From: support Date: Thu, 26 Jan 2023 17:46:24 +0000 (+0000) Subject: Built motion from commit ff426b3f.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=7013d158f95526aa6bfe24d5c816320a8fc7f076;p=motion2.git Built motion from commit ff426b3f.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index a579fd7..4cb3ae8 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-26T17:14:10.723Z", + "time": "2023-01-26T17:37:48.491Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 66a40da..9a6f818 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-26T17:14:10.723Z", + "time": "2023-01-26T17:37:48.491Z", "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 6f08088..962aef4 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 _0xb70c=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb70c,0x1e0));var _0xcb70=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xb70c[_0x454018];return _0x24697d;};'use strict';var Sequelize=require(_0xcb70('0x0'));module[_0xcb70('0x1')]={'name':{'type':Sequelize[_0xcb70('0x2')],'get':function(_0xebe80a){return this['getDataValue'](_0xcb70('0x3'));}},'action':{'type':Sequelize[_0xcb70('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xcb70('0x5'),_0xcb70('0x6'),_0xcb70('0x7'),_0xcb70('0x8'),_0xcb70('0x9'),_0xcb70('0xa'),_0xcb70('0xb'),_0xcb70('0xc')]],'msg':_0xcb70('0xd')}},'comment':_0xcb70('0xd')},'data1':{'type':Sequelize[_0xcb70('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xcb70('0x4')](0x1000),'comment':_0xcb70('0xe')},'data3':{'type':Sequelize[_0xcb70('0x4')](0x1000),'comment':_0xcb70('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xcb70('0x4')](0x1000),'comments':_0xcb70('0x10')},'data6':{'type':Sequelize[_0xcb70('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xcb70('0x11')],'comments':_0xcb70('0x12')}}; \ No newline at end of file +var _0x7293=['contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x5c06b2,_0x3dcc51){var _0x126942=function(_0x1daa71){while(--_0x1daa71){_0x5c06b2['push'](_0x5c06b2['shift']());}};_0x126942(++_0x3dcc51);}(_0x7293,0xd6));var _0x3729=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7293[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x3729('0x0')]={'name':{'type':Sequelize[_0x3729('0x1')],'get':function(_0x151055){return this[_0x3729('0x2')](_0x3729('0x3'));}},'action':{'type':Sequelize[_0x3729('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3729('0x5'),_0x3729('0x6'),_0x3729('0x7'),_0x3729('0x8'),_0x3729('0x9'),_0x3729('0xa'),_0x3729('0xb'),_0x3729('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x3729('0xd')},'data1':{'type':Sequelize[_0x3729('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x3729('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3729('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x3729('0xf')},'data5':{'type':Sequelize[_0x3729('0x4')](0x1000),'comments':_0x3729('0x10')},'data6':{'type':Sequelize[_0x3729('0x4')],'comments':_0x3729('0x11')},'data7':{'type':Sequelize[_0x3729('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 66d2cb8..70b59e3 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 _0x64a0=['jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','body','Action','find','params','then','catch','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x71b177,_0x248a33){var _0x4c7363=function(_0x40fd6c){while(--_0x40fd6c){_0x71b177['push'](_0x71b177['shift']());}};_0x4c7363(++_0x248a33);}(_0x64a0,0xe3));var _0x064a=function(_0xa339a9,_0x342371){_0xa339a9=_0xa339a9-0x0;var _0x125a36=_0x64a0[_0xa339a9];return _0x125a36;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x064a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x064a('0x1'));var BPromise=require(_0x064a('0x2'));var Mustache=require(_0x064a('0x3'));var util=require(_0x064a('0x4'));var path=require(_0x064a('0x5'));var sox=require(_0x064a('0x6'));var csv=require(_0x064a('0x7'));var ejs=require(_0x064a('0x8'));var fs=require('fs');var fs_extra=require(_0x064a('0x9'));var _=require(_0x064a('0xa'));var squel=require(_0x064a('0xb'));var crypto=require(_0x064a('0xc'));var jsforce=require(_0x064a('0xd'));var deskjs=require(_0x064a('0xe'));var toCsv=require(_0x064a('0x7'));var querystring=require(_0x064a('0xf'));var Papa=require('papaparse');var Redis=require(_0x064a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x064a('0x11'));var as=require(_0x064a('0x12'));var hardwareService=require(_0x064a('0x13'));var logger=require(_0x064a('0x14'))(_0x064a('0x15'));var utils=require(_0x064a('0x16'));var config=require(_0x064a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x064a('0x18'))['db'];function respondWithStatusCode(_0x54c308,_0x58298b){_0x58298b=_0x58298b||0xcc;return function(_0xb14288){if(_0xb14288){return _0x54c308[_0x064a('0x19')](_0x58298b);}return _0x54c308[_0x064a('0x1a')](_0x58298b)['end']();};}function respondWithResult(_0x1004b0,_0x15e95c){_0x15e95c=_0x15e95c||0xc8;return function(_0x162b60){if(_0x162b60){return _0x1004b0['status'](_0x15e95c)[_0x064a('0x1b')](_0x162b60);}};}function respondWithFilteredResult(_0x96f403,_0x195c7f){return function(_0x402753){if(_0x402753){var _0x2d37cf=typeof _0x195c7f[_0x064a('0x1c')]==='undefined'&&typeof _0x195c7f[_0x064a('0x1d')]===_0x064a('0x1e');var _0x5b2059=_0x402753[_0x064a('0x1f')];var _0x561b59=_0x2d37cf?0x0:_0x195c7f['offset'];var _0xd569b3=_0x2d37cf?_0x402753[_0x064a('0x1f')]:_0x195c7f[_0x064a('0x1c')]+_0x195c7f['limit'];var _0x1814a7;if(_0xd569b3>=_0x5b2059){_0xd569b3=_0x5b2059;_0x1814a7=0xc8;}else{_0x1814a7=0xce;}_0x96f403[_0x064a('0x1a')](_0x1814a7);return _0x96f403['set'](_0x064a('0x20'),_0x561b59+'-'+_0xd569b3+'/'+_0x5b2059)[_0x064a('0x1b')](_0x402753);}return null;};}function patchUpdates(_0x1c289b){return function(_0x25989f){try{jsonpatch[_0x064a('0x21')](_0x25989f,_0x1c289b,!![]);}catch(_0x2d76b5){return BPromise[_0x064a('0x22')](_0x2d76b5);}return _0x25989f[_0x064a('0x23')]();};}function saveUpdates(_0x1ec55c,_0x55dffb){return function(_0x309778){if(_0x309778){return _0x309778[_0x064a('0x24')](_0x1ec55c)['then'](function(_0x1ba57b){return _0x1ba57b;});}return null;};}function removeEntity(_0x33ace4,_0x429d96){return function(_0x47a84c){if(_0x47a84c){return _0x47a84c[_0x064a('0x25')]()['then'](function(){_0x33ace4[_0x064a('0x1a')](0xcc)[_0x064a('0x26')]();});}};}function handleEntityNotFound(_0x13c172,_0x4054d2){return function(_0x23207c){if(!_0x23207c){_0x13c172[_0x064a('0x19')](0x194);}return _0x23207c;};}function handleError(_0x3079d9,_0x364500){_0x364500=_0x364500||0x1f4;return function(_0x2ed3d6){logger[_0x064a('0x27')](_0x2ed3d6[_0x064a('0x28')]);if(_0x2ed3d6['name']){delete _0x2ed3d6[_0x064a('0x29')];}_0x3079d9[_0x064a('0x1a')](_0x364500)['send'](_0x2ed3d6);};}exports[_0x064a('0x24')]=function(_0x18cc92,_0xc5dfe){if(_0x18cc92[_0x064a('0x2a')]['id']){delete _0x18cc92[_0x064a('0x2a')]['id'];}return db[_0x064a('0x2b')][_0x064a('0x2c')]({'where':{'id':_0x18cc92[_0x064a('0x2d')]['id']}})[_0x064a('0x2e')](handleEntityNotFound(_0xc5dfe,null))['then'](saveUpdates(_0x18cc92[_0x064a('0x2a')],null))['then'](respondWithResult(_0xc5dfe,null))[_0x064a('0x2f')](handleError(_0xc5dfe,null));};exports[_0x064a('0x25')]=function(_0x183173,_0x5dbb2c){return db[_0x064a('0x2b')][_0x064a('0x2c')]({'where':{'id':_0x183173[_0x064a('0x2d')]['id']}})[_0x064a('0x2e')](handleEntityNotFound(_0x5dbb2c,null))[_0x064a('0x2e')](removeEntity(_0x5dbb2c,null))[_0x064a('0x2f')](handleError(_0x5dbb2c,null));}; \ No newline at end of file +var _0xabac=['Content-Range','json','apply','reject','save','then','destroy','error','stack','name','update','body','Action','find','params','eml-format','rimraf','zip-dir','mustache','util','path','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set'];(function(_0x1c083c,_0x20b324){var _0x412b21=function(_0x388dc7){while(--_0x388dc7){_0x1c083c['push'](_0x1c083c['shift']());}};_0x412b21(++_0x20b324);}(_0xabac,0x1dd));var _0xcaba=function(_0x1eb18c,_0x4860ae){_0x1eb18c=_0x1eb18c-0x0;var _0x2eb78a=_0xabac[_0x1eb18c];return _0x2eb78a;};'use strict';var emlformat=require(_0xcaba('0x0'));var rimraf=require(_0xcaba('0x1'));var zipdir=require(_0xcaba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcaba('0x3'));var util=require(_0xcaba('0x4'));var path=require(_0xcaba('0x5'));var sox=require('sox');var csv=require(_0xcaba('0x6'));var ejs=require(_0xcaba('0x7'));var fs=require('fs');var fs_extra=require(_0xcaba('0x8'));var _=require('lodash');var squel=require(_0xcaba('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcaba('0x6'));var querystring=require(_0xcaba('0xa'));var Papa=require(_0xcaba('0xb'));var Redis=require('ioredis');var authService=require(_0xcaba('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcaba('0xd'));var logger=require('../../config/logger')(_0xcaba('0xe'));var utils=require(_0xcaba('0xf'));var config=require(_0xcaba('0x10'));var licenseUtil=require(_0xcaba('0x11'));var db=require(_0xcaba('0x12'))['db'];function respondWithStatusCode(_0x329b3f,_0x1b1bd8){_0x1b1bd8=_0x1b1bd8||0xcc;return function(_0x52fe2f){if(_0x52fe2f){return _0x329b3f[_0xcaba('0x13')](_0x1b1bd8);}return _0x329b3f[_0xcaba('0x14')](_0x1b1bd8)[_0xcaba('0x15')]();};}function respondWithResult(_0x4b4554,_0x32a279){_0x32a279=_0x32a279||0xc8;return function(_0x5d3911){if(_0x5d3911){return _0x4b4554['status'](_0x32a279)['json'](_0x5d3911);}};}function respondWithFilteredResult(_0x16ab1e,_0x3c6ae7){return function(_0x340993){if(_0x340993){var _0x7bd979=typeof _0x3c6ae7['offset']===_0xcaba('0x16')&&typeof _0x3c6ae7[_0xcaba('0x17')]===_0xcaba('0x16');var _0x3034e6=_0x340993[_0xcaba('0x18')];var _0x32b98f=_0x7bd979?0x0:_0x3c6ae7[_0xcaba('0x19')];var _0x5a8407=_0x7bd979?_0x340993[_0xcaba('0x18')]:_0x3c6ae7[_0xcaba('0x19')]+_0x3c6ae7[_0xcaba('0x17')];var _0xdec068;if(_0x5a8407>=_0x3034e6){_0x5a8407=_0x3034e6;_0xdec068=0xc8;}else{_0xdec068=0xce;}_0x16ab1e[_0xcaba('0x14')](_0xdec068);return _0x16ab1e[_0xcaba('0x1a')](_0xcaba('0x1b'),_0x32b98f+'-'+_0x5a8407+'/'+_0x3034e6)[_0xcaba('0x1c')](_0x340993);}return null;};}function patchUpdates(_0x24ba81){return function(_0x2a53bf){try{jsonpatch[_0xcaba('0x1d')](_0x2a53bf,_0x24ba81,!![]);}catch(_0x538bff){return BPromise[_0xcaba('0x1e')](_0x538bff);}return _0x2a53bf[_0xcaba('0x1f')]();};}function saveUpdates(_0x269534,_0x3384e7){return function(_0xc09e81){if(_0xc09e81){return _0xc09e81['update'](_0x269534)[_0xcaba('0x20')](function(_0x1ee0c9){return _0x1ee0c9;});}return null;};}function removeEntity(_0x5540d8,_0x28f90f){return function(_0x229d18){if(_0x229d18){return _0x229d18[_0xcaba('0x21')]()[_0xcaba('0x20')](function(){_0x5540d8[_0xcaba('0x14')](0xcc)[_0xcaba('0x15')]();});}};}function handleEntityNotFound(_0x393cdd,_0x1b0a49){return function(_0x1fd7da){if(!_0x1fd7da){_0x393cdd[_0xcaba('0x13')](0x194);}return _0x1fd7da;};}function handleError(_0x3c7051,_0x240342){_0x240342=_0x240342||0x1f4;return function(_0x16e7ee){logger[_0xcaba('0x22')](_0x16e7ee[_0xcaba('0x23')]);if(_0x16e7ee[_0xcaba('0x24')]){delete _0x16e7ee[_0xcaba('0x24')];}_0x3c7051[_0xcaba('0x14')](_0x240342)['send'](_0x16e7ee);};}exports[_0xcaba('0x25')]=function(_0x2c3977,_0x43e210){if(_0x2c3977[_0xcaba('0x26')]['id']){delete _0x2c3977[_0xcaba('0x26')]['id'];}return db[_0xcaba('0x27')][_0xcaba('0x28')]({'where':{'id':_0x2c3977[_0xcaba('0x29')]['id']}})[_0xcaba('0x20')](handleEntityNotFound(_0x43e210,null))['then'](saveUpdates(_0x2c3977['body'],null))[_0xcaba('0x20')](respondWithResult(_0x43e210,null))['catch'](handleError(_0x43e210,null));};exports[_0xcaba('0x21')]=function(_0xebef53,_0x955d30){return db['Action'][_0xcaba('0x28')]({'where':{'id':_0xebef53[_0xcaba('0x29')]['id']}})[_0xcaba('0x20')](handleEntityNotFound(_0x955d30,null))[_0xcaba('0x20')](removeEntity(_0x955d30,null))['catch'](handleError(_0x955d30,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 0300f28..2201d65 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 _0x9f91=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x9f91,0x1e0));var _0x19f9=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0x9f91[_0x2bda14];return _0xb5dd49;};'use strict';var _=require(_0x19f9('0x0'));var util=require(_0x19f9('0x1'));var logger=require(_0x19f9('0x2'))(_0x19f9('0x3'));var moment=require(_0x19f9('0x4'));var BPromise=require('bluebird');var rp=require(_0x19f9('0x5'));var fs=require('fs');var path=require(_0x19f9('0x6'));var rimraf=require('rimraf');var config=require(_0x19f9('0x7'));var attributes=require(_0x19f9('0x8'));module[_0x19f9('0x9')]=function(_0x3ebea0,_0x17a8a6){return _0x3ebea0[_0x19f9('0xa')](_0x19f9('0xb'),attributes,{'tableName':_0x19f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4487=['rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','moment','bluebird','path'];(function(_0xeb48fa,_0xb4ee28){var _0xc91134=function(_0x7e3f3){while(--_0x7e3f3){_0xeb48fa['push'](_0xeb48fa['shift']());}};_0xc91134(++_0xb4ee28);}(_0x4487,0x11b));var _0x7448=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4487[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7448('0x0'));var util=require('util');var logger=require(_0x7448('0x1'))('api');var moment=require(_0x7448('0x2'));var BPromise=require(_0x7448('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7448('0x4'));var rimraf=require(_0x7448('0x5'));var config=require(_0x7448('0x6'));var attributes=require(_0x7448('0x7'));module[_0x7448('0x8')]=function(_0x29ab25,_0x423bf9){return _0x29ab25[_0x7448('0x9')](_0x7448('0xa'),attributes,{'tableName':_0x7448('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index d8bac57..24ae0b2 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x1cb9,0x14e));var _0x91cb=function(_0x297138,_0x2c347e){_0x297138=_0x297138-0x0;var _0x25cf6d=_0x1cb9[_0x297138];return _0x25cf6d;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3c0051,_0x51f6db){var _0x543886=function(_0x5180b9){while(--_0x5180b9){_0x3c0051['push'](_0x3c0051['shift']());}};_0x543886(++_0x51f6db);}(_0x5fc3,0xa8));var _0x35fc=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0x5fc3[_0x375492];return _0x18ba5b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 16647f7..1cd19b9 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 _0xd9cb=['/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update'];(function(_0x37cc52,_0x459a9b){var _0x2b4a90=function(_0xabcfc7){while(--_0xabcfc7){_0x37cc52['push'](_0x37cc52['shift']());}};_0x2b4a90(++_0x459a9b);}(_0xd9cb,0x14d));var _0xbd9c=function(_0x373447,_0x32a264){_0x373447=_0x373447-0x0;var _0x283e0b=_0xd9cb[_0x373447];return _0x283e0b;};'use strict';var multer=require('multer');var util=require(_0xbd9c('0x0'));var path=require(_0xbd9c('0x1'));var timeout=require(_0xbd9c('0x2'));var express=require(_0xbd9c('0x3'));var router=express[_0xbd9c('0x4')]();var fs_extra=require(_0xbd9c('0x5'));var auth=require(_0xbd9c('0x6'));var interaction=require(_0xbd9c('0x7'));var config=require(_0xbd9c('0x8'));var controller=require(_0xbd9c('0x9'));router['put']('/:id',auth[_0xbd9c('0xa')](),controller[_0xbd9c('0xb')]);router['delete'](_0xbd9c('0xc'),auth[_0xbd9c('0xa')](),controller[_0xbd9c('0xd')]);module[_0xbd9c('0xe')]=router; \ No newline at end of file +var _0x8d37=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x2ef691,_0x1af14d){var _0x399d1a=function(_0x48ddbb){while(--_0x48ddbb){_0x2ef691['push'](_0x2ef691['shift']());}};_0x399d1a(++_0x1af14d);}(_0x8d37,0x111));var _0x78d3=function(_0x25c8af,_0x74b7f8){_0x25c8af=_0x25c8af-0x0;var _0x36f703=_0x8d37[_0x25c8af];return _0x36f703;};'use strict';var multer=require(_0x78d3('0x0'));var util=require(_0x78d3('0x1'));var path=require(_0x78d3('0x2'));var timeout=require(_0x78d3('0x3'));var express=require(_0x78d3('0x4'));var router=express['Router']();var fs_extra=require(_0x78d3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x78d3('0x6'));var config=require(_0x78d3('0x7'));var controller=require(_0x78d3('0x8'));router[_0x78d3('0x9')](_0x78d3('0xa'),auth[_0x78d3('0xb')](),controller[_0x78d3('0xc')]);router['delete'](_0x78d3('0xa'),auth[_0x78d3('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 00ba690..234b046 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 _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x143679,_0x25a0a1){var _0x109767=function(_0x4ceee5){while(--_0x4ceee5){_0x143679['push'](_0x143679['shift']());}};_0x109767(++_0x25a0a1);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x46a8c7,_0x72d945){_0x46a8c7=_0x46a8c7-0x0;var _0x2542cd=_0x9c5a[_0x46a8c7];return _0x2542cd;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4819=['TEXT','exports','STRING'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0x4819,0xcd));var _0x9481=function(_0x223b71,_0x597bfb){_0x223b71=_0x223b71-0x0;var _0x4131e4=_0x4819[_0x223b71];return _0x4131e4;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 995047f..d6d9058 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 _0x1a40=['.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','keyBy','metric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','reject','save','update','then','get','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','getFields','ValidationErrorItem','order','alias','output','web','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a40,0xb7));var _0x01a4=function(_0x4006f7,_0x2b1071){_0x4006f7=_0x4006f7-0x0;var _0x8aa156=_0x1a40[_0x4006f7];return _0x8aa156;};'use strict';var emlformat=require(_0x01a4('0x0'));var rimraf=require(_0x01a4('0x1'));var zipdir=require(_0x01a4('0x2'));var jsonpatch=require(_0x01a4('0x3'));var rp=require(_0x01a4('0x4'));var moment=require(_0x01a4('0x5'));var BPromise=require(_0x01a4('0x6'));var Mustache=require(_0x01a4('0x7'));var util=require(_0x01a4('0x8'));var path=require(_0x01a4('0x9'));var sox=require(_0x01a4('0xa'));var csv=require(_0x01a4('0xb'));var ejs=require(_0x01a4('0xc'));var fs=require('fs');var fs_extra=require(_0x01a4('0xd'));var _=require(_0x01a4('0xe'));var squel=require(_0x01a4('0xf'));var crypto=require(_0x01a4('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x01a4('0x11'));var toCsv=require(_0x01a4('0xb'));var querystring=require(_0x01a4('0x12'));var Papa=require(_0x01a4('0x13'));var Redis=require(_0x01a4('0x14'));var authService=require(_0x01a4('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x01a4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01a4('0x17'))(_0x01a4('0x18'));var utils=require('../../config/utils');var config=require(_0x01a4('0x19'));var licenseUtil=require(_0x01a4('0x1a'));var db=require(_0x01a4('0x1b'))['db'];var dbH=require(_0x01a4('0x1b'))[_0x01a4('0x1c')];function respondWithStatusCode(_0x355100,_0x4bb212){_0x4bb212=_0x4bb212||0xcc;return function(_0x1f701d){if(_0x1f701d){return _0x355100[_0x01a4('0x1d')](_0x4bb212);}return _0x355100[_0x01a4('0x1e')](_0x4bb212)[_0x01a4('0x1f')]();};}function respondWithResult(_0x378625,_0x1abcdf){_0x1abcdf=_0x1abcdf||0xc8;return function(_0x3f3cf1){if(_0x3f3cf1){return _0x378625['status'](_0x1abcdf)['json'](_0x3f3cf1);}};}function respondWithFilteredResult(_0x480a2d,_0x4388cb){return function(_0x22893f){if(_0x22893f){var _0x8327b5=typeof _0x4388cb['offset']===_0x01a4('0x20')&&typeof _0x4388cb[_0x01a4('0x21')]==='undefined';var _0x22c142=_0x22893f['count'];var _0x56ce9a=_0x8327b5?0x0:_0x4388cb[_0x01a4('0x22')];var _0x3c5930=_0x8327b5?_0x22893f[_0x01a4('0x23')]:_0x4388cb['offset']+_0x4388cb[_0x01a4('0x21')];var _0x32c076;if(_0x3c5930>=_0x22c142){_0x3c5930=_0x22c142;_0x32c076=0xc8;}else{_0x32c076=0xce;}_0x480a2d[_0x01a4('0x1e')](_0x32c076);return _0x480a2d['set'](_0x01a4('0x24'),_0x56ce9a+'-'+_0x3c5930+'/'+_0x22c142)[_0x01a4('0x25')](_0x22893f);}return null;};}function patchUpdates(_0x5a127f){return function(_0x417c1b){try{jsonpatch['apply'](_0x417c1b,_0x5a127f,!![]);}catch(_0x43270a){return BPromise[_0x01a4('0x26')](_0x43270a);}return _0x417c1b[_0x01a4('0x27')]();};}function saveUpdates(_0x46fafd,_0x5076e5){return function(_0x3a2993){if(_0x3a2993){return _0x3a2993[_0x01a4('0x28')](_0x46fafd)[_0x01a4('0x29')](function(_0x4063a0){return _0x4063a0;});}return null;};}function removeEntity(_0x31860f,_0x1ff82a){return function(_0x1977f1){if(_0x1977f1){return _0x1977f1['destroy']()[_0x01a4('0x29')](function(){var _0x216810=_0x1977f1[_0x01a4('0x2a')]({'plain':!![]});var _0x53a8d5='CustomReports';return db[_0x01a4('0x2b')]['destroy']({'where':{'type':_0x53a8d5,'resourceId':_0x216810['id']}})['then'](function(){return _0x1977f1;});})[_0x01a4('0x29')](function(){_0x31860f[_0x01a4('0x1e')](0xcc)[_0x01a4('0x1f')]();});}};}function handleEntityNotFound(_0x4249e7,_0x3007f8){return function(_0x2aab8b){if(!_0x2aab8b){_0x4249e7[_0x01a4('0x1d')](0x194);}return _0x2aab8b;};}function handleError(_0x1fcd57,_0x3d4085){_0x3d4085=_0x3d4085||0x1f4;return function(_0x449b12){logger['error'](_0x449b12[_0x01a4('0x2c')]);if(_0x449b12[_0x01a4('0x2d')]){delete _0x449b12[_0x01a4('0x2d')];}_0x1fcd57[_0x01a4('0x1e')](_0x3d4085)[_0x01a4('0x2e')](_0x449b12);};}exports[_0x01a4('0x2f')]=function(_0x2a61ed,_0x2c824f){var _0xc5ea13={},_0x343c9a={},_0x3ee4f0={'count':0x0,'rows':[]};var _0x3e006c=_['map'](db['AnalyticCustomReport'][_0x01a4('0x30')],function(_0x35da28){return{'name':_0x35da28[_0x01a4('0x31')],'type':_0x35da28[_0x01a4('0x32')][_0x01a4('0x33')]};});_0x343c9a[_0x01a4('0x34')]=_[_0x01a4('0x35')](_0x3e006c,'name');_0x343c9a[_0x01a4('0x36')]=_[_0x01a4('0x37')](_0x2a61ed[_0x01a4('0x36')]);_0x343c9a[_0x01a4('0x38')]=_[_0x01a4('0x39')](_0x343c9a[_0x01a4('0x34')],_0x343c9a[_0x01a4('0x36')]);_0xc5ea13[_0x01a4('0x3a')]=_[_0x01a4('0x39')](_0x343c9a[_0x01a4('0x34')],qs[_0x01a4('0x3b')](_0x2a61ed[_0x01a4('0x36')][_0x01a4('0x3b')]));_0xc5ea13[_0x01a4('0x3a')]=_0xc5ea13[_0x01a4('0x3a')][_0x01a4('0x3c')]?_0xc5ea13[_0x01a4('0x3a')]:_0x343c9a[_0x01a4('0x34')];if(!_0x2a61ed[_0x01a4('0x36')][_0x01a4('0x3d')](_0x01a4('0x3e'))){_0xc5ea13[_0x01a4('0x21')]=qs[_0x01a4('0x21')](_0x2a61ed[_0x01a4('0x36')][_0x01a4('0x21')]);_0xc5ea13[_0x01a4('0x22')]=qs[_0x01a4('0x22')](_0x2a61ed[_0x01a4('0x36')][_0x01a4('0x22')]);}_0xc5ea13['order']=qs[_0x01a4('0x3f')](_0x2a61ed[_0x01a4('0x36')][_0x01a4('0x3f')]);_0xc5ea13[_0x01a4('0x40')]=qs[_0x01a4('0x38')](_[_0x01a4('0x41')](_0x2a61ed[_0x01a4('0x36')],_0x343c9a[_0x01a4('0x38')]),_0x3e006c);if(_0x2a61ed['query'][_0x01a4('0x42')]){_0xc5ea13[_0x01a4('0x40')]=_[_0x01a4('0x43')](_0xc5ea13[_0x01a4('0x40')],{'$or':_[_0x01a4('0x35')](_0x3e006c,function(_0x54612a){if(_0x54612a[_0x01a4('0x32')]!==_0x01a4('0x44')){var _0xc38da0={};_0xc38da0[_0x54612a[_0x01a4('0x2d')]]={'$like':'%'+_0x2a61ed[_0x01a4('0x36')][_0x01a4('0x42')]+'%'};return _0xc38da0;}})});}_0xc5ea13=_[_0x01a4('0x43')]({},_0xc5ea13,_0x2a61ed[_0x01a4('0x45')]);var _0x2a7e7c={'where':_0xc5ea13['where']};return db[_0x01a4('0x46')][_0x01a4('0x23')](_0x2a7e7c)['then'](function(_0x38a64d){_0x3ee4f0[_0x01a4('0x23')]=_0x38a64d;if(_0x2a61ed[_0x01a4('0x36')][_0x01a4('0x47')]){_0xc5ea13[_0x01a4('0x48')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x01a4('0x49')](_0xc5ea13);})[_0x01a4('0x29')](function(_0x1868bd){_0x3ee4f0['rows']=_0x1868bd;return _0x3ee4f0;})[_0x01a4('0x29')](respondWithFilteredResult(_0x2c824f,_0xc5ea13))[_0x01a4('0x4a')](handleError(_0x2c824f,null));};exports[_0x01a4('0x4b')]=function(_0x7ea729,_0x26a75e){var _0x3c5ff3={'raw':![],'where':{'id':_0x7ea729['params']['id']}},_0xd8f6a2={};_0xd8f6a2[_0x01a4('0x34')]=_[_0x01a4('0x37')](db['AnalyticCustomReport'][_0x01a4('0x30')]);_0xd8f6a2[_0x01a4('0x36')]=_[_0x01a4('0x37')](_0x7ea729[_0x01a4('0x36')]);_0xd8f6a2[_0x01a4('0x38')]=_['intersection'](_0xd8f6a2[_0x01a4('0x34')],_0xd8f6a2[_0x01a4('0x36')]);_0x3c5ff3[_0x01a4('0x3a')]=_[_0x01a4('0x39')](_0xd8f6a2[_0x01a4('0x34')],qs[_0x01a4('0x3b')](_0x7ea729[_0x01a4('0x36')][_0x01a4('0x3b')]));_0x3c5ff3[_0x01a4('0x3a')]=_0x3c5ff3[_0x01a4('0x3a')][_0x01a4('0x3c')]?_0x3c5ff3[_0x01a4('0x3a')]:_0xd8f6a2[_0x01a4('0x34')];if(_0x7ea729['query'][_0x01a4('0x47')]){_0x3c5ff3[_0x01a4('0x48')]=[{'all':!![]}];}_0x3c5ff3=_[_0x01a4('0x43')]({},_0x3c5ff3,_0x7ea729[_0x01a4('0x45')]);return db['AnalyticCustomReport'][_0x01a4('0x4c')](_0x3c5ff3)['then'](handleEntityNotFound(_0x26a75e,null))[_0x01a4('0x29')](respondWithResult(_0x26a75e,null))[_0x01a4('0x4a')](handleError(_0x26a75e,null));};exports[_0x01a4('0x4d')]=function(_0x35636a,_0xe78275){return db[_0x01a4('0x46')][_0x01a4('0x4d')](_0x35636a[_0x01a4('0x4e')],{})[_0x01a4('0x29')](function(_0x43227c){var _0x144507=_0x35636a[_0x01a4('0x4f')]['get']({'plain':!![]});if(!_0x144507)throw new Error(_0x01a4('0x50'));if(_0x144507['role']===_0x01a4('0x4f')){var _0x628eef=_0x43227c[_0x01a4('0x2a')]({'plain':!![]});var _0x5d1306=_0x01a4('0x51');return db['UserProfileSection'][_0x01a4('0x4c')]({'where':{'name':_0x5d1306,'userProfileId':_0x144507[_0x01a4('0x52')]},'raw':!![]})[_0x01a4('0x29')](function(_0x29b732){if(_0x29b732&&_0x29b732[_0x01a4('0x53')]===0x0){return db[_0x01a4('0x2b')][_0x01a4('0x4d')]({'name':_0x628eef[_0x01a4('0x2d')],'resourceId':_0x628eef['id'],'type':_0x01a4('0x54'),'sectionId':_0x29b732['id']},{})['then'](function(){return _0x43227c;});}else{return _0x43227c;}})[_0x01a4('0x4a')](function(_0x251bc8){logger[_0x01a4('0x55')](_0x01a4('0x56'),_0x251bc8);throw _0x251bc8;});}return _0x43227c;})[_0x01a4('0x29')](respondWithResult(_0xe78275,0xc9))[_0x01a4('0x4a')](handleError(_0xe78275,null));};exports[_0x01a4('0x28')]=function(_0x89af78,_0x4cec74){if(_0x89af78[_0x01a4('0x4e')]['id']){delete _0x89af78['body']['id'];}return db[_0x01a4('0x46')]['find']({'where':{'id':_0x89af78[_0x01a4('0x57')]['id']}})['then'](handleEntityNotFound(_0x4cec74,null))[_0x01a4('0x29')](saveUpdates(_0x89af78[_0x01a4('0x4e')],null))[_0x01a4('0x29')](respondWithResult(_0x4cec74,null))[_0x01a4('0x4a')](handleError(_0x4cec74,null));};exports[_0x01a4('0x58')]=function(_0x327309,_0x36c3bd){return db['AnalyticCustomReport'][_0x01a4('0x4c')]({'where':{'id':_0x327309[_0x01a4('0x57')]['id']}})[_0x01a4('0x29')](handleEntityNotFound(_0x36c3bd,null))[_0x01a4('0x29')](removeEntity(_0x36c3bd,null))[_0x01a4('0x4a')](handleError(_0x36c3bd,null));};exports['preview']=function(_0x23a8b0,_0x259012){var _0xc2443=0xa;var _0xd00fbe=[_0x01a4('0x59'),_0x01a4('0x5a'),_0x01a4('0x5b'),_0x01a4('0x5c')];var _0x131b37={'SUM':_0x01a4('0x5d'),'COUNT':_0x01a4('0x5e'),'COUNT DISTINCT':_0x01a4('0x5f'),'MAX':_0x01a4('0x60'),'MIN':_0x01a4('0x61'),'AVG':_0x01a4('0x62'),'GROUP_CONCAT':_0x01a4('0x63'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x01a4('0x64')};var _0xabd6b3={'SEC_TO_TIME':_0x01a4('0x65'),'DATE':_0x01a4('0x66'),'HOUR':_0x01a4('0x67'),'ROUND':_0x01a4('0x68'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x11204f=function(_0x1235d7){return!_[_0x01a4('0x69')](['IS\x20NULL',_0x01a4('0x6a'),'IS\x20EMPTY',_0x01a4('0x6b')],_0x1235d7);};var _0x1620bc=function(_0x1f1622){if(!_0x1f1622||!_0x1f1622[_0x01a4('0x6c')][_0x01a4('0x3c')]){return'';}for(var _0x5683d9='(',_0x4b5085=0x0;_0x4b5085<_0x1f1622[_0x01a4('0x6c')][_0x01a4('0x3c')];_0x4b5085+=0x1){_0x4b5085>0x0&&(_0x5683d9+='\x20'+_0x1f1622[_0x01a4('0x6d')]+'\x20');_0x5683d9+=_0x1f1622[_0x01a4('0x6c')][_0x4b5085][_0x01a4('0x6e')]?_0x1620bc(_0x1f1622[_0x01a4('0x6c')][_0x4b5085][_0x01a4('0x6e')]):_0x1f1622[_0x01a4('0x6c')][_0x4b5085][_0x01a4('0x6f')]+'\x20'+_0x1f1622[_0x01a4('0x6c')][_0x4b5085]['condition']+(_0x11204f(_0x1f1622['rules'][_0x4b5085][_0x01a4('0x70')])?'\x20'+_0x1f1622[_0x01a4('0x6c')][_0x4b5085]['value']:'');}return _0x5683d9+')';};var _0xaff13e={'where':{'id':_0x23a8b0[_0x01a4('0x57')]['id']}},_0xe0a06a,_0x4b2d73,_0x55d34c,_0x516b2b,_0x1dd208;_0xaff13e=_[_0x01a4('0x43')]({},_0xaff13e,_0x23a8b0[_0x01a4('0x45')]);return db['AnalyticCustomReport'][_0x01a4('0x4c')](_0xaff13e)[_0x01a4('0x29')](function(_0x278b0d){if(_0x278b0d){_0xe0a06a=_0x278b0d;return _0x278b0d['getFields']();}return null;})[_0x01a4('0x29')](function(_0x577158){if(_0x577158){if(!_0x577158[_0x01a4('0x3c')]){throw new db[(_0x01a4('0x71'))]['ValidationErrorItem'](_0x01a4('0x72'),0x193);}_0x4b2d73=_0x577158;return db[_0x01a4('0x73')][_0x01a4('0x49')]({'raw':!![]});}return null;})['then'](function(_0x4de351){if(_0x4de351){_0x55d34c=_['keyBy'](_0x4de351,'id');var _0x12f4dd;var _0x52013a=squel[_0x01a4('0x74')]();_0x52013a[_0x01a4('0x75')](_0xe0a06a[_0x01a4('0x76')]);for(var _0x3f91e8=0x0;_0x3f91e8<_0x4b2d73[_0x01a4('0x3c')];_0x3f91e8+=0x1){_0x12f4dd=_0x4b2d73[_0x3f91e8][_0x01a4('0x77')]?_0x55d34c[_0x4b2d73[_0x3f91e8][_0x01a4('0x77')]]['metric']:_0x4b2d73[_0x3f91e8][_0x01a4('0x6f')];_0x12f4dd=_0x4b2d73[_0x3f91e8][_0x01a4('0x78')]?_[_0x01a4('0x79')](_0x131b37[_0x4b2d73[_0x3f91e8][_0x01a4('0x78')]],'%s',_0x12f4dd):_0x12f4dd;_0x12f4dd=_0x4b2d73[_0x3f91e8][_0x01a4('0x7a')]?_[_0x01a4('0x79')](_0xabd6b3[_0x4b2d73[_0x3f91e8]['format']],'%s',_0x12f4dd):_0x12f4dd;if(_0x4b2d73[_0x3f91e8][_0x01a4('0x7b')]){_0x52013a['group'](_0x12f4dd);}_0x4b2d73[_0x3f91e8][_0x01a4('0x7c')]&&_0x52013a['order'](_0x12f4dd,_0x4b2d73[_0x3f91e8][_0x01a4('0x7c')]===_0x01a4('0x7d')?![]:!![]);_0x52013a[_0x01a4('0x6f')](_0x12f4dd,_0x4b2d73[_0x3f91e8]['alias']||_0x12f4dd);}if(_0xe0a06a[_0x01a4('0x7e')]){_0xe0a06a['joins']=JSON[_0x01a4('0x7f')](_0xe0a06a['joins']);for(var _0x3134e2=0x0;_0x3134e2<_0xe0a06a['joins'][_0x01a4('0x3c')];_0x3134e2+=0x1){if(_0xe0a06a['joins'][_0x3134e2][_0x01a4('0x32')]&&_[_0x01a4('0x69')](_0xd00fbe,_0xe0a06a[_0x01a4('0x7e')][_0x3134e2][_0x01a4('0x32')])&&_0xe0a06a[_0x01a4('0x7e')][_0x3134e2][_0x01a4('0x80')]&&_0xe0a06a['joins'][_0x3134e2][_0x01a4('0x81')]&&_0xe0a06a['joins'][_0x3134e2][_0x01a4('0x82')]){_0x52013a[_0xe0a06a['joins'][_0x3134e2]['type']](_0xe0a06a[_0x01a4('0x7e')][_0x3134e2][_0x01a4('0x81')],null,util[_0x01a4('0x7a')](_0x01a4('0x83'),_0xe0a06a[_0x01a4('0x76')],_0xe0a06a[_0x01a4('0x7e')][_0x3134e2][_0x01a4('0x80')],_0xe0a06a[_0x01a4('0x7e')][_0x3134e2]['foreignTable'],_0xe0a06a['joins'][_0x3134e2][_0x01a4('0x82')]));}}}if(_0xe0a06a[_0x01a4('0x84')]){_0xe0a06a[_0x01a4('0x84')]=JSON[_0x01a4('0x7f')](_0xe0a06a['conditions']);_0x52013a['where'](_0x1620bc(_0xe0a06a[_0x01a4('0x84')][_0x01a4('0x6e')]));}_0x1dd208=_0x52013a[_0x01a4('0x85')]();_0x52013a[_0x01a4('0x21')](_0xc2443);_0x52013a['offset'](0x0);logger[_0x01a4('0x86')](_0x01a4('0x87'),_0x52013a[_0x01a4('0x88')]());return dbH[_0x01a4('0x89')][_0x01a4('0x36')](_0x52013a[_0x01a4('0x88')](),{'type':dbH[_0x01a4('0x89')][_0x01a4('0x8a')][_0x01a4('0x8b')]});}})['then'](respondWithResult(_0x259012,null))[_0x01a4('0x4a')](handleError(_0x259012,null));};function runReport(_0x347182,_0x263486,_0x4a6257){var _0x33a993=_0x263486[_0x01a4('0x2d')];var _0x297bd9=0xa;var _0x24f3e5=[_0x01a4('0x59'),_0x01a4('0x5a'),'right_join',_0x01a4('0x5c')];var _0x513b4c={'SUM':'SUM(%s)','COUNT':_0x01a4('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x01a4('0x60'),'MIN':_0x01a4('0x61'),'AVG':_0x01a4('0x62'),'GROUP_CONCAT':_0x01a4('0x63'),'GROUP_CONCAT ASC':_0x01a4('0x8c'),'GROUP_CONCAT DESC':_0x01a4('0x64')};var _0x470f6d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x01a4('0x66'),'HOUR':'HOUR(%s)','ROUND':_0x01a4('0x68'),'UNIX_TIMESTAMP':_0x01a4('0x8d')};var _0x1185c5=function(_0x4e2393){return!_[_0x01a4('0x69')]([_0x01a4('0x8e'),'IS\x20NOT\x20NULL',_0x01a4('0x8f'),_0x01a4('0x6b')],_0x4e2393);};var _0x5d3d57=function(_0x2784d2){if(!_0x2784d2||!_0x2784d2[_0x01a4('0x6c')][_0x01a4('0x3c')]){return'';}for(var _0x1eaec3='(',_0x5569e3=0x0;_0x5569e3<_0x2784d2[_0x01a4('0x6c')][_0x01a4('0x3c')];_0x5569e3+=0x1){_0x5569e3>0x0&&(_0x1eaec3+='\x20'+_0x2784d2[_0x01a4('0x6d')]+'\x20');_0x1eaec3+=_0x2784d2[_0x01a4('0x6c')][_0x5569e3][_0x01a4('0x6e')]?_0x5d3d57(_0x2784d2['rules'][_0x5569e3]['group']):_0x2784d2[_0x01a4('0x6c')][_0x5569e3]['field']+'\x20'+_0x2784d2[_0x01a4('0x6c')][_0x5569e3][_0x01a4('0x70')]+(_0x1185c5(_0x2784d2[_0x01a4('0x6c')][_0x5569e3][_0x01a4('0x70')])?'\x20'+_0x2784d2[_0x01a4('0x6c')][_0x5569e3]['value']:'');}return _0x1eaec3+')';};var _0xd0aefc={'where':{'id':_0x347182['id']}},_0x1cde98,_0x2320cd,_0x548821,_0x1d01f6,_0x247271;_0xd0aefc=_[_0x01a4('0x43')]({},_0xd0aefc,_0x4a6257);return db['AnalyticCustomReport'][_0x01a4('0x4c')](_0xd0aefc)[_0x01a4('0x29')](function(_0x13aa65){if(_0x13aa65){_0x1cde98=_0x13aa65;return _0x13aa65[_0x01a4('0x90')]();}return null;})[_0x01a4('0x29')](function(_0x29d386){if(_0x29d386){if(!_0x29d386[_0x01a4('0x3c')]){throw new db['Sequelize'][(_0x01a4('0x91'))](_0x01a4('0x72'),0x193);}_0x2320cd=_0x29d386;return db[_0x01a4('0x73')][_0x01a4('0x49')]({'raw':!![]});}return null;})[_0x01a4('0x29')](function(_0x22a8a3){if(_0x22a8a3){_0x548821=_['keyBy'](_0x22a8a3,'id');var _0x22ab5a;var _0x9384d9=squel[_0x01a4('0x74')]();_0x9384d9['from'](_0x1cde98[_0x01a4('0x76')]);for(var _0x105bf2=0x0;_0x105bf2<_0x2320cd[_0x01a4('0x3c')];_0x105bf2+=0x1){_0x22ab5a=_0x2320cd[_0x105bf2][_0x01a4('0x77')]?_0x548821[_0x2320cd[_0x105bf2][_0x01a4('0x77')]]['metric']:_0x2320cd[_0x105bf2][_0x01a4('0x6f')];_0x22ab5a=_0x2320cd[_0x105bf2][_0x01a4('0x78')]?_['replace'](_0x513b4c[_0x2320cd[_0x105bf2][_0x01a4('0x78')]],'%s',_0x22ab5a):_0x22ab5a;_0x22ab5a=_0x2320cd[_0x105bf2][_0x01a4('0x7a')]?_[_0x01a4('0x79')](_0x470f6d[_0x2320cd[_0x105bf2]['format']],'%s',_0x22ab5a):_0x22ab5a;if(_0x2320cd[_0x105bf2][_0x01a4('0x7b')]){_0x9384d9[_0x01a4('0x6e')](_0x22ab5a);}_0x2320cd[_0x105bf2][_0x01a4('0x7c')]&&_0x9384d9[_0x01a4('0x92')](_0x22ab5a,_0x2320cd[_0x105bf2][_0x01a4('0x7c')]==='DESC'?![]:!![]);_0x9384d9[_0x01a4('0x6f')](_0x22ab5a,_0x2320cd[_0x105bf2][_0x01a4('0x93')]||_0x22ab5a);}if(_0x1cde98['joins']){_0x1cde98[_0x01a4('0x7e')]=JSON[_0x01a4('0x7f')](_0x1cde98[_0x01a4('0x7e')]);for(var _0x365276=0x0;_0x365276<_0x1cde98[_0x01a4('0x7e')][_0x01a4('0x3c')];_0x365276+=0x1){if(_0x1cde98['joins'][_0x365276][_0x01a4('0x32')]&&_[_0x01a4('0x69')](_0x24f3e5,_0x1cde98[_0x01a4('0x7e')][_0x365276]['type'])&&_0x1cde98[_0x01a4('0x7e')][_0x365276][_0x01a4('0x80')]&&_0x1cde98[_0x01a4('0x7e')][_0x365276][_0x01a4('0x81')]&&_0x1cde98['joins'][_0x365276][_0x01a4('0x82')]){_0x9384d9[_0x1cde98['joins'][_0x365276][_0x01a4('0x32')]](_0x1cde98[_0x01a4('0x7e')][_0x365276]['foreignTable'],null,util[_0x01a4('0x7a')](_0x01a4('0x83'),_0x1cde98[_0x01a4('0x76')],_0x1cde98[_0x01a4('0x7e')][_0x365276]['parentKey'],_0x1cde98['joins'][_0x365276]['foreignTable'],_0x1cde98['joins'][_0x365276][_0x01a4('0x82')]));}}}if(_0x1cde98['conditions']){_0x1cde98[_0x01a4('0x84')]=JSON[_0x01a4('0x7f')](_0x1cde98[_0x01a4('0x84')]);_0x9384d9[_0x01a4('0x40')](_0x5d3d57(_0x1cde98[_0x01a4('0x84')][_0x01a4('0x6e')]));}_0x247271=_0x9384d9['clone']();_0x9384d9[_0x01a4('0x21')](_0x297bd9);_0x9384d9[_0x01a4('0x22')](0x0);return;}})[_0x01a4('0x29')](function(){if(_0x263486[_0x01a4('0x94')]===_0x01a4('0x95')){return null;}var _0x58dd51=_[_0x01a4('0x43')](_0x263486,{'name':_0x263486['fullPath']||_0x263486[_0x01a4('0x2d')]||_0x1cde98['name'],'basename':_0x33a993,'savename':util['format'](_0x01a4('0x96'),_0x263486[_0x01a4('0x2d')]||_0x1cde98[_0x01a4('0x2d')],require(_0x01a4('0x97'))[_0x01a4('0x98')](0x4),_0x263486[_0x01a4('0x94')]||_0x01a4('0x99')),'reportId':_0x1cde98['id'],'reportType':'custom'});return db[_0x01a4('0x9a')][_0x01a4('0x4d')](_0x58dd51,{'raw':!![]});})[_0x01a4('0x29')](function(_0x2656b1){if(_0x1cde98[_0x01a4('0x76')]===_0x01a4('0x9b')){_0x247271[_0x01a4('0x40')](_0x1cde98[_0x01a4('0x76')]+_0x01a4('0x9c'),_0x263486[_0x01a4('0x9d')],_0x263486[_0x01a4('0x9e')]);}else{_0x247271[_0x01a4('0x40')](_0x1cde98[_0x01a4('0x76')]+_0x01a4('0x9f'),_0x263486[_0x01a4('0x9d')],_0x263486['endDate']);}if(_0x2656b1){logger[_0x01a4('0xa0')](_0x01a4('0xa1'),_0x247271[_0x01a4('0x88')]());require(_0x01a4('0xa2'))['fork'](path['join'](__dirname,_0x01a4('0xa3'),_0x2656b1[_0x01a4('0x94')]),[_0x2656b1['id'],_0x247271[_0x01a4('0x88')](),path[_0x01a4('0x59')](__dirname,_0x01a4('0xa4'),_0x2656b1[_0x01a4('0xa5')]),_0x33a993]);return _0x2656b1;}else{var _0x1af3d5=squel[_0x01a4('0x74')]();_0x1af3d5[_0x01a4('0x75')]('('+_0x247271[_0x01a4('0x88')]()+')',_0x01a4('0xa6'));_0x1af3d5[_0x01a4('0x6f')](_0x01a4('0xa7'),_0x01a4('0x23'));_0x247271[_0x01a4('0x21')](_0x263486[_0x01a4('0x21')]||_0x297bd9);_0x247271[_0x01a4('0x22')](_0x263486[_0x01a4('0x22')]||0x0);return dbH[_0x01a4('0x89')][_0x01a4('0x36')](_0x1af3d5[_0x01a4('0x88')](),{'type':dbH[_0x01a4('0x89')][_0x01a4('0x8a')][_0x01a4('0x8b')]})['then'](function(_0x3ca6ab){if(!_0x3ca6ab[_0x01a4('0x3c')]){_0x1d01f6=0x0;}else{_0x1d01f6=_0x3ca6ab[0x0][_0x01a4('0x23')]||0x0;}return dbH[_0x01a4('0x89')]['query'](_0x247271['toString'](),{'type':dbH[_0x01a4('0x89')][_0x01a4('0x8a')][_0x01a4('0x8b')]});})['then'](function(_0x4e001b){return{'rows':_0x4e001b||[],'count':_0x1d01f6};});}});}exports[_0x01a4('0xa8')]=function(_0x4cf1e8,_0x28d6a5){return runReport(_0x4cf1e8[_0x01a4('0x57')],_0x4cf1e8[_0x01a4('0x36')],_0x4cf1e8[_0x01a4('0x45')])[_0x01a4('0x29')](respondWithResult(_0x28d6a5,null))[_0x01a4('0x4a')](handleError(_0x28d6a5,null));};exports['runReport']=runReport;exports[_0x01a4('0x36')]=function(_0xf46ecb,_0x5bfe71){var _0x105f99=0xa;var _0x57343f=[_0x01a4('0x59'),_0x01a4('0x5a'),_0x01a4('0x5b'),_0x01a4('0x5c')];var _0x3a67f6={'SUM':_0x01a4('0x5d'),'COUNT':_0x01a4('0x5e'),'COUNT DISTINCT':_0x01a4('0x5f'),'MAX':_0x01a4('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x01a4('0x63'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x01a4('0x64')};var _0x91248b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x01a4('0x66'),'HOUR':_0x01a4('0x67'),'ROUND':_0x01a4('0x68'),'UNIX_TIMESTAMP':_0x01a4('0x8d')};var _0x3adc67=function(_0x17f8f1){return!_[_0x01a4('0x69')]([_0x01a4('0x8e'),_0x01a4('0x6a'),_0x01a4('0x8f'),_0x01a4('0x6b')],_0x17f8f1);};var _0x2a445c=function(_0x1b446c){if(!_0x1b446c||!_0x1b446c[_0x01a4('0x6c')]['length']){return'';}for(var _0x46f7b5='(',_0x56c4e7=0x0;_0x56c4e7<_0x1b446c['rules'][_0x01a4('0x3c')];_0x56c4e7+=0x1){_0x56c4e7>0x0&&(_0x46f7b5+='\x20'+_0x1b446c['operator']+'\x20');_0x46f7b5+=_0x1b446c[_0x01a4('0x6c')][_0x56c4e7]['group']?_0x2a445c(_0x1b446c['rules'][_0x56c4e7][_0x01a4('0x6e')]):_0x1b446c['rules'][_0x56c4e7][_0x01a4('0x6f')]+'\x20'+_0x1b446c[_0x01a4('0x6c')][_0x56c4e7][_0x01a4('0x70')]+(_0x3adc67(_0x1b446c[_0x01a4('0x6c')][_0x56c4e7][_0x01a4('0x70')])?'\x20'+_0x1b446c['rules'][_0x56c4e7]['value']:'');}return _0x46f7b5+')';};var _0x52f8fb={'where':{'id':_0xf46ecb[_0x01a4('0x57')]['id']}},_0x5a700e,_0x555e4b,_0x5b4689,_0x11d909,_0x33cf8a;_0x52f8fb=_[_0x01a4('0x43')]({},_0x52f8fb,_0xf46ecb[_0x01a4('0x45')]);return db['AnalyticCustomReport'][_0x01a4('0x4c')](_0x52f8fb)[_0x01a4('0x29')](function(_0x5458cb){if(_0x5458cb){_0x5a700e=_0x5458cb;return _0x5458cb[_0x01a4('0x90')]();}return null;})['then'](function(_0x3eb1fa){if(_0x3eb1fa){if(!_0x3eb1fa['length']){throw new db[(_0x01a4('0x71'))][(_0x01a4('0x91'))](_0x01a4('0x72'),0x193);}_0x555e4b=_0x3eb1fa;return db[_0x01a4('0x73')][_0x01a4('0x49')]({'raw':!![]});}return null;})[_0x01a4('0x29')](function(_0x57c2dc){if(_0x57c2dc){_0x5b4689=_[_0x01a4('0xa9')](_0x57c2dc,'id');var _0x58bd11;var _0x278e78=squel[_0x01a4('0x74')]();_0x278e78[_0x01a4('0x75')](_0x5a700e[_0x01a4('0x76')]);for(var _0x5f0dfb=0x0;_0x5f0dfb<_0x555e4b[_0x01a4('0x3c')];_0x5f0dfb+=0x1){_0x58bd11=_0x555e4b[_0x5f0dfb][_0x01a4('0x77')]?_0x5b4689[_0x555e4b[_0x5f0dfb][_0x01a4('0x77')]][_0x01a4('0xaa')]:_0x555e4b[_0x5f0dfb][_0x01a4('0x6f')];_0x58bd11=_0x555e4b[_0x5f0dfb][_0x01a4('0x78')]?_[_0x01a4('0x79')](_0x3a67f6[_0x555e4b[_0x5f0dfb][_0x01a4('0x78')]],'%s',_0x58bd11):_0x58bd11;_0x58bd11=_0x555e4b[_0x5f0dfb][_0x01a4('0x7a')]?_[_0x01a4('0x79')](_0x91248b[_0x555e4b[_0x5f0dfb][_0x01a4('0x7a')]],'%s',_0x58bd11):_0x58bd11;if(_0x555e4b[_0x5f0dfb][_0x01a4('0x7b')]){_0x278e78[_0x01a4('0x6e')](_0x58bd11);}_0x555e4b[_0x5f0dfb][_0x01a4('0x7c')]&&_0x278e78[_0x01a4('0x92')](_0x58bd11,_0x555e4b[_0x5f0dfb][_0x01a4('0x7c')]===_0x01a4('0x7d')?![]:!![]);_0x278e78[_0x01a4('0x6f')](_0x58bd11,_0x555e4b[_0x5f0dfb]['alias']||_0x58bd11);}if(_0x5a700e[_0x01a4('0x7e')]){_0x5a700e[_0x01a4('0x7e')]=JSON[_0x01a4('0x7f')](_0x5a700e[_0x01a4('0x7e')]);for(var _0x2dd49f=0x0;_0x2dd49f<_0x5a700e[_0x01a4('0x7e')][_0x01a4('0x3c')];_0x2dd49f+=0x1){if(_0x5a700e[_0x01a4('0x7e')][_0x2dd49f][_0x01a4('0x32')]&&_[_0x01a4('0x69')](_0x57343f,_0x5a700e[_0x01a4('0x7e')][_0x2dd49f]['type'])&&_0x5a700e[_0x01a4('0x7e')][_0x2dd49f]['parentKey']&&_0x5a700e[_0x01a4('0x7e')][_0x2dd49f][_0x01a4('0x81')]&&_0x5a700e[_0x01a4('0x7e')][_0x2dd49f][_0x01a4('0x82')]){_0x278e78[_0x5a700e[_0x01a4('0x7e')][_0x2dd49f][_0x01a4('0x32')]](_0x5a700e[_0x01a4('0x7e')][_0x2dd49f]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5a700e[_0x01a4('0x76')],_0x5a700e[_0x01a4('0x7e')][_0x2dd49f][_0x01a4('0x80')],_0x5a700e[_0x01a4('0x7e')][_0x2dd49f][_0x01a4('0x81')],_0x5a700e[_0x01a4('0x7e')][_0x2dd49f][_0x01a4('0x82')]));}}}if(_0x5a700e[_0x01a4('0x84')]){_0x5a700e[_0x01a4('0x84')]=JSON['parse'](_0x5a700e[_0x01a4('0x84')]);_0x278e78['where'](_0x2a445c(_0x5a700e[_0x01a4('0x84')][_0x01a4('0x6e')]));}_0x33cf8a=_0x278e78[_0x01a4('0x85')]();_0x278e78[_0x01a4('0x21')](_0x105f99);_0x278e78['offset'](0x0);logger[_0x01a4('0x86')](_0x01a4('0x87'),_0x278e78['toString']());return dbH[_0x01a4('0x89')]['query'](_0x278e78[_0x01a4('0x88')](),{'type':dbH[_0x01a4('0x89')][_0x01a4('0x8a')][_0x01a4('0x8b')]});}})[_0x01a4('0x29')](function(){return{'sql':_0x33cf8a[_0x01a4('0x88')]()};})['then'](respondWithResult(_0x5bfe71,null))[_0x01a4('0x4a')](handleError(_0x5bfe71,null));}; \ No newline at end of file +var _0x2b8e=['GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','metric','function','replace','format','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','SELECT','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','AnalyticMetric','MetricId','groupBy','output','web','fullPath','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','value','debug','Limited\x20Query:','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)'];(function(_0x315dd0,_0x357deb){var _0x3aa317=function(_0x2a7628){while(--_0x2a7628){_0x315dd0['push'](_0x315dd0['shift']());}};_0x3aa317(++_0x357deb);}(_0x2b8e,0xf4));var _0xe2b8=function(_0x2ea2a0,_0x1851b2){_0x2ea2a0=_0x2ea2a0-0x0;var _0x498e64=_0x2b8e[_0x2ea2a0];return _0x498e64;};'use strict';var emlformat=require(_0xe2b8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe2b8('0x1'));var rp=require(_0xe2b8('0x2'));var moment=require('moment');var BPromise=require(_0xe2b8('0x3'));var Mustache=require(_0xe2b8('0x4'));var util=require(_0xe2b8('0x5'));var path=require(_0xe2b8('0x6'));var sox=require('sox');var csv=require(_0xe2b8('0x7'));var ejs=require(_0xe2b8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2b8('0x9'));var squel=require(_0xe2b8('0xa'));var crypto=require(_0xe2b8('0xb'));var jsforce=require(_0xe2b8('0xc'));var deskjs=require(_0xe2b8('0xd'));var toCsv=require(_0xe2b8('0x7'));var querystring=require(_0xe2b8('0xe'));var Papa=require(_0xe2b8('0xf'));var Redis=require(_0xe2b8('0x10'));var authService=require(_0xe2b8('0x11'));var qs=require(_0xe2b8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2b8('0x13'))(_0xe2b8('0x14'));var utils=require(_0xe2b8('0x15'));var config=require(_0xe2b8('0x16'));var licenseUtil=require(_0xe2b8('0x17'));var db=require(_0xe2b8('0x18'))['db'];var dbH=require(_0xe2b8('0x18'))[_0xe2b8('0x19')];function respondWithStatusCode(_0x4ebe2a,_0x1db250){_0x1db250=_0x1db250||0xcc;return function(_0x359b5b){if(_0x359b5b){return _0x4ebe2a[_0xe2b8('0x1a')](_0x1db250);}return _0x4ebe2a['status'](_0x1db250)[_0xe2b8('0x1b')]();};}function respondWithResult(_0x39e7ac,_0x55f52d){_0x55f52d=_0x55f52d||0xc8;return function(_0x598b37){if(_0x598b37){return _0x39e7ac[_0xe2b8('0x1c')](_0x55f52d)[_0xe2b8('0x1d')](_0x598b37);}};}function respondWithFilteredResult(_0x481308,_0x4069e8){return function(_0x1c0a82){if(_0x1c0a82){var _0x10a6f9=typeof _0x4069e8['offset']===_0xe2b8('0x1e')&&typeof _0x4069e8['limit']===_0xe2b8('0x1e');var _0x576946=_0x1c0a82['count'];var _0x3b326a=_0x10a6f9?0x0:_0x4069e8[_0xe2b8('0x1f')];var _0x4efc36=_0x10a6f9?_0x1c0a82[_0xe2b8('0x20')]:_0x4069e8['offset']+_0x4069e8[_0xe2b8('0x21')];var _0x386f5d;if(_0x4efc36>=_0x576946){_0x4efc36=_0x576946;_0x386f5d=0xc8;}else{_0x386f5d=0xce;}_0x481308[_0xe2b8('0x1c')](_0x386f5d);return _0x481308[_0xe2b8('0x22')](_0xe2b8('0x23'),_0x3b326a+'-'+_0x4efc36+'/'+_0x576946)[_0xe2b8('0x1d')](_0x1c0a82);}return null;};}function patchUpdates(_0x1e59ad){return function(_0x5eda53){try{jsonpatch[_0xe2b8('0x24')](_0x5eda53,_0x1e59ad,!![]);}catch(_0x1c38c4){return BPromise['reject'](_0x1c38c4);}return _0x5eda53[_0xe2b8('0x25')]();};}function saveUpdates(_0xefa3f5,_0x300dc5){return function(_0x357083){if(_0x357083){return _0x357083[_0xe2b8('0x26')](_0xefa3f5)[_0xe2b8('0x27')](function(_0x2aaeba){return _0x2aaeba;});}return null;};}function removeEntity(_0x24c205,_0x1624c2){return function(_0x49974e){if(_0x49974e){return _0x49974e[_0xe2b8('0x28')]()[_0xe2b8('0x27')](function(){var _0x3654d5=_0x49974e[_0xe2b8('0x29')]({'plain':!![]});var _0x1e310a='CustomReports';return db[_0xe2b8('0x2a')]['destroy']({'where':{'type':_0x1e310a,'resourceId':_0x3654d5['id']}})['then'](function(){return _0x49974e;});})['then'](function(){_0x24c205[_0xe2b8('0x1c')](0xcc)[_0xe2b8('0x1b')]();});}};}function handleEntityNotFound(_0x237a7b,_0x3c3eee){return function(_0x161ef1){if(!_0x161ef1){_0x237a7b[_0xe2b8('0x1a')](0x194);}return _0x161ef1;};}function handleError(_0x2d6d56,_0x210563){_0x210563=_0x210563||0x1f4;return function(_0x276b99){logger['error'](_0x276b99['stack']);if(_0x276b99[_0xe2b8('0x2b')]){delete _0x276b99[_0xe2b8('0x2b')];}_0x2d6d56['status'](_0x210563)[_0xe2b8('0x2c')](_0x276b99);};}exports[_0xe2b8('0x2d')]=function(_0x3536fd,_0x2b87e7){var _0x276e2d={},_0x233bc6={},_0x2ff8b0={'count':0x0,'rows':[]};var _0xbf9a0e=_[_0xe2b8('0x2e')](db['AnalyticCustomReport'][_0xe2b8('0x2f')],function(_0x3101cf){return{'name':_0x3101cf[_0xe2b8('0x30')],'type':_0x3101cf[_0xe2b8('0x31')][_0xe2b8('0x32')]};});_0x233bc6['model']=_[_0xe2b8('0x2e')](_0xbf9a0e,'name');_0x233bc6[_0xe2b8('0x33')]=_[_0xe2b8('0x34')](_0x3536fd[_0xe2b8('0x33')]);_0x233bc6[_0xe2b8('0x35')]=_[_0xe2b8('0x36')](_0x233bc6[_0xe2b8('0x37')],_0x233bc6['query']);_0x276e2d[_0xe2b8('0x38')]=_[_0xe2b8('0x36')](_0x233bc6[_0xe2b8('0x37')],qs[_0xe2b8('0x39')](_0x3536fd['query']['fields']));_0x276e2d['attributes']=_0x276e2d[_0xe2b8('0x38')][_0xe2b8('0x3a')]?_0x276e2d[_0xe2b8('0x38')]:_0x233bc6[_0xe2b8('0x37')];if(!_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x3b')](_0xe2b8('0x3c'))){_0x276e2d['limit']=qs[_0xe2b8('0x21')](_0x3536fd[_0xe2b8('0x33')]['limit']);_0x276e2d[_0xe2b8('0x1f')]=qs[_0xe2b8('0x1f')](_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x1f')]);}_0x276e2d['order']=qs[_0xe2b8('0x3d')](_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x3d')]);_0x276e2d[_0xe2b8('0x3e')]=qs[_0xe2b8('0x35')](_['pick'](_0x3536fd['query'],_0x233bc6[_0xe2b8('0x35')]),_0xbf9a0e);if(_0x3536fd['query'][_0xe2b8('0x3f')]){_0x276e2d[_0xe2b8('0x3e')]=_[_0xe2b8('0x40')](_0x276e2d[_0xe2b8('0x3e')],{'$or':_['map'](_0xbf9a0e,function(_0x44c440){if(_0x44c440[_0xe2b8('0x31')]!==_0xe2b8('0x41')){var _0x14f190={};_0x14f190[_0x44c440[_0xe2b8('0x2b')]]={'$like':'%'+_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x3f')]+'%'};return _0x14f190;}})});}_0x276e2d=_[_0xe2b8('0x40')]({},_0x276e2d,_0x3536fd[_0xe2b8('0x42')]);var _0x4fb5c6={'where':_0x276e2d[_0xe2b8('0x3e')]};return db[_0xe2b8('0x43')][_0xe2b8('0x20')](_0x4fb5c6)['then'](function(_0x4e0963){_0x2ff8b0[_0xe2b8('0x20')]=_0x4e0963;if(_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x44')]){_0x276e2d[_0xe2b8('0x45')]=[{'all':!![]}];}return db[_0xe2b8('0x43')][_0xe2b8('0x46')](_0x276e2d);})[_0xe2b8('0x27')](function(_0x5aa05c){_0x2ff8b0[_0xe2b8('0x47')]=_0x5aa05c;return _0x2ff8b0;})[_0xe2b8('0x27')](respondWithFilteredResult(_0x2b87e7,_0x276e2d))[_0xe2b8('0x48')](handleError(_0x2b87e7,null));};exports[_0xe2b8('0x49')]=function(_0x32c4fc,_0x1fed47){var _0x5b7573={'raw':![],'where':{'id':_0x32c4fc[_0xe2b8('0x4a')]['id']}},_0x101096={};_0x101096['model']=_[_0xe2b8('0x34')](db[_0xe2b8('0x43')][_0xe2b8('0x2f')]);_0x101096[_0xe2b8('0x33')]=_[_0xe2b8('0x34')](_0x32c4fc[_0xe2b8('0x33')]);_0x101096[_0xe2b8('0x35')]=_['intersection'](_0x101096['model'],_0x101096[_0xe2b8('0x33')]);_0x5b7573[_0xe2b8('0x38')]=_[_0xe2b8('0x36')](_0x101096[_0xe2b8('0x37')],qs[_0xe2b8('0x39')](_0x32c4fc[_0xe2b8('0x33')][_0xe2b8('0x39')]));_0x5b7573[_0xe2b8('0x38')]=_0x5b7573[_0xe2b8('0x38')][_0xe2b8('0x3a')]?_0x5b7573[_0xe2b8('0x38')]:_0x101096['model'];if(_0x32c4fc['query'][_0xe2b8('0x44')]){_0x5b7573[_0xe2b8('0x45')]=[{'all':!![]}];}_0x5b7573=_[_0xe2b8('0x40')]({},_0x5b7573,_0x32c4fc[_0xe2b8('0x42')]);return db[_0xe2b8('0x43')][_0xe2b8('0x4b')](_0x5b7573)[_0xe2b8('0x27')](handleEntityNotFound(_0x1fed47,null))['then'](respondWithResult(_0x1fed47,null))[_0xe2b8('0x48')](handleError(_0x1fed47,null));};exports[_0xe2b8('0x4c')]=function(_0x4929ed,_0x52af5d){return db[_0xe2b8('0x43')]['create'](_0x4929ed[_0xe2b8('0x4d')],{})[_0xe2b8('0x27')](function(_0x4e2211){var _0x2e8c79=_0x4929ed[_0xe2b8('0x4e')]['get']({'plain':!![]});if(!_0x2e8c79)throw new Error(_0xe2b8('0x4f'));if(_0x2e8c79[_0xe2b8('0x50')]===_0xe2b8('0x4e')){var _0x52663c=_0x4e2211['get']({'plain':!![]});var _0x2f8ef=_0xe2b8('0x51');return db[_0xe2b8('0x52')][_0xe2b8('0x4b')]({'where':{'name':_0x2f8ef,'userProfileId':_0x2e8c79[_0xe2b8('0x53')]},'raw':!![]})[_0xe2b8('0x27')](function(_0x2092a){if(_0x2092a&&_0x2092a['autoAssociation']===0x0){return db[_0xe2b8('0x2a')][_0xe2b8('0x4c')]({'name':_0x52663c['name'],'resourceId':_0x52663c['id'],'type':_0xe2b8('0x54'),'sectionId':_0x2092a['id']},{})['then'](function(){return _0x4e2211;});}else{return _0x4e2211;}})[_0xe2b8('0x48')](function(_0x1037cf){logger[_0xe2b8('0x55')](_0xe2b8('0x56'),_0x1037cf);throw _0x1037cf;});}return _0x4e2211;})[_0xe2b8('0x27')](respondWithResult(_0x52af5d,0xc9))[_0xe2b8('0x48')](handleError(_0x52af5d,null));};exports[_0xe2b8('0x26')]=function(_0xe2f6df,_0x2b5d21){if(_0xe2f6df[_0xe2b8('0x4d')]['id']){delete _0xe2f6df[_0xe2b8('0x4d')]['id'];}return db[_0xe2b8('0x43')][_0xe2b8('0x4b')]({'where':{'id':_0xe2f6df[_0xe2b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2b5d21,null))[_0xe2b8('0x27')](saveUpdates(_0xe2f6df['body'],null))[_0xe2b8('0x27')](respondWithResult(_0x2b5d21,null))[_0xe2b8('0x48')](handleError(_0x2b5d21,null));};exports['destroy']=function(_0x5c543b,_0x7434bf){return db['AnalyticCustomReport'][_0xe2b8('0x4b')]({'where':{'id':_0x5c543b[_0xe2b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7434bf,null))[_0xe2b8('0x27')](removeEntity(_0x7434bf,null))['catch'](handleError(_0x7434bf,null));};exports['preview']=function(_0x1a565a,_0x24c400){var _0x1a0ddc=0xa;var _0x3212df=[_0xe2b8('0x57'),_0xe2b8('0x58'),_0xe2b8('0x59'),_0xe2b8('0x5a')];var _0x33e8c6={'SUM':_0xe2b8('0x5b'),'COUNT':_0xe2b8('0x5c'),'COUNT DISTINCT':_0xe2b8('0x5d'),'MAX':_0xe2b8('0x5e'),'MIN':_0xe2b8('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe2b8('0x60'),'GROUP_CONCAT ASC':_0xe2b8('0x61'),'GROUP_CONCAT DESC':_0xe2b8('0x62')};var _0x4b4170={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe2b8('0x63'),'HOUR':_0xe2b8('0x64'),'ROUND':_0xe2b8('0x65'),'UNIX_TIMESTAMP':_0xe2b8('0x66')};var _0x31db39=function(_0x12c46a){return!_[_0xe2b8('0x67')]([_0xe2b8('0x68'),'IS\x20NOT\x20NULL',_0xe2b8('0x69'),_0xe2b8('0x6a')],_0x12c46a);};var _0x2e9bdb=function(_0x15177b){if(!_0x15177b||!_0x15177b[_0xe2b8('0x6b')]['length']){return'';}for(var _0x4a076f='(',_0x248578=0x0;_0x248578<_0x15177b[_0xe2b8('0x6b')][_0xe2b8('0x3a')];_0x248578+=0x1){_0x248578>0x0&&(_0x4a076f+='\x20'+_0x15177b[_0xe2b8('0x6c')]+'\x20');_0x4a076f+=_0x15177b['rules'][_0x248578][_0xe2b8('0x6d')]?_0x2e9bdb(_0x15177b['rules'][_0x248578]['group']):_0x15177b[_0xe2b8('0x6b')][_0x248578][_0xe2b8('0x6e')]+'\x20'+_0x15177b['rules'][_0x248578][_0xe2b8('0x6f')]+(_0x31db39(_0x15177b['rules'][_0x248578][_0xe2b8('0x6f')])?'\x20'+_0x15177b[_0xe2b8('0x6b')][_0x248578]['value']:'');}return _0x4a076f+')';};var _0x1c2885={'where':{'id':_0x1a565a[_0xe2b8('0x4a')]['id']}},_0x417e72,_0xf0c45d,_0x2c7bca,_0x4efa01,_0x1e70e0;_0x1c2885=_[_0xe2b8('0x40')]({},_0x1c2885,_0x1a565a['options']);return db['AnalyticCustomReport'][_0xe2b8('0x4b')](_0x1c2885)[_0xe2b8('0x27')](function(_0x18d7fc){if(_0x18d7fc){_0x417e72=_0x18d7fc;return _0x18d7fc[_0xe2b8('0x70')]();}return null;})[_0xe2b8('0x27')](function(_0x97fa19){if(_0x97fa19){if(!_0x97fa19[_0xe2b8('0x3a')]){throw new db[(_0xe2b8('0x71'))][(_0xe2b8('0x72'))](_0xe2b8('0x73'),0x193);}_0xf0c45d=_0x97fa19;return db['AnalyticMetric'][_0xe2b8('0x46')]({'raw':!![]});}return null;})[_0xe2b8('0x27')](function(_0x4a140b){if(_0x4a140b){_0x2c7bca=_[_0xe2b8('0x74')](_0x4a140b,'id');var _0x18f814;var _0x4fa961=squel[_0xe2b8('0x75')]();_0x4fa961[_0xe2b8('0x76')](_0x417e72[_0xe2b8('0x77')]);for(var _0x305e73=0x0;_0x305e73<_0xf0c45d[_0xe2b8('0x3a')];_0x305e73+=0x1){_0x18f814=_0xf0c45d[_0x305e73]['MetricId']?_0x2c7bca[_0xf0c45d[_0x305e73]['MetricId']][_0xe2b8('0x78')]:_0xf0c45d[_0x305e73]['field'];_0x18f814=_0xf0c45d[_0x305e73][_0xe2b8('0x79')]?_[_0xe2b8('0x7a')](_0x33e8c6[_0xf0c45d[_0x305e73][_0xe2b8('0x79')]],'%s',_0x18f814):_0x18f814;_0x18f814=_0xf0c45d[_0x305e73][_0xe2b8('0x7b')]?_[_0xe2b8('0x7a')](_0x4b4170[_0xf0c45d[_0x305e73][_0xe2b8('0x7b')]],'%s',_0x18f814):_0x18f814;if(_0xf0c45d[_0x305e73]['groupBy']){_0x4fa961['group'](_0x18f814);}_0xf0c45d[_0x305e73][_0xe2b8('0x7c')]&&_0x4fa961[_0xe2b8('0x7d')](_0x18f814,_0xf0c45d[_0x305e73][_0xe2b8('0x7c')]===_0xe2b8('0x7e')?![]:!![]);_0x4fa961['field'](_0x18f814,_0xf0c45d[_0x305e73][_0xe2b8('0x7f')]||_0x18f814);}if(_0x417e72[_0xe2b8('0x80')]){_0x417e72[_0xe2b8('0x80')]=JSON['parse'](_0x417e72['joins']);for(var _0x3fb229=0x0;_0x3fb229<_0x417e72[_0xe2b8('0x80')]['length'];_0x3fb229+=0x1){if(_0x417e72[_0xe2b8('0x80')][_0x3fb229]['type']&&_[_0xe2b8('0x67')](_0x3212df,_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x31')])&&_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x81')]&&_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x82')]&&_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x83')]){_0x4fa961[_0x417e72[_0xe2b8('0x80')][_0x3fb229]['type']](_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x82')],null,util[_0xe2b8('0x7b')](_0xe2b8('0x84'),_0x417e72[_0xe2b8('0x77')],_0x417e72['joins'][_0x3fb229][_0xe2b8('0x81')],_0x417e72['joins'][_0x3fb229][_0xe2b8('0x82')],_0x417e72['joins'][_0x3fb229]['foreignKey']));}}}if(_0x417e72[_0xe2b8('0x85')]){_0x417e72['conditions']=JSON[_0xe2b8('0x86')](_0x417e72[_0xe2b8('0x85')]);_0x4fa961[_0xe2b8('0x3e')](_0x2e9bdb(_0x417e72[_0xe2b8('0x85')][_0xe2b8('0x6d')]));}_0x1e70e0=_0x4fa961[_0xe2b8('0x87')]();_0x4fa961['limit'](_0x1a0ddc);_0x4fa961['offset'](0x0);logger['debug']('Limited\x20Query:',_0x4fa961[_0xe2b8('0x88')]());return dbH[_0xe2b8('0x89')][_0xe2b8('0x33')](_0x4fa961[_0xe2b8('0x88')](),{'type':dbH[_0xe2b8('0x89')][_0xe2b8('0x8a')][_0xe2b8('0x8b')]});}})['then'](respondWithResult(_0x24c400,null))[_0xe2b8('0x48')](handleError(_0x24c400,null));};function runReport(_0x1a4eeb,_0x4c9365,_0x919d6c){var _0x2bd08e=_0x4c9365['name'];var _0x5afeb5=0xa;var _0x52062d=[_0xe2b8('0x57'),_0xe2b8('0x58'),_0xe2b8('0x59'),_0xe2b8('0x5a')];var _0x44d195={'SUM':_0xe2b8('0x5b'),'COUNT':_0xe2b8('0x5c'),'COUNT DISTINCT':_0xe2b8('0x5d'),'MAX':_0xe2b8('0x5e'),'MIN':_0xe2b8('0x5f'),'AVG':_0xe2b8('0x8c'),'GROUP_CONCAT':_0xe2b8('0x60'),'GROUP_CONCAT ASC':_0xe2b8('0x61'),'GROUP_CONCAT DESC':_0xe2b8('0x62')};var _0x499c5c={'SEC_TO_TIME':_0xe2b8('0x8d'),'DATE':_0xe2b8('0x63'),'HOUR':_0xe2b8('0x64'),'ROUND':_0xe2b8('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x29662e=function(_0x3fda91){return!_['includes'](['IS\x20NULL',_0xe2b8('0x8e'),_0xe2b8('0x69'),_0xe2b8('0x6a')],_0x3fda91);};var _0x10368f=function(_0xb274ff){if(!_0xb274ff||!_0xb274ff[_0xe2b8('0x6b')][_0xe2b8('0x3a')]){return'';}for(var _0x5d2bb8='(',_0x4f2a60=0x0;_0x4f2a60<_0xb274ff['rules'][_0xe2b8('0x3a')];_0x4f2a60+=0x1){_0x4f2a60>0x0&&(_0x5d2bb8+='\x20'+_0xb274ff[_0xe2b8('0x6c')]+'\x20');_0x5d2bb8+=_0xb274ff[_0xe2b8('0x6b')][_0x4f2a60][_0xe2b8('0x6d')]?_0x10368f(_0xb274ff['rules'][_0x4f2a60][_0xe2b8('0x6d')]):_0xb274ff[_0xe2b8('0x6b')][_0x4f2a60][_0xe2b8('0x6e')]+'\x20'+_0xb274ff[_0xe2b8('0x6b')][_0x4f2a60][_0xe2b8('0x6f')]+(_0x29662e(_0xb274ff[_0xe2b8('0x6b')][_0x4f2a60]['condition'])?'\x20'+_0xb274ff['rules'][_0x4f2a60]['value']:'');}return _0x5d2bb8+')';};var _0x2728e1={'where':{'id':_0x1a4eeb['id']}},_0x2f612a,_0xcda5f9,_0x40516a,_0x24c8f8,_0x5e01f0;_0x2728e1=_[_0xe2b8('0x40')]({},_0x2728e1,_0x919d6c);return db[_0xe2b8('0x43')][_0xe2b8('0x4b')](_0x2728e1)[_0xe2b8('0x27')](function(_0x3f88ec){if(_0x3f88ec){_0x2f612a=_0x3f88ec;return _0x3f88ec[_0xe2b8('0x70')]();}return null;})['then'](function(_0x57703b){if(_0x57703b){if(!_0x57703b[_0xe2b8('0x3a')]){throw new db[(_0xe2b8('0x71'))][(_0xe2b8('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xcda5f9=_0x57703b;return db[_0xe2b8('0x8f')][_0xe2b8('0x46')]({'raw':!![]});}return null;})[_0xe2b8('0x27')](function(_0x1dbcc4){if(_0x1dbcc4){_0x40516a=_[_0xe2b8('0x74')](_0x1dbcc4,'id');var _0x4ae833;var _0x255f25=squel['select']();_0x255f25[_0xe2b8('0x76')](_0x2f612a['table']);for(var _0x5b4167=0x0;_0x5b4167<_0xcda5f9[_0xe2b8('0x3a')];_0x5b4167+=0x1){_0x4ae833=_0xcda5f9[_0x5b4167][_0xe2b8('0x90')]?_0x40516a[_0xcda5f9[_0x5b4167]['MetricId']][_0xe2b8('0x78')]:_0xcda5f9[_0x5b4167][_0xe2b8('0x6e')];_0x4ae833=_0xcda5f9[_0x5b4167][_0xe2b8('0x79')]?_[_0xe2b8('0x7a')](_0x44d195[_0xcda5f9[_0x5b4167]['function']],'%s',_0x4ae833):_0x4ae833;_0x4ae833=_0xcda5f9[_0x5b4167][_0xe2b8('0x7b')]?_[_0xe2b8('0x7a')](_0x499c5c[_0xcda5f9[_0x5b4167][_0xe2b8('0x7b')]],'%s',_0x4ae833):_0x4ae833;if(_0xcda5f9[_0x5b4167][_0xe2b8('0x91')]){_0x255f25['group'](_0x4ae833);}_0xcda5f9[_0x5b4167]['orderBy']&&_0x255f25['order'](_0x4ae833,_0xcda5f9[_0x5b4167][_0xe2b8('0x7c')]===_0xe2b8('0x7e')?![]:!![]);_0x255f25[_0xe2b8('0x6e')](_0x4ae833,_0xcda5f9[_0x5b4167][_0xe2b8('0x7f')]||_0x4ae833);}if(_0x2f612a[_0xe2b8('0x80')]){_0x2f612a[_0xe2b8('0x80')]=JSON[_0xe2b8('0x86')](_0x2f612a[_0xe2b8('0x80')]);for(var _0x317114=0x0;_0x317114<_0x2f612a[_0xe2b8('0x80')][_0xe2b8('0x3a')];_0x317114+=0x1){if(_0x2f612a[_0xe2b8('0x80')][_0x317114][_0xe2b8('0x31')]&&_[_0xe2b8('0x67')](_0x52062d,_0x2f612a['joins'][_0x317114][_0xe2b8('0x31')])&&_0x2f612a['joins'][_0x317114][_0xe2b8('0x81')]&&_0x2f612a[_0xe2b8('0x80')][_0x317114]['foreignTable']&&_0x2f612a[_0xe2b8('0x80')][_0x317114][_0xe2b8('0x83')]){_0x255f25[_0x2f612a[_0xe2b8('0x80')][_0x317114][_0xe2b8('0x31')]](_0x2f612a[_0xe2b8('0x80')][_0x317114]['foreignTable'],null,util[_0xe2b8('0x7b')]('%s.%s\x20=\x20%s.%s',_0x2f612a[_0xe2b8('0x77')],_0x2f612a[_0xe2b8('0x80')][_0x317114]['parentKey'],_0x2f612a[_0xe2b8('0x80')][_0x317114][_0xe2b8('0x82')],_0x2f612a['joins'][_0x317114]['foreignKey']));}}}if(_0x2f612a[_0xe2b8('0x85')]){_0x2f612a[_0xe2b8('0x85')]=JSON[_0xe2b8('0x86')](_0x2f612a[_0xe2b8('0x85')]);_0x255f25[_0xe2b8('0x3e')](_0x10368f(_0x2f612a[_0xe2b8('0x85')][_0xe2b8('0x6d')]));}_0x5e01f0=_0x255f25[_0xe2b8('0x87')]();_0x255f25[_0xe2b8('0x21')](_0x5afeb5);_0x255f25[_0xe2b8('0x1f')](0x0);return;}})[_0xe2b8('0x27')](function(){if(_0x4c9365[_0xe2b8('0x92')]===_0xe2b8('0x93')){return null;}var _0x54d7f4=_[_0xe2b8('0x40')](_0x4c9365,{'name':_0x4c9365[_0xe2b8('0x94')]||_0x4c9365[_0xe2b8('0x2b')]||_0x2f612a[_0xe2b8('0x2b')],'basename':_0x2bd08e,'savename':util[_0xe2b8('0x7b')]('%s-%s.%s',_0x4c9365[_0xe2b8('0x2b')]||_0x2f612a['name'],require(_0xe2b8('0x95'))[_0xe2b8('0x96')](0x4),_0x4c9365[_0xe2b8('0x92')]||_0xe2b8('0x97')),'reportId':_0x2f612a['id'],'reportType':'custom'});return db[_0xe2b8('0x98')][_0xe2b8('0x4c')](_0x54d7f4,{'raw':!![]});})[_0xe2b8('0x27')](function(_0x256703){if(_0x2f612a['table']===_0xe2b8('0x99')){_0x5e01f0['where'](_0x2f612a[_0xe2b8('0x77')]+_0xe2b8('0x9a'),_0x4c9365[_0xe2b8('0x9b')],_0x4c9365[_0xe2b8('0x9c')]);}else{_0x5e01f0[_0xe2b8('0x3e')](_0x2f612a['table']+_0xe2b8('0x9d'),_0x4c9365['startDate'],_0x4c9365[_0xe2b8('0x9c')]);}if(_0x256703){logger[_0xe2b8('0x9e')](_0xe2b8('0x9f'),_0x5e01f0[_0xe2b8('0x88')]());require(_0xe2b8('0xa0'))[_0xe2b8('0xa1')](path[_0xe2b8('0x57')](__dirname,_0xe2b8('0xa2'),_0x256703['output']),[_0x256703['id'],_0x5e01f0[_0xe2b8('0x88')](),path['join'](__dirname,_0xe2b8('0xa3'),_0x256703[_0xe2b8('0xa4')]),_0x2bd08e]);return _0x256703;}else{var _0x1d81e6=squel['select']();_0x1d81e6[_0xe2b8('0x76')]('('+_0x5e01f0[_0xe2b8('0x88')]()+')',_0xe2b8('0xa5'));_0x1d81e6[_0xe2b8('0x6e')](_0xe2b8('0xa6'),_0xe2b8('0x20'));_0x5e01f0[_0xe2b8('0x21')](_0x4c9365[_0xe2b8('0x21')]||_0x5afeb5);_0x5e01f0[_0xe2b8('0x1f')](_0x4c9365['offset']||0x0);return dbH['sequelize'][_0xe2b8('0x33')](_0x1d81e6[_0xe2b8('0x88')](),{'type':dbH[_0xe2b8('0x89')][_0xe2b8('0x8a')][_0xe2b8('0x8b')]})['then'](function(_0x3be71c){if(!_0x3be71c['length']){_0x24c8f8=0x0;}else{_0x24c8f8=_0x3be71c[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x5e01f0[_0xe2b8('0x88')](),{'type':dbH[_0xe2b8('0x89')][_0xe2b8('0x8a')][_0xe2b8('0x8b')]});})[_0xe2b8('0x27')](function(_0x3a532f){return{'rows':_0x3a532f||[],'count':_0x24c8f8};});}});}exports['run']=function(_0x5c5e12,_0x12e3e8){return runReport(_0x5c5e12[_0xe2b8('0x4a')],_0x5c5e12[_0xe2b8('0x33')],_0x5c5e12[_0xe2b8('0x42')])[_0xe2b8('0x27')](respondWithResult(_0x12e3e8,null))[_0xe2b8('0x48')](handleError(_0x12e3e8,null));};exports['runReport']=runReport;exports[_0xe2b8('0x33')]=function(_0x4dfb04,_0x280b75){var _0x34d71b=0xa;var _0x5b0369=['join',_0xe2b8('0x58'),_0xe2b8('0x59'),'cross_join'];var _0x43ba45={'SUM':_0xe2b8('0x5b'),'COUNT':_0xe2b8('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe2b8('0x5e'),'MIN':_0xe2b8('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe2b8('0x60'),'GROUP_CONCAT ASC':_0xe2b8('0x61'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x21e026={'SEC_TO_TIME':_0xe2b8('0x8d'),'DATE':_0xe2b8('0x63'),'HOUR':_0xe2b8('0x64'),'ROUND':_0xe2b8('0x65'),'UNIX_TIMESTAMP':_0xe2b8('0x66')};var _0x4a80ea=function(_0x145ae4){return!_[_0xe2b8('0x67')](['IS\x20NULL',_0xe2b8('0x8e'),'IS\x20EMPTY',_0xe2b8('0x6a')],_0x145ae4);};var _0x2b9a03=function(_0x2c7665){if(!_0x2c7665||!_0x2c7665['rules'][_0xe2b8('0x3a')]){return'';}for(var _0x5133c2='(',_0x329ef7=0x0;_0x329ef7<_0x2c7665[_0xe2b8('0x6b')][_0xe2b8('0x3a')];_0x329ef7+=0x1){_0x329ef7>0x0&&(_0x5133c2+='\x20'+_0x2c7665[_0xe2b8('0x6c')]+'\x20');_0x5133c2+=_0x2c7665[_0xe2b8('0x6b')][_0x329ef7][_0xe2b8('0x6d')]?_0x2b9a03(_0x2c7665['rules'][_0x329ef7][_0xe2b8('0x6d')]):_0x2c7665[_0xe2b8('0x6b')][_0x329ef7][_0xe2b8('0x6e')]+'\x20'+_0x2c7665[_0xe2b8('0x6b')][_0x329ef7][_0xe2b8('0x6f')]+(_0x4a80ea(_0x2c7665['rules'][_0x329ef7][_0xe2b8('0x6f')])?'\x20'+_0x2c7665[_0xe2b8('0x6b')][_0x329ef7][_0xe2b8('0xa7')]:'');}return _0x5133c2+')';};var _0x54f9d8={'where':{'id':_0x4dfb04[_0xe2b8('0x4a')]['id']}},_0x142382,_0x3a01e6,_0x2265af,_0x36ab2d,_0x18cfe1;_0x54f9d8=_[_0xe2b8('0x40')]({},_0x54f9d8,_0x4dfb04[_0xe2b8('0x42')]);return db['AnalyticCustomReport']['find'](_0x54f9d8)[_0xe2b8('0x27')](function(_0x2bc025){if(_0x2bc025){_0x142382=_0x2bc025;return _0x2bc025[_0xe2b8('0x70')]();}return null;})[_0xe2b8('0x27')](function(_0x5a149f){if(_0x5a149f){if(!_0x5a149f[_0xe2b8('0x3a')]){throw new db[(_0xe2b8('0x71'))][(_0xe2b8('0x72'))](_0xe2b8('0x73'),0x193);}_0x3a01e6=_0x5a149f;return db[_0xe2b8('0x8f')]['findAll']({'raw':!![]});}return null;})[_0xe2b8('0x27')](function(_0x48ca73){if(_0x48ca73){_0x2265af=_['keyBy'](_0x48ca73,'id');var _0xdefce0;var _0x3ea6ff=squel[_0xe2b8('0x75')]();_0x3ea6ff[_0xe2b8('0x76')](_0x142382[_0xe2b8('0x77')]);for(var _0x37496a=0x0;_0x37496a<_0x3a01e6[_0xe2b8('0x3a')];_0x37496a+=0x1){_0xdefce0=_0x3a01e6[_0x37496a]['MetricId']?_0x2265af[_0x3a01e6[_0x37496a]['MetricId']]['metric']:_0x3a01e6[_0x37496a]['field'];_0xdefce0=_0x3a01e6[_0x37496a][_0xe2b8('0x79')]?_[_0xe2b8('0x7a')](_0x43ba45[_0x3a01e6[_0x37496a][_0xe2b8('0x79')]],'%s',_0xdefce0):_0xdefce0;_0xdefce0=_0x3a01e6[_0x37496a][_0xe2b8('0x7b')]?_[_0xe2b8('0x7a')](_0x21e026[_0x3a01e6[_0x37496a][_0xe2b8('0x7b')]],'%s',_0xdefce0):_0xdefce0;if(_0x3a01e6[_0x37496a][_0xe2b8('0x91')]){_0x3ea6ff['group'](_0xdefce0);}_0x3a01e6[_0x37496a][_0xe2b8('0x7c')]&&_0x3ea6ff['order'](_0xdefce0,_0x3a01e6[_0x37496a][_0xe2b8('0x7c')]==='DESC'?![]:!![]);_0x3ea6ff[_0xe2b8('0x6e')](_0xdefce0,_0x3a01e6[_0x37496a][_0xe2b8('0x7f')]||_0xdefce0);}if(_0x142382[_0xe2b8('0x80')]){_0x142382[_0xe2b8('0x80')]=JSON['parse'](_0x142382['joins']);for(var _0x4d9b7a=0x0;_0x4d9b7a<_0x142382[_0xe2b8('0x80')]['length'];_0x4d9b7a+=0x1){if(_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x31')]&&_['includes'](_0x5b0369,_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x31')])&&_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x81')]&&_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x82')]&&_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x83')]){_0x3ea6ff[_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x31')]](_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x82')],null,util['format'](_0xe2b8('0x84'),_0x142382[_0xe2b8('0x77')],_0x142382['joins'][_0x4d9b7a][_0xe2b8('0x81')],_0x142382[_0xe2b8('0x80')][_0x4d9b7a]['foreignTable'],_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x83')]));}}}if(_0x142382[_0xe2b8('0x85')]){_0x142382[_0xe2b8('0x85')]=JSON['parse'](_0x142382[_0xe2b8('0x85')]);_0x3ea6ff[_0xe2b8('0x3e')](_0x2b9a03(_0x142382['conditions'][_0xe2b8('0x6d')]));}_0x18cfe1=_0x3ea6ff[_0xe2b8('0x87')]();_0x3ea6ff['limit'](_0x34d71b);_0x3ea6ff['offset'](0x0);logger[_0xe2b8('0xa8')](_0xe2b8('0xa9'),_0x3ea6ff[_0xe2b8('0x88')]());return dbH[_0xe2b8('0x89')]['query'](_0x3ea6ff['toString'](),{'type':dbH[_0xe2b8('0x89')][_0xe2b8('0x8a')]['SELECT']});}})[_0xe2b8('0x27')](function(){return{'sql':_0x18cfe1[_0xe2b8('0x88')]()};})[_0xe2b8('0x27')](respondWithResult(_0x280b75,null))[_0xe2b8('0x48')](handleError(_0x280b75,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a5450b7..de5611f 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 _0x39b3=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','analytics_custom_reports'];(function(_0x5e7357,_0x29e8c6){var _0x3aac6b=function(_0x403d54){while(--_0x403d54){_0x5e7357['push'](_0x5e7357['shift']());}};_0x3aac6b(++_0x29e8c6);}(_0x39b3,0xf2));var _0x339b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x39b3[_0x5783f4];return _0x28e380;};'use strict';var _=require('lodash');var util=require(_0x339b('0x0'));var logger=require('../../config/logger')(_0x339b('0x1'));var moment=require(_0x339b('0x2'));var BPromise=require(_0x339b('0x3'));var rp=require(_0x339b('0x4'));var fs=require('fs');var path=require(_0x339b('0x5'));var rimraf=require(_0x339b('0x6'));var config=require(_0x339b('0x7'));var attributes=require(_0x339b('0x8'));module[_0x339b('0x9')]=function(_0x3ed28f,_0x150276){return _0x3ed28f['define']('AnalyticCustomReport',attributes,{'tableName':_0x339b('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3164=['path','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','request-promise'];(function(_0x438c85,_0x559651){var _0x1ab3c8=function(_0x10ed70){while(--_0x10ed70){_0x438c85['push'](_0x438c85['shift']());}};_0x1ab3c8(++_0x559651);}(_0x3164,0x1c9));var _0x4316=function(_0x569d0f,_0x224a07){_0x569d0f=_0x569d0f-0x0;var _0x26d516=_0x3164[_0x569d0f];return _0x26d516;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var logger=require(_0x4316('0x2'))(_0x4316('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4316('0x4'));var fs=require('fs');var path=require(_0x4316('0x5'));var rimraf=require('rimraf');var config=require(_0x4316('0x6'));var attributes=require(_0x4316('0x7'));module['exports']=function(_0x34fd79,_0x5e1dfe){return _0x34fd79[_0x4316('0x8')](_0x4316('0x9'),attributes,{'tableName':_0x4316('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 6f80c76..fa72696 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 _0x5e9a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring'];(function(_0x284311,_0x1e89f5){var _0x1f2969=function(_0x222c7e){while(--_0x222c7e){_0x284311['push'](_0x284311['shift']());}};_0x1f2969(++_0x1e89f5);}(_0x5e9a,0x155));var _0xa5e9=function(_0x1de88d,_0x2fc37e){_0x1de88d=_0x1de88d-0x0;var _0x41bfea=_0x5e9a[_0x1de88d];return _0x41bfea;};'use strict';var _=require('lodash');var util=require(_0xa5e9('0x0'));var moment=require(_0xa5e9('0x1'));var BPromise=require(_0xa5e9('0x2'));var rs=require(_0xa5e9('0x3'));var fs=require('fs');var Redis=require(_0xa5e9('0x4'));var db=require(_0xa5e9('0x5'))['db'];var utils=require(_0xa5e9('0x6'));var logger=require(_0xa5e9('0x7'))(_0xa5e9('0x8'));var config=require(_0xa5e9('0x9'));var jayson=require(_0xa5e9('0xa'));var client=jayson[_0xa5e9('0xb')][_0xa5e9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x473dee,_0x8deaac,_0xaac9d8){return new BPromise(function(_0x25c9fc,_0x46a081){return client[_0xa5e9('0xd')](_0x473dee,_0xaac9d8)[_0xa5e9('0xe')](function(_0x2c9f30){logger[_0xa5e9('0xf')](_0xa5e9('0x10'),_0x8deaac,_0xa5e9('0x11'));logger[_0xa5e9('0x12')](_0xa5e9('0x13'),_0x8deaac,_0xa5e9('0x11'),JSON['stringify'](_0x2c9f30));if(_0x2c9f30[_0xa5e9('0x14')]){if(_0x2c9f30['error']['code']===0x1f4){logger[_0xa5e9('0x14')](_0xa5e9('0x10'),_0x8deaac,_0x2c9f30[_0xa5e9('0x14')][_0xa5e9('0x15')]);return _0x46a081(_0x2c9f30[_0xa5e9('0x14')][_0xa5e9('0x15')]);}logger[_0xa5e9('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x8deaac,_0x2c9f30['error']['message']);return _0x25c9fc(_0x2c9f30['error'][_0xa5e9('0x15')]);}else{logger[_0xa5e9('0xf')](_0xa5e9('0x10'),_0x8deaac,'request\x20sent');_0x25c9fc(_0x2c9f30[_0xa5e9('0x16')][_0xa5e9('0x15')]);}})['catch'](function(_0x5cc3cd){logger[_0xa5e9('0x14')](_0xa5e9('0x10'),_0x8deaac,_0x5cc3cd);_0x46a081(_0x5cc3cd);});});} \ No newline at end of file +var _0xb515=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','util','ioredis','../../config/utils','../../config/logger'];(function(_0x238f15,_0x796bce){var _0x28f0df=function(_0x78ecf3){while(--_0x78ecf3){_0x238f15['push'](_0x238f15['shift']());}};_0x28f0df(++_0x796bce);}(_0xb515,0x113));var _0x5b51=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xb515[_0x42020e];return _0x561551;};'use strict';var _=require(_0x5b51('0x0'));var util=require(_0x5b51('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b51('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b51('0x3'));var logger=require(_0x5b51('0x4'))(_0x5b51('0x5'));var config=require(_0x5b51('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5b51('0x7')][_0x5b51('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f10fb,_0xfe4953,_0x3c31ac){return new BPromise(function(_0x43fc75,_0x1db2da){return client[_0x5b51('0x9')](_0x1f10fb,_0x3c31ac)[_0x5b51('0xa')](function(_0x23f6fc){logger[_0x5b51('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0xfe4953,_0x5b51('0xc'));logger['debug'](_0x5b51('0xd'),_0xfe4953,_0x5b51('0xc'),JSON[_0x5b51('0xe')](_0x23f6fc));if(_0x23f6fc[_0x5b51('0xf')]){if(_0x23f6fc['error'][_0x5b51('0x10')]===0x1f4){logger['error'](_0x5b51('0x11'),_0xfe4953,_0x23f6fc[_0x5b51('0xf')][_0x5b51('0x12')]);return _0x1db2da(_0x23f6fc[_0x5b51('0xf')][_0x5b51('0x12')]);}logger[_0x5b51('0xf')](_0x5b51('0x11'),_0xfe4953,_0x23f6fc[_0x5b51('0xf')]['message']);return _0x43fc75(_0x23f6fc[_0x5b51('0xf')][_0x5b51('0x12')]);}else{logger[_0x5b51('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0xfe4953,_0x5b51('0xc'));_0x43fc75(_0x23f6fc['result'][_0x5b51('0x12')]);}})[_0x5b51('0x13')](function(_0x77eec1){logger[_0x5b51('0xf')](_0x5b51('0x11'),_0xfe4953,_0x77eec1);_0x1db2da(_0x77eec1);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index dae951d..6e0e1a2 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 _0xe0a0=['/:id','show','/:id/preview','/:id/run','query','post','update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index'];(function(_0x304fd3,_0x3fe8c9){var _0x99c2ba=function(_0xa14734){while(--_0xa14734){_0x304fd3['push'](_0x304fd3['shift']());}};_0x99c2ba(++_0x3fe8c9);}(_0xe0a0,0xec));var _0x0e0a=function(_0xcef3cf,_0x5e2d18){_0xcef3cf=_0xcef3cf-0x0;var _0x1de08e=_0xe0a0[_0xcef3cf];return _0x1de08e;};'use strict';var multer=require(_0x0e0a('0x0'));var util=require(_0x0e0a('0x1'));var path=require('path');var timeout=require(_0x0e0a('0x2'));var express=require('express');var router=express[_0x0e0a('0x3')]();var fs_extra=require(_0x0e0a('0x4'));var auth=require(_0x0e0a('0x5'));var interaction=require(_0x0e0a('0x6'));var config=require('../../config/environment');var controller=require(_0x0e0a('0x7'));router[_0x0e0a('0x8')]('/',auth[_0x0e0a('0x9')](),controller[_0x0e0a('0xa')]);router[_0x0e0a('0x8')](_0x0e0a('0xb'),auth[_0x0e0a('0x9')](),controller[_0x0e0a('0xc')]);router[_0x0e0a('0x8')](_0x0e0a('0xd'),auth[_0x0e0a('0x9')](),controller['preview']);router[_0x0e0a('0x8')](_0x0e0a('0xe'),auth[_0x0e0a('0x9')](),controller['run']);router['get']('/:id/query',auth[_0x0e0a('0x9')](),controller[_0x0e0a('0xf')]);router[_0x0e0a('0x10')]('/',auth[_0x0e0a('0x9')](),controller['create']);router['put'](_0x0e0a('0xb'),auth[_0x0e0a('0x9')](),controller[_0x0e0a('0x11')]);router[_0x0e0a('0x12')]('/:id',auth[_0x0e0a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9ce5=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','put','update','delete','destroy','exports'];(function(_0x1b7523,_0x377040){var _0x36356d=function(_0x1869ff){while(--_0x1869ff){_0x1b7523['push'](_0x1b7523['shift']());}};_0x36356d(++_0x377040);}(_0x9ce5,0x108));var _0x59ce=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x9ce5[_0x47a349];return _0x18ab75;};'use strict';var multer=require(_0x59ce('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x59ce('0x1'));var express=require(_0x59ce('0x2'));var router=express[_0x59ce('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x59ce('0x4'));var interaction=require(_0x59ce('0x5'));var config=require(_0x59ce('0x6'));var controller=require(_0x59ce('0x7'));router[_0x59ce('0x8')]('/',auth[_0x59ce('0x9')](),controller[_0x59ce('0xa')]);router[_0x59ce('0x8')](_0x59ce('0xb'),auth[_0x59ce('0x9')](),controller[_0x59ce('0xc')]);router[_0x59ce('0x8')](_0x59ce('0xd'),auth[_0x59ce('0x9')](),controller[_0x59ce('0xe')]);router[_0x59ce('0x8')](_0x59ce('0xf'),auth[_0x59ce('0x9')](),controller[_0x59ce('0x10')]);router[_0x59ce('0x8')]('/:id/query',auth[_0x59ce('0x9')](),controller[_0x59ce('0x11')]);router[_0x59ce('0x12')]('/',auth[_0x59ce('0x9')](),controller['create']);router[_0x59ce('0x13')]('/:id',auth[_0x59ce('0x9')](),controller[_0x59ce('0x14')]);router[_0x59ce('0x15')](_0x59ce('0xb'),auth[_0x59ce('0x9')](),controller[_0x59ce('0x16')]);module[_0x59ce('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6935718..a8d1d1a 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 _0x5496=['TEXT','sequelize','exports','STRING'];(function(_0xbaa13a,_0x1bebea){var _0x3a3642=function(_0x234fc7){while(--_0x234fc7){_0xbaa13a['push'](_0xbaa13a['shift']());}};_0x3a3642(++_0x1bebea);}(_0x5496,0x175));var _0x6549=function(_0x329c53,_0x124f3d){_0x329c53=_0x329c53-0x0;var _0x25f208=_0x5496[_0x329c53];return _0x25f208;};'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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x5d02ed,_0x4e5140){var _0x4bbd14=function(_0x271c29){while(--_0x271c29){_0x5d02ed['push'](_0x5d02ed['shift']());}};_0x4bbd14(++_0x4e5140);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 19347ee..2531d52 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 _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','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\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','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','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xabce[_0x2dafbe];return _0x58a45a;};'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'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file +var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x453036,_0x521770){var _0x203aa2=function(_0x2d383a){while(--_0x2d383a){_0x453036['push'](_0x453036['shift']());}};_0x203aa2(++_0x521770);}(_0xba34,0x119));var _0x4ba3=function(_0xb80ab0,_0x4545ea){_0xb80ab0=_0xb80ab0-0x0;var _0x5c2cd9=_0xba34[_0xb80ab0];return _0x5c2cd9;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8d8eed9..4adf3d3 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 _0xe069=['request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','moment','bluebird'];(function(_0x1afadf,_0x357131){var _0x3a3b4a=function(_0x224753){while(--_0x224753){_0x1afadf['push'](_0x1afadf['shift']());}};_0x3a3b4a(++_0x357131);}(_0xe069,0x140));var _0x9e06=function(_0x248fd6,_0x203fe9){_0x248fd6=_0x248fd6-0x0;var _0x869561=_0xe069[_0x248fd6];return _0x869561;};'use strict';var _=require(_0x9e06('0x0'));var util=require(_0x9e06('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9e06('0x2'));var BPromise=require(_0x9e06('0x3'));var rp=require(_0x9e06('0x4'));var fs=require('fs');var path=require(_0x9e06('0x5'));var rimraf=require(_0x9e06('0x6'));var config=require('../../config/environment');var attributes=require(_0x9e06('0x7'));module[_0x9e06('0x8')]=function(_0x5d8157,_0xe8ceb7){return _0x5d8157[_0x9e06('0x9')](_0x9e06('0xa'),attributes,{'tableName':_0x9e06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1412=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x12f847,_0x403776){var _0x2c54e4=function(_0x541e47){while(--_0x541e47){_0x12f847['push'](_0x12f847['shift']());}};_0x2c54e4(++_0x403776);}(_0x1412,0x67));var _0x2141=function(_0x1a202a,_0x2b87e6){_0x1a202a=_0x1a202a-0x0;var _0xfb41ba=_0x1412[_0x1a202a];return _0xfb41ba;};'use strict';var _=require(_0x2141('0x0'));var util=require(_0x2141('0x1'));var logger=require(_0x2141('0x2'))(_0x2141('0x3'));var moment=require(_0x2141('0x4'));var BPromise=require(_0x2141('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2141('0x6'));var rimraf=require(_0x2141('0x7'));var config=require(_0x2141('0x8'));var attributes=require(_0x2141('0x9'));module['exports']=function(_0x317e43,_0x4ad54a){return _0x317e43[_0x2141('0xa')](_0x2141('0xb'),attributes,{'tableName':_0x2141('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index a2f55c6..2da1dc0 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 _0x2cd5=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x2cd5,0x182));var _0x52cd=function(_0xa39f48,_0x1f27be){_0xa39f48=_0xa39f48-0x0;var _0x75e45c=_0x2cd5[_0xa39f48];return _0x75e45c;};'use strict';var _=require(_0x52cd('0x0'));var util=require('util');var moment=require(_0x52cd('0x1'));var BPromise=require(_0x52cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52cd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x52cd('0x4'));var config=require(_0x52cd('0x5'));var jayson=require(_0x52cd('0x6'));var client=jayson[_0x52cd('0x7')][_0x52cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55c57c,_0x3cbe07,_0x5b478d){return new BPromise(function(_0x3778e6,_0x35a1e1){return client[_0x52cd('0x9')](_0x55c57c,_0x5b478d)[_0x52cd('0xa')](function(_0x46cf79){logger[_0x52cd('0xb')](_0x52cd('0xc'),_0x3cbe07,_0x52cd('0xd'));logger[_0x52cd('0xe')](_0x52cd('0xf'),_0x3cbe07,'request\x20sent',JSON['stringify'](_0x46cf79));if(_0x46cf79[_0x52cd('0x10')]){if(_0x46cf79['error']['code']===0x1f4){logger['error'](_0x52cd('0xc'),_0x3cbe07,_0x46cf79['error'][_0x52cd('0x11')]);return _0x35a1e1(_0x46cf79[_0x52cd('0x10')][_0x52cd('0x11')]);}logger[_0x52cd('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3cbe07,_0x46cf79['error']['message']);return _0x3778e6(_0x46cf79[_0x52cd('0x10')][_0x52cd('0x11')]);}else{logger[_0x52cd('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3cbe07,_0x52cd('0xd'));_0x3778e6(_0x46cf79[_0x52cd('0x12')][_0x52cd('0x11')]);}})[_0x52cd('0x13')](function(_0x11dd30){logger[_0x52cd('0x10')](_0x52cd('0xc'),_0x3cbe07,_0x11dd30);_0x35a1e1(_0x11dd30);});});} \ No newline at end of file +var _0xcbbf=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5d509d,_0x59bdc6){var _0x46085d=function(_0x4e12e0){while(--_0x4e12e0){_0x5d509d['push'](_0x5d509d['shift']());}};_0x46085d(++_0x59bdc6);}(_0xcbbf,0x100));var _0xfcbb=function(_0x537efb,_0xe69b8f){_0x537efb=_0x537efb-0x0;var _0x2400b5=_0xcbbf[_0x537efb];return _0x2400b5;};'use strict';var _=require(_0xfcbb('0x0'));var util=require(_0xfcbb('0x1'));var moment=require(_0xfcbb('0x2'));var BPromise=require('bluebird');var rs=require(_0xfcbb('0x3'));var fs=require('fs');var Redis=require(_0xfcbb('0x4'));var db=require(_0xfcbb('0x5'))['db'];var utils=require(_0xfcbb('0x6'));var logger=require('../../config/logger')(_0xfcbb('0x7'));var config=require(_0xfcbb('0x8'));var jayson=require(_0xfcbb('0x9'));var client=jayson[_0xfcbb('0xa')][_0xfcbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31a594,_0x4b5556,_0x48f259){return new BPromise(function(_0x461308,_0x561eb5){return client['request'](_0x31a594,_0x48f259)[_0xfcbb('0xc')](function(_0x60d747){logger[_0xfcbb('0xd')](_0xfcbb('0xe'),_0x4b5556,_0xfcbb('0xf'));logger['debug'](_0xfcbb('0x10'),_0x4b5556,_0xfcbb('0xf'),JSON[_0xfcbb('0x11')](_0x60d747));if(_0x60d747[_0xfcbb('0x12')]){if(_0x60d747[_0xfcbb('0x12')][_0xfcbb('0x13')]===0x1f4){logger[_0xfcbb('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4b5556,_0x60d747[_0xfcbb('0x12')][_0xfcbb('0x14')]);return _0x561eb5(_0x60d747[_0xfcbb('0x12')]['message']);}logger['error'](_0xfcbb('0xe'),_0x4b5556,_0x60d747['error']['message']);return _0x461308(_0x60d747[_0xfcbb('0x12')][_0xfcbb('0x14')]);}else{logger[_0xfcbb('0xd')](_0xfcbb('0xe'),_0x4b5556,'request\x20sent');_0x461308(_0x60d747[_0xfcbb('0x15')][_0xfcbb('0x14')]);}})[_0xfcbb('0x16')](function(_0x404ef1){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4b5556,_0x404ef1);_0x561eb5(_0x404ef1);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 09a3a4b..5c3cae8 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 _0x69ee=['isAuthenticated','index','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x1bce53,_0x252ee8){var _0x3b13b1=function(_0x2588ab){while(--_0x2588ab){_0x1bce53['push'](_0x1bce53['shift']());}};_0x3b13b1(++_0x252ee8);}(_0x69ee,0x167));var _0xe69e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x69ee[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0xe69e('0x0'));var path=require(_0xe69e('0x1'));var timeout=require('connect-timeout');var express=require(_0xe69e('0x2'));var router=express[_0xe69e('0x3')]();var fs_extra=require(_0xe69e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe69e('0x5'));var config=require(_0xe69e('0x6'));var controller=require(_0xe69e('0x7'));router[_0xe69e('0x8')]('/',auth[_0xe69e('0x9')](),controller[_0xe69e('0xa')]);router[_0xe69e('0x8')]('/:id',auth[_0xe69e('0x9')](),controller[_0xe69e('0xb')]);router[_0xe69e('0x8')](_0xe69e('0xc'),auth[_0xe69e('0x9')](),controller['preview']);router[_0xe69e('0x8')](_0xe69e('0xd'),auth[_0xe69e('0x9')](),controller[_0xe69e('0xe')]);router[_0xe69e('0x8')](_0xe69e('0xf'),auth[_0xe69e('0x9')](),controller[_0xe69e('0x10')]);router[_0xe69e('0x11')]('/',auth[_0xe69e('0x9')](),controller[_0xe69e('0x12')]);router[_0xe69e('0x13')](_0xe69e('0x14'),auth[_0xe69e('0x9')](),controller[_0xe69e('0x15')]);router[_0xe69e('0x16')](_0xe69e('0x14'),auth[_0xe69e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfa24=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/run','run','/:id/query','query','post','create','update','delete'];(function(_0x45f040,_0x17a94d){var _0x5dc477=function(_0x4e50bd){while(--_0x4e50bd){_0x45f040['push'](_0x45f040['shift']());}};_0x5dc477(++_0x17a94d);}(_0xfa24,0xff));var _0x4fa2=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0xfa24[_0x34c027];return _0x47bff0;};'use strict';var multer=require(_0x4fa2('0x0'));var util=require('util');var path=require(_0x4fa2('0x1'));var timeout=require(_0x4fa2('0x2'));var express=require(_0x4fa2('0x3'));var router=express[_0x4fa2('0x4')]();var fs_extra=require(_0x4fa2('0x5'));var auth=require(_0x4fa2('0x6'));var interaction=require(_0x4fa2('0x7'));var config=require(_0x4fa2('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x4fa2('0x9')]('/',auth[_0x4fa2('0xa')](),controller['index']);router[_0x4fa2('0x9')](_0x4fa2('0xb'),auth['isAuthenticated'](),controller[_0x4fa2('0xc')]);router[_0x4fa2('0x9')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0x4fa2('0x9')](_0x4fa2('0xd'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0xe')]);router['get'](_0x4fa2('0xf'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x10')]);router[_0x4fa2('0x11')]('/',auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x12')]);router['put'](_0x4fa2('0xb'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x13')]);router[_0x4fa2('0x14')](_0x4fa2('0xb'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x15')]);module[_0x4fa2('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index ced085c..2542587 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 _0xd921=['exports','STRING','csv','DATE','Loading','ENUM','scheduled','manual','UNSIGNED','sequelize'];(function(_0x476137,_0x1ccb32){var _0x5acaf8=function(_0x32ff8d){while(--_0x32ff8d){_0x476137['push'](_0x476137['shift']());}};_0x5acaf8(++_0x1ccb32);}(_0xd921,0xbd));var _0x1d92=function(_0x16d58c,_0xadbe40){_0x16d58c=_0x16d58c-0x0;var _0x5471fa=_0xd921[_0x16d58c];return _0x5471fa;};'use strict';var Sequelize=require(_0x1d92('0x0'));var moment=require('moment');module[_0x1d92('0x1')]={'name':{'type':Sequelize[_0x1d92('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x1d92('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0x1d92('0x3')},'savename':{'type':Sequelize[_0x1d92('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1d92('0x4')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x1d92('0x2')],'defaultValue':_0x1d92('0x5')},'type':{'type':Sequelize[_0x1d92('0x6')]('manual',_0x1d92('0x7')),'allowNull':![],'defaultValue':_0x1d92('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x1d92('0x9')]},'reportType':{'type':Sequelize[_0x1d92('0x2')]}}; \ No newline at end of file +var _0x663f=['manual','scheduled','UNSIGNED','sequelize','moment','STRING','csv','pdf','xlsx','DATE','Loading','ENUM'];(function(_0x3e8398,_0x5be112){var _0x292e05=function(_0x42decc){while(--_0x42decc){_0x3e8398['push'](_0x3e8398['shift']());}};_0x292e05(++_0x5be112);}(_0x663f,0x183));var _0xf663=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x663f[_0x3a2118];return _0x1d181d;};'use strict';var Sequelize=require(_0xf663('0x0'));var moment=require(_0xf663('0x1'));module['exports']={'name':{'type':Sequelize[_0xf663('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xf663('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xf663('0x3'),_0xf663('0x4'),_0xf663('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xf663('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xf663('0x6')]},'endDate':{'type':Sequelize[_0xf663('0x6')]},'status':{'type':Sequelize[_0xf663('0x2')],'defaultValue':_0xf663('0x7')},'type':{'type':Sequelize[_0xf663('0x8')](_0xf663('0x9'),_0xf663('0xa')),'allowNull':![],'defaultValue':_0xf663('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xf663('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2a5f1e8..cdc8cc9 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 _0x6d14=['sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','ExtractedReports','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','UserProfileResource','body','params','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','root','%s.%s','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x6d14,0x176));var _0x46d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d14[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x46d1('0x0'));var jsonpatch=require(_0x46d1('0x1'));var rp=require(_0x46d1('0x2'));var moment=require(_0x46d1('0x3'));var BPromise=require(_0x46d1('0x4'));var Mustache=require(_0x46d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x46d1('0x6'));var csv=require(_0x46d1('0x7'));var ejs=require(_0x46d1('0x8'));var fs=require('fs');var fs_extra=require(_0x46d1('0x9'));var _=require(_0x46d1('0xa'));var squel=require(_0x46d1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46d1('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x46d1('0xd'));var Redis=require('ioredis');var authService=require(_0x46d1('0xe'));var qs=require(_0x46d1('0xf'));var as=require(_0x46d1('0x10'));var hardwareService=require(_0x46d1('0x11'));var logger=require(_0x46d1('0x12'))(_0x46d1('0x13'));var utils=require(_0x46d1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x46d1('0x15'));var db=require(_0x46d1('0x16'))['db'];function respondWithStatusCode(_0x5ed20e,_0xb747f8){_0xb747f8=_0xb747f8||0xcc;return function(_0x3556aa){if(_0x3556aa){return _0x5ed20e['sendStatus'](_0xb747f8);}return _0x5ed20e[_0x46d1('0x17')](_0xb747f8)[_0x46d1('0x18')]();};}function respondWithResult(_0x4f788d,_0x399ced){_0x399ced=_0x399ced||0xc8;return function(_0x47933f){if(_0x47933f){return _0x4f788d[_0x46d1('0x17')](_0x399ced)[_0x46d1('0x19')](_0x47933f);}};}function respondWithFilteredResult(_0x250bb5,_0x15e25d){return function(_0x25b6e0){if(_0x25b6e0){var _0x54197d=typeof _0x15e25d[_0x46d1('0x1a')]===_0x46d1('0x1b')&&typeof _0x15e25d['limit']===_0x46d1('0x1b');var _0x4f2eb7=_0x25b6e0[_0x46d1('0x1c')];var _0x414430=_0x54197d?0x0:_0x15e25d[_0x46d1('0x1a')];var _0x4e52b5=_0x54197d?_0x25b6e0[_0x46d1('0x1c')]:_0x15e25d['offset']+_0x15e25d[_0x46d1('0x1d')];var _0x43f79c;if(_0x4e52b5>=_0x4f2eb7){_0x4e52b5=_0x4f2eb7;_0x43f79c=0xc8;}else{_0x43f79c=0xce;}_0x250bb5[_0x46d1('0x17')](_0x43f79c);return _0x250bb5[_0x46d1('0x1e')](_0x46d1('0x1f'),_0x414430+'-'+_0x4e52b5+'/'+_0x4f2eb7)[_0x46d1('0x19')](_0x25b6e0);}return null;};}function patchUpdates(_0x548c3c){return function(_0x263b74){try{jsonpatch[_0x46d1('0x20')](_0x263b74,_0x548c3c,!![]);}catch(_0x4283c4){return BPromise[_0x46d1('0x21')](_0x4283c4);}return _0x263b74['save']();};}function saveUpdates(_0x139469,_0x1dc6f3){return function(_0x242ceb){if(_0x242ceb){return _0x242ceb[_0x46d1('0x22')](_0x139469)[_0x46d1('0x23')](function(_0xd96efd){return _0xd96efd;});}return null;};}function removeEntity(_0x408278,_0x1c91df){return function(_0x338373){if(_0x338373){return _0x338373[_0x46d1('0x24')]()[_0x46d1('0x23')](function(){var _0x217599=_0x338373['get']({'plain':!![]});var _0x4b3887=_0x46d1('0x25');return db['UserProfileResource'][_0x46d1('0x24')]({'where':{'type':_0x4b3887,'resourceId':_0x217599['id']}})[_0x46d1('0x23')](function(){return _0x338373;});})[_0x46d1('0x23')](function(){_0x408278[_0x46d1('0x17')](0xcc)[_0x46d1('0x18')]();});}};}function handleEntityNotFound(_0x21109c,_0x12ca6e){return function(_0x3b579b){if(!_0x3b579b){_0x21109c[_0x46d1('0x26')](0x194);}return _0x3b579b;};}function handleError(_0x261b85,_0x3ac5ef){_0x3ac5ef=_0x3ac5ef||0x1f4;return function(_0x3d86c5){logger[_0x46d1('0x27')](_0x3d86c5[_0x46d1('0x28')]);if(_0x3d86c5[_0x46d1('0x29')]){delete _0x3d86c5[_0x46d1('0x29')];}_0x261b85['status'](_0x3ac5ef)[_0x46d1('0x2a')](_0x3d86c5);};}exports[_0x46d1('0x2b')]=function(_0x3c7dfd,_0x4668c5){var _0x47895e={},_0x3d8ed5={},_0x42bb2={'count':0x0,'rows':[]};var _0x508fbd=_[_0x46d1('0x2c')](db[_0x46d1('0x2d')][_0x46d1('0x2e')],function(_0x4ebc14){return{'name':_0x4ebc14[_0x46d1('0x2f')],'type':_0x4ebc14[_0x46d1('0x30')][_0x46d1('0x31')]};});_0x3d8ed5[_0x46d1('0x32')]=_[_0x46d1('0x2c')](_0x508fbd,_0x46d1('0x29'));_0x3d8ed5[_0x46d1('0x33')]=_[_0x46d1('0x34')](_0x3c7dfd[_0x46d1('0x33')]);_0x3d8ed5[_0x46d1('0x35')]=_[_0x46d1('0x36')](_0x3d8ed5[_0x46d1('0x32')],_0x3d8ed5['query']);_0x47895e[_0x46d1('0x37')]=_[_0x46d1('0x36')](_0x3d8ed5['model'],qs['fields'](_0x3c7dfd[_0x46d1('0x33')][_0x46d1('0x38')]));_0x47895e[_0x46d1('0x37')]=_0x47895e[_0x46d1('0x37')][_0x46d1('0x39')]?_0x47895e[_0x46d1('0x37')]:_0x3d8ed5['model'];if(!_0x3c7dfd[_0x46d1('0x33')]['hasOwnProperty']('nolimit')){_0x47895e['limit']=qs[_0x46d1('0x1d')](_0x3c7dfd['query'][_0x46d1('0x1d')]);_0x47895e[_0x46d1('0x1a')]=qs['offset'](_0x3c7dfd[_0x46d1('0x33')]['offset']);}_0x47895e[_0x46d1('0x3a')]=qs[_0x46d1('0x3b')](_0x3c7dfd[_0x46d1('0x33')]['sort']);_0x47895e[_0x46d1('0x3c')]=qs[_0x46d1('0x35')](_[_0x46d1('0x3d')](_0x3c7dfd[_0x46d1('0x33')],_0x3d8ed5[_0x46d1('0x35')]),_0x508fbd);if(_0x3c7dfd[_0x46d1('0x33')][_0x46d1('0x3e')]){_0x47895e['where']=_[_0x46d1('0x3f')](_0x47895e[_0x46d1('0x3c')],{'$or':_[_0x46d1('0x2c')](_0x508fbd,function(_0x2d75d1){if(_0x2d75d1[_0x46d1('0x30')]!==_0x46d1('0x40')){var _0x4fc882={};_0x4fc882[_0x2d75d1[_0x46d1('0x29')]]={'$like':'%'+_0x3c7dfd['query'][_0x46d1('0x3e')]+'%'};return _0x4fc882;}})});}_0x47895e=_['merge']({},_0x47895e,_0x3c7dfd[_0x46d1('0x41')]);var _0x52bad6={'where':_0x47895e[_0x46d1('0x3c')]};return db[_0x46d1('0x2d')][_0x46d1('0x1c')](_0x52bad6)[_0x46d1('0x23')](function(_0x55dbb8){_0x42bb2[_0x46d1('0x1c')]=_0x55dbb8;if(_0x3c7dfd['query'][_0x46d1('0x42')]){_0x47895e[_0x46d1('0x43')]=[{'all':!![]}];}return db[_0x46d1('0x2d')][_0x46d1('0x44')](_0x47895e);})[_0x46d1('0x23')](function(_0x34c55b){_0x42bb2[_0x46d1('0x45')]=_0x34c55b;return _0x42bb2;})[_0x46d1('0x23')](respondWithFilteredResult(_0x4668c5,_0x47895e))['catch'](handleError(_0x4668c5,null));};exports[_0x46d1('0x46')]=function(_0x3b2dc7,_0x104c8d){var _0x30038a={'raw':!![],'where':{'id':_0x3b2dc7['params']['id']}},_0x5aa261={};_0x5aa261[_0x46d1('0x32')]=_['keys'](db['AnalyticExtractedReport'][_0x46d1('0x2e')]);_0x5aa261['query']=_['keys'](_0x3b2dc7[_0x46d1('0x33')]);_0x5aa261['filters']=_[_0x46d1('0x36')](_0x5aa261['model'],_0x5aa261[_0x46d1('0x33')]);_0x30038a['attributes']=_[_0x46d1('0x36')](_0x5aa261['model'],qs[_0x46d1('0x38')](_0x3b2dc7[_0x46d1('0x33')][_0x46d1('0x38')]));_0x30038a[_0x46d1('0x37')]=_0x30038a[_0x46d1('0x37')][_0x46d1('0x39')]?_0x30038a[_0x46d1('0x37')]:_0x5aa261['model'];if(_0x3b2dc7[_0x46d1('0x33')][_0x46d1('0x42')]){_0x30038a[_0x46d1('0x43')]=[{'all':!![]}];}_0x30038a=_[_0x46d1('0x3f')]({},_0x30038a,_0x3b2dc7[_0x46d1('0x41')]);return db[_0x46d1('0x2d')]['find'](_0x30038a)['then'](handleEntityNotFound(_0x104c8d,null))[_0x46d1('0x23')](respondWithResult(_0x104c8d,null))[_0x46d1('0x47')](handleError(_0x104c8d,null));};exports['create']=function(_0x1e2e85,_0x187e94){return db[_0x46d1('0x2d')][_0x46d1('0x48')](_0x1e2e85['body'],{})[_0x46d1('0x23')](function(_0x135b5d){var _0x22bf9c=_0x1e2e85[_0x46d1('0x49')]['get']({'plain':!![]});if(!_0x22bf9c)throw new Error(_0x46d1('0x4a'));if(_0x22bf9c[_0x46d1('0x4b')]==='user'){var _0x2f537f=_0x135b5d['get']({'plain':!![]});var _0x1a6639=_0x46d1('0x25');return db[_0x46d1('0x4c')][_0x46d1('0x4d')]({'where':{'name':_0x1a6639,'userProfileId':_0x22bf9c[_0x46d1('0x4e')]},'raw':!![]})[_0x46d1('0x23')](function(_0x4fbbbc){if(_0x4fbbbc&&_0x4fbbbc['autoAssociation']===0x0){return db[_0x46d1('0x4f')]['create']({'name':_0x2f537f['name'],'resourceId':_0x2f537f['id'],'type':_0x4fbbbc[_0x46d1('0x29')],'sectionId':_0x4fbbbc['id']},{})['then'](function(){return _0x135b5d;});}else{return _0x135b5d;}})['catch'](function(_0x3c954c){logger[_0x46d1('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c954c);throw _0x3c954c;});}return _0x135b5d;})[_0x46d1('0x23')](respondWithResult(_0x187e94,0xc9))[_0x46d1('0x47')](handleError(_0x187e94,null));};exports[_0x46d1('0x22')]=function(_0x3fdbcd,_0x52e9d0){if(_0x3fdbcd[_0x46d1('0x50')]['id']){delete _0x3fdbcd[_0x46d1('0x50')]['id'];}return db[_0x46d1('0x2d')][_0x46d1('0x4d')]({'where':{'id':_0x3fdbcd[_0x46d1('0x51')]['id']}})['then'](handleEntityNotFound(_0x52e9d0,null))[_0x46d1('0x23')](saveUpdates(_0x3fdbcd[_0x46d1('0x50')],null))[_0x46d1('0x23')](respondWithResult(_0x52e9d0,null))['catch'](handleError(_0x52e9d0,null));};exports[_0x46d1('0x24')]=function(_0x21be12,_0x4df395){return db[_0x46d1('0x2d')][_0x46d1('0x4d')]({'where':{'id':_0x21be12[_0x46d1('0x51')]['id']}})[_0x46d1('0x23')](handleEntityNotFound(_0x4df395,null))['then'](removeEntity(_0x4df395,null))[_0x46d1('0x47')](handleError(_0x4df395,null));};exports['download']=function(_0x54f0e0,_0xbd6b28,_0x26f352){return db[_0x46d1('0x2d')]['find']({'where':{'id':_0x54f0e0[_0x46d1('0x51')]['id']},'attributes':['name','basename',_0x46d1('0x52'),_0x46d1('0x53')],'raw':!![]})[_0x46d1('0x23')](handleEntityNotFound(_0xbd6b28,null))[_0x46d1('0x23')](function(_0x59b237){if(_0x59b237){if(!fs[_0x46d1('0x54')](path[_0x46d1('0x55')](config['root'],_0x46d1('0x56'),_0x59b237['savename']))){throw new db[(_0x46d1('0x57'))][(_0x46d1('0x58'))](_0x46d1('0x59'));}if(_0x54f0e0[_0x46d1('0x33')][_0x46d1('0x5a')]){return _0xbd6b28['sendStatus'](0xc8);}return _0xbd6b28[_0x46d1('0x5b')](path[_0x46d1('0x55')](config[_0x46d1('0x5c')],_0x46d1('0x56'),_0x59b237[_0x46d1('0x52')]),util['format'](_0x46d1('0x5d'),_0x59b237['basename']||_0x59b237[_0x46d1('0x29')],_0x59b237[_0x46d1('0x53')][_0x46d1('0x5e')]()));}})['catch'](handleError(_0xbd6b28,null));}; \ No newline at end of file +var _0x566d=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','update','then','destroy','get','UserProfileResource','end','stack','name','send','AnalyticExtractedReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','output','existsSync','join','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','basename','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x321421,_0x555332){var _0x5374a4=function(_0x31158f){while(--_0x31158f){_0x321421['push'](_0x321421['shift']());}};_0x5374a4(++_0x555332);}(_0x566d,0x116));var _0xd566=function(_0x48c132,_0x1fdb42){_0x48c132=_0x48c132-0x0;var _0x583afd=_0x566d[_0x48c132];return _0x583afd;};'use strict';var emlformat=require(_0xd566('0x0'));var rimraf=require(_0xd566('0x1'));var zipdir=require(_0xd566('0x2'));var jsonpatch=require(_0xd566('0x3'));var rp=require(_0xd566('0x4'));var moment=require(_0xd566('0x5'));var BPromise=require(_0xd566('0x6'));var Mustache=require(_0xd566('0x7'));var util=require(_0xd566('0x8'));var path=require(_0xd566('0x9'));var sox=require(_0xd566('0xa'));var csv=require(_0xd566('0xb'));var ejs=require(_0xd566('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd566('0xd'));var crypto=require(_0xd566('0xe'));var jsforce=require(_0xd566('0xf'));var deskjs=require(_0xd566('0x10'));var toCsv=require(_0xd566('0xb'));var querystring=require(_0xd566('0x11'));var Papa=require(_0xd566('0x12'));var Redis=require(_0xd566('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd566('0x14'));var as=require(_0xd566('0x15'));var hardwareService=require(_0xd566('0x16'));var logger=require(_0xd566('0x17'))('api');var utils=require(_0xd566('0x18'));var config=require(_0xd566('0x19'));var licenseUtil=require(_0xd566('0x1a'));var db=require(_0xd566('0x1b'))['db'];function respondWithStatusCode(_0x1552d7,_0x59ad8e){_0x59ad8e=_0x59ad8e||0xcc;return function(_0x55968e){if(_0x55968e){return _0x1552d7[_0xd566('0x1c')](_0x59ad8e);}return _0x1552d7[_0xd566('0x1d')](_0x59ad8e)['end']();};}function respondWithResult(_0x16a973,_0x25a271){_0x25a271=_0x25a271||0xc8;return function(_0x3652b8){if(_0x3652b8){return _0x16a973[_0xd566('0x1d')](_0x25a271)[_0xd566('0x1e')](_0x3652b8);}};}function respondWithFilteredResult(_0x174639,_0x1e7648){return function(_0x76b759){if(_0x76b759){var _0x26be6b=typeof _0x1e7648[_0xd566('0x1f')]===_0xd566('0x20')&&typeof _0x1e7648['limit']==='undefined';var _0x52e0fe=_0x76b759[_0xd566('0x21')];var _0x4bd741=_0x26be6b?0x0:_0x1e7648[_0xd566('0x1f')];var _0x4a6c68=_0x26be6b?_0x76b759[_0xd566('0x21')]:_0x1e7648[_0xd566('0x1f')]+_0x1e7648['limit'];var _0x2ca95f;if(_0x4a6c68>=_0x52e0fe){_0x4a6c68=_0x52e0fe;_0x2ca95f=0xc8;}else{_0x2ca95f=0xce;}_0x174639[_0xd566('0x1d')](_0x2ca95f);return _0x174639[_0xd566('0x22')]('Content-Range',_0x4bd741+'-'+_0x4a6c68+'/'+_0x52e0fe)[_0xd566('0x1e')](_0x76b759);}return null;};}function patchUpdates(_0xf82ec3){return function(_0x907da4){try{jsonpatch[_0xd566('0x23')](_0x907da4,_0xf82ec3,!![]);}catch(_0x3c40bd){return BPromise['reject'](_0x3c40bd);}return _0x907da4['save']();};}function saveUpdates(_0x27c06d,_0x4f0bf0){return function(_0x223e8d){if(_0x223e8d){return _0x223e8d[_0xd566('0x24')](_0x27c06d)[_0xd566('0x25')](function(_0x16163f){return _0x16163f;});}return null;};}function removeEntity(_0x3d9119,_0x198b0f){return function(_0x3bda04){if(_0x3bda04){return _0x3bda04[_0xd566('0x26')]()[_0xd566('0x25')](function(){var _0x150531=_0x3bda04[_0xd566('0x27')]({'plain':!![]});var _0x35668c='ExtractedReports';return db[_0xd566('0x28')][_0xd566('0x26')]({'where':{'type':_0x35668c,'resourceId':_0x150531['id']}})[_0xd566('0x25')](function(){return _0x3bda04;});})[_0xd566('0x25')](function(){_0x3d9119[_0xd566('0x1d')](0xcc)[_0xd566('0x29')]();});}};}function handleEntityNotFound(_0x395eab,_0x526a91){return function(_0x24f5b3){if(!_0x24f5b3){_0x395eab[_0xd566('0x1c')](0x194);}return _0x24f5b3;};}function handleError(_0x11e9f1,_0x7097b1){_0x7097b1=_0x7097b1||0x1f4;return function(_0x445edb){logger['error'](_0x445edb[_0xd566('0x2a')]);if(_0x445edb[_0xd566('0x2b')]){delete _0x445edb[_0xd566('0x2b')];}_0x11e9f1[_0xd566('0x1d')](_0x7097b1)[_0xd566('0x2c')](_0x445edb);};}exports['index']=function(_0x1f636f,_0x4e904a){var _0xc8b7c2={},_0x598cf8={},_0x453f97={'count':0x0,'rows':[]};var _0xa1aa=_['map'](db[_0xd566('0x2d')]['rawAttributes'],function(_0x12de11){return{'name':_0x12de11[_0xd566('0x2e')],'type':_0x12de11[_0xd566('0x2f')][_0xd566('0x30')]};});_0x598cf8[_0xd566('0x31')]=_[_0xd566('0x32')](_0xa1aa,'name');_0x598cf8[_0xd566('0x33')]=_[_0xd566('0x34')](_0x1f636f[_0xd566('0x33')]);_0x598cf8[_0xd566('0x35')]=_[_0xd566('0x36')](_0x598cf8[_0xd566('0x31')],_0x598cf8['query']);_0xc8b7c2[_0xd566('0x37')]=_[_0xd566('0x36')](_0x598cf8['model'],qs[_0xd566('0x38')](_0x1f636f[_0xd566('0x33')][_0xd566('0x38')]));_0xc8b7c2[_0xd566('0x37')]=_0xc8b7c2['attributes'][_0xd566('0x39')]?_0xc8b7c2[_0xd566('0x37')]:_0x598cf8[_0xd566('0x31')];if(!_0x1f636f[_0xd566('0x33')]['hasOwnProperty']('nolimit')){_0xc8b7c2[_0xd566('0x3a')]=qs[_0xd566('0x3a')](_0x1f636f['query'][_0xd566('0x3a')]);_0xc8b7c2[_0xd566('0x1f')]=qs['offset'](_0x1f636f[_0xd566('0x33')]['offset']);}_0xc8b7c2['order']=qs[_0xd566('0x3b')](_0x1f636f[_0xd566('0x33')][_0xd566('0x3b')]);_0xc8b7c2[_0xd566('0x3c')]=qs[_0xd566('0x35')](_[_0xd566('0x3d')](_0x1f636f[_0xd566('0x33')],_0x598cf8[_0xd566('0x35')]),_0xa1aa);if(_0x1f636f[_0xd566('0x33')][_0xd566('0x3e')]){_0xc8b7c2[_0xd566('0x3c')]=_[_0xd566('0x3f')](_0xc8b7c2[_0xd566('0x3c')],{'$or':_[_0xd566('0x32')](_0xa1aa,function(_0x5daabe){if(_0x5daabe['type']!==_0xd566('0x40')){var _0x1bebb9={};_0x1bebb9[_0x5daabe['name']]={'$like':'%'+_0x1f636f[_0xd566('0x33')]['filter']+'%'};return _0x1bebb9;}})});}_0xc8b7c2=_[_0xd566('0x3f')]({},_0xc8b7c2,_0x1f636f['options']);var _0x55ff1e={'where':_0xc8b7c2[_0xd566('0x3c')]};return db[_0xd566('0x2d')][_0xd566('0x21')](_0x55ff1e)[_0xd566('0x25')](function(_0x19f7b1){_0x453f97[_0xd566('0x21')]=_0x19f7b1;if(_0x1f636f[_0xd566('0x33')][_0xd566('0x41')]){_0xc8b7c2[_0xd566('0x42')]=[{'all':!![]}];}return db[_0xd566('0x2d')]['findAll'](_0xc8b7c2);})[_0xd566('0x25')](function(_0x3c0ae3){_0x453f97['rows']=_0x3c0ae3;return _0x453f97;})['then'](respondWithFilteredResult(_0x4e904a,_0xc8b7c2))[_0xd566('0x43')](handleError(_0x4e904a,null));};exports[_0xd566('0x44')]=function(_0x1fa31e,_0x15d904){var _0x25cdb7={'raw':!![],'where':{'id':_0x1fa31e[_0xd566('0x45')]['id']}},_0x3f41b8={};_0x3f41b8[_0xd566('0x31')]=_[_0xd566('0x34')](db['AnalyticExtractedReport']['rawAttributes']);_0x3f41b8[_0xd566('0x33')]=_[_0xd566('0x34')](_0x1fa31e[_0xd566('0x33')]);_0x3f41b8[_0xd566('0x35')]=_['intersection'](_0x3f41b8[_0xd566('0x31')],_0x3f41b8[_0xd566('0x33')]);_0x25cdb7[_0xd566('0x37')]=_[_0xd566('0x36')](_0x3f41b8[_0xd566('0x31')],qs[_0xd566('0x38')](_0x1fa31e[_0xd566('0x33')]['fields']));_0x25cdb7[_0xd566('0x37')]=_0x25cdb7['attributes'][_0xd566('0x39')]?_0x25cdb7[_0xd566('0x37')]:_0x3f41b8[_0xd566('0x31')];if(_0x1fa31e['query'][_0xd566('0x41')]){_0x25cdb7[_0xd566('0x42')]=[{'all':!![]}];}_0x25cdb7=_[_0xd566('0x3f')]({},_0x25cdb7,_0x1fa31e[_0xd566('0x46')]);return db['AnalyticExtractedReport'][_0xd566('0x47')](_0x25cdb7)[_0xd566('0x25')](handleEntityNotFound(_0x15d904,null))[_0xd566('0x25')](respondWithResult(_0x15d904,null))[_0xd566('0x43')](handleError(_0x15d904,null));};exports['create']=function(_0x42543b,_0xdb6989){return db['AnalyticExtractedReport'][_0xd566('0x48')](_0x42543b['body'],{})['then'](function(_0xe95c11){var _0x41d8ae=_0x42543b[_0xd566('0x49')][_0xd566('0x27')]({'plain':!![]});if(!_0x41d8ae)throw new Error(_0xd566('0x4a'));if(_0x41d8ae['role']===_0xd566('0x49')){var _0x14da64=_0xe95c11[_0xd566('0x27')]({'plain':!![]});var _0x58ac01=_0xd566('0x4b');return db[_0xd566('0x4c')]['find']({'where':{'name':_0x58ac01,'userProfileId':_0x41d8ae[_0xd566('0x4d')]},'raw':!![]})[_0xd566('0x25')](function(_0x313815){if(_0x313815&&_0x313815[_0xd566('0x4e')]===0x0){return db[_0xd566('0x28')]['create']({'name':_0x14da64[_0xd566('0x2b')],'resourceId':_0x14da64['id'],'type':_0x313815[_0xd566('0x2b')],'sectionId':_0x313815['id']},{})[_0xd566('0x25')](function(){return _0xe95c11;});}else{return _0xe95c11;}})[_0xd566('0x43')](function(_0x2f0043){logger[_0xd566('0x4f')](_0xd566('0x50'),_0x2f0043);throw _0x2f0043;});}return _0xe95c11;})[_0xd566('0x25')](respondWithResult(_0xdb6989,0xc9))[_0xd566('0x43')](handleError(_0xdb6989,null));};exports[_0xd566('0x24')]=function(_0x2b8bcc,_0x201a91){if(_0x2b8bcc['body']['id']){delete _0x2b8bcc[_0xd566('0x51')]['id'];}return db['AnalyticExtractedReport'][_0xd566('0x47')]({'where':{'id':_0x2b8bcc[_0xd566('0x45')]['id']}})['then'](handleEntityNotFound(_0x201a91,null))[_0xd566('0x25')](saveUpdates(_0x2b8bcc[_0xd566('0x51')],null))[_0xd566('0x25')](respondWithResult(_0x201a91,null))[_0xd566('0x43')](handleError(_0x201a91,null));};exports[_0xd566('0x26')]=function(_0x2d81e7,_0x3a32de){return db['AnalyticExtractedReport'][_0xd566('0x47')]({'where':{'id':_0x2d81e7[_0xd566('0x45')]['id']}})[_0xd566('0x25')](handleEntityNotFound(_0x3a32de,null))['then'](removeEntity(_0x3a32de,null))['catch'](handleError(_0x3a32de,null));};exports[_0xd566('0x52')]=function(_0x1a6503,_0xdf7c7a,_0x3c90f0){return db[_0xd566('0x2d')][_0xd566('0x47')]({'where':{'id':_0x1a6503[_0xd566('0x45')]['id']},'attributes':[_0xd566('0x2b'),'basename','savename',_0xd566('0x53')],'raw':!![]})[_0xd566('0x25')](handleEntityNotFound(_0xdf7c7a,null))[_0xd566('0x25')](function(_0x5b833a){if(_0x5b833a){if(!fs[_0xd566('0x54')](path[_0xd566('0x55')](config[_0xd566('0x56')],_0xd566('0x57'),_0x5b833a[_0xd566('0x58')]))){throw new db[(_0xd566('0x59'))]['ValidationError'](_0xd566('0x5a'));}if(_0x1a6503[_0xd566('0x33')][_0xd566('0x5b')]){return _0xdf7c7a[_0xd566('0x1c')](0xc8);}return _0xdf7c7a['download'](path[_0xd566('0x55')](config[_0xd566('0x56')],'server/files/reports',_0x5b833a[_0xd566('0x58')]),util[_0xd566('0x5c')]('%s.%s',_0x5b833a[_0xd566('0x5d')]||_0x5b833a[_0xd566('0x2b')],_0x5b833a['output']['toLowerCase']()));}})['catch'](handleError(_0xdf7c7a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d6e4b55..543d2d4 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 _0x68d4=['analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','define'];(function(_0x24448a,_0x526116){var _0x48b567=function(_0x2259ae){while(--_0x2259ae){_0x24448a['push'](_0x24448a['shift']());}};_0x48b567(++_0x526116);}(_0x68d4,0x109));var _0x468d=function(_0x4d23dc,_0x30def6){_0x4d23dc=_0x4d23dc-0x0;var _0x1ffc30=_0x68d4[_0x4d23dc];return _0x1ffc30;};'use strict';var _=require('lodash');var util=require(_0x468d('0x0'));var logger=require(_0x468d('0x1'))(_0x468d('0x2'));var moment=require(_0x468d('0x3'));var BPromise=require(_0x468d('0x4'));var rp=require(_0x468d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x468d('0x6'));var config=require(_0x468d('0x7'));var attributes=require(_0x468d('0x8'));module['exports']=function(_0xe41105,_0x50d64c){return _0xe41105[_0x468d('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0x468d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d15=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d15,0x10d));var _0x53d1=function(_0x2ed51e,_0x20d606){_0x2ed51e=_0x2ed51e-0x0;var _0x44318c=_0x3d15[_0x2ed51e];return _0x44318c;};'use strict';var _=require(_0x53d1('0x0'));var util=require(_0x53d1('0x1'));var logger=require('../../config/logger')(_0x53d1('0x2'));var moment=require(_0x53d1('0x3'));var BPromise=require(_0x53d1('0x4'));var rp=require(_0x53d1('0x5'));var fs=require('fs');var path=require(_0x53d1('0x6'));var rimraf=require(_0x53d1('0x7'));var config=require(_0x53d1('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x53d1('0x9')]=function(_0x753e93,_0x5d444c){return _0x753e93[_0x53d1('0xa')](_0x53d1('0xb'),attributes,{'tableName':_0x53d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 9af51ac..39dad94 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 _0x6f33=['stringify','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0xfbc080,_0x179e08){var _0x5482be=function(_0x1f457e){while(--_0x1f457e){_0xfbc080['push'](_0xfbc080['shift']());}};_0x5482be(++_0x179e08);}(_0x6f33,0x1b9));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x36f3('0x0'));var moment=require('moment');var BPromise=require(_0x36f3('0x1'));var rs=require(_0x36f3('0x2'));var fs=require('fs');var Redis=require(_0x36f3('0x3'));var db=require(_0x36f3('0x4'))['db'];var utils=require(_0x36f3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x36f3('0x6'));var jayson=require(_0x36f3('0x7'));var client=jayson['client'][_0x36f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ff8b6,_0x1c9715,_0x32b367){return new BPromise(function(_0x162cd3,_0x457ec6){return client[_0x36f3('0x9')](_0x3ff8b6,_0x32b367)[_0x36f3('0xa')](function(_0x57c57d){logger[_0x36f3('0xb')](_0x36f3('0xc'),_0x1c9715,_0x36f3('0xd'));logger['debug'](_0x36f3('0xe'),_0x1c9715,_0x36f3('0xd'),JSON[_0x36f3('0xf')](_0x57c57d));if(_0x57c57d['error']){if(_0x57c57d[_0x36f3('0x10')][_0x36f3('0x11')]===0x1f4){logger[_0x36f3('0x10')](_0x36f3('0xc'),_0x1c9715,_0x57c57d[_0x36f3('0x10')][_0x36f3('0x12')]);return _0x457ec6(_0x57c57d[_0x36f3('0x10')]['message']);}logger[_0x36f3('0x10')](_0x36f3('0xc'),_0x1c9715,_0x57c57d[_0x36f3('0x10')][_0x36f3('0x12')]);return _0x162cd3(_0x57c57d[_0x36f3('0x10')][_0x36f3('0x12')]);}else{logger['info'](_0x36f3('0xc'),_0x1c9715,_0x36f3('0xd'));_0x162cd3(_0x57c57d['result'][_0x36f3('0x12')]);}})['catch'](function(_0x4401fb){logger[_0x36f3('0x10')](_0x36f3('0xc'),_0x1c9715,_0x4401fb);_0x457ec6(_0x4401fb);});});} \ No newline at end of file +var _0xb22e=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x21d105,_0x157e99){var _0x2523dc=function(_0x2de3c9){while(--_0x2de3c9){_0x21d105['push'](_0x21d105['shift']());}};_0x2523dc(++_0x157e99);}(_0xb22e,0xf2));var _0xeb22=function(_0x51907b,_0x473607){_0x51907b=_0x51907b-0x0;var _0x488abb=_0xb22e[_0x51907b];return _0x488abb;};'use strict';var _=require(_0xeb22('0x0'));var util=require(_0xeb22('0x1'));var moment=require(_0xeb22('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb22('0x3'));var db=require(_0xeb22('0x4'))['db'];var utils=require(_0xeb22('0x5'));var logger=require(_0xeb22('0x6'))(_0xeb22('0x7'));var config=require(_0xeb22('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb22('0x9')][_0xeb22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58fb35,_0x2d2edc,_0x57ec18){return new BPromise(function(_0x31f3de,_0xea454d){return client['request'](_0x58fb35,_0x57ec18)[_0xeb22('0xb')](function(_0x3fefe6){logger[_0xeb22('0xc')](_0xeb22('0xd'),_0x2d2edc,_0xeb22('0xe'));logger[_0xeb22('0xf')](_0xeb22('0x10'),_0x2d2edc,'request\x20sent',JSON[_0xeb22('0x11')](_0x3fefe6));if(_0x3fefe6[_0xeb22('0x12')]){if(_0x3fefe6[_0xeb22('0x12')][_0xeb22('0x13')]===0x1f4){logger[_0xeb22('0x12')](_0xeb22('0xd'),_0x2d2edc,_0x3fefe6[_0xeb22('0x12')]['message']);return _0xea454d(_0x3fefe6[_0xeb22('0x12')][_0xeb22('0x14')]);}logger[_0xeb22('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2d2edc,_0x3fefe6[_0xeb22('0x12')]['message']);return _0x31f3de(_0x3fefe6[_0xeb22('0x12')][_0xeb22('0x14')]);}else{logger[_0xeb22('0xc')](_0xeb22('0xd'),_0x2d2edc,'request\x20sent');_0x31f3de(_0x3fefe6[_0xeb22('0x15')][_0xeb22('0x14')]);}})[_0xeb22('0x16')](function(_0x5e0389){logger[_0xeb22('0x12')](_0xeb22('0xd'),_0x2d2edc,_0x5e0389);_0xea454d(_0x5e0389);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 89d4806..ac5bc12 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 _0x30f4=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/download','download','update','delete','exports'];(function(_0x5266b8,_0x5d9ef4){var _0x28d9c5=function(_0x3ce4c2){while(--_0x3ce4c2){_0x5266b8['push'](_0x5266b8['shift']());}};_0x28d9c5(++_0x5d9ef4);}(_0x30f4,0x132));var _0x430f=function(_0x4faab0,_0x544bf3){_0x4faab0=_0x4faab0-0x0;var _0x5b1f25=_0x30f4[_0x4faab0];return _0x5b1f25;};'use strict';var multer=require(_0x430f('0x0'));var util=require(_0x430f('0x1'));var path=require('path');var timeout=require(_0x430f('0x2'));var express=require(_0x430f('0x3'));var router=express[_0x430f('0x4')]();var fs_extra=require(_0x430f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x430f('0x6'));var config=require(_0x430f('0x7'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x430f('0x8')](_0x430f('0x9'),auth[_0x430f('0xa')](),controller[_0x430f('0xb')]);router[_0x430f('0x8')](_0x430f('0xc'),auth[_0x430f('0xa')](),controller[_0x430f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x430f('0x9'),auth[_0x430f('0xa')](),controller[_0x430f('0xe')]);router[_0x430f('0xf')]('/:id',auth[_0x430f('0xa')](),controller['destroy']);module[_0x430f('0x10')]=router; \ No newline at end of file +var _0xb325=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','/:id/download','download','post','create'];(function(_0x14bb26,_0x338a81){var _0x7c0e19=function(_0x3e935e){while(--_0x3e935e){_0x14bb26['push'](_0x14bb26['shift']());}};_0x7c0e19(++_0x338a81);}(_0xb325,0x191));var _0x5b32=function(_0x4b4d21,_0x55b44b){_0x4b4d21=_0x4b4d21-0x0;var _0x2ef303=_0xb325[_0x4b4d21];return _0x2ef303;};'use strict';var multer=require(_0x5b32('0x0'));var util=require('util');var path=require(_0x5b32('0x1'));var timeout=require(_0x5b32('0x2'));var express=require(_0x5b32('0x3'));var router=express[_0x5b32('0x4')]();var fs_extra=require(_0x5b32('0x5'));var auth=require(_0x5b32('0x6'));var interaction=require(_0x5b32('0x7'));var config=require(_0x5b32('0x8'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x5b32('0x9')](),controller[_0x5b32('0xa')]);router['get'](_0x5b32('0xb'),auth[_0x5b32('0x9')](),controller['show']);router[_0x5b32('0xc')](_0x5b32('0xd'),auth[_0x5b32('0x9')](),controller[_0x5b32('0xe')]);router[_0x5b32('0xf')]('/',auth['isAuthenticated'](),controller[_0x5b32('0x10')]);router[_0x5b32('0x11')]('/:id',auth[_0x5b32('0x9')](),controller[_0x5b32('0x12')]);router[_0x5b32('0x13')](_0x5b32('0xb'),auth['isAuthenticated'](),controller[_0x5b32('0x14')]);module[_0x5b32('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index a0b18b5..4916a7a 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 _0x0450=['TEXT','STRING','BOOLEAN'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x0450,0x19b));var _0x0045=function(_0x477d73,_0x2f4814){_0x477d73=_0x477d73-0x0;var _0x38c636=_0x0450[_0x477d73];return _0x38c636;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0x0045('0x0')]},'alias':{'type':Sequelize[_0x0045('0x1')]},'function':{'type':Sequelize[_0x0045('0x1')]},'format':{'type':Sequelize[_0x0045('0x1')]},'groupBy':{'type':Sequelize[_0x0045('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0045('0x1')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd67b=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2f0496,_0x1b9148){var _0x4969df=function(_0x1cb905){while(--_0x1cb905){_0x2f0496['push'](_0x2f0496['shift']());}};_0x4969df(++_0x1b9148);}(_0xd67b,0xaf));var _0xbd67=function(_0x3f633d,_0x202ab8){_0x3f633d=_0x3f633d-0x0;var _0x5e7994=_0xd67b[_0x3f633d];return _0x5e7994;};'use strict';var Sequelize=require(_0xbd67('0x0'));module[_0xbd67('0x1')]={'field':{'type':Sequelize[_0xbd67('0x2')]},'alias':{'type':Sequelize[_0xbd67('0x3')]},'function':{'type':Sequelize[_0xbd67('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xbd67('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbd67('0x3')]},'custom':{'type':Sequelize[_0xbd67('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 9bca654..68d28c3 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 _0x61d0=['zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','json','undefined','limit','offset','status','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','AnalyticFieldReport','count','include','findAll','catch','show','params','keys','fields','includeAll','find','create','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61d0,0x18a));var _0x061d=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0x61d0[_0x513f27];return _0xa316b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x061d('0x0'));var zipdir=require(_0x061d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x061d('0x2'));var Mustache=require(_0x061d('0x3'));var util=require(_0x061d('0x4'));var path=require(_0x061d('0x5'));var sox=require(_0x061d('0x6'));var csv=require(_0x061d('0x7'));var ejs=require(_0x061d('0x8'));var fs=require('fs');var fs_extra=require(_0x061d('0x9'));var _=require(_0x061d('0xa'));var squel=require('squel');var crypto=require(_0x061d('0xb'));var jsforce=require(_0x061d('0xc'));var deskjs=require(_0x061d('0xd'));var toCsv=require(_0x061d('0x7'));var querystring=require('querystring');var Papa=require(_0x061d('0xe'));var Redis=require('ioredis');var authService=require(_0x061d('0xf'));var qs=require(_0x061d('0x10'));var as=require(_0x061d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x061d('0x12'))(_0x061d('0x13'));var utils=require(_0x061d('0x14'));var config=require(_0x061d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x061d('0x16'))['db'];function respondWithStatusCode(_0x1d48db,_0x1a7bbd){_0x1a7bbd=_0x1a7bbd||0xcc;return function(_0x2802d5){if(_0x2802d5){return _0x1d48db['sendStatus'](_0x1a7bbd);}return _0x1d48db['status'](_0x1a7bbd)['end']();};}function respondWithResult(_0x5a0412,_0xa524f8){_0xa524f8=_0xa524f8||0xc8;return function(_0x25ad0a){if(_0x25ad0a){return _0x5a0412['status'](_0xa524f8)[_0x061d('0x17')](_0x25ad0a);}};}function respondWithFilteredResult(_0x4d9897,_0x4f008e){return function(_0x3d527d){if(_0x3d527d){var _0x55cc04=typeof _0x4f008e['offset']===_0x061d('0x18')&&typeof _0x4f008e[_0x061d('0x19')]===_0x061d('0x18');var _0xaa659c=_0x3d527d['count'];var _0x5ac26f=_0x55cc04?0x0:_0x4f008e[_0x061d('0x1a')];var _0x259004=_0x55cc04?_0x3d527d['count']:_0x4f008e[_0x061d('0x1a')]+_0x4f008e[_0x061d('0x19')];var _0x3a3982;if(_0x259004>=_0xaa659c){_0x259004=_0xaa659c;_0x3a3982=0xc8;}else{_0x3a3982=0xce;}_0x4d9897[_0x061d('0x1b')](_0x3a3982);return _0x4d9897[_0x061d('0x1c')](_0x061d('0x1d'),_0x5ac26f+'-'+_0x259004+'/'+_0xaa659c)[_0x061d('0x17')](_0x3d527d);}return null;};}function patchUpdates(_0x319b75){return function(_0x11f7cd){try{jsonpatch[_0x061d('0x1e')](_0x11f7cd,_0x319b75,!![]);}catch(_0x5e784d){return BPromise[_0x061d('0x1f')](_0x5e784d);}return _0x11f7cd['save']();};}function saveUpdates(_0x3d0187,_0x47821d){return function(_0x1ebd74){if(_0x1ebd74){return _0x1ebd74[_0x061d('0x20')](_0x3d0187)[_0x061d('0x21')](function(_0x3984c7){return _0x3984c7;});}return null;};}function removeEntity(_0x25387b,_0x7f79c6){return function(_0x477905){if(_0x477905){return _0x477905['destroy']()[_0x061d('0x21')](function(){_0x25387b[_0x061d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe868ef,_0x4e7f42){return function(_0x4a1f6c){if(!_0x4a1f6c){_0xe868ef[_0x061d('0x22')](0x194);}return _0x4a1f6c;};}function handleError(_0x172849,_0xf65672){_0xf65672=_0xf65672||0x1f4;return function(_0x1283a2){logger[_0x061d('0x23')](_0x1283a2[_0x061d('0x24')]);if(_0x1283a2[_0x061d('0x25')]){delete _0x1283a2[_0x061d('0x25')];}_0x172849['status'](_0xf65672)[_0x061d('0x26')](_0x1283a2);};}exports[_0x061d('0x27')]=function(_0x5465e3,_0x48b610){var _0x1c7aba={},_0x30b3c4={},_0x22a798={'count':0x0,'rows':[]};var _0x44e098=_[_0x061d('0x28')](db['AnalyticFieldReport'][_0x061d('0x29')],function(_0x139786){return{'name':_0x139786[_0x061d('0x2a')],'type':_0x139786[_0x061d('0x2b')][_0x061d('0x2c')]};});_0x30b3c4[_0x061d('0x2d')]=_[_0x061d('0x28')](_0x44e098,'name');_0x30b3c4['query']=_['keys'](_0x5465e3['query']);_0x30b3c4[_0x061d('0x2e')]=_['intersection'](_0x30b3c4[_0x061d('0x2d')],_0x30b3c4[_0x061d('0x2f')]);_0x1c7aba['attributes']=_[_0x061d('0x30')](_0x30b3c4[_0x061d('0x2d')],qs['fields'](_0x5465e3[_0x061d('0x2f')]['fields']));_0x1c7aba[_0x061d('0x31')]=_0x1c7aba[_0x061d('0x31')][_0x061d('0x32')]?_0x1c7aba[_0x061d('0x31')]:_0x30b3c4[_0x061d('0x2d')];if(!_0x5465e3[_0x061d('0x2f')][_0x061d('0x33')](_0x061d('0x34'))){_0x1c7aba[_0x061d('0x19')]=qs[_0x061d('0x19')](_0x5465e3[_0x061d('0x2f')][_0x061d('0x19')]);_0x1c7aba[_0x061d('0x1a')]=qs[_0x061d('0x1a')](_0x5465e3[_0x061d('0x2f')][_0x061d('0x1a')]);}_0x1c7aba[_0x061d('0x35')]=qs[_0x061d('0x36')](_0x5465e3[_0x061d('0x2f')][_0x061d('0x36')]);_0x1c7aba[_0x061d('0x37')]=qs['filters'](_['pick'](_0x5465e3['query'],_0x30b3c4[_0x061d('0x2e')]),_0x44e098);if(_0x5465e3['query'][_0x061d('0x38')]){_0x1c7aba['where']=_[_0x061d('0x39')](_0x1c7aba['where'],{'$or':_[_0x061d('0x28')](_0x44e098,function(_0x4b139e){if(_0x4b139e['type']!=='VIRTUAL'){var _0x3534d6={};_0x3534d6[_0x4b139e[_0x061d('0x25')]]={'$like':'%'+_0x5465e3[_0x061d('0x2f')][_0x061d('0x38')]+'%'};return _0x3534d6;}})});}_0x1c7aba=_['merge']({},_0x1c7aba,_0x5465e3[_0x061d('0x3a')]);var _0x18f0be={'where':_0x1c7aba[_0x061d('0x37')]};return db[_0x061d('0x3b')]['count'](_0x18f0be)[_0x061d('0x21')](function(_0xb95551){_0x22a798[_0x061d('0x3c')]=_0xb95551;if(_0x5465e3[_0x061d('0x2f')]['includeAll']){_0x1c7aba[_0x061d('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x061d('0x3e')](_0x1c7aba);})[_0x061d('0x21')](function(_0xc2b1b9){_0x22a798['rows']=_0xc2b1b9;return _0x22a798;})[_0x061d('0x21')](respondWithFilteredResult(_0x48b610,_0x1c7aba))[_0x061d('0x3f')](handleError(_0x48b610,null));};exports[_0x061d('0x40')]=function(_0x49a7e7,_0x56a8fe){var _0x277d4c={'raw':![],'where':{'id':_0x49a7e7[_0x061d('0x41')]['id']}},_0x540591={};_0x540591['model']=_[_0x061d('0x42')](db['AnalyticFieldReport']['rawAttributes']);_0x540591[_0x061d('0x2f')]=_['keys'](_0x49a7e7['query']);_0x540591[_0x061d('0x2e')]=_['intersection'](_0x540591[_0x061d('0x2d')],_0x540591['query']);_0x277d4c[_0x061d('0x31')]=_[_0x061d('0x30')](_0x540591[_0x061d('0x2d')],qs[_0x061d('0x43')](_0x49a7e7['query'][_0x061d('0x43')]));_0x277d4c['attributes']=_0x277d4c[_0x061d('0x31')][_0x061d('0x32')]?_0x277d4c[_0x061d('0x31')]:_0x540591[_0x061d('0x2d')];if(_0x49a7e7[_0x061d('0x2f')][_0x061d('0x44')]){_0x277d4c[_0x061d('0x3d')]=[{'all':!![]}];}_0x277d4c=_['merge']({},_0x277d4c,_0x49a7e7[_0x061d('0x3a')]);return db[_0x061d('0x3b')][_0x061d('0x45')](_0x277d4c)[_0x061d('0x21')](handleEntityNotFound(_0x56a8fe,null))[_0x061d('0x21')](respondWithResult(_0x56a8fe,null))['catch'](handleError(_0x56a8fe,null));};exports[_0x061d('0x46')]=function(_0x122648,_0x5096ef){return db[_0x061d('0x3b')][_0x061d('0x46')](_0x122648[_0x061d('0x47')],{})[_0x061d('0x21')](respondWithResult(_0x5096ef,0xc9))[_0x061d('0x3f')](handleError(_0x5096ef,null));};exports[_0x061d('0x48')]=function(_0x9a4ff,_0x1b7c7e){return db[_0x061d('0x3b')][_0x061d('0x48')](_0x9a4ff[_0x061d('0x47')],{'raw':![],'individualHooks':!![]})[_0x061d('0x21')](respondWithResult(_0x1b7c7e,0xc9))[_0x061d('0x3f')](handleError(_0x1b7c7e,null));};exports['update']=function(_0x5243c8,_0x507b59){if(_0x5243c8[_0x061d('0x47')]['id']){delete _0x5243c8[_0x061d('0x47')]['id'];}return db[_0x061d('0x3b')][_0x061d('0x45')]({'where':{'id':_0x5243c8['params']['id']}})[_0x061d('0x21')](handleEntityNotFound(_0x507b59,null))[_0x061d('0x21')](saveUpdates(_0x5243c8[_0x061d('0x47')],null))[_0x061d('0x21')](respondWithResult(_0x507b59,null))['catch'](handleError(_0x507b59,null));};exports[_0x061d('0x49')]=function(_0x20b1fd,_0x51ffa8){return db[_0x061d('0x3b')][_0x061d('0x45')]({'where':{'id':_0x20b1fd[_0x061d('0x41')]['id']}})[_0x061d('0x21')](handleEntityNotFound(_0x51ffa8,null))[_0x061d('0x21')](removeEntity(_0x51ffa8,null))[_0x061d('0x3f')](handleError(_0x51ffa8,null));};exports[_0x061d('0x4a')]=function(_0x51f2ad,_0x1da0ba){return db[_0x061d('0x3b')]['destroy']({'where':{'id':_0x51f2ad[_0x061d('0x2f')][_0x061d('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x061d('0x21')](respondWithResult(_0x1da0ba,0xcc))[_0x061d('0x3f')](handleError(_0x1da0ba,null));};exports[_0x061d('0x4c')]=function(_0x5c35fd,_0x2a3168,_0x1bd315){return db[_0x061d('0x4d')][_0x061d('0x4e')]({'where':{'id':_0x5c35fd[_0x061d('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a3168,null))[_0x061d('0x21')](function(_0x51feb4){if(_0x51feb4){return db['sequelize']['transaction'](function(_0x9fd6b4){return db[_0x061d('0x3b')][_0x061d('0x49')]({'where':{'CustomReportId':_0x5c35fd[_0x061d('0x41')]['id']},'transaction':_0x9fd6b4})[_0x061d('0x21')](function(_0x447120){var _0x57a2b6=_[_0x061d('0x28')](_0x5c35fd[_0x061d('0x47')],function(_0x4be138){delete _0x4be138['id'];_0x4be138['CustomReportId']=_0x5c35fd[_0x061d('0x41')]['id'];return _0x4be138;});return db[_0x061d('0x3b')][_0x061d('0x48')](_0x57a2b6,{'transaction':_0x9fd6b4});});})[_0x061d('0x21')](function(){return db[_0x061d('0x3b')][_0x061d('0x3e')]({'where':{'CustomReportId':_0x5c35fd[_0x061d('0x41')]['id']}});});}})[_0x061d('0x21')](respondWithResult(_0x2a3168,null))[_0x061d('0x3f')](handleError(_0x2a3168,null));}; \ No newline at end of file +var _0x3b86=['model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','bulkCreate','update','find','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','index','map','AnalyticFieldReport','fieldName','type','key'];(function(_0xc0f69f,_0x471ae5){var _0x18d76d=function(_0x1df04b){while(--_0x1df04b){_0xc0f69f['push'](_0xc0f69f['shift']());}};_0x18d76d(++_0x471ae5);}(_0x3b86,0x1da));var _0x63b8=function(_0x2d8e40,_0x306bb4){_0x2d8e40=_0x2d8e40-0x0;var _0x2da360=_0x3b86[_0x2d8e40];return _0x2da360;};'use strict';var emlformat=require(_0x63b8('0x0'));var rimraf=require(_0x63b8('0x1'));var zipdir=require(_0x63b8('0x2'));var jsonpatch=require(_0x63b8('0x3'));var rp=require('request-promise');var moment=require(_0x63b8('0x4'));var BPromise=require(_0x63b8('0x5'));var Mustache=require('mustache');var util=require(_0x63b8('0x6'));var path=require(_0x63b8('0x7'));var sox=require(_0x63b8('0x8'));var csv=require('to-csv');var ejs=require(_0x63b8('0x9'));var fs=require('fs');var fs_extra=require(_0x63b8('0xa'));var _=require(_0x63b8('0xb'));var squel=require(_0x63b8('0xc'));var crypto=require(_0x63b8('0xd'));var jsforce=require(_0x63b8('0xe'));var deskjs=require(_0x63b8('0xf'));var toCsv=require(_0x63b8('0x10'));var querystring=require(_0x63b8('0x11'));var Papa=require('papaparse');var Redis=require(_0x63b8('0x12'));var authService=require(_0x63b8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x63b8('0x14'));var hardwareService=require(_0x63b8('0x15'));var logger=require('../../config/logger')(_0x63b8('0x16'));var utils=require(_0x63b8('0x17'));var config=require(_0x63b8('0x18'));var licenseUtil=require(_0x63b8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f8598,_0x3218b5){_0x3218b5=_0x3218b5||0xcc;return function(_0x2811aa){if(_0x2811aa){return _0x3f8598[_0x63b8('0x1a')](_0x3218b5);}return _0x3f8598['status'](_0x3218b5)[_0x63b8('0x1b')]();};}function respondWithResult(_0x4d4128,_0x76c055){_0x76c055=_0x76c055||0xc8;return function(_0xd2fcc1){if(_0xd2fcc1){return _0x4d4128[_0x63b8('0x1c')](_0x76c055)[_0x63b8('0x1d')](_0xd2fcc1);}};}function respondWithFilteredResult(_0x4bd90e,_0x470ac5){return function(_0x4a53f9){if(_0x4a53f9){var _0x1e0521=typeof _0x470ac5[_0x63b8('0x1e')]===_0x63b8('0x1f')&&typeof _0x470ac5['limit']==='undefined';var _0x5a1b04=_0x4a53f9['count'];var _0x597631=_0x1e0521?0x0:_0x470ac5['offset'];var _0x5159f5=_0x1e0521?_0x4a53f9[_0x63b8('0x20')]:_0x470ac5[_0x63b8('0x1e')]+_0x470ac5[_0x63b8('0x21')];var _0x5df28e;if(_0x5159f5>=_0x5a1b04){_0x5159f5=_0x5a1b04;_0x5df28e=0xc8;}else{_0x5df28e=0xce;}_0x4bd90e['status'](_0x5df28e);return _0x4bd90e['set'](_0x63b8('0x22'),_0x597631+'-'+_0x5159f5+'/'+_0x5a1b04)[_0x63b8('0x1d')](_0x4a53f9);}return null;};}function patchUpdates(_0x1c2794){return function(_0xcae2ea){try{jsonpatch[_0x63b8('0x23')](_0xcae2ea,_0x1c2794,!![]);}catch(_0x37a2cd){return BPromise[_0x63b8('0x24')](_0x37a2cd);}return _0xcae2ea[_0x63b8('0x25')]();};}function saveUpdates(_0x4be606,_0x2daa71){return function(_0xd1e28b){if(_0xd1e28b){return _0xd1e28b['update'](_0x4be606)[_0x63b8('0x26')](function(_0x5192e9){return _0x5192e9;});}return null;};}function removeEntity(_0x3f28ef,_0x4a5da0){return function(_0x336b6f){if(_0x336b6f){return _0x336b6f['destroy']()[_0x63b8('0x26')](function(){_0x3f28ef['status'](0xcc)[_0x63b8('0x1b')]();});}};}function handleEntityNotFound(_0x23109d,_0x162d09){return function(_0x52d3d1){if(!_0x52d3d1){_0x23109d[_0x63b8('0x1a')](0x194);}return _0x52d3d1;};}function handleError(_0x2ac639,_0x57a459){_0x57a459=_0x57a459||0x1f4;return function(_0x5ce518){logger[_0x63b8('0x27')](_0x5ce518[_0x63b8('0x28')]);if(_0x5ce518[_0x63b8('0x29')]){delete _0x5ce518[_0x63b8('0x29')];}_0x2ac639['status'](_0x57a459)['send'](_0x5ce518);};}exports[_0x63b8('0x2a')]=function(_0x1f1ce9,_0xe1aa9){var _0x13fb1f={},_0x1ebb98={},_0x1cdc30={'count':0x0,'rows':[]};var _0x53637c=_[_0x63b8('0x2b')](db[_0x63b8('0x2c')]['rawAttributes'],function(_0x12067f){return{'name':_0x12067f[_0x63b8('0x2d')],'type':_0x12067f[_0x63b8('0x2e')][_0x63b8('0x2f')]};});_0x1ebb98[_0x63b8('0x30')]=_[_0x63b8('0x2b')](_0x53637c,_0x63b8('0x29'));_0x1ebb98['query']=_['keys'](_0x1f1ce9[_0x63b8('0x31')]);_0x1ebb98['filters']=_[_0x63b8('0x32')](_0x1ebb98['model'],_0x1ebb98['query']);_0x13fb1f['attributes']=_['intersection'](_0x1ebb98[_0x63b8('0x30')],qs[_0x63b8('0x33')](_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x33')]));_0x13fb1f[_0x63b8('0x34')]=_0x13fb1f['attributes'][_0x63b8('0x35')]?_0x13fb1f[_0x63b8('0x34')]:_0x1ebb98[_0x63b8('0x30')];if(!_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x36')](_0x63b8('0x37'))){_0x13fb1f[_0x63b8('0x21')]=qs['limit'](_0x1f1ce9['query'][_0x63b8('0x21')]);_0x13fb1f[_0x63b8('0x1e')]=qs[_0x63b8('0x1e')](_0x1f1ce9['query'][_0x63b8('0x1e')]);}_0x13fb1f[_0x63b8('0x38')]=qs[_0x63b8('0x39')](_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x39')]);_0x13fb1f[_0x63b8('0x3a')]=qs[_0x63b8('0x3b')](_[_0x63b8('0x3c')](_0x1f1ce9[_0x63b8('0x31')],_0x1ebb98[_0x63b8('0x3b')]),_0x53637c);if(_0x1f1ce9['query']['filter']){_0x13fb1f[_0x63b8('0x3a')]=_[_0x63b8('0x3d')](_0x13fb1f[_0x63b8('0x3a')],{'$or':_[_0x63b8('0x2b')](_0x53637c,function(_0x1e8683){if(_0x1e8683[_0x63b8('0x2e')]!==_0x63b8('0x3e')){var _0xe8a6b8={};_0xe8a6b8[_0x1e8683[_0x63b8('0x29')]]={'$like':'%'+_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x3f')]+'%'};return _0xe8a6b8;}})});}_0x13fb1f=_[_0x63b8('0x3d')]({},_0x13fb1f,_0x1f1ce9[_0x63b8('0x40')]);var _0x4dc74e={'where':_0x13fb1f[_0x63b8('0x3a')]};return db[_0x63b8('0x2c')][_0x63b8('0x20')](_0x4dc74e)[_0x63b8('0x26')](function(_0x2e4fc2){_0x1cdc30[_0x63b8('0x20')]=_0x2e4fc2;if(_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x41')]){_0x13fb1f[_0x63b8('0x42')]=[{'all':!![]}];}return db[_0x63b8('0x2c')]['findAll'](_0x13fb1f);})[_0x63b8('0x26')](function(_0x2f9c35){_0x1cdc30[_0x63b8('0x43')]=_0x2f9c35;return _0x1cdc30;})[_0x63b8('0x26')](respondWithFilteredResult(_0xe1aa9,_0x13fb1f))[_0x63b8('0x44')](handleError(_0xe1aa9,null));};exports[_0x63b8('0x45')]=function(_0xdfa686,_0x31cb6b){var _0xf996a1={'raw':![],'where':{'id':_0xdfa686[_0x63b8('0x46')]['id']}},_0x1d1f28={};_0x1d1f28[_0x63b8('0x30')]=_[_0x63b8('0x47')](db[_0x63b8('0x2c')][_0x63b8('0x48')]);_0x1d1f28['query']=_[_0x63b8('0x47')](_0xdfa686[_0x63b8('0x31')]);_0x1d1f28['filters']=_[_0x63b8('0x32')](_0x1d1f28[_0x63b8('0x30')],_0x1d1f28[_0x63b8('0x31')]);_0xf996a1[_0x63b8('0x34')]=_[_0x63b8('0x32')](_0x1d1f28['model'],qs['fields'](_0xdfa686[_0x63b8('0x31')]['fields']));_0xf996a1['attributes']=_0xf996a1[_0x63b8('0x34')][_0x63b8('0x35')]?_0xf996a1['attributes']:_0x1d1f28[_0x63b8('0x30')];if(_0xdfa686['query'][_0x63b8('0x41')]){_0xf996a1[_0x63b8('0x42')]=[{'all':!![]}];}_0xf996a1=_[_0x63b8('0x3d')]({},_0xf996a1,_0xdfa686[_0x63b8('0x40')]);return db[_0x63b8('0x2c')]['find'](_0xf996a1)[_0x63b8('0x26')](handleEntityNotFound(_0x31cb6b,null))[_0x63b8('0x26')](respondWithResult(_0x31cb6b,null))['catch'](handleError(_0x31cb6b,null));};exports[_0x63b8('0x49')]=function(_0x30c279,_0x4935c2){return db[_0x63b8('0x2c')][_0x63b8('0x49')](_0x30c279[_0x63b8('0x4a')],{})[_0x63b8('0x26')](respondWithResult(_0x4935c2,0xc9))[_0x63b8('0x44')](handleError(_0x4935c2,null));};exports[_0x63b8('0x4b')]=function(_0x54cdc7,_0xb19a3e){return db[_0x63b8('0x2c')][_0x63b8('0x4b')](_0x54cdc7['body'],{'raw':![],'individualHooks':!![]})[_0x63b8('0x26')](respondWithResult(_0xb19a3e,0xc9))[_0x63b8('0x44')](handleError(_0xb19a3e,null));};exports[_0x63b8('0x4c')]=function(_0xbf0d3b,_0x194785){if(_0xbf0d3b['body']['id']){delete _0xbf0d3b[_0x63b8('0x4a')]['id'];}return db[_0x63b8('0x2c')][_0x63b8('0x4d')]({'where':{'id':_0xbf0d3b[_0x63b8('0x46')]['id']}})[_0x63b8('0x26')](handleEntityNotFound(_0x194785,null))[_0x63b8('0x26')](saveUpdates(_0xbf0d3b[_0x63b8('0x4a')],null))[_0x63b8('0x26')](respondWithResult(_0x194785,null))['catch'](handleError(_0x194785,null));};exports['destroy']=function(_0x483f52,_0x83d0b4){return db[_0x63b8('0x2c')][_0x63b8('0x4d')]({'where':{'id':_0x483f52[_0x63b8('0x46')]['id']}})[_0x63b8('0x26')](handleEntityNotFound(_0x83d0b4,null))[_0x63b8('0x26')](removeEntity(_0x83d0b4,null))[_0x63b8('0x44')](handleError(_0x83d0b4,null));};exports[_0x63b8('0x4e')]=function(_0x7a27d2,_0x370576){return db[_0x63b8('0x2c')][_0x63b8('0x4f')]({'where':{'id':_0x7a27d2[_0x63b8('0x31')][_0x63b8('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0x63b8('0x26')](respondWithResult(_0x370576,0xcc))['catch'](handleError(_0x370576,null));};exports[_0x63b8('0x51')]=function(_0x1f1249,_0x2647af,_0x50986d){return db[_0x63b8('0x52')][_0x63b8('0x53')]({'where':{'id':_0x1f1249[_0x63b8('0x46')]['id']}})[_0x63b8('0x26')](handleEntityNotFound(_0x2647af,null))['then'](function(_0x3307d3){if(_0x3307d3){return db[_0x63b8('0x54')][_0x63b8('0x55')](function(_0xe51323){return db['AnalyticFieldReport'][_0x63b8('0x4f')]({'where':{'CustomReportId':_0x1f1249[_0x63b8('0x46')]['id']},'transaction':_0xe51323})[_0x63b8('0x26')](function(_0x221264){var _0x207627=_[_0x63b8('0x2b')](_0x1f1249[_0x63b8('0x4a')],function(_0x51ca11){delete _0x51ca11['id'];_0x51ca11['CustomReportId']=_0x1f1249[_0x63b8('0x46')]['id'];return _0x51ca11;});return db[_0x63b8('0x2c')][_0x63b8('0x4b')](_0x207627,{'transaction':_0xe51323});});})[_0x63b8('0x26')](function(){return db[_0x63b8('0x2c')][_0x63b8('0x56')]({'where':{'CustomReportId':_0x1f1249[_0x63b8('0x46')]['id']}});});}})[_0x63b8('0x26')](respondWithResult(_0x2647af,null))['catch'](handleError(_0x2647af,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f465cbf..f0cf379 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 _0xc62c=['define','AnalyticFieldReport','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x517950,_0xca8a59){var _0x212aeb=function(_0x10f6a9){while(--_0x10f6a9){_0x517950['push'](_0x517950['shift']());}};_0x212aeb(++_0xca8a59);}(_0xc62c,0xb2));var _0xcc62=function(_0x414e8a,_0x41f2f4){_0x414e8a=_0x414e8a-0x0;var _0x2a5a7a=_0xc62c[_0x414e8a];return _0x2a5a7a;};'use strict';var _=require(_0xcc62('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcc62('0x1'));var BPromise=require(_0xcc62('0x2'));var rp=require(_0xcc62('0x3'));var fs=require('fs');var path=require(_0xcc62('0x4'));var rimraf=require(_0xcc62('0x5'));var config=require(_0xcc62('0x6'));var attributes=require(_0xcc62('0x7'));module[_0xcc62('0x8')]=function(_0x247640,_0x5a81b4){return _0x247640[_0xcc62('0x9')](_0xcc62('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc850=['./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc850,0xa0));var _0x0c85=function(_0x487933,_0x77076d){_0x487933=_0x487933-0x0;var _0x741518=_0xc850[_0x487933];return _0x741518;};'use strict';var _=require(_0x0c85('0x0'));var util=require(_0x0c85('0x1'));var logger=require(_0x0c85('0x2'))(_0x0c85('0x3'));var moment=require('moment');var BPromise=require(_0x0c85('0x4'));var rp=require(_0x0c85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c85('0x6'));var config=require(_0x0c85('0x7'));var attributes=require(_0x0c85('0x8'));module[_0x0c85('0x9')]=function(_0x3c5fef,_0x14d341){return _0x3c5fef[_0x0c85('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x0c85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index f909676..7f10618 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 _0x5416=['info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x5416,0x13d));var _0x6541=function(_0x3ade21,_0x41d4e0){_0x3ade21=_0x3ade21-0x0;var _0x114a92=_0x5416[_0x3ade21];return _0x114a92;};'use strict';var _=require(_0x6541('0x0'));var util=require(_0x6541('0x1'));var moment=require(_0x6541('0x2'));var BPromise=require(_0x6541('0x3'));var rs=require(_0x6541('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6541('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6541('0x6'))(_0x6541('0x7'));var config=require('../../config/environment');var jayson=require(_0x6541('0x8'));var client=jayson[_0x6541('0x9')][_0x6541('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38fe33,_0x176fc3,_0x327a7c){return new BPromise(function(_0x37d7cd,_0x21e1bc){return client[_0x6541('0xb')](_0x38fe33,_0x327a7c)[_0x6541('0xc')](function(_0x34270f){logger[_0x6541('0xd')](_0x6541('0xe'),_0x176fc3,'request\x20sent');logger[_0x6541('0xf')](_0x6541('0x10'),_0x176fc3,'request\x20sent',JSON['stringify'](_0x34270f));if(_0x34270f['error']){if(_0x34270f[_0x6541('0x11')][_0x6541('0x12')]===0x1f4){logger['error'](_0x6541('0xe'),_0x176fc3,_0x34270f[_0x6541('0x11')][_0x6541('0x13')]);return _0x21e1bc(_0x34270f[_0x6541('0x11')][_0x6541('0x13')]);}logger['error'](_0x6541('0xe'),_0x176fc3,_0x34270f[_0x6541('0x11')]['message']);return _0x37d7cd(_0x34270f[_0x6541('0x11')]['message']);}else{logger['info'](_0x6541('0xe'),_0x176fc3,_0x6541('0x14'));_0x37d7cd(_0x34270f[_0x6541('0x15')]['message']);}})['catch'](function(_0x20e117){logger[_0x6541('0x11')](_0x6541('0xe'),_0x176fc3,_0x20e117);_0x21e1bc(_0x20e117);});});} \ No newline at end of file +var _0xad93=['error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x27016c,_0x530529){var _0x50209c=function(_0x20f6f1){while(--_0x20f6f1){_0x27016c['push'](_0x27016c['shift']());}};_0x50209c(++_0x530529);}(_0xad93,0x98));var _0x3ad9=function(_0x32f845,_0x335cb9){_0x32f845=_0x32f845-0x0;var _0x3c0de4=_0xad93[_0x32f845];return _0x3c0de4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ad9('0x0'));var BPromise=require(_0x3ad9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ad9('0x2'));var db=require(_0x3ad9('0x3'))['db'];var utils=require(_0x3ad9('0x4'));var logger=require(_0x3ad9('0x5'))(_0x3ad9('0x6'));var config=require(_0x3ad9('0x7'));var jayson=require(_0x3ad9('0x8'));var client=jayson[_0x3ad9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48a9ae,_0x3c1a02,_0x163fdc){return new BPromise(function(_0x167416,_0x3f33ec){return client[_0x3ad9('0xa')](_0x48a9ae,_0x163fdc)[_0x3ad9('0xb')](function(_0x5b0ff3){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x3c1a02,_0x3ad9('0xc'));logger[_0x3ad9('0xd')](_0x3ad9('0xe'),_0x3c1a02,_0x3ad9('0xc'),JSON[_0x3ad9('0xf')](_0x5b0ff3));if(_0x5b0ff3[_0x3ad9('0x10')]){if(_0x5b0ff3[_0x3ad9('0x10')][_0x3ad9('0x11')]===0x1f4){logger['error'](_0x3ad9('0x12'),_0x3c1a02,_0x5b0ff3[_0x3ad9('0x10')][_0x3ad9('0x13')]);return _0x3f33ec(_0x5b0ff3[_0x3ad9('0x10')]['message']);}logger[_0x3ad9('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3c1a02,_0x5b0ff3[_0x3ad9('0x10')][_0x3ad9('0x13')]);return _0x167416(_0x5b0ff3[_0x3ad9('0x10')][_0x3ad9('0x13')]);}else{logger['info'](_0x3ad9('0x12'),_0x3c1a02,_0x3ad9('0xc'));_0x167416(_0x5b0ff3['result'][_0x3ad9('0x13')]);}})[_0x3ad9('0x14')](function(_0x5f29c5){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3c1a02,_0x5f29c5);_0x3f33ec(_0x5f29c5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 975d86d..bd42327 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(_0x28e8fe,_0x25ecdd){var _0x594f0c=function(_0x4fc2a1){while(--_0x4fc2a1){_0x28e8fe['push'](_0x28e8fe['shift']());}};_0x594f0c(++_0x25ecdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x453145,_0x5963d0){var _0x15c5cb=function(_0x1aeb4b){while(--_0x1aeb4b){_0x453145['push'](_0x453145['shift']());}};_0x15c5cb(++_0x5963d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 7d10a6a..b1f76d0 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 _0x7462=['sequelize','exports','STRING'];(function(_0x14e08d,_0x32d8fa){var _0x57b194=function(_0x4dcc8d){while(--_0x4dcc8d){_0x14e08d['push'](_0x14e08d['shift']());}};_0x57b194(++_0x32d8fa);}(_0x7462,0x165));var _0x2746=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0x7462[_0x1ca9eb];return _0x2e284e;};'use strict';var Sequelize=require(_0x2746('0x0'));module[_0x2746('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x2746('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x18a9=['name','TEXT','STRING'];(function(_0x1278f6,_0x54e8aa){var _0x2e6d5a=function(_0x123ff9){while(--_0x123ff9){_0x1278f6['push'](_0x1278f6['shift']());}};_0x2e6d5a(++_0x54e8aa);}(_0x18a9,0x15b));var _0x918a=function(_0x5b80fb,_0x232d60){_0x5b80fb=_0x5b80fb-0x0;var _0x2d29a5=_0x18a9[_0x5b80fb];return _0x2d29a5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x918a('0x0')],'allowNull':![],'unique':_0x918a('0x1')},'table':{'type':Sequelize[_0x918a('0x0')]},'metric':{'type':Sequelize[_0x918a('0x2')]},'description':{'type':Sequelize[_0x918a('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 777fb29..599b463 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x47e453,_0x4b4fe2){var _0xa8d8cb=function(_0x53cf45){while(--_0x53cf45){_0x47e453['push'](_0x47e453['shift']());}};_0xa8d8cb(++_0x4b4fe2);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xf37b8d,_0x42ce54){_0xf37b8d=_0xf37b8d-0x0;var _0x3b0b62=_0x7fbe[_0xf37b8d];return _0x3b0b62;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file +var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x41e520,_0x49fcc){var _0x2d8c5b=function(_0x48d8f5){while(--_0x48d8f5){_0x41e520['push'](_0x41e520['shift']());}};_0x2d8c5b(++_0x49fcc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0x5fc3[_0x5b1c50];return _0x2d379b;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 3a32808..222030b 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 _0xaf0d=['analytics_metrics','util','../../config/logger','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x18debc,_0x4ff733){var _0x3b543a=function(_0x2dc423){while(--_0x2dc423){_0x18debc['push'](_0x18debc['shift']());}};_0x3b543a(++_0x4ff733);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x1537ba,_0x14f5f4){_0x1537ba=_0x1537ba-0x0;var _0x176900=_0xaf0d[_0x1537ba];return _0x176900;};'use strict';var _=require('lodash');var util=require(_0xdaf0('0x0'));var logger=require(_0xdaf0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaf0('0x2'));var config=require(_0xdaf0('0x3'));var attributes=require(_0xdaf0('0x4'));module['exports']=function(_0x35fe4f,_0x14b19d){return _0x35fe4f['define']('AnalyticMetric',attributes,{'tableName':_0xdaf0('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9829=['./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x9829,0xc4));var _0x9982=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x9829[_0x1ae4a9];return _0x54d0b0;};'use strict';var _=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var logger=require(_0x9982('0x2'))(_0x9982('0x3'));var moment=require(_0x9982('0x4'));var BPromise=require('bluebird');var rp=require(_0x9982('0x5'));var fs=require('fs');var path=require(_0x9982('0x6'));var rimraf=require(_0x9982('0x7'));var config=require('../../config/environment');var attributes=require(_0x9982('0x8'));module[_0x9982('0x9')]=function(_0x58f8fe,_0x500dfd){return _0x58f8fe[_0x9982('0xa')](_0x9982('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 822c668..73588b3 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 _0x7118=['error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x823a0f,_0xd424a8){var _0x8c5736=function(_0x4419dc){while(--_0x4419dc){_0x823a0f['push'](_0x823a0f['shift']());}};_0x8c5736(++_0xd424a8);}(_0x7118,0x11c));var _0x8711=function(_0x5bc302,_0xa27162){_0x5bc302=_0x5bc302-0x0;var _0x90a040=_0x7118[_0x5bc302];return _0x90a040;};'use strict';var _=require('lodash');var util=require(_0x8711('0x0'));var moment=require(_0x8711('0x1'));var BPromise=require(_0x8711('0x2'));var rs=require(_0x8711('0x3'));var fs=require('fs');var Redis=require(_0x8711('0x4'));var db=require(_0x8711('0x5'))['db'];var utils=require(_0x8711('0x6'));var logger=require('../../config/logger')(_0x8711('0x7'));var config=require(_0x8711('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfc0546,_0x15292e,_0x4cdffa){return new BPromise(function(_0x264f4b,_0x38bbff){return client[_0x8711('0x9')](_0xfc0546,_0x4cdffa)[_0x8711('0xa')](function(_0x4ff4fa){logger[_0x8711('0xb')](_0x8711('0xc'),_0x15292e,_0x8711('0xd'));logger['debug'](_0x8711('0xe'),_0x15292e,_0x8711('0xd'),JSON[_0x8711('0xf')](_0x4ff4fa));if(_0x4ff4fa[_0x8711('0x10')]){if(_0x4ff4fa[_0x8711('0x10')][_0x8711('0x11')]===0x1f4){logger[_0x8711('0x10')](_0x8711('0xc'),_0x15292e,_0x4ff4fa[_0x8711('0x10')]['message']);return _0x38bbff(_0x4ff4fa[_0x8711('0x10')]['message']);}logger[_0x8711('0x10')](_0x8711('0xc'),_0x15292e,_0x4ff4fa[_0x8711('0x10')][_0x8711('0x12')]);return _0x264f4b(_0x4ff4fa['error'][_0x8711('0x12')]);}else{logger['info'](_0x8711('0xc'),_0x15292e,_0x8711('0xd'));_0x264f4b(_0x4ff4fa['result'][_0x8711('0x12')]);}})[_0x8711('0x13')](function(_0x4fc93a){logger[_0x8711('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x15292e,_0x4fc93a);_0x38bbff(_0x4fc93a);});});} \ No newline at end of file +var _0xb518=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb518,0x146));var _0x8b51=function(_0xfb89d1,_0x17f94e){_0xfb89d1=_0xfb89d1-0x0;var _0x58bf9b=_0xb518[_0xfb89d1];return _0x58bf9b;};'use strict';var _=require(_0x8b51('0x0'));var util=require('util');var moment=require(_0x8b51('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b51('0x2'));var fs=require('fs');var Redis=require(_0x8b51('0x3'));var db=require(_0x8b51('0x4'))['db'];var utils=require(_0x8b51('0x5'));var logger=require('../../config/logger')(_0x8b51('0x6'));var config=require(_0x8b51('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b51('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x409078,_0x3e8544,_0x55f79a){return new BPromise(function(_0x5ef411,_0x5e6004){return client[_0x8b51('0x9')](_0x409078,_0x55f79a)[_0x8b51('0xa')](function(_0x172507){logger[_0x8b51('0xb')](_0x8b51('0xc'),_0x3e8544,_0x8b51('0xd'));logger['debug'](_0x8b51('0xe'),_0x3e8544,_0x8b51('0xd'),JSON[_0x8b51('0xf')](_0x172507));if(_0x172507[_0x8b51('0x10')]){if(_0x172507[_0x8b51('0x10')][_0x8b51('0x11')]===0x1f4){logger[_0x8b51('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3e8544,_0x172507[_0x8b51('0x10')]['message']);return _0x5e6004(_0x172507[_0x8b51('0x10')]['message']);}logger['error'](_0x8b51('0xc'),_0x3e8544,_0x172507['error'][_0x8b51('0x12')]);return _0x5ef411(_0x172507[_0x8b51('0x10')][_0x8b51('0x12')]);}else{logger[_0x8b51('0xb')](_0x8b51('0xc'),_0x3e8544,'request\x20sent');_0x5ef411(_0x172507[_0x8b51('0x13')][_0x8b51('0x12')]);}})[_0x8b51('0x14')](function(_0xecb929){logger[_0x8b51('0x10')](_0x8b51('0xc'),_0x3e8544,_0xecb929);_0x5e6004(_0xecb929);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3f5bd85..8011930 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 _0xef39=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x53f1de,_0x37d8d3){var _0x2fa505=function(_0x220b34){while(--_0x220b34){_0x53f1de['push'](_0x53f1de['shift']());}};_0x2fa505(++_0x37d8d3);}(_0xef39,0x92));var _0x9ef3=function(_0x579bad,_0x4501a6){_0x579bad=_0x579bad-0x0;var _0x1a3ee5=_0xef39[_0x579bad];return _0x1a3ee5;};'use strict';var multer=require('multer');var util=require(_0x9ef3('0x0'));var path=require(_0x9ef3('0x1'));var timeout=require(_0x9ef3('0x2'));var express=require(_0x9ef3('0x3'));var router=express[_0x9ef3('0x4')]();var fs_extra=require(_0x9ef3('0x5'));var auth=require(_0x9ef3('0x6'));var interaction=require(_0x9ef3('0x7'));var config=require(_0x9ef3('0x8'));var controller=require(_0x9ef3('0x9'));router[_0x9ef3('0xa')]('/',auth[_0x9ef3('0xb')](),controller['index']);router[_0x9ef3('0xa')](_0x9ef3('0xc'),auth[_0x9ef3('0xb')](),controller[_0x9ef3('0xd')]);router[_0x9ef3('0xe')]('/',auth[_0x9ef3('0xb')](),controller[_0x9ef3('0xf')]);router[_0x9ef3('0x10')](_0x9ef3('0xc'),auth[_0x9ef3('0xb')](),controller[_0x9ef3('0x11')]);router[_0x9ef3('0x12')](_0x9ef3('0xc'),auth['isAuthenticated'](),controller[_0x9ef3('0x13')]);module[_0x9ef3('0x14')]=router; \ No newline at end of file +var _0xac4f=['destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','put','update','delete'];(function(_0x1c1969,_0x19eb95){var _0x1db48e=function(_0x41271e){while(--_0x41271e){_0x1c1969['push'](_0x1c1969['shift']());}};_0x1db48e(++_0x19eb95);}(_0xac4f,0x122));var _0xfac4=function(_0x1ac53b,_0x31c1f1){_0x1ac53b=_0x1ac53b-0x0;var _0x6dcc75=_0xac4f[_0x1ac53b];return _0x6dcc75;};'use strict';var multer=require(_0xfac4('0x0'));var util=require('util');var path=require(_0xfac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xfac4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfac4('0x3'));var interaction=require(_0xfac4('0x4'));var config=require('../../config/environment');var controller=require(_0xfac4('0x5'));router[_0xfac4('0x6')]('/',auth[_0xfac4('0x7')](),controller['index']);router[_0xfac4('0x6')](_0xfac4('0x8'),auth[_0xfac4('0x7')](),controller[_0xfac4('0x9')]);router[_0xfac4('0xa')]('/',auth[_0xfac4('0x7')](),controller['create']);router[_0xfac4('0xb')](_0xfac4('0x8'),auth[_0xfac4('0x7')](),controller[_0xfac4('0xc')]);router[_0xfac4('0xd')](_0xfac4('0x8'),auth[_0xfac4('0x7')](),controller[_0xfac4('0xe')]);module[_0xfac4('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f740c09..06bd2bb 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 _0xd58d=['exports','TEXT','sequelize'];(function(_0x1a5551,_0x2e8f97){var _0x7e4fa6=function(_0x331f8c){while(--_0x331f8c){_0x1a5551['push'](_0x1a5551['shift']());}};_0x7e4fa6(++_0x2e8f97);}(_0xd58d,0x176));var _0xdd58=function(_0x5c4b9f,_0xe37aa5){_0x5c4b9f=_0x5c4b9f-0x0;var _0x8534f4=_0xd58d[_0x5c4b9f];return _0x8534f4;};'use strict';var Sequelize=require(_0xdd58('0x0'));module[_0xdd58('0x1')]={'tree':{'type':Sequelize[_0xdd58('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa70c=['exports'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0xa70c,0x189));var _0xca70=function(_0x5b9dd7,_0x43a06e){_0x5b9dd7=_0x5b9dd7-0x0;var _0x49ec19=_0xa70c[_0x5b9dd7];return _0x49ec19;};'use strict';var Sequelize=require('sequelize');module[_0xca70('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b73c108..1d1c94b 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 _0x925a=['map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','length','includeAll','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','name','send','index'];(function(_0x164fa2,_0x1f1dbb){var _0x2e9988=function(_0x46e029){while(--_0x46e029){_0x164fa2['push'](_0x164fa2['shift']());}};_0x2e9988(++_0x1f1dbb);}(_0x925a,0x107));var _0xa925=function(_0x11dd75,_0x340f1c){_0x11dd75=_0x11dd75-0x0;var _0x21bd9b=_0x925a[_0x11dd75];return _0x21bd9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa925('0x0'));var zipdir=require(_0xa925('0x1'));var jsonpatch=require(_0xa925('0x2'));var rp=require(_0xa925('0x3'));var moment=require(_0xa925('0x4'));var BPromise=require(_0xa925('0x5'));var Mustache=require(_0xa925('0x6'));var util=require('util');var path=require(_0xa925('0x7'));var sox=require(_0xa925('0x8'));var csv=require(_0xa925('0x9'));var ejs=require(_0xa925('0xa'));var fs=require('fs');var fs_extra=require(_0xa925('0xb'));var _=require(_0xa925('0xc'));var squel=require(_0xa925('0xd'));var crypto=require(_0xa925('0xe'));var jsforce=require(_0xa925('0xf'));var deskjs=require(_0xa925('0x10'));var toCsv=require(_0xa925('0x9'));var querystring=require(_0xa925('0x11'));var Papa=require(_0xa925('0x12'));var Redis=require('ioredis');var authService=require(_0xa925('0x13'));var qs=require(_0xa925('0x14'));var as=require(_0xa925('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa925('0x16'))(_0xa925('0x17'));var utils=require(_0xa925('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa925('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32f955,_0x399452){_0x399452=_0x399452||0xcc;return function(_0x1c6690){if(_0x1c6690){return _0x32f955[_0xa925('0x1a')](_0x399452);}return _0x32f955[_0xa925('0x1b')](_0x399452)[_0xa925('0x1c')]();};}function respondWithResult(_0x8746f0,_0x3eaebc){_0x3eaebc=_0x3eaebc||0xc8;return function(_0x4583ad){if(_0x4583ad){return _0x8746f0[_0xa925('0x1b')](_0x3eaebc)['json'](_0x4583ad);}};}function respondWithFilteredResult(_0x456e6f,_0x314a2b){return function(_0x1012f9){if(_0x1012f9){var _0x48c029=typeof _0x314a2b[_0xa925('0x1d')]===_0xa925('0x1e')&&typeof _0x314a2b['limit']==='undefined';var _0xabfeb4=_0x1012f9[_0xa925('0x1f')];var _0x1a7366=_0x48c029?0x0:_0x314a2b[_0xa925('0x1d')];var _0x4adbc4=_0x48c029?_0x1012f9[_0xa925('0x1f')]:_0x314a2b[_0xa925('0x1d')]+_0x314a2b[_0xa925('0x20')];var _0x41bc13;if(_0x4adbc4>=_0xabfeb4){_0x4adbc4=_0xabfeb4;_0x41bc13=0xc8;}else{_0x41bc13=0xce;}_0x456e6f[_0xa925('0x1b')](_0x41bc13);return _0x456e6f[_0xa925('0x21')]('Content-Range',_0x1a7366+'-'+_0x4adbc4+'/'+_0xabfeb4)[_0xa925('0x22')](_0x1012f9);}return null;};}function patchUpdates(_0x169291){return function(_0x43e64e){try{jsonpatch[_0xa925('0x23')](_0x43e64e,_0x169291,!![]);}catch(_0x3b33a3){return BPromise[_0xa925('0x24')](_0x3b33a3);}return _0x43e64e[_0xa925('0x25')]();};}function saveUpdates(_0x399eed,_0x1da02a){return function(_0x21d8b5){if(_0x21d8b5){return _0x21d8b5[_0xa925('0x26')](_0x399eed)[_0xa925('0x27')](function(_0x229cd3){return _0x229cd3;});}return null;};}function removeEntity(_0x248413,_0x26dc33){return function(_0x2daf17){if(_0x2daf17){return _0x2daf17[_0xa925('0x28')]()['then'](function(){_0x248413['status'](0xcc)[_0xa925('0x1c')]();});}};}function handleEntityNotFound(_0x5406c7,_0x133223){return function(_0x1bd808){if(!_0x1bd808){_0x5406c7[_0xa925('0x1a')](0x194);}return _0x1bd808;};}function handleError(_0x33a653,_0x5d6d61){_0x5d6d61=_0x5d6d61||0x1f4;return function(_0x5b3ee3){logger[_0xa925('0x29')](_0x5b3ee3['stack']);if(_0x5b3ee3[_0xa925('0x2a')]){delete _0x5b3ee3['name'];}_0x33a653[_0xa925('0x1b')](_0x5d6d61)[_0xa925('0x2b')](_0x5b3ee3);};}exports[_0xa925('0x2c')]=function(_0x34bfa0,_0x3524c1){var _0x59fe63={},_0x149314={},_0x2edff8={'count':0x0,'rows':[]};var _0x2dfd01=_[_0xa925('0x2d')](db[_0xa925('0x2e')][_0xa925('0x2f')],function(_0x514dea){return{'name':_0x514dea[_0xa925('0x30')],'type':_0x514dea[_0xa925('0x31')]['key']};});_0x149314[_0xa925('0x32')]=_['map'](_0x2dfd01,_0xa925('0x2a'));_0x149314[_0xa925('0x33')]=_[_0xa925('0x34')](_0x34bfa0['query']);_0x149314[_0xa925('0x35')]=_[_0xa925('0x36')](_0x149314['model'],_0x149314[_0xa925('0x33')]);_0x59fe63[_0xa925('0x37')]=_[_0xa925('0x36')](_0x149314[_0xa925('0x32')],qs[_0xa925('0x38')](_0x34bfa0['query'][_0xa925('0x38')]));_0x59fe63[_0xa925('0x37')]=_0x59fe63[_0xa925('0x37')]['length']?_0x59fe63[_0xa925('0x37')]:_0x149314[_0xa925('0x32')];if(!_0x34bfa0['query'][_0xa925('0x39')](_0xa925('0x3a'))){_0x59fe63['limit']=qs[_0xa925('0x20')](_0x34bfa0[_0xa925('0x33')][_0xa925('0x20')]);_0x59fe63[_0xa925('0x1d')]=qs[_0xa925('0x1d')](_0x34bfa0[_0xa925('0x33')][_0xa925('0x1d')]);}_0x59fe63[_0xa925('0x3b')]=qs['sort'](_0x34bfa0[_0xa925('0x33')][_0xa925('0x3c')]);_0x59fe63[_0xa925('0x3d')]=qs[_0xa925('0x35')](_[_0xa925('0x3e')](_0x34bfa0[_0xa925('0x33')],_0x149314[_0xa925('0x35')]),_0x2dfd01);if(_0x34bfa0[_0xa925('0x33')][_0xa925('0x3f')]){_0x59fe63[_0xa925('0x3d')]=_[_0xa925('0x40')](_0x59fe63['where'],{'$or':_[_0xa925('0x2d')](_0x2dfd01,function(_0x339d78){if(_0x339d78[_0xa925('0x31')]!==_0xa925('0x41')){var _0x579419={};_0x579419[_0x339d78['name']]={'$like':'%'+_0x34bfa0[_0xa925('0x33')][_0xa925('0x3f')]+'%'};return _0x579419;}})});}_0x59fe63=_[_0xa925('0x40')]({},_0x59fe63,_0x34bfa0[_0xa925('0x42')]);var _0x11319f={'where':_0x59fe63['where']};return db[_0xa925('0x2e')][_0xa925('0x1f')](_0x11319f)[_0xa925('0x27')](function(_0x1f6347){_0x2edff8[_0xa925('0x1f')]=_0x1f6347;if(_0x34bfa0[_0xa925('0x33')]['includeAll']){_0x59fe63[_0xa925('0x43')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x59fe63);})[_0xa925('0x27')](function(_0x191543){_0x2edff8[_0xa925('0x44')]=_0x191543;return _0x2edff8;})[_0xa925('0x27')](respondWithFilteredResult(_0x3524c1,_0x59fe63))['catch'](handleError(_0x3524c1,null));};exports[_0xa925('0x45')]=function(_0x90d0b2,_0x113bf3){var _0x10470c={'raw':!![],'where':{'id':_0x90d0b2['params']['id']}},_0x4667e7={};_0x4667e7[_0xa925('0x32')]=_[_0xa925('0x34')](db[_0xa925('0x2e')][_0xa925('0x2f')]);_0x4667e7[_0xa925('0x33')]=_[_0xa925('0x34')](_0x90d0b2[_0xa925('0x33')]);_0x4667e7[_0xa925('0x35')]=_[_0xa925('0x36')](_0x4667e7[_0xa925('0x32')],_0x4667e7[_0xa925('0x33')]);_0x10470c[_0xa925('0x37')]=_['intersection'](_0x4667e7[_0xa925('0x32')],qs[_0xa925('0x38')](_0x90d0b2[_0xa925('0x33')][_0xa925('0x38')]));_0x10470c[_0xa925('0x37')]=_0x10470c[_0xa925('0x37')][_0xa925('0x46')]?_0x10470c[_0xa925('0x37')]:_0x4667e7[_0xa925('0x32')];if(_0x90d0b2[_0xa925('0x33')][_0xa925('0x47')]){_0x10470c[_0xa925('0x43')]=[{'all':!![]}];}_0x10470c=_[_0xa925('0x40')]({},_0x10470c,_0x90d0b2[_0xa925('0x42')]);return db['AnalyticTreeReport'][_0xa925('0x48')](_0x10470c)['then'](handleEntityNotFound(_0x113bf3,null))[_0xa925('0x27')](respondWithResult(_0x113bf3,null))[_0xa925('0x49')](handleError(_0x113bf3,null));};exports[_0xa925('0x4a')]=function(_0x4db90c,_0x11b1b8){return db[_0xa925('0x2e')]['create'](_0x4db90c[_0xa925('0x4b')],{})['then'](respondWithResult(_0x11b1b8,0xc9))[_0xa925('0x49')](handleError(_0x11b1b8,null));};exports[_0xa925('0x26')]=function(_0x42ff3e,_0x53c41b){if(_0x42ff3e[_0xa925('0x4b')]['id']){delete _0x42ff3e[_0xa925('0x4b')]['id'];}return db[_0xa925('0x2e')][_0xa925('0x48')]({'where':{'id':_0x42ff3e[_0xa925('0x4c')]['id']}})[_0xa925('0x27')](handleEntityNotFound(_0x53c41b,null))['then'](saveUpdates(_0x42ff3e[_0xa925('0x4b')],null))[_0xa925('0x27')](respondWithResult(_0x53c41b,null))[_0xa925('0x49')](handleError(_0x53c41b,null));};exports['destroy']=function(_0x1ccc1a,_0x379776){return db['AnalyticTreeReport']['find']({'where':{'id':_0x1ccc1a[_0xa925('0x4c')]['id']}})[_0xa925('0x27')](handleEntityNotFound(_0x379776,null))[_0xa925('0x27')](removeEntity(_0x379776,null))[_0xa925('0x49')](handleError(_0x379776,null));}; \ No newline at end of file +var _0xbfeb=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','keys','find','catch','create','body','params','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName'];(function(_0x3b01a9,_0x2cb3fa){var _0x4aa436=function(_0xdbd8d){while(--_0xdbd8d){_0x3b01a9['push'](_0x3b01a9['shift']());}};_0x4aa436(++_0x2cb3fa);}(_0xbfeb,0x183));var _0xbbfe=function(_0x54d448,_0x584e5e){_0x54d448=_0x54d448-0x0;var _0x2177a8=_0xbfeb[_0x54d448];return _0x2177a8;};'use strict';var emlformat=require(_0xbbfe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbbfe('0x1'));var rp=require('request-promise');var moment=require(_0xbbfe('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbbfe('0x3'));var util=require(_0xbbfe('0x4'));var path=require(_0xbbfe('0x5'));var sox=require(_0xbbfe('0x6'));var csv=require(_0xbbfe('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbfe('0x8'));var _=require(_0xbbfe('0x9'));var squel=require(_0xbbfe('0xa'));var crypto=require(_0xbbfe('0xb'));var jsforce=require(_0xbbfe('0xc'));var deskjs=require(_0xbbfe('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbbfe('0xe'));var Papa=require(_0xbbfe('0xf'));var Redis=require(_0xbbfe('0x10'));var authService=require(_0xbbfe('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbbfe('0x12'));var hardwareService=require(_0xbbfe('0x13'));var logger=require(_0xbbfe('0x14'))(_0xbbfe('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbbfe('0x16'));var db=require(_0xbbfe('0x17'))['db'];function respondWithStatusCode(_0x4ed695,_0x4e22e1){_0x4e22e1=_0x4e22e1||0xcc;return function(_0x5a7108){if(_0x5a7108){return _0x4ed695['sendStatus'](_0x4e22e1);}return _0x4ed695[_0xbbfe('0x18')](_0x4e22e1)[_0xbbfe('0x19')]();};}function respondWithResult(_0x598c68,_0x2e0e1b){_0x2e0e1b=_0x2e0e1b||0xc8;return function(_0x474907){if(_0x474907){return _0x598c68[_0xbbfe('0x18')](_0x2e0e1b)[_0xbbfe('0x1a')](_0x474907);}};}function respondWithFilteredResult(_0x555b52,_0x5f38a1){return function(_0x52080b){if(_0x52080b){var _0x37dadd=typeof _0x5f38a1[_0xbbfe('0x1b')]===_0xbbfe('0x1c')&&typeof _0x5f38a1[_0xbbfe('0x1d')]===_0xbbfe('0x1c');var _0x5d366a=_0x52080b[_0xbbfe('0x1e')];var _0x3c52c0=_0x37dadd?0x0:_0x5f38a1['offset'];var _0x4eb175=_0x37dadd?_0x52080b['count']:_0x5f38a1['offset']+_0x5f38a1[_0xbbfe('0x1d')];var _0x29aadc;if(_0x4eb175>=_0x5d366a){_0x4eb175=_0x5d366a;_0x29aadc=0xc8;}else{_0x29aadc=0xce;}_0x555b52[_0xbbfe('0x18')](_0x29aadc);return _0x555b52[_0xbbfe('0x1f')](_0xbbfe('0x20'),_0x3c52c0+'-'+_0x4eb175+'/'+_0x5d366a)[_0xbbfe('0x1a')](_0x52080b);}return null;};}function patchUpdates(_0x3d33f3){return function(_0x7919f2){try{jsonpatch[_0xbbfe('0x21')](_0x7919f2,_0x3d33f3,!![]);}catch(_0x3bdd31){return BPromise[_0xbbfe('0x22')](_0x3bdd31);}return _0x7919f2['save']();};}function saveUpdates(_0x5955a2,_0x2db963){return function(_0x3bff3d){if(_0x3bff3d){return _0x3bff3d[_0xbbfe('0x23')](_0x5955a2)[_0xbbfe('0x24')](function(_0xeba75a){return _0xeba75a;});}return null;};}function removeEntity(_0x3ac25c,_0x3580ff){return function(_0x556789){if(_0x556789){return _0x556789['destroy']()[_0xbbfe('0x24')](function(){_0x3ac25c['status'](0xcc)[_0xbbfe('0x19')]();});}};}function handleEntityNotFound(_0x48da81,_0x54d37d){return function(_0x316eb9){if(!_0x316eb9){_0x48da81['sendStatus'](0x194);}return _0x316eb9;};}function handleError(_0x37005f,_0x45a8bf){_0x45a8bf=_0x45a8bf||0x1f4;return function(_0x100a21){logger[_0xbbfe('0x25')](_0x100a21[_0xbbfe('0x26')]);if(_0x100a21[_0xbbfe('0x27')]){delete _0x100a21[_0xbbfe('0x27')];}_0x37005f['status'](_0x45a8bf)[_0xbbfe('0x28')](_0x100a21);};}exports[_0xbbfe('0x29')]=function(_0x2d9846,_0x1fc541){var _0x5aaaa3={},_0x338c20={},_0x3cf65d={'count':0x0,'rows':[]};var _0x464e28=_['map'](db[_0xbbfe('0x2a')][_0xbbfe('0x2b')],function(_0x305558){return{'name':_0x305558[_0xbbfe('0x2c')],'type':_0x305558['type'][_0xbbfe('0x2d')]};});_0x338c20[_0xbbfe('0x2e')]=_[_0xbbfe('0x2f')](_0x464e28,'name');_0x338c20[_0xbbfe('0x30')]=_['keys'](_0x2d9846[_0xbbfe('0x30')]);_0x338c20[_0xbbfe('0x31')]=_[_0xbbfe('0x32')](_0x338c20[_0xbbfe('0x2e')],_0x338c20[_0xbbfe('0x30')]);_0x5aaaa3[_0xbbfe('0x33')]=_['intersection'](_0x338c20[_0xbbfe('0x2e')],qs[_0xbbfe('0x34')](_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x34')]));_0x5aaaa3[_0xbbfe('0x33')]=_0x5aaaa3['attributes'][_0xbbfe('0x35')]?_0x5aaaa3['attributes']:_0x338c20[_0xbbfe('0x2e')];if(!_0x2d9846['query'][_0xbbfe('0x36')](_0xbbfe('0x37'))){_0x5aaaa3[_0xbbfe('0x1d')]=qs['limit'](_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x1d')]);_0x5aaaa3[_0xbbfe('0x1b')]=qs[_0xbbfe('0x1b')](_0x2d9846['query'][_0xbbfe('0x1b')]);}_0x5aaaa3['order']=qs[_0xbbfe('0x38')](_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x38')]);_0x5aaaa3[_0xbbfe('0x39')]=qs[_0xbbfe('0x31')](_[_0xbbfe('0x3a')](_0x2d9846[_0xbbfe('0x30')],_0x338c20[_0xbbfe('0x31')]),_0x464e28);if(_0x2d9846[_0xbbfe('0x30')]['filter']){_0x5aaaa3['where']=_[_0xbbfe('0x3b')](_0x5aaaa3[_0xbbfe('0x39')],{'$or':_['map'](_0x464e28,function(_0x2487cf){if(_0x2487cf[_0xbbfe('0x3c')]!==_0xbbfe('0x3d')){var _0x12cb91={};_0x12cb91[_0x2487cf[_0xbbfe('0x27')]]={'$like':'%'+_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x3e')]+'%'};return _0x12cb91;}})});}_0x5aaaa3=_[_0xbbfe('0x3b')]({},_0x5aaaa3,_0x2d9846[_0xbbfe('0x3f')]);var _0x1e34d5={'where':_0x5aaaa3[_0xbbfe('0x39')]};return db['AnalyticTreeReport'][_0xbbfe('0x1e')](_0x1e34d5)[_0xbbfe('0x24')](function(_0x28d67e){_0x3cf65d[_0xbbfe('0x1e')]=_0x28d67e;if(_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x40')]){_0x5aaaa3[_0xbbfe('0x41')]=[{'all':!![]}];}return db[_0xbbfe('0x2a')]['findAll'](_0x5aaaa3);})[_0xbbfe('0x24')](function(_0x32887c){_0x3cf65d['rows']=_0x32887c;return _0x3cf65d;})['then'](respondWithFilteredResult(_0x1fc541,_0x5aaaa3))['catch'](handleError(_0x1fc541,null));};exports['show']=function(_0x2ccd72,_0x15c1b4){var _0x40f317={'raw':!![],'where':{'id':_0x2ccd72['params']['id']}},_0x3b06a8={};_0x3b06a8[_0xbbfe('0x2e')]=_[_0xbbfe('0x42')](db['AnalyticTreeReport'][_0xbbfe('0x2b')]);_0x3b06a8[_0xbbfe('0x30')]=_[_0xbbfe('0x42')](_0x2ccd72[_0xbbfe('0x30')]);_0x3b06a8[_0xbbfe('0x31')]=_[_0xbbfe('0x32')](_0x3b06a8['model'],_0x3b06a8[_0xbbfe('0x30')]);_0x40f317['attributes']=_['intersection'](_0x3b06a8[_0xbbfe('0x2e')],qs['fields'](_0x2ccd72[_0xbbfe('0x30')][_0xbbfe('0x34')]));_0x40f317[_0xbbfe('0x33')]=_0x40f317[_0xbbfe('0x33')]['length']?_0x40f317['attributes']:_0x3b06a8['model'];if(_0x2ccd72[_0xbbfe('0x30')]['includeAll']){_0x40f317[_0xbbfe('0x41')]=[{'all':!![]}];}_0x40f317=_[_0xbbfe('0x3b')]({},_0x40f317,_0x2ccd72[_0xbbfe('0x3f')]);return db[_0xbbfe('0x2a')][_0xbbfe('0x43')](_0x40f317)['then'](handleEntityNotFound(_0x15c1b4,null))[_0xbbfe('0x24')](respondWithResult(_0x15c1b4,null))[_0xbbfe('0x44')](handleError(_0x15c1b4,null));};exports['create']=function(_0x332a38,_0x51aec5){return db[_0xbbfe('0x2a')][_0xbbfe('0x45')](_0x332a38[_0xbbfe('0x46')],{})[_0xbbfe('0x24')](respondWithResult(_0x51aec5,0xc9))[_0xbbfe('0x44')](handleError(_0x51aec5,null));};exports[_0xbbfe('0x23')]=function(_0x34f4a6,_0x3546a6){if(_0x34f4a6[_0xbbfe('0x46')]['id']){delete _0x34f4a6['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x34f4a6[_0xbbfe('0x47')]['id']}})[_0xbbfe('0x24')](handleEntityNotFound(_0x3546a6,null))['then'](saveUpdates(_0x34f4a6[_0xbbfe('0x46')],null))[_0xbbfe('0x24')](respondWithResult(_0x3546a6,null))[_0xbbfe('0x44')](handleError(_0x3546a6,null));};exports['destroy']=function(_0x4aaca0,_0x2bdafd){return db['AnalyticTreeReport'][_0xbbfe('0x43')]({'where':{'id':_0x4aaca0[_0xbbfe('0x47')]['id']}})[_0xbbfe('0x24')](handleEntityNotFound(_0x2bdafd,null))[_0xbbfe('0x24')](removeEntity(_0x2bdafd,null))[_0xbbfe('0x44')](handleError(_0x2bdafd,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a28b9bd..0f49e90 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 _0x1d5c=['path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','api','moment','bluebird','request-promise'];(function(_0x46198f,_0x54fd8b){var _0x120254=function(_0x1a0467){while(--_0x1a0467){_0x46198f['push'](_0x46198f['shift']());}};_0x120254(++_0x54fd8b);}(_0x1d5c,0x1ea));var _0xc1d5=function(_0x5c84a6,_0x321f95){_0x5c84a6=_0x5c84a6-0x0;var _0xb8c5f0=_0x1d5c[_0x5c84a6];return _0xb8c5f0;};'use strict';var _=require(_0xc1d5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc1d5('0x1'));var moment=require(_0xc1d5('0x2'));var BPromise=require(_0xc1d5('0x3'));var rp=require(_0xc1d5('0x4'));var fs=require('fs');var path=require(_0xc1d5('0x5'));var rimraf=require(_0xc1d5('0x6'));var config=require(_0xc1d5('0x7'));var attributes=require(_0xc1d5('0x8'));module[_0xc1d5('0x9')]=function(_0x2ea00a,_0x5b0874){return _0x2ea00a['define']('AnalyticTreeReport',attributes,{'tableName':_0xc1d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7df0=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x401a3b,_0x2e37de){var _0x3b9ef4=function(_0xe2badb){while(--_0xe2badb){_0x401a3b['push'](_0x401a3b['shift']());}};_0x3b9ef4(++_0x2e37de);}(_0x7df0,0x14c));var _0x07df=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7df0[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x07df('0x0'));var logger=require(_0x07df('0x1'))(_0x07df('0x2'));var moment=require('moment');var BPromise=require(_0x07df('0x3'));var rp=require(_0x07df('0x4'));var fs=require('fs');var path=require(_0x07df('0x5'));var rimraf=require(_0x07df('0x6'));var config=require(_0x07df('0x7'));var attributes=require(_0x07df('0x8'));module[_0x07df('0x9')]=function(_0x540c1f,_0xc3e433){return _0x540c1f[_0x07df('0xa')](_0x07df('0xb'),attributes,{'tableName':_0x07df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 8b76d19..0ec2692 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x26e3c9,_0x2068b6){_0x26e3c9=_0x26e3c9-0x0;var _0x3e7cca=_0x7a54[_0x26e3c9];return _0x3e7cca;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5d93fb,_0x348924){var _0x344596=function(_0x106142){while(--_0x106142){_0x5d93fb['push'](_0x5d93fb['shift']());}};_0x344596(++_0x348924);}(_0x1261,0x144));var _0x1126=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0x1261[_0x2bc2a2];return _0x20de67;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 4556e98..b2b6ee1 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 _0xcfb1=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','put','delete','destroy','exports'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0xcfb1,0x168));var _0x1cfb=function(_0x3d5fc9,_0x48bb9f){_0x3d5fc9=_0x3d5fc9-0x0;var _0x4c5fef=_0xcfb1[_0x3d5fc9];return _0x4c5fef;};'use strict';var multer=require('multer');var util=require(_0x1cfb('0x0'));var path=require(_0x1cfb('0x1'));var timeout=require(_0x1cfb('0x2'));var express=require(_0x1cfb('0x3'));var router=express[_0x1cfb('0x4')]();var fs_extra=require(_0x1cfb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1cfb('0x6'));var config=require(_0x1cfb('0x7'));var controller=require(_0x1cfb('0x8'));router['get']('/',auth[_0x1cfb('0x9')](),controller[_0x1cfb('0xa')]);router[_0x1cfb('0xb')](_0x1cfb('0xc'),auth['isAuthenticated'](),controller[_0x1cfb('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1cfb('0xe')](_0x1cfb('0xc'),auth[_0x1cfb('0x9')](),controller['update']);router[_0x1cfb('0xf')]('/:id',auth[_0x1cfb('0x9')](),controller[_0x1cfb('0x10')]);module[_0x1cfb('0x11')]=router; \ No newline at end of file +var _0x1ca6=['post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x170bba,_0x2be92f){var _0xa7c249=function(_0x2b6505){while(--_0x2b6505){_0x170bba['push'](_0x170bba['shift']());}};_0xa7c249(++_0x2be92f);}(_0x1ca6,0x1e1));var _0x61ca=function(_0x32056c,_0x1b6db7){_0x32056c=_0x32056c-0x0;var _0x317313=_0x1ca6[_0x32056c];return _0x317313;};'use strict';var multer=require(_0x61ca('0x0'));var util=require(_0x61ca('0x1'));var path=require(_0x61ca('0x2'));var timeout=require('connect-timeout');var express=require(_0x61ca('0x3'));var router=express[_0x61ca('0x4')]();var fs_extra=require(_0x61ca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x61ca('0x6'));var config=require('../../config/environment');var controller=require(_0x61ca('0x7'));router[_0x61ca('0x8')]('/',auth[_0x61ca('0x9')](),controller[_0x61ca('0xa')]);router[_0x61ca('0x8')](_0x61ca('0xb'),auth['isAuthenticated'](),controller[_0x61ca('0xc')]);router[_0x61ca('0xd')]('/',auth['isAuthenticated'](),controller[_0x61ca('0xe')]);router[_0x61ca('0xf')](_0x61ca('0xb'),auth[_0x61ca('0x9')](),controller[_0x61ca('0x10')]);router[_0x61ca('0x11')](_0x61ca('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x61ca('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0d59253..a558ff4 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 _0x9649=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9649,0x19f));var _0x9964=function(_0x1b706c,_0x1cd5a1){_0x1b706c=_0x1b706c-0x0;var _0x3b0cc0=_0x9649[_0x1b706c];return _0x3b0cc0;};'use strict';var Sequelize=require(_0x9964('0x0'));module[_0x9964('0x1')]={'name':{'type':Sequelize[_0x9964('0x2')]},'basename':{'type':Sequelize[_0x9964('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa7b4=['STRING','exports'];(function(_0x2be419,_0xf08292){var _0x1efa9f=function(_0x45373c){while(--_0x45373c){_0x2be419['push'](_0x2be419['shift']());}};_0x1efa9f(++_0xf08292);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x2a6109,_0x47853d){_0x2a6109=_0x2a6109-0x0;var _0x36c3d9=_0xa7b4[_0x2a6109];return _0x36c3d9;};'use strict';var Sequelize=require('sequelize');module[_0x4a7b('0x0')]={'name':{'type':Sequelize[_0x4a7b('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4a7b('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 701c291..8a4ec0b 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 _0xc097=['basename','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','rawAttributes','options','find','clone','includeAll','omit','updatedAt','createdAt','body','create','originalname','file','filename','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc097,0x16d));var _0x7c09=function(_0x594fe9,_0x3e0fa3){_0x594fe9=_0x594fe9-0x0;var _0xeaa78d=_0xc097[_0x594fe9];return _0xeaa78d;};'use strict';var emlformat=require(_0x7c09('0x0'));var rimraf=require(_0x7c09('0x1'));var zipdir=require(_0x7c09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c09('0x3'));var moment=require(_0x7c09('0x4'));var BPromise=require(_0x7c09('0x5'));var Mustache=require(_0x7c09('0x6'));var util=require('util');var path=require(_0x7c09('0x7'));var sox=require('sox');var csv=require(_0x7c09('0x8'));var ejs=require(_0x7c09('0x9'));var fs=require('fs');var fs_extra=require(_0x7c09('0xa'));var _=require(_0x7c09('0xb'));var squel=require('squel');var crypto=require(_0x7c09('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c09('0x8'));var querystring=require('querystring');var Papa=require(_0x7c09('0xd'));var Redis=require(_0x7c09('0xe'));var authService=require(_0x7c09('0xf'));var qs=require(_0x7c09('0x10'));var as=require(_0x7c09('0x11'));var hardwareService=require(_0x7c09('0x12'));var logger=require(_0x7c09('0x13'))(_0x7c09('0x14'));var utils=require(_0x7c09('0x15'));var config=require(_0x7c09('0x16'));var licenseUtil=require(_0x7c09('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x279e4d,_0x47168d){_0x47168d=_0x47168d||0xcc;return function(_0x3985e1){if(_0x3985e1){return _0x279e4d['sendStatus'](_0x47168d);}return _0x279e4d[_0x7c09('0x18')](_0x47168d)[_0x7c09('0x19')]();};}function respondWithResult(_0x4daa0e,_0x279031){_0x279031=_0x279031||0xc8;return function(_0x265237){if(_0x265237){return _0x4daa0e[_0x7c09('0x18')](_0x279031)['json'](_0x265237);}};}function respondWithFilteredResult(_0x4beeec,_0x40ae13){return function(_0x15a3af){if(_0x15a3af){var _0x194f40=typeof _0x40ae13[_0x7c09('0x1a')]===_0x7c09('0x1b')&&typeof _0x40ae13['limit']===_0x7c09('0x1b');var _0x387a08=_0x15a3af[_0x7c09('0x1c')];var _0x3093f9=_0x194f40?0x0:_0x40ae13[_0x7c09('0x1a')];var _0xea5cfd=_0x194f40?_0x15a3af[_0x7c09('0x1c')]:_0x40ae13[_0x7c09('0x1a')]+_0x40ae13[_0x7c09('0x1d')];var _0x474834;if(_0xea5cfd>=_0x387a08){_0xea5cfd=_0x387a08;_0x474834=0xc8;}else{_0x474834=0xce;}_0x4beeec[_0x7c09('0x18')](_0x474834);return _0x4beeec['set'](_0x7c09('0x1e'),_0x3093f9+'-'+_0xea5cfd+'/'+_0x387a08)[_0x7c09('0x1f')](_0x15a3af);}return null;};}function patchUpdates(_0x28d70f){return function(_0x30f951){try{jsonpatch[_0x7c09('0x20')](_0x30f951,_0x28d70f,!![]);}catch(_0x26dd5a){return BPromise[_0x7c09('0x21')](_0x26dd5a);}return _0x30f951['save']();};}function saveUpdates(_0x1cb0e8,_0x5e1247){return function(_0x40943c){if(_0x40943c){return _0x40943c[_0x7c09('0x22')](_0x1cb0e8)[_0x7c09('0x23')](function(_0x3f7b52){return _0x3f7b52;});}return null;};}function removeEntity(_0xe6648e,_0x4aee06){return function(_0x1322eb){if(_0x1322eb){return _0x1322eb[_0x7c09('0x24')]()[_0x7c09('0x23')](function(){_0xe6648e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa025b2,_0xc71b11){return function(_0x3cf312){if(!_0x3cf312){_0xa025b2[_0x7c09('0x25')](0x194);}return _0x3cf312;};}function handleError(_0x57e20f,_0x442762){_0x442762=_0x442762||0x1f4;return function(_0x159e9f){logger[_0x7c09('0x26')](_0x159e9f[_0x7c09('0x27')]);if(_0x159e9f['name']){delete _0x159e9f[_0x7c09('0x28')];}_0x57e20f[_0x7c09('0x18')](_0x442762)[_0x7c09('0x29')](_0x159e9f);};}exports[_0x7c09('0x2a')]=function(_0xcf47b9,_0x8a22e){var _0x362e73={},_0x131020={},_0x4087f7={'count':0x0,'rows':[]};var _0x24227b=_[_0x7c09('0x2b')](db[_0x7c09('0x2c')]['rawAttributes'],function(_0x5e79aa){return{'name':_0x5e79aa[_0x7c09('0x2d')],'type':_0x5e79aa[_0x7c09('0x2e')]['key']};});_0x131020[_0x7c09('0x2f')]=_['map'](_0x24227b,_0x7c09('0x28'));_0x131020[_0x7c09('0x30')]=_[_0x7c09('0x31')](_0xcf47b9[_0x7c09('0x30')]);_0x131020[_0x7c09('0x32')]=_['intersection'](_0x131020['model'],_0x131020['query']);_0x362e73[_0x7c09('0x33')]=_[_0x7c09('0x34')](_0x131020[_0x7c09('0x2f')],qs[_0x7c09('0x35')](_0xcf47b9[_0x7c09('0x30')][_0x7c09('0x35')]));_0x362e73[_0x7c09('0x33')]=_0x362e73['attributes'][_0x7c09('0x36')]?_0x362e73[_0x7c09('0x33')]:_0x131020[_0x7c09('0x2f')];if(!_0xcf47b9[_0x7c09('0x30')][_0x7c09('0x37')](_0x7c09('0x38'))){_0x362e73['limit']=qs['limit'](_0xcf47b9['query'][_0x7c09('0x1d')]);_0x362e73['offset']=qs[_0x7c09('0x1a')](_0xcf47b9[_0x7c09('0x30')][_0x7c09('0x1a')]);}_0x362e73[_0x7c09('0x39')]=qs[_0x7c09('0x3a')](_0xcf47b9[_0x7c09('0x30')][_0x7c09('0x3a')]);_0x362e73[_0x7c09('0x3b')]=qs[_0x7c09('0x32')](_[_0x7c09('0x3c')](_0xcf47b9[_0x7c09('0x30')],_0x131020[_0x7c09('0x32')]),_0x24227b);if(_0xcf47b9[_0x7c09('0x30')][_0x7c09('0x3d')]){_0x362e73[_0x7c09('0x3b')]=_[_0x7c09('0x3e')](_0x362e73[_0x7c09('0x3b')],{'$or':_[_0x7c09('0x2b')](_0x24227b,function(_0x52c6f5){if(_0x52c6f5['type']!=='VIRTUAL'){var _0x2322c0={};_0x2322c0[_0x52c6f5[_0x7c09('0x28')]]={'$like':'%'+_0xcf47b9['query']['filter']+'%'};return _0x2322c0;}})});}_0x362e73=_[_0x7c09('0x3e')]({},_0x362e73,_0xcf47b9['options']);var _0x49335b={'where':_0x362e73[_0x7c09('0x3b')]};return db[_0x7c09('0x2c')][_0x7c09('0x1c')](_0x49335b)[_0x7c09('0x23')](function(_0x4911b9){_0x4087f7[_0x7c09('0x1c')]=_0x4911b9;if(_0xcf47b9['query']['includeAll']){_0x362e73[_0x7c09('0x3f')]=[{'all':!![]}];}return db[_0x7c09('0x2c')][_0x7c09('0x40')](_0x362e73);})[_0x7c09('0x23')](function(_0xa89464){_0x4087f7[_0x7c09('0x41')]=_0xa89464;return _0x4087f7;})[_0x7c09('0x23')](respondWithFilteredResult(_0x8a22e,_0x362e73))[_0x7c09('0x42')](handleError(_0x8a22e,null));};exports[_0x7c09('0x43')]=function(_0x2e979a,_0x29d02d){var _0x1d148f={'raw':!![],'where':{'id':_0x2e979a[_0x7c09('0x44')]['id']}},_0xebfeb6={};_0xebfeb6[_0x7c09('0x2f')]=_[_0x7c09('0x31')](db[_0x7c09('0x2c')][_0x7c09('0x45')]);_0xebfeb6[_0x7c09('0x30')]=_[_0x7c09('0x31')](_0x2e979a[_0x7c09('0x30')]);_0xebfeb6[_0x7c09('0x32')]=_[_0x7c09('0x34')](_0xebfeb6[_0x7c09('0x2f')],_0xebfeb6[_0x7c09('0x30')]);_0x1d148f[_0x7c09('0x33')]=_[_0x7c09('0x34')](_0xebfeb6[_0x7c09('0x2f')],qs[_0x7c09('0x35')](_0x2e979a[_0x7c09('0x30')][_0x7c09('0x35')]));_0x1d148f['attributes']=_0x1d148f[_0x7c09('0x33')][_0x7c09('0x36')]?_0x1d148f[_0x7c09('0x33')]:_0xebfeb6[_0x7c09('0x2f')];if(_0x2e979a[_0x7c09('0x30')]['includeAll']){_0x1d148f[_0x7c09('0x3f')]=[{'all':!![]}];}_0x1d148f=_['merge']({},_0x1d148f,_0x2e979a[_0x7c09('0x46')]);return db['Attachment'][_0x7c09('0x47')](_0x1d148f)[_0x7c09('0x23')](handleEntityNotFound(_0x29d02d,null))[_0x7c09('0x23')](respondWithResult(_0x29d02d,null))['catch'](handleError(_0x29d02d,null));};exports[_0x7c09('0x48')]=function(_0x3697fc,_0x50d441){var _0x25800e={'where':{'id':_0x3697fc[_0x7c09('0x44')]['id']}},_0x26bcc2={};_0x26bcc2[_0x7c09('0x2f')]=_[_0x7c09('0x31')](db[_0x7c09('0x2c')]['rawAttributes']);_0x25800e['attributes']=_[_0x7c09('0x34')](_0x26bcc2['model'],qs['fields'](_0x3697fc[_0x7c09('0x30')]['fields']));_0x25800e[_0x7c09('0x33')]=_0x25800e[_0x7c09('0x33')][_0x7c09('0x36')]?_0x25800e[_0x7c09('0x33')]:_0x26bcc2[_0x7c09('0x2f')];if(_0x3697fc['query'][_0x7c09('0x49')]){_0x25800e['include']=[{'all':!![]}];}_0x25800e=_[_0x7c09('0x3e')]({},_0x25800e,_0x3697fc[_0x7c09('0x46')]);return db['Attachment'][_0x7c09('0x47')](_0x25800e)['then'](handleEntityNotFound(_0x50d441,null))[_0x7c09('0x23')](function(_0x3ce688){if(_0x3ce688){var _0xda113b=_0x3ce688['get']({'plain':!![]});_0xda113b=qs[_0x7c09('0x4a')](_0xda113b,['id','createdAt',_0x7c09('0x4b')]);_0x3697fc['body']=_[_0x7c09('0x4a')](_0x3697fc['body'],['id',_0x7c09('0x4c'),_0x7c09('0x4b')]);return db[_0x7c09('0x2c')]['create'](_[_0x7c09('0x3e')](_0xda113b,_0x3697fc['body']),{'include':_0x3697fc[_0x7c09('0x30')][_0x7c09('0x49')]?[{'all':!![]}]:undefined});}})[_0x7c09('0x23')](respondWithResult(_0x50d441,0xc9))['catch'](handleError(_0x50d441,null));};exports[_0x7c09('0x22')]=function(_0x5e9e92,_0xfcc753){if(_0x5e9e92['body']['id']){delete _0x5e9e92[_0x7c09('0x4d')]['id'];}return db[_0x7c09('0x2c')][_0x7c09('0x47')]({'where':{'id':_0x5e9e92[_0x7c09('0x44')]['id']}})[_0x7c09('0x23')](handleEntityNotFound(_0xfcc753,null))[_0x7c09('0x23')](saveUpdates(_0x5e9e92[_0x7c09('0x4d')],null))[_0x7c09('0x23')](respondWithResult(_0xfcc753,null))[_0x7c09('0x42')](handleError(_0xfcc753,null));};exports['destroy']=function(_0x17a718,_0x1e70c4){return db[_0x7c09('0x2c')][_0x7c09('0x47')]({'where':{'id':_0x17a718[_0x7c09('0x44')]['id']}})[_0x7c09('0x23')](handleEntityNotFound(_0x1e70c4,null))['then'](removeEntity(_0x1e70c4,null))[_0x7c09('0x42')](handleError(_0x1e70c4,null));};exports[_0x7c09('0x4e')]=function(_0x1646aa,_0x54efde,_0x337fd8){_0x1646aa[_0x7c09('0x4d')]['name']=_0x1646aa['file'][_0x7c09('0x4f')];_0x1646aa[_0x7c09('0x4d')]['basename']=_0x1646aa[_0x7c09('0x50')][_0x7c09('0x51')];_0x1646aa['body']['type']=_0x1646aa[_0x7c09('0x50')][_0x7c09('0x52')];return db[_0x7c09('0x2c')][_0x7c09('0x4e')](_0x1646aa[_0x7c09('0x4d')])[_0x7c09('0x23')](respondWithResult(_0x54efde,0xc9))['catch'](handleError(_0x54efde,null));};exports[_0x7c09('0x53')]=function(_0x4e1e7b,_0x1bd97f,_0x28108c){return db['Attachment'][_0x7c09('0x54')]({'where':{'id':_0x4e1e7b[_0x7c09('0x44')]['id']},'raw':!![]})[_0x7c09('0x23')](handleEntityNotFound(_0x1bd97f,null))['then'](function(_0x174f7d){if(_0x174f7d){var _0x267928=_0x174f7d[_0x7c09('0x55')]!==null;var _0x36cb68=path['join'](config[_0x7c09('0x56')],_0x7c09('0x57'));if(_0x267928){_0x36cb68=path['join'](_0x36cb68,_0x7c09('0x58'));}var _0x422ab0=path[_0x7c09('0x59')](_0x36cb68,_0x174f7d[_0x7c09('0x5a')]);return _0x1bd97f['download'](_0x422ab0);}})['catch'](handleError(_0x1bd97f,null));}; \ No newline at end of file +var _0xf3bd=['length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','find','catch','clone','params','get','omit','updatedAt','body','createdAt','create','update','file','filename','mimetype','download','findOne','ChatOfflineMessageId','root','join','offline-chat/','basename','eml-format','rimraf','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0xf3bd,0x12a));var _0xdf3b=function(_0x510ad9,_0xf3a178){_0x510ad9=_0x510ad9-0x0;var _0x4ca16f=_0xf3bd[_0x510ad9];return _0x4ca16f;};'use strict';var emlformat=require(_0xdf3b('0x0'));var rimraf=require(_0xdf3b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdf3b('0x2'));var moment=require('moment');var BPromise=require(_0xdf3b('0x3'));var Mustache=require(_0xdf3b('0x4'));var util=require(_0xdf3b('0x5'));var path=require(_0xdf3b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdf3b('0x7'));var fs=require('fs');var fs_extra=require(_0xdf3b('0x8'));var _=require(_0xdf3b('0x9'));var squel=require(_0xdf3b('0xa'));var crypto=require(_0xdf3b('0xb'));var jsforce=require(_0xdf3b('0xc'));var deskjs=require(_0xdf3b('0xd'));var toCsv=require(_0xdf3b('0xe'));var querystring=require(_0xdf3b('0xf'));var Papa=require(_0xdf3b('0x10'));var Redis=require(_0xdf3b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf3b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf3b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdf3b('0x14'));var licenseUtil=require(_0xdf3b('0x15'));var db=require(_0xdf3b('0x16'))['db'];function respondWithStatusCode(_0x3ac033,_0x1d5874){_0x1d5874=_0x1d5874||0xcc;return function(_0x5a8527){if(_0x5a8527){return _0x3ac033[_0xdf3b('0x17')](_0x1d5874);}return _0x3ac033[_0xdf3b('0x18')](_0x1d5874)['end']();};}function respondWithResult(_0x39e20c,_0x1954bc){_0x1954bc=_0x1954bc||0xc8;return function(_0x11d628){if(_0x11d628){return _0x39e20c[_0xdf3b('0x18')](_0x1954bc)[_0xdf3b('0x19')](_0x11d628);}};}function respondWithFilteredResult(_0x28f05f,_0x1539cd){return function(_0x24c6f8){if(_0x24c6f8){var _0x2415a0=typeof _0x1539cd['offset']===_0xdf3b('0x1a')&&typeof _0x1539cd[_0xdf3b('0x1b')]==='undefined';var _0x6de785=_0x24c6f8[_0xdf3b('0x1c')];var _0x2989bf=_0x2415a0?0x0:_0x1539cd[_0xdf3b('0x1d')];var _0x3bcae5=_0x2415a0?_0x24c6f8[_0xdf3b('0x1c')]:_0x1539cd[_0xdf3b('0x1d')]+_0x1539cd[_0xdf3b('0x1b')];var _0x1767b9;if(_0x3bcae5>=_0x6de785){_0x3bcae5=_0x6de785;_0x1767b9=0xc8;}else{_0x1767b9=0xce;}_0x28f05f[_0xdf3b('0x18')](_0x1767b9);return _0x28f05f[_0xdf3b('0x1e')](_0xdf3b('0x1f'),_0x2989bf+'-'+_0x3bcae5+'/'+_0x6de785)[_0xdf3b('0x19')](_0x24c6f8);}return null;};}function patchUpdates(_0x39bed7){return function(_0x4c1553){try{jsonpatch['apply'](_0x4c1553,_0x39bed7,!![]);}catch(_0x20599f){return BPromise[_0xdf3b('0x20')](_0x20599f);}return _0x4c1553[_0xdf3b('0x21')]();};}function saveUpdates(_0x2bdffa,_0x1350c9){return function(_0x272abe){if(_0x272abe){return _0x272abe['update'](_0x2bdffa)[_0xdf3b('0x22')](function(_0x3ba581){return _0x3ba581;});}return null;};}function removeEntity(_0x436bad,_0x58cf04){return function(_0x1f1136){if(_0x1f1136){return _0x1f1136[_0xdf3b('0x23')]()['then'](function(){_0x436bad['status'](0xcc)[_0xdf3b('0x24')]();});}};}function handleEntityNotFound(_0x206e75,_0x4300ac){return function(_0x3fb056){if(!_0x3fb056){_0x206e75['sendStatus'](0x194);}return _0x3fb056;};}function handleError(_0x7fba88,_0x28c6f6){_0x28c6f6=_0x28c6f6||0x1f4;return function(_0x3feac6){logger[_0xdf3b('0x25')](_0x3feac6[_0xdf3b('0x26')]);if(_0x3feac6[_0xdf3b('0x27')]){delete _0x3feac6[_0xdf3b('0x27')];}_0x7fba88[_0xdf3b('0x18')](_0x28c6f6)[_0xdf3b('0x28')](_0x3feac6);};}exports[_0xdf3b('0x29')]=function(_0x946313,_0x3f8461){var _0x4cf65d={},_0x16d307={},_0x31abc4={'count':0x0,'rows':[]};var _0x39ce7c=_[_0xdf3b('0x2a')](db[_0xdf3b('0x2b')][_0xdf3b('0x2c')],function(_0x4b7f54){return{'name':_0x4b7f54[_0xdf3b('0x2d')],'type':_0x4b7f54[_0xdf3b('0x2e')][_0xdf3b('0x2f')]};});_0x16d307[_0xdf3b('0x30')]=_[_0xdf3b('0x2a')](_0x39ce7c,'name');_0x16d307[_0xdf3b('0x31')]=_[_0xdf3b('0x32')](_0x946313[_0xdf3b('0x31')]);_0x16d307['filters']=_[_0xdf3b('0x33')](_0x16d307[_0xdf3b('0x30')],_0x16d307[_0xdf3b('0x31')]);_0x4cf65d[_0xdf3b('0x34')]=_[_0xdf3b('0x33')](_0x16d307['model'],qs[_0xdf3b('0x35')](_0x946313['query'][_0xdf3b('0x35')]));_0x4cf65d[_0xdf3b('0x34')]=_0x4cf65d[_0xdf3b('0x34')][_0xdf3b('0x36')]?_0x4cf65d[_0xdf3b('0x34')]:_0x16d307[_0xdf3b('0x30')];if(!_0x946313[_0xdf3b('0x31')]['hasOwnProperty'](_0xdf3b('0x37'))){_0x4cf65d[_0xdf3b('0x1b')]=qs[_0xdf3b('0x1b')](_0x946313[_0xdf3b('0x31')][_0xdf3b('0x1b')]);_0x4cf65d['offset']=qs[_0xdf3b('0x1d')](_0x946313[_0xdf3b('0x31')][_0xdf3b('0x1d')]);}_0x4cf65d[_0xdf3b('0x38')]=qs[_0xdf3b('0x39')](_0x946313['query']['sort']);_0x4cf65d['where']=qs[_0xdf3b('0x3a')](_[_0xdf3b('0x3b')](_0x946313['query'],_0x16d307[_0xdf3b('0x3a')]),_0x39ce7c);if(_0x946313['query'][_0xdf3b('0x3c')]){_0x4cf65d[_0xdf3b('0x3d')]=_[_0xdf3b('0x3e')](_0x4cf65d[_0xdf3b('0x3d')],{'$or':_[_0xdf3b('0x2a')](_0x39ce7c,function(_0x111170){if(_0x111170[_0xdf3b('0x2e')]!==_0xdf3b('0x3f')){var _0x25cfbc={};_0x25cfbc[_0x111170['name']]={'$like':'%'+_0x946313[_0xdf3b('0x31')][_0xdf3b('0x3c')]+'%'};return _0x25cfbc;}})});}_0x4cf65d=_[_0xdf3b('0x3e')]({},_0x4cf65d,_0x946313[_0xdf3b('0x40')]);var _0x227054={'where':_0x4cf65d['where']};return db[_0xdf3b('0x2b')][_0xdf3b('0x1c')](_0x227054)['then'](function(_0x2fc8e8){_0x31abc4[_0xdf3b('0x1c')]=_0x2fc8e8;if(_0x946313[_0xdf3b('0x31')][_0xdf3b('0x41')]){_0x4cf65d[_0xdf3b('0x42')]=[{'all':!![]}];}return db[_0xdf3b('0x2b')]['findAll'](_0x4cf65d);})[_0xdf3b('0x22')](function(_0x55d676){_0x31abc4['rows']=_0x55d676;return _0x31abc4;})[_0xdf3b('0x22')](respondWithFilteredResult(_0x3f8461,_0x4cf65d))['catch'](handleError(_0x3f8461,null));};exports['show']=function(_0x1e6f21,_0x1369dd){var _0x4d9982={'raw':!![],'where':{'id':_0x1e6f21['params']['id']}},_0x58bd86={};_0x58bd86[_0xdf3b('0x30')]=_[_0xdf3b('0x32')](db[_0xdf3b('0x2b')][_0xdf3b('0x2c')]);_0x58bd86[_0xdf3b('0x31')]=_['keys'](_0x1e6f21[_0xdf3b('0x31')]);_0x58bd86[_0xdf3b('0x3a')]=_[_0xdf3b('0x33')](_0x58bd86[_0xdf3b('0x30')],_0x58bd86[_0xdf3b('0x31')]);_0x4d9982[_0xdf3b('0x34')]=_['intersection'](_0x58bd86['model'],qs[_0xdf3b('0x35')](_0x1e6f21[_0xdf3b('0x31')][_0xdf3b('0x35')]));_0x4d9982[_0xdf3b('0x34')]=_0x4d9982[_0xdf3b('0x34')]['length']?_0x4d9982[_0xdf3b('0x34')]:_0x58bd86[_0xdf3b('0x30')];if(_0x1e6f21[_0xdf3b('0x31')][_0xdf3b('0x41')]){_0x4d9982['include']=[{'all':!![]}];}_0x4d9982=_[_0xdf3b('0x3e')]({},_0x4d9982,_0x1e6f21[_0xdf3b('0x40')]);return db['Attachment'][_0xdf3b('0x43')](_0x4d9982)[_0xdf3b('0x22')](handleEntityNotFound(_0x1369dd,null))['then'](respondWithResult(_0x1369dd,null))[_0xdf3b('0x44')](handleError(_0x1369dd,null));};exports[_0xdf3b('0x45')]=function(_0x1a0f2d,_0x2315d6){var _0x1b0e7c={'where':{'id':_0x1a0f2d[_0xdf3b('0x46')]['id']}},_0x13884e={};_0x13884e[_0xdf3b('0x30')]=_[_0xdf3b('0x32')](db[_0xdf3b('0x2b')]['rawAttributes']);_0x1b0e7c['attributes']=_[_0xdf3b('0x33')](_0x13884e[_0xdf3b('0x30')],qs['fields'](_0x1a0f2d[_0xdf3b('0x31')]['fields']));_0x1b0e7c['attributes']=_0x1b0e7c['attributes'][_0xdf3b('0x36')]?_0x1b0e7c[_0xdf3b('0x34')]:_0x13884e['model'];if(_0x1a0f2d[_0xdf3b('0x31')][_0xdf3b('0x41')]){_0x1b0e7c[_0xdf3b('0x42')]=[{'all':!![]}];}_0x1b0e7c=_[_0xdf3b('0x3e')]({},_0x1b0e7c,_0x1a0f2d['options']);return db['Attachment']['find'](_0x1b0e7c)[_0xdf3b('0x22')](handleEntityNotFound(_0x2315d6,null))['then'](function(_0x5e53c7){if(_0x5e53c7){var _0xbfdc8=_0x5e53c7[_0xdf3b('0x47')]({'plain':!![]});_0xbfdc8=qs[_0xdf3b('0x48')](_0xbfdc8,['id','createdAt',_0xdf3b('0x49')]);_0x1a0f2d[_0xdf3b('0x4a')]=_[_0xdf3b('0x48')](_0x1a0f2d[_0xdf3b('0x4a')],['id',_0xdf3b('0x4b'),_0xdf3b('0x49')]);return db[_0xdf3b('0x2b')][_0xdf3b('0x4c')](_[_0xdf3b('0x3e')](_0xbfdc8,_0x1a0f2d['body']),{'include':_0x1a0f2d[_0xdf3b('0x31')][_0xdf3b('0x41')]?[{'all':!![]}]:undefined});}})[_0xdf3b('0x22')](respondWithResult(_0x2315d6,0xc9))['catch'](handleError(_0x2315d6,null));};exports[_0xdf3b('0x4d')]=function(_0x5b629d,_0x9ee0df){if(_0x5b629d[_0xdf3b('0x4a')]['id']){delete _0x5b629d[_0xdf3b('0x4a')]['id'];}return db[_0xdf3b('0x2b')]['find']({'where':{'id':_0x5b629d[_0xdf3b('0x46')]['id']}})[_0xdf3b('0x22')](handleEntityNotFound(_0x9ee0df,null))[_0xdf3b('0x22')](saveUpdates(_0x5b629d[_0xdf3b('0x4a')],null))[_0xdf3b('0x22')](respondWithResult(_0x9ee0df,null))[_0xdf3b('0x44')](handleError(_0x9ee0df,null));};exports[_0xdf3b('0x23')]=function(_0x22364e,_0x209bce){return db[_0xdf3b('0x2b')][_0xdf3b('0x43')]({'where':{'id':_0x22364e[_0xdf3b('0x46')]['id']}})[_0xdf3b('0x22')](handleEntityNotFound(_0x209bce,null))['then'](removeEntity(_0x209bce,null))[_0xdf3b('0x44')](handleError(_0x209bce,null));};exports['create']=function(_0x4e5f7e,_0x5d8eae,_0x586a11){_0x4e5f7e[_0xdf3b('0x4a')][_0xdf3b('0x27')]=_0x4e5f7e[_0xdf3b('0x4e')]['originalname'];_0x4e5f7e[_0xdf3b('0x4a')]['basename']=_0x4e5f7e[_0xdf3b('0x4e')][_0xdf3b('0x4f')];_0x4e5f7e['body'][_0xdf3b('0x2e')]=_0x4e5f7e[_0xdf3b('0x4e')][_0xdf3b('0x50')];return db['Attachment']['create'](_0x4e5f7e[_0xdf3b('0x4a')])['then'](respondWithResult(_0x5d8eae,0xc9))['catch'](handleError(_0x5d8eae,null));};exports[_0xdf3b('0x51')]=function(_0xe3b667,_0x5507b8,_0x25f727){return db[_0xdf3b('0x2b')][_0xdf3b('0x52')]({'where':{'id':_0xe3b667['params']['id']},'raw':!![]})[_0xdf3b('0x22')](handleEntityNotFound(_0x5507b8,null))[_0xdf3b('0x22')](function(_0x4a98fd){if(_0x4a98fd){var _0x11f89d=_0x4a98fd[_0xdf3b('0x53')]!==null;var _0x1d9195=path['join'](config[_0xdf3b('0x54')],'server/files/attachments/');if(_0x11f89d){_0x1d9195=path[_0xdf3b('0x55')](_0x1d9195,_0xdf3b('0x56'));}var _0x33083a=path['join'](_0x1d9195,_0x4a98fd[_0xdf3b('0x57')]);return _0x5507b8[_0xdf3b('0x51')](_0x33083a);}})[_0xdf3b('0x44')](handleError(_0x5507b8,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index aacc69c..c6439f1 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 _0x3362=['exports','attachments','util','api','moment','bluebird','request-promise','rimraf','./attachment.attributes'];(function(_0x278cb1,_0xfdcabf){var _0x1a12e6=function(_0x394f5f){while(--_0x394f5f){_0x278cb1['push'](_0x278cb1['shift']());}};_0x1a12e6(++_0xfdcabf);}(_0x3362,0x77));var _0x2336=function(_0x3cc4fc,_0x5a69d1){_0x3cc4fc=_0x3cc4fc-0x0;var _0x11cc8a=_0x3362[_0x3cc4fc];return _0x11cc8a;};'use strict';var _=require('lodash');var util=require(_0x2336('0x0'));var logger=require('../../config/logger')(_0x2336('0x1'));var moment=require(_0x2336('0x2'));var BPromise=require(_0x2336('0x3'));var rp=require(_0x2336('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2336('0x5'));var config=require('../../config/environment');var attributes=require(_0x2336('0x6'));module[_0x2336('0x7')]=function(_0x570460,_0x52ff64){return _0x570460['define']('Attachment',attributes,{'tableName':_0x2336('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa21f=['../../config/logger','api','moment','path','rimraf','./attachment.attributes','exports','Attachment','attachments','lodash','util'];(function(_0x416c5a,_0x34326e){var _0x20c95a=function(_0x445afd){while(--_0x445afd){_0x416c5a['push'](_0x416c5a['shift']());}};_0x20c95a(++_0x34326e);}(_0xa21f,0x174));var _0xfa21=function(_0x820dcd,_0x44a136){_0x820dcd=_0x820dcd-0x0;var _0x1a7c7d=_0xa21f[_0x820dcd];return _0x1a7c7d;};'use strict';var _=require(_0xfa21('0x0'));var util=require(_0xfa21('0x1'));var logger=require(_0xfa21('0x2'))(_0xfa21('0x3'));var moment=require(_0xfa21('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa21('0x5'));var rimraf=require(_0xfa21('0x6'));var config=require('../../config/environment');var attributes=require(_0xfa21('0x7'));module[_0xfa21('0x8')]=function(_0x2310eb,_0x2574eb){return _0x2310eb['define'](_0xfa21('0x9'),attributes,{'tableName':_0xfa21('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index facdc89..55d143b 100644 --- a/server/api/attachment/attachment.rpc.js +++ b/server/api/attachment/attachment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44a3=['create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','Attachment,\x20%s,\x20%s','catch','CreateAttachment','Attachment'];(function(_0x43789b,_0x241cb4){var _0x1b0e38=function(_0x3f6add){while(--_0x3f6add){_0x43789b['push'](_0x43789b['shift']());}};_0x1b0e38(++_0x241cb4);}(_0x44a3,0x1a9));var _0x344a=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x44a3[_0x19d24c];return _0x2fae8d;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('Attachment,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('Attachment,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('Attachment,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});}exports[_0x344a('0x17')]=function(_0x277c06){var _0x49b55f=this;return new Promise(function(_0x9fe854,_0x274016){return db[_0x344a('0x18')][_0x344a('0x19')](_0x277c06[_0x344a('0x1a')],{'raw':_0x277c06[_0x344a('0x1b')]?_0x277c06[_0x344a('0x1b')][_0x344a('0x1c')]===undefined?!![]:![]:!![]})[_0x344a('0xe')](function(_0x450922){logger['info'](_0x344a('0x17'),_0x277c06);logger[_0x344a('0x11')](_0x344a('0x17'),_0x277c06,JSON[_0x344a('0x1d')](_0x450922));_0x9fe854(_0x450922);})[_0x344a('0x16')](function(_0x80ae12){logger[_0x344a('0x12')](_0x344a('0x17'),_0x80ae12[_0x344a('0x14')],_0x277c06);_0x274016(_0x49b55f[_0x344a('0x12')](0x1f4,_0x80ae12[_0x344a('0x14')]));});});}; \ No newline at end of file +var _0xc1c4=['Attachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment'];(function(_0x44c31e,_0x461e58){var _0x3b79b6=function(_0x8cc30d){while(--_0x8cc30d){_0x44c31e['push'](_0x44c31e['shift']());}};_0x3b79b6(++_0x461e58);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x40b22c,_0x448a14){_0x40b22c=_0x40b22c-0x0;var _0x3384ed=_0xc1c4[_0x40b22c];return _0x3384ed;};'use strict';var _=require(_0x4c1c('0x0'));var util=require(_0x4c1c('0x1'));var moment=require(_0x4c1c('0x2'));var BPromise=require(_0x4c1c('0x3'));var rs=require(_0x4c1c('0x4'));var fs=require('fs');var Redis=require(_0x4c1c('0x5'));var db=require(_0x4c1c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c1c('0x7'))(_0x4c1c('0x8'));var config=require(_0x4c1c('0x9'));var jayson=require(_0x4c1c('0xa'));var client=jayson['client'][_0x4c1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f5a4f,_0x5863d0,_0x20e276){return new BPromise(function(_0x3337e4,_0x486065){return client[_0x4c1c('0xc')](_0x4f5a4f,_0x20e276)[_0x4c1c('0xd')](function(_0x445441){logger[_0x4c1c('0xe')](_0x4c1c('0xf'),_0x5863d0,'request\x20sent');logger['debug'](_0x4c1c('0x10'),_0x5863d0,_0x4c1c('0x11'),JSON[_0x4c1c('0x12')](_0x445441));if(_0x445441[_0x4c1c('0x13')]){if(_0x445441[_0x4c1c('0x13')][_0x4c1c('0x14')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x5863d0,_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);return _0x486065(_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);}logger[_0x4c1c('0x13')]('Attachment,\x20%s,\x20%s',_0x5863d0,_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);return _0x3337e4(_0x445441['error'][_0x4c1c('0x15')]);}else{logger[_0x4c1c('0xe')](_0x4c1c('0xf'),_0x5863d0,_0x4c1c('0x11'));_0x3337e4(_0x445441[_0x4c1c('0x16')][_0x4c1c('0x15')]);}})[_0x4c1c('0x17')](function(_0x33641d){logger[_0x4c1c('0x13')](_0x4c1c('0xf'),_0x5863d0,_0x33641d);_0x486065(_0x33641d);});});}exports[_0x4c1c('0x18')]=function(_0x5a9217){var _0x1fad89=this;return new Promise(function(_0x213019,_0x64fe4b){return db[_0x4c1c('0x19')][_0x4c1c('0x1a')](_0x5a9217[_0x4c1c('0x1b')],{'raw':_0x5a9217[_0x4c1c('0x1c')]?_0x5a9217[_0x4c1c('0x1c')][_0x4c1c('0x1d')]===undefined?!![]:![]:!![]})[_0x4c1c('0xd')](function(_0x58aca9){logger['info'](_0x4c1c('0x18'),_0x5a9217);logger['debug'](_0x4c1c('0x18'),_0x5a9217,JSON[_0x4c1c('0x12')](_0x58aca9));_0x213019(_0x58aca9);})['catch'](function(_0x23377c){logger['error']('CreateAttachment',_0x23377c[_0x4c1c('0x15')],_0x5a9217);_0x64fe4b(_0x1fad89[_0x4c1c('0x13')](0x1f4,_0x23377c[_0x4c1c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 101c95b..09633fb 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0xf7bdcd,_0x373cbb){var _0x4a96ef=function(_0x2f48b5){while(--_0x2f48b5){_0xf7bdcd['push'](_0xf7bdcd['shift']());}};_0x4a96ef(++_0x373cbb);}(_0x757a,0xde));var _0xa757=function(_0x11d0f4,_0x117a62){_0x11d0f4=_0x11d0f4-0x0;var _0x33bb8f=_0x757a[_0x11d0f4];return _0x33bb8f;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0xa3c969,_0x4760ff){var _0x265ad3=function(_0x488c37){while(--_0x488c37){_0xa3c969['push'](_0xa3c969['shift']());}};_0x265ad3(++_0x4760ff);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f3ba3,_0x8ff3){_0x2f3ba3=_0x2f3ba3-0x0;var _0x1525ee=_0x5f2f[_0x2f3ba3];return _0x1525ee;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 19aa833..ac4387a 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 _0x8c73=['findOne','adSsoEnabled','blockDuration','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','blocked','blockedAt','user','agent','then','disabled','add','clearBlockUser','getLicense','catch','status','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','User','passport','passport-local','Strategy','moment','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting'];(function(_0x12c3d1,_0x3c6ae7){var _0x282840=function(_0x4ae0d2){while(--_0x4ae0d2){_0x12c3d1['push'](_0x12c3d1['shift']());}};_0x282840(++_0x3c6ae7);}(_0x8c73,0x10d));var _0x38c7=function(_0x503e4e,_0x5e9fba){_0x503e4e=_0x503e4e-0x0;var _0x30e5fd=_0x8c73[_0x503e4e];return _0x30e5fd;};'use strict';var passport=require(_0x38c7('0x0'));var LocalStrategy=require(_0x38c7('0x1'))[_0x38c7('0x2')];var moment=require(_0x38c7('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x38c7('0x4'));var util=require('util');var db=require(_0x38c7('0x5'))['db'];var authService=require(_0x38c7('0x6'));var utils=require(_0x38c7('0x7'));var config=require(_0x38c7('0x8'));var logger=require(_0x38c7('0x9'))(_0x38c7('0xa'));function isActiveDirectoryConfigured(_0x4d2f0b){var _0x113b2e=![];if(typeof _0x4d2f0b[_0x38c7('0xb')]!==_0x38c7('0xc')){_0x113b2e=_0x4d2f0b[_0x38c7('0xb')]['baseDN']&&_0x4d2f0b[_0x38c7('0xb')][_0x38c7('0xd')]&&_0x4d2f0b[_0x38c7('0xb')][_0x38c7('0xe')];}return _0x113b2e;}function adAuthenticate(_0x3fe746,_0x4a4708,_0x2beb46){return new BPromise(function(_0x57a090,_0x175496){try{var _0x25b213=new ActiveDirectory(_0x3fe746);_0x25b213['authenticate'](_0x4a4708,_0x2beb46,function(_0x460ae3,_0x4a8bc8){if(_0x460ae3){logger['error'](_0x38c7('0xf'),_0x4a4708,util[_0x38c7('0x10')](_0x460ae3,{'showHidden':![],'depth':null}));_0x175496(_0x38c7('0x11'));}else if(!_0x4a8bc8){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x4a4708);_0x175496(_0x38c7('0x11'));}else{_0x57a090(_0x4a8bc8);}});}catch(_0x38e443){_0x175496(_0x38e443);}});}function ActiveDirectoryAuthenticate(_0x57b785,_0x239400,_0xbee7c7,_0x1c169d){var _0x101d00,_0x449b76;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x239400);return _0x1c169d(null,![],{'message':_0x38c7('0x11')});}return db[_0x38c7('0x12')][_0x38c7('0x13')]({'where':{'id':0x1},'attributes':[_0x38c7('0x14'),_0x38c7('0x15')],'raw':!![]})['then'](function(_0x1e300b){_0x101d00=_0x1e300b;if(!_0x101d00['adSsoEnabled']){logger[_0x38c7('0x16')](_0x38c7('0x17'),_0x239400);throw new Error(_0x38c7('0x11'));}return _0x57b785[_0x38c7('0x13')]({'attributes':['id',_0x38c7('0x18'),'password',_0x38c7('0x19'),_0x38c7('0x1a'),'disabled',_0x38c7('0x1b'),_0x38c7('0x1c'),'online'],'where':{'name':_0x239400,'role':{'$or':['admin',_0x38c7('0x1d'),_0x38c7('0x1e')]},'adSsoEnabled':!![]}});})[_0x38c7('0x1f')](function(_0x35d40e){if(!_0x35d40e||_0x35d40e&&_0x35d40e[_0x38c7('0x18')]!==_0x239400){throw new Error(_0x38c7('0x11'));}_0x449b76=_0x35d40e;var _0x3df980=_0x449b76['name']+'@'+config[_0x38c7('0xb')][_0x38c7('0xe')];return adAuthenticate(config[_0x38c7('0xb')],_0x3df980,_0xbee7c7);})[_0x38c7('0x1f')](function(_0x2b1c0c){if(_0x449b76[_0x38c7('0x20')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x101d00['blockDuration']>0x0){if(_0x449b76[_0x38c7('0x1b')]){if(moment(_0x449b76[_0x38c7('0x1c')])[_0x38c7('0x21')](_0x101d00[_0x38c7('0x15')],'minutes')>moment()){throw new Error(_0x38c7('0x11'));}return utils[_0x38c7('0x22')](_0x449b76,0x0,![],null)[_0x38c7('0x1f')](function(){return utils['getLicense'](_0x449b76);})['then'](function(){return _0x1c169d(null,_0x449b76);});}else{return utils['getLicense'](_0x449b76)[_0x38c7('0x1f')](function(){return _0x1c169d(null,_0x449b76);});}}else{return utils[_0x38c7('0x23')](_0x449b76)[_0x38c7('0x1f')](function(){return _0x1c169d(null,_0x449b76);});}})[_0x38c7('0x24')](function(_0x2bbbb5){return _0x1c169d(null,![],_0x2bbbb5);});}function handleError(_0x58bae8,_0x408f71,_0x359df2){return _0x58bae8[_0x38c7('0x25')](_0x408f71||0x1f4)[_0x38c7('0x26')]({'message':_0x359df2?_0x359df2[_0x38c7('0x27')]||_0x359df2:''});}exports[_0x38c7('0x28')]=function(_0x2486fa,_0x5e1fbf,_0x536b20){passport[_0x38c7('0x29')](_0x38c7('0x2a'),function(_0x5a1d90,_0x24a424,_0x116ba7){var _0x4a75ee=_0x5a1d90||_0x116ba7;if(_0x4a75ee){return handleError(_0x5e1fbf,0x191,_0x4a75ee);}if(!_0x24a424){return handleError(_0x5e1fbf,0x194,{'message':_0x38c7('0x2b')});}else{var _0x503f49={'payload':{'id':_0x24a424['id'],'role':_0x24a424[_0x38c7('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x38c7('0x2c')](_0x503f49)[_0x38c7('0x1f')](function(_0x28c573){_0x5e1fbf[_0x38c7('0x2d')]({'id':_0x24a424['id'],'token':_0x28c573,'statusCall':'','isAlreadyLogged':_0x24a424[_0x38c7('0x2e')]});});}})(_0x2486fa,_0x5e1fbf,_0x536b20);};passport['use'](_0x38c7('0x2a'),new LocalStrategy({'usernameField':_0x38c7('0x18'),'passwordField':'password'},function(_0xe41919,_0x5ccbc5,_0x1be301){return ActiveDirectoryAuthenticate(db[_0x38c7('0x2f')],_0xe41919,_0x5ccbc5,_0x1be301);})); \ No newline at end of file +var _0x5046=['clearBlockUser','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','password','salt','role','disabled','blocked','blockedAt','online','user','agent','then','name','add','minutes'];(function(_0x218963,_0x3e9f27){var _0x79231=function(_0x46d2f1){while(--_0x46d2f1){_0x218963['push'](_0x218963['shift']());}};_0x79231(++_0x3e9f27);}(_0x5046,0x6d));var _0x6504=function(_0x1956bb,_0x4202e8){_0x1956bb=_0x1956bb-0x0;var _0x1420bf=_0x5046[_0x1956bb];return _0x1420bf;};'use strict';var passport=require(_0x6504('0x0'));var LocalStrategy=require(_0x6504('0x1'))[_0x6504('0x2')];var moment=require(_0x6504('0x3'));var ActiveDirectory=require(_0x6504('0x4'));var BPromise=require(_0x6504('0x5'));var util=require(_0x6504('0x6'));var db=require(_0x6504('0x7'))['db'];var authService=require(_0x6504('0x8'));var utils=require(_0x6504('0x9'));var config=require('../../config/environment');var logger=require(_0x6504('0xa'))(_0x6504('0xb'));function isActiveDirectoryConfigured(_0x4ba14c){var _0x493f92=![];if(typeof _0x4ba14c[_0x6504('0xc')]!=='undefined'){_0x493f92=_0x4ba14c[_0x6504('0xc')][_0x6504('0xd')]&&_0x4ba14c[_0x6504('0xc')][_0x6504('0xe')]&&_0x4ba14c[_0x6504('0xc')][_0x6504('0xf')];}return _0x493f92;}function adAuthenticate(_0x1a24a8,_0x540f62,_0x299951){return new BPromise(function(_0x4049fa,_0x3ce219){try{var _0x75f70b=new ActiveDirectory(_0x1a24a8);_0x75f70b[_0x6504('0x10')](_0x540f62,_0x299951,function(_0x297471,_0x2abe30){if(_0x297471){logger[_0x6504('0x11')]('Error\x20authenticate\x20%s:\x20%s',_0x540f62,util['inspect'](_0x297471,{'showHidden':![],'depth':null}));_0x3ce219(_0x6504('0x12'));}else if(!_0x2abe30){logger[_0x6504('0x11')](_0x6504('0x13'),_0x540f62);_0x3ce219('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4049fa(_0x2abe30);}});}catch(_0x20575d){_0x3ce219(_0x20575d);}});}function ActiveDirectoryAuthenticate(_0x1e20c4,_0x2b199e,_0x255b57,_0x3df07c){var _0x6b9e02,_0x5b1e2d;if(!isActiveDirectoryConfigured(config)){logger[_0x6504('0x11')](_0x6504('0x14'),_0x2b199e);return _0x3df07c(null,![],{'message':_0x6504('0x12')});}return db[_0x6504('0x15')][_0x6504('0x16')]({'where':{'id':0x1},'attributes':[_0x6504('0x17'),_0x6504('0x18')],'raw':!![]})['then'](function(_0x9dd17f){_0x6b9e02=_0x9dd17f;if(!_0x6b9e02['adSsoEnabled']){logger[_0x6504('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x2b199e);throw new Error(_0x6504('0x12'));}return _0x1e20c4[_0x6504('0x16')]({'attributes':['id','name',_0x6504('0x19'),_0x6504('0x1a'),_0x6504('0x1b'),_0x6504('0x1c'),_0x6504('0x1d'),_0x6504('0x1e'),_0x6504('0x1f')],'where':{'name':_0x2b199e,'role':{'$or':['admin',_0x6504('0x20'),_0x6504('0x21')]},'adSsoEnabled':!![]}});})[_0x6504('0x22')](function(_0x3c4418){if(!_0x3c4418||_0x3c4418&&_0x3c4418[_0x6504('0x23')]!==_0x2b199e){throw new Error(_0x6504('0x12'));}_0x5b1e2d=_0x3c4418;var _0x3bc0ad=_0x5b1e2d[_0x6504('0x23')]+'@'+config[_0x6504('0xc')]['domain'];return adAuthenticate(config[_0x6504('0xc')],_0x3bc0ad,_0x255b57);})[_0x6504('0x22')](function(_0x4529f2){if(_0x5b1e2d[_0x6504('0x1c')]){throw new Error(_0x6504('0x12'));}if(_0x6b9e02[_0x6504('0x18')]>0x0){if(_0x5b1e2d[_0x6504('0x1d')]){if(moment(_0x5b1e2d[_0x6504('0x1e')])[_0x6504('0x24')](_0x6b9e02[_0x6504('0x18')],_0x6504('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x6504('0x26')](_0x5b1e2d,0x0,![],null)[_0x6504('0x22')](function(){return utils[_0x6504('0x27')](_0x5b1e2d);})[_0x6504('0x22')](function(){return _0x3df07c(null,_0x5b1e2d);});}else{return utils[_0x6504('0x27')](_0x5b1e2d)[_0x6504('0x22')](function(){return _0x3df07c(null,_0x5b1e2d);});}}else{return utils[_0x6504('0x27')](_0x5b1e2d)[_0x6504('0x22')](function(){return _0x3df07c(null,_0x5b1e2d);});}})[_0x6504('0x28')](function(_0x182107){return _0x3df07c(null,![],_0x182107);});}function handleError(_0x21cb97,_0xec27e9,_0x55f58c){return _0x21cb97[_0x6504('0x29')](_0xec27e9||0x1f4)[_0x6504('0x2a')]({'message':_0x55f58c?_0x55f58c[_0x6504('0x2b')]||_0x55f58c:''});}exports['login']=function(_0x1e1274,_0xc1a200,_0x57fc43){passport[_0x6504('0x10')](_0x6504('0x2c'),function(_0x20c4c1,_0x140856,_0x4ab2ce){var _0x4bb1e0=_0x20c4c1||_0x4ab2ce;if(_0x4bb1e0){return handleError(_0xc1a200,0x191,_0x4bb1e0);}if(!_0x140856){return handleError(_0xc1a200,0x194,{'message':_0x6504('0x2d')});}else{var _0x44afd2={'payload':{'id':_0x140856['id'],'role':_0x140856[_0x6504('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x6504('0x2e')](_0x44afd2)[_0x6504('0x22')](function(_0x30798f){_0xc1a200[_0x6504('0x2f')]({'id':_0x140856['id'],'token':_0x30798f,'statusCall':'','isAlreadyLogged':_0x140856['online']});});}})(_0x1e1274,_0xc1a200,_0x57fc43);};passport['use'](_0x6504('0x2c'),new LocalStrategy({'usernameField':_0x6504('0x23'),'passwordField':_0x6504('0x19')},function(_0x4f520a,_0x3a62e7,_0x2daa07){return ActiveDirectoryAuthenticate(db[_0x6504('0x30')],_0x4f520a,_0x3a62e7,_0x2daa07);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 57bed48..2d28b65 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 _0x6d2a=['post','login','exports','Router','./authActiveDirectory.controller'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6d2a,0xfd));var _0xa6d2=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x6d2a[_0x40be86];return _0xda3c3b;};'use strict';var express=require('express');var router=express[_0xa6d2('0x0')]();var controller=require(_0xa6d2('0x1'));router[_0xa6d2('0x2')]('/',controller[_0xa6d2('0x3')]);module[_0xa6d2('0x4')]=router; \ No newline at end of file +var _0x888d=['Router','./authActiveDirectory.controller','post','login','exports','express'];(function(_0xfa12cc,_0x3c381c){var _0x50fa77=function(_0x184a7e){while(--_0x184a7e){_0xfa12cc['push'](_0xfa12cc['shift']());}};_0x50fa77(++_0x3c381c);}(_0x888d,0xb3));var _0xd888=function(_0x59243b,_0x18ebc0){_0x59243b=_0x59243b-0x0;var _0x45758e=_0x888d[_0x59243b];return _0x45758e;};'use strict';var express=require(_0xd888('0x0'));var router=express[_0xd888('0x1')]();var controller=require(_0xd888('0x2'));router[_0xd888('0x3')]('/',controller[_0xd888('0x4')]);module[_0xd888('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4d67b14..a25f1ed 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x33b8fd,_0x5bb9e6){var _0x46bd51=function(_0x11dc50){while(--_0x11dc50){_0x33b8fd['push'](_0x33b8fd['shift']());}};_0x46bd51(++_0x5bb9e6);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x2b7d97,_0x57fd4e){_0x2b7d97=_0x2b7d97-0x0;var _0x235ab4=_0x7a54[_0x2b7d97];return _0x235ab4;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 4d0c766..2844932 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 _0x564c=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','login','get','/callback','isMiddleware','setTokenCookie','exports'];(function(_0x586a6f,_0x3956b4){var _0x211598=function(_0x5d92d5){while(--_0x5d92d5){_0x586a6f['push'](_0x586a6f['shift']());}};_0x211598(++_0x3956b4);}(_0x564c,0xe7));var _0xc564=function(_0x52be73,_0x1b4cbd){_0x52be73=_0x52be73-0x0;var _0x26f66a=_0x564c[_0x52be73];return _0x26f66a;};'use strict';var express=require(_0xc564('0x0'));var passport=require(_0xc564('0x1'));var router=express[_0xc564('0x2')]();var controller=require(_0xc564('0x3'));var userController=require(_0xc564('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller[_0xc564('0x5')]);router[_0xc564('0x6')](_0xc564('0x7'),controller['callback'],authService[_0xc564('0x8')],userController[_0xc564('0x5')],authService[_0xc564('0x9')]);module[_0xc564('0xa')]=router; \ No newline at end of file +var _0x807b=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports'];(function(_0x27af7a,_0xe18331){var _0x4ee641=function(_0x512694){while(--_0x512694){_0x27af7a['push'](_0x27af7a['shift']());}};_0x4ee641(++_0xe18331);}(_0x807b,0x1bc));var _0xb807=function(_0xc42d8a,_0x2a7950){_0xc42d8a=_0xc42d8a-0x0;var _0x1b0ab5=_0x807b[_0xc42d8a];return _0x1b0ab5;};'use strict';var express=require(_0xb807('0x0'));var passport=require(_0xb807('0x1'));var router=express[_0xb807('0x2')]();var controller=require(_0xb807('0x3'));var userController=require(_0xb807('0x4'));var authService=require(_0xb807('0x5'));router[_0xb807('0x6')]('/',controller[_0xb807('0x7')]);router['get']('/callback',controller[_0xb807('0x8')],authService[_0xb807('0x9')],userController[_0xb807('0x7')],authService[_0xb807('0xa')]);module[_0xb807('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 517da0d..d8d9de3 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 _0xd07f=['trim','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','local-login','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','http','allowedLoginAttempts','blockDuration','findOne','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','request','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing'];(function(_0x3e6e8a,_0x51847a){var _0x478af0=function(_0xa5ad58){while(--_0xa5ad58){_0x3e6e8a['push'](_0x3e6e8a['shift']());}};_0x478af0(++_0x51847a);}(_0xd07f,0x1af));var _0xfd07=function(_0x4f467a,_0x1ac0ad){_0x4f467a=_0x4f467a-0x0;var _0x1b4c6e=_0xd07f[_0x4f467a];return _0x1b4c6e;};'use strict';var util=require(_0xfd07('0x0'));var passport=require(_0xfd07('0x1'));var LocalStrategy=require(_0xfd07('0x2'))[_0xfd07('0x3')];var jayson=require(_0xfd07('0x4'));var _=require(_0xfd07('0x5'));var rs=require(_0xfd07('0x6'));var moment=require(_0xfd07('0x7'));var db=require(_0xfd07('0x8'))['db'];var authService=require(_0xfd07('0x9'));var utils=require('../../config/utils');var client=jayson[_0xfd07('0xa')][_0xfd07('0xb')]({'port':0x232b});function localAuthenticate(_0x515a0d,_0x5d4e09,_0x44eef8,_0x2bd88f){var _0x3cb555,_0x37aa75;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xfd07('0xc'),_0xfd07('0xd')],'raw':!![]})['then'](function(_0x562dd9){_0x3cb555=_0x562dd9;return _0x515a0d[_0xfd07('0xe')]({'attributes':['id',_0xfd07('0xf'),_0xfd07('0x10'),_0xfd07('0x11'),_0xfd07('0x12'),_0xfd07('0x13'),'blocked',_0xfd07('0x14'),_0xfd07('0x15')],'where':{'name':_0x5d4e09,'role':{'$or':[_0xfd07('0x16'),'user','agent']}}});})[_0xfd07('0x17')](function(_0x26a548){if(!_0x26a548||_0x26a548&&_0x26a548[_0xfd07('0xf')]!==_0x5d4e09){throw new Error(_0xfd07('0x18'));}else{_0x37aa75=_0x26a548;return _0x37aa75;}})[_0xfd07('0x17')](function(){_0x37aa75[_0xfd07('0x19')](_0x44eef8,function(_0x355d4b,_0x40e81b){var _0x2ab81b=_0x37aa75[_0xfd07('0x15')]+0x1;if(_0x355d4b){return _0x2bd88f(_0x355d4b);}else if(!_0x40e81b){if(_0x37aa75[_0xfd07('0x13')]){return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});}else if(_0x3cb555['allowedLoginAttempts']>0x0){if(_0x37aa75[_0xfd07('0x1a')]){if(_0x3cb555[_0xfd07('0xd')]>0x0){if(moment(_0x37aa75[_0xfd07('0x14')])[_0xfd07('0x1b')](_0x3cb555[_0xfd07('0xd')],_0xfd07('0x1c'))>moment()){return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});}else{return utils[_0xfd07('0x1d')](_0x37aa75,_0x2ab81b,![],null)[_0xfd07('0x17')](function(){return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});});}}else{return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});}}else{if(_0x2ab81b>=_0x3cb555['allowedLoginAttempts']){return utils[_0xfd07('0x1d')](_0x37aa75,0x0,!![],moment())[_0xfd07('0x17')](function(){return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});});}else{return utils[_0xfd07('0x1d')](_0x37aa75,_0x2ab81b,![],null)[_0xfd07('0x17')](function(){return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});});}}}else{return _0x2bd88f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x37aa75[_0xfd07('0x13')]){return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});}else if(_0x3cb555['allowedLoginAttempts']>0x0){if(_0x37aa75[_0xfd07('0x1a')]){if(_0x3cb555[_0xfd07('0xd')]>0x0){if(moment(_0x37aa75[_0xfd07('0x14')])[_0xfd07('0x1b')](_0x3cb555[_0xfd07('0xd')],_0xfd07('0x1c'))>moment()){return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});}else{return utils[_0xfd07('0x1d')](_0x37aa75,0x0,![],null)[_0xfd07('0x17')](function(){return utils[_0xfd07('0x1e')](_0x37aa75);})['then'](function(){return _0x2bd88f(null,_0x37aa75);});}}else{return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});}}else{return utils[_0xfd07('0x1d')](_0x37aa75,0x0,![],null)[_0xfd07('0x17')](function(){return utils[_0xfd07('0x1e')](_0x37aa75);})[_0xfd07('0x17')](function(){return _0x2bd88f(null,_0x37aa75);})[_0xfd07('0x1f')](function(_0x268be9){return _0x2bd88f(null,![],_0x268be9);});}}else{if(_0x37aa75['blocked']){return _0x2bd88f(null,![],{'message':_0xfd07('0x18')});}else{return utils[_0xfd07('0x1e')](_0x37aa75)[_0xfd07('0x17')](function(){return _0x2bd88f(null,_0x37aa75);});}}}});})[_0xfd07('0x1f')](function(_0x385640){return _0x2bd88f(null,![],_0x385640);});}function sendServiceMail(_0x5899f4){return db['MailAccount'][_0xfd07('0x20')]({'where':{'service':!![]},'attributes':['id',_0xfd07('0xf'),_0xfd07('0x21')],'include':[{'model':db[_0xfd07('0x22')],'as':_0xfd07('0x23'),'include':[{'model':db[_0xfd07('0x24')],'as':_0xfd07('0x24')}]}]})['then'](function(_0x3943e3){if(!_0x3943e3){throw new Error(_0xfd07('0x25'));}var _0x250453=_0x3943e3['getSmtpOptions']();var _0x23b814={'account':_0x250453,'message':_[_0xfd07('0x26')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x3943e3['name'],_0x3943e3[_0xfd07('0x21')]||_0x3943e3[_0xfd07('0x23')]['user'])},_0x5899f4)};return client[_0xfd07('0x27')]('SendMail',_0x23b814);})['then'](function(_0x4d83a9){if(_0x4d83a9['error']){throw new Error(util[_0xfd07('0x28')](_0xfd07('0x29'),_0x4d83a9[_0xfd07('0x2a')][_0xfd07('0x2b')]||JSON[_0xfd07('0x2c')](_0x4d83a9[_0xfd07('0x2a')])));}return!![];});}function handleError(_0x57051d,_0x50fd53,_0x2fa2f1){return _0x57051d[_0xfd07('0x2d')](_0x50fd53||0x1f4)[_0xfd07('0x2e')]({'message':_0x2fa2f1?_0x2fa2f1[_0xfd07('0x2b')]||_0x2fa2f1:''});}exports[_0xfd07('0x2f')]=function(_0x5727f5,_0x54f044,_0x2496fd){passport['authenticate']('local-login',function(_0x395f13,_0x2c23cf,_0x34858f){var _0x1800bc=_0x395f13||_0x34858f;if(_0x1800bc){return handleError(_0x54f044,0x191,_0x1800bc);}if(!_0x2c23cf){return handleError(_0x54f044,0x194,{'message':_0xfd07('0x30')});}else{var _0x274531={'payload':{'id':_0x2c23cf['id'],'role':_0x2c23cf['role']},'options':{'expiresIn':0x15180}};return authService[_0xfd07('0x31')](_0x274531)[_0xfd07('0x17')](function(_0x3f05dd){_0x54f044[_0xfd07('0x32')]({'id':_0x2c23cf['id'],'token':_0x3f05dd,'statusCall':'','isAlreadyLogged':_0x2c23cf[_0xfd07('0x33')]});});}})(_0x5727f5,_0x54f044,_0x2496fd);};exports[_0xfd07('0x34')]=function(_0x52b2d0,_0x21cb06){if(!_0x52b2d0[_0xfd07('0x35')][_0xfd07('0x21')]){return handleError(_0x21cb06,0x1f4,{'message':_0xfd07('0x36')});}var _0x139c76=rs['generate']();_0x52b2d0[_0xfd07('0x35')][_0xfd07('0x21')]=_0x52b2d0['body'][_0xfd07('0x21')][_0xfd07('0x37')]()['toLowerCase']();var _0x7f6772;return db[_0xfd07('0x38')][_0xfd07('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xfd07('0xd')],'raw':!![]})[_0xfd07('0x17')](function(_0x568f1a){_0x7f6772=_0x568f1a;return db[_0xfd07('0x39')][_0xfd07('0x20')]({'where':{'email':_0x52b2d0[_0xfd07('0x35')][_0xfd07('0x21')]}});})[_0xfd07('0x17')](function(_0x5b335c){if(!_0x5b335c){throw new Error(_0xfd07('0x3a'));}if(_0x5b335c[_0xfd07('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x5b335c['blocked']){if(moment(_0x5b335c[_0xfd07('0x14')])[_0xfd07('0x1b')](_0x7f6772[_0xfd07('0xd')],_0xfd07('0x1c'))>moment()){throw new Error(_0xfd07('0x3b'));}else{_0x5b335c[_0xfd07('0x1a')]=![];_0x5b335c[_0xfd07('0x14')]=null;}}_0x5b335c[_0xfd07('0x3c')]=_0x139c76;_0x5b335c[_0xfd07('0x3d')]=Date[_0xfd07('0x3e')]()+0x36ee80;return _0x5b335c[_0xfd07('0x3f')]();})[_0xfd07('0x17')](function(){return sendServiceMail({'to':_0x52b2d0[_0xfd07('0x35')]['email'],'subject':_0xfd07('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xfd07('0x41')+_0xfd07('0x42')+_0x52b2d0['headers']['host']+_0xfd07('0x43')+_0x139c76+'\x0a\x0a'+_0xfd07('0x44')});})[_0xfd07('0x17')](function(){_0x21cb06[_0xfd07('0x2d')](0xc8)[_0xfd07('0x2e')]({'message':'Reset\x20Email\x20sent!'});})[_0xfd07('0x1f')](function(_0x3cdd83){return handleError(_0x21cb06,0x1f4,_0x3cdd83);});};exports[_0xfd07('0x45')]=function(_0x3b06cd,_0x14f76a){return db[_0xfd07('0x39')][_0xfd07('0x20')]({'where':{'resetPasswordToken':_0x3b06cd[_0xfd07('0x46')][_0xfd07('0x47')],'resetPasswordExpires':{'$gt':Date[_0xfd07('0x3e')]()}}})[_0xfd07('0x17')](function(_0x83ac3b){if(!_0x83ac3b){throw new Error(_0xfd07('0x48'));}return db[_0xfd07('0x38')][_0xfd07('0xe')]({'attributes':['id',_0xfd07('0x49'),_0xfd07('0x4a'),_0xfd07('0x4b')]})[_0xfd07('0x17')](function(_0x12e452){if(_0x12e452['securePassword'])authService[_0xfd07('0x4c')](_0x3b06cd[_0xfd07('0x35')][_0xfd07('0x10')]);if(!_0x12e452[_0xfd07('0x4a')]||!_0x83ac3b[_0xfd07('0x4d')])return _0x83ac3b;authService['validatePasswordHistory'](_0x3b06cd['body'][_0xfd07('0x10')],_0x83ac3b[_0xfd07('0x4d')],_0x12e452[_0xfd07('0x4b')]);return _0x83ac3b;})['then'](function(){_0x83ac3b[_0xfd07('0x10')]=_0x3b06cd[_0xfd07('0x35')][_0xfd07('0x10')];_0x83ac3b[_0xfd07('0x3c')]=null;_0x83ac3b[_0xfd07('0x3d')]=null;return _0x83ac3b['save']();});})[_0xfd07('0x17')](function(){_0x14f76a[_0xfd07('0x2d')](0xc8)[_0xfd07('0x2e')]({'message':_0xfd07('0x4e')});})[_0xfd07('0x1f')](function(_0x98c607){return handleError(_0x14f76a,0x1f4,_0x98c607);});};passport[_0xfd07('0x4f')](_0xfd07('0x50'),new LocalStrategy({'usernameField':_0xfd07('0xf'),'passwordField':'password'},function(_0x41b10f,_0x4b3218,_0x411d70){return localAuthenticate(db['User'],_0x41b10f,_0x4b3218,_0x411d70);})); \ No newline at end of file +var _0xd4bc=['json','online','forgot','generate','body','User','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','util','passport-local','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','email','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken'];(function(_0x4fcb43,_0x2a54dc){var _0x3657ef=function(_0x479456){while(--_0x479456){_0x4fcb43['push'](_0x4fcb43['shift']());}};_0x3657ef(++_0x2a54dc);}(_0xd4bc,0x115));var _0xcd4b=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0xd4bc[_0x5f6a8a];return _0x2cce4d;};'use strict';var util=require(_0xcd4b('0x0'));var passport=require('passport');var LocalStrategy=require(_0xcd4b('0x1'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0xcd4b('0x2'));var rs=require(_0xcd4b('0x3'));var moment=require(_0xcd4b('0x4'));var db=require(_0xcd4b('0x5'))['db'];var authService=require(_0xcd4b('0x6'));var utils=require(_0xcd4b('0x7'));var client=jayson[_0xcd4b('0x8')][_0xcd4b('0x9')]({'port':0x232b});function localAuthenticate(_0x130984,_0x442205,_0x377b94,_0x3ffdfe){var _0x151a48,_0xcec9c9;return db[_0xcd4b('0xa')][_0xcd4b('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xcd4b('0xc')],'raw':!![]})[_0xcd4b('0xd')](function(_0xf8f5ef){_0x151a48=_0xf8f5ef;return _0x130984['findOne']({'attributes':['id',_0xcd4b('0xe'),_0xcd4b('0xf'),'salt','role',_0xcd4b('0x10'),_0xcd4b('0x11'),_0xcd4b('0x12'),_0xcd4b('0x13')],'where':{'name':_0x442205,'role':{'$or':[_0xcd4b('0x14'),_0xcd4b('0x15'),_0xcd4b('0x16')]}}});})[_0xcd4b('0xd')](function(_0x15994a){if(!_0x15994a||_0x15994a&&_0x15994a[_0xcd4b('0xe')]!==_0x442205){throw new Error(_0xcd4b('0x17'));}else{_0xcec9c9=_0x15994a;return _0xcec9c9;}})[_0xcd4b('0xd')](function(){_0xcec9c9['authenticate'](_0x377b94,function(_0x4c02ee,_0x46dbd3){var _0xfd169e=_0xcec9c9['loginAttempts']+0x1;if(_0x4c02ee){return _0x3ffdfe(_0x4c02ee);}else if(!_0x46dbd3){if(_0xcec9c9[_0xcd4b('0x10')]){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});}else if(_0x151a48[_0xcd4b('0x18')]>0x0){if(_0xcec9c9[_0xcd4b('0x11')]){if(_0x151a48[_0xcd4b('0xc')]>0x0){if(moment(_0xcec9c9[_0xcd4b('0x12')])['add'](_0x151a48['blockDuration'],_0xcd4b('0x19'))>moment()){return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0xcec9c9,_0xfd169e,![],null)[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});});}}else{return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xfd169e>=_0x151a48[_0xcd4b('0x18')]){return utils[_0xcd4b('0x1a')](_0xcec9c9,0x0,!![],moment())[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xcd4b('0x1a')](_0xcec9c9,_0xfd169e,![],null)[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});});}}}else{return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});}}else{if(_0xcec9c9[_0xcd4b('0x10')]){return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x151a48[_0xcd4b('0x18')]>0x0){if(_0xcec9c9[_0xcd4b('0x11')]){if(_0x151a48[_0xcd4b('0xc')]>0x0){if(moment(_0xcec9c9[_0xcd4b('0x12')])[_0xcd4b('0x1b')](_0x151a48[_0xcd4b('0xc')],_0xcd4b('0x19'))>moment()){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});}else{return utils[_0xcd4b('0x1a')](_0xcec9c9,0x0,![],null)[_0xcd4b('0xd')](function(){return utils[_0xcd4b('0x1c')](_0xcec9c9);})['then'](function(){return _0x3ffdfe(null,_0xcec9c9);});}}else{return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0xcec9c9,0x0,![],null)['then'](function(){return utils[_0xcd4b('0x1c')](_0xcec9c9);})[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,_0xcec9c9);})[_0xcd4b('0x1d')](function(_0x267d48){return _0x3ffdfe(null,![],_0x267d48);});}}else{if(_0xcec9c9[_0xcd4b('0x11')]){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});}else{return utils[_0xcd4b('0x1c')](_0xcec9c9)[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,_0xcec9c9);});}}}});})[_0xcd4b('0x1d')](function(_0x56d4bc){return _0x3ffdfe(null,![],_0x56d4bc);});}function sendServiceMail(_0x48cc14){return db[_0xcd4b('0x1e')][_0xcd4b('0x1f')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xcd4b('0x20')],'as':_0xcd4b('0x21'),'include':[{'model':db[_0xcd4b('0x22')],'as':_0xcd4b('0x22')}]}]})['then'](function(_0x11dd91){if(!_0x11dd91){throw new Error(_0xcd4b('0x23'));}var _0x394b65=_0x11dd91['getSmtpOptions']();var _0x31ac45={'account':_0x394b65,'message':_[_0xcd4b('0x24')]({'from':util['format'](_0xcd4b('0x25'),_0x11dd91['name'],_0x11dd91[_0xcd4b('0x26')]||_0x11dd91['Smtp'][_0xcd4b('0x15')])},_0x48cc14)};return client[_0xcd4b('0x27')]('SendMail',_0x31ac45);})[_0xcd4b('0xd')](function(_0x33992e){if(_0x33992e[_0xcd4b('0x28')]){throw new Error(util[_0xcd4b('0x29')](_0xcd4b('0x2a'),_0x33992e['error'][_0xcd4b('0x2b')]||JSON['stringify'](_0x33992e[_0xcd4b('0x28')])));}return!![];});}function handleError(_0x449fff,_0x1fbf94,_0x274aa9){return _0x449fff['status'](_0x1fbf94||0x1f4)[_0xcd4b('0x2c')]({'message':_0x274aa9?_0x274aa9[_0xcd4b('0x2b')]||_0x274aa9:''});}exports[_0xcd4b('0x2d')]=function(_0x2b6896,_0x565955,_0x4ac448){passport[_0xcd4b('0x2e')](_0xcd4b('0x2f'),function(_0x5707fd,_0x439c1f,_0xff7218){var _0x1e0227=_0x5707fd||_0xff7218;if(_0x1e0227){return handleError(_0x565955,0x191,_0x1e0227);}if(!_0x439c1f){return handleError(_0x565955,0x194,{'message':_0xcd4b('0x30')});}else{var _0x73f8a8={'payload':{'id':_0x439c1f['id'],'role':_0x439c1f[_0xcd4b('0x31')]},'options':{'expiresIn':0x15180}};return authService[_0xcd4b('0x32')](_0x73f8a8)[_0xcd4b('0xd')](function(_0x21c2e6){_0x565955[_0xcd4b('0x33')]({'id':_0x439c1f['id'],'token':_0x21c2e6,'statusCall':'','isAlreadyLogged':_0x439c1f[_0xcd4b('0x34')]});});}})(_0x2b6896,_0x565955,_0x4ac448);};exports[_0xcd4b('0x35')]=function(_0x432e45,_0x5e4f32){if(!_0x432e45['body'][_0xcd4b('0x26')]){return handleError(_0x5e4f32,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x2229d7=rs[_0xcd4b('0x36')]();_0x432e45['body']['email']=_0x432e45[_0xcd4b('0x37')][_0xcd4b('0x26')]['trim']()['toLowerCase']();var _0x25cd65;return db['Setting'][_0xcd4b('0xb')]({'where':{'id':0x1},'attributes':[_0xcd4b('0x18'),_0xcd4b('0xc')],'raw':!![]})['then'](function(_0x1a9581){_0x25cd65=_0x1a9581;return db[_0xcd4b('0x38')]['find']({'where':{'email':_0x432e45[_0xcd4b('0x37')]['email']}});})[_0xcd4b('0xd')](function(_0x2062ea){if(!_0x2062ea){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x2062ea[_0xcd4b('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x2062ea[_0xcd4b('0x11')]){if(moment(_0x2062ea['blockedAt'])[_0xcd4b('0x1b')](_0x25cd65[_0xcd4b('0xc')],_0xcd4b('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2062ea[_0xcd4b('0x11')]=![];_0x2062ea['blockedAt']=null;}}_0x2062ea[_0xcd4b('0x39')]=_0x2229d7;_0x2062ea[_0xcd4b('0x3a')]=Date[_0xcd4b('0x3b')]()+0x36ee80;return _0x2062ea[_0xcd4b('0x3c')]();})[_0xcd4b('0xd')](function(){return sendServiceMail({'to':_0x432e45[_0xcd4b('0x37')][_0xcd4b('0x26')],'subject':_0xcd4b('0x3d'),'text':_0xcd4b('0x3e')+_0xcd4b('0x3f')+_0xcd4b('0x40')+_0x432e45[_0xcd4b('0x41')]['host']+_0xcd4b('0x42')+_0x2229d7+'\x0a\x0a'+_0xcd4b('0x43')});})[_0xcd4b('0xd')](function(){_0x5e4f32[_0xcd4b('0x44')](0xc8)[_0xcd4b('0x2c')]({'message':_0xcd4b('0x45')});})[_0xcd4b('0x1d')](function(_0x5902d8){return handleError(_0x5e4f32,0x1f4,_0x5902d8);});};exports[_0xcd4b('0x46')]=function(_0x3a483e,_0x13d0e9){return db['User']['find']({'where':{'resetPasswordToken':_0x3a483e[_0xcd4b('0x47')][_0xcd4b('0x48')],'resetPasswordExpires':{'$gt':Date[_0xcd4b('0x3b')]()}}})[_0xcd4b('0xd')](function(_0x53ebc1){if(!_0x53ebc1){throw new Error(_0xcd4b('0x49'));}return db[_0xcd4b('0xa')][_0xcd4b('0xb')]({'attributes':['id',_0xcd4b('0x4a'),_0xcd4b('0x4b'),'passwordHistoryLimit']})[_0xcd4b('0xd')](function(_0x354cbc){if(_0x354cbc['securePassword'])authService[_0xcd4b('0x4c')](_0x3a483e[_0xcd4b('0x37')][_0xcd4b('0xf')]);if(!_0x354cbc[_0xcd4b('0x4b')]||!_0x53ebc1[_0xcd4b('0x4d')])return _0x53ebc1;authService[_0xcd4b('0x4e')](_0x3a483e[_0xcd4b('0x37')][_0xcd4b('0xf')],_0x53ebc1[_0xcd4b('0x4d')],_0x354cbc[_0xcd4b('0x4f')]);return _0x53ebc1;})[_0xcd4b('0xd')](function(){_0x53ebc1[_0xcd4b('0xf')]=_0x3a483e[_0xcd4b('0x37')][_0xcd4b('0xf')];_0x53ebc1[_0xcd4b('0x39')]=null;_0x53ebc1[_0xcd4b('0x3a')]=null;return _0x53ebc1['save']();});})['then'](function(){_0x13d0e9[_0xcd4b('0x44')](0xc8)[_0xcd4b('0x2c')]({'message':_0xcd4b('0x50')});})[_0xcd4b('0x1d')](function(_0x73f0de){return handleError(_0x13d0e9,0x1f4,_0x73f0de);});};passport[_0xcd4b('0x51')](_0xcd4b('0x2f'),new LocalStrategy({'usernameField':_0xcd4b('0xe'),'passwordField':_0xcd4b('0xf')},function(_0x48833e,_0x3cf953,_0x175c04){return localAuthenticate(db[_0xcd4b('0x38')],_0x48833e,_0x3cf953,_0x175c04);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index fbece8e..ad22667 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 _0x3b46=['post','login','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x28c83d,_0x5dee5a){var _0x13a169=function(_0x4a01aa){while(--_0x4a01aa){_0x28c83d['push'](_0x28c83d['shift']());}};_0x13a169(++_0x5dee5a);}(_0x3b46,0xdf));var _0x63b4=function(_0x2e7a43,_0x3b3df4){_0x2e7a43=_0x2e7a43-0x0;var _0x52e9e1=_0x3b46[_0x2e7a43];return _0x52e9e1;};'use strict';var express=require(_0x63b4('0x0'));var router=express[_0x63b4('0x1')]();var controller=require('./authLocal.controller');router[_0x63b4('0x2')]('/',controller[_0x63b4('0x3')]);router[_0x63b4('0x2')](_0x63b4('0x4'),controller[_0x63b4('0x5')]);router[_0x63b4('0x2')](_0x63b4('0x6'),controller[_0x63b4('0x7')]);module[_0x63b4('0x8')]=router; \ No newline at end of file +var _0x9fae=['exports','express','Router','./authLocal.controller','post','/forgot','forgot','reset'];(function(_0xeb80c9,_0x3fe888){var _0x259c37=function(_0x49478c){while(--_0x49478c){_0xeb80c9['push'](_0xeb80c9['shift']());}};_0x259c37(++_0x3fe888);}(_0x9fae,0x111));var _0xe9fa=function(_0x58ca9b,_0x378045){_0x58ca9b=_0x58ca9b-0x0;var _0x1bf38c=_0x9fae[_0x58ca9b];return _0x1bf38c;};'use strict';var express=require(_0xe9fa('0x0'));var router=express[_0xe9fa('0x1')]();var controller=require(_0xe9fa('0x2'));router[_0xe9fa('0x3')]('/',controller['login']);router['post'](_0xe9fa('0x4'),controller[_0xe9fa('0x5')]);router[_0xe9fa('0x3')]('/reset/:token',controller[_0xe9fa('0x6')]);module[_0xe9fa('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 42ef973..3158f17 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 _0x40fc=['STRING','INTEGER','sequelize','exports'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x40fc,0xf2));var _0xc40f=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0x40fc[_0x4cf0b7];return _0x545f10;};'use strict';var Sequelize=require(_0xc40f('0x0'));module[_0xc40f('0x1')]={'name':{'type':Sequelize[_0xc40f('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xc40f('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc40f('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xf182=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3350ec,_0x310200){var _0x28a0da=function(_0x278f5f){while(--_0x278f5f){_0x3350ec['push'](_0x3350ec['shift']());}};_0x28a0da(++_0x310200);}(_0xf182,0xb4));var _0x2f18=function(_0x3a7685,_0x9a8ccb){_0x3a7685=_0x3a7685-0x0;var _0x5d0aec=_0xf182[_0x3a7685];return _0x5d0aec;};'use strict';var Sequelize=require(_0x2f18('0x0'));module[_0x2f18('0x1')]={'name':{'type':Sequelize[_0x2f18('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2f18('0x2')]},'description':{'type':Sequelize[_0x2f18('0x2')]},'status':{'type':Sequelize[_0x2f18('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2f18('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 0ed8751..533027d 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 _0xa0d1=['error','stack','send','map','rawAttributes','fieldName','type','key','name','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Automation','count','includeAll','include','findAll','rows','catch','params','filters','create','body','find','destroy','addConditions','ids','omit','findOne','Condition','getConditions','addActions','getActions','Action','hasOwnProperty','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','offset','undefined','limit','set','json','reject','save','then'];(function(_0x5f1297,_0x110b10){var _0x3c9295=function(_0xe95f1d){while(--_0xe95f1d){_0x5f1297['push'](_0x5f1297['shift']());}};_0x3c9295(++_0x110b10);}(_0xa0d1,0x7a));var _0x1a0d=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xa0d1[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a0d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a0d('0x1'));var moment=require(_0x1a0d('0x2'));var BPromise=require(_0x1a0d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a0d('0x4'));var sox=require(_0x1a0d('0x5'));var csv=require(_0x1a0d('0x6'));var ejs=require(_0x1a0d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1a0d('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1a0d('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1a0d('0x9'));var authService=require('../../components/auth/service');var qs=require(_0x1a0d('0xa'));var as=require(_0x1a0d('0xb'));var hardwareService=require(_0x1a0d('0xc'));var logger=require(_0x1a0d('0xd'))('api');var utils=require(_0x1a0d('0xe'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x414297,_0x4d701e){_0x4d701e=_0x4d701e||0xcc;return function(_0x396b84){if(_0x396b84){return _0x414297[_0x1a0d('0xf')](_0x4d701e);}return _0x414297[_0x1a0d('0x10')](_0x4d701e)[_0x1a0d('0x11')]();};}function respondWithResult(_0x3cebad,_0x57f2bd){_0x57f2bd=_0x57f2bd||0xc8;return function(_0x2d6743){if(_0x2d6743){return _0x3cebad[_0x1a0d('0x10')](_0x57f2bd)['json'](_0x2d6743);}};}function respondWithFilteredResult(_0x4387ae,_0x463a89){return function(_0xb9749f){if(_0xb9749f){var _0x4e064e=typeof _0x463a89[_0x1a0d('0x12')]===_0x1a0d('0x13')&&typeof _0x463a89[_0x1a0d('0x14')]===_0x1a0d('0x13');var _0x22b5a1=_0xb9749f['count'];var _0x588700=_0x4e064e?0x0:_0x463a89[_0x1a0d('0x12')];var _0x56dfdd=_0x4e064e?_0xb9749f['count']:_0x463a89[_0x1a0d('0x12')]+_0x463a89[_0x1a0d('0x14')];var _0x55798d;if(_0x56dfdd>=_0x22b5a1){_0x56dfdd=_0x22b5a1;_0x55798d=0xc8;}else{_0x55798d=0xce;}_0x4387ae[_0x1a0d('0x10')](_0x55798d);return _0x4387ae[_0x1a0d('0x15')]('Content-Range',_0x588700+'-'+_0x56dfdd+'/'+_0x22b5a1)[_0x1a0d('0x16')](_0xb9749f);}return null;};}function patchUpdates(_0x4bb126){return function(_0x1e7157){try{jsonpatch['apply'](_0x1e7157,_0x4bb126,!![]);}catch(_0x6007f){return BPromise[_0x1a0d('0x17')](_0x6007f);}return _0x1e7157[_0x1a0d('0x18')]();};}function saveUpdates(_0x5440b1,_0x908e2c){return function(_0x212a78){if(_0x212a78){return _0x212a78['update'](_0x5440b1)[_0x1a0d('0x19')](function(_0x371240){return _0x371240;});}return null;};}function removeEntity(_0x1833ff,_0x3c15d5){return function(_0x46beb5){if(_0x46beb5){return _0x46beb5['destroy']()[_0x1a0d('0x19')](function(){_0x1833ff[_0x1a0d('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17425c,_0x4600f0){return function(_0xec72c8){if(!_0xec72c8){_0x17425c[_0x1a0d('0xf')](0x194);}return _0xec72c8;};}function handleError(_0x142c11,_0x473eb7){_0x473eb7=_0x473eb7||0x1f4;return function(_0x22adb1){logger[_0x1a0d('0x1a')](_0x22adb1[_0x1a0d('0x1b')]);if(_0x22adb1['name']){delete _0x22adb1['name'];}_0x142c11[_0x1a0d('0x10')](_0x473eb7)[_0x1a0d('0x1c')](_0x22adb1);};}exports['index']=function(_0x31d3d3,_0x3caa09){var _0x302d2d={},_0x8f48d1={},_0x5ca6ad={'count':0x0,'rows':[]};var _0x28fdc1=_[_0x1a0d('0x1d')](db['Automation'][_0x1a0d('0x1e')],function(_0xc38c68){return{'name':_0xc38c68[_0x1a0d('0x1f')],'type':_0xc38c68[_0x1a0d('0x20')][_0x1a0d('0x21')]};});_0x8f48d1['model']=_[_0x1a0d('0x1d')](_0x28fdc1,_0x1a0d('0x22'));_0x8f48d1[_0x1a0d('0x23')]=_[_0x1a0d('0x24')](_0x31d3d3[_0x1a0d('0x23')]);_0x8f48d1['filters']=_[_0x1a0d('0x25')](_0x8f48d1['model'],_0x8f48d1[_0x1a0d('0x23')]);_0x302d2d[_0x1a0d('0x26')]=_['intersection'](_0x8f48d1[_0x1a0d('0x27')],qs[_0x1a0d('0x28')](_0x31d3d3[_0x1a0d('0x23')]['fields']));_0x302d2d['attributes']=_0x302d2d[_0x1a0d('0x26')][_0x1a0d('0x29')]?_0x302d2d[_0x1a0d('0x26')]:_0x8f48d1[_0x1a0d('0x27')];if(!_0x31d3d3[_0x1a0d('0x23')]['hasOwnProperty'](_0x1a0d('0x2a'))){_0x302d2d[_0x1a0d('0x14')]=qs[_0x1a0d('0x14')](_0x31d3d3['query'][_0x1a0d('0x14')]);_0x302d2d[_0x1a0d('0x12')]=qs[_0x1a0d('0x12')](_0x31d3d3[_0x1a0d('0x23')]['offset']);}_0x302d2d[_0x1a0d('0x2b')]=qs['sort'](_0x31d3d3[_0x1a0d('0x23')][_0x1a0d('0x2c')]);_0x302d2d[_0x1a0d('0x2d')]=qs['filters'](_[_0x1a0d('0x2e')](_0x31d3d3[_0x1a0d('0x23')],_0x8f48d1['filters']),_0x28fdc1);if(_0x31d3d3[_0x1a0d('0x23')][_0x1a0d('0x2f')]){_0x302d2d[_0x1a0d('0x2d')]=_['merge'](_0x302d2d['where'],{'$or':_[_0x1a0d('0x1d')](_0x28fdc1,function(_0x4cf307){if(_0x4cf307['type']!==_0x1a0d('0x30')){var _0x4bfd15={};_0x4bfd15[_0x4cf307['name']]={'$like':'%'+_0x31d3d3['query']['filter']+'%'};return _0x4bfd15;}})});}_0x302d2d=_[_0x1a0d('0x31')]({},_0x302d2d,_0x31d3d3[_0x1a0d('0x32')]);var _0x2524e0={'where':_0x302d2d['where']};return db[_0x1a0d('0x33')][_0x1a0d('0x34')](_0x2524e0)[_0x1a0d('0x19')](function(_0x2e755b){_0x5ca6ad[_0x1a0d('0x34')]=_0x2e755b;if(_0x31d3d3[_0x1a0d('0x23')][_0x1a0d('0x35')]){_0x302d2d[_0x1a0d('0x36')]=[{'all':!![]}];}return db[_0x1a0d('0x33')][_0x1a0d('0x37')](_0x302d2d);})['then'](function(_0x4dd2c3){_0x5ca6ad[_0x1a0d('0x38')]=_0x4dd2c3;return _0x5ca6ad;})[_0x1a0d('0x19')](respondWithFilteredResult(_0x3caa09,_0x302d2d))[_0x1a0d('0x39')](handleError(_0x3caa09,null));};exports['show']=function(_0x25ae1f,_0x5d9769){var _0x1395a5={'raw':![],'where':{'id':_0x25ae1f[_0x1a0d('0x3a')]['id']}},_0x385775={};_0x385775['model']=_[_0x1a0d('0x24')](db[_0x1a0d('0x33')]['rawAttributes']);_0x385775[_0x1a0d('0x23')]=_['keys'](_0x25ae1f[_0x1a0d('0x23')]);_0x385775[_0x1a0d('0x3b')]=_['intersection'](_0x385775[_0x1a0d('0x27')],_0x385775[_0x1a0d('0x23')]);_0x1395a5['attributes']=_[_0x1a0d('0x25')](_0x385775['model'],qs[_0x1a0d('0x28')](_0x25ae1f[_0x1a0d('0x23')]['fields']));_0x1395a5[_0x1a0d('0x26')]=_0x1395a5['attributes'][_0x1a0d('0x29')]?_0x1395a5[_0x1a0d('0x26')]:_0x385775[_0x1a0d('0x27')];if(_0x25ae1f['query'][_0x1a0d('0x35')]){_0x1395a5[_0x1a0d('0x36')]=[{'all':!![]}];}_0x1395a5=_[_0x1a0d('0x31')]({},_0x1395a5,_0x25ae1f[_0x1a0d('0x32')]);return db[_0x1a0d('0x33')]['find'](_0x1395a5)[_0x1a0d('0x19')](handleEntityNotFound(_0x5d9769,null))[_0x1a0d('0x19')](respondWithResult(_0x5d9769,null))['catch'](handleError(_0x5d9769,null));};exports[_0x1a0d('0x3c')]=function(_0x1a82b0,_0x27ad3d){return db['Automation']['create'](_0x1a82b0[_0x1a0d('0x3d')],{})[_0x1a0d('0x19')](respondWithResult(_0x27ad3d,0xc9))[_0x1a0d('0x39')](handleError(_0x27ad3d,null));};exports['update']=function(_0x4360a7,_0x1fe542){if(_0x4360a7['body']['id']){delete _0x4360a7['body']['id'];}return db[_0x1a0d('0x33')][_0x1a0d('0x3e')]({'where':{'id':_0x4360a7[_0x1a0d('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1fe542,null))[_0x1a0d('0x19')](saveUpdates(_0x4360a7[_0x1a0d('0x3d')],null))[_0x1a0d('0x19')](respondWithResult(_0x1fe542,null))['catch'](handleError(_0x1fe542,null));};exports[_0x1a0d('0x3f')]=function(_0x20603e,_0x43e488){return db[_0x1a0d('0x33')][_0x1a0d('0x3e')]({'where':{'id':_0x20603e[_0x1a0d('0x3a')]['id']}})['then'](handleEntityNotFound(_0x43e488,null))[_0x1a0d('0x19')](removeEntity(_0x43e488,null))[_0x1a0d('0x39')](handleError(_0x43e488,null));};exports[_0x1a0d('0x40')]=function(_0x55eb93,_0x1cba84,_0x4d8a30){return db['Condition']['find']({'where':{'id':_0x55eb93['params']['id']}})['then'](handleEntityNotFound(_0x1cba84,null))[_0x1a0d('0x19')](function(_0xc1f712){if(_0xc1f712){return _0xc1f712['addConditions'](_0x55eb93['body'][_0x1a0d('0x41')],_[_0x1a0d('0x42')](_0x55eb93[_0x1a0d('0x3d')],['ids','id'])||{});}})['then'](respondWithResult(_0x1cba84,null))[_0x1a0d('0x39')](handleError(_0x1cba84,null));};exports['getConditions']=function(_0x51bbe6,_0x4ce1b4,_0x1efb5a){var _0x468ef1={};var _0x5a0e12={};var _0x15c991;var _0x41eb9e;return db[_0x1a0d('0x33')][_0x1a0d('0x43')]({'where':{'id':_0x51bbe6[_0x1a0d('0x3a')]['id']}})[_0x1a0d('0x19')](handleEntityNotFound(_0x4ce1b4,null))[_0x1a0d('0x19')](function(_0x43b179){if(_0x43b179){_0x15c991=_0x43b179;_0x5a0e12[_0x1a0d('0x27')]=_['keys'](db[_0x1a0d('0x44')][_0x1a0d('0x1e')]);_0x5a0e12[_0x1a0d('0x23')]=_[_0x1a0d('0x24')](_0x51bbe6[_0x1a0d('0x23')]);_0x5a0e12[_0x1a0d('0x3b')]=_['intersection'](_0x5a0e12['model'],_0x5a0e12['query']);_0x468ef1[_0x1a0d('0x26')]=_['intersection'](_0x5a0e12[_0x1a0d('0x27')],qs[_0x1a0d('0x28')](_0x51bbe6[_0x1a0d('0x23')]['fields']));_0x468ef1[_0x1a0d('0x26')]=_0x468ef1['attributes'][_0x1a0d('0x29')]?_0x468ef1[_0x1a0d('0x26')]:_0x5a0e12['model'];_0x468ef1[_0x1a0d('0x2b')]=qs[_0x1a0d('0x2c')](_0x51bbe6[_0x1a0d('0x23')][_0x1a0d('0x2c')]);_0x468ef1[_0x1a0d('0x2d')]=qs['filters'](_[_0x1a0d('0x2e')](_0x51bbe6[_0x1a0d('0x23')],_0x5a0e12[_0x1a0d('0x3b')]));if(_0x51bbe6[_0x1a0d('0x23')][_0x1a0d('0x2f')]){_0x468ef1[_0x1a0d('0x2d')]=_[_0x1a0d('0x31')](_0x468ef1[_0x1a0d('0x2d')],{'$or':_[_0x1a0d('0x1d')](_0x468ef1[_0x1a0d('0x26')],function(_0x10d1d7){var _0x5bca04={};_0x5bca04[_0x10d1d7]={'$like':'%'+_0x51bbe6[_0x1a0d('0x23')][_0x1a0d('0x2f')]+'%'};return _0x5bca04;})});}_0x468ef1=_[_0x1a0d('0x31')]({},_0x468ef1,_0x51bbe6[_0x1a0d('0x32')]);return _0x15c991[_0x1a0d('0x45')](_0x468ef1);}})[_0x1a0d('0x19')](function(_0x4a2fd1){if(_0x4a2fd1){_0x41eb9e=_0x4a2fd1['length'];if(!_0x51bbe6[_0x1a0d('0x23')]['hasOwnProperty']('nolimit')){_0x468ef1[_0x1a0d('0x14')]=qs['limit'](_0x51bbe6[_0x1a0d('0x23')]['limit']);_0x468ef1[_0x1a0d('0x12')]=qs[_0x1a0d('0x12')](_0x51bbe6[_0x1a0d('0x23')][_0x1a0d('0x12')]);}return _0x15c991[_0x1a0d('0x45')](_0x468ef1);}})[_0x1a0d('0x19')](function(_0x351a86){if(_0x351a86){return _0x351a86?{'count':_0x41eb9e,'rows':_0x351a86}:null;}})[_0x1a0d('0x19')](respondWithResult(_0x4ce1b4,null))[_0x1a0d('0x39')](handleError(_0x4ce1b4,null));};exports[_0x1a0d('0x46')]=function(_0x21e388,_0x5aab56,_0x5f50a9){return db['Action'][_0x1a0d('0x3e')]({'where':{'id':_0x21e388[_0x1a0d('0x3a')]['id']}})[_0x1a0d('0x19')](handleEntityNotFound(_0x5aab56,null))[_0x1a0d('0x19')](function(_0x325612){if(_0x325612){return _0x325612[_0x1a0d('0x46')](_0x21e388[_0x1a0d('0x3d')][_0x1a0d('0x41')],_[_0x1a0d('0x42')](_0x21e388[_0x1a0d('0x3d')],[_0x1a0d('0x41'),'id'])||{});}})[_0x1a0d('0x19')](respondWithResult(_0x5aab56,null))[_0x1a0d('0x39')](handleError(_0x5aab56,null));};exports[_0x1a0d('0x47')]=function(_0x5dfdce,_0x3b6d2e,_0x38b904){var _0x36a5fc={};var _0x4c0df5={};var _0x2d30eb;var _0x25c1f3;return db[_0x1a0d('0x33')][_0x1a0d('0x43')]({'where':{'id':_0x5dfdce['params']['id']}})[_0x1a0d('0x19')](handleEntityNotFound(_0x3b6d2e,null))[_0x1a0d('0x19')](function(_0x2acaea){if(_0x2acaea){_0x2d30eb=_0x2acaea;_0x4c0df5[_0x1a0d('0x27')]=_[_0x1a0d('0x24')](db[_0x1a0d('0x48')][_0x1a0d('0x1e')]);_0x4c0df5[_0x1a0d('0x23')]=_['keys'](_0x5dfdce[_0x1a0d('0x23')]);_0x4c0df5[_0x1a0d('0x3b')]=_[_0x1a0d('0x25')](_0x4c0df5[_0x1a0d('0x27')],_0x4c0df5[_0x1a0d('0x23')]);_0x36a5fc[_0x1a0d('0x26')]=_['intersection'](_0x4c0df5[_0x1a0d('0x27')],qs['fields'](_0x5dfdce[_0x1a0d('0x23')][_0x1a0d('0x28')]));_0x36a5fc[_0x1a0d('0x26')]=_0x36a5fc[_0x1a0d('0x26')]['length']?_0x36a5fc[_0x1a0d('0x26')]:_0x4c0df5['model'];_0x36a5fc[_0x1a0d('0x2b')]=qs[_0x1a0d('0x2c')](_0x5dfdce['query'][_0x1a0d('0x2c')]);_0x36a5fc[_0x1a0d('0x2d')]=qs[_0x1a0d('0x3b')](_['pick'](_0x5dfdce['query'],_0x4c0df5[_0x1a0d('0x3b')]));if(_0x5dfdce[_0x1a0d('0x23')]['filter']){_0x36a5fc[_0x1a0d('0x2d')]=_['merge'](_0x36a5fc[_0x1a0d('0x2d')],{'$or':_[_0x1a0d('0x1d')](_0x36a5fc['attributes'],function(_0x5447a1){var _0xd6df3d={};_0xd6df3d[_0x5447a1]={'$like':'%'+_0x5dfdce[_0x1a0d('0x23')][_0x1a0d('0x2f')]+'%'};return _0xd6df3d;})});}_0x36a5fc=_[_0x1a0d('0x31')]({},_0x36a5fc,_0x5dfdce[_0x1a0d('0x32')]);return _0x2d30eb['getActions'](_0x36a5fc);}})[_0x1a0d('0x19')](function(_0x327a72){if(_0x327a72){_0x25c1f3=_0x327a72[_0x1a0d('0x29')];if(!_0x5dfdce[_0x1a0d('0x23')][_0x1a0d('0x49')](_0x1a0d('0x2a'))){_0x36a5fc[_0x1a0d('0x14')]=qs[_0x1a0d('0x14')](_0x5dfdce[_0x1a0d('0x23')][_0x1a0d('0x14')]);_0x36a5fc[_0x1a0d('0x12')]=qs[_0x1a0d('0x12')](_0x5dfdce[_0x1a0d('0x23')][_0x1a0d('0x12')]);}return _0x2d30eb[_0x1a0d('0x47')](_0x36a5fc);}})[_0x1a0d('0x19')](function(_0x6893ec){if(_0x6893ec){return _0x6893ec?{'count':_0x25c1f3,'rows':_0x6893ec}:null;}})['then'](respondWithResult(_0x3b6d2e,null))[_0x1a0d('0x39')](handleError(_0x3b6d2e,null));}; \ No newline at end of file +var _0x97c8=['name','send','map','Automation','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','length','attributes','order','sort','pick','filter','where','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','find','body','Condition','ids','omit','getConditions','findOne','hasOwnProperty','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','error','stack'];(function(_0x4e35a2,_0x4bd134){var _0x24def6=function(_0x2bb4bd){while(--_0x2bb4bd){_0x4e35a2['push'](_0x4e35a2['shift']());}};_0x24def6(++_0x4bd134);}(_0x97c8,0x79));var _0x897c=function(_0x549fb4,_0x57140c){_0x549fb4=_0x549fb4-0x0;var _0xc64c37=_0x97c8[_0x549fb4];return _0xc64c37;};'use strict';var emlformat=require(_0x897c('0x0'));var rimraf=require(_0x897c('0x1'));var zipdir=require(_0x897c('0x2'));var jsonpatch=require(_0x897c('0x3'));var rp=require(_0x897c('0x4'));var moment=require(_0x897c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x897c('0x6'));var path=require(_0x897c('0x7'));var sox=require('sox');var csv=require(_0x897c('0x8'));var ejs=require(_0x897c('0x9'));var fs=require('fs');var fs_extra=require(_0x897c('0xa'));var _=require(_0x897c('0xb'));var squel=require(_0x897c('0xc'));var crypto=require(_0x897c('0xd'));var jsforce=require(_0x897c('0xe'));var deskjs=require(_0x897c('0xf'));var toCsv=require(_0x897c('0x8'));var querystring=require(_0x897c('0x10'));var Papa=require(_0x897c('0x11'));var Redis=require(_0x897c('0x12'));var authService=require(_0x897c('0x13'));var qs=require(_0x897c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x897c('0x15'))('api');var utils=require(_0x897c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x897c('0x17'))['db'];function respondWithStatusCode(_0x2fd3b7,_0x449b06){_0x449b06=_0x449b06||0xcc;return function(_0x38a5a3){if(_0x38a5a3){return _0x2fd3b7[_0x897c('0x18')](_0x449b06);}return _0x2fd3b7['status'](_0x449b06)['end']();};}function respondWithResult(_0x5d8ff7,_0x36eacb){_0x36eacb=_0x36eacb||0xc8;return function(_0x533145){if(_0x533145){return _0x5d8ff7[_0x897c('0x19')](_0x36eacb)[_0x897c('0x1a')](_0x533145);}};}function respondWithFilteredResult(_0x54c3e0,_0xcd1209){return function(_0x549ed5){if(_0x549ed5){var _0x570b31=typeof _0xcd1209['offset']===_0x897c('0x1b')&&typeof _0xcd1209[_0x897c('0x1c')]==='undefined';var _0x47c015=_0x549ed5[_0x897c('0x1d')];var _0x5399f6=_0x570b31?0x0:_0xcd1209[_0x897c('0x1e')];var _0x40c3e3=_0x570b31?_0x549ed5[_0x897c('0x1d')]:_0xcd1209['offset']+_0xcd1209['limit'];var _0x273afa;if(_0x40c3e3>=_0x47c015){_0x40c3e3=_0x47c015;_0x273afa=0xc8;}else{_0x273afa=0xce;}_0x54c3e0[_0x897c('0x19')](_0x273afa);return _0x54c3e0[_0x897c('0x1f')](_0x897c('0x20'),_0x5399f6+'-'+_0x40c3e3+'/'+_0x47c015)[_0x897c('0x1a')](_0x549ed5);}return null;};}function patchUpdates(_0x1e9872){return function(_0x328b4f){try{jsonpatch['apply'](_0x328b4f,_0x1e9872,!![]);}catch(_0x5b76bb){return BPromise[_0x897c('0x21')](_0x5b76bb);}return _0x328b4f[_0x897c('0x22')]();};}function saveUpdates(_0x23a8f2,_0x4aed8f){return function(_0x4245e4){if(_0x4245e4){return _0x4245e4[_0x897c('0x23')](_0x23a8f2)['then'](function(_0x389e00){return _0x389e00;});}return null;};}function removeEntity(_0x3ba0e1,_0x170895){return function(_0xf1058e){if(_0xf1058e){return _0xf1058e[_0x897c('0x24')]()['then'](function(){_0x3ba0e1[_0x897c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1547ae,_0x1386e8){return function(_0x49bc8e){if(!_0x49bc8e){_0x1547ae['sendStatus'](0x194);}return _0x49bc8e;};}function handleError(_0x235dc2,_0x244628){_0x244628=_0x244628||0x1f4;return function(_0x4f69f3){logger[_0x897c('0x25')](_0x4f69f3[_0x897c('0x26')]);if(_0x4f69f3['name']){delete _0x4f69f3[_0x897c('0x27')];}_0x235dc2[_0x897c('0x19')](_0x244628)[_0x897c('0x28')](_0x4f69f3);};}exports['index']=function(_0x1ad1b2,_0x1b5faf){var _0x1cd783={},_0xecbef3={},_0x495ac8={'count':0x0,'rows':[]};var _0x545578=_[_0x897c('0x29')](db[_0x897c('0x2a')][_0x897c('0x2b')],function(_0x7efd3f){return{'name':_0x7efd3f[_0x897c('0x2c')],'type':_0x7efd3f[_0x897c('0x2d')]['key']};});_0xecbef3['model']=_['map'](_0x545578,_0x897c('0x27'));_0xecbef3[_0x897c('0x2e')]=_[_0x897c('0x2f')](_0x1ad1b2[_0x897c('0x2e')]);_0xecbef3[_0x897c('0x30')]=_[_0x897c('0x31')](_0xecbef3[_0x897c('0x32')],_0xecbef3[_0x897c('0x2e')]);_0x1cd783['attributes']=_['intersection'](_0xecbef3[_0x897c('0x32')],qs[_0x897c('0x33')](_0x1ad1b2[_0x897c('0x2e')]['fields']));_0x1cd783['attributes']=_0x1cd783['attributes'][_0x897c('0x34')]?_0x1cd783[_0x897c('0x35')]:_0xecbef3[_0x897c('0x32')];if(!_0x1ad1b2[_0x897c('0x2e')]['hasOwnProperty']('nolimit')){_0x1cd783[_0x897c('0x1c')]=qs[_0x897c('0x1c')](_0x1ad1b2[_0x897c('0x2e')]['limit']);_0x1cd783[_0x897c('0x1e')]=qs[_0x897c('0x1e')](_0x1ad1b2[_0x897c('0x2e')][_0x897c('0x1e')]);}_0x1cd783[_0x897c('0x36')]=qs['sort'](_0x1ad1b2[_0x897c('0x2e')][_0x897c('0x37')]);_0x1cd783['where']=qs[_0x897c('0x30')](_[_0x897c('0x38')](_0x1ad1b2['query'],_0xecbef3[_0x897c('0x30')]),_0x545578);if(_0x1ad1b2[_0x897c('0x2e')][_0x897c('0x39')]){_0x1cd783[_0x897c('0x3a')]=_[_0x897c('0x3b')](_0x1cd783[_0x897c('0x3a')],{'$or':_['map'](_0x545578,function(_0x352fe3){if(_0x352fe3['type']!==_0x897c('0x3c')){var _0x1aeb4d={};_0x1aeb4d[_0x352fe3[_0x897c('0x27')]]={'$like':'%'+_0x1ad1b2[_0x897c('0x2e')][_0x897c('0x39')]+'%'};return _0x1aeb4d;}})});}_0x1cd783=_['merge']({},_0x1cd783,_0x1ad1b2[_0x897c('0x3d')]);var _0x1a6391={'where':_0x1cd783[_0x897c('0x3a')]};return db[_0x897c('0x2a')][_0x897c('0x1d')](_0x1a6391)[_0x897c('0x3e')](function(_0x3aea5c){_0x495ac8['count']=_0x3aea5c;if(_0x1ad1b2[_0x897c('0x2e')]['includeAll']){_0x1cd783[_0x897c('0x3f')]=[{'all':!![]}];}return db[_0x897c('0x2a')][_0x897c('0x40')](_0x1cd783);})[_0x897c('0x3e')](function(_0x18e99c){_0x495ac8[_0x897c('0x41')]=_0x18e99c;return _0x495ac8;})['then'](respondWithFilteredResult(_0x1b5faf,_0x1cd783))[_0x897c('0x42')](handleError(_0x1b5faf,null));};exports['show']=function(_0x2977f7,_0x161cbb){var _0x2f42ac={'raw':![],'where':{'id':_0x2977f7[_0x897c('0x43')]['id']}},_0x5c00f1={};_0x5c00f1[_0x897c('0x32')]=_[_0x897c('0x2f')](db[_0x897c('0x2a')][_0x897c('0x2b')]);_0x5c00f1[_0x897c('0x2e')]=_['keys'](_0x2977f7['query']);_0x5c00f1[_0x897c('0x30')]=_[_0x897c('0x31')](_0x5c00f1[_0x897c('0x32')],_0x5c00f1[_0x897c('0x2e')]);_0x2f42ac['attributes']=_['intersection'](_0x5c00f1[_0x897c('0x32')],qs[_0x897c('0x33')](_0x2977f7[_0x897c('0x2e')][_0x897c('0x33')]));_0x2f42ac[_0x897c('0x35')]=_0x2f42ac[_0x897c('0x35')][_0x897c('0x34')]?_0x2f42ac[_0x897c('0x35')]:_0x5c00f1['model'];if(_0x2977f7['query']['includeAll']){_0x2f42ac['include']=[{'all':!![]}];}_0x2f42ac=_[_0x897c('0x3b')]({},_0x2f42ac,_0x2977f7['options']);return db[_0x897c('0x2a')][_0x897c('0x44')](_0x2f42ac)[_0x897c('0x3e')](handleEntityNotFound(_0x161cbb,null))[_0x897c('0x3e')](respondWithResult(_0x161cbb,null))['catch'](handleError(_0x161cbb,null));};exports['create']=function(_0x8c4719,_0x44940d){return db[_0x897c('0x2a')]['create'](_0x8c4719[_0x897c('0x45')],{})[_0x897c('0x3e')](respondWithResult(_0x44940d,0xc9))[_0x897c('0x42')](handleError(_0x44940d,null));};exports[_0x897c('0x23')]=function(_0x3e8a32,_0x31eb86){if(_0x3e8a32['body']['id']){delete _0x3e8a32['body']['id'];}return db[_0x897c('0x2a')][_0x897c('0x44')]({'where':{'id':_0x3e8a32[_0x897c('0x43')]['id']}})[_0x897c('0x3e')](handleEntityNotFound(_0x31eb86,null))[_0x897c('0x3e')](saveUpdates(_0x3e8a32[_0x897c('0x45')],null))['then'](respondWithResult(_0x31eb86,null))['catch'](handleError(_0x31eb86,null));};exports[_0x897c('0x24')]=function(_0x33be07,_0x50d9e4){return db['Automation'][_0x897c('0x44')]({'where':{'id':_0x33be07['params']['id']}})[_0x897c('0x3e')](handleEntityNotFound(_0x50d9e4,null))['then'](removeEntity(_0x50d9e4,null))[_0x897c('0x42')](handleError(_0x50d9e4,null));};exports['addConditions']=function(_0x3d947a,_0x41570a,_0x2ca258){return db[_0x897c('0x46')][_0x897c('0x44')]({'where':{'id':_0x3d947a[_0x897c('0x43')]['id']}})[_0x897c('0x3e')](handleEntityNotFound(_0x41570a,null))[_0x897c('0x3e')](function(_0xcc5dc9){if(_0xcc5dc9){return _0xcc5dc9['addConditions'](_0x3d947a[_0x897c('0x45')][_0x897c('0x47')],_[_0x897c('0x48')](_0x3d947a[_0x897c('0x45')],[_0x897c('0x47'),'id'])||{});}})[_0x897c('0x3e')](respondWithResult(_0x41570a,null))['catch'](handleError(_0x41570a,null));};exports[_0x897c('0x49')]=function(_0xd3c64d,_0x26dd0b,_0x5069e8){var _0x3a2c0a={};var _0x4a4e7d={};var _0x3d58c5;var _0x343b81;return db[_0x897c('0x2a')][_0x897c('0x4a')]({'where':{'id':_0xd3c64d[_0x897c('0x43')]['id']}})['then'](handleEntityNotFound(_0x26dd0b,null))[_0x897c('0x3e')](function(_0x161f1c){if(_0x161f1c){_0x3d58c5=_0x161f1c;_0x4a4e7d[_0x897c('0x32')]=_['keys'](db[_0x897c('0x46')][_0x897c('0x2b')]);_0x4a4e7d[_0x897c('0x2e')]=_[_0x897c('0x2f')](_0xd3c64d[_0x897c('0x2e')]);_0x4a4e7d['filters']=_[_0x897c('0x31')](_0x4a4e7d[_0x897c('0x32')],_0x4a4e7d[_0x897c('0x2e')]);_0x3a2c0a[_0x897c('0x35')]=_['intersection'](_0x4a4e7d[_0x897c('0x32')],qs[_0x897c('0x33')](_0xd3c64d[_0x897c('0x2e')]['fields']));_0x3a2c0a[_0x897c('0x35')]=_0x3a2c0a[_0x897c('0x35')][_0x897c('0x34')]?_0x3a2c0a[_0x897c('0x35')]:_0x4a4e7d[_0x897c('0x32')];_0x3a2c0a[_0x897c('0x36')]=qs[_0x897c('0x37')](_0xd3c64d[_0x897c('0x2e')][_0x897c('0x37')]);_0x3a2c0a[_0x897c('0x3a')]=qs[_0x897c('0x30')](_[_0x897c('0x38')](_0xd3c64d[_0x897c('0x2e')],_0x4a4e7d[_0x897c('0x30')]));if(_0xd3c64d[_0x897c('0x2e')]['filter']){_0x3a2c0a[_0x897c('0x3a')]=_[_0x897c('0x3b')](_0x3a2c0a['where'],{'$or':_[_0x897c('0x29')](_0x3a2c0a[_0x897c('0x35')],function(_0x27ac43){var _0x526a11={};_0x526a11[_0x27ac43]={'$like':'%'+_0xd3c64d[_0x897c('0x2e')][_0x897c('0x39')]+'%'};return _0x526a11;})});}_0x3a2c0a=_[_0x897c('0x3b')]({},_0x3a2c0a,_0xd3c64d[_0x897c('0x3d')]);return _0x3d58c5[_0x897c('0x49')](_0x3a2c0a);}})[_0x897c('0x3e')](function(_0x11894c){if(_0x11894c){_0x343b81=_0x11894c[_0x897c('0x34')];if(!_0xd3c64d[_0x897c('0x2e')][_0x897c('0x4b')](_0x897c('0x4c'))){_0x3a2c0a[_0x897c('0x1c')]=qs['limit'](_0xd3c64d[_0x897c('0x2e')][_0x897c('0x1c')]);_0x3a2c0a[_0x897c('0x1e')]=qs['offset'](_0xd3c64d[_0x897c('0x2e')][_0x897c('0x1e')]);}return _0x3d58c5[_0x897c('0x49')](_0x3a2c0a);}})[_0x897c('0x3e')](function(_0x2b6083){if(_0x2b6083){return _0x2b6083?{'count':_0x343b81,'rows':_0x2b6083}:null;}})['then'](respondWithResult(_0x26dd0b,null))[_0x897c('0x42')](handleError(_0x26dd0b,null));};exports[_0x897c('0x4d')]=function(_0xef07ca,_0x474b31,_0x21ac53){return db[_0x897c('0x4e')]['find']({'where':{'id':_0xef07ca[_0x897c('0x43')]['id']}})['then'](handleEntityNotFound(_0x474b31,null))['then'](function(_0x45472f){if(_0x45472f){return _0x45472f[_0x897c('0x4d')](_0xef07ca[_0x897c('0x45')][_0x897c('0x47')],_['omit'](_0xef07ca['body'],[_0x897c('0x47'),'id'])||{});}})['then'](respondWithResult(_0x474b31,null))[_0x897c('0x42')](handleError(_0x474b31,null));};exports['getActions']=function(_0x9122e6,_0x36c643,_0xf12eab){var _0x2b8a98={};var _0x348066={};var _0x3ed6f6;var _0x31274a;return db['Automation'][_0x897c('0x4a')]({'where':{'id':_0x9122e6[_0x897c('0x43')]['id']}})[_0x897c('0x3e')](handleEntityNotFound(_0x36c643,null))[_0x897c('0x3e')](function(_0x2a93dc){if(_0x2a93dc){_0x3ed6f6=_0x2a93dc;_0x348066[_0x897c('0x32')]=_[_0x897c('0x2f')](db[_0x897c('0x4e')][_0x897c('0x2b')]);_0x348066[_0x897c('0x2e')]=_[_0x897c('0x2f')](_0x9122e6['query']);_0x348066[_0x897c('0x30')]=_['intersection'](_0x348066[_0x897c('0x32')],_0x348066[_0x897c('0x2e')]);_0x2b8a98[_0x897c('0x35')]=_['intersection'](_0x348066[_0x897c('0x32')],qs[_0x897c('0x33')](_0x9122e6[_0x897c('0x2e')]['fields']));_0x2b8a98[_0x897c('0x35')]=_0x2b8a98[_0x897c('0x35')][_0x897c('0x34')]?_0x2b8a98['attributes']:_0x348066[_0x897c('0x32')];_0x2b8a98['order']=qs[_0x897c('0x37')](_0x9122e6[_0x897c('0x2e')][_0x897c('0x37')]);_0x2b8a98[_0x897c('0x3a')]=qs[_0x897c('0x30')](_[_0x897c('0x38')](_0x9122e6['query'],_0x348066['filters']));if(_0x9122e6['query'][_0x897c('0x39')]){_0x2b8a98[_0x897c('0x3a')]=_[_0x897c('0x3b')](_0x2b8a98[_0x897c('0x3a')],{'$or':_['map'](_0x2b8a98[_0x897c('0x35')],function(_0x1a2dec){var _0x5edefd={};_0x5edefd[_0x1a2dec]={'$like':'%'+_0x9122e6[_0x897c('0x2e')]['filter']+'%'};return _0x5edefd;})});}_0x2b8a98=_['merge']({},_0x2b8a98,_0x9122e6['options']);return _0x3ed6f6['getActions'](_0x2b8a98);}})[_0x897c('0x3e')](function(_0x550729){if(_0x550729){_0x31274a=_0x550729[_0x897c('0x34')];if(!_0x9122e6[_0x897c('0x2e')][_0x897c('0x4b')](_0x897c('0x4c'))){_0x2b8a98['limit']=qs['limit'](_0x9122e6[_0x897c('0x2e')]['limit']);_0x2b8a98['offset']=qs['offset'](_0x9122e6['query'][_0x897c('0x1e')]);}return _0x3ed6f6[_0x897c('0x4f')](_0x2b8a98);}})[_0x897c('0x3e')](function(_0x1d78d9){if(_0x1d78d9){return _0x1d78d9?{'count':_0x31274a,'rows':_0x1d78d9}:null;}})[_0x897c('0x3e')](respondWithResult(_0x36c643,null))[_0x897c('0x42')](handleError(_0x36c643,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d640178..c3ca61e 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 _0xfb99=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','Automation','tools_automations'];(function(_0x551405,_0xef90c){var _0x37c3fe=function(_0x2e2814){while(--_0x2e2814){_0x551405['push'](_0x551405['shift']());}};_0x37c3fe(++_0xef90c);}(_0xfb99,0x15f));var _0x9fb9=function(_0x9a8838,_0x163c4b){_0x9a8838=_0x9a8838-0x0;var _0x277d69=_0xfb99[_0x9a8838];return _0x277d69;};'use strict';var _=require(_0x9fb9('0x0'));var util=require(_0x9fb9('0x1'));var logger=require(_0x9fb9('0x2'))(_0x9fb9('0x3'));var moment=require(_0x9fb9('0x4'));var BPromise=require(_0x9fb9('0x5'));var rp=require(_0x9fb9('0x6'));var fs=require('fs');var path=require(_0x9fb9('0x7'));var rimraf=require('rimraf');var config=require(_0x9fb9('0x8'));var attributes=require(_0x9fb9('0x9'));module[_0x9fb9('0xa')]=function(_0xe0f498,_0x8cea59){return _0xe0f498['define'](_0x9fb9('0xb'),attributes,{'tableName':_0x9fb9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe523=['exports','define','tools_automations','lodash','util','api','moment','bluebird','../../config/environment'];(function(_0x37c3fc,_0x5ffca){var _0x43101f=function(_0x4efa08){while(--_0x4efa08){_0x37c3fc['push'](_0x37c3fc['shift']());}};_0x43101f(++_0x5ffca);}(_0xe523,0xc0));var _0x3e52=function(_0x5b47db,_0x1130a7){_0x5b47db=_0x5b47db-0x0;var _0x722a26=_0xe523[_0x5b47db];return _0x722a26;};'use strict';var _=require(_0x3e52('0x0'));var util=require(_0x3e52('0x1'));var logger=require('../../config/logger')(_0x3e52('0x2'));var moment=require(_0x3e52('0x3'));var BPromise=require(_0x3e52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e52('0x5'));var attributes=require('./automation.attributes');module[_0x3e52('0x6')]=function(_0x40fdec,_0x11c7e3){return _0x40fdec[_0x3e52('0x7')]('Automation',attributes,{'tableName':_0x3e52('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index eed6850..5d7c705 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 _0x5458=['rpc','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3d0fa1,_0xd57cd6){var _0x4660bc=function(_0x5358ac){while(--_0x5358ac){_0x3d0fa1['push'](_0x3d0fa1['shift']());}};_0x4660bc(++_0xd57cd6);}(_0x5458,0x1c7));var _0x8545=function(_0x71204b,_0x352ee3){_0x71204b=_0x71204b-0x0;var _0x24d44c=_0x5458[_0x71204b];return _0x24d44c;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var moment=require(_0x8545('0x2'));var BPromise=require('bluebird');var rs=require(_0x8545('0x3'));var fs=require('fs');var Redis=require(_0x8545('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8545('0x5'));var logger=require(_0x8545('0x6'))(_0x8545('0x7'));var config=require('../../config/environment');var jayson=require(_0x8545('0x8'));var client=jayson[_0x8545('0x9')][_0x8545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359d01,_0x5062c7,_0x291bc9){return new BPromise(function(_0x507ed8,_0x2cc4f4){return client[_0x8545('0xb')](_0x359d01,_0x291bc9)[_0x8545('0xc')](function(_0x10931d){logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));logger[_0x8545('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0x5062c7,_0x8545('0xf'),JSON[_0x8545('0x11')](_0x10931d));if(_0x10931d[_0x8545('0x12')]){if(_0x10931d['error'][_0x8545('0x13')]===0x1f4){logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);return _0x2cc4f4(_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);}logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d['error'][_0x8545('0x14')]);return _0x507ed8(_0x10931d[_0x8545('0x12')]['message']);}else{logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));_0x507ed8(_0x10931d['result'][_0x8545('0x14')]);}})[_0x8545('0x15')](function(_0x3374f7){logger['error']('Automation,\x20%s,\x20%s',_0x5062c7,_0x3374f7);_0x2cc4f4(_0x3374f7);});});} \ No newline at end of file +var _0x731b=['debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x731b,0xf7));var _0xb731=function(_0x2d197d,_0x586725){_0x2d197d=_0x2d197d-0x0;var _0x332df8=_0x731b[_0x2d197d];return _0x332df8;};'use strict';var _=require(_0xb731('0x0'));var util=require(_0xb731('0x1'));var moment=require('moment');var BPromise=require(_0xb731('0x2'));var rs=require(_0xb731('0x3'));var fs=require('fs');var Redis=require(_0xb731('0x4'));var db=require(_0xb731('0x5'))['db'];var utils=require(_0xb731('0x6'));var logger=require(_0xb731('0x7'))('rpc');var config=require(_0xb731('0x8'));var jayson=require(_0xb731('0x9'));var client=jayson[_0xb731('0xa')][_0xb731('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12c59b,_0x2b475d,_0x173768){return new BPromise(function(_0x58b83c,_0x2ab04b){return client[_0xb731('0xc')](_0x12c59b,_0x173768)[_0xb731('0xd')](function(_0x26488c){logger[_0xb731('0xe')](_0xb731('0xf'),_0x2b475d,_0xb731('0x10'));logger[_0xb731('0x11')](_0xb731('0x12'),_0x2b475d,_0xb731('0x10'),JSON[_0xb731('0x13')](_0x26488c));if(_0x26488c[_0xb731('0x14')]){if(_0x26488c[_0xb731('0x14')][_0xb731('0x15')]===0x1f4){logger[_0xb731('0x14')]('Automation,\x20%s,\x20%s',_0x2b475d,_0x26488c[_0xb731('0x14')]['message']);return _0x2ab04b(_0x26488c[_0xb731('0x14')][_0xb731('0x16')]);}logger[_0xb731('0x14')]('Automation,\x20%s,\x20%s',_0x2b475d,_0x26488c[_0xb731('0x14')]['message']);return _0x58b83c(_0x26488c['error']['message']);}else{logger[_0xb731('0xe')](_0xb731('0xf'),_0x2b475d,'request\x20sent');_0x58b83c(_0x26488c[_0xb731('0x17')][_0xb731('0x16')]);}})['catch'](function(_0x30da75){logger[_0xb731('0x14')](_0xb731('0xf'),_0x2b475d,_0x30da75);_0x2ab04b(_0x30da75);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ae40e07..93a3cd5 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 _0x8bda=['express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','/:id','show','get','/:id/conditions','getConditions','/:id/actions','post','addConditions','addActions','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x3c838c,_0x29ad40){var _0x58605a=function(_0x5a8361){while(--_0x5a8361){_0x3c838c['push'](_0x3c838c['shift']());}};_0x58605a(++_0x29ad40);}(_0x8bda,0x104));var _0xa8bd=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x8bda[_0x10f68e];return _0x4c8372;};'use strict';var multer=require(_0xa8bd('0x0'));var util=require(_0xa8bd('0x1'));var path=require(_0xa8bd('0x2'));var timeout=require(_0xa8bd('0x3'));var express=require(_0xa8bd('0x4'));var router=express[_0xa8bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa8bd('0x6'));var interaction=require(_0xa8bd('0x7'));var config=require('../../config/environment');var controller=require(_0xa8bd('0x8'));router['get']('/',auth[_0xa8bd('0x9')](),controller[_0xa8bd('0xa')]);router['get'](_0xa8bd('0xb'),auth[_0xa8bd('0x9')](),controller[_0xa8bd('0xc')]);router[_0xa8bd('0xd')](_0xa8bd('0xe'),auth['isAuthenticated'](),controller[_0xa8bd('0xf')]);router[_0xa8bd('0xd')](_0xa8bd('0x10'),auth[_0xa8bd('0x9')](),controller['getActions']);router[_0xa8bd('0x11')]('/',auth[_0xa8bd('0x9')](),controller['create']);router[_0xa8bd('0x11')](_0xa8bd('0xe'),auth[_0xa8bd('0x9')](),controller[_0xa8bd('0x12')]);router[_0xa8bd('0x11')](_0xa8bd('0x10'),auth[_0xa8bd('0x9')](),controller[_0xa8bd('0x13')]);router[_0xa8bd('0x14')](_0xa8bd('0xb'),auth[_0xa8bd('0x9')](),controller[_0xa8bd('0x15')]);router[_0xa8bd('0x16')](_0xa8bd('0xb'),auth[_0xa8bd('0x9')](),controller['destroy']);module[_0xa8bd('0x17')]=router; \ No newline at end of file +var _0x1294=['../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','getActions','post','addActions','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service'];(function(_0x45f4ba,_0x5498c8){var _0x44db14=function(_0x381dec){while(--_0x381dec){_0x45f4ba['push'](_0x45f4ba['shift']());}};_0x44db14(++_0x5498c8);}(_0x1294,0xb8));var _0x4129=function(_0x32ad52,_0x3867b7){_0x32ad52=_0x32ad52-0x0;var _0xd4d3d3=_0x1294[_0x32ad52];return _0xd4d3d3;};'use strict';var multer=require(_0x4129('0x0'));var util=require('util');var path=require(_0x4129('0x1'));var timeout=require('connect-timeout');var express=require(_0x4129('0x2'));var router=express[_0x4129('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4129('0x4'));var interaction=require(_0x4129('0x5'));var config=require(_0x4129('0x6'));var controller=require(_0x4129('0x7'));router[_0x4129('0x8')]('/',auth[_0x4129('0x9')](),controller[_0x4129('0xa')]);router[_0x4129('0x8')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0xc')]);router[_0x4129('0x8')]('/:id/conditions',auth[_0x4129('0x9')](),controller[_0x4129('0xd')]);router[_0x4129('0x8')]('/:id/actions',auth['isAuthenticated'](),controller[_0x4129('0xe')]);router[_0x4129('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x4129('0xf')]('/:id/actions',auth[_0x4129('0x9')](),controller[_0x4129('0x10')]);router[_0x4129('0x11')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0x12')]);router[_0x4129('0x13')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e3a4e00..22bea2c 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 _0x1c72=['#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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#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','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER'];(function(_0x4c9bab,_0x1fe01f){var _0x3ff8da=function(_0x462124){while(--_0x462124){_0x4c9bab['push'](_0x4c9bab['shift']());}};_0x3ff8da(++_0x1fe01f);}(_0x1c72,0xca));var _0x21c7=function(_0x353562,_0x19c137){_0x353562=_0x353562-0x0;var _0x2d0320=_0x1c72[_0x353562];return _0x2d0320;};'use strict';var Sequelize=require(_0x21c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x21c7('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x21c7('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x21c7('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x21c7('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x21c7('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x21c7('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x21c7('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x21c7('0x7')](0x3)[_0x21c7('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x21c7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21c7('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x21c7('0x7')](0x5)[_0x21c7('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21c7('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x21c7('0x7')](0x3)[_0x21c7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21c7('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x21c7('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21c7('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x21c7('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x21c7('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x21c7('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21c7('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x21c7('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x21c7('0xe')},'dialTimezone':{'type':Sequelize[_0x21c7('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x21c7('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x21c7('0xf'),_0x21c7('0x10'),_0x21c7('0x11')),'defaultValue':_0x21c7('0xf')},'dialAMDActive':{'type':Sequelize[_0x21c7('0x4')],'defaultValue':0x0,'comment':_0x21c7('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x21c7('0x7')](0x9)[_0x21c7('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x21c7('0x7')](0x9)[_0x21c7('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x21c7('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x21c7('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x21c7('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x21c7('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x21c7('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x21c7('0x7')](0x9)[_0x21c7('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x21c7('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x21c7('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x21c7('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x21c7('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x21c7('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x21c7('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x21c7('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x21c7('0x2')](_0x21c7('0x1a'),'ASC'),'defaultValue':_0x21c7('0x1a')},'dialPrefix':{'type':Sequelize[_0x21c7('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x21c7('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x21c7('0x1b')},'dialCutDigit':{'type':Sequelize[_0x21c7('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x21c7('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x21c7('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x21c7('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21c7('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x21c7('0x7')](0x3)[_0x21c7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x21c7('0x7')](0x5)[_0x21c7('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21c7('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x21c7('0x7')](0x3)[_0x21c7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x21c7('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x21c7('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21c7('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x21c7('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x21c7('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21c7('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x21c7('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x21c7('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x21c7('0x22')}}; \ No newline at end of file +var _0x094c=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x8579f9,_0x357bdd){var _0x129dea=function(_0x9a86){while(--_0x9a86){_0x8579f9['push'](_0x8579f9['shift']());}};_0x129dea(++_0x357bdd);}(_0x094c,0x131));var _0xc094=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0x094c[_0x3987a1];return _0xe2596e;};'use strict';var Sequelize=require('sequelize');module[_0xc094('0x0')]={'name':{'type':Sequelize[_0xc094('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc094('0x2')](_0xc094('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xc094('0x1')]},'active':{'type':Sequelize[_0xc094('0x4')],'defaultValue':0x0,'comment':_0xc094('0x5')},'limitCalls':{'type':Sequelize[_0xc094('0x6')](0x4)[_0xc094('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc094('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc094('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xc094('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc094('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc094('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc094('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xc094('0x2')](_0xc094('0x10'),_0xc094('0x11'),_0xc094('0x12')),'defaultValue':_0xc094('0x10')},'dialAMDActive':{'type':Sequelize[_0xc094('0x4')],'defaultValue':0x0,'comment':_0xc094('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xc094('0x6')](0x9)[_0xc094('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc094('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc094('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc094('0x6')](0x9)[_0xc094('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc094('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc094('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xc094('0x6')](0x9)[_0xc094('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc094('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc094('0x6')](0x9)[_0xc094('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc094('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc094('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc094('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc094('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc094('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc094('0x2')](_0xc094('0x1a'),_0xc094('0x1b')),'defaultValue':_0xc094('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xc094('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc094('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 798ad4f..1e828fe 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 _0xd64b=['CmHopperHistory','rows','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','CmList','getLists','format','addLists','ids','omit','spread','dialCheckDuplicateType','always','into','cm_hopper','phone','ContactId','ListId','field','scheduledAt','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','select','insert','fromQuery','NOW()','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','all','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','push','sequelize','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','apply','reject','update','then','destroy','get','IvrCampaigns','stack','name','send','index','map','Campaign','rawAttributes','type','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','where','pick','merge','filter','options','includeAll','include','findAll','catch','params','filters','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','clone','updatedAt','body','createdAt','getHoppers','findOne','CmHopper','sort','CampaignId','getHopperHistories'];(function(_0x3c24fc,_0x392f8b){var _0x580736=function(_0x236a7a){while(--_0x236a7a){_0x3c24fc['push'](_0x3c24fc['shift']());}};_0x580736(++_0x392f8b);}(_0xd64b,0xc1));var _0xbd64=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xd64b[_0x1fd9e7];return _0x1781f2;};'use strict';var emlformat=require(_0xbd64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd64('0x2'));var moment=require(_0xbd64('0x3'));var BPromise=require(_0xbd64('0x4'));var Mustache=require(_0xbd64('0x5'));var util=require(_0xbd64('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd64('0x7'));var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd64('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x136f60,_0x2729d8){_0x2729d8=_0x2729d8||0xcc;return function(_0x3a941c){if(_0x3a941c){return _0x136f60[_0xbd64('0x16')](_0x2729d8);}return _0x136f60[_0xbd64('0x17')](_0x2729d8)[_0xbd64('0x18')]();};}function respondWithResult(_0x2e23f2,_0x269e2f){_0x269e2f=_0x269e2f||0xc8;return function(_0x2b5808){if(_0x2b5808){return _0x2e23f2['status'](_0x269e2f)[_0xbd64('0x19')](_0x2b5808);}};}function respondWithFilteredResult(_0x13e7a4,_0x3ff550){return function(_0x32fd34){if(_0x32fd34){var _0x29fc16=typeof _0x3ff550['offset']===_0xbd64('0x1a')&&typeof _0x3ff550['limit']===_0xbd64('0x1a');var _0x1432a6=_0x32fd34[_0xbd64('0x1b')];var _0x1d7a14=_0x29fc16?0x0:_0x3ff550[_0xbd64('0x1c')];var _0x2f4554=_0x29fc16?_0x32fd34[_0xbd64('0x1b')]:_0x3ff550[_0xbd64('0x1c')]+_0x3ff550['limit'];var _0x305545;if(_0x2f4554>=_0x1432a6){_0x2f4554=_0x1432a6;_0x305545=0xc8;}else{_0x305545=0xce;}_0x13e7a4[_0xbd64('0x17')](_0x305545);return _0x13e7a4['set']('Content-Range',_0x1d7a14+'-'+_0x2f4554+'/'+_0x1432a6)[_0xbd64('0x19')](_0x32fd34);}return null;};}function patchUpdates(_0x42b328){return function(_0x196d21){try{jsonpatch[_0xbd64('0x1d')](_0x196d21,_0x42b328,!![]);}catch(_0x2c5551){return BPromise[_0xbd64('0x1e')](_0x2c5551);}return _0x196d21['save']();};}function saveUpdates(_0x4d4a16,_0x6038f){return function(_0x41f2f){if(_0x41f2f){return _0x41f2f[_0xbd64('0x1f')](_0x4d4a16)[_0xbd64('0x20')](function(_0x55e74c){return _0x55e74c;});}return null;};}function removeEntity(_0x51d118,_0x28497c){return function(_0x4afaff){if(_0x4afaff){return _0x4afaff[_0xbd64('0x21')]()['then'](function(){var _0x33452d=_0x4afaff[_0xbd64('0x22')]({'plain':!![]});var _0x3d12a0=_0xbd64('0x23');return db['UserProfileResource'][_0xbd64('0x21')]({'where':{'type':_0x3d12a0,'resourceId':_0x33452d['id']}})[_0xbd64('0x20')](function(){return _0x4afaff;});})[_0xbd64('0x20')](function(){_0x51d118[_0xbd64('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8719,_0x29c9c8){return function(_0x49eac5){if(!_0x49eac5){_0x4e8719['sendStatus'](0x194);}return _0x49eac5;};}function handleError(_0xfa918,_0x5aacdd){_0x5aacdd=_0x5aacdd||0x1f4;return function(_0x3cf5b7){logger['error'](_0x3cf5b7[_0xbd64('0x24')]);if(_0x3cf5b7['name']){delete _0x3cf5b7[_0xbd64('0x25')];}_0xfa918[_0xbd64('0x17')](_0x5aacdd)[_0xbd64('0x26')](_0x3cf5b7);};}exports[_0xbd64('0x27')]=function(_0x306f19,_0x207ffc){var _0x4ed44a={},_0x35bdd5={},_0xe876c9={'count':0x0,'rows':[]};var _0xc44280=_[_0xbd64('0x28')](db[_0xbd64('0x29')][_0xbd64('0x2a')],function(_0x5e70d3){return{'name':_0x5e70d3['fieldName'],'type':_0x5e70d3[_0xbd64('0x2b')]['key']};});_0x35bdd5[_0xbd64('0x2c')]=_[_0xbd64('0x28')](_0xc44280,'name');_0x35bdd5['query']=_[_0xbd64('0x2d')](_0x306f19['query']);_0x35bdd5['filters']=_[_0xbd64('0x2e')](_0x35bdd5[_0xbd64('0x2c')],_0x35bdd5[_0xbd64('0x2f')]);_0x4ed44a['attributes']=_[_0xbd64('0x2e')](_0x35bdd5['model'],qs[_0xbd64('0x30')](_0x306f19[_0xbd64('0x2f')][_0xbd64('0x30')]));_0x4ed44a[_0xbd64('0x31')]=_0x4ed44a[_0xbd64('0x31')][_0xbd64('0x32')]?_0x4ed44a['attributes']:_0x35bdd5['model'];if(!_0x306f19[_0xbd64('0x2f')][_0xbd64('0x33')](_0xbd64('0x34'))){_0x4ed44a[_0xbd64('0x35')]=qs[_0xbd64('0x35')](_0x306f19[_0xbd64('0x2f')]['limit']);_0x4ed44a['offset']=qs[_0xbd64('0x1c')](_0x306f19[_0xbd64('0x2f')][_0xbd64('0x1c')]);}_0x4ed44a['order']=qs['sort'](_0x306f19[_0xbd64('0x2f')]['sort']);_0x4ed44a[_0xbd64('0x36')]=qs['filters'](_[_0xbd64('0x37')](_0x306f19[_0xbd64('0x2f')],_0x35bdd5['filters']),_0xc44280);if(_0x306f19[_0xbd64('0x2f')]['filter']){_0x4ed44a['where']=_[_0xbd64('0x38')](_0x4ed44a[_0xbd64('0x36')],{'$or':_[_0xbd64('0x28')](_0xc44280,function(_0x52f401){if(_0x52f401['type']!=='VIRTUAL'){var _0x344d46={};_0x344d46[_0x52f401[_0xbd64('0x25')]]={'$like':'%'+_0x306f19['query'][_0xbd64('0x39')]+'%'};return _0x344d46;}})});}_0x4ed44a=_[_0xbd64('0x38')]({},_0x4ed44a,_0x306f19[_0xbd64('0x3a')]);var _0x27fd12={'where':_0x4ed44a['where']};return db['Campaign'][_0xbd64('0x1b')](_0x27fd12)['then'](function(_0x595a91){_0xe876c9[_0xbd64('0x1b')]=_0x595a91;if(_0x306f19[_0xbd64('0x2f')][_0xbd64('0x3b')]){_0x4ed44a[_0xbd64('0x3c')]=[{'all':!![]}];}return db[_0xbd64('0x29')][_0xbd64('0x3d')](_0x4ed44a);})[_0xbd64('0x20')](function(_0x762380){_0xe876c9['rows']=_0x762380;return _0xe876c9;})[_0xbd64('0x20')](respondWithFilteredResult(_0x207ffc,_0x4ed44a))[_0xbd64('0x3e')](handleError(_0x207ffc,null));};exports['show']=function(_0x41b27a,_0x1e4983){var _0xe5b069={'raw':![],'where':{'id':_0x41b27a[_0xbd64('0x3f')]['id']}},_0x2bc972={};_0x2bc972[_0xbd64('0x2c')]=_[_0xbd64('0x2d')](db['Campaign'][_0xbd64('0x2a')]);_0x2bc972['query']=_[_0xbd64('0x2d')](_0x41b27a['query']);_0x2bc972[_0xbd64('0x40')]=_[_0xbd64('0x2e')](_0x2bc972[_0xbd64('0x2c')],_0x2bc972['query']);_0xe5b069[_0xbd64('0x31')]=_['intersection'](_0x2bc972['model'],qs['fields'](_0x41b27a[_0xbd64('0x2f')][_0xbd64('0x30')]));_0xe5b069[_0xbd64('0x31')]=_0xe5b069[_0xbd64('0x31')][_0xbd64('0x32')]?_0xe5b069[_0xbd64('0x31')]:_0x2bc972[_0xbd64('0x2c')];if(_0x41b27a['query'][_0xbd64('0x3b')]){_0xe5b069[_0xbd64('0x3c')]=[{'all':!![]}];}_0xe5b069=_[_0xbd64('0x38')]({},_0xe5b069,_0x41b27a['options']);return db[_0xbd64('0x29')][_0xbd64('0x41')](_0xe5b069)[_0xbd64('0x20')](handleEntityNotFound(_0x1e4983,null))[_0xbd64('0x20')](respondWithResult(_0x1e4983,null))[_0xbd64('0x3e')](handleError(_0x1e4983,null));};exports['create']=function(_0x283699,_0x1a9ec8){return db[_0xbd64('0x29')][_0xbd64('0x42')](_0x283699['body'],{})['then'](function(_0x1e008f){var _0x2a7eec=_0x283699[_0xbd64('0x43')][_0xbd64('0x22')]({'plain':!![]});if(!_0x2a7eec)throw new Error(_0xbd64('0x44'));if(_0x2a7eec[_0xbd64('0x45')]===_0xbd64('0x43')){var _0x3807a7=_0x1e008f[_0xbd64('0x22')]({'plain':!![]});var _0x2709b2=_0xbd64('0x23');return db[_0xbd64('0x46')][_0xbd64('0x41')]({'where':{'name':_0x2709b2,'userProfileId':_0x2a7eec[_0xbd64('0x47')]},'raw':!![]})[_0xbd64('0x20')](function(_0x5bd444){if(_0x5bd444&&_0x5bd444[_0xbd64('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x3807a7['name'],'resourceId':_0x3807a7['id'],'type':_0x5bd444['name'],'sectionId':_0x5bd444['id']},{})[_0xbd64('0x20')](function(){return _0x1e008f;});}else{return _0x1e008f;}})[_0xbd64('0x3e')](function(_0x5480f5){logger[_0xbd64('0x49')](_0xbd64('0x4a'),_0x5480f5);throw _0x5480f5;});}return _0x1e008f;})[_0xbd64('0x20')](respondWithResult(_0x1a9ec8,0xc9))['catch'](handleError(_0x1a9ec8,null));};exports[_0xbd64('0x4b')]=function(_0x371bad,_0x44cd4f){var _0x1db94c={'where':{'id':_0x371bad[_0xbd64('0x3f')]['id']}},_0x2436c1={};_0x2436c1['model']=_['keys'](db['Campaign'][_0xbd64('0x2a')]);_0x1db94c[_0xbd64('0x31')]=_[_0xbd64('0x2e')](_0x2436c1[_0xbd64('0x2c')],qs['fields'](_0x371bad[_0xbd64('0x2f')][_0xbd64('0x30')]));_0x1db94c[_0xbd64('0x31')]=_0x1db94c[_0xbd64('0x31')][_0xbd64('0x32')]?_0x1db94c[_0xbd64('0x31')]:_0x2436c1['model'];if(_0x371bad[_0xbd64('0x2f')][_0xbd64('0x3b')]){_0x1db94c[_0xbd64('0x3c')]=[{'all':!![]}];}_0x1db94c=_[_0xbd64('0x38')]({},_0x1db94c,_0x371bad[_0xbd64('0x3a')]);return db[_0xbd64('0x29')][_0xbd64('0x41')](_0x1db94c)[_0xbd64('0x20')](handleEntityNotFound(_0x44cd4f,null))[_0xbd64('0x20')](function(_0x1e8e1c){if(_0x1e8e1c){var _0x3812b3=_0x1e8e1c[_0xbd64('0x22')]({'plain':!![]});_0x3812b3=qs['omit'](_0x3812b3,['id','createdAt',_0xbd64('0x4c')]);_0x371bad[_0xbd64('0x4d')]=_['omit'](_0x371bad['body'],['id',_0xbd64('0x4e'),_0xbd64('0x4c')]);return db['Campaign'][_0xbd64('0x42')](_[_0xbd64('0x38')](_0x3812b3,_0x371bad[_0xbd64('0x4d')]),{'include':_0x371bad[_0xbd64('0x2f')][_0xbd64('0x3b')]?[{'all':!![]}]:undefined})[_0xbd64('0x20')](function(_0x2d788){var _0x23e602=_0x371bad[_0xbd64('0x43')]['get']({'plain':!![]});if(!_0x23e602)throw new Error(_0xbd64('0x44'));if(_0x23e602[_0xbd64('0x45')]===_0xbd64('0x43')){var _0x5054a6=_0x2d788[_0xbd64('0x22')]({'plain':!![]});var _0x39fae9='IvrCampaigns';return db[_0xbd64('0x46')][_0xbd64('0x41')]({'where':{'name':_0x39fae9,'userProfileId':_0x23e602[_0xbd64('0x47')]},'raw':!![]})[_0xbd64('0x20')](function(_0x3615bc){if(_0x3615bc&&_0x3615bc[_0xbd64('0x48')]===0x0){return db['UserProfileResource'][_0xbd64('0x42')]({'name':_0x5054a6[_0xbd64('0x25')],'resourceId':_0x5054a6['id'],'type':_0x3615bc[_0xbd64('0x25')],'sectionId':_0x3615bc['id']},{})[_0xbd64('0x20')](function(){return _0x2d788;});}else{return _0x2d788;}})['catch'](function(_0xff862e){logger[_0xbd64('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xff862e);throw _0xff862e;});}return _0x2d788;});}})[_0xbd64('0x20')](respondWithResult(_0x44cd4f,0xc9))['catch'](handleError(_0x44cd4f,null));};exports[_0xbd64('0x1f')]=function(_0x10e269,_0x1c10df){if(_0x10e269[_0xbd64('0x4d')]['id']){delete _0x10e269['body']['id'];}return db[_0xbd64('0x29')][_0xbd64('0x41')]({'where':{'id':_0x10e269[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x1c10df,null))[_0xbd64('0x20')](saveUpdates(_0x10e269[_0xbd64('0x4d')],null))['then'](respondWithResult(_0x1c10df,null))['catch'](handleError(_0x1c10df,null));};exports['destroy']=function(_0x36f3a8,_0xd1b21f){return db[_0xbd64('0x29')][_0xbd64('0x41')]({'where':{'id':_0x36f3a8[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0xd1b21f,null))['then'](removeEntity(_0xd1b21f,null))[_0xbd64('0x3e')](handleError(_0xd1b21f,null));};exports[_0xbd64('0x4f')]=function(_0x305ffc,_0x333720,_0x12f171){var _0x463105={'raw':!![],'where':{}};var _0x2f3516={};var _0x3d7e47={'count':0x0,'rows':[]};return db[_0xbd64('0x29')][_0xbd64('0x50')]({'where':{'id':_0x305ffc[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x333720,null))['then'](function(_0x5f16fd){if(_0x5f16fd){_0x2f3516[_0xbd64('0x2c')]=_[_0xbd64('0x2d')](db[_0xbd64('0x51')]['rawAttributes']);_0x2f3516[_0xbd64('0x2f')]=_['keys'](_0x305ffc[_0xbd64('0x2f')]);_0x2f3516[_0xbd64('0x40')]=_[_0xbd64('0x2e')](_0x2f3516[_0xbd64('0x2c')],_0x2f3516['query']);_0x463105[_0xbd64('0x31')]=_['intersection'](_0x2f3516[_0xbd64('0x2c')],qs[_0xbd64('0x30')](_0x305ffc[_0xbd64('0x2f')][_0xbd64('0x30')]));_0x463105[_0xbd64('0x31')]=_0x463105['attributes'][_0xbd64('0x32')]?_0x463105[_0xbd64('0x31')]:_0x2f3516['model'];if(!_0x305ffc[_0xbd64('0x2f')][_0xbd64('0x33')](_0xbd64('0x34'))){_0x463105[_0xbd64('0x35')]=qs['limit'](_0x305ffc[_0xbd64('0x2f')]['limit']);_0x463105[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x305ffc[_0xbd64('0x2f')]['offset']);}_0x463105['order']=qs['sort'](_0x305ffc['query'][_0xbd64('0x52')]);_0x463105[_0xbd64('0x36')]=qs[_0xbd64('0x40')](_[_0xbd64('0x37')](_0x305ffc[_0xbd64('0x2f')],_0x2f3516['filters']));_0x463105[_0xbd64('0x36')][_0xbd64('0x53')]=_0x5f16fd['id'];if(_0x305ffc[_0xbd64('0x2f')][_0xbd64('0x39')]){_0x463105[_0xbd64('0x36')]=_['merge'](_0x463105[_0xbd64('0x36')],{'$or':_[_0xbd64('0x28')](_0x463105[_0xbd64('0x31')],function(_0x808467){var _0x5875da={};_0x5875da[_0x808467]={'$like':'%'+_0x305ffc['query'][_0xbd64('0x39')]+'%'};return _0x5875da;})});}_0x463105=_[_0xbd64('0x38')]({},_0x463105,_0x305ffc[_0xbd64('0x3a')]);return db[_0xbd64('0x51')][_0xbd64('0x1b')]({'where':_0x463105[_0xbd64('0x36')]})[_0xbd64('0x20')](function(_0x344285){_0x3d7e47['count']=_0x344285;if(_0x305ffc[_0xbd64('0x2f')]['includeAll']){_0x463105[_0xbd64('0x3c')]=[{'all':!![]}];}return db[_0xbd64('0x51')][_0xbd64('0x3d')](_0x463105);})['then'](function(_0x15b625){_0x3d7e47['rows']=_0x15b625;return _0x3d7e47;});}})['then'](respondWithFilteredResult(_0x333720,_0x463105))[_0xbd64('0x3e')](handleError(_0x333720,null));};exports[_0xbd64('0x54')]=function(_0x448254,_0x5b5428,_0x364af8){var _0x3a34b7={'raw':!![],'where':{}};var _0x8150bb={};var _0x35cf6a={'count':0x0,'rows':[]};return db['Campaign'][_0xbd64('0x50')]({'where':{'id':_0x448254[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x5b5428,null))[_0xbd64('0x20')](function(_0x339e52){if(_0x339e52){_0x8150bb[_0xbd64('0x2c')]=_[_0xbd64('0x2d')](db[_0xbd64('0x55')][_0xbd64('0x2a')]);_0x8150bb[_0xbd64('0x2f')]=_[_0xbd64('0x2d')](_0x448254[_0xbd64('0x2f')]);_0x8150bb[_0xbd64('0x40')]=_[_0xbd64('0x2e')](_0x8150bb['model'],_0x8150bb['query']);_0x3a34b7[_0xbd64('0x31')]=_[_0xbd64('0x2e')](_0x8150bb[_0xbd64('0x2c')],qs['fields'](_0x448254[_0xbd64('0x2f')]['fields']));_0x3a34b7[_0xbd64('0x31')]=_0x3a34b7[_0xbd64('0x31')][_0xbd64('0x32')]?_0x3a34b7[_0xbd64('0x31')]:_0x8150bb['model'];if(!_0x448254[_0xbd64('0x2f')][_0xbd64('0x33')]('nolimit')){_0x3a34b7[_0xbd64('0x35')]=qs['limit'](_0x448254[_0xbd64('0x2f')][_0xbd64('0x35')]);_0x3a34b7[_0xbd64('0x1c')]=qs[_0xbd64('0x1c')](_0x448254[_0xbd64('0x2f')][_0xbd64('0x1c')]);}_0x3a34b7['order']=qs[_0xbd64('0x52')](_0x448254['query'][_0xbd64('0x52')]);_0x3a34b7[_0xbd64('0x36')]=qs['filters'](_[_0xbd64('0x37')](_0x448254['query'],_0x8150bb[_0xbd64('0x40')]));_0x3a34b7[_0xbd64('0x36')][_0xbd64('0x53')]=_0x339e52['id'];if(_0x448254['query'][_0xbd64('0x39')]){_0x3a34b7[_0xbd64('0x36')]=_[_0xbd64('0x38')](_0x3a34b7[_0xbd64('0x36')],{'$or':_[_0xbd64('0x28')](_0x3a34b7['attributes'],function(_0x58efa2){var _0x42feee={};_0x42feee[_0x58efa2]={'$like':'%'+_0x448254[_0xbd64('0x2f')][_0xbd64('0x39')]+'%'};return _0x42feee;})});}_0x3a34b7=_[_0xbd64('0x38')]({},_0x3a34b7,_0x448254[_0xbd64('0x3a')]);return db[_0xbd64('0x55')][_0xbd64('0x1b')]({'where':_0x3a34b7[_0xbd64('0x36')]})[_0xbd64('0x20')](function(_0x4224c3){_0x35cf6a[_0xbd64('0x1b')]=_0x4224c3;if(_0x448254[_0xbd64('0x2f')][_0xbd64('0x3b')]){_0x3a34b7['include']=[{'all':!![]}];}return db[_0xbd64('0x55')][_0xbd64('0x3d')](_0x3a34b7);})['then'](function(_0x3a375c){_0x35cf6a[_0xbd64('0x56')]=_0x3a375c;return _0x35cf6a;});}})[_0xbd64('0x20')](respondWithFilteredResult(_0x5b5428,_0x3a34b7))[_0xbd64('0x3e')](handleError(_0x5b5428,null));};exports['getHopperFinals']=function(_0x5c6fc0,_0x25ce1e,_0x923e5a){var _0x7f4e70={'raw':!![],'where':{}};var _0x2af19c={};var _0x46a391={'count':0x0,'rows':[]};return db[_0xbd64('0x29')][_0xbd64('0x50')]({'where':{'id':_0x5c6fc0[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x25ce1e,null))[_0xbd64('0x20')](function(_0x1c5e0a){if(_0x1c5e0a){_0x2af19c[_0xbd64('0x2c')]=_['keys'](db[_0xbd64('0x57')][_0xbd64('0x2a')]);_0x2af19c[_0xbd64('0x2f')]=_['keys'](_0x5c6fc0['query']);_0x2af19c[_0xbd64('0x40')]=_[_0xbd64('0x2e')](_0x2af19c['model'],_0x2af19c[_0xbd64('0x2f')]);_0x7f4e70[_0xbd64('0x31')]=_[_0xbd64('0x2e')](_0x2af19c[_0xbd64('0x2c')],qs[_0xbd64('0x30')](_0x5c6fc0[_0xbd64('0x2f')][_0xbd64('0x30')]));_0x7f4e70[_0xbd64('0x31')]=_0x7f4e70[_0xbd64('0x31')][_0xbd64('0x32')]?_0x7f4e70[_0xbd64('0x31')]:_0x2af19c[_0xbd64('0x2c')];if(!_0x5c6fc0['query'][_0xbd64('0x33')]('nolimit')){_0x7f4e70[_0xbd64('0x35')]=qs[_0xbd64('0x35')](_0x5c6fc0[_0xbd64('0x2f')][_0xbd64('0x35')]);_0x7f4e70[_0xbd64('0x1c')]=qs['offset'](_0x5c6fc0[_0xbd64('0x2f')][_0xbd64('0x1c')]);}_0x7f4e70[_0xbd64('0x58')]=qs[_0xbd64('0x52')](_0x5c6fc0['query'][_0xbd64('0x52')]);_0x7f4e70['where']=qs[_0xbd64('0x40')](_[_0xbd64('0x37')](_0x5c6fc0[_0xbd64('0x2f')],_0x2af19c[_0xbd64('0x40')]));_0x7f4e70[_0xbd64('0x36')][_0xbd64('0x53')]=_0x1c5e0a['id'];if(_0x5c6fc0[_0xbd64('0x2f')]['filter']){_0x7f4e70[_0xbd64('0x36')]=_[_0xbd64('0x38')](_0x7f4e70[_0xbd64('0x36')],{'$or':_[_0xbd64('0x28')](_0x7f4e70['attributes'],function(_0x38b2b3){var _0x232cca={};_0x232cca[_0x38b2b3]={'$like':'%'+_0x5c6fc0[_0xbd64('0x2f')][_0xbd64('0x39')]+'%'};return _0x232cca;})});}_0x7f4e70=_[_0xbd64('0x38')]({},_0x7f4e70,_0x5c6fc0[_0xbd64('0x3a')]);return db[_0xbd64('0x57')]['count']({'where':_0x7f4e70[_0xbd64('0x36')]})['then'](function(_0x168c17){_0x46a391['count']=_0x168c17;if(_0x5c6fc0['query'][_0xbd64('0x3b')]){_0x7f4e70[_0xbd64('0x3c')]=[{'all':!![]}];}return db[_0xbd64('0x57')]['findAll'](_0x7f4e70);})[_0xbd64('0x20')](function(_0x49d6fe){_0x46a391[_0xbd64('0x56')]=_0x49d6fe;return _0x46a391;});}})['then'](respondWithFilteredResult(_0x25ce1e,_0x7f4e70))['catch'](handleError(_0x25ce1e,null));};exports[_0xbd64('0x59')]=function(_0x680b67,_0x30a8b4,_0x310ee4){var _0x34c941={'raw':!![],'where':{}};var _0x2e67e9={};var _0x2982c2={'count':0x0,'rows':[]};return db[_0xbd64('0x29')]['findOne']({'where':{'id':_0x680b67['params']['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x30a8b4,null))['then'](function(_0x216dd1){if(_0x216dd1){_0x2e67e9[_0xbd64('0x2c')]=_[_0xbd64('0x2d')](db['CmHopperBlack'][_0xbd64('0x2a')]);_0x2e67e9[_0xbd64('0x2f')]=_['keys'](_0x680b67[_0xbd64('0x2f')]);_0x2e67e9[_0xbd64('0x40')]=_['intersection'](_0x2e67e9['model'],_0x2e67e9[_0xbd64('0x2f')]);_0x34c941[_0xbd64('0x31')]=_[_0xbd64('0x2e')](_0x2e67e9[_0xbd64('0x2c')],qs[_0xbd64('0x30')](_0x680b67[_0xbd64('0x2f')][_0xbd64('0x30')]));_0x34c941[_0xbd64('0x31')]=_0x34c941[_0xbd64('0x31')][_0xbd64('0x32')]?_0x34c941[_0xbd64('0x31')]:_0x2e67e9[_0xbd64('0x2c')];if(!_0x680b67[_0xbd64('0x2f')][_0xbd64('0x33')](_0xbd64('0x34'))){_0x34c941['limit']=qs[_0xbd64('0x35')](_0x680b67['query'][_0xbd64('0x35')]);_0x34c941[_0xbd64('0x1c')]=qs['offset'](_0x680b67[_0xbd64('0x2f')]['offset']);}_0x34c941[_0xbd64('0x58')]=qs[_0xbd64('0x52')](_0x680b67[_0xbd64('0x2f')][_0xbd64('0x52')]);_0x34c941['where']=qs[_0xbd64('0x40')](_[_0xbd64('0x37')](_0x680b67[_0xbd64('0x2f')],_0x2e67e9[_0xbd64('0x40')]));_0x34c941['where']['CampaignId']=_0x216dd1['id'];if(_0x680b67[_0xbd64('0x2f')][_0xbd64('0x39')]){_0x34c941[_0xbd64('0x36')]=_['merge'](_0x34c941[_0xbd64('0x36')],{'$or':_['map'](_0x34c941[_0xbd64('0x31')],function(_0x1bde47){var _0x21b397={};_0x21b397[_0x1bde47]={'$like':'%'+_0x680b67[_0xbd64('0x2f')][_0xbd64('0x39')]+'%'};return _0x21b397;})});}_0x34c941=_['merge']({},_0x34c941,_0x680b67['options']);return db[_0xbd64('0x5a')][_0xbd64('0x1b')]({'where':_0x34c941[_0xbd64('0x36')]})['then'](function(_0x2c805b){_0x2982c2['count']=_0x2c805b;if(_0x680b67[_0xbd64('0x2f')][_0xbd64('0x3b')]){_0x34c941[_0xbd64('0x3c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xbd64('0x3d')](_0x34c941);})[_0xbd64('0x20')](function(_0x496475){_0x2982c2['rows']=_0x496475;return _0x2982c2;});}})[_0xbd64('0x20')](respondWithFilteredResult(_0x30a8b4,_0x34c941))['catch'](handleError(_0x30a8b4,null));};exports['getLists']=function(_0x1442ee,_0x237a8c,_0x4e3663){var _0xa932c3={};var _0x540513={};var _0x4011c5;var _0x1c999a;return db[_0xbd64('0x29')]['findOne']({'where':{'id':_0x1442ee[_0xbd64('0x3f')]['id']}})['then'](handleEntityNotFound(_0x237a8c,null))['then'](function(_0x4abd1b){if(_0x4abd1b){_0x4011c5=_0x4abd1b;_0x540513[_0xbd64('0x2c')]=_[_0xbd64('0x2d')](db[_0xbd64('0x5b')]['rawAttributes']);_0x540513[_0xbd64('0x2f')]=_['keys'](_0x1442ee[_0xbd64('0x2f')]);_0x540513['filters']=_['intersection'](_0x540513['model'],_0x540513[_0xbd64('0x2f')]);_0xa932c3[_0xbd64('0x31')]=_[_0xbd64('0x2e')](_0x540513[_0xbd64('0x2c')],qs['fields'](_0x1442ee[_0xbd64('0x2f')][_0xbd64('0x30')]));_0xa932c3[_0xbd64('0x31')]=_0xa932c3['attributes'][_0xbd64('0x32')]?_0xa932c3['attributes']:_0x540513[_0xbd64('0x2c')];_0xa932c3[_0xbd64('0x58')]=qs[_0xbd64('0x52')](_0x1442ee[_0xbd64('0x2f')][_0xbd64('0x52')]);_0xa932c3[_0xbd64('0x36')]=qs[_0xbd64('0x40')](_[_0xbd64('0x37')](_0x1442ee[_0xbd64('0x2f')],_0x540513[_0xbd64('0x40')]));if(_0x1442ee[_0xbd64('0x2f')][_0xbd64('0x39')]){_0xa932c3[_0xbd64('0x36')]=_['merge'](_0xa932c3['where'],{'$or':_[_0xbd64('0x28')](_0xa932c3[_0xbd64('0x31')],function(_0x424f0f){var _0x3275d4={};_0x3275d4[_0x424f0f]={'$like':'%'+_0x1442ee['query'][_0xbd64('0x39')]+'%'};return _0x3275d4;})});}_0xa932c3=_['merge']({},_0xa932c3,_0x1442ee[_0xbd64('0x3a')]);return _0x4011c5['getLists'](_0xa932c3);}})['then'](function(_0x421cd3){if(_0x421cd3){_0x1c999a=_0x421cd3[_0xbd64('0x32')];if(!_0x1442ee['query'][_0xbd64('0x33')]('nolimit')){_0xa932c3[_0xbd64('0x35')]=qs['limit'](_0x1442ee[_0xbd64('0x2f')][_0xbd64('0x35')]);_0xa932c3[_0xbd64('0x1c')]=qs['offset'](_0x1442ee[_0xbd64('0x2f')][_0xbd64('0x1c')]);}return _0x4011c5[_0xbd64('0x5c')](_0xa932c3);}})[_0xbd64('0x20')](function(_0x21a8e6){if(_0x21a8e6){return _0x21a8e6?{'count':_0x1c999a,'rows':_0x21a8e6}:null;}})[_0xbd64('0x20')](respondWithResult(_0x237a8c,null))[_0xbd64('0x3e')](handleError(_0x237a8c,null));};exports['addLists']=function(_0x2b21d0,_0x38ed53,_0x56e59e){var _0x497b8e,_0x5de03a;var _0x20182f=[];var _0x3f3d60=moment()[_0xbd64('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xbd64('0x29')]['find']({'where':{'id':_0x2b21d0[_0xbd64('0x3f')]['id']}})['then'](handleEntityNotFound(_0x38ed53,null))[_0xbd64('0x20')](function(_0x133cb4){if(_0x133cb4){_0x5de03a=_0x133cb4;return _0x133cb4[_0xbd64('0x5e')](_0x2b21d0[_0xbd64('0x4d')][_0xbd64('0x5f')],_[_0xbd64('0x60')](_0x2b21d0[_0xbd64('0x4d')],[_0xbd64('0x5f'),'id'])||{});}return null;})[_0xbd64('0x61')](function(_0x1e9882){var _0x3792f8;var _0x4d684d;_0x497b8e=_0x1e9882||[];var _0x168b3d=[];if(_0x1e9882){for(var _0x1dad77=0x0;_0x1dad77<_0x1e9882[_0xbd64('0x32')];_0x1dad77+=0x1){var _0x23fd87=_0x1e9882[_0x1dad77][_0xbd64('0x22')]({'plain':!![]});_0x5de03a[_0xbd64('0x62')]=_0x2b21d0[_0xbd64('0x4d')][_0xbd64('0x62')]?_0x2b21d0[_0xbd64('0x4d')]['dialCheckDuplicateType']:_0x5de03a['dialCheckDuplicateType'];switch(_0x5de03a[_0xbd64('0x62')]){case _0xbd64('0x63'):_0x3792f8=squel['insert']()[_0xbd64('0x64')](_0xbd64('0x65'))['fromQuery']([_0xbd64('0x66'),'scheduledAt',_0xbd64('0x67'),_0xbd64('0x68'),_0xbd64('0x53'),_0xbd64('0x4e'),_0xbd64('0x4c')],squel['select']()['field']('phone','phone')[_0xbd64('0x69')]('NOW()',_0xbd64('0x6a'))['field']('id','ContactId')[_0xbd64('0x69')](_0x23fd87[_0xbd64('0x6b')][_0xbd64('0x6c')](),_0xbd64('0x68'))[_0xbd64('0x69')](_0x2b21d0[_0xbd64('0x3f')]['id'][_0xbd64('0x6c')](),_0xbd64('0x53'))[_0xbd64('0x69')]('\x27'+_0x3f3d60+'\x27',_0xbd64('0x4e'))[_0xbd64('0x69')]('\x27'+_0x3f3d60+'\x27',_0xbd64('0x4c'))['from'](_0xbd64('0x6d'))[_0xbd64('0x36')](_0xbd64('0x6e'))[_0xbd64('0x36')](_0xbd64('0x6f'),_0x23fd87[_0xbd64('0x6b')]['toString']())[_0xbd64('0x36')](_0xbd64('0x70'))[_0xbd64('0x36')](_0xbd64('0x71'),squel['select']()[_0xbd64('0x69')](_0xbd64('0x72'))[_0xbd64('0x73')](_0xbd64('0x74'))['where'](_0xbd64('0x75'),_0x2b21d0['params']['id']['toString']()))['where'](_0xbd64('0x71'),squel[_0xbd64('0x76')]()['field']('COALESCE(phone,\x27\x27)')[_0xbd64('0x73')](_0xbd64('0x65'))[_0xbd64('0x36')](_0xbd64('0x75'),_0x2b21d0['params']['id']['toString']())))[_0xbd64('0x6c')]();break;case'onlyIfOpen':_0x3792f8=squel[_0xbd64('0x77')]()['into'](_0xbd64('0x65'))[_0xbd64('0x78')]([_0xbd64('0x66'),_0xbd64('0x6a'),'ContactId',_0xbd64('0x68'),_0xbd64('0x53'),_0xbd64('0x4e'),_0xbd64('0x4c')],squel['select']()[_0xbd64('0x69')](_0xbd64('0x66'),_0xbd64('0x66'))[_0xbd64('0x69')](_0xbd64('0x79'),_0xbd64('0x6a'))[_0xbd64('0x69')]('id',_0xbd64('0x67'))[_0xbd64('0x69')](_0x23fd87['CmListId']['toString'](),_0xbd64('0x68'))['field'](_0x2b21d0[_0xbd64('0x3f')]['id'][_0xbd64('0x6c')](),_0xbd64('0x53'))['field']('\x27'+_0x3f3d60+'\x27','createdAt')[_0xbd64('0x69')]('\x27'+_0x3f3d60+'\x27',_0xbd64('0x4c'))[_0xbd64('0x73')](_0xbd64('0x6d'))[_0xbd64('0x36')](_0xbd64('0x6e'))[_0xbd64('0x36')](_0xbd64('0x6f'),_0x23fd87[_0xbd64('0x6b')]['toString']())['where'](_0xbd64('0x70'))[_0xbd64('0x36')](_0xbd64('0x71'),squel[_0xbd64('0x76')]()['field'](_0xbd64('0x7a'))['from'](_0xbd64('0x65'))['where'](_0xbd64('0x75'),_0x2b21d0['params']['id'][_0xbd64('0x6c')]())))[_0xbd64('0x6c')]();break;default:_0x3792f8=squel[_0xbd64('0x77')]()[_0xbd64('0x64')](_0xbd64('0x65'))[_0xbd64('0x78')](['phone',_0xbd64('0x6a'),'ContactId',_0xbd64('0x68'),'CampaignId','createdAt',_0xbd64('0x4c')],squel[_0xbd64('0x76')]()[_0xbd64('0x69')]('phone',_0xbd64('0x66'))[_0xbd64('0x69')](_0xbd64('0x79'),_0xbd64('0x6a'))[_0xbd64('0x69')]('id','ContactId')[_0xbd64('0x69')](_0x23fd87['CmListId']['toString'](),_0xbd64('0x68'))[_0xbd64('0x69')](_0x2b21d0[_0xbd64('0x3f')]['id'][_0xbd64('0x6c')](),_0xbd64('0x53'))[_0xbd64('0x69')]('\x27'+_0x3f3d60+'\x27',_0xbd64('0x4e'))[_0xbd64('0x69')]('\x27'+_0x3f3d60+'\x27',_0xbd64('0x4c'))[_0xbd64('0x73')](_0xbd64('0x6d'))['where'](_0xbd64('0x6e'))[_0xbd64('0x36')](_0xbd64('0x6f'),_0x23fd87[_0xbd64('0x6b')]['toString']())[_0xbd64('0x36')](_0xbd64('0x70')))['toString']();}_0x4d684d=squel['insert']()[_0xbd64('0x64')](_0xbd64('0x7b'))[_0xbd64('0x78')]([_0xbd64('0x7c'),_0xbd64('0x6a'),_0xbd64('0x66'),'OrderBy',_0xbd64('0x4e'),_0xbd64('0x4c')],squel[_0xbd64('0x76')]()[_0xbd64('0x69')]('h.id','id')[_0xbd64('0x69')]('NOW()',_0xbd64('0x6a'))[_0xbd64('0x69')](_0xbd64('0x7d'),_0xbd64('0x66'))['field'](_0xbd64('0x7e'),'OrderBy')[_0xbd64('0x69')]('\x27'+_0x3f3d60+'\x27','createdAt')[_0xbd64('0x69')]('\x27'+_0x3f3d60+'\x27','updatedAt')[_0xbd64('0x73')](_0xbd64('0x7f'),'ci')['join'](_0xbd64('0x65'),'h',_0xbd64('0x80'))['where'](_0xbd64('0x81'),_0x23fd87[_0xbd64('0x6b')][_0xbd64('0x6c')]())['where'](_0xbd64('0x82'),_0x2b21d0[_0xbd64('0x3f')]['id'][_0xbd64('0x6c')]())['where'](_0xbd64('0x83'),_0x3f3d60))[_0xbd64('0x6c')]();_0x168b3d['push'](db['sequelize'][_0xbd64('0x2f')](_0x3792f8));_0x20182f['push'](db['sequelize'][_0xbd64('0x2f')](_0x4d684d));}return BPromise[_0xbd64('0x84')](_0x168b3d);}})[_0xbd64('0x20')](function(){return BPromise['all'](_0x20182f);})[_0xbd64('0x20')](function(){return _0x497b8e;})['then'](respondWithResult(_0x38ed53,null))[_0xbd64('0x3e')](handleError(_0x38ed53,null));};exports['removeLists']=function(_0x45f692,_0x1a899a,_0x4a2067){return db[_0xbd64('0x29')][_0xbd64('0x41')]({'where':{'id':_0x45f692[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x1a899a,null))[_0xbd64('0x20')](function(_0x415a60){if(_0x415a60){return _0x415a60['removeLists'](_0x45f692[_0xbd64('0x2f')][_0xbd64('0x5f')]);}})[_0xbd64('0x20')](function(_0x1a1bce){if(_0x1a1bce){return db[_0xbd64('0x51')][_0xbd64('0x21')]({'where':{'ListId':_0x45f692['query']['ids'],'CampaignId':_0x45f692[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](function(){return _0x1a1bce;});}})[_0xbd64('0x20')](respondWithStatusCode(_0x1a899a,null))['catch'](handleError(_0x1a899a,null));};exports[_0xbd64('0x85')]=function(_0x2ab4d7,_0x3067fa,_0x3a35ad){var _0xa573d0={};var _0x46c4a4={};var _0x5a0256;var _0x55170c;return db[_0xbd64('0x29')][_0xbd64('0x50')]({'where':{'id':_0x2ab4d7[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x3067fa,null))['then'](function(_0x4e7e3a){if(_0x4e7e3a){_0x5a0256=_0x4e7e3a;_0x46c4a4['model']=_[_0xbd64('0x2d')](db['CmList'][_0xbd64('0x2a')]);_0x46c4a4[_0xbd64('0x2f')]=_[_0xbd64('0x2d')](_0x2ab4d7['query']);_0x46c4a4[_0xbd64('0x40')]=_[_0xbd64('0x2e')](_0x46c4a4[_0xbd64('0x2c')],_0x46c4a4[_0xbd64('0x2f')]);_0xa573d0[_0xbd64('0x31')]=_[_0xbd64('0x2e')](_0x46c4a4[_0xbd64('0x2c')],qs[_0xbd64('0x30')](_0x2ab4d7[_0xbd64('0x2f')][_0xbd64('0x30')]));_0xa573d0[_0xbd64('0x31')]=_0xa573d0[_0xbd64('0x31')][_0xbd64('0x32')]?_0xa573d0['attributes']:_0x46c4a4[_0xbd64('0x2c')];_0xa573d0['order']=qs[_0xbd64('0x52')](_0x2ab4d7[_0xbd64('0x2f')][_0xbd64('0x52')]);_0xa573d0[_0xbd64('0x36')]=qs[_0xbd64('0x40')](_[_0xbd64('0x37')](_0x2ab4d7['query'],_0x46c4a4['filters']));if(_0x2ab4d7['query']['filter']){_0xa573d0[_0xbd64('0x36')]=_[_0xbd64('0x38')](_0xa573d0[_0xbd64('0x36')],{'$or':_[_0xbd64('0x28')](_0xa573d0[_0xbd64('0x31')],function(_0x35d11f){var _0x46b0dd={};_0x46b0dd[_0x35d11f]={'$like':'%'+_0x2ab4d7[_0xbd64('0x2f')]['filter']+'%'};return _0x46b0dd;})});}_0xa573d0=_[_0xbd64('0x38')]({},_0xa573d0,_0x2ab4d7[_0xbd64('0x3a')]);return _0x5a0256['getBlackLists'](_0xa573d0);}})[_0xbd64('0x20')](function(_0x41294f){if(_0x41294f){_0x55170c=_0x41294f[_0xbd64('0x32')];if(!_0x2ab4d7[_0xbd64('0x2f')][_0xbd64('0x33')](_0xbd64('0x34'))){_0xa573d0[_0xbd64('0x35')]=qs[_0xbd64('0x35')](_0x2ab4d7[_0xbd64('0x2f')][_0xbd64('0x35')]);_0xa573d0[_0xbd64('0x1c')]=qs['offset'](_0x2ab4d7[_0xbd64('0x2f')][_0xbd64('0x1c')]);}return _0x5a0256[_0xbd64('0x85')](_0xa573d0);}})['then'](function(_0x216268){if(_0x216268){return _0x216268?{'count':_0x55170c,'rows':_0x216268}:null;}})['then'](respondWithResult(_0x3067fa,null))[_0xbd64('0x3e')](handleError(_0x3067fa,null));};exports[_0xbd64('0x86')]=function(_0x2e0988,_0x5e85b7,_0x52215e){var _0x33a01c,_0x452ff6;var _0x53fcb0=[];var _0xf28e24=moment()['format'](_0xbd64('0x87'));return db[_0xbd64('0x29')][_0xbd64('0x41')]({'where':{'id':_0x2e0988[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x5e85b7,null))[_0xbd64('0x20')](function(_0x476e9e){if(_0x476e9e){_0x452ff6=_0x476e9e;return _0x476e9e[_0xbd64('0x86')](_0x2e0988[_0xbd64('0x4d')][_0xbd64('0x5f')],_['omit'](_0x2e0988['body'],[_0xbd64('0x5f'),'id'])||{});}return null;})[_0xbd64('0x61')](function(_0x54379f){var _0x1b88aa;var _0xeaaf4d;_0x33a01c=_0x54379f||[];var _0x136a6d=[];if(_0x54379f){for(var _0x39fb65=0x0;_0x39fb65<_0x54379f['length'];_0x39fb65+=0x1){var _0x24793e=_0x54379f[_0x39fb65][_0xbd64('0x22')]({'plain':!![]});_0x1b88aa=squel[_0xbd64('0x77')]()['into']('cm_hopper_black')[_0xbd64('0x78')]([_0xbd64('0x66'),_0xbd64('0x67'),'ListId',_0xbd64('0x53'),'createdAt',_0xbd64('0x4c')],squel['select']()[_0xbd64('0x69')]('phone',_0xbd64('0x66'))[_0xbd64('0x69')]('id',_0xbd64('0x67'))[_0xbd64('0x69')](_0x24793e['CmListId'][_0xbd64('0x6c')](),_0xbd64('0x68'))[_0xbd64('0x69')](_0x2e0988[_0xbd64('0x3f')]['id'][_0xbd64('0x6c')](),_0xbd64('0x53'))[_0xbd64('0x69')](_0xbd64('0x79'),_0xbd64('0x4e'))[_0xbd64('0x69')](_0xbd64('0x79'),'updatedAt')[_0xbd64('0x73')](_0xbd64('0x6d'))['where']('deletedAt\x20IS\x20NULL')[_0xbd64('0x36')](_0xbd64('0x6f'),_0x24793e['CmListId'][_0xbd64('0x6c')]())[_0xbd64('0x36')](_0xbd64('0x70')))['toString']();_0x136a6d[_0xbd64('0x88')](db[_0xbd64('0x89')]['query'](_0x1b88aa));}return BPromise[_0xbd64('0x84')](_0x136a6d);}})[_0xbd64('0x20')](function(){return _0x33a01c;})[_0xbd64('0x20')](respondWithResult(_0x5e85b7,null))[_0xbd64('0x3e')](handleError(_0x5e85b7,null));};exports[_0xbd64('0x8a')]=function(_0x2e5437,_0x1d759c,_0x171d75){return db[_0xbd64('0x29')]['find']({'where':{'id':_0x2e5437['params']['id']}})[_0xbd64('0x20')](handleEntityNotFound(_0x1d759c,null))['then'](function(_0x2acfac){if(_0x2acfac){return _0x2acfac['removeBlackLists'](_0x2e5437[_0xbd64('0x2f')]['ids']);}})[_0xbd64('0x20')](function(_0x42f9f8){if(_0x42f9f8){return db['CmHopperBlack'][_0xbd64('0x21')]({'where':{'ListId':_0x2e5437[_0xbd64('0x2f')][_0xbd64('0x5f')],'CampaignId':_0x2e5437[_0xbd64('0x3f')]['id']}})[_0xbd64('0x20')](function(){return _0x42f9f8;});}})[_0xbd64('0x20')](respondWithStatusCode(_0x1d759c,null))[_0xbd64('0x3e')](handleError(_0x1d759c,null));}; \ No newline at end of file +var _0xa0a3=['CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','sequelize','push','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','name','send','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getHoppers','CmHopper','nolimit','order','CampaignId','findOne','CmHopperHistory','getHopperFinals'];(function(_0x485843,_0x4d8e2b){var _0x1f7495=function(_0x4fd673){while(--_0x4fd673){_0x485843['push'](_0x485843['shift']());}};_0x1f7495(++_0x4d8e2b);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x26888c,_0x1e6a1a){_0x26888c=_0x26888c-0x0;var _0x563c69=_0xa0a3[_0x26888c];return _0x563c69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a0a('0x0'));var zipdir=require(_0x3a0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a0a('0x2'));var moment=require(_0x3a0a('0x3'));var BPromise=require(_0x3a0a('0x4'));var Mustache=require(_0x3a0a('0x5'));var util=require(_0x3a0a('0x6'));var path=require(_0x3a0a('0x7'));var sox=require(_0x3a0a('0x8'));var csv=require(_0x3a0a('0x9'));var ejs=require(_0x3a0a('0xa'));var fs=require('fs');var fs_extra=require(_0x3a0a('0xb'));var _=require(_0x3a0a('0xc'));var squel=require(_0x3a0a('0xd'));var crypto=require(_0x3a0a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3a0a('0x9'));var querystring=require(_0x3a0a('0xf'));var Papa=require(_0x3a0a('0x10'));var Redis=require(_0x3a0a('0x11'));var authService=require(_0x3a0a('0x12'));var qs=require(_0x3a0a('0x13'));var as=require(_0x3a0a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3a0a('0x15'));var utils=require(_0x3a0a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3a0a('0x17'))['db'];function respondWithStatusCode(_0x1db53c,_0x52cb58){_0x52cb58=_0x52cb58||0xcc;return function(_0x2243d2){if(_0x2243d2){return _0x1db53c[_0x3a0a('0x18')](_0x52cb58);}return _0x1db53c[_0x3a0a('0x19')](_0x52cb58)[_0x3a0a('0x1a')]();};}function respondWithResult(_0x977120,_0x303dc7){_0x303dc7=_0x303dc7||0xc8;return function(_0x350d58){if(_0x350d58){return _0x977120[_0x3a0a('0x19')](_0x303dc7)[_0x3a0a('0x1b')](_0x350d58);}};}function respondWithFilteredResult(_0x21e0f7,_0x11eeee){return function(_0x22a60e){if(_0x22a60e){var _0x52f629=typeof _0x11eeee[_0x3a0a('0x1c')]==='undefined'&&typeof _0x11eeee[_0x3a0a('0x1d')]==='undefined';var _0x2f5e77=_0x22a60e[_0x3a0a('0x1e')];var _0x36582f=_0x52f629?0x0:_0x11eeee['offset'];var _0x104679=_0x52f629?_0x22a60e[_0x3a0a('0x1e')]:_0x11eeee['offset']+_0x11eeee[_0x3a0a('0x1d')];var _0x26f7bb;if(_0x104679>=_0x2f5e77){_0x104679=_0x2f5e77;_0x26f7bb=0xc8;}else{_0x26f7bb=0xce;}_0x21e0f7[_0x3a0a('0x19')](_0x26f7bb);return _0x21e0f7[_0x3a0a('0x1f')](_0x3a0a('0x20'),_0x36582f+'-'+_0x104679+'/'+_0x2f5e77)[_0x3a0a('0x1b')](_0x22a60e);}return null;};}function patchUpdates(_0x3e99f9){return function(_0x231541){try{jsonpatch[_0x3a0a('0x21')](_0x231541,_0x3e99f9,!![]);}catch(_0x430509){return BPromise['reject'](_0x430509);}return _0x231541['save']();};}function saveUpdates(_0x483039,_0x33560b){return function(_0x6681b2){if(_0x6681b2){return _0x6681b2[_0x3a0a('0x22')](_0x483039)[_0x3a0a('0x23')](function(_0x1468a9){return _0x1468a9;});}return null;};}function removeEntity(_0x49d60d,_0x280022){return function(_0x1d2eac){if(_0x1d2eac){return _0x1d2eac[_0x3a0a('0x24')]()['then'](function(){var _0x3a5955=_0x1d2eac[_0x3a0a('0x25')]({'plain':!![]});var _0x496348='IvrCampaigns';return db[_0x3a0a('0x26')][_0x3a0a('0x24')]({'where':{'type':_0x496348,'resourceId':_0x3a5955['id']}})[_0x3a0a('0x23')](function(){return _0x1d2eac;});})['then'](function(){_0x49d60d[_0x3a0a('0x19')](0xcc)[_0x3a0a('0x1a')]();});}};}function handleEntityNotFound(_0x130ca6,_0x188027){return function(_0x122e65){if(!_0x122e65){_0x130ca6['sendStatus'](0x194);}return _0x122e65;};}function handleError(_0x4a5481,_0x453040){_0x453040=_0x453040||0x1f4;return function(_0x3d01d8){logger['error'](_0x3d01d8['stack']);if(_0x3d01d8[_0x3a0a('0x27')]){delete _0x3d01d8[_0x3a0a('0x27')];}_0x4a5481[_0x3a0a('0x19')](_0x453040)[_0x3a0a('0x28')](_0x3d01d8);};}exports['index']=function(_0x5d7760,_0x38aaa0){var _0x23dd57={},_0x177181={},_0x4c99f9={'count':0x0,'rows':[]};var _0x1418b6=_[_0x3a0a('0x29')](db[_0x3a0a('0x2a')][_0x3a0a('0x2b')],function(_0x10b09f){return{'name':_0x10b09f[_0x3a0a('0x2c')],'type':_0x10b09f[_0x3a0a('0x2d')][_0x3a0a('0x2e')]};});_0x177181[_0x3a0a('0x2f')]=_['map'](_0x1418b6,_0x3a0a('0x27'));_0x177181[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x5d7760[_0x3a0a('0x30')]);_0x177181[_0x3a0a('0x32')]=_['intersection'](_0x177181[_0x3a0a('0x2f')],_0x177181[_0x3a0a('0x30')]);_0x23dd57[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x177181[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x5d7760['query'][_0x3a0a('0x35')]));_0x23dd57[_0x3a0a('0x33')]=_0x23dd57[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x23dd57[_0x3a0a('0x33')]:_0x177181[_0x3a0a('0x2f')];if(!_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x37')]('nolimit')){_0x23dd57[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x23dd57[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}_0x23dd57['order']=qs[_0x3a0a('0x38')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x23dd57[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x5d7760[_0x3a0a('0x30')],_0x177181[_0x3a0a('0x32')]),_0x1418b6);if(_0x5d7760[_0x3a0a('0x30')]['filter']){_0x23dd57[_0x3a0a('0x39')]=_['merge'](_0x23dd57[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x1418b6,function(_0x17b5b3){if(_0x17b5b3[_0x3a0a('0x2d')]!=='VIRTUAL'){var _0x425c95={};_0x425c95[_0x17b5b3['name']]={'$like':'%'+_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x425c95;}})});}_0x23dd57=_[_0x3a0a('0x3c')]({},_0x23dd57,_0x5d7760[_0x3a0a('0x3d')]);var _0x4d32f8={'where':_0x23dd57[_0x3a0a('0x39')]};return db['Campaign']['count'](_0x4d32f8)[_0x3a0a('0x23')](function(_0x4f9b60){_0x4c99f9['count']=_0x4f9b60;if(_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x23dd57['include']=[{'all':!![]}];}return db[_0x3a0a('0x2a')][_0x3a0a('0x3f')](_0x23dd57);})[_0x3a0a('0x23')](function(_0xd16d0){_0x4c99f9[_0x3a0a('0x40')]=_0xd16d0;return _0x4c99f9;})['then'](respondWithFilteredResult(_0x38aaa0,_0x23dd57))[_0x3a0a('0x41')](handleError(_0x38aaa0,null));};exports[_0x3a0a('0x42')]=function(_0x2b4a6b,_0x34ea81){var _0x45e170={'raw':![],'where':{'id':_0x2b4a6b[_0x3a0a('0x43')]['id']}},_0x34e633={};_0x34e633[_0x3a0a('0x2f')]=_['keys'](db['Campaign'][_0x3a0a('0x2b')]);_0x34e633[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x2b4a6b['query']);_0x34e633[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x34e633[_0x3a0a('0x2f')],_0x34e633[_0x3a0a('0x30')]);_0x45e170['attributes']=_[_0x3a0a('0x34')](_0x34e633['model'],qs[_0x3a0a('0x35')](_0x2b4a6b['query'][_0x3a0a('0x35')]));_0x45e170['attributes']=_0x45e170[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x45e170['attributes']:_0x34e633['model'];if(_0x2b4a6b[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x45e170[_0x3a0a('0x44')]=[{'all':!![]}];}_0x45e170=_[_0x3a0a('0x3c')]({},_0x45e170,_0x2b4a6b[_0x3a0a('0x3d')]);return db[_0x3a0a('0x2a')]['find'](_0x45e170)['then'](handleEntityNotFound(_0x34ea81,null))[_0x3a0a('0x23')](respondWithResult(_0x34ea81,null))[_0x3a0a('0x41')](handleError(_0x34ea81,null));};exports['create']=function(_0x48aa92,_0x1ef695){return db['Campaign'][_0x3a0a('0x45')](_0x48aa92[_0x3a0a('0x46')],{})[_0x3a0a('0x23')](function(_0x34677a){var _0x385f83=_0x48aa92[_0x3a0a('0x47')]['get']({'plain':!![]});if(!_0x385f83)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x385f83[_0x3a0a('0x48')]===_0x3a0a('0x47')){var _0x201dca=_0x34677a[_0x3a0a('0x25')]({'plain':!![]});var _0x26f46c='IvrCampaigns';return db[_0x3a0a('0x49')][_0x3a0a('0x4a')]({'where':{'name':_0x26f46c,'userProfileId':_0x385f83['userProfileId']},'raw':!![]})['then'](function(_0x37d62d){if(_0x37d62d&&_0x37d62d[_0x3a0a('0x4b')]===0x0){return db[_0x3a0a('0x26')][_0x3a0a('0x45')]({'name':_0x201dca[_0x3a0a('0x27')],'resourceId':_0x201dca['id'],'type':_0x37d62d[_0x3a0a('0x27')],'sectionId':_0x37d62d['id']},{})[_0x3a0a('0x23')](function(){return _0x34677a;});}else{return _0x34677a;}})['catch'](function(_0x2905b7){logger[_0x3a0a('0x4c')](_0x3a0a('0x4d'),_0x2905b7);throw _0x2905b7;});}return _0x34677a;})[_0x3a0a('0x23')](respondWithResult(_0x1ef695,0xc9))[_0x3a0a('0x41')](handleError(_0x1ef695,null));};exports[_0x3a0a('0x4e')]=function(_0x93e846,_0x2ebdec){var _0x2cc478={'where':{'id':_0x93e846[_0x3a0a('0x43')]['id']}},_0x3fe96a={};_0x3fe96a[_0x3a0a('0x2f')]=_[_0x3a0a('0x31')](db['Campaign'][_0x3a0a('0x2b')]);_0x2cc478[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x3fe96a['model'],qs['fields'](_0x93e846[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x2cc478[_0x3a0a('0x33')]=_0x2cc478['attributes']['length']?_0x2cc478[_0x3a0a('0x33')]:_0x3fe96a[_0x3a0a('0x2f')];if(_0x93e846[_0x3a0a('0x30')]['includeAll']){_0x2cc478[_0x3a0a('0x44')]=[{'all':!![]}];}_0x2cc478=_[_0x3a0a('0x3c')]({},_0x2cc478,_0x93e846[_0x3a0a('0x3d')]);return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')](_0x2cc478)['then'](handleEntityNotFound(_0x2ebdec,null))[_0x3a0a('0x23')](function(_0x5d3081){if(_0x5d3081){var _0x40df97=_0x5d3081[_0x3a0a('0x25')]({'plain':!![]});_0x40df97=qs[_0x3a0a('0x4f')](_0x40df97,['id',_0x3a0a('0x50'),'updatedAt']);_0x93e846[_0x3a0a('0x46')]=_['omit'](_0x93e846[_0x3a0a('0x46')],['id',_0x3a0a('0x50'),_0x3a0a('0x51')]);return db[_0x3a0a('0x2a')][_0x3a0a('0x45')](_[_0x3a0a('0x3c')](_0x40df97,_0x93e846[_0x3a0a('0x46')]),{'include':_0x93e846[_0x3a0a('0x30')][_0x3a0a('0x3e')]?[{'all':!![]}]:undefined})[_0x3a0a('0x23')](function(_0x25a7c8){var _0x8e7485=_0x93e846[_0x3a0a('0x47')][_0x3a0a('0x25')]({'plain':!![]});if(!_0x8e7485)throw new Error(_0x3a0a('0x52'));if(_0x8e7485[_0x3a0a('0x48')]===_0x3a0a('0x47')){var _0x3c8166=_0x25a7c8[_0x3a0a('0x25')]({'plain':!![]});var _0x182ba6='IvrCampaigns';return db[_0x3a0a('0x49')][_0x3a0a('0x4a')]({'where':{'name':_0x182ba6,'userProfileId':_0x8e7485[_0x3a0a('0x53')]},'raw':!![]})[_0x3a0a('0x23')](function(_0x2c807a){if(_0x2c807a&&_0x2c807a[_0x3a0a('0x4b')]===0x0){return db[_0x3a0a('0x26')][_0x3a0a('0x45')]({'name':_0x3c8166[_0x3a0a('0x27')],'resourceId':_0x3c8166['id'],'type':_0x2c807a[_0x3a0a('0x27')],'sectionId':_0x2c807a['id']},{})[_0x3a0a('0x23')](function(){return _0x25a7c8;});}else{return _0x25a7c8;}})[_0x3a0a('0x41')](function(_0x1a3227){logger[_0x3a0a('0x4c')](_0x3a0a('0x4d'),_0x1a3227);throw _0x1a3227;});}return _0x25a7c8;});}})['then'](respondWithResult(_0x2ebdec,0xc9))['catch'](handleError(_0x2ebdec,null));};exports['update']=function(_0x21b82c,_0x4ba52b){if(_0x21b82c[_0x3a0a('0x46')]['id']){delete _0x21b82c['body']['id'];}return db[_0x3a0a('0x2a')]['find']({'where':{'id':_0x21b82c[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x4ba52b,null))['then'](saveUpdates(_0x21b82c[_0x3a0a('0x46')],null))['then'](respondWithResult(_0x4ba52b,null))[_0x3a0a('0x41')](handleError(_0x4ba52b,null));};exports[_0x3a0a('0x24')]=function(_0x2474ff,_0x2b0507){return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x2474ff['params']['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x2b0507,null))[_0x3a0a('0x23')](removeEntity(_0x2b0507,null))[_0x3a0a('0x41')](handleError(_0x2b0507,null));};exports[_0x3a0a('0x54')]=function(_0x476e45,_0x34f09a,_0x23836c){var _0x5404a9={'raw':!![],'where':{}};var _0x53f68e={};var _0x183e88={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')]['findOne']({'where':{'id':_0x476e45[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x34f09a,null))['then'](function(_0x535379){if(_0x535379){_0x53f68e['model']=_[_0x3a0a('0x31')](db[_0x3a0a('0x55')]['rawAttributes']);_0x53f68e[_0x3a0a('0x30')]=_['keys'](_0x476e45[_0x3a0a('0x30')]);_0x53f68e[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x53f68e[_0x3a0a('0x2f')],_0x53f68e[_0x3a0a('0x30')]);_0x5404a9[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x53f68e[_0x3a0a('0x2f')],qs['fields'](_0x476e45['query']['fields']));_0x5404a9[_0x3a0a('0x33')]=_0x5404a9[_0x3a0a('0x33')]['length']?_0x5404a9[_0x3a0a('0x33')]:_0x53f68e[_0x3a0a('0x2f')];if(!_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x5404a9['limit']=qs[_0x3a0a('0x1d')](_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x5404a9[_0x3a0a('0x1c')]=qs['offset'](_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}_0x5404a9[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x476e45['query'][_0x3a0a('0x38')]);_0x5404a9[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x476e45[_0x3a0a('0x30')],_0x53f68e['filters']));_0x5404a9[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x535379['id'];if(_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x5404a9[_0x3a0a('0x39')]=_['merge'](_0x5404a9[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x5404a9['attributes'],function(_0x3872a3){var _0x27187b={};_0x27187b[_0x3872a3]={'$like':'%'+_0x476e45[_0x3a0a('0x30')]['filter']+'%'};return _0x27187b;})});}_0x5404a9=_[_0x3a0a('0x3c')]({},_0x5404a9,_0x476e45[_0x3a0a('0x3d')]);return db['CmHopper'][_0x3a0a('0x1e')]({'where':_0x5404a9[_0x3a0a('0x39')]})['then'](function(_0x226331){_0x183e88[_0x3a0a('0x1e')]=_0x226331;if(_0x476e45[_0x3a0a('0x30')]['includeAll']){_0x5404a9['include']=[{'all':!![]}];}return db[_0x3a0a('0x55')][_0x3a0a('0x3f')](_0x5404a9);})[_0x3a0a('0x23')](function(_0xfa7c6a){_0x183e88[_0x3a0a('0x40')]=_0xfa7c6a;return _0x183e88;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x34f09a,_0x5404a9))[_0x3a0a('0x41')](handleError(_0x34f09a,null));};exports['getHopperHistories']=function(_0x37521a,_0x27315d,_0x426ae5){var _0x4a9744={'raw':!![],'where':{}};var _0x26b9a2={};var _0x489e7f={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')][_0x3a0a('0x59')]({'where':{'id':_0x37521a[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x27315d,null))['then'](function(_0x479733){if(_0x479733){_0x26b9a2['model']=_['keys'](db['CmHopperHistory'][_0x3a0a('0x2b')]);_0x26b9a2[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x37521a[_0x3a0a('0x30')]);_0x26b9a2[_0x3a0a('0x32')]=_['intersection'](_0x26b9a2[_0x3a0a('0x2f')],_0x26b9a2[_0x3a0a('0x30')]);_0x4a9744[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x26b9a2[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x4a9744[_0x3a0a('0x33')]=_0x4a9744[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x4a9744[_0x3a0a('0x33')]:_0x26b9a2[_0x3a0a('0x2f')];if(!_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x4a9744[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x37521a['query'][_0x3a0a('0x1d')]);_0x4a9744['offset']=qs[_0x3a0a('0x1c')](_0x37521a[_0x3a0a('0x30')]['offset']);}_0x4a9744[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x4a9744[_0x3a0a('0x39')]=qs['filters'](_[_0x3a0a('0x3a')](_0x37521a[_0x3a0a('0x30')],_0x26b9a2[_0x3a0a('0x32')]));_0x4a9744[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x479733['id'];if(_0x37521a['query'][_0x3a0a('0x3b')]){_0x4a9744['where']=_[_0x3a0a('0x3c')](_0x4a9744[_0x3a0a('0x39')],{'$or':_['map'](_0x4a9744[_0x3a0a('0x33')],function(_0x5beab5){var _0x46f2d0={};_0x46f2d0[_0x5beab5]={'$like':'%'+_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x46f2d0;})});}_0x4a9744=_[_0x3a0a('0x3c')]({},_0x4a9744,_0x37521a[_0x3a0a('0x3d')]);return db[_0x3a0a('0x5a')][_0x3a0a('0x1e')]({'where':_0x4a9744[_0x3a0a('0x39')]})[_0x3a0a('0x23')](function(_0x55f6af){_0x489e7f[_0x3a0a('0x1e')]=_0x55f6af;if(_0x37521a[_0x3a0a('0x30')]['includeAll']){_0x4a9744['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x3a0a('0x3f')](_0x4a9744);})['then'](function(_0x2f1415){_0x489e7f['rows']=_0x2f1415;return _0x489e7f;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x27315d,_0x4a9744))['catch'](handleError(_0x27315d,null));};exports[_0x3a0a('0x5b')]=function(_0x1aa7a1,_0x23dfb2,_0x3bf50a){var _0x2f6c41={'raw':!![],'where':{}};var _0x471d3a={};var _0x374390={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')][_0x3a0a('0x59')]({'where':{'id':_0x1aa7a1[_0x3a0a('0x43')]['id']}})['then'](handleEntityNotFound(_0x23dfb2,null))[_0x3a0a('0x23')](function(_0x41fe0b){if(_0x41fe0b){_0x471d3a[_0x3a0a('0x2f')]=_[_0x3a0a('0x31')](db['CmHopperFinal'][_0x3a0a('0x2b')]);_0x471d3a['query']=_[_0x3a0a('0x31')](_0x1aa7a1[_0x3a0a('0x30')]);_0x471d3a['filters']=_[_0x3a0a('0x34')](_0x471d3a[_0x3a0a('0x2f')],_0x471d3a['query']);_0x2f6c41[_0x3a0a('0x33')]=_['intersection'](_0x471d3a[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x1aa7a1['query'][_0x3a0a('0x35')]));_0x2f6c41[_0x3a0a('0x33')]=_0x2f6c41[_0x3a0a('0x33')]['length']?_0x2f6c41[_0x3a0a('0x33')]:_0x471d3a[_0x3a0a('0x2f')];if(!_0x1aa7a1[_0x3a0a('0x30')]['hasOwnProperty'](_0x3a0a('0x56'))){_0x2f6c41[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x1aa7a1[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x2f6c41[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x1aa7a1[_0x3a0a('0x30')]['offset']);}_0x2f6c41['order']=qs[_0x3a0a('0x38')](_0x1aa7a1[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x2f6c41[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x1aa7a1[_0x3a0a('0x30')],_0x471d3a[_0x3a0a('0x32')]));_0x2f6c41[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x41fe0b['id'];if(_0x1aa7a1[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x2f6c41[_0x3a0a('0x39')]=_[_0x3a0a('0x3c')](_0x2f6c41[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x2f6c41[_0x3a0a('0x33')],function(_0x5c27d0){var _0x50cada={};_0x50cada[_0x5c27d0]={'$like':'%'+_0x1aa7a1[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x50cada;})});}_0x2f6c41=_['merge']({},_0x2f6c41,_0x1aa7a1[_0x3a0a('0x3d')]);return db[_0x3a0a('0x5c')][_0x3a0a('0x1e')]({'where':_0x2f6c41['where']})[_0x3a0a('0x23')](function(_0x1bd9c6){_0x374390[_0x3a0a('0x1e')]=_0x1bd9c6;if(_0x1aa7a1['query'][_0x3a0a('0x3e')]){_0x2f6c41['include']=[{'all':!![]}];}return db[_0x3a0a('0x5c')]['findAll'](_0x2f6c41);})[_0x3a0a('0x23')](function(_0x13ea2a){_0x374390['rows']=_0x13ea2a;return _0x374390;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x23dfb2,_0x2f6c41))['catch'](handleError(_0x23dfb2,null));};exports[_0x3a0a('0x5d')]=function(_0x26e790,_0x384dde,_0x33a254){var _0x2d828a={'raw':!![],'where':{}};var _0x389af5={};var _0x320ef5={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')][_0x3a0a('0x59')]({'where':{'id':_0x26e790[_0x3a0a('0x43')]['id']}})['then'](handleEntityNotFound(_0x384dde,null))[_0x3a0a('0x23')](function(_0x26113f){if(_0x26113f){_0x389af5[_0x3a0a('0x2f')]=_['keys'](db[_0x3a0a('0x5e')][_0x3a0a('0x2b')]);_0x389af5[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x26e790['query']);_0x389af5[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x389af5['model'],_0x389af5[_0x3a0a('0x30')]);_0x2d828a[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x389af5['model'],qs[_0x3a0a('0x35')](_0x26e790['query'][_0x3a0a('0x35')]));_0x2d828a[_0x3a0a('0x33')]=_0x2d828a[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x2d828a[_0x3a0a('0x33')]:_0x389af5[_0x3a0a('0x2f')];if(!_0x26e790[_0x3a0a('0x30')]['hasOwnProperty']('nolimit')){_0x2d828a[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x26e790['query']['limit']);_0x2d828a['offset']=qs[_0x3a0a('0x1c')](_0x26e790['query'][_0x3a0a('0x1c')]);}_0x2d828a['order']=qs[_0x3a0a('0x38')](_0x26e790[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x2d828a['where']=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x26e790[_0x3a0a('0x30')],_0x389af5[_0x3a0a('0x32')]));_0x2d828a[_0x3a0a('0x39')]['CampaignId']=_0x26113f['id'];if(_0x26e790['query']['filter']){_0x2d828a[_0x3a0a('0x39')]=_[_0x3a0a('0x3c')](_0x2d828a[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x2d828a[_0x3a0a('0x33')],function(_0x40a39f){var _0x529090={};_0x529090[_0x40a39f]={'$like':'%'+_0x26e790[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x529090;})});}_0x2d828a=_['merge']({},_0x2d828a,_0x26e790[_0x3a0a('0x3d')]);return db['CmHopperBlack']['count']({'where':_0x2d828a[_0x3a0a('0x39')]})[_0x3a0a('0x23')](function(_0x2fcc06){_0x320ef5['count']=_0x2fcc06;if(_0x26e790[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x2d828a[_0x3a0a('0x44')]=[{'all':!![]}];}return db[_0x3a0a('0x5e')]['findAll'](_0x2d828a);})[_0x3a0a('0x23')](function(_0x36d289){_0x320ef5[_0x3a0a('0x40')]=_0x36d289;return _0x320ef5;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x384dde,_0x2d828a))['catch'](handleError(_0x384dde,null));};exports[_0x3a0a('0x5f')]=function(_0x2fcdc6,_0x257d2f,_0x3f9d67){var _0x448cac={};var _0x51a37a={};var _0x24e245;var _0x1f2e1a;return db['Campaign'][_0x3a0a('0x59')]({'where':{'id':_0x2fcdc6[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x257d2f,null))[_0x3a0a('0x23')](function(_0x5e96ee){if(_0x5e96ee){_0x24e245=_0x5e96ee;_0x51a37a['model']=_[_0x3a0a('0x31')](db[_0x3a0a('0x60')][_0x3a0a('0x2b')]);_0x51a37a['query']=_['keys'](_0x2fcdc6[_0x3a0a('0x30')]);_0x51a37a['filters']=_['intersection'](_0x51a37a['model'],_0x51a37a['query']);_0x448cac['attributes']=_['intersection'](_0x51a37a['model'],qs['fields'](_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x448cac['attributes']=_0x448cac[_0x3a0a('0x33')]['length']?_0x448cac['attributes']:_0x51a37a[_0x3a0a('0x2f')];_0x448cac[_0x3a0a('0x57')]=qs['sort'](_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x448cac['where']=qs['filters'](_[_0x3a0a('0x3a')](_0x2fcdc6[_0x3a0a('0x30')],_0x51a37a['filters']));if(_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x448cac[_0x3a0a('0x39')]=_[_0x3a0a('0x3c')](_0x448cac[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x448cac[_0x3a0a('0x33')],function(_0xc42873){var _0x4ef309={};_0x4ef309[_0xc42873]={'$like':'%'+_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x4ef309;})});}_0x448cac=_[_0x3a0a('0x3c')]({},_0x448cac,_0x2fcdc6['options']);return _0x24e245[_0x3a0a('0x5f')](_0x448cac);}})['then'](function(_0x50b6bb){if(_0x50b6bb){_0x1f2e1a=_0x50b6bb[_0x3a0a('0x36')];if(!_0x2fcdc6[_0x3a0a('0x30')]['hasOwnProperty'](_0x3a0a('0x56'))){_0x448cac[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x448cac[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}return _0x24e245[_0x3a0a('0x5f')](_0x448cac);}})[_0x3a0a('0x23')](function(_0x22efd9){if(_0x22efd9){return _0x22efd9?{'count':_0x1f2e1a,'rows':_0x22efd9}:null;}})[_0x3a0a('0x23')](respondWithResult(_0x257d2f,null))[_0x3a0a('0x41')](handleError(_0x257d2f,null));};exports['addLists']=function(_0x6dda21,_0x1dcee2,_0x4eb4be){var _0x1dc909,_0x10192d;var _0x11f067=[];var _0xdb9665=moment()[_0x3a0a('0x61')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x6dda21[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x1dcee2,null))['then'](function(_0x211cfd){if(_0x211cfd){_0x10192d=_0x211cfd;return _0x211cfd[_0x3a0a('0x62')](_0x6dda21['body'][_0x3a0a('0x63')],_[_0x3a0a('0x4f')](_0x6dda21[_0x3a0a('0x46')],[_0x3a0a('0x63'),'id'])||{});}return null;})[_0x3a0a('0x64')](function(_0x5edd19){var _0x488779;var _0x225721;_0x1dc909=_0x5edd19||[];var _0x5f55c5=[];if(_0x5edd19){for(var _0x113fb9=0x0;_0x113fb9<_0x5edd19['length'];_0x113fb9+=0x1){var _0x1316e8=_0x5edd19[_0x113fb9][_0x3a0a('0x25')]({'plain':!![]});_0x10192d['dialCheckDuplicateType']=_0x6dda21[_0x3a0a('0x46')]['dialCheckDuplicateType']?_0x6dda21['body'][_0x3a0a('0x65')]:_0x10192d[_0x3a0a('0x65')];switch(_0x10192d[_0x3a0a('0x65')]){case _0x3a0a('0x66'):_0x488779=squel[_0x3a0a('0x67')]()[_0x3a0a('0x68')](_0x3a0a('0x69'))[_0x3a0a('0x6a')]([_0x3a0a('0x6b'),_0x3a0a('0x6c'),_0x3a0a('0x6d'),_0x3a0a('0x6e'),_0x3a0a('0x58'),_0x3a0a('0x50'),'updatedAt'],squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')](_0x3a0a('0x6b'),'phone')[_0x3a0a('0x70')](_0x3a0a('0x71'),_0x3a0a('0x6c'))['field']('id',_0x3a0a('0x6d'))[_0x3a0a('0x70')](_0x1316e8[_0x3a0a('0x72')]['toString'](),_0x3a0a('0x6e'))[_0x3a0a('0x70')](_0x6dda21[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')](),_0x3a0a('0x58'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x50'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x51'))[_0x3a0a('0x74')](_0x3a0a('0x75'))[_0x3a0a('0x39')](_0x3a0a('0x76'))[_0x3a0a('0x39')](_0x3a0a('0x77'),_0x1316e8['CmListId']['toString']())[_0x3a0a('0x39')](_0x3a0a('0x78'))[_0x3a0a('0x39')](_0x3a0a('0x79'),squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')](_0x3a0a('0x7a'))[_0x3a0a('0x74')](_0x3a0a('0x7b'))['where'](_0x3a0a('0x7c'),_0x6dda21[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')]('COALESCE(phone,\x27\x27)')[_0x3a0a('0x74')]('cm_hopper')['where'](_0x3a0a('0x7c'),_0x6dda21['params']['id'][_0x3a0a('0x73')]())))[_0x3a0a('0x73')]();break;case _0x3a0a('0x7d'):_0x488779=squel[_0x3a0a('0x67')]()[_0x3a0a('0x68')](_0x3a0a('0x69'))[_0x3a0a('0x6a')]([_0x3a0a('0x6b'),_0x3a0a('0x6c'),'ContactId','ListId',_0x3a0a('0x58'),_0x3a0a('0x50'),_0x3a0a('0x51')],squel[_0x3a0a('0x6f')]()['field'](_0x3a0a('0x6b'),_0x3a0a('0x6b'))[_0x3a0a('0x70')](_0x3a0a('0x71'),_0x3a0a('0x6c'))[_0x3a0a('0x70')]('id',_0x3a0a('0x6d'))['field'](_0x1316e8[_0x3a0a('0x72')][_0x3a0a('0x73')](),_0x3a0a('0x6e'))[_0x3a0a('0x70')](_0x6dda21[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')](),_0x3a0a('0x58'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x50'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x51'))[_0x3a0a('0x74')](_0x3a0a('0x75'))[_0x3a0a('0x39')](_0x3a0a('0x76'))['where']('ListId\x20=\x20?',_0x1316e8[_0x3a0a('0x72')][_0x3a0a('0x73')]())[_0x3a0a('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x3a0a('0x39')](_0x3a0a('0x79'),squel['select']()['field'](_0x3a0a('0x7e'))[_0x3a0a('0x74')](_0x3a0a('0x69'))[_0x3a0a('0x39')](_0x3a0a('0x7c'),_0x6dda21[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')]())))[_0x3a0a('0x73')]();break;default:_0x488779=squel[_0x3a0a('0x67')]()['into']('cm_hopper')['fromQuery']([_0x3a0a('0x6b'),_0x3a0a('0x6c'),'ContactId',_0x3a0a('0x6e'),_0x3a0a('0x58'),_0x3a0a('0x50'),_0x3a0a('0x51')],squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')]('phone',_0x3a0a('0x6b'))[_0x3a0a('0x70')]('NOW()',_0x3a0a('0x6c'))[_0x3a0a('0x70')]('id',_0x3a0a('0x6d'))['field'](_0x1316e8[_0x3a0a('0x72')][_0x3a0a('0x73')](),_0x3a0a('0x6e'))[_0x3a0a('0x70')](_0x6dda21['params']['id'][_0x3a0a('0x73')](),'CampaignId')[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x50'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27','updatedAt')[_0x3a0a('0x74')](_0x3a0a('0x75'))['where'](_0x3a0a('0x76'))[_0x3a0a('0x39')](_0x3a0a('0x77'),_0x1316e8[_0x3a0a('0x72')][_0x3a0a('0x73')]())[_0x3a0a('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x3a0a('0x73')]();}_0x225721=squel['insert']()[_0x3a0a('0x68')](_0x3a0a('0x7f'))['fromQuery']([_0x3a0a('0x80'),_0x3a0a('0x6c'),_0x3a0a('0x6b'),_0x3a0a('0x81'),'createdAt',_0x3a0a('0x51')],squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')](_0x3a0a('0x82'),'id')[_0x3a0a('0x70')](_0x3a0a('0x71'),_0x3a0a('0x6c'))[_0x3a0a('0x70')](_0x3a0a('0x83'),'phone')['field'](_0x3a0a('0x84'),'OrderBy')['field']('\x27'+_0xdb9665+'\x27',_0x3a0a('0x50'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x51'))[_0x3a0a('0x74')]('cm_contact_has_items','ci')[_0x3a0a('0x85')](_0x3a0a('0x69'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x3a0a('0x39')]('h.ListId\x20=\x20?',_0x1316e8[_0x3a0a('0x72')]['toString']())[_0x3a0a('0x39')]('h.CampaignId=?',_0x6dda21[_0x3a0a('0x43')]['id']['toString']())[_0x3a0a('0x39')]('h.createdAt\x20=\x20?',_0xdb9665))[_0x3a0a('0x73')]();_0x5f55c5['push'](db[_0x3a0a('0x86')][_0x3a0a('0x30')](_0x488779));_0x11f067[_0x3a0a('0x87')](db[_0x3a0a('0x86')][_0x3a0a('0x30')](_0x225721));}return BPromise['all'](_0x5f55c5);}})[_0x3a0a('0x23')](function(){return BPromise[_0x3a0a('0x88')](_0x11f067);})['then'](function(){return _0x1dc909;})[_0x3a0a('0x23')](respondWithResult(_0x1dcee2,null))[_0x3a0a('0x41')](handleError(_0x1dcee2,null));};exports[_0x3a0a('0x89')]=function(_0x16cd16,_0x34890f,_0x4ecc8d){return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x16cd16[_0x3a0a('0x43')]['id']}})['then'](handleEntityNotFound(_0x34890f,null))[_0x3a0a('0x23')](function(_0x3706c5){if(_0x3706c5){return _0x3706c5[_0x3a0a('0x89')](_0x16cd16['query'][_0x3a0a('0x63')]);}})[_0x3a0a('0x23')](function(_0x516769){if(_0x516769){return db[_0x3a0a('0x55')][_0x3a0a('0x24')]({'where':{'ListId':_0x16cd16[_0x3a0a('0x30')][_0x3a0a('0x63')],'CampaignId':_0x16cd16[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](function(){return _0x516769;});}})[_0x3a0a('0x23')](respondWithStatusCode(_0x34890f,null))['catch'](handleError(_0x34890f,null));};exports[_0x3a0a('0x8a')]=function(_0x20ca4c,_0x3a0792,_0x190975){var _0x2385f9={};var _0x2751d3={};var _0x84b6db;var _0x7ccdaf;return db[_0x3a0a('0x2a')]['findOne']({'where':{'id':_0x20ca4c[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x3a0792,null))[_0x3a0a('0x23')](function(_0x12a796){if(_0x12a796){_0x84b6db=_0x12a796;_0x2751d3[_0x3a0a('0x2f')]=_[_0x3a0a('0x31')](db[_0x3a0a('0x60')]['rawAttributes']);_0x2751d3[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x20ca4c[_0x3a0a('0x30')]);_0x2751d3[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x2751d3[_0x3a0a('0x2f')],_0x2751d3[_0x3a0a('0x30')]);_0x2385f9['attributes']=_[_0x3a0a('0x34')](_0x2751d3[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x2385f9[_0x3a0a('0x33')]=_0x2385f9[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x2385f9['attributes']:_0x2751d3[_0x3a0a('0x2f')];_0x2385f9[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x20ca4c['query'][_0x3a0a('0x38')]);_0x2385f9['where']=qs['filters'](_[_0x3a0a('0x3a')](_0x20ca4c['query'],_0x2751d3[_0x3a0a('0x32')]));if(_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x2385f9[_0x3a0a('0x39')]=_[_0x3a0a('0x3c')](_0x2385f9[_0x3a0a('0x39')],{'$or':_['map'](_0x2385f9['attributes'],function(_0x15ad10){var _0x3c9447={};_0x3c9447[_0x15ad10]={'$like':'%'+_0x20ca4c['query'][_0x3a0a('0x3b')]+'%'};return _0x3c9447;})});}_0x2385f9=_[_0x3a0a('0x3c')]({},_0x2385f9,_0x20ca4c[_0x3a0a('0x3d')]);return _0x84b6db[_0x3a0a('0x8a')](_0x2385f9);}})[_0x3a0a('0x23')](function(_0x146304){if(_0x146304){_0x7ccdaf=_0x146304[_0x3a0a('0x36')];if(!_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x2385f9[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x2385f9[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}return _0x84b6db[_0x3a0a('0x8a')](_0x2385f9);}})[_0x3a0a('0x23')](function(_0xeb71a7){if(_0xeb71a7){return _0xeb71a7?{'count':_0x7ccdaf,'rows':_0xeb71a7}:null;}})['then'](respondWithResult(_0x3a0792,null))[_0x3a0a('0x41')](handleError(_0x3a0792,null));};exports[_0x3a0a('0x8b')]=function(_0x2de985,_0x3c402c,_0x230670){var _0x4d1ee3,_0x423d6d;var _0x4eb5df=[];var _0x368231=moment()[_0x3a0a('0x61')](_0x3a0a('0x8c'));return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x2de985[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x3c402c,null))['then'](function(_0x58a7b9){if(_0x58a7b9){_0x423d6d=_0x58a7b9;return _0x58a7b9[_0x3a0a('0x8b')](_0x2de985[_0x3a0a('0x46')][_0x3a0a('0x63')],_['omit'](_0x2de985[_0x3a0a('0x46')],[_0x3a0a('0x63'),'id'])||{});}return null;})[_0x3a0a('0x64')](function(_0x4ec022){var _0x34db7d;var _0x579f30;_0x4d1ee3=_0x4ec022||[];var _0x365c38=[];if(_0x4ec022){for(var _0x1b2d91=0x0;_0x1b2d91<_0x4ec022[_0x3a0a('0x36')];_0x1b2d91+=0x1){var _0x339980=_0x4ec022[_0x1b2d91]['get']({'plain':!![]});_0x34db7d=squel[_0x3a0a('0x67')]()[_0x3a0a('0x68')](_0x3a0a('0x8d'))[_0x3a0a('0x6a')]([_0x3a0a('0x6b'),_0x3a0a('0x6d'),_0x3a0a('0x6e'),_0x3a0a('0x58'),_0x3a0a('0x50'),_0x3a0a('0x51')],squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')](_0x3a0a('0x6b'),_0x3a0a('0x6b'))[_0x3a0a('0x70')]('id',_0x3a0a('0x6d'))['field'](_0x339980[_0x3a0a('0x72')][_0x3a0a('0x73')](),_0x3a0a('0x6e'))['field'](_0x2de985[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')](),_0x3a0a('0x58'))['field'](_0x3a0a('0x71'),_0x3a0a('0x50'))[_0x3a0a('0x70')](_0x3a0a('0x71'),_0x3a0a('0x51'))[_0x3a0a('0x74')](_0x3a0a('0x75'))[_0x3a0a('0x39')](_0x3a0a('0x76'))[_0x3a0a('0x39')]('ListId\x20=\x20?',_0x339980[_0x3a0a('0x72')][_0x3a0a('0x73')]())[_0x3a0a('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x3a0a('0x73')]();_0x365c38[_0x3a0a('0x87')](db['sequelize'][_0x3a0a('0x30')](_0x34db7d));}return BPromise[_0x3a0a('0x88')](_0x365c38);}})['then'](function(){return _0x4d1ee3;})[_0x3a0a('0x23')](respondWithResult(_0x3c402c,null))['catch'](handleError(_0x3c402c,null));};exports[_0x3a0a('0x8e')]=function(_0x859139,_0x185016,_0x5ed8c8){return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x859139['params']['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x185016,null))[_0x3a0a('0x23')](function(_0xff99e8){if(_0xff99e8){return _0xff99e8[_0x3a0a('0x8e')](_0x859139[_0x3a0a('0x30')][_0x3a0a('0x63')]);}})[_0x3a0a('0x23')](function(_0x3ddec4){if(_0x3ddec4){return db[_0x3a0a('0x5e')]['destroy']({'where':{'ListId':_0x859139[_0x3a0a('0x30')][_0x3a0a('0x63')],'CampaignId':_0x859139[_0x3a0a('0x43')]['id']}})['then'](function(){return _0x3ddec4;});}})[_0x3a0a('0x23')](respondWithStatusCode(_0x185016,null))['catch'](handleError(_0x185016,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 4856fed..5850c00 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_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':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index d5fe382..2f448f9 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 _0xd240=['include','map','model','stringify','GetCampaign','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Campaign,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','findAll','options','where','attributes','limit'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xd240,0x1c7));var _0x0d24=function(_0x37b94c,_0x243d65){_0x37b94c=_0x37b94c-0x0;var _0x3f9746=_0xd240[_0x37b94c];return _0x3f9746;};'use strict';var _=require('lodash');var util=require(_0x0d24('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d24('0x1'));var fs=require('fs');var Redis=require(_0x0d24('0x2'));var db=require(_0x0d24('0x3'))['db'];var utils=require(_0x0d24('0x4'));var logger=require(_0x0d24('0x5'))(_0x0d24('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d24('0x7')][_0x0d24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1005ff,_0x250141,_0x48fb91){return new BPromise(function(_0xdb2d81,_0x2fdf4a){return client[_0x0d24('0x9')](_0x1005ff,_0x48fb91)[_0x0d24('0xa')](function(_0x58b925){logger[_0x0d24('0xb')](_0x0d24('0xc'),_0x250141,'request\x20sent');logger[_0x0d24('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x250141,_0x0d24('0xe'),JSON['stringify'](_0x58b925));if(_0x58b925[_0x0d24('0xf')]){if(_0x58b925[_0x0d24('0xf')][_0x0d24('0x10')]===0x1f4){logger['error']('Campaign,\x20%s,\x20%s',_0x250141,_0x58b925[_0x0d24('0xf')][_0x0d24('0x11')]);return _0x2fdf4a(_0x58b925[_0x0d24('0xf')]['message']);}logger[_0x0d24('0xf')](_0x0d24('0xc'),_0x250141,_0x58b925['error']['message']);return _0xdb2d81(_0x58b925[_0x0d24('0xf')][_0x0d24('0x11')]);}else{logger[_0x0d24('0xb')](_0x0d24('0xc'),_0x250141,_0x0d24('0xe'));_0xdb2d81(_0x58b925[_0x0d24('0x12')][_0x0d24('0x11')]);}})[_0x0d24('0x13')](function(_0x47ee4b){logger[_0x0d24('0xf')](_0x0d24('0xc'),_0x250141,_0x47ee4b);_0x2fdf4a(_0x47ee4b);});});}exports['GetCampaign']=function(_0xacfbd6){var _0x1c5899=this;return new Promise(function(_0x12204f,_0x151030){return db['Campaign'][_0x0d24('0x14')]({'raw':_0xacfbd6[_0x0d24('0x15')]?_0xacfbd6['options']['raw']===undefined?!![]:![]:!![],'where':_0xacfbd6[_0x0d24('0x15')]?_0xacfbd6[_0x0d24('0x15')][_0x0d24('0x16')]||null:null,'attributes':_0xacfbd6[_0x0d24('0x15')]?_0xacfbd6[_0x0d24('0x15')][_0x0d24('0x17')]||null:null,'limit':_0xacfbd6[_0x0d24('0x15')]?_0xacfbd6[_0x0d24('0x15')][_0x0d24('0x18')]||null:null,'include':_0xacfbd6['options']?_0xacfbd6[_0x0d24('0x15')][_0x0d24('0x19')]?_[_0x0d24('0x1a')](_0xacfbd6[_0x0d24('0x15')]['include'],function(_0x23440c){return{'model':db[_0x23440c[_0x0d24('0x1b')]],'as':_0x23440c['as'],'attributes':_0x23440c[_0x0d24('0x17')],'include':_0x23440c['include']?_[_0x0d24('0x1a')](_0x23440c[_0x0d24('0x19')],function(_0x425dd2){return{'model':db[_0x425dd2['model']],'as':_0x425dd2['as'],'attributes':_0x425dd2[_0x0d24('0x17')],'include':_0x425dd2[_0x0d24('0x19')]?_[_0x0d24('0x1a')](_0x425dd2['include'],function(_0x2226d6){return{'model':db[_0x2226d6[_0x0d24('0x1b')]],'as':_0x2226d6['as'],'attributes':_0x2226d6[_0x0d24('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0d24('0xa')](function(_0x2b472a){logger[_0x0d24('0xb')]('GetCampaign',_0xacfbd6);logger['debug']('GetCampaign',_0xacfbd6,JSON[_0x0d24('0x1c')](_0x2b472a));_0x12204f(_0x2b472a);})[_0x0d24('0x13')](function(_0x1a1ef7){logger[_0x0d24('0xf')](_0x0d24('0x1d'),_0x1a1ef7[_0x0d24('0x11')],_0xacfbd6);_0x151030(_0x1c5899[_0x0d24('0xf')](0x1f4,_0x1a1ef7[_0x0d24('0x11')]));});});}; \ No newline at end of file +var _0xc112=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','Campaign','options','raw','where','limit','include','model','attributes','map','GetCampaign','stringify','lodash','util'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0xc112,0xec));var _0x2c11=function(_0x44dfe6,_0x4dd17a){_0x44dfe6=_0x44dfe6-0x0;var _0x3ccb75=_0xc112[_0x44dfe6];return _0x3ccb75;};'use strict';var _=require(_0x2c11('0x0'));var util=require(_0x2c11('0x1'));var moment=require(_0x2c11('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c11('0x3'));var fs=require('fs');var Redis=require(_0x2c11('0x4'));var db=require(_0x2c11('0x5'))['db'];var utils=require(_0x2c11('0x6'));var logger=require(_0x2c11('0x7'))(_0x2c11('0x8'));var config=require(_0x2c11('0x9'));var jayson=require(_0x2c11('0xa'));var client=jayson[_0x2c11('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2399,_0x39c244,_0x1fada4){return new BPromise(function(_0x29dfcf,_0x43c1f5){return client['request'](_0x5c2399,_0x1fada4)[_0x2c11('0xc')](function(_0x1e0381){logger['info'](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));logger[_0x2c11('0xf')](_0x2c11('0x10'),_0x39c244,_0x2c11('0xe'),JSON['stringify'](_0x1e0381));if(_0x1e0381[_0x2c11('0x11')]){if(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x12')]===0x1f4){logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x43c1f5(_0x1e0381['error'][_0x2c11('0x13')]);}logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x29dfcf(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);}else{logger[_0x2c11('0x14')](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));_0x29dfcf(_0x1e0381[_0x2c11('0x15')]['message']);}})[_0x2c11('0x16')](function(_0x3c31e4){logger[_0x2c11('0x11')]('Campaign,\x20%s,\x20%s',_0x39c244,_0x3c31e4);_0x43c1f5(_0x3c31e4);});});}exports['GetCampaign']=function(_0x89a56){var _0x12ce46=this;return new Promise(function(_0x3988d7,_0x49304f){return db[_0x2c11('0x17')]['findAll']({'raw':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x19')]===undefined?!![]:![]:!![],'where':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1a')]||null:null,'attributes':_0x89a56['options']?_0x89a56['options']['attributes']||null:null,'limit':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1b')]||null:null,'include':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1c')]?_['map'](_0x89a56[_0x2c11('0x18')][_0x2c11('0x1c')],function(_0x45b96f){return{'model':db[_0x45b96f[_0x2c11('0x1d')]],'as':_0x45b96f['as'],'attributes':_0x45b96f[_0x2c11('0x1e')],'include':_0x45b96f[_0x2c11('0x1c')]?_[_0x2c11('0x1f')](_0x45b96f[_0x2c11('0x1c')],function(_0x107983){return{'model':db[_0x107983[_0x2c11('0x1d')]],'as':_0x107983['as'],'attributes':_0x107983['attributes'],'include':_0x107983[_0x2c11('0x1c')]?_[_0x2c11('0x1f')](_0x107983[_0x2c11('0x1c')],function(_0x308da8){return{'model':db[_0x308da8[_0x2c11('0x1d')]],'as':_0x308da8['as'],'attributes':_0x308da8[_0x2c11('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51af52){logger[_0x2c11('0x14')](_0x2c11('0x20'),_0x89a56);logger[_0x2c11('0xf')](_0x2c11('0x20'),_0x89a56,JSON[_0x2c11('0x21')](_0x51af52));_0x3988d7(_0x51af52);})[_0x2c11('0x16')](function(_0x2a494f){logger['error'](_0x2c11('0x20'),_0x2a494f[_0x2c11('0x13')],_0x89a56);_0x49304f(_0x12ce46[_0x2c11('0x11')](0x1f4,_0x2a494f[_0x2c11('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index eb581a9..7c1a73b 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 _0xa67b=['get','/:id','show','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','clone','addBlackLists','put','update','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','index'];(function(_0x32efdb,_0x56e38d){var _0x3c9575=function(_0x2ce5bf){while(--_0x2ce5bf){_0x32efdb['push'](_0x32efdb['shift']());}};_0x3c9575(++_0x56e38d);}(_0xa67b,0x14a));var _0xba67=function(_0x37af47,_0x401a25){_0x37af47=_0x37af47-0x0;var _0x43d015=_0xa67b[_0x37af47];return _0x43d015;};'use strict';var multer=require(_0xba67('0x0'));var util=require(_0xba67('0x1'));var path=require(_0xba67('0x2'));var timeout=require(_0xba67('0x3'));var express=require(_0xba67('0x4'));var router=express[_0xba67('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xba67('0x6'));var interaction=require(_0xba67('0x7'));var config=require('../../config/environment');var controller=require(_0xba67('0x8'));router['get']('/',auth[_0xba67('0x9')](),controller[_0xba67('0xa')]);router[_0xba67('0xb')](_0xba67('0xc'),auth[_0xba67('0x9')](),controller[_0xba67('0xd')]);router[_0xba67('0xb')](_0xba67('0xe'),auth[_0xba67('0x9')](),controller['getHoppers']);router['get'](_0xba67('0xf'),auth[_0xba67('0x9')](),controller['getHopperHistories']);router[_0xba67('0xb')](_0xba67('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xba67('0xb')]('/:id/hopper_black',auth[_0xba67('0x9')](),controller[_0xba67('0x11')]);router[_0xba67('0xb')](_0xba67('0x12'),auth[_0xba67('0x9')](),controller[_0xba67('0x13')]);router['get'](_0xba67('0x14'),auth['isAuthenticated'](),controller[_0xba67('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0xba67('0x16')]);router[_0xba67('0x17')]('/:id/clone',auth['isAuthenticated'](),controller[_0xba67('0x18')]);router['post'](_0xba67('0x12'),auth[_0xba67('0x9')](),controller['addLists']);router[_0xba67('0x17')](_0xba67('0x14'),auth[_0xba67('0x9')](),controller[_0xba67('0x19')]);router[_0xba67('0x1a')](_0xba67('0xc'),auth['isAuthenticated'](),controller[_0xba67('0x1b')]);router['delete']('/:id',auth[_0xba67('0x9')](),controller['destroy']);router[_0xba67('0x1c')](_0xba67('0x12'),auth[_0xba67('0x9')](),controller['removeLists']);router['delete'](_0xba67('0x14'),auth['isAuthenticated'](),controller[_0xba67('0x1d')]);module[_0xba67('0x1e')]=router; \ No newline at end of file +var _0x2cc1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','post','create','/:id/clone','addLists','/:id/blacklists','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','multer','util','path'];(function(_0x31edad,_0x1db381){var _0x4453fb=function(_0x5e9f00){while(--_0x5e9f00){_0x31edad['push'](_0x31edad['shift']());}};_0x4453fb(++_0x1db381);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x4ad37c,_0x2e7490){_0x4ad37c=_0x4ad37c-0x0;var _0x288919=_0x2cc1[_0x4ad37c];return _0x288919;};'use strict';var multer=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var path=require(_0x12cc('0x2'));var timeout=require(_0x12cc('0x3'));var express=require(_0x12cc('0x4'));var router=express[_0x12cc('0x5')]();var fs_extra=require(_0x12cc('0x6'));var auth=require(_0x12cc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x12cc('0x8'));router[_0x12cc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x12cc('0x9')](_0x12cc('0xa'),auth[_0x12cc('0xb')](),controller[_0x12cc('0xc')]);router[_0x12cc('0x9')](_0x12cc('0xd'),auth[_0x12cc('0xb')](),controller[_0x12cc('0xe')]);router[_0x12cc('0x9')](_0x12cc('0xf'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x10')]);router[_0x12cc('0x9')]('/:id/hopper_finals',auth[_0x12cc('0xb')](),controller['getHopperFinals']);router[_0x12cc('0x9')](_0x12cc('0x11'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x12')]);router[_0x12cc('0x9')](_0x12cc('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0x12cc('0x9')]('/:id/blacklists',auth[_0x12cc('0xb')](),controller['getBlackLists']);router[_0x12cc('0x14')]('/',auth[_0x12cc('0xb')](),controller[_0x12cc('0x15')]);router[_0x12cc('0x14')](_0x12cc('0x16'),auth[_0x12cc('0xb')](),controller['clone']);router[_0x12cc('0x14')](_0x12cc('0x13'),auth['isAuthenticated'](),controller[_0x12cc('0x17')]);router[_0x12cc('0x14')](_0x12cc('0x18'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x19')]);router[_0x12cc('0x1a')](_0x12cc('0xa'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x12cc('0x1c')]);router[_0x12cc('0x1d')](_0x12cc('0x13'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x1e')]);router[_0x12cc('0x1d')](_0x12cc('0x18'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index daefa27..1a3543a 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 _0x90ea=['medium','VIRTUAL','sequelize','exports','STRING','TEXT'];(function(_0x7a4a03,_0x91417c){var _0xfe0c7a=function(_0x2bbf81){while(--_0x2bbf81){_0x7a4a03['push'](_0x7a4a03['shift']());}};_0xfe0c7a(++_0x91417c);}(_0x90ea,0x80));var _0xa90e=function(_0x532421,_0x3a77fd){_0x532421=_0x532421-0x0;var _0x1ed7db=_0x90ea[_0x532421];return _0x1ed7db;};'use strict';var Sequelize=require(_0xa90e('0x0'));module[_0xa90e('0x1')]={'key':{'type':Sequelize[_0xa90e('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xa90e('0x3')],'length':_0xa90e('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xa90e('0x5')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0xd688=['medium','getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd688,0x122));var _0x8d68=function(_0x348148,_0x5db210){_0x348148=_0x348148-0x0;var _0x31d927=_0xd688[_0x348148];return _0x31d927;};'use strict';var Sequelize=require(_0x8d68('0x0'));module[_0x8d68('0x1')]={'key':{'type':Sequelize[_0x8d68('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x8d68('0x3')],'length':_0x8d68('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x8d68('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8d68('0x5')](_0x8d68('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index ab62fa1..b61e3df 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 _0xa78b=['CannedAnswers','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','filter','options','CannedAnswer','include','findAll','catch','show','params','rawAttributes','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get'];(function(_0x2ed0ef,_0x6e9249){var _0x3b9f19=function(_0x5ae518){while(--_0x5ae518){_0x2ed0ef['push'](_0x2ed0ef['shift']());}};_0x3b9f19(++_0x6e9249);}(_0xa78b,0x17f));var _0xba78=function(_0x1e3ac7,_0x2ddc83){_0x1e3ac7=_0x1e3ac7-0x0;var _0x53694b=_0xa78b[_0x1e3ac7];return _0x53694b;};'use strict';var emlformat=require(_0xba78('0x0'));var rimraf=require(_0xba78('0x1'));var zipdir=require(_0xba78('0x2'));var jsonpatch=require(_0xba78('0x3'));var rp=require(_0xba78('0x4'));var moment=require('moment');var BPromise=require(_0xba78('0x5'));var Mustache=require(_0xba78('0x6'));var util=require(_0xba78('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xba78('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba78('0x9'));var _=require(_0xba78('0xa'));var squel=require(_0xba78('0xb'));var crypto=require('crypto');var jsforce=require(_0xba78('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xba78('0xd'));var Papa=require(_0xba78('0xe'));var Redis=require('ioredis');var authService=require(_0xba78('0xf'));var qs=require(_0xba78('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba78('0x11'));var logger=require(_0xba78('0x12'))(_0xba78('0x13'));var utils=require(_0xba78('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xba78('0x15'))['db'];function respondWithStatusCode(_0x236c87,_0x6e9b52){_0x6e9b52=_0x6e9b52||0xcc;return function(_0x1be644){if(_0x1be644){return _0x236c87[_0xba78('0x16')](_0x6e9b52);}return _0x236c87[_0xba78('0x17')](_0x6e9b52)[_0xba78('0x18')]();};}function respondWithResult(_0x140f43,_0x41a4a6){_0x41a4a6=_0x41a4a6||0xc8;return function(_0x3b2ab6){if(_0x3b2ab6){return _0x140f43['status'](_0x41a4a6)[_0xba78('0x19')](_0x3b2ab6);}};}function respondWithFilteredResult(_0x28e65f,_0x631930){return function(_0x32a786){if(_0x32a786){var _0x3eebe8=typeof _0x631930[_0xba78('0x1a')]===_0xba78('0x1b')&&typeof _0x631930[_0xba78('0x1c')]===_0xba78('0x1b');var _0x16684e=_0x32a786[_0xba78('0x1d')];var _0x264d24=_0x3eebe8?0x0:_0x631930[_0xba78('0x1a')];var _0x4509ba=_0x3eebe8?_0x32a786[_0xba78('0x1d')]:_0x631930[_0xba78('0x1a')]+_0x631930[_0xba78('0x1c')];var _0x3c00ec;if(_0x4509ba>=_0x16684e){_0x4509ba=_0x16684e;_0x3c00ec=0xc8;}else{_0x3c00ec=0xce;}_0x28e65f['status'](_0x3c00ec);return _0x28e65f[_0xba78('0x1e')](_0xba78('0x1f'),_0x264d24+'-'+_0x4509ba+'/'+_0x16684e)[_0xba78('0x19')](_0x32a786);}return null;};}function patchUpdates(_0x2aac56){return function(_0x108a6c){try{jsonpatch['apply'](_0x108a6c,_0x2aac56,!![]);}catch(_0x31d292){return BPromise[_0xba78('0x20')](_0x31d292);}return _0x108a6c['save']();};}function saveUpdates(_0x423430,_0x3c7340){return function(_0x2b5591){if(_0x2b5591){return _0x2b5591[_0xba78('0x21')](_0x423430)[_0xba78('0x22')](function(_0x32d6ec){return _0x32d6ec;});}return null;};}function removeEntity(_0x2ffc98,_0x43565b){return function(_0x4dae55){if(_0x4dae55){return _0x4dae55[_0xba78('0x23')]()[_0xba78('0x22')](function(){var _0x2566d1=_0x4dae55[_0xba78('0x24')]({'plain':!![]});var _0x13a8de=_0xba78('0x25');return db[_0xba78('0x26')][_0xba78('0x23')]({'where':{'type':_0x13a8de,'resourceId':_0x2566d1['id']}})[_0xba78('0x22')](function(){return _0x4dae55;});})[_0xba78('0x22')](function(){_0x2ffc98[_0xba78('0x17')](0xcc)[_0xba78('0x18')]();});}};}function handleEntityNotFound(_0x318093,_0x2f836b){return function(_0x2a6e6){if(!_0x2a6e6){_0x318093[_0xba78('0x16')](0x194);}return _0x2a6e6;};}function handleError(_0x52f805,_0x120d08){_0x120d08=_0x120d08||0x1f4;return function(_0x49c505){logger[_0xba78('0x27')](_0x49c505[_0xba78('0x28')]);if(_0x49c505['name']){delete _0x49c505[_0xba78('0x29')];}_0x52f805[_0xba78('0x17')](_0x120d08)[_0xba78('0x2a')](_0x49c505);};}exports[_0xba78('0x2b')]=function(_0x52e954,_0x1cf5da){var _0x49554e={},_0x161224={},_0xdeadd5={'count':0x0,'rows':[]};var _0xdeb6a6=_[_0xba78('0x2c')](db['CannedAnswer']['rawAttributes'],function(_0x2f43a9){return{'name':_0x2f43a9[_0xba78('0x2d')],'type':_0x2f43a9[_0xba78('0x2e')][_0xba78('0x2f')]};});_0x161224[_0xba78('0x30')]=_[_0xba78('0x2c')](_0xdeb6a6,_0xba78('0x29'));_0x161224[_0xba78('0x31')]=_[_0xba78('0x32')](_0x52e954[_0xba78('0x31')]);_0x161224['filters']=_[_0xba78('0x33')](_0x161224['model'],_0x161224[_0xba78('0x31')]);_0x49554e['attributes']=_[_0xba78('0x33')](_0x161224[_0xba78('0x30')],qs['fields'](_0x52e954[_0xba78('0x31')][_0xba78('0x34')]));_0x49554e[_0xba78('0x35')]=_0x49554e['attributes'][_0xba78('0x36')]?_0x49554e[_0xba78('0x35')]:_0x161224[_0xba78('0x30')];if(!_0x52e954[_0xba78('0x31')][_0xba78('0x37')]('nolimit')){_0x49554e['limit']=qs[_0xba78('0x1c')](_0x52e954['query'][_0xba78('0x1c')]);_0x49554e['offset']=qs[_0xba78('0x1a')](_0x52e954['query'][_0xba78('0x1a')]);}_0x49554e[_0xba78('0x38')]=qs[_0xba78('0x39')](_0x52e954['query'][_0xba78('0x39')]);_0x49554e['where']=qs[_0xba78('0x3a')](_[_0xba78('0x3b')](_0x52e954[_0xba78('0x31')],_0x161224['filters']),_0xdeb6a6);if(_0x52e954[_0xba78('0x31')]['filter']){_0x49554e[_0xba78('0x3c')]=_[_0xba78('0x3d')](_0x49554e['where'],{'$or':[{'key':{'$like':'%'+_0x52e954['query']['filter']+'%'}},{'value':{'$like':'%'+_0x52e954['query'][_0xba78('0x3e')]+'%'}}]});}_0x49554e=_[_0xba78('0x3d')]({},_0x49554e,_0x52e954[_0xba78('0x3f')]);var _0x54d339={'where':_0x49554e[_0xba78('0x3c')]};return db[_0xba78('0x40')][_0xba78('0x1d')](_0x54d339)['then'](function(_0x4280aa){_0xdeadd5[_0xba78('0x1d')]=_0x4280aa;if(_0x52e954[_0xba78('0x31')]['includeAll']){_0x49554e[_0xba78('0x41')]=[{'all':!![]}];}return db[_0xba78('0x40')][_0xba78('0x42')](_0x49554e);})[_0xba78('0x22')](function(_0x27302c){_0xdeadd5['rows']=_0x27302c;return _0xdeadd5;})[_0xba78('0x22')](respondWithFilteredResult(_0x1cf5da,_0x49554e))[_0xba78('0x43')](handleError(_0x1cf5da,null));};exports[_0xba78('0x44')]=function(_0x4b932e,_0x52e445){var _0x36e320={'raw':!![],'where':{'id':_0x4b932e[_0xba78('0x45')]['id']}},_0x520247={};_0x520247[_0xba78('0x30')]=_[_0xba78('0x32')](db['CannedAnswer'][_0xba78('0x46')]);_0x520247['query']=_['keys'](_0x4b932e[_0xba78('0x31')]);_0x520247['filters']=_[_0xba78('0x33')](_0x520247[_0xba78('0x30')],_0x520247[_0xba78('0x31')]);_0x36e320[_0xba78('0x35')]=_[_0xba78('0x33')](_0x520247['model'],qs['fields'](_0x4b932e[_0xba78('0x31')][_0xba78('0x34')]));_0x36e320[_0xba78('0x35')]=_0x36e320[_0xba78('0x35')]['length']?_0x36e320[_0xba78('0x35')]:_0x520247[_0xba78('0x30')];if(_0x4b932e[_0xba78('0x31')]['includeAll']){_0x36e320[_0xba78('0x41')]=[{'all':!![]}];}_0x36e320=_['merge']({},_0x36e320,_0x4b932e[_0xba78('0x3f')]);return db[_0xba78('0x40')][_0xba78('0x47')](_0x36e320)['then'](handleEntityNotFound(_0x52e445,null))[_0xba78('0x22')](respondWithResult(_0x52e445,null))[_0xba78('0x43')](handleError(_0x52e445,null));};exports[_0xba78('0x21')]=function(_0x50ac66,_0x334e60){if(_0x50ac66[_0xba78('0x48')]['id']){delete _0x50ac66['body']['id'];}return db[_0xba78('0x40')][_0xba78('0x47')]({'where':{'id':_0x50ac66[_0xba78('0x45')]['id']}})[_0xba78('0x22')](handleEntityNotFound(_0x334e60,null))[_0xba78('0x22')](saveUpdates(_0x50ac66[_0xba78('0x48')],null))['then'](respondWithResult(_0x334e60,null))[_0xba78('0x43')](handleError(_0x334e60,null));};exports[_0xba78('0x23')]=function(_0x3f3a93,_0xaf62b4){return db[_0xba78('0x40')][_0xba78('0x47')]({'where':{'id':_0x3f3a93['params']['id']}})[_0xba78('0x22')](handleEntityNotFound(_0xaf62b4,null))[_0xba78('0x22')](removeEntity(_0xaf62b4,null))[_0xba78('0x43')](handleError(_0xaf62b4,null));};exports[_0xba78('0x49')]=function(_0x4ca0be,_0xd4c0bb){var _0x36d237={'key':_0x4ca0be['body'][_0xba78('0x2f')]};if(_0x4ca0be[_0xba78('0x48')][_0xba78('0x4a')]){_0x36d237[_0xba78('0x4a')]=_0x4ca0be['body'][_0xba78('0x4a')];}else if(_0x4ca0be['body'][_0xba78('0x4b')]){_0x36d237[_0xba78('0x4b')]=_0x4ca0be['body'][_0xba78('0x4b')];}else if(_0x4ca0be['body'][_0xba78('0x4c')]){_0x36d237['OpenchannelAccountId']=_0x4ca0be['body'][_0xba78('0x4c')];}else if(_0x4ca0be[_0xba78('0x48')]['ChatWebsiteId']){_0x36d237[_0xba78('0x4d')]=_0x4ca0be[_0xba78('0x48')]['ChatWebsiteId'];}return db[_0xba78('0x40')]['find']({'where':_0x36d237})[_0xba78('0x22')](function(_0x2a958f){if(_0x2a958f){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0xba78('0x49')](_0x4ca0be[_0xba78('0x48')]);})[_0xba78('0x22')](function(_0x219ea5){var _0x53b0f4=_0x4ca0be[_0xba78('0x4e')]['get']({'plain':!![]});if(!_0x53b0f4)throw new Error(_0xba78('0x4f'));if(_0x53b0f4[_0xba78('0x50')]===_0xba78('0x4e')){var _0x29318c=_0x219ea5[_0xba78('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xba78('0x47')]({'where':{'name':'CannedAnswers','userProfileId':_0x53b0f4[_0xba78('0x51')]},'raw':!![]})['then'](function(_0x543b58){if(_0x543b58&&_0x543b58[_0xba78('0x52')]===0x0){return db['UserProfileResource'][_0xba78('0x49')]({'name':_0x29318c[_0xba78('0x29')],'resourceId':_0x29318c['id'],'type':_0x543b58[_0xba78('0x29')],'sectionId':_0x543b58['id']},{})[_0xba78('0x22')](function(){return _0x219ea5;});}else{return _0x219ea5;}})[_0xba78('0x43')](function(_0x4451cd){logger[_0xba78('0x27')](_0xba78('0x53'),_0x4451cd);throw _0x4451cd;});}return _0x219ea5;})[_0xba78('0x22')](respondWithResult(_0xd4c0bb,0xc9))[_0xba78('0x43')](handleError(_0xd4c0bb,null));}; \ No newline at end of file +var _0x1e97=['save','update','then','get','UserProfileResource','destroy','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','includeAll','include','rows','params','options','catch','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','CannedAnswers','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x531622,_0x5d58b7){var _0x32a0fb=function(_0x71ff7e){while(--_0x71ff7e){_0x531622['push'](_0x531622['shift']());}};_0x32a0fb(++_0x5d58b7);}(_0x1e97,0x184));var _0x71e9=function(_0x4e108d,_0x23a861){_0x4e108d=_0x4e108d-0x0;var _0x3b600c=_0x1e97[_0x4e108d];return _0x3b600c;};'use strict';var emlformat=require(_0x71e9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x71e9('0x1'));var rp=require(_0x71e9('0x2'));var moment=require(_0x71e9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x71e9('0x4'));var util=require(_0x71e9('0x5'));var path=require(_0x71e9('0x6'));var sox=require('sox');var csv=require(_0x71e9('0x7'));var ejs=require(_0x71e9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x71e9('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x71e9('0x7'));var querystring=require(_0x71e9('0xa'));var Papa=require('papaparse');var Redis=require(_0x71e9('0xb'));var authService=require(_0x71e9('0xc'));var qs=require(_0x71e9('0xd'));var as=require(_0x71e9('0xe'));var hardwareService=require(_0x71e9('0xf'));var logger=require('../../config/logger')(_0x71e9('0x10'));var utils=require(_0x71e9('0x11'));var config=require(_0x71e9('0x12'));var licenseUtil=require(_0x71e9('0x13'));var db=require(_0x71e9('0x14'))['db'];function respondWithStatusCode(_0x58052b,_0x53f0f6){_0x53f0f6=_0x53f0f6||0xcc;return function(_0x4d9300){if(_0x4d9300){return _0x58052b[_0x71e9('0x15')](_0x53f0f6);}return _0x58052b[_0x71e9('0x16')](_0x53f0f6)[_0x71e9('0x17')]();};}function respondWithResult(_0x4ca779,_0x26f25e){_0x26f25e=_0x26f25e||0xc8;return function(_0x2ae29d){if(_0x2ae29d){return _0x4ca779[_0x71e9('0x16')](_0x26f25e)[_0x71e9('0x18')](_0x2ae29d);}};}function respondWithFilteredResult(_0x481f37,_0x17e77e){return function(_0x37c8b4){if(_0x37c8b4){var _0x1ec2bf=typeof _0x17e77e[_0x71e9('0x19')]===_0x71e9('0x1a')&&typeof _0x17e77e[_0x71e9('0x1b')]===_0x71e9('0x1a');var _0x2f44a0=_0x37c8b4[_0x71e9('0x1c')];var _0x168a89=_0x1ec2bf?0x0:_0x17e77e[_0x71e9('0x19')];var _0x4f6ad1=_0x1ec2bf?_0x37c8b4[_0x71e9('0x1c')]:_0x17e77e[_0x71e9('0x19')]+_0x17e77e[_0x71e9('0x1b')];var _0x5b90c8;if(_0x4f6ad1>=_0x2f44a0){_0x4f6ad1=_0x2f44a0;_0x5b90c8=0xc8;}else{_0x5b90c8=0xce;}_0x481f37[_0x71e9('0x16')](_0x5b90c8);return _0x481f37[_0x71e9('0x1d')](_0x71e9('0x1e'),_0x168a89+'-'+_0x4f6ad1+'/'+_0x2f44a0)['json'](_0x37c8b4);}return null;};}function patchUpdates(_0xc7a16f){return function(_0x3028ba){try{jsonpatch['apply'](_0x3028ba,_0xc7a16f,!![]);}catch(_0xa7c922){return BPromise[_0x71e9('0x1f')](_0xa7c922);}return _0x3028ba[_0x71e9('0x20')]();};}function saveUpdates(_0x1c0b91,_0x327dc4){return function(_0x5f14e7){if(_0x5f14e7){return _0x5f14e7[_0x71e9('0x21')](_0x1c0b91)['then'](function(_0xdb2a2){return _0xdb2a2;});}return null;};}function removeEntity(_0x3ae27f,_0x4ab5c5){return function(_0x56a8cd){if(_0x56a8cd){return _0x56a8cd['destroy']()[_0x71e9('0x22')](function(){var _0x57d8ee=_0x56a8cd[_0x71e9('0x23')]({'plain':!![]});var _0x3cce41='CannedAnswers';return db[_0x71e9('0x24')][_0x71e9('0x25')]({'where':{'type':_0x3cce41,'resourceId':_0x57d8ee['id']}})['then'](function(){return _0x56a8cd;});})[_0x71e9('0x22')](function(){_0x3ae27f[_0x71e9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3417dc,_0x4fd560){return function(_0x284fe7){if(!_0x284fe7){_0x3417dc[_0x71e9('0x15')](0x194);}return _0x284fe7;};}function handleError(_0x2ccdc0,_0x3681e7){_0x3681e7=_0x3681e7||0x1f4;return function(_0x5a16d8){logger[_0x71e9('0x26')](_0x5a16d8[_0x71e9('0x27')]);if(_0x5a16d8['name']){delete _0x5a16d8[_0x71e9('0x28')];}_0x2ccdc0[_0x71e9('0x16')](_0x3681e7)['send'](_0x5a16d8);};}exports['index']=function(_0x9dd0c,_0xc5dde7){var _0xce1af6={},_0x4a6062={},_0x6f4294={'count':0x0,'rows':[]};var _0x3a4410=_[_0x71e9('0x29')](db[_0x71e9('0x2a')][_0x71e9('0x2b')],function(_0x218506){return{'name':_0x218506[_0x71e9('0x2c')],'type':_0x218506[_0x71e9('0x2d')][_0x71e9('0x2e')]};});_0x4a6062['model']=_[_0x71e9('0x29')](_0x3a4410,'name');_0x4a6062[_0x71e9('0x2f')]=_[_0x71e9('0x30')](_0x9dd0c[_0x71e9('0x2f')]);_0x4a6062[_0x71e9('0x31')]=_[_0x71e9('0x32')](_0x4a6062[_0x71e9('0x33')],_0x4a6062[_0x71e9('0x2f')]);_0xce1af6['attributes']=_[_0x71e9('0x32')](_0x4a6062[_0x71e9('0x33')],qs[_0x71e9('0x34')](_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x34')]));_0xce1af6[_0x71e9('0x35')]=_0xce1af6[_0x71e9('0x35')][_0x71e9('0x36')]?_0xce1af6[_0x71e9('0x35')]:_0x4a6062['model'];if(!_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x37')](_0x71e9('0x38'))){_0xce1af6['limit']=qs['limit'](_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x1b')]);_0xce1af6[_0x71e9('0x19')]=qs['offset'](_0x9dd0c['query'][_0x71e9('0x19')]);}_0xce1af6[_0x71e9('0x39')]=qs['sort'](_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x3a')]);_0xce1af6['where']=qs[_0x71e9('0x31')](_[_0x71e9('0x3b')](_0x9dd0c[_0x71e9('0x2f')],_0x4a6062['filters']),_0x3a4410);if(_0x9dd0c[_0x71e9('0x2f')]['filter']){_0xce1af6['where']=_['merge'](_0xce1af6[_0x71e9('0x3c')],{'$or':[{'key':{'$like':'%'+_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x3d')]+'%'}},{'value':{'$like':'%'+_0x9dd0c['query'][_0x71e9('0x3d')]+'%'}}]});}_0xce1af6=_[_0x71e9('0x3e')]({},_0xce1af6,_0x9dd0c['options']);var _0x5d991c={'where':_0xce1af6[_0x71e9('0x3c')]};return db[_0x71e9('0x2a')][_0x71e9('0x1c')](_0x5d991c)[_0x71e9('0x22')](function(_0x1d87a7){_0x6f4294[_0x71e9('0x1c')]=_0x1d87a7;if(_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x3f')]){_0xce1af6[_0x71e9('0x40')]=[{'all':!![]}];}return db[_0x71e9('0x2a')]['findAll'](_0xce1af6);})[_0x71e9('0x22')](function(_0x4ba93d){_0x6f4294[_0x71e9('0x41')]=_0x4ba93d;return _0x6f4294;})[_0x71e9('0x22')](respondWithFilteredResult(_0xc5dde7,_0xce1af6))['catch'](handleError(_0xc5dde7,null));};exports['show']=function(_0x50c23d,_0x369144){var _0x58dc44={'raw':!![],'where':{'id':_0x50c23d[_0x71e9('0x42')]['id']}},_0x8a9c89={};_0x8a9c89[_0x71e9('0x33')]=_[_0x71e9('0x30')](db['CannedAnswer'][_0x71e9('0x2b')]);_0x8a9c89[_0x71e9('0x2f')]=_[_0x71e9('0x30')](_0x50c23d['query']);_0x8a9c89['filters']=_['intersection'](_0x8a9c89[_0x71e9('0x33')],_0x8a9c89[_0x71e9('0x2f')]);_0x58dc44[_0x71e9('0x35')]=_[_0x71e9('0x32')](_0x8a9c89['model'],qs['fields'](_0x50c23d[_0x71e9('0x2f')][_0x71e9('0x34')]));_0x58dc44['attributes']=_0x58dc44[_0x71e9('0x35')]['length']?_0x58dc44[_0x71e9('0x35')]:_0x8a9c89['model'];if(_0x50c23d[_0x71e9('0x2f')]['includeAll']){_0x58dc44['include']=[{'all':!![]}];}_0x58dc44=_['merge']({},_0x58dc44,_0x50c23d[_0x71e9('0x43')]);return db[_0x71e9('0x2a')]['find'](_0x58dc44)['then'](handleEntityNotFound(_0x369144,null))[_0x71e9('0x22')](respondWithResult(_0x369144,null))[_0x71e9('0x44')](handleError(_0x369144,null));};exports[_0x71e9('0x21')]=function(_0x10054e,_0x632b6d){if(_0x10054e[_0x71e9('0x45')]['id']){delete _0x10054e[_0x71e9('0x45')]['id'];}return db[_0x71e9('0x2a')][_0x71e9('0x46')]({'where':{'id':_0x10054e[_0x71e9('0x42')]['id']}})[_0x71e9('0x22')](handleEntityNotFound(_0x632b6d,null))['then'](saveUpdates(_0x10054e['body'],null))[_0x71e9('0x22')](respondWithResult(_0x632b6d,null))[_0x71e9('0x44')](handleError(_0x632b6d,null));};exports[_0x71e9('0x25')]=function(_0x1e2565,_0x14044c){return db[_0x71e9('0x2a')]['find']({'where':{'id':_0x1e2565['params']['id']}})['then'](handleEntityNotFound(_0x14044c,null))[_0x71e9('0x22')](removeEntity(_0x14044c,null))[_0x71e9('0x44')](handleError(_0x14044c,null));};exports[_0x71e9('0x47')]=function(_0x1d9582,_0x5a837b){var _0x17fc10={'key':_0x1d9582[_0x71e9('0x45')][_0x71e9('0x2e')]};if(_0x1d9582[_0x71e9('0x45')]['MailAccountId']){_0x17fc10[_0x71e9('0x48')]=_0x1d9582[_0x71e9('0x45')][_0x71e9('0x48')];}else if(_0x1d9582[_0x71e9('0x45')][_0x71e9('0x49')]){_0x17fc10[_0x71e9('0x49')]=_0x1d9582[_0x71e9('0x45')]['SmsAccountId'];}else if(_0x1d9582['body'][_0x71e9('0x4a')]){_0x17fc10[_0x71e9('0x4a')]=_0x1d9582[_0x71e9('0x45')]['OpenchannelAccountId'];}else if(_0x1d9582[_0x71e9('0x45')][_0x71e9('0x4b')]){_0x17fc10[_0x71e9('0x4b')]=_0x1d9582['body'][_0x71e9('0x4b')];}return db[_0x71e9('0x2a')]['find']({'where':_0x17fc10})['then'](function(_0x44bc05){if(_0x44bc05){throw new db[(_0x71e9('0x4c'))][(_0x71e9('0x4d'))](_0x71e9('0x4e'));}return db[_0x71e9('0x2a')][_0x71e9('0x47')](_0x1d9582[_0x71e9('0x45')]);})[_0x71e9('0x22')](function(_0x509edd){var _0x1d8fc9=_0x1d9582[_0x71e9('0x4f')][_0x71e9('0x23')]({'plain':!![]});if(!_0x1d8fc9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d8fc9[_0x71e9('0x50')]===_0x71e9('0x4f')){var _0x2bccc9=_0x509edd[_0x71e9('0x23')]({'plain':!![]});return db[_0x71e9('0x51')]['find']({'where':{'name':_0x71e9('0x52'),'userProfileId':_0x1d8fc9['userProfileId']},'raw':!![]})['then'](function(_0x7a8fa8){if(_0x7a8fa8&&_0x7a8fa8['autoAssociation']===0x0){return db[_0x71e9('0x24')][_0x71e9('0x47')]({'name':_0x2bccc9[_0x71e9('0x28')],'resourceId':_0x2bccc9['id'],'type':_0x7a8fa8[_0x71e9('0x28')],'sectionId':_0x7a8fa8['id']},{})['then'](function(){return _0x509edd;});}else{return _0x509edd;}})[_0x71e9('0x44')](function(_0x31205f){logger[_0x71e9('0x26')](_0x71e9('0x53'),_0x31205f);throw _0x31205f;});}return _0x509edd;})[_0x71e9('0x22')](respondWithResult(_0x5a837b,0xc9))['catch'](handleError(_0x5a837b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index a478c28..f33231c 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 _0x3e5a=['utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x4620aa,_0x45d0cb){var _0x4a2de0=function(_0x8e264){while(--_0x8e264){_0x4620aa['push'](_0x4620aa['shift']());}};_0x4a2de0(++_0x45d0cb);}(_0x3e5a,0x1dd));var _0xa3e5=function(_0x148671,_0x1d3cd4){_0x148671=_0x148671-0x0;var _0x3d2b40=_0x3e5a[_0x148671];return _0x3d2b40;};'use strict';var _=require(_0xa3e5('0x0'));var util=require(_0xa3e5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa3e5('0x2'));var BPromise=require(_0xa3e5('0x3'));var rp=require(_0xa3e5('0x4'));var fs=require('fs');var path=require(_0xa3e5('0x5'));var rimraf=require('rimraf');var config=require(_0xa3e5('0x6'));var attributes=require(_0xa3e5('0x7'));module[_0xa3e5('0x8')]=function(_0x3ef781,_0xec50a4){return _0x3ef781[_0xa3e5('0x9')](_0xa3e5('0xa'),attributes,{'tableName':_0xa3e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa3e5('0xc'),'collate':_0xa3e5('0xd')});}; \ No newline at end of file +var _0xdb3e=['CannedAnswer','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb3e,0x1e2));var _0xedb3=function(_0x5453ef,_0x176f82){_0x5453ef=_0x5453ef-0x0;var _0x5b4260=_0xdb3e[_0x5453ef];return _0x5b4260;};'use strict';var _=require('lodash');var util=require(_0xedb3('0x0'));var logger=require('../../config/logger')(_0xedb3('0x1'));var moment=require(_0xedb3('0x2'));var BPromise=require(_0xedb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedb3('0x4'));var rimraf=require(_0xedb3('0x5'));var config=require(_0xedb3('0x6'));var attributes=require(_0xedb3('0x7'));module[_0xedb3('0x8')]=function(_0x38cc0f,_0x39a058){return _0x38cc0f[_0xedb3('0x9')](_0xedb3('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xedb3('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b2af74f..ce62ddf 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(_0x10cee3,_0x3527b8){var _0x1a1e75=function(_0x561224){while(--_0x561224){_0x10cee3['push'](_0x10cee3['shift']());}};_0x1a1e75(++_0x3527b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x1404ae,_0x56f6aa){var _0x53ef53=function(_0x2c9c71){while(--_0x2c9c71){_0x1404ae['push'](_0x1404ae['shift']());}};_0x53ef53(++_0x56f6aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 295d1c7..a02d16b 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 _0xd007=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','path','fs-extra'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xd007,0x9d));var _0x7d00=function(_0x476f82,_0x4e96d0){_0x476f82=_0x476f82-0x0;var _0x136d2e=_0xd007[_0x476f82];return _0x136d2e;};'use strict';var multer=require('multer');var util=require(_0x7d00('0x0'));var path=require(_0x7d00('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7d00('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x7d00('0x3'));var config=require(_0x7d00('0x4'));var controller=require(_0x7d00('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7d00('0x6')](_0x7d00('0x7'),auth['isAuthenticated'](),controller[_0x7d00('0x8')]);router[_0x7d00('0x9')]('/',auth[_0x7d00('0xa')](),controller[_0x7d00('0xb')]);router[_0x7d00('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7d00('0xd')](_0x7d00('0x7'),auth[_0x7d00('0xa')](),controller[_0x7d00('0xe')]);module[_0x7d00('0xf')]=router; \ No newline at end of file +var _0xe37a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer','util','path'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0xe37a,0x69));var _0xae37=function(_0x801858,_0x5d6867){_0x801858=_0x801858-0x0;var _0xff36a5=_0xe37a[_0x801858];return _0xff36a5;};'use strict';var multer=require(_0xae37('0x0'));var util=require(_0xae37('0x1'));var path=require(_0xae37('0x2'));var timeout=require('connect-timeout');var express=require(_0xae37('0x3'));var router=express[_0xae37('0x4')]();var fs_extra=require(_0xae37('0x5'));var auth=require(_0xae37('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae37('0x7'));var controller=require(_0xae37('0x8'));router[_0xae37('0x9')]('/',auth[_0xae37('0xa')](),controller['index']);router[_0xae37('0x9')](_0xae37('0xb'),auth[_0xae37('0xa')](),controller[_0xae37('0xc')]);router['post']('/',auth[_0xae37('0xa')](),controller[_0xae37('0xd')]);router['put']('/:id',auth[_0xae37('0xa')](),controller[_0xae37('0xe')]);router[_0xae37('0xf')](_0xae37('0xb'),auth['isAuthenticated'](),controller[_0xae37('0x10')]);module[_0xae37('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 0886c2b..8f4b679 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 _0x117d=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x3a9193,_0x2be163){var _0x2c57d1=function(_0x17f969){while(--_0x17f969){_0x3a9193['push'](_0x3a9193['shift']());}};_0x2c57d1(++_0x2be163);}(_0x117d,0xac));var _0xd117=function(_0x22093a,_0xa7acf1){_0x22093a=_0x22093a-0x0;var _0x2f4989=_0x117d[_0x22093a];return _0x2f4989;};'use strict';var Sequelize=require(_0xd117('0x0'));module[_0xd117('0x1')]={'calldate':{'type':Sequelize[_0xd117('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xd117('0x3')]},'src':{'type':Sequelize[_0xd117('0x3')]},'dst':{'type':Sequelize[_0xd117('0x3')]},'dcontext':{'type':Sequelize[_0xd117('0x3')]},'channel':{'type':Sequelize[_0xd117('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xd117('0x3')]},'lastdata':{'type':Sequelize[_0xd117('0x3')]},'duration':{'type':Sequelize[_0xd117('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd117('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd117('0x3')]},'userfield':{'type':Sequelize[_0xd117('0x3')]},'uniqueid':{'type':Sequelize[_0xd117('0x3')]},'linkedid':{'type':Sequelize[_0xd117('0x3')]},'sequence':{'type':Sequelize[_0xd117('0x3')]},'peeraccount':{'type':Sequelize[_0xd117('0x3')]},'type':{'type':Sequelize[_0xd117('0x3')]},'tag':{'type':Sequelize[_0xd117('0x3')]}}; \ No newline at end of file +var _0x7d51=['INTEGER','sequelize','exports','STRING'];(function(_0x43d3fb,_0x2a7eca){var _0x42430a=function(_0x5241c0){while(--_0x5241c0){_0x43d3fb['push'](_0x43d3fb['shift']());}};_0x42430a(++_0x2a7eca);}(_0x7d51,0x1e9));var _0x17d5=function(_0x38134d,_0x1bd7c6){_0x38134d=_0x38134d-0x0;var _0x605689=_0x7d51[_0x38134d];return _0x605689;};'use strict';var Sequelize=require(_0x17d5('0x0'));module[_0x17d5('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x17d5('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x17d5('0x2')]},'dcontext':{'type':Sequelize[_0x17d5('0x2')]},'channel':{'type':Sequelize[_0x17d5('0x2')]},'dstchannel':{'type':Sequelize[_0x17d5('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x17d5('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x17d5('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x17d5('0x2')]},'amaflags':{'type':Sequelize[_0x17d5('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x17d5('0x2')]},'userfield':{'type':Sequelize[_0x17d5('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x17d5('0x2')]},'sequence':{'type':Sequelize[_0x17d5('0x2')]},'peeraccount':{'type':Sequelize[_0x17d5('0x2')]},'type':{'type':Sequelize[_0x17d5('0x2')]},'tag':{'type':Sequelize[_0x17d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 195b9cd..4de9ce8 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 _0x7fbe=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','body','catch','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','end','error','stack','send','index','map','Cdr','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit'];(function(_0x3bbd38,_0x1f451a){var _0x5e16e3=function(_0x1f699e){while(--_0x1f699e){_0x3bbd38['push'](_0x3bbd38['shift']());}};_0x5e16e3(++_0x1f451a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4e3ee6,_0x1cac16){_0x4e3ee6=_0x4e3ee6-0x0;var _0x3a1887=_0x7fbe[_0x4e3ee6];return _0x3a1887;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();});}};}function handleEntityNotFound(_0x2996ae,_0x4f6c73){return function(_0x6c930){if(!_0x6c930){_0x2996ae[_0xe7fb('0x1b')](0x194);}return _0x6c930;};}function handleError(_0x390f32,_0x1ceed8){_0x1ceed8=_0x1ceed8||0x1f4;return function(_0x392d75){logger[_0xe7fb('0x28')](_0x392d75[_0xe7fb('0x29')]);if(_0x392d75['name']){delete _0x392d75['name'];}_0x390f32[_0xe7fb('0x1c')](_0x1ceed8)[_0xe7fb('0x2a')](_0x392d75);};}exports[_0xe7fb('0x2b')]=function(_0x4fd290,_0xb1f2f4){var _0x251807={},_0xd3fffe={},_0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x2c')](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x2f')],'type':_0x4ce993[_0xe7fb('0x30')][_0xe7fb('0x31')]};});_0xd3fffe['model']=_['map'](_0x219554,_0xe7fb('0x32'));_0xd3fffe['query']=_[_0xe7fb('0x33')](_0x4fd290[_0xe7fb('0x34')]);_0xd3fffe[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0xd3fffe['model'],_0xd3fffe[_0xe7fb('0x34')]);_0x251807[_0xe7fb('0x37')]=_[_0xe7fb('0x36')](_0xd3fffe[_0xe7fb('0x38')],qs[_0xe7fb('0x39')](_0x4fd290['query'][_0xe7fb('0x39')]));_0x251807[_0xe7fb('0x37')]=_0x251807[_0xe7fb('0x37')][_0xe7fb('0x3a')]?_0x251807[_0xe7fb('0x37')]:_0xd3fffe[_0xe7fb('0x38')];if(!_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x3b')](_0xe7fb('0x3c'))){_0x251807['limit']=qs[_0xe7fb('0x20')](_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x20')]);_0x251807['offset']=qs[_0xe7fb('0x1e')](_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x1e')]);}_0x251807[_0xe7fb('0x3d')]=qs[_0xe7fb('0x3e')](_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x3e')]);_0x251807[_0xe7fb('0x3f')]=qs[_0xe7fb('0x35')](_[_0xe7fb('0x40')](_0x4fd290[_0xe7fb('0x34')],_0xd3fffe[_0xe7fb('0x35')]),_0x219554);if(_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x41')]){_0x251807[_0xe7fb('0x3f')]=_[_0xe7fb('0x42')](_0x251807[_0xe7fb('0x3f')],{'$or':_[_0xe7fb('0x2c')](_0x219554,function(_0x21e35c){if(_0x21e35c['type']!==_0xe7fb('0x43')){var _0x23f9f9={};_0x23f9f9[_0x21e35c[_0xe7fb('0x32')]]={'$like':'%'+_0x4fd290[_0xe7fb('0x34')]['filter']+'%'};return _0x23f9f9;}})});}_0x251807=_[_0xe7fb('0x42')]({},_0x251807,_0x4fd290[_0xe7fb('0x44')]);var _0xd472d={'where':_0x251807[_0xe7fb('0x3f')]};return db['Cdr'][_0xe7fb('0x21')](_0xd472d)[_0xe7fb('0x26')](function(_0x34265f){_0x5f265f[_0xe7fb('0x21')]=_0x34265f;if(_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x45')]){_0x251807['include']=[{'all':!![]}];}return db[_0xe7fb('0x2d')][_0xe7fb('0x46')](_0x251807);})[_0xe7fb('0x26')](function(_0x4b263d){_0x5f265f[_0xe7fb('0x47')]=_0x4b263d;return _0x5f265f;})[_0xe7fb('0x26')](respondWithFilteredResult(_0xb1f2f4,_0x251807))['catch'](handleError(_0xb1f2f4,null));};exports['show']=function(_0x5a01ae,_0x5ed3d4){var _0x5e0153={'raw':!![],'where':{'id':_0x5a01ae[_0xe7fb('0x48')]['id']}},_0x900d67={};_0x900d67[_0xe7fb('0x38')]=_['keys'](db[_0xe7fb('0x2d')]['rawAttributes']);_0x900d67[_0xe7fb('0x34')]=_[_0xe7fb('0x33')](_0x5a01ae['query']);_0x900d67[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x900d67[_0xe7fb('0x38')],_0x900d67[_0xe7fb('0x34')]);_0x5e0153['attributes']=_[_0xe7fb('0x36')](_0x900d67[_0xe7fb('0x38')],qs[_0xe7fb('0x39')](_0x5a01ae['query'][_0xe7fb('0x39')]));_0x5e0153[_0xe7fb('0x37')]=_0x5e0153[_0xe7fb('0x37')][_0xe7fb('0x3a')]?_0x5e0153[_0xe7fb('0x37')]:_0x900d67['model'];if(_0x5a01ae[_0xe7fb('0x34')]['includeAll']){_0x5e0153[_0xe7fb('0x49')]=[{'all':!![]}];}_0x5e0153=_[_0xe7fb('0x42')]({},_0x5e0153,_0x5a01ae[_0xe7fb('0x44')]);return db[_0xe7fb('0x2d')][_0xe7fb('0x4a')](_0x5e0153)['then'](handleEntityNotFound(_0x5ed3d4,null))[_0xe7fb('0x26')](respondWithResult(_0x5ed3d4,null))['catch'](handleError(_0x5ed3d4,null));};exports['create']=function(_0x12c828,_0x3d740f){return db[_0xe7fb('0x2d')]['create'](_0x12c828[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](respondWithResult(_0x3d740f,0xc9))['catch'](handleError(_0x3d740f,null));};exports['update']=function(_0x284bcb,_0x42270b){if(_0x284bcb[_0xe7fb('0x4b')]['id']){delete _0x284bcb[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x2d')][_0xe7fb('0x4a')]({'where':{'id':_0x284bcb[_0xe7fb('0x48')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x42270b,null))['then'](saveUpdates(_0x284bcb[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x42270b,null))[_0xe7fb('0x4c')](handleError(_0x42270b,null));};exports[_0xe7fb('0x4d')]=function(_0x5cedfb,_0x25347b){return db['Cdr'][_0xe7fb('0x4a')]({'where':{'id':_0x5cedfb['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x25347b,null))['then'](removeEntity(_0x25347b,null))[_0xe7fb('0x4c')](handleError(_0x25347b,null));};exports['describe']=function(_0x1fff6c,_0x1b6442){return db[_0xe7fb('0x2d')][_0xe7fb('0x4e')]()[_0xe7fb('0x26')](respondWithResult(_0x1b6442,null))[_0xe7fb('0x4c')](handleError(_0x1b6442,null));}; \ No newline at end of file +var _0x919e=['Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','map'];(function(_0x59771d,_0xa61611){var _0x4abb3d=function(_0xeba7e6){while(--_0xeba7e6){_0x59771d['push'](_0x59771d['shift']());}};_0x4abb3d(++_0xa61611);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xe919('0x0'));var rimraf=require(_0xe919('0x1'));var zipdir=require(_0xe919('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe919('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe919('0x4'));var util=require(_0xe919('0x5'));var path=require(_0xe919('0x6'));var sox=require(_0xe919('0x7'));var csv=require(_0xe919('0x8'));var ejs=require(_0xe919('0x9'));var fs=require('fs');var fs_extra=require(_0xe919('0xa'));var _=require('lodash');var squel=require(_0xe919('0xb'));var crypto=require(_0xe919('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe919('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe919('0xe'));var Papa=require(_0xe919('0xf'));var Redis=require(_0xe919('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe919('0x11'));var as=require(_0xe919('0x12'));var hardwareService=require(_0xe919('0x13'));var logger=require('../../config/logger')(_0xe919('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe919('0x15'))['db'];function respondWithStatusCode(_0xb06def,_0x40d013){_0x40d013=_0x40d013||0xcc;return function(_0x525f3e){if(_0x525f3e){return _0xb06def['sendStatus'](_0x40d013);}return _0xb06def[_0xe919('0x16')](_0x40d013)[_0xe919('0x17')]();};}function respondWithResult(_0x5c44d4,_0x3c09be){_0x3c09be=_0x3c09be||0xc8;return function(_0x1f88a0){if(_0x1f88a0){return _0x5c44d4[_0xe919('0x16')](_0x3c09be)[_0xe919('0x18')](_0x1f88a0);}};}function respondWithFilteredResult(_0x1e2bdd,_0x20d095){return function(_0x33b067){if(_0x33b067){var _0x5768f8=typeof _0x20d095[_0xe919('0x19')]==='undefined'&&typeof _0x20d095['limit']===_0xe919('0x1a');var _0x1ca098=_0x33b067['count'];var _0x4b3ea3=_0x5768f8?0x0:_0x20d095['offset'];var _0x1c820f=_0x5768f8?_0x33b067[_0xe919('0x1b')]:_0x20d095[_0xe919('0x19')]+_0x20d095[_0xe919('0x1c')];var _0x4a6945;if(_0x1c820f>=_0x1ca098){_0x1c820f=_0x1ca098;_0x4a6945=0xc8;}else{_0x4a6945=0xce;}_0x1e2bdd['status'](_0x4a6945);return _0x1e2bdd[_0xe919('0x1d')](_0xe919('0x1e'),_0x4b3ea3+'-'+_0x1c820f+'/'+_0x1ca098)[_0xe919('0x18')](_0x33b067);}return null;};}function patchUpdates(_0xd2a816){return function(_0x48d99f){try{jsonpatch[_0xe919('0x1f')](_0x48d99f,_0xd2a816,!![]);}catch(_0xc39074){return BPromise['reject'](_0xc39074);}return _0x48d99f['save']();};}function saveUpdates(_0x175b39,_0x483515){return function(_0x53e428){if(_0x53e428){return _0x53e428[_0xe919('0x20')](_0x175b39)[_0xe919('0x21')](function(_0x57056a){return _0x57056a;});}return null;};}function removeEntity(_0x26e01d,_0x5694b0){return function(_0x422934){if(_0x422934){return _0x422934[_0xe919('0x22')]()['then'](function(){_0x26e01d[_0xe919('0x16')](0xcc)[_0xe919('0x17')]();});}};}function handleEntityNotFound(_0x4607f5,_0x509bfa){return function(_0x2bb8d6){if(!_0x2bb8d6){_0x4607f5[_0xe919('0x23')](0x194);}return _0x2bb8d6;};}function handleError(_0x58f7a3,_0x19580b){_0x19580b=_0x19580b||0x1f4;return function(_0x354849){logger[_0xe919('0x24')](_0x354849['stack']);if(_0x354849[_0xe919('0x25')]){delete _0x354849['name'];}_0x58f7a3[_0xe919('0x16')](_0x19580b)[_0xe919('0x26')](_0x354849);};}exports['index']=function(_0x29b693,_0x5adb9b){var _0x101522={},_0x46d4f4={},_0x16d3a2={'count':0x0,'rows':[]};var _0x50e5cc=_[_0xe919('0x27')](db[_0xe919('0x28')][_0xe919('0x29')],function(_0x1090d4){return{'name':_0x1090d4[_0xe919('0x2a')],'type':_0x1090d4[_0xe919('0x2b')][_0xe919('0x2c')]};});_0x46d4f4[_0xe919('0x2d')]=_['map'](_0x50e5cc,_0xe919('0x25'));_0x46d4f4[_0xe919('0x2e')]=_['keys'](_0x29b693['query']);_0x46d4f4[_0xe919('0x2f')]=_[_0xe919('0x30')](_0x46d4f4[_0xe919('0x2d')],_0x46d4f4[_0xe919('0x2e')]);_0x101522[_0xe919('0x31')]=_[_0xe919('0x30')](_0x46d4f4[_0xe919('0x2d')],qs[_0xe919('0x32')](_0x29b693['query'][_0xe919('0x32')]));_0x101522[_0xe919('0x31')]=_0x101522[_0xe919('0x31')][_0xe919('0x33')]?_0x101522[_0xe919('0x31')]:_0x46d4f4[_0xe919('0x2d')];if(!_0x29b693[_0xe919('0x2e')][_0xe919('0x34')](_0xe919('0x35'))){_0x101522['limit']=qs[_0xe919('0x1c')](_0x29b693['query'][_0xe919('0x1c')]);_0x101522['offset']=qs['offset'](_0x29b693[_0xe919('0x2e')]['offset']);}_0x101522[_0xe919('0x36')]=qs[_0xe919('0x37')](_0x29b693['query']['sort']);_0x101522[_0xe919('0x38')]=qs[_0xe919('0x2f')](_[_0xe919('0x39')](_0x29b693[_0xe919('0x2e')],_0x46d4f4[_0xe919('0x2f')]),_0x50e5cc);if(_0x29b693[_0xe919('0x2e')][_0xe919('0x3a')]){_0x101522[_0xe919('0x38')]=_[_0xe919('0x3b')](_0x101522[_0xe919('0x38')],{'$or':_[_0xe919('0x27')](_0x50e5cc,function(_0x160774){if(_0x160774[_0xe919('0x2b')]!==_0xe919('0x3c')){var _0x35de99={};_0x35de99[_0x160774['name']]={'$like':'%'+_0x29b693[_0xe919('0x2e')][_0xe919('0x3a')]+'%'};return _0x35de99;}})});}_0x101522=_['merge']({},_0x101522,_0x29b693[_0xe919('0x3d')]);var _0xe34037={'where':_0x101522[_0xe919('0x38')]};return db[_0xe919('0x28')][_0xe919('0x1b')](_0xe34037)[_0xe919('0x21')](function(_0x48a291){_0x16d3a2[_0xe919('0x1b')]=_0x48a291;if(_0x29b693['query'][_0xe919('0x3e')]){_0x101522[_0xe919('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0xe919('0x40')](_0x101522);})[_0xe919('0x21')](function(_0x717cce){_0x16d3a2[_0xe919('0x41')]=_0x717cce;return _0x16d3a2;})[_0xe919('0x21')](respondWithFilteredResult(_0x5adb9b,_0x101522))[_0xe919('0x42')](handleError(_0x5adb9b,null));};exports[_0xe919('0x43')]=function(_0x347384,_0xf4ec66){var _0x435bd8={'raw':!![],'where':{'id':_0x347384[_0xe919('0x44')]['id']}},_0x4cbdea={};_0x4cbdea['model']=_['keys'](db[_0xe919('0x28')][_0xe919('0x29')]);_0x4cbdea['query']=_[_0xe919('0x45')](_0x347384[_0xe919('0x2e')]);_0x4cbdea[_0xe919('0x2f')]=_['intersection'](_0x4cbdea[_0xe919('0x2d')],_0x4cbdea[_0xe919('0x2e')]);_0x435bd8[_0xe919('0x31')]=_[_0xe919('0x30')](_0x4cbdea['model'],qs[_0xe919('0x32')](_0x347384[_0xe919('0x2e')]['fields']));_0x435bd8[_0xe919('0x31')]=_0x435bd8[_0xe919('0x31')][_0xe919('0x33')]?_0x435bd8[_0xe919('0x31')]:_0x4cbdea[_0xe919('0x2d')];if(_0x347384['query'][_0xe919('0x3e')]){_0x435bd8['include']=[{'all':!![]}];}_0x435bd8=_[_0xe919('0x3b')]({},_0x435bd8,_0x347384[_0xe919('0x3d')]);return db[_0xe919('0x28')][_0xe919('0x46')](_0x435bd8)[_0xe919('0x21')](handleEntityNotFound(_0xf4ec66,null))[_0xe919('0x21')](respondWithResult(_0xf4ec66,null))[_0xe919('0x42')](handleError(_0xf4ec66,null));};exports['create']=function(_0x3cd8f4,_0x19d7b3){return db[_0xe919('0x28')]['create'](_0x3cd8f4[_0xe919('0x47')],{})[_0xe919('0x21')](respondWithResult(_0x19d7b3,0xc9))['catch'](handleError(_0x19d7b3,null));};exports[_0xe919('0x20')]=function(_0x3da722,_0x300d64){if(_0x3da722[_0xe919('0x47')]['id']){delete _0x3da722[_0xe919('0x47')]['id'];}return db[_0xe919('0x28')]['find']({'where':{'id':_0x3da722[_0xe919('0x44')]['id']}})[_0xe919('0x21')](handleEntityNotFound(_0x300d64,null))['then'](saveUpdates(_0x3da722[_0xe919('0x47')],null))[_0xe919('0x21')](respondWithResult(_0x300d64,null))[_0xe919('0x42')](handleError(_0x300d64,null));};exports[_0xe919('0x22')]=function(_0x125160,_0x1aae2c){return db[_0xe919('0x28')][_0xe919('0x46')]({'where':{'id':_0x125160[_0xe919('0x44')]['id']}})[_0xe919('0x21')](handleEntityNotFound(_0x1aae2c,null))['then'](removeEntity(_0x1aae2c,null))[_0xe919('0x42')](handleError(_0x1aae2c,null));};exports[_0xe919('0x48')]=function(_0x3a44bb,_0x3d4b2a){return db[_0xe919('0x28')][_0xe919('0x48')]()[_0xe919('0x21')](respondWithResult(_0x3d4b2a,null))[_0xe919('0x42')](handleError(_0x3d4b2a,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index a16d12e..7e8218c 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x2c033c,_0x37bb3c){var _0x497768=function(_0x2d9219){while(--_0x2d9219){_0x2c033c['push'](_0x2c033c['shift']());}};_0x497768(++_0x37bb3c);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x1fa081,_0x4e93e2){var _0x40dfee=function(_0x47b13d){while(--_0x47b13d){_0x1fa081['push'](_0x1fa081['shift']());}};_0x40dfee(++_0x4e93e2);}(_0x7a54,0x106));var _0x47a5=function(_0x3f28bd,_0x17d691){_0x3f28bd=_0x3f28bd-0x0;var _0x598bbf=_0x7a54[_0x3f28bd];return _0x598bbf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index d14a3a1..7bf1c33 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 _0x0caa=['../../config/environment','jayson/promise','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x0caa,0x188));var _0xa0ca=function(_0x77a3a1,_0xb5b96e){_0x77a3a1=_0x77a3a1-0x0;var _0xa0648e=_0x0caa[_0x77a3a1];return _0xa0648e;};'use strict';var _=require(_0xa0ca('0x0'));var util=require('util');var moment=require(_0xa0ca('0x1'));var BPromise=require(_0xa0ca('0x2'));var rs=require(_0xa0ca('0x3'));var fs=require('fs');var Redis=require(_0xa0ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0ca('0x5'));var logger=require(_0xa0ca('0x6'))('rpc');var config=require(_0xa0ca('0x7'));var jayson=require(_0xa0ca('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1944d8,_0x47c648,_0x187b3d){return new BPromise(function(_0x28ffa1,_0x14485){return client[_0xa0ca('0x9')](_0x1944d8,_0x187b3d)[_0xa0ca('0xa')](function(_0x3e9ba0){logger[_0xa0ca('0xb')](_0xa0ca('0xc'),_0x47c648,'request\x20sent');logger[_0xa0ca('0xd')](_0xa0ca('0xe'),_0x47c648,_0xa0ca('0xf'),JSON[_0xa0ca('0x10')](_0x3e9ba0));if(_0x3e9ba0[_0xa0ca('0x11')]){if(_0x3e9ba0[_0xa0ca('0x11')][_0xa0ca('0x12')]===0x1f4){logger[_0xa0ca('0x11')](_0xa0ca('0xc'),_0x47c648,_0x3e9ba0['error']['message']);return _0x14485(_0x3e9ba0[_0xa0ca('0x11')]['message']);}logger[_0xa0ca('0x11')](_0xa0ca('0xc'),_0x47c648,_0x3e9ba0[_0xa0ca('0x11')][_0xa0ca('0x13')]);return _0x28ffa1(_0x3e9ba0[_0xa0ca('0x11')][_0xa0ca('0x13')]);}else{logger['info'](_0xa0ca('0xc'),_0x47c648,'request\x20sent');_0x28ffa1(_0x3e9ba0['result'][_0xa0ca('0x13')]);}})[_0xa0ca('0x14')](function(_0x306507){logger[_0xa0ca('0x11')](_0xa0ca('0xc'),_0x47c648,_0x306507);_0x14485(_0x306507);});});} \ No newline at end of file +var _0xf178=['message','info','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Cdr,\x20%s,\x20%s'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xf178,0xa3));var _0x8f17=function(_0x391bce,_0x4dcec1){_0x391bce=_0x391bce-0x0;var _0x14075b=_0xf178[_0x391bce];return _0x14075b;};'use strict';var _=require('lodash');var util=require(_0x8f17('0x0'));var moment=require(_0x8f17('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f17('0x2'));var db=require(_0x8f17('0x3'))['db'];var utils=require(_0x8f17('0x4'));var logger=require(_0x8f17('0x5'))(_0x8f17('0x6'));var config=require(_0x8f17('0x7'));var jayson=require(_0x8f17('0x8'));var client=jayson[_0x8f17('0x9')][_0x8f17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x224122,_0x419e4f,_0x4f09f3){return new BPromise(function(_0x39c546,_0x25b925){return client[_0x8f17('0xb')](_0x224122,_0x4f09f3)['then'](function(_0x70c2e7){logger['info']('Cdr,\x20%s,\x20%s',_0x419e4f,'request\x20sent');logger['debug'](_0x8f17('0xc'),_0x419e4f,_0x8f17('0xd'),JSON[_0x8f17('0xe')](_0x70c2e7));if(_0x70c2e7[_0x8f17('0xf')]){if(_0x70c2e7['error']['code']===0x1f4){logger[_0x8f17('0xf')](_0x8f17('0x10'),_0x419e4f,_0x70c2e7[_0x8f17('0xf')][_0x8f17('0x11')]);return _0x25b925(_0x70c2e7[_0x8f17('0xf')]['message']);}logger[_0x8f17('0xf')](_0x8f17('0x10'),_0x419e4f,_0x70c2e7['error'][_0x8f17('0x11')]);return _0x39c546(_0x70c2e7['error'][_0x8f17('0x11')]);}else{logger[_0x8f17('0x12')](_0x8f17('0x10'),_0x419e4f,_0x8f17('0xd'));_0x39c546(_0x70c2e7[_0x8f17('0x13')][_0x8f17('0x11')]);}})['catch'](function(_0x1ba416){logger[_0x8f17('0xf')](_0x8f17('0x10'),_0x419e4f,_0x1ba416);_0x25b925(_0x1ba416);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 51a1667..97ed472 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(_0x4f6856,_0x2dbb97){var _0x36cafd=function(_0x2d782b){while(--_0x2d782b){_0x4f6856['push'](_0x4f6856['shift']());}};_0x36cafd(++_0x2dbb97);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index d0dba6b..b046d87 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 _0x8edd=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1762c4,_0xb87aa1){var _0x1c8b14=function(_0xd5631c){while(--_0xd5631c){_0x1762c4['push'](_0x1762c4['shift']());}};_0x1c8b14(++_0xb87aa1);}(_0x8edd,0x8d));var _0xd8ed=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x8edd[_0x1f7201];return _0x289fd2;};'use strict';var Sequelize=require(_0xd8ed('0x0'));module[_0xd8ed('0x1')]={'priority':{'type':Sequelize[_0xd8ed('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd8ed('0x3')],'allowNull':![],'defaultValue':_0xd8ed('0x4')},'appdata':{'type':Sequelize[_0xd8ed('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd8ed('0x3')],'defaultValue':_0xd8ed('0x6')}}; \ No newline at end of file +var _0x07df=['STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3f798d,_0x4cf2b7){var _0x36d478=function(_0x162dad){while(--_0x162dad){_0x3f798d['push'](_0x3f798d['shift']());}};_0x36d478(++_0x4cf2b7);}(_0x07df,0xfe));var _0xf07d=function(_0x50612d,_0x11166e){_0x50612d=_0x50612d-0x0;var _0x542103=_0x07df[_0x50612d];return _0x542103;};'use strict';var Sequelize=require(_0xf07d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf07d('0x1')],'allowNull':![],'defaultValue':_0xf07d('0x2')},'appdata':{'type':Sequelize[_0xf07d('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf07d('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ad1e890..ed00416 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 _0x63c6=['include','merge','options','find','body','ChatApplication','catch','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll'];(function(_0x40c58d,_0xca539f){var _0x2a8381=function(_0x4a1f4d){while(--_0x4a1f4d){_0x40c58d['push'](_0x40c58d['shift']());}};_0x2a8381(++_0xca539f);}(_0x63c6,0xbb));var _0x663c=function(_0x3b1978,_0x1e1123){_0x3b1978=_0x3b1978-0x0;var _0x26c5a7=_0x63c6[_0x3b1978];return _0x26c5a7;};'use strict';var emlformat=require(_0x663c('0x0'));var rimraf=require(_0x663c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x663c('0x2'));var moment=require(_0x663c('0x3'));var BPromise=require(_0x663c('0x4'));var Mustache=require(_0x663c('0x5'));var util=require(_0x663c('0x6'));var path=require(_0x663c('0x7'));var sox=require(_0x663c('0x8'));var csv=require(_0x663c('0x9'));var ejs=require(_0x663c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x663c('0xb'));var squel=require(_0x663c('0xc'));var crypto=require(_0x663c('0xd'));var jsforce=require(_0x663c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x663c('0x9'));var querystring=require('querystring');var Papa=require(_0x663c('0xf'));var Redis=require('ioredis');var authService=require(_0x663c('0x10'));var qs=require(_0x663c('0x11'));var as=require(_0x663c('0x12'));var hardwareService=require(_0x663c('0x13'));var logger=require(_0x663c('0x14'))(_0x663c('0x15'));var utils=require(_0x663c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x663c('0x17'))['db'];function respondWithStatusCode(_0xe80d02,_0x588da1){_0x588da1=_0x588da1||0xcc;return function(_0x20038d){if(_0x20038d){return _0xe80d02[_0x663c('0x18')](_0x588da1);}return _0xe80d02[_0x663c('0x19')](_0x588da1)[_0x663c('0x1a')]();};}function respondWithResult(_0x5ef6af,_0xa119a1){_0xa119a1=_0xa119a1||0xc8;return function(_0x165454){if(_0x165454){return _0x5ef6af['status'](_0xa119a1)[_0x663c('0x1b')](_0x165454);}};}function respondWithFilteredResult(_0x523322,_0x44ffaa){return function(_0xb1e1bf){if(_0xb1e1bf){var _0x2a7b0d=typeof _0x44ffaa[_0x663c('0x1c')]===_0x663c('0x1d')&&typeof _0x44ffaa[_0x663c('0x1e')]===_0x663c('0x1d');var _0x41cc9d=_0xb1e1bf[_0x663c('0x1f')];var _0x3c87fe=_0x2a7b0d?0x0:_0x44ffaa['offset'];var _0x2fd707=_0x2a7b0d?_0xb1e1bf[_0x663c('0x1f')]:_0x44ffaa[_0x663c('0x1c')]+_0x44ffaa['limit'];var _0x137670;if(_0x2fd707>=_0x41cc9d){_0x2fd707=_0x41cc9d;_0x137670=0xc8;}else{_0x137670=0xce;}_0x523322[_0x663c('0x19')](_0x137670);return _0x523322[_0x663c('0x20')](_0x663c('0x21'),_0x3c87fe+'-'+_0x2fd707+'/'+_0x41cc9d)[_0x663c('0x1b')](_0xb1e1bf);}return null;};}function patchUpdates(_0x54fa2f){return function(_0xcf6ced){try{jsonpatch[_0x663c('0x22')](_0xcf6ced,_0x54fa2f,!![]);}catch(_0x319224){return BPromise[_0x663c('0x23')](_0x319224);}return _0xcf6ced['save']();};}function saveUpdates(_0x5a9e96,_0x2ac148){return function(_0x34135d){if(_0x34135d){return _0x34135d[_0x663c('0x24')](_0x5a9e96)[_0x663c('0x25')](function(_0x352a21){return _0x352a21;});}return null;};}function removeEntity(_0x53986f,_0x4984dc){return function(_0x4b7213){if(_0x4b7213){return _0x4b7213[_0x663c('0x26')]()[_0x663c('0x25')](function(){_0x53986f[_0x663c('0x19')](0xcc)[_0x663c('0x1a')]();});}};}function handleEntityNotFound(_0x5e6b45,_0xd82689){return function(_0x417181){if(!_0x417181){_0x5e6b45[_0x663c('0x18')](0x194);}return _0x417181;};}function handleError(_0x20ca5,_0x3581a3){_0x3581a3=_0x3581a3||0x1f4;return function(_0x5a56cd){logger[_0x663c('0x27')](_0x5a56cd['stack']);if(_0x5a56cd[_0x663c('0x28')]){delete _0x5a56cd['name'];}_0x20ca5['status'](_0x3581a3)[_0x663c('0x29')](_0x5a56cd);};}exports['show']=function(_0x16f30b,_0x274a2a){var _0x30ff6f={'raw':!![],'where':{'id':_0x16f30b[_0x663c('0x2a')]['id']}},_0x46d722={};_0x46d722[_0x663c('0x2b')]=_[_0x663c('0x2c')](db['ChatApplication'][_0x663c('0x2d')]);_0x46d722[_0x663c('0x2e')]=_[_0x663c('0x2c')](_0x16f30b[_0x663c('0x2e')]);_0x46d722[_0x663c('0x2f')]=_[_0x663c('0x30')](_0x46d722['model'],_0x46d722[_0x663c('0x2e')]);_0x30ff6f['attributes']=_[_0x663c('0x30')](_0x46d722['model'],qs['fields'](_0x16f30b['query'][_0x663c('0x31')]));_0x30ff6f[_0x663c('0x32')]=_0x30ff6f['attributes'][_0x663c('0x33')]?_0x30ff6f[_0x663c('0x32')]:_0x46d722['model'];if(_0x16f30b[_0x663c('0x2e')][_0x663c('0x34')]){_0x30ff6f[_0x663c('0x35')]=[{'all':!![]}];}_0x30ff6f=_[_0x663c('0x36')]({},_0x30ff6f,_0x16f30b[_0x663c('0x37')]);return db['ChatApplication'][_0x663c('0x38')](_0x30ff6f)[_0x663c('0x25')](handleEntityNotFound(_0x274a2a,null))[_0x663c('0x25')](respondWithResult(_0x274a2a,null))['catch'](handleError(_0x274a2a,null));};exports[_0x663c('0x24')]=function(_0x310846,_0x136637){if(_0x310846[_0x663c('0x39')]['id']){delete _0x310846['body']['id'];}return db[_0x663c('0x3a')][_0x663c('0x38')]({'where':{'id':_0x310846[_0x663c('0x2a')]['id']}})[_0x663c('0x25')](handleEntityNotFound(_0x136637,null))['then'](saveUpdates(_0x310846['body'],null))[_0x663c('0x25')](respondWithResult(_0x136637,null))[_0x663c('0x3b')](handleError(_0x136637,null));};exports['destroy']=function(_0x27de09,_0x5d90e2){return db[_0x663c('0x3a')][_0x663c('0x38')]({'where':{'id':_0x27de09['params']['id']}})[_0x663c('0x25')](handleEntityNotFound(_0x5d90e2,null))[_0x663c('0x25')](removeEntity(_0x5d90e2,null))['catch'](handleError(_0x5d90e2,null));}; \ No newline at end of file +var _0x8b2b=['set','Content-Range','reject','save','update','then','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','ChatApplication','find','catch','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count'];(function(_0x3b01af,_0x295155){var _0x418e36=function(_0x200f1f){while(--_0x200f1f){_0x3b01af['push'](_0x3b01af['shift']());}};_0x418e36(++_0x295155);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x2872e0,_0x217dec){_0x2872e0=_0x2872e0-0x0;var _0x3be12d=_0x8b2b[_0x2872e0];return _0x3be12d;};'use strict';var emlformat=require(_0xb8b2('0x0'));var rimraf=require(_0xb8b2('0x1'));var zipdir=require(_0xb8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8b2('0x3'));var moment=require(_0xb8b2('0x4'));var BPromise=require(_0xb8b2('0x5'));var Mustache=require(_0xb8b2('0x6'));var util=require(_0xb8b2('0x7'));var path=require(_0xb8b2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb8b2('0x9'));var fs=require('fs');var fs_extra=require(_0xb8b2('0xa'));var _=require(_0xb8b2('0xb'));var squel=require(_0xb8b2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8b2('0xd'));var toCsv=require(_0xb8b2('0xe'));var querystring=require(_0xb8b2('0xf'));var Papa=require(_0xb8b2('0x10'));var Redis=require(_0xb8b2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb8b2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b2('0x13'))(_0xb8b2('0x14'));var utils=require(_0xb8b2('0x15'));var config=require(_0xb8b2('0x16'));var licenseUtil=require(_0xb8b2('0x17'));var db=require(_0xb8b2('0x18'))['db'];function respondWithStatusCode(_0x584d41,_0x3440bf){_0x3440bf=_0x3440bf||0xcc;return function(_0x5bd724){if(_0x5bd724){return _0x584d41['sendStatus'](_0x3440bf);}return _0x584d41['status'](_0x3440bf)[_0xb8b2('0x19')]();};}function respondWithResult(_0xdc1d1d,_0x48b9df){_0x48b9df=_0x48b9df||0xc8;return function(_0x175885){if(_0x175885){return _0xdc1d1d[_0xb8b2('0x1a')](_0x48b9df)[_0xb8b2('0x1b')](_0x175885);}};}function respondWithFilteredResult(_0x142fb0,_0x46a592){return function(_0x5b614d){if(_0x5b614d){var _0x4b5a28=typeof _0x46a592[_0xb8b2('0x1c')]===_0xb8b2('0x1d')&&typeof _0x46a592[_0xb8b2('0x1e')]===_0xb8b2('0x1d');var _0xf04672=_0x5b614d['count'];var _0x47b94f=_0x4b5a28?0x0:_0x46a592[_0xb8b2('0x1c')];var _0x153b69=_0x4b5a28?_0x5b614d[_0xb8b2('0x1f')]:_0x46a592[_0xb8b2('0x1c')]+_0x46a592['limit'];var _0x23af66;if(_0x153b69>=_0xf04672){_0x153b69=_0xf04672;_0x23af66=0xc8;}else{_0x23af66=0xce;}_0x142fb0[_0xb8b2('0x1a')](_0x23af66);return _0x142fb0[_0xb8b2('0x20')](_0xb8b2('0x21'),_0x47b94f+'-'+_0x153b69+'/'+_0xf04672)[_0xb8b2('0x1b')](_0x5b614d);}return null;};}function patchUpdates(_0x1cbc65){return function(_0x34ca46){try{jsonpatch['apply'](_0x34ca46,_0x1cbc65,!![]);}catch(_0x382bbf){return BPromise[_0xb8b2('0x22')](_0x382bbf);}return _0x34ca46[_0xb8b2('0x23')]();};}function saveUpdates(_0x162d41,_0x316d3c){return function(_0x5a0a43){if(_0x5a0a43){return _0x5a0a43[_0xb8b2('0x24')](_0x162d41)['then'](function(_0xe3b28){return _0xe3b28;});}return null;};}function removeEntity(_0x8239a7,_0x2b40f8){return function(_0x20082f){if(_0x20082f){return _0x20082f['destroy']()[_0xb8b2('0x25')](function(){_0x8239a7[_0xb8b2('0x1a')](0xcc)[_0xb8b2('0x19')]();});}};}function handleEntityNotFound(_0x5a2afe,_0x49c5b1){return function(_0x517c2a){if(!_0x517c2a){_0x5a2afe['sendStatus'](0x194);}return _0x517c2a;};}function handleError(_0x36ae2d,_0x10d8f3){_0x10d8f3=_0x10d8f3||0x1f4;return function(_0x3bdb27){logger[_0xb8b2('0x26')](_0x3bdb27[_0xb8b2('0x27')]);if(_0x3bdb27[_0xb8b2('0x28')]){delete _0x3bdb27[_0xb8b2('0x28')];}_0x36ae2d[_0xb8b2('0x1a')](_0x10d8f3)[_0xb8b2('0x29')](_0x3bdb27);};}exports[_0xb8b2('0x2a')]=function(_0x2a236d,_0x6ae308){var _0x140b18={'raw':!![],'where':{'id':_0x2a236d[_0xb8b2('0x2b')]['id']}},_0xeb28c8={};_0xeb28c8[_0xb8b2('0x2c')]=_[_0xb8b2('0x2d')](db['ChatApplication'][_0xb8b2('0x2e')]);_0xeb28c8[_0xb8b2('0x2f')]=_[_0xb8b2('0x2d')](_0x2a236d[_0xb8b2('0x2f')]);_0xeb28c8[_0xb8b2('0x30')]=_['intersection'](_0xeb28c8[_0xb8b2('0x2c')],_0xeb28c8[_0xb8b2('0x2f')]);_0x140b18[_0xb8b2('0x31')]=_['intersection'](_0xeb28c8[_0xb8b2('0x2c')],qs[_0xb8b2('0x32')](_0x2a236d['query'][_0xb8b2('0x32')]));_0x140b18[_0xb8b2('0x31')]=_0x140b18[_0xb8b2('0x31')][_0xb8b2('0x33')]?_0x140b18[_0xb8b2('0x31')]:_0xeb28c8[_0xb8b2('0x2c')];if(_0x2a236d[_0xb8b2('0x2f')][_0xb8b2('0x34')]){_0x140b18[_0xb8b2('0x35')]=[{'all':!![]}];}_0x140b18=_[_0xb8b2('0x36')]({},_0x140b18,_0x2a236d['options']);return db[_0xb8b2('0x37')][_0xb8b2('0x38')](_0x140b18)['then'](handleEntityNotFound(_0x6ae308,null))[_0xb8b2('0x25')](respondWithResult(_0x6ae308,null))[_0xb8b2('0x39')](handleError(_0x6ae308,null));};exports[_0xb8b2('0x24')]=function(_0x350b23,_0xc3ac6){if(_0x350b23[_0xb8b2('0x3a')]['id']){delete _0x350b23[_0xb8b2('0x3a')]['id'];}return db[_0xb8b2('0x37')][_0xb8b2('0x38')]({'where':{'id':_0x350b23[_0xb8b2('0x2b')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0xc3ac6,null))[_0xb8b2('0x25')](saveUpdates(_0x350b23[_0xb8b2('0x3a')],null))[_0xb8b2('0x25')](respondWithResult(_0xc3ac6,null))[_0xb8b2('0x39')](handleError(_0xc3ac6,null));};exports[_0xb8b2('0x3b')]=function(_0x50c3d1,_0x9d012d){return db[_0xb8b2('0x37')][_0xb8b2('0x38')]({'where':{'id':_0x50c3d1[_0xb8b2('0x2b')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x9d012d,null))[_0xb8b2('0x25')](removeEntity(_0x9d012d,null))[_0xb8b2('0x39')](handleError(_0x9d012d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a6e7e68..b91bce8 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 _0xbf94=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4'];(function(_0x1923e3,_0x123a69){var _0x9ca0fb=function(_0x752792){while(--_0x752792){_0x1923e3['push'](_0x1923e3['shift']());}};_0x9ca0fb(++_0x123a69);}(_0xbf94,0x146));var _0x4bf9=function(_0x1818cf,_0x3df67c){_0x1818cf=_0x1818cf-0x0;var _0xf45fd4=_0xbf94[_0x1818cf];return _0xf45fd4;};'use strict';var _=require(_0x4bf9('0x0'));var util=require(_0x4bf9('0x1'));var logger=require(_0x4bf9('0x2'))(_0x4bf9('0x3'));var moment=require('moment');var BPromise=require(_0x4bf9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bf9('0x5'));var rimraf=require('rimraf');var config=require(_0x4bf9('0x6'));var attributes=require(_0x4bf9('0x7'));module['exports']=function(_0x1ef7f1,_0x5a2932){return _0x1ef7f1[_0x4bf9('0x8')](_0x4bf9('0x9'),attributes,{'tableName':_0x4bf9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4bf9('0xb'),'collate':_0x4bf9('0xc')});}; \ No newline at end of file +var _0xc200=['path','rimraf','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x102470,_0x199a01){var _0x558eaa=function(_0x12c74a){while(--_0x12c74a){_0x102470['push'](_0x102470['shift']());}};_0x558eaa(++_0x199a01);}(_0xc200,0x19e));var _0x0c20=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc200[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x0c20('0x0'));var util=require(_0x0c20('0x1'));var logger=require('../../config/logger')(_0x0c20('0x2'));var moment=require(_0x0c20('0x3'));var BPromise=require(_0x0c20('0x4'));var rp=require(_0x0c20('0x5'));var fs=require('fs');var path=require(_0x0c20('0x6'));var rimraf=require(_0x0c20('0x7'));var config=require(_0x0c20('0x8'));var attributes=require('./chatApplication.attributes');module[_0x0c20('0x9')]=function(_0x5407b0,_0xa49b23){return _0x5407b0['define'](_0x0c20('0xa'),attributes,{'tableName':_0x0c20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0c20('0xc'),'collate':_0x0c20('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 88fde0a..d753b11 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 _0xacc6=['request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5a3b91,_0x48bd35){var _0x4ba82a=function(_0x50ff14){while(--_0x50ff14){_0x5a3b91['push'](_0x5a3b91['shift']());}};_0x4ba82a(++_0x48bd35);}(_0xacc6,0x12c));var _0x6acc=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0xacc6[_0x52b24f];return _0x46ea6b;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var moment=require(_0x6acc('0x2'));var BPromise=require(_0x6acc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6acc('0x4'));var db=require(_0x6acc('0x5'))['db'];var utils=require(_0x6acc('0x6'));var logger=require('../../config/logger')(_0x6acc('0x7'));var config=require(_0x6acc('0x8'));var jayson=require(_0x6acc('0x9'));var client=jayson[_0x6acc('0xa')][_0x6acc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26fe9e,_0x37a920,_0x343cde){return new BPromise(function(_0x444352,_0x355037){return client[_0x6acc('0xc')](_0x26fe9e,_0x343cde)['then'](function(_0x2ebf02){logger[_0x6acc('0xd')](_0x6acc('0xe'),_0x37a920,_0x6acc('0xf'));logger[_0x6acc('0x10')](_0x6acc('0x11'),_0x37a920,'request\x20sent',JSON[_0x6acc('0x12')](_0x2ebf02));if(_0x2ebf02[_0x6acc('0x13')]){if(_0x2ebf02[_0x6acc('0x13')][_0x6acc('0x14')]===0x1f4){logger['error'](_0x6acc('0xe'),_0x37a920,_0x2ebf02[_0x6acc('0x13')]['message']);return _0x355037(_0x2ebf02['error'][_0x6acc('0x15')]);}logger[_0x6acc('0x13')](_0x6acc('0xe'),_0x37a920,_0x2ebf02['error']['message']);return _0x444352(_0x2ebf02[_0x6acc('0x13')]['message']);}else{logger['info'](_0x6acc('0xe'),_0x37a920,'request\x20sent');_0x444352(_0x2ebf02[_0x6acc('0x16')]['message']);}})[_0x6acc('0x17')](function(_0x1cb2cd){logger[_0x6acc('0x13')](_0x6acc('0xe'),_0x37a920,_0x1cb2cd);_0x355037(_0x1cb2cd);});});} \ No newline at end of file +var _0x69c8=['result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1103e6,_0x3a0217){var _0x5bc0ef=function(_0x3e979b){while(--_0x3e979b){_0x1103e6['push'](_0x1103e6['shift']());}};_0x5bc0ef(++_0x3a0217);}(_0x69c8,0x1bb));var _0x869c=function(_0x205d4f,_0x1551d7){_0x205d4f=_0x205d4f-0x0;var _0x2a740b=_0x69c8[_0x205d4f];return _0x2a740b;};'use strict';var _=require(_0x869c('0x0'));var util=require('util');var moment=require(_0x869c('0x1'));var BPromise=require(_0x869c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x869c('0x3'))['db'];var utils=require(_0x869c('0x4'));var logger=require(_0x869c('0x5'))(_0x869c('0x6'));var config=require(_0x869c('0x7'));var jayson=require(_0x869c('0x8'));var client=jayson['client'][_0x869c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4637a5,_0x4e4f00,_0x181d3c){return new BPromise(function(_0x28ea6c,_0x3304ca){return client['request'](_0x4637a5,_0x181d3c)['then'](function(_0x4ca15a){logger[_0x869c('0xa')](_0x869c('0xb'),_0x4e4f00,'request\x20sent');logger[_0x869c('0xc')](_0x869c('0xd'),_0x4e4f00,_0x869c('0xe'),JSON[_0x869c('0xf')](_0x4ca15a));if(_0x4ca15a[_0x869c('0x10')]){if(_0x4ca15a[_0x869c('0x10')][_0x869c('0x11')]===0x1f4){logger[_0x869c('0x10')](_0x869c('0xb'),_0x4e4f00,_0x4ca15a[_0x869c('0x10')][_0x869c('0x12')]);return _0x3304ca(_0x4ca15a['error']['message']);}logger[_0x869c('0x10')](_0x869c('0xb'),_0x4e4f00,_0x4ca15a['error']['message']);return _0x28ea6c(_0x4ca15a[_0x869c('0x10')]['message']);}else{logger[_0x869c('0xa')](_0x869c('0xb'),_0x4e4f00,_0x869c('0xe'));_0x28ea6c(_0x4ca15a[_0x869c('0x13')][_0x869c('0x12')]);}})[_0x869c('0x14')](function(_0x1e4b0f){logger[_0x869c('0x10')](_0x869c('0xb'),_0x4e4f00,_0x1e4b0f);_0x3304ca(_0x1e4b0f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index cadcac7..0e6be8f 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 _0xb9b6=['get','/:id','isAuthenticated','show','put','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x42a2f4,_0x4213f6){var _0x36b9e1=function(_0x4e3aa6){while(--_0x4e3aa6){_0x42a2f4['push'](_0x42a2f4['shift']());}};_0x36b9e1(++_0x4213f6);}(_0xb9b6,0x181));var _0x6b9b=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0xb9b6[_0x2e3107];return _0x833d69;};'use strict';var multer=require(_0x6b9b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b9b('0x1'));var express=require(_0x6b9b('0x2'));var router=express[_0x6b9b('0x3')]();var fs_extra=require(_0x6b9b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6b9b('0x5'));var config=require(_0x6b9b('0x6'));var controller=require('./chatApplication.controller');router[_0x6b9b('0x7')](_0x6b9b('0x8'),auth[_0x6b9b('0x9')](),controller[_0x6b9b('0xa')]);router[_0x6b9b('0xb')](_0x6b9b('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x6b9b('0xc')](_0x6b9b('0x8'),auth[_0x6b9b('0x9')](),controller['destroy']);module[_0x6b9b('0xd')]=router; \ No newline at end of file +var _0xd06e=['show','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x733977,_0x3c29e0){var _0x1b9b53=function(_0x39ac2a){while(--_0x39ac2a){_0x733977['push'](_0x733977['shift']());}};_0x1b9b53(++_0x3c29e0);}(_0xd06e,0x15b));var _0xed06=function(_0x480676,_0x49a1ce){_0x480676=_0x480676-0x0;var _0x2d75ec=_0xd06e[_0x480676];return _0x2d75ec;};'use strict';var multer=require(_0xed06('0x0'));var util=require(_0xed06('0x1'));var path=require(_0xed06('0x2'));var timeout=require(_0xed06('0x3'));var express=require(_0xed06('0x4'));var router=express['Router']();var fs_extra=require(_0xed06('0x5'));var auth=require(_0xed06('0x6'));var interaction=require(_0xed06('0x7'));var config=require(_0xed06('0x8'));var controller=require(_0xed06('0x9'));router[_0xed06('0xa')](_0xed06('0xb'),auth[_0xed06('0xc')](),controller[_0xed06('0xd')]);router[_0xed06('0xe')]('/:id',auth[_0xed06('0xc')](),controller[_0xed06('0xf')]);router[_0xed06('0x10')](_0xed06('0xb'),auth[_0xed06('0xc')](),controller[_0xed06('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7e9bb6f..c6ab74e 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 _0x5ae0=['STRING','BOOLEAN','exports'];(function(_0x2da7c6,_0x479760){var _0x334db5=function(_0x3a1268){while(--_0x3a1268){_0x2da7c6['push'](_0x2da7c6['shift']());}};_0x334db5(++_0x479760);}(_0x5ae0,0xf8));var _0x05ae=function(_0x4e422d,_0x505fc8){_0x4e422d=_0x4e422d-0x0;var _0x3d4f4d=_0x5ae0[_0x4e422d];return _0x3d4f4d;};'use strict';var Sequelize=require('sequelize');module[_0x05ae('0x0')]={'name':{'type':Sequelize[_0x05ae('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x05ae('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x55aa=['STRING','BOOLEAN','exports'];(function(_0x11165e,_0x38ef90){var _0x27ae1a=function(_0x39deed){while(--_0x39deed){_0x11165e['push'](_0x11165e['shift']());}};_0x27ae1a(++_0x38ef90);}(_0x55aa,0x146));var _0xa55a=function(_0x2919e2,_0x3bed37){_0x2919e2=_0x2919e2-0x0;var _0x4d1062=_0x55aa[_0x2919e2];return _0x4d1062;};'use strict';var Sequelize=require('sequelize');module[_0xa55a('0x0')]={'name':{'type':Sequelize[_0xa55a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa55a('0x1')]},'write':{'type':Sequelize[_0xa55a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4e81898..72b0a6a 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 _0x660e=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','length','options','find','create','update','body','params','describe','toInteger','addMembers','omit','getMembers','findOne','User','removeMembers','ids','addMessage','ChatGroupId','ChatInternalMessage','pick','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis'];(function(_0x864853,_0x1b7287){var _0x2d1509=function(_0x3c8ed2){while(--_0x3c8ed2){_0x864853['push'](_0x864853['shift']());}};_0x2d1509(++_0x1b7287);}(_0x660e,0x1c6));var _0xe660=function(_0x1b69f5,_0x528d25){_0x1b69f5=_0x1b69f5-0x0;var _0x35fbfb=_0x660e[_0x1b69f5];return _0x35fbfb;};'use strict';var emlformat=require(_0xe660('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe660('0x1'));var jsonpatch=require(_0xe660('0x2'));var rp=require('request-promise');var moment=require(_0xe660('0x3'));var BPromise=require(_0xe660('0x4'));var Mustache=require('mustache');var util=require(_0xe660('0x5'));var path=require(_0xe660('0x6'));var sox=require(_0xe660('0x7'));var csv=require(_0xe660('0x8'));var ejs=require(_0xe660('0x9'));var fs=require('fs');var fs_extra=require(_0xe660('0xa'));var _=require(_0xe660('0xb'));var squel=require('squel');var crypto=require(_0xe660('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe660('0xd'));var toCsv=require(_0xe660('0x8'));var querystring=require(_0xe660('0xe'));var Papa=require('papaparse');var Redis=require(_0xe660('0xf'));var authService=require(_0xe660('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe660('0x11'));var logger=require(_0xe660('0x12'))(_0xe660('0x13'));var utils=require(_0xe660('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe660('0x15'));var db=require(_0xe660('0x16'))['db'];config[_0xe660('0x17')]=_['defaults'](config[_0xe660('0x17')],{'host':_0xe660('0x18'),'port':0x18eb});var socket=require(_0xe660('0x19'))(new Redis(config[_0xe660('0x17')]));require(_0xe660('0x1a'))['register'](socket);function respondWithStatusCode(_0x2fb757,_0x502c47){_0x502c47=_0x502c47||0xcc;return function(_0x156d2b){if(_0x156d2b){return _0x2fb757[_0xe660('0x1b')](_0x502c47);}return _0x2fb757[_0xe660('0x1c')](_0x502c47)['end']();};}function respondWithResult(_0x5c894f,_0x11519a){_0x11519a=_0x11519a||0xc8;return function(_0x194836){if(_0x194836){return _0x5c894f[_0xe660('0x1c')](_0x11519a)[_0xe660('0x1d')](_0x194836);}};}function respondWithFilteredResult(_0x2a0356,_0x13c3a5){return function(_0x33a32e){if(_0x33a32e){var _0x5df609=typeof _0x13c3a5['offset']===_0xe660('0x1e')&&typeof _0x13c3a5['limit']===_0xe660('0x1e');var _0x324198=_0x33a32e['count'];var _0x1df447=_0x5df609?0x0:_0x13c3a5['offset'];var _0x4eedd0=_0x5df609?_0x33a32e[_0xe660('0x1f')]:_0x13c3a5[_0xe660('0x20')]+_0x13c3a5[_0xe660('0x21')];var _0x18aff9;if(_0x4eedd0>=_0x324198){_0x4eedd0=_0x324198;_0x18aff9=0xc8;}else{_0x18aff9=0xce;}_0x2a0356['status'](_0x18aff9);return _0x2a0356[_0xe660('0x22')](_0xe660('0x23'),_0x1df447+'-'+_0x4eedd0+'/'+_0x324198)[_0xe660('0x1d')](_0x33a32e);}return null;};}function patchUpdates(_0x395870){return function(_0x30e2fa){try{jsonpatch[_0xe660('0x24')](_0x30e2fa,_0x395870,!![]);}catch(_0x38a89d){return BPromise[_0xe660('0x25')](_0x38a89d);}return _0x30e2fa[_0xe660('0x26')]();};}function saveUpdates(_0x30adad,_0x218032){return function(_0x54177a){if(_0x54177a){return _0x54177a['update'](_0x30adad)['then'](function(_0x4ca9f5){return _0x4ca9f5;});}return null;};}function removeEntity(_0x15871f,_0x18f95c){return function(_0x5412ca){if(_0x5412ca){return _0x5412ca[_0xe660('0x27')]()[_0xe660('0x28')](function(){_0x15871f[_0xe660('0x1c')](0xcc)[_0xe660('0x29')]();});}};}function handleEntityNotFound(_0x13e640,_0x1f2ac9){return function(_0x2d10e5){if(!_0x2d10e5){_0x13e640['sendStatus'](0x194);}return _0x2d10e5;};}function handleError(_0x180498,_0x1ecb7c){_0x1ecb7c=_0x1ecb7c||0x1f4;return function(_0xa1586c){logger[_0xe660('0x2a')](_0xa1586c[_0xe660('0x2b')]);if(_0xa1586c[_0xe660('0x2c')]){delete _0xa1586c[_0xe660('0x2c')];}_0x180498[_0xe660('0x1c')](_0x1ecb7c)[_0xe660('0x2d')](_0xa1586c);};}exports[_0xe660('0x2e')]=function(_0x5e7d25,_0x42dfb5){var _0x11cbb2={},_0xc0d754={},_0x2b9b06={'count':0x0,'rows':[]};var _0xb05440=_[_0xe660('0x2f')](db[_0xe660('0x30')][_0xe660('0x31')],function(_0x710911){return{'name':_0x710911[_0xe660('0x32')],'type':_0x710911[_0xe660('0x33')]['key']};});_0xc0d754['model']=_['map'](_0xb05440,_0xe660('0x2c'));_0xc0d754[_0xe660('0x34')]=_[_0xe660('0x35')](_0x5e7d25[_0xe660('0x34')]);_0xc0d754[_0xe660('0x36')]=_['intersection'](_0xc0d754['model'],_0xc0d754[_0xe660('0x34')]);_0x11cbb2['attributes']=_[_0xe660('0x37')](_0xc0d754[_0xe660('0x38')],qs['fields'](_0x5e7d25[_0xe660('0x34')][_0xe660('0x39')]));_0x11cbb2['attributes']=_0x11cbb2[_0xe660('0x3a')]['length']?_0x11cbb2[_0xe660('0x3a')]:_0xc0d754[_0xe660('0x38')];if(!_0x5e7d25[_0xe660('0x34')]['hasOwnProperty'](_0xe660('0x3b'))){_0x11cbb2[_0xe660('0x21')]=qs['limit'](_0x5e7d25[_0xe660('0x34')][_0xe660('0x21')]);_0x11cbb2['offset']=qs[_0xe660('0x20')](_0x5e7d25[_0xe660('0x34')][_0xe660('0x20')]);}_0x11cbb2[_0xe660('0x3c')]=qs[_0xe660('0x3d')](_0x5e7d25['query'][_0xe660('0x3d')]);_0x11cbb2[_0xe660('0x3e')]=qs[_0xe660('0x36')](_['pick'](_0x5e7d25[_0xe660('0x34')],_0xc0d754[_0xe660('0x36')]),_0xb05440);if(_0x5e7d25[_0xe660('0x34')][_0xe660('0x3f')]){_0x11cbb2['where']=_[_0xe660('0x40')](_0x11cbb2[_0xe660('0x3e')],{'$or':_[_0xe660('0x2f')](_0xb05440,function(_0x24dd3e){if(_0x24dd3e['type']!=='VIRTUAL'){var _0x57a5e6={};_0x57a5e6[_0x24dd3e[_0xe660('0x2c')]]={'$like':'%'+_0x5e7d25[_0xe660('0x34')][_0xe660('0x3f')]+'%'};return _0x57a5e6;}})});}_0x11cbb2=_[_0xe660('0x40')]({},_0x11cbb2,_0x5e7d25['options']);var _0x300bdd={'where':_0x11cbb2[_0xe660('0x3e')]};return db[_0xe660('0x30')]['count'](_0x300bdd)[_0xe660('0x28')](function(_0x284825){_0x2b9b06[_0xe660('0x1f')]=_0x284825;if(_0x5e7d25[_0xe660('0x34')][_0xe660('0x41')]){_0x11cbb2[_0xe660('0x42')]=[{'all':!![]}];}return db[_0xe660('0x30')][_0xe660('0x43')](_0x11cbb2);})['then'](function(_0x222b79){_0x2b9b06[_0xe660('0x44')]=_0x222b79;return _0x2b9b06;})[_0xe660('0x28')](respondWithFilteredResult(_0x42dfb5,_0x11cbb2))[_0xe660('0x45')](handleError(_0x42dfb5,null));};exports[_0xe660('0x46')]=function(_0x13fc20,_0x378fdb){var _0x3d218={'raw':!![],'where':{'id':_0x13fc20['params']['id']}},_0x596944={};_0x596944['model']=_[_0xe660('0x35')](db['ChatGroup'][_0xe660('0x31')]);_0x596944['query']=_[_0xe660('0x35')](_0x13fc20['query']);_0x596944[_0xe660('0x36')]=_['intersection'](_0x596944[_0xe660('0x38')],_0x596944['query']);_0x3d218['attributes']=_[_0xe660('0x37')](_0x596944[_0xe660('0x38')],qs[_0xe660('0x39')](_0x13fc20['query'][_0xe660('0x39')]));_0x3d218['attributes']=_0x3d218[_0xe660('0x3a')][_0xe660('0x47')]?_0x3d218[_0xe660('0x3a')]:_0x596944[_0xe660('0x38')];if(_0x13fc20[_0xe660('0x34')][_0xe660('0x41')]){_0x3d218[_0xe660('0x42')]=[{'all':!![]}];}_0x3d218=_[_0xe660('0x40')]({},_0x3d218,_0x13fc20[_0xe660('0x48')]);return db[_0xe660('0x30')][_0xe660('0x49')](_0x3d218)[_0xe660('0x28')](handleEntityNotFound(_0x378fdb,null))[_0xe660('0x28')](respondWithResult(_0x378fdb,null))[_0xe660('0x45')](handleError(_0x378fdb,null));};exports[_0xe660('0x4a')]=function(_0xeebe22,_0x476dcf){return db[_0xe660('0x30')]['create'](_0xeebe22['body'],{})['then'](respondWithResult(_0x476dcf,0xc9))[_0xe660('0x45')](handleError(_0x476dcf,null));};exports[_0xe660('0x4b')]=function(_0x3cdee6,_0x323823){if(_0x3cdee6[_0xe660('0x4c')]['id']){delete _0x3cdee6['body']['id'];}return db['ChatGroup'][_0xe660('0x49')]({'where':{'id':_0x3cdee6[_0xe660('0x4d')]['id']}})['then'](handleEntityNotFound(_0x323823,null))[_0xe660('0x28')](saveUpdates(_0x3cdee6[_0xe660('0x4c')],null))['then'](respondWithResult(_0x323823,null))[_0xe660('0x45')](handleError(_0x323823,null));};exports[_0xe660('0x27')]=function(_0x1dd58b,_0x33a59f){return db['ChatGroup'][_0xe660('0x49')]({'where':{'id':_0x1dd58b[_0xe660('0x4d')]['id']}})[_0xe660('0x28')](handleEntityNotFound(_0x33a59f,null))[_0xe660('0x28')](removeEntity(_0x33a59f,null))[_0xe660('0x45')](handleError(_0x33a59f,null));};exports[_0xe660('0x4e')]=function(_0x306115,_0x5b5c2c){return db[_0xe660('0x30')][_0xe660('0x4e')]()[_0xe660('0x28')](respondWithResult(_0x5b5c2c,null))['catch'](handleError(_0x5b5c2c,null));};exports['getUnread']=function(_0x5e00dc,_0x5a89d5,_0x2c445b){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x5e00dc[_0xe660('0x4d')]['id'],'ToId':_0x5e00dc['user']['id'],'read':![]}})[_0xe660('0x28')](function(_0x9f8567){return{'id':_[_0xe660('0x4f')](_0x5e00dc['params']['id']),'count':_0x9f8567};})[_0xe660('0x28')](respondWithResult(_0x5a89d5,null))[_0xe660('0x45')](handleError(_0x5a89d5,null));};exports[_0xe660('0x50')]=function(_0x5bf95c,_0x112963,_0x4f378b){return db[_0xe660('0x30')]['find']({'where':{'id':_0x5bf95c[_0xe660('0x4d')]['id']}})[_0xe660('0x28')](handleEntityNotFound(_0x112963,null))['then'](function(_0x24449a){if(_0x24449a){return _0x24449a['addMembers'](_0x5bf95c[_0xe660('0x4c')]['ids'],_[_0xe660('0x51')](_0x5bf95c[_0xe660('0x4c')],['ids','id'])||{});}})[_0xe660('0x28')](respondWithResult(_0x112963,null))[_0xe660('0x45')](handleError(_0x112963,null));};exports[_0xe660('0x52')]=function(_0x4ac23c,_0x18ed61,_0x34f23e){var _0x50eefb={};var _0x42f751={};var _0x3c5af6;var _0x2b6c3f;return db[_0xe660('0x30')][_0xe660('0x53')]({'where':{'id':_0x4ac23c[_0xe660('0x4d')]['id']}})[_0xe660('0x28')](handleEntityNotFound(_0x18ed61,null))[_0xe660('0x28')](function(_0x20941e){if(_0x20941e){_0x3c5af6=_0x20941e;_0x42f751[_0xe660('0x38')]=_[_0xe660('0x35')](db[_0xe660('0x54')][_0xe660('0x31')]);_0x42f751[_0xe660('0x34')]=_[_0xe660('0x35')](_0x4ac23c['query']);_0x42f751[_0xe660('0x36')]=_['intersection'](_0x42f751[_0xe660('0x38')],_0x42f751[_0xe660('0x34')]);_0x50eefb[_0xe660('0x3a')]=_[_0xe660('0x37')](_0x42f751[_0xe660('0x38')],qs[_0xe660('0x39')](_0x4ac23c['query'][_0xe660('0x39')]));_0x50eefb['attributes']=_0x50eefb['attributes'][_0xe660('0x47')]?_0x50eefb[_0xe660('0x3a')]:_0x42f751[_0xe660('0x38')];_0x50eefb[_0xe660('0x3c')]=qs[_0xe660('0x3d')](_0x4ac23c[_0xe660('0x34')][_0xe660('0x3d')]);_0x50eefb[_0xe660('0x3e')]=qs[_0xe660('0x36')](_['pick'](_0x4ac23c[_0xe660('0x34')],_0x42f751[_0xe660('0x36')]));if(_0x4ac23c['query'][_0xe660('0x3f')]){_0x50eefb[_0xe660('0x3e')]=_['merge'](_0x50eefb[_0xe660('0x3e')],{'$or':_[_0xe660('0x2f')](_0x50eefb['attributes'],function(_0x36eb45){var _0x239717={};_0x239717[_0x36eb45]={'$like':'%'+_0x4ac23c[_0xe660('0x34')]['filter']+'%'};return _0x239717;})});}_0x50eefb=_[_0xe660('0x40')]({},_0x50eefb,_0x4ac23c[_0xe660('0x48')]);return _0x3c5af6[_0xe660('0x52')](_0x50eefb);}})['then'](function(_0x541b42){if(_0x541b42){_0x2b6c3f=_0x541b42[_0xe660('0x47')];if(!_0x4ac23c[_0xe660('0x34')]['hasOwnProperty'](_0xe660('0x3b'))){_0x50eefb['limit']=qs['limit'](_0x4ac23c[_0xe660('0x34')][_0xe660('0x21')]);_0x50eefb[_0xe660('0x20')]=qs['offset'](_0x4ac23c['query'][_0xe660('0x20')]);}return _0x3c5af6[_0xe660('0x52')](_0x50eefb);}})[_0xe660('0x28')](function(_0x5191cd){if(_0x5191cd){return _0x5191cd?{'count':_0x2b6c3f,'rows':_0x5191cd}:null;}})['then'](respondWithResult(_0x18ed61,null))[_0xe660('0x45')](handleError(_0x18ed61,null));};exports[_0xe660('0x55')]=function(_0x4ad535,_0x49353f,_0x187ff6){return db[_0xe660('0x30')][_0xe660('0x49')]({'where':{'id':_0x4ad535[_0xe660('0x4d')]['id']}})[_0xe660('0x28')](handleEntityNotFound(_0x49353f,null))[_0xe660('0x28')](function(_0x553504){if(_0x553504){return _0x553504[_0xe660('0x55')](_0x4ad535[_0xe660('0x34')][_0xe660('0x56')]);}})[_0xe660('0x28')](respondWithStatusCode(_0x49353f,null))[_0xe660('0x45')](handleError(_0x49353f,null));};exports[_0xe660('0x57')]=function(_0x1f03f2,_0x1f0777,_0x2349b5){if(_0x1f03f2['body']['id']){delete _0x1f03f2[_0xe660('0x4c')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x1f03f2['params']['id']}})['then'](handleEntityNotFound(_0x1f0777,null))[_0xe660('0x28')](function(_0x224059){if(_0x224059){_0x1f03f2[_0xe660('0x4c')][_0xe660('0x58')]=_0x224059['id'];return db['ChatInternalMessage'][_0xe660('0x4a')](_0x1f03f2[_0xe660('0x4c')]);}})[_0xe660('0x28')](respondWithResult(_0x1f0777,null))[_0xe660('0x45')](handleError(_0x1f0777,null));};exports['getMessages']=function(_0x56f86f,_0x1dcabd,_0x3c84dc){var _0x320b91={};var _0x180e0a={};var _0x40ae18;var _0x5a8602;return db[_0xe660('0x30')][_0xe660('0x53')]({'where':{'id':_0x56f86f[_0xe660('0x4d')]['id']}})[_0xe660('0x28')](handleEntityNotFound(_0x1dcabd,null))[_0xe660('0x28')](function(_0x2ae34a){if(_0x2ae34a){_0x40ae18=_0x2ae34a;_0x180e0a[_0xe660('0x38')]=_[_0xe660('0x35')](db[_0xe660('0x59')][_0xe660('0x31')]);_0x180e0a[_0xe660('0x34')]=_[_0xe660('0x35')](_0x56f86f[_0xe660('0x34')]);_0x180e0a[_0xe660('0x36')]=_[_0xe660('0x37')](_0x180e0a[_0xe660('0x38')],_0x180e0a[_0xe660('0x34')]);_0x320b91[_0xe660('0x3a')]=_['intersection'](_0x180e0a[_0xe660('0x38')],qs[_0xe660('0x39')](_0x56f86f[_0xe660('0x34')][_0xe660('0x39')]));_0x320b91[_0xe660('0x3a')]=_0x320b91[_0xe660('0x3a')][_0xe660('0x47')]?_0x320b91['attributes']:_0x180e0a[_0xe660('0x38')];_0x320b91[_0xe660('0x3c')]=qs['sort'](_0x56f86f[_0xe660('0x34')][_0xe660('0x3d')]);_0x320b91[_0xe660('0x3e')]=qs['filters'](_[_0xe660('0x5a')](_0x56f86f['query'],_0x180e0a[_0xe660('0x36')]));if(_0x56f86f[_0xe660('0x34')][_0xe660('0x3f')]){_0x320b91[_0xe660('0x3e')]=_[_0xe660('0x40')](_0x320b91[_0xe660('0x3e')],{'$or':_[_0xe660('0x2f')](_0x320b91[_0xe660('0x3a')],function(_0x57344b){var _0x4d7ad6={};_0x4d7ad6[_0x57344b]={'$like':'%'+_0x56f86f[_0xe660('0x34')][_0xe660('0x3f')]+'%'};return _0x4d7ad6;})});}if(_0x56f86f[_0xe660('0x34')]['$gte']){var _0x25e8e2=_0x56f86f[_0xe660('0x34')]['$gte'][_0xe660('0x5b')](',');var _0x51b9a7={};_0x51b9a7[_0x25e8e2[0x0]]={'$gte':moment(_0x25e8e2[0x1])['format'](_0xe660('0x5c'))};_0x320b91[_0xe660('0x3e')]=_[_0xe660('0x40')](_0x320b91[_0xe660('0x3e')],_0x51b9a7);}_0x320b91=_[_0xe660('0x40')]({},_0x320b91,_0x56f86f[_0xe660('0x48')]);return _0x40ae18[_0xe660('0x5d')](_0x320b91);}})['then'](function(_0x4c70f0){if(_0x4c70f0){_0x5a8602=_0x4c70f0[_0xe660('0x47')];if(!_0x56f86f[_0xe660('0x34')]['hasOwnProperty'](_0xe660('0x3b'))){_0x320b91[_0xe660('0x21')]=qs['limit'](_0x56f86f['query'][_0xe660('0x21')]);_0x320b91[_0xe660('0x20')]=qs[_0xe660('0x20')](_0x56f86f[_0xe660('0x34')][_0xe660('0x20')]);}return _0x40ae18[_0xe660('0x5d')](_0x320b91);}})[_0xe660('0x28')](function(_0x239644){if(_0x239644){return _0x239644?{'count':_0x5a8602,'rows':_0x239644}:null;}})['then'](respondWithResult(_0x1dcabd,null))['catch'](handleError(_0x1dcabd,null));}; \ No newline at end of file +var _0xec8a=['ChatInternalMessage','user','omit','ids','getMembers','findOne','pick','hasOwnProperty','removeMembers','addMessage','getMessages','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','nolimit','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','params','fields','length','find','create','body','destroy','describe','getUnread'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0xec8a,0x73));var _0xaec8=function(_0x58e5a5,_0x19b94b){_0x58e5a5=_0x58e5a5-0x0;var _0x362b61=_0xec8a[_0x58e5a5];return _0x362b61;};'use strict';var emlformat=require(_0xaec8('0x0'));var rimraf=require(_0xaec8('0x1'));var zipdir=require(_0xaec8('0x2'));var jsonpatch=require(_0xaec8('0x3'));var rp=require(_0xaec8('0x4'));var moment=require(_0xaec8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaec8('0x6'));var util=require('util');var path=require(_0xaec8('0x7'));var sox=require('sox');var csv=require(_0xaec8('0x8'));var ejs=require(_0xaec8('0x9'));var fs=require('fs');var fs_extra=require(_0xaec8('0xa'));var _=require(_0xaec8('0xb'));var squel=require(_0xaec8('0xc'));var crypto=require('crypto');var jsforce=require(_0xaec8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaec8('0x8'));var querystring=require(_0xaec8('0xe'));var Papa=require(_0xaec8('0xf'));var Redis=require(_0xaec8('0x10'));var authService=require(_0xaec8('0x11'));var qs=require(_0xaec8('0x12'));var as=require(_0xaec8('0x13'));var hardwareService=require(_0xaec8('0x14'));var logger=require('../../config/logger')(_0xaec8('0x15'));var utils=require(_0xaec8('0x16'));var config=require(_0xaec8('0x17'));var licenseUtil=require(_0xaec8('0x18'));var db=require(_0xaec8('0x19'))['db'];config[_0xaec8('0x1a')]=_[_0xaec8('0x1b')](config[_0xaec8('0x1a')],{'host':_0xaec8('0x1c'),'port':0x18eb});var socket=require(_0xaec8('0x1d'))(new Redis(config[_0xaec8('0x1a')]));require(_0xaec8('0x1e'))['register'](socket);function respondWithStatusCode(_0x2e7dcd,_0x1340d0){_0x1340d0=_0x1340d0||0xcc;return function(_0x4080e2){if(_0x4080e2){return _0x2e7dcd[_0xaec8('0x1f')](_0x1340d0);}return _0x2e7dcd[_0xaec8('0x20')](_0x1340d0)['end']();};}function respondWithResult(_0x10af0d,_0x297568){_0x297568=_0x297568||0xc8;return function(_0x73653f){if(_0x73653f){return _0x10af0d[_0xaec8('0x20')](_0x297568)[_0xaec8('0x21')](_0x73653f);}};}function respondWithFilteredResult(_0x5b6696,_0x33d75d){return function(_0x298723){if(_0x298723){var _0x4658f5=typeof _0x33d75d[_0xaec8('0x22')]===_0xaec8('0x23')&&typeof _0x33d75d[_0xaec8('0x24')]===_0xaec8('0x23');var _0x52b37d=_0x298723['count'];var _0x4d4b8a=_0x4658f5?0x0:_0x33d75d[_0xaec8('0x22')];var _0x59e820=_0x4658f5?_0x298723[_0xaec8('0x25')]:_0x33d75d['offset']+_0x33d75d['limit'];var _0x5cbecd;if(_0x59e820>=_0x52b37d){_0x59e820=_0x52b37d;_0x5cbecd=0xc8;}else{_0x5cbecd=0xce;}_0x5b6696[_0xaec8('0x20')](_0x5cbecd);return _0x5b6696[_0xaec8('0x26')](_0xaec8('0x27'),_0x4d4b8a+'-'+_0x59e820+'/'+_0x52b37d)['json'](_0x298723);}return null;};}function patchUpdates(_0x5052cf){return function(_0x4566c2){try{jsonpatch[_0xaec8('0x28')](_0x4566c2,_0x5052cf,!![]);}catch(_0x251274){return BPromise[_0xaec8('0x29')](_0x251274);}return _0x4566c2[_0xaec8('0x2a')]();};}function saveUpdates(_0x2f067c,_0x4f6c31){return function(_0x1fc9b8){if(_0x1fc9b8){return _0x1fc9b8[_0xaec8('0x2b')](_0x2f067c)['then'](function(_0x101bc7){return _0x101bc7;});}return null;};}function removeEntity(_0x59661e,_0xea716){return function(_0x3b096c){if(_0x3b096c){return _0x3b096c['destroy']()[_0xaec8('0x2c')](function(){_0x59661e[_0xaec8('0x20')](0xcc)[_0xaec8('0x2d')]();});}};}function handleEntityNotFound(_0x213d70,_0x3c7bb5){return function(_0x36298e){if(!_0x36298e){_0x213d70['sendStatus'](0x194);}return _0x36298e;};}function handleError(_0x1d2468,_0x5bb7ae){_0x5bb7ae=_0x5bb7ae||0x1f4;return function(_0x4e3a90){logger[_0xaec8('0x2e')](_0x4e3a90[_0xaec8('0x2f')]);if(_0x4e3a90['name']){delete _0x4e3a90[_0xaec8('0x30')];}_0x1d2468[_0xaec8('0x20')](_0x5bb7ae)[_0xaec8('0x31')](_0x4e3a90);};}exports[_0xaec8('0x32')]=function(_0x30246c,_0x4ad4c9){var _0x482517={},_0x3ce592={},_0x2a050e={'count':0x0,'rows':[]};var _0x9bd750=_[_0xaec8('0x33')](db[_0xaec8('0x34')][_0xaec8('0x35')],function(_0xa634f3){return{'name':_0xa634f3[_0xaec8('0x36')],'type':_0xa634f3[_0xaec8('0x37')][_0xaec8('0x38')]};});_0x3ce592['model']=_[_0xaec8('0x33')](_0x9bd750,'name');_0x3ce592[_0xaec8('0x39')]=_[_0xaec8('0x3a')](_0x30246c[_0xaec8('0x39')]);_0x3ce592['filters']=_[_0xaec8('0x3b')](_0x3ce592[_0xaec8('0x3c')],_0x3ce592[_0xaec8('0x39')]);_0x482517[_0xaec8('0x3d')]=_[_0xaec8('0x3b')](_0x3ce592[_0xaec8('0x3c')],qs['fields'](_0x30246c[_0xaec8('0x39')]['fields']));_0x482517[_0xaec8('0x3d')]=_0x482517[_0xaec8('0x3d')]['length']?_0x482517[_0xaec8('0x3d')]:_0x3ce592[_0xaec8('0x3c')];if(!_0x30246c['query']['hasOwnProperty'](_0xaec8('0x3e'))){_0x482517[_0xaec8('0x24')]=qs['limit'](_0x30246c[_0xaec8('0x39')][_0xaec8('0x24')]);_0x482517[_0xaec8('0x22')]=qs[_0xaec8('0x22')](_0x30246c[_0xaec8('0x39')]['offset']);}_0x482517['order']=qs[_0xaec8('0x3f')](_0x30246c['query']['sort']);_0x482517[_0xaec8('0x40')]=qs[_0xaec8('0x41')](_['pick'](_0x30246c['query'],_0x3ce592[_0xaec8('0x41')]),_0x9bd750);if(_0x30246c[_0xaec8('0x39')][_0xaec8('0x42')]){_0x482517['where']=_['merge'](_0x482517[_0xaec8('0x40')],{'$or':_[_0xaec8('0x33')](_0x9bd750,function(_0x135ad9){if(_0x135ad9[_0xaec8('0x37')]!=='VIRTUAL'){var _0x5f1b9f={};_0x5f1b9f[_0x135ad9[_0xaec8('0x30')]]={'$like':'%'+_0x30246c['query'][_0xaec8('0x42')]+'%'};return _0x5f1b9f;}})});}_0x482517=_[_0xaec8('0x43')]({},_0x482517,_0x30246c[_0xaec8('0x44')]);var _0xbc1de8={'where':_0x482517[_0xaec8('0x40')]};return db[_0xaec8('0x34')][_0xaec8('0x25')](_0xbc1de8)[_0xaec8('0x2c')](function(_0x4c96f4){_0x2a050e['count']=_0x4c96f4;if(_0x30246c[_0xaec8('0x39')][_0xaec8('0x45')]){_0x482517[_0xaec8('0x46')]=[{'all':!![]}];}return db[_0xaec8('0x34')]['findAll'](_0x482517);})[_0xaec8('0x2c')](function(_0x9acf9f){_0x2a050e[_0xaec8('0x47')]=_0x9acf9f;return _0x2a050e;})['then'](respondWithFilteredResult(_0x4ad4c9,_0x482517))[_0xaec8('0x48')](handleError(_0x4ad4c9,null));};exports[_0xaec8('0x49')]=function(_0x156b2f,_0x97591f){var _0x28aac6={'raw':!![],'where':{'id':_0x156b2f[_0xaec8('0x4a')]['id']}},_0x2561a6={};_0x2561a6[_0xaec8('0x3c')]=_['keys'](db[_0xaec8('0x34')]['rawAttributes']);_0x2561a6[_0xaec8('0x39')]=_[_0xaec8('0x3a')](_0x156b2f[_0xaec8('0x39')]);_0x2561a6[_0xaec8('0x41')]=_[_0xaec8('0x3b')](_0x2561a6[_0xaec8('0x3c')],_0x2561a6[_0xaec8('0x39')]);_0x28aac6[_0xaec8('0x3d')]=_[_0xaec8('0x3b')](_0x2561a6[_0xaec8('0x3c')],qs[_0xaec8('0x4b')](_0x156b2f['query']['fields']));_0x28aac6['attributes']=_0x28aac6['attributes'][_0xaec8('0x4c')]?_0x28aac6[_0xaec8('0x3d')]:_0x2561a6[_0xaec8('0x3c')];if(_0x156b2f[_0xaec8('0x39')][_0xaec8('0x45')]){_0x28aac6['include']=[{'all':!![]}];}_0x28aac6=_[_0xaec8('0x43')]({},_0x28aac6,_0x156b2f[_0xaec8('0x44')]);return db[_0xaec8('0x34')][_0xaec8('0x4d')](_0x28aac6)[_0xaec8('0x2c')](handleEntityNotFound(_0x97591f,null))['then'](respondWithResult(_0x97591f,null))[_0xaec8('0x48')](handleError(_0x97591f,null));};exports[_0xaec8('0x4e')]=function(_0x4f2016,_0x54454c){return db[_0xaec8('0x34')][_0xaec8('0x4e')](_0x4f2016[_0xaec8('0x4f')],{})[_0xaec8('0x2c')](respondWithResult(_0x54454c,0xc9))[_0xaec8('0x48')](handleError(_0x54454c,null));};exports[_0xaec8('0x2b')]=function(_0x41fb7f,_0x3a8a2e){if(_0x41fb7f['body']['id']){delete _0x41fb7f[_0xaec8('0x4f')]['id'];}return db[_0xaec8('0x34')][_0xaec8('0x4d')]({'where':{'id':_0x41fb7f[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x3a8a2e,null))[_0xaec8('0x2c')](saveUpdates(_0x41fb7f[_0xaec8('0x4f')],null))[_0xaec8('0x2c')](respondWithResult(_0x3a8a2e,null))[_0xaec8('0x48')](handleError(_0x3a8a2e,null));};exports[_0xaec8('0x50')]=function(_0x3e4dc4,_0x1a44c7){return db['ChatGroup'][_0xaec8('0x4d')]({'where':{'id':_0x3e4dc4[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x1a44c7,null))['then'](removeEntity(_0x1a44c7,null))[_0xaec8('0x48')](handleError(_0x1a44c7,null));};exports['describe']=function(_0x4eb966,_0xf8baa1){return db[_0xaec8('0x34')][_0xaec8('0x51')]()[_0xaec8('0x2c')](respondWithResult(_0xf8baa1,null))[_0xaec8('0x48')](handleError(_0xf8baa1,null));};exports[_0xaec8('0x52')]=function(_0x384567,_0x6dee1e,_0x5bf54e){return db[_0xaec8('0x53')][_0xaec8('0x25')]({'where':{'ChatGroupId':_0x384567['params']['id'],'ToId':_0x384567[_0xaec8('0x54')]['id'],'read':![]}})['then'](function(_0x51047c){return{'id':_['toInteger'](_0x384567[_0xaec8('0x4a')]['id']),'count':_0x51047c};})[_0xaec8('0x2c')](respondWithResult(_0x6dee1e,null))['catch'](handleError(_0x6dee1e,null));};exports['addMembers']=function(_0x58e95a,_0xf1b525,_0x2bc341){return db[_0xaec8('0x34')][_0xaec8('0x4d')]({'where':{'id':_0x58e95a[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0xf1b525,null))[_0xaec8('0x2c')](function(_0xd530b7){if(_0xd530b7){return _0xd530b7['addMembers'](_0x58e95a[_0xaec8('0x4f')]['ids'],_[_0xaec8('0x55')](_0x58e95a[_0xaec8('0x4f')],[_0xaec8('0x56'),'id'])||{});}})[_0xaec8('0x2c')](respondWithResult(_0xf1b525,null))[_0xaec8('0x48')](handleError(_0xf1b525,null));};exports[_0xaec8('0x57')]=function(_0x47a583,_0x290519,_0x2032eb){var _0x35553d={};var _0x23fa84={};var _0x3c604d;var _0x2ef7bd;return db[_0xaec8('0x34')][_0xaec8('0x58')]({'where':{'id':_0x47a583['params']['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x290519,null))['then'](function(_0xcca249){if(_0xcca249){_0x3c604d=_0xcca249;_0x23fa84[_0xaec8('0x3c')]=_['keys'](db['User'][_0xaec8('0x35')]);_0x23fa84[_0xaec8('0x39')]=_[_0xaec8('0x3a')](_0x47a583[_0xaec8('0x39')]);_0x23fa84[_0xaec8('0x41')]=_['intersection'](_0x23fa84['model'],_0x23fa84['query']);_0x35553d[_0xaec8('0x3d')]=_[_0xaec8('0x3b')](_0x23fa84[_0xaec8('0x3c')],qs[_0xaec8('0x4b')](_0x47a583['query'][_0xaec8('0x4b')]));_0x35553d[_0xaec8('0x3d')]=_0x35553d[_0xaec8('0x3d')]['length']?_0x35553d[_0xaec8('0x3d')]:_0x23fa84[_0xaec8('0x3c')];_0x35553d['order']=qs[_0xaec8('0x3f')](_0x47a583[_0xaec8('0x39')][_0xaec8('0x3f')]);_0x35553d[_0xaec8('0x40')]=qs['filters'](_[_0xaec8('0x59')](_0x47a583['query'],_0x23fa84['filters']));if(_0x47a583[_0xaec8('0x39')]['filter']){_0x35553d[_0xaec8('0x40')]=_[_0xaec8('0x43')](_0x35553d[_0xaec8('0x40')],{'$or':_[_0xaec8('0x33')](_0x35553d[_0xaec8('0x3d')],function(_0x5d6f4b){var _0x3f7249={};_0x3f7249[_0x5d6f4b]={'$like':'%'+_0x47a583[_0xaec8('0x39')][_0xaec8('0x42')]+'%'};return _0x3f7249;})});}_0x35553d=_[_0xaec8('0x43')]({},_0x35553d,_0x47a583[_0xaec8('0x44')]);return _0x3c604d[_0xaec8('0x57')](_0x35553d);}})['then'](function(_0x53e6ad){if(_0x53e6ad){_0x2ef7bd=_0x53e6ad[_0xaec8('0x4c')];if(!_0x47a583[_0xaec8('0x39')][_0xaec8('0x5a')](_0xaec8('0x3e'))){_0x35553d[_0xaec8('0x24')]=qs[_0xaec8('0x24')](_0x47a583[_0xaec8('0x39')][_0xaec8('0x24')]);_0x35553d[_0xaec8('0x22')]=qs[_0xaec8('0x22')](_0x47a583['query'][_0xaec8('0x22')]);}return _0x3c604d[_0xaec8('0x57')](_0x35553d);}})['then'](function(_0x553e01){if(_0x553e01){return _0x553e01?{'count':_0x2ef7bd,'rows':_0x553e01}:null;}})[_0xaec8('0x2c')](respondWithResult(_0x290519,null))['catch'](handleError(_0x290519,null));};exports[_0xaec8('0x5b')]=function(_0x132ac7,_0x344ade,_0x1c14ae){return db[_0xaec8('0x34')]['find']({'where':{'id':_0x132ac7[_0xaec8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x344ade,null))['then'](function(_0x505b82){if(_0x505b82){return _0x505b82[_0xaec8('0x5b')](_0x132ac7[_0xaec8('0x39')][_0xaec8('0x56')]);}})[_0xaec8('0x2c')](respondWithStatusCode(_0x344ade,null))[_0xaec8('0x48')](handleError(_0x344ade,null));};exports[_0xaec8('0x5c')]=function(_0x10526a,_0x2e9110,_0x3d3bb8){if(_0x10526a[_0xaec8('0x4f')]['id']){delete _0x10526a[_0xaec8('0x4f')]['id'];}return db[_0xaec8('0x34')][_0xaec8('0x4d')]({'where':{'id':_0x10526a[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x2e9110,null))['then'](function(_0x2fae7c){if(_0x2fae7c){_0x10526a[_0xaec8('0x4f')]['ChatGroupId']=_0x2fae7c['id'];return db[_0xaec8('0x53')][_0xaec8('0x4e')](_0x10526a[_0xaec8('0x4f')]);}})[_0xaec8('0x2c')](respondWithResult(_0x2e9110,null))[_0xaec8('0x48')](handleError(_0x2e9110,null));};exports[_0xaec8('0x5d')]=function(_0x59ce3f,_0x34f357,_0x3296a7){var _0x39e8bf={};var _0x16cbb0={};var _0x3874b4;var _0x317d0c;return db[_0xaec8('0x34')][_0xaec8('0x58')]({'where':{'id':_0x59ce3f[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x34f357,null))[_0xaec8('0x2c')](function(_0x17a8ee){if(_0x17a8ee){_0x3874b4=_0x17a8ee;_0x16cbb0[_0xaec8('0x3c')]=_[_0xaec8('0x3a')](db[_0xaec8('0x53')][_0xaec8('0x35')]);_0x16cbb0['query']=_[_0xaec8('0x3a')](_0x59ce3f[_0xaec8('0x39')]);_0x16cbb0['filters']=_['intersection'](_0x16cbb0[_0xaec8('0x3c')],_0x16cbb0[_0xaec8('0x39')]);_0x39e8bf[_0xaec8('0x3d')]=_[_0xaec8('0x3b')](_0x16cbb0['model'],qs['fields'](_0x59ce3f['query'][_0xaec8('0x4b')]));_0x39e8bf[_0xaec8('0x3d')]=_0x39e8bf[_0xaec8('0x3d')]['length']?_0x39e8bf[_0xaec8('0x3d')]:_0x16cbb0[_0xaec8('0x3c')];_0x39e8bf[_0xaec8('0x5e')]=qs[_0xaec8('0x3f')](_0x59ce3f[_0xaec8('0x39')][_0xaec8('0x3f')]);_0x39e8bf[_0xaec8('0x40')]=qs[_0xaec8('0x41')](_['pick'](_0x59ce3f[_0xaec8('0x39')],_0x16cbb0[_0xaec8('0x41')]));if(_0x59ce3f[_0xaec8('0x39')][_0xaec8('0x42')]){_0x39e8bf[_0xaec8('0x40')]=_['merge'](_0x39e8bf[_0xaec8('0x40')],{'$or':_['map'](_0x39e8bf['attributes'],function(_0x1dfb50){var _0x2bc2c={};_0x2bc2c[_0x1dfb50]={'$like':'%'+_0x59ce3f[_0xaec8('0x39')][_0xaec8('0x42')]+'%'};return _0x2bc2c;})});}if(_0x59ce3f['query'][_0xaec8('0x5f')]){var _0x3d2759=_0x59ce3f[_0xaec8('0x39')]['$gte'][_0xaec8('0x60')](',');var _0x5b0586={};_0x5b0586[_0x3d2759[0x0]]={'$gte':moment(_0x3d2759[0x1])[_0xaec8('0x61')](_0xaec8('0x62'))};_0x39e8bf[_0xaec8('0x40')]=_[_0xaec8('0x43')](_0x39e8bf[_0xaec8('0x40')],_0x5b0586);}_0x39e8bf=_[_0xaec8('0x43')]({},_0x39e8bf,_0x59ce3f[_0xaec8('0x44')]);return _0x3874b4[_0xaec8('0x5d')](_0x39e8bf);}})[_0xaec8('0x2c')](function(_0x8ade04){if(_0x8ade04){_0x317d0c=_0x8ade04[_0xaec8('0x4c')];if(!_0x59ce3f[_0xaec8('0x39')]['hasOwnProperty'](_0xaec8('0x3e'))){_0x39e8bf[_0xaec8('0x24')]=qs[_0xaec8('0x24')](_0x59ce3f[_0xaec8('0x39')][_0xaec8('0x24')]);_0x39e8bf[_0xaec8('0x22')]=qs['offset'](_0x59ce3f[_0xaec8('0x39')]['offset']);}return _0x3874b4['getMessages'](_0x39e8bf);}})[_0xaec8('0x2c')](function(_0x5663ea){if(_0x5663ea){return _0x5663ea?{'count':_0x317d0c,'rows':_0x5663ea}:null;}})[_0xaec8('0x2c')](respondWithResult(_0x34f357,null))[_0xaec8('0x48')](handleError(_0x34f357,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index ae8aeee..da32801 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 _0xf542=['ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf542,0x152));var _0x2f54=function(_0x23ee66,_0x1e5721){_0x23ee66=_0x23ee66-0x0;var _0xfb714d=_0xf542[_0x23ee66];return _0xfb714d;};'use strict';var EventEmitter=require(_0x2f54('0x0'));var ChatGroup=require(_0x2f54('0x1'))['db'][_0x2f54('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2f54('0x3')](0x0);var events={'afterCreate':_0x2f54('0x4'),'afterUpdate':_0x2f54('0x5'),'afterDestroy':'remove'};function emitEvent(_0x59b71f){return function(_0x1e7f22,_0x1abdd1,_0x3f4e1d){ChatGroupEvents[_0x2f54('0x6')](_0x59b71f+':'+_0x1e7f22['id'],_0x1e7f22);ChatGroupEvents[_0x2f54('0x6')](_0x59b71f,_0x1e7f22);_0x3f4e1d(null);};}for(var e in events){if(events[_0x2f54('0x7')](e)){var event=events[e];ChatGroup[_0x2f54('0x8')](e,emitEvent(event));}}module[_0x2f54('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0x5386=['hook','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit'];(function(_0x65e286,_0x4f908c){var _0x231609=function(_0x33b706){while(--_0x33b706){_0x65e286['push'](_0x65e286['shift']());}};_0x231609(++_0x4f908c);}(_0x5386,0x1e1));var _0x6538=function(_0x42a584,_0x2d9ee3){_0x42a584=_0x42a584-0x0;var _0x56be59=_0x5386[_0x42a584];return _0x56be59;};'use strict';var EventEmitter=require(_0x6538('0x0'));var ChatGroup=require(_0x6538('0x1'))['db'][_0x6538('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6538('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6538('0x4'),'afterDestroy':_0x6538('0x5')};function emitEvent(_0x105c66){return function(_0x1d2feb,_0x3721e7,_0x1bf31b){ChatGroupEvents[_0x6538('0x6')](_0x105c66+':'+_0x1d2feb['id'],_0x1d2feb);ChatGroupEvents[_0x6538('0x6')](_0x105c66,_0x1d2feb);_0x1bf31b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x6538('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6c3960e..d786d67 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 _0x0803=['./chatGroup.attributes','exports','define','ChatGroup','lodash','util','moment','request-promise','path'];(function(_0x431cf2,_0x1d4456){var _0x10c9a7=function(_0x574efe){while(--_0x574efe){_0x431cf2['push'](_0x431cf2['shift']());}};_0x10c9a7(++_0x1d4456);}(_0x0803,0x16c));var _0x3080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0803[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3080('0x0'));var util=require(_0x3080('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3080('0x2'));var BPromise=require('bluebird');var rp=require(_0x3080('0x3'));var fs=require('fs');var path=require(_0x3080('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3080('0x5'));module[_0x3080('0x6')]=function(_0x274707,_0xc1264b){return _0x274707[_0x3080('0x7')](_0x3080('0x8'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fd5=['path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x0fd5,0x13f));var _0x50fd=function(_0x5a726d,_0x653ee6){_0x5a726d=_0x5a726d-0x0;var _0x16157=_0x0fd5[_0x5a726d];return _0x16157;};'use strict';var _=require(_0x50fd('0x0'));var util=require('util');var logger=require(_0x50fd('0x1'))(_0x50fd('0x2'));var moment=require(_0x50fd('0x3'));var BPromise=require(_0x50fd('0x4'));var rp=require(_0x50fd('0x5'));var fs=require('fs');var path=require(_0x50fd('0x6'));var rimraf=require(_0x50fd('0x7'));var config=require('../../config/environment');var attributes=require(_0x50fd('0x8'));module[_0x50fd('0x9')]=function(_0x294fe8,_0x3224ac){return _0x294fe8[_0x50fd('0xa')](_0x50fd('0xb'),attributes,{'tableName':_0x50fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 9c509bd..07a67a7 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 _0x032e=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfeff8d,_0x3c92f9){var _0x9e5d96=function(_0x815c4b){while(--_0x815c4b){_0xfeff8d['push'](_0xfeff8d['shift']());}};_0x9e5d96(++_0x3c92f9);}(_0x032e,0x124));var _0xe032=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x032e[_0x411add];return _0x238242;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('ChatGroup,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});} \ No newline at end of file +var _0x3f2b=['localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x466822,_0x3ed1fd){var _0x27522d=function(_0x55f035){while(--_0x55f035){_0x466822['push'](_0x466822['shift']());}};_0x27522d(++_0x3ed1fd);}(_0x3f2b,0x72));var _0xb3f2=function(_0x4e68da,_0x57005b){_0x4e68da=_0x4e68da-0x0;var _0x251aa1=_0x3f2b[_0x4e68da];return _0x251aa1;};'use strict';var _=require(_0xb3f2('0x0'));var util=require('util');var moment=require(_0xb3f2('0x1'));var BPromise=require(_0xb3f2('0x2'));var rs=require(_0xb3f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3f2('0x4'))['db'];var utils=require(_0xb3f2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb3f2('0x6'));var jayson=require(_0xb3f2('0x7'));var client=jayson[_0xb3f2('0x8')][_0xb3f2('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb3f2('0xa')],{'host':_0xb3f2('0xb'),'port':0x18eb});var socket=require(_0xb3f2('0xc'))(new Redis(config[_0xb3f2('0xa')]));require(_0xb3f2('0xd'))[_0xb3f2('0xe')](socket);function respondWithRpcPromise(_0x415fd9,_0x314877,_0x94fada){return new BPromise(function(_0xf9b4be,_0x185c58){return client[_0xb3f2('0xf')](_0x415fd9,_0x94fada)[_0xb3f2('0x10')](function(_0xaf3b86){logger[_0xb3f2('0x11')]('ChatGroup,\x20%s,\x20%s',_0x314877,_0xb3f2('0x12'));logger['debug'](_0xb3f2('0x13'),_0x314877,_0xb3f2('0x12'),JSON['stringify'](_0xaf3b86));if(_0xaf3b86[_0xb3f2('0x14')]){if(_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x15')]===0x1f4){logger['error'](_0xb3f2('0x16'),_0x314877,_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x17')]);return _0x185c58(_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x17')]);}logger[_0xb3f2('0x14')](_0xb3f2('0x16'),_0x314877,_0xaf3b86['error'][_0xb3f2('0x17')]);return _0xf9b4be(_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x17')]);}else{logger[_0xb3f2('0x11')](_0xb3f2('0x16'),_0x314877,_0xb3f2('0x12'));_0xf9b4be(_0xaf3b86['result']['message']);}})[_0xb3f2('0x18')](function(_0x3a861a){logger[_0xb3f2('0x14')]('ChatGroup,\x20%s,\x20%s',_0x314877,_0x3a861a);_0x185c58(_0x3a861a);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c47dca6..4b1d2b3 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 _0x3725=['remove','emit','removeListener','register','length','./chatGroup.events','save'];(function(_0x3c962a,_0x15fd3f){var _0x11170a=function(_0x22c050){while(--_0x22c050){_0x3c962a['push'](_0x3c962a['shift']());}};_0x11170a(++_0x15fd3f);}(_0x3725,0xbb));var _0x5372=function(_0x458ca4,_0x4bbd3c){_0x458ca4=_0x458ca4-0x0;var _0x45abc0=_0x3725[_0x458ca4];return _0x45abc0;};'use strict';var ChatGroupEvents=require(_0x5372('0x0'));var events=[_0x5372('0x1'),_0x5372('0x2'),'update'];function createListener(_0x5a68c4,_0x5024ef){return function(_0x56898e){_0x5024ef[_0x5372('0x3')](_0x5a68c4,_0x56898e);};}function removeListener(_0x44f145,_0x247b8f){return function(){ChatGroupEvents[_0x5372('0x4')](_0x44f145,_0x247b8f);};}exports[_0x5372('0x5')]=function(_0x2c4367){for(var _0x1b2951=0x0,_0x1f51dd=events[_0x5372('0x6')];_0x1b2951<_0x1f51dd;_0x1b2951++){var _0x4bac6d=events[_0x1b2951];var _0x498640=createListener('chatGroup:'+_0x4bac6d,_0x2c4367);ChatGroupEvents['on'](_0x4bac6d,_0x498640);}}; \ No newline at end of file +var _0xfd8a=['./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x31680c,_0x58360b){var _0x2a4582=function(_0x54a4ca){while(--_0x54a4ca){_0x31680c['push'](_0x31680c['shift']());}};_0x2a4582(++_0x58360b);}(_0xfd8a,0xc4));var _0xafd8=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xfd8a[_0x8af54b];return _0x27d8f0;};'use strict';var ChatGroupEvents=require(_0xafd8('0x0'));var events=[_0xafd8('0x1'),_0xafd8('0x2'),_0xafd8('0x3')];function createListener(_0x39553b,_0x2d99aa){return function(_0x40b1cf){_0x2d99aa[_0xafd8('0x4')](_0x39553b,_0x40b1cf);};}function removeListener(_0x5be7f2,_0x402618){return function(){ChatGroupEvents[_0xafd8('0x5')](_0x5be7f2,_0x402618);};}exports[_0xafd8('0x6')]=function(_0x368d22){for(var _0x44703b=0x0,_0x2f9bbe=events['length'];_0x44703b<_0x2f9bbe;_0x44703b++){var _0x5829f2=events[_0x44703b];var _0x14514e=createListener('chatGroup:'+_0x5829f2,_0x368d22);ChatGroupEvents['on'](_0x5829f2,_0x14514e);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 0d022c6..6e3a4f4 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 _0x92d2=['delete','removeMembers','exports','multer','util','path','express','Router','../../components/auth/service','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put'];(function(_0x136a0d,_0x476fe2){var _0x212ea5=function(_0xa288e){while(--_0xa288e){_0x136a0d['push'](_0x136a0d['shift']());}};_0x212ea5(++_0x476fe2);}(_0x92d2,0xc0));var _0x292d=function(_0x101123,_0x2c9e54){_0x101123=_0x101123-0x0;var _0x30c2d6=_0x92d2[_0x101123];return _0x30c2d6;};'use strict';var multer=require(_0x292d('0x0'));var util=require(_0x292d('0x1'));var path=require(_0x292d('0x2'));var timeout=require('connect-timeout');var express=require(_0x292d('0x3'));var router=express[_0x292d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x292d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x292d('0x6'));router[_0x292d('0x7')]('/',auth[_0x292d('0x8')](),controller['index']);router[_0x292d('0x7')](_0x292d('0x9'),auth[_0x292d('0x8')](),controller[_0x292d('0xa')]);router[_0x292d('0x7')](_0x292d('0xb'),auth[_0x292d('0x8')](),controller[_0x292d('0xc')]);router['get'](_0x292d('0xd'),auth[_0x292d('0x8')](),controller[_0x292d('0xe')]);router[_0x292d('0x7')](_0x292d('0xf'),auth['isAuthenticated'](),controller[_0x292d('0x10')]);router[_0x292d('0x7')](_0x292d('0x11'),auth[_0x292d('0x8')](),controller[_0x292d('0x12')]);router[_0x292d('0x13')]('/',auth[_0x292d('0x8')](),controller[_0x292d('0x14')]);router[_0x292d('0x13')]('/:id/members',auth['isAuthenticated'](),controller[_0x292d('0x15')]);router[_0x292d('0x13')](_0x292d('0x11'),auth[_0x292d('0x8')](),controller[_0x292d('0x16')]);router[_0x292d('0x17')](_0x292d('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x292d('0x18')]('/:id',auth[_0x292d('0x8')](),controller['destroy']);router[_0x292d('0x18')](_0x292d('0xf'),auth[_0x292d('0x8')](),controller[_0x292d('0x19')]);module[_0x292d('0x1a')]=router; \ No newline at end of file +var _0x822d=['./chatGroup.controller','get','isAuthenticated','index','show','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','update','/:id','destroy','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1ae93c,_0xdc1b18){var _0x1a92a5=function(_0x358bca){while(--_0x358bca){_0x1ae93c['push'](_0x1ae93c['shift']());}};_0x1a92a5(++_0xdc1b18);}(_0x822d,0xc9));var _0xd822=function(_0x2ab3d9,_0x50e716){_0x2ab3d9=_0x2ab3d9-0x0;var _0x210a54=_0x822d[_0x2ab3d9];return _0x210a54;};'use strict';var multer=require(_0xd822('0x0'));var util=require(_0xd822('0x1'));var path=require(_0xd822('0x2'));var timeout=require(_0xd822('0x3'));var express=require(_0xd822('0x4'));var router=express['Router']();var fs_extra=require(_0xd822('0x5'));var auth=require(_0xd822('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd822('0x7'));router[_0xd822('0x8')]('/',auth[_0xd822('0x9')](),controller[_0xd822('0xa')]);router[_0xd822('0x8')]('/describe',auth[_0xd822('0x9')](),controller['describe']);router[_0xd822('0x8')]('/:id',auth[_0xd822('0x9')](),controller[_0xd822('0xb')]);router[_0xd822('0x8')]('/:id/unread',auth[_0xd822('0x9')](),controller[_0xd822('0xc')]);router['get'](_0xd822('0xd'),auth['isAuthenticated'](),controller[_0xd822('0xe')]);router[_0xd822('0x8')](_0xd822('0xf'),auth[_0xd822('0x9')](),controller['getMessages']);router[_0xd822('0x10')]('/',auth[_0xd822('0x9')](),controller[_0xd822('0x11')]);router[_0xd822('0x10')](_0xd822('0xd'),auth[_0xd822('0x9')](),controller[_0xd822('0x12')]);router['post'](_0xd822('0xf'),auth[_0xd822('0x9')](),controller[_0xd822('0x13')]);router[_0xd822('0x14')]('/:id',auth[_0xd822('0x9')](),controller[_0xd822('0x15')]);router['delete'](_0xd822('0x16'),auth[_0xd822('0x9')](),controller[_0xd822('0x17')]);router[_0xd822('0x18')](_0xd822('0xd'),auth['isAuthenticated'](),controller['removeMembers']);module[_0xd822('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index cd285c4..3459d93 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 _0x5825=['DATE','TEXT','BOOLEAN','INTEGER','exports','ENUM','star','thumb','STRING'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5825,0x11b));var _0x5582=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5825[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x5582('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x5582('0x1')](_0x5582('0x2'),_0x5582('0x3')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x5582('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5582('0x5')]},'disposition':{'type':Sequelize[_0x5582('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5582('0x4')]},'note':{'type':Sequelize[_0x5582('0x4')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x5582('0x4')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x5582('0x4')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x5582('0x4')]},'deviceType':{'type':Sequelize[_0x5582('0x4')]},'referer':{'type':Sequelize[_0x5582('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x5582('0x6')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x5582('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x5582('0x1')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x5582('0x4')]},'vidaooSessionId':{'type':Sequelize[_0x5582('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x5582('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5582('0x8')]}}; \ No newline at end of file +var _0xf59b=['ENUM','thumb','star','TEXT','STRING','DATE','exports','BOOLEAN','INTEGER'];(function(_0x547ede,_0x73d924){var _0x27adfb=function(_0x699a9d){while(--_0x699a9d){_0x547ede['push'](_0x547ede['shift']());}};_0x27adfb(++_0x73d924);}(_0xf59b,0x8d));var _0xbf59=function(_0x3f9fef,_0x3577bf){_0x3f9fef=_0x3f9fef-0x0;var _0x4f29c7=_0xf59b[_0x3f9fef];return _0x4f29c7;};'use strict';var Sequelize=require('sequelize');module[_0xbf59('0x0')]={'closed':{'type':Sequelize[_0xbf59('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xbf59('0x2')]},'ratingType':{'type':Sequelize[_0xbf59('0x3')]('star',_0xbf59('0x4')),'defaultValue':_0xbf59('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xbf59('0x6')]},'mailTranscript':{'type':Sequelize[_0xbf59('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbf59('0x8')]},'disposition':{'type':Sequelize[_0xbf59('0x7')]},'secondDisposition':{'type':Sequelize[_0xbf59('0x7')]},'thirdDisposition':{'type':Sequelize[_0xbf59('0x7')]},'note':{'type':Sequelize[_0xbf59('0x7')]},'browserName':{'type':Sequelize[_0xbf59('0x7')]},'browserVersion':{'type':Sequelize[_0xbf59('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xbf59('0x7')]},'deviceModel':{'type':Sequelize[_0xbf59('0x7')]},'deviceVendor':{'type':Sequelize[_0xbf59('0x7')]},'deviceType':{'type':Sequelize[_0xbf59('0x7')]},'referer':{'type':Sequelize[_0xbf59('0x6')]},'customerIp':{'type':Sequelize[_0xbf59('0x7')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xbf59('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xbf59('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbf59('0x7')]},'customerPort':{'type':Sequelize[_0xbf59('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xbf59('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xbf59('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0718257..3fd4a1c 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 _0x9479=['parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','closed','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','Messages','User','ContactId','UserId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','getMyMessages','ChatInteractionId','includeAgent','addTags','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','push','createdAt','read','Account','get','mkdirSync','Chat','Owner','N.A.','toString','closedAt','browserName','osName','customerPort','tail','existsSync','createReadStream','createWriteStream','out','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','name','send','render','merge','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','params','model','keys','filters','intersection','attributes','fields','length','options','create','update','body','destroy','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow'];(function(_0xfe96d1,_0x2f72d2){var _0x4e9b0e=function(_0xd9d76c){while(--_0xd9d76c){_0xfe96d1['push'](_0xfe96d1['shift']());}};_0x4e9b0e(++_0x2f72d2);}(_0x9479,0x15f));var _0x9947=function(_0x13a72c,_0x3f7e9d){_0x13a72c=_0x13a72c-0x0;var _0x475d01=_0x9479[_0x13a72c];return _0x475d01;};'use strict';var rimraf=require(_0x9947('0x0'));var zipdir=require(_0x9947('0x1'));var rp=require(_0x9947('0x2'));var moment=require('moment');var BPromise=require(_0x9947('0x3'));var Mustache=require('mustache');var util=require(_0x9947('0x4'));var path=require('path');var ejs=require(_0x9947('0x5'));var fs=require('fs');var _=require(_0x9947('0x6'));var Redis=require(_0x9947('0x7'));var interaction=require(_0x9947('0x8'));var qs=require(_0x9947('0x9'));var pdf=require(_0x9947('0xa'));var logger=require(_0x9947('0xb'))(_0x9947('0xc'));var config=require(_0x9947('0xd'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9947('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9947('0xf'))(new Redis(config[_0x9947('0x10')]));require(_0x9947('0x11'))[_0x9947('0x12')](socket);var jayson=require(_0x9947('0x13'));var client=jayson[_0x9947('0x14')][_0x9947('0x15')]({'port':0x232b});var client9004=jayson[_0x9947('0x14')][_0x9947('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x52f61d,_0x276cd3,_0x59bedb,_0x47017e){return new BPromise(function(_0x4a1c85,_0x3321d3){var _0x82a52b=_0x47017e||client;return _0x82a52b[_0x9947('0x16')](_0x52f61d,_0x59bedb)[_0x9947('0x17')](function(_0xbf3ae6){logger['info'](_0x9947('0x18'),_0x276cd3,'request\x20sent');logger[_0x9947('0x19')](_0x9947('0x1a'),_0x276cd3,'request\x20sent',JSON[_0x9947('0x1b')](_0xbf3ae6));if(_0xbf3ae6[_0x9947('0x1c')]){if(_0xbf3ae6[_0x9947('0x1c')][_0x9947('0x1d')]===0x1f4){logger['error'](_0x9947('0x18'),_0x276cd3,_0xbf3ae6['error'][_0x9947('0x1e')]);return _0x3321d3(_0xbf3ae6['error'][_0x9947('0x1e')]);}logger[_0x9947('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x276cd3,_0xbf3ae6[_0x9947('0x1c')][_0x9947('0x1e')]);return _0x4a1c85(_0xbf3ae6[_0x9947('0x1c')][_0x9947('0x1e')]);}else{logger[_0x9947('0x1f')](_0x9947('0x18'),_0x276cd3,_0x9947('0x20'));_0x4a1c85(_0xbf3ae6['result'][_0x9947('0x1e')]);}})[_0x9947('0x21')](function(_0x4cf8d7){logger['error'](_0x9947('0x18'),_0x276cd3,_0x4cf8d7);_0x3321d3(_0x4cf8d7);});});}function respondWithStatusCode(_0x3c19fc,_0x53242a){_0x53242a=_0x53242a||0xcc;return function(_0x59bc8f){if(_0x59bc8f){return _0x3c19fc[_0x9947('0x22')](_0x53242a);}return _0x3c19fc[_0x9947('0x23')](_0x53242a)[_0x9947('0x24')]();};}function respondWithResult(_0x3f7152,_0x32649b){_0x32649b=_0x32649b||0xc8;return function(_0x2e45a2){if(_0x2e45a2){return _0x3f7152['status'](_0x32649b)[_0x9947('0x25')](_0x2e45a2);}};}function respondWithFilteredResult(_0x504dde,_0x350b4f){return function(_0x18a4cf){if(_0x18a4cf){var _0x3d6039=typeof _0x350b4f[_0x9947('0x26')]===_0x9947('0x27')&&typeof _0x350b4f[_0x9947('0x28')]==='undefined';var _0x526176=_0x18a4cf[_0x9947('0x29')];var _0x1ba73d=_0x3d6039?0x0:_0x350b4f['offset'];var _0x484841=_0x3d6039?_0x18a4cf[_0x9947('0x29')]:_0x350b4f[_0x9947('0x26')]+_0x350b4f[_0x9947('0x28')];var _0x5e6c5e;if(_0x484841>=_0x526176){_0x484841=_0x526176;_0x5e6c5e=0xc8;}else{_0x5e6c5e=0xce;}_0x504dde['status'](_0x5e6c5e);return _0x504dde[_0x9947('0x2a')](_0x9947('0x2b'),_0x1ba73d+'-'+_0x484841+'/'+_0x526176)[_0x9947('0x25')](_0x18a4cf);}return null;};}function saveUpdates(_0x3b79c8){return function(_0x304387){if(_0x304387){return _0x304387['update'](_0x3b79c8)[_0x9947('0x17')](function(_0x418a7d){return _0x418a7d;});}return null;};}function removeEntity(_0x2eebd1){return function(_0x48579e){if(_0x48579e){return _0x48579e['destroy']()[_0x9947('0x17')](function(){_0x2eebd1[_0x9947('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32608e){return function(_0x884a0c){if(!_0x884a0c){_0x32608e[_0x9947('0x22')](0x194);}return _0x884a0c;};}function handleError(_0x574b69,_0x1c50a4){_0x1c50a4=_0x1c50a4||0x1f4;return function(_0x42c34f){logger[_0x9947('0x1c')](_0x42c34f['stack']);if(_0x42c34f['name']){delete _0x42c34f[_0x9947('0x2c')];}_0x574b69[_0x9947('0x23')](_0x1c50a4)[_0x9947('0x2d')](_0x42c34f);};}function getMustacheRender(_0x161026,_0x3d4c22){return Mustache[_0x9947('0x2e')](_0x161026,_[_0x9947('0x2f')](_0x3d4c22['body'],{'contact':_0x3d4c22[_0x9947('0x30')],'message':_0x3d4c22[_0x9947('0x1e')],'agent':_0x3d4c22[_0x9947('0x31')],'interaction':_0x3d4c22[_0x9947('0x32')],'account':_0x3d4c22[_0x9947('0x33')]}))||'';}exports[_0x9947('0x34')]=function(_0x42f9b2,_0x17cc80){var _0x192f5f={};var _0x5c7d71=_[_0x9947('0x35')](db[_0x9947('0x36')][_0x9947('0x37')],function(_0x3d841e){return{'name':_0x3d841e[_0x9947('0x38')],'type':_0x3d841e[_0x9947('0x39')][_0x9947('0x3a')]};});_0x192f5f=qs[_0x9947('0x3b')](_0x5c7d71,_0x42f9b2);return interaction[_0x9947('0x3c')](_0x9947('0x3d'),_0x42f9b2[_0x9947('0x3e')],_0x42f9b2[_0x9947('0x3f')],_0x192f5f,_0x5c7d71)[_0x9947('0x17')](respondWithFilteredResult(_0x17cc80,_0x192f5f))['catch'](handleError(_0x17cc80,null));};exports['show']=function(_0x426e88,_0x30e7bf){var _0x221ab9={'raw':![],'where':{'id':_0x426e88[_0x9947('0x40')]['id']}},_0x4bbd7a={};_0x4bbd7a[_0x9947('0x41')]=_[_0x9947('0x42')](db[_0x9947('0x36')][_0x9947('0x37')]);_0x4bbd7a[_0x9947('0x3e')]=_[_0x9947('0x42')](_0x426e88[_0x9947('0x3e')]);_0x4bbd7a[_0x9947('0x43')]=_[_0x9947('0x44')](_0x4bbd7a[_0x9947('0x41')],_0x4bbd7a[_0x9947('0x3e')]);_0x221ab9[_0x9947('0x45')]=_[_0x9947('0x44')](_0x4bbd7a[_0x9947('0x41')],qs[_0x9947('0x46')](_0x426e88[_0x9947('0x3e')]['fields']));_0x221ab9[_0x9947('0x45')]=_0x221ab9[_0x9947('0x45')][_0x9947('0x47')]?_0x221ab9['attributes']:_0x4bbd7a[_0x9947('0x41')];if(_0x426e88[_0x9947('0x3e')]['includeAll']){_0x221ab9['include']=[{'all':!![]}];}_0x221ab9=_['merge']({},_0x221ab9,_0x426e88[_0x9947('0x48')]);return db[_0x9947('0x36')]['find'](_0x221ab9)[_0x9947('0x17')](handleEntityNotFound(_0x30e7bf,null))['then'](respondWithResult(_0x30e7bf,null))[_0x9947('0x21')](handleError(_0x30e7bf,null));};exports[_0x9947('0x49')]=function(_0x414834,_0x2b2d72){return db['ChatInteraction'][_0x9947('0x49')](_0x414834['body'],{})[_0x9947('0x17')](respondWithResult(_0x2b2d72,0xc9))[_0x9947('0x21')](handleError(_0x2b2d72,null));};exports[_0x9947('0x4a')]=function(_0x496c04,_0x3a9352){if(_0x496c04[_0x9947('0x4b')]['id']){delete _0x496c04['body']['id'];}return db[_0x9947('0x36')]['find']({'where':{'id':_0x496c04[_0x9947('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a9352,null))[_0x9947('0x17')](saveUpdates(_0x496c04['body'],null))[_0x9947('0x17')](respondWithResult(_0x3a9352,null))[_0x9947('0x21')](handleError(_0x3a9352,null));};exports[_0x9947('0x4c')]=function(_0x2455dd,_0x57b52d){return db['ChatInteraction'][_0x9947('0x4d')]({'where':{'id':_0x2455dd[_0x9947('0x40')]['id']}})[_0x9947('0x17')](handleEntityNotFound(_0x57b52d,null))[_0x9947('0x17')](removeEntity(_0x57b52d,null))['catch'](handleError(_0x57b52d,null));};exports[_0x9947('0x4e')]=function(_0x5c8dac,_0x4c51fb){return db[_0x9947('0x36')][_0x9947('0x4e')]()[_0x9947('0x17')](respondWithResult(_0x4c51fb,null))[_0x9947('0x21')](handleError(_0x4c51fb,null));};exports[_0x9947('0x4f')]=function(_0x56b5a4,_0x28eb45){var _0x506cb0=_0x56b5a4[_0x9947('0x40')]['id'];var _0x37313a;var _0x172fbf;var _0x2066d1;return db[_0x9947('0x36')][_0x9947('0x50')]({'where':{'id':_0x506cb0}})[_0x9947('0x17')](function(_0x4ec373){_0x37313a=_0x4ec373;return db[_0x9947('0x51')]['findOne']({'where':{'id':_0x4ec373[_0x9947('0x52')]},'attributes':['id',_0x9947('0x53'),_0x9947('0x54'),_0x9947('0x55'),'vidaooNote',_0x9947('0x56')],'raw':!![]});})[_0x9947('0x17')](function(_0x38fd3b){if(_0x38fd3b&&_0x38fd3b[_0x9947('0x53')]&&_0x38fd3b[_0x9947('0x54')]){_0x172fbf=_0x38fd3b;var _0x192f3a={'interaction':{'id':_0x506cb0},'agent':{'id':_0x56b5a4[_0x9947('0x3f')]['id'],'name':_0x56b5a4[_0x9947('0x3f')][_0x9947('0x2c')],'fullname':_0x56b5a4[_0x9947('0x3f')]['fullname'],'email':_0x56b5a4['user'][_0x9947('0x57')]},'contact':_0x56b5a4['body'][_0x9947('0x30')],'account':_0x56b5a4[_0x9947('0x4b')][_0x9947('0x33')]};var _0x5d71d0={'rejectUnauthorized':![],'method':_0x9947('0x58'),'url':_0x9947('0x59'),'headers':{'X-APIKEY':_0x38fd3b[_0x9947('0x53')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x56b5a4[_0x9947('0x3f')][_0x9947('0x57')]],'buttons':null,'topic':_0x172fbf[_0x9947('0x55')],'note':_[_0x9947('0x5a')](_0x172fbf[_0x9947('0x5b')])?null:getMustacheRender(_0x172fbf[_0x9947('0x5b')],_0x192f3a),'metadata':null},'redirect':_0x9947('0x5c'),'json':!![]};try{if(!_['isNull'](_0x172fbf[_0x9947('0x56')])){var _0x33273f=getMustacheRender(_0x172fbf['vidaooMetadata'],_0x192f3a);var _0x515483=JSON[_0x9947('0x5d')](_0x33273f);_0x5d71d0[_0x9947('0x4b')]['metadata']=_0x515483;}}catch(_0x575188){throw new db[(_0x9947('0x5e'))][(_0x9947('0x5f'))](_0x9947('0x60'));}return rp(_0x5d71d0);}else{throw new db[(_0x9947('0x5e'))][(_0x9947('0x5f'))](_0x9947('0x61'));}})[_0x9947('0x17')](function(_0x48d78c){_0x2066d1=_0x48d78c;if(_0x2066d1['id']){var _0xba435f={'body':_0x2066d1[_0x9947('0x62')],'ChatWebsiteId':_0x172fbf['id'],'ChatInteractionId':_0x37313a['id'],'direction':'out','UserId':_0x56b5a4[_0x9947('0x3f')]['id']};return db[_0x9947('0x63')]['create'](_0xba435f,{});}else{throw new db[(_0x9947('0x5e'))][(_0x9947('0x5f'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x37313a[_0x9947('0x64')]({'vidaooSessionId':_0x2066d1['id']});})['then'](respondWithResult(_0x28eb45,null))[_0x9947('0x21')](handleError(_0x28eb45,null));};exports[_0x9947('0x65')]=function(_0x38f128,_0x24bbde){if(_0x38f128[_0x9947('0x4b')]['id']){delete _0x38f128['body']['id'];}return db[_0x9947('0x36')][_0x9947('0x4d')]({'where':{'id':_0x38f128[_0x9947('0x40')]['id']},'include':[{'model':db[_0x9947('0x66')],'as':_0x9947('0x67')}]})[_0x9947('0x17')](handleEntityNotFound(_0x24bbde,null))[_0x9947('0x17')](saveUpdates(_0x38f128[_0x9947('0x4b')],null))['then'](respondWithResult(_0x24bbde,null))[_0x9947('0x21')](handleError(_0x24bbde,null));};exports['abandon']=function(_0x43fe83,_0x307954){if(_0x43fe83[_0x9947('0x4b')]['id']){delete _0x43fe83[_0x9947('0x4b')]['id'];}return db[_0x9947('0x36')][_0x9947('0x4d')]({'where':{'id':_0x43fe83[_0x9947('0x40')]['id']}})['then'](function(_0x4518c9){if(!_0x4518c9){logger[_0x9947('0x1c')](_0x9947('0x68'),_0x9947('0x69'),0x194,_0x9947('0x6a'));_0x307954[_0x9947('0x22')](0x194);}else{if(_0x4518c9['UserId']){throw new db[(_0x9947('0x5e'))][(_0x9947('0x5f'))](_0x9947('0x6b'));}}return _0x4518c9;})[_0x9947('0x17')](function(_0x1c4ada){if(_0x1c4ada){return _0x1c4ada[_0x9947('0x4a')]({'closed':_0x43fe83['body']['closed'],'disposition':_0x43fe83[_0x9947('0x4b')][_0x9947('0x6c')]})[_0x9947('0x17')](function(_0x3f0b99){return _0x3f0b99;});}})[_0x9947('0x17')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x43fe83[_0x9947('0x4b')],client9004);})[_0x9947('0x17')](respondWithResult(_0x307954,null))['catch'](handleError(_0x307954,null));};exports[_0x9947('0x6d')]=function(_0x55716d,_0x5101c4){_0x55716d[_0x9947('0x4b')][_0x9947('0x2c')]=_0x55716d[_0x9947('0x6e')][_0x9947('0x6f')];_0x55716d[_0x9947('0x4b')][_0x9947('0x70')]=_0x55716d['file'][_0x9947('0x71')];_0x55716d[_0x9947('0x4b')][_0x9947('0x39')]=_0x55716d[_0x9947('0x6e')][_0x9947('0x72')];return db[_0x9947('0x73')][_0x9947('0x49')](_0x55716d[_0x9947('0x4b')])[_0x9947('0x17')](respondWithResult(_0x5101c4,0xc9))[_0x9947('0x21')](handleError(_0x5101c4,null));};exports['attachmentDownload']=function(_0x4af2c4,_0x4accfa){return db[_0x9947('0x36')][_0x9947('0x50')]({'where':{'id':_0x4af2c4[_0x9947('0x40')]['id']},'raw':!![]})[_0x9947('0x17')](handleEntityNotFound(_0x4accfa,null))['then'](function(_0x5b91f5){if(_0x5b91f5){if(_0x5b91f5[_0x9947('0x74')]){return _0x4accfa[_0x9947('0x23')](0x193)['json']({'status':0x193,'message':_0x9947('0x75')});}return db[_0x9947('0x73')]['findOne']({'where':{'id':_0x4af2c4['query'][_0x9947('0x76')]},'raw':!![]})['then'](handleEntityNotFound(_0x4accfa,null));}})[_0x9947('0x17')](function(_0x300776){if(_0x300776){var _0x187e7c=_0x300776[_0x9947('0x77')]!==null;var _0x39e4c6=path[_0x9947('0x78')](config[_0x9947('0x79')],_0x9947('0x7a'));if(_0x187e7c){_0x39e4c6=path[_0x9947('0x78')](_0x39e4c6,_0x9947('0x7b'));}var _0x1b5c56=path[_0x9947('0x78')](_0x39e4c6,_0x300776[_0x9947('0x70')]);return _0x4accfa[_0x9947('0x7c')](_0x1b5c56);}})[_0x9947('0x21')](handleError(_0x4accfa,null));};exports[_0x9947('0x7d')]=function(_0x4c1a45,_0x387e81){var _0x2e3b50=null;var _0x31958d=null;var _0x4dd501=null;if(_0x4c1a45['body']['id']){delete _0x4c1a45[_0x9947('0x4b')]['id'];}if(_0x4c1a45['body'][_0x9947('0x7e')]){_0x4dd501=path[_0x9947('0x78')](config[_0x9947('0x79')],_0x9947('0x7f'),util[_0x9947('0x80')](_0x9947('0x81'),Date['now']()));_0x4c1a45['body']['pathTranscript']=_0x4dd501;}return db[_0x9947('0x36')]['find']({'where':{'id':_0x4c1a45[_0x9947('0x40')]['id']},'include':[{'model':db[_0x9947('0x63')],'as':_0x9947('0x82'),'include':[{'model':db[_0x9947('0x83')],'as':_0x9947('0x83')}]}]})['then'](handleEntityNotFound(_0x387e81,null))[_0x9947('0x17')](saveUpdates(_0x4c1a45[_0x9947('0x4b')],null))['then'](function(_0x275df8){if(_0x275df8){_0x2e3b50=_0x275df8;return db[_0x9947('0x51')]['find']({'where':{'id':_0x2e3b50['ChatWebsiteId']}});}})[_0x9947('0x17')](function(_0x24d39c){if(_0x24d39c){_0x31958d=_0x24d39c;return db['CmContact']['find']({'where':{'id':_0x2e3b50[_0x9947('0x84')]}});}})[_0x9947('0x17')](function(_0x49800b){if(_0x49800b){if(_0x4dd501){var _0x47344e=null;for(var _0x524dc6=0x1;_0x524dc6<_0x2e3b50['Messages'][_0x9947('0x47')];++_0x524dc6){_0x47344e=_0x2e3b50[_0x9947('0x82')][_0x524dc6];var _0x113ebf=_0x47344e[_0x9947('0x85')]?util['format'](_0x9947('0x86'),_0x31958d[_0x9947('0x87')],_0x47344e['UserId']):_0x9947('0x88');var _0x3c5479=_0x4c1a45[_0x9947('0x4b')][_0x9947('0x89')]||util[_0x9947('0x80')](_0x9947('0x86'),_0x9947('0x8a'),_0x47344e[_0x9947('0x84')]);switch(_0x31958d[_0x9947('0x8b')]){case _0x9947('0x8c'):_0x113ebf=_0x47344e[_0x9947('0x85')]?util['format'](_0x9947('0x86'),_0x31958d[_0x9947('0x87')],_0x47344e['UserId']):_0x9947('0x88');break;case _0x9947('0x8d'):_0x113ebf=_0x47344e[_0x9947('0x85')]?_0x47344e['User'][_0x9947('0x8e')]||_0x47344e['User'][_0x9947('0x8f')]:_0x9947('0x88');break;case _0x9947('0x90'):_0x113ebf=_0x47344e[_0x9947('0x85')]?_0x47344e['User'][_0x9947('0x8f')]:_0x9947('0x88');break;default:_0x113ebf=_0x47344e[_0x9947('0x85')]?util[_0x9947('0x80')](_0x9947('0x86'),_0x31958d[_0x9947('0x87')],_0x47344e['UserId']):_0x9947('0x88');}var _0x17a786=util['format'](_0x9947('0x91'),moment(_0x47344e['createdAt'])[_0x9947('0x80')](_0x9947('0x92')),_0x47344e[_0x9947('0x93')]==='in'?_0x3c5479:_0x113ebf,_0x47344e[_0x9947('0x4b')]);if(!_0x47344e[_0x9947('0x94')]){fs[_0x9947('0x95')](_0x4dd501,_0x17a786);}}return db[_0x9947('0x96')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x9947('0x97')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x9947('0x98'),'raw':!![]}]}]});}}})['then'](function(_0x3edc04){if(!_0x3edc04||!_0x3edc04[_0x9947('0x99')]||!_0x4c1a45[_0x9947('0x4b')])return _0x2e3b50;var _0x4d19ab=_0x3edc04[_0x9947('0x9a')]();return respondWithRpcPromise(_0x9947('0x9b'),_0x9947('0x9c'),{'account':_0x4d19ab,'message':{'from':util[_0x9947('0x80')](_0x9947('0x9d'),_0x3edc04[_0x9947('0x2c')],_0x3edc04[_0x9947('0x57')]||_0x3edc04['Smtp'][_0x9947('0x3f')]),'to':_0x4c1a45[_0x9947('0x4b')][_0x9947('0x7e')],'subject':_0x9947('0x9e'),'text':util[_0x9947('0x80')](_0x9947('0x9f'),_0x4c1a45[_0x9947('0x4b')][_0x9947('0x7e')]),'attachments':[{'path':_0x4dd501}]}})['then'](function(){return _0x2e3b50;})[_0x9947('0x21')](function(_0x5beb01){logger[_0x9947('0x1c')](_0x5beb01);});})['then'](respondWithStatusCode(_0x387e81,0xc8))['catch'](handleError(_0x387e81,null));};exports[_0x9947('0xa0')]=function(_0x3eb449,_0x1b8b1e){return db[_0x9947('0x63')][_0x9947('0x4d')]({'where':{'id':_0x3eb449[_0x9947('0x40')]['id']}})[_0x9947('0x17')](handleEntityNotFound(_0x1b8b1e,null))[_0x9947('0x17')](function(_0x46e6fc){if(_0x46e6fc){return _0x46e6fc[_0x9947('0xa0')](_0x3eb449[_0x9947('0x4b')][_0x9947('0xa1')],_[_0x9947('0xa2')](_0x3eb449[_0x9947('0x4b')],['ids','id'])||{});}})[_0x9947('0x17')](respondWithResult(_0x1b8b1e,null))[_0x9947('0x21')](handleError(_0x1b8b1e,null));};exports[_0x9947('0xa3')]=function(_0x49ca3b,_0x21e6e9){var _0x37cb08={'raw':![],'where':{}};var _0x4faa31={};var _0x6d7688={'count':0x0,'rows':[]};return db[_0x9947('0x36')][_0x9947('0x50')]({'where':{'id':_0x49ca3b[_0x9947('0x40')]['id']}})[_0x9947('0x17')](handleEntityNotFound(_0x21e6e9,null))[_0x9947('0x17')](function(_0x146f34){if(_0x146f34){_0x4faa31[_0x9947('0x41')]=_['keys'](db[_0x9947('0x63')][_0x9947('0x37')]);_0x4faa31[_0x9947('0x3e')]=_[_0x9947('0x42')](_0x49ca3b[_0x9947('0x3e')]);_0x4faa31[_0x9947('0x43')]=_['intersection'](_0x4faa31[_0x9947('0x41')],_0x4faa31['query']);_0x37cb08[_0x9947('0x45')]=_[_0x9947('0x44')](_0x4faa31[_0x9947('0x41')],qs[_0x9947('0x46')](_0x49ca3b[_0x9947('0x3e')]['fields']));_0x37cb08[_0x9947('0x45')]=_0x37cb08[_0x9947('0x45')][_0x9947('0x47')]?_0x37cb08[_0x9947('0x45')]:_0x4faa31[_0x9947('0x41')];if(!_0x49ca3b[_0x9947('0x3e')][_0x9947('0xa4')](_0x9947('0xa5'))){_0x37cb08[_0x9947('0x28')]=qs['limit'](_0x49ca3b[_0x9947('0x3e')][_0x9947('0x28')]);_0x37cb08[_0x9947('0x26')]=qs[_0x9947('0x26')](_0x49ca3b['query'][_0x9947('0x26')]);}_0x37cb08[_0x9947('0xa6')]=qs[_0x9947('0xa7')](_0x49ca3b[_0x9947('0x3e')][_0x9947('0xa7')]);_0x37cb08['where']=qs[_0x9947('0x43')](_[_0x9947('0xa8')](_0x49ca3b[_0x9947('0x3e')],_0x4faa31['filters']));_0x37cb08[_0x9947('0xa9')]['ChatInteractionId']=_0x146f34['id'];if(_0x49ca3b[_0x9947('0x3e')][_0x9947('0xaa')]){_0x37cb08['where']=_['merge'](_0x37cb08['where'],{'$or':_[_0x9947('0x35')](_0x37cb08[_0x9947('0x45')],function(_0x58833a){var _0x66f94d={};_0x66f94d[_0x58833a]={'$like':'%'+_0x49ca3b['query']['filter']+'%'};return _0x66f94d;})});}if(_0x49ca3b[_0x9947('0x3e')][_0x9947('0xab')]){var _0x5068e4=_0x49ca3b[_0x9947('0x3e')][_0x9947('0xab')][_0x9947('0xac')](',');var _0x34e7be={};_0x34e7be[_0x5068e4[0x0]]={'$gte':moment(_0x5068e4[0x1])[_0x9947('0x80')](_0x9947('0xad'))};_0x37cb08['where']=_[_0x9947('0x2f')](_0x37cb08['where'],_0x34e7be);}_0x37cb08=_[_0x9947('0x2f')]({},_0x37cb08,_0x49ca3b[_0x9947('0x48')]);return db['ChatMessage'][_0x9947('0x29')]({'where':_0x37cb08[_0x9947('0xa9')]})['then'](function(_0x165285){_0x6d7688[_0x9947('0x29')]=_0x165285;if(_0x49ca3b[_0x9947('0x3e')][_0x9947('0xae')]){_0x37cb08[_0x9947('0xaf')]=[{'all':!![]}];}return db[_0x9947('0x63')][_0x9947('0x3c')](_0x37cb08);})[_0x9947('0x17')](function(_0xcb89c1){_0x6d7688[_0x9947('0xb0')]=_0xcb89c1;return _0x6d7688;});}})['then'](respondWithFilteredResult(_0x21e6e9,_0x37cb08))[_0x9947('0x21')](handleError(_0x21e6e9,null));};exports[_0x9947('0xb1')]=function(_0x566ebc,_0x1792bf){var _0x4181c9={'where':{}},_0x8f6ad1={},_0x152a78={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9947('0x50')]({'where':{'id':_0x566ebc[_0x9947('0x40')]['id']}})[_0x9947('0x17')](handleEntityNotFound(_0x1792bf,null))[_0x9947('0x17')](function(_0x11c3f5){if(_0x11c3f5){_0x8f6ad1[_0x9947('0x41')]=_[_0x9947('0x42')](db[_0x9947('0x63')][_0x9947('0x37')]);_0x8f6ad1[_0x9947('0x3e')]=_['keys'](_0x566ebc['query']);_0x8f6ad1[_0x9947('0x43')]=_['intersection'](_0x8f6ad1[_0x9947('0x41')],_0x8f6ad1['query']);_0x4181c9['attributes']=_[_0x9947('0x44')](_0x8f6ad1['model'],qs['fields'](_0x566ebc[_0x9947('0x3e')][_0x9947('0x46')]));_0x4181c9[_0x9947('0x45')]=_0x4181c9['attributes'][_0x9947('0x47')]?_0x4181c9[_0x9947('0x45')]:_0x8f6ad1['model'];if(!_0x566ebc['query'][_0x9947('0xa4')](_0x9947('0xa5'))){_0x4181c9[_0x9947('0x28')]=qs['limit'](_0x566ebc[_0x9947('0x3e')]['limit']);_0x4181c9[_0x9947('0x26')]=qs[_0x9947('0x26')](_0x566ebc['query'][_0x9947('0x26')]);}_0x4181c9['order']=qs[_0x9947('0xa7')](_0x566ebc['query']['sort']);_0x4181c9[_0x9947('0xa9')]=qs[_0x9947('0x43')](_[_0x9947('0xa8')](_0x566ebc['query'],_0x8f6ad1[_0x9947('0x43')]));_0x4181c9[_0x9947('0xa9')][_0x9947('0xb2')]=_0x11c3f5['id'];if(_0x566ebc['query'][_0x9947('0xaa')]){_0x4181c9[_0x9947('0xa9')]=_[_0x9947('0x2f')](_0x4181c9[_0x9947('0xa9')],{'$or':_[_0x9947('0x35')](_0x4181c9[_0x9947('0x45')],function(_0x43bf45){var _0xf10586={};_0xf10586[_0x43bf45]={'$like':'%'+_0x566ebc['query'][_0x9947('0xaa')]+'%'};return _0xf10586;})});}_0x4181c9[_0x9947('0xa9')][_0x9947('0x94')]=![];if(_0x566ebc['query']['id']){_0x4181c9['where']['id']={'$gt':_0x566ebc[_0x9947('0x3e')]['id']};}_0x4181c9=_[_0x9947('0x2f')]({},_0x4181c9,_0x566ebc[_0x9947('0x48')]);return db[_0x9947('0x63')][_0x9947('0x29')]({'where':_0x4181c9[_0x9947('0xa9')]})['then'](function(_0x33de98){_0x152a78[_0x9947('0x29')]=_0x33de98;_0x4181c9[_0x9947('0xaf')]=[];if(_0x566ebc[_0x9947('0x3e')][_0x9947('0xb3')]){_0x4181c9[_0x9947('0xaf')]['push']({'model':db[_0x9947('0x83')],'as':_0x9947('0x83'),'attributes':['id',_0x9947('0x8f'),_0x9947('0x8e')]});}if(_0x566ebc['query'][_0x9947('0xae')]){_0x4181c9[_0x9947('0xaf')]=[{'all':!![]}];}return db[_0x9947('0x63')][_0x9947('0x3c')](_0x4181c9);})[_0x9947('0x17')](function(_0x4d9cd9){_0x152a78['rows']=_0x4d9cd9;return _0x152a78;});}})[_0x9947('0x17')](respondWithFilteredResult(_0x1792bf,_0x4181c9))[_0x9947('0x21')](handleError(_0x1792bf,null));};exports[_0x9947('0xb4')]=function(_0x309061,_0x3eddc6){return db['ChatInteraction'][_0x9947('0x4d')]({'where':{'id':_0x309061['params']['id']}})['then'](handleEntityNotFound(_0x3eddc6,null))[_0x9947('0x17')](function(_0xce6de6){if(_0xce6de6){return _0xce6de6[_0x9947('0xb5')](_0x309061['body'][_0x9947('0xa1')],_[_0x9947('0xa2')](_0x309061[_0x9947('0x4b')],['ids','id'])||{})[_0x9947('0xb6')](function(){return db['Tag'][_0x9947('0x3c')]({'attributes':['id',_0x9947('0x2c'),_0x9947('0xb7')],'where':{'id':_0x309061[_0x9947('0x4b')][_0x9947('0xa1')]}});})[_0x9947('0x17')](function(_0x472547){socket[_0x9947('0xb8')](_0x9947('0xb9'),{'id':Number(_0x309061['params']['id']),'tags':_0x472547||[]});return{'id':Number(_0x309061[_0x9947('0x40')]['id']),'tags':_0x472547||[]};});}})[_0x9947('0x17')](respondWithResult(_0x3eddc6,null))['catch'](handleError(_0x3eddc6,null));};exports['removeTags']=function(_0x1af205,_0x3076fa){return db[_0x9947('0x36')][_0x9947('0x4d')]({'where':{'id':_0x1af205['params']['id']}})[_0x9947('0x17')](handleEntityNotFound(_0x3076fa,null))[_0x9947('0x17')](function(_0x3a743f){if(_0x3a743f){return _0x3a743f[_0x9947('0xba')](_0x1af205[_0x9947('0x3e')][_0x9947('0xa1')]);}})['then'](respondWithStatusCode(_0x3076fa,null))['catch'](handleError(_0x3076fa,null));};exports[_0x9947('0x7c')]=function(_0x21a606,_0x565699){var _0x19e222=moment()[_0x9947('0xbb')]()['toString']();var _0x508b69=path[_0x9947('0x78')](config[_0x9947('0x79')],_0x9947('0xbc'),_0x9947('0xbd'),_0x9947('0xbe'));var _0x3586a8=path['join'](config[_0x9947('0x79')],_0x9947('0xbc'),_0x9947('0xbd'),_0x9947('0xbf'));var _0x16a7a8=path[_0x9947('0x78')](_0x508b69,_0x19e222);var _0x36e815=util[_0x9947('0x80')](_0x9947('0xc0'),_0x21a606[_0x9947('0x40')]['id'],_0x19e222);var _0xcb4cd1=path[_0x9947('0x78')](_0x508b69,_0x36e815);var _0x1f8591=[];_0x1f8591['push']({'model':db[_0x9947('0x83')],'as':_0x9947('0x83'),'attributes':['id',_0x9947('0x8f')],'raw':!![]});_0x1f8591['push']({'model':db[_0x9947('0x66')],'as':'Contact','attributes':['id',_0x9947('0xc1'),_0x9947('0xc2')],'raw':!![]});if(_0x21a606[_0x9947('0x3e')][_0x9947('0xbf')]){_0x1f8591[_0x9947('0xc3')]({'model':db['Attachment'],'as':_0x9947('0x73'),'raw':!![]});}var _0x2b6974=[{'model':db['ChatMessage'],'as':_0x9947('0x82'),'attributes':['id',_0x9947('0x4b'),_0x9947('0xc4'),_0x9947('0x93'),_0x9947('0x94'),_0x9947('0xc5')],'include':_0x1f8591}];_0x2b6974[_0x9947('0xc3')]({'model':db[_0x9947('0x51')],'as':_0x9947('0xc6'),'attributes':['id',_0x9947('0x2c')]});_0x2b6974[_0x9947('0xc3')]({'model':db[_0x9947('0x83')],'as':'Owner','attributes':['id',_0x9947('0x8f')]});return db['ChatInteraction'][_0x9947('0x4d')]({'where':{'id':_0x21a606[_0x9947('0x40')]['id']},'include':_0x2b6974})[_0x9947('0x17')](handleEntityNotFound(_0x565699,null))[_0x9947('0x17')](function(_0xc73c4){if(_0xc73c4){var _0x324bb0=_0xc73c4[_0x9947('0xc7')]({'plain':!![]});fs[_0x9947('0xc8')](_0x16a7a8);var _0xdefac4={'channel':_0x9947('0xc9'),'account':_0x324bb0[_0x9947('0xc6')][_0x9947('0x2c')],'agent':_0x324bb0[_0x9947('0xca')]?_0x324bb0[_0x9947('0xca')][_0x9947('0x8f')]:_0x9947('0xcb'),'createdAt':moment(_0x324bb0[_0x9947('0xc4')])[_0x9947('0x80')](_0x9947('0xad'))[_0x9947('0xcc')](),'closedAt':_0x324bb0[_0x9947('0x74')]?moment(_0x324bb0[_0x9947('0xcd')])[_0x9947('0x80')](_0x9947('0xad'))[_0x9947('0xcc')]():'','disposition':_0x324bb0[_0x9947('0x6c')],'chatInfo':{'browser':_0x324bb0[_0x9947('0xce')],'os':_0x324bb0[_0x9947('0xcf')],'referer':_0x324bb0['referer'],'customerIp':_0x324bb0['customerIp'],'customerPort':_0x324bb0[_0x9947('0xd0')]?_0x324bb0[_0x9947('0xd0')]:'N.A.'},'messages':_(_0x324bb0[_0x9947('0x82')])[_0x9947('0xd1')]()['filter']({'secret':![]})[_0x9947('0x35')](function(_0x4ce63c){if(_0x4ce63c[_0x9947('0x73')]){var _0x48b155=path[_0x9947('0x78')](_0x3586a8,_0x4ce63c[_0x9947('0x73')]['basename']);if(fs[_0x9947('0xd2')](_0x48b155)){fs[_0x9947('0xd3')](_0x48b155)['pipe'](fs[_0x9947('0xd4')](path['join'](_0x16a7a8,_0x4ce63c[_0x9947('0x73')]['basename'])));}}return{'date':moment(_0x4ce63c['createdAt'])[_0x9947('0x80')](_0x9947('0xad'))[_0x9947('0xcc')](),'sender':_0x4ce63c[_0x9947('0x93')]==='out'?_0x4ce63c[_0x9947('0x83')]?_0x4ce63c[_0x9947('0x83')]['fullname']:_0x9947('0x88'):_0x4ce63c['Contact']['firstName']+(_0x4ce63c[_0x9947('0x67')][_0x9947('0xc2')]?'\x20'+_0x4ce63c['Contact'][_0x9947('0xc2')]:''),'body':_0x4ce63c[_0x9947('0x73')]?_0x4ce63c[_0x9947('0x73')]['basename']:_0x4ce63c[_0x9947('0x4b')],'direction':_0x4ce63c['direction']===_0x9947('0xd5')?'A':'C','secret':_0x4ce63c['secret'],'read':_0x4ce63c[_0x9947('0xc5')],'attachment':_0x4ce63c[_0x9947('0x73')]};})[_0x9947('0xd6')]()};return ejs[_0x9947('0xd7')](path['join'](config['root'],'server',_0x9947('0xd8'),_0x9947('0xd9')),{'interaction':_0xdefac4})[_0x9947('0x17')](function(_0x49ae5e){var _0x5884f0=path[_0x9947('0x78')](_0x16a7a8,'transcript-'+_0x324bb0['id']+'-'+_0x19e222+_0x9947('0xda'));var _0x300dfd={'path':_0x5884f0,'channel':_0x9947('0xc9'),'interactionId':_0x324bb0['id']};return pdf[_0x9947('0xdb')](_0x49ae5e,_0x300dfd);})[_0x9947('0x17')](function(){return new Promise(function(_0x55c4e0,_0x164369){zipdir(_0x16a7a8,{'saveTo':_0xcb4cd1},function(_0x10f087,_0x21b7c3){if(_0x10f087)return _0x164369(_0x10f087);return _0x55c4e0(_0x21b7c3);});})[_0x9947('0x17')](function(){return new BPromise(function(_0x24f649,_0x3dc2e9){rimraf(_0x16a7a8,function(_0x3f5c6c){if(_0x3f5c6c)_0x3dc2e9(_0x3f5c6c);return _0x24f649();});});})['then'](function(){return _0x565699[_0x9947('0x7c')](_0xcb4cd1,_0x36e815,function(_0x49a2e5){if(_0x49a2e5){logger[_0x9947('0x1c')](_0x9947('0xdc'),_0x49a2e5);}else{fs[_0x9947('0xdd')](_0xcb4cd1);}});});});}else{return _0x565699[_0x9947('0x22')](0xc8);}})['catch'](handleError(_0x565699,null));}; \ No newline at end of file +var _0x680a=['offset','limit','undefined','count','set','Content-Range','update','stack','name','merge','body','agent','interaction','account','index','map','ChatInteraction','fieldName','getOptions','findAll','query','show','params','model','keys','rawAttributes','filters','fields','attributes','length','includeAll','options','find','create','destroy','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','user','email','contact','isNull','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','type','mimetype','Unauthorized','Attachment','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','mailTranscript','root','format','transcript-%s.txt','now','User','ChatWebsite','ContactId','agentAlias','UserId','System','%s%d','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','intersection','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','nolimit','includeAgent','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','push','Messages','Account','Owner','get','mkdirSync','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','pipe','createWriteStream','firstName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','Chat','createPdfFromHTML','err','unlinkSync','sendStatus','zip-dir','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','status','end','json'];(function(_0x205bb4,_0x88f7d){var _0x55b21f=function(_0xbfc15c){while(--_0xbfc15c){_0x205bb4['push'](_0x205bb4['shift']());}};_0x55b21f(++_0x88f7d);}(_0x680a,0xab));var _0xa680=function(_0x5ce444,_0x12d54a){_0x5ce444=_0x5ce444-0x0;var _0x575008=_0x680a[_0x5ce444];return _0x575008;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xa680('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa680('0x1'));var Mustache=require(_0xa680('0x2'));var util=require(_0xa680('0x3'));var path=require(_0xa680('0x4'));var ejs=require(_0xa680('0x5'));var fs=require('fs');var _=require(_0xa680('0x6'));var Redis=require('ioredis');var interaction=require(_0xa680('0x7'));var qs=require(_0xa680('0x8'));var pdf=require(_0xa680('0x9'));var logger=require(_0xa680('0xa'))(_0xa680('0xb'));var config=require(_0xa680('0xc'));var db=require(_0xa680('0xd'))['db'];config[_0xa680('0xe')]=_[_0xa680('0xf')](config[_0xa680('0xe')],{'host':_0xa680('0x10'),'port':0x18eb});var socket=require(_0xa680('0x11'))(new Redis(config['redis']));require(_0xa680('0x12'))[_0xa680('0x13')](socket);var jayson=require(_0xa680('0x14'));var client=jayson[_0xa680('0x15')][_0xa680('0x16')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x62bec1,_0x33729c,_0x437c76,_0x371412){return new BPromise(function(_0x3ecbe2,_0xf9d8a4){var _0x550528=_0x371412||client;return _0x550528[_0xa680('0x17')](_0x62bec1,_0x437c76)[_0xa680('0x18')](function(_0x5400b9){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x33729c,_0xa680('0x19'));logger[_0xa680('0x1a')](_0xa680('0x1b'),_0x33729c,'request\x20sent',JSON[_0xa680('0x1c')](_0x5400b9));if(_0x5400b9[_0xa680('0x1d')]){if(_0x5400b9[_0xa680('0x1d')][_0xa680('0x1e')]===0x1f4){logger['error'](_0xa680('0x1f'),_0x33729c,_0x5400b9[_0xa680('0x1d')]['message']);return _0xf9d8a4(_0x5400b9['error'][_0xa680('0x20')]);}logger['error'](_0xa680('0x1f'),_0x33729c,_0x5400b9[_0xa680('0x1d')][_0xa680('0x20')]);return _0x3ecbe2(_0x5400b9[_0xa680('0x1d')][_0xa680('0x20')]);}else{logger[_0xa680('0x21')](_0xa680('0x1f'),_0x33729c,_0xa680('0x19'));_0x3ecbe2(_0x5400b9['result']['message']);}})[_0xa680('0x22')](function(_0x4868b4){logger[_0xa680('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x33729c,_0x4868b4);_0xf9d8a4(_0x4868b4);});});}function respondWithStatusCode(_0xb7ad69,_0x21bc8b){_0x21bc8b=_0x21bc8b||0xcc;return function(_0x58bfff){if(_0x58bfff){return _0xb7ad69['sendStatus'](_0x21bc8b);}return _0xb7ad69[_0xa680('0x23')](_0x21bc8b)[_0xa680('0x24')]();};}function respondWithResult(_0x188062,_0x4be778){_0x4be778=_0x4be778||0xc8;return function(_0x4d559f){if(_0x4d559f){return _0x188062[_0xa680('0x23')](_0x4be778)[_0xa680('0x25')](_0x4d559f);}};}function respondWithFilteredResult(_0x5b8e5d,_0x224aab){return function(_0xa7309b){if(_0xa7309b){var _0x48ff46=typeof _0x224aab[_0xa680('0x26')]==='undefined'&&typeof _0x224aab[_0xa680('0x27')]===_0xa680('0x28');var _0x52f3e6=_0xa7309b[_0xa680('0x29')];var _0x286d5e=_0x48ff46?0x0:_0x224aab[_0xa680('0x26')];var _0x30ac75=_0x48ff46?_0xa7309b[_0xa680('0x29')]:_0x224aab[_0xa680('0x26')]+_0x224aab[_0xa680('0x27')];var _0xe62705;if(_0x30ac75>=_0x52f3e6){_0x30ac75=_0x52f3e6;_0xe62705=0xc8;}else{_0xe62705=0xce;}_0x5b8e5d[_0xa680('0x23')](_0xe62705);return _0x5b8e5d[_0xa680('0x2a')](_0xa680('0x2b'),_0x286d5e+'-'+_0x30ac75+'/'+_0x52f3e6)[_0xa680('0x25')](_0xa7309b);}return null;};}function saveUpdates(_0x388bb4){return function(_0x3d5df6){if(_0x3d5df6){return _0x3d5df6[_0xa680('0x2c')](_0x388bb4)['then'](function(_0x5dfef3){return _0x5dfef3;});}return null;};}function removeEntity(_0x5aee24){return function(_0x2a2ea2){if(_0x2a2ea2){return _0x2a2ea2['destroy']()[_0xa680('0x18')](function(){_0x5aee24[_0xa680('0x23')](0xcc)[_0xa680('0x24')]();});}};}function handleEntityNotFound(_0x3296a7){return function(_0x79f788){if(!_0x79f788){_0x3296a7['sendStatus'](0x194);}return _0x79f788;};}function handleError(_0x140f87,_0x36d2e8){_0x36d2e8=_0x36d2e8||0x1f4;return function(_0x4d3ed2){logger[_0xa680('0x1d')](_0x4d3ed2[_0xa680('0x2d')]);if(_0x4d3ed2['name']){delete _0x4d3ed2[_0xa680('0x2e')];}_0x140f87['status'](_0x36d2e8)['send'](_0x4d3ed2);};}function getMustacheRender(_0x503e4d,_0x25b709){return Mustache['render'](_0x503e4d,_[_0xa680('0x2f')](_0x25b709[_0xa680('0x30')],{'contact':_0x25b709['contact'],'message':_0x25b709['message'],'agent':_0x25b709[_0xa680('0x31')],'interaction':_0x25b709[_0xa680('0x32')],'account':_0x25b709[_0xa680('0x33')]}))||'';}exports[_0xa680('0x34')]=function(_0x20371e,_0x2a774){var _0x3dc734={};var _0x1990d4=_[_0xa680('0x35')](db[_0xa680('0x36')]['rawAttributes'],function(_0x444b51){return{'name':_0x444b51[_0xa680('0x37')],'type':_0x444b51['type']['key']};});_0x3dc734=qs[_0xa680('0x38')](_0x1990d4,_0x20371e);return interaction[_0xa680('0x39')]('chat',_0x20371e[_0xa680('0x3a')],_0x20371e['user'],_0x3dc734,_0x1990d4)[_0xa680('0x18')](respondWithFilteredResult(_0x2a774,_0x3dc734))[_0xa680('0x22')](handleError(_0x2a774,null));};exports[_0xa680('0x3b')]=function(_0x1867cc,_0x545687){var _0x7b80b8={'raw':![],'where':{'id':_0x1867cc[_0xa680('0x3c')]['id']}},_0x2b4a1f={};_0x2b4a1f[_0xa680('0x3d')]=_[_0xa680('0x3e')](db[_0xa680('0x36')][_0xa680('0x3f')]);_0x2b4a1f[_0xa680('0x3a')]=_[_0xa680('0x3e')](_0x1867cc[_0xa680('0x3a')]);_0x2b4a1f[_0xa680('0x40')]=_['intersection'](_0x2b4a1f['model'],_0x2b4a1f[_0xa680('0x3a')]);_0x7b80b8['attributes']=_['intersection'](_0x2b4a1f[_0xa680('0x3d')],qs[_0xa680('0x41')](_0x1867cc[_0xa680('0x3a')][_0xa680('0x41')]));_0x7b80b8[_0xa680('0x42')]=_0x7b80b8[_0xa680('0x42')][_0xa680('0x43')]?_0x7b80b8[_0xa680('0x42')]:_0x2b4a1f[_0xa680('0x3d')];if(_0x1867cc[_0xa680('0x3a')][_0xa680('0x44')]){_0x7b80b8['include']=[{'all':!![]}];}_0x7b80b8=_[_0xa680('0x2f')]({},_0x7b80b8,_0x1867cc[_0xa680('0x45')]);return db[_0xa680('0x36')][_0xa680('0x46')](_0x7b80b8)[_0xa680('0x18')](handleEntityNotFound(_0x545687,null))['then'](respondWithResult(_0x545687,null))[_0xa680('0x22')](handleError(_0x545687,null));};exports[_0xa680('0x47')]=function(_0x36f7b9,_0x214bba){return db[_0xa680('0x36')]['create'](_0x36f7b9['body'],{})[_0xa680('0x18')](respondWithResult(_0x214bba,0xc9))[_0xa680('0x22')](handleError(_0x214bba,null));};exports['update']=function(_0x58d1de,_0x3a9c89){if(_0x58d1de[_0xa680('0x30')]['id']){delete _0x58d1de[_0xa680('0x30')]['id'];}return db['ChatInteraction'][_0xa680('0x46')]({'where':{'id':_0x58d1de['params']['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x3a9c89,null))['then'](saveUpdates(_0x58d1de[_0xa680('0x30')],null))[_0xa680('0x18')](respondWithResult(_0x3a9c89,null))['catch'](handleError(_0x3a9c89,null));};exports[_0xa680('0x48')]=function(_0x418a8b,_0x4540ee){return db[_0xa680('0x36')][_0xa680('0x46')]({'where':{'id':_0x418a8b[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x4540ee,null))['then'](removeEntity(_0x4540ee,null))[_0xa680('0x22')](handleError(_0x4540ee,null));};exports[_0xa680('0x49')]=function(_0x580d82,_0x46b1ce){return db[_0xa680('0x36')][_0xa680('0x49')]()['then'](respondWithResult(_0x46b1ce,null))[_0xa680('0x22')](handleError(_0x46b1ce,null));};exports[_0xa680('0x4a')]=function(_0x16e4e7,_0x2b6294){var _0x56c181=_0x16e4e7[_0xa680('0x3c')]['id'];var _0x536006;var _0x22c5a0;var _0x325ec3;return db[_0xa680('0x36')][_0xa680('0x4b')]({'where':{'id':_0x56c181}})['then'](function(_0x51a6af){_0x536006=_0x51a6af;return db['ChatWebsite'][_0xa680('0x4b')]({'where':{'id':_0x51a6af[_0xa680('0x4c')]},'attributes':['id',_0xa680('0x4d'),_0xa680('0x4e'),_0xa680('0x4f'),_0xa680('0x50'),'vidaooMetadata'],'raw':!![]});})[_0xa680('0x18')](function(_0x50d1f6){if(_0x50d1f6&&_0x50d1f6[_0xa680('0x4d')]&&_0x50d1f6[_0xa680('0x4e')]){_0x22c5a0=_0x50d1f6;var _0x22fb3f={'interaction':{'id':_0x56c181},'agent':{'id':_0x16e4e7[_0xa680('0x51')]['id'],'name':_0x16e4e7[_0xa680('0x51')]['name'],'fullname':_0x16e4e7['user']['fullname'],'email':_0x16e4e7[_0xa680('0x51')][_0xa680('0x52')]},'contact':_0x16e4e7['body'][_0xa680('0x53')],'account':_0x16e4e7[_0xa680('0x30')][_0xa680('0x33')]};var _0x7eaad3={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x50d1f6[_0xa680('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x16e4e7['user'][_0xa680('0x52')]],'buttons':null,'topic':_0x22c5a0['vidaooTopic'],'note':_[_0xa680('0x54')](_0x22c5a0['vidaooNote'])?null:getMustacheRender(_0x22c5a0[_0xa680('0x50')],_0x22fb3f),'metadata':null},'redirect':_0xa680('0x55'),'json':!![]};try{if(!_[_0xa680('0x54')](_0x22c5a0[_0xa680('0x56')])){var _0x4116ca=getMustacheRender(_0x22c5a0[_0xa680('0x56')],_0x22fb3f);var _0x345d81=JSON[_0xa680('0x57')](_0x4116ca);_0x7eaad3['body'][_0xa680('0x58')]=_0x345d81;}}catch(_0x221d2d){throw new db[(_0xa680('0x59'))][(_0xa680('0x5a'))](_0xa680('0x5b'));}return rp(_0x7eaad3);}else{throw new db[(_0xa680('0x59'))][(_0xa680('0x5a'))](_0xa680('0x5c'));}})[_0xa680('0x18')](function(_0x47cb9d){_0x325ec3=_0x47cb9d;if(_0x325ec3['id']){var _0x4d34c4={'body':_0x325ec3[_0xa680('0x5d')],'ChatWebsiteId':_0x22c5a0['id'],'ChatInteractionId':_0x536006['id'],'direction':_0xa680('0x5e'),'UserId':_0x16e4e7['user']['id']};return db[_0xa680('0x5f')][_0xa680('0x47')](_0x4d34c4,{});}else{throw new db['Sequelize'][(_0xa680('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xa680('0x18')](function(){return _0x536006['updateAttributes']({'vidaooSessionId':_0x325ec3['id']});})[_0xa680('0x18')](respondWithResult(_0x2b6294,null))[_0xa680('0x22')](handleError(_0x2b6294,null));};exports[_0xa680('0x60')]=function(_0x95b790,_0x4b5ede){if(_0x95b790[_0xa680('0x30')]['id']){delete _0x95b790[_0xa680('0x30')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x95b790[_0xa680('0x3c')]['id']},'include':[{'model':db[_0xa680('0x61')],'as':_0xa680('0x62')}]})[_0xa680('0x18')](handleEntityNotFound(_0x4b5ede,null))[_0xa680('0x18')](saveUpdates(_0x95b790[_0xa680('0x30')],null))[_0xa680('0x18')](respondWithResult(_0x4b5ede,null))[_0xa680('0x22')](handleError(_0x4b5ede,null));};exports[_0xa680('0x63')]=function(_0x5bf3a9,_0x14e4b7){if(_0x5bf3a9['body']['id']){delete _0x5bf3a9['body']['id'];}return db[_0xa680('0x36')]['find']({'where':{'id':_0x5bf3a9[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](function(_0x5d6d40){if(!_0x5d6d40){logger[_0xa680('0x1d')](_0xa680('0x64'),_0xa680('0x63'),0x194,_0xa680('0x65'));_0x14e4b7['sendStatus'](0x194);}else{if(_0x5d6d40['UserId']){throw new db['Sequelize'][(_0xa680('0x5a'))]('Interaction\x20already\x20assigned');}}return _0x5d6d40;})[_0xa680('0x18')](function(_0x24578d){if(_0x24578d){return _0x24578d[_0xa680('0x2c')]({'closed':_0x5bf3a9[_0xa680('0x30')]['closed'],'disposition':_0x5bf3a9['body'][_0xa680('0x66')]})[_0xa680('0x18')](function(_0x18dde0){return _0x18dde0;});}})['then'](function(){return respondWithRpcPromise(_0xa680('0x67'),_0xa680('0x63'),_0x5bf3a9[_0xa680('0x30')],client9004);})[_0xa680('0x18')](respondWithResult(_0x14e4b7,null))[_0xa680('0x22')](handleError(_0x14e4b7,null));};exports[_0xa680('0x68')]=function(_0x425e6d,_0x599183){_0x425e6d[_0xa680('0x30')][_0xa680('0x2e')]=_0x425e6d[_0xa680('0x69')][_0xa680('0x6a')];_0x425e6d[_0xa680('0x30')][_0xa680('0x6b')]=_0x425e6d['file'][_0xa680('0x6c')];_0x425e6d[_0xa680('0x30')][_0xa680('0x6d')]=_0x425e6d[_0xa680('0x69')][_0xa680('0x6e')];return db['Attachment'][_0xa680('0x47')](_0x425e6d['body'])[_0xa680('0x18')](respondWithResult(_0x599183,0xc9))[_0xa680('0x22')](handleError(_0x599183,null));};exports['attachmentDownload']=function(_0x5ba60a,_0x5baa54){return db[_0xa680('0x36')][_0xa680('0x4b')]({'where':{'id':_0x5ba60a[_0xa680('0x3c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5baa54,null))[_0xa680('0x18')](function(_0x372654){if(_0x372654){if(_0x372654['closed']){return _0x5baa54[_0xa680('0x23')](0x193)[_0xa680('0x25')]({'status':0x193,'message':_0xa680('0x6f')});}return db[_0xa680('0x70')][_0xa680('0x4b')]({'where':{'id':_0x5ba60a[_0xa680('0x3a')]['attachId']},'raw':!![]})[_0xa680('0x18')](handleEntityNotFound(_0x5baa54,null));}})[_0xa680('0x18')](function(_0x1599b6){if(_0x1599b6){var _0x4a2e4b=_0x1599b6[_0xa680('0x71')]!==null;var _0x1ac9ce=path[_0xa680('0x72')](config['root'],_0xa680('0x73'));if(_0x4a2e4b){_0x1ac9ce=path[_0xa680('0x72')](_0x1ac9ce,_0xa680('0x74'));}var _0x2a7983=path[_0xa680('0x72')](_0x1ac9ce,_0x1599b6[_0xa680('0x6b')]);return _0x5baa54[_0xa680('0x75')](_0x2a7983);}})[_0xa680('0x22')](handleError(_0x5baa54,null));};exports['close']=function(_0x4942f1,_0x389bad){var _0x10899c=null;var _0xed9306=null;var _0x1b0afc=null;if(_0x4942f1[_0xa680('0x30')]['id']){delete _0x4942f1[_0xa680('0x30')]['id'];}if(_0x4942f1[_0xa680('0x30')][_0xa680('0x76')]){_0x1b0afc=path[_0xa680('0x72')](config[_0xa680('0x77')],'server/files/chat/upload/',util[_0xa680('0x78')](_0xa680('0x79'),Date[_0xa680('0x7a')]()));_0x4942f1[_0xa680('0x30')]['pathTranscript']=_0x1b0afc;}return db[_0xa680('0x36')][_0xa680('0x46')]({'where':{'id':_0x4942f1[_0xa680('0x3c')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xa680('0x7b')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x389bad,null))['then'](saveUpdates(_0x4942f1['body'],null))[_0xa680('0x18')](function(_0x4909e2){if(_0x4909e2){_0x10899c=_0x4909e2;return db[_0xa680('0x7c')]['find']({'where':{'id':_0x10899c[_0xa680('0x4c')]}});}})[_0xa680('0x18')](function(_0x21ad52){if(_0x21ad52){_0xed9306=_0x21ad52;return db['CmContact']['find']({'where':{'id':_0x10899c[_0xa680('0x7d')]}});}})[_0xa680('0x18')](function(_0x5ee8ed){if(_0x5ee8ed){if(_0x1b0afc){var _0x1ff7b5=null;for(var _0x14978c=0x1;_0x14978c<_0x10899c['Messages'][_0xa680('0x43')];++_0x14978c){_0x1ff7b5=_0x10899c['Messages'][_0x14978c];var _0x147321=_0x1ff7b5['UserId']?util[_0xa680('0x78')]('%s%d',_0xed9306[_0xa680('0x7e')],_0x1ff7b5[_0xa680('0x7f')]):_0xa680('0x80');var _0x4314ee=_0x4942f1[_0xa680('0x30')]['customer']||util[_0xa680('0x78')](_0xa680('0x81'),'Visitor',_0x1ff7b5['ContactId']);switch(_0xed9306['agentIdentifier']){case'website_alias':_0x147321=_0x1ff7b5[_0xa680('0x7f')]?util[_0xa680('0x78')](_0xa680('0x81'),_0xed9306[_0xa680('0x7e')],_0x1ff7b5[_0xa680('0x7f')]):_0xa680('0x80');break;case'agent_alias':_0x147321=_0x1ff7b5[_0xa680('0x7f')]?_0x1ff7b5['User'][_0xa680('0x82')]||_0x1ff7b5[_0xa680('0x7b')][_0xa680('0x83')]:_0xa680('0x80');break;case _0xa680('0x84'):_0x147321=_0x1ff7b5['UserId']?_0x1ff7b5['User'][_0xa680('0x83')]:_0xa680('0x80');break;default:_0x147321=_0x1ff7b5[_0xa680('0x7f')]?util['format']('%s%d',_0xed9306[_0xa680('0x7e')],_0x1ff7b5[_0xa680('0x7f')]):_0xa680('0x80');}var _0x33fa31=util[_0xa680('0x78')](_0xa680('0x85'),moment(_0x1ff7b5[_0xa680('0x86')])['format'](_0xa680('0x87')),_0x1ff7b5[_0xa680('0x88')]==='in'?_0x4314ee:_0x147321,_0x1ff7b5[_0xa680('0x30')]);if(!_0x1ff7b5[_0xa680('0x89')]){fs[_0xa680('0x8a')](_0x1b0afc,_0x33fa31);}}return db[_0xa680('0x8b')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa680('0x8c')],'as':_0xa680('0x8d'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa680('0x8e'),'raw':!![]}]}]});}}})[_0xa680('0x18')](function(_0x5b9e4b){if(!_0x5b9e4b||!_0x5b9e4b[_0xa680('0x8d')]||!_0x4942f1[_0xa680('0x30')])return _0x10899c;var _0x4db571=_0x5b9e4b[_0xa680('0x8f')]();return respondWithRpcPromise(_0xa680('0x90'),_0xa680('0x91'),{'account':_0x4db571,'message':{'from':util[_0xa680('0x78')](_0xa680('0x92'),_0x5b9e4b[_0xa680('0x2e')],_0x5b9e4b[_0xa680('0x52')]||_0x5b9e4b['Smtp'][_0xa680('0x51')]),'to':_0x4942f1[_0xa680('0x30')]['mailTranscript'],'subject':_0xa680('0x93'),'text':util[_0xa680('0x78')](_0xa680('0x94'),_0x4942f1[_0xa680('0x30')][_0xa680('0x76')]),'attachments':[{'path':_0x1b0afc}]}})[_0xa680('0x18')](function(){return _0x10899c;})[_0xa680('0x22')](function(_0x40357b){logger[_0xa680('0x1d')](_0x40357b);});})[_0xa680('0x18')](respondWithStatusCode(_0x389bad,0xc8))[_0xa680('0x22')](handleError(_0x389bad,null));};exports['addMessage']=function(_0x3d3f82,_0x36853f){return db[_0xa680('0x5f')][_0xa680('0x46')]({'where':{'id':_0x3d3f82[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x36853f,null))[_0xa680('0x18')](function(_0x2f5944){if(_0x2f5944){return _0x2f5944[_0xa680('0x95')](_0x3d3f82[_0xa680('0x30')][_0xa680('0x96')],_[_0xa680('0x97')](_0x3d3f82[_0xa680('0x30')],[_0xa680('0x96'),'id'])||{});}})['then'](respondWithResult(_0x36853f,null))[_0xa680('0x22')](handleError(_0x36853f,null));};exports['getMessages']=function(_0x2bfdeb,_0x4dda21){var _0xb0d083={'raw':![],'where':{}};var _0x1d8e07={};var _0x3f6fc2={'count':0x0,'rows':[]};return db[_0xa680('0x36')][_0xa680('0x4b')]({'where':{'id':_0x2bfdeb[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x4dda21,null))[_0xa680('0x18')](function(_0x593d35){if(_0x593d35){_0x1d8e07[_0xa680('0x3d')]=_[_0xa680('0x3e')](db[_0xa680('0x5f')]['rawAttributes']);_0x1d8e07['query']=_[_0xa680('0x3e')](_0x2bfdeb[_0xa680('0x3a')]);_0x1d8e07['filters']=_[_0xa680('0x98')](_0x1d8e07[_0xa680('0x3d')],_0x1d8e07[_0xa680('0x3a')]);_0xb0d083[_0xa680('0x42')]=_[_0xa680('0x98')](_0x1d8e07[_0xa680('0x3d')],qs[_0xa680('0x41')](_0x2bfdeb[_0xa680('0x3a')][_0xa680('0x41')]));_0xb0d083['attributes']=_0xb0d083[_0xa680('0x42')]['length']?_0xb0d083[_0xa680('0x42')]:_0x1d8e07[_0xa680('0x3d')];if(!_0x2bfdeb['query'][_0xa680('0x99')]('nolimit')){_0xb0d083[_0xa680('0x27')]=qs[_0xa680('0x27')](_0x2bfdeb[_0xa680('0x3a')][_0xa680('0x27')]);_0xb0d083[_0xa680('0x26')]=qs[_0xa680('0x26')](_0x2bfdeb[_0xa680('0x3a')]['offset']);}_0xb0d083[_0xa680('0x9a')]=qs[_0xa680('0x9b')](_0x2bfdeb[_0xa680('0x3a')][_0xa680('0x9b')]);_0xb0d083[_0xa680('0x9c')]=qs['filters'](_[_0xa680('0x9d')](_0x2bfdeb['query'],_0x1d8e07['filters']));_0xb0d083[_0xa680('0x9c')][_0xa680('0x9e')]=_0x593d35['id'];if(_0x2bfdeb[_0xa680('0x3a')]['filter']){_0xb0d083[_0xa680('0x9c')]=_[_0xa680('0x2f')](_0xb0d083[_0xa680('0x9c')],{'$or':_['map'](_0xb0d083[_0xa680('0x42')],function(_0x4f65f2){var _0x2c1654={};_0x2c1654[_0x4f65f2]={'$like':'%'+_0x2bfdeb['query'][_0xa680('0x9f')]+'%'};return _0x2c1654;})});}if(_0x2bfdeb[_0xa680('0x3a')][_0xa680('0xa0')]){var _0x4ce04e=_0x2bfdeb[_0xa680('0x3a')][_0xa680('0xa0')][_0xa680('0xa1')](',');var _0x47e7cb={};_0x47e7cb[_0x4ce04e[0x0]]={'$gte':moment(_0x4ce04e[0x1])['format'](_0xa680('0xa2'))};_0xb0d083['where']=_['merge'](_0xb0d083[_0xa680('0x9c')],_0x47e7cb);}_0xb0d083=_[_0xa680('0x2f')]({},_0xb0d083,_0x2bfdeb[_0xa680('0x45')]);return db[_0xa680('0x5f')][_0xa680('0x29')]({'where':_0xb0d083[_0xa680('0x9c')]})['then'](function(_0x2ed634){_0x3f6fc2[_0xa680('0x29')]=_0x2ed634;if(_0x2bfdeb[_0xa680('0x3a')][_0xa680('0x44')]){_0xb0d083[_0xa680('0xa3')]=[{'all':!![]}];}return db[_0xa680('0x5f')]['findAll'](_0xb0d083);})[_0xa680('0x18')](function(_0x59f143){_0x3f6fc2[_0xa680('0xa4')]=_0x59f143;return _0x3f6fc2;});}})[_0xa680('0x18')](respondWithFilteredResult(_0x4dda21,_0xb0d083))[_0xa680('0x22')](handleError(_0x4dda21,null));};exports[_0xa680('0xa5')]=function(_0x5a1cee,_0x4c8596){var _0x25e088={'where':{}},_0x281df4={},_0x5717a3={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa680('0x4b')]({'where':{'id':_0x5a1cee[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x4c8596,null))['then'](function(_0x10d588){if(_0x10d588){_0x281df4[_0xa680('0x3d')]=_[_0xa680('0x3e')](db[_0xa680('0x5f')]['rawAttributes']);_0x281df4[_0xa680('0x3a')]=_['keys'](_0x5a1cee[_0xa680('0x3a')]);_0x281df4[_0xa680('0x40')]=_[_0xa680('0x98')](_0x281df4[_0xa680('0x3d')],_0x281df4[_0xa680('0x3a')]);_0x25e088[_0xa680('0x42')]=_['intersection'](_0x281df4[_0xa680('0x3d')],qs[_0xa680('0x41')](_0x5a1cee[_0xa680('0x3a')][_0xa680('0x41')]));_0x25e088[_0xa680('0x42')]=_0x25e088[_0xa680('0x42')][_0xa680('0x43')]?_0x25e088['attributes']:_0x281df4[_0xa680('0x3d')];if(!_0x5a1cee[_0xa680('0x3a')]['hasOwnProperty'](_0xa680('0xa6'))){_0x25e088[_0xa680('0x27')]=qs['limit'](_0x5a1cee[_0xa680('0x3a')][_0xa680('0x27')]);_0x25e088[_0xa680('0x26')]=qs[_0xa680('0x26')](_0x5a1cee['query']['offset']);}_0x25e088['order']=qs[_0xa680('0x9b')](_0x5a1cee['query']['sort']);_0x25e088[_0xa680('0x9c')]=qs[_0xa680('0x40')](_['pick'](_0x5a1cee[_0xa680('0x3a')],_0x281df4[_0xa680('0x40')]));_0x25e088['where'][_0xa680('0x9e')]=_0x10d588['id'];if(_0x5a1cee[_0xa680('0x3a')][_0xa680('0x9f')]){_0x25e088[_0xa680('0x9c')]=_['merge'](_0x25e088[_0xa680('0x9c')],{'$or':_[_0xa680('0x35')](_0x25e088[_0xa680('0x42')],function(_0x4c4bc6){var _0x3ac864={};_0x3ac864[_0x4c4bc6]={'$like':'%'+_0x5a1cee[_0xa680('0x3a')][_0xa680('0x9f')]+'%'};return _0x3ac864;})});}_0x25e088[_0xa680('0x9c')]['secret']=![];if(_0x5a1cee['query']['id']){_0x25e088['where']['id']={'$gt':_0x5a1cee['query']['id']};}_0x25e088=_[_0xa680('0x2f')]({},_0x25e088,_0x5a1cee[_0xa680('0x45')]);return db[_0xa680('0x5f')][_0xa680('0x29')]({'where':_0x25e088[_0xa680('0x9c')]})[_0xa680('0x18')](function(_0x380e7c){_0x5717a3[_0xa680('0x29')]=_0x380e7c;_0x25e088[_0xa680('0xa3')]=[];if(_0x5a1cee[_0xa680('0x3a')][_0xa680('0xa7')]){_0x25e088[_0xa680('0xa3')]['push']({'model':db[_0xa680('0x7b')],'as':_0xa680('0x7b'),'attributes':['id',_0xa680('0x83'),_0xa680('0x82')]});}if(_0x5a1cee[_0xa680('0x3a')]['includeAll']){_0x25e088[_0xa680('0xa3')]=[{'all':!![]}];}return db[_0xa680('0x5f')]['findAll'](_0x25e088);})[_0xa680('0x18')](function(_0xdd5735){_0x5717a3[_0xa680('0xa4')]=_0xdd5735;return _0x5717a3;});}})['then'](respondWithFilteredResult(_0x4c8596,_0x25e088))[_0xa680('0x22')](handleError(_0x4c8596,null));};exports['addTags']=function(_0x332319,_0x48e1bf){return db[_0xa680('0x36')]['find']({'where':{'id':_0x332319[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x48e1bf,null))[_0xa680('0x18')](function(_0x182d3d){if(_0x182d3d){return _0x182d3d['setTags'](_0x332319['body'][_0xa680('0x96')],_[_0xa680('0x97')](_0x332319[_0xa680('0x30')],[_0xa680('0x96'),'id'])||{})[_0xa680('0xa8')](function(){return db[_0xa680('0xa9')][_0xa680('0x39')]({'attributes':['id','name','color'],'where':{'id':_0x332319[_0xa680('0x30')]['ids']}});})[_0xa680('0x18')](function(_0xad1a40){socket[_0xa680('0xaa')](_0xa680('0xab'),{'id':Number(_0x332319[_0xa680('0x3c')]['id']),'tags':_0xad1a40||[]});return{'id':Number(_0x332319['params']['id']),'tags':_0xad1a40||[]};});}})[_0xa680('0x18')](respondWithResult(_0x48e1bf,null))[_0xa680('0x22')](handleError(_0x48e1bf,null));};exports[_0xa680('0xac')]=function(_0x3e3990,_0x4655ad){return db[_0xa680('0x36')][_0xa680('0x46')]({'where':{'id':_0x3e3990['params']['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x4655ad,null))[_0xa680('0x18')](function(_0x354166){if(_0x354166){return _0x354166[_0xa680('0xac')](_0x3e3990[_0xa680('0x3a')]['ids']);}})[_0xa680('0x18')](respondWithStatusCode(_0x4655ad,null))[_0xa680('0x22')](handleError(_0x4655ad,null));};exports[_0xa680('0x75')]=function(_0x1ea298,_0x3a5c30){var _0x1312fa=moment()[_0xa680('0xad')]()[_0xa680('0xae')]();var _0x43c484=path[_0xa680('0x72')](config[_0xa680('0x77')],_0xa680('0xaf'),_0xa680('0xb0'),_0xa680('0xb1'));var _0x25c29d=path['join'](config[_0xa680('0x77')],_0xa680('0xaf'),'files',_0xa680('0xb2'));var _0x1fa35c=path[_0xa680('0x72')](_0x43c484,_0x1312fa);var _0x33d40f=util[_0xa680('0x78')](_0xa680('0xb3'),_0x1ea298[_0xa680('0x3c')]['id'],_0x1312fa);var _0x1729ab=path[_0xa680('0x72')](_0x43c484,_0x33d40f);var _0x94e702=[];_0x94e702['push']({'model':db['User'],'as':_0xa680('0x7b'),'attributes':['id',_0xa680('0x83')],'raw':!![]});_0x94e702['push']({'model':db['CmContact'],'as':_0xa680('0x62'),'attributes':['id','firstName',_0xa680('0xb4')],'raw':!![]});if(_0x1ea298[_0xa680('0x3a')][_0xa680('0xb2')]){_0x94e702[_0xa680('0xb5')]({'model':db[_0xa680('0x70')],'as':'Attachment','raw':!![]});}var _0x568b74=[{'model':db['ChatMessage'],'as':_0xa680('0xb6'),'attributes':['id',_0xa680('0x30'),_0xa680('0x86'),'direction','secret','read'],'include':_0x94e702}];_0x568b74[_0xa680('0xb5')]({'model':db['ChatWebsite'],'as':_0xa680('0xb7'),'attributes':['id','name']});_0x568b74[_0xa680('0xb5')]({'model':db[_0xa680('0x7b')],'as':_0xa680('0xb8'),'attributes':['id',_0xa680('0x83')]});return db[_0xa680('0x36')][_0xa680('0x46')]({'where':{'id':_0x1ea298['params']['id']},'include':_0x568b74})[_0xa680('0x18')](handleEntityNotFound(_0x3a5c30,null))[_0xa680('0x18')](function(_0x35aa6d){if(_0x35aa6d){var _0x8c5b7a=_0x35aa6d[_0xa680('0xb9')]({'plain':!![]});fs[_0xa680('0xba')](_0x1fa35c);var _0x395fdf={'channel':'Chat','account':_0x8c5b7a[_0xa680('0xb7')][_0xa680('0x2e')],'agent':_0x8c5b7a[_0xa680('0xb8')]?_0x8c5b7a[_0xa680('0xb8')][_0xa680('0x83')]:_0xa680('0xbb'),'createdAt':moment(_0x8c5b7a['createdAt'])[_0xa680('0x78')](_0xa680('0xa2'))[_0xa680('0xae')](),'closedAt':_0x8c5b7a['closed']?moment(_0x8c5b7a[_0xa680('0xbc')])['format'](_0xa680('0xa2'))['toString']():'','disposition':_0x8c5b7a[_0xa680('0x66')],'chatInfo':{'browser':_0x8c5b7a[_0xa680('0xbd')],'os':_0x8c5b7a[_0xa680('0xbe')],'referer':_0x8c5b7a[_0xa680('0xbf')],'customerIp':_0x8c5b7a[_0xa680('0xc0')],'customerPort':_0x8c5b7a['customerPort']?_0x8c5b7a[_0xa680('0xc1')]:_0xa680('0xbb')},'messages':_(_0x8c5b7a[_0xa680('0xb6')])['tail']()[_0xa680('0x9f')]({'secret':![]})['map'](function(_0x1a5acd){if(_0x1a5acd[_0xa680('0x70')]){var _0x45ad1d=path[_0xa680('0x72')](_0x25c29d,_0x1a5acd[_0xa680('0x70')][_0xa680('0x6b')]);if(fs[_0xa680('0xc2')](_0x45ad1d)){fs['createReadStream'](_0x45ad1d)[_0xa680('0xc3')](fs[_0xa680('0xc4')](path['join'](_0x1fa35c,_0x1a5acd[_0xa680('0x70')]['basename'])));}}return{'date':moment(_0x1a5acd[_0xa680('0x86')])[_0xa680('0x78')](_0xa680('0xa2'))['toString'](),'sender':_0x1a5acd[_0xa680('0x88')]==='out'?_0x1a5acd['User']?_0x1a5acd['User'][_0xa680('0x83')]:_0xa680('0x80'):_0x1a5acd[_0xa680('0x62')][_0xa680('0xc5')]+(_0x1a5acd[_0xa680('0x62')][_0xa680('0xb4')]?'\x20'+_0x1a5acd[_0xa680('0x62')][_0xa680('0xb4')]:''),'body':_0x1a5acd['Attachment']?_0x1a5acd[_0xa680('0x70')][_0xa680('0x6b')]:_0x1a5acd[_0xa680('0x30')],'direction':_0x1a5acd[_0xa680('0x88')]===_0xa680('0x5e')?'A':'C','secret':_0x1a5acd[_0xa680('0x89')],'read':_0x1a5acd[_0xa680('0xc6')],'attachment':_0x1a5acd[_0xa680('0x70')]};})[_0xa680('0xc7')]()};return ejs[_0xa680('0xc8')](path[_0xa680('0x72')](config[_0xa680('0x77')],'server',_0xa680('0xc9'),_0xa680('0xca')),{'interaction':_0x395fdf})[_0xa680('0x18')](function(_0x5d1e8e){var _0x139160=path[_0xa680('0x72')](_0x1fa35c,_0xa680('0xcb')+_0x8c5b7a['id']+'-'+_0x1312fa+'.pdf');var _0x52ea0c={'path':_0x139160,'channel':_0xa680('0xcc'),'interactionId':_0x8c5b7a['id']};return pdf[_0xa680('0xcd')](_0x5d1e8e,_0x52ea0c);})[_0xa680('0x18')](function(){return new Promise(function(_0x29364a,_0x281c82){zipdir(_0x1fa35c,{'saveTo':_0x1729ab},function(_0x4668d7,_0x56495f){if(_0x4668d7)return _0x281c82(_0x4668d7);return _0x29364a(_0x56495f);});})[_0xa680('0x18')](function(){return new BPromise(function(_0x693a79,_0x1ad28f){rimraf(_0x1fa35c,function(_0x328d32){if(_0x328d32)_0x1ad28f(_0x328d32);return _0x693a79();});});})['then'](function(){return _0x3a5c30['download'](_0x1729ab,_0x33d40f,function(_0x2de956){if(_0x2de956){logger[_0xa680('0x1d')](_0xa680('0xce'),_0x2de956);}else{fs[_0xa680('0xcf')](_0x1729ab);}});});});}else{return _0x3a5c30[_0xa680('0xd0')](0xc8);}})[_0xa680('0x22')](handleError(_0x3a5c30,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c93df77..742f0ad 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 _0x950c=['getUsers','then','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','exports','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x950c,0x1d5));var _0xc950=function(_0x3a880f,_0x2e26ba){_0x3a880f=_0x3a880f-0x0;var _0x4418af=_0x950c[_0x3a880f];return _0x4418af;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xc950('0x0')];var ChatMessage=require(_0xc950('0x1'))['db'][_0xc950('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc950('0x3')](0x0);var events={'afterCreate':_0xc950('0x4'),'afterUpdate':_0xc950('0x5'),'afterDestroy':_0xc950('0x6')};function emitEvent(_0x10cb96){return function(_0x25ae5d,_0x315d40,_0x19facd){_0x25ae5d[_0xc950('0x7')]({'attributes':['id'],'raw':!![]})[_0xc950('0x8')](function(_0x186c8e){_0x25ae5d['setDataValue'](_0xc950('0x9'),_0x186c8e[_0xc950('0xa')](function(_0x2f9717){return{'id':_0x2f9717['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x25ae5d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc950('0x8')](function(_0x8011a3){_0x25ae5d['setDataValue'](_0xc950('0xb'),_0x8011a3[_0xc950('0xc')]);ChatInteractionEvents['emit'](_0x10cb96+':'+_0x25ae5d['id'],_0x25ae5d);ChatInteractionEvents[_0xc950('0xd')](_0x10cb96,_0x25ae5d);_0x19facd(null);})[_0xc950('0xe')](_0x19facd(null));};}for(var e in events){if(events[_0xc950('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xc950('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x69fb=['events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','then','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69fb,0xcc));var _0xb69f=function(_0x479884,_0x22712d){_0x479884=_0x479884-0x0;var _0x111a81=_0x69fb[_0x479884];return _0x111a81;};'use strict';var EventEmitter=require(_0xb69f('0x0'));var ChatInteraction=require(_0xb69f('0x1'))['db'][_0xb69f('0x2')];var ChatMessage=require(_0xb69f('0x1'))['db'][_0xb69f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb69f('0x4'),'afterUpdate':_0xb69f('0x5'),'afterDestroy':_0xb69f('0x6')};function emitEvent(_0x30f38e){return function(_0xe6c140,_0x44adf3,_0x151d96){_0xe6c140['getUsers']({'attributes':['id'],'raw':!![]})[_0xb69f('0x7')](function(_0xcf8c65){_0xe6c140['setDataValue']('Users',_0xcf8c65[_0xb69f('0x8')](function(_0x297f68){return{'id':_0x297f68['id']};}));return ChatMessage[_0xb69f('0x9')]({'where':{'ChatInteractionId':_0xe6c140['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x471a7d){_0xe6c140['setDataValue'](_0xb69f('0xa'),_0x471a7d[_0xb69f('0xb')]);ChatInteractionEvents['emit'](_0x30f38e+':'+_0xe6c140['id'],_0xe6c140);ChatInteractionEvents[_0xb69f('0xc')](_0x30f38e,_0xe6c140);_0x151d96(null);})[_0xb69f('0xd')](_0x151d96(null));};}for(var e in events){if(events[_0xb69f('0xe')](e)){var event=events[e];ChatInteraction[_0xb69f('0xf')](e,emitEvent(event));}}module[_0xb69f('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 6193f1d..7d43ae7 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 _0xf4b3=['path','../../config/environment','exports','define','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x239904,_0x4b11e2){var _0x259609=function(_0x41d52a){while(--_0x41d52a){_0x239904['push'](_0x239904['shift']());}};_0x259609(++_0x4b11e2);}(_0xf4b3,0x109));var _0x3f4b=function(_0x3baafb,_0x11761c){_0x3baafb=_0x3baafb-0x0;var _0x4d93c1=_0xf4b3[_0x3baafb];return _0x4d93c1;};'use strict';var _=require(_0x3f4b('0x0'));var util=require('util');var logger=require(_0x3f4b('0x1'))(_0x3f4b('0x2'));var moment=require(_0x3f4b('0x3'));var BPromise=require(_0x3f4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f4b('0x5'));var rimraf=require('rimraf');var config=require(_0x3f4b('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x3f4b('0x7')]=function(_0x58e502,_0x57bb31){return _0x58e502[_0x3f4b('0x8')]('ChatInteraction',attributes,{'tableName':_0x3f4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x538d6d,_0x25b6e2,_0xd9fdeb){if(_0x538d6d[_0x3f4b('0xa')](_0x3f4b('0xb'))){_0x538d6d['closedAt']=moment()[_0x3f4b('0xc')](_0x3f4b('0xd'));}_0xd9fdeb(null,_0x538d6d);}},'charset':'utf8mb4','collate':_0x3f4b('0xe')});}; \ No newline at end of file +var _0x0611=['api','moment','request-promise','path','rimraf','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0611,0x9f));var _0x1061=function(_0x1da9dd,_0x3c51f6){_0x1da9dd=_0x1da9dd-0x0;var _0x1176f2=_0x0611[_0x1da9dd];return _0x1176f2;};'use strict';var _=require('lodash');var util=require(_0x1061('0x0'));var logger=require('../../config/logger')(_0x1061('0x1'));var moment=require(_0x1061('0x2'));var BPromise=require('bluebird');var rp=require(_0x1061('0x3'));var fs=require('fs');var path=require(_0x1061('0x4'));var rimraf=require(_0x1061('0x5'));var config=require('../../config/environment');var attributes=require(_0x1061('0x6'));module[_0x1061('0x7')]=function(_0x3f64fc,_0x4b6c35){return _0x3f64fc['define'](_0x1061('0x8'),attributes,{'tableName':_0x1061('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xba8dc9,_0x3ec86f,_0x3b3186){if(_0xba8dc9[_0x1061('0xa')]('closed')){_0xba8dc9[_0x1061('0xb')]=moment()[_0x1061('0xc')](_0x1061('0xd'));}_0x3b3186(null,_0xba8dc9);}},'charset':_0x1061('0xe'),'collate':_0x1061('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index a5a995b..b36f6fa 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 _0xf4f0=['ChatInteraction','update','body','options','raw','where','attributes','AddTagsToChatInteraction','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateChatInteraction'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf4f0,0x1b1));var _0x0f4f=function(_0x12926a,_0xb3be90){_0x12926a=_0x12926a-0x0;var _0x2db765=_0xf4f0[_0x12926a];return _0x2db765;};'use strict';var _=require(_0x0f4f('0x0'));var util=require(_0x0f4f('0x1'));var moment=require(_0x0f4f('0x2'));var BPromise=require(_0x0f4f('0x3'));var rs=require(_0x0f4f('0x4'));var fs=require('fs');var Redis=require(_0x0f4f('0x5'));var db=require(_0x0f4f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f4f('0x7'))(_0x0f4f('0x8'));var config=require(_0x0f4f('0x9'));var jayson=require(_0x0f4f('0xa'));var client=jayson[_0x0f4f('0xb')][_0x0f4f('0xc')]({'port':0x232a});config['redis']=_[_0x0f4f('0xd')](config[_0x0f4f('0xe')],{'host':_0x0f4f('0xf'),'port':0x18eb});var socket=require(_0x0f4f('0x10'))(new Redis(config[_0x0f4f('0xe')]));require(_0x0f4f('0x11'))['register'](socket);function respondWithRpcPromise(_0x5d9d6f,_0x4df95c,_0x33ed89){return new BPromise(function(_0x4bf337,_0x1be4f3){return client['request'](_0x5d9d6f,_0x33ed89)[_0x0f4f('0x12')](function(_0xdd0200){logger[_0x0f4f('0x13')](_0x0f4f('0x14'),_0x4df95c,_0x0f4f('0x15'));logger[_0x0f4f('0x16')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4df95c,'request\x20sent',JSON[_0x0f4f('0x17')](_0xdd0200));if(_0xdd0200['error']){if(_0xdd0200[_0x0f4f('0x18')][_0x0f4f('0x19')]===0x1f4){logger[_0x0f4f('0x18')](_0x0f4f('0x14'),_0x4df95c,_0xdd0200[_0x0f4f('0x18')][_0x0f4f('0x1a')]);return _0x1be4f3(_0xdd0200[_0x0f4f('0x18')][_0x0f4f('0x1a')]);}logger[_0x0f4f('0x18')](_0x0f4f('0x14'),_0x4df95c,_0xdd0200[_0x0f4f('0x18')][_0x0f4f('0x1a')]);return _0x4bf337(_0xdd0200[_0x0f4f('0x18')][_0x0f4f('0x1a')]);}else{logger[_0x0f4f('0x13')](_0x0f4f('0x14'),_0x4df95c,_0x0f4f('0x15'));_0x4bf337(_0xdd0200['result'][_0x0f4f('0x1a')]);}})[_0x0f4f('0x1b')](function(_0x1bd0fd){logger[_0x0f4f('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x4df95c,_0x1bd0fd);_0x1be4f3(_0x1bd0fd);});});}exports[_0x0f4f('0x1c')]=function(_0x222dc8){var _0x4cfb23=this;return new Promise(function(_0x395316,_0x2d395a){return db[_0x0f4f('0x1d')][_0x0f4f('0x1e')](_0x222dc8[_0x0f4f('0x1f')],{'raw':_0x222dc8[_0x0f4f('0x20')]?_0x222dc8[_0x0f4f('0x20')][_0x0f4f('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x222dc8['options']?_0x222dc8[_0x0f4f('0x20')][_0x0f4f('0x22')]||null:null,'attributes':_0x222dc8[_0x0f4f('0x20')]?_0x222dc8['options'][_0x0f4f('0x23')]||null:null,'limit':_0x222dc8[_0x0f4f('0x20')]?_0x222dc8[_0x0f4f('0x20')]['limit']||null:null})[_0x0f4f('0x12')](function(_0xafa2f7){logger[_0x0f4f('0x13')](_0x0f4f('0x1c'),_0x222dc8);logger[_0x0f4f('0x16')]('UpdateChatInteraction',_0x222dc8,JSON['stringify'](_0xafa2f7));_0x395316(_0xafa2f7);})[_0x0f4f('0x1b')](function(_0x5a9205){logger[_0x0f4f('0x18')](_0x0f4f('0x1c'),_0x5a9205[_0x0f4f('0x1a')],_0x222dc8);_0x2d395a(_0x4cfb23[_0x0f4f('0x18')](0x1f4,_0x5a9205[_0x0f4f('0x1a')]));});});};exports[_0x0f4f('0x24')]=function(_0x2ca1d8){return new Promise(function(_0x2c4bea,_0x4ecf5b){return db['ChatInteraction']['find']({'where':_0x2ca1d8[_0x0f4f('0x20')]?_0x2ca1d8[_0x0f4f('0x20')]['where']||null:null})[_0x0f4f('0x12')](function(_0x5382f3){if(_0x5382f3){return _0x5382f3[_0x0f4f('0x25')](_0x2ca1d8[_0x0f4f('0x1f')]['ids'],_[_0x0f4f('0x26')](_0x2ca1d8[_0x0f4f('0x1f')],[_0x0f4f('0x27'),'id'])||{});}})[_0x0f4f('0x28')](function(_0x3803a7){logger[_0x0f4f('0x13')]('AddTags',_0x2ca1d8);logger[_0x0f4f('0x16')](_0x0f4f('0x29'),_0x2ca1d8,JSON[_0x0f4f('0x17')](_0x3803a7));_0x2c4bea(_0x3803a7);})[_0x0f4f('0x1b')](function(_0x2d345d){logger[_0x0f4f('0x18')](_0x0f4f('0x29'),_0x2d345d['message'],_0x2ca1d8);_0x4ecf5b(_this['error'](0x1f4,_0x2d345d[_0x0f4f('0x1a')]));});});}; \ No newline at end of file +var _0x10ae=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','then','AddTagsToChatInteraction','addTags','omit','ids','AddTags','stringify','lodash'];(function(_0x36535e,_0x664d76){var _0x33982b=function(_0x22008b){while(--_0x22008b){_0x36535e['push'](_0x36535e['shift']());}};_0x33982b(++_0x664d76);}(_0x10ae,0x137));var _0xe10a=function(_0x3821b5,_0x2c73a7){_0x3821b5=_0x3821b5-0x0;var _0x14352b=_0x10ae[_0x3821b5];return _0x14352b;};'use strict';var _=require(_0xe10a('0x0'));var util=require(_0xe10a('0x1'));var moment=require(_0xe10a('0x2'));var BPromise=require('bluebird');var rs=require(_0xe10a('0x3'));var fs=require('fs');var Redis=require(_0xe10a('0x4'));var db=require(_0xe10a('0x5'))['db'];var utils=require(_0xe10a('0x6'));var logger=require(_0xe10a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe10a('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xe10a('0x9')]=_[_0xe10a('0xa')](config[_0xe10a('0x9')],{'host':_0xe10a('0xb'),'port':0x18eb});var socket=require(_0xe10a('0xc'))(new Redis(config[_0xe10a('0x9')]));require(_0xe10a('0xd'))['register'](socket);function respondWithRpcPromise(_0x329bd6,_0x19a0a6,_0x585687){return new BPromise(function(_0x3a7ad5,_0x14aad6){return client[_0xe10a('0xe')](_0x329bd6,_0x585687)['then'](function(_0x23f628){logger[_0xe10a('0xf')](_0xe10a('0x10'),_0x19a0a6,_0xe10a('0x11'));logger[_0xe10a('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x19a0a6,_0xe10a('0x11'),JSON['stringify'](_0x23f628));if(_0x23f628[_0xe10a('0x13')]){if(_0x23f628['error'][_0xe10a('0x14')]===0x1f4){logger[_0xe10a('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x19a0a6,_0x23f628[_0xe10a('0x13')][_0xe10a('0x15')]);return _0x14aad6(_0x23f628[_0xe10a('0x13')][_0xe10a('0x15')]);}logger[_0xe10a('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x19a0a6,_0x23f628[_0xe10a('0x13')][_0xe10a('0x15')]);return _0x3a7ad5(_0x23f628['error']['message']);}else{logger[_0xe10a('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x19a0a6,_0xe10a('0x11'));_0x3a7ad5(_0x23f628[_0xe10a('0x16')]['message']);}})[_0xe10a('0x17')](function(_0x4202d1){logger[_0xe10a('0x13')](_0xe10a('0x10'),_0x19a0a6,_0x4202d1);_0x14aad6(_0x4202d1);});});}exports[_0xe10a('0x18')]=function(_0x597492){var _0x3fb4e5=this;return new Promise(function(_0x36e9f9,_0x2225e7){return db[_0xe10a('0x19')][_0xe10a('0x1a')](_0x597492[_0xe10a('0x1b')],{'raw':_0x597492[_0xe10a('0x1c')]?_0x597492[_0xe10a('0x1c')][_0xe10a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597492[_0xe10a('0x1c')]?_0x597492[_0xe10a('0x1c')][_0xe10a('0x1e')]||null:null,'attributes':_0x597492[_0xe10a('0x1c')]?_0x597492[_0xe10a('0x1c')][_0xe10a('0x1f')]||null:null,'limit':_0x597492['options']?_0x597492[_0xe10a('0x1c')]['limit']||null:null})[_0xe10a('0x20')](function(_0x2926f3){logger['info']('UpdateChatInteraction',_0x597492);logger[_0xe10a('0x12')]('UpdateChatInteraction',_0x597492,JSON['stringify'](_0x2926f3));_0x36e9f9(_0x2926f3);})[_0xe10a('0x17')](function(_0x4c203d){logger[_0xe10a('0x13')]('UpdateChatInteraction',_0x4c203d['message'],_0x597492);_0x2225e7(_0x3fb4e5[_0xe10a('0x13')](0x1f4,_0x4c203d[_0xe10a('0x15')]));});});};exports[_0xe10a('0x21')]=function(_0x1a9419){return new Promise(function(_0x1e6b12,_0x2fb73e){return db['ChatInteraction']['find']({'where':_0x1a9419[_0xe10a('0x1c')]?_0x1a9419[_0xe10a('0x1c')][_0xe10a('0x1e')]||null:null})['then'](function(_0x14edd5){if(_0x14edd5){return _0x14edd5[_0xe10a('0x22')](_0x1a9419[_0xe10a('0x1b')]['ids'],_[_0xe10a('0x23')](_0x1a9419['body'],[_0xe10a('0x24'),'id'])||{});}})['spread'](function(_0x328022){logger['info'](_0xe10a('0x25'),_0x1a9419);logger['debug'](_0xe10a('0x25'),_0x1a9419,JSON[_0xe10a('0x26')](_0x328022));_0x1e6b12(_0x328022);})[_0xe10a('0x17')](function(_0x5a6101){logger[_0xe10a('0x13')](_0xe10a('0x25'),_0x5a6101[_0xe10a('0x15')],_0x1a9419);_0x2fb73e(_this['error'](0x1f4,_0x5a6101[_0xe10a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 432af67..6c3df1a 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 _0xff25=['emit','removeListener','register','length','chatInteraction:'];(function(_0x2711c1,_0x3adb93){var _0x13c95c=function(_0x1de9dd){while(--_0x1de9dd){_0x2711c1['push'](_0x2711c1['shift']());}};_0x13c95c(++_0x3adb93);}(_0xff25,0x190));var _0x5ff2=function(_0x4deff1,_0x5421fc){_0x4deff1=_0x4deff1-0x0;var _0x559271=_0xff25[_0x4deff1];return _0x559271;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save','remove','update'];function createListener(_0x30837d,_0x29b239){return function(_0x11c5a1){_0x29b239[_0x5ff2('0x0')](_0x30837d,_0x11c5a1);};}function removeListener(_0x4b4205,_0x20d430){return function(){ChatInteractionEvents[_0x5ff2('0x1')](_0x4b4205,_0x20d430);};}exports[_0x5ff2('0x2')]=function(_0x9ba150){for(var _0x5b1bba=0x0,_0x532684=events[_0x5ff2('0x3')];_0x5b1bba<_0x532684;_0x5b1bba++){var _0x14744f=events[_0x5b1bba];var _0x31afeb=createListener(_0x5ff2('0x4')+_0x14744f,_0x9ba150);ChatInteractionEvents['on'](_0x14744f,_0x31afeb);}}; \ No newline at end of file +var _0xc153=['remove','update','emit','register','chatInteraction:','save'];(function(_0x24c603,_0x5b6156){var _0x42c1f3=function(_0x4612c9){while(--_0x4612c9){_0x24c603['push'](_0x24c603['shift']());}};_0x42c1f3(++_0x5b6156);}(_0xc153,0x137));var _0x3c15=function(_0x559797,_0x416667){_0x559797=_0x559797-0x0;var _0x49a70f=_0xc153[_0x559797];return _0x49a70f;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x3c15('0x0'),_0x3c15('0x1'),_0x3c15('0x2')];function createListener(_0x4b59a2,_0x4990f6){return function(_0x273498){_0x4990f6[_0x3c15('0x3')](_0x4b59a2,_0x273498);};}function removeListener(_0x227d61,_0x1dc83e){return function(){ChatInteractionEvents['removeListener'](_0x227d61,_0x1dc83e);};}exports[_0x3c15('0x4')]=function(_0x36eb08){for(var _0x101d4f=0x0,_0x589caa=events['length'];_0x101d4f<_0x589caa;_0x101d4f++){var _0x59b1e3=events[_0x101d4f];var _0x3cf90b=createListener(_0x3c15('0x5')+_0x59b1e3,_0x36eb08);ChatInteractionEvents['on'](_0x59b1e3,_0x3cf90b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ddd2345..d15bc68 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 _0x36bf=['put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x36bf,0xe3));var _0xf36b=function(_0xad78b9,_0xc0d56c){_0xad78b9=_0xad78b9-0x0;var _0x204e45=_0x36bf[_0xad78b9];return _0x204e45;};'use strict';var multer=require(_0xf36b('0x0'));var util=require(_0xf36b('0x1'));var path=require(_0xf36b('0x2'));var timeout=require(_0xf36b('0x3'));var express=require(_0xf36b('0x4'));var router=express[_0xf36b('0x5')]();var fs_extra=require(_0xf36b('0x6'));var auth=require(_0xf36b('0x7'));var interaction=require(_0xf36b('0x8'));var config=require('../../config/environment');var controller=require(_0xf36b('0x9'));router[_0xf36b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf36b('0xa')](_0xf36b('0xb'),auth[_0xf36b('0xc')](),controller[_0xf36b('0xd')]);router[_0xf36b('0xa')](_0xf36b('0xe'),auth[_0xf36b('0xf')](),controller[_0xf36b('0x10')]);router['get'](_0xf36b('0x11'),auth[_0xf36b('0xf')](),controller[_0xf36b('0x12')]);router[_0xf36b('0xa')](_0xf36b('0x13'),auth[_0xf36b('0xc')](),controller[_0xf36b('0x14')]);router['get'](_0xf36b('0x15'),auth[_0xf36b('0xf')](),controller[_0xf36b('0x16')]);router[_0xf36b('0xa')](_0xf36b('0x17'),auth['isAuthenticated'](),controller[_0xf36b('0x18')]);router[_0xf36b('0x19')]('/',auth['isAuthenticated'](),controller[_0xf36b('0x1a')]);router['post'](_0xf36b('0x1b'),auth[_0xf36b('0xc')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xf36b('0x1c')]({'destination':function(_0x32fe24,_0x45be82,_0x5a8317){_0x5a8317(null,path['join'](config[_0xf36b('0x1d')],_0xf36b('0x1e')));},'filename':function(_0x3c5a72,_0x1b37ff,_0x5d975d){_0x5d975d(null,util[_0xf36b('0x1f')](_0xf36b('0x20'),Date[_0xf36b('0x21')](),_0x1b37ff[_0xf36b('0x22')][_0xf36b('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single']('file'),controller[_0xf36b('0x24')]);router[_0xf36b('0x19')](_0xf36b('0x13'),auth[_0xf36b('0xf')](),controller['addMessage']);router['post'](_0xf36b('0x25'),auth['isAuthenticated'](),interaction[_0xf36b('0x26')](_0xf36b('0x27'),_0xf36b('0x28')),controller[_0xf36b('0x29')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xf36b('0x27'),_0xf36b('0x2a')),controller['update']);router[_0xf36b('0x2b')]('/:id/custom_update',controller[_0xf36b('0x2c')]);router[_0xf36b('0x2b')](_0xf36b('0x2d'),auth[_0xf36b('0xf')](),controller[_0xf36b('0x2e')]);router[_0xf36b('0x2b')](_0xf36b('0x2f'),controller[_0xf36b('0x30')]);router[_0xf36b('0x31')](_0xf36b('0xe'),auth[_0xf36b('0xc')](),interaction[_0xf36b('0x26')](_0xf36b('0x27'),_0xf36b('0x32')),controller[_0xf36b('0x33')]);router[_0xf36b('0x31')](_0xf36b('0x25'),auth[_0xf36b('0xc')](),controller[_0xf36b('0x34')]);module[_0xf36b('0x35')]=router; \ No newline at end of file +var _0xebc8=['/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','replace','post','file','addMessage','/:id/tags','tracked','chat','put','/:id','update','/:id/custom_update','customUpdate','abandon'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0xebc8,0x9d));var _0x8ebc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xebc8[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x8ebc('0x0'));var util=require(_0x8ebc('0x1'));var path=require(_0x8ebc('0x2'));var timeout=require(_0x8ebc('0x3'));var express=require('express');var router=express[_0x8ebc('0x4')]();var fs_extra=require(_0x8ebc('0x5'));var auth=require(_0x8ebc('0x6'));var interaction=require(_0x8ebc('0x7'));var config=require(_0x8ebc('0x8'));var controller=require(_0x8ebc('0x9'));router['get']('/',auth[_0x8ebc('0xa')](),controller[_0x8ebc('0xb')]);router[_0x8ebc('0xc')](_0x8ebc('0xd'),auth['isAuthenticated'](),controller[_0x8ebc('0xe')]);router['get']('/:id',auth[_0x8ebc('0xf')](),controller[_0x8ebc('0x10')]);router[_0x8ebc('0xc')](_0x8ebc('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x8ebc('0x12')]);router['get'](_0x8ebc('0x13'),auth[_0x8ebc('0xa')](),controller[_0x8ebc('0x14')]);router[_0x8ebc('0xc')](_0x8ebc('0x15'),auth[_0x8ebc('0xf')](),controller[_0x8ebc('0x16')]);router[_0x8ebc('0xc')](_0x8ebc('0x17'),auth[_0x8ebc('0xa')](),controller[_0x8ebc('0x18')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8ebc('0x19'),auth[_0x8ebc('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x8ebc('0x1a')]({'destination':function(_0x2765fd,_0x2efff4,_0x148f8c){_0x148f8c(null,path[_0x8ebc('0x1b')](config[_0x8ebc('0x1c')],_0x8ebc('0x1d')));},'filename':function(_0x17df71,_0x21d05f,_0x7680b6){_0x7680b6(null,util['format']('%s-%s',Date['now'](),_0x21d05f['originalname'][_0x8ebc('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8ebc('0x1f')]('/:id/attachment_upload',upload['single'](_0x8ebc('0x20')),controller['attachmentUpload']);router['post'](_0x8ebc('0x13'),auth[_0x8ebc('0xf')](),controller[_0x8ebc('0x21')]);router['post'](_0x8ebc('0x22'),auth['isAuthenticated'](),interaction[_0x8ebc('0x23')](_0x8ebc('0x24'),'chatinteraction:addtags'),controller['addTags']);router[_0x8ebc('0x25')](_0x8ebc('0x26'),auth[_0x8ebc('0xa')](),interaction[_0x8ebc('0x23')](_0x8ebc('0x24'),'chatinteraction:update'),controller[_0x8ebc('0x27')]);router[_0x8ebc('0x25')](_0x8ebc('0x28'),controller[_0x8ebc('0x29')]);router[_0x8ebc('0x25')]('/:id/abandon',auth[_0x8ebc('0xf')](),controller[_0x8ebc('0x2a')]);router[_0x8ebc('0x25')](_0x8ebc('0x2b'),controller[_0x8ebc('0x2c')]);router[_0x8ebc('0x2d')](_0x8ebc('0x26'),auth['isAuthenticated'](),interaction['tracked'](_0x8ebc('0x24'),_0x8ebc('0x2e')),controller[_0x8ebc('0x2f')]);router['delete'](_0x8ebc('0x22'),auth[_0x8ebc('0xa')](),controller[_0x8ebc('0x30')]);module[_0x8ebc('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index c758692..bd590cb 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 _0xbfcd=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0xbfcd,0xd9));var _0xdbfc=function(_0x3a6a83,_0x23838a){_0x3a6a83=_0x3a6a83-0x0;var _0x34df0b=_0xbfcd[_0x3a6a83];return _0x34df0b;};'use strict';var Sequelize=require(_0xdbfc('0x0'));module[_0xdbfc('0x1')]={'body':{'type':Sequelize[_0xdbfc('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xdbfc('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdbfc('0x4')]}}; \ No newline at end of file +var _0x737c=['BOOLEAN','INTEGER','sequelize','exports'];(function(_0x323006,_0x5b327b){var _0x460838=function(_0x2637bb){while(--_0x2637bb){_0x323006['push'](_0x323006['shift']());}};_0x460838(++_0x5b327b);}(_0x737c,0xa6));var _0xc737=function(_0x3fd9ce,_0x4b1fbe){_0x3fd9ce=_0x3fd9ce-0x0;var _0x3618d9=_0x737c[_0x3fd9ce];return _0x3618d9;};'use strict';var Sequelize=require(_0xc737('0x0'));module[_0xc737('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc737('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc737('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f24a4c2..d671ea3 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 _0xf5c4=['lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','agent','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','get','messages','createdAt'];(function(_0x443fda,_0xb06d0a){var _0x58360d=function(_0xfb6e21){while(--_0xfb6e21){_0x443fda['push'](_0x443fda['shift']());}};_0x58360d(++_0xb06d0a);}(_0xf5c4,0x87));var _0x4f5c=function(_0x30bbdd,_0x4357ca){_0x30bbdd=_0x30bbdd-0x0;var _0x4a92d0=_0xf5c4[_0x30bbdd];return _0x4a92d0;};'use strict';var emlformat=require(_0x4f5c('0x0'));var rimraf=require(_0x4f5c('0x1'));var zipdir=require(_0x4f5c('0x2'));var jsonpatch=require(_0x4f5c('0x3'));var rp=require(_0x4f5c('0x4'));var moment=require(_0x4f5c('0x5'));var BPromise=require(_0x4f5c('0x6'));var Mustache=require(_0x4f5c('0x7'));var util=require('util');var path=require(_0x4f5c('0x8'));var sox=require(_0x4f5c('0x9'));var csv=require(_0x4f5c('0xa'));var ejs=require(_0x4f5c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4f5c('0xc'));var crypto=require(_0x4f5c('0xd'));var jsforce=require(_0x4f5c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f5c('0xa'));var querystring=require('querystring');var Papa=require(_0x4f5c('0xf'));var Redis=require(_0x4f5c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f5c('0x11'));var as=require(_0x4f5c('0x12'));var hardwareService=require(_0x4f5c('0x13'));var logger=require(_0x4f5c('0x14'))('api');var utils=require(_0x4f5c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f5c('0x16'))['db'];config[_0x4f5c('0x17')]=_[_0x4f5c('0x18')](config[_0x4f5c('0x17')],{'host':_0x4f5c('0x19'),'port':0x18eb});var socket=require(_0x4f5c('0x1a'))(new Redis(config[_0x4f5c('0x17')]));require(_0x4f5c('0x1b'))['register'](socket);function respondWithStatusCode(_0xe08f4d,_0x1b00df){_0x1b00df=_0x1b00df||0xcc;return function(_0x4ce0bb){if(_0x4ce0bb){return _0xe08f4d['sendStatus'](_0x1b00df);}return _0xe08f4d[_0x4f5c('0x1c')](_0x1b00df)[_0x4f5c('0x1d')]();};}function respondWithResult(_0x347058,_0x4276db){_0x4276db=_0x4276db||0xc8;return function(_0x568407){if(_0x568407){return _0x347058['status'](_0x4276db)[_0x4f5c('0x1e')](_0x568407);}};}function respondWithFilteredResult(_0x190c20,_0x5700c2){return function(_0x230090){if(_0x230090){var _0x4a2f1a=typeof _0x5700c2[_0x4f5c('0x1f')]===_0x4f5c('0x20')&&typeof _0x5700c2[_0x4f5c('0x21')]==='undefined';var _0x3c5dd7=_0x230090[_0x4f5c('0x22')];var _0x514678=_0x4a2f1a?0x0:_0x5700c2[_0x4f5c('0x1f')];var _0x4ebb1=_0x4a2f1a?_0x230090[_0x4f5c('0x22')]:_0x5700c2[_0x4f5c('0x1f')]+_0x5700c2[_0x4f5c('0x21')];var _0x11db9f;if(_0x4ebb1>=_0x3c5dd7){_0x4ebb1=_0x3c5dd7;_0x11db9f=0xc8;}else{_0x11db9f=0xce;}_0x190c20[_0x4f5c('0x1c')](_0x11db9f);return _0x190c20[_0x4f5c('0x23')](_0x4f5c('0x24'),_0x514678+'-'+_0x4ebb1+'/'+_0x3c5dd7)[_0x4f5c('0x1e')](_0x230090);}return null;};}function patchUpdates(_0x4341ce){return function(_0x37b10f){try{jsonpatch['apply'](_0x37b10f,_0x4341ce,!![]);}catch(_0x3d74bf){return BPromise[_0x4f5c('0x25')](_0x3d74bf);}return _0x37b10f[_0x4f5c('0x26')]();};}function saveUpdates(_0x2bbca2,_0x3e1d26){return function(_0x2c5549){if(_0x2c5549){return _0x2c5549[_0x4f5c('0x27')](_0x2bbca2)[_0x4f5c('0x28')](function(_0x5b6e46){return _0x5b6e46;});}return null;};}function removeEntity(_0x2c5832,_0x42d22b){return function(_0xa5acf4){if(_0xa5acf4){return _0xa5acf4[_0x4f5c('0x29')]()[_0x4f5c('0x28')](function(){_0x2c5832[_0x4f5c('0x1c')](0xcc)[_0x4f5c('0x1d')]();});}};}function handleEntityNotFound(_0xe6ecaa,_0x35b3be){return function(_0xd1bbf5){if(!_0xd1bbf5){_0xe6ecaa[_0x4f5c('0x2a')](0x194);}return _0xd1bbf5;};}function handleError(_0x92af33,_0x1f0f21){_0x1f0f21=_0x1f0f21||0x1f4;return function(_0x1929a4){logger[_0x4f5c('0x2b')](_0x1929a4[_0x4f5c('0x2c')]);if(_0x1929a4[_0x4f5c('0x2d')]){delete _0x1929a4['name'];}_0x92af33[_0x4f5c('0x1c')](_0x1f0f21)[_0x4f5c('0x2e')](_0x1929a4);};}exports[_0x4f5c('0x2f')]=function(_0x3e5f44,_0x3640ca){var _0x1e6d71={},_0x52001b={},_0x312f92={'count':0x0,'rows':[]};var _0x14cb4c=_[_0x4f5c('0x30')](db[_0x4f5c('0x31')][_0x4f5c('0x32')],function(_0x11f12b){return{'name':_0x11f12b[_0x4f5c('0x33')],'type':_0x11f12b['type']['key']};});_0x52001b[_0x4f5c('0x34')]=_[_0x4f5c('0x30')](_0x14cb4c,_0x4f5c('0x2d'));_0x52001b[_0x4f5c('0x35')]=_[_0x4f5c('0x36')](_0x3e5f44['query']);_0x52001b[_0x4f5c('0x37')]=_[_0x4f5c('0x38')](_0x52001b[_0x4f5c('0x34')],_0x52001b[_0x4f5c('0x35')]);_0x1e6d71[_0x4f5c('0x39')]=_[_0x4f5c('0x38')](_0x52001b[_0x4f5c('0x34')],qs[_0x4f5c('0x3a')](_0x3e5f44[_0x4f5c('0x35')][_0x4f5c('0x3a')]));_0x1e6d71[_0x4f5c('0x39')]=_0x1e6d71[_0x4f5c('0x39')][_0x4f5c('0x3b')]?_0x1e6d71[_0x4f5c('0x39')]:_0x52001b[_0x4f5c('0x34')];if(!_0x3e5f44[_0x4f5c('0x35')]['hasOwnProperty']('nolimit')){_0x1e6d71[_0x4f5c('0x21')]=qs[_0x4f5c('0x21')](_0x3e5f44[_0x4f5c('0x35')]['limit']);_0x1e6d71[_0x4f5c('0x1f')]=qs['offset'](_0x3e5f44[_0x4f5c('0x35')]['offset']);}_0x1e6d71['order']=qs['sort'](_0x3e5f44['query'][_0x4f5c('0x3c')]);_0x1e6d71[_0x4f5c('0x3d')]=qs[_0x4f5c('0x37')](_[_0x4f5c('0x3e')](_0x3e5f44[_0x4f5c('0x35')],_0x52001b[_0x4f5c('0x37')]),_0x14cb4c);if(_0x3e5f44[_0x4f5c('0x35')]['filter']){_0x1e6d71[_0x4f5c('0x3d')]=_['merge'](_0x1e6d71[_0x4f5c('0x3d')],{'$or':_['map'](_0x14cb4c,function(_0x32ee7a){if(_0x32ee7a[_0x4f5c('0x3f')]!==_0x4f5c('0x40')){var _0x66be02={};_0x66be02[_0x32ee7a['name']]={'$like':'%'+_0x3e5f44[_0x4f5c('0x35')][_0x4f5c('0x41')]+'%'};return _0x66be02;}})});}_0x1e6d71=_['merge']({},_0x1e6d71,_0x3e5f44[_0x4f5c('0x42')]);var _0x4eb519={'where':_0x1e6d71['where']};return db[_0x4f5c('0x31')][_0x4f5c('0x22')](_0x4eb519)['then'](function(_0x1f8edf){_0x312f92['count']=_0x1f8edf;if(_0x3e5f44['query'][_0x4f5c('0x43')]){_0x1e6d71[_0x4f5c('0x44')]=[{'all':!![]}];}return db[_0x4f5c('0x31')][_0x4f5c('0x45')](_0x1e6d71);})[_0x4f5c('0x28')](function(_0x5aa944){_0x312f92[_0x4f5c('0x46')]=_0x5aa944;return _0x312f92;})['then'](respondWithFilteredResult(_0x3640ca,_0x1e6d71))[_0x4f5c('0x47')](handleError(_0x3640ca,null));};exports[_0x4f5c('0x48')]=function(_0x3f4eb1,_0x9c4b4e){var _0x21f9ff={'raw':!![],'where':{'id':_0x3f4eb1['params']['id']}},_0x14f1df={};_0x14f1df[_0x4f5c('0x34')]=_[_0x4f5c('0x36')](db['ChatInternalMessage'][_0x4f5c('0x32')]);_0x14f1df[_0x4f5c('0x35')]=_[_0x4f5c('0x36')](_0x3f4eb1[_0x4f5c('0x35')]);_0x14f1df['filters']=_['intersection'](_0x14f1df['model'],_0x14f1df[_0x4f5c('0x35')]);_0x21f9ff[_0x4f5c('0x39')]=_['intersection'](_0x14f1df[_0x4f5c('0x34')],qs[_0x4f5c('0x3a')](_0x3f4eb1[_0x4f5c('0x35')][_0x4f5c('0x3a')]));_0x21f9ff[_0x4f5c('0x39')]=_0x21f9ff[_0x4f5c('0x39')][_0x4f5c('0x3b')]?_0x21f9ff[_0x4f5c('0x39')]:_0x14f1df[_0x4f5c('0x34')];if(_0x3f4eb1[_0x4f5c('0x35')][_0x4f5c('0x43')]){_0x21f9ff[_0x4f5c('0x44')]=[{'all':!![]}];}_0x21f9ff=_['merge']({},_0x21f9ff,_0x3f4eb1['options']);return db[_0x4f5c('0x31')][_0x4f5c('0x49')](_0x21f9ff)[_0x4f5c('0x28')](handleEntityNotFound(_0x9c4b4e,null))['then'](respondWithResult(_0x9c4b4e,null))[_0x4f5c('0x47')](handleError(_0x9c4b4e,null));};exports[_0x4f5c('0x4a')]=function(_0x631757,_0x5b9d45){return db[_0x4f5c('0x31')][_0x4f5c('0x4a')](_0x631757[_0x4f5c('0x4b')],{})[_0x4f5c('0x28')](respondWithResult(_0x5b9d45,0xc9))['catch'](handleError(_0x5b9d45,null));};exports[_0x4f5c('0x27')]=function(_0x1d0356,_0x541f00){if(_0x1d0356['body']['id']){delete _0x1d0356['body']['id'];}return db[_0x4f5c('0x31')]['find']({'where':{'id':_0x1d0356[_0x4f5c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x541f00,null))[_0x4f5c('0x28')](saveUpdates(_0x1d0356[_0x4f5c('0x4b')],null))['then'](respondWithResult(_0x541f00,null))[_0x4f5c('0x47')](handleError(_0x541f00,null));};exports[_0x4f5c('0x29')]=function(_0x325b51,_0x21f161){return db[_0x4f5c('0x31')][_0x4f5c('0x49')]({'where':{'id':_0x325b51[_0x4f5c('0x4c')]['id']}})[_0x4f5c('0x28')](handleEntityNotFound(_0x21f161,null))[_0x4f5c('0x28')](removeEntity(_0x21f161,null))['catch'](handleError(_0x21f161,null));};exports[_0x4f5c('0x4d')]=function(_0x453f35,_0x46234a){return db[_0x4f5c('0x31')][_0x4f5c('0x4d')]()['then'](respondWithResult(_0x46234a,null))[_0x4f5c('0x47')](handleError(_0x46234a,null));};function wrapUser(_0x429041){return function(_0x36d819){var _0x571ef8=_0x429041[_0x4f5c('0x4e')]({'plain':!![]});_0x571ef8[_0x4f5c('0x4f')]=[];if(_0x36d819){_0x571ef8['lastMessageAt']=_0x36d819[_0x4f5c('0x50')];_0x571ef8[_0x4f5c('0x51')]=_0x36d819;}else{_0x571ef8[_0x4f5c('0x52')]=moment(0x0)[_0x4f5c('0x53')](_0x4f5c('0x54'));_0x571ef8[_0x4f5c('0x51')]={};}return _0x571ef8;};}exports[_0x4f5c('0x55')]=function(_0x51b5bd,_0x36b768,_0x1468af){var _0xb99086=[];return db[_0x4f5c('0x56')]['findAll']({'where':{'role':['agent',_0x4f5c('0x57'),_0x4f5c('0x58')]},'attributes':['id',_0x4f5c('0x59'),_0x4f5c('0x2d'),_0x4f5c('0x5a'),_0x4f5c('0x5b'),_0x4f5c('0x5c'),_0x4f5c('0x5d'),_0x4f5c('0x5e'),_0x4f5c('0x5f'),'showWebBar'],'order':qs[_0x4f5c('0x3c')]('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x4f5c('0x2d'),'type'],'through':{'attributes':[]}}]})[_0x4f5c('0x28')](function(_0x2b89ca){if(_0x2b89ca){var _0x417d63=_0x51b5bd[_0x4f5c('0x58')][_0x4f5c('0x4e')]({'plain':!![]});if(!_0x417d63)throw new Error(_0x4f5c('0x60'));if(_0x417d63[_0x4f5c('0x5a')]===_0x4f5c('0x58')){return db['UserProfileSection'][_0x4f5c('0x49')]({'where':{'name':'Agents','userProfileId':_0x417d63[_0x4f5c('0x61')]},'raw':!![]})[_0x4f5c('0x28')](function(_0x3e05dc){if(_0x3e05dc){if(_0x3e05dc[_0x4f5c('0x62')]===0x0){return db[_0x4f5c('0x63')][_0x4f5c('0x45')]({'where':{'sectionId':_0x3e05dc['id']},'raw':!![]})[_0x4f5c('0x28')](function(_0x20ab12){var _0x24e057=[];if(_['isEmpty'](_0x20ab12)){_0x24e057=_[_0x4f5c('0x41')](_0x2b89ca,function(_0x56d97d){if(_0x56d97d[_0x4f5c('0x5a')]!==_0x4f5c('0x64')){return _0x56d97d;}});return _0x24e057;}else{for(var _0x1bcd4a=0x0;_0x1bcd4a<_0x2b89ca[_0x4f5c('0x3b')];_0x1bcd4a++){var _0x83d705=_0x2b89ca[_0x1bcd4a];if(_0x83d705['role']==='agent'){var _0x1f1303=_[_0x4f5c('0x49')](_0x20ab12,function(_0x614e44){return _0x614e44[_0x4f5c('0x65')]===_0x83d705['id'];});if(_0x1f1303)_0x24e057[_0x4f5c('0x66')](_0x83d705);}else{_0x24e057[_0x4f5c('0x66')](_0x83d705);}}return _0x24e057;}});}else{return _0x2b89ca;}}else{var _0x289585=_[_0x4f5c('0x41')](_0x2b89ca,function(_0x3fde13){if(_0x3fde13['role']!==_0x4f5c('0x64')){return _0x3fde13;}});return _0x289585;}});}else{return _0x2b89ca;}}})[_0x4f5c('0x28')](function(_0x18c4de){var _0x2fb489=[];if(_0x18c4de){_0xb99086=_0x18c4de;for(var _0x3ef461=0x0;_0x3ef461<_0x18c4de['length'];_0x3ef461+=0x1){_0xb99086[_0x3ef461][_0x4f5c('0x4f')]=[];_0x2fb489[_0x4f5c('0x66')](db['ChatInternalMessage'][_0x4f5c('0x49')]({'where':{'FromId':[_0x51b5bd['user']['id'],_0x18c4de[_0x3ef461]['id']],'ToId':[_0x51b5bd['user']['id'],_0x18c4de[_0x3ef461]['id']],'ChatGroupId':null},'attributes':['id',_0x4f5c('0x50'),_0x4f5c('0x67'),_0x4f5c('0x68'),_0x4f5c('0x69'),_0x4f5c('0x4b')],'order':qs[_0x4f5c('0x3c')](_0x4f5c('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4f5c('0x28')](wrapUser(_0x18c4de[_0x3ef461])));}return BPromise[_0x4f5c('0x6b')](_0x2fb489);}return[];})[_0x4f5c('0x28')](function(_0x5abd4e){return{'rows':_0x5abd4e,'count':_0x5abd4e[_0x4f5c('0x3b')]};})[_0x4f5c('0x28')](respondWithResult(_0x36b768,null))['catch'](handleError(_0x36b768,null));}; \ No newline at end of file +var _0x7ee9=['destroy','describe','messages','lastMessageAt','lastMessage','getUsers','User','findAll','admin','user','fullname','role','userpic','internal','lastLoginAt','sort','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','createdAt','FromId','ToId','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','options','includeAll','ChatInternalMessage','rows','catch','show','params','create','body','find'];(function(_0xb2fb09,_0x23241a){var _0x49b96c=function(_0x385f2a){while(--_0x385f2a){_0xb2fb09['push'](_0xb2fb09['shift']());}};_0x49b96c(++_0x23241a);}(_0x7ee9,0x157));var _0x97ee=function(_0x2ad19a,_0xb1e06a){_0x2ad19a=_0x2ad19a-0x0;var _0x4e4e65=_0x7ee9[_0x2ad19a];return _0x4e4e65;};'use strict';var emlformat=require(_0x97ee('0x0'));var rimraf=require(_0x97ee('0x1'));var zipdir=require(_0x97ee('0x2'));var jsonpatch=require(_0x97ee('0x3'));var rp=require(_0x97ee('0x4'));var moment=require('moment');var BPromise=require(_0x97ee('0x5'));var Mustache=require('mustache');var util=require(_0x97ee('0x6'));var path=require(_0x97ee('0x7'));var sox=require(_0x97ee('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97ee('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x97ee('0xa'));var jsforce=require(_0x97ee('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x97ee('0xc'));var querystring=require(_0x97ee('0xd'));var Papa=require(_0x97ee('0xe'));var Redis=require('ioredis');var authService=require(_0x97ee('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x97ee('0x10'));var hardwareService=require(_0x97ee('0x11'));var logger=require(_0x97ee('0x12'))(_0x97ee('0x13'));var utils=require('../../config/utils');var config=require(_0x97ee('0x14'));var licenseUtil=require(_0x97ee('0x15'));var db=require(_0x97ee('0x16'))['db'];config[_0x97ee('0x17')]=_['defaults'](config[_0x97ee('0x17')],{'host':_0x97ee('0x18'),'port':0x18eb});var socket=require(_0x97ee('0x19'))(new Redis(config[_0x97ee('0x17')]));require('./chatInternalMessage.socket')[_0x97ee('0x1a')](socket);function respondWithStatusCode(_0x59d42b,_0x48305e){_0x48305e=_0x48305e||0xcc;return function(_0x237890){if(_0x237890){return _0x59d42b['sendStatus'](_0x48305e);}return _0x59d42b[_0x97ee('0x1b')](_0x48305e)[_0x97ee('0x1c')]();};}function respondWithResult(_0x4c0263,_0x4783db){_0x4783db=_0x4783db||0xc8;return function(_0x30fa3e){if(_0x30fa3e){return _0x4c0263[_0x97ee('0x1b')](_0x4783db)[_0x97ee('0x1d')](_0x30fa3e);}};}function respondWithFilteredResult(_0x970b1,_0x53ae9a){return function(_0x52681a){if(_0x52681a){var _0x4da0eb=typeof _0x53ae9a[_0x97ee('0x1e')]===_0x97ee('0x1f')&&typeof _0x53ae9a[_0x97ee('0x20')]==='undefined';var _0x1fbaae=_0x52681a[_0x97ee('0x21')];var _0x2dd888=_0x4da0eb?0x0:_0x53ae9a['offset'];var _0x37544c=_0x4da0eb?_0x52681a['count']:_0x53ae9a[_0x97ee('0x1e')]+_0x53ae9a[_0x97ee('0x20')];var _0x3b673b;if(_0x37544c>=_0x1fbaae){_0x37544c=_0x1fbaae;_0x3b673b=0xc8;}else{_0x3b673b=0xce;}_0x970b1[_0x97ee('0x1b')](_0x3b673b);return _0x970b1[_0x97ee('0x22')]('Content-Range',_0x2dd888+'-'+_0x37544c+'/'+_0x1fbaae)[_0x97ee('0x1d')](_0x52681a);}return null;};}function patchUpdates(_0x3e88ee){return function(_0x5c6bab){try{jsonpatch[_0x97ee('0x23')](_0x5c6bab,_0x3e88ee,!![]);}catch(_0x4d4ab5){return BPromise[_0x97ee('0x24')](_0x4d4ab5);}return _0x5c6bab[_0x97ee('0x25')]();};}function saveUpdates(_0x578fcc,_0x37c5f0){return function(_0x424e25){if(_0x424e25){return _0x424e25['update'](_0x578fcc)['then'](function(_0x3112e8){return _0x3112e8;});}return null;};}function removeEntity(_0x21b990,_0x9a4897){return function(_0x59f63b){if(_0x59f63b){return _0x59f63b['destroy']()[_0x97ee('0x26')](function(){_0x21b990[_0x97ee('0x1b')](0xcc)[_0x97ee('0x1c')]();});}};}function handleEntityNotFound(_0x34a442,_0x424889){return function(_0x258fa6){if(!_0x258fa6){_0x34a442[_0x97ee('0x27')](0x194);}return _0x258fa6;};}function handleError(_0x15b489,_0x324bec){_0x324bec=_0x324bec||0x1f4;return function(_0x132ae7){logger[_0x97ee('0x28')](_0x132ae7[_0x97ee('0x29')]);if(_0x132ae7[_0x97ee('0x2a')]){delete _0x132ae7[_0x97ee('0x2a')];}_0x15b489[_0x97ee('0x1b')](_0x324bec)[_0x97ee('0x2b')](_0x132ae7);};}exports[_0x97ee('0x2c')]=function(_0xc9270,_0x57d569){var _0x168d1b={},_0x3f5da6={},_0x406255={'count':0x0,'rows':[]};var _0x290700=_[_0x97ee('0x2d')](db['ChatInternalMessage'][_0x97ee('0x2e')],function(_0x3072f0){return{'name':_0x3072f0[_0x97ee('0x2f')],'type':_0x3072f0[_0x97ee('0x30')][_0x97ee('0x31')]};});_0x3f5da6[_0x97ee('0x32')]=_[_0x97ee('0x2d')](_0x290700,'name');_0x3f5da6[_0x97ee('0x33')]=_[_0x97ee('0x34')](_0xc9270['query']);_0x3f5da6[_0x97ee('0x35')]=_[_0x97ee('0x36')](_0x3f5da6[_0x97ee('0x32')],_0x3f5da6[_0x97ee('0x33')]);_0x168d1b[_0x97ee('0x37')]=_[_0x97ee('0x36')](_0x3f5da6[_0x97ee('0x32')],qs[_0x97ee('0x38')](_0xc9270[_0x97ee('0x33')][_0x97ee('0x38')]));_0x168d1b['attributes']=_0x168d1b[_0x97ee('0x37')][_0x97ee('0x39')]?_0x168d1b[_0x97ee('0x37')]:_0x3f5da6[_0x97ee('0x32')];if(!_0xc9270[_0x97ee('0x33')][_0x97ee('0x3a')]('nolimit')){_0x168d1b[_0x97ee('0x20')]=qs['limit'](_0xc9270[_0x97ee('0x33')][_0x97ee('0x20')]);_0x168d1b['offset']=qs[_0x97ee('0x1e')](_0xc9270['query']['offset']);}_0x168d1b[_0x97ee('0x3b')]=qs['sort'](_0xc9270[_0x97ee('0x33')]['sort']);_0x168d1b[_0x97ee('0x3c')]=qs[_0x97ee('0x35')](_['pick'](_0xc9270[_0x97ee('0x33')],_0x3f5da6[_0x97ee('0x35')]),_0x290700);if(_0xc9270[_0x97ee('0x33')][_0x97ee('0x3d')]){_0x168d1b['where']=_[_0x97ee('0x3e')](_0x168d1b[_0x97ee('0x3c')],{'$or':_[_0x97ee('0x2d')](_0x290700,function(_0x3a7f1a){if(_0x3a7f1a[_0x97ee('0x30')]!=='VIRTUAL'){var _0xf25710={};_0xf25710[_0x3a7f1a['name']]={'$like':'%'+_0xc9270[_0x97ee('0x33')][_0x97ee('0x3d')]+'%'};return _0xf25710;}})});}_0x168d1b=_[_0x97ee('0x3e')]({},_0x168d1b,_0xc9270[_0x97ee('0x3f')]);var _0x2351dc={'where':_0x168d1b[_0x97ee('0x3c')]};return db['ChatInternalMessage'][_0x97ee('0x21')](_0x2351dc)['then'](function(_0x4df13a){_0x406255[_0x97ee('0x21')]=_0x4df13a;if(_0xc9270[_0x97ee('0x33')][_0x97ee('0x40')]){_0x168d1b['include']=[{'all':!![]}];}return db[_0x97ee('0x41')]['findAll'](_0x168d1b);})[_0x97ee('0x26')](function(_0x1aa460){_0x406255[_0x97ee('0x42')]=_0x1aa460;return _0x406255;})['then'](respondWithFilteredResult(_0x57d569,_0x168d1b))[_0x97ee('0x43')](handleError(_0x57d569,null));};exports[_0x97ee('0x44')]=function(_0x582e0b,_0x2e29e6){var _0x758b66={'raw':!![],'where':{'id':_0x582e0b[_0x97ee('0x45')]['id']}},_0x264edb={};_0x264edb[_0x97ee('0x32')]=_['keys'](db[_0x97ee('0x41')]['rawAttributes']);_0x264edb[_0x97ee('0x33')]=_[_0x97ee('0x34')](_0x582e0b['query']);_0x264edb[_0x97ee('0x35')]=_[_0x97ee('0x36')](_0x264edb[_0x97ee('0x32')],_0x264edb[_0x97ee('0x33')]);_0x758b66[_0x97ee('0x37')]=_['intersection'](_0x264edb[_0x97ee('0x32')],qs['fields'](_0x582e0b['query'][_0x97ee('0x38')]));_0x758b66[_0x97ee('0x37')]=_0x758b66[_0x97ee('0x37')][_0x97ee('0x39')]?_0x758b66['attributes']:_0x264edb[_0x97ee('0x32')];if(_0x582e0b['query']['includeAll']){_0x758b66['include']=[{'all':!![]}];}_0x758b66=_[_0x97ee('0x3e')]({},_0x758b66,_0x582e0b[_0x97ee('0x3f')]);return db[_0x97ee('0x41')]['find'](_0x758b66)[_0x97ee('0x26')](handleEntityNotFound(_0x2e29e6,null))[_0x97ee('0x26')](respondWithResult(_0x2e29e6,null))[_0x97ee('0x43')](handleError(_0x2e29e6,null));};exports[_0x97ee('0x46')]=function(_0x3ed365,_0x3d6d08){return db[_0x97ee('0x41')][_0x97ee('0x46')](_0x3ed365[_0x97ee('0x47')],{})['then'](respondWithResult(_0x3d6d08,0xc9))[_0x97ee('0x43')](handleError(_0x3d6d08,null));};exports['update']=function(_0x2ea009,_0x5493da){if(_0x2ea009[_0x97ee('0x47')]['id']){delete _0x2ea009[_0x97ee('0x47')]['id'];}return db[_0x97ee('0x41')][_0x97ee('0x48')]({'where':{'id':_0x2ea009[_0x97ee('0x45')]['id']}})[_0x97ee('0x26')](handleEntityNotFound(_0x5493da,null))[_0x97ee('0x26')](saveUpdates(_0x2ea009[_0x97ee('0x47')],null))[_0x97ee('0x26')](respondWithResult(_0x5493da,null))['catch'](handleError(_0x5493da,null));};exports[_0x97ee('0x49')]=function(_0x4503b7,_0x3c292a){return db[_0x97ee('0x41')][_0x97ee('0x48')]({'where':{'id':_0x4503b7[_0x97ee('0x45')]['id']}})[_0x97ee('0x26')](handleEntityNotFound(_0x3c292a,null))[_0x97ee('0x26')](removeEntity(_0x3c292a,null))[_0x97ee('0x43')](handleError(_0x3c292a,null));};exports[_0x97ee('0x4a')]=function(_0x7def1d,_0x5ba070){return db[_0x97ee('0x41')][_0x97ee('0x4a')]()[_0x97ee('0x26')](respondWithResult(_0x5ba070,null))['catch'](handleError(_0x5ba070,null));};function wrapUser(_0x2b477c){return function(_0x4d1664){var _0x26a562=_0x2b477c['get']({'plain':!![]});_0x26a562[_0x97ee('0x4b')]=[];if(_0x4d1664){_0x26a562[_0x97ee('0x4c')]=_0x4d1664['createdAt'];_0x26a562[_0x97ee('0x4d')]=_0x4d1664;}else{_0x26a562[_0x97ee('0x4c')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x26a562[_0x97ee('0x4d')]={};}return _0x26a562;};}exports[_0x97ee('0x4e')]=function(_0x1ac72b,_0x2779ac,_0x10b0d8){var _0x4bbef3=[];return db[_0x97ee('0x4f')][_0x97ee('0x50')]({'where':{'role':['agent',_0x97ee('0x51'),_0x97ee('0x52')]},'attributes':['id',_0x97ee('0x53'),_0x97ee('0x2a'),_0x97ee('0x54'),_0x97ee('0x55'),_0x97ee('0x56'),'online',_0x97ee('0x57'),'allowmessenger','showWebBar'],'order':qs[_0x97ee('0x58')]('-online'),'include':[{'model':db[_0x97ee('0x59')],'as':'VoiceQueues','attributes':['id',_0x97ee('0x2a'),_0x97ee('0x30')],'through':{'attributes':[]}}]})['then'](function(_0xc9a0df){if(_0xc9a0df){var _0x14438d=_0x1ac72b['user'][_0x97ee('0x5a')]({'plain':!![]});if(!_0x14438d)throw new Error(_0x97ee('0x5b'));if(_0x14438d['role']===_0x97ee('0x52')){return db[_0x97ee('0x5c')][_0x97ee('0x48')]({'where':{'name':_0x97ee('0x5d'),'userProfileId':_0x14438d[_0x97ee('0x5e')]},'raw':!![]})['then'](function(_0x445e63){if(_0x445e63){if(_0x445e63['autoAssociation']===0x0){return db[_0x97ee('0x5f')][_0x97ee('0x50')]({'where':{'sectionId':_0x445e63['id']},'raw':!![]})[_0x97ee('0x26')](function(_0x995a93){var _0x5374d6=[];if(_[_0x97ee('0x60')](_0x995a93)){_0x5374d6=_[_0x97ee('0x3d')](_0xc9a0df,function(_0x19e0d6){if(_0x19e0d6[_0x97ee('0x54')]!==_0x97ee('0x61')){return _0x19e0d6;}});return _0x5374d6;}else{for(var _0x395c7e=0x0;_0x395c7e<_0xc9a0df[_0x97ee('0x39')];_0x395c7e++){var _0x46a251=_0xc9a0df[_0x395c7e];if(_0x46a251[_0x97ee('0x54')]===_0x97ee('0x61')){var _0xc4c18f=_['find'](_0x995a93,function(_0x2feda8){return _0x2feda8[_0x97ee('0x62')]===_0x46a251['id'];});if(_0xc4c18f)_0x5374d6[_0x97ee('0x63')](_0x46a251);}else{_0x5374d6[_0x97ee('0x63')](_0x46a251);}}return _0x5374d6;}});}else{return _0xc9a0df;}}else{var _0x58988d=_['filter'](_0xc9a0df,function(_0x5d7282){if(_0x5d7282[_0x97ee('0x54')]!==_0x97ee('0x61')){return _0x5d7282;}});return _0x58988d;}});}else{return _0xc9a0df;}}})[_0x97ee('0x26')](function(_0x31944c){var _0x2a1e13=[];if(_0x31944c){_0x4bbef3=_0x31944c;for(var _0x380fa6=0x0;_0x380fa6<_0x31944c[_0x97ee('0x39')];_0x380fa6+=0x1){_0x4bbef3[_0x380fa6][_0x97ee('0x4b')]=[];_0x2a1e13[_0x97ee('0x63')](db[_0x97ee('0x41')][_0x97ee('0x48')]({'where':{'FromId':[_0x1ac72b[_0x97ee('0x52')]['id'],_0x31944c[_0x380fa6]['id']],'ToId':[_0x1ac72b[_0x97ee('0x52')]['id'],_0x31944c[_0x380fa6]['id']],'ChatGroupId':null},'attributes':['id',_0x97ee('0x64'),_0x97ee('0x65'),_0x97ee('0x66'),_0x97ee('0x67'),_0x97ee('0x47')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x31944c[_0x380fa6])));}return BPromise['all'](_0x2a1e13);}return[];})[_0x97ee('0x26')](function(_0x5a7a26){return{'rows':_0x5a7a26,'count':_0x5a7a26['length']};})[_0x97ee('0x26')](respondWithResult(_0x2779ac,null))[_0x97ee('0x43')](handleError(_0x2779ac,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 127644c..66d10c2 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 _0xdca3=['setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdca3,0x13d));var _0x3dca=function(_0x72c000,_0x415424){_0x72c000=_0x72c000-0x0;var _0x382f17=_0xdca3[_0x72c000];return _0x382f17;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x3dca('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3dca('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3dca('0x2')};function emitEvent(_0x242242){return function(_0x248c22,_0x412297,_0x48ab04){ChatInternalMessageEvents[_0x3dca('0x3')](_0x242242+':'+_0x248c22['id'],_0x248c22);ChatInternalMessageEvents['emit'](_0x242242,_0x248c22);_0x48ab04(null);};}for(var e in events){if(events[_0x3dca('0x4')](e)){var event=events[e];ChatInternalMessage[_0x3dca('0x5')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x074c=['ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x5e43e2,_0x281609){var _0x50cf18=function(_0x37566f){while(--_0x37566f){_0x5e43e2['push'](_0x5e43e2['shift']());}};_0x50cf18(++_0x281609);}(_0x074c,0x1d7));var _0xc074=function(_0x2387c5,_0xfcc74c){_0x2387c5=_0x2387c5-0x0;var _0x2c414c=_0x074c[_0x2387c5];return _0x2c414c;};'use strict';var EventEmitter=require(_0xc074('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xc074('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc074('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc074('0x3'),'afterDestroy':_0xc074('0x4')};function emitEvent(_0x207cf6){return function(_0x258bec,_0x336933,_0x24af89){ChatInternalMessageEvents[_0xc074('0x5')](_0x207cf6+':'+_0x258bec['id'],_0x258bec);ChatInternalMessageEvents[_0xc074('0x5')](_0x207cf6,_0x258bec);_0x24af89(null);};}for(var e in events){if(events[_0xc074('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xc074('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 227b0e0..83b33d5 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 _0xb29c=['exports','define','chat_internal_messages','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x5153e9,_0x1e5062){var _0x3a2a85=function(_0x2e7644){while(--_0x2e7644){_0x5153e9['push'](_0x5153e9['shift']());}};_0x3a2a85(++_0x1e5062);}(_0xb29c,0x197));var _0xcb29=function(_0xef3c80,_0x36164f){_0xef3c80=_0xef3c80-0x0;var _0x27f054=_0xb29c[_0xef3c80];return _0x27f054;};'use strict';var _=require(_0xcb29('0x0'));var util=require('util');var logger=require(_0xcb29('0x1'))(_0xcb29('0x2'));var moment=require(_0xcb29('0x3'));var BPromise=require('bluebird');var rp=require(_0xcb29('0x4'));var fs=require('fs');var path=require(_0xcb29('0x5'));var rimraf=require(_0xcb29('0x6'));var config=require(_0xcb29('0x7'));var attributes=require(_0xcb29('0x8'));module[_0xcb29('0x9')]=function(_0x42e472,_0x45f695){return _0x42e472[_0xcb29('0xa')]('ChatInternalMessage',attributes,{'tableName':_0xcb29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb29('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1517=['exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x1517,0x7d));var _0x7151=function(_0x197954,_0x3f61d0){_0x197954=_0x197954-0x0;var _0x231d54=_0x1517[_0x197954];return _0x231d54;};'use strict';var _=require(_0x7151('0x0'));var util=require(_0x7151('0x1'));var logger=require(_0x7151('0x2'))(_0x7151('0x3'));var moment=require(_0x7151('0x4'));var BPromise=require('bluebird');var rp=require(_0x7151('0x5'));var fs=require('fs');var path=require(_0x7151('0x6'));var rimraf=require(_0x7151('0x7'));var config=require(_0x7151('0x8'));var attributes=require(_0x7151('0x9'));module[_0x7151('0xa')]=function(_0x2493da,_0x1d4194){return _0x2493da['define'](_0x7151('0xb'),attributes,{'tableName':_0x7151('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7151('0xd'),'collate':_0x7151('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 8ec0a77..9c313f9 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 _0x4502=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','debug'];(function(_0xcf6231,_0x23ab9f){var _0x3d3e43=function(_0x320499){while(--_0x320499){_0xcf6231['push'](_0xcf6231['shift']());}};_0x3d3e43(++_0x23ab9f);}(_0x4502,0x157));var _0x2450=function(_0x64a23d,_0x574253){_0x64a23d=_0x64a23d-0x0;var _0x499ac0=_0x4502[_0x64a23d];return _0x499ac0;};'use strict';var _=require(_0x2450('0x0'));var util=require('util');var moment=require(_0x2450('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2450('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2450('0x3'));var logger=require(_0x2450('0x4'))(_0x2450('0x5'));var config=require(_0x2450('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2450('0x7')]=_[_0x2450('0x8')](config['redis'],{'host':_0x2450('0x9'),'port':0x18eb});var socket=require(_0x2450('0xa'))(new Redis(config[_0x2450('0x7')]));require(_0x2450('0xb'))[_0x2450('0xc')](socket);function respondWithRpcPromise(_0x132cb,_0x4eef76,_0x8d3da0){return new BPromise(function(_0x12da53,_0x5df599){return client['request'](_0x132cb,_0x8d3da0)[_0x2450('0xd')](function(_0x1a6bcb){logger[_0x2450('0xe')](_0x2450('0xf'),_0x4eef76,'request\x20sent');logger[_0x2450('0x10')](_0x2450('0x11'),_0x4eef76,_0x2450('0x12'),JSON[_0x2450('0x13')](_0x1a6bcb));if(_0x1a6bcb[_0x2450('0x14')]){if(_0x1a6bcb[_0x2450('0x14')][_0x2450('0x15')]===0x1f4){logger[_0x2450('0x14')](_0x2450('0xf'),_0x4eef76,_0x1a6bcb[_0x2450('0x14')][_0x2450('0x16')]);return _0x5df599(_0x1a6bcb[_0x2450('0x14')]['message']);}logger[_0x2450('0x14')](_0x2450('0xf'),_0x4eef76,_0x1a6bcb[_0x2450('0x14')]['message']);return _0x12da53(_0x1a6bcb['error'][_0x2450('0x16')]);}else{logger[_0x2450('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x4eef76,_0x2450('0x12'));_0x12da53(_0x1a6bcb['result'][_0x2450('0x16')]);}})[_0x2450('0x17')](function(_0x48b2e5){logger[_0x2450('0x14')](_0x2450('0xf'),_0x4eef76,_0x48b2e5);_0x5df599(_0x48b2e5);});});} \ No newline at end of file +var _0x7488=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a649a,_0x1050f9){var _0x42b360=function(_0x40faaf){while(--_0x40faaf){_0x4a649a['push'](_0x4a649a['shift']());}};_0x42b360(++_0x1050f9);}(_0x7488,0x19a));var _0x8748=function(_0x3cfc7a,_0x3d24a5){_0x3cfc7a=_0x3cfc7a-0x0;var _0x1f623c=_0x7488[_0x3cfc7a];return _0x1f623c;};'use strict';var _=require(_0x8748('0x0'));var util=require(_0x8748('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8748('0x2'));var fs=require('fs');var Redis=require(_0x8748('0x3'));var db=require(_0x8748('0x4'))['db'];var utils=require(_0x8748('0x5'));var logger=require('../../config/logger')(_0x8748('0x6'));var config=require(_0x8748('0x7'));var jayson=require(_0x8748('0x8'));var client=jayson[_0x8748('0x9')][_0x8748('0xa')]({'port':0x232a});config['redis']=_[_0x8748('0xb')](config[_0x8748('0xc')],{'host':_0x8748('0xd'),'port':0x18eb});var socket=require(_0x8748('0xe'))(new Redis(config[_0x8748('0xc')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x907b6c,_0x2906fc,_0x348fff){return new BPromise(function(_0x34fb60,_0x42013b){return client[_0x8748('0xf')](_0x907b6c,_0x348fff)['then'](function(_0x21fcd8){logger['info'](_0x8748('0x10'),_0x2906fc,_0x8748('0x11'));logger[_0x8748('0x12')](_0x8748('0x13'),_0x2906fc,_0x8748('0x11'),JSON[_0x8748('0x14')](_0x21fcd8));if(_0x21fcd8[_0x8748('0x15')]){if(_0x21fcd8[_0x8748('0x15')][_0x8748('0x16')]===0x1f4){logger[_0x8748('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2906fc,_0x21fcd8['error']['message']);return _0x42013b(_0x21fcd8[_0x8748('0x15')][_0x8748('0x17')]);}logger[_0x8748('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2906fc,_0x21fcd8[_0x8748('0x15')][_0x8748('0x17')]);return _0x34fb60(_0x21fcd8[_0x8748('0x15')][_0x8748('0x17')]);}else{logger[_0x8748('0x18')](_0x8748('0x10'),_0x2906fc,_0x8748('0x11'));_0x34fb60(_0x21fcd8[_0x8748('0x19')][_0x8748('0x17')]);}})['catch'](function(_0x22b6bb){logger[_0x8748('0x15')](_0x8748('0x10'),_0x2906fc,_0x22b6bb);_0x42013b(_0x22b6bb);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f797a04..6683add 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 _0xcef3=['save','remove','update','removeListener','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcef3,0x125));var _0x3cef=function(_0x149013,_0x268258){_0x149013=_0x149013-0x0;var _0x502195=_0xcef3[_0x149013];return _0x502195;};'use strict';var ChatInternalMessageEvents=require(_0x3cef('0x0'));var events=[_0x3cef('0x1'),_0x3cef('0x2'),_0x3cef('0x3')];function createListener(_0x5363ac,_0x54ae1d){return function(_0x48bbe5){_0x54ae1d['emit'](_0x5363ac,_0x48bbe5);};}function removeListener(_0x59c6dc,_0x4bc044){return function(){ChatInternalMessageEvents[_0x3cef('0x4')](_0x59c6dc,_0x4bc044);};}exports['register']=function(_0x49e6e5){for(var _0x5d788c=0x0,_0x3f7a28=events[_0x3cef('0x5')];_0x5d788c<_0x3f7a28;_0x5d788c++){var _0x32c2f2=events[_0x5d788c];var _0xbaa1af=createListener(_0x3cef('0x6')+_0x32c2f2,_0x49e6e5);ChatInternalMessageEvents['on'](_0x32c2f2,_0xbaa1af);}}; \ No newline at end of file +var _0xc450=['removeListener','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc450,0x103));var _0x0c45=function(_0x5a59cc,_0x57090f){_0x5a59cc=_0x5a59cc-0x0;var _0x31a246=_0xc450[_0x5a59cc];return _0x31a246;};'use strict';var ChatInternalMessageEvents=require(_0x0c45('0x0'));var events=['save','remove','update'];function createListener(_0x54ca45,_0x5b61d0){return function(_0x24ae48){_0x5b61d0['emit'](_0x54ca45,_0x24ae48);};}function removeListener(_0x4b08a7,_0x49b33b){return function(){ChatInternalMessageEvents[_0x0c45('0x1')](_0x4b08a7,_0x49b33b);};}exports['register']=function(_0x4b48f0){for(var _0x2d215b=0x0,_0xdd0469=events[_0x0c45('0x2')];_0x2d215b<_0xdd0469;_0x2d215b++){var _0x22f9c8=events[_0x2d215b];var _0x24620d=createListener(_0x0c45('0x3')+_0x22f9c8,_0x4b48f0);ChatInternalMessageEvents['on'](_0x22f9c8,_0x24620d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 38925ca..1eeba09 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 _0x9422=['./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users','getUsers','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x24bae3,_0x52ebb4){var _0x1872d2=function(_0xacccda){while(--_0xacccda){_0x24bae3['push'](_0x24bae3['shift']());}};_0x1872d2(++_0x52ebb4);}(_0x9422,0x151));var _0x2942=function(_0xdc3a32,_0x383166){_0xdc3a32=_0xdc3a32-0x0;var _0x370e71=_0x9422[_0xdc3a32];return _0x370e71;};'use strict';var multer=require(_0x2942('0x0'));var util=require(_0x2942('0x1'));var path=require('path');var timeout=require(_0x2942('0x2'));var express=require('express');var router=express[_0x2942('0x3')]();var fs_extra=require(_0x2942('0x4'));var auth=require(_0x2942('0x5'));var interaction=require(_0x2942('0x6'));var config=require(_0x2942('0x7'));var controller=require(_0x2942('0x8'));router[_0x2942('0x9')]('/',auth['isAuthenticated'](),controller[_0x2942('0xa')]);router[_0x2942('0x9')](_0x2942('0xb'),auth[_0x2942('0xc')](),controller[_0x2942('0xd')]);router[_0x2942('0x9')](_0x2942('0xe'),auth[_0x2942('0xc')](),controller[_0x2942('0xf')]);router[_0x2942('0x9')](_0x2942('0x10'),auth[_0x2942('0xc')](),controller[_0x2942('0x11')]);router['post']('/',auth[_0x2942('0xc')](),controller[_0x2942('0x12')]);router['put'](_0x2942('0x10'),controller[_0x2942('0x13')]);router[_0x2942('0x14')](_0x2942('0x10'),auth[_0x2942('0xc')](),controller[_0x2942('0x15')]);module[_0x2942('0x16')]=router; \ No newline at end of file +var _0x43df=['index','/describe','describe','/users','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x1752c4,_0xc5d1dc){var _0x5cdb63=function(_0x45ff5d){while(--_0x45ff5d){_0x1752c4['push'](_0x1752c4['shift']());}};_0x5cdb63(++_0xc5d1dc);}(_0x43df,0x14d));var _0xf43d=function(_0x305d99,_0x30e499){_0x305d99=_0x305d99-0x0;var _0x1163cf=_0x43df[_0x305d99];return _0x1163cf;};'use strict';var multer=require(_0xf43d('0x0'));var util=require(_0xf43d('0x1'));var path=require('path');var timeout=require(_0xf43d('0x2'));var express=require(_0xf43d('0x3'));var router=express[_0xf43d('0x4')]();var fs_extra=require(_0xf43d('0x5'));var auth=require(_0xf43d('0x6'));var interaction=require(_0xf43d('0x7'));var config=require(_0xf43d('0x8'));var controller=require(_0xf43d('0x9'));router[_0xf43d('0xa')]('/',auth[_0xf43d('0xb')](),controller[_0xf43d('0xc')]);router['get'](_0xf43d('0xd'),auth[_0xf43d('0xb')](),controller[_0xf43d('0xe')]);router[_0xf43d('0xa')](_0xf43d('0xf'),auth[_0xf43d('0xb')](),controller['getUsers']);router[_0xf43d('0xa')](_0xf43d('0x10'),auth['isAuthenticated'](),controller[_0xf43d('0x11')]);router[_0xf43d('0x12')]('/',auth['isAuthenticated'](),controller[_0xf43d('0x13')]);router[_0xf43d('0x14')](_0xf43d('0x10'),controller['update']);router[_0xf43d('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf43d('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 27d17d1..5ddc9c0 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 _0x93e6=['BOOLEAN','out','DATE','TEXT','sequelize','medium'];(function(_0x12236d,_0x25d8b0){var _0x19b8f5=function(_0x17f3a7){while(--_0x17f3a7){_0x12236d['push'](_0x12236d['shift']());}};_0x19b8f5(++_0x25d8b0);}(_0x93e6,0x11e));var _0x693e=function(_0x1057cb,_0x7b8162){_0x1057cb=_0x1057cb-0x0;var _0x7fbf7e=_0x93e6[_0x1057cb];return _0x7fbf7e;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x693e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x693e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x693e('0x3')),'defaultValue':_0x693e('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x693e('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x693e('0x5')]}}; \ No newline at end of file +var _0x566f=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x382a59,_0x36357b){var _0x212183=function(_0xd52674){while(--_0xd52674){_0x382a59['push'](_0x382a59['shift']());}};_0x212183(++_0x36357b);}(_0x566f,0x124));var _0xf566=function(_0x29de5d,_0x6d02f0){_0x29de5d=_0x29de5d-0x0;var _0x2c1b77=_0x566f[_0x29de5d];return _0x2c1b77;};'use strict';var Sequelize=require(_0xf566('0x0'));module[_0xf566('0x1')]={'body':{'type':Sequelize[_0xf566('0x2')](_0xf566('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf566('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf566('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf566('0x5')]('in',_0xf566('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xf566('0x7')]},'providerName':{'type':Sequelize[_0xf566('0x8')]},'providerResponse':{'type':Sequelize[_0xf566('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 9b68481..1ec7771 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 _0x6704=['keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ChatMessage','include','findAll','rows','params','length','find','create','body','update','destroy','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','rejectMessage','Sequelize','fullname','internal','interface','reject','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','save','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x2daf2a,_0x23acf0){var _0x50e844=function(_0x59bae2){while(--_0x59bae2){_0x2daf2a['push'](_0x2daf2a['shift']());}};_0x50e844(++_0x23acf0);}(_0x6704,0x1d8));var _0x4670=function(_0x5f5eb2,_0x3868f5){_0x5f5eb2=_0x5f5eb2-0x0;var _0x58df87=_0x6704[_0x5f5eb2];return _0x58df87;};'use strict';var emlformat=require(_0x4670('0x0'));var rimraf=require(_0x4670('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4670('0x2'));var rp=require(_0x4670('0x3'));var moment=require(_0x4670('0x4'));var BPromise=require(_0x4670('0x5'));var Mustache=require(_0x4670('0x6'));var util=require(_0x4670('0x7'));var path=require(_0x4670('0x8'));var sox=require(_0x4670('0x9'));var csv=require(_0x4670('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4670('0xb'));var _=require(_0x4670('0xc'));var squel=require('squel');var crypto=require(_0x4670('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4670('0xe'));var Papa=require(_0x4670('0xf'));var Redis=require(_0x4670('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4670('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4670('0x12'));var logger=require(_0x4670('0x13'))(_0x4670('0x14'));var utils=require('../../config/utils');var config=require(_0x4670('0x15'));var licenseUtil=require(_0x4670('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4670('0x17')](config[_0x4670('0x18')],{'host':_0x4670('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4670('0x18')]));require(_0x4670('0x1a'))[_0x4670('0x1b')](socket);var jayson=require(_0x4670('0x1c'));var client=jayson[_0x4670('0x1d')][_0x4670('0x1e')]({'port':0x232c});var client9002=jayson[_0x4670('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5567f4,_0x2243ab,_0x44688c,_0xd161bb){return new BPromise(function(_0x5db35d,_0x528060){var _0xf32b59=_0xd161bb||client;return _0xf32b59[_0x4670('0x1f')](_0x5567f4,_0x44688c)[_0x4670('0x20')](function(_0x5a9ff7){logger['info']('ChatMessage,\x20%s,\x20%s',_0x2243ab,_0x4670('0x21'));logger[_0x4670('0x22')](_0x4670('0x23'),_0x2243ab,_0x4670('0x21'),JSON[_0x4670('0x24')](_0x5a9ff7));if(_0x5a9ff7['error']){if(_0x5a9ff7[_0x4670('0x25')]['code']===0x1f4){logger[_0x4670('0x25')](_0x4670('0x26'),_0x2243ab,_0x5a9ff7[_0x4670('0x25')][_0x4670('0x27')]);return _0x528060(_0x5a9ff7[_0x4670('0x25')][_0x4670('0x27')]);}logger[_0x4670('0x25')](_0x4670('0x26'),_0x2243ab,_0x5a9ff7[_0x4670('0x25')][_0x4670('0x27')]);return _0x5db35d(_0x5a9ff7[_0x4670('0x25')]['message']);}else{logger[_0x4670('0x28')](_0x4670('0x26'),_0x2243ab,_0x4670('0x21'));_0x5db35d(_0x5a9ff7[_0x4670('0x29')][_0x4670('0x27')]);}})[_0x4670('0x2a')](function(_0x2853f7){logger['error'](_0x4670('0x26'),_0x2243ab,_0x2853f7);_0x528060(_0x2853f7);});});}function respondWithStatusCode(_0x4a4bda,_0x218ec3){_0x218ec3=_0x218ec3||0xcc;return function(_0x14bff7){if(_0x14bff7){return _0x4a4bda[_0x4670('0x2b')](_0x218ec3);}return _0x4a4bda[_0x4670('0x2c')](_0x218ec3)['end']();};}function respondWithResult(_0x348ab2,_0xc1a112){_0xc1a112=_0xc1a112||0xc8;return function(_0x431a0b){if(_0x431a0b){return _0x348ab2[_0x4670('0x2c')](_0xc1a112)['json'](_0x431a0b);}};}function respondWithFilteredResult(_0x1cd376,_0x57b69f){return function(_0x1d0c98){if(_0x1d0c98){var _0x45f85b=typeof _0x57b69f[_0x4670('0x2d')]==='undefined'&&typeof _0x57b69f[_0x4670('0x2e')]==='undefined';var _0xcc4bda=_0x1d0c98['count'];var _0x2db437=_0x45f85b?0x0:_0x57b69f[_0x4670('0x2d')];var _0x41a2b1=_0x45f85b?_0x1d0c98[_0x4670('0x2f')]:_0x57b69f['offset']+_0x57b69f[_0x4670('0x2e')];var _0x33daad;if(_0x41a2b1>=_0xcc4bda){_0x41a2b1=_0xcc4bda;_0x33daad=0xc8;}else{_0x33daad=0xce;}_0x1cd376[_0x4670('0x2c')](_0x33daad);return _0x1cd376[_0x4670('0x30')](_0x4670('0x31'),_0x2db437+'-'+_0x41a2b1+'/'+_0xcc4bda)[_0x4670('0x32')](_0x1d0c98);}return null;};}function patchUpdates(_0x24514f){return function(_0xed1e71){try{jsonpatch[_0x4670('0x33')](_0xed1e71,_0x24514f,!![]);}catch(_0x16ceac){return BPromise['reject'](_0x16ceac);}return _0xed1e71[_0x4670('0x34')]();};}function saveUpdates(_0x1e7f61,_0x3fc1a5){return function(_0x560a5d){if(_0x560a5d){return _0x560a5d['update'](_0x1e7f61)['then'](function(_0x3ca583){return _0x3ca583;});}return null;};}function removeEntity(_0x17a9d5,_0x12343b){return function(_0x478d85){if(_0x478d85){return _0x478d85['destroy']()[_0x4670('0x20')](function(){_0x17a9d5[_0x4670('0x2c')](0xcc)[_0x4670('0x35')]();});}};}function handleEntityNotFound(_0x3c0118,_0x170ef3){return function(_0x35703c){if(!_0x35703c){_0x3c0118[_0x4670('0x2b')](0x194);}return _0x35703c;};}function handleError(_0x328198,_0x1e1481){_0x1e1481=_0x1e1481||0x1f4;return function(_0x3a95fc){logger[_0x4670('0x25')](_0x3a95fc[_0x4670('0x36')]);if(_0x3a95fc['name']){delete _0x3a95fc[_0x4670('0x37')];}_0x328198[_0x4670('0x2c')](_0x1e1481)['send'](_0x3a95fc);};}exports[_0x4670('0x38')]=function(_0x1e1ca8,_0x10cd3d){var _0x56b51b={},_0x5f330f={},_0x129346={'count':0x0,'rows':[]};var _0x7f0567=_[_0x4670('0x39')](db['ChatMessage'][_0x4670('0x3a')],function(_0x3d2667){return{'name':_0x3d2667[_0x4670('0x3b')],'type':_0x3d2667[_0x4670('0x3c')][_0x4670('0x3d')]};});_0x5f330f[_0x4670('0x3e')]=_[_0x4670('0x39')](_0x7f0567,_0x4670('0x37'));_0x5f330f[_0x4670('0x3f')]=_[_0x4670('0x40')](_0x1e1ca8[_0x4670('0x3f')]);_0x5f330f[_0x4670('0x41')]=_['intersection'](_0x5f330f[_0x4670('0x3e')],_0x5f330f[_0x4670('0x3f')]);_0x56b51b[_0x4670('0x42')]=_[_0x4670('0x43')](_0x5f330f[_0x4670('0x3e')],qs[_0x4670('0x44')](_0x1e1ca8['query'][_0x4670('0x44')]));_0x56b51b[_0x4670('0x42')]=_0x56b51b[_0x4670('0x42')]['length']?_0x56b51b[_0x4670('0x42')]:_0x5f330f['model'];if(!_0x1e1ca8[_0x4670('0x3f')][_0x4670('0x45')](_0x4670('0x46'))){_0x56b51b['limit']=qs['limit'](_0x1e1ca8['query'][_0x4670('0x2e')]);_0x56b51b[_0x4670('0x2d')]=qs[_0x4670('0x2d')](_0x1e1ca8[_0x4670('0x3f')][_0x4670('0x2d')]);}_0x56b51b[_0x4670('0x47')]=qs[_0x4670('0x48')](_0x1e1ca8[_0x4670('0x3f')][_0x4670('0x48')]);_0x56b51b[_0x4670('0x49')]=qs[_0x4670('0x41')](_[_0x4670('0x4a')](_0x1e1ca8[_0x4670('0x3f')],_0x5f330f[_0x4670('0x41')]),_0x7f0567);if(_0x1e1ca8[_0x4670('0x3f')][_0x4670('0x4b')]){_0x56b51b['where']=_[_0x4670('0x4c')](_0x56b51b['where'],{'$or':_[_0x4670('0x39')](_0x7f0567,function(_0x954e05){if(_0x954e05[_0x4670('0x3c')]!=='VIRTUAL'){var _0x301a7d={};_0x301a7d[_0x954e05[_0x4670('0x37')]]={'$like':'%'+_0x1e1ca8['query'][_0x4670('0x4b')]+'%'};return _0x301a7d;}})});}_0x56b51b=_[_0x4670('0x4c')]({},_0x56b51b,_0x1e1ca8[_0x4670('0x4d')]);var _0x2c194b={'where':_0x56b51b[_0x4670('0x49')]};return db[_0x4670('0x4e')][_0x4670('0x2f')](_0x2c194b)[_0x4670('0x20')](function(_0xe80f29){_0x129346[_0x4670('0x2f')]=_0xe80f29;if(_0x1e1ca8[_0x4670('0x3f')]['includeAll']){_0x56b51b[_0x4670('0x4f')]=[{'all':!![]}];}return db[_0x4670('0x4e')][_0x4670('0x50')](_0x56b51b);})[_0x4670('0x20')](function(_0x10eac8){_0x129346[_0x4670('0x51')]=_0x10eac8;return _0x129346;})[_0x4670('0x20')](respondWithFilteredResult(_0x10cd3d,_0x56b51b))['catch'](handleError(_0x10cd3d,null));};exports['show']=function(_0x17f40b,_0x395f98){var _0x4eaa8d={'raw':!![],'where':{'id':_0x17f40b[_0x4670('0x52')]['id']}},_0x1488cd={};_0x1488cd[_0x4670('0x3e')]=_[_0x4670('0x40')](db[_0x4670('0x4e')][_0x4670('0x3a')]);_0x1488cd[_0x4670('0x3f')]=_[_0x4670('0x40')](_0x17f40b['query']);_0x1488cd[_0x4670('0x41')]=_[_0x4670('0x43')](_0x1488cd['model'],_0x1488cd[_0x4670('0x3f')]);_0x4eaa8d['attributes']=_[_0x4670('0x43')](_0x1488cd['model'],qs[_0x4670('0x44')](_0x17f40b[_0x4670('0x3f')][_0x4670('0x44')]));_0x4eaa8d[_0x4670('0x42')]=_0x4eaa8d[_0x4670('0x42')][_0x4670('0x53')]?_0x4eaa8d[_0x4670('0x42')]:_0x1488cd['model'];if(_0x17f40b[_0x4670('0x3f')]['includeAll']){_0x4eaa8d[_0x4670('0x4f')]=[{'all':!![]}];}_0x4eaa8d=_[_0x4670('0x4c')]({},_0x4eaa8d,_0x17f40b[_0x4670('0x4d')]);return db[_0x4670('0x4e')][_0x4670('0x54')](_0x4eaa8d)[_0x4670('0x20')](handleEntityNotFound(_0x395f98,null))[_0x4670('0x20')](respondWithResult(_0x395f98,null))[_0x4670('0x2a')](handleError(_0x395f98,null));};exports[_0x4670('0x55')]=function(_0x4bd793,_0x23365e){return db['ChatMessage'][_0x4670('0x55')](_0x4bd793[_0x4670('0x56')],{})[_0x4670('0x20')](respondWithResult(_0x23365e,0xc9))[_0x4670('0x2a')](handleError(_0x23365e,null));};exports[_0x4670('0x57')]=function(_0xae5bff,_0x2bf7dd){if(_0xae5bff[_0x4670('0x56')]['id']){delete _0xae5bff[_0x4670('0x56')]['id'];}return db[_0x4670('0x4e')][_0x4670('0x54')]({'where':{'id':_0xae5bff[_0x4670('0x52')]['id']}})[_0x4670('0x20')](handleEntityNotFound(_0x2bf7dd,null))[_0x4670('0x20')](saveUpdates(_0xae5bff[_0x4670('0x56')],null))[_0x4670('0x20')](respondWithResult(_0x2bf7dd,null))[_0x4670('0x2a')](handleError(_0x2bf7dd,null));};exports[_0x4670('0x58')]=function(_0x942bcd,_0x311174){return db[_0x4670('0x4e')]['find']({'where':{'id':_0x942bcd[_0x4670('0x52')]['id']}})['then'](handleEntityNotFound(_0x311174,null))[_0x4670('0x20')](removeEntity(_0x311174,null))[_0x4670('0x2a')](handleError(_0x311174,null));};exports[_0x4670('0x59')]=function(_0x593871,_0x515d95){return db[_0x4670('0x4e')][_0x4670('0x59')]()[_0x4670('0x20')](respondWithResult(_0x515d95,null))[_0x4670('0x2a')](handleError(_0x515d95,null));};var interaction_log=require(_0x4670('0x13'))(_0x4670('0x5a'));exports[_0x4670('0x5b')]=function(_0x2d8db6,_0x3d940e,_0x33b150){var _0x342196={'agent':{},'channel':_0x4670('0x5c')};if(_0x2d8db6[_0x4670('0x56')]['id']){delete _0x2d8db6['body']['id'];}_0x2d8db6[_0x4670('0x56')][_0x4670('0x5d')]=!![];_0x2d8db6['body'][_0x4670('0x5e')]=moment()[_0x4670('0x5f')](_0x4670('0x60'));_0x2d8db6[_0x4670('0x56')]['UserId']=_0x2d8db6['body'][_0x4670('0x61')]||_0x2d8db6['user']['id'];_0x342196[_0x4670('0x62')]['id']=_0x2d8db6[_0x4670('0x56')][_0x4670('0x61')];return db[_0x4670('0x4e')][_0x4670('0x54')]({'where':{'id':_0x2d8db6['params']['id'],'UserId':null}})[_0x4670('0x20')](handleEntityNotFound(_0x3d940e,null))[_0x4670('0x20')](saveUpdates(_0x2d8db6[_0x4670('0x56')],null))[_0x4670('0x20')](function(_0x17c0d3){if(_0x17c0d3){_0x342196[_0x4670('0x27')]=_0x17c0d3[_0x4670('0x63')]({'plain':!![]});return db[_0x4670('0x64')][_0x4670('0x54')]({'where':{'id':_0x17c0d3[_0x4670('0x65')]}});}return null;})[_0x4670('0x20')](handleEntityNotFound(_0x3d940e,null))[_0x4670('0x20')](function(_0x19429a){if(_0x19429a){return _0x19429a[_0x4670('0x57')]({'UserId':_0x2d8db6['body'][_0x4670('0x61')],'read1stAt':_['isNil'](_0x19429a['read1stAt'])?moment()[_0x4670('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x37ac5a){if(_0x37ac5a){_0x342196['interaction']=_0x37ac5a['get']({'plain':!![]});interaction_log[_0x4670('0x28')](_0x4670('0x66'),_0x2d8db6['user']['id'],_0x2d8db6[_0x4670('0x67')][_0x4670('0x37')],_0x2d8db6[_0x4670('0x67')][_0x4670('0x68')],_0x342196['interaction']['id'],_0x2d8db6[_0x4670('0x56')]?JSON['stringify'](_0x2d8db6[_0x4670('0x56')]):_0x4670('0x69'));return respondWithRpcPromise(_0x4670('0x6a'),_0x4670('0x6b'),_0x342196);}return null;})[_0x4670('0x20')](function(_0x21c010){var _0x1dbb08=_0x4670('0x6c')+_0x21c010['message'][_0x4670('0x6d')];return db[_0x4670('0x6e')]['query'](_0x1dbb08,{'type':db['Sequelize'][_0x4670('0x6f')][_0x4670('0x70')],'raw':!![]})[_0x4670('0x20')](function(_0xfc885f){return _0xfc885f;});})['then'](function(_0x60c0e){if(_0x60c0e){_0x342196['message'][_0x4670('0x71')]=_0x60c0e[0x0];if(!_0x2d8db6['body'][_0x4670('0x61')])return;return db[_0x4670('0x72')][_0x4670('0x54')]({'where':{'id':_0x2d8db6['body'][_0x4670('0x61')],'role':_0x4670('0x62')},'attributes':['id','name','fullname',_0x4670('0x73'),'internal'],'raw':!![]});}return null;})[_0x4670('0x20')](function(_0x43d449){if(!_0x43d449)return null;_0x342196[_0x4670('0x27')][_0x4670('0x62')]=_0x43d449;return _0x342196;})['then'](function(_0x42300c){if(_0x42300c){if(_0x2d8db6[_0x4670('0x56')][_0x4670('0x74')]){_0x342196[_0x4670('0x27')]['interface']=util[_0x4670('0x5f')](_0x4670('0x75'),_0x2d8db6[_0x4670('0x67')]['name']);_0x342196['message'][_0x4670('0x76')]=_0x342196[_0x4670('0x76')];_0x342196[_0x4670('0x27')][_0x4670('0x77')]=_0x342196[_0x4670('0x76')];_0x342196[_0x4670('0x27')][_0x4670('0x78')]=_0x4670('0x5b');return respondWithRpcPromise(_0x4670('0x79'),'EventManager',{'event':_0x4670('0x7a'),'message':_[_0x4670('0x4c')](_0x342196[_0x4670('0x27')],JSON[_0x4670('0x7b')](_0x342196['interaction'][_0x4670('0x7c')]))},client9002)[_0x4670('0x20')](function(){return _0x342196;});}return _0x342196;}return null;})[_0x4670('0x20')](respondWithResult(_0x3d940e,null))[_0x4670('0x2a')](handleError(_0x3d940e,null));};var interaction_log=require(_0x4670('0x13'))(_0x4670('0x5a'));exports['reject']=function(_0x40b67c,_0xcd12f6,_0x55112e){var _0x5da326={'agent':{},'channel':'chat'};if(_0x40b67c[_0x4670('0x56')]['id']){delete _0x40b67c[_0x4670('0x56')]['id'];}_0x40b67c[_0x4670('0x56')][_0x4670('0x61')]=_0x40b67c[_0x4670('0x56')]['UserId']||_0x40b67c[_0x4670('0x67')]['id'];_0x5da326[_0x4670('0x62')]['id']=_0x40b67c[_0x4670('0x56')][_0x4670('0x61')];return db['ChatMessage'][_0x4670('0x54')]({'where':{'id':_0x40b67c[_0x4670('0x52')]['id'],'UserId':null}})[_0x4670('0x20')](handleEntityNotFound(_0xcd12f6,null))[_0x4670('0x20')](function(_0x48bc14){if(_0x48bc14){_0x5da326[_0x4670('0x27')]=_0x48bc14[_0x4670('0x63')]({'plain':!![]});return db[_0x4670('0x64')][_0x4670('0x54')]({'where':{'id':_0x48bc14[_0x4670('0x65')]}});}return null;})[_0x4670('0x20')](handleEntityNotFound(_0xcd12f6,null))['then'](function(_0x28b17c){if(_0x28b17c){_0x5da326['interaction']=_0x28b17c[_0x4670('0x63')]({'plain':!![]});interaction_log[_0x4670('0x28')](_0x4670('0x7d'),_0x40b67c[_0x4670('0x67')]['id'],_0x40b67c[_0x4670('0x67')][_0x4670('0x37')],_0x40b67c[_0x4670('0x67')][_0x4670('0x68')],_0x5da326[_0x4670('0x7e')]['id'],_0x40b67c['body']?JSON[_0x4670('0x24')](_0x40b67c[_0x4670('0x56')]):_0x4670('0x69'));return respondWithRpcPromise(_0x4670('0x7f'),_0x4670('0x80'),_0x5da326);}return null;})[_0x4670('0x20')](function(_0x419d7a){var _0x10f661=_0x4670('0x6c')+_0x419d7a[_0x4670('0x27')][_0x4670('0x6d')];return db[_0x4670('0x6e')][_0x4670('0x3f')](_0x10f661,{'type':db[_0x4670('0x81')][_0x4670('0x6f')][_0x4670('0x70')],'raw':!![]})[_0x4670('0x20')](function(_0x199e54){return _0x199e54;});})[_0x4670('0x20')](function(_0x47ada9){if(_0x47ada9){_0x5da326[_0x4670('0x27')][_0x4670('0x71')]=_0x47ada9[0x0];if(!_0x40b67c[_0x4670('0x56')]['UserId'])return;return db[_0x4670('0x72')]['find']({'where':{'id':_0x40b67c[_0x4670('0x56')]['UserId'],'role':_0x4670('0x62')},'attributes':['id',_0x4670('0x37'),_0x4670('0x82'),_0x4670('0x73'),_0x4670('0x83')],'raw':!![]});}return null;})[_0x4670('0x20')](function(_0x5aff6f){if(!_0x5aff6f)return null;_0x5da326[_0x4670('0x27')][_0x4670('0x62')]=_0x5aff6f;return _0x5da326;})[_0x4670('0x20')](function(_0x380b4b){if(_0x380b4b){_0x380b4b[_0x4670('0x27')][_0x4670('0x84')]=util['format'](_0x4670('0x75'),_0x40b67c[_0x4670('0x67')][_0x4670('0x37')]);_0x380b4b[_0x4670('0x27')][_0x4670('0x76')]=_0x5da326[_0x4670('0x76')];_0x380b4b[_0x4670('0x27')][_0x4670('0x77')]=_0x5da326['channel'];_0x380b4b[_0x4670('0x27')][_0x4670('0x78')]=_0x4670('0x85');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_[_0x4670('0x4c')](_0x5da326[_0x4670('0x27')],JSON[_0x4670('0x7b')](_0x5da326[_0x4670('0x7e')][_0x4670('0x7c')]))},client9002);return _0x5da326;}return null;})['then'](respondWithResult(_0xcd12f6,null))[_0x4670('0x2a')](handleError(_0xcd12f6,null));}; \ No newline at end of file +var _0x1957=['[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','motionChannel','reject','rejectmessage','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','stack','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','includeAll','find','create','body','params','describe','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','ChatInteraction'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x1957,0x11a));var _0x7195=function(_0x289c3e,_0x3614b5){_0x289c3e=_0x289c3e-0x0;var _0x25a4b3=_0x1957[_0x289c3e];return _0x25a4b3;};'use strict';var emlformat=require(_0x7195('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7195('0x1'));var rp=require('request-promise');var moment=require(_0x7195('0x2'));var BPromise=require(_0x7195('0x3'));var Mustache=require(_0x7195('0x4'));var util=require(_0x7195('0x5'));var path=require(_0x7195('0x6'));var sox=require(_0x7195('0x7'));var csv=require(_0x7195('0x8'));var ejs=require(_0x7195('0x9'));var fs=require('fs');var fs_extra=require(_0x7195('0xa'));var _=require('lodash');var squel=require(_0x7195('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7195('0xc'));var toCsv=require(_0x7195('0x8'));var querystring=require(_0x7195('0xd'));var Papa=require(_0x7195('0xe'));var Redis=require(_0x7195('0xf'));var authService=require(_0x7195('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7195('0x11'));var hardwareService=require(_0x7195('0x12'));var logger=require(_0x7195('0x13'))('api');var utils=require(_0x7195('0x14'));var config=require(_0x7195('0x15'));var licenseUtil=require(_0x7195('0x16'));var db=require(_0x7195('0x17'))['db'];config[_0x7195('0x18')]=_[_0x7195('0x19')](config[_0x7195('0x18')],{'host':_0x7195('0x1a'),'port':0x18eb});var socket=require(_0x7195('0x1b'))(new Redis(config['redis']));require(_0x7195('0x1c'))[_0x7195('0x1d')](socket);var jayson=require(_0x7195('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x7195('0x1f')][_0x7195('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x8d6782,_0x40bae0,_0x42f913,_0x33aff1){return new BPromise(function(_0x30ec17,_0x1e01f0){var _0x1b1d8d=_0x33aff1||client;return _0x1b1d8d['request'](_0x8d6782,_0x42f913)[_0x7195('0x21')](function(_0x32b52d){logger[_0x7195('0x22')](_0x7195('0x23'),_0x40bae0,'request\x20sent');logger[_0x7195('0x24')](_0x7195('0x25'),_0x40bae0,_0x7195('0x26'),JSON[_0x7195('0x27')](_0x32b52d));if(_0x32b52d[_0x7195('0x28')]){if(_0x32b52d[_0x7195('0x28')][_0x7195('0x29')]===0x1f4){logger[_0x7195('0x28')](_0x7195('0x23'),_0x40bae0,_0x32b52d[_0x7195('0x28')]['message']);return _0x1e01f0(_0x32b52d[_0x7195('0x28')]['message']);}logger[_0x7195('0x28')](_0x7195('0x23'),_0x40bae0,_0x32b52d[_0x7195('0x28')][_0x7195('0x2a')]);return _0x30ec17(_0x32b52d[_0x7195('0x28')]['message']);}else{logger[_0x7195('0x22')](_0x7195('0x23'),_0x40bae0,'request\x20sent');_0x30ec17(_0x32b52d[_0x7195('0x2b')][_0x7195('0x2a')]);}})[_0x7195('0x2c')](function(_0x261f17){logger[_0x7195('0x28')]('ChatMessage,\x20%s,\x20%s',_0x40bae0,_0x261f17);_0x1e01f0(_0x261f17);});});}function respondWithStatusCode(_0x2a4364,_0x36b13c){_0x36b13c=_0x36b13c||0xcc;return function(_0x195bb9){if(_0x195bb9){return _0x2a4364[_0x7195('0x2d')](_0x36b13c);}return _0x2a4364[_0x7195('0x2e')](_0x36b13c)[_0x7195('0x2f')]();};}function respondWithResult(_0x2eb0b7,_0x914551){_0x914551=_0x914551||0xc8;return function(_0x55460f){if(_0x55460f){return _0x2eb0b7[_0x7195('0x2e')](_0x914551)[_0x7195('0x30')](_0x55460f);}};}function respondWithFilteredResult(_0x2a30f9,_0x314410){return function(_0x1dfd04){if(_0x1dfd04){var _0x374b9d=typeof _0x314410[_0x7195('0x31')]===_0x7195('0x32')&&typeof _0x314410['limit']===_0x7195('0x32');var _0x1741ef=_0x1dfd04[_0x7195('0x33')];var _0x1cbce4=_0x374b9d?0x0:_0x314410['offset'];var _0x52c601=_0x374b9d?_0x1dfd04['count']:_0x314410[_0x7195('0x31')]+_0x314410[_0x7195('0x34')];var _0x3a4823;if(_0x52c601>=_0x1741ef){_0x52c601=_0x1741ef;_0x3a4823=0xc8;}else{_0x3a4823=0xce;}_0x2a30f9[_0x7195('0x2e')](_0x3a4823);return _0x2a30f9[_0x7195('0x35')](_0x7195('0x36'),_0x1cbce4+'-'+_0x52c601+'/'+_0x1741ef)[_0x7195('0x30')](_0x1dfd04);}return null;};}function patchUpdates(_0x4a08f0){return function(_0x317e08){try{jsonpatch[_0x7195('0x37')](_0x317e08,_0x4a08f0,!![]);}catch(_0x47c950){return BPromise['reject'](_0x47c950);}return _0x317e08['save']();};}function saveUpdates(_0x31a62a,_0x39c3d3){return function(_0x48313d){if(_0x48313d){return _0x48313d[_0x7195('0x38')](_0x31a62a)[_0x7195('0x21')](function(_0x402c00){return _0x402c00;});}return null;};}function removeEntity(_0x45b3a3,_0x39cf88){return function(_0x134897){if(_0x134897){return _0x134897[_0x7195('0x39')]()[_0x7195('0x21')](function(){_0x45b3a3[_0x7195('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3218db,_0xf6edce){return function(_0x50d5fc){if(!_0x50d5fc){_0x3218db[_0x7195('0x2d')](0x194);}return _0x50d5fc;};}function handleError(_0x4f10e8,_0x4f4b47){_0x4f4b47=_0x4f4b47||0x1f4;return function(_0x53ea78){logger['error'](_0x53ea78[_0x7195('0x3a')]);if(_0x53ea78['name']){delete _0x53ea78['name'];}_0x4f10e8[_0x7195('0x2e')](_0x4f4b47)[_0x7195('0x3b')](_0x53ea78);};}exports[_0x7195('0x3c')]=function(_0x4a7063,_0x4c00a9){var _0x381393={},_0x557f5a={},_0xe4b8fd={'count':0x0,'rows':[]};var _0x54dea2=_[_0x7195('0x3d')](db[_0x7195('0x3e')][_0x7195('0x3f')],function(_0x2bea86){return{'name':_0x2bea86[_0x7195('0x40')],'type':_0x2bea86[_0x7195('0x41')][_0x7195('0x42')]};});_0x557f5a['model']=_[_0x7195('0x3d')](_0x54dea2,_0x7195('0x43'));_0x557f5a['query']=_['keys'](_0x4a7063[_0x7195('0x44')]);_0x557f5a[_0x7195('0x45')]=_[_0x7195('0x46')](_0x557f5a[_0x7195('0x47')],_0x557f5a['query']);_0x381393[_0x7195('0x48')]=_[_0x7195('0x46')](_0x557f5a[_0x7195('0x47')],qs[_0x7195('0x49')](_0x4a7063['query']['fields']));_0x381393[_0x7195('0x48')]=_0x381393[_0x7195('0x48')][_0x7195('0x4a')]?_0x381393[_0x7195('0x48')]:_0x557f5a[_0x7195('0x47')];if(!_0x4a7063[_0x7195('0x44')][_0x7195('0x4b')]('nolimit')){_0x381393[_0x7195('0x34')]=qs[_0x7195('0x34')](_0x4a7063[_0x7195('0x44')][_0x7195('0x34')]);_0x381393[_0x7195('0x31')]=qs[_0x7195('0x31')](_0x4a7063['query'][_0x7195('0x31')]);}_0x381393[_0x7195('0x4c')]=qs[_0x7195('0x4d')](_0x4a7063['query'][_0x7195('0x4d')]);_0x381393[_0x7195('0x4e')]=qs[_0x7195('0x45')](_['pick'](_0x4a7063[_0x7195('0x44')],_0x557f5a[_0x7195('0x45')]),_0x54dea2);if(_0x4a7063['query'][_0x7195('0x4f')]){_0x381393[_0x7195('0x4e')]=_[_0x7195('0x50')](_0x381393['where'],{'$or':_[_0x7195('0x3d')](_0x54dea2,function(_0x5a3373){if(_0x5a3373['type']!==_0x7195('0x51')){var _0x3e44fe={};_0x3e44fe[_0x5a3373[_0x7195('0x43')]]={'$like':'%'+_0x4a7063[_0x7195('0x44')]['filter']+'%'};return _0x3e44fe;}})});}_0x381393=_[_0x7195('0x50')]({},_0x381393,_0x4a7063[_0x7195('0x52')]);var _0x113fc4={'where':_0x381393[_0x7195('0x4e')]};return db['ChatMessage'][_0x7195('0x33')](_0x113fc4)[_0x7195('0x21')](function(_0x2aaa98){_0xe4b8fd[_0x7195('0x33')]=_0x2aaa98;if(_0x4a7063['query']['includeAll']){_0x381393[_0x7195('0x53')]=[{'all':!![]}];}return db['ChatMessage'][_0x7195('0x54')](_0x381393);})[_0x7195('0x21')](function(_0x1f2500){_0xe4b8fd[_0x7195('0x55')]=_0x1f2500;return _0xe4b8fd;})[_0x7195('0x21')](respondWithFilteredResult(_0x4c00a9,_0x381393))[_0x7195('0x2c')](handleError(_0x4c00a9,null));};exports[_0x7195('0x56')]=function(_0x5c3bc2,_0x4ac5cb){var _0x5a4656={'raw':!![],'where':{'id':_0x5c3bc2['params']['id']}},_0x370c21={};_0x370c21['model']=_[_0x7195('0x57')](db[_0x7195('0x3e')][_0x7195('0x3f')]);_0x370c21['query']=_['keys'](_0x5c3bc2[_0x7195('0x44')]);_0x370c21[_0x7195('0x45')]=_[_0x7195('0x46')](_0x370c21[_0x7195('0x47')],_0x370c21[_0x7195('0x44')]);_0x5a4656[_0x7195('0x48')]=_[_0x7195('0x46')](_0x370c21[_0x7195('0x47')],qs[_0x7195('0x49')](_0x5c3bc2['query']['fields']));_0x5a4656[_0x7195('0x48')]=_0x5a4656[_0x7195('0x48')][_0x7195('0x4a')]?_0x5a4656[_0x7195('0x48')]:_0x370c21['model'];if(_0x5c3bc2[_0x7195('0x44')][_0x7195('0x58')]){_0x5a4656[_0x7195('0x53')]=[{'all':!![]}];}_0x5a4656=_[_0x7195('0x50')]({},_0x5a4656,_0x5c3bc2[_0x7195('0x52')]);return db[_0x7195('0x3e')][_0x7195('0x59')](_0x5a4656)[_0x7195('0x21')](handleEntityNotFound(_0x4ac5cb,null))['then'](respondWithResult(_0x4ac5cb,null))[_0x7195('0x2c')](handleError(_0x4ac5cb,null));};exports[_0x7195('0x5a')]=function(_0x396966,_0x624dfe){return db[_0x7195('0x3e')]['create'](_0x396966['body'],{})[_0x7195('0x21')](respondWithResult(_0x624dfe,0xc9))[_0x7195('0x2c')](handleError(_0x624dfe,null));};exports['update']=function(_0x4f0997,_0x1b6ad5){if(_0x4f0997[_0x7195('0x5b')]['id']){delete _0x4f0997[_0x7195('0x5b')]['id'];}return db[_0x7195('0x3e')][_0x7195('0x59')]({'where':{'id':_0x4f0997[_0x7195('0x5c')]['id']}})[_0x7195('0x21')](handleEntityNotFound(_0x1b6ad5,null))[_0x7195('0x21')](saveUpdates(_0x4f0997[_0x7195('0x5b')],null))[_0x7195('0x21')](respondWithResult(_0x1b6ad5,null))[_0x7195('0x2c')](handleError(_0x1b6ad5,null));};exports[_0x7195('0x39')]=function(_0x5b5a24,_0x9bc016){return db[_0x7195('0x3e')][_0x7195('0x59')]({'where':{'id':_0x5b5a24[_0x7195('0x5c')]['id']}})[_0x7195('0x21')](handleEntityNotFound(_0x9bc016,null))[_0x7195('0x21')](removeEntity(_0x9bc016,null))['catch'](handleError(_0x9bc016,null));};exports['describe']=function(_0x516c7e,_0x339854){return db[_0x7195('0x3e')][_0x7195('0x5d')]()['then'](respondWithResult(_0x339854,null))['catch'](handleError(_0x339854,null));};var interaction_log=require(_0x7195('0x13'))('chat-interactions');exports[_0x7195('0x5e')]=function(_0x4e6edf,_0x54eda2,_0x3be27d){var _0x431a0e={'agent':{},'channel':_0x7195('0x5f')};if(_0x4e6edf[_0x7195('0x5b')]['id']){delete _0x4e6edf[_0x7195('0x5b')]['id'];}_0x4e6edf[_0x7195('0x5b')]['read']=!![];_0x4e6edf[_0x7195('0x5b')][_0x7195('0x60')]=moment()[_0x7195('0x61')](_0x7195('0x62'));_0x4e6edf[_0x7195('0x5b')]['UserId']=_0x4e6edf[_0x7195('0x5b')][_0x7195('0x63')]||_0x4e6edf[_0x7195('0x64')]['id'];_0x431a0e[_0x7195('0x65')]['id']=_0x4e6edf[_0x7195('0x5b')][_0x7195('0x63')];return db['ChatMessage'][_0x7195('0x59')]({'where':{'id':_0x4e6edf[_0x7195('0x5c')]['id'],'UserId':null}})[_0x7195('0x21')](handleEntityNotFound(_0x54eda2,null))[_0x7195('0x21')](saveUpdates(_0x4e6edf[_0x7195('0x5b')],null))[_0x7195('0x21')](function(_0x305041){if(_0x305041){_0x431a0e['message']=_0x305041[_0x7195('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x7195('0x59')]({'where':{'id':_0x305041[_0x7195('0x67')]}});}return null;})[_0x7195('0x21')](handleEntityNotFound(_0x54eda2,null))[_0x7195('0x21')](function(_0x4520c5){if(_0x4520c5){return _0x4520c5[_0x7195('0x38')]({'UserId':_0x4e6edf['body'][_0x7195('0x63')],'read1stAt':_[_0x7195('0x68')](_0x4520c5[_0x7195('0x69')])?moment()['format'](_0x7195('0x62')):undefined});}return null;})['then'](function(_0x86e1e8){if(_0x86e1e8){_0x431a0e[_0x7195('0x6a')]=_0x86e1e8[_0x7195('0x66')]({'plain':!![]});interaction_log[_0x7195('0x22')](_0x7195('0x6b'),_0x4e6edf[_0x7195('0x64')]['id'],_0x4e6edf[_0x7195('0x64')][_0x7195('0x43')],_0x4e6edf[_0x7195('0x64')][_0x7195('0x6c')],_0x431a0e[_0x7195('0x6a')]['id'],_0x4e6edf[_0x7195('0x5b')]?JSON['stringify'](_0x4e6edf[_0x7195('0x5b')]):_0x7195('0x6d'));return respondWithRpcPromise(_0x7195('0x6e'),_0x7195('0x6f'),_0x431a0e);}return null;})[_0x7195('0x21')](function(_0x5e77b4){var _0xc410d9=_0x7195('0x70')+_0x5e77b4['message'][_0x7195('0x71')];return db[_0x7195('0x72')]['query'](_0xc410d9,{'type':db[_0x7195('0x73')][_0x7195('0x74')][_0x7195('0x75')],'raw':!![]})[_0x7195('0x21')](function(_0x38a384){return _0x38a384;});})[_0x7195('0x21')](function(_0x5997d3){if(_0x5997d3){_0x431a0e[_0x7195('0x2a')][_0x7195('0x76')]=_0x5997d3[0x0];if(!_0x4e6edf[_0x7195('0x5b')]['UserId'])return;return db['User'][_0x7195('0x59')]({'where':{'id':_0x4e6edf[_0x7195('0x5b')][_0x7195('0x63')],'role':_0x7195('0x65')},'attributes':['id',_0x7195('0x43'),_0x7195('0x77'),_0x7195('0x78'),_0x7195('0x79')],'raw':!![]});}return null;})[_0x7195('0x21')](function(_0x151791){if(!_0x151791)return null;_0x431a0e[_0x7195('0x2a')][_0x7195('0x65')]=_0x151791;return _0x431a0e;})['then'](function(_0x32927d){if(_0x32927d){if(_0x4e6edf[_0x7195('0x5b')][_0x7195('0x7a')]){_0x431a0e[_0x7195('0x2a')][_0x7195('0x7b')]=util[_0x7195('0x61')](_0x7195('0x7c'),_0x4e6edf[_0x7195('0x64')]['name']);_0x431a0e[_0x7195('0x2a')][_0x7195('0x7d')]=_0x431a0e[_0x7195('0x7d')];_0x431a0e[_0x7195('0x2a')]['motionChannel']=_0x431a0e[_0x7195('0x7d')];_0x431a0e['message'][_0x7195('0x7e')]='accept';return respondWithRpcPromise(_0x7195('0x7f'),_0x7195('0x7f'),{'event':_0x7195('0x80'),'message':_[_0x7195('0x50')](_0x431a0e[_0x7195('0x2a')],JSON[_0x7195('0x81')](_0x431a0e['interaction'][_0x7195('0x82')]))},client9002)['then'](function(){return _0x431a0e;});}return _0x431a0e;}return null;})[_0x7195('0x21')](respondWithResult(_0x54eda2,null))[_0x7195('0x2c')](handleError(_0x54eda2,null));};var interaction_log=require(_0x7195('0x13'))('chat-interactions');exports['reject']=function(_0x2c7efb,_0x1fd40e,_0x2926ee){var _0x293708={'agent':{},'channel':_0x7195('0x5f')};if(_0x2c7efb[_0x7195('0x5b')]['id']){delete _0x2c7efb[_0x7195('0x5b')]['id'];}_0x2c7efb[_0x7195('0x5b')]['UserId']=_0x2c7efb[_0x7195('0x5b')][_0x7195('0x63')]||_0x2c7efb[_0x7195('0x64')]['id'];_0x293708['agent']['id']=_0x2c7efb[_0x7195('0x5b')][_0x7195('0x63')];return db[_0x7195('0x3e')][_0x7195('0x59')]({'where':{'id':_0x2c7efb[_0x7195('0x5c')]['id'],'UserId':null}})[_0x7195('0x21')](handleEntityNotFound(_0x1fd40e,null))[_0x7195('0x21')](function(_0x18dbef){if(_0x18dbef){_0x293708['message']=_0x18dbef[_0x7195('0x66')]({'plain':!![]});return db[_0x7195('0x83')][_0x7195('0x59')]({'where':{'id':_0x18dbef[_0x7195('0x67')]}});}return null;})[_0x7195('0x21')](handleEntityNotFound(_0x1fd40e,null))[_0x7195('0x21')](function(_0x22e119){if(_0x22e119){_0x293708['interaction']=_0x22e119[_0x7195('0x66')]({'plain':!![]});interaction_log['info'](_0x7195('0x84'),_0x2c7efb[_0x7195('0x64')]['id'],_0x2c7efb[_0x7195('0x64')][_0x7195('0x43')],_0x2c7efb['user'][_0x7195('0x6c')],_0x293708[_0x7195('0x6a')]['id'],_0x2c7efb[_0x7195('0x5b')]?JSON['stringify'](_0x2c7efb[_0x7195('0x5b')]):_0x7195('0x6d'));return respondWithRpcPromise('RejectMessage',_0x7195('0x85'),_0x293708);}return null;})[_0x7195('0x21')](function(_0x57355b){var _0x287e4b=_0x7195('0x70')+_0x57355b[_0x7195('0x2a')][_0x7195('0x71')];return db[_0x7195('0x72')]['query'](_0x287e4b,{'type':db[_0x7195('0x73')][_0x7195('0x74')]['SELECT'],'raw':!![]})[_0x7195('0x21')](function(_0x5a9c9a){return _0x5a9c9a;});})[_0x7195('0x21')](function(_0x51e5bb){if(_0x51e5bb){_0x293708[_0x7195('0x2a')][_0x7195('0x76')]=_0x51e5bb[0x0];if(!_0x2c7efb[_0x7195('0x5b')]['UserId'])return;return db[_0x7195('0x86')][_0x7195('0x59')]({'where':{'id':_0x2c7efb[_0x7195('0x5b')]['UserId'],'role':'agent'},'attributes':['id','name',_0x7195('0x77'),_0x7195('0x78'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1a61d8){if(!_0x1a61d8)return null;_0x293708[_0x7195('0x2a')][_0x7195('0x65')]=_0x1a61d8;return _0x293708;})[_0x7195('0x21')](function(_0x1cf2b1){if(_0x1cf2b1){_0x1cf2b1[_0x7195('0x2a')][_0x7195('0x7b')]=util['format'](_0x7195('0x7c'),_0x2c7efb['user'][_0x7195('0x43')]);_0x1cf2b1[_0x7195('0x2a')][_0x7195('0x7d')]=_0x293708[_0x7195('0x7d')];_0x1cf2b1['message'][_0x7195('0x87')]=_0x293708[_0x7195('0x7d')];_0x1cf2b1[_0x7195('0x2a')][_0x7195('0x7e')]=_0x7195('0x88');respondWithRpcPromise(_0x7195('0x7f'),_0x7195('0x7f'),{'event':_0x7195('0x89'),'message':_[_0x7195('0x50')](_0x293708[_0x7195('0x2a')],JSON[_0x7195('0x81')](_0x293708[_0x7195('0x6a')][_0x7195('0x82')]))},client9002);return _0x293708;}return null;})['then'](respondWithResult(_0x1fd40e,null))[_0x7195('0x2c')](handleError(_0x1fd40e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 94bda23..29570e4 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 _0xa8dd=['ChatMessage','save','remove','emit','hook','exports','../../mysqldb'];(function(_0x51a76a,_0x136d7d){var _0x9efc57=function(_0x16a4b8){while(--_0x16a4b8){_0x51a76a['push'](_0x51a76a['shift']());}};_0x9efc57(++_0x136d7d);}(_0xa8dd,0xca));var _0xda8d=function(_0x551646,_0x183acb){_0x551646=_0x551646-0x0;var _0x19d925=_0xa8dd[_0x551646];return _0x19d925;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xda8d('0x0'))['db'][_0xda8d('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xda8d('0x2'),'afterUpdate':'update','afterDestroy':_0xda8d('0x3')};function emitEvent(_0x36f531){return function(_0x10631d,_0x1881bd,_0xb8394f){ChatMessageEvents[_0xda8d('0x4')](_0x36f531+':'+_0x10631d['id'],_0x10631d);ChatMessageEvents[_0xda8d('0x4')](_0x36f531,_0x10631d);_0xb8394f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xda8d('0x5')](e,emitEvent(event));}}module[_0xda8d('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0x88e9=['hook','exports','events','../../mysqldb','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x252087,_0x28d2c7){var _0x10f21d=function(_0x300e75){while(--_0x300e75){_0x252087['push'](_0x252087['shift']());}};_0x10f21d(++_0x28d2c7);}(_0x88e9,0x7a));var _0x988e=function(_0x2e6235,_0x4ee47b){_0x2e6235=_0x2e6235-0x0;var _0x2550ea=_0x88e9[_0x2e6235];return _0x2550ea;};'use strict';var EventEmitter=require(_0x988e('0x0'));var ChatMessage=require(_0x988e('0x1'))['db'][_0x988e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x988e('0x3'),'afterUpdate':_0x988e('0x4'),'afterDestroy':_0x988e('0x5')};function emitEvent(_0x3e409b){return function(_0x58a5b7,_0x201a7e,_0x2f03fa){ChatMessageEvents[_0x988e('0x6')](_0x3e409b+':'+_0x58a5b7['id'],_0x58a5b7);ChatMessageEvents[_0x988e('0x6')](_0x3e409b,_0x58a5b7);_0x2f03fa(null);};}for(var e in events){if(events[_0x988e('0x7')](e)){var event=events[e];ChatMessage[_0x988e('0x8')](e,emitEvent(event));}}module[_0x988e('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e804445..c9d8c3b 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 _0x59e7=['chat_messages','body','get','direction','toLowerCase','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x59e7,0x103));var _0x759e=function(_0x568f74,_0x3cb5a8){_0x568f74=_0x568f74-0x0;var _0x363cdd=_0x59e7[_0x568f74];return _0x363cdd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x759e('0x0'))(_0x759e('0x1'));var moment=require(_0x759e('0x2'));var BPromise=require(_0x759e('0x3'));var rp=require(_0x759e('0x4'));var fs=require('fs');var path=require(_0x759e('0x5'));var rimraf=require(_0x759e('0x6'));var config=require(_0x759e('0x7'));var attributes=require(_0x759e('0x8'));module['exports']=function(_0x1968c8,_0x54aa41){return _0x1968c8[_0x759e('0x9')](_0x759e('0xa'),attributes,{'tableName':_0x759e('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x759e('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32f4a5,_0x578e46,_0xe3e9e6){var _0x532c44=_0x1968c8['models'];var _0x3350e9=_0x32f4a5[_0x759e('0xd')]({'plain':!![]});if(_0x3350e9[_0x759e('0xe')]['toLowerCase']()==='in'||_0x3350e9[_0x759e('0xe')][_0x759e('0xf')]()==='out'&&!_0x3350e9[_0x759e('0x10')]&&!_[_0x759e('0x11')](_0x3350e9['UserId'])){_0x532c44[_0x759e('0x12')][_0x759e('0x13')]({'where':{'id':_0x3350e9[_0x759e('0x14')]}})[_0x759e('0x15')](function(_0x5a0520){if(_0x5a0520){_0x5a0520[_0x759e('0x16')]({'lastMsgAt':_0x3350e9[_0x759e('0x17')],'lastMsgDirection':_0x3350e9['direction'][_0x759e('0xf')]()});}})[_0x759e('0x18')](function(_0x54d479){console[_0x759e('0x19')](_0x54d479);});}_0xe3e9e6();}},'charset':'utf8mb4','collate':_0x759e('0x1a')});}; \ No newline at end of file +var _0x3fab=['isNil','UserId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x3fab,0xf8));var _0xb3fa=function(_0xba9879,_0x178a09){_0xba9879=_0xba9879-0x0;var _0x312144=_0x3fab[_0xba9879];return _0x312144;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb3fa('0x0'))('api');var moment=require(_0xb3fa('0x1'));var BPromise=require('bluebird');var rp=require(_0xb3fa('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3fa('0x3'));var attributes=require(_0xb3fa('0x4'));module[_0xb3fa('0x5')]=function(_0x79e345,_0x30670f){return _0x79e345[_0xb3fa('0x6')](_0xb3fa('0x7'),attributes,{'tableName':_0xb3fa('0x8'),'paranoid':![],'indexes':[{'name':_0xb3fa('0x9'),'fields':[_0xb3fa('0xa')],'type':_0xb3fa('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4010f6,_0x224bae,_0x37cc77){var _0x3abe22=_0x79e345[_0xb3fa('0xc')];var _0x1a7155=_0x4010f6[_0xb3fa('0xd')]({'plain':!![]});if(_0x1a7155['direction'][_0xb3fa('0xe')]()==='in'||_0x1a7155[_0xb3fa('0xf')][_0xb3fa('0xe')]()==='out'&&!_0x1a7155['secret']&&!_[_0xb3fa('0x10')](_0x1a7155[_0xb3fa('0x11')])){_0x3abe22['ChatInteraction']['findOne']({'where':{'id':_0x1a7155['ChatInteractionId']}})[_0xb3fa('0x12')](function(_0x162ef4){if(_0x162ef4){_0x162ef4[_0xb3fa('0x13')]({'lastMsgAt':_0x1a7155['createdAt'],'lastMsgDirection':_0x1a7155[_0xb3fa('0xf')][_0xb3fa('0xe')]()});}})[_0xb3fa('0x14')](function(_0x569395){console[_0xb3fa('0x15')](_0x569395);});}_0x37cc77();}},'charset':_0xb3fa('0x16'),'collate':_0xb3fa('0x17')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 052eeb7..677c15e 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 _0x59f2=['./chatMessage.socket','register','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','create','body','raw','CreateChatMessage','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter'];(function(_0x201d98,_0x56fd1f){var _0x1ae057=function(_0xb7eeab){while(--_0xb7eeab){_0x201d98['push'](_0x201d98['shift']());}};_0x1ae057(++_0x56fd1f);}(_0x59f2,0xb3));var _0x259f=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x59f2[_0x1a36a5];return _0x746243;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x259f('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x259f('0x1'));var db=require(_0x259f('0x2'))['db'];var utils=require(_0x259f('0x3'));var logger=require(_0x259f('0x4'))('rpc');var config=require(_0x259f('0x5'));var jayson=require(_0x259f('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x259f('0x7')]=_[_0x259f('0x8')](config[_0x259f('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x259f('0x9'))(new Redis(config['redis']));require(_0x259f('0xa'))[_0x259f('0xb')](socket);function respondWithRpcPromise(_0x31d5a0,_0x5bbc27,_0xe76e38){return new BPromise(function(_0x240f70,_0x2b0ca5){return client['request'](_0x31d5a0,_0xe76e38)[_0x259f('0xc')](function(_0x724824){logger[_0x259f('0xd')]('ChatMessage,\x20%s,\x20%s',_0x5bbc27,'request\x20sent');logger[_0x259f('0xe')](_0x259f('0xf'),_0x5bbc27,'request\x20sent',JSON['stringify'](_0x724824));if(_0x724824[_0x259f('0x10')]){if(_0x724824[_0x259f('0x10')][_0x259f('0x11')]===0x1f4){logger[_0x259f('0x10')](_0x259f('0x12'),_0x5bbc27,_0x724824[_0x259f('0x10')][_0x259f('0x13')]);return _0x2b0ca5(_0x724824[_0x259f('0x10')][_0x259f('0x13')]);}logger[_0x259f('0x10')](_0x259f('0x12'),_0x5bbc27,_0x724824[_0x259f('0x10')][_0x259f('0x13')]);return _0x240f70(_0x724824[_0x259f('0x10')][_0x259f('0x13')]);}else{logger[_0x259f('0xd')](_0x259f('0x12'),_0x5bbc27,_0x259f('0x14'));_0x240f70(_0x724824[_0x259f('0x15')][_0x259f('0x13')]);}})[_0x259f('0x16')](function(_0x5b49de){logger[_0x259f('0x10')](_0x259f('0x12'),_0x5bbc27,_0x5b49de);_0x2b0ca5(_0x5b49de);});});}exports['CreateChatMessage']=function(_0x46302d){var _0x4c394c=this;return new Promise(function(_0xc1796c,_0x225d21){return db['ChatMessage'][_0x259f('0x17')](_0x46302d[_0x259f('0x18')],{'raw':_0x46302d['options']?_0x46302d['options'][_0x259f('0x19')]===undefined?!![]:![]:!![]})[_0x259f('0xc')](function(_0x163d83){logger['info'](_0x259f('0x1a'),_0x46302d);logger['debug'](_0x259f('0x1a'),_0x46302d,JSON['stringify'](_0x163d83));_0xc1796c(_0x163d83);})[_0x259f('0x16')](function(_0x1562c6){logger[_0x259f('0x10')](_0x259f('0x1a'),_0x1562c6['message'],_0x46302d);_0x225d21(_0x4c394c[_0x259f('0x10')](0x1f4,_0x1562c6['message']));});});}; \ No newline at end of file +var _0x00c2=['catch','ChatMessage','body','options','raw','then','CreateChatMessage','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x331ebe,_0x1fdbfa){var _0x5311ef=function(_0xc76f7b){while(--_0xc76f7b){_0x331ebe['push'](_0x331ebe['shift']());}};_0x5311ef(++_0x1fdbfa);}(_0x00c2,0x6a));var _0x200c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00c2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x200c('0x0'));var util=require(_0x200c('0x1'));var moment=require('moment');var BPromise=require(_0x200c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x200c('0x3'));var db=require(_0x200c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x200c('0x5'))(_0x200c('0x6'));var config=require(_0x200c('0x7'));var jayson=require(_0x200c('0x8'));var client=jayson[_0x200c('0x9')][_0x200c('0xa')]({'port':0x232a});config[_0x200c('0xb')]=_[_0x200c('0xc')](config['redis'],{'host':_0x200c('0xd'),'port':0x18eb});var socket=require(_0x200c('0xe'))(new Redis(config['redis']));require(_0x200c('0xf'))[_0x200c('0x10')](socket);function respondWithRpcPromise(_0x113e58,_0x301da2,_0x52ca95){return new BPromise(function(_0x2ad205,_0x424186){return client['request'](_0x113e58,_0x52ca95)['then'](function(_0x276df4){logger[_0x200c('0x11')](_0x200c('0x12'),_0x301da2,_0x200c('0x13'));logger[_0x200c('0x14')](_0x200c('0x15'),_0x301da2,_0x200c('0x13'),JSON[_0x200c('0x16')](_0x276df4));if(_0x276df4['error']){if(_0x276df4['error'][_0x200c('0x17')]===0x1f4){logger[_0x200c('0x18')](_0x200c('0x12'),_0x301da2,_0x276df4[_0x200c('0x18')][_0x200c('0x19')]);return _0x424186(_0x276df4[_0x200c('0x18')][_0x200c('0x19')]);}logger[_0x200c('0x18')](_0x200c('0x12'),_0x301da2,_0x276df4[_0x200c('0x18')][_0x200c('0x19')]);return _0x2ad205(_0x276df4[_0x200c('0x18')][_0x200c('0x19')]);}else{logger['info'](_0x200c('0x12'),_0x301da2,_0x200c('0x13'));_0x2ad205(_0x276df4['result']['message']);}})[_0x200c('0x1a')](function(_0x59e244){logger[_0x200c('0x18')]('ChatMessage,\x20%s,\x20%s',_0x301da2,_0x59e244);_0x424186(_0x59e244);});});}exports['CreateChatMessage']=function(_0x1c4391){var _0x2d8a39=this;return new Promise(function(_0x3e4e01,_0xc3b98f){return db[_0x200c('0x1b')]['create'](_0x1c4391[_0x200c('0x1c')],{'raw':_0x1c4391[_0x200c('0x1d')]?_0x1c4391['options'][_0x200c('0x1e')]===undefined?!![]:![]:!![]})[_0x200c('0x1f')](function(_0x1dab90){logger[_0x200c('0x11')]('CreateChatMessage',_0x1c4391);logger[_0x200c('0x14')](_0x200c('0x20'),_0x1c4391,JSON[_0x200c('0x16')](_0x1dab90));_0x3e4e01(_0x1dab90);})[_0x200c('0x1a')](function(_0x1bb929){logger[_0x200c('0x18')]('CreateChatMessage',_0x1bb929['message'],_0x1c4391);_0xc3b98f(_0x2d8a39[_0x200c('0x18')](0x1f4,_0x1bb929[_0x200c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a280304..e950532 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 _0x383d=['register','length','remove','update','emit','removeListener'];(function(_0x24b3a2,_0x81eb9c){var _0x236d48=function(_0x31f120){while(--_0x31f120){_0x24b3a2['push'](_0x24b3a2['shift']());}};_0x236d48(++_0x81eb9c);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0xd383('0x0'),_0xd383('0x1')];function createListener(_0x35486e,_0x559dd3){return function(_0x7554ef){_0x559dd3[_0xd383('0x2')](_0x35486e,_0x7554ef);};}function removeListener(_0x319f67,_0x3439dd){return function(){ChatMessageEvents[_0xd383('0x3')](_0x319f67,_0x3439dd);};}exports[_0xd383('0x4')]=function(_0x5a0b1d){for(var _0xc64e9b=0x0,_0x30ba82=events[_0xd383('0x5')];_0xc64e9b<_0x30ba82;_0xc64e9b++){var _0x470d8d=events[_0xc64e9b];var _0xffa778=createListener('chatMessage:'+_0x470d8d,_0x5a0b1d);ChatMessageEvents['on'](_0x470d8d,_0xffa778);}}; \ No newline at end of file +var _0xfd20=['register','chatMessage:','save','emit','removeListener'];(function(_0x19fd7d,_0x2b866d){var _0x46fd50=function(_0x10c4d0){while(--_0x10c4d0){_0x19fd7d['push'](_0x19fd7d['shift']());}};_0x46fd50(++_0x2b866d);}(_0xfd20,0x66));var _0x0fd2=function(_0x49c816,_0x198631){_0x49c816=_0x49c816-0x0;var _0x23bcac=_0xfd20[_0x49c816];return _0x23bcac;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x0fd2('0x0'),'remove','update'];function createListener(_0x429df4,_0x28eb77){return function(_0x53caa3){_0x28eb77[_0x0fd2('0x1')](_0x429df4,_0x53caa3);};}function removeListener(_0x4c4975,_0x3661d3){return function(){ChatMessageEvents[_0x0fd2('0x2')](_0x4c4975,_0x3661d3);};}exports[_0x0fd2('0x3')]=function(_0xf25991){for(var _0x247d6e=0x0,_0x4d114c=events['length'];_0x247d6e<_0x4d114c;_0x247d6e++){var _0x32d460=events[_0x247d6e];var _0x15ba86=createListener(_0x0fd2('0x4')+_0x32d460,_0xf25991);ChatMessageEvents['on'](_0x32d460,_0x15ba86);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 27fd9fd..f3749d6 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 _0xa510=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','post','tracked','chatmessage:create','create','update','put','/:id/accept','/:id/reject','reject','delete','exports','multer','util','path','express','Router'];(function(_0x3c43db,_0x52a979){var _0x3bdc8d=function(_0x1b6862){while(--_0x1b6862){_0x3c43db['push'](_0x3c43db['shift']());}};_0x3bdc8d(++_0x52a979);}(_0xa510,0x1c3));var _0x0a51=function(_0x4e790d,_0x5da06f){_0x4e790d=_0x4e790d-0x0;var _0x3c71e2=_0xa510[_0x4e790d];return _0x3c71e2;};'use strict';var multer=require(_0x0a51('0x0'));var util=require(_0x0a51('0x1'));var path=require(_0x0a51('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a51('0x3'));var router=express[_0x0a51('0x4')]();var fs_extra=require(_0x0a51('0x5'));var auth=require(_0x0a51('0x6'));var interaction=require(_0x0a51('0x7'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x0a51('0x8')]('/',auth[_0x0a51('0x9')](),controller['index']);router['get'](_0x0a51('0xa'),auth[_0x0a51('0x9')](),controller['describe']);router['get'](_0x0a51('0xb'),auth[_0x0a51('0x9')](),controller[_0x0a51('0xc')]);router[_0x0a51('0xd')]('/',auth[_0x0a51('0x9')](),interaction[_0x0a51('0xe')]('chat',_0x0a51('0xf')),controller[_0x0a51('0x10')]);router['put']('/:id',controller[_0x0a51('0x11')]);router[_0x0a51('0x12')](_0x0a51('0x13'),auth[_0x0a51('0x9')](),controller['accept']);router[_0x0a51('0x12')](_0x0a51('0x14'),auth[_0x0a51('0x9')](),controller[_0x0a51('0x15')]);router[_0x0a51('0x16')](_0x0a51('0xb'),auth[_0x0a51('0x9')](),controller['destroy']);module[_0x0a51('0x17')]=router; \ No newline at end of file +var _0xeb20=['post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x149065,_0x19d114){var _0x14d0af=function(_0x265c06){while(--_0x265c06){_0x149065['push'](_0x149065['shift']());}};_0x14d0af(++_0x19d114);}(_0xeb20,0x100));var _0x0eb2=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xeb20[_0x19babd];return _0x314eaf;};'use strict';var multer=require('multer');var util=require(_0x0eb2('0x0'));var path=require('path');var timeout=require(_0x0eb2('0x1'));var express=require(_0x0eb2('0x2'));var router=express[_0x0eb2('0x3')]();var fs_extra=require(_0x0eb2('0x4'));var auth=require(_0x0eb2('0x5'));var interaction=require(_0x0eb2('0x6'));var config=require(_0x0eb2('0x7'));var controller=require(_0x0eb2('0x8'));router[_0x0eb2('0x9')]('/',auth[_0x0eb2('0xa')](),controller[_0x0eb2('0xb')]);router['get'](_0x0eb2('0xc'),auth[_0x0eb2('0xa')](),controller['describe']);router[_0x0eb2('0x9')](_0x0eb2('0xd'),auth[_0x0eb2('0xa')](),controller['show']);router[_0x0eb2('0xe')]('/',auth[_0x0eb2('0xa')](),interaction[_0x0eb2('0xf')](_0x0eb2('0x10'),_0x0eb2('0x11')),controller[_0x0eb2('0x12')]);router[_0x0eb2('0x13')](_0x0eb2('0xd'),controller[_0x0eb2('0x14')]);router[_0x0eb2('0x13')](_0x0eb2('0x15'),auth[_0x0eb2('0xa')](),controller[_0x0eb2('0x16')]);router[_0x0eb2('0x13')](_0x0eb2('0x17'),auth[_0x0eb2('0xa')](),controller['reject']);router[_0x0eb2('0x18')](_0x0eb2('0xd'),auth['isAuthenticated'](),controller[_0x0eb2('0x19')]);module[_0x0eb2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index d43f1b2..ae1a894 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3e079f,_0x189e15){_0x3e079f=_0x3e079f-0x0;var _0x296a34=_0x0b0e[_0x3e079f];return _0x296a34;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x2c1923,_0x26da04){var _0x3d38bb=function(_0xb95248){while(--_0xb95248){_0x2c1923['push'](_0x2c1923['shift']());}};_0x3d38bb(++_0x26da04);}(_0xdb28,0x106));var _0x8db2=function(_0x364511,_0x1db927){_0x364511=_0x364511-0x0;var _0x3dd973=_0xdb28[_0x364511];return _0x3dd973;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 3f20f68..50ccf22 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x7a54,0x106));var _0x47a5=function(_0x1b30f2,_0x12a2e6){_0x1b30f2=_0x1b30f2-0x0;var _0x4961c8=_0x7a54[_0x1b30f2];return _0x4961c8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x1f6dee,_0x3c7a24){_0x1f6dee=_0x1f6dee-0x0;var _0x4e29be=_0x7a54[_0x1f6dee];return _0x4e29be;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 615c884..4cd4ca0 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 _0x95a2=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x499086,_0x6230eb){var _0x45fa1e=function(_0x27af06){while(--_0x27af06){_0x499086['push'](_0x499086['shift']());}};_0x45fa1e(++_0x6230eb);}(_0x95a2,0x1e1));var _0x295a=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0x95a2[_0x507597];return _0x110a0f;};'use strict';var EventEmitter=require(_0x295a('0x0'));var ChatOfflineMessage=require(_0x295a('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x295a('0x2')](0x0);var events={'afterCreate':_0x295a('0x3'),'afterUpdate':_0x295a('0x4'),'afterDestroy':_0x295a('0x5')};function emitEvent(_0x5871e7){return function(_0x2734b4,_0x4b844a,_0x1625b8){ChatOfflineMessageEvents['emit'](_0x5871e7+':'+_0x2734b4['id'],_0x2734b4);ChatOfflineMessageEvents[_0x295a('0x6')](_0x5871e7,_0x2734b4);_0x1625b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x295a('0x7')](e,emitEvent(event));}}module[_0x295a('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x9336=['hasOwnProperty','hook','events','ChatOfflineMessage','setMaxListeners','save','update','remove'];(function(_0x198ba1,_0x211771){var _0x40e413=function(_0x5b63d0){while(--_0x5b63d0){_0x198ba1['push'](_0x198ba1['shift']());}};_0x40e413(++_0x211771);}(_0x9336,0x112));var _0x6933=function(_0xb58f1d,_0x1dc338){_0xb58f1d=_0xb58f1d-0x0;var _0x2d69ed=_0x9336[_0xb58f1d];return _0x2d69ed;};'use strict';var EventEmitter=require(_0x6933('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x6933('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x6933('0x2')](0x0);var events={'afterCreate':_0x6933('0x3'),'afterUpdate':_0x6933('0x4'),'afterDestroy':_0x6933('0x5')};function emitEvent(_0x15f8d3){return function(_0x2ecca2,_0x552221,_0xe1cfab){ChatOfflineMessageEvents['emit'](_0x15f8d3+':'+_0x2ecca2['id'],_0x2ecca2);ChatOfflineMessageEvents['emit'](_0x15f8d3,_0x2ecca2);_0xe1cfab(null);};}for(var e in events){if(events[_0x6933('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x6933('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 06ea494..fd2b81c 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 _0xbd19=['ChatOfflineMessage','chat_offline_messages','./chatOfflineMessage.attributes','exports','define'];(function(_0x4474c2,_0x59cf02){var _0x435fbb=function(_0x3c86eb){while(--_0x3c86eb){_0x4474c2['push'](_0x4474c2['shift']());}};_0x435fbb(++_0x59cf02);}(_0xbd19,0x98));var _0x9bd1=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xbd19[_0x4792c8];return _0x35edb1;};'use strict';var attributes=require(_0x9bd1('0x0'));module[_0x9bd1('0x1')]=function(_0x48fae0){return _0x48fae0[_0x9bd1('0x2')](_0x9bd1('0x3'),attributes,{'tableName':_0x9bd1('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb25f=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x4ca853,_0x122b94){var _0x2a0cb5=function(_0x1b1eac){while(--_0x1b1eac){_0x4ca853['push'](_0x4ca853['shift']());}};_0x2a0cb5(++_0x122b94);}(_0xb25f,0xce));var _0xfb25=function(_0x2de4d0,_0x56c5d9){_0x2de4d0=_0x2de4d0-0x0;var _0x392758=_0xb25f[_0x2de4d0];return _0x392758;};'use strict';var attributes=require(_0xfb25('0x0'));module[_0xfb25('0x1')]=function(_0x230bfd){return _0x230bfd[_0xfb25('0x2')](_0xfb25('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb25('0x4'),'collate':_0xfb25('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index be17365..0ca46ff 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 _0x810c=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x810c,0x1a5));var _0xc810=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x810c[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0xc810('0x0'));var util=require(_0xc810('0x1'));var moment=require('moment');var BPromise=require(_0xc810('0x2'));var rs=require(_0xc810('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc810('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc810('0x5'))(_0xc810('0x6'));var config=require(_0xc810('0x7'));var jayson=require(_0xc810('0x8'));var client=jayson[_0xc810('0x9')][_0xc810('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38a729,_0x567ac0,_0x227fd4){return new BPromise(function(_0x4bb524,_0x1799f8){return client[_0xc810('0xb')](_0x38a729,_0x227fd4)[_0xc810('0xc')](function(_0x39c855){logger[_0xc810('0xd')](_0xc810('0xe'),_0x567ac0,_0xc810('0xf'));logger[_0xc810('0x10')](_0xc810('0x11'),_0x567ac0,'request\x20sent',JSON[_0xc810('0x12')](_0x39c855));if(_0x39c855[_0xc810('0x13')]){if(_0x39c855[_0xc810('0x13')][_0xc810('0x14')]===0x1f4){logger[_0xc810('0x13')](_0xc810('0xe'),_0x567ac0,_0x39c855[_0xc810('0x13')][_0xc810('0x15')]);return _0x1799f8(_0x39c855[_0xc810('0x13')]['message']);}logger[_0xc810('0x13')](_0xc810('0xe'),_0x567ac0,_0x39c855[_0xc810('0x13')][_0xc810('0x15')]);return _0x4bb524(_0x39c855[_0xc810('0x13')][_0xc810('0x15')]);}else{logger['info'](_0xc810('0xe'),_0x567ac0,'request\x20sent');_0x4bb524(_0x39c855[_0xc810('0x16')][_0xc810('0x15')]);}})[_0xc810('0x17')](function(_0x278d82){logger['error'](_0xc810('0xe'),_0x567ac0,_0x278d82);_0x1799f8(_0x278d82);});});} \ No newline at end of file +var _0xf569=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x38061e,_0x4f6c6f){var _0x545d9c=function(_0x23fd1e){while(--_0x23fd1e){_0x38061e['push'](_0x38061e['shift']());}};_0x545d9c(++_0x4f6c6f);}(_0xf569,0xd0));var _0x9f56=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf569[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var moment=require(_0x9f56('0x1'));var BPromise=require(_0x9f56('0x2'));var rs=require(_0x9f56('0x3'));var fs=require('fs');var Redis=require(_0x9f56('0x4'));var db=require(_0x9f56('0x5'))['db'];var utils=require(_0x9f56('0x6'));var logger=require(_0x9f56('0x7'))('rpc');var config=require(_0x9f56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f56('0x9')][_0x9f56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c5e5f,_0x1bcede,_0x73c3b4){return new BPromise(function(_0x5980f2,_0x46fd92){return client[_0x9f56('0xb')](_0x5c5e5f,_0x73c3b4)[_0x9f56('0xc')](function(_0x4f398b){logger['info'](_0x9f56('0xd'),_0x1bcede,_0x9f56('0xe'));logger['debug'](_0x9f56('0xf'),_0x1bcede,_0x9f56('0xe'),JSON[_0x9f56('0x10')](_0x4f398b));if(_0x4f398b['error']){if(_0x4f398b['error'][_0x9f56('0x11')]===0x1f4){logger['error'](_0x9f56('0xd'),_0x1bcede,_0x4f398b['error']['message']);return _0x46fd92(_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);}logger['error'](_0x9f56('0xd'),_0x1bcede,_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);return _0x5980f2(_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);}else{logger[_0x9f56('0x14')](_0x9f56('0xd'),_0x1bcede,_0x9f56('0xe'));_0x5980f2(_0x4f398b[_0x9f56('0x15')][_0x9f56('0x13')]);}})[_0x9f56('0x16')](function(_0x13ebfa){logger[_0x9f56('0x12')](_0x9f56('0xd'),_0x1bcede,_0x13ebfa);_0x46fd92(_0x13ebfa);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f14e71f..800a502 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 _0xba06=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0xba06,0x1e1));var _0x6ba0=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0xba06[_0x2962d5];return _0x273406;};'use strict';var multer=require(_0x6ba0('0x0'));var util=require(_0x6ba0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6ba0('0x2'));var router=express[_0x6ba0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6ba0('0x4'));var interaction=require(_0x6ba0('0x5'));var config=require(_0x6ba0('0x6'));var controller=require(_0x6ba0('0x7'));router[_0x6ba0('0x8')]('/',auth[_0x6ba0('0x9')](),controller[_0x6ba0('0xa')]);router[_0x6ba0('0x8')](_0x6ba0('0xb'),auth[_0x6ba0('0x9')](),controller['describe']);router[_0x6ba0('0x8')](_0x6ba0('0xc'),auth[_0x6ba0('0x9')](),controller[_0x6ba0('0xd')]);router[_0x6ba0('0xe')]('/',auth['isAuthenticated'](),controller[_0x6ba0('0xf')]);router[_0x6ba0('0x10')](_0x6ba0('0xc'),auth['isAuthenticated'](),controller[_0x6ba0('0x11')]);router[_0x6ba0('0x12')](_0x6ba0('0xc'),auth[_0x6ba0('0x9')](),controller[_0x6ba0('0x13')]);module[_0x6ba0('0x14')]=router; \ No newline at end of file +var _0x69e5=['/:id','show','post','put','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x69e5,0x1d7));var _0x569e=function(_0x3c2407,_0x3c9a47){_0x3c2407=_0x3c2407-0x0;var _0x5d2eac=_0x69e5[_0x3c2407];return _0x5d2eac;};'use strict';var multer=require('multer');var util=require(_0x569e('0x0'));var path=require('path');var timeout=require(_0x569e('0x1'));var express=require('express');var router=express[_0x569e('0x2')]();var fs_extra=require(_0x569e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x569e('0x4'));var config=require(_0x569e('0x5'));var controller=require(_0x569e('0x6'));router[_0x569e('0x7')]('/',auth[_0x569e('0x8')](),controller['index']);router[_0x569e('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x569e('0x9'),auth[_0x569e('0x8')](),controller[_0x569e('0xa')]);router[_0x569e('0xb')]('/',auth[_0x569e('0x8')](),controller['create']);router[_0x569e('0xc')](_0x569e('0x9'),auth[_0x569e('0x8')](),controller[_0x569e('0xd')]);router[_0x569e('0xe')](_0x569e('0x9'),auth[_0x569e('0x8')](),controller[_0x569e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index e3336d3..f515466 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 _0xb130=['sequelize','STRING','mouseOver','timeout','INTEGER'];(function(_0x54514c,_0xf1c84a){var _0x5cd80e=function(_0x186444){while(--_0x186444){_0x54514c['push'](_0x54514c['shift']());}};_0x5cd80e(++_0xf1c84a);}(_0xb130,0xff));var _0x0b13=function(_0x3f3a47,_0x28f84b){_0x3f3a47=_0x3f3a47-0x0;var _0x57a682=_0xb130[_0x3f3a47];return _0x57a682;};'use strict';var Sequelize=require(_0x0b13('0x0'));module['exports']={'name':{'type':Sequelize[_0x0b13('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0b13('0x2'),_0x0b13('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x0b13('0x1')]},'timeout':{'type':Sequelize[_0x0b13('0x4')]}}; \ No newline at end of file +var _0x92c2=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x2746fa,_0x204898){var _0x522dc9=function(_0x43c668){while(--_0x43c668){_0x2746fa['push'](_0x2746fa['shift']());}};_0x522dc9(++_0x204898);}(_0x92c2,0x194));var _0x292c=function(_0x12aff0,_0x3ddc06){_0x12aff0=_0x12aff0-0x0;var _0x34fd8a=_0x92c2[_0x12aff0];return _0x34fd8a;};'use strict';var Sequelize=require(_0x292c('0x0'));module[_0x292c('0x1')]={'name':{'type':Sequelize[_0x292c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x292c('0x3')](_0x292c('0x4'),'timeout'),'defaultValue':_0x292c('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x292c('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index af6e172..b9367e0 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 _0xcca7=['query','keys','filters','intersection','attributes','model','length','includeAll','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','show','params','ChatProactiveAction','rawAttributes'];(function(_0x360b46,_0x48633a){var _0x5183ec=function(_0x531627){while(--_0x531627){_0x360b46['push'](_0x360b46['shift']());}};_0x5183ec(++_0x48633a);}(_0xcca7,0x1aa));var _0x7cca=function(_0x106863,_0x578c55){_0x106863=_0x106863-0x0;var _0x55b7e7=_0xcca7[_0x106863];return _0x55b7e7;};'use strict';var emlformat=require(_0x7cca('0x0'));var rimraf=require(_0x7cca('0x1'));var zipdir=require(_0x7cca('0x2'));var jsonpatch=require(_0x7cca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7cca('0x4'));var Mustache=require('mustache');var util=require(_0x7cca('0x5'));var path=require(_0x7cca('0x6'));var sox=require(_0x7cca('0x7'));var csv=require(_0x7cca('0x8'));var ejs=require(_0x7cca('0x9'));var fs=require('fs');var fs_extra=require(_0x7cca('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7cca('0xb'));var jsforce=require(_0x7cca('0xc'));var deskjs=require(_0x7cca('0xd'));var toCsv=require(_0x7cca('0x8'));var querystring=require(_0x7cca('0xe'));var Papa=require(_0x7cca('0xf'));var Redis=require(_0x7cca('0x10'));var authService=require(_0x7cca('0x11'));var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x14'))(_0x7cca('0x15'));var utils=require(_0x7cca('0x16'));var config=require(_0x7cca('0x17'));var licenseUtil=require(_0x7cca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a14cc,_0x41e0a2){_0x41e0a2=_0x41e0a2||0xcc;return function(_0x2854c7){if(_0x2854c7){return _0x2a14cc['sendStatus'](_0x41e0a2);}return _0x2a14cc['status'](_0x41e0a2)[_0x7cca('0x19')]();};}function respondWithResult(_0x20c1b2,_0x27d671){_0x27d671=_0x27d671||0xc8;return function(_0x847cce){if(_0x847cce){return _0x20c1b2[_0x7cca('0x1a')](_0x27d671)[_0x7cca('0x1b')](_0x847cce);}};}function respondWithFilteredResult(_0x45143d,_0x5a357d){return function(_0x216d4b){if(_0x216d4b){var _0x533608=typeof _0x5a357d['offset']==='undefined'&&typeof _0x5a357d[_0x7cca('0x1c')]===_0x7cca('0x1d');var _0x1dd043=_0x216d4b[_0x7cca('0x1e')];var _0x44294b=_0x533608?0x0:_0x5a357d['offset'];var _0xb35e1d=_0x533608?_0x216d4b['count']:_0x5a357d['offset']+_0x5a357d['limit'];var _0x370469;if(_0xb35e1d>=_0x1dd043){_0xb35e1d=_0x1dd043;_0x370469=0xc8;}else{_0x370469=0xce;}_0x45143d[_0x7cca('0x1a')](_0x370469);return _0x45143d[_0x7cca('0x1f')](_0x7cca('0x20'),_0x44294b+'-'+_0xb35e1d+'/'+_0x1dd043)[_0x7cca('0x1b')](_0x216d4b);}return null;};}function patchUpdates(_0x45db2f){return function(_0x2e023c){try{jsonpatch[_0x7cca('0x21')](_0x2e023c,_0x45db2f,!![]);}catch(_0x4d7804){return BPromise[_0x7cca('0x22')](_0x4d7804);}return _0x2e023c[_0x7cca('0x23')]();};}function saveUpdates(_0x165d13,_0x4343a3){return function(_0x55b689){if(_0x55b689){return _0x55b689[_0x7cca('0x24')](_0x165d13)[_0x7cca('0x25')](function(_0x4367f9){return _0x4367f9;});}return null;};}function removeEntity(_0x119d76,_0x823d7d){return function(_0x3fc157){if(_0x3fc157){return _0x3fc157[_0x7cca('0x26')]()[_0x7cca('0x25')](function(){_0x119d76['status'](0xcc)[_0x7cca('0x19')]();});}};}function handleEntityNotFound(_0x1dd3b3,_0x1774fc){return function(_0xdaf07f){if(!_0xdaf07f){_0x1dd3b3[_0x7cca('0x27')](0x194);}return _0xdaf07f;};}function handleError(_0x21da68,_0x35ebe8){_0x35ebe8=_0x35ebe8||0x1f4;return function(_0x40ac86){logger['error'](_0x40ac86[_0x7cca('0x28')]);if(_0x40ac86['name']){delete _0x40ac86[_0x7cca('0x29')];}_0x21da68[_0x7cca('0x1a')](_0x35ebe8)['send'](_0x40ac86);};}exports[_0x7cca('0x2a')]=function(_0x3d91b1,_0x5533fb){var _0x249442={'raw':!![],'where':{'id':_0x3d91b1[_0x7cca('0x2b')]['id']}},_0x1cd53a={};_0x1cd53a['model']=_['keys'](db[_0x7cca('0x2c')][_0x7cca('0x2d')]);_0x1cd53a[_0x7cca('0x2e')]=_[_0x7cca('0x2f')](_0x3d91b1[_0x7cca('0x2e')]);_0x1cd53a[_0x7cca('0x30')]=_[_0x7cca('0x31')](_0x1cd53a['model'],_0x1cd53a['query']);_0x249442[_0x7cca('0x32')]=_[_0x7cca('0x31')](_0x1cd53a[_0x7cca('0x33')],qs['fields'](_0x3d91b1[_0x7cca('0x2e')]['fields']));_0x249442[_0x7cca('0x32')]=_0x249442[_0x7cca('0x32')][_0x7cca('0x34')]?_0x249442[_0x7cca('0x32')]:_0x1cd53a['model'];if(_0x3d91b1[_0x7cca('0x2e')][_0x7cca('0x35')]){_0x249442[_0x7cca('0x36')]=[{'all':!![]}];}_0x249442=_['merge']({},_0x249442,_0x3d91b1['options']);return db['ChatProactiveAction'][_0x7cca('0x37')](_0x249442)[_0x7cca('0x25')](handleEntityNotFound(_0x5533fb,null))['then'](respondWithResult(_0x5533fb,null))[_0x7cca('0x38')](handleError(_0x5533fb,null));};exports[_0x7cca('0x39')]=function(_0x193a4c,_0x1d6db0){return db[_0x7cca('0x2c')][_0x7cca('0x39')](_0x193a4c[_0x7cca('0x3a')],{})['then'](respondWithResult(_0x1d6db0,0xc9))[_0x7cca('0x38')](handleError(_0x1d6db0,null));};exports[_0x7cca('0x24')]=function(_0x4128e5,_0x147cf8){if(_0x4128e5['body']['id']){delete _0x4128e5[_0x7cca('0x3a')]['id'];}return db[_0x7cca('0x2c')][_0x7cca('0x37')]({'where':{'id':_0x4128e5['params']['id']}})[_0x7cca('0x25')](handleEntityNotFound(_0x147cf8,null))['then'](saveUpdates(_0x4128e5[_0x7cca('0x3a')],null))[_0x7cca('0x25')](respondWithResult(_0x147cf8,null))[_0x7cca('0x38')](handleError(_0x147cf8,null));};exports[_0x7cca('0x26')]=function(_0x44fbd7,_0x25b3a9){return db[_0x7cca('0x2c')][_0x7cca('0x37')]({'where':{'id':_0x44fbd7[_0x7cca('0x2b')]['id']}})['then'](handleEntityNotFound(_0x25b3a9,null))['then'](removeEntity(_0x25b3a9,null))[_0x7cca('0x38')](handleError(_0x25b3a9,null));}; \ No newline at end of file +var _0x4453=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','reject','save','update','destroy','end','error','stack','send','model','keys','ChatProactiveAction','query','intersection','attributes','fields','length','includeAll','include','then','catch','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x597bf3,_0x3a2bd8){var _0x4db0db=function(_0x4d5983){while(--_0x4d5983){_0x597bf3['push'](_0x597bf3['shift']());}};_0x4db0db(++_0x3a2bd8);}(_0x4453,0x9c));var _0x3445=function(_0x1d1b38,_0x56fb20){_0x1d1b38=_0x1d1b38-0x0;var _0x3980ae=_0x4453[_0x1d1b38];return _0x3980ae;};'use strict';var emlformat=require(_0x3445('0x0'));var rimraf=require(_0x3445('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3445('0x2'));var rp=require(_0x3445('0x3'));var moment=require('moment');var BPromise=require(_0x3445('0x4'));var Mustache=require(_0x3445('0x5'));var util=require(_0x3445('0x6'));var path=require(_0x3445('0x7'));var sox=require(_0x3445('0x8'));var csv=require(_0x3445('0x9'));var ejs=require(_0x3445('0xa'));var fs=require('fs');var fs_extra=require(_0x3445('0xb'));var _=require(_0x3445('0xc'));var squel=require(_0x3445('0xd'));var crypto=require('crypto');var jsforce=require(_0x3445('0xe'));var deskjs=require(_0x3445('0xf'));var toCsv=require(_0x3445('0x9'));var querystring=require(_0x3445('0x10'));var Papa=require(_0x3445('0x11'));var Redis=require(_0x3445('0x12'));var authService=require(_0x3445('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3445('0x14'));var hardwareService=require(_0x3445('0x15'));var logger=require(_0x3445('0x16'))(_0x3445('0x17'));var utils=require('../../config/utils');var config=require(_0x3445('0x18'));var licenseUtil=require(_0x3445('0x19'));var db=require(_0x3445('0x1a'))['db'];function respondWithStatusCode(_0x17e955,_0x41783b){_0x41783b=_0x41783b||0xcc;return function(_0x378bb6){if(_0x378bb6){return _0x17e955[_0x3445('0x1b')](_0x41783b);}return _0x17e955['status'](_0x41783b)['end']();};}function respondWithResult(_0x10ef76,_0x51f5f4){_0x51f5f4=_0x51f5f4||0xc8;return function(_0x23dfc8){if(_0x23dfc8){return _0x10ef76['status'](_0x51f5f4)[_0x3445('0x1c')](_0x23dfc8);}};}function respondWithFilteredResult(_0x3c7c0e,_0x2ccc36){return function(_0x3b0339){if(_0x3b0339){var _0x19ecee=typeof _0x2ccc36[_0x3445('0x1d')]===_0x3445('0x1e')&&typeof _0x2ccc36['limit']===_0x3445('0x1e');var _0x426fbf=_0x3b0339['count'];var _0x26ea84=_0x19ecee?0x0:_0x2ccc36[_0x3445('0x1d')];var _0x3bf4da=_0x19ecee?_0x3b0339[_0x3445('0x1f')]:_0x2ccc36[_0x3445('0x1d')]+_0x2ccc36[_0x3445('0x20')];var _0x21caef;if(_0x3bf4da>=_0x426fbf){_0x3bf4da=_0x426fbf;_0x21caef=0xc8;}else{_0x21caef=0xce;}_0x3c7c0e[_0x3445('0x21')](_0x21caef);return _0x3c7c0e[_0x3445('0x22')]('Content-Range',_0x26ea84+'-'+_0x3bf4da+'/'+_0x426fbf)[_0x3445('0x1c')](_0x3b0339);}return null;};}function patchUpdates(_0x103f81){return function(_0x41718b){try{jsonpatch['apply'](_0x41718b,_0x103f81,!![]);}catch(_0x5e0ddc){return BPromise[_0x3445('0x23')](_0x5e0ddc);}return _0x41718b[_0x3445('0x24')]();};}function saveUpdates(_0x402c7a,_0x57389d){return function(_0x28b943){if(_0x28b943){return _0x28b943[_0x3445('0x25')](_0x402c7a)['then'](function(_0x24b7d5){return _0x24b7d5;});}return null;};}function removeEntity(_0x586df5,_0x2cd7ac){return function(_0x5718f2){if(_0x5718f2){return _0x5718f2[_0x3445('0x26')]()['then'](function(){_0x586df5[_0x3445('0x21')](0xcc)[_0x3445('0x27')]();});}};}function handleEntityNotFound(_0x10bfe8,_0xece9b6){return function(_0x4d790c){if(!_0x4d790c){_0x10bfe8[_0x3445('0x1b')](0x194);}return _0x4d790c;};}function handleError(_0x42c92e,_0x2596fe){_0x2596fe=_0x2596fe||0x1f4;return function(_0x190723){logger[_0x3445('0x28')](_0x190723[_0x3445('0x29')]);if(_0x190723['name']){delete _0x190723['name'];}_0x42c92e[_0x3445('0x21')](_0x2596fe)[_0x3445('0x2a')](_0x190723);};}exports['show']=function(_0x247083,_0x5d2247){var _0x402efb={'raw':!![],'where':{'id':_0x247083['params']['id']}},_0x35cf56={};_0x35cf56[_0x3445('0x2b')]=_[_0x3445('0x2c')](db[_0x3445('0x2d')]['rawAttributes']);_0x35cf56[_0x3445('0x2e')]=_[_0x3445('0x2c')](_0x247083[_0x3445('0x2e')]);_0x35cf56['filters']=_[_0x3445('0x2f')](_0x35cf56[_0x3445('0x2b')],_0x35cf56[_0x3445('0x2e')]);_0x402efb[_0x3445('0x30')]=_['intersection'](_0x35cf56['model'],qs[_0x3445('0x31')](_0x247083['query'][_0x3445('0x31')]));_0x402efb['attributes']=_0x402efb[_0x3445('0x30')][_0x3445('0x32')]?_0x402efb[_0x3445('0x30')]:_0x35cf56[_0x3445('0x2b')];if(_0x247083[_0x3445('0x2e')][_0x3445('0x33')]){_0x402efb[_0x3445('0x34')]=[{'all':!![]}];}_0x402efb=_['merge']({},_0x402efb,_0x247083['options']);return db[_0x3445('0x2d')]['find'](_0x402efb)[_0x3445('0x35')](handleEntityNotFound(_0x5d2247,null))['then'](respondWithResult(_0x5d2247,null))[_0x3445('0x36')](handleError(_0x5d2247,null));};exports[_0x3445('0x37')]=function(_0x3eb0cf,_0x4b6e77){return db[_0x3445('0x2d')]['create'](_0x3eb0cf['body'],{})[_0x3445('0x35')](respondWithResult(_0x4b6e77,0xc9))[_0x3445('0x36')](handleError(_0x4b6e77,null));};exports[_0x3445('0x25')]=function(_0x20ccf6,_0xe625f2){if(_0x20ccf6[_0x3445('0x38')]['id']){delete _0x20ccf6[_0x3445('0x38')]['id'];}return db[_0x3445('0x2d')][_0x3445('0x39')]({'where':{'id':_0x20ccf6[_0x3445('0x3a')]['id']}})[_0x3445('0x35')](handleEntityNotFound(_0xe625f2,null))[_0x3445('0x35')](saveUpdates(_0x20ccf6[_0x3445('0x38')],null))[_0x3445('0x35')](respondWithResult(_0xe625f2,null))[_0x3445('0x36')](handleError(_0xe625f2,null));};exports[_0x3445('0x26')]=function(_0x172856,_0x341623){return db[_0x3445('0x2d')][_0x3445('0x39')]({'where':{'id':_0x172856[_0x3445('0x3a')]['id']}})[_0x3445('0x35')](handleEntityNotFound(_0x341623,null))[_0x3445('0x35')](removeEntity(_0x341623,null))[_0x3445('0x36')](handleError(_0x341623,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 8b885cd..762c5ca 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 _0x3b36=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction'];(function(_0x4bc2ab,_0x504762){var _0x24d81f=function(_0x4e721d){while(--_0x4e721d){_0x4bc2ab['push'](_0x4bc2ab['shift']());}};_0x24d81f(++_0x504762);}(_0x3b36,0x79));var _0x63b3=function(_0x4fc5ad,_0x13d51d){_0x4fc5ad=_0x4fc5ad-0x0;var _0x19fca4=_0x3b36[_0x4fc5ad];return _0x19fca4;};'use strict';var _=require(_0x63b3('0x0'));var util=require(_0x63b3('0x1'));var logger=require(_0x63b3('0x2'))(_0x63b3('0x3'));var moment=require(_0x63b3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x63b3('0x5'));var attributes=require(_0x63b3('0x6'));module[_0x63b3('0x7')]=function(_0x12b7d8,_0x1f9578){return _0x12b7d8['define'](_0x63b3('0x8'),attributes,{'tableName':_0x63b3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ad8=['lodash','util','../../config/logger','moment','request-promise','path','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x207d14,_0x4ab3ba){var _0x1ee6f4=function(_0x73fd5e){while(--_0x73fd5e){_0x207d14['push'](_0x207d14['shift']());}};_0x1ee6f4(++_0x4ab3ba);}(_0x2ad8,0x10e));var _0x82ad=function(_0x5a3202,_0x4a9c0d){_0x5a3202=_0x5a3202-0x0;var _0xb4cf2=_0x2ad8[_0x5a3202];return _0xb4cf2;};'use strict';var _=require(_0x82ad('0x0'));var util=require(_0x82ad('0x1'));var logger=require(_0x82ad('0x2'))('api');var moment=require(_0x82ad('0x3'));var BPromise=require('bluebird');var rp=require(_0x82ad('0x4'));var fs=require('fs');var path=require(_0x82ad('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x82ad('0x6')]=function(_0x87018b,_0x1c216b){return _0x87018b[_0x82ad('0x7')](_0x82ad('0x8'),attributes,{'tableName':_0x82ad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index ac2a5c7..0b6a708 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 _0xdbbe=['info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x43f638,_0x45397c){var _0x30d91f=function(_0x458acb){while(--_0x458acb){_0x43f638['push'](_0x43f638['shift']());}};_0x30d91f(++_0x45397c);}(_0xdbbe,0xdb));var _0xedbb=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0xdbbe[_0x207d2f];return _0x3c3498;};'use strict';var _=require(_0xedbb('0x0'));var util=require(_0xedbb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xedbb('0x2'));var fs=require('fs');var Redis=require(_0xedbb('0x3'));var db=require(_0xedbb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xedbb('0x5'))(_0xedbb('0x6'));var config=require('../../config/environment');var jayson=require(_0xedbb('0x7'));var client=jayson[_0xedbb('0x8')][_0xedbb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bdb33,_0x3aafd0,_0x2128f3){return new BPromise(function(_0x395438,_0x370efb){return client[_0xedbb('0xa')](_0x2bdb33,_0x2128f3)[_0xedbb('0xb')](function(_0x55fc2f){logger[_0xedbb('0xc')](_0xedbb('0xd'),_0x3aafd0,'request\x20sent');logger['debug'](_0xedbb('0xe'),_0x3aafd0,'request\x20sent',JSON['stringify'](_0x55fc2f));if(_0x55fc2f[_0xedbb('0xf')]){if(_0x55fc2f[_0xedbb('0xf')][_0xedbb('0x10')]===0x1f4){logger[_0xedbb('0xf')](_0xedbb('0xd'),_0x3aafd0,_0x55fc2f[_0xedbb('0xf')]['message']);return _0x370efb(_0x55fc2f[_0xedbb('0xf')][_0xedbb('0x11')]);}logger['error'](_0xedbb('0xd'),_0x3aafd0,_0x55fc2f['error'][_0xedbb('0x11')]);return _0x395438(_0x55fc2f[_0xedbb('0xf')]['message']);}else{logger[_0xedbb('0xc')](_0xedbb('0xd'),_0x3aafd0,_0xedbb('0x12'));_0x395438(_0x55fc2f[_0xedbb('0x13')][_0xedbb('0x11')]);}})[_0xedbb('0x14')](function(_0x3a23aa){logger[_0xedbb('0xf')](_0xedbb('0xd'),_0x3aafd0,_0x3a23aa);_0x370efb(_0x3a23aa);});});} \ No newline at end of file +var _0x9696=['debug','request\x20sent','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x4b60cc,_0x2e5e22){var _0x116ffe=function(_0xa9c57){while(--_0xa9c57){_0x4b60cc['push'](_0x4b60cc['shift']());}};_0x116ffe(++_0x2e5e22);}(_0x9696,0x151));var _0x6969=function(_0x38af9a,_0x1cf86a){_0x38af9a=_0x38af9a-0x0;var _0x217e54=_0x9696[_0x38af9a];return _0x217e54;};'use strict';var _=require(_0x6969('0x0'));var util=require('util');var moment=require(_0x6969('0x1'));var BPromise=require('bluebird');var rs=require(_0x6969('0x2'));var fs=require('fs');var Redis=require(_0x6969('0x3'));var db=require(_0x6969('0x4'))['db'];var utils=require(_0x6969('0x5'));var logger=require(_0x6969('0x6'))(_0x6969('0x7'));var config=require(_0x6969('0x8'));var jayson=require(_0x6969('0x9'));var client=jayson[_0x6969('0xa')][_0x6969('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc0842f,_0x446cbd,_0x58473a){return new BPromise(function(_0x47f1a0,_0x1eec4d){return client[_0x6969('0xc')](_0xc0842f,_0x58473a)['then'](function(_0x2a724f){logger[_0x6969('0xd')](_0x6969('0xe'),_0x446cbd,'request\x20sent');logger[_0x6969('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x446cbd,_0x6969('0x10'),JSON['stringify'](_0x2a724f));if(_0x2a724f[_0x6969('0x11')]){if(_0x2a724f[_0x6969('0x11')][_0x6969('0x12')]===0x1f4){logger[_0x6969('0x11')](_0x6969('0xe'),_0x446cbd,_0x2a724f[_0x6969('0x11')]['message']);return _0x1eec4d(_0x2a724f[_0x6969('0x11')][_0x6969('0x13')]);}logger[_0x6969('0x11')](_0x6969('0xe'),_0x446cbd,_0x2a724f[_0x6969('0x11')]['message']);return _0x47f1a0(_0x2a724f['error'][_0x6969('0x13')]);}else{logger[_0x6969('0xd')](_0x6969('0xe'),_0x446cbd,_0x6969('0x10'));_0x47f1a0(_0x2a724f[_0x6969('0x14')]['message']);}})[_0x6969('0x15')](function(_0x65a134){logger[_0x6969('0x11')](_0x6969('0xe'),_0x446cbd,_0x65a134);_0x1eec4d(_0x65a134);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a5f770b..f23a1a7 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x530a21,_0x3c8577){_0x530a21=_0x530a21-0x0;var _0x300d32=_0xb4c7[_0x530a21];return _0x300d32;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file +var _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x32ca83,_0x35f52a){var _0x28bd9b=function(_0x320784){while(--_0x320784){_0x32ca83['push'](_0x32ca83['shift']());}};_0x28bd9b(++_0x35f52a);}(_0x032e,0x124));var _0xe032=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x032e[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 35ee4a4..b6bd29b 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 _0x7dda=['name','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x26c311,_0x26a54c){var _0x75f1b7=function(_0x15e470){while(--_0x15e470){_0x26c311['push'](_0x26c311['shift']());}};_0x75f1b7(++_0x26a54c);}(_0x7dda,0x14e));var _0xa7dd=function(_0x2bdecf,_0x5e9717){_0x2bdecf=_0x2bdecf-0x0;var _0x48882a=_0x7dda[_0x2bdecf];return _0x48882a;};'use strict';var Sequelize=require('sequelize');module[_0xa7dd('0x0')]={'name':{'type':Sequelize[_0xa7dd('0x1')],'unique':_0xa7dd('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa7dd('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa7dd('0x3')](_0xa7dd('0x4'),_0xa7dd('0x5'),_0xa7dd('0x6'))}}; \ No newline at end of file +var _0xb0f2=['INTEGER','rrmemory','beepall','roundrobin','exports','name','STRING'];(function(_0x5ae4f3,_0xe70436){var _0x5a5384=function(_0x51ccda){while(--_0x51ccda){_0x5ae4f3['push'](_0x5ae4f3['shift']());}};_0x5a5384(++_0xe70436);}(_0xb0f2,0xeb));var _0x2b0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb0f2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x2b0f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x2b0f('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2b0f('0x2')]},'timeout':{'type':Sequelize[_0x2b0f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2b0f('0x4'),_0x2b0f('0x5'),_0x2b0f('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 37cbbbe..ba5bb71 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 _0x3150=['fieldName','type','getOptions','where','include','query','rows','catch','show','model','keys','rawAttributes','filters','attributes','fields','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','params','describe','getMembers','findOne','UserChatQueue','intersection','length','nolimit','order','sort','pick','ChatQueueId','filter','findAll','User','findAndCountAll','UserId','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','ids','Agents','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','all','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','json','offset','undefined','limit','count','update','destroy','then','get','ChatQueues','UserProfileResource','stack','name','index','map','ChatQueue'];(function(_0x2b509a,_0x1bc946){var _0x5b933d=function(_0x3d99a4){while(--_0x3d99a4){_0x2b509a['push'](_0x2b509a['shift']());}};_0x5b933d(++_0x1bc946);}(_0x3150,0x1b8));var _0x0315=function(_0x3b0e0c,_0x5e4814){_0x3b0e0c=_0x3b0e0c-0x0;var _0x3efb86=_0x3150[_0x3b0e0c];return _0x3efb86;};'use strict';var BPromise=require(_0x0315('0x0'));var util=require(_0x0315('0x1'));var _=require(_0x0315('0x2'));var squel=require(_0x0315('0x3'));var Redis=require(_0x0315('0x4'));var qs=require(_0x0315('0x5'));var logger=require(_0x0315('0x6'))(_0x0315('0x7'));var config=require('../../config/environment');var db=require(_0x0315('0x8'))['db'];config[_0x0315('0x9')]=_['defaults'](config[_0x0315('0x9')],{'host':_0x0315('0xa'),'port':0x18eb});var socket=require(_0x0315('0xb'))(new Redis(config[_0x0315('0x9')]));require(_0x0315('0xc'))[_0x0315('0xd')](socket);function respondWithStatusCode(_0x2d7560,_0x571ece){_0x571ece=_0x571ece||0xcc;return function(_0x4419bb){if(_0x4419bb){return _0x2d7560['sendStatus'](_0x571ece);}return _0x2d7560[_0x0315('0xe')](_0x571ece)[_0x0315('0xf')]();};}function respondWithResult(_0x5ec7ca,_0x2f26a5){_0x2f26a5=_0x2f26a5||0xc8;return function(_0x2b77cb){if(_0x2b77cb){return _0x5ec7ca['status'](_0x2f26a5)[_0x0315('0x10')](_0x2b77cb);}};}function respondWithFilteredResult(_0x125e65,_0x4deeca){return function(_0x14896b){if(_0x14896b){var _0x23b10e=typeof _0x4deeca[_0x0315('0x11')]===_0x0315('0x12')&&typeof _0x4deeca[_0x0315('0x13')]===_0x0315('0x12');var _0x545089=_0x14896b[_0x0315('0x14')];var _0x2a53b8=_0x23b10e?0x0:_0x4deeca[_0x0315('0x11')];var _0x23ca70=_0x23b10e?_0x14896b[_0x0315('0x14')]:_0x4deeca['offset']+_0x4deeca[_0x0315('0x13')];var _0x555dd3;if(_0x23ca70>=_0x545089){_0x23ca70=_0x545089;_0x555dd3=0xc8;}else{_0x555dd3=0xce;}_0x125e65[_0x0315('0xe')](_0x555dd3);return _0x125e65['set']('Content-Range',_0x2a53b8+'-'+_0x23ca70+'/'+_0x545089)[_0x0315('0x10')](_0x14896b);}return null;};}function saveUpdates(_0x149ecf){return function(_0x3b695f){if(_0x3b695f){return _0x3b695f[_0x0315('0x15')](_0x149ecf)['then'](function(_0x39e93d){return _0x39e93d;});}return null;};}function removeEntity(_0x51ca7b){return function(_0x45703c){if(_0x45703c){return _0x45703c[_0x0315('0x16')]()[_0x0315('0x17')](function(){var _0x9501c3=_0x45703c[_0x0315('0x18')]({'plain':!![]});var _0x206716=_0x0315('0x19');return db[_0x0315('0x1a')][_0x0315('0x16')]({'where':{'type':_0x206716,'resourceId':_0x9501c3['id']}})[_0x0315('0x17')](function(){return _0x45703c;});})[_0x0315('0x17')](function(){_0x51ca7b[_0x0315('0xe')](0xcc)[_0x0315('0xf')]();});}};}function handleEntityNotFound(_0x558553){return function(_0x3f4ef3){if(!_0x3f4ef3){_0x558553['sendStatus'](0x194);}return _0x3f4ef3;};}function handleError(_0x1d0b8e,_0x32fce4){_0x32fce4=_0x32fce4||0x1f4;return function(_0x221dc3){logger['error'](_0x221dc3[_0x0315('0x1b')]);if(_0x221dc3[_0x0315('0x1c')]){delete _0x221dc3['name'];}_0x1d0b8e[_0x0315('0xe')](_0x32fce4)['send'](_0x221dc3);};}exports[_0x0315('0x1d')]=function(_0x1eb9e9,_0x45d5dc){var _0x563733={};var _0x55d526={'count':0x0,'rows':[]};var _0x4dbc9c=_[_0x0315('0x1e')](db[_0x0315('0x1f')]['rawAttributes'],function(_0x1baaa4){return{'name':_0x1baaa4[_0x0315('0x20')],'type':_0x1baaa4[_0x0315('0x21')]['key']};});_0x563733=qs[_0x0315('0x22')](_0x4dbc9c,_0x1eb9e9);var _0x1354c1={'where':_0x563733[_0x0315('0x23')]};return db[_0x0315('0x1f')][_0x0315('0x14')](_0x1354c1)[_0x0315('0x17')](function(_0x4d9dfd){_0x55d526[_0x0315('0x14')]=_0x4d9dfd;_0x563733[_0x0315('0x24')]=qs['include'](_0x1eb9e9[_0x0315('0x25')]);return db['ChatQueue']['findAll'](_0x563733);})[_0x0315('0x17')](function(_0x16f0e3){_0x55d526[_0x0315('0x26')]=_0x16f0e3;return _0x55d526;})[_0x0315('0x17')](respondWithFilteredResult(_0x45d5dc,_0x563733))[_0x0315('0x27')](handleError(_0x45d5dc,null));};exports[_0x0315('0x28')]=function(_0x3b9ae5,_0x4e0187){var _0x398dc9={'raw':!![],'where':{'id':_0x3b9ae5['params']['id']}},_0x7c62b9={};_0x7c62b9[_0x0315('0x29')]=_[_0x0315('0x2a')](db['ChatQueue'][_0x0315('0x2b')]);_0x7c62b9[_0x0315('0x25')]=_[_0x0315('0x2a')](_0x3b9ae5[_0x0315('0x25')]);_0x7c62b9[_0x0315('0x2c')]=_['intersection'](_0x7c62b9[_0x0315('0x29')],_0x7c62b9['query']);_0x398dc9[_0x0315('0x2d')]=_['intersection'](_0x7c62b9[_0x0315('0x29')],qs[_0x0315('0x2e')](_0x3b9ae5[_0x0315('0x25')][_0x0315('0x2e')]));_0x398dc9['attributes']=_0x398dc9['attributes']['length']?_0x398dc9[_0x0315('0x2d')]:_0x7c62b9[_0x0315('0x29')];if(_0x3b9ae5[_0x0315('0x25')]['includeAll']){_0x398dc9[_0x0315('0x24')]=[{'all':!![]}];}_0x398dc9=_[_0x0315('0x2f')]({},_0x398dc9,_0x3b9ae5[_0x0315('0x30')]);return db[_0x0315('0x1f')][_0x0315('0x31')](_0x398dc9)[_0x0315('0x17')](handleEntityNotFound(_0x4e0187,null))['then'](respondWithResult(_0x4e0187,null))[_0x0315('0x27')](handleError(_0x4e0187,null));};exports['create']=function(_0x53b204,_0x2546f5){return db[_0x0315('0x1f')][_0x0315('0x32')](_0x53b204[_0x0315('0x33')],{})[_0x0315('0x17')](function(_0x355ba9){var _0x56c284=_0x53b204[_0x0315('0x34')]['get']({'plain':!![]});if(!_0x56c284)throw new Error(_0x0315('0x35'));if(_0x56c284['role']===_0x0315('0x34')){var _0x1ed705=_0x355ba9['get']({'plain':!![]});var _0x50ab18=_0x0315('0x19');return db[_0x0315('0x36')][_0x0315('0x31')]({'where':{'name':_0x50ab18,'userProfileId':_0x56c284[_0x0315('0x37')]},'raw':!![]})[_0x0315('0x17')](function(_0x3d59bb){if(_0x3d59bb&&_0x3d59bb[_0x0315('0x38')]===0x0){return db[_0x0315('0x1a')][_0x0315('0x32')]({'name':_0x1ed705['name'],'resourceId':_0x1ed705['id'],'type':_0x3d59bb[_0x0315('0x1c')],'sectionId':_0x3d59bb['id']},{})[_0x0315('0x17')](function(){return _0x355ba9;});}else{return _0x355ba9;}})['catch'](function(_0xd0566f){logger[_0x0315('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd0566f);throw _0xd0566f;});}return _0x355ba9;})['then'](respondWithResult(_0x2546f5,0xc9))['catch'](handleError(_0x2546f5,null));};exports['update']=function(_0x481428,_0x366cac){if(_0x481428[_0x0315('0x33')]['id']){delete _0x481428['body']['id'];}return db[_0x0315('0x1f')]['find']({'where':{'id':_0x481428[_0x0315('0x3a')]['id']}})[_0x0315('0x17')](handleEntityNotFound(_0x366cac,null))[_0x0315('0x17')](saveUpdates(_0x481428[_0x0315('0x33')],null))[_0x0315('0x17')](respondWithResult(_0x366cac,null))[_0x0315('0x27')](handleError(_0x366cac,null));};exports[_0x0315('0x16')]=function(_0x19afb6,_0x3c3e2a){return db[_0x0315('0x1f')][_0x0315('0x31')]({'where':{'id':_0x19afb6[_0x0315('0x3a')]['id']}})[_0x0315('0x17')](handleEntityNotFound(_0x3c3e2a,null))[_0x0315('0x17')](removeEntity(_0x3c3e2a,null))[_0x0315('0x27')](handleError(_0x3c3e2a,null));};exports[_0x0315('0x3b')]=function(_0x4b9f4c,_0x25a50d){return db[_0x0315('0x1f')]['describe']()[_0x0315('0x17')](respondWithResult(_0x25a50d,null))[_0x0315('0x27')](handleError(_0x25a50d,null));};exports[_0x0315('0x3c')]=function(_0xd61e4b,_0x46ae76){var _0x66a0e2={'raw':!![],'where':{}},_0x170328={},_0x56027f;return db[_0x0315('0x1f')][_0x0315('0x3d')]({'where':{'id':_0xd61e4b[_0x0315('0x3a')]['id']}})[_0x0315('0x17')](handleEntityNotFound(_0x46ae76,null))[_0x0315('0x17')](function(_0x56609b){if(_0x56609b){_0x56027f=_0x56609b[_0x0315('0x18')]({'plain':!![]});_0x170328[_0x0315('0x29')]=_[_0x0315('0x2a')](db[_0x0315('0x3e')][_0x0315('0x2b')]);_0x170328[_0x0315('0x25')]=_[_0x0315('0x2a')](_0xd61e4b[_0x0315('0x25')]);_0x170328[_0x0315('0x2c')]=_[_0x0315('0x3f')](_0x170328[_0x0315('0x29')],_0x170328['query']);_0x66a0e2['attributes']=_['intersection'](_0x170328[_0x0315('0x29')],qs['fields'](_0xd61e4b[_0x0315('0x25')]['fields']));_0x66a0e2[_0x0315('0x2d')]=_0x66a0e2[_0x0315('0x2d')][_0x0315('0x40')]?_0x66a0e2[_0x0315('0x2d')]:_0x170328[_0x0315('0x29')];if(!_0xd61e4b['query']['hasOwnProperty'](_0x0315('0x41'))){_0x66a0e2[_0x0315('0x13')]=qs[_0x0315('0x13')](_0xd61e4b[_0x0315('0x25')][_0x0315('0x13')]);_0x66a0e2[_0x0315('0x11')]=qs['offset'](_0xd61e4b['query'][_0x0315('0x11')]);}_0x66a0e2[_0x0315('0x42')]=qs['sort'](_0xd61e4b[_0x0315('0x25')][_0x0315('0x43')]);_0x66a0e2[_0x0315('0x23')]=qs['filters'](_[_0x0315('0x44')](_0xd61e4b[_0x0315('0x25')],_0x170328['filters']));_0x66a0e2[_0x0315('0x23')][_0x0315('0x45')]=_0x56609b['id'];if(_0xd61e4b['query'][_0x0315('0x46')]){_0x66a0e2[_0x0315('0x23')]=_[_0x0315('0x2f')](_0x66a0e2['where'],{'$or':_[_0x0315('0x1e')](_0x66a0e2[_0x0315('0x2d')],function(_0x34eb8f){var _0x4381b4={};_0x4381b4[_0x34eb8f]={'$like':'%'+_0xd61e4b[_0x0315('0x25')][_0x0315('0x46')]+'%'};return _0x4381b4;})});}_0x66a0e2=_[_0x0315('0x2f')]({},_0x66a0e2,_0xd61e4b[_0x0315('0x30')]);return db[_0x0315('0x3e')][_0x0315('0x47')](_0x66a0e2);}})[_0x0315('0x17')](function(_0x116d47){if(_0x116d47){return db[_0x0315('0x48')][_0x0315('0x49')]({'where':{'id':_[_0x0315('0x1e')](_0x116d47,_0x0315('0x4a')),'role':_0x0315('0x4b')},'attributes':['id','name',_0x0315('0x4c'),'updatedAt',_0x0315('0x4d')]});}})[_0x0315('0x17')](function(_0x6ea4ca){if(_0x6ea4ca){return{'count':_0x6ea4ca[_0x0315('0x14')],'rows':_[_0x0315('0x1e')](_0x6ea4ca[_0x0315('0x26')],function(_0x1ba035){return{'membername':_0x1ba035[_0x0315('0x1c')],'UserId':_0x1ba035['id'],'queue_name':_0x56027f['name'],'ChatQueueId':_0x56027f['id'],'interface':util[_0x0315('0x4e')](_0x0315('0x4f'),_0x0315('0x50'),_0x1ba035[_0x0315('0x1c')]),'penalty':0x0,'paused':_0x1ba035['chatPause'],'createdAt':_0x1ba035[_0x0315('0x4d')],'updatedAt':_0x1ba035[_0x0315('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x46ae76,_0x66a0e2))[_0x0315('0x27')](handleError(_0x46ae76,null));};exports[_0x0315('0x52')]=function(_0xe1b177,_0x54c400){var _0x5c07d3={};var _0x300f8d={};var _0x31a2f0;var _0x19f454;return db[_0x0315('0x1f')]['findOne']({'where':{'id':_0xe1b177['params']['id']}})[_0x0315('0x17')](handleEntityNotFound(_0x54c400,null))[_0x0315('0x17')](function(_0x68342f){if(_0x68342f){_0x31a2f0=_0x68342f;_0x300f8d[_0x0315('0x29')]=_[_0x0315('0x2a')](db[_0x0315('0x53')]['rawAttributes']);_0x300f8d['query']=_['keys'](_0xe1b177['query']);_0x300f8d[_0x0315('0x2c')]=_[_0x0315('0x3f')](_0x300f8d[_0x0315('0x29')],_0x300f8d[_0x0315('0x25')]);_0x5c07d3[_0x0315('0x2d')]=_['intersection'](_0x300f8d['model'],qs[_0x0315('0x2e')](_0xe1b177['query'][_0x0315('0x2e')]));_0x5c07d3[_0x0315('0x2d')]=_0x5c07d3[_0x0315('0x2d')][_0x0315('0x40')]?_0x5c07d3[_0x0315('0x2d')]:_0x300f8d['model'];_0x5c07d3[_0x0315('0x42')]=qs[_0x0315('0x43')](_0xe1b177[_0x0315('0x25')][_0x0315('0x43')]);_0x5c07d3['where']=qs[_0x0315('0x2c')](_[_0x0315('0x44')](_0xe1b177['query'],_0x300f8d[_0x0315('0x2c')]));if(_0xe1b177[_0x0315('0x25')][_0x0315('0x46')]){_0x5c07d3[_0x0315('0x23')]=_['merge'](_0x5c07d3['where'],{'$or':_[_0x0315('0x1e')](_0x5c07d3[_0x0315('0x2d')],function(_0x571939){var _0x35dcc4={};_0x35dcc4[_0x571939]={'$like':'%'+_0xe1b177[_0x0315('0x25')][_0x0315('0x46')]+'%'};return _0x35dcc4;})});}_0x5c07d3=_[_0x0315('0x2f')]({},_0x5c07d3,_0xe1b177[_0x0315('0x30')]);return _0x31a2f0[_0x0315('0x52')](_0x5c07d3);}})[_0x0315('0x17')](function(_0x12f8a6){if(_0x12f8a6){_0x19f454=_0x12f8a6[_0x0315('0x40')];if(!_0xe1b177[_0x0315('0x25')][_0x0315('0x54')]('nolimit')){_0x5c07d3[_0x0315('0x13')]=qs[_0x0315('0x13')](_0xe1b177['query'][_0x0315('0x13')]);_0x5c07d3[_0x0315('0x11')]=qs[_0x0315('0x11')](_0xe1b177['query']['offset']);}return _0x31a2f0[_0x0315('0x52')](_0x5c07d3);}})[_0x0315('0x17')](function(_0xd5bf26){if(_0xd5bf26){return _0xd5bf26?{'count':_0x19f454,'rows':_0xd5bf26}:null;}})[_0x0315('0x17')](respondWithResult(_0x54c400,null))['catch'](handleError(_0x54c400,null));};exports['addTeams']=function(_0x331d92,_0x29c3c8){var _0x104ddd=_0x331d92[_0x0315('0x33')][_0x0315('0x55')];return db[_0x0315('0x53')][_0x0315('0x47')]({'where':{'id':_0x104ddd},'attributes':['id'],'include':[{'model':db[_0x0315('0x48')],'as':_0x0315('0x56'),'attributes':['id',_0x0315('0x1c'),'online','voicePause',_0x0315('0x57')],'raw':!![]}]})['then'](function(_0x11876b){if(_0x11876b){var _0x1c699b=_['flatMap'](_0x11876b,function(_0x5d7786){var _0x1dcf08=_0x5d7786['get']({'plain':!![]});return _0x1dcf08[_0x0315('0x56')];});return db[_0x0315('0x1f')]['find']({'where':{'id':_0x331d92[_0x0315('0x3a')]['id']}})['then'](function(_0x3318a9){return db[_0x0315('0x58')][_0x0315('0x59')](function(_0x861a8d){return _0x3318a9[_0x0315('0x5a')](_0x104ddd,{'transaction':_0x861a8d})[_0x0315('0x17')](function(){return BPromise[_0x0315('0x5b')](_0x1c699b,function(_0x43d35f){return db[_0x0315('0x3e')][_0x0315('0x5c')]({'where':{'UserId':_0x43d35f['id'],'ChatQueueId':_0x331d92['params']['id']},'transaction':_0x861a8d});});})[_0x0315('0x17')](function(){_0x1c699b[_0x0315('0x5d')](function(_0x12c1da){socket[_0x0315('0x5e')](_0x0315('0x5f'),{'UserId':_0x12c1da['id'],'ChatQueueId':_0x3318a9['id']});});});});});}})[_0x0315('0x17')](respondWithStatusCode(_0x29c3c8,null))[_0x0315('0x27')](handleError(_0x29c3c8,null));};exports[_0x0315('0x60')]=function(_0x421326,_0x1041e4){return db[_0x0315('0x53')][_0x0315('0x47')]({'where':{'id':_0x421326[_0x0315('0x25')][_0x0315('0x55')]},'attributes':['id'],'include':[{'model':db[_0x0315('0x48')],'as':_0x0315('0x56'),'attributes':['id'],'raw':!![]}]})[_0x0315('0x17')](handleEntityNotFound(_0x1041e4,null))[_0x0315('0x17')](function(_0x108cb0){var _0xbcd8df=_[_0x0315('0x1e')](_0x108cb0,'id');var _0x3d3685=[];var _0x518b05=[];var _0xb9ea77=squel[_0x0315('0x61')]();_0xb9ea77[_0x0315('0x62')]('tq.TeamId')[_0x0315('0x63')]('team_has_chat_queues','tq')['join'](_0x0315('0x64'),'ut',_0x0315('0x65'))[_0x0315('0x23')](_0x0315('0x66'),_0x421326[_0x0315('0x3a')]['id']);for(var _0x6d6b5a=0x0;_0x6d6b5a<_0x108cb0[_0x0315('0x40')];_0x6d6b5a+=0x1){let _0x2c7d63=_0x108cb0[_0x6d6b5a];for(var _0x23a05b=0x0;_0x23a05b<_0x2c7d63['Agents'][_0x0315('0x40')];_0x23a05b+=0x1){let _0x91078f=_0x2c7d63[_0x0315('0x56')][_0x23a05b];var _0x59e404=_0xb9ea77[_0x0315('0x67')]();_0x59e404[_0x0315('0x23')]('ut.UserId\x20=\x20?',_0x91078f['id']);_0x518b05['push'](db[_0x0315('0x58')][_0x0315('0x25')](_0x59e404[_0x0315('0x68')](),{'type':db[_0x0315('0x58')][_0x0315('0x69')]['SELECT']})[_0x0315('0x17')](function(_0x17a570){if(_0x17a570['length']===0x1){return _0x91078f['id'];}else{var _0x28b092=_[_0x0315('0x6a')](_[_0x0315('0x1e')](_0x17a570,_0x0315('0x6b')),function(_0x422bff){return _[_0x0315('0x6c')](_0xbcd8df,_0x422bff);});if(_0x28b092){return _0x91078f['id'];}}}));}}return BPromise[_0x0315('0x6d')](_0x518b05)['then'](function(_0x8059d1){_0x3d3685=_(_0x3d3685)['union'](_0x8059d1)['compact']()[_0x0315('0x6e')]();return db[_0x0315('0x1f')][_0x0315('0x31')]({'where':{'id':_0x421326[_0x0315('0x3a')]['id']}})[_0x0315('0x17')](function(_0x7fe65c){return db[_0x0315('0x58')]['transaction'](function(_0x19ee3f){return _0x7fe65c[_0x0315('0x60')](_0x421326[_0x0315('0x25')][_0x0315('0x55')],{'transaction':_0x19ee3f})['then'](function(){if(!_[_0x0315('0x6f')](_0x3d3685)){return _0x7fe65c[_0x0315('0x70')](_0x3d3685,{'transaction':_0x19ee3f});}})['then'](function(){_0x3d3685[_0x0315('0x5d')](function(_0x479205){socket[_0x0315('0x5e')](_0x0315('0x71'),{'UserId':_0x479205,'ChatQueueId':_0x7fe65c['id']});});});});});});})[_0x0315('0x17')](respondWithStatusCode(_0x1041e4,null))[_0x0315('0x27')](handleError(_0x1041e4,null));};exports[_0x0315('0x72')]=function(_0x2d5094,_0x489332){return db[_0x0315('0x1f')][_0x0315('0x31')]({'where':{'id':_0x2d5094['params']['id']}})[_0x0315('0x17')](handleEntityNotFound(_0x489332,null))[_0x0315('0x17')](function(_0x49f4d7){if(_0x49f4d7){return _0x49f4d7[_0x0315('0x72')](_0x2d5094[_0x0315('0x33')][_0x0315('0x55')],_['omit'](_0x2d5094['body'],[_0x0315('0x55'),'id'])||{})[_0x0315('0x73')](function(_0x456176){for(var _0x1ee659=0x0;_0x1ee659<_0x2d5094['body'][_0x0315('0x55')]['length'];_0x1ee659+=0x1){socket[_0x0315('0x5e')](_0x0315('0x5f'),{'UserId':Number(_0x2d5094['body'][_0x0315('0x55')][_0x1ee659]),'ChatQueueId':Number(_0x2d5094['params']['id'])});}return _0x456176;});}})[_0x0315('0x17')](respondWithResult(_0x489332,null))[_0x0315('0x27')](handleError(_0x489332,null));};exports[_0x0315('0x70')]=function(_0x4a1e3b,_0x166088){return db[_0x0315('0x1f')][_0x0315('0x31')]({'where':{'id':_0x4a1e3b[_0x0315('0x3a')]['id']}})['then'](handleEntityNotFound(_0x166088,null))[_0x0315('0x17')](function(_0x417d19){if(_0x417d19){return _0x417d19[_0x0315('0x70')](_0x4a1e3b[_0x0315('0x25')][_0x0315('0x55')])[_0x0315('0x17')](function(){if(_[_0x0315('0x74')](_0x4a1e3b[_0x0315('0x25')][_0x0315('0x55')])){for(var _0x3376e7=0x0;_0x3376e7<_0x4a1e3b[_0x0315('0x25')]['ids'][_0x0315('0x40')];_0x3376e7+=0x1){socket[_0x0315('0x5e')](_0x0315('0x71'),{'UserId':Number(_0x4a1e3b[_0x0315('0x25')][_0x0315('0x55')][_0x3376e7]),'ChatQueueId':Number(_0x4a1e3b['params']['id'])});}}else{socket[_0x0315('0x5e')](_0x0315('0x71'),{'UserId':Number(_0x4a1e3b[_0x0315('0x25')]['ids']),'ChatQueueId':Number(_0x4a1e3b[_0x0315('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x166088,null))[_0x0315('0x27')](handleError(_0x166088,null));};exports['getAgents']=function(_0x4195a1,_0x43a537){var _0x4007e4={};var _0x21a0c0={};var _0x4d68ec;var _0x36c0bd;return db[_0x0315('0x1f')][_0x0315('0x3d')]({'where':{'id':_0x4195a1[_0x0315('0x3a')]['id']}})['then'](handleEntityNotFound(_0x43a537,null))[_0x0315('0x17')](function(_0x480150){if(_0x480150){_0x4d68ec=_0x480150;_0x21a0c0[_0x0315('0x29')]=_[_0x0315('0x2a')](db[_0x0315('0x48')][_0x0315('0x2b')]);_0x21a0c0[_0x0315('0x25')]=_[_0x0315('0x2a')](_0x4195a1[_0x0315('0x25')]);_0x21a0c0[_0x0315('0x2c')]=_[_0x0315('0x3f')](_0x21a0c0['model'],_0x21a0c0['query']);_0x4007e4[_0x0315('0x2d')]=_[_0x0315('0x3f')](_0x21a0c0['model'],qs[_0x0315('0x2e')](_0x4195a1[_0x0315('0x25')][_0x0315('0x2e')]));_0x4007e4[_0x0315('0x2d')]=_0x4007e4['attributes']['length']?_0x4007e4[_0x0315('0x2d')]:_0x21a0c0[_0x0315('0x29')];_0x4007e4[_0x0315('0x42')]=qs[_0x0315('0x43')](_0x4195a1[_0x0315('0x25')][_0x0315('0x43')]);_0x4007e4[_0x0315('0x23')]=qs[_0x0315('0x2c')](_[_0x0315('0x44')](_0x4195a1[_0x0315('0x25')],_0x21a0c0[_0x0315('0x2c')]));if(_0x4195a1['query'][_0x0315('0x46')]){_0x4007e4['where']=_[_0x0315('0x2f')](_0x4007e4[_0x0315('0x23')],{'$or':_[_0x0315('0x1e')](_0x4007e4[_0x0315('0x2d')],function(_0x23036b){var _0x26295a={};_0x26295a[_0x23036b]={'$like':'%'+_0x4195a1[_0x0315('0x25')][_0x0315('0x46')]+'%'};return _0x26295a;})});}_0x4007e4=_[_0x0315('0x2f')]({},_0x4007e4,_0x4195a1['options']);return _0x4d68ec[_0x0315('0x75')](_0x4007e4);}})[_0x0315('0x17')](function(_0x12c08d){if(_0x12c08d){_0x36c0bd=_0x12c08d['length'];if(!_0x4195a1[_0x0315('0x25')]['hasOwnProperty'](_0x0315('0x41'))){_0x4007e4[_0x0315('0x13')]=qs[_0x0315('0x13')](_0x4195a1['query'][_0x0315('0x13')]);_0x4007e4[_0x0315('0x11')]=qs[_0x0315('0x11')](_0x4195a1[_0x0315('0x25')][_0x0315('0x11')]);}return _0x4d68ec[_0x0315('0x75')](_0x4007e4);}})[_0x0315('0x17')](function(_0x2aaa56){if(_0x2aaa56){return _0x2aaa56?{'count':_0x36c0bd,'rows':_0x2aaa56}:null;}})['then'](respondWithResult(_0x43a537,null))[_0x0315('0x27')](handleError(_0x43a537,null));}; \ No newline at end of file +var _0x3464=['transaction','addTeams','each','emit','userChatQueue:save','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','./chatQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','catch','show','params','model','keys','filters','attributes','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','options','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','ids','online','interface','flatMap','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3464,0x11b));var _0x4346=function(_0x3c4f15,_0x535966){_0x3c4f15=_0x3c4f15-0x0;var _0x3a5952=_0x3464[_0x3c4f15];return _0x3a5952;};'use strict';var BPromise=require(_0x4346('0x0'));var util=require('util');var _=require(_0x4346('0x1'));var squel=require(_0x4346('0x2'));var Redis=require(_0x4346('0x3'));var qs=require(_0x4346('0x4'));var logger=require(_0x4346('0x5'))(_0x4346('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4346('0x7')]=_[_0x4346('0x8')](config[_0x4346('0x7')],{'host':_0x4346('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4346('0x7')]));require(_0x4346('0xa'))[_0x4346('0xb')](socket);function respondWithStatusCode(_0x119f54,_0x4c3e1d){_0x4c3e1d=_0x4c3e1d||0xcc;return function(_0x305130){if(_0x305130){return _0x119f54[_0x4346('0xc')](_0x4c3e1d);}return _0x119f54['status'](_0x4c3e1d)[_0x4346('0xd')]();};}function respondWithResult(_0x29aded,_0x4517aa){_0x4517aa=_0x4517aa||0xc8;return function(_0x3b442){if(_0x3b442){return _0x29aded[_0x4346('0xe')](_0x4517aa)[_0x4346('0xf')](_0x3b442);}};}function respondWithFilteredResult(_0x550031,_0x3ffa14){return function(_0x5a32ce){if(_0x5a32ce){var _0x35d65f=typeof _0x3ffa14[_0x4346('0x10')]==='undefined'&&typeof _0x3ffa14[_0x4346('0x11')]===_0x4346('0x12');var _0x41e604=_0x5a32ce['count'];var _0x5eb67d=_0x35d65f?0x0:_0x3ffa14[_0x4346('0x10')];var _0x34cc96=_0x35d65f?_0x5a32ce[_0x4346('0x13')]:_0x3ffa14[_0x4346('0x10')]+_0x3ffa14['limit'];var _0x13679a;if(_0x34cc96>=_0x41e604){_0x34cc96=_0x41e604;_0x13679a=0xc8;}else{_0x13679a=0xce;}_0x550031[_0x4346('0xe')](_0x13679a);return _0x550031['set'](_0x4346('0x14'),_0x5eb67d+'-'+_0x34cc96+'/'+_0x41e604)[_0x4346('0xf')](_0x5a32ce);}return null;};}function saveUpdates(_0x20aa5d){return function(_0xac6675){if(_0xac6675){return _0xac6675[_0x4346('0x15')](_0x20aa5d)[_0x4346('0x16')](function(_0x5245d9){return _0x5245d9;});}return null;};}function removeEntity(_0x116856){return function(_0x15e32b){if(_0x15e32b){return _0x15e32b[_0x4346('0x17')]()[_0x4346('0x16')](function(){var _0x53f4bb=_0x15e32b[_0x4346('0x18')]({'plain':!![]});var _0x344417=_0x4346('0x19');return db[_0x4346('0x1a')][_0x4346('0x17')]({'where':{'type':_0x344417,'resourceId':_0x53f4bb['id']}})['then'](function(){return _0x15e32b;});})[_0x4346('0x16')](function(){_0x116856[_0x4346('0xe')](0xcc)[_0x4346('0xd')]();});}};}function handleEntityNotFound(_0x5c2fe3){return function(_0x46e7da){if(!_0x46e7da){_0x5c2fe3[_0x4346('0xc')](0x194);}return _0x46e7da;};}function handleError(_0x305eb4,_0x4c9bba){_0x4c9bba=_0x4c9bba||0x1f4;return function(_0x2904fd){logger[_0x4346('0x1b')](_0x2904fd[_0x4346('0x1c')]);if(_0x2904fd['name']){delete _0x2904fd[_0x4346('0x1d')];}_0x305eb4['status'](_0x4c9bba)[_0x4346('0x1e')](_0x2904fd);};}exports['index']=function(_0x19471e,_0x4db3a0){var _0x5c4b88={};var _0x172ff0={'count':0x0,'rows':[]};var _0x103685=_[_0x4346('0x1f')](db[_0x4346('0x20')][_0x4346('0x21')],function(_0x3b8e50){return{'name':_0x3b8e50[_0x4346('0x22')],'type':_0x3b8e50[_0x4346('0x23')][_0x4346('0x24')]};});_0x5c4b88=qs[_0x4346('0x25')](_0x103685,_0x19471e);var _0x4585d8={'where':_0x5c4b88[_0x4346('0x26')]};return db[_0x4346('0x20')][_0x4346('0x13')](_0x4585d8)[_0x4346('0x16')](function(_0x10cb88){_0x172ff0[_0x4346('0x13')]=_0x10cb88;_0x5c4b88['include']=qs[_0x4346('0x27')](_0x19471e[_0x4346('0x28')]);return db[_0x4346('0x20')]['findAll'](_0x5c4b88);})[_0x4346('0x16')](function(_0x3a936d){_0x172ff0['rows']=_0x3a936d;return _0x172ff0;})[_0x4346('0x16')](respondWithFilteredResult(_0x4db3a0,_0x5c4b88))[_0x4346('0x29')](handleError(_0x4db3a0,null));};exports[_0x4346('0x2a')]=function(_0x1eba3b,_0x4b03e6){var _0x329023={'raw':!![],'where':{'id':_0x1eba3b[_0x4346('0x2b')]['id']}},_0x5b496e={};_0x5b496e[_0x4346('0x2c')]=_[_0x4346('0x2d')](db[_0x4346('0x20')][_0x4346('0x21')]);_0x5b496e[_0x4346('0x28')]=_[_0x4346('0x2d')](_0x1eba3b['query']);_0x5b496e[_0x4346('0x2e')]=_['intersection'](_0x5b496e['model'],_0x5b496e[_0x4346('0x28')]);_0x329023[_0x4346('0x2f')]=_['intersection'](_0x5b496e['model'],qs['fields'](_0x1eba3b[_0x4346('0x28')]['fields']));_0x329023[_0x4346('0x2f')]=_0x329023[_0x4346('0x2f')][_0x4346('0x30')]?_0x329023[_0x4346('0x2f')]:_0x5b496e['model'];if(_0x1eba3b[_0x4346('0x28')]['includeAll']){_0x329023['include']=[{'all':!![]}];}_0x329023=_[_0x4346('0x31')]({},_0x329023,_0x1eba3b['options']);return db[_0x4346('0x20')][_0x4346('0x32')](_0x329023)['then'](handleEntityNotFound(_0x4b03e6,null))[_0x4346('0x16')](respondWithResult(_0x4b03e6,null))[_0x4346('0x29')](handleError(_0x4b03e6,null));};exports[_0x4346('0x33')]=function(_0x4ff20c,_0x303b88){return db[_0x4346('0x20')][_0x4346('0x33')](_0x4ff20c[_0x4346('0x34')],{})[_0x4346('0x16')](function(_0x5c985f){var _0xd87621=_0x4ff20c[_0x4346('0x35')]['get']({'plain':!![]});if(!_0xd87621)throw new Error(_0x4346('0x36'));if(_0xd87621['role']==='user'){var _0x1c025a=_0x5c985f['get']({'plain':!![]});var _0x1e4c1d='ChatQueues';return db[_0x4346('0x37')]['find']({'where':{'name':_0x1e4c1d,'userProfileId':_0xd87621['userProfileId']},'raw':!![]})[_0x4346('0x16')](function(_0x2e59f2){if(_0x2e59f2&&_0x2e59f2[_0x4346('0x38')]===0x0){return db[_0x4346('0x1a')][_0x4346('0x33')]({'name':_0x1c025a[_0x4346('0x1d')],'resourceId':_0x1c025a['id'],'type':_0x2e59f2['name'],'sectionId':_0x2e59f2['id']},{})['then'](function(){return _0x5c985f;});}else{return _0x5c985f;}})['catch'](function(_0x43f4d4){logger[_0x4346('0x1b')](_0x4346('0x39'),_0x43f4d4);throw _0x43f4d4;});}return _0x5c985f;})['then'](respondWithResult(_0x303b88,0xc9))[_0x4346('0x29')](handleError(_0x303b88,null));};exports['update']=function(_0x54b22a,_0x2687e7){if(_0x54b22a[_0x4346('0x34')]['id']){delete _0x54b22a[_0x4346('0x34')]['id'];}return db['ChatQueue'][_0x4346('0x32')]({'where':{'id':_0x54b22a[_0x4346('0x2b')]['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x2687e7,null))[_0x4346('0x16')](saveUpdates(_0x54b22a[_0x4346('0x34')],null))[_0x4346('0x16')](respondWithResult(_0x2687e7,null))['catch'](handleError(_0x2687e7,null));};exports[_0x4346('0x17')]=function(_0x1caa4b,_0x3c370c){return db['ChatQueue'][_0x4346('0x32')]({'where':{'id':_0x1caa4b['params']['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x3c370c,null))[_0x4346('0x16')](removeEntity(_0x3c370c,null))['catch'](handleError(_0x3c370c,null));};exports[_0x4346('0x3a')]=function(_0x3349b7,_0x41efd7){return db['ChatQueue'][_0x4346('0x3a')]()[_0x4346('0x16')](respondWithResult(_0x41efd7,null))[_0x4346('0x29')](handleError(_0x41efd7,null));};exports[_0x4346('0x3b')]=function(_0x147770,_0x1a4f09){var _0x3ff667={'raw':!![],'where':{}},_0x3b597d={},_0x202a9d;return db['ChatQueue'][_0x4346('0x3c')]({'where':{'id':_0x147770[_0x4346('0x2b')]['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x1a4f09,null))[_0x4346('0x16')](function(_0x498e7b){if(_0x498e7b){_0x202a9d=_0x498e7b[_0x4346('0x18')]({'plain':!![]});_0x3b597d[_0x4346('0x2c')]=_[_0x4346('0x2d')](db[_0x4346('0x3d')][_0x4346('0x21')]);_0x3b597d['query']=_[_0x4346('0x2d')](_0x147770['query']);_0x3b597d[_0x4346('0x2e')]=_[_0x4346('0x3e')](_0x3b597d[_0x4346('0x2c')],_0x3b597d[_0x4346('0x28')]);_0x3ff667['attributes']=_['intersection'](_0x3b597d[_0x4346('0x2c')],qs[_0x4346('0x3f')](_0x147770['query'][_0x4346('0x3f')]));_0x3ff667[_0x4346('0x2f')]=_0x3ff667[_0x4346('0x2f')][_0x4346('0x30')]?_0x3ff667[_0x4346('0x2f')]:_0x3b597d[_0x4346('0x2c')];if(!_0x147770['query'][_0x4346('0x40')](_0x4346('0x41'))){_0x3ff667[_0x4346('0x11')]=qs[_0x4346('0x11')](_0x147770[_0x4346('0x28')]['limit']);_0x3ff667['offset']=qs[_0x4346('0x10')](_0x147770[_0x4346('0x28')][_0x4346('0x10')]);}_0x3ff667[_0x4346('0x42')]=qs[_0x4346('0x43')](_0x147770['query'][_0x4346('0x43')]);_0x3ff667[_0x4346('0x26')]=qs[_0x4346('0x2e')](_[_0x4346('0x44')](_0x147770[_0x4346('0x28')],_0x3b597d[_0x4346('0x2e')]));_0x3ff667[_0x4346('0x26')]['ChatQueueId']=_0x498e7b['id'];if(_0x147770[_0x4346('0x28')]['filter']){_0x3ff667['where']=_[_0x4346('0x31')](_0x3ff667[_0x4346('0x26')],{'$or':_['map'](_0x3ff667[_0x4346('0x2f')],function(_0x42bfec){var _0x1f7ad6={};_0x1f7ad6[_0x42bfec]={'$like':'%'+_0x147770[_0x4346('0x28')][_0x4346('0x45')]+'%'};return _0x1f7ad6;})});}_0x3ff667=_['merge']({},_0x3ff667,_0x147770[_0x4346('0x46')]);return db[_0x4346('0x3d')][_0x4346('0x47')](_0x3ff667);}})[_0x4346('0x16')](function(_0x53524e){if(_0x53524e){return db[_0x4346('0x48')]['findAndCountAll']({'where':{'id':_[_0x4346('0x1f')](_0x53524e,_0x4346('0x49')),'role':_0x4346('0x4a')},'attributes':['id',_0x4346('0x1d'),_0x4346('0x4b'),_0x4346('0x4c'),_0x4346('0x4d')]});}})['then'](function(_0x4be7a7){if(_0x4be7a7){return{'count':_0x4be7a7[_0x4346('0x13')],'rows':_[_0x4346('0x1f')](_0x4be7a7[_0x4346('0x4e')],function(_0x27700e){return{'membername':_0x27700e[_0x4346('0x1d')],'UserId':_0x27700e['id'],'queue_name':_0x202a9d['name'],'ChatQueueId':_0x202a9d['id'],'interface':util[_0x4346('0x4f')](_0x4346('0x50'),_0x4346('0x51'),_0x27700e['name']),'penalty':0x0,'paused':_0x27700e[_0x4346('0x4b')],'createdAt':_0x27700e[_0x4346('0x4d')],'updatedAt':_0x27700e[_0x4346('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4346('0x16')](respondWithFilteredResult(_0x1a4f09,_0x3ff667))[_0x4346('0x29')](handleError(_0x1a4f09,null));};exports['getTeams']=function(_0xd41511,_0x57963a){var _0x458981={};var _0x23fdd5={};var _0x1f0c1b;var _0x875894;return db[_0x4346('0x20')][_0x4346('0x3c')]({'where':{'id':_0xd41511[_0x4346('0x2b')]['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x57963a,null))[_0x4346('0x16')](function(_0x22ad8c){if(_0x22ad8c){_0x1f0c1b=_0x22ad8c;_0x23fdd5['model']=_[_0x4346('0x2d')](db[_0x4346('0x52')]['rawAttributes']);_0x23fdd5[_0x4346('0x28')]=_[_0x4346('0x2d')](_0xd41511[_0x4346('0x28')]);_0x23fdd5['filters']=_[_0x4346('0x3e')](_0x23fdd5[_0x4346('0x2c')],_0x23fdd5[_0x4346('0x28')]);_0x458981[_0x4346('0x2f')]=_[_0x4346('0x3e')](_0x23fdd5[_0x4346('0x2c')],qs[_0x4346('0x3f')](_0xd41511[_0x4346('0x28')]['fields']));_0x458981['attributes']=_0x458981[_0x4346('0x2f')]['length']?_0x458981[_0x4346('0x2f')]:_0x23fdd5[_0x4346('0x2c')];_0x458981[_0x4346('0x42')]=qs[_0x4346('0x43')](_0xd41511[_0x4346('0x28')][_0x4346('0x43')]);_0x458981[_0x4346('0x26')]=qs['filters'](_[_0x4346('0x44')](_0xd41511[_0x4346('0x28')],_0x23fdd5['filters']));if(_0xd41511['query'][_0x4346('0x45')]){_0x458981['where']=_[_0x4346('0x31')](_0x458981[_0x4346('0x26')],{'$or':_[_0x4346('0x1f')](_0x458981['attributes'],function(_0x2a885d){var _0x3baeef={};_0x3baeef[_0x2a885d]={'$like':'%'+_0xd41511[_0x4346('0x28')][_0x4346('0x45')]+'%'};return _0x3baeef;})});}_0x458981=_[_0x4346('0x31')]({},_0x458981,_0xd41511['options']);return _0x1f0c1b[_0x4346('0x53')](_0x458981);}})[_0x4346('0x16')](function(_0x428fd5){if(_0x428fd5){_0x875894=_0x428fd5[_0x4346('0x30')];if(!_0xd41511[_0x4346('0x28')][_0x4346('0x40')](_0x4346('0x41'))){_0x458981[_0x4346('0x11')]=qs[_0x4346('0x11')](_0xd41511[_0x4346('0x28')][_0x4346('0x11')]);_0x458981['offset']=qs[_0x4346('0x10')](_0xd41511[_0x4346('0x28')][_0x4346('0x10')]);}return _0x1f0c1b[_0x4346('0x53')](_0x458981);}})[_0x4346('0x16')](function(_0x3c9db8){if(_0x3c9db8){return _0x3c9db8?{'count':_0x875894,'rows':_0x3c9db8}:null;}})['then'](respondWithResult(_0x57963a,null))['catch'](handleError(_0x57963a,null));};exports['addTeams']=function(_0x1a1071,_0x19c7fa){var _0x4c6e56=_0x1a1071[_0x4346('0x34')][_0x4346('0x54')];return db[_0x4346('0x52')][_0x4346('0x47')]({'where':{'id':_0x4c6e56},'attributes':['id'],'include':[{'model':db[_0x4346('0x48')],'as':'Agents','attributes':['id','name',_0x4346('0x55'),'voicePause',_0x4346('0x56')],'raw':!![]}]})[_0x4346('0x16')](function(_0x2c786b){if(_0x2c786b){var _0x7aadde=_[_0x4346('0x57')](_0x2c786b,function(_0x4debe9){var _0x46fb2d=_0x4debe9[_0x4346('0x18')]({'plain':!![]});return _0x46fb2d['Agents'];});return db[_0x4346('0x20')][_0x4346('0x32')]({'where':{'id':_0x1a1071['params']['id']}})[_0x4346('0x16')](function(_0x5e5f5c){return db[_0x4346('0x58')][_0x4346('0x59')](function(_0x682cc8){return _0x5e5f5c[_0x4346('0x5a')](_0x4c6e56,{'transaction':_0x682cc8})['then'](function(){return BPromise[_0x4346('0x5b')](_0x7aadde,function(_0x36ac9e){return db[_0x4346('0x3d')]['findOrCreate']({'where':{'UserId':_0x36ac9e['id'],'ChatQueueId':_0x1a1071[_0x4346('0x2b')]['id']},'transaction':_0x682cc8});});})['then'](function(){_0x7aadde['forEach'](function(_0x3c2939){socket[_0x4346('0x5c')](_0x4346('0x5d'),{'UserId':_0x3c2939['id'],'ChatQueueId':_0x5e5f5c['id']});});});});});}})['then'](respondWithStatusCode(_0x19c7fa,null))[_0x4346('0x29')](handleError(_0x19c7fa,null));};exports['removeTeams']=function(_0x12091c,_0x503b3e){return db[_0x4346('0x52')][_0x4346('0x47')]({'where':{'id':_0x12091c[_0x4346('0x28')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4346('0x48')],'as':_0x4346('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x503b3e,null))['then'](function(_0x3d9bb6){var _0x26c56a=_[_0x4346('0x1f')](_0x3d9bb6,'id');var _0x366a10=[];var _0x333b7c=[];var _0x26b701=squel[_0x4346('0x5f')]();_0x26b701[_0x4346('0x60')](_0x4346('0x61'))[_0x4346('0x62')](_0x4346('0x63'),'tq')[_0x4346('0x64')](_0x4346('0x65'),'ut',_0x4346('0x66'))['where'](_0x4346('0x67'),_0x12091c[_0x4346('0x2b')]['id']);for(var _0x502319=0x0;_0x502319<_0x3d9bb6[_0x4346('0x30')];_0x502319+=0x1){let _0x33b1be=_0x3d9bb6[_0x502319];for(var _0x7ebb42=0x0;_0x7ebb42<_0x33b1be[_0x4346('0x5e')][_0x4346('0x30')];_0x7ebb42+=0x1){let _0x3b6e66=_0x33b1be[_0x4346('0x5e')][_0x7ebb42];var _0x4e1ae9=_0x26b701[_0x4346('0x68')]();_0x4e1ae9[_0x4346('0x26')](_0x4346('0x69'),_0x3b6e66['id']);_0x333b7c['push'](db[_0x4346('0x58')]['query'](_0x4e1ae9[_0x4346('0x6a')](),{'type':db[_0x4346('0x58')][_0x4346('0x6b')][_0x4346('0x6c')]})[_0x4346('0x16')](function(_0x6fda05){if(_0x6fda05['length']===0x1){return _0x3b6e66['id'];}else{var _0x27db67=_[_0x4346('0x6d')](_[_0x4346('0x1f')](_0x6fda05,'TeamId'),function(_0x1034a3){return _['includes'](_0x26c56a,_0x1034a3);});if(_0x27db67){return _0x3b6e66['id'];}}}));}}return BPromise[_0x4346('0x6e')](_0x333b7c)[_0x4346('0x16')](function(_0x486829){_0x366a10=_(_0x366a10)[_0x4346('0x6f')](_0x486829)[_0x4346('0x70')]()[_0x4346('0x71')]();return db[_0x4346('0x20')][_0x4346('0x32')]({'where':{'id':_0x12091c['params']['id']}})['then'](function(_0xdfd159){return db['sequelize'][_0x4346('0x59')](function(_0x48b336){return _0xdfd159[_0x4346('0x72')](_0x12091c['query'][_0x4346('0x54')],{'transaction':_0x48b336})[_0x4346('0x16')](function(){if(!_[_0x4346('0x73')](_0x366a10)){return _0xdfd159[_0x4346('0x74')](_0x366a10,{'transaction':_0x48b336});}})['then'](function(){_0x366a10[_0x4346('0x75')](function(_0x185abb){socket[_0x4346('0x5c')]('userChatQueue:remove',{'UserId':_0x185abb,'ChatQueueId':_0xdfd159['id']});});});});});});})['then'](respondWithStatusCode(_0x503b3e,null))['catch'](handleError(_0x503b3e,null));};exports[_0x4346('0x76')]=function(_0x2f9711,_0x46437c){return db[_0x4346('0x20')]['find']({'where':{'id':_0x2f9711['params']['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x46437c,null))[_0x4346('0x16')](function(_0x5dc264){if(_0x5dc264){return _0x5dc264['addAgents'](_0x2f9711[_0x4346('0x34')]['ids'],_[_0x4346('0x77')](_0x2f9711[_0x4346('0x34')],[_0x4346('0x54'),'id'])||{})[_0x4346('0x78')](function(_0x1f2b0a){for(var _0x16c5f6=0x0;_0x16c5f6<_0x2f9711[_0x4346('0x34')]['ids'][_0x4346('0x30')];_0x16c5f6+=0x1){socket[_0x4346('0x5c')](_0x4346('0x5d'),{'UserId':Number(_0x2f9711[_0x4346('0x34')][_0x4346('0x54')][_0x16c5f6]),'ChatQueueId':Number(_0x2f9711['params']['id'])});}return _0x1f2b0a;});}})['then'](respondWithResult(_0x46437c,null))[_0x4346('0x29')](handleError(_0x46437c,null));};exports[_0x4346('0x74')]=function(_0x257d31,_0x2d3f0d){return db['ChatQueue'][_0x4346('0x32')]({'where':{'id':_0x257d31['params']['id']}})['then'](handleEntityNotFound(_0x2d3f0d,null))['then'](function(_0xd4823c){if(_0xd4823c){return _0xd4823c[_0x4346('0x74')](_0x257d31['query'][_0x4346('0x54')])[_0x4346('0x16')](function(){if(_[_0x4346('0x79')](_0x257d31[_0x4346('0x28')]['ids'])){for(var _0x2b59a6=0x0;_0x2b59a6<_0x257d31[_0x4346('0x28')]['ids'][_0x4346('0x30')];_0x2b59a6+=0x1){socket[_0x4346('0x5c')](_0x4346('0x7a'),{'UserId':Number(_0x257d31[_0x4346('0x28')][_0x4346('0x54')][_0x2b59a6]),'ChatQueueId':Number(_0x257d31[_0x4346('0x2b')]['id'])});}}else{socket[_0x4346('0x5c')]('userChatQueue:remove',{'UserId':Number(_0x257d31['query'][_0x4346('0x54')]),'ChatQueueId':Number(_0x257d31[_0x4346('0x2b')]['id'])});}});}})[_0x4346('0x16')](respondWithStatusCode(_0x2d3f0d,null))['catch'](handleError(_0x2d3f0d,null));};exports[_0x4346('0x7b')]=function(_0x529dd3,_0x161aa1){var _0x548018={};var _0x2a6557={};var _0x3cb955;var _0x12ad87;return db[_0x4346('0x20')][_0x4346('0x3c')]({'where':{'id':_0x529dd3[_0x4346('0x2b')]['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x161aa1,null))['then'](function(_0x307ff6){if(_0x307ff6){_0x3cb955=_0x307ff6;_0x2a6557[_0x4346('0x2c')]=_[_0x4346('0x2d')](db[_0x4346('0x48')][_0x4346('0x21')]);_0x2a6557['query']=_[_0x4346('0x2d')](_0x529dd3['query']);_0x2a6557['filters']=_[_0x4346('0x3e')](_0x2a6557[_0x4346('0x2c')],_0x2a6557['query']);_0x548018[_0x4346('0x2f')]=_[_0x4346('0x3e')](_0x2a6557[_0x4346('0x2c')],qs[_0x4346('0x3f')](_0x529dd3['query'][_0x4346('0x3f')]));_0x548018[_0x4346('0x2f')]=_0x548018[_0x4346('0x2f')][_0x4346('0x30')]?_0x548018[_0x4346('0x2f')]:_0x2a6557[_0x4346('0x2c')];_0x548018['order']=qs[_0x4346('0x43')](_0x529dd3[_0x4346('0x28')][_0x4346('0x43')]);_0x548018['where']=qs['filters'](_[_0x4346('0x44')](_0x529dd3[_0x4346('0x28')],_0x2a6557[_0x4346('0x2e')]));if(_0x529dd3['query'][_0x4346('0x45')]){_0x548018[_0x4346('0x26')]=_[_0x4346('0x31')](_0x548018['where'],{'$or':_[_0x4346('0x1f')](_0x548018['attributes'],function(_0x119cb6){var _0x574f8e={};_0x574f8e[_0x119cb6]={'$like':'%'+_0x529dd3[_0x4346('0x28')]['filter']+'%'};return _0x574f8e;})});}_0x548018=_[_0x4346('0x31')]({},_0x548018,_0x529dd3[_0x4346('0x46')]);return _0x3cb955[_0x4346('0x7b')](_0x548018);}})['then'](function(_0x4e706a){if(_0x4e706a){_0x12ad87=_0x4e706a[_0x4346('0x30')];if(!_0x529dd3['query'][_0x4346('0x40')]('nolimit')){_0x548018['limit']=qs[_0x4346('0x11')](_0x529dd3[_0x4346('0x28')][_0x4346('0x11')]);_0x548018[_0x4346('0x10')]=qs[_0x4346('0x10')](_0x529dd3['query']['offset']);}return _0x3cb955['getAgents'](_0x548018);}})[_0x4346('0x16')](function(_0x1fa570){if(_0x1fa570){return _0x1fa570?{'count':_0x12ad87,'rows':_0x1fa570}:null;}})['then'](respondWithResult(_0x161aa1,null))[_0x4346('0x29')](handleError(_0x161aa1,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9b01b75..3cab2f5 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 _0x5750=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x2f9bac,_0x15aac9){var _0x5da607=function(_0x48256d){while(--_0x48256d){_0x2f9bac['push'](_0x2f9bac['shift']());}};_0x5da607(++_0x15aac9);}(_0x5750,0x1bb));var _0x0575=function(_0x3dcaea,_0x2e7222){_0x3dcaea=_0x3dcaea-0x0;var _0xb6f875=_0x5750[_0x3dcaea];return _0xb6f875;};'use strict';var EventEmitter=require(_0x0575('0x0'));var ChatQueue=require(_0x0575('0x1'))['db'][_0x0575('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0575('0x3')](0x0);var events={'afterCreate':_0x0575('0x4'),'afterUpdate':_0x0575('0x5'),'afterDestroy':_0x0575('0x6')};function emitEvent(_0x4fd895){return function(_0x3f4ad5,_0x310cfe,_0x327216){ChatQueueEvents[_0x0575('0x7')](_0x4fd895+':'+_0x3f4ad5['id'],_0x3f4ad5);ChatQueueEvents['emit'](_0x4fd895,_0x3f4ad5);_0x327216(null);};}for(var e in events){if(events[_0x0575('0x8')](e)){var event=events[e];ChatQueue[_0x0575('0x9')](e,emitEvent(event));}}module[_0x0575('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xd8df=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','remove','emit'];(function(_0x4f550,_0x3edd72){var _0xd18547=function(_0x33dec3){while(--_0x33dec3){_0x4f550['push'](_0x4f550['shift']());}};_0xd18547(++_0x3edd72);}(_0xd8df,0x163));var _0xfd8d=function(_0x44406c,_0x302c2f){_0x44406c=_0x44406c-0x0;var _0xe3b344=_0xd8df[_0x44406c];return _0xe3b344;};'use strict';var EventEmitter=require(_0xfd8d('0x0'));var ChatQueue=require(_0xfd8d('0x1'))['db'][_0xfd8d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfd8d('0x3')};function emitEvent(_0xab4ef3){return function(_0x33750a,_0x53592e,_0x5b2d87){ChatQueueEvents[_0xfd8d('0x4')](_0xab4ef3+':'+_0x33750a['id'],_0x33750a);ChatQueueEvents[_0xfd8d('0x4')](_0xab4ef3,_0x33750a);_0x5b2d87(null);};}for(var e in events){if(events[_0xfd8d('0x5')](e)){var event=events[e];ChatQueue[_0xfd8d('0x6')](e,emitEvent(event));}}module[_0xfd8d('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 7439baf..e36507c 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 _0xd33e=['exports','ChatQueue','chat_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes'];(function(_0x3bacd0,_0x157dcf){var _0x2fd932=function(_0x13d4c1){while(--_0x13d4c1){_0x3bacd0['push'](_0x3bacd0['shift']());}};_0x2fd932(++_0x157dcf);}(_0xd33e,0x137));var _0xed33=function(_0x2570b1,_0x3fed7f){_0x2570b1=_0x2570b1-0x0;var _0x5b4e74=_0xd33e[_0x2570b1];return _0x5b4e74;};'use strict';var _=require(_0xed33('0x0'));var util=require(_0xed33('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xed33('0x2'));var BPromise=require(_0xed33('0x3'));var rp=require(_0xed33('0x4'));var fs=require('fs');var path=require(_0xed33('0x5'));var rimraf=require(_0xed33('0x6'));var config=require('../../config/environment');var attributes=require(_0xed33('0x7'));module[_0xed33('0x8')]=function(_0x546d6e,_0x402236){return _0x546d6e['define'](_0xed33('0x9'),attributes,{'tableName':_0xed33('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa408=['chat_queues','util','bluebird','request-promise','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa408,0x184));var _0x8a40=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xa408[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require('lodash');var util=require(_0x8a40('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8a40('0x1'));var rp=require(_0x8a40('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8a40('0x3'));var attributes=require(_0x8a40('0x4'));module[_0x8a40('0x5')]=function(_0x6b0196,_0x63a881){return _0x6b0196[_0x8a40('0x6')](_0x8a40('0x7'),attributes,{'tableName':_0x8a40('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 713fd1d..d220e6d 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 _0x617f=['http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetChatQueue','ChatQueue','options','raw','where','attributes','map','include','model','then','catch','ShowChatQueue','find','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3d869c,_0x1a903a){var _0x6855e2=function(_0x3b2b38){while(--_0x3b2b38){_0x3d869c['push'](_0x3d869c['shift']());}};_0x6855e2(++_0x1a903a);}(_0x617f,0x15e));var _0xf617=function(_0x5ce3a7,_0x1e03d2){_0x5ce3a7=_0x5ce3a7-0x0;var _0x1dafb0=_0x617f[_0x5ce3a7];return _0x1dafb0;};'use strict';var _=require('lodash');var util=require(_0xf617('0x0'));var moment=require(_0xf617('0x1'));var BPromise=require(_0xf617('0x2'));var rs=require(_0xf617('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf617('0x4'))['db'];var utils=require(_0xf617('0x5'));var logger=require(_0xf617('0x6'))(_0xf617('0x7'));var config=require(_0xf617('0x8'));var jayson=require(_0xf617('0x9'));var client=jayson['client'][_0xf617('0xa')]({'port':0x232a});config['redis']=_[_0xf617('0xb')](config[_0xf617('0xc')],{'host':_0xf617('0xd'),'port':0x18eb});var socket=require(_0xf617('0xe'))(new Redis(config[_0xf617('0xc')]));require(_0xf617('0xf'))[_0xf617('0x10')](socket);function respondWithRpcPromise(_0x2ea231,_0x426738,_0x12dfa0){return new BPromise(function(_0x569002,_0x342c2a){return client[_0xf617('0x11')](_0x2ea231,_0x12dfa0)['then'](function(_0x550350){logger[_0xf617('0x12')](_0xf617('0x13'),_0x426738,_0xf617('0x14'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x426738,_0xf617('0x14'),JSON[_0xf617('0x15')](_0x550350));if(_0x550350[_0xf617('0x16')]){if(_0x550350[_0xf617('0x16')][_0xf617('0x17')]===0x1f4){logger[_0xf617('0x16')]('ChatQueue,\x20%s,\x20%s',_0x426738,_0x550350[_0xf617('0x16')]['message']);return _0x342c2a(_0x550350['error'][_0xf617('0x18')]);}logger[_0xf617('0x16')](_0xf617('0x13'),_0x426738,_0x550350[_0xf617('0x16')][_0xf617('0x18')]);return _0x569002(_0x550350[_0xf617('0x16')]['message']);}else{logger[_0xf617('0x12')](_0xf617('0x13'),_0x426738,'request\x20sent');_0x569002(_0x550350[_0xf617('0x19')][_0xf617('0x18')]);}})['catch'](function(_0xd23d4f){logger[_0xf617('0x16')](_0xf617('0x13'),_0x426738,_0xd23d4f);_0x342c2a(_0xd23d4f);});});}exports[_0xf617('0x1a')]=function(_0xf5ae02){var _0x53dabd=this;return new Promise(function(_0x591d2e,_0x1c9f8c){return db[_0xf617('0x1b')]['findAll']({'raw':_0xf5ae02[_0xf617('0x1c')]?_0xf5ae02[_0xf617('0x1c')][_0xf617('0x1d')]===undefined?!![]:![]:!![],'where':_0xf5ae02[_0xf617('0x1c')]?_0xf5ae02['options'][_0xf617('0x1e')]||null:null,'attributes':_0xf5ae02[_0xf617('0x1c')]?_0xf5ae02[_0xf617('0x1c')][_0xf617('0x1f')]||null:null,'limit':_0xf5ae02[_0xf617('0x1c')]?_0xf5ae02[_0xf617('0x1c')]['limit']||null:null,'include':_0xf5ae02[_0xf617('0x1c')]?_0xf5ae02[_0xf617('0x1c')]['include']?_[_0xf617('0x20')](_0xf5ae02['options'][_0xf617('0x21')],function(_0x474062){return{'model':db[_0x474062[_0xf617('0x22')]],'as':_0x474062['as'],'attributes':_0x474062[_0xf617('0x1f')],'include':_0x474062[_0xf617('0x21')]?_['map'](_0x474062['include'],function(_0x13235b){return{'model':db[_0x13235b['model']],'as':_0x13235b['as'],'attributes':_0x13235b[_0xf617('0x1f')],'include':_0x13235b['include']?_[_0xf617('0x20')](_0x13235b[_0xf617('0x21')],function(_0x3c6e95){return{'model':db[_0x3c6e95[_0xf617('0x22')]],'as':_0x3c6e95['as'],'attributes':_0x3c6e95[_0xf617('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf617('0x23')](function(_0x350453){logger[_0xf617('0x12')](_0xf617('0x1a'),_0xf5ae02);logger['debug'](_0xf617('0x1a'),_0xf5ae02,JSON[_0xf617('0x15')](_0x350453));_0x591d2e(_0x350453);})[_0xf617('0x24')](function(_0x3b228b){logger[_0xf617('0x16')](_0xf617('0x1a'),_0x3b228b[_0xf617('0x18')],_0xf5ae02);_0x1c9f8c(_0x53dabd[_0xf617('0x16')](0x1f4,_0x3b228b['message']));});});};exports[_0xf617('0x25')]=function(_0x443915){var _0x538b8e=this;return new Promise(function(_0x5ba464,_0xca2772){return db[_0xf617('0x1b')][_0xf617('0x26')]({'raw':_0x443915[_0xf617('0x1c')]?_0x443915[_0xf617('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x443915[_0xf617('0x1c')]?_0x443915[_0xf617('0x1c')][_0xf617('0x1e')]||null:null,'attributes':_0x443915[_0xf617('0x1c')]?_0x443915['options'][_0xf617('0x1f')]||null:null,'include':_0x443915[_0xf617('0x1c')]?_0x443915[_0xf617('0x1c')]['include']?_[_0xf617('0x20')](_0x443915[_0xf617('0x1c')][_0xf617('0x21')],function(_0x5b8914){return{'model':db[_0x5b8914['model']],'as':_0x5b8914['as'],'attributes':_0x5b8914['attributes'],'include':_0x5b8914[_0xf617('0x21')]?_[_0xf617('0x20')](_0x5b8914[_0xf617('0x21')],function(_0xdaeb59){return{'model':db[_0xdaeb59['model']],'as':_0xdaeb59['as'],'attributes':_0xdaeb59[_0xf617('0x1f')],'include':_0xdaeb59['include']?_['map'](_0xdaeb59['include'],function(_0x220114){return{'model':db[_0x220114[_0xf617('0x22')]],'as':_0x220114['as'],'attributes':_0x220114['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x156f09){logger[_0xf617('0x12')](_0xf617('0x25'),_0x443915);logger[_0xf617('0x27')](_0xf617('0x25'),_0x443915,JSON[_0xf617('0x15')](_0x156f09));_0x5ba464(_0x156f09);})[_0xf617('0x24')](function(_0x207544){logger[_0xf617('0x16')](_0xf617('0x25'),_0x207544['message'],_0x443915);_0xca2772(_0x538b8e['error'](0x1f4,_0x207544[_0xf617('0x18')]));});});}; \ No newline at end of file +var _0x3af5=['redis','localhost','socket.io-emitter','./chatQueue.socket','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowChatQueue','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','defaults'];(function(_0x1dcf41,_0x1c200b){var _0x15eb43=function(_0x452a30){while(--_0x452a30){_0x1dcf41['push'](_0x1dcf41['shift']());}};_0x15eb43(++_0x1c200b);}(_0x3af5,0x1d3));var _0x53af=function(_0x20008a,_0x362490){_0x20008a=_0x20008a-0x0;var _0x5d0f1c=_0x3af5[_0x20008a];return _0x5d0f1c;};'use strict';var _=require(_0x53af('0x0'));var util=require(_0x53af('0x1'));var moment=require('moment');var BPromise=require(_0x53af('0x2'));var rs=require(_0x53af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x53af('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x53af('0x5'));var jayson=require(_0x53af('0x6'));var client=jayson['client'][_0x53af('0x7')]({'port':0x232a});config['redis']=_[_0x53af('0x8')](config[_0x53af('0x9')],{'host':_0x53af('0xa'),'port':0x18eb});var socket=require(_0x53af('0xb'))(new Redis(config[_0x53af('0x9')]));require(_0x53af('0xc'))['register'](socket);function respondWithRpcPromise(_0x52b4d1,_0x10ee70,_0x5727e6){return new BPromise(function(_0x370cdc,_0x4673a9){return client['request'](_0x52b4d1,_0x5727e6)[_0x53af('0xd')](function(_0x1a08ca){logger['info'](_0x53af('0xe'),_0x10ee70,_0x53af('0xf'));logger[_0x53af('0x10')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x10ee70,_0x53af('0xf'),JSON['stringify'](_0x1a08ca));if(_0x1a08ca[_0x53af('0x11')]){if(_0x1a08ca[_0x53af('0x11')][_0x53af('0x12')]===0x1f4){logger[_0x53af('0x11')](_0x53af('0xe'),_0x10ee70,_0x1a08ca[_0x53af('0x11')][_0x53af('0x13')]);return _0x4673a9(_0x1a08ca[_0x53af('0x11')][_0x53af('0x13')]);}logger[_0x53af('0x11')]('ChatQueue,\x20%s,\x20%s',_0x10ee70,_0x1a08ca[_0x53af('0x11')][_0x53af('0x13')]);return _0x370cdc(_0x1a08ca[_0x53af('0x11')][_0x53af('0x13')]);}else{logger[_0x53af('0x14')](_0x53af('0xe'),_0x10ee70,_0x53af('0xf'));_0x370cdc(_0x1a08ca['result'][_0x53af('0x13')]);}})[_0x53af('0x15')](function(_0xae3142){logger[_0x53af('0x11')]('ChatQueue,\x20%s,\x20%s',_0x10ee70,_0xae3142);_0x4673a9(_0xae3142);});});}exports['GetChatQueue']=function(_0x167dc2){var _0x3f5503=this;return new Promise(function(_0x37ecb3,_0x5a31d6){return db[_0x53af('0x16')][_0x53af('0x17')]({'raw':_0x167dc2[_0x53af('0x18')]?_0x167dc2[_0x53af('0x18')][_0x53af('0x19')]===undefined?!![]:![]:!![],'where':_0x167dc2[_0x53af('0x18')]?_0x167dc2[_0x53af('0x18')][_0x53af('0x1a')]||null:null,'attributes':_0x167dc2['options']?_0x167dc2[_0x53af('0x18')][_0x53af('0x1b')]||null:null,'limit':_0x167dc2[_0x53af('0x18')]?_0x167dc2[_0x53af('0x18')][_0x53af('0x1c')]||null:null,'include':_0x167dc2[_0x53af('0x18')]?_0x167dc2['options'][_0x53af('0x1d')]?_[_0x53af('0x1e')](_0x167dc2[_0x53af('0x18')][_0x53af('0x1d')],function(_0x480665){return{'model':db[_0x480665[_0x53af('0x1f')]],'as':_0x480665['as'],'attributes':_0x480665[_0x53af('0x1b')],'include':_0x480665[_0x53af('0x1d')]?_[_0x53af('0x1e')](_0x480665[_0x53af('0x1d')],function(_0x152dcc){return{'model':db[_0x152dcc[_0x53af('0x1f')]],'as':_0x152dcc['as'],'attributes':_0x152dcc[_0x53af('0x1b')],'include':_0x152dcc['include']?_[_0x53af('0x1e')](_0x152dcc[_0x53af('0x1d')],function(_0xc9b0df){return{'model':db[_0xc9b0df[_0x53af('0x1f')]],'as':_0xc9b0df['as'],'attributes':_0xc9b0df[_0x53af('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x53af('0xd')](function(_0x154cc2){logger['info']('GetChatQueue',_0x167dc2);logger[_0x53af('0x10')]('GetChatQueue',_0x167dc2,JSON[_0x53af('0x20')](_0x154cc2));_0x37ecb3(_0x154cc2);})[_0x53af('0x15')](function(_0x38563d){logger[_0x53af('0x11')]('GetChatQueue',_0x38563d[_0x53af('0x13')],_0x167dc2);_0x5a31d6(_0x3f5503[_0x53af('0x11')](0x1f4,_0x38563d['message']));});});};exports['ShowChatQueue']=function(_0xc0dae3){var _0x1fa69c=this;return new Promise(function(_0x1a688c,_0x243ee5){return db['ChatQueue']['find']({'raw':_0xc0dae3[_0x53af('0x18')]?_0xc0dae3[_0x53af('0x18')][_0x53af('0x19')]===undefined?!![]:![]:!![],'where':_0xc0dae3['options']?_0xc0dae3['options'][_0x53af('0x1a')]||null:null,'attributes':_0xc0dae3[_0x53af('0x18')]?_0xc0dae3[_0x53af('0x18')][_0x53af('0x1b')]||null:null,'include':_0xc0dae3[_0x53af('0x18')]?_0xc0dae3[_0x53af('0x18')][_0x53af('0x1d')]?_['map'](_0xc0dae3[_0x53af('0x18')][_0x53af('0x1d')],function(_0x51784e){return{'model':db[_0x51784e[_0x53af('0x1f')]],'as':_0x51784e['as'],'attributes':_0x51784e[_0x53af('0x1b')],'include':_0x51784e[_0x53af('0x1d')]?_[_0x53af('0x1e')](_0x51784e[_0x53af('0x1d')],function(_0x576bfc){return{'model':db[_0x576bfc[_0x53af('0x1f')]],'as':_0x576bfc['as'],'attributes':_0x576bfc['attributes'],'include':_0x576bfc[_0x53af('0x1d')]?_[_0x53af('0x1e')](_0x576bfc[_0x53af('0x1d')],function(_0x1213a6){return{'model':db[_0x1213a6[_0x53af('0x1f')]],'as':_0x1213a6['as'],'attributes':_0x1213a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e3295){logger[_0x53af('0x14')]('ShowChatQueue',_0xc0dae3);logger['debug']('ShowChatQueue',_0xc0dae3,JSON[_0x53af('0x20')](_0x5e3295));_0x1a688c(_0x5e3295);})[_0x53af('0x15')](function(_0x440655){logger[_0x53af('0x11')](_0x53af('0x21'),_0x440655[_0x53af('0x13')],_0xc0dae3);_0x243ee5(_0x1fa69c[_0x53af('0x11')](0x1f4,_0x440655[_0x53af('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index e55c9c3..b70dedf 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 _0x4b19=['remove','update','emit','removeListener','register','chatQueue:','./chatQueue.events'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x4b19,0x195));var _0x94b1=function(_0x2464a5,_0x46e146){_0x2464a5=_0x2464a5-0x0;var _0x49c410=_0x4b19[_0x2464a5];return _0x49c410;};'use strict';var ChatQueueEvents=require(_0x94b1('0x0'));var events=['save',_0x94b1('0x1'),_0x94b1('0x2')];function createListener(_0x221ab3,_0x577f52){return function(_0x1ffdb7){_0x577f52[_0x94b1('0x3')](_0x221ab3,_0x1ffdb7);};}function removeListener(_0x2240b9,_0x4f607f){return function(){ChatQueueEvents[_0x94b1('0x4')](_0x2240b9,_0x4f607f);};}exports[_0x94b1('0x5')]=function(_0x52d6c1){for(var _0x24df76=0x0,_0x110a52=events['length'];_0x24df76<_0x110a52;_0x24df76++){var _0x40c69c=events[_0x24df76];var _0x201a02=createListener(_0x94b1('0x6')+_0x40c69c,_0x52d6c1);ChatQueueEvents['on'](_0x40c69c,_0x201a02);}}; \ No newline at end of file +var _0xed1f=['register','length','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xed1f,0x6a));var _0xfed1=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xed1f[_0x411017];return _0x2adeea;};'use strict';var ChatQueueEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),_0xfed1('0x2'),_0xfed1('0x3')];function createListener(_0xa45937,_0x25f345){return function(_0x1dd614){_0x25f345[_0xfed1('0x4')](_0xa45937,_0x1dd614);};}function removeListener(_0x2209b3,_0x45c3c1){return function(){ChatQueueEvents[_0xfed1('0x5')](_0x2209b3,_0x45c3c1);};}exports[_0xfed1('0x6')]=function(_0x3d6706){for(var _0x42751d=0x0,_0x380e18=events[_0xfed1('0x7')];_0x42751d<_0x380e18;_0x42751d++){var _0x2a6082=events[_0x42751d];var _0x2967ef=createListener('chatQueue:'+_0x2a6082,_0x3d6706);ChatQueueEvents['on'](_0x2a6082,_0x2967ef);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 700990a..a985933 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 _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(_0x24a10d,_0x186056){var _0x25a80c=function(_0x106b8b){while(--_0x106b8b){_0x24a10d['push'](_0x24a10d['shift']());}};_0x25a80c(++_0x186056);}(_0x008c,0x188));var _0xc008=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x008c[_0x3cf5a3];return _0x39ba2d;};'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 +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x57f576,_0x44ff3e){var _0x2f0655=function(_0x58b35e){while(--_0x58b35e){_0x57f576['push'](_0x57f576['shift']());}};_0x2f0655(++_0x44ff3e);}(_0xe14b,0x93));var _0xbe14=function(_0x56b8eb,_0x1b90ab){_0x56b8eb=_0x56b8eb-0x0;var _0x31494f=_0xe14b[_0x56b8eb];return _0x31494f;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 0e0272b..c821a27 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 _0x793b=['moment','exports','STRING','DATE'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x793b,0xf0));var _0xb793=function(_0x4be3f9,_0x18a6b1){_0x4be3f9=_0x4be3f9-0x0;var _0x1bad41=_0x793b[_0x4be3f9];return _0x1bad41;};'use strict';var moment=require(_0xb793('0x0'));var Sequelize=require('sequelize');module[_0xb793('0x1')]={'uniqueid':{'type':Sequelize[_0xb793('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb793('0x3')]},'acceptAt':{'type':Sequelize[_0xb793('0x3')]},'exitAt':{'type':Sequelize[_0xb793('0x3')]},'reason':{'type':Sequelize[_0xb793('0x2')]}}; \ No newline at end of file +var _0x68f5=['STRING','DATE','moment','sequelize','exports'];(function(_0x6d97cc,_0xc03086){var _0x32fc5c=function(_0x4b0755){while(--_0x4b0755){_0x6d97cc['push'](_0x6d97cc['shift']());}};_0x32fc5c(++_0xc03086);}(_0x68f5,0x11a));var _0x568f=function(_0x1b3d0e,_0x1fba2f){_0x1b3d0e=_0x1b3d0e-0x0;var _0x2dac24=_0x68f5[_0x1b3d0e];return _0x2dac24;};'use strict';var moment=require(_0x568f('0x0'));var Sequelize=require(_0x568f('0x1'));module[_0x568f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x568f('0x3')]},'joinAt':{'type':Sequelize[_0x568f('0x4')]},'leaveAt':{'type':Sequelize[_0x568f('0x4')]},'acceptAt':{'type':Sequelize[_0x568f('0x4')]},'exitAt':{'type':Sequelize[_0x568f('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index da1f2e5..1303838 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 _0x01db=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','name','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','create','body','find','destroy','describe','eml-format','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1b8be9,_0x49dce5){var _0x5a544f=function(_0x4cd533){while(--_0x4cd533){_0x1b8be9['push'](_0x1b8be9['shift']());}};_0x5a544f(++_0x49dce5);}(_0x01db,0x171));var _0xb01d=function(_0x1e2d59,_0x58a35f){_0x1e2d59=_0x1e2d59-0x0;var _0x2cffb6=_0x01db[_0x1e2d59];return _0x2cffb6;};'use strict';var emlformat=require(_0xb01d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb01d('0x1'));var rp=require(_0xb01d('0x2'));var moment=require(_0xb01d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb01d('0x4'));var util=require('util');var path=require('path');var sox=require(_0xb01d('0x5'));var csv=require(_0xb01d('0x6'));var ejs=require(_0xb01d('0x7'));var fs=require('fs');var fs_extra=require(_0xb01d('0x8'));var _=require(_0xb01d('0x9'));var squel=require(_0xb01d('0xa'));var crypto=require(_0xb01d('0xb'));var jsforce=require(_0xb01d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb01d('0xd'));var Papa=require(_0xb01d('0xe'));var Redis=require(_0xb01d('0xf'));var authService=require(_0xb01d('0x10'));var qs=require(_0xb01d('0x11'));var as=require(_0xb01d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb01d('0x13'));var utils=require(_0xb01d('0x14'));var config=require(_0xb01d('0x15'));var licenseUtil=require(_0xb01d('0x16'));var db=require(_0xb01d('0x17'))['db'];function respondWithStatusCode(_0x447479,_0xbcc293){_0xbcc293=_0xbcc293||0xcc;return function(_0x48b905){if(_0x48b905){return _0x447479['sendStatus'](_0xbcc293);}return _0x447479[_0xb01d('0x18')](_0xbcc293)['end']();};}function respondWithResult(_0x246537,_0x2e1ec7){_0x2e1ec7=_0x2e1ec7||0xc8;return function(_0x4a7641){if(_0x4a7641){return _0x246537[_0xb01d('0x18')](_0x2e1ec7)[_0xb01d('0x19')](_0x4a7641);}};}function respondWithFilteredResult(_0x286c13,_0x219327){return function(_0x515789){if(_0x515789){var _0x135604=typeof _0x219327['offset']===_0xb01d('0x1a')&&typeof _0x219327[_0xb01d('0x1b')]===_0xb01d('0x1a');var _0x2009a2=_0x515789['count'];var _0xe47874=_0x135604?0x0:_0x219327[_0xb01d('0x1c')];var _0x39eaaf=_0x135604?_0x515789['count']:_0x219327[_0xb01d('0x1c')]+_0x219327['limit'];var _0x42961b;if(_0x39eaaf>=_0x2009a2){_0x39eaaf=_0x2009a2;_0x42961b=0xc8;}else{_0x42961b=0xce;}_0x286c13[_0xb01d('0x18')](_0x42961b);return _0x286c13[_0xb01d('0x1d')](_0xb01d('0x1e'),_0xe47874+'-'+_0x39eaaf+'/'+_0x2009a2)[_0xb01d('0x19')](_0x515789);}return null;};}function patchUpdates(_0x4d517e){return function(_0x2528ac){try{jsonpatch[_0xb01d('0x1f')](_0x2528ac,_0x4d517e,!![]);}catch(_0x149b50){return BPromise[_0xb01d('0x20')](_0x149b50);}return _0x2528ac[_0xb01d('0x21')]();};}function saveUpdates(_0x7de0a2,_0x28f643){return function(_0x42064d){if(_0x42064d){return _0x42064d[_0xb01d('0x22')](_0x7de0a2)[_0xb01d('0x23')](function(_0x1151ea){return _0x1151ea;});}return null;};}function removeEntity(_0x19ef37,_0x515d52){return function(_0x446824){if(_0x446824){return _0x446824['destroy']()[_0xb01d('0x23')](function(){_0x19ef37[_0xb01d('0x18')](0xcc)[_0xb01d('0x24')]();});}};}function handleEntityNotFound(_0x3ce3f8,_0xf92ae7){return function(_0x1d8f04){if(!_0x1d8f04){_0x3ce3f8[_0xb01d('0x25')](0x194);}return _0x1d8f04;};}function handleError(_0x1dcbcd,_0xe9e66e){_0xe9e66e=_0xe9e66e||0x1f4;return function(_0x1236c2){logger[_0xb01d('0x26')](_0x1236c2['stack']);if(_0x1236c2[_0xb01d('0x27')]){delete _0x1236c2[_0xb01d('0x27')];}_0x1dcbcd[_0xb01d('0x18')](_0xe9e66e)['send'](_0x1236c2);};}exports[_0xb01d('0x28')]=function(_0x1bd8d2,_0x1659fa){var _0x58b452={},_0x29b32c={},_0x5007d1={'count':0x0,'rows':[]};var _0x13345a=_[_0xb01d('0x29')](db[_0xb01d('0x2a')]['rawAttributes'],function(_0x2f3046){return{'name':_0x2f3046[_0xb01d('0x2b')],'type':_0x2f3046[_0xb01d('0x2c')][_0xb01d('0x2d')]};});_0x29b32c[_0xb01d('0x2e')]=_[_0xb01d('0x29')](_0x13345a,'name');_0x29b32c[_0xb01d('0x2f')]=_[_0xb01d('0x30')](_0x1bd8d2[_0xb01d('0x2f')]);_0x29b32c['filters']=_[_0xb01d('0x31')](_0x29b32c['model'],_0x29b32c['query']);_0x58b452[_0xb01d('0x32')]=_[_0xb01d('0x31')](_0x29b32c['model'],qs['fields'](_0x1bd8d2[_0xb01d('0x2f')][_0xb01d('0x33')]));_0x58b452[_0xb01d('0x32')]=_0x58b452[_0xb01d('0x32')][_0xb01d('0x34')]?_0x58b452[_0xb01d('0x32')]:_0x29b32c[_0xb01d('0x2e')];if(!_0x1bd8d2[_0xb01d('0x2f')][_0xb01d('0x35')]('nolimit')){_0x58b452[_0xb01d('0x1b')]=qs[_0xb01d('0x1b')](_0x1bd8d2[_0xb01d('0x2f')][_0xb01d('0x1b')]);_0x58b452['offset']=qs[_0xb01d('0x1c')](_0x1bd8d2['query'][_0xb01d('0x1c')]);}_0x58b452[_0xb01d('0x36')]=qs[_0xb01d('0x37')](_0x1bd8d2[_0xb01d('0x2f')]['sort']);_0x58b452[_0xb01d('0x38')]=qs[_0xb01d('0x39')](_[_0xb01d('0x3a')](_0x1bd8d2[_0xb01d('0x2f')],_0x29b32c[_0xb01d('0x39')]),_0x13345a);if(_0x1bd8d2['query'][_0xb01d('0x3b')]){_0x58b452[_0xb01d('0x38')]=_[_0xb01d('0x3c')](_0x58b452[_0xb01d('0x38')],{'$or':_[_0xb01d('0x29')](_0x13345a,function(_0x25c283){if(_0x25c283[_0xb01d('0x2c')]!=='VIRTUAL'){var _0x4b93f0={};_0x4b93f0[_0x25c283[_0xb01d('0x27')]]={'$like':'%'+_0x1bd8d2['query'][_0xb01d('0x3b')]+'%'};return _0x4b93f0;}})});}_0x58b452=_[_0xb01d('0x3c')]({},_0x58b452,_0x1bd8d2['options']);var _0x847853={'where':_0x58b452[_0xb01d('0x38')]};return db[_0xb01d('0x2a')][_0xb01d('0x3d')](_0x847853)['then'](function(_0x459f4a){_0x5007d1[_0xb01d('0x3d')]=_0x459f4a;if(_0x1bd8d2['query'][_0xb01d('0x3e')]){_0x58b452['include']=[{'all':!![]}];}return db[_0xb01d('0x2a')][_0xb01d('0x3f')](_0x58b452);})[_0xb01d('0x23')](function(_0x59023b){_0x5007d1[_0xb01d('0x40')]=_0x59023b;return _0x5007d1;})['then'](respondWithFilteredResult(_0x1659fa,_0x58b452))[_0xb01d('0x41')](handleError(_0x1659fa,null));};exports[_0xb01d('0x42')]=function(_0x2d29ad,_0x2f582f){var _0x5087cb={'raw':!![],'where':{'id':_0x2d29ad[_0xb01d('0x43')]['id']}},_0x502880={};_0x502880[_0xb01d('0x2e')]=_[_0xb01d('0x30')](db[_0xb01d('0x2a')][_0xb01d('0x44')]);_0x502880[_0xb01d('0x2f')]=_[_0xb01d('0x30')](_0x2d29ad[_0xb01d('0x2f')]);_0x502880[_0xb01d('0x39')]=_['intersection'](_0x502880['model'],_0x502880['query']);_0x5087cb[_0xb01d('0x32')]=_[_0xb01d('0x31')](_0x502880['model'],qs[_0xb01d('0x33')](_0x2d29ad['query']['fields']));_0x5087cb[_0xb01d('0x32')]=_0x5087cb[_0xb01d('0x32')]['length']?_0x5087cb[_0xb01d('0x32')]:_0x502880[_0xb01d('0x2e')];if(_0x2d29ad[_0xb01d('0x2f')][_0xb01d('0x3e')]){_0x5087cb[_0xb01d('0x45')]=[{'all':!![]}];}_0x5087cb=_[_0xb01d('0x3c')]({},_0x5087cb,_0x2d29ad[_0xb01d('0x46')]);return db['ChatQueueReport']['find'](_0x5087cb)[_0xb01d('0x23')](handleEntityNotFound(_0x2f582f,null))['then'](respondWithResult(_0x2f582f,null))['catch'](handleError(_0x2f582f,null));};exports[_0xb01d('0x47')]=function(_0x75b2e7,_0x361acb){return db['ChatQueueReport'][_0xb01d('0x47')](_0x75b2e7[_0xb01d('0x48')],{})[_0xb01d('0x23')](respondWithResult(_0x361acb,0xc9))['catch'](handleError(_0x361acb,null));};exports[_0xb01d('0x22')]=function(_0x500bff,_0x494b9c){if(_0x500bff[_0xb01d('0x48')]['id']){delete _0x500bff[_0xb01d('0x48')]['id'];}return db[_0xb01d('0x2a')][_0xb01d('0x49')]({'where':{'id':_0x500bff[_0xb01d('0x43')]['id']}})[_0xb01d('0x23')](handleEntityNotFound(_0x494b9c,null))[_0xb01d('0x23')](saveUpdates(_0x500bff[_0xb01d('0x48')],null))[_0xb01d('0x23')](respondWithResult(_0x494b9c,null))[_0xb01d('0x41')](handleError(_0x494b9c,null));};exports[_0xb01d('0x4a')]=function(_0x403786,_0xe9e895){return db[_0xb01d('0x2a')][_0xb01d('0x49')]({'where':{'id':_0x403786['params']['id']}})[_0xb01d('0x23')](handleEntityNotFound(_0xe9e895,null))[_0xb01d('0x23')](removeEntity(_0xe9e895,null))[_0xb01d('0x41')](handleError(_0xe9e895,null));};exports[_0xb01d('0x4b')]=function(_0x128512,_0x1332a3){return db['ChatQueueReport'][_0xb01d('0x4b')]()[_0xb01d('0x23')](respondWithResult(_0x1332a3,null))[_0xb01d('0x41')](handleError(_0x1332a3,null));}; \ No newline at end of file +var _0x5ff9=['show','find','catch','create','body','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','ChatQueueReport','includeAll','include','findAll'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x5ff9,0xa0));var _0x95ff=function(_0xa3f784,_0x12bba2){_0xa3f784=_0xa3f784-0x0;var _0x2c5827=_0x5ff9[_0xa3f784];return _0x2c5827;};'use strict';var emlformat=require(_0x95ff('0x0'));var rimraf=require(_0x95ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ff('0x2'));var rp=require(_0x95ff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95ff('0x4'));var util=require('util');var path=require('path');var sox=require(_0x95ff('0x5'));var csv=require(_0x95ff('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95ff('0x7'));var _=require('lodash');var squel=require(_0x95ff('0x8'));var crypto=require(_0x95ff('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x95ff('0xa'));var toCsv=require('to-csv');var querystring=require(_0x95ff('0xb'));var Papa=require(_0x95ff('0xc'));var Redis=require('ioredis');var authService=require(_0x95ff('0xd'));var qs=require(_0x95ff('0xe'));var as=require(_0x95ff('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95ff('0x10'))(_0x95ff('0x11'));var utils=require(_0x95ff('0x12'));var config=require(_0x95ff('0x13'));var licenseUtil=require(_0x95ff('0x14'));var db=require(_0x95ff('0x15'))['db'];function respondWithStatusCode(_0x52a97e,_0x5293e9){_0x5293e9=_0x5293e9||0xcc;return function(_0x39ce1b){if(_0x39ce1b){return _0x52a97e[_0x95ff('0x16')](_0x5293e9);}return _0x52a97e[_0x95ff('0x17')](_0x5293e9)[_0x95ff('0x18')]();};}function respondWithResult(_0x59bcac,_0x3a29fc){_0x3a29fc=_0x3a29fc||0xc8;return function(_0x40c53b){if(_0x40c53b){return _0x59bcac['status'](_0x3a29fc)[_0x95ff('0x19')](_0x40c53b);}};}function respondWithFilteredResult(_0x1b6c9a,_0x4cc1f2){return function(_0x59c504){if(_0x59c504){var _0xf8fee=typeof _0x4cc1f2[_0x95ff('0x1a')]===_0x95ff('0x1b')&&typeof _0x4cc1f2['limit']===_0x95ff('0x1b');var _0x4fd920=_0x59c504['count'];var _0x1929c4=_0xf8fee?0x0:_0x4cc1f2[_0x95ff('0x1a')];var _0x1c67e4=_0xf8fee?_0x59c504[_0x95ff('0x1c')]:_0x4cc1f2['offset']+_0x4cc1f2[_0x95ff('0x1d')];var _0x1467df;if(_0x1c67e4>=_0x4fd920){_0x1c67e4=_0x4fd920;_0x1467df=0xc8;}else{_0x1467df=0xce;}_0x1b6c9a[_0x95ff('0x17')](_0x1467df);return _0x1b6c9a[_0x95ff('0x1e')](_0x95ff('0x1f'),_0x1929c4+'-'+_0x1c67e4+'/'+_0x4fd920)['json'](_0x59c504);}return null;};}function patchUpdates(_0x363691){return function(_0x409963){try{jsonpatch[_0x95ff('0x20')](_0x409963,_0x363691,!![]);}catch(_0x169dcb){return BPromise[_0x95ff('0x21')](_0x169dcb);}return _0x409963['save']();};}function saveUpdates(_0x552067,_0x1151d8){return function(_0x2d02f2){if(_0x2d02f2){return _0x2d02f2[_0x95ff('0x22')](_0x552067)[_0x95ff('0x23')](function(_0x4be963){return _0x4be963;});}return null;};}function removeEntity(_0x3cf2eb,_0x1f79b1){return function(_0x4fa568){if(_0x4fa568){return _0x4fa568['destroy']()[_0x95ff('0x23')](function(){_0x3cf2eb['status'](0xcc)[_0x95ff('0x18')]();});}};}function handleEntityNotFound(_0x206d30,_0xbc5e96){return function(_0x1830f5){if(!_0x1830f5){_0x206d30[_0x95ff('0x16')](0x194);}return _0x1830f5;};}function handleError(_0x2b4926,_0x4e5178){_0x4e5178=_0x4e5178||0x1f4;return function(_0x43e339){logger[_0x95ff('0x24')](_0x43e339[_0x95ff('0x25')]);if(_0x43e339[_0x95ff('0x26')]){delete _0x43e339[_0x95ff('0x26')];}_0x2b4926[_0x95ff('0x17')](_0x4e5178)[_0x95ff('0x27')](_0x43e339);};}exports[_0x95ff('0x28')]=function(_0x258339,_0x3b4919){var _0x37b9bc={},_0x2fcc8b={},_0x2bc475={'count':0x0,'rows':[]};var _0x89c03d=_[_0x95ff('0x29')](db['ChatQueueReport'][_0x95ff('0x2a')],function(_0x73f4c){return{'name':_0x73f4c[_0x95ff('0x2b')],'type':_0x73f4c[_0x95ff('0x2c')][_0x95ff('0x2d')]};});_0x2fcc8b[_0x95ff('0x2e')]=_[_0x95ff('0x29')](_0x89c03d,'name');_0x2fcc8b[_0x95ff('0x2f')]=_[_0x95ff('0x30')](_0x258339[_0x95ff('0x2f')]);_0x2fcc8b[_0x95ff('0x31')]=_[_0x95ff('0x32')](_0x2fcc8b[_0x95ff('0x2e')],_0x2fcc8b['query']);_0x37b9bc[_0x95ff('0x33')]=_[_0x95ff('0x32')](_0x2fcc8b[_0x95ff('0x2e')],qs[_0x95ff('0x34')](_0x258339[_0x95ff('0x2f')][_0x95ff('0x34')]));_0x37b9bc[_0x95ff('0x33')]=_0x37b9bc['attributes'][_0x95ff('0x35')]?_0x37b9bc[_0x95ff('0x33')]:_0x2fcc8b['model'];if(!_0x258339[_0x95ff('0x2f')][_0x95ff('0x36')](_0x95ff('0x37'))){_0x37b9bc[_0x95ff('0x1d')]=qs[_0x95ff('0x1d')](_0x258339[_0x95ff('0x2f')][_0x95ff('0x1d')]);_0x37b9bc[_0x95ff('0x1a')]=qs[_0x95ff('0x1a')](_0x258339['query'][_0x95ff('0x1a')]);}_0x37b9bc[_0x95ff('0x38')]=qs[_0x95ff('0x39')](_0x258339[_0x95ff('0x2f')]['sort']);_0x37b9bc['where']=qs[_0x95ff('0x31')](_[_0x95ff('0x3a')](_0x258339[_0x95ff('0x2f')],_0x2fcc8b[_0x95ff('0x31')]),_0x89c03d);if(_0x258339['query']['filter']){_0x37b9bc[_0x95ff('0x3b')]=_['merge'](_0x37b9bc[_0x95ff('0x3b')],{'$or':_[_0x95ff('0x29')](_0x89c03d,function(_0x3d1670){if(_0x3d1670[_0x95ff('0x2c')]!==_0x95ff('0x3c')){var _0x1c0d9d={};_0x1c0d9d[_0x3d1670[_0x95ff('0x26')]]={'$like':'%'+_0x258339[_0x95ff('0x2f')][_0x95ff('0x3d')]+'%'};return _0x1c0d9d;}})});}_0x37b9bc=_[_0x95ff('0x3e')]({},_0x37b9bc,_0x258339[_0x95ff('0x3f')]);var _0x595807={'where':_0x37b9bc['where']};return db[_0x95ff('0x40')][_0x95ff('0x1c')](_0x595807)[_0x95ff('0x23')](function(_0x4ff017){_0x2bc475[_0x95ff('0x1c')]=_0x4ff017;if(_0x258339['query'][_0x95ff('0x41')]){_0x37b9bc[_0x95ff('0x42')]=[{'all':!![]}];}return db[_0x95ff('0x40')][_0x95ff('0x43')](_0x37b9bc);})[_0x95ff('0x23')](function(_0x56de6f){_0x2bc475['rows']=_0x56de6f;return _0x2bc475;})[_0x95ff('0x23')](respondWithFilteredResult(_0x3b4919,_0x37b9bc))['catch'](handleError(_0x3b4919,null));};exports[_0x95ff('0x44')]=function(_0x5eb53c,_0x501b48){var _0x152710={'raw':!![],'where':{'id':_0x5eb53c['params']['id']}},_0x199883={};_0x199883[_0x95ff('0x2e')]=_[_0x95ff('0x30')](db[_0x95ff('0x40')][_0x95ff('0x2a')]);_0x199883[_0x95ff('0x2f')]=_[_0x95ff('0x30')](_0x5eb53c[_0x95ff('0x2f')]);_0x199883[_0x95ff('0x31')]=_['intersection'](_0x199883[_0x95ff('0x2e')],_0x199883[_0x95ff('0x2f')]);_0x152710[_0x95ff('0x33')]=_['intersection'](_0x199883[_0x95ff('0x2e')],qs[_0x95ff('0x34')](_0x5eb53c[_0x95ff('0x2f')][_0x95ff('0x34')]));_0x152710['attributes']=_0x152710[_0x95ff('0x33')][_0x95ff('0x35')]?_0x152710[_0x95ff('0x33')]:_0x199883[_0x95ff('0x2e')];if(_0x5eb53c[_0x95ff('0x2f')][_0x95ff('0x41')]){_0x152710['include']=[{'all':!![]}];}_0x152710=_[_0x95ff('0x3e')]({},_0x152710,_0x5eb53c['options']);return db[_0x95ff('0x40')][_0x95ff('0x45')](_0x152710)[_0x95ff('0x23')](handleEntityNotFound(_0x501b48,null))['then'](respondWithResult(_0x501b48,null))[_0x95ff('0x46')](handleError(_0x501b48,null));};exports[_0x95ff('0x47')]=function(_0x5c1cb4,_0x3e5051){return db['ChatQueueReport'][_0x95ff('0x47')](_0x5c1cb4[_0x95ff('0x48')],{})[_0x95ff('0x23')](respondWithResult(_0x3e5051,0xc9))[_0x95ff('0x46')](handleError(_0x3e5051,null));};exports[_0x95ff('0x22')]=function(_0x582a03,_0x58c9f2){if(_0x582a03[_0x95ff('0x48')]['id']){delete _0x582a03['body']['id'];}return db[_0x95ff('0x40')][_0x95ff('0x45')]({'where':{'id':_0x582a03['params']['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x58c9f2,null))['then'](saveUpdates(_0x582a03[_0x95ff('0x48')],null))[_0x95ff('0x23')](respondWithResult(_0x58c9f2,null))[_0x95ff('0x46')](handleError(_0x58c9f2,null));};exports[_0x95ff('0x49')]=function(_0x36e05f,_0x117ac1){return db[_0x95ff('0x40')][_0x95ff('0x45')]({'where':{'id':_0x36e05f[_0x95ff('0x4a')]['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x117ac1,null))[_0x95ff('0x23')](removeEntity(_0x117ac1,null))['catch'](handleError(_0x117ac1,null));};exports['describe']=function(_0x1c91cd,_0x5c892a){return db[_0x95ff('0x40')][_0x95ff('0x4b')]()[_0x95ff('0x23')](respondWithResult(_0x5c892a,null))['catch'](handleError(_0x5c892a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 30769a5..77313fb 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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x43121f,_0x39d303){var _0x114067=function(_0x3b6b12){while(--_0x3b6b12){_0x43121f['push'](_0x43121f['shift']());}};_0x114067(++_0x39d303);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x1b7171,_0x533d9a){var _0x3c3db2=function(_0x4d7038){while(--_0x4d7038){_0x1b7171['push'](_0x1b7171['shift']());}};_0x3c3db2(++_0x533d9a);}(_0xe706,0xa3));var _0x6e70=function(_0x4a611d,_0x36da69){_0x4a611d=_0x4a611d-0x0;var _0xde08a3=_0xe706[_0x4a611d];return _0xde08a3;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 87713be..969d472 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 _0xf264=['UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','update','attributes','limit'];(function(_0x17cdf0,_0x3b96f4){var _0x4721d1=function(_0xf69011){while(--_0xf69011){_0x17cdf0['push'](_0x17cdf0['shift']());}};_0x4721d1(++_0x3b96f4);}(_0xf264,0x1d2));var _0x4f26=function(_0x42c17c,_0x35a3e8){_0x42c17c=_0x42c17c-0x0;var _0xc75bb7=_0xf264[_0x42c17c];return _0xc75bb7;};'use strict';var _=require(_0x4f26('0x0'));var util=require(_0x4f26('0x1'));var moment=require(_0x4f26('0x2'));var BPromise=require(_0x4f26('0x3'));var rs=require(_0x4f26('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f26('0x5'));var config=require('../../config/environment');var jayson=require(_0x4f26('0x6'));var client=jayson[_0x4f26('0x7')][_0x4f26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1078da,_0x4f3d59,_0x5b574b){return new BPromise(function(_0x3f16fe,_0x486c92){return client[_0x4f26('0x9')](_0x1078da,_0x5b574b)[_0x4f26('0xa')](function(_0x2c7815){logger[_0x4f26('0xb')](_0x4f26('0xc'),_0x4f3d59,_0x4f26('0xd'));logger[_0x4f26('0xe')](_0x4f26('0xf'),_0x4f3d59,_0x4f26('0xd'),JSON[_0x4f26('0x10')](_0x2c7815));if(_0x2c7815[_0x4f26('0x11')]){if(_0x2c7815['error']['code']===0x1f4){logger[_0x4f26('0x11')](_0x4f26('0xc'),_0x4f3d59,_0x2c7815[_0x4f26('0x11')][_0x4f26('0x12')]);return _0x486c92(_0x2c7815[_0x4f26('0x11')][_0x4f26('0x12')]);}logger[_0x4f26('0x11')](_0x4f26('0xc'),_0x4f3d59,_0x2c7815[_0x4f26('0x11')]['message']);return _0x3f16fe(_0x2c7815['error']['message']);}else{logger[_0x4f26('0xb')](_0x4f26('0xc'),_0x4f3d59,_0x4f26('0xd'));_0x3f16fe(_0x2c7815[_0x4f26('0x13')][_0x4f26('0x12')]);}})[_0x4f26('0x14')](function(_0x3b217b){logger[_0x4f26('0x11')](_0x4f26('0xc'),_0x4f3d59,_0x3b217b);_0x486c92(_0x3b217b);});});}exports['CreateChatQueueReport']=function(_0x5d8560){var _0x151db9=this;return new Promise(function(_0x4faa22,_0x526f31){return db[_0x4f26('0x15')][_0x4f26('0x16')](_0x5d8560[_0x4f26('0x17')],{'raw':_0x5d8560[_0x4f26('0x18')]?_0x5d8560[_0x4f26('0x18')][_0x4f26('0x19')]===undefined?!![]:![]:!![]})[_0x4f26('0xa')](function(_0x43cdb5){logger['info'](_0x4f26('0x1a'),_0x5d8560);logger[_0x4f26('0xe')]('CreateChatQueueReport',_0x5d8560,JSON[_0x4f26('0x10')](_0x43cdb5));_0x4faa22(_0x43cdb5);})['catch'](function(_0x308196){logger[_0x4f26('0x11')](_0x4f26('0x1a'),_0x308196['message'],_0x5d8560);_0x526f31(_0x151db9[_0x4f26('0x11')](0x1f4,_0x308196[_0x4f26('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x4f3043){var _0x281eac=this;return new Promise(function(_0x819634,_0x2ea2fc){return db['ChatQueueReport'][_0x4f26('0x1b')](_0x4f3043[_0x4f26('0x17')],{'raw':_0x4f3043[_0x4f26('0x18')]?_0x4f3043['options'][_0x4f26('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f3043[_0x4f26('0x18')]?_0x4f3043[_0x4f26('0x18')]['where']||null:null,'attributes':_0x4f3043[_0x4f26('0x18')]?_0x4f3043[_0x4f26('0x18')][_0x4f26('0x1c')]||null:null,'limit':_0x4f3043['options']?_0x4f3043[_0x4f26('0x18')][_0x4f26('0x1d')]||null:null})[_0x4f26('0xa')](function(_0x2b1235){logger['info'](_0x4f26('0x1e'),_0x4f3043);logger[_0x4f26('0xe')](_0x4f26('0x1e'),_0x4f3043,JSON[_0x4f26('0x10')](_0x2b1235));_0x819634(_0x2b1235);})[_0x4f26('0x14')](function(_0x2fca5e){logger[_0x4f26('0x11')](_0x4f26('0x1e'),_0x2fca5e['message'],_0x4f3043);_0x2ea2fc(_0x281eac[_0x4f26('0x11')](0x1f4,_0x2fca5e[_0x4f26('0x12')]));});});}; \ No newline at end of file +var _0xb746=['attributes','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','where'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0xb746,0x187));var _0x6b74=function(_0x4667e3,_0x4d446c){_0x4667e3=_0x4667e3-0x0;var _0x3d3ed4=_0xb746[_0x4667e3];return _0x3d3ed4;};'use strict';var _=require('lodash');var util=require(_0x6b74('0x0'));var moment=require(_0x6b74('0x1'));var BPromise=require(_0x6b74('0x2'));var rs=require(_0x6b74('0x3'));var fs=require('fs');var Redis=require(_0x6b74('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6b74('0x5'))('rpc');var config=require(_0x6b74('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6b74('0x7')][_0x6b74('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x570a1c,_0x83cd31,_0x52d98c){return new BPromise(function(_0x5518d8,_0x6d3d5a){return client[_0x6b74('0x9')](_0x570a1c,_0x52d98c)[_0x6b74('0xa')](function(_0x569c0a){logger[_0x6b74('0xb')](_0x6b74('0xc'),_0x83cd31,_0x6b74('0xd'));logger[_0x6b74('0xe')](_0x6b74('0xf'),_0x83cd31,_0x6b74('0xd'),JSON['stringify'](_0x569c0a));if(_0x569c0a[_0x6b74('0x10')]){if(_0x569c0a[_0x6b74('0x10')]['code']===0x1f4){logger['error'](_0x6b74('0xc'),_0x83cd31,_0x569c0a[_0x6b74('0x10')][_0x6b74('0x11')]);return _0x6d3d5a(_0x569c0a[_0x6b74('0x10')][_0x6b74('0x11')]);}logger[_0x6b74('0x10')](_0x6b74('0xc'),_0x83cd31,_0x569c0a[_0x6b74('0x10')]['message']);return _0x5518d8(_0x569c0a[_0x6b74('0x10')][_0x6b74('0x11')]);}else{logger[_0x6b74('0xb')](_0x6b74('0xc'),_0x83cd31,_0x6b74('0xd'));_0x5518d8(_0x569c0a[_0x6b74('0x12')][_0x6b74('0x11')]);}})[_0x6b74('0x13')](function(_0x2f1dfc){logger['error'](_0x6b74('0xc'),_0x83cd31,_0x2f1dfc);_0x6d3d5a(_0x2f1dfc);});});}exports[_0x6b74('0x14')]=function(_0x22b623){var _0x5d4923=this;return new Promise(function(_0x5f2b0a,_0x5371c7){return db[_0x6b74('0x15')][_0x6b74('0x16')](_0x22b623[_0x6b74('0x17')],{'raw':_0x22b623['options']?_0x22b623[_0x6b74('0x18')][_0x6b74('0x19')]===undefined?!![]:![]:!![]})[_0x6b74('0xa')](function(_0x3078bc){logger[_0x6b74('0xb')]('CreateChatQueueReport',_0x22b623);logger[_0x6b74('0xe')]('CreateChatQueueReport',_0x22b623,JSON[_0x6b74('0x1a')](_0x3078bc));_0x5f2b0a(_0x3078bc);})[_0x6b74('0x13')](function(_0x1a56e7){logger[_0x6b74('0x10')](_0x6b74('0x14'),_0x1a56e7[_0x6b74('0x11')],_0x22b623);_0x5371c7(_0x5d4923['error'](0x1f4,_0x1a56e7['message']));});});};exports[_0x6b74('0x1b')]=function(_0xf1b1e4){var _0x2829f9=this;return new Promise(function(_0x1911bf,_0x3b2a9a){return db['ChatQueueReport']['update'](_0xf1b1e4[_0x6b74('0x17')],{'raw':_0xf1b1e4[_0x6b74('0x18')]?_0xf1b1e4[_0x6b74('0x18')][_0x6b74('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf1b1e4['options']?_0xf1b1e4[_0x6b74('0x18')][_0x6b74('0x1c')]||null:null,'attributes':_0xf1b1e4[_0x6b74('0x18')]?_0xf1b1e4['options'][_0x6b74('0x1d')]||null:null,'limit':_0xf1b1e4[_0x6b74('0x18')]?_0xf1b1e4[_0x6b74('0x18')]['limit']||null:null})[_0x6b74('0xa')](function(_0x54056e){logger[_0x6b74('0xb')](_0x6b74('0x1b'),_0xf1b1e4);logger['debug'](_0x6b74('0x1b'),_0xf1b1e4,JSON[_0x6b74('0x1a')](_0x54056e));_0x1911bf(_0x54056e);})['catch'](function(_0x6ba794){logger[_0x6b74('0x10')]('UpdateChatQueueReport',_0x6ba794[_0x6b74('0x11')],_0xf1b1e4);_0x3b2a9a(_0x2829f9['error'](0x1f4,_0x6ba794[_0x6b74('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 1e82539..d23bc9f 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 _0xef30=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x1b2d57,_0x2bfccd){var _0x492dab=function(_0x43d883){while(--_0x43d883){_0x1b2d57['push'](_0x1b2d57['shift']());}};_0x492dab(++_0x2bfccd);}(_0xef30,0xee));var _0x0ef3=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0xef30[_0x57975f];return _0x4793b8;};'use strict';var multer=require('multer');var util=require(_0x0ef3('0x0'));var path=require(_0x0ef3('0x1'));var timeout=require(_0x0ef3('0x2'));var express=require(_0x0ef3('0x3'));var router=express[_0x0ef3('0x4')]();var fs_extra=require(_0x0ef3('0x5'));var auth=require(_0x0ef3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0ef3('0x7'));var controller=require(_0x0ef3('0x8'));router[_0x0ef3('0x9')]('/',auth[_0x0ef3('0xa')](),controller[_0x0ef3('0xb')]);router[_0x0ef3('0x9')](_0x0ef3('0xc'),auth[_0x0ef3('0xa')](),controller[_0x0ef3('0xd')]);router[_0x0ef3('0x9')](_0x0ef3('0xe'),auth[_0x0ef3('0xa')](),controller[_0x0ef3('0xf')]);router[_0x0ef3('0x10')]('/',auth[_0x0ef3('0xa')](),controller[_0x0ef3('0x11')]);router[_0x0ef3('0x12')](_0x0ef3('0xe'),auth[_0x0ef3('0xa')](),controller['update']);router[_0x0ef3('0x13')]('/:id',auth[_0x0ef3('0xa')](),controller[_0x0ef3('0x14')]);module[_0x0ef3('0x15')]=router; \ No newline at end of file +var _0x15b0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','multer','util','path'];(function(_0x2d7c0a,_0x1c9c50){var _0x3f51e7=function(_0x3e1ee1){while(--_0x3e1ee1){_0x2d7c0a['push'](_0x2d7c0a['shift']());}};_0x3f51e7(++_0x1c9c50);}(_0x15b0,0xd9));var _0x015b=function(_0x593b33,_0x1ea034){_0x593b33=_0x593b33-0x0;var _0x2f17a2=_0x15b0[_0x593b33];return _0x2f17a2;};'use strict';var multer=require(_0x015b('0x0'));var util=require(_0x015b('0x1'));var path=require(_0x015b('0x2'));var timeout=require(_0x015b('0x3'));var express=require(_0x015b('0x4'));var router=express[_0x015b('0x5')]();var fs_extra=require(_0x015b('0x6'));var auth=require(_0x015b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x015b('0x8'));var controller=require('./chatQueueReport.controller');router[_0x015b('0x9')]('/',auth['isAuthenticated'](),controller[_0x015b('0xa')]);router['get']('/describe',auth[_0x015b('0xb')](),controller['describe']);router[_0x015b('0x9')]('/:id',auth[_0x015b('0xb')](),controller[_0x015b('0xc')]);router[_0x015b('0xd')]('/',auth['isAuthenticated'](),controller[_0x015b('0xe')]);router[_0x015b('0xf')]('/:id',auth[_0x015b('0xb')](),controller[_0x015b('0x10')]);router[_0x015b('0x11')](_0x015b('0x12'),auth[_0x015b('0xb')](),controller[_0x015b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 69d6588..c7dcbfb 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x31aac8,_0x1ac0e3){var _0x55448d=function(_0x396c5f){while(--_0x396c5f){_0x31aac8['push'](_0x31aac8['shift']());}};_0x55448d(++_0x1ac0e3);}(_0x54ef,0x112));var _0xf54e=function(_0x496097,_0xfbb2da){_0x496097=_0x496097-0x0;var _0x51b1d2=_0x54ef[_0x496097];return _0x51b1d2;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x267fa3,_0x3027ea){var _0xc4653c=function(_0x3f7909){while(--_0x3f7909){_0x267fa3['push'](_0x267fa3['shift']());}};_0xc4653c(++_0x3027ea);}(_0x70e0,0x17b));var _0x070e=function(_0x252733,_0x1226da){_0x252733=_0x252733-0x0;var _0x17ab14=_0x70e0[_0x252733];return _0x17ab14;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5d9e16b..c85639a 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 _0xa072=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','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','sendStatus','status','end','json','undefined','offset','limit','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','ChatTransferReport','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format'];(function(_0x9c43f,_0x576181){var _0xdf8bd4=function(_0x150986){while(--_0x150986){_0x9c43f['push'](_0x9c43f['shift']());}};_0xdf8bd4(++_0x576181);}(_0xa072,0x18f));var _0x2a07=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0xa072[_0x3dc68d];return _0xdf7f94;};'use strict';var emlformat=require(_0x2a07('0x0'));var rimraf=require(_0x2a07('0x1'));var zipdir=require(_0x2a07('0x2'));var jsonpatch=require(_0x2a07('0x3'));var rp=require(_0x2a07('0x4'));var moment=require(_0x2a07('0x5'));var BPromise=require(_0x2a07('0x6'));var Mustache=require(_0x2a07('0x7'));var util=require('util');var path=require(_0x2a07('0x8'));var sox=require(_0x2a07('0x9'));var csv=require(_0x2a07('0xa'));var ejs=require(_0x2a07('0xb'));var fs=require('fs');var fs_extra=require(_0x2a07('0xc'));var _=require(_0x2a07('0xd'));var squel=require(_0x2a07('0xe'));var crypto=require(_0x2a07('0xf'));var jsforce=require(_0x2a07('0x10'));var deskjs=require(_0x2a07('0x11'));var toCsv=require(_0x2a07('0xa'));var querystring=require('querystring');var Papa=require(_0x2a07('0x12'));var Redis=require(_0x2a07('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2a07('0x14'));var hardwareService=require(_0x2a07('0x15'));var logger=require(_0x2a07('0x16'))(_0x2a07('0x17'));var utils=require(_0x2a07('0x18'));var config=require(_0x2a07('0x19'));var licenseUtil=require(_0x2a07('0x1a'));var db=require(_0x2a07('0x1b'))['db'];function respondWithStatusCode(_0x6355ed,_0x3208d8){_0x3208d8=_0x3208d8||0xcc;return function(_0x59b39e){if(_0x59b39e){return _0x6355ed[_0x2a07('0x1c')](_0x3208d8);}return _0x6355ed[_0x2a07('0x1d')](_0x3208d8)[_0x2a07('0x1e')]();};}function respondWithResult(_0x38eb28,_0xfbea6b){_0xfbea6b=_0xfbea6b||0xc8;return function(_0x44bc65){if(_0x44bc65){return _0x38eb28[_0x2a07('0x1d')](_0xfbea6b)[_0x2a07('0x1f')](_0x44bc65);}};}function respondWithFilteredResult(_0x325136,_0x502728){return function(_0x3df8ae){if(_0x3df8ae){var _0x399879=typeof _0x502728['offset']===_0x2a07('0x20')&&typeof _0x502728['limit']===_0x2a07('0x20');var _0x4214a0=_0x3df8ae['count'];var _0x4aae39=_0x399879?0x0:_0x502728[_0x2a07('0x21')];var _0x351ef7=_0x399879?_0x3df8ae['count']:_0x502728['offset']+_0x502728[_0x2a07('0x22')];var _0x38f52c;if(_0x351ef7>=_0x4214a0){_0x351ef7=_0x4214a0;_0x38f52c=0xc8;}else{_0x38f52c=0xce;}_0x325136[_0x2a07('0x1d')](_0x38f52c);return _0x325136['set'](_0x2a07('0x23'),_0x4aae39+'-'+_0x351ef7+'/'+_0x4214a0)[_0x2a07('0x1f')](_0x3df8ae);}return null;};}function patchUpdates(_0x378d8c){return function(_0x1aa6cb){try{jsonpatch[_0x2a07('0x24')](_0x1aa6cb,_0x378d8c,!![]);}catch(_0x36993a){return BPromise[_0x2a07('0x25')](_0x36993a);}return _0x1aa6cb['save']();};}function saveUpdates(_0x52df5e,_0x29895c){return function(_0x55508d){if(_0x55508d){return _0x55508d[_0x2a07('0x26')](_0x52df5e)[_0x2a07('0x27')](function(_0x34a65e){return _0x34a65e;});}return null;};}function removeEntity(_0x1c3b6d,_0x1fdd3f){return function(_0x4df89b){if(_0x4df89b){return _0x4df89b['destroy']()[_0x2a07('0x27')](function(){_0x1c3b6d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5866df,_0x230204){return function(_0x2becfc){if(!_0x2becfc){_0x5866df['sendStatus'](0x194);}return _0x2becfc;};}function handleError(_0x1d5ed1,_0x44a5bb){_0x44a5bb=_0x44a5bb||0x1f4;return function(_0xe6803){logger[_0x2a07('0x28')](_0xe6803[_0x2a07('0x29')]);if(_0xe6803[_0x2a07('0x2a')]){delete _0xe6803[_0x2a07('0x2a')];}_0x1d5ed1[_0x2a07('0x1d')](_0x44a5bb)[_0x2a07('0x2b')](_0xe6803);};}exports[_0x2a07('0x2c')]=function(_0x46a6fc,_0x383ad3){var _0x4ccf72={},_0x4f0663={},_0x379d22={'count':0x0,'rows':[]};var _0x118e7e=_['map'](db['ChatTransferReport'][_0x2a07('0x2d')],function(_0x564c3b){return{'name':_0x564c3b['fieldName'],'type':_0x564c3b[_0x2a07('0x2e')]['key']};});_0x4f0663[_0x2a07('0x2f')]=_[_0x2a07('0x30')](_0x118e7e,'name');_0x4f0663[_0x2a07('0x31')]=_[_0x2a07('0x32')](_0x46a6fc[_0x2a07('0x31')]);_0x4f0663[_0x2a07('0x33')]=_[_0x2a07('0x34')](_0x4f0663[_0x2a07('0x2f')],_0x4f0663[_0x2a07('0x31')]);_0x4ccf72[_0x2a07('0x35')]=_[_0x2a07('0x34')](_0x4f0663[_0x2a07('0x2f')],qs[_0x2a07('0x36')](_0x46a6fc[_0x2a07('0x31')][_0x2a07('0x36')]));_0x4ccf72[_0x2a07('0x35')]=_0x4ccf72[_0x2a07('0x35')][_0x2a07('0x37')]?_0x4ccf72[_0x2a07('0x35')]:_0x4f0663[_0x2a07('0x2f')];if(!_0x46a6fc['query'][_0x2a07('0x38')](_0x2a07('0x39'))){_0x4ccf72[_0x2a07('0x22')]=qs[_0x2a07('0x22')](_0x46a6fc[_0x2a07('0x31')][_0x2a07('0x22')]);_0x4ccf72[_0x2a07('0x21')]=qs['offset'](_0x46a6fc[_0x2a07('0x31')]['offset']);}_0x4ccf72[_0x2a07('0x3a')]=qs[_0x2a07('0x3b')](_0x46a6fc[_0x2a07('0x31')]['sort']);_0x4ccf72['where']=qs['filters'](_[_0x2a07('0x3c')](_0x46a6fc[_0x2a07('0x31')],_0x4f0663[_0x2a07('0x33')]),_0x118e7e);if(_0x46a6fc[_0x2a07('0x31')][_0x2a07('0x3d')]){_0x4ccf72[_0x2a07('0x3e')]=_['merge'](_0x4ccf72[_0x2a07('0x3e')],{'$or':_[_0x2a07('0x30')](_0x118e7e,function(_0x42be2b){if(_0x42be2b[_0x2a07('0x2e')]!==_0x2a07('0x3f')){var _0x455e32={};_0x455e32[_0x42be2b[_0x2a07('0x2a')]]={'$like':'%'+_0x46a6fc[_0x2a07('0x31')][_0x2a07('0x3d')]+'%'};return _0x455e32;}})});}_0x4ccf72=_[_0x2a07('0x40')]({},_0x4ccf72,_0x46a6fc[_0x2a07('0x41')]);var _0x517bb9={'where':_0x4ccf72[_0x2a07('0x3e')]};return db[_0x2a07('0x42')][_0x2a07('0x43')](_0x517bb9)['then'](function(_0x35fc2e){_0x379d22[_0x2a07('0x43')]=_0x35fc2e;if(_0x46a6fc[_0x2a07('0x31')][_0x2a07('0x44')]){_0x4ccf72[_0x2a07('0x45')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x2a07('0x46')](_0x4ccf72);})[_0x2a07('0x27')](function(_0x362ead){_0x379d22[_0x2a07('0x47')]=_0x362ead;return _0x379d22;})[_0x2a07('0x27')](respondWithFilteredResult(_0x383ad3,_0x4ccf72))[_0x2a07('0x48')](handleError(_0x383ad3,null));};exports[_0x2a07('0x49')]=function(_0x554723,_0x33fc84){var _0x5e9c50={'raw':!![],'where':{'id':_0x554723['params']['id']}},_0x5ad35b={};_0x5ad35b[_0x2a07('0x2f')]=_[_0x2a07('0x32')](db['ChatTransferReport'][_0x2a07('0x2d')]);_0x5ad35b[_0x2a07('0x31')]=_[_0x2a07('0x32')](_0x554723[_0x2a07('0x31')]);_0x5ad35b[_0x2a07('0x33')]=_[_0x2a07('0x34')](_0x5ad35b[_0x2a07('0x2f')],_0x5ad35b[_0x2a07('0x31')]);_0x5e9c50['attributes']=_['intersection'](_0x5ad35b[_0x2a07('0x2f')],qs[_0x2a07('0x36')](_0x554723[_0x2a07('0x31')][_0x2a07('0x36')]));_0x5e9c50[_0x2a07('0x35')]=_0x5e9c50['attributes']['length']?_0x5e9c50[_0x2a07('0x35')]:_0x5ad35b[_0x2a07('0x2f')];if(_0x554723['query'][_0x2a07('0x44')]){_0x5e9c50[_0x2a07('0x45')]=[{'all':!![]}];}_0x5e9c50=_[_0x2a07('0x40')]({},_0x5e9c50,_0x554723['options']);return db['ChatTransferReport'][_0x2a07('0x4a')](_0x5e9c50)['then'](handleEntityNotFound(_0x33fc84,null))[_0x2a07('0x27')](respondWithResult(_0x33fc84,null))['catch'](handleError(_0x33fc84,null));};exports[_0x2a07('0x4b')]=function(_0x40afa2,_0x3ca209){return db['ChatTransferReport']['create'](_0x40afa2[_0x2a07('0x4c')],{})[_0x2a07('0x27')](respondWithResult(_0x3ca209,0xc9))['catch'](handleError(_0x3ca209,null));};exports[_0x2a07('0x26')]=function(_0x54cae1,_0x5cda1f){if(_0x54cae1[_0x2a07('0x4c')]['id']){delete _0x54cae1[_0x2a07('0x4c')]['id'];}return db[_0x2a07('0x42')][_0x2a07('0x4a')]({'where':{'id':_0x54cae1[_0x2a07('0x4d')]['id']}})[_0x2a07('0x27')](handleEntityNotFound(_0x5cda1f,null))[_0x2a07('0x27')](saveUpdates(_0x54cae1[_0x2a07('0x4c')],null))['then'](respondWithResult(_0x5cda1f,null))[_0x2a07('0x48')](handleError(_0x5cda1f,null));};exports[_0x2a07('0x4e')]=function(_0x3f4461,_0x53a233){return db[_0x2a07('0x42')][_0x2a07('0x4a')]({'where':{'id':_0x3f4461[_0x2a07('0x4d')]['id']}})[_0x2a07('0x27')](handleEntityNotFound(_0x53a233,null))[_0x2a07('0x27')](removeEntity(_0x53a233,null))['catch'](handleError(_0x53a233,null));};exports[_0x2a07('0x4f')]=function(_0x3ca6e7,_0x468c7b){return db[_0x2a07('0x42')][_0x2a07('0x4f')]()[_0x2a07('0x27')](respondWithResult(_0x468c7b,null))[_0x2a07('0x48')](handleError(_0x468c7b,null));}; \ No newline at end of file +var _0x34e3=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring'];(function(_0x148448,_0x50abd9){var _0x10ef46=function(_0x27ad04){while(--_0x27ad04){_0x148448['push'](_0x148448['shift']());}};_0x10ef46(++_0x50abd9);}(_0x34e3,0xc4));var _0x334e=function(_0x5a88e8,_0x3827a3){_0x5a88e8=_0x5a88e8-0x0;var _0x51de83=_0x34e3[_0x5a88e8];return _0x51de83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x334e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x334e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x334e('0x2'));var Mustache=require(_0x334e('0x3'));var util=require('util');var path=require('path');var sox=require(_0x334e('0x4'));var csv=require(_0x334e('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x334e('0x6'));var _=require(_0x334e('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x334e('0x8'));var deskjs=require(_0x334e('0x9'));var toCsv=require(_0x334e('0x5'));var querystring=require(_0x334e('0xa'));var Papa=require(_0x334e('0xb'));var Redis=require(_0x334e('0xc'));var authService=require(_0x334e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x334e('0xe'));var hardwareService=require(_0x334e('0xf'));var logger=require('../../config/logger')(_0x334e('0x10'));var utils=require('../../config/utils');var config=require(_0x334e('0x11'));var licenseUtil=require(_0x334e('0x12'));var db=require(_0x334e('0x13'))['db'];function respondWithStatusCode(_0x49c0c4,_0x560233){_0x560233=_0x560233||0xcc;return function(_0x471321){if(_0x471321){return _0x49c0c4['sendStatus'](_0x560233);}return _0x49c0c4[_0x334e('0x14')](_0x560233)['end']();};}function respondWithResult(_0x408cf2,_0x36a47a){_0x36a47a=_0x36a47a||0xc8;return function(_0xc95b6a){if(_0xc95b6a){return _0x408cf2[_0x334e('0x14')](_0x36a47a)[_0x334e('0x15')](_0xc95b6a);}};}function respondWithFilteredResult(_0x2386ee,_0x9af5eb){return function(_0x8cf419){if(_0x8cf419){var _0x749685=typeof _0x9af5eb[_0x334e('0x16')]===_0x334e('0x17')&&typeof _0x9af5eb[_0x334e('0x18')]===_0x334e('0x17');var _0x3cd725=_0x8cf419['count'];var _0x5c3475=_0x749685?0x0:_0x9af5eb['offset'];var _0x14efed=_0x749685?_0x8cf419[_0x334e('0x19')]:_0x9af5eb[_0x334e('0x16')]+_0x9af5eb[_0x334e('0x18')];var _0x4ee64d;if(_0x14efed>=_0x3cd725){_0x14efed=_0x3cd725;_0x4ee64d=0xc8;}else{_0x4ee64d=0xce;}_0x2386ee[_0x334e('0x14')](_0x4ee64d);return _0x2386ee['set'](_0x334e('0x1a'),_0x5c3475+'-'+_0x14efed+'/'+_0x3cd725)[_0x334e('0x15')](_0x8cf419);}return null;};}function patchUpdates(_0x1022cb){return function(_0xc21bec){try{jsonpatch[_0x334e('0x1b')](_0xc21bec,_0x1022cb,!![]);}catch(_0x144b58){return BPromise[_0x334e('0x1c')](_0x144b58);}return _0xc21bec[_0x334e('0x1d')]();};}function saveUpdates(_0x523b4c,_0x31c6e6){return function(_0x116f4e){if(_0x116f4e){return _0x116f4e[_0x334e('0x1e')](_0x523b4c)[_0x334e('0x1f')](function(_0x42a55f){return _0x42a55f;});}return null;};}function removeEntity(_0x2d1a00,_0x4e32fb){return function(_0x48f4b9){if(_0x48f4b9){return _0x48f4b9[_0x334e('0x20')]()['then'](function(){_0x2d1a00[_0x334e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x512166,_0xbd91dd){return function(_0x4cda0b){if(!_0x4cda0b){_0x512166[_0x334e('0x21')](0x194);}return _0x4cda0b;};}function handleError(_0x48e6db,_0x1ec53){_0x1ec53=_0x1ec53||0x1f4;return function(_0xc8348){logger['error'](_0xc8348['stack']);if(_0xc8348['name']){delete _0xc8348[_0x334e('0x22')];}_0x48e6db['status'](_0x1ec53)[_0x334e('0x23')](_0xc8348);};}exports[_0x334e('0x24')]=function(_0x4cbb5e,_0x8c4a88){var _0x5c78bb={},_0x560924={},_0x616afa={'count':0x0,'rows':[]};var _0x94f2df=_[_0x334e('0x25')](db[_0x334e('0x26')][_0x334e('0x27')],function(_0x266abd){return{'name':_0x266abd[_0x334e('0x28')],'type':_0x266abd[_0x334e('0x29')][_0x334e('0x2a')]};});_0x560924[_0x334e('0x2b')]=_['map'](_0x94f2df,_0x334e('0x22'));_0x560924[_0x334e('0x2c')]=_[_0x334e('0x2d')](_0x4cbb5e['query']);_0x560924[_0x334e('0x2e')]=_[_0x334e('0x2f')](_0x560924[_0x334e('0x2b')],_0x560924[_0x334e('0x2c')]);_0x5c78bb[_0x334e('0x30')]=_[_0x334e('0x2f')](_0x560924[_0x334e('0x2b')],qs[_0x334e('0x31')](_0x4cbb5e[_0x334e('0x2c')][_0x334e('0x31')]));_0x5c78bb[_0x334e('0x30')]=_0x5c78bb['attributes'][_0x334e('0x32')]?_0x5c78bb[_0x334e('0x30')]:_0x560924[_0x334e('0x2b')];if(!_0x4cbb5e[_0x334e('0x2c')]['hasOwnProperty']('nolimit')){_0x5c78bb[_0x334e('0x18')]=qs[_0x334e('0x18')](_0x4cbb5e['query']['limit']);_0x5c78bb[_0x334e('0x16')]=qs[_0x334e('0x16')](_0x4cbb5e[_0x334e('0x2c')]['offset']);}_0x5c78bb[_0x334e('0x33')]=qs[_0x334e('0x34')](_0x4cbb5e[_0x334e('0x2c')][_0x334e('0x34')]);_0x5c78bb[_0x334e('0x35')]=qs['filters'](_[_0x334e('0x36')](_0x4cbb5e['query'],_0x560924[_0x334e('0x2e')]),_0x94f2df);if(_0x4cbb5e[_0x334e('0x2c')]['filter']){_0x5c78bb[_0x334e('0x35')]=_['merge'](_0x5c78bb[_0x334e('0x35')],{'$or':_[_0x334e('0x25')](_0x94f2df,function(_0x58a179){if(_0x58a179[_0x334e('0x29')]!==_0x334e('0x37')){var _0xbc3949={};_0xbc3949[_0x58a179[_0x334e('0x22')]]={'$like':'%'+_0x4cbb5e[_0x334e('0x2c')]['filter']+'%'};return _0xbc3949;}})});}_0x5c78bb=_[_0x334e('0x38')]({},_0x5c78bb,_0x4cbb5e['options']);var _0x3d93a0={'where':_0x5c78bb[_0x334e('0x35')]};return db[_0x334e('0x26')][_0x334e('0x19')](_0x3d93a0)[_0x334e('0x1f')](function(_0x3a88f9){_0x616afa[_0x334e('0x19')]=_0x3a88f9;if(_0x4cbb5e['query'][_0x334e('0x39')]){_0x5c78bb[_0x334e('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x334e('0x3b')](_0x5c78bb);})[_0x334e('0x1f')](function(_0x5768ce){_0x616afa[_0x334e('0x3c')]=_0x5768ce;return _0x616afa;})['then'](respondWithFilteredResult(_0x8c4a88,_0x5c78bb))[_0x334e('0x3d')](handleError(_0x8c4a88,null));};exports[_0x334e('0x3e')]=function(_0x226abc,_0x21aa64){var _0x5688c5={'raw':!![],'where':{'id':_0x226abc[_0x334e('0x3f')]['id']}},_0x3a2a0d={};_0x3a2a0d['model']=_['keys'](db[_0x334e('0x26')]['rawAttributes']);_0x3a2a0d[_0x334e('0x2c')]=_[_0x334e('0x2d')](_0x226abc[_0x334e('0x2c')]);_0x3a2a0d[_0x334e('0x2e')]=_[_0x334e('0x2f')](_0x3a2a0d[_0x334e('0x2b')],_0x3a2a0d[_0x334e('0x2c')]);_0x5688c5[_0x334e('0x30')]=_[_0x334e('0x2f')](_0x3a2a0d[_0x334e('0x2b')],qs['fields'](_0x226abc[_0x334e('0x2c')][_0x334e('0x31')]));_0x5688c5[_0x334e('0x30')]=_0x5688c5[_0x334e('0x30')][_0x334e('0x32')]?_0x5688c5[_0x334e('0x30')]:_0x3a2a0d['model'];if(_0x226abc[_0x334e('0x2c')]['includeAll']){_0x5688c5[_0x334e('0x3a')]=[{'all':!![]}];}_0x5688c5=_[_0x334e('0x38')]({},_0x5688c5,_0x226abc[_0x334e('0x40')]);return db[_0x334e('0x26')][_0x334e('0x41')](_0x5688c5)[_0x334e('0x1f')](handleEntityNotFound(_0x21aa64,null))[_0x334e('0x1f')](respondWithResult(_0x21aa64,null))[_0x334e('0x3d')](handleError(_0x21aa64,null));};exports['create']=function(_0x1d55c2,_0x1941d2){return db[_0x334e('0x26')][_0x334e('0x42')](_0x1d55c2['body'],{})[_0x334e('0x1f')](respondWithResult(_0x1941d2,0xc9))[_0x334e('0x3d')](handleError(_0x1941d2,null));};exports[_0x334e('0x1e')]=function(_0x408362,_0x54c9a4){if(_0x408362[_0x334e('0x43')]['id']){delete _0x408362[_0x334e('0x43')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x408362[_0x334e('0x3f')]['id']}})[_0x334e('0x1f')](handleEntityNotFound(_0x54c9a4,null))['then'](saveUpdates(_0x408362[_0x334e('0x43')],null))[_0x334e('0x1f')](respondWithResult(_0x54c9a4,null))[_0x334e('0x3d')](handleError(_0x54c9a4,null));};exports[_0x334e('0x20')]=function(_0x1dd99e,_0x12cf30){return db[_0x334e('0x26')][_0x334e('0x41')]({'where':{'id':_0x1dd99e[_0x334e('0x3f')]['id']}})[_0x334e('0x1f')](handleEntityNotFound(_0x12cf30,null))[_0x334e('0x1f')](removeEntity(_0x12cf30,null))[_0x334e('0x3d')](handleError(_0x12cf30,null));};exports[_0x334e('0x44')]=function(_0x2c9619,_0x5cae35){return db[_0x334e('0x26')][_0x334e('0x44')]()[_0x334e('0x1f')](respondWithResult(_0x5cae35,null))[_0x334e('0x3d')](handleError(_0x5cae35,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c63d9b3..00233ec 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 _0xb9a1=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','ChatTransferReport','uniqueid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9a1,0x10c));var _0x1b9a=function(_0x523fe2,_0x3efec3){_0x523fe2=_0x523fe2-0x0;var _0x4e0c21=_0xb9a1[_0x523fe2];return _0x4e0c21;};'use strict';var _=require(_0x1b9a('0x0'));var util=require(_0x1b9a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b9a('0x2'));var fs=require('fs');var path=require(_0x1b9a('0x3'));var rimraf=require(_0x1b9a('0x4'));var config=require(_0x1b9a('0x5'));var attributes=require(_0x1b9a('0x6'));module['exports']=function(_0x195146,_0x49f28e){return _0x195146['define'](_0x1b9a('0x7'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x1b9a('0x8'),'fields':[_0x1b9a('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa225=['moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2909de,_0x1accd9){var _0x2a1d54=function(_0x523e19){while(--_0x523e19){_0x2909de['push'](_0x2909de['shift']());}};_0x2a1d54(++_0x1accd9);}(_0xa225,0x1bc));var _0x5a22=function(_0x4f7fe0,_0x18201f){_0x4f7fe0=_0x4f7fe0-0x0;var _0x1e2851=_0xa225[_0x4f7fe0];return _0x1e2851;};'use strict';var _=require(_0x5a22('0x0'));var util=require(_0x5a22('0x1'));var logger=require(_0x5a22('0x2'))(_0x5a22('0x3'));var moment=require(_0x5a22('0x4'));var BPromise=require(_0x5a22('0x5'));var rp=require(_0x5a22('0x6'));var fs=require('fs');var path=require(_0x5a22('0x7'));var rimraf=require('rimraf');var config=require(_0x5a22('0x8'));var attributes=require(_0x5a22('0x9'));module[_0x5a22('0xa')]=function(_0x416929,_0x3a4076){return _0x416929['define'](_0x5a22('0xb'),attributes,{'tableName':_0x5a22('0xc'),'paranoid':![],'indexes':[{'name':_0x5a22('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 938a44c..514ac09 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 _0x22ec=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5dfdf9,_0x343aef){var _0x3ecc78=function(_0x39a65a){while(--_0x39a65a){_0x5dfdf9['push'](_0x5dfdf9['shift']());}};_0x3ecc78(++_0x343aef);}(_0x22ec,0xb8));var _0xc22e=function(_0x1a0160,_0x5ef2bd){_0x1a0160=_0x1a0160-0x0;var _0x39c78a=_0x22ec[_0x1a0160];return _0x39c78a;};'use strict';var _=require(_0xc22e('0x0'));var util=require(_0xc22e('0x1'));var moment=require(_0xc22e('0x2'));var BPromise=require('bluebird');var rs=require(_0xc22e('0x3'));var fs=require('fs');var Redis=require(_0xc22e('0x4'));var db=require(_0xc22e('0x5'))['db'];var utils=require(_0xc22e('0x6'));var logger=require(_0xc22e('0x7'))(_0xc22e('0x8'));var config=require(_0xc22e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc22e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7ca8f5,_0x11a058,_0x4f8177){return new BPromise(function(_0x16e71a,_0x3ed4ef){return client['request'](_0x7ca8f5,_0x4f8177)['then'](function(_0x4d073d){logger[_0xc22e('0xb')](_0xc22e('0xc'),_0x11a058,'request\x20sent');logger['debug'](_0xc22e('0xd'),_0x11a058,_0xc22e('0xe'),JSON['stringify'](_0x4d073d));if(_0x4d073d['error']){if(_0x4d073d[_0xc22e('0xf')][_0xc22e('0x10')]===0x1f4){logger[_0xc22e('0xf')](_0xc22e('0xc'),_0x11a058,_0x4d073d['error'][_0xc22e('0x11')]);return _0x3ed4ef(_0x4d073d[_0xc22e('0xf')][_0xc22e('0x11')]);}logger[_0xc22e('0xf')](_0xc22e('0xc'),_0x11a058,_0x4d073d['error'][_0xc22e('0x11')]);return _0x16e71a(_0x4d073d[_0xc22e('0xf')][_0xc22e('0x11')]);}else{logger[_0xc22e('0xb')](_0xc22e('0xc'),_0x11a058,_0xc22e('0xe'));_0x16e71a(_0x4d073d[_0xc22e('0x12')][_0xc22e('0x11')]);}})[_0xc22e('0x13')](function(_0x3dafcc){logger[_0xc22e('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x11a058,_0x3dafcc);_0x3ed4ef(_0x3dafcc);});});} \ No newline at end of file +var _0x7a8a=['client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2cf34f,_0x113909){var _0xe590ce=function(_0x36fe65){while(--_0x36fe65){_0x2cf34f['push'](_0x2cf34f['shift']());}};_0xe590ce(++_0x113909);}(_0x7a8a,0x173));var _0xa7a8=function(_0x119b59,_0x586bca){_0x119b59=_0x119b59-0x0;var _0x549482=_0x7a8a[_0x119b59];return _0x549482;};'use strict';var _=require(_0xa7a8('0x0'));var util=require('util');var moment=require(_0xa7a8('0x1'));var BPromise=require('bluebird');var rs=require(_0xa7a8('0x2'));var fs=require('fs');var Redis=require(_0xa7a8('0x3'));var db=require(_0xa7a8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7a8('0x5'))(_0xa7a8('0x6'));var config=require(_0xa7a8('0x7'));var jayson=require(_0xa7a8('0x8'));var client=jayson[_0xa7a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x352b94,_0x409313,_0x305055){return new BPromise(function(_0x17757b,_0x237425){return client['request'](_0x352b94,_0x305055)[_0xa7a8('0xa')](function(_0x443541){logger[_0xa7a8('0xb')](_0xa7a8('0xc'),_0x409313,_0xa7a8('0xd'));logger[_0xa7a8('0xe')](_0xa7a8('0xf'),_0x409313,'request\x20sent',JSON['stringify'](_0x443541));if(_0x443541[_0xa7a8('0x10')]){if(_0x443541[_0xa7a8('0x10')]['code']===0x1f4){logger[_0xa7a8('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x409313,_0x443541[_0xa7a8('0x10')][_0xa7a8('0x11')]);return _0x237425(_0x443541[_0xa7a8('0x10')][_0xa7a8('0x11')]);}logger[_0xa7a8('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x409313,_0x443541[_0xa7a8('0x10')][_0xa7a8('0x11')]);return _0x17757b(_0x443541[_0xa7a8('0x10')]['message']);}else{logger[_0xa7a8('0xb')](_0xa7a8('0xc'),_0x409313,_0xa7a8('0xd'));_0x17757b(_0x443541[_0xa7a8('0x12')][_0xa7a8('0x11')]);}})[_0xa7a8('0x13')](function(_0x28a7be){logger[_0xa7a8('0x10')](_0xa7a8('0xc'),_0x409313,_0x28a7be);_0x237425(_0x28a7be);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index da0cd89..1ecb2d7 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 _0x01fd=['describe','post','create','put','/:id','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3e034d,_0x2bb46f){var _0x1d751c=function(_0x3ee4da){while(--_0x3ee4da){_0x3e034d['push'](_0x3e034d['shift']());}};_0x1d751c(++_0x2bb46f);}(_0x01fd,0x136));var _0xd01f=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x01fd[_0x4d67b8];return _0x55af3b;};'use strict';var multer=require('multer');var util=require(_0xd01f('0x0'));var path=require(_0xd01f('0x1'));var timeout=require(_0xd01f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd01f('0x3'));var auth=require(_0xd01f('0x4'));var interaction=require(_0xd01f('0x5'));var config=require(_0xd01f('0x6'));var controller=require('./chatTransferReport.controller');router[_0xd01f('0x7')]('/',auth[_0xd01f('0x8')](),controller[_0xd01f('0x9')]);router[_0xd01f('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd01f('0xa')]);router[_0xd01f('0x7')]('/:id',auth[_0xd01f('0x8')](),controller['show']);router[_0xd01f('0xb')]('/',auth[_0xd01f('0x8')](),controller[_0xd01f('0xc')]);router[_0xd01f('0xd')](_0xd01f('0xe'),auth[_0xd01f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xd01f('0x8')](),controller[_0xd01f('0xf')]);module['exports']=router; \ No newline at end of file +var _0x603d=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','create','update','delete','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x603d,0xc6));var _0xd603=function(_0x228ade,_0x47e287){_0x228ade=_0x228ade-0x0;var _0x2f177a=_0x603d[_0x228ade];return _0x2f177a;};'use strict';var multer=require(_0xd603('0x0'));var util=require(_0xd603('0x1'));var path=require(_0xd603('0x2'));var timeout=require(_0xd603('0x3'));var express=require(_0xd603('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd603('0x5'));var interaction=require(_0xd603('0x6'));var config=require(_0xd603('0x7'));var controller=require(_0xd603('0x8'));router[_0xd603('0x9')]('/',auth[_0xd603('0xa')](),controller[_0xd603('0xb')]);router[_0xd603('0x9')](_0xd603('0xc'),auth[_0xd603('0xa')](),controller['describe']);router['get'](_0xd603('0xd'),auth[_0xd603('0xa')](),controller['show']);router['post']('/',auth[_0xd603('0xa')](),controller[_0xd603('0xe')]);router['put'](_0xd603('0xd'),auth[_0xd603('0xa')](),controller[_0xd603('0xf')]);router[_0xd603('0x10')](_0xd603('0xd'),auth[_0xd603('0xa')](),controller['destroy']);module[_0xd603('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 528de39..d846b9e 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 _0xeb07=['email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','input','name','text','getDataValue','parse','onlineForm','setDataValue','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}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','STRING'];(function(_0x22942f,_0x56e2ae){var _0x17dde5=function(_0x47de28){while(--_0x47de28){_0x22942f['push'](_0x22942f['shift']());}};_0x17dde5(++_0x56e2ae);}(_0xeb07,0x130));var _0x7eb0=function(_0x3342fc,_0x333631){_0x3342fc=_0x3342fc-0x0;var _0x3ab19f=_0xeb07[_0x3342fc];return _0x3ab19f;};'use strict';var Sequelize=require(_0x7eb0('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x7eb0('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x7eb0('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x2')},'mapKeyOffline':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x2')},'key':{'type':Sequelize[_0x7eb0('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x3')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7eb0('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7eb0('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7eb0('0x1')],'allowNull':![],'defaultValue':_0x7eb0('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x7eb0('0x1')],'allowNull':![],'defaultValue':_0x7eb0('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x7eb0('0x7')](_0x7eb0('0x8'),_0x7eb0('0x9')),'defaultValue':_0x7eb0('0x8')},'header_online':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7eb0('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7eb0('0xb')},'header_offline':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0xc')},'download_transcript':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7eb0('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7eb0('0xf')]},'closingQuestion':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x7eb0('0x11')},'placeholderMessage':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x12')},'closingMessage':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x13')},'closingMessageButton':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x14')},'conditionAgreement':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x7eb0('0x7')](_0x7eb0('0x15'),_0x7eb0('0x16')),'defaultValue':_0x7eb0('0x15')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x7eb0('0x17')]({'items':[{'type':_0x7eb0('0x18'),'variable':null,'config':{'placeholder':_0x7eb0('0x19'),'type':_0x7eb0('0x1a'),'required':!![]},'props':{'title':_0x7eb0('0x19'),'helpText':''}},{'type':'input','props':{'title':_0x7eb0('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x7eb0('0x2'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x7eb0('0x1b')]('onlineForm')?JSON[_0x7eb0('0x1c')](this[_0x7eb0('0x1b')](_0x7eb0('0x1d'))):{};},'set':function(_0xf7d307){return this[_0x7eb0('0x1e')](_0x7eb0('0x1d'),JSON[_0x7eb0('0x17')](_0xf7d307));}},'offlineForm':{'type':Sequelize[_0x7eb0('0xf')],'defaultValue':function(){return JSON[_0x7eb0('0x17')]({'items':[{'type':_0x7eb0('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x7eb0('0x2'),'type':_0x7eb0('0x2')},'variable':null},{'type':'textarea','config':{'placeholder':_0x7eb0('0x1f')},'props':{'title':'Comments','helpText':_0x7eb0('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x7eb0('0x1b')](_0x7eb0('0x21'))?JSON[_0x7eb0('0x1c')](this[_0x7eb0('0x1b')](_0x7eb0('0x21'))):{};},'set':function(_0x1870a2){return this['setDataValue'](_0x7eb0('0x21'),JSON[_0x7eb0('0x17')](_0x1870a2));}},'token':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':function(){return rs[_0x7eb0('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7eb0('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x23')},'waitingMessage':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x25')},'offlineMessageBody':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x7eb0('0x14')},'sendUnmanaged':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7eb0('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7eb0('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7eb0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x29')},'verticalAlignment':{'type':Sequelize[_0x7eb0('0xd')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x7eb0('0x2a')},'defaultTitle':{'type':Sequelize[_0x7eb0('0x1')]},'customerAvatar':{'type':Sequelize[_0x7eb0('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x7eb0('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7eb0('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7eb0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':_0x7eb0('0x2c')},'systemAvatar':{'type':Sequelize[_0x7eb0('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7eb0('0xd')],'comment':_0x7eb0('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![],'comment':_0x7eb0('0x2e'),'set':function(_0x59e4d8){if(!_0x59e4d8)this['setDataValue'](_0x7eb0('0x2f'),null);this['setDataValue'](_0x7eb0('0x30'),_0x59e4d8);}},'vidaooEscalation':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7eb0('0x31')},'vidaooNote':{'type':Sequelize[_0x7eb0('0x1')],'defaultValue':function(){return _0x7eb0('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x7eb0('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x7eb0('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7eb0('0xf')]}}; \ No newline at end of file +var _0x4917=['Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','input','name','text','onlineForm','setDataValue','Comments','getDataValue','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send'];(function(_0x3c4ae4,_0x1bfaf3){var _0x3d4c2d=function(_0x172bc4){while(--_0x172bc4){_0x3c4ae4['push'](_0x3c4ae4['shift']());}};_0x3d4c2d(++_0x1bfaf3);}(_0x4917,0xd8));var _0x7491=function(_0x17a7c0,_0x22e66e){_0x17a7c0=_0x17a7c0-0x0;var _0x34cfd2=_0x4917[_0x17a7c0];return _0x34cfd2;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7491('0x0'));module['exports']={'name':{'type':Sequelize[_0x7491('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7491('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x3')},'mapKeyOffline':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x7491('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x4')},'customerAlias':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7491('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7491('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7491('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x7491('0x1')],'allowNull':![],'defaultValue':_0x7491('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7491('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7491('0x1')]},'animation':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x7491('0x8')](_0x7491('0x9'),_0x7491('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0xb')},'start_chat_button':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0xc')},'offline_chat_button':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0xd')},'header_offline':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7491('0xf')]},'closingQuestion':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x12')},'noteTitle':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x13')},'closingMessage':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0xd')},'skipMessageButton':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x14')},'conditionAgreement':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x15')},'ratingType':{'type':Sequelize[_0x7491('0x8')](_0x7491('0x16'),_0x7491('0x17')),'defaultValue':_0x7491('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7491('0xf')],'defaultValue':function(){return JSON[_0x7491('0x18')]({'items':[{'type':_0x7491('0x19'),'variable':null,'config':{'placeholder':_0x7491('0x1a'),'type':_0x7491('0x1b'),'required':!![]},'props':{'title':_0x7491('0x1a'),'helpText':''}},{'type':_0x7491('0x19'),'props':{'title':_0x7491('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x7491('0x3'),'type':_0x7491('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this['getDataValue'](_0x7491('0x1c'))):{};},'set':function(_0x6680d9){return this[_0x7491('0x1d')](_0x7491('0x1c'),JSON[_0x7491('0x18')](_0x6680d9));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x7491('0x18')]({'items':[{'type':_0x7491('0x19'),'props':{'title':_0x7491('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x7491('0x3'),'type':_0x7491('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0x7491('0x1e')},'props':{'title':_0x7491('0x1e'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x7491('0x1f')]('offlineForm')?JSON[_0x7491('0x20')](this[_0x7491('0x1f')]('offlineForm')):{};},'set':function(_0x3a192e){return this[_0x7491('0x1d')](_0x7491('0x21'),JSON['stringify'](_0x3a192e));}},'token':{'type':Sequelize[_0x7491('0x1')],'defaultValue':function(){return rs[_0x7491('0x22')]();}},'autoclose':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7491('0x1')]},'forwardOffline':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7491('0x1')]},'waitingTitle':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x7491('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x25')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7491('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x26')},'verticalAlignment':{'type':Sequelize[_0x7491('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x27')},'defaultTitle':{'type':Sequelize[_0x7491('0x1')]},'customerAvatar':{'type':Sequelize[_0x7491('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x7491('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7491('0x1')],'allowNull':![],'defaultValue':_0x7491('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7491('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7491('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x29')},'systemAvatar':{'type':Sequelize[_0x7491('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7491('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![],'comment':_0x7491('0x2a'),'set':function(_0x409d0f){if(!_0x409d0f)this[_0x7491('0x1d')](_0x7491('0x2b'),null);this[_0x7491('0x1d')](_0x7491('0x2c'),_0x409d0f);}},'vidaooEscalation':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x7491('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0x7491('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7491('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 276929a..0d70d33 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 _0x398b=['transaction','bulkCreate','Smtp','CloudProvider','forwardOffline','getSmtpOptions','SendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','firstName','Chat','NotifyMailAccount','notifyMail','server','remove','addInteraction','ids','omit','Contact','Owner','fullname','Tag','Tags','tag','getSnippet','interval','getProactiveActions','virtual','License','increment','timezone','readFileSync','server/files/chat/iframe.ejs','3.9.0','origin','http://localhost:9000','undefined','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','color','textColor','color_button','hideWhenOffline','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','spread','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','ChatWebsites','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','browser','version','unknown','format','device','model','vendor','%s\x20%s\x20%s','type','stringify','index','Pause','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','mandatoryDispositionPause','ChatWebsite','length','options','find','create','body','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','address','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','root','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','resolve','ifTime','notify','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','referer','CmContact','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','headers','threadId','ChatInteraction','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','messageId','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','mimetype','attachments','offline-chat','basename','openNewInteraction'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x398b,0x188));var _0xb398=function(_0x22d19d,_0x379051){_0x22d19d=_0x22d19d-0x0;var _0x103fc2=_0x398b[_0x22d19d];return _0x103fc2;};'use strict';var Mustache=require(_0xb398('0x0'));var util=require(_0xb398('0x1'));var path=require(_0xb398('0x2'));var ejs=require(_0xb398('0x3'));var fs=require('fs');var fs_extra=require(_0xb398('0x4'));var _=require(_0xb398('0x5'));var querystring=require('querystring');var htmlToText=require(_0xb398('0x6'));var Redis=require(_0xb398('0x7'));var jayson=require('jayson/promise');var qs=require(_0xb398('0x8'));var logger=require(_0xb398('0x9'))('api');var config=require('../../config/environment');var APIBadRequestError=require(_0xb398('0xa'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0xb398('0xb')];var APIOutOfIntervalError=require(_0xb398('0xa'))[_0xb398('0xc')];var APIHandleError=require(_0xb398('0xa'))[_0xb398('0xd')];var APIConflictError=require(_0xb398('0xa'))['APIConflictError'];var wildcardUtils=require(_0xb398('0xe'));var URL=require(_0xb398('0xf'))['URL'];var db=require(_0xb398('0x10'))['db'];config[_0xb398('0x11')]=_[_0xb398('0x12')](config[_0xb398('0x11')],{'host':_0xb398('0x13'),'port':0x18eb});var socket=require(_0xb398('0x14'))(new Redis(config[_0xb398('0x11')]));require(_0xb398('0x15'))[_0xb398('0x16')](socket);var client=jayson[_0xb398('0x17')][_0xb398('0x18')]({'port':0x232c});var client9002=jayson[_0xb398('0x17')]['http']({'port':0x232a});var client9003=jayson[_0xb398('0x17')][_0xb398('0x18')]({'port':0x232b});var client9001=jayson['client'][_0xb398('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x56942e,_0x3eda3a,_0x82fc5,_0x416f11){return new Promise(function(_0x36f175,_0x542f95){var _0x26947b=_0x416f11||client;return _0x26947b[_0xb398('0x19')](_0x56942e,_0x82fc5)[_0xb398('0x1a')](function(_0x10976f){logger[_0xb398('0x1b')]('ChatWebsite,\x20%s,\x20%s',_0x3eda3a,_0xb398('0x1c'));logger[_0xb398('0x1d')](_0xb398('0x1e'),_0x3eda3a,_0xb398('0x1c'),JSON['stringify'](_0x10976f));if(_0x10976f[_0xb398('0x1f')]){if(_0x10976f['error'][_0xb398('0x20')]===0x1f4){logger[_0xb398('0x1f')](_0xb398('0x21'),_0x3eda3a,_0x10976f[_0xb398('0x1f')][_0xb398('0x22')]);return _0x542f95(_0x10976f[_0xb398('0x1f')][_0xb398('0x22')]);}logger[_0xb398('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x3eda3a,_0x10976f[_0xb398('0x1f')][_0xb398('0x22')]);return _0x36f175(_0x10976f[_0xb398('0x1f')][_0xb398('0x22')]);}else{logger[_0xb398('0x1b')](_0xb398('0x21'),_0x3eda3a,_0xb398('0x1c'));_0x36f175(_0x10976f[_0xb398('0x23')]['message']);}})['catch'](function(_0x965ba7){logger[_0xb398('0x1f')](_0xb398('0x21'),_0x3eda3a,_0x965ba7);_0x542f95(_0x965ba7);});});}function respondWithStatusCode(_0x4e8d77,_0x3f8409){_0x3f8409=_0x3f8409||0xcc;return function(_0x36a6c4){if(_0x36a6c4){return _0x4e8d77[_0xb398('0x24')](_0x3f8409);}return _0x4e8d77[_0xb398('0x25')](_0x3f8409)[_0xb398('0x26')]();};}function respondWithResult(_0x374809,_0x11c7de){_0x11c7de=_0x11c7de||0xc8;return function(_0x5b715b){if(_0x5b715b){return _0x374809[_0xb398('0x25')](_0x11c7de)[_0xb398('0x27')](_0x5b715b);}};}function respondWithFilteredResult(_0x10c1e6,_0x593108){return function(_0x4e186f){if(_0x4e186f){var _0x40e7bf=typeof _0x593108[_0xb398('0x28')]==='undefined'&&typeof _0x593108[_0xb398('0x29')]==='undefined';var _0x40f0b1=_0x4e186f[_0xb398('0x2a')];var _0x2b6897=_0x40e7bf?0x0:_0x593108['offset'];var _0xca52a5=_0x40e7bf?_0x4e186f[_0xb398('0x2a')]:_0x593108[_0xb398('0x28')]+_0x593108[_0xb398('0x29')];var _0x2762ff;if(_0xca52a5>=_0x40f0b1){_0xca52a5=_0x40f0b1;_0x2762ff=0xc8;}else{_0x2762ff=0xce;}_0x10c1e6[_0xb398('0x25')](_0x2762ff);return _0x10c1e6[_0xb398('0x2b')](_0xb398('0x2c'),_0x2b6897+'-'+_0xca52a5+'/'+_0x40f0b1)['json'](_0x4e186f);}return null;};}function saveUpdates(_0x59f764){return function(_0x27f43c){if(_0x27f43c){return _0x27f43c[_0xb398('0x2d')](_0x59f764)[_0xb398('0x1a')](function(_0x2d22eb){return _0x2d22eb;});}return null;};}function removeEntity(_0x14a4ce){return function(_0x2c8bc3){if(_0x2c8bc3){return _0x2c8bc3['destroy']()[_0xb398('0x1a')](function(){var _0x115f57=_0x2c8bc3['get']({'plain':!![]});var _0x450b42=_0xb398('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x450b42,'resourceId':_0x115f57['id']}})[_0xb398('0x1a')](function(){return _0x2c8bc3;});})[_0xb398('0x1a')](function(){_0x14a4ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc0706){return function(_0x44997a){if(!_0x44997a){_0xfc0706[_0xb398('0x24')](0x194);}return _0x44997a;};}function handleError(_0x121cdb,_0x5b9925){_0x5b9925=_0x5b9925||0x1f4;return function(_0x499c94){logger['error'](_0x499c94[_0xb398('0x2f')]);if(_0x499c94[_0xb398('0x30')]){delete _0x499c94[_0xb398('0x30')];}_0x121cdb[_0xb398('0x25')](_0x5b9925)[_0xb398('0x31')](_0x499c94);};}function createInteractionObject(_0x185553,_0x37d5b6,_0x115660,_0x5acc28){var _0xe51cad=require(_0xb398('0x32'));var _0x57cdce=new _0xe51cad();var _0x18a4a4=_0x57cdce[_0xb398('0x33')](_0x115660[_0xb398('0x34')])[_0xb398('0x35')]();var _0x2ad02d=_0x37d5b6[_0xb398('0x36')];if(_0x115660[_0xb398('0x37')]){_0x2ad02d=_0x115660[_0xb398('0x37')];}else if(_0x115660[_0xb398('0x38')]){_0x2ad02d=_[_0xb398('0x39')](_0x115660[_0xb398('0x38')][_0xb398('0x3a')](','));}return{'ContactId':_0x5acc28['id'],'ChatWebsiteId':_0x185553,'from':(_0x5acc28['firstName']||'')+'\x20'+(_0x5acc28[_0xb398('0x3b')]||''),'customerIp':_0x2ad02d,'customerPort':_0x115660[_0xb398('0x3c')]?_0x115660['x-real-port']:null,'referer':_0x37d5b6['referer'],'browserName':_0x18a4a4['browser'][_0xb398('0x30')]&&_0x18a4a4[_0xb398('0x3d')][_0xb398('0x3e')]?util['format']('%s\x20%s',_0x18a4a4[_0xb398('0x3d')][_0xb398('0x30')],_0x18a4a4[_0xb398('0x3d')][_0xb398('0x3e')]):_0xb398('0x3f'),'browserVersion':_0x18a4a4[_0xb398('0x3d')][_0xb398('0x3e')]||_0xb398('0x3f'),'osName':util[_0xb398('0x40')]('%s\x20%s',_0x18a4a4['os']['name'],_0x18a4a4['os'][_0xb398('0x3e')]),'osVersion':_0x18a4a4['os'][_0xb398('0x3e')],'deviceModel':_0x18a4a4[_0xb398('0x41')][_0xb398('0x42')]&&_0x18a4a4['device'][_0xb398('0x43')]?util[_0xb398('0x40')](_0xb398('0x44'),_0x18a4a4['device'][_0xb398('0x42')],_0x18a4a4['device'][_0xb398('0x43')],_0x18a4a4[_0xb398('0x41')][_0xb398('0x45')]):null,'deviceVendor':_0x18a4a4[_0xb398('0x41')][_0xb398('0x43')],'deviceType':_0x18a4a4[_0xb398('0x41')][_0xb398('0x45')],'formData':JSON[_0xb398('0x46')](_0x37d5b6)};}exports[_0xb398('0x47')]=function(_0x42bc4b,_0x531af1){var _0x2227f4={'include':[{'model':db[_0xb398('0x48')],'as':'mandatoryDispositionPause'}]},_0x2d5d04={},_0x10cd9f={'count':0x0,'rows':[]};var _0x131b96=_['map'](db['ChatWebsite'][_0xb398('0x49')],function(_0x16134a){return{'name':_0x16134a[_0xb398('0x4a')],'type':_0x16134a[_0xb398('0x45')][_0xb398('0x4b')]};});_0x2d5d04[_0xb398('0x42')]=_[_0xb398('0x4c')](_0x131b96,_0xb398('0x30'));_0x2d5d04[_0xb398('0x4d')]=_[_0xb398('0x4e')](_0x42bc4b[_0xb398('0x4d')]);_0x2d5d04[_0xb398('0x4f')]=_[_0xb398('0x50')](_0x2d5d04[_0xb398('0x42')],_0x2d5d04[_0xb398('0x4d')]);_0x2227f4[_0xb398('0x51')]=_[_0xb398('0x50')](_0x2d5d04[_0xb398('0x42')],qs[_0xb398('0x52')](_0x42bc4b[_0xb398('0x4d')][_0xb398('0x52')]));_0x2227f4[_0xb398('0x51')]=_0x2227f4[_0xb398('0x51')]['length']?_0x2227f4[_0xb398('0x51')]:_0x2d5d04['model'];if(!_0x42bc4b[_0xb398('0x4d')]['hasOwnProperty']('nolimit')){_0x2227f4[_0xb398('0x29')]=qs['limit'](_0x42bc4b[_0xb398('0x4d')][_0xb398('0x29')]);_0x2227f4[_0xb398('0x28')]=qs[_0xb398('0x28')](_0x42bc4b['query'][_0xb398('0x28')]);}_0x2227f4[_0xb398('0x53')]=qs[_0xb398('0x54')](_0x42bc4b['query'][_0xb398('0x54')]);_0x2227f4[_0xb398('0x55')]=qs['filters'](_[_0xb398('0x56')](_0x42bc4b[_0xb398('0x4d')],_0x2d5d04[_0xb398('0x4f')]),_0x131b96);if(_0x42bc4b[_0xb398('0x4d')]['filter']){_0x2227f4[_0xb398('0x55')]=_[_0xb398('0x57')](_0x2227f4[_0xb398('0x55')],{'$or':_[_0xb398('0x4c')](_0x131b96,function(_0x44d522){if(_0x44d522['type']!==_0xb398('0x58')){var _0xf26d15={};_0xf26d15[_0x44d522['name']]={'$like':'%'+_0x42bc4b[_0xb398('0x4d')][_0xb398('0x59')]+'%'};return _0xf26d15;}})});}_0x2227f4=_['merge']({},_0x2227f4,_0x42bc4b['options']);var _0x25e496={'where':_0x2227f4[_0xb398('0x55')]};return db['ChatWebsite']['count'](_0x25e496)[_0xb398('0x1a')](function(_0x202435){_0x10cd9f[_0xb398('0x2a')]=_0x202435;if(_0x42bc4b[_0xb398('0x4d')][_0xb398('0x5a')]){_0x2227f4[_0xb398('0x5b')]=[{'all':!![]}];}return db['ChatWebsite'][_0xb398('0x5c')](_0x2227f4);})[_0xb398('0x1a')](function(_0xe520cd){_0x10cd9f['rows']=_0xe520cd;return _0x10cd9f;})['then'](respondWithFilteredResult(_0x531af1,_0x2227f4))[_0xb398('0x5d')](handleError(_0x531af1,null));};exports[_0xb398('0x5e')]=function(_0x3c3476,_0x3bd328){var _0x16cd3b={'raw':![],'where':{'id':_0x3c3476['params']['id']},'include':[{'model':db['Pause'],'as':_0xb398('0x5f')}]},_0x10af75={};_0x10af75['model']=_['keys'](db[_0xb398('0x60')][_0xb398('0x49')]);_0x10af75[_0xb398('0x4d')]=_[_0xb398('0x4e')](_0x3c3476[_0xb398('0x4d')]);_0x10af75[_0xb398('0x4f')]=_['intersection'](_0x10af75['model'],_0x10af75[_0xb398('0x4d')]);_0x16cd3b[_0xb398('0x51')]=_[_0xb398('0x50')](_0x10af75['model'],qs[_0xb398('0x52')](_0x3c3476[_0xb398('0x4d')][_0xb398('0x52')]));_0x16cd3b['attributes']=_0x16cd3b[_0xb398('0x51')][_0xb398('0x61')]?_0x16cd3b['attributes']:_0x10af75[_0xb398('0x42')];if(_0x3c3476[_0xb398('0x4d')]['includeAll']){_0x16cd3b[_0xb398('0x5b')]=[{'all':!![]}];}_0x16cd3b=_[_0xb398('0x57')]({},_0x16cd3b,_0x3c3476[_0xb398('0x62')]);return db['ChatWebsite'][_0xb398('0x63')](_0x16cd3b)['then'](handleEntityNotFound(_0x3bd328,null))[_0xb398('0x1a')](respondWithResult(_0x3bd328,null))[_0xb398('0x5d')](handleError(_0x3bd328,null));};exports[_0xb398('0x64')]=function(_0x3ebc84,_0x14d617){var _0x515499=null;_0x3ebc84[_0xb398('0x65')]['address'][_0xb398('0x3a')](',')[_0xb398('0x66')](_0x3f6238=>{if(_0x3f6238[_0xb398('0x67')]()!==''&&!wildcardUtils[_0xb398('0x68')](_0x3f6238[_0xb398('0x67')]())){_0x515499=new APIBadRequestError('\x22'+_0x3f6238[_0xb398('0x67')]()+_0xb398('0x69'));}});if(_0x515499){return handleError(_0x14d617,null)(_0x515499);}return db[_0xb398('0x60')][_0xb398('0x64')](_0x3ebc84[_0xb398('0x65')],{})[_0xb398('0x1a')](function(_0x4f21e6){var _0x296ef0=_0x3ebc84[_0xb398('0x6a')][_0xb398('0x6b')]({'plain':!![]});if(!_0x296ef0)throw new Error(_0xb398('0x6c'));if(_0x296ef0[_0xb398('0x6d')]===_0xb398('0x6a')){var _0x15fca5=_0x4f21e6[_0xb398('0x6b')]({'plain':!![]});var _0x155487=_0xb398('0x2e');return db[_0xb398('0x6e')]['find']({'where':{'name':_0x155487,'userProfileId':_0x296ef0[_0xb398('0x6f')]},'raw':!![]})[_0xb398('0x1a')](function(_0x4cad91){if(_0x4cad91&&_0x4cad91[_0xb398('0x70')]===0x0){return db['UserProfileResource'][_0xb398('0x64')]({'name':_0x15fca5[_0xb398('0x30')],'resourceId':_0x15fca5['id'],'type':_0x4cad91[_0xb398('0x30')],'sectionId':_0x4cad91['id']},{})[_0xb398('0x1a')](function(){return _0x4f21e6;});}else{return _0x4f21e6;}})[_0xb398('0x5d')](function(_0x1e48a0){logger[_0xb398('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e48a0);throw _0x1e48a0;});}return _0x4f21e6;})[_0xb398('0x1a')](respondWithResult(_0x14d617,0xc9))[_0xb398('0x5d')](handleError(_0x14d617,null));};exports[_0xb398('0x2d')]=function(_0x2b6c41,_0x32dd35){var _0x65fc69=null;_0x2b6c41[_0xb398('0x65')][_0xb398('0x71')]['split'](',')[_0xb398('0x66')](_0x37f5e9=>{if(_0x37f5e9[_0xb398('0x67')]()!==''&&!wildcardUtils[_0xb398('0x68')](_0x37f5e9[_0xb398('0x67')]())){_0x65fc69=new APIBadRequestError('\x22'+_0x37f5e9[_0xb398('0x67')]()+_0xb398('0x69'));}});if(_0x65fc69){return handleError(_0x32dd35,null)(_0x65fc69);}if(_0x2b6c41[_0xb398('0x65')]['id']){delete _0x2b6c41[_0xb398('0x65')]['id'];}return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x2b6c41['params']['id']},'include':[{'model':db[_0xb398('0x48')],'as':_0xb398('0x5f')}]})[_0xb398('0x1a')](handleEntityNotFound(_0x32dd35,null))['then'](saveUpdates(_0x2b6c41[_0xb398('0x65')],null))[_0xb398('0x1a')](respondWithResult(_0x32dd35,null))[_0xb398('0x5d')](handleError(_0x32dd35,null));};exports['destroy']=function(_0x346a70,_0xe83537){return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x346a70[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0xe83537,null))[_0xb398('0x1a')](removeEntity(_0xe83537,null))[_0xb398('0x5d')](handleError(_0xe83537,null));};exports['describe']=function(_0x523036,_0x20df31){return db['ChatWebsite'][_0xb398('0x73')]()[_0xb398('0x1a')](respondWithResult(_0x20df31,null))[_0xb398('0x5d')](handleError(_0x20df31,null));};exports[_0xb398('0x74')]=function(_0x1c3e50,_0x2787c8){if(_0x1c3e50[_0xb398('0x65')]['id']){delete _0x1c3e50[_0xb398('0x65')]['id'];}return db[_0xb398('0x60')]['find']({'where':{'id':_0x1c3e50['params']['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x2787c8,null))[_0xb398('0x1a')](function(_0x43d1dc){if(_0x43d1dc){_0x1c3e50[_0xb398('0x65')][_0xb398('0x75')]=_0x43d1dc['id'];return db[_0xb398('0x76')]['create'](_0x1c3e50[_0xb398('0x65')]);}})[_0xb398('0x1a')](respondWithResult(_0x2787c8,null))[_0xb398('0x5d')](handleError(_0x2787c8,null));};exports[_0xb398('0x77')]=function(_0x5288c4,_0xa80f30){var _0x74479f={'raw':![],'where':{}};var _0x46f1d9={};var _0x365002={'count':0x0,'rows':[]};return db[_0xb398('0x60')][_0xb398('0x78')]({'where':{'id':_0x5288c4[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0xa80f30,null))['then'](function(_0x5b6ec5){if(_0x5b6ec5){_0x46f1d9[_0xb398('0x42')]=_[_0xb398('0x4e')](db[_0xb398('0x76')]['rawAttributes']);_0x46f1d9['query']=_[_0xb398('0x4e')](_0x5288c4[_0xb398('0x4d')]);_0x46f1d9[_0xb398('0x4f')]=_[_0xb398('0x50')](_0x46f1d9[_0xb398('0x42')],_0x46f1d9['query']);_0x74479f[_0xb398('0x51')]=_[_0xb398('0x50')](_0x46f1d9['model'],qs[_0xb398('0x52')](_0x5288c4[_0xb398('0x4d')][_0xb398('0x52')]));_0x74479f[_0xb398('0x51')]=_0x74479f[_0xb398('0x51')][_0xb398('0x61')]?_0x74479f['attributes']:_0x46f1d9['model'];if(!_0x5288c4[_0xb398('0x4d')][_0xb398('0x79')](_0xb398('0x7a'))){_0x74479f[_0xb398('0x29')]=qs[_0xb398('0x29')](_0x5288c4[_0xb398('0x4d')][_0xb398('0x29')]);_0x74479f['offset']=qs[_0xb398('0x28')](_0x5288c4[_0xb398('0x4d')][_0xb398('0x28')]);}_0x74479f[_0xb398('0x53')]=qs[_0xb398('0x54')](_0x5288c4[_0xb398('0x4d')]['sort']);_0x74479f[_0xb398('0x55')]=qs[_0xb398('0x4f')](_[_0xb398('0x56')](_0x5288c4[_0xb398('0x4d')],_0x46f1d9[_0xb398('0x4f')]));_0x74479f[_0xb398('0x55')][_0xb398('0x75')]=_0x5b6ec5['id'];if(_0x5288c4[_0xb398('0x4d')][_0xb398('0x59')]){_0x74479f[_0xb398('0x55')]=_[_0xb398('0x57')](_0x74479f[_0xb398('0x55')],{'$or':_[_0xb398('0x4c')](_0x74479f[_0xb398('0x51')],function(_0x316560){var _0x51c03f={};_0x51c03f[_0x316560]={'$like':'%'+_0x5288c4['query'][_0xb398('0x59')]+'%'};return _0x51c03f;})});}_0x74479f=_[_0xb398('0x57')]({},_0x74479f,_0x5288c4[_0xb398('0x62')]);return db[_0xb398('0x76')]['count']({'where':_0x74479f['where']})['then'](function(_0x5636c0){_0x365002[_0xb398('0x2a')]=_0x5636c0;if(_0x5288c4[_0xb398('0x4d')][_0xb398('0x5a')]){_0x74479f[_0xb398('0x5b')]=[{'all':!![]}];}return db[_0xb398('0x76')]['findAll'](_0x74479f);})[_0xb398('0x1a')](function(_0x3c8d53){_0x365002[_0xb398('0x7b')]=_0x3c8d53;return _0x365002;});}})[_0xb398('0x1a')](respondWithFilteredResult(_0xa80f30,_0x74479f))[_0xb398('0x5d')](handleError(_0xa80f30,null));};exports[_0xb398('0x7c')]=function(_0x3be3d7,_0x4845f5){return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x3be3d7['params']['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x4845f5,null))['then'](function(_0x291fca){if(_0x291fca){return _0x291fca[_0xb398('0x7c')](_0x3be3d7[_0xb398('0x4d')]['ids']);}})[_0xb398('0x1a')](respondWithStatusCode(_0x4845f5,null))[_0xb398('0x5d')](handleError(_0x4845f5,null));};exports[_0xb398('0x7d')]=function(_0x1a7688,_0x5a172f){if(_0x1a7688['body']['id']){delete _0x1a7688[_0xb398('0x65')]['id'];}return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x1a7688[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x5a172f,null))[_0xb398('0x1a')](function(_0x5f3745){if(_0x5f3745){_0x1a7688['body']['ChatWebsiteId']=_0x5f3745['id'];return db[_0xb398('0x7e')]['create'](_0x1a7688[_0xb398('0x65')]);}})[_0xb398('0x1a')](respondWithResult(_0x5a172f,null))['catch'](handleError(_0x5a172f,null));};exports[_0xb398('0x7f')]=function(_0x1ea912,_0x3f1b5e){var _0x1ea40a={'raw':![],'where':{}};var _0x1be5c6={};var _0x1a80eb={'count':0x0,'rows':[]};return db[_0xb398('0x60')][_0xb398('0x78')]({'where':{'id':_0x1ea912['params']['id']}})['then'](handleEntityNotFound(_0x3f1b5e,null))['then'](function(_0x52f016){if(_0x52f016){_0x1be5c6[_0xb398('0x42')]=_[_0xb398('0x4e')](db['CannedAnswer'][_0xb398('0x49')]);_0x1be5c6[_0xb398('0x4d')]=_['keys'](_0x1ea912[_0xb398('0x4d')]);_0x1be5c6['filters']=_[_0xb398('0x50')](_0x1be5c6[_0xb398('0x42')],_0x1be5c6['query']);_0x1ea40a['attributes']=_[_0xb398('0x50')](_0x1be5c6['model'],qs[_0xb398('0x52')](_0x1ea912['query'][_0xb398('0x52')]));_0x1ea40a[_0xb398('0x51')]=_0x1ea40a['attributes'][_0xb398('0x61')]?_0x1ea40a['attributes']:_0x1be5c6[_0xb398('0x42')];if(!_0x1ea912['query'][_0xb398('0x79')](_0xb398('0x7a'))){_0x1ea40a[_0xb398('0x29')]=qs[_0xb398('0x29')](_0x1ea912[_0xb398('0x4d')][_0xb398('0x29')]);_0x1ea40a[_0xb398('0x28')]=qs['offset'](_0x1ea912[_0xb398('0x4d')][_0xb398('0x28')]);}_0x1ea40a[_0xb398('0x53')]=qs['sort'](_0x1ea912['query'][_0xb398('0x54')]);_0x1ea40a['where']=qs['filters'](_[_0xb398('0x56')](_0x1ea912[_0xb398('0x4d')],_0x1be5c6[_0xb398('0x4f')]));_0x1ea40a[_0xb398('0x55')][_0xb398('0x75')]=_0x52f016['id'];if(_0x1ea912[_0xb398('0x4d')]['filter']){_0x1ea40a['where']=_['merge'](_0x1ea40a['where'],{'$or':_[_0xb398('0x4c')](_0x1ea40a['attributes'],function(_0xc4b4e5){var _0x4057a9={};_0x4057a9[_0xc4b4e5]={'$like':'%'+_0x1ea912[_0xb398('0x4d')][_0xb398('0x59')]+'%'};return _0x4057a9;})});}_0x1ea40a=_[_0xb398('0x57')]({},_0x1ea40a,_0x1ea912[_0xb398('0x62')]);return db[_0xb398('0x7e')][_0xb398('0x2a')]({'where':_0x1ea40a['where']})[_0xb398('0x1a')](function(_0x51d8e7){_0x1a80eb[_0xb398('0x2a')]=_0x51d8e7;if(_0x1ea912['query']['includeAll']){_0x1ea40a[_0xb398('0x5b')]=[{'all':!![]}];}return db[_0xb398('0x7e')][_0xb398('0x5c')](_0x1ea40a);})[_0xb398('0x1a')](function(_0x2cf95d){_0x1a80eb[_0xb398('0x7b')]=_0x2cf95d;return _0x1a80eb;});}})['then'](respondWithFilteredResult(_0x3f1b5e,_0x1ea40a))[_0xb398('0x5d')](handleError(_0x3f1b5e,null));};exports['removeAnswers']=function(_0x13ab4c,_0x54883d){return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x13ab4c[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x54883d,null))['then'](function(_0x5230d5){if(_0x5230d5){return _0x5230d5['removeAnswers'](_0x13ab4c[_0xb398('0x4d')]['ids']);}})[_0xb398('0x1a')](respondWithStatusCode(_0x54883d,null))[_0xb398('0x5d')](handleError(_0x54883d,null));};exports[_0xb398('0x80')]=function(_0x3b0136,_0x22b24d){_0x3b0136[_0xb398('0x65')][_0xb398('0x81')]=_0x3b0136[_0xb398('0x82')]['filename'];return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x3b0136['params']['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x22b24d,null))[_0xb398('0x1a')](saveUpdates(_0x3b0136[_0xb398('0x65')],null))[_0xb398('0x1a')](respondWithResult(_0x22b24d,null))[_0xb398('0x5d')](handleError(_0x22b24d,null));};exports[_0xb398('0x83')]=function(_0x522f6d,_0xf87c55){_0x522f6d['body'][_0xb398('0x84')]=_0x522f6d[_0xb398('0x82')][_0xb398('0x85')];return db[_0xb398('0x60')]['find']({'where':{'id':_0x522f6d[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0xf87c55,null))[_0xb398('0x1a')](saveUpdates(_0x522f6d['body'],null))[_0xb398('0x1a')](respondWithResult(_0xf87c55,null))[_0xb398('0x5d')](handleError(_0xf87c55,null));};exports[_0xb398('0x86')]=function(_0x37dd30,_0x33001e){_0x37dd30[_0xb398('0x65')][_0xb398('0x87')]=_0x37dd30['file'][_0xb398('0x85')];return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x37dd30['params']['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x33001e,null))[_0xb398('0x1a')](saveUpdates(_0x37dd30[_0xb398('0x65')],null))['then'](respondWithResult(_0x33001e,null))[_0xb398('0x5d')](handleError(_0x33001e,null));};exports[_0xb398('0x88')]=function(_0x446737,_0x1791ba){_0x446737[_0xb398('0x65')]['systemAvatar']=_0x446737[_0xb398('0x82')]['filename'];return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x446737[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x1791ba,null))[_0xb398('0x1a')](saveUpdates(_0x446737[_0xb398('0x65')],null))[_0xb398('0x1a')](respondWithResult(_0x1791ba,null))[_0xb398('0x5d')](handleError(_0x1791ba,null));};exports[_0xb398('0x89')]=function(_0x5773bf,_0x5874a9){var _0x3603bb=path[_0xb398('0x8a')](config['root'],_0xb398('0x8b'));var _0x12ce45={'where':{'id':_0x5773bf[_0xb398('0x72')]['id']},'attributes':['id',_0xb398('0x81')],'raw':!![]};var _0x2e5434=![];return require(_0xb398('0x8c'))[_0xb398('0x8d')]()['then'](function(_0x4d5e46){if(_0x4d5e46){_0x2e5434=_0x4d5e46[_0xb398('0x8e')];}})[_0xb398('0x1a')](function(){return db[_0xb398('0x60')]['find'](_0x12ce45);})[_0xb398('0x1a')](handleEntityNotFound(_0x5874a9,null))[_0xb398('0x1a')](function(_0x3b7830){if(_0x3b7830){if(!_[_0xb398('0x8f')](_0x3b7830[_0xb398('0x81')])){if(fs[_0xb398('0x90')](path[_0xb398('0x8a')](config['root'],'server/files/images/logos/',_0x3b7830[_0xb398('0x81')]))&&_0x2e5434){_0x3603bb=path['join'](config['root'],_0xb398('0x91'),_0x3b7830[_0xb398('0x81')]);}}return _0x5874a9[_0xb398('0x92')](_0x3603bb);}})[_0xb398('0x5d')](handleError(_0x5874a9,null));};exports[_0xb398('0x93')]=function(_0x429cff,_0x4b823c){var _0x24fcbf=path[_0xb398('0x8a')](config[_0xb398('0x94')],_0xb398('0x95'));var _0x28962d={'where':{'id':_0x429cff[_0xb398('0x72')]['id']},'attributes':['id',_0xb398('0x84')],'raw':!![]};return db['ChatWebsite'][_0xb398('0x63')](_0x28962d)[_0xb398('0x1a')](handleEntityNotFound(_0x4b823c,null))[_0xb398('0x1a')](function(_0x48d8b1){if(_0x48d8b1){if(!_[_0xb398('0x8f')](_0x48d8b1[_0xb398('0x84')])){if(fs[_0xb398('0x90')](path[_0xb398('0x8a')](config[_0xb398('0x94')],_0xb398('0x96'),_0x48d8b1['agentAvatar']))){_0x24fcbf=path[_0xb398('0x8a')](config[_0xb398('0x94')],_0xb398('0x96'),_0x48d8b1['agentAvatar']);}}return _0x4b823c[_0xb398('0x92')](_0x24fcbf);}})[_0xb398('0x5d')](handleError(_0x4b823c,null));};exports[_0xb398('0x97')]=function(_0x436569,_0x3708e7){var _0x44eca6=path[_0xb398('0x8a')](config[_0xb398('0x94')],_0xb398('0x98'));var _0x1f9597={'where':{'id':_0x436569[_0xb398('0x72')]['id']},'attributes':['id','customerAvatar',_0xb398('0x99')],'raw':!![]};return db['ChatWebsite'][_0xb398('0x63')](_0x1f9597)[_0xb398('0x1a')](handleEntityNotFound(_0x3708e7,null))[_0xb398('0x1a')](function(_0x4d7baf){if(_0x4d7baf){if(!_[_0xb398('0x8f')](_0x4d7baf[_0xb398('0x87')])){if(fs[_0xb398('0x90')](path[_0xb398('0x8a')](config['root'],_0xb398('0x96'),_0x4d7baf['customerAvatar']))&&_0x4d7baf[_0xb398('0x99')]){_0x44eca6=path[_0xb398('0x8a')](config[_0xb398('0x94')],_0xb398('0x96'),_0x4d7baf['customerAvatar']);}}return _0x3708e7[_0xb398('0x92')](_0x44eca6);}})[_0xb398('0x5d')](handleError(_0x3708e7,null));};exports[_0xb398('0x9a')]=function(_0x24e09a,_0x3a0e3d){var _0x540ac6=path[_0xb398('0x8a')](config[_0xb398('0x94')],_0xb398('0x9b'));var _0x2a46a7={'where':{'id':_0x24e09a[_0xb398('0x72')]['id']},'attributes':['id',_0xb398('0x9c')],'raw':!![]};return db[_0xb398('0x60')]['find'](_0x2a46a7)[_0xb398('0x1a')](handleEntityNotFound(_0x3a0e3d,null))[_0xb398('0x1a')](function(_0x92011c){if(_0x92011c){if(!_[_0xb398('0x8f')](_0x92011c[_0xb398('0x9c')])){if(fs[_0xb398('0x90')](path['join'](config[_0xb398('0x94')],'server/files/images/avatars/',_0x92011c[_0xb398('0x9c')]))){_0x540ac6=path[_0xb398('0x8a')](config[_0xb398('0x94')],_0xb398('0x96'),_0x92011c[_0xb398('0x9c')]);}}return _0x3a0e3d['download'](_0x540ac6);}})[_0xb398('0x5d')](handleError(_0x3a0e3d,null));};function checkWebsiteInterval(_0x1c68c3){var _0x309f25=_0x1c68c3['Interval'];if(!_0x309f25){return Promise[_0xb398('0x9d')](_0x1c68c3);}var _0x23f7c5=_0x1c68c3['timezone']||undefined;return _0x309f25[_0xb398('0x9e')](_0x23f7c5)[_0xb398('0x1a')](function(_0x2093f3){if(!_0x2093f3){throw new APIOutOfIntervalError();}return _0x1c68c3;});}exports[_0xb398('0x9f')]=function(_0x31175b,_0x389910){var _0x116558={'body':_0x31175b[_0xb398('0x65')],'channel':'chat'};var _0x58a972=[];var _0x28c448=[];var _0x4a499c={};var _0x2437b0=![];if(_0x31175b[_0xb398('0x65')]['id']){delete _0x31175b['body']['id'];}if(_[_0xb398('0x8f')](_0x31175b[_0xb398('0x65')][_0xb398('0xa0')])){throw new APIBadRequestError(_0xb398('0xa1'));}if(_[_0xb398('0x8f')](_0x31175b[_0xb398('0x65')][_0xb398('0xa2')])){throw new APIBadRequestError(_0xb398('0xa3'));}if(_[_0xb398('0xa4')](_0x31175b[_0xb398('0x65')][_0xb398('0x65')])){throw new APIBadRequestError(_0xb398('0xa5'));}var _0x4efa55=_0x31175b[_0xb398('0x65')][_0xb398('0x36')]&&_0x31175b['body'][_0xb398('0xa6')];return db[_0xb398('0xa7')][_0xb398('0x73')]()[_0xb398('0x1a')](function(_0x3efb64){if(!_0x3efb64){throw new Error('No\x20available\x20attributes');}_0x58a972=Object['keys'](_0x3efb64)[_0xb398('0x59')](function(_0x822c8f){return!['createdAt',_0xb398('0xa8')][_0xb398('0xa9')](_0x822c8f);});_0x28c448=Object[_0xb398('0x4e')](_0x3efb64)[_0xb398('0x59')](function(_0x7b984b){return!['createdAt',_0xb398('0xa8'),_0xb398('0xaa'),_0xb398('0xab')][_0xb398('0xa9')](_0x7b984b);});if(!_[_0xb398('0xa9')](_0x28c448,_0x31175b[_0xb398('0x65')]['mapKey'])){throw new APIBadRequestError(_0xb398('0xac')+_0x28c448[_0xb398('0x8a')](',\x20'));}_0x4a499c[_0x31175b[_0xb398('0x65')][_0xb398('0xa2')]]=_0x31175b[_0xb398('0x65')][_0xb398('0xa0')];})[_0xb398('0x1a')](function(){return db['ChatWebsite'][_0xb398('0x63')]({'where':{'id':_0x31175b[_0xb398('0x72')]['id']},'include':[{'model':db[_0xb398('0xad')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb398('0xae'),'where':_0x4a499c,'limit':0x1,'order':[[_0xb398('0xa8'),_0xb398('0xaf')]]}]},{'model':db[_0xb398('0xb0')],'as':_0xb398('0xb1')},{'model':db[_0xb398('0xb2')],'as':_0xb398('0xb2'),'include':[{'model':db[_0xb398('0xb2')],'as':_0xb398('0xb3'),'attributes':['id','interval'],'raw':!![]}]}]});})['then'](function(_0x4446e3){if(!_0x4446e3){throw new APINotFoundError(util[_0xb398('0x40')](_0xb398('0xb4'),_0x31175b[_0xb398('0x72')]['id']));}if(_0x4efa55){return checkWebsiteInterval(_0x4446e3);}return _0x4446e3;})['then'](function(_0x1d378e){_0x116558[_0xb398('0xb5')]=_0x1d378e;_0x116558[_0xb398('0xb6')]=_[_0xb398('0xb7')](_0x1d378e[_0xb398('0xb1')],[_0xb398('0xb8')],[_0xb398('0xb9')]);if(_0x116558[_0xb398('0xb5')][_0xb398('0xb1')]){delete _0x116558[_0xb398('0xb5')][_0xb398('0xb1')];}_0x116558[_0xb398('0xba')]=_0x1d378e['List']||{'id':_0x1d378e['ListId']};if(_0x116558['list']&&_0x116558[_0xb398('0xba')][_0xb398('0xae')][_0xb398('0x61')]){return _0x116558[_0xb398('0xba')][_0xb398('0xae')][0x0];}var _0x22f5a5=_[_0xb398('0x12')](_0x31175b[_0xb398('0x65')],{'firstName':_0x31175b[_0xb398('0x65')][_0xb398('0xa0')],'ListId':_0x1d378e[_0xb398('0xab')]});_0x22f5a5[_0x31175b[_0xb398('0x65')][_0xb398('0xa2')]]=_0x31175b[_0xb398('0x65')]['from'];return db[_0xb398('0xa7')][_0xb398('0x64')](_0x22f5a5,{'fields':_0x58a972,'raw':!![]});})[_0xb398('0x1a')](function(_0x2d2140){_0x116558['contact']=_0x2d2140;var _0x1c8398=createInteractionObject(_0x31175b[_0xb398('0x72')]['id'],_0x31175b['body'],_0x31175b[_0xb398('0xbb')],_0x2d2140);var _0x3519a3={'ChatWebsiteId':_0x31175b[_0xb398('0x72')]['id']};if(_0x31175b['body'][_0xb398('0xbc')]){_0x3519a3['threadId']=_0x31175b[_0xb398('0x65')][_0xb398('0xbc')];_0x3519a3['closed']=![];return db[_0xb398('0xbd')][_0xb398('0x63')]({'where':_0x3519a3})['then'](function(_0x4d8408){var _0x406bee=_0x31175b[_0xb398('0x65')][_0xb398('0x36')]&&_0x31175b[_0xb398('0x65')][_0xb398('0xa6')];if(_0x4d8408){_0x2437b0=!![];return _0x4d8408;}else if(!_0x406bee&&_0x4d8408&&_0x4d8408[_0xb398('0xbe')]){throw new APIConflictError(_0xb398('0xbf'));}_0x1c8398[_0xb398('0xbc')]=_0x31175b[_0xb398('0x65')][_0xb398('0xbc')];_0x1c8398[_0xb398('0xc0')]=_0x31175b['body'][_0xb398('0xc0')];return db[_0xb398('0xbd')][_0xb398('0x64')](_0x1c8398);});}_0x3519a3[_0xb398('0xc1')]=_0x2d2140['id'];if(_0x31175b[_0xb398('0x65')][_0xb398('0xc2')]&&_0x31175b[_0xb398('0x65')][_0xb398('0xc2')]['id']){_0x3519a3['id']=_0x31175b[_0xb398('0x65')][_0xb398('0xc2')]['id'];return db[_0xb398('0xbd')][_0xb398('0x63')]({'where':_0x3519a3})[_0xb398('0x1a')](function(_0x1cc65e){var _0x5e6454=_0x31175b['body'][_0xb398('0x36')]&&_0x31175b[_0xb398('0x65')][_0xb398('0xa6')];if(!_0x5e6454&&_0x1cc65e&&_0x1cc65e[_0xb398('0xbe')]){throw new APIConflictError(_0xb398('0xbf'));}else if(_0x1cc65e){_0x2437b0=!![];return _0x1cc65e;}else{return db[_0xb398('0xbd')][_0xb398('0x64')](_0x1c8398);}});}return db['ChatInteraction'][_0xb398('0x64')](_0x1c8398);})['then'](function(_0x32d654){if(!_0x2437b0){return _0x32d654;}var _0x3fcbe1={'from':(_0x116558[_0xb398('0xc3')]['firstName']||'')+'\x20'+(_0x116558[_0xb398('0xc3')][_0xb398('0x3b')]||'')};if(_0x31175b[_0xb398('0x65')][_0xb398('0xbc')]&&_0x31175b[_0xb398('0x65')]['messageId']&&_0x31175b[_0xb398('0x65')][_0xb398('0xbc')]!=_0x31175b['body']['messageId']){_0x3fcbe1['threadId']=_0x31175b['body'][_0xb398('0xc4')];}return _0x32d654[_0xb398('0x2d')](_0x3fcbe1);})[_0xb398('0x1a')](function(_0x3ba739){_0x116558[_0xb398('0xc2')]=_0x3ba739[_0xb398('0x6b')]({'plain':!![]});_0x116558[_0xb398('0xc2')]['created']=!_0x2437b0;if(_0x116558[_0xb398('0xc2')][_0xb398('0xc5')]){if(_0x116558['account']['autoclose']){_0x116558[_0xb398('0xb6')][_0xb398('0xc6')]({'id':0x0,'priority':_0x116558[_0xb398('0xb6')][_0xb398('0x61')]+0x1,'app':_0xb398('0xc7'),'appdata':_0xb398('0xc8'),'interval':_0xb398('0xc9')});}}return db['ChatMessage'][_0xb398('0x64')]({'body':_0x31175b['body'][_0xb398('0x65')],'ChatWebsiteId':_0x31175b['params']['id'],'ChatInteractionId':_0x3ba739['id'],'direction':'in','ContactId':_0x116558['contact']['id'],'AttachmentId':_0x31175b[_0xb398('0x65')][_0xb398('0xca')]});})[_0xb398('0x1a')](function(_0x168d71){_0x116558[_0xb398('0x22')]=_0x168d71;if(!_0x116558[_0xb398('0xc2')][_0xb398('0xcb')]){return;}return db[_0xb398('0xcc')][_0xb398('0x63')]({'attributes':['id','name'],'where':{'id':_0x116558[_0xb398('0xc2')][_0xb398('0xcb')]}});})[_0xb398('0x1a')](function(_0x5f1e29){if(_0x5f1e29){_0x116558[_0xb398('0xb6')][_0xb398('0xcd')]({'id':0x0,'priority':0x0,'app':_0xb398('0xce'),'appdata':_0x5f1e29[_0xb398('0x30')]+','+(_0x116558[_0xb398('0xb5')][_0xb398('0xcf')]||0xa),'interval':_0xb398('0xc9')});_0x116558[_0xb398('0xd0')]=!![];}if(!_0x116558[_0xb398('0xc2')][_0xb398('0xd1')]){return;}return db['ChatQueue']['find']({'attributes':['id',_0xb398('0x30')],'where':{'id':_0x116558[_0xb398('0xc2')][_0xb398('0xd1')]}});})[_0xb398('0x1a')](function(_0x503cd1){if(_0x503cd1){_0x116558[_0xb398('0xb6')][_0xb398('0xcd')]({'id':0x0,'priority':0x1,'app':_0xb398('0xd2'),'appdata':_0x503cd1[_0xb398('0x30')]+','+(_0x116558[_0xb398('0xb5')][_0xb398('0xd3')]||0x12c),'interval':_0xb398('0xc9')});}return respondWithRpcPromise('Start',_0xb398('0xd4'),_0x116558);})[_0xb398('0x1a')](function(_0x31875d){respondWithRpcPromise(_0xb398('0xd5'),_0xb398('0xd5'),{'event':_0xb398('0x9f'),'message':_0x31875d},client9002);return _0x31875d;})['then'](respondWithResult(_0x389910,null))[_0xb398('0x5d')](APIHandleError(_0x389910));};exports[_0xb398('0xd6')]=function(_0x574aaa,_0x227c93){var _0x10063f,_0x3bcd25,_0x4dce35;var _0x5b3113=[];var _0x135d08={};var _0x24e9e=_0x574aaa[_0xb398('0xd7')]||[];var _0x320cb5=[];var _0x37285f;return db['CmContact'][_0xb398('0x73')]()[_0xb398('0x1a')](function(_0x1b8bb0){if(!_0x1b8bb0){throw new db[(_0xb398('0xd8'))][(_0xb398('0xd9'))](_0xb398('0xda'));}_0x5b3113=_[_0xb398('0xdb')](_[_0xb398('0x4e')](_0x1b8bb0),[_0xb398('0xdc'),_0xb398('0xa8'),_0xb398('0xaa'),_0xb398('0xab')]);if(_0x574aaa['body']['id']){delete _0x574aaa['body']['id'];}if(_[_0xb398('0x8f')](_0x574aaa[_0xb398('0x65')]['from'])){throw _0x227c93[_0xb398('0x25')](0x1f4)[_0xb398('0x31')](new db[(_0xb398('0xd8'))][(_0xb398('0xd9'))](_0xb398('0xdd')));}if(_[_0xb398('0x8f')](_0x574aaa[_0xb398('0x65')]['body'])||_0x574aaa['body']['body']===''){throw _0x227c93[_0xb398('0x25')](0x1f4)[_0xb398('0x31')](new db[(_0xb398('0xd8'))][(_0xb398('0xd9'))](_0xb398('0xde')));}if(_[_0xb398('0x8f')](_0x574aaa[_0xb398('0x65')][_0xb398('0xdf')])){throw _0x227c93[_0xb398('0x25')](0x1f4)[_0xb398('0x31')](new db[(_0xb398('0xd8'))][(_0xb398('0xd9'))](_0xb398('0xe0')+_0x5b3113));}if(!_[_0xb398('0xa9')](_0x5b3113,_0x574aaa[_0xb398('0x65')][_0xb398('0xdf')])){throw _0x227c93['status'](0x1f4)['send'](new db[(_0xb398('0xd8'))][(_0xb398('0xd9'))](_0xb398('0xe1')+_0x5b3113));}_0x135d08[_0x574aaa[_0xb398('0x65')][_0xb398('0xdf')]]=_0x574aaa[_0xb398('0x65')][_0xb398('0xa0')];})[_0xb398('0x1a')](function(){return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x574aaa[_0xb398('0x72')]['id']},'include':[{'model':db[_0xb398('0xad')],'as':_0xb398('0xe2')},{'model':db[_0xb398('0xe3')],'as':_0xb398('0xe3')}]});})[_0xb398('0x1a')](handleEntityNotFound(_0x227c93,null))[_0xb398('0x1a')](function(_0x4ac3d5){if(_0x4ac3d5&&_0x4ac3d5[_0xb398('0xe2')]){_0x3bcd25=_0x4ac3d5;var _0x2afbe9=_[_0xb398('0x12')](_0x574aaa[_0xb398('0x65')],{'firstName':_0x574aaa['body'][_0xb398('0xa0')],'phone':_0x574aaa[_0xb398('0x65')][_0xb398('0xa0')],'ListId':_0x4ac3d5[_0xb398('0xab')]});_0x2afbe9[_0x574aaa[_0xb398('0x65')]['mapKeyOffline']]=_0x574aaa['body'][_0xb398('0xa0')];return db[_0xb398('0xa7')][_0xb398('0xe4')]({'where':_0x135d08,'defaults':_0x2afbe9});}})['spread'](function(_0x2588c3){if(_0x2588c3){_0x4dce35=_0x2588c3;var _0x19cb55=fs['readFileSync'](path[_0xb398('0x8a')](config[_0xb398('0x94')],_0xb398('0xe5')),_0xb398('0xe6'));var _0x3ec4f1=ejs[_0xb398('0xe7')](_0x19cb55,{'body':_[_0xb398('0xe8')](_0x574aaa[_0xb398('0x65')][_0xb398('0x65')]),'bodyTitle':_0x3bcd25['offlineMessageBody']});return db[_0xb398('0xe9')]['create']({'body':_0x3ec4f1,'plainBody':htmlToText[_0xb398('0xea')](_0x3ec4f1),'ContactId':_0x2588c3['id'],'ChatWebsiteId':_0x3bcd25['id']});}})[_0xb398('0x1a')](function(_0xbc82df){_0x37285f=_0xbc82df;if(_0x24e9e[_0xb398('0x61')]){var _0x10a4c1=_0x24e9e['map'](function(_0x2e9435){return{'name':_0x2e9435['originalname'],'basename':_0x2e9435['filename'],'type':_0x2e9435[_0xb398('0xeb')],'ChatOfflineMessageId':_0xbc82df['id']};});_0x320cb5=_0x10a4c1['map'](_0x2fe4cc=>{var _0x3118f7={'filename':_0x2fe4cc[_0xb398('0x30')],'path':path['join'](config[_0xb398('0x94')],'server','files',_0xb398('0xec'),_0xb398('0xed'),_0x2fe4cc[_0xb398('0xee')])};return _0x3118f7;});if(!_0x3bcd25[_0xb398('0xef')]){return db['sequelize'][_0xb398('0xf0')](function(_0x2b2799){return db['Attachment'][_0xb398('0xf1')](_0x10a4c1,{'transaction':_0x2b2799});});}}})['then'](function(){if(_0x37285f){_0x10063f=_0x37285f;return db[_0xb398('0xe3')][_0xb398('0x78')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb398('0xf2'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xb398('0xf3'),'raw':!![]}]}]});}})[_0xb398('0x1a')](function(_0x2447ab){if(_0x2447ab&&_0x2447ab[_0xb398('0xf2')]&&_0x3bcd25[_0xb398('0xf4')]&&_0x3bcd25['forwardOfflineAddress']){var _0x522430=_0x2447ab[_0xb398('0xf5')]();return respondWithRpcPromise(_0xb398('0xf6'),'sendMail',{'account':_0x522430,'message':{'from':util[_0xb398('0x40')]('\x22%s\x22\x20<%s>',_0x2447ab['name'],_0x2447ab[_0xb398('0xf7')]||_0x2447ab[_0xb398('0xf2')][_0xb398('0x6a')]),'to':_0x3bcd25['forwardOfflineAddress'],'subject':_0x3bcd25[_0xb398('0xf8')],'html':_0x10063f['body'],'attachments':_0x320cb5}},client9003)['then'](function(){return _0x10063f;})[_0xb398('0x5d')](function(_0x410a56){logger[_0xb398('0x1f')](_0x410a56);});}})[_0xb398('0x1a')](function(){if(_0x3bcd25&&_0x3bcd25[_0xb398('0xef')]&&_0x3bcd25[_0xb398('0xf9')]){var _0x3a6daa=[];if(_0x24e9e[_0xb398('0x61')]){_0x3a6daa=_0x24e9e[_0xb398('0x4c')](function(_0x5e2f5f){return{'name':_0x5e2f5f['originalname'],'basename':_0x5e2f5f[_0xb398('0x85')],'type':_0x5e2f5f[_0xb398('0xeb')],'ChatOfflineMessageId':_0x37285f['id']};});}var _0x19f60f;if(!_[_0xb398('0x8f')](_0x3bcd25[_0xb398('0xfa')])){var _0x29101c=_[_0xb398('0x4c')](_0x574aaa[_0xb398('0x65')],function(_0xcd191){return _0xcd191;});var _0x158ad3=_['toPairsIn'](_0x29101c)[0x0];var _0x1508ce=_[_0xb398('0xfb')](_0x158ad3,function(_0x5702f5){return _0x5702f5;});_0x19f60f=_0x1508ce[0x1][_0x3bcd25[_0xb398('0xfa')]];}var _0x1ed1f9={'from':_0x4dce35[_0xb398('0xf7')],'firstName':_0x4dce35[_0xb398('0xfc')],'lastName':_0x4dce35['lastName'],'mapKey':_0xb398('0xf7'),'message':{'from':_0x4dce35[_0xb398('0xf7')],'to':_0x3bcd25[_0xb398('0xe3')][_0xb398('0xf7')],'cc':'','subject':_[_0xb398('0x8f')](_0x19f60f)?_0x3bcd25['offlineMessageSubject']:_0x19f60f,'messageId':'','sentAt':new Date(),'attach':_0x3a6daa['length'],'attachments':_0x3a6daa,'originChannel':_0xb398('0xfd'),'ChatWebsiteId':_0x3bcd25['id'],'ChatOfflineMessageId':_0x10063f['id'],'originTo':_0x3bcd25[_0xb398('0xe3')]['email']},'body':_0x10063f[_0xb398('0x65')]};var _0x4d15f5={'account':{'id':_0x3bcd25['MailAccountId']},'body':_0x1ed1f9,'log':_0xb398('0xfe')};return respondWithRpcPromise(_0xb398('0xfe'),_0xb398('0xff'),_0x4d15f5,client9001)['then'](function(){return _0x10063f;})[_0xb398('0x5d')](function(_0x577ea8){logger[_0xb398('0x1f')](_0x577ea8);});}return;})[_0xb398('0x1a')](function(){if(_0x10063f){return _0x10063f;}})[_0xb398('0x1a')](respondWithResult(_0x227c93,null))[_0xb398('0x5d')](function(){for(var _0x3daac9 of _0x24e9e){var _0x458e5c=path[_0xb398('0x8a')](config['root'],_0xb398('0x100'),_0xb398('0xd7'),_0xb398('0xec'),_0xb398('0xed'),_0x3daac9[_0xb398('0x85')]);fs_extra[_0xb398('0x101')](_0x458e5c)[_0xb398('0x5d')](function(_0x2818c0){logger[_0xb398('0x1f')]('Could\x20not\x20remove\x20attachment\x20file',_0x458e5c,_0x2818c0);});}});};exports[_0xb398('0x102')]=function(_0x3b8d1a,_0x5e6773){return db[_0xb398('0xbd')][_0xb398('0x63')]({'where':{'id':_0x3b8d1a[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x5e6773,null))[_0xb398('0x1a')](function(_0x1618d3){if(_0x1618d3){return _0x1618d3[_0xb398('0x102')](_0x3b8d1a['body'][_0xb398('0x103')],_[_0xb398('0x104')](_0x3b8d1a['body'],[_0xb398('0x103'),'id'])||{});}})[_0xb398('0x1a')](respondWithResult(_0x5e6773,null))[_0xb398('0x5d')](handleError(_0x5e6773,null));};exports['getInteractions']=function(_0x47a9c8,_0x3f4499){var _0x296723={'raw':![],'where':{}};var _0x3f10db={};var _0xe016cd={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb398('0x78')]({'where':{'id':_0x47a9c8[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x3f4499,null))[_0xb398('0x1a')](function(_0x205291){if(_0x205291){_0x3f10db[_0xb398('0x42')]=_['keys'](db[_0xb398('0xbd')][_0xb398('0x49')]);_0x3f10db[_0xb398('0x4d')]=_[_0xb398('0x4e')](_0x47a9c8[_0xb398('0x4d')]);_0x3f10db[_0xb398('0x4f')]=_[_0xb398('0x50')](_0x3f10db['model'],_0x3f10db['query']);_0x296723['attributes']=_[_0xb398('0x50')](_0x3f10db[_0xb398('0x42')],qs['fields'](_0x47a9c8[_0xb398('0x4d')][_0xb398('0x52')]));_0x296723[_0xb398('0x51')]=_0x296723[_0xb398('0x51')]['length']?_0x296723[_0xb398('0x51')]:_0x3f10db[_0xb398('0x42')];if(!_0x47a9c8[_0xb398('0x4d')]['hasOwnProperty'](_0xb398('0x7a'))){_0x296723[_0xb398('0x29')]=qs['limit'](_0x47a9c8[_0xb398('0x4d')]['limit']);_0x296723['offset']=qs['offset'](_0x47a9c8['query'][_0xb398('0x28')]);}_0x296723[_0xb398('0x53')]=qs[_0xb398('0x54')](_0x47a9c8[_0xb398('0x4d')]['sort']);_0x296723[_0xb398('0x55')]=qs[_0xb398('0x4f')](_['pick'](_0x47a9c8[_0xb398('0x4d')],_0x3f10db[_0xb398('0x4f')]));_0x296723[_0xb398('0x55')][_0xb398('0x75')]=_0x205291['id'];if(_0x47a9c8[_0xb398('0x4d')][_0xb398('0x59')]){_0x296723[_0xb398('0x55')]=_[_0xb398('0x57')](_0x296723['where'],{'$or':_[_0xb398('0x4c')](_0x296723[_0xb398('0x51')],function(_0x535c94){var _0x5d08f3={};_0x5d08f3[_0x535c94]={'$like':'%'+_0x47a9c8[_0xb398('0x4d')][_0xb398('0x59')]+'%'};return _0x5d08f3;})});}_0x296723=_[_0xb398('0x57')]({},_0x296723,_0x47a9c8[_0xb398('0x62')]);return db[_0xb398('0xbd')]['count']({'where':_0x296723[_0xb398('0x55')]})[_0xb398('0x1a')](function(_0x5705ff){_0xe016cd[_0xb398('0x2a')]=_0x5705ff;if(_0x47a9c8[_0xb398('0x4d')][_0xb398('0x5a')]){_0x296723[_0xb398('0x5b')]=[{'model':db[_0xb398('0xa7')],'as':_0xb398('0x105'),'required':![]},{'model':db[_0xb398('0xcc')],'as':_0xb398('0x106'),'attributes':['name',_0xb398('0x107'),'internal'],'required':![]},{'model':db[_0xb398('0x108')],'as':_0xb398('0x109'),'attributes':['id','name','color'],'where':_0x47a9c8[_0xb398('0x4d')][_0xb398('0x10a')]?{'id':_0x47a9c8['query'][_0xb398('0x10a')]}:undefined,'required':_0x47a9c8[_0xb398('0x4d')][_0xb398('0x10a')]?!![]:![]}];}return db[_0xb398('0xbd')][_0xb398('0x5c')](_0x296723);})['then'](function(_0x17519e){_0xe016cd['rows']=_0x17519e;return _0xe016cd;});}})[_0xb398('0x1a')](respondWithFilteredResult(_0x3f4499,_0x296723))[_0xb398('0x5d')](handleError(_0x3f4499,null));};exports[_0xb398('0x10b')]=function(_0x32b1fb,_0x37bf38){var _0x483022=0x0;var _0x2d7a4d=0x0;var _0x4472cb=![];var _0x4db47b;var _0x468e5b;return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x32b1fb[_0xb398('0x72')]['id']},'include':[{'model':db['Interval'],'as':_0xb398('0xb2'),'include':[{'model':db[_0xb398('0xb2')],'as':_0xb398('0xb3'),'attributes':['id',_0xb398('0x10c')]}]}]})[_0xb398('0x1a')](handleEntityNotFound(_0x37bf38,null))[_0xb398('0x1a')](function(_0x269a7e){if(_0x269a7e){_0x4db47b=_0x269a7e;return _0x269a7e[_0xb398('0x10d')]({'raw':!![]});}})[_0xb398('0x1a')](function(_0x407042){if(_0x4db47b){if(_0x407042){_0x468e5b=_0x407042;}}return require(_0xb398('0x8c'))[_0xb398('0x8d')]();})[_0xb398('0x1a')](function(_0x44f718){if(_0x44f718){_0x2d7a4d=_0x44f718[_0xb398('0x10e')];_0x4472cb=_0x44f718['custom'];}})[_0xb398('0x1a')](function(){return db[_0xb398('0xbd')][_0xb398('0x2a')]({'where':{'closed':![]}});})[_0xb398('0x1a')](function(_0x3d6e48){_0x483022=_0x3d6e48;if(_0x2d7a4d&&_0x3d6e48>_0x2d7a4d){return db[_0xb398('0x10f')][_0xb398('0x78')]({'where':{'id':0x1}})[_0xb398('0x1a')](function(_0xbe7b51){if(_0xbe7b51){_0xbe7b51[_0xb398('0x110')]('chatLicenseExceeded');}});}})[_0xb398('0x1a')](function(){var _0x1a6d55=_0x4db47b[_0xb398('0xb2')];var _0x29c385=_0x4db47b[_0xb398('0x111')]||undefined;return _0x1a6d55?_0x1a6d55[_0xb398('0x9e')](_0x29c385):!![];})[_0xb398('0x1a')](function(_0xf8b050){var _0x308e4b=fs[_0xb398('0x112')](path[_0xb398('0x8a')](config[_0xb398('0x94')],_0xb398('0x113')),'utf8');var _0xcbbb51=_0xb398('0x114');var _0x314911=![];var _0x1208f9,_0xfde7f2;if(_0x32b1fb[_0xb398('0xbb')][_0xb398('0xa6')]){_0x1208f9=new URL(_0x32b1fb[_0xb398('0xbb')][_0xb398('0xa6')])[_0xb398('0x115')];}else if(_0x32b1fb['headers']['origin']){_0x1208f9=new URL(_0x32b1fb[_0xb398('0xbb')][_0xb398('0x115')])[_0xb398('0x115')];}else{_0x1208f9=_0xb398('0x116');}_0xfde7f2=typeof _0x4db47b[_0xb398('0x71')][_0xb398('0x3a')](',')[_0xb398('0x63')](function(_0x58c56f){return wildcardUtils['testWebsiteWithWildcard'](_0x58c56f,_0x1208f9);})!==_0xb398('0x117');var _0x69fa89={'chatVersion':_0xcbbb51,'chatWebsiteAddressOrigin':_0xfde7f2?_0x1208f9:_0x4db47b[_0xb398('0x71')],'remote':_0x4db47b[_0xb398('0x118')],'query':querystring[_0xb398('0x46')](_['merge'](_0x4db47b[_0xb398('0x6b')]({'plain':!![]}),{'customerIp':_0x32b1fb[_0xb398('0xbb')][_0xb398('0x38')]||_0x32b1fb['headers'][_0xb398('0x119')]||_0x32b1fb[_0xb398('0x11a')][_0xb398('0x11b')]||_0x32b1fb['ip'],'referer':_0x32b1fb['headers'][_0xb398('0xa6')],'openedInteractions':_0x483022,'maxInteractions':_0x2d7a4d,'virtual':_0x4472cb[_0xb398('0x10e')],'online':_0xf8b050,'custom':_0x4472cb,'address':_0xfde7f2?_0x1208f9:null}))[_0xb398('0x11c')](/'/g,'\x5c\x27')};_0x37bf38[_0xb398('0x31')](ejs['render'](Mustache[_0xb398('0xe7')](_0x308e4b,_0x69fa89),{'proactiveActions':_0x468e5b,'alignment':_0x4db47b['alignment'],'verticalAlignment':_0x4db47b[_0xb398('0x11d')],'div_color':_0x4db47b[_0xb398('0x11e')],'labelText':_0x4db47b['labelText'],'text_color':_0x4db47b[_0xb398('0x11f')],'text_button_color':_0x4db47b['textButtonColor'],'button_color':_0x4db47b[_0xb398('0x120')],'background_color':_0x4db47b['backgroundColor'],'hideWhenOffline':_0x4db47b[_0xb398('0x121')],'intervalId':_0x4db47b['IntervalId'],'isDevelopment':_0x314911,'chatVersion':_0xcbbb51}));})[_0xb398('0x5d')](handleError(_0x37bf38,null));};exports[_0xb398('0x122')]=function(_0x1d34f7,_0x1d0f4d){var _0x2089af=_0x1d34f7[_0xb398('0x72')]['id'];var _0x114fe0=_0x1d34f7['body'];var _0x2e20c3=0xc8;var _0x10e863=null;return db[_0xb398('0x123')]['transaction']({'isolationLevel':db[_0xb398('0x123')]['Transaction'][_0xb398('0x124')][_0xb398('0x125')]},function(_0x55c8dd){return db[_0xb398('0x60')][_0xb398('0x78')]({'where':{'id':_0x2089af},'transaction':_0x55c8dd})['then'](function(_0xf699bc){if(_0xf699bc){return db[_0xb398('0xb0')]['destroy']({'where':{'ChatWebsiteId':_0x2089af},'transaction':_0x55c8dd})[_0xb398('0x1a')](function(){var _0x230b33=_[_0xb398('0x4c')](_0x114fe0,function(_0xab4aa4){_0xab4aa4[_0xb398('0x75')]=_0x2089af;return _0xab4aa4;});return db[_0xb398('0xb0')][_0xb398('0xf1')](_0x230b33,{'transaction':_0x55c8dd});});}else{_0x2e20c3=0x194;_0x10e863=[];}});})[_0xb398('0x1a')](function(){if(_0x2e20c3!==0x194){return db[_0xb398('0xb0')][_0xb398('0x126')]({'where':{'ChatWebsiteId':_0x2089af},'order':_0xb398('0xb8')})[_0xb398('0x1a')](function(_0x343086){_0x10e863=_0x343086;});}})[_0xb398('0x5d')](function(_0x5d6bbf){_0x2e20c3=0x1f4;logger[_0xb398('0x1f')](_0x5d6bbf[_0xb398('0x2f')]);if(_0x5d6bbf[_0xb398('0x30')]){delete _0x5d6bbf[_0xb398('0x30')];}_0x10e863=_0x5d6bbf;})[_0xb398('0x127')](function(){if(_0x10e863===null){_0x1d0f4d[_0xb398('0x24')](_0x2e20c3);}else{if(_0x2e20c3===0x1f4){_0x1d0f4d[_0xb398('0x25')](_0x2e20c3)['send'](_0x10e863);}else{_0x1d0f4d[_0xb398('0x25')](_0x2e20c3)[_0xb398('0x27')](_0x10e863);}}});};exports['getApplications']=function(_0x24b673,_0x4b1823){var _0x39eb42={};var _0x515627={};var _0x3b570e;var _0x517f28;return db['ChatWebsite'][_0xb398('0x78')]({'where':{'id':_0x24b673['params']['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x4b1823,null))[_0xb398('0x1a')](function(_0x2ddf5a){if(_0x2ddf5a){_0x3b570e=_0x2ddf5a;_0x515627[_0xb398('0x42')]=_['keys'](db[_0xb398('0xb0')][_0xb398('0x49')]);_0x515627[_0xb398('0x4d')]=_[_0xb398('0x4e')](_0x24b673[_0xb398('0x4d')]);_0x515627['filters']=_[_0xb398('0x50')](_0x515627[_0xb398('0x42')],_0x515627[_0xb398('0x4d')]);_0x39eb42['attributes']=_[_0xb398('0x50')](_0x515627['model'],qs['fields'](_0x24b673[_0xb398('0x4d')][_0xb398('0x52')]));_0x39eb42[_0xb398('0x51')]=_0x39eb42[_0xb398('0x51')][_0xb398('0x61')]?_0x39eb42['attributes']:_0x515627[_0xb398('0x42')];_0x39eb42[_0xb398('0x53')]=qs['sort'](_0x24b673['query'][_0xb398('0x54')]);_0x39eb42[_0xb398('0x55')]=qs[_0xb398('0x4f')](_['pick'](_0x24b673[_0xb398('0x4d')],_0x515627[_0xb398('0x4f')]));if(_0x24b673[_0xb398('0x4d')][_0xb398('0x59')]){_0x39eb42['where']=_[_0xb398('0x57')](_0x39eb42[_0xb398('0x55')],{'$or':_[_0xb398('0x4c')](_0x39eb42[_0xb398('0x51')],function(_0x46d2bf){var _0x535244={};_0x535244[_0x46d2bf]={'$like':'%'+_0x24b673[_0xb398('0x4d')][_0xb398('0x59')]+'%'};return _0x535244;})});}_0x39eb42=_[_0xb398('0x57')]({},_0x39eb42,_0x24b673['options']);return _0x3b570e[_0xb398('0x128')](_0x39eb42);}})[_0xb398('0x1a')](function(_0x3941a0){if(_0x3941a0){_0x517f28=_0x3941a0[_0xb398('0x61')];if(!_0x24b673[_0xb398('0x4d')][_0xb398('0x79')](_0xb398('0x7a'))){_0x39eb42['limit']=qs[_0xb398('0x29')](_0x24b673[_0xb398('0x4d')][_0xb398('0x29')]);_0x39eb42[_0xb398('0x28')]=qs['offset'](_0x24b673[_0xb398('0x4d')][_0xb398('0x28')]);}return _0x3b570e['getApplications'](_0x39eb42);}})[_0xb398('0x1a')](function(_0x516eb5){if(_0x516eb5){return _0x516eb5?{'count':_0x517f28,'rows':_0x516eb5}:null;}})[_0xb398('0x1a')](respondWithResult(_0x4b1823,null))['catch'](handleError(_0x4b1823,null));};exports[_0xb398('0x129')]=function(_0x1b953b,_0x36dce1){return db[_0xb398('0x12a')]['find']({'where':{'id':_0x1b953b[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x36dce1,null))[_0xb398('0x1a')](function(_0x4bc05a){if(_0x4bc05a){return _0x4bc05a[_0xb398('0x129')](_0x1b953b[_0xb398('0x65')][_0xb398('0x103')],_[_0xb398('0x104')](_0x1b953b['body'],[_0xb398('0x103'),'id'])||{});}})[_0xb398('0x1a')](respondWithResult(_0x36dce1,null))[_0xb398('0x5d')](handleError(_0x36dce1,null));};exports[_0xb398('0x10d')]=function(_0x38b072,_0x4a5d07){var _0x5dcc59={};var _0x377637={};var _0x3bf936;var _0x40d343;return db['ChatWebsite'][_0xb398('0x78')]({'where':{'id':_0x38b072['params']['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x4a5d07,null))['then'](function(_0x4e29ec){if(_0x4e29ec){_0x3bf936=_0x4e29ec;_0x377637[_0xb398('0x42')]=_[_0xb398('0x4e')](db[_0xb398('0x12b')][_0xb398('0x49')]);_0x377637[_0xb398('0x4d')]=_['keys'](_0x38b072['query']);_0x377637['filters']=_[_0xb398('0x50')](_0x377637['model'],_0x377637[_0xb398('0x4d')]);_0x5dcc59[_0xb398('0x51')]=_[_0xb398('0x50')](_0x377637['model'],qs[_0xb398('0x52')](_0x38b072[_0xb398('0x4d')][_0xb398('0x52')]));_0x5dcc59[_0xb398('0x51')]=_0x5dcc59[_0xb398('0x51')][_0xb398('0x61')]?_0x5dcc59[_0xb398('0x51')]:_0x377637['model'];_0x5dcc59['order']=qs[_0xb398('0x54')](_0x38b072[_0xb398('0x4d')]['sort']);_0x5dcc59[_0xb398('0x55')]=qs[_0xb398('0x4f')](_[_0xb398('0x56')](_0x38b072[_0xb398('0x4d')],_0x377637['filters']));if(_0x38b072['query'][_0xb398('0x59')]){_0x5dcc59[_0xb398('0x55')]=_[_0xb398('0x57')](_0x5dcc59[_0xb398('0x55')],{'$or':_[_0xb398('0x4c')](_0x5dcc59['attributes'],function(_0x1fea42){var _0x21e85b={};_0x21e85b[_0x1fea42]={'$like':'%'+_0x38b072[_0xb398('0x4d')][_0xb398('0x59')]+'%'};return _0x21e85b;})});}_0x5dcc59=_['merge']({},_0x5dcc59,_0x38b072['options']);return _0x3bf936[_0xb398('0x10d')](_0x5dcc59);}})['then'](function(_0x1267c9){if(_0x1267c9){_0x40d343=_0x1267c9[_0xb398('0x61')];if(!_0x38b072[_0xb398('0x4d')][_0xb398('0x79')](_0xb398('0x7a'))){_0x5dcc59[_0xb398('0x29')]=qs['limit'](_0x38b072[_0xb398('0x4d')]['limit']);_0x5dcc59['offset']=qs[_0xb398('0x28')](_0x38b072['query'][_0xb398('0x28')]);}return _0x3bf936[_0xb398('0x10d')](_0x5dcc59);}})[_0xb398('0x1a')](function(_0x36ae4d){if(_0x36ae4d){return _0x36ae4d?{'count':_0x40d343,'rows':_0x36ae4d}:null;}})[_0xb398('0x1a')](respondWithResult(_0x4a5d07,null))['catch'](handleError(_0x4a5d07,null));};exports[_0xb398('0x12c')]=function(_0x51db68,_0x4373c0){var _0x344390=_0x51db68[_0xb398('0x4d')][_0xb398('0x12d')]===_0xb398('0x12e')?_0xb398('0x12f'):_0xb398('0x130');return db[_0xb398('0x60')]['find']({'attributes':['id',_0x344390],'where':{'id':_0x51db68[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x4373c0,null))['then'](function(_0x5bb843){if(_0x5bb843){var _0x3918ec=_0x5bb843[_0x344390];var _0x2135ea=_0x3918ec&&_0x3918ec[_0xb398('0x131')]?_0x3918ec[_0xb398('0x131')]:[];_0x4373c0[_0xb398('0x31')]({'fromKey':_[_0xb398('0x8f')](_0x3918ec[_0xb398('0x132')])?undefined:_0x3918ec[_0xb398('0x132')],'count':_0x2135ea['length'],'rows':_0x2135ea});}})[_0xb398('0x5d')](handleError(_0x4373c0,null));};exports[_0xb398('0x133')]=function(_0x149c4b,_0x2c6a57){var _0x43e299={'raw':![],'where':{}};var _0x4e272b={};var _0x332c16={'count':0x0,'rows':[]};return db[_0xb398('0x60')][_0xb398('0x78')]({'where':{'id':_0x149c4b['params']['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x2c6a57,null))[_0xb398('0x1a')](function(_0x3609f2){if(_0x3609f2){_0x4e272b[_0xb398('0x42')]=_[_0xb398('0x4e')](db['ChatOfflineMessage'][_0xb398('0x49')]);_0x4e272b[_0xb398('0x4d')]=_['keys'](_0x149c4b[_0xb398('0x4d')]);_0x4e272b[_0xb398('0x4f')]=_[_0xb398('0x50')](_0x4e272b['model'],_0x4e272b[_0xb398('0x4d')]);_0x43e299[_0xb398('0x51')]=_[_0xb398('0x50')](_0x4e272b[_0xb398('0x42')],qs['fields'](_0x149c4b[_0xb398('0x4d')][_0xb398('0x52')]));_0x43e299[_0xb398('0x51')]=_0x43e299[_0xb398('0x51')]['length']?_0x43e299[_0xb398('0x51')]:_0x4e272b['model'];if(!_0x149c4b[_0xb398('0x4d')][_0xb398('0x79')](_0xb398('0x7a'))){_0x43e299['limit']=qs[_0xb398('0x29')](_0x149c4b[_0xb398('0x4d')][_0xb398('0x29')]);_0x43e299['offset']=qs[_0xb398('0x28')](_0x149c4b[_0xb398('0x4d')]['offset']);}_0x43e299[_0xb398('0x53')]=qs['sort'](_0x149c4b[_0xb398('0x4d')][_0xb398('0x54')]);_0x43e299[_0xb398('0x55')]=qs[_0xb398('0x4f')](_['pick'](_0x149c4b[_0xb398('0x4d')],_0x4e272b[_0xb398('0x4f')]));_0x43e299[_0xb398('0x55')][_0xb398('0x75')]=_0x3609f2['id'];if(_0x149c4b[_0xb398('0x4d')][_0xb398('0x59')]){_0x43e299['where']=_[_0xb398('0x57')](_0x43e299[_0xb398('0x55')],{'$or':_[_0xb398('0x4c')](_0x43e299['attributes'],function(_0x21451a){var _0x5c7cdc={};_0x5c7cdc[_0x21451a]={'$like':'%'+_0x149c4b[_0xb398('0x4d')]['filter']+'%'};return _0x5c7cdc;})});}_0x43e299=_[_0xb398('0x57')]({},_0x43e299,_0x149c4b['options']);return db[_0xb398('0xe9')][_0xb398('0x2a')]({'where':_0x43e299['where']})[_0xb398('0x1a')](function(_0x39485c){_0x332c16['count']=_0x39485c;if(_0x149c4b[_0xb398('0x4d')][_0xb398('0x5a')]){_0x43e299[_0xb398('0x5b')]=[{'all':!![]}];}else{_0x43e299['include']=[{'model':db[_0xb398('0xa7')],'as':_0xb398('0x105'),'required':![]},{'model':db['Attachment'],'as':_0xb398('0x134'),'required':![]}];}return db[_0xb398('0xe9')][_0xb398('0x5c')](_0x43e299);})[_0xb398('0x1a')](function(_0xe5cef6){_0x332c16['rows']=_0xe5cef6;return _0x332c16;});}})[_0xb398('0x1a')](respondWithFilteredResult(_0x2c6a57,_0x43e299))[_0xb398('0x5d')](handleError(_0x2c6a57,null));};exports['addAgents']=function(_0x3d18d,_0x29d122){return db[_0xb398('0x60')][_0xb398('0x63')]({'where':{'id':_0x3d18d[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x29d122,null))['then'](function(_0x3e6531){if(_0x3e6531){return _0x3e6531[_0xb398('0x135')](_0x3d18d[_0xb398('0x65')][_0xb398('0x103')],_[_0xb398('0x104')](_0x3d18d[_0xb398('0x65')],[_0xb398('0x103'),'id'])||{})[_0xb398('0x136')](function(_0x20fbec){for(var _0x3a9c9f=0x0;_0x3a9c9f<_0x3d18d[_0xb398('0x65')][_0xb398('0x103')][_0xb398('0x61')];_0x3a9c9f+=0x1){socket[_0xb398('0x137')]('userChatWebsite:save',{'UserId':Number(_0x3d18d['body'][_0xb398('0x103')][_0x3a9c9f]),'ChatWebsiteId':Number(_0x3d18d[_0xb398('0x72')]['id'])});}return _0x20fbec;});}})[_0xb398('0x1a')](respondWithResult(_0x29d122,null))['catch'](handleError(_0x29d122,null));};exports[_0xb398('0x138')]=function(_0x3417e4,_0x46e1dd){return db[_0xb398('0x60')]['find']({'where':{'id':_0x3417e4[_0xb398('0x72')]['id']}})[_0xb398('0x1a')](handleEntityNotFound(_0x46e1dd,null))[_0xb398('0x1a')](function(_0x4d3114){if(_0x4d3114){return _0x4d3114[_0xb398('0x138')](_0x3417e4[_0xb398('0x4d')][_0xb398('0x103')])[_0xb398('0x1a')](function(){if(_[_0xb398('0x139')](_0x3417e4[_0xb398('0x4d')]['ids'])){for(var _0x3fb664=0x0;_0x3fb664<_0x3417e4['query'][_0xb398('0x103')]['length'];_0x3fb664+=0x1){socket[_0xb398('0x137')](_0xb398('0x13a'),{'UserId':Number(_0x3417e4['query'][_0xb398('0x103')][_0x3fb664]),'ChatWebsiteId':Number(_0x3417e4[_0xb398('0x72')]['id'])});}}else{socket[_0xb398('0x137')](_0xb398('0x13a'),{'UserId':Number(_0x3417e4[_0xb398('0x4d')][_0xb398('0x103')]),'ChatWebsiteId':Number(_0x3417e4[_0xb398('0x72')]['id'])});}});}})[_0xb398('0x1a')](respondWithStatusCode(_0x46e1dd,null))[_0xb398('0x5d')](handleError(_0x46e1dd,null));};exports[_0xb398('0x13b')]=function(_0x175876,_0x507769){var _0xe82584={};var _0x1e533a={};var _0x445be1;var _0x3f48ed;return db[_0xb398('0x60')]['findOne']({'where':{'id':_0x175876['params']['id']}})['then'](handleEntityNotFound(_0x507769,null))[_0xb398('0x1a')](function(_0x28a35a){if(_0x28a35a){_0x445be1=_0x28a35a;_0x1e533a[_0xb398('0x42')]=_[_0xb398('0x4e')](db[_0xb398('0xcc')]['rawAttributes']);_0x1e533a['query']=_[_0xb398('0x4e')](_0x175876[_0xb398('0x4d')]);_0x1e533a[_0xb398('0x4f')]=_['intersection'](_0x1e533a[_0xb398('0x42')],_0x1e533a['query']);_0xe82584[_0xb398('0x51')]=_[_0xb398('0x50')](_0x1e533a[_0xb398('0x42')],qs['fields'](_0x175876['query'][_0xb398('0x52')]));_0xe82584[_0xb398('0x51')]=_0xe82584[_0xb398('0x51')][_0xb398('0x61')]?_0xe82584[_0xb398('0x51')]:_0x1e533a[_0xb398('0x42')];_0xe82584[_0xb398('0x53')]=qs[_0xb398('0x54')](_0x175876[_0xb398('0x4d')]['sort']);_0xe82584[_0xb398('0x55')]=qs['filters'](_[_0xb398('0x56')](_0x175876['query'],_0x1e533a[_0xb398('0x4f')]));if(_0x175876['query'][_0xb398('0x59')]){_0xe82584[_0xb398('0x55')]=_[_0xb398('0x57')](_0xe82584[_0xb398('0x55')],{'$or':_[_0xb398('0x4c')](_0xe82584[_0xb398('0x51')],function(_0x1b58f5){var _0x399818={};_0x399818[_0x1b58f5]={'$like':'%'+_0x175876[_0xb398('0x4d')]['filter']+'%'};return _0x399818;})});}_0xe82584=_[_0xb398('0x57')]({},_0xe82584,_0x175876['options']);return _0x445be1[_0xb398('0x13b')](_0xe82584);}})[_0xb398('0x1a')](function(_0x203002){if(_0x203002){_0x3f48ed=_0x203002[_0xb398('0x61')];if(!_0x175876['query']['hasOwnProperty'](_0xb398('0x7a'))){_0xe82584[_0xb398('0x29')]=qs['limit'](_0x175876[_0xb398('0x4d')][_0xb398('0x29')]);_0xe82584[_0xb398('0x28')]=qs[_0xb398('0x28')](_0x175876[_0xb398('0x4d')][_0xb398('0x28')]);}return _0x445be1['getAgents'](_0xe82584);}})[_0xb398('0x1a')](function(_0x4f613c){if(_0x4f613c){return _0x4f613c?{'count':_0x3f48ed,'rows':_0x4f613c}:null;}})[_0xb398('0x1a')](respondWithResult(_0x507769,null))[_0xb398('0x5d')](handleError(_0x507769,null));}; \ No newline at end of file +var _0x80f7=['updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','DESC','ChatApplication','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','Applications','priority','asc','list','List','Contacts','from','contact','headers','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','threadId','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','ChatQueue','queueId','startRouting','EventManager','offline','Sequelize','no\x20available\x20attributes','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','fromString','originalname','server','files','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','email','offlineMessageSubject','openNewInteraction','MailAccountId','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Intervals','getProactiveActions','../../config/license/util','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','origin','http://localhost:9000','remoteAddress','virtual','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','send','user-agent-parser','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','name','format','%s\x20%s','unknown','version','device','vendor','%s\x20%s\x20%s','model','type','stringify','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','Pause','length','create','body','split','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','address','forEach','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','getLicense','custom','join','root','server/files/images/logos/','download','getAvatar','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','timezone','ifTime','notify','chat','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0x80f7,0x91));var _0x780f=function(_0x450a0d,_0x21839f){_0x450a0d=_0x450a0d-0x0;var _0x41e651=_0x80f7[_0x450a0d];return _0x41e651;};'use strict';var Mustache=require('mustache');var util=require(_0x780f('0x0'));var path=require(_0x780f('0x1'));var ejs=require(_0x780f('0x2'));var fs=require('fs');var fs_extra=require(_0x780f('0x3'));var _=require(_0x780f('0x4'));var querystring=require(_0x780f('0x5'));var htmlToText=require(_0x780f('0x6'));var Redis=require(_0x780f('0x7'));var jayson=require(_0x780f('0x8'));var qs=require(_0x780f('0x9'));var logger=require(_0x780f('0xa'))('api');var config=require(_0x780f('0xb'));var APIBadRequestError=require(_0x780f('0xc'))[_0x780f('0xd')];var APINotFoundError=require(_0x780f('0xc'))[_0x780f('0xe')];var APIOutOfIntervalError=require(_0x780f('0xc'))[_0x780f('0xf')];var APIHandleError=require(_0x780f('0xc'))[_0x780f('0x10')];var APIConflictError=require(_0x780f('0xc'))[_0x780f('0x11')];var wildcardUtils=require(_0x780f('0x12'));var URL=require(_0x780f('0x13'))[_0x780f('0x14')];var db=require(_0x780f('0x15'))['db'];config[_0x780f('0x16')]=_[_0x780f('0x17')](config[_0x780f('0x16')],{'host':_0x780f('0x18'),'port':0x18eb});var socket=require(_0x780f('0x19'))(new Redis(config[_0x780f('0x16')]));require(_0x780f('0x1a'))[_0x780f('0x1b')](socket);var client=jayson[_0x780f('0x1c')][_0x780f('0x1d')]({'port':0x232c});var client9002=jayson[_0x780f('0x1c')][_0x780f('0x1d')]({'port':0x232a});var client9003=jayson[_0x780f('0x1c')][_0x780f('0x1d')]({'port':0x232b});var client9001=jayson['client'][_0x780f('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0x55662d,_0x40d59c,_0x47c428,_0x4ead40){return new Promise(function(_0x1747dc,_0x2cbf2a){var _0x1157b7=_0x4ead40||client;return _0x1157b7[_0x780f('0x1e')](_0x55662d,_0x47c428)[_0x780f('0x1f')](function(_0x4ea166){logger['info'](_0x780f('0x20'),_0x40d59c,_0x780f('0x21'));logger['debug'](_0x780f('0x22'),_0x40d59c,_0x780f('0x21'),JSON['stringify'](_0x4ea166));if(_0x4ea166[_0x780f('0x23')]){if(_0x4ea166['error'][_0x780f('0x24')]===0x1f4){logger[_0x780f('0x23')](_0x780f('0x20'),_0x40d59c,_0x4ea166[_0x780f('0x23')]['message']);return _0x2cbf2a(_0x4ea166['error'][_0x780f('0x25')]);}logger[_0x780f('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x40d59c,_0x4ea166['error'][_0x780f('0x25')]);return _0x1747dc(_0x4ea166['error'][_0x780f('0x25')]);}else{logger[_0x780f('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x40d59c,_0x780f('0x21'));_0x1747dc(_0x4ea166[_0x780f('0x27')][_0x780f('0x25')]);}})[_0x780f('0x28')](function(_0x249cce){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x40d59c,_0x249cce);_0x2cbf2a(_0x249cce);});});}function respondWithStatusCode(_0x55584c,_0x2d8f9e){_0x2d8f9e=_0x2d8f9e||0xcc;return function(_0x422f77){if(_0x422f77){return _0x55584c[_0x780f('0x29')](_0x2d8f9e);}return _0x55584c['status'](_0x2d8f9e)[_0x780f('0x2a')]();};}function respondWithResult(_0x25b332,_0x5b527a){_0x5b527a=_0x5b527a||0xc8;return function(_0x1aa703){if(_0x1aa703){return _0x25b332[_0x780f('0x2b')](_0x5b527a)[_0x780f('0x2c')](_0x1aa703);}};}function respondWithFilteredResult(_0x433938,_0x35e734){return function(_0x2db668){if(_0x2db668){var _0x2c9db2=typeof _0x35e734[_0x780f('0x2d')]==='undefined'&&typeof _0x35e734['limit']===_0x780f('0x2e');var _0x43f145=_0x2db668[_0x780f('0x2f')];var _0x1c5644=_0x2c9db2?0x0:_0x35e734['offset'];var _0x3c1675=_0x2c9db2?_0x2db668[_0x780f('0x2f')]:_0x35e734[_0x780f('0x2d')]+_0x35e734[_0x780f('0x30')];var _0x186c83;if(_0x3c1675>=_0x43f145){_0x3c1675=_0x43f145;_0x186c83=0xc8;}else{_0x186c83=0xce;}_0x433938[_0x780f('0x2b')](_0x186c83);return _0x433938[_0x780f('0x31')](_0x780f('0x32'),_0x1c5644+'-'+_0x3c1675+'/'+_0x43f145)[_0x780f('0x2c')](_0x2db668);}return null;};}function saveUpdates(_0x5ca7be){return function(_0x182e06){if(_0x182e06){return _0x182e06[_0x780f('0x33')](_0x5ca7be)[_0x780f('0x1f')](function(_0x37a164){return _0x37a164;});}return null;};}function removeEntity(_0x5d5366){return function(_0x47c6b3){if(_0x47c6b3){return _0x47c6b3[_0x780f('0x34')]()[_0x780f('0x1f')](function(){var _0x561b07=_0x47c6b3[_0x780f('0x35')]({'plain':!![]});var _0x7be426=_0x780f('0x36');return db[_0x780f('0x37')][_0x780f('0x34')]({'where':{'type':_0x7be426,'resourceId':_0x561b07['id']}})[_0x780f('0x1f')](function(){return _0x47c6b3;});})[_0x780f('0x1f')](function(){_0x5d5366[_0x780f('0x2b')](0xcc)[_0x780f('0x2a')]();});}};}function handleEntityNotFound(_0x7a1321){return function(_0x19403a){if(!_0x19403a){_0x7a1321[_0x780f('0x29')](0x194);}return _0x19403a;};}function handleError(_0x9a929a,_0x3b1242){_0x3b1242=_0x3b1242||0x1f4;return function(_0xe6185){logger[_0x780f('0x23')](_0xe6185['stack']);if(_0xe6185['name']){delete _0xe6185['name'];}_0x9a929a[_0x780f('0x2b')](_0x3b1242)[_0x780f('0x38')](_0xe6185);};}function createInteractionObject(_0x2c36a0,_0x274a6e,_0x35baaa,_0x1c0e63){var _0x5eda61=require(_0x780f('0x39'));var _0x43157d=new _0x5eda61();var _0x3502f6=_0x43157d['setUA'](_0x35baaa['user-agent'])[_0x780f('0x3a')]();var _0x4ad707=_0x274a6e[_0x780f('0x3b')];if(_0x35baaa['cf-connecting-ip']){_0x4ad707=_0x35baaa[_0x780f('0x3c')];}else if(_0x35baaa[_0x780f('0x3d')]){_0x4ad707=_[_0x780f('0x3e')](_0x35baaa[_0x780f('0x3d')]['split'](','));}return{'ContactId':_0x1c0e63['id'],'ChatWebsiteId':_0x2c36a0,'from':(_0x1c0e63[_0x780f('0x3f')]||'')+'\x20'+(_0x1c0e63[_0x780f('0x40')]||''),'customerIp':_0x4ad707,'customerPort':_0x35baaa[_0x780f('0x41')]?_0x35baaa[_0x780f('0x41')]:null,'referer':_0x274a6e[_0x780f('0x42')],'browserName':_0x3502f6[_0x780f('0x43')][_0x780f('0x44')]&&_0x3502f6[_0x780f('0x43')]['version']?util[_0x780f('0x45')](_0x780f('0x46'),_0x3502f6[_0x780f('0x43')][_0x780f('0x44')],_0x3502f6['browser']['version']):_0x780f('0x47'),'browserVersion':_0x3502f6[_0x780f('0x43')][_0x780f('0x48')]||_0x780f('0x47'),'osName':util[_0x780f('0x45')]('%s\x20%s',_0x3502f6['os']['name'],_0x3502f6['os'][_0x780f('0x48')]),'osVersion':_0x3502f6['os'][_0x780f('0x48')],'deviceModel':_0x3502f6[_0x780f('0x49')]['model']&&_0x3502f6[_0x780f('0x49')][_0x780f('0x4a')]?util[_0x780f('0x45')](_0x780f('0x4b'),_0x3502f6[_0x780f('0x49')][_0x780f('0x4c')],_0x3502f6[_0x780f('0x49')][_0x780f('0x4a')],_0x3502f6[_0x780f('0x49')]['type']):null,'deviceVendor':_0x3502f6[_0x780f('0x49')]['vendor'],'deviceType':_0x3502f6[_0x780f('0x49')][_0x780f('0x4d')],'formData':JSON[_0x780f('0x4e')](_0x274a6e)};}exports['index']=function(_0x217452,_0x57628c){var _0xc6e209={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5178ba={},_0x4427fd={'count':0x0,'rows':[]};var _0x5482c0=_[_0x780f('0x4f')](db[_0x780f('0x50')][_0x780f('0x51')],function(_0x373896){return{'name':_0x373896[_0x780f('0x52')],'type':_0x373896[_0x780f('0x4d')][_0x780f('0x53')]};});_0x5178ba[_0x780f('0x4c')]=_[_0x780f('0x4f')](_0x5482c0,_0x780f('0x44'));_0x5178ba[_0x780f('0x54')]=_[_0x780f('0x55')](_0x217452['query']);_0x5178ba['filters']=_[_0x780f('0x56')](_0x5178ba[_0x780f('0x4c')],_0x5178ba[_0x780f('0x54')]);_0xc6e209[_0x780f('0x57')]=_[_0x780f('0x56')](_0x5178ba[_0x780f('0x4c')],qs['fields'](_0x217452[_0x780f('0x54')][_0x780f('0x58')]));_0xc6e209[_0x780f('0x57')]=_0xc6e209[_0x780f('0x57')]['length']?_0xc6e209[_0x780f('0x57')]:_0x5178ba['model'];if(!_0x217452[_0x780f('0x54')]['hasOwnProperty'](_0x780f('0x59'))){_0xc6e209[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x217452['query'][_0x780f('0x30')]);_0xc6e209[_0x780f('0x2d')]=qs['offset'](_0x217452[_0x780f('0x54')][_0x780f('0x2d')]);}_0xc6e209['order']=qs[_0x780f('0x5a')](_0x217452['query'][_0x780f('0x5a')]);_0xc6e209[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x217452['query'],_0x5178ba[_0x780f('0x5c')]),_0x5482c0);if(_0x217452[_0x780f('0x54')]['filter']){_0xc6e209['where']=_[_0x780f('0x5e')](_0xc6e209[_0x780f('0x5b')],{'$or':_[_0x780f('0x4f')](_0x5482c0,function(_0x43dfd2){if(_0x43dfd2['type']!==_0x780f('0x5f')){var _0x22b61f={};_0x22b61f[_0x43dfd2[_0x780f('0x44')]]={'$like':'%'+_0x217452[_0x780f('0x54')][_0x780f('0x60')]+'%'};return _0x22b61f;}})});}_0xc6e209=_[_0x780f('0x5e')]({},_0xc6e209,_0x217452[_0x780f('0x61')]);var _0x4ca595={'where':_0xc6e209[_0x780f('0x5b')]};return db[_0x780f('0x50')]['count'](_0x4ca595)['then'](function(_0x555d60){_0x4427fd[_0x780f('0x2f')]=_0x555d60;if(_0x217452[_0x780f('0x54')][_0x780f('0x62')]){_0xc6e209[_0x780f('0x63')]=[{'all':!![]}];}return db[_0x780f('0x50')][_0x780f('0x64')](_0xc6e209);})[_0x780f('0x1f')](function(_0x4b1219){_0x4427fd[_0x780f('0x65')]=_0x4b1219;return _0x4427fd;})[_0x780f('0x1f')](respondWithFilteredResult(_0x57628c,_0xc6e209))[_0x780f('0x28')](handleError(_0x57628c,null));};exports[_0x780f('0x66')]=function(_0x1e10cd,_0x193cf5){var _0x1c87b7={'raw':![],'where':{'id':_0x1e10cd[_0x780f('0x67')]['id']},'include':[{'model':db[_0x780f('0x68')],'as':'mandatoryDispositionPause'}]},_0x31ff8a={};_0x31ff8a[_0x780f('0x4c')]=_['keys'](db[_0x780f('0x50')][_0x780f('0x51')]);_0x31ff8a[_0x780f('0x54')]=_[_0x780f('0x55')](_0x1e10cd[_0x780f('0x54')]);_0x31ff8a[_0x780f('0x5c')]=_['intersection'](_0x31ff8a[_0x780f('0x4c')],_0x31ff8a[_0x780f('0x54')]);_0x1c87b7[_0x780f('0x57')]=_[_0x780f('0x56')](_0x31ff8a[_0x780f('0x4c')],qs[_0x780f('0x58')](_0x1e10cd[_0x780f('0x54')][_0x780f('0x58')]));_0x1c87b7['attributes']=_0x1c87b7[_0x780f('0x57')][_0x780f('0x69')]?_0x1c87b7[_0x780f('0x57')]:_0x31ff8a[_0x780f('0x4c')];if(_0x1e10cd[_0x780f('0x54')][_0x780f('0x62')]){_0x1c87b7[_0x780f('0x63')]=[{'all':!![]}];}_0x1c87b7=_[_0x780f('0x5e')]({},_0x1c87b7,_0x1e10cd[_0x780f('0x61')]);return db[_0x780f('0x50')]['find'](_0x1c87b7)[_0x780f('0x1f')](handleEntityNotFound(_0x193cf5,null))[_0x780f('0x1f')](respondWithResult(_0x193cf5,null))[_0x780f('0x28')](handleError(_0x193cf5,null));};exports[_0x780f('0x6a')]=function(_0x3720b9,_0x161f3d){var _0x164d7f=null;_0x3720b9[_0x780f('0x6b')]['address'][_0x780f('0x6c')](',')['forEach'](_0x5251f2=>{if(_0x5251f2[_0x780f('0x6d')]()!==''&&!wildcardUtils[_0x780f('0x6e')](_0x5251f2[_0x780f('0x6d')]())){_0x164d7f=new APIBadRequestError('\x22'+_0x5251f2[_0x780f('0x6d')]()+_0x780f('0x6f'));}});if(_0x164d7f){return handleError(_0x161f3d,null)(_0x164d7f);}return db[_0x780f('0x50')][_0x780f('0x6a')](_0x3720b9[_0x780f('0x6b')],{})[_0x780f('0x1f')](function(_0x56a907){var _0x5a671f=_0x3720b9['user']['get']({'plain':!![]});if(!_0x5a671f)throw new Error(_0x780f('0x70'));if(_0x5a671f[_0x780f('0x71')]===_0x780f('0x72')){var _0x3474fe=_0x56a907[_0x780f('0x35')]({'plain':!![]});var _0x3e1ecf=_0x780f('0x36');return db['UserProfileSection'][_0x780f('0x73')]({'where':{'name':_0x3e1ecf,'userProfileId':_0x5a671f[_0x780f('0x74')]},'raw':!![]})[_0x780f('0x1f')](function(_0x39c77a){if(_0x39c77a&&_0x39c77a[_0x780f('0x75')]===0x0){return db['UserProfileResource'][_0x780f('0x6a')]({'name':_0x3474fe[_0x780f('0x44')],'resourceId':_0x3474fe['id'],'type':_0x39c77a[_0x780f('0x44')],'sectionId':_0x39c77a['id']},{})[_0x780f('0x1f')](function(){return _0x56a907;});}else{return _0x56a907;}})[_0x780f('0x28')](function(_0xdca7d4){logger[_0x780f('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdca7d4);throw _0xdca7d4;});}return _0x56a907;})[_0x780f('0x1f')](respondWithResult(_0x161f3d,0xc9))[_0x780f('0x28')](handleError(_0x161f3d,null));};exports[_0x780f('0x33')]=function(_0xf7864b,_0x2b396e){var _0x2856b2=null;_0xf7864b[_0x780f('0x6b')][_0x780f('0x76')][_0x780f('0x6c')](',')[_0x780f('0x77')](_0xc737bc=>{if(_0xc737bc[_0x780f('0x6d')]()!==''&&!wildcardUtils[_0x780f('0x6e')](_0xc737bc[_0x780f('0x6d')]())){_0x2856b2=new APIBadRequestError('\x22'+_0xc737bc['trim']()+_0x780f('0x6f'));}});if(_0x2856b2){return handleError(_0x2b396e,null)(_0x2856b2);}if(_0xf7864b[_0x780f('0x6b')]['id']){delete _0xf7864b['body']['id'];}return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0xf7864b[_0x780f('0x67')]['id']},'include':[{'model':db[_0x780f('0x68')],'as':_0x780f('0x78')}]})[_0x780f('0x1f')](handleEntityNotFound(_0x2b396e,null))['then'](saveUpdates(_0xf7864b[_0x780f('0x6b')],null))[_0x780f('0x1f')](respondWithResult(_0x2b396e,null))[_0x780f('0x28')](handleError(_0x2b396e,null));};exports[_0x780f('0x34')]=function(_0x2252b7,_0x154774){return db['ChatWebsite'][_0x780f('0x73')]({'where':{'id':_0x2252b7['params']['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x154774,null))[_0x780f('0x1f')](removeEntity(_0x154774,null))[_0x780f('0x28')](handleError(_0x154774,null));};exports[_0x780f('0x79')]=function(_0x55a4e9,_0x393fa1){return db[_0x780f('0x50')][_0x780f('0x79')]()[_0x780f('0x1f')](respondWithResult(_0x393fa1,null))[_0x780f('0x28')](handleError(_0x393fa1,null));};exports[_0x780f('0x7a')]=function(_0x76002a,_0x222fdf){if(_0x76002a[_0x780f('0x6b')]['id']){delete _0x76002a['body']['id'];}return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x76002a['params']['id']}})['then'](handleEntityNotFound(_0x222fdf,null))[_0x780f('0x1f')](function(_0x35835f){if(_0x35835f){_0x76002a['body'][_0x780f('0x7b')]=_0x35835f['id'];return db[_0x780f('0x7c')][_0x780f('0x6a')](_0x76002a[_0x780f('0x6b')]);}})[_0x780f('0x1f')](respondWithResult(_0x222fdf,null))[_0x780f('0x28')](handleError(_0x222fdf,null));};exports[_0x780f('0x7d')]=function(_0x48ba82,_0x378259){var _0xd01200={'raw':![],'where':{}};var _0x4a2d51={};var _0x6f3674={'count':0x0,'rows':[]};return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x48ba82[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x378259,null))[_0x780f('0x1f')](function(_0x5e0635){if(_0x5e0635){_0x4a2d51[_0x780f('0x4c')]=_[_0x780f('0x55')](db['Disposition']['rawAttributes']);_0x4a2d51[_0x780f('0x54')]=_['keys'](_0x48ba82[_0x780f('0x54')]);_0x4a2d51[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x4a2d51['model'],_0x4a2d51[_0x780f('0x54')]);_0xd01200['attributes']=_[_0x780f('0x56')](_0x4a2d51[_0x780f('0x4c')],qs[_0x780f('0x58')](_0x48ba82[_0x780f('0x54')][_0x780f('0x58')]));_0xd01200[_0x780f('0x57')]=_0xd01200['attributes'][_0x780f('0x69')]?_0xd01200[_0x780f('0x57')]:_0x4a2d51[_0x780f('0x4c')];if(!_0x48ba82[_0x780f('0x54')][_0x780f('0x7f')](_0x780f('0x59'))){_0xd01200['limit']=qs[_0x780f('0x30')](_0x48ba82[_0x780f('0x54')]['limit']);_0xd01200[_0x780f('0x2d')]=qs[_0x780f('0x2d')](_0x48ba82['query'][_0x780f('0x2d')]);}_0xd01200[_0x780f('0x80')]=qs['sort'](_0x48ba82[_0x780f('0x54')][_0x780f('0x5a')]);_0xd01200[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x48ba82[_0x780f('0x54')],_0x4a2d51['filters']));_0xd01200[_0x780f('0x5b')][_0x780f('0x7b')]=_0x5e0635['id'];if(_0x48ba82[_0x780f('0x54')][_0x780f('0x60')]){_0xd01200[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0xd01200['where'],{'$or':_[_0x780f('0x4f')](_0xd01200['attributes'],function(_0x2235ab){var _0x274bb1={};_0x274bb1[_0x2235ab]={'$like':'%'+_0x48ba82[_0x780f('0x54')]['filter']+'%'};return _0x274bb1;})});}_0xd01200=_[_0x780f('0x5e')]({},_0xd01200,_0x48ba82[_0x780f('0x61')]);return db[_0x780f('0x7c')][_0x780f('0x2f')]({'where':_0xd01200[_0x780f('0x5b')]})[_0x780f('0x1f')](function(_0x21830e){_0x6f3674[_0x780f('0x2f')]=_0x21830e;if(_0x48ba82[_0x780f('0x54')][_0x780f('0x62')]){_0xd01200[_0x780f('0x63')]=[{'all':!![]}];}return db[_0x780f('0x7c')][_0x780f('0x64')](_0xd01200);})[_0x780f('0x1f')](function(_0x48a70c){_0x6f3674['rows']=_0x48a70c;return _0x6f3674;});}})[_0x780f('0x1f')](respondWithFilteredResult(_0x378259,_0xd01200))[_0x780f('0x28')](handleError(_0x378259,null));};exports[_0x780f('0x81')]=function(_0x52b01c,_0x1b9265){return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x52b01c[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x1b9265,null))[_0x780f('0x1f')](function(_0x1a4488){if(_0x1a4488){return _0x1a4488['removeDispositions'](_0x52b01c[_0x780f('0x54')]['ids']);}})[_0x780f('0x1f')](respondWithStatusCode(_0x1b9265,null))['catch'](handleError(_0x1b9265,null));};exports[_0x780f('0x82')]=function(_0x4f78fb,_0x51129c){if(_0x4f78fb[_0x780f('0x6b')]['id']){delete _0x4f78fb['body']['id'];}return db['ChatWebsite'][_0x780f('0x73')]({'where':{'id':_0x4f78fb[_0x780f('0x67')]['id']}})['then'](handleEntityNotFound(_0x51129c,null))[_0x780f('0x1f')](function(_0x5a0d26){if(_0x5a0d26){_0x4f78fb[_0x780f('0x6b')][_0x780f('0x7b')]=_0x5a0d26['id'];return db[_0x780f('0x83')][_0x780f('0x6a')](_0x4f78fb[_0x780f('0x6b')]);}})['then'](respondWithResult(_0x51129c,null))['catch'](handleError(_0x51129c,null));};exports[_0x780f('0x84')]=function(_0x3a339a,_0x3f138f){var _0x3a5df0={'raw':![],'where':{}};var _0x599ceb={};var _0x3dc348={'count':0x0,'rows':[]};return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x3a339a[_0x780f('0x67')]['id']}})['then'](handleEntityNotFound(_0x3f138f,null))[_0x780f('0x1f')](function(_0x1da8d7){if(_0x1da8d7){_0x599ceb[_0x780f('0x4c')]=_[_0x780f('0x55')](db[_0x780f('0x83')]['rawAttributes']);_0x599ceb[_0x780f('0x54')]=_[_0x780f('0x55')](_0x3a339a['query']);_0x599ceb['filters']=_[_0x780f('0x56')](_0x599ceb[_0x780f('0x4c')],_0x599ceb[_0x780f('0x54')]);_0x3a5df0[_0x780f('0x57')]=_[_0x780f('0x56')](_0x599ceb['model'],qs[_0x780f('0x58')](_0x3a339a[_0x780f('0x54')][_0x780f('0x58')]));_0x3a5df0[_0x780f('0x57')]=_0x3a5df0[_0x780f('0x57')]['length']?_0x3a5df0[_0x780f('0x57')]:_0x599ceb[_0x780f('0x4c')];if(!_0x3a339a['query'][_0x780f('0x7f')](_0x780f('0x59'))){_0x3a5df0[_0x780f('0x30')]=qs['limit'](_0x3a339a[_0x780f('0x54')][_0x780f('0x30')]);_0x3a5df0['offset']=qs['offset'](_0x3a339a[_0x780f('0x54')][_0x780f('0x2d')]);}_0x3a5df0[_0x780f('0x80')]=qs['sort'](_0x3a339a[_0x780f('0x54')]['sort']);_0x3a5df0[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x3a339a[_0x780f('0x54')],_0x599ceb[_0x780f('0x5c')]));_0x3a5df0['where'][_0x780f('0x7b')]=_0x1da8d7['id'];if(_0x3a339a[_0x780f('0x54')][_0x780f('0x60')]){_0x3a5df0[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x3a5df0[_0x780f('0x5b')],{'$or':_[_0x780f('0x4f')](_0x3a5df0['attributes'],function(_0x5408e0){var _0x3ebcde={};_0x3ebcde[_0x5408e0]={'$like':'%'+_0x3a339a[_0x780f('0x54')]['filter']+'%'};return _0x3ebcde;})});}_0x3a5df0=_[_0x780f('0x5e')]({},_0x3a5df0,_0x3a339a[_0x780f('0x61')]);return db[_0x780f('0x83')][_0x780f('0x2f')]({'where':_0x3a5df0[_0x780f('0x5b')]})[_0x780f('0x1f')](function(_0x4f240a){_0x3dc348[_0x780f('0x2f')]=_0x4f240a;if(_0x3a339a['query'][_0x780f('0x62')]){_0x3a5df0[_0x780f('0x63')]=[{'all':!![]}];}return db[_0x780f('0x83')][_0x780f('0x64')](_0x3a5df0);})[_0x780f('0x1f')](function(_0x19c1a2){_0x3dc348[_0x780f('0x65')]=_0x19c1a2;return _0x3dc348;});}})[_0x780f('0x1f')](respondWithFilteredResult(_0x3f138f,_0x3a5df0))['catch'](handleError(_0x3f138f,null));};exports[_0x780f('0x85')]=function(_0x1d3fe8,_0x1f8bda){return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x1d3fe8[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x1f8bda,null))['then'](function(_0x2a9e94){if(_0x2a9e94){return _0x2a9e94[_0x780f('0x85')](_0x1d3fe8[_0x780f('0x54')]['ids']);}})[_0x780f('0x1f')](respondWithStatusCode(_0x1f8bda,null))[_0x780f('0x28')](handleError(_0x1f8bda,null));};exports['addLogo']=function(_0x24fc44,_0xba803b){_0x24fc44[_0x780f('0x6b')][_0x780f('0x86')]=_0x24fc44['file'][_0x780f('0x87')];return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x24fc44[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0xba803b,null))[_0x780f('0x1f')](saveUpdates(_0x24fc44['body'],null))[_0x780f('0x1f')](respondWithResult(_0xba803b,null))['catch'](handleError(_0xba803b,null));};exports['addAvatar']=function(_0x3d7059,_0x42c5b1){_0x3d7059[_0x780f('0x6b')][_0x780f('0x88')]=_0x3d7059[_0x780f('0x89')][_0x780f('0x87')];return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x3d7059['params']['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x42c5b1,null))['then'](saveUpdates(_0x3d7059[_0x780f('0x6b')],null))[_0x780f('0x1f')](respondWithResult(_0x42c5b1,null))[_0x780f('0x28')](handleError(_0x42c5b1,null));};exports[_0x780f('0x8a')]=function(_0x1b98d2,_0x6bd54b){_0x1b98d2[_0x780f('0x6b')][_0x780f('0x8b')]=_0x1b98d2['file'][_0x780f('0x87')];return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x1b98d2[_0x780f('0x67')]['id']}})['then'](handleEntityNotFound(_0x6bd54b,null))['then'](saveUpdates(_0x1b98d2[_0x780f('0x6b')],null))[_0x780f('0x1f')](respondWithResult(_0x6bd54b,null))['catch'](handleError(_0x6bd54b,null));};exports[_0x780f('0x8c')]=function(_0x21e048,_0x66123a){_0x21e048[_0x780f('0x6b')][_0x780f('0x8d')]=_0x21e048['file'][_0x780f('0x87')];return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x21e048[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x66123a,null))[_0x780f('0x1f')](saveUpdates(_0x21e048[_0x780f('0x6b')],null))[_0x780f('0x1f')](respondWithResult(_0x66123a,null))[_0x780f('0x28')](handleError(_0x66123a,null));};exports[_0x780f('0x8e')]=function(_0x445fb2,_0x3ace87){var _0x43aff9=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x274952={'where':{'id':_0x445fb2['params']['id']},'attributes':['id',_0x780f('0x86')],'raw':!![]};var _0x4f7543=![];return require('../../config/license/util')[_0x780f('0x8f')]()[_0x780f('0x1f')](function(_0x3eb08d){if(_0x3eb08d){_0x4f7543=_0x3eb08d[_0x780f('0x90')];}})['then'](function(){return db['ChatWebsite'][_0x780f('0x73')](_0x274952);})[_0x780f('0x1f')](handleEntityNotFound(_0x3ace87,null))[_0x780f('0x1f')](function(_0x5dbdb9){if(_0x5dbdb9){if(!_['isNil'](_0x5dbdb9[_0x780f('0x86')])){if(fs['existsSync'](path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x93'),_0x5dbdb9[_0x780f('0x86')]))&&_0x4f7543){_0x43aff9=path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x93'),_0x5dbdb9[_0x780f('0x86')]);}}return _0x3ace87[_0x780f('0x94')](_0x43aff9);}})['catch'](handleError(_0x3ace87,null));};exports[_0x780f('0x95')]=function(_0x9da09e,_0x56031a){var _0x52788c=path[_0x780f('0x91')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x261367={'where':{'id':_0x9da09e[_0x780f('0x67')]['id']},'attributes':['id',_0x780f('0x88')],'raw':!![]};return db[_0x780f('0x50')][_0x780f('0x73')](_0x261367)[_0x780f('0x1f')](handleEntityNotFound(_0x56031a,null))[_0x780f('0x1f')](function(_0x285ebc){if(_0x285ebc){if(!_[_0x780f('0x96')](_0x285ebc[_0x780f('0x88')])){if(fs[_0x780f('0x97')](path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x98'),_0x285ebc[_0x780f('0x88')]))){_0x52788c=path[_0x780f('0x91')](config[_0x780f('0x92')],'server/files/images/avatars/',_0x285ebc[_0x780f('0x88')]);}}return _0x56031a[_0x780f('0x94')](_0x52788c);}})[_0x780f('0x28')](handleError(_0x56031a,null));};exports[_0x780f('0x99')]=function(_0x58e73d,_0x152e79){var _0x2d4ef5=path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x9a'));var _0x4c9cd5={'where':{'id':_0x58e73d['params']['id']},'attributes':['id',_0x780f('0x8b'),'showCustomerAvatar'],'raw':!![]};return db[_0x780f('0x50')][_0x780f('0x73')](_0x4c9cd5)['then'](handleEntityNotFound(_0x152e79,null))[_0x780f('0x1f')](function(_0x231ae9){if(_0x231ae9){if(!_['isNil'](_0x231ae9[_0x780f('0x8b')])){if(fs['existsSync'](path['join'](config['root'],_0x780f('0x98'),_0x231ae9[_0x780f('0x8b')]))&&_0x231ae9[_0x780f('0x9b')]){_0x2d4ef5=path['join'](config[_0x780f('0x92')],'server/files/images/avatars/',_0x231ae9[_0x780f('0x8b')]);}}return _0x152e79[_0x780f('0x94')](_0x2d4ef5);}})['catch'](handleError(_0x152e79,null));};exports[_0x780f('0x9c')]=function(_0x4a503a,_0x45b0f4){var _0x25164e=path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x9d'));var _0x49a59f={'where':{'id':_0x4a503a[_0x780f('0x67')]['id']},'attributes':['id',_0x780f('0x8d')],'raw':!![]};return db[_0x780f('0x50')][_0x780f('0x73')](_0x49a59f)[_0x780f('0x1f')](handleEntityNotFound(_0x45b0f4,null))[_0x780f('0x1f')](function(_0x35afac){if(_0x35afac){if(!_[_0x780f('0x96')](_0x35afac[_0x780f('0x8d')])){if(fs[_0x780f('0x97')](path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x98'),_0x35afac[_0x780f('0x8d')]))){_0x25164e=path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x98'),_0x35afac['systemAvatar']);}}return _0x45b0f4[_0x780f('0x94')](_0x25164e);}})[_0x780f('0x28')](handleError(_0x45b0f4,null));};function checkWebsiteInterval(_0x332c3e){var _0x9a91a=_0x332c3e[_0x780f('0x9e')];if(!_0x9a91a){return Promise['resolve'](_0x332c3e);}var _0x33829a=_0x332c3e[_0x780f('0x9f')]||undefined;return _0x9a91a[_0x780f('0xa0')](_0x33829a)['then'](function(_0x17403e){if(!_0x17403e){throw new APIOutOfIntervalError();}return _0x332c3e;});}exports[_0x780f('0xa1')]=function(_0x451045,_0x233235){var _0x5cdbd0={'body':_0x451045[_0x780f('0x6b')],'channel':_0x780f('0xa2')};var _0x4d8fbc=[];var _0x4ee7b0=[];var _0x1bf1f4={};var _0x45adcb=![];if(_0x451045[_0x780f('0x6b')]['id']){delete _0x451045['body']['id'];}if(_[_0x780f('0x96')](_0x451045[_0x780f('0x6b')]['from'])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x780f('0x96')](_0x451045['body'][_0x780f('0xa3')])){throw new APIBadRequestError(_0x780f('0xa4'));}if(_[_0x780f('0xa5')](_0x451045['body'][_0x780f('0x6b')])){throw new APIBadRequestError(_0x780f('0xa6'));}var _0x371b1c=_0x451045[_0x780f('0x6b')][_0x780f('0x3b')]&&_0x451045[_0x780f('0x6b')][_0x780f('0x42')];return db[_0x780f('0xa7')][_0x780f('0x79')]()['then'](function(_0x106c84){if(!_0x106c84){throw new Error('No\x20available\x20attributes');}_0x4d8fbc=Object[_0x780f('0x55')](_0x106c84)[_0x780f('0x60')](function(_0xae9756){return![_0x780f('0xa8'),_0x780f('0xa9')][_0x780f('0xaa')](_0xae9756);});_0x4ee7b0=Object[_0x780f('0x55')](_0x106c84)[_0x780f('0x60')](function(_0x54ef17){return!['createdAt',_0x780f('0xa9'),_0x780f('0xab'),_0x780f('0xac')][_0x780f('0xaa')](_0x54ef17);});if(!_[_0x780f('0xaa')](_0x4ee7b0,_0x451045[_0x780f('0x6b')]['mapKey'])){throw new APIBadRequestError(_0x780f('0xad')+_0x4ee7b0[_0x780f('0x91')](',\x20'));}_0x1bf1f4[_0x451045['body'][_0x780f('0xa3')]]=_0x451045[_0x780f('0x6b')]['from'];})[_0x780f('0x1f')](function(){return db[_0x780f('0x50')]['find']({'where':{'id':_0x451045[_0x780f('0x67')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1bf1f4,'limit':0x1,'order':[['updatedAt',_0x780f('0xae')]]}]},{'model':db[_0x780f('0xaf')],'as':'Applications'},{'model':db[_0x780f('0x9e')],'as':'Interval','include':[{'model':db[_0x780f('0x9e')],'as':'Intervals','attributes':['id',_0x780f('0xb0')],'raw':!![]}]}]});})[_0x780f('0x1f')](function(_0x4a473b){if(!_0x4a473b){throw new APINotFoundError(util[_0x780f('0x45')](_0x780f('0xb1'),_0x451045[_0x780f('0x67')]['id']));}if(_0x371b1c){return checkWebsiteInterval(_0x4a473b);}return _0x4a473b;})['then'](function(_0x45fca1){_0x5cdbd0[_0x780f('0xb2')]=_0x45fca1;_0x5cdbd0[_0x780f('0xb3')]=_['orderBy'](_0x45fca1[_0x780f('0xb4')],[_0x780f('0xb5')],[_0x780f('0xb6')]);if(_0x5cdbd0[_0x780f('0xb2')][_0x780f('0xb4')]){delete _0x5cdbd0['account'][_0x780f('0xb4')];}_0x5cdbd0[_0x780f('0xb7')]=_0x45fca1[_0x780f('0xb8')]||{'id':_0x45fca1[_0x780f('0xac')]};if(_0x5cdbd0[_0x780f('0xb7')]&&_0x5cdbd0[_0x780f('0xb7')]['Contacts'][_0x780f('0x69')]){return _0x5cdbd0[_0x780f('0xb7')][_0x780f('0xb9')][0x0];}var _0x27f8bb=_[_0x780f('0x17')](_0x451045[_0x780f('0x6b')],{'firstName':_0x451045[_0x780f('0x6b')][_0x780f('0xba')],'ListId':_0x45fca1[_0x780f('0xac')]});_0x27f8bb[_0x451045[_0x780f('0x6b')][_0x780f('0xa3')]]=_0x451045[_0x780f('0x6b')][_0x780f('0xba')];return db['CmContact'][_0x780f('0x6a')](_0x27f8bb,{'fields':_0x4d8fbc,'raw':!![]});})[_0x780f('0x1f')](function(_0x2d1133){_0x5cdbd0[_0x780f('0xbb')]=_0x2d1133;var _0x5a3e80=createInteractionObject(_0x451045[_0x780f('0x67')]['id'],_0x451045['body'],_0x451045[_0x780f('0xbc')],_0x2d1133);var _0x19fba6={'ChatWebsiteId':_0x451045[_0x780f('0x67')]['id']};if(_0x451045[_0x780f('0x6b')]['threadId']){_0x19fba6['threadId']=_0x451045['body']['threadId'];_0x19fba6[_0x780f('0xbd')]=![];return db[_0x780f('0xbe')]['find']({'where':_0x19fba6})[_0x780f('0x1f')](function(_0x3ad050){var _0x3820e1=_0x451045['body'][_0x780f('0x3b')]&&_0x451045['body'][_0x780f('0x42')];if(_0x3ad050){_0x45adcb=!![];return _0x3ad050;}else if(!_0x3820e1&&_0x3ad050&&_0x3ad050[_0x780f('0xbd')]){throw new APIConflictError(_0x780f('0xbf'));}_0x5a3e80[_0x780f('0xc0')]=_0x451045[_0x780f('0x6b')][_0x780f('0xc0')];_0x5a3e80['externalUrl']=_0x451045[_0x780f('0x6b')]['externalUrl'];return db['ChatInteraction'][_0x780f('0x6a')](_0x5a3e80);});}_0x19fba6[_0x780f('0xc1')]=_0x2d1133['id'];if(_0x451045[_0x780f('0x6b')]['interaction']&&_0x451045[_0x780f('0x6b')][_0x780f('0xc2')]['id']){_0x19fba6['id']=_0x451045[_0x780f('0x6b')][_0x780f('0xc2')]['id'];return db['ChatInteraction'][_0x780f('0x73')]({'where':_0x19fba6})['then'](function(_0x4b5856){var _0xd3fc9a=_0x451045['body']['customerIp']&&_0x451045[_0x780f('0x6b')][_0x780f('0x42')];if(!_0xd3fc9a&&_0x4b5856&&_0x4b5856[_0x780f('0xbd')]){throw new APIConflictError(_0x780f('0xbf'));}else if(_0x4b5856){_0x45adcb=!![];return _0x4b5856;}else{return db['ChatInteraction']['create'](_0x5a3e80);}});}return db[_0x780f('0xbe')]['create'](_0x5a3e80);})[_0x780f('0x1f')](function(_0x4b1292){if(!_0x45adcb){return _0x4b1292;}var _0x698e2b={'from':(_0x5cdbd0[_0x780f('0xbb')]['firstName']||'')+'\x20'+(_0x5cdbd0[_0x780f('0xbb')]['lastName']||'')};if(_0x451045[_0x780f('0x6b')]['threadId']&&_0x451045[_0x780f('0x6b')][_0x780f('0xc3')]&&_0x451045['body'][_0x780f('0xc0')]!=_0x451045[_0x780f('0x6b')]['messageId']){_0x698e2b[_0x780f('0xc0')]=_0x451045[_0x780f('0x6b')]['messageId'];}return _0x4b1292[_0x780f('0x33')](_0x698e2b);})[_0x780f('0x1f')](function(_0x21a67f){_0x5cdbd0[_0x780f('0xc2')]=_0x21a67f[_0x780f('0x35')]({'plain':!![]});_0x5cdbd0[_0x780f('0xc2')][_0x780f('0xc4')]=!_0x45adcb;if(_0x5cdbd0[_0x780f('0xc2')][_0x780f('0xc4')]){if(_0x5cdbd0['account'][_0x780f('0xc5')]){_0x5cdbd0['applications'][_0x780f('0xc6')]({'id':0x0,'priority':_0x5cdbd0['applications'][_0x780f('0x69')]+0x1,'app':_0x780f('0xc7'),'appdata':_0x780f('0xc8'),'interval':_0x780f('0xc9')});}}return db[_0x780f('0xca')]['create']({'body':_0x451045[_0x780f('0x6b')][_0x780f('0x6b')],'ChatWebsiteId':_0x451045[_0x780f('0x67')]['id'],'ChatInteractionId':_0x21a67f['id'],'direction':'in','ContactId':_0x5cdbd0['contact']['id'],'AttachmentId':_0x451045[_0x780f('0x6b')][_0x780f('0xcb')]});})['then'](function(_0x1802f5){_0x5cdbd0[_0x780f('0x25')]=_0x1802f5;if(!_0x5cdbd0['interaction'][_0x780f('0xcc')]){return;}return db[_0x780f('0xcd')]['find']({'attributes':['id','name'],'where':{'id':_0x5cdbd0[_0x780f('0xc2')][_0x780f('0xcc')]}});})[_0x780f('0x1f')](function(_0x4e3dcb){if(_0x4e3dcb){_0x5cdbd0['applications'][_0x780f('0xce')]({'id':0x0,'priority':0x0,'app':_0x780f('0xcf'),'appdata':_0x4e3dcb['name']+','+(_0x5cdbd0['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x5cdbd0[_0x780f('0xd0')]=!![];}if(!_0x5cdbd0['interaction']['queueId']){return;}return db[_0x780f('0xd1')]['find']({'attributes':['id',_0x780f('0x44')],'where':{'id':_0x5cdbd0[_0x780f('0xc2')][_0x780f('0xd2')]}});})[_0x780f('0x1f')](function(_0x216504){if(_0x216504){_0x5cdbd0[_0x780f('0xb3')][_0x780f('0xce')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x216504[_0x780f('0x44')]+','+(_0x5cdbd0[_0x780f('0xb2')]['waitForTheAssignedQueue']||0x12c),'interval':_0x780f('0xc9')});}return respondWithRpcPromise('Start',_0x780f('0xd3'),_0x5cdbd0);})[_0x780f('0x1f')](function(_0x3d18c0){respondWithRpcPromise(_0x780f('0xd4'),'EventManager',{'event':_0x780f('0xa1'),'message':_0x3d18c0},client9002);return _0x3d18c0;})[_0x780f('0x1f')](respondWithResult(_0x233235,null))[_0x780f('0x28')](APIHandleError(_0x233235));};exports[_0x780f('0xd5')]=function(_0x2763c1,_0x46da4e){var _0x4a7be9,_0x38de46,_0x8edbd4;var _0x105f4b=[];var _0x27ef9d={};var _0xae0745=_0x2763c1['files']||[];var _0x537c93=[];var _0x563b6f;return db[_0x780f('0xa7')][_0x780f('0x79')]()[_0x780f('0x1f')](function(_0x2909b8){if(!_0x2909b8){throw new db[(_0x780f('0xd6'))]['ValidationError'](_0x780f('0xd7'));}_0x105f4b=_['difference'](_[_0x780f('0x55')](_0x2909b8),['createdAt',_0x780f('0xa9'),_0x780f('0xab'),_0x780f('0xac')]);if(_0x2763c1['body']['id']){delete _0x2763c1[_0x780f('0x6b')]['id'];}if(_[_0x780f('0x96')](_0x2763c1[_0x780f('0x6b')][_0x780f('0xba')])){throw _0x46da4e[_0x780f('0x2b')](0x1f4)['send'](new db[(_0x780f('0xd6'))][(_0x780f('0xd8'))](_0x780f('0xd9')));}if(_[_0x780f('0x96')](_0x2763c1[_0x780f('0x6b')][_0x780f('0x6b')])||_0x2763c1[_0x780f('0x6b')][_0x780f('0x6b')]===''){throw _0x46da4e[_0x780f('0x2b')](0x1f4)['send'](new db[(_0x780f('0xd6'))]['ValidationError'](_0x780f('0xda')));}if(_[_0x780f('0x96')](_0x2763c1[_0x780f('0x6b')][_0x780f('0xdb')])){throw _0x46da4e[_0x780f('0x2b')](0x1f4)['send'](new db[(_0x780f('0xd6'))]['ValidationError'](_0x780f('0xdc')+_0x105f4b));}if(!_[_0x780f('0xaa')](_0x105f4b,_0x2763c1[_0x780f('0x6b')][_0x780f('0xdb')])){throw _0x46da4e[_0x780f('0x2b')](0x1f4)[_0x780f('0x38')](new db[(_0x780f('0xd6'))][(_0x780f('0xd8'))](_0x780f('0xdd')+_0x105f4b));}_0x27ef9d[_0x2763c1[_0x780f('0x6b')][_0x780f('0xdb')]]=_0x2763c1[_0x780f('0x6b')]['from'];})[_0x780f('0x1f')](function(){return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x2763c1[_0x780f('0x67')]['id']},'include':[{'model':db[_0x780f('0xde')],'as':_0x780f('0xb8')},{'model':db['MailAccount'],'as':_0x780f('0xdf')}]});})[_0x780f('0x1f')](handleEntityNotFound(_0x46da4e,null))[_0x780f('0x1f')](function(_0x2d358a){if(_0x2d358a&&_0x2d358a['List']){_0x38de46=_0x2d358a;var _0x16adee=_[_0x780f('0x17')](_0x2763c1[_0x780f('0x6b')],{'firstName':_0x2763c1[_0x780f('0x6b')][_0x780f('0xba')],'phone':_0x2763c1[_0x780f('0x6b')][_0x780f('0xba')],'ListId':_0x2d358a['ListId']});_0x16adee[_0x2763c1[_0x780f('0x6b')][_0x780f('0xdb')]]=_0x2763c1[_0x780f('0x6b')]['from'];return db['CmContact'][_0x780f('0xe0')]({'where':_0x27ef9d,'defaults':_0x16adee});}})[_0x780f('0xe1')](function(_0x3d9df1){if(_0x3d9df1){_0x8edbd4=_0x3d9df1;var _0x370f5f=fs[_0x780f('0xe2')](path['join'](config['root'],_0x780f('0xe3')),'utf8');var _0x3d196f=ejs[_0x780f('0xe4')](_0x370f5f,{'body':_[_0x780f('0xe5')](_0x2763c1[_0x780f('0x6b')][_0x780f('0x6b')]),'bodyTitle':_0x38de46[_0x780f('0xe6')]});return db['ChatOfflineMessage'][_0x780f('0x6a')]({'body':_0x3d196f,'plainBody':htmlToText[_0x780f('0xe7')](_0x3d196f),'ContactId':_0x3d9df1['id'],'ChatWebsiteId':_0x38de46['id']});}})['then'](function(_0x511f2b){_0x563b6f=_0x511f2b;if(_0xae0745[_0x780f('0x69')]){var _0x2c5514=_0xae0745[_0x780f('0x4f')](function(_0xa889ce){return{'name':_0xa889ce[_0x780f('0xe8')],'basename':_0xa889ce['filename'],'type':_0xa889ce['mimetype'],'ChatOfflineMessageId':_0x511f2b['id']};});_0x537c93=_0x2c5514['map'](_0x41ec61=>{var _0x9bcf9d={'filename':_0x41ec61['name'],'path':path['join'](config[_0x780f('0x92')],_0x780f('0xe9'),_0x780f('0xea'),_0x780f('0xeb'),_0x780f('0xec'),_0x41ec61[_0x780f('0xed')])};return _0x9bcf9d;});if(!_0x38de46['openNewInteraction']){return db[_0x780f('0xee')][_0x780f('0xef')](function(_0x23bc2e){return db[_0x780f('0xf0')][_0x780f('0xf1')](_0x2c5514,{'transaction':_0x23bc2e});});}}})[_0x780f('0x1f')](function(){if(_0x563b6f){_0x4a7be9=_0x563b6f;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x780f('0xf2')],'as':_0x780f('0xf3'),'raw':!![],'include':[{'model':db[_0x780f('0xf4')],'as':_0x780f('0xf4'),'raw':!![]}]}]});}})[_0x780f('0x1f')](function(_0x3e7ceb){if(_0x3e7ceb&&_0x3e7ceb[_0x780f('0xf3')]&&_0x38de46[_0x780f('0xf5')]&&_0x38de46[_0x780f('0xf6')]){var _0x99f8fe=_0x3e7ceb['getSmtpOptions']();return respondWithRpcPromise(_0x780f('0xf7'),'sendMail',{'account':_0x99f8fe,'message':{'from':util[_0x780f('0x45')]('\x22%s\x22\x20<%s>',_0x3e7ceb[_0x780f('0x44')],_0x3e7ceb[_0x780f('0xf8')]||_0x3e7ceb[_0x780f('0xf3')][_0x780f('0x72')]),'to':_0x38de46['forwardOfflineAddress'],'subject':_0x38de46[_0x780f('0xf9')],'html':_0x4a7be9[_0x780f('0x6b')],'attachments':_0x537c93}},client9003)[_0x780f('0x1f')](function(){return _0x4a7be9;})[_0x780f('0x28')](function(_0x24aef2){logger[_0x780f('0x23')](_0x24aef2);});}})['then'](function(){if(_0x38de46&&_0x38de46[_0x780f('0xfa')]&&_0x38de46[_0x780f('0xfb')]){var _0x55a8dc=[];if(_0xae0745[_0x780f('0x69')]){_0x55a8dc=_0xae0745[_0x780f('0x4f')](function(_0x28bf7d){return{'name':_0x28bf7d['originalname'],'basename':_0x28bf7d[_0x780f('0x87')],'type':_0x28bf7d['mimetype'],'ChatOfflineMessageId':_0x563b6f['id']};});}var _0x11371e;if(!_[_0x780f('0x96')](_0x38de46['subjectOffline'])){var _0x2b443b=_['map'](_0x2763c1['body'],function(_0x4704e8){return _0x4704e8;});var _0x1539e9=_[_0x780f('0xfc')](_0x2b443b)[0x0];var _0x43546f=_[_0x780f('0xfd')](_0x1539e9,function(_0x519f1a){return _0x519f1a;});_0x11371e=_0x43546f[0x1][_0x38de46['subjectOffline']];}var _0x1035fb={'from':_0x8edbd4[_0x780f('0xf8')],'firstName':_0x8edbd4[_0x780f('0x3f')],'lastName':_0x8edbd4[_0x780f('0x40')],'mapKey':_0x780f('0xf8'),'message':{'from':_0x8edbd4[_0x780f('0xf8')],'to':_0x38de46[_0x780f('0xdf')][_0x780f('0xf8')],'cc':'','subject':_[_0x780f('0x96')](_0x11371e)?_0x38de46['offlineMessageSubject']:_0x11371e,'messageId':'','sentAt':new Date(),'attach':_0x55a8dc[_0x780f('0x69')],'attachments':_0x55a8dc,'originChannel':_0x780f('0xfe'),'ChatWebsiteId':_0x38de46['id'],'ChatOfflineMessageId':_0x4a7be9['id'],'originTo':_0x38de46['MailAccount']['email']},'body':_0x4a7be9[_0x780f('0x6b')]};var _0x2a9541={'account':{'id':_0x38de46[_0x780f('0xfb')]},'body':_0x1035fb,'log':_0x780f('0xff')};return respondWithRpcPromise(_0x780f('0xff'),_0x780f('0x100'),_0x2a9541,client9001)['then'](function(){return _0x4a7be9;})['catch'](function(_0x25a4f1){logger[_0x780f('0x23')](_0x25a4f1);});}return;})[_0x780f('0x1f')](function(){if(_0x4a7be9){return _0x4a7be9;}})[_0x780f('0x1f')](respondWithResult(_0x46da4e,null))[_0x780f('0x28')](function(){for(var _0x28219c of _0xae0745){var _0x36b927=path['join'](config['root'],_0x780f('0xe9'),_0x780f('0xea'),_0x780f('0xeb'),_0x780f('0xec'),_0x28219c[_0x780f('0x87')]);fs_extra[_0x780f('0x101')](_0x36b927)['catch'](function(_0xbd8f4){logger['error'](_0x780f('0x102'),_0x36b927,_0xbd8f4);});}});};exports[_0x780f('0x103')]=function(_0x196cec,_0x58d94a){return db[_0x780f('0xbe')][_0x780f('0x73')]({'where':{'id':_0x196cec['params']['id']}})['then'](handleEntityNotFound(_0x58d94a,null))[_0x780f('0x1f')](function(_0x44064c){if(_0x44064c){return _0x44064c[_0x780f('0x103')](_0x196cec['body'][_0x780f('0x104')],_[_0x780f('0x105')](_0x196cec['body'],[_0x780f('0x104'),'id'])||{});}})['then'](respondWithResult(_0x58d94a,null))[_0x780f('0x28')](handleError(_0x58d94a,null));};exports['getInteractions']=function(_0x36b9a4,_0x1a5ba0){var _0x5ec736={'raw':![],'where':{}};var _0x3e2b3={};var _0x2b238f={'count':0x0,'rows':[]};return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x36b9a4['params']['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x1a5ba0,null))[_0x780f('0x1f')](function(_0x3c634b){if(_0x3c634b){_0x3e2b3['model']=_[_0x780f('0x55')](db['ChatInteraction'][_0x780f('0x51')]);_0x3e2b3[_0x780f('0x54')]=_[_0x780f('0x55')](_0x36b9a4[_0x780f('0x54')]);_0x3e2b3[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x3e2b3[_0x780f('0x4c')],_0x3e2b3[_0x780f('0x54')]);_0x5ec736['attributes']=_[_0x780f('0x56')](_0x3e2b3[_0x780f('0x4c')],qs[_0x780f('0x58')](_0x36b9a4['query'][_0x780f('0x58')]));_0x5ec736[_0x780f('0x57')]=_0x5ec736[_0x780f('0x57')][_0x780f('0x69')]?_0x5ec736[_0x780f('0x57')]:_0x3e2b3['model'];if(!_0x36b9a4[_0x780f('0x54')][_0x780f('0x7f')](_0x780f('0x59'))){_0x5ec736[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x36b9a4[_0x780f('0x54')]['limit']);_0x5ec736['offset']=qs[_0x780f('0x2d')](_0x36b9a4[_0x780f('0x54')][_0x780f('0x2d')]);}_0x5ec736['order']=qs[_0x780f('0x5a')](_0x36b9a4[_0x780f('0x54')][_0x780f('0x5a')]);_0x5ec736[_0x780f('0x5b')]=qs['filters'](_['pick'](_0x36b9a4['query'],_0x3e2b3[_0x780f('0x5c')]));_0x5ec736['where']['ChatWebsiteId']=_0x3c634b['id'];if(_0x36b9a4[_0x780f('0x54')][_0x780f('0x60')]){_0x5ec736[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x5ec736[_0x780f('0x5b')],{'$or':_['map'](_0x5ec736[_0x780f('0x57')],function(_0xf62374){var _0x5f2a7e={};_0x5f2a7e[_0xf62374]={'$like':'%'+_0x36b9a4[_0x780f('0x54')]['filter']+'%'};return _0x5f2a7e;})});}_0x5ec736=_[_0x780f('0x5e')]({},_0x5ec736,_0x36b9a4[_0x780f('0x61')]);return db[_0x780f('0xbe')]['count']({'where':_0x5ec736['where']})[_0x780f('0x1f')](function(_0x436344){_0x2b238f[_0x780f('0x2f')]=_0x436344;if(_0x36b9a4[_0x780f('0x54')][_0x780f('0x62')]){_0x5ec736[_0x780f('0x63')]=[{'model':db['CmContact'],'as':_0x780f('0x106'),'required':![]},{'model':db['User'],'as':_0x780f('0x107'),'attributes':[_0x780f('0x44'),_0x780f('0x108'),_0x780f('0x109')],'required':![]},{'model':db[_0x780f('0x10a')],'as':_0x780f('0x10b'),'attributes':['id',_0x780f('0x44'),_0x780f('0x10c')],'where':_0x36b9a4[_0x780f('0x54')][_0x780f('0x10d')]?{'id':_0x36b9a4[_0x780f('0x54')][_0x780f('0x10d')]}:undefined,'required':_0x36b9a4[_0x780f('0x54')][_0x780f('0x10d')]?!![]:![]}];}return db['ChatInteraction'][_0x780f('0x64')](_0x5ec736);})[_0x780f('0x1f')](function(_0x4e1838){_0x2b238f['rows']=_0x4e1838;return _0x2b238f;});}})['then'](respondWithFilteredResult(_0x1a5ba0,_0x5ec736))['catch'](handleError(_0x1a5ba0,null));};exports['getSnippet']=function(_0x3a7f03,_0xb4a15d){var _0xe3b403=0x0;var _0x251afe=0x0;var _0x2b70ef=![];var _0x6d9f64;var _0x133803;return db[_0x780f('0x50')]['find']({'where':{'id':_0x3a7f03['params']['id']},'include':[{'model':db[_0x780f('0x9e')],'as':'Interval','include':[{'model':db[_0x780f('0x9e')],'as':_0x780f('0x10e'),'attributes':['id','interval']}]}]})[_0x780f('0x1f')](handleEntityNotFound(_0xb4a15d,null))['then'](function(_0x2d173e){if(_0x2d173e){_0x6d9f64=_0x2d173e;return _0x2d173e[_0x780f('0x10f')]({'raw':!![]});}})[_0x780f('0x1f')](function(_0x3e03a6){if(_0x6d9f64){if(_0x3e03a6){_0x133803=_0x3e03a6;}}return require(_0x780f('0x110'))['getLicense']();})['then'](function(_0x32ba87){if(_0x32ba87){_0x251afe=_0x32ba87['virtual'];_0x2b70ef=_0x32ba87[_0x780f('0x90')];}})[_0x780f('0x1f')](function(){return db[_0x780f('0xbe')][_0x780f('0x2f')]({'where':{'closed':![]}});})[_0x780f('0x1f')](function(_0x3ba7bb){_0xe3b403=_0x3ba7bb;if(_0x251afe&&_0x3ba7bb>_0x251afe){return db[_0x780f('0x111')]['findOne']({'where':{'id':0x1}})[_0x780f('0x1f')](function(_0x4b8e84){if(_0x4b8e84){_0x4b8e84[_0x780f('0x112')](_0x780f('0x113'));}});}})[_0x780f('0x1f')](function(){var _0x47eff8=_0x6d9f64[_0x780f('0x9e')];var _0x14bcbf=_0x6d9f64['timezone']||undefined;return _0x47eff8?_0x47eff8['ifTime'](_0x14bcbf):!![];})['then'](function(_0xe639c4){var _0x4f6232=fs[_0x780f('0xe2')](path['join'](config[_0x780f('0x92')],_0x780f('0x114')),_0x780f('0x115'));var _0x563b61='3.9.0';var _0x472fb0=![];var _0x3e0c73,_0x53e57c;if(_0x3a7f03[_0x780f('0xbc')][_0x780f('0x42')]){_0x3e0c73=new URL(_0x3a7f03['headers'][_0x780f('0x42')])[_0x780f('0x116')];}else if(_0x3a7f03[_0x780f('0xbc')]['origin']){_0x3e0c73=new URL(_0x3a7f03[_0x780f('0xbc')][_0x780f('0x116')])[_0x780f('0x116')];}else{_0x3e0c73=_0x780f('0x117');}_0x53e57c=typeof _0x6d9f64[_0x780f('0x76')][_0x780f('0x6c')](',')[_0x780f('0x73')](function(_0x58d950){return wildcardUtils['testWebsiteWithWildcard'](_0x58d950,_0x3e0c73);})!==_0x780f('0x2e');var _0x43c844={'chatVersion':_0x563b61,'chatWebsiteAddressOrigin':_0x53e57c?_0x3e0c73:_0x6d9f64['address'],'remote':_0x6d9f64['remote'],'query':querystring[_0x780f('0x4e')](_[_0x780f('0x5e')](_0x6d9f64[_0x780f('0x35')]({'plain':!![]}),{'customerIp':_0x3a7f03['headers']['x-forwarded-for']||_0x3a7f03['headers']['x-real-ip']||_0x3a7f03['connection'][_0x780f('0x118')]||_0x3a7f03['ip'],'referer':_0x3a7f03[_0x780f('0xbc')]['referer'],'openedInteractions':_0xe3b403,'maxInteractions':_0x251afe,'virtual':_0x2b70ef[_0x780f('0x119')],'online':_0xe639c4,'custom':_0x2b70ef,'address':_0x53e57c?_0x3e0c73:null}))['replace'](/'/g,'\x5c\x27')};_0xb4a15d[_0x780f('0x38')](ejs[_0x780f('0xe4')](Mustache[_0x780f('0xe4')](_0x4f6232,_0x43c844),{'proactiveActions':_0x133803,'alignment':_0x6d9f64['alignment'],'verticalAlignment':_0x6d9f64[_0x780f('0x11a')],'div_color':_0x6d9f64['color'],'labelText':_0x6d9f64[_0x780f('0x11b')],'text_color':_0x6d9f64[_0x780f('0x11c')],'text_button_color':_0x6d9f64[_0x780f('0x11d')],'button_color':_0x6d9f64[_0x780f('0x11e')],'background_color':_0x6d9f64[_0x780f('0x11f')],'hideWhenOffline':_0x6d9f64[_0x780f('0x120')],'intervalId':_0x6d9f64['IntervalId'],'isDevelopment':_0x472fb0,'chatVersion':_0x563b61}));})[_0x780f('0x28')](handleError(_0xb4a15d,null));};exports[_0x780f('0x121')]=function(_0x232f2a,_0x3c38c2){var _0x47d83c=_0x232f2a[_0x780f('0x67')]['id'];var _0x406dfe=_0x232f2a[_0x780f('0x6b')];var _0x1a4af8=0xc8;var _0x4b1abd=null;return db[_0x780f('0xee')][_0x780f('0xef')]({'isolationLevel':db['sequelize'][_0x780f('0x122')][_0x780f('0x123')][_0x780f('0x124')]},function(_0x3a75ea){return db[_0x780f('0x50')]['findOne']({'where':{'id':_0x47d83c},'transaction':_0x3a75ea})[_0x780f('0x1f')](function(_0x2bcd13){if(_0x2bcd13){return db[_0x780f('0xaf')]['destroy']({'where':{'ChatWebsiteId':_0x47d83c},'transaction':_0x3a75ea})[_0x780f('0x1f')](function(){var _0x1da524=_[_0x780f('0x4f')](_0x406dfe,function(_0x489d3e){_0x489d3e[_0x780f('0x7b')]=_0x47d83c;return _0x489d3e;});return db[_0x780f('0xaf')][_0x780f('0xf1')](_0x1da524,{'transaction':_0x3a75ea});});}else{_0x1a4af8=0x194;_0x4b1abd=[];}});})[_0x780f('0x1f')](function(){if(_0x1a4af8!==0x194){return db[_0x780f('0xaf')][_0x780f('0x125')]({'where':{'ChatWebsiteId':_0x47d83c},'order':_0x780f('0xb5')})['then'](function(_0x530c1c){_0x4b1abd=_0x530c1c;});}})[_0x780f('0x28')](function(_0x20a494){_0x1a4af8=0x1f4;logger[_0x780f('0x23')](_0x20a494['stack']);if(_0x20a494['name']){delete _0x20a494[_0x780f('0x44')];}_0x4b1abd=_0x20a494;})[_0x780f('0x126')](function(){if(_0x4b1abd===null){_0x3c38c2[_0x780f('0x29')](_0x1a4af8);}else{if(_0x1a4af8===0x1f4){_0x3c38c2[_0x780f('0x2b')](_0x1a4af8)[_0x780f('0x38')](_0x4b1abd);}else{_0x3c38c2[_0x780f('0x2b')](_0x1a4af8)[_0x780f('0x2c')](_0x4b1abd);}}});};exports[_0x780f('0x127')]=function(_0x30a4dc,_0xafe98d){var _0x102ed4={};var _0x4b1e03={};var _0x460f1f;var _0x1e49ef;return db['ChatWebsite']['findOne']({'where':{'id':_0x30a4dc['params']['id']}})['then'](handleEntityNotFound(_0xafe98d,null))[_0x780f('0x1f')](function(_0x2d396a){if(_0x2d396a){_0x460f1f=_0x2d396a;_0x4b1e03[_0x780f('0x4c')]=_[_0x780f('0x55')](db[_0x780f('0xaf')]['rawAttributes']);_0x4b1e03[_0x780f('0x54')]=_[_0x780f('0x55')](_0x30a4dc[_0x780f('0x54')]);_0x4b1e03[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x4b1e03[_0x780f('0x4c')],_0x4b1e03[_0x780f('0x54')]);_0x102ed4[_0x780f('0x57')]=_[_0x780f('0x56')](_0x4b1e03[_0x780f('0x4c')],qs['fields'](_0x30a4dc[_0x780f('0x54')]['fields']));_0x102ed4[_0x780f('0x57')]=_0x102ed4['attributes'][_0x780f('0x69')]?_0x102ed4[_0x780f('0x57')]:_0x4b1e03[_0x780f('0x4c')];_0x102ed4[_0x780f('0x80')]=qs[_0x780f('0x5a')](_0x30a4dc[_0x780f('0x54')][_0x780f('0x5a')]);_0x102ed4[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x30a4dc[_0x780f('0x54')],_0x4b1e03[_0x780f('0x5c')]));if(_0x30a4dc[_0x780f('0x54')]['filter']){_0x102ed4[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x102ed4[_0x780f('0x5b')],{'$or':_[_0x780f('0x4f')](_0x102ed4[_0x780f('0x57')],function(_0x31536b){var _0x3cb300={};_0x3cb300[_0x31536b]={'$like':'%'+_0x30a4dc[_0x780f('0x54')]['filter']+'%'};return _0x3cb300;})});}_0x102ed4=_[_0x780f('0x5e')]({},_0x102ed4,_0x30a4dc[_0x780f('0x61')]);return _0x460f1f[_0x780f('0x127')](_0x102ed4);}})['then'](function(_0x2e7fd6){if(_0x2e7fd6){_0x1e49ef=_0x2e7fd6[_0x780f('0x69')];if(!_0x30a4dc['query'][_0x780f('0x7f')](_0x780f('0x59'))){_0x102ed4['limit']=qs[_0x780f('0x30')](_0x30a4dc['query'][_0x780f('0x30')]);_0x102ed4['offset']=qs[_0x780f('0x2d')](_0x30a4dc[_0x780f('0x54')][_0x780f('0x2d')]);}return _0x460f1f['getApplications'](_0x102ed4);}})[_0x780f('0x1f')](function(_0x59f50d){if(_0x59f50d){return _0x59f50d?{'count':_0x1e49ef,'rows':_0x59f50d}:null;}})[_0x780f('0x1f')](respondWithResult(_0xafe98d,null))[_0x780f('0x28')](handleError(_0xafe98d,null));};exports[_0x780f('0x128')]=function(_0x5d1010,_0x8cd1f1){return db[_0x780f('0x129')][_0x780f('0x73')]({'where':{'id':_0x5d1010['params']['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x8cd1f1,null))[_0x780f('0x1f')](function(_0x5c0aa8){if(_0x5c0aa8){return _0x5c0aa8[_0x780f('0x128')](_0x5d1010[_0x780f('0x6b')][_0x780f('0x104')],_[_0x780f('0x105')](_0x5d1010[_0x780f('0x6b')],[_0x780f('0x104'),'id'])||{});}})[_0x780f('0x1f')](respondWithResult(_0x8cd1f1,null))[_0x780f('0x28')](handleError(_0x8cd1f1,null));};exports[_0x780f('0x10f')]=function(_0x34d674,_0x1a9ca5){var _0x3362e5={};var _0x3ceea3={};var _0x5b9010;var _0x452d41;return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x34d674['params']['id']}})['then'](handleEntityNotFound(_0x1a9ca5,null))[_0x780f('0x1f')](function(_0x3fa869){if(_0x3fa869){_0x5b9010=_0x3fa869;_0x3ceea3[_0x780f('0x4c')]=_[_0x780f('0x55')](db[_0x780f('0x12a')][_0x780f('0x51')]);_0x3ceea3[_0x780f('0x54')]=_['keys'](_0x34d674['query']);_0x3ceea3['filters']=_[_0x780f('0x56')](_0x3ceea3['model'],_0x3ceea3[_0x780f('0x54')]);_0x3362e5['attributes']=_['intersection'](_0x3ceea3[_0x780f('0x4c')],qs['fields'](_0x34d674['query'][_0x780f('0x58')]));_0x3362e5[_0x780f('0x57')]=_0x3362e5['attributes'][_0x780f('0x69')]?_0x3362e5[_0x780f('0x57')]:_0x3ceea3[_0x780f('0x4c')];_0x3362e5[_0x780f('0x80')]=qs[_0x780f('0x5a')](_0x34d674[_0x780f('0x54')][_0x780f('0x5a')]);_0x3362e5[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_['pick'](_0x34d674[_0x780f('0x54')],_0x3ceea3['filters']));if(_0x34d674[_0x780f('0x54')]['filter']){_0x3362e5[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x3362e5[_0x780f('0x5b')],{'$or':_['map'](_0x3362e5[_0x780f('0x57')],function(_0x31388d){var _0x3f530d={};_0x3f530d[_0x31388d]={'$like':'%'+_0x34d674[_0x780f('0x54')]['filter']+'%'};return _0x3f530d;})});}_0x3362e5=_[_0x780f('0x5e')]({},_0x3362e5,_0x34d674[_0x780f('0x61')]);return _0x5b9010[_0x780f('0x10f')](_0x3362e5);}})[_0x780f('0x1f')](function(_0x197741){if(_0x197741){_0x452d41=_0x197741['length'];if(!_0x34d674[_0x780f('0x54')][_0x780f('0x7f')](_0x780f('0x59'))){_0x3362e5[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x34d674['query'][_0x780f('0x30')]);_0x3362e5[_0x780f('0x2d')]=qs[_0x780f('0x2d')](_0x34d674[_0x780f('0x54')][_0x780f('0x2d')]);}return _0x5b9010[_0x780f('0x10f')](_0x3362e5);}})[_0x780f('0x1f')](function(_0x1ff1d7){if(_0x1ff1d7){return _0x1ff1d7?{'count':_0x452d41,'rows':_0x1ff1d7}:null;}})[_0x780f('0x1f')](respondWithResult(_0x1a9ca5,null))[_0x780f('0x28')](handleError(_0x1a9ca5,null));};exports['getFields']=function(_0x1cd10f,_0x48ce6c){var _0x26b7ed=_0x1cd10f[_0x780f('0x54')][_0x780f('0x12b')]==='false'?_0x780f('0x12c'):_0x780f('0x12d');return db[_0x780f('0x50')]['find']({'attributes':['id',_0x26b7ed],'where':{'id':_0x1cd10f[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x48ce6c,null))[_0x780f('0x1f')](function(_0x301277){if(_0x301277){var _0x403c44=_0x301277[_0x26b7ed];var _0x3d5358=_0x403c44&&_0x403c44[_0x780f('0x12e')]?_0x403c44[_0x780f('0x12e')]:[];_0x48ce6c['send']({'fromKey':_[_0x780f('0x96')](_0x403c44[_0x780f('0x12f')])?undefined:_0x403c44[_0x780f('0x12f')],'count':_0x3d5358['length'],'rows':_0x3d5358});}})[_0x780f('0x28')](handleError(_0x48ce6c,null));};exports[_0x780f('0x130')]=function(_0x4affd1,_0x255be3){var _0x30b928={'raw':![],'where':{}};var _0x163e87={};var _0xca5fb={'count':0x0,'rows':[]};return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x4affd1[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x255be3,null))['then'](function(_0x34413b){if(_0x34413b){_0x163e87['model']=_[_0x780f('0x55')](db[_0x780f('0x131')][_0x780f('0x51')]);_0x163e87['query']=_[_0x780f('0x55')](_0x4affd1[_0x780f('0x54')]);_0x163e87[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x163e87[_0x780f('0x4c')],_0x163e87[_0x780f('0x54')]);_0x30b928[_0x780f('0x57')]=_[_0x780f('0x56')](_0x163e87[_0x780f('0x4c')],qs[_0x780f('0x58')](_0x4affd1[_0x780f('0x54')]['fields']));_0x30b928[_0x780f('0x57')]=_0x30b928['attributes'][_0x780f('0x69')]?_0x30b928[_0x780f('0x57')]:_0x163e87['model'];if(!_0x4affd1[_0x780f('0x54')][_0x780f('0x7f')]('nolimit')){_0x30b928[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x4affd1[_0x780f('0x54')]['limit']);_0x30b928[_0x780f('0x2d')]=qs[_0x780f('0x2d')](_0x4affd1['query'][_0x780f('0x2d')]);}_0x30b928[_0x780f('0x80')]=qs[_0x780f('0x5a')](_0x4affd1[_0x780f('0x54')]['sort']);_0x30b928[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_['pick'](_0x4affd1[_0x780f('0x54')],_0x163e87['filters']));_0x30b928[_0x780f('0x5b')][_0x780f('0x7b')]=_0x34413b['id'];if(_0x4affd1['query']['filter']){_0x30b928[_0x780f('0x5b')]=_['merge'](_0x30b928[_0x780f('0x5b')],{'$or':_[_0x780f('0x4f')](_0x30b928[_0x780f('0x57')],function(_0x1a33ad){var _0x29c16c={};_0x29c16c[_0x1a33ad]={'$like':'%'+_0x4affd1['query'][_0x780f('0x60')]+'%'};return _0x29c16c;})});}_0x30b928=_['merge']({},_0x30b928,_0x4affd1[_0x780f('0x61')]);return db['ChatOfflineMessage']['count']({'where':_0x30b928[_0x780f('0x5b')]})[_0x780f('0x1f')](function(_0x27dacd){_0xca5fb[_0x780f('0x2f')]=_0x27dacd;if(_0x4affd1[_0x780f('0x54')][_0x780f('0x62')]){_0x30b928[_0x780f('0x63')]=[{'all':!![]}];}else{_0x30b928[_0x780f('0x63')]=[{'model':db['CmContact'],'as':_0x780f('0x106'),'required':![]},{'model':db[_0x780f('0xf0')],'as':_0x780f('0x132'),'required':![]}];}return db[_0x780f('0x131')][_0x780f('0x64')](_0x30b928);})[_0x780f('0x1f')](function(_0x20136e){_0xca5fb[_0x780f('0x65')]=_0x20136e;return _0xca5fb;});}})['then'](respondWithFilteredResult(_0x255be3,_0x30b928))[_0x780f('0x28')](handleError(_0x255be3,null));};exports[_0x780f('0x133')]=function(_0x3948be,_0xf76d46){return db[_0x780f('0x50')]['find']({'where':{'id':_0x3948be[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0xf76d46,null))[_0x780f('0x1f')](function(_0x38b5f6){if(_0x38b5f6){return _0x38b5f6['addAgents'](_0x3948be['body'][_0x780f('0x104')],_[_0x780f('0x105')](_0x3948be['body'],[_0x780f('0x104'),'id'])||{})[_0x780f('0xe1')](function(_0x16a4b8){for(var _0x582c45=0x0;_0x582c45<_0x3948be['body'][_0x780f('0x104')][_0x780f('0x69')];_0x582c45+=0x1){socket[_0x780f('0x134')](_0x780f('0x135'),{'UserId':Number(_0x3948be[_0x780f('0x6b')][_0x780f('0x104')][_0x582c45]),'ChatWebsiteId':Number(_0x3948be[_0x780f('0x67')]['id'])});}return _0x16a4b8;});}})[_0x780f('0x1f')](respondWithResult(_0xf76d46,null))[_0x780f('0x28')](handleError(_0xf76d46,null));};exports[_0x780f('0x136')]=function(_0x36770a,_0x3878cb){return db[_0x780f('0x50')]['find']({'where':{'id':_0x36770a[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x3878cb,null))[_0x780f('0x1f')](function(_0x53b5b4){if(_0x53b5b4){return _0x53b5b4[_0x780f('0x136')](_0x36770a[_0x780f('0x54')][_0x780f('0x104')])[_0x780f('0x1f')](function(){if(_[_0x780f('0x137')](_0x36770a[_0x780f('0x54')]['ids'])){for(var _0x1d57fb=0x0;_0x1d57fb<_0x36770a['query'][_0x780f('0x104')][_0x780f('0x69')];_0x1d57fb+=0x1){socket[_0x780f('0x134')](_0x780f('0x138'),{'UserId':Number(_0x36770a['query'][_0x780f('0x104')][_0x1d57fb]),'ChatWebsiteId':Number(_0x36770a[_0x780f('0x67')]['id'])});}}else{socket[_0x780f('0x134')](_0x780f('0x138'),{'UserId':Number(_0x36770a[_0x780f('0x54')][_0x780f('0x104')]),'ChatWebsiteId':Number(_0x36770a[_0x780f('0x67')]['id'])});}});}})[_0x780f('0x1f')](respondWithStatusCode(_0x3878cb,null))['catch'](handleError(_0x3878cb,null));};exports['getAgents']=function(_0x3de4ab,_0x49602c){var _0x30e854={};var _0x2fdd7e={};var _0x13bf0a;var _0x3ada1d;return db['ChatWebsite'][_0x780f('0x7e')]({'where':{'id':_0x3de4ab[_0x780f('0x67')]['id']}})['then'](handleEntityNotFound(_0x49602c,null))[_0x780f('0x1f')](function(_0x5b4dd7){if(_0x5b4dd7){_0x13bf0a=_0x5b4dd7;_0x2fdd7e['model']=_[_0x780f('0x55')](db[_0x780f('0xcd')][_0x780f('0x51')]);_0x2fdd7e[_0x780f('0x54')]=_[_0x780f('0x55')](_0x3de4ab[_0x780f('0x54')]);_0x2fdd7e[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x2fdd7e[_0x780f('0x4c')],_0x2fdd7e['query']);_0x30e854[_0x780f('0x57')]=_[_0x780f('0x56')](_0x2fdd7e['model'],qs['fields'](_0x3de4ab[_0x780f('0x54')][_0x780f('0x58')]));_0x30e854[_0x780f('0x57')]=_0x30e854[_0x780f('0x57')][_0x780f('0x69')]?_0x30e854[_0x780f('0x57')]:_0x2fdd7e[_0x780f('0x4c')];_0x30e854[_0x780f('0x80')]=qs[_0x780f('0x5a')](_0x3de4ab[_0x780f('0x54')]['sort']);_0x30e854[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x3de4ab[_0x780f('0x54')],_0x2fdd7e[_0x780f('0x5c')]));if(_0x3de4ab['query']['filter']){_0x30e854[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x30e854['where'],{'$or':_[_0x780f('0x4f')](_0x30e854[_0x780f('0x57')],function(_0x488213){var _0x261fa8={};_0x261fa8[_0x488213]={'$like':'%'+_0x3de4ab[_0x780f('0x54')][_0x780f('0x60')]+'%'};return _0x261fa8;})});}_0x30e854=_[_0x780f('0x5e')]({},_0x30e854,_0x3de4ab[_0x780f('0x61')]);return _0x13bf0a[_0x780f('0x139')](_0x30e854);}})['then'](function(_0x4c65e1){if(_0x4c65e1){_0x3ada1d=_0x4c65e1[_0x780f('0x69')];if(!_0x3de4ab[_0x780f('0x54')][_0x780f('0x7f')](_0x780f('0x59'))){_0x30e854[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x3de4ab[_0x780f('0x54')][_0x780f('0x30')]);_0x30e854['offset']=qs[_0x780f('0x2d')](_0x3de4ab[_0x780f('0x54')]['offset']);}return _0x13bf0a[_0x780f('0x139')](_0x30e854);}})[_0x780f('0x1f')](function(_0x5eed1e){if(_0x5eed1e){return _0x5eed1e?{'count':_0x3ada1d,'rows':_0x5eed1e}:null;}})[_0x780f('0x1f')](respondWithResult(_0x49602c,null))[_0x780f('0x28')](handleError(_0x49602c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 51800dd..b77a209 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 _0xf29c=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x49fcd7,_0x15a6c0){var _0x451f00=function(_0x27698c){while(--_0x27698c){_0x49fcd7['push'](_0x49fcd7['shift']());}};_0x451f00(++_0x15a6c0);}(_0xf29c,0xc7));var _0xcf29=function(_0x5b7fb2,_0x4baf8b){_0x5b7fb2=_0x5b7fb2-0x0;var _0x58b71f=_0xf29c[_0x5b7fb2];return _0x58b71f;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xcf29('0x0'))['db'][_0xcf29('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcf29('0x2')](0x0);var events={'afterCreate':_0xcf29('0x3'),'afterUpdate':_0xcf29('0x4'),'afterDestroy':_0xcf29('0x5')};function emitEvent(_0x46fd65){return function(_0x148004,_0x1f2b5d,_0x1a85d7){ChatWebsiteEvents[_0xcf29('0x6')](_0x46fd65+':'+_0x148004['id'],_0x148004);ChatWebsiteEvents[_0xcf29('0x6')](_0x46fd65,_0x148004);_0x1a85d7(null);};}for(var e in events){if(events[_0xcf29('0x7')](e)){var event=events[e];ChatWebsite[_0xcf29('0x8')](e,emitEvent(event));}}module[_0xcf29('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x16e4=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x16e4,0x97));var _0x416e=function(_0x219cc2,_0xa571ff){_0x219cc2=_0x219cc2-0x0;var _0x354d0c=_0x16e4[_0x219cc2];return _0x354d0c;};'use strict';var EventEmitter=require(_0x416e('0x0'));var ChatWebsite=require(_0x416e('0x1'))['db'][_0x416e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x416e('0x3')](0x0);var events={'afterCreate':_0x416e('0x4'),'afterUpdate':_0x416e('0x5'),'afterDestroy':'remove'};function emitEvent(_0xdf95eb){return function(_0x4a161c,_0x344e7b,_0x30af74){ChatWebsiteEvents['emit'](_0xdf95eb+':'+_0x4a161c['id'],_0x4a161c);ChatWebsiteEvents[_0x416e('0x6')](_0xdf95eb,_0x4a161c);_0x30af74(null);};}for(var e in events){if(events[_0x416e('0x7')](e)){var event=events[e];ChatWebsite[_0x416e('0x8')](e,emitEvent(event));}}module[_0x416e('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index fdd4bbb..8cf5d0f 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 _0x085f=['./chatWebsite.attributes','chat_websites','lodash','../../config/logger','bluebird','path','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x085f,0x12f));var _0xf085=function(_0x45447c,_0x447cb8){_0x45447c=_0x45447c-0x0;var _0x20bd49=_0x085f[_0x45447c];return _0x20bd49;};'use strict';var _=require(_0xf085('0x0'));var util=require('util');var logger=require(_0xf085('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf085('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf085('0x3'));var rimraf=require('rimraf');var config=require(_0xf085('0x4'));var attributes=require(_0xf085('0x5'));module['exports']=function(_0x538b52,_0x4069de){return _0x538b52['define']('ChatWebsite',attributes,{'tableName':_0xf085('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbaa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatWebsite','lodash','util','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcbaa,0x11d));var _0xacba=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0xcbaa[_0x44f974];return _0x805dbd;};'use strict';var _=require(_0xacba('0x0'));var util=require(_0xacba('0x1'));var logger=require('../../config/logger')(_0xacba('0x2'));var moment=require(_0xacba('0x3'));var BPromise=require(_0xacba('0x4'));var rp=require(_0xacba('0x5'));var fs=require('fs');var path=require(_0xacba('0x6'));var rimraf=require(_0xacba('0x7'));var config=require(_0xacba('0x8'));var attributes=require('./chatWebsite.attributes');module[_0xacba('0x9')]=function(_0x45ab26,_0x515e09){return _0x45ab26[_0xacba('0xa')](_0xacba('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 59fd53a..df32166 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 _0x8f71=['request','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register'];(function(_0x502ffb,_0x39df5c){var _0x5e80d3=function(_0xc6c5e9){while(--_0xc6c5e9){_0x502ffb['push'](_0x502ffb['shift']());}};_0x5e80d3(++_0x39df5c);}(_0x8f71,0xba));var _0x18f7=function(_0x19a6d4,_0x445a4e){_0x19a6d4=_0x19a6d4-0x0;var _0x1d056b=_0x8f71[_0x19a6d4];return _0x1d056b;};'use strict';var _=require(_0x18f7('0x0'));var util=require(_0x18f7('0x1'));var moment=require('moment');var BPromise=require(_0x18f7('0x2'));var rs=require(_0x18f7('0x3'));var fs=require('fs');var Redis=require(_0x18f7('0x4'));var db=require(_0x18f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x18f7('0x6'));var config=require(_0x18f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x18f7('0x8')][_0x18f7('0x9')]({'port':0x232a});config[_0x18f7('0xa')]=_[_0x18f7('0xb')](config[_0x18f7('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x18f7('0xc'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x18f7('0xd')](socket);function respondWithRpcPromise(_0x12f78b,_0xfd81e7,_0xb7499b){return new BPromise(function(_0x13e7dd,_0x43afa2){return client[_0x18f7('0xe')](_0x12f78b,_0xb7499b)['then'](function(_0x3f061c){logger[_0x18f7('0xf')](_0x18f7('0x10'),_0xfd81e7,'request\x20sent');logger['debug'](_0x18f7('0x11'),_0xfd81e7,'request\x20sent',JSON[_0x18f7('0x12')](_0x3f061c));if(_0x3f061c[_0x18f7('0x13')]){if(_0x3f061c['error'][_0x18f7('0x14')]===0x1f4){logger[_0x18f7('0x13')](_0x18f7('0x10'),_0xfd81e7,_0x3f061c[_0x18f7('0x13')][_0x18f7('0x15')]);return _0x43afa2(_0x3f061c[_0x18f7('0x13')][_0x18f7('0x15')]);}logger[_0x18f7('0x13')](_0x18f7('0x10'),_0xfd81e7,_0x3f061c['error'][_0x18f7('0x15')]);return _0x13e7dd(_0x3f061c['error']['message']);}else{logger[_0x18f7('0xf')](_0x18f7('0x10'),_0xfd81e7,_0x18f7('0x16'));_0x13e7dd(_0x3f061c[_0x18f7('0x17')][_0x18f7('0x15')]);}})[_0x18f7('0x18')](function(_0x1ec19b){logger[_0x18f7('0x13')](_0x18f7('0x10'),_0xfd81e7,_0x1ec19b);_0x43afa2(_0x1ec19b);});});} \ No newline at end of file +var _0xd49f=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b379d,_0x2d6c06){var _0x35f203=function(_0x5d78ba){while(--_0x5d78ba){_0x4b379d['push'](_0x4b379d['shift']());}};_0x35f203(++_0x2d6c06);}(_0xd49f,0x165));var _0xfd49=function(_0x5f1d5a,_0x1c85a7){_0x5f1d5a=_0x5f1d5a-0x0;var _0x449071=_0xd49f[_0x5f1d5a];return _0x449071;};'use strict';var _=require(_0xfd49('0x0'));var util=require(_0xfd49('0x1'));var moment=require('moment');var BPromise=require(_0xfd49('0x2'));var rs=require(_0xfd49('0x3'));var fs=require('fs');var Redis=require(_0xfd49('0x4'));var db=require(_0xfd49('0x5'))['db'];var utils=require(_0xfd49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfd49('0x7'));var jayson=require(_0xfd49('0x8'));var client=jayson[_0xfd49('0x9')][_0xfd49('0xa')]({'port':0x232a});config[_0xfd49('0xb')]=_['defaults'](config[_0xfd49('0xb')],{'host':_0xfd49('0xc'),'port':0x18eb});var socket=require(_0xfd49('0xd'))(new Redis(config[_0xfd49('0xb')]));require(_0xfd49('0xe'))[_0xfd49('0xf')](socket);function respondWithRpcPromise(_0x4e0172,_0x5e3aa4,_0x33a3c6){return new BPromise(function(_0x32add7,_0x1366b9){return client[_0xfd49('0x10')](_0x4e0172,_0x33a3c6)['then'](function(_0x3c95a6){logger[_0xfd49('0x11')](_0xfd49('0x12'),_0x5e3aa4,_0xfd49('0x13'));logger[_0xfd49('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5e3aa4,_0xfd49('0x13'),JSON[_0xfd49('0x15')](_0x3c95a6));if(_0x3c95a6[_0xfd49('0x16')]){if(_0x3c95a6[_0xfd49('0x16')][_0xfd49('0x17')]===0x1f4){logger[_0xfd49('0x16')](_0xfd49('0x12'),_0x5e3aa4,_0x3c95a6['error'][_0xfd49('0x18')]);return _0x1366b9(_0x3c95a6[_0xfd49('0x16')]['message']);}logger[_0xfd49('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x5e3aa4,_0x3c95a6['error'][_0xfd49('0x18')]);return _0x32add7(_0x3c95a6[_0xfd49('0x16')]['message']);}else{logger[_0xfd49('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x5e3aa4,'request\x20sent');_0x32add7(_0x3c95a6[_0xfd49('0x19')][_0xfd49('0x18')]);}})[_0xfd49('0x1a')](function(_0x1fde74){logger[_0xfd49('0x16')](_0xfd49('0x12'),_0x5e3aa4,_0x1fde74);_0x1366b9(_0x1fde74);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index adf6154..2350430 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 _0xbf32=['removeListener','length','chatWebsite:','save','remove'];(function(_0x37af6f,_0x36e415){var _0x1cb977=function(_0x160d3a){while(--_0x160d3a){_0x37af6f['push'](_0x37af6f['shift']());}};_0x1cb977(++_0x36e415);}(_0xbf32,0x14d));var _0x2bf3=function(_0x28e255,_0x4a8144){_0x28e255=_0x28e255-0x0;var _0x1146db=_0xbf32[_0x28e255];return _0x1146db;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x2bf3('0x0'),_0x2bf3('0x1'),'update'];function createListener(_0x59e580,_0xe00d5c){return function(_0x3dc606){_0xe00d5c['emit'](_0x59e580,_0x3dc606);};}function removeListener(_0x533781,_0x2fc49a){return function(){ChatWebsiteEvents[_0x2bf3('0x2')](_0x533781,_0x2fc49a);};}exports['register']=function(_0x467ae){for(var _0x1871da=0x0,_0x39beee=events[_0x2bf3('0x3')];_0x1871da<_0x39beee;_0x1871da++){var _0x418704=events[_0x1871da];var _0x3c0124=createListener(_0x2bf3('0x4')+_0x418704,_0x467ae);ChatWebsiteEvents['on'](_0x418704,_0x3c0124);}}; \ No newline at end of file +var _0x137d=['save','remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x137d,0x1df));var _0xd137=function(_0x414ff1,_0xf0462b){_0x414ff1=_0x414ff1-0x0;var _0x29c53f=_0x137d[_0x414ff1];return _0x29c53f;};'use strict';var ChatWebsiteEvents=require(_0xd137('0x0'));var events=[_0xd137('0x1'),_0xd137('0x2'),'update'];function createListener(_0x11c945,_0x78b57e){return function(_0x3a8d27){_0x78b57e[_0xd137('0x3')](_0x11c945,_0x3a8d27);};}function removeListener(_0xe01d85,_0x394af9){return function(){ChatWebsiteEvents[_0xd137('0x4')](_0xe01d85,_0x394af9);};}exports[_0xd137('0x5')]=function(_0x3e94d1){for(var _0x158980=0x0,_0x166c0b=events[_0xd137('0x6')];_0x158980<_0x166c0b;_0x158980++){var _0x16a2c3=events[_0x158980];var _0x36fd4d=createListener(_0xd137('0x7')+_0x16a2c3,_0x3e94d1);ChatWebsiteEvents['on'](_0x16a2c3,_0x36fd4d);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index c70876a..49e96a8 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d14=['replace','test','localhost','exports','../../../utils/misc','escapeRegExp','URL'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0x7d14,0x6d));var _0x47d1=function(_0x1aa47a,_0x2ca5bb){_0x1aa47a=_0x1aa47a-0x0;var _0xcac733=_0x7d14[_0x1aa47a];return _0xcac733;};var escapeRegExp=require(_0x47d1('0x0'))[_0x47d1('0x1')];var URL=require('url')[_0x47d1('0x2')];function testWildcardValidity(_0x325761){var _0x21f244=!![];try{new URL(_0x325761[_0x47d1('0x3')]('*','localhost'));}catch(_0x37d8f2){_0x21f244=![];}return _0x21f244&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x47d1('0x4')](_0x325761);}function testWebsiteWithWildcard(_0x8f3654,_0x244bbf){var _0x1b2f47;var _0x550ee2=escapeRegExp(_0x8f3654['trim']()['replace'](/\/$/,''))[_0x47d1('0x3')]('\x5c*','([\x5cw]+)');try{new URL(_0x8f3654[_0x47d1('0x3')]('\x5c*',_0x47d1('0x5')));_0x1b2f47=new RegExp(_0x550ee2)[_0x47d1('0x4')](_0x244bbf);}catch(_0x175dd2){_0x1b2f47=![];}return _0x1b2f47;}module[_0x47d1('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xd9fb=['([\x5cw]+)','localhost','exports','../../../utils/misc','escapeRegExp','url','URL','replace','test','trim'];(function(_0x47378a,_0x55cc2f){var _0x9bebe3=function(_0x115e69){while(--_0x115e69){_0x47378a['push'](_0x47378a['shift']());}};_0x9bebe3(++_0x55cc2f);}(_0xd9fb,0x189));var _0xbd9f=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd9fb[_0xd1d19a];return _0x52a79d;};var escapeRegExp=require(_0xbd9f('0x0'))[_0xbd9f('0x1')];var URL=require(_0xbd9f('0x2'))[_0xbd9f('0x3')];function testWildcardValidity(_0xc03acd){var _0x22804e=!![];try{new URL(_0xc03acd[_0xbd9f('0x4')]('*','localhost'));}catch(_0x2d4213){_0x22804e=![];}return _0x22804e&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xbd9f('0x5')](_0xc03acd);}function testWebsiteWithWildcard(_0x4ce2e2,_0x469446){var _0x5b6052;var _0x2e7eea=escapeRegExp(_0x4ce2e2[_0xbd9f('0x6')]()['replace'](/\/$/,''))[_0xbd9f('0x4')]('\x5c*',_0xbd9f('0x7'));try{new URL(_0x4ce2e2[_0xbd9f('0x4')]('\x5c*',_0xbd9f('0x8')));_0x5b6052=new RegExp(_0x2e7eea)['test'](_0x469446);}catch(_0x37163c){_0x5b6052=![];}return _0x5b6052;}module[_0xbd9f('0x9')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b33ccf7..275e53a 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 _0x8ec9=['addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','offline','addApplications','addProactiveActions','update','delete','destroy','removeDispositions','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','diskStorage','join','root','format','now','originalname','file','addLogo','server/files/images/avatars/','%s-%s','single'];(function(_0x17cac9,_0x5284ed){var _0x810776=function(_0xec593c){while(--_0xec593c){_0x17cac9['push'](_0x17cac9['shift']());}};_0x810776(++_0x5284ed);}(_0x8ec9,0xa7));var _0x98ec=function(_0x5e9279,_0x5b2465){_0x5e9279=_0x5e9279-0x0;var _0x108262=_0x8ec9[_0x5e9279];return _0x108262;};'use strict';var multer=require(_0x98ec('0x0'));var util=require(_0x98ec('0x1'));var path=require(_0x98ec('0x2'));var timeout=require(_0x98ec('0x3'));var express=require(_0x98ec('0x4'));var router=express[_0x98ec('0x5')]();var fs_extra=require(_0x98ec('0x6'));var auth=require(_0x98ec('0x7'));var interaction=require(_0x98ec('0x8'));var config=require(_0x98ec('0x9'));var controller=require(_0x98ec('0xa'));router[_0x98ec('0xb')]('/',auth[_0x98ec('0xc')](),controller[_0x98ec('0xd')]);router['get']('/describe',auth[_0x98ec('0xc')](),controller[_0x98ec('0xe')]);router[_0x98ec('0xb')](_0x98ec('0xf'),auth[_0x98ec('0xc')](),controller[_0x98ec('0x10')]);router['get'](_0x98ec('0x11'),auth['isAuthenticated'](),controller[_0x98ec('0x12')]);router[_0x98ec('0xb')](_0x98ec('0x13'),auth[_0x98ec('0xc')](),controller['getAnswers']);router[_0x98ec('0xb')](_0x98ec('0x14'),controller[_0x98ec('0x15')]);router['get']('/:id/avatar',controller[_0x98ec('0x16')]);router[_0x98ec('0xb')](_0x98ec('0x17'),controller[_0x98ec('0x18')]);router[_0x98ec('0xb')](_0x98ec('0x19'),controller[_0x98ec('0x1a')]);router['get'](_0x98ec('0x1b'),auth[_0x98ec('0xc')](),controller[_0x98ec('0x1c')]);router['get'](_0x98ec('0x1d'),controller[_0x98ec('0x1e')]);router[_0x98ec('0xb')](_0x98ec('0x1f'),auth[_0x98ec('0xc')](),controller['getApplications']);router[_0x98ec('0xb')](_0x98ec('0x20'),auth[_0x98ec('0xc')](),controller[_0x98ec('0x21')]);router[_0x98ec('0xb')](_0x98ec('0x22'),controller['getFields']);router[_0x98ec('0xb')](_0x98ec('0x23'),auth[_0x98ec('0xc')](),controller[_0x98ec('0x24')]);router['get']('/:id/users',auth[_0x98ec('0xc')](),controller[_0x98ec('0x25')]);router[_0x98ec('0x26')]('/',auth[_0x98ec('0xc')](),controller[_0x98ec('0x27')]);router['post'](_0x98ec('0x11'),auth[_0x98ec('0xc')](),controller[_0x98ec('0x28')]);router[_0x98ec('0x26')]('/:id/canned_answers',auth[_0x98ec('0xc')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x98ec('0x29')]({'destination':function(_0x281f45,_0x380542,_0x203c40){_0x203c40(null,path[_0x98ec('0x2a')](config[_0x98ec('0x2b')],'server/files/images/logos/'));},'filename':function(_0x47463c,_0x23a936,_0x325922){_0x325922(null,util[_0x98ec('0x2c')]('%s-%s',Date[_0x98ec('0x2d')](),_0x23a936[_0x98ec('0x2e')]));}})});router[_0x98ec('0x26')](_0x98ec('0x14'),upload['single'](_0x98ec('0x2f')),controller[_0x98ec('0x30')]);var upload=multer({'storage':multer[_0x98ec('0x29')]({'destination':function(_0x41f34c,_0x47cf53,_0x434ea8){_0x434ea8(null,path[_0x98ec('0x2a')](config['root'],_0x98ec('0x31')));},'filename':function(_0x122774,_0x310af9,_0x4ca92b){_0x4ca92b(null,util['format'](_0x98ec('0x32'),Date[_0x98ec('0x2d')](),_0x310af9[_0x98ec('0x2e')]));}})});router[_0x98ec('0x26')]('/:id/avatar',upload[_0x98ec('0x33')](_0x98ec('0x2f')),controller[_0x98ec('0x34')]);var upload=multer({'storage':multer[_0x98ec('0x29')]({'destination':function(_0x36f2d8,_0x5c9f65,_0x3d8421){_0x3d8421(null,path[_0x98ec('0x2a')](config[_0x98ec('0x2b')],_0x98ec('0x31')));},'filename':function(_0x2f9bc9,_0x408081,_0x36fe53){_0x36fe53(null,util['format']('%s-%s',Date['now'](),_0x408081['originalname']));}})});router[_0x98ec('0x26')]('/:id/customer_avatar',upload[_0x98ec('0x33')](_0x98ec('0x2f')),controller[_0x98ec('0x35')]);var upload=multer({'storage':multer[_0x98ec('0x29')]({'destination':function(_0x2dd92d,_0x14eee5,_0x42ac9a){_0x42ac9a(null,path[_0x98ec('0x2a')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x559bc4,_0x37f47d,_0x571ee7){_0x571ee7(null,util[_0x98ec('0x2c')](_0x98ec('0x32'),Date[_0x98ec('0x2d')](),_0x37f47d[_0x98ec('0x2e')]));}})});router[_0x98ec('0x26')](_0x98ec('0x19'),upload[_0x98ec('0x33')](_0x98ec('0x2f')),controller[_0x98ec('0x36')]);router['post'](_0x98ec('0x37'),controller[_0x98ec('0x38')]);const offlineUploadMulter=multer({'storage':multer[_0x98ec('0x29')]({'destination':function(_0x1b5e14,_0x10dbb8,_0x1b001e){const _0x5297c2=path[_0x98ec('0x2a')](config['root'],_0x98ec('0x39'),_0x98ec('0x3a'),_0x98ec('0x3b'));fs_extra['ensureDir'](_0x5297c2,function(){_0x1b001e(null,_0x5297c2);});},'filename':function(_0x28daaf,_0xcb725f,_0xb92b23){const _0x213521=_0xcb725f['originalname'][_0x98ec('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x477395=path[_0x98ec('0x3d')](_0x213521);const _0x43d70d=Date[_0x98ec('0x2d')]()+'-'+_0x213521[_0x98ec('0x3c')](_0x477395,'')+_0x477395;_0xb92b23(null,_0x43d70d);}})});router['post'](_0x98ec('0x3e'),offlineUploadMulter['any'](),controller[_0x98ec('0x3f')]);router[_0x98ec('0x26')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router[_0x98ec('0x26')]('/:id/applications',auth[_0x98ec('0xc')](),controller[_0x98ec('0x40')]);router[_0x98ec('0x26')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x98ec('0x41')]);router['post']('/:id/users',auth[_0x98ec('0xc')](),controller['addAgents']);router['put'](_0x98ec('0xf'),auth[_0x98ec('0xc')](),controller[_0x98ec('0x42')]);router[_0x98ec('0x43')]('/:id',auth['isAuthenticated'](),controller[_0x98ec('0x44')]);router['delete'](_0x98ec('0x11'),auth[_0x98ec('0xc')](),controller[_0x98ec('0x45')]);router[_0x98ec('0x43')](_0x98ec('0x13'),auth[_0x98ec('0xc')](),controller['removeAnswers']);router[_0x98ec('0x43')](_0x98ec('0x46'),auth['isAuthenticated'](),controller[_0x98ec('0x47')]);module[_0x98ec('0x48')]=router; \ No newline at end of file +var _0x6bb3=['create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','file','addLogo','server/files/images/avatars/','format','originalname','/:id/avatar','single','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','extname','replace','offline','addInteraction','addApplications','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post'];(function(_0x12c4cd,_0xdebe29){var _0x18a029=function(_0x4c4272){while(--_0x4c4272){_0x12c4cd['push'](_0x12c4cd['shift']());}};_0x18a029(++_0xdebe29);}(_0x6bb3,0x142));var _0x36bb=function(_0x36641f,_0x1de996){_0x36641f=_0x36641f-0x0;var _0x264197=_0x6bb3[_0x36641f];return _0x264197;};'use strict';var multer=require('multer');var util=require(_0x36bb('0x0'));var path=require('path');var timeout=require(_0x36bb('0x1'));var express=require(_0x36bb('0x2'));var router=express[_0x36bb('0x3')]();var fs_extra=require(_0x36bb('0x4'));var auth=require(_0x36bb('0x5'));var interaction=require(_0x36bb('0x6'));var config=require(_0x36bb('0x7'));var controller=require(_0x36bb('0x8'));router[_0x36bb('0x9')]('/',auth[_0x36bb('0xa')](),controller['index']);router[_0x36bb('0x9')](_0x36bb('0xb'),auth[_0x36bb('0xa')](),controller[_0x36bb('0xc')]);router[_0x36bb('0x9')](_0x36bb('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x36bb('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x36bb('0xe')]);router[_0x36bb('0x9')](_0x36bb('0xf'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x10')]);router[_0x36bb('0x9')](_0x36bb('0x11'),controller[_0x36bb('0x12')]);router[_0x36bb('0x9')]('/:id/avatar',controller[_0x36bb('0x13')]);router['get'](_0x36bb('0x14'),controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller[_0x36bb('0x15')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x36bb('0x16')]);router[_0x36bb('0x9')]('/:id/snippet',controller[_0x36bb('0x17')]);router['get'](_0x36bb('0x18'),auth[_0x36bb('0xa')](),controller['getApplications']);router[_0x36bb('0x9')](_0x36bb('0x19'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x1a')]);router[_0x36bb('0x9')](_0x36bb('0x1b'),controller['getFields']);router[_0x36bb('0x9')](_0x36bb('0x1c'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x1d')]);router[_0x36bb('0x9')](_0x36bb('0x1e'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x1f')]);router[_0x36bb('0x20')]('/',auth[_0x36bb('0xa')](),controller[_0x36bb('0x21')]);router[_0x36bb('0x20')](_0x36bb('0x22'),auth['isAuthenticated'](),controller[_0x36bb('0x23')]);router[_0x36bb('0x20')]('/:id/canned_answers',auth[_0x36bb('0xa')](),controller[_0x36bb('0x24')]);var upload=multer({'storage':multer[_0x36bb('0x25')]({'destination':function(_0x2db83f,_0x2789a4,_0x20031e){_0x20031e(null,path[_0x36bb('0x26')](config[_0x36bb('0x27')],_0x36bb('0x28')));},'filename':function(_0x3e7ecc,_0x2cb669,_0x5e7152){_0x5e7152(null,util['format'](_0x36bb('0x29'),Date[_0x36bb('0x2a')](),_0x2cb669['originalname']));}})});router[_0x36bb('0x20')](_0x36bb('0x11'),upload['single'](_0x36bb('0x2b')),controller[_0x36bb('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf21f61,_0xff0c13,_0x5b33be){_0x5b33be(null,path[_0x36bb('0x26')](config[_0x36bb('0x27')],_0x36bb('0x2d')));},'filename':function(_0x1cec0b,_0x465170,_0x3eb143){_0x3eb143(null,util[_0x36bb('0x2e')](_0x36bb('0x29'),Date[_0x36bb('0x2a')](),_0x465170[_0x36bb('0x2f')]));}})});router[_0x36bb('0x20')](_0x36bb('0x30'),upload[_0x36bb('0x31')](_0x36bb('0x2b')),controller[_0x36bb('0x32')]);var upload=multer({'storage':multer[_0x36bb('0x25')]({'destination':function(_0x20faeb,_0x265e52,_0x372801){_0x372801(null,path[_0x36bb('0x26')](config[_0x36bb('0x27')],_0x36bb('0x2d')));},'filename':function(_0xf7c36c,_0x44353a,_0x1aecbc){_0x1aecbc(null,util[_0x36bb('0x2e')](_0x36bb('0x29'),Date[_0x36bb('0x2a')](),_0x44353a[_0x36bb('0x2f')]));}})});router[_0x36bb('0x20')]('/:id/customer_avatar',upload['single'](_0x36bb('0x2b')),controller[_0x36bb('0x33')]);var upload=multer({'storage':multer[_0x36bb('0x25')]({'destination':function(_0x5dc791,_0x16af64,_0x44b9fc){_0x44b9fc(null,path[_0x36bb('0x26')](config[_0x36bb('0x27')],'server/files/images/avatars/'));},'filename':function(_0x4ffa58,_0x551d3b,_0x2c2131){_0x2c2131(null,util['format'](_0x36bb('0x29'),Date[_0x36bb('0x2a')](),_0x551d3b[_0x36bb('0x2f')]));}})});router[_0x36bb('0x20')](_0x36bb('0x34'),upload[_0x36bb('0x31')](_0x36bb('0x2b')),controller[_0x36bb('0x35')]);router['post']('/:id/notify',controller[_0x36bb('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x36bb('0x25')]({'destination':function(_0x52c40b,_0x4492a6,_0x6ac561){const _0xfaa7b2=path[_0x36bb('0x26')](config[_0x36bb('0x27')],'server/files',_0x36bb('0x37'),_0x36bb('0x38'));fs_extra[_0x36bb('0x39')](_0xfaa7b2,function(){_0x6ac561(null,_0xfaa7b2);});},'filename':function(_0x476868,_0x2b1cad,_0x264579){const _0x286bba=_0x2b1cad['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x28da9f=path[_0x36bb('0x3a')](_0x286bba);const _0x15efb2=Date[_0x36bb('0x2a')]()+'-'+_0x286bba[_0x36bb('0x3b')](_0x28da9f,'')+_0x28da9f;_0x264579(null,_0x15efb2);}})});router['post']('/:id/offline',offlineUploadMulter['any'](),controller[_0x36bb('0x3c')]);router[_0x36bb('0x20')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x36bb('0x3d')]);router['post'](_0x36bb('0x18'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x3e')]);router[_0x36bb('0x20')](_0x36bb('0x19'),auth[_0x36bb('0xa')](),controller['addProactiveActions']);router['post'](_0x36bb('0x1e'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x3f')]);router[_0x36bb('0x40')]('/:id',auth['isAuthenticated'](),controller[_0x36bb('0x41')]);router[_0x36bb('0x42')](_0x36bb('0xd'),auth[_0x36bb('0xa')](),controller['destroy']);router[_0x36bb('0x42')]('/:id/dispositions',auth[_0x36bb('0xa')](),controller[_0x36bb('0x43')]);router['delete'](_0x36bb('0xf'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x44')]);router['delete'](_0x36bb('0x1e'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x45')]);module[_0x36bb('0x46')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 52119cb..a471dec 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 _0x1efd=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x376f50,_0x1b6855){var _0x1c5f2e=function(_0x50adf8){while(--_0x50adf8){_0x376f50['push'](_0x376f50['shift']());}};_0x1c5f2e(++_0x1b6855);}(_0x1efd,0x1b1));var _0xd1ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1efd[_0x321bb2];return _0x9c12ed;};var beaverLogger=require(_0xd1ef('0x0'));var express=require(_0xd1ef('0x1'));var auth=require(_0xd1ef('0x2'));var config=require(_0xd1ef('0x3'));var router=express[_0xd1ef('0x4')]();var isProduction=config[_0xd1ef('0x5')]===_0xd1ef('0x6')||![];function clientSideLogs(_0x3b65c5,_0x84acd2,_0x29a935){var _0x5abd43=_0x3b65c5['app']['get'](_0xd1ef('0x7'));if(!_0x5abd43){throw new Error(_0xd1ef('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0xd1ef('0x9'),'logger':_0x5abd43,'enableCors':!isProduction})(_0x3b65c5,_0x84acd2,_0x29a935);}router[_0xd1ef('0xa')](auth[_0xd1ef('0xb')](),clientSideLogs);module[_0xd1ef('0xc')]=router; \ No newline at end of file +var _0x4065=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x4065,0xc8));var _0x5406=function(_0x292e70,_0x4ec903){_0x292e70=_0x292e70-0x0;var _0x507abb=_0x4065[_0x292e70];return _0x507abb;};var beaverLogger=require(_0x5406('0x0'));var express=require(_0x5406('0x1'));var auth=require(_0x5406('0x2'));var config=require('../config/environment');var router=express[_0x5406('0x3')]();var isProduction=config[_0x5406('0x4')]===_0x5406('0x5')||![];function clientSideLogs(_0x3b5e62,_0xb7b26b,_0x1818c9){var _0x496b42=_0x3b5e62['app'][_0x5406('0x6')](_0x5406('0x7'));if(!_0x496b42){throw new Error(_0x5406('0x8'));}return beaverLogger[_0x5406('0x9')]({'uri':_0x5406('0xa'),'logger':_0x496b42,'enableCors':!isProduction})(_0x3b5e62,_0xb7b26b,_0x1818c9);}router[_0x5406('0xb')](auth[_0x5406('0xc')](),clientSideLogs);module[_0x5406('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7e95244..35ffea4 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 _0x5f54=['TEXT','MicrosoftAzure\x20=>\x20refresh_token','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0xb44dbb,_0x3f0bd3){var _0x46f99c=function(_0x145809){while(--_0x145809){_0xb44dbb['push'](_0xb44dbb['shift']());}};_0x46f99c(++_0x3f0bd3);}(_0x5f54,0x1c5));var _0x45f5=function(_0x38f11,_0x1c486d){_0x38f11=_0x38f11-0x0;var _0x57fab9=_0x5f54[_0x38f11];return _0x57fab9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x45f5('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x45f5('0x1')]('AmazonAWS',_0x45f5('0x2'),_0x45f5('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x45f5('0x1')](_0x45f5('0x4'),_0x45f5('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x45f5('0x6')},'data2':{'type':Sequelize[_0x45f5('0x0')],'comment':_0x45f5('0x7')},'data3':{'type':Sequelize[_0x45f5('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x45f5('0x0')],'comment':_0x45f5('0x8')},'data5':{'type':Sequelize[_0x45f5('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x45f5('0x9')],'comment':_0x45f5('0xa')},'data7':{'type':Sequelize[_0x45f5('0x9')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x03ad=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x5ed475,_0x3a75b9){var _0x543d0e=function(_0xbd2a0a){while(--_0xbd2a0a){_0x5ed475['push'](_0x5ed475['shift']());}};_0x543d0e(++_0x3a75b9);}(_0x03ad,0xe5));var _0xd03a=function(_0x2d093b,_0x460963){_0x2d093b=_0x2d093b-0x0;var _0x1abe4e=_0x03ad[_0x2d093b];return _0x1abe4e;};'use strict';var Sequelize=require(_0xd03a('0x0'));module['exports']={'name':{'type':Sequelize[_0xd03a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd03a('0x2')](_0xd03a('0x3'),_0xd03a('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xd03a('0x2')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0xd03a('0x1')],'comment':_0xd03a('0x5')},'data2':{'type':Sequelize[_0xd03a('0x1')],'comment':_0xd03a('0x6')},'data3':{'type':Sequelize['STRING'],'comment':_0xd03a('0x7')},'data4':{'type':Sequelize[_0xd03a('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0xd03a('0x8')},'data6':{'type':Sequelize[_0xd03a('0x9')],'comment':_0xd03a('0xa')},'data7':{'type':Sequelize[_0xd03a('0x9')],'comment':_0xd03a('0xb')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8f0107c..37d96a9 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 _0xd666=['filter','merge','VIRTUAL','CloudProvider','count','includeAll','MicrosoftAzure','decryptString','data3','show','params','keys','include','find','service','catch','body','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','defaults','localhost','socket.io-emitter','redis','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','update','then','destroy','stack','name','send','padEnd','slice','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x4ec8d2,_0x2bd974){var _0x4bf615=function(_0x326098){while(--_0x326098){_0x4ec8d2['push'](_0x4ec8d2['shift']());}};_0x4bf615(++_0x2bd974);}(_0xd666,0xeb));var _0x6d66=function(_0x5b6a86,_0x59489c){_0x5b6a86=_0x5b6a86-0x0;var _0x425888=_0xd666[_0x5b6a86];return _0x425888;};'use strict';var _=require(_0x6d66('0x0'));var Redis=require('ioredis');var qs=require(_0x6d66('0x1'));var encryptor=require(_0x6d66('0x2'));var config=require(_0x6d66('0x3'));var logger=require(_0x6d66('0x4'))(_0x6d66('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x6d66('0x6'));config['redis']=_[_0x6d66('0x7')](config['redis'],{'host':_0x6d66('0x8'),'port':0x18eb});var socket=require(_0x6d66('0x9'))(new Redis(config[_0x6d66('0xa')]));var redis=new Redis(config[_0x6d66('0xa')]);function respondWithStatusCode(_0x1da666,_0x47fbdf){_0x47fbdf=_0x47fbdf||0xcc;return function(_0x19ca6e){if(_0x19ca6e){return _0x1da666[_0x6d66('0xb')](_0x47fbdf);}return _0x1da666['status'](_0x47fbdf)[_0x6d66('0xc')]();};}function respondWithResult(_0x261b10,_0x1dfb75){_0x1dfb75=_0x1dfb75||0xc8;return function(_0x4722a3){if(_0x4722a3){return _0x261b10[_0x6d66('0xd')](_0x1dfb75)[_0x6d66('0xe')](_0x4722a3);}};}function respondWithFilteredResult(_0x2ec9d3,_0x28167d){return function(_0x5ca3e8){if(_0x5ca3e8){var _0x3f3025=typeof _0x28167d['offset']===_0x6d66('0xf')&&typeof _0x28167d[_0x6d66('0x10')]===_0x6d66('0xf');var _0x3b0115=_0x5ca3e8['count'];var _0xc4d885=_0x3f3025?0x0:_0x28167d[_0x6d66('0x11')];var _0x5b81e0=_0x3f3025?_0x5ca3e8['count']:_0x28167d[_0x6d66('0x11')]+_0x28167d[_0x6d66('0x10')];var _0x48c274;if(_0x5b81e0>=_0x3b0115){_0x5b81e0=_0x3b0115;_0x48c274=0xc8;}else{_0x48c274=0xce;}_0x2ec9d3[_0x6d66('0xd')](_0x48c274);return _0x2ec9d3[_0x6d66('0x12')](_0x6d66('0x13'),_0xc4d885+'-'+_0x5b81e0+'/'+_0x3b0115)['json'](_0x5ca3e8);}return null;};}function saveUpdates(_0xe7f5ec){return function(_0x43f75d){if(_0x43f75d){return _0x43f75d[_0x6d66('0x14')](_0xe7f5ec)[_0x6d66('0x15')](function(_0x726fd6){return _0x726fd6;});}return null;};}function removeEntity(_0x2992f9){return function(_0x3f52ed){if(_0x3f52ed){return _0x3f52ed[_0x6d66('0x16')]()['then'](function(){_0x2992f9[_0x6d66('0xd')](0xcc)[_0x6d66('0xc')]();});}};}function handleEntityNotFound(_0x5343c2){return function(_0x5cb30c){if(!_0x5cb30c){_0x5343c2[_0x6d66('0xb')](0x194);}return _0x5cb30c;};}function handleError(_0x36683e,_0x3f3e0a){_0x3f3e0a=_0x3f3e0a||0x1f4;return function(_0xa76e5c){logger['error'](_0xa76e5c[_0x6d66('0x17')]);if(_0xa76e5c[_0x6d66('0x18')]){delete _0xa76e5c[_0x6d66('0x18')];}_0x36683e[_0x6d66('0xd')](_0x3f3e0a)[_0x6d66('0x19')](_0xa76e5c);};}function maskClientSecret(_0x4e1282){return _[_0x6d66('0x1a')](_0x4e1282[_0x6d66('0x1b')](0x0,0x3),0x14,'*');}exports[_0x6d66('0x1c')]=function(_0x4694a9,_0x36b96c){var _0x33ab08={},_0x45c33b={},_0x2c1d08={'count':0x0,'rows':[]};var _0x969e85=_['map'](db['CloudProvider'][_0x6d66('0x1d')],function(_0x1b48af){return{'name':_0x1b48af[_0x6d66('0x1e')],'type':_0x1b48af[_0x6d66('0x1f')]['key']};});_0x45c33b[_0x6d66('0x20')]=_[_0x6d66('0x21')](_0x969e85,_0x6d66('0x18'));_0x45c33b[_0x6d66('0x22')]=_['keys'](_0x4694a9[_0x6d66('0x22')]);_0x45c33b[_0x6d66('0x23')]=_[_0x6d66('0x24')](_0x45c33b['model'],_0x45c33b[_0x6d66('0x22')]);_0x33ab08[_0x6d66('0x25')]=_[_0x6d66('0x24')](_0x45c33b[_0x6d66('0x20')],qs[_0x6d66('0x26')](_0x4694a9['query'][_0x6d66('0x26')]));_0x33ab08[_0x6d66('0x25')]=_0x33ab08[_0x6d66('0x25')][_0x6d66('0x27')]?_0x33ab08[_0x6d66('0x25')]:_0x45c33b[_0x6d66('0x20')];if(!_0x4694a9['query']['hasOwnProperty']('nolimit')){_0x33ab08[_0x6d66('0x10')]=qs[_0x6d66('0x10')](_0x4694a9[_0x6d66('0x22')]['limit']);_0x33ab08['offset']=qs['offset'](_0x4694a9[_0x6d66('0x22')][_0x6d66('0x11')]);}_0x33ab08[_0x6d66('0x28')]=qs[_0x6d66('0x29')](_0x4694a9[_0x6d66('0x22')][_0x6d66('0x29')]);_0x33ab08[_0x6d66('0x2a')]=qs[_0x6d66('0x23')](_[_0x6d66('0x2b')](_0x4694a9['query'],_0x45c33b[_0x6d66('0x23')]),_0x969e85);if(_0x4694a9['query'][_0x6d66('0x2c')]){_0x33ab08[_0x6d66('0x2a')]=_[_0x6d66('0x2d')](_0x33ab08['where'],{'$or':_['map'](_0x969e85,function(_0x163a72){if(_0x163a72[_0x6d66('0x1f')]!==_0x6d66('0x2e')){var _0x558eb3={};_0x558eb3[_0x163a72[_0x6d66('0x18')]]={'$like':'%'+_0x4694a9[_0x6d66('0x22')][_0x6d66('0x2c')]+'%'};return _0x558eb3;}})});}_0x33ab08=_[_0x6d66('0x2d')]({},_0x33ab08,_0x4694a9['options']);var _0x23b721={'where':_0x33ab08[_0x6d66('0x2a')]};return db[_0x6d66('0x2f')][_0x6d66('0x30')](_0x23b721)['then'](function(_0x55d3c6){_0x2c1d08['count']=_0x55d3c6;if(_0x4694a9[_0x6d66('0x22')][_0x6d66('0x31')]){_0x33ab08['include']=[{'all':!![]}];}return db[_0x6d66('0x2f')]['findAll'](_0x33ab08);})[_0x6d66('0x15')](function(_0x54638d){_0x2c1d08['rows']=_[_0x6d66('0x21')](_0x54638d,function(_0x12881){if(_0x12881['service']===_0x6d66('0x32')){var _0x4df646=encryptor[_0x6d66('0x33')](_0x12881[_0x6d66('0x34')]);_0x12881[_0x6d66('0x34')]=maskClientSecret(_0x4df646);}return _0x12881;});return _0x2c1d08;})['then'](respondWithFilteredResult(_0x36b96c,_0x33ab08))['catch'](handleError(_0x36b96c,null));};exports[_0x6d66('0x35')]=function(_0x599f2e,_0x3c8807){var _0x28da24={'raw':!![],'where':{'id':_0x599f2e[_0x6d66('0x36')]['id']}},_0x213034={};_0x213034[_0x6d66('0x20')]=_[_0x6d66('0x37')](db['CloudProvider'][_0x6d66('0x1d')]);_0x213034[_0x6d66('0x22')]=_[_0x6d66('0x37')](_0x599f2e[_0x6d66('0x22')]);_0x213034['filters']=_['intersection'](_0x213034[_0x6d66('0x20')],_0x213034[_0x6d66('0x22')]);_0x28da24['attributes']=_[_0x6d66('0x24')](_0x213034[_0x6d66('0x20')],qs['fields'](_0x599f2e['query'][_0x6d66('0x26')]));_0x28da24['attributes']=_0x28da24[_0x6d66('0x25')][_0x6d66('0x27')]?_0x28da24[_0x6d66('0x25')]:_0x213034[_0x6d66('0x20')];if(_0x599f2e[_0x6d66('0x22')][_0x6d66('0x31')]){_0x28da24[_0x6d66('0x38')]=[{'all':!![]}];}_0x28da24=_[_0x6d66('0x2d')]({},_0x28da24,_0x599f2e['options']);return db[_0x6d66('0x2f')][_0x6d66('0x39')](_0x28da24)['then'](handleEntityNotFound(_0x3c8807,null))[_0x6d66('0x15')](function(_0x33d542){if(_0x33d542[_0x6d66('0x3a')]===_0x6d66('0x32')){var _0x41aca6=encryptor['decryptString'](_0x33d542[_0x6d66('0x34')]);_0x33d542[_0x6d66('0x34')]=maskClientSecret(_0x41aca6);}return _0x33d542;})[_0x6d66('0x15')](respondWithResult(_0x3c8807,null))[_0x6d66('0x3b')](handleError(_0x3c8807,null));};exports['create']=function(_0x12be56,_0x17aed6){if(!_0x12be56['body'][_0x6d66('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x12be56[_0x6d66('0x3c')][_0x6d66('0x3a')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x1f75f0=db[_0x6d66('0x2f')][_0x6d66('0x1d')]['service'][_0x6d66('0x3d')];if(!_0x1f75f0['includes'](_0x12be56[_0x6d66('0x3c')][_0x6d66('0x3a')]))throw new Error(_0x6d66('0x3e')+_0x1f75f0[_0x6d66('0x3f')](',\x20'));if(_0x12be56[_0x6d66('0x3c')][_0x6d66('0x3a')]==='MicrosoftAzure'&&_0x12be56[_0x6d66('0x3c')]['data3']){_0x12be56[_0x6d66('0x3c')][_0x6d66('0x34')]=encryptor[_0x6d66('0x40')](_0x12be56[_0x6d66('0x3c')][_0x6d66('0x34')]);}return db[_0x6d66('0x2f')]['create'](_0x12be56['body'],{})['then'](respondWithResult(_0x17aed6,0xc9))[_0x6d66('0x3b')](handleError(_0x17aed6,null));};exports[_0x6d66('0x14')]=function(_0x6a044d,_0x24a1a6){if(_0x6a044d['body']['id']){delete _0x6a044d[_0x6d66('0x3c')]['id'];}return db[_0x6d66('0x2f')][_0x6d66('0x39')]({'where':{'id':_0x6a044d[_0x6d66('0x36')]['id']}})[_0x6d66('0x15')](handleEntityNotFound(_0x24a1a6,null))['then'](function(_0x4daf35){if(_0x4daf35[_0x6d66('0x3a')]===_0x6d66('0x32')&&_0x6a044d['body'][_0x6d66('0x34')]){_0x6a044d[_0x6d66('0x3c')]['data3']=encryptor[_0x6d66('0x40')](_0x6a044d[_0x6d66('0x3c')][_0x6d66('0x34')]);}return _0x4daf35;})['then'](saveUpdates(_0x6a044d['body'],null))[_0x6d66('0x15')](respondWithResult(_0x24a1a6,null))['catch'](handleError(_0x24a1a6,null));};exports['destroy']=function(_0x2738d1,_0x37cb0a){return db[_0x6d66('0x2f')][_0x6d66('0x39')]({'where':{'id':_0x2738d1['params']['id']}})['then'](handleEntityNotFound(_0x37cb0a,null))[_0x6d66('0x15')](removeEntity(_0x37cb0a,null))[_0x6d66('0x3b')](handleError(_0x37cb0a,null));};exports[_0x6d66('0x41')]=function(_0x835d45,_0x5e79ec){return db[_0x6d66('0x2f')]['findOne']({'where':{'id':_0x835d45[_0x6d66('0x36')]['id']},'raw':!![]})['then'](function(_0x9a4f78){if(!_0x9a4f78)return _0x5e79ec[_0x6d66('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x9a4f78,_0x835d45[_0x6d66('0x42')]['id'])};})[_0x6d66('0x15')](respondWithResult(_0x5e79ec,null))[_0x6d66('0x3b')](handleError(_0x5e79ec,null));};exports[_0x6d66('0x43')]=function(_0x4fde6c,_0x3ebe94){var _0x5aeb67=_0x4fde6c[_0x6d66('0x3c')];var _0x2c5500;var _0x4a70ab;if(_0x5aeb67[_0x6d66('0x44')])throw _0x5aeb67;redis[_0x6d66('0x45')](_0x5aeb67[_0x6d66('0x46')])[_0x6d66('0x15')](function(_0x366eb4){if(!_0x366eb4)throw new Error(_0x6d66('0x47'));_0x2c5500=JSON[_0x6d66('0x48')](_0x366eb4);var _0x3a40ab=Buffer[_0x6d66('0x49')](_0x5aeb67[_0x6d66('0x46')],_0x6d66('0x4a'))[_0x6d66('0x4b')](_0x6d66('0x4c'));_0x4a70ab=JSON[_0x6d66('0x48')](_0x3a40ab);if(!oauth[_0x6d66('0x4d')](_0x5aeb67[_0x6d66('0x4e')],_0x2c5500[_0x6d66('0x4f')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x5aeb67['state']);return oauth[_0x6d66('0x50')](_0x5aeb67[_0x6d66('0x51')],_0x2c5500);})[_0x6d66('0x15')](function(_0x7ed3b4){_0x2c5500[_0x6d66('0x52')]=_0x7ed3b4[_0x6d66('0x53')];_0x2c5500[_0x6d66('0x54')]=_0x7ed3b4[_0x6d66('0x55')];return db[_0x6d66('0x2f')][_0x6d66('0x14')]({'data5':_0x2c5500[_0x6d66('0x52')],'data6':_0x2c5500[_0x6d66('0x54')]},{'where':{'id':_0x2c5500['id']}});})[_0x6d66('0x15')](function(){oauth[_0x6d66('0x56')](_0x2c5500);socket[_0x6d66('0x57')](_0x6d66('0x58'),{'id':_0x4a70ab['id']});return;})[_0x6d66('0x15')](respondWithStatusCode(_0x3ebe94,null))['catch'](function(_0x3d6f0d){if(_0x4a70ab){socket['emit'](_0x6d66('0x59'),{'id':_0x4a70ab['id']});}if(!_0x2c5500){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x3d6f0d);return _0x3ebe94[_0x6d66('0xd')](0x1f4)[_0x6d66('0x19')](_0x3d6f0d[_0x6d66('0x5a')]);}logger[_0x6d66('0x44')](_0x6d66('0x5b'),_0x2c5500['id'],JSON[_0x6d66('0x5c')](_0x3d6f0d));});}; \ No newline at end of file +var _0x5178=['oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','emit','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','Content-Range','update','then','error','stack','send','map','CloudProvider','fieldName','type','model','name','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','service','MicrosoftAzure','data3','catch','show','params','keys','rawAttributes','filters','find','decryptString','create','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy'];(function(_0x17ccc0,_0x9c3b80){var _0x1f1dd3=function(_0x5406b8){while(--_0x5406b8){_0x17ccc0['push'](_0x17ccc0['shift']());}};_0x1f1dd3(++_0x9c3b80);}(_0x5178,0x17b));var _0x8517=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5178[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var Redis=require(_0x8517('0x0'));var qs=require(_0x8517('0x1'));var encryptor=require(_0x8517('0x2'));var config=require(_0x8517('0x3'));var logger=require(_0x8517('0x4'))(_0x8517('0x5'));var db=require(_0x8517('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x8517('0x7')]=_[_0x8517('0x8')](config[_0x8517('0x7')],{'host':_0x8517('0x9'),'port':0x18eb});var socket=require(_0x8517('0xa'))(new Redis(config[_0x8517('0x7')]));var redis=new Redis(config[_0x8517('0x7')]);function respondWithStatusCode(_0x32ed0c,_0x3514c1){_0x3514c1=_0x3514c1||0xcc;return function(_0x2f249c){if(_0x2f249c){return _0x32ed0c[_0x8517('0xb')](_0x3514c1);}return _0x32ed0c['status'](_0x3514c1)[_0x8517('0xc')]();};}function respondWithResult(_0x1dfeeb,_0x285d03){_0x285d03=_0x285d03||0xc8;return function(_0x11dbd1){if(_0x11dbd1){return _0x1dfeeb[_0x8517('0xd')](_0x285d03)[_0x8517('0xe')](_0x11dbd1);}};}function respondWithFilteredResult(_0x5b7fdc,_0x2f1749){return function(_0x800736){if(_0x800736){var _0x548e1c=typeof _0x2f1749[_0x8517('0xf')]===_0x8517('0x10')&&typeof _0x2f1749[_0x8517('0x11')]===_0x8517('0x10');var _0x10f69f=_0x800736['count'];var _0x42ea53=_0x548e1c?0x0:_0x2f1749[_0x8517('0xf')];var _0xd0b60f=_0x548e1c?_0x800736['count']:_0x2f1749[_0x8517('0xf')]+_0x2f1749[_0x8517('0x11')];var _0x2ef334;if(_0xd0b60f>=_0x10f69f){_0xd0b60f=_0x10f69f;_0x2ef334=0xc8;}else{_0x2ef334=0xce;}_0x5b7fdc[_0x8517('0xd')](_0x2ef334);return _0x5b7fdc['set'](_0x8517('0x12'),_0x42ea53+'-'+_0xd0b60f+'/'+_0x10f69f)['json'](_0x800736);}return null;};}function saveUpdates(_0x35da83){return function(_0x393994){if(_0x393994){return _0x393994[_0x8517('0x13')](_0x35da83)[_0x8517('0x14')](function(_0x2846b7){return _0x2846b7;});}return null;};}function removeEntity(_0x374903){return function(_0x36feaf){if(_0x36feaf){return _0x36feaf['destroy']()[_0x8517('0x14')](function(){_0x374903[_0x8517('0xd')](0xcc)[_0x8517('0xc')]();});}};}function handleEntityNotFound(_0x2adfe3){return function(_0x48d882){if(!_0x48d882){_0x2adfe3[_0x8517('0xb')](0x194);}return _0x48d882;};}function handleError(_0x392bc8,_0x18b523){_0x18b523=_0x18b523||0x1f4;return function(_0x337c42){logger[_0x8517('0x15')](_0x337c42[_0x8517('0x16')]);if(_0x337c42['name']){delete _0x337c42['name'];}_0x392bc8[_0x8517('0xd')](_0x18b523)[_0x8517('0x17')](_0x337c42);};}function maskClientSecret(_0xba24f9){return _['padEnd'](_0xba24f9['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x475a9c,_0x31120c){var _0x290e7c={},_0x365182={},_0x5399ba={'count':0x0,'rows':[]};var _0x4c4415=_[_0x8517('0x18')](db[_0x8517('0x19')]['rawAttributes'],function(_0x45c102){return{'name':_0x45c102[_0x8517('0x1a')],'type':_0x45c102[_0x8517('0x1b')]['key']};});_0x365182[_0x8517('0x1c')]=_['map'](_0x4c4415,_0x8517('0x1d'));_0x365182['query']=_['keys'](_0x475a9c[_0x8517('0x1e')]);_0x365182['filters']=_[_0x8517('0x1f')](_0x365182[_0x8517('0x1c')],_0x365182[_0x8517('0x1e')]);_0x290e7c[_0x8517('0x20')]=_[_0x8517('0x1f')](_0x365182[_0x8517('0x1c')],qs[_0x8517('0x21')](_0x475a9c[_0x8517('0x1e')][_0x8517('0x21')]));_0x290e7c['attributes']=_0x290e7c['attributes'][_0x8517('0x22')]?_0x290e7c[_0x8517('0x20')]:_0x365182['model'];if(!_0x475a9c[_0x8517('0x1e')]['hasOwnProperty'](_0x8517('0x23'))){_0x290e7c['limit']=qs[_0x8517('0x11')](_0x475a9c[_0x8517('0x1e')][_0x8517('0x11')]);_0x290e7c[_0x8517('0xf')]=qs['offset'](_0x475a9c[_0x8517('0x1e')][_0x8517('0xf')]);}_0x290e7c['order']=qs[_0x8517('0x24')](_0x475a9c[_0x8517('0x1e')][_0x8517('0x24')]);_0x290e7c[_0x8517('0x25')]=qs['filters'](_[_0x8517('0x26')](_0x475a9c[_0x8517('0x1e')],_0x365182['filters']),_0x4c4415);if(_0x475a9c['query'][_0x8517('0x27')]){_0x290e7c[_0x8517('0x25')]=_[_0x8517('0x28')](_0x290e7c['where'],{'$or':_[_0x8517('0x18')](_0x4c4415,function(_0x52fa99){if(_0x52fa99[_0x8517('0x1b')]!==_0x8517('0x29')){var _0x17012d={};_0x17012d[_0x52fa99[_0x8517('0x1d')]]={'$like':'%'+_0x475a9c[_0x8517('0x1e')][_0x8517('0x27')]+'%'};return _0x17012d;}})});}_0x290e7c=_[_0x8517('0x28')]({},_0x290e7c,_0x475a9c[_0x8517('0x2a')]);var _0x2ef168={'where':_0x290e7c[_0x8517('0x25')]};return db['CloudProvider'][_0x8517('0x2b')](_0x2ef168)[_0x8517('0x14')](function(_0x262cec){_0x5399ba['count']=_0x262cec;if(_0x475a9c[_0x8517('0x1e')][_0x8517('0x2c')]){_0x290e7c[_0x8517('0x2d')]=[{'all':!![]}];}return db[_0x8517('0x19')][_0x8517('0x2e')](_0x290e7c);})[_0x8517('0x14')](function(_0x152c54){_0x5399ba['rows']=_[_0x8517('0x18')](_0x152c54,function(_0x1c8183){if(_0x1c8183[_0x8517('0x2f')]===_0x8517('0x30')){var _0x461376=encryptor['decryptString'](_0x1c8183[_0x8517('0x31')]);_0x1c8183['data3']=maskClientSecret(_0x461376);}return _0x1c8183;});return _0x5399ba;})[_0x8517('0x14')](respondWithFilteredResult(_0x31120c,_0x290e7c))[_0x8517('0x32')](handleError(_0x31120c,null));};exports[_0x8517('0x33')]=function(_0x23c9b8,_0xc6ab81){var _0x4b1b6d={'raw':!![],'where':{'id':_0x23c9b8[_0x8517('0x34')]['id']}},_0x3cb45a={};_0x3cb45a[_0x8517('0x1c')]=_[_0x8517('0x35')](db['CloudProvider'][_0x8517('0x36')]);_0x3cb45a[_0x8517('0x1e')]=_[_0x8517('0x35')](_0x23c9b8['query']);_0x3cb45a[_0x8517('0x37')]=_[_0x8517('0x1f')](_0x3cb45a['model'],_0x3cb45a[_0x8517('0x1e')]);_0x4b1b6d[_0x8517('0x20')]=_[_0x8517('0x1f')](_0x3cb45a[_0x8517('0x1c')],qs['fields'](_0x23c9b8[_0x8517('0x1e')][_0x8517('0x21')]));_0x4b1b6d[_0x8517('0x20')]=_0x4b1b6d[_0x8517('0x20')][_0x8517('0x22')]?_0x4b1b6d[_0x8517('0x20')]:_0x3cb45a[_0x8517('0x1c')];if(_0x23c9b8[_0x8517('0x1e')][_0x8517('0x2c')]){_0x4b1b6d[_0x8517('0x2d')]=[{'all':!![]}];}_0x4b1b6d=_[_0x8517('0x28')]({},_0x4b1b6d,_0x23c9b8[_0x8517('0x2a')]);return db[_0x8517('0x19')][_0x8517('0x38')](_0x4b1b6d)[_0x8517('0x14')](handleEntityNotFound(_0xc6ab81,null))[_0x8517('0x14')](function(_0x22830d){if(_0x22830d['service']===_0x8517('0x30')){var _0x16dd08=encryptor[_0x8517('0x39')](_0x22830d[_0x8517('0x31')]);_0x22830d[_0x8517('0x31')]=maskClientSecret(_0x16dd08);}return _0x22830d;})['then'](respondWithResult(_0xc6ab81,null))['catch'](handleError(_0xc6ab81,null));};exports[_0x8517('0x3a')]=function(_0x596da1,_0x49ce35){if(!_0x596da1[_0x8517('0x3b')][_0x8517('0x1d')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x596da1[_0x8517('0x3b')][_0x8517('0x2f')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x4a52a3=db[_0x8517('0x19')]['rawAttributes']['service'][_0x8517('0x3c')];if(!_0x4a52a3[_0x8517('0x3d')](_0x596da1['body'][_0x8517('0x2f')]))throw new Error(_0x8517('0x3e')+_0x4a52a3[_0x8517('0x3f')](',\x20'));if(_0x596da1[_0x8517('0x3b')]['service']===_0x8517('0x30')&&_0x596da1[_0x8517('0x3b')][_0x8517('0x31')]){_0x596da1[_0x8517('0x3b')][_0x8517('0x31')]=encryptor['encryptString'](_0x596da1['body'][_0x8517('0x31')]);}return db[_0x8517('0x19')][_0x8517('0x3a')](_0x596da1[_0x8517('0x3b')],{})[_0x8517('0x14')](respondWithResult(_0x49ce35,0xc9))[_0x8517('0x32')](handleError(_0x49ce35,null));};exports[_0x8517('0x13')]=function(_0x13101b,_0x3129c7){if(_0x13101b['body']['id']){delete _0x13101b[_0x8517('0x3b')]['id'];}return db['CloudProvider'][_0x8517('0x38')]({'where':{'id':_0x13101b['params']['id']}})[_0x8517('0x14')](handleEntityNotFound(_0x3129c7,null))['then'](function(_0x23ed23){if(_0x23ed23[_0x8517('0x2f')]===_0x8517('0x30')&&_0x13101b[_0x8517('0x3b')]['data3']){_0x13101b[_0x8517('0x3b')]['data3']=encryptor[_0x8517('0x40')](_0x13101b[_0x8517('0x3b')][_0x8517('0x31')]);}return _0x23ed23;})[_0x8517('0x14')](saveUpdates(_0x13101b['body'],null))[_0x8517('0x14')](respondWithResult(_0x3129c7,null))[_0x8517('0x32')](handleError(_0x3129c7,null));};exports[_0x8517('0x41')]=function(_0x245bc0,_0x28de09){return db[_0x8517('0x19')][_0x8517('0x38')]({'where':{'id':_0x245bc0[_0x8517('0x34')]['id']}})['then'](handleEntityNotFound(_0x28de09,null))[_0x8517('0x14')](removeEntity(_0x28de09,null))['catch'](handleError(_0x28de09,null));};exports[_0x8517('0x42')]=function(_0x125c20,_0x48c48e){return db[_0x8517('0x19')][_0x8517('0x43')]({'where':{'id':_0x125c20['params']['id']},'raw':!![]})[_0x8517('0x14')](function(_0x437aa2){if(!_0x437aa2)return _0x48c48e[_0x8517('0xb')](0x194);return{'url':oauth[_0x8517('0x44')](_0x437aa2,_0x125c20['user']['id'])};})[_0x8517('0x14')](respondWithResult(_0x48c48e,null))[_0x8517('0x32')](handleError(_0x48c48e,null));};exports[_0x8517('0x45')]=function(_0x413d20,_0x168713){var _0x3b4ce6=_0x413d20[_0x8517('0x3b')];var _0x564283;var _0x2b9278;if(_0x3b4ce6[_0x8517('0x15')])throw _0x3b4ce6;redis['get'](_0x3b4ce6[_0x8517('0x46')])[_0x8517('0x14')](function(_0x4bba55){if(!_0x4bba55)throw new Error(_0x8517('0x47'));_0x564283=JSON[_0x8517('0x48')](_0x4bba55);var _0x46705d=Buffer[_0x8517('0x49')](_0x3b4ce6[_0x8517('0x46')],_0x8517('0x4a'))['toString']('ascii');_0x2b9278=JSON['parse'](_0x46705d);if(!oauth[_0x8517('0x4b')](_0x3b4ce6[_0x8517('0x4c')],_0x564283[_0x8517('0x4d')]))throw new Error(_0x8517('0x4e'));redis['del'](_0x3b4ce6[_0x8517('0x46')]);return oauth[_0x8517('0x4f')](_0x3b4ce6[_0x8517('0x50')],_0x564283);})[_0x8517('0x14')](function(_0x9ab90d){_0x564283['data5']=_0x9ab90d[_0x8517('0x51')];_0x564283[_0x8517('0x52')]=_0x9ab90d[_0x8517('0x53')];return db['CloudProvider']['update']({'data5':_0x564283[_0x8517('0x54')],'data6':_0x564283['data6']},{'where':{'id':_0x564283['id']}});})[_0x8517('0x14')](function(){oauth['startRefreshInterval'](_0x564283);socket[_0x8517('0x55')]('microsoftAuthorization:success',{'id':_0x2b9278['id']});return;})['then'](respondWithStatusCode(_0x168713,null))['catch'](function(_0x616a81){if(_0x2b9278){socket[_0x8517('0x55')]('microsoftAuthorization:error',{'id':_0x2b9278['id']});}if(!_0x564283){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x616a81);return _0x168713['status'](0x1f4)[_0x8517('0x17')](_0x616a81[_0x8517('0x56')]);}logger[_0x8517('0x15')](_0x8517('0x57'),_0x564283['id'],JSON[_0x8517('0x58')](_0x616a81));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e6bd1c3..c3eacc2 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 _0x7901=['exports','define','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x25079d,_0x1aca2b){var _0xf3f2a5=function(_0x2f1ad0){while(--_0x2f1ad0){_0x25079d['push'](_0x25079d['shift']());}};_0xf3f2a5(++_0x1aca2b);}(_0x7901,0xb8));var _0x1790=function(_0x45d123,_0x5bad15){_0x45d123=_0x45d123-0x0;var _0x4ee572=_0x7901[_0x45d123];return _0x4ee572;};'use strict';var _=require(_0x1790('0x0'));var util=require('util');var logger=require(_0x1790('0x1'))(_0x1790('0x2'));var moment=require(_0x1790('0x3'));var BPromise=require(_0x1790('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1790('0x5'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x1790('0x6')]=function(_0xaf6c1b,_0x20fffb){return _0xaf6c1b[_0x1790('0x7')](_0x1790('0x8'),attributes,{'tableName':_0x1790('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71d3=['./cloudProvider.attributes','exports','CloudProvider','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x2aa0f6,_0x50784f){var _0x3555e2=function(_0x29b9d4){while(--_0x29b9d4){_0x2aa0f6['push'](_0x2aa0f6['shift']());}};_0x3555e2(++_0x50784f);}(_0x71d3,0x193));var _0x371d=function(_0xc71e2a,_0x44cf5a){_0xc71e2a=_0xc71e2a-0x0;var _0x51f7ff=_0x71d3[_0xc71e2a];return _0x51f7ff;};'use strict';var _=require(_0x371d('0x0'));var util=require(_0x371d('0x1'));var logger=require(_0x371d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x371d('0x3'));var rp=require(_0x371d('0x4'));var fs=require('fs');var path=require(_0x371d('0x5'));var rimraf=require(_0x371d('0x6'));var config=require('../../config/environment');var attributes=require(_0x371d('0x7'));module[_0x371d('0x8')]=function(_0x2cb80b,_0x24867b){return _0x2cb80b['define'](_0x371d('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 2ace7d9..d5e5787 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 _0x6007=['openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','map','Dynamics365','push','data7','/.default','join','type','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','data1','redirect_uri','data4','scope','state','nonce','login','key','oauth2Claims','replace','oauth2/','decode','payload','issuer','aud','resolve','then','CloudProvider','findOne','refresh_token','decryptString','data3','POST','data5','access_token','data6','error','authorization_code','intervals','bind','findAll','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0'];(function(_0x1d103e,_0x58fbe1){var _0x429026=function(_0x34c60e){while(--_0x34c60e){_0x1d103e['push'](_0x1d103e['shift']());}};_0x429026(++_0x58fbe1);}(_0x6007,0x168));var _0x7600=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x6007[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x7600('0x0'));var crypto=require('crypto');var jwt=require(_0x7600('0x1'));var moment=require(_0x7600('0x2'));var Redis=require('ioredis');var rp=require(_0x7600('0x3'));var util=require(_0x7600('0x4'));var encryptor=require(_0x7600('0x5'));var config=require(_0x7600('0x6'));var logger=require(_0x7600('0x7'))(_0x7600('0x8'));var schedule=require(_0x7600('0x9'));var db=require(_0x7600('0xa'))['db'];config[_0x7600('0xb')]=_[_0x7600('0xc')](config[_0x7600('0xb')],{'host':_0x7600('0xd'),'port':0x18eb});var redis=new Redis(config[_0x7600('0xb')]);var MICROSOFT_AUTH_URL=_0x7600('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x7600('0xf'),_0x7600('0x10'),_0x7600('0x11'),_0x7600('0x12'),_0x7600('0x13'),_0x7600('0x14'),_0x7600('0x15')],'Dynamics365':[_0x7600('0xf'),_0x7600('0x12')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x33d21f){var _0x22dc93=_[_0x7600('0x16')](AZURE_AUTH_SCOPES[_0x33d21f['type']]);if(_0x33d21f['type']===_0x7600('0x17'))_0x22dc93[_0x7600('0x18')](_0x33d21f[_0x7600('0x19')]+_0x7600('0x1a'));return _0x22dc93[_0x7600('0x1b')]('\x20');}function getAccessTokenScope(_0x34ad9f){if(_0x34ad9f[_0x7600('0x1c')]===_0x7600('0x1d'))return _0x7600('0x13');if(_0x34ad9f[_0x7600('0x1c')]==='Dynamics365')return _0x34ad9f[_0x7600('0x19')]+_0x7600('0x1a');}function generateMicrosoftAuthorizationUrl(_0x1cf026,_0x52323f){var _0x1c9123=MICROSOFT_AUTH_URL['replace'](_0x7600('0x1e'),_0x1cf026[_0x7600('0x1f')]);var _0x3dcf2b=[_0x7600('0x20'),_0x7600('0x21')];var _0x249b29=Buffer[_0x7600('0x22')](JSON[_0x7600('0x23')]({'id':_0x52323f}))[_0x7600('0x24')](_0x7600('0x25'));var _0x558963=crypto[_0x7600('0x26')](0x10)[_0x7600('0x24')](_0x7600('0x27'));var _0x4f3182=getAuthorizationScopes(_0x1cf026);var _0x2fa36c=[{'key':'client_id','value':_0x1cf026[_0x7600('0x28')]},{'key':'response_type','value':encodeURIComponent(_0x3dcf2b[_0x7600('0x1b')]('\x20'))},{'key':_0x7600('0x29'),'value':_0x1cf026[_0x7600('0x2a')]},{'key':'response_mode','value':'form_post'},{'key':_0x7600('0x2b'),'value':encodeURIComponent(_0x4f3182)},{'key':_0x7600('0x2c'),'value':_0x249b29},{'key':_0x7600('0x2d'),'value':_0x558963},{'key':'prompt','value':_0x7600('0x2e')}];var _0x474a2d=_0x1c9123+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x2fa36c,function(_0x133c39){return _0x133c39[_0x7600('0x2f')]+'='+_0x133c39['value'];})['join']('&');_0x1cf026[_0x7600('0x30')]={'issuer':_0x1c9123[_0x7600('0x31')](_0x7600('0x32'),''),'audience':_0x1cf026[_0x7600('0x28')],'state':_0x249b29,'nonce':_0x558963};redis['set'](_0x249b29,JSON['stringify'](_0x1cf026));return _0x474a2d;}function isValidIdToken(_0x1c221d,_0x4d65e2){try{var _0x29d508=jwt[_0x7600('0x33')](_0x1c221d,{'complete':!![]});var _0x1c3a58=_0x29d508[_0x7600('0x34')];if(_0x1c3a58['iss']!==_0x4d65e2[_0x7600('0x35')])return![];if(_0x1c3a58[_0x7600('0x36')]!==_0x4d65e2['audience'])return![];if(_0x1c3a58[_0x7600('0x2d')]!==_0x4d65e2[_0x7600('0x2d')])return![];if(moment()['isAfter'](moment['unix'](_0x1c3a58['exp'])))return![];return!![];}catch(_0x3029bb){throw _0x3029bb;}}function refreshOauth2MicrosoftAccessToken(_0x55d806){return Promise[_0x7600('0x37')]()[_0x7600('0x38')](function(){if(_0x55d806['data3'])return _0x55d806;return db[_0x7600('0x39')][_0x7600('0x3a')]({'where':{'id':_0x55d806['id']},'raw':!![]});})['then'](function(_0x3f51ed){var _0x4cd269={'grant_type':_0x7600('0x3b'),'refresh_token':_0x3f51ed['data6'],'scope':getAccessTokenScope(_0x3f51ed),'redirect_uri':_0x3f51ed[_0x7600('0x2a')],'client_id':_0x3f51ed['data1'],'client_secret':encryptor[_0x7600('0x3c')](_0x3f51ed[_0x7600('0x3d')])};var _0x69fa3a={'method':_0x7600('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x7600('0x31')](_0x7600('0x1e'),_0x3f51ed[_0x7600('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4cd269,'json':!![]};return rp(_0x69fa3a);})[_0x7600('0x38')](function(_0x17a2cc){_0x55d806[_0x7600('0x3f')]=_0x17a2cc[_0x7600('0x40')];_0x55d806[_0x7600('0x41')]=_0x17a2cc['refresh_token'];return db[_0x7600('0x39')]['update']({'data5':_0x55d806['data5'],'data6':_0x55d806[_0x7600('0x41')]},{'where':{'id':_0x55d806['id']}});})[_0x7600('0x38')](function(){return _0x55d806;})['catch'](function(_0x25a0d7){logger[_0x7600('0x42')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x55d806['id'],_0x25a0d7);});}function getOauth2MicrosoftAccessToken(_0x1b37b3,_0x2ebefd){var _0xa5901b={'grant_type':_0x7600('0x43'),'code':_0x1b37b3,'scope':getAccessTokenScope(_0x2ebefd),'redirect_uri':_0x2ebefd[_0x7600('0x2a')],'client_id':_0x2ebefd[_0x7600('0x28')],'client_secret':encryptor[_0x7600('0x3c')](_0x2ebefd['data3'])};var _0x27a998={'method':_0x7600('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x7600('0x31')]('{TENANT_ID}',_0x2ebefd[_0x7600('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xa5901b,'json':!![]};return rp(_0x27a998);}function startRefreshInterval(_0x256314){var _0x14e51a=schedule[_0x7600('0x44')];if(_0x14e51a[_0x256314['id']])clearInterval(_0x14e51a[_0x256314['id']]);_0x14e51a[_0x256314['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7600('0x45')](this,{'id':_0x256314['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7600('0x44')]=_0x14e51a;}function startAllRefreshIntervals(){return db[_0x7600('0x39')][_0x7600('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0xb73be3){var _0x55597d=_0xb73be3[_0x7600('0x16')](function(_0x537abc){return refreshOauth2MicrosoftAccessToken(_0x537abc)[_0x7600('0x38')](function(_0x5675b1){startRefreshInterval(_0x5675b1);});});return Promise['all'](_0x55597d);})[_0x7600('0x47')](function(_0x3ec3fb){var _0x2221f6=_0x3ec3fb?util[_0x7600('0x48')](_0x3ec3fb,{'showHidden':![],'depth':null}):'';logger[_0x7600('0x42')](_0x7600('0x49'),_0x2221f6);});}module[_0x7600('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x4c4b=['data6','data4','decryptString','POST','data2','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','openid','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','code','id_token','from','toString','base64','hex','data1','redirect_uri','response_mode','form_post','scope','state','nonce','prompt','login','oauth2Claims','decode','payload','iss','issuer','audience','exp','resolve','then','data3','CloudProvider','findOne','refresh_token'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x4c4b,0x130));var _0xb4c4=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x4c4b[_0x13843f];return _0x1063ae;};'use strict';var _=require(_0xb4c4('0x0'));var crypto=require(_0xb4c4('0x1'));var jwt=require(_0xb4c4('0x2'));var moment=require('moment');var Redis=require(_0xb4c4('0x3'));var rp=require(_0xb4c4('0x4'));var util=require(_0xb4c4('0x5'));var encryptor=require(_0xb4c4('0x6'));var config=require(_0xb4c4('0x7'));var logger=require('../../config/logger')(_0xb4c4('0x8'));var schedule=require(_0xb4c4('0x9'));var db=require('../../mysqldb')['db'];config[_0xb4c4('0xa')]=_[_0xb4c4('0xb')](config[_0xb4c4('0xa')],{'host':_0xb4c4('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xb4c4('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xb4c4('0xe'),'email',_0xb4c4('0xf'),_0xb4c4('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xb4c4('0x11'),_0xb4c4('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4b9189){var _0x552db5=_[_0xb4c4('0x12')](AZURE_AUTH_SCOPES[_0x4b9189[_0xb4c4('0x13')]]);if(_0x4b9189[_0xb4c4('0x13')]===_0xb4c4('0x14'))_0x552db5[_0xb4c4('0x15')](_0x4b9189[_0xb4c4('0x16')]+_0xb4c4('0x17'));return _0x552db5[_0xb4c4('0x18')]('\x20');}function getAccessTokenScope(_0x1ea7aa){if(_0x1ea7aa[_0xb4c4('0x13')]===_0xb4c4('0x19'))return _0xb4c4('0x10');if(_0x1ea7aa[_0xb4c4('0x13')]===_0xb4c4('0x14'))return _0x1ea7aa[_0xb4c4('0x16')]+_0xb4c4('0x17');}function generateMicrosoftAuthorizationUrl(_0x115d2d,_0xe9f8e1){var _0x1afce8=MICROSOFT_AUTH_URL[_0xb4c4('0x1a')](_0xb4c4('0x1b'),_0x115d2d['data2']);var _0x1031f0=[_0xb4c4('0x1c'),_0xb4c4('0x1d')];var _0x264a8a=Buffer[_0xb4c4('0x1e')](JSON['stringify']({'id':_0xe9f8e1}))[_0xb4c4('0x1f')](_0xb4c4('0x20'));var _0x4bee66=crypto['randomBytes'](0x10)[_0xb4c4('0x1f')](_0xb4c4('0x21'));var _0x33c6c6=getAuthorizationScopes(_0x115d2d);var _0x1a73f2=[{'key':'client_id','value':_0x115d2d[_0xb4c4('0x22')]},{'key':'response_type','value':encodeURIComponent(_0x1031f0[_0xb4c4('0x18')]('\x20'))},{'key':_0xb4c4('0x23'),'value':_0x115d2d['data4']},{'key':_0xb4c4('0x24'),'value':_0xb4c4('0x25')},{'key':_0xb4c4('0x26'),'value':encodeURIComponent(_0x33c6c6)},{'key':_0xb4c4('0x27'),'value':_0x264a8a},{'key':_0xb4c4('0x28'),'value':_0x4bee66},{'key':_0xb4c4('0x29'),'value':_0xb4c4('0x2a')}];var _0x5c51b6=_0x1afce8+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb4c4('0x12')](_0x1a73f2,function(_0x54e026){return _0x54e026['key']+'='+_0x54e026['value'];})[_0xb4c4('0x18')]('&');_0x115d2d[_0xb4c4('0x2b')]={'issuer':_0x1afce8[_0xb4c4('0x1a')]('oauth2/',''),'audience':_0x115d2d[_0xb4c4('0x22')],'state':_0x264a8a,'nonce':_0x4bee66};redis['set'](_0x264a8a,JSON['stringify'](_0x115d2d));return _0x5c51b6;}function isValidIdToken(_0x4e2a0d,_0x2f66cc){try{var _0x608c06=jwt[_0xb4c4('0x2c')](_0x4e2a0d,{'complete':!![]});var _0x5e3797=_0x608c06[_0xb4c4('0x2d')];if(_0x5e3797[_0xb4c4('0x2e')]!==_0x2f66cc[_0xb4c4('0x2f')])return![];if(_0x5e3797['aud']!==_0x2f66cc[_0xb4c4('0x30')])return![];if(_0x5e3797[_0xb4c4('0x28')]!==_0x2f66cc[_0xb4c4('0x28')])return![];if(moment()['isAfter'](moment['unix'](_0x5e3797[_0xb4c4('0x31')])))return![];return!![];}catch(_0x4a83d9){throw _0x4a83d9;}}function refreshOauth2MicrosoftAccessToken(_0x503920){return Promise[_0xb4c4('0x32')]()[_0xb4c4('0x33')](function(){if(_0x503920[_0xb4c4('0x34')])return _0x503920;return db[_0xb4c4('0x35')][_0xb4c4('0x36')]({'where':{'id':_0x503920['id']},'raw':!![]});})['then'](function(_0x4e1d2b){var _0x316809={'grant_type':_0xb4c4('0x37'),'refresh_token':_0x4e1d2b[_0xb4c4('0x38')],'scope':getAccessTokenScope(_0x4e1d2b),'redirect_uri':_0x4e1d2b[_0xb4c4('0x39')],'client_id':_0x4e1d2b[_0xb4c4('0x22')],'client_secret':encryptor[_0xb4c4('0x3a')](_0x4e1d2b[_0xb4c4('0x34')])};var _0x5d8a13={'method':_0xb4c4('0x3b'),'uri':MICROSOFT_AUTH_URL[_0xb4c4('0x1a')](_0xb4c4('0x1b'),_0x4e1d2b[_0xb4c4('0x3c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x316809,'json':!![]};return rp(_0x5d8a13);})[_0xb4c4('0x33')](function(_0x5e917f){_0x503920[_0xb4c4('0x3d')]=_0x5e917f[_0xb4c4('0x3e')];_0x503920['data6']=_0x5e917f[_0xb4c4('0x37')];return db[_0xb4c4('0x35')][_0xb4c4('0x3f')]({'data5':_0x503920[_0xb4c4('0x3d')],'data6':_0x503920['data6']},{'where':{'id':_0x503920['id']}});})['then'](function(){return _0x503920;})[_0xb4c4('0x40')](function(_0x52884a){logger[_0xb4c4('0x41')](_0xb4c4('0x42'),_0x503920['id'],_0x52884a);});}function getOauth2MicrosoftAccessToken(_0x546a3c,_0x3871a3){var _0x26483e={'grant_type':_0xb4c4('0x43'),'code':_0x546a3c,'scope':getAccessTokenScope(_0x3871a3),'redirect_uri':_0x3871a3[_0xb4c4('0x39')],'client_id':_0x3871a3[_0xb4c4('0x22')],'client_secret':encryptor['decryptString'](_0x3871a3[_0xb4c4('0x34')])};var _0x3451a3={'method':_0xb4c4('0x3b'),'uri':MICROSOFT_AUTH_URL[_0xb4c4('0x1a')]('{TENANT_ID}',_0x3871a3['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x26483e,'json':!![]};return rp(_0x3451a3);}function startRefreshInterval(_0x54b0ff){var _0x550e5f=schedule[_0xb4c4('0x44')];if(_0x550e5f[_0x54b0ff['id']])clearInterval(_0x550e5f[_0x54b0ff['id']]);_0x550e5f[_0x54b0ff['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb4c4('0x45')](this,{'id':_0x54b0ff['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb4c4('0x44')]=_0x550e5f;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb4c4('0x33')](function(_0x5b8028){var _0x373326=_0x5b8028['map'](function(_0x109274){return refreshOauth2MicrosoftAccessToken(_0x109274)[_0xb4c4('0x33')](function(_0x2f6f99){startRefreshInterval(_0x2f6f99);});});return Promise[_0xb4c4('0x46')](_0x373326);})[_0xb4c4('0x40')](function(_0x2320ec){var _0x3de65b=_0x2320ec?util['inspect'](_0x2320ec,{'showHidden':![],'depth':null}):'';logger['error'](_0xb4c4('0x47'),_0x3de65b);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 5b16b01..081678a 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 _0x5942=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x335d24,_0x33b159){var _0x24e5a3=function(_0x41f721){while(--_0x41f721){_0x335d24['push'](_0x335d24['shift']());}};_0x24e5a3(++_0x33b159);}(_0x5942,0x16a));var _0x2594=function(_0x7f3667,_0x30c3f1){_0x7f3667=_0x7f3667-0x0;var _0x2c4c24=_0x5942[_0x7f3667];return _0x2c4c24;};'use strict';var _=require(_0x2594('0x0'));var util=require(_0x2594('0x1'));var moment=require(_0x2594('0x2'));var BPromise=require(_0x2594('0x3'));var rs=require(_0x2594('0x4'));var fs=require('fs');var Redis=require(_0x2594('0x5'));var db=require(_0x2594('0x6'))['db'];var utils=require(_0x2594('0x7'));var logger=require(_0x2594('0x8'))(_0x2594('0x9'));var config=require(_0x2594('0xa'));var jayson=require(_0x2594('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x381472,_0xd0ada5,_0x3d20aa){return new BPromise(function(_0x5707a0,_0x2b42d3){return client[_0x2594('0xc')](_0x381472,_0x3d20aa)['then'](function(_0x29517f){logger['info'](_0x2594('0xd'),_0xd0ada5,_0x2594('0xe'));logger[_0x2594('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0xd0ada5,_0x2594('0xe'),JSON[_0x2594('0x10')](_0x29517f));if(_0x29517f[_0x2594('0x11')]){if(_0x29517f[_0x2594('0x11')]['code']===0x1f4){logger[_0x2594('0x11')](_0x2594('0xd'),_0xd0ada5,_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);return _0x2b42d3(_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);}logger[_0x2594('0x11')](_0x2594('0xd'),_0xd0ada5,_0x29517f[_0x2594('0x11')]['message']);return _0x5707a0(_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);}else{logger['info'](_0x2594('0xd'),_0xd0ada5,'request\x20sent');_0x5707a0(_0x29517f[_0x2594('0x13')][_0x2594('0x12')]);}})[_0x2594('0x14')](function(_0x33b4bc){logger[_0x2594('0x11')]('CloudProvider,\x20%s,\x20%s',_0xd0ada5,_0x33b4bc);_0x2b42d3(_0x33b4bc);});});} \ No newline at end of file +var _0xf970=['../../config/logger','../../config/environment','jayson/promise','client','http','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var moment=require(_0x0f97('0x1'));var BPromise=require(_0x0f97('0x2'));var rs=require(_0x0f97('0x3'));var fs=require('fs');var Redis=require(_0x0f97('0x4'));var db=require(_0x0f97('0x5'))['db'];var utils=require(_0x0f97('0x6'));var logger=require(_0x0f97('0x7'))('rpc');var config=require(_0x0f97('0x8'));var jayson=require(_0x0f97('0x9'));var client=jayson[_0x0f97('0xa')][_0x0f97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3515,_0x3244a6,_0x12fbb3){return new BPromise(function(_0x374083,_0x2891f7){return client['request'](_0x2e3515,_0x12fbb3)['then'](function(_0x12397b){logger['info'](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));logger[_0x0f97('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3244a6,_0x0f97('0xd'),JSON['stringify'](_0x12397b));if(_0x12397b[_0x0f97('0xf')]){if(_0x12397b[_0x0f97('0xf')][_0x0f97('0x10')]===0x1f4){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b['error'][_0x0f97('0x11')]);return _0x2891f7(_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);}logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);return _0x374083(_0x12397b['error']['message']);}else{logger[_0x0f97('0x12')](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));_0x374083(_0x12397b[_0x0f97('0x13')]['message']);}})['catch'](function(_0x336f61){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x336f61);_0x2891f7(_0x336f61);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 488fc9b..79a66e2 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x6486c2,_0x24e1c9){var _0x3a9ed2=function(_0x5c6a04){while(--_0x5c6a04){_0x6486c2['push'](_0x6486c2['shift']());}};_0x3a9ed2(++_0x24e1c9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0x1261,0x144));var _0x1126=function(_0x310a23,_0x49f6b5){_0x310a23=_0x310a23-0x0;var _0x50fe57=_0x1261[_0x310a23];return _0x50fe57;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8a0338a..ded89fb 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 _0xa915=['exports','STRING','name'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa915,0x1d7));var _0x5a91=function(_0xc22821,_0x48d7ec){_0xc22821=_0xc22821-0x0;var _0x8715fe=_0xa915[_0xc22821];return _0x8715fe;};'use strict';var Sequelize=require('sequelize');module[_0x5a91('0x0')]={'name':{'type':Sequelize[_0x5a91('0x1')],'unique':_0x5a91('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x5a91('0x1')]},'phone':{'type':Sequelize[_0x5a91('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5a91('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5a91('0x1')]},'city':{'type':Sequelize[_0x5a91('0x1')]},'country':{'type':Sequelize[_0x5a91('0x1')]},'email':{'type':Sequelize[_0x5a91('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5a91('0x1')]},'sStreet':{'type':Sequelize[_0x5a91('0x1')]},'sPostalCode':{'type':Sequelize[_0x5a91('0x1')]},'sCity':{'type':Sequelize[_0x5a91('0x1')]},'sCountry':{'type':Sequelize[_0x5a91('0x1')]},'description':{'type':Sequelize[_0x5a91('0x1')]}}; \ No newline at end of file +var _0xc7a9=['sequelize','exports','STRING','name'];(function(_0x328169,_0x4c1d1b){var _0x20617a=function(_0x1e7f97){while(--_0x1e7f97){_0x328169['push'](_0x328169['shift']());}};_0x20617a(++_0x4c1d1b);}(_0xc7a9,0x134));var _0x9c7a=function(_0x1f2dc0,_0x54fff9){_0x1f2dc0=_0x1f2dc0-0x0;var _0x101674=_0xc7a9[_0x1f2dc0];return _0x101674;};'use strict';var Sequelize=require(_0x9c7a('0x0'));module[_0x9c7a('0x1')]={'name':{'type':Sequelize[_0x9c7a('0x2')],'unique':_0x9c7a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9c7a('0x2')]},'companyId':{'type':Sequelize[_0x9c7a('0x2')]},'website':{'type':Sequelize[_0x9c7a('0x2')]},'phone':{'type':Sequelize[_0x9c7a('0x2')]},'fax':{'type':Sequelize[_0x9c7a('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9c7a('0x2')]},'country':{'type':Sequelize[_0x9c7a('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9c7a('0x2')]},'sStreet':{'type':Sequelize[_0x9c7a('0x2')]},'sPostalCode':{'type':Sequelize[_0x9c7a('0x2')]},'sCity':{'type':Sequelize[_0x9c7a('0x2')]},'sCountry':{'type':Sequelize[_0x9c7a('0x2')]},'description':{'type':Sequelize[_0x9c7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index caa706e..e036970 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 _0x8850=['params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','omit','getContacts','findOne','hasOwnProperty','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','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','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Companies','end','error','stack','name','CmCompany','describe','keys','query','model','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','map','filter','merge','options','includeAll','include','findAll','catch','show'];(function(_0x3e6aed,_0x97a2f1){var _0x3220dd=function(_0x252cd2){while(--_0x252cd2){_0x3e6aed['push'](_0x3e6aed['shift']());}};_0x3220dd(++_0x97a2f1);}(_0x8850,0x173));var _0x0885=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8850[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0885('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0885('0x1'));var rp=require('request-promise');var moment=require(_0x0885('0x2'));var BPromise=require(_0x0885('0x3'));var Mustache=require(_0x0885('0x4'));var util=require(_0x0885('0x5'));var path=require(_0x0885('0x6'));var sox=require('sox');var csv=require(_0x0885('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0885('0x8'));var _=require('lodash');var squel=require(_0x0885('0x9'));var crypto=require(_0x0885('0xa'));var jsforce=require(_0x0885('0xb'));var deskjs=require(_0x0885('0xc'));var toCsv=require(_0x0885('0x7'));var querystring=require(_0x0885('0xd'));var Papa=require(_0x0885('0xe'));var Redis=require(_0x0885('0xf'));var authService=require(_0x0885('0x10'));var qs=require(_0x0885('0x11'));var as=require(_0x0885('0x12'));var hardwareService=require(_0x0885('0x13'));var logger=require(_0x0885('0x14'))(_0x0885('0x15'));var utils=require(_0x0885('0x16'));var config=require(_0x0885('0x17'));var licenseUtil=require(_0x0885('0x18'));var db=require(_0x0885('0x19'))['db'];function respondWithStatusCode(_0x1f4b52,_0x5998b5){_0x5998b5=_0x5998b5||0xcc;return function(_0x3cb0b0){if(_0x3cb0b0){return _0x1f4b52[_0x0885('0x1a')](_0x5998b5);}return _0x1f4b52[_0x0885('0x1b')](_0x5998b5)['end']();};}function respondWithResult(_0x22dcac,_0x544f86){_0x544f86=_0x544f86||0xc8;return function(_0x5b1615){if(_0x5b1615){return _0x22dcac['status'](_0x544f86)[_0x0885('0x1c')](_0x5b1615);}};}function respondWithFilteredResult(_0x3250cc,_0x31214d){return function(_0x2adf67){if(_0x2adf67){var _0x1bc080=typeof _0x31214d['offset']===_0x0885('0x1d')&&typeof _0x31214d[_0x0885('0x1e')]==='undefined';var _0x1e81ae=_0x2adf67[_0x0885('0x1f')];var _0x57b50b=_0x1bc080?0x0:_0x31214d[_0x0885('0x20')];var _0x1f34b1=_0x1bc080?_0x2adf67[_0x0885('0x1f')]:_0x31214d[_0x0885('0x20')]+_0x31214d[_0x0885('0x1e')];var _0x29c437;if(_0x1f34b1>=_0x1e81ae){_0x1f34b1=_0x1e81ae;_0x29c437=0xc8;}else{_0x29c437=0xce;}_0x3250cc[_0x0885('0x1b')](_0x29c437);return _0x3250cc[_0x0885('0x21')](_0x0885('0x22'),_0x57b50b+'-'+_0x1f34b1+'/'+_0x1e81ae)[_0x0885('0x1c')](_0x2adf67);}return null;};}function patchUpdates(_0x111c11){return function(_0x1223d1){try{jsonpatch[_0x0885('0x23')](_0x1223d1,_0x111c11,!![]);}catch(_0x3a270b){return BPromise['reject'](_0x3a270b);}return _0x1223d1[_0x0885('0x24')]();};}function saveUpdates(_0x28586f,_0x2399fd){return function(_0x37e7b5){if(_0x37e7b5){return _0x37e7b5[_0x0885('0x25')](_0x28586f)[_0x0885('0x26')](function(_0x3a44a3){return _0x3a44a3;});}return null;};}function removeEntity(_0x2e5554,_0x5ce26d){return function(_0x828d6d){if(_0x828d6d){return _0x828d6d[_0x0885('0x27')]()[_0x0885('0x26')](function(){var _0x122eff=_0x828d6d[_0x0885('0x28')]({'plain':!![]});var _0x44911d=_0x0885('0x29');return db['UserProfileResource'][_0x0885('0x27')]({'where':{'type':_0x44911d,'resourceId':_0x122eff['id']}})['then'](function(){return _0x828d6d;});})['then'](function(){_0x2e5554['status'](0xcc)[_0x0885('0x2a')]();});}};}function handleEntityNotFound(_0x17ca87,_0x326934){return function(_0x229b5c){if(!_0x229b5c){_0x17ca87[_0x0885('0x1a')](0x194);}return _0x229b5c;};}function handleError(_0x4e14b2,_0x49950f){_0x49950f=_0x49950f||0x1f4;return function(_0xc5c2d4){logger[_0x0885('0x2b')](_0xc5c2d4[_0x0885('0x2c')]);if(_0xc5c2d4['name']){delete _0xc5c2d4[_0x0885('0x2d')];}_0x4e14b2['status'](_0x49950f)['send'](_0xc5c2d4);};}exports['index']=function(_0x4781c2,_0x2cfb20){var _0x4a9e70={},_0x4661ee={},_0x484992={'count':0x0,'rows':[]};return db[_0x0885('0x2e')][_0x0885('0x2f')]()[_0x0885('0x26')](function(_0x2df2f4){_0x4661ee['model']=_[_0x0885('0x30')](_0x2df2f4);_0x4661ee['query']=_['keys'](_0x4781c2[_0x0885('0x31')]);_0x4661ee['filters']=_['intersection'](_0x4661ee[_0x0885('0x32')],_0x4661ee[_0x0885('0x31')]);_0x4a9e70[_0x0885('0x33')]=_[_0x0885('0x34')](_0x4661ee[_0x0885('0x32')],qs[_0x0885('0x35')](_0x4781c2['query'][_0x0885('0x35')]));_0x4a9e70['attributes']=_0x4a9e70[_0x0885('0x33')]['length']?_0x4a9e70[_0x0885('0x33')]:_0x4661ee[_0x0885('0x32')];if(!_0x4781c2[_0x0885('0x31')]['hasOwnProperty'](_0x0885('0x36'))){_0x4a9e70[_0x0885('0x1e')]=qs[_0x0885('0x1e')](_0x4781c2[_0x0885('0x31')][_0x0885('0x1e')]);_0x4a9e70[_0x0885('0x20')]=qs[_0x0885('0x20')](_0x4781c2[_0x0885('0x31')][_0x0885('0x20')]);}_0x4a9e70[_0x0885('0x37')]=qs[_0x0885('0x38')](_0x4781c2[_0x0885('0x31')][_0x0885('0x38')]);_0x4a9e70[_0x0885('0x39')]=qs[_0x0885('0x3a')](_[_0x0885('0x3b')](_0x4781c2['query'],_0x4661ee[_0x0885('0x3a')]),_0x2df2f4);if(_0x4781c2[_0x0885('0x31')]['filter']){_0x4a9e70[_0x0885('0x39')]=_['merge'](_0x4a9e70['where'],{'$or':_[_0x0885('0x3c')](_0x4a9e70[_0x0885('0x33')],function(_0xabdcb9){var _0x127333={};_0x127333[_0xabdcb9]={'$like':'%'+_0x4781c2[_0x0885('0x31')][_0x0885('0x3d')]+'%'};return _0x127333;})});}_0x4a9e70=_[_0x0885('0x3e')]({},_0x4a9e70,_0x4781c2[_0x0885('0x3f')]);var _0x103306={'where':_0x4a9e70['where']};return db[_0x0885('0x2e')][_0x0885('0x1f')](_0x103306)[_0x0885('0x26')](function(_0x2c7732){_0x484992[_0x0885('0x1f')]=_0x2c7732;if(_0x4781c2['query'][_0x0885('0x40')]){_0x4a9e70[_0x0885('0x41')]=[{'all':!![]}];}return db[_0x0885('0x2e')][_0x0885('0x42')](_0x4a9e70);})[_0x0885('0x26')](function(_0x27211f){_0x484992['rows']=_0x27211f;return _0x484992;})['then'](respondWithFilteredResult(_0x2cfb20,_0x4a9e70))[_0x0885('0x43')](handleError(_0x2cfb20,null));})[_0x0885('0x43')](handleError(_0x2cfb20,null));};exports[_0x0885('0x44')]=function(_0x26c7cc,_0x380326){var _0x578bd0={'raw':![],'where':{'id':_0x26c7cc[_0x0885('0x45')]['id']}},_0x3cd015={};_0x3cd015[_0x0885('0x32')]=_['keys'](db[_0x0885('0x2e')][_0x0885('0x46')]);_0x3cd015[_0x0885('0x31')]=_[_0x0885('0x30')](_0x26c7cc[_0x0885('0x31')]);_0x3cd015['filters']=_[_0x0885('0x34')](_0x3cd015['model'],_0x3cd015[_0x0885('0x31')]);_0x578bd0[_0x0885('0x33')]=_[_0x0885('0x34')](_0x3cd015[_0x0885('0x32')],qs[_0x0885('0x35')](_0x26c7cc[_0x0885('0x31')][_0x0885('0x35')]));_0x578bd0['attributes']=_0x578bd0[_0x0885('0x33')][_0x0885('0x47')]?_0x578bd0[_0x0885('0x33')]:_0x3cd015[_0x0885('0x32')];if(_0x26c7cc[_0x0885('0x31')][_0x0885('0x40')]){_0x578bd0[_0x0885('0x41')]=[{'all':!![]}];}_0x578bd0=_['merge']({},_0x578bd0,_0x26c7cc[_0x0885('0x3f')]);return db['CmCompany'][_0x0885('0x48')](_0x578bd0)['then'](handleEntityNotFound(_0x380326,null))['then'](respondWithResult(_0x380326,null))[_0x0885('0x43')](handleError(_0x380326,null));};exports['create']=function(_0x4d7b81,_0x593582){return db[_0x0885('0x2e')][_0x0885('0x49')](_0x4d7b81[_0x0885('0x4a')],{})[_0x0885('0x26')](function(_0x35d936){var _0x3b8352=_0x4d7b81[_0x0885('0x4b')][_0x0885('0x28')]({'plain':!![]});if(!_0x3b8352)throw new Error(_0x0885('0x4c'));if(_0x3b8352[_0x0885('0x4d')]===_0x0885('0x4b')){var _0x42d073=_0x35d936['get']({'plain':!![]});var _0x4f6fc4=_0x0885('0x29');return db[_0x0885('0x4e')][_0x0885('0x48')]({'where':{'name':_0x4f6fc4,'userProfileId':_0x3b8352[_0x0885('0x4f')]},'raw':!![]})[_0x0885('0x26')](function(_0x1850e0){if(_0x1850e0&&_0x1850e0[_0x0885('0x50')]===0x0){return db[_0x0885('0x51')][_0x0885('0x49')]({'name':_0x42d073[_0x0885('0x2d')],'resourceId':_0x42d073['id'],'type':_0x1850e0[_0x0885('0x2d')],'sectionId':_0x1850e0['id']},{})[_0x0885('0x26')](function(){return _0x35d936;});}else{return _0x35d936;}})[_0x0885('0x43')](function(_0x5d2056){logger[_0x0885('0x2b')](_0x0885('0x52'),_0x5d2056);throw _0x5d2056;});}return _0x35d936;})[_0x0885('0x26')](respondWithResult(_0x593582,0xc9))[_0x0885('0x43')](handleError(_0x593582,null));};exports[_0x0885('0x25')]=function(_0x69f16d,_0x2ac08b){if(_0x69f16d[_0x0885('0x4a')]['id']){delete _0x69f16d['body']['id'];}return db['CmCompany'][_0x0885('0x48')]({'where':{'id':_0x69f16d[_0x0885('0x45')]['id']}})[_0x0885('0x26')](handleEntityNotFound(_0x2ac08b,null))[_0x0885('0x26')](saveUpdates(_0x69f16d[_0x0885('0x4a')],null))[_0x0885('0x26')](respondWithResult(_0x2ac08b,null))[_0x0885('0x43')](handleError(_0x2ac08b,null));};exports['destroy']=function(_0x584662,_0x296205){return db[_0x0885('0x2e')][_0x0885('0x48')]({'where':{'id':_0x584662[_0x0885('0x45')]['id']}})[_0x0885('0x26')](handleEntityNotFound(_0x296205,null))[_0x0885('0x26')](removeEntity(_0x296205,null))[_0x0885('0x43')](handleError(_0x296205,null));};exports['describe']=function(_0x4b000d,_0x440bf8){return db[_0x0885('0x2e')]['describe']()['then'](respondWithResult(_0x440bf8,null))[_0x0885('0x43')](handleError(_0x440bf8,null));};exports[_0x0885('0x53')]=function(_0x2742b3,_0x4a1d0c,_0x488ae0){return db['CmContact'][_0x0885('0x48')]({'where':{'id':_0x2742b3[_0x0885('0x45')]['id']}})[_0x0885('0x26')](handleEntityNotFound(_0x4a1d0c,null))[_0x0885('0x26')](function(_0x5984fa){if(_0x5984fa){return _0x5984fa['addContacts'](_0x2742b3['body']['ids'],_[_0x0885('0x54')](_0x2742b3['body'],['ids','id'])||{});}})[_0x0885('0x26')](respondWithResult(_0x4a1d0c,null))[_0x0885('0x43')](handleError(_0x4a1d0c,null));};exports[_0x0885('0x55')]=function(_0x45d01d,_0x58cc9d,_0x298976){var _0x32eb23={};var _0xe1ac2e={};var _0x1728f0;var _0x5cac40;return db[_0x0885('0x2e')][_0x0885('0x56')]({'where':{'id':_0x45d01d['params']['id']}})[_0x0885('0x26')](handleEntityNotFound(_0x58cc9d,null))['then'](function(_0x4356a3){if(_0x4356a3){_0x1728f0=_0x4356a3;_0xe1ac2e[_0x0885('0x32')]=_[_0x0885('0x30')](db['CmContact']['rawAttributes']);_0xe1ac2e[_0x0885('0x31')]=_[_0x0885('0x30')](_0x45d01d['query']);_0xe1ac2e[_0x0885('0x3a')]=_[_0x0885('0x34')](_0xe1ac2e[_0x0885('0x32')],_0xe1ac2e[_0x0885('0x31')]);_0x32eb23['attributes']=_[_0x0885('0x34')](_0xe1ac2e[_0x0885('0x32')],qs[_0x0885('0x35')](_0x45d01d[_0x0885('0x31')][_0x0885('0x35')]));_0x32eb23[_0x0885('0x33')]=_0x32eb23[_0x0885('0x33')][_0x0885('0x47')]?_0x32eb23[_0x0885('0x33')]:_0xe1ac2e['model'];_0x32eb23[_0x0885('0x37')]=qs['sort'](_0x45d01d['query'][_0x0885('0x38')]);_0x32eb23['where']=qs['filters'](_['pick'](_0x45d01d[_0x0885('0x31')],_0xe1ac2e[_0x0885('0x3a')]));if(_0x45d01d[_0x0885('0x31')][_0x0885('0x3d')]){_0x32eb23[_0x0885('0x39')]=_['merge'](_0x32eb23[_0x0885('0x39')],{'$or':_[_0x0885('0x3c')](_0x32eb23[_0x0885('0x33')],function(_0x5ac70f){var _0x15cc45={};_0x15cc45[_0x5ac70f]={'$like':'%'+_0x45d01d[_0x0885('0x31')]['filter']+'%'};return _0x15cc45;})});}_0x32eb23=_['merge']({},_0x32eb23,_0x45d01d['options']);return _0x1728f0['getContacts'](_0x32eb23);}})[_0x0885('0x26')](function(_0x31efb3){if(_0x31efb3){_0x5cac40=_0x31efb3[_0x0885('0x47')];if(!_0x45d01d[_0x0885('0x31')][_0x0885('0x57')](_0x0885('0x36'))){_0x32eb23['limit']=qs[_0x0885('0x1e')](_0x45d01d[_0x0885('0x31')]['limit']);_0x32eb23['offset']=qs[_0x0885('0x20')](_0x45d01d['query'][_0x0885('0x20')]);}return _0x1728f0[_0x0885('0x55')](_0x32eb23);}})[_0x0885('0x26')](function(_0x4f7bd8){if(_0x4f7bd8){return _0x4f7bd8?{'count':_0x5cac40,'rows':_0x4f7bd8}:null;}})[_0x0885('0x26')](respondWithResult(_0x58cc9d,null))['catch'](handleError(_0x58cc9d,null));}; \ No newline at end of file +var _0xc2f7=['merge','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','find','userProfileId','create','update','addContacts','CmContact','ids','omit','getContacts'];(function(_0x5f4777,_0x1df9ba){var _0x187998=function(_0x1458f7){while(--_0x1458f7){_0x5f4777['push'](_0x5f4777['shift']());}};_0x187998(++_0x1df9ba);}(_0xc2f7,0x15a));var _0x7c2f=function(_0x22408c,_0x34b6ca){_0x22408c=_0x22408c-0x0;var _0x165585=_0xc2f7[_0x22408c];return _0x165585;};'use strict';var emlformat=require(_0x7c2f('0x0'));var rimraf=require(_0x7c2f('0x1'));var zipdir=require(_0x7c2f('0x2'));var jsonpatch=require(_0x7c2f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7c2f('0x4'));var Mustache=require('mustache');var util=require(_0x7c2f('0x5'));var path=require(_0x7c2f('0x6'));var sox=require(_0x7c2f('0x7'));var csv=require(_0x7c2f('0x8'));var ejs=require(_0x7c2f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c2f('0xa'));var squel=require('squel');var crypto=require(_0x7c2f('0xb'));var jsforce=require(_0x7c2f('0xc'));var deskjs=require(_0x7c2f('0xd'));var toCsv=require(_0x7c2f('0x8'));var querystring=require('querystring');var Papa=require(_0x7c2f('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2f('0xf'));var qs=require(_0x7c2f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c2f('0x11'));var logger=require(_0x7c2f('0x12'))(_0x7c2f('0x13'));var utils=require(_0x7c2f('0x14'));var config=require(_0x7c2f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c2f('0x16'))['db'];function respondWithStatusCode(_0x54509e,_0x46e499){_0x46e499=_0x46e499||0xcc;return function(_0x2c5e5c){if(_0x2c5e5c){return _0x54509e['sendStatus'](_0x46e499);}return _0x54509e[_0x7c2f('0x17')](_0x46e499)['end']();};}function respondWithResult(_0x206b6c,_0x6d40ab){_0x6d40ab=_0x6d40ab||0xc8;return function(_0x4bf77a){if(_0x4bf77a){return _0x206b6c[_0x7c2f('0x17')](_0x6d40ab)['json'](_0x4bf77a);}};}function respondWithFilteredResult(_0x2a4772,_0x37092e){return function(_0x4062d4){if(_0x4062d4){var _0x6f5dda=typeof _0x37092e[_0x7c2f('0x18')]==='undefined'&&typeof _0x37092e['limit']===_0x7c2f('0x19');var _0x556b60=_0x4062d4[_0x7c2f('0x1a')];var _0x5da0e4=_0x6f5dda?0x0:_0x37092e[_0x7c2f('0x18')];var _0x144dac=_0x6f5dda?_0x4062d4[_0x7c2f('0x1a')]:_0x37092e[_0x7c2f('0x18')]+_0x37092e[_0x7c2f('0x1b')];var _0x331cf1;if(_0x144dac>=_0x556b60){_0x144dac=_0x556b60;_0x331cf1=0xc8;}else{_0x331cf1=0xce;}_0x2a4772[_0x7c2f('0x17')](_0x331cf1);return _0x2a4772['set'](_0x7c2f('0x1c'),_0x5da0e4+'-'+_0x144dac+'/'+_0x556b60)['json'](_0x4062d4);}return null;};}function patchUpdates(_0x5ab432){return function(_0x552509){try{jsonpatch[_0x7c2f('0x1d')](_0x552509,_0x5ab432,!![]);}catch(_0x419a73){return BPromise[_0x7c2f('0x1e')](_0x419a73);}return _0x552509[_0x7c2f('0x1f')]();};}function saveUpdates(_0x1c4c68,_0x4a58d8){return function(_0x3c3b20){if(_0x3c3b20){return _0x3c3b20['update'](_0x1c4c68)[_0x7c2f('0x20')](function(_0xc9dd84){return _0xc9dd84;});}return null;};}function removeEntity(_0x2f5710,_0x4f6bdc){return function(_0x380d9a){if(_0x380d9a){return _0x380d9a[_0x7c2f('0x21')]()[_0x7c2f('0x20')](function(){var _0x295e37=_0x380d9a[_0x7c2f('0x22')]({'plain':!![]});var _0x522b6d='Companies';return db[_0x7c2f('0x23')]['destroy']({'where':{'type':_0x522b6d,'resourceId':_0x295e37['id']}})[_0x7c2f('0x20')](function(){return _0x380d9a;});})[_0x7c2f('0x20')](function(){_0x2f5710[_0x7c2f('0x17')](0xcc)[_0x7c2f('0x24')]();});}};}function handleEntityNotFound(_0x1e0b76,_0x419cf4){return function(_0x523bf3){if(!_0x523bf3){_0x1e0b76[_0x7c2f('0x25')](0x194);}return _0x523bf3;};}function handleError(_0x52cad7,_0x2ac2f4){_0x2ac2f4=_0x2ac2f4||0x1f4;return function(_0x5ef872){logger[_0x7c2f('0x26')](_0x5ef872[_0x7c2f('0x27')]);if(_0x5ef872[_0x7c2f('0x28')]){delete _0x5ef872[_0x7c2f('0x28')];}_0x52cad7[_0x7c2f('0x17')](_0x2ac2f4)[_0x7c2f('0x29')](_0x5ef872);};}exports[_0x7c2f('0x2a')]=function(_0x5411e6,_0x4c9302){var _0x19adde={},_0x1958ce={},_0x164032={'count':0x0,'rows':[]};return db[_0x7c2f('0x2b')][_0x7c2f('0x2c')]()['then'](function(_0x53b3bd){_0x1958ce[_0x7c2f('0x2d')]=_[_0x7c2f('0x2e')](_0x53b3bd);_0x1958ce[_0x7c2f('0x2f')]=_[_0x7c2f('0x2e')](_0x5411e6[_0x7c2f('0x2f')]);_0x1958ce[_0x7c2f('0x30')]=_[_0x7c2f('0x31')](_0x1958ce[_0x7c2f('0x2d')],_0x1958ce[_0x7c2f('0x2f')]);_0x19adde[_0x7c2f('0x32')]=_[_0x7c2f('0x31')](_0x1958ce[_0x7c2f('0x2d')],qs[_0x7c2f('0x33')](_0x5411e6[_0x7c2f('0x2f')][_0x7c2f('0x33')]));_0x19adde[_0x7c2f('0x32')]=_0x19adde[_0x7c2f('0x32')][_0x7c2f('0x34')]?_0x19adde[_0x7c2f('0x32')]:_0x1958ce[_0x7c2f('0x2d')];if(!_0x5411e6[_0x7c2f('0x2f')]['hasOwnProperty'](_0x7c2f('0x35'))){_0x19adde[_0x7c2f('0x1b')]=qs[_0x7c2f('0x1b')](_0x5411e6['query'][_0x7c2f('0x1b')]);_0x19adde[_0x7c2f('0x18')]=qs['offset'](_0x5411e6['query'][_0x7c2f('0x18')]);}_0x19adde[_0x7c2f('0x36')]=qs[_0x7c2f('0x37')](_0x5411e6[_0x7c2f('0x2f')][_0x7c2f('0x37')]);_0x19adde['where']=qs[_0x7c2f('0x30')](_[_0x7c2f('0x38')](_0x5411e6['query'],_0x1958ce[_0x7c2f('0x30')]),_0x53b3bd);if(_0x5411e6['query'][_0x7c2f('0x39')]){_0x19adde[_0x7c2f('0x3a')]=_['merge'](_0x19adde[_0x7c2f('0x3a')],{'$or':_[_0x7c2f('0x3b')](_0x19adde[_0x7c2f('0x32')],function(_0x543582){var _0x5323f9={};_0x5323f9[_0x543582]={'$like':'%'+_0x5411e6['query'][_0x7c2f('0x39')]+'%'};return _0x5323f9;})});}_0x19adde=_['merge']({},_0x19adde,_0x5411e6[_0x7c2f('0x3c')]);var _0x23df97={'where':_0x19adde['where']};return db['CmCompany'][_0x7c2f('0x1a')](_0x23df97)[_0x7c2f('0x20')](function(_0x522dfb){_0x164032['count']=_0x522dfb;if(_0x5411e6[_0x7c2f('0x2f')][_0x7c2f('0x3d')]){_0x19adde[_0x7c2f('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0x7c2f('0x3f')](_0x19adde);})['then'](function(_0x83e0b6){_0x164032[_0x7c2f('0x40')]=_0x83e0b6;return _0x164032;})[_0x7c2f('0x20')](respondWithFilteredResult(_0x4c9302,_0x19adde))[_0x7c2f('0x41')](handleError(_0x4c9302,null));})[_0x7c2f('0x41')](handleError(_0x4c9302,null));};exports[_0x7c2f('0x42')]=function(_0x52239e,_0x562885){var _0x47d91b={'raw':![],'where':{'id':_0x52239e[_0x7c2f('0x43')]['id']}},_0x237f7f={};_0x237f7f[_0x7c2f('0x2d')]=_[_0x7c2f('0x2e')](db['CmCompany'][_0x7c2f('0x44')]);_0x237f7f['query']=_[_0x7c2f('0x2e')](_0x52239e['query']);_0x237f7f['filters']=_[_0x7c2f('0x31')](_0x237f7f[_0x7c2f('0x2d')],_0x237f7f[_0x7c2f('0x2f')]);_0x47d91b['attributes']=_[_0x7c2f('0x31')](_0x237f7f[_0x7c2f('0x2d')],qs['fields'](_0x52239e[_0x7c2f('0x2f')][_0x7c2f('0x33')]));_0x47d91b[_0x7c2f('0x32')]=_0x47d91b[_0x7c2f('0x32')]['length']?_0x47d91b[_0x7c2f('0x32')]:_0x237f7f['model'];if(_0x52239e['query'][_0x7c2f('0x3d')]){_0x47d91b['include']=[{'all':!![]}];}_0x47d91b=_['merge']({},_0x47d91b,_0x52239e[_0x7c2f('0x3c')]);return db[_0x7c2f('0x2b')]['find'](_0x47d91b)[_0x7c2f('0x20')](handleEntityNotFound(_0x562885,null))[_0x7c2f('0x20')](respondWithResult(_0x562885,null))['catch'](handleError(_0x562885,null));};exports['create']=function(_0x1f78dd,_0x4006b9){return db[_0x7c2f('0x2b')]['create'](_0x1f78dd[_0x7c2f('0x45')],{})[_0x7c2f('0x20')](function(_0x491685){var _0x1be66f=_0x1f78dd[_0x7c2f('0x46')][_0x7c2f('0x22')]({'plain':!![]});if(!_0x1be66f)throw new Error(_0x7c2f('0x47'));if(_0x1be66f[_0x7c2f('0x48')]==='user'){var _0x3d705f=_0x491685[_0x7c2f('0x22')]({'plain':!![]});var _0x290ee5=_0x7c2f('0x49');return db[_0x7c2f('0x4a')][_0x7c2f('0x4b')]({'where':{'name':_0x290ee5,'userProfileId':_0x1be66f[_0x7c2f('0x4c')]},'raw':!![]})[_0x7c2f('0x20')](function(_0x5b39c9){if(_0x5b39c9&&_0x5b39c9['autoAssociation']===0x0){return db[_0x7c2f('0x23')][_0x7c2f('0x4d')]({'name':_0x3d705f['name'],'resourceId':_0x3d705f['id'],'type':_0x5b39c9[_0x7c2f('0x28')],'sectionId':_0x5b39c9['id']},{})[_0x7c2f('0x20')](function(){return _0x491685;});}else{return _0x491685;}})[_0x7c2f('0x41')](function(_0x2e65ab){logger[_0x7c2f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e65ab);throw _0x2e65ab;});}return _0x491685;})[_0x7c2f('0x20')](respondWithResult(_0x4006b9,0xc9))['catch'](handleError(_0x4006b9,null));};exports[_0x7c2f('0x4e')]=function(_0x48583c,_0x5c0c01){if(_0x48583c[_0x7c2f('0x45')]['id']){delete _0x48583c[_0x7c2f('0x45')]['id'];}return db['CmCompany'][_0x7c2f('0x4b')]({'where':{'id':_0x48583c[_0x7c2f('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c0c01,null))[_0x7c2f('0x20')](saveUpdates(_0x48583c['body'],null))['then'](respondWithResult(_0x5c0c01,null))['catch'](handleError(_0x5c0c01,null));};exports[_0x7c2f('0x21')]=function(_0x5cf576,_0x166ef0){return db[_0x7c2f('0x2b')][_0x7c2f('0x4b')]({'where':{'id':_0x5cf576[_0x7c2f('0x43')]['id']}})[_0x7c2f('0x20')](handleEntityNotFound(_0x166ef0,null))[_0x7c2f('0x20')](removeEntity(_0x166ef0,null))['catch'](handleError(_0x166ef0,null));};exports[_0x7c2f('0x2c')]=function(_0x5b85c3,_0x18eb89){return db[_0x7c2f('0x2b')]['describe']()['then'](respondWithResult(_0x18eb89,null))[_0x7c2f('0x41')](handleError(_0x18eb89,null));};exports[_0x7c2f('0x4f')]=function(_0x5df6fd,_0x295282,_0x45fb36){return db[_0x7c2f('0x50')][_0x7c2f('0x4b')]({'where':{'id':_0x5df6fd[_0x7c2f('0x43')]['id']}})[_0x7c2f('0x20')](handleEntityNotFound(_0x295282,null))[_0x7c2f('0x20')](function(_0x11e91a){if(_0x11e91a){return _0x11e91a[_0x7c2f('0x4f')](_0x5df6fd['body'][_0x7c2f('0x51')],_[_0x7c2f('0x52')](_0x5df6fd[_0x7c2f('0x45')],[_0x7c2f('0x51'),'id'])||{});}})[_0x7c2f('0x20')](respondWithResult(_0x295282,null))[_0x7c2f('0x41')](handleError(_0x295282,null));};exports[_0x7c2f('0x53')]=function(_0x382be6,_0x29e95f,_0x4d6912){var _0x5910e6={};var _0x2dab5d={};var _0x28256a;var _0x4a31e8;return db['CmCompany']['findOne']({'where':{'id':_0x382be6[_0x7c2f('0x43')]['id']}})['then'](handleEntityNotFound(_0x29e95f,null))[_0x7c2f('0x20')](function(_0x606fb9){if(_0x606fb9){_0x28256a=_0x606fb9;_0x2dab5d[_0x7c2f('0x2d')]=_[_0x7c2f('0x2e')](db[_0x7c2f('0x50')]['rawAttributes']);_0x2dab5d[_0x7c2f('0x2f')]=_[_0x7c2f('0x2e')](_0x382be6[_0x7c2f('0x2f')]);_0x2dab5d['filters']=_['intersection'](_0x2dab5d[_0x7c2f('0x2d')],_0x2dab5d[_0x7c2f('0x2f')]);_0x5910e6['attributes']=_[_0x7c2f('0x31')](_0x2dab5d[_0x7c2f('0x2d')],qs[_0x7c2f('0x33')](_0x382be6[_0x7c2f('0x2f')][_0x7c2f('0x33')]));_0x5910e6[_0x7c2f('0x32')]=_0x5910e6[_0x7c2f('0x32')][_0x7c2f('0x34')]?_0x5910e6[_0x7c2f('0x32')]:_0x2dab5d['model'];_0x5910e6['order']=qs[_0x7c2f('0x37')](_0x382be6[_0x7c2f('0x2f')][_0x7c2f('0x37')]);_0x5910e6['where']=qs[_0x7c2f('0x30')](_[_0x7c2f('0x38')](_0x382be6[_0x7c2f('0x2f')],_0x2dab5d[_0x7c2f('0x30')]));if(_0x382be6[_0x7c2f('0x2f')]['filter']){_0x5910e6[_0x7c2f('0x3a')]=_[_0x7c2f('0x54')](_0x5910e6[_0x7c2f('0x3a')],{'$or':_[_0x7c2f('0x3b')](_0x5910e6[_0x7c2f('0x32')],function(_0x284e2a){var _0x11cf76={};_0x11cf76[_0x284e2a]={'$like':'%'+_0x382be6['query'][_0x7c2f('0x39')]+'%'};return _0x11cf76;})});}_0x5910e6=_[_0x7c2f('0x54')]({},_0x5910e6,_0x382be6[_0x7c2f('0x3c')]);return _0x28256a['getContacts'](_0x5910e6);}})[_0x7c2f('0x20')](function(_0x346b49){if(_0x346b49){_0x4a31e8=_0x346b49[_0x7c2f('0x34')];if(!_0x382be6[_0x7c2f('0x2f')][_0x7c2f('0x55')](_0x7c2f('0x35'))){_0x5910e6[_0x7c2f('0x1b')]=qs[_0x7c2f('0x1b')](_0x382be6['query'][_0x7c2f('0x1b')]);_0x5910e6[_0x7c2f('0x18')]=qs[_0x7c2f('0x18')](_0x382be6['query'][_0x7c2f('0x18')]);}return _0x28256a[_0x7c2f('0x53')](_0x5910e6);}})[_0x7c2f('0x20')](function(_0x2b81cc){if(_0x2b81cc){return _0x2b81cc?{'count':_0x4a31e8,'rows':_0x2b81cc}:null;}})['then'](respondWithResult(_0x29e95f,null))[_0x7c2f('0x41')](handleError(_0x29e95f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index df29224..fae718c 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 _0x280f=['define','CmCompany','cm_companies','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x20a4b5,_0x59ccb5){var _0x461de7=function(_0x24b857){while(--_0x24b857){_0x20a4b5['push'](_0x20a4b5['shift']());}};_0x461de7(++_0x59ccb5);}(_0x280f,0xb9));var _0xf280=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0x280f[_0x395bfe];return _0x35c81c;};'use strict';var _=require(_0xf280('0x0'));var util=require(_0xf280('0x1'));var logger=require(_0xf280('0x2'))('api');var moment=require(_0xf280('0x3'));var BPromise=require(_0xf280('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf280('0x5'));var rimraf=require(_0xf280('0x6'));var config=require(_0xf280('0x7'));var attributes=require(_0xf280('0x8'));module[_0xf280('0x9')]=function(_0x41815e,_0x737dd1){return _0x41815e[_0xf280('0xa')](_0xf280('0xb'),attributes,{'tableName':_0xf280('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x671c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmCompany','cm_companies'];(function(_0x10d76c,_0x5a2b0f){var _0x4a4376=function(_0x143621){while(--_0x143621){_0x10d76c['push'](_0x10d76c['shift']());}};_0x4a4376(++_0x5a2b0f);}(_0x671c,0x11e));var _0xc671=function(_0x5c6067,_0x4e0ce3){_0x5c6067=_0x5c6067-0x0;var _0x3d31d3=_0x671c[_0x5c6067];return _0x3d31d3;};'use strict';var _=require(_0xc671('0x0'));var util=require(_0xc671('0x1'));var logger=require(_0xc671('0x2'))(_0xc671('0x3'));var moment=require(_0xc671('0x4'));var BPromise=require(_0xc671('0x5'));var rp=require(_0xc671('0x6'));var fs=require('fs');var path=require(_0xc671('0x7'));var rimraf=require('rimraf');var config=require(_0xc671('0x8'));var attributes=require('./cmCompany.attributes');module[_0xc671('0x9')]=function(_0x54d7f2,_0xfa3728){return _0x54d7f2[_0xc671('0xa')](_0xc671('0xb'),attributes,{'tableName':_0xc671('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 25ee1d3..0112326 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 _0x26e8=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x260c31,_0x982e07){var _0x3e09c2=function(_0x1101e7){while(--_0x1101e7){_0x260c31['push'](_0x260c31['shift']());}};_0x3e09c2(++_0x982e07);}(_0x26e8,0x13a));var _0x826e=function(_0x1337c6,_0x3e8010){_0x1337c6=_0x1337c6-0x0;var _0x28bcf4=_0x26e8[_0x1337c6];return _0x28bcf4;};'use strict';var _=require(_0x826e('0x0'));var util=require(_0x826e('0x1'));var moment=require(_0x826e('0x2'));var BPromise=require(_0x826e('0x3'));var rs=require(_0x826e('0x4'));var fs=require('fs');var Redis=require(_0x826e('0x5'));var db=require(_0x826e('0x6'))['db'];var utils=require(_0x826e('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x826e('0x8'));var jayson=require(_0x826e('0x9'));var client=jayson['client'][_0x826e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x500fcd,_0x3e9735,_0x24a631){return new BPromise(function(_0xb5f895,_0x2f5a16){return client['request'](_0x500fcd,_0x24a631)[_0x826e('0xb')](function(_0x1d4e5c){logger['info'](_0x826e('0xc'),_0x3e9735,_0x826e('0xd'));logger[_0x826e('0xe')](_0x826e('0xf'),_0x3e9735,_0x826e('0xd'),JSON['stringify'](_0x1d4e5c));if(_0x1d4e5c[_0x826e('0x10')]){if(_0x1d4e5c[_0x826e('0x10')][_0x826e('0x11')]===0x1f4){logger[_0x826e('0x10')](_0x826e('0xc'),_0x3e9735,_0x1d4e5c[_0x826e('0x10')][_0x826e('0x12')]);return _0x2f5a16(_0x1d4e5c[_0x826e('0x10')][_0x826e('0x12')]);}logger[_0x826e('0x10')]('CmCompany,\x20%s,\x20%s',_0x3e9735,_0x1d4e5c[_0x826e('0x10')][_0x826e('0x12')]);return _0xb5f895(_0x1d4e5c[_0x826e('0x10')]['message']);}else{logger[_0x826e('0x13')](_0x826e('0xc'),_0x3e9735,_0x826e('0xd'));_0xb5f895(_0x1d4e5c[_0x826e('0x14')][_0x826e('0x12')]);}})[_0x826e('0x15')](function(_0x2b82bd){logger[_0x826e('0x10')]('CmCompany,\x20%s,\x20%s',_0x3e9735,_0x2b82bd);_0x2f5a16(_0x2b82bd);});});} \ No newline at end of file +var _0x3c73=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result'];(function(_0x56ad12,_0xbdbe29){var _0x34403a=function(_0x4a5969){while(--_0x4a5969){_0x56ad12['push'](_0x56ad12['shift']());}};_0x34403a(++_0xbdbe29);}(_0x3c73,0x1ce));var _0x33c7=function(_0x4e95f6,_0x59292a){_0x4e95f6=_0x4e95f6-0x0;var _0x799a=_0x3c73[_0x4e95f6];return _0x799a;};'use strict';var _=require(_0x33c7('0x0'));var util=require(_0x33c7('0x1'));var moment=require(_0x33c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x33c7('0x3'));var fs=require('fs');var Redis=require(_0x33c7('0x4'));var db=require(_0x33c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x33c7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x33c7('0x7'));var client=jayson[_0x33c7('0x8')][_0x33c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x389957,_0x1c5c21,_0x482b90){return new BPromise(function(_0x45fe15,_0x1dc72b){return client[_0x33c7('0xa')](_0x389957,_0x482b90)[_0x33c7('0xb')](function(_0x442b25){logger[_0x33c7('0xc')]('CmCompany,\x20%s,\x20%s',_0x1c5c21,_0x33c7('0xd'));logger['debug'](_0x33c7('0xe'),_0x1c5c21,'request\x20sent',JSON[_0x33c7('0xf')](_0x442b25));if(_0x442b25[_0x33c7('0x10')]){if(_0x442b25[_0x33c7('0x10')][_0x33c7('0x11')]===0x1f4){logger[_0x33c7('0x10')](_0x33c7('0x12'),_0x1c5c21,_0x442b25[_0x33c7('0x10')]['message']);return _0x1dc72b(_0x442b25[_0x33c7('0x10')][_0x33c7('0x13')]);}logger[_0x33c7('0x10')](_0x33c7('0x12'),_0x1c5c21,_0x442b25[_0x33c7('0x10')][_0x33c7('0x13')]);return _0x45fe15(_0x442b25[_0x33c7('0x10')]['message']);}else{logger['info'](_0x33c7('0x12'),_0x1c5c21,'request\x20sent');_0x45fe15(_0x442b25[_0x33c7('0x14')]['message']);}})['catch'](function(_0x2329c7){logger['error']('CmCompany,\x20%s,\x20%s',_0x1c5c21,_0x2329c7);_0x1dc72b(_0x2329c7);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 704d6ea..d9f817f 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 _0x8fc1=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','/describe','describe','isAuthenticated','/:id/contacts','getContacts','create','addContacts','put','/:id','update'];(function(_0x32cf96,_0x7502d5){var _0x125cc1=function(_0x376987){while(--_0x376987){_0x32cf96['push'](_0x32cf96['shift']());}};_0x125cc1(++_0x7502d5);}(_0x8fc1,0x1a0));var _0x18fc=function(_0x52e6ae,_0x502a68){_0x52e6ae=_0x52e6ae-0x0;var _0x4322d7=_0x8fc1[_0x52e6ae];return _0x4322d7;};'use strict';var multer=require(_0x18fc('0x0'));var util=require(_0x18fc('0x1'));var path=require(_0x18fc('0x2'));var timeout=require(_0x18fc('0x3'));var express=require(_0x18fc('0x4'));var router=express[_0x18fc('0x5')]();var fs_extra=require(_0x18fc('0x6'));var auth=require(_0x18fc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x18fc('0x8'));var controller=require(_0x18fc('0x9'));router[_0x18fc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x18fc('0xa')](_0x18fc('0xb'),auth['isAuthenticated'](),controller[_0x18fc('0xc')]);router[_0x18fc('0xa')]('/:id',auth[_0x18fc('0xd')](),controller['show']);router[_0x18fc('0xa')](_0x18fc('0xe'),auth[_0x18fc('0xd')](),controller[_0x18fc('0xf')]);router['post']('/',auth[_0x18fc('0xd')](),controller[_0x18fc('0x10')]);router['post'](_0x18fc('0xe'),auth[_0x18fc('0xd')](),controller[_0x18fc('0x11')]);router[_0x18fc('0x12')](_0x18fc('0x13'),auth[_0x18fc('0xd')](),controller[_0x18fc('0x14')]);router[_0x18fc('0x15')](_0x18fc('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x18fc('0x16')]=router; \ No newline at end of file +var _0x252c=['/:id/contacts','getContacts','post','create','addContacts','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x8e2097,_0x1ed2d1){var _0x45b706=function(_0x444abe){while(--_0x444abe){_0x8e2097['push'](_0x8e2097['shift']());}};_0x45b706(++_0x1ed2d1);}(_0x252c,0x18e));var _0xc252=function(_0x23c1f3,_0x56dfd6){_0x23c1f3=_0x23c1f3-0x0;var _0x1cbd48=_0x252c[_0x23c1f3];return _0x1cbd48;};'use strict';var multer=require(_0xc252('0x0'));var util=require(_0xc252('0x1'));var path=require(_0xc252('0x2'));var timeout=require(_0xc252('0x3'));var express=require('express');var router=express[_0xc252('0x4')]();var fs_extra=require(_0xc252('0x5'));var auth=require(_0xc252('0x6'));var interaction=require(_0xc252('0x7'));var config=require('../../config/environment');var controller=require(_0xc252('0x8'));router[_0xc252('0x9')]('/',auth[_0xc252('0xa')](),controller[_0xc252('0xb')]);router[_0xc252('0x9')](_0xc252('0xc'),auth[_0xc252('0xa')](),controller[_0xc252('0xd')]);router[_0xc252('0x9')](_0xc252('0xe'),auth['isAuthenticated'](),controller[_0xc252('0xf')]);router[_0xc252('0x9')](_0xc252('0x10'),auth[_0xc252('0xa')](),controller[_0xc252('0x11')]);router[_0xc252('0x12')]('/',auth['isAuthenticated'](),controller[_0xc252('0x13')]);router['post'](_0xc252('0x10'),auth[_0xc252('0xa')](),controller[_0xc252('0x14')]);router['put'](_0xc252('0xe'),auth[_0xc252('0xa')](),controller['update']);router[_0xc252('0x15')](_0xc252('0xe'),auth['isAuthenticated'](),controller[_0xc252('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 4c0a505..086894d 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 _0x18c5=['INTEGER','DATE','NOW','sequelize','exports','STRING','TEXT'];(function(_0x484e24,_0x28111d){var _0xc7d3b1=function(_0x2040e1){while(--_0x2040e1){_0x484e24['push'](_0x484e24['shift']());}};_0xc7d3b1(++_0x28111d);}(_0x18c5,0xf8));var _0x518c=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0x18c5[_0x5e77db];return _0x34b675;};'use strict';var _=require('lodash');var Sequelize=require(_0x518c('0x0'));module[_0x518c('0x1')]={'firstName':{'type':Sequelize[_0x518c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x518c('0x2')]},'postalCode':{'type':Sequelize[_0x518c('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x518c('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x518c('0x3')]},'phone':{'type':Sequelize[_0x518c('0x2')]},'mobile':{'type':Sequelize[_0x518c('0x2')]},'fax':{'type':Sequelize[_0x518c('0x2')]},'email':{'type':Sequelize[_0x518c('0x2')]},'url':{'type':Sequelize[_0x518c('0x2')]},'facebook':{'type':Sequelize[_0x518c('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x518c('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x518c('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x518c('0x2')]},'wechat':{'type':Sequelize[_0x518c('0x2')]},'telegram':{'type':Sequelize[_0x518c('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x518c('0x2')]},'priority':{'type':Sequelize[_0x518c('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x518c('0x5')],'defaultValue':Sequelize[_0x518c('0x6')]},'dialTimezone':{'type':Sequelize[_0x518c('0x2')]},'utcOffset':{'type':Sequelize[_0x518c('0x4')]}}; \ No newline at end of file +var _0x235c=['sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x353bbb,_0x56e1ab){var _0x4e6a0e=function(_0x2e1703){while(--_0x2e1703){_0x353bbb['push'](_0x353bbb['shift']());}};_0x4e6a0e(++_0x56e1ab);}(_0x235c,0x18f));var _0xc235=function(_0x2b1f33,_0x55855b){_0x2b1f33=_0x2b1f33-0x0;var _0x7840d3=_0x235c[_0x2b1f33];return _0x7840d3;};'use strict';var _=require(_0xc235('0x0'));var Sequelize=require(_0xc235('0x1'));module[_0xc235('0x2')]={'firstName':{'type':Sequelize[_0xc235('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc235('0x3')]},'street':{'type':Sequelize[_0xc235('0x3')]},'postalCode':{'type':Sequelize[_0xc235('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc235('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc235('0x4')]},'phone':{'type':Sequelize[_0xc235('0x3')]},'mobile':{'type':Sequelize[_0xc235('0x3')]},'fax':{'type':Sequelize[_0xc235('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xc235('0x3')]},'facebook':{'type':Sequelize[_0xc235('0x3')]},'fb_data':{'type':Sequelize[_0xc235('0x3')]},'twitter':{'type':Sequelize[_0xc235('0x3')]},'skype':{'type':Sequelize[_0xc235('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xc235('0x3')]},'telegram':{'type':Sequelize[_0xc235('0x3')]},'UserId':{'type':Sequelize[_0xc235('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xc235('0x3')]},'priority':{'type':Sequelize[_0xc235('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc235('0x6')],'defaultValue':Sequelize[_0xc235('0x7')]},'dialTimezone':{'type':Sequelize[_0xc235('0x3')]},'utcOffset':{'type':Sequelize[_0xc235('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f801cd3..daf847f 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 _0x44c2=['FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','catch','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','show','Tag','Tags','color','Phones','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','CmCustomField','omit','cf_%d','pickBy','map','isEmpty','cm_contacts','setFields','toParam','text','phone','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','options','nolimit','limit','getTags','setTags','ids','setAdditionalPhones','all','items','item_types','ItemTypeId','description','find','OrderBy','PHONE','literal','`ItemType`.OrderBy','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','includeAll','include','rows','ContactId','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','upload','createReadStream','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','pid','exit','error\x20child\x20process','start\x20child\x20process\x20correctly!','getJourney','mail','chat','fax','voice','resolve','channel','includes','toLowerCase','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','note','createdAt','fullname','DESC','findAndCountAll','startCase','Website','Account','thirdDisposition','UserId','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','subject','openchannel','externalUrl','threadId','Owner','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','count','offset','set','update','destroy','then','end','sendStatus','error','stack','name','send','describe','getOptions','findAll','query','user','CmContact','params','tags','keys','length','startsWith','cf_','displayName','analytics','columnName','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport'];(function(_0x524c12,_0x58ec1d){var _0x7649a2=function(_0x3fa4ae){while(--_0x3fa4ae){_0x524c12['push'](_0x524c12['shift']());}};_0x7649a2(++_0x58ec1d);}(_0x44c2,0x1a3));var _0x244c=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0x44c2[_0x36bfe3];return _0x9b0436;};'use strict';var moment=require(_0x244c('0x0'));var BPromise=require(_0x244c('0x1'));var util=require(_0x244c('0x2'));var path=require(_0x244c('0x3'));var fs=require('fs');var _=require(_0x244c('0x4'));var squel=require(_0x244c('0x5'));var Papa=require('papaparse');var Redis=require(_0x244c('0x6'));var contacts=require(_0x244c('0x7'));var qs=require(_0x244c('0x8'));var logger=require(_0x244c('0x9'))(_0x244c('0xa'));var config=require(_0x244c('0xb'));var shared=require('../../config/environment/shared');var db=require(_0x244c('0xc'))['db'];config['redis']=_[_0x244c('0xd')](config[_0x244c('0xe')],{'host':_0x244c('0xf'),'port':0x18eb});var socket=require(_0x244c('0x10'))(new Redis(config['redis']));require(_0x244c('0x11'))[_0x244c('0x12')](socket);function respondWithResult(_0x741d02,_0x1ca202){_0x1ca202=_0x1ca202||0xc8;return function(_0x75d950){if(_0x75d950){return _0x741d02[_0x244c('0x13')](_0x1ca202)[_0x244c('0x14')](_0x75d950);}};}function respondWithFilteredResult(_0x3f1592,_0x3dd0f0){return function(_0x39f961){if(_0x39f961){var _0x2b31d1=typeof _0x3dd0f0['offset']===_0x244c('0x15')&&typeof _0x3dd0f0['limit']===_0x244c('0x15');var _0x1f825b=_0x39f961[_0x244c('0x16')];var _0x5b41dc=_0x2b31d1?0x0:_0x3dd0f0['offset'];var _0x40bcb0=_0x2b31d1?_0x39f961[_0x244c('0x16')]:_0x3dd0f0[_0x244c('0x17')]+_0x3dd0f0['limit'];var _0x390c1a;if(_0x40bcb0>=_0x1f825b){_0x40bcb0=_0x1f825b;_0x390c1a=0xc8;}else{_0x390c1a=0xce;}_0x3f1592[_0x244c('0x13')](_0x390c1a);return _0x3f1592[_0x244c('0x18')]('Content-Range',_0x5b41dc+'-'+_0x40bcb0+'/'+_0x1f825b)[_0x244c('0x14')](_0x39f961);}return null;};}function saveUpdates(_0x43fe97){return function(_0x2fdab1){if(_0x2fdab1){return _0x2fdab1[_0x244c('0x19')](_0x43fe97)['then'](function(_0x27ce6d){return _0x27ce6d;});}return null;};}function removeEntity(_0x2d2bab){return function(_0x277202){if(_0x277202){return _0x277202[_0x244c('0x1a')]()[_0x244c('0x1b')](function(){_0x2d2bab['status'](0xcc)[_0x244c('0x1c')]();});}};}function handleEntityNotFound(_0x65442a){return function(_0x1ee2cd){if(!_0x1ee2cd){_0x65442a[_0x244c('0x1d')](0x194);}return _0x1ee2cd;};}function handleError(_0x54ab04,_0x280f3a){_0x280f3a=_0x280f3a||0x1f4;return function(_0x48e80a){logger[_0x244c('0x1e')](_0x48e80a[_0x244c('0x1f')]);if(_0x48e80a[_0x244c('0x20')]){delete _0x48e80a['name'];}_0x54ab04['status'](_0x280f3a)[_0x244c('0x21')](_0x48e80a);};}exports['index']=function(_0x3c12c7,_0x52d434){var _0x5e7dac={};return contacts[_0x244c('0x22')]()[_0x244c('0x1b')](function(_0x5853e0){_0x5e7dac=qs[_0x244c('0x23')](_0x5853e0,_0x3c12c7);return contacts[_0x244c('0x24')](_0x3c12c7[_0x244c('0x25')],_0x3c12c7[_0x244c('0x26')],_0x5e7dac,_0x5853e0);})[_0x244c('0x1b')](respondWithFilteredResult(_0x52d434,_0x5e7dac))['catch'](handleError(_0x52d434,null));};exports['destroy']=function(_0x131601,_0x3990e1){return db[_0x244c('0x27')]['find']({'where':{'id':_0x131601[_0x244c('0x28')]['id']}})[_0x244c('0x1b')](handleEntityNotFound(_0x3990e1,null))[_0x244c('0x1b')](removeEntity(_0x3990e1,null))['catch'](handleError(_0x3990e1,null));};exports['describe']=function(_0x38ac7e,_0xa70b0b){return db[_0x244c('0x27')][_0x244c('0x22')]()[_0x244c('0x1b')](function(_0x17b648){delete _0x17b648[_0x244c('0x29')];for(var _0x2d4c33=0x0;_0x2d4c330x0){return new Promise(function(_0x112230){var _0x32cd85=[];for(var _0x3fa0f1=0x0;_0x3fa0f1<_0x3f7274[_0x244c('0x2b')];_0x3fa0f1++){_0x32cd85[_0x244c('0x68')](insertAdditionalPhones(_0x3f7274[_0x3fa0f1]['contact'],_0x3f7274[_0x3fa0f1][_0x244c('0x62')]));}Promise['all'](_0x32cd85)[_0x244c('0x1b')](function(){_0x112230(0x1);});})[_0x244c('0x1b')](function(){return{'success':_0x35ce33,'failure':_0x21dbcf,'duplicates':_0x5ae0b1};});}else{return{'success':_0x35ce33,'failure':_0x21dbcf,'duplicates':_0x5ae0b1};}}})[_0x244c('0x1b')](respondWithResult(_0x370b6a,0xc9))[_0x244c('0x5d')](handleError(_0x370b6a,null));};exports[_0x244c('0x6c')]=function(_0x4336a7,_0x31b8e4){var _0x154cc1;return db[_0x244c('0x27')][_0x244c('0x22')]()['then'](function(_0x299b62){return db[_0x244c('0x27')]['find']({'where':{'id':_0x4336a7[_0x244c('0x28')]['id']},'include':[{'model':db[_0x244c('0x6d')],'as':_0x244c('0x6e'),'attributes':['id',_0x244c('0x20'),_0x244c('0x6f')],'required':_0x4336a7['query']['tag']?!![]:![]},{'model':db[_0x244c('0x4f')],'as':_0x244c('0x70'),'where':{'CmContactId':_0x4336a7[_0x244c('0x28')]['id']},'required':![],'include':[{'model':db[_0x244c('0x71')],'as':_0x244c('0x72')}]}],'order':[db[_0x244c('0x73')]['literal'](_0x244c('0x74'))],'attributes':_[_0x244c('0x2a')](_0x299b62)});})[_0x244c('0x1b')](function(_0x21d860){if(!_[_0x244c('0x5f')](_0x21d860)){_0x154cc1=_0x21d860[_0x244c('0x3b')]({'plain':!![]});var _0x50cc9b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x21d860&&_0x21d860[_0x244c('0x69')]){if(_0x21d860[_0x244c('0x69')]){_0x50cc9b[_0x244c('0x66')][_0x244c('0x75')][_0x244c('0x68')]({'ListId':{'$ne':_0x21d860['ListId']}});}}return db[_0x244c('0x76')]['findAll'](_0x50cc9b);}})[_0x244c('0x1b')](function(_0x18004e){if(!_[_0x244c('0x5f')](_0x18004e)){return _[_0x244c('0x77')](_0x154cc1,_['map'](_0x18004e,function(_0x188941){return util['format'](_0x244c('0x78'),_0x188941['id']);}));}})[_0x244c('0x1b')](handleEntityNotFound(_0x31b8e4,null))['then'](respondWithResult(_0x31b8e4,null))[_0x244c('0x5d')](handleError(_0x31b8e4,null));};exports['update']=function(_0x1403fb,_0x43f288){var _0x2a13d0;if(_0x1403fb['body']['id']){delete _0x1403fb['body']['id'];}if(!_[_0x244c('0x5f')](_0x1403fb['body'][_0x244c('0x5e')])){var _0x4b88f4=_0x1403fb[_0x244c('0x39')][_0x244c('0x5e')];if(!_[_0x244c('0x5f')](shared['timezones'][_0x4b88f4]))_0x1403fb[_0x244c('0x39')]['utcOffset']=shared['timezones'][_0x4b88f4][_0x244c('0x61')];}return db[_0x244c('0x27')]['find']({'where':{'id':_0x1403fb[_0x244c('0x28')]['id']}})[_0x244c('0x1b')](handleEntityNotFound(_0x43f288,null))['then'](saveUpdates(_0x1403fb[_0x244c('0x39')],null))[_0x244c('0x1b')](function(_0x37c83b){_0x2a13d0=_0x37c83b;var _0x2564db={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x37c83b&&_0x37c83b[_0x244c('0x69')]){if(_0x37c83b[_0x244c('0x69')]){_0x2564db[_0x244c('0x66')]['$and'][_0x244c('0x68')]({'ListId':{'$ne':_0x37c83b[_0x244c('0x69')]}});}}return db[_0x244c('0x76')]['findAll'](_0x2564db);})[_0x244c('0x1b')](function(_0x1e8f04){if(_0x1e8f04){return _[_0x244c('0x77')](_[_0x244c('0x79')](_0x1403fb[_0x244c('0x39')],function(_0x1c02c7,_0xa5f736){return _[_0x244c('0x2c')](_0xa5f736,_0x244c('0x2d'));}),_[_0x244c('0x7a')](_0x1e8f04,function(_0x51bf79){return util['format'](_0x244c('0x78'),_0x51bf79['id']);}));}})[_0x244c('0x1b')](function(_0x1f1948){if(_0x1f1948&&!_[_0x244c('0x7b')](_0x1f1948)){var _0x42ff59=squel['update']()['table'](_0x244c('0x7c'))[_0x244c('0x7d')](_0x1f1948)[_0x244c('0x66')]('id\x20=\x20?',_0x1403fb[_0x244c('0x28')]['id'])[_0x244c('0x7e')]();return db[_0x244c('0x73')][_0x244c('0x25')](_0x42ff59[_0x244c('0x7f')],{'replacements':_0x42ff59[_0x244c('0x34')]});}})[_0x244c('0x1b')](function(){if(_0x1403fb[_0x244c('0x39')][_0x244c('0x80')]&&_0x2a13d0){return db['CmHopper'][_0x244c('0x19')]({'phone':_0x1403fb[_0x244c('0x39')][_0x244c('0x80')],'OrderBy':0x0},{'where':{'ContactId':_0x2a13d0['id']}});}})[_0x244c('0x1b')](function(){return _0x2a13d0;})[_0x244c('0x1b')](respondWithResult(_0x43f288,null))[_0x244c('0x5d')](handleError(_0x43f288,null));};exports['getTags']=function(_0x289675,_0x55f864){var _0x3fa6f5={};var _0x35c6cd={};var _0x478522;var _0x23b357;return db[_0x244c('0x27')][_0x244c('0x81')]({'where':{'id':_0x289675[_0x244c('0x28')]['id']}})[_0x244c('0x1b')](handleEntityNotFound(_0x55f864,null))[_0x244c('0x1b')](function(_0xdc8988){if(_0xdc8988){_0x478522=_0xdc8988;_0x35c6cd[_0x244c('0x82')]=_[_0x244c('0x2a')](db[_0x244c('0x6d')][_0x244c('0x83')]);_0x35c6cd[_0x244c('0x25')]=_[_0x244c('0x2a')](_0x289675[_0x244c('0x25')]);_0x35c6cd[_0x244c('0x84')]=_[_0x244c('0x85')](_0x35c6cd[_0x244c('0x82')],_0x35c6cd[_0x244c('0x25')]);_0x3fa6f5[_0x244c('0x86')]=_[_0x244c('0x85')](_0x35c6cd[_0x244c('0x82')],qs[_0x244c('0x87')](_0x289675[_0x244c('0x25')]['fields']));_0x3fa6f5['attributes']=_0x3fa6f5[_0x244c('0x86')]['length']?_0x3fa6f5[_0x244c('0x86')]:_0x35c6cd[_0x244c('0x82')];_0x3fa6f5[_0x244c('0x88')]=qs[_0x244c('0x89')](_0x289675[_0x244c('0x25')][_0x244c('0x89')]);_0x3fa6f5[_0x244c('0x66')]=qs[_0x244c('0x84')](_[_0x244c('0x8a')](_0x289675[_0x244c('0x25')],_0x35c6cd[_0x244c('0x84')]));if(_0x289675[_0x244c('0x25')][_0x244c('0x8b')]){_0x3fa6f5[_0x244c('0x66')]=_[_0x244c('0x8c')](_0x3fa6f5[_0x244c('0x66')],{'$or':_[_0x244c('0x7a')](_0x3fa6f5[_0x244c('0x86')],function(_0x32e233){var _0x25c8b5={};_0x25c8b5[_0x32e233]={'$like':'%'+_0x289675[_0x244c('0x25')]['filter']+'%'};return _0x25c8b5;})});}_0x3fa6f5=_[_0x244c('0x8c')]({},_0x3fa6f5,_0x289675[_0x244c('0x8d')]);return _0x478522['getTags'](_0x3fa6f5);}})['then'](function(_0x469a7c){if(_0x469a7c){_0x23b357=_0x469a7c[_0x244c('0x2b')];if(!_0x289675[_0x244c('0x25')][_0x244c('0x38')](_0x244c('0x8e'))){_0x3fa6f5[_0x244c('0x8f')]=qs['limit'](_0x289675[_0x244c('0x25')]['limit']);_0x3fa6f5[_0x244c('0x17')]=qs[_0x244c('0x17')](_0x289675['query']['offset']);}return _0x478522[_0x244c('0x90')](_0x3fa6f5);}})[_0x244c('0x1b')](function(_0x36700e){if(_0x36700e){return _0x36700e?{'count':_0x23b357,'rows':_0x36700e}:null;}})[_0x244c('0x1b')](respondWithResult(_0x55f864,null))[_0x244c('0x5d')](handleError(_0x55f864,null));};exports[_0x244c('0x91')]=function(_0x396a9c,_0xdda361){if(_0x396a9c['body']['id']){delete _0x396a9c[_0x244c('0x39')]['id'];}return db[_0x244c('0x27')]['findOne']({'where':{'id':_0x396a9c['params']['id']}})['then'](handleEntityNotFound(_0xdda361,null))[_0x244c('0x1b')](function(_0x1209d6){if(_0x1209d6){return _0x1209d6['setTags'](_0x396a9c['body'][_0x244c('0x92')]||[]);}return null;})[_0x244c('0x1b')](respondWithResult(_0xdda361,null))[_0x244c('0x5d')](handleError(_0xdda361,null));};exports[_0x244c('0x93')]=function(_0x49dadb,_0x58f78a){var _0x550382=[];_0x550382[_0x244c('0x68')](addAdditionalPhones(_0x49dadb[_0x244c('0x39')]));Promise[_0x244c('0x94')](_0x550382)['then'](function(){_0x550382=[];_0x550382['push'](deleteCmHopperPhones(_0x49dadb[_0x244c('0x39')]['id']));_0x550382['push'](addCmHopperPhones(_0x49dadb[_0x244c('0x39')]['id']));Promise['all'](_0x550382)[_0x244c('0x1b')](function(){return[0x1];})['then'](respondWithResult(_0x58f78a,null));});};function addAdditionalPhones(_0x2ba417){var _0x130be1;return new Promise(function(_0x4a546e){return db[_0x244c('0x4f')][_0x244c('0x1a')]({'where':{'CmContactId':_0x2ba417['id']}})[_0x244c('0x1b')](function(){db[_0x244c('0x71')][_0x244c('0x24')]({'raw':!![],'attributes':['id','OrderBy']})[_0x244c('0x1b')](function(_0x370e26){var _0x1936d4=[];for(var _0x3ae0f3=0x0;_0x3ae0f3<_0x2ba417[_0x244c('0x95')][_0x244c('0x2b')];_0x3ae0f3++){var _0x3026d5=_0x2ba417[_0x244c('0x96')]?_['isNil'](_0x2ba417['item_types'][_0x3ae0f3])?'':_0x2ba417[_0x244c('0x96')][_0x3ae0f3]:_0x2ba417['items'][_0x3ae0f3][_0x244c('0x97')]?_0x2ba417['items'][_0x3ae0f3]['ItemTypeId']:'';var _0x42e78e=_['isNil'](_0x2ba417[_0x244c('0x95')][_0x3ae0f3][_0x244c('0x98')])?'':_0x2ba417['items'][_0x3ae0f3]['description'];var _0x3079f5=_0x3026d5+':'+_0x2ba417[_0x244c('0x95')][_0x3ae0f3][_0x244c('0x80')]+'§'+_0x42e78e;if(_['isNil'](_0x130be1))_0x130be1=_0x3079f5;else _0x130be1+=';'+_0x3079f5;var _0xc1958f=null;var _0x811f71=null;if(_0x2ba417[_0x244c('0x96')]){if(!_['isNil'](_0x2ba417[_0x244c('0x96')][_0x3ae0f3])){_0x811f71=_[_0x244c('0x99')](_0x370e26,function(_0x52dcf0){return _0x52dcf0['id']===_0x2ba417[_0x244c('0x96')][_0x3ae0f3];});if(!_[_0x244c('0x5f')](_0x811f71)){_0xc1958f=_0x811f71[_0x244c('0x9a')];}}}else{if(!_[_0x244c('0x5f')](_0x2ba417[_0x244c('0x95')][_0x3ae0f3])){_0x811f71=_[_0x244c('0x99')](_0x370e26,function(_0x2b0dbb){return _0x2b0dbb['id']===_0x2ba417[_0x244c('0x95')][_0x3ae0f3][_0x244c('0x97')];});if(!_[_0x244c('0x5f')](_0x811f71)){_0xc1958f=_0x3ae0f3;}}}if(_[_0x244c('0x5f')](_0xc1958f)){_0xc1958f=0x64;}_0x1936d4[_0x244c('0x68')](addAdditionalPhone(_0x2ba417['id'],_0x2ba417[_0x244c('0x95')][_0x3ae0f3][_0x244c('0x80')],_0x2ba417[_0x244c('0x96')]?_[_0x244c('0x5f')](_0x2ba417[_0x244c('0x96')][_0x3ae0f3])?null:_0x2ba417[_0x244c('0x96')][_0x3ae0f3]:_0x2ba417['items'][_0x3ae0f3]['ItemTypeId']?_0x2ba417[_0x244c('0x95')][_0x3ae0f3]['ItemTypeId']:null,_0xc1958f,_0x42e78e));}Promise[_0x244c('0x94')](_0x1936d4)[_0x244c('0x1b')](function(){db[_0x244c('0x27')][_0x244c('0x19')]({'AdditionalPhones':_0x130be1},{'where':{'id':_0x2ba417['id']}})[_0x244c('0x1b')](function(){_0x4a546e(0x1);});});});});});}function addAdditionalPhone(_0x4d0697,_0xbe4be8,_0x881316,_0x9f16f7,_0x212787){return db[_0x244c('0x4f')][_0x244c('0x99')]({'where':{'CmContactId':_0x4d0697,'item':_0xbe4be8}})[_0x244c('0x1b')](function(_0x2cfdcb){if(_0x2cfdcb)logger['info']('contact\x20phone\x20exists',_0x2cfdcb);else{db[_0x244c('0x4f')][_0x244c('0x44')]({'CmContactId':_0x4d0697,'item':_0xbe4be8,'ItemTypeId':_0x881316,'OrderBy':_0x9f16f7,'ItemClass':_0x244c('0x9b'),'description':_0x212787});}});}function deleteCmHopperPhones(_0x8f1545){return new Promise(function(_0x2fba19){return db[_0x244c('0x40')][_0x244c('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x8f1545}})['then'](function(_0x3f053b){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x244c('0x7a')](_0x3f053b,'id')}}});})[_0x244c('0x1b')](function(){_0x2fba19(0x1);});});}function addCmHopperPhones(_0x5dab0d){return new Promise(function(_0x1c0659){return db[_0x244c('0x40')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5dab0d}})['then'](function(_0xd29648){var _0x38b3b8=[];_[_0x244c('0x7a')](_0xd29648,function(_0x122e83){_0x38b3b8['push'](createCmHopperPhone(_0x5dab0d,_0x122e83['id']));});Promise[_0x244c('0x94')](_0x38b3b8)['then'](function(){_0x1c0659(0x1);});});});}function createCmHopperPhone(_0x19f2b3,_0x53892e){return new Promise(function(_0x215274){db['CmContactHasItem'][_0x244c('0x24')]({'raw':!![],'attributes':['item',_0x244c('0x9a')],'where':{'CmContactId':_0x19f2b3,'ItemClass':_0x244c('0x9b')},'include':[{'model':db['ContactItemType'],'attributes':['OrderBy'],'as':_0x244c('0x72')}],'order':[_0x244c('0x9a'),db[_0x244c('0x73')][_0x244c('0x9c')](_0x244c('0x9d'))]})[_0x244c('0x1b')](function(_0x49f2cb){var _0x52d058=0x1;var _0x2d18a9=_['map'](_0x49f2cb,function(_0x4bf3f2){_0x4bf3f2['CmHopperId']=_0x53892e;_0x4bf3f2[_0x244c('0x80')]=_0x4bf3f2['item'];_0x4bf3f2[_0x244c('0x9a')]=_0x52d058;delete _0x4bf3f2['ItemType.OrderBy'];_0x52d058=_0x52d058+0x1;return _0x4bf3f2;});return db[_0x244c('0x9e')][_0x244c('0x63')](_0x2d18a9,{});})[_0x244c('0x1b')](function(){_0x215274(0x1);});});}function insertAdditionalPhones(_0xa8039f,_0x158b64){return new Promise(function(_0xa6f2e){var _0x4437d8=[];for(var _0x2780cd=0x0;_0x2780cd<_0x158b64[_0x244c('0x2b')];_0x2780cd++){var _0x3a9a42=_0x158b64[_0x2780cd];_0x4437d8[_0x244c('0x68')](parseContactItemType(_0x3a9a42));}Promise[_0x244c('0x94')](_0x4437d8)[_0x244c('0x1b')](function(){var _0x22c606={'id':_0xa8039f['id'],'items':_0x158b64};return addAdditionalPhones(_0x22c606)[_0x244c('0x1b')](function(){return addCmHopperPhones(_0xa8039f['id']);});})[_0x244c('0x1b')](function(){_0xa6f2e(_0xa8039f);});});}function parseContactItemType(_0x5ef4ab){return new Promise(function(_0x17f5c4){if(_0x5ef4ab[_0x244c('0x38')](_0x244c('0x97'))){_0x17f5c4(_0x5ef4ab);}else{return db[_0x244c('0x71')][_0x244c('0x99')]({'where':{'name':_0x5ef4ab[_0x244c('0x72')]}})[_0x244c('0x1b')](function(_0x3888f0){if(_[_0x244c('0x5f')](_0x3888f0))_0x5ef4ab[_0x244c('0x97')]=null;else _0x5ef4ab[_0x244c('0x97')]=_0x3888f0['id'];_0x17f5c4(_0x5ef4ab);});}});}exports[_0x244c('0x9f')]=function(_0x169d8f,_0x173541){return db[_0x244c('0x4f')][_0x244c('0x24')]({'raw':!![],'where':{'CmContactId':_0x169d8f[_0x244c('0x28')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x244c('0x71')],'as':_0x244c('0x72')}],'order':[['OrderBy'],[db[_0x244c('0x73')]['literal'](_0x244c('0x9d'))]]})[_0x244c('0x1b')](function(_0x5760d3){return _0x5760d3;})[_0x244c('0x1b')](respondWithResult(_0x173541,null))[_0x244c('0x5d')](handleError(_0x173541,null));};exports[_0x244c('0xa0')]=function(_0x4be330,_0x4d5313){return db[_0x244c('0x4f')][_0x244c('0x24')]({'raw':!![],'where':{'CmContactId':_0x4be330[_0x244c('0x39')][_0x244c('0xa1')]}})[_0x244c('0x1b')](function(_0x13a060){var _0x206429=_['map'](_0x13a060,function(_0x22527a){_0x22527a[_0x244c('0xa2')]=_0x4be330[_0x244c('0x39')][_0x244c('0xa3')];return _0x22527a;});return db[_0x244c('0x4f')]['bulkCreate'](_0x206429,{});})[_0x244c('0x1b')](function(){return addCmHopperPhones(_0x4be330[_0x244c('0x39')][_0x244c('0xa3')]);})['then'](function(){return['ok'];})[_0x244c('0x1b')](respondWithResult(_0x4d5313,null))['catch'](handleError(_0x4d5313,null));};exports[_0x244c('0xa4')]=function(_0x5174f2,_0x49c521){var _0x81e86f=[];_0x81e86f[_0x244c('0x68')](createCmHopperPhone(_0x5174f2[_0x244c('0x39')]['id'],_0x5174f2[_0x244c('0x39')][_0x244c('0xa5')]));Promise['all'](_0x81e86f)[_0x244c('0x1b')](function(){return[0x1];})[_0x244c('0x1b')](respondWithResult(_0x49c521,null));};exports['getHoppers']=function(_0x30d3d3,_0x3de529){var _0x19b636={'raw':![],'where':{}};var _0x841c27={};var _0x337fab={'count':0x0,'rows':[]};return db['CmContact'][_0x244c('0x81')]({'where':{'id':_0x30d3d3['params']['id']}})[_0x244c('0x1b')](handleEntityNotFound(_0x3de529,null))[_0x244c('0x1b')](function(_0x38ee28){if(_0x38ee28){_0x841c27[_0x244c('0x82')]=_[_0x244c('0x2a')](db[_0x244c('0x40')][_0x244c('0x83')]);_0x841c27[_0x244c('0x25')]=_[_0x244c('0x2a')](_0x30d3d3[_0x244c('0x25')]);_0x841c27['filters']=_[_0x244c('0x85')](_0x841c27[_0x244c('0x82')],_0x841c27[_0x244c('0x25')]);_0x19b636['attributes']=_['intersection'](_0x841c27['model'],qs[_0x244c('0x87')](_0x30d3d3[_0x244c('0x25')][_0x244c('0x87')]));_0x19b636[_0x244c('0x86')]=_0x19b636[_0x244c('0x86')][_0x244c('0x2b')]?_0x19b636[_0x244c('0x86')]:_0x841c27[_0x244c('0x82')];if(!_0x30d3d3[_0x244c('0x25')][_0x244c('0x38')](_0x244c('0x8e'))){_0x19b636[_0x244c('0x8f')]=qs['limit'](_0x30d3d3[_0x244c('0x25')][_0x244c('0x8f')]);_0x19b636[_0x244c('0x17')]=qs[_0x244c('0x17')](_0x30d3d3['query'][_0x244c('0x17')]);}_0x19b636[_0x244c('0x88')]=qs[_0x244c('0x89')](_0x30d3d3['query'][_0x244c('0x89')]);_0x19b636['where']=qs[_0x244c('0x84')](_['pick'](_0x30d3d3[_0x244c('0x25')],_0x841c27['filters']));_0x19b636[_0x244c('0x66')]['ContactId']=_0x38ee28['id'];if(_0x30d3d3[_0x244c('0x25')]['filter']){_0x19b636['where']=_[_0x244c('0x8c')](_0x19b636['where'],{'$or':_[_0x244c('0x7a')](_0x19b636[_0x244c('0x86')],function(_0x2ea803){var _0x178703={};_0x178703[_0x2ea803]={'$like':'%'+_0x30d3d3[_0x244c('0x25')][_0x244c('0x8b')]+'%'};return _0x178703;})});}_0x19b636=_[_0x244c('0x8c')]({},_0x19b636,_0x30d3d3[_0x244c('0x8d')]);return db[_0x244c('0x40')][_0x244c('0x16')]({'where':_0x19b636['where']})['then'](function(_0x597f0b){_0x337fab[_0x244c('0x16')]=_0x597f0b;if(_0x30d3d3[_0x244c('0x25')][_0x244c('0xa6')]){_0x19b636[_0x244c('0xa7')]=[{'all':!![]}];}return db[_0x244c('0x40')][_0x244c('0x24')](_0x19b636);})[_0x244c('0x1b')](function(_0x54fefc){_0x337fab[_0x244c('0xa8')]=_0x54fefc;return _0x337fab;});}})[_0x244c('0x1b')](respondWithFilteredResult(_0x3de529,_0x19b636))['catch'](handleError(_0x3de529,null));};exports['getHopperHistories']=function(_0x484629,_0x462f13){var _0x107dc5={'raw':!![],'where':{}};var _0x49e31f={};var _0x79f40c={'count':0x0,'rows':[]};return db[_0x244c('0x27')][_0x244c('0x81')]({'where':{'id':_0x484629['params']['id']}})[_0x244c('0x1b')](handleEntityNotFound(_0x462f13,null))[_0x244c('0x1b')](function(_0x5193c8){if(_0x5193c8){_0x49e31f[_0x244c('0x82')]=_['keys'](db[_0x244c('0x51')][_0x244c('0x83')]);_0x49e31f[_0x244c('0x25')]=_[_0x244c('0x2a')](_0x484629[_0x244c('0x25')]);_0x49e31f[_0x244c('0x84')]=_[_0x244c('0x85')](_0x49e31f[_0x244c('0x82')],_0x49e31f[_0x244c('0x25')]);_0x107dc5[_0x244c('0x86')]=_['intersection'](_0x49e31f[_0x244c('0x82')],qs[_0x244c('0x87')](_0x484629['query'][_0x244c('0x87')]));_0x107dc5[_0x244c('0x86')]=_0x107dc5[_0x244c('0x86')][_0x244c('0x2b')]?_0x107dc5[_0x244c('0x86')]:_0x49e31f['model'];if(!_0x484629['query']['hasOwnProperty'](_0x244c('0x8e'))){_0x107dc5[_0x244c('0x8f')]=qs[_0x244c('0x8f')](_0x484629[_0x244c('0x25')][_0x244c('0x8f')]);_0x107dc5['offset']=qs['offset'](_0x484629[_0x244c('0x25')][_0x244c('0x17')]);}_0x107dc5[_0x244c('0x88')]=qs[_0x244c('0x89')](_0x484629[_0x244c('0x25')]['sort']);_0x107dc5['where']=qs[_0x244c('0x84')](_[_0x244c('0x8a')](_0x484629['query'],_0x49e31f[_0x244c('0x84')]));_0x107dc5[_0x244c('0x66')][_0x244c('0xa9')]=_0x5193c8['id'];if(_0x484629[_0x244c('0x25')][_0x244c('0x8b')]){_0x107dc5['where']=_['merge'](_0x107dc5[_0x244c('0x66')],{'$or':_[_0x244c('0x7a')](_0x107dc5[_0x244c('0x86')],function(_0x525b02){var _0x713e00={};_0x713e00[_0x525b02]={'$like':'%'+_0x484629['query'][_0x244c('0x8b')]+'%'};return _0x713e00;})});}_0x107dc5=_[_0x244c('0x8c')]({},_0x107dc5,_0x484629['options']);return db[_0x244c('0x51')][_0x244c('0x16')]({'where':_0x107dc5[_0x244c('0x66')]})['then'](function(_0x1ddc5a){_0x79f40c['count']=_0x1ddc5a;if(_0x484629[_0x244c('0x25')][_0x244c('0xa6')]){_0x107dc5['include']=[{'all':!![]}];}return db[_0x244c('0x51')][_0x244c('0x24')](_0x107dc5);})['then'](function(_0x276776){_0x79f40c[_0x244c('0xa8')]=_0x276776;return _0x79f40c;});}})[_0x244c('0x1b')](respondWithFilteredResult(_0x462f13,_0x107dc5))['catch'](handleError(_0x462f13,null));};exports['getHopperFinals']=function(_0x4b04d4,_0x22fc03){var _0x3decdb={'raw':!![],'where':{}};var _0x1e58fd={};var _0x1c4b11={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x4b04d4[_0x244c('0x28')]['id']}})['then'](handleEntityNotFound(_0x22fc03,null))['then'](function(_0xf46e92){if(_0xf46e92){_0x1e58fd[_0x244c('0x82')]=_[_0x244c('0x2a')](db[_0x244c('0x50')]['rawAttributes']);_0x1e58fd[_0x244c('0x25')]=_['keys'](_0x4b04d4['query']);_0x1e58fd[_0x244c('0x84')]=_['intersection'](_0x1e58fd[_0x244c('0x82')],_0x1e58fd[_0x244c('0x25')]);_0x3decdb[_0x244c('0x86')]=_[_0x244c('0x85')](_0x1e58fd[_0x244c('0x82')],qs[_0x244c('0x87')](_0x4b04d4[_0x244c('0x25')]['fields']));_0x3decdb[_0x244c('0x86')]=_0x3decdb['attributes'][_0x244c('0x2b')]?_0x3decdb[_0x244c('0x86')]:_0x1e58fd[_0x244c('0x82')];if(!_0x4b04d4[_0x244c('0x25')][_0x244c('0x38')](_0x244c('0x8e'))){_0x3decdb['limit']=qs['limit'](_0x4b04d4['query']['limit']);_0x3decdb[_0x244c('0x17')]=qs[_0x244c('0x17')](_0x4b04d4['query'][_0x244c('0x17')]);}_0x3decdb['order']=qs['sort'](_0x4b04d4[_0x244c('0x25')][_0x244c('0x89')]);_0x3decdb[_0x244c('0x66')]=qs[_0x244c('0x84')](_[_0x244c('0x8a')](_0x4b04d4[_0x244c('0x25')],_0x1e58fd['filters']));_0x3decdb[_0x244c('0x66')][_0x244c('0xa9')]=_0xf46e92['id'];if(_0x4b04d4[_0x244c('0x25')][_0x244c('0x8b')]){_0x3decdb['where']=_[_0x244c('0x8c')](_0x3decdb['where'],{'$or':_[_0x244c('0x7a')](_0x3decdb[_0x244c('0x86')],function(_0x40ca7e){var _0x5b2fb2={};_0x5b2fb2[_0x40ca7e]={'$like':'%'+_0x4b04d4[_0x244c('0x25')]['filter']+'%'};return _0x5b2fb2;})});}_0x3decdb=_[_0x244c('0x8c')]({},_0x3decdb,_0x4b04d4[_0x244c('0x8d')]);return db[_0x244c('0x50')][_0x244c('0x16')]({'where':_0x3decdb[_0x244c('0x66')]})[_0x244c('0x1b')](function(_0x16e8ad){_0x1c4b11[_0x244c('0x16')]=_0x16e8ad;if(_0x4b04d4['query']['includeAll']){_0x3decdb[_0x244c('0xa7')]=[{'all':!![]}];}return db[_0x244c('0x50')]['findAll'](_0x3decdb);})[_0x244c('0x1b')](function(_0xbedb2d){_0x1c4b11[_0x244c('0xa8')]=_0xbedb2d;return _0x1c4b11;});}})[_0x244c('0x1b')](respondWithFilteredResult(_0x22fc03,_0x3decdb))['catch'](handleError(_0x22fc03,null));};exports[_0x244c('0xaa')]=function(_0x1b0525,_0x5aa76d){var _0x497ff0={'raw':!![],'where':{}};var _0x4bdf56={};var _0x47f74f={'count':0x0,'rows':[]};return db[_0x244c('0x27')][_0x244c('0x81')]({'where':{'id':_0x1b0525[_0x244c('0x28')]['id']}})['then'](handleEntityNotFound(_0x5aa76d,null))['then'](function(_0x1fd1a7){if(_0x1fd1a7){_0x4bdf56[_0x244c('0x82')]=_[_0x244c('0x2a')](db[_0x244c('0x59')][_0x244c('0x83')]);_0x4bdf56[_0x244c('0x25')]=_['keys'](_0x1b0525['query']);_0x4bdf56['filters']=_[_0x244c('0x85')](_0x4bdf56[_0x244c('0x82')],_0x4bdf56['query']);_0x497ff0[_0x244c('0x86')]=_[_0x244c('0x85')](_0x4bdf56[_0x244c('0x82')],qs[_0x244c('0x87')](_0x1b0525['query']['fields']));_0x497ff0[_0x244c('0x86')]=_0x497ff0[_0x244c('0x86')]['length']?_0x497ff0[_0x244c('0x86')]:_0x4bdf56[_0x244c('0x82')];if(!_0x1b0525['query'][_0x244c('0x38')](_0x244c('0x8e'))){_0x497ff0[_0x244c('0x8f')]=qs[_0x244c('0x8f')](_0x1b0525['query'][_0x244c('0x8f')]);_0x497ff0[_0x244c('0x17')]=qs[_0x244c('0x17')](_0x1b0525[_0x244c('0x25')]['offset']);}_0x497ff0[_0x244c('0x88')]=qs['sort'](_0x1b0525[_0x244c('0x25')][_0x244c('0x89')]);_0x497ff0[_0x244c('0x66')]=qs['filters'](_[_0x244c('0x8a')](_0x1b0525[_0x244c('0x25')],_0x4bdf56['filters']));_0x497ff0[_0x244c('0x66')]['ContactId']=_0x1fd1a7['id'];if(_0x1b0525[_0x244c('0x25')][_0x244c('0x8b')]){_0x497ff0[_0x244c('0x66')]=_[_0x244c('0x8c')](_0x497ff0[_0x244c('0x66')],{'$or':_[_0x244c('0x7a')](_0x497ff0[_0x244c('0x86')],function(_0x1af9a4){var _0x8d3418={};_0x8d3418[_0x1af9a4]={'$like':'%'+_0x1b0525['query'][_0x244c('0x8b')]+'%'};return _0x8d3418;})});}_0x497ff0=_[_0x244c('0x8c')]({},_0x497ff0,_0x1b0525['options']);return db['JscriptySessionReport'][_0x244c('0x16')]({'where':_0x497ff0['where']})['then'](function(_0x1b009e){_0x47f74f[_0x244c('0x16')]=_0x1b009e;if(_0x1b0525[_0x244c('0x25')]['includeAll']){_0x497ff0[_0x244c('0xa7')]=[{'all':!![]}];}return db[_0x244c('0x59')][_0x244c('0x24')](_0x497ff0);})[_0x244c('0x1b')](function(_0x3299aa){_0x47f74f[_0x244c('0xa8')]=_0x3299aa;return _0x47f74f;});}})['then'](respondWithFilteredResult(_0x5aa76d,_0x497ff0))['catch'](handleError(_0x5aa76d,null));};exports[_0x244c('0xab')]=function(_0xa11160,_0x2d9dcf){try{if(!_0xa11160['body'][_0x244c('0x69')]){throw new Error(_0x244c('0xac'));}if(!_0xa11160[_0x244c('0x39')][_0x244c('0xad')]){throw new Error(_0x244c('0xae'));}if(!_0xa11160[_0x244c('0x39')]['binding_values']){throw new Error(_0x244c('0xaf'));}if(!_0xa11160[_0x244c('0x39')]['socket_timestamp']){throw new Error(_0x244c('0xb0'));}var _0x50032c=_0xa11160[_0x244c('0x39')]['binding_keys']['split'](',');var _0x526a3d=_0xa11160[_0x244c('0x39')][_0x244c('0xb1')]['split'](',');if(!_0x50032c[_0x244c('0x2b')]||!_0x526a3d['length']||_0x50032c[_0x244c('0x2b')]!==_0x526a3d[_0x244c('0x2b')]){throw new Error(_0x244c('0xb2'));}_0xa11160[_0x244c('0x39')][_0x244c('0x87')]=_['zipObject'](_0x50032c,_0x526a3d);if(!_0xa11160['body'][_0x244c('0x87')]['phone']){throw new Error(_0x244c('0xb3'));}if(!_0xa11160[_0x244c('0x39')]['fields'][_0x244c('0xb4')]){throw new Error(_0x244c('0xb5'));}var _0x9af0a6=path[_0x244c('0x3e')](config[_0x244c('0xb6')],_0x244c('0xb7'),_0xa11160[_0x244c('0xb8')]['filename']);fs[_0x244c('0xb9')](_0x9af0a6,parseInt('0777',0x8));var _0x2fc812=require(_0x244c('0xba'))[_0x244c('0xbb')](path[_0x244c('0x3e')](__dirname,_0x244c('0xbc')),[_0x9af0a6,_0xa11160[_0x244c('0x39')][_0x244c('0xad')],_0xa11160[_0x244c('0x39')][_0x244c('0xb1')],_0xa11160[_0x244c('0x39')]['ListId'],_0xa11160['body'][_0x244c('0xbd')],_0xa11160[_0x244c('0x39')][_0x244c('0x65')],_0xa11160[_0x244c('0x39')][_0x244c('0xbe')]]);return _0x2d9dcf[_0x244c('0x13')](0xc8)[_0x244c('0x14')]({'message':_0x244c('0xbf'),'pid':_0x2fc812['pid']});}catch(_0x4b3b35){return _0x2d9dcf[_0x244c('0x13')](0x1f4)['send'](_0x4b3b35);}};exports[_0x244c('0xc0')]=function(_0x572757,_0x5d5bcf){var _0x3bee69=fs[_0x244c('0xc1')](_0x572757[_0x244c('0xb8')][_0x244c('0x3')]);Papa['parse'](_0x3bee69,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4545c7){return _0x5d5bcf['status'](0xc8)[_0x244c('0x14')]({'file':_0x572757[_0x244c('0xb8')],'fields':_0x4545c7[_0x244c('0xc2')]['fields']});}});};exports[_0x244c('0xc3')]=function(_0x381bc7,_0xd282d5){return db[_0x244c('0xc4')][_0x244c('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':_0x244c('0xc5')}})['then'](function(_0x3dadd7){var _0x51940b=![];if(!_0x381bc7[_0x244c('0x39')]['ListId']){throw new Error(_0x244c('0xac'));}if(!_0x381bc7[_0x244c('0x39')]['binding'][_0x244c('0x80')]){throw new Error(_0x244c('0xb3'));}if(!_0x381bc7[_0x244c('0x39')][_0x244c('0xc6')][_0x244c('0xb4')]){throw new Error(_0x244c('0xb5'));}if(!_0x381bc7[_0x244c('0x39')]['socket_timestamp']){throw new Error(_0x244c('0xb0'));}var _0x1f1e5a=require(_0x244c('0xba'))['fork'](path[_0x244c('0x3e')](__dirname,_0x244c('0xc7')),[_0x381bc7['params']['id'],JSON['stringify'](_0x381bc7[_0x244c('0x39')]),JSON[_0x244c('0xc8')](_0x3dadd7)]);_0x1f1e5a['on'](_0x244c('0xc9'),function(){_0x51940b=!![];return _0xd282d5[_0x244c('0x13')](0xc8)[_0x244c('0x14')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1f1e5a[_0x244c('0xca')]});});_0x1f1e5a['on'](_0x244c('0xcb'),function(_0x13f09e){if(_0x13f09e&&!_0x51940b){return _0xd282d5[_0x244c('0x13')](0x1f4)[_0x244c('0x14')]({'message':_0x244c('0xcc'),'pid':_0x1f1e5a[_0x244c('0xca')]});}});})[_0x244c('0x5d')](handleError(_0xd282d5,null));};exports['importUpdates']=function(_0x1ee305,_0x1bad29){return db[_0x244c('0xc4')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x244c('0xc5')}})[_0x244c('0x1b')](function(_0x166f4d){var _0x3ce597=![];if(!_0x1ee305[_0x244c('0x39')]['ListId']){throw new Error(_0x244c('0xac'));}if(!_0x1ee305[_0x244c('0x39')][_0x244c('0xc6')][_0x244c('0x80')]){throw new Error(_0x244c('0xb3'));}if(!_0x1ee305[_0x244c('0x39')]['binding'][_0x244c('0xb4')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1ee305[_0x244c('0x39')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x316597=require(_0x244c('0xba'))[_0x244c('0xbb')](path[_0x244c('0x3e')](__dirname,'../../components/import/cm/csvUpdates'),[_0x1ee305[_0x244c('0x28')]['id'],JSON[_0x244c('0xc8')](_0x1ee305['body']),JSON[_0x244c('0xc8')](_0x166f4d)]);_0x316597['on']('message',function(){_0x3ce597=!![];return _0x1bad29[_0x244c('0x13')](0xc8)[_0x244c('0x14')]({'message':_0x244c('0xcd'),'pid':_0x316597[_0x244c('0xca')]});});_0x316597['on']('exit',function(_0x22bb5e){if(_0x22bb5e&&!_0x3ce597){return _0x1bad29['status'](0x1f4)[_0x244c('0x14')]({'message':_0x244c('0xcc'),'pid':_0x316597['pid']});}});})[_0x244c('0x5d')](handleError(_0x1bad29,null));};exports[_0x244c('0xce')]=function(_0x4d8ff9,_0x56dcf9){var _0x58fdcf=[_0x244c('0xcf'),_0x244c('0xd0'),'sms','openchannel',_0x244c('0xd1'),'whatsapp',_0x244c('0xd2')];var _0x23fc09={'offset':0x0,'order':qs[_0x244c('0x89')]('-createdAt')},_0x191e66={'count':0x0,'rows':[]};Promise[_0x244c('0xd3')]()['then'](function(){if(_0x4d8ff9[_0x244c('0x25')][_0x244c('0xd4')]){if(!_[_0x244c('0xd5')](_0x58fdcf,_0x4d8ff9[_0x244c('0x25')][_0x244c('0xd4')][_0x244c('0xd6')]())){throw new Error('Invalid\x20channel');}_0x58fdcf=[_0x4d8ff9[_0x244c('0x25')][_0x244c('0xd4')][_0x244c('0xd6')]()];}if(_0x4d8ff9[_0x244c('0x25')][_0x244c('0xd7')]){try{var _0x4297ea=JSON[_0x244c('0xd8')](_0x4d8ff9[_0x244c('0x25')][_0x244c('0xd7')]);if(!moment(_0x4297ea[_0x244c('0x3a')])[_0x244c('0xd9')]()){throw new Error(_0x244c('0xda'));}if(!moment(_0x4297ea['to'])[_0x244c('0xd9')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x33637f){throw new Error(_0x244c('0xdb'));}}if(!_0x4d8ff9[_0x244c('0x25')]['hasOwnProperty'](_0x244c('0x8e'))){_0x23fc09[_0x244c('0x8f')]=qs[_0x244c('0x8f')](_0x4d8ff9[_0x244c('0x25')][_0x244c('0x8f')]||0xa);_0x23fc09['offset']=qs['offset'](_0x4d8ff9['query']['offset']);}var _0x19f485=_0x58fdcf[_0x244c('0x7a')](function(_0x52d189){if(_0x52d189===_0x244c('0xd2')){var _0x4149d3={'attributes':['id',_0x244c('0xdc'),_0x244c('0x33'),_0x244c('0xdd'),_0x244c('0xde'),_0x244c('0xdf'),_0x244c('0xe0'),'endtime','duration',_0x244c('0xe1'),_0x244c('0xe2'),'userDisposition','userSecondDisposition','userThirdDisposition','UserId'],'where':{'ContactId':_0x4d8ff9['params']['id']},'include':[{'model':db[_0x244c('0xc4')],'as':_0x244c('0xc4'),'attributes':['id',_0x244c('0x20'),_0x244c('0xe3'),_0x244c('0x31')]}],'order':[[_0x244c('0xe2'),_0x244c('0xe4')]]};if(_0x4d8ff9[_0x244c('0x25')][_0x244c('0xd7')]){_0x4149d3[_0x244c('0x66')]['createdAt']={'$gte':_0x4297ea[_0x244c('0x3a')],'$lte':_0x4297ea['to']};}return db['VoiceCallReport'][_0x244c('0xe5')](_0x4149d3)[_0x244c('0x1b')](function(_0x159b7d){_0x191e66[_0x244c('0x16')]+=_0x159b7d[_0x244c('0x16')];return _[_0x244c('0x7a')](_0x159b7d[_0x244c('0xa8')],function(_0x56b606){var _0xf6a500=_0x56b606[_0x244c('0x3b')]({'plain':!![]});_0xf6a500[_0x244c('0xd4')]=_0x52d189;if(_0xf6a500['User']){_0xf6a500[_0x244c('0xc4')]={'id':_0xf6a500[_0x244c('0xc4')]['id'],'name':_0xf6a500[_0x244c('0xc4')][_0x244c('0x20')],'fullname':_0xf6a500[_0x244c('0xc4')][_0x244c('0xe3')],'alias':_0xf6a500['User'][_0x244c('0x31')]};}return _0xf6a500;});});}else{var _0x33a986=_[_0x244c('0xe6')](_0x52d189)+(_0x52d189===_0x244c('0xd0')?_0x244c('0xe7'):_0x244c('0xe8'));var _0x558c2b={'attributes':['id','closed','closedAt',_0x244c('0xe2'),'note','disposition','secondDisposition',_0x244c('0xe9'),_0x244c('0xea'),_0x33a986+'Id'],'where':{'ContactId':_0x4d8ff9['params']['id']},'include':[{'model':db[_0x33a986],'as':_0x244c('0xe8'),'attributes':['id',_0x244c('0x20'),'key']},{'model':db[_0x244c('0xc4')],'as':'Owner','attributes':['id',_0x244c('0x20'),'fullname']},{'model':db[_0x244c('0x6d')],'as':_0x244c('0x6e'),'attributes':['id',_0x244c('0x20'),_0x244c('0x6f')],'through':{'attributes':[]}}],'order':[[_0x244c('0xe2'),_0x244c('0xe4')]]};if(_0x4d8ff9[_0x244c('0x25')]['range']){_0x558c2b['where'][_0x244c('0xe2')]={'$gte':_0x4297ea['from'],'$lte':_0x4297ea['to']};}switch(_0x52d189){case _0x244c('0xd0'):_0x558c2b[_0x244c('0x86')][_0x244c('0x68')](_0x244c('0xeb'),_0x244c('0xec'),_0x244c('0xed'),_0x244c('0xee'),_0x244c('0xef'),_0x244c('0xf0'),_0x244c('0xf1'),'ratingValue',_0x244c('0xf2'));break;case _0x244c('0xcf'):_0x558c2b[_0x244c('0x86')][_0x244c('0x68')](_0x244c('0xf3'),'substatus');break;case _0x244c('0xf4'):_0x558c2b['attributes'][_0x244c('0x68')](_0x244c('0xf5'),_0x244c('0xf6'));break;}return db[_['startCase'](_0x52d189)+'Interaction'][_0x244c('0xe5')](_0x558c2b)[_0x244c('0x1b')](function(_0x275511){_0x191e66[_0x244c('0x16')]+=_0x275511[_0x244c('0x16')];return _[_0x244c('0x7a')](_0x275511[_0x244c('0xa8')],function(_0x2cbf99){var _0x287ebc=_0x2cbf99['get']({'plain':!![]});_0x287ebc[_0x244c('0xd4')]=_0x52d189;if(_0x287ebc[_0x244c('0xf7')]){_0x287ebc[_0x244c('0xf7')]={'id':_0x287ebc[_0x244c('0xf7')]['id'],'name':_0x287ebc['Owner']['name'],'fullname':_0x287ebc[_0x244c('0xf7')][_0x244c('0xe3')]};}return _0x287ebc;});});}});return Promise[_0x244c('0x94')](_0x19f485);})['then'](function(_0x2c40e1){return _(_0x2c40e1)['flatten']()[_0x244c('0xf8')](_0x244c('0xe2'))[_0x244c('0xf9')]()[_0x244c('0xfa')]();})['then'](function(_0x17be17){_0x191e66['rows']=_0x23fc09[_0x244c('0x8f')]?_0x17be17[_0x244c('0xfb')](_0x23fc09[_0x244c('0x17')],_0x23fc09['offset']+_0x23fc09[_0x244c('0x8f')]):_0x17be17;return _0x191e66;})[_0x244c('0x1b')](respondWithFilteredResult(_0x56dcf9,_0x23fc09))[_0x244c('0x5d')](handleError(_0x56dcf9,null));}; \ No newline at end of file +var _0xb36a=['phone','getTags','findOne','model','rawAttributes','intersection','attributes','fields','order','sort','filters','merge','options','nolimit','limit','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','CmHopperId','ItemType.OrderBy','sequelize','`ItemType`.OrderBy','fromContactId','toContactId','getHoppers','ContactId','filter','includeAll','include','rows','getHopperHistories','CmHopperHistory','pick','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','child_process','CompanyId','pid','upload','createReadStream','import','User','agent','No\x20phone\x20column\x20specified','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','importUpdates','fork','../../components/import/cm/csvUpdates','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','parse','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','alias','findAndCountAll','startCase','Website','Account','closed','disposition','UserId','key','DESC','customerPort','deviceModel','osName','ratingType','ratingValue','referer','substatus','threadId','Interaction','Owner','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','count','offset','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','describe','findAll','query','catch','destroy','CmContact','params','length','keys','startsWith','columnName','displayName','analytics','CmCustomField','cf_','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','from','get','mergeWith','tags','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','create','join','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','push','ListId','spread','contact','all','show','find','Tag','Tags','color','tag','ContactItemType','ItemType','Phones.OrderBy','$and','map','dialTimezone','omit','pickBy','format','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','text'];(function(_0x1c87bc,_0x1ed010){var _0xbba8f6=function(_0x3efae1){while(--_0x3efae1){_0x1c87bc['push'](_0x1c87bc['shift']());}};_0xbba8f6(++_0x1ed010);}(_0xb36a,0x83));var _0xab36=function(_0x28ee99,_0x1c3d97){_0x28ee99=_0x28ee99-0x0;var _0x599dda=_0xb36a[_0x28ee99];return _0x599dda;};'use strict';var moment=require(_0xab36('0x0'));var BPromise=require(_0xab36('0x1'));var util=require(_0xab36('0x2'));var path=require(_0xab36('0x3'));var fs=require('fs');var _=require(_0xab36('0x4'));var squel=require(_0xab36('0x5'));var Papa=require(_0xab36('0x6'));var Redis=require(_0xab36('0x7'));var contacts=require('../../components/contacts');var qs=require(_0xab36('0x8'));var logger=require(_0xab36('0x9'))('api');var config=require('../../config/environment');var shared=require(_0xab36('0xa'));var db=require(_0xab36('0xb'))['db'];config[_0xab36('0xc')]=_['defaults'](config[_0xab36('0xc')],{'host':_0xab36('0xd'),'port':0x18eb});var socket=require(_0xab36('0xe'))(new Redis(config['redis']));require(_0xab36('0xf'))[_0xab36('0x10')](socket);function respondWithResult(_0x424087,_0x1a2994){_0x1a2994=_0x1a2994||0xc8;return function(_0x576f1f){if(_0x576f1f){return _0x424087[_0xab36('0x11')](_0x1a2994)[_0xab36('0x12')](_0x576f1f);}};}function respondWithFilteredResult(_0x2cd8b6,_0x1e93d2){return function(_0xcc69aa){if(_0xcc69aa){var _0x1d07cb=typeof _0x1e93d2['offset']===_0xab36('0x13')&&typeof _0x1e93d2['limit']===_0xab36('0x13');var _0x5a3014=_0xcc69aa[_0xab36('0x14')];var _0x26f7b7=_0x1d07cb?0x0:_0x1e93d2[_0xab36('0x15')];var _0x1e3d85=_0x1d07cb?_0xcc69aa[_0xab36('0x14')]:_0x1e93d2[_0xab36('0x15')]+_0x1e93d2['limit'];var _0x24f34b;if(_0x1e3d85>=_0x5a3014){_0x1e3d85=_0x5a3014;_0x24f34b=0xc8;}else{_0x24f34b=0xce;}_0x2cd8b6[_0xab36('0x11')](_0x24f34b);return _0x2cd8b6[_0xab36('0x16')](_0xab36('0x17'),_0x26f7b7+'-'+_0x1e3d85+'/'+_0x5a3014)['json'](_0xcc69aa);}return null;};}function saveUpdates(_0x34d182){return function(_0x1c4974){if(_0x1c4974){return _0x1c4974[_0xab36('0x18')](_0x34d182)[_0xab36('0x19')](function(_0x413c87){return _0x413c87;});}return null;};}function removeEntity(_0x46429e){return function(_0xf989bd){if(_0xf989bd){return _0xf989bd['destroy']()[_0xab36('0x19')](function(){_0x46429e[_0xab36('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49d01d){return function(_0x24dfd7){if(!_0x24dfd7){_0x49d01d[_0xab36('0x1a')](0x194);}return _0x24dfd7;};}function handleError(_0x3ea1c1,_0x2c78e5){_0x2c78e5=_0x2c78e5||0x1f4;return function(_0x172b24){logger[_0xab36('0x1b')](_0x172b24[_0xab36('0x1c')]);if(_0x172b24[_0xab36('0x1d')]){delete _0x172b24[_0xab36('0x1d')];}_0x3ea1c1['status'](_0x2c78e5)[_0xab36('0x1e')](_0x172b24);};}exports[_0xab36('0x1f')]=function(_0x39519b,_0x25700c){var _0x5ac9c2={};return contacts[_0xab36('0x20')]()[_0xab36('0x19')](function(_0x1c433b){_0x5ac9c2=qs['getOptions'](_0x1c433b,_0x39519b);return contacts[_0xab36('0x21')](_0x39519b[_0xab36('0x22')],_0x39519b['user'],_0x5ac9c2,_0x1c433b);})[_0xab36('0x19')](respondWithFilteredResult(_0x25700c,_0x5ac9c2))[_0xab36('0x23')](handleError(_0x25700c,null));};exports[_0xab36('0x24')]=function(_0xd75ba2,_0x5c2f70){return db[_0xab36('0x25')]['find']({'where':{'id':_0xd75ba2[_0xab36('0x26')]['id']}})[_0xab36('0x19')](handleEntityNotFound(_0x5c2f70,null))[_0xab36('0x19')](removeEntity(_0x5c2f70,null))[_0xab36('0x23')](handleError(_0x5c2f70,null));};exports[_0xab36('0x20')]=function(_0x114514,_0x25d070){return db[_0xab36('0x25')][_0xab36('0x20')]()[_0xab36('0x19')](function(_0x249488){delete _0x249488['tags'];for(var _0x183250=0x0;_0x1832500x0){return new Promise(function(_0x3f4668){var _0x469ad7=[];for(var _0x22b978=0x0;_0x22b978<_0x5cda37[_0xab36('0x27')];_0x22b978++){_0x469ad7[_0xab36('0x5d')](insertAdditionalPhones(_0x5cda37[_0x22b978][_0xab36('0x60')],_0x5cda37[_0x22b978][_0xab36('0x59')]));}Promise[_0xab36('0x61')](_0x469ad7)[_0xab36('0x19')](function(){_0x3f4668(0x1);});})[_0xab36('0x19')](function(){return{'success':_0x1a681f,'failure':_0x1eb1c1,'duplicates':_0x4a1919};});}else{return{'success':_0x1a681f,'failure':_0x1eb1c1,'duplicates':_0x4a1919};}}})['then'](respondWithResult(_0x17e934,0xc9))['catch'](handleError(_0x17e934,null));};exports[_0xab36('0x62')]=function(_0x3344a3,_0x9e7064){var _0x2a6681;return db[_0xab36('0x25')][_0xab36('0x20')]()['then'](function(_0x29f92f){return db[_0xab36('0x25')][_0xab36('0x63')]({'where':{'id':_0x3344a3[_0xab36('0x26')]['id']},'include':[{'model':db[_0xab36('0x64')],'as':_0xab36('0x65'),'attributes':['id','name',_0xab36('0x66')],'required':_0x3344a3[_0xab36('0x22')][_0xab36('0x67')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x3344a3[_0xab36('0x26')]['id']},'required':![],'include':[{'model':db[_0xab36('0x68')],'as':_0xab36('0x69')}]}],'order':[db['sequelize']['literal'](_0xab36('0x6a'))],'attributes':_[_0xab36('0x28')](_0x29f92f)});})[_0xab36('0x19')](function(_0x57178e){if(!_['isNil'](_0x57178e)){_0x2a6681=_0x57178e['get']({'plain':!![]});var _0x6c975d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x57178e&&_0x57178e[_0xab36('0x5e')]){if(_0x57178e[_0xab36('0x5e')]){_0x6c975d[_0xab36('0x5c')][_0xab36('0x6b')][_0xab36('0x5d')]({'ListId':{'$ne':_0x57178e['ListId']}});}}return db[_0xab36('0x2d')][_0xab36('0x21')](_0x6c975d);}})[_0xab36('0x19')](function(_0x44182d){if(!_['isNil'](_0x44182d)){return _['omit'](_0x2a6681,_[_0xab36('0x6c')](_0x44182d,function(_0x1bdaf1){return util['format']('cf_%d',_0x1bdaf1['id']);}));}})[_0xab36('0x19')](handleEntityNotFound(_0x9e7064,null))[_0xab36('0x19')](respondWithResult(_0x9e7064,null))[_0xab36('0x23')](handleError(_0x9e7064,null));};exports[_0xab36('0x18')]=function(_0x399bab,_0x30f0b9){var _0x4edef2;if(_0x399bab[_0xab36('0x36')]['id']){delete _0x399bab[_0xab36('0x36')]['id'];}if(!_['isNil'](_0x399bab[_0xab36('0x36')][_0xab36('0x6d')])){var _0x44056a=_0x399bab[_0xab36('0x36')][_0xab36('0x6d')];if(!_[_0xab36('0x56')](shared[_0xab36('0x57')][_0x44056a]))_0x399bab['body'][_0xab36('0x58')]=shared[_0xab36('0x57')][_0x44056a][_0xab36('0x58')];}return db['CmContact'][_0xab36('0x63')]({'where':{'id':_0x399bab[_0xab36('0x26')]['id']}})[_0xab36('0x19')](handleEntityNotFound(_0x30f0b9,null))['then'](saveUpdates(_0x399bab[_0xab36('0x36')],null))['then'](function(_0x5eed38){_0x4edef2=_0x5eed38;var _0x184fed={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5eed38&&_0x5eed38['ListId']){if(_0x5eed38[_0xab36('0x5e')]){_0x184fed[_0xab36('0x5c')]['$and'][_0xab36('0x5d')]({'ListId':{'$ne':_0x5eed38[_0xab36('0x5e')]}});}}return db[_0xab36('0x2d')]['findAll'](_0x184fed);})['then'](function(_0x2f6c98){if(_0x2f6c98){return _[_0xab36('0x6e')](_[_0xab36('0x6f')](_0x399bab['body'],function(_0x4a5c0d,_0x487cb1){return _[_0xab36('0x29')](_0x487cb1,_0xab36('0x2e'));}),_[_0xab36('0x6c')](_0x2f6c98,function(_0x1b5cc8){return util[_0xab36('0x70')](_0xab36('0x71'),_0x1b5cc8['id']);}));}})[_0xab36('0x19')](function(_0x29acfb){if(_0x29acfb&&!_[_0xab36('0x72')](_0x29acfb)){var _0x13d44f=squel[_0xab36('0x18')]()['table'](_0xab36('0x73'))['setFields'](_0x29acfb)[_0xab36('0x5c')](_0xab36('0x74'),_0x399bab['params']['id'])['toParam']();return db['sequelize'][_0xab36('0x22')](_0x13d44f[_0xab36('0x75')],{'replacements':_0x13d44f['values']});}})[_0xab36('0x19')](function(){if(_0x399bab[_0xab36('0x36')][_0xab36('0x76')]&&_0x4edef2){return db[_0xab36('0x3d')]['update']({'phone':_0x399bab['body'][_0xab36('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x4edef2['id']}});}})[_0xab36('0x19')](function(){return _0x4edef2;})['then'](respondWithResult(_0x30f0b9,null))[_0xab36('0x23')](handleError(_0x30f0b9,null));};exports[_0xab36('0x77')]=function(_0x219caf,_0xc6b7f){var _0x611f52={};var _0x5b228e={};var _0x258cb9;var _0x471e3d;return db[_0xab36('0x25')][_0xab36('0x78')]({'where':{'id':_0x219caf[_0xab36('0x26')]['id']}})['then'](handleEntityNotFound(_0xc6b7f,null))[_0xab36('0x19')](function(_0x22236c){if(_0x22236c){_0x258cb9=_0x22236c;_0x5b228e[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x64')][_0xab36('0x7a')]);_0x5b228e[_0xab36('0x22')]=_[_0xab36('0x28')](_0x219caf[_0xab36('0x22')]);_0x5b228e['filters']=_[_0xab36('0x7b')](_0x5b228e['model'],_0x5b228e[_0xab36('0x22')]);_0x611f52[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x5b228e[_0xab36('0x79')],qs[_0xab36('0x7d')](_0x219caf['query'][_0xab36('0x7d')]));_0x611f52[_0xab36('0x7c')]=_0x611f52['attributes']['length']?_0x611f52[_0xab36('0x7c')]:_0x5b228e[_0xab36('0x79')];_0x611f52[_0xab36('0x7e')]=qs['sort'](_0x219caf[_0xab36('0x22')][_0xab36('0x7f')]);_0x611f52['where']=qs[_0xab36('0x80')](_['pick'](_0x219caf['query'],_0x5b228e[_0xab36('0x80')]));if(_0x219caf[_0xab36('0x22')]['filter']){_0x611f52[_0xab36('0x5c')]=_[_0xab36('0x81')](_0x611f52[_0xab36('0x5c')],{'$or':_[_0xab36('0x6c')](_0x611f52['attributes'],function(_0x1a56e1){var _0x1890ae={};_0x1890ae[_0x1a56e1]={'$like':'%'+_0x219caf[_0xab36('0x22')]['filter']+'%'};return _0x1890ae;})});}_0x611f52=_[_0xab36('0x81')]({},_0x611f52,_0x219caf[_0xab36('0x82')]);return _0x258cb9[_0xab36('0x77')](_0x611f52);}})['then'](function(_0xc396ac){if(_0xc396ac){_0x471e3d=_0xc396ac['length'];if(!_0x219caf['query']['hasOwnProperty'](_0xab36('0x83'))){_0x611f52[_0xab36('0x84')]=qs[_0xab36('0x84')](_0x219caf[_0xab36('0x22')][_0xab36('0x84')]);_0x611f52['offset']=qs[_0xab36('0x15')](_0x219caf['query'][_0xab36('0x15')]);}return _0x258cb9[_0xab36('0x77')](_0x611f52);}})[_0xab36('0x19')](function(_0x99dd8e){if(_0x99dd8e){return _0x99dd8e?{'count':_0x471e3d,'rows':_0x99dd8e}:null;}})[_0xab36('0x19')](respondWithResult(_0xc6b7f,null))['catch'](handleError(_0xc6b7f,null));};exports[_0xab36('0x85')]=function(_0x3e5e72,_0x360b3b){if(_0x3e5e72[_0xab36('0x36')]['id']){delete _0x3e5e72['body']['id'];}return db[_0xab36('0x25')][_0xab36('0x78')]({'where':{'id':_0x3e5e72['params']['id']}})['then'](handleEntityNotFound(_0x360b3b,null))[_0xab36('0x19')](function(_0x332ee3){if(_0x332ee3){return _0x332ee3['setTags'](_0x3e5e72[_0xab36('0x36')][_0xab36('0x86')]||[]);}return null;})['then'](respondWithResult(_0x360b3b,null))[_0xab36('0x23')](handleError(_0x360b3b,null));};exports['setAdditionalPhones']=function(_0x3dbe6c,_0x11e14a){var _0x32c155=[];_0x32c155[_0xab36('0x5d')](addAdditionalPhones(_0x3dbe6c[_0xab36('0x36')]));Promise['all'](_0x32c155)['then'](function(){_0x32c155=[];_0x32c155[_0xab36('0x5d')](deleteCmHopperPhones(_0x3dbe6c['body']['id']));_0x32c155[_0xab36('0x5d')](addCmHopperPhones(_0x3dbe6c['body']['id']));Promise[_0xab36('0x61')](_0x32c155)[_0xab36('0x19')](function(){return[0x1];})[_0xab36('0x19')](respondWithResult(_0x11e14a,null));});};function addAdditionalPhones(_0x3af90a){var _0x16b814;return new Promise(function(_0x3411d0){return db['CmContactHasItem'][_0xab36('0x24')]({'where':{'CmContactId':_0x3af90a['id']}})[_0xab36('0x19')](function(){db['ContactItemType'][_0xab36('0x21')]({'raw':!![],'attributes':['id',_0xab36('0x87')]})['then'](function(_0x42cf64){var _0x4202ed=[];for(var _0x116e39=0x0;_0x116e39<_0x3af90a[_0xab36('0x88')]['length'];_0x116e39++){var _0xfae751=_0x3af90a[_0xab36('0x89')]?_[_0xab36('0x56')](_0x3af90a[_0xab36('0x89')][_0x116e39])?'':_0x3af90a['item_types'][_0x116e39]:_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8a')]?_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8a')]:'';var _0x2bac5e=_[_0xab36('0x56')](_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8b')])?'':_0x3af90a[_0xab36('0x88')][_0x116e39]['description'];var _0x1d99af=_0xfae751+':'+_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x76')]+'§'+_0x2bac5e;if(_[_0xab36('0x56')](_0x16b814))_0x16b814=_0x1d99af;else _0x16b814+=';'+_0x1d99af;var _0x15e2b9=null;var _0x127156=null;if(_0x3af90a[_0xab36('0x89')]){if(!_[_0xab36('0x56')](_0x3af90a[_0xab36('0x89')][_0x116e39])){_0x127156=_[_0xab36('0x63')](_0x42cf64,function(_0x3730fa){return _0x3730fa['id']===_0x3af90a[_0xab36('0x89')][_0x116e39];});if(!_[_0xab36('0x56')](_0x127156)){_0x15e2b9=_0x127156[_0xab36('0x87')];}}}else{if(!_[_0xab36('0x56')](_0x3af90a[_0xab36('0x88')][_0x116e39])){_0x127156=_[_0xab36('0x63')](_0x42cf64,function(_0x250d8d){return _0x250d8d['id']===_0x3af90a['items'][_0x116e39][_0xab36('0x8a')];});if(!_[_0xab36('0x56')](_0x127156)){_0x15e2b9=_0x116e39;}}}if(_[_0xab36('0x56')](_0x15e2b9)){_0x15e2b9=0x64;}_0x4202ed[_0xab36('0x5d')](addAdditionalPhone(_0x3af90a['id'],_0x3af90a[_0xab36('0x88')][_0x116e39]['phone'],_0x3af90a['item_types']?_[_0xab36('0x56')](_0x3af90a[_0xab36('0x89')][_0x116e39])?null:_0x3af90a[_0xab36('0x89')][_0x116e39]:_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8a')]?_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8a')]:null,_0x15e2b9,_0x2bac5e));}Promise[_0xab36('0x61')](_0x4202ed)[_0xab36('0x19')](function(){db['CmContact']['update']({'AdditionalPhones':_0x16b814},{'where':{'id':_0x3af90a['id']}})[_0xab36('0x19')](function(){_0x3411d0(0x1);});});});});});}function addAdditionalPhone(_0x4f29cd,_0x16a7b5,_0x435f89,_0x321ff0,_0x1afd1c){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x4f29cd,'item':_0x16a7b5}})[_0xab36('0x19')](function(_0x11d8e5){if(_0x11d8e5)logger['info'](_0xab36('0x8c'),_0x11d8e5);else{db[_0xab36('0x49')][_0xab36('0x54')]({'CmContactId':_0x4f29cd,'item':_0x16a7b5,'ItemTypeId':_0x435f89,'OrderBy':_0x321ff0,'ItemClass':_0xab36('0x8d'),'description':_0x1afd1c});}});}function deleteCmHopperPhones(_0xd32b05){return new Promise(function(_0x4db3eb){return db[_0xab36('0x3d')][_0xab36('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xd32b05}})[_0xab36('0x19')](function(_0x5cc91d){db[_0xab36('0x8e')][_0xab36('0x24')]({'where':{'CmHopperId':{'$in':_[_0xab36('0x6c')](_0x5cc91d,'id')}}});})[_0xab36('0x19')](function(){_0x4db3eb(0x1);});});}function addCmHopperPhones(_0x1ca599){return new Promise(function(_0x502c0b){return db[_0xab36('0x3d')][_0xab36('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1ca599}})[_0xab36('0x19')](function(_0x11ed8a){var _0x20ad46=[];_['map'](_0x11ed8a,function(_0x5bfdd5){_0x20ad46[_0xab36('0x5d')](createCmHopperPhone(_0x1ca599,_0x5bfdd5['id']));});Promise[_0xab36('0x61')](_0x20ad46)[_0xab36('0x19')](function(){_0x502c0b(0x1);});});});}function createCmHopperPhone(_0x6c711a,_0x4e39e8){return new Promise(function(_0x2e1982){db['CmContactHasItem'][_0xab36('0x21')]({'raw':!![],'attributes':[_0xab36('0x8f'),_0xab36('0x87')],'where':{'CmContactId':_0x6c711a,'ItemClass':'PHONE'},'include':[{'model':db[_0xab36('0x68')],'attributes':[_0xab36('0x87')],'as':_0xab36('0x69')}],'order':[_0xab36('0x87'),db['sequelize'][_0xab36('0x90')]('`ItemType`.OrderBy')]})[_0xab36('0x19')](function(_0x11a722){var _0x23b40e=0x1;var _0x5435d8=_[_0xab36('0x6c')](_0x11a722,function(_0x550b13){_0x550b13[_0xab36('0x91')]=_0x4e39e8;_0x550b13[_0xab36('0x76')]=_0x550b13[_0xab36('0x8f')];_0x550b13[_0xab36('0x87')]=_0x23b40e;delete _0x550b13[_0xab36('0x92')];_0x23b40e=_0x23b40e+0x1;return _0x550b13;});return db['CmHopperAdditionalPhone'][_0xab36('0x5a')](_0x5435d8,{});})[_0xab36('0x19')](function(){_0x2e1982(0x1);});});}function insertAdditionalPhones(_0x394134,_0x464dcc){return new Promise(function(_0xbc13bd){var _0x423b59=[];for(var _0x55c24e=0x0;_0x55c24e<_0x464dcc['length'];_0x55c24e++){var _0x4959bf=_0x464dcc[_0x55c24e];_0x423b59[_0xab36('0x5d')](parseContactItemType(_0x4959bf));}Promise[_0xab36('0x61')](_0x423b59)[_0xab36('0x19')](function(){var _0x3d36b2={'id':_0x394134['id'],'items':_0x464dcc};return addAdditionalPhones(_0x3d36b2)[_0xab36('0x19')](function(){return addCmHopperPhones(_0x394134['id']);});})[_0xab36('0x19')](function(){_0xbc13bd(_0x394134);});});}function parseContactItemType(_0x44dca3){return new Promise(function(_0x33ac84){if(_0x44dca3[_0xab36('0x35')]('ItemTypeId')){_0x33ac84(_0x44dca3);}else{return db['ContactItemType'][_0xab36('0x63')]({'where':{'name':_0x44dca3[_0xab36('0x69')]}})[_0xab36('0x19')](function(_0x330704){if(_[_0xab36('0x56')](_0x330704))_0x44dca3[_0xab36('0x8a')]=null;else _0x44dca3[_0xab36('0x8a')]=_0x330704['id'];_0x33ac84(_0x44dca3);});}});}exports['getAdditionalPhones']=function(_0x467349,_0x475509){return db[_0xab36('0x49')][_0xab36('0x21')]({'raw':!![],'where':{'CmContactId':_0x467349[_0xab36('0x26')]['id'],'ItemClass':_0xab36('0x8d')},'include':[{'model':db[_0xab36('0x68')],'as':_0xab36('0x69')}],'order':[[_0xab36('0x87')],[db[_0xab36('0x93')][_0xab36('0x90')](_0xab36('0x94'))]]})[_0xab36('0x19')](function(_0x5ec824){return _0x5ec824;})['then'](respondWithResult(_0x475509,null))[_0xab36('0x23')](handleError(_0x475509,null));};exports['duplicateAdditionalPhones']=function(_0xcaf18e,_0x54fc56){return db[_0xab36('0x49')][_0xab36('0x21')]({'raw':!![],'where':{'CmContactId':_0xcaf18e[_0xab36('0x36')][_0xab36('0x95')]}})[_0xab36('0x19')](function(_0x430782){var _0x302fa8=_['map'](_0x430782,function(_0x1c5ee4){_0x1c5ee4['CmContactId']=_0xcaf18e['body'][_0xab36('0x96')];return _0x1c5ee4;});return db[_0xab36('0x49')][_0xab36('0x5a')](_0x302fa8,{});})[_0xab36('0x19')](function(){return addCmHopperPhones(_0xcaf18e[_0xab36('0x36')][_0xab36('0x96')]);})[_0xab36('0x19')](function(){return['ok'];})[_0xab36('0x19')](respondWithResult(_0x54fc56,null))['catch'](handleError(_0x54fc56,null));};exports['rescheduleAdditionalPhones']=function(_0x23f25d,_0xca0612){var _0x186b23=[];_0x186b23[_0xab36('0x5d')](createCmHopperPhone(_0x23f25d[_0xab36('0x36')]['id'],_0x23f25d[_0xab36('0x36')]['hopperId']));Promise[_0xab36('0x61')](_0x186b23)[_0xab36('0x19')](function(){return[0x1];})[_0xab36('0x19')](respondWithResult(_0xca0612,null));};exports[_0xab36('0x97')]=function(_0x330d2f,_0xcffa99){var _0x1f3138={'raw':![],'where':{}};var _0x862f4c={};var _0x12cf3c={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x330d2f['params']['id']}})[_0xab36('0x19')](handleEntityNotFound(_0xcffa99,null))[_0xab36('0x19')](function(_0x6247c1){if(_0x6247c1){_0x862f4c[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x3d')][_0xab36('0x7a')]);_0x862f4c[_0xab36('0x22')]=_[_0xab36('0x28')](_0x330d2f[_0xab36('0x22')]);_0x862f4c[_0xab36('0x80')]=_[_0xab36('0x7b')](_0x862f4c[_0xab36('0x79')],_0x862f4c[_0xab36('0x22')]);_0x1f3138[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x862f4c['model'],qs[_0xab36('0x7d')](_0x330d2f['query'][_0xab36('0x7d')]));_0x1f3138[_0xab36('0x7c')]=_0x1f3138[_0xab36('0x7c')][_0xab36('0x27')]?_0x1f3138[_0xab36('0x7c')]:_0x862f4c[_0xab36('0x79')];if(!_0x330d2f[_0xab36('0x22')][_0xab36('0x35')](_0xab36('0x83'))){_0x1f3138['limit']=qs[_0xab36('0x84')](_0x330d2f[_0xab36('0x22')][_0xab36('0x84')]);_0x1f3138[_0xab36('0x15')]=qs['offset'](_0x330d2f['query'][_0xab36('0x15')]);}_0x1f3138[_0xab36('0x7e')]=qs['sort'](_0x330d2f[_0xab36('0x22')][_0xab36('0x7f')]);_0x1f3138[_0xab36('0x5c')]=qs[_0xab36('0x80')](_['pick'](_0x330d2f[_0xab36('0x22')],_0x862f4c['filters']));_0x1f3138[_0xab36('0x5c')][_0xab36('0x98')]=_0x6247c1['id'];if(_0x330d2f['query'][_0xab36('0x99')]){_0x1f3138['where']=_[_0xab36('0x81')](_0x1f3138['where'],{'$or':_[_0xab36('0x6c')](_0x1f3138[_0xab36('0x7c')],function(_0x5b8dc7){var _0x12caad={};_0x12caad[_0x5b8dc7]={'$like':'%'+_0x330d2f[_0xab36('0x22')][_0xab36('0x99')]+'%'};return _0x12caad;})});}_0x1f3138=_['merge']({},_0x1f3138,_0x330d2f[_0xab36('0x82')]);return db[_0xab36('0x3d')][_0xab36('0x14')]({'where':_0x1f3138[_0xab36('0x5c')]})[_0xab36('0x19')](function(_0x315104){_0x12cf3c[_0xab36('0x14')]=_0x315104;if(_0x330d2f['query'][_0xab36('0x9a')]){_0x1f3138[_0xab36('0x9b')]=[{'all':!![]}];}return db[_0xab36('0x3d')][_0xab36('0x21')](_0x1f3138);})[_0xab36('0x19')](function(_0x3d41b5){_0x12cf3c[_0xab36('0x9c')]=_0x3d41b5;return _0x12cf3c;});}})['then'](respondWithFilteredResult(_0xcffa99,_0x1f3138))[_0xab36('0x23')](handleError(_0xcffa99,null));};exports[_0xab36('0x9d')]=function(_0x1f842f,_0x394a56){var _0x5f52fc={'raw':!![],'where':{}};var _0x415606={};var _0x23f73c={'count':0x0,'rows':[]};return db['CmContact'][_0xab36('0x78')]({'where':{'id':_0x1f842f[_0xab36('0x26')]['id']}})[_0xab36('0x19')](handleEntityNotFound(_0x394a56,null))['then'](function(_0x425024){if(_0x425024){_0x415606[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x9e')]['rawAttributes']);_0x415606['query']=_[_0xab36('0x28')](_0x1f842f[_0xab36('0x22')]);_0x415606[_0xab36('0x80')]=_[_0xab36('0x7b')](_0x415606[_0xab36('0x79')],_0x415606[_0xab36('0x22')]);_0x5f52fc[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x415606['model'],qs[_0xab36('0x7d')](_0x1f842f[_0xab36('0x22')][_0xab36('0x7d')]));_0x5f52fc[_0xab36('0x7c')]=_0x5f52fc['attributes'][_0xab36('0x27')]?_0x5f52fc[_0xab36('0x7c')]:_0x415606[_0xab36('0x79')];if(!_0x1f842f[_0xab36('0x22')][_0xab36('0x35')]('nolimit')){_0x5f52fc[_0xab36('0x84')]=qs[_0xab36('0x84')](_0x1f842f[_0xab36('0x22')][_0xab36('0x84')]);_0x5f52fc['offset']=qs[_0xab36('0x15')](_0x1f842f['query'][_0xab36('0x15')]);}_0x5f52fc[_0xab36('0x7e')]=qs['sort'](_0x1f842f[_0xab36('0x22')][_0xab36('0x7f')]);_0x5f52fc[_0xab36('0x5c')]=qs['filters'](_['pick'](_0x1f842f[_0xab36('0x22')],_0x415606[_0xab36('0x80')]));_0x5f52fc[_0xab36('0x5c')][_0xab36('0x98')]=_0x425024['id'];if(_0x1f842f['query'][_0xab36('0x99')]){_0x5f52fc['where']=_[_0xab36('0x81')](_0x5f52fc[_0xab36('0x5c')],{'$or':_[_0xab36('0x6c')](_0x5f52fc[_0xab36('0x7c')],function(_0x52a6b8){var _0x3ef984={};_0x3ef984[_0x52a6b8]={'$like':'%'+_0x1f842f[_0xab36('0x22')][_0xab36('0x99')]+'%'};return _0x3ef984;})});}_0x5f52fc=_['merge']({},_0x5f52fc,_0x1f842f[_0xab36('0x82')]);return db[_0xab36('0x9e')]['count']({'where':_0x5f52fc[_0xab36('0x5c')]})[_0xab36('0x19')](function(_0x13bae8){_0x23f73c[_0xab36('0x14')]=_0x13bae8;if(_0x1f842f[_0xab36('0x22')]['includeAll']){_0x5f52fc[_0xab36('0x9b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xab36('0x21')](_0x5f52fc);})['then'](function(_0x21ac7e){_0x23f73c[_0xab36('0x9c')]=_0x21ac7e;return _0x23f73c;});}})[_0xab36('0x19')](respondWithFilteredResult(_0x394a56,_0x5f52fc))['catch'](handleError(_0x394a56,null));};exports['getHopperFinals']=function(_0x11d079,_0x573e88){var _0x2dac03={'raw':!![],'where':{}};var _0x33c1c6={};var _0x1bffdc={'count':0x0,'rows':[]};return db[_0xab36('0x25')][_0xab36('0x78')]({'where':{'id':_0x11d079[_0xab36('0x26')]['id']}})['then'](handleEntityNotFound(_0x573e88,null))[_0xab36('0x19')](function(_0x2f18ee){if(_0x2f18ee){_0x33c1c6[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x4a')][_0xab36('0x7a')]);_0x33c1c6[_0xab36('0x22')]=_[_0xab36('0x28')](_0x11d079[_0xab36('0x22')]);_0x33c1c6[_0xab36('0x80')]=_[_0xab36('0x7b')](_0x33c1c6[_0xab36('0x79')],_0x33c1c6[_0xab36('0x22')]);_0x2dac03[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x33c1c6[_0xab36('0x79')],qs[_0xab36('0x7d')](_0x11d079[_0xab36('0x22')][_0xab36('0x7d')]));_0x2dac03[_0xab36('0x7c')]=_0x2dac03['attributes'][_0xab36('0x27')]?_0x2dac03['attributes']:_0x33c1c6[_0xab36('0x79')];if(!_0x11d079['query'][_0xab36('0x35')]('nolimit')){_0x2dac03['limit']=qs[_0xab36('0x84')](_0x11d079[_0xab36('0x22')][_0xab36('0x84')]);_0x2dac03[_0xab36('0x15')]=qs[_0xab36('0x15')](_0x11d079[_0xab36('0x22')][_0xab36('0x15')]);}_0x2dac03[_0xab36('0x7e')]=qs['sort'](_0x11d079[_0xab36('0x22')][_0xab36('0x7f')]);_0x2dac03[_0xab36('0x5c')]=qs[_0xab36('0x80')](_[_0xab36('0x9f')](_0x11d079[_0xab36('0x22')],_0x33c1c6[_0xab36('0x80')]));_0x2dac03['where'][_0xab36('0x98')]=_0x2f18ee['id'];if(_0x11d079['query'][_0xab36('0x99')]){_0x2dac03[_0xab36('0x5c')]=_[_0xab36('0x81')](_0x2dac03[_0xab36('0x5c')],{'$or':_[_0xab36('0x6c')](_0x2dac03[_0xab36('0x7c')],function(_0x4f10dd){var _0x4c990f={};_0x4c990f[_0x4f10dd]={'$like':'%'+_0x11d079[_0xab36('0x22')][_0xab36('0x99')]+'%'};return _0x4c990f;})});}_0x2dac03=_[_0xab36('0x81')]({},_0x2dac03,_0x11d079[_0xab36('0x82')]);return db[_0xab36('0x4a')][_0xab36('0x14')]({'where':_0x2dac03[_0xab36('0x5c')]})[_0xab36('0x19')](function(_0x411e59){_0x1bffdc['count']=_0x411e59;if(_0x11d079[_0xab36('0x22')][_0xab36('0x9a')]){_0x2dac03[_0xab36('0x9b')]=[{'all':!![]}];}return db[_0xab36('0x4a')]['findAll'](_0x2dac03);})['then'](function(_0x231975){_0x1bffdc[_0xab36('0x9c')]=_0x231975;return _0x1bffdc;});}})['then'](respondWithFilteredResult(_0x573e88,_0x2dac03))[_0xab36('0x23')](handleError(_0x573e88,null));};exports['getJscriptySessions']=function(_0x2b3279,_0x1439d4){var _0x5d98d={'raw':!![],'where':{}};var _0x1b8f41={};var _0x234b51={'count':0x0,'rows':[]};return db['CmContact'][_0xab36('0x78')]({'where':{'id':_0x2b3279['params']['id']}})[_0xab36('0x19')](handleEntityNotFound(_0x1439d4,null))['then'](function(_0x38799a){if(_0x38799a){_0x1b8f41[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x52')][_0xab36('0x7a')]);_0x1b8f41['query']=_[_0xab36('0x28')](_0x2b3279[_0xab36('0x22')]);_0x1b8f41[_0xab36('0x80')]=_['intersection'](_0x1b8f41['model'],_0x1b8f41[_0xab36('0x22')]);_0x5d98d[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x1b8f41['model'],qs[_0xab36('0x7d')](_0x2b3279['query']['fields']));_0x5d98d[_0xab36('0x7c')]=_0x5d98d[_0xab36('0x7c')][_0xab36('0x27')]?_0x5d98d['attributes']:_0x1b8f41[_0xab36('0x79')];if(!_0x2b3279[_0xab36('0x22')]['hasOwnProperty']('nolimit')){_0x5d98d[_0xab36('0x84')]=qs[_0xab36('0x84')](_0x2b3279[_0xab36('0x22')][_0xab36('0x84')]);_0x5d98d[_0xab36('0x15')]=qs[_0xab36('0x15')](_0x2b3279[_0xab36('0x22')][_0xab36('0x15')]);}_0x5d98d['order']=qs['sort'](_0x2b3279['query'][_0xab36('0x7f')]);_0x5d98d[_0xab36('0x5c')]=qs[_0xab36('0x80')](_['pick'](_0x2b3279[_0xab36('0x22')],_0x1b8f41[_0xab36('0x80')]));_0x5d98d[_0xab36('0x5c')]['ContactId']=_0x38799a['id'];if(_0x2b3279[_0xab36('0x22')][_0xab36('0x99')]){_0x5d98d['where']=_['merge'](_0x5d98d['where'],{'$or':_[_0xab36('0x6c')](_0x5d98d[_0xab36('0x7c')],function(_0x593068){var _0xa3cc28={};_0xa3cc28[_0x593068]={'$like':'%'+_0x2b3279[_0xab36('0x22')]['filter']+'%'};return _0xa3cc28;})});}_0x5d98d=_['merge']({},_0x5d98d,_0x2b3279['options']);return db[_0xab36('0x52')][_0xab36('0x14')]({'where':_0x5d98d[_0xab36('0x5c')]})[_0xab36('0x19')](function(_0xebec54){_0x234b51[_0xab36('0x14')]=_0xebec54;if(_0x2b3279['query'][_0xab36('0x9a')]){_0x5d98d[_0xab36('0x9b')]=[{'all':!![]}];}return db[_0xab36('0x52')][_0xab36('0x21')](_0x5d98d);})[_0xab36('0x19')](function(_0x43520c){_0x234b51[_0xab36('0x9c')]=_0x43520c;return _0x234b51;});}})[_0xab36('0x19')](respondWithFilteredResult(_0x1439d4,_0x5d98d))[_0xab36('0x23')](handleError(_0x1439d4,null));};exports['uploadCsv']=function(_0x48e82b,_0x2b22ce){try{if(!_0x48e82b['body']['ListId']){throw new Error(_0xab36('0xa0'));}if(!_0x48e82b[_0xab36('0x36')][_0xab36('0xa1')]){throw new Error(_0xab36('0xa2'));}if(!_0x48e82b[_0xab36('0x36')][_0xab36('0xa3')]){throw new Error(_0xab36('0xa4'));}if(!_0x48e82b[_0xab36('0x36')][_0xab36('0xa5')]){throw new Error(_0xab36('0xa6'));}var _0x5b7ae0=_0x48e82b[_0xab36('0x36')]['binding_keys'][_0xab36('0xa7')](',');var _0x44004b=_0x48e82b[_0xab36('0x36')][_0xab36('0xa3')]['split'](',');if(!_0x5b7ae0[_0xab36('0x27')]||!_0x44004b[_0xab36('0x27')]||_0x5b7ae0[_0xab36('0x27')]!==_0x44004b[_0xab36('0x27')]){throw new Error(_0xab36('0xa8'));}_0x48e82b[_0xab36('0x36')]['fields']=_[_0xab36('0xa9')](_0x5b7ae0,_0x44004b);if(!_0x48e82b[_0xab36('0x36')][_0xab36('0x7d')][_0xab36('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x48e82b['body'][_0xab36('0x7d')][_0xab36('0xaa')]){throw new Error(_0xab36('0xab'));}var _0x5313a9=path[_0xab36('0x55')](config[_0xab36('0xac')],_0xab36('0xad'),_0x48e82b[_0xab36('0xae')]['filename']);fs[_0xab36('0xaf')](_0x5313a9,parseInt('0777',0x8));var _0xc8e58=require(_0xab36('0xb0'))['fork'](path['join'](__dirname,'../../components/import/cm/csv'),[_0x5313a9,_0x48e82b[_0xab36('0x36')][_0xab36('0xa1')],_0x48e82b['body']['binding_values'],_0x48e82b[_0xab36('0x36')][_0xab36('0x5e')],_0x48e82b[_0xab36('0x36')][_0xab36('0xb1')],_0x48e82b['body'][_0xab36('0x5b')],_0x48e82b[_0xab36('0x36')]['socket_timestamp']]);return _0x2b22ce[_0xab36('0x11')](0xc8)[_0xab36('0x12')]({'message':'File\x20uploaded\x20correctly!','pid':_0xc8e58[_0xab36('0xb2')]});}catch(_0x2d80a8){return _0x2b22ce['status'](0x1f4)['send'](_0x2d80a8);}};exports[_0xab36('0xb3')]=function(_0x49eb84,_0x2f8c5a){var _0x4e1523=fs[_0xab36('0xb4')](_0x49eb84['file'][_0xab36('0x3')]);Papa['parse'](_0x4e1523,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1ab8bc){return _0x2f8c5a[_0xab36('0x11')](0xc8)[_0xab36('0x12')]({'file':_0x49eb84[_0xab36('0xae')],'fields':_0x1ab8bc['meta'][_0xab36('0x7d')]});}});};exports[_0xab36('0xb5')]=function(_0x4ee570,_0x4ef907){return db[_0xab36('0xb6')][_0xab36('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xab36('0xb7')}})[_0xab36('0x19')](function(_0x1c09a7){var _0xdf5f85=![];if(!_0x4ee570[_0xab36('0x36')][_0xab36('0x5e')]){throw new Error(_0xab36('0xa0'));}if(!_0x4ee570['body']['binding'][_0xab36('0x76')]){throw new Error(_0xab36('0xb8'));}if(!_0x4ee570['body'][_0xab36('0xb9')][_0xab36('0xaa')]){throw new Error(_0xab36('0xab'));}if(!_0x4ee570['body'][_0xab36('0xa5')]){throw new Error(_0xab36('0xa6'));}var _0x30ed04=require(_0xab36('0xb0'))['fork'](path[_0xab36('0x55')](__dirname,_0xab36('0xba')),[_0x4ee570['params']['id'],JSON['stringify'](_0x4ee570[_0xab36('0x36')]),JSON[_0xab36('0xbb')](_0x1c09a7)]);_0x30ed04['on']('message',function(){_0xdf5f85=!![];return _0x4ef907['status'](0xc8)['json']({'message':_0xab36('0xbc'),'pid':_0x30ed04[_0xab36('0xb2')]});});_0x30ed04['on'](_0xab36('0xbd'),function(_0x46db31){if(_0x46db31&&!_0xdf5f85){return _0x4ef907[_0xab36('0x11')](0x1f4)[_0xab36('0x12')]({'message':'error\x20child\x20process','pid':_0x30ed04[_0xab36('0xb2')]});}});})['catch'](handleError(_0x4ef907,null));};exports[_0xab36('0xbe')]=function(_0xcb7a2,_0x445a0a){return db[_0xab36('0xb6')][_0xab36('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xab36('0xb7')}})[_0xab36('0x19')](function(_0x44a44c){var _0xccf83e=![];if(!_0xcb7a2[_0xab36('0x36')][_0xab36('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0xcb7a2[_0xab36('0x36')][_0xab36('0xb9')][_0xab36('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xcb7a2['body'][_0xab36('0xb9')][_0xab36('0xaa')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0xcb7a2['body'][_0xab36('0xa5')]){throw new Error(_0xab36('0xa6'));}var _0x413d0d=require('child_process')[_0xab36('0xbf')](path['join'](__dirname,_0xab36('0xc0')),[_0xcb7a2[_0xab36('0x26')]['id'],JSON[_0xab36('0xbb')](_0xcb7a2[_0xab36('0x36')]),JSON[_0xab36('0xbb')](_0x44a44c)]);_0x413d0d['on']('message',function(){_0xccf83e=!![];return _0x445a0a[_0xab36('0x11')](0xc8)[_0xab36('0x12')]({'message':_0xab36('0xbc'),'pid':_0x413d0d[_0xab36('0xb2')]});});_0x413d0d['on'](_0xab36('0xbd'),function(_0x1dd1b3){if(_0x1dd1b3&&!_0xccf83e){return _0x445a0a[_0xab36('0x11')](0x1f4)[_0xab36('0x12')]({'message':_0xab36('0xc1'),'pid':_0x413d0d[_0xab36('0xb2')]});}});})['catch'](handleError(_0x445a0a,null));};exports[_0xab36('0xc2')]=function(_0x30b3ee,_0x3f9f1a){var _0x1235d4=[_0xab36('0xc3'),_0xab36('0xc4'),_0xab36('0xc5'),_0xab36('0xc6'),_0xab36('0xc7'),_0xab36('0xc8'),_0xab36('0xc9')];var _0x25a3bd={'offset':0x0,'order':qs[_0xab36('0x7f')](_0xab36('0xca'))},_0x4ec7c0={'count':0x0,'rows':[]};Promise[_0xab36('0xcb')]()['then'](function(){if(_0x30b3ee['query']['channel']){if(!_['includes'](_0x1235d4,_0x30b3ee[_0xab36('0x22')][_0xab36('0xcc')][_0xab36('0xcd')]())){throw new Error(_0xab36('0xce'));}_0x1235d4=[_0x30b3ee[_0xab36('0x22')][_0xab36('0xcc')]['toLowerCase']()];}if(_0x30b3ee[_0xab36('0x22')][_0xab36('0xcf')]){try{var _0x358d4b=JSON[_0xab36('0xd0')](_0x30b3ee['query'][_0xab36('0xcf')]);if(!moment(_0x358d4b['from'])['isValid']()){throw new Error(_0xab36('0xd1'));}if(!moment(_0x358d4b['to'])[_0xab36('0xd2')]()){throw new Error(_0xab36('0xd3'));}}catch(_0x5c8074){throw new Error(_0xab36('0xd4'));}}if(!_0x30b3ee[_0xab36('0x22')][_0xab36('0x35')](_0xab36('0x83'))){_0x25a3bd[_0xab36('0x84')]=qs[_0xab36('0x84')](_0x30b3ee[_0xab36('0x22')][_0xab36('0x84')]||0xa);_0x25a3bd[_0xab36('0x15')]=qs[_0xab36('0x15')](_0x30b3ee[_0xab36('0x22')][_0xab36('0x15')]);}var _0x369530=_0x1235d4['map'](function(_0x474f73){if(_0x474f73==='voice'){var _0x49a482={'attributes':['id',_0xab36('0xd5'),_0xab36('0x30'),_0xab36('0xd6'),_0xab36('0xd7'),'callerid','starttime',_0xab36('0xd8'),_0xab36('0xd9'),_0xab36('0xda'),_0xab36('0xdb'),_0xab36('0xdc'),_0xab36('0xdd'),_0xab36('0xde'),'UserId'],'where':{'ContactId':_0x30b3ee['params']['id']},'include':[{'model':db[_0xab36('0xb6')],'as':_0xab36('0xb6'),'attributes':['id',_0xab36('0x1d'),_0xab36('0xdf'),_0xab36('0xe0')]}],'order':[['createdAt','DESC']]};if(_0x30b3ee['query'][_0xab36('0xcf')]){_0x49a482[_0xab36('0x5c')][_0xab36('0xdb')]={'$gte':_0x358d4b[_0xab36('0x37')],'$lte':_0x358d4b['to']};}return db[_0xab36('0x4c')][_0xab36('0xe1')](_0x49a482)['then'](function(_0x300d8b){_0x4ec7c0[_0xab36('0x14')]+=_0x300d8b[_0xab36('0x14')];return _[_0xab36('0x6c')](_0x300d8b[_0xab36('0x9c')],function(_0xe5606b){var _0x3d9d4c=_0xe5606b[_0xab36('0x38')]({'plain':!![]});_0x3d9d4c[_0xab36('0xcc')]=_0x474f73;if(_0x3d9d4c['User']){_0x3d9d4c['User']={'id':_0x3d9d4c[_0xab36('0xb6')]['id'],'name':_0x3d9d4c[_0xab36('0xb6')][_0xab36('0x1d')],'fullname':_0x3d9d4c['User']['fullname'],'alias':_0x3d9d4c['User'][_0xab36('0xe0')]};}return _0x3d9d4c;});});}else{var _0x43786e=_[_0xab36('0xe2')](_0x474f73)+(_0x474f73===_0xab36('0xc4')?_0xab36('0xe3'):_0xab36('0xe4'));var _0x18128d={'attributes':['id',_0xab36('0xe5'),'closedAt','createdAt',_0xab36('0xda'),_0xab36('0xe6'),'secondDisposition','thirdDisposition',_0xab36('0xe7'),_0x43786e+'Id'],'where':{'ContactId':_0x30b3ee[_0xab36('0x26')]['id']},'include':[{'model':db[_0x43786e],'as':_0xab36('0xe4'),'attributes':['id',_0xab36('0x1d'),_0xab36('0xe8')]},{'model':db[_0xab36('0xb6')],'as':'Owner','attributes':['id','name',_0xab36('0xdf')]},{'model':db[_0xab36('0x64')],'as':_0xab36('0x65'),'attributes':['id','name',_0xab36('0x66')],'through':{'attributes':[]}}],'order':[[_0xab36('0xdb'),_0xab36('0xe9')]]};if(_0x30b3ee['query'][_0xab36('0xcf')]){_0x18128d[_0xab36('0x5c')][_0xab36('0xdb')]={'$gte':_0x358d4b[_0xab36('0x37')],'$lte':_0x358d4b['to']};}switch(_0x474f73){case _0xab36('0xc4'):_0x18128d['attributes'][_0xab36('0x5d')]('browserName','customerIp',_0xab36('0xea'),_0xab36('0xeb'),_0xab36('0xec'),'ratingMessage',_0xab36('0xed'),_0xab36('0xee'),_0xab36('0xef'));break;case'mail':_0x18128d['attributes']['push']('subject',_0xab36('0xf0'));break;case'openchannel':_0x18128d[_0xab36('0x7c')][_0xab36('0x5d')]('externalUrl',_0xab36('0xf1'));break;}return db[_[_0xab36('0xe2')](_0x474f73)+_0xab36('0xf2')][_0xab36('0xe1')](_0x18128d)[_0xab36('0x19')](function(_0x194f0c){_0x4ec7c0['count']+=_0x194f0c[_0xab36('0x14')];return _[_0xab36('0x6c')](_0x194f0c[_0xab36('0x9c')],function(_0x4549d3){var _0x44dc=_0x4549d3['get']({'plain':!![]});_0x44dc[_0xab36('0xcc')]=_0x474f73;if(_0x44dc[_0xab36('0xf3')]){_0x44dc[_0xab36('0xf3')]={'id':_0x44dc[_0xab36('0xf3')]['id'],'name':_0x44dc[_0xab36('0xf3')][_0xab36('0x1d')],'fullname':_0x44dc[_0xab36('0xf3')][_0xab36('0xdf')]};}return _0x44dc;});});}});return Promise['all'](_0x369530);})[_0xab36('0x19')](function(_0x37618f){return _(_0x37618f)[_0xab36('0xf4')]()[_0xab36('0xf5')](_0xab36('0xdb'))[_0xab36('0xf6')]()[_0xab36('0xf7')]();})[_0xab36('0x19')](function(_0xcb6eca){_0x4ec7c0[_0xab36('0x9c')]=_0x25a3bd[_0xab36('0x84')]?_0xcb6eca[_0xab36('0xf8')](_0x25a3bd[_0xab36('0x15')],_0x25a3bd[_0xab36('0x15')]+_0x25a3bd['limit']):_0xcb6eca;return _0x4ec7c0;})['then'](respondWithFilteredResult(_0x3f9f1a,_0x25a3bd))[_0xab36('0x23')](handleError(_0x3f9f1a,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 2fa9c5e..18cc235 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 _0xd1e8=['CmContact','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x160c42,_0x383a96){var _0xcc4c25=function(_0x6e66fd){while(--_0x6e66fd){_0x160c42['push'](_0x160c42['shift']());}};_0xcc4c25(++_0x383a96);}(_0xd1e8,0x131));var _0x8d1e=function(_0x31d98a,_0x292465){_0x31d98a=_0x31d98a-0x0;var _0x56e10e=_0xd1e8[_0x31d98a];return _0x56e10e;};'use strict';var EventEmitter=require(_0x8d1e('0x0'));var CmContact=require('../../mysqldb')['db'][_0x8d1e('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x8d1e('0x2')](0x0);var events={'afterCreate':_0x8d1e('0x3'),'afterUpdate':'update','afterDestroy':_0x8d1e('0x4')};function emitEvent(_0xd00f4e){return function(_0x176f0c,_0x328c1c,_0x212803){CmContactEvents[_0x8d1e('0x5')](_0xd00f4e+':'+_0x176f0c['id'],_0x176f0c);CmContactEvents[_0x8d1e('0x5')](_0xd00f4e,_0x176f0c);_0x212803(null);};}for(var e in events){if(events[_0x8d1e('0x6')](e)){var event=events[e];CmContact[_0x8d1e('0x7')](e,emitEvent(event));}}module[_0x8d1e('0x8')]=CmContactEvents; \ No newline at end of file +var _0x3276=['hook','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x3276,0xe1));var _0x6327=function(_0x22db06,_0x16814b){_0x22db06=_0x22db06-0x0;var _0x3c5402=_0x3276[_0x22db06];return _0x3c5402;};'use strict';var EventEmitter=require(_0x6327('0x0'));var CmContact=require(_0x6327('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6327('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6327('0x3'),'afterDestroy':_0x6327('0x4')};function emitEvent(_0x177f4d){return function(_0x2e1392,_0x3952af,_0x43c7d5){CmContactEvents[_0x6327('0x5')](_0x177f4d+':'+_0x2e1392['id'],_0x2e1392);CmContactEvents[_0x6327('0x5')](_0x177f4d,_0x2e1392);_0x43c7d5(null);};}for(var e in events){if(events[_0x6327('0x6')](e)){var event=events[e];CmContact[_0x6327('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 25c4444..fd50b85 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 _0x3bb0=['cm_contacts','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','message','isEmpty','length','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','../../config/logger','../../config/environment/shared','./cmContact.attributes','VoiceQueue','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','then','resolve','timezones','utcOffset','scheduledat','add','minutes','format','phone','ListId','priority','callbackUniqueid','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','always','findAll','outbound','CmList','Lists','map','Campaign','all','CmHopperBlack','CmContact'];(function(_0x27c338,_0x2e1a70){var _0x1aab26=function(_0x871b8){while(--_0x871b8){_0x27c338['push'](_0x27c338['shift']());}};_0x1aab26(++_0x2e1a70);}(_0x3bb0,0x145));var _0x03bb=function(_0x3044ce,_0x2b06a9){_0x3044ce=_0x3044ce-0x0;var _0x343615=_0x3bb0[_0x3044ce];return _0x343615;};'use strict';var _=require(_0x03bb('0x0'));var util=require('util');var logger=require(_0x03bb('0x1'))('api');var moment=require('moment');var shared=require(_0x03bb('0x2'));var attributes=require(_0x03bb('0x3'));function getTimezoneCallbackAt(_0x5ab85c,_0xd6412b,_0x4b31b9,_0x278498){var _0x1acd4d=_0x278498?'Campaign':_0x03bb('0x4');var _0x2906b4=_0x4b31b9['scheduledat']?_0x4b31b9['scheduledat']:moment()['format'](_0x03bb('0x5'));if(_[_0x03bb('0x6')](_0x4b31b9[_0x03bb('0x7')])){return Promise['resolve'](_0x2906b4);}return _0x5ab85c[_0x1acd4d]['findOne']({'where':{'id':_0xd6412b}})[_0x03bb('0x8')](function(_0x42ae87){if(_[_0x03bb('0x6')](_0x42ae87)||_[_0x03bb('0x6')](_0x42ae87[_0x03bb('0x7')])){return Promise[_0x03bb('0x9')](_0x2906b4);}var _0x130855=shared[_0x03bb('0xa')];var _0x5f0f65=_0x130855[_0x42ae87[_0x03bb('0x7')]];var _0x29d6dc=_0x130855[_0x4b31b9[_0x03bb('0x7')]];if(_[_0x03bb('0x6')](_0x5f0f65)&&_[_0x03bb('0x6')](_0x29d6dc)){return Promise[_0x03bb('0x9')](_0x2906b4);}var _0x45a085=_0x5f0f65[_0x03bb('0xb')]-_0x29d6dc[_0x03bb('0xb')];var _0x367a97=_0x4b31b9[_0x03bb('0xc')]?_0x4b31b9[_0x03bb('0xc')]:moment();_0x2906b4=moment(_0x367a97)[_0x03bb('0xd')](_0x45a085,_0x03bb('0xe'))[_0x03bb('0xf')](_0x03bb('0x5'));return Promise[_0x03bb('0x9')](_0x2906b4);});}function getNewHopperPayload(_0x7d1622){return{'phone':_0x7d1622[_0x03bb('0x10')],'ContactId':_0x7d1622['id'],'ListId':_0x7d1622[_0x03bb('0x11')],'scheduledat':_0x7d1622[_0x03bb('0xc')]?_0x7d1622[_0x03bb('0xc')]:moment()[_0x03bb('0xf')](_0x03bb('0x5')),'priority':_0x7d1622['priority']?_0x7d1622[_0x03bb('0x12')]:0x2,'callback':_0x7d1622[_0x03bb('0x13')]?!![]:![],'callbackuniqueid':_0x7d1622['callbackUniqueid']?_0x7d1622[_0x03bb('0x13')]:undefined,'callbackat':_0x7d1622['callbackUniqueid']?moment()['format'](_0x03bb('0x5')):undefined};}function handleAlwaysCheckDuplicate(_0xde9b03,_0x5bff93,_0x54ede2,_0x1c6706){var _0x31b782={'phone':_0x54ede2[_0x03bb('0x10')]};var _0x260354={'calleridnum':_0x54ede2[_0x03bb('0x10')]};if(_0x1c6706){Object[_0x03bb('0x14')](_0x31b782,{'CampaignId':_0x5bff93['id']});Object[_0x03bb('0x14')](_0x260354,{'CampaignId':_0x5bff93['id']});}else{Object[_0x03bb('0x14')](_0x31b782,{'VoiceQueueId':_0x5bff93['id']});Object[_0x03bb('0x14')](_0x260354,{'VoiceQueueId':_0x5bff93['id']});}return _0xde9b03[_0x03bb('0x15')][_0x03bb('0x16')]({'where':_0x31b782})['then'](function(_0x40733a){if(_0x40733a){throw new Error(_0x03bb('0x17')+_0x54ede2[_0x03bb('0x10')]+_0x03bb('0x18')+_0x5bff93['id']);}return _0xde9b03['CmHopperFinal'][_0x03bb('0x16')]({'where':_0x260354});})[_0x03bb('0x8')](function(_0x344df6){if(_0x344df6){throw new Error(_0x03bb('0x19')+_0x54ede2[_0x03bb('0x10')]+_0x03bb('0x18')+_0x5bff93['id']);}var _0x4b9c91=getNewHopperPayload(_0x54ede2);if(_0x1c6706){_0x4b9c91[_0x03bb('0x1a')]=_0x5bff93['id'];}else{_0x4b9c91['VoiceQueueId']=_0x5bff93['id'];}return _0xde9b03[_0x03bb('0x15')][_0x03bb('0x1b')](_0x4b9c91);});}function handleOnlyIfOpenCheckDuplicate(_0x25c05f,_0x3ac015,_0x3f5fd2,_0x5630a1){var _0x15ca01={'phone':_0x3f5fd2[_0x03bb('0x10')]};if(_0x5630a1){Object[_0x03bb('0x14')](_0x15ca01,{'CampaignId':_0x3ac015['id']});}else{Object[_0x03bb('0x14')](_0x15ca01,{'VoiceQueueId':_0x3ac015['id']});}return _0x25c05f['CmHopper'][_0x03bb('0x16')]({'where':_0x15ca01})[_0x03bb('0x8')](function(_0x146cc1){if(_0x146cc1){throw new Error(_0x03bb('0x1c')+_0x3f5fd2[_0x03bb('0x10')]+_0x03bb('0x18')+_0x3ac015['id']);}var _0x5448c5=getNewHopperPayload(_0x3f5fd2);if(_0x5630a1){_0x5448c5[_0x03bb('0x1a')]=_0x3ac015['id'];}else{_0x5448c5[_0x03bb('0x1d')]=_0x3ac015['id'];}return _0x25c05f[_0x03bb('0x15')][_0x03bb('0x1b')](_0x5448c5);});}function handleNeverCheckDuplicate(_0x48461a,_0x4824b9,_0x474b79){var _0x49c7ad=getNewHopperPayload(_0x474b79);_0x49c7ad[_0x03bb('0x1d')]=_0x4824b9['id'];return _0x48461a[_0x03bb('0x15')][_0x03bb('0x1b')](_0x49c7ad);}function handleCheckDuplicate(_0x33d554,_0x3bb30e,_0x184530,_0x4e622d){return getTimezoneCallbackAt(_0x33d554,_0x3bb30e,_0x184530,_0x4e622d)[_0x03bb('0x8')](function(_0x1fda5d){_0x184530[_0x03bb('0xc')]=_0x1fda5d;switch(_0x3bb30e[_0x03bb('0x1e')]){case _0x03bb('0x1f'):return handleAlwaysCheckDuplicate(_0x33d554,_0x3bb30e,_0x184530,_0x4e622d);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x33d554,_0x3bb30e,_0x184530,_0x4e622d);default:return handleNeverCheckDuplicate(_0x33d554,_0x3bb30e,_0x184530);}});}function createHopperForVoiceQueues(_0x49516a,_0x5a00e1){return _0x49516a[_0x03bb('0x4')][_0x03bb('0x20')]({'where':{'type':_0x03bb('0x21')},'attributes':['id',_0x03bb('0x1e'),_0x03bb('0x7')],'include':[{'model':_0x49516a[_0x03bb('0x22')],'as':_0x03bb('0x23'),'where':{'id':_0x5a00e1[_0x03bb('0x11')]}}],'raw':!![]})[_0x03bb('0x8')](function(_0x43bb97){var _0x470bfb=_0x43bb97[_0x03bb('0x24')](function(_0x593e2e){return handleCheckDuplicate(_0x49516a,_0x593e2e,_0x5a00e1,![]);});return Promise['all'](_0x470bfb);});}function createHopperForCampaigns(_0x2eed85,_0x448551){return _0x2eed85[_0x03bb('0x25')]['findAll']({'attributes':['id',_0x03bb('0x1e'),_0x03bb('0x7')],'include':[{'model':_0x2eed85[_0x03bb('0x22')],'as':_0x03bb('0x23'),'where':{'id':_0x448551[_0x03bb('0x11')]}}],'raw':!![]})['then'](function(_0x40f03c){var _0x263e66=_0x40f03c['map'](function(_0x2cb93d){return handleCheckDuplicate(_0x2eed85,_0x2cb93d,_0x448551,!![]);});return Promise[_0x03bb('0x26')](_0x263e66);});}function createHopperBlackForVoiceQueues(_0x3202e6,_0x4212bb){return _0x3202e6[_0x03bb('0x4')][_0x03bb('0x20')]({'where':{'type':_0x03bb('0x21')},'attributes':['id'],'include':[{'model':_0x3202e6[_0x03bb('0x22')],'as':'BlackLists','where':{'id':_0x4212bb[_0x03bb('0x11')]}}],'raw':!![]})[_0x03bb('0x8')](function(_0x137511){var _0x3457da=_0x137511['map'](function(_0x3591d9){return _0x3202e6[_0x03bb('0x27')][_0x03bb('0x1b')]({'phone':_0x4212bb[_0x03bb('0x10')],'ContactId':_0x4212bb['id'],'ListId':_0x4212bb['ListId'],'VoiceQueueId':_0x3591d9['id']});});return Promise['all'](_0x3457da);});}function createHopperBlackForCampaigns(_0x3858eb,_0x947be5){return _0x3858eb['Campaign'][_0x03bb('0x20')]({'attributes':['id'],'include':[{'model':_0x3858eb[_0x03bb('0x22')],'as':'BlackLists','where':{'id':_0x947be5[_0x03bb('0x11')]}}],'raw':!![]})[_0x03bb('0x8')](function(_0x32f681){var _0x2dfaba=_0x32f681[_0x03bb('0x24')](function(_0x5b682b){return _0x3858eb[_0x03bb('0x27')][_0x03bb('0x1b')]({'phone':_0x947be5[_0x03bb('0x10')],'ContactId':_0x947be5['id'],'ListId':_0x947be5[_0x03bb('0x11')],'CampaignId':_0x5b682b['id']});});return Promise[_0x03bb('0x26')](_0x2dfaba);});}module['exports']=function(_0x14f2a4){return _0x14f2a4['define'](_0x03bb('0x28'),attributes,{'tableName':_0x03bb('0x29'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x03bb('0x10')]},{'name':_0x03bb('0x2a'),'fields':[_0x03bb('0x2b'),'lastName','phone',_0x03bb('0x2c'),_0x03bb('0x2d'),'email'],'type':_0x03bb('0x2e')}],'timestamps':!![],'charset':_0x03bb('0x2f'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x28020b,_0x599ad5,_0x3cf781){var _0x4ad610=_0x14f2a4[_0x03bb('0x30')];var _0x2c9e5b=_0x28020b[_0x03bb('0x31')]({'plain':!![]});if(!_0x2c9e5b['ListId']){logger[_0x03bb('0x32')](_0x03bb('0x33')+_0x2c9e5b['id']);return _0x3cf781();}if(!_0x2c9e5b['phone']){return _0x3cf781();}return createHopperForVoiceQueues(_0x4ad610,_0x2c9e5b)[_0x03bb('0x8')](function(){return createHopperBlackForVoiceQueues(_0x4ad610,_0x2c9e5b);})[_0x03bb('0x8')](function(){return createHopperForCampaigns(_0x4ad610,_0x2c9e5b);})[_0x03bb('0x8')](function(){return createHopperBlackForCampaigns(_0x4ad610,_0x2c9e5b);})[_0x03bb('0x8')](function(){return _0x3cf781();})['catch'](function(_0xc4c4d1){logger['error']('[cmContact][afterCreate]',_0xc4c4d1[_0x03bb('0x34')]);_0x3cf781();});},'afterDestroy':function(_0x3791ca,_0x2b0d70,_0x33e7ae){var _0x44826f=_0x14f2a4['models'];var _0x5c6b79=_0x3791ca[_0x03bb('0x31')]({'plain':!![]});return _0x44826f[_0x03bb('0x15')][_0x03bb('0x20')]({'raw':!![],'where':{'ListId':_0x5c6b79[_0x03bb('0x11')],'ContactId':_0x5c6b79['id']}})[_0x03bb('0x8')](function(_0x1a7552){if(!_[_0x03bb('0x35')](_0x1a7552)){var _0x3e6bb3=[];for(var _0x387183=0x0;_0x387183<_0x1a7552[_0x03bb('0x36')];_0x387183+=0x1){var _0x10d4b3=_0x44826f[_0x03bb('0x15')][_0x03bb('0x37')]({'where':{'ListId':_0x1a7552[_0x387183][_0x03bb('0x11')],'ContactId':_0x1a7552[_0x387183][_0x03bb('0x38')],'VoiceQueueId':_0x1a7552[_0x387183][_0x03bb('0x1d')],'CampaignId':_0x1a7552[_0x387183][_0x03bb('0x1a')]}});_0x3e6bb3[_0x03bb('0x39')](_0x10d4b3);}return Promise[_0x03bb('0x26')](_0x3e6bb3);}})[_0x03bb('0x8')](function(_0x40565c){logger['info'](_0x03bb('0x3a'),util[_0x03bb('0x3b')](_0x40565c,{'showHidden':![],'depth':null}));_0x33e7ae();})['catch'](function(_0x2aadbf){logger[_0x03bb('0x32')](_0x03bb('0x3c'),util[_0x03bb('0x3b')](_0x2aadbf,{'showHidden':![],'depth':null}));_0x33e7ae(_0x2aadbf);});}}});}; \ No newline at end of file +var _0x76c4=['moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','isNil','dialTimezone','resolve','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','always','onlyIfOpen','findAll','dialCheckDuplicateType','CmList','Lists','map','all','outbound','CmHopperBlack','BlackLists','define','CmContact','cm_contacts','fti_cm_contacts','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','isEmpty','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger'];(function(_0x56c6a9,_0x1239ee){var _0xa3ad43=function(_0x386c0a){while(--_0x386c0a){_0x56c6a9['push'](_0x56c6a9['shift']());}};_0xa3ad43(++_0x1239ee);}(_0x76c4,0x19b));var _0x476c=function(_0xb7baaa,_0x602427){_0xb7baaa=_0xb7baaa-0x0;var _0x2c7a11=_0x76c4[_0xb7baaa];return _0x2c7a11;};'use strict';var _=require(_0x476c('0x0'));var util=require(_0x476c('0x1'));var logger=require(_0x476c('0x2'))('api');var moment=require(_0x476c('0x3'));var shared=require(_0x476c('0x4'));var attributes=require(_0x476c('0x5'));function getTimezoneCallbackAt(_0x33f84f,_0x3a6fc4,_0x5ec12b,_0x4f5f3f){var _0x1bd092=_0x4f5f3f?_0x476c('0x6'):_0x476c('0x7');var _0x126b74=_0x5ec12b[_0x476c('0x8')]?_0x5ec12b[_0x476c('0x8')]:moment()[_0x476c('0x9')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x476c('0xa')](_0x5ec12b[_0x476c('0xb')])){return Promise[_0x476c('0xc')](_0x126b74);}return _0x33f84f[_0x1bd092]['findOne']({'where':{'id':_0x3a6fc4}})[_0x476c('0xd')](function(_0x3f52bf){if(_['isNil'](_0x3f52bf)||_[_0x476c('0xa')](_0x3f52bf['dialTimezone'])){return Promise[_0x476c('0xc')](_0x126b74);}var _0x1bf6f3=shared[_0x476c('0xe')];var _0x2e9477=_0x1bf6f3[_0x3f52bf[_0x476c('0xb')]];var _0x3a54f8=_0x1bf6f3[_0x5ec12b[_0x476c('0xb')]];if(_[_0x476c('0xa')](_0x2e9477)&&_['isNil'](_0x3a54f8)){return Promise['resolve'](_0x126b74);}var _0x4218ae=_0x2e9477[_0x476c('0xf')]-_0x3a54f8['utcOffset'];var _0x38ff59=_0x5ec12b[_0x476c('0x8')]?_0x5ec12b[_0x476c('0x8')]:moment();_0x126b74=moment(_0x38ff59)[_0x476c('0x10')](_0x4218ae,_0x476c('0x11'))[_0x476c('0x9')](_0x476c('0x12'));return Promise[_0x476c('0xc')](_0x126b74);});}function getNewHopperPayload(_0xd2b9b8){return{'phone':_0xd2b9b8[_0x476c('0x13')],'ContactId':_0xd2b9b8['id'],'ListId':_0xd2b9b8[_0x476c('0x14')],'scheduledat':_0xd2b9b8[_0x476c('0x8')]?_0xd2b9b8['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xd2b9b8[_0x476c('0x15')]?_0xd2b9b8[_0x476c('0x15')]:0x2,'callback':_0xd2b9b8[_0x476c('0x16')]?!![]:![],'callbackuniqueid':_0xd2b9b8[_0x476c('0x16')]?_0xd2b9b8[_0x476c('0x16')]:undefined,'callbackat':_0xd2b9b8[_0x476c('0x16')]?moment()[_0x476c('0x9')](_0x476c('0x12')):undefined};}function handleAlwaysCheckDuplicate(_0x3e76e0,_0x28df30,_0x34407f,_0x45c02){var _0x20e12a={'phone':_0x34407f[_0x476c('0x13')]};var _0x14aae6={'calleridnum':_0x34407f[_0x476c('0x13')]};if(_0x45c02){Object[_0x476c('0x17')](_0x20e12a,{'CampaignId':_0x28df30['id']});Object[_0x476c('0x17')](_0x14aae6,{'CampaignId':_0x28df30['id']});}else{Object[_0x476c('0x17')](_0x20e12a,{'VoiceQueueId':_0x28df30['id']});Object[_0x476c('0x17')](_0x14aae6,{'VoiceQueueId':_0x28df30['id']});}return _0x3e76e0[_0x476c('0x18')][_0x476c('0x19')]({'where':_0x20e12a})['then'](function(_0x5d5190){if(_0x5d5190){throw new Error(_0x476c('0x1a')+_0x34407f[_0x476c('0x13')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x28df30['id']);}return _0x3e76e0['CmHopperFinal']['findOne']({'where':_0x14aae6});})['then'](function(_0x4b48b2){if(_0x4b48b2){throw new Error(_0x476c('0x1b')+_0x34407f['phone']+_0x476c('0x1c')+_0x28df30['id']);}var _0x2aff2a=getNewHopperPayload(_0x34407f);if(_0x45c02){_0x2aff2a[_0x476c('0x1d')]=_0x28df30['id'];}else{_0x2aff2a[_0x476c('0x1e')]=_0x28df30['id'];}return _0x3e76e0[_0x476c('0x18')]['create'](_0x2aff2a);});}function handleOnlyIfOpenCheckDuplicate(_0x410179,_0x1eeadb,_0x31a93f,_0x33991f){var _0x588d92={'phone':_0x31a93f['phone']};if(_0x33991f){Object['assign'](_0x588d92,{'CampaignId':_0x1eeadb['id']});}else{Object[_0x476c('0x17')](_0x588d92,{'VoiceQueueId':_0x1eeadb['id']});}return _0x410179[_0x476c('0x18')][_0x476c('0x19')]({'where':_0x588d92})[_0x476c('0xd')](function(_0x1700f0){if(_0x1700f0){throw new Error(_0x476c('0x1f')+_0x31a93f[_0x476c('0x13')]+_0x476c('0x1c')+_0x1eeadb['id']);}var _0x45607a=getNewHopperPayload(_0x31a93f);if(_0x33991f){_0x45607a['CampaignId']=_0x1eeadb['id'];}else{_0x45607a[_0x476c('0x1e')]=_0x1eeadb['id'];}return _0x410179[_0x476c('0x18')][_0x476c('0x20')](_0x45607a);});}function handleNeverCheckDuplicate(_0x4663f7,_0x4ce6bd,_0x456456){var _0x3b3dcd=getNewHopperPayload(_0x456456);_0x3b3dcd[_0x476c('0x1e')]=_0x4ce6bd['id'];return _0x4663f7[_0x476c('0x18')][_0x476c('0x20')](_0x3b3dcd);}function handleCheckDuplicate(_0x1e4498,_0x1d3983,_0x3f227b,_0x1bc713){return getTimezoneCallbackAt(_0x1e4498,_0x1d3983,_0x3f227b,_0x1bc713)[_0x476c('0xd')](function(_0x523735){_0x3f227b[_0x476c('0x8')]=_0x523735;switch(_0x1d3983['dialCheckDuplicateType']){case _0x476c('0x21'):return handleAlwaysCheckDuplicate(_0x1e4498,_0x1d3983,_0x3f227b,_0x1bc713);case _0x476c('0x22'):return handleOnlyIfOpenCheckDuplicate(_0x1e4498,_0x1d3983,_0x3f227b,_0x1bc713);default:return handleNeverCheckDuplicate(_0x1e4498,_0x1d3983,_0x3f227b);}});}function createHopperForVoiceQueues(_0x4e78cf,_0xd1b0e5){return _0x4e78cf[_0x476c('0x7')][_0x476c('0x23')]({'where':{'type':'outbound'},'attributes':['id',_0x476c('0x24'),'dialTimezone'],'include':[{'model':_0x4e78cf[_0x476c('0x25')],'as':_0x476c('0x26'),'where':{'id':_0xd1b0e5[_0x476c('0x14')]}}],'raw':!![]})[_0x476c('0xd')](function(_0x12d63b){var _0x3740f8=_0x12d63b['map'](function(_0x5d7fe1){return handleCheckDuplicate(_0x4e78cf,_0x5d7fe1,_0xd1b0e5,![]);});return Promise['all'](_0x3740f8);});}function createHopperForCampaigns(_0x28d67b,_0x26e1ba){return _0x28d67b[_0x476c('0x6')][_0x476c('0x23')]({'attributes':['id',_0x476c('0x24'),_0x476c('0xb')],'include':[{'model':_0x28d67b[_0x476c('0x25')],'as':_0x476c('0x26'),'where':{'id':_0x26e1ba[_0x476c('0x14')]}}],'raw':!![]})['then'](function(_0x55de40){var _0x4877b5=_0x55de40[_0x476c('0x27')](function(_0x3c106f){return handleCheckDuplicate(_0x28d67b,_0x3c106f,_0x26e1ba,!![]);});return Promise[_0x476c('0x28')](_0x4877b5);});}function createHopperBlackForVoiceQueues(_0x41118f,_0x3fca8a){return _0x41118f[_0x476c('0x7')]['findAll']({'where':{'type':_0x476c('0x29')},'attributes':['id'],'include':[{'model':_0x41118f['CmList'],'as':'BlackLists','where':{'id':_0x3fca8a[_0x476c('0x14')]}}],'raw':!![]})[_0x476c('0xd')](function(_0x545fdb){var _0x4b4c2f=_0x545fdb[_0x476c('0x27')](function(_0x1e3fde){return _0x41118f[_0x476c('0x2a')][_0x476c('0x20')]({'phone':_0x3fca8a['phone'],'ContactId':_0x3fca8a['id'],'ListId':_0x3fca8a['ListId'],'VoiceQueueId':_0x1e3fde['id']});});return Promise[_0x476c('0x28')](_0x4b4c2f);});}function createHopperBlackForCampaigns(_0x5c3c01,_0x5b5009){return _0x5c3c01[_0x476c('0x6')]['findAll']({'attributes':['id'],'include':[{'model':_0x5c3c01[_0x476c('0x25')],'as':_0x476c('0x2b'),'where':{'id':_0x5b5009[_0x476c('0x14')]}}],'raw':!![]})[_0x476c('0xd')](function(_0x46df46){var _0x230181=_0x46df46[_0x476c('0x27')](function(_0x42e2ed){return _0x5c3c01['CmHopperBlack'][_0x476c('0x20')]({'phone':_0x5b5009[_0x476c('0x13')],'ContactId':_0x5b5009['id'],'ListId':_0x5b5009[_0x476c('0x14')],'CampaignId':_0x42e2ed['id']});});return Promise[_0x476c('0x28')](_0x230181);});}module['exports']=function(_0x1cb6f7){return _0x1cb6f7[_0x476c('0x2c')](_0x476c('0x2d'),attributes,{'tableName':_0x476c('0x2e'),'paranoid':!![],'indexes':[{'name':_0x476c('0x13'),'fields':[_0x476c('0x13')]},{'name':_0x476c('0x2f'),'fields':['firstName',_0x476c('0x30'),_0x476c('0x13'),'mobile',_0x476c('0x31'),_0x476c('0x32')],'type':_0x476c('0x33')}],'timestamps':!![],'charset':_0x476c('0x34'),'collate':_0x476c('0x35'),'hooks':{'afterCreate':function(_0x5be874,_0x1649f5,_0xb9edb4){var _0x149e55=_0x1cb6f7[_0x476c('0x36')];var _0x2368ca=_0x5be874[_0x476c('0x37')]({'plain':!![]});if(!_0x2368ca['ListId']){logger[_0x476c('0x38')](_0x476c('0x39')+_0x2368ca['id']);return _0xb9edb4();}if(!_0x2368ca['phone']){return _0xb9edb4();}return createHopperForVoiceQueues(_0x149e55,_0x2368ca)[_0x476c('0xd')](function(){return createHopperBlackForVoiceQueues(_0x149e55,_0x2368ca);})['then'](function(){return createHopperForCampaigns(_0x149e55,_0x2368ca);})[_0x476c('0xd')](function(){return createHopperBlackForCampaigns(_0x149e55,_0x2368ca);})[_0x476c('0xd')](function(){return _0xb9edb4();})[_0x476c('0x3a')](function(_0x4a615b){logger[_0x476c('0x38')](_0x476c('0x3b'),_0x4a615b['message']);_0xb9edb4();});},'afterDestroy':function(_0x4f6901,_0x10176c,_0x77c15){var _0x5c3769=_0x1cb6f7[_0x476c('0x36')];var _0x4dffbb=_0x4f6901[_0x476c('0x37')]({'plain':!![]});return _0x5c3769[_0x476c('0x18')]['findAll']({'raw':!![],'where':{'ListId':_0x4dffbb[_0x476c('0x14')],'ContactId':_0x4dffbb['id']}})[_0x476c('0xd')](function(_0xbdc6db){if(!_[_0x476c('0x3c')](_0xbdc6db)){var _0x13dca0=[];for(var _0x4289d5=0x0;_0x4289d5<_0xbdc6db[_0x476c('0x3d')];_0x4289d5+=0x1){var _0x26dc4a=_0x5c3769['CmHopper'][_0x476c('0x3e')]({'where':{'ListId':_0xbdc6db[_0x4289d5][_0x476c('0x14')],'ContactId':_0xbdc6db[_0x4289d5][_0x476c('0x3f')],'VoiceQueueId':_0xbdc6db[_0x4289d5][_0x476c('0x1e')],'CampaignId':_0xbdc6db[_0x4289d5][_0x476c('0x1d')]}});_0x13dca0[_0x476c('0x40')](_0x26dc4a);}return Promise[_0x476c('0x28')](_0x13dca0);}})[_0x476c('0xd')](function(_0x882340){logger[_0x476c('0x41')](_0x476c('0x42'),util[_0x476c('0x43')](_0x882340,{'showHidden':![],'depth':null}));_0x77c15();})['catch'](function(_0x5477e7){logger[_0x476c('0x38')](_0x476c('0x44'),util['inspect'](_0x5477e7,{'showHidden':![],'depth':null}));_0x77c15(_0x5477e7);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 7112767..820ea73 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x4ae64f,_0x2b416a){var _0x394ced=function(_0x3cbc56){while(--_0x3cbc56){_0x4ae64f['push'](_0x4ae64f['shift']());}};_0x394ced(++_0x2b416a);}(_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'));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 c9a5aaf..d71c2a3 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 _0x04d0=['STRING','PHONE','INTEGER'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x04d0,0x10a));var _0x004d=function(_0x498554,_0x49933a){_0x498554=_0x498554-0x0;var _0x8aede0=_0x04d0[_0x498554];return _0x8aede0;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x004d('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0x004d('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x004d('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x004d('0x1')],'defaultValue':_0x004d('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x720c=['STRING','sequelize','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x720c,0x154));var _0xc720=function(_0x18fcde,_0x20f1c1){_0x18fcde=_0x18fcde-0x0;var _0x29bfb7=_0x720c[_0x18fcde];return _0x29bfb7;};'use strict';var Sequelize=require(_0xc720('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xc720('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xc720('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc720('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc720('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xc720('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xc720('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index de09ce1..1fc44b7 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 _0x29ce=['to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x518fcd,_0x13e1d1){var _0x5572a1=function(_0x4bd923){while(--_0x4bd923){_0x518fcd['push'](_0x518fcd['shift']());}};_0x5572a1(++_0x13e1d1);}(_0x29ce,0x1e3));var _0xe29c=function(_0x19cac0,_0x1bbeba){_0x19cac0=_0x19cac0-0x0;var _0x8242e8=_0x29ce[_0x19cac0];return _0x8242e8;};'use strict';var emlformat=require(_0xe29c('0x0'));var rimraf=require(_0xe29c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe29c('0x2'));var rp=require(_0xe29c('0x3'));var moment=require(_0xe29c('0x4'));var BPromise=require(_0xe29c('0x5'));var Mustache=require(_0xe29c('0x6'));var util=require(_0xe29c('0x7'));var path=require(_0xe29c('0x8'));var sox=require('sox');var csv=require(_0xe29c('0x9'));var ejs=require(_0xe29c('0xa'));var fs=require('fs');var fs_extra=require(_0xe29c('0xb'));var _=require(_0xe29c('0xc'));var squel=require(_0xe29c('0xd'));var crypto=require('crypto');var jsforce=require(_0xe29c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe29c('0x9'));var querystring=require('querystring');var Papa=require(_0xe29c('0xf'));var Redis=require(_0xe29c('0x10'));var authService=require(_0xe29c('0x11'));var qs=require(_0xe29c('0x12'));var as=require(_0xe29c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe29c('0x14'));var config=require(_0xe29c('0x15'));var licenseUtil=require(_0xe29c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1742cd,_0x482fc3){_0x482fc3=_0x482fc3||0xcc;return function(_0x551c96){if(_0x551c96){return _0x1742cd[_0xe29c('0x17')](_0x482fc3);}return _0x1742cd[_0xe29c('0x18')](_0x482fc3)[_0xe29c('0x19')]();};}function respondWithResult(_0x3c69cc,_0x165ffe){_0x165ffe=_0x165ffe||0xc8;return function(_0x5a6211){if(_0x5a6211){return _0x3c69cc['status'](_0x165ffe)[_0xe29c('0x1a')](_0x5a6211);}};}function respondWithFilteredResult(_0x12253f,_0x2bdf86){return function(_0x43785d){if(_0x43785d){var _0x53287f=typeof _0x2bdf86[_0xe29c('0x1b')]===_0xe29c('0x1c')&&typeof _0x2bdf86['limit']===_0xe29c('0x1c');var _0xe5c066=_0x43785d[_0xe29c('0x1d')];var _0x955ffe=_0x53287f?0x0:_0x2bdf86[_0xe29c('0x1b')];var _0x2b3435=_0x53287f?_0x43785d['count']:_0x2bdf86[_0xe29c('0x1b')]+_0x2bdf86['limit'];var _0x51a393;if(_0x2b3435>=_0xe5c066){_0x2b3435=_0xe5c066;_0x51a393=0xc8;}else{_0x51a393=0xce;}_0x12253f['status'](_0x51a393);return _0x12253f[_0xe29c('0x1e')]('Content-Range',_0x955ffe+'-'+_0x2b3435+'/'+_0xe5c066)['json'](_0x43785d);}return null;};}function patchUpdates(_0x3eecee){return function(_0xe6f4b5){try{jsonpatch[_0xe29c('0x1f')](_0xe6f4b5,_0x3eecee,!![]);}catch(_0x49e069){return BPromise['reject'](_0x49e069);}return _0xe6f4b5[_0xe29c('0x20')]();};}function saveUpdates(_0x172961,_0x507947){return function(_0x102614){if(_0x102614){return _0x102614[_0xe29c('0x21')](_0x172961)[_0xe29c('0x22')](function(_0x1b8b9d){return _0x1b8b9d;});}return null;};}function removeEntity(_0x88ef40,_0x15052c){return function(_0x25242a){if(_0x25242a){return _0x25242a[_0xe29c('0x23')]()['then'](function(){var _0x25d407=_0x25242a[_0xe29c('0x24')]({'plain':!![]});var _0x316ce7=_0xe29c('0x25');return db[_0xe29c('0x26')][_0xe29c('0x23')]({'where':{'type':_0x316ce7,'resourceId':_0x25d407['id']}})[_0xe29c('0x22')](function(){return _0x25242a;});})[_0xe29c('0x22')](function(){_0x88ef40[_0xe29c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a40d6,_0x193c80){return function(_0x3a58e8){if(!_0x3a58e8){_0x9a40d6['sendStatus'](0x194);}return _0x3a58e8;};}function handleError(_0x20bafd,_0x2916bf){_0x2916bf=_0x2916bf||0x1f4;return function(_0x2f9dc0){logger[_0xe29c('0x27')](_0x2f9dc0[_0xe29c('0x28')]);if(_0x2f9dc0[_0xe29c('0x29')]){delete _0x2f9dc0[_0xe29c('0x29')];}_0x20bafd[_0xe29c('0x18')](_0x2916bf)['send'](_0x2f9dc0);};}exports[_0xe29c('0x2a')]=function(_0x3a066e,_0x462845){var _0x1b2480={},_0x5ddd0b={},_0x47c8b1={'count':0x0,'rows':[]};var _0x2bfeac=_[_0xe29c('0x2b')](db[_0xe29c('0x2c')][_0xe29c('0x2d')],function(_0x35287f){return{'name':_0x35287f[_0xe29c('0x2e')],'type':_0x35287f['type']['key']};});_0x5ddd0b[_0xe29c('0x2f')]=_[_0xe29c('0x2b')](_0x2bfeac,_0xe29c('0x29'));_0x5ddd0b[_0xe29c('0x30')]=_[_0xe29c('0x31')](_0x3a066e[_0xe29c('0x30')]);_0x5ddd0b[_0xe29c('0x32')]=_['intersection'](_0x5ddd0b[_0xe29c('0x2f')],_0x5ddd0b[_0xe29c('0x30')]);_0x1b2480[_0xe29c('0x33')]=_[_0xe29c('0x34')](_0x5ddd0b[_0xe29c('0x2f')],qs[_0xe29c('0x35')](_0x3a066e[_0xe29c('0x30')]['fields']));_0x1b2480['attributes']=_0x1b2480[_0xe29c('0x33')][_0xe29c('0x36')]?_0x1b2480['attributes']:_0x5ddd0b[_0xe29c('0x2f')];if(!_0x3a066e[_0xe29c('0x30')][_0xe29c('0x37')](_0xe29c('0x38'))){_0x1b2480[_0xe29c('0x39')]=qs[_0xe29c('0x39')](_0x3a066e[_0xe29c('0x30')][_0xe29c('0x39')]);_0x1b2480['offset']=qs['offset'](_0x3a066e[_0xe29c('0x30')][_0xe29c('0x1b')]);}_0x1b2480[_0xe29c('0x3a')]=qs[_0xe29c('0x3b')](_0x3a066e['query'][_0xe29c('0x3b')]);_0x1b2480['where']=qs[_0xe29c('0x32')](_[_0xe29c('0x3c')](_0x3a066e['query'],_0x5ddd0b[_0xe29c('0x32')]),_0x2bfeac);if(_0x3a066e[_0xe29c('0x30')][_0xe29c('0x3d')]){_0x1b2480[_0xe29c('0x3e')]=_[_0xe29c('0x3f')](_0x1b2480[_0xe29c('0x3e')],{'$or':_['map'](_0x2bfeac,function(_0x38fc41){if(_0x38fc41[_0xe29c('0x40')]!==_0xe29c('0x41')){var _0x5c1f7b={};_0x5c1f7b[_0x38fc41[_0xe29c('0x29')]]={'$like':'%'+_0x3a066e[_0xe29c('0x30')][_0xe29c('0x3d')]+'%'};return _0x5c1f7b;}})});}_0x1b2480=_[_0xe29c('0x3f')]({},_0x1b2480,_0x3a066e[_0xe29c('0x42')]);var _0x4134a8={'where':_0x1b2480[_0xe29c('0x3e')]};return db['CmContactHasItem'][_0xe29c('0x1d')](_0x4134a8)[_0xe29c('0x22')](function(_0x45c3e2){_0x47c8b1[_0xe29c('0x1d')]=_0x45c3e2;if(_0x3a066e[_0xe29c('0x30')][_0xe29c('0x43')]){_0x1b2480[_0xe29c('0x44')]=[{'all':!![]}];}return db[_0xe29c('0x2c')][_0xe29c('0x45')](_0x1b2480);})[_0xe29c('0x22')](function(_0x431e63){_0x47c8b1[_0xe29c('0x46')]=_0x431e63;return _0x47c8b1;})[_0xe29c('0x22')](respondWithFilteredResult(_0x462845,_0x1b2480))['catch'](handleError(_0x462845,null));};exports['show']=function(_0x105024,_0x5b7797){var _0x405992={'raw':!![],'where':{'id':_0x105024['params']['id']}},_0x1181f2={};_0x1181f2[_0xe29c('0x2f')]=_[_0xe29c('0x31')](db['CmContactHasItem'][_0xe29c('0x2d')]);_0x1181f2[_0xe29c('0x30')]=_[_0xe29c('0x31')](_0x105024[_0xe29c('0x30')]);_0x1181f2['filters']=_[_0xe29c('0x34')](_0x1181f2[_0xe29c('0x2f')],_0x1181f2['query']);_0x405992['attributes']=_[_0xe29c('0x34')](_0x1181f2[_0xe29c('0x2f')],qs[_0xe29c('0x35')](_0x105024[_0xe29c('0x30')][_0xe29c('0x35')]));_0x405992['attributes']=_0x405992[_0xe29c('0x33')][_0xe29c('0x36')]?_0x405992[_0xe29c('0x33')]:_0x1181f2['model'];if(_0x105024[_0xe29c('0x30')]['includeAll']){_0x405992['include']=[{'all':!![]}];}_0x405992=_[_0xe29c('0x3f')]({},_0x405992,_0x105024[_0xe29c('0x42')]);return db[_0xe29c('0x2c')][_0xe29c('0x47')](_0x405992)[_0xe29c('0x22')](handleEntityNotFound(_0x5b7797,null))[_0xe29c('0x22')](respondWithResult(_0x5b7797,null))[_0xe29c('0x48')](handleError(_0x5b7797,null));};exports['create']=function(_0x273e29,_0x1dcb97){return db[_0xe29c('0x2c')][_0xe29c('0x49')](_0x273e29[_0xe29c('0x4a')],{})[_0xe29c('0x22')](function(_0xc0b4e0){var _0x4aefd2=_0x273e29['user'][_0xe29c('0x24')]({'plain':!![]});if(!_0x4aefd2)throw new Error(_0xe29c('0x4b'));if(_0x4aefd2[_0xe29c('0x4c')]===_0xe29c('0x4d')){var _0x4a1294=_0xc0b4e0['get']({'plain':!![]});var _0x1f27ad='CmContactHasItems';return db[_0xe29c('0x4e')]['find']({'where':{'name':_0x1f27ad,'userProfileId':_0x4aefd2[_0xe29c('0x4f')]},'raw':!![]})[_0xe29c('0x22')](function(_0x29a686){if(_0x29a686&&_0x29a686[_0xe29c('0x50')]===0x0){return db[_0xe29c('0x26')][_0xe29c('0x49')]({'name':_0x4a1294[_0xe29c('0x29')],'resourceId':_0x4a1294['id'],'type':_0x29a686['name'],'sectionId':_0x29a686['id']},{})[_0xe29c('0x22')](function(){return _0xc0b4e0;});}else{return _0xc0b4e0;}})[_0xe29c('0x48')](function(_0x4e772d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e772d);throw _0x4e772d;});}return _0xc0b4e0;})[_0xe29c('0x22')](respondWithResult(_0x1dcb97,0xc9))['catch'](handleError(_0x1dcb97,null));};exports[_0xe29c('0x21')]=function(_0x41faca,_0x53f3e5){if(_0x41faca[_0xe29c('0x4a')]['id']){delete _0x41faca[_0xe29c('0x4a')]['id'];}return db[_0xe29c('0x2c')][_0xe29c('0x47')]({'where':{'id':_0x41faca['params']['id']}})['then'](handleEntityNotFound(_0x53f3e5,null))['then'](saveUpdates(_0x41faca[_0xe29c('0x4a')],null))[_0xe29c('0x22')](respondWithResult(_0x53f3e5,null))[_0xe29c('0x48')](handleError(_0x53f3e5,null));};exports[_0xe29c('0x23')]=function(_0x51048a,_0x14b9b8){return db[_0xe29c('0x2c')][_0xe29c('0x47')]({'where':{'id':_0x51048a[_0xe29c('0x51')]['id']}})[_0xe29c('0x22')](handleEntityNotFound(_0x14b9b8,null))['then'](removeEntity(_0x14b9b8,null))['catch'](handleError(_0x14b9b8,null));}; \ No newline at end of file +var _0xb0c5=['body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','status','end','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','CmContactHasItem','rows','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error'];(function(_0x88f99f,_0x10d180){var _0x2dc4d4=function(_0x4399f9){while(--_0x4399f9){_0x88f99f['push'](_0x88f99f['shift']());}};_0x2dc4d4(++_0x10d180);}(_0xb0c5,0x1a1));var _0x5b0c=function(_0x55a54d,_0x40057a){_0x55a54d=_0x55a54d-0x0;var _0x3808a2=_0xb0c5[_0x55a54d];return _0x3808a2;};'use strict';var emlformat=require(_0x5b0c('0x0'));var rimraf=require(_0x5b0c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b0c('0x2'));var rp=require(_0x5b0c('0x3'));var moment=require(_0x5b0c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5b0c('0x5'));var util=require('util');var path=require(_0x5b0c('0x6'));var sox=require(_0x5b0c('0x7'));var csv=require('to-csv');var ejs=require(_0x5b0c('0x8'));var fs=require('fs');var fs_extra=require(_0x5b0c('0x9'));var _=require(_0x5b0c('0xa'));var squel=require('squel');var crypto=require(_0x5b0c('0xb'));var jsforce=require(_0x5b0c('0xc'));var deskjs=require(_0x5b0c('0xd'));var toCsv=require(_0x5b0c('0xe'));var querystring=require('querystring');var Papa=require(_0x5b0c('0xf'));var Redis=require(_0x5b0c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5b0c('0x11'));var as=require(_0x5b0c('0x12'));var hardwareService=require(_0x5b0c('0x13'));var logger=require(_0x5b0c('0x14'))(_0x5b0c('0x15'));var utils=require(_0x5b0c('0x16'));var config=require(_0x5b0c('0x17'));var licenseUtil=require(_0x5b0c('0x18'));var db=require(_0x5b0c('0x19'))['db'];function respondWithStatusCode(_0x1d5dfc,_0x5acc3f){_0x5acc3f=_0x5acc3f||0xcc;return function(_0x34cada){if(_0x34cada){return _0x1d5dfc[_0x5b0c('0x1a')](_0x5acc3f);}return _0x1d5dfc['status'](_0x5acc3f)['end']();};}function respondWithResult(_0x4dac23,_0x2be327){_0x2be327=_0x2be327||0xc8;return function(_0x1118b3){if(_0x1118b3){return _0x4dac23['status'](_0x2be327)[_0x5b0c('0x1b')](_0x1118b3);}};}function respondWithFilteredResult(_0x59438c,_0x5f36fe){return function(_0x4f1010){if(_0x4f1010){var _0x5c3891=typeof _0x5f36fe[_0x5b0c('0x1c')]===_0x5b0c('0x1d')&&typeof _0x5f36fe[_0x5b0c('0x1e')]===_0x5b0c('0x1d');var _0x639528=_0x4f1010[_0x5b0c('0x1f')];var _0x326bd1=_0x5c3891?0x0:_0x5f36fe[_0x5b0c('0x1c')];var _0x58b2b9=_0x5c3891?_0x4f1010['count']:_0x5f36fe['offset']+_0x5f36fe['limit'];var _0x803018;if(_0x58b2b9>=_0x639528){_0x58b2b9=_0x639528;_0x803018=0xc8;}else{_0x803018=0xce;}_0x59438c['status'](_0x803018);return _0x59438c['set']('Content-Range',_0x326bd1+'-'+_0x58b2b9+'/'+_0x639528)['json'](_0x4f1010);}return null;};}function patchUpdates(_0x54b6e2){return function(_0x3d7569){try{jsonpatch[_0x5b0c('0x20')](_0x3d7569,_0x54b6e2,!![]);}catch(_0x50060b){return BPromise[_0x5b0c('0x21')](_0x50060b);}return _0x3d7569[_0x5b0c('0x22')]();};}function saveUpdates(_0x32b326,_0x473ace){return function(_0x1b82a4){if(_0x1b82a4){return _0x1b82a4['update'](_0x32b326)[_0x5b0c('0x23')](function(_0x412978){return _0x412978;});}return null;};}function removeEntity(_0x2842cc,_0x1f5128){return function(_0x171eb0){if(_0x171eb0){return _0x171eb0[_0x5b0c('0x24')]()[_0x5b0c('0x23')](function(){var _0x5dbf31=_0x171eb0[_0x5b0c('0x25')]({'plain':!![]});var _0x2f221f=_0x5b0c('0x26');return db[_0x5b0c('0x27')][_0x5b0c('0x24')]({'where':{'type':_0x2f221f,'resourceId':_0x5dbf31['id']}})[_0x5b0c('0x23')](function(){return _0x171eb0;});})['then'](function(){_0x2842cc[_0x5b0c('0x28')](0xcc)[_0x5b0c('0x29')]();});}};}function handleEntityNotFound(_0x4d1689,_0x495e77){return function(_0x1e4829){if(!_0x1e4829){_0x4d1689[_0x5b0c('0x1a')](0x194);}return _0x1e4829;};}function handleError(_0x28e188,_0x37da16){_0x37da16=_0x37da16||0x1f4;return function(_0x189280){logger['error'](_0x189280[_0x5b0c('0x2a')]);if(_0x189280[_0x5b0c('0x2b')]){delete _0x189280['name'];}_0x28e188[_0x5b0c('0x28')](_0x37da16)[_0x5b0c('0x2c')](_0x189280);};}exports[_0x5b0c('0x2d')]=function(_0xa1bd41,_0x255f2d){var _0x46f399={},_0x3cc1be={},_0x1955f5={'count':0x0,'rows':[]};var _0x3c5eb0=_[_0x5b0c('0x2e')](db['CmContactHasItem'][_0x5b0c('0x2f')],function(_0x45117e){return{'name':_0x45117e['fieldName'],'type':_0x45117e[_0x5b0c('0x30')][_0x5b0c('0x31')]};});_0x3cc1be[_0x5b0c('0x32')]=_[_0x5b0c('0x2e')](_0x3c5eb0,'name');_0x3cc1be[_0x5b0c('0x33')]=_['keys'](_0xa1bd41['query']);_0x3cc1be[_0x5b0c('0x34')]=_['intersection'](_0x3cc1be[_0x5b0c('0x32')],_0x3cc1be[_0x5b0c('0x33')]);_0x46f399['attributes']=_[_0x5b0c('0x35')](_0x3cc1be[_0x5b0c('0x32')],qs[_0x5b0c('0x36')](_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x36')]));_0x46f399[_0x5b0c('0x37')]=_0x46f399['attributes'][_0x5b0c('0x38')]?_0x46f399[_0x5b0c('0x37')]:_0x3cc1be['model'];if(!_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x39')](_0x5b0c('0x3a'))){_0x46f399[_0x5b0c('0x1e')]=qs['limit'](_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x1e')]);_0x46f399[_0x5b0c('0x1c')]=qs['offset'](_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x1c')]);}_0x46f399[_0x5b0c('0x3b')]=qs[_0x5b0c('0x3c')](_0xa1bd41[_0x5b0c('0x33')]['sort']);_0x46f399[_0x5b0c('0x3d')]=qs[_0x5b0c('0x34')](_[_0x5b0c('0x3e')](_0xa1bd41[_0x5b0c('0x33')],_0x3cc1be[_0x5b0c('0x34')]),_0x3c5eb0);if(_0xa1bd41['query'][_0x5b0c('0x3f')]){_0x46f399['where']=_[_0x5b0c('0x40')](_0x46f399['where'],{'$or':_['map'](_0x3c5eb0,function(_0x4287b3){if(_0x4287b3[_0x5b0c('0x30')]!==_0x5b0c('0x41')){var _0x4c026d={};_0x4c026d[_0x4287b3[_0x5b0c('0x2b')]]={'$like':'%'+_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x3f')]+'%'};return _0x4c026d;}})});}_0x46f399=_[_0x5b0c('0x40')]({},_0x46f399,_0xa1bd41[_0x5b0c('0x42')]);var _0x11f369={'where':_0x46f399[_0x5b0c('0x3d')]};return db['CmContactHasItem'][_0x5b0c('0x1f')](_0x11f369)[_0x5b0c('0x23')](function(_0x18bbab){_0x1955f5[_0x5b0c('0x1f')]=_0x18bbab;if(_0xa1bd41[_0x5b0c('0x33')]['includeAll']){_0x46f399[_0x5b0c('0x43')]=[{'all':!![]}];}return db[_0x5b0c('0x44')]['findAll'](_0x46f399);})['then'](function(_0x80b056){_0x1955f5[_0x5b0c('0x45')]=_0x80b056;return _0x1955f5;})[_0x5b0c('0x23')](respondWithFilteredResult(_0x255f2d,_0x46f399))[_0x5b0c('0x46')](handleError(_0x255f2d,null));};exports[_0x5b0c('0x47')]=function(_0xe1cf84,_0x3ac0a2){var _0x103af7={'raw':!![],'where':{'id':_0xe1cf84['params']['id']}},_0x264aff={};_0x264aff[_0x5b0c('0x32')]=_[_0x5b0c('0x48')](db[_0x5b0c('0x44')][_0x5b0c('0x2f')]);_0x264aff['query']=_[_0x5b0c('0x48')](_0xe1cf84[_0x5b0c('0x33')]);_0x264aff[_0x5b0c('0x34')]=_[_0x5b0c('0x35')](_0x264aff[_0x5b0c('0x32')],_0x264aff[_0x5b0c('0x33')]);_0x103af7[_0x5b0c('0x37')]=_[_0x5b0c('0x35')](_0x264aff[_0x5b0c('0x32')],qs[_0x5b0c('0x36')](_0xe1cf84[_0x5b0c('0x33')]['fields']));_0x103af7['attributes']=_0x103af7[_0x5b0c('0x37')][_0x5b0c('0x38')]?_0x103af7['attributes']:_0x264aff[_0x5b0c('0x32')];if(_0xe1cf84[_0x5b0c('0x33')]['includeAll']){_0x103af7['include']=[{'all':!![]}];}_0x103af7=_[_0x5b0c('0x40')]({},_0x103af7,_0xe1cf84[_0x5b0c('0x42')]);return db['CmContactHasItem'][_0x5b0c('0x49')](_0x103af7)[_0x5b0c('0x23')](handleEntityNotFound(_0x3ac0a2,null))[_0x5b0c('0x23')](respondWithResult(_0x3ac0a2,null))[_0x5b0c('0x46')](handleError(_0x3ac0a2,null));};exports[_0x5b0c('0x4a')]=function(_0x34a125,_0x375129){return db[_0x5b0c('0x44')][_0x5b0c('0x4a')](_0x34a125['body'],{})[_0x5b0c('0x23')](function(_0x2c6309){var _0x4443fd=_0x34a125[_0x5b0c('0x4b')][_0x5b0c('0x25')]({'plain':!![]});if(!_0x4443fd)throw new Error(_0x5b0c('0x4c'));if(_0x4443fd[_0x5b0c('0x4d')]===_0x5b0c('0x4b')){var _0x3557ae=_0x2c6309[_0x5b0c('0x25')]({'plain':!![]});var _0x8cccd1=_0x5b0c('0x26');return db[_0x5b0c('0x4e')][_0x5b0c('0x49')]({'where':{'name':_0x8cccd1,'userProfileId':_0x4443fd['userProfileId']},'raw':!![]})[_0x5b0c('0x23')](function(_0x3a2750){if(_0x3a2750&&_0x3a2750[_0x5b0c('0x4f')]===0x0){return db['UserProfileResource'][_0x5b0c('0x4a')]({'name':_0x3557ae[_0x5b0c('0x2b')],'resourceId':_0x3557ae['id'],'type':_0x3a2750['name'],'sectionId':_0x3a2750['id']},{})[_0x5b0c('0x23')](function(){return _0x2c6309;});}else{return _0x2c6309;}})[_0x5b0c('0x46')](function(_0x414aae){logger[_0x5b0c('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x414aae);throw _0x414aae;});}return _0x2c6309;})[_0x5b0c('0x23')](respondWithResult(_0x375129,0xc9))[_0x5b0c('0x46')](handleError(_0x375129,null));};exports['update']=function(_0x4204ed,_0x387232){if(_0x4204ed[_0x5b0c('0x51')]['id']){delete _0x4204ed[_0x5b0c('0x51')]['id'];}return db['CmContactHasItem'][_0x5b0c('0x49')]({'where':{'id':_0x4204ed[_0x5b0c('0x52')]['id']}})[_0x5b0c('0x23')](handleEntityNotFound(_0x387232,null))[_0x5b0c('0x23')](saveUpdates(_0x4204ed[_0x5b0c('0x51')],null))[_0x5b0c('0x23')](respondWithResult(_0x387232,null))['catch'](handleError(_0x387232,null));};exports[_0x5b0c('0x24')]=function(_0x34d9f1,_0x11b8ff){return db[_0x5b0c('0x44')][_0x5b0c('0x49')]({'where':{'id':_0x34d9f1['params']['id']}})['then'](handleEntityNotFound(_0x11b8ff,null))[_0x5b0c('0x23')](removeEntity(_0x11b8ff,null))['catch'](handleError(_0x11b8ff,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 7ab78a1..4631687 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 _0x577b=['moment','request-promise','path','../../config/environment','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api'];(function(_0x114c09,_0x573192){var _0x501b05=function(_0x25a96b){while(--_0x25a96b){_0x114c09['push'](_0x114c09['shift']());}};_0x501b05(++_0x573192);}(_0x577b,0xa4));var _0xb577=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x577b[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0xb577('0x0'));var util=require(_0xb577('0x1'));var logger=require(_0xb577('0x2'))(_0xb577('0x3'));var moment=require(_0xb577('0x4'));var BPromise=require('bluebird');var rp=require(_0xb577('0x5'));var fs=require('fs');var path=require(_0xb577('0x6'));var rimraf=require('rimraf');var config=require(_0xb577('0x7'));var attributes=require('./cmContactHasItem.attributes');module[_0xb577('0x8')]=function(_0xdfa83f,_0x30d730){return _0xdfa83f[_0xb577('0x9')](_0xb577('0xa'),attributes,{'tableName':_0xb577('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4147=['../../config/logger','api','moment','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util'];(function(_0x39e2b1,_0x2d89c7){var _0x20672c=function(_0xcbcbcf){while(--_0xcbcbcf){_0x39e2b1['push'](_0x39e2b1['shift']());}};_0x20672c(++_0x2d89c7);}(_0x4147,0x1b8));var _0x7414=function(_0xc5c2e2,_0x246901){_0xc5c2e2=_0xc5c2e2-0x0;var _0x2ad80b=_0x4147[_0xc5c2e2];return _0x2ad80b;};'use strict';var _=require(_0x7414('0x0'));var util=require(_0x7414('0x1'));var logger=require(_0x7414('0x2'))(_0x7414('0x3'));var moment=require(_0x7414('0x4'));var BPromise=require('bluebird');var rp=require(_0x7414('0x5'));var fs=require('fs');var path=require(_0x7414('0x6'));var rimraf=require('rimraf');var config=require(_0x7414('0x7'));var attributes=require(_0x7414('0x8'));module[_0x7414('0x9')]=function(_0x3216af,_0xf46e64){return _0x3216af[_0x7414('0xa')](_0x7414('0xb'),attributes,{'tableName':_0x7414('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 2a18f8b..81157bc 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 _0x754b=['request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x754b,0x94));var _0xb754=function(_0x616fb8,_0x177e11){_0x616fb8=_0x616fb8-0x0;var _0x739e20=_0x754b[_0x616fb8];return _0x739e20;};'use strict';var _=require('lodash');var util=require(_0xb754('0x0'));var moment=require(_0xb754('0x1'));var BPromise=require(_0xb754('0x2'));var rs=require(_0xb754('0x3'));var fs=require('fs');var Redis=require(_0xb754('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb754('0x5'));var logger=require(_0xb754('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb754('0x7'));var client=jayson[_0xb754('0x8')][_0xb754('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a9bfc,_0x4f3ff1,_0x5f2b15){return new BPromise(function(_0x58e2a6,_0x54232b){return client[_0xb754('0xa')](_0x3a9bfc,_0x5f2b15)[_0xb754('0xb')](function(_0x88c2eb){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x4f3ff1,_0xb754('0xc'));logger[_0xb754('0xd')](_0xb754('0xe'),_0x4f3ff1,_0xb754('0xc'),JSON[_0xb754('0xf')](_0x88c2eb));if(_0x88c2eb[_0xb754('0x10')]){if(_0x88c2eb[_0xb754('0x10')][_0xb754('0x11')]===0x1f4){logger[_0xb754('0x10')](_0xb754('0x12'),_0x4f3ff1,_0x88c2eb[_0xb754('0x10')][_0xb754('0x13')]);return _0x54232b(_0x88c2eb[_0xb754('0x10')]['message']);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4f3ff1,_0x88c2eb[_0xb754('0x10')]['message']);return _0x58e2a6(_0x88c2eb[_0xb754('0x10')]['message']);}else{logger['info'](_0xb754('0x12'),_0x4f3ff1,_0xb754('0xc'));_0x58e2a6(_0x88c2eb['result'][_0xb754('0x13')]);}})['catch'](function(_0x34ab3d){logger[_0xb754('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x4f3ff1,_0x34ab3d);_0x54232b(_0x34ab3d);});});} \ No newline at end of file +var _0x1508=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x5b75ec,_0x2fe2ff){var _0x76ce6f=function(_0x303437){while(--_0x303437){_0x5b75ec['push'](_0x5b75ec['shift']());}};_0x76ce6f(++_0x2fe2ff);}(_0x1508,0xb1));var _0x8150=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1508[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8150('0x0'));var moment=require(_0x8150('0x1'));var BPromise=require(_0x8150('0x2'));var rs=require(_0x8150('0x3'));var fs=require('fs');var Redis=require(_0x8150('0x4'));var db=require(_0x8150('0x5'))['db'];var utils=require(_0x8150('0x6'));var logger=require(_0x8150('0x7'))(_0x8150('0x8'));var config=require('../../config/environment');var jayson=require(_0x8150('0x9'));var client=jayson[_0x8150('0xa')][_0x8150('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b8fe2,_0x752fb5,_0x3c75fa){return new BPromise(function(_0x1b801f,_0x56c0d9){return client['request'](_0x3b8fe2,_0x3c75fa)[_0x8150('0xc')](function(_0x521052){logger['info'](_0x8150('0xd'),_0x752fb5,_0x8150('0xe'));logger[_0x8150('0xf')](_0x8150('0x10'),_0x752fb5,'request\x20sent',JSON[_0x8150('0x11')](_0x521052));if(_0x521052[_0x8150('0x12')]){if(_0x521052['error']['code']===0x1f4){logger[_0x8150('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x752fb5,_0x521052['error'][_0x8150('0x13')]);return _0x56c0d9(_0x521052[_0x8150('0x12')][_0x8150('0x13')]);}logger[_0x8150('0x12')](_0x8150('0xd'),_0x752fb5,_0x521052[_0x8150('0x12')][_0x8150('0x13')]);return _0x1b801f(_0x521052['error']['message']);}else{logger[_0x8150('0x14')](_0x8150('0xd'),_0x752fb5,'request\x20sent');_0x1b801f(_0x521052['result'][_0x8150('0x13')]);}})[_0x8150('0x15')](function(_0x2643a5){logger[_0x8150('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x752fb5,_0x2643a5);_0x56c0d9(_0x2643a5);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 6bc1e97..822a881 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 _0xbb8e=['post','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','get','/:id','show'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0xbb8e,0x164));var _0xebb8=function(_0x242e38,_0x5433ca){_0x242e38=_0x242e38-0x0;var _0x58ce8d=_0xbb8e[_0x242e38];return _0x58ce8d;};'use strict';var multer=require(_0xebb8('0x0'));var util=require(_0xebb8('0x1'));var path=require(_0xebb8('0x2'));var timeout=require(_0xebb8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xebb8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xebb8('0x5'));var config=require(_0xebb8('0x6'));var controller=require(_0xebb8('0x7'));router['get']('/',auth[_0xebb8('0x8')](),controller['index']);router[_0xebb8('0x9')](_0xebb8('0xa'),auth[_0xebb8('0x8')](),controller[_0xebb8('0xb')]);router[_0xebb8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xebb8('0xa'),auth[_0xebb8('0x8')](),controller[_0xebb8('0xd')]);router[_0xebb8('0xe')](_0xebb8('0xa'),auth[_0xebb8('0x8')](),controller[_0xebb8('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2560=['put','update','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','/:id','isAuthenticated','post','create'];(function(_0x380168,_0x40546c){var _0x12e86d=function(_0x559ef7){while(--_0x559ef7){_0x380168['push'](_0x380168['shift']());}};_0x12e86d(++_0x40546c);}(_0x2560,0x104));var _0x0256=function(_0x250849,_0x2c8dc){_0x250849=_0x250849-0x0;var _0xf9a38c=_0x2560[_0x250849];return _0xf9a38c;};'use strict';var multer=require(_0x0256('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0256('0x1'));var router=express[_0x0256('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0256('0x3'));var interaction=require(_0x0256('0x4'));var config=require(_0x0256('0x5'));var controller=require(_0x0256('0x6'));router[_0x0256('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0256('0x7')](_0x0256('0x8'),auth[_0x0256('0x9')](),controller['show']);router[_0x0256('0xa')]('/',auth[_0x0256('0x9')](),controller[_0x0256('0xb')]);router[_0x0256('0xc')](_0x0256('0x8'),auth[_0x0256('0x9')](),controller[_0x0256('0xd')]);router['delete'](_0x0256('0x8'),auth[_0x0256('0x9')](),controller[_0x0256('0xe')]);module[_0x0256('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4bbdc84..5063f9c 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 _0x7e4a=['getDataValue','alias','STRING','name','TEXT','long','type','values','isArray','setDataValue','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL'];(function(_0x3607a3,_0x18b07b){var _0x2e8f5e=function(_0x30245b){while(--_0x30245b){_0x3607a3['push'](_0x3607a3['shift']());}};_0x2e8f5e(++_0x18b07b);}(_0x7e4a,0xea));var _0xa7e4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7e4a[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0xa7e4('0x0'));var _=require(_0xa7e4('0x1'));module[_0xa7e4('0x2')]={'name':{'type':Sequelize[_0xa7e4('0x3')],'get':function(_0x2073bb){return this[_0xa7e4('0x4')](_0xa7e4('0x5'));}},'alias':{'type':Sequelize[_0xa7e4('0x6')],'allowNull':![],'set':function(_0x949f2a){this['setDataValue']('alias',_0x949f2a?_0x949f2a:this[_0xa7e4('0x4')](_0xa7e4('0x7')));}},'type':{'type':Sequelize[_0xa7e4('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xa7e4('0x8')](_0xa7e4('0x9')),'get':function(){if(this[_0xa7e4('0x4')](_0xa7e4('0xa'))==='select'){return JSON['parse'](this[_0xa7e4('0x4')](_0xa7e4('0xb')));}else{return this['getDataValue']('values');}},'set':function(_0x444cfc){if(Array[_0xa7e4('0xc')](_0x444cfc)){this[_0xa7e4('0xd')]('values',JSON[_0xa7e4('0xe')](_0x444cfc));}else{this[_0xa7e4('0xd')](_0xa7e4('0xb'),_0x444cfc);}}},'required':{'type':Sequelize[_0xa7e4('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa7e4('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xa7e4('0x10'))}}; \ No newline at end of file +var _0xf158=['name','type','select','parse','values','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf158,0x1e8));var _0x8f15=function(_0x36f4d5,_0xabd719){_0x36f4d5=_0x36f4d5-0x0;var _0x4bb87d=_0xf158[_0x36f4d5];return _0x4bb87d;};'use strict';var Sequelize=require(_0x8f15('0x0'));var _=require(_0x8f15('0x1'));module[_0x8f15('0x2')]={'name':{'type':Sequelize[_0x8f15('0x3')],'get':function(_0x112a4e){return this[_0x8f15('0x4')](_0x8f15('0x5'));}},'alias':{'type':Sequelize[_0x8f15('0x6')],'allowNull':![],'set':function(_0x142354){this[_0x8f15('0x7')](_0x8f15('0x5'),_0x142354?_0x142354:this['getDataValue'](_0x8f15('0x8')));}},'type':{'type':Sequelize[_0x8f15('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this['getDataValue'](_0x8f15('0x9'))===_0x8f15('0xa')){return JSON[_0x8f15('0xb')](this[_0x8f15('0x4')]('values'));}else{return this[_0x8f15('0x4')](_0x8f15('0xc'));}},'set':function(_0x34dc17){if(Array['isArray'](_0x34dc17)){this[_0x8f15('0x7')](_0x8f15('0xc'),JSON[_0x8f15('0xd')](_0x34dc17));}else{this[_0x8f15('0x7')](_0x8f15('0xc'),_0x34dc17);}}},'required':{'type':Sequelize[_0x8f15('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8f15('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x8f15('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 547394e..cff96cf 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 _0x3808=['addColumn','format','cf_%d','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','reject','save','update','then','destroy','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','keys','include','body','find','params','sequelize','create','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN'];(function(_0x1e5d84,_0x4de4b7){var _0x2b602f=function(_0x2d06ee){while(--_0x2d06ee){_0x1e5d84['push'](_0x1e5d84['shift']());}};_0x2b602f(++_0x4de4b7);}(_0x3808,0x1a2));var _0x8380=function(_0x9090bb,_0x120d1f){_0x9090bb=_0x9090bb-0x0;var _0x229b07=_0x3808[_0x9090bb];return _0x229b07;};'use strict';var emlformat=require(_0x8380('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8380('0x1'));var jsonpatch=require(_0x8380('0x2'));var rp=require('request-promise');var moment=require(_0x8380('0x3'));var BPromise=require(_0x8380('0x4'));var Mustache=require(_0x8380('0x5'));var util=require(_0x8380('0x6'));var path=require(_0x8380('0x7'));var sox=require(_0x8380('0x8'));var csv=require(_0x8380('0x9'));var ejs=require(_0x8380('0xa'));var fs=require('fs');var fs_extra=require(_0x8380('0xb'));var _=require('lodash');var squel=require(_0x8380('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8380('0xd'));var toCsv=require(_0x8380('0x9'));var querystring=require(_0x8380('0xe'));var Papa=require(_0x8380('0xf'));var Redis=require(_0x8380('0x10'));var authService=require(_0x8380('0x11'));var qs=require(_0x8380('0x12'));var as=require(_0x8380('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8380('0x14'))('api');var utils=require(_0x8380('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8380('0x16'));var db=require(_0x8380('0x17'))['db'];function respondWithStatusCode(_0x371412,_0xcc5711){_0xcc5711=_0xcc5711||0xcc;return function(_0x4c7d38){if(_0x4c7d38){return _0x371412[_0x8380('0x18')](_0xcc5711);}return _0x371412['status'](_0xcc5711)[_0x8380('0x19')]();};}function respondWithResult(_0x5c466b,_0x557c65){_0x557c65=_0x557c65||0xc8;return function(_0x177b62){if(_0x177b62){return _0x5c466b[_0x8380('0x1a')](_0x557c65)[_0x8380('0x1b')](_0x177b62);}};}function respondWithFilteredResult(_0x3ae137,_0x14d150){return function(_0x489d71){if(_0x489d71){var _0x2273f2=typeof _0x14d150[_0x8380('0x1c')]===_0x8380('0x1d')&&typeof _0x14d150['limit']===_0x8380('0x1d');var _0x22ccda=_0x489d71[_0x8380('0x1e')];var _0x562e1f=_0x2273f2?0x0:_0x14d150[_0x8380('0x1c')];var _0x99aca3=_0x2273f2?_0x489d71[_0x8380('0x1e')]:_0x14d150[_0x8380('0x1c')]+_0x14d150[_0x8380('0x1f')];var _0x13709a;if(_0x99aca3>=_0x22ccda){_0x99aca3=_0x22ccda;_0x13709a=0xc8;}else{_0x13709a=0xce;}_0x3ae137[_0x8380('0x1a')](_0x13709a);return _0x3ae137['set']('Content-Range',_0x562e1f+'-'+_0x99aca3+'/'+_0x22ccda)['json'](_0x489d71);}return null;};}function patchUpdates(_0x19f3f0){return function(_0x4537ee){try{jsonpatch['apply'](_0x4537ee,_0x19f3f0,!![]);}catch(_0x39b81a){return BPromise[_0x8380('0x20')](_0x39b81a);}return _0x4537ee[_0x8380('0x21')]();};}function saveUpdates(_0x1ced0c,_0x33eccb){return function(_0x9cf3a1){if(_0x9cf3a1){return _0x9cf3a1[_0x8380('0x22')](_0x1ced0c)[_0x8380('0x23')](function(_0x220e6e){return _0x220e6e;});}return null;};}function removeEntity(_0x3ddff3,_0x1b486f){return function(_0x20475a){if(_0x20475a){return _0x20475a[_0x8380('0x24')]()['then'](function(){_0x3ddff3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a50cb,_0x1a64f2){return function(_0x6861dd){if(!_0x6861dd){_0x4a50cb[_0x8380('0x18')](0x194);}return _0x6861dd;};}function handleError(_0x4294cb,_0x5227b0){_0x5227b0=_0x5227b0||0x1f4;return function(_0xa46b05){logger['error'](_0xa46b05[_0x8380('0x25')]);if(_0xa46b05[_0x8380('0x26')]){delete _0xa46b05[_0x8380('0x26')];}_0x4294cb['status'](_0x5227b0)[_0x8380('0x27')](_0xa46b05);};}exports[_0x8380('0x28')]=function(_0x44022c,_0x42c5b8){var _0x4835b1={},_0x8a0b3c={},_0x313eff={'count':0x0,'rows':[]};var _0x2c1802=_[_0x8380('0x29')](db[_0x8380('0x2a')][_0x8380('0x2b')],function(_0x296129){return{'name':_0x296129[_0x8380('0x2c')],'type':_0x296129[_0x8380('0x2d')][_0x8380('0x2e')]};});_0x8a0b3c[_0x8380('0x2f')]=_[_0x8380('0x30')](_[_0x8380('0x29')](_0x2c1802,_0x8380('0x26')),[_0x8380('0x26')]);_0x8a0b3c[_0x8380('0x31')]=_['keys'](_0x44022c[_0x8380('0x31')]);_0x8a0b3c[_0x8380('0x32')]=_[_0x8380('0x33')](_0x8a0b3c['model'],_0x8a0b3c[_0x8380('0x31')]);_0x4835b1['attributes']=_[_0x8380('0x33')](_0x8a0b3c[_0x8380('0x2f')],qs[_0x8380('0x34')](_0x44022c[_0x8380('0x31')][_0x8380('0x34')]));_0x4835b1['attributes']=_0x4835b1[_0x8380('0x35')][_0x8380('0x36')]?_0x4835b1[_0x8380('0x35')]:_0x8a0b3c['model'];if(!_0x44022c[_0x8380('0x31')]['hasOwnProperty'](_0x8380('0x37'))){_0x4835b1[_0x8380('0x1f')]=qs[_0x8380('0x1f')](_0x44022c[_0x8380('0x31')]['limit']);_0x4835b1[_0x8380('0x1c')]=qs[_0x8380('0x1c')](_0x44022c[_0x8380('0x31')]['offset']);}_0x4835b1[_0x8380('0x38')]=qs['sort'](_0x44022c['query'][_0x8380('0x39')]);_0x4835b1['where']=qs[_0x8380('0x32')](_[_0x8380('0x3a')](_0x44022c[_0x8380('0x31')],_0x8a0b3c[_0x8380('0x32')]),_0x2c1802);if(_0x44022c[_0x8380('0x31')][_0x8380('0x3b')]){_0x4835b1[_0x8380('0x3c')]=_[_0x8380('0x3d')](_0x4835b1['where'],{'$or':_['map'](_0x2c1802,function(_0x41aa1a){if(_0x41aa1a['type']!==_0x8380('0x3e')){var _0x56dba6={};_0x56dba6[_0x41aa1a[_0x8380('0x26')]]={'$like':'%'+_0x44022c['query'][_0x8380('0x3b')]+'%'};return _0x56dba6;}})});}_0x4835b1=_[_0x8380('0x3d')]({},_0x4835b1,_0x44022c['options']);var _0x2ee43a={'where':_0x4835b1[_0x8380('0x3c')]};return db[_0x8380('0x2a')][_0x8380('0x1e')](_0x2ee43a)[_0x8380('0x23')](function(_0x514599){_0x313eff['count']=_0x514599;if(_0x44022c[_0x8380('0x31')][_0x8380('0x3f')]){_0x4835b1['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x4835b1);})['then'](function(_0x2b09d5){_0x313eff[_0x8380('0x40')]=_0x2b09d5;return _0x313eff;})[_0x8380('0x23')](respondWithFilteredResult(_0x42c5b8,_0x4835b1))[_0x8380('0x41')](handleError(_0x42c5b8,null));};exports[_0x8380('0x42')]=function(_0x352058,_0x1288c3){var _0x37a0d1={'raw':!![],'where':{'id':_0x352058['params']['id']}},_0x29d11d={};_0x29d11d[_0x8380('0x2f')]=_['keys'](db[_0x8380('0x2a')][_0x8380('0x2b')]);_0x29d11d[_0x8380('0x31')]=_[_0x8380('0x43')](_0x352058['query']);_0x29d11d['filters']=_['intersection'](_0x29d11d['model'],_0x29d11d[_0x8380('0x31')]);_0x37a0d1[_0x8380('0x35')]=_[_0x8380('0x33')](_0x29d11d['model'],qs[_0x8380('0x34')](_0x352058[_0x8380('0x31')]['fields']));_0x37a0d1[_0x8380('0x35')]=_0x37a0d1['attributes'][_0x8380('0x36')]?_0x37a0d1[_0x8380('0x35')]:_0x29d11d[_0x8380('0x2f')];if(_0x352058[_0x8380('0x31')]['includeAll']){_0x37a0d1[_0x8380('0x44')]=[{'all':!![]}];}_0x37a0d1=_[_0x8380('0x3d')]({},_0x37a0d1,_0x352058['options']);return db[_0x8380('0x2a')]['find'](_0x37a0d1)['then'](handleEntityNotFound(_0x1288c3,null))[_0x8380('0x23')](respondWithResult(_0x1288c3,null))[_0x8380('0x41')](handleError(_0x1288c3,null));};exports[_0x8380('0x22')]=function(_0x2c896d,_0x3d4481){if(_0x2c896d['body']['id']){delete _0x2c896d[_0x8380('0x45')]['id'];}return db[_0x8380('0x2a')][_0x8380('0x46')]({'where':{'id':_0x2c896d[_0x8380('0x47')]['id']}})[_0x8380('0x23')](handleEntityNotFound(_0x3d4481,null))[_0x8380('0x23')](saveUpdates(_0x2c896d['body'],null))[_0x8380('0x23')](respondWithResult(_0x3d4481,null))[_0x8380('0x41')](handleError(_0x3d4481,null));};exports[_0x8380('0x24')]=function(_0x3c83eb,_0x25e88a){return db['CmCustomField'][_0x8380('0x46')]({'where':{'id':_0x3c83eb['params']['id']}})[_0x8380('0x23')](handleEntityNotFound(_0x25e88a,null))['then'](removeEntity(_0x25e88a,null))[_0x8380('0x41')](handleError(_0x25e88a,null));};exports['create']=function(_0x14de2e,_0xe8cfcc){var _0x11555d;return db[_0x8380('0x48')]['transaction'](function(_0x5a0385){return db[_0x8380('0x2a')][_0x8380('0x49')](_0x14de2e[_0x8380('0x45')],{'transaction':_0x5a0385})[_0x8380('0x23')](function(_0x5cde94){_0x11555d=_0x5cde94;var _0x35a8b3={'type':db[_0x8380('0x4a')]['TEXT'],'transaction':_0x5a0385};switch(_0x14de2e[_0x8380('0x45')][_0x8380('0x2d')]){case _0x8380('0x4b'):_0x35a8b3['type']=db[_0x8380('0x4a')][_0x8380('0x4c')];break;case'number':_0x35a8b3[_0x8380('0x2d')]=db['Sequelize'][_0x8380('0x4d')];break;case _0x8380('0x4e'):_0x35a8b3['type']=db[_0x8380('0x4a')][_0x8380('0x4f')];_0x35a8b3['defaultValue']=![];break;default:}return db[_0x8380('0x48')]['queryInterface'][_0x8380('0x50')]('cm_contacts',util[_0x8380('0x51')](_0x8380('0x52'),_0x11555d['id']),_0x35a8b3);})[_0x8380('0x23')](function(){return _0x11555d;});})['then'](respondWithResult(_0xe8cfcc,0xc9))[_0x8380('0x41')](handleError(_0xe8cfcc,null));}; \ No newline at end of file +var _0x361a=['fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','error','stack','send','map','CmCustomField','fieldName','type','key','model','differenceBy','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x98197,_0xea7356){var _0x5d9199=function(_0x135375){while(--_0x135375){_0x98197['push'](_0x98197['shift']());}};_0x5d9199(++_0xea7356);}(_0x361a,0x102));var _0xa361=function(_0xb1235c,_0x20af79){_0xb1235c=_0xb1235c-0x0;var _0x236917=_0x361a[_0xb1235c];return _0x236917;};'use strict';var emlformat=require(_0xa361('0x0'));var rimraf=require(_0xa361('0x1'));var zipdir=require(_0xa361('0x2'));var jsonpatch=require(_0xa361('0x3'));var rp=require('request-promise');var moment=require(_0xa361('0x4'));var BPromise=require(_0xa361('0x5'));var Mustache=require(_0xa361('0x6'));var util=require(_0xa361('0x7'));var path=require(_0xa361('0x8'));var sox=require(_0xa361('0x9'));var csv=require(_0xa361('0xa'));var ejs=require(_0xa361('0xb'));var fs=require('fs');var fs_extra=require(_0xa361('0xc'));var _=require('lodash');var squel=require(_0xa361('0xd'));var crypto=require(_0xa361('0xe'));var jsforce=require(_0xa361('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa361('0xa'));var querystring=require(_0xa361('0x10'));var Papa=require(_0xa361('0x11'));var Redis=require(_0xa361('0x12'));var authService=require(_0xa361('0x13'));var qs=require(_0xa361('0x14'));var as=require(_0xa361('0x15'));var hardwareService=require(_0xa361('0x16'));var logger=require('../../config/logger')(_0xa361('0x17'));var utils=require(_0xa361('0x18'));var config=require(_0xa361('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa361('0x1a'))['db'];function respondWithStatusCode(_0x2e1428,_0x2d4a55){_0x2d4a55=_0x2d4a55||0xcc;return function(_0x7a028b){if(_0x7a028b){return _0x2e1428[_0xa361('0x1b')](_0x2d4a55);}return _0x2e1428[_0xa361('0x1c')](_0x2d4a55)[_0xa361('0x1d')]();};}function respondWithResult(_0x11fcb7,_0x49ab7a){_0x49ab7a=_0x49ab7a||0xc8;return function(_0x11166e){if(_0x11166e){return _0x11fcb7['status'](_0x49ab7a)[_0xa361('0x1e')](_0x11166e);}};}function respondWithFilteredResult(_0x502c3d,_0x26f7e6){return function(_0x17fbc4){if(_0x17fbc4){var _0x293f14=typeof _0x26f7e6[_0xa361('0x1f')]==='undefined'&&typeof _0x26f7e6[_0xa361('0x20')]===_0xa361('0x21');var _0x5ef3fc=_0x17fbc4[_0xa361('0x22')];var _0x432faa=_0x293f14?0x0:_0x26f7e6[_0xa361('0x1f')];var _0x3989a7=_0x293f14?_0x17fbc4[_0xa361('0x22')]:_0x26f7e6[_0xa361('0x1f')]+_0x26f7e6[_0xa361('0x20')];var _0x204884;if(_0x3989a7>=_0x5ef3fc){_0x3989a7=_0x5ef3fc;_0x204884=0xc8;}else{_0x204884=0xce;}_0x502c3d[_0xa361('0x1c')](_0x204884);return _0x502c3d[_0xa361('0x23')]('Content-Range',_0x432faa+'-'+_0x3989a7+'/'+_0x5ef3fc)['json'](_0x17fbc4);}return null;};}function patchUpdates(_0x566e82){return function(_0x258a3d){try{jsonpatch[_0xa361('0x24')](_0x258a3d,_0x566e82,!![]);}catch(_0x35c9a4){return BPromise[_0xa361('0x25')](_0x35c9a4);}return _0x258a3d[_0xa361('0x26')]();};}function saveUpdates(_0x1daf54,_0x174b4f){return function(_0x466520){if(_0x466520){return _0x466520['update'](_0x1daf54)['then'](function(_0x3b41e0){return _0x3b41e0;});}return null;};}function removeEntity(_0x2dfc9e,_0x3ef3b2){return function(_0x1a98d3){if(_0x1a98d3){return _0x1a98d3[_0xa361('0x27')]()[_0xa361('0x28')](function(){_0x2dfc9e['status'](0xcc)[_0xa361('0x1d')]();});}};}function handleEntityNotFound(_0x112ae5,_0x4c6421){return function(_0x3bef86){if(!_0x3bef86){_0x112ae5[_0xa361('0x1b')](0x194);}return _0x3bef86;};}function handleError(_0x17b803,_0x37c825){_0x37c825=_0x37c825||0x1f4;return function(_0x3a2e21){logger[_0xa361('0x29')](_0x3a2e21[_0xa361('0x2a')]);if(_0x3a2e21['name']){delete _0x3a2e21['name'];}_0x17b803[_0xa361('0x1c')](_0x37c825)[_0xa361('0x2b')](_0x3a2e21);};}exports['index']=function(_0x239845,_0x32db6b){var _0xe0ee9e={},_0x28fcb2={},_0x2154c9={'count':0x0,'rows':[]};var _0x47ca65=_[_0xa361('0x2c')](db[_0xa361('0x2d')]['rawAttributes'],function(_0x3f3f48){return{'name':_0x3f3f48[_0xa361('0x2e')],'type':_0x3f3f48[_0xa361('0x2f')][_0xa361('0x30')]};});_0x28fcb2[_0xa361('0x31')]=_[_0xa361('0x32')](_['map'](_0x47ca65,_0xa361('0x33')),[_0xa361('0x33')]);_0x28fcb2['query']=_[_0xa361('0x34')](_0x239845[_0xa361('0x35')]);_0x28fcb2[_0xa361('0x36')]=_[_0xa361('0x37')](_0x28fcb2[_0xa361('0x31')],_0x28fcb2[_0xa361('0x35')]);_0xe0ee9e['attributes']=_[_0xa361('0x37')](_0x28fcb2['model'],qs[_0xa361('0x38')](_0x239845[_0xa361('0x35')]['fields']));_0xe0ee9e[_0xa361('0x39')]=_0xe0ee9e[_0xa361('0x39')][_0xa361('0x3a')]?_0xe0ee9e[_0xa361('0x39')]:_0x28fcb2[_0xa361('0x31')];if(!_0x239845[_0xa361('0x35')][_0xa361('0x3b')](_0xa361('0x3c'))){_0xe0ee9e[_0xa361('0x20')]=qs[_0xa361('0x20')](_0x239845[_0xa361('0x35')][_0xa361('0x20')]);_0xe0ee9e[_0xa361('0x1f')]=qs[_0xa361('0x1f')](_0x239845[_0xa361('0x35')][_0xa361('0x1f')]);}_0xe0ee9e[_0xa361('0x3d')]=qs[_0xa361('0x3e')](_0x239845[_0xa361('0x35')]['sort']);_0xe0ee9e[_0xa361('0x3f')]=qs[_0xa361('0x36')](_['pick'](_0x239845[_0xa361('0x35')],_0x28fcb2[_0xa361('0x36')]),_0x47ca65);if(_0x239845[_0xa361('0x35')][_0xa361('0x40')]){_0xe0ee9e['where']=_[_0xa361('0x41')](_0xe0ee9e[_0xa361('0x3f')],{'$or':_[_0xa361('0x2c')](_0x47ca65,function(_0x30037c){if(_0x30037c[_0xa361('0x2f')]!=='VIRTUAL'){var _0x5df5d5={};_0x5df5d5[_0x30037c[_0xa361('0x33')]]={'$like':'%'+_0x239845[_0xa361('0x35')][_0xa361('0x40')]+'%'};return _0x5df5d5;}})});}_0xe0ee9e=_[_0xa361('0x41')]({},_0xe0ee9e,_0x239845[_0xa361('0x42')]);var _0x3f0328={'where':_0xe0ee9e[_0xa361('0x3f')]};return db[_0xa361('0x2d')][_0xa361('0x22')](_0x3f0328)[_0xa361('0x28')](function(_0x56157a){_0x2154c9['count']=_0x56157a;if(_0x239845['query'][_0xa361('0x43')]){_0xe0ee9e[_0xa361('0x44')]=[{'all':!![]}];}return db['CmCustomField'][_0xa361('0x45')](_0xe0ee9e);})['then'](function(_0x27ddbd){_0x2154c9['rows']=_0x27ddbd;return _0x2154c9;})['then'](respondWithFilteredResult(_0x32db6b,_0xe0ee9e))[_0xa361('0x46')](handleError(_0x32db6b,null));};exports[_0xa361('0x47')]=function(_0x4b26af,_0xa462f9){var _0x4db2cc={'raw':!![],'where':{'id':_0x4b26af[_0xa361('0x48')]['id']}},_0x3141d6={};_0x3141d6['model']=_[_0xa361('0x34')](db[_0xa361('0x2d')][_0xa361('0x49')]);_0x3141d6[_0xa361('0x35')]=_[_0xa361('0x34')](_0x4b26af[_0xa361('0x35')]);_0x3141d6[_0xa361('0x36')]=_[_0xa361('0x37')](_0x3141d6[_0xa361('0x31')],_0x3141d6[_0xa361('0x35')]);_0x4db2cc[_0xa361('0x39')]=_[_0xa361('0x37')](_0x3141d6[_0xa361('0x31')],qs['fields'](_0x4b26af[_0xa361('0x35')][_0xa361('0x38')]));_0x4db2cc['attributes']=_0x4db2cc[_0xa361('0x39')][_0xa361('0x3a')]?_0x4db2cc[_0xa361('0x39')]:_0x3141d6['model'];if(_0x4b26af['query'][_0xa361('0x43')]){_0x4db2cc[_0xa361('0x44')]=[{'all':!![]}];}_0x4db2cc=_[_0xa361('0x41')]({},_0x4db2cc,_0x4b26af[_0xa361('0x42')]);return db[_0xa361('0x2d')][_0xa361('0x4a')](_0x4db2cc)['then'](handleEntityNotFound(_0xa462f9,null))[_0xa361('0x28')](respondWithResult(_0xa462f9,null))[_0xa361('0x46')](handleError(_0xa462f9,null));};exports['update']=function(_0x333c3d,_0x18c6c5){if(_0x333c3d[_0xa361('0x4b')]['id']){delete _0x333c3d[_0xa361('0x4b')]['id'];}return db[_0xa361('0x2d')][_0xa361('0x4a')]({'where':{'id':_0x333c3d[_0xa361('0x48')]['id']}})[_0xa361('0x28')](handleEntityNotFound(_0x18c6c5,null))[_0xa361('0x28')](saveUpdates(_0x333c3d[_0xa361('0x4b')],null))['then'](respondWithResult(_0x18c6c5,null))[_0xa361('0x46')](handleError(_0x18c6c5,null));};exports[_0xa361('0x27')]=function(_0x2538c1,_0x1b90be){return db[_0xa361('0x2d')][_0xa361('0x4a')]({'where':{'id':_0x2538c1[_0xa361('0x48')]['id']}})[_0xa361('0x28')](handleEntityNotFound(_0x1b90be,null))[_0xa361('0x28')](removeEntity(_0x1b90be,null))[_0xa361('0x46')](handleError(_0x1b90be,null));};exports[_0xa361('0x4c')]=function(_0x1e3a31,_0x236756){var _0x266e0f;return db[_0xa361('0x4d')][_0xa361('0x4e')](function(_0x5265fc){return db[_0xa361('0x2d')][_0xa361('0x4c')](_0x1e3a31[_0xa361('0x4b')],{'transaction':_0x5265fc})[_0xa361('0x28')](function(_0x231f85){_0x266e0f=_0x231f85;var _0xa86724={'type':db[_0xa361('0x4f')][_0xa361('0x50')],'transaction':_0x5265fc};switch(_0x1e3a31[_0xa361('0x4b')][_0xa361('0x2f')]){case'text':_0xa86724['type']=db[_0xa361('0x4f')][_0xa361('0x50')];break;case _0xa361('0x51'):_0xa86724[_0xa361('0x2f')]=db[_0xa361('0x4f')][_0xa361('0x52')];break;case _0xa361('0x53'):_0xa86724['type']=db['Sequelize'][_0xa361('0x54')];_0xa86724[_0xa361('0x55')]=![];break;default:}return db[_0xa361('0x4d')][_0xa361('0x56')][_0xa361('0x57')](_0xa361('0x58'),util['format'](_0xa361('0x59'),_0x266e0f['id']),_0xa86724);})[_0xa361('0x28')](function(){return _0x266e0f;});})['then'](respondWithResult(_0x236756,0xc9))[_0xa361('0x46')](handleError(_0x236756,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8ea6604..26f1388 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 _0xde50=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','cm_custom_fields','util','../../config/logger','api','moment'];(function(_0x2ad32d,_0x3c5689){var _0x52a37e=function(_0x3c9cfa){while(--_0x3c9cfa){_0x2ad32d['push'](_0x2ad32d['shift']());}};_0x52a37e(++_0x3c5689);}(_0xde50,0xcd));var _0x0de5=function(_0x5c9d9e,_0x5ee2bf){_0x5c9d9e=_0x5c9d9e-0x0;var _0x31ddf8=_0xde50[_0x5c9d9e];return _0x31ddf8;};'use strict';var _=require('lodash');var util=require(_0x0de5('0x0'));var logger=require(_0x0de5('0x1'))(_0x0de5('0x2'));var moment=require(_0x0de5('0x3'));var BPromise=require(_0x0de5('0x4'));var rp=require(_0x0de5('0x5'));var fs=require('fs');var path=require(_0x0de5('0x6'));var rimraf=require(_0x0de5('0x7'));var config=require(_0x0de5('0x8'));var attributes=require(_0x0de5('0x9'));module['exports']=function(_0x51dad4,_0xff10ed){return _0x51dad4['define']('CmCustomField',attributes,{'tableName':_0x0de5('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3687=['CmCustomField','cm_custom_fields','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x43fd9e,_0x44804d){var _0x468a23=function(_0x119a12){while(--_0x119a12){_0x43fd9e['push'](_0x43fd9e['shift']());}};_0x468a23(++_0x44804d);}(_0x3687,0xa4));var _0x7368=function(_0x25aac1,_0x31e4c6){_0x25aac1=_0x25aac1-0x0;var _0x3c75ba=_0x3687[_0x25aac1];return _0x3c75ba;};'use strict';var _=require('lodash');var util=require(_0x7368('0x0'));var logger=require('../../config/logger')(_0x7368('0x1'));var moment=require(_0x7368('0x2'));var BPromise=require('bluebird');var rp=require(_0x7368('0x3'));var fs=require('fs');var path=require(_0x7368('0x4'));var rimraf=require('rimraf');var config=require(_0x7368('0x5'));var attributes=require('./cmCustomField.attributes');module[_0x7368('0x6')]=function(_0x49ede2,_0x41a479){return _0x49ede2['define'](_0x7368('0x7'),attributes,{'tableName':_0x7368('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index a0aee55..510d76f 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 _0x2979=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x338b8d,_0x36a3d4){var _0x4a2ccb=function(_0x531e44){while(--_0x531e44){_0x338b8d['push'](_0x338b8d['shift']());}};_0x4a2ccb(++_0x36a3d4);}(_0x2979,0x88));var _0x9297=function(_0x2199f1,_0x10c734){_0x2199f1=_0x2199f1-0x0;var _0x43436b=_0x2979[_0x2199f1];return _0x43436b;};'use strict';var _=require(_0x9297('0x0'));var util=require(_0x9297('0x1'));var moment=require('moment');var BPromise=require(_0x9297('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9297('0x3'));var db=require(_0x9297('0x4'))['db'];var utils=require(_0x9297('0x5'));var logger=require(_0x9297('0x6'))('rpc');var config=require(_0x9297('0x7'));var jayson=require(_0x9297('0x8'));var client=jayson[_0x9297('0x9')][_0x9297('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b5b38,_0x58d4bb,_0x199b25){return new BPromise(function(_0x2722ce,_0x44de96){return client[_0x9297('0xb')](_0x9b5b38,_0x199b25)['then'](function(_0x171b85){logger[_0x9297('0xc')]('CmCustomField,\x20%s,\x20%s',_0x58d4bb,_0x9297('0xd'));logger[_0x9297('0xe')](_0x9297('0xf'),_0x58d4bb,_0x9297('0xd'),JSON[_0x9297('0x10')](_0x171b85));if(_0x171b85[_0x9297('0x11')]){if(_0x171b85[_0x9297('0x11')][_0x9297('0x12')]===0x1f4){logger[_0x9297('0x11')](_0x9297('0x13'),_0x58d4bb,_0x171b85[_0x9297('0x11')]['message']);return _0x44de96(_0x171b85[_0x9297('0x11')]['message']);}logger[_0x9297('0x11')](_0x9297('0x13'),_0x58d4bb,_0x171b85['error']['message']);return _0x2722ce(_0x171b85[_0x9297('0x11')][_0x9297('0x14')]);}else{logger[_0x9297('0xc')]('CmCustomField,\x20%s,\x20%s',_0x58d4bb,'request\x20sent');_0x2722ce(_0x171b85[_0x9297('0x15')][_0x9297('0x14')]);}})[_0x9297('0x16')](function(_0x106733){logger['error']('CmCustomField,\x20%s,\x20%s',_0x58d4bb,_0x106733);_0x44de96(_0x106733);});});} \ No newline at end of file +var _0xf80f=['error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x215c7f,_0x445791){var _0x5e0d70=function(_0x998e7a){while(--_0x998e7a){_0x215c7f['push'](_0x215c7f['shift']());}};_0x5e0d70(++_0x445791);}(_0xf80f,0x196));var _0xff80=function(_0x32fc0c,_0x520834){_0x32fc0c=_0x32fc0c-0x0;var _0x229503=_0xf80f[_0x32fc0c];return _0x229503;};'use strict';var _=require(_0xff80('0x0'));var util=require(_0xff80('0x1'));var moment=require(_0xff80('0x2'));var BPromise=require('bluebird');var rs=require(_0xff80('0x3'));var fs=require('fs');var Redis=require(_0xff80('0x4'));var db=require(_0xff80('0x5'))['db'];var utils=require(_0xff80('0x6'));var logger=require(_0xff80('0x7'))(_0xff80('0x8'));var config=require(_0xff80('0x9'));var jayson=require(_0xff80('0xa'));var client=jayson[_0xff80('0xb')][_0xff80('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11ad9f,_0x11186e,_0x15d47b){return new BPromise(function(_0x320222,_0xfdfca1){return client['request'](_0x11ad9f,_0x15d47b)[_0xff80('0xd')](function(_0x487e06){logger[_0xff80('0xe')]('CmCustomField,\x20%s,\x20%s',_0x11186e,_0xff80('0xf'));logger[_0xff80('0x10')](_0xff80('0x11'),_0x11186e,'request\x20sent',JSON[_0xff80('0x12')](_0x487e06));if(_0x487e06[_0xff80('0x13')]){if(_0x487e06[_0xff80('0x13')][_0xff80('0x14')]===0x1f4){logger[_0xff80('0x13')](_0xff80('0x15'),_0x11186e,_0x487e06[_0xff80('0x13')][_0xff80('0x16')]);return _0xfdfca1(_0x487e06[_0xff80('0x13')][_0xff80('0x16')]);}logger[_0xff80('0x13')]('CmCustomField,\x20%s,\x20%s',_0x11186e,_0x487e06[_0xff80('0x13')][_0xff80('0x16')]);return _0x320222(_0x487e06[_0xff80('0x13')][_0xff80('0x16')]);}else{logger[_0xff80('0xe')](_0xff80('0x15'),_0x11186e,_0xff80('0xf'));_0x320222(_0x487e06[_0xff80('0x17')][_0xff80('0x16')]);}})[_0xff80('0x18')](function(_0x330b26){logger['error'](_0xff80('0x15'),_0x11186e,_0x330b26);_0xfdfca1(_0x330b26);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6adfac1..057253d 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 _0xe57d=['get','show','create','put','delete','/:id','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index'];(function(_0x3518b6,_0x1d6005){var _0x55a221=function(_0x25ebfa){while(--_0x25ebfa){_0x3518b6['push'](_0x3518b6['shift']());}};_0x55a221(++_0x1d6005);}(_0xe57d,0xd7));var _0xde57=function(_0x182648,_0x2a7b01){_0x182648=_0x182648-0x0;var _0x10d106=_0xe57d[_0x182648];return _0x10d106;};'use strict';var multer=require(_0xde57('0x0'));var util=require('util');var path=require(_0xde57('0x1'));var timeout=require(_0xde57('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde57('0x3'));var auth=require(_0xde57('0x4'));var interaction=require(_0xde57('0x5'));var config=require('../../config/environment');var controller=require(_0xde57('0x6'));router['get']('/',auth[_0xde57('0x7')](),controller[_0xde57('0x8')]);router[_0xde57('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xde57('0xa')]);router['post']('/',auth[_0xde57('0x7')](),controller[_0xde57('0xb')]);router[_0xde57('0xc')]('/:id',auth[_0xde57('0x7')](),controller['update']);router[_0xde57('0xd')](_0xde57('0xe'),auth[_0xde57('0x7')](),controller[_0xde57('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6d19=['../../config/environment','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x46a53b,_0x2fd0c2){var _0x200ef5=function(_0x3debc6){while(--_0x3debc6){_0x46a53b['push'](_0x46a53b['shift']());}};_0x200ef5(++_0x2fd0c2);}(_0x6d19,0x160));var _0x96d1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6d19[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x96d1('0x0'));var util=require(_0x96d1('0x1'));var path=require(_0x96d1('0x2'));var timeout=require(_0x96d1('0x3'));var express=require(_0x96d1('0x4'));var router=express[_0x96d1('0x5')]();var fs_extra=require(_0x96d1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x96d1('0x7'));var config=require(_0x96d1('0x8'));var controller=require(_0x96d1('0x9'));router[_0x96d1('0xa')]('/',auth['isAuthenticated'](),controller[_0x96d1('0xb')]);router[_0x96d1('0xa')](_0x96d1('0xc'),auth['isAuthenticated'](),controller[_0x96d1('0xd')]);router[_0x96d1('0xe')]('/',auth[_0x96d1('0xf')](),controller[_0x96d1('0x10')]);router[_0x96d1('0x11')](_0x96d1('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x96d1('0x12')](_0x96d1('0xc'),auth['isAuthenticated'](),controller[_0x96d1('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 2a500ce..6e4b44d 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 _0x61ae=['contactListQueue','DATE','moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x4bb0de,_0x33057c){var _0xd8649=function(_0x493365){while(--_0x493365){_0x4bb0de['push'](_0x4bb0de['shift']());}};_0xd8649(++_0x33057c);}(_0x61ae,0x7b));var _0xe61a=function(_0x27fa65,_0x4e02ee){_0x27fa65=_0x27fa65-0x0;var _0x456594=_0x61ae[_0x27fa65];return _0x456594;};'use strict';var moment=require(_0xe61a('0x0'));var Sequelize=require(_0xe61a('0x1'));module[_0xe61a('0x2')]={'phone':{'type':Sequelize[_0xe61a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xe61a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xe61a('0x5')](_0xe61a('0x6'))},'countbusyretry':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe61a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe61a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xe61a('0x7')](0x2)[_0xe61a('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe61a('0x7')],'unique':_0xe61a('0x9')},'ListId':{'type':Sequelize[_0xe61a('0x7')],'unique':_0xe61a('0x9')},'UserId':{'type':Sequelize[_0xe61a('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xe61a('0x7')],'unique':_0xe61a('0x9')},'CampaignId':{'type':Sequelize[_0xe61a('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe61a('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xe61a('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe61a('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xe61a('0xa')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x5341=['BOOLEAN','DATE','contactListQueue','sequelize','STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5341,0xab));var _0x1534=function(_0x30278a,_0x1c8da6){_0x30278a=_0x30278a-0x0;var _0x945666=_0x5341[_0x30278a];return _0x945666;};'use strict';var moment=require('moment');var Sequelize=require(_0x1534('0x0'));module['exports']={'phone':{'type':Sequelize[_0x1534('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x1534('0x2')](_0x1534('0x3'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1534('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1534('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1534('0x6')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1534('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1534('0x4')],'unique':_0x1534('0x7')},'ListId':{'type':Sequelize[_0x1534('0x4')],'unique':_0x1534('0x7')},'UserId':{'type':Sequelize[_0x1534('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x1534('0x4')],'unique':_0x1534('0x7')},'CampaignId':{'type':Sequelize[_0x1534('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x1534('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x1534('0x6')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index a11a6b5..2220597 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 _0x8819=['dialActive','getPreviewRecall','transaction','findOne','CmCompany','List','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','getTimezone','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','limit','count','offset','set','sendStatus','stack','name','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','$and','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','find','body','update','describe','destroy','params','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','create','CmHopperAdditionalPhone','getPreview','CmContact','getVoiceQueues','preview','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','Company','CmList'];(function(_0x21bad5,_0x23a39d){var _0x235106=function(_0x281b1f){while(--_0x281b1f){_0x21bad5['push'](_0x21bad5['shift']());}};_0x235106(++_0x23a39d);}(_0x8819,0x94));var _0x9881=function(_0x1f6dab,_0x409f44){_0x1f6dab=_0x1f6dab-0x0;var _0x26ba8c=_0x8819[_0x1f6dab];return _0x26ba8c;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require(_0x9881('0x0'));var logger=require(_0x9881('0x1'))(_0x9881('0x2'));var shared=require(_0x9881('0x3'));var db=require(_0x9881('0x4'))['db'];function respondWithResult(_0x5e52c5,_0x333d6f){_0x333d6f=_0x333d6f||0xc8;return function(_0x446deb){if(_0x446deb){return _0x5e52c5[_0x9881('0x5')](_0x333d6f)[_0x9881('0x6')](_0x446deb);}};}function respondWithFilteredResult(_0x1791fd,_0x2a3664){return function(_0x5f1d45){if(_0x5f1d45){var _0x353966=typeof _0x2a3664['offset']==='undefined'&&typeof _0x2a3664[_0x9881('0x7')]==='undefined';var _0x5c2c0f=_0x5f1d45[_0x9881('0x8')];var _0x4adf62=_0x353966?0x0:_0x2a3664[_0x9881('0x9')];var _0x39122e=_0x353966?_0x5f1d45[_0x9881('0x8')]:_0x2a3664['offset']+_0x2a3664[_0x9881('0x7')];var _0x1327e8;if(_0x39122e>=_0x5c2c0f){_0x39122e=_0x5c2c0f;_0x1327e8=0xc8;}else{_0x1327e8=0xce;}_0x1791fd[_0x9881('0x5')](_0x1327e8);return _0x1791fd[_0x9881('0xa')]('Content-Range',_0x4adf62+'-'+_0x39122e+'/'+_0x5c2c0f)[_0x9881('0x6')](_0x5f1d45);}return null;};}function saveUpdates(_0x26ee3f,_0x5c6d2d){return function(_0x42850e){if(_0x42850e){return _0x42850e['update'](_0x26ee3f)['then'](function(_0x48cfe1){return _0x48cfe1;});}return null;};}function handleEntityNotFound(_0x58f526,_0x12794f){return function(_0x3178d7){if(!_0x3178d7){_0x58f526[_0x9881('0xb')](0x194);}return _0x3178d7;};}function handleError(_0x1947e8,_0x39d127){_0x39d127=_0x39d127||0x1f4;return function(_0x1d57ea){logger['error'](_0x1d57ea[_0x9881('0xc')]);if(_0x1d57ea[_0x9881('0xd')]){delete _0x1d57ea[_0x9881('0xd')];}_0x1947e8['status'](_0x39d127)['send'](_0x1d57ea);};}exports['index']=function(_0x280ea2,_0x4c3493){var _0x620a9a={},_0x5a9848={},_0x59ff56={'count':0x0,'rows':[]};var _0x1f6e20=_[_0x9881('0xe')](db[_0x9881('0xf')][_0x9881('0x10')],function(_0x43f8a2){return{'name':_0x43f8a2[_0x9881('0x11')],'type':_0x43f8a2[_0x9881('0x12')][_0x9881('0x13')]};});_0x5a9848[_0x9881('0x14')]=_[_0x9881('0xe')](_0x1f6e20,_0x9881('0xd'));_0x5a9848[_0x9881('0x15')]=_[_0x9881('0x16')](_0x280ea2[_0x9881('0x15')]);_0x5a9848[_0x9881('0x17')]=_['intersection'](_0x5a9848['model'],_0x5a9848[_0x9881('0x15')]);_0x5a9848['filters']=_['concat'](_0x5a9848[_0x9881('0x17')],[_0x9881('0x18'),'$or','$gt',_0x9881('0x19'),'$lt',_0x9881('0x1a'),_0x9881('0x1b'),_0x9881('0x1c'),_0x9881('0x1d'),_0x9881('0x1e'),_0x9881('0x1f'),_0x9881('0x20'),_0x9881('0x21'),_0x9881('0x22'),_0x9881('0x23'),_0x9881('0x24'),_0x9881('0x25'),_0x9881('0x22'),'$overlap',_0x9881('0x26'),_0x9881('0x27'),'$any']);_0x620a9a[_0x9881('0x28')]=_[_0x9881('0x29')](_0x5a9848['model'],qs[_0x9881('0x2a')](_0x280ea2[_0x9881('0x15')][_0x9881('0x2a')]));_0x620a9a[_0x9881('0x28')]=_0x620a9a[_0x9881('0x28')][_0x9881('0x2b')]?_0x620a9a[_0x9881('0x28')]:_0x5a9848[_0x9881('0x14')];if(!_0x280ea2['query'][_0x9881('0x2c')](_0x9881('0x2d'))){_0x620a9a[_0x9881('0x7')]=qs[_0x9881('0x7')](_0x280ea2[_0x9881('0x15')][_0x9881('0x7')]);_0x620a9a['offset']=qs[_0x9881('0x9')](_0x280ea2[_0x9881('0x15')]['offset']);}_0x620a9a[_0x9881('0x2e')]=qs[_0x9881('0x2f')](_0x280ea2[_0x9881('0x15')][_0x9881('0x2f')]);_0x620a9a[_0x9881('0x30')]=qs['filters'](_[_0x9881('0x31')](_0x280ea2[_0x9881('0x15')],_0x5a9848[_0x9881('0x17')]),_0x1f6e20);if(_0x280ea2[_0x9881('0x15')][_0x9881('0x32')]){_0x620a9a[_0x9881('0x30')]=_[_0x9881('0x33')](_0x620a9a[_0x9881('0x30')],{'$or':_[_0x9881('0xe')](_0x1f6e20,function(_0x26c829){if(_0x26c829[_0x9881('0x12')]!==_0x9881('0x34')){var _0xfff6a5={};_0xfff6a5[_0x26c829[_0x9881('0xd')]]={'$like':'%'+_0x280ea2[_0x9881('0x15')][_0x9881('0x32')]+'%'};return _0xfff6a5;}})});}_0x620a9a=_['merge']({},_0x620a9a,_0x280ea2[_0x9881('0x35')]);var _0x5f14d5={'where':_0x620a9a[_0x9881('0x30')]};return db['CmHopper'][_0x9881('0x8')](_0x5f14d5)[_0x9881('0x36')](function(_0x4c865e){_0x59ff56[_0x9881('0x8')]=_0x4c865e;if(_0x280ea2['query'][_0x9881('0x37')]){_0x620a9a[_0x9881('0x38')]=[{'all':!![]}];}return db[_0x9881('0xf')][_0x9881('0x39')](_0x620a9a);})['then'](function(_0x2b2a0b){_0x59ff56[_0x9881('0x3a')]=_0x2b2a0b;return _0x59ff56;})[_0x9881('0x36')](respondWithFilteredResult(_0x4c3493,_0x620a9a))[_0x9881('0x3b')](handleError(_0x4c3493,null));};exports[_0x9881('0x3c')]=function(_0x201dcd,_0x100139){var _0x4feb70={'raw':!![],'where':{'id':_0x201dcd['params']['id']}},_0x3f25db={};_0x3f25db[_0x9881('0x14')]=_[_0x9881('0x16')](db[_0x9881('0xf')]['rawAttributes']);_0x3f25db[_0x9881('0x15')]=_[_0x9881('0x16')](_0x201dcd[_0x9881('0x15')]);_0x3f25db['filters']=_[_0x9881('0x29')](_0x3f25db[_0x9881('0x14')],_0x3f25db['query']);_0x4feb70[_0x9881('0x28')]=_[_0x9881('0x29')](_0x3f25db[_0x9881('0x14')],qs[_0x9881('0x2a')](_0x201dcd[_0x9881('0x15')][_0x9881('0x2a')]));_0x4feb70[_0x9881('0x28')]=_0x4feb70[_0x9881('0x28')][_0x9881('0x2b')]?_0x4feb70[_0x9881('0x28')]:_0x3f25db['model'];if(_0x201dcd[_0x9881('0x15')][_0x9881('0x37')]){_0x4feb70[_0x9881('0x38')]=[{'all':!![]}];}_0x4feb70=_[_0x9881('0x33')]({},_0x4feb70,_0x201dcd[_0x9881('0x35')]);return db['CmHopper'][_0x9881('0x3d')](_0x4feb70)[_0x9881('0x36')](handleEntityNotFound(_0x100139,null))[_0x9881('0x36')](respondWithResult(_0x100139,null))[_0x9881('0x3b')](handleError(_0x100139,null));};exports['create']=function(_0x28f0c0,_0xc9713c){return db[_0x9881('0xf')]['create'](_0x28f0c0[_0x9881('0x3e')],{})[_0x9881('0x36')](respondWithResult(_0xc9713c,0xc9))[_0x9881('0x3b')](handleError(_0xc9713c,null));};exports[_0x9881('0x3f')]=function(_0x193c45,_0x391777){if(_0x193c45[_0x9881('0x3e')]['id']){delete _0x193c45[_0x9881('0x3e')]['id'];}return db[_0x9881('0xf')][_0x9881('0x3d')]({'where':{'id':_0x193c45['params']['id']}})[_0x9881('0x36')](handleEntityNotFound(_0x391777,null))[_0x9881('0x36')](saveUpdates(_0x193c45[_0x9881('0x3e')],null))['then'](respondWithResult(_0x391777,null))[_0x9881('0x3b')](handleError(_0x391777,null));};exports[_0x9881('0x40')]=function(_0x1e1f0f,_0x573b4f){return db['CmHopper'][_0x9881('0x40')]()[_0x9881('0x36')](respondWithResult(_0x573b4f,null))[_0x9881('0x3b')](handleError(_0x573b4f,null));};exports[_0x9881('0x41')]=function(_0x49c478,_0x514263){var _0x3689d7;var _0x355357=_0x49c478[_0x9881('0x42')]['id'];return db['CmHopper'][_0x9881('0x3d')]({'where':{'id':_0x49c478[_0x9881('0x42')]['id']}})['then'](handleEntityNotFound(_0x514263,null))[_0x9881('0x36')](function(_0x262b8b){if(_0x262b8b){return _0x262b8b[_0x9881('0x41')]()[_0x9881('0x36')](function(_0x21720a){return _0x21720a;});}})[_0x9881('0x36')](function(_0x43f17d){_0x3689d7=_0x43f17d;if(_0x43f17d){if(_0x43f17d['VoiceQueueId']||_0x43f17d[_0x9881('0x43')]){return db[_0x43f17d['VoiceQueueId']?_0x9881('0x44'):_0x9881('0x45')][_0x9881('0x3d')]({'where':{'id':_0x43f17d[_0x9881('0x46')]?_0x43f17d['VoiceQueueId']:_0x43f17d['CampaignId']},'attributes':['id',_0x9881('0xd')],'raw':!![]});}}})[_0x9881('0x36')](function(_0x2fdba2){var _0x49d8b6={};if(_0x2fdba2){_[_0x9881('0x33')](_0x49d8b6,_[_0x9881('0x47')](_0x3689d7[_0x9881('0x48')],[_0x9881('0x49'),_0x9881('0x4a'),'id']));_0x49d8b6[_0x9881('0x4b')]=0x15;_0x49d8b6['statedesc']=_0x9881('0x4c');_0x49d8b6[_0x9881('0x4d')]=_0x2fdba2[_0x9881('0xd')];_0x49d8b6[_0x9881('0x4e')]=_0x49c478[_0x9881('0x4f')]['name'];_0x49d8b6['UserId']=_0x49c478['user']['id'];_0x49d8b6[_0x9881('0x4c')]=!![];_0x49d8b6[_0x9881('0x50')]=moment()[_0x9881('0x51')](_0x9881('0x52'));_0x49d8b6[_0x9881('0x53')]=_0x3689d7[_0x9881('0x54')];_0x49d8b6['campaigntype']=_0x3689d7['VoiceQueueId']?_0x9881('0x55'):_0x9881('0x56');return db['CmContact'][_0x9881('0x3d')]({'where':{'id':_0x49d8b6[_0x9881('0x57')]},'attributes':[_0x9881('0x58'),_0x9881('0x59')]})['then'](function(_0x3efda3){if(!_['isNil'](_0x514263)&&!_[_0x9881('0x5a')](_0x3efda3[_0x9881('0x58')])){_0x49d8b6[_0x9881('0x5b')]=_0x3efda3['firstName'];if(!_['isNil'](_0x3efda3['lastName'])){_0x49d8b6[_0x9881('0x5b')]+='\x20'+_0x3efda3[_0x9881('0x59')];}}})['finally'](function(){return db[_0x9881('0x5c')][_0x9881('0x5d')](_0x49d8b6);});}})[_0x9881('0x36')](function(_0x165274){return db[_0x9881('0x5e')][_0x9881('0x41')]({'where':{'CmHopperId':_0x355357}});})[_0x9881('0x36')](function(){return _0x514263[_0x9881('0x5')](0xcc)['end']();})['catch'](handleError(_0x514263,null));};exports[_0x9881('0x5f')]=function(_0x4012d9,_0xb9d0ac){var _0x12f6eb=[];return db[_0x9881('0x60')][_0x9881('0x40')]()['then'](function(_0x438a14){_0x12f6eb=_[_0x9881('0x16')](_0x438a14);return _0x4012d9[_0x9881('0x4f')][_0x9881('0x61')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x9881('0x62')},'attributes':['id','dialOrderByScheduledAt',_0x9881('0x63')],'raw':!![]});})[_0x9881('0x36')](function(_0xc1fd9b){if(_0xc1fd9b&&_0xc1fd9b[_0x9881('0x2b')]){return db['sequelize']['transaction'](function(_0x23f6cf){var _0x5d218e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x9881('0x52'))},'VoiceQueueId':{'$in':_[_0x9881('0xe')](_0xc1fd9b,'id')},'$or':[{'UserId':null},{'UserId':_0x4012d9[_0x9881('0x4f')]['id']}]};var _0x4b5491={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xc1fd9b)[_0x9881('0x32')]([_0x9881('0x63'),0x0])['map']('id')[_0x9881('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x4012d9[_0x9881('0x4f')]['id']}]};var _0x4d5ea0={'$or':[_0x5d218e,_0x4b5491]};var _0x21503c=[];if(_0x4012d9['body'][_0x9881('0x65')]&&_0x4012d9[_0x9881('0x3e')][_0x9881('0x65')]===_0x9881('0x66')){if(!_[_0x9881('0x67')](_0x4012d9[_0x9881('0x3e')]['hopperIds'])){_0x4d5ea0['id']={'$in':_0x4012d9[_0x9881('0x3e')][_0x9881('0x68')]};}_0x21503c=[[_0x9881('0x69'),_0x9881('0x6a')],[_0x9881('0x6b'),_0xc1fd9b[0x0][_0x9881('0x6c')]===_0x9881('0x6a')?_0x9881('0x6d'):_0x9881('0x6a')],db[_0x9881('0x6e')][_0x9881('0x6f')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x9881('0x6d')]];}else{if(!_[_0x9881('0x67')](_0x4012d9['body'][_0x9881('0x68')])){_0x4d5ea0['id']={'$notIn':_0x4012d9[_0x9881('0x3e')]['hopperIds']};}_0x21503c=[[_0x9881('0x69'),_0x9881('0x6d')],[_0x9881('0x6b'),_0xc1fd9b[0x0][_0x9881('0x6c')]],db[_0x9881('0x6e')]['literal'](_0x9881('0x70')),['id',_0x9881('0x6a')]];}return db[_0x9881('0xf')]['findOne']({'attributes':['id',_0x9881('0x71'),_0x9881('0x54'),_0x9881('0x72')],'where':_0x4d5ea0,'order':_0x21503c,'transaction':_0x23f6cf,'lock':_0x23f6cf[_0x9881('0x73')][_0x9881('0x74')],'include':[{'model':db['CmContact'],'as':_0x9881('0x75'),'attributes':_0x12f6eb,'include':[{'model':db['CmCompany'],'as':_0x9881('0x76'),'attributes':['id',_0x9881('0xd')]}]},{'model':db[_0x9881('0x77')],'as':'List','attributes':['id',_0x9881('0xd')]},{'model':db[_0x9881('0x44')],'as':'Queue','attributes':['id',_0x9881('0xd'),_0x9881('0x78')]}]})[_0x9881('0x36')](function(_0x4263ac){if(_0x4263ac){return _0x4263ac[_0x9881('0x3f')]({'UserId':_0x4012d9[_0x9881('0x4f')]['id']},{'transaction':_0x23f6cf});}});});}})['then'](handleEntityNotFound(_0xb9d0ac,null))[_0x9881('0x36')](respondWithResult(_0xb9d0ac,null))[_0x9881('0x3b')](handleError(_0xb9d0ac,null));};exports[_0x9881('0x79')]=function(_0x15f887,_0x578ac5,_0x1489cf){var _0x30bd50=[];var _0x5125c1=_0x15f887[_0x9881('0x42')]['id'];var _0x30a343=_0x15f887[_0x9881('0x4f')]['id'];return db['CmContact']['describe']()['then'](function(_0x57c931){_0x30bd50=_[_0x9881('0x16')](_0x57c931);return db[_0x9881('0x6e')][_0x9881('0x7a')](function(_0x237757){const _0x47739f={'id':_0x5125c1};return db[_0x9881('0xf')][_0x9881('0x7b')]({'attributes':['id',_0x9881('0x71'),'recallme'],'where':_0x47739f,'transaction':_0x237757,'lock':_0x237757[_0x9881('0x73')][_0x9881('0x74')],'include':[{'model':db[_0x9881('0x60')],'as':'Contact','attributes':_0x30bd50,'include':[{'model':db[_0x9881('0x7c')],'as':_0x9881('0x76'),'attributes':['id',_0x9881('0xd')]}]},{'model':db[_0x9881('0x77')],'as':_0x9881('0x7d'),'attributes':['id',_0x9881('0xd')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x9881('0xd'),_0x9881('0x78')]}]})[_0x9881('0x36')](function(_0x54af49){if(_0x54af49){return _0x54af49[_0x9881('0x3f')]({'UserId':_0x30a343},{'transaction':_0x237757});}});});})[_0x9881('0x36')](handleEntityNotFound(_0x578ac5,null))[_0x9881('0x36')](respondWithResult(_0x578ac5,null))['catch'](handleError(_0x578ac5,null));};exports[_0x9881('0x7e')]=function(_0x13dc4d,_0x2f654f){return _0x13dc4d[_0x9881('0x4f')][_0x9881('0x61')]({'where':{'type':_0x9881('0x7f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x21bc73){if(_0x21bc73&&_0x21bc73[_0x9881('0x2b')]){return db['CmHopper'][_0x9881('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9881('0x51')](_0x9881('0x52'))},'VoiceQueueId':{'$in':_[_0x9881('0xe')](_0x21bc73,'id')},'$or':[{'UserId':null},{'UserId':_0x13dc4d['user']['id']}]}});}return 0x0;})[_0x9881('0x36')](function(_0x569561){if(!_[_0x9881('0x5a')](_0x569561)&&_[_0x9881('0x80')](_0x569561)){return _0x2f654f[_0x9881('0x5')](0xc8)['json']({'contacts':_0x569561});}else{logger['error'](_0x9881('0x81'),_0x9881('0x7e'),0x194,_0x9881('0x82'));_0x2f654f['sendStatus'](0x194);}})[_0x9881('0x3b')](handleError(_0x2f654f,null));};exports[_0x9881('0x83')]=function(_0x942159,_0x1c8218){var _0x19937d=shared[_0x9881('0x84')];var _0x5f26da=[];_[_0x9881('0xe')](_0x19937d,function(_0x487668){_0x5f26da['push']({'id':_0x487668[_0x9881('0xd')],'name':_0x487668[_0x9881('0xd')],'utcOffset':_0x487668['utcOffset']});});return _0x1c8218[_0x9881('0x5')](0xc8)['json']({'tz':_0x5f26da});};exports[_0x9881('0x85')]=function(_0x21a524,_0x2d598b){var _0x5e8c3a=shared[_0x9881('0x84')];var _0x49ea3d={};if(!_[_0x9881('0x5a')](_0x5e8c3a[_0x21a524[_0x9881('0x3e')]['id']]))_0x49ea3d=_0x5e8c3a[_0x21a524[_0x9881('0x3e')]['id']];return _0x2d598b[_0x9881('0x5')](0xc8)[_0x9881('0x6')](_0x49ea3d);}; \ 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(_0x563d3b,_0x40812b){var _0xcc6fa4=function(_0x262fd8){while(--_0x262fd8){_0x563d3b['push'](_0x563d3b['shift']());}};_0xcc6fa4(++_0x40812b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0x4b84[_0x5ca5bc];return _0x26ca86;};'use strict';var moment=require(_0x44b8('0x0'));var _=require(_0x44b8('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x44b8('0x2'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x3b26c7,_0x31282a){_0x31282a=_0x31282a||0xc8;return function(_0x39ad16){if(_0x39ad16){return _0x3b26c7['status'](_0x31282a)['json'](_0x39ad16);}};}function respondWithFilteredResult(_0x55f25d,_0x996a8b){return function(_0x54274b){if(_0x54274b){var _0x327f59=typeof _0x996a8b['offset']===_0x44b8('0x3')&&typeof _0x996a8b['limit']==='undefined';var _0x41d515=_0x54274b[_0x44b8('0x4')];var _0x30ebc3=_0x327f59?0x0:_0x996a8b['offset'];var _0xc650ec=_0x327f59?_0x54274b[_0x44b8('0x4')]:_0x996a8b[_0x44b8('0x5')]+_0x996a8b[_0x44b8('0x6')];var _0x24dd10;if(_0xc650ec>=_0x41d515){_0xc650ec=_0x41d515;_0x24dd10=0xc8;}else{_0x24dd10=0xce;}_0x55f25d[_0x44b8('0x7')](_0x24dd10);return _0x55f25d[_0x44b8('0x8')]('Content-Range',_0x30ebc3+'-'+_0xc650ec+'/'+_0x41d515)[_0x44b8('0x9')](_0x54274b);}return null;};}function saveUpdates(_0x4301a6,_0x4bcc43){return function(_0x194230){if(_0x194230){return _0x194230['update'](_0x4301a6)[_0x44b8('0xa')](function(_0x18d642){return _0x18d642;});}return null;};}function handleEntityNotFound(_0x4df670,_0x63e8f6){return function(_0x4be54c){if(!_0x4be54c){_0x4df670['sendStatus'](0x194);}return _0x4be54c;};}function handleError(_0x2a3e4c,_0x2af0ad){_0x2af0ad=_0x2af0ad||0x1f4;return function(_0x1722da){logger[_0x44b8('0xb')](_0x1722da['stack']);if(_0x1722da['name']){delete _0x1722da['name'];}_0x2a3e4c[_0x44b8('0x7')](_0x2af0ad)['send'](_0x1722da);};}exports[_0x44b8('0xc')]=function(_0x31651b,_0x55e258){var _0x36743e={},_0xe3de8f={},_0x5103f5={'count':0x0,'rows':[]};var _0x89bc30=_[_0x44b8('0xd')](db['CmHopper'][_0x44b8('0xe')],function(_0x8b4301){return{'name':_0x8b4301[_0x44b8('0xf')],'type':_0x8b4301[_0x44b8('0x10')][_0x44b8('0x11')]};});_0xe3de8f[_0x44b8('0x12')]=_[_0x44b8('0xd')](_0x89bc30,_0x44b8('0x13'));_0xe3de8f[_0x44b8('0x14')]=_[_0x44b8('0x15')](_0x31651b[_0x44b8('0x14')]);_0xe3de8f[_0x44b8('0x16')]=_['intersection'](_0xe3de8f[_0x44b8('0x12')],_0xe3de8f[_0x44b8('0x14')]);_0xe3de8f[_0x44b8('0x16')]=_[_0x44b8('0x17')](_0xe3de8f[_0x44b8('0x16')],['$and',_0x44b8('0x18'),'$gt',_0x44b8('0x19'),_0x44b8('0x1a'),_0x44b8('0x1b'),_0x44b8('0x1c'),_0x44b8('0x1d'),'$not',_0x44b8('0x1e'),'$notBetween',_0x44b8('0x1f'),_0x44b8('0x20'),'$like',_0x44b8('0x21'),_0x44b8('0x22'),_0x44b8('0x23'),'$like',_0x44b8('0x24'),_0x44b8('0x25'),'$contained',_0x44b8('0x26')]);_0x36743e['attributes']=_[_0x44b8('0x27')](_0xe3de8f['model'],qs['fields'](_0x31651b['query'][_0x44b8('0x28')]));_0x36743e[_0x44b8('0x29')]=_0x36743e[_0x44b8('0x29')][_0x44b8('0x2a')]?_0x36743e[_0x44b8('0x29')]:_0xe3de8f[_0x44b8('0x12')];if(!_0x31651b[_0x44b8('0x14')][_0x44b8('0x2b')](_0x44b8('0x2c'))){_0x36743e[_0x44b8('0x6')]=qs[_0x44b8('0x6')](_0x31651b[_0x44b8('0x14')][_0x44b8('0x6')]);_0x36743e['offset']=qs[_0x44b8('0x5')](_0x31651b['query'][_0x44b8('0x5')]);}_0x36743e[_0x44b8('0x2d')]=qs[_0x44b8('0x2e')](_0x31651b[_0x44b8('0x14')][_0x44b8('0x2e')]);_0x36743e['where']=qs[_0x44b8('0x16')](_[_0x44b8('0x2f')](_0x31651b[_0x44b8('0x14')],_0xe3de8f[_0x44b8('0x16')]),_0x89bc30);if(_0x31651b[_0x44b8('0x14')]['filter']){_0x36743e[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x36743e[_0x44b8('0x30')],{'$or':_[_0x44b8('0xd')](_0x89bc30,function(_0x140a79){if(_0x140a79[_0x44b8('0x10')]!==_0x44b8('0x32')){var _0x14a9d7={};_0x14a9d7[_0x140a79[_0x44b8('0x13')]]={'$like':'%'+_0x31651b[_0x44b8('0x14')][_0x44b8('0x33')]+'%'};return _0x14a9d7;}})});}_0x36743e=_[_0x44b8('0x31')]({},_0x36743e,_0x31651b[_0x44b8('0x34')]);var _0xae15f4={'where':_0x36743e[_0x44b8('0x30')]};return db[_0x44b8('0x35')][_0x44b8('0x4')](_0xae15f4)[_0x44b8('0xa')](function(_0x28faa9){_0x5103f5[_0x44b8('0x4')]=_0x28faa9;if(_0x31651b[_0x44b8('0x14')][_0x44b8('0x36')]){_0x36743e['include']=[{'all':!![]}];}return db[_0x44b8('0x35')][_0x44b8('0x37')](_0x36743e);})['then'](function(_0x25688b){_0x5103f5[_0x44b8('0x38')]=_0x25688b;return _0x5103f5;})[_0x44b8('0xa')](respondWithFilteredResult(_0x55e258,_0x36743e))[_0x44b8('0x39')](handleError(_0x55e258,null));};exports['show']=function(_0x221543,_0x11e4e3){var _0x3611b4={'raw':!![],'where':{'id':_0x221543[_0x44b8('0x3a')]['id']}},_0x1ee3cc={};_0x1ee3cc[_0x44b8('0x12')]=_[_0x44b8('0x15')](db[_0x44b8('0x35')][_0x44b8('0xe')]);_0x1ee3cc[_0x44b8('0x14')]=_[_0x44b8('0x15')](_0x221543[_0x44b8('0x14')]);_0x1ee3cc[_0x44b8('0x16')]=_[_0x44b8('0x27')](_0x1ee3cc[_0x44b8('0x12')],_0x1ee3cc[_0x44b8('0x14')]);_0x3611b4['attributes']=_[_0x44b8('0x27')](_0x1ee3cc[_0x44b8('0x12')],qs[_0x44b8('0x28')](_0x221543['query'][_0x44b8('0x28')]));_0x3611b4[_0x44b8('0x29')]=_0x3611b4[_0x44b8('0x29')]['length']?_0x3611b4[_0x44b8('0x29')]:_0x1ee3cc[_0x44b8('0x12')];if(_0x221543[_0x44b8('0x14')][_0x44b8('0x36')]){_0x3611b4[_0x44b8('0x3b')]=[{'all':!![]}];}_0x3611b4=_['merge']({},_0x3611b4,_0x221543['options']);return db[_0x44b8('0x35')][_0x44b8('0x3c')](_0x3611b4)[_0x44b8('0xa')](handleEntityNotFound(_0x11e4e3,null))[_0x44b8('0xa')](respondWithResult(_0x11e4e3,null))[_0x44b8('0x39')](handleError(_0x11e4e3,null));};exports[_0x44b8('0x3d')]=function(_0x3fc41b,_0x457348){return db[_0x44b8('0x35')][_0x44b8('0x3d')](_0x3fc41b[_0x44b8('0x3e')],{})[_0x44b8('0xa')](respondWithResult(_0x457348,0xc9))[_0x44b8('0x39')](handleError(_0x457348,null));};exports[_0x44b8('0x3f')]=function(_0x149731,_0x60eeb2){if(_0x149731[_0x44b8('0x3e')]['id']){delete _0x149731[_0x44b8('0x3e')]['id'];}return db[_0x44b8('0x35')]['find']({'where':{'id':_0x149731['params']['id']}})[_0x44b8('0xa')](handleEntityNotFound(_0x60eeb2,null))[_0x44b8('0xa')](saveUpdates(_0x149731[_0x44b8('0x3e')],null))[_0x44b8('0xa')](respondWithResult(_0x60eeb2,null))[_0x44b8('0x39')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x40')]=function(_0x411ed6,_0x4fe73f){return db[_0x44b8('0x35')]['describe']()[_0x44b8('0xa')](respondWithResult(_0x4fe73f,null))[_0x44b8('0x39')](handleError(_0x4fe73f,null));};exports[_0x44b8('0x41')]=function(_0x9207bf,_0x103d57){var _0x35ca19;var _0x491600=_0x9207bf[_0x44b8('0x3a')]['id'];return db[_0x44b8('0x35')][_0x44b8('0x3c')]({'where':{'id':_0x9207bf[_0x44b8('0x3a')]['id']}})['then'](handleEntityNotFound(_0x103d57,null))[_0x44b8('0xa')](function(_0x2f549d){if(_0x2f549d){return _0x2f549d[_0x44b8('0x41')]()[_0x44b8('0xa')](function(_0x44ec23){return _0x44ec23;});}})[_0x44b8('0xa')](function(_0x500bad){_0x35ca19=_0x500bad;if(_0x500bad){if(_0x500bad[_0x44b8('0x42')]||_0x500bad[_0x44b8('0x43')]){return db[_0x500bad[_0x44b8('0x42')]?_0x44b8('0x44'):_0x44b8('0x45')]['find']({'where':{'id':_0x500bad['VoiceQueueId']?_0x500bad[_0x44b8('0x42')]:_0x500bad['CampaignId']},'attributes':['id',_0x44b8('0x13')],'raw':!![]});}}})['then'](function(_0x40164d){var _0x434d6a={};if(_0x40164d){_[_0x44b8('0x31')](_0x434d6a,_[_0x44b8('0x46')](_0x35ca19[_0x44b8('0x47')],[_0x44b8('0x48'),_0x44b8('0x49'),'id']));_0x434d6a['state']=0x15;_0x434d6a[_0x44b8('0x4a')]=_0x44b8('0x4b');_0x434d6a[_0x44b8('0x4c')]=_0x40164d['name'];_0x434d6a[_0x44b8('0x4d')]=_0x9207bf[_0x44b8('0x4e')][_0x44b8('0x13')];_0x434d6a[_0x44b8('0x4f')]=_0x9207bf['user']['id'];_0x434d6a[_0x44b8('0x4b')]=!![];_0x434d6a[_0x44b8('0x50')]=moment()['format'](_0x44b8('0x51'));_0x434d6a[_0x44b8('0x52')]=_0x35ca19[_0x44b8('0x53')];_0x434d6a[_0x44b8('0x54')]=_0x35ca19[_0x44b8('0x42')]?'queue':'ivr';return db[_0x44b8('0x55')][_0x44b8('0x3c')]({'where':{'id':_0x434d6a[_0x44b8('0x56')]},'attributes':[_0x44b8('0x57'),_0x44b8('0x58')]})[_0x44b8('0xa')](function(_0x3c9534){if(!_[_0x44b8('0x59')](_0x103d57)&&!_[_0x44b8('0x59')](_0x3c9534[_0x44b8('0x57')])){_0x434d6a[_0x44b8('0x5a')]=_0x3c9534[_0x44b8('0x57')];if(!_['isNil'](_0x3c9534[_0x44b8('0x58')])){_0x434d6a[_0x44b8('0x5a')]+='\x20'+_0x3c9534[_0x44b8('0x58')];}}})[_0x44b8('0x5b')](function(){return db[_0x44b8('0x5c')][_0x44b8('0x3d')](_0x434d6a);});}})[_0x44b8('0xa')](function(_0x172ff3){return db[_0x44b8('0x5d')][_0x44b8('0x41')]({'where':{'CmHopperId':_0x491600}});})[_0x44b8('0xa')](function(){return _0x103d57[_0x44b8('0x7')](0xcc)[_0x44b8('0x5e')]();})[_0x44b8('0x39')](handleError(_0x103d57,null));};exports[_0x44b8('0x5f')]=function(_0x293c2e,_0x25f91c){var _0x20e563=[];return db['CmContact'][_0x44b8('0x40')]()[_0x44b8('0xa')](function(_0x10e519){_0x20e563=_[_0x44b8('0x15')](_0x10e519);return _0x293c2e[_0x44b8('0x4e')][_0x44b8('0x60')]({'where':{'type':_0x44b8('0x61'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x44b8('0x62'),_0x44b8('0x63')],'raw':!![]});})['then'](function(_0x2a95f6){if(_0x2a95f6&&_0x2a95f6[_0x44b8('0x2a')]){return db['sequelize'][_0x44b8('0x64')](function(_0x454fe6){var _0x370618={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x44b8('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x2a95f6,'id')},'$or':[{'UserId':null},{'UserId':_0x293c2e[_0x44b8('0x4e')]['id']}]};var _0x5161ea={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2a95f6)[_0x44b8('0x33')]([_0x44b8('0x63'),0x0])[_0x44b8('0xd')]('id')[_0x44b8('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x293c2e[_0x44b8('0x4e')]['id']}]};var _0x230b6a={'$or':[_0x370618,_0x5161ea]};var _0x4c7edd=[];if(_0x293c2e[_0x44b8('0x3e')]['direction']&&_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x66')]==='prev'){if(!_[_0x44b8('0x67')](_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')])){_0x230b6a['id']={'$in':_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')]};}_0x4c7edd=[[_0x44b8('0x69'),_0x44b8('0x6a')],[_0x44b8('0x6b'),_0x2a95f6[0x0][_0x44b8('0x62')]===_0x44b8('0x6a')?_0x44b8('0x6c'):_0x44b8('0x6a')],db['sequelize'][_0x44b8('0x6d')](_0x44b8('0x6e')),['id',_0x44b8('0x6c')]];}else{if(!_['isEmpty'](_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')])){_0x230b6a['id']={'$notIn':_0x293c2e['body'][_0x44b8('0x68')]};}_0x4c7edd=[[_0x44b8('0x69'),_0x44b8('0x6c')],[_0x44b8('0x6b'),_0x2a95f6[0x0][_0x44b8('0x62')]],db['sequelize'][_0x44b8('0x6d')](_0x44b8('0x6f')),['id',_0x44b8('0x6a')]];}return db[_0x44b8('0x35')][_0x44b8('0x70')]({'attributes':['id',_0x44b8('0x71'),_0x44b8('0x53'),_0x44b8('0x72')],'where':_0x230b6a,'order':_0x4c7edd,'transaction':_0x454fe6,'lock':_0x454fe6['LOCK'][_0x44b8('0x73')],'include':[{'model':db[_0x44b8('0x55')],'as':_0x44b8('0x74'),'attributes':_0x20e563,'include':[{'model':db[_0x44b8('0x75')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x44b8('0x76'),'attributes':['id',_0x44b8('0x13')]},{'model':db[_0x44b8('0x44')],'as':_0x44b8('0x77'),'attributes':['id',_0x44b8('0x13'),'dialActive']}]})[_0x44b8('0xa')](function(_0x58180f){if(_0x58180f){return _0x58180f[_0x44b8('0x3f')]({'UserId':_0x293c2e[_0x44b8('0x4e')]['id']},{'transaction':_0x454fe6});}});});}})[_0x44b8('0xa')](handleEntityNotFound(_0x25f91c,null))['then'](respondWithResult(_0x25f91c,null))['catch'](handleError(_0x25f91c,null));};exports[_0x44b8('0x78')]=function(_0x1964b2,_0x248e6c,_0x536734){var _0x1f5277=[];var _0x36f217=_0x1964b2[_0x44b8('0x3a')]['id'];var _0x15b209=_0x1964b2[_0x44b8('0x4e')]['id'];return db['CmContact'][_0x44b8('0x40')]()[_0x44b8('0xa')](function(_0xbbdab9){_0x1f5277=_[_0x44b8('0x15')](_0xbbdab9);return db[_0x44b8('0x79')]['transaction'](function(_0x40571c){const _0x4c7cdf={'id':_0x36f217};return db[_0x44b8('0x35')][_0x44b8('0x70')]({'attributes':['id',_0x44b8('0x71'),_0x44b8('0x72')],'where':_0x4c7cdf,'transaction':_0x40571c,'lock':_0x40571c[_0x44b8('0x7a')]['UPDATE'],'include':[{'model':db[_0x44b8('0x55')],'as':_0x44b8('0x74'),'attributes':_0x1f5277,'include':[{'model':db['CmCompany'],'as':_0x44b8('0x7b'),'attributes':['id',_0x44b8('0x13')]}]},{'model':db['CmList'],'as':_0x44b8('0x76'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x44b8('0x77'),'attributes':['id',_0x44b8('0x13'),_0x44b8('0x7c')]}]})['then'](function(_0x510760){if(_0x510760){return _0x510760['update']({'UserId':_0x15b209},{'transaction':_0x40571c});}});});})[_0x44b8('0xa')](handleEntityNotFound(_0x248e6c,null))[_0x44b8('0xa')](respondWithResult(_0x248e6c,null))[_0x44b8('0x39')](handleError(_0x248e6c,null));};exports[_0x44b8('0x7d')]=function(_0x1a5621,_0x221e65){return _0x1a5621[_0x44b8('0x4e')][_0x44b8('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x44b8('0x7e')},'attributes':['id'],'raw':!![]})['then'](function(_0x59e7b4){if(_0x59e7b4&&_0x59e7b4['length']){return db[_0x44b8('0x35')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x44b8('0x7f')](_0x44b8('0x51'))},'VoiceQueueId':{'$in':_[_0x44b8('0xd')](_0x59e7b4,'id')},'$or':[{'UserId':null},{'UserId':_0x1a5621[_0x44b8('0x4e')]['id']}]}});}return 0x0;})[_0x44b8('0xa')](function(_0x245ba3){if(!_[_0x44b8('0x59')](_0x245ba3)&&_[_0x44b8('0x80')](_0x245ba3)){return _0x221e65['status'](0xc8)[_0x44b8('0x9')]({'contacts':_0x245ba3});}else{logger[_0x44b8('0xb')](_0x44b8('0x81'),_0x44b8('0x7d'),0x194,_0x44b8('0x82'));_0x221e65[_0x44b8('0x83')](0x194);}})[_0x44b8('0x39')](handleError(_0x221e65,null));};exports[_0x44b8('0x84')]=function(_0x40fec3,_0x5f4734){var _0x4b45a7=shared[_0x44b8('0x85')];var _0x553aa9=[];_[_0x44b8('0xd')](_0x4b45a7,function(_0x444419){_0x553aa9[_0x44b8('0x86')]({'id':_0x444419['name'],'name':_0x444419['name'],'utcOffset':_0x444419['utcOffset']});});return _0x5f4734[_0x44b8('0x7')](0xc8)['json']({'tz':_0x553aa9});};exports[_0x44b8('0x87')]=function(_0x2812da,_0xf18cb2){var _0x322a49=shared[_0x44b8('0x85')];var _0xf643d3={};if(!_[_0x44b8('0x59')](_0x322a49[_0x2812da[_0x44b8('0x3e')]['id']]))_0xf643d3=_0x322a49[_0x2812da[_0x44b8('0x3e')]['id']];return _0xf18cb2[_0x44b8('0x7')](0xc8)[_0x44b8('0x9')](_0xf643d3);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 7eedcde..b53751a 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 _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','api'];(function(_0x5cba8f,_0x2834bb){var _0x2f218a=function(_0x3a0a56){while(--_0x3a0a56){_0x5cba8f['push'](_0x5cba8f['shift']());}};_0x2f218a(++_0x2834bb);}(_0xfcf0,0x138));var _0x0fcf=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0xfcf0[_0xa4928c];return _0x27cc29;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xc')]},{'name':_0x0fcf('0xd'),'fields':['phone']},{'name':_0x0fcf('0xe'),'fields':[_0x0fcf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','priority','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x326f,0xd1));var _0xf326=function(_0x4266c0,_0x404f59){_0x4266c0=_0x4266c0-0x0;var _0x1a5d4e=_0x326f[_0x4266c0];return _0x1a5d4e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0xf326('0xe'),'fields':[_0xf326('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 05df2b0..8ff5b57 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 _0xbbfd=['include','model','map','info','debug','stringify','catch','message','then','ShowCmHopper','error','create','body','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','keys','Agent','length','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','UserId','UPDATE','GetCmHopperPreview','Contact','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','util','moment','bluebird','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xbbfd,0x86));var _0xdbbf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbbfd[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xdbbf('0x0'));var moment=require(_0xdbbf('0x1'));var BPromise=require(_0xdbbf('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xdbbf('0x3'))('rpc');exports[_0xdbbf('0x4')]=function(_0x3d5295){var _0x45046c=this;return new Promise(function(_0x136c8b,_0x5b460d){return db[_0xdbbf('0x5')][_0xdbbf('0x6')]({'raw':_0x3d5295[_0xdbbf('0x7')]?_0x3d5295[_0xdbbf('0x7')][_0xdbbf('0x8')]===undefined?!![]:![]:!![],'where':_0x3d5295['options']?_0x3d5295[_0xdbbf('0x7')][_0xdbbf('0x9')]||null:null,'attributes':_0x3d5295['options']?_0x3d5295[_0xdbbf('0x7')][_0xdbbf('0xa')]||null:null,'limit':_0x3d5295[_0xdbbf('0x7')]?_0x3d5295[_0xdbbf('0x7')][_0xdbbf('0xb')]||null:null,'include':_0x3d5295[_0xdbbf('0x7')]?_0x3d5295[_0xdbbf('0x7')][_0xdbbf('0xc')]?_['map'](_0x3d5295['options'][_0xdbbf('0xc')],function(_0x42a19b){return{'model':db[_0x42a19b[_0xdbbf('0xd')]],'as':_0x42a19b['as'],'attributes':_0x42a19b['attributes'],'include':_0x42a19b[_0xdbbf('0xc')]?_[_0xdbbf('0xe')](_0x42a19b[_0xdbbf('0xc')],function(_0x1b8368){return{'model':db[_0x1b8368[_0xdbbf('0xd')]],'as':_0x1b8368['as'],'attributes':_0x1b8368[_0xdbbf('0xa')],'include':_0x1b8368['include']?_[_0xdbbf('0xe')](_0x1b8368['include'],function(_0x3421aa){return{'model':db[_0x3421aa['model']],'as':_0x3421aa['as'],'attributes':_0x3421aa[_0xdbbf('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fb66b){logger[_0xdbbf('0xf')]('GetCmHopper',_0x3d5295);logger[_0xdbbf('0x10')](_0xdbbf('0x4'),_0x3d5295,JSON[_0xdbbf('0x11')](_0x2fb66b));_0x136c8b(_0x2fb66b);})[_0xdbbf('0x12')](function(_0x1bb79b){logger['error'](_0xdbbf('0x4'),_0x1bb79b[_0xdbbf('0x13')],_0x3d5295);_0x5b460d(_0x45046c['error'](0x1f4,_0x1bb79b[_0xdbbf('0x13')]));});});};exports['ShowCmHopper']=function(_0x39555f){var _0x537cd3=this;return new Promise(function(_0x31c95d,_0x2bbfc9){return db[_0xdbbf('0x5')]['find']({'raw':_0x39555f[_0xdbbf('0x7')]?_0x39555f[_0xdbbf('0x7')][_0xdbbf('0x8')]===undefined?!![]:![]:!![],'where':_0x39555f[_0xdbbf('0x7')]?_0x39555f[_0xdbbf('0x7')][_0xdbbf('0x9')]||null:null,'attributes':_0x39555f[_0xdbbf('0x7')]?_0x39555f['options']['attributes']||null:null,'include':_0x39555f[_0xdbbf('0x7')]?_0x39555f[_0xdbbf('0x7')][_0xdbbf('0xc')]?_['map'](_0x39555f[_0xdbbf('0x7')][_0xdbbf('0xc')],function(_0xc7adcb){return{'model':db[_0xc7adcb[_0xdbbf('0xd')]],'as':_0xc7adcb['as'],'attributes':_0xc7adcb[_0xdbbf('0xa')],'include':_0xc7adcb[_0xdbbf('0xc')]?_['map'](_0xc7adcb['include'],function(_0x49bbe1){return{'model':db[_0x49bbe1[_0xdbbf('0xd')]],'as':_0x49bbe1['as'],'attributes':_0x49bbe1[_0xdbbf('0xa')],'include':_0x49bbe1[_0xdbbf('0xc')]?_[_0xdbbf('0xe')](_0x49bbe1[_0xdbbf('0xc')],function(_0x35ba15){return{'model':db[_0x35ba15[_0xdbbf('0xd')]],'as':_0x35ba15['as'],'attributes':_0x35ba15[_0xdbbf('0xa')]};}):[]};}):[]};}):[]:[]})[_0xdbbf('0x14')](function(_0x1dac6c){logger[_0xdbbf('0xf')](_0xdbbf('0x15'),_0x39555f);logger[_0xdbbf('0x10')](_0xdbbf('0x15'),_0x39555f,JSON[_0xdbbf('0x11')](_0x1dac6c));_0x31c95d(_0x1dac6c);})[_0xdbbf('0x12')](function(_0x5415e0){logger[_0xdbbf('0x16')](_0xdbbf('0x15'),_0x5415e0['message'],_0x39555f);_0x2bbfc9(_0x537cd3['error'](0x1f4,_0x5415e0[_0xdbbf('0x13')]));});});};exports['CreateCmHopper']=function(_0x4a5792){var _0x573f72=this;return new Promise(function(_0xb5116f,_0x5038a5){return db['CmHopper'][_0xdbbf('0x17')](_0x4a5792[_0xdbbf('0x18')],{'raw':_0x4a5792['options']?_0x4a5792['options'][_0xdbbf('0x8')]===undefined?!![]:![]:!![]})[_0xdbbf('0x14')](function(_0x287694){logger['info'](_0xdbbf('0x19'),_0x4a5792);logger[_0xdbbf('0x10')](_0xdbbf('0x19'),_0x4a5792,JSON[_0xdbbf('0x11')](_0x287694));_0xb5116f(_0x287694);})['catch'](function(_0x5ab0c5){logger[_0xdbbf('0x16')](_0xdbbf('0x19'),_0x5ab0c5[_0xdbbf('0x13')],_0x4a5792);_0x5038a5(_0x573f72[_0xdbbf('0x16')](0x1f4,_0x5ab0c5[_0xdbbf('0x13')]));});});};exports[_0xdbbf('0x1a')]=function(_0x2d541d){var _0x55cb71=this;return new Promise(function(_0x1e8059,_0x3a2f2e){return db[_0xdbbf('0x5')]['update'](_0x2d541d[_0xdbbf('0x18')],{'raw':_0x2d541d[_0xdbbf('0x7')]?_0x2d541d[_0xdbbf('0x7')][_0xdbbf('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d541d[_0xdbbf('0x7')]?_0x2d541d[_0xdbbf('0x7')]['where']||null:null,'attributes':_0x2d541d[_0xdbbf('0x7')]?_0x2d541d[_0xdbbf('0x7')]['attributes']||null:null,'limit':_0x2d541d[_0xdbbf('0x7')]?_0x2d541d['options']['limit']||null:null})[_0xdbbf('0x14')](function(_0x3123f8){logger[_0xdbbf('0xf')](_0xdbbf('0x1a'),_0x2d541d);logger[_0xdbbf('0xf')](_0xdbbf('0x1b'),JSON[_0xdbbf('0x11')](_0x2d541d[_0xdbbf('0x7')][_0xdbbf('0x9')]),_0x2d541d[_0xdbbf('0x18')]['active']);logger[_0xdbbf('0x10')]('UpdateCmHopper',_0x2d541d,JSON['stringify'](_0x3123f8));_0x1e8059(_0x3123f8);})[_0xdbbf('0x12')](function(_0x2894b2){logger[_0xdbbf('0x16')]('UpdateCmHopper',_0x2894b2['message'],_0x2d541d);_0x3a2f2e(_0x55cb71['error'](0x1f4,_0x2894b2[_0xdbbf('0x13')]));});});};exports[_0xdbbf('0x1c')]=function(_0x2afcd3){var _0x270aa0=this;return new Promise(function(_0x5158ee,_0x204446){return db[_0xdbbf('0x5')][_0xdbbf('0x1d')]({'where':_0x2afcd3['options']?_0x2afcd3['options'][_0xdbbf('0x9')]||null:null})[_0xdbbf('0x14')](function(_0x280b37){logger[_0xdbbf('0xf')](_0xdbbf('0x1c'),_0x2afcd3);logger[_0xdbbf('0x10')](_0xdbbf('0x1c'),_0x2afcd3,JSON[_0xdbbf('0x11')](_0x280b37));_0x5158ee(_0x280b37);})[_0xdbbf('0x12')](function(_0x183e73){logger[_0xdbbf('0x16')](_0xdbbf('0x1c'),_0x183e73[_0xdbbf('0x13')],_0x2afcd3);_0x204446(_0x270aa0[_0xdbbf('0x16')](0x1f4,_0x183e73[_0xdbbf('0x13')]));});});};exports[_0xdbbf('0x1e')]=function(_0xbcff38){var _0xa9a7d4=this;return new Promise(function(_0x205993,_0x597fca){return db[_0xdbbf('0x1f')][_0xdbbf('0x20')]()[_0xdbbf('0x14')](function(_0x31e7e8){return db[_0xdbbf('0x21')][_0xdbbf('0x22')](function(_0x43d808){return db[_0xdbbf('0x5')][_0xdbbf('0x6')]({'where':_0xbcff38[_0xdbbf('0x7')]?_0xbcff38['options'][_0xdbbf('0x9')]||null:null,'attributes':_0xbcff38[_0xdbbf('0x7')]?_0xbcff38[_0xdbbf('0x7')][_0xdbbf('0xa')]||null:null,'limit':_0xbcff38[_0xdbbf('0x7')]?_0xbcff38[_0xdbbf('0x7')][_0xdbbf('0xb')]||null:null,'order':_0xbcff38[_0xdbbf('0x7')]?_0xbcff38[_0xdbbf('0x7')]['order']||null:null,'transaction':_0x43d808,'lock':_0x43d808[_0xdbbf('0x23')]['UPDATE'],'include':[{'model':db[_0xdbbf('0x1f')],'as':'Contact','attributes':_[_0xdbbf('0x24')](_0x31e7e8)},{'model':db['User'],'as':_0xdbbf('0x25'),'attributes':['id','name','voicePause']}]})[_0xdbbf('0x14')](function(_0x50388a){var _0x1027e9=[];var _0x15f34f=[];for(var _0x1600ee=0x0;_0x1600ee<_0x50388a[_0xdbbf('0x26')];_0x1600ee+=0x1){var _0x1d45d6=_0x50388a[_0x1600ee]['UserId'];if(_0x1d45d6===null){_0x1027e9[_0xdbbf('0x27')](_0x50388a[_0x1600ee][_0xdbbf('0x28')](_0xbcff38[_0xdbbf('0x18')],{'transaction':_0x43d808}));}else if(!_0x15f34f[_0xdbbf('0x29')](_0x1d45d6)){_0x15f34f[_0xdbbf('0x27')](_0x1d45d6);_0x1027e9['push'](_0x50388a[_0x1600ee]['update'](_0xbcff38[_0xdbbf('0x18')],{'transaction':_0x43d808}));}}return BPromise[_0xdbbf('0x2a')](_0x1027e9);});})['then'](function(_0x3c7099){logger[_0xdbbf('0xf')]('GetContactDialer',_0xbcff38);if(_0x3c7099[_0xdbbf('0x26')]>0x0){logger[_0xdbbf('0xf')](_0xdbbf('0x2b'),_0x3c7099[0x0][_0xdbbf('0x2c')]['id'],_0x3c7099[0x0][_0xdbbf('0x2c')]['ContactId'],_0x3c7099[0x0][_0xdbbf('0x2c')][_0xdbbf('0x2d')]);}logger['debug'](_0xdbbf('0x1e'),_0xbcff38,JSON[_0xdbbf('0x11')](_0x3c7099));_0x205993(_0x3c7099);})[_0xdbbf('0x12')](function(_0x19e4bb){logger[_0xdbbf('0x16')](_0xdbbf('0x1e'),_0x19e4bb['message'],_0xbcff38);_0x597fca(_0xa9a7d4[_0xdbbf('0x16')](0x1f4,_0x19e4bb[_0xdbbf('0x13')]));});});});};exports[_0xdbbf('0x2e')]=function(_0x266cce){var _0x3a2bf=this;return new Promise(function(_0x49cbd2,_0x4fe7c0){return db[_0xdbbf('0x21')]['transaction'](function(_0x271be7){return db[_0xdbbf('0x2f')][_0xdbbf('0x17')](_0x266cce[_0xdbbf('0x18')],{'raw':_0x266cce['options']?_0x266cce[_0xdbbf('0x7')][_0xdbbf('0x8')]===undefined?!![]:![]:!![],'transaction':_0x271be7})[_0xdbbf('0x14')](function(){logger[_0xdbbf('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xdbbf('0x11')](_0x266cce[_0xdbbf('0x7')][_0xdbbf('0x9')]),_0x266cce[_0xdbbf('0x7')][_0xdbbf('0x9')]['active']);return db[_0xdbbf('0x5')][_0xdbbf('0x1d')]({'where':_0x266cce[_0xdbbf('0x7')]?_0x266cce[_0xdbbf('0x7')][_0xdbbf('0x9')]||null:null,'transaction':_0x271be7});});})[_0xdbbf('0x14')](function(_0x4b4367){logger['info'](_0xdbbf('0x2e'),_0x266cce);logger[_0xdbbf('0x10')](_0xdbbf('0x2e'),_0x266cce,JSON['stringify'](_0x4b4367));_0x49cbd2(_0x4b4367);})[_0xdbbf('0x12')](function(_0xecba6){logger[_0xdbbf('0x16')]('MoveContactManagedDialer',_0xecba6[_0xdbbf('0x13')],_0x266cce);_0x4fe7c0(_0x3a2bf[_0xdbbf('0x16')](0x1f4,_0xecba6[_0xdbbf('0x13')]));});});};exports[_0xdbbf('0x30')]=function(_0x26021a){var _0x36c036=this;return new Promise(function(_0x503e25,_0x594cd8){return db[_0xdbbf('0x5')]['findAll']({'raw':_0x26021a[_0xdbbf('0x7')]?_0x26021a['options'][_0xdbbf('0x8')]===undefined?!![]:![]:!![],'where':_0x26021a[_0xdbbf('0x7')]?_0x26021a['options'][_0xdbbf('0x9')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xdbbf('0x21')]['fn']('IF',db[_0xdbbf('0x21')][_0xdbbf('0x31')](_0xdbbf('0x32')+util[_0xdbbf('0x33')]('\x22%s\x22',moment()[_0xdbbf('0x33')](_0xdbbf('0x34')))+_0xdbbf('0x35')))),'contactsRescheduled']]})[_0xdbbf('0x14')](function(_0x481d40){logger[_0xdbbf('0xf')](_0xdbbf('0x30'),_0x26021a);logger[_0xdbbf('0x10')]('CountReScheduled',_0x26021a,JSON['stringify'](_0x481d40));_0x503e25(_0x481d40);})[_0xdbbf('0x12')](function(_0x329173){logger[_0xdbbf('0x16')](_0xdbbf('0x30'),_0x329173[_0xdbbf('0x13')],_0x26021a);_0x594cd8(_0x36c036[_0xdbbf('0x16')](0x1f4,_0x329173[_0xdbbf('0x13')]));});});};exports[_0xdbbf('0x36')]=function(_0x172bf8){var _0x3be5c1=this;return new Promise(function(_0x3bc1b1,_0x58f38b){return db[_0xdbbf('0x1f')][_0xdbbf('0x20')]()[_0xdbbf('0x14')](function(){return db[_0xdbbf('0x21')][_0xdbbf('0x22')](function(_0x4a2db5){return db[_0xdbbf('0x5')][_0xdbbf('0x6')]({'where':_0x172bf8[_0xdbbf('0x7')]?_0x172bf8['options'][_0xdbbf('0x9')]||null:null,'attributes':_0x172bf8[_0xdbbf('0x7')]?_0x172bf8[_0xdbbf('0x7')][_0xdbbf('0xa')]||null:null,'limit':0x1,'order':_0x172bf8[_0xdbbf('0x7')]?_0x172bf8[_0xdbbf('0x7')]['order']||null:null,'group':db['CmHopper'][_0xdbbf('0x37')],'transaction':_0x4a2db5,'lock':_0x4a2db5['LOCK'][_0xdbbf('0x38')],'include':_0x172bf8[_0xdbbf('0x7')]?_0x172bf8['options']['include']?_[_0xdbbf('0xe')](_0x172bf8[_0xdbbf('0x7')][_0xdbbf('0xc')],function(_0x17790b){return{'model':db[_0x17790b[_0xdbbf('0xd')]],'as':_0x17790b['as'],'attributes':_0x17790b[_0xdbbf('0xa')],'include':_0x17790b[_0xdbbf('0xc')]?_[_0xdbbf('0xe')](_0x17790b[_0xdbbf('0xc')],function(_0x1ac17d){return{'model':db[_0x1ac17d[_0xdbbf('0xd')]],'as':_0x1ac17d['as'],'attributes':_0x1ac17d['attributes'],'include':_0x1ac17d[_0xdbbf('0xc')]?_[_0xdbbf('0xe')](_0x1ac17d[_0xdbbf('0xc')],function(_0x271dfb){return{'model':db[_0x271dfb['model']],'as':_0x271dfb['as'],'attributes':_0x271dfb[_0xdbbf('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17c8a4){var _0x4a13dc=[];for(var _0x56670a=0x0;_0x56670a<_0x17c8a4['length'];_0x56670a+=0x1){_0x4a13dc[_0xdbbf('0x27')](_0x17c8a4[_0x56670a]['update'](_0x172bf8[_0xdbbf('0x18')],{'transaction':_0x4a2db5}));}return BPromise[_0xdbbf('0x2a')](_0x4a13dc);});})['then'](function(_0xf14df5){logger[_0xdbbf('0xf')](_0xdbbf('0x36'),_0x172bf8);logger[_0xdbbf('0x10')](_0xdbbf('0x36'),_0x172bf8,JSON[_0xdbbf('0x11')](_0xf14df5));_0x3bc1b1(_0xf14df5);})[_0xdbbf('0x12')](function(_0x4a47d8){logger['error'](_0xdbbf('0x36'),_0x4a47d8['message'],_0x172bf8);_0x58f38b(_0x3be5c1['error'](0x1f4,_0x4a47d8[_0xdbbf('0x13')]));});});});};exports[_0xdbbf('0x39')]=function(_0x98ece0){var _0x34e400=this;return new Promise(function(_0x959c4a,_0x5cbe20){db['CmContact'][_0xdbbf('0x20')]()['then'](function(_0x1d4425){return db[_0xdbbf('0x5')]['findAll']({'raw':_0x98ece0[_0xdbbf('0x7')]?_0x98ece0[_0xdbbf('0x7')][_0xdbbf('0x8')]===undefined?!![]:![]:!![],'where':_0x98ece0[_0xdbbf('0x7')]?_0x98ece0[_0xdbbf('0x7')][_0xdbbf('0x9')]||null:null,'attributes':_0x98ece0[_0xdbbf('0x7')]?_0x98ece0['options'][_0xdbbf('0xa')]||null:null,'limit':_0x98ece0[_0xdbbf('0x7')]?_0x98ece0['options'][_0xdbbf('0xb')]||null:null,'include':_0x98ece0[_0xdbbf('0x7')]?_0x98ece0[_0xdbbf('0x7')]['include']?_[_0xdbbf('0xe')](_0x98ece0['options'][_0xdbbf('0xc')],function(_0x57238b){return{'model':db[_0x57238b[_0xdbbf('0xd')]],'as':_0x57238b['as'],'attributes':_0x57238b['as']===_0xdbbf('0x3a')?_['keys'](_0x1d4425):_0x57238b[_0xdbbf('0xa')],'include':_0x57238b['include']?_['map'](_0x57238b['include'],function(_0xbefa5){return{'model':db[_0xbefa5['model']],'as':_0xbefa5['as'],'attributes':_0xbefa5[_0xdbbf('0xa')],'include':_0xbefa5[_0xdbbf('0xc')]?_[_0xdbbf('0xe')](_0xbefa5[_0xdbbf('0xc')],function(_0xb9f9f8){return{'model':db[_0xb9f9f8[_0xdbbf('0xd')]],'as':_0xb9f9f8['as'],'attributes':_0xb9f9f8[_0xdbbf('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x356606){logger[_0xdbbf('0xf')]('GetCmHopper',_0x98ece0);logger[_0xdbbf('0x10')](_0xdbbf('0x4'),_0x98ece0,JSON['stringify'](_0x356606));_0x959c4a(_0x356606);})[_0xdbbf('0x12')](function(_0x1034f1){logger[_0xdbbf('0x16')]('GetCmHopper',_0x1034f1[_0xdbbf('0x13')],_0x98ece0);_0x5cbe20(_0x34e400['error'](0x1f4,_0x1034f1['message']));});});});};exports[_0xdbbf('0x3b')]=function(_0x14880e){var _0x51db9f=this;return new Promise(function(_0x480b18,_0x39fb9b){return db[_0xdbbf('0x1f')][_0xdbbf('0x3c')]({'raw':!![],'where':{'phone':_0x14880e[_0xdbbf('0x7')][_0xdbbf('0x9')]['phone']},'attributes':['id',_0xdbbf('0x3d')],'order':[['id',_0xdbbf('0x3e')]]})[_0xdbbf('0x14')](function(_0x4a25e3){logger['info']('getContactByPhone',_0x14880e);logger[_0xdbbf('0x10')](_0xdbbf('0x3f'),_0x14880e,JSON['stringify'](_0x4a25e3));_0x480b18(_0x4a25e3);})[_0xdbbf('0x12')](function(_0x142e97){logger[_0xdbbf('0x16')](_0xdbbf('0x3f'),_0x142e97['message'],_0x14880e);_0x39fb9b(_0x51db9f[_0xdbbf('0x16')](0x1f4,_0x142e97['message']));});});};exports[_0xdbbf('0x40')]=function(_0x515149){var _0xc8874a=this;return new Promise(function(_0x1721b1,_0x45b9b9){return db[_0xdbbf('0x21')]['transaction'](function(_0x10bbec){var _0x137755=_0x515149['options']&&_0x515149[_0xdbbf('0x7')][_0xdbbf('0x9')]?_0x515149[_0xdbbf('0x7')][_0xdbbf('0x9')]:{};return db[_0xdbbf('0x5')][_0xdbbf('0x28')](_0x515149[_0xdbbf('0x18')],{'where':_0x137755,'transaction':_0x10bbec})[_0xdbbf('0x14')](function(_0x8275eb){logger[_0xdbbf('0xf')](_0xdbbf('0x40'),_0x515149);logger['debug'](_0xdbbf('0x40'),_0x515149,JSON[_0xdbbf('0x11')](_0x8275eb));_0x1721b1(_0x8275eb);})[_0xdbbf('0x12')](function(_0x28206d){logger[_0xdbbf('0x16')](_0xdbbf('0x40'),_0x28206d[_0xdbbf('0x13')],_0x515149);_0x45b9b9(_0xc8874a[_0xdbbf('0x16')](0x1f4,_0x28206d[_0xdbbf('0x13')]));});});});};exports[_0xdbbf('0x41')]=function(_0xd9ca2b){var _0x47b7c6=this;var _0xd48f5c=_0xd9ca2b[_0xdbbf('0x18')][_0xdbbf('0x9')][_0xdbbf('0x42')];var _0x3dc80d=_0xd9ca2b[_0xdbbf('0x18')][_0xdbbf('0x9')]['interval'];var _0x17b542=_0xd9ca2b['body'][_0xdbbf('0x9')][_0xdbbf('0x43')];return new Promise(function(_0x4a4968,_0x3667bb){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0xd48f5c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xdbbf('0x21')][_0xdbbf('0x31')](_0xdbbf('0x44')+_0x3dc80d+_0xdbbf('0x45')),'$gt':db[_0xdbbf('0x21')]['literal'](_0xdbbf('0x46'))}},'UserId':{'$in':_0x17b542}},'include':[{'model':db[_0xdbbf('0x1f')],'as':_0xdbbf('0x3a')},{'model':db[_0xdbbf('0x47')],'as':_0xdbbf('0x25'),'attributes':['id','name','voicePause']},{'model':db[_0xdbbf('0x48')],'as':'List'}]})[_0xdbbf('0x14')](function(_0x2b5b79){if(_0x2b5b79[_0xdbbf('0x26')]>0x0){return db[_0xdbbf('0x21')]['transaction'](function(_0x235b32){return db[_0xdbbf('0x5')][_0xdbbf('0x28')]({'recallmeNotifiedDate':db[_0xdbbf('0x21')][_0xdbbf('0x31')](_0xdbbf('0x46'))},{'where':{'id':{'$in':_[_0xdbbf('0xe')](_0x2b5b79,'id')}},'transaction':_0x235b32})[_0xdbbf('0x14')](function(){_0x4a4968(_0x2b5b79);})[_0xdbbf('0x12')](function(_0x494cd3){logger[_0xdbbf('0x16')]('CmHopperHandlePreviewRecallNotifications',_0x494cd3['message'],_0xd9ca2b);_0x3667bb(_0x47b7c6[_0xdbbf('0x16')](0x1f4,_0x494cd3[_0xdbbf('0x13')]));});})[_0xdbbf('0x12')](function(_0x44132f){logger[_0xdbbf('0x16')](_0xdbbf('0x41'),_0x44132f[_0xdbbf('0x13')],_0xd9ca2b);_0x3667bb(_0x47b7c6['error'](0x1f4,_0x44132f[_0xdbbf('0x13')]));});}else{_0x4a4968(_0x2b5b79);}});});}; \ No newline at end of file +var _0x72e6=['message','find','raw','ShowCmHopper','CreateCmHopper','create','body','info','UpdateCmHopper','update','then','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','User','name','voicePause','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','UserId','GetCmHopperPreview','describe','keys','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','Agent','CmList','List','bluebird','../../mysqldb','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','map','model','include','debug','stringify','catch','error'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x72e6,0xda));var _0x672e=function(_0x5a3475,_0x18becb){_0x5a3475=_0x5a3475-0x0;var _0x565c69=_0x72e6[_0x5a3475];return _0x565c69;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x672e('0x0'));var db=require(_0x672e('0x1'))['db'];var logger=require('../../config/logger')('rpc');exports[_0x672e('0x2')]=function(_0x136fd9){var _0x47e5ab=this;return new Promise(function(_0x52d380,_0x48aff2){return db[_0x672e('0x3')][_0x672e('0x4')]({'raw':_0x136fd9[_0x672e('0x5')]?_0x136fd9[_0x672e('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x136fd9[_0x672e('0x5')]?_0x136fd9[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0x136fd9[_0x672e('0x5')]?_0x136fd9['options'][_0x672e('0x7')]||null:null,'limit':_0x136fd9[_0x672e('0x5')]?_0x136fd9[_0x672e('0x5')][_0x672e('0x8')]||null:null,'include':_0x136fd9[_0x672e('0x5')]?_0x136fd9[_0x672e('0x5')]['include']?_[_0x672e('0x9')](_0x136fd9[_0x672e('0x5')]['include'],function(_0x34cd83){return{'model':db[_0x34cd83[_0x672e('0xa')]],'as':_0x34cd83['as'],'attributes':_0x34cd83['attributes'],'include':_0x34cd83['include']?_['map'](_0x34cd83[_0x672e('0xb')],function(_0x16ef09){return{'model':db[_0x16ef09['model']],'as':_0x16ef09['as'],'attributes':_0x16ef09['attributes'],'include':_0x16ef09[_0x672e('0xb')]?_[_0x672e('0x9')](_0x16ef09[_0x672e('0xb')],function(_0x4fdbab){return{'model':db[_0x4fdbab[_0x672e('0xa')]],'as':_0x4fdbab['as'],'attributes':_0x4fdbab[_0x672e('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d735a){logger['info'](_0x672e('0x2'),_0x136fd9);logger[_0x672e('0xc')](_0x672e('0x2'),_0x136fd9,JSON[_0x672e('0xd')](_0x2d735a));_0x52d380(_0x2d735a);})[_0x672e('0xe')](function(_0x39ce4d){logger[_0x672e('0xf')](_0x672e('0x2'),_0x39ce4d[_0x672e('0x10')],_0x136fd9);_0x48aff2(_0x47e5ab['error'](0x1f4,_0x39ce4d['message']));});});};exports['ShowCmHopper']=function(_0x4a6166){var _0x31b497=this;return new Promise(function(_0x15733c,_0x47e92c){return db[_0x672e('0x3')][_0x672e('0x11')]({'raw':_0x4a6166[_0x672e('0x5')]?_0x4a6166[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![],'where':_0x4a6166['options']?_0x4a6166[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0x4a6166[_0x672e('0x5')]?_0x4a6166[_0x672e('0x5')][_0x672e('0x7')]||null:null,'include':_0x4a6166['options']?_0x4a6166[_0x672e('0x5')][_0x672e('0xb')]?_[_0x672e('0x9')](_0x4a6166[_0x672e('0x5')]['include'],function(_0x54c6fe){return{'model':db[_0x54c6fe['model']],'as':_0x54c6fe['as'],'attributes':_0x54c6fe[_0x672e('0x7')],'include':_0x54c6fe[_0x672e('0xb')]?_[_0x672e('0x9')](_0x54c6fe[_0x672e('0xb')],function(_0x281d37){return{'model':db[_0x281d37[_0x672e('0xa')]],'as':_0x281d37['as'],'attributes':_0x281d37[_0x672e('0x7')],'include':_0x281d37['include']?_[_0x672e('0x9')](_0x281d37['include'],function(_0x309459){return{'model':db[_0x309459[_0x672e('0xa')]],'as':_0x309459['as'],'attributes':_0x309459[_0x672e('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b200a){logger['info'](_0x672e('0x13'),_0x4a6166);logger[_0x672e('0xc')](_0x672e('0x13'),_0x4a6166,JSON[_0x672e('0xd')](_0x2b200a));_0x15733c(_0x2b200a);})[_0x672e('0xe')](function(_0x536e33){logger[_0x672e('0xf')](_0x672e('0x13'),_0x536e33[_0x672e('0x10')],_0x4a6166);_0x47e92c(_0x31b497['error'](0x1f4,_0x536e33[_0x672e('0x10')]));});});};exports[_0x672e('0x14')]=function(_0x23ebc2){var _0xc5c4c7=this;return new Promise(function(_0x5a77ba,_0x5d106e){return db[_0x672e('0x3')][_0x672e('0x15')](_0x23ebc2[_0x672e('0x16')],{'raw':_0x23ebc2['options']?_0x23ebc2[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![]})['then'](function(_0x1b8b2c){logger[_0x672e('0x17')](_0x672e('0x14'),_0x23ebc2);logger[_0x672e('0xc')](_0x672e('0x14'),_0x23ebc2,JSON[_0x672e('0xd')](_0x1b8b2c));_0x5a77ba(_0x1b8b2c);})['catch'](function(_0x112dc3){logger[_0x672e('0xf')](_0x672e('0x14'),_0x112dc3['message'],_0x23ebc2);_0x5d106e(_0xc5c4c7[_0x672e('0xf')](0x1f4,_0x112dc3[_0x672e('0x10')]));});});};exports[_0x672e('0x18')]=function(_0x4ca859){var _0x534909=this;return new Promise(function(_0x21ae28,_0x5c5d1c){return db[_0x672e('0x3')][_0x672e('0x19')](_0x4ca859[_0x672e('0x16')],{'raw':_0x4ca859[_0x672e('0x5')]?_0x4ca859[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ca859[_0x672e('0x5')]?_0x4ca859[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0x4ca859[_0x672e('0x5')]?_0x4ca859[_0x672e('0x5')][_0x672e('0x7')]||null:null,'limit':_0x4ca859['options']?_0x4ca859[_0x672e('0x5')][_0x672e('0x8')]||null:null})[_0x672e('0x1a')](function(_0x57fada){logger[_0x672e('0x17')](_0x672e('0x18'),_0x4ca859);logger[_0x672e('0x17')](_0x672e('0x1b'),JSON[_0x672e('0xd')](_0x4ca859[_0x672e('0x5')]['where']),_0x4ca859[_0x672e('0x16')][_0x672e('0x1c')]);logger[_0x672e('0xc')](_0x672e('0x18'),_0x4ca859,JSON['stringify'](_0x57fada));_0x21ae28(_0x57fada);})[_0x672e('0xe')](function(_0x1b2c97){logger[_0x672e('0xf')](_0x672e('0x18'),_0x1b2c97[_0x672e('0x10')],_0x4ca859);_0x5c5d1c(_0x534909['error'](0x1f4,_0x1b2c97['message']));});});};exports[_0x672e('0x1d')]=function(_0x28fc25){var _0x583f22=this;return new Promise(function(_0x309829,_0x8e1bae){return db[_0x672e('0x3')][_0x672e('0x1e')]({'where':_0x28fc25[_0x672e('0x5')]?_0x28fc25[_0x672e('0x5')]['where']||null:null})[_0x672e('0x1a')](function(_0x34050d){logger[_0x672e('0x17')]('DestroyCmHopper',_0x28fc25);logger[_0x672e('0xc')](_0x672e('0x1d'),_0x28fc25,JSON[_0x672e('0xd')](_0x34050d));_0x309829(_0x34050d);})[_0x672e('0xe')](function(_0x3ed5df){logger['error']('DestroyCmHopper',_0x3ed5df[_0x672e('0x10')],_0x28fc25);_0x8e1bae(_0x583f22[_0x672e('0xf')](0x1f4,_0x3ed5df[_0x672e('0x10')]));});});};exports[_0x672e('0x1f')]=function(_0x44ddf6){var _0x36f2fa=this;return new Promise(function(_0x495bcd,_0x218cbb){return db[_0x672e('0x20')]['describe']()[_0x672e('0x1a')](function(_0x1d18db){return db[_0x672e('0x21')][_0x672e('0x22')](function(_0x436e29){return db[_0x672e('0x3')][_0x672e('0x4')]({'where':_0x44ddf6[_0x672e('0x5')]?_0x44ddf6[_0x672e('0x5')]['where']||null:null,'attributes':_0x44ddf6[_0x672e('0x5')]?_0x44ddf6[_0x672e('0x5')][_0x672e('0x7')]||null:null,'limit':_0x44ddf6[_0x672e('0x5')]?_0x44ddf6['options'][_0x672e('0x8')]||null:null,'order':_0x44ddf6[_0x672e('0x5')]?_0x44ddf6[_0x672e('0x5')][_0x672e('0x23')]||null:null,'transaction':_0x436e29,'lock':_0x436e29[_0x672e('0x24')][_0x672e('0x25')],'include':[{'model':db[_0x672e('0x20')],'as':_0x672e('0x26'),'attributes':_['keys'](_0x1d18db)},{'model':db[_0x672e('0x27')],'as':'Agent','attributes':['id',_0x672e('0x28'),_0x672e('0x29')]}]})['then'](function(_0x5eeef8){var _0x1bd01d=[];var _0x40d9d3=[];for(var _0x11d130=0x0;_0x11d130<_0x5eeef8['length'];_0x11d130+=0x1){var _0x4adb2f=_0x5eeef8[_0x11d130]['UserId'];if(_0x4adb2f===null){_0x1bd01d[_0x672e('0x2a')](_0x5eeef8[_0x11d130]['update'](_0x44ddf6[_0x672e('0x16')],{'transaction':_0x436e29}));}else if(!_0x40d9d3[_0x672e('0x2b')](_0x4adb2f)){_0x40d9d3[_0x672e('0x2a')](_0x4adb2f);_0x1bd01d[_0x672e('0x2a')](_0x5eeef8[_0x11d130][_0x672e('0x19')](_0x44ddf6[_0x672e('0x16')],{'transaction':_0x436e29}));}}return BPromise[_0x672e('0x2c')](_0x1bd01d);});})[_0x672e('0x1a')](function(_0x26fa80){logger[_0x672e('0x17')](_0x672e('0x1f'),_0x44ddf6);if(_0x26fa80[_0x672e('0x2d')]>0x0){logger[_0x672e('0x17')](_0x672e('0x2e'),_0x26fa80[0x0][_0x672e('0x2f')]['id'],_0x26fa80[0x0]['dataValues'][_0x672e('0x30')],_0x26fa80[0x0][_0x672e('0x2f')][_0x672e('0x1c')]);}logger['debug']('GetContactDialer',_0x44ddf6,JSON[_0x672e('0xd')](_0x26fa80));_0x495bcd(_0x26fa80);})[_0x672e('0xe')](function(_0x2f33ca){logger['error'](_0x672e('0x1f'),_0x2f33ca[_0x672e('0x10')],_0x44ddf6);_0x218cbb(_0x36f2fa[_0x672e('0xf')](0x1f4,_0x2f33ca['message']));});});});};exports['MoveContactManagedDialer']=function(_0xd69d41){var _0x746d04=this;return new Promise(function(_0x39a2f8,_0x92765d){return db[_0x672e('0x21')]['transaction'](function(_0x472e79){return db[_0x672e('0x31')][_0x672e('0x15')](_0xd69d41[_0x672e('0x16')],{'raw':_0xd69d41['options']?_0xd69d41[_0x672e('0x5')]['raw']===undefined?!![]:![]:!![],'transaction':_0x472e79})[_0x672e('0x1a')](function(){logger[_0x672e('0x17')](_0x672e('0x32'),JSON['stringify'](_0xd69d41[_0x672e('0x5')][_0x672e('0x6')]),_0xd69d41[_0x672e('0x5')][_0x672e('0x6')][_0x672e('0x1c')]);return db[_0x672e('0x3')][_0x672e('0x1e')]({'where':_0xd69d41[_0x672e('0x5')]?_0xd69d41[_0x672e('0x5')][_0x672e('0x6')]||null:null,'transaction':_0x472e79});});})[_0x672e('0x1a')](function(_0x2bfacd){logger['info']('MoveContactManagedDialer',_0xd69d41);logger[_0x672e('0xc')](_0x672e('0x33'),_0xd69d41,JSON[_0x672e('0xd')](_0x2bfacd));_0x39a2f8(_0x2bfacd);})['catch'](function(_0x31ad7b){logger[_0x672e('0xf')](_0x672e('0x33'),_0x31ad7b[_0x672e('0x10')],_0xd69d41);_0x92765d(_0x746d04['error'](0x1f4,_0x31ad7b[_0x672e('0x10')]));});});};exports[_0x672e('0x34')]=function(_0x10c734){var _0x3cfc54=this;return new Promise(function(_0x570b4d,_0x417765){return db[_0x672e('0x3')]['findAll']({'raw':_0x10c734['options']?_0x10c734[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![],'where':_0x10c734['options']?_0x10c734[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':[[db[_0x672e('0x21')]['fn'](_0x672e('0x35'),db['sequelize']['fn']('IF',db[_0x672e('0x21')][_0x672e('0x36')](_0x672e('0x37')+util[_0x672e('0x38')](_0x672e('0x39'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x672e('0x3a')))),'contactsRescheduled']]})['then'](function(_0x5c44b8){logger[_0x672e('0x17')](_0x672e('0x34'),_0x10c734);logger[_0x672e('0xc')](_0x672e('0x34'),_0x10c734,JSON[_0x672e('0xd')](_0x5c44b8));_0x570b4d(_0x5c44b8);})['catch'](function(_0x377f93){logger[_0x672e('0xf')](_0x672e('0x34'),_0x377f93[_0x672e('0x10')],_0x10c734);_0x417765(_0x3cfc54[_0x672e('0xf')](0x1f4,_0x377f93[_0x672e('0x10')]));});});};exports[_0x672e('0x3b')]=function(_0xd10306){var _0x5555d6=this;return new Promise(function(_0x12df60,_0x887c8a){return db[_0x672e('0x20')]['describe']()[_0x672e('0x1a')](function(){return db[_0x672e('0x21')][_0x672e('0x22')](function(_0x56659d){return db['CmHopper'][_0x672e('0x4')]({'where':_0xd10306[_0x672e('0x5')]?_0xd10306[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0xd10306[_0x672e('0x5')]?_0xd10306[_0x672e('0x5')][_0x672e('0x7')]||null:null,'limit':0x1,'order':_0xd10306[_0x672e('0x5')]?_0xd10306['options'][_0x672e('0x23')]||null:null,'group':db['CmHopper'][_0x672e('0x3c')],'transaction':_0x56659d,'lock':_0x56659d['LOCK']['UPDATE'],'include':_0xd10306['options']?_0xd10306['options'][_0x672e('0xb')]?_[_0x672e('0x9')](_0xd10306['options']['include'],function(_0x5835bd){return{'model':db[_0x5835bd[_0x672e('0xa')]],'as':_0x5835bd['as'],'attributes':_0x5835bd[_0x672e('0x7')],'include':_0x5835bd[_0x672e('0xb')]?_['map'](_0x5835bd[_0x672e('0xb')],function(_0x1bce30){return{'model':db[_0x1bce30[_0x672e('0xa')]],'as':_0x1bce30['as'],'attributes':_0x1bce30[_0x672e('0x7')],'include':_0x1bce30[_0x672e('0xb')]?_[_0x672e('0x9')](_0x1bce30[_0x672e('0xb')],function(_0x3095c1){return{'model':db[_0x3095c1[_0x672e('0xa')]],'as':_0x3095c1['as'],'attributes':_0x3095c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2336b3){var _0x13ad78=[];for(var _0x1ef372=0x0;_0x1ef372<_0x2336b3[_0x672e('0x2d')];_0x1ef372+=0x1){_0x13ad78['push'](_0x2336b3[_0x1ef372][_0x672e('0x19')](_0xd10306[_0x672e('0x16')],{'transaction':_0x56659d}));}return BPromise[_0x672e('0x2c')](_0x13ad78);});})[_0x672e('0x1a')](function(_0x4adc29){logger[_0x672e('0x17')](_0x672e('0x3b'),_0xd10306);logger['debug'](_0x672e('0x3b'),_0xd10306,JSON['stringify'](_0x4adc29));_0x12df60(_0x4adc29);})[_0x672e('0xe')](function(_0x2cf415){logger[_0x672e('0xf')](_0x672e('0x3b'),_0x2cf415[_0x672e('0x10')],_0xd10306);_0x887c8a(_0x5555d6[_0x672e('0xf')](0x1f4,_0x2cf415[_0x672e('0x10')]));});});});};exports[_0x672e('0x3d')]=function(_0x587084){var _0xc7b83c=this;return new Promise(function(_0x53a88d,_0x4eba70){db[_0x672e('0x20')][_0x672e('0x3e')]()['then'](function(_0x1b0a08){return db[_0x672e('0x3')][_0x672e('0x4')]({'raw':_0x587084[_0x672e('0x5')]?_0x587084[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![],'where':_0x587084[_0x672e('0x5')]?_0x587084[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0x587084['options']?_0x587084[_0x672e('0x5')][_0x672e('0x7')]||null:null,'limit':_0x587084['options']?_0x587084['options'][_0x672e('0x8')]||null:null,'include':_0x587084[_0x672e('0x5')]?_0x587084['options'][_0x672e('0xb')]?_['map'](_0x587084['options'][_0x672e('0xb')],function(_0x45ecb0){return{'model':db[_0x45ecb0[_0x672e('0xa')]],'as':_0x45ecb0['as'],'attributes':_0x45ecb0['as']===_0x672e('0x26')?_[_0x672e('0x3f')](_0x1b0a08):_0x45ecb0[_0x672e('0x7')],'include':_0x45ecb0['include']?_[_0x672e('0x9')](_0x45ecb0['include'],function(_0x47cc14){return{'model':db[_0x47cc14[_0x672e('0xa')]],'as':_0x47cc14['as'],'attributes':_0x47cc14[_0x672e('0x7')],'include':_0x47cc14[_0x672e('0xb')]?_[_0x672e('0x9')](_0x47cc14[_0x672e('0xb')],function(_0xa0c316){return{'model':db[_0xa0c316['model']],'as':_0xa0c316['as'],'attributes':_0xa0c316[_0x672e('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x572ccd){logger['info'](_0x672e('0x2'),_0x587084);logger[_0x672e('0xc')](_0x672e('0x2'),_0x587084,JSON[_0x672e('0xd')](_0x572ccd));_0x53a88d(_0x572ccd);})[_0x672e('0xe')](function(_0x40b465){logger['error'](_0x672e('0x2'),_0x40b465[_0x672e('0x10')],_0x587084);_0x4eba70(_0xc7b83c[_0x672e('0xf')](0x1f4,_0x40b465[_0x672e('0x10')]));});});});};exports[_0x672e('0x40')]=function(_0x521996){var _0x107e13=this;return new Promise(function(_0x1cf89d,_0x412864){return db[_0x672e('0x20')][_0x672e('0x41')]({'raw':!![],'where':{'phone':_0x521996['options'][_0x672e('0x6')][_0x672e('0x42')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})['then'](function(_0x371df6){logger[_0x672e('0x17')](_0x672e('0x43'),_0x521996);logger[_0x672e('0xc')](_0x672e('0x43'),_0x521996,JSON[_0x672e('0xd')](_0x371df6));_0x1cf89d(_0x371df6);})['catch'](function(_0x1b50a0){logger[_0x672e('0xf')](_0x672e('0x43'),_0x1b50a0['message'],_0x521996);_0x412864(_0x107e13[_0x672e('0xf')](0x1f4,_0x1b50a0[_0x672e('0x10')]));});});};exports[_0x672e('0x44')]=function(_0x1c512c){var _0xc8b304=this;return new Promise(function(_0x367daf,_0x3bd048){return db['sequelize'][_0x672e('0x22')](function(_0x479ada){var _0x412318=_0x1c512c[_0x672e('0x5')]&&_0x1c512c[_0x672e('0x5')]['where']?_0x1c512c[_0x672e('0x5')][_0x672e('0x6')]:{};return db[_0x672e('0x3')][_0x672e('0x19')](_0x1c512c['body'],{'where':_0x412318,'transaction':_0x479ada})[_0x672e('0x1a')](function(_0x3612ca){logger[_0x672e('0x17')](_0x672e('0x44'),_0x1c512c);logger[_0x672e('0xc')]('ResetActiveCalls',_0x1c512c,JSON[_0x672e('0xd')](_0x3612ca));_0x367daf(_0x3612ca);})[_0x672e('0xe')](function(_0x137c50){logger[_0x672e('0xf')](_0x672e('0x44'),_0x137c50[_0x672e('0x10')],_0x1c512c);_0x3bd048(_0xc8b304[_0x672e('0xf')](0x1f4,_0x137c50[_0x672e('0x10')]));});});});};exports[_0x672e('0x45')]=function(_0x1bc94e){var _0x282cfc=this;var _0xb64289=_0x1bc94e[_0x672e('0x16')][_0x672e('0x6')][_0x672e('0x46')];var _0x27073d=_0x1bc94e['body'][_0x672e('0x6')][_0x672e('0x47')];var _0x16d02a=_0x1bc94e[_0x672e('0x16')][_0x672e('0x6')][_0x672e('0x48')];return new Promise(function(_0x443cdb,_0x3f8dec){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0xb64289},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x672e('0x21')][_0x672e('0x36')](_0x672e('0x49')+_0x27073d+_0x672e('0x4a')),'$gt':db['sequelize']['literal']('NOW()')}},'UserId':{'$in':_0x16d02a}},'include':[{'model':db[_0x672e('0x20')],'as':_0x672e('0x26')},{'model':db[_0x672e('0x27')],'as':_0x672e('0x4b'),'attributes':['id',_0x672e('0x28'),_0x672e('0x29')]},{'model':db[_0x672e('0x4c')],'as':_0x672e('0x4d')}]})[_0x672e('0x1a')](function(_0x314c7c){if(_0x314c7c[_0x672e('0x2d')]>0x0){return db['sequelize'][_0x672e('0x22')](function(_0x2641e5){return db[_0x672e('0x3')]['update']({'recallmeNotifiedDate':db[_0x672e('0x21')][_0x672e('0x36')]('NOW()')},{'where':{'id':{'$in':_[_0x672e('0x9')](_0x314c7c,'id')}},'transaction':_0x2641e5})['then'](function(){_0x443cdb(_0x314c7c);})['catch'](function(_0x305303){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x305303[_0x672e('0x10')],_0x1bc94e);_0x3f8dec(_0x282cfc['error'](0x1f4,_0x305303['message']));});})[_0x672e('0xe')](function(_0x1d331e){logger[_0x672e('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x1d331e[_0x672e('0x10')],_0x1bc94e);_0x3f8dec(_0x282cfc[_0x672e('0xf')](0x1f4,_0x1d331e[_0x672e('0x10')]));});}else{_0x443cdb(_0x314c7c);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 014040c..605c3f0 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 _0x8945=['describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','getPreviewRecall','post','create','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','express','../../components/auth/service','./cmHopper.controller','get','index','isAuthenticated'];(function(_0x31d87a,_0x40dcba){var _0x245c35=function(_0x475e6e){while(--_0x475e6e){_0x31d87a['push'](_0x31d87a['shift']());}};_0x245c35(++_0x40dcba);}(_0x8945,0x16a));var _0x5894=function(_0x2418eb,_0xfdb4fa){_0x2418eb=_0x2418eb-0x0;var _0x2d1720=_0x8945[_0x2418eb];return _0x2d1720;};'use strict';var express=require(_0x5894('0x0'));var router=express['Router']();var auth=require(_0x5894('0x1'));var controller=require(_0x5894('0x2'));router[_0x5894('0x3')]('/',auth['isAuthenticated'](),controller[_0x5894('0x4')]);router['get']('/describe',auth[_0x5894('0x5')](),controller[_0x5894('0x6')]);router[_0x5894('0x3')](_0x5894('0x7'),auth[_0x5894('0x5')](),controller[_0x5894('0x8')]);router[_0x5894('0x3')]('/timezones',auth['isAuthenticated'](),controller[_0x5894('0x9')]);router[_0x5894('0x3')](_0x5894('0xa'),auth[_0x5894('0x5')](),controller[_0x5894('0xb')]);router[_0x5894('0x3')]('/:id/previewrecall',auth[_0x5894('0x5')](),controller[_0x5894('0xc')]);router[_0x5894('0xd')]('/',auth[_0x5894('0x5')](),controller[_0x5894('0xe')]);router['post']('/preview',auth[_0x5894('0x5')](),controller[_0x5894('0xf')]);router['post'](_0x5894('0x10'),auth['isAuthenticated'](),controller[_0x5894('0x11')]);router[_0x5894('0x12')]('/:id',auth[_0x5894('0x5')](),controller[_0x5894('0x13')]);router[_0x5894('0x14')](_0x5894('0xa'),auth[_0x5894('0x5')](),controller[_0x5894('0x15')]);module[_0x5894('0x16')]=router; \ No newline at end of file +var _0x55e8=['exports','Router','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','delete','destroy'];(function(_0x3c6443,_0xa2d657){var _0x2e3899=function(_0x33329a){while(--_0x33329a){_0x3c6443['push'](_0x3c6443['shift']());}};_0x2e3899(++_0xa2d657);}(_0x55e8,0x16a));var _0x855e=function(_0x3e1234,_0x5377b7){_0x3e1234=_0x3e1234-0x0;var _0x56ac40=_0x55e8[_0x3e1234];return _0x56ac40;};'use strict';var express=require('express');var router=express[_0x855e('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x855e('0x1'));router[_0x855e('0x2')]('/',auth[_0x855e('0x3')](),controller[_0x855e('0x4')]);router['get']('/describe',auth[_0x855e('0x3')](),controller['describe']);router['get'](_0x855e('0x5'),auth[_0x855e('0x3')](),controller['getOpenContacts']);router[_0x855e('0x2')]('/timezones',auth[_0x855e('0x3')](),controller[_0x855e('0x6')]);router[_0x855e('0x2')](_0x855e('0x7'),auth[_0x855e('0x3')](),controller['show']);router[_0x855e('0x2')](_0x855e('0x8'),auth[_0x855e('0x3')](),controller[_0x855e('0x9')]);router[_0x855e('0xa')]('/',auth[_0x855e('0x3')](),controller[_0x855e('0xb')]);router[_0x855e('0xa')](_0x855e('0xc'),auth[_0x855e('0x3')](),controller[_0x855e('0xd')]);router['post'](_0x855e('0xe'),auth[_0x855e('0x3')](),controller[_0x855e('0xf')]);router['put'](_0x855e('0x7'),auth[_0x855e('0x3')](),controller['update']);router[_0x855e('0x10')](_0x855e('0x7'),auth['isAuthenticated'](),controller[_0x855e('0x11')]);module[_0x855e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 75e0fdc..28b0fc8 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 _0x49f3=['moment','sequelize','exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x49f3,0x150));var _0x349f=function(_0x457c41,_0x320aad){_0x457c41=_0x457c41-0x0;var _0x2f7a46=_0x49f3[_0x457c41];return _0x2f7a46;};'use strict';var moment=require(_0x349f('0x0'));var Sequelize=require(_0x349f('0x1'));module[_0x349f('0x2')]={'CmHopperId':{'type':Sequelize[_0x349f('0x3')]},'phone':{'type':Sequelize[_0x349f('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x349f('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x349f('0x5')](_0x349f('0x6'))},'countbusyretry':{'type':Sequelize[_0x349f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x349f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x349f('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x349f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x349f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3262=['format','sequelize','INTEGER','DATE'];(function(_0x15fef1,_0x21c57a){var _0x5f50a7=function(_0x320b83){while(--_0x320b83){_0x15fef1['push'](_0x15fef1['shift']());}};_0x5f50a7(++_0x21c57a);}(_0x3262,0xd9));var _0x2326=function(_0x2888a4,_0x1fc157){_0x2888a4=_0x2888a4-0x0;var _0x7f650c=_0x3262[_0x2888a4];return _0x7f650c;};'use strict';var moment=require('moment');var Sequelize=require(_0x2326('0x0'));module['exports']={'CmHopperId':{'type':Sequelize[_0x2326('0x1')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2326('0x2')],'defaultValue':moment()[_0x2326('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 95d487f..49bba89 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 _0x797a=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','destroy','error','stack','name','send','CmHopperAdditionalPhone','fieldName','type','key','model','map','query','intersection','fields','attributes','length','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','CmHopperAdditionalPhones','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2b5994,_0x1bf6e7){var _0x2f6a2c=function(_0x458593){while(--_0x458593){_0x2b5994['push'](_0x2b5994['shift']());}};_0x2f6a2c(++_0x1bf6e7);}(_0x797a,0x1d9));var _0xa797=function(_0x1d01e1,_0x42f4a3){_0x1d01e1=_0x1d01e1-0x0;var _0x204cc1=_0x797a[_0x1d01e1];return _0x204cc1;};'use strict';var emlformat=require(_0xa797('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa797('0x1'));var jsonpatch=require(_0xa797('0x2'));var rp=require('request-promise');var moment=require(_0xa797('0x3'));var BPromise=require(_0xa797('0x4'));var Mustache=require(_0xa797('0x5'));var util=require(_0xa797('0x6'));var path=require(_0xa797('0x7'));var sox=require(_0xa797('0x8'));var csv=require(_0xa797('0x9'));var ejs=require(_0xa797('0xa'));var fs=require('fs');var fs_extra=require(_0xa797('0xb'));var _=require(_0xa797('0xc'));var squel=require(_0xa797('0xd'));var crypto=require(_0xa797('0xe'));var jsforce=require(_0xa797('0xf'));var deskjs=require(_0xa797('0x10'));var toCsv=require(_0xa797('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa797('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa797('0x12'));var as=require(_0xa797('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa797('0x14'))(_0xa797('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa797('0x16'));var db=require(_0xa797('0x17'))['db'];function respondWithStatusCode(_0x3fb1b0,_0x44e034){_0x44e034=_0x44e034||0xcc;return function(_0x2c0470){if(_0x2c0470){return _0x3fb1b0[_0xa797('0x18')](_0x44e034);}return _0x3fb1b0[_0xa797('0x19')](_0x44e034)[_0xa797('0x1a')]();};}function respondWithResult(_0x2c4026,_0x403efd){_0x403efd=_0x403efd||0xc8;return function(_0x361048){if(_0x361048){return _0x2c4026[_0xa797('0x19')](_0x403efd)[_0xa797('0x1b')](_0x361048);}};}function respondWithFilteredResult(_0x4333cd,_0x142011){return function(_0x39e63e){if(_0x39e63e){var _0x5a831a=typeof _0x142011[_0xa797('0x1c')]==='undefined'&&typeof _0x142011[_0xa797('0x1d')]==='undefined';var _0x4da649=_0x39e63e[_0xa797('0x1e')];var _0x391c10=_0x5a831a?0x0:_0x142011['offset'];var _0x3ce94a=_0x5a831a?_0x39e63e['count']:_0x142011['offset']+_0x142011[_0xa797('0x1d')];var _0x394b33;if(_0x3ce94a>=_0x4da649){_0x3ce94a=_0x4da649;_0x394b33=0xc8;}else{_0x394b33=0xce;}_0x4333cd[_0xa797('0x19')](_0x394b33);return _0x4333cd[_0xa797('0x1f')](_0xa797('0x20'),_0x391c10+'-'+_0x3ce94a+'/'+_0x4da649)[_0xa797('0x1b')](_0x39e63e);}return null;};}function patchUpdates(_0x207fa7){return function(_0x49750e){try{jsonpatch[_0xa797('0x21')](_0x49750e,_0x207fa7,!![]);}catch(_0x3d4988){return BPromise[_0xa797('0x22')](_0x3d4988);}return _0x49750e[_0xa797('0x23')]();};}function saveUpdates(_0x503537,_0x3751c8){return function(_0x10b666){if(_0x10b666){return _0x10b666[_0xa797('0x24')](_0x503537)[_0xa797('0x25')](function(_0x3fe8d2){return _0x3fe8d2;});}return null;};}function removeEntity(_0x15346d,_0x5e883f){return function(_0x9dbec8){if(_0x9dbec8){return _0x9dbec8['destroy']()[_0xa797('0x25')](function(){var _0x2187c6=_0x9dbec8[_0xa797('0x26')]({'plain':!![]});var _0x2eeb22='CmHopperAdditionalPhones';return db['UserProfileResource'][_0xa797('0x27')]({'where':{'type':_0x2eeb22,'resourceId':_0x2187c6['id']}})[_0xa797('0x25')](function(){return _0x9dbec8;});})[_0xa797('0x25')](function(){_0x15346d[_0xa797('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a9f9,_0x1bc781){return function(_0x41e8e5){if(!_0x41e8e5){_0x27a9f9['sendStatus'](0x194);}return _0x41e8e5;};}function handleError(_0x24bbd6,_0x4340f5){_0x4340f5=_0x4340f5||0x1f4;return function(_0x478837){logger[_0xa797('0x28')](_0x478837[_0xa797('0x29')]);if(_0x478837[_0xa797('0x2a')]){delete _0x478837[_0xa797('0x2a')];}_0x24bbd6[_0xa797('0x19')](_0x4340f5)[_0xa797('0x2b')](_0x478837);};}exports['index']=function(_0x38fab8,_0x55f47f){var _0x14f1b9={},_0x5efd35={},_0x55b221={'count':0x0,'rows':[]};var _0x17cbfa=_['map'](db[_0xa797('0x2c')]['rawAttributes'],function(_0x13a086){return{'name':_0x13a086[_0xa797('0x2d')],'type':_0x13a086[_0xa797('0x2e')][_0xa797('0x2f')]};});_0x5efd35[_0xa797('0x30')]=_[_0xa797('0x31')](_0x17cbfa,_0xa797('0x2a'));_0x5efd35[_0xa797('0x32')]=_['keys'](_0x38fab8['query']);_0x5efd35['filters']=_[_0xa797('0x33')](_0x5efd35[_0xa797('0x30')],_0x5efd35[_0xa797('0x32')]);_0x14f1b9['attributes']=_[_0xa797('0x33')](_0x5efd35[_0xa797('0x30')],qs[_0xa797('0x34')](_0x38fab8[_0xa797('0x32')][_0xa797('0x34')]));_0x14f1b9[_0xa797('0x35')]=_0x14f1b9['attributes'][_0xa797('0x36')]?_0x14f1b9[_0xa797('0x35')]:_0x5efd35['model'];if(!_0x38fab8['query']['hasOwnProperty']('nolimit')){_0x14f1b9[_0xa797('0x1d')]=qs[_0xa797('0x1d')](_0x38fab8['query'][_0xa797('0x1d')]);_0x14f1b9[_0xa797('0x1c')]=qs['offset'](_0x38fab8[_0xa797('0x32')][_0xa797('0x1c')]);}_0x14f1b9[_0xa797('0x37')]=qs['sort'](_0x38fab8['query'][_0xa797('0x38')]);_0x14f1b9[_0xa797('0x39')]=qs[_0xa797('0x3a')](_['pick'](_0x38fab8[_0xa797('0x32')],_0x5efd35[_0xa797('0x3a')]),_0x17cbfa);if(_0x38fab8[_0xa797('0x32')]['filter']){_0x14f1b9[_0xa797('0x39')]=_[_0xa797('0x3b')](_0x14f1b9[_0xa797('0x39')],{'$or':_[_0xa797('0x31')](_0x17cbfa,function(_0x4d965f){if(_0x4d965f[_0xa797('0x2e')]!==_0xa797('0x3c')){var _0x56db34={};_0x56db34[_0x4d965f['name']]={'$like':'%'+_0x38fab8[_0xa797('0x32')][_0xa797('0x3d')]+'%'};return _0x56db34;}})});}_0x14f1b9=_[_0xa797('0x3b')]({},_0x14f1b9,_0x38fab8['options']);var _0x473ca5={'where':_0x14f1b9[_0xa797('0x39')]};return db[_0xa797('0x2c')][_0xa797('0x1e')](_0x473ca5)[_0xa797('0x25')](function(_0xeeafcc){_0x55b221[_0xa797('0x1e')]=_0xeeafcc;if(_0x38fab8[_0xa797('0x32')][_0xa797('0x3e')]){_0x14f1b9[_0xa797('0x3f')]=[{'all':!![]}];}return db[_0xa797('0x2c')]['findAll'](_0x14f1b9);})[_0xa797('0x25')](function(_0x15b383){_0x55b221[_0xa797('0x40')]=_0x15b383;return _0x55b221;})[_0xa797('0x25')](respondWithFilteredResult(_0x55f47f,_0x14f1b9))[_0xa797('0x41')](handleError(_0x55f47f,null));};exports[_0xa797('0x42')]=function(_0x3281ed,_0x6c83a6){var _0x2d8f69={'raw':!![],'where':{'id':_0x3281ed[_0xa797('0x43')]['id']}},_0x571312={};_0x571312[_0xa797('0x30')]=_[_0xa797('0x44')](db[_0xa797('0x2c')][_0xa797('0x45')]);_0x571312[_0xa797('0x32')]=_[_0xa797('0x44')](_0x3281ed['query']);_0x571312[_0xa797('0x3a')]=_[_0xa797('0x33')](_0x571312[_0xa797('0x30')],_0x571312[_0xa797('0x32')]);_0x2d8f69['attributes']=_[_0xa797('0x33')](_0x571312[_0xa797('0x30')],qs['fields'](_0x3281ed[_0xa797('0x32')][_0xa797('0x34')]));_0x2d8f69[_0xa797('0x35')]=_0x2d8f69[_0xa797('0x35')][_0xa797('0x36')]?_0x2d8f69[_0xa797('0x35')]:_0x571312[_0xa797('0x30')];if(_0x3281ed['query'][_0xa797('0x3e')]){_0x2d8f69[_0xa797('0x3f')]=[{'all':!![]}];}_0x2d8f69=_[_0xa797('0x3b')]({},_0x2d8f69,_0x3281ed[_0xa797('0x46')]);return db[_0xa797('0x2c')][_0xa797('0x47')](_0x2d8f69)[_0xa797('0x25')](handleEntityNotFound(_0x6c83a6,null))[_0xa797('0x25')](respondWithResult(_0x6c83a6,null))[_0xa797('0x41')](handleError(_0x6c83a6,null));};exports[_0xa797('0x48')]=function(_0x425949,_0x437e78){return db[_0xa797('0x2c')][_0xa797('0x48')](_0x425949[_0xa797('0x49')],{})[_0xa797('0x25')](function(_0x196dc7){var _0x57a21f=_0x425949['user']['get']({'plain':!![]});if(!_0x57a21f)throw new Error(_0xa797('0x4a'));if(_0x57a21f['role']===_0xa797('0x4b')){var _0x4e8175=_0x196dc7['get']({'plain':!![]});var _0xf08c4a=_0xa797('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0xf08c4a,'userProfileId':_0x57a21f['userProfileId']},'raw':!![]})[_0xa797('0x25')](function(_0x277851){if(_0x277851&&_0x277851[_0xa797('0x4d')]===0x0){return db[_0xa797('0x4e')][_0xa797('0x48')]({'name':_0x4e8175['name'],'resourceId':_0x4e8175['id'],'type':_0x277851[_0xa797('0x2a')],'sectionId':_0x277851['id']},{})[_0xa797('0x25')](function(){return _0x196dc7;});}else{return _0x196dc7;}})[_0xa797('0x41')](function(_0x47745f){logger[_0xa797('0x28')](_0xa797('0x4f'),_0x47745f);throw _0x47745f;});}return _0x196dc7;})[_0xa797('0x25')](respondWithResult(_0x437e78,0xc9))['catch'](handleError(_0x437e78,null));};exports['update']=function(_0x44bbfc,_0x49825d){if(_0x44bbfc[_0xa797('0x49')]['id']){delete _0x44bbfc['body']['id'];}return db['CmHopperAdditionalPhone'][_0xa797('0x47')]({'where':{'id':_0x44bbfc[_0xa797('0x43')]['id']}})[_0xa797('0x25')](handleEntityNotFound(_0x49825d,null))[_0xa797('0x25')](saveUpdates(_0x44bbfc[_0xa797('0x49')],null))['then'](respondWithResult(_0x49825d,null))[_0xa797('0x41')](handleError(_0x49825d,null));};exports[_0xa797('0x27')]=function(_0x42451c,_0x5e1796){return db['CmHopperAdditionalPhone'][_0xa797('0x47')]({'where':{'id':_0x42451c['params']['id']}})[_0xa797('0x25')](handleEntityNotFound(_0x5e1796,null))[_0xa797('0x25')](removeEntity(_0x5e1796,null))[_0xa797('0x41')](handleError(_0x5e1796,null));}; \ No newline at end of file +var _0x9200=['params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','create','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','update','body'];(function(_0x5f2f5d,_0x2acb71){var _0x38acbb=function(_0x4aa0f6){while(--_0x4aa0f6){_0x5f2f5d['push'](_0x5f2f5d['shift']());}};_0x38acbb(++_0x2acb71);}(_0x9200,0x192));var _0x0920=function(_0x48d1f4,_0x96793b){_0x48d1f4=_0x48d1f4-0x0;var _0x3fcc6b=_0x9200[_0x48d1f4];return _0x3fcc6b;};'use strict';var emlformat=require(_0x0920('0x0'));var rimraf=require(_0x0920('0x1'));var zipdir=require(_0x0920('0x2'));var jsonpatch=require(_0x0920('0x3'));var rp=require(_0x0920('0x4'));var moment=require('moment');var BPromise=require(_0x0920('0x5'));var Mustache=require(_0x0920('0x6'));var util=require('util');var path=require(_0x0920('0x7'));var sox=require(_0x0920('0x8'));var csv=require(_0x0920('0x9'));var ejs=require(_0x0920('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0920('0xb'));var squel=require(_0x0920('0xc'));var crypto=require(_0x0920('0xd'));var jsforce=require(_0x0920('0xe'));var deskjs=require(_0x0920('0xf'));var toCsv=require(_0x0920('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0920('0x10'));var authService=require(_0x0920('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0920('0x12'));var logger=require(_0x0920('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0920('0x14'));var licenseUtil=require(_0x0920('0x15'));var db=require(_0x0920('0x16'))['db'];function respondWithStatusCode(_0x10a483,_0x2fe4d){_0x2fe4d=_0x2fe4d||0xcc;return function(_0x1457a0){if(_0x1457a0){return _0x10a483[_0x0920('0x17')](_0x2fe4d);}return _0x10a483[_0x0920('0x18')](_0x2fe4d)[_0x0920('0x19')]();};}function respondWithResult(_0xb09497,_0x4e789e){_0x4e789e=_0x4e789e||0xc8;return function(_0x462abc){if(_0x462abc){return _0xb09497[_0x0920('0x18')](_0x4e789e)[_0x0920('0x1a')](_0x462abc);}};}function respondWithFilteredResult(_0x544443,_0x17fe94){return function(_0x4dd1fb){if(_0x4dd1fb){var _0x267210=typeof _0x17fe94['offset']===_0x0920('0x1b')&&typeof _0x17fe94[_0x0920('0x1c')]===_0x0920('0x1b');var _0x5831c9=_0x4dd1fb[_0x0920('0x1d')];var _0x4e41f5=_0x267210?0x0:_0x17fe94[_0x0920('0x1e')];var _0x444cc3=_0x267210?_0x4dd1fb[_0x0920('0x1d')]:_0x17fe94[_0x0920('0x1e')]+_0x17fe94[_0x0920('0x1c')];var _0x54983f;if(_0x444cc3>=_0x5831c9){_0x444cc3=_0x5831c9;_0x54983f=0xc8;}else{_0x54983f=0xce;}_0x544443['status'](_0x54983f);return _0x544443[_0x0920('0x1f')](_0x0920('0x20'),_0x4e41f5+'-'+_0x444cc3+'/'+_0x5831c9)[_0x0920('0x1a')](_0x4dd1fb);}return null;};}function patchUpdates(_0x23c662){return function(_0x23567e){try{jsonpatch[_0x0920('0x21')](_0x23567e,_0x23c662,!![]);}catch(_0x53ad8d){return BPromise['reject'](_0x53ad8d);}return _0x23567e[_0x0920('0x22')]();};}function saveUpdates(_0x3183e1,_0x2673dd){return function(_0x99c1ad){if(_0x99c1ad){return _0x99c1ad['update'](_0x3183e1)[_0x0920('0x23')](function(_0x5c3df9){return _0x5c3df9;});}return null;};}function removeEntity(_0x2eefe3,_0x246cf6){return function(_0x189d44){if(_0x189d44){return _0x189d44['destroy']()[_0x0920('0x23')](function(){var _0x6cc55e=_0x189d44['get']({'plain':!![]});var _0x5dd225='CmHopperAdditionalPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x5dd225,'resourceId':_0x6cc55e['id']}})[_0x0920('0x23')](function(){return _0x189d44;});})[_0x0920('0x23')](function(){_0x2eefe3[_0x0920('0x18')](0xcc)[_0x0920('0x19')]();});}};}function handleEntityNotFound(_0x33157d,_0x1b5261){return function(_0x5c668f){if(!_0x5c668f){_0x33157d['sendStatus'](0x194);}return _0x5c668f;};}function handleError(_0x23e9fa,_0x4a79a1){_0x4a79a1=_0x4a79a1||0x1f4;return function(_0x3d3bd5){logger[_0x0920('0x24')](_0x3d3bd5[_0x0920('0x25')]);if(_0x3d3bd5['name']){delete _0x3d3bd5[_0x0920('0x26')];}_0x23e9fa['status'](_0x4a79a1)[_0x0920('0x27')](_0x3d3bd5);};}exports[_0x0920('0x28')]=function(_0x47c327,_0x1117f9){var _0x42d34e={},_0x34c39d={},_0x5040be={'count':0x0,'rows':[]};var _0x5a63d2=_[_0x0920('0x29')](db[_0x0920('0x2a')][_0x0920('0x2b')],function(_0x572107){return{'name':_0x572107[_0x0920('0x2c')],'type':_0x572107[_0x0920('0x2d')][_0x0920('0x2e')]};});_0x34c39d[_0x0920('0x2f')]=_[_0x0920('0x29')](_0x5a63d2,'name');_0x34c39d[_0x0920('0x30')]=_[_0x0920('0x31')](_0x47c327[_0x0920('0x30')]);_0x34c39d[_0x0920('0x32')]=_[_0x0920('0x33')](_0x34c39d[_0x0920('0x2f')],_0x34c39d['query']);_0x42d34e[_0x0920('0x34')]=_[_0x0920('0x33')](_0x34c39d[_0x0920('0x2f')],qs[_0x0920('0x35')](_0x47c327[_0x0920('0x30')][_0x0920('0x35')]));_0x42d34e[_0x0920('0x34')]=_0x42d34e[_0x0920('0x34')][_0x0920('0x36')]?_0x42d34e['attributes']:_0x34c39d['model'];if(!_0x47c327[_0x0920('0x30')][_0x0920('0x37')](_0x0920('0x38'))){_0x42d34e['limit']=qs[_0x0920('0x1c')](_0x47c327[_0x0920('0x30')][_0x0920('0x1c')]);_0x42d34e[_0x0920('0x1e')]=qs[_0x0920('0x1e')](_0x47c327['query'][_0x0920('0x1e')]);}_0x42d34e[_0x0920('0x39')]=qs[_0x0920('0x3a')](_0x47c327[_0x0920('0x30')][_0x0920('0x3a')]);_0x42d34e[_0x0920('0x3b')]=qs['filters'](_['pick'](_0x47c327[_0x0920('0x30')],_0x34c39d[_0x0920('0x32')]),_0x5a63d2);if(_0x47c327['query'][_0x0920('0x3c')]){_0x42d34e['where']=_['merge'](_0x42d34e[_0x0920('0x3b')],{'$or':_[_0x0920('0x29')](_0x5a63d2,function(_0x2a2528){if(_0x2a2528[_0x0920('0x2d')]!=='VIRTUAL'){var _0x5a9d67={};_0x5a9d67[_0x2a2528[_0x0920('0x26')]]={'$like':'%'+_0x47c327[_0x0920('0x30')][_0x0920('0x3c')]+'%'};return _0x5a9d67;}})});}_0x42d34e=_[_0x0920('0x3d')]({},_0x42d34e,_0x47c327[_0x0920('0x3e')]);var _0x2a33e2={'where':_0x42d34e[_0x0920('0x3b')]};return db[_0x0920('0x2a')][_0x0920('0x1d')](_0x2a33e2)[_0x0920('0x23')](function(_0x6466){_0x5040be[_0x0920('0x1d')]=_0x6466;if(_0x47c327[_0x0920('0x30')][_0x0920('0x3f')]){_0x42d34e[_0x0920('0x40')]=[{'all':!![]}];}return db[_0x0920('0x2a')]['findAll'](_0x42d34e);})[_0x0920('0x23')](function(_0x45438e){_0x5040be[_0x0920('0x41')]=_0x45438e;return _0x5040be;})['then'](respondWithFilteredResult(_0x1117f9,_0x42d34e))[_0x0920('0x42')](handleError(_0x1117f9,null));};exports[_0x0920('0x43')]=function(_0x24218a,_0x426c70){var _0x5c5629={'raw':!![],'where':{'id':_0x24218a['params']['id']}},_0x420746={};_0x420746[_0x0920('0x2f')]=_[_0x0920('0x31')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x420746[_0x0920('0x30')]=_[_0x0920('0x31')](_0x24218a[_0x0920('0x30')]);_0x420746[_0x0920('0x32')]=_[_0x0920('0x33')](_0x420746[_0x0920('0x2f')],_0x420746['query']);_0x5c5629[_0x0920('0x34')]=_[_0x0920('0x33')](_0x420746[_0x0920('0x2f')],qs[_0x0920('0x35')](_0x24218a[_0x0920('0x30')]['fields']));_0x5c5629[_0x0920('0x34')]=_0x5c5629[_0x0920('0x34')][_0x0920('0x36')]?_0x5c5629[_0x0920('0x34')]:_0x420746[_0x0920('0x2f')];if(_0x24218a[_0x0920('0x30')]['includeAll']){_0x5c5629[_0x0920('0x40')]=[{'all':!![]}];}_0x5c5629=_[_0x0920('0x3d')]({},_0x5c5629,_0x24218a[_0x0920('0x3e')]);return db[_0x0920('0x2a')]['find'](_0x5c5629)['then'](handleEntityNotFound(_0x426c70,null))['then'](respondWithResult(_0x426c70,null))[_0x0920('0x42')](handleError(_0x426c70,null));};exports[_0x0920('0x44')]=function(_0x394227,_0x16d71f){return db['CmHopperAdditionalPhone'][_0x0920('0x44')](_0x394227['body'],{})[_0x0920('0x23')](function(_0x5095bb){var _0x3c8bb8=_0x394227[_0x0920('0x45')][_0x0920('0x46')]({'plain':!![]});if(!_0x3c8bb8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c8bb8[_0x0920('0x47')]===_0x0920('0x45')){var _0x5f3c2e=_0x5095bb['get']({'plain':!![]});var _0x2a2940='CmHopperAdditionalPhones';return db[_0x0920('0x48')][_0x0920('0x49')]({'where':{'name':_0x2a2940,'userProfileId':_0x3c8bb8[_0x0920('0x4a')]},'raw':!![]})[_0x0920('0x23')](function(_0x1857fb){if(_0x1857fb&&_0x1857fb[_0x0920('0x4b')]===0x0){return db['UserProfileResource'][_0x0920('0x44')]({'name':_0x5f3c2e[_0x0920('0x26')],'resourceId':_0x5f3c2e['id'],'type':_0x1857fb[_0x0920('0x26')],'sectionId':_0x1857fb['id']},{})[_0x0920('0x23')](function(){return _0x5095bb;});}else{return _0x5095bb;}})[_0x0920('0x42')](function(_0x31dd10){logger[_0x0920('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31dd10);throw _0x31dd10;});}return _0x5095bb;})['then'](respondWithResult(_0x16d71f,0xc9))[_0x0920('0x42')](handleError(_0x16d71f,null));};exports[_0x0920('0x4c')]=function(_0x2f28af,_0x396532){if(_0x2f28af['body']['id']){delete _0x2f28af[_0x0920('0x4d')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x2f28af[_0x0920('0x4e')]['id']}})[_0x0920('0x23')](handleEntityNotFound(_0x396532,null))['then'](saveUpdates(_0x2f28af[_0x0920('0x4d')],null))[_0x0920('0x23')](respondWithResult(_0x396532,null))[_0x0920('0x42')](handleError(_0x396532,null));};exports[_0x0920('0x4f')]=function(_0x4d4063,_0x258a22){return db['CmHopperAdditionalPhone'][_0x0920('0x49')]({'where':{'id':_0x4d4063['params']['id']}})[_0x0920('0x23')](handleEntityNotFound(_0x258a22,null))[_0x0920('0x23')](removeEntity(_0x258a22,null))[_0x0920('0x42')](handleError(_0x258a22,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 4d6bfbc..7351384 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 _0x0504=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','api'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x0504,0x147));var _0x4050=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0504[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x4050('0x0'));var logger=require(_0x4050('0x1'))(_0x4050('0x2'));var moment=require(_0x4050('0x3'));var BPromise=require(_0x4050('0x4'));var rp=require(_0x4050('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4050('0x6'));var config=require(_0x4050('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x4050('0x8')]=function(_0x26da81,_0x2fd317){return _0x26da81['define'](_0x4050('0x9'),attributes,{'tableName':_0x4050('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6fb=['api','moment','bluebird','request-promise','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xa6fb,0x13d));var _0xba6f=function(_0x4b982f,_0x235dfb){_0x4b982f=_0x4b982f-0x0;var _0x5afa0f=_0xa6fb[_0x4b982f];return _0x5afa0f;};'use strict';var _=require(_0xba6f('0x0'));var util=require(_0xba6f('0x1'));var logger=require(_0xba6f('0x2'))(_0xba6f('0x3'));var moment=require(_0xba6f('0x4'));var BPromise=require(_0xba6f('0x5'));var rp=require(_0xba6f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba6f('0x7'));module['exports']=function(_0x3b6e89,_0x3cb9d4){return _0x3b6e89['define'](_0xba6f('0x8'),attributes,{'tableName':_0xba6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 563e8aa..20ddb77 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 _0x828c=['CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','entity','dialGlobalMaxRetry','countabandonedretry','countagentrejectretry','VerifyAdditionalPhones','catch','duration','waitTime','scheduledat','add','minutes','isNil','updatedAt','createdAt','sequelize','update','phone','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CmHopper','body','ContactId','ListId','VoiceQueueId'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x828c,0x17b));var _0xc828=function(_0x2631f6,_0x552ce5){_0x2631f6=_0x2631f6-0x0;var _0x45917c=_0x828c[_0x2631f6];return _0x45917c;};'use strict';var _=require(_0xc828('0x0'));var util=require(_0xc828('0x1'));var moment=require(_0xc828('0x2'));var BPromise=require(_0xc828('0x3'));var rs=require(_0xc828('0x4'));var fs=require('fs');var Redis=require(_0xc828('0x5'));var db=require(_0xc828('0x6'))['db'];var utils=require(_0xc828('0x7'));var logger=require(_0xc828('0x8'))(_0xc828('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc828('0xa')][_0xc828('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55aa9d,_0x16d648,_0x454f43){return new BPromise(function(_0x227851,_0x472246){return client['request'](_0x55aa9d,_0x454f43)[_0xc828('0xc')](function(_0x125528){logger[_0xc828('0xd')](_0xc828('0xe'),_0x16d648,_0xc828('0xf'));logger[_0xc828('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x16d648,_0xc828('0xf'),JSON[_0xc828('0x11')](_0x125528));if(_0x125528['error']){if(_0x125528[_0xc828('0x12')][_0xc828('0x13')]===0x1f4){logger['error'](_0xc828('0xe'),_0x16d648,_0x125528[_0xc828('0x12')]['message']);return _0x472246(_0x125528[_0xc828('0x12')]['message']);}logger[_0xc828('0x12')](_0xc828('0xe'),_0x16d648,_0x125528[_0xc828('0x12')][_0xc828('0x14')]);return _0x227851(_0x125528[_0xc828('0x12')][_0xc828('0x14')]);}else{logger[_0xc828('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x16d648,_0xc828('0xf'));_0x227851(_0x125528[_0xc828('0x15')]['message']);}})['catch'](function(_0x407ccf){logger[_0xc828('0x12')](_0xc828('0xe'),_0x16d648,_0x407ccf);_0x472246(_0x407ccf);});});}exports['VerifyAdditionalPhones']=function(_0x3f2ee1){var _0x39dc17=this;return new Promise(function(_0x22f027,_0x1294f3){return db[_0xc828('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x3f2ee1[_0xc828('0x17')][_0xc828('0x18')],'ListId':_0x3f2ee1[_0xc828('0x17')][_0xc828('0x19')],'VoiceQueueId':_0x3f2ee1[_0xc828('0x17')][_0xc828('0x1a')]===undefined?null:_0x3f2ee1[_0xc828('0x17')][_0xc828('0x1a')],'CampaignId':_0x3f2ee1[_0xc828('0x17')][_0xc828('0x1b')]===undefined?null:_0x3f2ee1[_0xc828('0x17')][_0xc828('0x1b')]}})['then'](function(_0x432a18){if(_0x432a18!=null){return db[_0xc828('0x1c')][_0xc828('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x432a18['id'],'OrderBy':{'$gt':_0x432a18[_0xc828('0x1e')]}},'order':[['OrderBy',_0xc828('0x1f')]]})['then'](function(_0x245f7b){var _0x51c64b=0x0;if(_0x245f7b){if(_0x245f7b[_0xc828('0x20')]+_0x245f7b[_0xc828('0x21')]+_0x245f7b[_0xc828('0x22')]+_0x245f7b[_0xc828('0x23')]+_0x245f7b[_0xc828('0x24')]+_0x245f7b['countabandonedretry']+_0x245f7b[_0xc828('0x25')]+_0x245f7b['countagentrejectretry']<_0x3f2ee1[_0xc828('0x26')][_0xc828('0x27')])_0x51c64b=0x1;_0x22f027({'additional':_0x51c64b});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x432a18['id']},'order':[['OrderBy','ASC']]})['then'](function(_0x375526){var _0x35f3dd=0x0;if(_0x375526){if(_0x375526[_0xc828('0x20')]+_0x375526['countcongestionretry']+_0x375526[_0xc828('0x22')]+_0x375526['countnosuchnumberretry']+_0x375526['countdropretry']+_0x375526[_0xc828('0x28')]+_0x375526[_0xc828('0x25')]+_0x375526[_0xc828('0x29')]<_0x3f2ee1['entity'][_0xc828('0x27')])_0x35f3dd=0x1;_0x22f027({'additional':_0x35f3dd});}else{_0x22f027({'additional':0x0});}})['catch'](function(_0x5ade94){logger['error'](_0xc828('0x2a'),_0x5ade94[_0xc828('0x14')]);_0x1294f3(_0x39dc17[_0xc828('0x12')](0x1f4,_0x5ade94[_0xc828('0x14')]));});}})[_0xc828('0x2b')](function(_0x4cf0d7){logger[_0xc828('0x12')](_0xc828('0x2a'),_0x4cf0d7[_0xc828('0x14')]);_0x1294f3(_0x39dc17[_0xc828('0x12')](0x1f4,_0x4cf0d7['message']));});}else _0x22f027({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x5de1f8){var _0x5bcd9c=this;return new Promise(function(_0x24c468,_0x252e02){return db[_0xc828('0x16')][_0xc828('0x1d')]({'raw':!![],'where':{'ContactId':_0x5de1f8[_0xc828('0x17')][_0xc828('0x18')],'ListId':_0x5de1f8[_0xc828('0x17')][_0xc828('0x19')],'VoiceQueueId':_0x5de1f8[_0xc828('0x17')][_0xc828('0x1a')]===undefined?null:_0x5de1f8[_0xc828('0x17')][_0xc828('0x1a')],'CampaignId':_0x5de1f8[_0xc828('0x17')][_0xc828('0x1b')]===undefined?null:_0x5de1f8[_0xc828('0x17')][_0xc828('0x1b')]}})[_0xc828('0xc')](function(_0xeab96d){if(_0xeab96d!=null){return db['CmHopperAdditionalPhone'][_0xc828('0x1d')]({'raw':!![],'where':{'CmHopperId':_0xeab96d['id'],'OrderBy':{'$gte':_0xeab96d[_0xc828('0x1e')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x55b040){if(_0x55b040)return activateAdditionalPhone(_0xeab96d,_0x5de1f8[_0xc828('0x17')],_0x55b040,_0x5de1f8[_0xc828('0x2c')],_0x5de1f8['waitTime'])[_0xc828('0xc')](function(_0x571c05){_0x24c468(_0x571c05);});else{return db[_0xc828('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xeab96d['id']},'order':[['OrderBy','ASC']]})[_0xc828('0xc')](function(_0x579f3e){if(_0x579f3e)return activateAdditionalPhone(_0xeab96d,_0x5de1f8['body'],_0x579f3e,_0x5de1f8[_0xc828('0x2c')],_0x5de1f8[_0xc828('0x2d')])[_0xc828('0xc')](function(_0x150233){_0x24c468(_0x150233);});else{_0x24c468({'id':_0xeab96d['id'],'phone':''});}})['catch'](function(_0xe22511){logger[_0xc828('0x12')]('VerifyAdditionalPhones',_0xe22511['message']);_0x252e02(_0x5bcd9c[_0xc828('0x12')](0x1f4,_0xe22511[_0xc828('0x14')]));});}})['catch'](function(_0x2e3275){logger[_0xc828('0x12')](_0xc828('0x2a'),_0x2e3275[_0xc828('0x14')]);_0x252e02(_0x5bcd9c['error'](0x1f4,_0x2e3275[_0xc828('0x14')]));});}else _0x24c468(0x1);});});};function activateAdditionalPhone(_0x54d5d4,_0x276f21,_0x1d5c12,_0x4a6471,_0x5e0644){return new Promise(function(_0x234f9f,_0x1ffd60){var _0x4978af;if(_['isNil'](_0x1d5c12[_0xc828('0x2e')])){_0x1d5c12[_0xc828('0x2e')]=moment();}if(moment()>moment(_0x1d5c12[_0xc828('0x2e')])){_0x4978af=moment()[_0xc828('0x2f')](_0x5e0644||0x3,_0xc828('0x30'));}else{if(_0x1d5c12[_0xc828('0x1e')]==0x0){_0x4978af=moment(_0x1d5c12['scheduledat']);}else{_0x4978af=moment()[_0xc828('0x2f')](_0x5e0644||0x3,_0xc828('0x30'));}}if(_['isNil'](_0x4978af)){_0x4978af=moment()[_0xc828('0x2f')](_0x5e0644||0x3,'minutes');}var _0x1c04b4={'phone':_0x54d5d4['phone'],'active':0x0,'OrderBy':_[_0xc828('0x31')](_0x54d5d4[_0xc828('0x1e')])?0x0:_0x54d5d4['OrderBy'],'scheduledat':moment()[_0xc828('0x2f')](_0x4a6471||0x1,_0xc828('0x30')),'countbusyretry':_0x276f21['countbusyretry'],'countcongestionretry':_0x276f21[_0xc828('0x21')],'countnoanswerretry':_0x276f21[_0xc828('0x22')],'countnosuchnumberretry':_0x276f21[_0xc828('0x23')],'countdropretry':_0x276f21[_0xc828('0x24')],'countabandonedretry':_0x276f21[_0xc828('0x28')],'countmachineretry':_0x276f21[_0xc828('0x25')],'countagentrejectretry':_0x276f21[_0xc828('0x29')],'createdAt':_0x276f21['createdAt'],'updatedAt':_0x276f21[_0xc828('0x32')]};var _0x19373a={'CmHopperId':_0x54d5d4['id'],'phone':_0x1d5c12['phone'],'active':0x0,'OrderBy':_[_0xc828('0x31')](_0x1d5c12[_0xc828('0x1e')])?0x0:_0x1d5c12[_0xc828('0x1e')],'scheduledat':_0x4978af,'countbusyretry':_0x1d5c12['countbusyretry'],'countcongestionretry':_0x1d5c12['countcongestionretry'],'countnoanswerretry':_0x1d5c12['countnoanswerretry'],'countnosuchnumberretry':_0x1d5c12['countnosuchnumberretry'],'countdropretry':_0x1d5c12[_0xc828('0x24')],'countabandonedretry':_0x1d5c12['countabandonedretry'],'countmachineretry':_0x1d5c12['countmachineretry'],'countagentrejectretry':_0x1d5c12['countagentrejectretry'],'createdAt':_0x1d5c12[_0xc828('0x33')],'updatedAt':_0x1d5c12[_0xc828('0x32')]};return db[_0xc828('0x34')]['transaction'](function(_0x307189){return db[_0xc828('0x1c')][_0xc828('0x35')](_0x1c04b4,{'where':{'id':_0x1d5c12['id']}},{'transaction':_0x307189})[_0xc828('0xc')](function(){return db[_0xc828('0x16')][_0xc828('0x35')](_0x19373a,{'where':{'id':_0x54d5d4['id']}},{'transaction':_0x307189});});})[_0xc828('0xc')](function(_0x1dfb92){_0x234f9f({'id':_0x54d5d4['id'],'phone':_0x1d5c12[_0xc828('0x36')]});})[_0xc828('0x2b')](function(_0x120892){logger[_0xc828('0x12')](_0xc828('0x37'),_0x120892[_0xc828('0x14')]);_0x1ffd60({'error':_0x120892[_0xc828('0x14')]});});});}exports[_0xc828('0x38')]=function(_0xbfa423){var _0x5268f1=this;return new Promise(function(_0x2bace3,_0x365e4a){return db['CmHopper'][_0xc828('0x35')](_0xbfa423[_0xc828('0x17')][_0xc828('0x39')],{'where':{'id':_0xbfa423['body']['id']}})['then'](function(_0x2ac47d){_0x2bace3(_0x2ac47d);})[_0xc828('0x2b')](function(_0x43b381){logger[_0xc828('0x12')](_0xc828('0x38'),_0x43b381[_0xc828('0x14')]);_0x365e4a(_0x5268f1[_0xc828('0x12')](0x1f4,_0x43b381[_0xc828('0x14')]));});});}; \ No newline at end of file +var _0x0a1c=['error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countnoanswerretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','update','activateAdditionalPhone','IncrementPreviewCounters','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent'];(function(_0x3e697c,_0x459b86){var _0x34121d=function(_0x28646e){while(--_0x28646e){_0x3e697c['push'](_0x3e697c['shift']());}};_0x34121d(++_0x459b86);}(_0x0a1c,0x1cf));var _0xc0a1=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0x0a1c[_0x1e6659];return _0x4d16e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0a1('0x0'));var BPromise=require(_0xc0a1('0x1'));var rs=require(_0xc0a1('0x2'));var fs=require('fs');var Redis=require(_0xc0a1('0x3'));var db=require(_0xc0a1('0x4'))['db'];var utils=require(_0xc0a1('0x5'));var logger=require(_0xc0a1('0x6'))(_0xc0a1('0x7'));var config=require(_0xc0a1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc0a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aa7a2,_0x29d99c,_0xc37649){return new BPromise(function(_0x5567b6,_0x59bba8){return client[_0xc0a1('0xa')](_0x5aa7a2,_0xc37649)['then'](function(_0x5c64f6){logger[_0xc0a1('0xb')](_0xc0a1('0xc'),_0x29d99c,_0xc0a1('0xd'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x29d99c,_0xc0a1('0xd'),JSON['stringify'](_0x5c64f6));if(_0x5c64f6['error']){if(_0x5c64f6[_0xc0a1('0xe')][_0xc0a1('0xf')]===0x1f4){logger[_0xc0a1('0xe')](_0xc0a1('0xc'),_0x29d99c,_0x5c64f6[_0xc0a1('0xe')][_0xc0a1('0x10')]);return _0x59bba8(_0x5c64f6[_0xc0a1('0xe')]['message']);}logger[_0xc0a1('0xe')](_0xc0a1('0xc'),_0x29d99c,_0x5c64f6[_0xc0a1('0xe')][_0xc0a1('0x10')]);return _0x5567b6(_0x5c64f6['error']['message']);}else{logger[_0xc0a1('0xb')](_0xc0a1('0xc'),_0x29d99c,_0xc0a1('0xd'));_0x5567b6(_0x5c64f6[_0xc0a1('0x11')]['message']);}})[_0xc0a1('0x12')](function(_0x486f0e){logger['error'](_0xc0a1('0xc'),_0x29d99c,_0x486f0e);_0x59bba8(_0x486f0e);});});}exports[_0xc0a1('0x13')]=function(_0x57aed3){var _0x2f0ad1=this;return new Promise(function(_0x3d272d,_0x21c410){return db[_0xc0a1('0x14')][_0xc0a1('0x15')]({'raw':!![],'where':{'ContactId':_0x57aed3['body'][_0xc0a1('0x16')],'ListId':_0x57aed3[_0xc0a1('0x17')][_0xc0a1('0x18')],'VoiceQueueId':_0x57aed3[_0xc0a1('0x17')][_0xc0a1('0x19')]===undefined?null:_0x57aed3[_0xc0a1('0x17')]['VoiceQueueId'],'CampaignId':_0x57aed3[_0xc0a1('0x17')]['CampaignId']===undefined?null:_0x57aed3[_0xc0a1('0x17')][_0xc0a1('0x1a')]}})[_0xc0a1('0x1b')](function(_0x46ca77){if(_0x46ca77!=null){return db[_0xc0a1('0x1c')][_0xc0a1('0x15')]({'raw':!![],'where':{'CmHopperId':_0x46ca77['id'],'OrderBy':{'$gt':_0x46ca77[_0xc0a1('0x1d')]}},'order':[[_0xc0a1('0x1d'),_0xc0a1('0x1e')]]})[_0xc0a1('0x1b')](function(_0x28823d){var _0x4d6e14=0x0;if(_0x28823d){if(_0x28823d[_0xc0a1('0x1f')]+_0x28823d[_0xc0a1('0x20')]+_0x28823d['countnoanswerretry']+_0x28823d[_0xc0a1('0x21')]+_0x28823d[_0xc0a1('0x22')]+_0x28823d[_0xc0a1('0x23')]+_0x28823d[_0xc0a1('0x24')]+_0x28823d[_0xc0a1('0x25')]<_0x57aed3[_0xc0a1('0x26')]['dialGlobalMaxRetry'])_0x4d6e14=0x1;_0x3d272d({'additional':_0x4d6e14});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x46ca77['id']},'order':[[_0xc0a1('0x1d'),'ASC']]})[_0xc0a1('0x1b')](function(_0x3823c9){var _0x51a179=0x0;if(_0x3823c9){if(_0x3823c9['countbusyretry']+_0x3823c9[_0xc0a1('0x20')]+_0x3823c9[_0xc0a1('0x27')]+_0x3823c9[_0xc0a1('0x21')]+_0x3823c9[_0xc0a1('0x22')]+_0x3823c9[_0xc0a1('0x23')]+_0x3823c9['countmachineretry']+_0x3823c9[_0xc0a1('0x25')]<_0x57aed3[_0xc0a1('0x26')][_0xc0a1('0x28')])_0x51a179=0x1;_0x3d272d({'additional':_0x51a179});}else{_0x3d272d({'additional':0x0});}})[_0xc0a1('0x12')](function(_0x1ffc83){logger[_0xc0a1('0xe')]('VerifyAdditionalPhones',_0x1ffc83['message']);_0x21c410(_0x2f0ad1[_0xc0a1('0xe')](0x1f4,_0x1ffc83[_0xc0a1('0x10')]));});}})[_0xc0a1('0x12')](function(_0x207b3e){logger[_0xc0a1('0xe')](_0xc0a1('0x13'),_0x207b3e[_0xc0a1('0x10')]);_0x21c410(_0x2f0ad1['error'](0x1f4,_0x207b3e['message']));});}else _0x3d272d({'additional':0x0});});});};exports[_0xc0a1('0x29')]=function(_0x1e9e96){var _0x1c0840=this;return new Promise(function(_0x18aeea,_0x4190dc){return db[_0xc0a1('0x14')][_0xc0a1('0x15')]({'raw':!![],'where':{'ContactId':_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x16')],'ListId':_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x18')],'VoiceQueueId':_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x19')]===undefined?null:_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x19')],'CampaignId':_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x1a')]===undefined?null:_0x1e9e96['body'][_0xc0a1('0x1a')]}})[_0xc0a1('0x1b')](function(_0x326b30){if(_0x326b30!=null){return db['CmHopperAdditionalPhone'][_0xc0a1('0x15')]({'raw':!![],'where':{'CmHopperId':_0x326b30['id'],'OrderBy':{'$gte':_0x326b30['OrderBy']}},'order':[[_0xc0a1('0x1d'),'ASC']]})['then'](function(_0xa2dd9e){if(_0xa2dd9e)return activateAdditionalPhone(_0x326b30,_0x1e9e96[_0xc0a1('0x17')],_0xa2dd9e,_0x1e9e96['duration'],_0x1e9e96['waitTime'])[_0xc0a1('0x1b')](function(_0x445fc8){_0x18aeea(_0x445fc8);});else{return db[_0xc0a1('0x1c')][_0xc0a1('0x15')]({'raw':!![],'where':{'CmHopperId':_0x326b30['id']},'order':[[_0xc0a1('0x1d'),_0xc0a1('0x1e')]]})['then'](function(_0x97013e){if(_0x97013e)return activateAdditionalPhone(_0x326b30,_0x1e9e96[_0xc0a1('0x17')],_0x97013e,_0x1e9e96[_0xc0a1('0x2a')],_0x1e9e96[_0xc0a1('0x2b')])[_0xc0a1('0x1b')](function(_0x55f310){_0x18aeea(_0x55f310);});else{_0x18aeea({'id':_0x326b30['id'],'phone':''});}})[_0xc0a1('0x12')](function(_0xb0b40e){logger[_0xc0a1('0xe')](_0xc0a1('0x13'),_0xb0b40e[_0xc0a1('0x10')]);_0x4190dc(_0x1c0840['error'](0x1f4,_0xb0b40e[_0xc0a1('0x10')]));});}})[_0xc0a1('0x12')](function(_0x50315e){logger[_0xc0a1('0xe')](_0xc0a1('0x13'),_0x50315e[_0xc0a1('0x10')]);_0x4190dc(_0x1c0840['error'](0x1f4,_0x50315e[_0xc0a1('0x10')]));});}else _0x18aeea(0x1);});});};function activateAdditionalPhone(_0x1a6216,_0x17806a,_0x4ceefa,_0x256c0b,_0x5515db){return new Promise(function(_0x509b6c,_0x39fd9f){var _0x133c45;if(_[_0xc0a1('0x2c')](_0x4ceefa[_0xc0a1('0x2d')])){_0x4ceefa[_0xc0a1('0x2d')]=moment();}if(moment()>moment(_0x4ceefa[_0xc0a1('0x2d')])){_0x133c45=moment()[_0xc0a1('0x2e')](_0x5515db||0x3,_0xc0a1('0x2f'));}else{if(_0x4ceefa[_0xc0a1('0x1d')]==0x0){_0x133c45=moment(_0x4ceefa[_0xc0a1('0x2d')]);}else{_0x133c45=moment()[_0xc0a1('0x2e')](_0x5515db||0x3,_0xc0a1('0x2f'));}}if(_['isNil'](_0x133c45)){_0x133c45=moment()[_0xc0a1('0x2e')](_0x5515db||0x3,_0xc0a1('0x2f'));}var _0x5bc264={'phone':_0x1a6216['phone'],'active':0x0,'OrderBy':_['isNil'](_0x1a6216[_0xc0a1('0x1d')])?0x0:_0x1a6216[_0xc0a1('0x1d')],'scheduledat':moment()[_0xc0a1('0x2e')](_0x256c0b||0x1,_0xc0a1('0x2f')),'countbusyretry':_0x17806a[_0xc0a1('0x1f')],'countcongestionretry':_0x17806a[_0xc0a1('0x20')],'countnoanswerretry':_0x17806a[_0xc0a1('0x27')],'countnosuchnumberretry':_0x17806a[_0xc0a1('0x21')],'countdropretry':_0x17806a['countdropretry'],'countabandonedretry':_0x17806a[_0xc0a1('0x23')],'countmachineretry':_0x17806a[_0xc0a1('0x24')],'countagentrejectretry':_0x17806a[_0xc0a1('0x25')],'createdAt':_0x17806a['createdAt'],'updatedAt':_0x17806a['updatedAt']};var _0x3e441e={'CmHopperId':_0x1a6216['id'],'phone':_0x4ceefa[_0xc0a1('0x30')],'active':0x0,'OrderBy':_[_0xc0a1('0x2c')](_0x4ceefa['OrderBy'])?0x0:_0x4ceefa[_0xc0a1('0x1d')],'scheduledat':_0x133c45,'countbusyretry':_0x4ceefa[_0xc0a1('0x1f')],'countcongestionretry':_0x4ceefa[_0xc0a1('0x20')],'countnoanswerretry':_0x4ceefa[_0xc0a1('0x27')],'countnosuchnumberretry':_0x4ceefa[_0xc0a1('0x21')],'countdropretry':_0x4ceefa['countdropretry'],'countabandonedretry':_0x4ceefa[_0xc0a1('0x23')],'countmachineretry':_0x4ceefa['countmachineretry'],'countagentrejectretry':_0x4ceefa[_0xc0a1('0x25')],'createdAt':_0x4ceefa[_0xc0a1('0x31')],'updatedAt':_0x4ceefa['updatedAt']};return db['sequelize']['transaction'](function(_0x169fd7){return db[_0xc0a1('0x1c')][_0xc0a1('0x32')](_0x5bc264,{'where':{'id':_0x4ceefa['id']}},{'transaction':_0x169fd7})['then'](function(){return db['CmHopper'][_0xc0a1('0x32')](_0x3e441e,{'where':{'id':_0x1a6216['id']}},{'transaction':_0x169fd7});});})[_0xc0a1('0x1b')](function(_0x5cfc8e){_0x509b6c({'id':_0x1a6216['id'],'phone':_0x4ceefa['phone']});})[_0xc0a1('0x12')](function(_0x18c89f){logger[_0xc0a1('0xe')](_0xc0a1('0x33'),_0x18c89f[_0xc0a1('0x10')]);_0x39fd9f({'error':_0x18c89f[_0xc0a1('0x10')]});});});}exports[_0xc0a1('0x34')]=function(_0x42a4e4){var _0x507b0f=this;return new Promise(function(_0x4820d0,_0x1aa2dc){return db['CmHopper']['update'](_0x42a4e4['body']['field'],{'where':{'id':_0x42a4e4['body']['id']}})[_0xc0a1('0x1b')](function(_0x4e67de){_0x4820d0(_0x4e67de);})[_0xc0a1('0x12')](function(_0x12f247){logger[_0xc0a1('0xe')](_0xc0a1('0x34'),_0x12f247[_0xc0a1('0x10')]);_0x1aa2dc(_0x507b0f[_0xc0a1('0xe')](0x1f4,_0x12f247['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 8456484..39b9dff 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 _0xf263=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf263,0x141));var _0x3f26=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0xf263[_0x44ae0b];return _0x69232a;};'use strict';var multer=require(_0x3f26('0x0'));var util=require('util');var path=require(_0x3f26('0x1'));var timeout=require(_0x3f26('0x2'));var express=require(_0x3f26('0x3'));var router=express[_0x3f26('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f26('0x5'));var interaction=require(_0x3f26('0x6'));var config=require(_0x3f26('0x7'));var controller=require(_0x3f26('0x8'));router['get']('/',auth[_0x3f26('0x9')](),controller[_0x3f26('0xa')]);router[_0x3f26('0xb')]('/:id',auth[_0x3f26('0x9')](),controller[_0x3f26('0xc')]);router[_0x3f26('0xd')]('/',auth[_0x3f26('0x9')](),controller[_0x3f26('0xe')]);router[_0x3f26('0xf')](_0x3f26('0x10'),auth[_0x3f26('0x9')](),controller['update']);router[_0x3f26('0x11')](_0x3f26('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x3f26('0x12')]=router; \ No newline at end of file +var _0x112a=['../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x493f77,_0x4567ac){var _0x472bf8=function(_0x1ceab4){while(--_0x1ceab4){_0x493f77['push'](_0x493f77['shift']());}};_0x472bf8(++_0x4567ac);}(_0x112a,0x115));var _0xa112=function(_0xb96c37,_0x468c64){_0xb96c37=_0xb96c37-0x0;var _0x85992f=_0x112a[_0xb96c37];return _0x85992f;};'use strict';var multer=require(_0xa112('0x0'));var util=require(_0xa112('0x1'));var path=require(_0xa112('0x2'));var timeout=require(_0xa112('0x3'));var express=require(_0xa112('0x4'));var router=express[_0xa112('0x5')]();var fs_extra=require(_0xa112('0x6'));var auth=require(_0xa112('0x7'));var interaction=require(_0xa112('0x8'));var config=require(_0xa112('0x9'));var controller=require(_0xa112('0xa'));router[_0xa112('0xb')]('/',auth[_0xa112('0xc')](),controller[_0xa112('0xd')]);router[_0xa112('0xb')](_0xa112('0xe'),auth[_0xa112('0xc')](),controller[_0xa112('0xf')]);router[_0xa112('0x10')]('/',auth[_0xa112('0xc')](),controller[_0xa112('0x11')]);router[_0xa112('0x12')](_0xa112('0xe'),auth['isAuthenticated'](),controller[_0xa112('0x13')]);router['delete'](_0xa112('0xe'),auth[_0xa112('0xc')](),controller[_0xa112('0x14')]);module[_0xa112('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 8cc1e06..ece985d 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 _0x83f7=['INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x83f7,0x84));var _0x783f=function(_0x1e7565,_0x5c0f3a){_0x1e7565=_0x1e7565-0x0;var _0x5cc1d6=_0x83f7[_0x1e7565];return _0x5cc1d6;};'use strict';var moment=require(_0x783f('0x0'));var Sequelize=require(_0x783f('0x1'));module[_0x783f('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x783f('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x783f('0x4')},'VoiceQueueId':{'type':Sequelize[_0x783f('0x3')],'unique':_0x783f('0x4')}}; \ No newline at end of file +var _0xd094=['INTEGER','contactListQueue','sequelize','exports'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xd094,0x96));var _0x4d09=function(_0x1d740e,_0x5c0f9a){_0x1d740e=_0x1d740e-0x0;var _0x5a5fdc=_0xd094[_0x1d740e];return _0x5a5fdc;};'use strict';var moment=require('moment');var Sequelize=require(_0x4d09('0x0'));module[_0x4d09('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x4d09('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x4d09('0x2')],'unique':_0x4d09('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0478efe..c87fb40 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 _0xc4b3=['merge','map','name','options','where','include','findAll','rows','catch','keys','rawAttributes','length','includeAll','find','body','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','send','index','CmHopperBlack','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xc4b3,0x179));var _0x3c4b=function(_0x2d9c60,_0x166110){_0x2d9c60=_0x2d9c60-0x0;var _0x4d33e0=_0xc4b3[_0x2d9c60];return _0x4d33e0;};'use strict';var emlformat=require(_0x3c4b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3c4b('0x1'));var rp=require(_0x3c4b('0x2'));var moment=require(_0x3c4b('0x3'));var BPromise=require(_0x3c4b('0x4'));var Mustache=require('mustache');var util=require(_0x3c4b('0x5'));var path=require('path');var sox=require(_0x3c4b('0x6'));var csv=require(_0x3c4b('0x7'));var ejs=require(_0x3c4b('0x8'));var fs=require('fs');var fs_extra=require(_0x3c4b('0x9'));var _=require(_0x3c4b('0xa'));var squel=require(_0x3c4b('0xb'));var crypto=require(_0x3c4b('0xc'));var jsforce=require(_0x3c4b('0xd'));var deskjs=require(_0x3c4b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3c4b('0xf'));var Papa=require(_0x3c4b('0x10'));var Redis=require(_0x3c4b('0x11'));var authService=require(_0x3c4b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c4b('0x13'));var logger=require(_0x3c4b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3c4b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42000c,_0x4d635d){_0x4d635d=_0x4d635d||0xcc;return function(_0x3e9d1d){if(_0x3e9d1d){return _0x42000c[_0x3c4b('0x16')](_0x4d635d);}return _0x42000c[_0x3c4b('0x17')](_0x4d635d)['end']();};}function respondWithResult(_0x1a9e48,_0x19e5a6){_0x19e5a6=_0x19e5a6||0xc8;return function(_0xd685ee){if(_0xd685ee){return _0x1a9e48[_0x3c4b('0x17')](_0x19e5a6)[_0x3c4b('0x18')](_0xd685ee);}};}function respondWithFilteredResult(_0x33039b,_0x54dd17){return function(_0x363438){if(_0x363438){var _0x18f283=typeof _0x54dd17['offset']===_0x3c4b('0x19')&&typeof _0x54dd17['limit']===_0x3c4b('0x19');var _0x5330f3=_0x363438['count'];var _0x56b786=_0x18f283?0x0:_0x54dd17[_0x3c4b('0x1a')];var _0x243fc5=_0x18f283?_0x363438[_0x3c4b('0x1b')]:_0x54dd17[_0x3c4b('0x1a')]+_0x54dd17[_0x3c4b('0x1c')];var _0x471e48;if(_0x243fc5>=_0x5330f3){_0x243fc5=_0x5330f3;_0x471e48=0xc8;}else{_0x471e48=0xce;}_0x33039b[_0x3c4b('0x17')](_0x471e48);return _0x33039b[_0x3c4b('0x1d')](_0x3c4b('0x1e'),_0x56b786+'-'+_0x243fc5+'/'+_0x5330f3)[_0x3c4b('0x18')](_0x363438);}return null;};}function patchUpdates(_0x2f32f7){return function(_0x19a5be){try{jsonpatch[_0x3c4b('0x1f')](_0x19a5be,_0x2f32f7,!![]);}catch(_0x5d4d5d){return BPromise[_0x3c4b('0x20')](_0x5d4d5d);}return _0x19a5be[_0x3c4b('0x21')]();};}function saveUpdates(_0x55a78b,_0x191e7a){return function(_0x2e5a94){if(_0x2e5a94){return _0x2e5a94[_0x3c4b('0x22')](_0x55a78b)['then'](function(_0x285b10){return _0x285b10;});}return null;};}function removeEntity(_0x46e1c6,_0x337392){return function(_0x5ae128){if(_0x5ae128){return _0x5ae128[_0x3c4b('0x23')]()[_0x3c4b('0x24')](function(){_0x46e1c6[_0x3c4b('0x17')](0xcc)[_0x3c4b('0x25')]();});}};}function handleEntityNotFound(_0x5371bd,_0x42f186){return function(_0x2b8aac){if(!_0x2b8aac){_0x5371bd[_0x3c4b('0x16')](0x194);}return _0x2b8aac;};}function handleError(_0x4fb975,_0x38fc8d){_0x38fc8d=_0x38fc8d||0x1f4;return function(_0x3f6e7a){logger[_0x3c4b('0x26')](_0x3f6e7a['stack']);if(_0x3f6e7a['name']){delete _0x3f6e7a['name'];}_0x4fb975['status'](_0x38fc8d)[_0x3c4b('0x27')](_0x3f6e7a);};}exports[_0x3c4b('0x28')]=function(_0x1056d0,_0x13cfd8){var _0x486c81={},_0x536cd5={},_0x376183={'count':0x0,'rows':[]};var _0x39c5a7=_['map'](db[_0x3c4b('0x29')]['rawAttributes'],function(_0x28e9f5){return{'name':_0x28e9f5['fieldName'],'type':_0x28e9f5[_0x3c4b('0x2a')][_0x3c4b('0x2b')]};});_0x536cd5[_0x3c4b('0x2c')]=_['map'](_0x39c5a7,'name');_0x536cd5['query']=_['keys'](_0x1056d0[_0x3c4b('0x2d')]);_0x536cd5[_0x3c4b('0x2e')]=_[_0x3c4b('0x2f')](_0x536cd5[_0x3c4b('0x2c')],_0x536cd5[_0x3c4b('0x2d')]);_0x486c81[_0x3c4b('0x30')]=_[_0x3c4b('0x2f')](_0x536cd5[_0x3c4b('0x2c')],qs[_0x3c4b('0x31')](_0x1056d0[_0x3c4b('0x2d')][_0x3c4b('0x31')]));_0x486c81[_0x3c4b('0x30')]=_0x486c81[_0x3c4b('0x30')]['length']?_0x486c81[_0x3c4b('0x30')]:_0x536cd5[_0x3c4b('0x2c')];if(!_0x1056d0['query'][_0x3c4b('0x32')](_0x3c4b('0x33'))){_0x486c81[_0x3c4b('0x1c')]=qs[_0x3c4b('0x1c')](_0x1056d0[_0x3c4b('0x2d')][_0x3c4b('0x1c')]);_0x486c81[_0x3c4b('0x1a')]=qs['offset'](_0x1056d0[_0x3c4b('0x2d')][_0x3c4b('0x1a')]);}_0x486c81[_0x3c4b('0x34')]=qs[_0x3c4b('0x35')](_0x1056d0[_0x3c4b('0x2d')][_0x3c4b('0x35')]);_0x486c81['where']=qs[_0x3c4b('0x2e')](_['pick'](_0x1056d0[_0x3c4b('0x2d')],_0x536cd5[_0x3c4b('0x2e')]),_0x39c5a7);if(_0x1056d0[_0x3c4b('0x2d')][_0x3c4b('0x36')]){_0x486c81['where']=_[_0x3c4b('0x37')](_0x486c81['where'],{'$or':_[_0x3c4b('0x38')](_0x39c5a7,function(_0xdbcb33){if(_0xdbcb33['type']!=='VIRTUAL'){var _0x3c3a83={};_0x3c3a83[_0xdbcb33[_0x3c4b('0x39')]]={'$like':'%'+_0x1056d0[_0x3c4b('0x2d')][_0x3c4b('0x36')]+'%'};return _0x3c3a83;}})});}_0x486c81=_[_0x3c4b('0x37')]({},_0x486c81,_0x1056d0[_0x3c4b('0x3a')]);var _0x54b4a1={'where':_0x486c81[_0x3c4b('0x3b')]};return db['CmHopperBlack'][_0x3c4b('0x1b')](_0x54b4a1)[_0x3c4b('0x24')](function(_0x5479d5){_0x376183[_0x3c4b('0x1b')]=_0x5479d5;if(_0x1056d0[_0x3c4b('0x2d')]['includeAll']){_0x486c81[_0x3c4b('0x3c')]=[{'all':!![]}];}return db[_0x3c4b('0x29')][_0x3c4b('0x3d')](_0x486c81);})[_0x3c4b('0x24')](function(_0x18ecd3){_0x376183[_0x3c4b('0x3e')]=_0x18ecd3;return _0x376183;})[_0x3c4b('0x24')](respondWithFilteredResult(_0x13cfd8,_0x486c81))[_0x3c4b('0x3f')](handleError(_0x13cfd8,null));};exports['show']=function(_0x512bef,_0x44bb91){var _0x1d5ef8={'raw':!![],'where':{'id':_0x512bef['params']['id']}},_0x462b3a={};_0x462b3a[_0x3c4b('0x2c')]=_[_0x3c4b('0x40')](db['CmHopperBlack'][_0x3c4b('0x41')]);_0x462b3a[_0x3c4b('0x2d')]=_[_0x3c4b('0x40')](_0x512bef[_0x3c4b('0x2d')]);_0x462b3a[_0x3c4b('0x2e')]=_[_0x3c4b('0x2f')](_0x462b3a[_0x3c4b('0x2c')],_0x462b3a[_0x3c4b('0x2d')]);_0x1d5ef8[_0x3c4b('0x30')]=_[_0x3c4b('0x2f')](_0x462b3a[_0x3c4b('0x2c')],qs[_0x3c4b('0x31')](_0x512bef[_0x3c4b('0x2d')]['fields']));_0x1d5ef8[_0x3c4b('0x30')]=_0x1d5ef8[_0x3c4b('0x30')][_0x3c4b('0x42')]?_0x1d5ef8[_0x3c4b('0x30')]:_0x462b3a[_0x3c4b('0x2c')];if(_0x512bef[_0x3c4b('0x2d')][_0x3c4b('0x43')]){_0x1d5ef8[_0x3c4b('0x3c')]=[{'all':!![]}];}_0x1d5ef8=_[_0x3c4b('0x37')]({},_0x1d5ef8,_0x512bef[_0x3c4b('0x3a')]);return db[_0x3c4b('0x29')][_0x3c4b('0x44')](_0x1d5ef8)[_0x3c4b('0x24')](handleEntityNotFound(_0x44bb91,null))[_0x3c4b('0x24')](respondWithResult(_0x44bb91,null))[_0x3c4b('0x3f')](handleError(_0x44bb91,null));};exports[_0x3c4b('0x22')]=function(_0x4ade73,_0x771e6a){if(_0x4ade73[_0x3c4b('0x45')]['id']){delete _0x4ade73['body']['id'];}return db[_0x3c4b('0x29')][_0x3c4b('0x44')]({'where':{'id':_0x4ade73[_0x3c4b('0x46')]['id']}})[_0x3c4b('0x24')](handleEntityNotFound(_0x771e6a,null))[_0x3c4b('0x24')](saveUpdates(_0x4ade73[_0x3c4b('0x45')],null))[_0x3c4b('0x24')](respondWithResult(_0x771e6a,null))[_0x3c4b('0x3f')](handleError(_0x771e6a,null));};exports['destroy']=function(_0x1aef13,_0x3b26f6){return db[_0x3c4b('0x29')][_0x3c4b('0x44')]({'where':{'id':_0x1aef13[_0x3c4b('0x46')]['id']}})[_0x3c4b('0x24')](handleEntityNotFound(_0x3b26f6,null))[_0x3c4b('0x24')](removeEntity(_0x3b26f6,null))[_0x3c4b('0x3f')](handleError(_0x3b26f6,null));};exports[_0x3c4b('0x47')]=function(_0xb165d4,_0x5e6044){return db['CmHopperBlack']['describe']()[_0x3c4b('0x24')](respondWithResult(_0x5e6044,null))[_0x3c4b('0x3f')](handleError(_0x5e6044,null));}; \ No newline at end of file +var _0x10ee=['include','findAll','rows','show','params','rawAttributes','fields','length','find','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','map','CmHopperBlack','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x34926f,_0x3db4c){var _0xe68b89=function(_0x47cedf){while(--_0x47cedf){_0x34926f['push'](_0x34926f['shift']());}};_0xe68b89(++_0x3db4c);}(_0x10ee,0xed));var _0xe10e=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x10ee[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0xe10e('0x0'));var rimraf=require(_0xe10e('0x1'));var zipdir=require(_0xe10e('0x2'));var jsonpatch=require(_0xe10e('0x3'));var rp=require('request-promise');var moment=require(_0xe10e('0x4'));var BPromise=require(_0xe10e('0x5'));var Mustache=require(_0xe10e('0x6'));var util=require(_0xe10e('0x7'));var path=require(_0xe10e('0x8'));var sox=require('sox');var csv=require(_0xe10e('0x9'));var ejs=require(_0xe10e('0xa'));var fs=require('fs');var fs_extra=require(_0xe10e('0xb'));var _=require('lodash');var squel=require(_0xe10e('0xc'));var crypto=require(_0xe10e('0xd'));var jsforce=require(_0xe10e('0xe'));var deskjs=require(_0xe10e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe10e('0x10'));var Papa=require(_0xe10e('0x11'));var Redis=require(_0xe10e('0x12'));var authService=require(_0xe10e('0x13'));var qs=require(_0xe10e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe10e('0x15'))(_0xe10e('0x16'));var utils=require('../../config/utils');var config=require(_0xe10e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe10e('0x18'))['db'];function respondWithStatusCode(_0x24869b,_0x5cbd1f){_0x5cbd1f=_0x5cbd1f||0xcc;return function(_0x4c4b3d){if(_0x4c4b3d){return _0x24869b[_0xe10e('0x19')](_0x5cbd1f);}return _0x24869b[_0xe10e('0x1a')](_0x5cbd1f)[_0xe10e('0x1b')]();};}function respondWithResult(_0x25a273,_0x4a5b42){_0x4a5b42=_0x4a5b42||0xc8;return function(_0x2ccc45){if(_0x2ccc45){return _0x25a273['status'](_0x4a5b42)[_0xe10e('0x1c')](_0x2ccc45);}};}function respondWithFilteredResult(_0x96948e,_0x2e37b2){return function(_0xc6f530){if(_0xc6f530){var _0x4584cc=typeof _0x2e37b2[_0xe10e('0x1d')]===_0xe10e('0x1e')&&typeof _0x2e37b2[_0xe10e('0x1f')]===_0xe10e('0x1e');var _0x20a404=_0xc6f530[_0xe10e('0x20')];var _0x91f0d1=_0x4584cc?0x0:_0x2e37b2[_0xe10e('0x1d')];var _0x148e99=_0x4584cc?_0xc6f530[_0xe10e('0x20')]:_0x2e37b2[_0xe10e('0x1d')]+_0x2e37b2[_0xe10e('0x1f')];var _0x15881e;if(_0x148e99>=_0x20a404){_0x148e99=_0x20a404;_0x15881e=0xc8;}else{_0x15881e=0xce;}_0x96948e[_0xe10e('0x1a')](_0x15881e);return _0x96948e[_0xe10e('0x21')](_0xe10e('0x22'),_0x91f0d1+'-'+_0x148e99+'/'+_0x20a404)[_0xe10e('0x1c')](_0xc6f530);}return null;};}function patchUpdates(_0x3eb773){return function(_0xcac481){try{jsonpatch[_0xe10e('0x23')](_0xcac481,_0x3eb773,!![]);}catch(_0x5d9d3b){return BPromise[_0xe10e('0x24')](_0x5d9d3b);}return _0xcac481['save']();};}function saveUpdates(_0x519cd9,_0xf447ea){return function(_0x1f70c0){if(_0x1f70c0){return _0x1f70c0[_0xe10e('0x25')](_0x519cd9)[_0xe10e('0x26')](function(_0xa77246){return _0xa77246;});}return null;};}function removeEntity(_0x3075eb,_0x2dfa94){return function(_0x5bcf42){if(_0x5bcf42){return _0x5bcf42['destroy']()[_0xe10e('0x26')](function(){_0x3075eb[_0xe10e('0x1a')](0xcc)[_0xe10e('0x1b')]();});}};}function handleEntityNotFound(_0x246999,_0x429400){return function(_0x4663bc){if(!_0x4663bc){_0x246999['sendStatus'](0x194);}return _0x4663bc;};}function handleError(_0x4afd2c,_0x120000){_0x120000=_0x120000||0x1f4;return function(_0x1ca188){logger[_0xe10e('0x27')](_0x1ca188['stack']);if(_0x1ca188[_0xe10e('0x28')]){delete _0x1ca188[_0xe10e('0x28')];}_0x4afd2c['status'](_0x120000)[_0xe10e('0x29')](_0x1ca188);};}exports['index']=function(_0x32b32b,_0x37f1f7){var _0x43a746={},_0x26f024={},_0x43e721={'count':0x0,'rows':[]};var _0x23ff93=_[_0xe10e('0x2a')](db[_0xe10e('0x2b')]['rawAttributes'],function(_0x17eeb9){return{'name':_0x17eeb9[_0xe10e('0x2c')],'type':_0x17eeb9[_0xe10e('0x2d')][_0xe10e('0x2e')]};});_0x26f024['model']=_[_0xe10e('0x2a')](_0x23ff93,_0xe10e('0x28'));_0x26f024[_0xe10e('0x2f')]=_[_0xe10e('0x30')](_0x32b32b[_0xe10e('0x2f')]);_0x26f024[_0xe10e('0x31')]=_[_0xe10e('0x32')](_0x26f024['model'],_0x26f024[_0xe10e('0x2f')]);_0x43a746['attributes']=_[_0xe10e('0x32')](_0x26f024[_0xe10e('0x33')],qs['fields'](_0x32b32b[_0xe10e('0x2f')]['fields']));_0x43a746[_0xe10e('0x34')]=_0x43a746[_0xe10e('0x34')]['length']?_0x43a746[_0xe10e('0x34')]:_0x26f024[_0xe10e('0x33')];if(!_0x32b32b['query'][_0xe10e('0x35')](_0xe10e('0x36'))){_0x43a746[_0xe10e('0x1f')]=qs['limit'](_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x1f')]);_0x43a746[_0xe10e('0x1d')]=qs[_0xe10e('0x1d')](_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x1d')]);}_0x43a746[_0xe10e('0x37')]=qs['sort'](_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x38')]);_0x43a746[_0xe10e('0x39')]=qs[_0xe10e('0x31')](_['pick'](_0x32b32b['query'],_0x26f024['filters']),_0x23ff93);if(_0x32b32b[_0xe10e('0x2f')]['filter']){_0x43a746[_0xe10e('0x39')]=_[_0xe10e('0x3a')](_0x43a746[_0xe10e('0x39')],{'$or':_['map'](_0x23ff93,function(_0x2708c1){if(_0x2708c1[_0xe10e('0x2d')]!==_0xe10e('0x3b')){var _0x223a13={};_0x223a13[_0x2708c1['name']]={'$like':'%'+_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x3c')]+'%'};return _0x223a13;}})});}_0x43a746=_[_0xe10e('0x3a')]({},_0x43a746,_0x32b32b[_0xe10e('0x3d')]);var _0x511cec={'where':_0x43a746[_0xe10e('0x39')]};return db[_0xe10e('0x2b')][_0xe10e('0x20')](_0x511cec)['then'](function(_0x2aee23){_0x43e721[_0xe10e('0x20')]=_0x2aee23;if(_0x32b32b['query'][_0xe10e('0x3e')]){_0x43a746[_0xe10e('0x3f')]=[{'all':!![]}];}return db[_0xe10e('0x2b')][_0xe10e('0x40')](_0x43a746);})[_0xe10e('0x26')](function(_0x2e8db1){_0x43e721[_0xe10e('0x41')]=_0x2e8db1;return _0x43e721;})['then'](respondWithFilteredResult(_0x37f1f7,_0x43a746))['catch'](handleError(_0x37f1f7,null));};exports[_0xe10e('0x42')]=function(_0x366c62,_0x5e985e){var _0x12a787={'raw':!![],'where':{'id':_0x366c62[_0xe10e('0x43')]['id']}},_0x37e988={};_0x37e988[_0xe10e('0x33')]=_[_0xe10e('0x30')](db[_0xe10e('0x2b')][_0xe10e('0x44')]);_0x37e988[_0xe10e('0x2f')]=_[_0xe10e('0x30')](_0x366c62[_0xe10e('0x2f')]);_0x37e988[_0xe10e('0x31')]=_['intersection'](_0x37e988[_0xe10e('0x33')],_0x37e988[_0xe10e('0x2f')]);_0x12a787[_0xe10e('0x34')]=_[_0xe10e('0x32')](_0x37e988[_0xe10e('0x33')],qs[_0xe10e('0x45')](_0x366c62[_0xe10e('0x2f')][_0xe10e('0x45')]));_0x12a787[_0xe10e('0x34')]=_0x12a787[_0xe10e('0x34')][_0xe10e('0x46')]?_0x12a787['attributes']:_0x37e988[_0xe10e('0x33')];if(_0x366c62[_0xe10e('0x2f')]['includeAll']){_0x12a787[_0xe10e('0x3f')]=[{'all':!![]}];}_0x12a787=_[_0xe10e('0x3a')]({},_0x12a787,_0x366c62['options']);return db[_0xe10e('0x2b')][_0xe10e('0x47')](_0x12a787)[_0xe10e('0x26')](handleEntityNotFound(_0x5e985e,null))[_0xe10e('0x26')](respondWithResult(_0x5e985e,null))['catch'](handleError(_0x5e985e,null));};exports['update']=function(_0x2c6b70,_0xc801b){if(_0x2c6b70['body']['id']){delete _0x2c6b70['body']['id'];}return db['CmHopperBlack'][_0xe10e('0x47')]({'where':{'id':_0x2c6b70[_0xe10e('0x43')]['id']}})['then'](handleEntityNotFound(_0xc801b,null))['then'](saveUpdates(_0x2c6b70[_0xe10e('0x48')],null))[_0xe10e('0x26')](respondWithResult(_0xc801b,null))[_0xe10e('0x49')](handleError(_0xc801b,null));};exports[_0xe10e('0x4a')]=function(_0x182167,_0x1eb529){return db['CmHopperBlack'][_0xe10e('0x47')]({'where':{'id':_0x182167[_0xe10e('0x43')]['id']}})[_0xe10e('0x26')](handleEntityNotFound(_0x1eb529,null))[_0xe10e('0x26')](removeEntity(_0x1eb529,null))[_0xe10e('0x49')](handleError(_0x1eb529,null));};exports['describe']=function(_0x55ade0,_0x42d728){return db['CmHopperBlack']['describe']()[_0xe10e('0x26')](respondWithResult(_0x42d728,null))['catch'](handleError(_0x42d728,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 911ce7e..2aa34e6 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 _0x8ec8=['path','rimraf','../../config/environment','exports','define','CmHopperBlack','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5065b6,_0x35f46a){var _0x244227=function(_0x30f3b4){while(--_0x30f3b4){_0x5065b6['push'](_0x5065b6['shift']());}};_0x244227(++_0x35f46a);}(_0x8ec8,0x8a));var _0x88ec=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8ec8[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x88ec('0x0'));var util=require('util');var logger=require(_0x88ec('0x1'))(_0x88ec('0x2'));var moment=require('moment');var BPromise=require(_0x88ec('0x3'));var rp=require(_0x88ec('0x4'));var fs=require('fs');var path=require(_0x88ec('0x5'));var rimraf=require(_0x88ec('0x6'));var config=require(_0x88ec('0x7'));var attributes=require('./cmHopperBlack.attributes');module[_0x88ec('0x8')]=function(_0x4c6426,_0x27d313){return _0x4c6426[_0x88ec('0x9')](_0x88ec('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfeaa=['../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x543a5e,_0x33dd65){var _0x29afa6=function(_0x42d2ec){while(--_0x42d2ec){_0x543a5e['push'](_0x543a5e['shift']());}};_0x29afa6(++_0x33dd65);}(_0xfeaa,0x95));var _0xafea=function(_0x2d8f47,_0x16d3d8){_0x2d8f47=_0x2d8f47-0x0;var _0x389eba=_0xfeaa[_0x2d8f47];return _0x389eba;};'use strict';var _=require(_0xafea('0x0'));var util=require('util');var logger=require(_0xafea('0x1'))('api');var moment=require(_0xafea('0x2'));var BPromise=require(_0xafea('0x3'));var rp=require(_0xafea('0x4'));var fs=require('fs');var path=require(_0xafea('0x5'));var rimraf=require(_0xafea('0x6'));var config=require(_0xafea('0x7'));var attributes=require(_0xafea('0x8'));module[_0xafea('0x9')]=function(_0x32cfb7,_0x4cf562){return _0x32cfb7['define'](_0xafea('0xa'),attributes,{'tableName':_0xafea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 95ffc19..4230fbd 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 _0x5611=['attributes','GetCmHopperBlack','stringify','catch','UpdateCmHopperBlack','CmHopperBlack','body','DestroyCmHopperBlack','destroy','where','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','findAll','options','limit','include','map','model'];(function(_0x3ace04,_0x2e2afb){var _0x51ffea=function(_0x29a8f){while(--_0x29a8f){_0x3ace04['push'](_0x3ace04['shift']());}};_0x51ffea(++_0x2e2afb);}(_0x5611,0x106));var _0x1561=function(_0x261da8,_0x469e93){_0x261da8=_0x261da8-0x0;var _0x13fddc=_0x5611[_0x261da8];return _0x13fddc;};'use strict';var _=require(_0x1561('0x0'));var util=require(_0x1561('0x1'));var moment=require(_0x1561('0x2'));var BPromise=require(_0x1561('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1561('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1561('0x5'));var logger=require(_0x1561('0x6'))(_0x1561('0x7'));var config=require(_0x1561('0x8'));var jayson=require(_0x1561('0x9'));var client=jayson['client'][_0x1561('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49771b,_0x249c1b,_0x36d454){return new BPromise(function(_0x148953,_0x25bc7a){return client['request'](_0x49771b,_0x36d454)[_0x1561('0xb')](function(_0x16c74f){logger[_0x1561('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x249c1b,_0x1561('0xd'));logger[_0x1561('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x249c1b,'request\x20sent',JSON['stringify'](_0x16c74f));if(_0x16c74f['error']){if(_0x16c74f[_0x1561('0xf')][_0x1561('0x10')]===0x1f4){logger[_0x1561('0xf')](_0x1561('0x11'),_0x249c1b,_0x16c74f[_0x1561('0xf')]['message']);return _0x25bc7a(_0x16c74f['error'][_0x1561('0x12')]);}logger[_0x1561('0xf')](_0x1561('0x11'),_0x249c1b,_0x16c74f['error'][_0x1561('0x12')]);return _0x148953(_0x16c74f[_0x1561('0xf')]['message']);}else{logger['info'](_0x1561('0x11'),_0x249c1b,'request\x20sent');_0x148953(_0x16c74f[_0x1561('0x13')][_0x1561('0x12')]);}})['catch'](function(_0x44fd70){logger[_0x1561('0xf')](_0x1561('0x11'),_0x249c1b,_0x44fd70);_0x25bc7a(_0x44fd70);});});}exports['GetCmHopperBlack']=function(_0x292056){var _0x246147=this;return new Promise(function(_0x296c4c,_0x13aee2){return db['CmHopperBlack'][_0x1561('0x14')]({'raw':_0x292056['options']?_0x292056['options']['raw']===undefined?!![]:![]:!![],'where':_0x292056[_0x1561('0x15')]?_0x292056[_0x1561('0x15')]['where']||null:null,'attributes':_0x292056['options']?_0x292056[_0x1561('0x15')]['attributes']||null:null,'limit':_0x292056['options']?_0x292056[_0x1561('0x15')][_0x1561('0x16')]||null:null,'include':_0x292056[_0x1561('0x15')]?_0x292056[_0x1561('0x15')][_0x1561('0x17')]?_[_0x1561('0x18')](_0x292056[_0x1561('0x15')][_0x1561('0x17')],function(_0x1d7a46){return{'model':db[_0x1d7a46[_0x1561('0x19')]],'as':_0x1d7a46['as'],'attributes':_0x1d7a46['attributes'],'include':_0x1d7a46['include']?_[_0x1561('0x18')](_0x1d7a46[_0x1561('0x17')],function(_0x195bef){return{'model':db[_0x195bef['model']],'as':_0x195bef['as'],'attributes':_0x195bef[_0x1561('0x1a')],'include':_0x195bef[_0x1561('0x17')]?_[_0x1561('0x18')](_0x195bef[_0x1561('0x17')],function(_0x21b185){return{'model':db[_0x21b185[_0x1561('0x19')]],'as':_0x21b185['as'],'attributes':_0x21b185[_0x1561('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1561('0xb')](function(_0x5127fc){logger[_0x1561('0xc')](_0x1561('0x1b'),_0x292056);logger['debug'](_0x1561('0x1b'),_0x292056,JSON[_0x1561('0x1c')](_0x5127fc));_0x296c4c(_0x5127fc);})[_0x1561('0x1d')](function(_0x267c09){logger['error'](_0x1561('0x1b'),_0x267c09['message'],_0x292056);_0x13aee2(_0x246147[_0x1561('0xf')](0x1f4,_0x267c09[_0x1561('0x12')]));});});};exports[_0x1561('0x1e')]=function(_0x3c8af6){var _0x469fdb=this;return new Promise(function(_0x1c8533,_0x4140cc){return db[_0x1561('0x1f')]['update'](_0x3c8af6[_0x1561('0x20')],{'raw':_0x3c8af6['options']?_0x3c8af6[_0x1561('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c8af6['options']?_0x3c8af6['options']['where']||null:null,'attributes':_0x3c8af6[_0x1561('0x15')]?_0x3c8af6[_0x1561('0x15')][_0x1561('0x1a')]||null:null,'limit':_0x3c8af6[_0x1561('0x15')]?_0x3c8af6[_0x1561('0x15')]['limit']||null:null})[_0x1561('0xb')](function(_0x3363cf){logger['info'](_0x1561('0x1e'),_0x3c8af6);logger['debug'](_0x1561('0x1e'),_0x3c8af6,JSON[_0x1561('0x1c')](_0x3363cf));_0x1c8533(_0x3363cf);})[_0x1561('0x1d')](function(_0x286c9b){logger[_0x1561('0xf')](_0x1561('0x1e'),_0x286c9b['message'],_0x3c8af6);_0x4140cc(_0x469fdb[_0x1561('0xf')](0x1f4,_0x286c9b[_0x1561('0x12')]));});});};exports[_0x1561('0x21')]=function(_0x4b19fb){var _0x62be6c=this;return new Promise(function(_0x5818fa,_0x5234c8){return db[_0x1561('0x1f')][_0x1561('0x22')]({'where':_0x4b19fb[_0x1561('0x15')]?_0x4b19fb['options'][_0x1561('0x23')]||null:null})[_0x1561('0xb')](function(_0x59f101){logger[_0x1561('0xc')](_0x1561('0x21'),_0x4b19fb);logger[_0x1561('0xe')](_0x1561('0x21'),_0x4b19fb,JSON[_0x1561('0x1c')](_0x59f101));_0x5818fa(_0x59f101);})[_0x1561('0x1d')](function(_0x7d95be){logger[_0x1561('0xf')](_0x1561('0x21'),_0x7d95be[_0x1561('0x12')],_0x4b19fb);_0x5234c8(_0x62be6c['error'](0x1f4,_0x7d95be['message']));});});}; \ No newline at end of file +var _0xde80=['GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde80,0x10d));var _0x0de8=function(_0xe11966,_0x455d9d){_0xe11966=_0xe11966-0x0;var _0x2fa7e1=_0xde80[_0xe11966];return _0x2fa7e1;};'use strict';var _=require(_0x0de8('0x0'));var util=require(_0x0de8('0x1'));var moment=require(_0x0de8('0x2'));var BPromise=require(_0x0de8('0x3'));var rs=require(_0x0de8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0de8('0x5'));var logger=require(_0x0de8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0de8('0x7'));var client=jayson[_0x0de8('0x8')][_0x0de8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bdef0,_0x5ee4be,_0x469076){return new BPromise(function(_0x50e91b,_0x386163){return client['request'](_0x4bdef0,_0x469076)[_0x0de8('0xa')](function(_0x3d1666){logger[_0x0de8('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x5ee4be,_0x0de8('0xc'));logger[_0x0de8('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5ee4be,_0x0de8('0xc'),JSON[_0x0de8('0xe')](_0x3d1666));if(_0x3d1666[_0x0de8('0xf')]){if(_0x3d1666[_0x0de8('0xf')][_0x0de8('0x10')]===0x1f4){logger[_0x0de8('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x5ee4be,_0x3d1666[_0x0de8('0xf')][_0x0de8('0x11')]);return _0x386163(_0x3d1666[_0x0de8('0xf')][_0x0de8('0x11')]);}logger[_0x0de8('0xf')](_0x0de8('0x12'),_0x5ee4be,_0x3d1666[_0x0de8('0xf')][_0x0de8('0x11')]);return _0x50e91b(_0x3d1666[_0x0de8('0xf')][_0x0de8('0x11')]);}else{logger[_0x0de8('0xb')](_0x0de8('0x12'),_0x5ee4be,_0x0de8('0xc'));_0x50e91b(_0x3d1666['result']['message']);}})['catch'](function(_0x4f81ef){logger['error'](_0x0de8('0x12'),_0x5ee4be,_0x4f81ef);_0x386163(_0x4f81ef);});});}exports[_0x0de8('0x13')]=function(_0x1f0c6e){var _0x20e76c=this;return new Promise(function(_0xe25f6,_0xbd685c){return db[_0x0de8('0x14')][_0x0de8('0x15')]({'raw':_0x1f0c6e[_0x0de8('0x16')]?_0x1f0c6e[_0x0de8('0x16')][_0x0de8('0x17')]===undefined?!![]:![]:!![],'where':_0x1f0c6e['options']?_0x1f0c6e[_0x0de8('0x16')][_0x0de8('0x18')]||null:null,'attributes':_0x1f0c6e[_0x0de8('0x16')]?_0x1f0c6e[_0x0de8('0x16')][_0x0de8('0x19')]||null:null,'limit':_0x1f0c6e[_0x0de8('0x16')]?_0x1f0c6e['options']['limit']||null:null,'include':_0x1f0c6e[_0x0de8('0x16')]?_0x1f0c6e[_0x0de8('0x16')][_0x0de8('0x1a')]?_[_0x0de8('0x1b')](_0x1f0c6e['options']['include'],function(_0x2cc82d){return{'model':db[_0x2cc82d[_0x0de8('0x1c')]],'as':_0x2cc82d['as'],'attributes':_0x2cc82d[_0x0de8('0x19')],'include':_0x2cc82d['include']?_['map'](_0x2cc82d[_0x0de8('0x1a')],function(_0x5e36e7){return{'model':db[_0x5e36e7['model']],'as':_0x5e36e7['as'],'attributes':_0x5e36e7[_0x0de8('0x19')],'include':_0x5e36e7[_0x0de8('0x1a')]?_['map'](_0x5e36e7['include'],function(_0xb71b67){return{'model':db[_0xb71b67[_0x0de8('0x1c')]],'as':_0xb71b67['as'],'attributes':_0xb71b67[_0x0de8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0de8('0xa')](function(_0x5bf504){logger[_0x0de8('0xb')](_0x0de8('0x13'),_0x1f0c6e);logger['debug'](_0x0de8('0x13'),_0x1f0c6e,JSON[_0x0de8('0xe')](_0x5bf504));_0xe25f6(_0x5bf504);})['catch'](function(_0x49596a){logger[_0x0de8('0xf')]('GetCmHopperBlack',_0x49596a[_0x0de8('0x11')],_0x1f0c6e);_0xbd685c(_0x20e76c[_0x0de8('0xf')](0x1f4,_0x49596a[_0x0de8('0x11')]));});});};exports[_0x0de8('0x1d')]=function(_0x5d11d7){var _0x2dce51=this;return new Promise(function(_0x577111,_0x275e35){return db['CmHopperBlack'][_0x0de8('0x1e')](_0x5d11d7[_0x0de8('0x1f')],{'raw':_0x5d11d7[_0x0de8('0x16')]?_0x5d11d7[_0x0de8('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d11d7[_0x0de8('0x16')]?_0x5d11d7[_0x0de8('0x16')][_0x0de8('0x18')]||null:null,'attributes':_0x5d11d7['options']?_0x5d11d7[_0x0de8('0x16')][_0x0de8('0x19')]||null:null,'limit':_0x5d11d7['options']?_0x5d11d7['options'][_0x0de8('0x20')]||null:null})['then'](function(_0x1185e6){logger['info']('UpdateCmHopperBlack',_0x5d11d7);logger['debug'](_0x0de8('0x1d'),_0x5d11d7,JSON['stringify'](_0x1185e6));_0x577111(_0x1185e6);})['catch'](function(_0x43763c){logger[_0x0de8('0xf')](_0x0de8('0x1d'),_0x43763c['message'],_0x5d11d7);_0x275e35(_0x2dce51[_0x0de8('0xf')](0x1f4,_0x43763c[_0x0de8('0x11')]));});});};exports[_0x0de8('0x21')]=function(_0x2a997f){var _0xdc9c32=this;return new Promise(function(_0x244f81,_0x3d1658){return db[_0x0de8('0x14')][_0x0de8('0x22')]({'where':_0x2a997f[_0x0de8('0x16')]?_0x2a997f['options'][_0x0de8('0x18')]||null:null})[_0x0de8('0xa')](function(_0x40f15e){logger[_0x0de8('0xb')](_0x0de8('0x21'),_0x2a997f);logger['debug'](_0x0de8('0x21'),_0x2a997f,JSON[_0x0de8('0xe')](_0x40f15e));_0x244f81(_0x40f15e);})[_0x0de8('0x23')](function(_0x22ea0e){logger[_0x0de8('0xf')](_0x0de8('0x21'),_0x22ea0e[_0x0de8('0x11')],_0x2a997f);_0x3d1658(_0xdc9c32[_0x0de8('0xf')](0x1f4,_0x22ea0e[_0x0de8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 39960f7..6054936 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 _0x1623=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','get','/:id','show','put','update','delete','destroy','exports'];(function(_0x241e93,_0x595ec4){var _0x61940d=function(_0x29d379){while(--_0x29d379){_0x241e93['push'](_0x241e93['shift']());}};_0x61940d(++_0x595ec4);}(_0x1623,0xab));var _0x3162=function(_0x8ab09c,_0xa64565){_0x8ab09c=_0x8ab09c-0x0;var _0x2fd7df=_0x1623[_0x8ab09c];return _0x2fd7df;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3162('0xf')]);router[_0x3162('0x10')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0x11')]);module[_0x3162('0x12')]=router; \ No newline at end of file +var _0x9536=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer','util','path'];(function(_0x23ee7c,_0x1c2ae4){var _0x746716=function(_0x403e14){while(--_0x403e14){_0x23ee7c['push'](_0x23ee7c['shift']());}};_0x746716(++_0x1c2ae4);}(_0x9536,0x179));var _0x6953=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0x9536[_0x1d83db];return _0x2dc1d1;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['put'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0x10')]);router[_0x6953('0x11')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0x12')]);module[_0x6953('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 410657b..91112dd 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 _0xd845=['setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x49a57f,_0x405f38){var _0x2fa2a5=function(_0x359a98){while(--_0x359a98){_0x49a57f['push'](_0x49a57f['shift']());}};_0x2fa2a5(++_0x405f38);}(_0xd845,0xa1));var _0x5d84=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xd845[_0x2555d0];return _0x3bb486;};'use strict';var Sequelize=require(_0x5d84('0x0'));var moment=require(_0x5d84('0x1'));module['exports']={'state':{'type':Sequelize[_0x5d84('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5d84('0x3')]},'scheduledat':{'type':Sequelize[_0x5d84('0x4')]},'countbusyretry':{'type':Sequelize[_0x5d84('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5d84('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5d84('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x5d84('0x3')]},'originatecalleridname':{'type':Sequelize[_0x5d84('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5d84('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5d84('0x4')]},'droptime':{'type':Sequelize[_0x5d84('0x4')]},'endtime':{'type':Sequelize[_0x5d84('0x4')]},'ringtime':{'type':Sequelize[_0x5d84('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5d84('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5d84('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5d84('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x5d84('0x3')]},'secondDisposition':{'type':Sequelize[_0x5d84('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5d84('0x3')]},'dispositionat':{'type':Sequelize[_0x5d84('0x4')],'set':function(_0x3919a8){var _0x57c875=this[_0x5d84('0x5')](_0x5d84('0x6'));if(_0x57c875&&_0x3919a8){this[_0x5d84('0x7')](_0x5d84('0x8'),moment(_0x3919a8)[_0x5d84('0x9')](moment(_0x57c875),_0x5d84('0xa')));}}},'amd':{'type':Sequelize[_0x5d84('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5d84('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5d84('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5d84('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5d84('0x4')]},'callback':{'type':Sequelize[_0x5d84('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d84('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5d84('0x4')]},'deleted':{'type':Sequelize[_0x5d84('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5d84('0x4')]},'recallme':{'type':Sequelize[_0x5d84('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5d84('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5d84('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa61e=['INTEGER','STRING','DATE','diff','seconds','BOOLEAN','sequelize','exports'];(function(_0x352658,_0x13068b){var _0x5a9f8f=function(_0x1ac831){while(--_0x1ac831){_0x352658['push'](_0x352658['shift']());}};_0x5a9f8f(++_0x13068b);}(_0xa61e,0x1d6));var _0xea61=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa61e[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0xea61('0x0'));var moment=require('moment');module[_0xea61('0x1')]={'state':{'type':Sequelize[_0xea61('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xea61('0x3')]},'scheduledat':{'type':Sequelize[_0xea61('0x4')]},'countbusyretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xea61('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xea61('0x3')]},'originatecalleridname':{'type':Sequelize[_0xea61('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xea61('0x4')]},'responsetime':{'type':Sequelize[_0xea61('0x4')]},'answertime':{'type':Sequelize[_0xea61('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xea61('0x3')]},'campaign':{'type':Sequelize[_0xea61('0x3')]},'campaigntype':{'type':Sequelize[_0xea61('0x3')]},'membername':{'type':Sequelize[_0xea61('0x3')]},'reason':{'type':Sequelize[_0xea61('0x3')]},'disposition':{'type':Sequelize[_0xea61('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xea61('0x3')]},'dispositionat':{'type':Sequelize[_0xea61('0x4')],'set':function(_0x18fbf4){var _0x36a5c3=this['getDataValue']('endtime');if(_0x36a5c3&&_0x18fbf4){this['setDataValue']('followuptime',moment(_0x18fbf4)[_0xea61('0x5')](moment(_0x36a5c3),_0xea61('0x6')));}}},'amd':{'type':Sequelize[_0xea61('0x7')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xea61('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xea61('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xea61('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xea61('0x4')]},'deleted':{'type':Sequelize[_0xea61('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xea61('0x4')]},'recallme':{'type':Sequelize[_0xea61('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xea61('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 385f929..d0a41cb 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 _0xdb28=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','CmHopperFinal','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','insert','into','cm_hopper','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(CampaignId)','state','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf'];(function(_0x1c3863,_0x2bd7c0){var _0x341c19=function(_0x21603e){while(--_0x21603e){_0x1c3863['push'](_0x1c3863['shift']());}};_0x341c19(++_0x2bd7c0);}(_0xdb28,0x106));var _0x8db2=function(_0x3e848c,_0x2f43c0){_0x3e848c=_0x3e848c-0x0;var _0x39e8c5=_0xdb28[_0x3e848c];return _0x39e8c5;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['describe']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')]()['then'](respondWithResult(_0x2ada52,null))['catch'](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x2e46d4,_0x164020){if(_0x2e46d4['body']['uniqueid']){delete _0x2e46d4['body'][_0x8db2('0x4a')];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'uniqueid':_0x2e46d4[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x164020,null))[_0x8db2('0x24')](saveUpdates(_0x2e46d4[_0x8db2('0x4b')],null))['then'](respondWithResult(_0x164020,null))['catch'](handleError(_0x164020,null));};exports[_0x8db2('0x4c')]=function(_0x18c6ef,_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x18c6ef[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x54')))),_0x8db2('0x55')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x56')))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8db2('0x58')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal'](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x5d')))),_0x8db2('0x5e')]]})['then'](handleEntityNotFound(_0x2908e4,null))[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x42')](handleError(_0x2908e4,null));};exports[_0x8db2('0x5f')]=function(_0xc27a7e,_0x349db0,_0x53b2dc){return db[_0x8db2('0x2b')][_0x8db2('0x40')]({'raw':![],'where':{'CampaignId':_0xc27a7e[_0x8db2('0x44')]['id']},'attributes':[[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x50')))),_0x8db2('0x51')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x52')))),_0x8db2('0x53')],[db[_0x8db2('0x4d')]['fn']('COUNT',db[_0x8db2('0x4d')]['fn']('IF',db['sequelize'][_0x8db2('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x8db2('0x55')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x8db2('0x57')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x60')))),_0x8db2('0x58')],[db['sequelize']['fn'](_0x8db2('0x4e'),db[_0x8db2('0x4d')]['fn']('IF',db[_0x8db2('0x4d')][_0x8db2('0x4f')](_0x8db2('0x59')))),_0x8db2('0x5a')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5b')))),_0x8db2('0x5c')],[db[_0x8db2('0x4d')]['fn'](_0x8db2('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8db2('0x4f')](_0x8db2('0x5d')))),'answeringMachine']]})[_0x8db2('0x24')](handleEntityNotFound(_0x349db0,null))[_0x8db2('0x24')](respondWithResult(_0x349db0,null))[_0x8db2('0x42')](handleError(_0x349db0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x26523b,_0x291375,_0x2cf731){return db['VoiceQueue'][_0x8db2('0x48')]({'where':{'id':_0x26523b[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x291375,null))[_0x8db2('0x24')](function(_0x3a0946){var _0x5923b3;if(_0x3a0946){_0x5923b3=squel[_0x8db2('0x61')]()[_0x8db2('0x62')](_0x8db2('0x63'))['fromQuery'](['phone',_0x8db2('0x64'),_0x8db2('0x65'),'ListId',_0x8db2('0x66'),_0x8db2('0x67'),_0x8db2('0x68')],squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))[_0x8db2('0x6a')](_0x8db2('0x6e'),_0x8db2('0x65'))['field'](_0x8db2('0x6f'),'ListId')[_0x8db2('0x6a')](_0x8db2('0x70'),'VoiceQueueId')[_0x8db2('0x6a')](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())['where']('state\x20=\x20?',_0x26523b[_0x8db2('0x4b')]['state'][_0x8db2('0x74')]())[_0x8db2('0x3b')](_0x8db2('0x75'))['where'](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')]('phone')[_0x8db2('0x71')](_0x8db2('0x63'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b['params']['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')](_0x8db2('0x73'),_0x26523b[_0x8db2('0x44')]['id']['toString']())[_0x8db2('0x3b')](_0x8db2('0x78')))[_0x8db2('0x79')]('ContactId'))['toString']();return db['sequelize'][_0x8db2('0x30')](_0x5923b3);}return[];})[_0x8db2('0x24')](respondWithResult(_0x291375,null))[_0x8db2('0x42')](handleError(_0x291375,null));};exports[_0x8db2('0x7a')]=function(_0x2ad024,_0x313918,_0x339d09){return db[_0x8db2('0x7b')][_0x8db2('0x48')]({'where':{'id':_0x2ad024[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x313918,null))['then'](function(_0x360a06){var _0xa2e293;if(_0x360a06){_0xa2e293=squel[_0x8db2('0x61')]()[_0x8db2('0x62')]('cm_hopper')['fromQuery']([_0x8db2('0x6c'),_0x8db2('0x64'),'ContactId',_0x8db2('0x7c'),_0x8db2('0x7d'),_0x8db2('0x67'),'updatedAt'],squel['select']()['field'](_0x8db2('0x6b'),_0x8db2('0x6c'))[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x64'))['field'](_0x8db2('0x6e'),'ContactId')[_0x8db2('0x6a')](_0x8db2('0x6f'),_0x8db2('0x7c'))[_0x8db2('0x6a')](_0x8db2('0x7e'),'CampaignId')['field'](_0x8db2('0x6d'),'createdAt')[_0x8db2('0x6a')](_0x8db2('0x6d'),_0x8db2('0x68'))[_0x8db2('0x71')](_0x8db2('0x72'))[_0x8db2('0x3b')]('CampaignId\x20=\x20?',_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x20?',_0x2ad024[_0x8db2('0x4b')][_0x8db2('0x7f')]['toString']())[_0x8db2('0x3b')](_0x8db2('0x75'))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x6c'))[_0x8db2('0x71')](_0x8db2('0x63'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]()))[_0x8db2('0x3b')](_0x8db2('0x76'),squel[_0x8db2('0x69')]()[_0x8db2('0x6a')](_0x8db2('0x77'))[_0x8db2('0x71')](_0x8db2('0x72'))['where'](_0x8db2('0x80'),_0x2ad024[_0x8db2('0x44')]['id'][_0x8db2('0x74')]())[_0x8db2('0x3b')]('state\x20=\x204'))[_0x8db2('0x79')](_0x8db2('0x65')))[_0x8db2('0x74')]();return db['sequelize']['query'](_0xa2e293);}return[];})[_0x8db2('0x24')](respondWithResult(_0x313918,null))[_0x8db2('0x42')](handleError(_0x313918,null));};exports[_0x8db2('0x81')]=function(_0xc83913,_0x4f9ce4,_0xaa2661){return db[_0x8db2('0x82')][_0x8db2('0x83')]({'where':{'VoiceQueueId':_0xc83913[_0x8db2('0x4b')]['VoiceQueueId'],'CampaignId':_0xc83913[_0x8db2('0x4b')][_0x8db2('0x7d')],'ContactId':_0xc83913[_0x8db2('0x4b')]['ContactId']}})['then'](handleEntityNotFound(_0x4f9ce4,null))['then'](function(_0x1ba097){if(_0x1ba097){return _0x1ba097;}return null;})[_0x8db2('0x24')](respondWithResult(_0x4f9ce4,null))[_0x8db2('0x42')](handleError(_0x4f9ce4,null));}; \ No newline at end of file +var _0x524e=['destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','then','includeAll','include','findAll','rows','catch','show','length','find','describe','body','uniqueid','params','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','group','Campaign','ContactId','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','CmHopper','findOne','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x524e,0x15e));var _0xe524=function(_0x450b21,_0x4260a0){_0x450b21=_0x450b21-0x0;var _0x8b9008=_0x524e[_0x450b21];return _0x8b9008;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['CmHopperFinal'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['describe']()[_0xe524('0x3f')](respondWithResult(_0x33b1c8,null))['catch'](handleError(_0x33b1c8,null));};exports['update']=function(_0x24f313,_0x59fe6b){if(_0x24f313[_0xe524('0x49')][_0xe524('0x4a')]){delete _0x24f313['body'][_0xe524('0x4a')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x24f313[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x59fe6b,null))[_0xe524('0x3f')](saveUpdates(_0x24f313['body'],null))['then'](respondWithResult(_0x59fe6b,null))['catch'](handleError(_0x59fe6b,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x4f7a64,_0x5477ca,_0x45f504){return db[_0xe524('0x3e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x4f7a64[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x4e')))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x51')))),_0xe524('0x52')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),_0xe524('0x54')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x59')))),'reCallContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xe524('0x3f')](handleEntityNotFound(_0x5477ca,null))['then'](respondWithResult(_0x5477ca,null))[_0xe524('0x44')](handleError(_0x5477ca,null));};exports[_0xe524('0x5a')]=function(_0x3f4201,_0x287ab8,_0x2b2a0e){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x3f4201[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),'busyContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x5b')))),_0xe524('0x5c')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x59')))),_0xe524('0x5d')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x5e')))),_0xe524('0x5f')]]})[_0xe524('0x3f')](handleEntityNotFound(_0x287ab8,null))['then'](respondWithResult(_0x287ab8,null))[_0xe524('0x44')](handleError(_0x287ab8,null));};exports[_0xe524('0x60')]=function(_0x43d125,_0x13905f,_0x4514d4){return db['VoiceQueue'][_0xe524('0x47')]({'where':{'id':_0x43d125[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x13905f,null))[_0xe524('0x3f')](function(_0x109da1){var _0x57b6bb;if(_0x109da1){_0x57b6bb=squel[_0xe524('0x61')]()[_0xe524('0x62')](_0xe524('0x63'))[_0xe524('0x64')]([_0xe524('0x65'),_0xe524('0x66'),'ContactId',_0xe524('0x67'),_0xe524('0x68'),_0xe524('0x69'),'updatedAt'],squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('ANY_VALUE(calleridnum)',_0xe524('0x65'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))[_0xe524('0x6b')](_0xe524('0x6d'),'ContactId')[_0xe524('0x6b')](_0xe524('0x6e'),_0xe524('0x67'))[_0xe524('0x6b')](_0xe524('0x6f'),_0xe524('0x68'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x69'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x70'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x20?',_0x43d125[_0xe524('0x49')][_0xe524('0x74')]['toString']())['where'](_0xe524('0x75'))['where'](_0xe524('0x76'),squel['select']()[_0xe524('0x6b')](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))['where']('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where'](_0xe524('0x76'),squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('calleridnum')[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')](_0xe524('0x77'),_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())['where']('state\x20=\x204'))[_0xe524('0x78')]('ContactId'))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0x57b6bb);}return[];})['then'](respondWithResult(_0x13905f,null))[_0xe524('0x44')](handleError(_0x13905f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1681c5,_0x41e693,_0xfc62e5){return db[_0xe524('0x79')][_0xe524('0x47')]({'where':{'id':_0x1681c5[_0xe524('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41e693,null))[_0xe524('0x3f')](function(_0x35d0f4){var _0xa8334;if(_0x35d0f4){_0xa8334=squel['insert']()[_0xe524('0x62')](_0xe524('0x63'))['fromQuery']([_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x7a'),_0xe524('0x67'),'CampaignId',_0xe524('0x69'),_0xe524('0x70')],squel[_0xe524('0x6a')]()['field'](_0xe524('0x7b'),'phone')[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))['field'](_0xe524('0x6d'),_0xe524('0x7a'))[_0xe524('0x6b')]('ANY_VALUE(ListId)','ListId')[_0xe524('0x6b')]('ANY_VALUE(CampaignId)',_0xe524('0x7c'))['field'](_0xe524('0x6c'),_0xe524('0x69'))['field'](_0xe524('0x6c'),_0xe524('0x70'))['from']('cm_hopper_final')[_0xe524('0x38')](_0xe524('0x7d'),_0x1681c5[_0xe524('0x4b')]['id']['toString']())[_0xe524('0x38')](_0xe524('0x7e'),_0x1681c5[_0xe524('0x49')][_0xe524('0x74')][_0xe524('0x73')]())[_0xe524('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xe524('0x38')](_0xe524('0x76'),squel['select']()['field'](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xe524('0x6a')]()[_0xe524('0x6b')](_0xe524('0x7f'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5['params']['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x204'))['group'](_0xe524('0x7a')))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0xa8334);}return[];})[_0xe524('0x3f')](respondWithResult(_0x41e693,null))[_0xe524('0x44')](handleError(_0x41e693,null));};exports['checkContactHopper']=function(_0x555801,_0x3e8668,_0x390093){return db[_0xe524('0x80')][_0xe524('0x81')]({'where':{'VoiceQueueId':_0x555801[_0xe524('0x49')][_0xe524('0x68')],'CampaignId':_0x555801[_0xe524('0x49')][_0xe524('0x7c')],'ContactId':_0x555801['body'][_0xe524('0x7a')]}})[_0xe524('0x3f')](handleEntityNotFound(_0x3e8668,null))[_0xe524('0x3f')](function(_0x5242b7){if(_0x5242b7){return _0x5242b7;}return null;})['then'](respondWithResult(_0x3e8668,null))[_0xe524('0x44')](handleError(_0x3e8668,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 190bcb2..d57f234 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 _0xe575=['uniqueid','lodash','util','api','moment','request-promise','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x12a023,_0x284fd2){var _0x14e19a=function(_0x2c1b75){while(--_0x2c1b75){_0x12a023['push'](_0x12a023['shift']());}};_0x14e19a(++_0x284fd2);}(_0xe575,0x91));var _0x5e57=function(_0x22fc72,_0x3bf728){_0x22fc72=_0x22fc72-0x0;var _0x33ca79=_0xe575[_0x22fc72];return _0x33ca79;};'use strict';var _=require(_0x5e57('0x0'));var util=require(_0x5e57('0x1'));var logger=require('../../config/logger')(_0x5e57('0x2'));var moment=require(_0x5e57('0x3'));var BPromise=require('bluebird');var rp=require(_0x5e57('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e57('0x5'));var config=require('../../config/environment');var attributes=require(_0x5e57('0x6'));module['exports']=function(_0x6b563b,_0x14a797){return _0x6b563b[_0x5e57('0x7')](_0x5e57('0x8'),attributes,{'tableName':_0x5e57('0x9'),'paranoid':![],'indexes':[{'name':_0x5e57('0xa'),'fields':[_0x5e57('0xa')]},{'name':_0x5e57('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6077=['../../config/logger','api','moment','path','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6077,0x1de));var _0x7607=function(_0x4dd63b,_0x1bf52d){_0x4dd63b=_0x4dd63b-0x0;var _0x1a5ccd=_0x6077[_0x4dd63b];return _0x1a5ccd;};'use strict';var _=require(_0x7607('0x0'));var util=require(_0x7607('0x1'));var logger=require(_0x7607('0x2'))(_0x7607('0x3'));var moment=require(_0x7607('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7607('0x5'));var rimraf=require('rimraf');var config=require(_0x7607('0x6'));var attributes=require(_0x7607('0x7'));module['exports']=function(_0x2f8dd0,_0xd7b847){return _0x2f8dd0[_0x7607('0x8')](_0x7607('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x7607('0xa'),'fields':['calleridnum']},{'name':_0x7607('0xb'),'fields':[_0x7607('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 024480a..43cacdc 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(_0x2c0cdd,_0xce5add){var _0x2aa500=function(_0x2aeea2){while(--_0x2aeea2){_0x2c0cdd['push'](_0x2c0cdd['shift']());}};_0x2aa500(++_0xce5add);}(_0xb10b,0x12a));var _0xbb10=function(_0x1833dc,_0x121d9d){_0x1833dc=_0x1833dc-0x0;var _0x77da96=_0xb10b[_0x1833dc];return _0x77da96;};'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(_0x4e0b7d,_0x5648c9){var _0x1406fa=function(_0x44c744){while(--_0x44c744){_0x4e0b7d['push'](_0x4e0b7d['shift']());}};_0x1406fa(++_0x5648c9);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d542c,_0x2098ae){_0x3d542c=_0x3d542c-0x0;var _0x4946de=_0xb10b[_0x3d542c];return _0x4946de;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 647dc4a..504850d 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 _0xa0d5=['/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','exports','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x231453,_0x544e0a){var _0x394a0b=function(_0x303413){while(--_0x303413){_0x231453['push'](_0x231453['shift']());}};_0x394a0b(++_0x544e0a);}(_0xa0d5,0xab));var _0x5a0d=function(_0x2384bb,_0x12f81b){_0x2384bb=_0x2384bb-0x0;var _0x3f2bac=_0xa0d5[_0x2384bb];return _0x3f2bac;};'use strict';var multer=require('multer');var util=require(_0x5a0d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5a0d('0x1'));var auth=require(_0x5a0d('0x2'));var interaction=require(_0x5a0d('0x3'));var config=require(_0x5a0d('0x4'));var controller=require(_0x5a0d('0x5'));router[_0x5a0d('0x6')]('/',auth['isAuthenticated'](),controller[_0x5a0d('0x7')]);router['get'](_0x5a0d('0x8'),auth[_0x5a0d('0x9')](),controller[_0x5a0d('0xa')]);router['get'](_0x5a0d('0xb'),auth[_0x5a0d('0x9')](),controller[_0x5a0d('0xc')]);router[_0x5a0d('0x6')](_0x5a0d('0xd'),auth[_0x5a0d('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x5a0d('0x6')](_0x5a0d('0xe'),auth[_0x5a0d('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x5a0d('0xf'),auth[_0x5a0d('0x9')](),controller[_0x5a0d('0x10')]);router[_0x5a0d('0x11')](_0x5a0d('0x12'),auth[_0x5a0d('0x9')](),controller[_0x5a0d('0x13')]);router[_0x5a0d('0x11')]('/checkContactHopper',auth[_0x5a0d('0x9')](),controller[_0x5a0d('0x14')]);router[_0x5a0d('0x15')]('/:id',auth[_0x5a0d('0x9')](),controller['update']);module[_0x5a0d('0x16')]=router; \ No newline at end of file +var _0x2ba0=['post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','index','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','get','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x2ba0,0x1dd));var _0x02ba=function(_0x5cc8d9,_0x489eee){_0x5cc8d9=_0x5cc8d9-0x0;var _0x1e4704=_0x2ba0[_0x5cc8d9];return _0x1e4704;};'use strict';var multer=require('multer');var util=require(_0x02ba('0x0'));var path=require(_0x02ba('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x02ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x02ba('0x3'));var interaction=require(_0x02ba('0x4'));var config=require('../../config/environment');var controller=require(_0x02ba('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x02ba('0x6')]);router['get'](_0x02ba('0x7'),auth[_0x02ba('0x8')](),controller[_0x02ba('0x9')]);router['get'](_0x02ba('0xa'),auth[_0x02ba('0x8')](),controller[_0x02ba('0xb')]);router['get'](_0x02ba('0xc'),auth[_0x02ba('0x8')](),controller[_0x02ba('0xd')]);router[_0x02ba('0xe')](_0x02ba('0xf'),auth['isAuthenticated'](),controller[_0x02ba('0x10')]);router[_0x02ba('0x11')](_0x02ba('0x12'),auth[_0x02ba('0x8')](),controller[_0x02ba('0x13')]);router[_0x02ba('0x11')](_0x02ba('0x14'),auth[_0x02ba('0x8')](),controller[_0x02ba('0x15')]);router['post'](_0x02ba('0x16'),auth[_0x02ba('0x8')](),controller[_0x02ba('0x17')]);router['put']('/:id',auth[_0x02ba('0x8')](),controller[_0x02ba('0x18')]);module[_0x02ba('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 75bbb2b..df2cfb5 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 _0xbf25=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x4e9d4d,_0x4877d2){var _0x217393=function(_0x4477a7){while(--_0x4477a7){_0x4e9d4d['push'](_0x4e9d4d['shift']());}};_0x217393(++_0x4877d2);}(_0xbf25,0x12d));var _0x5bf2=function(_0x1b5b1a,_0x146780){_0x1b5b1a=_0x1b5b1a-0x0;var _0x74e9ec=_0xbf25[_0x1b5b1a];return _0x74e9ec;};'use strict';var Sequelize=require(_0x5bf2('0x0'));module[_0x5bf2('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x5bf2('0x2')]},'scheduledat':{'type':Sequelize[_0x5bf2('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5bf2('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5bf2('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5bf2('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x5bf2('0x2')]},'originatecalleridname':{'type':Sequelize[_0x5bf2('0x2')]},'calleridnum':{'type':Sequelize[_0x5bf2('0x2')]},'calleridname':{'type':Sequelize[_0x5bf2('0x2')]},'starttime':{'type':Sequelize[_0x5bf2('0x3')]},'responsetime':{'type':Sequelize[_0x5bf2('0x3')]},'answertime':{'type':Sequelize[_0x5bf2('0x3')]},'droptime':{'type':Sequelize[_0x5bf2('0x3')]},'endtime':{'type':Sequelize[_0x5bf2('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5bf2('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5bf2('0x2')]},'campaign':{'type':Sequelize[_0x5bf2('0x2')]},'campaigntype':{'type':Sequelize[_0x5bf2('0x2')]},'membername':{'type':Sequelize[_0x5bf2('0x2')]},'reason':{'type':Sequelize[_0x5bf2('0x2')]},'amd':{'type':Sequelize[_0x5bf2('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5bf2('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5bf2('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5bf2('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x5bf2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5bf2('0x3')]},'edited':{'type':Sequelize[_0x5bf2('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5bf2('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5bf2('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5bf2('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5bf2('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5bf2('0x2')]}}; \ No newline at end of file +var _0xf898=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x37b67e,_0x2c3ceb){var _0x2072bf=function(_0x4f2d2b){while(--_0x4f2d2b){_0x37b67e['push'](_0x37b67e['shift']());}};_0x2072bf(++_0x2c3ceb);}(_0xf898,0x14d));var _0x8f89=function(_0x47714d,_0x518cd5){_0x47714d=_0x47714d-0x0;var _0x338896=_0xf898[_0x47714d];return _0x338896;};'use strict';var Sequelize=require(_0x8f89('0x0'));module[_0x8f89('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8f89('0x2')]},'scheduledat':{'type':Sequelize[_0x8f89('0x3')]},'countbusyretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8f89('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8f89('0x2')]},'calleridnum':{'type':Sequelize[_0x8f89('0x2')]},'calleridname':{'type':Sequelize[_0x8f89('0x2')]},'starttime':{'type':Sequelize[_0x8f89('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8f89('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8f89('0x2')]},'campaigntype':{'type':Sequelize[_0x8f89('0x2')]},'membername':{'type':Sequelize[_0x8f89('0x2')]},'reason':{'type':Sequelize[_0x8f89('0x2')]},'amd':{'type':Sequelize[_0x8f89('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8f89('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8f89('0x3')]},'recallme':{'type':Sequelize[_0x8f89('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8f89('0x3')]},'edited':{'type':Sequelize[_0x8f89('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 7f5a472..e24e6f6 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 _0x60ec=['intersection','attributes','fields','query','order','sort','where','filter','merge','VIRTUAL','options','includeAll','CmHopperHistory','rows','catch','show','params','include','find','describe','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x60ec,0x13d));var _0xc60e=function(_0x4d4aa4,_0xe06314){_0x4d4aa4=_0x4d4aa4-0x0;var _0x5daf18=_0x60ec[_0x4d4aa4];return _0x5daf18;};'use strict';var emlformat=require(_0xc60e('0x0'));var rimraf=require(_0xc60e('0x1'));var zipdir=require(_0xc60e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc60e('0x3'));var moment=require(_0xc60e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc60e('0x5'));var util=require('util');var path=require(_0xc60e('0x6'));var sox=require(_0xc60e('0x7'));var csv=require(_0xc60e('0x8'));var ejs=require(_0xc60e('0x9'));var fs=require('fs');var fs_extra=require(_0xc60e('0xa'));var _=require(_0xc60e('0xb'));var squel=require(_0xc60e('0xc'));var crypto=require(_0xc60e('0xd'));var jsforce=require(_0xc60e('0xe'));var deskjs=require(_0xc60e('0xf'));var toCsv=require(_0xc60e('0x8'));var querystring=require(_0xc60e('0x10'));var Papa=require(_0xc60e('0x11'));var Redis=require('ioredis');var authService=require(_0xc60e('0x12'));var qs=require(_0xc60e('0x13'));var as=require(_0xc60e('0x14'));var hardwareService=require(_0xc60e('0x15'));var logger=require(_0xc60e('0x16'))(_0xc60e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc60e('0x18'))['db'];function respondWithStatusCode(_0x197301,_0x4ee1d8){_0x4ee1d8=_0x4ee1d8||0xcc;return function(_0xca8598){if(_0xca8598){return _0x197301[_0xc60e('0x19')](_0x4ee1d8);}return _0x197301[_0xc60e('0x1a')](_0x4ee1d8)[_0xc60e('0x1b')]();};}function respondWithResult(_0x3129ef,_0x5d01f0){_0x5d01f0=_0x5d01f0||0xc8;return function(_0x3bb529){if(_0x3bb529){return _0x3129ef[_0xc60e('0x1a')](_0x5d01f0)['json'](_0x3bb529);}};}function respondWithFilteredResult(_0xe48847,_0x36b326){return function(_0x16a886){if(_0x16a886){var _0x21eae1=typeof _0x36b326[_0xc60e('0x1c')]===_0xc60e('0x1d')&&typeof _0x36b326['limit']===_0xc60e('0x1d');var _0x2d26ee=_0x16a886[_0xc60e('0x1e')];var _0xfb3d3f=_0x21eae1?0x0:_0x36b326[_0xc60e('0x1c')];var _0x23e77b=_0x21eae1?_0x16a886[_0xc60e('0x1e')]:_0x36b326[_0xc60e('0x1c')]+_0x36b326[_0xc60e('0x1f')];var _0x4ce1d7;if(_0x23e77b>=_0x2d26ee){_0x23e77b=_0x2d26ee;_0x4ce1d7=0xc8;}else{_0x4ce1d7=0xce;}_0xe48847[_0xc60e('0x1a')](_0x4ce1d7);return _0xe48847[_0xc60e('0x20')](_0xc60e('0x21'),_0xfb3d3f+'-'+_0x23e77b+'/'+_0x2d26ee)[_0xc60e('0x22')](_0x16a886);}return null;};}function patchUpdates(_0xf0e5d1){return function(_0x4f6abe){try{jsonpatch[_0xc60e('0x23')](_0x4f6abe,_0xf0e5d1,!![]);}catch(_0x270b46){return BPromise[_0xc60e('0x24')](_0x270b46);}return _0x4f6abe[_0xc60e('0x25')]();};}function saveUpdates(_0x3fb972,_0x40c6bf){return function(_0xbb57ff){if(_0xbb57ff){return _0xbb57ff[_0xc60e('0x26')](_0x3fb972)['then'](function(_0x5d4379){return _0x5d4379;});}return null;};}function removeEntity(_0x1739e1,_0x4585a8){return function(_0x257ca6){if(_0x257ca6){return _0x257ca6[_0xc60e('0x27')]()[_0xc60e('0x28')](function(){_0x1739e1[_0xc60e('0x1a')](0xcc)[_0xc60e('0x1b')]();});}};}function handleEntityNotFound(_0xf2c8ec,_0x1b2b41){return function(_0x3e9ad1){if(!_0x3e9ad1){_0xf2c8ec[_0xc60e('0x19')](0x194);}return _0x3e9ad1;};}function handleError(_0x212d46,_0x571f17){_0x571f17=_0x571f17||0x1f4;return function(_0x3d923b){logger[_0xc60e('0x29')](_0x3d923b[_0xc60e('0x2a')]);if(_0x3d923b[_0xc60e('0x2b')]){delete _0x3d923b['name'];}_0x212d46[_0xc60e('0x1a')](_0x571f17)[_0xc60e('0x2c')](_0x3d923b);};}exports['index']=function(_0x2d426b,_0x173441){var _0x41e3d1={},_0x4ad044={},_0x57d3e1={'count':0x0,'rows':[]};var _0x19ca5a=_[_0xc60e('0x2d')](db['CmHopperHistory'][_0xc60e('0x2e')],function(_0x1aac56){return{'name':_0x1aac56[_0xc60e('0x2f')],'type':_0x1aac56[_0xc60e('0x30')][_0xc60e('0x31')]};});_0x4ad044[_0xc60e('0x32')]=_[_0xc60e('0x2d')](_0x19ca5a,'name');_0x4ad044['query']=_[_0xc60e('0x33')](_0x2d426b['query']);_0x4ad044[_0xc60e('0x34')]=_[_0xc60e('0x35')](_0x4ad044[_0xc60e('0x32')],_0x4ad044['query']);_0x41e3d1[_0xc60e('0x36')]=_[_0xc60e('0x35')](_0x4ad044[_0xc60e('0x32')],qs[_0xc60e('0x37')](_0x2d426b[_0xc60e('0x38')][_0xc60e('0x37')]));_0x41e3d1['attributes']=_0x41e3d1[_0xc60e('0x36')]['length']?_0x41e3d1[_0xc60e('0x36')]:_0x4ad044[_0xc60e('0x32')];if(!_0x2d426b[_0xc60e('0x38')]['hasOwnProperty']('nolimit')){_0x41e3d1[_0xc60e('0x1f')]=qs[_0xc60e('0x1f')](_0x2d426b[_0xc60e('0x38')]['limit']);_0x41e3d1[_0xc60e('0x1c')]=qs[_0xc60e('0x1c')](_0x2d426b[_0xc60e('0x38')][_0xc60e('0x1c')]);}_0x41e3d1[_0xc60e('0x39')]=qs[_0xc60e('0x3a')](_0x2d426b['query'][_0xc60e('0x3a')]);_0x41e3d1[_0xc60e('0x3b')]=qs['filters'](_['pick'](_0x2d426b[_0xc60e('0x38')],_0x4ad044[_0xc60e('0x34')]),_0x19ca5a);if(_0x2d426b[_0xc60e('0x38')][_0xc60e('0x3c')]){_0x41e3d1[_0xc60e('0x3b')]=_[_0xc60e('0x3d')](_0x41e3d1[_0xc60e('0x3b')],{'$or':_['map'](_0x19ca5a,function(_0xdb481a){if(_0xdb481a[_0xc60e('0x30')]!==_0xc60e('0x3e')){var _0x1fb26e={};_0x1fb26e[_0xdb481a[_0xc60e('0x2b')]]={'$like':'%'+_0x2d426b['query'][_0xc60e('0x3c')]+'%'};return _0x1fb26e;}})});}_0x41e3d1=_[_0xc60e('0x3d')]({},_0x41e3d1,_0x2d426b[_0xc60e('0x3f')]);var _0x39942a={'where':_0x41e3d1[_0xc60e('0x3b')]};return db['CmHopperHistory'][_0xc60e('0x1e')](_0x39942a)[_0xc60e('0x28')](function(_0x3a09ba){_0x57d3e1['count']=_0x3a09ba;if(_0x2d426b[_0xc60e('0x38')][_0xc60e('0x40')]){_0x41e3d1['include']=[{'all':!![]}];}return db[_0xc60e('0x41')]['findAll'](_0x41e3d1);})['then'](function(_0xd71abd){_0x57d3e1[_0xc60e('0x42')]=_0xd71abd;return _0x57d3e1;})[_0xc60e('0x28')](respondWithFilteredResult(_0x173441,_0x41e3d1))[_0xc60e('0x43')](handleError(_0x173441,null));};exports[_0xc60e('0x44')]=function(_0x2dc48a,_0x3353fc){var _0x1f2d9b={'raw':!![],'where':{'id':_0x2dc48a[_0xc60e('0x45')]['id']}},_0x4e4d69={};_0x4e4d69[_0xc60e('0x32')]=_[_0xc60e('0x33')](db[_0xc60e('0x41')][_0xc60e('0x2e')]);_0x4e4d69[_0xc60e('0x38')]=_[_0xc60e('0x33')](_0x2dc48a['query']);_0x4e4d69[_0xc60e('0x34')]=_[_0xc60e('0x35')](_0x4e4d69[_0xc60e('0x32')],_0x4e4d69[_0xc60e('0x38')]);_0x1f2d9b['attributes']=_[_0xc60e('0x35')](_0x4e4d69[_0xc60e('0x32')],qs[_0xc60e('0x37')](_0x2dc48a[_0xc60e('0x38')][_0xc60e('0x37')]));_0x1f2d9b[_0xc60e('0x36')]=_0x1f2d9b[_0xc60e('0x36')]['length']?_0x1f2d9b[_0xc60e('0x36')]:_0x4e4d69['model'];if(_0x2dc48a['query']['includeAll']){_0x1f2d9b[_0xc60e('0x46')]=[{'all':!![]}];}_0x1f2d9b=_['merge']({},_0x1f2d9b,_0x2dc48a['options']);return db[_0xc60e('0x41')][_0xc60e('0x47')](_0x1f2d9b)[_0xc60e('0x28')](handleEntityNotFound(_0x3353fc,null))[_0xc60e('0x28')](respondWithResult(_0x3353fc,null))[_0xc60e('0x43')](handleError(_0x3353fc,null));};exports['create']=function(_0x469d35,_0x145702){return db['CmHopperHistory']['create'](_0x469d35['body'],{})[_0xc60e('0x28')](respondWithResult(_0x145702,0xc9))['catch'](handleError(_0x145702,null));};exports[_0xc60e('0x48')]=function(_0x4bea87,_0x263c58){return db[_0xc60e('0x41')][_0xc60e('0x48')]()[_0xc60e('0x28')](respondWithResult(_0x263c58,null))['catch'](handleError(_0x263c58,null));};exports['update']=function(_0xb635e2,_0x578513){if(_0xb635e2[_0xc60e('0x49')]['uniqueid']){delete _0xb635e2[_0xc60e('0x49')]['uniqueid'];}return db[_0xc60e('0x41')][_0xc60e('0x47')]({'where':{'uniqueid':_0xb635e2[_0xc60e('0x45')]['id']}})[_0xc60e('0x28')](handleEntityNotFound(_0x578513,null))[_0xc60e('0x28')](saveUpdates(_0xb635e2[_0xc60e('0x49')],null))[_0xc60e('0x28')](respondWithResult(_0x578513,null))[_0xc60e('0x43')](handleError(_0x578513,null));}; \ No newline at end of file +var _0xedc6=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs'];(function(_0x545666,_0x86e245){var _0x883f4d=function(_0x33c02f){while(--_0x33c02f){_0x545666['push'](_0x545666['shift']());}};_0x883f4d(++_0x86e245);}(_0xedc6,0x12a));var _0x6edc=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xedc6[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x6edc('0x0'));var rimraf=require(_0x6edc('0x1'));var zipdir=require(_0x6edc('0x2'));var jsonpatch=require(_0x6edc('0x3'));var rp=require(_0x6edc('0x4'));var moment=require(_0x6edc('0x5'));var BPromise=require(_0x6edc('0x6'));var Mustache=require(_0x6edc('0x7'));var util=require(_0x6edc('0x8'));var path=require('path');var sox=require(_0x6edc('0x9'));var csv=require(_0x6edc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6edc('0xb'));var _=require(_0x6edc('0xc'));var squel=require(_0x6edc('0xd'));var crypto=require(_0x6edc('0xe'));var jsforce=require(_0x6edc('0xf'));var deskjs=require(_0x6edc('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6edc('0x11'));var as=require(_0x6edc('0x12'));var hardwareService=require(_0x6edc('0x13'));var logger=require(_0x6edc('0x14'))(_0x6edc('0x15'));var utils=require('../../config/utils');var config=require(_0x6edc('0x16'));var licenseUtil=require(_0x6edc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x360831,_0x46113d){_0x46113d=_0x46113d||0xcc;return function(_0x3f7fa8){if(_0x3f7fa8){return _0x360831[_0x6edc('0x18')](_0x46113d);}return _0x360831['status'](_0x46113d)[_0x6edc('0x19')]();};}function respondWithResult(_0x2ab2f0,_0x53d484){_0x53d484=_0x53d484||0xc8;return function(_0x1faf6d){if(_0x1faf6d){return _0x2ab2f0[_0x6edc('0x1a')](_0x53d484)['json'](_0x1faf6d);}};}function respondWithFilteredResult(_0x32882c,_0x4d6896){return function(_0x4e4ee3){if(_0x4e4ee3){var _0x5bbc30=typeof _0x4d6896[_0x6edc('0x1b')]===_0x6edc('0x1c')&&typeof _0x4d6896['limit']===_0x6edc('0x1c');var _0x533d11=_0x4e4ee3[_0x6edc('0x1d')];var _0xf1a6b1=_0x5bbc30?0x0:_0x4d6896[_0x6edc('0x1b')];var _0x257d80=_0x5bbc30?_0x4e4ee3[_0x6edc('0x1d')]:_0x4d6896[_0x6edc('0x1b')]+_0x4d6896[_0x6edc('0x1e')];var _0x28fd26;if(_0x257d80>=_0x533d11){_0x257d80=_0x533d11;_0x28fd26=0xc8;}else{_0x28fd26=0xce;}_0x32882c['status'](_0x28fd26);return _0x32882c[_0x6edc('0x1f')](_0x6edc('0x20'),_0xf1a6b1+'-'+_0x257d80+'/'+_0x533d11)[_0x6edc('0x21')](_0x4e4ee3);}return null;};}function patchUpdates(_0x1a1f20){return function(_0x29682b){try{jsonpatch[_0x6edc('0x22')](_0x29682b,_0x1a1f20,!![]);}catch(_0x32f782){return BPromise[_0x6edc('0x23')](_0x32f782);}return _0x29682b[_0x6edc('0x24')]();};}function saveUpdates(_0x164089,_0x23cc60){return function(_0x3a2dee){if(_0x3a2dee){return _0x3a2dee['update'](_0x164089)[_0x6edc('0x25')](function(_0x2b0fa1){return _0x2b0fa1;});}return null;};}function removeEntity(_0x412f8e,_0xce2a3e){return function(_0x39ab06){if(_0x39ab06){return _0x39ab06[_0x6edc('0x26')]()[_0x6edc('0x25')](function(){_0x412f8e[_0x6edc('0x1a')](0xcc)[_0x6edc('0x19')]();});}};}function handleEntityNotFound(_0x51d33f,_0x2e445c){return function(_0x416c83){if(!_0x416c83){_0x51d33f[_0x6edc('0x18')](0x194);}return _0x416c83;};}function handleError(_0x10d5b1,_0x5f3a5e){_0x5f3a5e=_0x5f3a5e||0x1f4;return function(_0x1a6425){logger[_0x6edc('0x27')](_0x1a6425['stack']);if(_0x1a6425[_0x6edc('0x28')]){delete _0x1a6425[_0x6edc('0x28')];}_0x10d5b1['status'](_0x5f3a5e)['send'](_0x1a6425);};}exports[_0x6edc('0x29')]=function(_0x5c9a61,_0x1589b3){var _0x4ea3ce={},_0x1567fd={},_0x37c7a2={'count':0x0,'rows':[]};var _0x112fd6=_[_0x6edc('0x2a')](db[_0x6edc('0x2b')][_0x6edc('0x2c')],function(_0x4f8243){return{'name':_0x4f8243[_0x6edc('0x2d')],'type':_0x4f8243[_0x6edc('0x2e')][_0x6edc('0x2f')]};});_0x1567fd[_0x6edc('0x30')]=_['map'](_0x112fd6,_0x6edc('0x28'));_0x1567fd[_0x6edc('0x31')]=_[_0x6edc('0x32')](_0x5c9a61[_0x6edc('0x31')]);_0x1567fd[_0x6edc('0x33')]=_[_0x6edc('0x34')](_0x1567fd[_0x6edc('0x30')],_0x1567fd[_0x6edc('0x31')]);_0x4ea3ce[_0x6edc('0x35')]=_[_0x6edc('0x34')](_0x1567fd['model'],qs[_0x6edc('0x36')](_0x5c9a61[_0x6edc('0x31')]['fields']));_0x4ea3ce['attributes']=_0x4ea3ce[_0x6edc('0x35')][_0x6edc('0x37')]?_0x4ea3ce[_0x6edc('0x35')]:_0x1567fd['model'];if(!_0x5c9a61[_0x6edc('0x31')][_0x6edc('0x38')](_0x6edc('0x39'))){_0x4ea3ce[_0x6edc('0x1e')]=qs[_0x6edc('0x1e')](_0x5c9a61[_0x6edc('0x31')]['limit']);_0x4ea3ce[_0x6edc('0x1b')]=qs[_0x6edc('0x1b')](_0x5c9a61[_0x6edc('0x31')][_0x6edc('0x1b')]);}_0x4ea3ce[_0x6edc('0x3a')]=qs[_0x6edc('0x3b')](_0x5c9a61[_0x6edc('0x31')][_0x6edc('0x3b')]);_0x4ea3ce[_0x6edc('0x3c')]=qs[_0x6edc('0x33')](_[_0x6edc('0x3d')](_0x5c9a61['query'],_0x1567fd[_0x6edc('0x33')]),_0x112fd6);if(_0x5c9a61['query']['filter']){_0x4ea3ce[_0x6edc('0x3c')]=_['merge'](_0x4ea3ce[_0x6edc('0x3c')],{'$or':_['map'](_0x112fd6,function(_0x1a8162){if(_0x1a8162['type']!==_0x6edc('0x3e')){var _0x2b54c0={};_0x2b54c0[_0x1a8162[_0x6edc('0x28')]]={'$like':'%'+_0x5c9a61['query'][_0x6edc('0x3f')]+'%'};return _0x2b54c0;}})});}_0x4ea3ce=_['merge']({},_0x4ea3ce,_0x5c9a61[_0x6edc('0x40')]);var _0x1aa08b={'where':_0x4ea3ce[_0x6edc('0x3c')]};return db[_0x6edc('0x2b')][_0x6edc('0x1d')](_0x1aa08b)['then'](function(_0x2ba658){_0x37c7a2[_0x6edc('0x1d')]=_0x2ba658;if(_0x5c9a61[_0x6edc('0x31')][_0x6edc('0x41')]){_0x4ea3ce[_0x6edc('0x42')]=[{'all':!![]}];}return db[_0x6edc('0x2b')][_0x6edc('0x43')](_0x4ea3ce);})[_0x6edc('0x25')](function(_0x2be30e){_0x37c7a2[_0x6edc('0x44')]=_0x2be30e;return _0x37c7a2;})[_0x6edc('0x25')](respondWithFilteredResult(_0x1589b3,_0x4ea3ce))[_0x6edc('0x45')](handleError(_0x1589b3,null));};exports[_0x6edc('0x46')]=function(_0x4861e4,_0x5442c0){var _0x3b6d92={'raw':!![],'where':{'id':_0x4861e4[_0x6edc('0x47')]['id']}},_0x2119ac={};_0x2119ac[_0x6edc('0x30')]=_['keys'](db[_0x6edc('0x2b')][_0x6edc('0x2c')]);_0x2119ac[_0x6edc('0x31')]=_[_0x6edc('0x32')](_0x4861e4['query']);_0x2119ac[_0x6edc('0x33')]=_[_0x6edc('0x34')](_0x2119ac['model'],_0x2119ac[_0x6edc('0x31')]);_0x3b6d92[_0x6edc('0x35')]=_[_0x6edc('0x34')](_0x2119ac[_0x6edc('0x30')],qs[_0x6edc('0x36')](_0x4861e4['query'][_0x6edc('0x36')]));_0x3b6d92['attributes']=_0x3b6d92[_0x6edc('0x35')][_0x6edc('0x37')]?_0x3b6d92[_0x6edc('0x35')]:_0x2119ac[_0x6edc('0x30')];if(_0x4861e4[_0x6edc('0x31')][_0x6edc('0x41')]){_0x3b6d92['include']=[{'all':!![]}];}_0x3b6d92=_[_0x6edc('0x48')]({},_0x3b6d92,_0x4861e4[_0x6edc('0x40')]);return db[_0x6edc('0x2b')][_0x6edc('0x49')](_0x3b6d92)[_0x6edc('0x25')](handleEntityNotFound(_0x5442c0,null))[_0x6edc('0x25')](respondWithResult(_0x5442c0,null))[_0x6edc('0x45')](handleError(_0x5442c0,null));};exports[_0x6edc('0x4a')]=function(_0x35517f,_0x57c5da){return db['CmHopperHistory'][_0x6edc('0x4a')](_0x35517f[_0x6edc('0x4b')],{})['then'](respondWithResult(_0x57c5da,0xc9))[_0x6edc('0x45')](handleError(_0x57c5da,null));};exports[_0x6edc('0x4c')]=function(_0x31265b,_0xd86af7){return db[_0x6edc('0x2b')][_0x6edc('0x4c')]()['then'](respondWithResult(_0xd86af7,null))[_0x6edc('0x45')](handleError(_0xd86af7,null));};exports[_0x6edc('0x4d')]=function(_0x1164ff,_0x23a8cb){if(_0x1164ff[_0x6edc('0x4b')]['uniqueid']){delete _0x1164ff['body'][_0x6edc('0x4e')];}return db[_0x6edc('0x2b')][_0x6edc('0x49')]({'where':{'uniqueid':_0x1164ff[_0x6edc('0x47')]['id']}})[_0x6edc('0x25')](handleEntityNotFound(_0x23a8cb,null))['then'](saveUpdates(_0x1164ff[_0x6edc('0x4b')],null))['then'](respondWithResult(_0x23a8cb,null))['catch'](handleError(_0x23a8cb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a41884d..9122082 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 _0x8969=['./cmHopperHistory.attributes','define','CmHopperHistory','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8969,0x130));var _0x9896=function(_0x5d5eed,_0x266c09){_0x5d5eed=_0x5d5eed-0x0;var _0x3200d2=_0x8969[_0x5d5eed];return _0x3200d2;};'use strict';var _=require(_0x9896('0x0'));var util=require('util');var logger=require(_0x9896('0x1'))(_0x9896('0x2'));var moment=require(_0x9896('0x3'));var BPromise=require(_0x9896('0x4'));var rp=require(_0x9896('0x5'));var fs=require('fs');var path=require(_0x9896('0x6'));var rimraf=require(_0x9896('0x7'));var config=require('../../config/environment');var attributes=require(_0x9896('0x8'));module['exports']=function(_0x4d1a83,_0xd26a8b){return _0x4d1a83[_0x9896('0x9')](_0x9896('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x9896('0xb'),'fields':[_0x9896('0xb')]},{'name':_0x9896('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d68=['bluebird','path','../../config/environment','exports','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5b2f23,_0xffc5a2){var _0x62a012=function(_0x55c733){while(--_0x55c733){_0x5b2f23['push'](_0x5b2f23['shift']());}};_0x62a012(++_0xffc5a2);}(_0x4d68,0x1c3));var _0x84d6=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x4d68[_0x35e92e];return _0x1205a8;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var logger=require(_0x84d6('0x2'))(_0x84d6('0x3'));var moment=require(_0x84d6('0x4'));var BPromise=require(_0x84d6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84d6('0x6'));var rimraf=require('rimraf');var config=require(_0x84d6('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x84d6('0x8')]=function(_0x368a18,_0x20957c){return _0x368a18['define']('CmHopperHistory',attributes,{'tableName':_0x84d6('0x9'),'paranoid':![],'indexes':[{'name':_0x84d6('0xa'),'fields':[_0x84d6('0xa')]},{'name':_0x84d6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index e84ea5e..5f6f639 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 _0x8581=['`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`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','`state`\x20=\x2018,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','col','ivrTotalCallsDays','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','where','sequelize','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','info','GetVoiceQueueHopperHistory','findAll','campaign'];(function(_0x311333,_0x2b92e4){var _0x620938=function(_0x2f3084){while(--_0x2f3084){_0x311333['push'](_0x311333['shift']());}};_0x620938(++_0x2b92e4);}(_0x8581,0x163));var _0x1858=function(_0x24e64a,_0x22af59){_0x24e64a=_0x24e64a-0x0;var _0x3827d2=_0x8581[_0x24e64a];return _0x3827d2;};'use strict';var _=require('lodash');var util=require(_0x1858('0x0'));var moment=require(_0x1858('0x1'));var BPromise=require('bluebird');var rs=require(_0x1858('0x2'));var fs=require('fs');var Redis=require(_0x1858('0x3'));var db=require(_0x1858('0x4'))['db'];var utils=require(_0x1858('0x5'));var logger=require(_0x1858('0x6'))(_0x1858('0x7'));var config=require(_0x1858('0x8'));var jayson=require(_0x1858('0x9'));var client=jayson[_0x1858('0xa')][_0x1858('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fcb0b,_0x1d4663,_0x3c0f4c){return new BPromise(function(_0x5c8ba0,_0x39a962){return client[_0x1858('0xc')](_0x3fcb0b,_0x3c0f4c)[_0x1858('0xd')](function(_0x569366){logger['info'](_0x1858('0xe'),_0x1d4663,'request\x20sent');logger[_0x1858('0xf')](_0x1858('0x10'),_0x1d4663,_0x1858('0x11'),JSON[_0x1858('0x12')](_0x569366));if(_0x569366['error']){if(_0x569366[_0x1858('0x13')][_0x1858('0x14')]===0x1f4){logger[_0x1858('0x13')](_0x1858('0xe'),_0x1d4663,_0x569366[_0x1858('0x13')][_0x1858('0x15')]);return _0x39a962(_0x569366['error']['message']);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x1d4663,_0x569366['error']['message']);return _0x5c8ba0(_0x569366[_0x1858('0x13')]['message']);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x1d4663,_0x1858('0x11'));_0x5c8ba0(_0x569366[_0x1858('0x16')][_0x1858('0x15')]);}})[_0x1858('0x17')](function(_0x25a40d){logger[_0x1858('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x1d4663,_0x25a40d);_0x39a962(_0x25a40d);});});}exports[_0x1858('0x18')]=function(_0x3508b3){var _0x9f3106=this;return new Promise(function(_0x44d64a,_0x37f559){return db[_0x1858('0x19')]['create'](_0x3508b3[_0x1858('0x1a')],{'raw':_0x3508b3[_0x1858('0x1b')]?_0x3508b3[_0x1858('0x1b')][_0x1858('0x1c')]===undefined?!![]:![]:!![]})[_0x1858('0xd')](function(_0x52cc41){logger['info']('CreateCmHopperHistory',_0x3508b3);logger[_0x1858('0xf')](_0x1858('0x18'),_0x3508b3,JSON[_0x1858('0x12')](_0x52cc41));_0x44d64a(_0x52cc41);})['catch'](function(_0x3aad8f){logger[_0x1858('0x13')](_0x1858('0x18'),_0x3aad8f[_0x1858('0x15')],_0x3508b3);_0x37f559(_0x9f3106[_0x1858('0x13')](0x1f4,_0x3aad8f['message']));});});};exports[_0x1858('0x1d')]=function(_0x459c84){var _0x3f3b8c=this;return new Promise(function(_0xf153c1,_0x48aac9){return db[_0x1858('0x19')]['findAll']({'raw':_0x459c84['options']?_0x459c84['options'][_0x1858('0x1c')]===undefined?!![]:![]:!![],'where':_0x459c84[_0x1858('0x1b')]?_0x459c84[_0x1858('0x1b')][_0x1858('0x1e')]||null:null,'attributes':[[db[_0x1858('0x1f')]['fn']('COUNT',db['sequelize']['col']('id')),_0x1858('0x20')],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')]['literal'](_0x1858('0x22')))),_0x1858('0x23')],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db['sequelize'][_0x1858('0x24')](_0x1858('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')]['literal'](_0x1858('0x26')))),_0x1858('0x27')],[db[_0x1858('0x1f')]['fn'](_0x1858('0x28'),db[_0x1858('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1858('0x29')))),_0x1858('0x2a')],[db['sequelize']['fn'](_0x1858('0x28'),db[_0x1858('0x1f')]['fn']('IF',db['sequelize'][_0x1858('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0x1858('0xd')](function(_0x265390){logger[_0x1858('0x2b')](_0x1858('0x1d'),_0x459c84);logger[_0x1858('0xf')]('AvgHandleTime',_0x459c84,JSON[_0x1858('0x12')](_0x265390));_0xf153c1(_0x265390);})['catch'](function(_0xf5ba35){logger[_0x1858('0x13')](_0x1858('0x1d'),_0xf5ba35[_0x1858('0x15')],_0x459c84);_0x48aac9(_0x3f3b8c[_0x1858('0x13')](0x1f4,_0xf5ba35[_0x1858('0x15')]));});});};exports[_0x1858('0x2c')]=function(_0x3517c2){var _0x289e7c=this;return new Promise(function(_0x3e69ff,_0x47067d){return db[_0x1858('0x19')][_0x1858('0x2d')]({'raw':_0x3517c2[_0x1858('0x1b')]?_0x3517c2['options'][_0x1858('0x1c')]===undefined?!![]:![]:!![],'where':_0x3517c2['options']?_0x3517c2[_0x1858('0x1b')][_0x1858('0x1e')]||null:null,'attributes':[[_0x1858('0x2e'),'name'],[db[_0x1858('0x1f')]['fn']('COUNT',db[_0x1858('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1858('0x2f')))),_0x1858('0x30')],[db['sequelize']['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1858('0x31')))),_0x1858('0x32')],[db['sequelize']['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1858('0x22')))),'outboundAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')][_0x1858('0x24')](_0x1858('0x33')))),_0x1858('0x34')],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')][_0x1858('0x24')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')][_0x1858('0x24')](_0x1858('0x35')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x1858('0x24')](_0x1858('0x36')))),_0x1858('0x37')],[db['sequelize']['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')]['literal'](_0x1858('0x38')))),_0x1858('0x39')],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')]['literal'](_0x1858('0x3a')))),_0x1858('0x3b')],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x1858('0x24')](_0x1858('0x3c')))),'outboundOriginateFailureCallsDay'],[db[_0x1858('0x1f')]['fn']('COUNT',db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')]['literal'](_0x1858('0x3d')))),'outboundRejectCallsDay'],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')][_0x1858('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db[_0x1858('0x1f')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db['sequelize'][_0x1858('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x1858('0x3e')]],'group':[_0x1858('0x2e')]})[_0x1858('0xd')](function(_0x12686b){logger['info'](_0x1858('0x2c'),_0x3517c2);logger['debug'](_0x1858('0x2c'),_0x3517c2,JSON['stringify'](_0x12686b));_0x3e69ff(_0x12686b);})[_0x1858('0x17')](function(_0x28f4ee){logger[_0x1858('0x13')](_0x1858('0x2c'),_0x28f4ee['message'],_0x3517c2);_0x47067d(_0x289e7c[_0x1858('0x13')](0x1f4,_0x28f4ee[_0x1858('0x15')]));});});};exports[_0x1858('0x3f')]=function(_0x203ef4){var _0x550a02=this;return new Promise(function(_0x18df7f,_0x48ab05){return db[_0x1858('0x19')][_0x1858('0x2d')]({'raw':_0x203ef4[_0x1858('0x1b')]?_0x203ef4[_0x1858('0x1b')][_0x1858('0x1c')]===undefined?!![]:![]:!![],'where':_0x203ef4[_0x1858('0x1b')]?_0x203ef4['options'][_0x1858('0x1e')]||null:null,'attributes':[[_0x1858('0x2e'),_0x1858('0x40')],[db[_0x1858('0x1f')]['fn'](_0x1858('0x21'),db[_0x1858('0x1f')][_0x1858('0x41')]('id')),_0x1858('0x42')],[db['sequelize']['fn'](_0x1858('0x21'),db[_0x1858('0x1f')]['fn']('IF',db['sequelize'][_0x1858('0x24')](_0x1858('0x22')))),'ivrAnswerCallsDay']],'group':[_0x1858('0x2e')]})[_0x1858('0xd')](function(_0x14c449){logger[_0x1858('0x2b')](_0x1858('0x3f'),_0x203ef4);logger['debug']('GetCampaignHopperHistory',_0x203ef4,JSON[_0x1858('0x12')](_0x14c449));_0x18df7f(_0x14c449);})[_0x1858('0x17')](function(_0x365643){logger['error'](_0x1858('0x3f'),_0x365643[_0x1858('0x15')],_0x203ef4);_0x48ab05(_0x550a02[_0x1858('0x13')](0x1f4,_0x365643[_0x1858('0x15')]));});});}; \ No newline at end of file +var _0xa204=['CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','where','sequelize','COUNT','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','catch','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','then','GetCampaignHopperHistory','findAll','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xa204,0x152));var _0x4a20=function(_0x280875,_0x137bcb){_0x280875=_0x280875-0x0;var _0x74acfe=_0xa204[_0x280875];return _0x74acfe;};'use strict';var _=require(_0x4a20('0x0'));var util=require(_0x4a20('0x1'));var moment=require('moment');var BPromise=require(_0x4a20('0x2'));var rs=require(_0x4a20('0x3'));var fs=require('fs');var Redis=require(_0x4a20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a20('0x5'));var logger=require(_0x4a20('0x6'))(_0x4a20('0x7'));var config=require(_0x4a20('0x8'));var jayson=require(_0x4a20('0x9'));var client=jayson[_0x4a20('0xa')][_0x4a20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a549b,_0x57ce07,_0x27e3ec){return new BPromise(function(_0x31a214,_0x2d5107){return client[_0x4a20('0xc')](_0x2a549b,_0x27e3ec)['then'](function(_0x4fa4d6){logger[_0x4a20('0xd')](_0x4a20('0xe'),_0x57ce07,_0x4a20('0xf'));logger[_0x4a20('0x10')](_0x4a20('0x11'),_0x57ce07,_0x4a20('0xf'),JSON[_0x4a20('0x12')](_0x4fa4d6));if(_0x4fa4d6[_0x4a20('0x13')]){if(_0x4fa4d6[_0x4a20('0x13')]['code']===0x1f4){logger[_0x4a20('0x13')](_0x4a20('0xe'),_0x57ce07,_0x4fa4d6['error'][_0x4a20('0x14')]);return _0x2d5107(_0x4fa4d6[_0x4a20('0x13')][_0x4a20('0x14')]);}logger['error'](_0x4a20('0xe'),_0x57ce07,_0x4fa4d6['error']['message']);return _0x31a214(_0x4fa4d6['error'][_0x4a20('0x14')]);}else{logger['info'](_0x4a20('0xe'),_0x57ce07,'request\x20sent');_0x31a214(_0x4fa4d6[_0x4a20('0x15')][_0x4a20('0x14')]);}})['catch'](function(_0x3bd783){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x57ce07,_0x3bd783);_0x2d5107(_0x3bd783);});});}exports[_0x4a20('0x16')]=function(_0x8a23f1){var _0x296156=this;return new Promise(function(_0x557e7d,_0x57f0f7){return db[_0x4a20('0x17')][_0x4a20('0x18')](_0x8a23f1[_0x4a20('0x19')],{'raw':_0x8a23f1[_0x4a20('0x1a')]?_0x8a23f1[_0x4a20('0x1a')][_0x4a20('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2dfa58){logger[_0x4a20('0xd')](_0x4a20('0x16'),_0x8a23f1);logger[_0x4a20('0x10')]('CreateCmHopperHistory',_0x8a23f1,JSON['stringify'](_0x2dfa58));_0x557e7d(_0x2dfa58);})['catch'](function(_0x425ace){logger['error'](_0x4a20('0x16'),_0x425ace[_0x4a20('0x14')],_0x8a23f1);_0x57f0f7(_0x296156[_0x4a20('0x13')](0x1f4,_0x425ace['message']));});});};exports[_0x4a20('0x1c')]=function(_0x368dad){var _0x14f788=this;return new Promise(function(_0xd24d0e,_0x63a154){return db[_0x4a20('0x17')]['findAll']({'raw':_0x368dad['options']?_0x368dad[_0x4a20('0x1a')][_0x4a20('0x1b')]===undefined?!![]:![]:!![],'where':_0x368dad[_0x4a20('0x1a')]?_0x368dad[_0x4a20('0x1a')][_0x4a20('0x1d')]||null:null,'attributes':[[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize'][_0x4a20('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize']['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x4a20('0x22')],[db[_0x4a20('0x1e')]['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize']['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x24')))),_0x4a20('0x25')],[db['sequelize']['fn'](_0x4a20('0x26'),db['sequelize']['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x4a20('0x1e')]['fn']('AVG',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x387da0){logger[_0x4a20('0xd')](_0x4a20('0x1c'),_0x368dad);logger[_0x4a20('0x10')](_0x4a20('0x1c'),_0x368dad,JSON['stringify'](_0x387da0));_0xd24d0e(_0x387da0);})[_0x4a20('0x28')](function(_0x51752e){logger['error'](_0x4a20('0x1c'),_0x51752e['message'],_0x368dad);_0x63a154(_0x14f788[_0x4a20('0x13')](0x1f4,_0x51752e[_0x4a20('0x14')]));});});};exports[_0x4a20('0x29')]=function(_0x1ffbfd){var _0x15f754=this;return new Promise(function(_0x89baeb,_0x4009b8){return db[_0x4a20('0x17')]['findAll']({'raw':_0x1ffbfd[_0x4a20('0x1a')]?_0x1ffbfd[_0x4a20('0x1a')][_0x4a20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ffbfd[_0x4a20('0x1a')]?_0x1ffbfd['options'][_0x4a20('0x1d')]||null:null,'attributes':[[_0x4a20('0x2a'),_0x4a20('0x2b')],[db[_0x4a20('0x1e')]['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')]['literal'](_0x4a20('0x2c')))),_0x4a20('0x2d')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db['sequelize'][_0x4a20('0x21')](_0x4a20('0x2e')))),_0x4a20('0x2f')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x30')))),_0x4a20('0x31')],[db['sequelize']['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x32')))),_0x4a20('0x33')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')]['literal'](_0x4a20('0x34')))),'outboundCongestionCallsDay'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4a20('0x35')],[db['sequelize']['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4a20('0x36')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize']['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x37')))),_0x4a20('0x38')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db['sequelize'][_0x4a20('0x21')](_0x4a20('0x39')))),_0x4a20('0x3a')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x4a20('0x21')](_0x4a20('0x3c')))),_0x4a20('0x3d')],[db[_0x4a20('0x1e')]['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x3e')))),_0x4a20('0x3f')],[db[_0x4a20('0x1e')]['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x40')))),_0x4a20('0x3d')],[db[_0x4a20('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4a20('0x41')))),_0x4a20('0x42')]],'group':[_0x4a20('0x2a')]})[_0x4a20('0x43')](function(_0x5a9d7a){logger[_0x4a20('0xd')](_0x4a20('0x29'),_0x1ffbfd);logger['debug'](_0x4a20('0x29'),_0x1ffbfd,JSON['stringify'](_0x5a9d7a));_0x89baeb(_0x5a9d7a);})[_0x4a20('0x28')](function(_0x46bbd2){logger[_0x4a20('0x13')](_0x4a20('0x29'),_0x46bbd2[_0x4a20('0x14')],_0x1ffbfd);_0x4009b8(_0x15f754['error'](0x1f4,_0x46bbd2[_0x4a20('0x14')]));});});};exports[_0x4a20('0x44')]=function(_0x2c941b){var _0xffceac=this;return new Promise(function(_0x2f95d3,_0x2460bf){return db[_0x4a20('0x17')][_0x4a20('0x45')]({'raw':_0x2c941b['options']?_0x2c941b[_0x4a20('0x1a')][_0x4a20('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c941b[_0x4a20('0x1a')]?_0x2c941b[_0x4a20('0x1a')]['where']||null:null,'attributes':[[_0x4a20('0x2a'),_0x4a20('0x2b')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize'][_0x4a20('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x30')))),_0x4a20('0x46')]],'group':[_0x4a20('0x2a')]})[_0x4a20('0x43')](function(_0x10d462){logger[_0x4a20('0xd')](_0x4a20('0x44'),_0x2c941b);logger['debug'](_0x4a20('0x44'),_0x2c941b,JSON[_0x4a20('0x12')](_0x10d462));_0x2f95d3(_0x10d462);})[_0x4a20('0x28')](function(_0x23346d){logger[_0x4a20('0x13')](_0x4a20('0x44'),_0x23346d[_0x4a20('0x14')],_0x2c941b);_0x2460bf(_0xffceac[_0x4a20('0x13')](0x1f4,_0x23346d[_0x4a20('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 8bbefa6..b467977 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 _0x71de=['./cmHopperHistory.controller','isAuthenticated','index','describe','get','/:id','show','post','create','put','update','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x71de,0xb6));var _0xe71d=function(_0x5036b1,_0x2441bd){_0x5036b1=_0x5036b1-0x0;var _0x20e38a=_0x71de[_0x5036b1];return _0x20e38a;};'use strict';var multer=require(_0xe71d('0x0'));var util=require('util');var path=require(_0xe71d('0x1'));var timeout=require(_0xe71d('0x2'));var express=require(_0xe71d('0x3'));var router=express[_0xe71d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe71d('0x5'));var interaction=require(_0xe71d('0x6'));var config=require(_0xe71d('0x7'));var controller=require(_0xe71d('0x8'));router['get']('/',auth[_0xe71d('0x9')](),controller[_0xe71d('0xa')]);router['get']('/describe',auth[_0xe71d('0x9')](),controller[_0xe71d('0xb')]);router[_0xe71d('0xc')](_0xe71d('0xd'),auth['isAuthenticated'](),controller[_0xe71d('0xe')]);router[_0xe71d('0xf')]('/',auth['isAuthenticated'](),controller[_0xe71d('0x10')]);router[_0xe71d('0x11')](_0xe71d('0xd'),auth[_0xe71d('0x9')](),controller[_0xe71d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3937=['describe','/:id','show','post','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x3937,0xef));var _0x7393=function(_0x4510c3,_0x9e97c){_0x4510c3=_0x4510c3-0x0;var _0x4e62b8=_0x3937[_0x4510c3];return _0x4e62b8;};'use strict';var multer=require('multer');var util=require(_0x7393('0x0'));var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require(_0x7393('0x3'));var router=express[_0x7393('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7393('0x5'));var interaction=require(_0x7393('0x6'));var config=require(_0x7393('0x7'));var controller=require(_0x7393('0x8'));router[_0x7393('0x9')]('/',auth[_0x7393('0xa')](),controller[_0x7393('0xb')]);router[_0x7393('0x9')](_0x7393('0xc'),auth['isAuthenticated'](),controller[_0x7393('0xd')]);router[_0x7393('0x9')](_0x7393('0xe'),auth['isAuthenticated'](),controller[_0x7393('0xf')]);router[_0x7393('0x10')]('/',auth[_0x7393('0xa')](),controller[_0x7393('0x11')]);router[_0x7393('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7393('0x13')]);module[_0x7393('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 4027924..9833fb4 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 _0xb205=['sequelize','exports','STRING','name'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb205,0xf0));var _0x5b20=function(_0xd77e0b,_0x1d1daf){_0xd77e0b=_0xd77e0b-0x0;var _0x1e8c7b=_0xb205[_0xd77e0b];return _0x1e8c7b;};'use strict';var Sequelize=require(_0x5b20('0x0'));module[_0x5b20('0x1')]={'name':{'type':Sequelize[_0x5b20('0x2')],'unique':_0x5b20('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5b20('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6b4e=['exports'];(function(_0x2a7ad4,_0x2fdc48){var _0xa15bf8=function(_0x2e66d6){while(--_0x2e66d6){_0x2a7ad4['push'](_0x2a7ad4['shift']());}};_0xa15bf8(++_0x2fdc48);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x1b23ea,_0x4a7bb4){_0x1b23ea=_0x1b23ea-0x0;var _0x174d7d=_0x6b4e[_0x1b23ea];return _0x174d7d;};'use strict';var Sequelize=require('sequelize');module[_0xe6b4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 458d936..a163faa 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 _0x937c=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','index','CmList','type','key','model','query','keys','intersection','attributes','fields','length','sort','pick','filters','filter','merge','map','VIRTUAL','where','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','order','removeDispositions','addContacts','CmContact','tags','join','isArray','push','each','ids','success','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','item','from','cm_contact_has_items','CmContactId\x20=\x20c.id','description','ItemTypeId\x20=\x20?','description_additionalPhone_','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','switch','BOOLEAN','defaultValue','cf_%s','getGlobalCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','message','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x99203d,_0x2ada85){var _0x2899e3=function(_0x8e1ef0){while(--_0x8e1ef0){_0x99203d['push'](_0x99203d['shift']());}};_0x2899e3(++_0x2ada85);}(_0x937c,0x135));var _0xc937=function(_0x1b5fff,_0x21d5e5){_0x1b5fff=_0x1b5fff-0x0;var _0x1536a4=_0x937c[_0x1b5fff];return _0x1536a4;};'use strict';var emlformat=require(_0xc937('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc937('0x1'));var jsonpatch=require(_0xc937('0x2'));var rp=require(_0xc937('0x3'));var moment=require(_0xc937('0x4'));var BPromise=require(_0xc937('0x5'));var Mustache=require(_0xc937('0x6'));var util=require(_0xc937('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc937('0x8'));var fs=require('fs');var fs_extra=require(_0xc937('0x9'));var _=require(_0xc937('0xa'));var squel=require(_0xc937('0xb'));var crypto=require(_0xc937('0xc'));var jsforce=require(_0xc937('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc937('0xe'));var Redis=require(_0xc937('0xf'));var authService=require(_0xc937('0x10'));var qs=require(_0xc937('0x11'));var as=require(_0xc937('0x12'));var hardwareService=require(_0xc937('0x13'));var logger=require('../../config/logger')(_0xc937('0x14'));var utils=require(_0xc937('0x15'));var config=require(_0xc937('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc937('0x17'))['db'];var csv_results;config[_0xc937('0x18')]=_[_0xc937('0x19')](config[_0xc937('0x18')],{'host':_0xc937('0x1a'),'port':0x18eb});var socket=require(_0xc937('0x1b'))(new Redis(config[_0xc937('0x18')]));require(_0xc937('0x1c'))[_0xc937('0x1d')](socket);function respondWithStatusCode(_0x5dff75,_0x3d3c5e){_0x3d3c5e=_0x3d3c5e||0xcc;return function(_0x326233){if(_0x326233){return _0x5dff75[_0xc937('0x1e')](_0x3d3c5e);}return _0x5dff75[_0xc937('0x1f')](_0x3d3c5e)['end']();};}function respondWithResult(_0x461da5,_0x409d69){_0x409d69=_0x409d69||0xc8;return function(_0x536c67){if(_0x536c67){return _0x461da5[_0xc937('0x1f')](_0x409d69)['json'](_0x536c67);}};}function respondWithFilteredResult(_0x371f30,_0x389a18){return function(_0x304b63){if(_0x304b63){var _0x1132e1=typeof _0x389a18[_0xc937('0x20')]===_0xc937('0x21')&&typeof _0x389a18[_0xc937('0x22')]===_0xc937('0x21');var _0x14cc02=_0x304b63[_0xc937('0x23')];var _0x35834e=_0x1132e1?0x0:_0x389a18[_0xc937('0x20')];var _0x3bbd86=_0x1132e1?_0x304b63[_0xc937('0x23')]:_0x389a18[_0xc937('0x20')]+_0x389a18[_0xc937('0x22')];var _0x2840a7;if(_0x3bbd86>=_0x14cc02){_0x3bbd86=_0x14cc02;_0x2840a7=0xc8;}else{_0x2840a7=0xce;}_0x371f30[_0xc937('0x1f')](_0x2840a7);return _0x371f30[_0xc937('0x24')]('Content-Range',_0x35834e+'-'+_0x3bbd86+'/'+_0x14cc02)[_0xc937('0x25')](_0x304b63);}return null;};}function patchUpdates(_0xebb436){return function(_0x522446){try{jsonpatch['apply'](_0x522446,_0xebb436,!![]);}catch(_0x115541){return BPromise[_0xc937('0x26')](_0x115541);}return _0x522446[_0xc937('0x27')]();};}function saveUpdates(_0x224f49,_0x359a1c){return function(_0x28b1bb){if(_0x28b1bb){return _0x28b1bb[_0xc937('0x28')](_0x224f49)[_0xc937('0x29')](function(_0x62683d){return _0x62683d;});}return null;};}function removeEntity(_0x2e3826,_0x4ac17f){return function(_0x18a1af){if(_0x18a1af){return _0x18a1af[_0xc937('0x2a')]()[_0xc937('0x29')](function(){var _0x137487=_0x18a1af['get']({'plain':!![]});var _0x19e509='Lists';return db[_0xc937('0x2b')]['destroy']({'where':{'type':_0x19e509,'resourceId':_0x137487['id']}})[_0xc937('0x29')](function(){return _0x18a1af;});})[_0xc937('0x29')](function(){_0x2e3826['status'](0xcc)[_0xc937('0x2c')]();});}};}function handleEntityNotFound(_0x383143,_0x2a1cd8){return function(_0xfac41){if(!_0xfac41){_0x383143[_0xc937('0x1e')](0x194);}return _0xfac41;};}function handleError(_0x5d203f,_0x5e0210){_0x5e0210=_0x5e0210||0x1f4;return function(_0x4c22ad){logger[_0xc937('0x2d')](_0x4c22ad[_0xc937('0x2e')]);if(_0x4c22ad['name']){delete _0x4c22ad[_0xc937('0x2f')];}_0x5d203f[_0xc937('0x1f')](_0x5e0210)['send'](_0x4c22ad);};}exports[_0xc937('0x30')]=function(_0x5598e5,_0x566371){var _0x16e0d1={},_0x8a9350={},_0x53ba10={'count':0x0,'rows':[]};var _0x3f27d5=_['map'](db[_0xc937('0x31')]['rawAttributes'],function(_0x499765){return{'name':_0x499765['fieldName'],'type':_0x499765[_0xc937('0x32')][_0xc937('0x33')]};});_0x8a9350[_0xc937('0x34')]=_['map'](_0x3f27d5,_0xc937('0x2f'));_0x8a9350[_0xc937('0x35')]=_[_0xc937('0x36')](_0x5598e5['query']);_0x8a9350['filters']=_[_0xc937('0x37')](_0x8a9350[_0xc937('0x34')],_0x8a9350[_0xc937('0x35')]);_0x16e0d1[_0xc937('0x38')]=_['intersection'](_0x8a9350['model'],qs[_0xc937('0x39')](_0x5598e5[_0xc937('0x35')][_0xc937('0x39')]));_0x16e0d1[_0xc937('0x38')]=_0x16e0d1[_0xc937('0x38')][_0xc937('0x3a')]?_0x16e0d1['attributes']:_0x8a9350['model'];if(!_0x5598e5[_0xc937('0x35')]['hasOwnProperty']('nolimit')){_0x16e0d1['limit']=qs[_0xc937('0x22')](_0x5598e5[_0xc937('0x35')]['limit']);_0x16e0d1[_0xc937('0x20')]=qs[_0xc937('0x20')](_0x5598e5[_0xc937('0x35')]['offset']);}_0x16e0d1['order']=qs[_0xc937('0x3b')](_0x5598e5['query']['sort']);_0x16e0d1['where']=qs['filters'](_[_0xc937('0x3c')](_0x5598e5[_0xc937('0x35')],_0x8a9350[_0xc937('0x3d')]),_0x3f27d5);if(_0x5598e5[_0xc937('0x35')][_0xc937('0x3e')]){_0x16e0d1['where']=_[_0xc937('0x3f')](_0x16e0d1['where'],{'$or':_[_0xc937('0x40')](_0x3f27d5,function(_0x52a67f){if(_0x52a67f['type']!==_0xc937('0x41')){var _0x1d39d2={};_0x1d39d2[_0x52a67f[_0xc937('0x2f')]]={'$like':'%'+_0x5598e5[_0xc937('0x35')][_0xc937('0x3e')]+'%'};return _0x1d39d2;}})});}_0x16e0d1=_[_0xc937('0x3f')]({},_0x16e0d1,_0x5598e5['options']);var _0x3ea8b3={'where':_0x16e0d1[_0xc937('0x42')]};return db[_0xc937('0x31')][_0xc937('0x23')](_0x3ea8b3)[_0xc937('0x29')](function(_0x4473f9){_0x53ba10['count']=_0x4473f9;if(_0x5598e5[_0xc937('0x35')][_0xc937('0x43')]){_0x16e0d1[_0xc937('0x44')]=[{'all':!![]}];}return db[_0xc937('0x31')][_0xc937('0x45')](_0x16e0d1);})['then'](function(_0x1c4048){_0x53ba10[_0xc937('0x46')]=_0x1c4048;return _0x53ba10;})[_0xc937('0x29')](respondWithFilteredResult(_0x566371,_0x16e0d1))['catch'](handleError(_0x566371,null));};exports[_0xc937('0x47')]=function(_0x363ed6,_0x380e4e){var _0x19a39b={'raw':![],'where':{'id':_0x363ed6[_0xc937('0x48')]['id']}},_0x400604={};_0x400604[_0xc937('0x34')]=_[_0xc937('0x36')](db['CmList'][_0xc937('0x49')]);_0x400604[_0xc937('0x35')]=_['keys'](_0x363ed6['query']);_0x400604[_0xc937('0x3d')]=_[_0xc937('0x37')](_0x400604[_0xc937('0x34')],_0x400604[_0xc937('0x35')]);_0x19a39b[_0xc937('0x38')]=_[_0xc937('0x37')](_0x400604[_0xc937('0x34')],qs['fields'](_0x363ed6[_0xc937('0x35')][_0xc937('0x39')]));_0x19a39b[_0xc937('0x38')]=_0x19a39b[_0xc937('0x38')][_0xc937('0x3a')]?_0x19a39b[_0xc937('0x38')]:_0x400604[_0xc937('0x34')];if(_0x363ed6[_0xc937('0x35')]['includeAll']){_0x19a39b[_0xc937('0x44')]=[{'all':!![]}];}_0x19a39b=_[_0xc937('0x3f')]({},_0x19a39b,_0x363ed6[_0xc937('0x4a')]);return db['CmList'][_0xc937('0x4b')](_0x19a39b)[_0xc937('0x29')](handleEntityNotFound(_0x380e4e,null))['then'](respondWithResult(_0x380e4e,null))[_0xc937('0x4c')](handleError(_0x380e4e,null));};exports[_0xc937('0x4d')]=function(_0x205d0d,_0x3db9bf){return db[_0xc937('0x31')][_0xc937('0x4d')](_0x205d0d[_0xc937('0x4e')],{})['then'](function(_0x8cb9ef){var _0x562b3d=_0x205d0d[_0xc937('0x4f')][_0xc937('0x50')]({'plain':!![]});if(!_0x562b3d)throw new Error(_0xc937('0x51'));if(_0x562b3d[_0xc937('0x52')]===_0xc937('0x4f')){var _0xb44170=_0x8cb9ef[_0xc937('0x50')]({'plain':!![]});var _0x4bf1f0=_0xc937('0x53');return db[_0xc937('0x54')][_0xc937('0x4b')]({'where':{'name':_0x4bf1f0,'userProfileId':_0x562b3d[_0xc937('0x55')]},'raw':!![]})['then'](function(_0x3c0ffd){if(_0x3c0ffd&&_0x3c0ffd['autoAssociation']===0x0){return db[_0xc937('0x2b')][_0xc937('0x4d')]({'name':_0xb44170[_0xc937('0x2f')],'resourceId':_0xb44170['id'],'type':_0x3c0ffd[_0xc937('0x2f')],'sectionId':_0x3c0ffd['id']},{})[_0xc937('0x29')](function(){return _0x8cb9ef;});}else{return _0x8cb9ef;}})[_0xc937('0x4c')](function(_0x555d54){logger[_0xc937('0x2d')](_0xc937('0x56'),_0x555d54);throw _0x555d54;});}return _0x8cb9ef;})[_0xc937('0x29')](respondWithResult(_0x3db9bf,0xc9))[_0xc937('0x4c')](handleError(_0x3db9bf,null));};exports[_0xc937('0x28')]=function(_0x495d34,_0xe0b8e5){if(_0x495d34['body']['id']){delete _0x495d34['body']['id'];}return db['CmList'][_0xc937('0x4b')]({'where':{'id':_0x495d34[_0xc937('0x48')]['id']}})[_0xc937('0x29')](handleEntityNotFound(_0xe0b8e5,null))[_0xc937('0x29')](saveUpdates(_0x495d34[_0xc937('0x4e')],null))[_0xc937('0x29')](respondWithResult(_0xe0b8e5,null))[_0xc937('0x4c')](handleError(_0xe0b8e5,null));};exports[_0xc937('0x2a')]=function(_0x26a748,_0x5ad03e){return db[_0xc937('0x31')][_0xc937('0x4b')]({'where':{'id':_0x26a748[_0xc937('0x48')]['id']}})[_0xc937('0x29')](handleEntityNotFound(_0x5ad03e,null))['then'](removeEntity(_0x5ad03e,null))[_0xc937('0x4c')](handleError(_0x5ad03e,null));};exports['describe']=function(_0xc4563,_0x1935c4){return db[_0xc937('0x31')]['describe']()['then'](respondWithResult(_0x1935c4,null))[_0xc937('0x4c')](handleError(_0x1935c4,null));};exports[_0xc937('0x57')]=function(_0x392dd8,_0x430a49,_0x283605){if(_0x392dd8[_0xc937('0x4e')]['id']){delete _0x392dd8[_0xc937('0x4e')]['id'];}return db[_0xc937('0x31')]['find']({'where':{'id':_0x392dd8[_0xc937('0x48')]['id']}})[_0xc937('0x29')](handleEntityNotFound(_0x430a49,null))[_0xc937('0x29')](function(_0x5061fe){if(_0x5061fe){_0x392dd8[_0xc937('0x4e')][_0xc937('0x58')]=_0x5061fe['id'];return db[_0xc937('0x59')][_0xc937('0x4d')](_0x392dd8[_0xc937('0x4e')]);}})[_0xc937('0x29')](respondWithResult(_0x430a49,null))[_0xc937('0x4c')](handleError(_0x430a49,null));};exports[_0xc937('0x5a')]=function(_0x30cc61,_0x2ef83d,_0x1e272d){var _0x2e18c8={'raw':![],'where':{}};var _0x505f8c={};var _0x361fa0={'count':0x0,'rows':[]};return db[_0xc937('0x31')][_0xc937('0x5b')]({'where':{'id':_0x30cc61[_0xc937('0x48')]['id']}})[_0xc937('0x29')](handleEntityNotFound(_0x2ef83d,null))['then'](function(_0x2b877a){if(_0x2b877a){_0x505f8c[_0xc937('0x34')]=_['keys'](db[_0xc937('0x59')][_0xc937('0x49')]);_0x505f8c[_0xc937('0x35')]=_[_0xc937('0x36')](_0x30cc61[_0xc937('0x35')]);_0x505f8c['filters']=_['intersection'](_0x505f8c[_0xc937('0x34')],_0x505f8c[_0xc937('0x35')]);_0x2e18c8[_0xc937('0x38')]=_[_0xc937('0x37')](_0x505f8c['model'],qs[_0xc937('0x39')](_0x30cc61['query'][_0xc937('0x39')]));_0x2e18c8[_0xc937('0x38')]=_0x2e18c8[_0xc937('0x38')][_0xc937('0x3a')]?_0x2e18c8['attributes']:_0x505f8c[_0xc937('0x34')];if(!_0x30cc61[_0xc937('0x35')][_0xc937('0x5c')](_0xc937('0x5d'))){_0x2e18c8[_0xc937('0x22')]=qs['limit'](_0x30cc61[_0xc937('0x35')][_0xc937('0x22')]);_0x2e18c8[_0xc937('0x20')]=qs[_0xc937('0x20')](_0x30cc61['query'][_0xc937('0x20')]);}_0x2e18c8[_0xc937('0x5e')]=qs[_0xc937('0x3b')](_0x30cc61[_0xc937('0x35')][_0xc937('0x3b')]);_0x2e18c8['where']=qs[_0xc937('0x3d')](_['pick'](_0x30cc61[_0xc937('0x35')],_0x505f8c[_0xc937('0x3d')]));_0x2e18c8[_0xc937('0x42')][_0xc937('0x58')]=_0x2b877a['id'];if(_0x30cc61[_0xc937('0x35')]['filter']){_0x2e18c8['where']=_[_0xc937('0x3f')](_0x2e18c8['where'],{'$or':_[_0xc937('0x40')](_0x2e18c8[_0xc937('0x38')],function(_0x509200){var _0x1bb6e2={};_0x1bb6e2[_0x509200]={'$like':'%'+_0x30cc61[_0xc937('0x35')][_0xc937('0x3e')]+'%'};return _0x1bb6e2;})});}_0x2e18c8=_[_0xc937('0x3f')]({},_0x2e18c8,_0x30cc61[_0xc937('0x4a')]);return db[_0xc937('0x59')][_0xc937('0x23')]({'where':_0x2e18c8[_0xc937('0x42')]})[_0xc937('0x29')](function(_0x4fe668){_0x361fa0[_0xc937('0x23')]=_0x4fe668;if(_0x30cc61[_0xc937('0x35')][_0xc937('0x43')]){_0x2e18c8[_0xc937('0x44')]=[{'all':!![]}];}return db[_0xc937('0x59')][_0xc937('0x45')](_0x2e18c8);})['then'](function(_0x4e76d2){_0x361fa0[_0xc937('0x46')]=_0x4e76d2;return _0x361fa0;});}})[_0xc937('0x29')](respondWithFilteredResult(_0x2ef83d,_0x2e18c8))['catch'](handleError(_0x2ef83d,null));};exports[_0xc937('0x5f')]=function(_0x15aa8b,_0x12191f,_0x2830ae){return db['CmList']['find']({'where':{'id':_0x15aa8b['params']['id']}})[_0xc937('0x29')](handleEntityNotFound(_0x12191f,null))[_0xc937('0x29')](function(_0x462b01){if(_0x462b01){return _0x462b01['removeDispositions'](_0x15aa8b[_0xc937('0x35')]['ids']);}})[_0xc937('0x29')](respondWithStatusCode(_0x12191f,null))[_0xc937('0x4c')](handleError(_0x12191f,null));};exports[_0xc937('0x60')]=function(_0x302218,_0x3c06a5,_0x2d58a8){return db['CmList'][_0xc937('0x4b')]({'where':{'id':_0x302218[_0xc937('0x48')]['id']}})[_0xc937('0x29')](handleEntityNotFound(_0x3c06a5,null))['then'](function(_0x54c996){if(_0x54c996){var _0x564822=[];var _0x130b2c={'success':[],'errors':[]};return db[_0xc937('0x61')]['describe']()[_0xc937('0x29')](function(_0x4393ad){if(_0x302218[_0xc937('0x4e')][_0xc937('0x62')]&&_['isArray'](_0x302218[_0xc937('0x4e')]['tags'])){if(_0x302218[_0xc937('0x4e')]['tags'][_0xc937('0x3a')]){_0x302218['body']['tags']=_0x302218['body'][_0xc937('0x62')][_0xc937('0x63')](';')+';';}else{_0x302218[_0xc937('0x4e')][_0xc937('0x62')]=null;}}else{_0x302218[_0xc937('0x4e')][_0xc937('0x62')]=null;}if(_0x302218[_0xc937('0x4e')]&&_[_0xc937('0x64')](_0x302218[_0xc937('0x4e')])){for(var _0x5076f3=0x0;_0x5076f3<_0x302218[_0xc937('0x4e')]['length'];_0x5076f3+=0x1){_0x302218['body'][_0x5076f3]['ListId']=_0x302218['params']['id'];_0x564822[_0xc937('0x65')](_0x302218[_0xc937('0x4e')][_0x5076f3]);}return BPromise[_0xc937('0x66')](_0x564822,function(_0x21a0c6){return db[_0xc937('0x61')][_0xc937('0x4d')](_['omit'](_0x21a0c6,[_0xc937('0x67'),'id'])||{},{'fields':_[_0xc937('0x36')](_0x4393ad),'raw':!![]})['then'](function(_0x4f0436){_0x130b2c[_0xc937('0x68')][_0xc937('0x65')](_0x4f0436[_0xc937('0x69')]);})[_0xc937('0x4c')](function(_0xbe46ac){_0x130b2c['errors'][_0xc937('0x65')]({'data':_0x21a0c6,'error':_0xbe46ac['message']});});})[_0xc937('0x29')](function(_0x1db0be){return _0x130b2c;})['catch'](function(_0x54e3cd){return _0x54e3cd;});}else{_0x3c06a5[_0xc937('0x1f')](0x190)[_0xc937('0x25')]({'message':_0xc937('0x6a')});}});}})[_0xc937('0x29')](respondWithResult(_0x3c06a5,null))[_0xc937('0x4c')](handleError(_0x3c06a5,null));};exports[_0xc937('0x6b')]=function(_0x3717b2,_0x4c97cb,_0x533d92){var _0xa8e7e7;return db['CmList'][_0xc937('0x4b')]({'where':{'id':_0x3717b2[_0xc937('0x48')]['id']},'include':[{'model':db[_0xc937('0x6c')],'as':'CustomFields'}]})[_0xc937('0x29')](handleEntityNotFound(_0x4c97cb,null))[_0xc937('0x29')](function(_0x5ae82f){if(_0x5ae82f){_0xa8e7e7=_0x5ae82f;return db[_0xc937('0x61')][_0xc937('0x49')];}})[_0xc937('0x29')](function(_0x5c3133){if(_0x5c3133){var _0x341450={};var _0x421a83={};_0x421a83[_0xc937('0x34')]=_[_0xc937('0x6d')](_[_0xc937('0x36')](_0x5c3133),_[_0xc937('0x40')](_0xa8e7e7[_0xc937('0x6e')],function(_0x1bb7cf){return util[_0xc937('0x6f')](_0xc937('0x70'),_0x1bb7cf['id']);}));_0x421a83['query']=_[_0xc937('0x36')](_0x3717b2[_0xc937('0x35')]);_0x421a83['filters']=_[_0xc937('0x37')](_0x421a83[_0xc937('0x34')],_0x421a83[_0xc937('0x35')]);_0x341450['attributes']=_[_0xc937('0x37')](_0x421a83[_0xc937('0x34')],qs['fields'](_0x3717b2[_0xc937('0x35')][_0xc937('0x39')]));_0x341450[_0xc937('0x38')]=_0x341450[_0xc937('0x38')]['length']?_0x341450[_0xc937('0x38')]:_0x421a83['model'];if(!_0x3717b2[_0xc937('0x35')][_0xc937('0x5c')](_0xc937('0x5d'))){_0x341450[_0xc937('0x22')]=qs['limit'](_0x3717b2[_0xc937('0x35')][_0xc937('0x22')]);_0x341450[_0xc937('0x20')]=qs[_0xc937('0x20')](_0x3717b2['query'][_0xc937('0x20')]);}_0x341450['order']=qs['sort'](_0x3717b2['query'][_0xc937('0x3b')]);_0x341450[_0xc937('0x42')]=qs[_0xc937('0x3d')](_[_0xc937('0x3c')](_0x3717b2['query'],_0x421a83[_0xc937('0x3d')]));_0x341450[_0xc937('0x71')]=!![];if(_0x3717b2[_0xc937('0x35')][_0xc937('0x3e')]){_0x341450[_0xc937('0x42')]=_[_0xc937('0x3f')](_0x341450[_0xc937('0x42')],{'$or':_[_0xc937('0x40')](_0x341450[_0xc937('0x38')],function(_0x51083c){var _0x384582={};_0x384582[_0x51083c]={'$like':'%'+_0x3717b2[_0xc937('0x35')][_0xc937('0x3e')]+'%'};return _0x384582;})});}_0x341450=_[_0xc937('0x3f')]({},_0x341450,_0x3717b2['options']);return _0xa8e7e7[_0xc937('0x6b')](_0x341450);}})[_0xc937('0x29')](respondWithResult(_0x4c97cb,null))[_0xc937('0x4c')](handleError(_0x4c97cb,null));};exports[_0xc937('0x72')]=function(_0x6303d,_0x45eb03,_0x41bd8a){var _0x30bc46;var _0x46c689;var _0x14266d;var _0xfa36c1=_0x6303d[_0xc937('0x48')]['id'];csv_results=[];return db[_0xc937('0x73')][_0xc937('0x45')]({'attributes':['id','name'],'raw':!![],'order':[_0xc937('0x74')]})[_0xc937('0x29')](function(_0xd68ae7){_0x30bc46=_0xd68ae7;var _0xbdb3b8=_[_0xc937('0x36')](db[_0xc937('0x61')][_0xc937('0x49')]);return db[_0xc937('0x6c')][_0xc937('0x45')]({'raw':!![],'attributes':['id',_0xc937('0x75')]})['then'](function(_0x3ab004){_0x46c689=_0x3ab004;var _0x4e5d08=squel[_0xc937('0x76')]()['fields'](_0xbdb3b8)['from'](_0xc937('0x77'),'c')[_0xc937('0x42')]('c.ListId\x20=\x20?',_0xfa36c1)['where'](_0xc937('0x78'))['distinct']();for(var _0x288022=0x0;_0x288022<_0x46c689[_0xc937('0x3a')];_0x288022++){_0x4e5d08[_0xc937('0x79')](_0xc937('0x7a')+_0x46c689[_0x288022]['id'],'customField_'+_0x46c689[_0x288022][_0xc937('0x75')]);}for(var _0x288022=0x0;_0x288022<_0x30bc46[_0xc937('0x3a')];_0x288022++){_0x4e5d08[_0xc937('0x79')](squel[_0xc937('0x76')]()[_0xc937('0x79')](_0xc937('0x7b'))[_0xc937('0x7c')](_0xc937('0x7d'))[_0xc937('0x42')]('ItemTypeId\x20=\x20?',_0x30bc46[_0x288022]['id'])[_0xc937('0x42')](_0xc937('0x7e')),'additionalPhone_'+_0x30bc46[_0x288022][_0xc937('0x2f')]);_0x4e5d08['field'](squel[_0xc937('0x76')]()[_0xc937('0x79')](_0xc937('0x7f'))['from']('cm_contact_has_items')[_0xc937('0x42')](_0xc937('0x80'),_0x30bc46[_0x288022]['id'])[_0xc937('0x42')](_0xc937('0x7e')),_0xc937('0x81')+_0x30bc46[_0x288022][_0xc937('0x2f')]);}var _0x53fb11=[];_0x53fb11[_0xc937('0x65')](_0x4e5d08['toString']());BPromise[_0xc937('0x66')](_0x53fb11,handleQuery)[_0xc937('0x29')](function(_0x49764a){handleQuery(_0x4e5d08['toString']());var _0x28bb05=csv_results[0x0];if(!_['isEmpty'](_0x28bb05)){var _0x5daa73=toCsv(_0x28bb05);var _0x4e827a=Date[_0xc937('0x82')]();fs[_0xc937('0x83')](util[_0xc937('0x6f')](_0xc937('0x84'),_0xfa36c1,_0x4e827a),_0x5daa73);_0x45eb03[_0xc937('0x85')](_0xc937('0x86'),_0xc937('0x87')+util[_0xc937('0x6f')]('list_%d_%s.csv',_0xfa36c1,_0x4e827a));_0x45eb03['setHeader'](_0xc937('0x88'),_0xc937('0x89'));return _0x45eb03[_0xc937('0x8a')](util[_0xc937('0x6f')]('/tmp/list_%d_%s.csv',_0xfa36c1,_0x4e827a));}else{return _0x45eb03['sendStatus'](0xcc);}});});});};exports[_0xc937('0x8b')]=function(_0x4209c9,_0x394445,_0x1ab42a){var _0x220082;delete _0x4209c9[_0xc937('0x4e')]['id'];return db[_0xc937('0x31')][_0xc937('0x5b')]({'where':{'id':_0x4209c9['params']['id']}})[_0xc937('0x29')](handleEntityNotFound(_0x394445,null))[_0xc937('0x29')](function(_0x1bd99b){if(_0x1bd99b){return db[_0xc937('0x8c')][_0xc937('0x8d')](function(_0x3ec26d){return db[_0xc937('0x6c')][_0xc937('0x4d')](_0x4209c9[_0xc937('0x4e')],{'transaction':_0x3ec26d})[_0xc937('0x29')](function(_0x7b0869){_0x220082=_0x7b0869;return _0x1bd99b[_0xc937('0x8e')](_0x7b0869,{'transaction':_0x3ec26d});})[_0xc937('0x29')](function(){var _0x22be87={'type':db[_0xc937('0x8f')]['TEXT'],'transaction':_0x3ec26d};switch(_0x4209c9[_0xc937('0x4e')]['type']){case _0xc937('0x90'):_0x22be87[_0xc937('0x32')]=db[_0xc937('0x8f')][_0xc937('0x91')];break;case _0xc937('0x92'):_0x22be87[_0xc937('0x32')]=db[_0xc937('0x8f')]['INTEGER'];break;case _0xc937('0x93'):_0x22be87['type']=db[_0xc937('0x8f')][_0xc937('0x94')];_0x22be87[_0xc937('0x95')]=![];break;default:}return db[_0xc937('0x8c')]['queryInterface']['addColumn'](_0xc937('0x77'),util[_0xc937('0x6f')](_0xc937('0x96'),_0x220082['id']),_0x22be87);})['then'](function(){return _0x220082;});});}})[_0xc937('0x29')](respondWithResult(_0x394445,null))[_0xc937('0x4c')](handleError(_0x394445,null));};exports['getCustomFields']=function(_0x5f1295,_0x465c3c,_0x24ae66){var _0xe54f36={};var _0x3fe87b={};var _0x37cedf;var _0x5a42d4;return db[_0xc937('0x31')]['findOne']({'where':{'id':_0x5f1295[_0xc937('0x48')]['id']}})[_0xc937('0x29')](handleEntityNotFound(_0x465c3c,null))['then'](function(_0x234050){if(_0x234050){_0x37cedf=_0x234050;_0x3fe87b[_0xc937('0x34')]=_[_0xc937('0x36')](db[_0xc937('0x6c')]['rawAttributes']);_0x3fe87b['query']=_[_0xc937('0x36')](_0x5f1295['query']);_0x3fe87b['filters']=_[_0xc937('0x37')](_0x3fe87b[_0xc937('0x34')],_0x3fe87b[_0xc937('0x35')]);_0xe54f36[_0xc937('0x38')]=_[_0xc937('0x37')](_0x3fe87b['model'],qs['fields'](_0x5f1295[_0xc937('0x35')][_0xc937('0x39')]));_0xe54f36[_0xc937('0x38')]=_0xe54f36[_0xc937('0x38')][_0xc937('0x3a')]?_0xe54f36[_0xc937('0x38')]:_0x3fe87b['model'];_0xe54f36[_0xc937('0x5e')]=qs[_0xc937('0x3b')](_0x5f1295[_0xc937('0x35')]['sort']);_0xe54f36[_0xc937('0x42')]=qs[_0xc937('0x3d')](_[_0xc937('0x3c')](_0x5f1295[_0xc937('0x35')],_0x3fe87b[_0xc937('0x3d')]));_0xe54f36[_0xc937('0x42')]=_['merge'](_0xe54f36[_0xc937('0x42')],{'$or':[{'ListId':_0x234050['id']},{'ListId':null}]});if(_0x5f1295[_0xc937('0x35')][_0xc937('0x3e')]){_0xe54f36[_0xc937('0x42')]=_[_0xc937('0x3f')](_0xe54f36[_0xc937('0x42')],{'$or':_[_0xc937('0x40')](_0xe54f36[_0xc937('0x38')],function(_0x57f8a8){var _0x54162c={};_0x54162c[_0x57f8a8]={'$like':'%'+_0x5f1295[_0xc937('0x35')][_0xc937('0x3e')]+'%'};return _0x54162c;})});}_0xe54f36=_[_0xc937('0x3f')]({},_0xe54f36,_0x5f1295['options']);return db[_0xc937('0x6c')]['findAndCountAll'](_0xe54f36);}})[_0xc937('0x29')](respondWithResult(_0x465c3c,null))[_0xc937('0x4c')](handleError(_0x465c3c,null));};exports[_0xc937('0x97')]=function(_0x288ee2,_0x41e069){return db[_0xc937('0x6c')][_0xc937('0x98')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x41e069,null))['then'](function(_0x24d532){return _0x24d532;})[_0xc937('0x29')](respondWithResult(_0x41e069,null))[_0xc937('0x4c')](handleError(_0x41e069,null));};exports[_0xc937('0x99')]=function(_0x21c027,_0x34e7dc,_0x3bd99b){return db[_0xc937('0x31')][_0xc937('0x4b')]({'where':{'id':_0x21c027[_0xc937('0x48')]['id']}})[_0xc937('0x29')](handleEntityNotFound(_0x34e7dc,null))[_0xc937('0x29')](function(_0x57c092){if(_0x57c092){return _0x57c092[_0xc937('0x99')](_0x21c027['body'][_0xc937('0x67')],_[_0xc937('0x9a')](_0x21c027['body'],[_0xc937('0x67'),'id'])||{})[_0xc937('0x9b')](function(_0x10c629){for(var _0x116132=0x0;_0x116132<_0x21c027[_0xc937('0x4e')][_0xc937('0x67')][_0xc937('0x3a')];_0x116132+=0x1){socket['emit'](_0xc937('0x9c'),{'UserId':Number(_0x21c027[_0xc937('0x4e')]['ids'][_0x116132]),'CmListId':Number(_0x21c027[_0xc937('0x48')]['id'])});}return _0x10c629;});}})[_0xc937('0x29')](respondWithResult(_0x34e7dc,null))[_0xc937('0x4c')](handleError(_0x34e7dc,null));};exports[_0xc937('0x9d')]=function(_0x119b9a,_0x1e2bc1,_0x2568dd){return db[_0xc937('0x31')]['find']({'where':{'id':_0x119b9a[_0xc937('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e2bc1,null))[_0xc937('0x29')](function(_0x42fcdd){if(_0x42fcdd){return _0x42fcdd[_0xc937('0x9d')](_0x119b9a[_0xc937('0x35')]['ids'])[_0xc937('0x29')](function(){if(_['isArray'](_0x119b9a[_0xc937('0x35')]['ids'])){for(var _0x2568da=0x0;_0x2568da<_0x119b9a[_0xc937('0x35')][_0xc937('0x67')][_0xc937('0x3a')];_0x2568da+=0x1){socket[_0xc937('0x9e')]('userCmList:remove',{'UserId':Number(_0x119b9a[_0xc937('0x35')][_0xc937('0x67')][_0x2568da]),'CmListId':Number(_0x119b9a[_0xc937('0x48')]['id'])});}}else{socket[_0xc937('0x9e')](_0xc937('0x9f'),{'UserId':Number(_0x119b9a[_0xc937('0x35')][_0xc937('0x67')]),'CmListId':Number(_0x119b9a[_0xc937('0x48')]['id'])});}});}})[_0xc937('0x29')](respondWithStatusCode(_0x1e2bc1,null))[_0xc937('0x4c')](handleError(_0x1e2bc1,null));};exports[_0xc937('0xa0')]=function(_0x5e0465,_0x5a909b,_0x2338a9){var _0x179ee4={};var _0x28ad84={};var _0x3dd45d;var _0x22dae5;return db[_0xc937('0x31')][_0xc937('0x5b')]({'where':{'id':_0x5e0465['params']['id']}})['then'](handleEntityNotFound(_0x5a909b,null))[_0xc937('0x29')](function(_0x369ffc){if(_0x369ffc){_0x3dd45d=_0x369ffc;_0x28ad84['model']=_['keys'](db[_0xc937('0xa1')][_0xc937('0x49')]);_0x28ad84['query']=_[_0xc937('0x36')](_0x5e0465[_0xc937('0x35')]);_0x28ad84['filters']=_[_0xc937('0x37')](_0x28ad84[_0xc937('0x34')],_0x28ad84[_0xc937('0x35')]);_0x179ee4[_0xc937('0x38')]=_[_0xc937('0x37')](_0x28ad84[_0xc937('0x34')],qs[_0xc937('0x39')](_0x5e0465['query']['fields']));_0x179ee4[_0xc937('0x38')]=_0x179ee4['attributes'][_0xc937('0x3a')]?_0x179ee4['attributes']:_0x28ad84[_0xc937('0x34')];_0x179ee4[_0xc937('0x5e')]=qs[_0xc937('0x3b')](_0x5e0465[_0xc937('0x35')]['sort']);_0x179ee4[_0xc937('0x42')]=qs[_0xc937('0x3d')](_[_0xc937('0x3c')](_0x5e0465[_0xc937('0x35')],_0x28ad84[_0xc937('0x3d')]));if(_0x5e0465[_0xc937('0x35')][_0xc937('0x3e')]){_0x179ee4[_0xc937('0x42')]=_[_0xc937('0x3f')](_0x179ee4[_0xc937('0x42')],{'$or':_['map'](_0x179ee4[_0xc937('0x38')],function(_0xfb6a2a){var _0x574d9d={};_0x574d9d[_0xfb6a2a]={'$like':'%'+_0x5e0465[_0xc937('0x35')][_0xc937('0x3e')]+'%'};return _0x574d9d;})});}_0x179ee4=_[_0xc937('0x3f')]({},_0x179ee4,_0x5e0465[_0xc937('0x4a')]);return _0x3dd45d[_0xc937('0xa0')](_0x179ee4);}})[_0xc937('0x29')](function(_0x1df533){if(_0x1df533){_0x22dae5=_0x1df533[_0xc937('0x3a')];if(!_0x5e0465[_0xc937('0x35')][_0xc937('0x5c')](_0xc937('0x5d'))){_0x179ee4[_0xc937('0x22')]=qs[_0xc937('0x22')](_0x5e0465[_0xc937('0x35')][_0xc937('0x22')]);_0x179ee4[_0xc937('0x20')]=qs[_0xc937('0x20')](_0x5e0465[_0xc937('0x35')]['offset']);}return _0x3dd45d[_0xc937('0xa0')](_0x179ee4);}})[_0xc937('0x29')](function(_0x28d6d9){if(_0x28d6d9){return _0x28d6d9?{'count':_0x22dae5,'rows':_0x28d6d9}:null;}})[_0xc937('0x29')](respondWithResult(_0x5a909b,null))['catch'](handleError(_0x5a909b,null));};function handleQuery(_0x3e75f8){logger[_0xc937('0xa2')](_0x3e75f8);return db[_0xc937('0x8c')][_0xc937('0x35')](_0x3e75f8)[_0xc937('0x9b')](function(_0x33daed){csv_results[_0xc937('0x65')](_0x33daed);})[_0xc937('0x4c')](function(_0x253da7){logger[_0xc937('0x2d')](_0x253da7[_0xc937('0xa3')]);});} \ No newline at end of file +var _0xb304=['name','send','index','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','Lists','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','ListId','getDispositions','findOne','Disposition','pick','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','OrderBy','CmCustomField','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','text','Sequelize','TEXT','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getGlobalCustomFields','findAndCountAll','addAgents','ids','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','limit','undefined','count','offset','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','stack'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xb304,0x7a));var _0x4b30=function(_0xc9bce3,_0x52e450){_0xc9bce3=_0xc9bce3-0x0;var _0x2c2602=_0xb304[_0xc9bce3];return _0x2c2602;};'use strict';var emlformat=require(_0x4b30('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4b30('0x1'));var rp=require(_0x4b30('0x2'));var moment=require(_0x4b30('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4b30('0x4'));var util=require('util');var path=require(_0x4b30('0x5'));var sox=require(_0x4b30('0x6'));var csv=require(_0x4b30('0x7'));var ejs=require(_0x4b30('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b30('0x9'));var squel=require(_0x4b30('0xa'));var crypto=require(_0x4b30('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b30('0xc'));var toCsv=require(_0x4b30('0x7'));var querystring=require(_0x4b30('0xd'));var Papa=require(_0x4b30('0xe'));var Redis=require(_0x4b30('0xf'));var authService=require(_0x4b30('0x10'));var qs=require(_0x4b30('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b30('0x12'));var logger=require(_0x4b30('0x13'))(_0x4b30('0x14'));var utils=require(_0x4b30('0x15'));var config=require(_0x4b30('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b30('0x17'))['db'];var csv_results;config[_0x4b30('0x18')]=_[_0x4b30('0x19')](config[_0x4b30('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b30('0x1a'))(new Redis(config[_0x4b30('0x18')]));require(_0x4b30('0x1b'))[_0x4b30('0x1c')](socket);function respondWithStatusCode(_0x151730,_0x3863a5){_0x3863a5=_0x3863a5||0xcc;return function(_0x383fb5){if(_0x383fb5){return _0x151730[_0x4b30('0x1d')](_0x3863a5);}return _0x151730['status'](_0x3863a5)['end']();};}function respondWithResult(_0x550f77,_0x383a90){_0x383a90=_0x383a90||0xc8;return function(_0x27a6b3){if(_0x27a6b3){return _0x550f77[_0x4b30('0x1e')](_0x383a90)[_0x4b30('0x1f')](_0x27a6b3);}};}function respondWithFilteredResult(_0x4dfab,_0x51ae32){return function(_0x1c276d){if(_0x1c276d){var _0x17647c=typeof _0x51ae32['offset']==='undefined'&&typeof _0x51ae32[_0x4b30('0x20')]===_0x4b30('0x21');var _0x3ef105=_0x1c276d[_0x4b30('0x22')];var _0x1853a3=_0x17647c?0x0:_0x51ae32[_0x4b30('0x23')];var _0x333674=_0x17647c?_0x1c276d[_0x4b30('0x22')]:_0x51ae32[_0x4b30('0x23')]+_0x51ae32[_0x4b30('0x20')];var _0x230f22;if(_0x333674>=_0x3ef105){_0x333674=_0x3ef105;_0x230f22=0xc8;}else{_0x230f22=0xce;}_0x4dfab['status'](_0x230f22);return _0x4dfab['set']('Content-Range',_0x1853a3+'-'+_0x333674+'/'+_0x3ef105)['json'](_0x1c276d);}return null;};}function patchUpdates(_0x4e4e7a){return function(_0x57e4bc){try{jsonpatch[_0x4b30('0x24')](_0x57e4bc,_0x4e4e7a,!![]);}catch(_0x5df6ec){return BPromise[_0x4b30('0x25')](_0x5df6ec);}return _0x57e4bc[_0x4b30('0x26')]();};}function saveUpdates(_0x5b96ce,_0x3aac37){return function(_0xf55f07){if(_0xf55f07){return _0xf55f07[_0x4b30('0x27')](_0x5b96ce)['then'](function(_0x5b8dbb){return _0x5b8dbb;});}return null;};}function removeEntity(_0x5358d2,_0xd8a8a0){return function(_0x5d4b62){if(_0x5d4b62){return _0x5d4b62[_0x4b30('0x28')]()[_0x4b30('0x29')](function(){var _0x116eba=_0x5d4b62[_0x4b30('0x2a')]({'plain':!![]});var _0x2b2682='Lists';return db[_0x4b30('0x2b')]['destroy']({'where':{'type':_0x2b2682,'resourceId':_0x116eba['id']}})[_0x4b30('0x29')](function(){return _0x5d4b62;});})[_0x4b30('0x29')](function(){_0x5358d2[_0x4b30('0x1e')](0xcc)[_0x4b30('0x2c')]();});}};}function handleEntityNotFound(_0x40e88b,_0x117974){return function(_0x31cfd0){if(!_0x31cfd0){_0x40e88b[_0x4b30('0x1d')](0x194);}return _0x31cfd0;};}function handleError(_0x25a5af,_0x58c6fe){_0x58c6fe=_0x58c6fe||0x1f4;return function(_0x4ae215){logger[_0x4b30('0x2d')](_0x4ae215[_0x4b30('0x2e')]);if(_0x4ae215[_0x4b30('0x2f')]){delete _0x4ae215[_0x4b30('0x2f')];}_0x25a5af['status'](_0x58c6fe)[_0x4b30('0x30')](_0x4ae215);};}exports[_0x4b30('0x31')]=function(_0x433eda,_0x5518c4){var _0x28aa78={},_0x5be291={},_0x286e99={'count':0x0,'rows':[]};var _0x2a4930=_[_0x4b30('0x32')](db[_0x4b30('0x33')]['rawAttributes'],function(_0x514571){return{'name':_0x514571[_0x4b30('0x34')],'type':_0x514571[_0x4b30('0x35')][_0x4b30('0x36')]};});_0x5be291[_0x4b30('0x37')]=_['map'](_0x2a4930,'name');_0x5be291[_0x4b30('0x38')]=_[_0x4b30('0x39')](_0x433eda[_0x4b30('0x38')]);_0x5be291[_0x4b30('0x3a')]=_[_0x4b30('0x3b')](_0x5be291['model'],_0x5be291[_0x4b30('0x38')]);_0x28aa78[_0x4b30('0x3c')]=_[_0x4b30('0x3b')](_0x5be291['model'],qs[_0x4b30('0x3d')](_0x433eda[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x28aa78[_0x4b30('0x3c')]=_0x28aa78[_0x4b30('0x3c')][_0x4b30('0x3e')]?_0x28aa78[_0x4b30('0x3c')]:_0x5be291[_0x4b30('0x37')];if(!_0x433eda['query'][_0x4b30('0x3f')](_0x4b30('0x40'))){_0x28aa78[_0x4b30('0x20')]=qs[_0x4b30('0x20')](_0x433eda[_0x4b30('0x38')][_0x4b30('0x20')]);_0x28aa78['offset']=qs[_0x4b30('0x23')](_0x433eda[_0x4b30('0x38')][_0x4b30('0x23')]);}_0x28aa78[_0x4b30('0x41')]=qs['sort'](_0x433eda['query'][_0x4b30('0x42')]);_0x28aa78[_0x4b30('0x43')]=qs['filters'](_['pick'](_0x433eda[_0x4b30('0x38')],_0x5be291[_0x4b30('0x3a')]),_0x2a4930);if(_0x433eda[_0x4b30('0x38')][_0x4b30('0x44')]){_0x28aa78['where']=_['merge'](_0x28aa78[_0x4b30('0x43')],{'$or':_[_0x4b30('0x32')](_0x2a4930,function(_0x59f7ad){if(_0x59f7ad[_0x4b30('0x35')]!==_0x4b30('0x45')){var _0x4bae14={};_0x4bae14[_0x59f7ad[_0x4b30('0x2f')]]={'$like':'%'+_0x433eda[_0x4b30('0x38')][_0x4b30('0x44')]+'%'};return _0x4bae14;}})});}_0x28aa78=_[_0x4b30('0x46')]({},_0x28aa78,_0x433eda[_0x4b30('0x47')]);var _0x356391={'where':_0x28aa78['where']};return db[_0x4b30('0x33')][_0x4b30('0x22')](_0x356391)[_0x4b30('0x29')](function(_0x3c587a){_0x286e99[_0x4b30('0x22')]=_0x3c587a;if(_0x433eda['query'][_0x4b30('0x48')]){_0x28aa78[_0x4b30('0x49')]=[{'all':!![]}];}return db['CmList'][_0x4b30('0x4a')](_0x28aa78);})[_0x4b30('0x29')](function(_0x251465){_0x286e99[_0x4b30('0x4b')]=_0x251465;return _0x286e99;})[_0x4b30('0x29')](respondWithFilteredResult(_0x5518c4,_0x28aa78))[_0x4b30('0x4c')](handleError(_0x5518c4,null));};exports[_0x4b30('0x4d')]=function(_0x7fa169,_0x4fb00a){var _0x552bb6={'raw':![],'where':{'id':_0x7fa169[_0x4b30('0x4e')]['id']}},_0x67e96d={};_0x67e96d['model']=_['keys'](db[_0x4b30('0x33')][_0x4b30('0x4f')]);_0x67e96d['query']=_[_0x4b30('0x39')](_0x7fa169[_0x4b30('0x38')]);_0x67e96d[_0x4b30('0x3a')]=_['intersection'](_0x67e96d['model'],_0x67e96d[_0x4b30('0x38')]);_0x552bb6['attributes']=_[_0x4b30('0x3b')](_0x67e96d['model'],qs['fields'](_0x7fa169[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x552bb6[_0x4b30('0x3c')]=_0x552bb6[_0x4b30('0x3c')][_0x4b30('0x3e')]?_0x552bb6['attributes']:_0x67e96d[_0x4b30('0x37')];if(_0x7fa169[_0x4b30('0x38')][_0x4b30('0x48')]){_0x552bb6[_0x4b30('0x49')]=[{'all':!![]}];}_0x552bb6=_['merge']({},_0x552bb6,_0x7fa169[_0x4b30('0x47')]);return db[_0x4b30('0x33')][_0x4b30('0x50')](_0x552bb6)['then'](handleEntityNotFound(_0x4fb00a,null))['then'](respondWithResult(_0x4fb00a,null))['catch'](handleError(_0x4fb00a,null));};exports['create']=function(_0x52a9ed,_0x4a0f87){return db[_0x4b30('0x33')][_0x4b30('0x51')](_0x52a9ed[_0x4b30('0x52')],{})[_0x4b30('0x29')](function(_0x5f41a4){var _0xa9d38a=_0x52a9ed[_0x4b30('0x53')][_0x4b30('0x2a')]({'plain':!![]});if(!_0xa9d38a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa9d38a[_0x4b30('0x54')]===_0x4b30('0x53')){var _0x2e2d34=_0x5f41a4[_0x4b30('0x2a')]({'plain':!![]});var _0x28566a=_0x4b30('0x55');return db[_0x4b30('0x56')][_0x4b30('0x50')]({'where':{'name':_0x28566a,'userProfileId':_0xa9d38a[_0x4b30('0x57')]},'raw':!![]})[_0x4b30('0x29')](function(_0x39cfdf){if(_0x39cfdf&&_0x39cfdf[_0x4b30('0x58')]===0x0){return db[_0x4b30('0x2b')][_0x4b30('0x51')]({'name':_0x2e2d34['name'],'resourceId':_0x2e2d34['id'],'type':_0x39cfdf[_0x4b30('0x2f')],'sectionId':_0x39cfdf['id']},{})[_0x4b30('0x29')](function(){return _0x5f41a4;});}else{return _0x5f41a4;}})['catch'](function(_0x1dc9aa){logger[_0x4b30('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dc9aa);throw _0x1dc9aa;});}return _0x5f41a4;})[_0x4b30('0x29')](respondWithResult(_0x4a0f87,0xc9))[_0x4b30('0x4c')](handleError(_0x4a0f87,null));};exports[_0x4b30('0x27')]=function(_0x4ade60,_0x522385){if(_0x4ade60[_0x4b30('0x52')]['id']){delete _0x4ade60[_0x4b30('0x52')]['id'];}return db[_0x4b30('0x33')]['find']({'where':{'id':_0x4ade60[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x522385,null))[_0x4b30('0x29')](saveUpdates(_0x4ade60[_0x4b30('0x52')],null))[_0x4b30('0x29')](respondWithResult(_0x522385,null))['catch'](handleError(_0x522385,null));};exports['destroy']=function(_0x511206,_0x4284b4){return db['CmList']['find']({'where':{'id':_0x511206[_0x4b30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4284b4,null))[_0x4b30('0x29')](removeEntity(_0x4284b4,null))[_0x4b30('0x4c')](handleError(_0x4284b4,null));};exports[_0x4b30('0x59')]=function(_0x400bf8,_0x4d1c83){return db['CmList'][_0x4b30('0x59')]()['then'](respondWithResult(_0x4d1c83,null))['catch'](handleError(_0x4d1c83,null));};exports[_0x4b30('0x5a')]=function(_0x555a7c,_0x449140,_0x307cf9){if(_0x555a7c[_0x4b30('0x52')]['id']){delete _0x555a7c[_0x4b30('0x52')]['id'];}return db['CmList'][_0x4b30('0x50')]({'where':{'id':_0x555a7c[_0x4b30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x449140,null))['then'](function(_0xb24e24){if(_0xb24e24){_0x555a7c[_0x4b30('0x52')][_0x4b30('0x5b')]=_0xb24e24['id'];return db['Disposition']['create'](_0x555a7c[_0x4b30('0x52')]);}})['then'](respondWithResult(_0x449140,null))[_0x4b30('0x4c')](handleError(_0x449140,null));};exports[_0x4b30('0x5c')]=function(_0x3c2788,_0x75da40,_0x4cf3d7){var _0x2671d4={'raw':![],'where':{}};var _0x1e9e46={};var _0x303470={'count':0x0,'rows':[]};return db[_0x4b30('0x33')][_0x4b30('0x5d')]({'where':{'id':_0x3c2788[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x75da40,null))[_0x4b30('0x29')](function(_0x285b57){if(_0x285b57){_0x1e9e46[_0x4b30('0x37')]=_[_0x4b30('0x39')](db[_0x4b30('0x5e')][_0x4b30('0x4f')]);_0x1e9e46[_0x4b30('0x38')]=_[_0x4b30('0x39')](_0x3c2788[_0x4b30('0x38')]);_0x1e9e46['filters']=_[_0x4b30('0x3b')](_0x1e9e46[_0x4b30('0x37')],_0x1e9e46[_0x4b30('0x38')]);_0x2671d4['attributes']=_[_0x4b30('0x3b')](_0x1e9e46[_0x4b30('0x37')],qs['fields'](_0x3c2788[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x2671d4['attributes']=_0x2671d4[_0x4b30('0x3c')][_0x4b30('0x3e')]?_0x2671d4[_0x4b30('0x3c')]:_0x1e9e46[_0x4b30('0x37')];if(!_0x3c2788[_0x4b30('0x38')][_0x4b30('0x3f')](_0x4b30('0x40'))){_0x2671d4['limit']=qs[_0x4b30('0x20')](_0x3c2788['query'][_0x4b30('0x20')]);_0x2671d4[_0x4b30('0x23')]=qs[_0x4b30('0x23')](_0x3c2788[_0x4b30('0x38')][_0x4b30('0x23')]);}_0x2671d4['order']=qs['sort'](_0x3c2788[_0x4b30('0x38')][_0x4b30('0x42')]);_0x2671d4[_0x4b30('0x43')]=qs[_0x4b30('0x3a')](_[_0x4b30('0x5f')](_0x3c2788[_0x4b30('0x38')],_0x1e9e46[_0x4b30('0x3a')]));_0x2671d4[_0x4b30('0x43')][_0x4b30('0x5b')]=_0x285b57['id'];if(_0x3c2788[_0x4b30('0x38')][_0x4b30('0x44')]){_0x2671d4[_0x4b30('0x43')]=_[_0x4b30('0x46')](_0x2671d4[_0x4b30('0x43')],{'$or':_[_0x4b30('0x32')](_0x2671d4[_0x4b30('0x3c')],function(_0x3217d0){var _0x2a914a={};_0x2a914a[_0x3217d0]={'$like':'%'+_0x3c2788[_0x4b30('0x38')][_0x4b30('0x44')]+'%'};return _0x2a914a;})});}_0x2671d4=_[_0x4b30('0x46')]({},_0x2671d4,_0x3c2788[_0x4b30('0x47')]);return db[_0x4b30('0x5e')][_0x4b30('0x22')]({'where':_0x2671d4[_0x4b30('0x43')]})[_0x4b30('0x29')](function(_0x2450bd){_0x303470['count']=_0x2450bd;if(_0x3c2788[_0x4b30('0x38')][_0x4b30('0x48')]){_0x2671d4[_0x4b30('0x49')]=[{'all':!![]}];}return db[_0x4b30('0x5e')]['findAll'](_0x2671d4);})[_0x4b30('0x29')](function(_0x314c79){_0x303470[_0x4b30('0x4b')]=_0x314c79;return _0x303470;});}})[_0x4b30('0x29')](respondWithFilteredResult(_0x75da40,_0x2671d4))['catch'](handleError(_0x75da40,null));};exports['removeDispositions']=function(_0x336681,_0x54c567,_0x5ead45){return db[_0x4b30('0x33')][_0x4b30('0x50')]({'where':{'id':_0x336681[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x54c567,null))[_0x4b30('0x29')](function(_0x5715bb){if(_0x5715bb){return _0x5715bb['removeDispositions'](_0x336681[_0x4b30('0x38')]['ids']);}})[_0x4b30('0x29')](respondWithStatusCode(_0x54c567,null))['catch'](handleError(_0x54c567,null));};exports[_0x4b30('0x60')]=function(_0x553f44,_0x57a0b0,_0x36988e){return db[_0x4b30('0x33')]['find']({'where':{'id':_0x553f44['params']['id']}})['then'](handleEntityNotFound(_0x57a0b0,null))['then'](function(_0x42e048){if(_0x42e048){var _0x3f3151=[];var _0x4aa917={'success':[],'errors':[]};return db[_0x4b30('0x61')][_0x4b30('0x59')]()['then'](function(_0x5df247){if(_0x553f44[_0x4b30('0x52')]['tags']&&_[_0x4b30('0x62')](_0x553f44[_0x4b30('0x52')][_0x4b30('0x63')])){if(_0x553f44['body']['tags'][_0x4b30('0x3e')]){_0x553f44[_0x4b30('0x52')][_0x4b30('0x63')]=_0x553f44[_0x4b30('0x52')]['tags'][_0x4b30('0x64')](';')+';';}else{_0x553f44[_0x4b30('0x52')][_0x4b30('0x63')]=null;}}else{_0x553f44['body'][_0x4b30('0x63')]=null;}if(_0x553f44[_0x4b30('0x52')]&&_[_0x4b30('0x62')](_0x553f44[_0x4b30('0x52')])){for(var _0x237a43=0x0;_0x237a43<_0x553f44[_0x4b30('0x52')]['length'];_0x237a43+=0x1){_0x553f44[_0x4b30('0x52')][_0x237a43]['ListId']=_0x553f44[_0x4b30('0x4e')]['id'];_0x3f3151[_0x4b30('0x65')](_0x553f44[_0x4b30('0x52')][_0x237a43]);}return BPromise[_0x4b30('0x66')](_0x3f3151,function(_0x8cf619){return db[_0x4b30('0x61')][_0x4b30('0x51')](_[_0x4b30('0x67')](_0x8cf619,['ids','id'])||{},{'fields':_[_0x4b30('0x39')](_0x5df247),'raw':!![]})[_0x4b30('0x29')](function(_0x3be055){_0x4aa917[_0x4b30('0x68')][_0x4b30('0x65')](_0x3be055[_0x4b30('0x69')]);})['catch'](function(_0x491634){_0x4aa917[_0x4b30('0x6a')][_0x4b30('0x65')]({'data':_0x8cf619,'error':_0x491634[_0x4b30('0x6b')]});});})[_0x4b30('0x29')](function(_0x4cac2e){return _0x4aa917;})['catch'](function(_0x23e4db){return _0x23e4db;});}else{_0x57a0b0[_0x4b30('0x1e')](0x190)[_0x4b30('0x1f')]({'message':_0x4b30('0x6c')});}});}})[_0x4b30('0x29')](respondWithResult(_0x57a0b0,null))[_0x4b30('0x4c')](handleError(_0x57a0b0,null));};exports[_0x4b30('0x6d')]=function(_0x1c24be,_0x46a1c3,_0x5c55f3){var _0x5b642f;return db['CmList'][_0x4b30('0x50')]({'where':{'id':_0x1c24be[_0x4b30('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x4b30('0x6e')}]})[_0x4b30('0x29')](handleEntityNotFound(_0x46a1c3,null))[_0x4b30('0x29')](function(_0x5df91f){if(_0x5df91f){_0x5b642f=_0x5df91f;return db[_0x4b30('0x61')][_0x4b30('0x4f')];}})[_0x4b30('0x29')](function(_0x3fed0c){if(_0x3fed0c){var _0x12c015={};var _0x2a4fc4={};_0x2a4fc4[_0x4b30('0x37')]=_[_0x4b30('0x6f')](_[_0x4b30('0x39')](_0x3fed0c),_['map'](_0x5b642f[_0x4b30('0x6e')],function(_0x2b93a9){return util[_0x4b30('0x70')](_0x4b30('0x71'),_0x2b93a9['id']);}));_0x2a4fc4['query']=_['keys'](_0x1c24be[_0x4b30('0x38')]);_0x2a4fc4['filters']=_[_0x4b30('0x3b')](_0x2a4fc4[_0x4b30('0x37')],_0x2a4fc4[_0x4b30('0x38')]);_0x12c015['attributes']=_[_0x4b30('0x3b')](_0x2a4fc4[_0x4b30('0x37')],qs[_0x4b30('0x3d')](_0x1c24be[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x12c015['attributes']=_0x12c015['attributes'][_0x4b30('0x3e')]?_0x12c015['attributes']:_0x2a4fc4[_0x4b30('0x37')];if(!_0x1c24be[_0x4b30('0x38')][_0x4b30('0x3f')]('nolimit')){_0x12c015['limit']=qs[_0x4b30('0x20')](_0x1c24be['query'][_0x4b30('0x20')]);_0x12c015[_0x4b30('0x23')]=qs['offset'](_0x1c24be[_0x4b30('0x38')][_0x4b30('0x23')]);}_0x12c015['order']=qs['sort'](_0x1c24be[_0x4b30('0x38')][_0x4b30('0x42')]);_0x12c015[_0x4b30('0x43')]=qs[_0x4b30('0x3a')](_[_0x4b30('0x5f')](_0x1c24be[_0x4b30('0x38')],_0x2a4fc4[_0x4b30('0x3a')]));_0x12c015[_0x4b30('0x72')]=!![];if(_0x1c24be['query'][_0x4b30('0x44')]){_0x12c015[_0x4b30('0x43')]=_[_0x4b30('0x46')](_0x12c015[_0x4b30('0x43')],{'$or':_[_0x4b30('0x32')](_0x12c015[_0x4b30('0x3c')],function(_0x1fd959){var _0x4ac2e0={};_0x4ac2e0[_0x1fd959]={'$like':'%'+_0x1c24be['query'][_0x4b30('0x44')]+'%'};return _0x4ac2e0;})});}_0x12c015=_[_0x4b30('0x46')]({},_0x12c015,_0x1c24be['options']);return _0x5b642f[_0x4b30('0x6d')](_0x12c015);}})[_0x4b30('0x29')](respondWithResult(_0x46a1c3,null))[_0x4b30('0x4c')](handleError(_0x46a1c3,null));};exports[_0x4b30('0x73')]=function(_0x5bb837,_0x6fdc3a,_0x1e0680){var _0x5d9647;var _0x3c43ab;var _0x4c6b24;var _0x143446=_0x5bb837[_0x4b30('0x4e')]['id'];csv_results=[];return db['ContactItemType'][_0x4b30('0x4a')]({'attributes':['id',_0x4b30('0x2f')],'raw':!![],'order':[_0x4b30('0x74')]})[_0x4b30('0x29')](function(_0x36506f){_0x5d9647=_0x36506f;var _0x242fca=_[_0x4b30('0x39')](db['CmContact']['rawAttributes']);return db[_0x4b30('0x75')][_0x4b30('0x4a')]({'raw':!![],'attributes':['id',_0x4b30('0x76')]})['then'](function(_0x5c66a9){_0x3c43ab=_0x5c66a9;var _0x43bf5a=squel[_0x4b30('0x77')]()['fields'](_0x242fca)[_0x4b30('0x78')]('cm_contacts','c')[_0x4b30('0x43')](_0x4b30('0x79'),_0x143446)['where'](_0x4b30('0x7a'))['distinct']();for(var _0x15d9eb=0x0;_0x15d9eb<_0x3c43ab[_0x4b30('0x3e')];_0x15d9eb++){_0x43bf5a[_0x4b30('0x7b')](_0x4b30('0x7c')+_0x3c43ab[_0x15d9eb]['id'],_0x4b30('0x7d')+_0x3c43ab[_0x15d9eb][_0x4b30('0x76')]);}for(var _0x15d9eb=0x0;_0x15d9eb<_0x5d9647['length'];_0x15d9eb++){_0x43bf5a[_0x4b30('0x7b')](squel[_0x4b30('0x77')]()['field'](_0x4b30('0x7e'))['from'](_0x4b30('0x7f'))['where'](_0x4b30('0x80'),_0x5d9647[_0x15d9eb]['id'])[_0x4b30('0x43')]('CmContactId\x20=\x20c.id'),_0x4b30('0x81')+_0x5d9647[_0x15d9eb]['name']);_0x43bf5a[_0x4b30('0x7b')](squel[_0x4b30('0x77')]()[_0x4b30('0x7b')](_0x4b30('0x82'))[_0x4b30('0x78')]('cm_contact_has_items')[_0x4b30('0x43')](_0x4b30('0x80'),_0x5d9647[_0x15d9eb]['id'])[_0x4b30('0x43')](_0x4b30('0x83')),'description_additionalPhone_'+_0x5d9647[_0x15d9eb][_0x4b30('0x2f')]);}var _0x428c01=[];_0x428c01['push'](_0x43bf5a[_0x4b30('0x84')]());BPromise['each'](_0x428c01,handleQuery)['then'](function(_0x5736c2){handleQuery(_0x43bf5a[_0x4b30('0x84')]());var _0x217593=csv_results[0x0];if(!_['isEmpty'](_0x217593)){var _0x180af1=toCsv(_0x217593);var _0x3058b0=Date[_0x4b30('0x85')]();fs[_0x4b30('0x86')](util[_0x4b30('0x70')](_0x4b30('0x87'),_0x143446,_0x3058b0),_0x180af1);_0x6fdc3a[_0x4b30('0x88')](_0x4b30('0x89'),_0x4b30('0x8a')+util[_0x4b30('0x70')](_0x4b30('0x8b'),_0x143446,_0x3058b0));_0x6fdc3a[_0x4b30('0x88')](_0x4b30('0x8c'),_0x4b30('0x8d'));return _0x6fdc3a[_0x4b30('0x8e')](util['format'](_0x4b30('0x87'),_0x143446,_0x3058b0));}else{return _0x6fdc3a[_0x4b30('0x1d')](0xcc);}});});});};exports[_0x4b30('0x8f')]=function(_0x18294c,_0x554bec,_0x31277b){var _0x43dde2;delete _0x18294c[_0x4b30('0x52')]['id'];return db['CmList']['findOne']({'where':{'id':_0x18294c[_0x4b30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x554bec,null))[_0x4b30('0x29')](function(_0x9da596){if(_0x9da596){return db[_0x4b30('0x90')][_0x4b30('0x91')](function(_0x17a74a){return db[_0x4b30('0x75')][_0x4b30('0x51')](_0x18294c['body'],{'transaction':_0x17a74a})[_0x4b30('0x29')](function(_0x2299ef){_0x43dde2=_0x2299ef;return _0x9da596[_0x4b30('0x92')](_0x2299ef,{'transaction':_0x17a74a});})['then'](function(){var _0x4e0d96={'type':db['Sequelize']['TEXT'],'transaction':_0x17a74a};switch(_0x18294c[_0x4b30('0x52')][_0x4b30('0x35')]){case _0x4b30('0x93'):_0x4e0d96[_0x4b30('0x35')]=db[_0x4b30('0x94')][_0x4b30('0x95')];break;case _0x4b30('0x96'):_0x4e0d96[_0x4b30('0x35')]=db[_0x4b30('0x94')][_0x4b30('0x97')];break;case _0x4b30('0x98'):_0x4e0d96[_0x4b30('0x35')]=db['Sequelize']['BOOLEAN'];_0x4e0d96[_0x4b30('0x99')]=![];break;default:}return db[_0x4b30('0x90')][_0x4b30('0x9a')][_0x4b30('0x9b')](_0x4b30('0x9c'),util['format'](_0x4b30('0x9d'),_0x43dde2['id']),_0x4e0d96);})[_0x4b30('0x29')](function(){return _0x43dde2;});});}})[_0x4b30('0x29')](respondWithResult(_0x554bec,null))[_0x4b30('0x4c')](handleError(_0x554bec,null));};exports['getCustomFields']=function(_0x5eb40d,_0xa29a36,_0x5f4b0c){var _0x4e2166={};var _0x240df2={};var _0xf97e3d;var _0x237392;return db[_0x4b30('0x33')][_0x4b30('0x5d')]({'where':{'id':_0x5eb40d['params']['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0xa29a36,null))[_0x4b30('0x29')](function(_0x2c115d){if(_0x2c115d){_0xf97e3d=_0x2c115d;_0x240df2[_0x4b30('0x37')]=_['keys'](db[_0x4b30('0x75')][_0x4b30('0x4f')]);_0x240df2[_0x4b30('0x38')]=_[_0x4b30('0x39')](_0x5eb40d[_0x4b30('0x38')]);_0x240df2[_0x4b30('0x3a')]=_['intersection'](_0x240df2[_0x4b30('0x37')],_0x240df2[_0x4b30('0x38')]);_0x4e2166[_0x4b30('0x3c')]=_[_0x4b30('0x3b')](_0x240df2[_0x4b30('0x37')],qs['fields'](_0x5eb40d[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x4e2166[_0x4b30('0x3c')]=_0x4e2166['attributes'][_0x4b30('0x3e')]?_0x4e2166[_0x4b30('0x3c')]:_0x240df2['model'];_0x4e2166[_0x4b30('0x41')]=qs[_0x4b30('0x42')](_0x5eb40d[_0x4b30('0x38')][_0x4b30('0x42')]);_0x4e2166[_0x4b30('0x43')]=qs[_0x4b30('0x3a')](_[_0x4b30('0x5f')](_0x5eb40d[_0x4b30('0x38')],_0x240df2[_0x4b30('0x3a')]));_0x4e2166[_0x4b30('0x43')]=_['merge'](_0x4e2166[_0x4b30('0x43')],{'$or':[{'ListId':_0x2c115d['id']},{'ListId':null}]});if(_0x5eb40d[_0x4b30('0x38')]['filter']){_0x4e2166[_0x4b30('0x43')]=_[_0x4b30('0x46')](_0x4e2166[_0x4b30('0x43')],{'$or':_[_0x4b30('0x32')](_0x4e2166[_0x4b30('0x3c')],function(_0x32c314){var _0x49a16b={};_0x49a16b[_0x32c314]={'$like':'%'+_0x5eb40d[_0x4b30('0x38')][_0x4b30('0x44')]+'%'};return _0x49a16b;})});}_0x4e2166=_[_0x4b30('0x46')]({},_0x4e2166,_0x5eb40d[_0x4b30('0x47')]);return db['CmCustomField']['findAndCountAll'](_0x4e2166);}})[_0x4b30('0x29')](respondWithResult(_0xa29a36,null))['catch'](handleError(_0xa29a36,null));};exports[_0x4b30('0x9e')]=function(_0x5aa1b5,_0x3d3bdd){return db[_0x4b30('0x75')][_0x4b30('0x9f')]({'where':{'ListId':null}})[_0x4b30('0x29')](handleEntityNotFound(_0x3d3bdd,null))[_0x4b30('0x29')](function(_0x234310){return _0x234310;})[_0x4b30('0x29')](respondWithResult(_0x3d3bdd,null))['catch'](handleError(_0x3d3bdd,null));};exports['addAgents']=function(_0xf8b923,_0x2219b2,_0x50b9b6){return db['CmList'][_0x4b30('0x50')]({'where':{'id':_0xf8b923[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x2219b2,null))[_0x4b30('0x29')](function(_0x576eef){if(_0x576eef){return _0x576eef[_0x4b30('0xa0')](_0xf8b923[_0x4b30('0x52')]['ids'],_[_0x4b30('0x67')](_0xf8b923[_0x4b30('0x52')],[_0x4b30('0xa1'),'id'])||{})['spread'](function(_0x27824c){for(var _0x50f9b6=0x0;_0x50f9b6<_0xf8b923['body']['ids'][_0x4b30('0x3e')];_0x50f9b6+=0x1){socket[_0x4b30('0xa2')](_0x4b30('0xa3'),{'UserId':Number(_0xf8b923['body'][_0x4b30('0xa1')][_0x50f9b6]),'CmListId':Number(_0xf8b923[_0x4b30('0x4e')]['id'])});}return _0x27824c;});}})[_0x4b30('0x29')](respondWithResult(_0x2219b2,null))['catch'](handleError(_0x2219b2,null));};exports['removeAgents']=function(_0x41cfc2,_0x1f93f7,_0x1e227c){return db[_0x4b30('0x33')][_0x4b30('0x50')]({'where':{'id':_0x41cfc2[_0x4b30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1f93f7,null))[_0x4b30('0x29')](function(_0x38179b){if(_0x38179b){return _0x38179b[_0x4b30('0xa4')](_0x41cfc2[_0x4b30('0x38')][_0x4b30('0xa1')])[_0x4b30('0x29')](function(){if(_[_0x4b30('0x62')](_0x41cfc2[_0x4b30('0x38')]['ids'])){for(var _0x180460=0x0;_0x180460<_0x41cfc2[_0x4b30('0x38')][_0x4b30('0xa1')][_0x4b30('0x3e')];_0x180460+=0x1){socket['emit'](_0x4b30('0xa5'),{'UserId':Number(_0x41cfc2[_0x4b30('0x38')][_0x4b30('0xa1')][_0x180460]),'CmListId':Number(_0x41cfc2[_0x4b30('0x4e')]['id'])});}}else{socket[_0x4b30('0xa2')](_0x4b30('0xa5'),{'UserId':Number(_0x41cfc2[_0x4b30('0x38')][_0x4b30('0xa1')]),'CmListId':Number(_0x41cfc2[_0x4b30('0x4e')]['id'])});}});}})[_0x4b30('0x29')](respondWithStatusCode(_0x1f93f7,null))['catch'](handleError(_0x1f93f7,null));};exports[_0x4b30('0xa6')]=function(_0x1fb803,_0x347fdf,_0x390ae8){var _0x152d90={};var _0x3db0f8={};var _0x316971;var _0x42fab8;return db[_0x4b30('0x33')][_0x4b30('0x5d')]({'where':{'id':_0x1fb803[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x347fdf,null))['then'](function(_0x23ccfd){if(_0x23ccfd){_0x316971=_0x23ccfd;_0x3db0f8[_0x4b30('0x37')]=_[_0x4b30('0x39')](db[_0x4b30('0xa7')]['rawAttributes']);_0x3db0f8[_0x4b30('0x38')]=_[_0x4b30('0x39')](_0x1fb803[_0x4b30('0x38')]);_0x3db0f8[_0x4b30('0x3a')]=_[_0x4b30('0x3b')](_0x3db0f8['model'],_0x3db0f8[_0x4b30('0x38')]);_0x152d90[_0x4b30('0x3c')]=_[_0x4b30('0x3b')](_0x3db0f8[_0x4b30('0x37')],qs[_0x4b30('0x3d')](_0x1fb803[_0x4b30('0x38')]['fields']));_0x152d90[_0x4b30('0x3c')]=_0x152d90[_0x4b30('0x3c')]['length']?_0x152d90['attributes']:_0x3db0f8[_0x4b30('0x37')];_0x152d90['order']=qs['sort'](_0x1fb803[_0x4b30('0x38')][_0x4b30('0x42')]);_0x152d90[_0x4b30('0x43')]=qs[_0x4b30('0x3a')](_[_0x4b30('0x5f')](_0x1fb803[_0x4b30('0x38')],_0x3db0f8[_0x4b30('0x3a')]));if(_0x1fb803[_0x4b30('0x38')][_0x4b30('0x44')]){_0x152d90[_0x4b30('0x43')]=_[_0x4b30('0x46')](_0x152d90[_0x4b30('0x43')],{'$or':_['map'](_0x152d90[_0x4b30('0x3c')],function(_0x1a28c8){var _0x4d594d={};_0x4d594d[_0x1a28c8]={'$like':'%'+_0x1fb803[_0x4b30('0x38')]['filter']+'%'};return _0x4d594d;})});}_0x152d90=_[_0x4b30('0x46')]({},_0x152d90,_0x1fb803[_0x4b30('0x47')]);return _0x316971[_0x4b30('0xa6')](_0x152d90);}})['then'](function(_0x2a9c33){if(_0x2a9c33){_0x42fab8=_0x2a9c33[_0x4b30('0x3e')];if(!_0x1fb803['query'][_0x4b30('0x3f')](_0x4b30('0x40'))){_0x152d90[_0x4b30('0x20')]=qs[_0x4b30('0x20')](_0x1fb803[_0x4b30('0x38')][_0x4b30('0x20')]);_0x152d90[_0x4b30('0x23')]=qs[_0x4b30('0x23')](_0x1fb803[_0x4b30('0x38')][_0x4b30('0x23')]);}return _0x316971[_0x4b30('0xa6')](_0x152d90);}})['then'](function(_0x237785){if(_0x237785){return _0x237785?{'count':_0x42fab8,'rows':_0x237785}:null;}})[_0x4b30('0x29')](respondWithResult(_0x347fdf,null))['catch'](handleError(_0x347fdf,null));};function handleQuery(_0x6bcd6e){logger[_0x4b30('0xa8')](_0x6bcd6e);return db[_0x4b30('0x90')]['query'](_0x6bcd6e)['spread'](function(_0x3d3bda){csv_results['push'](_0x3d3bda);})[_0x4b30('0x4c')](function(_0x5afef0){logger['error'](_0x5afef0[_0x4b30('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index b0fa0b1..3549566 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x5fc3[_0x3ff085];return _0x2b68c3;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x5fc3,0xa8));var _0x35fc=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x5fc3[_0x59d0cc];return _0x2ae79f;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 68c1e62..6a209e2 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 _0x5b02=['define','CmList','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x230489,_0x320811){var _0x414f3d=function(_0x42c9e9){while(--_0x42c9e9){_0x230489['push'](_0x230489['shift']());}};_0x414f3d(++_0x320811);}(_0x5b02,0xe9));var _0x25b0=function(_0x2ad185,_0x27cdff){_0x2ad185=_0x2ad185-0x0;var _0x3b5164=_0x5b02[_0x2ad185];return _0x3b5164;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'cm_lists','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(_0x24b61e,_0x20ce95){var _0x1ea8e8=function(_0x519c55){while(--_0x519c55){_0x24b61e['push'](_0x24b61e['shift']());}};_0x1ea8e8(++_0x20ce95);}(_0x22fb,0x192));var _0xb22f=function(_0x6c5282,_0x570f88){_0x6c5282=_0x6c5282-0x0;var _0x524093=_0x22fb[_0x6c5282];return _0x524093;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index fd0edfa..d1bf54c 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 _0xcd6c=['client','http','redis','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd6c,0x119));var _0xccd6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcd6c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xccd6('0x0'));var moment=require(_0xccd6('0x1'));var BPromise=require('bluebird');var rs=require(_0xccd6('0x2'));var fs=require('fs');var Redis=require(_0xccd6('0x3'));var db=require(_0xccd6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xccd6('0x5'));var jayson=require(_0xccd6('0x6'));var client=jayson[_0xccd6('0x7')][_0xccd6('0x8')]({'port':0x232a});config[_0xccd6('0x9')]=_['defaults'](config[_0xccd6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xccd6('0xa'))(new Redis(config[_0xccd6('0x9')]));require(_0xccd6('0xb'))['register'](socket);function respondWithRpcPromise(_0x245928,_0x3365e4,_0x1bb510){return new BPromise(function(_0x450053,_0x5319c8){return client[_0xccd6('0xc')](_0x245928,_0x1bb510)[_0xccd6('0xd')](function(_0x2aa81){logger[_0xccd6('0xe')](_0xccd6('0xf'),_0x3365e4,_0xccd6('0x10'));logger[_0xccd6('0x11')](_0xccd6('0x12'),_0x3365e4,_0xccd6('0x10'),JSON[_0xccd6('0x13')](_0x2aa81));if(_0x2aa81['error']){if(_0x2aa81['error']['code']===0x1f4){logger[_0xccd6('0x14')](_0xccd6('0xf'),_0x3365e4,_0x2aa81[_0xccd6('0x14')]['message']);return _0x5319c8(_0x2aa81['error'][_0xccd6('0x15')]);}logger[_0xccd6('0x14')](_0xccd6('0xf'),_0x3365e4,_0x2aa81[_0xccd6('0x14')][_0xccd6('0x15')]);return _0x450053(_0x2aa81[_0xccd6('0x14')][_0xccd6('0x15')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x3365e4,_0xccd6('0x10'));_0x450053(_0x2aa81[_0xccd6('0x16')]['message']);}})[_0xccd6('0x17')](function(_0x4e42e3){logger['error'](_0xccd6('0xf'),_0x3365e4,_0x4e42e3);_0x5319c8(_0x4e42e3);});});} \ No newline at end of file +var _0xb095=['debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CmList,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info'];(function(_0x3dca5f,_0x50e36b){var _0x271423=function(_0x164b80){while(--_0x164b80){_0x3dca5f['push'](_0x3dca5f['shift']());}};_0x271423(++_0x50e36b);}(_0xb095,0xcc));var _0x5b09=function(_0x3e6ad1,_0x483e6e){_0x3e6ad1=_0x3e6ad1-0x0;var _0x289e9a=_0xb095[_0x3e6ad1];return _0x289e9a;};'use strict';var _=require(_0x5b09('0x0'));var util=require(_0x5b09('0x1'));var moment=require(_0x5b09('0x2'));var BPromise=require('bluebird');var rs=require(_0x5b09('0x3'));var fs=require('fs');var Redis=require(_0x5b09('0x4'));var db=require(_0x5b09('0x5'))['db'];var utils=require(_0x5b09('0x6'));var logger=require(_0x5b09('0x7'))('rpc');var config=require(_0x5b09('0x8'));var jayson=require(_0x5b09('0x9'));var client=jayson['client'][_0x5b09('0xa')]({'port':0x232a});config[_0x5b09('0xb')]=_[_0x5b09('0xc')](config[_0x5b09('0xb')],{'host':_0x5b09('0xd'),'port':0x18eb});var socket=require(_0x5b09('0xe'))(new Redis(config[_0x5b09('0xb')]));require(_0x5b09('0xf'))[_0x5b09('0x10')](socket);function respondWithRpcPromise(_0x20d63f,_0x265942,_0x3ddba3){return new BPromise(function(_0x36ce23,_0x1ba1d5){return client[_0x5b09('0x11')](_0x20d63f,_0x3ddba3)[_0x5b09('0x12')](function(_0xdf86ce){logger[_0x5b09('0x13')]('CmList,\x20%s,\x20%s',_0x265942,'request\x20sent');logger[_0x5b09('0x14')](_0x5b09('0x15'),_0x265942,_0x5b09('0x16'),JSON['stringify'](_0xdf86ce));if(_0xdf86ce[_0x5b09('0x17')]){if(_0xdf86ce[_0x5b09('0x17')][_0x5b09('0x18')]===0x1f4){logger[_0x5b09('0x17')]('CmList,\x20%s,\x20%s',_0x265942,_0xdf86ce[_0x5b09('0x17')][_0x5b09('0x19')]);return _0x1ba1d5(_0xdf86ce[_0x5b09('0x17')][_0x5b09('0x19')]);}logger[_0x5b09('0x17')]('CmList,\x20%s,\x20%s',_0x265942,_0xdf86ce['error'][_0x5b09('0x19')]);return _0x36ce23(_0xdf86ce['error']['message']);}else{logger[_0x5b09('0x13')](_0x5b09('0x1a'),_0x265942,_0x5b09('0x16'));_0x36ce23(_0xdf86ce['result'][_0x5b09('0x19')]);}})[_0x5b09('0x1b')](function(_0x32e81c){logger[_0x5b09('0x17')](_0x5b09('0x1a'),_0x265942,_0x32e81c);_0x1ba1d5(_0x32e81c);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4eb9cb2..3b3c6a8 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 _0x55e8=['emit','removeListener','register','length','cmList:','update'];(function(_0x4655f1,_0x41821d){var _0x4ba294=function(_0x2c2f78){while(--_0x2c2f78){_0x4655f1['push'](_0x4655f1['shift']());}};_0x4ba294(++_0x41821d);}(_0x55e8,0xe9));var _0x855e=function(_0x5c4bdb,_0x17668e){_0x5c4bdb=_0x5c4bdb-0x0;var _0x2b3bd3=_0x55e8[_0x5c4bdb];return _0x2b3bd3;};'use strict';var CmListEvents=require('./cmList.events');var events=['save','remove',_0x855e('0x0')];function createListener(_0x252f25,_0x2d564e){return function(_0x3d1022){_0x2d564e[_0x855e('0x1')](_0x252f25,_0x3d1022);};}function removeListener(_0x3e8802,_0x4d590f){return function(){CmListEvents[_0x855e('0x2')](_0x3e8802,_0x4d590f);};}exports[_0x855e('0x3')]=function(_0x5b9fd3){for(var _0x1fcf5a=0x0,_0x1b47e5=events[_0x855e('0x4')];_0x1fcf5a<_0x1b47e5;_0x1fcf5a++){var _0x54d208=events[_0x1fcf5a];var _0x744bb6=createListener(_0x855e('0x5')+_0x54d208,_0x5b9fd3);CmListEvents['on'](_0x54d208,_0x744bb6);}}; \ No newline at end of file +var _0x4af9=['./cmList.events','save','remove','update','emit','removeListener','register','length'];(function(_0x54d91f,_0x4d32c4){var _0x8b3ca=function(_0x1a5dc3){while(--_0x1a5dc3){_0x54d91f['push'](_0x54d91f['shift']());}};_0x8b3ca(++_0x4d32c4);}(_0x4af9,0x188));var _0x94af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4af9[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require(_0x94af('0x0'));var events=[_0x94af('0x1'),_0x94af('0x2'),_0x94af('0x3')];function createListener(_0x3c1c25,_0x5f7f66){return function(_0x5576e9){_0x5f7f66[_0x94af('0x4')](_0x3c1c25,_0x5576e9);};}function removeListener(_0x5c32c1,_0x2dc43c){return function(){CmListEvents[_0x94af('0x5')](_0x5c32c1,_0x2dc43c);};}exports[_0x94af('0x6')]=function(_0x7eebde){for(var _0x10e81e=0x0,_0x4463cf=events[_0x94af('0x7')];_0x10e81e<_0x4463cf;_0x10e81e++){var _0x2b0994=events[_0x10e81e];var _0x5e9197=createListener('cmList:'+_0x2b0994,_0x7eebde);CmListEvents['on'](_0x2b0994,_0x5e9197);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d7d3363..746d1da 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 _0xfcee=['getAgents','post','create','addDisposition','addContacts','/:id/fields','addCustomField','/:id','update','delete','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xfcee,0x160));var _0xefce=function(_0xb9e33f,_0x47aef9){_0xb9e33f=_0xb9e33f-0x0;var _0x43572b=_0xfcee[_0xb9e33f];return _0x43572b;};'use strict';var multer=require(_0xefce('0x0'));var util=require('util');var path=require(_0xefce('0x1'));var timeout=require('connect-timeout');var express=require(_0xefce('0x2'));var router=express[_0xefce('0x3')]();var fs_extra=require(_0xefce('0x4'));var auth=require(_0xefce('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xefce('0x6'));var controller=require(_0xefce('0x7'));router[_0xefce('0x8')]('/',auth[_0xefce('0x9')](),controller[_0xefce('0xa')]);router[_0xefce('0x8')](_0xefce('0xb'),auth['isAuthenticated'](),controller[_0xefce('0xc')]);router[_0xefce('0x8')](_0xefce('0xd'),auth[_0xefce('0x9')](),controller['getGlobalCustomFields']);router[_0xefce('0x8')]('/:id',auth[_0xefce('0x9')](),controller[_0xefce('0xe')]);router[_0xefce('0x8')](_0xefce('0xf'),auth[_0xefce('0x9')](),controller[_0xefce('0x10')]);router[_0xefce('0x8')](_0xefce('0x11'),auth[_0xefce('0x9')](),controller[_0xefce('0x12')]);router['get'](_0xefce('0x13'),auth[_0xefce('0x9')](),controller[_0xefce('0x14')]);router[_0xefce('0x8')]('/:id/fields',auth[_0xefce('0x9')](),controller['getCustomFields']);router[_0xefce('0x8')](_0xefce('0x15'),auth[_0xefce('0x9')](),controller[_0xefce('0x16')]);router[_0xefce('0x17')]('/',auth[_0xefce('0x9')](),controller[_0xefce('0x18')]);router[_0xefce('0x17')](_0xefce('0xf'),auth[_0xefce('0x9')](),controller[_0xefce('0x19')]);router[_0xefce('0x17')](_0xefce('0x11'),auth[_0xefce('0x9')](),controller[_0xefce('0x1a')]);router[_0xefce('0x17')](_0xefce('0x1b'),auth[_0xefce('0x9')](),controller[_0xefce('0x1c')]);router[_0xefce('0x17')](_0xefce('0x15'),auth[_0xefce('0x9')](),controller['addAgents']);router['put'](_0xefce('0x1d'),auth[_0xefce('0x9')](),controller[_0xefce('0x1e')]);router[_0xefce('0x1f')](_0xefce('0x1d'),auth[_0xefce('0x9')](),controller['destroy']);router[_0xefce('0x1f')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xefce('0x1f')](_0xefce('0x15'),auth['isAuthenticated'](),controller[_0xefce('0x20')]);module[_0xefce('0x21')]=router; \ No newline at end of file +var _0x634d=['/describe','isAuthenticated','describe','getGlobalCustomFields','/:id','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index'];(function(_0x2acae7,_0x49d89c){var _0x2be409=function(_0x59407a){while(--_0x59407a){_0x2acae7['push'](_0x2acae7['shift']());}};_0x2be409(++_0x49d89c);}(_0x634d,0x120));var _0xd634=function(_0x1467bc,_0x452b04){_0x1467bc=_0x1467bc-0x0;var _0x44f841=_0x634d[_0x1467bc];return _0x44f841;};'use strict';var multer=require(_0xd634('0x0'));var util=require(_0xd634('0x1'));var path=require(_0xd634('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd634('0x3'));var auth=require(_0xd634('0x4'));var interaction=require(_0xd634('0x5'));var config=require('../../config/environment');var controller=require(_0xd634('0x6'));router[_0xd634('0x7')]('/',auth['isAuthenticated'](),controller[_0xd634('0x8')]);router[_0xd634('0x7')](_0xd634('0x9'),auth[_0xd634('0xa')](),controller[_0xd634('0xb')]);router[_0xd634('0x7')]('/global_fields',auth[_0xd634('0xa')](),controller[_0xd634('0xc')]);router['get'](_0xd634('0xd'),auth[_0xd634('0xa')](),controller['show']);router[_0xd634('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xd634('0x7')](_0xd634('0xe'),auth[_0xd634('0xa')](),controller['getContacts']);router['get'](_0xd634('0xf'),auth[_0xd634('0xa')](),controller[_0xd634('0x10')]);router['get'](_0xd634('0x11'),auth[_0xd634('0xa')](),controller[_0xd634('0x12')]);router[_0xd634('0x7')](_0xd634('0x13'),auth[_0xd634('0xa')](),controller[_0xd634('0x14')]);router[_0xd634('0x15')]('/',auth[_0xd634('0xa')](),controller['create']);router[_0xd634('0x15')](_0xd634('0x16'),auth[_0xd634('0xa')](),controller[_0xd634('0x17')]);router[_0xd634('0x15')](_0xd634('0xe'),auth[_0xd634('0xa')](),controller[_0xd634('0x18')]);router[_0xd634('0x15')](_0xd634('0x11'),auth['isAuthenticated'](),controller[_0xd634('0x19')]);router[_0xd634('0x15')](_0xd634('0x13'),auth[_0xd634('0xa')](),controller[_0xd634('0x1a')]);router[_0xd634('0x1b')](_0xd634('0xd'),auth[_0xd634('0xa')](),controller[_0xd634('0x1c')]);router[_0xd634('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xd634('0x1e')]);router[_0xd634('0x1d')](_0xd634('0x16'),auth['isAuthenticated'](),controller[_0xd634('0x1f')]);router[_0xd634('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0xd634('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a971e0d..055813c 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 _0xb6ca=['field','STRING','exports','VIRTUAL'];(function(_0x57f878,_0x4200ad){var _0x431868=function(_0xde6a64){while(--_0xde6a64){_0x57f878['push'](_0x57f878['shift']());}};_0x431868(++_0x4200ad);}(_0xb6ca,0xea));var _0xab6c=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb6ca[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');module[_0xab6c('0x0')]={'name':{'type':Sequelize[_0xab6c('0x1')],'get':function(_0x627daf){return this['getDataValue'](_0xab6c('0x2'));}},'field':{'type':Sequelize[_0xab6c('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xab6c('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x5b61=['STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x478f5c,_0x3faee9){var _0xb4eabb=function(_0xc30d14){while(--_0xc30d14){_0x478f5c['push'](_0x478f5c['shift']());}};_0xb4eabb(++_0x3faee9);}(_0x5b61,0x145));var _0x15b6=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x5b61[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require(_0x15b6('0x0'));module['exports']={'name':{'type':Sequelize[_0x15b6('0x1')],'get':function(_0x417bb9){return this[_0x15b6('0x2')]('field');}},'field':{'type':Sequelize[_0x15b6('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x15b6('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x15b6('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0def511..324071d 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x214003,_0x5c1ef3){var _0x585d22=function(_0x354a51){while(--_0x354a51){_0x214003['push'](_0x214003['shift']());}};_0x585d22(++_0x5c1ef3);}(_0x7a54,0x106));var _0x47a5=function(_0x340cd3,_0x2d75b8){_0x340cd3=_0x340cd3-0x0;var _0x444aa9=_0x7a54[_0x340cd3];return _0x444aa9;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x352004,_0x437119){var _0x33e56a=function(_0x4fb831){while(--_0x4fb831){_0x352004['push'](_0x352004['shift']());}};_0x33e56a(++_0x437119);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index ef1849b..99ed936 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 _0x23a0=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash','util'];(function(_0x415894,_0x835797){var _0x475cad=function(_0x5326f8){while(--_0x5326f8){_0x415894['push'](_0x415894['shift']());}};_0x475cad(++_0x835797);}(_0x23a0,0x143));var _0x023a=function(_0x44454f,_0x4bfbe8){_0x44454f=_0x44454f-0x0;var _0x475150=_0x23a0[_0x44454f];return _0x475150;};'use strict';var _=require(_0x023a('0x0'));var util=require(_0x023a('0x1'));var logger=require(_0x023a('0x2'))(_0x023a('0x3'));var moment=require(_0x023a('0x4'));var BPromise=require(_0x023a('0x5'));var rp=require(_0x023a('0x6'));var fs=require('fs');var path=require(_0x023a('0x7'));var rimraf=require('rimraf');var config=require(_0x023a('0x8'));var attributes=require(_0x023a('0x9'));module[_0x023a('0xa')]=function(_0x21c98e,_0x47a9c2){return _0x21c98e['define'](_0x023a('0xb'),attributes,{'tableName':_0x023a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe690=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util'];(function(_0x5668f4,_0x19c70b){var _0x439229=function(_0x360af3){while(--_0x360af3){_0x5668f4['push'](_0x5668f4['shift']());}};_0x439229(++_0x19c70b);}(_0xe690,0x15b));var _0x0e69=function(_0x356ec3,_0xbaffd2){_0x356ec3=_0x356ec3-0x0;var _0x539694=_0xe690[_0x356ec3];return _0x539694;};'use strict';var _=require('lodash');var util=require(_0x0e69('0x0'));var logger=require(_0x0e69('0x1'))(_0x0e69('0x2'));var moment=require(_0x0e69('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e69('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e69('0x5'));var config=require(_0x0e69('0x6'));var attributes=require(_0x0e69('0x7'));module[_0x0e69('0x8')]=function(_0x296d39,_0x472a59){return _0x296d39[_0x0e69('0x9')](_0x0e69('0xa'),attributes,{'tableName':_0x0e69('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 51b52df..f512c84 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 _0xa39a=['rpc','../../config/environment','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x3f5a50,_0x37ba35){var _0x302147=function(_0x28f9a){while(--_0x28f9a){_0x3f5a50['push'](_0x3f5a50['shift']());}};_0x302147(++_0x37ba35);}(_0xa39a,0x162));var _0xaa39=function(_0x47ef1c,_0x346649){_0x47ef1c=_0x47ef1c-0x0;var _0x176f31=_0xa39a[_0x47ef1c];return _0x176f31;};'use strict';var _=require(_0xaa39('0x0'));var util=require(_0xaa39('0x1'));var moment=require(_0xaa39('0x2'));var BPromise=require(_0xaa39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa39('0x4'));var db=require(_0xaa39('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa39('0x6'))(_0xaa39('0x7'));var config=require(_0xaa39('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaa39('0x9')][_0xaa39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x89c3a7,_0x479d5f,_0x393111){return new BPromise(function(_0x3a7a44,_0x1f9d91){return client['request'](_0x89c3a7,_0x393111)[_0xaa39('0xb')](function(_0x38a8b0){logger[_0xaa39('0xc')](_0xaa39('0xd'),_0x479d5f,'request\x20sent');logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x479d5f,_0xaa39('0xe'),JSON['stringify'](_0x38a8b0));if(_0x38a8b0[_0xaa39('0xf')]){if(_0x38a8b0[_0xaa39('0xf')]['code']===0x1f4){logger['error'](_0xaa39('0xd'),_0x479d5f,_0x38a8b0[_0xaa39('0xf')][_0xaa39('0x10')]);return _0x1f9d91(_0x38a8b0[_0xaa39('0xf')][_0xaa39('0x10')]);}logger[_0xaa39('0xf')](_0xaa39('0xd'),_0x479d5f,_0x38a8b0[_0xaa39('0xf')]['message']);return _0x3a7a44(_0x38a8b0[_0xaa39('0xf')][_0xaa39('0x10')]);}else{logger[_0xaa39('0xc')](_0xaa39('0xd'),_0x479d5f,_0xaa39('0xe'));_0x3a7a44(_0x38a8b0[_0xaa39('0x11')][_0xaa39('0x10')]);}})[_0xaa39('0x12')](function(_0x146ce8){logger[_0xaa39('0xf')](_0xaa39('0xd'),_0x479d5f,_0x146ce8);_0x1f9d91(_0x146ce8);});});} \ No newline at end of file +var _0x5a57=['info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then'];(function(_0x3fad0d,_0x1c123b){var _0x5b003e=function(_0xf9c02f){while(--_0xf9c02f){_0x3fad0d['push'](_0x3fad0d['shift']());}};_0x5b003e(++_0x1c123b);}(_0x5a57,0x14b));var _0x75a5=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0x5a57[_0x3c858f];return _0x198090;};'use strict';var _=require(_0x75a5('0x0'));var util=require('util');var moment=require(_0x75a5('0x1'));var BPromise=require(_0x75a5('0x2'));var rs=require(_0x75a5('0x3'));var fs=require('fs');var Redis=require(_0x75a5('0x4'));var db=require(_0x75a5('0x5'))['db'];var utils=require(_0x75a5('0x6'));var logger=require('../../config/logger')(_0x75a5('0x7'));var config=require(_0x75a5('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55e5fc,_0x28ade6,_0x451b34){return new BPromise(function(_0x5871ba,_0x101c14){return client[_0x75a5('0x9')](_0x55e5fc,_0x451b34)[_0x75a5('0xa')](function(_0x206646){logger[_0x75a5('0xb')](_0x75a5('0xc'),_0x28ade6,'request\x20sent');logger[_0x75a5('0xd')](_0x75a5('0xe'),_0x28ade6,_0x75a5('0xf'),JSON['stringify'](_0x206646));if(_0x206646['error']){if(_0x206646[_0x75a5('0x10')][_0x75a5('0x11')]===0x1f4){logger[_0x75a5('0x10')]('Condition,\x20%s,\x20%s',_0x28ade6,_0x206646['error'][_0x75a5('0x12')]);return _0x101c14(_0x206646[_0x75a5('0x10')][_0x75a5('0x12')]);}logger[_0x75a5('0x10')](_0x75a5('0xc'),_0x28ade6,_0x206646[_0x75a5('0x10')][_0x75a5('0x12')]);return _0x5871ba(_0x206646['error'][_0x75a5('0x12')]);}else{logger[_0x75a5('0xb')](_0x75a5('0xc'),_0x28ade6,_0x75a5('0xf'));_0x5871ba(_0x206646['result'][_0x75a5('0x12')]);}})['catch'](function(_0x154d50){logger[_0x75a5('0x10')](_0x75a5('0xc'),_0x28ade6,_0x154d50);_0x101c14(_0x154d50);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3fc585d..82dd85c 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 _0x198c=['./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x198c,0x19c));var _0xc198=function(_0x24d80d,_0x2f7a65){_0x24d80d=_0x24d80d-0x0;var _0x151ea7=_0x198c[_0x24d80d];return _0x151ea7;};'use strict';var multer=require(_0xc198('0x0'));var util=require('util');var path=require(_0xc198('0x1'));var timeout=require(_0xc198('0x2'));var express=require(_0xc198('0x3'));var router=express[_0xc198('0x4')]();var fs_extra=require(_0xc198('0x5'));var auth=require(_0xc198('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc198('0x7'));var controller=require(_0xc198('0x8'));router[_0xc198('0x9')](_0xc198('0xa'),auth[_0xc198('0xb')](),controller[_0xc198('0xc')]);router[_0xc198('0xd')](_0xc198('0xa'),auth[_0xc198('0xb')](),controller['destroy']);module[_0xc198('0xe')]=router; \ No newline at end of file +var _0x82d1=['/:id','update','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x12a626,_0x244ddb){var _0x237a12=function(_0xd0aa0d){while(--_0xd0aa0d){_0x12a626['push'](_0x12a626['shift']());}};_0x237a12(++_0x244ddb);}(_0x82d1,0x1c6));var _0x182d=function(_0x3e08b0,_0x1c95d5){_0x3e08b0=_0x3e08b0-0x0;var _0x432106=_0x82d1[_0x3e08b0];return _0x432106;};'use strict';var multer=require(_0x182d('0x0'));var util=require(_0x182d('0x1'));var path=require(_0x182d('0x2'));var timeout=require(_0x182d('0x3'));var express=require(_0x182d('0x4'));var router=express[_0x182d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x182d('0x6'));var interaction=require(_0x182d('0x7'));var config=require(_0x182d('0x8'));var controller=require(_0x182d('0x9'));router[_0x182d('0xa')](_0x182d('0xb'),auth['isAuthenticated'](),controller[_0x182d('0xc')]);router['delete'](_0x182d('0xb'),auth[_0x182d('0xd')](),controller['destroy']);module[_0x182d('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 8392b42..5625534 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 _0xc174=['name','INTEGER','STRING','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc174,0x1e8));var _0x4c17=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0xc174[_0x3b8f2e];return _0x1433d5;};'use strict';var Sequelize=require(_0x4c17('0x0'));module[_0x4c17('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4c17('0x2')},'OrderBy':{'type':Sequelize[_0x4c17('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4c17('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x3c1b=['exports','INTEGER','STRING','sequelize'];(function(_0x36125b,_0x5a888a){var _0x3e3479=function(_0xe3efeb){while(--_0xe3efeb){_0x36125b['push'](_0x36125b['shift']());}};_0x3e3479(++_0x5a888a);}(_0x3c1b,0x15b));var _0xb3c1=function(_0xb2189d,_0x59da17){_0xb2189d=_0xb2189d-0x0;var _0x3c50ce=_0x3c1b[_0xb2189d];return _0x3c50ce;};'use strict';var Sequelize=require(_0xb3c1('0x0'));module[_0xb3c1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xb3c1('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xb3c1('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 58dbfb8..03c51ac 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 _0x1a85=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','ContactItemTypes','UserProfileResource','destroy','end','error','stack','name','index','ContactItemType','rawAttributes','type','model','map','query','keys','filters','attributes','fields','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','intersection','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','body','CmContactHasItem','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0xc2100d,_0x3c552c){var _0x4bce11=function(_0x522e2a){while(--_0x522e2a){_0xc2100d['push'](_0xc2100d['shift']());}};_0x4bce11(++_0x3c552c);}(_0x1a85,0x178));var _0x51a8=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x1a85[_0x15ec4e];return _0xb5e5dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){var _0x78d3d6=_0x23d26a[_0x51a8('0x24')]({'plain':!![]});var _0x18e2f3=_0x51a8('0x25');return db[_0x51a8('0x26')][_0x51a8('0x27')]({'where':{'type':_0x18e2f3,'resourceId':_0x78d3d6['id']}})[_0x51a8('0x23')](function(){return _0x23d26a;});})['then'](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x28')]();});}};}function handleEntityNotFound(_0xca5746,_0x3da187){return function(_0x1c150d){if(!_0x1c150d){_0xca5746[_0x51a8('0x17')](0x194);}return _0x1c150d;};}function handleError(_0x1a886f,_0x2742f5){_0x2742f5=_0x2742f5||0x1f4;return function(_0xec08ae){logger[_0x51a8('0x29')](_0xec08ae[_0x51a8('0x2a')]);if(_0xec08ae[_0x51a8('0x2b')]){delete _0xec08ae['name'];}_0x1a886f[_0x51a8('0x18')](_0x2742f5)['send'](_0xec08ae);};}exports[_0x51a8('0x2c')]=function(_0x3bc19a,_0x143f46){var _0x41df56={},_0x2136b4={},_0x4ea271={'count':0x0,'rows':[]};var _0x10c19b=_['map'](db[_0x51a8('0x2d')][_0x51a8('0x2e')],function(_0x253a59){return{'name':_0x253a59['fieldName'],'type':_0x253a59[_0x51a8('0x2f')]['key']};});_0x2136b4[_0x51a8('0x30')]=_[_0x51a8('0x31')](_0x10c19b,_0x51a8('0x2b'));_0x2136b4[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x3bc19a['query']);_0x2136b4[_0x51a8('0x34')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],_0x2136b4[_0x51a8('0x32')]);_0x41df56[_0x51a8('0x35')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x36')]));_0x41df56[_0x51a8('0x35')]=_0x41df56['attributes']['length']?_0x41df56['attributes']:_0x2136b4[_0x51a8('0x30')];if(!_0x3bc19a[_0x51a8('0x32')]['hasOwnProperty'](_0x51a8('0x37'))){_0x41df56['limit']=qs[_0x51a8('0x1c')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x1c')]);_0x41df56[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0x3bc19a[_0x51a8('0x32')]['offset']);}_0x41df56['order']=qs[_0x51a8('0x38')](_0x3bc19a['query']['sort']);_0x41df56['where']=qs[_0x51a8('0x34')](_[_0x51a8('0x39')](_0x3bc19a[_0x51a8('0x32')],_0x2136b4['filters']),_0x10c19b);if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]){_0x41df56[_0x51a8('0x3b')]=_[_0x51a8('0x3c')](_0x41df56['where'],{'$or':_[_0x51a8('0x31')](_0x10c19b,function(_0xe6a86a){if(_0xe6a86a[_0x51a8('0x2f')]!=='VIRTUAL'){var _0xb96200={};_0xb96200[_0xe6a86a['name']]={'$like':'%'+_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]+'%'};return _0xb96200;}})});}_0x41df56=_[_0x51a8('0x3c')]({},_0x41df56,_0x3bc19a[_0x51a8('0x3d')]);var _0x5c44a9={'where':_0x41df56[_0x51a8('0x3b')]};return db[_0x51a8('0x2d')][_0x51a8('0x1d')](_0x5c44a9)[_0x51a8('0x23')](function(_0xa33fc){_0x4ea271[_0x51a8('0x1d')]=_0xa33fc;if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x41df56[_0x51a8('0x3f')]=[{'all':!![]}];}return db['ContactItemType'][_0x51a8('0x40')](_0x41df56);})[_0x51a8('0x23')](function(_0x4c7c67){_0x4ea271['rows']=_0x4c7c67;return _0x4ea271;})[_0x51a8('0x23')](respondWithFilteredResult(_0x143f46,_0x41df56))[_0x51a8('0x41')](handleError(_0x143f46,null));};exports[_0x51a8('0x42')]=function(_0x27b8e5,_0x311574){var _0x157a51={'raw':!![],'where':{'id':_0x27b8e5[_0x51a8('0x43')]['id']}},_0x28f5b3={};_0x28f5b3[_0x51a8('0x30')]=_[_0x51a8('0x33')](db['ContactItemType'][_0x51a8('0x2e')]);_0x28f5b3[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x27b8e5[_0x51a8('0x32')]);_0x28f5b3[_0x51a8('0x34')]=_[_0x51a8('0x44')](_0x28f5b3['model'],_0x28f5b3[_0x51a8('0x32')]);_0x157a51['attributes']=_[_0x51a8('0x44')](_0x28f5b3[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x36')]));_0x157a51['attributes']=_0x157a51['attributes'][_0x51a8('0x45')]?_0x157a51[_0x51a8('0x35')]:_0x28f5b3[_0x51a8('0x30')];if(_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x157a51['include']=[{'all':!![]}];}_0x157a51=_['merge']({},_0x157a51,_0x27b8e5[_0x51a8('0x3d')]);return db[_0x51a8('0x2d')][_0x51a8('0x46')](_0x157a51)[_0x51a8('0x23')](handleEntityNotFound(_0x311574,null))[_0x51a8('0x23')](respondWithResult(_0x311574,null))[_0x51a8('0x41')](handleError(_0x311574,null));};exports[_0x51a8('0x47')]=function(_0x1103a3,_0x301578){return db['ContactItemType']['create'](_0x1103a3['body'],{})[_0x51a8('0x23')](function(_0x279cb1){var _0x103897=_0x1103a3['user'][_0x51a8('0x24')]({'plain':!![]});if(!_0x103897)throw new Error(_0x51a8('0x48'));if(_0x103897['role']===_0x51a8('0x49')){var _0x4fb93c=_0x279cb1['get']({'plain':!![]});var _0xbf828b=_0x51a8('0x25');return db[_0x51a8('0x4a')]['find']({'where':{'name':_0xbf828b,'userProfileId':_0x103897['userProfileId']},'raw':!![]})[_0x51a8('0x23')](function(_0x5b0398){if(_0x5b0398&&_0x5b0398[_0x51a8('0x4b')]===0x0){return db[_0x51a8('0x26')][_0x51a8('0x47')]({'name':_0x4fb93c[_0x51a8('0x2b')],'resourceId':_0x4fb93c['id'],'type':_0x5b0398[_0x51a8('0x2b')],'sectionId':_0x5b0398['id']},{})[_0x51a8('0x23')](function(){return _0x279cb1;});}else{return _0x279cb1;}})[_0x51a8('0x41')](function(_0x406a87){logger[_0x51a8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x406a87);throw _0x406a87;});}return _0x279cb1;})[_0x51a8('0x23')](respondWithResult(_0x301578,0xc9))[_0x51a8('0x41')](handleError(_0x301578,null));};exports[_0x51a8('0x22')]=function(_0xd3c4,_0x533cfa){if(_0xd3c4[_0x51a8('0x4c')]['id']){delete _0xd3c4['body']['id'];}return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0xd3c4['params']['id']}})['then'](handleEntityNotFound(_0x533cfa,null))[_0x51a8('0x23')](saveUpdates(_0xd3c4[_0x51a8('0x4c')],null))[_0x51a8('0x23')](respondWithResult(_0x533cfa,null))[_0x51a8('0x41')](handleError(_0x533cfa,null));};exports[_0x51a8('0x27')]=function(_0x52f60f,_0x43b79a){return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0x52f60f[_0x51a8('0x43')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x43b79a,null))['then'](db[_0x51a8('0x4d')][_0x51a8('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x52f60f[_0x51a8('0x43')]['id']}}))[_0x51a8('0x23')](removeEntity(_0x43b79a,null))[_0x51a8('0x41')](handleError(_0x43b79a,null));}; \ No newline at end of file +var _0xd7d1=['autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','end','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId'];(function(_0x1d2179,_0x4cc753){var _0xc9c536=function(_0xb9ea9e){while(--_0xb9ea9e){_0x1d2179['push'](_0x1d2179['shift']());}};_0xc9c536(++_0x4cc753);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x462d87,_0x45e1a6){_0x462d87=_0x462d87-0x0;var _0x2c6936=_0xd7d1[_0x462d87];return _0x2c6936;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){var _0x4fa346=_0x106376[_0x1d7d('0x2a')]({'plain':!![]});var _0x151198='ContactItemTypes';return db['UserProfileResource'][_0x1d7d('0x29')]({'where':{'type':_0x151198,'resourceId':_0x4fa346['id']}})['then'](function(){return _0x106376;});})[_0x1d7d('0x28')](function(){_0x5097b8[_0x1d7d('0x1d')](0xcc)[_0x1d7d('0x2b')]();});}};}function handleEntityNotFound(_0x22c40d,_0x465938){return function(_0x59f827){if(!_0x59f827){_0x22c40d[_0x1d7d('0x1c')](0x194);}return _0x59f827;};}function handleError(_0x98c1ad,_0x352d5a){_0x352d5a=_0x352d5a||0x1f4;return function(_0x58672c){logger[_0x1d7d('0x2c')](_0x58672c[_0x1d7d('0x2d')]);if(_0x58672c[_0x1d7d('0x2e')]){delete _0x58672c['name'];}_0x98c1ad['status'](_0x352d5a)['send'](_0x58672c);};}exports[_0x1d7d('0x2f')]=function(_0x329f56,_0x559f19){var _0x1ebcbc={},_0x3e4136={},_0x16a81d={'count':0x0,'rows':[]};var _0x3336ab=_[_0x1d7d('0x30')](db[_0x1d7d('0x31')][_0x1d7d('0x32')],function(_0x803dc9){return{'name':_0x803dc9[_0x1d7d('0x33')],'type':_0x803dc9[_0x1d7d('0x34')]['key']};});_0x3e4136['model']=_[_0x1d7d('0x30')](_0x3336ab,_0x1d7d('0x2e'));_0x3e4136[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x329f56[_0x1d7d('0x35')]);_0x3e4136[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],_0x3e4136[_0x1d7d('0x35')]);_0x1ebcbc['attributes']=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x329f56[_0x1d7d('0x35')]['fields']));_0x1ebcbc['attributes']=_0x1ebcbc[_0x1d7d('0x3b')][_0x1d7d('0x3c')]?_0x1ebcbc['attributes']:_0x3e4136[_0x1d7d('0x39')];if(!_0x329f56[_0x1d7d('0x35')]['hasOwnProperty']('nolimit')){_0x1ebcbc[_0x1d7d('0x20')]=qs[_0x1d7d('0x20')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x20')]);_0x1ebcbc[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x22')]);}_0x1ebcbc[_0x1d7d('0x3d')]=qs[_0x1d7d('0x3e')](_0x329f56['query']['sort']);_0x1ebcbc['where']=qs['filters'](_[_0x1d7d('0x3f')](_0x329f56['query'],_0x3e4136[_0x1d7d('0x37')]),_0x3336ab);if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x40')]){_0x1ebcbc['where']=_[_0x1d7d('0x41')](_0x1ebcbc[_0x1d7d('0x42')],{'$or':_[_0x1d7d('0x30')](_0x3336ab,function(_0x5b7e01){if(_0x5b7e01[_0x1d7d('0x34')]!==_0x1d7d('0x43')){var _0xfb9845={};_0xfb9845[_0x5b7e01[_0x1d7d('0x2e')]]={'$like':'%'+_0x329f56['query'][_0x1d7d('0x40')]+'%'};return _0xfb9845;}})});}_0x1ebcbc=_[_0x1d7d('0x41')]({},_0x1ebcbc,_0x329f56[_0x1d7d('0x44')]);var _0x456d51={'where':_0x1ebcbc['where']};return db[_0x1d7d('0x31')]['count'](_0x456d51)[_0x1d7d('0x28')](function(_0x31b850){_0x16a81d[_0x1d7d('0x21')]=_0x31b850;if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x45')]){_0x1ebcbc['include']=[{'all':!![]}];}return db['ContactItemType'][_0x1d7d('0x46')](_0x1ebcbc);})[_0x1d7d('0x28')](function(_0x1637fc){_0x16a81d['rows']=_0x1637fc;return _0x16a81d;})['then'](respondWithFilteredResult(_0x559f19,_0x1ebcbc))[_0x1d7d('0x47')](handleError(_0x559f19,null));};exports['show']=function(_0x86e7bc,_0x379e75){var _0x1d1064={'raw':!![],'where':{'id':_0x86e7bc[_0x1d7d('0x48')]['id']}},_0x21394c={};_0x21394c[_0x1d7d('0x39')]=_[_0x1d7d('0x36')](db['ContactItemType'][_0x1d7d('0x32')]);_0x21394c[_0x1d7d('0x35')]=_['keys'](_0x86e7bc[_0x1d7d('0x35')]);_0x21394c[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],_0x21394c[_0x1d7d('0x35')]);_0x1d1064[_0x1d7d('0x3b')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x86e7bc[_0x1d7d('0x35')][_0x1d7d('0x3a')]));_0x1d1064[_0x1d7d('0x3b')]=_0x1d1064['attributes'][_0x1d7d('0x3c')]?_0x1d1064['attributes']:_0x21394c[_0x1d7d('0x39')];if(_0x86e7bc['query'][_0x1d7d('0x45')]){_0x1d1064[_0x1d7d('0x49')]=[{'all':!![]}];}_0x1d1064=_[_0x1d7d('0x41')]({},_0x1d1064,_0x86e7bc[_0x1d7d('0x44')]);return db['ContactItemType'][_0x1d7d('0x4a')](_0x1d1064)['then'](handleEntityNotFound(_0x379e75,null))['then'](respondWithResult(_0x379e75,null))[_0x1d7d('0x47')](handleError(_0x379e75,null));};exports['create']=function(_0x57e416,_0x3727be){return db[_0x1d7d('0x31')]['create'](_0x57e416[_0x1d7d('0x4b')],{})[_0x1d7d('0x28')](function(_0x527711){var _0x1f3a63=_0x57e416[_0x1d7d('0x4c')][_0x1d7d('0x2a')]({'plain':!![]});if(!_0x1f3a63)throw new Error(_0x1d7d('0x4d'));if(_0x1f3a63['role']==='user'){var _0x3f73eb=_0x527711[_0x1d7d('0x2a')]({'plain':!![]});var _0x35ff5d=_0x1d7d('0x4e');return db[_0x1d7d('0x4f')]['find']({'where':{'name':_0x35ff5d,'userProfileId':_0x1f3a63[_0x1d7d('0x50')]},'raw':!![]})[_0x1d7d('0x28')](function(_0x344b66){if(_0x344b66&&_0x344b66[_0x1d7d('0x51')]===0x0){return db[_0x1d7d('0x52')][_0x1d7d('0x53')]({'name':_0x3f73eb[_0x1d7d('0x2e')],'resourceId':_0x3f73eb['id'],'type':_0x344b66[_0x1d7d('0x2e')],'sectionId':_0x344b66['id']},{})[_0x1d7d('0x28')](function(){return _0x527711;});}else{return _0x527711;}})['catch'](function(_0x3e7c4c){logger[_0x1d7d('0x2c')](_0x1d7d('0x54'),_0x3e7c4c);throw _0x3e7c4c;});}return _0x527711;})['then'](respondWithResult(_0x3727be,0xc9))['catch'](handleError(_0x3727be,null));};exports[_0x1d7d('0x27')]=function(_0x2d4cc3,_0x3f5434){if(_0x2d4cc3['body']['id']){delete _0x2d4cc3[_0x1d7d('0x4b')]['id'];}return db[_0x1d7d('0x31')]['find']({'where':{'id':_0x2d4cc3[_0x1d7d('0x48')]['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3f5434,null))[_0x1d7d('0x28')](saveUpdates(_0x2d4cc3[_0x1d7d('0x4b')],null))['then'](respondWithResult(_0x3f5434,null))[_0x1d7d('0x47')](handleError(_0x3f5434,null));};exports[_0x1d7d('0x29')]=function(_0x4ba6ec,_0x4d4c34){return db[_0x1d7d('0x31')][_0x1d7d('0x4a')]({'where':{'id':_0x4ba6ec['params']['id']}})['then'](handleEntityNotFound(_0x4d4c34,null))[_0x1d7d('0x28')](db[_0x1d7d('0x55')][_0x1d7d('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4ba6ec[_0x1d7d('0x48')]['id']}}))['then'](removeEntity(_0x4d4c34,null))[_0x1d7d('0x47')](handleError(_0x4d4c34,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index f2516ca..78e14e0 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 _0xc90e=['bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','lodash','util','../../config/logger','api'];(function(_0x5d80aa,_0x3644aa){var _0x19f340=function(_0x56c826){while(--_0x56c826){_0x5d80aa['push'](_0x5d80aa['shift']());}};_0x19f340(++_0x3644aa);}(_0xc90e,0x1d0));var _0xec90=function(_0x4c35c3,_0x3ef78a){_0x4c35c3=_0x4c35c3-0x0;var _0x339d8f=_0xc90e[_0x4c35c3];return _0x339d8f;};'use strict';var _=require(_0xec90('0x0'));var util=require(_0xec90('0x1'));var logger=require(_0xec90('0x2'))(_0xec90('0x3'));var moment=require('moment');var BPromise=require(_0xec90('0x4'));var rp=require(_0xec90('0x5'));var fs=require('fs');var path=require(_0xec90('0x6'));var rimraf=require(_0xec90('0x7'));var config=require(_0xec90('0x8'));var attributes=require(_0xec90('0x9'));module[_0xec90('0xa')]=function(_0x45a52c,_0x578efe){return _0x45a52c[_0xec90('0xb')](_0xec90('0xc'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd56=['api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xdd56,0x1b7));var _0x6dd5=function(_0x4692bf,_0x5b0ba7){_0x4692bf=_0x4692bf-0x0;var _0x514134=_0xdd56[_0x4692bf];return _0x514134;};'use strict';var _=require(_0x6dd5('0x0'));var util=require(_0x6dd5('0x1'));var logger=require(_0x6dd5('0x2'))(_0x6dd5('0x3'));var moment=require(_0x6dd5('0x4'));var BPromise=require(_0x6dd5('0x5'));var rp=require(_0x6dd5('0x6'));var fs=require('fs');var path=require(_0x6dd5('0x7'));var rimraf=require(_0x6dd5('0x8'));var config=require('../../config/environment');var attributes=require(_0x6dd5('0x9'));module['exports']=function(_0x4aefd0,_0x314cde){return _0x4aefd0[_0x6dd5('0xa')](_0x6dd5('0xb'),attributes,{'tableName':_0x6dd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 78e53e6..b5c1775 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 _0x4266=['jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1b1330,_0x41fa6d){var _0x277c66=function(_0x42bfb9){while(--_0x42bfb9){_0x1b1330['push'](_0x1b1330['shift']());}};_0x277c66(++_0x41fa6d);}(_0x4266,0xa4));var _0x6426=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x4266[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x6426('0x0'));var util=require(_0x6426('0x1'));var moment=require(_0x6426('0x2'));var BPromise=require(_0x6426('0x3'));var rs=require(_0x6426('0x4'));var fs=require('fs');var Redis=require(_0x6426('0x5'));var db=require(_0x6426('0x6'))['db'];var utils=require(_0x6426('0x7'));var logger=require(_0x6426('0x8'))(_0x6426('0x9'));var config=require(_0x6426('0xa'));var jayson=require(_0x6426('0xb'));var client=jayson[_0x6426('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32a8fc,_0x55dcd2,_0x58fb5c){return new BPromise(function(_0x4219f8,_0x18acec){return client[_0x6426('0xd')](_0x32a8fc,_0x58fb5c)[_0x6426('0xe')](function(_0x220885){logger[_0x6426('0xf')](_0x6426('0x10'),_0x55dcd2,_0x6426('0x11'));logger['debug'](_0x6426('0x12'),_0x55dcd2,'request\x20sent',JSON[_0x6426('0x13')](_0x220885));if(_0x220885[_0x6426('0x14')]){if(_0x220885[_0x6426('0x14')][_0x6426('0x15')]===0x1f4){logger['error'](_0x6426('0x10'),_0x55dcd2,_0x220885[_0x6426('0x14')]['message']);return _0x18acec(_0x220885[_0x6426('0x14')][_0x6426('0x16')]);}logger[_0x6426('0x14')](_0x6426('0x10'),_0x55dcd2,_0x220885['error'][_0x6426('0x16')]);return _0x4219f8(_0x220885[_0x6426('0x14')]['message']);}else{logger['info'](_0x6426('0x10'),_0x55dcd2,_0x6426('0x11'));_0x4219f8(_0x220885[_0x6426('0x17')][_0x6426('0x16')]);}})[_0x6426('0x18')](function(_0x42dd46){logger[_0x6426('0x14')](_0x6426('0x10'),_0x55dcd2,_0x42dd46);_0x18acec(_0x42dd46);});});} \ No newline at end of file +var _0x57f5=['stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x12a880,_0x2e8fc2){var _0x12967d=function(_0x4e9f8b){while(--_0x4e9f8b){_0x12a880['push'](_0x12a880['shift']());}};_0x12967d(++_0x2e8fc2);}(_0x57f5,0x1e7));var _0x557f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x57f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x557f('0x0'));var moment=require(_0x557f('0x1'));var BPromise=require(_0x557f('0x2'));var rs=require(_0x557f('0x3'));var fs=require('fs');var Redis=require(_0x557f('0x4'));var db=require(_0x557f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x557f('0x6'))(_0x557f('0x7'));var config=require(_0x557f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x557f('0x9')][_0x557f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57a024,_0x50fcee,_0x2fa740){return new BPromise(function(_0x154e12,_0x29f588){return client[_0x557f('0xb')](_0x57a024,_0x2fa740)[_0x557f('0xc')](function(_0x481b45){logger[_0x557f('0xd')](_0x557f('0xe'),_0x50fcee,_0x557f('0xf'));logger['debug'](_0x557f('0x10'),_0x50fcee,_0x557f('0xf'),JSON[_0x557f('0x11')](_0x481b45));if(_0x481b45[_0x557f('0x12')]){if(_0x481b45[_0x557f('0x12')][_0x557f('0x13')]===0x1f4){logger[_0x557f('0x12')](_0x557f('0xe'),_0x50fcee,_0x481b45['error'][_0x557f('0x14')]);return _0x29f588(_0x481b45['error'][_0x557f('0x14')]);}logger[_0x557f('0x12')](_0x557f('0xe'),_0x50fcee,_0x481b45[_0x557f('0x12')]['message']);return _0x154e12(_0x481b45['error'][_0x557f('0x14')]);}else{logger[_0x557f('0xd')](_0x557f('0xe'),_0x50fcee,'request\x20sent');_0x154e12(_0x481b45['result'][_0x557f('0x14')]);}})['catch'](function(_0x4a9c04){logger[_0x557f('0x12')](_0x557f('0xe'),_0x50fcee,_0x4a9c04);_0x29f588(_0x4a9c04);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 4ffd8ff..51bac66 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 _0x7abd=['../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','create','put','update','delete','exports','util','path','express','Router','../../components/auth/service'];(function(_0x2b3f84,_0x3fc9b3){var _0x104ec3=function(_0x264cd4){while(--_0x264cd4){_0x2b3f84['push'](_0x2b3f84['shift']());}};_0x104ec3(++_0x3fc9b3);}(_0x7abd,0xbb));var _0xd7ab=function(_0x3125f8,_0x19e5a8){_0x3125f8=_0x3125f8-0x0;var _0x1465fc=_0x7abd[_0x3125f8];return _0x1465fc;};'use strict';var multer=require('multer');var util=require(_0xd7ab('0x0'));var path=require(_0xd7ab('0x1'));var timeout=require('connect-timeout');var express=require(_0xd7ab('0x2'));var router=express[_0xd7ab('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd7ab('0x4'));var interaction=require(_0xd7ab('0x5'));var config=require(_0xd7ab('0x6'));var controller=require('./contactItemType.controller');router[_0xd7ab('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd7ab('0x7')](_0xd7ab('0x8'),auth[_0xd7ab('0x9')](),controller[_0xd7ab('0xa')]);router['post']('/',auth[_0xd7ab('0x9')](),controller[_0xd7ab('0xb')]);router[_0xd7ab('0xc')](_0xd7ab('0x8'),auth[_0xd7ab('0x9')](),controller[_0xd7ab('0xd')]);router[_0xd7ab('0xe')](_0xd7ab('0x8'),auth[_0xd7ab('0x9')](),controller['destroy']);module[_0xd7ab('0xf')]=router; \ No newline at end of file +var _0xb4eb=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1d1d64,_0x5497b5){var _0x23b1d3=function(_0x3fc949){while(--_0x3fc949){_0x1d1d64['push'](_0x1d1d64['shift']());}};_0x23b1d3(++_0x5497b5);}(_0xb4eb,0x152));var _0xbb4e=function(_0x481784,_0x5cb506){_0x481784=_0x481784-0x0;var _0x92d05e=_0xb4eb[_0x481784];return _0x92d05e;};'use strict';var multer=require(_0xbb4e('0x0'));var util=require(_0xbb4e('0x1'));var path=require(_0xbb4e('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb4e('0x3'));var router=express['Router']();var fs_extra=require(_0xbb4e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb4e('0x5'));var config=require(_0xbb4e('0x6'));var controller=require('./contactItemType.controller');router[_0xbb4e('0x7')]('/',auth[_0xbb4e('0x8')](),controller[_0xbb4e('0x9')]);router[_0xbb4e('0x7')](_0xbb4e('0xa'),auth[_0xbb4e('0x8')](),controller[_0xbb4e('0xb')]);router[_0xbb4e('0xc')]('/',auth['isAuthenticated'](),controller[_0xbb4e('0xd')]);router[_0xbb4e('0xe')](_0xbb4e('0xa'),auth[_0xbb4e('0x8')](),controller[_0xbb4e('0xf')]);router[_0xbb4e('0x10')](_0xbb4e('0xa'),auth[_0xbb4e('0x8')](),controller[_0xbb4e('0x11')]);module[_0xbb4e('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index ce0f967..1ed325e 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x444001,_0x240e89){var _0x542469=function(_0x27492d){while(--_0x27492d){_0x444001['push'](_0x444001['shift']());}};_0x542469(++_0x240e89);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b7b9b,_0xa4aff9){_0x4b7b9b=_0x4b7b9b-0x0;var _0x3be710=_0xb10b[_0x4b7b9b];return _0x3be710;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x1d1cf4,_0x49bad5){var _0x3cf6a9=function(_0x2c1391){while(--_0x2c1391){_0x1d1cf4['push'](_0x1d1cf4['shift']());}};_0x3cf6a9(++_0x49bad5);}(_0xb10b,0x12a));var _0xbb10=function(_0x16e5b3,_0x30d91d){_0x16e5b3=_0x16e5b3-0x0;var _0x4d6874=_0xb10b[_0x16e5b3];return _0x4d6874;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3c1714d..933fa23 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 _0x8454=['model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','CustomDashboards','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','DashboardItem','getItems','findOne','pick','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','type'];(function(_0x2e7a81,_0x5a74bb){var _0x3474ef=function(_0x31d6e2){while(--_0x31d6e2){_0x2e7a81['push'](_0x2e7a81['shift']());}};_0x3474ef(++_0x5a74bb);}(_0x8454,0x1ca));var _0x4845=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8454[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x4845('0x0'));var rimraf=require(_0x4845('0x1'));var zipdir=require(_0x4845('0x2'));var jsonpatch=require(_0x4845('0x3'));var rp=require(_0x4845('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4845('0x5'));var util=require(_0x4845('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4845('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4845('0x8'));var squel=require(_0x4845('0x9'));var crypto=require(_0x4845('0xa'));var jsforce=require(_0x4845('0xb'));var deskjs=require(_0x4845('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4845('0xd'));var Papa=require(_0x4845('0xe'));var Redis=require(_0x4845('0xf'));var authService=require(_0x4845('0x10'));var qs=require(_0x4845('0x11'));var as=require(_0x4845('0x12'));var hardwareService=require(_0x4845('0x13'));var logger=require(_0x4845('0x14'))(_0x4845('0x15'));var utils=require(_0x4845('0x16'));var config=require(_0x4845('0x17'));var licenseUtil=require(_0x4845('0x18'));var db=require(_0x4845('0x19'))['db'];config['redis']=_[_0x4845('0x1a')](config['redis'],{'host':_0x4845('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4845('0x1c')]));require(_0x4845('0x1d'))[_0x4845('0x1e')](socket);function respondWithStatusCode(_0x98f09f,_0x4e24ce){_0x4e24ce=_0x4e24ce||0xcc;return function(_0x3ddcd7){if(_0x3ddcd7){return _0x98f09f[_0x4845('0x1f')](_0x4e24ce);}return _0x98f09f[_0x4845('0x20')](_0x4e24ce)[_0x4845('0x21')]();};}function respondWithResult(_0x5500c2,_0x18dd3c){_0x18dd3c=_0x18dd3c||0xc8;return function(_0xcadb8a){if(_0xcadb8a){return _0x5500c2[_0x4845('0x20')](_0x18dd3c)[_0x4845('0x22')](_0xcadb8a);}};}function respondWithFilteredResult(_0x5dbbde,_0x39ca8d){return function(_0x32a827){if(_0x32a827){var _0x11d0fa=typeof _0x39ca8d[_0x4845('0x23')]===_0x4845('0x24')&&typeof _0x39ca8d[_0x4845('0x25')]===_0x4845('0x24');var _0x357597=_0x32a827['count'];var _0x595d1a=_0x11d0fa?0x0:_0x39ca8d[_0x4845('0x23')];var _0xef9517=_0x11d0fa?_0x32a827[_0x4845('0x26')]:_0x39ca8d[_0x4845('0x23')]+_0x39ca8d[_0x4845('0x25')];var _0x2b35c5;if(_0xef9517>=_0x357597){_0xef9517=_0x357597;_0x2b35c5=0xc8;}else{_0x2b35c5=0xce;}_0x5dbbde[_0x4845('0x20')](_0x2b35c5);return _0x5dbbde['set'](_0x4845('0x27'),_0x595d1a+'-'+_0xef9517+'/'+_0x357597)[_0x4845('0x22')](_0x32a827);}return null;};}function patchUpdates(_0x463bcc){return function(_0x4d3d2e){try{jsonpatch['apply'](_0x4d3d2e,_0x463bcc,!![]);}catch(_0x3dccbd){return BPromise[_0x4845('0x28')](_0x3dccbd);}return _0x4d3d2e[_0x4845('0x29')]();};}function saveUpdates(_0x20d834,_0x9f2862){return function(_0x3c1b0f){if(_0x3c1b0f){return _0x3c1b0f['update'](_0x20d834)[_0x4845('0x2a')](function(_0x3e1c18){return _0x3e1c18;});}return null;};}function removeEntity(_0x4f894d,_0x250dbd){return function(_0x43975d){if(_0x43975d){return _0x43975d[_0x4845('0x2b')]()[_0x4845('0x2a')](function(){var _0x3cdd8c=_0x43975d[_0x4845('0x2c')]({'plain':!![]});var _0x15a80f='CustomDashboards';return db[_0x4845('0x2d')][_0x4845('0x2b')]({'where':{'type':_0x15a80f,'resourceId':_0x3cdd8c['id']}})[_0x4845('0x2a')](function(){return _0x43975d;});})['then'](function(){_0x4f894d[_0x4845('0x20')](0xcc)[_0x4845('0x21')]();});}};}function handleEntityNotFound(_0x9c06,_0x20f0d7){return function(_0x3ccd97){if(!_0x3ccd97){_0x9c06[_0x4845('0x1f')](0x194);}return _0x3ccd97;};}function handleError(_0x44dce5,_0x14efdc){_0x14efdc=_0x14efdc||0x1f4;return function(_0x1ef1fa){logger[_0x4845('0x2e')](_0x1ef1fa['stack']);if(_0x1ef1fa[_0x4845('0x2f')]){delete _0x1ef1fa['name'];}_0x44dce5[_0x4845('0x20')](_0x14efdc)[_0x4845('0x30')](_0x1ef1fa);};}exports[_0x4845('0x31')]=function(_0x267eb4,_0x121666){var _0x1eee17={},_0x3b263e={},_0x149fe9={'count':0x0,'rows':[]};var _0x17a8ca=_[_0x4845('0x32')](db[_0x4845('0x33')][_0x4845('0x34')],function(_0x54e3d4){return{'name':_0x54e3d4['fieldName'],'type':_0x54e3d4[_0x4845('0x35')]['key']};});_0x3b263e[_0x4845('0x36')]=_[_0x4845('0x32')](_0x17a8ca,_0x4845('0x2f'));_0x3b263e['query']=_[_0x4845('0x37')](_0x267eb4[_0x4845('0x38')]);_0x3b263e[_0x4845('0x39')]=_['intersection'](_0x3b263e[_0x4845('0x36')],_0x3b263e[_0x4845('0x38')]);_0x1eee17[_0x4845('0x3a')]=_[_0x4845('0x3b')](_0x3b263e[_0x4845('0x36')],qs[_0x4845('0x3c')](_0x267eb4[_0x4845('0x38')][_0x4845('0x3c')]));_0x1eee17['attributes']=_0x1eee17[_0x4845('0x3a')][_0x4845('0x3d')]?_0x1eee17[_0x4845('0x3a')]:_0x3b263e['model'];if(!_0x267eb4[_0x4845('0x38')][_0x4845('0x3e')]('nolimit')){_0x1eee17[_0x4845('0x25')]=qs[_0x4845('0x25')](_0x267eb4['query']['limit']);_0x1eee17[_0x4845('0x23')]=qs['offset'](_0x267eb4[_0x4845('0x38')][_0x4845('0x23')]);}_0x1eee17[_0x4845('0x3f')]=qs[_0x4845('0x40')](_0x267eb4[_0x4845('0x38')]['sort']);_0x1eee17[_0x4845('0x41')]=qs[_0x4845('0x39')](_['pick'](_0x267eb4[_0x4845('0x38')],_0x3b263e[_0x4845('0x39')]),_0x17a8ca);if(_0x267eb4[_0x4845('0x38')][_0x4845('0x42')]){_0x1eee17[_0x4845('0x41')]=_[_0x4845('0x43')](_0x1eee17['where'],{'$or':_[_0x4845('0x32')](_0x17a8ca,function(_0x42c03e){if(_0x42c03e[_0x4845('0x35')]!==_0x4845('0x44')){var _0x2c0fd6={};_0x2c0fd6[_0x42c03e[_0x4845('0x2f')]]={'$like':'%'+_0x267eb4[_0x4845('0x38')][_0x4845('0x42')]+'%'};return _0x2c0fd6;}})});}_0x1eee17=_[_0x4845('0x43')]({},_0x1eee17,_0x267eb4[_0x4845('0x45')]);var _0x3f012d={'where':_0x1eee17[_0x4845('0x41')]};return db['Dashboard'][_0x4845('0x26')](_0x3f012d)['then'](function(_0x1f7315){_0x149fe9[_0x4845('0x26')]=_0x1f7315;if(_0x267eb4[_0x4845('0x38')][_0x4845('0x46')]){_0x1eee17[_0x4845('0x47')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x1eee17);})[_0x4845('0x2a')](function(_0x5342cb){_0x149fe9[_0x4845('0x48')]=_0x5342cb;return _0x149fe9;})['then'](respondWithFilteredResult(_0x121666,_0x1eee17))[_0x4845('0x49')](handleError(_0x121666,null));};exports[_0x4845('0x4a')]=function(_0x15f243,_0x4d3ea4){var _0x1b35b6={'raw':![],'where':{'id':_0x15f243[_0x4845('0x4b')]['id']}},_0xf7eb3c={};_0xf7eb3c[_0x4845('0x36')]=_['keys'](db[_0x4845('0x33')]['rawAttributes']);_0xf7eb3c[_0x4845('0x38')]=_[_0x4845('0x37')](_0x15f243[_0x4845('0x38')]);_0xf7eb3c['filters']=_[_0x4845('0x3b')](_0xf7eb3c[_0x4845('0x36')],_0xf7eb3c['query']);_0x1b35b6[_0x4845('0x3a')]=_[_0x4845('0x3b')](_0xf7eb3c[_0x4845('0x36')],qs['fields'](_0x15f243[_0x4845('0x38')][_0x4845('0x3c')]));_0x1b35b6[_0x4845('0x3a')]=_0x1b35b6[_0x4845('0x3a')][_0x4845('0x3d')]?_0x1b35b6[_0x4845('0x3a')]:_0xf7eb3c[_0x4845('0x36')];if(_0x15f243[_0x4845('0x38')]['includeAll']){_0x1b35b6[_0x4845('0x47')]=[{'all':!![]}];}_0x1b35b6=_[_0x4845('0x43')]({},_0x1b35b6,_0x15f243[_0x4845('0x45')]);return db[_0x4845('0x33')][_0x4845('0x4c')](_0x1b35b6)[_0x4845('0x2a')](handleEntityNotFound(_0x4d3ea4,null))[_0x4845('0x2a')](respondWithResult(_0x4d3ea4,null))[_0x4845('0x49')](handleError(_0x4d3ea4,null));};exports['create']=function(_0x3dc074,_0x1e4239){return db['Dashboard'][_0x4845('0x4d')](_0x3dc074[_0x4845('0x4e')],{})[_0x4845('0x2a')](function(_0x306344){var _0x1ea22d=_0x3dc074['user']['get']({'plain':!![]});if(!_0x1ea22d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ea22d['role']===_0x4845('0x4f')){var _0x5267bb=_0x306344[_0x4845('0x2c')]({'plain':!![]});var _0x5610e5=_0x4845('0x50');return db[_0x4845('0x51')][_0x4845('0x4c')]({'where':{'name':_0x5610e5,'userProfileId':_0x1ea22d['userProfileId']},'raw':!![]})[_0x4845('0x2a')](function(_0x1a1180){if(_0x1a1180&&_0x1a1180[_0x4845('0x52')]===0x0){return db['UserProfileResource'][_0x4845('0x4d')]({'name':_0x5267bb[_0x4845('0x2f')],'resourceId':_0x5267bb['id'],'type':_0x1a1180['name'],'sectionId':_0x1a1180['id']},{})['then'](function(){return _0x306344;});}else{return _0x306344;}})[_0x4845('0x49')](function(_0x7014fd){logger[_0x4845('0x2e')](_0x4845('0x53'),_0x7014fd);throw _0x7014fd;});}return _0x306344;})[_0x4845('0x2a')](respondWithResult(_0x1e4239,0xc9))[_0x4845('0x49')](handleError(_0x1e4239,null));};exports[_0x4845('0x54')]=function(_0x8199f2,_0x204828){var _0x165cb8={'where':{'id':_0x8199f2[_0x4845('0x4b')]['id']}},_0x38fc95={};_0x38fc95[_0x4845('0x36')]=_[_0x4845('0x37')](db[_0x4845('0x33')][_0x4845('0x34')]);_0x165cb8[_0x4845('0x3a')]=_[_0x4845('0x3b')](_0x38fc95['model'],qs[_0x4845('0x3c')](_0x8199f2[_0x4845('0x38')][_0x4845('0x3c')]));_0x165cb8[_0x4845('0x3a')]=_0x165cb8['attributes'][_0x4845('0x3d')]?_0x165cb8[_0x4845('0x3a')]:_0x38fc95[_0x4845('0x36')];if(_0x8199f2['query'][_0x4845('0x46')]){_0x165cb8['include']=[{'all':!![]}];}_0x165cb8=_['merge']({},_0x165cb8,_0x8199f2[_0x4845('0x45')]);return db['Dashboard'][_0x4845('0x4c')](_0x165cb8)[_0x4845('0x2a')](handleEntityNotFound(_0x204828,null))[_0x4845('0x2a')](function(_0x2edc98){if(_0x2edc98){var _0x1ae023=_0x2edc98[_0x4845('0x2c')]({'plain':!![]});_0x1ae023=qs[_0x4845('0x55')](_0x1ae023,['id',_0x4845('0x56'),_0x4845('0x57')]);_0x8199f2[_0x4845('0x4e')]=_['omit'](_0x8199f2['body'],['id',_0x4845('0x56'),_0x4845('0x57')]);return db['Dashboard'][_0x4845('0x4d')](_['merge'](_0x1ae023,_0x8199f2[_0x4845('0x4e')]),{'include':_0x8199f2['query'][_0x4845('0x46')]?[{'all':!![]}]:undefined})[_0x4845('0x2a')](function(_0x5be364){var _0xc9c3e7=_0x8199f2['user'][_0x4845('0x2c')]({'plain':!![]});if(!_0xc9c3e7)throw new Error(_0x4845('0x58'));if(_0xc9c3e7['role']==='user'){var _0x5562cd=_0x5be364[_0x4845('0x2c')]({'plain':!![]});var _0xba9871=_0x4845('0x50');return db[_0x4845('0x51')][_0x4845('0x4c')]({'where':{'name':_0xba9871,'userProfileId':_0xc9c3e7['userProfileId']},'raw':!![]})[_0x4845('0x2a')](function(_0x5cfac1){if(_0x5cfac1&&_0x5cfac1[_0x4845('0x52')]===0x0){return db[_0x4845('0x2d')][_0x4845('0x4d')]({'name':_0x5562cd[_0x4845('0x2f')],'resourceId':_0x5562cd['id'],'type':_0x5cfac1['name'],'sectionId':_0x5cfac1['id']},{})[_0x4845('0x2a')](function(){return _0x5be364;});}else{return _0x5be364;}})[_0x4845('0x49')](function(_0x19c82f){logger['error'](_0x4845('0x53'),_0x19c82f);throw _0x19c82f;});}return _0x5be364;});}})['then'](respondWithResult(_0x204828,0xc9))[_0x4845('0x49')](handleError(_0x204828,null));};exports[_0x4845('0x59')]=function(_0x24641e,_0x499752){if(_0x24641e[_0x4845('0x4e')]['id']){delete _0x24641e[_0x4845('0x4e')]['id'];}return db[_0x4845('0x33')]['find']({'where':{'id':_0x24641e[_0x4845('0x4b')]['id']}})['then'](handleEntityNotFound(_0x499752,null))[_0x4845('0x2a')](saveUpdates(_0x24641e['body'],null))[_0x4845('0x2a')](respondWithResult(_0x499752,null))[_0x4845('0x49')](handleError(_0x499752,null));};exports[_0x4845('0x2b')]=function(_0x9a6244,_0x2dd5c6){return db[_0x4845('0x33')]['find']({'where':{'id':_0x9a6244[_0x4845('0x4b')]['id']}})[_0x4845('0x2a')](handleEntityNotFound(_0x2dd5c6,null))[_0x4845('0x2a')](removeEntity(_0x2dd5c6,null))[_0x4845('0x49')](handleError(_0x2dd5c6,null));};function widgetAttributes(_0x46b211){try{switch(_0x46b211[_0x4845('0x35')]){case _0x4845('0x5a'):return[{'name':'attrUrl','value':_0x46b211[_0x4845('0x5b')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x0]?_0x46b211[_0x4845('0x5c')][0x0][_0x4845('0x5d')]:undefined)||_0x4845('0x5e')}];case _0x4845('0x5f'):return[{'name':_0x4845('0x60'),'value':_0x46b211[_0x4845('0x60')]||(_0x46b211['attrs']&&_0x46b211['attrs'][0x0]?_0x46b211[_0x4845('0x5c')][0x0][_0x4845('0x5d')]:undefined)||''}];case _0x4845('0x61'):return[{'name':_0x4845('0x62'),'value':_0x46b211[_0x4845('0x62')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x0]?_0x46b211[_0x4845('0x5c')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x4845('0x63'),'value':_0x46b211['attrTimezone']||(_0x46b211['attrs']&&_0x46b211['attrs'][0x1]?_0x46b211[_0x4845('0x5c')][0x1][_0x4845('0x5d')]:undefined)||_0x4845('0x64')},{'name':_0x4845('0x65'),'value':_0x46b211[_0x4845('0x65')]||(_0x46b211['attrs']&&_0x46b211[_0x4845('0x5c')][0x2]?_0x46b211[_0x4845('0x5c')][0x2][_0x4845('0x5d')]:undefined)||0xc}];case _0x4845('0x66'):return[{'name':_0x4845('0x67'),'value':_0x46b211[_0x4845('0x67')]||(_0x46b211['attrs']&&_0x46b211[_0x4845('0x5c')][0x0]?_0x46b211[_0x4845('0x5c')][0x0]['value']:undefined)||_0x4845('0x68')},{'name':'attrVoiceQueues','value':_0x46b211[_0x4845('0x69')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x1]?_0x46b211[_0x4845('0x5c')][0x1][_0x4845('0x5d')]:undefined)||[]},{'name':_0x4845('0x65'),'value':_0x46b211[_0x4845('0x65')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x2]?_0x46b211[_0x4845('0x5c')][0x2][_0x4845('0x5d')]:undefined)||0x14},{'name':'attrChannel','value':_0x46b211[_0x4845('0x6a')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x3]?_0x46b211['attrs'][0x3][_0x4845('0x5d')]:undefined)||_0x4845('0x6b')},{'name':_0x4845('0x6c'),'value':_0x46b211[_0x4845('0x6c')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211['attrs'][0x4]?_0x46b211[_0x4845('0x5c')][0x4][_0x4845('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x46b211[_0x4845('0x6d')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211['attrs'][0x5]?_0x46b211['attrs'][0x5][_0x4845('0x5d')]:undefined)||''},{'name':_0x4845('0x6e'),'value':_0x46b211['attrSmsAccounts']||(_0x46b211[_0x4845('0x5c')]&&_0x46b211['attrs'][0x6]?_0x46b211[_0x4845('0x5c')][0x6][_0x4845('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x46b211['attrOpenchannelAccounts']||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x7]?_0x46b211[_0x4845('0x5c')][0x7][_0x4845('0x5d')]:undefined)||''},{'name':_0x4845('0x6f'),'value':_0x46b211[_0x4845('0x6f')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211['attrs'][0x8]?_0x46b211['attrs'][0x8][_0x4845('0x5d')]:undefined)||''},{'name':_0x4845('0x70'),'value':_0x46b211[_0x4845('0x70')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x9]?_0x46b211['attrs'][0x9][_0x4845('0x5d')]:undefined)||''}];case _0x4845('0x71'):case _0x4845('0x72'):return[{'name':_0x4845('0x73'),'value':_0x46b211['attrSerie1']||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x0]?_0x46b211['attrs'][0x0]['value']:undefined)||_0x4845('0x68')},{'name':_0x4845('0x74'),'value':_0x46b211[_0x4845('0x74')]||(_0x46b211['attrs']&&_0x46b211['attrs'][0x1]?_0x46b211[_0x4845('0x5c')][0x1][_0x4845('0x5d')]:undefined)||null},{'name':_0x4845('0x75'),'value':_0x46b211[_0x4845('0x75')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x2]?_0x46b211[_0x4845('0x5c')][0x2][_0x4845('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x46b211[_0x4845('0x69')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211['attrs'][0x3]?_0x46b211[_0x4845('0x5c')][0x3][_0x4845('0x5d')]:undefined)||[]},{'name':_0x4845('0x6a'),'value':_0x46b211[_0x4845('0x6a')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x4]?_0x46b211[_0x4845('0x5c')][0x4]['value']:undefined)||_0x4845('0x6b')},{'name':_0x4845('0x6c'),'value':_0x46b211[_0x4845('0x6c')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211['attrs'][0x5]?_0x46b211[_0x4845('0x5c')][0x5]['value']:undefined)||''},{'name':_0x4845('0x6d'),'value':_0x46b211['attrFaxAccounts']||(_0x46b211[_0x4845('0x5c')]&&_0x46b211['attrs'][0x6]?_0x46b211[_0x4845('0x5c')][0x6][_0x4845('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x46b211[_0x4845('0x6e')]||(_0x46b211['attrs']&&_0x46b211['attrs'][0x7]?_0x46b211[_0x4845('0x5c')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x46b211[_0x4845('0x76')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211['attrs'][0x8]?_0x46b211[_0x4845('0x5c')][0x8]['value']:undefined)||''},{'name':_0x4845('0x6f'),'value':_0x46b211['attrWhatsappAccounts']||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x9]?_0x46b211[_0x4845('0x5c')][0x9][_0x4845('0x5d')]:undefined)||''},{'name':_0x4845('0x70'),'value':_0x46b211[_0x4845('0x70')]||(_0x46b211['attrs']&&_0x46b211['attrs'][0xa]?_0x46b211[_0x4845('0x5c')][0xa][_0x4845('0x5d')]:undefined)||''}];case _0x4845('0x77'):return[{'name':_0x4845('0x78'),'type':_0x46b211['reportType']||(_0x46b211['attrs']&&_0x46b211['attrs'][0x0]?_0x46b211['attrs'][0x0][_0x4845('0x35')]:undefined)||null,'value':_0x46b211[_0x4845('0x78')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211['attrs'][0x0]?_0x46b211[_0x4845('0x5c')][0x0][_0x4845('0x5d')]:undefined)||null},{'name':'attrRefresh','value':_0x46b211[_0x4845('0x79')]||(_0x46b211[_0x4845('0x5c')]&&_0x46b211[_0x4845('0x5c')][0x1]?_0x46b211[_0x4845('0x5c')][0x1][_0x4845('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x333e11){logger[_0x4845('0x2e')](_0x4845('0x7a'),JSON['stringify'](_0x333e11));return[];}}exports['addItem']=function(_0x483685,_0x24b690,_0x4a7c66){if(_0x483685[_0x4845('0x4e')]['id']){delete _0x483685[_0x4845('0x4e')]['id'];}return db[_0x4845('0x33')]['find']({'where':{'id':_0x483685[_0x4845('0x4b')]['id']}})['then'](handleEntityNotFound(_0x24b690,null))[_0x4845('0x2a')](function(_0x1e30aa){if(_0x1e30aa){_0x483685[_0x4845('0x4e')]['DashboardId']=_0x1e30aa['id'];_0x483685[_0x4845('0x4e')]['attrs']=widgetAttributes(_0x483685[_0x4845('0x4e')]);return db[_0x4845('0x7b')]['create'](_0x483685[_0x4845('0x4e')]);}})[_0x4845('0x2a')](respondWithResult(_0x24b690,null))[_0x4845('0x49')](handleError(_0x24b690,null));};exports[_0x4845('0x7c')]=function(_0x3f2df9,_0x5b8dcd,_0x536f3f){var _0x3ac20b={};var _0x21b960={};var _0x34f410;var _0x340fad;return db[_0x4845('0x33')][_0x4845('0x7d')]({'where':{'id':_0x3f2df9[_0x4845('0x4b')]['id']}})[_0x4845('0x2a')](handleEntityNotFound(_0x5b8dcd,null))[_0x4845('0x2a')](function(_0x3d8384){if(_0x3d8384){_0x34f410=_0x3d8384;_0x21b960[_0x4845('0x36')]=_[_0x4845('0x37')](db[_0x4845('0x7b')][_0x4845('0x34')]);_0x21b960[_0x4845('0x38')]=_['keys'](_0x3f2df9[_0x4845('0x38')]);_0x21b960['filters']=_[_0x4845('0x3b')](_0x21b960['model'],_0x21b960[_0x4845('0x38')]);_0x3ac20b[_0x4845('0x3a')]=_[_0x4845('0x3b')](_0x21b960[_0x4845('0x36')],qs[_0x4845('0x3c')](_0x3f2df9[_0x4845('0x38')][_0x4845('0x3c')]));_0x3ac20b[_0x4845('0x3a')]=_0x3ac20b[_0x4845('0x3a')][_0x4845('0x3d')]?_0x3ac20b['attributes']:_0x21b960[_0x4845('0x36')];_0x3ac20b[_0x4845('0x3f')]=qs[_0x4845('0x40')](_0x3f2df9[_0x4845('0x38')][_0x4845('0x40')]);_0x3ac20b[_0x4845('0x41')]=qs[_0x4845('0x39')](_[_0x4845('0x7e')](_0x3f2df9[_0x4845('0x38')],_0x21b960[_0x4845('0x39')]));if(_0x3f2df9[_0x4845('0x38')][_0x4845('0x42')]){_0x3ac20b[_0x4845('0x41')]=_[_0x4845('0x43')](_0x3ac20b['where'],{'$or':_[_0x4845('0x32')](_0x3ac20b['attributes'],function(_0x56897b){var _0x1f4603={};_0x1f4603[_0x56897b]={'$like':'%'+_0x3f2df9[_0x4845('0x38')][_0x4845('0x42')]+'%'};return _0x1f4603;})});}_0x3ac20b=_[_0x4845('0x43')]({},_0x3ac20b,_0x3f2df9[_0x4845('0x45')]);return _0x34f410[_0x4845('0x7c')](_0x3ac20b);}})[_0x4845('0x2a')](function(_0x5582e9){if(_0x5582e9){_0x340fad=_0x5582e9['length'];if(!_0x3f2df9[_0x4845('0x38')][_0x4845('0x3e')](_0x4845('0x7f'))){_0x3ac20b[_0x4845('0x25')]=qs[_0x4845('0x25')](_0x3f2df9['query']['limit']);_0x3ac20b[_0x4845('0x23')]=qs[_0x4845('0x23')](_0x3f2df9[_0x4845('0x38')][_0x4845('0x23')]);}return _0x34f410['getItems'](_0x3ac20b);}})[_0x4845('0x2a')](function(_0x3ab64b){if(_0x3ab64b){return _0x3ab64b?{'count':_0x340fad,'rows':_0x3ab64b}:null;}})[_0x4845('0x2a')](respondWithResult(_0x5b8dcd,null))[_0x4845('0x49')](handleError(_0x5b8dcd,null));}; \ No newline at end of file +var _0x3264=['params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','autoAssociation','UserProfileResource','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','attrWhatsappAccounts','web-report','attrReport','attrRefresh','addItem','DashboardId','DashboardItem','getItems','findOne','order','pick','nolimit','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','get','CustomDashboards','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','Dashboard','include','findAll','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3264,0x1b7));var _0x4326=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x3264[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0x4326('0x0'));var rimraf=require(_0x4326('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4326('0x2'));var moment=require(_0x4326('0x3'));var BPromise=require(_0x4326('0x4'));var Mustache=require(_0x4326('0x5'));var util=require('util');var path=require(_0x4326('0x6'));var sox=require(_0x4326('0x7'));var csv=require(_0x4326('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4326('0x9'));var squel=require(_0x4326('0xa'));var crypto=require('crypto');var jsforce=require(_0x4326('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4326('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4326('0xc'));var qs=require(_0x4326('0xd'));var as=require(_0x4326('0xe'));var hardwareService=require(_0x4326('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x4326('0x10'));var config=require(_0x4326('0x11'));var licenseUtil=require(_0x4326('0x12'));var db=require(_0x4326('0x13'))['db'];config[_0x4326('0x14')]=_[_0x4326('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4326('0x16'))(new Redis(config[_0x4326('0x14')]));require(_0x4326('0x17'))[_0x4326('0x18')](socket);function respondWithStatusCode(_0x3ecec1,_0x547ea5){_0x547ea5=_0x547ea5||0xcc;return function(_0x12eee0){if(_0x12eee0){return _0x3ecec1[_0x4326('0x19')](_0x547ea5);}return _0x3ecec1[_0x4326('0x1a')](_0x547ea5)[_0x4326('0x1b')]();};}function respondWithResult(_0x3e3593,_0x54c7f2){_0x54c7f2=_0x54c7f2||0xc8;return function(_0x14acf2){if(_0x14acf2){return _0x3e3593['status'](_0x54c7f2)[_0x4326('0x1c')](_0x14acf2);}};}function respondWithFilteredResult(_0x28a9a6,_0x1ffefa){return function(_0x270b3e){if(_0x270b3e){var _0x2698cc=typeof _0x1ffefa[_0x4326('0x1d')]==='undefined'&&typeof _0x1ffefa[_0x4326('0x1e')]==='undefined';var _0x40b1ea=_0x270b3e[_0x4326('0x1f')];var _0x1613c5=_0x2698cc?0x0:_0x1ffefa[_0x4326('0x1d')];var _0x1272b3=_0x2698cc?_0x270b3e[_0x4326('0x1f')]:_0x1ffefa[_0x4326('0x1d')]+_0x1ffefa[_0x4326('0x1e')];var _0x1558d2;if(_0x1272b3>=_0x40b1ea){_0x1272b3=_0x40b1ea;_0x1558d2=0xc8;}else{_0x1558d2=0xce;}_0x28a9a6['status'](_0x1558d2);return _0x28a9a6['set'](_0x4326('0x20'),_0x1613c5+'-'+_0x1272b3+'/'+_0x40b1ea)[_0x4326('0x1c')](_0x270b3e);}return null;};}function patchUpdates(_0x351634){return function(_0x51d8fa){try{jsonpatch[_0x4326('0x21')](_0x51d8fa,_0x351634,!![]);}catch(_0x4df144){return BPromise[_0x4326('0x22')](_0x4df144);}return _0x51d8fa[_0x4326('0x23')]();};}function saveUpdates(_0x553cc6,_0x25162e){return function(_0x373501){if(_0x373501){return _0x373501[_0x4326('0x24')](_0x553cc6)[_0x4326('0x25')](function(_0x2937c4){return _0x2937c4;});}return null;};}function removeEntity(_0x4f6318,_0x11c4c5){return function(_0x4d41dd){if(_0x4d41dd){return _0x4d41dd['destroy']()[_0x4326('0x25')](function(){var _0x21403b=_0x4d41dd[_0x4326('0x26')]({'plain':!![]});var _0xb9f6d3=_0x4326('0x27');return db['UserProfileResource'][_0x4326('0x28')]({'where':{'type':_0xb9f6d3,'resourceId':_0x21403b['id']}})['then'](function(){return _0x4d41dd;});})[_0x4326('0x25')](function(){_0x4f6318[_0x4326('0x1a')](0xcc)[_0x4326('0x1b')]();});}};}function handleEntityNotFound(_0x3f07ca,_0x146439){return function(_0x1a8441){if(!_0x1a8441){_0x3f07ca['sendStatus'](0x194);}return _0x1a8441;};}function handleError(_0x4c2eac,_0x80f211){_0x80f211=_0x80f211||0x1f4;return function(_0x2419d7){logger[_0x4326('0x29')](_0x2419d7['stack']);if(_0x2419d7[_0x4326('0x2a')]){delete _0x2419d7[_0x4326('0x2a')];}_0x4c2eac[_0x4326('0x1a')](_0x80f211)[_0x4326('0x2b')](_0x2419d7);};}exports['index']=function(_0x61ce3a,_0x15fa58){var _0x3a448f={},_0x5f1150={},_0x54c384={'count':0x0,'rows':[]};var _0x4bc537=_[_0x4326('0x2c')](db['Dashboard'][_0x4326('0x2d')],function(_0x4da22c){return{'name':_0x4da22c[_0x4326('0x2e')],'type':_0x4da22c[_0x4326('0x2f')][_0x4326('0x30')]};});_0x5f1150[_0x4326('0x31')]=_[_0x4326('0x2c')](_0x4bc537,_0x4326('0x2a'));_0x5f1150[_0x4326('0x32')]=_[_0x4326('0x33')](_0x61ce3a[_0x4326('0x32')]);_0x5f1150[_0x4326('0x34')]=_[_0x4326('0x35')](_0x5f1150[_0x4326('0x31')],_0x5f1150[_0x4326('0x32')]);_0x3a448f['attributes']=_[_0x4326('0x35')](_0x5f1150['model'],qs[_0x4326('0x36')](_0x61ce3a[_0x4326('0x32')][_0x4326('0x36')]));_0x3a448f[_0x4326('0x37')]=_0x3a448f[_0x4326('0x37')][_0x4326('0x38')]?_0x3a448f['attributes']:_0x5f1150[_0x4326('0x31')];if(!_0x61ce3a[_0x4326('0x32')][_0x4326('0x39')]('nolimit')){_0x3a448f[_0x4326('0x1e')]=qs['limit'](_0x61ce3a['query'][_0x4326('0x1e')]);_0x3a448f[_0x4326('0x1d')]=qs[_0x4326('0x1d')](_0x61ce3a[_0x4326('0x32')]['offset']);}_0x3a448f['order']=qs[_0x4326('0x3a')](_0x61ce3a[_0x4326('0x32')]['sort']);_0x3a448f[_0x4326('0x3b')]=qs['filters'](_['pick'](_0x61ce3a[_0x4326('0x32')],_0x5f1150['filters']),_0x4bc537);if(_0x61ce3a[_0x4326('0x32')][_0x4326('0x3c')]){_0x3a448f[_0x4326('0x3b')]=_[_0x4326('0x3d')](_0x3a448f[_0x4326('0x3b')],{'$or':_[_0x4326('0x2c')](_0x4bc537,function(_0x3f3d57){if(_0x3f3d57[_0x4326('0x2f')]!==_0x4326('0x3e')){var _0x4de72a={};_0x4de72a[_0x3f3d57[_0x4326('0x2a')]]={'$like':'%'+_0x61ce3a['query'][_0x4326('0x3c')]+'%'};return _0x4de72a;}})});}_0x3a448f=_[_0x4326('0x3d')]({},_0x3a448f,_0x61ce3a[_0x4326('0x3f')]);var _0x2eae8c={'where':_0x3a448f[_0x4326('0x3b')]};return db[_0x4326('0x40')][_0x4326('0x1f')](_0x2eae8c)[_0x4326('0x25')](function(_0xa48151){_0x54c384[_0x4326('0x1f')]=_0xa48151;if(_0x61ce3a[_0x4326('0x32')]['includeAll']){_0x3a448f[_0x4326('0x41')]=[{'all':!![]}];}return db[_0x4326('0x40')][_0x4326('0x42')](_0x3a448f);})[_0x4326('0x25')](function(_0x566b0e){_0x54c384[_0x4326('0x43')]=_0x566b0e;return _0x54c384;})[_0x4326('0x25')](respondWithFilteredResult(_0x15fa58,_0x3a448f))[_0x4326('0x44')](handleError(_0x15fa58,null));};exports['show']=function(_0x187b73,_0x3b9489){var _0x5bff33={'raw':![],'where':{'id':_0x187b73[_0x4326('0x45')]['id']}},_0x44cdaa={};_0x44cdaa['model']=_[_0x4326('0x33')](db[_0x4326('0x40')][_0x4326('0x2d')]);_0x44cdaa[_0x4326('0x32')]=_[_0x4326('0x33')](_0x187b73['query']);_0x44cdaa['filters']=_[_0x4326('0x35')](_0x44cdaa[_0x4326('0x31')],_0x44cdaa['query']);_0x5bff33[_0x4326('0x37')]=_['intersection'](_0x44cdaa[_0x4326('0x31')],qs[_0x4326('0x36')](_0x187b73[_0x4326('0x32')]['fields']));_0x5bff33[_0x4326('0x37')]=_0x5bff33['attributes'][_0x4326('0x38')]?_0x5bff33[_0x4326('0x37')]:_0x44cdaa[_0x4326('0x31')];if(_0x187b73[_0x4326('0x32')]['includeAll']){_0x5bff33[_0x4326('0x41')]=[{'all':!![]}];}_0x5bff33=_[_0x4326('0x3d')]({},_0x5bff33,_0x187b73[_0x4326('0x3f')]);return db[_0x4326('0x40')][_0x4326('0x46')](_0x5bff33)['then'](handleEntityNotFound(_0x3b9489,null))[_0x4326('0x25')](respondWithResult(_0x3b9489,null))['catch'](handleError(_0x3b9489,null));};exports[_0x4326('0x47')]=function(_0x24693a,_0x2d71eb){return db[_0x4326('0x40')]['create'](_0x24693a[_0x4326('0x48')],{})[_0x4326('0x25')](function(_0x3ceb1c){var _0x29463f=_0x24693a[_0x4326('0x49')][_0x4326('0x26')]({'plain':!![]});if(!_0x29463f)throw new Error(_0x4326('0x4a'));if(_0x29463f[_0x4326('0x4b')]===_0x4326('0x49')){var _0x3ce5e3=_0x3ceb1c[_0x4326('0x26')]({'plain':!![]});var _0x54f7b4=_0x4326('0x27');return db[_0x4326('0x4c')][_0x4326('0x46')]({'where':{'name':_0x54f7b4,'userProfileId':_0x29463f[_0x4326('0x4d')]},'raw':!![]})[_0x4326('0x25')](function(_0x31f4f7){if(_0x31f4f7&&_0x31f4f7['autoAssociation']===0x0){return db['UserProfileResource'][_0x4326('0x47')]({'name':_0x3ce5e3[_0x4326('0x2a')],'resourceId':_0x3ce5e3['id'],'type':_0x31f4f7[_0x4326('0x2a')],'sectionId':_0x31f4f7['id']},{})[_0x4326('0x25')](function(){return _0x3ceb1c;});}else{return _0x3ceb1c;}})['catch'](function(_0x5e1164){logger[_0x4326('0x29')](_0x4326('0x4e'),_0x5e1164);throw _0x5e1164;});}return _0x3ceb1c;})[_0x4326('0x25')](respondWithResult(_0x2d71eb,0xc9))[_0x4326('0x44')](handleError(_0x2d71eb,null));};exports[_0x4326('0x4f')]=function(_0x5ac69e,_0x4c3325){var _0x4bd941={'where':{'id':_0x5ac69e['params']['id']}},_0x536ea0={};_0x536ea0['model']=_[_0x4326('0x33')](db[_0x4326('0x40')][_0x4326('0x2d')]);_0x4bd941['attributes']=_['intersection'](_0x536ea0[_0x4326('0x31')],qs[_0x4326('0x36')](_0x5ac69e[_0x4326('0x32')][_0x4326('0x36')]));_0x4bd941['attributes']=_0x4bd941['attributes'][_0x4326('0x38')]?_0x4bd941[_0x4326('0x37')]:_0x536ea0['model'];if(_0x5ac69e[_0x4326('0x32')][_0x4326('0x50')]){_0x4bd941['include']=[{'all':!![]}];}_0x4bd941=_[_0x4326('0x3d')]({},_0x4bd941,_0x5ac69e[_0x4326('0x3f')]);return db[_0x4326('0x40')][_0x4326('0x46')](_0x4bd941)[_0x4326('0x25')](handleEntityNotFound(_0x4c3325,null))[_0x4326('0x25')](function(_0x778e2c){if(_0x778e2c){var _0x14f1e5=_0x778e2c[_0x4326('0x26')]({'plain':!![]});_0x14f1e5=qs[_0x4326('0x51')](_0x14f1e5,['id',_0x4326('0x52'),_0x4326('0x53')]);_0x5ac69e['body']=_['omit'](_0x5ac69e[_0x4326('0x48')],['id',_0x4326('0x52'),_0x4326('0x53')]);return db[_0x4326('0x40')][_0x4326('0x47')](_['merge'](_0x14f1e5,_0x5ac69e[_0x4326('0x48')]),{'include':_0x5ac69e[_0x4326('0x32')][_0x4326('0x50')]?[{'all':!![]}]:undefined})[_0x4326('0x25')](function(_0x3f7895){var _0x26fcb7=_0x5ac69e[_0x4326('0x49')]['get']({'plain':!![]});if(!_0x26fcb7)throw new Error(_0x4326('0x4a'));if(_0x26fcb7[_0x4326('0x4b')]===_0x4326('0x49')){var _0xf7eda8=_0x3f7895[_0x4326('0x26')]({'plain':!![]});var _0x471b36=_0x4326('0x27');return db[_0x4326('0x4c')][_0x4326('0x46')]({'where':{'name':_0x471b36,'userProfileId':_0x26fcb7['userProfileId']},'raw':!![]})[_0x4326('0x25')](function(_0x296f11){if(_0x296f11&&_0x296f11[_0x4326('0x54')]===0x0){return db[_0x4326('0x55')][_0x4326('0x47')]({'name':_0xf7eda8[_0x4326('0x2a')],'resourceId':_0xf7eda8['id'],'type':_0x296f11['name'],'sectionId':_0x296f11['id']},{})['then'](function(){return _0x3f7895;});}else{return _0x3f7895;}})['catch'](function(_0x32afca){logger['error'](_0x4326('0x4e'),_0x32afca);throw _0x32afca;});}return _0x3f7895;});}})[_0x4326('0x25')](respondWithResult(_0x4c3325,0xc9))[_0x4326('0x44')](handleError(_0x4c3325,null));};exports[_0x4326('0x24')]=function(_0xf28bc1,_0x4c9e6d){if(_0xf28bc1['body']['id']){delete _0xf28bc1[_0x4326('0x48')]['id'];}return db[_0x4326('0x40')]['find']({'where':{'id':_0xf28bc1[_0x4326('0x45')]['id']}})[_0x4326('0x25')](handleEntityNotFound(_0x4c9e6d,null))[_0x4326('0x25')](saveUpdates(_0xf28bc1[_0x4326('0x48')],null))['then'](respondWithResult(_0x4c9e6d,null))[_0x4326('0x44')](handleError(_0x4c9e6d,null));};exports[_0x4326('0x28')]=function(_0x599246,_0x4e9afe){return db['Dashboard'][_0x4326('0x46')]({'where':{'id':_0x599246[_0x4326('0x45')]['id']}})[_0x4326('0x25')](handleEntityNotFound(_0x4e9afe,null))['then'](removeEntity(_0x4e9afe,null))['catch'](handleError(_0x4e9afe,null));};function widgetAttributes(_0x139ff4){try{switch(_0x139ff4[_0x4326('0x2f')]){case _0x4326('0x56'):return[{'name':_0x4326('0x57'),'value':_0x139ff4[_0x4326('0x57')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4[_0x4326('0x58')][0x0][_0x4326('0x59')]:undefined)||_0x4326('0x5a')}];case _0x4326('0x5b'):return[{'name':_0x4326('0x5c'),'value':_0x139ff4[_0x4326('0x5c')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4['attrs'][0x0]['value']:undefined)||''}];case _0x4326('0x5d'):return[{'name':_0x4326('0x5e'),'value':_0x139ff4[_0x4326('0x5e')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4[_0x4326('0x58')][0x0][_0x4326('0x59')]:undefined)||_0x4326('0x5f')},{'name':_0x4326('0x60'),'value':_0x139ff4[_0x4326('0x60')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x1]?_0x139ff4[_0x4326('0x58')][0x1]['value']:undefined)||_0x4326('0x61')},{'name':'attrFontSize','value':_0x139ff4[_0x4326('0x62')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x2]?_0x139ff4[_0x4326('0x58')][0x2][_0x4326('0x59')]:undefined)||0xc}];case _0x4326('0x63'):return[{'name':_0x4326('0x64'),'value':_0x139ff4['attrMetric']||(_0x139ff4['attrs']&&_0x139ff4['attrs'][0x0]?_0x139ff4['attrs'][0x0][_0x4326('0x59')]:undefined)||_0x4326('0x65')},{'name':_0x4326('0x66'),'value':_0x139ff4[_0x4326('0x66')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x1]?_0x139ff4[_0x4326('0x58')][0x1][_0x4326('0x59')]:undefined)||[]},{'name':'attrFontSize','value':_0x139ff4[_0x4326('0x62')]||(_0x139ff4['attrs']&&_0x139ff4['attrs'][0x2]?_0x139ff4[_0x4326('0x58')][0x2][_0x4326('0x59')]:undefined)||0x14},{'name':'attrChannel','value':_0x139ff4[_0x4326('0x67')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x3]?_0x139ff4[_0x4326('0x58')][0x3]['value']:undefined)||_0x4326('0x68')},{'name':_0x4326('0x69'),'value':_0x139ff4[_0x4326('0x69')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x4]?_0x139ff4[_0x4326('0x58')][0x4][_0x4326('0x59')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x139ff4['attrFaxAccounts']||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x5]?_0x139ff4[_0x4326('0x58')][0x5][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x6a'),'value':_0x139ff4[_0x4326('0x6a')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x6]?_0x139ff4[_0x4326('0x58')][0x6]['value']:undefined)||''},{'name':_0x4326('0x6b'),'value':_0x139ff4[_0x4326('0x6b')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x7]?_0x139ff4['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x139ff4['attrWhatsappAccounts']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x8]?_0x139ff4[_0x4326('0x58')][0x8][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x6c'),'value':_0x139ff4[_0x4326('0x6c')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x9]?_0x139ff4[_0x4326('0x58')][0x9][_0x4326('0x59')]:undefined)||''}];case _0x4326('0x6d'):case _0x4326('0x6e'):return[{'name':'attrSerie1','value':_0x139ff4[_0x4326('0x6f')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4[_0x4326('0x58')][0x0][_0x4326('0x59')]:undefined)||'total'},{'name':_0x4326('0x70'),'value':_0x139ff4[_0x4326('0x70')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x1]?_0x139ff4[_0x4326('0x58')][0x1][_0x4326('0x59')]:undefined)||null},{'name':_0x4326('0x71'),'value':_0x139ff4['attrSerie3']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x2]?_0x139ff4[_0x4326('0x58')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x139ff4['attrVoiceQueues']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x3]?_0x139ff4[_0x4326('0x58')][0x3][_0x4326('0x59')]:undefined)||[]},{'name':_0x4326('0x67'),'value':_0x139ff4[_0x4326('0x67')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x4]?_0x139ff4[_0x4326('0x58')][0x4][_0x4326('0x59')]:undefined)||_0x4326('0x68')},{'name':'attrEmailAccounts','value':_0x139ff4[_0x4326('0x69')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x5]?_0x139ff4['attrs'][0x5][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x72'),'value':_0x139ff4[_0x4326('0x72')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x6]?_0x139ff4[_0x4326('0x58')][0x6][_0x4326('0x59')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x139ff4[_0x4326('0x6a')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x7]?_0x139ff4[_0x4326('0x58')][0x7][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x6b'),'value':_0x139ff4[_0x4326('0x6b')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x8]?_0x139ff4[_0x4326('0x58')][0x8][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x73'),'value':_0x139ff4[_0x4326('0x73')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x9]?_0x139ff4[_0x4326('0x58')][0x9][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x6c'),'value':_0x139ff4[_0x4326('0x6c')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0xa]?_0x139ff4['attrs'][0xa][_0x4326('0x59')]:undefined)||''}];case _0x4326('0x74'):return[{'name':_0x4326('0x75'),'type':_0x139ff4['reportType']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4['attrs'][0x0]['type']:undefined)||null,'value':_0x139ff4['attrReport']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x0]?_0x139ff4[_0x4326('0x58')][0x0][_0x4326('0x59')]:undefined)||null},{'name':_0x4326('0x76'),'value':_0x139ff4['attrRefresh']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x1]?_0x139ff4['attrs'][0x1][_0x4326('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x3d405c){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x3d405c));return[];}}exports[_0x4326('0x77')]=function(_0x1cba5e,_0x549bd8,_0x552c75){if(_0x1cba5e[_0x4326('0x48')]['id']){delete _0x1cba5e[_0x4326('0x48')]['id'];}return db['Dashboard'][_0x4326('0x46')]({'where':{'id':_0x1cba5e[_0x4326('0x45')]['id']}})['then'](handleEntityNotFound(_0x549bd8,null))[_0x4326('0x25')](function(_0x190d36){if(_0x190d36){_0x1cba5e[_0x4326('0x48')][_0x4326('0x78')]=_0x190d36['id'];_0x1cba5e['body']['attrs']=widgetAttributes(_0x1cba5e[_0x4326('0x48')]);return db[_0x4326('0x79')][_0x4326('0x47')](_0x1cba5e[_0x4326('0x48')]);}})[_0x4326('0x25')](respondWithResult(_0x549bd8,null))[_0x4326('0x44')](handleError(_0x549bd8,null));};exports[_0x4326('0x7a')]=function(_0x2bc2ff,_0x34e296,_0x42794a){var _0x2d0d48={};var _0x6cabe5={};var _0x171c1d;var _0x554566;return db[_0x4326('0x40')][_0x4326('0x7b')]({'where':{'id':_0x2bc2ff[_0x4326('0x45')]['id']}})['then'](handleEntityNotFound(_0x34e296,null))[_0x4326('0x25')](function(_0x564d18){if(_0x564d18){_0x171c1d=_0x564d18;_0x6cabe5['model']=_[_0x4326('0x33')](db['DashboardItem']['rawAttributes']);_0x6cabe5[_0x4326('0x32')]=_[_0x4326('0x33')](_0x2bc2ff[_0x4326('0x32')]);_0x6cabe5[_0x4326('0x34')]=_[_0x4326('0x35')](_0x6cabe5['model'],_0x6cabe5[_0x4326('0x32')]);_0x2d0d48['attributes']=_[_0x4326('0x35')](_0x6cabe5[_0x4326('0x31')],qs['fields'](_0x2bc2ff[_0x4326('0x32')]['fields']));_0x2d0d48[_0x4326('0x37')]=_0x2d0d48['attributes']['length']?_0x2d0d48[_0x4326('0x37')]:_0x6cabe5[_0x4326('0x31')];_0x2d0d48[_0x4326('0x7c')]=qs[_0x4326('0x3a')](_0x2bc2ff[_0x4326('0x32')][_0x4326('0x3a')]);_0x2d0d48[_0x4326('0x3b')]=qs['filters'](_[_0x4326('0x7d')](_0x2bc2ff[_0x4326('0x32')],_0x6cabe5[_0x4326('0x34')]));if(_0x2bc2ff[_0x4326('0x32')][_0x4326('0x3c')]){_0x2d0d48[_0x4326('0x3b')]=_[_0x4326('0x3d')](_0x2d0d48['where'],{'$or':_[_0x4326('0x2c')](_0x2d0d48[_0x4326('0x37')],function(_0x390ff4){var _0x4ad749={};_0x4ad749[_0x390ff4]={'$like':'%'+_0x2bc2ff[_0x4326('0x32')]['filter']+'%'};return _0x4ad749;})});}_0x2d0d48=_[_0x4326('0x3d')]({},_0x2d0d48,_0x2bc2ff[_0x4326('0x3f')]);return _0x171c1d['getItems'](_0x2d0d48);}})['then'](function(_0x2ea89c){if(_0x2ea89c){_0x554566=_0x2ea89c['length'];if(!_0x2bc2ff[_0x4326('0x32')][_0x4326('0x39')](_0x4326('0x7e'))){_0x2d0d48[_0x4326('0x1e')]=qs[_0x4326('0x1e')](_0x2bc2ff['query'][_0x4326('0x1e')]);_0x2d0d48[_0x4326('0x1d')]=qs['offset'](_0x2bc2ff[_0x4326('0x32')][_0x4326('0x1d')]);}return _0x171c1d['getItems'](_0x2d0d48);}})[_0x4326('0x25')](function(_0x45f94c){if(_0x45f94c){return _0x45f94c?{'count':_0x554566,'rows':_0x45f94c}:null;}})[_0x4326('0x25')](respondWithResult(_0x34e296,null))[_0x4326('0x44')](handleError(_0x34e296,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index f4e41c6..8b2e366 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 _0x7d8a=['remove','emit','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x466fa7,_0x565305){var _0x1b8ca8=function(_0x511175){while(--_0x511175){_0x466fa7['push'](_0x466fa7['shift']());}};_0x1b8ca8(++_0x565305);}(_0x7d8a,0x1e1));var _0xa7d8=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7d8a[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require(_0xa7d8('0x0'));var Dashboard=require(_0xa7d8('0x1'))['db'][_0xa7d8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa7d8('0x3')](0x0);var events={'afterCreate':_0xa7d8('0x4'),'afterUpdate':'update','afterDestroy':_0xa7d8('0x5')};function emitEvent(_0x56174a){return function(_0x2a159d,_0x5bd17c,_0x46cdf2){DashboardEvents[_0xa7d8('0x6')](_0x56174a+':'+_0x2a159d['id'],_0x2a159d);DashboardEvents[_0xa7d8('0x6')](_0x56174a,_0x2a159d);_0x46cdf2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xa7d8('0x7')](e,emitEvent(event));}}module[_0xa7d8('0x8')]=DashboardEvents; \ No newline at end of file +var _0xd9d0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','update'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0xd9d0,0xe5));var _0x0d9d=function(_0x25d4b1,_0x4e896d){_0x25d4b1=_0x25d4b1-0x0;var _0x2d51a5=_0xd9d0[_0x25d4b1];return _0x2d51a5;};'use strict';var EventEmitter=require(_0x0d9d('0x0'));var Dashboard=require(_0x0d9d('0x1'))['db'][_0x0d9d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0d9d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d9d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3fd7e9){return function(_0x23ed48,_0x51f0b7,_0x408cbc){DashboardEvents[_0x0d9d('0x5')](_0x3fd7e9+':'+_0x23ed48['id'],_0x23ed48);DashboardEvents['emit'](_0x3fd7e9,_0x23ed48);_0x408cbc(null);};}for(var e in events){if(events[_0x0d9d('0x6')](e)){var event=events[e];Dashboard[_0x0d9d('0x7')](e,emitEvent(event));}}module[_0x0d9d('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ff26ce6..441e041 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 _0xe2b0=['./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xe2b0,0x185));var _0x0e2b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe2b0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0e2b('0x0'));var logger=require(_0x0e2b('0x1'))(_0x0e2b('0x2'));var moment=require(_0x0e2b('0x3'));var BPromise=require(_0x0e2b('0x4'));var rp=require(_0x0e2b('0x5'));var fs=require('fs');var path=require(_0x0e2b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0e2b('0x7'));module[_0x0e2b('0x8')]=function(_0x1a2aa1,_0x5a0a2a){return _0x1a2aa1[_0x0e2b('0x9')](_0x0e2b('0xa'),attributes,{'tableName':_0x0e2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ce1=['dashboards','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./dashboard.attributes','exports','Dashboard'];(function(_0x69a79e,_0x1cf909){var _0x2b1d0c=function(_0x5a0e26){while(--_0x5a0e26){_0x69a79e['push'](_0x69a79e['shift']());}};_0x2b1d0c(++_0x1cf909);}(_0x3ce1,0xbc));var _0x13ce=function(_0x5253c6,_0x45317e){_0x5253c6=_0x5253c6-0x0;var _0x2297c0=_0x3ce1[_0x5253c6];return _0x2297c0;};'use strict';var _=require(_0x13ce('0x0'));var util=require(_0x13ce('0x1'));var logger=require(_0x13ce('0x2'))('api');var moment=require(_0x13ce('0x3'));var BPromise=require(_0x13ce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13ce('0x5'));var rimraf=require(_0x13ce('0x6'));var config=require('../../config/environment');var attributes=require(_0x13ce('0x7'));module[_0x13ce('0x8')]=function(_0x149c70,_0x5e6b8a){return _0x149c70['define'](_0x13ce('0x9'),attributes,{'tableName':_0x13ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 6d3f15c..1a888b0 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 _0x5daa=['http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x299ca1,_0x596808){var _0x5322d7=function(_0x1618d7){while(--_0x1618d7){_0x299ca1['push'](_0x299ca1['shift']());}};_0x5322d7(++_0x596808);}(_0x5daa,0x18c));var _0xa5da=function(_0x269286,_0x4e4ac2){_0x269286=_0x269286-0x0;var _0x4c95d0=_0x5daa[_0x269286];return _0x4c95d0;};'use strict';var _=require('lodash');var util=require(_0xa5da('0x0'));var moment=require('moment');var BPromise=require(_0xa5da('0x1'));var rs=require(_0xa5da('0x2'));var fs=require('fs');var Redis=require(_0xa5da('0x3'));var db=require(_0xa5da('0x4'))['db'];var utils=require(_0xa5da('0x5'));var logger=require(_0xa5da('0x6'))(_0xa5da('0x7'));var config=require(_0xa5da('0x8'));var jayson=require(_0xa5da('0x9'));var client=jayson['client'][_0xa5da('0xa')]({'port':0x232a});config[_0xa5da('0xb')]=_[_0xa5da('0xc')](config[_0xa5da('0xb')],{'host':_0xa5da('0xd'),'port':0x18eb});var socket=require(_0xa5da('0xe'))(new Redis(config[_0xa5da('0xb')]));require(_0xa5da('0xf'))[_0xa5da('0x10')](socket);function respondWithRpcPromise(_0x220d9b,_0x16dfc8,_0x18ed8d){return new BPromise(function(_0x3848d,_0x287102){return client[_0xa5da('0x11')](_0x220d9b,_0x18ed8d)[_0xa5da('0x12')](function(_0x111295){logger[_0xa5da('0x13')](_0xa5da('0x14'),_0x16dfc8,_0xa5da('0x15'));logger[_0xa5da('0x16')](_0xa5da('0x17'),_0x16dfc8,_0xa5da('0x15'),JSON['stringify'](_0x111295));if(_0x111295[_0xa5da('0x18')]){if(_0x111295[_0xa5da('0x18')][_0xa5da('0x19')]===0x1f4){logger[_0xa5da('0x18')](_0xa5da('0x14'),_0x16dfc8,_0x111295[_0xa5da('0x18')]['message']);return _0x287102(_0x111295[_0xa5da('0x18')]['message']);}logger['error'](_0xa5da('0x14'),_0x16dfc8,_0x111295[_0xa5da('0x18')][_0xa5da('0x1a')]);return _0x3848d(_0x111295['error'][_0xa5da('0x1a')]);}else{logger[_0xa5da('0x13')](_0xa5da('0x14'),_0x16dfc8,_0xa5da('0x15'));_0x3848d(_0x111295[_0xa5da('0x1b')]['message']);}})[_0xa5da('0x1c')](function(_0x407bdb){logger[_0xa5da('0x18')]('Dashboard,\x20%s,\x20%s',_0x16dfc8,_0x407bdb);_0x287102(_0x407bdb);});});} \ No newline at end of file +var _0x961d=['then','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request'];(function(_0x5185e7,_0x27126d){var _0xcf6da9=function(_0x2251b4){while(--_0x2251b4){_0x5185e7['push'](_0x5185e7['shift']());}};_0xcf6da9(++_0x27126d);}(_0x961d,0x14a));var _0xd961=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x961d[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0xd961('0x0'));var util=require(_0xd961('0x1'));var moment=require(_0xd961('0x2'));var BPromise=require(_0xd961('0x3'));var rs=require(_0xd961('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd961('0x5'))['db'];var utils=require(_0xd961('0x6'));var logger=require('../../config/logger')(_0xd961('0x7'));var config=require(_0xd961('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd961('0x9')][_0xd961('0xa')]({'port':0x232a});config['redis']=_[_0xd961('0xb')](config[_0xd961('0xc')],{'host':_0xd961('0xd'),'port':0x18eb});var socket=require(_0xd961('0xe'))(new Redis(config[_0xd961('0xc')]));require(_0xd961('0xf'))[_0xd961('0x10')](socket);function respondWithRpcPromise(_0x3ef341,_0x5a3fcc,_0x4c486f){return new BPromise(function(_0x439443,_0x18c451){return client[_0xd961('0x11')](_0x3ef341,_0x4c486f)[_0xd961('0x12')](function(_0x699352){logger[_0xd961('0x13')](_0xd961('0x14'),_0x5a3fcc,'request\x20sent');logger['debug'](_0xd961('0x15'),_0x5a3fcc,_0xd961('0x16'),JSON[_0xd961('0x17')](_0x699352));if(_0x699352[_0xd961('0x18')]){if(_0x699352[_0xd961('0x18')][_0xd961('0x19')]===0x1f4){logger[_0xd961('0x18')](_0xd961('0x14'),_0x5a3fcc,_0x699352[_0xd961('0x18')][_0xd961('0x1a')]);return _0x18c451(_0x699352[_0xd961('0x18')][_0xd961('0x1a')]);}logger['error'](_0xd961('0x14'),_0x5a3fcc,_0x699352[_0xd961('0x18')][_0xd961('0x1a')]);return _0x439443(_0x699352['error'][_0xd961('0x1a')]);}else{logger[_0xd961('0x13')](_0xd961('0x14'),_0x5a3fcc,_0xd961('0x16'));_0x439443(_0x699352[_0xd961('0x1b')][_0xd961('0x1a')]);}})[_0xd961('0x1c')](function(_0x309a4a){logger['error'](_0xd961('0x14'),_0x5a3fcc,_0x309a4a);_0x18c451(_0x309a4a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2910055..d9f80df 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 _0x42a2=['removeListener','dashboard:','./dashboard.events','save','update','emit'];(function(_0x20480a,_0x137a6f){var _0x406718=function(_0x352d9c){while(--_0x352d9c){_0x20480a['push'](_0x20480a['shift']());}};_0x406718(++_0x137a6f);}(_0x42a2,0xd4));var _0x242a=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x42a2[_0x8a969d];return _0x1d8dc7;};'use strict';var DashboardEvents=require(_0x242a('0x0'));var events=[_0x242a('0x1'),'remove',_0x242a('0x2')];function createListener(_0xaaa4e,_0x59a9e4){return function(_0x19f6de){_0x59a9e4[_0x242a('0x3')](_0xaaa4e,_0x19f6de);};}function removeListener(_0x5761d1,_0x4404e6){return function(){DashboardEvents[_0x242a('0x4')](_0x5761d1,_0x4404e6);};}exports['register']=function(_0x37d997){for(var _0x2d6948=0x0,_0x2e3b57=events['length'];_0x2d6948<_0x2e3b57;_0x2d6948++){var _0x112da5=events[_0x2d6948];var _0x26399d=createListener(_0x242a('0x5')+_0x112da5,_0x37d997);DashboardEvents['on'](_0x112da5,_0x26399d);}}; \ No newline at end of file +var _0x54cc=['removeListener','register','length','dashboard:','remove','update','emit'];(function(_0x371213,_0x4c4187){var _0x531244=function(_0x209a3d){while(--_0x209a3d){_0x371213['push'](_0x371213['shift']());}};_0x531244(++_0x4c4187);}(_0x54cc,0x1d9));var _0xc54c=function(_0xd349bc,_0x1d436e){_0xd349bc=_0xd349bc-0x0;var _0x638079=_0x54cc[_0xd349bc];return _0x638079;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xc54c('0x0'),_0xc54c('0x1')];function createListener(_0x26f6f3,_0xe347f0){return function(_0x56b5e5){_0xe347f0[_0xc54c('0x2')](_0x26f6f3,_0x56b5e5);};}function removeListener(_0x4fed07,_0x5bbf50){return function(){DashboardEvents[_0xc54c('0x3')](_0x4fed07,_0x5bbf50);};}exports[_0xc54c('0x4')]=function(_0x97703c){for(var _0x5883f2=0x0,_0x9883eb=events[_0xc54c('0x5')];_0x5883f2<_0x9883eb;_0x5883f2++){var _0x1834a3=events[_0x5883f2];var _0xad4c28=createListener(_0xc54c('0x6')+_0x1834a3,_0x97703c);DashboardEvents['on'](_0x1834a3,_0xad4c28);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 6193105..68de6ab 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 _0xcff5=['getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','./dashboard.controller','get','isAuthenticated','index','/:id','show'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0xcff5,0x8e));var _0x5cff=function(_0x2eda7d,_0x162382){_0x2eda7d=_0x2eda7d-0x0;var _0x2fd21d=_0xcff5[_0x2eda7d];return _0x2fd21d;};'use strict';var multer=require(_0x5cff('0x0'));var util=require('util');var path=require(_0x5cff('0x1'));var timeout=require('connect-timeout');var express=require(_0x5cff('0x2'));var router=express[_0x5cff('0x3')]();var fs_extra=require(_0x5cff('0x4'));var auth=require(_0x5cff('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5cff('0x6'));router[_0x5cff('0x7')]('/',auth[_0x5cff('0x8')](),controller[_0x5cff('0x9')]);router[_0x5cff('0x7')](_0x5cff('0xa'),auth[_0x5cff('0x8')](),controller[_0x5cff('0xb')]);router['get']('/:id/items',auth[_0x5cff('0x8')](),controller[_0x5cff('0xc')]);router[_0x5cff('0xd')]('/',auth[_0x5cff('0x8')](),controller[_0x5cff('0xe')]);router[_0x5cff('0xd')](_0x5cff('0xf'),auth[_0x5cff('0x8')](),controller[_0x5cff('0x10')]);router[_0x5cff('0xd')]('/:id/items',auth[_0x5cff('0x8')](),controller[_0x5cff('0x11')]);router[_0x5cff('0x12')](_0x5cff('0xa'),auth[_0x5cff('0x8')](),controller[_0x5cff('0x13')]);router[_0x5cff('0x14')](_0x5cff('0xa'),auth[_0x5cff('0x8')](),controller[_0x5cff('0x15')]);module['exports']=router; \ No newline at end of file +var _0x09e8=['getItems','post','create','/:id/clone','clone','addItem','put','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','index','/:id','show','/:id/items','isAuthenticated'];(function(_0x3fa325,_0x119391){var _0x34c97d=function(_0x1ffba8){while(--_0x1ffba8){_0x3fa325['push'](_0x3fa325['shift']());}};_0x34c97d(++_0x119391);}(_0x09e8,0xc1));var _0x809e=function(_0x4efaff,_0x4626bc){_0x4efaff=_0x4efaff-0x0;var _0x566b79=_0x09e8[_0x4efaff];return _0x566b79;};'use strict';var multer=require(_0x809e('0x0'));var util=require(_0x809e('0x1'));var path=require(_0x809e('0x2'));var timeout=require(_0x809e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x809e('0x4'));var auth=require(_0x809e('0x5'));var interaction=require(_0x809e('0x6'));var config=require('../../config/environment');var controller=require(_0x809e('0x7'));router[_0x809e('0x8')]('/',auth['isAuthenticated'](),controller[_0x809e('0x9')]);router[_0x809e('0x8')](_0x809e('0xa'),auth['isAuthenticated'](),controller[_0x809e('0xb')]);router[_0x809e('0x8')](_0x809e('0xc'),auth[_0x809e('0xd')](),controller[_0x809e('0xe')]);router[_0x809e('0xf')]('/',auth['isAuthenticated'](),controller[_0x809e('0x10')]);router[_0x809e('0xf')](_0x809e('0x11'),auth[_0x809e('0xd')](),controller[_0x809e('0x12')]);router[_0x809e('0xf')](_0x809e('0xc'),auth[_0x809e('0xd')](),controller[_0x809e('0x13')]);router[_0x809e('0x14')]('/:id',auth[_0x809e('0xd')](),controller[_0x809e('0x15')]);router['delete'](_0x809e('0xa'),auth['isAuthenticated'](),controller[_0x809e('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 667d07b..b424089 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 _0xfcf0=['sequelize','squel','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1f4b18,_0x4e777c){_0x1f4b18=_0x1f4b18-0x0;var _0xde3957=_0xfcf0[_0x1f4b18];return _0xde3957;};'use strict';var Sequelize=require(_0x0fcf('0x0'));var squel=require(_0x0fcf('0x1'));var _=require('lodash');module[_0x0fcf('0x2')]={'title':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0fcf('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0fcf('0x4')]('long'),'get':function(){try{return JSON[_0x0fcf('0x5')](this[_0x0fcf('0x6')](_0x0fcf('0x7')));}catch(_0x3af316){return[];}},'set':function(_0x1bace8){try{this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')](_0x1bace8));}catch(_0x50c575){this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0fcf('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0fcf('0xa')]},'col':{'type':Sequelize[_0x0fcf('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0fcf('0x3')]},'titleFontSize':{'type':Sequelize[_0x0fcf('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xd8fb=['exports','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','STRING','sequelize','squel','lodash'];(function(_0x4f5c57,_0x1099d3){var _0x5097b6=function(_0x2a7cd5){while(--_0x2a7cd5){_0x4f5c57['push'](_0x4f5c57['shift']());}};_0x5097b6(++_0x1099d3);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3253c3,_0x429ce0){_0x3253c3=_0x3253c3-0x0;var _0x493dc1=_0xd8fb[_0x3253c3];return _0x493dc1;};'use strict';var Sequelize=require(_0xbd8f('0x0'));var squel=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));module[_0xbd8f('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xbd8f('0x4')),'get':function(){try{return JSON[_0xbd8f('0x5')](this['getDataValue'](_0xbd8f('0x6')));}catch(_0x2343bf){return[];}},'set':function(_0x5543b2){try{this[_0xbd8f('0x7')]('attrs',JSON[_0xbd8f('0x8')](_0x5543b2));}catch(_0x578499){this[_0xbd8f('0x7')](_0xbd8f('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xbd8f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xbd8f('0x9')]},'col':{'type':Sequelize[_0xbd8f('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd8f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xbd8f('0xb')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xbd8f('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 3b0a30d..52d8480 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 _0x06ae=['api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','DashboardItem','query','keys','filters','attributes','intersection','fields','length','includeAll','merge','find','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x24c363,_0x53a389){var _0x1b351f=function(_0x156d8e){while(--_0x156d8e){_0x24c363['push'](_0x24c363['shift']());}};_0x1b351f(++_0x53a389);}(_0x06ae,0x16e));var _0xe06a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x06ae[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe06a('0x0'));var zipdir=require(_0xe06a('0x1'));var jsonpatch=require(_0xe06a('0x2'));var rp=require(_0xe06a('0x3'));var moment=require(_0xe06a('0x4'));var BPromise=require(_0xe06a('0x5'));var Mustache=require(_0xe06a('0x6'));var util=require(_0xe06a('0x7'));var path=require(_0xe06a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe06a('0x9'));var _=require(_0xe06a('0xa'));var squel=require(_0xe06a('0xb'));var crypto=require(_0xe06a('0xc'));var jsforce=require(_0xe06a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe06a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe06a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe06a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe06a('0x11'))(_0xe06a('0x12'));var utils=require('../../config/utils');var config=require(_0xe06a('0x13'));var licenseUtil=require(_0xe06a('0x14'));var db=require('../../mysqldb')['db'];config[_0xe06a('0x15')]=_[_0xe06a('0x16')](config[_0xe06a('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xe06a('0x17'))(new Redis(config[_0xe06a('0x15')]));require(_0xe06a('0x18'))[_0xe06a('0x19')](socket);function respondWithStatusCode(_0x335c0d,_0x49decd){_0x49decd=_0x49decd||0xcc;return function(_0x1284bf){if(_0x1284bf){return _0x335c0d[_0xe06a('0x1a')](_0x49decd);}return _0x335c0d[_0xe06a('0x1b')](_0x49decd)[_0xe06a('0x1c')]();};}function respondWithResult(_0x4d0e41,_0x403a92){_0x403a92=_0x403a92||0xc8;return function(_0x57b590){if(_0x57b590){return _0x4d0e41[_0xe06a('0x1b')](_0x403a92)['json'](_0x57b590);}};}function respondWithFilteredResult(_0x534380,_0x4941ce){return function(_0x7a5a6f){if(_0x7a5a6f){var _0x43ce7b=typeof _0x4941ce[_0xe06a('0x1d')]==='undefined'&&typeof _0x4941ce[_0xe06a('0x1e')]===_0xe06a('0x1f');var _0x5806b6=_0x7a5a6f[_0xe06a('0x20')];var _0x5382a6=_0x43ce7b?0x0:_0x4941ce[_0xe06a('0x1d')];var _0x4a2681=_0x43ce7b?_0x7a5a6f['count']:_0x4941ce[_0xe06a('0x1d')]+_0x4941ce[_0xe06a('0x1e')];var _0x1e7f25;if(_0x4a2681>=_0x5806b6){_0x4a2681=_0x5806b6;_0x1e7f25=0xc8;}else{_0x1e7f25=0xce;}_0x534380[_0xe06a('0x1b')](_0x1e7f25);return _0x534380[_0xe06a('0x21')](_0xe06a('0x22'),_0x5382a6+'-'+_0x4a2681+'/'+_0x5806b6)[_0xe06a('0x23')](_0x7a5a6f);}return null;};}function patchUpdates(_0x2c30c7){return function(_0x275668){try{jsonpatch[_0xe06a('0x24')](_0x275668,_0x2c30c7,!![]);}catch(_0x5970d9){return BPromise[_0xe06a('0x25')](_0x5970d9);}return _0x275668[_0xe06a('0x26')]();};}function saveUpdates(_0xf13325,_0x82ba72){return function(_0x352434){if(_0x352434){return _0x352434[_0xe06a('0x27')](_0xf13325)[_0xe06a('0x28')](function(_0x19a7e0){return _0x19a7e0;});}return null;};}function removeEntity(_0x456d2d,_0x4ef4ca){return function(_0x53bdca){if(_0x53bdca){return _0x53bdca[_0xe06a('0x29')]()['then'](function(){_0x456d2d[_0xe06a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4afa75,_0x5e0b56){return function(_0x37ff49){if(!_0x37ff49){_0x4afa75[_0xe06a('0x1a')](0x194);}return _0x37ff49;};}function handleError(_0x58525a,_0x217f24){_0x217f24=_0x217f24||0x1f4;return function(_0x1613d8){logger[_0xe06a('0x2a')](_0x1613d8[_0xe06a('0x2b')]);if(_0x1613d8[_0xe06a('0x2c')]){delete _0x1613d8[_0xe06a('0x2c')];}_0x58525a[_0xe06a('0x1b')](_0x217f24)[_0xe06a('0x2d')](_0x1613d8);};}exports[_0xe06a('0x2e')]=function(_0x50aded,_0x4bee48){var _0x177d3e={'raw':![],'where':{'id':_0x50aded[_0xe06a('0x2f')]['id']}},_0x1f985b={};_0x1f985b[_0xe06a('0x30')]=_['keys'](db[_0xe06a('0x31')]['rawAttributes']);_0x1f985b[_0xe06a('0x32')]=_[_0xe06a('0x33')](_0x50aded[_0xe06a('0x32')]);_0x1f985b[_0xe06a('0x34')]=_['intersection'](_0x1f985b[_0xe06a('0x30')],_0x1f985b[_0xe06a('0x32')]);_0x177d3e[_0xe06a('0x35')]=_[_0xe06a('0x36')](_0x1f985b['model'],qs['fields'](_0x50aded[_0xe06a('0x32')][_0xe06a('0x37')]));_0x177d3e[_0xe06a('0x35')]=_0x177d3e[_0xe06a('0x35')][_0xe06a('0x38')]?_0x177d3e[_0xe06a('0x35')]:_0x1f985b['model'];if(_0x50aded['query'][_0xe06a('0x39')]){_0x177d3e['include']=[{'all':!![]}];}_0x177d3e=_[_0xe06a('0x3a')]({},_0x177d3e,_0x50aded['options']);return db[_0xe06a('0x31')][_0xe06a('0x3b')](_0x177d3e)[_0xe06a('0x28')](handleEntityNotFound(_0x4bee48,null))['then'](respondWithResult(_0x4bee48,null))['catch'](handleError(_0x4bee48,null));};exports[_0xe06a('0x29')]=function(_0xb0e44c,_0xefd764){return db[_0xe06a('0x31')][_0xe06a('0x3b')]({'where':{'id':_0xb0e44c[_0xe06a('0x2f')]['id']}})['then'](handleEntityNotFound(_0xefd764,null))['then'](removeEntity(_0xefd764,null))['catch'](handleError(_0xefd764,null));};function widgetAttributes(_0x598caf){try{switch(_0x598caf[_0xe06a('0x3c')]){case _0xe06a('0x3d'):return[{'name':_0xe06a('0x3e'),'value':_0x598caf[_0xe06a('0x3e')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf['attrs'][0x0]?_0x598caf[_0xe06a('0x3f')][0x0][_0xe06a('0x40')]:undefined)||_0xe06a('0x41')}];case'custom':return[{'name':_0xe06a('0x42'),'value':_0x598caf[_0xe06a('0x42')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x0]?_0x598caf[_0xe06a('0x3f')][0x0][_0xe06a('0x40')]:undefined)||''}];case _0xe06a('0x43'):return[{'name':_0xe06a('0x44'),'value':_0x598caf['attrHourFormat']||(_0x598caf['attrs']&&_0x598caf[_0xe06a('0x3f')][0x0]?_0x598caf['attrs'][0x0]['value']:undefined)||_0xe06a('0x45')},{'name':_0xe06a('0x46'),'value':_0x598caf[_0xe06a('0x46')]||(_0x598caf['attrs']&&_0x598caf['attrs'][0x1]?_0x598caf[_0xe06a('0x3f')][0x1][_0xe06a('0x40')]:undefined)||_0xe06a('0x47')},{'name':_0xe06a('0x48'),'value':_0x598caf['attrFontSize']||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf['attrs'][0x2]?_0x598caf[_0xe06a('0x3f')][0x2][_0xe06a('0x40')]:undefined)||0xc}];case'counter':return[{'name':_0xe06a('0x49'),'value':_0x598caf[_0xe06a('0x49')]||(_0x598caf['attrs']&&_0x598caf['attrs'][0x0]?_0x598caf['attrs'][0x0]['value']:undefined)||_0xe06a('0x4a')},{'name':'attrVoiceQueues','value':_0x598caf['attrVoiceQueues']||(_0x598caf['attrs']&&_0x598caf['attrs'][0x1]?_0x598caf[_0xe06a('0x3f')][0x1][_0xe06a('0x40')]:undefined)||[]},{'name':_0xe06a('0x48'),'value':_0x598caf[_0xe06a('0x48')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x2]?_0x598caf['attrs'][0x2][_0xe06a('0x40')]:undefined)||0x14},{'name':_0xe06a('0x4b'),'value':_0x598caf[_0xe06a('0x4b')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x3]?_0x598caf['attrs'][0x3]['value']:undefined)||_0xe06a('0x4c')},{'name':_0xe06a('0x4d'),'value':_0x598caf[_0xe06a('0x4d')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf['attrs'][0x4]?_0x598caf[_0xe06a('0x3f')][0x4][_0xe06a('0x40')]:undefined)||''},{'name':_0xe06a('0x4e'),'value':_0x598caf['attrFaxAccounts']||(_0x598caf['attrs']&&_0x598caf['attrs'][0x5]?_0x598caf[_0xe06a('0x3f')][0x5][_0xe06a('0x40')]:undefined)||''},{'name':_0xe06a('0x4f'),'value':_0x598caf[_0xe06a('0x4f')]||(_0x598caf['attrs']&&_0x598caf[_0xe06a('0x3f')][0x6]?_0x598caf[_0xe06a('0x3f')][0x6][_0xe06a('0x40')]:undefined)||''},{'name':_0xe06a('0x50'),'value':_0x598caf[_0xe06a('0x50')]||(_0x598caf['attrs']&&_0x598caf[_0xe06a('0x3f')][0x7]?_0x598caf[_0xe06a('0x3f')][0x7][_0xe06a('0x40')]:undefined)||''},{'name':_0xe06a('0x51'),'value':_0x598caf['attrWhatsappAccounts']||(_0x598caf['attrs']&&_0x598caf[_0xe06a('0x3f')][0x8]?_0x598caf[_0xe06a('0x3f')][0x8][_0xe06a('0x40')]:undefined)||''},{'name':'attrChatWebsites','value':_0x598caf[_0xe06a('0x52')]||(_0x598caf['attrs']&&_0x598caf[_0xe06a('0x3f')][0x9]?_0x598caf['attrs'][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0xe06a('0x53'),'value':_0x598caf['attrSerie1']||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x0]?_0x598caf[_0xe06a('0x3f')][0x0][_0xe06a('0x40')]:undefined)||_0xe06a('0x4a')},{'name':'attrSerie2','value':_0x598caf[_0xe06a('0x54')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x1]?_0x598caf[_0xe06a('0x3f')][0x1]['value']:undefined)||null},{'name':_0xe06a('0x55'),'value':_0x598caf[_0xe06a('0x55')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x2]?_0x598caf[_0xe06a('0x3f')][0x2][_0xe06a('0x40')]:undefined)||null},{'name':_0xe06a('0x56'),'value':_0x598caf[_0xe06a('0x56')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x3]?_0x598caf[_0xe06a('0x3f')][0x3][_0xe06a('0x40')]:undefined)||[]},{'name':_0xe06a('0x4b'),'value':_0x598caf[_0xe06a('0x4b')]||(_0x598caf['attrs']&&_0x598caf['attrs'][0x4]?_0x598caf[_0xe06a('0x3f')][0x4]['value']:undefined)||_0xe06a('0x4c')},{'name':_0xe06a('0x4d'),'value':_0x598caf[_0xe06a('0x4d')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x5]?_0x598caf[_0xe06a('0x3f')][0x5][_0xe06a('0x40')]:undefined)||''},{'name':_0xe06a('0x4e'),'value':_0x598caf[_0xe06a('0x4e')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x6]?_0x598caf[_0xe06a('0x3f')][0x6]['value']:undefined)||''},{'name':_0xe06a('0x4f'),'value':_0x598caf[_0xe06a('0x4f')]||(_0x598caf['attrs']&&_0x598caf['attrs'][0x7]?_0x598caf[_0xe06a('0x3f')][0x7]['value']:undefined)||''},{'name':_0xe06a('0x50'),'value':_0x598caf[_0xe06a('0x50')]||(_0x598caf['attrs']&&_0x598caf[_0xe06a('0x3f')][0x8]?_0x598caf[_0xe06a('0x3f')][0x8]['value']:undefined)||''},{'name':_0xe06a('0x51'),'value':_0x598caf[_0xe06a('0x51')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x9]?_0x598caf[_0xe06a('0x3f')][0x9][_0xe06a('0x40')]:undefined)||''},{'name':_0xe06a('0x52'),'value':_0x598caf[_0xe06a('0x52')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0xa]?_0x598caf[_0xe06a('0x3f')][0xa][_0xe06a('0x40')]:undefined)||''}];case _0xe06a('0x57'):return[{'name':_0xe06a('0x58'),'type':_0x598caf[_0xe06a('0x59')]||(_0x598caf['attrs']&&_0x598caf[_0xe06a('0x3f')][0x0]?_0x598caf[_0xe06a('0x3f')][0x0]['type']:undefined)||null,'value':_0x598caf[_0xe06a('0x58')]||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x0]?_0x598caf[_0xe06a('0x3f')][0x0][_0xe06a('0x40')]:undefined)||null},{'name':_0xe06a('0x5a'),'value':_0x598caf['attrRefresh']||(_0x598caf[_0xe06a('0x3f')]&&_0x598caf[_0xe06a('0x3f')][0x1]?_0x598caf[_0xe06a('0x3f')][0x1][_0xe06a('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x33c033){logger[_0xe06a('0x2a')](_0xe06a('0x5b'),JSON[_0xe06a('0x5c')](_0x33c033));return[];}}exports['create']=function(_0x23a8da,_0x1895da){if(_0x23a8da[_0xe06a('0x5d')]){_0x23a8da[_0xe06a('0x5d')][_0xe06a('0x3f')]=widgetAttributes(_0x23a8da[_0xe06a('0x5d')]);}return db[_0xe06a('0x31')][_0xe06a('0x5e')](_0x23a8da[_0xe06a('0x5d')],{})[_0xe06a('0x28')](respondWithResult(_0x1895da,0xc9))[_0xe06a('0x5f')](handleError(_0x1895da,null));};exports['update']=function(_0x2d0340,_0x3c6704){if(_0x2d0340[_0xe06a('0x5d')]['id']){delete _0x2d0340[_0xe06a('0x5d')]['id'];}_0x2d0340[_0xe06a('0x5d')][_0xe06a('0x3f')]=widgetAttributes(_0x2d0340[_0xe06a('0x5d')]);return db[_0xe06a('0x31')][_0xe06a('0x3b')]({'where':{'id':_0x2d0340[_0xe06a('0x2f')]['id']}})[_0xe06a('0x28')](handleEntityNotFound(_0x3c6704,null))[_0xe06a('0x28')](saveUpdates(_0x2d0340[_0xe06a('0x5d')],null))[_0xe06a('0x28')](respondWithResult(_0x3c6704,null))['catch'](handleError(_0x3c6704,null));}; \ No newline at end of file +var _0x7923=['intersection','fields','length','query','merge','options','find','then','destroy','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','stringify','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','filters','attributes'];(function(_0x4eb3fc,_0x3b443b){var _0x2a8249=function(_0xf039e0){while(--_0xf039e0){_0x4eb3fc['push'](_0x4eb3fc['shift']());}};_0x2a8249(++_0x3b443b);}(_0x7923,0x8f));var _0x3792=function(_0x10e49c,_0x27e27b){_0x10e49c=_0x10e49c-0x0;var _0x87cf6a=_0x7923[_0x10e49c];return _0x87cf6a;};'use strict';var emlformat=require(_0x3792('0x0'));var rimraf=require(_0x3792('0x1'));var zipdir=require(_0x3792('0x2'));var jsonpatch=require(_0x3792('0x3'));var rp=require(_0x3792('0x4'));var moment=require(_0x3792('0x5'));var BPromise=require(_0x3792('0x6'));var Mustache=require('mustache');var util=require(_0x3792('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3792('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3792('0x9'));var _=require(_0x3792('0xa'));var squel=require(_0x3792('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3792('0xc'));var toCsv=require(_0x3792('0x8'));var querystring=require('querystring');var Papa=require(_0x3792('0xd'));var Redis=require(_0x3792('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3792('0xf'));var as=require(_0x3792('0x10'));var hardwareService=require(_0x3792('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3792('0x12'));var config=require(_0x3792('0x13'));var licenseUtil=require(_0x3792('0x14'));var db=require(_0x3792('0x15'))['db'];config['redis']=_['defaults'](config[_0x3792('0x16')],{'host':_0x3792('0x17'),'port':0x18eb});var socket=require(_0x3792('0x18'))(new Redis(config[_0x3792('0x16')]));require(_0x3792('0x19'))[_0x3792('0x1a')](socket);function respondWithStatusCode(_0x41139d,_0x2dc722){_0x2dc722=_0x2dc722||0xcc;return function(_0x44398b){if(_0x44398b){return _0x41139d[_0x3792('0x1b')](_0x2dc722);}return _0x41139d[_0x3792('0x1c')](_0x2dc722)[_0x3792('0x1d')]();};}function respondWithResult(_0x4247cd,_0x26a4ba){_0x26a4ba=_0x26a4ba||0xc8;return function(_0x46653b){if(_0x46653b){return _0x4247cd[_0x3792('0x1c')](_0x26a4ba)[_0x3792('0x1e')](_0x46653b);}};}function respondWithFilteredResult(_0x4a8e1c,_0x24eb3c){return function(_0x2547d8){if(_0x2547d8){var _0xb69786=typeof _0x24eb3c[_0x3792('0x1f')]===_0x3792('0x20')&&typeof _0x24eb3c['limit']===_0x3792('0x20');var _0xc75467=_0x2547d8[_0x3792('0x21')];var _0x3c36b5=_0xb69786?0x0:_0x24eb3c[_0x3792('0x1f')];var _0x5647ac=_0xb69786?_0x2547d8['count']:_0x24eb3c[_0x3792('0x1f')]+_0x24eb3c[_0x3792('0x22')];var _0x4e0ba4;if(_0x5647ac>=_0xc75467){_0x5647ac=_0xc75467;_0x4e0ba4=0xc8;}else{_0x4e0ba4=0xce;}_0x4a8e1c[_0x3792('0x1c')](_0x4e0ba4);return _0x4a8e1c[_0x3792('0x23')](_0x3792('0x24'),_0x3c36b5+'-'+_0x5647ac+'/'+_0xc75467)['json'](_0x2547d8);}return null;};}function patchUpdates(_0x4ca818){return function(_0x2d1ab5){try{jsonpatch[_0x3792('0x25')](_0x2d1ab5,_0x4ca818,!![]);}catch(_0x3fa77a){return BPromise[_0x3792('0x26')](_0x3fa77a);}return _0x2d1ab5['save']();};}function saveUpdates(_0x515dc0,_0x48f41c){return function(_0x21c266){if(_0x21c266){return _0x21c266[_0x3792('0x27')](_0x515dc0)['then'](function(_0x530c04){return _0x530c04;});}return null;};}function removeEntity(_0x3bf510,_0x2328fe){return function(_0x401080){if(_0x401080){return _0x401080['destroy']()['then'](function(){_0x3bf510[_0x3792('0x1c')](0xcc)[_0x3792('0x1d')]();});}};}function handleEntityNotFound(_0x53369e,_0x483e79){return function(_0x7e2964){if(!_0x7e2964){_0x53369e[_0x3792('0x1b')](0x194);}return _0x7e2964;};}function handleError(_0x1334d2,_0x2908ab){_0x2908ab=_0x2908ab||0x1f4;return function(_0x4ca06c){logger['error'](_0x4ca06c[_0x3792('0x28')]);if(_0x4ca06c[_0x3792('0x29')]){delete _0x4ca06c[_0x3792('0x29')];}_0x1334d2[_0x3792('0x1c')](_0x2908ab)[_0x3792('0x2a')](_0x4ca06c);};}exports[_0x3792('0x2b')]=function(_0x2816e9,_0x44cc37){var _0xe83f5c={'raw':![],'where':{'id':_0x2816e9[_0x3792('0x2c')]['id']}},_0x4b2ba4={};_0x4b2ba4[_0x3792('0x2d')]=_[_0x3792('0x2e')](db[_0x3792('0x2f')][_0x3792('0x30')]);_0x4b2ba4['query']=_['keys'](_0x2816e9['query']);_0x4b2ba4[_0x3792('0x31')]=_['intersection'](_0x4b2ba4[_0x3792('0x2d')],_0x4b2ba4['query']);_0xe83f5c[_0x3792('0x32')]=_[_0x3792('0x33')](_0x4b2ba4[_0x3792('0x2d')],qs[_0x3792('0x34')](_0x2816e9['query'][_0x3792('0x34')]));_0xe83f5c['attributes']=_0xe83f5c['attributes'][_0x3792('0x35')]?_0xe83f5c[_0x3792('0x32')]:_0x4b2ba4[_0x3792('0x2d')];if(_0x2816e9[_0x3792('0x36')]['includeAll']){_0xe83f5c['include']=[{'all':!![]}];}_0xe83f5c=_[_0x3792('0x37')]({},_0xe83f5c,_0x2816e9[_0x3792('0x38')]);return db[_0x3792('0x2f')][_0x3792('0x39')](_0xe83f5c)[_0x3792('0x3a')](handleEntityNotFound(_0x44cc37,null))[_0x3792('0x3a')](respondWithResult(_0x44cc37,null))['catch'](handleError(_0x44cc37,null));};exports[_0x3792('0x3b')]=function(_0x46187c,_0x11c655){return db[_0x3792('0x2f')][_0x3792('0x39')]({'where':{'id':_0x46187c[_0x3792('0x2c')]['id']}})[_0x3792('0x3a')](handleEntityNotFound(_0x11c655,null))[_0x3792('0x3a')](removeEntity(_0x11c655,null))['catch'](handleError(_0x11c655,null));};function widgetAttributes(_0x5be5b7){try{switch(_0x5be5b7['type']){case _0x3792('0x3c'):return[{'name':_0x3792('0x3d'),'value':_0x5be5b7[_0x3792('0x3d')]||(_0x5be5b7['attrs']&&_0x5be5b7['attrs'][0x0]?_0x5be5b7[_0x3792('0x3e')][0x0][_0x3792('0x3f')]:undefined)||'https://'}];case _0x3792('0x40'):return[{'name':_0x3792('0x41'),'value':_0x5be5b7[_0x3792('0x41')]||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7['attrs'][0x0][_0x3792('0x3f')]:undefined)||''}];case _0x3792('0x42'):return[{'name':_0x3792('0x43'),'value':_0x5be5b7['attrHourFormat']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7[_0x3792('0x3e')][0x0][_0x3792('0x3f')]:undefined)||_0x3792('0x44')},{'name':'attrTimezone','value':_0x5be5b7[_0x3792('0x45')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x1]?_0x5be5b7[_0x3792('0x3e')][0x1]['value']:undefined)||_0x3792('0x46')},{'name':_0x3792('0x47'),'value':_0x5be5b7[_0x3792('0x47')]||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x2]?_0x5be5b7[_0x3792('0x3e')][0x2][_0x3792('0x3f')]:undefined)||0xc}];case _0x3792('0x48'):return[{'name':_0x3792('0x49'),'value':_0x5be5b7[_0x3792('0x49')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7[_0x3792('0x3e')][0x0][_0x3792('0x3f')]:undefined)||_0x3792('0x4a')},{'name':_0x3792('0x4b'),'value':_0x5be5b7[_0x3792('0x4b')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x1]?_0x5be5b7[_0x3792('0x3e')][0x1][_0x3792('0x3f')]:undefined)||[]},{'name':_0x3792('0x47'),'value':_0x5be5b7[_0x3792('0x47')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x2]?_0x5be5b7[_0x3792('0x3e')][0x2]['value']:undefined)||0x14},{'name':_0x3792('0x4c'),'value':_0x5be5b7['attrChannel']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x3]?_0x5be5b7[_0x3792('0x3e')][0x3]['value']:undefined)||_0x3792('0x4d')},{'name':_0x3792('0x4e'),'value':_0x5be5b7['attrEmailAccounts']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x4]?_0x5be5b7[_0x3792('0x3e')][0x4][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x4f'),'value':_0x5be5b7[_0x3792('0x4f')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x5]?_0x5be5b7[_0x3792('0x3e')][0x5][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x50'),'value':_0x5be5b7[_0x3792('0x50')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x6]?_0x5be5b7[_0x3792('0x3e')][0x6][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x51'),'value':_0x5be5b7[_0x3792('0x51')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x7]?_0x5be5b7[_0x3792('0x3e')][0x7][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x52'),'value':_0x5be5b7[_0x3792('0x52')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7['attrs'][0x8]?_0x5be5b7['attrs'][0x8]['value']:undefined)||''},{'name':_0x3792('0x53'),'value':_0x5be5b7[_0x3792('0x53')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7['attrs'][0x9]?_0x5be5b7[_0x3792('0x3e')][0x9][_0x3792('0x3f')]:undefined)||''}];case _0x3792('0x54'):case _0x3792('0x55'):return[{'name':_0x3792('0x56'),'value':_0x5be5b7['attrSerie1']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7[_0x3792('0x3e')][0x0][_0x3792('0x3f')]:undefined)||'total'},{'name':_0x3792('0x57'),'value':_0x5be5b7[_0x3792('0x57')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x1]?_0x5be5b7['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x5be5b7[_0x3792('0x58')]||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x2]?_0x5be5b7['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5be5b7['attrVoiceQueues']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x3]?_0x5be5b7[_0x3792('0x3e')][0x3]['value']:undefined)||[]},{'name':_0x3792('0x4c'),'value':_0x5be5b7[_0x3792('0x4c')]||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x4]?_0x5be5b7[_0x3792('0x3e')][0x4][_0x3792('0x3f')]:undefined)||_0x3792('0x4d')},{'name':_0x3792('0x4e'),'value':_0x5be5b7[_0x3792('0x4e')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x5]?_0x5be5b7['attrs'][0x5][_0x3792('0x3f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5be5b7['attrFaxAccounts']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x6]?_0x5be5b7[_0x3792('0x3e')][0x6][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x50'),'value':_0x5be5b7[_0x3792('0x50')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x7]?_0x5be5b7['attrs'][0x7][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x51'),'value':_0x5be5b7[_0x3792('0x51')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7['attrs'][0x8]?_0x5be5b7[_0x3792('0x3e')][0x8][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x52'),'value':_0x5be5b7['attrWhatsappAccounts']||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x9]?_0x5be5b7[_0x3792('0x3e')][0x9][_0x3792('0x3f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5be5b7[_0x3792('0x53')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0xa]?_0x5be5b7[_0x3792('0x3e')][0xa][_0x3792('0x3f')]:undefined)||''}];case'web-report':return[{'name':_0x3792('0x59'),'type':_0x5be5b7[_0x3792('0x5a')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7['attrs'][0x0][_0x3792('0x5b')]:undefined)||null,'value':_0x5be5b7[_0x3792('0x59')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7['attrs'][0x0]?_0x5be5b7['attrs'][0x0]['value']:undefined)||null},{'name':_0x3792('0x5c'),'value':_0x5be5b7[_0x3792('0x5c')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x1]?_0x5be5b7['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x32f563){logger['error']('widgetAttributes:\x20%s',JSON[_0x3792('0x5d')](_0x32f563));return[];}}exports[_0x3792('0x5e')]=function(_0x3ecab6,_0x3632ac){if(_0x3ecab6[_0x3792('0x5f')]){_0x3ecab6[_0x3792('0x5f')][_0x3792('0x3e')]=widgetAttributes(_0x3ecab6[_0x3792('0x5f')]);}return db[_0x3792('0x2f')][_0x3792('0x5e')](_0x3ecab6['body'],{})['then'](respondWithResult(_0x3632ac,0xc9))[_0x3792('0x60')](handleError(_0x3632ac,null));};exports['update']=function(_0x33d0bc,_0x53b379){if(_0x33d0bc[_0x3792('0x5f')]['id']){delete _0x33d0bc[_0x3792('0x5f')]['id'];}_0x33d0bc[_0x3792('0x5f')][_0x3792('0x3e')]=widgetAttributes(_0x33d0bc['body']);return db['DashboardItem'][_0x3792('0x39')]({'where':{'id':_0x33d0bc[_0x3792('0x2c')]['id']}})['then'](handleEntityNotFound(_0x53b379,null))[_0x3792('0x3a')](saveUpdates(_0x33d0bc['body'],null))['then'](respondWithResult(_0x53b379,null))['catch'](handleError(_0x53b379,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0c27619..e2bc1db 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 _0x2581=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2581,0x72));var _0x1258=function(_0x18891b,_0x2c7042){_0x18891b=_0x18891b-0x0;var _0x3ac3d2=_0x2581[_0x18891b];return _0x3ac3d2;};'use strict';var EventEmitter=require(_0x1258('0x0'));var DashboardItem=require(_0x1258('0x1'))['db'][_0x1258('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1258('0x3')](0x0);var events={'afterCreate':_0x1258('0x4'),'afterUpdate':_0x1258('0x5'),'afterDestroy':_0x1258('0x6')};function emitEvent(_0xcda1e8){return function(_0x3e019c,_0x11675f,_0x555cba){DashboardItemEvents[_0x1258('0x7')](_0xcda1e8+':'+_0x3e019c['id'],_0x3e019c);DashboardItemEvents[_0x1258('0x7')](_0xcda1e8,_0x3e019c);_0x555cba(null);};}for(var e in events){if(events[_0x1258('0x8')](e)){var event=events[e];DashboardItem[_0x1258('0x9')](e,emitEvent(event));}}module[_0x1258('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0x6427=['../../mysqldb','save','emit','hasOwnProperty','hook','events'];(function(_0x61e635,_0x16f4df){var _0x13e7c4=function(_0x465f33){while(--_0x465f33){_0x61e635['push'](_0x61e635['shift']());}};_0x13e7c4(++_0x16f4df);}(_0x6427,0x191));var _0x7642=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x6427[_0x4e9628];return _0x27bc8c;};'use strict';var EventEmitter=require(_0x7642('0x0'));var DashboardItem=require(_0x7642('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7642('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5404d4){return function(_0x849593,_0x47ffca,_0x45f6d3){DashboardItemEvents[_0x7642('0x3')](_0x5404d4+':'+_0x849593['id'],_0x849593);DashboardItemEvents['emit'](_0x5404d4,_0x849593);_0x45f6d3(null);};}for(var e in events){if(events[_0x7642('0x4')](e)){var event=events[e];DashboardItem[_0x7642('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6dfdc0f..ec14707 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 _0x6597=['../../config/logger','moment','request-promise','./dashboardItem.attributes','exports','define','lodash','util'];(function(_0x5b008f,_0x163307){var _0x5e1a66=function(_0x1e56dd){while(--_0x1e56dd){_0x5b008f['push'](_0x5b008f['shift']());}};_0x5e1a66(++_0x163307);}(_0x6597,0x16e));var _0x7659=function(_0x4396b6,_0x3c975c){_0x4396b6=_0x4396b6-0x0;var _0x8906d=_0x6597[_0x4396b6];return _0x8906d;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var logger=require(_0x7659('0x2'))('api');var moment=require(_0x7659('0x3'));var BPromise=require('bluebird');var rp=require(_0x7659('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7659('0x5'));module[_0x7659('0x6')]=function(_0x4e09cc,_0xb90fa2){return _0x4e09cc[_0x7659('0x7')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2b4=['DashboardItem','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0xa46696,_0x31968d){var _0x5bca82=function(_0x386e72){while(--_0x386e72){_0xa46696['push'](_0xa46696['shift']());}};_0x5bca82(++_0x31968d);}(_0xd2b4,0xa6));var _0x4d2b=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xd2b4[_0x496333];return _0x44256e;};'use strict';var _=require('lodash');var util=require(_0x4d2b('0x0'));var logger=require('../../config/logger')(_0x4d2b('0x1'));var moment=require(_0x4d2b('0x2'));var BPromise=require(_0x4d2b('0x3'));var rp=require(_0x4d2b('0x4'));var fs=require('fs');var path=require(_0x4d2b('0x5'));var rimraf=require(_0x4d2b('0x6'));var config=require(_0x4d2b('0x7'));var attributes=require(_0x4d2b('0x8'));module[_0x4d2b('0x9')]=function(_0x168b12,_0x5d1f36){return _0x168b12['define'](_0x4d2b('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 540ba43..f5e361d 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 _0x778e=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','code','DashboardItem,\x20%s,\x20%s','message','error','lodash','moment','bluebird','randomstring','../../config/utils','rpc','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent'];(function(_0x44d48d,_0xf539fd){var _0x2b6985=function(_0x1f3c72){while(--_0x1f3c72){_0x44d48d['push'](_0x44d48d['shift']());}};_0x2b6985(++_0xf539fd);}(_0x778e,0xcc));var _0xe778=function(_0x50b308,_0x3cf522){_0x50b308=_0x50b308-0x0;var _0x5a5dc2=_0x778e[_0x50b308];return _0x5a5dc2;};'use strict';var _=require(_0xe778('0x0'));var util=require('util');var moment=require(_0xe778('0x1'));var BPromise=require(_0xe778('0x2'));var rs=require(_0xe778('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe778('0x4'));var logger=require('../../config/logger')(_0xe778('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xe778('0x6')]=_[_0xe778('0x7')](config[_0xe778('0x6')],{'host':_0xe778('0x8'),'port':0x18eb});var socket=require(_0xe778('0x9'))(new Redis(config[_0xe778('0x6')]));require(_0xe778('0xa'))[_0xe778('0xb')](socket);function respondWithRpcPromise(_0xa7c858,_0x1f89e1,_0x122a9a){return new BPromise(function(_0x34ba38,_0x45b0ed){return client[_0xe778('0xc')](_0xa7c858,_0x122a9a)[_0xe778('0xd')](function(_0xa8eb24){logger[_0xe778('0xe')]('DashboardItem,\x20%s,\x20%s',_0x1f89e1,_0xe778('0xf'));logger[_0xe778('0x10')](_0xe778('0x11'),_0x1f89e1,_0xe778('0xf'),JSON['stringify'](_0xa8eb24));if(_0xa8eb24['error']){if(_0xa8eb24['error'][_0xe778('0x12')]===0x1f4){logger['error'](_0xe778('0x13'),_0x1f89e1,_0xa8eb24['error'][_0xe778('0x14')]);return _0x45b0ed(_0xa8eb24[_0xe778('0x15')][_0xe778('0x14')]);}logger[_0xe778('0x15')](_0xe778('0x13'),_0x1f89e1,_0xa8eb24['error']['message']);return _0x34ba38(_0xa8eb24[_0xe778('0x15')][_0xe778('0x14')]);}else{logger[_0xe778('0xe')](_0xe778('0x13'),_0x1f89e1,_0xe778('0xf'));_0x34ba38(_0xa8eb24['result'][_0xe778('0x14')]);}})['catch'](function(_0x279a94){logger[_0xe778('0x15')](_0xe778('0x13'),_0x1f89e1,_0x279a94);_0x45b0ed(_0x279a94);});});} \ No newline at end of file +var _0x8ae5=['DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3227a6,_0x4b3c0c){var _0x165d7c=function(_0x1a9c78){while(--_0x1a9c78){_0x3227a6['push'](_0x3227a6['shift']());}};_0x165d7c(++_0x4b3c0c);}(_0x8ae5,0x72));var _0x58ae=function(_0xd19e44,_0x306aea){_0xd19e44=_0xd19e44-0x0;var _0x4d670b=_0x8ae5[_0xd19e44];return _0x4d670b;};'use strict';var _=require(_0x58ae('0x0'));var util=require('util');var moment=require(_0x58ae('0x1'));var BPromise=require(_0x58ae('0x2'));var rs=require(_0x58ae('0x3'));var fs=require('fs');var Redis=require(_0x58ae('0x4'));var db=require(_0x58ae('0x5'))['db'];var utils=require(_0x58ae('0x6'));var logger=require('../../config/logger')(_0x58ae('0x7'));var config=require('../../config/environment');var jayson=require(_0x58ae('0x8'));var client=jayson[_0x58ae('0x9')]['http']({'port':0x232a});config[_0x58ae('0xa')]=_[_0x58ae('0xb')](config['redis'],{'host':_0x58ae('0xc'),'port':0x18eb});var socket=require(_0x58ae('0xd'))(new Redis(config[_0x58ae('0xa')]));require(_0x58ae('0xe'))[_0x58ae('0xf')](socket);function respondWithRpcPromise(_0x41d0e8,_0x36c1c5,_0x14c225){return new BPromise(function(_0x457e95,_0x5d3084){return client['request'](_0x41d0e8,_0x14c225)[_0x58ae('0x10')](function(_0x2353a6){logger[_0x58ae('0x11')](_0x58ae('0x12'),_0x36c1c5,_0x58ae('0x13'));logger[_0x58ae('0x14')](_0x58ae('0x15'),_0x36c1c5,'request\x20sent',JSON[_0x58ae('0x16')](_0x2353a6));if(_0x2353a6[_0x58ae('0x17')]){if(_0x2353a6[_0x58ae('0x17')][_0x58ae('0x18')]===0x1f4){logger['error'](_0x58ae('0x12'),_0x36c1c5,_0x2353a6[_0x58ae('0x17')][_0x58ae('0x19')]);return _0x5d3084(_0x2353a6[_0x58ae('0x17')][_0x58ae('0x19')]);}logger[_0x58ae('0x17')](_0x58ae('0x12'),_0x36c1c5,_0x2353a6[_0x58ae('0x17')][_0x58ae('0x19')]);return _0x457e95(_0x2353a6[_0x58ae('0x17')][_0x58ae('0x19')]);}else{logger[_0x58ae('0x11')](_0x58ae('0x12'),_0x36c1c5,_0x58ae('0x13'));_0x457e95(_0x2353a6['result']['message']);}})[_0x58ae('0x1a')](function(_0x11db91){logger[_0x58ae('0x17')](_0x58ae('0x12'),_0x36c1c5,_0x11db91);_0x5d3084(_0x11db91);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 8df65ab..4a52b37 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 _0x9e5d=['register','length','dashboardItem:','save','remove','update','emit'];(function(_0x75fb3c,_0x10e0da){var _0x1a2837=function(_0xcec616){while(--_0xcec616){_0x75fb3c['push'](_0x75fb3c['shift']());}};_0x1a2837(++_0x10e0da);}(_0x9e5d,0x65));var _0xd9e5=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x9e5d[_0x3a1ea5];return _0xfac9b2;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xd9e5('0x0'),_0xd9e5('0x1'),_0xd9e5('0x2')];function createListener(_0x2401f4,_0x1f850e){return function(_0x31972f){_0x1f850e[_0xd9e5('0x3')](_0x2401f4,_0x31972f);};}function removeListener(_0x529dd5,_0x4a62f0){return function(){DashboardItemEvents['removeListener'](_0x529dd5,_0x4a62f0);};}exports[_0xd9e5('0x4')]=function(_0x12c8ae){for(var _0x4adb65=0x0,_0x54e5ef=events[_0xd9e5('0x5')];_0x4adb65<_0x54e5ef;_0x4adb65++){var _0x537fea=events[_0x4adb65];var _0x46d932=createListener(_0xd9e5('0x6')+_0x537fea,_0x12c8ae);DashboardItemEvents['on'](_0x537fea,_0x46d932);}}; \ No newline at end of file +var _0xd599=['remove','update','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x18fe54,_0xff789){var _0xccb1ee=function(_0x513cf3){while(--_0x513cf3){_0x18fe54['push'](_0x18fe54['shift']());}};_0xccb1ee(++_0xff789);}(_0xd599,0x19e));var _0x9d59=function(_0x144017,_0x56680b){_0x144017=_0x144017-0x0;var _0x4aee58=_0xd599[_0x144017];return _0x4aee58;};'use strict';var DashboardItemEvents=require(_0x9d59('0x0'));var events=[_0x9d59('0x1'),_0x9d59('0x2'),_0x9d59('0x3')];function createListener(_0x18a54c,_0x3ffd62){return function(_0x21adac){_0x3ffd62['emit'](_0x18a54c,_0x21adac);};}function removeListener(_0x5e3c21,_0x4aaa8e){return function(){DashboardItemEvents[_0x9d59('0x4')](_0x5e3c21,_0x4aaa8e);};}exports[_0x9d59('0x5')]=function(_0x10c952){for(var _0x1f6fa9=0x0,_0x905c54=events[_0x9d59('0x6')];_0x1f6fa9<_0x905c54;_0x1f6fa9++){var _0x4ef7ff=events[_0x1f6fa9];var _0x1b7696=createListener(_0x9d59('0x7')+_0x4ef7ff,_0x10c952);DashboardItemEvents['on'](_0x4ef7ff,_0x1b7696);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ba1f387..91c4a3a 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 _0x0dbc=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','update'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0dbc,0x1a5));var _0xc0db=function(_0x462fcb,_0x6f1e04){_0x462fcb=_0x462fcb-0x0;var _0xf39de5=_0x0dbc[_0x462fcb];return _0xf39de5;};'use strict';var multer=require(_0xc0db('0x0'));var util=require(_0xc0db('0x1'));var path=require(_0xc0db('0x2'));var timeout=require(_0xc0db('0x3'));var express=require('express');var router=express[_0xc0db('0x4')]();var fs_extra=require(_0xc0db('0x5'));var auth=require(_0xc0db('0x6'));var interaction=require(_0xc0db('0x7'));var config=require(_0xc0db('0x8'));var controller=require('./dashboardItem.controller');router[_0xc0db('0x9')](_0xc0db('0xa'),auth[_0xc0db('0xb')](),controller[_0xc0db('0xc')]);router[_0xc0db('0xd')]('/',auth[_0xc0db('0xb')](),controller[_0xc0db('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc0db('0xf')]);router[_0xc0db('0x10')](_0xc0db('0xa'),auth[_0xc0db('0xb')](),controller[_0xc0db('0x11')]);module[_0xc0db('0x12')]=router; \ No newline at end of file +var _0x1505=['isAuthenticated','show','create','put','update','delete','destroy','multer','path','express','Router','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1505,0x1d8));var _0x5150=function(_0x547976,_0x2da222){_0x547976=_0x547976-0x0;var _0x4dd7c4=_0x1505[_0x547976];return _0x4dd7c4;};'use strict';var multer=require(_0x5150('0x0'));var util=require('util');var path=require(_0x5150('0x1'));var timeout=require('connect-timeout');var express=require(_0x5150('0x2'));var router=express[_0x5150('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5150('0x4'));var controller=require(_0x5150('0x5'));router[_0x5150('0x6')](_0x5150('0x7'),auth[_0x5150('0x8')](),controller[_0x5150('0x9')]);router['post']('/',auth[_0x5150('0x8')](),controller[_0x5150('0xa')]);router[_0x5150('0xb')](_0x5150('0x7'),auth[_0x5150('0x8')](),controller[_0x5150('0xc')]);router[_0x5150('0xd')](_0x5150('0x7'),auth[_0x5150('0x8')](),controller[_0x5150('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index c064c74..816ff26 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 _0x0caf=['second','third','sequelize','STRING','first'];(function(_0x397ddb,_0x271caf){var _0xc80b9b=function(_0xc8974e){while(--_0xc8974e){_0x397ddb['push'](_0x397ddb['shift']());}};_0xc80b9b(++_0x271caf);}(_0x0caf,0x16a));var _0xf0ca=function(_0x4fe372,_0x340562){_0x4fe372=_0x4fe372-0x0;var _0x3425dc=_0x0caf[_0x4fe372];return _0x3425dc;};'use strict';var Sequelize=require(_0xf0ca('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0ca('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xf0ca('0x2'),_0xf0ca('0x3'),_0xf0ca('0x4')),'allowNull':![],'defaultValue':_0xf0ca('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6e10=['exports','STRING','ENUM','first','second','third','sequelize'];(function(_0x11d841,_0x467b37){var _0x20dece=function(_0x28c19d){while(--_0x28c19d){_0x11d841['push'](_0x11d841['shift']());}};_0x20dece(++_0x467b37);}(_0x6e10,0x1c6));var _0x06e1=function(_0x4948ec,_0x2586e3){_0x4948ec=_0x4948ec-0x0;var _0x20bda4=_0x6e10[_0x4948ec];return _0x20bda4;};'use strict';var Sequelize=require(_0x06e1('0x0'));module[_0x06e1('0x1')]={'name':{'type':Sequelize[_0x06e1('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x06e1('0x3')](_0x06e1('0x4'),_0x06e1('0x5'),_0x06e1('0x6')),'allowNull':![],'defaultValue':_0x06e1('0x4')},'description':{'type':Sequelize[_0x06e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 237fca3..f29038f 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 _0xbd54=['nolimit','sort','where','pick','filter','merge','options','rows','catch','params','length','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0xe5495f,_0x36e9af){var _0x584c6e=function(_0x4c1cb7){while(--_0x4c1cb7){_0xe5495f['push'](_0xe5495f['shift']());}};_0x584c6e(++_0x36e9af);}(_0xbd54,0x67));var _0x4bd5=function(_0x44a59b,_0x18f8a5){_0x44a59b=_0x44a59b-0x0;var _0x5382c5=_0xbd54[_0x44a59b];return _0x5382c5;};'use strict';var emlformat=require(_0x4bd5('0x0'));var rimraf=require(_0x4bd5('0x1'));var zipdir=require(_0x4bd5('0x2'));var jsonpatch=require(_0x4bd5('0x3'));var rp=require(_0x4bd5('0x4'));var moment=require(_0x4bd5('0x5'));var BPromise=require(_0x4bd5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4bd5('0x7'));var sox=require(_0x4bd5('0x8'));var csv=require(_0x4bd5('0x9'));var ejs=require(_0x4bd5('0xa'));var fs=require('fs');var fs_extra=require(_0x4bd5('0xb'));var _=require(_0x4bd5('0xc'));var squel=require(_0x4bd5('0xd'));var crypto=require(_0x4bd5('0xe'));var jsforce=require(_0x4bd5('0xf'));var deskjs=require(_0x4bd5('0x10'));var toCsv=require(_0x4bd5('0x9'));var querystring=require(_0x4bd5('0x11'));var Papa=require(_0x4bd5('0x12'));var Redis=require(_0x4bd5('0x13'));var authService=require(_0x4bd5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4bd5('0x15'));var hardwareService=require(_0x4bd5('0x16'));var logger=require(_0x4bd5('0x17'))(_0x4bd5('0x18'));var utils=require(_0x4bd5('0x19'));var config=require(_0x4bd5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4bd5('0x1b'))['db'];function respondWithStatusCode(_0x9c7468,_0xecfc8){_0xecfc8=_0xecfc8||0xcc;return function(_0x4db062){if(_0x4db062){return _0x9c7468[_0x4bd5('0x1c')](_0xecfc8);}return _0x9c7468[_0x4bd5('0x1d')](_0xecfc8)[_0x4bd5('0x1e')]();};}function respondWithResult(_0x40d0dd,_0x43551f){_0x43551f=_0x43551f||0xc8;return function(_0x59364f){if(_0x59364f){return _0x40d0dd[_0x4bd5('0x1d')](_0x43551f)[_0x4bd5('0x1f')](_0x59364f);}};}function respondWithFilteredResult(_0x507d19,_0xce1797){return function(_0x3f234f){if(_0x3f234f){var _0x564bb7=typeof _0xce1797[_0x4bd5('0x20')]===_0x4bd5('0x21')&&typeof _0xce1797[_0x4bd5('0x22')]===_0x4bd5('0x21');var _0x45ff3c=_0x3f234f[_0x4bd5('0x23')];var _0x780db5=_0x564bb7?0x0:_0xce1797[_0x4bd5('0x20')];var _0x84f9a6=_0x564bb7?_0x3f234f['count']:_0xce1797[_0x4bd5('0x20')]+_0xce1797[_0x4bd5('0x22')];var _0x5f52d8;if(_0x84f9a6>=_0x45ff3c){_0x84f9a6=_0x45ff3c;_0x5f52d8=0xc8;}else{_0x5f52d8=0xce;}_0x507d19[_0x4bd5('0x1d')](_0x5f52d8);return _0x507d19[_0x4bd5('0x24')](_0x4bd5('0x25'),_0x780db5+'-'+_0x84f9a6+'/'+_0x45ff3c)[_0x4bd5('0x1f')](_0x3f234f);}return null;};}function patchUpdates(_0x2d925f){return function(_0xf1629){try{jsonpatch[_0x4bd5('0x26')](_0xf1629,_0x2d925f,!![]);}catch(_0x3b2907){return BPromise[_0x4bd5('0x27')](_0x3b2907);}return _0xf1629[_0x4bd5('0x28')]();};}function saveUpdates(_0x412eb2,_0x13d17d){return function(_0x5972d3){if(_0x5972d3){return _0x5972d3[_0x4bd5('0x29')](_0x412eb2)[_0x4bd5('0x2a')](function(_0x2c245b){return _0x2c245b;});}return null;};}function removeEntity(_0x3bbf1e,_0x4bd602){return function(_0x211d72){if(_0x211d72){return _0x211d72[_0x4bd5('0x2b')]()[_0x4bd5('0x2a')](function(){var _0x4f344d=_0x211d72[_0x4bd5('0x2c')]({'plain':!![]});var _0x55556c=_0x4bd5('0x2d');return db[_0x4bd5('0x2e')][_0x4bd5('0x2b')]({'where':{'type':_0x55556c,'resourceId':_0x4f344d['id']}})[_0x4bd5('0x2a')](function(){return _0x211d72;});})[_0x4bd5('0x2a')](function(){_0x3bbf1e[_0x4bd5('0x1d')](0xcc)[_0x4bd5('0x1e')]();});}};}function handleEntityNotFound(_0x35bb1f,_0x53c7b5){return function(_0x2daf10){if(!_0x2daf10){_0x35bb1f[_0x4bd5('0x1c')](0x194);}return _0x2daf10;};}function handleError(_0x252b87,_0x7d4441){_0x7d4441=_0x7d4441||0x1f4;return function(_0x427639){logger[_0x4bd5('0x2f')](_0x427639['stack']);if(_0x427639[_0x4bd5('0x30')]){delete _0x427639['name'];}_0x252b87['status'](_0x7d4441)[_0x4bd5('0x31')](_0x427639);};}exports[_0x4bd5('0x32')]=function(_0xbac5ac,_0x372c04){var _0x12723a={},_0x573bc0={},_0x29a913={'count':0x0,'rows':[]};var _0x1c4b6f=_[_0x4bd5('0x33')](db[_0x4bd5('0x34')][_0x4bd5('0x35')],function(_0x198e0f){return{'name':_0x198e0f[_0x4bd5('0x36')],'type':_0x198e0f[_0x4bd5('0x37')][_0x4bd5('0x38')]};});_0x573bc0[_0x4bd5('0x39')]=_[_0x4bd5('0x33')](_0x1c4b6f,_0x4bd5('0x30'));_0x573bc0[_0x4bd5('0x3a')]=_[_0x4bd5('0x3b')](_0xbac5ac[_0x4bd5('0x3a')]);_0x573bc0[_0x4bd5('0x3c')]=_['intersection'](_0x573bc0[_0x4bd5('0x39')],_0x573bc0['query']);_0x12723a[_0x4bd5('0x3d')]=_[_0x4bd5('0x3e')](_0x573bc0[_0x4bd5('0x39')],qs[_0x4bd5('0x3f')](_0xbac5ac[_0x4bd5('0x3a')][_0x4bd5('0x3f')]));_0x12723a[_0x4bd5('0x3d')]=_0x12723a[_0x4bd5('0x3d')]['length']?_0x12723a[_0x4bd5('0x3d')]:_0x573bc0[_0x4bd5('0x39')];if(!_0xbac5ac[_0x4bd5('0x3a')][_0x4bd5('0x40')](_0x4bd5('0x41'))){_0x12723a[_0x4bd5('0x22')]=qs[_0x4bd5('0x22')](_0xbac5ac['query'][_0x4bd5('0x22')]);_0x12723a[_0x4bd5('0x20')]=qs['offset'](_0xbac5ac[_0x4bd5('0x3a')]['offset']);}_0x12723a['order']=qs['sort'](_0xbac5ac['query'][_0x4bd5('0x42')]);_0x12723a[_0x4bd5('0x43')]=qs[_0x4bd5('0x3c')](_[_0x4bd5('0x44')](_0xbac5ac[_0x4bd5('0x3a')],_0x573bc0['filters']),_0x1c4b6f);if(_0xbac5ac[_0x4bd5('0x3a')][_0x4bd5('0x45')]){_0x12723a[_0x4bd5('0x43')]=_[_0x4bd5('0x46')](_0x12723a['where'],{'$or':_[_0x4bd5('0x33')](_0x1c4b6f,function(_0xe3855d){if(_0xe3855d[_0x4bd5('0x37')]!=='VIRTUAL'){var _0x1691a0={};_0x1691a0[_0xe3855d[_0x4bd5('0x30')]]={'$like':'%'+_0xbac5ac['query']['filter']+'%'};return _0x1691a0;}})});}_0x12723a=_[_0x4bd5('0x46')]({},_0x12723a,_0xbac5ac[_0x4bd5('0x47')]);var _0x6a3266={'where':_0x12723a[_0x4bd5('0x43')]};return db[_0x4bd5('0x34')][_0x4bd5('0x23')](_0x6a3266)[_0x4bd5('0x2a')](function(_0x1d97e6){_0x29a913[_0x4bd5('0x23')]=_0x1d97e6;if(_0xbac5ac['query']['includeAll']){_0x12723a['include']=[{'all':!![]}];}return db[_0x4bd5('0x34')]['findAll'](_0x12723a);})[_0x4bd5('0x2a')](function(_0x395d60){_0x29a913[_0x4bd5('0x48')]=_0x395d60;return _0x29a913;})[_0x4bd5('0x2a')](respondWithFilteredResult(_0x372c04,_0x12723a))[_0x4bd5('0x49')](handleError(_0x372c04,null));};exports['show']=function(_0x49d0ec,_0x5934ff){var _0x50988e={'raw':!![],'where':{'id':_0x49d0ec[_0x4bd5('0x4a')]['id']}},_0x1a332f={};_0x1a332f[_0x4bd5('0x39')]=_[_0x4bd5('0x3b')](db[_0x4bd5('0x34')][_0x4bd5('0x35')]);_0x1a332f[_0x4bd5('0x3a')]=_[_0x4bd5('0x3b')](_0x49d0ec[_0x4bd5('0x3a')]);_0x1a332f[_0x4bd5('0x3c')]=_[_0x4bd5('0x3e')](_0x1a332f[_0x4bd5('0x39')],_0x1a332f[_0x4bd5('0x3a')]);_0x50988e[_0x4bd5('0x3d')]=_['intersection'](_0x1a332f[_0x4bd5('0x39')],qs[_0x4bd5('0x3f')](_0x49d0ec[_0x4bd5('0x3a')][_0x4bd5('0x3f')]));_0x50988e[_0x4bd5('0x3d')]=_0x50988e[_0x4bd5('0x3d')][_0x4bd5('0x4b')]?_0x50988e['attributes']:_0x1a332f['model'];if(_0x49d0ec[_0x4bd5('0x3a')]['includeAll']){_0x50988e[_0x4bd5('0x4c')]=[{'all':!![]}];}_0x50988e=_[_0x4bd5('0x46')]({},_0x50988e,_0x49d0ec['options']);return db['Disposition'][_0x4bd5('0x4d')](_0x50988e)[_0x4bd5('0x2a')](handleEntityNotFound(_0x5934ff,null))['then'](respondWithResult(_0x5934ff,null))['catch'](handleError(_0x5934ff,null));};exports[_0x4bd5('0x4e')]=function(_0x46a80c,_0x3dfb04){return db[_0x4bd5('0x34')]['create'](_0x46a80c[_0x4bd5('0x4f')],{})['then'](function(_0x221501){var _0x1aeef4=_0x46a80c['user'][_0x4bd5('0x2c')]({'plain':!![]});if(!_0x1aeef4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aeef4['role']===_0x4bd5('0x50')){var _0x2c5e86=_0x221501[_0x4bd5('0x2c')]({'plain':!![]});var _0x5903a6=_0x4bd5('0x2d');return db[_0x4bd5('0x51')][_0x4bd5('0x4d')]({'where':{'name':_0x5903a6,'userProfileId':_0x1aeef4[_0x4bd5('0x52')]},'raw':!![]})[_0x4bd5('0x2a')](function(_0x514c8a){if(_0x514c8a&&_0x514c8a[_0x4bd5('0x53')]===0x0){return db[_0x4bd5('0x2e')][_0x4bd5('0x4e')]({'name':_0x2c5e86[_0x4bd5('0x30')],'resourceId':_0x2c5e86['id'],'type':_0x514c8a[_0x4bd5('0x30')],'sectionId':_0x514c8a['id']},{})[_0x4bd5('0x2a')](function(){return _0x221501;});}else{return _0x221501;}})[_0x4bd5('0x49')](function(_0x28e01c){logger[_0x4bd5('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28e01c);throw _0x28e01c;});}return _0x221501;})[_0x4bd5('0x2a')](respondWithResult(_0x3dfb04,0xc9))[_0x4bd5('0x49')](handleError(_0x3dfb04,null));};exports['update']=function(_0x2dab02,_0x567188){if(_0x2dab02[_0x4bd5('0x4f')]['id']){delete _0x2dab02[_0x4bd5('0x4f')]['id'];}return db[_0x4bd5('0x34')]['find']({'where':{'id':_0x2dab02['params']['id']}})[_0x4bd5('0x2a')](handleEntityNotFound(_0x567188,null))[_0x4bd5('0x2a')](saveUpdates(_0x2dab02[_0x4bd5('0x4f')],null))[_0x4bd5('0x2a')](respondWithResult(_0x567188,null))[_0x4bd5('0x49')](handleError(_0x567188,null));};exports[_0x4bd5('0x2b')]=function(_0x3e469f,_0x100663){return db[_0x4bd5('0x34')][_0x4bd5('0x4d')]({'where':{'id':_0x3e469f[_0x4bd5('0x4a')]['id']}})[_0x4bd5('0x2a')](handleEntityNotFound(_0x100663,null))[_0x4bd5('0x2a')](removeEntity(_0x100663,null))['catch'](handleError(_0x100663,null));}; \ No newline at end of file +var _0xc69b=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','name','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2c2526,_0x2c1188){var _0x45439d=function(_0x4b8898){while(--_0x4b8898){_0x2c2526['push'](_0x2c2526['shift']());}};_0x45439d(++_0x2c1188);}(_0xc69b,0x14a));var _0xbc69=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0xc69b[_0x5550b3];return _0x4b8fc4;};'use strict';var emlformat=require(_0xbc69('0x0'));var rimraf=require(_0xbc69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc69('0x2'));var moment=require(_0xbc69('0x3'));var BPromise=require(_0xbc69('0x4'));var Mustache=require(_0xbc69('0x5'));var util=require(_0xbc69('0x6'));var path=require(_0xbc69('0x7'));var sox=require(_0xbc69('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc69('0x9'));var _=require(_0xbc69('0xa'));var squel=require(_0xbc69('0xb'));var crypto=require(_0xbc69('0xc'));var jsforce=require(_0xbc69('0xd'));var deskjs=require(_0xbc69('0xe'));var toCsv=require(_0xbc69('0xf'));var querystring=require(_0xbc69('0x10'));var Papa=require(_0xbc69('0x11'));var Redis=require(_0xbc69('0x12'));var authService=require(_0xbc69('0x13'));var qs=require(_0xbc69('0x14'));var as=require(_0xbc69('0x15'));var hardwareService=require(_0xbc69('0x16'));var logger=require(_0xbc69('0x17'))(_0xbc69('0x18'));var utils=require(_0xbc69('0x19'));var config=require(_0xbc69('0x1a'));var licenseUtil=require(_0xbc69('0x1b'));var db=require(_0xbc69('0x1c'))['db'];function respondWithStatusCode(_0x5109ff,_0x5f3efa){_0x5f3efa=_0x5f3efa||0xcc;return function(_0x2a38b3){if(_0x2a38b3){return _0x5109ff['sendStatus'](_0x5f3efa);}return _0x5109ff['status'](_0x5f3efa)[_0xbc69('0x1d')]();};}function respondWithResult(_0x4fd24c,_0x3fff23){_0x3fff23=_0x3fff23||0xc8;return function(_0x3be604){if(_0x3be604){return _0x4fd24c[_0xbc69('0x1e')](_0x3fff23)['json'](_0x3be604);}};}function respondWithFilteredResult(_0x275a11,_0x44a58d){return function(_0x49b7f){if(_0x49b7f){var _0x32db83=typeof _0x44a58d[_0xbc69('0x1f')]===_0xbc69('0x20')&&typeof _0x44a58d[_0xbc69('0x21')]===_0xbc69('0x20');var _0x5c4b3b=_0x49b7f[_0xbc69('0x22')];var _0x536d97=_0x32db83?0x0:_0x44a58d['offset'];var _0x4c3d55=_0x32db83?_0x49b7f[_0xbc69('0x22')]:_0x44a58d[_0xbc69('0x1f')]+_0x44a58d[_0xbc69('0x21')];var _0x297d0d;if(_0x4c3d55>=_0x5c4b3b){_0x4c3d55=_0x5c4b3b;_0x297d0d=0xc8;}else{_0x297d0d=0xce;}_0x275a11[_0xbc69('0x1e')](_0x297d0d);return _0x275a11[_0xbc69('0x23')](_0xbc69('0x24'),_0x536d97+'-'+_0x4c3d55+'/'+_0x5c4b3b)['json'](_0x49b7f);}return null;};}function patchUpdates(_0x50d81c){return function(_0xf6fef8){try{jsonpatch[_0xbc69('0x25')](_0xf6fef8,_0x50d81c,!![]);}catch(_0x4a1a4d){return BPromise[_0xbc69('0x26')](_0x4a1a4d);}return _0xf6fef8[_0xbc69('0x27')]();};}function saveUpdates(_0x39feb2,_0x5415b8){return function(_0x330570){if(_0x330570){return _0x330570[_0xbc69('0x28')](_0x39feb2)[_0xbc69('0x29')](function(_0x2ceecc){return _0x2ceecc;});}return null;};}function removeEntity(_0xeecd0d,_0x439215){return function(_0x385bee){if(_0x385bee){return _0x385bee[_0xbc69('0x2a')]()[_0xbc69('0x29')](function(){var _0x1410a2=_0x385bee[_0xbc69('0x2b')]({'plain':!![]});var _0xa821b1=_0xbc69('0x2c');return db[_0xbc69('0x2d')][_0xbc69('0x2a')]({'where':{'type':_0xa821b1,'resourceId':_0x1410a2['id']}})[_0xbc69('0x29')](function(){return _0x385bee;});})['then'](function(){_0xeecd0d[_0xbc69('0x1e')](0xcc)[_0xbc69('0x1d')]();});}};}function handleEntityNotFound(_0x43ff36,_0x1fd059){return function(_0x543a6e){if(!_0x543a6e){_0x43ff36[_0xbc69('0x2e')](0x194);}return _0x543a6e;};}function handleError(_0x12e651,_0xf5c07d){_0xf5c07d=_0xf5c07d||0x1f4;return function(_0x1ad8c0){logger[_0xbc69('0x2f')](_0x1ad8c0['stack']);if(_0x1ad8c0[_0xbc69('0x30')]){delete _0x1ad8c0[_0xbc69('0x30')];}_0x12e651['status'](_0xf5c07d)['send'](_0x1ad8c0);};}exports[_0xbc69('0x31')]=function(_0xa171f7,_0x2b5b99){var _0x44f2fc={},_0x1767fa={},_0x2620d5={'count':0x0,'rows':[]};var _0x2297b8=_[_0xbc69('0x32')](db[_0xbc69('0x33')][_0xbc69('0x34')],function(_0x401898){return{'name':_0x401898[_0xbc69('0x35')],'type':_0x401898['type'][_0xbc69('0x36')]};});_0x1767fa[_0xbc69('0x37')]=_[_0xbc69('0x32')](_0x2297b8,_0xbc69('0x30'));_0x1767fa[_0xbc69('0x38')]=_[_0xbc69('0x39')](_0xa171f7['query']);_0x1767fa[_0xbc69('0x3a')]=_[_0xbc69('0x3b')](_0x1767fa[_0xbc69('0x37')],_0x1767fa[_0xbc69('0x38')]);_0x44f2fc['attributes']=_['intersection'](_0x1767fa[_0xbc69('0x37')],qs[_0xbc69('0x3c')](_0xa171f7['query'][_0xbc69('0x3c')]));_0x44f2fc[_0xbc69('0x3d')]=_0x44f2fc[_0xbc69('0x3d')][_0xbc69('0x3e')]?_0x44f2fc[_0xbc69('0x3d')]:_0x1767fa['model'];if(!_0xa171f7[_0xbc69('0x38')][_0xbc69('0x3f')](_0xbc69('0x40'))){_0x44f2fc[_0xbc69('0x21')]=qs['limit'](_0xa171f7[_0xbc69('0x38')][_0xbc69('0x21')]);_0x44f2fc[_0xbc69('0x1f')]=qs['offset'](_0xa171f7['query'][_0xbc69('0x1f')]);}_0x44f2fc['order']=qs['sort'](_0xa171f7[_0xbc69('0x38')][_0xbc69('0x41')]);_0x44f2fc[_0xbc69('0x42')]=qs[_0xbc69('0x3a')](_[_0xbc69('0x43')](_0xa171f7['query'],_0x1767fa[_0xbc69('0x3a')]),_0x2297b8);if(_0xa171f7[_0xbc69('0x38')][_0xbc69('0x44')]){_0x44f2fc['where']=_[_0xbc69('0x45')](_0x44f2fc[_0xbc69('0x42')],{'$or':_['map'](_0x2297b8,function(_0x3ccb27){if(_0x3ccb27['type']!==_0xbc69('0x46')){var _0x3c176f={};_0x3c176f[_0x3ccb27[_0xbc69('0x30')]]={'$like':'%'+_0xa171f7[_0xbc69('0x38')][_0xbc69('0x44')]+'%'};return _0x3c176f;}})});}_0x44f2fc=_[_0xbc69('0x45')]({},_0x44f2fc,_0xa171f7[_0xbc69('0x47')]);var _0x2b1a29={'where':_0x44f2fc[_0xbc69('0x42')]};return db[_0xbc69('0x33')][_0xbc69('0x22')](_0x2b1a29)['then'](function(_0x3f4178){_0x2620d5[_0xbc69('0x22')]=_0x3f4178;if(_0xa171f7[_0xbc69('0x38')]['includeAll']){_0x44f2fc[_0xbc69('0x48')]=[{'all':!![]}];}return db['Disposition'][_0xbc69('0x49')](_0x44f2fc);})[_0xbc69('0x29')](function(_0x110fd2){_0x2620d5[_0xbc69('0x4a')]=_0x110fd2;return _0x2620d5;})[_0xbc69('0x29')](respondWithFilteredResult(_0x2b5b99,_0x44f2fc))[_0xbc69('0x4b')](handleError(_0x2b5b99,null));};exports[_0xbc69('0x4c')]=function(_0x3cd7ce,_0x478e5b){var _0x566626={'raw':!![],'where':{'id':_0x3cd7ce[_0xbc69('0x4d')]['id']}},_0x56b372={};_0x56b372[_0xbc69('0x37')]=_[_0xbc69('0x39')](db[_0xbc69('0x33')][_0xbc69('0x34')]);_0x56b372[_0xbc69('0x38')]=_[_0xbc69('0x39')](_0x3cd7ce[_0xbc69('0x38')]);_0x56b372['filters']=_[_0xbc69('0x3b')](_0x56b372[_0xbc69('0x37')],_0x56b372[_0xbc69('0x38')]);_0x566626[_0xbc69('0x3d')]=_[_0xbc69('0x3b')](_0x56b372[_0xbc69('0x37')],qs[_0xbc69('0x3c')](_0x3cd7ce[_0xbc69('0x38')][_0xbc69('0x3c')]));_0x566626[_0xbc69('0x3d')]=_0x566626[_0xbc69('0x3d')][_0xbc69('0x3e')]?_0x566626[_0xbc69('0x3d')]:_0x56b372[_0xbc69('0x37')];if(_0x3cd7ce[_0xbc69('0x38')][_0xbc69('0x4e')]){_0x566626[_0xbc69('0x48')]=[{'all':!![]}];}_0x566626=_[_0xbc69('0x45')]({},_0x566626,_0x3cd7ce[_0xbc69('0x47')]);return db[_0xbc69('0x33')][_0xbc69('0x4f')](_0x566626)[_0xbc69('0x29')](handleEntityNotFound(_0x478e5b,null))[_0xbc69('0x29')](respondWithResult(_0x478e5b,null))[_0xbc69('0x4b')](handleError(_0x478e5b,null));};exports[_0xbc69('0x50')]=function(_0x18ff56,_0x1e4dc1){return db[_0xbc69('0x33')][_0xbc69('0x50')](_0x18ff56[_0xbc69('0x51')],{})[_0xbc69('0x29')](function(_0x5d11dd){var _0x1772f2=_0x18ff56[_0xbc69('0x52')]['get']({'plain':!![]});if(!_0x1772f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1772f2[_0xbc69('0x53')]===_0xbc69('0x52')){var _0x3c6703=_0x5d11dd[_0xbc69('0x2b')]({'plain':!![]});var _0x170d71=_0xbc69('0x2c');return db[_0xbc69('0x54')][_0xbc69('0x4f')]({'where':{'name':_0x170d71,'userProfileId':_0x1772f2['userProfileId']},'raw':!![]})[_0xbc69('0x29')](function(_0x4fa1d5){if(_0x4fa1d5&&_0x4fa1d5['autoAssociation']===0x0){return db[_0xbc69('0x2d')][_0xbc69('0x50')]({'name':_0x3c6703['name'],'resourceId':_0x3c6703['id'],'type':_0x4fa1d5[_0xbc69('0x30')],'sectionId':_0x4fa1d5['id']},{})[_0xbc69('0x29')](function(){return _0x5d11dd;});}else{return _0x5d11dd;}})[_0xbc69('0x4b')](function(_0x10f300){logger[_0xbc69('0x2f')](_0xbc69('0x55'),_0x10f300);throw _0x10f300;});}return _0x5d11dd;})['then'](respondWithResult(_0x1e4dc1,0xc9))['catch'](handleError(_0x1e4dc1,null));};exports[_0xbc69('0x28')]=function(_0xbd07a5,_0x23e404){if(_0xbd07a5[_0xbc69('0x51')]['id']){delete _0xbd07a5[_0xbc69('0x51')]['id'];}return db[_0xbc69('0x33')][_0xbc69('0x4f')]({'where':{'id':_0xbd07a5[_0xbc69('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23e404,null))['then'](saveUpdates(_0xbd07a5['body'],null))[_0xbc69('0x29')](respondWithResult(_0x23e404,null))[_0xbc69('0x4b')](handleError(_0x23e404,null));};exports[_0xbc69('0x2a')]=function(_0x2d5ec3,_0x261b42){return db[_0xbc69('0x33')][_0xbc69('0x4f')]({'where':{'id':_0x2d5ec3[_0xbc69('0x4d')]['id']}})['then'](handleEntityNotFound(_0x261b42,null))['then'](removeEntity(_0x261b42,null))[_0xbc69('0x4b')](handleError(_0x261b42,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0f8f39d..aa74c14 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 _0x7ae8=['util','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId'];(function(_0x23f58d,_0x22b11c){var _0x515d10=function(_0x18fe4a){while(--_0x18fe4a){_0x23f58d['push'](_0x23f58d['shift']());}};_0x515d10(++_0x22b11c);}(_0x7ae8,0x142));var _0x87ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7ae8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x87ae('0x0'));var logger=require('../../config/logger')(_0x87ae('0x1'));var moment=require(_0x87ae('0x2'));var BPromise=require(_0x87ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87ae('0x4'));var rimraf=require(_0x87ae('0x5'));var config=require(_0x87ae('0x6'));var attributes=require(_0x87ae('0x7'));module[_0x87ae('0x8')]=function(_0x1930fa,_0x1c3d83){return _0x1930fa[_0x87ae('0x9')](_0x87ae('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x87ae('0xb'),'fields':['name',_0x87ae('0xc')]},{'unique':!![],'name':_0x87ae('0xd'),'fields':[_0x87ae('0xe'),_0x87ae('0xf')]},{'unique':!![],'name':_0x87ae('0x10'),'fields':['name',_0x87ae('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0x87ae('0xe'),_0x87ae('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x87ae('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x87ae('0x13'),'fields':[_0x87ae('0xe'),_0x87ae('0x14')]},{'unique':!![],'name':_0x87ae('0x15'),'fields':[_0x87ae('0xe'),_0x87ae('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b49=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','name_voice','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash'];(function(_0x3e5060,_0x23438a){var _0x34e0f9=function(_0x4bc65f){while(--_0x4bc65f){_0x3e5060['push'](_0x3e5060['shift']());}};_0x34e0f9(++_0x23438a);}(_0x2b49,0x95));var _0x92b4=function(_0x331b2b,_0xfc4d1b){_0x331b2b=_0x331b2b-0x0;var _0x39a6d4=_0x2b49[_0x331b2b];return _0x39a6d4;};'use strict';var _=require(_0x92b4('0x0'));var util=require(_0x92b4('0x1'));var logger=require(_0x92b4('0x2'))(_0x92b4('0x3'));var moment=require(_0x92b4('0x4'));var BPromise=require(_0x92b4('0x5'));var rp=require(_0x92b4('0x6'));var fs=require('fs');var path=require(_0x92b4('0x7'));var rimraf=require(_0x92b4('0x8'));var config=require(_0x92b4('0x9'));var attributes=require('./disposition.attributes');module[_0x92b4('0xa')]=function(_0x7b8a6c,_0x243d8f){return _0x7b8a6c[_0x92b4('0xb')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x92b4('0xc'),'fields':[_0x92b4('0xd'),_0x92b4('0xe')]},{'unique':!![],'name':_0x92b4('0xf'),'fields':[_0x92b4('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0x92b4('0x10'),'fields':[_0x92b4('0xd'),_0x92b4('0x11')]},{'unique':!![],'name':_0x92b4('0x12'),'fields':[_0x92b4('0xd'),_0x92b4('0x13')]},{'unique':!![],'name':_0x92b4('0x14'),'fields':[_0x92b4('0xd'),_0x92b4('0x15')]},{'unique':!![],'name':_0x92b4('0x16'),'fields':['name',_0x92b4('0x17')]},{'unique':!![],'name':_0x92b4('0x18'),'fields':[_0x92b4('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 1ef2772..84622d3 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(_0x5bdaef,_0x40e16c){var _0x143171=function(_0x16b13f){while(--_0x16b13f){_0x5bdaef['push'](_0x5bdaef['shift']());}};_0x143171(++_0x40e16c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x31fc46,_0x23fbc4){var _0x3416db=function(_0x314e95){while(--_0x314e95){_0x31fc46['push'](_0x31fc46['shift']());}};_0x3416db(++_0x23fbc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 6223a02..56b7e6e 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 _0xe06e=['/:id','isAuthenticated','post','create','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller'];(function(_0x26229f,_0x1efcff){var _0xbc198c=function(_0xd4b910){while(--_0xd4b910){_0x26229f['push'](_0x26229f['shift']());}};_0xbc198c(++_0x1efcff);}(_0xe06e,0x132));var _0xee06=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xe06e[_0x277107];return _0x1da046;};'use strict';var multer=require(_0xee06('0x0'));var util=require(_0xee06('0x1'));var path=require(_0xee06('0x2'));var timeout=require('connect-timeout');var express=require(_0xee06('0x3'));var router=express[_0xee06('0x4')]();var fs_extra=require(_0xee06('0x5'));var auth=require(_0xee06('0x6'));var interaction=require(_0xee06('0x7'));var config=require('../../config/environment');var controller=require(_0xee06('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xee06('0x9'),auth[_0xee06('0xa')](),controller['show']);router[_0xee06('0xb')]('/',auth['isAuthenticated'](),controller[_0xee06('0xc')]);router['put'](_0xee06('0x9'),auth[_0xee06('0xa')](),controller[_0xee06('0xd')]);router['delete'](_0xee06('0x9'),auth[_0xee06('0xa')](),controller['destroy']);module[_0xee06('0xe')]=router; \ No newline at end of file +var _0x0e5e=['update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','put'];(function(_0x3dfefc,_0x273917){var _0x2f8f9b=function(_0x4c6cb9){while(--_0x4c6cb9){_0x3dfefc['push'](_0x3dfefc['shift']());}};_0x2f8f9b(++_0x273917);}(_0x0e5e,0xd0));var _0xe0e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e5e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe0e5('0x0'));var util=require(_0xe0e5('0x1'));var path=require(_0xe0e5('0x2'));var timeout=require(_0xe0e5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe0e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe0e5('0x5'));var config=require(_0xe0e5('0x6'));var controller=require('./disposition.controller');router[_0xe0e5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe0e5('0x7')](_0xe0e5('0x8'),auth[_0xe0e5('0x9')](),controller['show']);router[_0xe0e5('0xa')]('/',auth[_0xe0e5('0x9')](),controller[_0xe0e5('0xb')]);router[_0xe0e5('0xc')]('/:id',auth[_0xe0e5('0x9')](),controller[_0xe0e5('0xd')]);router[_0xe0e5('0xe')](_0xe0e5('0x8'),auth[_0xe0e5('0x9')](),controller[_0xe0e5('0xf')]);module[_0xe0e5('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 4e088fb..b86ad27 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 _0xa1f6=['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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400','4800','7200','9600','12000','14400','v17,v27,v29'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0xa1f6[_0x151334];return _0x3d03da;};'use strict';var Sequelize=require(_0x6a1f('0x0'));module[_0x6a1f('0x1')]={'name':{'type':Sequelize[_0x6a1f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6a1f('0x2')]},'ecm':{'type':Sequelize[_0x6a1f('0x3')](_0x6a1f('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x6a1f('0x3')](_0x6a1f('0x5'),_0x6a1f('0x6'),_0x6a1f('0x7'),_0x6a1f('0x8'),_0x6a1f('0x9'),_0x6a1f('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x6a1f('0x3')](_0x6a1f('0x5'),_0x6a1f('0x6'),_0x6a1f('0x7'),_0x6a1f('0x8'),'12000',_0x6a1f('0xa')),'defaultValue':_0x6a1f('0xa')},'modem':{'type':Sequelize[_0x6a1f('0x2')],'defaultValue':_0x6a1f('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6a1f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6a1f('0x3')](_0x6a1f('0xc'),_0x6a1f('0xd'),_0x6a1f('0xe'),_0x6a1f('0xf')),'defaultValue':_0x6a1f('0xc')},'key':{'type':Sequelize[_0x6a1f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6a1f('0x10')],'defaultValue':function(){return _0x6a1f('0x11');}},'notificationSound':{'type':Sequelize[_0x6a1f('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6a1f('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6a1f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6a1f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6a1f('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6a1f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6a1f('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6a1f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6a1f('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x6a1f('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6a1f('0x15'),'set':function(_0x45e6f0){if(!_0x45e6f0)this[_0x6a1f('0x16')](_0x6a1f('0x17'),null);this[_0x6a1f('0x16')](_0x6a1f('0x18'),_0x45e6f0);}}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','14400','7200','9600','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x549fb4,_0x57140c){var _0xc64c37=function(_0x40e702){while(--_0x40e702){_0x549fb4['push'](_0x549fb4['shift']());}};_0xc64c37(++_0x57140c);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0xfdbd[_0x17730a];return _0x485db1;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdfdb('0x2')]},'ecm':{'type':Sequelize[_0xdfdb('0x3')](_0xdfdb('0x4'),'no'),'defaultValue':_0xdfdb('0x4')},'headerinfo':{'type':Sequelize[_0xdfdb('0x2')],'defaultValue':_0xdfdb('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xdfdb('0x6')},'minrate':{'type':Sequelize['ENUM'](_0xdfdb('0x7'),_0xdfdb('0x8'),'7200','9600','12000',_0xdfdb('0x9')),'defaultValue':_0xdfdb('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0xdfdb('0x7'),_0xdfdb('0x8'),_0xdfdb('0xa'),_0xdfdb('0xb'),_0xdfdb('0xc'),_0xdfdb('0x9')),'defaultValue':_0xdfdb('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xdfdb('0xd')},'gateway':{'type':Sequelize[_0xdfdb('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xdfdb('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdfdb('0x3')](_0xdfdb('0xf'),_0xdfdb('0x10'),_0xdfdb('0x11'),_0xdfdb('0x12')),'defaultValue':_0xdfdb('0xf')},'key':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xdfdb('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdfdb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdfdb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdfdb('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdfdb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdfdb('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdfdb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdfdb('0x13')],'defaultValue':![],'comment':_0xdfdb('0x14'),'set':function(_0x2c1070){if(!_0x2c1070)this['setDataValue'](_0xdfdb('0x15'),null);this[_0xdfdb('0x16')](_0xdfdb('0x17'),_0x2c1070);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7f825da..54d7415 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 _0x8580=['update','then','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','nolimit','pick','filter','options','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','system','description','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','tech','key','createdAt','TrunkId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','updatedAt','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','out','filename','Messages','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./faxAccount.socket','register','client','http','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x3ec31f,_0x35d8dc){var _0x3e5d42=function(_0x50a1a0){while(--_0x50a1a0){_0x3ec31f['push'](_0x3ec31f['shift']());}};_0x3e5d42(++_0x35d8dc);}(_0x8580,0x92));var _0x0858=function(_0xa22b12,_0x490f3b){_0xa22b12=_0xa22b12-0x0;var _0x13a707=_0x8580[_0xa22b12];return _0x13a707;};'use strict';var emlformat=require(_0x0858('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0858('0x1'));var jsonpatch=require(_0x0858('0x2'));var rp=require(_0x0858('0x3'));var moment=require(_0x0858('0x4'));var BPromise=require(_0x0858('0x5'));var Mustache=require(_0x0858('0x6'));var util=require(_0x0858('0x7'));var path=require(_0x0858('0x8'));var sox=require(_0x0858('0x9'));var csv=require(_0x0858('0xa'));var ejs=require(_0x0858('0xb'));var fs=require('fs');var fs_extra=require(_0x0858('0xc'));var _=require(_0x0858('0xd'));var squel=require('squel');var crypto=require(_0x0858('0xe'));var jsforce=require(_0x0858('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0858('0xa'));var querystring=require('querystring');var Papa=require(_0x0858('0x10'));var Redis=require(_0x0858('0x11'));var authService=require(_0x0858('0x12'));var qs=require(_0x0858('0x13'));var as=require(_0x0858('0x14'));var hardwareService=require(_0x0858('0x15'));var logger=require('../../config/logger')(_0x0858('0x16'));var utils=require(_0x0858('0x17'));var config=require(_0x0858('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x0858('0x19')](config[_0x0858('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0858('0x1b'))(new Redis(config[_0x0858('0x1a')]));require(_0x0858('0x1c'))[_0x0858('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0858('0x1e')][_0x0858('0x1f')]({'port':0x232c});var client9002=jayson[_0x0858('0x1e')][_0x0858('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x42ad68,_0x597370,_0x302f95,_0x1875e0){return new BPromise(function(_0x1054cb,_0x24e142){var _0x2a1fc0=_0x1875e0||client;return _0x2a1fc0['request'](_0x42ad68,_0x302f95)['then'](function(_0x158c0c){logger[_0x0858('0x20')](_0x0858('0x21'),_0x597370,_0x0858('0x22'));logger[_0x0858('0x23')](_0x0858('0x24'),_0x597370,_0x0858('0x22'),JSON['stringify'](_0x158c0c));if(_0x158c0c[_0x0858('0x25')]){if(_0x158c0c[_0x0858('0x25')][_0x0858('0x26')]===0x1f4){logger['error'](_0x0858('0x21'),_0x597370,_0x158c0c[_0x0858('0x25')][_0x0858('0x27')]);return _0x24e142(_0x158c0c[_0x0858('0x25')]['message']);}logger[_0x0858('0x25')](_0x0858('0x21'),_0x597370,_0x158c0c[_0x0858('0x25')][_0x0858('0x27')]);return _0x1054cb(_0x158c0c[_0x0858('0x25')][_0x0858('0x27')]);}else{logger[_0x0858('0x20')](_0x0858('0x21'),_0x597370,_0x0858('0x22'));_0x1054cb(_0x158c0c['result'][_0x0858('0x27')]);}})['catch'](function(_0x124f2b){logger[_0x0858('0x25')]('FaxAccount,\x20%s,\x20%s',_0x597370,_0x124f2b);_0x24e142(_0x124f2b);});});}function respondWithStatusCode(_0x5f5bc0,_0x16426f){_0x16426f=_0x16426f||0xcc;return function(_0xf2c02a){if(_0xf2c02a){return _0x5f5bc0[_0x0858('0x28')](_0x16426f);}return _0x5f5bc0[_0x0858('0x29')](_0x16426f)[_0x0858('0x2a')]();};}function respondWithResult(_0x5a4151,_0x4fee82){_0x4fee82=_0x4fee82||0xc8;return function(_0x4b6a49){if(_0x4b6a49){return _0x5a4151[_0x0858('0x29')](_0x4fee82)[_0x0858('0x2b')](_0x4b6a49);}};}function respondWithFilteredResult(_0x31aec5,_0x5ae161){return function(_0x5d4605){if(_0x5d4605){var _0x12f06d=typeof _0x5ae161[_0x0858('0x2c')]===_0x0858('0x2d')&&typeof _0x5ae161['limit']==='undefined';var _0x113d06=_0x5d4605[_0x0858('0x2e')];var _0x2b05c7=_0x12f06d?0x0:_0x5ae161[_0x0858('0x2c')];var _0x305157=_0x12f06d?_0x5d4605[_0x0858('0x2e')]:_0x5ae161['offset']+_0x5ae161['limit'];var _0x3263ea;if(_0x305157>=_0x113d06){_0x305157=_0x113d06;_0x3263ea=0xc8;}else{_0x3263ea=0xce;}_0x31aec5['status'](_0x3263ea);return _0x31aec5[_0x0858('0x2f')](_0x0858('0x30'),_0x2b05c7+'-'+_0x305157+'/'+_0x113d06)[_0x0858('0x2b')](_0x5d4605);}return null;};}function patchUpdates(_0x4def47){return function(_0x57f463){try{jsonpatch[_0x0858('0x31')](_0x57f463,_0x4def47,!![]);}catch(_0xcf07e){return BPromise[_0x0858('0x32')](_0xcf07e);}return _0x57f463[_0x0858('0x33')]();};}function saveUpdates(_0x4a0342,_0x3c5418){return function(_0xf5ce2d){if(_0xf5ce2d){return _0xf5ce2d[_0x0858('0x34')](_0x4a0342)[_0x0858('0x35')](function(_0x404f49){return _0x404f49;});}return null;};}function removeEntity(_0x3f0f1e,_0x34f527){return function(_0x1e9b3d){if(_0x1e9b3d){return _0x1e9b3d[_0x0858('0x36')]()[_0x0858('0x35')](function(){var _0x5c4367=_0x1e9b3d['get']({'plain':!![]});var _0x4a20c7=_0x0858('0x37');return db[_0x0858('0x38')][_0x0858('0x36')]({'where':{'type':_0x4a20c7,'resourceId':_0x5c4367['id']}})[_0x0858('0x35')](function(){return _0x1e9b3d;});})[_0x0858('0x35')](function(){_0x3f0f1e[_0x0858('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c897,_0x1b0db3){return function(_0x38a1e0){if(!_0x38a1e0){_0x10c897[_0x0858('0x28')](0x194);}return _0x38a1e0;};}function handleError(_0x5b2077,_0x232980){_0x232980=_0x232980||0x1f4;return function(_0x1f3a8e){logger[_0x0858('0x25')](_0x1f3a8e[_0x0858('0x39')]);if(_0x1f3a8e['name']){delete _0x1f3a8e[_0x0858('0x3a')];}_0x5b2077['status'](_0x232980)[_0x0858('0x3b')](_0x1f3a8e);};}exports[_0x0858('0x3c')]=function(_0x1e09ae,_0x57736b){var _0x20479a={'include':[{'model':db[_0x0858('0x3d')],'as':_0x0858('0x3e')}]},_0x299268={},_0x569e44={'count':0x0,'rows':[]};var _0x2cc67d=_['map'](db[_0x0858('0x3f')][_0x0858('0x40')],function(_0x3569fa){return{'name':_0x3569fa[_0x0858('0x41')],'type':_0x3569fa[_0x0858('0x42')]['key']};});_0x299268[_0x0858('0x43')]=_[_0x0858('0x44')](_0x2cc67d,_0x0858('0x3a'));_0x299268[_0x0858('0x45')]=_[_0x0858('0x46')](_0x1e09ae[_0x0858('0x45')]);_0x299268['filters']=_[_0x0858('0x47')](_0x299268['model'],_0x299268['query']);_0x20479a[_0x0858('0x48')]=_[_0x0858('0x47')](_0x299268[_0x0858('0x43')],qs[_0x0858('0x49')](_0x1e09ae['query']['fields']));_0x20479a[_0x0858('0x48')]=_0x20479a['attributes'][_0x0858('0x4a')]?_0x20479a['attributes']:_0x299268[_0x0858('0x43')];if(!_0x1e09ae['query'][_0x0858('0x4b')]('nolimit')){_0x20479a[_0x0858('0x4c')]=qs[_0x0858('0x4c')](_0x1e09ae[_0x0858('0x45')][_0x0858('0x4c')]);_0x20479a[_0x0858('0x2c')]=qs['offset'](_0x1e09ae[_0x0858('0x45')][_0x0858('0x2c')]);}_0x20479a[_0x0858('0x4d')]=qs[_0x0858('0x4e')](_0x1e09ae[_0x0858('0x45')][_0x0858('0x4e')]);_0x20479a[_0x0858('0x4f')]=qs[_0x0858('0x50')](_['pick'](_0x1e09ae[_0x0858('0x45')],_0x299268[_0x0858('0x50')]),_0x2cc67d);if(_0x1e09ae[_0x0858('0x45')]['filter']){_0x20479a['where']=_[_0x0858('0x51')](_0x20479a['where'],{'$or':_[_0x0858('0x44')](_0x2cc67d,function(_0x417a96){if(_0x417a96[_0x0858('0x42')]!==_0x0858('0x52')){var _0x12acca={};_0x12acca[_0x417a96[_0x0858('0x3a')]]={'$like':'%'+_0x1e09ae[_0x0858('0x45')]['filter']+'%'};return _0x12acca;}})});}_0x20479a=_['merge']({},_0x20479a,_0x1e09ae['options']);var _0x50906={'where':_0x20479a[_0x0858('0x4f')]};return db[_0x0858('0x3f')][_0x0858('0x2e')](_0x50906)[_0x0858('0x35')](function(_0x3ee338){_0x569e44[_0x0858('0x2e')]=_0x3ee338;if(_0x1e09ae[_0x0858('0x45')][_0x0858('0x53')]){_0x20479a[_0x0858('0x54')]=[{'all':!![]}];}return db[_0x0858('0x3f')][_0x0858('0x55')](_0x20479a);})['then'](function(_0x8cf49a){_0x569e44[_0x0858('0x56')]=_0x8cf49a;return _0x569e44;})['then'](respondWithFilteredResult(_0x57736b,_0x20479a))[_0x0858('0x57')](handleError(_0x57736b,null));};exports['show']=function(_0x397103,_0x13342){var _0x4426fb={'raw':![],'where':{'id':_0x397103[_0x0858('0x58')]['id']},'include':[{'model':db[_0x0858('0x3d')],'as':_0x0858('0x3e')}]},_0x4a0ebf={};_0x4a0ebf[_0x0858('0x43')]=_[_0x0858('0x46')](db[_0x0858('0x3f')][_0x0858('0x40')]);_0x4a0ebf[_0x0858('0x45')]=_[_0x0858('0x46')](_0x397103[_0x0858('0x45')]);_0x4a0ebf[_0x0858('0x50')]=_[_0x0858('0x47')](_0x4a0ebf['model'],_0x4a0ebf[_0x0858('0x45')]);_0x4426fb[_0x0858('0x48')]=_['intersection'](_0x4a0ebf['model'],qs[_0x0858('0x49')](_0x397103['query'][_0x0858('0x49')]));_0x4426fb[_0x0858('0x48')]=_0x4426fb['attributes']['length']?_0x4426fb[_0x0858('0x48')]:_0x4a0ebf[_0x0858('0x43')];if(_0x397103[_0x0858('0x45')][_0x0858('0x53')]){_0x4426fb[_0x0858('0x54')]=[{'all':!![]}];}_0x4426fb=_[_0x0858('0x51')]({},_0x4426fb,_0x397103['options']);return db[_0x0858('0x3f')]['find'](_0x4426fb)['then'](handleEntityNotFound(_0x13342,null))['then'](respondWithResult(_0x13342,null))['catch'](handleError(_0x13342,null));};exports[_0x0858('0x59')]=function(_0x304790,_0x17e5e6){return db['FaxAccount'][_0x0858('0x59')](_0x304790[_0x0858('0x5a')],{})[_0x0858('0x35')](function(_0x397fb0){var _0x2464de=_0x304790[_0x0858('0x5b')][_0x0858('0x5c')]({'plain':!![]});if(!_0x2464de)throw new Error(_0x0858('0x5d'));if(_0x2464de[_0x0858('0x5e')]===_0x0858('0x5b')){var _0x1b4990=_0x397fb0['get']({'plain':!![]});var _0x216ec9='FaxAccounts';return db[_0x0858('0x5f')][_0x0858('0x60')]({'where':{'name':_0x216ec9,'userProfileId':_0x2464de[_0x0858('0x61')]},'raw':!![]})[_0x0858('0x35')](function(_0x6b87b9){if(_0x6b87b9&&_0x6b87b9[_0x0858('0x62')]===0x0){return db[_0x0858('0x38')][_0x0858('0x59')]({'name':_0x1b4990[_0x0858('0x3a')],'resourceId':_0x1b4990['id'],'type':_0x6b87b9[_0x0858('0x3a')],'sectionId':_0x6b87b9['id']},{})['then'](function(){return _0x397fb0;});}else{return _0x397fb0;}})['catch'](function(_0x45fabb){logger[_0x0858('0x25')](_0x0858('0x63'),_0x45fabb);throw _0x45fabb;});}return _0x397fb0;})['then'](respondWithResult(_0x17e5e6,0xc9))[_0x0858('0x57')](handleError(_0x17e5e6,null));};exports[_0x0858('0x34')]=function(_0xa8e3b3,_0x235b1f){if(_0xa8e3b3['body']['id']){delete _0xa8e3b3[_0x0858('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0xa8e3b3[_0x0858('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x235b1f,null))[_0x0858('0x35')](saveUpdates(_0xa8e3b3[_0x0858('0x5a')],null))['then'](respondWithResult(_0x235b1f,null))[_0x0858('0x57')](handleError(_0x235b1f,null));};exports[_0x0858('0x36')]=function(_0x2801c8,_0x57c910){return db[_0x0858('0x3f')][_0x0858('0x60')]({'where':{'id':_0x2801c8[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x57c910,null))[_0x0858('0x35')](removeEntity(_0x57c910,null))[_0x0858('0x57')](handleError(_0x57c910,null));};exports[_0x0858('0x64')]=function(_0x9a14af,_0x110d7a){return db[_0x0858('0x3f')]['describe']()[_0x0858('0x35')](respondWithResult(_0x110d7a,null))[_0x0858('0x57')](handleError(_0x110d7a,null));};exports[_0x0858('0x65')]=function(_0xda4c0b,_0x1248ac,_0x565b65){if(_0xda4c0b['body']['id']){delete _0xda4c0b[_0x0858('0x5a')]['id'];}return db['FaxAccount'][_0x0858('0x60')]({'where':{'id':_0xda4c0b[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x1248ac,null))[_0x0858('0x35')](function(_0x1c1495){if(_0x1c1495){_0xda4c0b['body'][_0x0858('0x66')]=_0x1c1495['id'];return db[_0x0858('0x67')][_0x0858('0x59')](_0xda4c0b['body']);}})[_0x0858('0x35')](respondWithResult(_0x1248ac,null))[_0x0858('0x57')](handleError(_0x1248ac,null));};exports['getDispositions']=function(_0x4ebf5b,_0x478b21,_0x526b0f){var _0x1163ba={'raw':![],'where':{}};var _0x511472={};var _0x5c2540={'count':0x0,'rows':[]};return db[_0x0858('0x3f')][_0x0858('0x68')]({'where':{'id':_0x4ebf5b[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x478b21,null))[_0x0858('0x35')](function(_0x266b40){if(_0x266b40){_0x511472[_0x0858('0x43')]=_['keys'](db[_0x0858('0x67')]['rawAttributes']);_0x511472[_0x0858('0x45')]=_[_0x0858('0x46')](_0x4ebf5b['query']);_0x511472[_0x0858('0x50')]=_[_0x0858('0x47')](_0x511472['model'],_0x511472[_0x0858('0x45')]);_0x1163ba[_0x0858('0x48')]=_['intersection'](_0x511472['model'],qs[_0x0858('0x49')](_0x4ebf5b[_0x0858('0x45')]['fields']));_0x1163ba[_0x0858('0x48')]=_0x1163ba[_0x0858('0x48')][_0x0858('0x4a')]?_0x1163ba['attributes']:_0x511472['model'];if(!_0x4ebf5b['query'][_0x0858('0x4b')](_0x0858('0x69'))){_0x1163ba[_0x0858('0x4c')]=qs[_0x0858('0x4c')](_0x4ebf5b['query'][_0x0858('0x4c')]);_0x1163ba[_0x0858('0x2c')]=qs['offset'](_0x4ebf5b[_0x0858('0x45')][_0x0858('0x2c')]);}_0x1163ba[_0x0858('0x4d')]=qs[_0x0858('0x4e')](_0x4ebf5b[_0x0858('0x45')][_0x0858('0x4e')]);_0x1163ba[_0x0858('0x4f')]=qs[_0x0858('0x50')](_[_0x0858('0x6a')](_0x4ebf5b[_0x0858('0x45')],_0x511472[_0x0858('0x50')]));_0x1163ba['where'][_0x0858('0x66')]=_0x266b40['id'];if(_0x4ebf5b[_0x0858('0x45')][_0x0858('0x6b')]){_0x1163ba['where']=_[_0x0858('0x51')](_0x1163ba['where'],{'$or':_[_0x0858('0x44')](_0x1163ba[_0x0858('0x48')],function(_0x11db83){var _0x243f43={};_0x243f43[_0x11db83]={'$like':'%'+_0x4ebf5b[_0x0858('0x45')][_0x0858('0x6b')]+'%'};return _0x243f43;})});}_0x1163ba=_[_0x0858('0x51')]({},_0x1163ba,_0x4ebf5b[_0x0858('0x6c')]);return db[_0x0858('0x67')][_0x0858('0x2e')]({'where':_0x1163ba['where']})[_0x0858('0x35')](function(_0x3e2a50){_0x5c2540[_0x0858('0x2e')]=_0x3e2a50;if(_0x4ebf5b['query']['includeAll']){_0x1163ba[_0x0858('0x54')]=[{'all':!![]}];}return db[_0x0858('0x67')][_0x0858('0x55')](_0x1163ba);})[_0x0858('0x35')](function(_0x3e5da5){_0x5c2540['rows']=_0x3e5da5;return _0x5c2540;});}})[_0x0858('0x35')](respondWithFilteredResult(_0x478b21,_0x1163ba))[_0x0858('0x57')](handleError(_0x478b21,null));};exports[_0x0858('0x6d')]=function(_0x4cdc3b,_0x59da5f,_0x6a4691){return db['FaxAccount'][_0x0858('0x60')]({'where':{'id':_0x4cdc3b[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x59da5f,null))[_0x0858('0x35')](function(_0x15601a){if(_0x15601a){return _0x15601a[_0x0858('0x6d')](_0x4cdc3b['query']['ids']);}})[_0x0858('0x35')](respondWithStatusCode(_0x59da5f,null))['catch'](handleError(_0x59da5f,null));};exports[_0x0858('0x6e')]=function(_0x393028,_0x513c52,_0x22b0fb){if(_0x393028[_0x0858('0x5a')]['id']){delete _0x393028[_0x0858('0x5a')]['id'];}return db[_0x0858('0x3f')][_0x0858('0x60')]({'where':{'id':_0x393028['params']['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x513c52,null))[_0x0858('0x35')](function(_0x5c1518){if(_0x5c1518){_0x393028[_0x0858('0x5a')][_0x0858('0x66')]=_0x5c1518['id'];return db['CannedAnswer'][_0x0858('0x59')](_0x393028['body']);}})[_0x0858('0x35')](respondWithResult(_0x513c52,null))[_0x0858('0x57')](handleError(_0x513c52,null));};exports['getAnswers']=function(_0x9d956d,_0x18ee47,_0x27246a){var _0x4e8a78={'raw':![],'where':{}};var _0x491316={};var _0x1f85de={'count':0x0,'rows':[]};return db[_0x0858('0x3f')][_0x0858('0x68')]({'where':{'id':_0x9d956d[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x18ee47,null))['then'](function(_0x5c5882){if(_0x5c5882){_0x491316['model']=_[_0x0858('0x46')](db['CannedAnswer']['rawAttributes']);_0x491316[_0x0858('0x45')]=_[_0x0858('0x46')](_0x9d956d['query']);_0x491316[_0x0858('0x50')]=_[_0x0858('0x47')](_0x491316[_0x0858('0x43')],_0x491316[_0x0858('0x45')]);_0x4e8a78['attributes']=_[_0x0858('0x47')](_0x491316[_0x0858('0x43')],qs['fields'](_0x9d956d['query'][_0x0858('0x49')]));_0x4e8a78[_0x0858('0x48')]=_0x4e8a78['attributes'][_0x0858('0x4a')]?_0x4e8a78[_0x0858('0x48')]:_0x491316['model'];if(!_0x9d956d[_0x0858('0x45')][_0x0858('0x4b')](_0x0858('0x69'))){_0x4e8a78['limit']=qs[_0x0858('0x4c')](_0x9d956d[_0x0858('0x45')]['limit']);_0x4e8a78[_0x0858('0x2c')]=qs[_0x0858('0x2c')](_0x9d956d[_0x0858('0x45')][_0x0858('0x2c')]);}_0x4e8a78['order']=qs[_0x0858('0x4e')](_0x9d956d[_0x0858('0x45')][_0x0858('0x4e')]);_0x4e8a78[_0x0858('0x4f')]=qs[_0x0858('0x50')](_[_0x0858('0x6a')](_0x9d956d['query'],_0x491316[_0x0858('0x50')]));_0x4e8a78[_0x0858('0x4f')][_0x0858('0x66')]=_0x5c5882['id'];if(_0x9d956d['query'][_0x0858('0x6b')]){_0x4e8a78['where']=_['merge'](_0x4e8a78[_0x0858('0x4f')],{'$or':_[_0x0858('0x44')](_0x4e8a78[_0x0858('0x48')],function(_0x1bf3d2){var _0x4b1b1e={};_0x4b1b1e[_0x1bf3d2]={'$like':'%'+_0x9d956d[_0x0858('0x45')][_0x0858('0x6b')]+'%'};return _0x4b1b1e;})});}_0x4e8a78=_[_0x0858('0x51')]({},_0x4e8a78,_0x9d956d['options']);return db['CannedAnswer']['count']({'where':_0x4e8a78[_0x0858('0x4f')]})[_0x0858('0x35')](function(_0x1223e4){_0x1f85de[_0x0858('0x2e')]=_0x1223e4;if(_0x9d956d[_0x0858('0x45')]['includeAll']){_0x4e8a78[_0x0858('0x54')]=[{'all':!![]}];}return db[_0x0858('0x6f')]['findAll'](_0x4e8a78);})[_0x0858('0x35')](function(_0x308e68){_0x1f85de[_0x0858('0x56')]=_0x308e68;return _0x1f85de;});}})[_0x0858('0x35')](respondWithFilteredResult(_0x18ee47,_0x4e8a78))[_0x0858('0x57')](handleError(_0x18ee47,null));};exports['removeAnswers']=function(_0x56f7b9,_0x250a62,_0x364ad6){return db[_0x0858('0x3f')][_0x0858('0x60')]({'where':{'id':_0x56f7b9[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x250a62,null))[_0x0858('0x35')](function(_0x467c9e){if(_0x467c9e){return _0x467c9e[_0x0858('0x70')](_0x56f7b9[_0x0858('0x45')][_0x0858('0x71')]);}})['then'](respondWithStatusCode(_0x250a62,null))[_0x0858('0x57')](handleError(_0x250a62,null));};exports['addInteraction']=function(_0x23ab8a,_0xd939d4,_0x3c6978){return db[_0x0858('0x72')][_0x0858('0x60')]({'where':{'id':_0x23ab8a['params']['id']}})[_0x0858('0x35')](handleEntityNotFound(_0xd939d4,null))['then'](function(_0x1d7c71){if(_0x1d7c71){return _0x1d7c71[_0x0858('0x73')](_0x23ab8a[_0x0858('0x5a')][_0x0858('0x71')],_[_0x0858('0x74')](_0x23ab8a[_0x0858('0x5a')],[_0x0858('0x71'),'id'])||{});}})[_0x0858('0x35')](respondWithResult(_0xd939d4,null))[_0x0858('0x57')](handleError(_0xd939d4,null));};exports[_0x0858('0x75')]=function(_0x2e0ae4,_0x19be54,_0x43c89c){var _0x93df76={'raw':![],'where':{}};var _0x4b1d1a={};var _0x482fd4={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0858('0x68')]({'where':{'id':_0x2e0ae4[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x19be54,null))[_0x0858('0x35')](function(_0x5ae497){if(_0x5ae497){_0x4b1d1a[_0x0858('0x43')]=_[_0x0858('0x46')](db[_0x0858('0x72')][_0x0858('0x40')]);_0x4b1d1a[_0x0858('0x45')]=_['keys'](_0x2e0ae4[_0x0858('0x45')]);_0x4b1d1a[_0x0858('0x50')]=_['intersection'](_0x4b1d1a[_0x0858('0x43')],_0x4b1d1a['query']);_0x93df76[_0x0858('0x48')]=_['intersection'](_0x4b1d1a[_0x0858('0x43')],qs[_0x0858('0x49')](_0x2e0ae4['query']['fields']));_0x93df76['attributes']=_0x93df76[_0x0858('0x48')][_0x0858('0x4a')]?_0x93df76[_0x0858('0x48')]:_0x4b1d1a[_0x0858('0x43')];if(!_0x2e0ae4['query'][_0x0858('0x4b')](_0x0858('0x69'))){_0x93df76['limit']=qs['limit'](_0x2e0ae4[_0x0858('0x45')][_0x0858('0x4c')]);_0x93df76[_0x0858('0x2c')]=qs[_0x0858('0x2c')](_0x2e0ae4['query'][_0x0858('0x2c')]);}_0x93df76[_0x0858('0x4d')]=qs[_0x0858('0x4e')](_0x2e0ae4[_0x0858('0x45')][_0x0858('0x4e')]);_0x93df76[_0x0858('0x4f')]=qs[_0x0858('0x50')](_[_0x0858('0x6a')](_0x2e0ae4[_0x0858('0x45')],_0x4b1d1a[_0x0858('0x50')]));_0x93df76[_0x0858('0x4f')]['FaxAccountId']=_0x5ae497['id'];if(_0x2e0ae4['query']['filter']){_0x93df76[_0x0858('0x4f')]=_[_0x0858('0x51')](_0x93df76[_0x0858('0x4f')],{'$or':_[_0x0858('0x44')](_0x93df76[_0x0858('0x48')],function(_0x53f716){var _0x20d551={};_0x20d551[_0x53f716]={'$like':'%'+_0x2e0ae4[_0x0858('0x45')]['filter']+'%'};return _0x20d551;})});}_0x93df76=_['merge']({},_0x93df76,_0x2e0ae4['options']);return db['FaxInteraction']['count']({'where':_0x93df76[_0x0858('0x4f')]})['then'](function(_0x4bbd18){_0x482fd4['count']=_0x4bbd18;if(_0x2e0ae4[_0x0858('0x45')][_0x0858('0x53')]){_0x93df76['include']=[{'model':db['CmContact'],'as':_0x0858('0x76'),'required':![]},{'model':db[_0x0858('0x77')],'as':_0x0858('0x78'),'attributes':[_0x0858('0x3a'),_0x0858('0x79'),_0x0858('0x7a')],'required':![]},{'model':db[_0x0858('0x7b')],'as':_0x0858('0x7c'),'attributes':['id',_0x0858('0x3a'),_0x0858('0x7d')],'where':_0x2e0ae4['query'][_0x0858('0x7e')]?{'id':_0x2e0ae4[_0x0858('0x45')]['tag']}:undefined,'required':_0x2e0ae4[_0x0858('0x45')][_0x0858('0x7e')]?!![]:![]}];}return db[_0x0858('0x72')][_0x0858('0x55')](_0x93df76);})[_0x0858('0x35')](function(_0x4a09c9){_0x482fd4[_0x0858('0x56')]=_0x4a09c9;return _0x482fd4;});}})[_0x0858('0x35')](respondWithFilteredResult(_0x19be54,_0x93df76))['catch'](handleError(_0x19be54,null));};exports[_0x0858('0x7f')]=function(_0x4d8387,_0x29d209){var _0x5667f7=_0x4d8387['params']['id'];var _0x413938=_0x4d8387[_0x0858('0x5a')];var _0x4d108e=0xc8;var _0x3583db=null;return db['sequelize'][_0x0858('0x80')]({'isolationLevel':db[_0x0858('0x81')][_0x0858('0x82')]['ISOLATION_LEVELS'][_0x0858('0x83')]},function(_0x35fccd){return db[_0x0858('0x3f')][_0x0858('0x68')]({'where':{'id':_0x5667f7},'transaction':_0x35fccd})[_0x0858('0x35')](function(_0x5d76f9){if(_0x5d76f9){return db['FaxApplication'][_0x0858('0x36')]({'where':{'FaxAccountId':_0x5667f7},'transaction':_0x35fccd})[_0x0858('0x35')](function(){var _0x2c0c97=_[_0x0858('0x44')](_0x413938,function(_0xc5d0a2){_0xc5d0a2['FaxAccountId']=_0x5667f7;return _0xc5d0a2;});return db[_0x0858('0x84')][_0x0858('0x85')](_0x2c0c97,{'transaction':_0x35fccd});});}else{_0x4d108e=0x194;_0x3583db=[];}});})['then'](function(){if(_0x4d108e!==0x194){return db[_0x0858('0x84')][_0x0858('0x86')]({'where':{'FaxAccountId':_0x5667f7},'order':_0x0858('0x87')})[_0x0858('0x35')](function(_0x576c73){_0x3583db=_0x576c73;});}})[_0x0858('0x57')](function(_0x45df78){_0x4d108e=0x1f4;logger['error'](_0x45df78['stack']);if(_0x45df78['name']){delete _0x45df78['name'];}_0x3583db=_0x45df78;})[_0x0858('0x88')](function(){if(_0x3583db===null){_0x29d209['sendStatus'](_0x4d108e);}else{if(_0x4d108e===0x1f4){_0x29d209['status'](_0x4d108e)[_0x0858('0x3b')](_0x3583db);}else{_0x29d209['status'](_0x4d108e)['json'](_0x3583db);}}});};exports[_0x0858('0x89')]=function(_0x20f0c3,_0x3a036,_0x18347f){var _0x398edf={};var _0x40b437={};var _0x5cb7f7;var _0x4fdbb1;return db[_0x0858('0x3f')]['findOne']({'where':{'id':_0x20f0c3[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x3a036,null))['then'](function(_0x25c924){if(_0x25c924){_0x5cb7f7=_0x25c924;_0x40b437['model']=_[_0x0858('0x46')](db[_0x0858('0x84')]['rawAttributes']);_0x40b437[_0x0858('0x45')]=_[_0x0858('0x46')](_0x20f0c3[_0x0858('0x45')]);_0x40b437[_0x0858('0x50')]=_[_0x0858('0x47')](_0x40b437['model'],_0x40b437[_0x0858('0x45')]);_0x398edf[_0x0858('0x48')]=_['intersection'](_0x40b437[_0x0858('0x43')],qs[_0x0858('0x49')](_0x20f0c3[_0x0858('0x45')][_0x0858('0x49')]));_0x398edf[_0x0858('0x48')]=_0x398edf[_0x0858('0x48')][_0x0858('0x4a')]?_0x398edf[_0x0858('0x48')]:_0x40b437['model'];_0x398edf[_0x0858('0x4d')]=qs[_0x0858('0x4e')](_0x20f0c3[_0x0858('0x45')][_0x0858('0x4e')]);_0x398edf['where']=qs[_0x0858('0x50')](_[_0x0858('0x6a')](_0x20f0c3[_0x0858('0x45')],_0x40b437[_0x0858('0x50')]));if(_0x20f0c3[_0x0858('0x45')]['filter']){_0x398edf['where']=_[_0x0858('0x51')](_0x398edf[_0x0858('0x4f')],{'$or':_[_0x0858('0x44')](_0x398edf[_0x0858('0x48')],function(_0x52d1a8){var _0x9c28bd={};_0x9c28bd[_0x52d1a8]={'$like':'%'+_0x20f0c3[_0x0858('0x45')][_0x0858('0x6b')]+'%'};return _0x9c28bd;})});}_0x398edf=_[_0x0858('0x51')]({},_0x398edf,_0x20f0c3[_0x0858('0x6c')]);return _0x5cb7f7[_0x0858('0x89')](_0x398edf);}})[_0x0858('0x35')](function(_0x5f0435){if(_0x5f0435){_0x4fdbb1=_0x5f0435[_0x0858('0x4a')];if(!_0x20f0c3[_0x0858('0x45')][_0x0858('0x4b')](_0x0858('0x69'))){_0x398edf['limit']=qs[_0x0858('0x4c')](_0x20f0c3['query'][_0x0858('0x4c')]);_0x398edf[_0x0858('0x2c')]=qs[_0x0858('0x2c')](_0x20f0c3[_0x0858('0x45')]['offset']);}return _0x5cb7f7['getApplications'](_0x398edf);}})[_0x0858('0x35')](function(_0x170eda){if(_0x170eda){return _0x170eda?{'count':_0x4fdbb1,'rows':_0x170eda}:null;}})[_0x0858('0x35')](respondWithResult(_0x3a036,null))[_0x0858('0x57')](handleError(_0x3a036,null));};function Extension(_0x13cbd2,_0x202dd5,_0x5a1e91,_0x4911f0){this[_0x0858('0x8a')]=_0x0858('0x8b');this[_0x0858('0x8c')]=_0x13cbd2[_0x0858('0x8d')];this['app']=_0x4911f0;this[_0x0858('0x42')]=_0x0858('0x8e');this[_0x0858('0x8f')]='Fax\x20Extension';this[_0x0858('0x66')]=_0x13cbd2['id'];this[_0x0858('0x87')]=_0x202dd5;this['appdata']=_0x5a1e91;}function createExtensionsReciveFax(_0x45f981){var _0xdbb535=0x1;var _0x29758b=[];_0x29758b[_0x0858('0x90')](new Extension(_0x45f981,_0xdbb535,'',_0x0858('0x91')));_0xdbb535+=0x1;_0x29758b[_0x0858('0x90')](new Extension(_0x45f981,_0xdbb535,'CDR(type)=inbound-fax',_0x0858('0x92')));_0xdbb535+=0x1;for(var _0x1346e7 in _0x45f981){if(_0x45f981[_0x0858('0x4b')](_0x1346e7)&&(_0x1346e7===_0x0858('0x93')||_0x1346e7===_0x0858('0x8d')||_0x1346e7===_0x0858('0x94')||_0x1346e7===_0x0858('0x95')||_0x1346e7==='headerinfo'||_0x1346e7===_0x0858('0x96')||_0x1346e7===_0x0858('0x97')||_0x1346e7==='modem'||_0x1346e7===_0x0858('0x98'))){_0x29758b[_0x0858('0x90')](new Extension(_0x45f981,_0xdbb535,_0x0858('0x99')+_0x1346e7+')='+_0x45f981[_0x1346e7],_0x0858('0x92')));_0xdbb535+=0x1;}}_0x29758b[_0x0858('0x90')](new Extension(_0x45f981,_0xdbb535,'6','Wait'));_0xdbb535+=0x1;_0x29758b[_0x0858('0x90')](new Extension(_0x45f981,_0xdbb535,_0x0858('0x9a'),_0x0858('0x9b')));_0xdbb535=0x0;return _0x29758b;}exports['addAccountApplications']=function(_0x54d4f0,_0x3dc409,_0x3c2462){var _0x3faa40;return db[_0x0858('0x81')]['transaction'](function(_0x1450ab){return db[_0x0858('0x3f')][_0x0858('0x59')](_0x54d4f0[_0x0858('0x5a')],{'transaction':_0x1450ab})[_0x0858('0x35')](function(_0x201a4c){_0x3faa40=_0x201a4c[_0x0858('0x5c')]({'plain':!![]});return db[_0x0858('0x9c')]['bulkCreate'](createExtensionsReciveFax(_0x3faa40),{'transaction':_0x1450ab});});})[_0x0858('0x35')](function(){return _0x3faa40;})[_0x0858('0x35')](respondWithResult(_0x3dc409,null))[_0x0858('0x57')](handleError(_0x3dc409,null));};exports[_0x0858('0x9d')]=function(_0x48e679,_0x2d7922,_0x562fc3){var _0x1b4226;return db[_0x0858('0x81')][_0x0858('0x80')](function(_0x14cba4){return db[_0x0858('0x3f')]['update'](_0x48e679['body'],{'where':{'id':_0x48e679['body']['id']},'transaction':_0x14cba4})[_0x0858('0x35')](function(_0x4438dd){return db[_0x0858('0x9c')][_0x0858('0x36')]({'where':{'FaxAccountId':_0x48e679[_0x0858('0x5a')]['id']},'transaction':_0x14cba4})['then'](function(_0x471933){return db[_0x0858('0x9c')][_0x0858('0x85')](createExtensionsReciveFax(_[_0x0858('0x74')](_0x48e679['body'],[_0x0858('0x9e'),_0x0858('0x9f'),_0x0858('0xa0'),'updatedAt',_0x0858('0xa1'),'ListId'])),{'transaction':_0x14cba4});});});})[_0x0858('0x35')](function(){return db['FaxAccount'][_0x0858('0xa2')](_0x48e679[_0x0858('0x5a')]['id']);})[_0x0858('0x35')](respondWithResult(_0x2d7922,null))['catch'](handleError(_0x2d7922,null));};exports['getMessages']=function(_0x1a9891,_0x2e3eb0,_0x7db0a6){var _0x475032={'raw':!![],'where':{}};var _0x58ee12={};var _0x34dccf={'count':0x0,'rows':[]};return db[_0x0858('0x3f')][_0x0858('0x68')]({'where':{'id':_0x1a9891[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x2e3eb0,null))['then'](function(_0x2f3764){if(_0x2f3764){_0x58ee12['model']=_[_0x0858('0x46')](db[_0x0858('0xa3')][_0x0858('0x40')]);_0x58ee12[_0x0858('0x45')]=_['keys'](_0x1a9891['query']);_0x58ee12[_0x0858('0x50')]=_['intersection'](_0x58ee12[_0x0858('0x43')],_0x58ee12[_0x0858('0x45')]);_0x475032[_0x0858('0x48')]=_[_0x0858('0x47')](_0x58ee12[_0x0858('0x43')],qs[_0x0858('0x49')](_0x1a9891[_0x0858('0x45')][_0x0858('0x49')]));_0x475032[_0x0858('0x48')]=_0x475032[_0x0858('0x48')][_0x0858('0x4a')]?_0x475032[_0x0858('0x48')]:_0x58ee12[_0x0858('0x43')];if(!_0x1a9891[_0x0858('0x45')][_0x0858('0x4b')](_0x0858('0x69'))){_0x475032[_0x0858('0x4c')]=qs[_0x0858('0x4c')](_0x1a9891['query'][_0x0858('0x4c')]);_0x475032[_0x0858('0x2c')]=qs[_0x0858('0x2c')](_0x1a9891[_0x0858('0x45')][_0x0858('0x2c')]);}_0x475032[_0x0858('0x4d')]=qs[_0x0858('0x4e')](_0x1a9891['query'][_0x0858('0x4e')]);_0x475032[_0x0858('0x4f')]=qs[_0x0858('0x50')](_[_0x0858('0x6a')](_0x1a9891[_0x0858('0x45')],_0x58ee12[_0x0858('0x50')]));_0x475032[_0x0858('0x4f')][_0x0858('0x66')]=_0x2f3764['id'];if(_0x1a9891['query'][_0x0858('0x6b')]){_0x475032[_0x0858('0x4f')]=_[_0x0858('0x51')](_0x475032[_0x0858('0x4f')],{'$or':_[_0x0858('0x44')](_0x475032[_0x0858('0x48')],function(_0x1d2dbf){var _0x1a28ff={};_0x1a28ff[_0x1d2dbf]={'$like':'%'+_0x1a9891[_0x0858('0x45')]['filter']+'%'};return _0x1a28ff;})});}if(_0x1a9891[_0x0858('0x45')]['$gte']){var _0x38521a=_0x1a9891[_0x0858('0x45')][_0x0858('0xa4')][_0x0858('0xa5')](',');var _0x2089fa={};_0x2089fa[_0x38521a[0x0]]={'$gte':moment(_0x38521a[0x1])[_0x0858('0xa6')](_0x0858('0xa7'))};_0x475032[_0x0858('0x4f')]=_[_0x0858('0x51')](_0x475032['where'],_0x2089fa);}_0x475032=_[_0x0858('0x51')]({},_0x475032,_0x1a9891[_0x0858('0x6c')]);return db[_0x0858('0xa3')][_0x0858('0x2e')]({'where':_0x475032[_0x0858('0x4f')]})[_0x0858('0x35')](function(_0x3d2b94){_0x34dccf[_0x0858('0x2e')]=_0x3d2b94;if(_0x1a9891[_0x0858('0x45')][_0x0858('0x53')]){_0x475032[_0x0858('0x54')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x475032);})[_0x0858('0x35')](function(_0x381976){_0x34dccf[_0x0858('0x56')]=_0x381976;return _0x34dccf;});}})[_0x0858('0x35')](respondWithFilteredResult(_0x2e3eb0,_0x475032))[_0x0858('0x57')](handleError(_0x2e3eb0,null));};exports['send']=function(_0x5a7e0d,_0x1e56b9,_0xee1180){var _0x403ef6,_0x1c7b74={},_0x2ed20e;if(_0x5a7e0d[_0x0858('0x5a')]['to']){_0x2ed20e=_0x5a7e0d[_0x0858('0x5a')]['to'][0x0];}return db[_0x0858('0x3f')][_0x0858('0x60')]({'where':{'id':_0x5a7e0d[_0x0858('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x0858('0xa8'),'include':[{'model':db[_0x0858('0xa9')],'as':_0x0858('0xaa'),'where':{'fax':_0x2ed20e},'limit':0x1,'order':[[_0x0858('0xab'),_0x0858('0xac')]]}]}]})[_0x0858('0x35')](handleEntityNotFound(_0x1e56b9,null))[_0x0858('0x35')](function(_0x5110a8){_0x403ef6=_0x5110a8;if(_0x5a7e0d[_0x0858('0x5a')]['attachments']&&_0x5a7e0d[_0x0858('0x5a')]['attachments'][_0x0858('0x4a')]){for(var _0x21c207=0x0;_0x21c207<_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xad')][_0x0858('0x4a')];_0x21c207+=0x1){_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xad')][_0x21c207]={'filename':_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xad')][_0x21c207]['name'],'id':_0x5a7e0d['body']['attachments'][_0x21c207]['id'],'path':path[_0x0858('0xae')](config['root'],_0x0858('0xaf'),_0x5a7e0d[_0x0858('0x5a')]['attachments'][_0x21c207][_0x0858('0xb0')])};}}return respondWithRpcPromise(_0x0858('0xb1'),_0x0858('0xb1'),{'FaxAccountId':_[_0x0858('0xb2')](_0x5a7e0d[_0x0858('0x58')]['id'])?undefined:_0x5a7e0d[_0x0858('0x58')]['id'],'path':_['isNil'](_0x5a7e0d['body']['attachments'][0x0]['path'])?undefined:_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xad')][0x0][_0x0858('0x8')],'fax':_[_0x0858('0xb2')](_0x5a7e0d[_0x0858('0x5a')]['to'][0x0])?undefined:_0x5a7e0d[_0x0858('0x5a')]['to'][0x0]},client9002);})[_0x0858('0x35')](function(){if(_0x403ef6){if(_['isNil'](_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xb3')])){_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xb3')]=util[_0x0858('0xa6')](_0x0858('0xb4'),_0x403ef6['name'],_0x403ef6[_0x0858('0xb5')]);}if(_0x403ef6['List']){if(_0x403ef6[_0x0858('0xa8')][_0x0858('0xaa')]['length']){return _0x403ef6[_0x0858('0xa8')][_0x0858('0xaa')][0x0];}else{return db[_0x0858('0xa9')][_0x0858('0x59')](_[_0x0858('0x19')](_0x5a7e0d['body'],{'firstName':_0x5a7e0d[_0x0858('0x5a')]['to'][0x0],'phone':_0x5a7e0d['body']['to'][0x0],'fax':_0x5a7e0d['body']['to'][0x0],'ListId':_0x403ef6[_0x0858('0xb6')]}));}}else{throw new Error(_0x0858('0xb7'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x0858('0x35')](function(_0x4c634b){if(_0x4c634b){return db['FaxInteraction']['find']({'where':{'ContactId':_0x4c634b['id'],'closed':![],'FaxAccountId':_0x403ef6['id']}})[_0x0858('0x35')](function(_0x2e5a28){if(_0x2e5a28){return[_0x2e5a28,![]];}return db['FaxInteraction']['create']({'UserId':_0x5a7e0d['user']['id'],'ContactId':_0x4c634b['id'],'FaxAccountId':_0x403ef6['id'],'fax':_0x5a7e0d[_0x0858('0x5a')]['to'][0x0],'firstMsgDirection':_0x0858('0xb8'),'Messages':[_[_0x0858('0x51')](_0x5a7e0d['body'],{'read':![],'body':_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xad')][0x0][_0x0858('0xb9')],'FaxAccountId':_0x403ef6['id'],'UserId':_0x5a7e0d[_0x0858('0x5b')]['id'],'ContactId':_0x4c634b['id'],'AttachmentId':_0x5a7e0d[_0x0858('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x0858('0xa3')],'as':_0x0858('0xba')}]})[_0x0858('0x35')](function(_0x38dc94){return[_0x38dc94,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x25dae2,_0xe87c0){if(_0xe87c0){return _0x25dae2;}return db['FaxMessage'][_0x0858('0x59')]({'direction':_0x0858('0xb8'),'read':![],'body':_0x5a7e0d[_0x0858('0x5a')]['attachments'][0x0]['filename'],'FaxAccountId':_0x403ef6['id'],'FaxInteractionId':_0x25dae2['id'],'UserId':_0x5a7e0d['user']['id'],'ContactId':_0x25dae2[_0x0858('0xbb')],'AttachmentId':_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xad')][0x0]['id']})[_0x0858('0x35')](function(_0x14ad59){_0x25dae2['dataValues']['Messages']=[];_0x25dae2['dataValues'][_0x0858('0xba')]['push'](_0x14ad59[_0x0858('0xbc')]);return _0x25dae2;});})[_0x0858('0x35')](function(_0x1be974){respondWithRpcPromise(_0x0858('0xbd'),_0x0858('0xbd'),{'FaxAccountId':_[_0x0858('0xb2')](_0x5a7e0d[_0x0858('0x58')]['id'])?undefined:_0x5a7e0d[_0x0858('0x58')]['id'],'path':_['isNil'](_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xad')][0x0][_0x0858('0x8')])?undefined:_0x5a7e0d[_0x0858('0x5a')]['attachments'][0x0][_0x0858('0x8')],'fax':_[_0x0858('0xb2')](_0x5a7e0d['body']['to'][0x0])?undefined:_0x5a7e0d[_0x0858('0x5a')]['to'][0x0],'AttachmentId':_0x5a7e0d[_0x0858('0x5a')][_0x0858('0xad')][0x0]['id']},client9002)['then'](function(_0x3c31b3){logger[_0x0858('0x20')](_0x0858('0xbe'),_0x3c31b3);})[_0x0858('0x57')](function(_0x6f9ae7){logger[_0x0858('0x20')]('SendFaxRpc,\x20%s',_0x6f9ae7);});return _0x1be974;})['then'](respondWithResult(_0x1e56b9,null))[_0x0858('0x57')](handleError(_0x1e56b9,null));};exports['addAgents']=function(_0xe0b3aa,_0x29ff05,_0x43d220){return db[_0x0858('0x3f')]['find']({'where':{'id':_0xe0b3aa[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x29ff05,null))['then'](function(_0x2ad134){if(_0x2ad134){return _0x2ad134['addAgents'](_0xe0b3aa[_0x0858('0x5a')][_0x0858('0x71')],_[_0x0858('0x74')](_0xe0b3aa[_0x0858('0x5a')],[_0x0858('0x71'),'id'])||{})[_0x0858('0xbf')](function(_0x23a3c4){for(var _0xc95b15=0x0;_0xc95b15<_0xe0b3aa['body'][_0x0858('0x71')][_0x0858('0x4a')];_0xc95b15+=0x1){socket[_0x0858('0xc0')](_0x0858('0xc1'),{'UserId':Number(_0xe0b3aa['body'][_0x0858('0x71')][_0xc95b15]),'FaxAccountId':Number(_0xe0b3aa[_0x0858('0x58')]['id'])});}return _0x23a3c4;});}})[_0x0858('0x35')](respondWithResult(_0x29ff05,null))[_0x0858('0x57')](handleError(_0x29ff05,null));};exports[_0x0858('0xc2')]=function(_0x232112,_0x503c4b,_0x51b478){return db['FaxAccount']['find']({'where':{'id':_0x232112[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x503c4b,null))[_0x0858('0x35')](function(_0x3803fb){if(_0x3803fb){return _0x3803fb[_0x0858('0xc2')](_0x232112[_0x0858('0x45')][_0x0858('0x71')])[_0x0858('0x35')](function(){if(_[_0x0858('0xc3')](_0x232112['query'][_0x0858('0x71')])){for(var _0xf86407=0x0;_0xf86407<_0x232112['query']['ids'][_0x0858('0x4a')];_0xf86407+=0x1){socket[_0x0858('0xc0')](_0x0858('0xc4'),{'UserId':Number(_0x232112['query'][_0x0858('0x71')][_0xf86407]),'FaxAccountId':Number(_0x232112['params']['id'])});}}else{socket[_0x0858('0xc0')](_0x0858('0xc4'),{'UserId':Number(_0x232112[_0x0858('0x45')][_0x0858('0x71')]),'FaxAccountId':Number(_0x232112[_0x0858('0x58')]['id'])});}});}})[_0x0858('0x35')](respondWithStatusCode(_0x503c4b,null))[_0x0858('0x57')](handleError(_0x503c4b,null));};exports[_0x0858('0xc5')]=function(_0x5db512,_0x4459fc,_0x55a3b0){var _0x37e251={};var _0x10e58f={};var _0x159840;var _0x3bbce4;return db['FaxAccount']['findOne']({'where':{'id':_0x5db512[_0x0858('0x58')]['id']}})[_0x0858('0x35')](handleEntityNotFound(_0x4459fc,null))[_0x0858('0x35')](function(_0x2c4fa9){if(_0x2c4fa9){_0x159840=_0x2c4fa9;_0x10e58f['model']=_[_0x0858('0x46')](db[_0x0858('0x77')]['rawAttributes']);_0x10e58f[_0x0858('0x45')]=_['keys'](_0x5db512[_0x0858('0x45')]);_0x10e58f[_0x0858('0x50')]=_[_0x0858('0x47')](_0x10e58f['model'],_0x10e58f['query']);_0x37e251['attributes']=_[_0x0858('0x47')](_0x10e58f[_0x0858('0x43')],qs['fields'](_0x5db512['query'][_0x0858('0x49')]));_0x37e251[_0x0858('0x48')]=_0x37e251[_0x0858('0x48')][_0x0858('0x4a')]?_0x37e251[_0x0858('0x48')]:_0x10e58f[_0x0858('0x43')];_0x37e251[_0x0858('0x4d')]=qs[_0x0858('0x4e')](_0x5db512[_0x0858('0x45')]['sort']);_0x37e251[_0x0858('0x4f')]=qs[_0x0858('0x50')](_[_0x0858('0x6a')](_0x5db512['query'],_0x10e58f['filters']));if(_0x5db512['query'][_0x0858('0x6b')]){_0x37e251[_0x0858('0x4f')]=_[_0x0858('0x51')](_0x37e251['where'],{'$or':_['map'](_0x37e251[_0x0858('0x48')],function(_0x4ed565){var _0x3383aa={};_0x3383aa[_0x4ed565]={'$like':'%'+_0x5db512[_0x0858('0x45')][_0x0858('0x6b')]+'%'};return _0x3383aa;})});}_0x37e251=_[_0x0858('0x51')]({},_0x37e251,_0x5db512[_0x0858('0x6c')]);return _0x159840['getAgents'](_0x37e251);}})[_0x0858('0x35')](function(_0x40945b){if(_0x40945b){_0x3bbce4=_0x40945b[_0x0858('0x4a')];if(!_0x5db512[_0x0858('0x45')]['hasOwnProperty'](_0x0858('0x69'))){_0x37e251[_0x0858('0x4c')]=qs[_0x0858('0x4c')](_0x5db512[_0x0858('0x45')][_0x0858('0x4c')]);_0x37e251[_0x0858('0x2c')]=qs[_0x0858('0x2c')](_0x5db512[_0x0858('0x45')][_0x0858('0x2c')]);}return _0x159840[_0x0858('0xc5')](_0x37e251);}})['then'](function(_0x27549e){if(_0x27549e){return _0x27549e?{'count':_0x3bbce4,'rows':_0x27549e}:null;}})[_0x0858('0x35')](respondWithResult(_0x4459fc,null))[_0x0858('0x57')](handleError(_0x4459fc,null));}; \ No newline at end of file +var _0x453f=['ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','client','request','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','send','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','push','Wait','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found'];(function(_0x47fd9e,_0x22305e){var _0x5927af=function(_0x186fb0){while(--_0x186fb0){_0x47fd9e['push'](_0x47fd9e['shift']());}};_0x5927af(++_0x22305e);}(_0x453f,0xd5));var _0xf453=function(_0x52017e,_0x190239){_0x52017e=_0x52017e-0x0;var _0x3894af=_0x453f[_0x52017e];return _0x3894af;};'use strict';var emlformat=require(_0xf453('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf453('0x1'));var moment=require('moment');var BPromise=require(_0xf453('0x2'));var Mustache=require(_0xf453('0x3'));var util=require('util');var path=require(_0xf453('0x4'));var sox=require(_0xf453('0x5'));var csv=require(_0xf453('0x6'));var ejs=require(_0xf453('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf453('0x8'));var squel=require(_0xf453('0x9'));var crypto=require(_0xf453('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf453('0xb'));var toCsv=require(_0xf453('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf453('0xc'));var authService=require(_0xf453('0xd'));var qs=require(_0xf453('0xe'));var as=require(_0xf453('0xf'));var hardwareService=require(_0xf453('0x10'));var logger=require(_0xf453('0x11'))('api');var utils=require(_0xf453('0x12'));var config=require(_0xf453('0x13'));var licenseUtil=require(_0xf453('0x14'));var db=require(_0xf453('0x15'))['db'];config[_0xf453('0x16')]=_[_0xf453('0x17')](config['redis'],{'host':_0xf453('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf453('0x16')]));require('./faxAccount.socket')[_0xf453('0x19')](socket);var jayson=require(_0xf453('0x1a'));var client=jayson['client'][_0xf453('0x1b')]({'port':0x232c});var client9002=jayson[_0xf453('0x1c')][_0xf453('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2933ba,_0x469607,_0x45f88f,_0x27e37a){return new BPromise(function(_0x471ff5,_0x286873){var _0x3e8814=_0x27e37a||client;return _0x3e8814[_0xf453('0x1d')](_0x2933ba,_0x45f88f)['then'](function(_0x491f54){logger['info']('FaxAccount,\x20%s,\x20%s',_0x469607,_0xf453('0x1e'));logger[_0xf453('0x1f')](_0xf453('0x20'),_0x469607,_0xf453('0x1e'),JSON[_0xf453('0x21')](_0x491f54));if(_0x491f54['error']){if(_0x491f54[_0xf453('0x22')][_0xf453('0x23')]===0x1f4){logger[_0xf453('0x22')](_0xf453('0x24'),_0x469607,_0x491f54[_0xf453('0x22')][_0xf453('0x25')]);return _0x286873(_0x491f54[_0xf453('0x22')][_0xf453('0x25')]);}logger[_0xf453('0x22')](_0xf453('0x24'),_0x469607,_0x491f54[_0xf453('0x22')]['message']);return _0x471ff5(_0x491f54['error']['message']);}else{logger[_0xf453('0x26')](_0xf453('0x24'),_0x469607,'request\x20sent');_0x471ff5(_0x491f54[_0xf453('0x27')][_0xf453('0x25')]);}})['catch'](function(_0x3960ae){logger[_0xf453('0x22')](_0xf453('0x24'),_0x469607,_0x3960ae);_0x286873(_0x3960ae);});});}function respondWithStatusCode(_0x15815e,_0x4fd11f){_0x4fd11f=_0x4fd11f||0xcc;return function(_0x4fca61){if(_0x4fca61){return _0x15815e['sendStatus'](_0x4fd11f);}return _0x15815e[_0xf453('0x28')](_0x4fd11f)[_0xf453('0x29')]();};}function respondWithResult(_0x55c28b,_0x309252){_0x309252=_0x309252||0xc8;return function(_0x433d9d){if(_0x433d9d){return _0x55c28b['status'](_0x309252)[_0xf453('0x2a')](_0x433d9d);}};}function respondWithFilteredResult(_0x3efa7c,_0x149ccc){return function(_0x27a14d){if(_0x27a14d){var _0x1f357f=typeof _0x149ccc[_0xf453('0x2b')]===_0xf453('0x2c')&&typeof _0x149ccc[_0xf453('0x2d')]===_0xf453('0x2c');var _0x89a03=_0x27a14d[_0xf453('0x2e')];var _0x46d742=_0x1f357f?0x0:_0x149ccc['offset'];var _0x3fa01a=_0x1f357f?_0x27a14d[_0xf453('0x2e')]:_0x149ccc[_0xf453('0x2b')]+_0x149ccc[_0xf453('0x2d')];var _0x1cea33;if(_0x3fa01a>=_0x89a03){_0x3fa01a=_0x89a03;_0x1cea33=0xc8;}else{_0x1cea33=0xce;}_0x3efa7c[_0xf453('0x28')](_0x1cea33);return _0x3efa7c[_0xf453('0x2f')](_0xf453('0x30'),_0x46d742+'-'+_0x3fa01a+'/'+_0x89a03)['json'](_0x27a14d);}return null;};}function patchUpdates(_0x17b450){return function(_0x198ba2){try{jsonpatch[_0xf453('0x31')](_0x198ba2,_0x17b450,!![]);}catch(_0x1ff9ec){return BPromise[_0xf453('0x32')](_0x1ff9ec);}return _0x198ba2[_0xf453('0x33')]();};}function saveUpdates(_0x1dcb8a,_0x3898e6){return function(_0x578c8c){if(_0x578c8c){return _0x578c8c[_0xf453('0x34')](_0x1dcb8a)[_0xf453('0x35')](function(_0x78f62c){return _0x78f62c;});}return null;};}function removeEntity(_0x120077,_0x4ca508){return function(_0x4ef9f4){if(_0x4ef9f4){return _0x4ef9f4[_0xf453('0x36')]()[_0xf453('0x35')](function(){var _0x397e7f=_0x4ef9f4[_0xf453('0x37')]({'plain':!![]});var _0x19c129='FaxAccounts';return db[_0xf453('0x38')][_0xf453('0x36')]({'where':{'type':_0x19c129,'resourceId':_0x397e7f['id']}})[_0xf453('0x35')](function(){return _0x4ef9f4;});})['then'](function(){_0x120077[_0xf453('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3315,_0x508e13){return function(_0x556a06){if(!_0x556a06){_0x5b3315[_0xf453('0x39')](0x194);}return _0x556a06;};}function handleError(_0x470966,_0x3bb42b){_0x3bb42b=_0x3bb42b||0x1f4;return function(_0x1b3685){logger[_0xf453('0x22')](_0x1b3685[_0xf453('0x3a')]);if(_0x1b3685[_0xf453('0x3b')]){delete _0x1b3685[_0xf453('0x3b')];}_0x470966[_0xf453('0x28')](_0x3bb42b)['send'](_0x1b3685);};}exports['index']=function(_0x2d7441,_0x2e38b8){var _0x24a24f={'include':[{'model':db[_0xf453('0x3c')],'as':'mandatoryDispositionPause'}]},_0x2c3f93={},_0x5e17ce={'count':0x0,'rows':[]};var _0x355f14=_[_0xf453('0x3d')](db[_0xf453('0x3e')][_0xf453('0x3f')],function(_0x1a3fda){return{'name':_0x1a3fda[_0xf453('0x40')],'type':_0x1a3fda[_0xf453('0x41')][_0xf453('0x42')]};});_0x2c3f93['model']=_[_0xf453('0x3d')](_0x355f14,_0xf453('0x3b'));_0x2c3f93['query']=_[_0xf453('0x43')](_0x2d7441[_0xf453('0x44')]);_0x2c3f93['filters']=_['intersection'](_0x2c3f93[_0xf453('0x45')],_0x2c3f93[_0xf453('0x44')]);_0x24a24f['attributes']=_[_0xf453('0x46')](_0x2c3f93[_0xf453('0x45')],qs[_0xf453('0x47')](_0x2d7441[_0xf453('0x44')][_0xf453('0x47')]));_0x24a24f[_0xf453('0x48')]=_0x24a24f['attributes'][_0xf453('0x49')]?_0x24a24f['attributes']:_0x2c3f93[_0xf453('0x45')];if(!_0x2d7441[_0xf453('0x44')][_0xf453('0x4a')](_0xf453('0x4b'))){_0x24a24f[_0xf453('0x2d')]=qs[_0xf453('0x2d')](_0x2d7441[_0xf453('0x44')][_0xf453('0x2d')]);_0x24a24f[_0xf453('0x2b')]=qs[_0xf453('0x2b')](_0x2d7441[_0xf453('0x44')][_0xf453('0x2b')]);}_0x24a24f[_0xf453('0x4c')]=qs[_0xf453('0x4d')](_0x2d7441[_0xf453('0x44')][_0xf453('0x4d')]);_0x24a24f[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x2d7441[_0xf453('0x44')],_0x2c3f93[_0xf453('0x4f')]),_0x355f14);if(_0x2d7441['query'][_0xf453('0x51')]){_0x24a24f[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x24a24f[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x355f14,function(_0x3c8f89){if(_0x3c8f89[_0xf453('0x41')]!=='VIRTUAL'){var _0x8646b3={};_0x8646b3[_0x3c8f89['name']]={'$like':'%'+_0x2d7441[_0xf453('0x44')][_0xf453('0x51')]+'%'};return _0x8646b3;}})});}_0x24a24f=_['merge']({},_0x24a24f,_0x2d7441[_0xf453('0x53')]);var _0x4a0dba={'where':_0x24a24f['where']};return db[_0xf453('0x3e')][_0xf453('0x2e')](_0x4a0dba)['then'](function(_0x40eac5){_0x5e17ce[_0xf453('0x2e')]=_0x40eac5;if(_0x2d7441[_0xf453('0x44')][_0xf453('0x54')]){_0x24a24f[_0xf453('0x55')]=[{'all':!![]}];}return db[_0xf453('0x3e')]['findAll'](_0x24a24f);})['then'](function(_0x5b3a29){_0x5e17ce[_0xf453('0x56')]=_0x5b3a29;return _0x5e17ce;})[_0xf453('0x35')](respondWithFilteredResult(_0x2e38b8,_0x24a24f))[_0xf453('0x57')](handleError(_0x2e38b8,null));};exports[_0xf453('0x58')]=function(_0x43152a,_0xeb73eb){var _0x3409a9={'raw':![],'where':{'id':_0x43152a[_0xf453('0x59')]['id']},'include':[{'model':db[_0xf453('0x3c')],'as':_0xf453('0x5a')}]},_0x4935eb={};_0x4935eb[_0xf453('0x45')]=_['keys'](db['FaxAccount'][_0xf453('0x3f')]);_0x4935eb[_0xf453('0x44')]=_[_0xf453('0x43')](_0x43152a[_0xf453('0x44')]);_0x4935eb[_0xf453('0x4f')]=_[_0xf453('0x46')](_0x4935eb['model'],_0x4935eb[_0xf453('0x44')]);_0x3409a9[_0xf453('0x48')]=_[_0xf453('0x46')](_0x4935eb[_0xf453('0x45')],qs[_0xf453('0x47')](_0x43152a['query'][_0xf453('0x47')]));_0x3409a9[_0xf453('0x48')]=_0x3409a9[_0xf453('0x48')][_0xf453('0x49')]?_0x3409a9['attributes']:_0x4935eb['model'];if(_0x43152a[_0xf453('0x44')][_0xf453('0x54')]){_0x3409a9['include']=[{'all':!![]}];}_0x3409a9=_[_0xf453('0x52')]({},_0x3409a9,_0x43152a[_0xf453('0x53')]);return db[_0xf453('0x3e')][_0xf453('0x5b')](_0x3409a9)['then'](handleEntityNotFound(_0xeb73eb,null))[_0xf453('0x35')](respondWithResult(_0xeb73eb,null))[_0xf453('0x57')](handleError(_0xeb73eb,null));};exports[_0xf453('0x5c')]=function(_0x23b261,_0x2f418b){return db[_0xf453('0x3e')][_0xf453('0x5c')](_0x23b261[_0xf453('0x5d')],{})[_0xf453('0x35')](function(_0x526499){var _0x4ed8ef=_0x23b261[_0xf453('0x5e')][_0xf453('0x37')]({'plain':!![]});if(!_0x4ed8ef)throw new Error(_0xf453('0x5f'));if(_0x4ed8ef[_0xf453('0x60')]===_0xf453('0x5e')){var _0x4bc18b=_0x526499[_0xf453('0x37')]({'plain':!![]});var _0x1cfb83=_0xf453('0x61');return db[_0xf453('0x62')]['find']({'where':{'name':_0x1cfb83,'userProfileId':_0x4ed8ef[_0xf453('0x63')]},'raw':!![]})['then'](function(_0x25ad02){if(_0x25ad02&&_0x25ad02['autoAssociation']===0x0){return db['UserProfileResource'][_0xf453('0x5c')]({'name':_0x4bc18b[_0xf453('0x3b')],'resourceId':_0x4bc18b['id'],'type':_0x25ad02[_0xf453('0x3b')],'sectionId':_0x25ad02['id']},{})[_0xf453('0x35')](function(){return _0x526499;});}else{return _0x526499;}})[_0xf453('0x57')](function(_0x889302){logger[_0xf453('0x22')](_0xf453('0x64'),_0x889302);throw _0x889302;});}return _0x526499;})[_0xf453('0x35')](respondWithResult(_0x2f418b,0xc9))[_0xf453('0x57')](handleError(_0x2f418b,null));};exports[_0xf453('0x34')]=function(_0x38033a,_0x4818c9){if(_0x38033a[_0xf453('0x5d')]['id']){delete _0x38033a['body']['id'];}return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x38033a[_0xf453('0x59')]['id']},'include':[{'model':db[_0xf453('0x3c')],'as':_0xf453('0x5a')}]})[_0xf453('0x35')](handleEntityNotFound(_0x4818c9,null))['then'](saveUpdates(_0x38033a[_0xf453('0x5d')],null))[_0xf453('0x35')](respondWithResult(_0x4818c9,null))[_0xf453('0x57')](handleError(_0x4818c9,null));};exports[_0xf453('0x36')]=function(_0x14893a,_0x58e014){return db['FaxAccount'][_0xf453('0x5b')]({'where':{'id':_0x14893a[_0xf453('0x59')]['id']}})['then'](handleEntityNotFound(_0x58e014,null))[_0xf453('0x35')](removeEntity(_0x58e014,null))['catch'](handleError(_0x58e014,null));};exports[_0xf453('0x65')]=function(_0x430c04,_0x54ee8c){return db['FaxAccount'][_0xf453('0x65')]()[_0xf453('0x35')](respondWithResult(_0x54ee8c,null))['catch'](handleError(_0x54ee8c,null));};exports[_0xf453('0x66')]=function(_0x17e2ec,_0xd22939,_0x41480b){if(_0x17e2ec[_0xf453('0x5d')]['id']){delete _0x17e2ec['body']['id'];}return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x17e2ec[_0xf453('0x59')]['id']}})['then'](handleEntityNotFound(_0xd22939,null))[_0xf453('0x35')](function(_0x56d127){if(_0x56d127){_0x17e2ec[_0xf453('0x5d')][_0xf453('0x67')]=_0x56d127['id'];return db[_0xf453('0x68')]['create'](_0x17e2ec[_0xf453('0x5d')]);}})['then'](respondWithResult(_0xd22939,null))[_0xf453('0x57')](handleError(_0xd22939,null));};exports[_0xf453('0x69')]=function(_0x1af4cf,_0x807658,_0x3be77a){var _0x52341b={'raw':![],'where':{}};var _0x1c02ad={};var _0x13c2db={'count':0x0,'rows':[]};return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x1af4cf[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x807658,null))[_0xf453('0x35')](function(_0x21408c){if(_0x21408c){_0x1c02ad[_0xf453('0x45')]=_[_0xf453('0x43')](db['Disposition'][_0xf453('0x3f')]);_0x1c02ad[_0xf453('0x44')]=_[_0xf453('0x43')](_0x1af4cf[_0xf453('0x44')]);_0x1c02ad['filters']=_['intersection'](_0x1c02ad['model'],_0x1c02ad[_0xf453('0x44')]);_0x52341b[_0xf453('0x48')]=_[_0xf453('0x46')](_0x1c02ad[_0xf453('0x45')],qs[_0xf453('0x47')](_0x1af4cf['query'][_0xf453('0x47')]));_0x52341b[_0xf453('0x48')]=_0x52341b['attributes']['length']?_0x52341b['attributes']:_0x1c02ad[_0xf453('0x45')];if(!_0x1af4cf[_0xf453('0x44')]['hasOwnProperty'](_0xf453('0x4b'))){_0x52341b[_0xf453('0x2d')]=qs[_0xf453('0x2d')](_0x1af4cf[_0xf453('0x44')][_0xf453('0x2d')]);_0x52341b['offset']=qs[_0xf453('0x2b')](_0x1af4cf['query'][_0xf453('0x2b')]);}_0x52341b['order']=qs[_0xf453('0x4d')](_0x1af4cf[_0xf453('0x44')][_0xf453('0x4d')]);_0x52341b[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x1af4cf[_0xf453('0x44')],_0x1c02ad[_0xf453('0x4f')]));_0x52341b[_0xf453('0x4e')]['FaxAccountId']=_0x21408c['id'];if(_0x1af4cf[_0xf453('0x44')][_0xf453('0x51')]){_0x52341b[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x52341b[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x52341b['attributes'],function(_0x5aaaed){var _0x2e009f={};_0x2e009f[_0x5aaaed]={'$like':'%'+_0x1af4cf['query']['filter']+'%'};return _0x2e009f;})});}_0x52341b=_[_0xf453('0x52')]({},_0x52341b,_0x1af4cf[_0xf453('0x53')]);return db[_0xf453('0x68')][_0xf453('0x2e')]({'where':_0x52341b[_0xf453('0x4e')]})[_0xf453('0x35')](function(_0xc1986f){_0x13c2db[_0xf453('0x2e')]=_0xc1986f;if(_0x1af4cf['query']['includeAll']){_0x52341b[_0xf453('0x55')]=[{'all':!![]}];}return db[_0xf453('0x68')][_0xf453('0x6b')](_0x52341b);})[_0xf453('0x35')](function(_0x114719){_0x13c2db[_0xf453('0x56')]=_0x114719;return _0x13c2db;});}})[_0xf453('0x35')](respondWithFilteredResult(_0x807658,_0x52341b))[_0xf453('0x57')](handleError(_0x807658,null));};exports[_0xf453('0x6c')]=function(_0x22ea82,_0x43d63b,_0x1a76f3){return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x22ea82[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x43d63b,null))['then'](function(_0xa5cede){if(_0xa5cede){return _0xa5cede[_0xf453('0x6c')](_0x22ea82[_0xf453('0x44')][_0xf453('0x6d')]);}})[_0xf453('0x35')](respondWithStatusCode(_0x43d63b,null))[_0xf453('0x57')](handleError(_0x43d63b,null));};exports[_0xf453('0x6e')]=function(_0x3e96c1,_0x1d0a8d,_0x5b5d8a){if(_0x3e96c1[_0xf453('0x5d')]['id']){delete _0x3e96c1['body']['id'];}return db[_0xf453('0x3e')]['find']({'where':{'id':_0x3e96c1[_0xf453('0x59')]['id']}})['then'](handleEntityNotFound(_0x1d0a8d,null))[_0xf453('0x35')](function(_0x291fab){if(_0x291fab){_0x3e96c1[_0xf453('0x5d')][_0xf453('0x67')]=_0x291fab['id'];return db['CannedAnswer'][_0xf453('0x5c')](_0x3e96c1[_0xf453('0x5d')]);}})[_0xf453('0x35')](respondWithResult(_0x1d0a8d,null))[_0xf453('0x57')](handleError(_0x1d0a8d,null));};exports[_0xf453('0x6f')]=function(_0x164801,_0x3be550,_0x1a8244){var _0x1915d1={'raw':![],'where':{}};var _0x453366={};var _0x5755b0={'count':0x0,'rows':[]};return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x164801[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x3be550,null))[_0xf453('0x35')](function(_0x4e1560){if(_0x4e1560){_0x453366['model']=_[_0xf453('0x43')](db['CannedAnswer'][_0xf453('0x3f')]);_0x453366[_0xf453('0x44')]=_[_0xf453('0x43')](_0x164801[_0xf453('0x44')]);_0x453366['filters']=_[_0xf453('0x46')](_0x453366[_0xf453('0x45')],_0x453366[_0xf453('0x44')]);_0x1915d1['attributes']=_['intersection'](_0x453366[_0xf453('0x45')],qs[_0xf453('0x47')](_0x164801['query'][_0xf453('0x47')]));_0x1915d1[_0xf453('0x48')]=_0x1915d1[_0xf453('0x48')][_0xf453('0x49')]?_0x1915d1[_0xf453('0x48')]:_0x453366[_0xf453('0x45')];if(!_0x164801[_0xf453('0x44')][_0xf453('0x4a')](_0xf453('0x4b'))){_0x1915d1['limit']=qs[_0xf453('0x2d')](_0x164801[_0xf453('0x44')]['limit']);_0x1915d1[_0xf453('0x2b')]=qs['offset'](_0x164801[_0xf453('0x44')][_0xf453('0x2b')]);}_0x1915d1[_0xf453('0x4c')]=qs[_0xf453('0x4d')](_0x164801[_0xf453('0x44')][_0xf453('0x4d')]);_0x1915d1[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x164801[_0xf453('0x44')],_0x453366['filters']));_0x1915d1['where'][_0xf453('0x67')]=_0x4e1560['id'];if(_0x164801[_0xf453('0x44')][_0xf453('0x51')]){_0x1915d1[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x1915d1[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x1915d1[_0xf453('0x48')],function(_0x193e51){var _0x5df280={};_0x5df280[_0x193e51]={'$like':'%'+_0x164801[_0xf453('0x44')]['filter']+'%'};return _0x5df280;})});}_0x1915d1=_['merge']({},_0x1915d1,_0x164801[_0xf453('0x53')]);return db[_0xf453('0x70')][_0xf453('0x2e')]({'where':_0x1915d1[_0xf453('0x4e')]})['then'](function(_0x408d81){_0x5755b0['count']=_0x408d81;if(_0x164801[_0xf453('0x44')][_0xf453('0x54')]){_0x1915d1[_0xf453('0x55')]=[{'all':!![]}];}return db[_0xf453('0x70')]['findAll'](_0x1915d1);})[_0xf453('0x35')](function(_0x395410){_0x5755b0[_0xf453('0x56')]=_0x395410;return _0x5755b0;});}})[_0xf453('0x35')](respondWithFilteredResult(_0x3be550,_0x1915d1))[_0xf453('0x57')](handleError(_0x3be550,null));};exports[_0xf453('0x71')]=function(_0x470909,_0x28b539,_0x3fc91f){return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x470909[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x28b539,null))[_0xf453('0x35')](function(_0x54fe65){if(_0x54fe65){return _0x54fe65['removeAnswers'](_0x470909['query'][_0xf453('0x6d')]);}})[_0xf453('0x35')](respondWithStatusCode(_0x28b539,null))[_0xf453('0x57')](handleError(_0x28b539,null));};exports[_0xf453('0x72')]=function(_0x5ec8f8,_0x1bb99b,_0x56010f){return db[_0xf453('0x73')][_0xf453('0x5b')]({'where':{'id':_0x5ec8f8[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x1bb99b,null))[_0xf453('0x35')](function(_0x113157){if(_0x113157){return _0x113157['addInteraction'](_0x5ec8f8[_0xf453('0x5d')][_0xf453('0x6d')],_[_0xf453('0x74')](_0x5ec8f8['body'],[_0xf453('0x6d'),'id'])||{});}})[_0xf453('0x35')](respondWithResult(_0x1bb99b,null))['catch'](handleError(_0x1bb99b,null));};exports[_0xf453('0x75')]=function(_0x1115f2,_0x57de44,_0x332661){var _0x41a09c={'raw':![],'where':{}};var _0x43d09b={};var _0x5ed3cd={'count':0x0,'rows':[]};return db[_0xf453('0x3e')]['findOne']({'where':{'id':_0x1115f2[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x57de44,null))[_0xf453('0x35')](function(_0x5b7ab9){if(_0x5b7ab9){_0x43d09b[_0xf453('0x45')]=_[_0xf453('0x43')](db[_0xf453('0x73')][_0xf453('0x3f')]);_0x43d09b[_0xf453('0x44')]=_[_0xf453('0x43')](_0x1115f2[_0xf453('0x44')]);_0x43d09b[_0xf453('0x4f')]=_['intersection'](_0x43d09b['model'],_0x43d09b[_0xf453('0x44')]);_0x41a09c[_0xf453('0x48')]=_['intersection'](_0x43d09b[_0xf453('0x45')],qs[_0xf453('0x47')](_0x1115f2[_0xf453('0x44')]['fields']));_0x41a09c['attributes']=_0x41a09c[_0xf453('0x48')][_0xf453('0x49')]?_0x41a09c[_0xf453('0x48')]:_0x43d09b[_0xf453('0x45')];if(!_0x1115f2['query'][_0xf453('0x4a')](_0xf453('0x4b'))){_0x41a09c[_0xf453('0x2d')]=qs[_0xf453('0x2d')](_0x1115f2[_0xf453('0x44')][_0xf453('0x2d')]);_0x41a09c[_0xf453('0x2b')]=qs[_0xf453('0x2b')](_0x1115f2[_0xf453('0x44')][_0xf453('0x2b')]);}_0x41a09c['order']=qs[_0xf453('0x4d')](_0x1115f2[_0xf453('0x44')][_0xf453('0x4d')]);_0x41a09c[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_['pick'](_0x1115f2[_0xf453('0x44')],_0x43d09b[_0xf453('0x4f')]));_0x41a09c[_0xf453('0x4e')][_0xf453('0x67')]=_0x5b7ab9['id'];if(_0x1115f2[_0xf453('0x44')][_0xf453('0x51')]){_0x41a09c['where']=_['merge'](_0x41a09c[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x41a09c[_0xf453('0x48')],function(_0x3815b5){var _0x195689={};_0x195689[_0x3815b5]={'$like':'%'+_0x1115f2[_0xf453('0x44')][_0xf453('0x51')]+'%'};return _0x195689;})});}_0x41a09c=_[_0xf453('0x52')]({},_0x41a09c,_0x1115f2[_0xf453('0x53')]);return db[_0xf453('0x73')][_0xf453('0x2e')]({'where':_0x41a09c['where']})[_0xf453('0x35')](function(_0x5efe09){_0x5ed3cd['count']=_0x5efe09;if(_0x1115f2['query'][_0xf453('0x54')]){_0x41a09c[_0xf453('0x55')]=[{'model':db[_0xf453('0x76')],'as':_0xf453('0x77'),'required':![]},{'model':db[_0xf453('0x78')],'as':_0xf453('0x79'),'attributes':[_0xf453('0x3b'),_0xf453('0x7a'),'internal'],'required':![]},{'model':db[_0xf453('0x7b')],'as':_0xf453('0x7c'),'attributes':['id','name',_0xf453('0x7d')],'where':_0x1115f2[_0xf453('0x44')][_0xf453('0x7e')]?{'id':_0x1115f2['query'][_0xf453('0x7e')]}:undefined,'required':_0x1115f2['query']['tag']?!![]:![]}];}return db[_0xf453('0x73')][_0xf453('0x6b')](_0x41a09c);})[_0xf453('0x35')](function(_0x4b5a26){_0x5ed3cd[_0xf453('0x56')]=_0x4b5a26;return _0x5ed3cd;});}})[_0xf453('0x35')](respondWithFilteredResult(_0x57de44,_0x41a09c))['catch'](handleError(_0x57de44,null));};exports['addApplications']=function(_0x277527,_0xf6f321){var _0x3750bb=_0x277527['params']['id'];var _0x1d91fa=_0x277527['body'];var _0x52f81d=0xc8;var _0x2979b1=null;return db[_0xf453('0x7f')][_0xf453('0x80')]({'isolationLevel':db[_0xf453('0x7f')][_0xf453('0x81')][_0xf453('0x82')][_0xf453('0x83')]},function(_0x2e8579){return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x3750bb},'transaction':_0x2e8579})['then'](function(_0x24d442){if(_0x24d442){return db['FaxApplication'][_0xf453('0x36')]({'where':{'FaxAccountId':_0x3750bb},'transaction':_0x2e8579})[_0xf453('0x35')](function(){var _0x4817e4=_[_0xf453('0x3d')](_0x1d91fa,function(_0x4fae17){_0x4fae17[_0xf453('0x67')]=_0x3750bb;return _0x4fae17;});return db[_0xf453('0x84')][_0xf453('0x85')](_0x4817e4,{'transaction':_0x2e8579});});}else{_0x52f81d=0x194;_0x2979b1=[];}});})[_0xf453('0x35')](function(){if(_0x52f81d!==0x194){return db[_0xf453('0x84')]['findAndCountAll']({'where':{'FaxAccountId':_0x3750bb},'order':_0xf453('0x86')})['then'](function(_0x26bea1){_0x2979b1=_0x26bea1;});}})[_0xf453('0x57')](function(_0x3d5ccf){_0x52f81d=0x1f4;logger[_0xf453('0x22')](_0x3d5ccf[_0xf453('0x3a')]);if(_0x3d5ccf['name']){delete _0x3d5ccf[_0xf453('0x3b')];}_0x2979b1=_0x3d5ccf;})[_0xf453('0x87')](function(){if(_0x2979b1===null){_0xf6f321['sendStatus'](_0x52f81d);}else{if(_0x52f81d===0x1f4){_0xf6f321[_0xf453('0x28')](_0x52f81d)[_0xf453('0x88')](_0x2979b1);}else{_0xf6f321[_0xf453('0x28')](_0x52f81d)[_0xf453('0x2a')](_0x2979b1);}}});};exports['getApplications']=function(_0x7779c6,_0x51d575,_0x25ccd5){var _0x2948b9={};var _0x12d49a={};var _0x58f683;var _0x669146;return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x7779c6[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x51d575,null))[_0xf453('0x35')](function(_0x5749a7){if(_0x5749a7){_0x58f683=_0x5749a7;_0x12d49a[_0xf453('0x45')]=_[_0xf453('0x43')](db['FaxApplication'][_0xf453('0x3f')]);_0x12d49a[_0xf453('0x44')]=_[_0xf453('0x43')](_0x7779c6[_0xf453('0x44')]);_0x12d49a[_0xf453('0x4f')]=_[_0xf453('0x46')](_0x12d49a['model'],_0x12d49a['query']);_0x2948b9['attributes']=_[_0xf453('0x46')](_0x12d49a[_0xf453('0x45')],qs[_0xf453('0x47')](_0x7779c6['query'][_0xf453('0x47')]));_0x2948b9['attributes']=_0x2948b9['attributes'][_0xf453('0x49')]?_0x2948b9[_0xf453('0x48')]:_0x12d49a[_0xf453('0x45')];_0x2948b9['order']=qs[_0xf453('0x4d')](_0x7779c6[_0xf453('0x44')][_0xf453('0x4d')]);_0x2948b9[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x7779c6[_0xf453('0x44')],_0x12d49a[_0xf453('0x4f')]));if(_0x7779c6[_0xf453('0x44')]['filter']){_0x2948b9[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x2948b9['where'],{'$or':_[_0xf453('0x3d')](_0x2948b9[_0xf453('0x48')],function(_0x9a8810){var _0xb63724={};_0xb63724[_0x9a8810]={'$like':'%'+_0x7779c6[_0xf453('0x44')][_0xf453('0x51')]+'%'};return _0xb63724;})});}_0x2948b9=_[_0xf453('0x52')]({},_0x2948b9,_0x7779c6[_0xf453('0x53')]);return _0x58f683[_0xf453('0x89')](_0x2948b9);}})[_0xf453('0x35')](function(_0x125fcf){if(_0x125fcf){_0x669146=_0x125fcf[_0xf453('0x49')];if(!_0x7779c6['query'][_0xf453('0x4a')]('nolimit')){_0x2948b9[_0xf453('0x2d')]=qs['limit'](_0x7779c6[_0xf453('0x44')]['limit']);_0x2948b9[_0xf453('0x2b')]=qs[_0xf453('0x2b')](_0x7779c6[_0xf453('0x44')][_0xf453('0x2b')]);}return _0x58f683[_0xf453('0x89')](_0x2948b9);}})['then'](function(_0x3d41d2){if(_0x3d41d2){return _0x3d41d2?{'count':_0x669146,'rows':_0x3d41d2}:null;}})[_0xf453('0x35')](respondWithResult(_0x51d575,null))['catch'](handleError(_0x51d575,null));};function Extension(_0x496c5a,_0x36bacf,_0x5a3a12,_0x4ee172){this[_0xf453('0x8a')]=_0xf453('0x8b');this[_0xf453('0x8c')]=_0x496c5a[_0xf453('0x8d')];this['app']=_0x4ee172;this[_0xf453('0x41')]=_0xf453('0x8e');this[_0xf453('0x8f')]=_0xf453('0x90');this[_0xf453('0x67')]=_0x496c5a['id'];this[_0xf453('0x86')]=_0x36bacf;this[_0xf453('0x91')]=_0x5a3a12;}function createExtensionsReciveFax(_0x3a5d2c){var _0x360350=0x1;var _0x215c3f=[];_0x215c3f['push'](new Extension(_0x3a5d2c,_0x360350,'',_0xf453('0x92')));_0x360350+=0x1;_0x215c3f['push'](new Extension(_0x3a5d2c,_0x360350,_0xf453('0x93'),'Set'));_0x360350+=0x1;for(var _0x22f5cf in _0x3a5d2c){if(_0x3a5d2c[_0xf453('0x4a')](_0x22f5cf)&&(_0x22f5cf===_0xf453('0x94')||_0x22f5cf===_0xf453('0x8d')||_0x22f5cf===_0xf453('0x95')||_0x22f5cf==='faxdetect'||_0x22f5cf===_0xf453('0x96')||_0x22f5cf===_0xf453('0x97')||_0x22f5cf===_0xf453('0x98')||_0x22f5cf===_0xf453('0x99')||_0x22f5cf===_0xf453('0x9a'))){_0x215c3f['push'](new Extension(_0x3a5d2c,_0x360350,_0xf453('0x9b')+_0x22f5cf+')='+_0x3a5d2c[_0x22f5cf],'Set'));_0x360350+=0x1;}}_0x215c3f[_0xf453('0x9c')](new Extension(_0x3a5d2c,_0x360350,'6',_0xf453('0x9d')));_0x360350+=0x1;_0x215c3f['push'](new Extension(_0x3a5d2c,_0x360350,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0xf453('0x9e')));_0x360350=0x0;return _0x215c3f;}exports[_0xf453('0x9f')]=function(_0x1848bd,_0x2ecc6a,_0x1b3225){var _0x32a22d;return db[_0xf453('0x7f')][_0xf453('0x80')](function(_0x5a70cd){return db[_0xf453('0x3e')][_0xf453('0x5c')](_0x1848bd[_0xf453('0x5d')],{'transaction':_0x5a70cd})[_0xf453('0x35')](function(_0xf0126c){_0x32a22d=_0xf0126c[_0xf453('0x37')]({'plain':!![]});return db[_0xf453('0xa0')][_0xf453('0x85')](createExtensionsReciveFax(_0x32a22d),{'transaction':_0x5a70cd});});})[_0xf453('0x35')](function(){return _0x32a22d;})[_0xf453('0x35')](respondWithResult(_0x2ecc6a,null))[_0xf453('0x57')](handleError(_0x2ecc6a,null));};exports['updateAccountApplications']=function(_0x22d9ed,_0x26ae4c,_0x5207ca){var _0x4694a6;return db[_0xf453('0x7f')][_0xf453('0x80')](function(_0x3011f8){return db[_0xf453('0x3e')][_0xf453('0x34')](_0x22d9ed[_0xf453('0x5d')],{'where':{'id':_0x22d9ed[_0xf453('0x5d')]['id']},'transaction':_0x3011f8})[_0xf453('0x35')](function(_0x59d147){return db['VoiceExtension'][_0xf453('0x36')]({'where':{'FaxAccountId':_0x22d9ed['body']['id']},'transaction':_0x3011f8})['then'](function(_0x47d5a1){return db[_0xf453('0xa0')][_0xf453('0x85')](createExtensionsReciveFax(_[_0xf453('0x74')](_0x22d9ed[_0xf453('0x5d')],[_0xf453('0xa1'),_0xf453('0x42'),_0xf453('0xa2'),_0xf453('0xa3'),_0xf453('0xa4'),'ListId'])),{'transaction':_0x3011f8});});});})[_0xf453('0x35')](function(){return db[_0xf453('0x3e')][_0xf453('0xa5')](_0x22d9ed[_0xf453('0x5d')]['id']);})[_0xf453('0x35')](respondWithResult(_0x26ae4c,null))[_0xf453('0x57')](handleError(_0x26ae4c,null));};exports[_0xf453('0xa6')]=function(_0x3ea9b5,_0x1e8ec7,_0x56ddc4){var _0x45dd40={'raw':!![],'where':{}};var _0x2edbc5={};var _0xc5c819={'count':0x0,'rows':[]};return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x3ea9b5['params']['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x1e8ec7,null))[_0xf453('0x35')](function(_0x473e5e){if(_0x473e5e){_0x2edbc5[_0xf453('0x45')]=_[_0xf453('0x43')](db[_0xf453('0xa7')][_0xf453('0x3f')]);_0x2edbc5[_0xf453('0x44')]=_['keys'](_0x3ea9b5['query']);_0x2edbc5[_0xf453('0x4f')]=_[_0xf453('0x46')](_0x2edbc5[_0xf453('0x45')],_0x2edbc5[_0xf453('0x44')]);_0x45dd40[_0xf453('0x48')]=_['intersection'](_0x2edbc5[_0xf453('0x45')],qs['fields'](_0x3ea9b5[_0xf453('0x44')][_0xf453('0x47')]));_0x45dd40[_0xf453('0x48')]=_0x45dd40[_0xf453('0x48')][_0xf453('0x49')]?_0x45dd40[_0xf453('0x48')]:_0x2edbc5[_0xf453('0x45')];if(!_0x3ea9b5[_0xf453('0x44')]['hasOwnProperty'](_0xf453('0x4b'))){_0x45dd40[_0xf453('0x2d')]=qs['limit'](_0x3ea9b5[_0xf453('0x44')][_0xf453('0x2d')]);_0x45dd40[_0xf453('0x2b')]=qs[_0xf453('0x2b')](_0x3ea9b5[_0xf453('0x44')]['offset']);}_0x45dd40[_0xf453('0x4c')]=qs[_0xf453('0x4d')](_0x3ea9b5[_0xf453('0x44')][_0xf453('0x4d')]);_0x45dd40[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x3ea9b5[_0xf453('0x44')],_0x2edbc5[_0xf453('0x4f')]));_0x45dd40[_0xf453('0x4e')]['FaxAccountId']=_0x473e5e['id'];if(_0x3ea9b5[_0xf453('0x44')][_0xf453('0x51')]){_0x45dd40[_0xf453('0x4e')]=_['merge'](_0x45dd40[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x45dd40['attributes'],function(_0x1c7437){var _0x339d33={};_0x339d33[_0x1c7437]={'$like':'%'+_0x3ea9b5[_0xf453('0x44')]['filter']+'%'};return _0x339d33;})});}if(_0x3ea9b5['query']['$gte']){var _0x3c44e6=_0x3ea9b5[_0xf453('0x44')][_0xf453('0xa8')][_0xf453('0xa9')](',');var _0x5f1b7={};_0x5f1b7[_0x3c44e6[0x0]]={'$gte':moment(_0x3c44e6[0x1])[_0xf453('0xaa')](_0xf453('0xab'))};_0x45dd40[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x45dd40[_0xf453('0x4e')],_0x5f1b7);}_0x45dd40=_[_0xf453('0x52')]({},_0x45dd40,_0x3ea9b5['options']);return db[_0xf453('0xa7')][_0xf453('0x2e')]({'where':_0x45dd40[_0xf453('0x4e')]})[_0xf453('0x35')](function(_0x192f41){_0xc5c819[_0xf453('0x2e')]=_0x192f41;if(_0x3ea9b5['query'][_0xf453('0x54')]){_0x45dd40[_0xf453('0x55')]=[{'all':!![]}];}return db[_0xf453('0xa7')][_0xf453('0x6b')](_0x45dd40);})[_0xf453('0x35')](function(_0x3b63e1){_0xc5c819[_0xf453('0x56')]=_0x3b63e1;return _0xc5c819;});}})[_0xf453('0x35')](respondWithFilteredResult(_0x1e8ec7,_0x45dd40))[_0xf453('0x57')](handleError(_0x1e8ec7,null));};exports['send']=function(_0x74ff79,_0x80b887,_0x411d75){var _0x5a04c8,_0x185f94={},_0x44e848;if(_0x74ff79[_0xf453('0x5d')]['to']){_0x44e848=_0x74ff79[_0xf453('0x5d')]['to'][0x0];}return db[_0xf453('0x3e')]['find']({'where':{'id':_0x74ff79[_0xf453('0x59')]['id']},'include':[{'model':db[_0xf453('0xac')],'as':_0xf453('0xad'),'include':[{'model':db[_0xf453('0x76')],'as':_0xf453('0xae'),'where':{'fax':_0x44e848},'limit':0x1,'order':[[_0xf453('0xa3'),_0xf453('0xaf')]]}]}]})[_0xf453('0x35')](handleEntityNotFound(_0x80b887,null))['then'](function(_0x1523e0){_0x5a04c8=_0x1523e0;if(_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')]&&_0x74ff79['body'][_0xf453('0xb0')][_0xf453('0x49')]){for(var _0x5d394c=0x0;_0x5d394c<_0x74ff79['body'][_0xf453('0xb0')][_0xf453('0x49')];_0x5d394c+=0x1){_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][_0x5d394c]={'filename':_0x74ff79['body'][_0xf453('0xb0')][_0x5d394c][_0xf453('0x3b')],'id':_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][_0x5d394c]['id'],'path':path[_0xf453('0xb1')](config['root'],_0xf453('0xb2'),_0x74ff79['body'][_0xf453('0xb0')][_0x5d394c][_0xf453('0xb3')])};}}return respondWithRpcPromise(_0xf453('0xb4'),'CheckAfterSend',{'FaxAccountId':_[_0xf453('0xb5')](_0x74ff79[_0xf453('0x59')]['id'])?undefined:_0x74ff79[_0xf453('0x59')]['id'],'path':_[_0xf453('0xb5')](_0x74ff79['body'][_0xf453('0xb0')][0x0]['path'])?undefined:_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0][_0xf453('0x4')],'fax':_['isNil'](_0x74ff79[_0xf453('0x5d')]['to'][0x0])?undefined:_0x74ff79['body']['to'][0x0]},client9002);})[_0xf453('0x35')](function(){if(_0x5a04c8){if(_['isNil'](_0x74ff79[_0xf453('0x5d')][_0xf453('0xb6')])){_0x74ff79[_0xf453('0x5d')][_0xf453('0xb6')]=util[_0xf453('0xaa')](_0xf453('0xb7'),_0x5a04c8[_0xf453('0x3b')],_0x5a04c8[_0xf453('0xb8')]);}if(_0x5a04c8[_0xf453('0xad')]){if(_0x5a04c8[_0xf453('0xad')][_0xf453('0xae')][_0xf453('0x49')]){return _0x5a04c8[_0xf453('0xad')][_0xf453('0xae')][0x0];}else{return db[_0xf453('0x76')][_0xf453('0x5c')](_['defaults'](_0x74ff79[_0xf453('0x5d')],{'firstName':_0x74ff79['body']['to'][0x0],'phone':_0x74ff79['body']['to'][0x0],'fax':_0x74ff79[_0xf453('0x5d')]['to'][0x0],'ListId':_0x5a04c8[_0xf453('0xb9')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xf453('0xba'));}})[_0xf453('0x35')](function(_0x56a662){if(_0x56a662){return db[_0xf453('0x73')]['find']({'where':{'ContactId':_0x56a662['id'],'closed':![],'FaxAccountId':_0x5a04c8['id']}})[_0xf453('0x35')](function(_0x274121){if(_0x274121){return[_0x274121,![]];}return db[_0xf453('0x73')][_0xf453('0x5c')]({'UserId':_0x74ff79[_0xf453('0x5e')]['id'],'ContactId':_0x56a662['id'],'FaxAccountId':_0x5a04c8['id'],'fax':_0x74ff79[_0xf453('0x5d')]['to'][0x0],'firstMsgDirection':_0xf453('0xbb'),'Messages':[_[_0xf453('0x52')](_0x74ff79[_0xf453('0x5d')],{'read':![],'body':_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0][_0xf453('0xbc')],'FaxAccountId':_0x5a04c8['id'],'UserId':_0x74ff79['user']['id'],'ContactId':_0x56a662['id'],'AttachmentId':_0x74ff79['body'][_0xf453('0xb0')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xf453('0xbd')}]})['then'](function(_0x5f3f1d){return[_0x5f3f1d,!![]];});});}else{throw new Error(_0xf453('0xbe'));}})['spread'](function(_0x2f56f4,_0x186f7a){if(_0x186f7a){return _0x2f56f4;}return db[_0xf453('0xa7')][_0xf453('0x5c')]({'direction':_0xf453('0xbb'),'read':![],'body':_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0]['filename'],'FaxAccountId':_0x5a04c8['id'],'FaxInteractionId':_0x2f56f4['id'],'UserId':_0x74ff79[_0xf453('0x5e')]['id'],'ContactId':_0x2f56f4[_0xf453('0xbf')],'AttachmentId':_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0]['id']})['then'](function(_0x5862a3){_0x2f56f4[_0xf453('0xc0')]['Messages']=[];_0x2f56f4['dataValues'][_0xf453('0xbd')][_0xf453('0x9c')](_0x5862a3['dataValues']);return _0x2f56f4;});})[_0xf453('0x35')](function(_0x10a844){respondWithRpcPromise(_0xf453('0xc1'),'SendFax',{'FaxAccountId':_[_0xf453('0xb5')](_0x74ff79[_0xf453('0x59')]['id'])?undefined:_0x74ff79['params']['id'],'path':_[_0xf453('0xb5')](_0x74ff79['body'][_0xf453('0xb0')][0x0][_0xf453('0x4')])?undefined:_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0]['path'],'fax':_[_0xf453('0xb5')](_0x74ff79['body']['to'][0x0])?undefined:_0x74ff79[_0xf453('0x5d')]['to'][0x0],'AttachmentId':_0x74ff79['body'][_0xf453('0xb0')][0x0]['id']},client9002)[_0xf453('0x35')](function(_0x14d3c3){logger[_0xf453('0x26')](_0xf453('0xc2'),_0x14d3c3);})[_0xf453('0x57')](function(_0xd97959){logger[_0xf453('0x26')](_0xf453('0xc2'),_0xd97959);});return _0x10a844;})[_0xf453('0x35')](respondWithResult(_0x80b887,null))['catch'](handleError(_0x80b887,null));};exports[_0xf453('0xc3')]=function(_0x37bb20,_0x3f28df,_0x48ce3e){return db['FaxAccount']['find']({'where':{'id':_0x37bb20['params']['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x3f28df,null))[_0xf453('0x35')](function(_0x4a0435){if(_0x4a0435){return _0x4a0435[_0xf453('0xc3')](_0x37bb20['body'][_0xf453('0x6d')],_[_0xf453('0x74')](_0x37bb20[_0xf453('0x5d')],['ids','id'])||{})[_0xf453('0xc4')](function(_0x2f546c){for(var _0x399bd9=0x0;_0x399bd9<_0x37bb20[_0xf453('0x5d')][_0xf453('0x6d')][_0xf453('0x49')];_0x399bd9+=0x1){socket[_0xf453('0xc5')](_0xf453('0xc6'),{'UserId':Number(_0x37bb20[_0xf453('0x5d')][_0xf453('0x6d')][_0x399bd9]),'FaxAccountId':Number(_0x37bb20['params']['id'])});}return _0x2f546c;});}})['then'](respondWithResult(_0x3f28df,null))[_0xf453('0x57')](handleError(_0x3f28df,null));};exports[_0xf453('0xc7')]=function(_0x196209,_0x3bef84,_0x4b2b6f){return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x196209[_0xf453('0x59')]['id']}})['then'](handleEntityNotFound(_0x3bef84,null))[_0xf453('0x35')](function(_0x31d4fe){if(_0x31d4fe){return _0x31d4fe['removeAgents'](_0x196209[_0xf453('0x44')]['ids'])[_0xf453('0x35')](function(){if(_['isArray'](_0x196209['query']['ids'])){for(var _0x9bca55=0x0;_0x9bca55<_0x196209[_0xf453('0x44')][_0xf453('0x6d')][_0xf453('0x49')];_0x9bca55+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x196209['query']['ids'][_0x9bca55]),'FaxAccountId':Number(_0x196209[_0xf453('0x59')]['id'])});}}else{socket['emit'](_0xf453('0xc8'),{'UserId':Number(_0x196209['query'][_0xf453('0x6d')]),'FaxAccountId':Number(_0x196209[_0xf453('0x59')]['id'])});}});}})[_0xf453('0x35')](respondWithStatusCode(_0x3bef84,null))[_0xf453('0x57')](handleError(_0x3bef84,null));};exports[_0xf453('0xc9')]=function(_0x6ae284,_0xfa30df,_0x2758fb){var _0x5acd29={};var _0x282183={};var _0x1f024f;var _0x2dd766;return db['FaxAccount'][_0xf453('0x6a')]({'where':{'id':_0x6ae284['params']['id']}})[_0xf453('0x35')](handleEntityNotFound(_0xfa30df,null))[_0xf453('0x35')](function(_0x29a318){if(_0x29a318){_0x1f024f=_0x29a318;_0x282183[_0xf453('0x45')]=_[_0xf453('0x43')](db[_0xf453('0x78')][_0xf453('0x3f')]);_0x282183['query']=_[_0xf453('0x43')](_0x6ae284[_0xf453('0x44')]);_0x282183[_0xf453('0x4f')]=_[_0xf453('0x46')](_0x282183[_0xf453('0x45')],_0x282183[_0xf453('0x44')]);_0x5acd29['attributes']=_['intersection'](_0x282183[_0xf453('0x45')],qs[_0xf453('0x47')](_0x6ae284['query'][_0xf453('0x47')]));_0x5acd29[_0xf453('0x48')]=_0x5acd29[_0xf453('0x48')][_0xf453('0x49')]?_0x5acd29[_0xf453('0x48')]:_0x282183[_0xf453('0x45')];_0x5acd29[_0xf453('0x4c')]=qs[_0xf453('0x4d')](_0x6ae284[_0xf453('0x44')][_0xf453('0x4d')]);_0x5acd29['where']=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x6ae284[_0xf453('0x44')],_0x282183[_0xf453('0x4f')]));if(_0x6ae284[_0xf453('0x44')][_0xf453('0x51')]){_0x5acd29[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x5acd29[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x5acd29[_0xf453('0x48')],function(_0x51a045){var _0x3abd37={};_0x3abd37[_0x51a045]={'$like':'%'+_0x6ae284[_0xf453('0x44')][_0xf453('0x51')]+'%'};return _0x3abd37;})});}_0x5acd29=_[_0xf453('0x52')]({},_0x5acd29,_0x6ae284[_0xf453('0x53')]);return _0x1f024f[_0xf453('0xc9')](_0x5acd29);}})[_0xf453('0x35')](function(_0x342d7e){if(_0x342d7e){_0x2dd766=_0x342d7e[_0xf453('0x49')];if(!_0x6ae284[_0xf453('0x44')][_0xf453('0x4a')](_0xf453('0x4b'))){_0x5acd29['limit']=qs[_0xf453('0x2d')](_0x6ae284[_0xf453('0x44')]['limit']);_0x5acd29[_0xf453('0x2b')]=qs['offset'](_0x6ae284[_0xf453('0x44')]['offset']);}return _0x1f024f['getAgents'](_0x5acd29);}})[_0xf453('0x35')](function(_0x15bea6){if(_0x15bea6){return _0x15bea6?{'count':_0x2dd766,'rows':_0x15bea6}:null;}})[_0xf453('0x35')](respondWithResult(_0xfa30df,null))[_0xf453('0x57')](handleError(_0xfa30df,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3f85e4c..2f65048 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 _0xf628=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','emit','hasOwnProperty'];(function(_0x1e05e9,_0x40472c){var _0x27b537=function(_0x422781){while(--_0x422781){_0x1e05e9['push'](_0x1e05e9['shift']());}};_0x27b537(++_0x40472c);}(_0xf628,0x7f));var _0x8f62=function(_0x19086c,_0xd17244){_0x19086c=_0x19086c-0x0;var _0x9fba73=_0xf628[_0x19086c];return _0x9fba73;};'use strict';var EventEmitter=require(_0x8f62('0x0'));var FaxAccount=require(_0x8f62('0x1'))['db'][_0x8f62('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8f62('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x393c04){return function(_0x18593f,_0x1706d2,_0x2377a5){FaxAccountEvents[_0x8f62('0x4')](_0x393c04+':'+_0x18593f['id'],_0x18593f);FaxAccountEvents['emit'](_0x393c04,_0x18593f);_0x2377a5(null);};}for(var e in events){if(events[_0x8f62('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x8f62('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0xd3d3=['hook','exports','FaxAccount','setMaxListeners','emit','hasOwnProperty'];(function(_0x39adbc,_0x206482){var _0x57628d=function(_0x40d2aa){while(--_0x40d2aa){_0x39adbc['push'](_0x39adbc['shift']());}};_0x57628d(++_0x206482);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3d3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x3d3d('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3d3d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xd18336){return function(_0xf51158,_0x2fceb1,_0x4f0996){FaxAccountEvents[_0x3d3d('0x2')](_0xd18336+':'+_0xf51158['id'],_0xf51158);FaxAccountEvents['emit'](_0xd18336,_0xf51158);_0x4f0996(null);};}for(var e in events){if(events[_0x3d3d('0x3')](e)){var event=events[e];FaxAccount[_0x3d3d('0x4')](e,emitEvent(event));}}module[_0x3d3d('0x5')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9bd3205..d64e942 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 _0xc168=['fax_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc168,0xb5));var _0x8c16=function(_0x5243bb,_0x4641fb){_0x5243bb=_0x5243bb-0x0;var _0xadaa18=_0xc168[_0x5243bb];return _0xadaa18;};'use strict';var _=require(_0x8c16('0x0'));var util=require(_0x8c16('0x1'));var logger=require(_0x8c16('0x2'))(_0x8c16('0x3'));var moment=require(_0x8c16('0x4'));var BPromise=require('bluebird');var rp=require(_0x8c16('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c16('0x6'));var config=require(_0x8c16('0x7'));var attributes=require(_0x8c16('0x8'));module[_0x8c16('0x9')]=function(_0x118ea2,_0x21e558){return _0x118ea2['define'](_0x8c16('0xa'),attributes,{'tableName':_0x8c16('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11c7=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util'];(function(_0x532b5b,_0xce6ec8){var _0x169ff9=function(_0x4d2804){while(--_0x4d2804){_0x532b5b['push'](_0x532b5b['shift']());}};_0x169ff9(++_0xce6ec8);}(_0x11c7,0x111));var _0x711c=function(_0x4e7e88,_0x343ab5){_0x4e7e88=_0x4e7e88-0x0;var _0x1cbe4c=_0x11c7[_0x4e7e88];return _0x1cbe4c;};'use strict';var _=require(_0x711c('0x0'));var util=require(_0x711c('0x1'));var logger=require(_0x711c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x711c('0x3'));var rp=require(_0x711c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x711c('0x5'));var config=require(_0x711c('0x6'));var attributes=require(_0x711c('0x7'));module[_0x711c('0x8')]=function(_0x18501a,_0x48a287){return _0x18501a['define'](_0x711c('0x9'),attributes,{'tableName':_0x711c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index d8cd410..8ace4b5 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 _0xde8d=['map','model','attributes','stringify','NotifyFaxAccount','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','applications','list','orderBy','priority','asc','Applications','length','create','FaxInteraction','Contact\x20not\x20found','spread','get','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','include'];(function(_0x370c46,_0x838a5d){var _0x7bfe4e=function(_0xe0d0dd){while(--_0xe0d0dd){_0x370c46['push'](_0x370c46['shift']());}};_0x7bfe4e(++_0x838a5d);}(_0xde8d,0x15f));var _0xdde8=function(_0x46c9f8,_0x299670){_0x46c9f8=_0x46c9f8-0x0;var _0xcaef7e=_0xde8d[_0x46c9f8];return _0xcaef7e;};'use strict';var _=require(_0xdde8('0x0'));var util=require(_0xdde8('0x1'));var moment=require(_0xdde8('0x2'));var BPromise=require('bluebird');var rs=require(_0xdde8('0x3'));var fs=require('fs');var Redis=require(_0xdde8('0x4'));var db=require(_0xdde8('0x5'))['db'];var utils=require(_0xdde8('0x6'));var logger=require(_0xdde8('0x7'))(_0xdde8('0x8'));var config=require(_0xdde8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdde8('0xa')][_0xdde8('0xb')]({'port':0x232c});config[_0xdde8('0xc')]=_[_0xdde8('0xd')](config['redis'],{'host':_0xdde8('0xe'),'port':0x18eb});var socket=require(_0xdde8('0xf'))(new Redis(config['redis']));require(_0xdde8('0x10'))[_0xdde8('0x11')](socket);function respondWithRpcPromise(_0xb598d7,_0x49c995,_0x45ac27){return new BPromise(function(_0x4c85ec,_0xe1ee3a){return client[_0xdde8('0x12')](_0xb598d7,_0x45ac27)[_0xdde8('0x13')](function(_0x4fa83d){logger[_0xdde8('0x14')](_0xdde8('0x15'),_0x49c995,_0xdde8('0x16'));logger[_0xdde8('0x17')](_0xdde8('0x18'),_0x49c995,_0xdde8('0x16'),JSON['stringify'](_0x4fa83d));if(_0x4fa83d[_0xdde8('0x19')]){if(_0x4fa83d[_0xdde8('0x19')][_0xdde8('0x1a')]===0x1f4){logger[_0xdde8('0x19')]('FaxAccount,\x20%s,\x20%s',_0x49c995,_0x4fa83d['error']['message']);return _0xe1ee3a(_0x4fa83d[_0xdde8('0x19')]['message']);}logger[_0xdde8('0x19')](_0xdde8('0x15'),_0x49c995,_0x4fa83d[_0xdde8('0x19')][_0xdde8('0x1b')]);return _0x4c85ec(_0x4fa83d[_0xdde8('0x19')][_0xdde8('0x1b')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x49c995,'request\x20sent');_0x4c85ec(_0x4fa83d['result'][_0xdde8('0x1b')]);}})[_0xdde8('0x1c')](function(_0x4f93d7){logger[_0xdde8('0x19')](_0xdde8('0x15'),_0x49c995,_0x4f93d7);_0xe1ee3a(_0x4f93d7);});});}exports[_0xdde8('0x1d')]=function(_0x3832c2){var _0x1b94b1=this;return new Promise(function(_0x56152d,_0x2fab64){return db[_0xdde8('0x1e')][_0xdde8('0x1f')]({'raw':_0x3832c2['options']?_0x3832c2[_0xdde8('0x20')][_0xdde8('0x21')]===undefined?!![]:![]:!![],'where':_0x3832c2['options']?_0x3832c2[_0xdde8('0x20')][_0xdde8('0x22')]||null:null,'attributes':_0x3832c2[_0xdde8('0x20')]?_0x3832c2[_0xdde8('0x20')]['attributes']||null:null,'limit':_0x3832c2['options']?_0x3832c2[_0xdde8('0x20')][_0xdde8('0x23')]||null:null,'include':_0x3832c2[_0xdde8('0x20')]?_0x3832c2[_0xdde8('0x20')][_0xdde8('0x24')]?_[_0xdde8('0x25')](_0x3832c2['options'][_0xdde8('0x24')],function(_0x28bb75){return{'model':db[_0x28bb75[_0xdde8('0x26')]],'as':_0x28bb75['as'],'attributes':_0x28bb75['attributes'],'include':_0x28bb75[_0xdde8('0x24')]?_[_0xdde8('0x25')](_0x28bb75[_0xdde8('0x24')],function(_0x3bb0a7){return{'model':db[_0x3bb0a7[_0xdde8('0x26')]],'as':_0x3bb0a7['as'],'attributes':_0x3bb0a7['attributes'],'include':_0x3bb0a7[_0xdde8('0x24')]?_['map'](_0x3bb0a7[_0xdde8('0x24')],function(_0x37255a){return{'model':db[_0x37255a['model']],'as':_0x37255a['as'],'attributes':_0x37255a[_0xdde8('0x27')]};}):[]};}):[]};}):[]:[]})[_0xdde8('0x13')](function(_0x456e63){logger['info'](_0xdde8('0x1d'),_0x3832c2);logger['debug'](_0xdde8('0x1d'),_0x3832c2,JSON[_0xdde8('0x28')](_0x456e63));_0x56152d(_0x456e63);})[_0xdde8('0x1c')](function(_0x3d28ed){logger[_0xdde8('0x19')]('GetFaxAccount',_0x3d28ed[_0xdde8('0x1b')],_0x3832c2);_0x2fab64(_0x1b94b1[_0xdde8('0x19')](0x1f4,_0x3d28ed[_0xdde8('0x1b')]));});});};exports[_0xdde8('0x29')]=function(_0x32b4b3,_0x853b65,_0x154bce){var _0x161ff7=this;return new Promise(function(_0x563456,_0x43b851){var _0x38b190={'body':_0x32b4b3[_0xdde8('0x2a')],'channel':_0xdde8('0x2b')};var _0x86f765=[];var _0x145730=[];var _0x57ddae={};return db['CmContact'][_0xdde8('0x2c')]()[_0xdde8('0x13')](function(_0xdce0b0){if(!_0xdce0b0){throw new db[(_0xdde8('0x2d'))][(_0xdde8('0x2e'))](_0xdde8('0x2f'));}_0x86f765=_['difference'](_[_0xdde8('0x30')](_0xdce0b0),['createdAt',_0xdde8('0x31')]);_0x145730=_[_0xdde8('0x32')](_[_0xdde8('0x30')](_0xdce0b0),['createdAt',_0xdde8('0x31'),'CompanyId',_0xdde8('0x33')]);if(_0x32b4b3['body']['id']){delete _0x32b4b3[_0xdde8('0x2a')]['id'];}if(_[_0xdde8('0x34')](_0x32b4b3[_0xdde8('0x2a')][_0xdde8('0x35')])){throw new db[(_0xdde8('0x2d'))][(_0xdde8('0x2e'))](_0xdde8('0x36'));}if(_[_0xdde8('0x34')](_0x32b4b3[_0xdde8('0x2a')]['body'])||_0x32b4b3[_0xdde8('0x2a')]['body']===''){throw new db[(_0xdde8('0x2d'))][(_0xdde8('0x2e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x32b4b3[_0xdde8('0x2a')][_0xdde8('0x37')])){throw new db[(_0xdde8('0x2d'))][(_0xdde8('0x2e'))](_0xdde8('0x38')+_0x145730);}if(!_[_0xdde8('0x39')](_0x145730,_0x32b4b3[_0xdde8('0x2a')][_0xdde8('0x37')])){throw new db['Sequelize'][(_0xdde8('0x2e'))](_0xdde8('0x3a')+_0x145730);}_0x57ddae[_0x32b4b3[_0xdde8('0x2a')]['mapKey']]=_0x32b4b3[_0xdde8('0x2a')][_0xdde8('0x35')];})['then'](function(){return db[_0xdde8('0x1e')][_0xdde8('0x3b')]({'where':{'id':_0x32b4b3[_0xdde8('0x3c')]['id']},'include':[{'model':db[_0xdde8('0x3d')],'as':_0xdde8('0x3e'),'include':[{'model':db[_0xdde8('0x3f')],'as':_0xdde8('0x40'),'where':_0x57ddae,'limit':0x1,'order':[[_0xdde8('0x31'),'DESC']]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xdde8('0x13')](function(_0x37a1d4){if(_0x37a1d4&&_0x37a1d4[_0xdde8('0x3e')]){var _0x445caf=_0x37a1d4['get']({'plain':!![]});_0x38b190['account']=_0x445caf;_0x38b190[_0xdde8('0x41')]=_0x445caf['Applications'];_0x38b190[_0xdde8('0x42')]=_0x445caf['List'];_0x38b190[_0xdde8('0x41')]=_[_0xdde8('0x43')](_0x38b190[_0xdde8('0x41')],[_0xdde8('0x44')],[_0xdde8('0x45')]);if(_0x38b190[_0xdde8('0x3c')][_0xdde8('0x46')]){delete _0x38b190[_0xdde8('0x3c')]['Applications'];}if(_0x38b190[_0xdde8('0x3c')][_0xdde8('0x3e')]&&_0x38b190[_0xdde8('0x3c')][_0xdde8('0x3e')][_0xdde8('0x40')][_0xdde8('0x47')]){return _0x38b190['account']['List']['Contacts'][0x0];}var _0x347393=_['defaults'](_0x32b4b3[_0xdde8('0x2a')],{'firstName':_0x32b4b3['body'][_0xdde8('0x35')],'ListId':_0x445caf[_0xdde8('0x33')]});_0x347393[_0x32b4b3['body'][_0xdde8('0x37')]]=_0x32b4b3['body'][_0xdde8('0x35')];return db[_0xdde8('0x3f')][_0xdde8('0x48')](_0x347393,{'fields':_0x86f765,'raw':!![]});}})[_0xdde8('0x13')](function(_0x2e5780){_0x38b190['contact']=_0x2e5780;if(_0x2e5780){var _0x27d177={'ContactId':_0x2e5780['id'],'FaxAccountId':_0x32b4b3['account']['id'],'fax':_0x2e5780[_0xdde8('0x2b')]};return db[_0xdde8('0x49')]['find']({'where':{'ContactId':_0x2e5780['id'],'closed':![],'FaxAccountId':_0x32b4b3[_0xdde8('0x3c')]['id']}})[_0xdde8('0x13')](function(_0x311625){if(_0x311625){return[_0x311625,![]];}return db[_0xdde8('0x49')]['create'](_0x27d177)[_0xdde8('0x13')](function(_0x3b9afb){return[_0x3b9afb,!![]];});});}else{throw new Error(_0xdde8('0x4a'));}})[_0xdde8('0x4b')](function(_0x5adec4,_0x4b3370){var _0x23a147=_0x5adec4[_0xdde8('0x4c')]({'plain':!![]});if(_0x4b3370){if(_0x38b190[_0xdde8('0x3c')]['autoclose']){_0x38b190[_0xdde8('0x41')][_0xdde8('0x4d')]({'id':0x0,'priority':_0x38b190['applications'][_0xdde8('0x47')]+0x1,'app':_0xdde8('0x4e'),'appdata':_0xdde8('0x4f'),'interval':_0xdde8('0x50')});}_0x23a147[_0xdde8('0x51')]=!![];}else{_0x23a147['created']=![];}_0x38b190[_0xdde8('0x52')]=_0x23a147;return db[_0xdde8('0x53')][_0xdde8('0x48')]({'body':_0x32b4b3[_0xdde8('0x2a')]['body'],'FaxAccountId':_0x32b4b3[_0xdde8('0x3c')]['id'],'FaxInteractionId':_0x5adec4['id'],'direction':'in','ContactId':_0x5adec4[_0xdde8('0x54')],'AttachmentId':_0x32b4b3[_0xdde8('0x2a')][_0xdde8('0x55')]});})[_0xdde8('0x13')](function(_0x4f114f){_0x38b190[_0xdde8('0x1b')]=_0x4f114f;if(!_0x38b190[_0xdde8('0x52')][_0xdde8('0x56')])return;return db['User']['find']({'attributes':['id',_0xdde8('0x57')],'where':{'id':_0x38b190[_0xdde8('0x52')][_0xdde8('0x56')]}});})[_0xdde8('0x13')](function(_0x29a8d4){if(_0x29a8d4){_0x38b190['applications'][_0xdde8('0x58')]({'id':0x0,'priority':0x0,'app':_0xdde8('0x59'),'appdata':_0x29a8d4[_0xdde8('0x57')]+','+(_0x38b190[_0xdde8('0x3c')][_0xdde8('0x5a')]||0xa),'interval':_0xdde8('0x50')});}if(!_0x38b190['interaction'][_0xdde8('0x5b')])return;return db[_0xdde8('0x5c')][_0xdde8('0x3b')]({'attributes':['id',_0xdde8('0x57')],'where':{'id':_0x38b190['interaction'][_0xdde8('0x5b')]}});})[_0xdde8('0x13')](function(_0x5468a2){if(_0x5468a2){_0x38b190[_0xdde8('0x41')][_0xdde8('0x58')]({'id':0x0,'priority':0x1,'app':_0xdde8('0x5d'),'appdata':_0x5468a2['name']+','+(_0x38b190['account'][_0xdde8('0x5e')]||0x12c),'interval':_0xdde8('0x50')});}return respondWithRpcPromise(_0xdde8('0x5f'),_0xdde8('0x60'),_0x38b190);})[_0xdde8('0x13')](function(_0x247311){_0x563456(_0x247311);})[_0xdde8('0x1c')](function(_0x1f21b5){_0x43b851(_0x161ff7['error'](0x1f4,_0x1f21b5[_0xdde8('0x1b')]));});});}; \ No newline at end of file +var _0xa065=['map','model','info','GetFaxAccount','debug','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','length','defaults','ListId','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','User','name','UserId','unshift','waitForTheAssignedAgent','queueId','FaxQueue','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxAccount','findAll','raw','options','where','attributes','limit','include'];(function(_0x657e65,_0x307cb8){var _0x24c8ea=function(_0x5e1b88){while(--_0x5e1b88){_0x657e65['push'](_0x657e65['shift']());}};_0x24c8ea(++_0x307cb8);}(_0xa065,0x153));var _0x5a06=function(_0xef349,_0x6ac770){_0xef349=_0xef349-0x0;var _0x5679de=_0xa065[_0xef349];return _0x5679de;};'use strict';var _=require(_0x5a06('0x0'));var util=require(_0x5a06('0x1'));var moment=require(_0x5a06('0x2'));var BPromise=require(_0x5a06('0x3'));var rs=require(_0x5a06('0x4'));var fs=require('fs');var Redis=require(_0x5a06('0x5'));var db=require(_0x5a06('0x6'))['db'];var utils=require(_0x5a06('0x7'));var logger=require(_0x5a06('0x8'))(_0x5a06('0x9'));var config=require('../../config/environment');var jayson=require(_0x5a06('0xa'));var client=jayson[_0x5a06('0xb')]['http']({'port':0x232c});config[_0x5a06('0xc')]=_['defaults'](config[_0x5a06('0xc')],{'host':_0x5a06('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5a06('0xe'))[_0x5a06('0xf')](socket);function respondWithRpcPromise(_0x411c53,_0x1b8199,_0x4be5c8){return new BPromise(function(_0x44bb81,_0x2c69e5){return client['request'](_0x411c53,_0x4be5c8)[_0x5a06('0x10')](function(_0x1de1f3){logger['info'](_0x5a06('0x11'),_0x1b8199,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1b8199,_0x5a06('0x12'),JSON[_0x5a06('0x13')](_0x1de1f3));if(_0x1de1f3['error']){if(_0x1de1f3[_0x5a06('0x14')][_0x5a06('0x15')]===0x1f4){logger['error'](_0x5a06('0x11'),_0x1b8199,_0x1de1f3[_0x5a06('0x14')][_0x5a06('0x16')]);return _0x2c69e5(_0x1de1f3[_0x5a06('0x14')][_0x5a06('0x16')]);}logger[_0x5a06('0x14')](_0x5a06('0x11'),_0x1b8199,_0x1de1f3[_0x5a06('0x14')][_0x5a06('0x16')]);return _0x44bb81(_0x1de1f3['error']['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1b8199,'request\x20sent');_0x44bb81(_0x1de1f3[_0x5a06('0x17')]['message']);}})[_0x5a06('0x18')](function(_0x13f64c){logger[_0x5a06('0x14')]('FaxAccount,\x20%s,\x20%s',_0x1b8199,_0x13f64c);_0x2c69e5(_0x13f64c);});});}exports['GetFaxAccount']=function(_0x5a9887){var _0x529666=this;return new Promise(function(_0x316b7b,_0x32f830){return db[_0x5a06('0x19')][_0x5a06('0x1a')]({'raw':_0x5a9887['options']?_0x5a9887['options'][_0x5a06('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a9887[_0x5a06('0x1c')]?_0x5a9887[_0x5a06('0x1c')][_0x5a06('0x1d')]||null:null,'attributes':_0x5a9887[_0x5a06('0x1c')]?_0x5a9887[_0x5a06('0x1c')][_0x5a06('0x1e')]||null:null,'limit':_0x5a9887[_0x5a06('0x1c')]?_0x5a9887[_0x5a06('0x1c')][_0x5a06('0x1f')]||null:null,'include':_0x5a9887[_0x5a06('0x1c')]?_0x5a9887['options'][_0x5a06('0x20')]?_[_0x5a06('0x21')](_0x5a9887[_0x5a06('0x1c')]['include'],function(_0xbc8ff0){return{'model':db[_0xbc8ff0[_0x5a06('0x22')]],'as':_0xbc8ff0['as'],'attributes':_0xbc8ff0['attributes'],'include':_0xbc8ff0[_0x5a06('0x20')]?_['map'](_0xbc8ff0[_0x5a06('0x20')],function(_0x3474b8){return{'model':db[_0x3474b8[_0x5a06('0x22')]],'as':_0x3474b8['as'],'attributes':_0x3474b8['attributes'],'include':_0x3474b8[_0x5a06('0x20')]?_[_0x5a06('0x21')](_0x3474b8[_0x5a06('0x20')],function(_0x137387){return{'model':db[_0x137387['model']],'as':_0x137387['as'],'attributes':_0x137387[_0x5a06('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5a06('0x10')](function(_0x18369c){logger[_0x5a06('0x23')](_0x5a06('0x24'),_0x5a9887);logger[_0x5a06('0x25')]('GetFaxAccount',_0x5a9887,JSON[_0x5a06('0x13')](_0x18369c));_0x316b7b(_0x18369c);})[_0x5a06('0x18')](function(_0x3dc215){logger['error'](_0x5a06('0x24'),_0x3dc215[_0x5a06('0x16')],_0x5a9887);_0x32f830(_0x529666['error'](0x1f4,_0x3dc215['message']));});});};exports['NotifyFaxAccount']=function(_0x4131eb,_0x3be99b,_0x2f0740){var _0x2d68d7=this;return new Promise(function(_0x26c8b5,_0x5e5512){var _0x23f055={'body':_0x4131eb[_0x5a06('0x26')],'channel':_0x5a06('0x27')};var _0x15f566=[];var _0x2a7495=[];var _0x2bc37a={};return db[_0x5a06('0x28')][_0x5a06('0x29')]()[_0x5a06('0x10')](function(_0x4295bd){if(!_0x4295bd){throw new db[(_0x5a06('0x2a'))]['ValidationError'](_0x5a06('0x2b'));}_0x15f566=_[_0x5a06('0x2c')](_[_0x5a06('0x2d')](_0x4295bd),['createdAt','updatedAt']);_0x2a7495=_[_0x5a06('0x2c')](_[_0x5a06('0x2d')](_0x4295bd),[_0x5a06('0x2e'),_0x5a06('0x2f'),'CompanyId','ListId']);if(_0x4131eb[_0x5a06('0x26')]['id']){delete _0x4131eb[_0x5a06('0x26')]['id'];}if(_[_0x5a06('0x30')](_0x4131eb[_0x5a06('0x26')][_0x5a06('0x31')])){throw new db[(_0x5a06('0x2a'))]['ValidationError'](_0x5a06('0x32'));}if(_[_0x5a06('0x30')](_0x4131eb[_0x5a06('0x26')]['body'])||_0x4131eb[_0x5a06('0x26')][_0x5a06('0x26')]===''){throw new db[(_0x5a06('0x2a'))][(_0x5a06('0x33'))](_0x5a06('0x34'));}if(_[_0x5a06('0x30')](_0x4131eb[_0x5a06('0x26')][_0x5a06('0x35')])){throw new db['Sequelize'][(_0x5a06('0x33'))](_0x5a06('0x36')+_0x2a7495);}if(!_[_0x5a06('0x37')](_0x2a7495,_0x4131eb[_0x5a06('0x26')][_0x5a06('0x35')])){throw new db[(_0x5a06('0x2a'))][(_0x5a06('0x33'))](_0x5a06('0x38')+_0x2a7495);}_0x2bc37a[_0x4131eb[_0x5a06('0x26')][_0x5a06('0x35')]]=_0x4131eb['body']['from'];})[_0x5a06('0x10')](function(){return db['FaxAccount']['find']({'where':{'id':_0x4131eb[_0x5a06('0x39')]['id']},'include':[{'model':db[_0x5a06('0x3a')],'as':_0x5a06('0x3b'),'include':[{'model':db[_0x5a06('0x28')],'as':_0x5a06('0x3c'),'where':_0x2bc37a,'limit':0x1,'order':[[_0x5a06('0x2f'),_0x5a06('0x3d')]]}]},{'model':db[_0x5a06('0x3e')],'as':_0x5a06('0x3f')}]});})['then'](function(_0x5e9670){if(_0x5e9670&&_0x5e9670['List']){var _0x5f10fd=_0x5e9670[_0x5a06('0x40')]({'plain':!![]});_0x23f055['account']=_0x5f10fd;_0x23f055[_0x5a06('0x41')]=_0x5f10fd[_0x5a06('0x3f')];_0x23f055[_0x5a06('0x42')]=_0x5f10fd[_0x5a06('0x3b')];_0x23f055[_0x5a06('0x41')]=_[_0x5a06('0x43')](_0x23f055[_0x5a06('0x41')],['priority'],['asc']);if(_0x23f055[_0x5a06('0x39')]['Applications']){delete _0x23f055[_0x5a06('0x39')][_0x5a06('0x3f')];}if(_0x23f055[_0x5a06('0x39')][_0x5a06('0x3b')]&&_0x23f055['account']['List'][_0x5a06('0x3c')][_0x5a06('0x44')]){return _0x23f055[_0x5a06('0x39')][_0x5a06('0x3b')]['Contacts'][0x0];}var _0x513d4d=_[_0x5a06('0x45')](_0x4131eb[_0x5a06('0x26')],{'firstName':_0x4131eb[_0x5a06('0x26')][_0x5a06('0x31')],'ListId':_0x5f10fd[_0x5a06('0x46')]});_0x513d4d[_0x4131eb['body'][_0x5a06('0x35')]]=_0x4131eb['body']['from'];return db[_0x5a06('0x28')][_0x5a06('0x47')](_0x513d4d,{'fields':_0x15f566,'raw':!![]});}})[_0x5a06('0x10')](function(_0x5a6dba){_0x23f055[_0x5a06('0x48')]=_0x5a6dba;if(_0x5a6dba){var _0x23694f={'ContactId':_0x5a6dba['id'],'FaxAccountId':_0x4131eb['account']['id'],'fax':_0x5a6dba[_0x5a06('0x27')]};return db[_0x5a06('0x49')][_0x5a06('0x4a')]({'where':{'ContactId':_0x5a6dba['id'],'closed':![],'FaxAccountId':_0x4131eb[_0x5a06('0x39')]['id']}})['then'](function(_0x4feb9a){if(_0x4feb9a){return[_0x4feb9a,![]];}return db['FaxInteraction'][_0x5a06('0x47')](_0x23694f)['then'](function(_0x38e260){return[_0x38e260,!![]];});});}else{throw new Error(_0x5a06('0x4b'));}})[_0x5a06('0x4c')](function(_0x3bb711,_0x3fd98f){var _0x3f47fe=_0x3bb711[_0x5a06('0x40')]({'plain':!![]});if(_0x3fd98f){if(_0x23f055[_0x5a06('0x39')][_0x5a06('0x4d')]){_0x23f055[_0x5a06('0x41')][_0x5a06('0x4e')]({'id':0x0,'priority':_0x23f055[_0x5a06('0x41')]['length']+0x1,'app':'close','appdata':_0x5a06('0x4f'),'interval':_0x5a06('0x50')});}_0x3f47fe[_0x5a06('0x51')]=!![];}else{_0x3f47fe['created']=![];}_0x23f055['interaction']=_0x3f47fe;return db[_0x5a06('0x52')][_0x5a06('0x47')]({'body':_0x4131eb[_0x5a06('0x26')]['body'],'FaxAccountId':_0x4131eb[_0x5a06('0x39')]['id'],'FaxInteractionId':_0x3bb711['id'],'direction':'in','ContactId':_0x3bb711['ContactId'],'AttachmentId':_0x4131eb[_0x5a06('0x26')][_0x5a06('0x53')]});})['then'](function(_0x43a802){_0x23f055[_0x5a06('0x16')]=_0x43a802;if(!_0x23f055[_0x5a06('0x54')]['UserId'])return;return db[_0x5a06('0x55')][_0x5a06('0x4a')]({'attributes':['id',_0x5a06('0x56')],'where':{'id':_0x23f055[_0x5a06('0x54')][_0x5a06('0x57')]}});})[_0x5a06('0x10')](function(_0x781770){if(_0x781770){_0x23f055[_0x5a06('0x41')][_0x5a06('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x781770[_0x5a06('0x56')]+','+(_0x23f055[_0x5a06('0x39')][_0x5a06('0x59')]||0xa),'interval':_0x5a06('0x50')});}if(!_0x23f055[_0x5a06('0x54')][_0x5a06('0x5a')])return;return db[_0x5a06('0x5b')][_0x5a06('0x4a')]({'attributes':['id',_0x5a06('0x56')],'where':{'id':_0x23f055[_0x5a06('0x54')][_0x5a06('0x5a')]}});})['then'](function(_0x28d2ad){if(_0x28d2ad){_0x23f055[_0x5a06('0x41')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x28d2ad[_0x5a06('0x56')]+','+(_0x23f055['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x5a06('0x50')});}return respondWithRpcPromise(_0x5a06('0x5c'),'startRouting',_0x23f055);})[_0x5a06('0x10')](function(_0x4313c8){_0x26c8b5(_0x4313c8);})['catch'](function(_0x1bf142){_0x5e5512(_0x2d68d7['error'](0x1f4,_0x1bf142[_0x5a06('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a3e100d..a034386 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 _0x9f68=['./faxAccount.events','save','remove','update','emit','removeListener','length','faxAccount:'];(function(_0x303401,_0xb09078){var _0x3a753d=function(_0x50ac59){while(--_0x50ac59){_0x303401['push'](_0x303401['shift']());}};_0x3a753d(++_0xb09078);}(_0x9f68,0x1c8));var _0x89f6=function(_0x346fc2,_0x4d3f8f){_0x346fc2=_0x346fc2-0x0;var _0x385a5e=_0x9f68[_0x346fc2];return _0x385a5e;};'use strict';var FaxAccountEvents=require(_0x89f6('0x0'));var events=[_0x89f6('0x1'),_0x89f6('0x2'),_0x89f6('0x3')];function createListener(_0x50ee25,_0x390710){return function(_0x43f449){_0x390710[_0x89f6('0x4')](_0x50ee25,_0x43f449);};}function removeListener(_0x12ae4a,_0x1d87d4){return function(){FaxAccountEvents[_0x89f6('0x5')](_0x12ae4a,_0x1d87d4);};}exports['register']=function(_0x31616d){for(var _0x5f515f=0x0,_0x4d9013=events[_0x89f6('0x6')];_0x5f515f<_0x4d9013;_0x5f515f++){var _0x1b627e=events[_0x5f515f];var _0x1fd6a0=createListener(_0x89f6('0x7')+_0x1b627e,_0x31616d);FaxAccountEvents['on'](_0x1b627e,_0x1fd6a0);}}; \ No newline at end of file +var _0x4e19=['faxAccount:','./faxAccount.events','save','update','emit','removeListener','register','length'];(function(_0x3cfe4e,_0x3e2fed){var _0x22e983=function(_0x75f797){while(--_0x75f797){_0x3cfe4e['push'](_0x3cfe4e['shift']());}};_0x22e983(++_0x3e2fed);}(_0x4e19,0xe1));var _0x94e1=function(_0x57d232,_0x1eb10c){_0x57d232=_0x57d232-0x0;var _0x4c7e6d=_0x4e19[_0x57d232];return _0x4c7e6d;};'use strict';var FaxAccountEvents=require(_0x94e1('0x0'));var events=[_0x94e1('0x1'),'remove',_0x94e1('0x2')];function createListener(_0x2280af,_0xd59361){return function(_0x2c0553){_0xd59361[_0x94e1('0x3')](_0x2280af,_0x2c0553);};}function removeListener(_0x2e287b,_0xac83c8){return function(){FaxAccountEvents[_0x94e1('0x4')](_0x2e287b,_0xac83c8);};}exports[_0x94e1('0x5')]=function(_0x3a2952){for(var _0x595711=0x0,_0x24908e=events[_0x94e1('0x6')];_0x595711<_0x24908e;_0x595711++){var _0x1943be=events[_0x595711];var _0x2aec24=createListener(_0x94e1('0x7')+_0x1943be,_0x3a2952);FaxAccountEvents['on'](_0x1943be,_0x2aec24);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 14ba910..6b2aefe 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 _0x0188=['getAgents','post','create','/:id/dispositions','/:id/interactions','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','send','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','express','Router','fs-extra','../../components/auth/service','./faxAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users'];(function(_0x7543a1,_0x11659f){var _0xd420a0=function(_0x360fb5){while(--_0x360fb5){_0x7543a1['push'](_0x7543a1['shift']());}};_0xd420a0(++_0x11659f);}(_0x0188,0xfd));var _0x8018=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x0188[_0x13ce0c];return _0x4388fb;};'use strict';var multer=require(_0x8018('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8018('0x1'));var router=express[_0x8018('0x2')]();var fs_extra=require(_0x8018('0x3'));var auth=require(_0x8018('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8018('0x5'));router[_0x8018('0x6')]('/',auth['isAuthenticated'](),controller[_0x8018('0x7')]);router['get'](_0x8018('0x8'),auth[_0x8018('0x9')](),controller[_0x8018('0xa')]);router[_0x8018('0x6')](_0x8018('0xb'),auth[_0x8018('0x9')](),controller[_0x8018('0xc')]);router[_0x8018('0x6')]('/:id/dispositions',auth[_0x8018('0x9')](),controller[_0x8018('0xd')]);router[_0x8018('0x6')](_0x8018('0xe'),auth[_0x8018('0x9')](),controller['getAnswers']);router[_0x8018('0x6')]('/:id/interactions',auth[_0x8018('0x9')](),controller['getInteractions']);router[_0x8018('0x6')](_0x8018('0xf'),auth['isAuthenticated'](),controller[_0x8018('0x10')]);router[_0x8018('0x6')](_0x8018('0x11'),auth[_0x8018('0x9')](),controller[_0x8018('0x12')]);router[_0x8018('0x6')](_0x8018('0x13'),auth[_0x8018('0x9')](),controller[_0x8018('0x14')]);router[_0x8018('0x15')]('/',auth['isAuthenticated'](),controller[_0x8018('0x16')]);router['post'](_0x8018('0x17'),auth[_0x8018('0x9')](),controller['addDisposition']);router['post'](_0x8018('0xe'),auth[_0x8018('0x9')](),controller['addAnswer']);router['post'](_0x8018('0x18'),auth[_0x8018('0x9')](),controller[_0x8018('0x19')]);router[_0x8018('0x15')](_0x8018('0xf'),auth['isAuthenticated'](),controller[_0x8018('0x1a')]);router[_0x8018('0x15')](_0x8018('0x1b'),auth[_0x8018('0x9')](),controller[_0x8018('0x1c')]);router[_0x8018('0x15')](_0x8018('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router['post']('/:id/send',auth[_0x8018('0x9')](),controller[_0x8018('0x1e')]);router[_0x8018('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x8018('0x1f')]);router[_0x8018('0x20')](_0x8018('0xb'),auth[_0x8018('0x9')](),controller[_0x8018('0x21')]);router[_0x8018('0x22')](_0x8018('0xb'),auth[_0x8018('0x9')](),controller[_0x8018('0x23')]);router[_0x8018('0x22')]('/:id/dispositions',auth[_0x8018('0x9')](),controller[_0x8018('0x24')]);router[_0x8018('0x22')](_0x8018('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x8018('0x22')](_0x8018('0x13'),auth[_0x8018('0x9')](),controller[_0x8018('0x25')]);module[_0x8018('0x26')]=router; \ No newline at end of file +var _0x5dac=['delete','destroy','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','/:id/applications','/updateaccountapplications','updateAccountApplications','/:id/send','put','/:id','update'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x5dac,0xf4));var _0xc5da=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5dac[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xc5da('0x0'));var util=require(_0xc5da('0x1'));var path=require('path');var timeout=require(_0xc5da('0x2'));var express=require(_0xc5da('0x3'));var router=express[_0xc5da('0x4')]();var fs_extra=require(_0xc5da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc5da('0x6'));var config=require(_0xc5da('0x7'));var controller=require(_0xc5da('0x8'));router['get']('/',auth[_0xc5da('0x9')](),controller[_0xc5da('0xa')]);router[_0xc5da('0xb')](_0xc5da('0xc'),auth[_0xc5da('0x9')](),controller[_0xc5da('0xd')]);router[_0xc5da('0xb')]('/:id',auth[_0xc5da('0x9')](),controller['show']);router[_0xc5da('0xb')](_0xc5da('0xe'),auth['isAuthenticated'](),controller[_0xc5da('0xf')]);router[_0xc5da('0xb')](_0xc5da('0x10'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x11')]);router[_0xc5da('0xb')](_0xc5da('0x12'),auth['isAuthenticated'](),controller[_0xc5da('0x13')]);router['get']('/:id/applications',auth[_0xc5da('0x9')](),controller[_0xc5da('0x14')]);router[_0xc5da('0xb')](_0xc5da('0x15'),auth['isAuthenticated'](),controller[_0xc5da('0x16')]);router[_0xc5da('0xb')](_0xc5da('0x17'),auth[_0xc5da('0x9')](),controller['getAgents']);router[_0xc5da('0x18')]('/',auth[_0xc5da('0x9')](),controller[_0xc5da('0x19')]);router['post'](_0xc5da('0xe'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x1a')]);router[_0xc5da('0x18')](_0xc5da('0x10'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x1b')]);router[_0xc5da('0x18')](_0xc5da('0x12'),auth['isAuthenticated'](),controller[_0xc5da('0x1c')]);router[_0xc5da('0x18')](_0xc5da('0x1d'),auth[_0xc5da('0x9')](),controller['addApplications']);router[_0xc5da('0x18')]('/addaccountapplications',auth[_0xc5da('0x9')](),controller['addAccountApplications']);router[_0xc5da('0x18')](_0xc5da('0x1e'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x1f')]);router[_0xc5da('0x18')](_0xc5da('0x20'),auth[_0xc5da('0x9')](),controller['send']);router[_0xc5da('0x18')](_0xc5da('0x17'),auth[_0xc5da('0x9')](),controller['addAgents']);router[_0xc5da('0x21')](_0xc5da('0x22'),auth['isAuthenticated'](),controller[_0xc5da('0x23')]);router[_0xc5da('0x24')]('/:id',auth[_0xc5da('0x9')](),controller[_0xc5da('0x25')]);router[_0xc5da('0x24')](_0xc5da('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xc5da('0x24')]('/:id/canned_answers',auth[_0xc5da('0x9')](),controller[_0xc5da('0x26')]);router[_0xc5da('0x24')](_0xc5da('0x17'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 708834e..bee7604 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 _0x6df1=['TEXT','sequelize','STRING','noop'];(function(_0x29c047,_0x45c350){var _0x2cbd8a=function(_0x1e133b){while(--_0x1e133b){_0x29c047['push'](_0x29c047['shift']());}};_0x2cbd8a(++_0x45c350);}(_0x6df1,0x1a1));var _0x16df=function(_0x25e7ee,_0x4d8966){_0x25e7ee=_0x25e7ee-0x0;var _0x1251f2=_0x6df1[_0x25e7ee];return _0x1251f2;};'use strict';var Sequelize=require(_0x16df('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x16df('0x1')],'allowNull':![],'defaultValue':_0x16df('0x2')},'appdata':{'type':Sequelize[_0x16df('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x16df('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7687=['STRING','noop','TEXT','exports'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x7687,0x1e3));var _0x7768=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7687[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module[_0x7768('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7768('0x1')],'allowNull':![],'defaultValue':_0x7768('0x2')},'appdata':{'type':Sequelize[_0x7768('0x3')]()},'description':{'type':Sequelize[_0x7768('0x1')]},'interval':{'type':Sequelize[_0x7768('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index f7d0da6..d1cd888 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 _0xdbe6=['offset','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','FaxApplication','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','options','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5bf609,_0x5c1e35){var _0x3c3a74=function(_0x538a50){while(--_0x538a50){_0x5bf609['push'](_0x5bf609['shift']());}};_0x3c3a74(++_0x5c1e35);}(_0xdbe6,0x11b));var _0x6dbe=function(_0x7853aa,_0x340aa6){_0x7853aa=_0x7853aa-0x0;var _0x59c9f7=_0xdbe6[_0x7853aa];return _0x59c9f7;};'use strict';var emlformat=require(_0x6dbe('0x0'));var rimraf=require(_0x6dbe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6dbe('0x2'));var rp=require(_0x6dbe('0x3'));var moment=require('moment');var BPromise=require(_0x6dbe('0x4'));var Mustache=require(_0x6dbe('0x5'));var util=require(_0x6dbe('0x6'));var path=require(_0x6dbe('0x7'));var sox=require(_0x6dbe('0x8'));var csv=require(_0x6dbe('0x9'));var ejs=require(_0x6dbe('0xa'));var fs=require('fs');var fs_extra=require(_0x6dbe('0xb'));var _=require(_0x6dbe('0xc'));var squel=require('squel');var crypto=require(_0x6dbe('0xd'));var jsforce=require(_0x6dbe('0xe'));var deskjs=require(_0x6dbe('0xf'));var toCsv=require(_0x6dbe('0x9'));var querystring=require(_0x6dbe('0x10'));var Papa=require(_0x6dbe('0x11'));var Redis=require(_0x6dbe('0x12'));var authService=require(_0x6dbe('0x13'));var qs=require(_0x6dbe('0x14'));var as=require(_0x6dbe('0x15'));var hardwareService=require(_0x6dbe('0x16'));var logger=require(_0x6dbe('0x17'))(_0x6dbe('0x18'));var utils=require(_0x6dbe('0x19'));var config=require(_0x6dbe('0x1a'));var licenseUtil=require(_0x6dbe('0x1b'));var db=require(_0x6dbe('0x1c'))['db'];function respondWithStatusCode(_0x4df248,_0x41e47b){_0x41e47b=_0x41e47b||0xcc;return function(_0x354c1c){if(_0x354c1c){return _0x4df248[_0x6dbe('0x1d')](_0x41e47b);}return _0x4df248[_0x6dbe('0x1e')](_0x41e47b)[_0x6dbe('0x1f')]();};}function respondWithResult(_0x56f576,_0x53db6c){_0x53db6c=_0x53db6c||0xc8;return function(_0x2e98ff){if(_0x2e98ff){return _0x56f576['status'](_0x53db6c)[_0x6dbe('0x20')](_0x2e98ff);}};}function respondWithFilteredResult(_0x19e2d4,_0x499832){return function(_0x440efb){if(_0x440efb){var _0x37e4a4=typeof _0x499832['offset']==='undefined'&&typeof _0x499832['limit']==='undefined';var _0x424be2=_0x440efb['count'];var _0x402287=_0x37e4a4?0x0:_0x499832[_0x6dbe('0x21')];var _0x393ef7=_0x37e4a4?_0x440efb[_0x6dbe('0x22')]:_0x499832[_0x6dbe('0x21')]+_0x499832[_0x6dbe('0x23')];var _0xf123e5;if(_0x393ef7>=_0x424be2){_0x393ef7=_0x424be2;_0xf123e5=0xc8;}else{_0xf123e5=0xce;}_0x19e2d4[_0x6dbe('0x1e')](_0xf123e5);return _0x19e2d4[_0x6dbe('0x24')](_0x6dbe('0x25'),_0x402287+'-'+_0x393ef7+'/'+_0x424be2)[_0x6dbe('0x20')](_0x440efb);}return null;};}function patchUpdates(_0x2112e8){return function(_0x31c74d){try{jsonpatch[_0x6dbe('0x26')](_0x31c74d,_0x2112e8,!![]);}catch(_0x172516){return BPromise[_0x6dbe('0x27')](_0x172516);}return _0x31c74d[_0x6dbe('0x28')]();};}function saveUpdates(_0x3df44a,_0x5a1a98){return function(_0x47bdbe){if(_0x47bdbe){return _0x47bdbe[_0x6dbe('0x29')](_0x3df44a)[_0x6dbe('0x2a')](function(_0x2a18a7){return _0x2a18a7;});}return null;};}function removeEntity(_0x53cc91,_0x17ab53){return function(_0x40eb86){if(_0x40eb86){return _0x40eb86['destroy']()[_0x6dbe('0x2a')](function(){_0x53cc91[_0x6dbe('0x1e')](0xcc)[_0x6dbe('0x1f')]();});}};}function handleEntityNotFound(_0x2025ae,_0x712f3e){return function(_0x5b84e1){if(!_0x5b84e1){_0x2025ae['sendStatus'](0x194);}return _0x5b84e1;};}function handleError(_0x454557,_0x2b4c7c){_0x2b4c7c=_0x2b4c7c||0x1f4;return function(_0x32633f){logger[_0x6dbe('0x2b')](_0x32633f['stack']);if(_0x32633f[_0x6dbe('0x2c')]){delete _0x32633f[_0x6dbe('0x2c')];}_0x454557['status'](_0x2b4c7c)['send'](_0x32633f);};}exports[_0x6dbe('0x2d')]=function(_0x27f931,_0x391237){var _0x4fdabd={},_0x55b3c9={},_0x36337c={'count':0x0,'rows':[]};var _0x1c031a=_['map'](db[_0x6dbe('0x2e')][_0x6dbe('0x2f')],function(_0x370bcf){return{'name':_0x370bcf[_0x6dbe('0x30')],'type':_0x370bcf[_0x6dbe('0x31')][_0x6dbe('0x32')]};});_0x55b3c9['model']=_[_0x6dbe('0x33')](_0x1c031a,_0x6dbe('0x2c'));_0x55b3c9[_0x6dbe('0x34')]=_[_0x6dbe('0x35')](_0x27f931[_0x6dbe('0x34')]);_0x55b3c9['filters']=_['intersection'](_0x55b3c9[_0x6dbe('0x36')],_0x55b3c9[_0x6dbe('0x34')]);_0x4fdabd[_0x6dbe('0x37')]=_[_0x6dbe('0x38')](_0x55b3c9[_0x6dbe('0x36')],qs[_0x6dbe('0x39')](_0x27f931[_0x6dbe('0x34')][_0x6dbe('0x39')]));_0x4fdabd['attributes']=_0x4fdabd[_0x6dbe('0x37')][_0x6dbe('0x3a')]?_0x4fdabd[_0x6dbe('0x37')]:_0x55b3c9['model'];if(!_0x27f931[_0x6dbe('0x34')][_0x6dbe('0x3b')](_0x6dbe('0x3c'))){_0x4fdabd[_0x6dbe('0x23')]=qs[_0x6dbe('0x23')](_0x27f931[_0x6dbe('0x34')]['limit']);_0x4fdabd[_0x6dbe('0x21')]=qs[_0x6dbe('0x21')](_0x27f931[_0x6dbe('0x34')][_0x6dbe('0x21')]);}_0x4fdabd[_0x6dbe('0x3d')]=qs[_0x6dbe('0x3e')](_0x27f931[_0x6dbe('0x34')][_0x6dbe('0x3e')]);_0x4fdabd[_0x6dbe('0x3f')]=qs[_0x6dbe('0x40')](_['pick'](_0x27f931['query'],_0x55b3c9['filters']),_0x1c031a);if(_0x27f931['query'][_0x6dbe('0x41')]){_0x4fdabd[_0x6dbe('0x3f')]=_['merge'](_0x4fdabd[_0x6dbe('0x3f')],{'$or':_[_0x6dbe('0x33')](_0x1c031a,function(_0x1054a1){if(_0x1054a1['type']!==_0x6dbe('0x42')){var _0x58db23={};_0x58db23[_0x1054a1[_0x6dbe('0x2c')]]={'$like':'%'+_0x27f931[_0x6dbe('0x34')][_0x6dbe('0x41')]+'%'};return _0x58db23;}})});}_0x4fdabd=_[_0x6dbe('0x43')]({},_0x4fdabd,_0x27f931['options']);var _0xbacb7={'where':_0x4fdabd[_0x6dbe('0x3f')]};return db[_0x6dbe('0x2e')][_0x6dbe('0x22')](_0xbacb7)['then'](function(_0x5a9050){_0x36337c['count']=_0x5a9050;if(_0x27f931[_0x6dbe('0x34')][_0x6dbe('0x44')]){_0x4fdabd['include']=[{'all':!![]}];}return db['FaxApplication'][_0x6dbe('0x45')](_0x4fdabd);})[_0x6dbe('0x2a')](function(_0x1a0b75){_0x36337c[_0x6dbe('0x46')]=_0x1a0b75;return _0x36337c;})[_0x6dbe('0x2a')](respondWithFilteredResult(_0x391237,_0x4fdabd))['catch'](handleError(_0x391237,null));};exports[_0x6dbe('0x47')]=function(_0x5f0516,_0x40edf3){var _0x3cb211={'raw':!![],'where':{'id':_0x5f0516[_0x6dbe('0x48')]['id']}},_0x1c132f={};_0x1c132f[_0x6dbe('0x36')]=_[_0x6dbe('0x35')](db[_0x6dbe('0x2e')][_0x6dbe('0x2f')]);_0x1c132f[_0x6dbe('0x34')]=_[_0x6dbe('0x35')](_0x5f0516[_0x6dbe('0x34')]);_0x1c132f[_0x6dbe('0x40')]=_[_0x6dbe('0x38')](_0x1c132f[_0x6dbe('0x36')],_0x1c132f[_0x6dbe('0x34')]);_0x3cb211[_0x6dbe('0x37')]=_[_0x6dbe('0x38')](_0x1c132f['model'],qs[_0x6dbe('0x39')](_0x5f0516['query'][_0x6dbe('0x39')]));_0x3cb211['attributes']=_0x3cb211[_0x6dbe('0x37')][_0x6dbe('0x3a')]?_0x3cb211[_0x6dbe('0x37')]:_0x1c132f['model'];if(_0x5f0516['query']['includeAll']){_0x3cb211[_0x6dbe('0x49')]=[{'all':!![]}];}_0x3cb211=_[_0x6dbe('0x43')]({},_0x3cb211,_0x5f0516[_0x6dbe('0x4a')]);return db[_0x6dbe('0x2e')]['find'](_0x3cb211)[_0x6dbe('0x2a')](handleEntityNotFound(_0x40edf3,null))[_0x6dbe('0x2a')](respondWithResult(_0x40edf3,null))[_0x6dbe('0x4b')](handleError(_0x40edf3,null));};exports[_0x6dbe('0x4c')]=function(_0x159eda,_0x546bca){return db[_0x6dbe('0x2e')][_0x6dbe('0x4c')](_0x159eda[_0x6dbe('0x4d')],{})['then'](respondWithResult(_0x546bca,0xc9))['catch'](handleError(_0x546bca,null));};exports[_0x6dbe('0x29')]=function(_0x3d4906,_0x39365a){if(_0x3d4906[_0x6dbe('0x4d')]['id']){delete _0x3d4906[_0x6dbe('0x4d')]['id'];}return db[_0x6dbe('0x2e')]['find']({'where':{'id':_0x3d4906[_0x6dbe('0x48')]['id']}})[_0x6dbe('0x2a')](handleEntityNotFound(_0x39365a,null))[_0x6dbe('0x2a')](saveUpdates(_0x3d4906[_0x6dbe('0x4d')],null))[_0x6dbe('0x2a')](respondWithResult(_0x39365a,null))[_0x6dbe('0x4b')](handleError(_0x39365a,null));};exports['destroy']=function(_0x24cea7,_0x48f4af){return db[_0x6dbe('0x2e')][_0x6dbe('0x4e')]({'where':{'id':_0x24cea7[_0x6dbe('0x48')]['id']}})[_0x6dbe('0x2a')](handleEntityNotFound(_0x48f4af,null))[_0x6dbe('0x2a')](removeEntity(_0x48f4af,null))[_0x6dbe('0x4b')](handleError(_0x48f4af,null));}; \ No newline at end of file +var _0x3494=['nolimit','order','sort','where','pick','filters','filter','type','merge','FaxApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','find','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3494,0x106));var _0x4349=function(_0x4cee3e,_0x55413a){_0x4cee3e=_0x4cee3e-0x0;var _0x18c390=_0x3494[_0x4cee3e];return _0x18c390;};'use strict';var emlformat=require(_0x4349('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4349('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4349('0x2'));var moment=require(_0x4349('0x3'));var BPromise=require(_0x4349('0x4'));var Mustache=require(_0x4349('0x5'));var util=require(_0x4349('0x6'));var path=require('path');var sox=require(_0x4349('0x7'));var csv=require(_0x4349('0x8'));var ejs=require(_0x4349('0x9'));var fs=require('fs');var fs_extra=require(_0x4349('0xa'));var _=require('lodash');var squel=require(_0x4349('0xb'));var crypto=require(_0x4349('0xc'));var jsforce=require(_0x4349('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4349('0x8'));var querystring=require(_0x4349('0xe'));var Papa=require(_0x4349('0xf'));var Redis=require(_0x4349('0x10'));var authService=require(_0x4349('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4349('0x12'));var hardwareService=require(_0x4349('0x13'));var logger=require(_0x4349('0x14'))(_0x4349('0x15'));var utils=require(_0x4349('0x16'));var config=require(_0x4349('0x17'));var licenseUtil=require(_0x4349('0x18'));var db=require(_0x4349('0x19'))['db'];function respondWithStatusCode(_0x73da72,_0x2b418b){_0x2b418b=_0x2b418b||0xcc;return function(_0x4ba8de){if(_0x4ba8de){return _0x73da72['sendStatus'](_0x2b418b);}return _0x73da72[_0x4349('0x1a')](_0x2b418b)[_0x4349('0x1b')]();};}function respondWithResult(_0x592ab7,_0x82d563){_0x82d563=_0x82d563||0xc8;return function(_0x5696c8){if(_0x5696c8){return _0x592ab7[_0x4349('0x1a')](_0x82d563)[_0x4349('0x1c')](_0x5696c8);}};}function respondWithFilteredResult(_0x3e2fb4,_0x4b469f){return function(_0xb46758){if(_0xb46758){var _0x7e1bc9=typeof _0x4b469f['offset']===_0x4349('0x1d')&&typeof _0x4b469f[_0x4349('0x1e')]===_0x4349('0x1d');var _0x5b8bf4=_0xb46758['count'];var _0xab8de6=_0x7e1bc9?0x0:_0x4b469f[_0x4349('0x1f')];var _0x3f33b3=_0x7e1bc9?_0xb46758[_0x4349('0x20')]:_0x4b469f[_0x4349('0x1f')]+_0x4b469f[_0x4349('0x1e')];var _0x269ad4;if(_0x3f33b3>=_0x5b8bf4){_0x3f33b3=_0x5b8bf4;_0x269ad4=0xc8;}else{_0x269ad4=0xce;}_0x3e2fb4['status'](_0x269ad4);return _0x3e2fb4[_0x4349('0x21')](_0x4349('0x22'),_0xab8de6+'-'+_0x3f33b3+'/'+_0x5b8bf4)[_0x4349('0x1c')](_0xb46758);}return null;};}function patchUpdates(_0x1e84fd){return function(_0x47a9f0){try{jsonpatch[_0x4349('0x23')](_0x47a9f0,_0x1e84fd,!![]);}catch(_0x40ed37){return BPromise[_0x4349('0x24')](_0x40ed37);}return _0x47a9f0[_0x4349('0x25')]();};}function saveUpdates(_0x1ab7ad,_0x17febd){return function(_0x508645){if(_0x508645){return _0x508645[_0x4349('0x26')](_0x1ab7ad)[_0x4349('0x27')](function(_0x31338b){return _0x31338b;});}return null;};}function removeEntity(_0xd8901a,_0x289654){return function(_0x42ae78){if(_0x42ae78){return _0x42ae78[_0x4349('0x28')]()[_0x4349('0x27')](function(){_0xd8901a['status'](0xcc)[_0x4349('0x1b')]();});}};}function handleEntityNotFound(_0xcfaf43,_0x4ca2d0){return function(_0x3f5029){if(!_0x3f5029){_0xcfaf43[_0x4349('0x29')](0x194);}return _0x3f5029;};}function handleError(_0x4c09e1,_0x8b8b1d){_0x8b8b1d=_0x8b8b1d||0x1f4;return function(_0x2a81c4){logger[_0x4349('0x2a')](_0x2a81c4[_0x4349('0x2b')]);if(_0x2a81c4[_0x4349('0x2c')]){delete _0x2a81c4[_0x4349('0x2c')];}_0x4c09e1[_0x4349('0x1a')](_0x8b8b1d)[_0x4349('0x2d')](_0x2a81c4);};}exports[_0x4349('0x2e')]=function(_0xcd36d0,_0x2178a8){var _0x301c53={},_0x5f1980={},_0x4bfbfd={'count':0x0,'rows':[]};var _0x4e4397=_[_0x4349('0x2f')](db['FaxApplication']['rawAttributes'],function(_0x18aecd){return{'name':_0x18aecd[_0x4349('0x30')],'type':_0x18aecd['type'][_0x4349('0x31')]};});_0x5f1980['model']=_['map'](_0x4e4397,'name');_0x5f1980[_0x4349('0x32')]=_[_0x4349('0x33')](_0xcd36d0[_0x4349('0x32')]);_0x5f1980['filters']=_[_0x4349('0x34')](_0x5f1980[_0x4349('0x35')],_0x5f1980[_0x4349('0x32')]);_0x301c53[_0x4349('0x36')]=_[_0x4349('0x34')](_0x5f1980[_0x4349('0x35')],qs[_0x4349('0x37')](_0xcd36d0[_0x4349('0x32')]['fields']));_0x301c53['attributes']=_0x301c53[_0x4349('0x36')][_0x4349('0x38')]?_0x301c53[_0x4349('0x36')]:_0x5f1980[_0x4349('0x35')];if(!_0xcd36d0[_0x4349('0x32')][_0x4349('0x39')](_0x4349('0x3a'))){_0x301c53[_0x4349('0x1e')]=qs[_0x4349('0x1e')](_0xcd36d0[_0x4349('0x32')][_0x4349('0x1e')]);_0x301c53[_0x4349('0x1f')]=qs[_0x4349('0x1f')](_0xcd36d0['query'][_0x4349('0x1f')]);}_0x301c53[_0x4349('0x3b')]=qs[_0x4349('0x3c')](_0xcd36d0[_0x4349('0x32')][_0x4349('0x3c')]);_0x301c53[_0x4349('0x3d')]=qs['filters'](_[_0x4349('0x3e')](_0xcd36d0[_0x4349('0x32')],_0x5f1980[_0x4349('0x3f')]),_0x4e4397);if(_0xcd36d0[_0x4349('0x32')][_0x4349('0x40')]){_0x301c53[_0x4349('0x3d')]=_['merge'](_0x301c53[_0x4349('0x3d')],{'$or':_[_0x4349('0x2f')](_0x4e4397,function(_0x45a318){if(_0x45a318[_0x4349('0x41')]!=='VIRTUAL'){var _0x253308={};_0x253308[_0x45a318[_0x4349('0x2c')]]={'$like':'%'+_0xcd36d0[_0x4349('0x32')][_0x4349('0x40')]+'%'};return _0x253308;}})});}_0x301c53=_[_0x4349('0x42')]({},_0x301c53,_0xcd36d0['options']);var _0x1cd26f={'where':_0x301c53[_0x4349('0x3d')]};return db[_0x4349('0x43')][_0x4349('0x20')](_0x1cd26f)[_0x4349('0x27')](function(_0x59f9ae){_0x4bfbfd[_0x4349('0x20')]=_0x59f9ae;if(_0xcd36d0['query'][_0x4349('0x44')]){_0x301c53[_0x4349('0x45')]=[{'all':!![]}];}return db[_0x4349('0x43')][_0x4349('0x46')](_0x301c53);})[_0x4349('0x27')](function(_0x57098b){_0x4bfbfd[_0x4349('0x47')]=_0x57098b;return _0x4bfbfd;})[_0x4349('0x27')](respondWithFilteredResult(_0x2178a8,_0x301c53))[_0x4349('0x48')](handleError(_0x2178a8,null));};exports[_0x4349('0x49')]=function(_0x2da8ae,_0x550160){var _0x4ee683={'raw':!![],'where':{'id':_0x2da8ae[_0x4349('0x4a')]['id']}},_0x5657cf={};_0x5657cf[_0x4349('0x35')]=_[_0x4349('0x33')](db['FaxApplication'][_0x4349('0x4b')]);_0x5657cf['query']=_['keys'](_0x2da8ae[_0x4349('0x32')]);_0x5657cf[_0x4349('0x3f')]=_['intersection'](_0x5657cf[_0x4349('0x35')],_0x5657cf[_0x4349('0x32')]);_0x4ee683[_0x4349('0x36')]=_[_0x4349('0x34')](_0x5657cf[_0x4349('0x35')],qs[_0x4349('0x37')](_0x2da8ae[_0x4349('0x32')]['fields']));_0x4ee683[_0x4349('0x36')]=_0x4ee683['attributes'][_0x4349('0x38')]?_0x4ee683[_0x4349('0x36')]:_0x5657cf[_0x4349('0x35')];if(_0x2da8ae[_0x4349('0x32')][_0x4349('0x44')]){_0x4ee683[_0x4349('0x45')]=[{'all':!![]}];}_0x4ee683=_[_0x4349('0x42')]({},_0x4ee683,_0x2da8ae[_0x4349('0x4c')]);return db['FaxApplication']['find'](_0x4ee683)[_0x4349('0x27')](handleEntityNotFound(_0x550160,null))[_0x4349('0x27')](respondWithResult(_0x550160,null))[_0x4349('0x48')](handleError(_0x550160,null));};exports[_0x4349('0x4d')]=function(_0x5e8322,_0x198233){return db['FaxApplication'][_0x4349('0x4d')](_0x5e8322['body'],{})[_0x4349('0x27')](respondWithResult(_0x198233,0xc9))['catch'](handleError(_0x198233,null));};exports[_0x4349('0x26')]=function(_0x2f0881,_0x121ac8){if(_0x2f0881['body']['id']){delete _0x2f0881['body']['id'];}return db['FaxApplication'][_0x4349('0x4e')]({'where':{'id':_0x2f0881[_0x4349('0x4a')]['id']}})[_0x4349('0x27')](handleEntityNotFound(_0x121ac8,null))['then'](saveUpdates(_0x2f0881[_0x4349('0x4f')],null))[_0x4349('0x27')](respondWithResult(_0x121ac8,null))['catch'](handleError(_0x121ac8,null));};exports[_0x4349('0x28')]=function(_0x94a0a3,_0x5aeb50){return db[_0x4349('0x43')][_0x4349('0x4e')]({'where':{'id':_0x94a0a3[_0x4349('0x4a')]['id']}})[_0x4349('0x27')](handleEntityNotFound(_0x5aeb50,null))[_0x4349('0x27')](removeEntity(_0x5aeb50,null))[_0x4349('0x48')](handleError(_0x5aeb50,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b51ac6a..f53ca3d 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 _0x34d1=['bluebird','path','rimraf','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1a84d5,_0xa631a1){var _0x1740cd=function(_0x207554){while(--_0x207554){_0x1a84d5['push'](_0x1a84d5['shift']());}};_0x1740cd(++_0xa631a1);}(_0x34d1,0x1e9));var _0x134d=function(_0x42d278,_0x196838){_0x42d278=_0x42d278-0x0;var _0x4fe99b=_0x34d1[_0x42d278];return _0x4fe99b;};'use strict';var _=require(_0x134d('0x0'));var util=require(_0x134d('0x1'));var logger=require(_0x134d('0x2'))(_0x134d('0x3'));var moment=require(_0x134d('0x4'));var BPromise=require(_0x134d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x134d('0x6'));var rimraf=require(_0x134d('0x7'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module['exports']=function(_0x28b597,_0x30a19b){return _0x28b597[_0x134d('0x8')](_0x134d('0x9'),attributes,{'tableName':_0x134d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x134d('0xb'),'collate':_0x134d('0xc')});}; \ No newline at end of file +var _0x6d5e=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication'];(function(_0x37fa4f,_0x379eb2){var _0x17133f=function(_0x38b3ee){while(--_0x38b3ee){_0x37fa4f['push'](_0x37fa4f['shift']());}};_0x17133f(++_0x379eb2);}(_0x6d5e,0x1a7));var _0xe6d5=function(_0x30b53b,_0x54fb29){_0x30b53b=_0x30b53b-0x0;var _0x499105=_0x6d5e[_0x30b53b];return _0x499105;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var logger=require(_0xe6d5('0x2'))('api');var moment=require(_0xe6d5('0x3'));var BPromise=require(_0xe6d5('0x4'));var rp=require(_0xe6d5('0x5'));var fs=require('fs');var path=require(_0xe6d5('0x6'));var rimraf=require(_0xe6d5('0x7'));var config=require(_0xe6d5('0x8'));var attributes=require(_0xe6d5('0x9'));module['exports']=function(_0x5266a7,_0x17927a){return _0x5266a7[_0xe6d5('0xa')](_0xe6d5('0xb'),attributes,{'tableName':_0xe6d5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe6d5('0xd'),'collate':_0xe6d5('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0cbc82b..5d6d7d5 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 _0x2279=['rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','FaxApplication,\x20%s,\x20%s','message','info','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','stringify','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x523fb2,_0x1085c1){var _0x308995=function(_0x462b7f){while(--_0x462b7f){_0x523fb2['push'](_0x523fb2['shift']());}};_0x308995(++_0x1085c1);}(_0x2279,0x90));var _0x9227=function(_0x4753c6,_0x3ff8c4){_0x4753c6=_0x4753c6-0x0;var _0x34e20a=_0x2279[_0x4753c6];return _0x34e20a;};'use strict';var _=require('lodash');var util=require(_0x9227('0x0'));var moment=require('moment');var BPromise=require(_0x9227('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9227('0x2'));var db=require(_0x9227('0x3'))['db'];var utils=require(_0x9227('0x4'));var logger=require(_0x9227('0x5'))(_0x9227('0x6'));var config=require(_0x9227('0x7'));var jayson=require(_0x9227('0x8'));var client=jayson[_0x9227('0x9')][_0x9227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55c9db,_0x357534,_0x1ee9c6){return new BPromise(function(_0x37d022,_0x5f4cd3){return client[_0x9227('0xb')](_0x55c9db,_0x1ee9c6)[_0x9227('0xc')](function(_0x58f8a8){logger['info']('FaxApplication,\x20%s,\x20%s',_0x357534,_0x9227('0xd'));logger[_0x9227('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x357534,_0x9227('0xd'),JSON['stringify'](_0x58f8a8));if(_0x58f8a8['error']){if(_0x58f8a8[_0x9227('0xf')][_0x9227('0x10')]===0x1f4){logger[_0x9227('0xf')](_0x9227('0x11'),_0x357534,_0x58f8a8[_0x9227('0xf')][_0x9227('0x12')]);return _0x5f4cd3(_0x58f8a8[_0x9227('0xf')][_0x9227('0x12')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x357534,_0x58f8a8[_0x9227('0xf')][_0x9227('0x12')]);return _0x37d022(_0x58f8a8[_0x9227('0xf')][_0x9227('0x12')]);}else{logger[_0x9227('0x13')](_0x9227('0x11'),_0x357534,_0x9227('0xd'));_0x37d022(_0x58f8a8['result']['message']);}})[_0x9227('0x14')](function(_0x4319df){logger['error'](_0x9227('0x11'),_0x357534,_0x4319df);_0x5f4cd3(_0x4319df);});});}exports[_0x9227('0x15')]=function(_0x16217f){var _0x7077f6=this;return new Promise(function(_0x3f5fcc,_0x584d02){return db[_0x9227('0x16')][_0x9227('0x17')](_0x16217f[_0x9227('0x18')],{'raw':_0x16217f[_0x9227('0x19')]?_0x16217f[_0x9227('0x19')][_0x9227('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16217f['options']?_0x16217f[_0x9227('0x19')][_0x9227('0x1b')]||null:null,'attributes':_0x16217f[_0x9227('0x19')]?_0x16217f['options']['attributes']||null:null,'limit':_0x16217f[_0x9227('0x19')]?_0x16217f['options'][_0x9227('0x1c')]||null:null})[_0x9227('0xc')](function(_0x6b7776){logger[_0x9227('0x13')](_0x9227('0x15'),_0x16217f);logger[_0x9227('0xe')](_0x9227('0x15'),_0x16217f,JSON[_0x9227('0x1d')](_0x6b7776));_0x3f5fcc(_0x6b7776);})[_0x9227('0x14')](function(_0x3db7ca){logger[_0x9227('0xf')]('UpdateFaxApplication',_0x3db7ca['message'],_0x16217f);_0x584d02(_0x7077f6[_0x9227('0xf')](0x1f4,_0x3db7ca[_0x9227('0x12')]));});});}; \ No newline at end of file +var _0x4841=['options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','UpdateFaxApplication','FaxApplication','update','body'];(function(_0x44e6fd,_0x25a37a){var _0x11e582=function(_0x4a0271){while(--_0x4a0271){_0x44e6fd['push'](_0x44e6fd['shift']());}};_0x11e582(++_0x25a37a);}(_0x4841,0xfc));var _0x1484=function(_0x4279fa,_0xa5ed34){_0x4279fa=_0x4279fa-0x0;var _0x1cd0b6=_0x4841[_0x4279fa];return _0x1cd0b6;};'use strict';var _=require(_0x1484('0x0'));var util=require(_0x1484('0x1'));var moment=require(_0x1484('0x2'));var BPromise=require(_0x1484('0x3'));var rs=require(_0x1484('0x4'));var fs=require('fs');var Redis=require(_0x1484('0x5'));var db=require(_0x1484('0x6'))['db'];var utils=require(_0x1484('0x7'));var logger=require(_0x1484('0x8'))(_0x1484('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1484('0xa')][_0x1484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x480e4a,_0x1acbc4,_0x2e0d64){return new BPromise(function(_0x1437bb,_0x20e979){return client[_0x1484('0xc')](_0x480e4a,_0x2e0d64)[_0x1484('0xd')](function(_0x3f000d){logger[_0x1484('0xe')](_0x1484('0xf'),_0x1acbc4,'request\x20sent');logger['debug'](_0x1484('0x10'),_0x1acbc4,'request\x20sent',JSON[_0x1484('0x11')](_0x3f000d));if(_0x3f000d[_0x1484('0x12')]){if(_0x3f000d[_0x1484('0x12')][_0x1484('0x13')]===0x1f4){logger[_0x1484('0x12')](_0x1484('0xf'),_0x1acbc4,_0x3f000d[_0x1484('0x12')][_0x1484('0x14')]);return _0x20e979(_0x3f000d[_0x1484('0x12')][_0x1484('0x14')]);}logger[_0x1484('0x12')](_0x1484('0xf'),_0x1acbc4,_0x3f000d[_0x1484('0x12')][_0x1484('0x14')]);return _0x1437bb(_0x3f000d[_0x1484('0x12')][_0x1484('0x14')]);}else{logger[_0x1484('0xe')]('FaxApplication,\x20%s,\x20%s',_0x1acbc4,_0x1484('0x15'));_0x1437bb(_0x3f000d['result']['message']);}})[_0x1484('0x16')](function(_0x530245){logger[_0x1484('0x12')](_0x1484('0xf'),_0x1acbc4,_0x530245);_0x20e979(_0x530245);});});}exports[_0x1484('0x17')]=function(_0x23dd1a){var _0x389f5f=this;return new Promise(function(_0x53ed40,_0x24c744){return db[_0x1484('0x18')][_0x1484('0x19')](_0x23dd1a[_0x1484('0x1a')],{'raw':_0x23dd1a[_0x1484('0x1b')]?_0x23dd1a[_0x1484('0x1b')][_0x1484('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23dd1a[_0x1484('0x1b')]?_0x23dd1a[_0x1484('0x1b')][_0x1484('0x1d')]||null:null,'attributes':_0x23dd1a['options']?_0x23dd1a['options']['attributes']||null:null,'limit':_0x23dd1a['options']?_0x23dd1a[_0x1484('0x1b')][_0x1484('0x1e')]||null:null})[_0x1484('0xd')](function(_0x22c925){logger[_0x1484('0xe')](_0x1484('0x17'),_0x23dd1a);logger['debug']('UpdateFaxApplication',_0x23dd1a,JSON['stringify'](_0x22c925));_0x53ed40(_0x22c925);})[_0x1484('0x16')](function(_0x7e6a69){logger['error'](_0x1484('0x17'),_0x7e6a69[_0x1484('0x14')],_0x23dd1a);_0x24c744(_0x389f5f['error'](0x1f4,_0x7e6a69['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7cbafe6..ff6ca36 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 _0x5c00=['delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0xd4e013,_0x42b259){var _0x47aa83=function(_0x55c7de){while(--_0x55c7de){_0xd4e013['push'](_0xd4e013['shift']());}};_0x47aa83(++_0x42b259);}(_0x5c00,0x17e));var _0x05c0=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0x5c00[_0x2d48fa];return _0x4645b7;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./faxApplication.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05c0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9c00=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4ccc24,_0x53a1f9){var _0x4066f6=function(_0x514e96){while(--_0x514e96){_0x4ccc24['push'](_0x4ccc24['shift']());}};_0x4066f6(++_0x53a1f9);}(_0x9c00,0x1a0));var _0x09c0=function(_0x38b297,_0x27dcd0){_0x38b297=_0x38b297-0x0;var _0x5e8157=_0x9c00[_0x38b297];return _0x5e8157;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x09c0('0xd')]);router[_0x09c0('0xe')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x11')]);module[_0x09c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index acabab9..168c88f 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 _0x32f4=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x36744a,_0x1ae1a8){var _0x3a957=function(_0x5ab871){while(--_0x5ab871){_0x36744a['push'](_0x36744a['shift']());}};_0x3a957(++_0x1ae1a8);}(_0x32f4,0x154));var _0x432f=function(_0x13c80d,_0x52cdc8){_0x13c80d=_0x13c80d-0x0;var _0x29b74c=_0x32f4[_0x13c80d];return _0x29b74c;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'closed':{'type':Sequelize[_0x432f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x432f('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x432f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x432f('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x432f('0x3')]},'fax':{'type':Sequelize[_0x432f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x432f('0x5')]('in',_0x432f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x432f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x432f('0x7')]}}; \ No newline at end of file +var _0x7b84=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7b84,0x17c));var _0x47b8=function(_0x3dac43,_0x181d1f){_0x3dac43=_0x3dac43-0x0;var _0x252919=_0x7b84[_0x3dac43];return _0x252919;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'closed':{'type':Sequelize[_0x47b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x47b8('0x3')]},'disposition':{'type':Sequelize[_0x47b8('0x4')]},'secondDisposition':{'type':Sequelize[_0x47b8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x47b8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x47b8('0x3')]},'fax':{'type':Sequelize[_0x47b8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in',_0x47b8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x47b8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x47b8('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index ba7f691..580d6ef 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 _0xf9a0=['./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','show','params','model','keys','query','attributes','fields','length','includeAll','include','merge','find','catch','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','filters','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','spread','Tag','findAll','color','emit','faxInteractionTags:save','removeTags','toString','join','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','log','unlinkSync','zip-dir','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','localhost','redis'];(function(_0x49e6db,_0x1a4546){var _0x5a6137=function(_0xcf3ed9){while(--_0xcf3ed9){_0x49e6db['push'](_0x49e6db['shift']());}};_0x5a6137(++_0x1a4546);}(_0xf9a0,0x1e8));var _0x0f9a=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0xf9a0[_0x350182];return _0x4a0892;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0f9a('0x0'));var moment=require(_0x0f9a('0x1'));var BPromise=require('bluebird');var util=require(_0x0f9a('0x2'));var path=require(_0x0f9a('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x0f9a('0x4'));var interaction=require(_0x0f9a('0x5'));var qs=require(_0x0f9a('0x6'));var logger=require('../../config/logger')(_0x0f9a('0x7'));var config=require(_0x0f9a('0x8'));var db=require(_0x0f9a('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x0f9a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f9a('0xb')]));require(_0x0f9a('0xc'))[_0x0f9a('0xd')](socket);function respondWithStatusCode(_0x34c98f,_0x346b69){_0x346b69=_0x346b69||0xcc;return function(_0x31fa0f){if(_0x31fa0f){return _0x34c98f[_0x0f9a('0xe')](_0x346b69);}return _0x34c98f[_0x0f9a('0xf')](_0x346b69)[_0x0f9a('0x10')]();};}function respondWithResult(_0x489217,_0x36e66){_0x36e66=_0x36e66||0xc8;return function(_0x161f52){if(_0x161f52){return _0x489217[_0x0f9a('0xf')](_0x36e66)['json'](_0x161f52);}};}function respondWithFilteredResult(_0x16266a,_0x4b298c){return function(_0x1ccade){if(_0x1ccade){var _0x1caf60=typeof _0x4b298c[_0x0f9a('0x11')]===_0x0f9a('0x12')&&typeof _0x4b298c[_0x0f9a('0x13')]===_0x0f9a('0x12');var _0x10aa47=_0x1ccade['count'];var _0x1c781b=_0x1caf60?0x0:_0x4b298c['offset'];var _0x4b98ca=_0x1caf60?_0x1ccade[_0x0f9a('0x14')]:_0x4b298c[_0x0f9a('0x11')]+_0x4b298c[_0x0f9a('0x13')];var _0x8e5d5e;if(_0x4b98ca>=_0x10aa47){_0x4b98ca=_0x10aa47;_0x8e5d5e=0xc8;}else{_0x8e5d5e=0xce;}_0x16266a['status'](_0x8e5d5e);return _0x16266a[_0x0f9a('0x15')]('Content-Range',_0x1c781b+'-'+_0x4b98ca+'/'+_0x10aa47)[_0x0f9a('0x16')](_0x1ccade);}return null;};}function saveUpdates(_0x32123f){return function(_0x537084){if(_0x537084){return _0x537084[_0x0f9a('0x17')](_0x32123f)[_0x0f9a('0x18')](function(_0x39f7bf){return _0x39f7bf;});}return null;};}function removeEntity(_0x229741){return function(_0x490c9a){if(_0x490c9a){return _0x490c9a[_0x0f9a('0x19')]()[_0x0f9a('0x18')](function(){_0x229741[_0x0f9a('0xf')](0xcc)[_0x0f9a('0x10')]();});}};}function handleEntityNotFound(_0x563e57){return function(_0x38e6fb){if(!_0x38e6fb){_0x563e57[_0x0f9a('0xe')](0x194);}return _0x38e6fb;};}function handleError(_0x29c866,_0x1f4b9d){_0x1f4b9d=_0x1f4b9d||0x1f4;return function(_0x901fa1){logger['error'](_0x901fa1['stack']);if(_0x901fa1['name']){delete _0x901fa1[_0x0f9a('0x1a')];}_0x29c866[_0x0f9a('0xf')](_0x1f4b9d)[_0x0f9a('0x1b')](_0x901fa1);};}exports[_0x0f9a('0x1c')]=function(_0x552d07,_0x2aab85){var _0x84acac={};var _0x3cb0a6=_[_0x0f9a('0x1d')](db[_0x0f9a('0x1e')][_0x0f9a('0x1f')],function(_0x468b94){return{'name':_0x468b94[_0x0f9a('0x20')],'type':_0x468b94[_0x0f9a('0x21')][_0x0f9a('0x22')]};});_0x84acac=qs[_0x0f9a('0x23')](_0x3cb0a6,_0x552d07);return interaction['findAll']('fax',_0x552d07['query'],_0x552d07['user'],_0x84acac,_0x3cb0a6)[_0x0f9a('0x18')](respondWithFilteredResult(_0x2aab85,_0x84acac))['catch'](handleError(_0x2aab85,null));};exports[_0x0f9a('0x24')]=function(_0x25d8a3,_0x26f468){var _0xec478f={'raw':![],'where':{'id':_0x25d8a3[_0x0f9a('0x25')]['id']}},_0x189ffd={};_0x189ffd[_0x0f9a('0x26')]=_[_0x0f9a('0x27')](db[_0x0f9a('0x1e')][_0x0f9a('0x1f')]);_0x189ffd[_0x0f9a('0x28')]=_[_0x0f9a('0x27')](_0x25d8a3['query']);_0x189ffd['filters']=_['intersection'](_0x189ffd[_0x0f9a('0x26')],_0x189ffd['query']);_0xec478f[_0x0f9a('0x29')]=_['intersection'](_0x189ffd[_0x0f9a('0x26')],qs[_0x0f9a('0x2a')](_0x25d8a3[_0x0f9a('0x28')][_0x0f9a('0x2a')]));_0xec478f[_0x0f9a('0x29')]=_0xec478f['attributes'][_0x0f9a('0x2b')]?_0xec478f[_0x0f9a('0x29')]:_0x189ffd[_0x0f9a('0x26')];if(_0x25d8a3[_0x0f9a('0x28')][_0x0f9a('0x2c')]){_0xec478f[_0x0f9a('0x2d')]=[{'all':!![]}];}_0xec478f=_[_0x0f9a('0x2e')]({},_0xec478f,_0x25d8a3['options']);return db[_0x0f9a('0x1e')][_0x0f9a('0x2f')](_0xec478f)[_0x0f9a('0x18')](handleEntityNotFound(_0x26f468,null))[_0x0f9a('0x18')](respondWithResult(_0x26f468,null))[_0x0f9a('0x30')](handleError(_0x26f468,null));};exports['create']=function(_0x1723ca,_0x53b825){return db[_0x0f9a('0x1e')][_0x0f9a('0x31')](_0x1723ca[_0x0f9a('0x32')],{})[_0x0f9a('0x18')](respondWithResult(_0x53b825,0xc9))[_0x0f9a('0x30')](handleError(_0x53b825,null));};exports[_0x0f9a('0x17')]=function(_0x1e171b,_0x3219c6){if(_0x1e171b[_0x0f9a('0x32')]['id']){delete _0x1e171b['body']['id'];}return db[_0x0f9a('0x1e')]['find']({'where':{'id':_0x1e171b[_0x0f9a('0x25')]['id']}})[_0x0f9a('0x18')](handleEntityNotFound(_0x3219c6,null))[_0x0f9a('0x18')](saveUpdates(_0x1e171b[_0x0f9a('0x32')],null))[_0x0f9a('0x18')](respondWithResult(_0x3219c6,null))[_0x0f9a('0x30')](handleError(_0x3219c6,null));};exports['destroy']=function(_0x15b97c,_0xf735c9){return db[_0x0f9a('0x1e')][_0x0f9a('0x2f')]({'where':{'id':_0x15b97c['params']['id']}})[_0x0f9a('0x18')](handleEntityNotFound(_0xf735c9,null))[_0x0f9a('0x18')](removeEntity(_0xf735c9,null))[_0x0f9a('0x30')](handleError(_0xf735c9,null));};exports['describe']=function(_0x2ef1b4,_0x5bb88e){return db['FaxInteraction'][_0x0f9a('0x33')]()[_0x0f9a('0x18')](respondWithResult(_0x5bb88e,null))['catch'](handleError(_0x5bb88e,null));};exports[_0x0f9a('0x34')]=function(_0x331b53,_0x12fc62){return db[_0x0f9a('0x35')][_0x0f9a('0x2f')]({'where':{'id':_0x331b53[_0x0f9a('0x25')]['id']}})['then'](handleEntityNotFound(_0x12fc62,null))[_0x0f9a('0x18')](function(_0x5bfba5){if(_0x5bfba5){return _0x5bfba5[_0x0f9a('0x34')](_0x331b53[_0x0f9a('0x32')][_0x0f9a('0x36')],_[_0x0f9a('0x37')](_0x331b53[_0x0f9a('0x32')],[_0x0f9a('0x36'),'id'])||{});}})['then'](respondWithResult(_0x12fc62,null))['catch'](handleError(_0x12fc62,null));};exports[_0x0f9a('0x38')]=function(_0x5e77ce,_0x5224d4){var _0x3548ec={'raw':![],'where':{}};var _0x2b0640={};var _0x12560c={'count':0x0,'rows':[]};return db[_0x0f9a('0x1e')][_0x0f9a('0x39')]({'where':{'id':_0x5e77ce['params']['id']}})[_0x0f9a('0x18')](handleEntityNotFound(_0x5224d4,null))[_0x0f9a('0x18')](function(_0x5a7934){if(_0x5a7934){_0x2b0640['model']=_[_0x0f9a('0x27')](db[_0x0f9a('0x35')][_0x0f9a('0x1f')]);_0x2b0640[_0x0f9a('0x28')]=_[_0x0f9a('0x27')](_0x5e77ce[_0x0f9a('0x28')]);_0x2b0640[_0x0f9a('0x3a')]=_[_0x0f9a('0x3b')](_0x2b0640[_0x0f9a('0x26')],_0x2b0640[_0x0f9a('0x28')]);_0x3548ec[_0x0f9a('0x29')]=_[_0x0f9a('0x3b')](_0x2b0640[_0x0f9a('0x26')],qs['fields'](_0x5e77ce['query'][_0x0f9a('0x2a')]));_0x3548ec['attributes']=_0x3548ec[_0x0f9a('0x29')]['length']?_0x3548ec[_0x0f9a('0x29')]:_0x2b0640[_0x0f9a('0x26')];if(!_0x5e77ce[_0x0f9a('0x28')][_0x0f9a('0x3c')](_0x0f9a('0x3d'))){_0x3548ec[_0x0f9a('0x13')]=qs[_0x0f9a('0x13')](_0x5e77ce[_0x0f9a('0x28')][_0x0f9a('0x13')]);_0x3548ec['offset']=qs[_0x0f9a('0x11')](_0x5e77ce[_0x0f9a('0x28')][_0x0f9a('0x11')]);}_0x3548ec[_0x0f9a('0x3e')]=qs[_0x0f9a('0x3f')](_0x5e77ce[_0x0f9a('0x28')]['sort']);_0x3548ec[_0x0f9a('0x40')]=qs[_0x0f9a('0x3a')](_[_0x0f9a('0x41')](_0x5e77ce[_0x0f9a('0x28')],_0x2b0640[_0x0f9a('0x3a')]));_0x3548ec['where']['FaxInteractionId']=_0x5a7934['id'];if(_0x5e77ce[_0x0f9a('0x28')][_0x0f9a('0x42')]){_0x3548ec['where']=_[_0x0f9a('0x2e')](_0x3548ec[_0x0f9a('0x40')],{'$or':_[_0x0f9a('0x1d')](_0x3548ec[_0x0f9a('0x29')],function(_0xde7b4e){var _0x352964={};_0x352964[_0xde7b4e]={'$like':'%'+_0x5e77ce[_0x0f9a('0x28')]['filter']+'%'};return _0x352964;})});}if(_0x5e77ce[_0x0f9a('0x28')][_0x0f9a('0x43')]){var _0x5adc5e=_0x5e77ce['query'][_0x0f9a('0x43')][_0x0f9a('0x44')](',');var _0xa33a8b={};_0xa33a8b[_0x5adc5e[0x0]]={'$gte':moment(_0x5adc5e[0x1])[_0x0f9a('0x45')](_0x0f9a('0x46'))};_0x3548ec[_0x0f9a('0x40')]=_['merge'](_0x3548ec['where'],_0xa33a8b);}_0x3548ec=_['merge']({},_0x3548ec,_0x5e77ce[_0x0f9a('0x47')]);return db[_0x0f9a('0x35')][_0x0f9a('0x14')]({'where':_0x3548ec[_0x0f9a('0x40')]})['then'](function(_0x59c72c){_0x12560c[_0x0f9a('0x14')]=_0x59c72c;if(_0x5e77ce[_0x0f9a('0x28')][_0x0f9a('0x2c')]){_0x3548ec[_0x0f9a('0x2d')]=[{'all':!![]}];}return db[_0x0f9a('0x35')]['findAll'](_0x3548ec);})[_0x0f9a('0x18')](function(_0x4142e5){_0x12560c[_0x0f9a('0x48')]=_0x4142e5;return _0x12560c;});}})[_0x0f9a('0x18')](respondWithFilteredResult(_0x5224d4,_0x3548ec))[_0x0f9a('0x30')](handleError(_0x5224d4,null));};exports[_0x0f9a('0x49')]=function(_0x534da1,_0x5a28dd){return db['FaxInteraction']['find']({'where':{'id':_0x534da1['params']['id']}})[_0x0f9a('0x18')](handleEntityNotFound(_0x5a28dd,null))['then'](function(_0x5331c5){if(_0x5331c5){return _0x5331c5['setTags'](_0x534da1[_0x0f9a('0x32')][_0x0f9a('0x36')],_['omit'](_0x534da1[_0x0f9a('0x32')],[_0x0f9a('0x36'),'id'])||{})[_0x0f9a('0x4a')](function(){return db[_0x0f9a('0x4b')][_0x0f9a('0x4c')]({'attributes':['id',_0x0f9a('0x1a'),_0x0f9a('0x4d')],'where':{'id':_0x534da1[_0x0f9a('0x32')][_0x0f9a('0x36')]}});})[_0x0f9a('0x18')](function(_0x49d07b){socket[_0x0f9a('0x4e')](_0x0f9a('0x4f'),{'id':Number(_0x534da1[_0x0f9a('0x25')]['id']),'tags':_0x49d07b||[]});return{'id':Number(_0x534da1[_0x0f9a('0x25')]['id']),'tags':_0x49d07b||[]};});}})[_0x0f9a('0x18')](respondWithResult(_0x5a28dd,null))[_0x0f9a('0x30')](handleError(_0x5a28dd,null));};exports[_0x0f9a('0x50')]=function(_0x501336,_0x39afe7){return db['FaxInteraction']['find']({'where':{'id':_0x501336[_0x0f9a('0x25')]['id']}})[_0x0f9a('0x18')](handleEntityNotFound(_0x39afe7,null))[_0x0f9a('0x18')](function(_0x2ad550){if(_0x2ad550){return _0x2ad550['removeTags'](_0x501336[_0x0f9a('0x28')][_0x0f9a('0x36')]);}})[_0x0f9a('0x18')](respondWithStatusCode(_0x39afe7,null))[_0x0f9a('0x30')](handleError(_0x39afe7,null));};exports['download']=function(_0x40456f,_0x4e8f43){var _0x8248a1=moment()['unix']()[_0x0f9a('0x51')]();var _0x5baeee=path[_0x0f9a('0x52')](config['root'],_0x0f9a('0x53'),_0x0f9a('0x54'),_0x0f9a('0x55'));var _0x1fbb3a=path[_0x0f9a('0x52')](config['root'],_0x0f9a('0x53'),_0x0f9a('0x54'),_0x0f9a('0x56'));var _0x4d6cd6=path[_0x0f9a('0x52')](_0x5baeee,_0x8248a1);var _0x5dc084=util[_0x0f9a('0x45')](_0x0f9a('0x57'),_0x40456f[_0x0f9a('0x25')]['id'],_0x8248a1);var _0x5556e0=path[_0x0f9a('0x52')](_0x5baeee,_0x5dc084);var _0x54d721=[];_0x54d721['push']({'model':db[_0x0f9a('0x58')],'as':_0x0f9a('0x58'),'raw':!![]});var _0x43f428=[{'model':db['FaxMessage'],'as':_0x0f9a('0x59'),'attributes':['id',_0x0f9a('0x32'),_0x0f9a('0x5a')],'include':_0x54d721}];return db[_0x0f9a('0x1e')][_0x0f9a('0x2f')]({'where':{'id':_0x40456f[_0x0f9a('0x25')]['id']},'include':_0x43f428})[_0x0f9a('0x18')](handleEntityNotFound(_0x4e8f43,null))[_0x0f9a('0x18')](function(_0x11bad6){if(_0x11bad6&&_0x11bad6[_0x0f9a('0x59')]){var _0x44b12f=_0x11bad6[_0x0f9a('0x5b')]({'plain':!![]});fs[_0x0f9a('0x5c')](_0x4d6cd6);for(var _0x2b6086=0x0;_0x2b6086<_0x44b12f[_0x0f9a('0x59')]['length'];_0x2b6086++){var _0x2fbee0=_0x44b12f[_0x0f9a('0x59')][_0x2b6086][_0x0f9a('0x58')];if(_0x2fbee0){var _0x2f84e2=path[_0x0f9a('0x52')](_0x1fbb3a,_0x2fbee0[_0x0f9a('0x5d')]);if(fs[_0x0f9a('0x5e')](_0x2f84e2)){fs[_0x0f9a('0x5f')](_0x2f84e2)['pipe'](fs[_0x0f9a('0x60')](path[_0x0f9a('0x52')](_0x4d6cd6,_0x2fbee0[_0x0f9a('0x5d')])));}}}return BPromise[_0x0f9a('0x61')]()['then'](function(){return new BPromise(function(_0x283d8a,_0x181bac){zipdir(_0x4d6cd6,{'saveTo':_0x5556e0},function(_0x7ca6b4,_0x50ab48){if(_0x7ca6b4)return _0x181bac(_0x7ca6b4);return _0x283d8a(_0x50ab48);});})[_0x0f9a('0x18')](function(){return new BPromise(function(_0xa2d66e,_0x3b7c69){rimraf(_0x4d6cd6,function(_0x2ff2ff){if(_0x2ff2ff)_0x3b7c69(_0x2ff2ff);return _0xa2d66e();});});})[_0x0f9a('0x18')](function(){return _0x4e8f43['download'](_0x5556e0,_0x5dc084,function(_0x4f0da7){if(_0x4f0da7){console[_0x0f9a('0x62')]('err',_0x4f0da7);}else{fs[_0x0f9a('0x63')](_0x5556e0);}});});});}else{return _0x4e8f43[_0x0f9a('0xe')](0xc8);}})[_0x0f9a('0x30')](handleError(_0x4e8f43,null));}; \ No newline at end of file +var _0xb6b7=['../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','destroy','then','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','catch','show','params','model','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','update','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','keys','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','toString','join','files','root','attachments','push','Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','resolve','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ioredis'];(function(_0x356ae7,_0x579015){var _0x3751dd=function(_0x53b707){while(--_0x53b707){_0x356ae7['push'](_0x356ae7['shift']());}};_0x3751dd(++_0x579015);}(_0xb6b7,0xc7));var _0x7b6b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb6b7[_0x2dafbe];return _0x58a45a;};'use strict';var rimraf=require(_0x7b6b('0x0'));var zipdir=require(_0x7b6b('0x1'));var moment=require(_0x7b6b('0x2'));var BPromise=require(_0x7b6b('0x3'));var util=require(_0x7b6b('0x4'));var path=require(_0x7b6b('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x7b6b('0x6'));var interaction=require(_0x7b6b('0x7'));var qs=require(_0x7b6b('0x8'));var logger=require(_0x7b6b('0x9'))(_0x7b6b('0xa'));var config=require('../../config/environment');var db=require(_0x7b6b('0xb'))['db'];config[_0x7b6b('0xc')]=_['defaults'](config[_0x7b6b('0xc')],{'host':_0x7b6b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b6b('0xc')]));require(_0x7b6b('0xe'))[_0x7b6b('0xf')](socket);function respondWithStatusCode(_0x316e61,_0x53ca6e){_0x53ca6e=_0x53ca6e||0xcc;return function(_0x3c3f8c){if(_0x3c3f8c){return _0x316e61[_0x7b6b('0x10')](_0x53ca6e);}return _0x316e61[_0x7b6b('0x11')](_0x53ca6e)[_0x7b6b('0x12')]();};}function respondWithResult(_0x19c887,_0x1245f7){_0x1245f7=_0x1245f7||0xc8;return function(_0x37195f){if(_0x37195f){return _0x19c887['status'](_0x1245f7)[_0x7b6b('0x13')](_0x37195f);}};}function respondWithFilteredResult(_0x2228a4,_0x342a3f){return function(_0x60e17){if(_0x60e17){var _0x5b4540=typeof _0x342a3f[_0x7b6b('0x14')]===_0x7b6b('0x15')&&typeof _0x342a3f['limit']==='undefined';var _0x2f47b9=_0x60e17['count'];var _0x455a8a=_0x5b4540?0x0:_0x342a3f[_0x7b6b('0x14')];var _0x5b9846=_0x5b4540?_0x60e17['count']:_0x342a3f[_0x7b6b('0x14')]+_0x342a3f[_0x7b6b('0x16')];var _0x3d0584;if(_0x5b9846>=_0x2f47b9){_0x5b9846=_0x2f47b9;_0x3d0584=0xc8;}else{_0x3d0584=0xce;}_0x2228a4[_0x7b6b('0x11')](_0x3d0584);return _0x2228a4[_0x7b6b('0x17')](_0x7b6b('0x18'),_0x455a8a+'-'+_0x5b9846+'/'+_0x2f47b9)[_0x7b6b('0x13')](_0x60e17);}return null;};}function saveUpdates(_0x5bfc0d){return function(_0x546484){if(_0x546484){return _0x546484['update'](_0x5bfc0d)['then'](function(_0x430dbb){return _0x430dbb;});}return null;};}function removeEntity(_0x11b4d4){return function(_0x2e53a2){if(_0x2e53a2){return _0x2e53a2[_0x7b6b('0x19')]()[_0x7b6b('0x1a')](function(){_0x11b4d4[_0x7b6b('0x11')](0xcc)[_0x7b6b('0x12')]();});}};}function handleEntityNotFound(_0x58541c){return function(_0x35b402){if(!_0x35b402){_0x58541c[_0x7b6b('0x10')](0x194);}return _0x35b402;};}function handleError(_0x479192,_0x3176e6){_0x3176e6=_0x3176e6||0x1f4;return function(_0x1d1907){logger['error'](_0x1d1907[_0x7b6b('0x1b')]);if(_0x1d1907[_0x7b6b('0x1c')]){delete _0x1d1907[_0x7b6b('0x1c')];}_0x479192[_0x7b6b('0x11')](_0x3176e6)[_0x7b6b('0x1d')](_0x1d1907);};}exports[_0x7b6b('0x1e')]=function(_0x56ee7a,_0x5436ef){var _0x292512={};var _0x3c58df=_[_0x7b6b('0x1f')](db[_0x7b6b('0x20')][_0x7b6b('0x21')],function(_0x3c3374){return{'name':_0x3c3374[_0x7b6b('0x22')],'type':_0x3c3374['type'][_0x7b6b('0x23')]};});_0x292512=qs[_0x7b6b('0x24')](_0x3c58df,_0x56ee7a);return interaction[_0x7b6b('0x25')](_0x7b6b('0x26'),_0x56ee7a[_0x7b6b('0x27')],_0x56ee7a[_0x7b6b('0x28')],_0x292512,_0x3c58df)['then'](respondWithFilteredResult(_0x5436ef,_0x292512))[_0x7b6b('0x29')](handleError(_0x5436ef,null));};exports[_0x7b6b('0x2a')]=function(_0x268e19,_0x4a441f){var _0x56464d={'raw':![],'where':{'id':_0x268e19[_0x7b6b('0x2b')]['id']}},_0x59debc={};_0x59debc[_0x7b6b('0x2c')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x59debc[_0x7b6b('0x27')]=_['keys'](_0x268e19[_0x7b6b('0x27')]);_0x59debc[_0x7b6b('0x2d')]=_[_0x7b6b('0x2e')](_0x59debc[_0x7b6b('0x2c')],_0x59debc[_0x7b6b('0x27')]);_0x56464d[_0x7b6b('0x2f')]=_[_0x7b6b('0x2e')](_0x59debc['model'],qs[_0x7b6b('0x30')](_0x268e19[_0x7b6b('0x27')][_0x7b6b('0x30')]));_0x56464d[_0x7b6b('0x2f')]=_0x56464d[_0x7b6b('0x2f')][_0x7b6b('0x31')]?_0x56464d[_0x7b6b('0x2f')]:_0x59debc[_0x7b6b('0x2c')];if(_0x268e19[_0x7b6b('0x27')][_0x7b6b('0x32')]){_0x56464d[_0x7b6b('0x33')]=[{'all':!![]}];}_0x56464d=_['merge']({},_0x56464d,_0x268e19[_0x7b6b('0x34')]);return db[_0x7b6b('0x20')][_0x7b6b('0x35')](_0x56464d)[_0x7b6b('0x1a')](handleEntityNotFound(_0x4a441f,null))['then'](respondWithResult(_0x4a441f,null))[_0x7b6b('0x29')](handleError(_0x4a441f,null));};exports[_0x7b6b('0x36')]=function(_0x4fded2,_0x39855a){return db[_0x7b6b('0x20')][_0x7b6b('0x36')](_0x4fded2[_0x7b6b('0x37')],{})[_0x7b6b('0x1a')](respondWithResult(_0x39855a,0xc9))['catch'](handleError(_0x39855a,null));};exports[_0x7b6b('0x38')]=function(_0x8e848d,_0x2b17dd){if(_0x8e848d['body']['id']){delete _0x8e848d[_0x7b6b('0x37')]['id'];}return db[_0x7b6b('0x20')]['find']({'where':{'id':_0x8e848d[_0x7b6b('0x2b')]['id']}})[_0x7b6b('0x1a')](handleEntityNotFound(_0x2b17dd,null))[_0x7b6b('0x1a')](saveUpdates(_0x8e848d['body'],null))[_0x7b6b('0x1a')](respondWithResult(_0x2b17dd,null))[_0x7b6b('0x29')](handleError(_0x2b17dd,null));};exports[_0x7b6b('0x19')]=function(_0x41eec8,_0x2def88){return db[_0x7b6b('0x20')][_0x7b6b('0x35')]({'where':{'id':_0x41eec8[_0x7b6b('0x2b')]['id']}})[_0x7b6b('0x1a')](handleEntityNotFound(_0x2def88,null))[_0x7b6b('0x1a')](removeEntity(_0x2def88,null))[_0x7b6b('0x29')](handleError(_0x2def88,null));};exports[_0x7b6b('0x39')]=function(_0x353d5d,_0x121be7){return db[_0x7b6b('0x20')][_0x7b6b('0x39')]()[_0x7b6b('0x1a')](respondWithResult(_0x121be7,null))['catch'](handleError(_0x121be7,null));};exports[_0x7b6b('0x3a')]=function(_0x24811b,_0x1e8215){return db[_0x7b6b('0x3b')][_0x7b6b('0x35')]({'where':{'id':_0x24811b[_0x7b6b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1e8215,null))['then'](function(_0x2f14bf){if(_0x2f14bf){return _0x2f14bf[_0x7b6b('0x3a')](_0x24811b[_0x7b6b('0x37')]['ids'],_[_0x7b6b('0x3c')](_0x24811b[_0x7b6b('0x37')],[_0x7b6b('0x3d'),'id'])||{});}})[_0x7b6b('0x1a')](respondWithResult(_0x1e8215,null))[_0x7b6b('0x29')](handleError(_0x1e8215,null));};exports[_0x7b6b('0x3e')]=function(_0x25969c,_0x35b797){var _0x307fbc={'raw':![],'where':{}};var _0x3ce1a1={};var _0x5df530={'count':0x0,'rows':[]};return db[_0x7b6b('0x20')][_0x7b6b('0x3f')]({'where':{'id':_0x25969c[_0x7b6b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x35b797,null))[_0x7b6b('0x1a')](function(_0x3f9367){if(_0x3f9367){_0x3ce1a1[_0x7b6b('0x2c')]=_['keys'](db['FaxMessage'][_0x7b6b('0x21')]);_0x3ce1a1[_0x7b6b('0x27')]=_[_0x7b6b('0x40')](_0x25969c[_0x7b6b('0x27')]);_0x3ce1a1['filters']=_[_0x7b6b('0x2e')](_0x3ce1a1[_0x7b6b('0x2c')],_0x3ce1a1['query']);_0x307fbc[_0x7b6b('0x2f')]=_[_0x7b6b('0x2e')](_0x3ce1a1[_0x7b6b('0x2c')],qs[_0x7b6b('0x30')](_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x30')]));_0x307fbc[_0x7b6b('0x2f')]=_0x307fbc[_0x7b6b('0x2f')][_0x7b6b('0x31')]?_0x307fbc[_0x7b6b('0x2f')]:_0x3ce1a1[_0x7b6b('0x2c')];if(!_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x41')](_0x7b6b('0x42'))){_0x307fbc[_0x7b6b('0x16')]=qs[_0x7b6b('0x16')](_0x25969c['query'][_0x7b6b('0x16')]);_0x307fbc['offset']=qs[_0x7b6b('0x14')](_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x14')]);}_0x307fbc[_0x7b6b('0x43')]=qs[_0x7b6b('0x44')](_0x25969c[_0x7b6b('0x27')]['sort']);_0x307fbc[_0x7b6b('0x45')]=qs['filters'](_[_0x7b6b('0x46')](_0x25969c[_0x7b6b('0x27')],_0x3ce1a1[_0x7b6b('0x2d')]));_0x307fbc[_0x7b6b('0x45')]['FaxInteractionId']=_0x3f9367['id'];if(_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x47')]){_0x307fbc[_0x7b6b('0x45')]=_[_0x7b6b('0x48')](_0x307fbc['where'],{'$or':_[_0x7b6b('0x1f')](_0x307fbc['attributes'],function(_0x2c7ee1){var _0x796ced={};_0x796ced[_0x2c7ee1]={'$like':'%'+_0x25969c['query'][_0x7b6b('0x47')]+'%'};return _0x796ced;})});}if(_0x25969c[_0x7b6b('0x27')]['$gte']){var _0x478aa5=_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x49')][_0x7b6b('0x4a')](',');var _0x162144={};_0x162144[_0x478aa5[0x0]]={'$gte':moment(_0x478aa5[0x1])[_0x7b6b('0x4b')](_0x7b6b('0x4c'))};_0x307fbc[_0x7b6b('0x45')]=_[_0x7b6b('0x48')](_0x307fbc[_0x7b6b('0x45')],_0x162144);}_0x307fbc=_['merge']({},_0x307fbc,_0x25969c[_0x7b6b('0x34')]);return db[_0x7b6b('0x3b')][_0x7b6b('0x4d')]({'where':_0x307fbc[_0x7b6b('0x45')]})[_0x7b6b('0x1a')](function(_0x472af2){_0x5df530[_0x7b6b('0x4d')]=_0x472af2;if(_0x25969c[_0x7b6b('0x27')]['includeAll']){_0x307fbc[_0x7b6b('0x33')]=[{'all':!![]}];}return db[_0x7b6b('0x3b')][_0x7b6b('0x25')](_0x307fbc);})[_0x7b6b('0x1a')](function(_0x5703e4){_0x5df530[_0x7b6b('0x4e')]=_0x5703e4;return _0x5df530;});}})['then'](respondWithFilteredResult(_0x35b797,_0x307fbc))[_0x7b6b('0x29')](handleError(_0x35b797,null));};exports[_0x7b6b('0x4f')]=function(_0x17d0c7,_0x345cf8){return db[_0x7b6b('0x20')][_0x7b6b('0x35')]({'where':{'id':_0x17d0c7[_0x7b6b('0x2b')]['id']}})[_0x7b6b('0x1a')](handleEntityNotFound(_0x345cf8,null))['then'](function(_0x5085c8){if(_0x5085c8){return _0x5085c8[_0x7b6b('0x50')](_0x17d0c7[_0x7b6b('0x37')][_0x7b6b('0x3d')],_[_0x7b6b('0x3c')](_0x17d0c7[_0x7b6b('0x37')],[_0x7b6b('0x3d'),'id'])||{})[_0x7b6b('0x51')](function(){return db[_0x7b6b('0x52')]['findAll']({'attributes':['id',_0x7b6b('0x1c'),_0x7b6b('0x53')],'where':{'id':_0x17d0c7[_0x7b6b('0x37')][_0x7b6b('0x3d')]}});})[_0x7b6b('0x1a')](function(_0x2fba7b){socket[_0x7b6b('0x54')]('faxInteractionTags:save',{'id':Number(_0x17d0c7[_0x7b6b('0x2b')]['id']),'tags':_0x2fba7b||[]});return{'id':Number(_0x17d0c7[_0x7b6b('0x2b')]['id']),'tags':_0x2fba7b||[]};});}})['then'](respondWithResult(_0x345cf8,null))[_0x7b6b('0x29')](handleError(_0x345cf8,null));};exports[_0x7b6b('0x55')]=function(_0x674571,_0xb08816){return db[_0x7b6b('0x20')]['find']({'where':{'id':_0x674571['params']['id']}})['then'](handleEntityNotFound(_0xb08816,null))[_0x7b6b('0x1a')](function(_0x22db74){if(_0x22db74){return _0x22db74[_0x7b6b('0x55')](_0x674571['query']['ids']);}})['then'](respondWithStatusCode(_0xb08816,null))[_0x7b6b('0x29')](handleError(_0xb08816,null));};exports[_0x7b6b('0x56')]=function(_0x4a7845,_0x1c96b7){var _0x1f20d0=moment()['unix']()[_0x7b6b('0x57')]();var _0x5af7ca=path[_0x7b6b('0x58')](config['root'],'server',_0x7b6b('0x59'),'tmp');var _0x217e36=path['join'](config[_0x7b6b('0x5a')],'server',_0x7b6b('0x59'),_0x7b6b('0x5b'));var _0x382622=path['join'](_0x5af7ca,_0x1f20d0);var _0x5d8c38=util[_0x7b6b('0x4b')]('transcript-%d-%s.zip',_0x4a7845['params']['id'],_0x1f20d0);var _0x10cb05=path[_0x7b6b('0x58')](_0x5af7ca,_0x5d8c38);var _0x111dc8=[];_0x111dc8[_0x7b6b('0x5c')]({'model':db[_0x7b6b('0x5d')],'as':'Attachment','raw':!![]});var _0x48085e=[{'model':db[_0x7b6b('0x3b')],'as':_0x7b6b('0x5e'),'attributes':['id',_0x7b6b('0x37'),_0x7b6b('0x5f')],'include':_0x111dc8}];return db[_0x7b6b('0x20')][_0x7b6b('0x35')]({'where':{'id':_0x4a7845[_0x7b6b('0x2b')]['id']},'include':_0x48085e})[_0x7b6b('0x1a')](handleEntityNotFound(_0x1c96b7,null))[_0x7b6b('0x1a')](function(_0x1fd01f){if(_0x1fd01f&&_0x1fd01f[_0x7b6b('0x5e')]){var _0x487315=_0x1fd01f['get']({'plain':!![]});fs[_0x7b6b('0x60')](_0x382622);for(var _0x2bc22d=0x0;_0x2bc22d<_0x487315[_0x7b6b('0x5e')][_0x7b6b('0x31')];_0x2bc22d++){var _0x1f26d4=_0x487315[_0x7b6b('0x5e')][_0x2bc22d][_0x7b6b('0x5d')];if(_0x1f26d4){var _0x5b1188=path['join'](_0x217e36,_0x1f26d4['basename']);if(fs[_0x7b6b('0x61')](_0x5b1188)){fs[_0x7b6b('0x62')](_0x5b1188)[_0x7b6b('0x63')](fs['createWriteStream'](path[_0x7b6b('0x58')](_0x382622,_0x1f26d4['basename'])));}}}return BPromise[_0x7b6b('0x64')]()[_0x7b6b('0x1a')](function(){return new BPromise(function(_0x3d1d79,_0x501772){zipdir(_0x382622,{'saveTo':_0x10cb05},function(_0x2a269c,_0x13b4fe){if(_0x2a269c)return _0x501772(_0x2a269c);return _0x3d1d79(_0x13b4fe);});})[_0x7b6b('0x1a')](function(){return new BPromise(function(_0x52dbdc,_0x3254bf){rimraf(_0x382622,function(_0x4b68c2){if(_0x4b68c2)_0x3254bf(_0x4b68c2);return _0x52dbdc();});});})[_0x7b6b('0x1a')](function(){return _0x1c96b7[_0x7b6b('0x56')](_0x10cb05,_0x5d8c38,function(_0x2e338f){if(_0x2e338f){console[_0x7b6b('0x65')]('err',_0x2e338f);}else{fs[_0x7b6b('0x66')](_0x10cb05);}});});});}else{return _0x1c96b7[_0x7b6b('0x10')](0xc8);}})[_0x7b6b('0x29')](handleError(_0x1c96b7,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index eca871d..a9c75a6 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 _0x67df=['catch','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit'];(function(_0x25ccbe,_0xc935c0){var _0x289529=function(_0x478776){while(--_0x478776){_0x25ccbe['push'](_0x25ccbe['shift']());}};_0x289529(++_0xc935c0);}(_0x67df,0x17d));var _0xf67d=function(_0x48c943,_0xb3a774){_0x48c943=_0x48c943-0x0;var _0x36507c=_0x67df[_0x48c943];return _0x36507c;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xf67d('0x0'))['db'][_0xf67d('0x1')];var FaxMessage=require(_0xf67d('0x0'))['db'][_0xf67d('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf67d('0x3')](0x0);var events={'afterCreate':_0xf67d('0x4'),'afterUpdate':'update','afterDestroy':_0xf67d('0x5')};function emitEvent(_0x19e2fb){return function(_0x3da3e4,_0x54a9de,_0x239959){_0x3da3e4[_0xf67d('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x30bb3c){_0x3da3e4[_0xf67d('0x7')](_0xf67d('0x8'),_0x30bb3c[_0xf67d('0x9')](function(_0x33763d){return{'id':_0x33763d['id']};}));return FaxMessage[_0xf67d('0xa')]({'where':{'FaxInteractionId':_0x3da3e4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf67d('0xb')](function(_0x5c9beb){_0x3da3e4[_0xf67d('0x7')](_0xf67d('0xc'),_0x5c9beb[_0xf67d('0xd')]);FaxInteractionEvents[_0xf67d('0xe')](_0x19e2fb+':'+_0x3da3e4['id'],_0x3da3e4);FaxInteractionEvents[_0xf67d('0xe')](_0x19e2fb,_0x3da3e4);_0x239959(null);})[_0xf67d('0xf')](_0x239959(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xf67d('0x10')](e,emitEvent(event));}}module[_0xf67d('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x7970=['map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x2b49fc,_0x40cd4f){var _0x46a5f8=function(_0x18eb67){while(--_0x18eb67){_0x2b49fc['push'](_0x2b49fc['shift']());}};_0x46a5f8(++_0x40cd4f);}(_0x7970,0x1ed));var _0x0797=function(_0x2426cc,_0x1fd020){_0x2426cc=_0x2426cc-0x0;var _0x3bb2d1=_0x7970[_0x2426cc];return _0x3bb2d1;};'use strict';var EventEmitter=require(_0x0797('0x0'));var FaxInteraction=require(_0x0797('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x0797('0x1'))['db'][_0x0797('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0797('0x3')](0x0);var events={'afterCreate':_0x0797('0x4'),'afterUpdate':_0x0797('0x5'),'afterDestroy':_0x0797('0x6')};function emitEvent(_0x1a3834){return function(_0x38245b,_0x725172,_0x3889f2){_0x38245b[_0x0797('0x7')]({'attributes':['id'],'raw':!![]})[_0x0797('0x8')](function(_0x478d75){_0x38245b[_0x0797('0x9')](_0x0797('0xa'),_0x478d75[_0x0797('0xb')](function(_0x37bd3c){return{'id':_0x37bd3c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x38245b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0797('0x8')](function(_0x3c8a9f){_0x38245b[_0x0797('0x9')](_0x0797('0xc'),_0x3c8a9f[_0x0797('0xd')]);FaxInteractionEvents[_0x0797('0xe')](_0x1a3834+':'+_0x38245b['id'],_0x38245b);FaxInteractionEvents['emit'](_0x1a3834,_0x38245b);_0x3889f2(null);})[_0x0797('0xf')](_0x3889f2(null));};}for(var e in events){if(events[_0x0797('0x10')](e)){var event=events[e];FaxInteraction[_0x0797('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6294a3e..8765d88 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 _0xc337=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction'];(function(_0xad142b,_0x43aa90){var _0x2f8e8a=function(_0x31c786){while(--_0x31c786){_0xad142b['push'](_0xad142b['shift']());}};_0x2f8e8a(++_0x43aa90);}(_0xc337,0x150));var _0x7c33=function(_0x2a100a,_0x6ca0a6){_0x2a100a=_0x2a100a-0x0;var _0x57850f=_0xc337[_0x2a100a];return _0x57850f;};'use strict';var _=require(_0x7c33('0x0'));var util=require('util');var logger=require(_0x7c33('0x1'))('api');var moment=require(_0x7c33('0x2'));var BPromise=require(_0x7c33('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7c33('0x4'));var config=require(_0x7c33('0x5'));var attributes=require(_0x7c33('0x6'));module[_0x7c33('0x7')]=function(_0x275067,_0x5146b0){return _0x275067['define'](_0x7c33('0x8'),attributes,{'tableName':_0x7c33('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30bf3e,_0x5c95bf,_0x5ad445){if(_0x30bf3e[_0x7c33('0xa')](_0x7c33('0xb'))){_0x30bf3e[_0x7c33('0xc')]=moment()[_0x7c33('0xd')](_0x7c33('0xe'));}_0x5ad445(null,_0x30bf3e);}}});}; \ No newline at end of file +var _0x11d3=['moment','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x11d3,0x1ac));var _0x311d=function(_0x57c3a2,_0xf75938){_0x57c3a2=_0x57c3a2-0x0;var _0x5b572f=_0x11d3[_0x57c3a2];return _0x5b572f;};'use strict';var _=require(_0x311d('0x0'));var util=require(_0x311d('0x1'));var logger=require(_0x311d('0x2'))(_0x311d('0x3'));var moment=require(_0x311d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x311d('0x5'));var rimraf=require(_0x311d('0x6'));var config=require(_0x311d('0x7'));var attributes=require(_0x311d('0x8'));module[_0x311d('0x9')]=function(_0x4443f6,_0x1e93a0){return _0x4443f6[_0x311d('0xa')](_0x311d('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1917f5,_0x23fbb9,_0x4402c1){if(_0x1917f5[_0x311d('0xc')]('closed')){_0x1917f5[_0x311d('0xd')]=moment()[_0x311d('0xe')](_0x311d('0xf'));}_0x4402c1(null,_0x1917f5);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 14ef65e..8d1bf4d 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 _0x8c85=['client','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','AddTagsToFaxInteraction','find','then','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x8ae7f5,_0x55396e){var _0x19cd92=function(_0x14ff9e){while(--_0x14ff9e){_0x8ae7f5['push'](_0x8ae7f5['shift']());}};_0x19cd92(++_0x55396e);}(_0x8c85,0x13e));var _0x58c8=function(_0x17b6b5,_0x426a32){_0x17b6b5=_0x17b6b5-0x0;var _0x579061=_0x8c85[_0x17b6b5];return _0x579061;};'use strict';var _=require(_0x58c8('0x0'));var util=require(_0x58c8('0x1'));var moment=require(_0x58c8('0x2'));var BPromise=require(_0x58c8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58c8('0x4'));var db=require(_0x58c8('0x5'))['db'];var utils=require(_0x58c8('0x6'));var logger=require(_0x58c8('0x7'))(_0x58c8('0x8'));var config=require(_0x58c8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58c8('0xa')]['http']({'port':0x232a});config[_0x58c8('0xb')]=_[_0x58c8('0xc')](config[_0x58c8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x58c8('0xd'))(new Redis(config[_0x58c8('0xb')]));require(_0x58c8('0xe'))[_0x58c8('0xf')](socket);function respondWithRpcPromise(_0x207fec,_0x5e8a10,_0x3289ba){return new BPromise(function(_0x13e3df,_0xaead31){return client[_0x58c8('0x10')](_0x207fec,_0x3289ba)['then'](function(_0x4261d1){logger['info'](_0x58c8('0x11'),_0x5e8a10,'request\x20sent');logger[_0x58c8('0x12')](_0x58c8('0x13'),_0x5e8a10,_0x58c8('0x14'),JSON[_0x58c8('0x15')](_0x4261d1));if(_0x4261d1[_0x58c8('0x16')]){if(_0x4261d1[_0x58c8('0x16')][_0x58c8('0x17')]===0x1f4){logger[_0x58c8('0x16')](_0x58c8('0x11'),_0x5e8a10,_0x4261d1[_0x58c8('0x16')][_0x58c8('0x18')]);return _0xaead31(_0x4261d1['error'][_0x58c8('0x18')]);}logger['error'](_0x58c8('0x11'),_0x5e8a10,_0x4261d1[_0x58c8('0x16')]['message']);return _0x13e3df(_0x4261d1[_0x58c8('0x16')][_0x58c8('0x18')]);}else{logger[_0x58c8('0x19')](_0x58c8('0x11'),_0x5e8a10,'request\x20sent');_0x13e3df(_0x4261d1[_0x58c8('0x1a')]['message']);}})[_0x58c8('0x1b')](function(_0x304a7f){logger['error'](_0x58c8('0x11'),_0x5e8a10,_0x304a7f);_0xaead31(_0x304a7f);});});}exports[_0x58c8('0x1c')]=function(_0x340e7a){var _0x412eb6=this;return new Promise(function(_0x284e2a,_0x1414ba){return db[_0x58c8('0x1d')][_0x58c8('0x1e')](_0x340e7a[_0x58c8('0x1f')],{'raw':_0x340e7a['options']?_0x340e7a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x340e7a[_0x58c8('0x20')]?_0x340e7a['options'][_0x58c8('0x21')]||null:null,'attributes':_0x340e7a[_0x58c8('0x20')]?_0x340e7a['options'][_0x58c8('0x22')]||null:null,'limit':_0x340e7a['options']?_0x340e7a[_0x58c8('0x20')][_0x58c8('0x23')]||null:null})['then'](function(_0x44aa6d){logger[_0x58c8('0x19')]('UpdateFaxInteraction',_0x340e7a);logger['debug'](_0x58c8('0x1c'),_0x340e7a,JSON['stringify'](_0x44aa6d));_0x284e2a(_0x44aa6d);})[_0x58c8('0x1b')](function(_0x54cb1b){logger[_0x58c8('0x16')](_0x58c8('0x1c'),_0x54cb1b[_0x58c8('0x18')],_0x340e7a);_0x1414ba(_0x412eb6['error'](0x1f4,_0x54cb1b[_0x58c8('0x18')]));});});};exports[_0x58c8('0x24')]=function(_0x13a74b){return new Promise(function(_0x2a15a2,_0x2526e2){return db[_0x58c8('0x1d')][_0x58c8('0x25')]({'where':_0x13a74b[_0x58c8('0x20')]?_0x13a74b[_0x58c8('0x20')][_0x58c8('0x21')]||null:null})[_0x58c8('0x26')](function(_0x2ed044){if(_0x2ed044){return _0x2ed044['addTags'](_0x13a74b['body'][_0x58c8('0x27')],_['omit'](_0x13a74b[_0x58c8('0x1f')],['ids','id'])||{});}})['spread'](function(_0x4844d9){logger[_0x58c8('0x19')](_0x58c8('0x28'),_0x13a74b);logger['debug'](_0x58c8('0x28'),_0x13a74b,JSON[_0x58c8('0x15')](_0x4844d9));_0x2a15a2(_0x4844d9);})['catch'](function(_0x22b4e3){logger[_0x58c8('0x16')](_0x58c8('0x28'),_0x22b4e3[_0x58c8('0x18')],_0x13a74b);_0x2526e2(_this[_0x58c8('0x16')](0x1f4,_0x22b4e3[_0x58c8('0x18')]));});});}; \ No newline at end of file +var _0x97b9=['addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','info','AddTagsToFaxInteraction','find','where'];(function(_0x1b0c34,_0x5d82b4){var _0x3fd9d4=function(_0x99e499){while(--_0x99e499){_0x1b0c34['push'](_0x1b0c34['shift']());}};_0x3fd9d4(++_0x5d82b4);}(_0x97b9,0x83));var _0x997b=function(_0x4d9e82,_0x14aff1){_0x4d9e82=_0x4d9e82-0x0;var _0x139241=_0x97b9[_0x4d9e82];return _0x139241;};'use strict';var _=require(_0x997b('0x0'));var util=require(_0x997b('0x1'));var moment=require(_0x997b('0x2'));var BPromise=require(_0x997b('0x3'));var rs=require(_0x997b('0x4'));var fs=require('fs');var Redis=require(_0x997b('0x5'));var db=require(_0x997b('0x6'))['db'];var utils=require(_0x997b('0x7'));var logger=require('../../config/logger')(_0x997b('0x8'));var config=require(_0x997b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x997b('0xa')][_0x997b('0xb')]({'port':0x232a});config[_0x997b('0xc')]=_['defaults'](config[_0x997b('0xc')],{'host':_0x997b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x997b('0xc')]));require(_0x997b('0xe'))[_0x997b('0xf')](socket);function respondWithRpcPromise(_0x3ef195,_0x5e080d,_0x2e6dec){return new BPromise(function(_0x1dc4d1,_0x315c5b){return client[_0x997b('0x10')](_0x3ef195,_0x2e6dec)[_0x997b('0x11')](function(_0x1b67ec){logger['info'](_0x997b('0x12'),_0x5e080d,_0x997b('0x13'));logger[_0x997b('0x14')](_0x997b('0x15'),_0x5e080d,_0x997b('0x13'),JSON[_0x997b('0x16')](_0x1b67ec));if(_0x1b67ec[_0x997b('0x17')]){if(_0x1b67ec['error'][_0x997b('0x18')]===0x1f4){logger['error'](_0x997b('0x12'),_0x5e080d,_0x1b67ec[_0x997b('0x17')][_0x997b('0x19')]);return _0x315c5b(_0x1b67ec['error'][_0x997b('0x19')]);}logger[_0x997b('0x17')](_0x997b('0x12'),_0x5e080d,_0x1b67ec[_0x997b('0x17')][_0x997b('0x19')]);return _0x1dc4d1(_0x1b67ec[_0x997b('0x17')]['message']);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5e080d,'request\x20sent');_0x1dc4d1(_0x1b67ec['result'][_0x997b('0x19')]);}})[_0x997b('0x1a')](function(_0x5aca97){logger['error'](_0x997b('0x12'),_0x5e080d,_0x5aca97);_0x315c5b(_0x5aca97);});});}exports[_0x997b('0x1b')]=function(_0x580c59){var _0x38fa13=this;return new Promise(function(_0x389556,_0x44356a){return db[_0x997b('0x1c')][_0x997b('0x1d')](_0x580c59['body'],{'raw':_0x580c59[_0x997b('0x1e')]?_0x580c59[_0x997b('0x1e')][_0x997b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x580c59[_0x997b('0x1e')]?_0x580c59[_0x997b('0x1e')]['where']||null:null,'attributes':_0x580c59[_0x997b('0x1e')]?_0x580c59['options'][_0x997b('0x20')]||null:null,'limit':_0x580c59[_0x997b('0x1e')]?_0x580c59[_0x997b('0x1e')]['limit']||null:null})[_0x997b('0x11')](function(_0x169aff){logger[_0x997b('0x21')](_0x997b('0x1b'),_0x580c59);logger['debug'](_0x997b('0x1b'),_0x580c59,JSON[_0x997b('0x16')](_0x169aff));_0x389556(_0x169aff);})[_0x997b('0x1a')](function(_0x5554dc){logger['error'](_0x997b('0x1b'),_0x5554dc[_0x997b('0x19')],_0x580c59);_0x44356a(_0x38fa13[_0x997b('0x17')](0x1f4,_0x5554dc['message']));});});};exports[_0x997b('0x22')]=function(_0x41e377){return new Promise(function(_0x25a104,_0x23a88a){return db[_0x997b('0x1c')][_0x997b('0x23')]({'where':_0x41e377[_0x997b('0x1e')]?_0x41e377[_0x997b('0x1e')][_0x997b('0x24')]||null:null})[_0x997b('0x11')](function(_0x8e18d8){if(_0x8e18d8){return _0x8e18d8[_0x997b('0x25')](_0x41e377[_0x997b('0x26')][_0x997b('0x27')],_[_0x997b('0x28')](_0x41e377['body'],[_0x997b('0x27'),'id'])||{});}})['spread'](function(_0x32cc03){logger['info'](_0x997b('0x29'),_0x41e377);logger[_0x997b('0x14')](_0x997b('0x29'),_0x41e377,JSON[_0x997b('0x16')](_0x32cc03));_0x25a104(_0x32cc03);})[_0x997b('0x1a')](function(_0x508b08){logger[_0x997b('0x17')]('AddTags',_0x508b08['message'],_0x41e377);_0x23a88a(_this[_0x997b('0x17')](0x1f4,_0x508b08[_0x997b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3c33965..26db7f2 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 _0x0fdf=['update','emit','removeListener','register','length','./faxInteraction.events','save','remove'];(function(_0x312205,_0x540acb){var _0x1805bc=function(_0xe86b59){while(--_0xe86b59){_0x312205['push'](_0x312205['shift']());}};_0x1805bc(++_0x540acb);}(_0x0fdf,0x1ed));var _0xf0fd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0fdf[_0x321bb2];return _0x9c12ed;};'use strict';var FaxInteractionEvents=require(_0xf0fd('0x0'));var events=[_0xf0fd('0x1'),_0xf0fd('0x2'),_0xf0fd('0x3')];function createListener(_0xb70ce9,_0x1ea0b8){return function(_0x41a1ae){_0x1ea0b8[_0xf0fd('0x4')](_0xb70ce9,_0x41a1ae);};}function removeListener(_0x925227,_0x4ec3ba){return function(){FaxInteractionEvents[_0xf0fd('0x5')](_0x925227,_0x4ec3ba);};}exports[_0xf0fd('0x6')]=function(_0x3e0fcd){for(var _0x5a7f1b=0x0,_0x583ca6=events[_0xf0fd('0x7')];_0x5a7f1b<_0x583ca6;_0x5a7f1b++){var _0x888ccc=events[_0x5a7f1b];var _0x1a7c08=createListener('faxInteraction:'+_0x888ccc,_0x3e0fcd);FaxInteractionEvents['on'](_0x888ccc,_0x1a7c08);}}; \ No newline at end of file +var _0x9c20=['save','update','emit','register','length','./faxInteraction.events'];(function(_0x4ec474,_0x427476){var _0x59dad0=function(_0x373cc3){while(--_0x373cc3){_0x4ec474['push'](_0x4ec474['shift']());}};_0x59dad0(++_0x427476);}(_0x9c20,0xa7));var _0x09c2=function(_0x7cb764,_0x417900){_0x7cb764=_0x7cb764-0x0;var _0x37714b=_0x9c20[_0x7cb764];return _0x37714b;};'use strict';var FaxInteractionEvents=require(_0x09c2('0x0'));var events=[_0x09c2('0x1'),'remove',_0x09c2('0x2')];function createListener(_0x5c4da7,_0x215b94){return function(_0xf6a3c5){_0x215b94[_0x09c2('0x3')](_0x5c4da7,_0xf6a3c5);};}function removeListener(_0x22b23c,_0xead51c){return function(){FaxInteractionEvents['removeListener'](_0x22b23c,_0xead51c);};}exports[_0x09c2('0x4')]=function(_0x464402){for(var _0x24869c=0x0,_0x45ad5b=events[_0x09c2('0x5')];_0x24869c<_0x45ad5b;_0x24869c++){var _0x12fa2b=events[_0x24869c];var _0x1e32d5=createListener('faxInteraction:'+_0x12fa2b,_0x464402);FaxInteractionEvents['on'](_0x12fa2b,_0x1e32d5);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 42d48e6..6259377 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 _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(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xf186,0xea));var _0x6f18=function(_0x39e6f9,_0x155795){_0x39e6f9=_0x39e6f9-0x0;var _0x31a2f4=_0xf186[_0x39e6f9];return _0x31a2f4;};'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 +var _0xa2d7=['put','/:id','fax','update','delete','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','addTags'];(function(_0x1834d3,_0xba4f88){var _0x4b049a=function(_0x3c0cc7){while(--_0x3c0cc7){_0x1834d3['push'](_0x1834d3['shift']());}};_0x4b049a(++_0xba4f88);}(_0xa2d7,0x1ba));var _0x7a2d=function(_0x3000b5,_0x327998){_0x3000b5=_0x3000b5-0x0;var _0x506e3b=_0xa2d7[_0x3000b5];return _0x506e3b;};'use strict';var multer=require(_0x7a2d('0x0'));var util=require(_0x7a2d('0x1'));var path=require(_0x7a2d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7a2d('0x3')]();var fs_extra=require(_0x7a2d('0x4'));var auth=require(_0x7a2d('0x5'));var interaction=require(_0x7a2d('0x6'));var config=require('../../config/environment');var controller=require(_0x7a2d('0x7'));router[_0x7a2d('0x8')]('/',auth[_0x7a2d('0x9')](),controller[_0x7a2d('0xa')]);router['get'](_0x7a2d('0xb'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7a2d('0x8')](_0x7a2d('0xd'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0xe')]);router[_0x7a2d('0x8')](_0x7a2d('0xf'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0x10')]);router[_0x7a2d('0x11')]('/',auth[_0x7a2d('0x9')](),controller['create']);router[_0x7a2d('0x11')](_0x7a2d('0xd'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0x12')]);router[_0x7a2d('0x11')](_0x7a2d('0x13'),auth[_0x7a2d('0x9')](),interaction[_0x7a2d('0x14')]('fax','faxinteraction:addtags'),controller[_0x7a2d('0x15')]);router[_0x7a2d('0x16')](_0x7a2d('0x17'),auth[_0x7a2d('0x9')](),interaction[_0x7a2d('0x14')](_0x7a2d('0x18'),'faxinteraction:update'),controller[_0x7a2d('0x19')]);router[_0x7a2d('0x1a')](_0x7a2d('0x17'),auth[_0x7a2d('0x9')](),interaction[_0x7a2d('0x14')](_0x7a2d('0x18'),'faxinteraction:destroy'),controller['destroy']);router[_0x7a2d('0x1a')](_0x7a2d('0x13'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0x1b')]);module[_0x7a2d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 2410daa..4b80dfc 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 _0xb2b3=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0xb2b3,0x71));var _0x3b2b=function(_0x3c6654,_0x396840){_0x3c6654=_0x3c6654-0x0;var _0x1357f7=_0xb2b3[_0x3c6654];return _0x1357f7;};'use strict';var Sequelize=require(_0x3b2b('0x0'));module[_0x3b2b('0x1')]={'body':{'type':Sequelize[_0x3b2b('0x2')](_0x3b2b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3b2b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3b2b('0x5')]('in',_0x3b2b('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x3b2b('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x3b2b('0x7')]}}; \ No newline at end of file +var _0x180f=['medium','BOOLEAN','out','TEXT','DATE','sequelize','exports'];(function(_0x3be7e9,_0x2393da){var _0x45497c=function(_0x1c952f){while(--_0x1c952f){_0x3be7e9['push'](_0x3be7e9['shift']());}};_0x45497c(++_0x2393da);}(_0x180f,0xf3));var _0xf180=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0x180f[_0x4a04de];return _0xbbe018;};'use strict';var Sequelize=require(_0xf180('0x0'));module[_0xf180('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf180('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf180('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf180('0x4')),'defaultValue':_0xf180('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf180('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf180('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 2a9c2c2..89d5426 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 _0x10ad=['find','body','describe','../../config/logger','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','reject','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','User','EventManager','rejectmessage','create','CmContact','fax','findOne','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','Attachment','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','save','update','destroy','then','stack','name','send','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','show','params','intersection','includeAll'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0x10ad,0x160));var _0xd10a=function(_0xeee344,_0x291948){_0xeee344=_0xeee344-0x0;var _0x2ad583=_0x10ad[_0xeee344];return _0x2ad583;};'use strict';var emlformat=require(_0xd10a('0x0'));var rimraf=require(_0xd10a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd10a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd10a('0x3'));var Mustache=require(_0xd10a('0x4'));var util=require(_0xd10a('0x5'));var path=require(_0xd10a('0x6'));var sox=require('sox');var csv=require(_0xd10a('0x7'));var ejs=require(_0xd10a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd10a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd10a('0xa'));var deskjs=require(_0xd10a('0xb'));var toCsv=require(_0xd10a('0x7'));var querystring=require(_0xd10a('0xc'));var Papa=require(_0xd10a('0xd'));var Redis=require(_0xd10a('0xe'));var authService=require(_0xd10a('0xf'));var qs=require(_0xd10a('0x10'));var as=require(_0xd10a('0x11'));var hardwareService=require(_0xd10a('0x12'));var logger=require('../../config/logger')(_0xd10a('0x13'));var utils=require(_0xd10a('0x14'));var config=require(_0xd10a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd10a('0x16'))['db'];config[_0xd10a('0x17')]=_[_0xd10a('0x18')](config['redis'],{'host':_0xd10a('0x19'),'port':0x18eb});var socket=require(_0xd10a('0x1a'))(new Redis(config[_0xd10a('0x17')]));require(_0xd10a('0x1b'))[_0xd10a('0x1c')](socket);var jayson=require(_0xd10a('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xd10a('0x1e')][_0xd10a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x139b37,_0x1ee8fa,_0x44e9f3,_0x215943){return new BPromise(function(_0x58d2f6,_0x59940a){var _0xca7476=_0x215943||client;return _0xca7476['request'](_0x139b37,_0x44e9f3)['then'](function(_0x499e28){logger[_0xd10a('0x20')](_0xd10a('0x21'),_0x1ee8fa,_0xd10a('0x22'));logger['debug'](_0xd10a('0x23'),_0x1ee8fa,'request\x20sent',JSON[_0xd10a('0x24')](_0x499e28));if(_0x499e28[_0xd10a('0x25')]){if(_0x499e28[_0xd10a('0x25')]['code']===0x1f4){logger[_0xd10a('0x25')](_0xd10a('0x21'),_0x1ee8fa,_0x499e28[_0xd10a('0x25')]['message']);return _0x59940a(_0x499e28[_0xd10a('0x25')][_0xd10a('0x26')]);}logger[_0xd10a('0x25')](_0xd10a('0x21'),_0x1ee8fa,_0x499e28[_0xd10a('0x25')][_0xd10a('0x26')]);return _0x58d2f6(_0x499e28['error']['message']);}else{logger[_0xd10a('0x20')]('FaxMessage,\x20%s,\x20%s',_0x1ee8fa,_0xd10a('0x22'));_0x58d2f6(_0x499e28[_0xd10a('0x27')][_0xd10a('0x26')]);}})[_0xd10a('0x28')](function(_0x3ab8ea){logger[_0xd10a('0x25')]('FaxMessage,\x20%s,\x20%s',_0x1ee8fa,_0x3ab8ea);_0x59940a(_0x3ab8ea);});});}function respondWithStatusCode(_0x512c2a,_0x5b2598){_0x5b2598=_0x5b2598||0xcc;return function(_0x2a0e71){if(_0x2a0e71){return _0x512c2a[_0xd10a('0x29')](_0x5b2598);}return _0x512c2a['status'](_0x5b2598)[_0xd10a('0x2a')]();};}function respondWithResult(_0x2b4499,_0x1a89a5){_0x1a89a5=_0x1a89a5||0xc8;return function(_0x23d2e6){if(_0x23d2e6){return _0x2b4499[_0xd10a('0x2b')](_0x1a89a5)['json'](_0x23d2e6);}};}function respondWithFilteredResult(_0x541ec6,_0x28858d){return function(_0x3aebf3){if(_0x3aebf3){var _0x3f3d67=typeof _0x28858d[_0xd10a('0x2c')]===_0xd10a('0x2d')&&typeof _0x28858d[_0xd10a('0x2e')]==='undefined';var _0x56b863=_0x3aebf3[_0xd10a('0x2f')];var _0x8c52cd=_0x3f3d67?0x0:_0x28858d['offset'];var _0x39dcd0=_0x3f3d67?_0x3aebf3[_0xd10a('0x2f')]:_0x28858d[_0xd10a('0x2c')]+_0x28858d[_0xd10a('0x2e')];var _0x2f28c0;if(_0x39dcd0>=_0x56b863){_0x39dcd0=_0x56b863;_0x2f28c0=0xc8;}else{_0x2f28c0=0xce;}_0x541ec6['status'](_0x2f28c0);return _0x541ec6['set'](_0xd10a('0x30'),_0x8c52cd+'-'+_0x39dcd0+'/'+_0x56b863)[_0xd10a('0x31')](_0x3aebf3);}return null;};}function patchUpdates(_0x32dfac){return function(_0x20b9ad){try{jsonpatch['apply'](_0x20b9ad,_0x32dfac,!![]);}catch(_0x1231be){return BPromise['reject'](_0x1231be);}return _0x20b9ad[_0xd10a('0x32')]();};}function saveUpdates(_0x11ed89,_0xbd2f1c){return function(_0x57951c){if(_0x57951c){return _0x57951c[_0xd10a('0x33')](_0x11ed89)['then'](function(_0x3a0687){return _0x3a0687;});}return null;};}function removeEntity(_0x317216,_0x357516){return function(_0x392a4e){if(_0x392a4e){return _0x392a4e[_0xd10a('0x34')]()[_0xd10a('0x35')](function(){_0x317216['status'](0xcc)[_0xd10a('0x2a')]();});}};}function handleEntityNotFound(_0x4353c5,_0x232e6a){return function(_0x49b143){if(!_0x49b143){_0x4353c5[_0xd10a('0x29')](0x194);}return _0x49b143;};}function handleError(_0x37f8a5,_0x5f3b63){_0x5f3b63=_0x5f3b63||0x1f4;return function(_0x497516){logger['error'](_0x497516[_0xd10a('0x36')]);if(_0x497516['name']){delete _0x497516[_0xd10a('0x37')];}_0x37f8a5[_0xd10a('0x2b')](_0x5f3b63)[_0xd10a('0x38')](_0x497516);};}exports['index']=function(_0x16f801,_0x2debec){var _0x3b68f8={},_0x559864={},_0x12c250={'count':0x0,'rows':[]};var _0x22f674=_[_0xd10a('0x39')](db[_0xd10a('0x3a')][_0xd10a('0x3b')],function(_0x1821b4){return{'name':_0x1821b4[_0xd10a('0x3c')],'type':_0x1821b4[_0xd10a('0x3d')][_0xd10a('0x3e')]};});_0x559864['model']=_[_0xd10a('0x39')](_0x22f674,_0xd10a('0x37'));_0x559864[_0xd10a('0x3f')]=_[_0xd10a('0x40')](_0x16f801[_0xd10a('0x3f')]);_0x559864[_0xd10a('0x41')]=_['intersection'](_0x559864[_0xd10a('0x42')],_0x559864[_0xd10a('0x3f')]);_0x3b68f8[_0xd10a('0x43')]=_['intersection'](_0x559864[_0xd10a('0x42')],qs[_0xd10a('0x44')](_0x16f801[_0xd10a('0x3f')][_0xd10a('0x44')]));_0x3b68f8[_0xd10a('0x43')]=_0x3b68f8['attributes'][_0xd10a('0x45')]?_0x3b68f8[_0xd10a('0x43')]:_0x559864[_0xd10a('0x42')];if(!_0x16f801[_0xd10a('0x3f')][_0xd10a('0x46')](_0xd10a('0x47'))){_0x3b68f8[_0xd10a('0x2e')]=qs['limit'](_0x16f801['query'][_0xd10a('0x2e')]);_0x3b68f8[_0xd10a('0x2c')]=qs['offset'](_0x16f801[_0xd10a('0x3f')]['offset']);}_0x3b68f8[_0xd10a('0x48')]=qs[_0xd10a('0x49')](_0x16f801['query'][_0xd10a('0x49')]);_0x3b68f8[_0xd10a('0x4a')]=qs[_0xd10a('0x41')](_[_0xd10a('0x4b')](_0x16f801['query'],_0x559864['filters']),_0x22f674);if(_0x16f801[_0xd10a('0x3f')]['filter']){_0x3b68f8['where']=_[_0xd10a('0x4c')](_0x3b68f8['where'],{'$or':_['map'](_0x22f674,function(_0x1e4f41){if(_0x1e4f41[_0xd10a('0x3d')]!==_0xd10a('0x4d')){var _0x20a487={};_0x20a487[_0x1e4f41[_0xd10a('0x37')]]={'$like':'%'+_0x16f801[_0xd10a('0x3f')][_0xd10a('0x4e')]+'%'};return _0x20a487;}})});}_0x3b68f8=_[_0xd10a('0x4c')]({},_0x3b68f8,_0x16f801[_0xd10a('0x4f')]);var _0x3e2c34={'where':_0x3b68f8[_0xd10a('0x4a')]};return db['FaxMessage'][_0xd10a('0x2f')](_0x3e2c34)[_0xd10a('0x35')](function(_0x1a5d4f){_0x12c250[_0xd10a('0x2f')]=_0x1a5d4f;if(_0x16f801[_0xd10a('0x3f')]['includeAll']){_0x3b68f8[_0xd10a('0x50')]=[{'all':!![]}];}return db['FaxMessage'][_0xd10a('0x51')](_0x3b68f8);})[_0xd10a('0x35')](function(_0x511195){_0x12c250['rows']=_0x511195;return _0x12c250;})[_0xd10a('0x35')](respondWithFilteredResult(_0x2debec,_0x3b68f8))[_0xd10a('0x28')](handleError(_0x2debec,null));};exports[_0xd10a('0x52')]=function(_0x3c2614,_0x4ee89a){var _0x27f9b3={'raw':!![],'where':{'id':_0x3c2614[_0xd10a('0x53')]['id']}},_0x1bb823={};_0x1bb823[_0xd10a('0x42')]=_[_0xd10a('0x40')](db[_0xd10a('0x3a')][_0xd10a('0x3b')]);_0x1bb823[_0xd10a('0x3f')]=_[_0xd10a('0x40')](_0x3c2614['query']);_0x1bb823['filters']=_[_0xd10a('0x54')](_0x1bb823[_0xd10a('0x42')],_0x1bb823[_0xd10a('0x3f')]);_0x27f9b3[_0xd10a('0x43')]=_[_0xd10a('0x54')](_0x1bb823[_0xd10a('0x42')],qs[_0xd10a('0x44')](_0x3c2614[_0xd10a('0x3f')][_0xd10a('0x44')]));_0x27f9b3[_0xd10a('0x43')]=_0x27f9b3['attributes'][_0xd10a('0x45')]?_0x27f9b3[_0xd10a('0x43')]:_0x1bb823[_0xd10a('0x42')];if(_0x3c2614[_0xd10a('0x3f')][_0xd10a('0x55')]){_0x27f9b3['include']=[{'all':!![]}];}_0x27f9b3=_[_0xd10a('0x4c')]({},_0x27f9b3,_0x3c2614['options']);return db[_0xd10a('0x3a')][_0xd10a('0x56')](_0x27f9b3)['then'](handleEntityNotFound(_0x4ee89a,null))[_0xd10a('0x35')](respondWithResult(_0x4ee89a,null))[_0xd10a('0x28')](handleError(_0x4ee89a,null));};exports[_0xd10a('0x33')]=function(_0x4e0f12,_0x2d8aa3){if(_0x4e0f12['body']['id']){delete _0x4e0f12[_0xd10a('0x57')]['id'];}return db[_0xd10a('0x3a')][_0xd10a('0x56')]({'where':{'id':_0x4e0f12[_0xd10a('0x53')]['id']}})[_0xd10a('0x35')](handleEntityNotFound(_0x2d8aa3,null))[_0xd10a('0x35')](saveUpdates(_0x4e0f12['body'],null))[_0xd10a('0x35')](respondWithResult(_0x2d8aa3,null))[_0xd10a('0x28')](handleError(_0x2d8aa3,null));};exports['destroy']=function(_0x37a16e,_0x193595){return db[_0xd10a('0x3a')][_0xd10a('0x56')]({'where':{'id':_0x37a16e[_0xd10a('0x53')]['id']}})[_0xd10a('0x35')](handleEntityNotFound(_0x193595,null))[_0xd10a('0x35')](removeEntity(_0x193595,null))[_0xd10a('0x28')](handleError(_0x193595,null));};exports['describe']=function(_0x485083,_0x11aa74){return db[_0xd10a('0x3a')][_0xd10a('0x58')]()[_0xd10a('0x35')](respondWithResult(_0x11aa74,null))['catch'](handleError(_0x11aa74,null));};var interaction_log=require(_0xd10a('0x59'))(_0xd10a('0x5a'));exports[_0xd10a('0x5b')]=function(_0x193f3d,_0x135355,_0x4073a0){var _0x1f877b={'agent':{},'channel':'fax'};if(_0x193f3d[_0xd10a('0x57')]['id']){delete _0x193f3d[_0xd10a('0x57')]['id'];}_0x193f3d[_0xd10a('0x57')][_0xd10a('0x5c')]=!![];_0x193f3d[_0xd10a('0x57')][_0xd10a('0x5d')]=moment()[_0xd10a('0x5e')](_0xd10a('0x5f'));_0x193f3d[_0xd10a('0x57')][_0xd10a('0x60')]=_0x193f3d[_0xd10a('0x57')][_0xd10a('0x60')]||_0x193f3d[_0xd10a('0x61')]['id'];_0x1f877b[_0xd10a('0x62')]['id']=_0x193f3d['body'][_0xd10a('0x60')];return db[_0xd10a('0x3a')]['find']({'where':{'id':_0x193f3d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x135355,null))[_0xd10a('0x35')](saveUpdates(_0x193f3d[_0xd10a('0x57')],null))[_0xd10a('0x35')](function(_0x48f362){if(_0x48f362){_0x1f877b[_0xd10a('0x26')]=_0x48f362[_0xd10a('0x63')]({'plain':!![]});return db[_0xd10a('0x64')][_0xd10a('0x56')]({'where':{'id':_0x48f362[_0xd10a('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x135355,null))[_0xd10a('0x35')](function(_0x5901ed){if(_0x5901ed){return _0x5901ed[_0xd10a('0x33')]({'UserId':_0x193f3d[_0xd10a('0x57')][_0xd10a('0x60')],'read1stAt':_['isNil'](_0x5901ed[_0xd10a('0x66')])?moment()[_0xd10a('0x5e')](_0xd10a('0x5f')):undefined});}return null;})[_0xd10a('0x35')](function(_0x4fa265){if(_0x4fa265){_0x1f877b['interaction']=_0x4fa265[_0xd10a('0x63')]({'plain':!![]});interaction_log[_0xd10a('0x20')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x193f3d[_0xd10a('0x61')]['id'],_0x193f3d['user']['name'],_0x193f3d[_0xd10a('0x61')]['role'],_0x1f877b['interaction']['id'],_0x193f3d[_0xd10a('0x57')]?JSON[_0xd10a('0x24')](_0x193f3d[_0xd10a('0x57')]):_0xd10a('0x67'));return respondWithRpcPromise(_0xd10a('0x68'),'acceptMessage',_0x1f877b);}return null;})[_0xd10a('0x35')](function(_0x22008f){var _0x53c820=_0xd10a('0x69')+_0x22008f[_0xd10a('0x26')][_0xd10a('0x6a')];return db['sequelize']['query'](_0x53c820,{'type':db[_0xd10a('0x6b')]['QueryTypes'][_0xd10a('0x6c')],'raw':!![]})[_0xd10a('0x35')](function(_0x304667){return _0x304667;});})['then'](function(_0x39531f){if(_0x39531f){_0x1f877b[_0xd10a('0x26')][_0xd10a('0x6d')]=_0x39531f[0x0];if(!_0x193f3d['body'][_0xd10a('0x60')])return;return db['User'][_0xd10a('0x56')]({'where':{'id':_0x193f3d['body'][_0xd10a('0x60')],'role':_0xd10a('0x62')},'attributes':['id',_0xd10a('0x37'),_0xd10a('0x6e'),_0xd10a('0x6f'),_0xd10a('0x70')],'raw':!![]});}return null;})['then'](function(_0x1e87af){if(!_0x1e87af)return null;_0x1f877b[_0xd10a('0x26')]['agent']=_0x1e87af;return _0x1f877b;})['then'](function(_0x2fd5c5){if(_0x2fd5c5){if(_0x193f3d['body'][_0xd10a('0x71')]){_0x1f877b[_0xd10a('0x26')][_0xd10a('0x72')]=util[_0xd10a('0x5e')](_0xd10a('0x73'),_0x193f3d[_0xd10a('0x61')][_0xd10a('0x37')]);_0x1f877b[_0xd10a('0x26')][_0xd10a('0x74')]=_0x1f877b[_0xd10a('0x74')];_0x1f877b[_0xd10a('0x26')][_0xd10a('0x75')]=_0x1f877b[_0xd10a('0x74')];_0x1f877b[_0xd10a('0x26')][_0xd10a('0x76')]=_0xd10a('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xd10a('0x77'),'message':_0x1f877b[_0xd10a('0x26')]},client9002)[_0xd10a('0x35')](function(){return _0x1f877b;});}return _0x1f877b;}return null;})[_0xd10a('0x35')](respondWithResult(_0x135355,null))[_0xd10a('0x28')](handleError(_0x135355,null));};var interaction_log=require(_0xd10a('0x59'))('fax-interactions');exports[_0xd10a('0x78')]=function(_0x5b34c1,_0xbb384c,_0x4f2bdf){var _0x22441f={'agent':{},'channel':'fax'};if(_0x5b34c1[_0xd10a('0x57')]['id']){delete _0x5b34c1[_0xd10a('0x57')]['id'];}_0x5b34c1[_0xd10a('0x57')][_0xd10a('0x60')]=_0x5b34c1[_0xd10a('0x57')][_0xd10a('0x60')]||_0x5b34c1['user']['id'];_0x22441f['agent']['id']=_0x5b34c1['body'][_0xd10a('0x60')];return db['FaxMessage'][_0xd10a('0x56')]({'where':{'id':_0x5b34c1[_0xd10a('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xbb384c,null))['then'](function(_0x381a8d){if(_0x381a8d){_0x22441f[_0xd10a('0x26')]=_0x381a8d[_0xd10a('0x63')]({'plain':!![]});return db['FaxInteraction'][_0xd10a('0x56')]({'where':{'id':_0x381a8d[_0xd10a('0x65')]}});}return null;})[_0xd10a('0x35')](handleEntityNotFound(_0xbb384c,null))['then'](function(_0x2d6eea){if(_0x2d6eea){_0x22441f[_0xd10a('0x79')]=_0x2d6eea['get']({'plain':!![]});interaction_log[_0xd10a('0x20')](_0xd10a('0x7a'),_0x5b34c1[_0xd10a('0x61')]['id'],_0x5b34c1[_0xd10a('0x61')][_0xd10a('0x37')],_0x5b34c1[_0xd10a('0x61')][_0xd10a('0x7b')],_0x22441f[_0xd10a('0x79')]['id'],_0x5b34c1['body']?JSON[_0xd10a('0x24')](_0x5b34c1[_0xd10a('0x57')]):_0xd10a('0x67'));return respondWithRpcPromise(_0xd10a('0x7c'),_0xd10a('0x7d'),_0x22441f);}return null;})[_0xd10a('0x35')](function(_0x5e1b15){var _0x1958a6=_0xd10a('0x69')+_0x5e1b15[_0xd10a('0x26')][_0xd10a('0x6a')];return db[_0xd10a('0x7e')]['query'](_0x1958a6,{'type':db['Sequelize']['QueryTypes'][_0xd10a('0x6c')],'raw':!![]})[_0xd10a('0x35')](function(_0x14c954){return _0x14c954;});})[_0xd10a('0x35')](function(_0x21b2b4){if(_0x21b2b4){_0x22441f[_0xd10a('0x26')][_0xd10a('0x6d')]=_0x21b2b4[0x0];if(!_0x5b34c1['body'][_0xd10a('0x60')])return;return db[_0xd10a('0x7f')][_0xd10a('0x56')]({'where':{'id':_0x5b34c1['body'][_0xd10a('0x60')],'role':_0xd10a('0x62')},'attributes':['id',_0xd10a('0x37'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x57e6fc){if(!_0x57e6fc)return null;_0x22441f['message']['agent']=_0x57e6fc;return _0x22441f;})[_0xd10a('0x35')](function(_0x14122c){if(_0x14122c){_0x14122c['message'][_0xd10a('0x72')]=util[_0xd10a('0x5e')]('SIP/%s',_0x5b34c1[_0xd10a('0x61')][_0xd10a('0x37')]);_0x14122c[_0xd10a('0x26')][_0xd10a('0x74')]=_0x22441f[_0xd10a('0x74')];_0x14122c['message']['motionChannel']=_0x22441f['channel'];_0x14122c['message'][_0xd10a('0x76')]='reject';respondWithRpcPromise('EventManager',_0xd10a('0x80'),{'event':_0xd10a('0x81'),'message':_0x14122c[_0xd10a('0x26')]},client9002);return _0x22441f;}return null;})[_0xd10a('0x35')](respondWithResult(_0xbb384c,null))[_0xd10a('0x28')](handleError(_0xbb384c,null));};exports[_0xd10a('0x82')]=function(_0x200c9c,_0xb4a10){var _0x593d4b;return db['FaxMessage'][_0xd10a('0x82')](_0x200c9c[_0xd10a('0x57')],{})[_0xd10a('0x35')](function(_0x5e7803){_0x593d4b=_0x5e7803;return db[_0xd10a('0x83')]['findOne']({'where':{'id':_0x593d4b[_0xd10a('0x6a')]}});})[_0xd10a('0x35')](function(_0x2d3631){if(_['isNil'](_0x2d3631)){return;}else{_0x593d4b[_0xd10a('0x84')]=_0x2d3631[_0xd10a('0x84')];return db['Attachment'][_0xd10a('0x85')]({'where':{'id':_0x593d4b[_0xd10a('0x86')]}});}})[_0xd10a('0x35')](function(_0x163775){return respondWithRpcPromise(_0xd10a('0x87'),_0xd10a('0x87'),{'FaxAccountId':_[_0xd10a('0x88')](_0x200c9c[_0xd10a('0x57')])?undefined:_0x200c9c[_0xd10a('0x57')][_0xd10a('0x89')],'path':_[_0xd10a('0x88')](_0x163775)?undefined:util[_0xd10a('0x5e')](_0xd10a('0x8a'),_0x163775[_0xd10a('0x8b')]),'fax':_[_0xd10a('0x88')](_0x593d4b[_0xd10a('0x84')])?undefined:_0x593d4b[_0xd10a('0x84')],'AttachmentId':_0x593d4b['AttachmentId']},client9002);})[_0xd10a('0x35')](respondWithResult(_0xb4a10,0xc9))['catch'](handleError(_0xb4a10,null));};exports[_0xd10a('0x8c')]=function(_0x13a001,_0x67f3f7){var _0x374224=path[_0xd10a('0x8d')](config[_0xd10a('0x8e')],_0xd10a('0x8f'),'files',_0xd10a('0x90'));return db[_0xd10a('0x3a')][_0xd10a('0x56')]({'where':{'id':_0x13a001[_0xd10a('0x53')]['id']},'include':[{'model':db[_0xd10a('0x91')],'as':_0xd10a('0x91')}]})['then'](handleEntityNotFound(_0x67f3f7,null))['then'](function(_0x5c2c35){if(_0x5c2c35){return _0x67f3f7[_0xd10a('0x8c')](path[_0xd10a('0x8d')](_0x374224,_0x5c2c35[_0xd10a('0x91')][_0xd10a('0x8b')]));}})['catch'](handleError(_0x67f3f7,null));}; \ No newline at end of file +var _0x25d4=['localhost','socket.io-emitter','./faxMessage.socket','register','http','client','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','agent','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','contact','create','CmContact','findOne','isNil','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','join','root','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x25d4,0x19c));var _0x425d=function(_0x462267,_0x53f1bf){_0x462267=_0x462267-0x0;var _0x2252bf=_0x25d4[_0x462267];return _0x2252bf;};'use strict';var emlformat=require(_0x425d('0x0'));var rimraf=require(_0x425d('0x1'));var zipdir=require(_0x425d('0x2'));var jsonpatch=require(_0x425d('0x3'));var rp=require(_0x425d('0x4'));var moment=require(_0x425d('0x5'));var BPromise=require(_0x425d('0x6'));var Mustache=require('mustache');var util=require(_0x425d('0x7'));var path=require(_0x425d('0x8'));var sox=require(_0x425d('0x9'));var csv=require('to-csv');var ejs=require(_0x425d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x425d('0xb'));var squel=require('squel');var crypto=require(_0x425d('0xc'));var jsforce=require(_0x425d('0xd'));var deskjs=require(_0x425d('0xe'));var toCsv=require(_0x425d('0xf'));var querystring=require(_0x425d('0x10'));var Papa=require(_0x425d('0x11'));var Redis=require('ioredis');var authService=require(_0x425d('0x12'));var qs=require(_0x425d('0x13'));var as=require(_0x425d('0x14'));var hardwareService=require(_0x425d('0x15'));var logger=require(_0x425d('0x16'))(_0x425d('0x17'));var utils=require(_0x425d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x425d('0x19'));var db=require(_0x425d('0x1a'))['db'];config[_0x425d('0x1b')]=_[_0x425d('0x1c')](config[_0x425d('0x1b')],{'host':_0x425d('0x1d'),'port':0x18eb});var socket=require(_0x425d('0x1e'))(new Redis(config[_0x425d('0x1b')]));require(_0x425d('0x1f'))[_0x425d('0x20')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x425d('0x21')]({'port':0x232c});var client9002=jayson[_0x425d('0x22')][_0x425d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x19cde0,_0x2a9e8f,_0x39811c,_0x34e3a7){return new BPromise(function(_0xb2e907,_0xf8da0b){var _0x178e91=_0x34e3a7||client;return _0x178e91[_0x425d('0x23')](_0x19cde0,_0x39811c)[_0x425d('0x24')](function(_0x14c6cc){logger['info'](_0x425d('0x25'),_0x2a9e8f,_0x425d('0x26'));logger['debug'](_0x425d('0x27'),_0x2a9e8f,'request\x20sent',JSON[_0x425d('0x28')](_0x14c6cc));if(_0x14c6cc[_0x425d('0x29')]){if(_0x14c6cc['error'][_0x425d('0x2a')]===0x1f4){logger[_0x425d('0x29')](_0x425d('0x25'),_0x2a9e8f,_0x14c6cc[_0x425d('0x29')][_0x425d('0x2b')]);return _0xf8da0b(_0x14c6cc[_0x425d('0x29')][_0x425d('0x2b')]);}logger[_0x425d('0x29')](_0x425d('0x25'),_0x2a9e8f,_0x14c6cc['error'][_0x425d('0x2b')]);return _0xb2e907(_0x14c6cc[_0x425d('0x29')][_0x425d('0x2b')]);}else{logger['info'](_0x425d('0x25'),_0x2a9e8f,_0x425d('0x26'));_0xb2e907(_0x14c6cc['result'][_0x425d('0x2b')]);}})[_0x425d('0x2c')](function(_0x3e0482){logger[_0x425d('0x29')](_0x425d('0x25'),_0x2a9e8f,_0x3e0482);_0xf8da0b(_0x3e0482);});});}function respondWithStatusCode(_0x59d8f7,_0x341d12){_0x341d12=_0x341d12||0xcc;return function(_0x38085b){if(_0x38085b){return _0x59d8f7['sendStatus'](_0x341d12);}return _0x59d8f7[_0x425d('0x2d')](_0x341d12)[_0x425d('0x2e')]();};}function respondWithResult(_0x37fe4f,_0x4a5518){_0x4a5518=_0x4a5518||0xc8;return function(_0x52f1bb){if(_0x52f1bb){return _0x37fe4f['status'](_0x4a5518)[_0x425d('0x2f')](_0x52f1bb);}};}function respondWithFilteredResult(_0x3aaab4,_0x3c4149){return function(_0x2c35cf){if(_0x2c35cf){var _0x36d688=typeof _0x3c4149['offset']===_0x425d('0x30')&&typeof _0x3c4149['limit']===_0x425d('0x30');var _0x25f167=_0x2c35cf[_0x425d('0x31')];var _0x51c2f9=_0x36d688?0x0:_0x3c4149[_0x425d('0x32')];var _0x551dac=_0x36d688?_0x2c35cf[_0x425d('0x31')]:_0x3c4149[_0x425d('0x32')]+_0x3c4149[_0x425d('0x33')];var _0x2e1658;if(_0x551dac>=_0x25f167){_0x551dac=_0x25f167;_0x2e1658=0xc8;}else{_0x2e1658=0xce;}_0x3aaab4['status'](_0x2e1658);return _0x3aaab4[_0x425d('0x34')](_0x425d('0x35'),_0x51c2f9+'-'+_0x551dac+'/'+_0x25f167)[_0x425d('0x2f')](_0x2c35cf);}return null;};}function patchUpdates(_0x56762c){return function(_0x4a93a2){try{jsonpatch[_0x425d('0x36')](_0x4a93a2,_0x56762c,!![]);}catch(_0x422f04){return BPromise[_0x425d('0x37')](_0x422f04);}return _0x4a93a2[_0x425d('0x38')]();};}function saveUpdates(_0x264370,_0x19b211){return function(_0x1e58d1){if(_0x1e58d1){return _0x1e58d1[_0x425d('0x39')](_0x264370)[_0x425d('0x24')](function(_0xb38cc1){return _0xb38cc1;});}return null;};}function removeEntity(_0x3e8d7f,_0x1cc987){return function(_0x4ccfd0){if(_0x4ccfd0){return _0x4ccfd0[_0x425d('0x3a')]()[_0x425d('0x24')](function(){_0x3e8d7f['status'](0xcc)[_0x425d('0x2e')]();});}};}function handleEntityNotFound(_0x168c83,_0x33c3f5){return function(_0x5e4f34){if(!_0x5e4f34){_0x168c83[_0x425d('0x3b')](0x194);}return _0x5e4f34;};}function handleError(_0x5ad0d5,_0x139679){_0x139679=_0x139679||0x1f4;return function(_0x37876b){logger[_0x425d('0x29')](_0x37876b['stack']);if(_0x37876b['name']){delete _0x37876b['name'];}_0x5ad0d5[_0x425d('0x2d')](_0x139679)[_0x425d('0x3c')](_0x37876b);};}exports[_0x425d('0x3d')]=function(_0x20208d,_0x1b98cf){var _0x44d00f={},_0x51f2ee={},_0x419e6d={'count':0x0,'rows':[]};var _0x2a496e=_[_0x425d('0x3e')](db[_0x425d('0x3f')][_0x425d('0x40')],function(_0x280fc8){return{'name':_0x280fc8[_0x425d('0x41')],'type':_0x280fc8[_0x425d('0x42')][_0x425d('0x43')]};});_0x51f2ee[_0x425d('0x44')]=_[_0x425d('0x3e')](_0x2a496e,'name');_0x51f2ee[_0x425d('0x45')]=_[_0x425d('0x46')](_0x20208d[_0x425d('0x45')]);_0x51f2ee[_0x425d('0x47')]=_['intersection'](_0x51f2ee[_0x425d('0x44')],_0x51f2ee['query']);_0x44d00f[_0x425d('0x48')]=_[_0x425d('0x49')](_0x51f2ee[_0x425d('0x44')],qs[_0x425d('0x4a')](_0x20208d['query']['fields']));_0x44d00f[_0x425d('0x48')]=_0x44d00f['attributes'][_0x425d('0x4b')]?_0x44d00f[_0x425d('0x48')]:_0x51f2ee[_0x425d('0x44')];if(!_0x20208d['query']['hasOwnProperty'](_0x425d('0x4c'))){_0x44d00f['limit']=qs[_0x425d('0x33')](_0x20208d[_0x425d('0x45')][_0x425d('0x33')]);_0x44d00f[_0x425d('0x32')]=qs[_0x425d('0x32')](_0x20208d['query'][_0x425d('0x32')]);}_0x44d00f[_0x425d('0x4d')]=qs[_0x425d('0x4e')](_0x20208d['query'][_0x425d('0x4e')]);_0x44d00f[_0x425d('0x4f')]=qs[_0x425d('0x47')](_[_0x425d('0x50')](_0x20208d[_0x425d('0x45')],_0x51f2ee[_0x425d('0x47')]),_0x2a496e);if(_0x20208d['query'][_0x425d('0x51')]){_0x44d00f[_0x425d('0x4f')]=_[_0x425d('0x52')](_0x44d00f['where'],{'$or':_[_0x425d('0x3e')](_0x2a496e,function(_0x371524){if(_0x371524[_0x425d('0x42')]!==_0x425d('0x53')){var _0x18a54e={};_0x18a54e[_0x371524['name']]={'$like':'%'+_0x20208d['query'][_0x425d('0x51')]+'%'};return _0x18a54e;}})});}_0x44d00f=_[_0x425d('0x52')]({},_0x44d00f,_0x20208d['options']);var _0xc19b92={'where':_0x44d00f[_0x425d('0x4f')]};return db[_0x425d('0x3f')][_0x425d('0x31')](_0xc19b92)['then'](function(_0x3543a9){_0x419e6d['count']=_0x3543a9;if(_0x20208d[_0x425d('0x45')][_0x425d('0x54')]){_0x44d00f['include']=[{'all':!![]}];}return db[_0x425d('0x3f')][_0x425d('0x55')](_0x44d00f);})[_0x425d('0x24')](function(_0x5eea07){_0x419e6d[_0x425d('0x56')]=_0x5eea07;return _0x419e6d;})[_0x425d('0x24')](respondWithFilteredResult(_0x1b98cf,_0x44d00f))[_0x425d('0x2c')](handleError(_0x1b98cf,null));};exports[_0x425d('0x57')]=function(_0x4807c5,_0x1ae843){var _0x136181={'raw':!![],'where':{'id':_0x4807c5[_0x425d('0x58')]['id']}},_0x220475={};_0x220475[_0x425d('0x44')]=_[_0x425d('0x46')](db[_0x425d('0x3f')][_0x425d('0x40')]);_0x220475[_0x425d('0x45')]=_[_0x425d('0x46')](_0x4807c5[_0x425d('0x45')]);_0x220475['filters']=_[_0x425d('0x49')](_0x220475[_0x425d('0x44')],_0x220475[_0x425d('0x45')]);_0x136181['attributes']=_[_0x425d('0x49')](_0x220475[_0x425d('0x44')],qs[_0x425d('0x4a')](_0x4807c5[_0x425d('0x45')]['fields']));_0x136181[_0x425d('0x48')]=_0x136181[_0x425d('0x48')][_0x425d('0x4b')]?_0x136181['attributes']:_0x220475[_0x425d('0x44')];if(_0x4807c5['query'][_0x425d('0x54')]){_0x136181[_0x425d('0x59')]=[{'all':!![]}];}_0x136181=_[_0x425d('0x52')]({},_0x136181,_0x4807c5[_0x425d('0x5a')]);return db[_0x425d('0x3f')][_0x425d('0x5b')](_0x136181)[_0x425d('0x24')](handleEntityNotFound(_0x1ae843,null))[_0x425d('0x24')](respondWithResult(_0x1ae843,null))[_0x425d('0x2c')](handleError(_0x1ae843,null));};exports['update']=function(_0x423a5b,_0x5d89fb){if(_0x423a5b[_0x425d('0x5c')]['id']){delete _0x423a5b['body']['id'];}return db[_0x425d('0x3f')]['find']({'where':{'id':_0x423a5b[_0x425d('0x58')]['id']}})[_0x425d('0x24')](handleEntityNotFound(_0x5d89fb,null))[_0x425d('0x24')](saveUpdates(_0x423a5b['body'],null))['then'](respondWithResult(_0x5d89fb,null))[_0x425d('0x2c')](handleError(_0x5d89fb,null));};exports['destroy']=function(_0x29f8a8,_0x7f6ae0){return db[_0x425d('0x3f')][_0x425d('0x5b')]({'where':{'id':_0x29f8a8[_0x425d('0x58')]['id']}})[_0x425d('0x24')](handleEntityNotFound(_0x7f6ae0,null))[_0x425d('0x24')](removeEntity(_0x7f6ae0,null))[_0x425d('0x2c')](handleError(_0x7f6ae0,null));};exports[_0x425d('0x5d')]=function(_0x23f3bf,_0x145e68){return db[_0x425d('0x3f')][_0x425d('0x5d')]()[_0x425d('0x24')](respondWithResult(_0x145e68,null))['catch'](handleError(_0x145e68,null));};var interaction_log=require(_0x425d('0x16'))(_0x425d('0x5e'));exports[_0x425d('0x5f')]=function(_0x12a0f2,_0x4d23ce,_0x346757){var _0x4d8219={'agent':{},'channel':_0x425d('0x60')};if(_0x12a0f2['body']['id']){delete _0x12a0f2[_0x425d('0x5c')]['id'];}_0x12a0f2['body'][_0x425d('0x61')]=!![];_0x12a0f2[_0x425d('0x5c')][_0x425d('0x62')]=moment()[_0x425d('0x63')](_0x425d('0x64'));_0x12a0f2['body'][_0x425d('0x65')]=_0x12a0f2[_0x425d('0x5c')][_0x425d('0x65')]||_0x12a0f2[_0x425d('0x66')]['id'];_0x4d8219['agent']['id']=_0x12a0f2[_0x425d('0x5c')][_0x425d('0x65')];return db['FaxMessage'][_0x425d('0x5b')]({'where':{'id':_0x12a0f2['params']['id'],'UserId':null}})[_0x425d('0x24')](handleEntityNotFound(_0x4d23ce,null))[_0x425d('0x24')](saveUpdates(_0x12a0f2[_0x425d('0x5c')],null))[_0x425d('0x24')](function(_0xed131c){if(_0xed131c){_0x4d8219[_0x425d('0x2b')]=_0xed131c[_0x425d('0x67')]({'plain':!![]});return db[_0x425d('0x68')]['find']({'where':{'id':_0xed131c[_0x425d('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x4d23ce,null))[_0x425d('0x24')](function(_0x2705e3){if(_0x2705e3){return _0x2705e3['update']({'UserId':_0x12a0f2[_0x425d('0x5c')][_0x425d('0x65')],'read1stAt':_['isNil'](_0x2705e3[_0x425d('0x6a')])?moment()[_0x425d('0x63')](_0x425d('0x64')):undefined});}return null;})[_0x425d('0x24')](function(_0x57c3dd){if(_0x57c3dd){_0x4d8219['interaction']=_0x57c3dd[_0x425d('0x67')]({'plain':!![]});interaction_log['info'](_0x425d('0x6b'),_0x12a0f2[_0x425d('0x66')]['id'],_0x12a0f2['user'][_0x425d('0x6c')],_0x12a0f2[_0x425d('0x66')][_0x425d('0x6d')],_0x4d8219[_0x425d('0x6e')]['id'],_0x12a0f2[_0x425d('0x5c')]?JSON[_0x425d('0x28')](_0x12a0f2[_0x425d('0x5c')]):_0x425d('0x6f'));return respondWithRpcPromise(_0x425d('0x70'),'acceptMessage',_0x4d8219);}return null;})[_0x425d('0x24')](function(_0x2997a8){var _0x2c33ab=_0x425d('0x71')+_0x2997a8['message']['ContactId'];return db[_0x425d('0x72')][_0x425d('0x45')](_0x2c33ab,{'type':db[_0x425d('0x73')][_0x425d('0x74')]['SELECT'],'raw':!![]})[_0x425d('0x24')](function(_0x13b137){return _0x13b137;});})[_0x425d('0x24')](function(_0x4680df){if(_0x4680df){_0x4d8219[_0x425d('0x2b')]['contact']=_0x4680df[0x0];if(!_0x12a0f2[_0x425d('0x5c')][_0x425d('0x65')])return;return db[_0x425d('0x75')][_0x425d('0x5b')]({'where':{'id':_0x12a0f2['body']['UserId'],'role':'agent'},'attributes':['id',_0x425d('0x6c'),_0x425d('0x76'),_0x425d('0x77'),_0x425d('0x78')],'raw':!![]});}return null;})[_0x425d('0x24')](function(_0x219b54){if(!_0x219b54)return null;_0x4d8219[_0x425d('0x2b')][_0x425d('0x79')]=_0x219b54;return _0x4d8219;})[_0x425d('0x24')](function(_0x13233a){if(_0x13233a){if(_0x12a0f2[_0x425d('0x5c')]['manual']){_0x4d8219[_0x425d('0x2b')][_0x425d('0x7a')]=util[_0x425d('0x63')](_0x425d('0x7b'),_0x12a0f2['user'][_0x425d('0x6c')]);_0x4d8219[_0x425d('0x2b')][_0x425d('0x7c')]=_0x4d8219[_0x425d('0x7c')];_0x4d8219[_0x425d('0x2b')][_0x425d('0x7d')]=_0x4d8219[_0x425d('0x7c')];_0x4d8219['message'][_0x425d('0x7e')]=_0x425d('0x5f');return respondWithRpcPromise('EventManager',_0x425d('0x7f'),{'event':_0x425d('0x80'),'message':_0x4d8219[_0x425d('0x2b')]},client9002)['then'](function(){return _0x4d8219;});}return _0x4d8219;}return null;})[_0x425d('0x24')](respondWithResult(_0x4d23ce,null))[_0x425d('0x2c')](handleError(_0x4d23ce,null));};var interaction_log=require(_0x425d('0x16'))(_0x425d('0x5e'));exports['reject']=function(_0x478f20,_0x493f31,_0x3440a4){var _0xe2351f={'agent':{},'channel':_0x425d('0x60')};if(_0x478f20[_0x425d('0x5c')]['id']){delete _0x478f20[_0x425d('0x5c')]['id'];}_0x478f20['body']['UserId']=_0x478f20['body']['UserId']||_0x478f20[_0x425d('0x66')]['id'];_0xe2351f[_0x425d('0x79')]['id']=_0x478f20[_0x425d('0x5c')]['UserId'];return db[_0x425d('0x3f')][_0x425d('0x5b')]({'where':{'id':_0x478f20['params']['id'],'UserId':null}})[_0x425d('0x24')](handleEntityNotFound(_0x493f31,null))[_0x425d('0x24')](function(_0x4dbbb5){if(_0x4dbbb5){_0xe2351f[_0x425d('0x2b')]=_0x4dbbb5[_0x425d('0x67')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x4dbbb5[_0x425d('0x69')]}});}return null;})[_0x425d('0x24')](handleEntityNotFound(_0x493f31,null))[_0x425d('0x24')](function(_0x5c99d5){if(_0x5c99d5){_0xe2351f['interaction']=_0x5c99d5[_0x425d('0x67')]({'plain':!![]});interaction_log['info'](_0x425d('0x81'),_0x478f20[_0x425d('0x66')]['id'],_0x478f20[_0x425d('0x66')][_0x425d('0x6c')],_0x478f20[_0x425d('0x66')][_0x425d('0x6d')],_0xe2351f[_0x425d('0x6e')]['id'],_0x478f20['body']?JSON['stringify'](_0x478f20[_0x425d('0x5c')]):_0x425d('0x6f'));return respondWithRpcPromise(_0x425d('0x82'),_0x425d('0x83'),_0xe2351f);}return null;})[_0x425d('0x24')](function(_0x403cc2){var _0x2a2066=_0x425d('0x71')+_0x403cc2[_0x425d('0x2b')][_0x425d('0x84')];return db['sequelize']['query'](_0x2a2066,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x425d('0x24')](function(_0x3cda02){return _0x3cda02;});})[_0x425d('0x24')](function(_0x1c0890){if(_0x1c0890){_0xe2351f['message'][_0x425d('0x85')]=_0x1c0890[0x0];if(!_0x478f20[_0x425d('0x5c')][_0x425d('0x65')])return;return db[_0x425d('0x75')][_0x425d('0x5b')]({'where':{'id':_0x478f20[_0x425d('0x5c')][_0x425d('0x65')],'role':_0x425d('0x79')},'attributes':['id',_0x425d('0x6c'),'fullname',_0x425d('0x77'),_0x425d('0x78')],'raw':!![]});}return null;})['then'](function(_0x485fbf){if(!_0x485fbf)return null;_0xe2351f[_0x425d('0x2b')][_0x425d('0x79')]=_0x485fbf;return _0xe2351f;})['then'](function(_0x3a853a){if(_0x3a853a){_0x3a853a['message']['interface']=util[_0x425d('0x63')]('SIP/%s',_0x478f20['user'][_0x425d('0x6c')]);_0x3a853a[_0x425d('0x2b')][_0x425d('0x7c')]=_0xe2351f[_0x425d('0x7c')];_0x3a853a['message'][_0x425d('0x7d')]=_0xe2351f[_0x425d('0x7c')];_0x3a853a[_0x425d('0x2b')]['event']='reject';respondWithRpcPromise('EventManager',_0x425d('0x7f'),{'event':'rejectmessage','message':_0x3a853a['message']},client9002);return _0xe2351f;}return null;})[_0x425d('0x24')](respondWithResult(_0x493f31,null))[_0x425d('0x2c')](handleError(_0x493f31,null));};exports[_0x425d('0x86')]=function(_0x3c3812,_0x5957f3){var _0x44f3ed;return db[_0x425d('0x3f')][_0x425d('0x86')](_0x3c3812[_0x425d('0x5c')],{})[_0x425d('0x24')](function(_0x39e173){_0x44f3ed=_0x39e173;return db[_0x425d('0x87')][_0x425d('0x88')]({'where':{'id':_0x44f3ed['ContactId']}});})['then'](function(_0x5d43a4){if(_[_0x425d('0x89')](_0x5d43a4)){return;}else{_0x44f3ed['fax']=_0x5d43a4['fax'];return db['Attachment']['findOne']({'where':{'id':_0x44f3ed['AttachmentId']}});}})[_0x425d('0x24')](function(_0x26d13c){return respondWithRpcPromise(_0x425d('0x8a'),_0x425d('0x8a'),{'FaxAccountId':_['isNil'](_0x3c3812['body'])?undefined:_0x3c3812[_0x425d('0x5c')][_0x425d('0x8b')],'path':_[_0x425d('0x89')](_0x26d13c)?undefined:util[_0x425d('0x63')](_0x425d('0x8c'),_0x26d13c['basename']),'fax':_[_0x425d('0x89')](_0x44f3ed[_0x425d('0x60')])?undefined:_0x44f3ed['fax'],'AttachmentId':_0x44f3ed[_0x425d('0x8d')]},client9002);})['then'](respondWithResult(_0x5957f3,0xc9))[_0x425d('0x2c')](handleError(_0x5957f3,null));};exports['download']=function(_0x405327,_0x21c1da){var _0x278523=path[_0x425d('0x8e')](config[_0x425d('0x8f')],'server',_0x425d('0x90'),_0x425d('0x91'));return db[_0x425d('0x3f')][_0x425d('0x5b')]({'where':{'id':_0x405327[_0x425d('0x58')]['id']},'include':[{'model':db[_0x425d('0x92')],'as':_0x425d('0x92')}]})['then'](handleEntityNotFound(_0x21c1da,null))[_0x425d('0x24')](function(_0x4f65eb){if(_0x4f65eb){return _0x21c1da['download'](path[_0x425d('0x8e')](_0x278523,_0x4f65eb[_0x425d('0x92')]['basename']));}})[_0x425d('0x2c')](handleError(_0x21c1da,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 32a453e..005dce4 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 _0x79bf=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xbd0517,_0x35451f){var _0x142eee=function(_0x1fc812){while(--_0x1fc812){_0xbd0517['push'](_0xbd0517['shift']());}};_0x142eee(++_0x35451f);}(_0x79bf,0x1df));var _0xf79b=function(_0x2c2a81,_0x1d63e5){_0x2c2a81=_0x2c2a81-0x0;var _0x4e337c=_0x79bf[_0x2c2a81];return _0x4e337c;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xf79b('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xf79b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf79b('0x2'),'afterDestroy':_0xf79b('0x3')};function emitEvent(_0x917960){return function(_0x193fad,_0x44bff1,_0x8b298){FaxMessageEvents[_0xf79b('0x4')](_0x917960+':'+_0x193fad['id'],_0x193fad);FaxMessageEvents['emit'](_0x917960,_0x193fad);_0x8b298(null);};}for(var e in events){if(events[_0xf79b('0x5')](e)){var event=events[e];FaxMessage[_0xf79b('0x6')](e,emitEvent(event));}}module[_0xf79b('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x1fa9=['save','update','remove','emit','hook','exports','events','FaxMessage'];(function(_0x135c3d,_0xf4d149){var _0x23c7ea=function(_0x2de680){while(--_0x2de680){_0x135c3d['push'](_0x135c3d['shift']());}};_0x23c7ea(++_0xf4d149);}(_0x1fa9,0x136));var _0x91fa=function(_0x30ec7b,_0x86d660){_0x30ec7b=_0x30ec7b-0x0;var _0x1813d4=_0x1fa9[_0x30ec7b];return _0x1813d4;};'use strict';var EventEmitter=require(_0x91fa('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x91fa('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x91fa('0x2'),'afterUpdate':_0x91fa('0x3'),'afterDestroy':_0x91fa('0x4')};function emitEvent(_0x57f230){return function(_0x191166,_0x33b35a,_0x4779be){FaxMessageEvents[_0x91fa('0x5')](_0x57f230+':'+_0x191166['id'],_0x191166);FaxMessageEvents[_0x91fa('0x5')](_0x57f230,_0x191166);_0x4779be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x91fa('0x6')](e,emitEvent(event));}}module[_0x91fa('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 297b9f7..956f2a3 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 _0x80ca=['moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','FaxInteraction','update','createdAt','catch','utf8mb4','util','../../config/logger'];(function(_0x5c0151,_0x59aa3c){var _0x20bcb2=function(_0x3dbfde){while(--_0x3dbfde){_0x5c0151['push'](_0x5c0151['shift']());}};_0x20bcb2(++_0x59aa3c);}(_0x80ca,0x1c0));var _0xa80c=function(_0x32759d,_0x42fae9){_0x32759d=_0x32759d-0x0;var _0xf1b695=_0x80ca[_0x32759d];return _0xf1b695;};'use strict';var _=require('lodash');var util=require(_0xa80c('0x0'));var logger=require(_0xa80c('0x1'))('api');var moment=require(_0xa80c('0x2'));var BPromise=require('bluebird');var rp=require(_0xa80c('0x3'));var fs=require('fs');var path=require(_0xa80c('0x4'));var rimraf=require(_0xa80c('0x5'));var config=require(_0xa80c('0x6'));var attributes=require(_0xa80c('0x7'));module['exports']=function(_0x228039,_0xd359f6){return _0x228039[_0xa80c('0x8')](_0xa80c('0x9'),attributes,{'tableName':_0xa80c('0xa'),'paranoid':![],'indexes':[{'name':_0xa80c('0xb'),'fields':['body'],'type':_0xa80c('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5270fb,_0x4e7b8b,_0x56b764){var _0x2e8e87=_0x228039[_0xa80c('0xd')];var _0x58355e=_0x5270fb[_0xa80c('0xe')]({'plain':!![]});if(_0x58355e['direction'][_0xa80c('0xf')]()==='in'||_0x58355e[_0xa80c('0x10')][_0xa80c('0xf')]()===_0xa80c('0x11')&&!_0x58355e['secret']&&!_[_0xa80c('0x12')](_0x58355e[_0xa80c('0x13')])){_0x2e8e87[_0xa80c('0x14')]['findOne']({'where':{'id':_0x58355e['FaxInteractionId']}})['then'](function(_0x2239a4){if(_0x2239a4){_0x2239a4[_0xa80c('0x15')]({'lastMsgAt':_0x58355e[_0xa80c('0x16')],'lastMsgDirection':_0x58355e[_0xa80c('0x10')][_0xa80c('0xf')]()});}})[_0xa80c('0x17')](function(_0x249043){console['error'](_0x249043);});}_0x56b764();}},'charset':_0xa80c('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3d55=['../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3d55,0x165));var _0x53d5=function(_0x3073c5,_0x426ccc){_0x3073c5=_0x3073c5-0x0;var _0x35f385=_0x3d55[_0x3073c5];return _0x35f385;};'use strict';var _=require(_0x53d5('0x0'));var util=require(_0x53d5('0x1'));var logger=require(_0x53d5('0x2'))('api');var moment=require(_0x53d5('0x3'));var BPromise=require(_0x53d5('0x4'));var rp=require(_0x53d5('0x5'));var fs=require('fs');var path=require(_0x53d5('0x6'));var rimraf=require('rimraf');var config=require(_0x53d5('0x7'));var attributes=require(_0x53d5('0x8'));module[_0x53d5('0x9')]=function(_0x2d526b,_0xc24d34){return _0x2d526b['define']('FaxMessage',attributes,{'tableName':_0x53d5('0xa'),'paranoid':![],'indexes':[{'name':_0x53d5('0xb'),'fields':['body'],'type':_0x53d5('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32207b,_0x43723a,_0x49f919){var _0x44a278=_0x2d526b['models'];var _0x55d7bc=_0x32207b[_0x53d5('0xd')]({'plain':!![]});if(_0x55d7bc[_0x53d5('0xe')][_0x53d5('0xf')]()==='in'||_0x55d7bc['direction'][_0x53d5('0xf')]()===_0x53d5('0x10')&&!_0x55d7bc['secret']&&!_['isNil'](_0x55d7bc[_0x53d5('0x11')])){_0x44a278[_0x53d5('0x12')][_0x53d5('0x13')]({'where':{'id':_0x55d7bc[_0x53d5('0x14')]}})[_0x53d5('0x15')](function(_0x10caf4){if(_0x10caf4){_0x10caf4['update']({'lastMsgAt':_0x55d7bc[_0x53d5('0x16')],'lastMsgDirection':_0x55d7bc[_0x53d5('0xe')][_0x53d5('0xf')]()});}})[_0x53d5('0x17')](function(_0x3b3c85){console[_0x53d5('0x18')](_0x3b3c85);});}_0x49f919();}},'charset':'utf8mb4','collate':_0x53d5('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 084f385..4b3c209 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 _0x032e=['FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','where','attributes','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x59227e,_0x20fa18){var _0x5508bb=function(_0x5161ff){while(--_0x5161ff){_0x59227e['push'](_0x59227e['shift']());}};_0x5508bb(++_0x20fa18);}(_0x032e,0x124));var _0xe032=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x032e[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});config[_0xe032('0xb')]=_[_0xe032('0xc')](config[_0xe032('0xb')],{'host':_0xe032('0xd'),'port':0x18eb});var socket=require(_0xe032('0xe'))(new Redis(config[_0xe032('0xb')]));require(_0xe032('0xf'))[_0xe032('0x10')](socket);function respondWithRpcPromise(_0x2dc9e5,_0x167bd9,_0x4aec53){return new BPromise(function(_0x1382e1,_0x1ce2ae){return client[_0xe032('0x11')](_0x2dc9e5,_0x4aec53)[_0xe032('0x12')](function(_0x244f93){logger[_0xe032('0x13')](_0xe032('0x14'),_0x167bd9,'request\x20sent');logger[_0xe032('0x15')](_0xe032('0x16'),_0x167bd9,_0xe032('0x17'),JSON[_0xe032('0x18')](_0x244f93));if(_0x244f93['error']){if(_0x244f93[_0xe032('0x19')][_0xe032('0x1a')]===0x1f4){logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1ce2ae(_0x244f93[_0xe032('0x19')]['message']);}logger[_0xe032('0x19')](_0xe032('0x14'),_0x167bd9,_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);return _0x1382e1(_0x244f93[_0xe032('0x19')][_0xe032('0x1b')]);}else{logger['info'](_0xe032('0x14'),_0x167bd9,_0xe032('0x17'));_0x1382e1(_0x244f93[_0xe032('0x1c')][_0xe032('0x1b')]);}})[_0xe032('0x1d')](function(_0x5721ce){logger['error']('FaxMessage,\x20%s,\x20%s',_0x167bd9,_0x5721ce);_0x1ce2ae(_0x5721ce);});});}exports[_0xe032('0x1e')]=function(_0x505d8c){var _0x46dc27=this;return new Promise(function(_0x4608e4,_0x3f0257){return db[_0xe032('0x1f')][_0xe032('0x20')](_0x505d8c[_0xe032('0x21')],{'raw':_0x505d8c[_0xe032('0x22')]?_0x505d8c['options'][_0xe032('0x23')]===undefined?!![]:![]:!![]})[_0xe032('0x12')](function(_0x232e8f){logger[_0xe032('0x13')](_0xe032('0x1e'),_0x505d8c);logger[_0xe032('0x15')](_0xe032('0x1e'),_0x505d8c,JSON[_0xe032('0x18')](_0x232e8f));_0x4608e4(_0x232e8f);})['catch'](function(_0x4f1aa3){logger['error'](_0xe032('0x1e'),_0x4f1aa3[_0xe032('0x1b')],_0x505d8c);_0x3f0257(_0x46dc27[_0xe032('0x19')](0x1f4,_0x4f1aa3[_0xe032('0x1b')]));});});};exports[_0xe032('0x24')]=function(_0x200671){var _0x36ece7=this;return new Promise(function(_0x2b6ffa,_0x4dcbf1){return db[_0xe032('0x1f')]['update'](_0x200671[_0xe032('0x21')],{'raw':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x200671['options']?_0x200671['options'][_0xe032('0x25')]||null:null,'attributes':_0x200671[_0xe032('0x22')]?_0x200671[_0xe032('0x22')][_0xe032('0x26')]||null:null,'limit':_0x200671['options']?_0x200671['options']['limit']||null:null})[_0xe032('0x12')](function(_0x1dd34f){logger[_0xe032('0x13')](_0xe032('0x24'),_0x200671);logger['debug'](_0xe032('0x24'),_0x200671,JSON[_0xe032('0x18')](_0x1dd34f));_0x2b6ffa(_0x1dd34f);})[_0xe032('0x1d')](function(_0x4348f8){logger[_0xe032('0x19')]('UpdateFaxMessage',_0x4348f8[_0xe032('0x1b')],_0x200671);_0x4dcbf1(_0x36ece7[_0xe032('0x19')](0x1f4,_0x4348f8[_0xe032('0x1b')]));});});}; \ No newline at end of file +var _0xf3cd=['redis','defaults','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','body','options','raw','UpdateFaxMessage','FaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x455433,_0x34fdb5){var _0x50d9d2=function(_0x254b3f){while(--_0x254b3f){_0x455433['push'](_0x455433['shift']());}};_0x50d9d2(++_0x34fdb5);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1a2d1c,_0x4a1873){_0x1a2d1c=_0x1a2d1c-0x0;var _0x56eb67=_0xf3cd[_0x1a2d1c];return _0x56eb67;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});config[_0xdf3c('0xc')]=_[_0xdf3c('0xd')](config[_0xdf3c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf3c('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xdf3c('0xf')](socket);function respondWithRpcPromise(_0x981616,_0x5ef936,_0x1dba4c){return new BPromise(function(_0x205f33,_0x2d420c){return client[_0xdf3c('0x10')](_0x981616,_0x1dba4c)[_0xdf3c('0x11')](function(_0x1c456b){logger[_0xdf3c('0x12')](_0xdf3c('0x13'),_0x5ef936,'request\x20sent');logger[_0xdf3c('0x14')](_0xdf3c('0x15'),_0x5ef936,_0xdf3c('0x16'),JSON[_0xdf3c('0x17')](_0x1c456b));if(_0x1c456b['error']){if(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x19')]===0x1f4){logger[_0xdf3c('0x18')]('FaxMessage,\x20%s,\x20%s',_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x2d420c(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x205f33(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}else{logger['info'](_0xdf3c('0x13'),_0x5ef936,_0xdf3c('0x16'));_0x205f33(_0x1c456b[_0xdf3c('0x1b')][_0xdf3c('0x1a')]);}})[_0xdf3c('0x1c')](function(_0x113b56){logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x113b56);_0x2d420c(_0x113b56);});});}exports[_0xdf3c('0x1d')]=function(_0x18fb5f){var _0x267488=this;return new Promise(function(_0x3d14cc,_0x25487c){return db['FaxMessage']['create'](_0x18fb5f[_0xdf3c('0x1e')],{'raw':_0x18fb5f['options']?_0x18fb5f[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![]})[_0xdf3c('0x11')](function(_0x38b319){logger[_0xdf3c('0x12')](_0xdf3c('0x1d'),_0x18fb5f);logger['debug'](_0xdf3c('0x1d'),_0x18fb5f,JSON[_0xdf3c('0x17')](_0x38b319));_0x3d14cc(_0x38b319);})[_0xdf3c('0x1c')](function(_0x24754a){logger[_0xdf3c('0x18')](_0xdf3c('0x1d'),_0x24754a[_0xdf3c('0x1a')],_0x18fb5f);_0x25487c(_0x267488[_0xdf3c('0x18')](0x1f4,_0x24754a[_0xdf3c('0x1a')]));});});};exports[_0xdf3c('0x21')]=function(_0x4c076c){var _0xd284d7=this;return new Promise(function(_0x153daa,_0x4b57a4){return db[_0xdf3c('0x22')]['update'](_0x4c076c['body'],{'raw':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c076c['options']?_0x4c076c['options'][_0xdf3c('0x23')]||null:null,'attributes':_0x4c076c[_0xdf3c('0x1f')]?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x24')]||null:null,'limit':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x25')]||null:null})['then'](function(_0x51e0a4){logger[_0xdf3c('0x12')](_0xdf3c('0x21'),_0x4c076c);logger[_0xdf3c('0x14')]('UpdateFaxMessage',_0x4c076c,JSON[_0xdf3c('0x17')](_0x51e0a4));_0x153daa(_0x51e0a4);})[_0xdf3c('0x1c')](function(_0x21e7b8){logger[_0xdf3c('0x18')]('UpdateFaxMessage',_0x21e7b8[_0xdf3c('0x1a')],_0x4c076c);_0x4b57a4(_0xd284d7[_0xdf3c('0x18')](0x1f4,_0x21e7b8['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index f53b852..3c1001c 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 _0x0ab9=['emit','removeListener','length','faxMessage:','./faxMessage.events','save','update'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x0ab9,0xcf));var _0x90ab=function(_0x52cec5,_0x2b0cd9){_0x52cec5=_0x52cec5-0x0;var _0x2673c8=_0x0ab9[_0x52cec5];return _0x2673c8;};'use strict';var FaxMessageEvents=require(_0x90ab('0x0'));var events=[_0x90ab('0x1'),'remove',_0x90ab('0x2')];function createListener(_0x27b2e5,_0x24ddb7){return function(_0x205640){_0x24ddb7[_0x90ab('0x3')](_0x27b2e5,_0x205640);};}function removeListener(_0x44f58a,_0x206c20){return function(){FaxMessageEvents[_0x90ab('0x4')](_0x44f58a,_0x206c20);};}exports['register']=function(_0x1cf1ff){for(var _0x2bb662=0x0,_0x3d68cb=events[_0x90ab('0x5')];_0x2bb662<_0x3d68cb;_0x2bb662++){var _0x2dd55a=events[_0x2bb662];var _0x3e31b9=createListener(_0x90ab('0x6')+_0x2dd55a,_0x1cf1ff);FaxMessageEvents['on'](_0x2dd55a,_0x3e31b9);}}; \ No newline at end of file +var _0x9a19=['./faxMessage.events','save','remove','update','emit','removeListener','register','length','faxMessage:'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x9a19,0x105));var _0x99a1=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x9a19[_0x2261ce];return _0x524640;};'use strict';var FaxMessageEvents=require(_0x99a1('0x0'));var events=[_0x99a1('0x1'),_0x99a1('0x2'),_0x99a1('0x3')];function createListener(_0xbd58bf,_0x1ce860){return function(_0x39cb7b){_0x1ce860[_0x99a1('0x4')](_0xbd58bf,_0x39cb7b);};}function removeListener(_0x332dee,_0x4fa4d2){return function(){FaxMessageEvents[_0x99a1('0x5')](_0x332dee,_0x4fa4d2);};}exports[_0x99a1('0x6')]=function(_0x2cb2da){for(var _0x4ed9c7=0x0,_0x233490=events[_0x99a1('0x7')];_0x4ed9c7<_0x233490;_0x4ed9c7++){var _0x2ca523=events[_0x4ed9c7];var _0x548e24=createListener(_0x99a1('0x8')+_0x2ca523,_0x2cb2da);FaxMessageEvents['on'](_0x2ca523,_0x548e24);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c23acd3..3104a66 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 _0x91a7=['isAuthenticated','/:id','show','download','tracked','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get','index','/describe'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x91a7,0xe7));var _0x791a=function(_0x3d039f,_0x2533bd){_0x3d039f=_0x3d039f-0x0;var _0x1ddddc=_0x91a7[_0x3d039f];return _0x1ddddc;};'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['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/download',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),interaction[_0x791a('0xd')](_0x791a('0xe'),_0x791a('0xf')),controller[_0x791a('0x10')]);router[_0x791a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x791a('0x12')]);router[_0x791a('0x11')]('/:id/accept',auth[_0x791a('0x9')](),controller[_0x791a('0x13')]);router['put'](_0x791a('0x14'),auth[_0x791a('0x9')](),controller[_0x791a('0x15')]);router[_0x791a('0x16')]('/:id',auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x17')]=router; \ No newline at end of file +var _0xe205=['../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','tracked','fax','faxmessage:create','create','put','update','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4de950,_0x2bc8f8){var _0x312e51=function(_0x2ac86e){while(--_0x2ac86e){_0x4de950['push'](_0x4de950['shift']());}};_0x312e51(++_0x2bc8f8);}(_0xe205,0xa7));var _0x5e20=function(_0x19dcda,_0x34ec3b){_0x19dcda=_0x19dcda-0x0;var _0x144064=_0xe205[_0x19dcda];return _0x144064;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/describe',auth[_0x5e20('0xb')](),controller['describe']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['show']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),interaction[_0x5e20('0x10')](_0x5e20('0x11'),_0x5e20('0x12')),controller[_0x5e20('0x13')]);router[_0x5e20('0x14')]('/:id',auth[_0x5e20('0xb')](),controller[_0x5e20('0x15')]);router[_0x5e20('0x14')]('/:id/accept',auth[_0x5e20('0xb')](),controller['accept']);router[_0x5e20('0x14')]('/:id/reject',auth[_0x5e20('0xb')](),controller[_0x5e20('0x16')]);router[_0x5e20('0x17')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['destroy']);module[_0x5e20('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 68025c0..70b06c2 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 _0x33ec=['ENUM','rrmemory','roundrobin','exports','STRING','name','INTEGER'];(function(_0x2bc61b,_0x3bb067){var _0x50b180=function(_0x5bebde){while(--_0x5bebde){_0x2bc61b['push'](_0x2bc61b['shift']());}};_0x50b180(++_0x3bb067);}(_0x33ec,0x96));var _0xc33e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33ec[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc33e('0x0')]={'name':{'type':Sequelize[_0xc33e('0x1')],'unique':_0xc33e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc33e('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc33e('0x4')](_0xc33e('0x5'),'beepall',_0xc33e('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc33e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd5bc=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0xd5bc,0x78));var _0xcd5b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd5bc[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xcd5b('0x0'));module[_0xcd5b('0x1')]={'name':{'type':Sequelize[_0xcd5b('0x2')],'unique':_0xcd5b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcd5b('0x2')]},'timeout':{'type':Sequelize[_0xcd5b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd5b('0x5')](_0xcd5b('0x6'),'beepall',_0xcd5b('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xcd5b('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index bcab285..34cd6a2 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 _0x444e=['addAgents','omit','spread','getAgents','bluebird','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','offset','limit','count','set','Content-Range','json','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','FaxQueue','include','query','findAll','rows','catch','params','model','keys','filters','attributes','includeAll','merge','options','create','body','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','intersection','fields','length','nolimit','order','sort','where','FaxQueueId','filter','User','UserId','faxPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','pick','hasOwnProperty','addTeams','ids','Agents','online','interface','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Team','select','field','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','push','toString','sequelize','QueryTypes','every','all','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove'];(function(_0x2c71de,_0x12e964){var _0x51cb86=function(_0x2c765b){while(--_0x2c765b){_0x2c71de['push'](_0x2c71de['shift']());}};_0x51cb86(++_0x12e964);}(_0x444e,0xe8));var _0xe444=function(_0x40f186,_0x9ed0d3){_0x40f186=_0x40f186-0x0;var _0x49d2bd=_0x444e[_0x40f186];return _0x49d2bd;};'use strict';var BPromise=require(_0xe444('0x0'));var util=require('util');var _=require(_0xe444('0x1'));var squel=require('squel');var Redis=require(_0xe444('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xe444('0x3'))('api');var config=require(_0xe444('0x4'));var db=require(_0xe444('0x5'))['db'];config[_0xe444('0x6')]=_[_0xe444('0x7')](config[_0xe444('0x6')],{'host':_0xe444('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe444('0x6')]));require('./faxQueue.socket')[_0xe444('0x9')](socket);function respondWithStatusCode(_0x482b98,_0x3199dd){_0x3199dd=_0x3199dd||0xcc;return function(_0x4b5e34){if(_0x4b5e34){return _0x482b98[_0xe444('0xa')](_0x3199dd);}return _0x482b98['status'](_0x3199dd)['end']();};}function respondWithResult(_0x36c8a5,_0x1f41ff){_0x1f41ff=_0x1f41ff||0xc8;return function(_0x5e53cb){if(_0x5e53cb){return _0x36c8a5[_0xe444('0xb')](_0x1f41ff)['json'](_0x5e53cb);}};}function respondWithFilteredResult(_0x5f0f7f,_0x390347){return function(_0x4cb1b6){if(_0x4cb1b6){var _0x2a6bf8=typeof _0x390347[_0xe444('0xc')]==='undefined'&&typeof _0x390347[_0xe444('0xd')]==='undefined';var _0x5ba044=_0x4cb1b6[_0xe444('0xe')];var _0x3e3b9f=_0x2a6bf8?0x0:_0x390347['offset'];var _0x192c1a=_0x2a6bf8?_0x4cb1b6['count']:_0x390347[_0xe444('0xc')]+_0x390347[_0xe444('0xd')];var _0x18f7cf;if(_0x192c1a>=_0x5ba044){_0x192c1a=_0x5ba044;_0x18f7cf=0xc8;}else{_0x18f7cf=0xce;}_0x5f0f7f[_0xe444('0xb')](_0x18f7cf);return _0x5f0f7f[_0xe444('0xf')](_0xe444('0x10'),_0x3e3b9f+'-'+_0x192c1a+'/'+_0x5ba044)[_0xe444('0x11')](_0x4cb1b6);}return null;};}function saveUpdates(_0x3e1b57){return function(_0x11129b){if(_0x11129b){return _0x11129b[_0xe444('0x12')](_0x3e1b57)[_0xe444('0x13')](function(_0x3d9066){return _0x3d9066;});}return null;};}function removeEntity(_0x38879b){return function(_0x4e2711){if(_0x4e2711){return _0x4e2711[_0xe444('0x14')]()[_0xe444('0x13')](function(){var _0x12eb54=_0x4e2711[_0xe444('0x15')]({'plain':!![]});var _0x58fd40=_0xe444('0x16');return db[_0xe444('0x17')][_0xe444('0x14')]({'where':{'type':_0x58fd40,'resourceId':_0x12eb54['id']}})[_0xe444('0x13')](function(){return _0x4e2711;});})[_0xe444('0x13')](function(){_0x38879b['status'](0xcc)[_0xe444('0x18')]();});}};}function handleEntityNotFound(_0x5ecdff){return function(_0x529336){if(!_0x529336){_0x5ecdff[_0xe444('0xa')](0x194);}return _0x529336;};}function handleError(_0x5ef1a4,_0x13108c){_0x13108c=_0x13108c||0x1f4;return function(_0x5c5b8){logger[_0xe444('0x19')](_0x5c5b8[_0xe444('0x1a')]);if(_0x5c5b8[_0xe444('0x1b')]){delete _0x5c5b8['name'];}_0x5ef1a4['status'](_0x13108c)[_0xe444('0x1c')](_0x5c5b8);};}exports[_0xe444('0x1d')]=function(_0x1ac266,_0x1ff6d2){var _0x2a03a2={};var _0x5e0311={'count':0x0,'rows':[]};var _0x3c9cf7=_[_0xe444('0x1e')](db['FaxQueue'][_0xe444('0x1f')],function(_0x4f4412){return{'name':_0x4f4412[_0xe444('0x20')],'type':_0x4f4412[_0xe444('0x21')][_0xe444('0x22')]};});_0x2a03a2=qs[_0xe444('0x23')](_0x3c9cf7,_0x1ac266);var _0x16915c={'where':_0x2a03a2['where']};return db[_0xe444('0x24')][_0xe444('0xe')](_0x16915c)[_0xe444('0x13')](function(_0x304b33){_0x5e0311['count']=_0x304b33;_0x2a03a2['include']=qs[_0xe444('0x25')](_0x1ac266[_0xe444('0x26')]);return db[_0xe444('0x24')][_0xe444('0x27')](_0x2a03a2);})['then'](function(_0x26e233){_0x5e0311[_0xe444('0x28')]=_0x26e233;return _0x5e0311;})[_0xe444('0x13')](respondWithFilteredResult(_0x1ff6d2,_0x2a03a2))[_0xe444('0x29')](handleError(_0x1ff6d2,null));};exports['show']=function(_0x5a1269,_0x5c37b6){var _0x1e2d04={'raw':!![],'where':{'id':_0x5a1269[_0xe444('0x2a')]['id']}},_0xd4df5={};_0xd4df5[_0xe444('0x2b')]=_[_0xe444('0x2c')](db['FaxQueue'][_0xe444('0x1f')]);_0xd4df5[_0xe444('0x26')]=_[_0xe444('0x2c')](_0x5a1269['query']);_0xd4df5[_0xe444('0x2d')]=_['intersection'](_0xd4df5['model'],_0xd4df5[_0xe444('0x26')]);_0x1e2d04[_0xe444('0x2e')]=_['intersection'](_0xd4df5[_0xe444('0x2b')],qs['fields'](_0x5a1269[_0xe444('0x26')]['fields']));_0x1e2d04['attributes']=_0x1e2d04[_0xe444('0x2e')]['length']?_0x1e2d04[_0xe444('0x2e')]:_0xd4df5[_0xe444('0x2b')];if(_0x5a1269[_0xe444('0x26')][_0xe444('0x2f')]){_0x1e2d04['include']=[{'all':!![]}];}_0x1e2d04=_[_0xe444('0x30')]({},_0x1e2d04,_0x5a1269[_0xe444('0x31')]);return db[_0xe444('0x24')]['find'](_0x1e2d04)[_0xe444('0x13')](handleEntityNotFound(_0x5c37b6,null))['then'](respondWithResult(_0x5c37b6,null))[_0xe444('0x29')](handleError(_0x5c37b6,null));};exports[_0xe444('0x32')]=function(_0x40df20,_0x4dc4c9){return db['FaxQueue'][_0xe444('0x32')](_0x40df20[_0xe444('0x33')],{})[_0xe444('0x13')](function(_0x238b2b){var _0xec1e35=_0x40df20[_0xe444('0x34')][_0xe444('0x15')]({'plain':!![]});if(!_0xec1e35)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xec1e35['role']===_0xe444('0x34')){var _0x495c9d=_0x238b2b[_0xe444('0x15')]({'plain':!![]});var _0x5cfdaa=_0xe444('0x16');return db[_0xe444('0x35')][_0xe444('0x36')]({'where':{'name':_0x5cfdaa,'userProfileId':_0xec1e35[_0xe444('0x37')]},'raw':!![]})[_0xe444('0x13')](function(_0x2b1e25){if(_0x2b1e25&&_0x2b1e25['autoAssociation']===0x0){return db[_0xe444('0x17')][_0xe444('0x32')]({'name':_0x495c9d[_0xe444('0x1b')],'resourceId':_0x495c9d['id'],'type':_0x2b1e25[_0xe444('0x1b')],'sectionId':_0x2b1e25['id']},{})['then'](function(){return _0x238b2b;});}else{return _0x238b2b;}})[_0xe444('0x29')](function(_0x19283c){logger[_0xe444('0x19')](_0xe444('0x38'),_0x19283c);throw _0x19283c;});}return _0x238b2b;})[_0xe444('0x13')](respondWithResult(_0x4dc4c9,0xc9))[_0xe444('0x29')](handleError(_0x4dc4c9,null));};exports[_0xe444('0x12')]=function(_0x390ba0,_0x16c249){if(_0x390ba0['body']['id']){delete _0x390ba0['body']['id'];}return db['FaxQueue'][_0xe444('0x36')]({'where':{'id':_0x390ba0[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](handleEntityNotFound(_0x16c249,null))[_0xe444('0x13')](saveUpdates(_0x390ba0[_0xe444('0x33')],null))['then'](respondWithResult(_0x16c249,null))['catch'](handleError(_0x16c249,null));};exports[_0xe444('0x14')]=function(_0x1674e9,_0x2f0d8a){return db['FaxQueue'][_0xe444('0x36')]({'where':{'id':_0x1674e9[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](handleEntityNotFound(_0x2f0d8a,null))[_0xe444('0x13')](removeEntity(_0x2f0d8a,null))[_0xe444('0x29')](handleError(_0x2f0d8a,null));};exports[_0xe444('0x39')]=function(_0x563ca2,_0x595f81){return db[_0xe444('0x24')][_0xe444('0x39')]()[_0xe444('0x13')](respondWithResult(_0x595f81,null))[_0xe444('0x29')](handleError(_0x595f81,null));};exports['getMembers']=function(_0x13b92d,_0x3f96bb){var _0x3549d0={'raw':!![],'where':{}},_0x394665={},_0xbbd474;return db[_0xe444('0x24')][_0xe444('0x3a')]({'where':{'id':_0x13b92d[_0xe444('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3f96bb,null))[_0xe444('0x13')](function(_0x1c584d){if(_0x1c584d){_0xbbd474=_0x1c584d[_0xe444('0x15')]({'plain':!![]});_0x394665['model']=_[_0xe444('0x2c')](db['UserFaxQueue']['rawAttributes']);_0x394665['query']=_[_0xe444('0x2c')](_0x13b92d[_0xe444('0x26')]);_0x394665['filters']=_['intersection'](_0x394665[_0xe444('0x2b')],_0x394665[_0xe444('0x26')]);_0x3549d0['attributes']=_[_0xe444('0x3b')](_0x394665[_0xe444('0x2b')],qs[_0xe444('0x3c')](_0x13b92d['query'][_0xe444('0x3c')]));_0x3549d0['attributes']=_0x3549d0[_0xe444('0x2e')][_0xe444('0x3d')]?_0x3549d0['attributes']:_0x394665['model'];if(!_0x13b92d[_0xe444('0x26')]['hasOwnProperty'](_0xe444('0x3e'))){_0x3549d0[_0xe444('0xd')]=qs['limit'](_0x13b92d[_0xe444('0x26')][_0xe444('0xd')]);_0x3549d0[_0xe444('0xc')]=qs[_0xe444('0xc')](_0x13b92d[_0xe444('0x26')][_0xe444('0xc')]);}_0x3549d0[_0xe444('0x3f')]=qs[_0xe444('0x40')](_0x13b92d[_0xe444('0x26')][_0xe444('0x40')]);_0x3549d0[_0xe444('0x41')]=qs[_0xe444('0x2d')](_['pick'](_0x13b92d[_0xe444('0x26')],_0x394665[_0xe444('0x2d')]));_0x3549d0['where'][_0xe444('0x42')]=_0x1c584d['id'];if(_0x13b92d['query'][_0xe444('0x43')]){_0x3549d0['where']=_[_0xe444('0x30')](_0x3549d0['where'],{'$or':_[_0xe444('0x1e')](_0x3549d0[_0xe444('0x2e')],function(_0x16aee3){var _0x2abc49={};_0x2abc49[_0x16aee3]={'$like':'%'+_0x13b92d[_0xe444('0x26')]['filter']+'%'};return _0x2abc49;})});}_0x3549d0=_[_0xe444('0x30')]({},_0x3549d0,_0x13b92d[_0xe444('0x31')]);return db['UserFaxQueue'][_0xe444('0x27')](_0x3549d0);}})[_0xe444('0x13')](function(_0x35da1f){if(_0x35da1f){return db[_0xe444('0x44')]['findAndCountAll']({'where':{'id':_[_0xe444('0x1e')](_0x35da1f,_0xe444('0x45')),'role':'agent'},'attributes':['id',_0xe444('0x1b'),_0xe444('0x46'),'updatedAt','createdAt']});}})[_0xe444('0x13')](function(_0x35793c){if(_0x35793c){return{'count':_0x35793c[_0xe444('0xe')],'rows':_[_0xe444('0x1e')](_0x35793c['rows'],function(_0xc4daf7){return{'membername':_0xc4daf7['name'],'UserId':_0xc4daf7['id'],'queue_name':_0xbbd474[_0xe444('0x1b')],'FaxQueueId':_0xbbd474['id'],'interface':util[_0xe444('0x47')](_0xe444('0x48'),_0xe444('0x49'),_0xc4daf7[_0xe444('0x1b')]),'penalty':0x0,'paused':_0xc4daf7['faxPause'],'createdAt':_0xc4daf7[_0xe444('0x4a')],'updatedAt':_0xc4daf7[_0xe444('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f96bb,_0x3549d0))[_0xe444('0x29')](handleError(_0x3f96bb,null));};exports[_0xe444('0x4c')]=function(_0x3a9acf,_0x211d70){var _0x20796f={};var _0x273d54={};var _0x1c744e;var _0x410311;return db[_0xe444('0x24')][_0xe444('0x3a')]({'where':{'id':_0x3a9acf[_0xe444('0x2a')]['id']}})['then'](handleEntityNotFound(_0x211d70,null))[_0xe444('0x13')](function(_0x2d0b20){if(_0x2d0b20){_0x1c744e=_0x2d0b20;_0x273d54['model']=_[_0xe444('0x2c')](db['Team'][_0xe444('0x1f')]);_0x273d54[_0xe444('0x26')]=_[_0xe444('0x2c')](_0x3a9acf[_0xe444('0x26')]);_0x273d54['filters']=_[_0xe444('0x3b')](_0x273d54[_0xe444('0x2b')],_0x273d54['query']);_0x20796f[_0xe444('0x2e')]=_[_0xe444('0x3b')](_0x273d54['model'],qs[_0xe444('0x3c')](_0x3a9acf[_0xe444('0x26')][_0xe444('0x3c')]));_0x20796f['attributes']=_0x20796f[_0xe444('0x2e')][_0xe444('0x3d')]?_0x20796f['attributes']:_0x273d54[_0xe444('0x2b')];_0x20796f[_0xe444('0x3f')]=qs[_0xe444('0x40')](_0x3a9acf[_0xe444('0x26')][_0xe444('0x40')]);_0x20796f[_0xe444('0x41')]=qs[_0xe444('0x2d')](_[_0xe444('0x4d')](_0x3a9acf['query'],_0x273d54[_0xe444('0x2d')]));if(_0x3a9acf[_0xe444('0x26')][_0xe444('0x43')]){_0x20796f[_0xe444('0x41')]=_['merge'](_0x20796f[_0xe444('0x41')],{'$or':_[_0xe444('0x1e')](_0x20796f[_0xe444('0x2e')],function(_0x4b7f07){var _0x3d85a0={};_0x3d85a0[_0x4b7f07]={'$like':'%'+_0x3a9acf[_0xe444('0x26')][_0xe444('0x43')]+'%'};return _0x3d85a0;})});}_0x20796f=_[_0xe444('0x30')]({},_0x20796f,_0x3a9acf[_0xe444('0x31')]);return _0x1c744e[_0xe444('0x4c')](_0x20796f);}})[_0xe444('0x13')](function(_0x365d7f){if(_0x365d7f){_0x410311=_0x365d7f[_0xe444('0x3d')];if(!_0x3a9acf[_0xe444('0x26')][_0xe444('0x4e')]('nolimit')){_0x20796f[_0xe444('0xd')]=qs[_0xe444('0xd')](_0x3a9acf[_0xe444('0x26')]['limit']);_0x20796f[_0xe444('0xc')]=qs[_0xe444('0xc')](_0x3a9acf['query'][_0xe444('0xc')]);}return _0x1c744e[_0xe444('0x4c')](_0x20796f);}})[_0xe444('0x13')](function(_0x4b6ed4){if(_0x4b6ed4){return _0x4b6ed4?{'count':_0x410311,'rows':_0x4b6ed4}:null;}})[_0xe444('0x13')](respondWithResult(_0x211d70,null))[_0xe444('0x29')](handleError(_0x211d70,null));};exports[_0xe444('0x4f')]=function(_0x17ed5c,_0xa26b2){var _0x558190=_0x17ed5c['body'][_0xe444('0x50')];return db['Team'][_0xe444('0x27')]({'where':{'id':_0x558190},'attributes':['id'],'include':[{'model':db[_0xe444('0x44')],'as':_0xe444('0x51'),'attributes':['id','name',_0xe444('0x52'),'voicePause',_0xe444('0x53')],'raw':!![]}]})[_0xe444('0x13')](function(_0x4d3dfa){if(_0x4d3dfa){var _0x5e7e4b=_['flatMap'](_0x4d3dfa,function(_0x2ac3a1){var _0x57344f=_0x2ac3a1[_0xe444('0x15')]({'plain':!![]});return _0x57344f['Agents'];});return db['FaxQueue'][_0xe444('0x36')]({'where':{'id':_0x17ed5c[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](function(_0x936b6d){return db['sequelize']['transaction'](function(_0x10f7b0){return _0x936b6d['addTeams'](_0x558190,{'transaction':_0x10f7b0})[_0xe444('0x13')](function(){return BPromise[_0xe444('0x54')](_0x5e7e4b,function(_0x4ff543){return db['UserFaxQueue'][_0xe444('0x55')]({'where':{'UserId':_0x4ff543['id'],'FaxQueueId':_0x17ed5c[_0xe444('0x2a')]['id']},'transaction':_0x10f7b0});});})[_0xe444('0x13')](function(){_0x5e7e4b[_0xe444('0x56')](function(_0x10d76f){socket[_0xe444('0x57')](_0xe444('0x58'),{'UserId':_0x10d76f['id'],'FaxQueueId':_0x936b6d['id']});});});});});}})[_0xe444('0x13')](respondWithStatusCode(_0xa26b2,null))['catch'](handleError(_0xa26b2,null));};exports[_0xe444('0x59')]=function(_0x4fc53a,_0x395707){return db[_0xe444('0x5a')][_0xe444('0x27')]({'where':{'id':_0x4fc53a[_0xe444('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe444('0x44')],'as':_0xe444('0x51'),'attributes':['id'],'raw':!![]}]})[_0xe444('0x13')](handleEntityNotFound(_0x395707,null))[_0xe444('0x13')](function(_0x2e33e0){var _0x5001fa=_[_0xe444('0x1e')](_0x2e33e0,'id');var _0x433304=[];var _0x1d7b58=[];var _0x466c5c=squel[_0xe444('0x5b')]();_0x466c5c[_0xe444('0x5c')]('tq.TeamId')[_0xe444('0x5d')](_0xe444('0x5e'),'tq')[_0xe444('0x5f')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe444('0x41')](_0xe444('0x60'),_0x4fc53a[_0xe444('0x2a')]['id']);for(var _0x1675c8=0x0;_0x1675c8<_0x2e33e0[_0xe444('0x3d')];_0x1675c8+=0x1){let _0x2b8de6=_0x2e33e0[_0x1675c8];for(var _0xb5039a=0x0;_0xb5039a<_0x2b8de6['Agents'][_0xe444('0x3d')];_0xb5039a+=0x1){let _0x42789d=_0x2b8de6[_0xe444('0x51')][_0xb5039a];var _0x5027da=_0x466c5c[_0xe444('0x61')]();_0x5027da[_0xe444('0x41')]('ut.UserId\x20=\x20?',_0x42789d['id']);_0x1d7b58[_0xe444('0x62')](db['sequelize']['query'](_0x5027da[_0xe444('0x63')](),{'type':db[_0xe444('0x64')][_0xe444('0x65')]['SELECT']})[_0xe444('0x13')](function(_0x3b5d9c){if(_0x3b5d9c[_0xe444('0x3d')]===0x1){return _0x42789d['id'];}else{var _0x51b876=_[_0xe444('0x66')](_[_0xe444('0x1e')](_0x3b5d9c,'TeamId'),function(_0xb20f20){return _['includes'](_0x5001fa,_0xb20f20);});if(_0x51b876){return _0x42789d['id'];}}}));}}return BPromise[_0xe444('0x67')](_0x1d7b58)['then'](function(_0x1372a7){_0x433304=_(_0x433304)['union'](_0x1372a7)[_0xe444('0x68')]()[_0xe444('0x69')]();return db[_0xe444('0x24')][_0xe444('0x36')]({'where':{'id':_0x4fc53a[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](function(_0x517f69){return db[_0xe444('0x64')][_0xe444('0x6a')](function(_0xb30cb6){return _0x517f69[_0xe444('0x59')](_0x4fc53a[_0xe444('0x26')][_0xe444('0x50')],{'transaction':_0xb30cb6})['then'](function(){if(!_[_0xe444('0x6b')](_0x433304)){return _0x517f69[_0xe444('0x6c')](_0x433304,{'transaction':_0xb30cb6});}})[_0xe444('0x13')](function(){_0x433304[_0xe444('0x56')](function(_0x4cda77){socket[_0xe444('0x57')](_0xe444('0x6d'),{'UserId':_0x4cda77,'FaxQueueId':_0x517f69['id']});});});});});});})['then'](respondWithStatusCode(_0x395707,null))[_0xe444('0x29')](handleError(_0x395707,null));};exports[_0xe444('0x6e')]=function(_0x356445,_0x5b863c){return db[_0xe444('0x24')]['find']({'where':{'id':_0x356445[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](handleEntityNotFound(_0x5b863c,null))[_0xe444('0x13')](function(_0x3f1842){if(_0x3f1842){return _0x3f1842[_0xe444('0x6e')](_0x356445[_0xe444('0x33')][_0xe444('0x50')],_[_0xe444('0x6f')](_0x356445[_0xe444('0x33')],[_0xe444('0x50'),'id'])||{})[_0xe444('0x70')](function(_0x103ed0){for(var _0x34deff=0x0;_0x34deff<_0x356445['body'][_0xe444('0x50')]['length'];_0x34deff+=0x1){socket[_0xe444('0x57')](_0xe444('0x58'),{'UserId':Number(_0x356445[_0xe444('0x33')][_0xe444('0x50')][_0x34deff]),'FaxQueueId':Number(_0x356445[_0xe444('0x2a')]['id'])});}return _0x103ed0;});}})[_0xe444('0x13')](respondWithResult(_0x5b863c,null))[_0xe444('0x29')](handleError(_0x5b863c,null));};exports[_0xe444('0x6c')]=function(_0x5a7c24,_0x32d87f){return db[_0xe444('0x24')][_0xe444('0x36')]({'where':{'id':_0x5a7c24[_0xe444('0x2a')]['id']}})[_0xe444('0x13')](handleEntityNotFound(_0x32d87f,null))['then'](function(_0x1fa6fa){if(_0x1fa6fa){return _0x1fa6fa['removeAgents'](_0x5a7c24[_0xe444('0x26')][_0xe444('0x50')])['then'](function(){if(_['isArray'](_0x5a7c24[_0xe444('0x26')][_0xe444('0x50')])){for(var _0x592b5a=0x0;_0x592b5a<_0x5a7c24[_0xe444('0x26')][_0xe444('0x50')][_0xe444('0x3d')];_0x592b5a+=0x1){socket[_0xe444('0x57')]('userFaxQueue:remove',{'UserId':Number(_0x5a7c24[_0xe444('0x26')]['ids'][_0x592b5a]),'FaxQueueId':Number(_0x5a7c24[_0xe444('0x2a')]['id'])});}}else{socket[_0xe444('0x57')]('userFaxQueue:remove',{'UserId':Number(_0x5a7c24[_0xe444('0x26')][_0xe444('0x50')]),'FaxQueueId':Number(_0x5a7c24[_0xe444('0x2a')]['id'])});}});}})[_0xe444('0x13')](respondWithStatusCode(_0x32d87f,null))[_0xe444('0x29')](handleError(_0x32d87f,null));};exports[_0xe444('0x71')]=function(_0x1bc594,_0x15279f){var _0x4692b5={};var _0x40d8e4={};var _0x2d5a9c;var _0x281db5;return db[_0xe444('0x24')][_0xe444('0x3a')]({'where':{'id':_0x1bc594[_0xe444('0x2a')]['id']}})['then'](handleEntityNotFound(_0x15279f,null))[_0xe444('0x13')](function(_0x106383){if(_0x106383){_0x2d5a9c=_0x106383;_0x40d8e4[_0xe444('0x2b')]=_[_0xe444('0x2c')](db[_0xe444('0x44')][_0xe444('0x1f')]);_0x40d8e4[_0xe444('0x26')]=_['keys'](_0x1bc594[_0xe444('0x26')]);_0x40d8e4[_0xe444('0x2d')]=_[_0xe444('0x3b')](_0x40d8e4[_0xe444('0x2b')],_0x40d8e4[_0xe444('0x26')]);_0x4692b5['attributes']=_[_0xe444('0x3b')](_0x40d8e4[_0xe444('0x2b')],qs['fields'](_0x1bc594[_0xe444('0x26')][_0xe444('0x3c')]));_0x4692b5[_0xe444('0x2e')]=_0x4692b5[_0xe444('0x2e')]['length']?_0x4692b5[_0xe444('0x2e')]:_0x40d8e4[_0xe444('0x2b')];_0x4692b5[_0xe444('0x3f')]=qs[_0xe444('0x40')](_0x1bc594['query'][_0xe444('0x40')]);_0x4692b5[_0xe444('0x41')]=qs[_0xe444('0x2d')](_['pick'](_0x1bc594[_0xe444('0x26')],_0x40d8e4['filters']));if(_0x1bc594[_0xe444('0x26')][_0xe444('0x43')]){_0x4692b5[_0xe444('0x41')]=_[_0xe444('0x30')](_0x4692b5[_0xe444('0x41')],{'$or':_[_0xe444('0x1e')](_0x4692b5[_0xe444('0x2e')],function(_0x232d08){var _0xb32dd0={};_0xb32dd0[_0x232d08]={'$like':'%'+_0x1bc594[_0xe444('0x26')][_0xe444('0x43')]+'%'};return _0xb32dd0;})});}_0x4692b5=_[_0xe444('0x30')]({},_0x4692b5,_0x1bc594[_0xe444('0x31')]);return _0x2d5a9c[_0xe444('0x71')](_0x4692b5);}})['then'](function(_0x18a436){if(_0x18a436){_0x281db5=_0x18a436[_0xe444('0x3d')];if(!_0x1bc594[_0xe444('0x26')][_0xe444('0x4e')](_0xe444('0x3e'))){_0x4692b5[_0xe444('0xd')]=qs[_0xe444('0xd')](_0x1bc594[_0xe444('0x26')]['limit']);_0x4692b5[_0xe444('0xc')]=qs[_0xe444('0xc')](_0x1bc594[_0xe444('0x26')][_0xe444('0xc')]);}return _0x2d5a9c['getAgents'](_0x4692b5);}})[_0xe444('0x13')](function(_0x43d40d){if(_0x43d40d){return _0x43d40d?{'count':_0x281db5,'rows':_0x43d40d}:null;}})['then'](respondWithResult(_0x15279f,null))[_0xe444('0x29')](handleError(_0x15279f,null));}; \ No newline at end of file +var _0x6d19=['localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','end','error','stack','name','index','map','type','key','getOptions','where','include','query','rows','catch','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','includeAll','merge','FaxQueue','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','describe','getMembers','findOne','UserFaxQueue','length','hasOwnProperty','nolimit','sort','filter','options','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','pick','addTeams','ids','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0x6d19,0x160));var _0x96d1=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x6d19[_0x4ed4d2];return _0x15ae2e;};'use strict';var BPromise=require(_0x96d1('0x0'));var util=require(_0x96d1('0x1'));var _=require(_0x96d1('0x2'));var squel=require(_0x96d1('0x3'));var Redis=require(_0x96d1('0x4'));var qs=require(_0x96d1('0x5'));var logger=require(_0x96d1('0x6'))('api');var config=require(_0x96d1('0x7'));var db=require(_0x96d1('0x8'))['db'];config[_0x96d1('0x9')]=_[_0x96d1('0xa')](config['redis'],{'host':_0x96d1('0xb'),'port':0x18eb});var socket=require(_0x96d1('0xc'))(new Redis(config[_0x96d1('0x9')]));require('./faxQueue.socket')[_0x96d1('0xd')](socket);function respondWithStatusCode(_0x3f7a36,_0x163b0a){_0x163b0a=_0x163b0a||0xcc;return function(_0x4e1e7a){if(_0x4e1e7a){return _0x3f7a36[_0x96d1('0xe')](_0x163b0a);}return _0x3f7a36[_0x96d1('0xf')](_0x163b0a)['end']();};}function respondWithResult(_0x4bd620,_0x44e65d){_0x44e65d=_0x44e65d||0xc8;return function(_0x2de9e3){if(_0x2de9e3){return _0x4bd620['status'](_0x44e65d)[_0x96d1('0x10')](_0x2de9e3);}};}function respondWithFilteredResult(_0x51b089,_0x15b2c1){return function(_0x3c52f1){if(_0x3c52f1){var _0x31b953=typeof _0x15b2c1[_0x96d1('0x11')]===_0x96d1('0x12')&&typeof _0x15b2c1[_0x96d1('0x13')]==='undefined';var _0x35e728=_0x3c52f1[_0x96d1('0x14')];var _0x10e057=_0x31b953?0x0:_0x15b2c1[_0x96d1('0x11')];var _0x2fd5c6=_0x31b953?_0x3c52f1['count']:_0x15b2c1['offset']+_0x15b2c1[_0x96d1('0x13')];var _0x446023;if(_0x2fd5c6>=_0x35e728){_0x2fd5c6=_0x35e728;_0x446023=0xc8;}else{_0x446023=0xce;}_0x51b089[_0x96d1('0xf')](_0x446023);return _0x51b089[_0x96d1('0x15')](_0x96d1('0x16'),_0x10e057+'-'+_0x2fd5c6+'/'+_0x35e728)[_0x96d1('0x10')](_0x3c52f1);}return null;};}function saveUpdates(_0x45dc6f){return function(_0x455751){if(_0x455751){return _0x455751[_0x96d1('0x17')](_0x45dc6f)['then'](function(_0x18c73f){return _0x18c73f;});}return null;};}function removeEntity(_0x1c3540){return function(_0x3ed4ff){if(_0x3ed4ff){return _0x3ed4ff[_0x96d1('0x18')]()[_0x96d1('0x19')](function(){var _0x4ae4c5=_0x3ed4ff[_0x96d1('0x1a')]({'plain':!![]});var _0x28ad24=_0x96d1('0x1b');return db[_0x96d1('0x1c')]['destroy']({'where':{'type':_0x28ad24,'resourceId':_0x4ae4c5['id']}})[_0x96d1('0x19')](function(){return _0x3ed4ff;});})[_0x96d1('0x19')](function(){_0x1c3540[_0x96d1('0xf')](0xcc)[_0x96d1('0x1d')]();});}};}function handleEntityNotFound(_0x54af14){return function(_0x339ce1){if(!_0x339ce1){_0x54af14[_0x96d1('0xe')](0x194);}return _0x339ce1;};}function handleError(_0x186bae,_0x1390ac){_0x1390ac=_0x1390ac||0x1f4;return function(_0x5a0584){logger[_0x96d1('0x1e')](_0x5a0584[_0x96d1('0x1f')]);if(_0x5a0584['name']){delete _0x5a0584[_0x96d1('0x20')];}_0x186bae[_0x96d1('0xf')](_0x1390ac)['send'](_0x5a0584);};}exports[_0x96d1('0x21')]=function(_0x153cad,_0x1c3399){var _0x5462ec={};var _0x424d1e={'count':0x0,'rows':[]};var _0x46aa64=_[_0x96d1('0x22')](db['FaxQueue']['rawAttributes'],function(_0xd88eb7){return{'name':_0xd88eb7['fieldName'],'type':_0xd88eb7[_0x96d1('0x23')][_0x96d1('0x24')]};});_0x5462ec=qs[_0x96d1('0x25')](_0x46aa64,_0x153cad);var _0x312394={'where':_0x5462ec[_0x96d1('0x26')]};return db['FaxQueue'][_0x96d1('0x14')](_0x312394)[_0x96d1('0x19')](function(_0x433b36){_0x424d1e[_0x96d1('0x14')]=_0x433b36;_0x5462ec[_0x96d1('0x27')]=qs[_0x96d1('0x27')](_0x153cad[_0x96d1('0x28')]);return db['FaxQueue']['findAll'](_0x5462ec);})[_0x96d1('0x19')](function(_0x266d2c){_0x424d1e[_0x96d1('0x29')]=_0x266d2c;return _0x424d1e;})[_0x96d1('0x19')](respondWithFilteredResult(_0x1c3399,_0x5462ec))[_0x96d1('0x2a')](handleError(_0x1c3399,null));};exports[_0x96d1('0x2b')]=function(_0x5938ce,_0x148d6c){var _0x24bab3={'raw':!![],'where':{'id':_0x5938ce[_0x96d1('0x2c')]['id']}},_0x4b7e21={};_0x4b7e21[_0x96d1('0x2d')]=_[_0x96d1('0x2e')](db['FaxQueue'][_0x96d1('0x2f')]);_0x4b7e21[_0x96d1('0x28')]=_[_0x96d1('0x2e')](_0x5938ce[_0x96d1('0x28')]);_0x4b7e21[_0x96d1('0x30')]=_[_0x96d1('0x31')](_0x4b7e21['model'],_0x4b7e21[_0x96d1('0x28')]);_0x24bab3['attributes']=_['intersection'](_0x4b7e21['model'],qs[_0x96d1('0x32')](_0x5938ce[_0x96d1('0x28')][_0x96d1('0x32')]));_0x24bab3[_0x96d1('0x33')]=_0x24bab3[_0x96d1('0x33')]['length']?_0x24bab3[_0x96d1('0x33')]:_0x4b7e21[_0x96d1('0x2d')];if(_0x5938ce[_0x96d1('0x28')][_0x96d1('0x34')]){_0x24bab3[_0x96d1('0x27')]=[{'all':!![]}];}_0x24bab3=_[_0x96d1('0x35')]({},_0x24bab3,_0x5938ce['options']);return db[_0x96d1('0x36')][_0x96d1('0x37')](_0x24bab3)[_0x96d1('0x19')](handleEntityNotFound(_0x148d6c,null))[_0x96d1('0x19')](respondWithResult(_0x148d6c,null))[_0x96d1('0x2a')](handleError(_0x148d6c,null));};exports[_0x96d1('0x38')]=function(_0x4610eb,_0x4d70be){return db['FaxQueue'][_0x96d1('0x38')](_0x4610eb[_0x96d1('0x39')],{})[_0x96d1('0x19')](function(_0x309964){var _0xc87d85=_0x4610eb['user'][_0x96d1('0x1a')]({'plain':!![]});if(!_0xc87d85)throw new Error(_0x96d1('0x3a'));if(_0xc87d85['role']===_0x96d1('0x3b')){var _0x26439c=_0x309964[_0x96d1('0x1a')]({'plain':!![]});var _0x3b13cd='FaxQueues';return db[_0x96d1('0x3c')]['find']({'where':{'name':_0x3b13cd,'userProfileId':_0xc87d85['userProfileId']},'raw':!![]})[_0x96d1('0x19')](function(_0x3e10f3){if(_0x3e10f3&&_0x3e10f3['autoAssociation']===0x0){return db['UserProfileResource'][_0x96d1('0x38')]({'name':_0x26439c['name'],'resourceId':_0x26439c['id'],'type':_0x3e10f3[_0x96d1('0x20')],'sectionId':_0x3e10f3['id']},{})['then'](function(){return _0x309964;});}else{return _0x309964;}})[_0x96d1('0x2a')](function(_0x525045){logger[_0x96d1('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x525045);throw _0x525045;});}return _0x309964;})['then'](respondWithResult(_0x4d70be,0xc9))[_0x96d1('0x2a')](handleError(_0x4d70be,null));};exports['update']=function(_0x59f0e7,_0x1244ed){if(_0x59f0e7[_0x96d1('0x39')]['id']){delete _0x59f0e7[_0x96d1('0x39')]['id'];}return db[_0x96d1('0x36')][_0x96d1('0x37')]({'where':{'id':_0x59f0e7['params']['id']}})['then'](handleEntityNotFound(_0x1244ed,null))['then'](saveUpdates(_0x59f0e7[_0x96d1('0x39')],null))[_0x96d1('0x19')](respondWithResult(_0x1244ed,null))[_0x96d1('0x2a')](handleError(_0x1244ed,null));};exports[_0x96d1('0x18')]=function(_0x36ba8b,_0x1b4267){return db['FaxQueue']['find']({'where':{'id':_0x36ba8b[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0x1b4267,null))[_0x96d1('0x19')](removeEntity(_0x1b4267,null))[_0x96d1('0x2a')](handleError(_0x1b4267,null));};exports[_0x96d1('0x3d')]=function(_0x29755d,_0x90bc88){return db[_0x96d1('0x36')]['describe']()['then'](respondWithResult(_0x90bc88,null))[_0x96d1('0x2a')](handleError(_0x90bc88,null));};exports[_0x96d1('0x3e')]=function(_0x56ac15,_0xe9a96e){var _0x4cabf5={'raw':!![],'where':{}},_0x3e347b={},_0x16ac35;return db[_0x96d1('0x36')][_0x96d1('0x3f')]({'where':{'id':_0x56ac15[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0xe9a96e,null))['then'](function(_0xa1bd8d){if(_0xa1bd8d){_0x16ac35=_0xa1bd8d[_0x96d1('0x1a')]({'plain':!![]});_0x3e347b['model']=_[_0x96d1('0x2e')](db[_0x96d1('0x40')][_0x96d1('0x2f')]);_0x3e347b[_0x96d1('0x28')]=_[_0x96d1('0x2e')](_0x56ac15[_0x96d1('0x28')]);_0x3e347b[_0x96d1('0x30')]=_[_0x96d1('0x31')](_0x3e347b[_0x96d1('0x2d')],_0x3e347b[_0x96d1('0x28')]);_0x4cabf5[_0x96d1('0x33')]=_[_0x96d1('0x31')](_0x3e347b[_0x96d1('0x2d')],qs[_0x96d1('0x32')](_0x56ac15['query'][_0x96d1('0x32')]));_0x4cabf5[_0x96d1('0x33')]=_0x4cabf5[_0x96d1('0x33')][_0x96d1('0x41')]?_0x4cabf5[_0x96d1('0x33')]:_0x3e347b[_0x96d1('0x2d')];if(!_0x56ac15['query'][_0x96d1('0x42')](_0x96d1('0x43'))){_0x4cabf5['limit']=qs[_0x96d1('0x13')](_0x56ac15[_0x96d1('0x28')][_0x96d1('0x13')]);_0x4cabf5['offset']=qs[_0x96d1('0x11')](_0x56ac15['query'][_0x96d1('0x11')]);}_0x4cabf5['order']=qs[_0x96d1('0x44')](_0x56ac15[_0x96d1('0x28')][_0x96d1('0x44')]);_0x4cabf5[_0x96d1('0x26')]=qs[_0x96d1('0x30')](_['pick'](_0x56ac15[_0x96d1('0x28')],_0x3e347b[_0x96d1('0x30')]));_0x4cabf5[_0x96d1('0x26')]['FaxQueueId']=_0xa1bd8d['id'];if(_0x56ac15[_0x96d1('0x28')][_0x96d1('0x45')]){_0x4cabf5['where']=_['merge'](_0x4cabf5[_0x96d1('0x26')],{'$or':_[_0x96d1('0x22')](_0x4cabf5[_0x96d1('0x33')],function(_0x5228f5){var _0xc21ea3={};_0xc21ea3[_0x5228f5]={'$like':'%'+_0x56ac15['query'][_0x96d1('0x45')]+'%'};return _0xc21ea3;})});}_0x4cabf5=_[_0x96d1('0x35')]({},_0x4cabf5,_0x56ac15[_0x96d1('0x46')]);return db['UserFaxQueue'][_0x96d1('0x47')](_0x4cabf5);}})[_0x96d1('0x19')](function(_0x9317e){if(_0x9317e){return db[_0x96d1('0x48')][_0x96d1('0x49')]({'where':{'id':_[_0x96d1('0x22')](_0x9317e,_0x96d1('0x4a')),'role':_0x96d1('0x4b')},'attributes':['id',_0x96d1('0x20'),'faxPause',_0x96d1('0x4c'),_0x96d1('0x4d')]});}})[_0x96d1('0x19')](function(_0x2f2f93){if(_0x2f2f93){return{'count':_0x2f2f93[_0x96d1('0x14')],'rows':_[_0x96d1('0x22')](_0x2f2f93[_0x96d1('0x29')],function(_0x36b1d5){return{'membername':_0x36b1d5[_0x96d1('0x20')],'UserId':_0x36b1d5['id'],'queue_name':_0x16ac35['name'],'FaxQueueId':_0x16ac35['id'],'interface':util[_0x96d1('0x4e')](_0x96d1('0x4f'),_0x96d1('0x50'),_0x36b1d5['name']),'penalty':0x0,'paused':_0x36b1d5['faxPause'],'createdAt':_0x36b1d5['createdAt'],'updatedAt':_0x36b1d5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x96d1('0x19')](respondWithFilteredResult(_0xe9a96e,_0x4cabf5))[_0x96d1('0x2a')](handleError(_0xe9a96e,null));};exports[_0x96d1('0x51')]=function(_0x371fe3,_0x38c243){var _0x2c2016={};var _0x54e23f={};var _0x2e6474;var _0x151613;return db[_0x96d1('0x36')][_0x96d1('0x3f')]({'where':{'id':_0x371fe3[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0x38c243,null))[_0x96d1('0x19')](function(_0x2f81ab){if(_0x2f81ab){_0x2e6474=_0x2f81ab;_0x54e23f[_0x96d1('0x2d')]=_[_0x96d1('0x2e')](db[_0x96d1('0x52')]['rawAttributes']);_0x54e23f['query']=_[_0x96d1('0x2e')](_0x371fe3[_0x96d1('0x28')]);_0x54e23f[_0x96d1('0x30')]=_[_0x96d1('0x31')](_0x54e23f[_0x96d1('0x2d')],_0x54e23f[_0x96d1('0x28')]);_0x2c2016[_0x96d1('0x33')]=_[_0x96d1('0x31')](_0x54e23f[_0x96d1('0x2d')],qs['fields'](_0x371fe3['query'][_0x96d1('0x32')]));_0x2c2016[_0x96d1('0x33')]=_0x2c2016[_0x96d1('0x33')][_0x96d1('0x41')]?_0x2c2016[_0x96d1('0x33')]:_0x54e23f[_0x96d1('0x2d')];_0x2c2016[_0x96d1('0x53')]=qs[_0x96d1('0x44')](_0x371fe3[_0x96d1('0x28')][_0x96d1('0x44')]);_0x2c2016[_0x96d1('0x26')]=qs['filters'](_[_0x96d1('0x54')](_0x371fe3[_0x96d1('0x28')],_0x54e23f[_0x96d1('0x30')]));if(_0x371fe3[_0x96d1('0x28')][_0x96d1('0x45')]){_0x2c2016[_0x96d1('0x26')]=_[_0x96d1('0x35')](_0x2c2016[_0x96d1('0x26')],{'$or':_['map'](_0x2c2016['attributes'],function(_0x4341c3){var _0x45aea1={};_0x45aea1[_0x4341c3]={'$like':'%'+_0x371fe3['query'][_0x96d1('0x45')]+'%'};return _0x45aea1;})});}_0x2c2016=_[_0x96d1('0x35')]({},_0x2c2016,_0x371fe3[_0x96d1('0x46')]);return _0x2e6474['getTeams'](_0x2c2016);}})['then'](function(_0x530a63){if(_0x530a63){_0x151613=_0x530a63['length'];if(!_0x371fe3[_0x96d1('0x28')]['hasOwnProperty'](_0x96d1('0x43'))){_0x2c2016[_0x96d1('0x13')]=qs[_0x96d1('0x13')](_0x371fe3[_0x96d1('0x28')]['limit']);_0x2c2016[_0x96d1('0x11')]=qs['offset'](_0x371fe3[_0x96d1('0x28')][_0x96d1('0x11')]);}return _0x2e6474['getTeams'](_0x2c2016);}})[_0x96d1('0x19')](function(_0x2bcdfe){if(_0x2bcdfe){return _0x2bcdfe?{'count':_0x151613,'rows':_0x2bcdfe}:null;}})[_0x96d1('0x19')](respondWithResult(_0x38c243,null))['catch'](handleError(_0x38c243,null));};exports[_0x96d1('0x55')]=function(_0x5a2a70,_0x57c7f4){var _0x4ce12e=_0x5a2a70[_0x96d1('0x39')][_0x96d1('0x56')];return db[_0x96d1('0x52')][_0x96d1('0x47')]({'where':{'id':_0x4ce12e},'attributes':['id'],'include':[{'model':db[_0x96d1('0x48')],'as':_0x96d1('0x57'),'attributes':['id',_0x96d1('0x20'),_0x96d1('0x58'),'voicePause',_0x96d1('0x59')],'raw':!![]}]})[_0x96d1('0x19')](function(_0x4cc65c){if(_0x4cc65c){var _0x497ebc=_[_0x96d1('0x5a')](_0x4cc65c,function(_0x5ac127){var _0x308c41=_0x5ac127['get']({'plain':!![]});return _0x308c41['Agents'];});return db[_0x96d1('0x36')][_0x96d1('0x37')]({'where':{'id':_0x5a2a70['params']['id']}})[_0x96d1('0x19')](function(_0x2be742){return db['sequelize'][_0x96d1('0x5b')](function(_0x59572f){return _0x2be742[_0x96d1('0x55')](_0x4ce12e,{'transaction':_0x59572f})[_0x96d1('0x19')](function(){return BPromise[_0x96d1('0x5c')](_0x497ebc,function(_0x30cc6d){return db[_0x96d1('0x40')][_0x96d1('0x5d')]({'where':{'UserId':_0x30cc6d['id'],'FaxQueueId':_0x5a2a70['params']['id']},'transaction':_0x59572f});});})[_0x96d1('0x19')](function(){_0x497ebc[_0x96d1('0x5e')](function(_0x3f1325){socket[_0x96d1('0x5f')](_0x96d1('0x60'),{'UserId':_0x3f1325['id'],'FaxQueueId':_0x2be742['id']});});});});});}})[_0x96d1('0x19')](respondWithStatusCode(_0x57c7f4,null))[_0x96d1('0x2a')](handleError(_0x57c7f4,null));};exports[_0x96d1('0x61')]=function(_0x52277b,_0x471b38){return db[_0x96d1('0x52')][_0x96d1('0x47')]({'where':{'id':_0x52277b[_0x96d1('0x28')][_0x96d1('0x56')]},'attributes':['id'],'include':[{'model':db[_0x96d1('0x48')],'as':_0x96d1('0x57'),'attributes':['id'],'raw':!![]}]})[_0x96d1('0x19')](handleEntityNotFound(_0x471b38,null))['then'](function(_0x4354c3){var _0x13266d=_[_0x96d1('0x22')](_0x4354c3,'id');var _0x5e0a48=[];var _0x3785d7=[];var _0x5a5842=squel[_0x96d1('0x62')]();_0x5a5842[_0x96d1('0x63')](_0x96d1('0x64'))['from'](_0x96d1('0x65'),'tq')[_0x96d1('0x66')]('user_has_teams','ut',_0x96d1('0x67'))[_0x96d1('0x26')]('FaxQueueId\x20=\x20?',_0x52277b[_0x96d1('0x2c')]['id']);for(var _0x3d7bfd=0x0;_0x3d7bfd<_0x4354c3[_0x96d1('0x41')];_0x3d7bfd+=0x1){let _0x2df9e7=_0x4354c3[_0x3d7bfd];for(var _0x5986ae=0x0;_0x5986ae<_0x2df9e7[_0x96d1('0x57')][_0x96d1('0x41')];_0x5986ae+=0x1){let _0x3f3024=_0x2df9e7[_0x96d1('0x57')][_0x5986ae];var _0x339ee9=_0x5a5842['clone']();_0x339ee9[_0x96d1('0x26')](_0x96d1('0x68'),_0x3f3024['id']);_0x3785d7[_0x96d1('0x69')](db['sequelize'][_0x96d1('0x28')](_0x339ee9['toString'](),{'type':db[_0x96d1('0x6a')][_0x96d1('0x6b')][_0x96d1('0x6c')]})['then'](function(_0x575e59){if(_0x575e59[_0x96d1('0x41')]===0x1){return _0x3f3024['id'];}else{var _0xe3c728=_[_0x96d1('0x6d')](_['map'](_0x575e59,_0x96d1('0x6e')),function(_0x5cdbce){return _[_0x96d1('0x6f')](_0x13266d,_0x5cdbce);});if(_0xe3c728){return _0x3f3024['id'];}}}));}}return BPromise[_0x96d1('0x70')](_0x3785d7)['then'](function(_0x2b1349){_0x5e0a48=_(_0x5e0a48)['union'](_0x2b1349)['compact']()[_0x96d1('0x71')]();return db[_0x96d1('0x36')][_0x96d1('0x37')]({'where':{'id':_0x52277b[_0x96d1('0x2c')]['id']}})['then'](function(_0x3bbbc0){return db[_0x96d1('0x6a')]['transaction'](function(_0x3e05c3){return _0x3bbbc0[_0x96d1('0x61')](_0x52277b[_0x96d1('0x28')][_0x96d1('0x56')],{'transaction':_0x3e05c3})[_0x96d1('0x19')](function(){if(!_['isEmpty'](_0x5e0a48)){return _0x3bbbc0[_0x96d1('0x72')](_0x5e0a48,{'transaction':_0x3e05c3});}})[_0x96d1('0x19')](function(){_0x5e0a48[_0x96d1('0x5e')](function(_0x40450f){socket[_0x96d1('0x5f')](_0x96d1('0x73'),{'UserId':_0x40450f,'FaxQueueId':_0x3bbbc0['id']});});});});});});})[_0x96d1('0x19')](respondWithStatusCode(_0x471b38,null))['catch'](handleError(_0x471b38,null));};exports[_0x96d1('0x74')]=function(_0x2dd021,_0x311142){return db[_0x96d1('0x36')][_0x96d1('0x37')]({'where':{'id':_0x2dd021['params']['id']}})['then'](handleEntityNotFound(_0x311142,null))['then'](function(_0xf0b620){if(_0xf0b620){return _0xf0b620[_0x96d1('0x74')](_0x2dd021[_0x96d1('0x39')][_0x96d1('0x56')],_[_0x96d1('0x75')](_0x2dd021['body'],['ids','id'])||{})[_0x96d1('0x76')](function(_0x5957ca){for(var _0x521214=0x0;_0x521214<_0x2dd021[_0x96d1('0x39')][_0x96d1('0x56')]['length'];_0x521214+=0x1){socket[_0x96d1('0x5f')](_0x96d1('0x60'),{'UserId':Number(_0x2dd021[_0x96d1('0x39')][_0x96d1('0x56')][_0x521214]),'FaxQueueId':Number(_0x2dd021[_0x96d1('0x2c')]['id'])});}return _0x5957ca;});}})['then'](respondWithResult(_0x311142,null))[_0x96d1('0x2a')](handleError(_0x311142,null));};exports['removeAgents']=function(_0x128098,_0x2bc023){return db[_0x96d1('0x36')]['find']({'where':{'id':_0x128098[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0x2bc023,null))[_0x96d1('0x19')](function(_0x55c9b1){if(_0x55c9b1){return _0x55c9b1[_0x96d1('0x72')](_0x128098[_0x96d1('0x28')][_0x96d1('0x56')])[_0x96d1('0x19')](function(){if(_[_0x96d1('0x77')](_0x128098[_0x96d1('0x28')]['ids'])){for(var _0x1e3df7=0x0;_0x1e3df7<_0x128098[_0x96d1('0x28')][_0x96d1('0x56')][_0x96d1('0x41')];_0x1e3df7+=0x1){socket[_0x96d1('0x5f')](_0x96d1('0x73'),{'UserId':Number(_0x128098[_0x96d1('0x28')][_0x96d1('0x56')][_0x1e3df7]),'FaxQueueId':Number(_0x128098[_0x96d1('0x2c')]['id'])});}}else{socket[_0x96d1('0x5f')](_0x96d1('0x73'),{'UserId':Number(_0x128098[_0x96d1('0x28')][_0x96d1('0x56')]),'FaxQueueId':Number(_0x128098[_0x96d1('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x2bc023,null))[_0x96d1('0x2a')](handleError(_0x2bc023,null));};exports[_0x96d1('0x78')]=function(_0x18bad3,_0x5b8262){var _0x4525eb={};var _0x2fd56c={};var _0x56f38f;var _0x20916b;return db[_0x96d1('0x36')]['findOne']({'where':{'id':_0x18bad3[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0x5b8262,null))[_0x96d1('0x19')](function(_0xc92f92){if(_0xc92f92){_0x56f38f=_0xc92f92;_0x2fd56c[_0x96d1('0x2d')]=_[_0x96d1('0x2e')](db['User'][_0x96d1('0x2f')]);_0x2fd56c[_0x96d1('0x28')]=_[_0x96d1('0x2e')](_0x18bad3[_0x96d1('0x28')]);_0x2fd56c[_0x96d1('0x30')]=_['intersection'](_0x2fd56c[_0x96d1('0x2d')],_0x2fd56c[_0x96d1('0x28')]);_0x4525eb['attributes']=_[_0x96d1('0x31')](_0x2fd56c[_0x96d1('0x2d')],qs[_0x96d1('0x32')](_0x18bad3[_0x96d1('0x28')][_0x96d1('0x32')]));_0x4525eb[_0x96d1('0x33')]=_0x4525eb['attributes'][_0x96d1('0x41')]?_0x4525eb[_0x96d1('0x33')]:_0x2fd56c[_0x96d1('0x2d')];_0x4525eb[_0x96d1('0x53')]=qs[_0x96d1('0x44')](_0x18bad3['query'][_0x96d1('0x44')]);_0x4525eb['where']=qs['filters'](_[_0x96d1('0x54')](_0x18bad3[_0x96d1('0x28')],_0x2fd56c['filters']));if(_0x18bad3[_0x96d1('0x28')][_0x96d1('0x45')]){_0x4525eb[_0x96d1('0x26')]=_[_0x96d1('0x35')](_0x4525eb[_0x96d1('0x26')],{'$or':_['map'](_0x4525eb[_0x96d1('0x33')],function(_0x4279f9){var _0x209642={};_0x209642[_0x4279f9]={'$like':'%'+_0x18bad3['query']['filter']+'%'};return _0x209642;})});}_0x4525eb=_[_0x96d1('0x35')]({},_0x4525eb,_0x18bad3[_0x96d1('0x46')]);return _0x56f38f[_0x96d1('0x78')](_0x4525eb);}})[_0x96d1('0x19')](function(_0xe76ca0){if(_0xe76ca0){_0x20916b=_0xe76ca0['length'];if(!_0x18bad3[_0x96d1('0x28')][_0x96d1('0x42')]('nolimit')){_0x4525eb[_0x96d1('0x13')]=qs[_0x96d1('0x13')](_0x18bad3[_0x96d1('0x28')][_0x96d1('0x13')]);_0x4525eb[_0x96d1('0x11')]=qs['offset'](_0x18bad3[_0x96d1('0x28')][_0x96d1('0x11')]);}return _0x56f38f[_0x96d1('0x78')](_0x4525eb);}})['then'](function(_0x495ca0){if(_0x495ca0){return _0x495ca0?{'count':_0x20916b,'rows':_0x495ca0}:null;}})[_0x96d1('0x19')](respondWithResult(_0x5b8262,null))[_0x96d1('0x2a')](handleError(_0x5b8262,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 31002cc..2002ae5 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 _0x24f8=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x374710,_0x5b0774){var _0x51063f=function(_0xf40937){while(--_0xf40937){_0x374710['push'](_0x374710['shift']());}};_0x51063f(++_0x5b0774);}(_0x24f8,0x64));var _0x824f=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x24f8[_0x42bc91];return _0x3f5507;};'use strict';var EventEmitter=require(_0x824f('0x0'));var FaxQueue=require(_0x824f('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x824f('0x2'),'afterUpdate':_0x824f('0x3'),'afterDestroy':_0x824f('0x4')};function emitEvent(_0x282354){return function(_0x2cec67,_0x4a6a67,_0x339d3b){FaxQueueEvents[_0x824f('0x5')](_0x282354+':'+_0x2cec67['id'],_0x2cec67);FaxQueueEvents[_0x824f('0x5')](_0x282354,_0x2cec67);_0x339d3b(null);};}for(var e in events){if(events[_0x824f('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x824f('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xe4cb=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x40178c,_0x326170){var _0x4622d0=function(_0x5d05f5){while(--_0x5d05f5){_0x40178c['push'](_0x40178c['shift']());}};_0x4622d0(++_0x326170);}(_0xe4cb,0x97));var _0xbe4c=function(_0x4a07d9,_0x8f8c4f){_0x4a07d9=_0x4a07d9-0x0;var _0x108c37=_0xe4cb[_0x4a07d9];return _0x108c37;};'use strict';var EventEmitter=require(_0xbe4c('0x0'));var FaxQueue=require(_0xbe4c('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbe4c('0x2')](0x0);var events={'afterCreate':_0xbe4c('0x3'),'afterUpdate':_0xbe4c('0x4'),'afterDestroy':_0xbe4c('0x5')};function emitEvent(_0x41ca57){return function(_0xf80379,_0x2b8135,_0x13e314){FaxQueueEvents[_0xbe4c('0x6')](_0x41ca57+':'+_0xf80379['id'],_0xf80379);FaxQueueEvents['emit'](_0x41ca57,_0xf80379);_0x13e314(null);};}for(var e in events){if(events[_0xbe4c('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xbe4c('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 6dfccd0..c0d1f8e 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 _0x54d8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x54d8,0x159));var _0x854d=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x54d8[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0x854d('0x0'));var util=require(_0x854d('0x1'));var logger=require(_0x854d('0x2'))(_0x854d('0x3'));var moment=require(_0x854d('0x4'));var BPromise=require(_0x854d('0x5'));var rp=require(_0x854d('0x6'));var fs=require('fs');var path=require(_0x854d('0x7'));var rimraf=require(_0x854d('0x8'));var config=require(_0x854d('0x9'));var attributes=require(_0x854d('0xa'));module[_0x854d('0xb')]=function(_0x487950,_0x410849){return _0x487950[_0x854d('0xc')](_0x854d('0xd'),attributes,{'tableName':_0x854d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x342c=['./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x342c,0xfb));var _0xc342=function(_0x289f6b,_0x2c269d){_0x289f6b=_0x289f6b-0x0;var _0x324bea=_0x342c[_0x289f6b];return _0x324bea;};'use strict';var _=require(_0xc342('0x0'));var util=require(_0xc342('0x1'));var logger=require(_0xc342('0x2'))(_0xc342('0x3'));var moment=require(_0xc342('0x4'));var BPromise=require(_0xc342('0x5'));var rp=require(_0xc342('0x6'));var fs=require('fs');var path=require(_0xc342('0x7'));var rimraf=require('rimraf');var config=require(_0xc342('0x8'));var attributes=require(_0xc342('0x9'));module[_0xc342('0xa')]=function(_0xb8b7a1,_0x354478){return _0xb8b7a1[_0xc342('0xb')](_0xc342('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 0cbd51e..74b604d 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 _0x0fff=['../../config/utils','../../config/logger','rpc','client','defaults','redis','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','include','map','model','attributes','find','ShowFaxQueue','lodash','moment','bluebird','../../mysqldb'];(function(_0x1fcc72,_0x191471){var _0x77731c=function(_0x36c407){while(--_0x36c407){_0x1fcc72['push'](_0x1fcc72['shift']());}};_0x77731c(++_0x191471);}(_0x0fff,0x65));var _0xf0ff=function(_0x217e15,_0x11734b){_0x217e15=_0x217e15-0x0;var _0x1e45bf=_0x0fff[_0x217e15];return _0x1e45bf;};'use strict';var _=require(_0xf0ff('0x0'));var util=require('util');var moment=require(_0xf0ff('0x1'));var BPromise=require(_0xf0ff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ff('0x3'))['db'];var utils=require(_0xf0ff('0x4'));var logger=require(_0xf0ff('0x5'))(_0xf0ff('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf0ff('0x7')]['http']({'port':0x232a});config['redis']=_[_0xf0ff('0x8')](config[_0xf0ff('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf0ff('0xa'))[_0xf0ff('0xb')](socket);function respondWithRpcPromise(_0x35d27f,_0x40c309,_0x1bc330){return new BPromise(function(_0x31340e,_0x375fa9){return client['request'](_0x35d27f,_0x1bc330)[_0xf0ff('0xc')](function(_0x10531e){logger[_0xf0ff('0xd')](_0xf0ff('0xe'),_0x40c309,_0xf0ff('0xf'));logger[_0xf0ff('0x10')](_0xf0ff('0x11'),_0x40c309,_0xf0ff('0xf'),JSON[_0xf0ff('0x12')](_0x10531e));if(_0x10531e[_0xf0ff('0x13')]){if(_0x10531e['error'][_0xf0ff('0x14')]===0x1f4){logger[_0xf0ff('0x13')](_0xf0ff('0xe'),_0x40c309,_0x10531e[_0xf0ff('0x13')][_0xf0ff('0x15')]);return _0x375fa9(_0x10531e[_0xf0ff('0x13')]['message']);}logger[_0xf0ff('0x13')](_0xf0ff('0xe'),_0x40c309,_0x10531e[_0xf0ff('0x13')]['message']);return _0x31340e(_0x10531e[_0xf0ff('0x13')][_0xf0ff('0x15')]);}else{logger[_0xf0ff('0xd')]('FaxQueue,\x20%s,\x20%s',_0x40c309,'request\x20sent');_0x31340e(_0x10531e[_0xf0ff('0x16')][_0xf0ff('0x15')]);}})[_0xf0ff('0x17')](function(_0x1cbf45){logger[_0xf0ff('0x13')](_0xf0ff('0xe'),_0x40c309,_0x1cbf45);_0x375fa9(_0x1cbf45);});});}exports[_0xf0ff('0x18')]=function(_0x52f214){var _0x45a22e=this;return new Promise(function(_0x4a6282,_0xbb9763){return db[_0xf0ff('0x19')]['findAll']({'raw':_0x52f214['options']?_0x52f214[_0xf0ff('0x1a')][_0xf0ff('0x1b')]===undefined?!![]:![]:!![],'where':_0x52f214[_0xf0ff('0x1a')]?_0x52f214['options'][_0xf0ff('0x1c')]||null:null,'attributes':_0x52f214['options']?_0x52f214[_0xf0ff('0x1a')]['attributes']||null:null,'limit':_0x52f214['options']?_0x52f214[_0xf0ff('0x1a')]['limit']||null:null,'include':_0x52f214[_0xf0ff('0x1a')]?_0x52f214[_0xf0ff('0x1a')][_0xf0ff('0x1d')]?_[_0xf0ff('0x1e')](_0x52f214[_0xf0ff('0x1a')]['include'],function(_0x2265b3){return{'model':db[_0x2265b3[_0xf0ff('0x1f')]],'as':_0x2265b3['as'],'attributes':_0x2265b3[_0xf0ff('0x20')],'include':_0x2265b3[_0xf0ff('0x1d')]?_[_0xf0ff('0x1e')](_0x2265b3[_0xf0ff('0x1d')],function(_0x2da4cb){return{'model':db[_0x2da4cb[_0xf0ff('0x1f')]],'as':_0x2da4cb['as'],'attributes':_0x2da4cb[_0xf0ff('0x20')],'include':_0x2da4cb[_0xf0ff('0x1d')]?_[_0xf0ff('0x1e')](_0x2da4cb[_0xf0ff('0x1d')],function(_0x6d02f2){return{'model':db[_0x6d02f2[_0xf0ff('0x1f')]],'as':_0x6d02f2['as'],'attributes':_0x6d02f2[_0xf0ff('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf0ff('0xc')](function(_0x150df0){logger[_0xf0ff('0xd')](_0xf0ff('0x18'),_0x52f214);logger[_0xf0ff('0x10')](_0xf0ff('0x18'),_0x52f214,JSON[_0xf0ff('0x12')](_0x150df0));_0x4a6282(_0x150df0);})[_0xf0ff('0x17')](function(_0x516696){logger[_0xf0ff('0x13')](_0xf0ff('0x18'),_0x516696[_0xf0ff('0x15')],_0x52f214);_0xbb9763(_0x45a22e['error'](0x1f4,_0x516696['message']));});});};exports['ShowFaxQueue']=function(_0x5d7639){var _0x144773=this;return new Promise(function(_0x2b4382,_0x316f84){return db[_0xf0ff('0x19')][_0xf0ff('0x21')]({'raw':_0x5d7639[_0xf0ff('0x1a')]?_0x5d7639[_0xf0ff('0x1a')][_0xf0ff('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d7639['options']?_0x5d7639[_0xf0ff('0x1a')][_0xf0ff('0x1c')]||null:null,'attributes':_0x5d7639[_0xf0ff('0x1a')]?_0x5d7639[_0xf0ff('0x1a')][_0xf0ff('0x20')]||null:null,'include':_0x5d7639[_0xf0ff('0x1a')]?_0x5d7639[_0xf0ff('0x1a')]['include']?_[_0xf0ff('0x1e')](_0x5d7639[_0xf0ff('0x1a')][_0xf0ff('0x1d')],function(_0x346c62){return{'model':db[_0x346c62[_0xf0ff('0x1f')]],'as':_0x346c62['as'],'attributes':_0x346c62[_0xf0ff('0x20')],'include':_0x346c62[_0xf0ff('0x1d')]?_['map'](_0x346c62['include'],function(_0x37e3b0){return{'model':db[_0x37e3b0['model']],'as':_0x37e3b0['as'],'attributes':_0x37e3b0[_0xf0ff('0x20')],'include':_0x37e3b0['include']?_[_0xf0ff('0x1e')](_0x37e3b0['include'],function(_0x1885de){return{'model':db[_0x1885de[_0xf0ff('0x1f')]],'as':_0x1885de['as'],'attributes':_0x1885de[_0xf0ff('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf0ff('0xc')](function(_0x453a71){logger['info'](_0xf0ff('0x22'),_0x5d7639);logger[_0xf0ff('0x10')]('ShowFaxQueue',_0x5d7639,JSON[_0xf0ff('0x12')](_0x453a71));_0x2b4382(_0x453a71);})[_0xf0ff('0x17')](function(_0x1392b1){logger[_0xf0ff('0x13')]('ShowFaxQueue',_0x1392b1[_0xf0ff('0x15')],_0x5d7639);_0x316f84(_0x144773[_0xf0ff('0x13')](0x1f4,_0x1392b1[_0xf0ff('0x15')]));});});}; \ No newline at end of file +var _0x1777=['code','message','result','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','catch','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x22de44,_0x4be4e2){var _0x765644=function(_0x159860){while(--_0x159860){_0x22de44['push'](_0x22de44['shift']());}};_0x765644(++_0x4be4e2);}(_0x1777,0x136));var _0x7177=function(_0x436087,_0x1db9a7){_0x436087=_0x436087-0x0;var _0xeac751=_0x1777[_0x436087];return _0xeac751;};'use strict';var _=require(_0x7177('0x0'));var util=require(_0x7177('0x1'));var moment=require(_0x7177('0x2'));var BPromise=require(_0x7177('0x3'));var rs=require(_0x7177('0x4'));var fs=require('fs');var Redis=require(_0x7177('0x5'));var db=require(_0x7177('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7177('0x7'))(_0x7177('0x8'));var config=require(_0x7177('0x9'));var jayson=require(_0x7177('0xa'));var client=jayson[_0x7177('0xb')]['http']({'port':0x232a});config[_0x7177('0xc')]=_[_0x7177('0xd')](config[_0x7177('0xc')],{'host':_0x7177('0xe'),'port':0x18eb});var socket=require(_0x7177('0xf'))(new Redis(config[_0x7177('0xc')]));require(_0x7177('0x10'))[_0x7177('0x11')](socket);function respondWithRpcPromise(_0x12f2c4,_0x422ba1,_0x19fea4){return new BPromise(function(_0x21cea0,_0x554c67){return client['request'](_0x12f2c4,_0x19fea4)[_0x7177('0x12')](function(_0x4ab089){logger[_0x7177('0x13')](_0x7177('0x14'),_0x422ba1,'request\x20sent');logger[_0x7177('0x15')](_0x7177('0x16'),_0x422ba1,_0x7177('0x17'),JSON[_0x7177('0x18')](_0x4ab089));if(_0x4ab089[_0x7177('0x19')]){if(_0x4ab089['error'][_0x7177('0x1a')]===0x1f4){logger[_0x7177('0x19')](_0x7177('0x14'),_0x422ba1,_0x4ab089['error'][_0x7177('0x1b')]);return _0x554c67(_0x4ab089['error'][_0x7177('0x1b')]);}logger[_0x7177('0x19')](_0x7177('0x14'),_0x422ba1,_0x4ab089[_0x7177('0x19')][_0x7177('0x1b')]);return _0x21cea0(_0x4ab089[_0x7177('0x19')]['message']);}else{logger[_0x7177('0x13')](_0x7177('0x14'),_0x422ba1,'request\x20sent');_0x21cea0(_0x4ab089[_0x7177('0x1c')][_0x7177('0x1b')]);}})['catch'](function(_0x56b9f0){logger[_0x7177('0x19')]('FaxQueue,\x20%s,\x20%s',_0x422ba1,_0x56b9f0);_0x554c67(_0x56b9f0);});});}exports['GetFaxQueue']=function(_0x17118b){var _0x41be19=this;return new Promise(function(_0x580ede,_0x445e71){return db[_0x7177('0x1d')][_0x7177('0x1e')]({'raw':_0x17118b[_0x7177('0x1f')]?_0x17118b[_0x7177('0x1f')][_0x7177('0x20')]===undefined?!![]:![]:!![],'where':_0x17118b[_0x7177('0x1f')]?_0x17118b[_0x7177('0x1f')][_0x7177('0x21')]||null:null,'attributes':_0x17118b[_0x7177('0x1f')]?_0x17118b[_0x7177('0x1f')][_0x7177('0x22')]||null:null,'limit':_0x17118b[_0x7177('0x1f')]?_0x17118b['options'][_0x7177('0x23')]||null:null,'include':_0x17118b[_0x7177('0x1f')]?_0x17118b[_0x7177('0x1f')][_0x7177('0x24')]?_[_0x7177('0x25')](_0x17118b[_0x7177('0x1f')]['include'],function(_0x28c87d){return{'model':db[_0x28c87d[_0x7177('0x26')]],'as':_0x28c87d['as'],'attributes':_0x28c87d[_0x7177('0x22')],'include':_0x28c87d[_0x7177('0x24')]?_['map'](_0x28c87d[_0x7177('0x24')],function(_0x1be0f0){return{'model':db[_0x1be0f0['model']],'as':_0x1be0f0['as'],'attributes':_0x1be0f0[_0x7177('0x22')],'include':_0x1be0f0[_0x7177('0x24')]?_[_0x7177('0x25')](_0x1be0f0[_0x7177('0x24')],function(_0x49afd9){return{'model':db[_0x49afd9[_0x7177('0x26')]],'as':_0x49afd9['as'],'attributes':_0x49afd9[_0x7177('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7177('0x12')](function(_0x4e743a){logger[_0x7177('0x13')](_0x7177('0x27'),_0x17118b);logger['debug'](_0x7177('0x27'),_0x17118b,JSON[_0x7177('0x18')](_0x4e743a));_0x580ede(_0x4e743a);})[_0x7177('0x28')](function(_0x27318a){logger[_0x7177('0x19')]('GetFaxQueue',_0x27318a['message'],_0x17118b);_0x445e71(_0x41be19[_0x7177('0x19')](0x1f4,_0x27318a[_0x7177('0x1b')]));});});};exports['ShowFaxQueue']=function(_0x59da1e){var _0x237f1f=this;return new Promise(function(_0xc749b9,_0x3c2e4e){return db['FaxQueue']['find']({'raw':_0x59da1e[_0x7177('0x1f')]?_0x59da1e[_0x7177('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x59da1e['options']?_0x59da1e[_0x7177('0x1f')]['where']||null:null,'attributes':_0x59da1e['options']?_0x59da1e['options'][_0x7177('0x22')]||null:null,'include':_0x59da1e[_0x7177('0x1f')]?_0x59da1e[_0x7177('0x1f')][_0x7177('0x24')]?_[_0x7177('0x25')](_0x59da1e[_0x7177('0x1f')][_0x7177('0x24')],function(_0x5f2916){return{'model':db[_0x5f2916[_0x7177('0x26')]],'as':_0x5f2916['as'],'attributes':_0x5f2916[_0x7177('0x22')],'include':_0x5f2916[_0x7177('0x24')]?_['map'](_0x5f2916[_0x7177('0x24')],function(_0x2e5121){return{'model':db[_0x2e5121[_0x7177('0x26')]],'as':_0x2e5121['as'],'attributes':_0x2e5121[_0x7177('0x22')],'include':_0x2e5121['include']?_[_0x7177('0x25')](_0x2e5121[_0x7177('0x24')],function(_0x84e05d){return{'model':db[_0x84e05d[_0x7177('0x26')]],'as':_0x84e05d['as'],'attributes':_0x84e05d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x211500){logger[_0x7177('0x13')](_0x7177('0x29'),_0x59da1e);logger['debug']('ShowFaxQueue',_0x59da1e,JSON[_0x7177('0x18')](_0x211500));_0xc749b9(_0x211500);})['catch'](function(_0x27862c){logger[_0x7177('0x19')](_0x7177('0x29'),_0x27862c['message'],_0x59da1e);_0x3c2e4e(_0x237f1f[_0x7177('0x19')](0x1f4,_0x27862c[_0x7177('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 04cce58..e47eb7d 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 _0x045e=['save','remove','emit','removeListener','length','faxQueue:','./faxQueue.events'];(function(_0x315889,_0x26c977){var _0x203f38=function(_0x56cd30){while(--_0x56cd30){_0x315889['push'](_0x315889['shift']());}};_0x203f38(++_0x26c977);}(_0x045e,0xfb));var _0xe045=function(_0x108c5b,_0x52c0fb){_0x108c5b=_0x108c5b-0x0;var _0x2afb52=_0x045e[_0x108c5b];return _0x2afb52;};'use strict';var FaxQueueEvents=require(_0xe045('0x0'));var events=[_0xe045('0x1'),_0xe045('0x2'),'update'];function createListener(_0x25b44b,_0x1c59d6){return function(_0x2f1373){_0x1c59d6[_0xe045('0x3')](_0x25b44b,_0x2f1373);};}function removeListener(_0xc4ebdf,_0x3b160d){return function(){FaxQueueEvents[_0xe045('0x4')](_0xc4ebdf,_0x3b160d);};}exports['register']=function(_0x3a0980){for(var _0x338862=0x0,_0xf9c791=events[_0xe045('0x5')];_0x338862<_0xf9c791;_0x338862++){var _0x3219c2=events[_0x338862];var _0x46390f=createListener(_0xe045('0x6')+_0x3219c2,_0x3a0980);FaxQueueEvents['on'](_0x3219c2,_0x46390f);}}; \ No newline at end of file +var _0xe1e6=['./faxQueue.events','update','emit','removeListener','register','length','faxQueue:'];(function(_0x306731,_0x302751){var _0x1de49f=function(_0x39c334){while(--_0x39c334){_0x306731['push'](_0x306731['shift']());}};_0x1de49f(++_0x302751);}(_0xe1e6,0x196));var _0x6e1e=function(_0x216bb5,_0x4af124){_0x216bb5=_0x216bb5-0x0;var _0x324d27=_0xe1e6[_0x216bb5];return _0x324d27;};'use strict';var FaxQueueEvents=require(_0x6e1e('0x0'));var events=['save','remove',_0x6e1e('0x1')];function createListener(_0x456871,_0xa29ac3){return function(_0x2771b4){_0xa29ac3[_0x6e1e('0x2')](_0x456871,_0x2771b4);};}function removeListener(_0x5013c0,_0x1e02fa){return function(){FaxQueueEvents[_0x6e1e('0x3')](_0x5013c0,_0x1e02fa);};}exports[_0x6e1e('0x4')]=function(_0xfeeb35){for(var _0x282a55=0x0,_0x5e3e01=events[_0x6e1e('0x5')];_0x282a55<_0x5e3e01;_0x282a55++){var _0x5f0408=events[_0x282a55];var _0x5f1983=createListener(_0x6e1e('0x6')+_0x5f0408,_0xfeeb35);FaxQueueEvents['on'](_0x5f0408,_0x5f1983);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 1924b72..7f5dfb2 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 _0xaa3f=['getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5122f5,_0x3a19ec){_0x5122f5=_0x5122f5-0x0;var _0x33e9a2=_0xaa3f[_0x5122f5];return _0x33e9a2;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0x9')](_0xfaa3('0xe'),auth['isAuthenticated'](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xfaa3('0x10')]);router[_0xfaa3('0x9')](_0xfaa3('0x11'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x12')]);router[_0xfaa3('0x9')]('/:id/users',auth[_0xfaa3('0xc')](),controller['getAgents']);router[_0xfaa3('0x13')]('/',auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x14')]);router['post'](_0xfaa3('0x11'),auth['isAuthenticated'](),controller[_0xfaa3('0x15')]);router[_0xfaa3('0x13')](_0xfaa3('0x16'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x17')]);router[_0xfaa3('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xfaa3('0x19')]);router[_0xfaa3('0x1a')](_0xfaa3('0xe'),auth[_0xfaa3('0xc')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xfaa3('0x1a')]('/:id/users',auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x1b')]);module[_0xfaa3('0x1c')]=router; \ No newline at end of file +var _0x5d17=['addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x5d17,0x114));var _0x75d1=function(_0x355958,_0x71c9ef){_0x355958=_0x355958-0x0;var _0x2daee2=_0x5d17[_0x355958];return _0x2daee2;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x75d1('0xe')]);router[_0x75d1('0x8')]('/:id/teams',auth[_0x75d1('0xb')](),controller[_0x75d1('0xf')]);router[_0x75d1('0x8')](_0x75d1('0x10'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);router['post']('/',auth[_0x75d1('0xb')](),controller[_0x75d1('0x12')]);router[_0x75d1('0x13')](_0x75d1('0x14'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x75d1('0x10'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x15')]);router['put'](_0x75d1('0xd'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x16')]);router[_0x75d1('0x17')](_0x75d1('0xd'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x18')]);router[_0x75d1('0x17')](_0x75d1('0x14'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x19')]);router['delete']('/:id/users',auth[_0x75d1('0xb')](),controller[_0x75d1('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 14a33d9..d7c3061 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 _0xb2f1=['STRING','DATE','moment','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2f1,0xee));var _0x1b2f=function(_0x54b893,_0x123df2){_0x54b893=_0x54b893-0x0;var _0x6557c3=_0xb2f1[_0x54b893];return _0x6557c3;};'use strict';var moment=require(_0x1b2f('0x0'));var Sequelize=require(_0x1b2f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1b2f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1b2f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1b2f('0x3')]},'acceptAt':{'type':Sequelize[_0x1b2f('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc524=['STRING','DATE','sequelize'];(function(_0x4574c8,_0x2dd90e){var _0x23279e=function(_0xe80014){while(--_0xe80014){_0x4574c8['push'](_0x4574c8['shift']());}};_0x23279e(++_0x2dd90e);}(_0xc524,0x140));var _0x4c52=function(_0x5610d2,_0x1ac569){_0x5610d2=_0x5610d2-0x0;var _0x32032e=_0xc524[_0x5610d2];return _0x32032e;};'use strict';var moment=require('moment');var Sequelize=require(_0x4c52('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4c52('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4c52('0x2')]},'leaveAt':{'type':Sequelize[_0x4c52('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4c52('0x2')]},'reason':{'type':Sequelize[_0x4c52('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index d24503a..c65e14f 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 _0x1da6=['update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','create','body','find','describe','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','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','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x4fd75e,_0x219e4a){var _0x5b6338=function(_0xf2969c){while(--_0xf2969c){_0x4fd75e['push'](_0x4fd75e['shift']());}};_0x5b6338(++_0x219e4a);}(_0x1da6,0x7c));var _0x61da=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0x1da6[_0x4ed37d];return _0x4fb2c5;};'use strict';var emlformat=require(_0x61da('0x0'));var rimraf=require(_0x61da('0x1'));var zipdir=require(_0x61da('0x2'));var jsonpatch=require(_0x61da('0x3'));var rp=require(_0x61da('0x4'));var moment=require(_0x61da('0x5'));var BPromise=require(_0x61da('0x6'));var Mustache=require(_0x61da('0x7'));var util=require(_0x61da('0x8'));var path=require(_0x61da('0x9'));var sox=require(_0x61da('0xa'));var csv=require(_0x61da('0xb'));var ejs=require(_0x61da('0xc'));var fs=require('fs');var fs_extra=require(_0x61da('0xd'));var _=require(_0x61da('0xe'));var squel=require(_0x61da('0xf'));var crypto=require(_0x61da('0x10'));var jsforce=require(_0x61da('0x11'));var deskjs=require(_0x61da('0x12'));var toCsv=require(_0x61da('0xb'));var querystring=require('querystring');var Papa=require(_0x61da('0x13'));var Redis=require(_0x61da('0x14'));var authService=require(_0x61da('0x15'));var qs=require(_0x61da('0x16'));var as=require(_0x61da('0x17'));var hardwareService=require(_0x61da('0x18'));var logger=require(_0x61da('0x19'))(_0x61da('0x1a'));var utils=require(_0x61da('0x1b'));var config=require(_0x61da('0x1c'));var licenseUtil=require(_0x61da('0x1d'));var db=require(_0x61da('0x1e'))['db'];function respondWithStatusCode(_0x1eb368,_0x1036e4){_0x1036e4=_0x1036e4||0xcc;return function(_0x43ec70){if(_0x43ec70){return _0x1eb368['sendStatus'](_0x1036e4);}return _0x1eb368[_0x61da('0x1f')](_0x1036e4)[_0x61da('0x20')]();};}function respondWithResult(_0x191033,_0x472abc){_0x472abc=_0x472abc||0xc8;return function(_0x55eef1){if(_0x55eef1){return _0x191033[_0x61da('0x1f')](_0x472abc)['json'](_0x55eef1);}};}function respondWithFilteredResult(_0x21a5fc,_0x6d24b7){return function(_0x4a0aea){if(_0x4a0aea){var _0x53f3a4=typeof _0x6d24b7[_0x61da('0x21')]===_0x61da('0x22')&&typeof _0x6d24b7[_0x61da('0x23')]===_0x61da('0x22');var _0x2ac3aa=_0x4a0aea[_0x61da('0x24')];var _0x505b1c=_0x53f3a4?0x0:_0x6d24b7[_0x61da('0x21')];var _0x34a678=_0x53f3a4?_0x4a0aea[_0x61da('0x24')]:_0x6d24b7[_0x61da('0x21')]+_0x6d24b7['limit'];var _0x1a0e6e;if(_0x34a678>=_0x2ac3aa){_0x34a678=_0x2ac3aa;_0x1a0e6e=0xc8;}else{_0x1a0e6e=0xce;}_0x21a5fc[_0x61da('0x1f')](_0x1a0e6e);return _0x21a5fc[_0x61da('0x25')](_0x61da('0x26'),_0x505b1c+'-'+_0x34a678+'/'+_0x2ac3aa)['json'](_0x4a0aea);}return null;};}function patchUpdates(_0x22b8bc){return function(_0x5c0363){try{jsonpatch[_0x61da('0x27')](_0x5c0363,_0x22b8bc,!![]);}catch(_0x172066){return BPromise[_0x61da('0x28')](_0x172066);}return _0x5c0363[_0x61da('0x29')]();};}function saveUpdates(_0x1868af,_0x129bb0){return function(_0x30c6f8){if(_0x30c6f8){return _0x30c6f8[_0x61da('0x2a')](_0x1868af)[_0x61da('0x2b')](function(_0x325e28){return _0x325e28;});}return null;};}function removeEntity(_0x56f5d2,_0x2c9e83){return function(_0x35550a){if(_0x35550a){return _0x35550a[_0x61da('0x2c')]()[_0x61da('0x2b')](function(){_0x56f5d2[_0x61da('0x1f')](0xcc)[_0x61da('0x20')]();});}};}function handleEntityNotFound(_0x4860d4,_0x2c5d97){return function(_0xe37079){if(!_0xe37079){_0x4860d4[_0x61da('0x2d')](0x194);}return _0xe37079;};}function handleError(_0x100ba1,_0x351241){_0x351241=_0x351241||0x1f4;return function(_0x262e32){logger[_0x61da('0x2e')](_0x262e32[_0x61da('0x2f')]);if(_0x262e32['name']){delete _0x262e32[_0x61da('0x30')];}_0x100ba1[_0x61da('0x1f')](_0x351241)[_0x61da('0x31')](_0x262e32);};}exports[_0x61da('0x32')]=function(_0x52f486,_0x275aa6){var _0x591efe={},_0x2c9a1d={},_0x2cc862={'count':0x0,'rows':[]};var _0x3a31a2=_[_0x61da('0x33')](db[_0x61da('0x34')][_0x61da('0x35')],function(_0xb97400){return{'name':_0xb97400['fieldName'],'type':_0xb97400[_0x61da('0x36')]['key']};});_0x2c9a1d['model']=_[_0x61da('0x33')](_0x3a31a2,_0x61da('0x30'));_0x2c9a1d[_0x61da('0x37')]=_[_0x61da('0x38')](_0x52f486[_0x61da('0x37')]);_0x2c9a1d['filters']=_[_0x61da('0x39')](_0x2c9a1d[_0x61da('0x3a')],_0x2c9a1d[_0x61da('0x37')]);_0x591efe[_0x61da('0x3b')]=_['intersection'](_0x2c9a1d[_0x61da('0x3a')],qs[_0x61da('0x3c')](_0x52f486['query'][_0x61da('0x3c')]));_0x591efe['attributes']=_0x591efe['attributes']['length']?_0x591efe['attributes']:_0x2c9a1d['model'];if(!_0x52f486[_0x61da('0x37')][_0x61da('0x3d')](_0x61da('0x3e'))){_0x591efe[_0x61da('0x23')]=qs[_0x61da('0x23')](_0x52f486['query'][_0x61da('0x23')]);_0x591efe[_0x61da('0x21')]=qs[_0x61da('0x21')](_0x52f486['query'][_0x61da('0x21')]);}_0x591efe[_0x61da('0x3f')]=qs[_0x61da('0x40')](_0x52f486['query'][_0x61da('0x40')]);_0x591efe[_0x61da('0x41')]=qs[_0x61da('0x42')](_[_0x61da('0x43')](_0x52f486[_0x61da('0x37')],_0x2c9a1d['filters']),_0x3a31a2);if(_0x52f486[_0x61da('0x37')][_0x61da('0x44')]){_0x591efe[_0x61da('0x41')]=_[_0x61da('0x45')](_0x591efe[_0x61da('0x41')],{'$or':_['map'](_0x3a31a2,function(_0x4e6512){if(_0x4e6512['type']!==_0x61da('0x46')){var _0x278732={};_0x278732[_0x4e6512[_0x61da('0x30')]]={'$like':'%'+_0x52f486[_0x61da('0x37')][_0x61da('0x44')]+'%'};return _0x278732;}})});}_0x591efe=_[_0x61da('0x45')]({},_0x591efe,_0x52f486[_0x61da('0x47')]);var _0x522aeb={'where':_0x591efe[_0x61da('0x41')]};return db[_0x61da('0x34')]['count'](_0x522aeb)[_0x61da('0x2b')](function(_0x1a430f){_0x2cc862[_0x61da('0x24')]=_0x1a430f;if(_0x52f486['query'][_0x61da('0x48')]){_0x591efe['include']=[{'all':!![]}];}return db[_0x61da('0x34')][_0x61da('0x49')](_0x591efe);})[_0x61da('0x2b')](function(_0x40d4a2){_0x2cc862['rows']=_0x40d4a2;return _0x2cc862;})[_0x61da('0x2b')](respondWithFilteredResult(_0x275aa6,_0x591efe))[_0x61da('0x4a')](handleError(_0x275aa6,null));};exports[_0x61da('0x4b')]=function(_0x47e1a5,_0x18e2da){var _0x36d744={'raw':!![],'where':{'id':_0x47e1a5[_0x61da('0x4c')]['id']}},_0x1dd879={};_0x1dd879[_0x61da('0x3a')]=_[_0x61da('0x38')](db['FaxQueueReport'][_0x61da('0x35')]);_0x1dd879[_0x61da('0x37')]=_[_0x61da('0x38')](_0x47e1a5[_0x61da('0x37')]);_0x1dd879[_0x61da('0x42')]=_[_0x61da('0x39')](_0x1dd879[_0x61da('0x3a')],_0x1dd879[_0x61da('0x37')]);_0x36d744['attributes']=_['intersection'](_0x1dd879[_0x61da('0x3a')],qs[_0x61da('0x3c')](_0x47e1a5[_0x61da('0x37')][_0x61da('0x3c')]));_0x36d744[_0x61da('0x3b')]=_0x36d744['attributes'][_0x61da('0x4d')]?_0x36d744[_0x61da('0x3b')]:_0x1dd879[_0x61da('0x3a')];if(_0x47e1a5[_0x61da('0x37')][_0x61da('0x48')]){_0x36d744[_0x61da('0x4e')]=[{'all':!![]}];}_0x36d744=_[_0x61da('0x45')]({},_0x36d744,_0x47e1a5[_0x61da('0x47')]);return db[_0x61da('0x34')]['find'](_0x36d744)[_0x61da('0x2b')](handleEntityNotFound(_0x18e2da,null))[_0x61da('0x2b')](respondWithResult(_0x18e2da,null))[_0x61da('0x4a')](handleError(_0x18e2da,null));};exports[_0x61da('0x4f')]=function(_0x5bf90a,_0x1b5ebf){return db[_0x61da('0x34')][_0x61da('0x4f')](_0x5bf90a[_0x61da('0x50')],{})[_0x61da('0x2b')](respondWithResult(_0x1b5ebf,0xc9))['catch'](handleError(_0x1b5ebf,null));};exports[_0x61da('0x2a')]=function(_0x5b3dee,_0x584ddd){if(_0x5b3dee[_0x61da('0x50')]['id']){delete _0x5b3dee[_0x61da('0x50')]['id'];}return db['FaxQueueReport'][_0x61da('0x51')]({'where':{'id':_0x5b3dee[_0x61da('0x4c')]['id']}})[_0x61da('0x2b')](handleEntityNotFound(_0x584ddd,null))['then'](saveUpdates(_0x5b3dee[_0x61da('0x50')],null))[_0x61da('0x2b')](respondWithResult(_0x584ddd,null))[_0x61da('0x4a')](handleError(_0x584ddd,null));};exports[_0x61da('0x2c')]=function(_0x4dd6fb,_0x19ec8a){return db['FaxQueueReport'][_0x61da('0x51')]({'where':{'id':_0x4dd6fb['params']['id']}})[_0x61da('0x2b')](handleEntityNotFound(_0x19ec8a,null))[_0x61da('0x2b')](removeEntity(_0x19ec8a,null))[_0x61da('0x4a')](handleError(_0x19ec8a,null));};exports[_0x61da('0x52')]=function(_0x47b335,_0xc5c8a6){return db[_0x61da('0x34')][_0x61da('0x52')]()[_0x61da('0x2b')](respondWithResult(_0xc5c8a6,null))[_0x61da('0x4a')](handleError(_0xc5c8a6,null));}; \ No newline at end of file +var _0xb544=['lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3a733e,_0xf03ef9){var _0x267f06=function(_0x52e0fe){while(--_0x52e0fe){_0x3a733e['push'](_0x3a733e['shift']());}};_0x267f06(++_0xf03ef9);}(_0xb544,0xd0));var _0x4b54=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xb544[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4b54('0x0'));var jsonpatch=require(_0x4b54('0x1'));var rp=require(_0x4b54('0x2'));var moment=require(_0x4b54('0x3'));var BPromise=require(_0x4b54('0x4'));var Mustache=require(_0x4b54('0x5'));var util=require(_0x4b54('0x6'));var path=require(_0x4b54('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b54('0x8'));var squel=require('squel');var crypto=require(_0x4b54('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4b54('0xa'));var toCsv=require(_0x4b54('0xb'));var querystring=require('querystring');var Papa=require(_0x4b54('0xc'));var Redis=require(_0x4b54('0xd'));var authService=require(_0x4b54('0xe'));var qs=require(_0x4b54('0xf'));var as=require(_0x4b54('0x10'));var hardwareService=require(_0x4b54('0x11'));var logger=require(_0x4b54('0x12'))('api');var utils=require(_0x4b54('0x13'));var config=require(_0x4b54('0x14'));var licenseUtil=require(_0x4b54('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16a4a6,_0x177f63){_0x177f63=_0x177f63||0xcc;return function(_0x4ea709){if(_0x4ea709){return _0x16a4a6[_0x4b54('0x16')](_0x177f63);}return _0x16a4a6[_0x4b54('0x17')](_0x177f63)['end']();};}function respondWithResult(_0x169d4e,_0x240a17){_0x240a17=_0x240a17||0xc8;return function(_0x4c0911){if(_0x4c0911){return _0x169d4e['status'](_0x240a17)[_0x4b54('0x18')](_0x4c0911);}};}function respondWithFilteredResult(_0x5c87db,_0x100d85){return function(_0x56955f){if(_0x56955f){var _0x160951=typeof _0x100d85['offset']===_0x4b54('0x19')&&typeof _0x100d85['limit']==='undefined';var _0x189b57=_0x56955f['count'];var _0x2f58cf=_0x160951?0x0:_0x100d85[_0x4b54('0x1a')];var _0x3b7702=_0x160951?_0x56955f[_0x4b54('0x1b')]:_0x100d85[_0x4b54('0x1a')]+_0x100d85[_0x4b54('0x1c')];var _0x5e9b49;if(_0x3b7702>=_0x189b57){_0x3b7702=_0x189b57;_0x5e9b49=0xc8;}else{_0x5e9b49=0xce;}_0x5c87db['status'](_0x5e9b49);return _0x5c87db['set'](_0x4b54('0x1d'),_0x2f58cf+'-'+_0x3b7702+'/'+_0x189b57)[_0x4b54('0x18')](_0x56955f);}return null;};}function patchUpdates(_0x5756f9){return function(_0x2e6ac8){try{jsonpatch[_0x4b54('0x1e')](_0x2e6ac8,_0x5756f9,!![]);}catch(_0x3610ac){return BPromise[_0x4b54('0x1f')](_0x3610ac);}return _0x2e6ac8[_0x4b54('0x20')]();};}function saveUpdates(_0x2460c5,_0x204282){return function(_0x449246){if(_0x449246){return _0x449246[_0x4b54('0x21')](_0x2460c5)[_0x4b54('0x22')](function(_0x1fbf12){return _0x1fbf12;});}return null;};}function removeEntity(_0x56a455,_0x34c526){return function(_0x5e71b2){if(_0x5e71b2){return _0x5e71b2[_0x4b54('0x23')]()[_0x4b54('0x22')](function(){_0x56a455[_0x4b54('0x17')](0xcc)[_0x4b54('0x24')]();});}};}function handleEntityNotFound(_0x506205,_0x40ffd9){return function(_0x18bb65){if(!_0x18bb65){_0x506205[_0x4b54('0x16')](0x194);}return _0x18bb65;};}function handleError(_0xbdb7f5,_0x1f9a79){_0x1f9a79=_0x1f9a79||0x1f4;return function(_0x5e4750){logger[_0x4b54('0x25')](_0x5e4750[_0x4b54('0x26')]);if(_0x5e4750[_0x4b54('0x27')]){delete _0x5e4750[_0x4b54('0x27')];}_0xbdb7f5[_0x4b54('0x17')](_0x1f9a79)[_0x4b54('0x28')](_0x5e4750);};}exports[_0x4b54('0x29')]=function(_0x9c99d9,_0x19792c){var _0x19b661={},_0x148779={},_0x5d87cc={'count':0x0,'rows':[]};var _0x5c0690=_[_0x4b54('0x2a')](db[_0x4b54('0x2b')][_0x4b54('0x2c')],function(_0x4b354e){return{'name':_0x4b354e[_0x4b54('0x2d')],'type':_0x4b354e['type']['key']};});_0x148779[_0x4b54('0x2e')]=_['map'](_0x5c0690,'name');_0x148779[_0x4b54('0x2f')]=_[_0x4b54('0x30')](_0x9c99d9[_0x4b54('0x2f')]);_0x148779[_0x4b54('0x31')]=_[_0x4b54('0x32')](_0x148779[_0x4b54('0x2e')],_0x148779[_0x4b54('0x2f')]);_0x19b661['attributes']=_[_0x4b54('0x32')](_0x148779[_0x4b54('0x2e')],qs[_0x4b54('0x33')](_0x9c99d9[_0x4b54('0x2f')][_0x4b54('0x33')]));_0x19b661[_0x4b54('0x34')]=_0x19b661[_0x4b54('0x34')]['length']?_0x19b661[_0x4b54('0x34')]:_0x148779[_0x4b54('0x2e')];if(!_0x9c99d9[_0x4b54('0x2f')][_0x4b54('0x35')](_0x4b54('0x36'))){_0x19b661[_0x4b54('0x1c')]=qs['limit'](_0x9c99d9[_0x4b54('0x2f')][_0x4b54('0x1c')]);_0x19b661['offset']=qs[_0x4b54('0x1a')](_0x9c99d9['query'][_0x4b54('0x1a')]);}_0x19b661[_0x4b54('0x37')]=qs['sort'](_0x9c99d9['query'][_0x4b54('0x38')]);_0x19b661[_0x4b54('0x39')]=qs[_0x4b54('0x31')](_[_0x4b54('0x3a')](_0x9c99d9[_0x4b54('0x2f')],_0x148779['filters']),_0x5c0690);if(_0x9c99d9[_0x4b54('0x2f')][_0x4b54('0x3b')]){_0x19b661[_0x4b54('0x39')]=_[_0x4b54('0x3c')](_0x19b661['where'],{'$or':_[_0x4b54('0x2a')](_0x5c0690,function(_0x2ab71f){if(_0x2ab71f['type']!=='VIRTUAL'){var _0x15e232={};_0x15e232[_0x2ab71f[_0x4b54('0x27')]]={'$like':'%'+_0x9c99d9['query'][_0x4b54('0x3b')]+'%'};return _0x15e232;}})});}_0x19b661=_[_0x4b54('0x3c')]({},_0x19b661,_0x9c99d9[_0x4b54('0x3d')]);var _0x4667c3={'where':_0x19b661[_0x4b54('0x39')]};return db[_0x4b54('0x2b')]['count'](_0x4667c3)[_0x4b54('0x22')](function(_0x17c42d){_0x5d87cc[_0x4b54('0x1b')]=_0x17c42d;if(_0x9c99d9[_0x4b54('0x2f')]['includeAll']){_0x19b661[_0x4b54('0x3e')]=[{'all':!![]}];}return db[_0x4b54('0x2b')][_0x4b54('0x3f')](_0x19b661);})['then'](function(_0x382961){_0x5d87cc[_0x4b54('0x40')]=_0x382961;return _0x5d87cc;})[_0x4b54('0x22')](respondWithFilteredResult(_0x19792c,_0x19b661))['catch'](handleError(_0x19792c,null));};exports[_0x4b54('0x41')]=function(_0x55c5bc,_0x57fbad){var _0x1789fd={'raw':!![],'where':{'id':_0x55c5bc[_0x4b54('0x42')]['id']}},_0x886d18={};_0x886d18['model']=_[_0x4b54('0x30')](db[_0x4b54('0x2b')][_0x4b54('0x2c')]);_0x886d18[_0x4b54('0x2f')]=_[_0x4b54('0x30')](_0x55c5bc['query']);_0x886d18[_0x4b54('0x31')]=_[_0x4b54('0x32')](_0x886d18[_0x4b54('0x2e')],_0x886d18[_0x4b54('0x2f')]);_0x1789fd[_0x4b54('0x34')]=_[_0x4b54('0x32')](_0x886d18['model'],qs['fields'](_0x55c5bc[_0x4b54('0x2f')]['fields']));_0x1789fd[_0x4b54('0x34')]=_0x1789fd[_0x4b54('0x34')]['length']?_0x1789fd[_0x4b54('0x34')]:_0x886d18[_0x4b54('0x2e')];if(_0x55c5bc[_0x4b54('0x2f')][_0x4b54('0x43')]){_0x1789fd['include']=[{'all':!![]}];}_0x1789fd=_[_0x4b54('0x3c')]({},_0x1789fd,_0x55c5bc[_0x4b54('0x3d')]);return db[_0x4b54('0x2b')][_0x4b54('0x44')](_0x1789fd)[_0x4b54('0x22')](handleEntityNotFound(_0x57fbad,null))[_0x4b54('0x22')](respondWithResult(_0x57fbad,null))[_0x4b54('0x45')](handleError(_0x57fbad,null));};exports['create']=function(_0x5b50a4,_0x3bb788){return db[_0x4b54('0x2b')]['create'](_0x5b50a4[_0x4b54('0x46')],{})[_0x4b54('0x22')](respondWithResult(_0x3bb788,0xc9))[_0x4b54('0x45')](handleError(_0x3bb788,null));};exports['update']=function(_0x55beb3,_0x96e27){if(_0x55beb3[_0x4b54('0x46')]['id']){delete _0x55beb3[_0x4b54('0x46')]['id'];}return db['FaxQueueReport'][_0x4b54('0x44')]({'where':{'id':_0x55beb3[_0x4b54('0x42')]['id']}})[_0x4b54('0x22')](handleEntityNotFound(_0x96e27,null))[_0x4b54('0x22')](saveUpdates(_0x55beb3[_0x4b54('0x46')],null))['then'](respondWithResult(_0x96e27,null))[_0x4b54('0x45')](handleError(_0x96e27,null));};exports['destroy']=function(_0x28652a,_0x59df24){return db['FaxQueueReport']['find']({'where':{'id':_0x28652a[_0x4b54('0x42')]['id']}})[_0x4b54('0x22')](handleEntityNotFound(_0x59df24,null))[_0x4b54('0x22')](removeEntity(_0x59df24,null))[_0x4b54('0x45')](handleError(_0x59df24,null));};exports[_0x4b54('0x47')]=function(_0x4bb189,_0x455d64){return db[_0x4b54('0x2b')]['describe']()[_0x4b54('0x22')](respondWithResult(_0x455d64,null))['catch'](handleError(_0x455d64,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 502c60b..642dbc3 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x814b,0x1a2));var _0xb814=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0x814b[_0x4e21ba];return _0x55b94b;};'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 +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x1cb9,0x14e));var _0x91cb=function(_0x57b705,_0x50afc0){_0x57b705=_0x57b705-0x0;var _0x2be433=_0x1cb9[_0x57b705];return _0x2be433;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 9203e63..d334f92 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 _0x4d56=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','FaxQueueReport','update','attributes'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4d56,0x117));var _0x64d5=function(_0x2ab4fa,_0xf90b71){_0x2ab4fa=_0x2ab4fa-0x0;var _0x5f31aa=_0x4d56[_0x2ab4fa];return _0x5f31aa;};'use strict';var _=require(_0x64d5('0x0'));var util=require(_0x64d5('0x1'));var moment=require(_0x64d5('0x2'));var BPromise=require(_0x64d5('0x3'));var rs=require(_0x64d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x64d5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64d5('0x7'));var client=jayson[_0x64d5('0x8')][_0x64d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ec6f,_0x1b242d,_0x1177ed){return new BPromise(function(_0x5bb9df,_0x4ec5e9){return client[_0x64d5('0xa')](_0x50ec6f,_0x1177ed)[_0x64d5('0xb')](function(_0x42c593){logger[_0x64d5('0xc')](_0x64d5('0xd'),_0x1b242d,_0x64d5('0xe'));logger[_0x64d5('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1b242d,_0x64d5('0xe'),JSON[_0x64d5('0x10')](_0x42c593));if(_0x42c593['error']){if(_0x42c593[_0x64d5('0x11')][_0x64d5('0x12')]===0x1f4){logger[_0x64d5('0x11')](_0x64d5('0xd'),_0x1b242d,_0x42c593[_0x64d5('0x11')][_0x64d5('0x13')]);return _0x4ec5e9(_0x42c593['error'][_0x64d5('0x13')]);}logger[_0x64d5('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x1b242d,_0x42c593[_0x64d5('0x11')][_0x64d5('0x13')]);return _0x5bb9df(_0x42c593['error'][_0x64d5('0x13')]);}else{logger[_0x64d5('0xc')](_0x64d5('0xd'),_0x1b242d,_0x64d5('0xe'));_0x5bb9df(_0x42c593[_0x64d5('0x14')][_0x64d5('0x13')]);}})[_0x64d5('0x15')](function(_0x3b766b){logger[_0x64d5('0x11')](_0x64d5('0xd'),_0x1b242d,_0x3b766b);_0x4ec5e9(_0x3b766b);});});}exports['CreateFaxQueueReport']=function(_0x411c13){var _0x336354=this;return new Promise(function(_0x54b25b,_0x43c7c9){return db['FaxQueueReport'][_0x64d5('0x16')](_0x411c13[_0x64d5('0x17')],{'raw':_0x411c13[_0x64d5('0x18')]?_0x411c13[_0x64d5('0x18')][_0x64d5('0x19')]===undefined?!![]:![]:!![]})[_0x64d5('0xb')](function(_0x22cc89){logger[_0x64d5('0xc')](_0x64d5('0x1a'),_0x411c13);logger[_0x64d5('0xf')](_0x64d5('0x1a'),_0x411c13,JSON[_0x64d5('0x10')](_0x22cc89));_0x54b25b(_0x22cc89);})[_0x64d5('0x15')](function(_0xb2dfcf){logger['error'](_0x64d5('0x1a'),_0xb2dfcf[_0x64d5('0x13')],_0x411c13);_0x43c7c9(_0x336354['error'](0x1f4,_0xb2dfcf[_0x64d5('0x13')]));});});};exports[_0x64d5('0x1b')]=function(_0x55316e){var _0xc48bf1=this;return new Promise(function(_0x4f2f2d,_0x176feb){return db[_0x64d5('0x1c')][_0x64d5('0x1d')](_0x55316e[_0x64d5('0x17')],{'raw':_0x55316e[_0x64d5('0x18')]?_0x55316e['options'][_0x64d5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55316e['options']?_0x55316e[_0x64d5('0x18')]['where']||null:null,'attributes':_0x55316e['options']?_0x55316e['options'][_0x64d5('0x1e')]||null:null,'limit':_0x55316e[_0x64d5('0x18')]?_0x55316e['options']['limit']||null:null})[_0x64d5('0xb')](function(_0x5bda27){logger[_0x64d5('0xc')](_0x64d5('0x1b'),_0x55316e);logger[_0x64d5('0xf')](_0x64d5('0x1b'),_0x55316e,JSON['stringify'](_0x5bda27));_0x4f2f2d(_0x5bda27);})[_0x64d5('0x15')](function(_0x63e8de){logger[_0x64d5('0x11')](_0x64d5('0x1b'),_0x63e8de[_0x64d5('0x13')],_0x55316e);_0x176feb(_0xc48bf1['error'](0x1f4,_0x63e8de[_0x64d5('0x13')]));});});}; \ No newline at end of file +var _0xa5a3=['../../config/utils','../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xa5a3,0x12f));var _0x3a5a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa5a3[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x3a5a('0x0'));var util=require('util');var moment=require(_0x3a5a('0x1'));var BPromise=require(_0x3a5a('0x2'));var rs=require(_0x3a5a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a5a('0x4'))['db'];var utils=require(_0x3a5a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a5a('0x6'));var jayson=require(_0x3a5a('0x7'));var client=jayson[_0x3a5a('0x8')][_0x3a5a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43ac75,_0x483913,_0x1474d2){return new BPromise(function(_0x2287b0,_0x34d35){return client[_0x3a5a('0xa')](_0x43ac75,_0x1474d2)['then'](function(_0x552750){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x483913,'request\x20sent');logger[_0x3a5a('0xb')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x483913,_0x3a5a('0xc'),JSON[_0x3a5a('0xd')](_0x552750));if(_0x552750[_0x3a5a('0xe')]){if(_0x552750['error'][_0x3a5a('0xf')]===0x1f4){logger['error'](_0x3a5a('0x10'),_0x483913,_0x552750[_0x3a5a('0xe')][_0x3a5a('0x11')]);return _0x34d35(_0x552750[_0x3a5a('0xe')][_0x3a5a('0x11')]);}logger[_0x3a5a('0xe')](_0x3a5a('0x10'),_0x483913,_0x552750[_0x3a5a('0xe')][_0x3a5a('0x11')]);return _0x2287b0(_0x552750[_0x3a5a('0xe')][_0x3a5a('0x11')]);}else{logger[_0x3a5a('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x483913,_0x3a5a('0xc'));_0x2287b0(_0x552750[_0x3a5a('0x13')]['message']);}})[_0x3a5a('0x14')](function(_0x215784){logger['error'](_0x3a5a('0x10'),_0x483913,_0x215784);_0x34d35(_0x215784);});});}exports[_0x3a5a('0x15')]=function(_0x15776f){var _0x2016dc=this;return new Promise(function(_0x36ba66,_0x424a99){return db['FaxQueueReport']['create'](_0x15776f[_0x3a5a('0x16')],{'raw':_0x15776f[_0x3a5a('0x17')]?_0x15776f[_0x3a5a('0x17')][_0x3a5a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5b5834){logger[_0x3a5a('0x12')](_0x3a5a('0x15'),_0x15776f);logger[_0x3a5a('0xb')]('CreateFaxQueueReport',_0x15776f,JSON['stringify'](_0x5b5834));_0x36ba66(_0x5b5834);})[_0x3a5a('0x14')](function(_0x370891){logger[_0x3a5a('0xe')](_0x3a5a('0x15'),_0x370891[_0x3a5a('0x11')],_0x15776f);_0x424a99(_0x2016dc['error'](0x1f4,_0x370891[_0x3a5a('0x11')]));});});};exports[_0x3a5a('0x19')]=function(_0x1bd184){var _0x1eade1=this;return new Promise(function(_0x5a00a1,_0x499e48){return db[_0x3a5a('0x1a')][_0x3a5a('0x1b')](_0x1bd184[_0x3a5a('0x16')],{'raw':_0x1bd184[_0x3a5a('0x17')]?_0x1bd184[_0x3a5a('0x17')][_0x3a5a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bd184[_0x3a5a('0x17')]?_0x1bd184['options']['where']||null:null,'attributes':_0x1bd184[_0x3a5a('0x17')]?_0x1bd184['options']['attributes']||null:null,'limit':_0x1bd184[_0x3a5a('0x17')]?_0x1bd184[_0x3a5a('0x17')]['limit']||null:null})['then'](function(_0x31919d){logger['info'](_0x3a5a('0x19'),_0x1bd184);logger[_0x3a5a('0xb')](_0x3a5a('0x19'),_0x1bd184,JSON['stringify'](_0x31919d));_0x5a00a1(_0x31919d);})[_0x3a5a('0x14')](function(_0x52a36f){logger[_0x3a5a('0xe')](_0x3a5a('0x19'),_0x52a36f['message'],_0x1bd184);_0x499e48(_0x1eade1['error'](0x1f4,_0x52a36f[_0x3a5a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8026195..e29ccac 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 _0x5634=['express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5634,0xf4));var _0x4563=function(_0x5aed1e,_0x45b4f2){_0x5aed1e=_0x5aed1e-0x0;var _0x51e7a7=_0x5634[_0x5aed1e];return _0x51e7a7;};'use strict';var multer=require('multer');var util=require(_0x4563('0x0'));var path=require(_0x4563('0x1'));var timeout=require(_0x4563('0x2'));var express=require(_0x4563('0x3'));var router=express[_0x4563('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4563('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4563('0x6'));var controller=require(_0x4563('0x7'));router[_0x4563('0x8')]('/',auth[_0x4563('0x9')](),controller[_0x4563('0xa')]);router[_0x4563('0x8')](_0x4563('0xb'),auth[_0x4563('0x9')](),controller[_0x4563('0xc')]);router[_0x4563('0x8')](_0x4563('0xd'),auth[_0x4563('0x9')](),controller[_0x4563('0xe')]);router[_0x4563('0xf')]('/',auth[_0x4563('0x9')](),controller['create']);router[_0x4563('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4563('0x11')]);router[_0x4563('0x12')](_0x4563('0xd'),auth[_0x4563('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc0fa=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x1c053d,_0x3d3fff){var _0x8a8fe4=function(_0x333232){while(--_0x333232){_0x1c053d['push'](_0x1c053d['shift']());}};_0x8a8fe4(++_0x3d3fff);}(_0xc0fa,0x8e));var _0xac0f=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xc0fa[_0x4aa4e6];return _0x322588;};'use strict';var multer=require('multer');var util=require(_0xac0f('0x0'));var path=require(_0xac0f('0x1'));var timeout=require(_0xac0f('0x2'));var express=require(_0xac0f('0x3'));var router=express[_0xac0f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac0f('0x5'));var config=require(_0xac0f('0x6'));var controller=require('./faxQueueReport.controller');router[_0xac0f('0x7')]('/',auth[_0xac0f('0x8')](),controller[_0xac0f('0x9')]);router[_0xac0f('0x7')]('/describe',auth[_0xac0f('0x8')](),controller[_0xac0f('0xa')]);router[_0xac0f('0x7')](_0xac0f('0xb'),auth[_0xac0f('0x8')](),controller[_0xac0f('0xc')]);router[_0xac0f('0xd')]('/',auth[_0xac0f('0x8')](),controller[_0xac0f('0xe')]);router[_0xac0f('0xf')](_0xac0f('0xb'),auth[_0xac0f('0x8')](),controller[_0xac0f('0x10')]);router[_0xac0f('0x11')](_0xac0f('0xb'),auth['isAuthenticated'](),controller[_0xac0f('0x12')]);module[_0xac0f('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index f3416a3..b8d79a8 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0xf823d,_0x177494){var _0x282e50=function(_0x3797d7){while(--_0x3797d7){_0xf823d['push'](_0xf823d['shift']());}};_0x282e50(++_0x177494);}(_0xedd9,0xfc));var _0x9edd=function(_0x562202,_0x325483){_0x562202=_0x562202-0x0;var _0x1e322f=_0xedd9[_0x562202];return _0x1e322f;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2f2cb6,_0x5f5576){var _0x33c4a7=function(_0x57b59c){while(--_0x57b59c){_0x2f2cb6['push'](_0x2f2cb6['shift']());}};_0x33c4a7(++_0x5f5576);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index fd78c33..9394827 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 _0x9fd0=['../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','then','sendStatus','stack','name','send','index','FaxTransferReport','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x177b55,_0x36e116){var _0x51b579=function(_0x2832f4){while(--_0x2832f4){_0x177b55['push'](_0x177b55['shift']());}};_0x51b579(++_0x36e116);}(_0x9fd0,0x11d));var _0x09fd=function(_0x8143aa,_0x2bd86d){_0x8143aa=_0x8143aa-0x0;var _0x25924c=_0x9fd0[_0x8143aa];return _0x25924c;};'use strict';var emlformat=require(_0x09fd('0x0'));var rimraf=require(_0x09fd('0x1'));var zipdir=require(_0x09fd('0x2'));var jsonpatch=require(_0x09fd('0x3'));var rp=require('request-promise');var moment=require(_0x09fd('0x4'));var BPromise=require(_0x09fd('0x5'));var Mustache=require(_0x09fd('0x6'));var util=require(_0x09fd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x09fd('0x8'));var ejs=require(_0x09fd('0x9'));var fs=require('fs');var fs_extra=require(_0x09fd('0xa'));var _=require(_0x09fd('0xb'));var squel=require(_0x09fd('0xc'));var crypto=require(_0x09fd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x09fd('0xe'));var toCsv=require(_0x09fd('0x8'));var querystring=require(_0x09fd('0xf'));var Papa=require('papaparse');var Redis=require(_0x09fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x09fd('0x11'));var as=require(_0x09fd('0x12'));var hardwareService=require(_0x09fd('0x13'));var logger=require('../../config/logger')(_0x09fd('0x14'));var utils=require(_0x09fd('0x15'));var config=require(_0x09fd('0x16'));var licenseUtil=require(_0x09fd('0x17'));var db=require(_0x09fd('0x18'))['db'];function respondWithStatusCode(_0xc542ca,_0x556e24){_0x556e24=_0x556e24||0xcc;return function(_0x5e9a90){if(_0x5e9a90){return _0xc542ca['sendStatus'](_0x556e24);}return _0xc542ca[_0x09fd('0x19')](_0x556e24)[_0x09fd('0x1a')]();};}function respondWithResult(_0x548379,_0x179e6d){_0x179e6d=_0x179e6d||0xc8;return function(_0x37cf9a){if(_0x37cf9a){return _0x548379[_0x09fd('0x19')](_0x179e6d)[_0x09fd('0x1b')](_0x37cf9a);}};}function respondWithFilteredResult(_0x5f2737,_0x5ea0f0){return function(_0x3759ac){if(_0x3759ac){var _0x350a74=typeof _0x5ea0f0['offset']===_0x09fd('0x1c')&&typeof _0x5ea0f0[_0x09fd('0x1d')]==='undefined';var _0x32f496=_0x3759ac[_0x09fd('0x1e')];var _0x46772c=_0x350a74?0x0:_0x5ea0f0[_0x09fd('0x1f')];var _0x4ef47a=_0x350a74?_0x3759ac[_0x09fd('0x1e')]:_0x5ea0f0[_0x09fd('0x1f')]+_0x5ea0f0[_0x09fd('0x1d')];var _0x187084;if(_0x4ef47a>=_0x32f496){_0x4ef47a=_0x32f496;_0x187084=0xc8;}else{_0x187084=0xce;}_0x5f2737['status'](_0x187084);return _0x5f2737[_0x09fd('0x20')](_0x09fd('0x21'),_0x46772c+'-'+_0x4ef47a+'/'+_0x32f496)[_0x09fd('0x1b')](_0x3759ac);}return null;};}function patchUpdates(_0x465ba9){return function(_0x4535d2){try{jsonpatch['apply'](_0x4535d2,_0x465ba9,!![]);}catch(_0x25692b){return BPromise[_0x09fd('0x22')](_0x25692b);}return _0x4535d2[_0x09fd('0x23')]();};}function saveUpdates(_0x424a46,_0x284ae5){return function(_0x390b7e){if(_0x390b7e){return _0x390b7e['update'](_0x424a46)['then'](function(_0x35f6f1){return _0x35f6f1;});}return null;};}function removeEntity(_0xdf620f,_0x2a53aa){return function(_0xfa0afd){if(_0xfa0afd){return _0xfa0afd[_0x09fd('0x24')]()[_0x09fd('0x25')](function(){_0xdf620f['status'](0xcc)[_0x09fd('0x1a')]();});}};}function handleEntityNotFound(_0x3e01b9,_0x51f97e){return function(_0x2678cd){if(!_0x2678cd){_0x3e01b9[_0x09fd('0x26')](0x194);}return _0x2678cd;};}function handleError(_0xdbeebe,_0x3321d6){_0x3321d6=_0x3321d6||0x1f4;return function(_0x5c42af){logger['error'](_0x5c42af[_0x09fd('0x27')]);if(_0x5c42af['name']){delete _0x5c42af[_0x09fd('0x28')];}_0xdbeebe[_0x09fd('0x19')](_0x3321d6)[_0x09fd('0x29')](_0x5c42af);};}exports[_0x09fd('0x2a')]=function(_0x51180d,_0x3184fc){var _0x3e0fc3={},_0x397531={},_0x28f7fd={'count':0x0,'rows':[]};var _0xd8c7e7=_['map'](db[_0x09fd('0x2b')][_0x09fd('0x2c')],function(_0x3a61f0){return{'name':_0x3a61f0['fieldName'],'type':_0x3a61f0[_0x09fd('0x2d')][_0x09fd('0x2e')]};});_0x397531[_0x09fd('0x2f')]=_[_0x09fd('0x30')](_0xd8c7e7,_0x09fd('0x28'));_0x397531[_0x09fd('0x31')]=_['keys'](_0x51180d[_0x09fd('0x31')]);_0x397531[_0x09fd('0x32')]=_['intersection'](_0x397531[_0x09fd('0x2f')],_0x397531[_0x09fd('0x31')]);_0x3e0fc3['attributes']=_[_0x09fd('0x33')](_0x397531[_0x09fd('0x2f')],qs[_0x09fd('0x34')](_0x51180d[_0x09fd('0x31')][_0x09fd('0x34')]));_0x3e0fc3[_0x09fd('0x35')]=_0x3e0fc3[_0x09fd('0x35')]['length']?_0x3e0fc3['attributes']:_0x397531[_0x09fd('0x2f')];if(!_0x51180d['query'][_0x09fd('0x36')]('nolimit')){_0x3e0fc3[_0x09fd('0x1d')]=qs[_0x09fd('0x1d')](_0x51180d[_0x09fd('0x31')][_0x09fd('0x1d')]);_0x3e0fc3[_0x09fd('0x1f')]=qs[_0x09fd('0x1f')](_0x51180d[_0x09fd('0x31')][_0x09fd('0x1f')]);}_0x3e0fc3[_0x09fd('0x37')]=qs[_0x09fd('0x38')](_0x51180d[_0x09fd('0x31')]['sort']);_0x3e0fc3['where']=qs[_0x09fd('0x32')](_[_0x09fd('0x39')](_0x51180d[_0x09fd('0x31')],_0x397531[_0x09fd('0x32')]),_0xd8c7e7);if(_0x51180d['query'][_0x09fd('0x3a')]){_0x3e0fc3[_0x09fd('0x3b')]=_['merge'](_0x3e0fc3[_0x09fd('0x3b')],{'$or':_['map'](_0xd8c7e7,function(_0x480362){if(_0x480362[_0x09fd('0x2d')]!==_0x09fd('0x3c')){var _0xff2d3a={};_0xff2d3a[_0x480362[_0x09fd('0x28')]]={'$like':'%'+_0x51180d[_0x09fd('0x31')][_0x09fd('0x3a')]+'%'};return _0xff2d3a;}})});}_0x3e0fc3=_[_0x09fd('0x3d')]({},_0x3e0fc3,_0x51180d[_0x09fd('0x3e')]);var _0x4726ed={'where':_0x3e0fc3[_0x09fd('0x3b')]};return db['FaxTransferReport'][_0x09fd('0x1e')](_0x4726ed)[_0x09fd('0x25')](function(_0x2fb371){_0x28f7fd[_0x09fd('0x1e')]=_0x2fb371;if(_0x51180d[_0x09fd('0x31')][_0x09fd('0x3f')]){_0x3e0fc3[_0x09fd('0x40')]=[{'all':!![]}];}return db[_0x09fd('0x2b')][_0x09fd('0x41')](_0x3e0fc3);})[_0x09fd('0x25')](function(_0x1f7944){_0x28f7fd[_0x09fd('0x42')]=_0x1f7944;return _0x28f7fd;})[_0x09fd('0x25')](respondWithFilteredResult(_0x3184fc,_0x3e0fc3))[_0x09fd('0x43')](handleError(_0x3184fc,null));};exports[_0x09fd('0x44')]=function(_0x120fa2,_0xcb4a41){var _0x2fcddc={'raw':!![],'where':{'id':_0x120fa2[_0x09fd('0x45')]['id']}},_0x18df08={};_0x18df08[_0x09fd('0x2f')]=_['keys'](db['FaxTransferReport'][_0x09fd('0x2c')]);_0x18df08[_0x09fd('0x31')]=_[_0x09fd('0x46')](_0x120fa2['query']);_0x18df08[_0x09fd('0x32')]=_['intersection'](_0x18df08[_0x09fd('0x2f')],_0x18df08['query']);_0x2fcddc['attributes']=_[_0x09fd('0x33')](_0x18df08[_0x09fd('0x2f')],qs[_0x09fd('0x34')](_0x120fa2['query'][_0x09fd('0x34')]));_0x2fcddc['attributes']=_0x2fcddc[_0x09fd('0x35')][_0x09fd('0x47')]?_0x2fcddc[_0x09fd('0x35')]:_0x18df08[_0x09fd('0x2f')];if(_0x120fa2[_0x09fd('0x31')][_0x09fd('0x3f')]){_0x2fcddc[_0x09fd('0x40')]=[{'all':!![]}];}_0x2fcddc=_['merge']({},_0x2fcddc,_0x120fa2[_0x09fd('0x3e')]);return db[_0x09fd('0x2b')][_0x09fd('0x48')](_0x2fcddc)[_0x09fd('0x25')](handleEntityNotFound(_0xcb4a41,null))[_0x09fd('0x25')](respondWithResult(_0xcb4a41,null))[_0x09fd('0x43')](handleError(_0xcb4a41,null));};exports[_0x09fd('0x49')]=function(_0x4c518d,_0x1076d0){return db[_0x09fd('0x2b')][_0x09fd('0x49')](_0x4c518d[_0x09fd('0x4a')],{})['then'](respondWithResult(_0x1076d0,0xc9))[_0x09fd('0x43')](handleError(_0x1076d0,null));};exports[_0x09fd('0x4b')]=function(_0x3307a1,_0x3e16f6){if(_0x3307a1[_0x09fd('0x4a')]['id']){delete _0x3307a1[_0x09fd('0x4a')]['id'];}return db[_0x09fd('0x2b')]['find']({'where':{'id':_0x3307a1[_0x09fd('0x45')]['id']}})[_0x09fd('0x25')](handleEntityNotFound(_0x3e16f6,null))[_0x09fd('0x25')](saveUpdates(_0x3307a1[_0x09fd('0x4a')],null))[_0x09fd('0x25')](respondWithResult(_0x3e16f6,null))[_0x09fd('0x43')](handleError(_0x3e16f6,null));};exports[_0x09fd('0x24')]=function(_0x3404bb,_0x6e0f75){return db[_0x09fd('0x2b')][_0x09fd('0x48')]({'where':{'id':_0x3404bb[_0x09fd('0x45')]['id']}})[_0x09fd('0x25')](handleEntityNotFound(_0x6e0f75,null))[_0x09fd('0x25')](removeEntity(_0x6e0f75,null))[_0x09fd('0x43')](handleError(_0x6e0f75,null));};exports[_0x09fd('0x4c')]=function(_0x29682e,_0x450188){return db[_0x09fd('0x2b')][_0x09fd('0x4c')]()[_0x09fd('0x25')](respondWithResult(_0x450188,null))[_0x09fd('0x43')](handleError(_0x450188,null));}; \ No newline at end of file +var _0x1213=['create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','stack','name','index','FaxTransferReport','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x14563f,_0x376828){var _0x4f0d09=function(_0x10ce33){while(--_0x10ce33){_0x14563f['push'](_0x14563f['shift']());}};_0x4f0d09(++_0x376828);}(_0x1213,0x1a7));var _0x3121=function(_0x38dcff,_0x5f249d){_0x38dcff=_0x38dcff-0x0;var _0x6cb881=_0x1213[_0x38dcff];return _0x6cb881;};'use strict';var emlformat=require(_0x3121('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3121('0x1'));var jsonpatch=require(_0x3121('0x2'));var rp=require('request-promise');var moment=require(_0x3121('0x3'));var BPromise=require(_0x3121('0x4'));var Mustache=require(_0x3121('0x5'));var util=require(_0x3121('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3121('0x7'));var ejs=require(_0x3121('0x8'));var fs=require('fs');var fs_extra=require(_0x3121('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3121('0xa'));var jsforce=require(_0x3121('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3121('0x7'));var querystring=require(_0x3121('0xc'));var Papa=require(_0x3121('0xd'));var Redis=require(_0x3121('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3121('0xf'));var as=require(_0x3121('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3121('0x11'));var config=require(_0x3121('0x12'));var licenseUtil=require(_0x3121('0x13'));var db=require(_0x3121('0x14'))['db'];function respondWithStatusCode(_0x219ede,_0x57c6f5){_0x57c6f5=_0x57c6f5||0xcc;return function(_0x2bcae6){if(_0x2bcae6){return _0x219ede[_0x3121('0x15')](_0x57c6f5);}return _0x219ede[_0x3121('0x16')](_0x57c6f5)[_0x3121('0x17')]();};}function respondWithResult(_0x52df0a,_0x3e2bf1){_0x3e2bf1=_0x3e2bf1||0xc8;return function(_0x2d542a){if(_0x2d542a){return _0x52df0a['status'](_0x3e2bf1)[_0x3121('0x18')](_0x2d542a);}};}function respondWithFilteredResult(_0x12b0d6,_0x166ef7){return function(_0xa91e10){if(_0xa91e10){var _0x1ce592=typeof _0x166ef7[_0x3121('0x19')]===_0x3121('0x1a')&&typeof _0x166ef7[_0x3121('0x1b')]===_0x3121('0x1a');var _0x68820f=_0xa91e10[_0x3121('0x1c')];var _0x55de74=_0x1ce592?0x0:_0x166ef7[_0x3121('0x19')];var _0x2c309f=_0x1ce592?_0xa91e10[_0x3121('0x1c')]:_0x166ef7[_0x3121('0x19')]+_0x166ef7[_0x3121('0x1b')];var _0x557cc8;if(_0x2c309f>=_0x68820f){_0x2c309f=_0x68820f;_0x557cc8=0xc8;}else{_0x557cc8=0xce;}_0x12b0d6[_0x3121('0x16')](_0x557cc8);return _0x12b0d6[_0x3121('0x1d')]('Content-Range',_0x55de74+'-'+_0x2c309f+'/'+_0x68820f)['json'](_0xa91e10);}return null;};}function patchUpdates(_0x2a09c5){return function(_0x4476ea){try{jsonpatch['apply'](_0x4476ea,_0x2a09c5,!![]);}catch(_0x2c4a31){return BPromise['reject'](_0x2c4a31);}return _0x4476ea['save']();};}function saveUpdates(_0xf05c3d,_0x336112){return function(_0x11fc0e){if(_0x11fc0e){return _0x11fc0e[_0x3121('0x1e')](_0xf05c3d)[_0x3121('0x1f')](function(_0x496f4f){return _0x496f4f;});}return null;};}function removeEntity(_0x431912,_0x3cb93e){return function(_0xb98293){if(_0xb98293){return _0xb98293[_0x3121('0x20')]()[_0x3121('0x1f')](function(){_0x431912['status'](0xcc)[_0x3121('0x17')]();});}};}function handleEntityNotFound(_0x65bbba,_0x1c1e44){return function(_0x551bfb){if(!_0x551bfb){_0x65bbba[_0x3121('0x15')](0x194);}return _0x551bfb;};}function handleError(_0x1400fc,_0x18018c){_0x18018c=_0x18018c||0x1f4;return function(_0x20d42e){logger[_0x3121('0x21')](_0x20d42e[_0x3121('0x22')]);if(_0x20d42e[_0x3121('0x23')]){delete _0x20d42e[_0x3121('0x23')];}_0x1400fc[_0x3121('0x16')](_0x18018c)['send'](_0x20d42e);};}exports[_0x3121('0x24')]=function(_0x1171b1,_0x55f590){var _0x58c123={},_0x149466={},_0x13f681={'count':0x0,'rows':[]};var _0x5c7448=_['map'](db[_0x3121('0x25')]['rawAttributes'],function(_0x1be38a){return{'name':_0x1be38a[_0x3121('0x26')],'type':_0x1be38a[_0x3121('0x27')][_0x3121('0x28')]};});_0x149466[_0x3121('0x29')]=_[_0x3121('0x2a')](_0x5c7448,_0x3121('0x23'));_0x149466[_0x3121('0x2b')]=_[_0x3121('0x2c')](_0x1171b1[_0x3121('0x2b')]);_0x149466['filters']=_['intersection'](_0x149466[_0x3121('0x29')],_0x149466[_0x3121('0x2b')]);_0x58c123[_0x3121('0x2d')]=_[_0x3121('0x2e')](_0x149466[_0x3121('0x29')],qs[_0x3121('0x2f')](_0x1171b1[_0x3121('0x2b')]['fields']));_0x58c123[_0x3121('0x2d')]=_0x58c123[_0x3121('0x2d')][_0x3121('0x30')]?_0x58c123[_0x3121('0x2d')]:_0x149466['model'];if(!_0x1171b1['query']['hasOwnProperty'](_0x3121('0x31'))){_0x58c123['limit']=qs[_0x3121('0x1b')](_0x1171b1[_0x3121('0x2b')][_0x3121('0x1b')]);_0x58c123['offset']=qs[_0x3121('0x19')](_0x1171b1[_0x3121('0x2b')][_0x3121('0x19')]);}_0x58c123['order']=qs[_0x3121('0x32')](_0x1171b1[_0x3121('0x2b')][_0x3121('0x32')]);_0x58c123['where']=qs['filters'](_[_0x3121('0x33')](_0x1171b1[_0x3121('0x2b')],_0x149466[_0x3121('0x34')]),_0x5c7448);if(_0x1171b1[_0x3121('0x2b')][_0x3121('0x35')]){_0x58c123[_0x3121('0x36')]=_[_0x3121('0x37')](_0x58c123[_0x3121('0x36')],{'$or':_[_0x3121('0x2a')](_0x5c7448,function(_0x7897cd){if(_0x7897cd['type']!==_0x3121('0x38')){var _0x286c89={};_0x286c89[_0x7897cd[_0x3121('0x23')]]={'$like':'%'+_0x1171b1['query']['filter']+'%'};return _0x286c89;}})});}_0x58c123=_[_0x3121('0x37')]({},_0x58c123,_0x1171b1[_0x3121('0x39')]);var _0x56ef62={'where':_0x58c123[_0x3121('0x36')]};return db[_0x3121('0x25')][_0x3121('0x1c')](_0x56ef62)['then'](function(_0x131f0f){_0x13f681['count']=_0x131f0f;if(_0x1171b1[_0x3121('0x2b')][_0x3121('0x3a')]){_0x58c123[_0x3121('0x3b')]=[{'all':!![]}];}return db[_0x3121('0x25')][_0x3121('0x3c')](_0x58c123);})['then'](function(_0x9d5284){_0x13f681[_0x3121('0x3d')]=_0x9d5284;return _0x13f681;})[_0x3121('0x1f')](respondWithFilteredResult(_0x55f590,_0x58c123))[_0x3121('0x3e')](handleError(_0x55f590,null));};exports[_0x3121('0x3f')]=function(_0x8e183c,_0x27e5f7){var _0x3097bf={'raw':!![],'where':{'id':_0x8e183c[_0x3121('0x40')]['id']}},_0x14da6e={};_0x14da6e['model']=_[_0x3121('0x2c')](db[_0x3121('0x25')][_0x3121('0x41')]);_0x14da6e[_0x3121('0x2b')]=_[_0x3121('0x2c')](_0x8e183c[_0x3121('0x2b')]);_0x14da6e['filters']=_['intersection'](_0x14da6e[_0x3121('0x29')],_0x14da6e[_0x3121('0x2b')]);_0x3097bf[_0x3121('0x2d')]=_[_0x3121('0x2e')](_0x14da6e[_0x3121('0x29')],qs['fields'](_0x8e183c[_0x3121('0x2b')][_0x3121('0x2f')]));_0x3097bf[_0x3121('0x2d')]=_0x3097bf[_0x3121('0x2d')][_0x3121('0x30')]?_0x3097bf['attributes']:_0x14da6e[_0x3121('0x29')];if(_0x8e183c[_0x3121('0x2b')]['includeAll']){_0x3097bf[_0x3121('0x3b')]=[{'all':!![]}];}_0x3097bf=_[_0x3121('0x37')]({},_0x3097bf,_0x8e183c[_0x3121('0x39')]);return db[_0x3121('0x25')][_0x3121('0x42')](_0x3097bf)[_0x3121('0x1f')](handleEntityNotFound(_0x27e5f7,null))[_0x3121('0x1f')](respondWithResult(_0x27e5f7,null))[_0x3121('0x3e')](handleError(_0x27e5f7,null));};exports[_0x3121('0x43')]=function(_0xa46a1f,_0x4d345e){return db[_0x3121('0x25')][_0x3121('0x43')](_0xa46a1f[_0x3121('0x44')],{})[_0x3121('0x1f')](respondWithResult(_0x4d345e,0xc9))[_0x3121('0x3e')](handleError(_0x4d345e,null));};exports[_0x3121('0x1e')]=function(_0x4e0e97,_0x587531){if(_0x4e0e97[_0x3121('0x44')]['id']){delete _0x4e0e97[_0x3121('0x44')]['id'];}return db[_0x3121('0x25')][_0x3121('0x42')]({'where':{'id':_0x4e0e97['params']['id']}})[_0x3121('0x1f')](handleEntityNotFound(_0x587531,null))[_0x3121('0x1f')](saveUpdates(_0x4e0e97[_0x3121('0x44')],null))[_0x3121('0x1f')](respondWithResult(_0x587531,null))[_0x3121('0x3e')](handleError(_0x587531,null));};exports[_0x3121('0x20')]=function(_0x16d4e0,_0x13e7f2){return db[_0x3121('0x25')][_0x3121('0x42')]({'where':{'id':_0x16d4e0[_0x3121('0x40')]['id']}})[_0x3121('0x1f')](handleEntityNotFound(_0x13e7f2,null))[_0x3121('0x1f')](removeEntity(_0x13e7f2,null))['catch'](handleError(_0x13e7f2,null));};exports[_0x3121('0x45')]=function(_0x4bcd9b,_0x108b6a){return db['FaxTransferReport']['describe']()[_0x3121('0x1f')](respondWithResult(_0x108b6a,null))[_0x3121('0x3e')](handleError(_0x108b6a,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index c31888b..e3b4ac0 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 _0x9b2a=['exports','define','report_fax_transfer','lodash','../../config/logger','api','request-promise','path','./faxTransferReport.attributes'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0x9b2a,0x8a));var _0xa9b2=function(_0x270ff3,_0x13751c){_0x270ff3=_0x270ff3-0x0;var _0x220388=_0x9b2a[_0x270ff3];return _0x220388;};'use strict';var _=require(_0xa9b2('0x0'));var util=require('util');var logger=require(_0xa9b2('0x1'))(_0xa9b2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa9b2('0x3'));var fs=require('fs');var path=require(_0xa9b2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9b2('0x5'));module[_0xa9b2('0x6')]=function(_0x4539ae,_0x56a3f7){return _0x4539ae[_0xa9b2('0x7')]('FaxTransferReport',attributes,{'tableName':_0xa9b2('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x62cf=['bluebird','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x1b7e60,_0xefa61a){var _0x12e244=function(_0x2e0b18){while(--_0x2e0b18){_0x1b7e60['push'](_0x1b7e60['shift']());}};_0x12e244(++_0xefa61a);}(_0x62cf,0x81));var _0xf62c=function(_0x590ace,_0x5c2b6a){_0x590ace=_0x590ace-0x0;var _0x356fff=_0x62cf[_0x590ace];return _0x356fff;};'use strict';var _=require(_0xf62c('0x0'));var util=require('util');var logger=require(_0xf62c('0x1'))('api');var moment=require(_0xf62c('0x2'));var BPromise=require(_0xf62c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var attributes=require(_0xf62c('0x6'));module[_0xf62c('0x7')]=function(_0x3604f0,_0x40487e){return _0x3604f0[_0xf62c('0x8')](_0xf62c('0x9'),attributes,{'tableName':_0xf62c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf62c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4f707ed..4522ec7 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 _0x73a0=['jayson/promise','client','http','request','then','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1ba71b,_0xfa5ab){var _0x386eed=function(_0x380f24){while(--_0x380f24){_0x1ba71b['push'](_0x1ba71b['shift']());}};_0x386eed(++_0xfa5ab);}(_0x73a0,0x118));var _0x073a=function(_0x13e0f0,_0x142ea5){_0x13e0f0=_0x13e0f0-0x0;var _0x107047=_0x73a0[_0x13e0f0];return _0x107047;};'use strict';var _=require(_0x073a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x073a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x073a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x073a('0x3'))(_0x073a('0x4'));var config=require(_0x073a('0x5'));var jayson=require(_0x073a('0x6'));var client=jayson[_0x073a('0x7')][_0x073a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bf023,_0x10f134,_0x557931){return new BPromise(function(_0x3b357f,_0xcd6a57){return client[_0x073a('0x9')](_0x5bf023,_0x557931)[_0x073a('0xa')](function(_0x2c4109){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x10f134,_0x073a('0xb'));logger[_0x073a('0xc')](_0x073a('0xd'),_0x10f134,'request\x20sent',JSON[_0x073a('0xe')](_0x2c4109));if(_0x2c4109[_0x073a('0xf')]){if(_0x2c4109[_0x073a('0xf')][_0x073a('0x10')]===0x1f4){logger['error'](_0x073a('0x11'),_0x10f134,_0x2c4109['error'][_0x073a('0x12')]);return _0xcd6a57(_0x2c4109[_0x073a('0xf')][_0x073a('0x12')]);}logger[_0x073a('0xf')](_0x073a('0x11'),_0x10f134,_0x2c4109['error'][_0x073a('0x12')]);return _0x3b357f(_0x2c4109['error'][_0x073a('0x12')]);}else{logger[_0x073a('0x13')](_0x073a('0x11'),_0x10f134,_0x073a('0xb'));_0x3b357f(_0x2c4109[_0x073a('0x14')]['message']);}})[_0x073a('0x15')](function(_0x51d3a7){logger[_0x073a('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x10f134,_0x51d3a7);_0xcd6a57(_0x51d3a7);});});} \ No newline at end of file +var _0x6bc5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x1c98d9,_0x52c359){var _0x1e7092=function(_0x32881a){while(--_0x32881a){_0x1c98d9['push'](_0x1c98d9['shift']());}};_0x1e7092(++_0x52c359);}(_0x6bc5,0xd3));var _0x56bc=function(_0x34e083,_0x6fd8f3){_0x34e083=_0x34e083-0x0;var _0x2d87db=_0x6bc5[_0x34e083];return _0x2d87db;};'use strict';var _=require(_0x56bc('0x0'));var util=require(_0x56bc('0x1'));var moment=require(_0x56bc('0x2'));var BPromise=require(_0x56bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56bc('0x4'));var db=require(_0x56bc('0x5'))['db'];var utils=require(_0x56bc('0x6'));var logger=require(_0x56bc('0x7'))(_0x56bc('0x8'));var config=require(_0x56bc('0x9'));var jayson=require(_0x56bc('0xa'));var client=jayson[_0x56bc('0xb')][_0x56bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x383201,_0x149b9c,_0x2bdd36){return new BPromise(function(_0x2cb790,_0x1267e2){return client[_0x56bc('0xd')](_0x383201,_0x2bdd36)[_0x56bc('0xe')](function(_0x49580c){logger[_0x56bc('0xf')](_0x56bc('0x10'),_0x149b9c,_0x56bc('0x11'));logger[_0x56bc('0x12')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x149b9c,'request\x20sent',JSON[_0x56bc('0x13')](_0x49580c));if(_0x49580c[_0x56bc('0x14')]){if(_0x49580c[_0x56bc('0x14')][_0x56bc('0x15')]===0x1f4){logger[_0x56bc('0x14')](_0x56bc('0x10'),_0x149b9c,_0x49580c['error'][_0x56bc('0x16')]);return _0x1267e2(_0x49580c['error'][_0x56bc('0x16')]);}logger[_0x56bc('0x14')](_0x56bc('0x10'),_0x149b9c,_0x49580c['error'][_0x56bc('0x16')]);return _0x2cb790(_0x49580c[_0x56bc('0x14')][_0x56bc('0x16')]);}else{logger[_0x56bc('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x149b9c,'request\x20sent');_0x2cb790(_0x49580c[_0x56bc('0x17')]['message']);}})['catch'](function(_0x157bd3){logger[_0x56bc('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x149b9c,_0x157bd3);_0x1267e2(_0x157bd3);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 43b88ac..a243960 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 _0xbe0b=['/:id','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x4947a7,_0x210ba5){var _0x4ec91f=function(_0x5cb999){while(--_0x5cb999){_0x4947a7['push'](_0x4947a7['shift']());}};_0x4ec91f(++_0x210ba5);}(_0xbe0b,0xeb));var _0xbbe0=function(_0x4160d2,_0x30cafa){_0x4160d2=_0x4160d2-0x0;var _0x5841fb=_0xbe0b[_0x4160d2];return _0x5841fb;};'use strict';var multer=require('multer');var util=require(_0xbbe0('0x0'));var path=require(_0xbbe0('0x1'));var timeout=require(_0xbbe0('0x2'));var express=require(_0xbbe0('0x3'));var router=express['Router']();var fs_extra=require(_0xbbe0('0x4'));var auth=require(_0xbbe0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbbe0('0x6'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xbbe0('0x7')](),controller[_0xbbe0('0x8')]);router[_0xbbe0('0x9')](_0xbbe0('0xa'),auth[_0xbbe0('0x7')](),controller[_0xbbe0('0xb')]);router[_0xbbe0('0x9')](_0xbbe0('0xc'),auth[_0xbbe0('0x7')](),controller['show']);router[_0xbbe0('0xd')]('/',auth[_0xbbe0('0x7')](),controller['create']);router[_0xbbe0('0xe')](_0xbbe0('0xc'),auth[_0xbbe0('0x7')](),controller[_0xbbe0('0xf')]);router[_0xbbe0('0x10')](_0xbbe0('0xc'),auth[_0xbbe0('0x7')](),controller[_0xbbe0('0x11')]);module[_0xbbe0('0x12')]=router; \ No newline at end of file +var _0x1b91=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x46218b,_0x5ee48b){var _0x5aa909=function(_0x27e1ea){while(--_0x27e1ea){_0x46218b['push'](_0x46218b['shift']());}};_0x5aa909(++_0x5ee48b);}(_0x1b91,0x1c5));var _0x11b9=function(_0x5db59e,_0x18e1ae){_0x5db59e=_0x5db59e-0x0;var _0x54bc9f=_0x1b91[_0x5db59e];return _0x54bc9f;};'use strict';var multer=require(_0x11b9('0x0'));var util=require(_0x11b9('0x1'));var path=require(_0x11b9('0x2'));var timeout=require(_0x11b9('0x3'));var express=require(_0x11b9('0x4'));var router=express['Router']();var fs_extra=require(_0x11b9('0x5'));var auth=require(_0x11b9('0x6'));var interaction=require(_0x11b9('0x7'));var config=require(_0x11b9('0x8'));var controller=require(_0x11b9('0x9'));router[_0x11b9('0xa')]('/',auth[_0x11b9('0xb')](),controller[_0x11b9('0xc')]);router[_0x11b9('0xa')](_0x11b9('0xd'),auth[_0x11b9('0xb')](),controller[_0x11b9('0xe')]);router['get'](_0x11b9('0xf'),auth[_0x11b9('0xb')](),controller[_0x11b9('0x10')]);router[_0x11b9('0x11')]('/',auth[_0x11b9('0xb')](),controller[_0x11b9('0x12')]);router[_0x11b9('0x13')](_0x11b9('0xf'),auth[_0x11b9('0xb')](),controller[_0x11b9('0x14')]);router[_0x11b9('0x15')](_0x11b9('0xf'),auth[_0x11b9('0xb')](),controller[_0x11b9('0x16')]);module[_0x11b9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 9de4e25..5367d51 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 _0x399c=['fs-extra','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','create','/:id/configurations','put','/:id','multer','path','connect-timeout','express','Router'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x399c,0x12d));var _0xc399=function(_0x3ca3a9,_0x55127c){_0x3ca3a9=_0x3ca3a9-0x0;var _0x38ce44=_0x399c[_0x3ca3a9];return _0x38ce44;};'use strict';var multer=require(_0xc399('0x0'));var util=require('util');var path=require(_0xc399('0x1'));var timeout=require(_0xc399('0x2'));var express=require(_0xc399('0x3'));var router=express[_0xc399('0x4')]();var fs_extra=require(_0xc399('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc399('0x6'));var controller=require(_0xc399('0x7'));router[_0xc399('0x8')]('/',auth[_0xc399('0x9')](),controller[_0xc399('0xa')]);router[_0xc399('0x8')]('/:id',auth[_0xc399('0x9')](),controller['show']);router[_0xc399('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc399('0xb')]);router[_0xc399('0x8')](_0xc399('0xc'),auth['isAuthenticated'](),controller[_0xc399('0xd')]);router['post']('/',auth[_0xc399('0x9')](),controller[_0xc399('0xe')]);router['post'](_0xc399('0xf'),auth[_0xc399('0x9')](),controller['addConfiguration']);router[_0xc399('0x10')](_0xc399('0x11'),auth[_0xc399('0x9')](),controller['update']);router['delete'](_0xc399('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x42b2=['update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put'];(function(_0x3c1309,_0x66e161){var _0x4b71bf=function(_0x46426e){while(--_0x46426e){_0x3c1309['push'](_0x3c1309['shift']());}};_0x4b71bf(++_0x66e161);}(_0x42b2,0x17a));var _0x242b=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x42b2[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x242b('0x0'));var util=require(_0x242b('0x1'));var path=require('path');var timeout=require(_0x242b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x242b('0x3'));var auth=require(_0x242b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x242b('0x5'));var controller=require(_0x242b('0x6'));router[_0x242b('0x7')]('/',auth[_0x242b('0x8')](),controller[_0x242b('0x9')]);router[_0x242b('0x7')](_0x242b('0xa'),auth[_0x242b('0x8')](),controller[_0x242b('0xb')]);router[_0x242b('0x7')](_0x242b('0xc'),auth[_0x242b('0x8')](),controller[_0x242b('0xd')]);router[_0x242b('0x7')](_0x242b('0xe'),auth[_0x242b('0x8')](),controller['getFields']);router[_0x242b('0xf')]('/',auth[_0x242b('0x8')](),controller[_0x242b('0x10')]);router['post']('/:id/configurations',auth[_0x242b('0x8')](),controller['addConfiguration']);router[_0x242b('0x11')](_0x242b('0xa'),auth[_0x242b('0x8')](),controller[_0x242b('0x12')]);router[_0x242b('0x13')]('/:id',auth[_0x242b('0x8')](),controller[_0x242b('0x14')]);module[_0x242b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 52c9647..a1c9806 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 _0x84f2=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x5cb6f3,_0x4085bc){var _0x225ffe=function(_0x1f1406){while(--_0x1f1406){_0x5cb6f3['push'](_0x5cb6f3['shift']());}};_0x225ffe(++_0x4085bc);}(_0x84f2,0x14a));var _0x284f=function(_0x260b6f,_0x1edc36){_0x260b6f=_0x260b6f-0x0;var _0x3f672e=_0x84f2[_0x260b6f];return _0x3f672e;};'use strict';var Sequelize=require(_0x284f('0x0'));module[_0x284f('0x1')]={'name':{'type':Sequelize[_0x284f('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x284f('0x2')]},'remoteUri':{'type':Sequelize[_0x284f('0x2')]},'authType':{'type':Sequelize[_0x284f('0x3')](_0x284f('0x4')),'defaultValue':_0x284f('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x284f('0x2')]},'consumerSecret':{'type':Sequelize[_0x284f('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x284f('0x2')]},'serverUrl':{'type':Sequelize[_0x284f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x284f('0x3')](_0x284f('0x5'),_0x284f('0x6')),'defaultValue':_0x284f('0x5')}}; \ No newline at end of file +var _0x8210=['exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x14892a,_0x4abed2){var _0x4557ab=function(_0x37a2c4){while(--_0x37a2c4){_0x14892a['push'](_0x14892a['shift']());}};_0x4557ab(++_0x4abed2);}(_0x8210,0xd8));var _0x0821=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x8210[_0x543084];return _0x306a57;};'use strict';var Sequelize=require('sequelize');module[_0x0821('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0821('0x1')]},'username':{'type':Sequelize[_0x0821('0x1')]},'remoteUri':{'type':Sequelize[_0x0821('0x1')]},'authType':{'type':Sequelize[_0x0821('0x2')](_0x0821('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x0821('0x1')]},'consumerSecret':{'type':Sequelize[_0x0821('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x0821('0x1')]},'serverUrl':{'type':Sequelize[_0x0821('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0821('0x2')]('integrationTab',_0x0821('0x4')),'defaultValue':_0x0821('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6f7349c..7f5b814 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 _0xd5d8=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','DeskAccount','findAll','rows','params','includeAll','find','create','body','catch','getConfigurations','findOne','DeskConfiguration','AccountId','getSubjects','channel','Descriptions','getFields','priority','authType','username','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','format','application/json','basic','Basic\x20%s','%s:%s','password','toString','concat','_embedded','entries','active','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','model','keys','query'];(function(_0x3588b9,_0x287026){var _0x316d56=function(_0x5086d3){while(--_0x5086d3){_0x3588b9['push'](_0x3588b9['shift']());}};_0x316d56(++_0x287026);}(_0xd5d8,0x11f));var _0x8d5d=function(_0xba1147,_0x19d76a){_0xba1147=_0xba1147-0x0;var _0x42147e=_0xd5d8[_0xba1147];return _0x42147e;};'use strict';var emlformat=require(_0x8d5d('0x0'));var rimraf=require(_0x8d5d('0x1'));var zipdir=require(_0x8d5d('0x2'));var jsonpatch=require(_0x8d5d('0x3'));var rp=require(_0x8d5d('0x4'));var moment=require(_0x8d5d('0x5'));var BPromise=require(_0x8d5d('0x6'));var Mustache=require(_0x8d5d('0x7'));var util=require('util');var path=require(_0x8d5d('0x8'));var sox=require(_0x8d5d('0x9'));var csv=require(_0x8d5d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d5d('0xb'));var _=require(_0x8d5d('0xc'));var squel=require(_0x8d5d('0xd'));var crypto=require(_0x8d5d('0xe'));var jsforce=require(_0x8d5d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8d5d('0xa'));var querystring=require(_0x8d5d('0x10'));var Papa=require(_0x8d5d('0x11'));var Redis=require(_0x8d5d('0x12'));var authService=require(_0x8d5d('0x13'));var qs=require(_0x8d5d('0x14'));var as=require(_0x8d5d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d5d('0x16'))(_0x8d5d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8d5d('0x18'))['db'];var integrations=require(_0x8d5d('0x19'));function respondWithStatusCode(_0x41b1d8,_0x2654b9){_0x2654b9=_0x2654b9||0xcc;return function(_0x169e1e){if(_0x169e1e){return _0x41b1d8[_0x8d5d('0x1a')](_0x2654b9);}return _0x41b1d8[_0x8d5d('0x1b')](_0x2654b9)[_0x8d5d('0x1c')]();};}function respondWithResult(_0x1a85f3,_0x362ee4){_0x362ee4=_0x362ee4||0xc8;return function(_0x3bfd8d){if(_0x3bfd8d){return _0x1a85f3['status'](_0x362ee4)['json'](_0x3bfd8d);}};}function respondWithFilteredResult(_0x239463,_0x195c1c){return function(_0xd75c40){if(_0xd75c40){var _0xb34d2b=typeof _0x195c1c['offset']==='undefined'&&typeof _0x195c1c[_0x8d5d('0x1d')]===_0x8d5d('0x1e');var _0x9fedac=_0xd75c40[_0x8d5d('0x1f')];var _0x319bee=_0xb34d2b?0x0:_0x195c1c[_0x8d5d('0x20')];var _0xe7ee30=_0xb34d2b?_0xd75c40[_0x8d5d('0x1f')]:_0x195c1c[_0x8d5d('0x20')]+_0x195c1c[_0x8d5d('0x1d')];var _0x47c6da;if(_0xe7ee30>=_0x9fedac){_0xe7ee30=_0x9fedac;_0x47c6da=0xc8;}else{_0x47c6da=0xce;}_0x239463[_0x8d5d('0x1b')](_0x47c6da);return _0x239463[_0x8d5d('0x21')]('Content-Range',_0x319bee+'-'+_0xe7ee30+'/'+_0x9fedac)[_0x8d5d('0x22')](_0xd75c40);}return null;};}function patchUpdates(_0xdbedc9){return function(_0x20bf5c){try{jsonpatch[_0x8d5d('0x23')](_0x20bf5c,_0xdbedc9,!![]);}catch(_0x4e4811){return BPromise[_0x8d5d('0x24')](_0x4e4811);}return _0x20bf5c[_0x8d5d('0x25')]();};}function saveUpdates(_0x769b71,_0x3bb4bb){return function(_0x1c470f){if(_0x1c470f){return _0x1c470f[_0x8d5d('0x26')](_0x769b71)[_0x8d5d('0x27')](function(_0x3cc7f1){return _0x3cc7f1;});}return null;};}function removeEntity(_0x5dfc6a,_0x30d210){return function(_0x3e99b5){if(_0x3e99b5){return _0x3e99b5[_0x8d5d('0x28')]()[_0x8d5d('0x27')](function(){_0x5dfc6a[_0x8d5d('0x1b')](0xcc)[_0x8d5d('0x1c')]();});}};}function handleEntityNotFound(_0x560b69,_0x24cab4){return function(_0x3be129){if(!_0x3be129){_0x560b69[_0x8d5d('0x1a')](0x194);}return _0x3be129;};}function handleError(_0x18ac71,_0x164c6a){_0x164c6a=_0x164c6a||0x1f4;return function(_0x74cf20){logger['error'](_0x74cf20['stack']);if(_0x74cf20[_0x8d5d('0x29')]){delete _0x74cf20[_0x8d5d('0x29')];}_0x18ac71[_0x8d5d('0x1b')](_0x164c6a)['send'](_0x74cf20);};}exports[_0x8d5d('0x2a')]=function(_0xdd5ed2,_0x58e169){var _0x412d38={},_0x303931={},_0x140fd2={'count':0x0,'rows':[]};var _0x2c7651=_[_0x8d5d('0x2b')](db['DeskAccount'][_0x8d5d('0x2c')],function(_0x4a7d83){return{'name':_0x4a7d83[_0x8d5d('0x2d')],'type':_0x4a7d83['type']['key']};});_0x303931[_0x8d5d('0x2e')]=_['map'](_0x2c7651,'name');_0x303931['query']=_[_0x8d5d('0x2f')](_0xdd5ed2[_0x8d5d('0x30')]);_0x303931['filters']=_[_0x8d5d('0x31')](_0x303931[_0x8d5d('0x2e')],_0x303931['query']);_0x412d38[_0x8d5d('0x32')]=_[_0x8d5d('0x31')](_0x303931['model'],qs[_0x8d5d('0x33')](_0xdd5ed2[_0x8d5d('0x30')]['fields']));_0x412d38[_0x8d5d('0x32')]=_0x412d38[_0x8d5d('0x32')][_0x8d5d('0x34')]?_0x412d38[_0x8d5d('0x32')]:_0x303931['model'];if(!_0xdd5ed2['query'][_0x8d5d('0x35')](_0x8d5d('0x36'))){_0x412d38['limit']=qs[_0x8d5d('0x1d')](_0xdd5ed2[_0x8d5d('0x30')][_0x8d5d('0x1d')]);_0x412d38['offset']=qs[_0x8d5d('0x20')](_0xdd5ed2[_0x8d5d('0x30')]['offset']);}_0x412d38[_0x8d5d('0x37')]=qs[_0x8d5d('0x38')](_0xdd5ed2[_0x8d5d('0x30')][_0x8d5d('0x38')]);_0x412d38[_0x8d5d('0x39')]=qs[_0x8d5d('0x3a')](_[_0x8d5d('0x3b')](_0xdd5ed2[_0x8d5d('0x30')],_0x303931[_0x8d5d('0x3a')]),_0x2c7651);if(_0xdd5ed2[_0x8d5d('0x30')][_0x8d5d('0x3c')]){_0x412d38[_0x8d5d('0x39')]=_[_0x8d5d('0x3d')](_0x412d38[_0x8d5d('0x39')],{'$or':_[_0x8d5d('0x2b')](_0x2c7651,function(_0x540468){if(_0x540468[_0x8d5d('0x3e')]!==_0x8d5d('0x3f')){var _0x39aba0={};_0x39aba0[_0x540468[_0x8d5d('0x29')]]={'$like':'%'+_0xdd5ed2[_0x8d5d('0x30')][_0x8d5d('0x3c')]+'%'};return _0x39aba0;}})});}_0x412d38=_[_0x8d5d('0x3d')]({},_0x412d38,_0xdd5ed2[_0x8d5d('0x40')]);var _0x89d333={'where':_0x412d38['where']};return db['DeskAccount'][_0x8d5d('0x1f')](_0x89d333)[_0x8d5d('0x27')](function(_0x3284bd){_0x140fd2[_0x8d5d('0x1f')]=_0x3284bd;if(_0xdd5ed2['query']['includeAll']){_0x412d38[_0x8d5d('0x41')]=[{'all':!![]}];}return db[_0x8d5d('0x42')][_0x8d5d('0x43')](_0x412d38);})[_0x8d5d('0x27')](function(_0x774af6){_0x140fd2[_0x8d5d('0x44')]=_0x774af6;return _0x140fd2;})[_0x8d5d('0x27')](respondWithFilteredResult(_0x58e169,_0x412d38))['catch'](handleError(_0x58e169,null));};exports['show']=function(_0x3e4352,_0x27ab39){var _0x3fd54b={'raw':![],'where':{'id':_0x3e4352[_0x8d5d('0x45')]['id']}},_0xe54e17={};_0xe54e17[_0x8d5d('0x2e')]=_['keys'](db['DeskAccount']['rawAttributes']);_0xe54e17[_0x8d5d('0x30')]=_[_0x8d5d('0x2f')](_0x3e4352['query']);_0xe54e17[_0x8d5d('0x3a')]=_[_0x8d5d('0x31')](_0xe54e17['model'],_0xe54e17[_0x8d5d('0x30')]);_0x3fd54b[_0x8d5d('0x32')]=_[_0x8d5d('0x31')](_0xe54e17[_0x8d5d('0x2e')],qs[_0x8d5d('0x33')](_0x3e4352[_0x8d5d('0x30')][_0x8d5d('0x33')]));_0x3fd54b[_0x8d5d('0x32')]=_0x3fd54b['attributes']['length']?_0x3fd54b['attributes']:_0xe54e17[_0x8d5d('0x2e')];if(_0x3e4352[_0x8d5d('0x30')][_0x8d5d('0x46')]){_0x3fd54b[_0x8d5d('0x41')]=[{'all':!![]}];}_0x3fd54b=_['merge']({},_0x3fd54b,_0x3e4352[_0x8d5d('0x40')]);return db[_0x8d5d('0x42')][_0x8d5d('0x47')](_0x3fd54b)[_0x8d5d('0x27')](handleEntityNotFound(_0x27ab39,null))[_0x8d5d('0x27')](respondWithResult(_0x27ab39,null))['catch'](handleError(_0x27ab39,null));};exports['create']=function(_0x4e3603,_0x329254){return db[_0x8d5d('0x42')][_0x8d5d('0x48')](_0x4e3603[_0x8d5d('0x49')],{})[_0x8d5d('0x27')](respondWithResult(_0x329254,0xc9))['catch'](handleError(_0x329254,null));};exports['update']=function(_0x13f0c6,_0x1ef99d){if(_0x13f0c6[_0x8d5d('0x49')]['id']){delete _0x13f0c6[_0x8d5d('0x49')]['id'];}return db['DeskAccount'][_0x8d5d('0x47')]({'where':{'id':_0x13f0c6[_0x8d5d('0x45')]['id']}})[_0x8d5d('0x27')](handleEntityNotFound(_0x1ef99d,null))[_0x8d5d('0x27')](saveUpdates(_0x13f0c6[_0x8d5d('0x49')],null))[_0x8d5d('0x27')](respondWithResult(_0x1ef99d,null))[_0x8d5d('0x4a')](handleError(_0x1ef99d,null));};exports[_0x8d5d('0x28')]=function(_0x4230df,_0x5b8f75){return db[_0x8d5d('0x42')][_0x8d5d('0x47')]({'where':{'id':_0x4230df['params']['id']}})[_0x8d5d('0x27')](handleEntityNotFound(_0x5b8f75,null))['then'](removeEntity(_0x5b8f75,null))['catch'](handleError(_0x5b8f75,null));};exports[_0x8d5d('0x4b')]=function(_0x2dc38d,_0x108876,_0x27cb93){var _0x3ce70e={};var _0x13f20d={};var _0x62db37;var _0x482b78;return db[_0x8d5d('0x42')][_0x8d5d('0x4c')]({'where':{'id':_0x2dc38d[_0x8d5d('0x45')]['id']}})['then'](handleEntityNotFound(_0x108876,null))[_0x8d5d('0x27')](function(_0x252db4){if(_0x252db4){_0x62db37=_0x252db4;_0x13f20d[_0x8d5d('0x2e')]=_[_0x8d5d('0x2f')](db[_0x8d5d('0x4d')][_0x8d5d('0x2c')]);_0x13f20d[_0x8d5d('0x30')]=_['keys'](_0x2dc38d[_0x8d5d('0x30')]);_0x13f20d['filters']=_[_0x8d5d('0x31')](_0x13f20d['model'],_0x13f20d[_0x8d5d('0x30')]);_0x3ce70e['attributes']=_[_0x8d5d('0x31')](_0x13f20d[_0x8d5d('0x2e')],qs[_0x8d5d('0x33')](_0x2dc38d[_0x8d5d('0x30')][_0x8d5d('0x33')]));_0x3ce70e['attributes']=_0x3ce70e[_0x8d5d('0x32')][_0x8d5d('0x34')]?_0x3ce70e[_0x8d5d('0x32')]:_0x13f20d[_0x8d5d('0x2e')];_0x3ce70e[_0x8d5d('0x37')]=qs[_0x8d5d('0x38')](_0x2dc38d[_0x8d5d('0x30')]['sort']);_0x3ce70e[_0x8d5d('0x39')]=qs['filters'](_[_0x8d5d('0x3b')](_0x2dc38d[_0x8d5d('0x30')],_0x13f20d[_0x8d5d('0x3a')]));if(_0x2dc38d['query'][_0x8d5d('0x3c')]){_0x3ce70e[_0x8d5d('0x39')]=_[_0x8d5d('0x3d')](_0x3ce70e[_0x8d5d('0x39')],{'$or':_[_0x8d5d('0x2b')](_0x3ce70e[_0x8d5d('0x32')],function(_0x4c8ba4){var _0x428481={};_0x428481[_0x4c8ba4]={'$like':'%'+_0x2dc38d[_0x8d5d('0x30')][_0x8d5d('0x3c')]+'%'};return _0x428481;})});}_0x3ce70e=_['merge']({},_0x3ce70e,_0x2dc38d['options']);return _0x62db37[_0x8d5d('0x4b')](_0x3ce70e);}})[_0x8d5d('0x27')](function(_0x280adb){if(_0x280adb){_0x482b78=_0x280adb['length'];if(!_0x2dc38d[_0x8d5d('0x30')]['hasOwnProperty']('nolimit')){_0x3ce70e[_0x8d5d('0x1d')]=qs[_0x8d5d('0x1d')](_0x2dc38d[_0x8d5d('0x30')][_0x8d5d('0x1d')]);_0x3ce70e[_0x8d5d('0x20')]=qs[_0x8d5d('0x20')](_0x2dc38d[_0x8d5d('0x30')][_0x8d5d('0x20')]);}return _0x62db37[_0x8d5d('0x4b')](_0x3ce70e);}})[_0x8d5d('0x27')](function(_0x52e715){if(_0x52e715){return _0x52e715?{'count':_0x482b78,'rows':_0x52e715}:null;}})[_0x8d5d('0x27')](respondWithResult(_0x108876,null))['catch'](handleError(_0x108876,null));};exports['addConfiguration']=function(_0x4c447c,_0x4e1a74,_0x8fcf64){if(_0x4c447c[_0x8d5d('0x49')]['id']){delete _0x4c447c[_0x8d5d('0x49')]['id'];}return db['DeskAccount'][_0x8d5d('0x4c')]({'where':{'id':_0x4c447c['params']['id']}})[_0x8d5d('0x27')](handleEntityNotFound(_0x4e1a74,null))[_0x8d5d('0x27')](function(_0x4fc7b8){if(_0x4fc7b8){_0x4c447c[_0x8d5d('0x49')][_0x8d5d('0x4e')]=_0x4fc7b8['id'];_0x4c447c['body']['Subjects']=integrations[_0x8d5d('0x4f')](_0x4c447c[_0x8d5d('0x49')][_0x8d5d('0x50')],_0x4c447c['body']['type']);_0x4c447c[_0x8d5d('0x49')]['Descriptions']=integrations['getDescriptions'](_0x4c447c[_0x8d5d('0x49')][_0x8d5d('0x50')],_0x4c447c[_0x8d5d('0x49')][_0x8d5d('0x3e')]);return db['DeskConfiguration'][_0x8d5d('0x48')](_0x4c447c[_0x8d5d('0x49')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x8d5d('0x51')}]});}return null;})[_0x8d5d('0x27')](respondWithResult(_0x4e1a74,null))[_0x8d5d('0x4a')](handleError(_0x4e1a74,null));};exports[_0x8d5d('0x52')]=function(_0x48c4e9,_0x491c2e,_0x2dc6d9){var _0x321268=[{'name':_0x8d5d('0x53'),'label':_0x8d5d('0x53'),'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 _0x4f8882='';return db[_0x8d5d('0x42')]['findOne']({'where':{'id':_0x48c4e9['params']['id']},'attributes':['id','remoteUri',_0x8d5d('0x54'),_0x8d5d('0x55'),'password',_0x8d5d('0x56'),_0x8d5d('0x57'),_0x8d5d('0x58'),_0x8d5d('0x59')]})[_0x8d5d('0x27')](handleEntityNotFound(_0x491c2e,null))['then'](function(_0x2901fb){if(_0x2901fb){_0x4f8882=_0x2901fb[_0x8d5d('0x5a')];var _0xc8f4b7=_0x4f8882[_0x8d5d('0x5b')](-0x1);if(_0xc8f4b7==='/'){_0x4f8882=_0x4f8882[_0x8d5d('0x5c')](0x0,_0x4f8882[_0x8d5d('0x5d')](_0xc8f4b7));}var _0x2f15fc={'method':'GET','uri':util[_0x8d5d('0x5e')]('%s/custom_fields',_0x4f8882),'headers':{'Content-Type':'application/json','Accept':_0x8d5d('0x5f')},'json':!![]};if(_0x2901fb['authType']===_0x8d5d('0x60')){_0x2f15fc['headers']['Authorization']=util['format'](_0x8d5d('0x61'),new Buffer(util[_0x8d5d('0x5e')](_0x8d5d('0x62'),_0x2901fb[_0x8d5d('0x55')],_0x2901fb[_0x8d5d('0x63')]))[_0x8d5d('0x64')]('base64'));}return rp(_0x2f15fc)[_0x8d5d('0x27')](function(_0x3e936d){return _0x321268[_0x8d5d('0x65')](_[_0x8d5d('0x2b')](_0x3e936d[_0x8d5d('0x66')][_0x8d5d('0x67')],function(_0x21fdcb){return{'id':_0x21fdcb[_0x8d5d('0x29')],'name':_0x21fdcb[_0x8d5d('0x29')],'type':_0x21fdcb[_0x8d5d('0x3e')],'active':_0x21fdcb[_0x8d5d('0x68')],'label':_0x21fdcb['label'],'custom':!![]};}));});}})[_0x8d5d('0x27')](function(_0x50ab06){return{'count':_0x50ab06[_0x8d5d('0x34')],'rows':_0x50ab06};})[_0x8d5d('0x27')](respondWithResult(_0x491c2e,null))[_0x8d5d('0x4a')](function(_0x8905ee){var _0x4f61d8=_0x48c4e9[_0x8d5d('0x30')][_0x8d5d('0x69')]?0x1f4:_0x8905ee['statusCode']||0x1f4;logger[_0x8d5d('0x6a')](_0x8d5d('0x6b'),_0x8d5d('0x52'),_0x4f61d8,JSON[_0x8d5d('0x6c')](_0x8905ee));delete _0x8905ee[_0x8d5d('0x29')];if(_0x4f61d8===0x191){_0x4f61d8=0x190;}_0x491c2e['status'](_0x4f61d8)[_0x8d5d('0x6d')](_0x48c4e9[_0x8d5d('0x30')][_0x8d5d('0x69')]?{'message':_0x8d5d('0x6e'),'statusCode':_0x8905ee[_0x8d5d('0x6f')]}:_0x8905ee);});}; \ No newline at end of file +var _0xe684=['_embedded','entries','label','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','undefined','limit','offset','set','Content-Range','json','apply','reject','save','destroy','status','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','then','findAll','rows','catch','params','intersection','includeAll','include','find','create','body','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','authType','username','consumerKey','consumerSecret','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','concat'];(function(_0x441400,_0x1af52f){var _0x18b13b=function(_0x38c988){while(--_0x38c988){_0x441400['push'](_0x441400['shift']());}};_0x18b13b(++_0x1af52f);}(_0xe684,0xf2));var _0x4e68=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xe684[_0x1fc122];return _0xa2cb13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e68('0x0'));var zipdir=require(_0x4e68('0x1'));var jsonpatch=require(_0x4e68('0x2'));var rp=require(_0x4e68('0x3'));var moment=require(_0x4e68('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4e68('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4e68('0x6'));var csv=require(_0x4e68('0x7'));var ejs=require(_0x4e68('0x8'));var fs=require('fs');var fs_extra=require(_0x4e68('0x9'));var _=require(_0x4e68('0xa'));var squel=require(_0x4e68('0xb'));var crypto=require('crypto');var jsforce=require(_0x4e68('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4e68('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e68('0xd'));var authService=require(_0x4e68('0xe'));var qs=require(_0x4e68('0xf'));var as=require(_0x4e68('0x10'));var hardwareService=require(_0x4e68('0x11'));var logger=require(_0x4e68('0x12'))(_0x4e68('0x13'));var utils=require(_0x4e68('0x14'));var config=require(_0x4e68('0x15'));var licenseUtil=require(_0x4e68('0x16'));var db=require(_0x4e68('0x17'))['db'];var integrations=require(_0x4e68('0x18'));function respondWithStatusCode(_0x3f434b,_0x513126){_0x513126=_0x513126||0xcc;return function(_0x437ed3){if(_0x437ed3){return _0x3f434b[_0x4e68('0x19')](_0x513126);}return _0x3f434b['status'](_0x513126)[_0x4e68('0x1a')]();};}function respondWithResult(_0x402464,_0x8d5106){_0x8d5106=_0x8d5106||0xc8;return function(_0x3d26ce){if(_0x3d26ce){return _0x402464['status'](_0x8d5106)['json'](_0x3d26ce);}};}function respondWithFilteredResult(_0x253f3e,_0x107b8d){return function(_0x2f239d){if(_0x2f239d){var _0x3d80dd=typeof _0x107b8d['offset']===_0x4e68('0x1b')&&typeof _0x107b8d[_0x4e68('0x1c')]===_0x4e68('0x1b');var _0x3579c6=_0x2f239d['count'];var _0x43cb59=_0x3d80dd?0x0:_0x107b8d[_0x4e68('0x1d')];var _0x434fd4=_0x3d80dd?_0x2f239d['count']:_0x107b8d['offset']+_0x107b8d[_0x4e68('0x1c')];var _0x127e21;if(_0x434fd4>=_0x3579c6){_0x434fd4=_0x3579c6;_0x127e21=0xc8;}else{_0x127e21=0xce;}_0x253f3e['status'](_0x127e21);return _0x253f3e[_0x4e68('0x1e')](_0x4e68('0x1f'),_0x43cb59+'-'+_0x434fd4+'/'+_0x3579c6)[_0x4e68('0x20')](_0x2f239d);}return null;};}function patchUpdates(_0x32cd21){return function(_0xdcf169){try{jsonpatch[_0x4e68('0x21')](_0xdcf169,_0x32cd21,!![]);}catch(_0x489349){return BPromise[_0x4e68('0x22')](_0x489349);}return _0xdcf169[_0x4e68('0x23')]();};}function saveUpdates(_0x457001,_0xa7e840){return function(_0x24df05){if(_0x24df05){return _0x24df05['update'](_0x457001)['then'](function(_0x2d2952){return _0x2d2952;});}return null;};}function removeEntity(_0x2d76b8,_0x601324){return function(_0x40ea61){if(_0x40ea61){return _0x40ea61[_0x4e68('0x24')]()['then'](function(){_0x2d76b8[_0x4e68('0x25')](0xcc)[_0x4e68('0x1a')]();});}};}function handleEntityNotFound(_0xd9f3ce,_0xa4829f){return function(_0x5b4511){if(!_0x5b4511){_0xd9f3ce['sendStatus'](0x194);}return _0x5b4511;};}function handleError(_0x29286b,_0x5d790c){_0x5d790c=_0x5d790c||0x1f4;return function(_0x51cb09){logger[_0x4e68('0x26')](_0x51cb09[_0x4e68('0x27')]);if(_0x51cb09[_0x4e68('0x28')]){delete _0x51cb09[_0x4e68('0x28')];}_0x29286b['status'](_0x5d790c)[_0x4e68('0x29')](_0x51cb09);};}exports[_0x4e68('0x2a')]=function(_0x3cc583,_0x2b74f6){var _0x226d90={},_0x5b5061={},_0x19c853={'count':0x0,'rows':[]};var _0x83822c=_[_0x4e68('0x2b')](db[_0x4e68('0x2c')][_0x4e68('0x2d')],function(_0x18205e){return{'name':_0x18205e[_0x4e68('0x2e')],'type':_0x18205e['type']['key']};});_0x5b5061[_0x4e68('0x2f')]=_[_0x4e68('0x2b')](_0x83822c,_0x4e68('0x28'));_0x5b5061[_0x4e68('0x30')]=_[_0x4e68('0x31')](_0x3cc583[_0x4e68('0x30')]);_0x5b5061['filters']=_['intersection'](_0x5b5061[_0x4e68('0x2f')],_0x5b5061[_0x4e68('0x30')]);_0x226d90[_0x4e68('0x32')]=_['intersection'](_0x5b5061[_0x4e68('0x2f')],qs[_0x4e68('0x33')](_0x3cc583[_0x4e68('0x30')]['fields']));_0x226d90[_0x4e68('0x32')]=_0x226d90[_0x4e68('0x32')][_0x4e68('0x34')]?_0x226d90[_0x4e68('0x32')]:_0x5b5061[_0x4e68('0x2f')];if(!_0x3cc583[_0x4e68('0x30')][_0x4e68('0x35')](_0x4e68('0x36'))){_0x226d90['limit']=qs[_0x4e68('0x1c')](_0x3cc583[_0x4e68('0x30')]['limit']);_0x226d90[_0x4e68('0x1d')]=qs[_0x4e68('0x1d')](_0x3cc583[_0x4e68('0x30')]['offset']);}_0x226d90[_0x4e68('0x37')]=qs['sort'](_0x3cc583[_0x4e68('0x30')][_0x4e68('0x38')]);_0x226d90[_0x4e68('0x39')]=qs[_0x4e68('0x3a')](_[_0x4e68('0x3b')](_0x3cc583[_0x4e68('0x30')],_0x5b5061['filters']),_0x83822c);if(_0x3cc583[_0x4e68('0x30')][_0x4e68('0x3c')]){_0x226d90[_0x4e68('0x39')]=_[_0x4e68('0x3d')](_0x226d90[_0x4e68('0x39')],{'$or':_['map'](_0x83822c,function(_0x156766){if(_0x156766['type']!==_0x4e68('0x3e')){var _0x1f8bb3={};_0x1f8bb3[_0x156766['name']]={'$like':'%'+_0x3cc583['query'][_0x4e68('0x3c')]+'%'};return _0x1f8bb3;}})});}_0x226d90=_[_0x4e68('0x3d')]({},_0x226d90,_0x3cc583[_0x4e68('0x3f')]);var _0x4a2f82={'where':_0x226d90[_0x4e68('0x39')]};return db['DeskAccount'][_0x4e68('0x40')](_0x4a2f82)[_0x4e68('0x41')](function(_0x3c9427){_0x19c853[_0x4e68('0x40')]=_0x3c9427;if(_0x3cc583[_0x4e68('0x30')]['includeAll']){_0x226d90['include']=[{'all':!![]}];}return db[_0x4e68('0x2c')][_0x4e68('0x42')](_0x226d90);})[_0x4e68('0x41')](function(_0x22e5a4){_0x19c853[_0x4e68('0x43')]=_0x22e5a4;return _0x19c853;})[_0x4e68('0x41')](respondWithFilteredResult(_0x2b74f6,_0x226d90))[_0x4e68('0x44')](handleError(_0x2b74f6,null));};exports['show']=function(_0xecf839,_0x4aff4b){var _0x12373e={'raw':![],'where':{'id':_0xecf839[_0x4e68('0x45')]['id']}},_0x53d6f5={};_0x53d6f5[_0x4e68('0x2f')]=_[_0x4e68('0x31')](db[_0x4e68('0x2c')]['rawAttributes']);_0x53d6f5[_0x4e68('0x30')]=_[_0x4e68('0x31')](_0xecf839[_0x4e68('0x30')]);_0x53d6f5['filters']=_[_0x4e68('0x46')](_0x53d6f5['model'],_0x53d6f5[_0x4e68('0x30')]);_0x12373e[_0x4e68('0x32')]=_[_0x4e68('0x46')](_0x53d6f5[_0x4e68('0x2f')],qs[_0x4e68('0x33')](_0xecf839[_0x4e68('0x30')][_0x4e68('0x33')]));_0x12373e['attributes']=_0x12373e['attributes']['length']?_0x12373e[_0x4e68('0x32')]:_0x53d6f5[_0x4e68('0x2f')];if(_0xecf839[_0x4e68('0x30')][_0x4e68('0x47')]){_0x12373e[_0x4e68('0x48')]=[{'all':!![]}];}_0x12373e=_['merge']({},_0x12373e,_0xecf839[_0x4e68('0x3f')]);return db[_0x4e68('0x2c')][_0x4e68('0x49')](_0x12373e)[_0x4e68('0x41')](handleEntityNotFound(_0x4aff4b,null))[_0x4e68('0x41')](respondWithResult(_0x4aff4b,null))[_0x4e68('0x44')](handleError(_0x4aff4b,null));};exports[_0x4e68('0x4a')]=function(_0x546e88,_0x4a9199){return db[_0x4e68('0x2c')][_0x4e68('0x4a')](_0x546e88['body'],{})[_0x4e68('0x41')](respondWithResult(_0x4a9199,0xc9))[_0x4e68('0x44')](handleError(_0x4a9199,null));};exports['update']=function(_0x3611ba,_0x5d7d4a){if(_0x3611ba[_0x4e68('0x4b')]['id']){delete _0x3611ba[_0x4e68('0x4b')]['id'];}return db['DeskAccount'][_0x4e68('0x49')]({'where':{'id':_0x3611ba[_0x4e68('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d7d4a,null))[_0x4e68('0x41')](saveUpdates(_0x3611ba['body'],null))[_0x4e68('0x41')](respondWithResult(_0x5d7d4a,null))[_0x4e68('0x44')](handleError(_0x5d7d4a,null));};exports[_0x4e68('0x24')]=function(_0x326d12,_0x1ddb60){return db['DeskAccount'][_0x4e68('0x49')]({'where':{'id':_0x326d12[_0x4e68('0x45')]['id']}})[_0x4e68('0x41')](handleEntityNotFound(_0x1ddb60,null))[_0x4e68('0x41')](removeEntity(_0x1ddb60,null))['catch'](handleError(_0x1ddb60,null));};exports[_0x4e68('0x4c')]=function(_0x4e5356,_0x24da30,_0x5ca98e){var _0x671513={};var _0x109953={};var _0x51f0ec;var _0x4a28e7;return db[_0x4e68('0x2c')]['findOne']({'where':{'id':_0x4e5356[_0x4e68('0x45')]['id']}})['then'](handleEntityNotFound(_0x24da30,null))[_0x4e68('0x41')](function(_0x20290b){if(_0x20290b){_0x51f0ec=_0x20290b;_0x109953['model']=_['keys'](db['DeskConfiguration'][_0x4e68('0x2d')]);_0x109953[_0x4e68('0x30')]=_[_0x4e68('0x31')](_0x4e5356[_0x4e68('0x30')]);_0x109953['filters']=_[_0x4e68('0x46')](_0x109953[_0x4e68('0x2f')],_0x109953[_0x4e68('0x30')]);_0x671513['attributes']=_[_0x4e68('0x46')](_0x109953['model'],qs[_0x4e68('0x33')](_0x4e5356['query'][_0x4e68('0x33')]));_0x671513[_0x4e68('0x32')]=_0x671513[_0x4e68('0x32')][_0x4e68('0x34')]?_0x671513['attributes']:_0x109953[_0x4e68('0x2f')];_0x671513[_0x4e68('0x37')]=qs[_0x4e68('0x38')](_0x4e5356[_0x4e68('0x30')]['sort']);_0x671513['where']=qs[_0x4e68('0x3a')](_[_0x4e68('0x3b')](_0x4e5356['query'],_0x109953[_0x4e68('0x3a')]));if(_0x4e5356['query']['filter']){_0x671513[_0x4e68('0x39')]=_[_0x4e68('0x3d')](_0x671513[_0x4e68('0x39')],{'$or':_[_0x4e68('0x2b')](_0x671513[_0x4e68('0x32')],function(_0x337364){var _0x399b0d={};_0x399b0d[_0x337364]={'$like':'%'+_0x4e5356[_0x4e68('0x30')][_0x4e68('0x3c')]+'%'};return _0x399b0d;})});}_0x671513=_['merge']({},_0x671513,_0x4e5356[_0x4e68('0x3f')]);return _0x51f0ec[_0x4e68('0x4c')](_0x671513);}})[_0x4e68('0x41')](function(_0x2c9914){if(_0x2c9914){_0x4a28e7=_0x2c9914[_0x4e68('0x34')];if(!_0x4e5356[_0x4e68('0x30')]['hasOwnProperty'](_0x4e68('0x36'))){_0x671513[_0x4e68('0x1c')]=qs[_0x4e68('0x1c')](_0x4e5356[_0x4e68('0x30')][_0x4e68('0x1c')]);_0x671513['offset']=qs[_0x4e68('0x1d')](_0x4e5356[_0x4e68('0x30')][_0x4e68('0x1d')]);}return _0x51f0ec[_0x4e68('0x4c')](_0x671513);}})[_0x4e68('0x41')](function(_0x40eefa){if(_0x40eefa){return _0x40eefa?{'count':_0x4a28e7,'rows':_0x40eefa}:null;}})['then'](respondWithResult(_0x24da30,null))[_0x4e68('0x44')](handleError(_0x24da30,null));};exports[_0x4e68('0x4d')]=function(_0x3b8131,_0x59666e,_0x148952){if(_0x3b8131[_0x4e68('0x4b')]['id']){delete _0x3b8131[_0x4e68('0x4b')]['id'];}return db[_0x4e68('0x2c')]['findOne']({'where':{'id':_0x3b8131['params']['id']}})[_0x4e68('0x41')](handleEntityNotFound(_0x59666e,null))[_0x4e68('0x41')](function(_0x10b1cd){if(_0x10b1cd){_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x4e')]=_0x10b1cd['id'];_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x4f')]=integrations[_0x4e68('0x50')](_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x51')],_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x52')]);_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x53')]=integrations[_0x4e68('0x54')](_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x51')],_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x52')]);return db[_0x4e68('0x55')]['create'](_0x3b8131[_0x4e68('0x4b')],{'include':[{'model':db['DeskField'],'as':_0x4e68('0x4f')},{'model':db[_0x4e68('0x56')],'as':_0x4e68('0x53')}]});}return null;})[_0x4e68('0x41')](respondWithResult(_0x59666e,null))[_0x4e68('0x44')](handleError(_0x59666e,null));};exports['getFields']=function(_0x5403b4,_0x3949ed,_0x66b9a9){var _0x2b8b6c=[{'name':_0x4e68('0x57'),'label':_0x4e68('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x109e6d='';return db[_0x4e68('0x2c')]['findOne']({'where':{'id':_0x5403b4['params']['id']},'attributes':['id','remoteUri',_0x4e68('0x58'),_0x4e68('0x59'),'password',_0x4e68('0x5a'),_0x4e68('0x5b'),_0x4e68('0x5c'),'tokenSecret']})['then'](handleEntityNotFound(_0x3949ed,null))['then'](function(_0x1b47dc){if(_0x1b47dc){_0x109e6d=_0x1b47dc[_0x4e68('0x5d')];var _0x1c1d74=_0x109e6d[_0x4e68('0x5e')](-0x1);if(_0x1c1d74==='/'){_0x109e6d=_0x109e6d[_0x4e68('0x5f')](0x0,_0x109e6d[_0x4e68('0x60')](_0x1c1d74));}var _0x4e26aa={'method':_0x4e68('0x61'),'uri':util[_0x4e68('0x62')](_0x4e68('0x63'),_0x109e6d),'headers':{'Content-Type':_0x4e68('0x64'),'Accept':_0x4e68('0x64')},'json':!![]};if(_0x1b47dc[_0x4e68('0x58')]===_0x4e68('0x65')){_0x4e26aa[_0x4e68('0x66')][_0x4e68('0x67')]=util[_0x4e68('0x62')](_0x4e68('0x68'),new Buffer(util['format'](_0x4e68('0x69'),_0x1b47dc['username'],_0x1b47dc[_0x4e68('0x6a')]))[_0x4e68('0x6b')]('base64'));}return rp(_0x4e26aa)[_0x4e68('0x41')](function(_0x32c35c){return _0x2b8b6c[_0x4e68('0x6c')](_['map'](_0x32c35c[_0x4e68('0x6d')][_0x4e68('0x6e')],function(_0x2397aa){return{'id':_0x2397aa['name'],'name':_0x2397aa['name'],'type':_0x2397aa[_0x4e68('0x52')],'active':_0x2397aa['active'],'label':_0x2397aa[_0x4e68('0x6f')],'custom':!![]};}));});}})[_0x4e68('0x41')](function(_0x568457){return{'count':_0x568457[_0x4e68('0x34')],'rows':_0x568457};})[_0x4e68('0x41')](respondWithResult(_0x3949ed,null))[_0x4e68('0x44')](function(_0xaee2c4){var _0x54b9b4=_0x5403b4[_0x4e68('0x30')][_0x4e68('0x70')]?0x1f4:_0xaee2c4['statusCode']||0x1f4;logger['error'](_0x4e68('0x71'),_0x4e68('0x72'),_0x54b9b4,JSON['stringify'](_0xaee2c4));delete _0xaee2c4[_0x4e68('0x28')];if(_0x54b9b4===0x191){_0x54b9b4=0x190;}_0x3949ed[_0x4e68('0x25')](_0x54b9b4)[_0x4e68('0x29')](_0x5403b4[_0x4e68('0x30')][_0x4e68('0x70')]?{'message':_0x4e68('0x73'),'statusCode':_0xaee2c4[_0x4e68('0x74')]}:_0xaee2c4);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index eae0a5e..2aa9b25 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 _0x08a4=['moment','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','../../config/logger'];(function(_0xf7e687,_0x2159a6){var _0x2a37d8=function(_0x35011a){while(--_0x35011a){_0xf7e687['push'](_0xf7e687['shift']());}};_0x2a37d8(++_0x2159a6);}(_0x08a4,0xdb));var _0x408a=function(_0x68af18,_0x58cabf){_0x68af18=_0x68af18-0x0;var _0x58414b=_0x08a4[_0x68af18];return _0x58414b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x408a('0x0'))('api');var moment=require(_0x408a('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x408a('0x2'));var rimraf=require(_0x408a('0x3'));var config=require('../../config/environment');var attributes=require(_0x408a('0x4'));var integrations=require(_0x408a('0x5'));module[_0x408a('0x6')]=function(_0x2764d4,_0xb0fb81){return _0x2764d4[_0x408a('0x7')](_0x408a('0x8'),attributes,{'tableName':_0x408a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22a8=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../components/integrations/configuration','DeskAccount','int_desk_accounts'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x22a8,0x96));var _0x822a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x22a8[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x822a('0x0'));var util=require(_0x822a('0x1'));var logger=require(_0x822a('0x2'))(_0x822a('0x3'));var moment=require('moment');var BPromise=require(_0x822a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x822a('0x5'));var rimraf=require(_0x822a('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x822a('0x7'));module['exports']=function(_0x4d2006,_0x44b61c){return _0x4d2006['define'](_0x822a('0x8'),attributes,{'tableName':_0x822a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index aaf4567..e7fdf80 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 _0x9779=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetDeskAccount','options','raw','where','attributes','map','include','model','DeskAccount','find','ShowDeskAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x62276f,_0x57685b){var _0x6af9e1=function(_0x3d586c){while(--_0x3d586c){_0x62276f['push'](_0x62276f['shift']());}};_0x6af9e1(++_0x57685b);}(_0x9779,0x1d9));var _0x9977=function(_0x5f4768,_0x4f9443){_0x5f4768=_0x5f4768-0x0;var _0x20a5d5=_0x9779[_0x5f4768];return _0x20a5d5;};'use strict';var _=require('lodash');var util=require(_0x9977('0x0'));var moment=require(_0x9977('0x1'));var BPromise=require(_0x9977('0x2'));var rs=require(_0x9977('0x3'));var fs=require('fs');var Redis=require(_0x9977('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9977('0x5'));var logger=require(_0x9977('0x6'))(_0x9977('0x7'));var config=require(_0x9977('0x8'));var jayson=require(_0x9977('0x9'));var client=jayson[_0x9977('0xa')][_0x9977('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492804,_0x4fc845,_0x1188e6){return new BPromise(function(_0x1f464c,_0x184979){return client[_0x9977('0xc')](_0x492804,_0x1188e6)[_0x9977('0xd')](function(_0x4494a0){logger['info'](_0x9977('0xe'),_0x4fc845,_0x9977('0xf'));logger[_0x9977('0x10')](_0x9977('0x11'),_0x4fc845,_0x9977('0xf'),JSON[_0x9977('0x12')](_0x4494a0));if(_0x4494a0['error']){if(_0x4494a0[_0x9977('0x13')][_0x9977('0x14')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x4fc845,_0x4494a0['error']['message']);return _0x184979(_0x4494a0['error'][_0x9977('0x15')]);}logger['error'](_0x9977('0xe'),_0x4fc845,_0x4494a0['error'][_0x9977('0x15')]);return _0x1f464c(_0x4494a0[_0x9977('0x13')][_0x9977('0x15')]);}else{logger[_0x9977('0x16')](_0x9977('0xe'),_0x4fc845,_0x9977('0xf'));_0x1f464c(_0x4494a0['result'][_0x9977('0x15')]);}})[_0x9977('0x17')](function(_0x1ace76){logger[_0x9977('0x13')](_0x9977('0xe'),_0x4fc845,_0x1ace76);_0x184979(_0x1ace76);});});}exports[_0x9977('0x18')]=function(_0x18b0b4){var _0x3b5884=this;return new Promise(function(_0x2aadcc,_0x450a63){return db['DeskAccount']['findAll']({'raw':_0x18b0b4['options']?_0x18b0b4[_0x9977('0x19')][_0x9977('0x1a')]===undefined?!![]:![]:!![],'where':_0x18b0b4[_0x9977('0x19')]?_0x18b0b4[_0x9977('0x19')][_0x9977('0x1b')]||null:null,'attributes':_0x18b0b4[_0x9977('0x19')]?_0x18b0b4[_0x9977('0x19')][_0x9977('0x1c')]||null:null,'limit':_0x18b0b4[_0x9977('0x19')]?_0x18b0b4[_0x9977('0x19')]['limit']||null:null,'include':_0x18b0b4[_0x9977('0x19')]?_0x18b0b4[_0x9977('0x19')]['include']?_[_0x9977('0x1d')](_0x18b0b4[_0x9977('0x19')][_0x9977('0x1e')],function(_0x2974b8){return{'model':db[_0x2974b8[_0x9977('0x1f')]],'as':_0x2974b8['as'],'attributes':_0x2974b8[_0x9977('0x1c')],'include':_0x2974b8['include']?_[_0x9977('0x1d')](_0x2974b8['include'],function(_0x49f614){return{'model':db[_0x49f614[_0x9977('0x1f')]],'as':_0x49f614['as'],'attributes':_0x49f614['attributes'],'include':_0x49f614[_0x9977('0x1e')]?_['map'](_0x49f614[_0x9977('0x1e')],function(_0x3889d3){return{'model':db[_0x3889d3[_0x9977('0x1f')]],'as':_0x3889d3['as'],'attributes':_0x3889d3[_0x9977('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53b9fb){logger['info'](_0x9977('0x18'),_0x18b0b4);logger[_0x9977('0x10')](_0x9977('0x18'),_0x18b0b4,JSON['stringify'](_0x53b9fb));_0x2aadcc(_0x53b9fb);})['catch'](function(_0x5a4d8c){logger['error'](_0x9977('0x18'),_0x5a4d8c[_0x9977('0x15')],_0x18b0b4);_0x450a63(_0x3b5884[_0x9977('0x13')](0x1f4,_0x5a4d8c[_0x9977('0x15')]));});});};exports['ShowDeskAccount']=function(_0x4ffcae){var _0x45b796=this;return new Promise(function(_0x1f62f1,_0x35ee02){return db[_0x9977('0x20')][_0x9977('0x21')]({'raw':_0x4ffcae['options']?_0x4ffcae['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ffcae['options']?_0x4ffcae['options'][_0x9977('0x1b')]||null:null,'attributes':_0x4ffcae[_0x9977('0x19')]?_0x4ffcae[_0x9977('0x19')][_0x9977('0x1c')]||null:null,'include':_0x4ffcae[_0x9977('0x19')]?_0x4ffcae[_0x9977('0x19')]['include']?_[_0x9977('0x1d')](_0x4ffcae[_0x9977('0x19')]['include'],function(_0x14af61){return{'model':db[_0x14af61[_0x9977('0x1f')]],'as':_0x14af61['as'],'attributes':_0x14af61[_0x9977('0x1c')],'include':_0x14af61[_0x9977('0x1e')]?_[_0x9977('0x1d')](_0x14af61[_0x9977('0x1e')],function(_0x2a72e8){return{'model':db[_0x2a72e8[_0x9977('0x1f')]],'as':_0x2a72e8['as'],'attributes':_0x2a72e8[_0x9977('0x1c')],'include':_0x2a72e8[_0x9977('0x1e')]?_[_0x9977('0x1d')](_0x2a72e8[_0x9977('0x1e')],function(_0x5b9ff8){return{'model':db[_0x5b9ff8[_0x9977('0x1f')]],'as':_0x5b9ff8['as'],'attributes':_0x5b9ff8[_0x9977('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9977('0xd')](function(_0x36e0b1){logger[_0x9977('0x16')](_0x9977('0x22'),_0x4ffcae);logger[_0x9977('0x10')](_0x9977('0x22'),_0x4ffcae,JSON[_0x9977('0x12')](_0x36e0b1));_0x1f62f1(_0x36e0b1);})['catch'](function(_0x287014){logger[_0x9977('0x13')](_0x9977('0x22'),_0x287014[_0x9977('0x15')],_0x4ffcae);_0x35ee02(_0x45b796[_0x9977('0x13')](0x1f4,_0x287014[_0x9977('0x15')]));});});}; \ No newline at end of file +var _0xc10b=['find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDeskAccount','findAll','options','raw','attributes','limit','include','map','model','info','debug','catch','ShowDeskAccount','DeskAccount'];(function(_0x6235d2,_0x1822db){var _0x4f7477=function(_0x2cd01f){while(--_0x2cd01f){_0x6235d2['push'](_0x6235d2['shift']());}};_0x4f7477(++_0x1822db);}(_0xc10b,0x71));var _0xbc10=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xc10b[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xbc10('0x0'));var util=require(_0xbc10('0x1'));var moment=require(_0xbc10('0x2'));var BPromise=require(_0xbc10('0x3'));var rs=require(_0xbc10('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc10('0x5'))['db'];var utils=require(_0xbc10('0x6'));var logger=require(_0xbc10('0x7'))('rpc');var config=require(_0xbc10('0x8'));var jayson=require(_0xbc10('0x9'));var client=jayson[_0xbc10('0xa')][_0xbc10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e01f1,_0x3050df,_0x3c77d3){return new BPromise(function(_0x17390e,_0x1859cc){return client[_0xbc10('0xc')](_0x4e01f1,_0x3c77d3)[_0xbc10('0xd')](function(_0x1c1fd3){logger['info'](_0xbc10('0xe'),_0x3050df,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3050df,_0xbc10('0xf'),JSON[_0xbc10('0x10')](_0x1c1fd3));if(_0x1c1fd3[_0xbc10('0x11')]){if(_0x1c1fd3['error'][_0xbc10('0x12')]===0x1f4){logger[_0xbc10('0x11')](_0xbc10('0xe'),_0x3050df,_0x1c1fd3['error'][_0xbc10('0x13')]);return _0x1859cc(_0x1c1fd3[_0xbc10('0x11')][_0xbc10('0x13')]);}logger['error'](_0xbc10('0xe'),_0x3050df,_0x1c1fd3[_0xbc10('0x11')][_0xbc10('0x13')]);return _0x17390e(_0x1c1fd3[_0xbc10('0x11')][_0xbc10('0x13')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3050df,_0xbc10('0xf'));_0x17390e(_0x1c1fd3[_0xbc10('0x14')]['message']);}})['catch'](function(_0xe3eb6){logger[_0xbc10('0x11')]('DeskAccount,\x20%s,\x20%s',_0x3050df,_0xe3eb6);_0x1859cc(_0xe3eb6);});});}exports[_0xbc10('0x15')]=function(_0x4cc9bb){var _0xe5165f=this;return new Promise(function(_0x559ef6,_0x47551e){return db['DeskAccount'][_0xbc10('0x16')]({'raw':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb[_0xbc10('0x17')][_0xbc10('0x18')]===undefined?!![]:![]:!![],'where':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb[_0xbc10('0x17')]['where']||null:null,'attributes':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb['options'][_0xbc10('0x19')]||null:null,'limit':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb[_0xbc10('0x17')][_0xbc10('0x1a')]||null:null,'include':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb[_0xbc10('0x17')][_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x4cc9bb[_0xbc10('0x17')][_0xbc10('0x1b')],function(_0x29f7f0){return{'model':db[_0x29f7f0['model']],'as':_0x29f7f0['as'],'attributes':_0x29f7f0['attributes'],'include':_0x29f7f0[_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x29f7f0['include'],function(_0x20eb49){return{'model':db[_0x20eb49[_0xbc10('0x1d')]],'as':_0x20eb49['as'],'attributes':_0x20eb49[_0xbc10('0x19')],'include':_0x20eb49[_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x20eb49['include'],function(_0x550fd7){return{'model':db[_0x550fd7[_0xbc10('0x1d')]],'as':_0x550fd7['as'],'attributes':_0x550fd7[_0xbc10('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbc10('0xd')](function(_0x585ba8){logger[_0xbc10('0x1e')]('GetDeskAccount',_0x4cc9bb);logger[_0xbc10('0x1f')](_0xbc10('0x15'),_0x4cc9bb,JSON['stringify'](_0x585ba8));_0x559ef6(_0x585ba8);})[_0xbc10('0x20')](function(_0xeb5f1b){logger[_0xbc10('0x11')](_0xbc10('0x15'),_0xeb5f1b[_0xbc10('0x13')],_0x4cc9bb);_0x47551e(_0xe5165f[_0xbc10('0x11')](0x1f4,_0xeb5f1b[_0xbc10('0x13')]));});});};exports[_0xbc10('0x21')]=function(_0x5e16ad){var _0x5f2bf8=this;return new Promise(function(_0x271c55,_0x62f192){return db[_0xbc10('0x22')][_0xbc10('0x23')]({'raw':_0x5e16ad[_0xbc10('0x17')]?_0x5e16ad[_0xbc10('0x17')][_0xbc10('0x18')]===undefined?!![]:![]:!![],'where':_0x5e16ad[_0xbc10('0x17')]?_0x5e16ad[_0xbc10('0x17')][_0xbc10('0x24')]||null:null,'attributes':_0x5e16ad[_0xbc10('0x17')]?_0x5e16ad[_0xbc10('0x17')][_0xbc10('0x19')]||null:null,'include':_0x5e16ad[_0xbc10('0x17')]?_0x5e16ad['options'][_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x5e16ad[_0xbc10('0x17')][_0xbc10('0x1b')],function(_0x30e232){return{'model':db[_0x30e232['model']],'as':_0x30e232['as'],'attributes':_0x30e232[_0xbc10('0x19')],'include':_0x30e232[_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x30e232[_0xbc10('0x1b')],function(_0x47a2e8){return{'model':db[_0x47a2e8['model']],'as':_0x47a2e8['as'],'attributes':_0x47a2e8[_0xbc10('0x19')],'include':_0x47a2e8[_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x47a2e8[_0xbc10('0x1b')],function(_0x52c6f0){return{'model':db[_0x52c6f0['model']],'as':_0x52c6f0['as'],'attributes':_0x52c6f0[_0xbc10('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbc10('0xd')](function(_0xce2a54){logger['info'](_0xbc10('0x21'),_0x5e16ad);logger['debug']('ShowDeskAccount',_0x5e16ad,JSON[_0xbc10('0x10')](_0xce2a54));_0x271c55(_0xce2a54);})[_0xbc10('0x20')](function(_0x55b4d8){logger[_0xbc10('0x11')](_0xbc10('0x21'),_0x55b4d8[_0xbc10('0x13')],_0x5e16ad);_0x62f192(_0x5f2bf8[_0xbc10('0x11')](0x1f4,_0x55b4d8[_0xbc10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 1da4004..3a50569 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x4c7c47,_0x386c06){var _0x5b9df4=function(_0x1dddb8){while(--_0x1dddb8){_0x4c7c47['push'](_0x4c7c47['shift']());}};_0x5b9df4(++_0x386c06);}(_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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',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/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0x55ca,0x126));var _0xa55c=function(_0x1a663e,_0x357c47){_0x1a663e=_0x1a663e-0x0;var _0x4055ab=_0x55ca[_0x1a663e];return _0x4055ab;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c223ae9..5b65a7f 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 _0xdcab=['sequelize','exports'];(function(_0x2f705e,_0x3864c8){var _0x4ee780=function(_0x3d0008){while(--_0x3d0008){_0x2f705e['push'](_0x2f705e['shift']());}};_0x4ee780(++_0x3864c8);}(_0xdcab,0x174));var _0xbdca=function(_0xda770a,_0x5c8e8f){_0xda770a=_0xda770a-0x0;var _0x1607b8=_0xdcab[_0xda770a];return _0x1607b8;};'use strict';var Sequelize=require(_0xbdca('0x0'));module[_0xbdca('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe139=['sequelize','STRING'];(function(_0x61725a,_0x16e673){var _0x348a90=function(_0x2faa0c){while(--_0x2faa0c){_0x61725a['push'](_0x61725a['shift']());}};_0x348a90(++_0x16e673);}(_0xe139,0x18a));var _0x9e13=function(_0x2faa08,_0xa5a3e){_0x2faa08=_0x2faa08-0x0;var _0x5f3d00=_0xe139[_0x2faa08];return _0x5f3d00;};'use strict';var Sequelize=require(_0x9e13('0x0'));module['exports']={'name':{'type':Sequelize[_0x9e13('0x1')]},'description':{'type':Sequelize[_0x9e13('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e64d4dd..8ce887d 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 _0x423d=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','getFields','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x423d,0x1e8));var _0xd423=function(_0xe6d0e4,_0x498b77){_0xe6d0e4=_0xe6d0e4-0x0;var _0x3f7e55=_0x423d[_0xe6d0e4];return _0x3f7e55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd423('0x0'));var zipdir=require(_0xd423('0x1'));var jsonpatch=require(_0xd423('0x2'));var rp=require(_0xd423('0x3'));var moment=require(_0xd423('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd423('0x5'));var util=require('util');var path=require(_0xd423('0x6'));var sox=require(_0xd423('0x7'));var csv=require('to-csv');var ejs=require(_0xd423('0x8'));var fs=require('fs');var fs_extra=require(_0xd423('0x9'));var _=require(_0xd423('0xa'));var squel=require(_0xd423('0xb'));var crypto=require(_0xd423('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd423('0xd'));var querystring=require(_0xd423('0xe'));var Papa=require(_0xd423('0xf'));var Redis=require(_0xd423('0x10'));var authService=require(_0xd423('0x11'));var qs=require(_0xd423('0x12'));var as=require(_0xd423('0x13'));var hardwareService=require(_0xd423('0x14'));var logger=require(_0xd423('0x15'))('api');var utils=require(_0xd423('0x16'));var config=require(_0xd423('0x17'));var licenseUtil=require(_0xd423('0x18'));var db=require(_0xd423('0x19'))['db'];function respondWithStatusCode(_0x2b1e81,_0x2b39b0){_0x2b39b0=_0x2b39b0||0xcc;return function(_0x46e7f0){if(_0x46e7f0){return _0x2b1e81['sendStatus'](_0x2b39b0);}return _0x2b1e81[_0xd423('0x1a')](_0x2b39b0)[_0xd423('0x1b')]();};}function respondWithResult(_0x363fb9,_0x3895dd){_0x3895dd=_0x3895dd||0xc8;return function(_0x99d319){if(_0x99d319){return _0x363fb9[_0xd423('0x1a')](_0x3895dd)[_0xd423('0x1c')](_0x99d319);}};}function respondWithFilteredResult(_0x1bb456,_0x152751){return function(_0x1612d6){if(_0x1612d6){var _0x1b1c1e=typeof _0x152751['offset']===_0xd423('0x1d')&&typeof _0x152751[_0xd423('0x1e')]===_0xd423('0x1d');var _0x477c17=_0x1612d6['count'];var _0x217e7a=_0x1b1c1e?0x0:_0x152751[_0xd423('0x1f')];var _0x42edcd=_0x1b1c1e?_0x1612d6[_0xd423('0x20')]:_0x152751[_0xd423('0x1f')]+_0x152751[_0xd423('0x1e')];var _0x52e762;if(_0x42edcd>=_0x477c17){_0x42edcd=_0x477c17;_0x52e762=0xc8;}else{_0x52e762=0xce;}_0x1bb456[_0xd423('0x1a')](_0x52e762);return _0x1bb456[_0xd423('0x21')](_0xd423('0x22'),_0x217e7a+'-'+_0x42edcd+'/'+_0x477c17)['json'](_0x1612d6);}return null;};}function patchUpdates(_0x5cb1e2){return function(_0x3d26e0){try{jsonpatch['apply'](_0x3d26e0,_0x5cb1e2,!![]);}catch(_0x437cca){return BPromise[_0xd423('0x23')](_0x437cca);}return _0x3d26e0[_0xd423('0x24')]();};}function saveUpdates(_0x1ee113,_0x3dde70){return function(_0x3aa9b0){if(_0x3aa9b0){return _0x3aa9b0[_0xd423('0x25')](_0x1ee113)[_0xd423('0x26')](function(_0x44ad37){return _0x44ad37;});}return null;};}function removeEntity(_0x3ae61b,_0x591fa6){return function(_0x9e4731){if(_0x9e4731){return _0x9e4731[_0xd423('0x27')]()[_0xd423('0x26')](function(){_0x3ae61b[_0xd423('0x1a')](0xcc)[_0xd423('0x1b')]();});}};}function handleEntityNotFound(_0x556728,_0x944cee){return function(_0xea47b3){if(!_0xea47b3){_0x556728['sendStatus'](0x194);}return _0xea47b3;};}function handleError(_0x13d3d6,_0x3cddb2){_0x3cddb2=_0x3cddb2||0x1f4;return function(_0x46304f){logger['error'](_0x46304f[_0xd423('0x28')]);if(_0x46304f[_0xd423('0x29')]){delete _0x46304f['name'];}_0x13d3d6['status'](_0x3cddb2)[_0xd423('0x2a')](_0x46304f);};}exports[_0xd423('0x2b')]=function(_0x11b40c,_0x59c0a5){var _0x12599d={},_0x53977e={},_0xfe481e={'count':0x0,'rows':[]};var _0x38cc9c=_[_0xd423('0x2c')](db['DeskConfiguration'][_0xd423('0x2d')],function(_0x26df77){return{'name':_0x26df77[_0xd423('0x2e')],'type':_0x26df77[_0xd423('0x2f')][_0xd423('0x30')]};});_0x53977e[_0xd423('0x31')]=_[_0xd423('0x2c')](_0x38cc9c,_0xd423('0x29'));_0x53977e[_0xd423('0x32')]=_['keys'](_0x11b40c['query']);_0x53977e['filters']=_[_0xd423('0x33')](_0x53977e[_0xd423('0x31')],_0x53977e[_0xd423('0x32')]);_0x12599d[_0xd423('0x34')]=_[_0xd423('0x33')](_0x53977e[_0xd423('0x31')],qs[_0xd423('0x35')](_0x11b40c['query'][_0xd423('0x35')]));_0x12599d['attributes']=_0x12599d[_0xd423('0x34')][_0xd423('0x36')]?_0x12599d[_0xd423('0x34')]:_0x53977e[_0xd423('0x31')];if(!_0x11b40c['query'][_0xd423('0x37')](_0xd423('0x38'))){_0x12599d[_0xd423('0x1e')]=qs[_0xd423('0x1e')](_0x11b40c['query'][_0xd423('0x1e')]);_0x12599d['offset']=qs[_0xd423('0x1f')](_0x11b40c[_0xd423('0x32')][_0xd423('0x1f')]);}_0x12599d[_0xd423('0x39')]=qs['sort'](_0x11b40c['query'][_0xd423('0x3a')]);_0x12599d[_0xd423('0x3b')]=qs[_0xd423('0x3c')](_[_0xd423('0x3d')](_0x11b40c[_0xd423('0x32')],_0x53977e['filters']),_0x38cc9c);if(_0x11b40c[_0xd423('0x32')]['filter']){_0x12599d[_0xd423('0x3b')]=_[_0xd423('0x3e')](_0x12599d[_0xd423('0x3b')],{'$or':_[_0xd423('0x2c')](_0x38cc9c,function(_0x709b93){if(_0x709b93[_0xd423('0x2f')]!=='VIRTUAL'){var _0x23115c={};_0x23115c[_0x709b93[_0xd423('0x29')]]={'$like':'%'+_0x11b40c[_0xd423('0x32')][_0xd423('0x3f')]+'%'};return _0x23115c;}})});}_0x12599d=_[_0xd423('0x3e')]({},_0x12599d,_0x11b40c[_0xd423('0x40')]);var _0x2692f0={'where':_0x12599d[_0xd423('0x3b')]};return db[_0xd423('0x41')][_0xd423('0x20')](_0x2692f0)[_0xd423('0x26')](function(_0x2ba207){_0xfe481e['count']=_0x2ba207;if(_0x11b40c[_0xd423('0x32')][_0xd423('0x42')]){_0x12599d[_0xd423('0x43')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xd423('0x44')](_0x12599d);})['then'](function(_0x394fd8){_0xfe481e[_0xd423('0x45')]=_0x394fd8;return _0xfe481e;})[_0xd423('0x26')](respondWithFilteredResult(_0x59c0a5,_0x12599d))[_0xd423('0x46')](handleError(_0x59c0a5,null));};exports[_0xd423('0x47')]=function(_0xc6e65d,_0x2deb9c){var _0x4bbeb2={'raw':![],'where':{'id':_0xc6e65d['params']['id']}},_0xdd348c={};_0xdd348c[_0xd423('0x31')]=_['keys'](db[_0xd423('0x41')]['rawAttributes']);_0xdd348c[_0xd423('0x32')]=_[_0xd423('0x48')](_0xc6e65d[_0xd423('0x32')]);_0xdd348c['filters']=_[_0xd423('0x33')](_0xdd348c[_0xd423('0x31')],_0xdd348c['query']);_0x4bbeb2[_0xd423('0x34')]=_['intersection'](_0xdd348c[_0xd423('0x31')],qs[_0xd423('0x35')](_0xc6e65d[_0xd423('0x32')]['fields']));_0x4bbeb2[_0xd423('0x34')]=_0x4bbeb2[_0xd423('0x34')][_0xd423('0x36')]?_0x4bbeb2[_0xd423('0x34')]:_0xdd348c['model'];if(_0xc6e65d[_0xd423('0x32')][_0xd423('0x42')]){_0x4bbeb2[_0xd423('0x43')]=[{'all':!![]}];}_0x4bbeb2=_['merge']({},_0x4bbeb2,_0xc6e65d[_0xd423('0x40')]);return db['DeskConfiguration'][_0xd423('0x49')](_0x4bbeb2)[_0xd423('0x26')](handleEntityNotFound(_0x2deb9c,null))[_0xd423('0x26')](respondWithResult(_0x2deb9c,null))['catch'](handleError(_0x2deb9c,null));};exports[_0xd423('0x4a')]=function(_0x1f3e3d,_0xece2a6){return db['DeskConfiguration'][_0xd423('0x4a')](_0x1f3e3d[_0xd423('0x4b')],{})['then'](respondWithResult(_0xece2a6,0xc9))[_0xd423('0x46')](handleError(_0xece2a6,null));};exports[_0xd423('0x25')]=function(_0x111a4b,_0x39e271){if(_0x111a4b[_0xd423('0x4b')]['id']){delete _0x111a4b['body']['id'];}return db[_0xd423('0x41')][_0xd423('0x49')]({'where':{'id':_0x111a4b[_0xd423('0x4c')]['id']}})[_0xd423('0x26')](handleEntityNotFound(_0x39e271,null))[_0xd423('0x26')](saveUpdates(_0x111a4b[_0xd423('0x4b')],null))[_0xd423('0x26')](respondWithResult(_0x39e271,null))[_0xd423('0x46')](handleError(_0x39e271,null));};exports['destroy']=function(_0x3fc3b6,_0xc83710){return db[_0xd423('0x41')][_0xd423('0x49')]({'where':{'id':_0x3fc3b6['params']['id']}})[_0xd423('0x26')](handleEntityNotFound(_0xc83710,null))[_0xd423('0x26')](removeEntity(_0xc83710,null))[_0xd423('0x46')](handleError(_0xc83710,null));};exports[_0xd423('0x4d')]=function(_0x39c901,_0x2843ce,_0x534c6f){var _0x2dd160={};var _0x38dc91={};var _0x366769;var _0x5db0fb;return db[_0xd423('0x41')][_0xd423('0x4e')]({'where':{'id':_0x39c901[_0xd423('0x4c')]['id']}})[_0xd423('0x26')](handleEntityNotFound(_0x2843ce,null))[_0xd423('0x26')](function(_0x475f03){if(_0x475f03){_0x366769=_0x475f03;_0x38dc91[_0xd423('0x31')]=_[_0xd423('0x48')](db['DeskField'][_0xd423('0x2d')]);_0x38dc91['query']=_[_0xd423('0x48')](_0x39c901['query']);_0x38dc91[_0xd423('0x3c')]=_[_0xd423('0x33')](_0x38dc91[_0xd423('0x31')],_0x38dc91[_0xd423('0x32')]);_0x2dd160[_0xd423('0x34')]=_[_0xd423('0x33')](_0x38dc91[_0xd423('0x31')],qs[_0xd423('0x35')](_0x39c901[_0xd423('0x32')][_0xd423('0x35')]));_0x2dd160[_0xd423('0x34')]=_0x2dd160[_0xd423('0x34')][_0xd423('0x36')]?_0x2dd160['attributes']:_0x38dc91[_0xd423('0x31')];_0x2dd160['order']=qs[_0xd423('0x3a')](_0x39c901[_0xd423('0x32')][_0xd423('0x3a')]);_0x2dd160['where']=qs['filters'](_[_0xd423('0x3d')](_0x39c901[_0xd423('0x32')],_0x38dc91['filters']));if(_0x39c901[_0xd423('0x32')][_0xd423('0x3f')]){_0x2dd160[_0xd423('0x3b')]=_[_0xd423('0x3e')](_0x2dd160['where'],{'$or':_[_0xd423('0x2c')](_0x2dd160[_0xd423('0x34')],function(_0x4794d){var _0xedd581={};_0xedd581[_0x4794d]={'$like':'%'+_0x39c901[_0xd423('0x32')][_0xd423('0x3f')]+'%'};return _0xedd581;})});}_0x2dd160=_['merge']({},_0x2dd160,_0x39c901[_0xd423('0x40')]);return _0x366769['getFields'](_0x2dd160);}})['then'](function(_0x3ffb34){if(_0x3ffb34){_0x5db0fb=_0x3ffb34[_0xd423('0x36')];if(!_0x39c901[_0xd423('0x32')][_0xd423('0x37')](_0xd423('0x38'))){_0x2dd160[_0xd423('0x1e')]=qs['limit'](_0x39c901['query'][_0xd423('0x1e')]);_0x2dd160[_0xd423('0x1f')]=qs[_0xd423('0x1f')](_0x39c901[_0xd423('0x32')][_0xd423('0x1f')]);}return _0x366769[_0xd423('0x4d')](_0x2dd160);}})[_0xd423('0x26')](function(_0x1d33d8){if(_0x1d33d8){return _0x1d33d8?{'count':_0x5db0fb,'rows':_0x1d33d8}:null;}})[_0xd423('0x26')](respondWithResult(_0x2843ce,null))['catch'](handleError(_0x2843ce,null));};exports[_0xd423('0x4f')]=function(_0xdcf8a8,_0x36081a,_0x3e3d7f){var _0xee920d={};var _0x400f2f={};var _0x5590b6;var _0x3dbed7;return db[_0xd423('0x41')][_0xd423('0x4e')]({'where':{'id':_0xdcf8a8[_0xd423('0x4c')]['id']}})['then'](handleEntityNotFound(_0x36081a,null))[_0xd423('0x26')](function(_0x5c05e5){if(_0x5c05e5){_0x5590b6=_0x5c05e5;_0x400f2f[_0xd423('0x31')]=_[_0xd423('0x48')](db['DeskField'][_0xd423('0x2d')]);_0x400f2f[_0xd423('0x32')]=_[_0xd423('0x48')](_0xdcf8a8[_0xd423('0x32')]);_0x400f2f[_0xd423('0x3c')]=_['intersection'](_0x400f2f['model'],_0x400f2f[_0xd423('0x32')]);_0xee920d[_0xd423('0x34')]=_[_0xd423('0x33')](_0x400f2f[_0xd423('0x31')],qs[_0xd423('0x35')](_0xdcf8a8['query'][_0xd423('0x35')]));_0xee920d[_0xd423('0x34')]=_0xee920d[_0xd423('0x34')][_0xd423('0x36')]?_0xee920d[_0xd423('0x34')]:_0x400f2f[_0xd423('0x31')];_0xee920d['order']=qs['sort'](_0xdcf8a8['query']['sort']);_0xee920d[_0xd423('0x3b')]=qs[_0xd423('0x3c')](_[_0xd423('0x3d')](_0xdcf8a8[_0xd423('0x32')],_0x400f2f['filters']));if(_0xdcf8a8[_0xd423('0x32')]['filter']){_0xee920d[_0xd423('0x3b')]=_['merge'](_0xee920d[_0xd423('0x3b')],{'$or':_[_0xd423('0x2c')](_0xee920d['attributes'],function(_0x3f7a7a){var _0x14c20f={};_0x14c20f[_0x3f7a7a]={'$like':'%'+_0xdcf8a8[_0xd423('0x32')]['filter']+'%'};return _0x14c20f;})});}_0xee920d=_[_0xd423('0x3e')]({},_0xee920d,_0xdcf8a8['options']);return _0x5590b6['getSubjects'](_0xee920d);}})[_0xd423('0x26')](function(_0x20ad38){if(_0x20ad38){_0x3dbed7=_0x20ad38[_0xd423('0x36')];if(!_0xdcf8a8[_0xd423('0x32')]['hasOwnProperty'](_0xd423('0x38'))){_0xee920d['limit']=qs[_0xd423('0x1e')](_0xdcf8a8[_0xd423('0x32')]['limit']);_0xee920d[_0xd423('0x1f')]=qs[_0xd423('0x1f')](_0xdcf8a8['query']['offset']);}return _0x5590b6[_0xd423('0x4f')](_0xee920d);}})[_0xd423('0x26')](function(_0x6b28c3){if(_0x6b28c3){return _0x6b28c3?{'count':_0x3dbed7,'rows':_0x6b28c3}:null;}})['then'](respondWithResult(_0x36081a,null))['catch'](handleError(_0x36081a,null));};exports[_0xd423('0x50')]=function(_0x3c34c4,_0x364ff8,_0x556b5e){var _0x5ea9b8={};var _0x1cd1b5={};var _0x4d29fa;var _0x38676b;return db[_0xd423('0x41')]['findOne']({'where':{'id':_0x3c34c4[_0xd423('0x4c')]['id']}})[_0xd423('0x26')](handleEntityNotFound(_0x364ff8,null))[_0xd423('0x26')](function(_0x57b10f){if(_0x57b10f){_0x4d29fa=_0x57b10f;_0x1cd1b5[_0xd423('0x31')]=_['keys'](db['DeskField'][_0xd423('0x2d')]);_0x1cd1b5[_0xd423('0x32')]=_[_0xd423('0x48')](_0x3c34c4[_0xd423('0x32')]);_0x1cd1b5[_0xd423('0x3c')]=_['intersection'](_0x1cd1b5[_0xd423('0x31')],_0x1cd1b5[_0xd423('0x32')]);_0x5ea9b8[_0xd423('0x34')]=_[_0xd423('0x33')](_0x1cd1b5[_0xd423('0x31')],qs[_0xd423('0x35')](_0x3c34c4['query'][_0xd423('0x35')]));_0x5ea9b8[_0xd423('0x34')]=_0x5ea9b8[_0xd423('0x34')][_0xd423('0x36')]?_0x5ea9b8['attributes']:_0x1cd1b5['model'];_0x5ea9b8[_0xd423('0x39')]=qs[_0xd423('0x3a')](_0x3c34c4[_0xd423('0x32')][_0xd423('0x3a')]);_0x5ea9b8[_0xd423('0x3b')]=qs[_0xd423('0x3c')](_[_0xd423('0x3d')](_0x3c34c4[_0xd423('0x32')],_0x1cd1b5[_0xd423('0x3c')]));if(_0x3c34c4[_0xd423('0x32')][_0xd423('0x3f')]){_0x5ea9b8['where']=_['merge'](_0x5ea9b8[_0xd423('0x3b')],{'$or':_['map'](_0x5ea9b8[_0xd423('0x34')],function(_0x2d65e7){var _0x1af24a={};_0x1af24a[_0x2d65e7]={'$like':'%'+_0x3c34c4[_0xd423('0x32')][_0xd423('0x3f')]+'%'};return _0x1af24a;})});}_0x5ea9b8=_[_0xd423('0x3e')]({},_0x5ea9b8,_0x3c34c4[_0xd423('0x40')]);return _0x4d29fa[_0xd423('0x50')](_0x5ea9b8);}})['then'](function(_0x132043){if(_0x132043){_0x38676b=_0x132043['length'];if(!_0x3c34c4['query'][_0xd423('0x37')](_0xd423('0x38'))){_0x5ea9b8['limit']=qs[_0xd423('0x1e')](_0x3c34c4[_0xd423('0x32')][_0xd423('0x1e')]);_0x5ea9b8[_0xd423('0x1f')]=qs[_0xd423('0x1f')](_0x3c34c4['query'][_0xd423('0x1f')]);}return _0x4d29fa[_0xd423('0x50')](_0x5ea9b8);}})[_0xd423('0x26')](function(_0x31c948){if(_0x31c948){return _0x31c948?{'count':_0x38676b,'rows':_0x31c948}:null;}})['then'](respondWithResult(_0x364ff8,null))[_0xd423('0x46')](handleError(_0x364ff8,null));};exports[_0xd423('0x51')]=function(_0x307e2a,_0x2234eb,_0x15c075){var _0x2fb5de={};var _0x4f8e90={};var _0x56f3a3;var _0x42d776;return db[_0xd423('0x41')][_0xd423('0x4e')]({'where':{'id':_0x307e2a[_0xd423('0x4c')]['id']}})[_0xd423('0x26')](handleEntityNotFound(_0x2234eb,null))[_0xd423('0x26')](function(_0x33397f){if(_0x33397f){_0x56f3a3=_0x33397f;_0x4f8e90[_0xd423('0x31')]=_[_0xd423('0x48')](db[_0xd423('0x52')]['rawAttributes']);_0x4f8e90[_0xd423('0x32')]=_[_0xd423('0x48')](_0x307e2a[_0xd423('0x32')]);_0x4f8e90[_0xd423('0x3c')]=_['intersection'](_0x4f8e90['model'],_0x4f8e90[_0xd423('0x32')]);_0x2fb5de[_0xd423('0x34')]=_[_0xd423('0x33')](_0x4f8e90[_0xd423('0x31')],qs[_0xd423('0x35')](_0x307e2a[_0xd423('0x32')][_0xd423('0x35')]));_0x2fb5de[_0xd423('0x34')]=_0x2fb5de[_0xd423('0x34')][_0xd423('0x36')]?_0x2fb5de[_0xd423('0x34')]:_0x4f8e90[_0xd423('0x31')];_0x2fb5de[_0xd423('0x39')]=qs[_0xd423('0x3a')](_0x307e2a[_0xd423('0x32')][_0xd423('0x3a')]);_0x2fb5de[_0xd423('0x3b')]=qs[_0xd423('0x3c')](_[_0xd423('0x3d')](_0x307e2a['query'],_0x4f8e90[_0xd423('0x3c')]));if(_0x307e2a['query'][_0xd423('0x3f')]){_0x2fb5de['where']=_[_0xd423('0x3e')](_0x2fb5de[_0xd423('0x3b')],{'$or':_['map'](_0x2fb5de[_0xd423('0x34')],function(_0x52f0e9){var _0x225598={};_0x225598[_0x52f0e9]={'$like':'%'+_0x307e2a[_0xd423('0x32')][_0xd423('0x3f')]+'%'};return _0x225598;})});}_0x2fb5de=_['merge']({},_0x2fb5de,_0x307e2a[_0xd423('0x40')]);return _0x56f3a3[_0xd423('0x51')](_0x2fb5de);}})['then'](function(_0x2ff492){if(_0x2ff492){_0x42d776=_0x2ff492[_0xd423('0x36')];if(!_0x307e2a[_0xd423('0x32')][_0xd423('0x37')](_0xd423('0x38'))){_0x2fb5de[_0xd423('0x1e')]=qs[_0xd423('0x1e')](_0x307e2a[_0xd423('0x32')][_0xd423('0x1e')]);_0x2fb5de[_0xd423('0x1f')]=qs['offset'](_0x307e2a[_0xd423('0x32')][_0xd423('0x1f')]);}return _0x56f3a3[_0xd423('0x51')](_0x2fb5de);}})[_0xd423('0x26')](function(_0x29b0b1){if(_0x29b0b1){return _0x29b0b1?{'count':_0x42d776,'rows':_0x29b0b1}:null;}})[_0xd423('0x26')](respondWithResult(_0x2234eb,null))[_0xd423('0x46')](handleError(_0x2234eb,null));};exports[_0xd423('0x53')]=function(_0x1e1d62,_0x497dc6,_0x2d9e36){if(_0x1e1d62[_0xd423('0x4b')]['id']){delete _0x1e1d62['body']['id'];}return db[_0xd423('0x41')][_0xd423('0x4e')]({'where':{'id':_0x1e1d62[_0xd423('0x4c')]['id']}})[_0xd423('0x26')](handleEntityNotFound(_0x497dc6,null))[_0xd423('0x26')](function(_0x927d10){if(_0x927d10){return _0x927d10[_0xd423('0x53')](_0x1e1d62[_0xd423('0x4b')][_0xd423('0x54')]||[]);}return null;})[_0xd423('0x26')](respondWithResult(_0x497dc6,null))['catch'](handleError(_0x497dc6,null));}; \ No newline at end of file +var _0xa1ec=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','getFields','DeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','DeskConfiguration','rawAttributes'];(function(_0xb3284d,_0x5f07b0){var _0x2ea499=function(_0x1c50d7){while(--_0x1c50d7){_0xb3284d['push'](_0xb3284d['shift']());}};_0x2ea499(++_0x5f07b0);}(_0xa1ec,0x17d));var _0xca1e=function(_0x42cac2,_0x2e68bc){_0x42cac2=_0x42cac2-0x0;var _0x54401c=_0xa1ec[_0x42cac2];return _0x54401c;};'use strict';var emlformat=require(_0xca1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca1e('0x1'));var jsonpatch=require(_0xca1e('0x2'));var rp=require(_0xca1e('0x3'));var moment=require(_0xca1e('0x4'));var BPromise=require(_0xca1e('0x5'));var Mustache=require(_0xca1e('0x6'));var util=require(_0xca1e('0x7'));var path=require(_0xca1e('0x8'));var sox=require(_0xca1e('0x9'));var csv=require(_0xca1e('0xa'));var ejs=require(_0xca1e('0xb'));var fs=require('fs');var fs_extra=require(_0xca1e('0xc'));var _=require(_0xca1e('0xd'));var squel=require(_0xca1e('0xe'));var crypto=require(_0xca1e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xca1e('0x10'));var toCsv=require('to-csv');var querystring=require(_0xca1e('0x11'));var Papa=require(_0xca1e('0x12'));var Redis=require(_0xca1e('0x13'));var authService=require(_0xca1e('0x14'));var qs=require(_0xca1e('0x15'));var as=require(_0xca1e('0x16'));var hardwareService=require(_0xca1e('0x17'));var logger=require(_0xca1e('0x18'))(_0xca1e('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xca1e('0x1a'));var db=require(_0xca1e('0x1b'))['db'];function respondWithStatusCode(_0x2a3f80,_0x451a6e){_0x451a6e=_0x451a6e||0xcc;return function(_0x2ab1c8){if(_0x2ab1c8){return _0x2a3f80['sendStatus'](_0x451a6e);}return _0x2a3f80['status'](_0x451a6e)[_0xca1e('0x1c')]();};}function respondWithResult(_0x223aa4,_0x20e70e){_0x20e70e=_0x20e70e||0xc8;return function(_0x52a0d2){if(_0x52a0d2){return _0x223aa4[_0xca1e('0x1d')](_0x20e70e)[_0xca1e('0x1e')](_0x52a0d2);}};}function respondWithFilteredResult(_0x5580ec,_0x27a83d){return function(_0x228aa4){if(_0x228aa4){var _0x53e94f=typeof _0x27a83d[_0xca1e('0x1f')]===_0xca1e('0x20')&&typeof _0x27a83d['limit']==='undefined';var _0x50109a=_0x228aa4[_0xca1e('0x21')];var _0x2583db=_0x53e94f?0x0:_0x27a83d[_0xca1e('0x1f')];var _0x5b8745=_0x53e94f?_0x228aa4[_0xca1e('0x21')]:_0x27a83d[_0xca1e('0x1f')]+_0x27a83d[_0xca1e('0x22')];var _0x359faa;if(_0x5b8745>=_0x50109a){_0x5b8745=_0x50109a;_0x359faa=0xc8;}else{_0x359faa=0xce;}_0x5580ec[_0xca1e('0x1d')](_0x359faa);return _0x5580ec[_0xca1e('0x23')](_0xca1e('0x24'),_0x2583db+'-'+_0x5b8745+'/'+_0x50109a)[_0xca1e('0x1e')](_0x228aa4);}return null;};}function patchUpdates(_0x90783e){return function(_0x38a260){try{jsonpatch[_0xca1e('0x25')](_0x38a260,_0x90783e,!![]);}catch(_0x304d7a){return BPromise['reject'](_0x304d7a);}return _0x38a260[_0xca1e('0x26')]();};}function saveUpdates(_0x4db09b,_0x5a04dd){return function(_0x3ec355){if(_0x3ec355){return _0x3ec355[_0xca1e('0x27')](_0x4db09b)[_0xca1e('0x28')](function(_0x3cc80b){return _0x3cc80b;});}return null;};}function removeEntity(_0x4f86c0,_0x3d0353){return function(_0x3b32af){if(_0x3b32af){return _0x3b32af[_0xca1e('0x29')]()['then'](function(){_0x4f86c0['status'](0xcc)[_0xca1e('0x1c')]();});}};}function handleEntityNotFound(_0x1b652b,_0x141acd){return function(_0x7ce061){if(!_0x7ce061){_0x1b652b['sendStatus'](0x194);}return _0x7ce061;};}function handleError(_0x278441,_0x303aa7){_0x303aa7=_0x303aa7||0x1f4;return function(_0xde387e){logger[_0xca1e('0x2a')](_0xde387e[_0xca1e('0x2b')]);if(_0xde387e['name']){delete _0xde387e[_0xca1e('0x2c')];}_0x278441[_0xca1e('0x1d')](_0x303aa7)['send'](_0xde387e);};}exports[_0xca1e('0x2d')]=function(_0x4bdfbb,_0x2c4d56){var _0x1187e5={},_0x4403dd={},_0x2c15d3={'count':0x0,'rows':[]};var _0x3684d3=_[_0xca1e('0x2e')](db[_0xca1e('0x2f')][_0xca1e('0x30')],function(_0x2b1b82){return{'name':_0x2b1b82[_0xca1e('0x31')],'type':_0x2b1b82[_0xca1e('0x32')][_0xca1e('0x33')]};});_0x4403dd[_0xca1e('0x34')]=_['map'](_0x3684d3,_0xca1e('0x2c'));_0x4403dd[_0xca1e('0x35')]=_[_0xca1e('0x36')](_0x4bdfbb['query']);_0x4403dd[_0xca1e('0x37')]=_['intersection'](_0x4403dd[_0xca1e('0x34')],_0x4403dd[_0xca1e('0x35')]);_0x1187e5['attributes']=_[_0xca1e('0x38')](_0x4403dd['model'],qs[_0xca1e('0x39')](_0x4bdfbb[_0xca1e('0x35')]['fields']));_0x1187e5[_0xca1e('0x3a')]=_0x1187e5[_0xca1e('0x3a')][_0xca1e('0x3b')]?_0x1187e5[_0xca1e('0x3a')]:_0x4403dd[_0xca1e('0x34')];if(!_0x4bdfbb[_0xca1e('0x35')]['hasOwnProperty'](_0xca1e('0x3c'))){_0x1187e5[_0xca1e('0x22')]=qs[_0xca1e('0x22')](_0x4bdfbb[_0xca1e('0x35')][_0xca1e('0x22')]);_0x1187e5[_0xca1e('0x1f')]=qs[_0xca1e('0x1f')](_0x4bdfbb[_0xca1e('0x35')][_0xca1e('0x1f')]);}_0x1187e5[_0xca1e('0x3d')]=qs[_0xca1e('0x3e')](_0x4bdfbb[_0xca1e('0x35')]['sort']);_0x1187e5[_0xca1e('0x3f')]=qs[_0xca1e('0x37')](_[_0xca1e('0x40')](_0x4bdfbb['query'],_0x4403dd['filters']),_0x3684d3);if(_0x4bdfbb['query']['filter']){_0x1187e5[_0xca1e('0x3f')]=_['merge'](_0x1187e5[_0xca1e('0x3f')],{'$or':_[_0xca1e('0x2e')](_0x3684d3,function(_0x3d0a71){if(_0x3d0a71['type']!==_0xca1e('0x41')){var _0x32f725={};_0x32f725[_0x3d0a71['name']]={'$like':'%'+_0x4bdfbb[_0xca1e('0x35')][_0xca1e('0x42')]+'%'};return _0x32f725;}})});}_0x1187e5=_[_0xca1e('0x43')]({},_0x1187e5,_0x4bdfbb[_0xca1e('0x44')]);var _0x22c41f={'where':_0x1187e5['where']};return db[_0xca1e('0x2f')][_0xca1e('0x21')](_0x22c41f)[_0xca1e('0x28')](function(_0x3f2353){_0x2c15d3[_0xca1e('0x21')]=_0x3f2353;if(_0x4bdfbb[_0xca1e('0x35')][_0xca1e('0x45')]){_0x1187e5[_0xca1e('0x46')]=[{'all':!![]}];}return db[_0xca1e('0x2f')][_0xca1e('0x47')](_0x1187e5);})[_0xca1e('0x28')](function(_0x20dda6){_0x2c15d3['rows']=_0x20dda6;return _0x2c15d3;})[_0xca1e('0x28')](respondWithFilteredResult(_0x2c4d56,_0x1187e5))['catch'](handleError(_0x2c4d56,null));};exports[_0xca1e('0x48')]=function(_0x2bb76f,_0x3907cc){var _0x32c091={'raw':![],'where':{'id':_0x2bb76f[_0xca1e('0x49')]['id']}},_0x5eda70={};_0x5eda70[_0xca1e('0x34')]=_['keys'](db[_0xca1e('0x2f')]['rawAttributes']);_0x5eda70[_0xca1e('0x35')]=_[_0xca1e('0x36')](_0x2bb76f[_0xca1e('0x35')]);_0x5eda70[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0x5eda70['model'],_0x5eda70['query']);_0x32c091[_0xca1e('0x3a')]=_['intersection'](_0x5eda70[_0xca1e('0x34')],qs[_0xca1e('0x39')](_0x2bb76f[_0xca1e('0x35')][_0xca1e('0x39')]));_0x32c091[_0xca1e('0x3a')]=_0x32c091[_0xca1e('0x3a')][_0xca1e('0x3b')]?_0x32c091[_0xca1e('0x3a')]:_0x5eda70['model'];if(_0x2bb76f[_0xca1e('0x35')][_0xca1e('0x45')]){_0x32c091[_0xca1e('0x46')]=[{'all':!![]}];}_0x32c091=_[_0xca1e('0x43')]({},_0x32c091,_0x2bb76f['options']);return db[_0xca1e('0x2f')][_0xca1e('0x4a')](_0x32c091)[_0xca1e('0x28')](handleEntityNotFound(_0x3907cc,null))[_0xca1e('0x28')](respondWithResult(_0x3907cc,null))[_0xca1e('0x4b')](handleError(_0x3907cc,null));};exports[_0xca1e('0x4c')]=function(_0x2cdbb0,_0x5dbc48){return db[_0xca1e('0x2f')][_0xca1e('0x4c')](_0x2cdbb0[_0xca1e('0x4d')],{})[_0xca1e('0x28')](respondWithResult(_0x5dbc48,0xc9))[_0xca1e('0x4b')](handleError(_0x5dbc48,null));};exports[_0xca1e('0x27')]=function(_0x349bb7,_0x1889d8){if(_0x349bb7['body']['id']){delete _0x349bb7[_0xca1e('0x4d')]['id'];}return db[_0xca1e('0x2f')][_0xca1e('0x4a')]({'where':{'id':_0x349bb7[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x1889d8,null))[_0xca1e('0x28')](saveUpdates(_0x349bb7['body'],null))[_0xca1e('0x28')](respondWithResult(_0x1889d8,null))['catch'](handleError(_0x1889d8,null));};exports[_0xca1e('0x29')]=function(_0x44cc5f,_0x33f08c){return db[_0xca1e('0x2f')][_0xca1e('0x4a')]({'where':{'id':_0x44cc5f[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x33f08c,null))['then'](removeEntity(_0x33f08c,null))[_0xca1e('0x4b')](handleError(_0x33f08c,null));};exports[_0xca1e('0x4e')]=function(_0x109a13,_0x1618ea,_0x3ceaea){var _0x29dcb5={};var _0x185ae7={};var _0x5be9b3;var _0xfd4aa7;return db['DeskConfiguration']['findOne']({'where':{'id':_0x109a13[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x1618ea,null))[_0xca1e('0x28')](function(_0x36095c){if(_0x36095c){_0x5be9b3=_0x36095c;_0x185ae7['model']=_[_0xca1e('0x36')](db[_0xca1e('0x4f')][_0xca1e('0x30')]);_0x185ae7[_0xca1e('0x35')]=_[_0xca1e('0x36')](_0x109a13['query']);_0x185ae7[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0x185ae7[_0xca1e('0x34')],_0x185ae7[_0xca1e('0x35')]);_0x29dcb5[_0xca1e('0x3a')]=_[_0xca1e('0x38')](_0x185ae7[_0xca1e('0x34')],qs[_0xca1e('0x39')](_0x109a13[_0xca1e('0x35')][_0xca1e('0x39')]));_0x29dcb5['attributes']=_0x29dcb5['attributes'][_0xca1e('0x3b')]?_0x29dcb5[_0xca1e('0x3a')]:_0x185ae7[_0xca1e('0x34')];_0x29dcb5[_0xca1e('0x3d')]=qs[_0xca1e('0x3e')](_0x109a13[_0xca1e('0x35')][_0xca1e('0x3e')]);_0x29dcb5['where']=qs[_0xca1e('0x37')](_[_0xca1e('0x40')](_0x109a13[_0xca1e('0x35')],_0x185ae7[_0xca1e('0x37')]));if(_0x109a13[_0xca1e('0x35')][_0xca1e('0x42')]){_0x29dcb5['where']=_['merge'](_0x29dcb5['where'],{'$or':_[_0xca1e('0x2e')](_0x29dcb5['attributes'],function(_0x2e21e0){var _0x1b824b={};_0x1b824b[_0x2e21e0]={'$like':'%'+_0x109a13[_0xca1e('0x35')][_0xca1e('0x42')]+'%'};return _0x1b824b;})});}_0x29dcb5=_[_0xca1e('0x43')]({},_0x29dcb5,_0x109a13[_0xca1e('0x44')]);return _0x5be9b3[_0xca1e('0x4e')](_0x29dcb5);}})[_0xca1e('0x28')](function(_0x20a851){if(_0x20a851){_0xfd4aa7=_0x20a851[_0xca1e('0x3b')];if(!_0x109a13[_0xca1e('0x35')][_0xca1e('0x50')](_0xca1e('0x3c'))){_0x29dcb5[_0xca1e('0x22')]=qs[_0xca1e('0x22')](_0x109a13[_0xca1e('0x35')][_0xca1e('0x22')]);_0x29dcb5[_0xca1e('0x1f')]=qs['offset'](_0x109a13['query'][_0xca1e('0x1f')]);}return _0x5be9b3['getFields'](_0x29dcb5);}})[_0xca1e('0x28')](function(_0x4a0c0c){if(_0x4a0c0c){return _0x4a0c0c?{'count':_0xfd4aa7,'rows':_0x4a0c0c}:null;}})[_0xca1e('0x28')](respondWithResult(_0x1618ea,null))[_0xca1e('0x4b')](handleError(_0x1618ea,null));};exports[_0xca1e('0x51')]=function(_0x4eb4b5,_0x39d933,_0x1b3452){var _0x419265={};var _0x4ba910={};var _0x2425d9;var _0x59be92;return db['DeskConfiguration'][_0xca1e('0x52')]({'where':{'id':_0x4eb4b5[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x39d933,null))[_0xca1e('0x28')](function(_0x1a43d6){if(_0x1a43d6){_0x2425d9=_0x1a43d6;_0x4ba910['model']=_[_0xca1e('0x36')](db[_0xca1e('0x4f')]['rawAttributes']);_0x4ba910[_0xca1e('0x35')]=_['keys'](_0x4eb4b5['query']);_0x4ba910[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0x4ba910[_0xca1e('0x34')],_0x4ba910[_0xca1e('0x35')]);_0x419265[_0xca1e('0x3a')]=_[_0xca1e('0x38')](_0x4ba910[_0xca1e('0x34')],qs['fields'](_0x4eb4b5[_0xca1e('0x35')][_0xca1e('0x39')]));_0x419265[_0xca1e('0x3a')]=_0x419265[_0xca1e('0x3a')]['length']?_0x419265[_0xca1e('0x3a')]:_0x4ba910[_0xca1e('0x34')];_0x419265[_0xca1e('0x3d')]=qs[_0xca1e('0x3e')](_0x4eb4b5['query'][_0xca1e('0x3e')]);_0x419265['where']=qs[_0xca1e('0x37')](_[_0xca1e('0x40')](_0x4eb4b5[_0xca1e('0x35')],_0x4ba910[_0xca1e('0x37')]));if(_0x4eb4b5['query'][_0xca1e('0x42')]){_0x419265[_0xca1e('0x3f')]=_[_0xca1e('0x43')](_0x419265[_0xca1e('0x3f')],{'$or':_['map'](_0x419265[_0xca1e('0x3a')],function(_0x52564a){var _0x24da22={};_0x24da22[_0x52564a]={'$like':'%'+_0x4eb4b5['query']['filter']+'%'};return _0x24da22;})});}_0x419265=_[_0xca1e('0x43')]({},_0x419265,_0x4eb4b5['options']);return _0x2425d9['getSubjects'](_0x419265);}})[_0xca1e('0x28')](function(_0xcf7fdb){if(_0xcf7fdb){_0x59be92=_0xcf7fdb[_0xca1e('0x3b')];if(!_0x4eb4b5[_0xca1e('0x35')]['hasOwnProperty']('nolimit')){_0x419265[_0xca1e('0x22')]=qs[_0xca1e('0x22')](_0x4eb4b5[_0xca1e('0x35')]['limit']);_0x419265[_0xca1e('0x1f')]=qs[_0xca1e('0x1f')](_0x4eb4b5['query'][_0xca1e('0x1f')]);}return _0x2425d9['getSubjects'](_0x419265);}})[_0xca1e('0x28')](function(_0x105e7e){if(_0x105e7e){return _0x105e7e?{'count':_0x59be92,'rows':_0x105e7e}:null;}})[_0xca1e('0x28')](respondWithResult(_0x39d933,null))[_0xca1e('0x4b')](handleError(_0x39d933,null));};exports[_0xca1e('0x53')]=function(_0x48bcda,_0x368ca6,_0x53b9af){var _0x30a337={};var _0xaf4fd4={};var _0x994c31;var _0x22a3e6;return db[_0xca1e('0x2f')][_0xca1e('0x52')]({'where':{'id':_0x48bcda[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x368ca6,null))[_0xca1e('0x28')](function(_0x3f01b9){if(_0x3f01b9){_0x994c31=_0x3f01b9;_0xaf4fd4[_0xca1e('0x34')]=_[_0xca1e('0x36')](db[_0xca1e('0x4f')][_0xca1e('0x30')]);_0xaf4fd4[_0xca1e('0x35')]=_['keys'](_0x48bcda[_0xca1e('0x35')]);_0xaf4fd4[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0xaf4fd4['model'],_0xaf4fd4['query']);_0x30a337[_0xca1e('0x3a')]=_['intersection'](_0xaf4fd4[_0xca1e('0x34')],qs[_0xca1e('0x39')](_0x48bcda[_0xca1e('0x35')]['fields']));_0x30a337[_0xca1e('0x3a')]=_0x30a337[_0xca1e('0x3a')][_0xca1e('0x3b')]?_0x30a337[_0xca1e('0x3a')]:_0xaf4fd4['model'];_0x30a337[_0xca1e('0x3d')]=qs[_0xca1e('0x3e')](_0x48bcda[_0xca1e('0x35')][_0xca1e('0x3e')]);_0x30a337[_0xca1e('0x3f')]=qs[_0xca1e('0x37')](_['pick'](_0x48bcda[_0xca1e('0x35')],_0xaf4fd4['filters']));if(_0x48bcda[_0xca1e('0x35')][_0xca1e('0x42')]){_0x30a337[_0xca1e('0x3f')]=_[_0xca1e('0x43')](_0x30a337['where'],{'$or':_[_0xca1e('0x2e')](_0x30a337[_0xca1e('0x3a')],function(_0x3d2735){var _0x4c227b={};_0x4c227b[_0x3d2735]={'$like':'%'+_0x48bcda[_0xca1e('0x35')][_0xca1e('0x42')]+'%'};return _0x4c227b;})});}_0x30a337=_[_0xca1e('0x43')]({},_0x30a337,_0x48bcda['options']);return _0x994c31[_0xca1e('0x53')](_0x30a337);}})[_0xca1e('0x28')](function(_0x173ff5){if(_0x173ff5){_0x22a3e6=_0x173ff5[_0xca1e('0x3b')];if(!_0x48bcda['query'][_0xca1e('0x50')](_0xca1e('0x3c'))){_0x30a337['limit']=qs[_0xca1e('0x22')](_0x48bcda[_0xca1e('0x35')][_0xca1e('0x22')]);_0x30a337[_0xca1e('0x1f')]=qs[_0xca1e('0x1f')](_0x48bcda[_0xca1e('0x35')]['offset']);}return _0x994c31['getDescriptions'](_0x30a337);}})[_0xca1e('0x28')](function(_0x44c31f){if(_0x44c31f){return _0x44c31f?{'count':_0x22a3e6,'rows':_0x44c31f}:null;}})[_0xca1e('0x28')](respondWithResult(_0x368ca6,null))[_0xca1e('0x4b')](handleError(_0x368ca6,null));};exports[_0xca1e('0x54')]=function(_0x2ac21a,_0x21baae,_0x5c381a){var _0x44959c={};var _0x1102eb={};var _0x30b6e0;var _0x3f0e7f;return db[_0xca1e('0x2f')]['findOne']({'where':{'id':_0x2ac21a[_0xca1e('0x49')]['id']}})['then'](handleEntityNotFound(_0x21baae,null))['then'](function(_0x2bf2ac){if(_0x2bf2ac){_0x30b6e0=_0x2bf2ac;_0x1102eb[_0xca1e('0x34')]=_[_0xca1e('0x36')](db['Tag'][_0xca1e('0x30')]);_0x1102eb[_0xca1e('0x35')]=_['keys'](_0x2ac21a[_0xca1e('0x35')]);_0x1102eb[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0x1102eb[_0xca1e('0x34')],_0x1102eb[_0xca1e('0x35')]);_0x44959c[_0xca1e('0x3a')]=_[_0xca1e('0x38')](_0x1102eb['model'],qs[_0xca1e('0x39')](_0x2ac21a[_0xca1e('0x35')]['fields']));_0x44959c[_0xca1e('0x3a')]=_0x44959c[_0xca1e('0x3a')][_0xca1e('0x3b')]?_0x44959c['attributes']:_0x1102eb[_0xca1e('0x34')];_0x44959c['order']=qs[_0xca1e('0x3e')](_0x2ac21a[_0xca1e('0x35')][_0xca1e('0x3e')]);_0x44959c['where']=qs[_0xca1e('0x37')](_[_0xca1e('0x40')](_0x2ac21a['query'],_0x1102eb['filters']));if(_0x2ac21a['query']['filter']){_0x44959c[_0xca1e('0x3f')]=_[_0xca1e('0x43')](_0x44959c[_0xca1e('0x3f')],{'$or':_[_0xca1e('0x2e')](_0x44959c['attributes'],function(_0x4efd93){var _0x3f4dac={};_0x3f4dac[_0x4efd93]={'$like':'%'+_0x2ac21a['query'][_0xca1e('0x42')]+'%'};return _0x3f4dac;})});}_0x44959c=_[_0xca1e('0x43')]({},_0x44959c,_0x2ac21a[_0xca1e('0x44')]);return _0x30b6e0[_0xca1e('0x54')](_0x44959c);}})['then'](function(_0x2919a6){if(_0x2919a6){_0x3f0e7f=_0x2919a6[_0xca1e('0x3b')];if(!_0x2ac21a[_0xca1e('0x35')][_0xca1e('0x50')](_0xca1e('0x3c'))){_0x44959c['limit']=qs[_0xca1e('0x22')](_0x2ac21a[_0xca1e('0x35')][_0xca1e('0x22')]);_0x44959c[_0xca1e('0x1f')]=qs[_0xca1e('0x1f')](_0x2ac21a[_0xca1e('0x35')][_0xca1e('0x1f')]);}return _0x30b6e0[_0xca1e('0x54')](_0x44959c);}})['then'](function(_0x11da35){if(_0x11da35){return _0x11da35?{'count':_0x3f0e7f,'rows':_0x11da35}:null;}})[_0xca1e('0x28')](respondWithResult(_0x21baae,null))[_0xca1e('0x4b')](handleError(_0x21baae,null));};exports['setTags']=function(_0x312f77,_0x3c6f21,_0x103ef7){if(_0x312f77[_0xca1e('0x4d')]['id']){delete _0x312f77['body']['id'];}return db['DeskConfiguration'][_0xca1e('0x52')]({'where':{'id':_0x312f77[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x3c6f21,null))[_0xca1e('0x28')](function(_0x1bc9c7){if(_0x1bc9c7){return _0x1bc9c7['setTags'](_0x312f77[_0xca1e('0x4d')][_0xca1e('0x55')]||[]);}return null;})[_0xca1e('0x28')](respondWithResult(_0x3c6f21,null))[_0xca1e('0x4b')](handleError(_0x3c6f21,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8295d48..e07a9c0 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 _0xdacd=['request-promise','path','rimraf','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x1b9ba5,_0x44b731){var _0x55bc1a=function(_0x5b1cbc){while(--_0x5b1cbc){_0x1b9ba5['push'](_0x1b9ba5['shift']());}};_0x55bc1a(++_0x44b731);}(_0xdacd,0xab));var _0xddac=function(_0x1918c9,_0x602a17){_0x1918c9=_0x1918c9-0x0;var _0x2d01a8=_0xdacd[_0x1918c9];return _0x2d01a8;};'use strict';var _=require('lodash');var util=require(_0xddac('0x0'));var logger=require(_0xddac('0x1'))(_0xddac('0x2'));var moment=require(_0xddac('0x3'));var BPromise=require(_0xddac('0x4'));var rp=require(_0xddac('0x5'));var fs=require('fs');var path=require(_0xddac('0x6'));var rimraf=require(_0xddac('0x7'));var config=require('../../config/environment');var attributes=require(_0xddac('0x8'));module['exports']=function(_0x28438d,_0x3d4e83){return _0x28438d['define'](_0xddac('0x9'),attributes,{'tableName':_0xddac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe54=['../../config/environment','exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3f2fc5,_0x1aaf24){var _0x697a68=function(_0x112b7f){while(--_0x112b7f){_0x3f2fc5['push'](_0x3f2fc5['shift']());}};_0x697a68(++_0x1aaf24);}(_0xbe54,0xe8));var _0x4be5=function(_0x537ef0,_0x1cba1c){_0x537ef0=_0x537ef0-0x0;var _0x30ad43=_0xbe54[_0x537ef0];return _0x30ad43;};'use strict';var _=require(_0x4be5('0x0'));var util=require(_0x4be5('0x1'));var logger=require(_0x4be5('0x2'))(_0x4be5('0x3'));var moment=require('moment');var BPromise=require(_0x4be5('0x4'));var rp=require(_0x4be5('0x5'));var fs=require('fs');var path=require(_0x4be5('0x6'));var rimraf=require(_0x4be5('0x7'));var config=require(_0x4be5('0x8'));var attributes=require('./intDeskConfiguration.attributes');module[_0x4be5('0x9')]=function(_0x4f8c72,_0x12b64c){return _0x4f8c72['define'](_0x4be5('0xa'),attributes,{'tableName':_0x4be5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 07e1f31..6196212 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 _0xb6ff=['info','DeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request'];(function(_0x4100d1,_0x209f80){var _0x2f235c=function(_0x5ee350){while(--_0x5ee350){_0x4100d1['push'](_0x4100d1['shift']());}};_0x2f235c(++_0x209f80);}(_0xb6ff,0x185));var _0xfb6f=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xb6ff[_0x25bea7];return _0x175952;};'use strict';var _=require(_0xfb6f('0x0'));var util=require(_0xfb6f('0x1'));var moment=require(_0xfb6f('0x2'));var BPromise=require(_0xfb6f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb6f('0x4'));var db=require(_0xfb6f('0x5'))['db'];var utils=require(_0xfb6f('0x6'));var logger=require('../../config/logger')(_0xfb6f('0x7'));var config=require(_0xfb6f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb6f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4172,_0x3de2f9,_0x35636c){return new BPromise(function(_0x54cebf,_0x2123fe){return client[_0xfb6f('0xa')](_0x2b4172,_0x35636c)['then'](function(_0x7bb352){logger[_0xfb6f('0xb')](_0xfb6f('0xc'),_0x3de2f9,'request\x20sent');logger[_0xfb6f('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3de2f9,_0xfb6f('0xe'),JSON['stringify'](_0x7bb352));if(_0x7bb352[_0xfb6f('0xf')]){if(_0x7bb352[_0xfb6f('0xf')][_0xfb6f('0x10')]===0x1f4){logger[_0xfb6f('0xf')](_0xfb6f('0xc'),_0x3de2f9,_0x7bb352[_0xfb6f('0xf')][_0xfb6f('0x11')]);return _0x2123fe(_0x7bb352[_0xfb6f('0xf')][_0xfb6f('0x11')]);}logger[_0xfb6f('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x3de2f9,_0x7bb352[_0xfb6f('0xf')]['message']);return _0x54cebf(_0x7bb352['error'][_0xfb6f('0x11')]);}else{logger['info'](_0xfb6f('0xc'),_0x3de2f9,'request\x20sent');_0x54cebf(_0x7bb352[_0xfb6f('0x12')]['message']);}})[_0xfb6f('0x13')](function(_0x2b1eec){logger[_0xfb6f('0xf')](_0xfb6f('0xc'),_0x3de2f9,_0x2b1eec);_0x2123fe(_0x2b1eec);});});} \ No newline at end of file +var _0xb1a4=['result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x57bc95,_0x417bf6){var _0x16fc06=function(_0x24cace){while(--_0x24cace){_0x57bc95['push'](_0x57bc95['shift']());}};_0x16fc06(++_0x417bf6);}(_0xb1a4,0x16a));var _0x4b1a=function(_0x4e68b4,_0x1e2cae){_0x4e68b4=_0x4e68b4-0x0;var _0x1c62d6=_0xb1a4[_0x4e68b4];return _0x1c62d6;};'use strict';var _=require(_0x4b1a('0x0'));var util=require(_0x4b1a('0x1'));var moment=require(_0x4b1a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b1a('0x3'))['db'];var utils=require(_0x4b1a('0x4'));var logger=require('../../config/logger')(_0x4b1a('0x5'));var config=require('../../config/environment');var jayson=require(_0x4b1a('0x6'));var client=jayson[_0x4b1a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14411d,_0x469d47,_0x312e2f){return new BPromise(function(_0x371066,_0x1547d9){return client[_0x4b1a('0x8')](_0x14411d,_0x312e2f)['then'](function(_0x36f9ba){logger[_0x4b1a('0x9')](_0x4b1a('0xa'),_0x469d47,'request\x20sent');logger['debug'](_0x4b1a('0xb'),_0x469d47,'request\x20sent',JSON[_0x4b1a('0xc')](_0x36f9ba));if(_0x36f9ba[_0x4b1a('0xd')]){if(_0x36f9ba[_0x4b1a('0xd')]['code']===0x1f4){logger[_0x4b1a('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x469d47,_0x36f9ba['error']['message']);return _0x1547d9(_0x36f9ba['error']['message']);}logger[_0x4b1a('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x469d47,_0x36f9ba[_0x4b1a('0xd')][_0x4b1a('0xe')]);return _0x371066(_0x36f9ba['error']['message']);}else{logger['info'](_0x4b1a('0xa'),_0x469d47,_0x4b1a('0xf'));_0x371066(_0x36f9ba[_0x4b1a('0x10')][_0x4b1a('0xe')]);}})[_0x4b1a('0x11')](function(_0x5ce93b){logger['error'](_0x4b1a('0xa'),_0x469d47,_0x5ce93b);_0x1547d9(_0x5ce93b);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index d51f0c9..ebe4f92 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 _0x659c=['/:id','post','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','index'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0x659c,0x1aa));var _0xc659=function(_0x1ca66c,_0x3e3868){_0x1ca66c=_0x1ca66c-0x0;var _0x5a78ce=_0x659c[_0x1ca66c];return _0x5a78ce;};'use strict';var multer=require(_0xc659('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc659('0x1'));var express=require(_0xc659('0x2'));var router=express['Router']();var fs_extra=require(_0xc659('0x3'));var auth=require(_0xc659('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc659('0x5'));router[_0xc659('0x6')]('/',auth[_0xc659('0x7')](),controller[_0xc659('0x8')]);router[_0xc659('0x6')](_0xc659('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc659('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc659('0x9'),auth[_0xc659('0x7')](),controller[_0xc659('0xb')]);router[_0xc659('0xc')](_0xc659('0x9'),auth[_0xc659('0x7')](),controller[_0xc659('0xd')]);module[_0xc659('0xe')]=router; \ No newline at end of file +var _0x19cb=['put','update','destroy','exports','util','path','express','fs-extra','./intDeskField.controller','get','/:id','isAuthenticated','show','create'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x19cb,0x146));var _0xb19c=function(_0x5dcde1,_0x4e6063){_0x5dcde1=_0x5dcde1-0x0;var _0x2161e9=_0x19cb[_0x5dcde1];return _0x2161e9;};'use strict';var multer=require('multer');var util=require(_0xb19c('0x0'));var path=require(_0xb19c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb19c('0x2'));var router=express['Router']();var fs_extra=require(_0xb19c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb19c('0x4'));router[_0xb19c('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb19c('0x5')](_0xb19c('0x6'),auth[_0xb19c('0x7')](),controller[_0xb19c('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb19c('0x9')]);router[_0xb19c('0xa')](_0xb19c('0x6'),auth[_0xb19c('0x7')](),controller[_0xb19c('0xb')]);router['delete'](_0xb19c('0x6'),auth[_0xb19c('0x7')](),controller[_0xb19c('0xc')]);module[_0xb19c('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0285235..6409386 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 _0xaf42=['BOOLEAN','exports','ENUM','string','customVariable','STRING','variable'];(function(_0x20c3bb,_0x1aac34){var _0x2fccd0=function(_0x5d36a3){while(--_0x5d36a3){_0x20c3bb['push'](_0x20c3bb['shift']());}};_0x2fccd0(++_0x1aac34);}(_0xaf42,0xf6));var _0x2af4=function(_0x50aabb,_0x23bce3){_0x50aabb=_0x50aabb-0x0;var _0x183a6d=_0xaf42[_0x50aabb];return _0x183a6d;};'use strict';var Sequelize=require('sequelize');module[_0x2af4('0x0')]={'type':{'type':Sequelize[_0x2af4('0x1')](_0x2af4('0x2'),'variable',_0x2af4('0x3'),'keyValue','picklist'),'defaultValue':_0x2af4('0x2')},'content':{'type':Sequelize[_0x2af4('0x4')]},'key':{'type':Sequelize[_0x2af4('0x4')]},'keyType':{'type':Sequelize[_0x2af4('0x1')](_0x2af4('0x2'),_0x2af4('0x5'),_0x2af4('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2af4('0x4')]},'nameField':{'type':Sequelize[_0x2af4('0x4')]},'customField':{'type':Sequelize[_0x2af4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2af4('0x4')]}}; \ No newline at end of file +var _0x52b2=['string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports'];(function(_0x3307d3,_0x4f68f5){var _0x164a8d=function(_0x6c1c5f){while(--_0x6c1c5f){_0x3307d3['push'](_0x3307d3['shift']());}};_0x164a8d(++_0x4f68f5);}(_0x52b2,0x196));var _0x252b=function(_0x4842e9,_0xb6ae05){_0x4842e9=_0x4842e9-0x0;var _0x546a5a=_0x52b2[_0x4842e9];return _0x546a5a;};'use strict';var Sequelize=require(_0x252b('0x0'));module[_0x252b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x252b('0x2'),_0x252b('0x3'),'customVariable',_0x252b('0x4'),_0x252b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x252b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x252b('0x2'),'variable',_0x252b('0x7'))},'keyContent':{'type':Sequelize[_0x252b('0x6')]},'idField':{'type':Sequelize[_0x252b('0x6')]},'nameField':{'type':Sequelize[_0x252b('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x252b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 77676f7..75072a4 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 _0xeff8=['findAll','rows','catch','show','params','length','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0xeff8,0x186));var _0x8eff=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xeff8[_0x9fd887];return _0x1a54ab;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x18')](_0x45f280);}return _0x4a399e[_0x8eff('0x19')](_0x45f280)[_0x8eff('0x1a')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x19')](_0x3e7c01)[_0x8eff('0x1b')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=typeof _0x4cfc91[_0x8eff('0x1c')]===_0x8eff('0x1d')&&typeof _0x4cfc91[_0x8eff('0x1e')]==='undefined';var _0x32b791=_0x16202e[_0x8eff('0x1f')];var _0x3cd1dc=_0xdbb753?0x0:_0x4cfc91[_0x8eff('0x1c')];var _0x2cd7c5=_0xdbb753?_0x16202e[_0x8eff('0x1f')]:_0x4cfc91[_0x8eff('0x1c')]+_0x4cfc91[_0x8eff('0x1e')];var _0x1b003c;if(_0x2cd7c5>=_0x32b791){_0x2cd7c5=_0x32b791;_0x1b003c=0xc8;}else{_0x1b003c=0xce;}_0x228eb1[_0x8eff('0x19')](_0x1b003c);return _0x228eb1[_0x8eff('0x20')](_0x8eff('0x21'),_0x3cd1dc+'-'+_0x2cd7c5+'/'+_0x32b791)[_0x8eff('0x1b')](_0x16202e);}return null;};}function patchUpdates(_0x2a7337){return function(_0xdbb7b5){try{jsonpatch[_0x8eff('0x22')](_0xdbb7b5,_0x2a7337,!![]);}catch(_0x5e157c){return BPromise[_0x8eff('0x23')](_0x5e157c);}return _0xdbb7b5[_0x8eff('0x24')]();};}function saveUpdates(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x25')](_0x5a2492)[_0x8eff('0x26')](function(_0x1ccc79){return _0x1ccc79;});}return null;};}function removeEntity(_0x59cc32,_0x1ee09c){return function(_0x4e891c){if(_0x4e891c){return _0x4e891c[_0x8eff('0x27')]()[_0x8eff('0x26')](function(){_0x59cc32['status'](0xcc)[_0x8eff('0x1a')]();});}};}function handleEntityNotFound(_0x5ec3d7,_0x40404b){return function(_0x3b698b){if(!_0x3b698b){_0x5ec3d7[_0x8eff('0x18')](0x194);}return _0x3b698b;};}function handleError(_0x41324b,_0x6359df){_0x6359df=_0x6359df||0x1f4;return function(_0x2e8067){logger['error'](_0x2e8067[_0x8eff('0x28')]);if(_0x2e8067[_0x8eff('0x29')]){delete _0x2e8067[_0x8eff('0x29')];}_0x41324b[_0x8eff('0x19')](_0x6359df)[_0x8eff('0x2a')](_0x2e8067);};}exports[_0x8eff('0x2b')]=function(_0x4cc146,_0x4ed3b8){var _0x44dcdb={},_0x472b19={},_0x17ff3f={'count':0x0,'rows':[]};var _0x5ce071=_[_0x8eff('0x2c')](db[_0x8eff('0x2d')][_0x8eff('0x2e')],function(_0x1da0fa){return{'name':_0x1da0fa[_0x8eff('0x2f')],'type':_0x1da0fa[_0x8eff('0x30')][_0x8eff('0x31')]};});_0x472b19[_0x8eff('0x32')]=_[_0x8eff('0x2c')](_0x5ce071,_0x8eff('0x29'));_0x472b19[_0x8eff('0x33')]=_[_0x8eff('0x34')](_0x4cc146['query']);_0x472b19[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],_0x472b19[_0x8eff('0x33')]);_0x44dcdb['attributes']=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],qs['fields'](_0x4cc146['query'][_0x8eff('0x37')]));_0x44dcdb[_0x8eff('0x38')]=_0x44dcdb['attributes']['length']?_0x44dcdb['attributes']:_0x472b19[_0x8eff('0x32')];if(!_0x4cc146['query'][_0x8eff('0x39')]('nolimit')){_0x44dcdb[_0x8eff('0x1e')]=qs[_0x8eff('0x1e')](_0x4cc146[_0x8eff('0x33')][_0x8eff('0x1e')]);_0x44dcdb[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x4cc146['query'][_0x8eff('0x1c')]);}_0x44dcdb['order']=qs[_0x8eff('0x3a')](_0x4cc146['query'][_0x8eff('0x3a')]);_0x44dcdb[_0x8eff('0x3b')]=qs[_0x8eff('0x35')](_[_0x8eff('0x3c')](_0x4cc146['query'],_0x472b19[_0x8eff('0x35')]),_0x5ce071);if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x3d')]){_0x44dcdb['where']=_[_0x8eff('0x3e')](_0x44dcdb[_0x8eff('0x3b')],{'$or':_[_0x8eff('0x2c')](_0x5ce071,function(_0x345bc7){if(_0x345bc7[_0x8eff('0x30')]!==_0x8eff('0x3f')){var _0x29f68e={};_0x29f68e[_0x345bc7[_0x8eff('0x29')]]={'$like':'%'+_0x4cc146[_0x8eff('0x33')]['filter']+'%'};return _0x29f68e;}})});}_0x44dcdb=_['merge']({},_0x44dcdb,_0x4cc146[_0x8eff('0x40')]);var _0x114f8e={'where':_0x44dcdb[_0x8eff('0x3b')]};return db[_0x8eff('0x2d')][_0x8eff('0x1f')](_0x114f8e)[_0x8eff('0x26')](function(_0x18b132){_0x17ff3f['count']=_0x18b132;if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x41')]){_0x44dcdb['include']=[{'all':!![]}];}return db[_0x8eff('0x2d')][_0x8eff('0x42')](_0x44dcdb);})[_0x8eff('0x26')](function(_0x18309b){_0x17ff3f[_0x8eff('0x43')]=_0x18309b;return _0x17ff3f;})[_0x8eff('0x26')](respondWithFilteredResult(_0x4ed3b8,_0x44dcdb))[_0x8eff('0x44')](handleError(_0x4ed3b8,null));};exports[_0x8eff('0x45')]=function(_0x6d0568,_0x480c4c){var _0x37f376={'raw':!![],'where':{'id':_0x6d0568[_0x8eff('0x46')]['id']}},_0x27a8c9={};_0x27a8c9[_0x8eff('0x32')]=_[_0x8eff('0x34')](db['DeskField'][_0x8eff('0x2e')]);_0x27a8c9['query']=_[_0x8eff('0x34')](_0x6d0568[_0x8eff('0x33')]);_0x27a8c9[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x27a8c9['model'],_0x27a8c9[_0x8eff('0x33')]);_0x37f376[_0x8eff('0x38')]=_[_0x8eff('0x36')](_0x27a8c9['model'],qs['fields'](_0x6d0568[_0x8eff('0x33')][_0x8eff('0x37')]));_0x37f376[_0x8eff('0x38')]=_0x37f376[_0x8eff('0x38')][_0x8eff('0x47')]?_0x37f376['attributes']:_0x27a8c9[_0x8eff('0x32')];if(_0x6d0568['query'][_0x8eff('0x41')]){_0x37f376[_0x8eff('0x48')]=[{'all':!![]}];}_0x37f376=_['merge']({},_0x37f376,_0x6d0568['options']);return db['DeskField']['find'](_0x37f376)['then'](handleEntityNotFound(_0x480c4c,null))['then'](respondWithResult(_0x480c4c,null))[_0x8eff('0x44')](handleError(_0x480c4c,null));};exports[_0x8eff('0x49')]=function(_0x33aa8d,_0x1b5fda){return db[_0x8eff('0x2d')][_0x8eff('0x49')](_0x33aa8d[_0x8eff('0x4a')],{})[_0x8eff('0x26')](respondWithResult(_0x1b5fda,0xc9))[_0x8eff('0x44')](handleError(_0x1b5fda,null));};exports[_0x8eff('0x25')]=function(_0x4c7013,_0x11e53c){if(_0x4c7013['body']['id']){delete _0x4c7013[_0x8eff('0x4a')]['id'];}return db[_0x8eff('0x2d')][_0x8eff('0x4b')]({'where':{'id':_0x4c7013[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x11e53c,null))[_0x8eff('0x26')](saveUpdates(_0x4c7013[_0x8eff('0x4a')],null))[_0x8eff('0x26')](respondWithResult(_0x11e53c,null))[_0x8eff('0x44')](handleError(_0x11e53c,null));};exports[_0x8eff('0x27')]=function(_0x2a4dbb,_0x452f7a){return db['DeskField'][_0x8eff('0x4b')]({'where':{'id':_0x2a4dbb[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x452f7a,null))[_0x8eff('0x26')](removeEntity(_0x452f7a,null))[_0x8eff('0x44')](handleError(_0x452f7a,null));}; \ No newline at end of file +var _0xf603=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','find','catch','body'];(function(_0x521c76,_0x469461){var _0x225012=function(_0x143dd4){while(--_0x143dd4){_0x521c76['push'](_0x521c76['shift']());}};_0x225012(++_0x469461);}(_0xf603,0x124));var _0x3f60=function(_0x1864f8,_0x2b03bb){_0x1864f8=_0x1864f8-0x0;var _0x49f630=_0xf603[_0x1864f8];return _0x49f630;};'use strict';var emlformat=require(_0x3f60('0x0'));var rimraf=require(_0x3f60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f60('0x2'));var rp=require(_0x3f60('0x3'));var moment=require(_0x3f60('0x4'));var BPromise=require(_0x3f60('0x5'));var Mustache=require(_0x3f60('0x6'));var util=require(_0x3f60('0x7'));var path=require(_0x3f60('0x8'));var sox=require(_0x3f60('0x9'));var csv=require(_0x3f60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f60('0xb'));var crypto=require(_0x3f60('0xc'));var jsforce=require(_0x3f60('0xd'));var deskjs=require(_0x3f60('0xe'));var toCsv=require(_0x3f60('0xa'));var querystring=require(_0x3f60('0xf'));var Papa=require(_0x3f60('0x10'));var Redis=require(_0x3f60('0x11'));var authService=require(_0x3f60('0x12'));var qs=require(_0x3f60('0x13'));var as=require(_0x3f60('0x14'));var hardwareService=require(_0x3f60('0x15'));var logger=require(_0x3f60('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f60('0x17'));var db=require(_0x3f60('0x18'))['db'];function respondWithStatusCode(_0x2e79e8,_0x58e120){_0x58e120=_0x58e120||0xcc;return function(_0xeb6151){if(_0xeb6151){return _0x2e79e8[_0x3f60('0x19')](_0x58e120);}return _0x2e79e8['status'](_0x58e120)[_0x3f60('0x1a')]();};}function respondWithResult(_0x1b3e74,_0x53ec7a){_0x53ec7a=_0x53ec7a||0xc8;return function(_0x1ec7f4){if(_0x1ec7f4){return _0x1b3e74['status'](_0x53ec7a)[_0x3f60('0x1b')](_0x1ec7f4);}};}function respondWithFilteredResult(_0x2cd28f,_0x5e7718){return function(_0x3c0e9d){if(_0x3c0e9d){var _0x4e84b5=typeof _0x5e7718[_0x3f60('0x1c')]==='undefined'&&typeof _0x5e7718[_0x3f60('0x1d')]===_0x3f60('0x1e');var _0xbc26c=_0x3c0e9d[_0x3f60('0x1f')];var _0x3ae771=_0x4e84b5?0x0:_0x5e7718[_0x3f60('0x1c')];var _0x52aa44=_0x4e84b5?_0x3c0e9d[_0x3f60('0x1f')]:_0x5e7718[_0x3f60('0x1c')]+_0x5e7718[_0x3f60('0x1d')];var _0x9c845f;if(_0x52aa44>=_0xbc26c){_0x52aa44=_0xbc26c;_0x9c845f=0xc8;}else{_0x9c845f=0xce;}_0x2cd28f[_0x3f60('0x20')](_0x9c845f);return _0x2cd28f[_0x3f60('0x21')]('Content-Range',_0x3ae771+'-'+_0x52aa44+'/'+_0xbc26c)[_0x3f60('0x1b')](_0x3c0e9d);}return null;};}function patchUpdates(_0x2f1735){return function(_0x4dace9){try{jsonpatch[_0x3f60('0x22')](_0x4dace9,_0x2f1735,!![]);}catch(_0x2dba08){return BPromise[_0x3f60('0x23')](_0x2dba08);}return _0x4dace9[_0x3f60('0x24')]();};}function saveUpdates(_0x1d23bb,_0x1b161e){return function(_0x44b665){if(_0x44b665){return _0x44b665[_0x3f60('0x25')](_0x1d23bb)[_0x3f60('0x26')](function(_0x31847d){return _0x31847d;});}return null;};}function removeEntity(_0x3f6fa7,_0x35b8f6){return function(_0x1f9390){if(_0x1f9390){return _0x1f9390[_0x3f60('0x27')]()[_0x3f60('0x26')](function(){_0x3f6fa7['status'](0xcc)[_0x3f60('0x1a')]();});}};}function handleEntityNotFound(_0x3cdef4,_0x15315b){return function(_0x4581d6){if(!_0x4581d6){_0x3cdef4[_0x3f60('0x19')](0x194);}return _0x4581d6;};}function handleError(_0x36dfdb,_0xc106a9){_0xc106a9=_0xc106a9||0x1f4;return function(_0x23e265){logger['error'](_0x23e265[_0x3f60('0x28')]);if(_0x23e265[_0x3f60('0x29')]){delete _0x23e265[_0x3f60('0x29')];}_0x36dfdb[_0x3f60('0x20')](_0xc106a9)[_0x3f60('0x2a')](_0x23e265);};}exports[_0x3f60('0x2b')]=function(_0x39e14c,_0x4520a5){var _0x16b590={},_0x3cd0a7={},_0x2f1bc9={'count':0x0,'rows':[]};var _0x457e5b=_[_0x3f60('0x2c')](db[_0x3f60('0x2d')][_0x3f60('0x2e')],function(_0x14d83c){return{'name':_0x14d83c[_0x3f60('0x2f')],'type':_0x14d83c[_0x3f60('0x30')][_0x3f60('0x31')]};});_0x3cd0a7[_0x3f60('0x32')]=_[_0x3f60('0x2c')](_0x457e5b,_0x3f60('0x29'));_0x3cd0a7[_0x3f60('0x33')]=_[_0x3f60('0x34')](_0x39e14c[_0x3f60('0x33')]);_0x3cd0a7[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x3cd0a7[_0x3f60('0x32')],_0x3cd0a7[_0x3f60('0x33')]);_0x16b590[_0x3f60('0x37')]=_[_0x3f60('0x36')](_0x3cd0a7['model'],qs[_0x3f60('0x38')](_0x39e14c[_0x3f60('0x33')]['fields']));_0x16b590[_0x3f60('0x37')]=_0x16b590[_0x3f60('0x37')][_0x3f60('0x39')]?_0x16b590[_0x3f60('0x37')]:_0x3cd0a7['model'];if(!_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3a')]('nolimit')){_0x16b590['limit']=qs[_0x3f60('0x1d')](_0x39e14c['query'][_0x3f60('0x1d')]);_0x16b590[_0x3f60('0x1c')]=qs[_0x3f60('0x1c')](_0x39e14c[_0x3f60('0x33')]['offset']);}_0x16b590['order']=qs[_0x3f60('0x3b')](_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3b')]);_0x16b590[_0x3f60('0x3c')]=qs[_0x3f60('0x35')](_[_0x3f60('0x3d')](_0x39e14c['query'],_0x3cd0a7[_0x3f60('0x35')]),_0x457e5b);if(_0x39e14c['query'][_0x3f60('0x3e')]){_0x16b590['where']=_[_0x3f60('0x3f')](_0x16b590[_0x3f60('0x3c')],{'$or':_[_0x3f60('0x2c')](_0x457e5b,function(_0x466d05){if(_0x466d05[_0x3f60('0x30')]!=='VIRTUAL'){var _0x4fa98d={};_0x4fa98d[_0x466d05[_0x3f60('0x29')]]={'$like':'%'+_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3e')]+'%'};return _0x4fa98d;}})});}_0x16b590=_['merge']({},_0x16b590,_0x39e14c[_0x3f60('0x40')]);var _0x42f82d={'where':_0x16b590['where']};return db['DeskField'][_0x3f60('0x1f')](_0x42f82d)[_0x3f60('0x26')](function(_0x3f2129){_0x2f1bc9[_0x3f60('0x1f')]=_0x3f2129;if(_0x39e14c[_0x3f60('0x33')]['includeAll']){_0x16b590[_0x3f60('0x41')]=[{'all':!![]}];}return db[_0x3f60('0x2d')][_0x3f60('0x42')](_0x16b590);})[_0x3f60('0x26')](function(_0x4c6346){_0x2f1bc9[_0x3f60('0x43')]=_0x4c6346;return _0x2f1bc9;})['then'](respondWithFilteredResult(_0x4520a5,_0x16b590))['catch'](handleError(_0x4520a5,null));};exports[_0x3f60('0x44')]=function(_0x20422a,_0x4ef8f2){var _0x5cfc2f={'raw':!![],'where':{'id':_0x20422a[_0x3f60('0x45')]['id']}},_0x4f0752={};_0x4f0752[_0x3f60('0x32')]=_['keys'](db['DeskField']['rawAttributes']);_0x4f0752[_0x3f60('0x33')]=_['keys'](_0x20422a['query']);_0x4f0752[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x4f0752['model'],_0x4f0752['query']);_0x5cfc2f[_0x3f60('0x37')]=_['intersection'](_0x4f0752[_0x3f60('0x32')],qs['fields'](_0x20422a[_0x3f60('0x33')][_0x3f60('0x38')]));_0x5cfc2f[_0x3f60('0x37')]=_0x5cfc2f[_0x3f60('0x37')][_0x3f60('0x39')]?_0x5cfc2f['attributes']:_0x4f0752[_0x3f60('0x32')];if(_0x20422a[_0x3f60('0x33')]['includeAll']){_0x5cfc2f['include']=[{'all':!![]}];}_0x5cfc2f=_[_0x3f60('0x3f')]({},_0x5cfc2f,_0x20422a[_0x3f60('0x40')]);return db[_0x3f60('0x2d')][_0x3f60('0x46')](_0x5cfc2f)[_0x3f60('0x26')](handleEntityNotFound(_0x4ef8f2,null))['then'](respondWithResult(_0x4ef8f2,null))[_0x3f60('0x47')](handleError(_0x4ef8f2,null));};exports['create']=function(_0xe5a2a6,_0x253d2f){return db[_0x3f60('0x2d')]['create'](_0xe5a2a6[_0x3f60('0x48')],{})[_0x3f60('0x26')](respondWithResult(_0x253d2f,0xc9))[_0x3f60('0x47')](handleError(_0x253d2f,null));};exports['update']=function(_0x217348,_0x55f75f){if(_0x217348[_0x3f60('0x48')]['id']){delete _0x217348[_0x3f60('0x48')]['id'];}return db[_0x3f60('0x2d')][_0x3f60('0x46')]({'where':{'id':_0x217348['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55f75f,null))[_0x3f60('0x26')](saveUpdates(_0x217348['body'],null))[_0x3f60('0x26')](respondWithResult(_0x55f75f,null))['catch'](handleError(_0x55f75f,null));};exports['destroy']=function(_0x4ce17d,_0x55dd97){return db['DeskField'][_0x3f60('0x46')]({'where':{'id':_0x4ce17d['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55dd97,null))[_0x3f60('0x26')](removeEntity(_0x55dd97,null))[_0x3f60('0x47')](handleError(_0x55dd97,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 4dca2fa..c5f57f6 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 _0xc477=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','idField','lodash','util'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xc477,0x1ed));var _0x7c47=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc477[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x7c47('0x0'));var util=require(_0x7c47('0x1'));var logger=require(_0x7c47('0x2'))(_0x7c47('0x3'));var moment=require(_0x7c47('0x4'));var BPromise=require(_0x7c47('0x5'));var rp=require(_0x7c47('0x6'));var fs=require('fs');var path=require(_0x7c47('0x7'));var rimraf=require(_0x7c47('0x8'));var config=require(_0x7c47('0x9'));var attributes=require(_0x7c47('0xa'));module[_0x7c47('0xb')]=function(_0x3dbb44,_0x17efe0){return _0x3dbb44[_0x7c47('0xc')](_0x7c47('0xd'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x7c47('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ca7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x15b1ff,_0x128656){var _0x27dd2e=function(_0x3e54b9){while(--_0x3e54b9){_0x15b1ff['push'](_0x15b1ff['shift']());}};_0x27dd2e(++_0x128656);}(_0x9ca7,0x1bd));var _0x79ca=function(_0x16fe0c,_0x1143b5){_0x16fe0c=_0x16fe0c-0x0;var _0x20c315=_0x9ca7[_0x16fe0c];return _0x20c315;};'use strict';var _=require('lodash');var util=require(_0x79ca('0x0'));var logger=require(_0x79ca('0x1'))(_0x79ca('0x2'));var moment=require(_0x79ca('0x3'));var BPromise=require(_0x79ca('0x4'));var rp=require(_0x79ca('0x5'));var fs=require('fs');var path=require(_0x79ca('0x6'));var rimraf=require(_0x79ca('0x7'));var config=require(_0x79ca('0x8'));var attributes=require('./intDeskField.attributes');module[_0x79ca('0x9')]=function(_0x52f17b,_0x313d23){return _0x52f17b[_0x79ca('0xa')](_0x79ca('0xb'),attributes,{'tableName':_0x79ca('0xc'),'paranoid':![],'indexes':[{'name':_0x79ca('0xd'),'fields':[_0x79ca('0xe'),_0x79ca('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 1e94365..f5251a0 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 _0xd959=['rpc','../../config/environment','request','then','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x498031,_0x4cb66a){var _0x4076ed=function(_0x2c0540){while(--_0x2c0540){_0x498031['push'](_0x498031['shift']());}};_0x4076ed(++_0x4cb66a);}(_0xd959,0x19d));var _0x9d95=function(_0x270315,_0x85d932){_0x270315=_0x270315-0x0;var _0x3cbe13=_0xd959[_0x270315];return _0x3cbe13;};'use strict';var _=require('lodash');var util=require(_0x9d95('0x0'));var moment=require(_0x9d95('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d95('0x2'));var fs=require('fs');var Redis=require(_0x9d95('0x3'));var db=require(_0x9d95('0x4'))['db'];var utils=require(_0x9d95('0x5'));var logger=require(_0x9d95('0x6'))(_0x9d95('0x7'));var config=require(_0x9d95('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f024b,_0x2f7a15,_0x16506e){return new BPromise(function(_0x2a2789,_0x3b0c45){return client[_0x9d95('0x9')](_0x2f024b,_0x16506e)[_0x9d95('0xa')](function(_0x36e226){logger[_0x9d95('0xb')](_0x9d95('0xc'),_0x2f7a15,'request\x20sent');logger[_0x9d95('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2f7a15,_0x9d95('0xe'),JSON[_0x9d95('0xf')](_0x36e226));if(_0x36e226[_0x9d95('0x10')]){if(_0x36e226[_0x9d95('0x10')][_0x9d95('0x11')]===0x1f4){logger[_0x9d95('0x10')]('DeskField,\x20%s,\x20%s',_0x2f7a15,_0x36e226[_0x9d95('0x10')][_0x9d95('0x12')]);return _0x3b0c45(_0x36e226['error'][_0x9d95('0x12')]);}logger[_0x9d95('0x10')]('DeskField,\x20%s,\x20%s',_0x2f7a15,_0x36e226[_0x9d95('0x10')][_0x9d95('0x12')]);return _0x2a2789(_0x36e226['error'][_0x9d95('0x12')]);}else{logger[_0x9d95('0xb')]('DeskField,\x20%s,\x20%s',_0x2f7a15,_0x9d95('0xe'));_0x2a2789(_0x36e226[_0x9d95('0x13')]['message']);}})[_0x9d95('0x14')](function(_0x36a45f){logger[_0x9d95('0x10')](_0x9d95('0xc'),_0x2f7a15,_0x36a45f);_0x3b0c45(_0x36a45f);});});} \ No newline at end of file +var _0x565c=['DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x8bf2e3,_0x32b29d){var _0x5e7352=function(_0x4a6733){while(--_0x4a6733){_0x8bf2e3['push'](_0x8bf2e3['shift']());}};_0x5e7352(++_0x32b29d);}(_0x565c,0x73));var _0xc565=function(_0x171108,_0x183b92){_0x171108=_0x171108-0x0;var _0x27e44d=_0x565c[_0x171108];return _0x27e44d;};'use strict';var _=require(_0xc565('0x0'));var util=require(_0xc565('0x1'));var moment=require(_0xc565('0x2'));var BPromise=require(_0xc565('0x3'));var rs=require(_0xc565('0x4'));var fs=require('fs');var Redis=require(_0xc565('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc565('0x6'));var config=require(_0xc565('0x7'));var jayson=require(_0xc565('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x226477,_0x4959ff,_0x2d8278){return new BPromise(function(_0x228e36,_0x1c3147){return client[_0xc565('0x9')](_0x226477,_0x2d8278)[_0xc565('0xa')](function(_0x3841c7){logger['info'](_0xc565('0xb'),_0x4959ff,_0xc565('0xc'));logger['debug'](_0xc565('0xd'),_0x4959ff,_0xc565('0xc'),JSON[_0xc565('0xe')](_0x3841c7));if(_0x3841c7[_0xc565('0xf')]){if(_0x3841c7[_0xc565('0xf')][_0xc565('0x10')]===0x1f4){logger[_0xc565('0xf')](_0xc565('0xb'),_0x4959ff,_0x3841c7[_0xc565('0xf')]['message']);return _0x1c3147(_0x3841c7['error']['message']);}logger['error'](_0xc565('0xb'),_0x4959ff,_0x3841c7[_0xc565('0xf')]['message']);return _0x228e36(_0x3841c7[_0xc565('0xf')][_0xc565('0x11')]);}else{logger[_0xc565('0x12')](_0xc565('0xb'),_0x4959ff,_0xc565('0xc'));_0x228e36(_0x3841c7[_0xc565('0x13')][_0xc565('0x11')]);}})[_0xc565('0x14')](function(_0x2818bd){logger[_0xc565('0xf')](_0xc565('0xb'),_0x4959ff,_0x2818bd);_0x1c3147(_0x2818bd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 6c1514d..e81ff2c 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 _0x29ee=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','put','update','destroy','exports','multer','connect-timeout'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0x29ee,0x1e1));var _0xe29e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x29ee[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0xe29e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe29e('0x1'));var express=require(_0xe29e('0x2'));var router=express[_0xe29e('0x3')]();var fs_extra=require(_0xe29e('0x4'));var auth=require(_0xe29e('0x5'));var interaction=require(_0xe29e('0x6'));var config=require(_0xe29e('0x7'));var controller=require(_0xe29e('0x8'));router[_0xe29e('0x9')]('/',auth[_0xe29e('0xa')](),controller[_0xe29e('0xb')]);router['get'](_0xe29e('0xc'),auth[_0xe29e('0xa')](),controller[_0xe29e('0xd')]);router[_0xe29e('0x9')](_0xe29e('0xe'),auth[_0xe29e('0xa')](),controller['getConfigurations']);router[_0xe29e('0x9')](_0xe29e('0xf'),auth[_0xe29e('0xa')](),controller[_0xe29e('0x10')]);router['post']('/',auth[_0xe29e('0xa')](),controller[_0xe29e('0x11')]);router[_0xe29e('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe29e('0x13')](_0xe29e('0xc'),auth['isAuthenticated'](),controller[_0xe29e('0x14')]);router['delete']('/:id',auth[_0xe29e('0xa')](),controller[_0xe29e('0x15')]);module[_0xe29e('0x16')]=router; \ No newline at end of file +var _0x40be=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','post','/:id/configurations','addConfiguration','put','delete'];(function(_0x205330,_0x255a0d){var _0x2e671e=function(_0xaa4647){while(--_0xaa4647){_0x205330['push'](_0x205330['shift']());}};_0x2e671e(++_0x255a0d);}(_0x40be,0xe8));var _0xe40b=function(_0x14da25,_0x106d33){_0x14da25=_0x14da25-0x0;var _0x3f53c0=_0x40be[_0x14da25];return _0x3f53c0;};'use strict';var multer=require(_0xe40b('0x0'));var util=require(_0xe40b('0x1'));var path=require(_0xe40b('0x2'));var timeout=require(_0xe40b('0x3'));var express=require(_0xe40b('0x4'));var router=express[_0xe40b('0x5')]();var fs_extra=require(_0xe40b('0x6'));var auth=require(_0xe40b('0x7'));var interaction=require(_0xe40b('0x8'));var config=require(_0xe40b('0x9'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xe40b('0xa')](),controller[_0xe40b('0xb')]);router[_0xe40b('0xc')](_0xe40b('0xd'),auth['isAuthenticated'](),controller[_0xe40b('0xe')]);router[_0xe40b('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xe40b('0xc')](_0xe40b('0xf'),auth[_0xe40b('0xa')](),controller['getFields']);router[_0xe40b('0x10')]('/',auth[_0xe40b('0xa')](),controller['create']);router[_0xe40b('0x10')](_0xe40b('0x11'),auth[_0xe40b('0xa')](),controller[_0xe40b('0x12')]);router[_0xe40b('0x13')](_0xe40b('0xd'),auth[_0xe40b('0xa')](),controller['update']);router[_0xe40b('0x14')](_0xe40b('0xd'),auth['isAuthenticated'](),controller[_0xe40b('0x15')]);module[_0xe40b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f36782d..c5d1407 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 _0x9e8a=['STRING','sequelize','exports'];(function(_0x19c64a,_0x5de14e){var _0x1b1a06=function(_0x5dd104){while(--_0x5dd104){_0x19c64a['push'](_0x19c64a['shift']());}};_0x1b1a06(++_0x5de14e);}(_0x9e8a,0x112));var _0xa9e8=function(_0x5bbb1e,_0x353c6a){_0x5bbb1e=_0x5bbb1e-0x0;var _0x1a4081=_0x9e8a[_0x5bbb1e];return _0x1a4081;};'use strict';var Sequelize=require(_0xa9e8('0x0'));module[_0xa9e8('0x1')]={'name':{'type':Sequelize[_0xa9e8('0x2')]},'username':{'type':Sequelize[_0xa9e8('0x2')]},'password':{'type':Sequelize[_0xa9e8('0x2')]},'remoteUri':{'type':Sequelize[_0xa9e8('0x2')]},'tenantId':{'type':Sequelize[_0xa9e8('0x2')]},'clientId':{'type':Sequelize[_0xa9e8('0x2')]},'clientSecret':{'type':Sequelize[_0xa9e8('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa261=['STRING','BOOLEAN','sequelize'];(function(_0x5e7ba9,_0xeae2ee){var _0x1161a4=function(_0x1c9be6){while(--_0x1c9be6){_0x5e7ba9['push'](_0x5e7ba9['shift']());}};_0x1161a4(++_0xeae2ee);}(_0xa261,0x1a3));var _0x1a26=function(_0x3c10f9,_0x34eba2){_0x3c10f9=_0x3c10f9-0x0;var _0x2a44a7=_0xa261[_0x3c10f9];return _0x2a44a7;};'use strict';var Sequelize=require(_0x1a26('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a26('0x1')]},'username':{'type':Sequelize[_0x1a26('0x1')]},'password':{'type':Sequelize[_0x1a26('0x1')]},'remoteUri':{'type':Sequelize[_0x1a26('0x1')]},'tenantId':{'type':Sequelize[_0x1a26('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1a26('0x1')]},'modernAuthentication':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1e8e80c..68e8220 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 _0xd2ee=[')/Microsoft.Dynamics.CRM.','util','../../components/parsers/qs','../../components/integrations/configuration','json','offset','undefined','limit','count','set','update','then','error','stack','name','status','send','index','map','Dynamics365Account','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','GET','EntityDefinitions(','Attributes','includes','LogicalName','forEach','PicklistAttributeMetadata','push','MetadataId','@odata.type','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','Label','Value','DisplayName','TrueOption','UserLocalizedLabel','true','FalseOption','false'];(function(_0x405317,_0x328ab5){var _0x51429a=function(_0x4a0480){while(--_0x4a0480){_0x405317['push'](_0x405317['shift']());}};_0x51429a(++_0x328ab5);}(_0xd2ee,0x161));var _0xed2e=function(_0x3c6b77,_0x1d129d){_0x3c6b77=_0x3c6b77-0x0;var _0x336643=_0xd2ee[_0x3c6b77];return _0x336643;};'use strict';var rp=require('request-promise');var util=require(_0xed2e('0x0'));var _=require('lodash');var qs=require(_0xed2e('0x1'));var logger=require('../../config/logger')('api');var db=require('../../mysqldb')['db'];var integrations=require(_0xed2e('0x2'));function respondWithResult(_0x470ebf,_0x3ddb91){_0x3ddb91=_0x3ddb91||0xc8;return function(_0x1f883b){if(_0x1f883b){return _0x470ebf['status'](_0x3ddb91)[_0xed2e('0x3')](_0x1f883b);}};}function respondWithFilteredResult(_0x1971f9,_0x314c3d){return function(_0x500bb7){if(_0x500bb7){var _0x45b13e=typeof _0x314c3d[_0xed2e('0x4')]===_0xed2e('0x5')&&typeof _0x314c3d[_0xed2e('0x6')]===_0xed2e('0x5');var _0x1b71f6=_0x500bb7[_0xed2e('0x7')];var _0x5caee4=_0x45b13e?0x0:_0x314c3d[_0xed2e('0x4')];var _0x28ea89=_0x45b13e?_0x500bb7['count']:_0x314c3d['offset']+_0x314c3d[_0xed2e('0x6')];var _0x1d0d71;if(_0x28ea89>=_0x1b71f6){_0x28ea89=_0x1b71f6;_0x1d0d71=0xc8;}else{_0x1d0d71=0xce;}_0x1971f9['status'](_0x1d0d71);return _0x1971f9[_0xed2e('0x8')]('Content-Range',_0x5caee4+'-'+_0x28ea89+'/'+_0x1b71f6)[_0xed2e('0x3')](_0x500bb7);}return null;};}function saveUpdates(_0x372b70){return function(_0xc5d6a2){if(_0xc5d6a2){return _0xc5d6a2[_0xed2e('0x9')](_0x372b70)[_0xed2e('0xa')](function(_0xcb442a){return _0xcb442a;});}return null;};}function removeEntity(_0x2547f3){return function(_0x1238d9){if(_0x1238d9){return _0x1238d9['destroy']()[_0xed2e('0xa')](function(){_0x2547f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21abae){return function(_0x5bb416){if(!_0x5bb416){_0x21abae['sendStatus'](0x194);}return _0x5bb416;};}function handleError(_0x2db55a,_0x2cfa11){_0x2cfa11=_0x2cfa11||0x1f4;return function(_0x35a4c7){logger[_0xed2e('0xb')](_0x35a4c7[_0xed2e('0xc')]);if(_0x35a4c7[_0xed2e('0xd')]){delete _0x35a4c7[_0xed2e('0xd')];}_0x2db55a[_0xed2e('0xe')](_0x2cfa11)[_0xed2e('0xf')](_0x35a4c7);};}exports[_0xed2e('0x10')]=function(_0x5485ea,_0x5943a7){var _0x288a02={},_0x221437={},_0x467df2={'count':0x0,'rows':[]};var _0x2a79c8=_[_0xed2e('0x11')](db[_0xed2e('0x12')]['rawAttributes'],function(_0x55e9a1){return{'name':_0x55e9a1['fieldName'],'type':_0x55e9a1['type']['key']};});_0x221437[_0xed2e('0x13')]=_[_0xed2e('0x11')](_0x2a79c8,_0xed2e('0xd'));_0x221437[_0xed2e('0x14')]=_[_0xed2e('0x15')](_0x5485ea[_0xed2e('0x14')]);_0x221437[_0xed2e('0x16')]=_['intersection'](_0x221437[_0xed2e('0x13')],_0x221437[_0xed2e('0x14')]);_0x288a02[_0xed2e('0x17')]=_[_0xed2e('0x18')](_0x221437['model'],qs[_0xed2e('0x19')](_0x5485ea['query'][_0xed2e('0x19')]));_0x288a02[_0xed2e('0x17')]=_0x288a02['attributes'][_0xed2e('0x1a')]?_0x288a02[_0xed2e('0x17')]:_0x221437[_0xed2e('0x13')];if(!_0x5485ea[_0xed2e('0x14')][_0xed2e('0x1b')](_0xed2e('0x1c'))){_0x288a02[_0xed2e('0x6')]=qs[_0xed2e('0x6')](_0x5485ea[_0xed2e('0x14')][_0xed2e('0x6')]);_0x288a02[_0xed2e('0x4')]=qs['offset'](_0x5485ea[_0xed2e('0x14')][_0xed2e('0x4')]);}_0x288a02['order']=qs['sort'](_0x5485ea[_0xed2e('0x14')][_0xed2e('0x1d')]);_0x288a02[_0xed2e('0x1e')]=qs[_0xed2e('0x16')](_[_0xed2e('0x1f')](_0x5485ea[_0xed2e('0x14')],_0x221437[_0xed2e('0x16')]),_0x2a79c8);if(_0x5485ea[_0xed2e('0x14')][_0xed2e('0x20')]){_0x288a02[_0xed2e('0x1e')]=_[_0xed2e('0x21')](_0x288a02[_0xed2e('0x1e')],{'$or':_[_0xed2e('0x11')](_0x2a79c8,function(_0x416d8d){if(_0x416d8d['type']!==_0xed2e('0x22')){var _0x5af237={};_0x5af237[_0x416d8d[_0xed2e('0xd')]]={'$like':'%'+_0x5485ea['query'][_0xed2e('0x20')]+'%'};return _0x5af237;}})});}_0x288a02=_[_0xed2e('0x21')]({},_0x288a02,_0x5485ea[_0xed2e('0x23')]);var _0x550c54={'where':_0x288a02[_0xed2e('0x1e')]};return db['Dynamics365Account']['count'](_0x550c54)[_0xed2e('0xa')](function(_0x4a90aa){_0x467df2['count']=_0x4a90aa;if(_0x5485ea[_0xed2e('0x14')][_0xed2e('0x24')]){_0x288a02[_0xed2e('0x25')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x288a02);})[_0xed2e('0xa')](function(_0x3753){_0x467df2[_0xed2e('0x26')]=_0x3753;return _0x467df2;})['then'](respondWithFilteredResult(_0x5943a7,_0x288a02))[_0xed2e('0x27')](handleError(_0x5943a7,null));};exports['show']=function(_0x321f53,_0x1d1583){var _0x232640={'raw':![],'where':{'id':_0x321f53[_0xed2e('0x28')]['id']}},_0x5bcf29={};_0x5bcf29[_0xed2e('0x13')]=_[_0xed2e('0x15')](db['Dynamics365Account'][_0xed2e('0x29')]);_0x5bcf29[_0xed2e('0x14')]=_['keys'](_0x321f53[_0xed2e('0x14')]);_0x5bcf29[_0xed2e('0x16')]=_['intersection'](_0x5bcf29[_0xed2e('0x13')],_0x5bcf29[_0xed2e('0x14')]);_0x232640[_0xed2e('0x17')]=_[_0xed2e('0x18')](_0x5bcf29[_0xed2e('0x13')],qs[_0xed2e('0x19')](_0x321f53[_0xed2e('0x14')]['fields']));_0x232640[_0xed2e('0x17')]=_0x232640[_0xed2e('0x17')][_0xed2e('0x1a')]?_0x232640[_0xed2e('0x17')]:_0x5bcf29[_0xed2e('0x13')];if(_0x321f53[_0xed2e('0x14')][_0xed2e('0x24')]){_0x232640[_0xed2e('0x25')]=[{'all':!![]}];}_0x232640=_[_0xed2e('0x21')]({},_0x232640,_0x321f53[_0xed2e('0x23')]);return db['Dynamics365Account'][_0xed2e('0x2a')](_0x232640)[_0xed2e('0xa')](handleEntityNotFound(_0x1d1583,null))[_0xed2e('0xa')](respondWithResult(_0x1d1583,null))[_0xed2e('0x27')](handleError(_0x1d1583,null));};exports['create']=function(_0x2e2c0b,_0x4c7e93){return db['Dynamics365Account'][_0xed2e('0x2b')](_0x2e2c0b[_0xed2e('0x2c')],{})[_0xed2e('0xa')](respondWithResult(_0x4c7e93,0xc9))[_0xed2e('0x27')](handleError(_0x4c7e93,null));};exports[_0xed2e('0x9')]=function(_0xfbe802,_0x3cfc8f){if(_0xfbe802[_0xed2e('0x2c')]['id']){delete _0xfbe802['body']['id'];}return db[_0xed2e('0x12')][_0xed2e('0x2a')]({'where':{'id':_0xfbe802[_0xed2e('0x28')]['id']}})[_0xed2e('0xa')](handleEntityNotFound(_0x3cfc8f,null))[_0xed2e('0xa')](saveUpdates(_0xfbe802[_0xed2e('0x2c')],null))[_0xed2e('0xa')](respondWithResult(_0x3cfc8f,null))[_0xed2e('0x27')](handleError(_0x3cfc8f,null));};exports[_0xed2e('0x2d')]=function(_0x2308c5,_0x580426){return db[_0xed2e('0x12')][_0xed2e('0x2a')]({'where':{'id':_0x2308c5[_0xed2e('0x28')]['id']}})[_0xed2e('0xa')](handleEntityNotFound(_0x580426,null))['then'](removeEntity(_0x580426,null))['catch'](handleError(_0x580426,null));};exports[_0xed2e('0x2e')]=function(_0x1cba34,_0x26aa6e){var _0x15bab0={};var _0x170343={};var _0x284c08;var _0xdc556b;return db[_0xed2e('0x12')][_0xed2e('0x2f')]({'where':{'id':_0x1cba34['params']['id']}})[_0xed2e('0xa')](handleEntityNotFound(_0x26aa6e,null))['then'](function(_0x16e9ca){if(_0x16e9ca){_0x284c08=_0x16e9ca;_0x170343[_0xed2e('0x13')]=_[_0xed2e('0x15')](db[_0xed2e('0x30')][_0xed2e('0x29')]);_0x170343[_0xed2e('0x14')]=_[_0xed2e('0x15')](_0x1cba34[_0xed2e('0x14')]);_0x170343[_0xed2e('0x16')]=_[_0xed2e('0x18')](_0x170343['model'],_0x170343[_0xed2e('0x14')]);_0x15bab0[_0xed2e('0x17')]=_['intersection'](_0x170343[_0xed2e('0x13')],qs['fields'](_0x1cba34[_0xed2e('0x14')][_0xed2e('0x19')]));_0x15bab0[_0xed2e('0x17')]=_0x15bab0['attributes']['length']?_0x15bab0[_0xed2e('0x17')]:_0x170343[_0xed2e('0x13')];_0x15bab0['order']=qs[_0xed2e('0x1d')](_0x1cba34['query'][_0xed2e('0x1d')]);_0x15bab0['where']=qs[_0xed2e('0x16')](_[_0xed2e('0x1f')](_0x1cba34[_0xed2e('0x14')],_0x170343[_0xed2e('0x16')]));if(_0x1cba34[_0xed2e('0x14')][_0xed2e('0x20')]){_0x15bab0['where']=_[_0xed2e('0x21')](_0x15bab0[_0xed2e('0x1e')],{'$or':_[_0xed2e('0x11')](_0x15bab0[_0xed2e('0x17')],function(_0x1fa550){var _0x193e92={};_0x193e92[_0x1fa550]={'$like':'%'+_0x1cba34[_0xed2e('0x14')][_0xed2e('0x20')]+'%'};return _0x193e92;})});}_0x15bab0=_[_0xed2e('0x21')]({},_0x15bab0,_0x1cba34['options']);return _0x284c08[_0xed2e('0x2e')](_0x15bab0);}})[_0xed2e('0xa')](function(_0x3d239b){if(_0x3d239b){_0xdc556b=_0x3d239b[_0xed2e('0x1a')];if(!_0x1cba34['query']['hasOwnProperty'](_0xed2e('0x1c'))){_0x15bab0[_0xed2e('0x6')]=qs[_0xed2e('0x6')](_0x1cba34[_0xed2e('0x14')][_0xed2e('0x6')]);_0x15bab0[_0xed2e('0x4')]=qs[_0xed2e('0x4')](_0x1cba34[_0xed2e('0x14')][_0xed2e('0x4')]);}return _0x284c08[_0xed2e('0x2e')](_0x15bab0);}})[_0xed2e('0xa')](function(_0x4d1ed3){if(_0x4d1ed3){return _0x4d1ed3?{'count':_0xdc556b,'rows':_0x4d1ed3}:null;}})[_0xed2e('0xa')](respondWithResult(_0x26aa6e,null))[_0xed2e('0x27')](handleError(_0x26aa6e,null));};exports['addConfiguration']=function(_0x5711a5,_0x516c9e){if(_0x5711a5[_0xed2e('0x2c')]['id']){delete _0x5711a5[_0xed2e('0x2c')]['id'];}return db[_0xed2e('0x12')]['findOne']({'where':{'id':_0x5711a5[_0xed2e('0x28')]['id']}})[_0xed2e('0xa')](handleEntityNotFound(_0x516c9e,null))[_0xed2e('0xa')](function(_0xda46d3){if(_0xda46d3){_0x5711a5['body'][_0xed2e('0x31')]=_0xda46d3['id'];_0x5711a5[_0xed2e('0x2c')][_0xed2e('0x32')]=integrations[_0xed2e('0x33')](_0x5711a5[_0xed2e('0x2c')][_0xed2e('0x34')],_0x5711a5['body'][_0xed2e('0x35')]);_0x5711a5[_0xed2e('0x2c')][_0xed2e('0x36')]=integrations[_0xed2e('0x37')](_0x5711a5[_0xed2e('0x2c')]['channel'],_0x5711a5[_0xed2e('0x2c')][_0xed2e('0x35')]);return db[_0xed2e('0x30')][_0xed2e('0x2b')](_0x5711a5['body'],{'include':[{'model':db[_0xed2e('0x38')],'as':'Subjects'},{'model':db[_0xed2e('0x38')],'as':_0xed2e('0x36')}]});}return null;})[_0xed2e('0xa')](respondWithResult(_0x516c9e,null))[_0xed2e('0x27')](handleError(_0x516c9e,null));};function sanitizeRemoteUri(_0xf453e2){var _0x52ac6d=_0xf453e2['slice'](-0x1);if(_0x52ac6d==='/')return _0xf453e2[_0xed2e('0x39')](0x0,_0xf453e2[_0xed2e('0x3a')](_0x52ac6d));return _0xf453e2;}function getWebApiUrl(_0x2eaa44){return util[_0xed2e('0x3b')](_0xed2e('0x3c'),_0x2eaa44);}exports[_0xed2e('0x3d')]=function(_0x2308a6,_0x41ddf5){var _0x48bfa9=_0x2308a6['query']['ticketType'];var _0x20abbb=_0x48bfa9==='incident'?_0xed2e('0x3e'):_0xed2e('0x3f');var _0x5f1455='';var _0x2e4507='';var _0x20c626='';var _0x27e098='';var _0x18800b='';var _0x4219e4='';var _0x24510d='';var _0x366b61='';var _0x1590a3=[_0xed2e('0x40'),_0xed2e('0x41'),_0xed2e('0x42'),_0xed2e('0x43'),_0xed2e('0x44'),_0xed2e('0x45'),_0xed2e('0x46'),_0xed2e('0x47'),_0xed2e('0x48'),'phonecall_activity_parties'];var _0x8425c8=['accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame',_0xed2e('0x49'),'contractidname',_0xed2e('0x4a'),_0xed2e('0x4b'),'createdbyname','createdbyyominame',_0xed2e('0x4c'),_0xed2e('0x4d'),_0xed2e('0x4e'),_0xed2e('0x4f'),_0xed2e('0x50'),_0xed2e('0x51'),_0xed2e('0x52'),_0xed2e('0x53'),_0xed2e('0x54'),_0xed2e('0x55'),'escalatedon','exchangerate',_0xed2e('0x56'),_0xed2e('0x57'),_0xed2e('0x58'),'influencescore',_0xed2e('0x59'),_0xed2e('0x5a'),_0xed2e('0x5b'),_0xed2e('0x5c'),_0xed2e('0x5d'),_0xed2e('0x5e'),_0xed2e('0x5f'),_0xed2e('0x60'),_0xed2e('0x61'),'modifiedonbehalfbyyominame',_0xed2e('0x62'),_0xed2e('0x63'),_0xed2e('0x64'),'onholdtime',_0xed2e('0x65'),_0xed2e('0x66'),_0xed2e('0x67'),'owneridyominame',_0xed2e('0x68'),_0xed2e('0x69'),_0xed2e('0x6a'),_0xed2e('0x6b'),'productidname',_0xed2e('0x6c'),_0xed2e('0x6d'),'resolvebykpiidname',_0xed2e('0x6e'),'responsiblecontactidname',_0xed2e('0x6f'),_0xed2e('0x70'),_0xed2e('0x71'),_0xed2e('0x72'),_0xed2e('0x73'),'statecode',_0xed2e('0x74'),_0xed2e('0x75'),_0xed2e('0x76'),_0xed2e('0x77'),_0xed2e('0x78'),_0xed2e('0x79'),_0xed2e('0x7a'),_0xed2e('0x7b')];var _0xf85bcc=_0x1590a3[_0xed2e('0x7c')](_0x8425c8);return db[_0xed2e('0x12')][_0xed2e('0x2f')]({'where':{'id':_0x2308a6[_0xed2e('0x28')]['id']},'attributes':['id',_0xed2e('0x7d'),_0xed2e('0x7e'),_0xed2e('0x7f'),_0xed2e('0x80'),_0xed2e('0x81'),_0xed2e('0x82'),_0xed2e('0x83')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id','data5','data7']}]})['then'](handleEntityNotFound(_0x41ddf5,null))[_0xed2e('0xa')](function(_0x2a0397){if(_0x2a0397){if(_0x2a0397[_0xed2e('0x83')]){_0x2a0397['access_token']=_0x2a0397[_0xed2e('0x84')][_0xed2e('0x85')];_0x366b61=sanitizeRemoteUri(_0x2a0397[_0xed2e('0x84')][_0xed2e('0x86')]);_0x24510d=getWebApiUrl(_0x366b61);return _0x2a0397;}_0x366b61=sanitizeRemoteUri(_0x2a0397['remoteUri']);_0x24510d=getWebApiUrl(_0x366b61);var _0x2b404b={'method':'POST','uri':_0xed2e('0x87')+_0x2a0397[_0xed2e('0x80')]+'/oauth2/token','form':{'client_id':_0x2a0397['clientId'],'resource':_0x366b61,'username':_0x2a0397['username'],'password':_0x2a0397[_0xed2e('0x7e')],'grant_type':'password','client_secret':_0x2a0397['clientSecret']},'json':!![]};return rp(_0x2b404b);}})[_0xed2e('0xa')](function(_0x1ea8ab){_0x4219e4=_0x1ea8ab[_0xed2e('0x88')];var _0x28619a={'method':'GET','uri':encodeURI(_0x24510d+_0xed2e('0x89')+_0x20abbb+'\x27'),'headers':{'Authorization':_0xed2e('0x8a')+_0x4219e4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x28619a);})['then'](function(_0x3e1d59){var _0x20c6aa=_0x3e1d59[_0xed2e('0x8b')][0x0];var _0x47b0d3=_0x20c6aa['MetadataId'];var _0xad6580={'method':_0xed2e('0x8c'),'uri':_0x24510d+_0xed2e('0x8d')+_0x47b0d3+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xed2e('0x8a')+_0x4219e4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xad6580);})[_0xed2e('0xa')](function(_0x303464){_0x5f1455=_0x303464;_0x2e4507=_0x5f1455[_0xed2e('0x8e')];_0x2e4507=_['remove'](_0x2e4507,function(_0x427773){return!_0xf85bcc[_0xed2e('0x8f')](_0x427773[_0xed2e('0x90')]);});var _0x4d919e=[];var _0x4eea7c=[];_0x2e4507[_0xed2e('0x91')](function(_0x201ddd){if(_0x201ddd['@odata.type']){var _0xf731dc=_0x201ddd['@odata.type'][_0xed2e('0x39')](_0x201ddd['@odata.type'][_0xed2e('0x3a')]('.')+0x1);if(_0xf731dc===_0xed2e('0x92')){_0x4d919e[_0xed2e('0x93')](getSelectList(_0x24510d,_0x48bfa9,_0x4eea7c,_0x5f1455[_0xed2e('0x94')],_0x201ddd[_0xed2e('0x94')],_0x4219e4));}}});return Promise['all'](_0x4d919e);})[_0xed2e('0xa')](function(_0x19f21a){_0x20c626=_0x19f21a[0x0];var _0x8e9450=[];var _0xf9d0c5=[];_0x2e4507[_0xed2e('0x91')](function(_0x282741){if(!_['isNil'](_0x282741[_0xed2e('0x95')])){var _0x27afdc=_0x282741['@odata.type'][_0xed2e('0x39')](_0x282741['@odata.type'][_0xed2e('0x3a')]('.')+0x1);if(_0x27afdc===_0xed2e('0x96')){_0x8e9450[_0xed2e('0x93')](getBooleanList(_0x24510d,_0x48bfa9,_0xf9d0c5,_0x5f1455[_0xed2e('0x94')],_0x282741[_0xed2e('0x94')],_0x4219e4));}}});return Promise[_0xed2e('0x97')](_0x8e9450);})[_0xed2e('0xa')](function(_0x5164d1){_0x27e098=_0x5164d1[0x0];var _0x1e1761=[];var _0x5f2574=[];_0x2e4507[_0xed2e('0x91')](function(_0x93a9b8){if(_0x93a9b8['@odata.type']){var _0x6b8e49=_0x93a9b8[_0xed2e('0x95')]['substring'](_0x93a9b8[_0xed2e('0x95')][_0xed2e('0x3a')]('.')+0x1);if(_0x6b8e49===_0xed2e('0x98')||_0x6b8e49===_0xed2e('0x99')||_0x6b8e49===_0xed2e('0x9a')||_0x6b8e49===_0xed2e('0x9b')||_0x6b8e49==='MemoAttributeMetadata'||_0x6b8e49==='DateTimeAttributeMetadata'||_0x6b8e49==='StatusAttributeMetadata'||_0x6b8e49===_0xed2e('0x9c')||_0x6b8e49===_0xed2e('0x9d')||_0x6b8e49===_0xed2e('0x9e')){_0x1e1761['push'](getInputList(_0x24510d,_0x48bfa9,_0x6b8e49,_0x5f2574,_0x5f1455[_0xed2e('0x94')],_0x93a9b8[_0xed2e('0x94')],_0x4219e4));}}});return Promise[_0xed2e('0x97')](_0x1e1761);})[_0xed2e('0xa')](function(_0x8c2226){_0x18800b=_0x8c2226[0x0];var _0x161fc3=_0x20c626['concat'](_0x27e098)[_0xed2e('0x7c')](_0x18800b);var _0x5df614={'count':_0x161fc3[_0xed2e('0x1a')],'rows':_0x161fc3};return _0x5df614;})[_0xed2e('0xa')](respondWithResult(_0x41ddf5,null))[_0xed2e('0x27')](function(_0xc52e8a){var _0x463695=_0x2308a6[_0xed2e('0x14')][_0xed2e('0x9f')]?0x1f4:_0xc52e8a[_0xed2e('0xa0')]||0x1f4;logger[_0xed2e('0xb')](_0xc52e8a[_0xed2e('0xc')]);delete _0xc52e8a[_0xed2e('0xd')];if(_0x463695===0x191){_0x463695=0x190;}_0x41ddf5['status'](_0x463695)[_0xed2e('0xf')](_0x2308a6[_0xed2e('0x14')][_0xed2e('0x9f')]?{'message':'Wrong\x20credentials','statusCode':_0xc52e8a['statusCode']}:_0xc52e8a);});};function getSelectList(_0x1cd6d3,_0x57ddfc,_0x54e6a3,_0x2d6a78,_0x104ab5,_0x54050d){var _0x40965c={'method':_0xed2e('0x8c'),'uri':_0x1cd6d3+_0xed2e('0x8d')+_0x2d6a78+_0xed2e('0xa1')+_0x104ab5+_0xed2e('0xa2')+_0xed2e('0xa3'),'headers':{'Authorization':_0xed2e('0x8a')+_0x54050d,'If-None-Match':null,'OData-Version':_0xed2e('0xa4')},'json':!![]};return rp(_0x40965c)[_0xed2e('0xa')](function(_0x18783e){var _0x578010=[];var _0x3dc580=_0x18783e[_0xed2e('0xa5')][_0xed2e('0xa6')];_0x3dc580[_0xed2e('0x91')](function(_0x7db73f){_0x578010[_0xed2e('0x93')]({'name':_0x7db73f[_0xed2e('0xa7')]['UserLocalizedLabel'][_0xed2e('0xa7')],'value':String(_0x7db73f[_0xed2e('0xa8')])});});var _0x25602c={'id':_0x57ddfc+'_'+_0x18783e['LogicalName'],'name':_0x18783e[_0xed2e('0xa9')]['UserLocalizedLabel'][_0xed2e('0xa7')],'custom':![],'options':_0x578010};_0x54e6a3['push'](_0x25602c);return _0x54e6a3;});}function getBooleanList(_0x219f22,_0x30851f,_0x1a9385,_0x3ec777,_0x48930a,_0x34817a){var _0x62b56b={'method':_0xed2e('0x8c'),'uri':_0x219f22+_0xed2e('0x8d')+_0x3ec777+_0xed2e('0xa1')+_0x48930a+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x34817a,'If-None-Match':null,'OData-Version':_0xed2e('0xa4')},'json':!![]};return rp(_0x62b56b)[_0xed2e('0xa')](function(_0x19f5c1){var _0x1ff8f5=[];_0x1ff8f5[_0xed2e('0x93')]({'name':_0x19f5c1[_0xed2e('0xa5')][_0xed2e('0xaa')][_0xed2e('0xa7')][_0xed2e('0xab')][_0xed2e('0xa7')],'value':_0xed2e('0xac')},{'name':_0x19f5c1[_0xed2e('0xa5')][_0xed2e('0xad')][_0xed2e('0xa7')][_0xed2e('0xab')][_0xed2e('0xa7')],'value':_0xed2e('0xae')});var _0x351e4a={'id':_0x30851f+'_'+_0x19f5c1[_0xed2e('0x90')],'name':_0x19f5c1[_0xed2e('0xa9')][_0xed2e('0xab')][_0xed2e('0xa7')],'custom':![],'options':_0x1ff8f5};_0x1a9385['push'](_0x351e4a);return _0x1a9385;});}function getInputList(_0x3ed84e,_0x53f04d,_0x5cc442,_0x2bfef3,_0x44a464,_0x3682fb,_0x259a58){var _0x3a98b1={'method':_0xed2e('0x8c'),'uri':_0x3ed84e+'EntityDefinitions('+_0x44a464+_0xed2e('0xa1')+_0x3682fb+_0xed2e('0xaf')+_0x5cc442+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x259a58,'If-None-Match':null,'OData-Version':_0xed2e('0xa4')},'json':!![]};return rp(_0x3a98b1)[_0xed2e('0xa')](function(_0x6a018c){var _0x340991={'id':_0x53f04d+'_'+_0x6a018c[_0xed2e('0x90')],'name':_0x6a018c[_0xed2e('0xa9')][_0xed2e('0xab')]?_0x6a018c['DisplayName'][_0xed2e('0xab')][_0xed2e('0xa7')]:_0x6a018c['LogicalName'],'custom':![],'options':[]};_0x2bfef3[_0xed2e('0x93')](_0x340991);return _0x2bfef3;});} \ No newline at end of file +var _0x0522=['offset','limit','status','Content-Range','update','then','end','error','stack','name','send','Dynamics365Account','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','fields','find','body','destroy','getConfigurations','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','create','Dynamics365Field','substring','lastIndexOf','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','username','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','https://login.microsoftonline.com/','tenantId','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','LogicalName','forEach','@odata.type','push','MetadataId','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','count'];(function(_0x25fd34,_0x3ab768){var _0x3e83dc=function(_0x291aca){while(--_0x291aca){_0x25fd34['push'](_0x25fd34['shift']());}};_0x3e83dc(++_0x3ab768);}(_0x0522,0x171));var _0x2052=function(_0x2fedfa,_0x51fc4b){_0x2fedfa=_0x2fedfa-0x0;var _0x2bcc21=_0x0522[_0x2fedfa];return _0x2bcc21;};'use strict';var rp=require(_0x2052('0x0'));var util=require('util');var _=require(_0x2052('0x1'));var qs=require(_0x2052('0x2'));var logger=require(_0x2052('0x3'))(_0x2052('0x4'));var db=require(_0x2052('0x5'))['db'];var integrations=require(_0x2052('0x6'));function respondWithResult(_0x24224e,_0x1e2b96){_0x1e2b96=_0x1e2b96||0xc8;return function(_0x275836){if(_0x275836){return _0x24224e['status'](_0x1e2b96)[_0x2052('0x7')](_0x275836);}};}function respondWithFilteredResult(_0x3977b5,_0x47e90e){return function(_0x2c64f6){if(_0x2c64f6){var _0x431fb2=typeof _0x47e90e['offset']==='undefined'&&typeof _0x47e90e['limit']==='undefined';var _0x52d047=_0x2c64f6[_0x2052('0x8')];var _0x40d8b2=_0x431fb2?0x0:_0x47e90e[_0x2052('0x9')];var _0x51e9ce=_0x431fb2?_0x2c64f6[_0x2052('0x8')]:_0x47e90e['offset']+_0x47e90e[_0x2052('0xa')];var _0x398133;if(_0x51e9ce>=_0x52d047){_0x51e9ce=_0x52d047;_0x398133=0xc8;}else{_0x398133=0xce;}_0x3977b5[_0x2052('0xb')](_0x398133);return _0x3977b5['set'](_0x2052('0xc'),_0x40d8b2+'-'+_0x51e9ce+'/'+_0x52d047)[_0x2052('0x7')](_0x2c64f6);}return null;};}function saveUpdates(_0x8e72a0){return function(_0xdeb7d1){if(_0xdeb7d1){return _0xdeb7d1[_0x2052('0xd')](_0x8e72a0)[_0x2052('0xe')](function(_0x4ee2ac){return _0x4ee2ac;});}return null;};}function removeEntity(_0x53ca81){return function(_0x38f998){if(_0x38f998){return _0x38f998['destroy']()[_0x2052('0xe')](function(){_0x53ca81[_0x2052('0xb')](0xcc)[_0x2052('0xf')]();});}};}function handleEntityNotFound(_0x2b467c){return function(_0x5670aa){if(!_0x5670aa){_0x2b467c['sendStatus'](0x194);}return _0x5670aa;};}function handleError(_0x3f65c1,_0x4c4e60){_0x4c4e60=_0x4c4e60||0x1f4;return function(_0x30d5d3){logger[_0x2052('0x10')](_0x30d5d3[_0x2052('0x11')]);if(_0x30d5d3[_0x2052('0x12')]){delete _0x30d5d3[_0x2052('0x12')];}_0x3f65c1[_0x2052('0xb')](_0x4c4e60)[_0x2052('0x13')](_0x30d5d3);};}exports['index']=function(_0x127390,_0x1fba60){var _0xfcf302={},_0x1f92a3={},_0x25a014={'count':0x0,'rows':[]};var _0xf945a9=_['map'](db[_0x2052('0x14')][_0x2052('0x15')],function(_0xdb4039){return{'name':_0xdb4039[_0x2052('0x16')],'type':_0xdb4039['type']['key']};});_0x1f92a3[_0x2052('0x17')]=_[_0x2052('0x18')](_0xf945a9,_0x2052('0x12'));_0x1f92a3[_0x2052('0x19')]=_['keys'](_0x127390[_0x2052('0x19')]);_0x1f92a3[_0x2052('0x1a')]=_['intersection'](_0x1f92a3['model'],_0x1f92a3[_0x2052('0x19')]);_0xfcf302[_0x2052('0x1b')]=_[_0x2052('0x1c')](_0x1f92a3['model'],qs['fields'](_0x127390[_0x2052('0x19')]['fields']));_0xfcf302[_0x2052('0x1b')]=_0xfcf302[_0x2052('0x1b')][_0x2052('0x1d')]?_0xfcf302[_0x2052('0x1b')]:_0x1f92a3[_0x2052('0x17')];if(!_0x127390[_0x2052('0x19')]['hasOwnProperty']('nolimit')){_0xfcf302[_0x2052('0xa')]=qs['limit'](_0x127390[_0x2052('0x19')][_0x2052('0xa')]);_0xfcf302['offset']=qs['offset'](_0x127390[_0x2052('0x19')][_0x2052('0x9')]);}_0xfcf302[_0x2052('0x1e')]=qs['sort'](_0x127390[_0x2052('0x19')][_0x2052('0x1f')]);_0xfcf302[_0x2052('0x20')]=qs[_0x2052('0x1a')](_[_0x2052('0x21')](_0x127390['query'],_0x1f92a3[_0x2052('0x1a')]),_0xf945a9);if(_0x127390[_0x2052('0x19')][_0x2052('0x22')]){_0xfcf302[_0x2052('0x20')]=_[_0x2052('0x23')](_0xfcf302[_0x2052('0x20')],{'$or':_[_0x2052('0x18')](_0xf945a9,function(_0x32e855){if(_0x32e855[_0x2052('0x24')]!==_0x2052('0x25')){var _0x4ee4c1={};_0x4ee4c1[_0x32e855[_0x2052('0x12')]]={'$like':'%'+_0x127390[_0x2052('0x19')][_0x2052('0x22')]+'%'};return _0x4ee4c1;}})});}_0xfcf302=_[_0x2052('0x23')]({},_0xfcf302,_0x127390[_0x2052('0x26')]);var _0x578e1c={'where':_0xfcf302['where']};return db['Dynamics365Account'][_0x2052('0x8')](_0x578e1c)['then'](function(_0x495cdc){_0x25a014[_0x2052('0x8')]=_0x495cdc;if(_0x127390[_0x2052('0x19')][_0x2052('0x27')]){_0xfcf302[_0x2052('0x28')]=[{'all':!![]}];}return db[_0x2052('0x14')][_0x2052('0x29')](_0xfcf302);})[_0x2052('0xe')](function(_0x296cab){_0x25a014['rows']=_0x296cab;return _0x25a014;})[_0x2052('0xe')](respondWithFilteredResult(_0x1fba60,_0xfcf302))[_0x2052('0x2a')](handleError(_0x1fba60,null));};exports['show']=function(_0x8da61,_0x224e2c){var _0x10d6ce={'raw':![],'where':{'id':_0x8da61[_0x2052('0x2b')]['id']}},_0x1e7926={};_0x1e7926[_0x2052('0x17')]=_[_0x2052('0x2c')](db[_0x2052('0x14')][_0x2052('0x15')]);_0x1e7926['query']=_['keys'](_0x8da61[_0x2052('0x19')]);_0x1e7926[_0x2052('0x1a')]=_[_0x2052('0x1c')](_0x1e7926[_0x2052('0x17')],_0x1e7926[_0x2052('0x19')]);_0x10d6ce[_0x2052('0x1b')]=_[_0x2052('0x1c')](_0x1e7926[_0x2052('0x17')],qs[_0x2052('0x2d')](_0x8da61[_0x2052('0x19')][_0x2052('0x2d')]));_0x10d6ce[_0x2052('0x1b')]=_0x10d6ce[_0x2052('0x1b')][_0x2052('0x1d')]?_0x10d6ce['attributes']:_0x1e7926['model'];if(_0x8da61[_0x2052('0x19')][_0x2052('0x27')]){_0x10d6ce[_0x2052('0x28')]=[{'all':!![]}];}_0x10d6ce=_['merge']({},_0x10d6ce,_0x8da61[_0x2052('0x26')]);return db['Dynamics365Account'][_0x2052('0x2e')](_0x10d6ce)[_0x2052('0xe')](handleEntityNotFound(_0x224e2c,null))[_0x2052('0xe')](respondWithResult(_0x224e2c,null))[_0x2052('0x2a')](handleError(_0x224e2c,null));};exports['create']=function(_0x4f78f6,_0x42de46){return db[_0x2052('0x14')]['create'](_0x4f78f6['body'],{})['then'](respondWithResult(_0x42de46,0xc9))[_0x2052('0x2a')](handleError(_0x42de46,null));};exports[_0x2052('0xd')]=function(_0x1a0a6a,_0x275d92){if(_0x1a0a6a[_0x2052('0x2f')]['id']){delete _0x1a0a6a['body']['id'];}return db['Dynamics365Account'][_0x2052('0x2e')]({'where':{'id':_0x1a0a6a[_0x2052('0x2b')]['id']}})[_0x2052('0xe')](handleEntityNotFound(_0x275d92,null))['then'](saveUpdates(_0x1a0a6a[_0x2052('0x2f')],null))['then'](respondWithResult(_0x275d92,null))[_0x2052('0x2a')](handleError(_0x275d92,null));};exports[_0x2052('0x30')]=function(_0x140f81,_0x20d4c7){return db[_0x2052('0x14')][_0x2052('0x2e')]({'where':{'id':_0x140f81[_0x2052('0x2b')]['id']}})[_0x2052('0xe')](handleEntityNotFound(_0x20d4c7,null))['then'](removeEntity(_0x20d4c7,null))[_0x2052('0x2a')](handleError(_0x20d4c7,null));};exports['getConfigurations']=function(_0x1e63d5,_0x3bfb2b){var _0x53766b={};var _0x57b2c5={};var _0x426c07;var _0x4dca21;return db['Dynamics365Account']['findOne']({'where':{'id':_0x1e63d5[_0x2052('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3bfb2b,null))[_0x2052('0xe')](function(_0x1781d5){if(_0x1781d5){_0x426c07=_0x1781d5;_0x57b2c5[_0x2052('0x17')]=_[_0x2052('0x2c')](db['Dynamics365Configuration'][_0x2052('0x15')]);_0x57b2c5[_0x2052('0x19')]=_['keys'](_0x1e63d5[_0x2052('0x19')]);_0x57b2c5[_0x2052('0x1a')]=_[_0x2052('0x1c')](_0x57b2c5[_0x2052('0x17')],_0x57b2c5[_0x2052('0x19')]);_0x53766b[_0x2052('0x1b')]=_['intersection'](_0x57b2c5[_0x2052('0x17')],qs[_0x2052('0x2d')](_0x1e63d5[_0x2052('0x19')][_0x2052('0x2d')]));_0x53766b[_0x2052('0x1b')]=_0x53766b[_0x2052('0x1b')][_0x2052('0x1d')]?_0x53766b[_0x2052('0x1b')]:_0x57b2c5[_0x2052('0x17')];_0x53766b[_0x2052('0x1e')]=qs[_0x2052('0x1f')](_0x1e63d5[_0x2052('0x19')]['sort']);_0x53766b['where']=qs[_0x2052('0x1a')](_[_0x2052('0x21')](_0x1e63d5[_0x2052('0x19')],_0x57b2c5[_0x2052('0x1a')]));if(_0x1e63d5[_0x2052('0x19')]['filter']){_0x53766b[_0x2052('0x20')]=_[_0x2052('0x23')](_0x53766b['where'],{'$or':_[_0x2052('0x18')](_0x53766b[_0x2052('0x1b')],function(_0x59e016){var _0x4a36e8={};_0x4a36e8[_0x59e016]={'$like':'%'+_0x1e63d5[_0x2052('0x19')]['filter']+'%'};return _0x4a36e8;})});}_0x53766b=_[_0x2052('0x23')]({},_0x53766b,_0x1e63d5[_0x2052('0x26')]);return _0x426c07[_0x2052('0x31')](_0x53766b);}})[_0x2052('0xe')](function(_0x1bdfac){if(_0x1bdfac){_0x4dca21=_0x1bdfac['length'];if(!_0x1e63d5[_0x2052('0x19')][_0x2052('0x32')](_0x2052('0x33'))){_0x53766b[_0x2052('0xa')]=qs[_0x2052('0xa')](_0x1e63d5[_0x2052('0x19')][_0x2052('0xa')]);_0x53766b['offset']=qs[_0x2052('0x9')](_0x1e63d5['query'][_0x2052('0x9')]);}return _0x426c07[_0x2052('0x31')](_0x53766b);}})[_0x2052('0xe')](function(_0x32716a){if(_0x32716a){return _0x32716a?{'count':_0x4dca21,'rows':_0x32716a}:null;}})[_0x2052('0xe')](respondWithResult(_0x3bfb2b,null))[_0x2052('0x2a')](handleError(_0x3bfb2b,null));};exports[_0x2052('0x34')]=function(_0x482d21,_0x4cc9d6){if(_0x482d21[_0x2052('0x2f')]['id']){delete _0x482d21[_0x2052('0x2f')]['id'];}return db[_0x2052('0x14')][_0x2052('0x35')]({'where':{'id':_0x482d21['params']['id']}})['then'](handleEntityNotFound(_0x4cc9d6,null))[_0x2052('0xe')](function(_0x1c11cd){if(_0x1c11cd){_0x482d21[_0x2052('0x2f')][_0x2052('0x36')]=_0x1c11cd['id'];_0x482d21[_0x2052('0x2f')][_0x2052('0x37')]=integrations[_0x2052('0x38')](_0x482d21[_0x2052('0x2f')]['channel'],_0x482d21[_0x2052('0x2f')]['type']);_0x482d21[_0x2052('0x2f')][_0x2052('0x39')]=integrations[_0x2052('0x3a')](_0x482d21[_0x2052('0x2f')][_0x2052('0x3b')],_0x482d21['body']['type']);return db[_0x2052('0x3c')][_0x2052('0x3d')](_0x482d21['body'],{'include':[{'model':db[_0x2052('0x3e')],'as':_0x2052('0x37')},{'model':db[_0x2052('0x3e')],'as':_0x2052('0x39')}]});}return null;})['then'](respondWithResult(_0x4cc9d6,null))[_0x2052('0x2a')](handleError(_0x4cc9d6,null));};function sanitizeRemoteUri(_0x474c8e){var _0x249647=_0x474c8e['slice'](-0x1);if(_0x249647==='/')return _0x474c8e[_0x2052('0x3f')](0x0,_0x474c8e[_0x2052('0x40')](_0x249647));return _0x474c8e;}function getWebApiUrl(_0x2dd33f){return util['format'](_0x2052('0x41'),_0x2dd33f);}exports[_0x2052('0x42')]=function(_0x24ad15,_0x421207){var _0x544619=_0x24ad15['query']['ticketType'];var _0x36cdcd=_0x544619===_0x2052('0x43')?_0x2052('0x44'):_0x2052('0x45');var _0xd82a79='';var _0x5842ab='';var _0x5a0821='';var _0x30a50c='';var _0x10f6e0='';var _0x8e717b='';var _0x2bad4d='';var _0x266d2e='';var _0x8338ae=[_0x2052('0x46'),_0x2052('0x47'),_0x2052('0x48'),_0x2052('0x49'),'caseorigincode',_0x2052('0x4a'),_0x2052('0x4b'),_0x2052('0x4c'),_0x2052('0x4d'),_0x2052('0x4e')];var _0x27ac9e=[_0x2052('0x4f'),_0x2052('0x50'),_0x2052('0x51'),'billedserviceunits','contactidname','contactidyominame',_0x2052('0x52'),_0x2052('0x53'),_0x2052('0x54'),_0x2052('0x55'),_0x2052('0x56'),_0x2052('0x57'),_0x2052('0x58'),_0x2052('0x59'),_0x2052('0x5a'),'customeridname',_0x2052('0x5b'),_0x2052('0x5c'),_0x2052('0x5d'),_0x2052('0x5e'),_0x2052('0x5f'),_0x2052('0x60'),'escalatedon',_0x2052('0x61'),_0x2052('0x62'),_0x2052('0x63'),_0x2052('0x64'),'influencescore',_0x2052('0x65'),_0x2052('0x66'),_0x2052('0x67'),_0x2052('0x68'),_0x2052('0x69'),'modifiedbyname',_0x2052('0x6a'),_0x2052('0x6b'),_0x2052('0x6c'),_0x2052('0x6d'),'msdyn_incidenttypename',_0x2052('0x6e'),'numberofchildincidents',_0x2052('0x6f'),_0x2052('0x70'),_0x2052('0x71'),_0x2052('0x72'),_0x2052('0x73'),_0x2052('0x74'),_0x2052('0x75'),'primarycontactidyominame',_0x2052('0x76'),'productidname',_0x2052('0x77'),'resolveby',_0x2052('0x78'),_0x2052('0x79'),_0x2052('0x7a'),_0x2052('0x7b'),_0x2052('0x7c'),_0x2052('0x7d'),_0x2052('0x7e'),_0x2052('0x7f'),'statecode',_0x2052('0x80'),_0x2052('0x81'),_0x2052('0x82'),_0x2052('0x83'),'transactioncurrencyidname',_0x2052('0x84'),'utcconversiontimezonecode','versionnumber'];var _0x56ee8c=_0x8338ae['concat'](_0x27ac9e);return db[_0x2052('0x14')][_0x2052('0x35')]({'where':{'id':_0x24ad15[_0x2052('0x2b')]['id']},'attributes':['id',_0x2052('0x85'),'password',_0x2052('0x86'),'tenantId',_0x2052('0x87'),_0x2052('0x88'),_0x2052('0x89')],'include':[{'model':db[_0x2052('0x8a')],'as':_0x2052('0x8a'),'attributes':['id',_0x2052('0x8b'),_0x2052('0x8c')]}]})['then'](handleEntityNotFound(_0x421207,null))[_0x2052('0xe')](function(_0x1e7a55){if(_0x1e7a55){if(_0x1e7a55[_0x2052('0x89')]){_0x1e7a55[_0x2052('0x8d')]=_0x1e7a55['CloudProvider'][_0x2052('0x8b')];_0x266d2e=sanitizeRemoteUri(_0x1e7a55['CloudProvider'][_0x2052('0x8c')]);_0x2bad4d=getWebApiUrl(_0x266d2e);return _0x1e7a55;}_0x266d2e=sanitizeRemoteUri(_0x1e7a55[_0x2052('0x86')]);_0x2bad4d=getWebApiUrl(_0x266d2e);var _0x33a9c1={'method':'POST','uri':_0x2052('0x8e')+_0x1e7a55[_0x2052('0x8f')]+_0x2052('0x90'),'form':{'client_id':_0x1e7a55[_0x2052('0x87')],'resource':_0x266d2e,'username':_0x1e7a55[_0x2052('0x85')],'password':_0x1e7a55[_0x2052('0x91')],'grant_type':_0x2052('0x91'),'client_secret':_0x1e7a55[_0x2052('0x88')]},'json':!![]};return rp(_0x33a9c1);}})[_0x2052('0xe')](function(_0xb36bf0){_0x8e717b=_0xb36bf0[_0x2052('0x8d')];var _0x524033={'method':_0x2052('0x92'),'uri':encodeURI(_0x2bad4d+_0x2052('0x93')+_0x36cdcd+'\x27'),'headers':{'Authorization':_0x2052('0x94')+_0x8e717b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x524033);})[_0x2052('0xe')](function(_0x2dc9d6){var _0x3537fb=_0x2dc9d6[_0x2052('0x95')][0x0];var _0x2a7788=_0x3537fb['MetadataId'];var _0x5d0594={'method':_0x2052('0x92'),'uri':_0x2bad4d+_0x2052('0x96')+_0x2a7788+_0x2052('0x97'),'headers':{'Authorization':_0x2052('0x94')+_0x8e717b,'If-None-Match':null,'OData-Version':_0x2052('0x98')},'json':!![]};return rp(_0x5d0594);})['then'](function(_0x1ebfcb){_0xd82a79=_0x1ebfcb;_0x5842ab=_0xd82a79['Attributes'];_0x5842ab=_['remove'](_0x5842ab,function(_0x16baf1){return!_0x56ee8c['includes'](_0x16baf1[_0x2052('0x99')]);});var _0x3ef508=[];var _0xc4e418=[];_0x5842ab[_0x2052('0x9a')](function(_0x2257a4){if(_0x2257a4['@odata.type']){var _0x49fe9a=_0x2257a4[_0x2052('0x9b')][_0x2052('0x3f')](_0x2257a4[_0x2052('0x9b')][_0x2052('0x40')]('.')+0x1);if(_0x49fe9a==='PicklistAttributeMetadata'){_0x3ef508[_0x2052('0x9c')](getSelectList(_0x2bad4d,_0x544619,_0xc4e418,_0xd82a79[_0x2052('0x9d')],_0x2257a4['MetadataId'],_0x8e717b));}}});return Promise['all'](_0x3ef508);})[_0x2052('0xe')](function(_0x53f9ca){_0x5a0821=_0x53f9ca[0x0];var _0x30060f=[];var _0x387126=[];_0x5842ab['forEach'](function(_0x25144b){if(!_[_0x2052('0x9e')](_0x25144b[_0x2052('0x9b')])){var _0x2f6869=_0x25144b[_0x2052('0x9b')]['substring'](_0x25144b['@odata.type']['lastIndexOf']('.')+0x1);if(_0x2f6869===_0x2052('0x9f')){_0x30060f[_0x2052('0x9c')](getBooleanList(_0x2bad4d,_0x544619,_0x387126,_0xd82a79[_0x2052('0x9d')],_0x25144b[_0x2052('0x9d')],_0x8e717b));}}});return Promise[_0x2052('0xa0')](_0x30060f);})[_0x2052('0xe')](function(_0x520c1e){_0x30a50c=_0x520c1e[0x0];var _0x199d93=[];var _0x306ad3=[];_0x5842ab[_0x2052('0x9a')](function(_0x499290){if(_0x499290['@odata.type']){var _0x1a7ad3=_0x499290[_0x2052('0x9b')]['substring'](_0x499290[_0x2052('0x9b')][_0x2052('0x40')]('.')+0x1);if(_0x1a7ad3===_0x2052('0xa1')||_0x1a7ad3===_0x2052('0xa2')||_0x1a7ad3===_0x2052('0xa3')||_0x1a7ad3===_0x2052('0xa4')||_0x1a7ad3===_0x2052('0xa5')||_0x1a7ad3===_0x2052('0xa6')||_0x1a7ad3===_0x2052('0xa7')||_0x1a7ad3===_0x2052('0xa8')||_0x1a7ad3===_0x2052('0xa9')||_0x1a7ad3===_0x2052('0xaa')){_0x199d93[_0x2052('0x9c')](getInputList(_0x2bad4d,_0x544619,_0x1a7ad3,_0x306ad3,_0xd82a79['MetadataId'],_0x499290[_0x2052('0x9d')],_0x8e717b));}}});return Promise[_0x2052('0xa0')](_0x199d93);})[_0x2052('0xe')](function(_0x3f8f91){_0x10f6e0=_0x3f8f91[0x0];var _0x7eb949=_0x5a0821['concat'](_0x30a50c)[_0x2052('0xab')](_0x10f6e0);var _0x1a99aa={'count':_0x7eb949[_0x2052('0x1d')],'rows':_0x7eb949};return _0x1a99aa;})[_0x2052('0xe')](respondWithResult(_0x421207,null))[_0x2052('0x2a')](function(_0x52a67f){var _0x19baec=_0x24ad15[_0x2052('0x19')][_0x2052('0xac')]?0x1f4:_0x52a67f[_0x2052('0xad')]||0x1f4;logger[_0x2052('0x10')](_0x52a67f['stack']);delete _0x52a67f[_0x2052('0x12')];if(_0x19baec===0x191){_0x19baec=0x190;}_0x421207[_0x2052('0xb')](_0x19baec)['send'](_0x24ad15[_0x2052('0x19')][_0x2052('0xac')]?{'message':_0x2052('0xae'),'statusCode':_0x52a67f[_0x2052('0xad')]}:_0x52a67f);});};function getSelectList(_0x4efe6c,_0x5b0357,_0x13060e,_0x5bba60,_0xef03dc,_0x27f245){var _0x539abd={'method':'GET','uri':_0x4efe6c+_0x2052('0x96')+_0x5bba60+')/Attributes('+_0xef03dc+_0x2052('0xaf')+_0x2052('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x27f245,'If-None-Match':null,'OData-Version':_0x2052('0x98')},'json':!![]};return rp(_0x539abd)[_0x2052('0xe')](function(_0xe7e216){var _0x4ed9a5=[];var _0x1307fc=_0xe7e216[_0x2052('0xb1')][_0x2052('0xb2')];_0x1307fc['forEach'](function(_0x3b0336){_0x4ed9a5['push']({'name':_0x3b0336['Label'][_0x2052('0xb3')][_0x2052('0xb4')],'value':String(_0x3b0336[_0x2052('0xb5')])});});var _0x4b00ea={'id':_0x5b0357+'_'+_0xe7e216[_0x2052('0x99')],'name':_0xe7e216[_0x2052('0xb6')][_0x2052('0xb3')][_0x2052('0xb4')],'custom':![],'options':_0x4ed9a5};_0x13060e['push'](_0x4b00ea);return _0x13060e;});}function getBooleanList(_0xe5b4dc,_0x223f47,_0x18cee5,_0x74e1df,_0x35cba8,_0x24d194){var _0x3ff6f9={'method':'GET','uri':_0xe5b4dc+_0x2052('0x96')+_0x74e1df+')/Attributes('+_0x35cba8+_0x2052('0xb7'),'headers':{'Authorization':_0x2052('0x94')+_0x24d194,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ff6f9)[_0x2052('0xe')](function(_0x2c52d7){var _0xf84424=[];_0xf84424['push']({'name':_0x2c52d7[_0x2052('0xb1')]['TrueOption'][_0x2052('0xb4')][_0x2052('0xb3')]['Label'],'value':_0x2052('0xb8')},{'name':_0x2c52d7[_0x2052('0xb1')][_0x2052('0xb9')][_0x2052('0xb4')][_0x2052('0xb3')]['Label'],'value':_0x2052('0xba')});var _0x2f6886={'id':_0x223f47+'_'+_0x2c52d7['LogicalName'],'name':_0x2c52d7[_0x2052('0xb6')]['UserLocalizedLabel'][_0x2052('0xb4')],'custom':![],'options':_0xf84424};_0x18cee5[_0x2052('0x9c')](_0x2f6886);return _0x18cee5;});}function getInputList(_0x5882fb,_0x12b040,_0x4e9716,_0x4cbcae,_0x19e18f,_0x5618a9,_0x63c239){var _0x4c6fb0={'method':'GET','uri':_0x5882fb+_0x2052('0x96')+_0x19e18f+')/Attributes('+_0x5618a9+_0x2052('0xbb')+_0x4e9716+_0x2052('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x63c239,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4c6fb0)[_0x2052('0xe')](function(_0x217b9b){var _0x5ba1f8={'id':_0x12b040+'_'+_0x217b9b[_0x2052('0x99')],'name':_0x217b9b[_0x2052('0xb6')][_0x2052('0xb3')]?_0x217b9b[_0x2052('0xb6')]['UserLocalizedLabel'][_0x2052('0xb4')]:_0x217b9b[_0x2052('0x99')],'custom':![],'options':[]};_0x4cbcae['push'](_0x5ba1f8);return _0x4cbcae;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index dab8113..a50ec3e 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x1a349a,_0x7a9fd0){var _0x5b0fb7=function(_0x2acd52){while(--_0x2acd52){_0x1a349a['push'](_0x1a349a['shift']());}};_0x5b0fb7(++_0x7a9fd0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xb7e7[_0x2a6809];return _0x11c371;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index d870640..ac7967f 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 _0xa093=['message','Dynamics365Account,\x20%s,\x20%s','catch','GetDynamics365Account','findAll','options','where','attributes','limit','include','model','map','stringify','ShowDynamics365Account','Dynamics365Account','find','raw','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x280b2c,_0x39e3c0){var _0x2c240c=function(_0x59ae47){while(--_0x59ae47){_0x280b2c['push'](_0x280b2c['shift']());}};_0x2c240c(++_0x39e3c0);}(_0xa093,0xb6));var _0x3a09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa093[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a09('0x0'));var BPromise=require('bluebird');var rs=require(_0x3a09('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a09('0x2'))['db'];var utils=require(_0x3a09('0x3'));var logger=require(_0x3a09('0x4'))('rpc');var config=require(_0x3a09('0x5'));var jayson=require(_0x3a09('0x6'));var client=jayson['client'][_0x3a09('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44d478,_0x5838fd,_0x52c59e){return new BPromise(function(_0x53bcff,_0x36b765){return client[_0x3a09('0x8')](_0x44d478,_0x52c59e)[_0x3a09('0x9')](function(_0x1e4d75){logger[_0x3a09('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x5838fd,_0x3a09('0xb'));logger[_0x3a09('0xc')](_0x3a09('0xd'),_0x5838fd,_0x3a09('0xb'),JSON['stringify'](_0x1e4d75));if(_0x1e4d75[_0x3a09('0xe')]){if(_0x1e4d75[_0x3a09('0xe')][_0x3a09('0xf')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5838fd,_0x1e4d75['error'][_0x3a09('0x10')]);return _0x36b765(_0x1e4d75[_0x3a09('0xe')][_0x3a09('0x10')]);}logger[_0x3a09('0xe')](_0x3a09('0x11'),_0x5838fd,_0x1e4d75[_0x3a09('0xe')][_0x3a09('0x10')]);return _0x53bcff(_0x1e4d75['error'][_0x3a09('0x10')]);}else{logger[_0x3a09('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x5838fd,_0x3a09('0xb'));_0x53bcff(_0x1e4d75['result'][_0x3a09('0x10')]);}})[_0x3a09('0x12')](function(_0x1238c6){logger[_0x3a09('0xe')](_0x3a09('0x11'),_0x5838fd,_0x1238c6);_0x36b765(_0x1238c6);});});}exports[_0x3a09('0x13')]=function(_0x492439){var _0x249adf=this;return new Promise(function(_0x4c8274,_0xaff68f){return db['Dynamics365Account'][_0x3a09('0x14')]({'raw':_0x492439[_0x3a09('0x15')]?_0x492439['options']['raw']===undefined?!![]:![]:!![],'where':_0x492439[_0x3a09('0x15')]?_0x492439['options'][_0x3a09('0x16')]||null:null,'attributes':_0x492439[_0x3a09('0x15')]?_0x492439[_0x3a09('0x15')][_0x3a09('0x17')]||null:null,'limit':_0x492439[_0x3a09('0x15')]?_0x492439[_0x3a09('0x15')][_0x3a09('0x18')]||null:null,'include':_0x492439[_0x3a09('0x15')]?_0x492439['options'][_0x3a09('0x19')]?_['map'](_0x492439[_0x3a09('0x15')][_0x3a09('0x19')],function(_0x34a465){return{'model':db[_0x34a465[_0x3a09('0x1a')]],'as':_0x34a465['as'],'attributes':_0x34a465['attributes'],'include':_0x34a465[_0x3a09('0x19')]?_['map'](_0x34a465[_0x3a09('0x19')],function(_0x557a4d){return{'model':db[_0x557a4d[_0x3a09('0x1a')]],'as':_0x557a4d['as'],'attributes':_0x557a4d[_0x3a09('0x17')],'include':_0x557a4d[_0x3a09('0x19')]?_[_0x3a09('0x1b')](_0x557a4d[_0x3a09('0x19')],function(_0x21ac47){return{'model':db[_0x21ac47[_0x3a09('0x1a')]],'as':_0x21ac47['as'],'attributes':_0x21ac47[_0x3a09('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3a09('0x9')](function(_0x5cb8cf){logger[_0x3a09('0xa')](_0x3a09('0x13'),_0x492439);logger[_0x3a09('0xc')]('GetDynamics365Account',_0x492439,JSON[_0x3a09('0x1c')](_0x5cb8cf));_0x4c8274(_0x5cb8cf);})[_0x3a09('0x12')](function(_0x2fb1bf){logger[_0x3a09('0xe')](_0x3a09('0x13'),_0x2fb1bf[_0x3a09('0x10')],_0x492439);_0xaff68f(_0x249adf[_0x3a09('0xe')](0x1f4,_0x2fb1bf['message']));});});};exports[_0x3a09('0x1d')]=function(_0x6e287d){var _0x313881=this;return new Promise(function(_0x2d8c3e,_0x1f4fe9){return db[_0x3a09('0x1e')][_0x3a09('0x1f')]({'raw':_0x6e287d[_0x3a09('0x15')]?_0x6e287d[_0x3a09('0x15')][_0x3a09('0x20')]===undefined?!![]:![]:!![],'where':_0x6e287d['options']?_0x6e287d[_0x3a09('0x15')][_0x3a09('0x16')]||null:null,'attributes':_0x6e287d[_0x3a09('0x15')]?_0x6e287d['options'][_0x3a09('0x17')]||null:null,'include':_0x6e287d['options']?_0x6e287d[_0x3a09('0x15')][_0x3a09('0x19')]?_[_0x3a09('0x1b')](_0x6e287d[_0x3a09('0x15')][_0x3a09('0x19')],function(_0x3d4236){return{'model':db[_0x3d4236[_0x3a09('0x1a')]],'as':_0x3d4236['as'],'attributes':_0x3d4236[_0x3a09('0x17')],'include':_0x3d4236['include']?_[_0x3a09('0x1b')](_0x3d4236[_0x3a09('0x19')],function(_0x432455){return{'model':db[_0x432455[_0x3a09('0x1a')]],'as':_0x432455['as'],'attributes':_0x432455[_0x3a09('0x17')],'include':_0x432455[_0x3a09('0x19')]?_[_0x3a09('0x1b')](_0x432455[_0x3a09('0x19')],function(_0x159304){return{'model':db[_0x159304[_0x3a09('0x1a')]],'as':_0x159304['as'],'attributes':_0x159304[_0x3a09('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3a09('0x9')](function(_0x3f0c01){logger[_0x3a09('0xa')](_0x3a09('0x1d'),_0x6e287d);logger['debug'](_0x3a09('0x1d'),_0x6e287d,JSON[_0x3a09('0x1c')](_0x3f0c01));_0x2d8c3e(_0x3f0c01);})[_0x3a09('0x12')](function(_0x32d49c){logger[_0x3a09('0xe')](_0x3a09('0x1d'),_0x32d49c[_0x3a09('0x10')],_0x6e287d);_0x1f4fe9(_0x313881[_0x3a09('0xe')](0x1f4,_0x32d49c[_0x3a09('0x10')]));});});}; \ No newline at end of file +var _0xecfb=['raw','where','include','map','model','attributes','GetDynamics365Account','stringify','ShowDynamics365Account','find','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','Dynamics365Account','findAll','options'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xecfb,0x1d2));var _0xbecf=function(_0x37a5a7,_0x2bdad5){_0x37a5a7=_0x37a5a7-0x0;var _0x5981d2=_0xecfb[_0x37a5a7];return _0x5981d2;};'use strict';var _=require(_0xbecf('0x0'));var util=require(_0xbecf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbecf('0x2'));var fs=require('fs');var Redis=require(_0xbecf('0x3'));var db=require(_0xbecf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbecf('0x5'))(_0xbecf('0x6'));var config=require(_0xbecf('0x7'));var jayson=require(_0xbecf('0x8'));var client=jayson[_0xbecf('0x9')][_0xbecf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf17f2a,_0x4260ec,_0x26836f){return new BPromise(function(_0x580309,_0x12210e){return client[_0xbecf('0xb')](_0xf17f2a,_0x26836f)[_0xbecf('0xc')](function(_0x495532){logger['info'](_0xbecf('0xd'),_0x4260ec,_0xbecf('0xe'));logger['debug'](_0xbecf('0xf'),_0x4260ec,_0xbecf('0xe'),JSON['stringify'](_0x495532));if(_0x495532[_0xbecf('0x10')]){if(_0x495532[_0xbecf('0x10')][_0xbecf('0x11')]===0x1f4){logger[_0xbecf('0x10')](_0xbecf('0xd'),_0x4260ec,_0x495532[_0xbecf('0x10')][_0xbecf('0x12')]);return _0x12210e(_0x495532[_0xbecf('0x10')][_0xbecf('0x12')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4260ec,_0x495532['error']['message']);return _0x580309(_0x495532['error'][_0xbecf('0x12')]);}else{logger[_0xbecf('0x13')](_0xbecf('0xd'),_0x4260ec,_0xbecf('0xe'));_0x580309(_0x495532['result']['message']);}})[_0xbecf('0x14')](function(_0xd02931){logger[_0xbecf('0x10')](_0xbecf('0xd'),_0x4260ec,_0xd02931);_0x12210e(_0xd02931);});});}exports['GetDynamics365Account']=function(_0x12ad90){var _0xa2464=this;return new Promise(function(_0x3bb877,_0x174e92){return db[_0xbecf('0x15')][_0xbecf('0x16')]({'raw':_0x12ad90[_0xbecf('0x17')]?_0x12ad90[_0xbecf('0x17')][_0xbecf('0x18')]===undefined?!![]:![]:!![],'where':_0x12ad90[_0xbecf('0x17')]?_0x12ad90[_0xbecf('0x17')][_0xbecf('0x19')]||null:null,'attributes':_0x12ad90[_0xbecf('0x17')]?_0x12ad90[_0xbecf('0x17')]['attributes']||null:null,'limit':_0x12ad90[_0xbecf('0x17')]?_0x12ad90['options']['limit']||null:null,'include':_0x12ad90[_0xbecf('0x17')]?_0x12ad90[_0xbecf('0x17')][_0xbecf('0x1a')]?_[_0xbecf('0x1b')](_0x12ad90[_0xbecf('0x17')]['include'],function(_0x43f927){return{'model':db[_0x43f927[_0xbecf('0x1c')]],'as':_0x43f927['as'],'attributes':_0x43f927[_0xbecf('0x1d')],'include':_0x43f927[_0xbecf('0x1a')]?_[_0xbecf('0x1b')](_0x43f927[_0xbecf('0x1a')],function(_0x204ef9){return{'model':db[_0x204ef9[_0xbecf('0x1c')]],'as':_0x204ef9['as'],'attributes':_0x204ef9[_0xbecf('0x1d')],'include':_0x204ef9[_0xbecf('0x1a')]?_[_0xbecf('0x1b')](_0x204ef9['include'],function(_0x3b7fa5){return{'model':db[_0x3b7fa5['model']],'as':_0x3b7fa5['as'],'attributes':_0x3b7fa5[_0xbecf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbecf('0xc')](function(_0x58f3b9){logger[_0xbecf('0x13')](_0xbecf('0x1e'),_0x12ad90);logger['debug'](_0xbecf('0x1e'),_0x12ad90,JSON[_0xbecf('0x1f')](_0x58f3b9));_0x3bb877(_0x58f3b9);})['catch'](function(_0xbba93e){logger[_0xbecf('0x10')](_0xbecf('0x1e'),_0xbba93e[_0xbecf('0x12')],_0x12ad90);_0x174e92(_0xa2464[_0xbecf('0x10')](0x1f4,_0xbba93e[_0xbecf('0x12')]));});});};exports[_0xbecf('0x20')]=function(_0x3a846e){var _0x18cb3a=this;return new Promise(function(_0x5e24ad,_0x17cf56){return db[_0xbecf('0x15')][_0xbecf('0x21')]({'raw':_0x3a846e[_0xbecf('0x17')]?_0x3a846e[_0xbecf('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3a846e[_0xbecf('0x17')]?_0x3a846e['options'][_0xbecf('0x19')]||null:null,'attributes':_0x3a846e['options']?_0x3a846e[_0xbecf('0x17')][_0xbecf('0x1d')]||null:null,'include':_0x3a846e[_0xbecf('0x17')]?_0x3a846e[_0xbecf('0x17')][_0xbecf('0x1a')]?_[_0xbecf('0x1b')](_0x3a846e[_0xbecf('0x17')][_0xbecf('0x1a')],function(_0x5f4bb9){return{'model':db[_0x5f4bb9[_0xbecf('0x1c')]],'as':_0x5f4bb9['as'],'attributes':_0x5f4bb9[_0xbecf('0x1d')],'include':_0x5f4bb9['include']?_[_0xbecf('0x1b')](_0x5f4bb9['include'],function(_0x49f781){return{'model':db[_0x49f781[_0xbecf('0x1c')]],'as':_0x49f781['as'],'attributes':_0x49f781[_0xbecf('0x1d')],'include':_0x49f781['include']?_[_0xbecf('0x1b')](_0x49f781[_0xbecf('0x1a')],function(_0x3baca5){return{'model':db[_0x3baca5[_0xbecf('0x1c')]],'as':_0x3baca5['as'],'attributes':_0x3baca5['attributes']};}):[]};}):[]};}):[]:[]})[_0xbecf('0xc')](function(_0x26e397){logger[_0xbecf('0x13')](_0xbecf('0x20'),_0x3a846e);logger[_0xbecf('0x22')]('ShowDynamics365Account',_0x3a846e,JSON[_0xbecf('0x1f')](_0x26e397));_0x5e24ad(_0x26e397);})[_0xbecf('0x14')](function(_0x52ee36){logger['error'](_0xbecf('0x20'),_0x52ee36[_0xbecf('0x12')],_0x3a846e);_0x17cf56(_0x18cb3a[_0xbecf('0x10')](0x1f4,_0x52ee36['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 487a98c..f10a560 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 _0x701c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x701c,0x167));var _0xc701=function(_0x3b69e9,_0x26d81d){_0x3b69e9=_0x3b69e9-0x0;var _0x2bf555=_0x701c[_0x3b69e9];return _0x2bf555;};'use strict';var multer=require(_0xc701('0x0'));var util=require('util');var path=require(_0xc701('0x1'));var timeout=require(_0xc701('0x2'));var express=require(_0xc701('0x3'));var router=express[_0xc701('0x4')]();var fs_extra=require(_0xc701('0x5'));var auth=require(_0xc701('0x6'));var interaction=require(_0xc701('0x7'));var config=require('../../config/environment');var controller=require(_0xc701('0x8'));router['get']('/',auth[_0xc701('0x9')](),controller[_0xc701('0xa')]);router[_0xc701('0xb')](_0xc701('0xc'),auth['isAuthenticated'](),controller[_0xc701('0xd')]);router[_0xc701('0xb')]('/:id/fields',auth[_0xc701('0x9')](),controller[_0xc701('0xe')]);router[_0xc701('0xb')](_0xc701('0xf'),auth[_0xc701('0x9')](),controller[_0xc701('0x10')]);router['get']('/:id/descriptions',auth[_0xc701('0x9')](),controller[_0xc701('0x11')]);router[_0xc701('0x12')]('/',auth[_0xc701('0x9')](),controller[_0xc701('0x13')]);router['put']('/:id',auth[_0xc701('0x9')](),controller[_0xc701('0x14')]);router[_0xc701('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc701('0x16')]);module[_0xc701('0x17')]=router; \ No newline at end of file +var _0xf47b=['getFields','/:id/descriptions','getDescriptions','post','create','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x5bcb11,_0x5b5d84){var _0x3daa19=function(_0x1e3715){while(--_0x1e3715){_0x5bcb11['push'](_0x5bcb11['shift']());}};_0x3daa19(++_0x5b5d84);}(_0xf47b,0x15d));var _0xbf47=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf47b[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xbf47('0x0'));var util=require(_0xbf47('0x1'));var path=require(_0xbf47('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf47('0x3'));var router=express[_0xbf47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbf47('0x5'));var interaction=require(_0xbf47('0x6'));var config=require(_0xbf47('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0xbf47('0x8')]('/',auth[_0xbf47('0x9')](),controller['index']);router[_0xbf47('0x8')](_0xbf47('0xa'),auth[_0xbf47('0x9')](),controller[_0xbf47('0xb')]);router[_0xbf47('0x8')]('/:id/fields',auth[_0xbf47('0x9')](),controller[_0xbf47('0xc')]);router[_0xbf47('0x8')]('/:id/subjects',auth[_0xbf47('0x9')](),controller['getSubjects']);router[_0xbf47('0x8')](_0xbf47('0xd'),auth[_0xbf47('0x9')](),controller[_0xbf47('0xe')]);router[_0xbf47('0xf')]('/',auth[_0xbf47('0x9')](),controller[_0xbf47('0x10')]);router['put'](_0xbf47('0xa'),auth[_0xbf47('0x9')](),controller['update']);router['delete'](_0xbf47('0xa'),auth[_0xbf47('0x9')](),controller[_0xbf47('0x11')]);module[_0xbf47('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 6daea11..0688dba 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 _0xa984=['ENUM','incident','phonecall','contact','sequelize','STRING'];(function(_0x660f4e,_0xf6e9c0){var _0x1bb90b=function(_0x3bdcfb){while(--_0x3bdcfb){_0x660f4e['push'](_0x660f4e['shift']());}};_0x1bb90b(++_0xf6e9c0);}(_0xa984,0xa0));var _0x4a98=function(_0x1ba865,_0x110d26){_0x1ba865=_0x1ba865-0x0;var _0x35a964=_0xa984[_0x1ba865];return _0x35a964;};'use strict';var Sequelize=require(_0x4a98('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a98('0x1')]},'description':{'type':Sequelize[_0x4a98('0x1')]},'ticketType':{'type':Sequelize[_0x4a98('0x2')](_0x4a98('0x3'),_0x4a98('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x4a98('0x5'),'nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb73c=['nothing','BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','contact'];(function(_0x4a5842,_0x42a825){var _0x1251a2=function(_0x50f601){while(--_0x50f601){_0x4a5842['push'](_0x4a5842['shift']());}};_0x1251a2(++_0x42a825);}(_0xb73c,0x1f1));var _0xcb73=function(_0x123676,_0x4340ed){_0x123676=_0x123676-0x0;var _0x3c77d5=_0xb73c[_0x123676];return _0x3c77d5;};'use strict';var Sequelize=require(_0xcb73('0x0'));module[_0xcb73('0x1')]={'name':{'type':Sequelize[_0xcb73('0x2')]},'description':{'type':Sequelize[_0xcb73('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xcb73('0x3'),_0xcb73('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xcb73('0x5')](_0xcb73('0x6'),_0xcb73('0x7')),'defaultValue':_0xcb73('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xcb73('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xcb73('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c97950c..dda679b 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 _0x11cf=['query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','intersection','length','include','find','create','body','getFields','findOne','sort','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0x11cf,0x10e));var _0xf11c=function(_0x16884c,_0x508220){_0x16884c=_0x16884c-0x0;var _0x1c1d13=_0x11cf[_0x16884c];return _0x1c1d13;};'use strict';var emlformat=require(_0xf11c('0x0'));var rimraf=require(_0xf11c('0x1'));var zipdir=require(_0xf11c('0x2'));var jsonpatch=require(_0xf11c('0x3'));var rp=require('request-promise');var moment=require(_0xf11c('0x4'));var BPromise=require(_0xf11c('0x5'));var Mustache=require(_0xf11c('0x6'));var util=require(_0xf11c('0x7'));var path=require(_0xf11c('0x8'));var sox=require(_0xf11c('0x9'));var csv=require(_0xf11c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf11c('0xb'));var _=require(_0xf11c('0xc'));var squel=require(_0xf11c('0xd'));var crypto=require(_0xf11c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf11c('0xa'));var querystring=require(_0xf11c('0xf'));var Papa=require(_0xf11c('0x10'));var Redis=require(_0xf11c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf11c('0x12'));var as=require(_0xf11c('0x13'));var hardwareService=require(_0xf11c('0x14'));var logger=require('../../config/logger')(_0xf11c('0x15'));var utils=require('../../config/utils');var config=require(_0xf11c('0x16'));var licenseUtil=require(_0xf11c('0x17'));var db=require(_0xf11c('0x18'))['db'];function respondWithStatusCode(_0x575c82,_0x582f59){_0x582f59=_0x582f59||0xcc;return function(_0x4aaa78){if(_0x4aaa78){return _0x575c82[_0xf11c('0x19')](_0x582f59);}return _0x575c82['status'](_0x582f59)['end']();};}function respondWithResult(_0x5024d9,_0x369cfb){_0x369cfb=_0x369cfb||0xc8;return function(_0x4dfd63){if(_0x4dfd63){return _0x5024d9[_0xf11c('0x1a')](_0x369cfb)[_0xf11c('0x1b')](_0x4dfd63);}};}function respondWithFilteredResult(_0x2b7c21,_0x402ad4){return function(_0x379f60){if(_0x379f60){var _0x5edbd3=typeof _0x402ad4['offset']===_0xf11c('0x1c')&&typeof _0x402ad4[_0xf11c('0x1d')]==='undefined';var _0x5f4d13=_0x379f60[_0xf11c('0x1e')];var _0xde2fc0=_0x5edbd3?0x0:_0x402ad4['offset'];var _0x2a1571=_0x5edbd3?_0x379f60[_0xf11c('0x1e')]:_0x402ad4['offset']+_0x402ad4[_0xf11c('0x1d')];var _0x406bc7;if(_0x2a1571>=_0x5f4d13){_0x2a1571=_0x5f4d13;_0x406bc7=0xc8;}else{_0x406bc7=0xce;}_0x2b7c21[_0xf11c('0x1a')](_0x406bc7);return _0x2b7c21[_0xf11c('0x1f')]('Content-Range',_0xde2fc0+'-'+_0x2a1571+'/'+_0x5f4d13)['json'](_0x379f60);}return null;};}function patchUpdates(_0x25a844){return function(_0x5d7726){try{jsonpatch[_0xf11c('0x20')](_0x5d7726,_0x25a844,!![]);}catch(_0xe2f71b){return BPromise[_0xf11c('0x21')](_0xe2f71b);}return _0x5d7726[_0xf11c('0x22')]();};}function saveUpdates(_0x1e63d1,_0xe3f0cb){return function(_0x3f25b4){if(_0x3f25b4){return _0x3f25b4[_0xf11c('0x23')](_0x1e63d1)[_0xf11c('0x24')](function(_0x4ff70b){return _0x4ff70b;});}return null;};}function removeEntity(_0x41eb16,_0x4be484){return function(_0x3a743b){if(_0x3a743b){return _0x3a743b[_0xf11c('0x25')]()['then'](function(){_0x41eb16[_0xf11c('0x1a')](0xcc)[_0xf11c('0x26')]();});}};}function handleEntityNotFound(_0x2ee712,_0x297c28){return function(_0x44c8bb){if(!_0x44c8bb){_0x2ee712[_0xf11c('0x19')](0x194);}return _0x44c8bb;};}function handleError(_0x5dca04,_0x5318be){_0x5318be=_0x5318be||0x1f4;return function(_0x2a0815){logger['error'](_0x2a0815['stack']);if(_0x2a0815[_0xf11c('0x27')]){delete _0x2a0815[_0xf11c('0x27')];}_0x5dca04[_0xf11c('0x1a')](_0x5318be)[_0xf11c('0x28')](_0x2a0815);};}exports['index']=function(_0x381fb3,_0x2c7b35){var _0x5b6cc9={},_0x1b2c76={},_0x2f4b0e={'count':0x0,'rows':[]};var _0x1063fd=_[_0xf11c('0x29')](db[_0xf11c('0x2a')][_0xf11c('0x2b')],function(_0x30e841){return{'name':_0x30e841[_0xf11c('0x2c')],'type':_0x30e841[_0xf11c('0x2d')]['key']};});_0x1b2c76['model']=_[_0xf11c('0x29')](_0x1063fd,'name');_0x1b2c76[_0xf11c('0x2e')]=_[_0xf11c('0x2f')](_0x381fb3[_0xf11c('0x2e')]);_0x1b2c76[_0xf11c('0x30')]=_['intersection'](_0x1b2c76[_0xf11c('0x31')],_0x1b2c76[_0xf11c('0x2e')]);_0x5b6cc9[_0xf11c('0x32')]=_['intersection'](_0x1b2c76[_0xf11c('0x31')],qs[_0xf11c('0x33')](_0x381fb3[_0xf11c('0x2e')][_0xf11c('0x33')]));_0x5b6cc9[_0xf11c('0x32')]=_0x5b6cc9[_0xf11c('0x32')]['length']?_0x5b6cc9['attributes']:_0x1b2c76[_0xf11c('0x31')];if(!_0x381fb3[_0xf11c('0x2e')][_0xf11c('0x34')](_0xf11c('0x35'))){_0x5b6cc9[_0xf11c('0x1d')]=qs['limit'](_0x381fb3[_0xf11c('0x2e')][_0xf11c('0x1d')]);_0x5b6cc9[_0xf11c('0x36')]=qs[_0xf11c('0x36')](_0x381fb3['query']['offset']);}_0x5b6cc9[_0xf11c('0x37')]=qs['sort'](_0x381fb3[_0xf11c('0x2e')]['sort']);_0x5b6cc9[_0xf11c('0x38')]=qs[_0xf11c('0x30')](_[_0xf11c('0x39')](_0x381fb3[_0xf11c('0x2e')],_0x1b2c76[_0xf11c('0x30')]),_0x1063fd);if(_0x381fb3[_0xf11c('0x2e')][_0xf11c('0x3a')]){_0x5b6cc9[_0xf11c('0x38')]=_[_0xf11c('0x3b')](_0x5b6cc9[_0xf11c('0x38')],{'$or':_[_0xf11c('0x29')](_0x1063fd,function(_0x3086c6){if(_0x3086c6[_0xf11c('0x2d')]!==_0xf11c('0x3c')){var _0x14f54a={};_0x14f54a[_0x3086c6[_0xf11c('0x27')]]={'$like':'%'+_0x381fb3[_0xf11c('0x2e')]['filter']+'%'};return _0x14f54a;}})});}_0x5b6cc9=_['merge']({},_0x5b6cc9,_0x381fb3[_0xf11c('0x3d')]);var _0x39e2a7={'where':_0x5b6cc9['where']};return db[_0xf11c('0x2a')][_0xf11c('0x1e')](_0x39e2a7)[_0xf11c('0x24')](function(_0x5b799e){_0x2f4b0e[_0xf11c('0x1e')]=_0x5b799e;if(_0x381fb3[_0xf11c('0x2e')][_0xf11c('0x3e')]){_0x5b6cc9['include']=[{'all':!![]}];}return db[_0xf11c('0x2a')][_0xf11c('0x3f')](_0x5b6cc9);})[_0xf11c('0x24')](function(_0x525dcd){_0x2f4b0e['rows']=_0x525dcd;return _0x2f4b0e;})[_0xf11c('0x24')](respondWithFilteredResult(_0x2c7b35,_0x5b6cc9))[_0xf11c('0x40')](handleError(_0x2c7b35,null));};exports[_0xf11c('0x41')]=function(_0x35061e,_0xedff32){var _0x3d7bef={'raw':![],'where':{'id':_0x35061e[_0xf11c('0x42')]['id']}},_0x5ee44d={};_0x5ee44d[_0xf11c('0x31')]=_['keys'](db[_0xf11c('0x2a')][_0xf11c('0x2b')]);_0x5ee44d[_0xf11c('0x2e')]=_[_0xf11c('0x2f')](_0x35061e['query']);_0x5ee44d['filters']=_[_0xf11c('0x43')](_0x5ee44d[_0xf11c('0x31')],_0x5ee44d[_0xf11c('0x2e')]);_0x3d7bef[_0xf11c('0x32')]=_[_0xf11c('0x43')](_0x5ee44d['model'],qs[_0xf11c('0x33')](_0x35061e[_0xf11c('0x2e')]['fields']));_0x3d7bef[_0xf11c('0x32')]=_0x3d7bef[_0xf11c('0x32')][_0xf11c('0x44')]?_0x3d7bef[_0xf11c('0x32')]:_0x5ee44d['model'];if(_0x35061e[_0xf11c('0x2e')][_0xf11c('0x3e')]){_0x3d7bef[_0xf11c('0x45')]=[{'all':!![]}];}_0x3d7bef=_[_0xf11c('0x3b')]({},_0x3d7bef,_0x35061e[_0xf11c('0x3d')]);return db[_0xf11c('0x2a')][_0xf11c('0x46')](_0x3d7bef)['then'](handleEntityNotFound(_0xedff32,null))[_0xf11c('0x24')](respondWithResult(_0xedff32,null))[_0xf11c('0x40')](handleError(_0xedff32,null));};exports[_0xf11c('0x47')]=function(_0x43c094,_0x2a3079){return db[_0xf11c('0x2a')][_0xf11c('0x47')](_0x43c094[_0xf11c('0x48')],{})[_0xf11c('0x24')](respondWithResult(_0x2a3079,0xc9))['catch'](handleError(_0x2a3079,null));};exports[_0xf11c('0x23')]=function(_0x48c4fb,_0x204b81){if(_0x48c4fb['body']['id']){delete _0x48c4fb['body']['id'];}return db[_0xf11c('0x2a')][_0xf11c('0x46')]({'where':{'id':_0x48c4fb['params']['id']}})[_0xf11c('0x24')](handleEntityNotFound(_0x204b81,null))['then'](saveUpdates(_0x48c4fb[_0xf11c('0x48')],null))[_0xf11c('0x24')](respondWithResult(_0x204b81,null))[_0xf11c('0x40')](handleError(_0x204b81,null));};exports[_0xf11c('0x25')]=function(_0x3dc044,_0x3507bd){return db[_0xf11c('0x2a')]['find']({'where':{'id':_0x3dc044[_0xf11c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3507bd,null))[_0xf11c('0x24')](removeEntity(_0x3507bd,null))[_0xf11c('0x40')](handleError(_0x3507bd,null));};exports[_0xf11c('0x49')]=function(_0x21db37,_0x4e8ea5,_0x17358e){var _0x1ed761={};var _0x33f853={};var _0xde5e39;var _0x12e475;return db['Dynamics365Configuration'][_0xf11c('0x4a')]({'where':{'id':_0x21db37[_0xf11c('0x42')]['id']}})[_0xf11c('0x24')](handleEntityNotFound(_0x4e8ea5,null))[_0xf11c('0x24')](function(_0x343e30){if(_0x343e30){_0xde5e39=_0x343e30;_0x33f853[_0xf11c('0x31')]=_[_0xf11c('0x2f')](db['Dynamics365Field'][_0xf11c('0x2b')]);_0x33f853['query']=_[_0xf11c('0x2f')](_0x21db37[_0xf11c('0x2e')]);_0x33f853[_0xf11c('0x30')]=_[_0xf11c('0x43')](_0x33f853['model'],_0x33f853['query']);_0x1ed761['attributes']=_['intersection'](_0x33f853[_0xf11c('0x31')],qs[_0xf11c('0x33')](_0x21db37[_0xf11c('0x2e')][_0xf11c('0x33')]));_0x1ed761[_0xf11c('0x32')]=_0x1ed761['attributes'][_0xf11c('0x44')]?_0x1ed761[_0xf11c('0x32')]:_0x33f853[_0xf11c('0x31')];_0x1ed761[_0xf11c('0x37')]=qs[_0xf11c('0x4b')](_0x21db37[_0xf11c('0x2e')]['sort']);_0x1ed761[_0xf11c('0x38')]=qs[_0xf11c('0x30')](_[_0xf11c('0x39')](_0x21db37[_0xf11c('0x2e')],_0x33f853[_0xf11c('0x30')]));if(_0x21db37[_0xf11c('0x2e')][_0xf11c('0x3a')]){_0x1ed761[_0xf11c('0x38')]=_[_0xf11c('0x3b')](_0x1ed761['where'],{'$or':_['map'](_0x1ed761[_0xf11c('0x32')],function(_0x2a3210){var _0x1893b1={};_0x1893b1[_0x2a3210]={'$like':'%'+_0x21db37['query']['filter']+'%'};return _0x1893b1;})});}_0x1ed761=_[_0xf11c('0x3b')]({},_0x1ed761,_0x21db37[_0xf11c('0x3d')]);return _0xde5e39[_0xf11c('0x49')](_0x1ed761);}})['then'](function(_0x4c61d9){if(_0x4c61d9){_0x12e475=_0x4c61d9[_0xf11c('0x44')];if(!_0x21db37[_0xf11c('0x2e')][_0xf11c('0x34')](_0xf11c('0x35'))){_0x1ed761['limit']=qs[_0xf11c('0x1d')](_0x21db37['query'][_0xf11c('0x1d')]);_0x1ed761[_0xf11c('0x36')]=qs[_0xf11c('0x36')](_0x21db37[_0xf11c('0x2e')]['offset']);}return _0xde5e39[_0xf11c('0x49')](_0x1ed761);}})['then'](function(_0x173676){if(_0x173676){return _0x173676?{'count':_0x12e475,'rows':_0x173676}:null;}})[_0xf11c('0x24')](respondWithResult(_0x4e8ea5,null))[_0xf11c('0x40')](handleError(_0x4e8ea5,null));};exports[_0xf11c('0x4c')]=function(_0x397f67,_0x1df0d4,_0x19752c){var _0xbe75e6={};var _0x4dba9b={};var _0x108994;var _0x1024fc;return db[_0xf11c('0x2a')][_0xf11c('0x4a')]({'where':{'id':_0x397f67['params']['id']}})[_0xf11c('0x24')](handleEntityNotFound(_0x1df0d4,null))[_0xf11c('0x24')](function(_0x2b9952){if(_0x2b9952){_0x108994=_0x2b9952;_0x4dba9b[_0xf11c('0x31')]=_['keys'](db[_0xf11c('0x4d')][_0xf11c('0x2b')]);_0x4dba9b[_0xf11c('0x2e')]=_[_0xf11c('0x2f')](_0x397f67[_0xf11c('0x2e')]);_0x4dba9b[_0xf11c('0x30')]=_[_0xf11c('0x43')](_0x4dba9b['model'],_0x4dba9b[_0xf11c('0x2e')]);_0xbe75e6[_0xf11c('0x32')]=_[_0xf11c('0x43')](_0x4dba9b[_0xf11c('0x31')],qs[_0xf11c('0x33')](_0x397f67[_0xf11c('0x2e')][_0xf11c('0x33')]));_0xbe75e6[_0xf11c('0x32')]=_0xbe75e6[_0xf11c('0x32')][_0xf11c('0x44')]?_0xbe75e6[_0xf11c('0x32')]:_0x4dba9b[_0xf11c('0x31')];_0xbe75e6[_0xf11c('0x37')]=qs[_0xf11c('0x4b')](_0x397f67['query'][_0xf11c('0x4b')]);_0xbe75e6[_0xf11c('0x38')]=qs[_0xf11c('0x30')](_['pick'](_0x397f67[_0xf11c('0x2e')],_0x4dba9b[_0xf11c('0x30')]));if(_0x397f67[_0xf11c('0x2e')][_0xf11c('0x3a')]){_0xbe75e6['where']=_[_0xf11c('0x3b')](_0xbe75e6[_0xf11c('0x38')],{'$or':_[_0xf11c('0x29')](_0xbe75e6[_0xf11c('0x32')],function(_0x224ba2){var _0x10da46={};_0x10da46[_0x224ba2]={'$like':'%'+_0x397f67[_0xf11c('0x2e')][_0xf11c('0x3a')]+'%'};return _0x10da46;})});}_0xbe75e6=_[_0xf11c('0x3b')]({},_0xbe75e6,_0x397f67['options']);return _0x108994[_0xf11c('0x4c')](_0xbe75e6);}})[_0xf11c('0x24')](function(_0x72d1e8){if(_0x72d1e8){_0x1024fc=_0x72d1e8[_0xf11c('0x44')];if(!_0x397f67['query'][_0xf11c('0x34')](_0xf11c('0x35'))){_0xbe75e6[_0xf11c('0x1d')]=qs['limit'](_0x397f67['query'][_0xf11c('0x1d')]);_0xbe75e6[_0xf11c('0x36')]=qs[_0xf11c('0x36')](_0x397f67['query'][_0xf11c('0x36')]);}return _0x108994[_0xf11c('0x4c')](_0xbe75e6);}})[_0xf11c('0x24')](function(_0x13bf14){if(_0x13bf14){return _0x13bf14?{'count':_0x1024fc,'rows':_0x13bf14}:null;}})[_0xf11c('0x24')](respondWithResult(_0x1df0d4,null))[_0xf11c('0x40')](handleError(_0x1df0d4,null));};exports['getDescriptions']=function(_0x114750,_0x3fbcb4,_0x10ea9d){var _0x3e47a7={};var _0x46bbbe={};var _0x1250e5;var _0x13088c;return db[_0xf11c('0x2a')]['findOne']({'where':{'id':_0x114750[_0xf11c('0x42')]['id']}})[_0xf11c('0x24')](handleEntityNotFound(_0x3fbcb4,null))['then'](function(_0x17ce87){if(_0x17ce87){_0x1250e5=_0x17ce87;_0x46bbbe['model']=_[_0xf11c('0x2f')](db[_0xf11c('0x4d')]['rawAttributes']);_0x46bbbe[_0xf11c('0x2e')]=_[_0xf11c('0x2f')](_0x114750[_0xf11c('0x2e')]);_0x46bbbe[_0xf11c('0x30')]=_[_0xf11c('0x43')](_0x46bbbe['model'],_0x46bbbe[_0xf11c('0x2e')]);_0x3e47a7[_0xf11c('0x32')]=_[_0xf11c('0x43')](_0x46bbbe[_0xf11c('0x31')],qs[_0xf11c('0x33')](_0x114750[_0xf11c('0x2e')][_0xf11c('0x33')]));_0x3e47a7[_0xf11c('0x32')]=_0x3e47a7[_0xf11c('0x32')][_0xf11c('0x44')]?_0x3e47a7[_0xf11c('0x32')]:_0x46bbbe[_0xf11c('0x31')];_0x3e47a7[_0xf11c('0x37')]=qs[_0xf11c('0x4b')](_0x114750['query'][_0xf11c('0x4b')]);_0x3e47a7[_0xf11c('0x38')]=qs[_0xf11c('0x30')](_['pick'](_0x114750[_0xf11c('0x2e')],_0x46bbbe[_0xf11c('0x30')]));if(_0x114750[_0xf11c('0x2e')][_0xf11c('0x3a')]){_0x3e47a7[_0xf11c('0x38')]=_[_0xf11c('0x3b')](_0x3e47a7[_0xf11c('0x38')],{'$or':_['map'](_0x3e47a7[_0xf11c('0x32')],function(_0x1805be){var _0x466862={};_0x466862[_0x1805be]={'$like':'%'+_0x114750[_0xf11c('0x2e')][_0xf11c('0x3a')]+'%'};return _0x466862;})});}_0x3e47a7=_['merge']({},_0x3e47a7,_0x114750[_0xf11c('0x3d')]);return _0x1250e5[_0xf11c('0x4e')](_0x3e47a7);}})[_0xf11c('0x24')](function(_0x394a17){if(_0x394a17){_0x13088c=_0x394a17[_0xf11c('0x44')];if(!_0x114750[_0xf11c('0x2e')]['hasOwnProperty'](_0xf11c('0x35'))){_0x3e47a7[_0xf11c('0x1d')]=qs[_0xf11c('0x1d')](_0x114750[_0xf11c('0x2e')][_0xf11c('0x1d')]);_0x3e47a7['offset']=qs['offset'](_0x114750[_0xf11c('0x2e')]['offset']);}return _0x1250e5[_0xf11c('0x4e')](_0x3e47a7);}})[_0xf11c('0x24')](function(_0x2dc941){if(_0x2dc941){return _0x2dc941?{'count':_0x13088c,'rows':_0x2dc941}:null;}})['then'](respondWithResult(_0x3fbcb4,null))[_0xf11c('0x40')](handleError(_0x3fbcb4,null));}; \ No newline at end of file +var _0x679c=['fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','merge','find','create','catch','update','body','findOne','Dynamics365Field','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes'];(function(_0x40635e,_0x5df898){var _0x41a30e=function(_0x2cdf2b){while(--_0x2cdf2b){_0x40635e['push'](_0x40635e['shift']());}};_0x41a30e(++_0x5df898);}(_0x679c,0xca));var _0xc679=function(_0x584953,_0x122a97){_0x584953=_0x584953-0x0;var _0x27a376=_0x679c[_0x584953];return _0x27a376;};'use strict';var emlformat=require(_0xc679('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc679('0x1'));var jsonpatch=require(_0xc679('0x2'));var rp=require('request-promise');var moment=require(_0xc679('0x3'));var BPromise=require(_0xc679('0x4'));var Mustache=require(_0xc679('0x5'));var util=require(_0xc679('0x6'));var path=require('path');var sox=require(_0xc679('0x7'));var csv=require(_0xc679('0x8'));var ejs=require(_0xc679('0x9'));var fs=require('fs');var fs_extra=require(_0xc679('0xa'));var _=require(_0xc679('0xb'));var squel=require(_0xc679('0xc'));var crypto=require(_0xc679('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc679('0x8'));var querystring=require(_0xc679('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc679('0xf'));var as=require(_0xc679('0x10'));var hardwareService=require(_0xc679('0x11'));var logger=require(_0xc679('0x12'))(_0xc679('0x13'));var utils=require(_0xc679('0x14'));var config=require(_0xc679('0x15'));var licenseUtil=require(_0xc679('0x16'));var db=require(_0xc679('0x17'))['db'];function respondWithStatusCode(_0x389374,_0xd89020){_0xd89020=_0xd89020||0xcc;return function(_0x42ae4b){if(_0x42ae4b){return _0x389374[_0xc679('0x18')](_0xd89020);}return _0x389374[_0xc679('0x19')](_0xd89020)[_0xc679('0x1a')]();};}function respondWithResult(_0x21004a,_0x2a67c3){_0x2a67c3=_0x2a67c3||0xc8;return function(_0x315c3d){if(_0x315c3d){return _0x21004a[_0xc679('0x19')](_0x2a67c3)[_0xc679('0x1b')](_0x315c3d);}};}function respondWithFilteredResult(_0x39bc17,_0x74e1d7){return function(_0x4a5cd1){if(_0x4a5cd1){var _0x5ec705=typeof _0x74e1d7[_0xc679('0x1c')]==='undefined'&&typeof _0x74e1d7[_0xc679('0x1d')]===_0xc679('0x1e');var _0x2c65c0=_0x4a5cd1[_0xc679('0x1f')];var _0x212fed=_0x5ec705?0x0:_0x74e1d7[_0xc679('0x1c')];var _0x589f2e=_0x5ec705?_0x4a5cd1[_0xc679('0x1f')]:_0x74e1d7['offset']+_0x74e1d7[_0xc679('0x1d')];var _0x5a30f4;if(_0x589f2e>=_0x2c65c0){_0x589f2e=_0x2c65c0;_0x5a30f4=0xc8;}else{_0x5a30f4=0xce;}_0x39bc17[_0xc679('0x19')](_0x5a30f4);return _0x39bc17[_0xc679('0x20')](_0xc679('0x21'),_0x212fed+'-'+_0x589f2e+'/'+_0x2c65c0)['json'](_0x4a5cd1);}return null;};}function patchUpdates(_0xf592){return function(_0x46a4e6){try{jsonpatch[_0xc679('0x22')](_0x46a4e6,_0xf592,!![]);}catch(_0x1ed025){return BPromise[_0xc679('0x23')](_0x1ed025);}return _0x46a4e6[_0xc679('0x24')]();};}function saveUpdates(_0x3e6608,_0x81f7d2){return function(_0x2023a5){if(_0x2023a5){return _0x2023a5['update'](_0x3e6608)[_0xc679('0x25')](function(_0x376944){return _0x376944;});}return null;};}function removeEntity(_0x37c842,_0x2245d2){return function(_0x55eca6){if(_0x55eca6){return _0x55eca6[_0xc679('0x26')]()['then'](function(){_0x37c842[_0xc679('0x19')](0xcc)[_0xc679('0x1a')]();});}};}function handleEntityNotFound(_0x1148ba,_0x39487d){return function(_0x3e4eb1){if(!_0x3e4eb1){_0x1148ba[_0xc679('0x18')](0x194);}return _0x3e4eb1;};}function handleError(_0x171ef6,_0x331583){_0x331583=_0x331583||0x1f4;return function(_0x3d1864){logger[_0xc679('0x27')](_0x3d1864[_0xc679('0x28')]);if(_0x3d1864['name']){delete _0x3d1864[_0xc679('0x29')];}_0x171ef6[_0xc679('0x19')](_0x331583)[_0xc679('0x2a')](_0x3d1864);};}exports[_0xc679('0x2b')]=function(_0x10d54f,_0x41ce70){var _0x360a73={},_0x36f92c={},_0x419f21={'count':0x0,'rows':[]};var _0x3c1898=_[_0xc679('0x2c')](db[_0xc679('0x2d')][_0xc679('0x2e')],function(_0x506cca){return{'name':_0x506cca[_0xc679('0x2f')],'type':_0x506cca['type'][_0xc679('0x30')]};});_0x36f92c[_0xc679('0x31')]=_[_0xc679('0x2c')](_0x3c1898,'name');_0x36f92c['query']=_['keys'](_0x10d54f[_0xc679('0x32')]);_0x36f92c[_0xc679('0x33')]=_['intersection'](_0x36f92c[_0xc679('0x31')],_0x36f92c[_0xc679('0x32')]);_0x360a73['attributes']=_[_0xc679('0x34')](_0x36f92c[_0xc679('0x31')],qs[_0xc679('0x35')](_0x10d54f[_0xc679('0x32')][_0xc679('0x35')]));_0x360a73[_0xc679('0x36')]=_0x360a73['attributes'][_0xc679('0x37')]?_0x360a73[_0xc679('0x36')]:_0x36f92c['model'];if(!_0x10d54f[_0xc679('0x32')][_0xc679('0x38')](_0xc679('0x39'))){_0x360a73[_0xc679('0x1d')]=qs[_0xc679('0x1d')](_0x10d54f['query']['limit']);_0x360a73[_0xc679('0x1c')]=qs[_0xc679('0x1c')](_0x10d54f[_0xc679('0x32')]['offset']);}_0x360a73[_0xc679('0x3a')]=qs[_0xc679('0x3b')](_0x10d54f[_0xc679('0x32')][_0xc679('0x3b')]);_0x360a73[_0xc679('0x3c')]=qs[_0xc679('0x33')](_[_0xc679('0x3d')](_0x10d54f[_0xc679('0x32')],_0x36f92c[_0xc679('0x33')]),_0x3c1898);if(_0x10d54f[_0xc679('0x32')][_0xc679('0x3e')]){_0x360a73[_0xc679('0x3c')]=_['merge'](_0x360a73[_0xc679('0x3c')],{'$or':_['map'](_0x3c1898,function(_0x5da217){if(_0x5da217[_0xc679('0x3f')]!==_0xc679('0x40')){var _0x59b127={};_0x59b127[_0x5da217[_0xc679('0x29')]]={'$like':'%'+_0x10d54f['query'][_0xc679('0x3e')]+'%'};return _0x59b127;}})});}_0x360a73=_['merge']({},_0x360a73,_0x10d54f[_0xc679('0x41')]);var _0x207d99={'where':_0x360a73['where']};return db[_0xc679('0x2d')][_0xc679('0x1f')](_0x207d99)[_0xc679('0x25')](function(_0x934933){_0x419f21[_0xc679('0x1f')]=_0x934933;if(_0x10d54f[_0xc679('0x32')][_0xc679('0x42')]){_0x360a73[_0xc679('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xc679('0x44')](_0x360a73);})[_0xc679('0x25')](function(_0x4063ee){_0x419f21['rows']=_0x4063ee;return _0x419f21;})[_0xc679('0x25')](respondWithFilteredResult(_0x41ce70,_0x360a73))['catch'](handleError(_0x41ce70,null));};exports[_0xc679('0x45')]=function(_0x3f9974,_0x11b298){var _0x51a5b1={'raw':![],'where':{'id':_0x3f9974[_0xc679('0x46')]['id']}},_0x3157b9={};_0x3157b9['model']=_[_0xc679('0x47')](db[_0xc679('0x2d')][_0xc679('0x2e')]);_0x3157b9[_0xc679('0x32')]=_['keys'](_0x3f9974[_0xc679('0x32')]);_0x3157b9[_0xc679('0x33')]=_['intersection'](_0x3157b9[_0xc679('0x31')],_0x3157b9['query']);_0x51a5b1[_0xc679('0x36')]=_[_0xc679('0x34')](_0x3157b9[_0xc679('0x31')],qs[_0xc679('0x35')](_0x3f9974[_0xc679('0x32')][_0xc679('0x35')]));_0x51a5b1[_0xc679('0x36')]=_0x51a5b1[_0xc679('0x36')][_0xc679('0x37')]?_0x51a5b1[_0xc679('0x36')]:_0x3157b9[_0xc679('0x31')];if(_0x3f9974[_0xc679('0x32')]['includeAll']){_0x51a5b1[_0xc679('0x43')]=[{'all':!![]}];}_0x51a5b1=_[_0xc679('0x48')]({},_0x51a5b1,_0x3f9974[_0xc679('0x41')]);return db[_0xc679('0x2d')][_0xc679('0x49')](_0x51a5b1)['then'](handleEntityNotFound(_0x11b298,null))[_0xc679('0x25')](respondWithResult(_0x11b298,null))['catch'](handleError(_0x11b298,null));};exports[_0xc679('0x4a')]=function(_0x30887f,_0x510de6){return db['Dynamics365Configuration'][_0xc679('0x4a')](_0x30887f['body'],{})[_0xc679('0x25')](respondWithResult(_0x510de6,0xc9))[_0xc679('0x4b')](handleError(_0x510de6,null));};exports[_0xc679('0x4c')]=function(_0x3b283e,_0x59104b){if(_0x3b283e[_0xc679('0x4d')]['id']){delete _0x3b283e['body']['id'];}return db[_0xc679('0x2d')][_0xc679('0x49')]({'where':{'id':_0x3b283e[_0xc679('0x46')]['id']}})[_0xc679('0x25')](handleEntityNotFound(_0x59104b,null))[_0xc679('0x25')](saveUpdates(_0x3b283e[_0xc679('0x4d')],null))[_0xc679('0x25')](respondWithResult(_0x59104b,null))[_0xc679('0x4b')](handleError(_0x59104b,null));};exports[_0xc679('0x26')]=function(_0x26682f,_0x54c908){return db[_0xc679('0x2d')][_0xc679('0x49')]({'where':{'id':_0x26682f[_0xc679('0x46')]['id']}})['then'](handleEntityNotFound(_0x54c908,null))[_0xc679('0x25')](removeEntity(_0x54c908,null))[_0xc679('0x4b')](handleError(_0x54c908,null));};exports['getFields']=function(_0x371aa5,_0x46790d,_0x5f0051){var _0x31525e={};var _0x15ac74={};var _0x57de49;var _0x397c3e;return db[_0xc679('0x2d')][_0xc679('0x4e')]({'where':{'id':_0x371aa5[_0xc679('0x46')]['id']}})['then'](handleEntityNotFound(_0x46790d,null))['then'](function(_0x2531a8){if(_0x2531a8){_0x57de49=_0x2531a8;_0x15ac74['model']=_[_0xc679('0x47')](db[_0xc679('0x4f')]['rawAttributes']);_0x15ac74[_0xc679('0x32')]=_['keys'](_0x371aa5[_0xc679('0x32')]);_0x15ac74['filters']=_[_0xc679('0x34')](_0x15ac74[_0xc679('0x31')],_0x15ac74[_0xc679('0x32')]);_0x31525e[_0xc679('0x36')]=_[_0xc679('0x34')](_0x15ac74[_0xc679('0x31')],qs[_0xc679('0x35')](_0x371aa5[_0xc679('0x32')]['fields']));_0x31525e[_0xc679('0x36')]=_0x31525e[_0xc679('0x36')][_0xc679('0x37')]?_0x31525e[_0xc679('0x36')]:_0x15ac74[_0xc679('0x31')];_0x31525e[_0xc679('0x3a')]=qs['sort'](_0x371aa5[_0xc679('0x32')][_0xc679('0x3b')]);_0x31525e['where']=qs[_0xc679('0x33')](_[_0xc679('0x3d')](_0x371aa5['query'],_0x15ac74[_0xc679('0x33')]));if(_0x371aa5[_0xc679('0x32')][_0xc679('0x3e')]){_0x31525e[_0xc679('0x3c')]=_[_0xc679('0x48')](_0x31525e[_0xc679('0x3c')],{'$or':_[_0xc679('0x2c')](_0x31525e['attributes'],function(_0x2ab629){var _0x125e7f={};_0x125e7f[_0x2ab629]={'$like':'%'+_0x371aa5[_0xc679('0x32')][_0xc679('0x3e')]+'%'};return _0x125e7f;})});}_0x31525e=_[_0xc679('0x48')]({},_0x31525e,_0x371aa5[_0xc679('0x41')]);return _0x57de49[_0xc679('0x50')](_0x31525e);}})[_0xc679('0x25')](function(_0x51d0a5){if(_0x51d0a5){_0x397c3e=_0x51d0a5[_0xc679('0x37')];if(!_0x371aa5[_0xc679('0x32')][_0xc679('0x38')]('nolimit')){_0x31525e['limit']=qs[_0xc679('0x1d')](_0x371aa5[_0xc679('0x32')][_0xc679('0x1d')]);_0x31525e[_0xc679('0x1c')]=qs['offset'](_0x371aa5[_0xc679('0x32')][_0xc679('0x1c')]);}return _0x57de49['getFields'](_0x31525e);}})[_0xc679('0x25')](function(_0x20647e){if(_0x20647e){return _0x20647e?{'count':_0x397c3e,'rows':_0x20647e}:null;}})[_0xc679('0x25')](respondWithResult(_0x46790d,null))[_0xc679('0x4b')](handleError(_0x46790d,null));};exports[_0xc679('0x51')]=function(_0x1d2130,_0x49e630,_0x432934){var _0x242572={};var _0x438f4c={};var _0x485131;var _0x301f84;return db[_0xc679('0x2d')]['findOne']({'where':{'id':_0x1d2130[_0xc679('0x46')]['id']}})[_0xc679('0x25')](handleEntityNotFound(_0x49e630,null))[_0xc679('0x25')](function(_0x28a7c3){if(_0x28a7c3){_0x485131=_0x28a7c3;_0x438f4c[_0xc679('0x31')]=_['keys'](db[_0xc679('0x4f')][_0xc679('0x2e')]);_0x438f4c['query']=_[_0xc679('0x47')](_0x1d2130['query']);_0x438f4c[_0xc679('0x33')]=_[_0xc679('0x34')](_0x438f4c[_0xc679('0x31')],_0x438f4c[_0xc679('0x32')]);_0x242572[_0xc679('0x36')]=_[_0xc679('0x34')](_0x438f4c[_0xc679('0x31')],qs[_0xc679('0x35')](_0x1d2130[_0xc679('0x32')][_0xc679('0x35')]));_0x242572[_0xc679('0x36')]=_0x242572[_0xc679('0x36')][_0xc679('0x37')]?_0x242572[_0xc679('0x36')]:_0x438f4c['model'];_0x242572[_0xc679('0x3a')]=qs[_0xc679('0x3b')](_0x1d2130['query'][_0xc679('0x3b')]);_0x242572[_0xc679('0x3c')]=qs['filters'](_[_0xc679('0x3d')](_0x1d2130[_0xc679('0x32')],_0x438f4c[_0xc679('0x33')]));if(_0x1d2130[_0xc679('0x32')][_0xc679('0x3e')]){_0x242572[_0xc679('0x3c')]=_[_0xc679('0x48')](_0x242572[_0xc679('0x3c')],{'$or':_[_0xc679('0x2c')](_0x242572[_0xc679('0x36')],function(_0x4b0f2a){var _0x52ef03={};_0x52ef03[_0x4b0f2a]={'$like':'%'+_0x1d2130[_0xc679('0x32')][_0xc679('0x3e')]+'%'};return _0x52ef03;})});}_0x242572=_[_0xc679('0x48')]({},_0x242572,_0x1d2130[_0xc679('0x41')]);return _0x485131[_0xc679('0x51')](_0x242572);}})['then'](function(_0x23418b){if(_0x23418b){_0x301f84=_0x23418b[_0xc679('0x37')];if(!_0x1d2130[_0xc679('0x32')][_0xc679('0x38')](_0xc679('0x39'))){_0x242572['limit']=qs['limit'](_0x1d2130[_0xc679('0x32')][_0xc679('0x1d')]);_0x242572[_0xc679('0x1c')]=qs[_0xc679('0x1c')](_0x1d2130['query'][_0xc679('0x1c')]);}return _0x485131[_0xc679('0x51')](_0x242572);}})['then'](function(_0x4e6268){if(_0x4e6268){return _0x4e6268?{'count':_0x301f84,'rows':_0x4e6268}:null;}})[_0xc679('0x25')](respondWithResult(_0x49e630,null))[_0xc679('0x4b')](handleError(_0x49e630,null));};exports[_0xc679('0x52')]=function(_0x4c37e2,_0x3e007f,_0x2e2eaa){var _0x410e26={};var _0x19fa17={};var _0x248b08;var _0x51e840;return db[_0xc679('0x2d')][_0xc679('0x4e')]({'where':{'id':_0x4c37e2[_0xc679('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e007f,null))[_0xc679('0x25')](function(_0x8e46df){if(_0x8e46df){_0x248b08=_0x8e46df;_0x19fa17[_0xc679('0x31')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x19fa17[_0xc679('0x32')]=_[_0xc679('0x47')](_0x4c37e2[_0xc679('0x32')]);_0x19fa17[_0xc679('0x33')]=_[_0xc679('0x34')](_0x19fa17[_0xc679('0x31')],_0x19fa17[_0xc679('0x32')]);_0x410e26[_0xc679('0x36')]=_[_0xc679('0x34')](_0x19fa17['model'],qs[_0xc679('0x35')](_0x4c37e2['query'][_0xc679('0x35')]));_0x410e26[_0xc679('0x36')]=_0x410e26[_0xc679('0x36')][_0xc679('0x37')]?_0x410e26[_0xc679('0x36')]:_0x19fa17['model'];_0x410e26[_0xc679('0x3a')]=qs[_0xc679('0x3b')](_0x4c37e2[_0xc679('0x32')]['sort']);_0x410e26[_0xc679('0x3c')]=qs[_0xc679('0x33')](_[_0xc679('0x3d')](_0x4c37e2[_0xc679('0x32')],_0x19fa17[_0xc679('0x33')]));if(_0x4c37e2[_0xc679('0x32')]['filter']){_0x410e26[_0xc679('0x3c')]=_[_0xc679('0x48')](_0x410e26[_0xc679('0x3c')],{'$or':_[_0xc679('0x2c')](_0x410e26[_0xc679('0x36')],function(_0x4371fa){var _0x30eea9={};_0x30eea9[_0x4371fa]={'$like':'%'+_0x4c37e2['query'][_0xc679('0x3e')]+'%'};return _0x30eea9;})});}_0x410e26=_['merge']({},_0x410e26,_0x4c37e2[_0xc679('0x41')]);return _0x248b08['getDescriptions'](_0x410e26);}})['then'](function(_0x4cdf43){if(_0x4cdf43){_0x51e840=_0x4cdf43[_0xc679('0x37')];if(!_0x4c37e2[_0xc679('0x32')][_0xc679('0x38')]('nolimit')){_0x410e26['limit']=qs['limit'](_0x4c37e2['query']['limit']);_0x410e26[_0xc679('0x1c')]=qs[_0xc679('0x1c')](_0x4c37e2['query'][_0xc679('0x1c')]);}return _0x248b08['getDescriptions'](_0x410e26);}})['then'](function(_0x547d16){if(_0x547d16){return _0x547d16?{'count':_0x51e840,'rows':_0x547d16}:null;}})[_0xc679('0x25')](respondWithResult(_0x3e007f,null))['catch'](handleError(_0x3e007f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 23a8cd5..e547e02 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 _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0xc3aae7,_0x3bfa91){var _0x1f365a=function(_0x465838){while(--_0x465838){_0xc3aae7['push'](_0xc3aae7['shift']());}};_0x1f365a(++_0x3bfa91);}(_0x3e74,0x175));var _0x43e7=function(_0x58d80f,_0x470203){_0x58d80f=_0x58d80f-0x0;var _0xc867d6=_0x3e74[_0x58d80f];return _0xc867d6;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x5761e4,_0x2f4895){var _0x490c68=function(_0x465a62){while(--_0x465a62){_0x5761e4['push'](_0x5761e4['shift']());}};_0x490c68(++_0x2f4895);}(_0xb821,0xa7));var _0x1b82=function(_0x5978f1,_0x1702cc){_0x5978f1=_0x5978f1-0x0;var _0x2fe6e1=_0xb821[_0x5978f1];return _0x2fe6e1;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 6e03e04..5f02f65 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 _0x42c2=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch'];(function(_0x23dc0a,_0xcb2d56){var _0x344b73=function(_0x1cda4d){while(--_0x1cda4d){_0x23dc0a['push'](_0x23dc0a['shift']());}};_0x344b73(++_0xcb2d56);}(_0x42c2,0xdc));var _0x242c=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0x42c2[_0x43dc7e];return _0x21e12d;};'use strict';var _=require(_0x242c('0x0'));var util=require(_0x242c('0x1'));var moment=require('moment');var BPromise=require(_0x242c('0x2'));var rs=require(_0x242c('0x3'));var fs=require('fs');var Redis=require(_0x242c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x242c('0x5'));var logger=require(_0x242c('0x6'))(_0x242c('0x7'));var config=require(_0x242c('0x8'));var jayson=require(_0x242c('0x9'));var client=jayson[_0x242c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x260edd,_0x4286b1,_0x4f2e65){return new BPromise(function(_0x4664b1,_0x30d01c){return client[_0x242c('0xb')](_0x260edd,_0x4f2e65)[_0x242c('0xc')](function(_0xf35c04){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x4286b1,_0x242c('0xd'));logger['debug'](_0x242c('0xe'),_0x4286b1,_0x242c('0xd'),JSON[_0x242c('0xf')](_0xf35c04));if(_0xf35c04['error']){if(_0xf35c04['error'][_0x242c('0x10')]===0x1f4){logger[_0x242c('0x11')](_0x242c('0x12'),_0x4286b1,_0xf35c04[_0x242c('0x11')]['message']);return _0x30d01c(_0xf35c04[_0x242c('0x11')][_0x242c('0x13')]);}logger[_0x242c('0x11')](_0x242c('0x12'),_0x4286b1,_0xf35c04[_0x242c('0x11')][_0x242c('0x13')]);return _0x4664b1(_0xf35c04[_0x242c('0x11')][_0x242c('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x4286b1,'request\x20sent');_0x4664b1(_0xf35c04[_0x242c('0x14')][_0x242c('0x13')]);}})[_0x242c('0x15')](function(_0x28e9b7){logger['error'](_0x242c('0x12'),_0x4286b1,_0x28e9b7);_0x30d01c(_0x28e9b7);});});} \ No newline at end of file +var _0x00d7=['http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x188cc8,_0xd39746){var _0x4cb155=function(_0x2d2a6c){while(--_0x2d2a6c){_0x188cc8['push'](_0x188cc8['shift']());}};_0x4cb155(++_0xd39746);}(_0x00d7,0x7d));var _0x700d=function(_0xe532e3,_0x189ece){_0xe532e3=_0xe532e3-0x0;var _0x285483=_0x00d7[_0xe532e3];return _0x285483;};'use strict';var _=require('lodash');var util=require(_0x700d('0x0'));var moment=require(_0x700d('0x1'));var BPromise=require('bluebird');var rs=require(_0x700d('0x2'));var fs=require('fs');var Redis=require(_0x700d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x700d('0x4'))(_0x700d('0x5'));var config=require('../../config/environment');var jayson=require(_0x700d('0x6'));var client=jayson[_0x700d('0x7')][_0x700d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3aed,_0x2ec80c,_0x14bd38){return new BPromise(function(_0x93e92e,_0x35b0ea){return client['request'](_0x2f3aed,_0x14bd38)[_0x700d('0x9')](function(_0xabef09){logger[_0x700d('0xa')](_0x700d('0xb'),_0x2ec80c,_0x700d('0xc'));logger['debug'](_0x700d('0xd'),_0x2ec80c,'request\x20sent',JSON['stringify'](_0xabef09));if(_0xabef09[_0x700d('0xe')]){if(_0xabef09[_0x700d('0xe')][_0x700d('0xf')]===0x1f4){logger[_0x700d('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2ec80c,_0xabef09[_0x700d('0xe')]['message']);return _0x35b0ea(_0xabef09[_0x700d('0xe')]['message']);}logger[_0x700d('0xe')](_0x700d('0xb'),_0x2ec80c,_0xabef09[_0x700d('0xe')]['message']);return _0x93e92e(_0xabef09[_0x700d('0xe')][_0x700d('0x10')]);}else{logger[_0x700d('0xa')](_0x700d('0xb'),_0x2ec80c,_0x700d('0xc'));_0x93e92e(_0xabef09[_0x700d('0x11')]['message']);}})[_0x700d('0x12')](function(_0x45fb11){logger[_0x700d('0xe')](_0x700d('0xb'),_0x2ec80c,_0x45fb11);_0x35b0ea(_0x45fb11);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 5ceaefc..191d894 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 _0x3052=['update','delete','/:id','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','index','show','post','create'];(function(_0x2f7650,_0x16d848){var _0x3beecf=function(_0x320ea7){while(--_0x320ea7){_0x2f7650['push'](_0x2f7650['shift']());}};_0x3beecf(++_0x16d848);}(_0x3052,0xd5));var _0x2305=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3052[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x2305('0x0'));var path=require(_0x2305('0x1'));var timeout=require(_0x2305('0x2'));var express=require(_0x2305('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2305('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x2305('0x5')]('/',auth[_0x2305('0x6')](),controller[_0x2305('0x7')]);router[_0x2305('0x5')]('/:id',auth[_0x2305('0x6')](),controller[_0x2305('0x8')]);router[_0x2305('0x9')]('/',auth[_0x2305('0x6')](),controller[_0x2305('0xa')]);router['put']('/:id',auth[_0x2305('0x6')](),controller[_0x2305('0xb')]);router[_0x2305('0xc')](_0x2305('0xd'),auth[_0x2305('0x6')](),controller[_0x2305('0xe')]);module[_0x2305('0xf')]=router; \ No newline at end of file +var _0xc520=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x39fb6a,_0x8b07ae){var _0x1452a1=function(_0x391804){while(--_0x391804){_0x39fb6a['push'](_0x39fb6a['shift']());}};_0x1452a1(++_0x8b07ae);}(_0xc520,0x1f0));var _0x0c52=function(_0x473e96,_0x5855e8){_0x473e96=_0x473e96-0x0;var _0x2d8da5=_0xc520[_0x473e96];return _0x2d8da5;};'use strict';var multer=require(_0x0c52('0x0'));var util=require(_0x0c52('0x1'));var path=require('path');var timeout=require(_0x0c52('0x2'));var express=require(_0x0c52('0x3'));var router=express[_0x0c52('0x4')]();var fs_extra=require(_0x0c52('0x5'));var auth=require(_0x0c52('0x6'));var interaction=require(_0x0c52('0x7'));var config=require('../../config/environment');var controller=require(_0x0c52('0x8'));router[_0x0c52('0x9')]('/',auth[_0x0c52('0xa')](),controller[_0x0c52('0xb')]);router[_0x0c52('0x9')](_0x0c52('0xc'),auth['isAuthenticated'](),controller[_0x0c52('0xd')]);router[_0x0c52('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0c52('0xf')](_0x0c52('0xc'),auth[_0x0c52('0xa')](),controller[_0x0c52('0x10')]);router[_0x0c52('0x11')](_0x0c52('0xc'),auth[_0x0c52('0xa')](),controller[_0x0c52('0x12')]);module[_0x0c52('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 083a7b2..12d9e2c 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 _0xb851=['keyValue','string','STRING','customVariable','sequelize','exports','ENUM','variable'];(function(_0x59ad17,_0x4bf7cc){var _0x11178c=function(_0x5641d3){while(--_0x5641d3){_0x59ad17['push'](_0x59ad17['shift']());}};_0x11178c(++_0x4bf7cc);}(_0xb851,0x114));var _0x1b85=function(_0x1e8bfb,_0x49c12b){_0x1e8bfb=_0x1e8bfb-0x0;var _0x2d70c9=_0xb851[_0x1e8bfb];return _0x2d70c9;};'use strict';var Sequelize=require(_0x1b85('0x0'));module[_0x1b85('0x1')]={'type':{'type':Sequelize[_0x1b85('0x2')]('string',_0x1b85('0x3'),'customVariable',_0x1b85('0x4'),'picklist'),'defaultValue':_0x1b85('0x5')},'content':{'type':Sequelize[_0x1b85('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1b85('0x2')](_0x1b85('0x5'),_0x1b85('0x3'),_0x1b85('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1b85('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbc1a=['STRING','customVariable','BOOLEAN','ENUM','string','variable','keyValue','picklist'];(function(_0x5e6c68,_0x5929eb){var _0x384213=function(_0x2e6a12){while(--_0x2e6a12){_0x5e6c68['push'](_0x5e6c68['shift']());}};_0x384213(++_0x5929eb);}(_0xbc1a,0x6b));var _0xabc1=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xbc1a[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xabc1('0x0')](_0xabc1('0x1'),_0xabc1('0x2'),'customVariable',_0xabc1('0x3'),_0xabc1('0x4')),'defaultValue':_0xabc1('0x1')},'content':{'type':Sequelize[_0xabc1('0x5')]},'key':{'type':Sequelize[_0xabc1('0x5')]},'keyType':{'type':Sequelize[_0xabc1('0x0')](_0xabc1('0x1'),_0xabc1('0x2'),_0xabc1('0x6'))},'keyContent':{'type':Sequelize[_0xabc1('0x5')]},'idField':{'type':Sequelize[_0xabc1('0x5')]},'nameField':{'type':Sequelize[_0xabc1('0x5')]},'customField':{'type':Sequelize[_0xabc1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xabc1('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ed1c044..e0ce8c5 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 _0x47fb=['index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Dynamics365Field','includeAll','include','findAll','catch','show','keys','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x47fb,0xb3));var _0xb47f=function(_0x3d21fb,_0x4fa5ec){_0x3d21fb=_0x3d21fb-0x0;var _0x1f649a=_0x47fb[_0x3d21fb];return _0x1f649a;};'use strict';var emlformat=require(_0xb47f('0x0'));var rimraf=require(_0xb47f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb47f('0x2'));var rp=require(_0xb47f('0x3'));var moment=require(_0xb47f('0x4'));var BPromise=require(_0xb47f('0x5'));var Mustache=require('mustache');var util=require(_0xb47f('0x6'));var path=require(_0xb47f('0x7'));var sox=require(_0xb47f('0x8'));var csv=require('to-csv');var ejs=require(_0xb47f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb47f('0xa'));var squel=require('squel');var crypto=require(_0xb47f('0xb'));var jsforce=require(_0xb47f('0xc'));var deskjs=require(_0xb47f('0xd'));var toCsv=require(_0xb47f('0xe'));var querystring=require(_0xb47f('0xf'));var Papa=require(_0xb47f('0x10'));var Redis=require(_0xb47f('0x11'));var authService=require(_0xb47f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb47f('0x13'));var hardwareService=require(_0xb47f('0x14'));var logger=require(_0xb47f('0x15'))(_0xb47f('0x16'));var utils=require(_0xb47f('0x17'));var config=require(_0xb47f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb47f('0x19'))['db'];function respondWithStatusCode(_0x4bf257,_0x4d71df){_0x4d71df=_0x4d71df||0xcc;return function(_0x866fa9){if(_0x866fa9){return _0x4bf257['sendStatus'](_0x4d71df);}return _0x4bf257['status'](_0x4d71df)[_0xb47f('0x1a')]();};}function respondWithResult(_0x1bc2d4,_0x502b15){_0x502b15=_0x502b15||0xc8;return function(_0x55086a){if(_0x55086a){return _0x1bc2d4['status'](_0x502b15)['json'](_0x55086a);}};}function respondWithFilteredResult(_0x5b783f,_0x478b7f){return function(_0x3939e2){if(_0x3939e2){var _0x2f5682=typeof _0x478b7f['offset']===_0xb47f('0x1b')&&typeof _0x478b7f[_0xb47f('0x1c')]===_0xb47f('0x1b');var _0x432830=_0x3939e2[_0xb47f('0x1d')];var _0x48c5ce=_0x2f5682?0x0:_0x478b7f[_0xb47f('0x1e')];var _0xe6aec6=_0x2f5682?_0x3939e2[_0xb47f('0x1d')]:_0x478b7f['offset']+_0x478b7f[_0xb47f('0x1c')];var _0x3f76ff;if(_0xe6aec6>=_0x432830){_0xe6aec6=_0x432830;_0x3f76ff=0xc8;}else{_0x3f76ff=0xce;}_0x5b783f[_0xb47f('0x1f')](_0x3f76ff);return _0x5b783f[_0xb47f('0x20')](_0xb47f('0x21'),_0x48c5ce+'-'+_0xe6aec6+'/'+_0x432830)[_0xb47f('0x22')](_0x3939e2);}return null;};}function patchUpdates(_0x202768){return function(_0xe55196){try{jsonpatch[_0xb47f('0x23')](_0xe55196,_0x202768,!![]);}catch(_0x181d64){return BPromise[_0xb47f('0x24')](_0x181d64);}return _0xe55196[_0xb47f('0x25')]();};}function saveUpdates(_0x54c1ab,_0x2d6b49){return function(_0xeaf8b3){if(_0xeaf8b3){return _0xeaf8b3[_0xb47f('0x26')](_0x54c1ab)[_0xb47f('0x27')](function(_0x11cd86){return _0x11cd86;});}return null;};}function removeEntity(_0x19d79b,_0x277a31){return function(_0x1ac91f){if(_0x1ac91f){return _0x1ac91f[_0xb47f('0x28')]()[_0xb47f('0x27')](function(){_0x19d79b[_0xb47f('0x1f')](0xcc)[_0xb47f('0x1a')]();});}};}function handleEntityNotFound(_0x168a83,_0x41fdff){return function(_0x810bf){if(!_0x810bf){_0x168a83[_0xb47f('0x29')](0x194);}return _0x810bf;};}function handleError(_0x4de307,_0x2c95ce){_0x2c95ce=_0x2c95ce||0x1f4;return function(_0x4cf9e6){logger[_0xb47f('0x2a')](_0x4cf9e6[_0xb47f('0x2b')]);if(_0x4cf9e6[_0xb47f('0x2c')]){delete _0x4cf9e6['name'];}_0x4de307[_0xb47f('0x1f')](_0x2c95ce)[_0xb47f('0x2d')](_0x4cf9e6);};}exports[_0xb47f('0x2e')]=function(_0x263888,_0x4a01a7){var _0x302b1d={},_0x15bd31={},_0x49d7c2={'count':0x0,'rows':[]};var _0x1cdc8e=_[_0xb47f('0x2f')](db['Dynamics365Field'][_0xb47f('0x30')],function(_0x45d7bf){return{'name':_0x45d7bf['fieldName'],'type':_0x45d7bf[_0xb47f('0x31')]['key']};});_0x15bd31[_0xb47f('0x32')]=_['map'](_0x1cdc8e,'name');_0x15bd31[_0xb47f('0x33')]=_['keys'](_0x263888[_0xb47f('0x33')]);_0x15bd31[_0xb47f('0x34')]=_[_0xb47f('0x35')](_0x15bd31[_0xb47f('0x32')],_0x15bd31[_0xb47f('0x33')]);_0x302b1d[_0xb47f('0x36')]=_['intersection'](_0x15bd31['model'],qs[_0xb47f('0x37')](_0x263888[_0xb47f('0x33')][_0xb47f('0x37')]));_0x302b1d[_0xb47f('0x36')]=_0x302b1d[_0xb47f('0x36')]['length']?_0x302b1d[_0xb47f('0x36')]:_0x15bd31[_0xb47f('0x32')];if(!_0x263888[_0xb47f('0x33')][_0xb47f('0x38')](_0xb47f('0x39'))){_0x302b1d[_0xb47f('0x1c')]=qs[_0xb47f('0x1c')](_0x263888['query'][_0xb47f('0x1c')]);_0x302b1d[_0xb47f('0x1e')]=qs[_0xb47f('0x1e')](_0x263888[_0xb47f('0x33')][_0xb47f('0x1e')]);}_0x302b1d['order']=qs[_0xb47f('0x3a')](_0x263888[_0xb47f('0x33')][_0xb47f('0x3a')]);_0x302b1d[_0xb47f('0x3b')]=qs[_0xb47f('0x34')](_[_0xb47f('0x3c')](_0x263888['query'],_0x15bd31[_0xb47f('0x34')]),_0x1cdc8e);if(_0x263888['query'][_0xb47f('0x3d')]){_0x302b1d[_0xb47f('0x3b')]=_[_0xb47f('0x3e')](_0x302b1d[_0xb47f('0x3b')],{'$or':_[_0xb47f('0x2f')](_0x1cdc8e,function(_0x6c39ba){if(_0x6c39ba[_0xb47f('0x31')]!=='VIRTUAL'){var _0x128b9b={};_0x128b9b[_0x6c39ba[_0xb47f('0x2c')]]={'$like':'%'+_0x263888[_0xb47f('0x33')]['filter']+'%'};return _0x128b9b;}})});}_0x302b1d=_[_0xb47f('0x3e')]({},_0x302b1d,_0x263888[_0xb47f('0x3f')]);var _0x8e4114={'where':_0x302b1d['where']};return db[_0xb47f('0x40')][_0xb47f('0x1d')](_0x8e4114)[_0xb47f('0x27')](function(_0x955d36){_0x49d7c2['count']=_0x955d36;if(_0x263888[_0xb47f('0x33')][_0xb47f('0x41')]){_0x302b1d[_0xb47f('0x42')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xb47f('0x43')](_0x302b1d);})['then'](function(_0x424961){_0x49d7c2['rows']=_0x424961;return _0x49d7c2;})[_0xb47f('0x27')](respondWithFilteredResult(_0x4a01a7,_0x302b1d))[_0xb47f('0x44')](handleError(_0x4a01a7,null));};exports[_0xb47f('0x45')]=function(_0xabad31,_0x5052cb){var _0x5bb7f7={'raw':!![],'where':{'id':_0xabad31['params']['id']}},_0x5017df={};_0x5017df[_0xb47f('0x32')]=_[_0xb47f('0x46')](db['Dynamics365Field'][_0xb47f('0x30')]);_0x5017df['query']=_[_0xb47f('0x46')](_0xabad31[_0xb47f('0x33')]);_0x5017df['filters']=_[_0xb47f('0x35')](_0x5017df[_0xb47f('0x32')],_0x5017df['query']);_0x5bb7f7[_0xb47f('0x36')]=_[_0xb47f('0x35')](_0x5017df[_0xb47f('0x32')],qs[_0xb47f('0x37')](_0xabad31[_0xb47f('0x33')][_0xb47f('0x37')]));_0x5bb7f7[_0xb47f('0x36')]=_0x5bb7f7['attributes']['length']?_0x5bb7f7[_0xb47f('0x36')]:_0x5017df[_0xb47f('0x32')];if(_0xabad31['query'][_0xb47f('0x41')]){_0x5bb7f7[_0xb47f('0x42')]=[{'all':!![]}];}_0x5bb7f7=_[_0xb47f('0x3e')]({},_0x5bb7f7,_0xabad31[_0xb47f('0x3f')]);return db[_0xb47f('0x40')][_0xb47f('0x47')](_0x5bb7f7)[_0xb47f('0x27')](handleEntityNotFound(_0x5052cb,null))['then'](respondWithResult(_0x5052cb,null))[_0xb47f('0x44')](handleError(_0x5052cb,null));};exports[_0xb47f('0x48')]=function(_0x58f29d,_0x2ab2f0){return db['Dynamics365Field'][_0xb47f('0x48')](_0x58f29d[_0xb47f('0x49')],{})[_0xb47f('0x27')](respondWithResult(_0x2ab2f0,0xc9))['catch'](handleError(_0x2ab2f0,null));};exports[_0xb47f('0x26')]=function(_0x23798e,_0x486094){if(_0x23798e[_0xb47f('0x49')]['id']){delete _0x23798e[_0xb47f('0x49')]['id'];}return db[_0xb47f('0x40')][_0xb47f('0x47')]({'where':{'id':_0x23798e[_0xb47f('0x4a')]['id']}})[_0xb47f('0x27')](handleEntityNotFound(_0x486094,null))[_0xb47f('0x27')](saveUpdates(_0x23798e['body'],null))[_0xb47f('0x27')](respondWithResult(_0x486094,null))['catch'](handleError(_0x486094,null));};exports['destroy']=function(_0xc0ca29,_0x22406c){return db[_0xb47f('0x40')]['find']({'where':{'id':_0xc0ca29['params']['id']}})[_0xb47f('0x27')](handleEntityNotFound(_0x22406c,null))[_0xb47f('0x27')](removeEntity(_0x22406c,null))[_0xb47f('0x44')](handleError(_0x22406c,null));}; \ No newline at end of file +var _0x1026=['where','pick','merge','filter','includeAll','rows','catch','show','params','include','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','end','error','name','index','Dynamics365Field','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1c197e,_0x2dd3a7){var _0x5e31b7=function(_0x84c36){while(--_0x84c36){_0x1c197e['push'](_0x1c197e['shift']());}};_0x5e31b7(++_0x2dd3a7);}(_0x1026,0xef));var _0x6102=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x1026[_0x2b55b5];return _0x103d28;};'use strict';var emlformat=require(_0x6102('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6102('0x1'));var jsonpatch=require(_0x6102('0x2'));var rp=require(_0x6102('0x3'));var moment=require(_0x6102('0x4'));var BPromise=require(_0x6102('0x5'));var Mustache=require(_0x6102('0x6'));var util=require(_0x6102('0x7'));var path=require(_0x6102('0x8'));var sox=require(_0x6102('0x9'));var csv=require(_0x6102('0xa'));var ejs=require(_0x6102('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6102('0xc'));var jsforce=require(_0x6102('0xd'));var deskjs=require(_0x6102('0xe'));var toCsv=require(_0x6102('0xa'));var querystring=require(_0x6102('0xf'));var Papa=require(_0x6102('0x10'));var Redis=require(_0x6102('0x11'));var authService=require(_0x6102('0x12'));var qs=require(_0x6102('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6102('0x14'));var logger=require(_0x6102('0x15'))(_0x6102('0x16'));var utils=require(_0x6102('0x17'));var config=require(_0x6102('0x18'));var licenseUtil=require(_0x6102('0x19'));var db=require(_0x6102('0x1a'))['db'];function respondWithStatusCode(_0x2148f8,_0x1b7461){_0x1b7461=_0x1b7461||0xcc;return function(_0x327c51){if(_0x327c51){return _0x2148f8[_0x6102('0x1b')](_0x1b7461);}return _0x2148f8[_0x6102('0x1c')](_0x1b7461)['end']();};}function respondWithResult(_0x1651ca,_0x1fcd25){_0x1fcd25=_0x1fcd25||0xc8;return function(_0x31e51c){if(_0x31e51c){return _0x1651ca['status'](_0x1fcd25)['json'](_0x31e51c);}};}function respondWithFilteredResult(_0x347df2,_0x373612){return function(_0x514739){if(_0x514739){var _0x1e3888=typeof _0x373612[_0x6102('0x1d')]===_0x6102('0x1e')&&typeof _0x373612[_0x6102('0x1f')]===_0x6102('0x1e');var _0x154fd3=_0x514739[_0x6102('0x20')];var _0x12bc4b=_0x1e3888?0x0:_0x373612[_0x6102('0x1d')];var _0x40d886=_0x1e3888?_0x514739[_0x6102('0x20')]:_0x373612['offset']+_0x373612[_0x6102('0x1f')];var _0x51a114;if(_0x40d886>=_0x154fd3){_0x40d886=_0x154fd3;_0x51a114=0xc8;}else{_0x51a114=0xce;}_0x347df2[_0x6102('0x1c')](_0x51a114);return _0x347df2['set'](_0x6102('0x21'),_0x12bc4b+'-'+_0x40d886+'/'+_0x154fd3)[_0x6102('0x22')](_0x514739);}return null;};}function patchUpdates(_0x20418e){return function(_0x256d29){try{jsonpatch[_0x6102('0x23')](_0x256d29,_0x20418e,!![]);}catch(_0x47731f){return BPromise[_0x6102('0x24')](_0x47731f);}return _0x256d29['save']();};}function saveUpdates(_0x19ccf2,_0x2a63da){return function(_0x8749bb){if(_0x8749bb){return _0x8749bb[_0x6102('0x25')](_0x19ccf2)[_0x6102('0x26')](function(_0x4eb461){return _0x4eb461;});}return null;};}function removeEntity(_0x5f3a9c,_0x54b8be){return function(_0x3853b3){if(_0x3853b3){return _0x3853b3[_0x6102('0x27')]()[_0x6102('0x26')](function(){_0x5f3a9c[_0x6102('0x1c')](0xcc)[_0x6102('0x28')]();});}};}function handleEntityNotFound(_0x557b51,_0x5860cf){return function(_0x596862){if(!_0x596862){_0x557b51['sendStatus'](0x194);}return _0x596862;};}function handleError(_0x52da6f,_0x27f93f){_0x27f93f=_0x27f93f||0x1f4;return function(_0x5810b9){logger[_0x6102('0x29')](_0x5810b9['stack']);if(_0x5810b9['name']){delete _0x5810b9[_0x6102('0x2a')];}_0x52da6f[_0x6102('0x1c')](_0x27f93f)['send'](_0x5810b9);};}exports[_0x6102('0x2b')]=function(_0x33161c,_0x152bb7){var _0x2e15eb={},_0x41f604={},_0x592ee9={'count':0x0,'rows':[]};var _0x516096=_['map'](db[_0x6102('0x2c')][_0x6102('0x2d')],function(_0x41a0cf){return{'name':_0x41a0cf[_0x6102('0x2e')],'type':_0x41a0cf[_0x6102('0x2f')]['key']};});_0x41f604[_0x6102('0x30')]=_[_0x6102('0x31')](_0x516096,_0x6102('0x2a'));_0x41f604[_0x6102('0x32')]=_[_0x6102('0x33')](_0x33161c[_0x6102('0x32')]);_0x41f604[_0x6102('0x34')]=_[_0x6102('0x35')](_0x41f604['model'],_0x41f604[_0x6102('0x32')]);_0x2e15eb['attributes']=_[_0x6102('0x35')](_0x41f604[_0x6102('0x30')],qs[_0x6102('0x36')](_0x33161c['query'][_0x6102('0x36')]));_0x2e15eb[_0x6102('0x37')]=_0x2e15eb['attributes'][_0x6102('0x38')]?_0x2e15eb['attributes']:_0x41f604[_0x6102('0x30')];if(!_0x33161c[_0x6102('0x32')][_0x6102('0x39')](_0x6102('0x3a'))){_0x2e15eb[_0x6102('0x1f')]=qs['limit'](_0x33161c[_0x6102('0x32')]['limit']);_0x2e15eb['offset']=qs[_0x6102('0x1d')](_0x33161c[_0x6102('0x32')][_0x6102('0x1d')]);}_0x2e15eb[_0x6102('0x3b')]=qs[_0x6102('0x3c')](_0x33161c[_0x6102('0x32')][_0x6102('0x3c')]);_0x2e15eb[_0x6102('0x3d')]=qs[_0x6102('0x34')](_[_0x6102('0x3e')](_0x33161c[_0x6102('0x32')],_0x41f604[_0x6102('0x34')]),_0x516096);if(_0x33161c[_0x6102('0x32')]['filter']){_0x2e15eb['where']=_[_0x6102('0x3f')](_0x2e15eb['where'],{'$or':_[_0x6102('0x31')](_0x516096,function(_0xebce71){if(_0xebce71[_0x6102('0x2f')]!=='VIRTUAL'){var _0x2e40a9={};_0x2e40a9[_0xebce71[_0x6102('0x2a')]]={'$like':'%'+_0x33161c[_0x6102('0x32')][_0x6102('0x40')]+'%'};return _0x2e40a9;}})});}_0x2e15eb=_[_0x6102('0x3f')]({},_0x2e15eb,_0x33161c['options']);var _0x3fae1b={'where':_0x2e15eb[_0x6102('0x3d')]};return db['Dynamics365Field'][_0x6102('0x20')](_0x3fae1b)['then'](function(_0x1db7ed){_0x592ee9['count']=_0x1db7ed;if(_0x33161c[_0x6102('0x32')][_0x6102('0x41')]){_0x2e15eb['include']=[{'all':!![]}];}return db[_0x6102('0x2c')]['findAll'](_0x2e15eb);})[_0x6102('0x26')](function(_0x37a2ec){_0x592ee9[_0x6102('0x42')]=_0x37a2ec;return _0x592ee9;})['then'](respondWithFilteredResult(_0x152bb7,_0x2e15eb))[_0x6102('0x43')](handleError(_0x152bb7,null));};exports[_0x6102('0x44')]=function(_0x538b56,_0xcb8094){var _0xf4ef78={'raw':!![],'where':{'id':_0x538b56[_0x6102('0x45')]['id']}},_0x15a4e7={};_0x15a4e7[_0x6102('0x30')]=_[_0x6102('0x33')](db['Dynamics365Field'][_0x6102('0x2d')]);_0x15a4e7['query']=_[_0x6102('0x33')](_0x538b56[_0x6102('0x32')]);_0x15a4e7[_0x6102('0x34')]=_[_0x6102('0x35')](_0x15a4e7[_0x6102('0x30')],_0x15a4e7[_0x6102('0x32')]);_0xf4ef78['attributes']=_[_0x6102('0x35')](_0x15a4e7['model'],qs[_0x6102('0x36')](_0x538b56[_0x6102('0x32')][_0x6102('0x36')]));_0xf4ef78['attributes']=_0xf4ef78[_0x6102('0x37')][_0x6102('0x38')]?_0xf4ef78['attributes']:_0x15a4e7[_0x6102('0x30')];if(_0x538b56['query'][_0x6102('0x41')]){_0xf4ef78[_0x6102('0x46')]=[{'all':!![]}];}_0xf4ef78=_[_0x6102('0x3f')]({},_0xf4ef78,_0x538b56[_0x6102('0x47')]);return db[_0x6102('0x2c')][_0x6102('0x48')](_0xf4ef78)[_0x6102('0x26')](handleEntityNotFound(_0xcb8094,null))[_0x6102('0x26')](respondWithResult(_0xcb8094,null))[_0x6102('0x43')](handleError(_0xcb8094,null));};exports[_0x6102('0x49')]=function(_0x58ef16,_0x18a56c){return db[_0x6102('0x2c')][_0x6102('0x49')](_0x58ef16[_0x6102('0x4a')],{})['then'](respondWithResult(_0x18a56c,0xc9))[_0x6102('0x43')](handleError(_0x18a56c,null));};exports[_0x6102('0x25')]=function(_0x412a30,_0x236bd5){if(_0x412a30[_0x6102('0x4a')]['id']){delete _0x412a30[_0x6102('0x4a')]['id'];}return db[_0x6102('0x2c')][_0x6102('0x48')]({'where':{'id':_0x412a30[_0x6102('0x45')]['id']}})[_0x6102('0x26')](handleEntityNotFound(_0x236bd5,null))[_0x6102('0x26')](saveUpdates(_0x412a30['body'],null))[_0x6102('0x26')](respondWithResult(_0x236bd5,null))['catch'](handleError(_0x236bd5,null));};exports['destroy']=function(_0x5aaf3f,_0xf035d4){return db[_0x6102('0x2c')][_0x6102('0x48')]({'where':{'id':_0x5aaf3f['params']['id']}})[_0x6102('0x26')](handleEntityNotFound(_0xf035d4,null))[_0x6102('0x26')](removeEntity(_0xf035d4,null))[_0x6102('0x43')](handleError(_0xf035d4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 0379383..2723bad 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 _0x2915=['path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2611c7,_0x33f9c8){var _0xfbe54d=function(_0xcee2aa){while(--_0xcee2aa){_0x2611c7['push'](_0x2611c7['shift']());}};_0xfbe54d(++_0x33f9c8);}(_0x2915,0x14d));var _0x5291=function(_0x13239e,_0x1ff4d4){_0x13239e=_0x13239e-0x0;var _0x558aef=_0x2915[_0x13239e];return _0x558aef;};'use strict';var _=require(_0x5291('0x0'));var util=require(_0x5291('0x1'));var logger=require(_0x5291('0x2'))(_0x5291('0x3'));var moment=require(_0x5291('0x4'));var BPromise=require(_0x5291('0x5'));var rp=require(_0x5291('0x6'));var fs=require('fs');var path=require(_0x5291('0x7'));var rimraf=require('rimraf');var config=require(_0x5291('0x8'));var attributes=require(_0x5291('0x9'));module[_0x5291('0xa')]=function(_0x3cf39e,_0x58d9b2){return _0x3cf39e[_0x5291('0xb')](_0x5291('0xc'),attributes,{'tableName':_0x5291('0xd'),'paranoid':![],'indexes':[{'name':_0x5291('0xe'),'fields':[_0x5291('0xf'),_0x5291('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x811c=['bluebird','request-promise','path','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','../../config/logger','api'];(function(_0xd9a3c2,_0x29d426){var _0x15df3b=function(_0x1507d8){while(--_0x1507d8){_0xd9a3c2['push'](_0xd9a3c2['shift']());}};_0x15df3b(++_0x29d426);}(_0x811c,0xae));var _0xc811=function(_0x13643e,_0x4a4efa){_0x13643e=_0x13643e-0x0;var _0x5d11dc=_0x811c[_0x13643e];return _0x5d11dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc811('0x0'))(_0xc811('0x1'));var moment=require('moment');var BPromise=require(_0xc811('0x2'));var rp=require(_0xc811('0x3'));var fs=require('fs');var path=require(_0xc811('0x4'));var rimraf=require('rimraf');var config=require(_0xc811('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0xc811('0x6')]=function(_0x482d54,_0x354082){return _0x482d54[_0xc811('0x7')](_0xc811('0x8'),attributes,{'tableName':_0xc811('0x9'),'paranoid':![],'indexes':[{'name':_0xc811('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index a37b4ff..d631543 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 _0x3b98=['../../config/logger','rpc','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','../../mysqldb','../../config/utils'];(function(_0x521435,_0x36c7a3){var _0x533b57=function(_0x514c21){while(--_0x514c21){_0x521435['push'](_0x521435['shift']());}};_0x533b57(++_0x36c7a3);}(_0x3b98,0xd4));var _0x83b9=function(_0x70f71,_0x2689e1){_0x70f71=_0x70f71-0x0;var _0x5c37dc=_0x3b98[_0x70f71];return _0x5c37dc;};'use strict';var _=require(_0x83b9('0x0'));var util=require('util');var moment=require(_0x83b9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83b9('0x2'))['db'];var utils=require(_0x83b9('0x3'));var logger=require(_0x83b9('0x4'))(_0x83b9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x83b9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x28033c,_0x5ce91e,_0x2d4c65){return new BPromise(function(_0x4cdbf5,_0x47d0e3){return client[_0x83b9('0x7')](_0x28033c,_0x2d4c65)[_0x83b9('0x8')](function(_0x1a6116){logger[_0x83b9('0x9')](_0x83b9('0xa'),_0x5ce91e,_0x83b9('0xb'));logger[_0x83b9('0xc')](_0x83b9('0xd'),_0x5ce91e,_0x83b9('0xb'),JSON[_0x83b9('0xe')](_0x1a6116));if(_0x1a6116[_0x83b9('0xf')]){if(_0x1a6116['error']['code']===0x1f4){logger[_0x83b9('0xf')](_0x83b9('0xa'),_0x5ce91e,_0x1a6116['error'][_0x83b9('0x10')]);return _0x47d0e3(_0x1a6116['error'][_0x83b9('0x10')]);}logger[_0x83b9('0xf')](_0x83b9('0xa'),_0x5ce91e,_0x1a6116[_0x83b9('0xf')]['message']);return _0x4cdbf5(_0x1a6116[_0x83b9('0xf')][_0x83b9('0x10')]);}else{logger[_0x83b9('0x9')](_0x83b9('0xa'),_0x5ce91e,_0x83b9('0xb'));_0x4cdbf5(_0x1a6116[_0x83b9('0x11')][_0x83b9('0x10')]);}})['catch'](function(_0x4134b8){logger[_0x83b9('0xf')](_0x83b9('0xa'),_0x5ce91e,_0x4134b8);_0x47d0e3(_0x4134b8);});});} \ No newline at end of file +var _0xee80=['request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1c2fc1,_0xe8cb37){var _0x29de42=function(_0x171303){while(--_0x171303){_0x1c2fc1['push'](_0x1c2fc1['shift']());}};_0x29de42(++_0xe8cb37);}(_0xee80,0x1d1));var _0x0ee8=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xee80[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x0ee8('0x0'));var util=require(_0x0ee8('0x1'));var moment=require('moment');var BPromise=require(_0x0ee8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ee8('0x3'));var db=require(_0x0ee8('0x4'))['db'];var utils=require(_0x0ee8('0x5'));var logger=require(_0x0ee8('0x6'))(_0x0ee8('0x7'));var config=require(_0x0ee8('0x8'));var jayson=require(_0x0ee8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x817e73,_0x4128a9,_0x192059){return new BPromise(function(_0x5c21c7,_0x2363e9){return client[_0x0ee8('0xa')](_0x817e73,_0x192059)['then'](function(_0x593720){logger[_0x0ee8('0xb')](_0x0ee8('0xc'),_0x4128a9,_0x0ee8('0xd'));logger['debug'](_0x0ee8('0xe'),_0x4128a9,_0x0ee8('0xd'),JSON['stringify'](_0x593720));if(_0x593720[_0x0ee8('0xf')]){if(_0x593720['error'][_0x0ee8('0x10')]===0x1f4){logger[_0x0ee8('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4128a9,_0x593720[_0x0ee8('0xf')][_0x0ee8('0x11')]);return _0x2363e9(_0x593720[_0x0ee8('0xf')][_0x0ee8('0x11')]);}logger[_0x0ee8('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4128a9,_0x593720[_0x0ee8('0xf')][_0x0ee8('0x11')]);return _0x5c21c7(_0x593720[_0x0ee8('0xf')][_0x0ee8('0x11')]);}else{logger[_0x0ee8('0xb')](_0x0ee8('0xc'),_0x4128a9,_0x0ee8('0xd'));_0x5c21c7(_0x593720['result'][_0x0ee8('0x11')]);}})[_0x0ee8('0x12')](function(_0x2ceb4e){logger[_0x0ee8('0xf')](_0x0ee8('0xc'),_0x4128a9,_0x2ceb4e);_0x2363e9(_0x2ceb4e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b1d07c7..36da96e 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 _0x76a4=['put','update','delete','destroy','util','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x859ed8,_0x35c6b9){var _0x428843=function(_0x5496a0){while(--_0x5496a0){_0x859ed8['push'](_0x859ed8['shift']());}};_0x428843(++_0x35c6b9);}(_0x76a4,0x72));var _0x476a=function(_0x48b9ba,_0x5cd940){_0x48b9ba=_0x48b9ba-0x0;var _0x38bd5a=_0x76a4[_0x48b9ba];return _0x38bd5a;};'use strict';var multer=require('multer');var util=require(_0x476a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x476a('0x1'));var router=express[_0x476a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x476a('0x3'));var config=require(_0x476a('0x4'));var controller=require(_0x476a('0x5'));router[_0x476a('0x6')]('/',auth[_0x476a('0x7')](),controller[_0x476a('0x8')]);router[_0x476a('0x6')](_0x476a('0x9'),auth[_0x476a('0x7')](),controller[_0x476a('0xa')]);router[_0x476a('0x6')](_0x476a('0xb'),auth['isAuthenticated'](),controller[_0x476a('0xc')]);router[_0x476a('0x6')](_0x476a('0xd'),auth['isAuthenticated'](),controller[_0x476a('0xe')]);router[_0x476a('0xf')]('/',auth[_0x476a('0x7')](),controller[_0x476a('0x10')]);router[_0x476a('0xf')]('/:id/configurations',auth[_0x476a('0x7')](),controller[_0x476a('0x11')]);router[_0x476a('0x12')](_0x476a('0x9'),auth['isAuthenticated'](),controller[_0x476a('0x13')]);router[_0x476a('0x14')](_0x476a('0x9'),auth['isAuthenticated'](),controller[_0x476a('0x15')]);module['exports']=router; \ No newline at end of file +var _0x70b0=['../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2dac44,_0x4d66ec){var _0x2e1c27=function(_0x464475){while(--_0x464475){_0x2dac44['push'](_0x2dac44['shift']());}};_0x2e1c27(++_0x4d66ec);}(_0x70b0,0x1a9));var _0x070b=function(_0x2050f7,_0x3833c6){_0x2050f7=_0x2050f7-0x0;var _0x219da1=_0x70b0[_0x2050f7];return _0x219da1;};'use strict';var multer=require('multer');var util=require(_0x070b('0x0'));var path=require(_0x070b('0x1'));var timeout=require(_0x070b('0x2'));var express=require(_0x070b('0x3'));var router=express[_0x070b('0x4')]();var fs_extra=require(_0x070b('0x5'));var auth=require(_0x070b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x070b('0x7'));var controller=require(_0x070b('0x8'));router[_0x070b('0x9')]('/',auth['isAuthenticated'](),controller[_0x070b('0xa')]);router['get'](_0x070b('0xb'),auth[_0x070b('0xc')](),controller[_0x070b('0xd')]);router[_0x070b('0x9')]('/:id/configurations',auth[_0x070b('0xc')](),controller[_0x070b('0xe')]);router[_0x070b('0x9')](_0x070b('0xf'),auth['isAuthenticated'](),controller[_0x070b('0x10')]);router[_0x070b('0x11')]('/',auth[_0x070b('0xc')](),controller['create']);router[_0x070b('0x11')](_0x070b('0x12'),auth[_0x070b('0xc')](),controller[_0x070b('0x13')]);router[_0x070b('0x14')]('/:id',auth[_0x070b('0xc')](),controller[_0x070b('0x15')]);router['delete'](_0x070b('0xb'),auth[_0x070b('0xc')](),controller[_0x070b('0x16')]);module[_0x070b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 4080b86..57f093d 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 _0x5430=['STRING','username','remoteUri','sequelize','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x5430,0x10c));var _0x0543=function(_0x4a505c,_0x38816b){_0x4a505c=_0x4a505c-0x0;var _0x23046c=_0x5430[_0x4a505c];return _0x23046c;};'use strict';var Sequelize=require(_0x0543('0x0'));module[_0x0543('0x1')]={'name':{'type':Sequelize[_0x0543('0x2')]},'description':{'type':Sequelize[_0x0543('0x2')]},'username':{'type':Sequelize[_0x0543('0x2')],'unique':_0x0543('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0543('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x5b12,0xa3));var _0x25b1=function(_0x558649,_0x483360){_0x558649=_0x558649-0x0;var _0x3f8cbd=_0x5b12[_0x558649];return _0x3f8cbd;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 63b7056..21a2eae 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 _0x6594=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','FreshdeskAccount','rawAttributes','options','find','create','body','update','params','findOne','FreshdeskConfiguration','length','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','Basic\x20%s','format','%s:X','requester','subject','ticket_type','group','company','remove','includes','default','custom_dropdown','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','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'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6594,0xcb));var _0x4659=function(_0x16cfae,_0x3c3596){_0x16cfae=_0x16cfae-0x0;var _0x5a04cf=_0x6594[_0x16cfae];return _0x5a04cf;};'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'];var integrations=require(_0x4659('0x16'));function respondWithStatusCode(_0x1f89cf,_0x5389a0){_0x5389a0=_0x5389a0||0xcc;return function(_0x40f043){if(_0x40f043){return _0x1f89cf[_0x4659('0x17')](_0x5389a0);}return _0x1f89cf['status'](_0x5389a0)['end']();};}function respondWithResult(_0x1a9e9c,_0x4c3c05){_0x4c3c05=_0x4c3c05||0xc8;return function(_0x39d8ba){if(_0x39d8ba){return _0x1a9e9c[_0x4659('0x18')](_0x4c3c05)[_0x4659('0x19')](_0x39d8ba);}};}function respondWithFilteredResult(_0x5c099c,_0x3d9a17){return function(_0x429b72){if(_0x429b72){var _0x1d78a5=typeof _0x3d9a17[_0x4659('0x1a')]==='undefined'&&typeof _0x3d9a17[_0x4659('0x1b')]===_0x4659('0x1c');var _0x73f3f5=_0x429b72[_0x4659('0x1d')];var _0x4c8820=_0x1d78a5?0x0:_0x3d9a17[_0x4659('0x1a')];var _0x3049ba=_0x1d78a5?_0x429b72['count']:_0x3d9a17[_0x4659('0x1a')]+_0x3d9a17[_0x4659('0x1b')];var _0x6b8d07;if(_0x3049ba>=_0x73f3f5){_0x3049ba=_0x73f3f5;_0x6b8d07=0xc8;}else{_0x6b8d07=0xce;}_0x5c099c[_0x4659('0x18')](_0x6b8d07);return _0x5c099c['set']('Content-Range',_0x4c8820+'-'+_0x3049ba+'/'+_0x73f3f5)[_0x4659('0x19')](_0x429b72);}return null;};}function patchUpdates(_0x157f1a){return function(_0x1fce1d){try{jsonpatch[_0x4659('0x1e')](_0x1fce1d,_0x157f1a,!![]);}catch(_0x288cdf){return BPromise[_0x4659('0x1f')](_0x288cdf);}return _0x1fce1d[_0x4659('0x20')]();};}function saveUpdates(_0x2e773b,_0x1a016e){return function(_0x494631){if(_0x494631){return _0x494631['update'](_0x2e773b)[_0x4659('0x21')](function(_0x4c40b3){return _0x4c40b3;});}return null;};}function removeEntity(_0x1e9c93,_0x47c73d){return function(_0x1715ba){if(_0x1715ba){return _0x1715ba[_0x4659('0x22')]()[_0x4659('0x21')](function(){_0x1e9c93[_0x4659('0x18')](0xcc)[_0x4659('0x23')]();});}};}function handleEntityNotFound(_0x1fe661,_0x2b4ad8){return function(_0x1d1cba){if(!_0x1d1cba){_0x1fe661[_0x4659('0x17')](0x194);}return _0x1d1cba;};}function handleError(_0x507598,_0x428dd5){_0x428dd5=_0x428dd5||0x1f4;return function(_0x1bd579){logger[_0x4659('0x24')](_0x1bd579[_0x4659('0x25')]);if(_0x1bd579[_0x4659('0x26')]){delete _0x1bd579[_0x4659('0x26')];}_0x507598[_0x4659('0x18')](_0x428dd5)[_0x4659('0x27')](_0x1bd579);};}exports[_0x4659('0x28')]=function(_0x479a2e,_0x5d0c89){var _0xde3c49={},_0x26d67f={},_0x5c5a31={'count':0x0,'rows':[]};var _0x507fc1=_[_0x4659('0x29')](db['FreshdeskAccount']['rawAttributes'],function(_0x34d817){return{'name':_0x34d817[_0x4659('0x2a')],'type':_0x34d817['type'][_0x4659('0x2b')]};});_0x26d67f[_0x4659('0x2c')]=_[_0x4659('0x29')](_0x507fc1,_0x4659('0x26'));_0x26d67f[_0x4659('0x2d')]=_[_0x4659('0x2e')](_0x479a2e[_0x4659('0x2d')]);_0x26d67f['filters']=_[_0x4659('0x2f')](_0x26d67f[_0x4659('0x2c')],_0x26d67f[_0x4659('0x2d')]);_0xde3c49[_0x4659('0x30')]=_['intersection'](_0x26d67f[_0x4659('0x2c')],qs[_0x4659('0x31')](_0x479a2e[_0x4659('0x2d')][_0x4659('0x31')]));_0xde3c49[_0x4659('0x30')]=_0xde3c49[_0x4659('0x30')]['length']?_0xde3c49['attributes']:_0x26d67f['model'];if(!_0x479a2e[_0x4659('0x2d')][_0x4659('0x32')]('nolimit')){_0xde3c49[_0x4659('0x1b')]=qs[_0x4659('0x1b')](_0x479a2e['query'][_0x4659('0x1b')]);_0xde3c49[_0x4659('0x1a')]=qs['offset'](_0x479a2e['query'][_0x4659('0x1a')]);}_0xde3c49[_0x4659('0x33')]=qs[_0x4659('0x34')](_0x479a2e[_0x4659('0x2d')][_0x4659('0x34')]);_0xde3c49[_0x4659('0x35')]=qs[_0x4659('0x36')](_[_0x4659('0x37')](_0x479a2e[_0x4659('0x2d')],_0x26d67f['filters']),_0x507fc1);if(_0x479a2e[_0x4659('0x2d')][_0x4659('0x38')]){_0xde3c49['where']=_['merge'](_0xde3c49['where'],{'$or':_['map'](_0x507fc1,function(_0xb4a62d){if(_0xb4a62d[_0x4659('0x39')]!==_0x4659('0x3a')){var _0x5406ae={};_0x5406ae[_0xb4a62d[_0x4659('0x26')]]={'$like':'%'+_0x479a2e[_0x4659('0x2d')]['filter']+'%'};return _0x5406ae;}})});}_0xde3c49=_[_0x4659('0x3b')]({},_0xde3c49,_0x479a2e['options']);var _0x1f5298={'where':_0xde3c49[_0x4659('0x35')]};return db['FreshdeskAccount']['count'](_0x1f5298)[_0x4659('0x21')](function(_0x391879){_0x5c5a31[_0x4659('0x1d')]=_0x391879;if(_0x479a2e['query'][_0x4659('0x3c')]){_0xde3c49[_0x4659('0x3d')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x4659('0x3e')](_0xde3c49);})[_0x4659('0x21')](function(_0xd78633){_0x5c5a31[_0x4659('0x3f')]=_0xd78633;return _0x5c5a31;})[_0x4659('0x21')](respondWithFilteredResult(_0x5d0c89,_0xde3c49))[_0x4659('0x40')](handleError(_0x5d0c89,null));};exports['show']=function(_0x11e413,_0x22e2bb){var _0xd38f94={'raw':![],'where':{'id':_0x11e413['params']['id']}},_0x9f120a={};_0x9f120a['model']=_[_0x4659('0x2e')](db[_0x4659('0x41')][_0x4659('0x42')]);_0x9f120a[_0x4659('0x2d')]=_[_0x4659('0x2e')](_0x11e413[_0x4659('0x2d')]);_0x9f120a[_0x4659('0x36')]=_['intersection'](_0x9f120a[_0x4659('0x2c')],_0x9f120a[_0x4659('0x2d')]);_0xd38f94[_0x4659('0x30')]=_[_0x4659('0x2f')](_0x9f120a['model'],qs[_0x4659('0x31')](_0x11e413['query']['fields']));_0xd38f94['attributes']=_0xd38f94['attributes']['length']?_0xd38f94[_0x4659('0x30')]:_0x9f120a[_0x4659('0x2c')];if(_0x11e413[_0x4659('0x2d')][_0x4659('0x3c')]){_0xd38f94[_0x4659('0x3d')]=[{'all':!![]}];}_0xd38f94=_['merge']({},_0xd38f94,_0x11e413[_0x4659('0x43')]);return db[_0x4659('0x41')][_0x4659('0x44')](_0xd38f94)[_0x4659('0x21')](handleEntityNotFound(_0x22e2bb,null))['then'](respondWithResult(_0x22e2bb,null))[_0x4659('0x40')](handleError(_0x22e2bb,null));};exports[_0x4659('0x45')]=function(_0x374df3,_0x1d3876){return db[_0x4659('0x41')]['create'](_0x374df3[_0x4659('0x46')],{})[_0x4659('0x21')](respondWithResult(_0x1d3876,0xc9))['catch'](handleError(_0x1d3876,null));};exports[_0x4659('0x47')]=function(_0x51e4ad,_0x452154){if(_0x51e4ad['body']['id']){delete _0x51e4ad[_0x4659('0x46')]['id'];}return db['FreshdeskAccount'][_0x4659('0x44')]({'where':{'id':_0x51e4ad[_0x4659('0x48')]['id']}})[_0x4659('0x21')](handleEntityNotFound(_0x452154,null))[_0x4659('0x21')](saveUpdates(_0x51e4ad[_0x4659('0x46')],null))[_0x4659('0x21')](respondWithResult(_0x452154,null))[_0x4659('0x40')](handleError(_0x452154,null));};exports[_0x4659('0x22')]=function(_0x722dea,_0x4a39a2){return db[_0x4659('0x41')][_0x4659('0x44')]({'where':{'id':_0x722dea[_0x4659('0x48')]['id']}})[_0x4659('0x21')](handleEntityNotFound(_0x4a39a2,null))['then'](removeEntity(_0x4a39a2,null))[_0x4659('0x40')](handleError(_0x4a39a2,null));};exports['getConfigurations']=function(_0x1d8b61,_0x105369,_0x3dbb46){var _0x42bd7e={};var _0x4f62ac={};var _0xc62155;var _0x225f98;return db[_0x4659('0x41')][_0x4659('0x49')]({'where':{'id':_0x1d8b61['params']['id']}})[_0x4659('0x21')](handleEntityNotFound(_0x105369,null))[_0x4659('0x21')](function(_0x9df1b2){if(_0x9df1b2){_0xc62155=_0x9df1b2;_0x4f62ac[_0x4659('0x2c')]=_[_0x4659('0x2e')](db[_0x4659('0x4a')][_0x4659('0x42')]);_0x4f62ac[_0x4659('0x2d')]=_[_0x4659('0x2e')](_0x1d8b61[_0x4659('0x2d')]);_0x4f62ac[_0x4659('0x36')]=_[_0x4659('0x2f')](_0x4f62ac[_0x4659('0x2c')],_0x4f62ac[_0x4659('0x2d')]);_0x42bd7e['attributes']=_[_0x4659('0x2f')](_0x4f62ac[_0x4659('0x2c')],qs['fields'](_0x1d8b61[_0x4659('0x2d')][_0x4659('0x31')]));_0x42bd7e[_0x4659('0x30')]=_0x42bd7e[_0x4659('0x30')][_0x4659('0x4b')]?_0x42bd7e[_0x4659('0x30')]:_0x4f62ac[_0x4659('0x2c')];_0x42bd7e['order']=qs[_0x4659('0x34')](_0x1d8b61[_0x4659('0x2d')][_0x4659('0x34')]);_0x42bd7e[_0x4659('0x35')]=qs[_0x4659('0x36')](_[_0x4659('0x37')](_0x1d8b61[_0x4659('0x2d')],_0x4f62ac['filters']));if(_0x1d8b61[_0x4659('0x2d')][_0x4659('0x38')]){_0x42bd7e['where']=_[_0x4659('0x3b')](_0x42bd7e[_0x4659('0x35')],{'$or':_[_0x4659('0x29')](_0x42bd7e['attributes'],function(_0x36d2cc){var _0x20f7ec={};_0x20f7ec[_0x36d2cc]={'$like':'%'+_0x1d8b61['query'][_0x4659('0x38')]+'%'};return _0x20f7ec;})});}_0x42bd7e=_['merge']({},_0x42bd7e,_0x1d8b61[_0x4659('0x43')]);return _0xc62155[_0x4659('0x4c')](_0x42bd7e);}})[_0x4659('0x21')](function(_0x517921){if(_0x517921){_0x225f98=_0x517921['length'];if(!_0x1d8b61[_0x4659('0x2d')]['hasOwnProperty'](_0x4659('0x4d'))){_0x42bd7e[_0x4659('0x1b')]=qs[_0x4659('0x1b')](_0x1d8b61['query']['limit']);_0x42bd7e[_0x4659('0x1a')]=qs[_0x4659('0x1a')](_0x1d8b61[_0x4659('0x2d')]['offset']);}return _0xc62155['getConfigurations'](_0x42bd7e);}})[_0x4659('0x21')](function(_0x41785f){if(_0x41785f){return _0x41785f?{'count':_0x225f98,'rows':_0x41785f}:null;}})[_0x4659('0x21')](respondWithResult(_0x105369,null))[_0x4659('0x40')](handleError(_0x105369,null));};exports[_0x4659('0x4e')]=function(_0x2746dc,_0x1b874d,_0x4dd4a8){if(_0x2746dc[_0x4659('0x46')]['id']){delete _0x2746dc['body']['id'];}return db[_0x4659('0x41')]['findOne']({'where':{'id':_0x2746dc[_0x4659('0x48')]['id']}})[_0x4659('0x21')](handleEntityNotFound(_0x1b874d,null))[_0x4659('0x21')](function(_0x57343a){if(_0x57343a){_0x2746dc['body'][_0x4659('0x4f')]=_0x57343a['id'];_0x2746dc[_0x4659('0x46')][_0x4659('0x50')]=integrations[_0x4659('0x51')](_0x2746dc[_0x4659('0x46')][_0x4659('0x52')],_0x2746dc[_0x4659('0x46')][_0x4659('0x39')]);_0x2746dc[_0x4659('0x46')][_0x4659('0x53')]=integrations[_0x4659('0x54')](_0x2746dc[_0x4659('0x46')]['channel'],_0x2746dc[_0x4659('0x46')]['type']);return db[_0x4659('0x4a')][_0x4659('0x45')](_0x2746dc['body'],{'include':[{'model':db[_0x4659('0x55')],'as':_0x4659('0x50')},{'model':db[_0x4659('0x55')],'as':'Descriptions'}]});}return null;})[_0x4659('0x21')](respondWithResult(_0x1b874d,null))[_0x4659('0x40')](handleError(_0x1b874d,null));};exports[_0x4659('0x56')]=function(_0x5e840f,_0x28bb1b,_0x4825a4){var _0x332658='';return db[_0x4659('0x41')]['findOne']({'where':{'id':_0x5e840f[_0x4659('0x48')]['id']},'attributes':['id',_0x4659('0x57'),_0x4659('0x58')]})[_0x4659('0x21')](handleEntityNotFound(_0x28bb1b,null))[_0x4659('0x21')](function(_0x482dc9){if(_0x482dc9){_0x332658=_0x482dc9[_0x4659('0x57')];var _0x249eb1=_0x332658[_0x4659('0x59')](-0x1);if(_0x249eb1==='/'){_0x332658=_0x332658[_0x4659('0x5a')](0x0,_0x332658[_0x4659('0x5b')](_0x249eb1));}return rp({'method':_0x4659('0x5c'),'uri':util['format']('%s/%s',_0x332658,'api/v2/ticket_fields'),'headers':{'Authorization':util['format'](_0x4659('0x5d'),new Buffer(util[_0x4659('0x5e')](_0x4659('0x5f'),_0x482dc9['apiKey']))['toString']('base64'))},'json':!![]});}})[_0x4659('0x21')](function(_0x2cef6b){if(_0x2cef6b){var _0x15d709=[_0x4659('0x60'),_0x4659('0x61'),'agent','description','status','priority','group','source',_0x4659('0x62'),_0x4659('0x63'),_0x4659('0x64')];_[_0x4659('0x65')](_0x2cef6b,function(_0x35ce47){return _0x15d709[_0x4659('0x66')](_0x35ce47['name'])||!_0x35ce47[_0x4659('0x67')]&&_0x35ce47[_0x4659('0x39')]!=='custom_text'&&_0x35ce47[_0x4659('0x39')]!==_0x4659('0x68');});return{'count':_0x2cef6b['length'],'rows':_[_0x4659('0x29')](_0x2cef6b,function(_0x56d500){return{'id':_0x56d500[_0x4659('0x26')],'name':_0x56d500['label'],'custom':!_0x56d500[_0x4659('0x67')],'options':_0x56d500[_0x4659('0x69')]?_[_0x4659('0x29')](_0x56d500[_0x4659('0x69')],function(_0x59d3be){return{'name':_['capitalize'](_0x59d3be),'value':_0x59d3be};}):[]};})};}})[_0x4659('0x21')](respondWithResult(_0x28bb1b,null))[_0x4659('0x40')](function(_0x320028){var _0x95642f=_0x5e840f[_0x4659('0x2d')][_0x4659('0x6a')]?0x1f4:_0x320028[_0x4659('0x6b')]||0x1f4;logger[_0x4659('0x24')](_0x4659('0x6c'),'getFields',_0x95642f,JSON[_0x4659('0x6d')](_0x320028));delete _0x320028[_0x4659('0x26')];if(_0x95642f===0x191){_0x95642f=0x190;}_0x28bb1b['status'](_0x95642f)[_0x4659('0x27')](_0x5e840f[_0x4659('0x2d')][_0x4659('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x320028[_0x4659('0x6b')]}:_0x320028);});}; \ No newline at end of file +var _0xcfac=['FreshdeskConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','subject','description','group','source','ticket_type','remove','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','update','destroy','then','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xcfac,0x105));var _0xccfa=function(_0x4b6152,_0x4c68d3){_0x4b6152=_0x4b6152-0x0;var _0x16277d=_0xcfac[_0x4b6152];return _0x16277d;};'use strict';var emlformat=require(_0xccfa('0x0'));var rimraf=require(_0xccfa('0x1'));var zipdir=require(_0xccfa('0x2'));var jsonpatch=require(_0xccfa('0x3'));var rp=require(_0xccfa('0x4'));var moment=require(_0xccfa('0x5'));var BPromise=require(_0xccfa('0x6'));var Mustache=require(_0xccfa('0x7'));var util=require(_0xccfa('0x8'));var path=require('path');var sox=require(_0xccfa('0x9'));var csv=require(_0xccfa('0xa'));var ejs=require(_0xccfa('0xb'));var fs=require('fs');var fs_extra=require(_0xccfa('0xc'));var _=require(_0xccfa('0xd'));var squel=require(_0xccfa('0xe'));var crypto=require(_0xccfa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xccfa('0x10'));var toCsv=require(_0xccfa('0xa'));var querystring=require(_0xccfa('0x11'));var Papa=require(_0xccfa('0x12'));var Redis=require(_0xccfa('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xccfa('0x14'));var as=require(_0xccfa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccfa('0x16'))(_0xccfa('0x17'));var utils=require(_0xccfa('0x18'));var config=require(_0xccfa('0x19'));var licenseUtil=require(_0xccfa('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xccfa('0x1b'));function respondWithStatusCode(_0x28d4e9,_0x73ab6d){_0x73ab6d=_0x73ab6d||0xcc;return function(_0x200af7){if(_0x200af7){return _0x28d4e9[_0xccfa('0x1c')](_0x73ab6d);}return _0x28d4e9[_0xccfa('0x1d')](_0x73ab6d)[_0xccfa('0x1e')]();};}function respondWithResult(_0xc43ebe,_0x411a73){_0x411a73=_0x411a73||0xc8;return function(_0x4d921){if(_0x4d921){return _0xc43ebe[_0xccfa('0x1d')](_0x411a73)[_0xccfa('0x1f')](_0x4d921);}};}function respondWithFilteredResult(_0x4e83d6,_0x89103f){return function(_0x258db6){if(_0x258db6){var _0x53416b=typeof _0x89103f['offset']===_0xccfa('0x20')&&typeof _0x89103f['limit']===_0xccfa('0x20');var _0x40c926=_0x258db6['count'];var _0x4adaab=_0x53416b?0x0:_0x89103f[_0xccfa('0x21')];var _0x26d90b=_0x53416b?_0x258db6[_0xccfa('0x22')]:_0x89103f[_0xccfa('0x21')]+_0x89103f[_0xccfa('0x23')];var _0x3f35a1;if(_0x26d90b>=_0x40c926){_0x26d90b=_0x40c926;_0x3f35a1=0xc8;}else{_0x3f35a1=0xce;}_0x4e83d6['status'](_0x3f35a1);return _0x4e83d6['set']('Content-Range',_0x4adaab+'-'+_0x26d90b+'/'+_0x40c926)[_0xccfa('0x1f')](_0x258db6);}return null;};}function patchUpdates(_0x4bdb04){return function(_0x5e0c63){try{jsonpatch['apply'](_0x5e0c63,_0x4bdb04,!![]);}catch(_0x29eb36){return BPromise['reject'](_0x29eb36);}return _0x5e0c63['save']();};}function saveUpdates(_0x471e59,_0x39b373){return function(_0x3ba121){if(_0x3ba121){return _0x3ba121[_0xccfa('0x24')](_0x471e59)['then'](function(_0xbedc9){return _0xbedc9;});}return null;};}function removeEntity(_0x485e6f,_0x58cc2c){return function(_0x4b8714){if(_0x4b8714){return _0x4b8714[_0xccfa('0x25')]()[_0xccfa('0x26')](function(){_0x485e6f[_0xccfa('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30aeb0,_0x3fdf53){return function(_0x29a1fb){if(!_0x29a1fb){_0x30aeb0[_0xccfa('0x1c')](0x194);}return _0x29a1fb;};}function handleError(_0xc3925,_0x195450){_0x195450=_0x195450||0x1f4;return function(_0x218f6e){logger[_0xccfa('0x27')](_0x218f6e['stack']);if(_0x218f6e[_0xccfa('0x28')]){delete _0x218f6e[_0xccfa('0x28')];}_0xc3925[_0xccfa('0x1d')](_0x195450)[_0xccfa('0x29')](_0x218f6e);};}exports[_0xccfa('0x2a')]=function(_0xe94e90,_0x32c849){var _0x3e8a05={},_0x3a255d={},_0x51aa9b={'count':0x0,'rows':[]};var _0x19fd9d=_[_0xccfa('0x2b')](db[_0xccfa('0x2c')][_0xccfa('0x2d')],function(_0xfae349){return{'name':_0xfae349[_0xccfa('0x2e')],'type':_0xfae349[_0xccfa('0x2f')][_0xccfa('0x30')]};});_0x3a255d[_0xccfa('0x31')]=_[_0xccfa('0x2b')](_0x19fd9d,_0xccfa('0x28'));_0x3a255d[_0xccfa('0x32')]=_[_0xccfa('0x33')](_0xe94e90[_0xccfa('0x32')]);_0x3a255d[_0xccfa('0x34')]=_[_0xccfa('0x35')](_0x3a255d[_0xccfa('0x31')],_0x3a255d[_0xccfa('0x32')]);_0x3e8a05['attributes']=_['intersection'](_0x3a255d['model'],qs[_0xccfa('0x36')](_0xe94e90[_0xccfa('0x32')][_0xccfa('0x36')]));_0x3e8a05[_0xccfa('0x37')]=_0x3e8a05['attributes']['length']?_0x3e8a05[_0xccfa('0x37')]:_0x3a255d[_0xccfa('0x31')];if(!_0xe94e90['query']['hasOwnProperty']('nolimit')){_0x3e8a05[_0xccfa('0x23')]=qs['limit'](_0xe94e90['query'][_0xccfa('0x23')]);_0x3e8a05[_0xccfa('0x21')]=qs[_0xccfa('0x21')](_0xe94e90[_0xccfa('0x32')][_0xccfa('0x21')]);}_0x3e8a05[_0xccfa('0x38')]=qs[_0xccfa('0x39')](_0xe94e90[_0xccfa('0x32')][_0xccfa('0x39')]);_0x3e8a05[_0xccfa('0x3a')]=qs[_0xccfa('0x34')](_['pick'](_0xe94e90[_0xccfa('0x32')],_0x3a255d['filters']),_0x19fd9d);if(_0xe94e90['query']['filter']){_0x3e8a05[_0xccfa('0x3a')]=_[_0xccfa('0x3b')](_0x3e8a05[_0xccfa('0x3a')],{'$or':_['map'](_0x19fd9d,function(_0x49e083){if(_0x49e083['type']!==_0xccfa('0x3c')){var _0x2f7923={};_0x2f7923[_0x49e083[_0xccfa('0x28')]]={'$like':'%'+_0xe94e90[_0xccfa('0x32')][_0xccfa('0x3d')]+'%'};return _0x2f7923;}})});}_0x3e8a05=_[_0xccfa('0x3b')]({},_0x3e8a05,_0xe94e90[_0xccfa('0x3e')]);var _0x31bd6b={'where':_0x3e8a05[_0xccfa('0x3a')]};return db[_0xccfa('0x2c')][_0xccfa('0x22')](_0x31bd6b)['then'](function(_0x5db3d0){_0x51aa9b['count']=_0x5db3d0;if(_0xe94e90[_0xccfa('0x32')][_0xccfa('0x3f')]){_0x3e8a05[_0xccfa('0x40')]=[{'all':!![]}];}return db[_0xccfa('0x2c')][_0xccfa('0x41')](_0x3e8a05);})['then'](function(_0x20df08){_0x51aa9b[_0xccfa('0x42')]=_0x20df08;return _0x51aa9b;})[_0xccfa('0x26')](respondWithFilteredResult(_0x32c849,_0x3e8a05))[_0xccfa('0x43')](handleError(_0x32c849,null));};exports['show']=function(_0x540a3f,_0x9380ab){var _0x2d19fb={'raw':![],'where':{'id':_0x540a3f[_0xccfa('0x44')]['id']}},_0x666ec1={};_0x666ec1[_0xccfa('0x31')]=_['keys'](db[_0xccfa('0x2c')][_0xccfa('0x2d')]);_0x666ec1[_0xccfa('0x32')]=_['keys'](_0x540a3f[_0xccfa('0x32')]);_0x666ec1['filters']=_['intersection'](_0x666ec1[_0xccfa('0x31')],_0x666ec1[_0xccfa('0x32')]);_0x2d19fb[_0xccfa('0x37')]=_[_0xccfa('0x35')](_0x666ec1[_0xccfa('0x31')],qs[_0xccfa('0x36')](_0x540a3f['query'][_0xccfa('0x36')]));_0x2d19fb['attributes']=_0x2d19fb['attributes'][_0xccfa('0x45')]?_0x2d19fb[_0xccfa('0x37')]:_0x666ec1[_0xccfa('0x31')];if(_0x540a3f[_0xccfa('0x32')][_0xccfa('0x3f')]){_0x2d19fb[_0xccfa('0x40')]=[{'all':!![]}];}_0x2d19fb=_[_0xccfa('0x3b')]({},_0x2d19fb,_0x540a3f[_0xccfa('0x3e')]);return db[_0xccfa('0x2c')][_0xccfa('0x46')](_0x2d19fb)[_0xccfa('0x26')](handleEntityNotFound(_0x9380ab,null))[_0xccfa('0x26')](respondWithResult(_0x9380ab,null))[_0xccfa('0x43')](handleError(_0x9380ab,null));};exports[_0xccfa('0x47')]=function(_0x54e363,_0x3e4770){return db[_0xccfa('0x2c')][_0xccfa('0x47')](_0x54e363['body'],{})['then'](respondWithResult(_0x3e4770,0xc9))[_0xccfa('0x43')](handleError(_0x3e4770,null));};exports[_0xccfa('0x24')]=function(_0x3d9d85,_0x4a0aa5){if(_0x3d9d85['body']['id']){delete _0x3d9d85[_0xccfa('0x48')]['id'];}return db['FreshdeskAccount'][_0xccfa('0x46')]({'where':{'id':_0x3d9d85['params']['id']}})[_0xccfa('0x26')](handleEntityNotFound(_0x4a0aa5,null))[_0xccfa('0x26')](saveUpdates(_0x3d9d85[_0xccfa('0x48')],null))[_0xccfa('0x26')](respondWithResult(_0x4a0aa5,null))[_0xccfa('0x43')](handleError(_0x4a0aa5,null));};exports[_0xccfa('0x25')]=function(_0x43ce21,_0x24bc69){return db[_0xccfa('0x2c')][_0xccfa('0x46')]({'where':{'id':_0x43ce21['params']['id']}})[_0xccfa('0x26')](handleEntityNotFound(_0x24bc69,null))[_0xccfa('0x26')](removeEntity(_0x24bc69,null))['catch'](handleError(_0x24bc69,null));};exports[_0xccfa('0x49')]=function(_0x59b012,_0x208b04,_0x43e5da){var _0x154bce={};var _0x24aca9={};var _0x2c7c23;var _0x15e661;return db['FreshdeskAccount'][_0xccfa('0x4a')]({'where':{'id':_0x59b012[_0xccfa('0x44')]['id']}})['then'](handleEntityNotFound(_0x208b04,null))[_0xccfa('0x26')](function(_0x1099c7){if(_0x1099c7){_0x2c7c23=_0x1099c7;_0x24aca9[_0xccfa('0x31')]=_[_0xccfa('0x33')](db[_0xccfa('0x4b')]['rawAttributes']);_0x24aca9['query']=_[_0xccfa('0x33')](_0x59b012[_0xccfa('0x32')]);_0x24aca9[_0xccfa('0x34')]=_['intersection'](_0x24aca9[_0xccfa('0x31')],_0x24aca9[_0xccfa('0x32')]);_0x154bce['attributes']=_[_0xccfa('0x35')](_0x24aca9['model'],qs['fields'](_0x59b012[_0xccfa('0x32')]['fields']));_0x154bce[_0xccfa('0x37')]=_0x154bce[_0xccfa('0x37')][_0xccfa('0x45')]?_0x154bce[_0xccfa('0x37')]:_0x24aca9[_0xccfa('0x31')];_0x154bce[_0xccfa('0x38')]=qs['sort'](_0x59b012[_0xccfa('0x32')][_0xccfa('0x39')]);_0x154bce[_0xccfa('0x3a')]=qs['filters'](_[_0xccfa('0x4c')](_0x59b012[_0xccfa('0x32')],_0x24aca9[_0xccfa('0x34')]));if(_0x59b012[_0xccfa('0x32')][_0xccfa('0x3d')]){_0x154bce[_0xccfa('0x3a')]=_[_0xccfa('0x3b')](_0x154bce[_0xccfa('0x3a')],{'$or':_[_0xccfa('0x2b')](_0x154bce[_0xccfa('0x37')],function(_0x1db436){var _0x465bb8={};_0x465bb8[_0x1db436]={'$like':'%'+_0x59b012[_0xccfa('0x32')][_0xccfa('0x3d')]+'%'};return _0x465bb8;})});}_0x154bce=_[_0xccfa('0x3b')]({},_0x154bce,_0x59b012[_0xccfa('0x3e')]);return _0x2c7c23[_0xccfa('0x49')](_0x154bce);}})[_0xccfa('0x26')](function(_0x35ad8e){if(_0x35ad8e){_0x15e661=_0x35ad8e[_0xccfa('0x45')];if(!_0x59b012[_0xccfa('0x32')][_0xccfa('0x4d')](_0xccfa('0x4e'))){_0x154bce[_0xccfa('0x23')]=qs[_0xccfa('0x23')](_0x59b012[_0xccfa('0x32')]['limit']);_0x154bce[_0xccfa('0x21')]=qs[_0xccfa('0x21')](_0x59b012[_0xccfa('0x32')][_0xccfa('0x21')]);}return _0x2c7c23[_0xccfa('0x49')](_0x154bce);}})[_0xccfa('0x26')](function(_0x6193d7){if(_0x6193d7){return _0x6193d7?{'count':_0x15e661,'rows':_0x6193d7}:null;}})[_0xccfa('0x26')](respondWithResult(_0x208b04,null))[_0xccfa('0x43')](handleError(_0x208b04,null));};exports[_0xccfa('0x4f')]=function(_0x2a2fc7,_0x5b2eaa,_0x286de1){if(_0x2a2fc7[_0xccfa('0x48')]['id']){delete _0x2a2fc7[_0xccfa('0x48')]['id'];}return db[_0xccfa('0x2c')][_0xccfa('0x4a')]({'where':{'id':_0x2a2fc7[_0xccfa('0x44')]['id']}})[_0xccfa('0x26')](handleEntityNotFound(_0x5b2eaa,null))[_0xccfa('0x26')](function(_0x26ce49){if(_0x26ce49){_0x2a2fc7['body'][_0xccfa('0x50')]=_0x26ce49['id'];_0x2a2fc7[_0xccfa('0x48')][_0xccfa('0x51')]=integrations['getSubjects'](_0x2a2fc7['body'][_0xccfa('0x52')],_0x2a2fc7[_0xccfa('0x48')]['type']);_0x2a2fc7[_0xccfa('0x48')][_0xccfa('0x53')]=integrations['getDescriptions'](_0x2a2fc7[_0xccfa('0x48')][_0xccfa('0x52')],_0x2a2fc7[_0xccfa('0x48')][_0xccfa('0x2f')]);return db['FreshdeskConfiguration'][_0xccfa('0x47')](_0x2a2fc7[_0xccfa('0x48')],{'include':[{'model':db[_0xccfa('0x54')],'as':'Subjects'},{'model':db[_0xccfa('0x54')],'as':_0xccfa('0x53')}]});}return null;})['then'](respondWithResult(_0x5b2eaa,null))[_0xccfa('0x43')](handleError(_0x5b2eaa,null));};exports[_0xccfa('0x55')]=function(_0x12b204,_0x56bd4c,_0x3b7772){var _0x5445ba='';return db[_0xccfa('0x2c')][_0xccfa('0x4a')]({'where':{'id':_0x12b204[_0xccfa('0x44')]['id']},'attributes':['id',_0xccfa('0x56'),_0xccfa('0x57')]})[_0xccfa('0x26')](handleEntityNotFound(_0x56bd4c,null))[_0xccfa('0x26')](function(_0x36ac8e){if(_0x36ac8e){_0x5445ba=_0x36ac8e[_0xccfa('0x56')];var _0x658b82=_0x5445ba['slice'](-0x1);if(_0x658b82==='/'){_0x5445ba=_0x5445ba[_0xccfa('0x58')](0x0,_0x5445ba[_0xccfa('0x59')](_0x658b82));}return rp({'method':_0xccfa('0x5a'),'uri':util['format'](_0xccfa('0x5b'),_0x5445ba,_0xccfa('0x5c')),'headers':{'Authorization':util[_0xccfa('0x5d')](_0xccfa('0x5e'),new Buffer(util[_0xccfa('0x5d')](_0xccfa('0x5f'),_0x36ac8e[_0xccfa('0x57')]))[_0xccfa('0x60')]('base64'))},'json':!![]});}})['then'](function(_0x440542){if(_0x440542){var _0x73ae1e=[_0xccfa('0x61'),_0xccfa('0x62'),'agent',_0xccfa('0x63'),'status','priority',_0xccfa('0x64'),_0xccfa('0x65'),_0xccfa('0x66'),_0xccfa('0x64'),'company'];_[_0xccfa('0x67')](_0x440542,function(_0x216737){return _0x73ae1e['includes'](_0x216737['name'])||!_0x216737['default']&&_0x216737[_0xccfa('0x2f')]!=='custom_text'&&_0x216737['type']!==_0xccfa('0x68');});return{'count':_0x440542[_0xccfa('0x45')],'rows':_[_0xccfa('0x2b')](_0x440542,function(_0x1fd76d){return{'id':_0x1fd76d['name'],'name':_0x1fd76d[_0xccfa('0x69')],'custom':!_0x1fd76d['default'],'options':_0x1fd76d[_0xccfa('0x6a')]?_[_0xccfa('0x2b')](_0x1fd76d[_0xccfa('0x6a')],function(_0xf2264c){return{'name':_[_0xccfa('0x6b')](_0xf2264c),'value':_0xf2264c};}):[]};})};}})[_0xccfa('0x26')](respondWithResult(_0x56bd4c,null))[_0xccfa('0x43')](function(_0x5284a8){var _0x368c8e=_0x12b204[_0xccfa('0x32')][_0xccfa('0x6c')]?0x1f4:_0x5284a8[_0xccfa('0x6d')]||0x1f4;logger[_0xccfa('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xccfa('0x55'),_0x368c8e,JSON[_0xccfa('0x6e')](_0x5284a8));delete _0x5284a8[_0xccfa('0x28')];if(_0x368c8e===0x191){_0x368c8e=0x190;}_0x56bd4c[_0xccfa('0x1d')](_0x368c8e)['send'](_0x12b204['query']['test']?{'message':_0xccfa('0x6f'),'statusCode':_0x5284a8[_0xccfa('0x6d')]}:_0x5284a8);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 07cb5ae..7733ebf 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 _0x52ba=['../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x4fa9b6,_0x5dbc8){var _0x423a19=function(_0x593cde){while(--_0x593cde){_0x4fa9b6['push'](_0x4fa9b6['shift']());}};_0x423a19(++_0x5dbc8);}(_0x52ba,0x1c6));var _0xa52b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x52ba[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xa52b('0x0'));var util=require(_0xa52b('0x1'));var logger=require(_0xa52b('0x2'))(_0xa52b('0x3'));var moment=require(_0xa52b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa52b('0x5'));var config=require(_0xa52b('0x6'));var attributes=require(_0xa52b('0x7'));var integrations=require(_0xa52b('0x8'));module['exports']=function(_0x5312f3,_0x52c67d){return _0x5312f3['define'](_0xa52b('0x9'),attributes,{'tableName':_0xa52b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6644=['request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x574bef,_0x2dc511){var _0x19e5e1=function(_0x49fd69){while(--_0x49fd69){_0x574bef['push'](_0x574bef['shift']());}};_0x19e5e1(++_0x2dc511);}(_0x6644,0x6b));var _0x4664=function(_0x9f2e07,_0x17abb4){_0x9f2e07=_0x9f2e07-0x0;var _0x3e5d33=_0x6644[_0x9f2e07];return _0x3e5d33;};'use strict';var _=require(_0x4664('0x0'));var util=require(_0x4664('0x1'));var logger=require('../../config/logger')(_0x4664('0x2'));var moment=require(_0x4664('0x3'));var BPromise=require(_0x4664('0x4'));var rp=require(_0x4664('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4664('0x6'));var config=require(_0x4664('0x7'));var attributes=require(_0x4664('0x8'));var integrations=require(_0x4664('0x9'));module[_0x4664('0xa')]=function(_0x26546f,_0x3c6867){return _0x26546f[_0x4664('0xb')](_0x4664('0xc'),attributes,{'tableName':_0x4664('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 6c3af79..c5a207a 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 _0x5d30=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','FreshdeskAccount','findAll','options','where','attributes','map','model','include','GetFreshdeskAccount','stringify','catch','find','raw','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x14bb2f,_0x3c8ed0){var _0x5e2041=function(_0x44c46e){while(--_0x44c46e){_0x14bb2f['push'](_0x14bb2f['shift']());}};_0x5e2041(++_0x3c8ed0);}(_0x5d30,0x186));var _0x05d3=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x5d30[_0x38c699];return _0x3b1ded;};'use strict';var _=require(_0x05d3('0x0'));var util=require(_0x05d3('0x1'));var moment=require(_0x05d3('0x2'));var BPromise=require(_0x05d3('0x3'));var rs=require(_0x05d3('0x4'));var fs=require('fs');var Redis=require(_0x05d3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x05d3('0x6'));var logger=require(_0x05d3('0x7'))(_0x05d3('0x8'));var config=require(_0x05d3('0x9'));var jayson=require(_0x05d3('0xa'));var client=jayson['client'][_0x05d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x533efc,_0xb46dad,_0x465375){return new BPromise(function(_0x3fbb1c,_0x4c65ee){return client[_0x05d3('0xc')](_0x533efc,_0x465375)[_0x05d3('0xd')](function(_0xa19fa5){logger[_0x05d3('0xe')](_0x05d3('0xf'),_0xb46dad,'request\x20sent');logger[_0x05d3('0x10')](_0x05d3('0x11'),_0xb46dad,_0x05d3('0x12'),JSON['stringify'](_0xa19fa5));if(_0xa19fa5[_0x05d3('0x13')]){if(_0xa19fa5['error'][_0x05d3('0x14')]===0x1f4){logger['error'](_0x05d3('0xf'),_0xb46dad,_0xa19fa5[_0x05d3('0x13')][_0x05d3('0x15')]);return _0x4c65ee(_0xa19fa5[_0x05d3('0x13')][_0x05d3('0x15')]);}logger[_0x05d3('0x13')](_0x05d3('0xf'),_0xb46dad,_0xa19fa5[_0x05d3('0x13')][_0x05d3('0x15')]);return _0x3fbb1c(_0xa19fa5[_0x05d3('0x13')][_0x05d3('0x15')]);}else{logger[_0x05d3('0xe')](_0x05d3('0xf'),_0xb46dad,'request\x20sent');_0x3fbb1c(_0xa19fa5['result'][_0x05d3('0x15')]);}})['catch'](function(_0x286726){logger[_0x05d3('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0xb46dad,_0x286726);_0x4c65ee(_0x286726);});});}exports['GetFreshdeskAccount']=function(_0x53fde3){var _0x3164e4=this;return new Promise(function(_0x32eba5,_0x1f9780){return db[_0x05d3('0x16')][_0x05d3('0x17')]({'raw':_0x53fde3['options']?_0x53fde3[_0x05d3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x53fde3['options']?_0x53fde3['options'][_0x05d3('0x19')]||null:null,'attributes':_0x53fde3[_0x05d3('0x18')]?_0x53fde3[_0x05d3('0x18')][_0x05d3('0x1a')]||null:null,'limit':_0x53fde3[_0x05d3('0x18')]?_0x53fde3['options']['limit']||null:null,'include':_0x53fde3['options']?_0x53fde3[_0x05d3('0x18')]['include']?_['map'](_0x53fde3[_0x05d3('0x18')]['include'],function(_0x5d247d){return{'model':db[_0x5d247d['model']],'as':_0x5d247d['as'],'attributes':_0x5d247d[_0x05d3('0x1a')],'include':_0x5d247d['include']?_[_0x05d3('0x1b')](_0x5d247d['include'],function(_0x52f0d5){return{'model':db[_0x52f0d5[_0x05d3('0x1c')]],'as':_0x52f0d5['as'],'attributes':_0x52f0d5[_0x05d3('0x1a')],'include':_0x52f0d5[_0x05d3('0x1d')]?_[_0x05d3('0x1b')](_0x52f0d5[_0x05d3('0x1d')],function(_0x31b90e){return{'model':db[_0x31b90e[_0x05d3('0x1c')]],'as':_0x31b90e['as'],'attributes':_0x31b90e['attributes']};}):[]};}):[]};}):[]:[]})[_0x05d3('0xd')](function(_0x384f31){logger['info'](_0x05d3('0x1e'),_0x53fde3);logger['debug'](_0x05d3('0x1e'),_0x53fde3,JSON[_0x05d3('0x1f')](_0x384f31));_0x32eba5(_0x384f31);})[_0x05d3('0x20')](function(_0x5e8b13){logger[_0x05d3('0x13')](_0x05d3('0x1e'),_0x5e8b13[_0x05d3('0x15')],_0x53fde3);_0x1f9780(_0x3164e4[_0x05d3('0x13')](0x1f4,_0x5e8b13['message']));});});};exports['ShowFreshdeskAccount']=function(_0x1caad6){var _0x3b737a=this;return new Promise(function(_0x1844e5,_0xfb1c94){return db[_0x05d3('0x16')][_0x05d3('0x21')]({'raw':_0x1caad6['options']?_0x1caad6[_0x05d3('0x18')][_0x05d3('0x22')]===undefined?!![]:![]:!![],'where':_0x1caad6[_0x05d3('0x18')]?_0x1caad6['options'][_0x05d3('0x19')]||null:null,'attributes':_0x1caad6[_0x05d3('0x18')]?_0x1caad6[_0x05d3('0x18')][_0x05d3('0x1a')]||null:null,'include':_0x1caad6[_0x05d3('0x18')]?_0x1caad6[_0x05d3('0x18')][_0x05d3('0x1d')]?_['map'](_0x1caad6['options'][_0x05d3('0x1d')],function(_0x553900){return{'model':db[_0x553900[_0x05d3('0x1c')]],'as':_0x553900['as'],'attributes':_0x553900[_0x05d3('0x1a')],'include':_0x553900[_0x05d3('0x1d')]?_[_0x05d3('0x1b')](_0x553900[_0x05d3('0x1d')],function(_0x23fa86){return{'model':db[_0x23fa86[_0x05d3('0x1c')]],'as':_0x23fa86['as'],'attributes':_0x23fa86['attributes'],'include':_0x23fa86[_0x05d3('0x1d')]?_[_0x05d3('0x1b')](_0x23fa86[_0x05d3('0x1d')],function(_0x8f5597){return{'model':db[_0x8f5597[_0x05d3('0x1c')]],'as':_0x8f5597['as'],'attributes':_0x8f5597[_0x05d3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x05d3('0xd')](function(_0x2ad71c){logger[_0x05d3('0xe')]('ShowFreshdeskAccount',_0x1caad6);logger[_0x05d3('0x10')](_0x05d3('0x23'),_0x1caad6,JSON[_0x05d3('0x1f')](_0x2ad71c));_0x1844e5(_0x2ad71c);})['catch'](function(_0xb9ed22){logger[_0x05d3('0x13')](_0x05d3('0x23'),_0xb9ed22[_0x05d3('0x15')],_0x1caad6);_0xfb1c94(_0x3b737a[_0x05d3('0x13')](0x1f4,_0xb9ed22[_0x05d3('0x15')]));});});}; \ No newline at end of file +var _0xf6c6=['stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','model','map','then','catch','ShowFreshdeskAccount','FreshdeskAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','request\x20sent'];(function(_0x49020c,_0x55f5e8){var _0xc7dc3a=function(_0x51cb69){while(--_0x51cb69){_0x49020c['push'](_0x49020c['shift']());}};_0xc7dc3a(++_0x55f5e8);}(_0xf6c6,0xed));var _0x6f6c=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xf6c6[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x6f6c('0x0'));var util=require(_0x6f6c('0x1'));var moment=require(_0x6f6c('0x2'));var BPromise=require(_0x6f6c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f6c('0x4'));var db=require(_0x6f6c('0x5'))['db'];var utils=require(_0x6f6c('0x6'));var logger=require(_0x6f6c('0x7'))('rpc');var config=require(_0x6f6c('0x8'));var jayson=require(_0x6f6c('0x9'));var client=jayson[_0x6f6c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x158508,_0x10d84e,_0x4bb100){return new BPromise(function(_0x53f5c4,_0x4e57d1){return client[_0x6f6c('0xb')](_0x158508,_0x4bb100)['then'](function(_0x16c39d){logger[_0x6f6c('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x10d84e,'request\x20sent');logger[_0x6f6c('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x10d84e,_0x6f6c('0xe'),JSON[_0x6f6c('0xf')](_0x16c39d));if(_0x16c39d[_0x6f6c('0x10')]){if(_0x16c39d[_0x6f6c('0x10')][_0x6f6c('0x11')]===0x1f4){logger[_0x6f6c('0x10')](_0x6f6c('0x12'),_0x10d84e,_0x16c39d[_0x6f6c('0x10')]['message']);return _0x4e57d1(_0x16c39d['error'][_0x6f6c('0x13')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x10d84e,_0x16c39d[_0x6f6c('0x10')][_0x6f6c('0x13')]);return _0x53f5c4(_0x16c39d[_0x6f6c('0x10')][_0x6f6c('0x13')]);}else{logger[_0x6f6c('0xc')](_0x6f6c('0x12'),_0x10d84e,_0x6f6c('0xe'));_0x53f5c4(_0x16c39d[_0x6f6c('0x14')][_0x6f6c('0x13')]);}})['catch'](function(_0xe76fe9){logger[_0x6f6c('0x10')](_0x6f6c('0x12'),_0x10d84e,_0xe76fe9);_0x4e57d1(_0xe76fe9);});});}exports[_0x6f6c('0x15')]=function(_0x106b98){var _0xb5b0f0=this;return new Promise(function(_0x12e900,_0x12e163){return db['FreshdeskAccount'][_0x6f6c('0x16')]({'raw':_0x106b98[_0x6f6c('0x17')]?_0x106b98[_0x6f6c('0x17')][_0x6f6c('0x18')]===undefined?!![]:![]:!![],'where':_0x106b98[_0x6f6c('0x17')]?_0x106b98[_0x6f6c('0x17')]['where']||null:null,'attributes':_0x106b98['options']?_0x106b98[_0x6f6c('0x17')][_0x6f6c('0x19')]||null:null,'limit':_0x106b98[_0x6f6c('0x17')]?_0x106b98['options'][_0x6f6c('0x1a')]||null:null,'include':_0x106b98[_0x6f6c('0x17')]?_0x106b98['options'][_0x6f6c('0x1b')]?_['map'](_0x106b98[_0x6f6c('0x17')]['include'],function(_0x25c98e){return{'model':db[_0x25c98e[_0x6f6c('0x1c')]],'as':_0x25c98e['as'],'attributes':_0x25c98e[_0x6f6c('0x19')],'include':_0x25c98e[_0x6f6c('0x1b')]?_[_0x6f6c('0x1d')](_0x25c98e[_0x6f6c('0x1b')],function(_0x2da358){return{'model':db[_0x2da358[_0x6f6c('0x1c')]],'as':_0x2da358['as'],'attributes':_0x2da358['attributes'],'include':_0x2da358[_0x6f6c('0x1b')]?_['map'](_0x2da358['include'],function(_0x2253e5){return{'model':db[_0x2253e5[_0x6f6c('0x1c')]],'as':_0x2253e5['as'],'attributes':_0x2253e5[_0x6f6c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6f6c('0x1e')](function(_0x51c05a){logger[_0x6f6c('0xc')](_0x6f6c('0x15'),_0x106b98);logger['debug'](_0x6f6c('0x15'),_0x106b98,JSON[_0x6f6c('0xf')](_0x51c05a));_0x12e900(_0x51c05a);})[_0x6f6c('0x1f')](function(_0x5c845e){logger[_0x6f6c('0x10')](_0x6f6c('0x15'),_0x5c845e['message'],_0x106b98);_0x12e163(_0xb5b0f0['error'](0x1f4,_0x5c845e['message']));});});};exports[_0x6f6c('0x20')]=function(_0x3214d7){var _0xb3e5cb=this;return new Promise(function(_0x1ea880,_0x776f36){return db[_0x6f6c('0x21')][_0x6f6c('0x22')]({'raw':_0x3214d7[_0x6f6c('0x17')]?_0x3214d7[_0x6f6c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3214d7['options']?_0x3214d7[_0x6f6c('0x17')][_0x6f6c('0x23')]||null:null,'attributes':_0x3214d7[_0x6f6c('0x17')]?_0x3214d7[_0x6f6c('0x17')]['attributes']||null:null,'include':_0x3214d7['options']?_0x3214d7[_0x6f6c('0x17')][_0x6f6c('0x1b')]?_[_0x6f6c('0x1d')](_0x3214d7['options']['include'],function(_0x4cbcec){return{'model':db[_0x4cbcec[_0x6f6c('0x1c')]],'as':_0x4cbcec['as'],'attributes':_0x4cbcec['attributes'],'include':_0x4cbcec[_0x6f6c('0x1b')]?_[_0x6f6c('0x1d')](_0x4cbcec['include'],function(_0x240a08){return{'model':db[_0x240a08[_0x6f6c('0x1c')]],'as':_0x240a08['as'],'attributes':_0x240a08['attributes'],'include':_0x240a08[_0x6f6c('0x1b')]?_[_0x6f6c('0x1d')](_0x240a08[_0x6f6c('0x1b')],function(_0x56e544){return{'model':db[_0x56e544[_0x6f6c('0x1c')]],'as':_0x56e544['as'],'attributes':_0x56e544[_0x6f6c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ee5cb){logger[_0x6f6c('0xc')](_0x6f6c('0x20'),_0x3214d7);logger['debug'](_0x6f6c('0x20'),_0x3214d7,JSON[_0x6f6c('0xf')](_0x1ee5cb));_0x1ea880(_0x1ee5cb);})['catch'](function(_0xb10ab7){logger[_0x6f6c('0x10')](_0x6f6c('0x20'),_0xb10ab7[_0x6f6c('0x13')],_0x3214d7);_0x776f36(_0xb3e5cb[_0x6f6c('0x10')](0x1f4,_0xb10ab7['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 02ca81d..776ec62 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 _0xfacd=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id/fields','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','put','update','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x5a4372,_0x1a8f1c){var _0x51ed54=function(_0x2e94e7){while(--_0x2e94e7){_0x5a4372['push'](_0x5a4372['shift']());}};_0x51ed54(++_0x1a8f1c);}(_0xfacd,0x177));var _0xdfac=function(_0x51061e,_0x5e7d8b){_0x51061e=_0x51061e-0x0;var _0x27e83d=_0xfacd[_0x51061e];return _0x27e83d;};'use strict';var multer=require(_0xdfac('0x0'));var util=require('util');var path=require(_0xdfac('0x1'));var timeout=require(_0xdfac('0x2'));var express=require('express');var router=express[_0xdfac('0x3')]();var fs_extra=require(_0xdfac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdfac('0x5'));var config=require(_0xdfac('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xdfac('0x7')]('/',auth['isAuthenticated'](),controller[_0xdfac('0x8')]);router[_0xdfac('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdfac('0x7')](_0xdfac('0x9'),auth[_0xdfac('0xa')](),controller['getFields']);router[_0xdfac('0x7')]('/:id/subjects',auth[_0xdfac('0xa')](),controller[_0xdfac('0xb')]);router[_0xdfac('0x7')](_0xdfac('0xc'),auth[_0xdfac('0xa')](),controller[_0xdfac('0xd')]);router['get'](_0xdfac('0xe'),auth[_0xdfac('0xa')](),controller[_0xdfac('0xf')]);router['post']('/',auth[_0xdfac('0xa')](),controller['create']);router['post'](_0xdfac('0xe'),auth[_0xdfac('0xa')](),controller['setTags']);router[_0xdfac('0x10')]('/:id',auth[_0xdfac('0xa')](),controller[_0xdfac('0x11')]);router['delete'](_0xdfac('0x12'),auth['isAuthenticated'](),controller[_0xdfac('0x13')]);module[_0xdfac('0x14')]=router; \ No newline at end of file +var _0xe2f7=['fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x42e3d5,_0x5325f6){var _0x21cf13=function(_0x398fc8){while(--_0x398fc8){_0x42e3d5['push'](_0x42e3d5['shift']());}};_0x21cf13(++_0x5325f6);}(_0xe2f7,0x183));var _0x7e2f=function(_0x6681b1,_0xc0c1df){_0x6681b1=_0x6681b1-0x0;var _0x45a3f9=_0xe2f7[_0x6681b1];return _0x45a3f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7e2f('0x0'));var timeout=require(_0x7e2f('0x1'));var express=require(_0x7e2f('0x2'));var router=express['Router']();var fs_extra=require(_0x7e2f('0x3'));var auth=require(_0x7e2f('0x4'));var interaction=require(_0x7e2f('0x5'));var config=require('../../config/environment');var controller=require(_0x7e2f('0x6'));router[_0x7e2f('0x7')]('/',auth[_0x7e2f('0x8')](),controller[_0x7e2f('0x9')]);router['get'](_0x7e2f('0xa'),auth[_0x7e2f('0x8')](),controller[_0x7e2f('0xb')]);router['get'](_0x7e2f('0xc'),auth[_0x7e2f('0x8')](),controller[_0x7e2f('0xd')]);router['get'](_0x7e2f('0xe'),auth[_0x7e2f('0x8')](),controller[_0x7e2f('0xf')]);router[_0x7e2f('0x7')](_0x7e2f('0x10'),auth[_0x7e2f('0x8')](),controller['getDescriptions']);router['get'](_0x7e2f('0x11'),auth[_0x7e2f('0x8')](),controller[_0x7e2f('0x12')]);router[_0x7e2f('0x13')]('/',auth[_0x7e2f('0x8')](),controller['create']);router[_0x7e2f('0x13')]('/:id/tags',auth[_0x7e2f('0x8')](),controller[_0x7e2f('0x14')]);router[_0x7e2f('0x15')](_0x7e2f('0xa'),auth['isAuthenticated'](),controller[_0x7e2f('0x16')]);router[_0x7e2f('0x17')]('/:id',auth[_0x7e2f('0x8')](),controller[_0x7e2f('0x18')]);module[_0x7e2f('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ac0336d..373cdc6 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 _0xfc8e=['STRING','exports'];(function(_0x1ff346,_0x4e79c3){var _0x4ef062=function(_0x4c9309){while(--_0x4c9309){_0x1ff346['push'](_0x1ff346['shift']());}};_0x4ef062(++_0x4e79c3);}(_0xfc8e,0x97));var _0xefc8=function(_0x2b0dcf,_0x594cb8){_0x2b0dcf=_0x2b0dcf-0x0;var _0x3a3601=_0xfc8e[_0x2b0dcf];return _0x3a3601;};'use strict';var Sequelize=require('sequelize');module[_0xefc8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xefc8('0x1')]}}; \ No newline at end of file +var _0xa8d7=['sequelize','exports','STRING'];(function(_0xcc6ce4,_0x2979cf){var _0x29566e=function(_0x4811bd){while(--_0x4811bd){_0xcc6ce4['push'](_0xcc6ce4['shift']());}};_0x29566e(++_0x2979cf);}(_0xa8d7,0x87));var _0x7a8d=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0xa8d7[_0x420513];return _0x1b44ec;};'use strict';var Sequelize=require(_0x7a8d('0x0'));module[_0x7a8d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7a8d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 3edd247..642ae06 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 _0x766a=['setTags','ids','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','type','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','destroy','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0x766a,0xb4));var _0xa766=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x766a[_0x384231];return _0x2480bf;};'use strict';var emlformat=require(_0xa766('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa766('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa766('0x2'));var moment=require(_0xa766('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa766('0x4'));var util=require(_0xa766('0x5'));var path=require(_0xa766('0x6'));var sox=require(_0xa766('0x7'));var csv=require('to-csv');var ejs=require(_0xa766('0x8'));var fs=require('fs');var fs_extra=require(_0xa766('0x9'));var _=require(_0xa766('0xa'));var squel=require('squel');var crypto=require(_0xa766('0xb'));var jsforce=require(_0xa766('0xc'));var deskjs=require(_0xa766('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa766('0xe'));var Papa=require('papaparse');var Redis=require(_0xa766('0xf'));var authService=require(_0xa766('0x10'));var qs=require(_0xa766('0x11'));var as=require(_0xa766('0x12'));var hardwareService=require(_0xa766('0x13'));var logger=require(_0xa766('0x14'))(_0xa766('0x15'));var utils=require(_0xa766('0x16'));var config=require(_0xa766('0x17'));var licenseUtil=require(_0xa766('0x18'));var db=require(_0xa766('0x19'))['db'];function respondWithStatusCode(_0x49ef7e,_0x4ed269){_0x4ed269=_0x4ed269||0xcc;return function(_0x2f2948){if(_0x2f2948){return _0x49ef7e[_0xa766('0x1a')](_0x4ed269);}return _0x49ef7e[_0xa766('0x1b')](_0x4ed269)[_0xa766('0x1c')]();};}function respondWithResult(_0x1e8783,_0x5ed22e){_0x5ed22e=_0x5ed22e||0xc8;return function(_0x393c6a){if(_0x393c6a){return _0x1e8783[_0xa766('0x1b')](_0x5ed22e)['json'](_0x393c6a);}};}function respondWithFilteredResult(_0xabc66c,_0x16800d){return function(_0x44dafc){if(_0x44dafc){var _0x4684c3=typeof _0x16800d['offset']===_0xa766('0x1d')&&typeof _0x16800d[_0xa766('0x1e')]===_0xa766('0x1d');var _0x25cf63=_0x44dafc[_0xa766('0x1f')];var _0x350c9f=_0x4684c3?0x0:_0x16800d[_0xa766('0x20')];var _0x15ba6f=_0x4684c3?_0x44dafc[_0xa766('0x1f')]:_0x16800d['offset']+_0x16800d[_0xa766('0x1e')];var _0x504183;if(_0x15ba6f>=_0x25cf63){_0x15ba6f=_0x25cf63;_0x504183=0xc8;}else{_0x504183=0xce;}_0xabc66c[_0xa766('0x1b')](_0x504183);return _0xabc66c[_0xa766('0x21')]('Content-Range',_0x350c9f+'-'+_0x15ba6f+'/'+_0x25cf63)[_0xa766('0x22')](_0x44dafc);}return null;};}function patchUpdates(_0x1c0aae){return function(_0xf0a2d5){try{jsonpatch[_0xa766('0x23')](_0xf0a2d5,_0x1c0aae,!![]);}catch(_0x380ba2){return BPromise[_0xa766('0x24')](_0x380ba2);}return _0xf0a2d5[_0xa766('0x25')]();};}function saveUpdates(_0x4b870e,_0x526d99){return function(_0xb039dc){if(_0xb039dc){return _0xb039dc['update'](_0x4b870e)[_0xa766('0x26')](function(_0x3c63db){return _0x3c63db;});}return null;};}function removeEntity(_0x2b2977,_0x60a12c){return function(_0x15186b){if(_0x15186b){return _0x15186b['destroy']()['then'](function(){_0x2b2977[_0xa766('0x1b')](0xcc)[_0xa766('0x1c')]();});}};}function handleEntityNotFound(_0x1be2fe,_0x11ae97){return function(_0x51db56){if(!_0x51db56){_0x1be2fe[_0xa766('0x1a')](0x194);}return _0x51db56;};}function handleError(_0x442885,_0x30604e){_0x30604e=_0x30604e||0x1f4;return function(_0x1dfadc){logger[_0xa766('0x27')](_0x1dfadc[_0xa766('0x28')]);if(_0x1dfadc[_0xa766('0x29')]){delete _0x1dfadc[_0xa766('0x29')];}_0x442885[_0xa766('0x1b')](_0x30604e)[_0xa766('0x2a')](_0x1dfadc);};}exports[_0xa766('0x2b')]=function(_0x38bc25,_0x587ead){var _0x48020f={},_0x5e2767={},_0x36ac27={'count':0x0,'rows':[]};var _0x860f72=_[_0xa766('0x2c')](db[_0xa766('0x2d')][_0xa766('0x2e')],function(_0x286636){return{'name':_0x286636[_0xa766('0x2f')],'type':_0x286636['type'][_0xa766('0x30')]};});_0x5e2767[_0xa766('0x31')]=_['map'](_0x860f72,_0xa766('0x29'));_0x5e2767['query']=_[_0xa766('0x32')](_0x38bc25[_0xa766('0x33')]);_0x5e2767[_0xa766('0x34')]=_[_0xa766('0x35')](_0x5e2767[_0xa766('0x31')],_0x5e2767['query']);_0x48020f[_0xa766('0x36')]=_[_0xa766('0x35')](_0x5e2767[_0xa766('0x31')],qs[_0xa766('0x37')](_0x38bc25[_0xa766('0x33')][_0xa766('0x37')]));_0x48020f[_0xa766('0x36')]=_0x48020f[_0xa766('0x36')][_0xa766('0x38')]?_0x48020f['attributes']:_0x5e2767['model'];if(!_0x38bc25[_0xa766('0x33')]['hasOwnProperty'](_0xa766('0x39'))){_0x48020f['limit']=qs[_0xa766('0x1e')](_0x38bc25[_0xa766('0x33')][_0xa766('0x1e')]);_0x48020f[_0xa766('0x20')]=qs[_0xa766('0x20')](_0x38bc25['query'][_0xa766('0x20')]);}_0x48020f[_0xa766('0x3a')]=qs[_0xa766('0x3b')](_0x38bc25[_0xa766('0x33')][_0xa766('0x3b')]);_0x48020f['where']=qs['filters'](_[_0xa766('0x3c')](_0x38bc25['query'],_0x5e2767['filters']),_0x860f72);if(_0x38bc25['query'][_0xa766('0x3d')]){_0x48020f['where']=_['merge'](_0x48020f['where'],{'$or':_[_0xa766('0x2c')](_0x860f72,function(_0x5ed9ca){if(_0x5ed9ca[_0xa766('0x3e')]!==_0xa766('0x3f')){var _0x28c33e={};_0x28c33e[_0x5ed9ca[_0xa766('0x29')]]={'$like':'%'+_0x38bc25[_0xa766('0x33')][_0xa766('0x3d')]+'%'};return _0x28c33e;}})});}_0x48020f=_[_0xa766('0x40')]({},_0x48020f,_0x38bc25[_0xa766('0x41')]);var _0x57cd07={'where':_0x48020f[_0xa766('0x42')]};return db[_0xa766('0x2d')][_0xa766('0x1f')](_0x57cd07)['then'](function(_0x36c4ce){_0x36ac27[_0xa766('0x1f')]=_0x36c4ce;if(_0x38bc25['query'][_0xa766('0x43')]){_0x48020f[_0xa766('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xa766('0x45')](_0x48020f);})[_0xa766('0x26')](function(_0x4c8d30){_0x36ac27[_0xa766('0x46')]=_0x4c8d30;return _0x36ac27;})[_0xa766('0x26')](respondWithFilteredResult(_0x587ead,_0x48020f))[_0xa766('0x47')](handleError(_0x587ead,null));};exports[_0xa766('0x48')]=function(_0x4cf5b2,_0x349f37){var _0x44c73f={'raw':![],'where':{'id':_0x4cf5b2[_0xa766('0x49')]['id']}},_0x5de944={};_0x5de944[_0xa766('0x31')]=_[_0xa766('0x32')](db[_0xa766('0x2d')][_0xa766('0x2e')]);_0x5de944[_0xa766('0x33')]=_['keys'](_0x4cf5b2[_0xa766('0x33')]);_0x5de944[_0xa766('0x34')]=_[_0xa766('0x35')](_0x5de944[_0xa766('0x31')],_0x5de944[_0xa766('0x33')]);_0x44c73f[_0xa766('0x36')]=_['intersection'](_0x5de944['model'],qs[_0xa766('0x37')](_0x4cf5b2[_0xa766('0x33')][_0xa766('0x37')]));_0x44c73f[_0xa766('0x36')]=_0x44c73f[_0xa766('0x36')][_0xa766('0x38')]?_0x44c73f[_0xa766('0x36')]:_0x5de944['model'];if(_0x4cf5b2['query'][_0xa766('0x43')]){_0x44c73f[_0xa766('0x44')]=[{'all':!![]}];}_0x44c73f=_[_0xa766('0x40')]({},_0x44c73f,_0x4cf5b2[_0xa766('0x41')]);return db[_0xa766('0x2d')]['find'](_0x44c73f)[_0xa766('0x26')](handleEntityNotFound(_0x349f37,null))['then'](respondWithResult(_0x349f37,null))[_0xa766('0x47')](handleError(_0x349f37,null));};exports[_0xa766('0x4a')]=function(_0x306271,_0x4cf713){return db[_0xa766('0x2d')]['create'](_0x306271[_0xa766('0x4b')],{})[_0xa766('0x26')](respondWithResult(_0x4cf713,0xc9))['catch'](handleError(_0x4cf713,null));};exports[_0xa766('0x4c')]=function(_0x3f1789,_0x28c2fb){if(_0x3f1789['body']['id']){delete _0x3f1789[_0xa766('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0xa766('0x4d')]({'where':{'id':_0x3f1789[_0xa766('0x49')]['id']}})[_0xa766('0x26')](handleEntityNotFound(_0x28c2fb,null))[_0xa766('0x26')](saveUpdates(_0x3f1789[_0xa766('0x4b')],null))['then'](respondWithResult(_0x28c2fb,null))[_0xa766('0x47')](handleError(_0x28c2fb,null));};exports[_0xa766('0x4e')]=function(_0xa55311,_0xf3c23){return db[_0xa766('0x2d')]['find']({'where':{'id':_0xa55311[_0xa766('0x49')]['id']}})['then'](handleEntityNotFound(_0xf3c23,null))[_0xa766('0x26')](removeEntity(_0xf3c23,null))[_0xa766('0x47')](handleError(_0xf3c23,null));};exports[_0xa766('0x4f')]=function(_0x42995b,_0x4c2cd5,_0x3cfb54){var _0x5151df={};var _0x2f740d={};var _0x144a9f;var _0x828c64;return db[_0xa766('0x2d')][_0xa766('0x50')]({'where':{'id':_0x42995b[_0xa766('0x49')]['id']}})[_0xa766('0x26')](handleEntityNotFound(_0x4c2cd5,null))[_0xa766('0x26')](function(_0x223e05){if(_0x223e05){_0x144a9f=_0x223e05;_0x2f740d['model']=_[_0xa766('0x32')](db[_0xa766('0x51')][_0xa766('0x2e')]);_0x2f740d['query']=_[_0xa766('0x32')](_0x42995b[_0xa766('0x33')]);_0x2f740d[_0xa766('0x34')]=_[_0xa766('0x35')](_0x2f740d[_0xa766('0x31')],_0x2f740d[_0xa766('0x33')]);_0x5151df[_0xa766('0x36')]=_[_0xa766('0x35')](_0x2f740d[_0xa766('0x31')],qs[_0xa766('0x37')](_0x42995b['query'][_0xa766('0x37')]));_0x5151df[_0xa766('0x36')]=_0x5151df[_0xa766('0x36')][_0xa766('0x38')]?_0x5151df[_0xa766('0x36')]:_0x2f740d[_0xa766('0x31')];_0x5151df[_0xa766('0x3a')]=qs[_0xa766('0x3b')](_0x42995b['query']['sort']);_0x5151df[_0xa766('0x42')]=qs[_0xa766('0x34')](_[_0xa766('0x3c')](_0x42995b[_0xa766('0x33')],_0x2f740d[_0xa766('0x34')]));if(_0x42995b[_0xa766('0x33')][_0xa766('0x3d')]){_0x5151df[_0xa766('0x42')]=_[_0xa766('0x40')](_0x5151df[_0xa766('0x42')],{'$or':_[_0xa766('0x2c')](_0x5151df['attributes'],function(_0x457bda){var _0x43d202={};_0x43d202[_0x457bda]={'$like':'%'+_0x42995b[_0xa766('0x33')][_0xa766('0x3d')]+'%'};return _0x43d202;})});}_0x5151df=_[_0xa766('0x40')]({},_0x5151df,_0x42995b[_0xa766('0x41')]);return _0x144a9f[_0xa766('0x4f')](_0x5151df);}})[_0xa766('0x26')](function(_0x415895){if(_0x415895){_0x828c64=_0x415895[_0xa766('0x38')];if(!_0x42995b['query'][_0xa766('0x52')](_0xa766('0x39'))){_0x5151df[_0xa766('0x1e')]=qs[_0xa766('0x1e')](_0x42995b[_0xa766('0x33')][_0xa766('0x1e')]);_0x5151df[_0xa766('0x20')]=qs[_0xa766('0x20')](_0x42995b[_0xa766('0x33')][_0xa766('0x20')]);}return _0x144a9f[_0xa766('0x4f')](_0x5151df);}})[_0xa766('0x26')](function(_0x519daf){if(_0x519daf){return _0x519daf?{'count':_0x828c64,'rows':_0x519daf}:null;}})[_0xa766('0x26')](respondWithResult(_0x4c2cd5,null))['catch'](handleError(_0x4c2cd5,null));};exports['getSubjects']=function(_0x5535f6,_0x13d088,_0x2d9691){var _0x524a24={};var _0x276217={};var _0x129a2f;var _0x57f6f3;return db[_0xa766('0x2d')]['findOne']({'where':{'id':_0x5535f6[_0xa766('0x49')]['id']}})[_0xa766('0x26')](handleEntityNotFound(_0x13d088,null))['then'](function(_0xbb91e9){if(_0xbb91e9){_0x129a2f=_0xbb91e9;_0x276217['model']=_[_0xa766('0x32')](db[_0xa766('0x51')][_0xa766('0x2e')]);_0x276217[_0xa766('0x33')]=_[_0xa766('0x32')](_0x5535f6['query']);_0x276217['filters']=_['intersection'](_0x276217[_0xa766('0x31')],_0x276217[_0xa766('0x33')]);_0x524a24[_0xa766('0x36')]=_[_0xa766('0x35')](_0x276217[_0xa766('0x31')],qs[_0xa766('0x37')](_0x5535f6[_0xa766('0x33')]['fields']));_0x524a24[_0xa766('0x36')]=_0x524a24[_0xa766('0x36')][_0xa766('0x38')]?_0x524a24[_0xa766('0x36')]:_0x276217[_0xa766('0x31')];_0x524a24[_0xa766('0x3a')]=qs[_0xa766('0x3b')](_0x5535f6[_0xa766('0x33')][_0xa766('0x3b')]);_0x524a24[_0xa766('0x42')]=qs[_0xa766('0x34')](_['pick'](_0x5535f6[_0xa766('0x33')],_0x276217[_0xa766('0x34')]));if(_0x5535f6['query']['filter']){_0x524a24[_0xa766('0x42')]=_[_0xa766('0x40')](_0x524a24[_0xa766('0x42')],{'$or':_[_0xa766('0x2c')](_0x524a24[_0xa766('0x36')],function(_0x43179e){var _0x25321f={};_0x25321f[_0x43179e]={'$like':'%'+_0x5535f6[_0xa766('0x33')][_0xa766('0x3d')]+'%'};return _0x25321f;})});}_0x524a24=_[_0xa766('0x40')]({},_0x524a24,_0x5535f6[_0xa766('0x41')]);return _0x129a2f[_0xa766('0x53')](_0x524a24);}})[_0xa766('0x26')](function(_0x344416){if(_0x344416){_0x57f6f3=_0x344416[_0xa766('0x38')];if(!_0x5535f6[_0xa766('0x33')]['hasOwnProperty'](_0xa766('0x39'))){_0x524a24[_0xa766('0x1e')]=qs[_0xa766('0x1e')](_0x5535f6[_0xa766('0x33')]['limit']);_0x524a24['offset']=qs[_0xa766('0x20')](_0x5535f6['query'][_0xa766('0x20')]);}return _0x129a2f[_0xa766('0x53')](_0x524a24);}})[_0xa766('0x26')](function(_0x28bf84){if(_0x28bf84){return _0x28bf84?{'count':_0x57f6f3,'rows':_0x28bf84}:null;}})[_0xa766('0x26')](respondWithResult(_0x13d088,null))[_0xa766('0x47')](handleError(_0x13d088,null));};exports[_0xa766('0x54')]=function(_0x45bd14,_0x460a17,_0x125918){var _0x45f9bf={};var _0x17b8cc={};var _0x31facd;var _0x42b237;return db[_0xa766('0x2d')][_0xa766('0x50')]({'where':{'id':_0x45bd14[_0xa766('0x49')]['id']}})['then'](handleEntityNotFound(_0x460a17,null))[_0xa766('0x26')](function(_0xd54e24){if(_0xd54e24){_0x31facd=_0xd54e24;_0x17b8cc['model']=_[_0xa766('0x32')](db[_0xa766('0x51')][_0xa766('0x2e')]);_0x17b8cc[_0xa766('0x33')]=_[_0xa766('0x32')](_0x45bd14[_0xa766('0x33')]);_0x17b8cc[_0xa766('0x34')]=_['intersection'](_0x17b8cc[_0xa766('0x31')],_0x17b8cc[_0xa766('0x33')]);_0x45f9bf['attributes']=_['intersection'](_0x17b8cc[_0xa766('0x31')],qs[_0xa766('0x37')](_0x45bd14[_0xa766('0x33')]['fields']));_0x45f9bf['attributes']=_0x45f9bf[_0xa766('0x36')][_0xa766('0x38')]?_0x45f9bf[_0xa766('0x36')]:_0x17b8cc['model'];_0x45f9bf[_0xa766('0x3a')]=qs[_0xa766('0x3b')](_0x45bd14[_0xa766('0x33')][_0xa766('0x3b')]);_0x45f9bf['where']=qs['filters'](_[_0xa766('0x3c')](_0x45bd14[_0xa766('0x33')],_0x17b8cc[_0xa766('0x34')]));if(_0x45bd14[_0xa766('0x33')]['filter']){_0x45f9bf[_0xa766('0x42')]=_[_0xa766('0x40')](_0x45f9bf[_0xa766('0x42')],{'$or':_[_0xa766('0x2c')](_0x45f9bf['attributes'],function(_0x4b1694){var _0x44cdee={};_0x44cdee[_0x4b1694]={'$like':'%'+_0x45bd14[_0xa766('0x33')][_0xa766('0x3d')]+'%'};return _0x44cdee;})});}_0x45f9bf=_[_0xa766('0x40')]({},_0x45f9bf,_0x45bd14[_0xa766('0x41')]);return _0x31facd[_0xa766('0x54')](_0x45f9bf);}})[_0xa766('0x26')](function(_0x2f849e){if(_0x2f849e){_0x42b237=_0x2f849e[_0xa766('0x38')];if(!_0x45bd14['query'][_0xa766('0x52')](_0xa766('0x39'))){_0x45f9bf[_0xa766('0x1e')]=qs[_0xa766('0x1e')](_0x45bd14[_0xa766('0x33')][_0xa766('0x1e')]);_0x45f9bf[_0xa766('0x20')]=qs[_0xa766('0x20')](_0x45bd14[_0xa766('0x33')][_0xa766('0x20')]);}return _0x31facd[_0xa766('0x54')](_0x45f9bf);}})[_0xa766('0x26')](function(_0x211861){if(_0x211861){return _0x211861?{'count':_0x42b237,'rows':_0x211861}:null;}})['then'](respondWithResult(_0x460a17,null))[_0xa766('0x47')](handleError(_0x460a17,null));};exports['getTags']=function(_0x74acf7,_0x38b046,_0x4b85b6){var _0x49cf92={};var _0x1ba1f0={};var _0x18482c;var _0x3354f1;return db[_0xa766('0x2d')][_0xa766('0x50')]({'where':{'id':_0x74acf7['params']['id']}})[_0xa766('0x26')](handleEntityNotFound(_0x38b046,null))[_0xa766('0x26')](function(_0x35c720){if(_0x35c720){_0x18482c=_0x35c720;_0x1ba1f0[_0xa766('0x31')]=_[_0xa766('0x32')](db[_0xa766('0x55')][_0xa766('0x2e')]);_0x1ba1f0['query']=_[_0xa766('0x32')](_0x74acf7[_0xa766('0x33')]);_0x1ba1f0['filters']=_[_0xa766('0x35')](_0x1ba1f0[_0xa766('0x31')],_0x1ba1f0[_0xa766('0x33')]);_0x49cf92['attributes']=_[_0xa766('0x35')](_0x1ba1f0[_0xa766('0x31')],qs[_0xa766('0x37')](_0x74acf7[_0xa766('0x33')][_0xa766('0x37')]));_0x49cf92[_0xa766('0x36')]=_0x49cf92['attributes']['length']?_0x49cf92[_0xa766('0x36')]:_0x1ba1f0['model'];_0x49cf92[_0xa766('0x3a')]=qs[_0xa766('0x3b')](_0x74acf7[_0xa766('0x33')]['sort']);_0x49cf92[_0xa766('0x42')]=qs[_0xa766('0x34')](_[_0xa766('0x3c')](_0x74acf7[_0xa766('0x33')],_0x1ba1f0[_0xa766('0x34')]));if(_0x74acf7[_0xa766('0x33')][_0xa766('0x3d')]){_0x49cf92[_0xa766('0x42')]=_['merge'](_0x49cf92[_0xa766('0x42')],{'$or':_[_0xa766('0x2c')](_0x49cf92[_0xa766('0x36')],function(_0x36ad74){var _0x50a860={};_0x50a860[_0x36ad74]={'$like':'%'+_0x74acf7['query'][_0xa766('0x3d')]+'%'};return _0x50a860;})});}_0x49cf92=_[_0xa766('0x40')]({},_0x49cf92,_0x74acf7[_0xa766('0x41')]);return _0x18482c[_0xa766('0x56')](_0x49cf92);}})['then'](function(_0x49ba2a){if(_0x49ba2a){_0x3354f1=_0x49ba2a[_0xa766('0x38')];if(!_0x74acf7[_0xa766('0x33')][_0xa766('0x52')](_0xa766('0x39'))){_0x49cf92['limit']=qs[_0xa766('0x1e')](_0x74acf7[_0xa766('0x33')][_0xa766('0x1e')]);_0x49cf92[_0xa766('0x20')]=qs[_0xa766('0x20')](_0x74acf7[_0xa766('0x33')]['offset']);}return _0x18482c[_0xa766('0x56')](_0x49cf92);}})[_0xa766('0x26')](function(_0x4c80e2){if(_0x4c80e2){return _0x4c80e2?{'count':_0x3354f1,'rows':_0x4c80e2}:null;}})['then'](respondWithResult(_0x38b046,null))['catch'](handleError(_0x38b046,null));};exports[_0xa766('0x57')]=function(_0x3542f4,_0x11a76e,_0x24b6bc){if(_0x3542f4[_0xa766('0x4b')]['id']){delete _0x3542f4[_0xa766('0x4b')]['id'];}return db[_0xa766('0x2d')][_0xa766('0x50')]({'where':{'id':_0x3542f4[_0xa766('0x49')]['id']}})['then'](handleEntityNotFound(_0x11a76e,null))[_0xa766('0x26')](function(_0x4548dc){if(_0x4548dc){return _0x4548dc[_0xa766('0x57')](_0x3542f4[_0xa766('0x4b')][_0xa766('0x58')]||[]);}return null;})[_0xa766('0x26')](respondWithResult(_0x11a76e,null))[_0xa766('0x47')](handleError(_0x11a76e,null));}; \ No newline at end of file +var _0x9c7c=['VIRTUAL','options','FreshdeskConfiguration','includeAll','rows','show','params','rawAttributes','include','find','create','body','catch','destroy','getFields','findOne','FreshdeskField','getSubjects','pick','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','send','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge'];(function(_0x202c57,_0x362b60){var _0x4faa61=function(_0x41e082){while(--_0x41e082){_0x202c57['push'](_0x202c57['shift']());}};_0x4faa61(++_0x362b60);}(_0x9c7c,0x119));var _0xc9c7=function(_0x2ea145,_0x459e23){_0x2ea145=_0x2ea145-0x0;var _0x2786d7=_0x9c7c[_0x2ea145];return _0x2786d7;};'use strict';var emlformat=require(_0xc9c7('0x0'));var rimraf=require(_0xc9c7('0x1'));var zipdir=require(_0xc9c7('0x2'));var jsonpatch=require(_0xc9c7('0x3'));var rp=require(_0xc9c7('0x4'));var moment=require('moment');var BPromise=require(_0xc9c7('0x5'));var Mustache=require(_0xc9c7('0x6'));var util=require(_0xc9c7('0x7'));var path=require(_0xc9c7('0x8'));var sox=require('sox');var csv=require(_0xc9c7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9c7('0xa'));var squel=require(_0xc9c7('0xb'));var crypto=require(_0xc9c7('0xc'));var jsforce=require(_0xc9c7('0xd'));var deskjs=require(_0xc9c7('0xe'));var toCsv=require(_0xc9c7('0x9'));var querystring=require(_0xc9c7('0xf'));var Papa=require('papaparse');var Redis=require(_0xc9c7('0x10'));var authService=require(_0xc9c7('0x11'));var qs=require(_0xc9c7('0x12'));var as=require(_0xc9c7('0x13'));var hardwareService=require(_0xc9c7('0x14'));var logger=require('../../config/logger')(_0xc9c7('0x15'));var utils=require(_0xc9c7('0x16'));var config=require(_0xc9c7('0x17'));var licenseUtil=require(_0xc9c7('0x18'));var db=require(_0xc9c7('0x19'))['db'];function respondWithStatusCode(_0x3d4cfb,_0x4aeb21){_0x4aeb21=_0x4aeb21||0xcc;return function(_0x16f075){if(_0x16f075){return _0x3d4cfb[_0xc9c7('0x1a')](_0x4aeb21);}return _0x3d4cfb[_0xc9c7('0x1b')](_0x4aeb21)['end']();};}function respondWithResult(_0x1bfd1b,_0x3402f8){_0x3402f8=_0x3402f8||0xc8;return function(_0x5e288e){if(_0x5e288e){return _0x1bfd1b[_0xc9c7('0x1b')](_0x3402f8)['json'](_0x5e288e);}};}function respondWithFilteredResult(_0x4e14ae,_0x47ef4c){return function(_0x3254df){if(_0x3254df){var _0x1a01d7=typeof _0x47ef4c[_0xc9c7('0x1c')]===_0xc9c7('0x1d')&&typeof _0x47ef4c[_0xc9c7('0x1e')]===_0xc9c7('0x1d');var _0x425706=_0x3254df[_0xc9c7('0x1f')];var _0x81209f=_0x1a01d7?0x0:_0x47ef4c[_0xc9c7('0x1c')];var _0x9a696a=_0x1a01d7?_0x3254df[_0xc9c7('0x1f')]:_0x47ef4c[_0xc9c7('0x1c')]+_0x47ef4c[_0xc9c7('0x1e')];var _0x1a9d25;if(_0x9a696a>=_0x425706){_0x9a696a=_0x425706;_0x1a9d25=0xc8;}else{_0x1a9d25=0xce;}_0x4e14ae['status'](_0x1a9d25);return _0x4e14ae[_0xc9c7('0x20')](_0xc9c7('0x21'),_0x81209f+'-'+_0x9a696a+'/'+_0x425706)[_0xc9c7('0x22')](_0x3254df);}return null;};}function patchUpdates(_0x376052){return function(_0x4f63a2){try{jsonpatch[_0xc9c7('0x23')](_0x4f63a2,_0x376052,!![]);}catch(_0x937785){return BPromise[_0xc9c7('0x24')](_0x937785);}return _0x4f63a2[_0xc9c7('0x25')]();};}function saveUpdates(_0xb20f17,_0x52589d){return function(_0x562a1e){if(_0x562a1e){return _0x562a1e[_0xc9c7('0x26')](_0xb20f17)[_0xc9c7('0x27')](function(_0x308723){return _0x308723;});}return null;};}function removeEntity(_0x4c0e14,_0x1659cf){return function(_0x129aaa){if(_0x129aaa){return _0x129aaa['destroy']()['then'](function(){_0x4c0e14['status'](0xcc)[_0xc9c7('0x28')]();});}};}function handleEntityNotFound(_0x2f3555,_0x1e78cb){return function(_0x49d11d){if(!_0x49d11d){_0x2f3555['sendStatus'](0x194);}return _0x49d11d;};}function handleError(_0x4c2e72,_0x3e6b0f){_0x3e6b0f=_0x3e6b0f||0x1f4;return function(_0x537ec6){logger['error'](_0x537ec6[_0xc9c7('0x29')]);if(_0x537ec6[_0xc9c7('0x2a')]){delete _0x537ec6[_0xc9c7('0x2a')];}_0x4c2e72[_0xc9c7('0x1b')](_0x3e6b0f)[_0xc9c7('0x2b')](_0x537ec6);};}exports[_0xc9c7('0x2c')]=function(_0x43e7ca,_0x4343b6){var _0x134e61={},_0x441c58={},_0x380b63={'count':0x0,'rows':[]};var _0x3b0f5b=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x55f51a){return{'name':_0x55f51a[_0xc9c7('0x2d')],'type':_0x55f51a[_0xc9c7('0x2e')]['key']};});_0x441c58[_0xc9c7('0x2f')]=_[_0xc9c7('0x30')](_0x3b0f5b,'name');_0x441c58[_0xc9c7('0x31')]=_[_0xc9c7('0x32')](_0x43e7ca[_0xc9c7('0x31')]);_0x441c58[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x441c58[_0xc9c7('0x2f')],_0x441c58[_0xc9c7('0x31')]);_0x134e61[_0xc9c7('0x35')]=_[_0xc9c7('0x34')](_0x441c58[_0xc9c7('0x2f')],qs[_0xc9c7('0x36')](_0x43e7ca['query']['fields']));_0x134e61['attributes']=_0x134e61['attributes'][_0xc9c7('0x37')]?_0x134e61[_0xc9c7('0x35')]:_0x441c58[_0xc9c7('0x2f')];if(!_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x134e61[_0xc9c7('0x1e')]=qs[_0xc9c7('0x1e')](_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x1e')]);_0x134e61[_0xc9c7('0x1c')]=qs[_0xc9c7('0x1c')](_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x1c')]);}_0x134e61[_0xc9c7('0x3a')]=qs[_0xc9c7('0x3b')](_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x134e61['where']=qs[_0xc9c7('0x33')](_['pick'](_0x43e7ca[_0xc9c7('0x31')],_0x441c58[_0xc9c7('0x33')]),_0x3b0f5b);if(_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x3c')]){_0x134e61[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x134e61['where'],{'$or':_[_0xc9c7('0x30')](_0x3b0f5b,function(_0x4c203e){if(_0x4c203e['type']!==_0xc9c7('0x3f')){var _0x52dc05={};_0x52dc05[_0x4c203e[_0xc9c7('0x2a')]]={'$like':'%'+_0x43e7ca['query'][_0xc9c7('0x3c')]+'%'};return _0x52dc05;}})});}_0x134e61=_[_0xc9c7('0x3e')]({},_0x134e61,_0x43e7ca[_0xc9c7('0x40')]);var _0x1bd177={'where':_0x134e61[_0xc9c7('0x3d')]};return db[_0xc9c7('0x41')][_0xc9c7('0x1f')](_0x1bd177)[_0xc9c7('0x27')](function(_0x58abcb){_0x380b63[_0xc9c7('0x1f')]=_0x58abcb;if(_0x43e7ca['query'][_0xc9c7('0x42')]){_0x134e61['include']=[{'all':!![]}];}return db[_0xc9c7('0x41')]['findAll'](_0x134e61);})[_0xc9c7('0x27')](function(_0x2d9e55){_0x380b63[_0xc9c7('0x43')]=_0x2d9e55;return _0x380b63;})[_0xc9c7('0x27')](respondWithFilteredResult(_0x4343b6,_0x134e61))['catch'](handleError(_0x4343b6,null));};exports[_0xc9c7('0x44')]=function(_0x1912d0,_0xb033b7){var _0x27690c={'raw':![],'where':{'id':_0x1912d0[_0xc9c7('0x45')]['id']}},_0x489f2b={};_0x489f2b['model']=_[_0xc9c7('0x32')](db[_0xc9c7('0x41')][_0xc9c7('0x46')]);_0x489f2b[_0xc9c7('0x31')]=_[_0xc9c7('0x32')](_0x1912d0[_0xc9c7('0x31')]);_0x489f2b[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x489f2b[_0xc9c7('0x2f')],_0x489f2b[_0xc9c7('0x31')]);_0x27690c['attributes']=_['intersection'](_0x489f2b['model'],qs[_0xc9c7('0x36')](_0x1912d0[_0xc9c7('0x31')][_0xc9c7('0x36')]));_0x27690c[_0xc9c7('0x35')]=_0x27690c[_0xc9c7('0x35')][_0xc9c7('0x37')]?_0x27690c[_0xc9c7('0x35')]:_0x489f2b[_0xc9c7('0x2f')];if(_0x1912d0['query']['includeAll']){_0x27690c[_0xc9c7('0x47')]=[{'all':!![]}];}_0x27690c=_[_0xc9c7('0x3e')]({},_0x27690c,_0x1912d0[_0xc9c7('0x40')]);return db[_0xc9c7('0x41')][_0xc9c7('0x48')](_0x27690c)[_0xc9c7('0x27')](handleEntityNotFound(_0xb033b7,null))[_0xc9c7('0x27')](respondWithResult(_0xb033b7,null))['catch'](handleError(_0xb033b7,null));};exports[_0xc9c7('0x49')]=function(_0x4cd0cf,_0x376add){return db[_0xc9c7('0x41')][_0xc9c7('0x49')](_0x4cd0cf['body'],{})[_0xc9c7('0x27')](respondWithResult(_0x376add,0xc9))['catch'](handleError(_0x376add,null));};exports[_0xc9c7('0x26')]=function(_0x16f7ed,_0x4ad94a){if(_0x16f7ed[_0xc9c7('0x4a')]['id']){delete _0x16f7ed[_0xc9c7('0x4a')]['id'];}return db[_0xc9c7('0x41')][_0xc9c7('0x48')]({'where':{'id':_0x16f7ed['params']['id']}})['then'](handleEntityNotFound(_0x4ad94a,null))[_0xc9c7('0x27')](saveUpdates(_0x16f7ed['body'],null))[_0xc9c7('0x27')](respondWithResult(_0x4ad94a,null))[_0xc9c7('0x4b')](handleError(_0x4ad94a,null));};exports[_0xc9c7('0x4c')]=function(_0x17390d,_0x591909){return db[_0xc9c7('0x41')]['find']({'where':{'id':_0x17390d[_0xc9c7('0x45')]['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0x591909,null))[_0xc9c7('0x27')](removeEntity(_0x591909,null))[_0xc9c7('0x4b')](handleError(_0x591909,null));};exports[_0xc9c7('0x4d')]=function(_0x1e893e,_0x143f72,_0x1a2304){var _0x11b00e={};var _0x1d0c7b={};var _0x29b4c8;var _0x12c483;return db[_0xc9c7('0x41')][_0xc9c7('0x4e')]({'where':{'id':_0x1e893e[_0xc9c7('0x45')]['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0x143f72,null))[_0xc9c7('0x27')](function(_0x508722){if(_0x508722){_0x29b4c8=_0x508722;_0x1d0c7b[_0xc9c7('0x2f')]=_['keys'](db[_0xc9c7('0x4f')][_0xc9c7('0x46')]);_0x1d0c7b[_0xc9c7('0x31')]=_[_0xc9c7('0x32')](_0x1e893e['query']);_0x1d0c7b[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x1d0c7b['model'],_0x1d0c7b[_0xc9c7('0x31')]);_0x11b00e[_0xc9c7('0x35')]=_[_0xc9c7('0x34')](_0x1d0c7b[_0xc9c7('0x2f')],qs[_0xc9c7('0x36')](_0x1e893e['query'][_0xc9c7('0x36')]));_0x11b00e[_0xc9c7('0x35')]=_0x11b00e[_0xc9c7('0x35')][_0xc9c7('0x37')]?_0x11b00e[_0xc9c7('0x35')]:_0x1d0c7b[_0xc9c7('0x2f')];_0x11b00e[_0xc9c7('0x3a')]=qs['sort'](_0x1e893e[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x11b00e[_0xc9c7('0x3d')]=qs[_0xc9c7('0x33')](_['pick'](_0x1e893e[_0xc9c7('0x31')],_0x1d0c7b['filters']));if(_0x1e893e[_0xc9c7('0x31')]['filter']){_0x11b00e[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x11b00e['where'],{'$or':_[_0xc9c7('0x30')](_0x11b00e[_0xc9c7('0x35')],function(_0xe198a6){var _0x3fd99c={};_0x3fd99c[_0xe198a6]={'$like':'%'+_0x1e893e[_0xc9c7('0x31')][_0xc9c7('0x3c')]+'%'};return _0x3fd99c;})});}_0x11b00e=_[_0xc9c7('0x3e')]({},_0x11b00e,_0x1e893e[_0xc9c7('0x40')]);return _0x29b4c8[_0xc9c7('0x4d')](_0x11b00e);}})['then'](function(_0x1da839){if(_0x1da839){_0x12c483=_0x1da839['length'];if(!_0x1e893e[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x11b00e[_0xc9c7('0x1e')]=qs['limit'](_0x1e893e[_0xc9c7('0x31')]['limit']);_0x11b00e[_0xc9c7('0x1c')]=qs[_0xc9c7('0x1c')](_0x1e893e[_0xc9c7('0x31')][_0xc9c7('0x1c')]);}return _0x29b4c8[_0xc9c7('0x4d')](_0x11b00e);}})[_0xc9c7('0x27')](function(_0x4b9506){if(_0x4b9506){return _0x4b9506?{'count':_0x12c483,'rows':_0x4b9506}:null;}})[_0xc9c7('0x27')](respondWithResult(_0x143f72,null))['catch'](handleError(_0x143f72,null));};exports[_0xc9c7('0x50')]=function(_0x46fc12,_0x532259,_0xe4af88){var _0x3a6118={};var _0x5392f8={};var _0x3f4f0b;var _0x34ab17;return db['FreshdeskConfiguration'][_0xc9c7('0x4e')]({'where':{'id':_0x46fc12['params']['id']}})['then'](handleEntityNotFound(_0x532259,null))[_0xc9c7('0x27')](function(_0x4a4104){if(_0x4a4104){_0x3f4f0b=_0x4a4104;_0x5392f8[_0xc9c7('0x2f')]=_[_0xc9c7('0x32')](db['FreshdeskField'][_0xc9c7('0x46')]);_0x5392f8['query']=_['keys'](_0x46fc12['query']);_0x5392f8[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x5392f8[_0xc9c7('0x2f')],_0x5392f8[_0xc9c7('0x31')]);_0x3a6118[_0xc9c7('0x35')]=_['intersection'](_0x5392f8['model'],qs['fields'](_0x46fc12['query'][_0xc9c7('0x36')]));_0x3a6118[_0xc9c7('0x35')]=_0x3a6118[_0xc9c7('0x35')]['length']?_0x3a6118[_0xc9c7('0x35')]:_0x5392f8[_0xc9c7('0x2f')];_0x3a6118[_0xc9c7('0x3a')]=qs[_0xc9c7('0x3b')](_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x3a6118[_0xc9c7('0x3d')]=qs[_0xc9c7('0x33')](_[_0xc9c7('0x51')](_0x46fc12[_0xc9c7('0x31')],_0x5392f8['filters']));if(_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x3c')]){_0x3a6118[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x3a6118[_0xc9c7('0x3d')],{'$or':_[_0xc9c7('0x30')](_0x3a6118[_0xc9c7('0x35')],function(_0x5b1ffa){var _0x2638b8={};_0x2638b8[_0x5b1ffa]={'$like':'%'+_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x3c')]+'%'};return _0x2638b8;})});}_0x3a6118=_[_0xc9c7('0x3e')]({},_0x3a6118,_0x46fc12[_0xc9c7('0x40')]);return _0x3f4f0b[_0xc9c7('0x50')](_0x3a6118);}})[_0xc9c7('0x27')](function(_0xed7bc){if(_0xed7bc){_0x34ab17=_0xed7bc['length'];if(!_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x3a6118[_0xc9c7('0x1e')]=qs['limit'](_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x1e')]);_0x3a6118[_0xc9c7('0x1c')]=qs[_0xc9c7('0x1c')](_0x46fc12['query'][_0xc9c7('0x1c')]);}return _0x3f4f0b['getSubjects'](_0x3a6118);}})['then'](function(_0x28deb1){if(_0x28deb1){return _0x28deb1?{'count':_0x34ab17,'rows':_0x28deb1}:null;}})[_0xc9c7('0x27')](respondWithResult(_0x532259,null))[_0xc9c7('0x4b')](handleError(_0x532259,null));};exports['getDescriptions']=function(_0x4d3fcd,_0xb178a7,_0x2012bd){var _0x4c7f90={};var _0x3e1d23={};var _0x48cb47;var _0x32c534;return db[_0xc9c7('0x41')][_0xc9c7('0x4e')]({'where':{'id':_0x4d3fcd[_0xc9c7('0x45')]['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0xb178a7,null))[_0xc9c7('0x27')](function(_0x2b1b9c){if(_0x2b1b9c){_0x48cb47=_0x2b1b9c;_0x3e1d23['model']=_[_0xc9c7('0x32')](db['FreshdeskField'][_0xc9c7('0x46')]);_0x3e1d23[_0xc9c7('0x31')]=_[_0xc9c7('0x32')](_0x4d3fcd[_0xc9c7('0x31')]);_0x3e1d23[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x3e1d23['model'],_0x3e1d23[_0xc9c7('0x31')]);_0x4c7f90['attributes']=_[_0xc9c7('0x34')](_0x3e1d23['model'],qs[_0xc9c7('0x36')](_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x36')]));_0x4c7f90[_0xc9c7('0x35')]=_0x4c7f90[_0xc9c7('0x35')][_0xc9c7('0x37')]?_0x4c7f90[_0xc9c7('0x35')]:_0x3e1d23['model'];_0x4c7f90[_0xc9c7('0x3a')]=qs[_0xc9c7('0x3b')](_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x4c7f90[_0xc9c7('0x3d')]=qs['filters'](_['pick'](_0x4d3fcd[_0xc9c7('0x31')],_0x3e1d23[_0xc9c7('0x33')]));if(_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x3c')]){_0x4c7f90[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x4c7f90[_0xc9c7('0x3d')],{'$or':_[_0xc9c7('0x30')](_0x4c7f90[_0xc9c7('0x35')],function(_0x36b6f7){var _0xdbdc8={};_0xdbdc8[_0x36b6f7]={'$like':'%'+_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x3c')]+'%'};return _0xdbdc8;})});}_0x4c7f90=_['merge']({},_0x4c7f90,_0x4d3fcd['options']);return _0x48cb47[_0xc9c7('0x52')](_0x4c7f90);}})[_0xc9c7('0x27')](function(_0x2bb42c){if(_0x2bb42c){_0x32c534=_0x2bb42c[_0xc9c7('0x37')];if(!_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x4c7f90[_0xc9c7('0x1e')]=qs[_0xc9c7('0x1e')](_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x1e')]);_0x4c7f90['offset']=qs[_0xc9c7('0x1c')](_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x1c')]);}return _0x48cb47[_0xc9c7('0x52')](_0x4c7f90);}})[_0xc9c7('0x27')](function(_0x2b3816){if(_0x2b3816){return _0x2b3816?{'count':_0x32c534,'rows':_0x2b3816}:null;}})[_0xc9c7('0x27')](respondWithResult(_0xb178a7,null))[_0xc9c7('0x4b')](handleError(_0xb178a7,null));};exports[_0xc9c7('0x53')]=function(_0x22292f,_0x498f4c,_0x3d3bd6){var _0x17dc2f={};var _0x1b878b={};var _0x4a4c5f;var _0x346035;return db['FreshdeskConfiguration'][_0xc9c7('0x4e')]({'where':{'id':_0x22292f['params']['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0x498f4c,null))[_0xc9c7('0x27')](function(_0xce4ebd){if(_0xce4ebd){_0x4a4c5f=_0xce4ebd;_0x1b878b[_0xc9c7('0x2f')]=_[_0xc9c7('0x32')](db[_0xc9c7('0x54')]['rawAttributes']);_0x1b878b[_0xc9c7('0x31')]=_['keys'](_0x22292f['query']);_0x1b878b['filters']=_[_0xc9c7('0x34')](_0x1b878b['model'],_0x1b878b['query']);_0x17dc2f[_0xc9c7('0x35')]=_[_0xc9c7('0x34')](_0x1b878b['model'],qs[_0xc9c7('0x36')](_0x22292f[_0xc9c7('0x31')]['fields']));_0x17dc2f[_0xc9c7('0x35')]=_0x17dc2f[_0xc9c7('0x35')][_0xc9c7('0x37')]?_0x17dc2f[_0xc9c7('0x35')]:_0x1b878b[_0xc9c7('0x2f')];_0x17dc2f['order']=qs[_0xc9c7('0x3b')](_0x22292f[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x17dc2f[_0xc9c7('0x3d')]=qs[_0xc9c7('0x33')](_['pick'](_0x22292f[_0xc9c7('0x31')],_0x1b878b[_0xc9c7('0x33')]));if(_0x22292f[_0xc9c7('0x31')]['filter']){_0x17dc2f[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x17dc2f[_0xc9c7('0x3d')],{'$or':_[_0xc9c7('0x30')](_0x17dc2f['attributes'],function(_0x123bb8){var _0x10926d={};_0x10926d[_0x123bb8]={'$like':'%'+_0x22292f['query'][_0xc9c7('0x3c')]+'%'};return _0x10926d;})});}_0x17dc2f=_[_0xc9c7('0x3e')]({},_0x17dc2f,_0x22292f[_0xc9c7('0x40')]);return _0x4a4c5f[_0xc9c7('0x53')](_0x17dc2f);}})[_0xc9c7('0x27')](function(_0x2a0c8c){if(_0x2a0c8c){_0x346035=_0x2a0c8c[_0xc9c7('0x37')];if(!_0x22292f[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x17dc2f[_0xc9c7('0x1e')]=qs[_0xc9c7('0x1e')](_0x22292f['query'][_0xc9c7('0x1e')]);_0x17dc2f['offset']=qs['offset'](_0x22292f[_0xc9c7('0x31')][_0xc9c7('0x1c')]);}return _0x4a4c5f[_0xc9c7('0x53')](_0x17dc2f);}})[_0xc9c7('0x27')](function(_0x25a630){if(_0x25a630){return _0x25a630?{'count':_0x346035,'rows':_0x25a630}:null;}})[_0xc9c7('0x27')](respondWithResult(_0x498f4c,null))[_0xc9c7('0x4b')](handleError(_0x498f4c,null));};exports[_0xc9c7('0x55')]=function(_0x1c9af3,_0x212dbb,_0x1cca1b){if(_0x1c9af3['body']['id']){delete _0x1c9af3[_0xc9c7('0x4a')]['id'];}return db[_0xc9c7('0x41')][_0xc9c7('0x4e')]({'where':{'id':_0x1c9af3[_0xc9c7('0x45')]['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0x212dbb,null))[_0xc9c7('0x27')](function(_0x4c37fd){if(_0x4c37fd){return _0x4c37fd[_0xc9c7('0x55')](_0x1c9af3['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x212dbb,null))[_0xc9c7('0x4b')](handleError(_0x212dbb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 588c316..f5992ab 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 _0x097c=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x68b90b,_0xb8b06a){var _0x5220ec=function(_0x226484){while(--_0x226484){_0x68b90b['push'](_0x68b90b['shift']());}};_0x5220ec(++_0xb8b06a);}(_0x097c,0x104));var _0xc097=function(_0x1bd9dc,_0x33425a){_0x1bd9dc=_0x1bd9dc-0x0;var _0x42be88=_0x097c[_0x1bd9dc];return _0x42be88;};'use strict';var _=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var logger=require('../../config/logger')(_0xc097('0x2'));var moment=require(_0xc097('0x3'));var BPromise=require(_0xc097('0x4'));var rp=require(_0xc097('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc097('0x6'));var config=require(_0xc097('0x7'));var attributes=require(_0xc097('0x8'));module[_0xc097('0x9')]=function(_0x51baf9,_0x3f45b2){return _0x51baf9[_0xc097('0xa')](_0xc097('0xb'),attributes,{'tableName':_0xc097('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dc3=['rimraf','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','api','moment','bluebird','request-promise','path'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4dc3,0x1a7));var _0x34dc=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x4dc3[_0x3df223];return _0x562d11;};'use strict';var _=require(_0x34dc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x34dc('0x1'));var moment=require(_0x34dc('0x2'));var BPromise=require(_0x34dc('0x3'));var rp=require(_0x34dc('0x4'));var fs=require('fs');var path=require(_0x34dc('0x5'));var rimraf=require(_0x34dc('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x34dc('0x7')]=function(_0x2336a5,_0x183824){return _0x2336a5[_0x34dc('0x8')](_0x34dc('0x9'),attributes,{'tableName':_0x34dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 264a7bb..5630469 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 _0x004c=['info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1b44b9,_0x2191fd){var _0x55b73c=function(_0x508d5b){while(--_0x508d5b){_0x1b44b9['push'](_0x1b44b9['shift']());}};_0x55b73c(++_0x2191fd);}(_0x004c,0x1bb));var _0xc004=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x004c[_0x725b8e];return _0x43ac45;};'use strict';var _=require('lodash');var util=require(_0xc004('0x0'));var moment=require('moment');var BPromise=require(_0xc004('0x1'));var rs=require(_0xc004('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc004('0x3'))['db'];var utils=require(_0xc004('0x4'));var logger=require('../../config/logger')(_0xc004('0x5'));var config=require(_0xc004('0x6'));var jayson=require(_0xc004('0x7'));var client=jayson[_0xc004('0x8')][_0xc004('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2edf4a,_0x578c13,_0x46f8f5){return new BPromise(function(_0x2234a8,_0x1d2831){return client['request'](_0x2edf4a,_0x46f8f5)[_0xc004('0xa')](function(_0xcca61f){logger['info'](_0xc004('0xb'),_0x578c13,_0xc004('0xc'));logger[_0xc004('0xd')](_0xc004('0xe'),_0x578c13,_0xc004('0xc'),JSON[_0xc004('0xf')](_0xcca61f));if(_0xcca61f['error']){if(_0xcca61f[_0xc004('0x10')][_0xc004('0x11')]===0x1f4){logger[_0xc004('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x578c13,_0xcca61f[_0xc004('0x10')][_0xc004('0x12')]);return _0x1d2831(_0xcca61f[_0xc004('0x10')][_0xc004('0x12')]);}logger[_0xc004('0x10')](_0xc004('0xb'),_0x578c13,_0xcca61f[_0xc004('0x10')][_0xc004('0x12')]);return _0x2234a8(_0xcca61f[_0xc004('0x10')]['message']);}else{logger[_0xc004('0x13')](_0xc004('0xb'),_0x578c13,'request\x20sent');_0x2234a8(_0xcca61f[_0xc004('0x14')][_0xc004('0x12')]);}})[_0xc004('0x15')](function(_0xde2857){logger[_0xc004('0x10')](_0xc004('0xb'),_0x578c13,_0xde2857);_0x1d2831(_0xde2857);});});} \ No newline at end of file +var _0x93ab=['rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x394aa8,_0x3dca8a){var _0x46850f=function(_0x3110f2){while(--_0x3110f2){_0x394aa8['push'](_0x394aa8['shift']());}};_0x46850f(++_0x3dca8a);}(_0x93ab,0xc7));var _0xb93a=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0x93ab[_0x3a99f4];return _0xea0b42;};'use strict';var _=require(_0xb93a('0x0'));var util=require(_0xb93a('0x1'));var moment=require(_0xb93a('0x2'));var BPromise=require(_0xb93a('0x3'));var rs=require(_0xb93a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb93a('0x5'))['db'];var utils=require(_0xb93a('0x6'));var logger=require(_0xb93a('0x7'))(_0xb93a('0x8'));var config=require(_0xb93a('0x9'));var jayson=require(_0xb93a('0xa'));var client=jayson[_0xb93a('0xb')][_0xb93a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x393854,_0x58cfcc,_0x280bfa){return new BPromise(function(_0x51f16b,_0x2b83a5){return client['request'](_0x393854,_0x280bfa)[_0xb93a('0xd')](function(_0x5123d4){logger[_0xb93a('0xe')](_0xb93a('0xf'),_0x58cfcc,_0xb93a('0x10'));logger[_0xb93a('0x11')](_0xb93a('0x12'),_0x58cfcc,'request\x20sent',JSON['stringify'](_0x5123d4));if(_0x5123d4[_0xb93a('0x13')]){if(_0x5123d4[_0xb93a('0x13')][_0xb93a('0x14')]===0x1f4){logger[_0xb93a('0x13')](_0xb93a('0xf'),_0x58cfcc,_0x5123d4['error']['message']);return _0x2b83a5(_0x5123d4['error'][_0xb93a('0x15')]);}logger[_0xb93a('0x13')](_0xb93a('0xf'),_0x58cfcc,_0x5123d4[_0xb93a('0x13')][_0xb93a('0x15')]);return _0x51f16b(_0x5123d4[_0xb93a('0x13')][_0xb93a('0x15')]);}else{logger[_0xb93a('0xe')](_0xb93a('0xf'),_0x58cfcc,_0xb93a('0x10'));_0x51f16b(_0x5123d4['result'][_0xb93a('0x15')]);}})[_0xb93a('0x16')](function(_0x418147){logger['error'](_0xb93a('0xf'),_0x58cfcc,_0x418147);_0x2b83a5(_0x418147);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 144e1d2..6e2b1ea 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 _0x1b5d=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x4cd3e3,_0x10f7fc){var _0x4c4f1d=function(_0x27a98b){while(--_0x27a98b){_0x4cd3e3['push'](_0x4cd3e3['shift']());}};_0x4c4f1d(++_0x10f7fc);}(_0x1b5d,0xd2));var _0xd1b5=function(_0x307c85,_0x2d6aee){_0x307c85=_0x307c85-0x0;var _0x2d1933=_0x1b5d[_0x307c85];return _0x2d1933;};'use strict';var multer=require(_0xd1b5('0x0'));var util=require(_0xd1b5('0x1'));var path=require(_0xd1b5('0x2'));var timeout=require(_0xd1b5('0x3'));var express=require(_0xd1b5('0x4'));var router=express[_0xd1b5('0x5')]();var fs_extra=require(_0xd1b5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd1b5('0x7'));var config=require(_0xd1b5('0x8'));var controller=require(_0xd1b5('0x9'));router[_0xd1b5('0xa')]('/',auth[_0xd1b5('0xb')](),controller[_0xd1b5('0xc')]);router['get'](_0xd1b5('0xd'),auth[_0xd1b5('0xb')](),controller[_0xd1b5('0xe')]);router[_0xd1b5('0xf')]('/',auth[_0xd1b5('0xb')](),controller['create']);router[_0xd1b5('0x10')]('/:id',auth[_0xd1b5('0xb')](),controller[_0xd1b5('0x11')]);router['delete'](_0xd1b5('0xd'),auth[_0xd1b5('0xb')](),controller['destroy']);module[_0xd1b5('0x12')]=router; \ No newline at end of file +var _0xced2=['../../components/auth/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','fs-extra'];(function(_0x2441b2,_0x55e94f){var _0x24ca0f=function(_0x4de21a){while(--_0x4de21a){_0x2441b2['push'](_0x2441b2['shift']());}};_0x24ca0f(++_0x55e94f);}(_0xced2,0xb0));var _0x2ced=function(_0x2af209,_0x21a41b){_0x2af209=_0x2af209-0x0;var _0x4e126e=_0xced2[_0x2af209];return _0x4e126e;};'use strict';var multer=require(_0x2ced('0x0'));var util=require(_0x2ced('0x1'));var path=require('path');var timeout=require(_0x2ced('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ced('0x3'));var auth=require(_0x2ced('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x2ced('0x5')]('/',auth[_0x2ced('0x6')](),controller['index']);router[_0x2ced('0x5')](_0x2ced('0x7'),auth[_0x2ced('0x6')](),controller[_0x2ced('0x8')]);router[_0x2ced('0x9')]('/',auth[_0x2ced('0x6')](),controller[_0x2ced('0xa')]);router[_0x2ced('0xb')](_0x2ced('0x7'),auth[_0x2ced('0x6')](),controller[_0x2ced('0xc')]);router[_0x2ced('0xd')]('/:id',auth[_0x2ced('0x6')](),controller[_0x2ced('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 3b50059..2266796 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 _0x5a87=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x1f0731,_0x312963){var _0x137e06=function(_0x294772){while(--_0x294772){_0x1f0731['push'](_0x1f0731['shift']());}};_0x137e06(++_0x312963);}(_0x5a87,0x17a));var _0x75a8=function(_0x43cf8f,_0x1c436c){_0x43cf8f=_0x43cf8f-0x0;var _0x928a69=_0x5a87[_0x43cf8f];return _0x928a69;};'use strict';var Sequelize=require(_0x75a8('0x0'));module[_0x75a8('0x1')]={'type':{'type':Sequelize[_0x75a8('0x2')](_0x75a8('0x3'),_0x75a8('0x4'),_0x75a8('0x5'),_0x75a8('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x75a8('0x2')]('string',_0x75a8('0x4'),_0x75a8('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x75a8('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x75a8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x75a8('0x7')]}}; \ No newline at end of file +var _0x918f=['BOOLEAN','sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM'];(function(_0x43874f,_0x495366){var _0x28eef8=function(_0x439c6a){while(--_0x439c6a){_0x43874f['push'](_0x43874f['shift']());}};_0x28eef8(++_0x495366);}(_0x918f,0x17b));var _0xf918=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x918f[_0x585ee5];return _0x470808;};'use strict';var Sequelize=require(_0xf918('0x0'));module[_0xf918('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf918('0x2'),_0xf918('0x3'),'customVariable',_0xf918('0x4'),_0xf918('0x5')),'defaultValue':_0xf918('0x2')},'content':{'type':Sequelize[_0xf918('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf918('0x7')](_0xf918('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf918('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf918('0x6')]},'customField':{'type':Sequelize[_0xf918('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e674cf4..6be9ac9 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 _0x2bc6=['crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','FreshdeskField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','rawAttributes','fields','find','create','body','eml-format','rimraf','zip-dir','mustache','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x3e2ca4,_0x4b8ec1){var _0x1659c0=function(_0x2a0a2f){while(--_0x2a0a2f){_0x3e2ca4['push'](_0x3e2ca4['shift']());}};_0x1659c0(++_0x4b8ec1);}(_0x2bc6,0x163));var _0x62bc=function(_0x13daeb,_0x1858f6){_0x13daeb=_0x13daeb-0x0;var _0x2922e6=_0x2bc6[_0x13daeb];return _0x2922e6;};'use strict';var emlformat=require(_0x62bc('0x0'));var rimraf=require(_0x62bc('0x1'));var zipdir=require(_0x62bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x62bc('0x3'));var util=require('util');var path=require(_0x62bc('0x4'));var sox=require(_0x62bc('0x5'));var csv=require('to-csv');var ejs=require(_0x62bc('0x6'));var fs=require('fs');var fs_extra=require(_0x62bc('0x7'));var _=require(_0x62bc('0x8'));var squel=require(_0x62bc('0x9'));var crypto=require(_0x62bc('0xa'));var jsforce=require(_0x62bc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x62bc('0xc'));var querystring=require(_0x62bc('0xd'));var Papa=require(_0x62bc('0xe'));var Redis=require(_0x62bc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x62bc('0x10'));var as=require(_0x62bc('0x11'));var hardwareService=require(_0x62bc('0x12'));var logger=require('../../config/logger')(_0x62bc('0x13'));var utils=require(_0x62bc('0x14'));var config=require(_0x62bc('0x15'));var licenseUtil=require(_0x62bc('0x16'));var db=require(_0x62bc('0x17'))['db'];function respondWithStatusCode(_0x2a9309,_0x414a08){_0x414a08=_0x414a08||0xcc;return function(_0x4f92f7){if(_0x4f92f7){return _0x2a9309[_0x62bc('0x18')](_0x414a08);}return _0x2a9309[_0x62bc('0x19')](_0x414a08)['end']();};}function respondWithResult(_0x314358,_0x10230f){_0x10230f=_0x10230f||0xc8;return function(_0xc14ac9){if(_0xc14ac9){return _0x314358['status'](_0x10230f)[_0x62bc('0x1a')](_0xc14ac9);}};}function respondWithFilteredResult(_0x94b649,_0x56eade){return function(_0x515c80){if(_0x515c80){var _0x39c5e0=typeof _0x56eade[_0x62bc('0x1b')]==='undefined'&&typeof _0x56eade[_0x62bc('0x1c')]===_0x62bc('0x1d');var _0xc1211c=_0x515c80[_0x62bc('0x1e')];var _0xc95407=_0x39c5e0?0x0:_0x56eade[_0x62bc('0x1b')];var _0x1d3d8f=_0x39c5e0?_0x515c80[_0x62bc('0x1e')]:_0x56eade[_0x62bc('0x1b')]+_0x56eade['limit'];var _0x5dd6f0;if(_0x1d3d8f>=_0xc1211c){_0x1d3d8f=_0xc1211c;_0x5dd6f0=0xc8;}else{_0x5dd6f0=0xce;}_0x94b649[_0x62bc('0x19')](_0x5dd6f0);return _0x94b649[_0x62bc('0x1f')](_0x62bc('0x20'),_0xc95407+'-'+_0x1d3d8f+'/'+_0xc1211c)['json'](_0x515c80);}return null;};}function patchUpdates(_0x380621){return function(_0x495f99){try{jsonpatch[_0x62bc('0x21')](_0x495f99,_0x380621,!![]);}catch(_0x37ab87){return BPromise[_0x62bc('0x22')](_0x37ab87);}return _0x495f99['save']();};}function saveUpdates(_0x3b8644,_0x28757d){return function(_0xae87bf){if(_0xae87bf){return _0xae87bf[_0x62bc('0x23')](_0x3b8644)[_0x62bc('0x24')](function(_0x3b2eb0){return _0x3b2eb0;});}return null;};}function removeEntity(_0x5b2e16,_0x70e428){return function(_0xb0d0fb){if(_0xb0d0fb){return _0xb0d0fb[_0x62bc('0x25')]()[_0x62bc('0x24')](function(){_0x5b2e16[_0x62bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ca86,_0xcd4b0){return function(_0x58e76a){if(!_0x58e76a){_0x52ca86[_0x62bc('0x18')](0x194);}return _0x58e76a;};}function handleError(_0x36af97,_0x1e046d){_0x1e046d=_0x1e046d||0x1f4;return function(_0x4a72d6){logger[_0x62bc('0x26')](_0x4a72d6[_0x62bc('0x27')]);if(_0x4a72d6[_0x62bc('0x28')]){delete _0x4a72d6['name'];}_0x36af97['status'](_0x1e046d)[_0x62bc('0x29')](_0x4a72d6);};}exports[_0x62bc('0x2a')]=function(_0x23817c,_0x4df640){var _0x4313ba={},_0x1f2985={},_0x44600f={'count':0x0,'rows':[]};var _0x444267=_['map'](db[_0x62bc('0x2b')]['rawAttributes'],function(_0x26701b){return{'name':_0x26701b[_0x62bc('0x2c')],'type':_0x26701b[_0x62bc('0x2d')][_0x62bc('0x2e')]};});_0x1f2985[_0x62bc('0x2f')]=_[_0x62bc('0x30')](_0x444267,_0x62bc('0x28'));_0x1f2985[_0x62bc('0x31')]=_[_0x62bc('0x32')](_0x23817c[_0x62bc('0x31')]);_0x1f2985[_0x62bc('0x33')]=_[_0x62bc('0x34')](_0x1f2985[_0x62bc('0x2f')],_0x1f2985[_0x62bc('0x31')]);_0x4313ba[_0x62bc('0x35')]=_[_0x62bc('0x34')](_0x1f2985[_0x62bc('0x2f')],qs['fields'](_0x23817c[_0x62bc('0x31')]['fields']));_0x4313ba['attributes']=_0x4313ba[_0x62bc('0x35')]['length']?_0x4313ba['attributes']:_0x1f2985['model'];if(!_0x23817c[_0x62bc('0x31')][_0x62bc('0x36')](_0x62bc('0x37'))){_0x4313ba['limit']=qs['limit'](_0x23817c['query'][_0x62bc('0x1c')]);_0x4313ba[_0x62bc('0x1b')]=qs['offset'](_0x23817c['query'][_0x62bc('0x1b')]);}_0x4313ba[_0x62bc('0x38')]=qs[_0x62bc('0x39')](_0x23817c['query'][_0x62bc('0x39')]);_0x4313ba[_0x62bc('0x3a')]=qs[_0x62bc('0x33')](_[_0x62bc('0x3b')](_0x23817c['query'],_0x1f2985[_0x62bc('0x33')]),_0x444267);if(_0x23817c[_0x62bc('0x31')]['filter']){_0x4313ba[_0x62bc('0x3a')]=_[_0x62bc('0x3c')](_0x4313ba[_0x62bc('0x3a')],{'$or':_[_0x62bc('0x30')](_0x444267,function(_0x599aed){if(_0x599aed[_0x62bc('0x2d')]!=='VIRTUAL'){var _0x38230a={};_0x38230a[_0x599aed[_0x62bc('0x28')]]={'$like':'%'+_0x23817c[_0x62bc('0x31')][_0x62bc('0x3d')]+'%'};return _0x38230a;}})});}_0x4313ba=_['merge']({},_0x4313ba,_0x23817c[_0x62bc('0x3e')]);var _0x5c806b={'where':_0x4313ba[_0x62bc('0x3a')]};return db[_0x62bc('0x2b')][_0x62bc('0x1e')](_0x5c806b)[_0x62bc('0x24')](function(_0x9011f2){_0x44600f[_0x62bc('0x1e')]=_0x9011f2;if(_0x23817c[_0x62bc('0x31')][_0x62bc('0x3f')]){_0x4313ba[_0x62bc('0x40')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x4313ba);})[_0x62bc('0x24')](function(_0x400779){_0x44600f['rows']=_0x400779;return _0x44600f;})[_0x62bc('0x24')](respondWithFilteredResult(_0x4df640,_0x4313ba))[_0x62bc('0x41')](handleError(_0x4df640,null));};exports[_0x62bc('0x42')]=function(_0xedc9f3,_0xbd8c7e){var _0x5f3752={'raw':!![],'where':{'id':_0xedc9f3[_0x62bc('0x43')]['id']}},_0x3bf043={};_0x3bf043['model']=_['keys'](db[_0x62bc('0x2b')][_0x62bc('0x44')]);_0x3bf043[_0x62bc('0x31')]=_['keys'](_0xedc9f3[_0x62bc('0x31')]);_0x3bf043[_0x62bc('0x33')]=_[_0x62bc('0x34')](_0x3bf043[_0x62bc('0x2f')],_0x3bf043[_0x62bc('0x31')]);_0x5f3752[_0x62bc('0x35')]=_['intersection'](_0x3bf043[_0x62bc('0x2f')],qs['fields'](_0xedc9f3[_0x62bc('0x31')][_0x62bc('0x45')]));_0x5f3752[_0x62bc('0x35')]=_0x5f3752['attributes']['length']?_0x5f3752['attributes']:_0x3bf043[_0x62bc('0x2f')];if(_0xedc9f3['query'][_0x62bc('0x3f')]){_0x5f3752[_0x62bc('0x40')]=[{'all':!![]}];}_0x5f3752=_['merge']({},_0x5f3752,_0xedc9f3['options']);return db['FreshdeskField'][_0x62bc('0x46')](_0x5f3752)[_0x62bc('0x24')](handleEntityNotFound(_0xbd8c7e,null))[_0x62bc('0x24')](respondWithResult(_0xbd8c7e,null))[_0x62bc('0x41')](handleError(_0xbd8c7e,null));};exports[_0x62bc('0x47')]=function(_0x49389f,_0x3834b2){return db[_0x62bc('0x2b')]['create'](_0x49389f[_0x62bc('0x48')],{})['then'](respondWithResult(_0x3834b2,0xc9))[_0x62bc('0x41')](handleError(_0x3834b2,null));};exports[_0x62bc('0x23')]=function(_0x17e0ec,_0xca6190){if(_0x17e0ec[_0x62bc('0x48')]['id']){delete _0x17e0ec[_0x62bc('0x48')]['id'];}return db[_0x62bc('0x2b')]['find']({'where':{'id':_0x17e0ec[_0x62bc('0x43')]['id']}})[_0x62bc('0x24')](handleEntityNotFound(_0xca6190,null))['then'](saveUpdates(_0x17e0ec[_0x62bc('0x48')],null))['then'](respondWithResult(_0xca6190,null))[_0x62bc('0x41')](handleError(_0xca6190,null));};exports[_0x62bc('0x25')]=function(_0x4bec08,_0x6c2969){return db[_0x62bc('0x2b')][_0x62bc('0x46')]({'where':{'id':_0x4bec08['params']['id']}})[_0x62bc('0x24')](handleEntityNotFound(_0x6c2969,null))[_0x62bc('0x24')](removeEntity(_0x6c2969,null))[_0x62bc('0x41')](handleError(_0x6c2969,null));}; \ No newline at end of file +var _0x4227=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','sendStatus','stack','name','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','options','FreshdeskField','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','fast-json-patch','moment'];(function(_0x170a33,_0x22cd64){var _0x3d5687=function(_0x4f7299){while(--_0x4f7299){_0x170a33['push'](_0x170a33['shift']());}};_0x3d5687(++_0x22cd64);}(_0x4227,0x89));var _0x7422=function(_0x5ca065,_0x2d2a06){_0x5ca065=_0x5ca065-0x0;var _0x233401=_0x4227[_0x5ca065];return _0x233401;};'use strict';var emlformat=require(_0x7422('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7422('0x1'));var rp=require('request-promise');var moment=require(_0x7422('0x2'));var BPromise=require(_0x7422('0x3'));var Mustache=require(_0x7422('0x4'));var util=require('util');var path=require(_0x7422('0x5'));var sox=require(_0x7422('0x6'));var csv=require(_0x7422('0x7'));var ejs=require(_0x7422('0x8'));var fs=require('fs');var fs_extra=require(_0x7422('0x9'));var _=require(_0x7422('0xa'));var squel=require(_0x7422('0xb'));var crypto=require(_0x7422('0xc'));var jsforce=require(_0x7422('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7422('0x7'));var querystring=require(_0x7422('0xe'));var Papa=require(_0x7422('0xf'));var Redis=require('ioredis');var authService=require(_0x7422('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7422('0x11'));var hardwareService=require(_0x7422('0x12'));var logger=require(_0x7422('0x13'))(_0x7422('0x14'));var utils=require(_0x7422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7422('0x16'));var db=require(_0x7422('0x17'))['db'];function respondWithStatusCode(_0x575c47,_0xb06dc6){_0xb06dc6=_0xb06dc6||0xcc;return function(_0x2acd6c){if(_0x2acd6c){return _0x575c47['sendStatus'](_0xb06dc6);}return _0x575c47[_0x7422('0x18')](_0xb06dc6)[_0x7422('0x19')]();};}function respondWithResult(_0x555082,_0x4d3f91){_0x4d3f91=_0x4d3f91||0xc8;return function(_0xeafd58){if(_0xeafd58){return _0x555082['status'](_0x4d3f91)[_0x7422('0x1a')](_0xeafd58);}};}function respondWithFilteredResult(_0x788829,_0x487c93){return function(_0x149c50){if(_0x149c50){var _0x39c31c=typeof _0x487c93[_0x7422('0x1b')]===_0x7422('0x1c')&&typeof _0x487c93[_0x7422('0x1d')]===_0x7422('0x1c');var _0x4e2b60=_0x149c50[_0x7422('0x1e')];var _0xa7ff41=_0x39c31c?0x0:_0x487c93[_0x7422('0x1b')];var _0x30656d=_0x39c31c?_0x149c50['count']:_0x487c93[_0x7422('0x1b')]+_0x487c93['limit'];var _0x22a1c8;if(_0x30656d>=_0x4e2b60){_0x30656d=_0x4e2b60;_0x22a1c8=0xc8;}else{_0x22a1c8=0xce;}_0x788829[_0x7422('0x18')](_0x22a1c8);return _0x788829[_0x7422('0x1f')]('Content-Range',_0xa7ff41+'-'+_0x30656d+'/'+_0x4e2b60)[_0x7422('0x1a')](_0x149c50);}return null;};}function patchUpdates(_0xacaad1){return function(_0x368e96){try{jsonpatch[_0x7422('0x20')](_0x368e96,_0xacaad1,!![]);}catch(_0x55f98f){return BPromise['reject'](_0x55f98f);}return _0x368e96[_0x7422('0x21')]();};}function saveUpdates(_0x380ef7,_0x20c1e3){return function(_0x7d34f2){if(_0x7d34f2){return _0x7d34f2[_0x7422('0x22')](_0x380ef7)[_0x7422('0x23')](function(_0xe4f174){return _0xe4f174;});}return null;};}function removeEntity(_0x596b89,_0x24ce62){return function(_0x46b927){if(_0x46b927){return _0x46b927['destroy']()[_0x7422('0x23')](function(){_0x596b89[_0x7422('0x18')](0xcc)[_0x7422('0x19')]();});}};}function handleEntityNotFound(_0x3eeb9c,_0x5436a4){return function(_0x3f579a){if(!_0x3f579a){_0x3eeb9c[_0x7422('0x24')](0x194);}return _0x3f579a;};}function handleError(_0x3cdea0,_0x2dd10f){_0x2dd10f=_0x2dd10f||0x1f4;return function(_0x3438d1){logger['error'](_0x3438d1[_0x7422('0x25')]);if(_0x3438d1[_0x7422('0x26')]){delete _0x3438d1[_0x7422('0x26')];}_0x3cdea0[_0x7422('0x18')](_0x2dd10f)['send'](_0x3438d1);};}exports[_0x7422('0x27')]=function(_0x20f71e,_0x9b0144){var _0x702aef={},_0x59bc52={},_0x1cd623={'count':0x0,'rows':[]};var _0x41d4a1=_['map'](db['FreshdeskField'][_0x7422('0x28')],function(_0x2fb125){return{'name':_0x2fb125['fieldName'],'type':_0x2fb125[_0x7422('0x29')][_0x7422('0x2a')]};});_0x59bc52[_0x7422('0x2b')]=_[_0x7422('0x2c')](_0x41d4a1,_0x7422('0x26'));_0x59bc52[_0x7422('0x2d')]=_[_0x7422('0x2e')](_0x20f71e[_0x7422('0x2d')]);_0x59bc52[_0x7422('0x2f')]=_[_0x7422('0x30')](_0x59bc52[_0x7422('0x2b')],_0x59bc52['query']);_0x702aef[_0x7422('0x31')]=_[_0x7422('0x30')](_0x59bc52[_0x7422('0x2b')],qs[_0x7422('0x32')](_0x20f71e['query'][_0x7422('0x32')]));_0x702aef[_0x7422('0x31')]=_0x702aef[_0x7422('0x31')]['length']?_0x702aef['attributes']:_0x59bc52[_0x7422('0x2b')];if(!_0x20f71e['query'][_0x7422('0x33')]('nolimit')){_0x702aef[_0x7422('0x1d')]=qs['limit'](_0x20f71e[_0x7422('0x2d')]['limit']);_0x702aef['offset']=qs[_0x7422('0x1b')](_0x20f71e['query'][_0x7422('0x1b')]);}_0x702aef[_0x7422('0x34')]=qs[_0x7422('0x35')](_0x20f71e[_0x7422('0x2d')][_0x7422('0x35')]);_0x702aef[_0x7422('0x36')]=qs[_0x7422('0x2f')](_['pick'](_0x20f71e[_0x7422('0x2d')],_0x59bc52[_0x7422('0x2f')]),_0x41d4a1);if(_0x20f71e[_0x7422('0x2d')][_0x7422('0x37')]){_0x702aef[_0x7422('0x36')]=_['merge'](_0x702aef[_0x7422('0x36')],{'$or':_[_0x7422('0x2c')](_0x41d4a1,function(_0x5bfbf6){if(_0x5bfbf6[_0x7422('0x29')]!=='VIRTUAL'){var _0x47486b={};_0x47486b[_0x5bfbf6['name']]={'$like':'%'+_0x20f71e['query'][_0x7422('0x37')]+'%'};return _0x47486b;}})});}_0x702aef=_[_0x7422('0x38')]({},_0x702aef,_0x20f71e[_0x7422('0x39')]);var _0x57a500={'where':_0x702aef[_0x7422('0x36')]};return db[_0x7422('0x3a')]['count'](_0x57a500)[_0x7422('0x23')](function(_0x5df470){_0x1cd623[_0x7422('0x1e')]=_0x5df470;if(_0x20f71e[_0x7422('0x2d')][_0x7422('0x3b')]){_0x702aef[_0x7422('0x3c')]=[{'all':!![]}];}return db[_0x7422('0x3a')][_0x7422('0x3d')](_0x702aef);})[_0x7422('0x23')](function(_0x50b48f){_0x1cd623[_0x7422('0x3e')]=_0x50b48f;return _0x1cd623;})[_0x7422('0x23')](respondWithFilteredResult(_0x9b0144,_0x702aef))['catch'](handleError(_0x9b0144,null));};exports[_0x7422('0x3f')]=function(_0x98c659,_0x5719df){var _0xca1546={'raw':!![],'where':{'id':_0x98c659[_0x7422('0x40')]['id']}},_0x4e2cd4={};_0x4e2cd4['model']=_[_0x7422('0x2e')](db[_0x7422('0x3a')][_0x7422('0x28')]);_0x4e2cd4[_0x7422('0x2d')]=_[_0x7422('0x2e')](_0x98c659[_0x7422('0x2d')]);_0x4e2cd4[_0x7422('0x2f')]=_[_0x7422('0x30')](_0x4e2cd4[_0x7422('0x2b')],_0x4e2cd4[_0x7422('0x2d')]);_0xca1546['attributes']=_[_0x7422('0x30')](_0x4e2cd4['model'],qs['fields'](_0x98c659[_0x7422('0x2d')][_0x7422('0x32')]));_0xca1546['attributes']=_0xca1546[_0x7422('0x31')][_0x7422('0x41')]?_0xca1546[_0x7422('0x31')]:_0x4e2cd4[_0x7422('0x2b')];if(_0x98c659[_0x7422('0x2d')][_0x7422('0x3b')]){_0xca1546[_0x7422('0x3c')]=[{'all':!![]}];}_0xca1546=_['merge']({},_0xca1546,_0x98c659[_0x7422('0x39')]);return db[_0x7422('0x3a')][_0x7422('0x42')](_0xca1546)[_0x7422('0x23')](handleEntityNotFound(_0x5719df,null))['then'](respondWithResult(_0x5719df,null))[_0x7422('0x43')](handleError(_0x5719df,null));};exports[_0x7422('0x44')]=function(_0x41ce88,_0x4db98d){return db[_0x7422('0x3a')][_0x7422('0x44')](_0x41ce88['body'],{})['then'](respondWithResult(_0x4db98d,0xc9))['catch'](handleError(_0x4db98d,null));};exports[_0x7422('0x22')]=function(_0xbbc9ab,_0x5b4694){if(_0xbbc9ab[_0x7422('0x45')]['id']){delete _0xbbc9ab['body']['id'];}return db[_0x7422('0x3a')][_0x7422('0x42')]({'where':{'id':_0xbbc9ab[_0x7422('0x40')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x5b4694,null))['then'](saveUpdates(_0xbbc9ab['body'],null))[_0x7422('0x23')](respondWithResult(_0x5b4694,null))[_0x7422('0x43')](handleError(_0x5b4694,null));};exports['destroy']=function(_0x121983,_0x2fbe91){return db['FreshdeskField'][_0x7422('0x42')]({'where':{'id':_0x121983[_0x7422('0x40')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x2fbe91,null))[_0x7422('0x23')](removeEntity(_0x2fbe91,null))[_0x7422('0x43')](handleError(_0x2fbe91,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 932727e..c162463 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 _0x0c94=['define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','moment','bluebird','path','../../config/environment','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0c94,0x71));var _0x40c9=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x0c94[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x40c9('0x0'));var util=require(_0x40c9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x40c9('0x2'));var BPromise=require(_0x40c9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40c9('0x4'));var rimraf=require('rimraf');var config=require(_0x40c9('0x5'));var attributes=require('./intFreshdeskField.attributes');module[_0x40c9('0x6')]=function(_0x52d1b8,_0x10fcab){return _0x52d1b8[_0x40c9('0x7')]('FreshdeskField',attributes,{'tableName':_0x40c9('0x8'),'paranoid':![],'indexes':[{'name':_0x40c9('0x9'),'fields':[_0x40c9('0xa'),_0x40c9('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x303a=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','FieldId'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0x303a,0x1a0));var _0xa303=function(_0x1ee35d,_0x56b6a8){_0x1ee35d=_0x1ee35d-0x0;var _0x1338d2=_0x303a[_0x1ee35d];return _0x1338d2;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var logger=require(_0xa303('0x1'))(_0xa303('0x2'));var moment=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa303('0x5'));var rimraf=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var attributes=require(_0xa303('0x8'));module[_0xa303('0x9')]=function(_0x1c7ee9,_0x2bc3d7){return _0x1c7ee9[_0xa303('0xa')](_0xa303('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0xa303('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 88ed47c..00d0d7d 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 _0xc23b=['client','request','info','debug','request\x20sent','error','code','FreshdeskField,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc23b,0x88));var _0xbc23=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xc23b[_0x49052b];return _0x48c045;};'use strict';var _=require(_0xbc23('0x0'));var util=require(_0xbc23('0x1'));var moment=require('moment');var BPromise=require(_0xbc23('0x2'));var rs=require(_0xbc23('0x3'));var fs=require('fs');var Redis=require(_0xbc23('0x4'));var db=require(_0xbc23('0x5'))['db'];var utils=require(_0xbc23('0x6'));var logger=require(_0xbc23('0x7'))(_0xbc23('0x8'));var config=require(_0xbc23('0x9'));var jayson=require(_0xbc23('0xa'));var client=jayson[_0xbc23('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x345af9,_0x5aac16,_0x2fff72){return new BPromise(function(_0xef2137,_0xe8e8a7){return client[_0xbc23('0xc')](_0x345af9,_0x2fff72)['then'](function(_0x5961a5){logger[_0xbc23('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x5aac16,'request\x20sent');logger[_0xbc23('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x5aac16,_0xbc23('0xf'),JSON['stringify'](_0x5961a5));if(_0x5961a5['error']){if(_0x5961a5[_0xbc23('0x10')][_0xbc23('0x11')]===0x1f4){logger[_0xbc23('0x10')](_0xbc23('0x12'),_0x5aac16,_0x5961a5['error'][_0xbc23('0x13')]);return _0xe8e8a7(_0x5961a5['error'][_0xbc23('0x13')]);}logger[_0xbc23('0x10')](_0xbc23('0x12'),_0x5aac16,_0x5961a5[_0xbc23('0x10')][_0xbc23('0x13')]);return _0xef2137(_0x5961a5['error'][_0xbc23('0x13')]);}else{logger[_0xbc23('0xd')](_0xbc23('0x12'),_0x5aac16,_0xbc23('0xf'));_0xef2137(_0x5961a5['result'][_0xbc23('0x13')]);}})[_0xbc23('0x14')](function(_0x2b35e1){logger['error'](_0xbc23('0x12'),_0x5aac16,_0x2b35e1);_0xe8e8a7(_0x2b35e1);});});} \ No newline at end of file +var _0xa7ae=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3ae256,_0x5779dc){var _0x2ab0f3=function(_0x3edd6d){while(--_0x3edd6d){_0x3ae256['push'](_0x3ae256['shift']());}};_0x2ab0f3(++_0x5779dc);}(_0xa7ae,0x1f4));var _0xea7a=function(_0xd67cd7,_0x1814ee){_0xd67cd7=_0xd67cd7-0x0;var _0x17f3c2=_0xa7ae[_0xd67cd7];return _0x17f3c2;};'use strict';var _=require(_0xea7a('0x0'));var util=require('util');var moment=require(_0xea7a('0x1'));var BPromise=require(_0xea7a('0x2'));var rs=require(_0xea7a('0x3'));var fs=require('fs');var Redis=require(_0xea7a('0x4'));var db=require(_0xea7a('0x5'))['db'];var utils=require(_0xea7a('0x6'));var logger=require(_0xea7a('0x7'))(_0xea7a('0x8'));var config=require('../../config/environment');var jayson=require(_0xea7a('0x9'));var client=jayson['client'][_0xea7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aceaa,_0x28cfaf,_0x5a4fe1){return new BPromise(function(_0x30fb76,_0x21a58b){return client[_0xea7a('0xb')](_0x2aceaa,_0x5a4fe1)[_0xea7a('0xc')](function(_0x215ffd){logger[_0xea7a('0xd')](_0xea7a('0xe'),_0x28cfaf,_0xea7a('0xf'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x28cfaf,_0xea7a('0xf'),JSON[_0xea7a('0x10')](_0x215ffd));if(_0x215ffd[_0xea7a('0x11')]){if(_0x215ffd[_0xea7a('0x11')]['code']===0x1f4){logger[_0xea7a('0x11')](_0xea7a('0xe'),_0x28cfaf,_0x215ffd[_0xea7a('0x11')][_0xea7a('0x12')]);return _0x21a58b(_0x215ffd['error'][_0xea7a('0x12')]);}logger[_0xea7a('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x28cfaf,_0x215ffd['error']['message']);return _0x30fb76(_0x215ffd[_0xea7a('0x11')]['message']);}else{logger[_0xea7a('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x28cfaf,_0xea7a('0xf'));_0x30fb76(_0x215ffd[_0xea7a('0x13')][_0xea7a('0x12')]);}})[_0xea7a('0x14')](function(_0x5c626){logger[_0xea7a('0x11')](_0xea7a('0xe'),_0x28cfaf,_0x5c626);_0x21a58b(_0x5c626);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 82997b3..7e4b699 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 _0x80ed=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','path'];(function(_0x26c0c8,_0x272361){var _0x2c6303=function(_0x2c2dae){while(--_0x2c2dae){_0x26c0c8['push'](_0x26c0c8['shift']());}};_0x2c6303(++_0x272361);}(_0x80ed,0x11c));var _0xd80e=function(_0x153ee8,_0x1f0a5a){_0x153ee8=_0x153ee8-0x0;var _0x1e31e8=_0x80ed[_0x153ee8];return _0x1e31e8;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getFields']);router[_0xd80e('0x10')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x10')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x12')]);router[_0xd80e('0x13')](_0xd80e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd80e('0x9')](),controller[_0xd80e('0x14')]);module[_0xd80e('0x15')]=router; \ No newline at end of file +var _0xa478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','update'];(function(_0x2e1589,_0x445f7c){var _0x5d0417=function(_0x198c0e){while(--_0x198c0e){_0x2e1589['push'](_0x2e1589['shift']());}};_0x5d0417(++_0x445f7c);}(_0xa478,0x136));var _0x8a47=function(_0x8c0bf5,_0x2456ab){_0x8c0bf5=_0x8c0bf5-0x0;var _0x447387=_0xa478[_0x8c0bf5];return _0x447387;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require(_0x8a47('0xa'));router[_0x8a47('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a47('0xc')]);router[_0x8a47('0xb')](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller['show']);router[_0x8a47('0xb')]('/:id/configurations',auth[_0x8a47('0xe')](),controller[_0x8a47('0xf')]);router[_0x8a47('0xb')]('/:id/fields',auth[_0x8a47('0xe')](),controller[_0x8a47('0x10')]);router['post']('/',auth[_0x8a47('0xe')](),controller['create']);router[_0x8a47('0x11')](_0x8a47('0x12'),auth[_0x8a47('0xe')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8a47('0xe')](),controller[_0x8a47('0x13')]);router['delete'](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller[_0x8a47('0x14')]);module[_0x8a47('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 760a6ce..41e80d0 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 _0xc2c7=['exports','STRING','username','remoteUri'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3c3e1e,_0x46d407){_0x3c3e1e=_0x3c3e1e-0x0;var _0x32a2e9=_0xc2c7[_0x3c3e1e];return _0x32a2e9;};'use strict';var Sequelize=require('sequelize');module[_0x7c2c('0x0')]={'name':{'type':Sequelize[_0x7c2c('0x1')]},'description':{'type':Sequelize[_0x7c2c('0x1')]},'username':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x2')},'apiKey':{'type':Sequelize[_0x7c2c('0x1')]},'remoteUri':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x32b6=['remoteUri','sequelize','exports','STRING'];(function(_0x223b71,_0x597bfb){var _0x4131e4=function(_0x411d23){while(--_0x411d23){_0x223b71['push'](_0x223b71['shift']());}};_0x4131e4(++_0x597bfb);}(_0x32b6,0x1d1));var _0x632b=function(_0x3c4952,_0x5e1699){_0x3c4952=_0x3c4952-0x0;var _0x111266=_0x32b6[_0x3c4952];return _0x111266;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x632b('0x2')]},'username':{'type':Sequelize[_0x632b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x632b('0x2')],'unique':_0x632b('0x3')},'serverUrl':{'type':Sequelize[_0x632b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 064534e..4de1719 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 _0xcfc1=['getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','send','index','fieldName','model','map','name','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','FreshsalesAccount','findAll','catch','show','params','rawAttributes','include','find','create','body','destroy','FreshsalesConfiguration'];(function(_0x358b77,_0x22c9b4){var _0xdac979=function(_0x5213a9){while(--_0x5213a9){_0x358b77['push'](_0x358b77['shift']());}};_0xdac979(++_0x22c9b4);}(_0xcfc1,0xef));var _0x1cfc=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xcfc1[_0x725b8e];return _0x43ac45;};'use strict';var emlformat=require(_0x1cfc('0x0'));var rimraf=require(_0x1cfc('0x1'));var zipdir=require(_0x1cfc('0x2'));var jsonpatch=require(_0x1cfc('0x3'));var rp=require('request-promise');var moment=require(_0x1cfc('0x4'));var BPromise=require(_0x1cfc('0x5'));var Mustache=require(_0x1cfc('0x6'));var util=require(_0x1cfc('0x7'));var path=require(_0x1cfc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1cfc('0x9'));var fs=require('fs');var fs_extra=require(_0x1cfc('0xa'));var _=require(_0x1cfc('0xb'));var squel=require(_0x1cfc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1cfc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1cfc('0xe'));var Papa=require(_0x1cfc('0xf'));var Redis=require(_0x1cfc('0x10'));var authService=require(_0x1cfc('0x11'));var qs=require(_0x1cfc('0x12'));var as=require(_0x1cfc('0x13'));var hardwareService=require(_0x1cfc('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1cfc('0x15'));var licenseUtil=require(_0x1cfc('0x16'));var db=require(_0x1cfc('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4e0aea,_0x5f30d7){_0x5f30d7=_0x5f30d7||0xcc;return function(_0x50b685){if(_0x50b685){return _0x4e0aea[_0x1cfc('0x18')](_0x5f30d7);}return _0x4e0aea[_0x1cfc('0x19')](_0x5f30d7)[_0x1cfc('0x1a')]();};}function respondWithResult(_0x50a6ba,_0x27539d){_0x27539d=_0x27539d||0xc8;return function(_0x27ed44){if(_0x27ed44){return _0x50a6ba[_0x1cfc('0x19')](_0x27539d)[_0x1cfc('0x1b')](_0x27ed44);}};}function respondWithFilteredResult(_0x4870f7,_0x1d43a3){return function(_0x2b75d1){if(_0x2b75d1){var _0x49578a=typeof _0x1d43a3[_0x1cfc('0x1c')]==='undefined'&&typeof _0x1d43a3[_0x1cfc('0x1d')]===_0x1cfc('0x1e');var _0x3d5817=_0x2b75d1[_0x1cfc('0x1f')];var _0x58e682=_0x49578a?0x0:_0x1d43a3[_0x1cfc('0x1c')];var _0x5aa3f0=_0x49578a?_0x2b75d1[_0x1cfc('0x1f')]:_0x1d43a3['offset']+_0x1d43a3[_0x1cfc('0x1d')];var _0x4fcbf7;if(_0x5aa3f0>=_0x3d5817){_0x5aa3f0=_0x3d5817;_0x4fcbf7=0xc8;}else{_0x4fcbf7=0xce;}_0x4870f7[_0x1cfc('0x19')](_0x4fcbf7);return _0x4870f7[_0x1cfc('0x20')]('Content-Range',_0x58e682+'-'+_0x5aa3f0+'/'+_0x3d5817)[_0x1cfc('0x1b')](_0x2b75d1);}return null;};}function patchUpdates(_0x2b0246){return function(_0x4e41db){try{jsonpatch[_0x1cfc('0x21')](_0x4e41db,_0x2b0246,!![]);}catch(_0x2637e3){return BPromise[_0x1cfc('0x22')](_0x2637e3);}return _0x4e41db[_0x1cfc('0x23')]();};}function saveUpdates(_0x4ebfbc,_0x56cc40){return function(_0x4e3130){if(_0x4e3130){return _0x4e3130[_0x1cfc('0x24')](_0x4ebfbc)['then'](function(_0x11a663){return _0x11a663;});}return null;};}function removeEntity(_0x3654d4,_0x2f4e2b){return function(_0x575569){if(_0x575569){return _0x575569['destroy']()[_0x1cfc('0x25')](function(){_0x3654d4[_0x1cfc('0x19')](0xcc)[_0x1cfc('0x1a')]();});}};}function handleEntityNotFound(_0x59dbda,_0x3b17a2){return function(_0x2edb6c){if(!_0x2edb6c){_0x59dbda['sendStatus'](0x194);}return _0x2edb6c;};}function handleError(_0x61c458,_0x37c2e2){_0x37c2e2=_0x37c2e2||0x1f4;return function(_0x327f7a){logger[_0x1cfc('0x26')](_0x327f7a[_0x1cfc('0x27')]);if(_0x327f7a['name']){delete _0x327f7a['name'];}_0x61c458[_0x1cfc('0x19')](_0x37c2e2)[_0x1cfc('0x28')](_0x327f7a);};}exports[_0x1cfc('0x29')]=function(_0x5deed4,_0x11e4bf){var _0x330a61={},_0x4c70c6={},_0x1a2e89={'count':0x0,'rows':[]};var _0x21b845=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0x1b940b){return{'name':_0x1b940b[_0x1cfc('0x2a')],'type':_0x1b940b['type']['key']};});_0x4c70c6[_0x1cfc('0x2b')]=_[_0x1cfc('0x2c')](_0x21b845,_0x1cfc('0x2d'));_0x4c70c6['query']=_[_0x1cfc('0x2e')](_0x5deed4[_0x1cfc('0x2f')]);_0x4c70c6[_0x1cfc('0x30')]=_[_0x1cfc('0x31')](_0x4c70c6[_0x1cfc('0x2b')],_0x4c70c6[_0x1cfc('0x2f')]);_0x330a61[_0x1cfc('0x32')]=_[_0x1cfc('0x31')](_0x4c70c6['model'],qs['fields'](_0x5deed4[_0x1cfc('0x2f')][_0x1cfc('0x33')]));_0x330a61[_0x1cfc('0x32')]=_0x330a61[_0x1cfc('0x32')][_0x1cfc('0x34')]?_0x330a61[_0x1cfc('0x32')]:_0x4c70c6[_0x1cfc('0x2b')];if(!_0x5deed4[_0x1cfc('0x2f')]['hasOwnProperty'](_0x1cfc('0x35'))){_0x330a61[_0x1cfc('0x1d')]=qs[_0x1cfc('0x1d')](_0x5deed4['query'][_0x1cfc('0x1d')]);_0x330a61[_0x1cfc('0x1c')]=qs['offset'](_0x5deed4['query'][_0x1cfc('0x1c')]);}_0x330a61[_0x1cfc('0x36')]=qs[_0x1cfc('0x37')](_0x5deed4['query'][_0x1cfc('0x37')]);_0x330a61['where']=qs[_0x1cfc('0x30')](_[_0x1cfc('0x38')](_0x5deed4[_0x1cfc('0x2f')],_0x4c70c6[_0x1cfc('0x30')]),_0x21b845);if(_0x5deed4['query'][_0x1cfc('0x39')]){_0x330a61[_0x1cfc('0x3a')]=_[_0x1cfc('0x3b')](_0x330a61[_0x1cfc('0x3a')],{'$or':_[_0x1cfc('0x2c')](_0x21b845,function(_0x3729e8){if(_0x3729e8[_0x1cfc('0x3c')]!==_0x1cfc('0x3d')){var _0x2cf1e9={};_0x2cf1e9[_0x3729e8['name']]={'$like':'%'+_0x5deed4[_0x1cfc('0x2f')][_0x1cfc('0x39')]+'%'};return _0x2cf1e9;}})});}_0x330a61=_['merge']({},_0x330a61,_0x5deed4[_0x1cfc('0x3e')]);var _0x56bb1f={'where':_0x330a61[_0x1cfc('0x3a')]};return db['FreshsalesAccount'][_0x1cfc('0x1f')](_0x56bb1f)[_0x1cfc('0x25')](function(_0x597ca5){_0x1a2e89[_0x1cfc('0x1f')]=_0x597ca5;if(_0x5deed4['query'][_0x1cfc('0x3f')]){_0x330a61['include']=[{'all':!![]}];}return db[_0x1cfc('0x40')][_0x1cfc('0x41')](_0x330a61);})['then'](function(_0x24e2da){_0x1a2e89['rows']=_0x24e2da;return _0x1a2e89;})[_0x1cfc('0x25')](respondWithFilteredResult(_0x11e4bf,_0x330a61))[_0x1cfc('0x42')](handleError(_0x11e4bf,null));};exports[_0x1cfc('0x43')]=function(_0x3259a0,_0x14ad89){var _0x50c38b={'raw':![],'where':{'id':_0x3259a0[_0x1cfc('0x44')]['id']}},_0x44705d={};_0x44705d[_0x1cfc('0x2b')]=_[_0x1cfc('0x2e')](db[_0x1cfc('0x40')][_0x1cfc('0x45')]);_0x44705d[_0x1cfc('0x2f')]=_[_0x1cfc('0x2e')](_0x3259a0['query']);_0x44705d['filters']=_['intersection'](_0x44705d['model'],_0x44705d[_0x1cfc('0x2f')]);_0x50c38b[_0x1cfc('0x32')]=_[_0x1cfc('0x31')](_0x44705d['model'],qs[_0x1cfc('0x33')](_0x3259a0[_0x1cfc('0x2f')][_0x1cfc('0x33')]));_0x50c38b[_0x1cfc('0x32')]=_0x50c38b[_0x1cfc('0x32')][_0x1cfc('0x34')]?_0x50c38b[_0x1cfc('0x32')]:_0x44705d[_0x1cfc('0x2b')];if(_0x3259a0['query'][_0x1cfc('0x3f')]){_0x50c38b[_0x1cfc('0x46')]=[{'all':!![]}];}_0x50c38b=_[_0x1cfc('0x3b')]({},_0x50c38b,_0x3259a0['options']);return db[_0x1cfc('0x40')][_0x1cfc('0x47')](_0x50c38b)['then'](handleEntityNotFound(_0x14ad89,null))[_0x1cfc('0x25')](respondWithResult(_0x14ad89,null))['catch'](handleError(_0x14ad89,null));};exports[_0x1cfc('0x48')]=function(_0x313eaf,_0x3ed5bc){return db[_0x1cfc('0x40')]['create'](_0x313eaf['body'],{})[_0x1cfc('0x25')](respondWithResult(_0x3ed5bc,0xc9))[_0x1cfc('0x42')](handleError(_0x3ed5bc,null));};exports[_0x1cfc('0x24')]=function(_0x261af0,_0x417fa0){if(_0x261af0[_0x1cfc('0x49')]['id']){delete _0x261af0[_0x1cfc('0x49')]['id'];}return db['FreshsalesAccount'][_0x1cfc('0x47')]({'where':{'id':_0x261af0[_0x1cfc('0x44')]['id']}})[_0x1cfc('0x25')](handleEntityNotFound(_0x417fa0,null))[_0x1cfc('0x25')](saveUpdates(_0x261af0[_0x1cfc('0x49')],null))['then'](respondWithResult(_0x417fa0,null))['catch'](handleError(_0x417fa0,null));};exports[_0x1cfc('0x4a')]=function(_0x230dbb,_0x3d0d4b){return db[_0x1cfc('0x40')]['find']({'where':{'id':_0x230dbb['params']['id']}})['then'](handleEntityNotFound(_0x3d0d4b,null))[_0x1cfc('0x25')](removeEntity(_0x3d0d4b,null))['catch'](handleError(_0x3d0d4b,null));};exports['getConfigurations']=function(_0x28c37c,_0x5136ea,_0x4ef32b){var _0x2e4697={};var _0x56d810={};var _0x2d52bd;var _0x5cdaef;return db[_0x1cfc('0x40')]['findOne']({'where':{'id':_0x28c37c[_0x1cfc('0x44')]['id']}})[_0x1cfc('0x25')](handleEntityNotFound(_0x5136ea,null))[_0x1cfc('0x25')](function(_0x1ab5ec){if(_0x1ab5ec){_0x2d52bd=_0x1ab5ec;_0x56d810['model']=_[_0x1cfc('0x2e')](db[_0x1cfc('0x4b')][_0x1cfc('0x45')]);_0x56d810[_0x1cfc('0x2f')]=_[_0x1cfc('0x2e')](_0x28c37c[_0x1cfc('0x2f')]);_0x56d810[_0x1cfc('0x30')]=_[_0x1cfc('0x31')](_0x56d810['model'],_0x56d810[_0x1cfc('0x2f')]);_0x2e4697['attributes']=_[_0x1cfc('0x31')](_0x56d810[_0x1cfc('0x2b')],qs['fields'](_0x28c37c[_0x1cfc('0x2f')][_0x1cfc('0x33')]));_0x2e4697[_0x1cfc('0x32')]=_0x2e4697[_0x1cfc('0x32')]['length']?_0x2e4697[_0x1cfc('0x32')]:_0x56d810[_0x1cfc('0x2b')];_0x2e4697['order']=qs[_0x1cfc('0x37')](_0x28c37c[_0x1cfc('0x2f')][_0x1cfc('0x37')]);_0x2e4697[_0x1cfc('0x3a')]=qs[_0x1cfc('0x30')](_['pick'](_0x28c37c[_0x1cfc('0x2f')],_0x56d810[_0x1cfc('0x30')]));if(_0x28c37c[_0x1cfc('0x2f')][_0x1cfc('0x39')]){_0x2e4697['where']=_[_0x1cfc('0x3b')](_0x2e4697[_0x1cfc('0x3a')],{'$or':_[_0x1cfc('0x2c')](_0x2e4697[_0x1cfc('0x32')],function(_0x2416b4){var _0x80c886={};_0x80c886[_0x2416b4]={'$like':'%'+_0x28c37c[_0x1cfc('0x2f')][_0x1cfc('0x39')]+'%'};return _0x80c886;})});}_0x2e4697=_[_0x1cfc('0x3b')]({},_0x2e4697,_0x28c37c[_0x1cfc('0x3e')]);return _0x2d52bd[_0x1cfc('0x4c')](_0x2e4697);}})[_0x1cfc('0x25')](function(_0x2d80d2){if(_0x2d80d2){_0x5cdaef=_0x2d80d2['length'];if(!_0x28c37c['query'][_0x1cfc('0x4d')](_0x1cfc('0x35'))){_0x2e4697[_0x1cfc('0x1d')]=qs[_0x1cfc('0x1d')](_0x28c37c[_0x1cfc('0x2f')]['limit']);_0x2e4697[_0x1cfc('0x1c')]=qs['offset'](_0x28c37c[_0x1cfc('0x2f')][_0x1cfc('0x1c')]);}return _0x2d52bd[_0x1cfc('0x4c')](_0x2e4697);}})[_0x1cfc('0x25')](function(_0x3239d9){if(_0x3239d9){return _0x3239d9?{'count':_0x5cdaef,'rows':_0x3239d9}:null;}})[_0x1cfc('0x25')](respondWithResult(_0x5136ea,null))[_0x1cfc('0x42')](handleError(_0x5136ea,null));};exports[_0x1cfc('0x4e')]=function(_0x2673f4,_0x31be02,_0x2712e6){if(_0x2673f4[_0x1cfc('0x49')]['id']){delete _0x2673f4['body']['id'];}return db[_0x1cfc('0x40')][_0x1cfc('0x4f')]({'where':{'id':_0x2673f4[_0x1cfc('0x44')]['id']}})[_0x1cfc('0x25')](handleEntityNotFound(_0x31be02,null))[_0x1cfc('0x25')](function(_0x5c16d3){if(_0x5c16d3){_0x2673f4[_0x1cfc('0x49')][_0x1cfc('0x50')]=_0x5c16d3['id'];_0x2673f4['body']['Subjects']=integrations[_0x1cfc('0x51')](_0x2673f4[_0x1cfc('0x49')][_0x1cfc('0x52')],_0x2673f4['body']['type']);_0x2673f4[_0x1cfc('0x49')][_0x1cfc('0x53')]=integrations['getDescriptions'](_0x2673f4['body'][_0x1cfc('0x52')],_0x2673f4[_0x1cfc('0x49')]['type']);return db['FreshsalesConfiguration'][_0x1cfc('0x48')](_0x2673f4['body'],{'include':[{'model':db[_0x1cfc('0x54')],'as':_0x1cfc('0x55')},{'model':db[_0x1cfc('0x54')],'as':_0x1cfc('0x53')}]});}return null;})[_0x1cfc('0x25')](respondWithResult(_0x31be02,null))[_0x1cfc('0x42')](handleError(_0x31be02,null));};exports[_0x1cfc('0x56')]=function(_0x662447,_0x31becf,_0x4d31ad){var _0x4a4494='';var _0x291b37='';return db['FreshsalesAccount'][_0x1cfc('0x4f')]({'where':{'id':_0x662447['params']['id']},'attributes':['id',_0x1cfc('0x57'),_0x1cfc('0x58'),_0x1cfc('0x59')]})['then'](handleEntityNotFound(_0x31becf,null))[_0x1cfc('0x25')](function(_0x5f2eee){if(_0x5f2eee){_0x291b37=_0x5f2eee[_0x1cfc('0x57')];_0x4a4494=_0x5f2eee['remoteUri'];var _0x317688=_0x5f2eee['remoteUri'][_0x1cfc('0x5a')](-0x1);if(_0x317688==='/'){_0x4a4494=_0x4a4494[_0x1cfc('0x5b')](0x0,_0x4a4494[_0x1cfc('0x5c')](_0x317688));}return rp({'method':'GET','uri':util[_0x1cfc('0x5d')](_0x1cfc('0x5e'),_0x4a4494,_0x1cfc('0x5f')),'headers':{'Authorization':_0x1cfc('0x60')+_0x5f2eee[_0x1cfc('0x59')]},'json':!![]});}})[_0x1cfc('0x25')](function(_0x3fdfbe){if(_0x3fdfbe){var _0x1c66be=_0x3fdfbe[_0x1cfc('0x61')];var _0xa3e6fe=![];var _0x34becf=null;for(_0x34becf=0x0;_0x34becf<_0x1c66be[_0x1cfc('0x34')];_0x34becf++){if(_0x1c66be[_0x34becf][_0x1cfc('0x62')]===_0x291b37){_0xa3e6fe=!![];}}if(_0xa3e6fe){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1cfc('0x63')});}}})['then'](respondWithResult(_0x31becf,null))['catch'](function(_0x360329){var _0x231c19=_0x662447[_0x1cfc('0x2f')][_0x1cfc('0x64')]?0x1f4:_0x360329[_0x1cfc('0x65')]||0x1f4;logger['error'](_0x1cfc('0x66'),_0x1cfc('0x56'),_0x231c19,JSON[_0x1cfc('0x67')](_0x360329));delete _0x360329['name'];if(_0x231c19===0x191){_0x231c19=0x190;}_0x31becf[_0x1cfc('0x19')](_0x231c19)['send'](_0x662447[_0x1cfc('0x2f')][_0x1cfc('0x64')]?{'message':_0x1cfc('0x68'),'statusCode':_0x360329[_0x1cfc('0x65')]}:_0x360329);});}; \ No newline at end of file +var _0xa917=['Content-Range','apply','save','update','then','destroy','error','stack','name','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','intersection','create','body','find','FreshsalesConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x1267f9,_0xef5dda){var _0x18cce0=function(_0x136535){while(--_0x136535){_0x1267f9['push'](_0x1267f9['shift']());}};_0x18cce0(++_0xef5dda);}(_0xa917,0x168));var _0x7a91=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa917[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x7a91('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7a91('0x1'));var rp=require(_0x7a91('0x2'));var moment=require(_0x7a91('0x3'));var BPromise=require(_0x7a91('0x4'));var Mustache=require(_0x7a91('0x5'));var util=require(_0x7a91('0x6'));var path=require('path');var sox=require(_0x7a91('0x7'));var csv=require(_0x7a91('0x8'));var ejs=require(_0x7a91('0x9'));var fs=require('fs');var fs_extra=require(_0x7a91('0xa'));var _=require(_0x7a91('0xb'));var squel=require(_0x7a91('0xc'));var crypto=require(_0x7a91('0xd'));var jsforce=require(_0x7a91('0xe'));var deskjs=require(_0x7a91('0xf'));var toCsv=require(_0x7a91('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a91('0x10'));var qs=require(_0x7a91('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a91('0x12'))(_0x7a91('0x13'));var utils=require(_0x7a91('0x14'));var config=require(_0x7a91('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a91('0x16'))['db'];var integrations=require(_0x7a91('0x17'));function respondWithStatusCode(_0x32a456,_0x5e2a2){_0x5e2a2=_0x5e2a2||0xcc;return function(_0x19b132){if(_0x19b132){return _0x32a456[_0x7a91('0x18')](_0x5e2a2);}return _0x32a456[_0x7a91('0x19')](_0x5e2a2)[_0x7a91('0x1a')]();};}function respondWithResult(_0x21a092,_0x3fe09d){_0x3fe09d=_0x3fe09d||0xc8;return function(_0x46e315){if(_0x46e315){return _0x21a092[_0x7a91('0x19')](_0x3fe09d)[_0x7a91('0x1b')](_0x46e315);}};}function respondWithFilteredResult(_0x51346f,_0x66f6ed){return function(_0x5a15b6){if(_0x5a15b6){var _0x8b1a33=typeof _0x66f6ed[_0x7a91('0x1c')]==='undefined'&&typeof _0x66f6ed[_0x7a91('0x1d')]===_0x7a91('0x1e');var _0x3b00c0=_0x5a15b6[_0x7a91('0x1f')];var _0x2a085b=_0x8b1a33?0x0:_0x66f6ed[_0x7a91('0x1c')];var _0x268fa6=_0x8b1a33?_0x5a15b6[_0x7a91('0x1f')]:_0x66f6ed[_0x7a91('0x1c')]+_0x66f6ed[_0x7a91('0x1d')];var _0xf5f071;if(_0x268fa6>=_0x3b00c0){_0x268fa6=_0x3b00c0;_0xf5f071=0xc8;}else{_0xf5f071=0xce;}_0x51346f[_0x7a91('0x19')](_0xf5f071);return _0x51346f['set'](_0x7a91('0x20'),_0x2a085b+'-'+_0x268fa6+'/'+_0x3b00c0)[_0x7a91('0x1b')](_0x5a15b6);}return null;};}function patchUpdates(_0x46add2){return function(_0x1e7fce){try{jsonpatch[_0x7a91('0x21')](_0x1e7fce,_0x46add2,!![]);}catch(_0x995bcc){return BPromise['reject'](_0x995bcc);}return _0x1e7fce[_0x7a91('0x22')]();};}function saveUpdates(_0x3b19b1,_0x4af7ce){return function(_0x502aa2){if(_0x502aa2){return _0x502aa2[_0x7a91('0x23')](_0x3b19b1)[_0x7a91('0x24')](function(_0x5aa1b8){return _0x5aa1b8;});}return null;};}function removeEntity(_0x1fd338,_0x592cb3){return function(_0x47d559){if(_0x47d559){return _0x47d559[_0x7a91('0x25')]()[_0x7a91('0x24')](function(){_0x1fd338['status'](0xcc)[_0x7a91('0x1a')]();});}};}function handleEntityNotFound(_0x24c33e,_0xa872b7){return function(_0x66f7e4){if(!_0x66f7e4){_0x24c33e['sendStatus'](0x194);}return _0x66f7e4;};}function handleError(_0x31cfda,_0x3d4476){_0x3d4476=_0x3d4476||0x1f4;return function(_0x43609f){logger[_0x7a91('0x26')](_0x43609f[_0x7a91('0x27')]);if(_0x43609f[_0x7a91('0x28')]){delete _0x43609f['name'];}_0x31cfda[_0x7a91('0x19')](_0x3d4476)['send'](_0x43609f);};}exports['index']=function(_0x98c656,_0x5e6a2b){var _0x471ae5={},_0x7176c0={},_0x5595b4={'count':0x0,'rows':[]};var _0x20c8b0=_[_0x7a91('0x29')](db[_0x7a91('0x2a')][_0x7a91('0x2b')],function(_0xf948af){return{'name':_0xf948af[_0x7a91('0x2c')],'type':_0xf948af[_0x7a91('0x2d')][_0x7a91('0x2e')]};});_0x7176c0[_0x7a91('0x2f')]=_[_0x7a91('0x29')](_0x20c8b0,'name');_0x7176c0[_0x7a91('0x30')]=_[_0x7a91('0x31')](_0x98c656[_0x7a91('0x30')]);_0x7176c0[_0x7a91('0x32')]=_['intersection'](_0x7176c0[_0x7a91('0x2f')],_0x7176c0['query']);_0x471ae5[_0x7a91('0x33')]=_['intersection'](_0x7176c0[_0x7a91('0x2f')],qs[_0x7a91('0x34')](_0x98c656[_0x7a91('0x30')][_0x7a91('0x34')]));_0x471ae5['attributes']=_0x471ae5[_0x7a91('0x33')][_0x7a91('0x35')]?_0x471ae5[_0x7a91('0x33')]:_0x7176c0[_0x7a91('0x2f')];if(!_0x98c656[_0x7a91('0x30')][_0x7a91('0x36')](_0x7a91('0x37'))){_0x471ae5[_0x7a91('0x1d')]=qs['limit'](_0x98c656[_0x7a91('0x30')][_0x7a91('0x1d')]);_0x471ae5[_0x7a91('0x1c')]=qs[_0x7a91('0x1c')](_0x98c656[_0x7a91('0x30')][_0x7a91('0x1c')]);}_0x471ae5[_0x7a91('0x38')]=qs['sort'](_0x98c656[_0x7a91('0x30')][_0x7a91('0x39')]);_0x471ae5[_0x7a91('0x3a')]=qs[_0x7a91('0x32')](_[_0x7a91('0x3b')](_0x98c656[_0x7a91('0x30')],_0x7176c0[_0x7a91('0x32')]),_0x20c8b0);if(_0x98c656['query']['filter']){_0x471ae5[_0x7a91('0x3a')]=_[_0x7a91('0x3c')](_0x471ae5['where'],{'$or':_[_0x7a91('0x29')](_0x20c8b0,function(_0x19cd68){if(_0x19cd68[_0x7a91('0x2d')]!==_0x7a91('0x3d')){var _0x4ac61a={};_0x4ac61a[_0x19cd68[_0x7a91('0x28')]]={'$like':'%'+_0x98c656[_0x7a91('0x30')][_0x7a91('0x3e')]+'%'};return _0x4ac61a;}})});}_0x471ae5=_[_0x7a91('0x3c')]({},_0x471ae5,_0x98c656[_0x7a91('0x3f')]);var _0x51cae3={'where':_0x471ae5[_0x7a91('0x3a')]};return db['FreshsalesAccount'][_0x7a91('0x1f')](_0x51cae3)['then'](function(_0x53d7c2){_0x5595b4['count']=_0x53d7c2;if(_0x98c656[_0x7a91('0x30')]['includeAll']){_0x471ae5[_0x7a91('0x40')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x7a91('0x41')](_0x471ae5);})[_0x7a91('0x24')](function(_0x9329f0){_0x5595b4[_0x7a91('0x42')]=_0x9329f0;return _0x5595b4;})[_0x7a91('0x24')](respondWithFilteredResult(_0x5e6a2b,_0x471ae5))[_0x7a91('0x43')](handleError(_0x5e6a2b,null));};exports[_0x7a91('0x44')]=function(_0x533278,_0x3a3323){var _0x298dfc={'raw':![],'where':{'id':_0x533278[_0x7a91('0x45')]['id']}},_0x3304e5={};_0x3304e5[_0x7a91('0x2f')]=_[_0x7a91('0x31')](db[_0x7a91('0x2a')]['rawAttributes']);_0x3304e5['query']=_[_0x7a91('0x31')](_0x533278[_0x7a91('0x30')]);_0x3304e5['filters']=_[_0x7a91('0x46')](_0x3304e5['model'],_0x3304e5['query']);_0x298dfc[_0x7a91('0x33')]=_[_0x7a91('0x46')](_0x3304e5[_0x7a91('0x2f')],qs[_0x7a91('0x34')](_0x533278[_0x7a91('0x30')]['fields']));_0x298dfc[_0x7a91('0x33')]=_0x298dfc['attributes']['length']?_0x298dfc[_0x7a91('0x33')]:_0x3304e5[_0x7a91('0x2f')];if(_0x533278[_0x7a91('0x30')]['includeAll']){_0x298dfc['include']=[{'all':!![]}];}_0x298dfc=_[_0x7a91('0x3c')]({},_0x298dfc,_0x533278[_0x7a91('0x3f')]);return db['FreshsalesAccount']['find'](_0x298dfc)[_0x7a91('0x24')](handleEntityNotFound(_0x3a3323,null))['then'](respondWithResult(_0x3a3323,null))[_0x7a91('0x43')](handleError(_0x3a3323,null));};exports[_0x7a91('0x47')]=function(_0x159dde,_0x58e29a){return db['FreshsalesAccount'][_0x7a91('0x47')](_0x159dde[_0x7a91('0x48')],{})['then'](respondWithResult(_0x58e29a,0xc9))[_0x7a91('0x43')](handleError(_0x58e29a,null));};exports[_0x7a91('0x23')]=function(_0xa2ddaa,_0x24454c){if(_0xa2ddaa['body']['id']){delete _0xa2ddaa[_0x7a91('0x48')]['id'];}return db[_0x7a91('0x2a')]['find']({'where':{'id':_0xa2ddaa['params']['id']}})[_0x7a91('0x24')](handleEntityNotFound(_0x24454c,null))[_0x7a91('0x24')](saveUpdates(_0xa2ddaa[_0x7a91('0x48')],null))[_0x7a91('0x24')](respondWithResult(_0x24454c,null))['catch'](handleError(_0x24454c,null));};exports[_0x7a91('0x25')]=function(_0xafe2ad,_0x3c9a09){return db['FreshsalesAccount'][_0x7a91('0x49')]({'where':{'id':_0xafe2ad[_0x7a91('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c9a09,null))[_0x7a91('0x24')](removeEntity(_0x3c9a09,null))[_0x7a91('0x43')](handleError(_0x3c9a09,null));};exports['getConfigurations']=function(_0x161ec3,_0x2cca05,_0x1f75b2){var _0x45c175={};var _0x414bc0={};var _0x64de88;var _0x4e8cca;return db[_0x7a91('0x2a')]['findOne']({'where':{'id':_0x161ec3['params']['id']}})[_0x7a91('0x24')](handleEntityNotFound(_0x2cca05,null))[_0x7a91('0x24')](function(_0x16fb02){if(_0x16fb02){_0x64de88=_0x16fb02;_0x414bc0[_0x7a91('0x2f')]=_[_0x7a91('0x31')](db[_0x7a91('0x4a')][_0x7a91('0x2b')]);_0x414bc0['query']=_[_0x7a91('0x31')](_0x161ec3['query']);_0x414bc0[_0x7a91('0x32')]=_[_0x7a91('0x46')](_0x414bc0[_0x7a91('0x2f')],_0x414bc0[_0x7a91('0x30')]);_0x45c175['attributes']=_[_0x7a91('0x46')](_0x414bc0[_0x7a91('0x2f')],qs[_0x7a91('0x34')](_0x161ec3['query'][_0x7a91('0x34')]));_0x45c175[_0x7a91('0x33')]=_0x45c175[_0x7a91('0x33')][_0x7a91('0x35')]?_0x45c175[_0x7a91('0x33')]:_0x414bc0[_0x7a91('0x2f')];_0x45c175[_0x7a91('0x38')]=qs[_0x7a91('0x39')](_0x161ec3['query'][_0x7a91('0x39')]);_0x45c175[_0x7a91('0x3a')]=qs['filters'](_[_0x7a91('0x3b')](_0x161ec3[_0x7a91('0x30')],_0x414bc0[_0x7a91('0x32')]));if(_0x161ec3[_0x7a91('0x30')]['filter']){_0x45c175[_0x7a91('0x3a')]=_['merge'](_0x45c175['where'],{'$or':_['map'](_0x45c175[_0x7a91('0x33')],function(_0xdfa085){var _0x40c858={};_0x40c858[_0xdfa085]={'$like':'%'+_0x161ec3[_0x7a91('0x30')][_0x7a91('0x3e')]+'%'};return _0x40c858;})});}_0x45c175=_[_0x7a91('0x3c')]({},_0x45c175,_0x161ec3[_0x7a91('0x3f')]);return _0x64de88[_0x7a91('0x4b')](_0x45c175);}})['then'](function(_0x18bb75){if(_0x18bb75){_0x4e8cca=_0x18bb75[_0x7a91('0x35')];if(!_0x161ec3[_0x7a91('0x30')][_0x7a91('0x36')](_0x7a91('0x37'))){_0x45c175[_0x7a91('0x1d')]=qs[_0x7a91('0x1d')](_0x161ec3['query'][_0x7a91('0x1d')]);_0x45c175[_0x7a91('0x1c')]=qs[_0x7a91('0x1c')](_0x161ec3['query'][_0x7a91('0x1c')]);}return _0x64de88[_0x7a91('0x4b')](_0x45c175);}})['then'](function(_0x273319){if(_0x273319){return _0x273319?{'count':_0x4e8cca,'rows':_0x273319}:null;}})[_0x7a91('0x24')](respondWithResult(_0x2cca05,null))[_0x7a91('0x43')](handleError(_0x2cca05,null));};exports[_0x7a91('0x4c')]=function(_0xeb5c84,_0x28f0e5,_0x502b5f){if(_0xeb5c84[_0x7a91('0x48')]['id']){delete _0xeb5c84[_0x7a91('0x48')]['id'];}return db[_0x7a91('0x2a')]['findOne']({'where':{'id':_0xeb5c84[_0x7a91('0x45')]['id']}})[_0x7a91('0x24')](handleEntityNotFound(_0x28f0e5,null))['then'](function(_0x532664){if(_0x532664){_0xeb5c84[_0x7a91('0x48')]['AccountId']=_0x532664['id'];_0xeb5c84[_0x7a91('0x48')][_0x7a91('0x4d')]=integrations[_0x7a91('0x4e')](_0xeb5c84[_0x7a91('0x48')]['channel'],_0xeb5c84[_0x7a91('0x48')][_0x7a91('0x2d')]);_0xeb5c84['body'][_0x7a91('0x4f')]=integrations[_0x7a91('0x50')](_0xeb5c84['body'][_0x7a91('0x51')],_0xeb5c84['body']['type']);return db[_0x7a91('0x4a')][_0x7a91('0x47')](_0xeb5c84['body'],{'include':[{'model':db[_0x7a91('0x52')],'as':_0x7a91('0x4d')},{'model':db[_0x7a91('0x52')],'as':_0x7a91('0x4f')}]});}return null;})[_0x7a91('0x24')](respondWithResult(_0x28f0e5,null))[_0x7a91('0x43')](handleError(_0x28f0e5,null));};exports[_0x7a91('0x53')]=function(_0x161987,_0x1597fd,_0x1a26ee){var _0x46ce90='';var _0x4a21be='';return db[_0x7a91('0x2a')]['findOne']({'where':{'id':_0x161987[_0x7a91('0x45')]['id']},'attributes':['id',_0x7a91('0x54'),_0x7a91('0x55'),_0x7a91('0x56')]})[_0x7a91('0x24')](handleEntityNotFound(_0x1597fd,null))[_0x7a91('0x24')](function(_0x398e1d){if(_0x398e1d){_0x4a21be=_0x398e1d[_0x7a91('0x54')];_0x46ce90=_0x398e1d[_0x7a91('0x55')];var _0x56fbf3=_0x398e1d[_0x7a91('0x55')]['slice'](-0x1);if(_0x56fbf3==='/'){_0x46ce90=_0x46ce90['substring'](0x0,_0x46ce90[_0x7a91('0x57')](_0x56fbf3));}return rp({'method':'GET','uri':util[_0x7a91('0x58')](_0x7a91('0x59'),_0x46ce90,_0x7a91('0x5a')),'headers':{'Authorization':_0x7a91('0x5b')+_0x398e1d[_0x7a91('0x56')]},'json':!![]});}})[_0x7a91('0x24')](function(_0x1be3fe){if(_0x1be3fe){var _0x1cd6d1=_0x1be3fe['users'];var _0x20269a=![];var _0x26f169=null;for(_0x26f169=0x0;_0x26f169<_0x1cd6d1[_0x7a91('0x35')];_0x26f169++){if(_0x1cd6d1[_0x26f169][_0x7a91('0x5c')]===_0x4a21be){_0x20269a=!![];}}if(_0x20269a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7a91('0x5d')});}}})[_0x7a91('0x24')](respondWithResult(_0x1597fd,null))[_0x7a91('0x43')](function(_0x164e1b){var _0x3f32bd=_0x161987[_0x7a91('0x30')][_0x7a91('0x5e')]?0x1f4:_0x164e1b['statusCode']||0x1f4;logger[_0x7a91('0x26')](_0x7a91('0x5f'),_0x7a91('0x53'),_0x3f32bd,JSON[_0x7a91('0x60')](_0x164e1b));delete _0x164e1b[_0x7a91('0x28')];if(_0x3f32bd===0x191){_0x3f32bd=0x190;}_0x1597fd[_0x7a91('0x19')](_0x3f32bd)['send'](_0x161987[_0x7a91('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x164e1b[_0x7a91('0x61')]}:_0x164e1b);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 44a7b90..5b494cf 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 _0x47c5=['rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x21fff4,_0x4c3785){var _0x5475ef=function(_0x56b0ca){while(--_0x56b0ca){_0x21fff4['push'](_0x21fff4['shift']());}};_0x5475ef(++_0x4c3785);}(_0x47c5,0x165));var _0x547c=function(_0x53aecd,_0x3d159f){_0x53aecd=_0x53aecd-0x0;var _0x13992c=_0x47c5[_0x53aecd];return _0x13992c;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var logger=require(_0x547c('0x2'))(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x547c('0x6'));var rimraf=require(_0x547c('0x7'));var config=require('../../config/environment');var attributes=require(_0x547c('0x8'));var integrations=require(_0x547c('0x9'));module['exports']=function(_0x2e5b57,_0x439f25){return _0x2e5b57[_0x547c('0xa')](_0x547c('0xb'),attributes,{'tableName':_0x547c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bd3=['define','int_freshsales_accounts','lodash','../../config/logger','api','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x4bd3,0x174));var _0x34bd=function(_0x167b48,_0x397525){_0x167b48=_0x167b48-0x0;var _0x15ee56=_0x4bd3[_0x167b48];return _0x15ee56;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x34bd('0x6'));module[_0x34bd('0x7')]=function(_0x5c2a7a,_0x3e8744){return _0x5c2a7a[_0x34bd('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x34bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 49a956c..f4b63e4 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 _0xd117=['message','request\x20sent','catch','FreshsalesAccount','options','raw','where','attributes','limit','map','include','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','code','error'];(function(_0x4c2e2b,_0x176274){var _0x84ea2d=function(_0x3de9cf){while(--_0x3de9cf){_0x4c2e2b['push'](_0x4c2e2b['shift']());}};_0x84ea2d(++_0x176274);}(_0xd117,0x182));var _0x7d11=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0xd117[_0x20cc29];return _0x28d513;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});}exports['GetFreshsalesAccount']=function(_0x456cb9){var _0x49a34b=this;return new Promise(function(_0x4d1306,_0x5459df){return db[_0x7d11('0x18')]['findAll']({'raw':_0x456cb9[_0x7d11('0x19')]?_0x456cb9['options'][_0x7d11('0x1a')]===undefined?!![]:![]:!![],'where':_0x456cb9[_0x7d11('0x19')]?_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1b')]||null:null,'attributes':_0x456cb9[_0x7d11('0x19')]?_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1c')]||null:null,'limit':_0x456cb9[_0x7d11('0x19')]?_0x456cb9['options'][_0x7d11('0x1d')]||null:null,'include':_0x456cb9['options']?_0x456cb9['options']['include']?_[_0x7d11('0x1e')](_0x456cb9[_0x7d11('0x19')][_0x7d11('0x1f')],function(_0x1a7853){return{'model':db[_0x1a7853[_0x7d11('0x20')]],'as':_0x1a7853['as'],'attributes':_0x1a7853[_0x7d11('0x1c')],'include':_0x1a7853[_0x7d11('0x1f')]?_[_0x7d11('0x1e')](_0x1a7853['include'],function(_0x36c2b4){return{'model':db[_0x36c2b4['model']],'as':_0x36c2b4['as'],'attributes':_0x36c2b4['attributes'],'include':_0x36c2b4['include']?_[_0x7d11('0x1e')](_0x36c2b4['include'],function(_0x180e1e){return{'model':db[_0x180e1e[_0x7d11('0x20')]],'as':_0x180e1e['as'],'attributes':_0x180e1e[_0x7d11('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46f76a){logger[_0x7d11('0xf')](_0x7d11('0x21'),_0x456cb9);logger['debug'](_0x7d11('0x21'),_0x456cb9,JSON[_0x7d11('0x12')](_0x46f76a));_0x4d1306(_0x46f76a);})[_0x7d11('0x17')](function(_0x38f1be){logger['error'](_0x7d11('0x21'),_0x38f1be['message'],_0x456cb9);_0x5459df(_0x49a34b[_0x7d11('0x14')](0x1f4,_0x38f1be['message']));});});};exports[_0x7d11('0x22')]=function(_0xba4e80){var _0x1e32f6=this;return new Promise(function(_0x4831ed,_0x5e721f){return db[_0x7d11('0x18')][_0x7d11('0x23')]({'raw':_0xba4e80['options']?_0xba4e80[_0x7d11('0x19')][_0x7d11('0x1a')]===undefined?!![]:![]:!![],'where':_0xba4e80[_0x7d11('0x19')]?_0xba4e80['options'][_0x7d11('0x1b')]||null:null,'attributes':_0xba4e80['options']?_0xba4e80['options'][_0x7d11('0x1c')]||null:null,'include':_0xba4e80['options']?_0xba4e80[_0x7d11('0x19')][_0x7d11('0x1f')]?_[_0x7d11('0x1e')](_0xba4e80[_0x7d11('0x19')]['include'],function(_0x11d9e2){return{'model':db[_0x11d9e2[_0x7d11('0x20')]],'as':_0x11d9e2['as'],'attributes':_0x11d9e2['attributes'],'include':_0x11d9e2['include']?_[_0x7d11('0x1e')](_0x11d9e2[_0x7d11('0x1f')],function(_0x5b7d3a){return{'model':db[_0x5b7d3a[_0x7d11('0x20')]],'as':_0x5b7d3a['as'],'attributes':_0x5b7d3a['attributes'],'include':_0x5b7d3a['include']?_[_0x7d11('0x1e')](_0x5b7d3a['include'],function(_0x4e53be){return{'model':db[_0x4e53be[_0x7d11('0x20')]],'as':_0x4e53be['as'],'attributes':_0x4e53be[_0x7d11('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7d11('0x24')](function(_0x2e426b){logger[_0x7d11('0xf')](_0x7d11('0x22'),_0xba4e80);logger[_0x7d11('0x11')](_0x7d11('0x22'),_0xba4e80,JSON[_0x7d11('0x12')](_0x2e426b));_0x4831ed(_0x2e426b);})[_0x7d11('0x17')](function(_0x1a9f18){logger[_0x7d11('0x14')]('ShowFreshsalesAccount',_0x1a9f18[_0x7d11('0x15')],_0xba4e80);_0x5e721f(_0x1e32f6['error'](0x1f4,_0x1a9f18[_0x7d11('0x15')]));});});}; \ No newline at end of file +var _0x3e24=['limit','map','include','model','debug','stringify','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes'];(function(_0x47d4c8,_0x4a7b98){var _0xe42fb6=function(_0x2b544b){while(--_0x2b544b){_0x47d4c8['push'](_0x47d4c8['shift']());}};_0xe42fb6(++_0x4a7b98);}(_0x3e24,0x167));var _0x43e2=function(_0x3a7257,_0x30b139){_0x3a7257=_0x3a7257-0x0;var _0x467d25=_0x3e24[_0x3a7257];return _0x467d25;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});}exports[_0x43e2('0x15')]=function(_0x1b7cde){var _0x3ea010=this;return new Promise(function(_0x15ecb5,_0x3236b9){return db[_0x43e2('0x16')]['findAll']({'raw':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x18')]||null:null,'attributes':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'limit':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x1a')]||null:null,'include':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['include']?_[_0x43e2('0x1b')](_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x1c')],function(_0x11b285){return{'model':db[_0x11b285['model']],'as':_0x11b285['as'],'attributes':_0x11b285[_0x43e2('0x19')],'include':_0x11b285[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x11b285[_0x43e2('0x1c')],function(_0x178223){return{'model':db[_0x178223[_0x43e2('0x1d')]],'as':_0x178223['as'],'attributes':_0x178223[_0x43e2('0x19')],'include':_0x178223[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x178223[_0x43e2('0x1c')],function(_0x1ea844){return{'model':db[_0x1ea844[_0x43e2('0x1d')]],'as':_0x1ea844['as'],'attributes':_0x1ea844['attributes']};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x2f2bd8){logger['info'](_0x43e2('0x15'),_0x1b7cde);logger[_0x43e2('0x1e')](_0x43e2('0x15'),_0x1b7cde,JSON[_0x43e2('0x1f')](_0x2f2bd8));_0x15ecb5(_0x2f2bd8);})[_0x43e2('0x14')](function(_0x5a896b){logger[_0x43e2('0x10')](_0x43e2('0x15'),_0x5a896b[_0x43e2('0x12')],_0x1b7cde);_0x3236b9(_0x3ea010[_0x43e2('0x10')](0x1f4,_0x5a896b[_0x43e2('0x12')]));});});};exports[_0x43e2('0x20')]=function(_0x53f797){var _0x51226b=this;return new Promise(function(_0xe09322,_0x1dcbc8){return db[_0x43e2('0x16')][_0x43e2('0x21')]({'raw':_0x53f797[_0x43e2('0x17')]?_0x53f797['options'][_0x43e2('0x22')]===undefined?!![]:![]:!![],'where':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x18')]||null:null,'attributes':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'include':_0x53f797['options']?_0x53f797['options'][_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x53f797['options'][_0x43e2('0x1c')],function(_0x34effb){return{'model':db[_0x34effb['model']],'as':_0x34effb['as'],'attributes':_0x34effb[_0x43e2('0x19')],'include':_0x34effb['include']?_['map'](_0x34effb['include'],function(_0x2bb489){return{'model':db[_0x2bb489['model']],'as':_0x2bb489['as'],'attributes':_0x2bb489[_0x43e2('0x19')],'include':_0x2bb489[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x2bb489[_0x43e2('0x1c')],function(_0x44670b){return{'model':db[_0x44670b[_0x43e2('0x1d')]],'as':_0x44670b['as'],'attributes':_0x44670b[_0x43e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x1e9be1){logger[_0x43e2('0x13')](_0x43e2('0x20'),_0x53f797);logger[_0x43e2('0x1e')](_0x43e2('0x20'),_0x53f797,JSON[_0x43e2('0x1f')](_0x1e9be1));_0xe09322(_0x1e9be1);})[_0x43e2('0x14')](function(_0x40b39b){logger[_0x43e2('0x10')]('ShowFreshsalesAccount',_0x40b39b['message'],_0x53f797);_0x1dcbc8(_0x51226b['error'](0x1f4,_0x40b39b[_0x43e2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6bcef10..43ac580 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 _0xb854=['./intFreshsalesConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xb854,0x1c4));var _0x4b85=function(_0x358abb,_0x31eaa0){_0x358abb=_0x358abb-0x0;var _0x2d3a2a=_0xb854[_0x358abb];return _0x2d3a2a;};'use strict';var multer=require('multer');var util=require(_0x4b85('0x0'));var path=require(_0x4b85('0x1'));var timeout=require(_0x4b85('0x2'));var express=require(_0x4b85('0x3'));var router=express[_0x4b85('0x4')]();var fs_extra=require(_0x4b85('0x5'));var auth=require(_0x4b85('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4b85('0x7'));var controller=require(_0x4b85('0x8'));router['get']('/',auth[_0x4b85('0x9')](),controller[_0x4b85('0xa')]);router['get'](_0x4b85('0xb'),auth['isAuthenticated'](),controller[_0x4b85('0xc')]);router[_0x4b85('0xd')](_0x4b85('0xe'),auth[_0x4b85('0x9')](),controller['getSubjects']);router['get'](_0x4b85('0xf'),auth[_0x4b85('0x9')](),controller[_0x4b85('0x10')]);router[_0x4b85('0xd')](_0x4b85('0x11'),auth[_0x4b85('0x9')](),controller[_0x4b85('0x12')]);router[_0x4b85('0x13')]('/',auth[_0x4b85('0x9')](),controller[_0x4b85('0x14')]);router['put'](_0x4b85('0xb'),auth[_0x4b85('0x9')](),controller[_0x4b85('0x15')]);router['delete'](_0x4b85('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4b85('0x16')]=router; \ No newline at end of file +var _0x8b8a=['./intFreshsalesConfiguration.controller','get','index','/:id','show','isAuthenticated','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x246b8d,_0x2ae345){var _0x5d4ad5=function(_0xbec604){while(--_0xbec604){_0x246b8d['push'](_0x246b8d['shift']());}};_0x5d4ad5(++_0x2ae345);}(_0x8b8a,0x181));var _0xa8b8=function(_0x3e96f6,_0x55107a){_0x3e96f6=_0x3e96f6-0x0;var _0x25a073=_0x8b8a[_0x3e96f6];return _0x25a073;};'use strict';var multer=require('multer');var util=require(_0xa8b8('0x0'));var path=require(_0xa8b8('0x1'));var timeout=require(_0xa8b8('0x2'));var express=require('express');var router=express[_0xa8b8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa8b8('0x4'));var config=require(_0xa8b8('0x5'));var controller=require(_0xa8b8('0x6'));router[_0xa8b8('0x7')]('/',auth['isAuthenticated'](),controller[_0xa8b8('0x8')]);router[_0xa8b8('0x7')](_0xa8b8('0x9'),auth['isAuthenticated'](),controller[_0xa8b8('0xa')]);router['get']('/:id/subjects',auth[_0xa8b8('0xb')](),controller[_0xa8b8('0xc')]);router[_0xa8b8('0x7')](_0xa8b8('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xa8b8('0x7')](_0xa8b8('0xe'),auth['isAuthenticated'](),controller[_0xa8b8('0xf')]);router[_0xa8b8('0x10')]('/',auth['isAuthenticated'](),controller[_0xa8b8('0x11')]);router[_0xa8b8('0x12')](_0xa8b8('0x9'),auth[_0xa8b8('0xb')](),controller[_0xa8b8('0x13')]);router[_0xa8b8('0x14')]('/:id',auth[_0xa8b8('0xb')](),controller[_0xa8b8('0x15')]);module[_0xa8b8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0b7a283..9b0ae0e 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 _0xda05=['STRING','sequelize','exports'];(function(_0x106dc8,_0x4e9648){var _0x51c5d1=function(_0x54ec7a){while(--_0x54ec7a){_0x106dc8['push'](_0x106dc8['shift']());}};_0x51c5d1(++_0x4e9648);}(_0xda05,0x106));var _0x5da0=function(_0x5a38ec,_0x718e94){_0x5a38ec=_0x5a38ec-0x0;var _0xd2ffb1=_0xda05[_0x5a38ec];return _0xd2ffb1;};'use strict';var Sequelize=require(_0x5da0('0x0'));module[_0x5da0('0x1')]={'name':{'type':Sequelize[_0x5da0('0x2')]},'description':{'type':Sequelize[_0x5da0('0x2')]}}; \ No newline at end of file +var _0x90ce=['STRING','sequelize','exports'];(function(_0x1f8e33,_0x300371){var _0x37b939=function(_0x4d4fa4){while(--_0x4d4fa4){_0x1f8e33['push'](_0x1f8e33['shift']());}};_0x37b939(++_0x300371);}(_0x90ce,0x15a));var _0xe90c=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0x90ce[_0x211fef];return _0x5447bf;};'use strict';var Sequelize=require(_0xe90c('0x0'));module[_0xe90c('0x1')]={'name':{'type':Sequelize[_0xe90c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 19e070c..d19e64f 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 _0x9b75=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','rows','show','params','find','catch','create','body','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0x9b75,0x1b5));var _0x59b7=function(_0x110111,_0x5bd611){_0x110111=_0x110111-0x0;var _0x1b3440=_0x9b75[_0x110111];return _0x1b3440;};'use strict';var emlformat=require(_0x59b7('0x0'));var rimraf=require(_0x59b7('0x1'));var zipdir=require(_0x59b7('0x2'));var jsonpatch=require(_0x59b7('0x3'));var rp=require(_0x59b7('0x4'));var moment=require('moment');var BPromise=require(_0x59b7('0x5'));var Mustache=require(_0x59b7('0x6'));var util=require(_0x59b7('0x7'));var path=require(_0x59b7('0x8'));var sox=require(_0x59b7('0x9'));var csv=require('to-csv');var ejs=require(_0x59b7('0xa'));var fs=require('fs');var fs_extra=require(_0x59b7('0xb'));var _=require(_0x59b7('0xc'));var squel=require(_0x59b7('0xd'));var crypto=require(_0x59b7('0xe'));var jsforce=require(_0x59b7('0xf'));var deskjs=require(_0x59b7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x59b7('0x11'));var Papa=require(_0x59b7('0x12'));var Redis=require(_0x59b7('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x59b7('0x14'));var as=require(_0x59b7('0x15'));var hardwareService=require(_0x59b7('0x16'));var logger=require('../../config/logger')(_0x59b7('0x17'));var utils=require(_0x59b7('0x18'));var config=require(_0x59b7('0x19'));var licenseUtil=require(_0x59b7('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4aee16,_0x5a7cc9){_0x5a7cc9=_0x5a7cc9||0xcc;return function(_0x4d59eb){if(_0x4d59eb){return _0x4aee16[_0x59b7('0x1b')](_0x5a7cc9);}return _0x4aee16[_0x59b7('0x1c')](_0x5a7cc9)['end']();};}function respondWithResult(_0x354222,_0x4ffec0){_0x4ffec0=_0x4ffec0||0xc8;return function(_0x21066a){if(_0x21066a){return _0x354222[_0x59b7('0x1c')](_0x4ffec0)[_0x59b7('0x1d')](_0x21066a);}};}function respondWithFilteredResult(_0x58ad8e,_0x33ddc5){return function(_0x5c6b9f){if(_0x5c6b9f){var _0x18821a=typeof _0x33ddc5[_0x59b7('0x1e')]==='undefined'&&typeof _0x33ddc5[_0x59b7('0x1f')]===_0x59b7('0x20');var _0x244af7=_0x5c6b9f[_0x59b7('0x21')];var _0x1d330a=_0x18821a?0x0:_0x33ddc5[_0x59b7('0x1e')];var _0x102836=_0x18821a?_0x5c6b9f[_0x59b7('0x21')]:_0x33ddc5[_0x59b7('0x1e')]+_0x33ddc5[_0x59b7('0x1f')];var _0x146aa1;if(_0x102836>=_0x244af7){_0x102836=_0x244af7;_0x146aa1=0xc8;}else{_0x146aa1=0xce;}_0x58ad8e[_0x59b7('0x1c')](_0x146aa1);return _0x58ad8e[_0x59b7('0x22')](_0x59b7('0x23'),_0x1d330a+'-'+_0x102836+'/'+_0x244af7)[_0x59b7('0x1d')](_0x5c6b9f);}return null;};}function patchUpdates(_0x5500be){return function(_0x4fb863){try{jsonpatch[_0x59b7('0x24')](_0x4fb863,_0x5500be,!![]);}catch(_0x37f325){return BPromise['reject'](_0x37f325);}return _0x4fb863['save']();};}function saveUpdates(_0x2358a2,_0x5e2ae6){return function(_0x566347){if(_0x566347){return _0x566347[_0x59b7('0x25')](_0x2358a2)[_0x59b7('0x26')](function(_0xb73654){return _0xb73654;});}return null;};}function removeEntity(_0x2ea5a3,_0x3fde9f){return function(_0xa4d81){if(_0xa4d81){return _0xa4d81['destroy']()['then'](function(){_0x2ea5a3[_0x59b7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4830ec,_0x4be5d5){return function(_0x3904d1){if(!_0x3904d1){_0x4830ec[_0x59b7('0x1b')](0x194);}return _0x3904d1;};}function handleError(_0x6fe1bc,_0x3d62f3){_0x3d62f3=_0x3d62f3||0x1f4;return function(_0x5a8aaf){logger[_0x59b7('0x27')](_0x5a8aaf['stack']);if(_0x5a8aaf[_0x59b7('0x28')]){delete _0x5a8aaf[_0x59b7('0x28')];}_0x6fe1bc[_0x59b7('0x1c')](_0x3d62f3)[_0x59b7('0x29')](_0x5a8aaf);};}exports[_0x59b7('0x2a')]=function(_0x18ef8c,_0x35eace){var _0x4fa72e={},_0x4d72b7={},_0x3632a7={'count':0x0,'rows':[]};var _0x26abad=_[_0x59b7('0x2b')](db['FreshsalesConfiguration'][_0x59b7('0x2c')],function(_0x4ee562){return{'name':_0x4ee562[_0x59b7('0x2d')],'type':_0x4ee562[_0x59b7('0x2e')][_0x59b7('0x2f')]};});_0x4d72b7['model']=_[_0x59b7('0x2b')](_0x26abad,_0x59b7('0x28'));_0x4d72b7[_0x59b7('0x30')]=_[_0x59b7('0x31')](_0x18ef8c[_0x59b7('0x30')]);_0x4d72b7[_0x59b7('0x32')]=_['intersection'](_0x4d72b7[_0x59b7('0x33')],_0x4d72b7['query']);_0x4fa72e['attributes']=_[_0x59b7('0x34')](_0x4d72b7[_0x59b7('0x33')],qs[_0x59b7('0x35')](_0x18ef8c['query'][_0x59b7('0x35')]));_0x4fa72e['attributes']=_0x4fa72e[_0x59b7('0x36')][_0x59b7('0x37')]?_0x4fa72e[_0x59b7('0x36')]:_0x4d72b7[_0x59b7('0x33')];if(!_0x18ef8c[_0x59b7('0x30')][_0x59b7('0x38')](_0x59b7('0x39'))){_0x4fa72e[_0x59b7('0x1f')]=qs[_0x59b7('0x1f')](_0x18ef8c[_0x59b7('0x30')][_0x59b7('0x1f')]);_0x4fa72e[_0x59b7('0x1e')]=qs['offset'](_0x18ef8c[_0x59b7('0x30')][_0x59b7('0x1e')]);}_0x4fa72e[_0x59b7('0x3a')]=qs[_0x59b7('0x3b')](_0x18ef8c['query'][_0x59b7('0x3b')]);_0x4fa72e[_0x59b7('0x3c')]=qs[_0x59b7('0x32')](_[_0x59b7('0x3d')](_0x18ef8c[_0x59b7('0x30')],_0x4d72b7[_0x59b7('0x32')]),_0x26abad);if(_0x18ef8c['query'][_0x59b7('0x3e')]){_0x4fa72e['where']=_[_0x59b7('0x3f')](_0x4fa72e[_0x59b7('0x3c')],{'$or':_[_0x59b7('0x2b')](_0x26abad,function(_0x17f3fb){if(_0x17f3fb[_0x59b7('0x2e')]!==_0x59b7('0x40')){var _0x5081e0={};_0x5081e0[_0x17f3fb[_0x59b7('0x28')]]={'$like':'%'+_0x18ef8c['query'][_0x59b7('0x3e')]+'%'};return _0x5081e0;}})});}_0x4fa72e=_[_0x59b7('0x3f')]({},_0x4fa72e,_0x18ef8c[_0x59b7('0x41')]);var _0x48790c={'where':_0x4fa72e[_0x59b7('0x3c')]};return db[_0x59b7('0x42')][_0x59b7('0x21')](_0x48790c)[_0x59b7('0x26')](function(_0x58b52a){_0x3632a7[_0x59b7('0x21')]=_0x58b52a;if(_0x18ef8c[_0x59b7('0x30')][_0x59b7('0x43')]){_0x4fa72e[_0x59b7('0x44')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x59b7('0x45')](_0x4fa72e);})[_0x59b7('0x26')](function(_0x5bf414){_0x3632a7[_0x59b7('0x46')]=_0x5bf414;return _0x3632a7;})[_0x59b7('0x26')](respondWithFilteredResult(_0x35eace,_0x4fa72e))['catch'](handleError(_0x35eace,null));};exports[_0x59b7('0x47')]=function(_0x203ca9,_0x35c928){var _0x3ce0f2={'raw':![],'where':{'id':_0x203ca9[_0x59b7('0x48')]['id']}},_0x42bc1b={};_0x42bc1b[_0x59b7('0x33')]=_[_0x59b7('0x31')](db[_0x59b7('0x42')][_0x59b7('0x2c')]);_0x42bc1b['query']=_[_0x59b7('0x31')](_0x203ca9['query']);_0x42bc1b[_0x59b7('0x32')]=_[_0x59b7('0x34')](_0x42bc1b['model'],_0x42bc1b['query']);_0x3ce0f2[_0x59b7('0x36')]=_[_0x59b7('0x34')](_0x42bc1b['model'],qs[_0x59b7('0x35')](_0x203ca9[_0x59b7('0x30')][_0x59b7('0x35')]));_0x3ce0f2[_0x59b7('0x36')]=_0x3ce0f2[_0x59b7('0x36')]['length']?_0x3ce0f2[_0x59b7('0x36')]:_0x42bc1b[_0x59b7('0x33')];if(_0x203ca9[_0x59b7('0x30')][_0x59b7('0x43')]){_0x3ce0f2[_0x59b7('0x44')]=[{'all':!![]}];}_0x3ce0f2=_['merge']({},_0x3ce0f2,_0x203ca9[_0x59b7('0x41')]);return db[_0x59b7('0x42')][_0x59b7('0x49')](_0x3ce0f2)['then'](handleEntityNotFound(_0x35c928,null))[_0x59b7('0x26')](respondWithResult(_0x35c928,null))[_0x59b7('0x4a')](handleError(_0x35c928,null));};exports['create']=function(_0x401dfb,_0x5d57d6){return db[_0x59b7('0x42')][_0x59b7('0x4b')](_0x401dfb[_0x59b7('0x4c')],{})[_0x59b7('0x26')](respondWithResult(_0x5d57d6,0xc9))['catch'](handleError(_0x5d57d6,null));};exports[_0x59b7('0x25')]=function(_0x4b71a7,_0x49f750){if(_0x4b71a7[_0x59b7('0x4c')]['id']){delete _0x4b71a7[_0x59b7('0x4c')]['id'];}return db[_0x59b7('0x42')][_0x59b7('0x49')]({'where':{'id':_0x4b71a7[_0x59b7('0x48')]['id']}})[_0x59b7('0x26')](handleEntityNotFound(_0x49f750,null))[_0x59b7('0x26')](saveUpdates(_0x4b71a7[_0x59b7('0x4c')],null))['then'](respondWithResult(_0x49f750,null))['catch'](handleError(_0x49f750,null));};exports['destroy']=function(_0x23bdfa,_0x9f7baf){return db[_0x59b7('0x42')][_0x59b7('0x49')]({'where':{'id':_0x23bdfa['params']['id']}})['then'](handleEntityNotFound(_0x9f7baf,null))[_0x59b7('0x26')](removeEntity(_0x9f7baf,null))['catch'](handleError(_0x9f7baf,null));};exports[_0x59b7('0x4d')]=function(_0xc2aef3,_0x1dc11b,_0x31ba27){var _0xc0fe0a={};var _0x30af50={};var _0x1fd921;var _0x2e5328;return db[_0x59b7('0x42')]['findOne']({'where':{'id':_0xc2aef3[_0x59b7('0x48')]['id']}})[_0x59b7('0x26')](handleEntityNotFound(_0x1dc11b,null))[_0x59b7('0x26')](function(_0x8d7609){if(_0x8d7609){_0x1fd921=_0x8d7609;_0x30af50['model']=_['keys'](db[_0x59b7('0x4e')][_0x59b7('0x2c')]);_0x30af50[_0x59b7('0x30')]=_[_0x59b7('0x31')](_0xc2aef3[_0x59b7('0x30')]);_0x30af50[_0x59b7('0x32')]=_[_0x59b7('0x34')](_0x30af50[_0x59b7('0x33')],_0x30af50['query']);_0xc0fe0a[_0x59b7('0x36')]=_[_0x59b7('0x34')](_0x30af50['model'],qs['fields'](_0xc2aef3['query'][_0x59b7('0x35')]));_0xc0fe0a['attributes']=_0xc0fe0a[_0x59b7('0x36')][_0x59b7('0x37')]?_0xc0fe0a[_0x59b7('0x36')]:_0x30af50['model'];_0xc0fe0a['order']=qs['sort'](_0xc2aef3[_0x59b7('0x30')][_0x59b7('0x3b')]);_0xc0fe0a[_0x59b7('0x3c')]=qs[_0x59b7('0x32')](_[_0x59b7('0x3d')](_0xc2aef3[_0x59b7('0x30')],_0x30af50[_0x59b7('0x32')]));if(_0xc2aef3[_0x59b7('0x30')][_0x59b7('0x3e')]){_0xc0fe0a[_0x59b7('0x3c')]=_[_0x59b7('0x3f')](_0xc0fe0a[_0x59b7('0x3c')],{'$or':_[_0x59b7('0x2b')](_0xc0fe0a[_0x59b7('0x36')],function(_0x303a9b){var _0x37c70e={};_0x37c70e[_0x303a9b]={'$like':'%'+_0xc2aef3[_0x59b7('0x30')][_0x59b7('0x3e')]+'%'};return _0x37c70e;})});}_0xc0fe0a=_[_0x59b7('0x3f')]({},_0xc0fe0a,_0xc2aef3[_0x59b7('0x41')]);return _0x1fd921['getSubjects'](_0xc0fe0a);}})[_0x59b7('0x26')](function(_0x5ca61a){if(_0x5ca61a){_0x2e5328=_0x5ca61a['length'];if(!_0xc2aef3[_0x59b7('0x30')][_0x59b7('0x38')](_0x59b7('0x39'))){_0xc0fe0a[_0x59b7('0x1f')]=qs[_0x59b7('0x1f')](_0xc2aef3[_0x59b7('0x30')]['limit']);_0xc0fe0a['offset']=qs[_0x59b7('0x1e')](_0xc2aef3[_0x59b7('0x30')][_0x59b7('0x1e')]);}return _0x1fd921['getSubjects'](_0xc0fe0a);}})[_0x59b7('0x26')](function(_0x5726ba){if(_0x5726ba){return _0x5726ba?{'count':_0x2e5328,'rows':_0x5726ba}:null;}})['then'](respondWithResult(_0x1dc11b,null))['catch'](handleError(_0x1dc11b,null));};exports[_0x59b7('0x4f')]=function(_0x2d2ed8,_0x3a946e,_0x5c83b0){var _0x52bc8f={};var _0x15fa20={};var _0x382023;var _0x3b3ec9;return db[_0x59b7('0x42')][_0x59b7('0x50')]({'where':{'id':_0x2d2ed8[_0x59b7('0x48')]['id']}})[_0x59b7('0x26')](handleEntityNotFound(_0x3a946e,null))[_0x59b7('0x26')](function(_0x5610bd){if(_0x5610bd){_0x382023=_0x5610bd;_0x15fa20[_0x59b7('0x33')]=_['keys'](db['FreshsalesField'][_0x59b7('0x2c')]);_0x15fa20[_0x59b7('0x30')]=_[_0x59b7('0x31')](_0x2d2ed8[_0x59b7('0x30')]);_0x15fa20[_0x59b7('0x32')]=_[_0x59b7('0x34')](_0x15fa20[_0x59b7('0x33')],_0x15fa20[_0x59b7('0x30')]);_0x52bc8f['attributes']=_[_0x59b7('0x34')](_0x15fa20[_0x59b7('0x33')],qs[_0x59b7('0x35')](_0x2d2ed8[_0x59b7('0x30')]['fields']));_0x52bc8f[_0x59b7('0x36')]=_0x52bc8f[_0x59b7('0x36')][_0x59b7('0x37')]?_0x52bc8f[_0x59b7('0x36')]:_0x15fa20['model'];_0x52bc8f['order']=qs['sort'](_0x2d2ed8[_0x59b7('0x30')][_0x59b7('0x3b')]);_0x52bc8f[_0x59b7('0x3c')]=qs[_0x59b7('0x32')](_['pick'](_0x2d2ed8[_0x59b7('0x30')],_0x15fa20['filters']));if(_0x2d2ed8[_0x59b7('0x30')]['filter']){_0x52bc8f[_0x59b7('0x3c')]=_['merge'](_0x52bc8f[_0x59b7('0x3c')],{'$or':_[_0x59b7('0x2b')](_0x52bc8f[_0x59b7('0x36')],function(_0x3859e1){var _0x51efd4={};_0x51efd4[_0x3859e1]={'$like':'%'+_0x2d2ed8[_0x59b7('0x30')]['filter']+'%'};return _0x51efd4;})});}_0x52bc8f=_['merge']({},_0x52bc8f,_0x2d2ed8[_0x59b7('0x41')]);return _0x382023['getDescriptions'](_0x52bc8f);}})[_0x59b7('0x26')](function(_0x255584){if(_0x255584){_0x3b3ec9=_0x255584[_0x59b7('0x37')];if(!_0x2d2ed8[_0x59b7('0x30')][_0x59b7('0x38')](_0x59b7('0x39'))){_0x52bc8f[_0x59b7('0x1f')]=qs[_0x59b7('0x1f')](_0x2d2ed8['query'][_0x59b7('0x1f')]);_0x52bc8f[_0x59b7('0x1e')]=qs[_0x59b7('0x1e')](_0x2d2ed8[_0x59b7('0x30')]['offset']);}return _0x382023[_0x59b7('0x4f')](_0x52bc8f);}})['then'](function(_0xcd149f){if(_0xcd149f){return _0xcd149f?{'count':_0x3b3ec9,'rows':_0xcd149f}:null;}})['then'](respondWithResult(_0x3a946e,null))[_0x59b7('0x4a')](handleError(_0x3a946e,null));};exports[_0x59b7('0x51')]=function(_0x1982b9,_0x1235df,_0x3f1712){var _0x5b72b0={};var _0x1824d0={};var _0x25f52d;var _0x5ee2e0;return db['FreshsalesConfiguration'][_0x59b7('0x50')]({'where':{'id':_0x1982b9[_0x59b7('0x48')]['id']}})[_0x59b7('0x26')](handleEntityNotFound(_0x1235df,null))[_0x59b7('0x26')](function(_0x5467cf){if(_0x5467cf){_0x25f52d=_0x5467cf;_0x1824d0[_0x59b7('0x33')]=_[_0x59b7('0x31')](db[_0x59b7('0x4e')][_0x59b7('0x2c')]);_0x1824d0['query']=_[_0x59b7('0x31')](_0x1982b9[_0x59b7('0x30')]);_0x1824d0[_0x59b7('0x32')]=_[_0x59b7('0x34')](_0x1824d0['model'],_0x1824d0[_0x59b7('0x30')]);_0x5b72b0['attributes']=_[_0x59b7('0x34')](_0x1824d0[_0x59b7('0x33')],qs[_0x59b7('0x35')](_0x1982b9['query']['fields']));_0x5b72b0[_0x59b7('0x36')]=_0x5b72b0['attributes'][_0x59b7('0x37')]?_0x5b72b0[_0x59b7('0x36')]:_0x1824d0[_0x59b7('0x33')];_0x5b72b0[_0x59b7('0x3a')]=qs[_0x59b7('0x3b')](_0x1982b9[_0x59b7('0x30')][_0x59b7('0x3b')]);_0x5b72b0[_0x59b7('0x3c')]=qs[_0x59b7('0x32')](_[_0x59b7('0x3d')](_0x1982b9[_0x59b7('0x30')],_0x1824d0[_0x59b7('0x32')]));if(_0x1982b9['query'][_0x59b7('0x3e')]){_0x5b72b0[_0x59b7('0x3c')]=_['merge'](_0x5b72b0[_0x59b7('0x3c')],{'$or':_[_0x59b7('0x2b')](_0x5b72b0[_0x59b7('0x36')],function(_0x4e1b61){var _0x4b9202={};_0x4b9202[_0x4e1b61]={'$like':'%'+_0x1982b9['query'][_0x59b7('0x3e')]+'%'};return _0x4b9202;})});}_0x5b72b0=_['merge']({},_0x5b72b0,_0x1982b9[_0x59b7('0x41')]);return _0x25f52d[_0x59b7('0x51')](_0x5b72b0);}})[_0x59b7('0x26')](function(_0x28c5d9){if(_0x28c5d9){_0x5ee2e0=_0x28c5d9['length'];if(!_0x1982b9[_0x59b7('0x30')][_0x59b7('0x38')](_0x59b7('0x39'))){_0x5b72b0['limit']=qs[_0x59b7('0x1f')](_0x1982b9['query'][_0x59b7('0x1f')]);_0x5b72b0[_0x59b7('0x1e')]=qs['offset'](_0x1982b9[_0x59b7('0x30')][_0x59b7('0x1e')]);}return _0x25f52d[_0x59b7('0x51')](_0x5b72b0);}})[_0x59b7('0x26')](function(_0x1a659){if(_0x1a659){return _0x1a659?{'count':_0x5ee2e0,'rows':_0x1a659}:null;}})['then'](respondWithResult(_0x1235df,null))['catch'](handleError(_0x1235df,null));}; \ No newline at end of file +var _0x75ee=['options','FreshsalesConfiguration','includeAll','findAll','rows','catch','show','params','create','body','find','getSubjects','sort','nolimit','findOne','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type'];(function(_0x35aade,_0x9b4cc0){var _0x1a9a28=function(_0x3d1ac6){while(--_0x3d1ac6){_0x35aade['push'](_0x35aade['shift']());}};_0x1a9a28(++_0x9b4cc0);}(_0x75ee,0x13e));var _0xe75e=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0x75ee[_0x1d80be];return _0xf9a4f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe75e('0x0'));var zipdir=require(_0xe75e('0x1'));var jsonpatch=require(_0xe75e('0x2'));var rp=require('request-promise');var moment=require(_0xe75e('0x3'));var BPromise=require(_0xe75e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe75e('0x5'));var sox=require('sox');var csv=require(_0xe75e('0x6'));var ejs=require(_0xe75e('0x7'));var fs=require('fs');var fs_extra=require(_0xe75e('0x8'));var _=require(_0xe75e('0x9'));var squel=require(_0xe75e('0xa'));var crypto=require(_0xe75e('0xb'));var jsforce=require(_0xe75e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe75e('0x6'));var querystring=require(_0xe75e('0xd'));var Papa=require(_0xe75e('0xe'));var Redis=require('ioredis');var authService=require(_0xe75e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe75e('0x10'));var logger=require(_0xe75e('0x11'))(_0xe75e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe75e('0x13'))['db'];function respondWithStatusCode(_0x1cfbf1,_0x5c6042){_0x5c6042=_0x5c6042||0xcc;return function(_0x15d060){if(_0x15d060){return _0x1cfbf1[_0xe75e('0x14')](_0x5c6042);}return _0x1cfbf1[_0xe75e('0x15')](_0x5c6042)[_0xe75e('0x16')]();};}function respondWithResult(_0x4b6962,_0x1e46fe){_0x1e46fe=_0x1e46fe||0xc8;return function(_0x4dfc0e){if(_0x4dfc0e){return _0x4b6962[_0xe75e('0x15')](_0x1e46fe)['json'](_0x4dfc0e);}};}function respondWithFilteredResult(_0x176fc3,_0x5567c5){return function(_0x4e7f1c){if(_0x4e7f1c){var _0x52c155=typeof _0x5567c5[_0xe75e('0x17')]===_0xe75e('0x18')&&typeof _0x5567c5[_0xe75e('0x19')]===_0xe75e('0x18');var _0x1b3be3=_0x4e7f1c[_0xe75e('0x1a')];var _0x15614a=_0x52c155?0x0:_0x5567c5[_0xe75e('0x17')];var _0x583072=_0x52c155?_0x4e7f1c[_0xe75e('0x1a')]:_0x5567c5[_0xe75e('0x17')]+_0x5567c5[_0xe75e('0x19')];var _0x4333af;if(_0x583072>=_0x1b3be3){_0x583072=_0x1b3be3;_0x4333af=0xc8;}else{_0x4333af=0xce;}_0x176fc3[_0xe75e('0x15')](_0x4333af);return _0x176fc3[_0xe75e('0x1b')](_0xe75e('0x1c'),_0x15614a+'-'+_0x583072+'/'+_0x1b3be3)['json'](_0x4e7f1c);}return null;};}function patchUpdates(_0x3e11f4){return function(_0x17c503){try{jsonpatch['apply'](_0x17c503,_0x3e11f4,!![]);}catch(_0x1afa77){return BPromise[_0xe75e('0x1d')](_0x1afa77);}return _0x17c503[_0xe75e('0x1e')]();};}function saveUpdates(_0x2e86a2,_0x3ab2de){return function(_0x21e6ef){if(_0x21e6ef){return _0x21e6ef[_0xe75e('0x1f')](_0x2e86a2)[_0xe75e('0x20')](function(_0xfecd3a){return _0xfecd3a;});}return null;};}function removeEntity(_0x20e643,_0x24957c){return function(_0x55e15e){if(_0x55e15e){return _0x55e15e[_0xe75e('0x21')]()[_0xe75e('0x20')](function(){_0x20e643[_0xe75e('0x15')](0xcc)[_0xe75e('0x16')]();});}};}function handleEntityNotFound(_0x143bfe,_0x565a60){return function(_0x20a9e3){if(!_0x20a9e3){_0x143bfe[_0xe75e('0x14')](0x194);}return _0x20a9e3;};}function handleError(_0x1d1e93,_0xe0a8e2){_0xe0a8e2=_0xe0a8e2||0x1f4;return function(_0x1886a9){logger[_0xe75e('0x22')](_0x1886a9[_0xe75e('0x23')]);if(_0x1886a9[_0xe75e('0x24')]){delete _0x1886a9['name'];}_0x1d1e93[_0xe75e('0x15')](_0xe0a8e2)[_0xe75e('0x25')](_0x1886a9);};}exports['index']=function(_0xed16bf,_0x5d1d2c){var _0x384aff={},_0x35591a={},_0x520bca={'count':0x0,'rows':[]};var _0x13b40=_[_0xe75e('0x26')](db['FreshsalesConfiguration'][_0xe75e('0x27')],function(_0x492b7a){return{'name':_0x492b7a[_0xe75e('0x28')],'type':_0x492b7a['type'][_0xe75e('0x29')]};});_0x35591a[_0xe75e('0x2a')]=_['map'](_0x13b40,_0xe75e('0x24'));_0x35591a['query']=_[_0xe75e('0x2b')](_0xed16bf[_0xe75e('0x2c')]);_0x35591a[_0xe75e('0x2d')]=_[_0xe75e('0x2e')](_0x35591a[_0xe75e('0x2a')],_0x35591a[_0xe75e('0x2c')]);_0x384aff[_0xe75e('0x2f')]=_['intersection'](_0x35591a[_0xe75e('0x2a')],qs[_0xe75e('0x30')](_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x30')]));_0x384aff[_0xe75e('0x2f')]=_0x384aff['attributes'][_0xe75e('0x31')]?_0x384aff[_0xe75e('0x2f')]:_0x35591a[_0xe75e('0x2a')];if(!_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x32')]('nolimit')){_0x384aff[_0xe75e('0x19')]=qs[_0xe75e('0x19')](_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x19')]);_0x384aff['offset']=qs['offset'](_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x17')]);}_0x384aff[_0xe75e('0x33')]=qs['sort'](_0xed16bf[_0xe75e('0x2c')]['sort']);_0x384aff[_0xe75e('0x34')]=qs[_0xe75e('0x2d')](_[_0xe75e('0x35')](_0xed16bf[_0xe75e('0x2c')],_0x35591a['filters']),_0x13b40);if(_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x36')]){_0x384aff['where']=_[_0xe75e('0x37')](_0x384aff[_0xe75e('0x34')],{'$or':_[_0xe75e('0x26')](_0x13b40,function(_0x37bfca){if(_0x37bfca[_0xe75e('0x38')]!=='VIRTUAL'){var _0x3fc31f={};_0x3fc31f[_0x37bfca[_0xe75e('0x24')]]={'$like':'%'+_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x36')]+'%'};return _0x3fc31f;}})});}_0x384aff=_[_0xe75e('0x37')]({},_0x384aff,_0xed16bf[_0xe75e('0x39')]);var _0x21bfc8={'where':_0x384aff[_0xe75e('0x34')]};return db[_0xe75e('0x3a')][_0xe75e('0x1a')](_0x21bfc8)['then'](function(_0x53574d){_0x520bca[_0xe75e('0x1a')]=_0x53574d;if(_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x3b')]){_0x384aff['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xe75e('0x3c')](_0x384aff);})['then'](function(_0x5b7b51){_0x520bca[_0xe75e('0x3d')]=_0x5b7b51;return _0x520bca;})[_0xe75e('0x20')](respondWithFilteredResult(_0x5d1d2c,_0x384aff))[_0xe75e('0x3e')](handleError(_0x5d1d2c,null));};exports[_0xe75e('0x3f')]=function(_0x49462e,_0x19e5d8){var _0x3f9085={'raw':![],'where':{'id':_0x49462e[_0xe75e('0x40')]['id']}},_0x463822={};_0x463822[_0xe75e('0x2a')]=_[_0xe75e('0x2b')](db[_0xe75e('0x3a')][_0xe75e('0x27')]);_0x463822[_0xe75e('0x2c')]=_[_0xe75e('0x2b')](_0x49462e[_0xe75e('0x2c')]);_0x463822['filters']=_[_0xe75e('0x2e')](_0x463822[_0xe75e('0x2a')],_0x463822[_0xe75e('0x2c')]);_0x3f9085[_0xe75e('0x2f')]=_[_0xe75e('0x2e')](_0x463822[_0xe75e('0x2a')],qs[_0xe75e('0x30')](_0x49462e[_0xe75e('0x2c')][_0xe75e('0x30')]));_0x3f9085['attributes']=_0x3f9085[_0xe75e('0x2f')][_0xe75e('0x31')]?_0x3f9085[_0xe75e('0x2f')]:_0x463822[_0xe75e('0x2a')];if(_0x49462e[_0xe75e('0x2c')][_0xe75e('0x3b')]){_0x3f9085['include']=[{'all':!![]}];}_0x3f9085=_[_0xe75e('0x37')]({},_0x3f9085,_0x49462e[_0xe75e('0x39')]);return db[_0xe75e('0x3a')]['find'](_0x3f9085)[_0xe75e('0x20')](handleEntityNotFound(_0x19e5d8,null))['then'](respondWithResult(_0x19e5d8,null))[_0xe75e('0x3e')](handleError(_0x19e5d8,null));};exports[_0xe75e('0x41')]=function(_0x1ddeb8,_0x58d67f){return db[_0xe75e('0x3a')][_0xe75e('0x41')](_0x1ddeb8[_0xe75e('0x42')],{})[_0xe75e('0x20')](respondWithResult(_0x58d67f,0xc9))[_0xe75e('0x3e')](handleError(_0x58d67f,null));};exports[_0xe75e('0x1f')]=function(_0x3eb377,_0x4d6c38){if(_0x3eb377[_0xe75e('0x42')]['id']){delete _0x3eb377[_0xe75e('0x42')]['id'];}return db[_0xe75e('0x3a')][_0xe75e('0x43')]({'where':{'id':_0x3eb377['params']['id']}})[_0xe75e('0x20')](handleEntityNotFound(_0x4d6c38,null))[_0xe75e('0x20')](saveUpdates(_0x3eb377['body'],null))[_0xe75e('0x20')](respondWithResult(_0x4d6c38,null))[_0xe75e('0x3e')](handleError(_0x4d6c38,null));};exports[_0xe75e('0x21')]=function(_0x3984d4,_0x14989f){return db['FreshsalesConfiguration'][_0xe75e('0x43')]({'where':{'id':_0x3984d4[_0xe75e('0x40')]['id']}})[_0xe75e('0x20')](handleEntityNotFound(_0x14989f,null))[_0xe75e('0x20')](removeEntity(_0x14989f,null))[_0xe75e('0x3e')](handleError(_0x14989f,null));};exports[_0xe75e('0x44')]=function(_0x5a923f,_0x5b0f7b,_0x3d6ea5){var _0x261020={};var _0x58c3c8={};var _0x3d828a;var _0x103c08;return db[_0xe75e('0x3a')]['findOne']({'where':{'id':_0x5a923f[_0xe75e('0x40')]['id']}})[_0xe75e('0x20')](handleEntityNotFound(_0x5b0f7b,null))['then'](function(_0x5b1d4f){if(_0x5b1d4f){_0x3d828a=_0x5b1d4f;_0x58c3c8['model']=_['keys'](db['FreshsalesField'][_0xe75e('0x27')]);_0x58c3c8[_0xe75e('0x2c')]=_[_0xe75e('0x2b')](_0x5a923f[_0xe75e('0x2c')]);_0x58c3c8[_0xe75e('0x2d')]=_[_0xe75e('0x2e')](_0x58c3c8[_0xe75e('0x2a')],_0x58c3c8[_0xe75e('0x2c')]);_0x261020['attributes']=_[_0xe75e('0x2e')](_0x58c3c8['model'],qs[_0xe75e('0x30')](_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x30')]));_0x261020['attributes']=_0x261020[_0xe75e('0x2f')][_0xe75e('0x31')]?_0x261020[_0xe75e('0x2f')]:_0x58c3c8[_0xe75e('0x2a')];_0x261020[_0xe75e('0x33')]=qs[_0xe75e('0x45')](_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x45')]);_0x261020[_0xe75e('0x34')]=qs[_0xe75e('0x2d')](_['pick'](_0x5a923f['query'],_0x58c3c8[_0xe75e('0x2d')]));if(_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x36')]){_0x261020[_0xe75e('0x34')]=_[_0xe75e('0x37')](_0x261020['where'],{'$or':_[_0xe75e('0x26')](_0x261020['attributes'],function(_0x268979){var _0x40c07d={};_0x40c07d[_0x268979]={'$like':'%'+_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x36')]+'%'};return _0x40c07d;})});}_0x261020=_[_0xe75e('0x37')]({},_0x261020,_0x5a923f[_0xe75e('0x39')]);return _0x3d828a[_0xe75e('0x44')](_0x261020);}})[_0xe75e('0x20')](function(_0x423d2b){if(_0x423d2b){_0x103c08=_0x423d2b[_0xe75e('0x31')];if(!_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x32')](_0xe75e('0x46'))){_0x261020[_0xe75e('0x19')]=qs[_0xe75e('0x19')](_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x19')]);_0x261020[_0xe75e('0x17')]=qs[_0xe75e('0x17')](_0x5a923f['query'][_0xe75e('0x17')]);}return _0x3d828a[_0xe75e('0x44')](_0x261020);}})[_0xe75e('0x20')](function(_0x5c5b8e){if(_0x5c5b8e){return _0x5c5b8e?{'count':_0x103c08,'rows':_0x5c5b8e}:null;}})[_0xe75e('0x20')](respondWithResult(_0x5b0f7b,null))[_0xe75e('0x3e')](handleError(_0x5b0f7b,null));};exports['getDescriptions']=function(_0x47af24,_0x2798dd,_0x499a77){var _0x222717={};var _0x3771bb={};var _0x1abe96;var _0xc42ed2;return db['FreshsalesConfiguration'][_0xe75e('0x47')]({'where':{'id':_0x47af24[_0xe75e('0x40')]['id']}})['then'](handleEntityNotFound(_0x2798dd,null))['then'](function(_0x291138){if(_0x291138){_0x1abe96=_0x291138;_0x3771bb[_0xe75e('0x2a')]=_[_0xe75e('0x2b')](db[_0xe75e('0x48')]['rawAttributes']);_0x3771bb[_0xe75e('0x2c')]=_[_0xe75e('0x2b')](_0x47af24[_0xe75e('0x2c')]);_0x3771bb[_0xe75e('0x2d')]=_[_0xe75e('0x2e')](_0x3771bb[_0xe75e('0x2a')],_0x3771bb[_0xe75e('0x2c')]);_0x222717[_0xe75e('0x2f')]=_[_0xe75e('0x2e')](_0x3771bb[_0xe75e('0x2a')],qs['fields'](_0x47af24['query'][_0xe75e('0x30')]));_0x222717[_0xe75e('0x2f')]=_0x222717[_0xe75e('0x2f')][_0xe75e('0x31')]?_0x222717[_0xe75e('0x2f')]:_0x3771bb['model'];_0x222717[_0xe75e('0x33')]=qs[_0xe75e('0x45')](_0x47af24[_0xe75e('0x2c')][_0xe75e('0x45')]);_0x222717['where']=qs['filters'](_['pick'](_0x47af24[_0xe75e('0x2c')],_0x3771bb[_0xe75e('0x2d')]));if(_0x47af24[_0xe75e('0x2c')][_0xe75e('0x36')]){_0x222717[_0xe75e('0x34')]=_[_0xe75e('0x37')](_0x222717[_0xe75e('0x34')],{'$or':_[_0xe75e('0x26')](_0x222717[_0xe75e('0x2f')],function(_0x6a21be){var _0xacc7ad={};_0xacc7ad[_0x6a21be]={'$like':'%'+_0x47af24[_0xe75e('0x2c')]['filter']+'%'};return _0xacc7ad;})});}_0x222717=_[_0xe75e('0x37')]({},_0x222717,_0x47af24[_0xe75e('0x39')]);return _0x1abe96[_0xe75e('0x49')](_0x222717);}})[_0xe75e('0x20')](function(_0x2fa086){if(_0x2fa086){_0xc42ed2=_0x2fa086[_0xe75e('0x31')];if(!_0x47af24[_0xe75e('0x2c')][_0xe75e('0x32')]('nolimit')){_0x222717['limit']=qs['limit'](_0x47af24[_0xe75e('0x2c')][_0xe75e('0x19')]);_0x222717['offset']=qs[_0xe75e('0x17')](_0x47af24[_0xe75e('0x2c')][_0xe75e('0x17')]);}return _0x1abe96[_0xe75e('0x49')](_0x222717);}})['then'](function(_0x2e1ee2){if(_0x2e1ee2){return _0x2e1ee2?{'count':_0xc42ed2,'rows':_0x2e1ee2}:null;}})[_0xe75e('0x20')](respondWithResult(_0x2798dd,null))[_0xe75e('0x3e')](handleError(_0x2798dd,null));};exports['getFields']=function(_0x33d010,_0x4259ac,_0x4f4e69){var _0x56c160={};var _0x3ea954={};var _0x65d115;var _0xe6f06b;return db['FreshsalesConfiguration'][_0xe75e('0x47')]({'where':{'id':_0x33d010[_0xe75e('0x40')]['id']}})[_0xe75e('0x20')](handleEntityNotFound(_0x4259ac,null))['then'](function(_0x6b9ecc){if(_0x6b9ecc){_0x65d115=_0x6b9ecc;_0x3ea954['model']=_[_0xe75e('0x2b')](db[_0xe75e('0x48')][_0xe75e('0x27')]);_0x3ea954[_0xe75e('0x2c')]=_[_0xe75e('0x2b')](_0x33d010['query']);_0x3ea954[_0xe75e('0x2d')]=_[_0xe75e('0x2e')](_0x3ea954[_0xe75e('0x2a')],_0x3ea954[_0xe75e('0x2c')]);_0x56c160[_0xe75e('0x2f')]=_[_0xe75e('0x2e')](_0x3ea954['model'],qs[_0xe75e('0x30')](_0x33d010[_0xe75e('0x2c')][_0xe75e('0x30')]));_0x56c160[_0xe75e('0x2f')]=_0x56c160[_0xe75e('0x2f')][_0xe75e('0x31')]?_0x56c160[_0xe75e('0x2f')]:_0x3ea954[_0xe75e('0x2a')];_0x56c160[_0xe75e('0x33')]=qs[_0xe75e('0x45')](_0x33d010[_0xe75e('0x2c')]['sort']);_0x56c160['where']=qs[_0xe75e('0x2d')](_[_0xe75e('0x35')](_0x33d010['query'],_0x3ea954[_0xe75e('0x2d')]));if(_0x33d010[_0xe75e('0x2c')][_0xe75e('0x36')]){_0x56c160[_0xe75e('0x34')]=_[_0xe75e('0x37')](_0x56c160['where'],{'$or':_['map'](_0x56c160[_0xe75e('0x2f')],function(_0x41e375){var _0x48bfcd={};_0x48bfcd[_0x41e375]={'$like':'%'+_0x33d010['query'][_0xe75e('0x36')]+'%'};return _0x48bfcd;})});}_0x56c160=_[_0xe75e('0x37')]({},_0x56c160,_0x33d010[_0xe75e('0x39')]);return _0x65d115[_0xe75e('0x4a')](_0x56c160);}})[_0xe75e('0x20')](function(_0x55b6b6){if(_0x55b6b6){_0xe6f06b=_0x55b6b6[_0xe75e('0x31')];if(!_0x33d010[_0xe75e('0x2c')][_0xe75e('0x32')](_0xe75e('0x46'))){_0x56c160[_0xe75e('0x19')]=qs[_0xe75e('0x19')](_0x33d010['query']['limit']);_0x56c160[_0xe75e('0x17')]=qs['offset'](_0x33d010[_0xe75e('0x2c')][_0xe75e('0x17')]);}return _0x65d115[_0xe75e('0x4a')](_0x56c160);}})[_0xe75e('0x20')](function(_0x449293){if(_0x449293){return _0x449293?{'count':_0xe6f06b,'rows':_0x449293}:null;}})['then'](respondWithResult(_0x4259ac,null))[_0xe75e('0x3e')](handleError(_0x4259ac,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 0b33e16..3efd633 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 _0x133b=['moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0x133b,0xcd));var _0xb133=function(_0xf989bb,_0xf66855){_0xf989bb=_0xf989bb-0x0;var _0xe97ff3=_0x133b[_0xf989bb];return _0xe97ff3;};'use strict';var _=require(_0xb133('0x0'));var util=require('util');var logger=require(_0xb133('0x1'))(_0xb133('0x2'));var moment=require(_0xb133('0x3'));var BPromise=require(_0xb133('0x4'));var rp=require(_0xb133('0x5'));var fs=require('fs');var path=require(_0xb133('0x6'));var rimraf=require('rimraf');var config=require(_0xb133('0x7'));var attributes=require(_0xb133('0x8'));module[_0xb133('0x9')]=function(_0x3ccb87,_0x18a072){return _0x3ccb87[_0xb133('0xa')](_0xb133('0xb'),attributes,{'tableName':_0xb133('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf312=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x12c56d,_0x1df8ae){var _0x5a32db=function(_0x1d90bf){while(--_0x1d90bf){_0x12c56d['push'](_0x12c56d['shift']());}};_0x5a32db(++_0x1df8ae);}(_0xf312,0x15c));var _0x2f31=function(_0x494408,_0x2ed5df){_0x494408=_0x494408-0x0;var _0x4d59b4=_0xf312[_0x494408];return _0x4d59b4;};'use strict';var _=require(_0x2f31('0x0'));var util=require(_0x2f31('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2f31('0x2'));var BPromise=require('bluebird');var rp=require(_0x2f31('0x3'));var fs=require('fs');var path=require(_0x2f31('0x4'));var rimraf=require(_0x2f31('0x5'));var config=require(_0x2f31('0x6'));var attributes=require(_0x2f31('0x7'));module[_0x2f31('0x8')]=function(_0x5a69fb,_0x4780b7){return _0x5a69fb[_0x2f31('0x9')](_0x2f31('0xa'),attributes,{'tableName':_0x2f31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 5c617ef..51b4727 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 _0xe1ed=['jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xe1ed,0x7b));var _0xde1e=function(_0x29b8c1,_0x20140f){_0x29b8c1=_0x29b8c1-0x0;var _0xda1c47=_0xe1ed[_0x29b8c1];return _0xda1c47;};'use strict';var _=require(_0xde1e('0x0'));var util=require(_0xde1e('0x1'));var moment=require('moment');var BPromise=require(_0xde1e('0x2'));var rs=require(_0xde1e('0x3'));var fs=require('fs');var Redis=require(_0xde1e('0x4'));var db=require(_0xde1e('0x5'))['db'];var utils=require(_0xde1e('0x6'));var logger=require(_0xde1e('0x7'))('rpc');var config=require(_0xde1e('0x8'));var jayson=require(_0xde1e('0x9'));var client=jayson[_0xde1e('0xa')][_0xde1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b9160,_0xd0e9d5,_0x113611){return new BPromise(function(_0x57f4f0,_0xab0971){return client[_0xde1e('0xc')](_0x1b9160,_0x113611)[_0xde1e('0xd')](function(_0x2342a1){logger[_0xde1e('0xe')](_0xde1e('0xf'),_0xd0e9d5,_0xde1e('0x10'));logger['debug'](_0xde1e('0x11'),_0xd0e9d5,_0xde1e('0x10'),JSON[_0xde1e('0x12')](_0x2342a1));if(_0x2342a1['error']){if(_0x2342a1[_0xde1e('0x13')][_0xde1e('0x14')]===0x1f4){logger[_0xde1e('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd0e9d5,_0x2342a1['error'][_0xde1e('0x15')]);return _0xab0971(_0x2342a1[_0xde1e('0x13')][_0xde1e('0x15')]);}logger[_0xde1e('0x13')](_0xde1e('0xf'),_0xd0e9d5,_0x2342a1['error']['message']);return _0x57f4f0(_0x2342a1[_0xde1e('0x13')][_0xde1e('0x15')]);}else{logger[_0xde1e('0xe')](_0xde1e('0xf'),_0xd0e9d5,'request\x20sent');_0x57f4f0(_0x2342a1['result'][_0xde1e('0x15')]);}})['catch'](function(_0x3295c9){logger[_0xde1e('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd0e9d5,_0x3295c9);_0xab0971(_0x3295c9);});});} \ No newline at end of file +var _0x95bb=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x2719cc,_0x2d0f25){var _0x32519a=function(_0x4c5345){while(--_0x4c5345){_0x2719cc['push'](_0x2719cc['shift']());}};_0x32519a(++_0x2d0f25);}(_0x95bb,0xc2));var _0xb95b=function(_0x1c779f,_0x25e56b){_0x1c779f=_0x1c779f-0x0;var _0x58c4b6=_0x95bb[_0x1c779f];return _0x58c4b6;};'use strict';var _=require(_0xb95b('0x0'));var util=require('util');var moment=require(_0xb95b('0x1'));var BPromise=require(_0xb95b('0x2'));var rs=require(_0xb95b('0x3'));var fs=require('fs');var Redis=require(_0xb95b('0x4'));var db=require(_0xb95b('0x5'))['db'];var utils=require(_0xb95b('0x6'));var logger=require('../../config/logger')(_0xb95b('0x7'));var config=require('../../config/environment');var jayson=require(_0xb95b('0x8'));var client=jayson[_0xb95b('0x9')][_0xb95b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32b07e,_0x2e89f1,_0x110555){return new BPromise(function(_0x57c176,_0x11cc4e){return client[_0xb95b('0xb')](_0x32b07e,_0x110555)[_0xb95b('0xc')](function(_0x4ff9aa){logger[_0xb95b('0xd')](_0xb95b('0xe'),_0x2e89f1,_0xb95b('0xf'));logger[_0xb95b('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2e89f1,'request\x20sent',JSON[_0xb95b('0x11')](_0x4ff9aa));if(_0x4ff9aa[_0xb95b('0x12')]){if(_0x4ff9aa[_0xb95b('0x12')]['code']===0x1f4){logger['error'](_0xb95b('0xe'),_0x2e89f1,_0x4ff9aa[_0xb95b('0x12')][_0xb95b('0x13')]);return _0x11cc4e(_0x4ff9aa['error'][_0xb95b('0x13')]);}logger[_0xb95b('0x12')](_0xb95b('0xe'),_0x2e89f1,_0x4ff9aa[_0xb95b('0x12')][_0xb95b('0x13')]);return _0x57c176(_0x4ff9aa[_0xb95b('0x12')][_0xb95b('0x13')]);}else{logger[_0xb95b('0xd')](_0xb95b('0xe'),_0x2e89f1,_0xb95b('0xf'));_0x57c176(_0x4ff9aa[_0xb95b('0x14')]['message']);}})[_0xb95b('0x15')](function(_0x2f6888){logger['error'](_0xb95b('0xe'),_0x2e89f1,_0x2f6888);_0x11cc4e(_0x2f6888);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 506493e..504fbfa 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 _0x44f8=['path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','put','update','exports','multer','util'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0x44f8,0x1de));var _0x844f=function(_0x1c3019,_0x181b03){_0x1c3019=_0x1c3019-0x0;var _0x58823f=_0x44f8[_0x1c3019];return _0x58823f;};'use strict';var multer=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var path=require(_0x844f('0x2'));var timeout=require(_0x844f('0x3'));var express=require(_0x844f('0x4'));var router=express[_0x844f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x844f('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x844f('0x7')](),controller[_0x844f('0x8')]);router[_0x844f('0x9')](_0x844f('0xa'),auth[_0x844f('0x7')](),controller[_0x844f('0xb')]);router[_0x844f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x844f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x844f('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x844f('0xf')]=router; \ No newline at end of file +var _0xa1e8=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer'];(function(_0x1941e2,_0x315032){var _0x337de1=function(_0x19bd92){while(--_0x19bd92){_0x1941e2['push'](_0x1941e2['shift']());}};_0x337de1(++_0x315032);}(_0xa1e8,0x1af));var _0x8a1e=function(_0x376f2d,_0x53f57d){_0x376f2d=_0x376f2d-0x0;var _0x44b918=_0xa1e8[_0x376f2d];return _0x44b918;};'use strict';var multer=require(_0x8a1e('0x0'));var util=require('util');var path=require(_0x8a1e('0x1'));var timeout=require(_0x8a1e('0x2'));var express=require(_0x8a1e('0x3'));var router=express['Router']();var fs_extra=require(_0x8a1e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8a1e('0x5'));var config=require(_0x8a1e('0x6'));var controller=require(_0x8a1e('0x7'));router[_0x8a1e('0x8')]('/',auth['isAuthenticated'](),controller[_0x8a1e('0x9')]);router[_0x8a1e('0x8')](_0x8a1e('0xa'),auth[_0x8a1e('0xb')](),controller['show']);router[_0x8a1e('0xc')]('/',auth[_0x8a1e('0xb')](),controller[_0x8a1e('0xd')]);router['put'](_0x8a1e('0xa'),auth['isAuthenticated'](),controller[_0x8a1e('0xe')]);router[_0x8a1e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8a1e('0x10')]);module[_0x8a1e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9eadbfe..c148339 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 _0x5bc2=['customVariable','picklist','STRING','variable','BOOLEAN','ENUM','string'];(function(_0x1a8cdf,_0x55b49a){var _0x5e5684=function(_0x556c4f){while(--_0x556c4f){_0x1a8cdf['push'](_0x1a8cdf['shift']());}};_0x5e5684(++_0x55b49a);}(_0x5bc2,0xd0));var _0x25bc=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x5bc2[_0x4bfade];return _0x272465;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x25bc('0x0')](_0x25bc('0x1'),'variable',_0x25bc('0x2'),'keyValue',_0x25bc('0x3')),'defaultValue':_0x25bc('0x1')},'content':{'type':Sequelize[_0x25bc('0x4')]},'key':{'type':Sequelize[_0x25bc('0x4')]},'keyType':{'type':Sequelize[_0x25bc('0x0')](_0x25bc('0x1'),_0x25bc('0x5'),_0x25bc('0x2'))},'keyContent':{'type':Sequelize[_0x25bc('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x25bc('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x25bc('0x4')]}}; \ No newline at end of file +var _0x5f8c=['STRING','BOOLEAN','exports','ENUM','string','variable','picklist'];(function(_0x239ccb,_0xddfdc5){var _0x3d3668=function(_0x5e6212){while(--_0x5e6212){_0x239ccb['push'](_0x239ccb['shift']());}};_0x3d3668(++_0xddfdc5);}(_0x5f8c,0x80));var _0xc5f8=function(_0x432169,_0x7ffbe9){_0x432169=_0x432169-0x0;var _0x28e745=_0x5f8c[_0x432169];return _0x28e745;};'use strict';var Sequelize=require('sequelize');module[_0xc5f8('0x0')]={'type':{'type':Sequelize[_0xc5f8('0x1')](_0xc5f8('0x2'),_0xc5f8('0x3'),'customVariable','keyValue',_0xc5f8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc5f8('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc5f8('0x1')](_0xc5f8('0x2'),_0xc5f8('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc5f8('0x5')]},'idField':{'type':Sequelize[_0xc5f8('0x5')]},'nameField':{'type':Sequelize[_0xc5f8('0x5')]},'customField':{'type':Sequelize[_0xc5f8('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc5f8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e7198c2..dede8c5 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 _0x7c7b=['mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','FreshsalesField','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','rawAttributes','include','find','catch','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x883e71,_0x2fe8ab){var _0xa723a6=function(_0x254df2){while(--_0x254df2){_0x883e71['push'](_0x883e71['shift']());}};_0xa723a6(++_0x2fe8ab);}(_0x7c7b,0x11b));var _0xb7c7=function(_0x14e5a9,_0x3c7232){_0x14e5a9=_0x14e5a9-0x0;var _0x3e7e87=_0x7c7b[_0x14e5a9];return _0x3e7e87;};'use strict';var emlformat=require(_0xb7c7('0x0'));var rimraf=require(_0xb7c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7c7('0x2'));var rp=require('request-promise');var moment=require(_0xb7c7('0x3'));var BPromise=require(_0xb7c7('0x4'));var Mustache=require(_0xb7c7('0x5'));var util=require(_0xb7c7('0x6'));var path=require(_0xb7c7('0x7'));var sox=require('sox');var csv=require(_0xb7c7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7c7('0x9'));var _=require(_0xb7c7('0xa'));var squel=require(_0xb7c7('0xb'));var crypto=require(_0xb7c7('0xc'));var jsforce=require(_0xb7c7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb7c7('0x8'));var querystring=require(_0xb7c7('0xe'));var Papa=require(_0xb7c7('0xf'));var Redis=require(_0xb7c7('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb7c7('0x11'));var hardwareService=require(_0xb7c7('0x12'));var logger=require(_0xb7c7('0x13'))(_0xb7c7('0x14'));var utils=require(_0xb7c7('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb7c7('0x16'))['db'];function respondWithStatusCode(_0x3d8582,_0x920fad){_0x920fad=_0x920fad||0xcc;return function(_0x49a167){if(_0x49a167){return _0x3d8582[_0xb7c7('0x17')](_0x920fad);}return _0x3d8582[_0xb7c7('0x18')](_0x920fad)[_0xb7c7('0x19')]();};}function respondWithResult(_0x394a1c,_0x68b6a){_0x68b6a=_0x68b6a||0xc8;return function(_0x2c44b6){if(_0x2c44b6){return _0x394a1c[_0xb7c7('0x18')](_0x68b6a)[_0xb7c7('0x1a')](_0x2c44b6);}};}function respondWithFilteredResult(_0x527a7d,_0x26e076){return function(_0x153ac4){if(_0x153ac4){var _0x3868ff=typeof _0x26e076['offset']===_0xb7c7('0x1b')&&typeof _0x26e076[_0xb7c7('0x1c')]===_0xb7c7('0x1b');var _0x4a6468=_0x153ac4[_0xb7c7('0x1d')];var _0x4ea265=_0x3868ff?0x0:_0x26e076[_0xb7c7('0x1e')];var _0x3f2e27=_0x3868ff?_0x153ac4[_0xb7c7('0x1d')]:_0x26e076[_0xb7c7('0x1e')]+_0x26e076[_0xb7c7('0x1c')];var _0x1fd871;if(_0x3f2e27>=_0x4a6468){_0x3f2e27=_0x4a6468;_0x1fd871=0xc8;}else{_0x1fd871=0xce;}_0x527a7d['status'](_0x1fd871);return _0x527a7d['set'](_0xb7c7('0x1f'),_0x4ea265+'-'+_0x3f2e27+'/'+_0x4a6468)[_0xb7c7('0x1a')](_0x153ac4);}return null;};}function patchUpdates(_0x2a808d){return function(_0x137d6a){try{jsonpatch[_0xb7c7('0x20')](_0x137d6a,_0x2a808d,!![]);}catch(_0x3b831b){return BPromise[_0xb7c7('0x21')](_0x3b831b);}return _0x137d6a['save']();};}function saveUpdates(_0x4cd220,_0x1db883){return function(_0x193fd0){if(_0x193fd0){return _0x193fd0[_0xb7c7('0x22')](_0x4cd220)[_0xb7c7('0x23')](function(_0x54efa9){return _0x54efa9;});}return null;};}function removeEntity(_0x44cf6f,_0x4ef899){return function(_0x1f1178){if(_0x1f1178){return _0x1f1178[_0xb7c7('0x24')]()[_0xb7c7('0x23')](function(){_0x44cf6f[_0xb7c7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24c506,_0x1854c5){return function(_0x20c593){if(!_0x20c593){_0x24c506['sendStatus'](0x194);}return _0x20c593;};}function handleError(_0x2d91eb,_0x28b4d2){_0x28b4d2=_0x28b4d2||0x1f4;return function(_0x2bdb1e){logger['error'](_0x2bdb1e[_0xb7c7('0x25')]);if(_0x2bdb1e['name']){delete _0x2bdb1e[_0xb7c7('0x26')];}_0x2d91eb['status'](_0x28b4d2)[_0xb7c7('0x27')](_0x2bdb1e);};}exports[_0xb7c7('0x28')]=function(_0x16e897,_0x31a406){var _0xfd87bb={},_0x3ef846={},_0x547b23={'count':0x0,'rows':[]};var _0x444cab=_[_0xb7c7('0x29')](db[_0xb7c7('0x2a')]['rawAttributes'],function(_0x33b566){return{'name':_0x33b566[_0xb7c7('0x2b')],'type':_0x33b566[_0xb7c7('0x2c')][_0xb7c7('0x2d')]};});_0x3ef846['model']=_[_0xb7c7('0x29')](_0x444cab,_0xb7c7('0x26'));_0x3ef846[_0xb7c7('0x2e')]=_['keys'](_0x16e897[_0xb7c7('0x2e')]);_0x3ef846[_0xb7c7('0x2f')]=_[_0xb7c7('0x30')](_0x3ef846[_0xb7c7('0x31')],_0x3ef846[_0xb7c7('0x2e')]);_0xfd87bb[_0xb7c7('0x32')]=_['intersection'](_0x3ef846[_0xb7c7('0x31')],qs[_0xb7c7('0x33')](_0x16e897[_0xb7c7('0x2e')][_0xb7c7('0x33')]));_0xfd87bb['attributes']=_0xfd87bb[_0xb7c7('0x32')][_0xb7c7('0x34')]?_0xfd87bb[_0xb7c7('0x32')]:_0x3ef846[_0xb7c7('0x31')];if(!_0x16e897[_0xb7c7('0x2e')][_0xb7c7('0x35')](_0xb7c7('0x36'))){_0xfd87bb[_0xb7c7('0x1c')]=qs[_0xb7c7('0x1c')](_0x16e897['query'][_0xb7c7('0x1c')]);_0xfd87bb[_0xb7c7('0x1e')]=qs[_0xb7c7('0x1e')](_0x16e897[_0xb7c7('0x2e')][_0xb7c7('0x1e')]);}_0xfd87bb['order']=qs[_0xb7c7('0x37')](_0x16e897[_0xb7c7('0x2e')][_0xb7c7('0x37')]);_0xfd87bb[_0xb7c7('0x38')]=qs[_0xb7c7('0x2f')](_['pick'](_0x16e897[_0xb7c7('0x2e')],_0x3ef846[_0xb7c7('0x2f')]),_0x444cab);if(_0x16e897['query'][_0xb7c7('0x39')]){_0xfd87bb[_0xb7c7('0x38')]=_[_0xb7c7('0x3a')](_0xfd87bb[_0xb7c7('0x38')],{'$or':_[_0xb7c7('0x29')](_0x444cab,function(_0x6f25fb){if(_0x6f25fb[_0xb7c7('0x2c')]!==_0xb7c7('0x3b')){var _0x233a62={};_0x233a62[_0x6f25fb[_0xb7c7('0x26')]]={'$like':'%'+_0x16e897['query'][_0xb7c7('0x39')]+'%'};return _0x233a62;}})});}_0xfd87bb=_[_0xb7c7('0x3a')]({},_0xfd87bb,_0x16e897[_0xb7c7('0x3c')]);var _0x1e5ed4={'where':_0xfd87bb[_0xb7c7('0x38')]};return db[_0xb7c7('0x2a')][_0xb7c7('0x1d')](_0x1e5ed4)['then'](function(_0x22e6d8){_0x547b23[_0xb7c7('0x1d')]=_0x22e6d8;if(_0x16e897[_0xb7c7('0x2e')][_0xb7c7('0x3d')]){_0xfd87bb['include']=[{'all':!![]}];}return db[_0xb7c7('0x2a')][_0xb7c7('0x3e')](_0xfd87bb);})['then'](function(_0x274f50){_0x547b23[_0xb7c7('0x3f')]=_0x274f50;return _0x547b23;})['then'](respondWithFilteredResult(_0x31a406,_0xfd87bb))['catch'](handleError(_0x31a406,null));};exports[_0xb7c7('0x40')]=function(_0x5798e0,_0xde217c){var _0x40bdc4={'raw':!![],'where':{'id':_0x5798e0['params']['id']}},_0x1d8d6c={};_0x1d8d6c[_0xb7c7('0x31')]=_[_0xb7c7('0x41')](db[_0xb7c7('0x2a')][_0xb7c7('0x42')]);_0x1d8d6c[_0xb7c7('0x2e')]=_[_0xb7c7('0x41')](_0x5798e0['query']);_0x1d8d6c[_0xb7c7('0x2f')]=_[_0xb7c7('0x30')](_0x1d8d6c[_0xb7c7('0x31')],_0x1d8d6c[_0xb7c7('0x2e')]);_0x40bdc4['attributes']=_[_0xb7c7('0x30')](_0x1d8d6c[_0xb7c7('0x31')],qs[_0xb7c7('0x33')](_0x5798e0[_0xb7c7('0x2e')]['fields']));_0x40bdc4[_0xb7c7('0x32')]=_0x40bdc4['attributes'][_0xb7c7('0x34')]?_0x40bdc4[_0xb7c7('0x32')]:_0x1d8d6c[_0xb7c7('0x31')];if(_0x5798e0['query'][_0xb7c7('0x3d')]){_0x40bdc4[_0xb7c7('0x43')]=[{'all':!![]}];}_0x40bdc4=_[_0xb7c7('0x3a')]({},_0x40bdc4,_0x5798e0['options']);return db[_0xb7c7('0x2a')][_0xb7c7('0x44')](_0x40bdc4)['then'](handleEntityNotFound(_0xde217c,null))[_0xb7c7('0x23')](respondWithResult(_0xde217c,null))[_0xb7c7('0x45')](handleError(_0xde217c,null));};exports['create']=function(_0x54a85f,_0x450529){return db[_0xb7c7('0x2a')]['create'](_0x54a85f[_0xb7c7('0x46')],{})[_0xb7c7('0x23')](respondWithResult(_0x450529,0xc9))[_0xb7c7('0x45')](handleError(_0x450529,null));};exports[_0xb7c7('0x22')]=function(_0x3bec92,_0x51a013){if(_0x3bec92[_0xb7c7('0x46')]['id']){delete _0x3bec92[_0xb7c7('0x46')]['id'];}return db['FreshsalesField'][_0xb7c7('0x44')]({'where':{'id':_0x3bec92['params']['id']}})[_0xb7c7('0x23')](handleEntityNotFound(_0x51a013,null))['then'](saveUpdates(_0x3bec92['body'],null))['then'](respondWithResult(_0x51a013,null))[_0xb7c7('0x45')](handleError(_0x51a013,null));};exports[_0xb7c7('0x24')]=function(_0x5c608a,_0xf56922){return db['FreshsalesField']['find']({'where':{'id':_0x5c608a[_0xb7c7('0x47')]['id']}})[_0xb7c7('0x23')](handleEntityNotFound(_0xf56922,null))[_0xb7c7('0x23')](removeEntity(_0xf56922,null))[_0xb7c7('0x45')](handleError(_0xf56922,null));}; \ No newline at end of file +var _0x75f8=['filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0xb70791,_0x1d91d6){var _0x48f939=function(_0x591c48){while(--_0x591c48){_0xb70791['push'](_0xb70791['shift']());}};_0x48f939(++_0x1d91d6);}(_0x75f8,0x1c2));var _0x875f=function(_0x3e23fd,_0x324cb8){_0x3e23fd=_0x3e23fd-0x0;var _0x23e70d=_0x75f8[_0x3e23fd];return _0x23e70d;};'use strict';var emlformat=require(_0x875f('0x0'));var rimraf=require(_0x875f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x875f('0x2'));var rp=require(_0x875f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x875f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x875f('0x5'));var csv=require(_0x875f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x875f('0x7'));var _=require(_0x875f('0x8'));var squel=require(_0x875f('0x9'));var crypto=require(_0x875f('0xa'));var jsforce=require(_0x875f('0xb'));var deskjs=require(_0x875f('0xc'));var toCsv=require(_0x875f('0x6'));var querystring=require('querystring');var Papa=require(_0x875f('0xd'));var Redis=require(_0x875f('0xe'));var authService=require(_0x875f('0xf'));var qs=require(_0x875f('0x10'));var as=require(_0x875f('0x11'));var hardwareService=require(_0x875f('0x12'));var logger=require('../../config/logger')(_0x875f('0x13'));var utils=require(_0x875f('0x14'));var config=require(_0x875f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x875f('0x16'))['db'];function respondWithStatusCode(_0x4b74b5,_0x529bc5){_0x529bc5=_0x529bc5||0xcc;return function(_0x3a4a20){if(_0x3a4a20){return _0x4b74b5[_0x875f('0x17')](_0x529bc5);}return _0x4b74b5[_0x875f('0x18')](_0x529bc5)[_0x875f('0x19')]();};}function respondWithResult(_0xd30829,_0x341acf){_0x341acf=_0x341acf||0xc8;return function(_0x1c96e8){if(_0x1c96e8){return _0xd30829[_0x875f('0x18')](_0x341acf)[_0x875f('0x1a')](_0x1c96e8);}};}function respondWithFilteredResult(_0x227019,_0x52c8b8){return function(_0x535f5e){if(_0x535f5e){var _0x1ce288=typeof _0x52c8b8[_0x875f('0x1b')]===_0x875f('0x1c')&&typeof _0x52c8b8[_0x875f('0x1d')]===_0x875f('0x1c');var _0x275db1=_0x535f5e[_0x875f('0x1e')];var _0x5dafbf=_0x1ce288?0x0:_0x52c8b8[_0x875f('0x1b')];var _0x4a2c7b=_0x1ce288?_0x535f5e['count']:_0x52c8b8[_0x875f('0x1b')]+_0x52c8b8['limit'];var _0x5c3c5f;if(_0x4a2c7b>=_0x275db1){_0x4a2c7b=_0x275db1;_0x5c3c5f=0xc8;}else{_0x5c3c5f=0xce;}_0x227019[_0x875f('0x18')](_0x5c3c5f);return _0x227019[_0x875f('0x1f')](_0x875f('0x20'),_0x5dafbf+'-'+_0x4a2c7b+'/'+_0x275db1)[_0x875f('0x1a')](_0x535f5e);}return null;};}function patchUpdates(_0x2e564a){return function(_0x14620a){try{jsonpatch[_0x875f('0x21')](_0x14620a,_0x2e564a,!![]);}catch(_0x45da69){return BPromise[_0x875f('0x22')](_0x45da69);}return _0x14620a[_0x875f('0x23')]();};}function saveUpdates(_0x1e7b83,_0x31b964){return function(_0x78c48c){if(_0x78c48c){return _0x78c48c[_0x875f('0x24')](_0x1e7b83)[_0x875f('0x25')](function(_0xb2678f){return _0xb2678f;});}return null;};}function removeEntity(_0x10620a,_0x14e609){return function(_0x200466){if(_0x200466){return _0x200466[_0x875f('0x26')]()[_0x875f('0x25')](function(){_0x10620a[_0x875f('0x18')](0xcc)[_0x875f('0x19')]();});}};}function handleEntityNotFound(_0x4547cd,_0x53b39c){return function(_0x490242){if(!_0x490242){_0x4547cd[_0x875f('0x17')](0x194);}return _0x490242;};}function handleError(_0x4b900d,_0x1a02f4){_0x1a02f4=_0x1a02f4||0x1f4;return function(_0x7e4f96){logger['error'](_0x7e4f96[_0x875f('0x27')]);if(_0x7e4f96['name']){delete _0x7e4f96[_0x875f('0x28')];}_0x4b900d[_0x875f('0x18')](_0x1a02f4)[_0x875f('0x29')](_0x7e4f96);};}exports['index']=function(_0x41d301,_0xd8635){var _0x339e66={},_0x24b3e6={},_0x5c942a={'count':0x0,'rows':[]};var _0x33708c=_['map'](db[_0x875f('0x2a')][_0x875f('0x2b')],function(_0x1e3378){return{'name':_0x1e3378[_0x875f('0x2c')],'type':_0x1e3378[_0x875f('0x2d')][_0x875f('0x2e')]};});_0x24b3e6[_0x875f('0x2f')]=_[_0x875f('0x30')](_0x33708c,_0x875f('0x28'));_0x24b3e6[_0x875f('0x31')]=_[_0x875f('0x32')](_0x41d301[_0x875f('0x31')]);_0x24b3e6[_0x875f('0x33')]=_[_0x875f('0x34')](_0x24b3e6[_0x875f('0x2f')],_0x24b3e6[_0x875f('0x31')]);_0x339e66[_0x875f('0x35')]=_[_0x875f('0x34')](_0x24b3e6[_0x875f('0x2f')],qs[_0x875f('0x36')](_0x41d301[_0x875f('0x31')][_0x875f('0x36')]));_0x339e66[_0x875f('0x35')]=_0x339e66[_0x875f('0x35')][_0x875f('0x37')]?_0x339e66[_0x875f('0x35')]:_0x24b3e6[_0x875f('0x2f')];if(!_0x41d301[_0x875f('0x31')][_0x875f('0x38')](_0x875f('0x39'))){_0x339e66[_0x875f('0x1d')]=qs['limit'](_0x41d301['query'][_0x875f('0x1d')]);_0x339e66[_0x875f('0x1b')]=qs[_0x875f('0x1b')](_0x41d301['query']['offset']);}_0x339e66['order']=qs['sort'](_0x41d301[_0x875f('0x31')][_0x875f('0x3a')]);_0x339e66[_0x875f('0x3b')]=qs[_0x875f('0x33')](_[_0x875f('0x3c')](_0x41d301[_0x875f('0x31')],_0x24b3e6[_0x875f('0x33')]),_0x33708c);if(_0x41d301[_0x875f('0x31')][_0x875f('0x3d')]){_0x339e66[_0x875f('0x3b')]=_['merge'](_0x339e66['where'],{'$or':_[_0x875f('0x30')](_0x33708c,function(_0x4e2bf9){if(_0x4e2bf9[_0x875f('0x2d')]!==_0x875f('0x3e')){var _0x2804da={};_0x2804da[_0x4e2bf9[_0x875f('0x28')]]={'$like':'%'+_0x41d301[_0x875f('0x31')][_0x875f('0x3d')]+'%'};return _0x2804da;}})});}_0x339e66=_[_0x875f('0x3f')]({},_0x339e66,_0x41d301[_0x875f('0x40')]);var _0x3aa10d={'where':_0x339e66[_0x875f('0x3b')]};return db[_0x875f('0x2a')][_0x875f('0x1e')](_0x3aa10d)[_0x875f('0x25')](function(_0x4af674){_0x5c942a[_0x875f('0x1e')]=_0x4af674;if(_0x41d301[_0x875f('0x31')][_0x875f('0x41')]){_0x339e66['include']=[{'all':!![]}];}return db[_0x875f('0x2a')][_0x875f('0x42')](_0x339e66);})[_0x875f('0x25')](function(_0x5023d3){_0x5c942a['rows']=_0x5023d3;return _0x5c942a;})['then'](respondWithFilteredResult(_0xd8635,_0x339e66))[_0x875f('0x43')](handleError(_0xd8635,null));};exports[_0x875f('0x44')]=function(_0x145af0,_0x563954){var _0x5534b9={'raw':!![],'where':{'id':_0x145af0[_0x875f('0x45')]['id']}},_0x3c40e4={};_0x3c40e4[_0x875f('0x2f')]=_['keys'](db[_0x875f('0x2a')][_0x875f('0x2b')]);_0x3c40e4[_0x875f('0x31')]=_['keys'](_0x145af0['query']);_0x3c40e4['filters']=_[_0x875f('0x34')](_0x3c40e4['model'],_0x3c40e4[_0x875f('0x31')]);_0x5534b9[_0x875f('0x35')]=_[_0x875f('0x34')](_0x3c40e4[_0x875f('0x2f')],qs['fields'](_0x145af0['query'][_0x875f('0x36')]));_0x5534b9[_0x875f('0x35')]=_0x5534b9['attributes'][_0x875f('0x37')]?_0x5534b9[_0x875f('0x35')]:_0x3c40e4[_0x875f('0x2f')];if(_0x145af0[_0x875f('0x31')]['includeAll']){_0x5534b9['include']=[{'all':!![]}];}_0x5534b9=_[_0x875f('0x3f')]({},_0x5534b9,_0x145af0[_0x875f('0x40')]);return db[_0x875f('0x2a')][_0x875f('0x46')](_0x5534b9)['then'](handleEntityNotFound(_0x563954,null))[_0x875f('0x25')](respondWithResult(_0x563954,null))[_0x875f('0x43')](handleError(_0x563954,null));};exports['create']=function(_0x3a44d0,_0x57fe13){return db[_0x875f('0x2a')][_0x875f('0x47')](_0x3a44d0[_0x875f('0x48')],{})['then'](respondWithResult(_0x57fe13,0xc9))[_0x875f('0x43')](handleError(_0x57fe13,null));};exports[_0x875f('0x24')]=function(_0x9ddf61,_0x488dc4){if(_0x9ddf61['body']['id']){delete _0x9ddf61[_0x875f('0x48')]['id'];}return db[_0x875f('0x2a')][_0x875f('0x46')]({'where':{'id':_0x9ddf61[_0x875f('0x45')]['id']}})[_0x875f('0x25')](handleEntityNotFound(_0x488dc4,null))[_0x875f('0x25')](saveUpdates(_0x9ddf61[_0x875f('0x48')],null))[_0x875f('0x25')](respondWithResult(_0x488dc4,null))[_0x875f('0x43')](handleError(_0x488dc4,null));};exports[_0x875f('0x26')]=function(_0x19ca71,_0x2dc71f){return db[_0x875f('0x2a')][_0x875f('0x46')]({'where':{'id':_0x19ca71[_0x875f('0x45')]['id']}})[_0x875f('0x25')](handleEntityNotFound(_0x2dc71f,null))['then'](removeEntity(_0x2dc71f,null))['catch'](handleError(_0x2dc71f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 30a32ef..bea4875 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 _0xba5a=['path','rimraf','../../config/environment','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util','../../config/logger','api','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xba5a,0x1d0));var _0xaba5=function(_0x43ed38,_0x507af1){_0x43ed38=_0x43ed38-0x0;var _0x181497=_0xba5a[_0x43ed38];return _0x181497;};'use strict';var _=require('lodash');var util=require(_0xaba5('0x0'));var logger=require(_0xaba5('0x1'))(_0xaba5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xaba5('0x3'));var fs=require('fs');var path=require(_0xaba5('0x4'));var rimraf=require(_0xaba5('0x5'));var config=require(_0xaba5('0x6'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x58b605,_0x35a186){return _0x58b605['define'](_0xaba5('0x7'),attributes,{'tableName':_0xaba5('0x8'),'paranoid':![],'indexes':[{'name':_0xaba5('0x9'),'fields':[_0xaba5('0xa'),_0xaba5('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10d=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x131160,_0x1dc2ca){var _0x10e3e2=function(_0x1bd0b2){while(--_0x1bd0b2){_0x131160['push'](_0x131160['shift']());}};_0x10e3e2(++_0x1dc2ca);}(_0xb10d,0x17f));var _0xdb10=function(_0x2fdeeb,_0xf0064f){_0x2fdeeb=_0x2fdeeb-0x0;var _0x1fc84d=_0xb10d[_0x2fdeeb];return _0x1fc84d;};'use strict';var _=require(_0xdb10('0x0'));var util=require('util');var logger=require(_0xdb10('0x1'))(_0xdb10('0x2'));var moment=require(_0xdb10('0x3'));var BPromise=require(_0xdb10('0x4'));var rp=require(_0xdb10('0x5'));var fs=require('fs');var path=require(_0xdb10('0x6'));var rimraf=require(_0xdb10('0x7'));var config=require(_0xdb10('0x8'));var attributes=require(_0xdb10('0x9'));module[_0xdb10('0xa')]=function(_0x348cff,_0x4d75f1){return _0x348cff[_0xdb10('0xb')](_0xdb10('0xc'),attributes,{'tableName':_0xdb10('0xd'),'paranoid':![],'indexes':[{'name':_0xdb10('0xe'),'fields':[_0xdb10('0xf'),_0xdb10('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 29afa69..a52aa04 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eb2=['request','then','info','request\x20sent','error','FreshsalesField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x56ff97,_0x3a0749){var _0x465c39=function(_0x4b1ab1){while(--_0x4b1ab1){_0x56ff97['push'](_0x56ff97['shift']());}};_0x465c39(++_0x3a0749);}(_0x2eb2,0x19f));var _0x22eb=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x2eb2[_0x12d033];return _0x3b4e80;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x687b,0x14a));var _0xb687=function(_0x2b1bb9,_0x3f85cc){_0x2b1bb9=_0x2b1bb9-0x0;var _0x59f401=_0x687b[_0x2b1bb9];return _0x59f401;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c5cc69f..38f584e 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(_0x45171f,_0x3d9457){var _0x3d0c0b=function(_0x59c310){while(--_0x59c310){_0x45171f['push'](_0x45171f['shift']());}};_0x3d0c0b(++_0x3d9457);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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(_0x17f7ed,_0x384ff9){var _0x333655=function(_0x4812f2){while(--_0x4812f2){_0x17f7ed['push'](_0x17f7ed['shift']());}};_0x333655(++_0x384ff9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index a6b0e20..17532f6 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 _0x838a=['newTab','STRING','username','integrationTab'];(function(_0x12a4ca,_0x33b9e5){var _0x19df6c=function(_0x2751d2){while(--_0x2751d2){_0x12a4ca['push'](_0x12a4ca['shift']());}};_0x19df6c(++_0x33b9e5);}(_0x838a,0x65));var _0xa838=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x838a[_0x393d69];return _0x3cee37;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa838('0x0')]},'description':{'type':Sequelize[_0xa838('0x0')]},'username':{'type':Sequelize[_0xa838('0x0')],'unique':_0xa838('0x1')},'remoteUri':{'type':Sequelize[_0xa838('0x0')]},'password':{'type':Sequelize[_0xa838('0x0')]},'clientId':{'type':Sequelize[_0xa838('0x0')]},'clientSecret':{'type':Sequelize[_0xa838('0x0')]},'securityToken':{'type':Sequelize[_0xa838('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa838('0x2'),_0xa838('0x3')),'defaultValue':_0xa838('0x2')}}; \ No newline at end of file +var _0x508a=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x1d4c12,_0x27c5d7){var _0x1c8c5f=function(_0x28fff6){while(--_0x28fff6){_0x1d4c12['push'](_0x1d4c12['shift']());}};_0x1c8c5f(++_0x27c5d7);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa508('0x0'));module['exports']={'name':{'type':Sequelize[_0xa508('0x1')]},'description':{'type':Sequelize[_0xa508('0x1')]},'username':{'type':Sequelize[_0xa508('0x1')],'unique':_0xa508('0x2')},'remoteUri':{'type':Sequelize[_0xa508('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa508('0x1')]},'clientSecret':{'type':Sequelize[_0xa508('0x1')]},'securityToken':{'type':Sequelize[_0xa508('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa508('0x3')](_0xa508('0x4'),_0xa508('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 64922f4..fdc683a 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 _0xf5ea=['SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','login','password','isNil','ticketType','sobject','describe','IsReminderSet','IsRecurrence','Description','string','int','picklist','boolean','textarea','phone','includes','custom','picklistValues','label','value','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','rawAttributes','includeAll','find','create','body','params','catch','getConfigurations','findOne','SalesforceConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions'];(function(_0x4f3ba6,_0x11635f){var _0x26101a=function(_0xd0bd69){while(--_0xd0bd69){_0x4f3ba6['push'](_0x4f3ba6['shift']());}};_0x26101a(++_0x11635f);}(_0xf5ea,0x189));var _0xaf5e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xf5ea[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xaf5e('0x0'));var rimraf=require(_0xaf5e('0x1'));var zipdir=require(_0xaf5e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf5e('0x3'));var moment=require('moment');var BPromise=require(_0xaf5e('0x4'));var Mustache=require(_0xaf5e('0x5'));var util=require('util');var path=require(_0xaf5e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf5e('0x7'));var _=require(_0xaf5e('0x8'));var squel=require(_0xaf5e('0x9'));var crypto=require('crypto');var jsforce=require(_0xaf5e('0xa'));var deskjs=require(_0xaf5e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xaf5e('0xc'));var Papa=require(_0xaf5e('0xd'));var Redis=require(_0xaf5e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaf5e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf5e('0x10'))('api');var utils=require(_0xaf5e('0x11'));var config=require(_0xaf5e('0x12'));var licenseUtil=require(_0xaf5e('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xaf5e('0x14'));function respondWithStatusCode(_0x1bf46e,_0x2d6097){_0x2d6097=_0x2d6097||0xcc;return function(_0x2c1c7f){if(_0x2c1c7f){return _0x1bf46e[_0xaf5e('0x15')](_0x2d6097);}return _0x1bf46e[_0xaf5e('0x16')](_0x2d6097)[_0xaf5e('0x17')]();};}function respondWithResult(_0x364db5,_0x2962ca){_0x2962ca=_0x2962ca||0xc8;return function(_0x572689){if(_0x572689){return _0x364db5[_0xaf5e('0x16')](_0x2962ca)[_0xaf5e('0x18')](_0x572689);}};}function respondWithFilteredResult(_0x21f4b9,_0x226715){return function(_0x464601){if(_0x464601){var _0x66cb7f=typeof _0x226715[_0xaf5e('0x19')]==='undefined'&&typeof _0x226715[_0xaf5e('0x1a')]===_0xaf5e('0x1b');var _0x2c4756=_0x464601[_0xaf5e('0x1c')];var _0x55d234=_0x66cb7f?0x0:_0x226715[_0xaf5e('0x19')];var _0x2eb7e9=_0x66cb7f?_0x464601[_0xaf5e('0x1c')]:_0x226715[_0xaf5e('0x19')]+_0x226715['limit'];var _0x314ae9;if(_0x2eb7e9>=_0x2c4756){_0x2eb7e9=_0x2c4756;_0x314ae9=0xc8;}else{_0x314ae9=0xce;}_0x21f4b9[_0xaf5e('0x16')](_0x314ae9);return _0x21f4b9[_0xaf5e('0x1d')](_0xaf5e('0x1e'),_0x55d234+'-'+_0x2eb7e9+'/'+_0x2c4756)['json'](_0x464601);}return null;};}function patchUpdates(_0x4f6231){return function(_0x2dda18){try{jsonpatch['apply'](_0x2dda18,_0x4f6231,!![]);}catch(_0xca4207){return BPromise[_0xaf5e('0x1f')](_0xca4207);}return _0x2dda18[_0xaf5e('0x20')]();};}function saveUpdates(_0x5980d7,_0x4aaf48){return function(_0x3456bf){if(_0x3456bf){return _0x3456bf[_0xaf5e('0x21')](_0x5980d7)[_0xaf5e('0x22')](function(_0x497064){return _0x497064;});}return null;};}function removeEntity(_0x3ba585,_0x516675){return function(_0x532ac8){if(_0x532ac8){return _0x532ac8[_0xaf5e('0x23')]()['then'](function(){_0x3ba585[_0xaf5e('0x16')](0xcc)[_0xaf5e('0x17')]();});}};}function handleEntityNotFound(_0x132641,_0x39b8b1){return function(_0x372951){if(!_0x372951){_0x132641[_0xaf5e('0x15')](0x194);}return _0x372951;};}function handleError(_0x3c07eb,_0x4258aa){_0x4258aa=_0x4258aa||0x1f4;return function(_0x24235a){logger[_0xaf5e('0x24')](_0x24235a[_0xaf5e('0x25')]);if(_0x24235a[_0xaf5e('0x26')]){delete _0x24235a[_0xaf5e('0x26')];}_0x3c07eb[_0xaf5e('0x16')](_0x4258aa)[_0xaf5e('0x27')](_0x24235a);};}exports[_0xaf5e('0x28')]=function(_0x45933d,_0x57cd2a){var _0x5b1ba2={},_0x5addb5={},_0x58b3e2={'count':0x0,'rows':[]};var _0x23e550=_[_0xaf5e('0x29')](db[_0xaf5e('0x2a')]['rawAttributes'],function(_0x499d9f){return{'name':_0x499d9f[_0xaf5e('0x2b')],'type':_0x499d9f[_0xaf5e('0x2c')][_0xaf5e('0x2d')]};});_0x5addb5[_0xaf5e('0x2e')]=_['map'](_0x23e550,'name');_0x5addb5['query']=_[_0xaf5e('0x2f')](_0x45933d[_0xaf5e('0x30')]);_0x5addb5[_0xaf5e('0x31')]=_[_0xaf5e('0x32')](_0x5addb5['model'],_0x5addb5['query']);_0x5b1ba2[_0xaf5e('0x33')]=_[_0xaf5e('0x32')](_0x5addb5[_0xaf5e('0x2e')],qs[_0xaf5e('0x34')](_0x45933d[_0xaf5e('0x30')][_0xaf5e('0x34')]));_0x5b1ba2[_0xaf5e('0x33')]=_0x5b1ba2[_0xaf5e('0x33')][_0xaf5e('0x35')]?_0x5b1ba2[_0xaf5e('0x33')]:_0x5addb5[_0xaf5e('0x2e')];if(!_0x45933d[_0xaf5e('0x30')][_0xaf5e('0x36')](_0xaf5e('0x37'))){_0x5b1ba2['limit']=qs['limit'](_0x45933d['query'][_0xaf5e('0x1a')]);_0x5b1ba2[_0xaf5e('0x19')]=qs[_0xaf5e('0x19')](_0x45933d['query'][_0xaf5e('0x19')]);}_0x5b1ba2[_0xaf5e('0x38')]=qs[_0xaf5e('0x39')](_0x45933d[_0xaf5e('0x30')][_0xaf5e('0x39')]);_0x5b1ba2[_0xaf5e('0x3a')]=qs[_0xaf5e('0x31')](_[_0xaf5e('0x3b')](_0x45933d[_0xaf5e('0x30')],_0x5addb5[_0xaf5e('0x31')]),_0x23e550);if(_0x45933d['query']['filter']){_0x5b1ba2[_0xaf5e('0x3a')]=_[_0xaf5e('0x3c')](_0x5b1ba2['where'],{'$or':_[_0xaf5e('0x29')](_0x23e550,function(_0x4aece3){if(_0x4aece3[_0xaf5e('0x2c')]!==_0xaf5e('0x3d')){var _0x392f5e={};_0x392f5e[_0x4aece3[_0xaf5e('0x26')]]={'$like':'%'+_0x45933d[_0xaf5e('0x30')][_0xaf5e('0x3e')]+'%'};return _0x392f5e;}})});}_0x5b1ba2=_[_0xaf5e('0x3c')]({},_0x5b1ba2,_0x45933d[_0xaf5e('0x3f')]);var _0x1ee043={'where':_0x5b1ba2['where']};return db['SalesforceAccount']['count'](_0x1ee043)[_0xaf5e('0x22')](function(_0x3b631a){_0x58b3e2[_0xaf5e('0x1c')]=_0x3b631a;if(_0x45933d[_0xaf5e('0x30')]['includeAll']){_0x5b1ba2[_0xaf5e('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xaf5e('0x41')](_0x5b1ba2);})['then'](function(_0x5122d5){_0x58b3e2[_0xaf5e('0x42')]=_0x5122d5;return _0x58b3e2;})['then'](respondWithFilteredResult(_0x57cd2a,_0x5b1ba2))['catch'](handleError(_0x57cd2a,null));};exports[_0xaf5e('0x43')]=function(_0x4a9adb,_0x3d03e4){var _0x45ea00={'raw':![],'where':{'id':_0x4a9adb['params']['id']}},_0x1ab3b3={};_0x1ab3b3[_0xaf5e('0x2e')]=_[_0xaf5e('0x2f')](db[_0xaf5e('0x2a')][_0xaf5e('0x44')]);_0x1ab3b3[_0xaf5e('0x30')]=_[_0xaf5e('0x2f')](_0x4a9adb[_0xaf5e('0x30')]);_0x1ab3b3[_0xaf5e('0x31')]=_['intersection'](_0x1ab3b3[_0xaf5e('0x2e')],_0x1ab3b3[_0xaf5e('0x30')]);_0x45ea00[_0xaf5e('0x33')]=_[_0xaf5e('0x32')](_0x1ab3b3[_0xaf5e('0x2e')],qs[_0xaf5e('0x34')](_0x4a9adb[_0xaf5e('0x30')][_0xaf5e('0x34')]));_0x45ea00['attributes']=_0x45ea00[_0xaf5e('0x33')][_0xaf5e('0x35')]?_0x45ea00['attributes']:_0x1ab3b3[_0xaf5e('0x2e')];if(_0x4a9adb[_0xaf5e('0x30')][_0xaf5e('0x45')]){_0x45ea00['include']=[{'all':!![]}];}_0x45ea00=_[_0xaf5e('0x3c')]({},_0x45ea00,_0x4a9adb[_0xaf5e('0x3f')]);return db[_0xaf5e('0x2a')][_0xaf5e('0x46')](_0x45ea00)[_0xaf5e('0x22')](handleEntityNotFound(_0x3d03e4,null))['then'](respondWithResult(_0x3d03e4,null))['catch'](handleError(_0x3d03e4,null));};exports[_0xaf5e('0x47')]=function(_0x1689e7,_0x59689a){return db[_0xaf5e('0x2a')][_0xaf5e('0x47')](_0x1689e7[_0xaf5e('0x48')],{})['then'](respondWithResult(_0x59689a,0xc9))['catch'](handleError(_0x59689a,null));};exports[_0xaf5e('0x21')]=function(_0x304817,_0x42ade7){if(_0x304817[_0xaf5e('0x48')]['id']){delete _0x304817[_0xaf5e('0x48')]['id'];}return db[_0xaf5e('0x2a')][_0xaf5e('0x46')]({'where':{'id':_0x304817[_0xaf5e('0x49')]['id']}})['then'](handleEntityNotFound(_0x42ade7,null))[_0xaf5e('0x22')](saveUpdates(_0x304817['body'],null))['then'](respondWithResult(_0x42ade7,null))[_0xaf5e('0x4a')](handleError(_0x42ade7,null));};exports[_0xaf5e('0x23')]=function(_0x2ec83c,_0x34a0ec){return db['SalesforceAccount'][_0xaf5e('0x46')]({'where':{'id':_0x2ec83c[_0xaf5e('0x49')]['id']}})['then'](handleEntityNotFound(_0x34a0ec,null))[_0xaf5e('0x22')](removeEntity(_0x34a0ec,null))[_0xaf5e('0x4a')](handleError(_0x34a0ec,null));};exports[_0xaf5e('0x4b')]=function(_0x400b89,_0x57013d,_0x31865e){var _0x2c8cb9={};var _0x4d055c={};var _0x5490cf;var _0x41c880;return db['SalesforceAccount'][_0xaf5e('0x4c')]({'where':{'id':_0x400b89[_0xaf5e('0x49')]['id']}})[_0xaf5e('0x22')](handleEntityNotFound(_0x57013d,null))[_0xaf5e('0x22')](function(_0xbb6fda){if(_0xbb6fda){_0x5490cf=_0xbb6fda;_0x4d055c['model']=_[_0xaf5e('0x2f')](db[_0xaf5e('0x4d')][_0xaf5e('0x44')]);_0x4d055c[_0xaf5e('0x30')]=_['keys'](_0x400b89[_0xaf5e('0x30')]);_0x4d055c['filters']=_['intersection'](_0x4d055c[_0xaf5e('0x2e')],_0x4d055c[_0xaf5e('0x30')]);_0x2c8cb9[_0xaf5e('0x33')]=_[_0xaf5e('0x32')](_0x4d055c['model'],qs[_0xaf5e('0x34')](_0x400b89[_0xaf5e('0x30')]['fields']));_0x2c8cb9[_0xaf5e('0x33')]=_0x2c8cb9[_0xaf5e('0x33')][_0xaf5e('0x35')]?_0x2c8cb9[_0xaf5e('0x33')]:_0x4d055c['model'];_0x2c8cb9[_0xaf5e('0x38')]=qs['sort'](_0x400b89['query'][_0xaf5e('0x39')]);_0x2c8cb9[_0xaf5e('0x3a')]=qs[_0xaf5e('0x31')](_[_0xaf5e('0x3b')](_0x400b89[_0xaf5e('0x30')],_0x4d055c[_0xaf5e('0x31')]));if(_0x400b89['query']['filter']){_0x2c8cb9[_0xaf5e('0x3a')]=_[_0xaf5e('0x3c')](_0x2c8cb9[_0xaf5e('0x3a')],{'$or':_['map'](_0x2c8cb9[_0xaf5e('0x33')],function(_0x165ac3){var _0x4513f8={};_0x4513f8[_0x165ac3]={'$like':'%'+_0x400b89[_0xaf5e('0x30')][_0xaf5e('0x3e')]+'%'};return _0x4513f8;})});}_0x2c8cb9=_[_0xaf5e('0x3c')]({},_0x2c8cb9,_0x400b89[_0xaf5e('0x3f')]);return _0x5490cf[_0xaf5e('0x4b')](_0x2c8cb9);}})['then'](function(_0x42dab2){if(_0x42dab2){_0x41c880=_0x42dab2[_0xaf5e('0x35')];if(!_0x400b89[_0xaf5e('0x30')]['hasOwnProperty'](_0xaf5e('0x37'))){_0x2c8cb9[_0xaf5e('0x1a')]=qs[_0xaf5e('0x1a')](_0x400b89[_0xaf5e('0x30')][_0xaf5e('0x1a')]);_0x2c8cb9[_0xaf5e('0x19')]=qs['offset'](_0x400b89[_0xaf5e('0x30')][_0xaf5e('0x19')]);}return _0x5490cf[_0xaf5e('0x4b')](_0x2c8cb9);}})[_0xaf5e('0x22')](function(_0xf6fe8b){if(_0xf6fe8b){return _0xf6fe8b?{'count':_0x41c880,'rows':_0xf6fe8b}:null;}})[_0xaf5e('0x22')](respondWithResult(_0x57013d,null))[_0xaf5e('0x4a')](handleError(_0x57013d,null));};exports['addConfiguration']=function(_0x55cbb4,_0x456121,_0xcf19c1){if(_0x55cbb4[_0xaf5e('0x48')]['id']){delete _0x55cbb4[_0xaf5e('0x48')]['id'];}return db[_0xaf5e('0x2a')][_0xaf5e('0x4c')]({'where':{'id':_0x55cbb4[_0xaf5e('0x49')]['id']}})[_0xaf5e('0x22')](handleEntityNotFound(_0x456121,null))['then'](function(_0x2321e1){if(_0x2321e1){_0x55cbb4[_0xaf5e('0x48')][_0xaf5e('0x4e')]=_0x2321e1['id'];_0x55cbb4[_0xaf5e('0x48')][_0xaf5e('0x4f')]=integrations['getSubjects'](_0x55cbb4[_0xaf5e('0x48')][_0xaf5e('0x50')],_0x55cbb4[_0xaf5e('0x48')][_0xaf5e('0x2c')]);_0x55cbb4[_0xaf5e('0x48')][_0xaf5e('0x51')]=integrations[_0xaf5e('0x52')](_0x55cbb4['body'][_0xaf5e('0x50')],_0x55cbb4[_0xaf5e('0x48')][_0xaf5e('0x2c')]);return db['SalesforceConfiguration'][_0xaf5e('0x47')](_0x55cbb4['body'],{'include':[{'model':db[_0xaf5e('0x53')],'as':_0xaf5e('0x4f')},{'model':db[_0xaf5e('0x53')],'as':_0xaf5e('0x51')}]});}return null;})['then'](respondWithResult(_0x456121,null))[_0xaf5e('0x4a')](handleError(_0x456121,null));};exports[_0xaf5e('0x54')]=function(_0x4e9cc7,_0x3fc3b2,_0x284e75){var _0x3271a5;var _0x50f3ba='';var _0x2ad854=_0xaf5e('0x55');return db[_0xaf5e('0x2a')][_0xaf5e('0x4c')]({'where':{'id':_0x4e9cc7[_0xaf5e('0x49')]['id']},'attributes':['id',_0xaf5e('0x56'),_0xaf5e('0x57'),_0xaf5e('0x58'),_0xaf5e('0x59'),'password',_0xaf5e('0x5a')]})['then'](handleEntityNotFound(_0x3fc3b2,null))[_0xaf5e('0x22')](function(_0x19d632){if(_0x19d632){_0x50f3ba=_0x19d632[_0xaf5e('0x56')];var _0x3a623e=_0x50f3ba[_0xaf5e('0x5b')](-0x1);if(_0x3a623e==='/'){_0x50f3ba=_0x50f3ba['substring'](0x0,_0x50f3ba['lastIndexOf'](_0x3a623e));}_0x3271a5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x50f3ba,'clientId':_0x19d632[_0xaf5e('0x57')],'clientSecret':_0x19d632[_0xaf5e('0x58')]}});return _0x3271a5[_0xaf5e('0x5c')](_0x19d632['username'],_0x19d632[_0xaf5e('0x5d')]['concat'](_0x19d632[_0xaf5e('0x5a')]));}})[_0xaf5e('0x22')](function(_0x49dcac){if(_0x49dcac){if(!_[_0xaf5e('0x5e')](_0x4e9cc7['query'][_0xaf5e('0x5f')])){_0x2ad854=_0x4e9cc7[_0xaf5e('0x30')][_0xaf5e('0x5f')];}return _0x3271a5[_0xaf5e('0x60')](_0x2ad854)[_0xaf5e('0x61')]();}})[_0xaf5e('0x22')](function(_0x382187){var _0x18aa92=['OwnerId','ActivityDate',_0xaf5e('0x62'),_0xaf5e('0x63'),'Subject',_0xaf5e('0x64')];var _0x824c50=[_0xaf5e('0x65'),_0xaf5e('0x66'),_0xaf5e('0x67'),_0xaf5e('0x68'),'email',_0xaf5e('0x69'),_0xaf5e('0x6a')];if(_0x382187){_['remove'](_0x382187[_0xaf5e('0x34')],function(_0xb26798){return _0x18aa92['includes'](_0xb26798[_0xaf5e('0x26')])||!_0x824c50[_0xaf5e('0x6b')](_0xb26798[_0xaf5e('0x2c')]);});return{'count':_0x382187[_0xaf5e('0x34')]['length'],'rows':_[_0xaf5e('0x29')](_0x382187[_0xaf5e('0x34')],function(_0x47dafa){return{'id':_0x47dafa[_0xaf5e('0x26')],'name':_0x47dafa['label'],'custom':_0x47dafa[_0xaf5e('0x6c')],'options':_0x47dafa[_0xaf5e('0x6d')][_0xaf5e('0x35')]>0x0?_['map'](_0x47dafa[_0xaf5e('0x6d')],function(_0x163ac6){return{'name':_0x163ac6[_0xaf5e('0x6e')],'value':_0x163ac6[_0xaf5e('0x6f')]};}):_0x47dafa[_0xaf5e('0x2c')]==_0xaf5e('0x68')?[{'name':_0xaf5e('0x70'),'value':_0xaf5e('0x71')},{'name':_0xaf5e('0x72'),'value':'false'}]:[]};})};}})[_0xaf5e('0x22')](respondWithResult(_0x3fc3b2,null))['catch'](function(_0x291edb){var _0x1102e1=_0x4e9cc7[_0xaf5e('0x30')][_0xaf5e('0x73')]?0x1f4:_0x291edb['statusCode']||0x1f4;logger[_0xaf5e('0x24')](_0xaf5e('0x74'),_0xaf5e('0x54'),_0x1102e1,JSON[_0xaf5e('0x75')](_0x291edb));delete _0x291edb[_0xaf5e('0x26')];if(_0x1102e1===0x191){_0x1102e1=0x190;}_0x3fc3b2[_0xaf5e('0x16')](_0x1102e1)['send'](_0x4e9cc7[_0xaf5e('0x30')][_0xaf5e('0x73')]?{'message':_0xaf5e('0x76'),'statusCode':_0x291edb['statusCode']}:_0x291edb);});}; \ No newline at end of file +var _0x42ef=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','SalesforceAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','create','body','find','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','SalesforceField','Subjects','Task','clientId','clientSecret','username','password','securityToken','remoteUri','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','ActivityDate','IsReminderSet','Subject','Description','string','email','phone','remove','includes','picklistValues','boolean','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x29bfa2,_0x45368c){var _0x5ef78d=function(_0x390933){while(--_0x390933){_0x29bfa2['push'](_0x29bfa2['shift']());}};_0x5ef78d(++_0x45368c);}(_0x42ef,0x1ce));var _0xf42e=function(_0x1f1573,_0x3e23ea){_0x1f1573=_0x1f1573-0x0;var _0x22b817=_0x42ef[_0x1f1573];return _0x22b817;};'use strict';var emlformat=require(_0xf42e('0x0'));var rimraf=require(_0xf42e('0x1'));var zipdir=require(_0xf42e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf42e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf42e('0x4'));var util=require(_0xf42e('0x5'));var path=require('path');var sox=require(_0xf42e('0x6'));var csv=require(_0xf42e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf42e('0x8'));var _=require(_0xf42e('0x9'));var squel=require(_0xf42e('0xa'));var crypto=require(_0xf42e('0xb'));var jsforce=require(_0xf42e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf42e('0x7'));var querystring=require(_0xf42e('0xd'));var Papa=require(_0xf42e('0xe'));var Redis=require('ioredis');var authService=require(_0xf42e('0xf'));var qs=require(_0xf42e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf42e('0x11'));var logger=require('../../config/logger')(_0xf42e('0x12'));var utils=require(_0xf42e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf42e('0x14'));var db=require(_0xf42e('0x15'))['db'];var integrations=require(_0xf42e('0x16'));function respondWithStatusCode(_0x5eb502,_0xd1bad){_0xd1bad=_0xd1bad||0xcc;return function(_0x29d8ff){if(_0x29d8ff){return _0x5eb502[_0xf42e('0x17')](_0xd1bad);}return _0x5eb502[_0xf42e('0x18')](_0xd1bad)[_0xf42e('0x19')]();};}function respondWithResult(_0x3ee590,_0x56ad97){_0x56ad97=_0x56ad97||0xc8;return function(_0x2bb535){if(_0x2bb535){return _0x3ee590[_0xf42e('0x18')](_0x56ad97)['json'](_0x2bb535);}};}function respondWithFilteredResult(_0xc9b19d,_0x2c670c){return function(_0xd95991){if(_0xd95991){var _0x1cf1cb=typeof _0x2c670c['offset']==='undefined'&&typeof _0x2c670c[_0xf42e('0x1a')]===_0xf42e('0x1b');var _0x20d2d7=_0xd95991[_0xf42e('0x1c')];var _0x1fbf47=_0x1cf1cb?0x0:_0x2c670c[_0xf42e('0x1d')];var _0x1df284=_0x1cf1cb?_0xd95991[_0xf42e('0x1c')]:_0x2c670c['offset']+_0x2c670c[_0xf42e('0x1a')];var _0x3b0919;if(_0x1df284>=_0x20d2d7){_0x1df284=_0x20d2d7;_0x3b0919=0xc8;}else{_0x3b0919=0xce;}_0xc9b19d['status'](_0x3b0919);return _0xc9b19d[_0xf42e('0x1e')](_0xf42e('0x1f'),_0x1fbf47+'-'+_0x1df284+'/'+_0x20d2d7)[_0xf42e('0x20')](_0xd95991);}return null;};}function patchUpdates(_0x59adb0){return function(_0x224f2a){try{jsonpatch[_0xf42e('0x21')](_0x224f2a,_0x59adb0,!![]);}catch(_0xacc127){return BPromise[_0xf42e('0x22')](_0xacc127);}return _0x224f2a[_0xf42e('0x23')]();};}function saveUpdates(_0x3c10ec,_0x23a9b7){return function(_0x1d6fac){if(_0x1d6fac){return _0x1d6fac[_0xf42e('0x24')](_0x3c10ec)[_0xf42e('0x25')](function(_0x34902c){return _0x34902c;});}return null;};}function removeEntity(_0x570668,_0x24f80b){return function(_0x4644ed){if(_0x4644ed){return _0x4644ed[_0xf42e('0x26')]()[_0xf42e('0x25')](function(){_0x570668[_0xf42e('0x18')](0xcc)[_0xf42e('0x19')]();});}};}function handleEntityNotFound(_0x5d087a,_0x5af824){return function(_0x57dc3d){if(!_0x57dc3d){_0x5d087a[_0xf42e('0x17')](0x194);}return _0x57dc3d;};}function handleError(_0x20dfc7,_0x8b33c8){_0x8b33c8=_0x8b33c8||0x1f4;return function(_0x139bec){logger['error'](_0x139bec[_0xf42e('0x27')]);if(_0x139bec['name']){delete _0x139bec[_0xf42e('0x28')];}_0x20dfc7[_0xf42e('0x18')](_0x8b33c8)['send'](_0x139bec);};}exports[_0xf42e('0x29')]=function(_0x1d07ec,_0x247102){var _0x4d5896={},_0x555196={},_0x16bdda={'count':0x0,'rows':[]};var _0x4dfb33=_[_0xf42e('0x2a')](db[_0xf42e('0x2b')][_0xf42e('0x2c')],function(_0x18d6af){return{'name':_0x18d6af['fieldName'],'type':_0x18d6af['type'][_0xf42e('0x2d')]};});_0x555196[_0xf42e('0x2e')]=_['map'](_0x4dfb33,_0xf42e('0x28'));_0x555196[_0xf42e('0x2f')]=_[_0xf42e('0x30')](_0x1d07ec[_0xf42e('0x2f')]);_0x555196[_0xf42e('0x31')]=_[_0xf42e('0x32')](_0x555196[_0xf42e('0x2e')],_0x555196[_0xf42e('0x2f')]);_0x4d5896[_0xf42e('0x33')]=_[_0xf42e('0x32')](_0x555196[_0xf42e('0x2e')],qs[_0xf42e('0x34')](_0x1d07ec[_0xf42e('0x2f')]['fields']));_0x4d5896['attributes']=_0x4d5896['attributes'][_0xf42e('0x35')]?_0x4d5896[_0xf42e('0x33')]:_0x555196[_0xf42e('0x2e')];if(!_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x36')](_0xf42e('0x37'))){_0x4d5896['limit']=qs['limit'](_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x1a')]);_0x4d5896[_0xf42e('0x1d')]=qs[_0xf42e('0x1d')](_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x1d')]);}_0x4d5896[_0xf42e('0x38')]=qs[_0xf42e('0x39')](_0x1d07ec['query'][_0xf42e('0x39')]);_0x4d5896[_0xf42e('0x3a')]=qs['filters'](_[_0xf42e('0x3b')](_0x1d07ec[_0xf42e('0x2f')],_0x555196[_0xf42e('0x31')]),_0x4dfb33);if(_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x3c')]){_0x4d5896[_0xf42e('0x3a')]=_['merge'](_0x4d5896[_0xf42e('0x3a')],{'$or':_[_0xf42e('0x2a')](_0x4dfb33,function(_0x17ecb7){if(_0x17ecb7[_0xf42e('0x3d')]!==_0xf42e('0x3e')){var _0x52d99e={};_0x52d99e[_0x17ecb7[_0xf42e('0x28')]]={'$like':'%'+_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x3c')]+'%'};return _0x52d99e;}})});}_0x4d5896=_[_0xf42e('0x3f')]({},_0x4d5896,_0x1d07ec[_0xf42e('0x40')]);var _0x5f0ed9={'where':_0x4d5896['where']};return db['SalesforceAccount'][_0xf42e('0x1c')](_0x5f0ed9)[_0xf42e('0x25')](function(_0x29b593){_0x16bdda['count']=_0x29b593;if(_0x1d07ec['query'][_0xf42e('0x41')]){_0x4d5896[_0xf42e('0x42')]=[{'all':!![]}];}return db[_0xf42e('0x2b')][_0xf42e('0x43')](_0x4d5896);})[_0xf42e('0x25')](function(_0x4d4066){_0x16bdda['rows']=_0x4d4066;return _0x16bdda;})[_0xf42e('0x25')](respondWithFilteredResult(_0x247102,_0x4d5896))[_0xf42e('0x44')](handleError(_0x247102,null));};exports['show']=function(_0x931088,_0x4144ee){var _0x2db507={'raw':![],'where':{'id':_0x931088[_0xf42e('0x45')]['id']}},_0x21e618={};_0x21e618[_0xf42e('0x2e')]=_['keys'](db[_0xf42e('0x2b')][_0xf42e('0x2c')]);_0x21e618[_0xf42e('0x2f')]=_[_0xf42e('0x30')](_0x931088['query']);_0x21e618['filters']=_[_0xf42e('0x32')](_0x21e618[_0xf42e('0x2e')],_0x21e618[_0xf42e('0x2f')]);_0x2db507['attributes']=_[_0xf42e('0x32')](_0x21e618[_0xf42e('0x2e')],qs['fields'](_0x931088[_0xf42e('0x2f')][_0xf42e('0x34')]));_0x2db507[_0xf42e('0x33')]=_0x2db507[_0xf42e('0x33')][_0xf42e('0x35')]?_0x2db507[_0xf42e('0x33')]:_0x21e618[_0xf42e('0x2e')];if(_0x931088['query'][_0xf42e('0x41')]){_0x2db507['include']=[{'all':!![]}];}_0x2db507=_[_0xf42e('0x3f')]({},_0x2db507,_0x931088[_0xf42e('0x40')]);return db[_0xf42e('0x2b')]['find'](_0x2db507)['then'](handleEntityNotFound(_0x4144ee,null))[_0xf42e('0x25')](respondWithResult(_0x4144ee,null))[_0xf42e('0x44')](handleError(_0x4144ee,null));};exports[_0xf42e('0x46')]=function(_0x3d7b7e,_0x3c2822){return db['SalesforceAccount'][_0xf42e('0x46')](_0x3d7b7e[_0xf42e('0x47')],{})[_0xf42e('0x25')](respondWithResult(_0x3c2822,0xc9))[_0xf42e('0x44')](handleError(_0x3c2822,null));};exports['update']=function(_0x5c0f50,_0x5d0717){if(_0x5c0f50[_0xf42e('0x47')]['id']){delete _0x5c0f50[_0xf42e('0x47')]['id'];}return db[_0xf42e('0x2b')][_0xf42e('0x48')]({'where':{'id':_0x5c0f50[_0xf42e('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d0717,null))[_0xf42e('0x25')](saveUpdates(_0x5c0f50[_0xf42e('0x47')],null))[_0xf42e('0x25')](respondWithResult(_0x5d0717,null))['catch'](handleError(_0x5d0717,null));};exports['destroy']=function(_0x55cc1b,_0x364a3d){return db[_0xf42e('0x2b')][_0xf42e('0x48')]({'where':{'id':_0x55cc1b[_0xf42e('0x45')]['id']}})['then'](handleEntityNotFound(_0x364a3d,null))['then'](removeEntity(_0x364a3d,null))[_0xf42e('0x44')](handleError(_0x364a3d,null));};exports[_0xf42e('0x49')]=function(_0x3ad965,_0x10a2ee,_0x142f06){var _0x2caff0={};var _0x55ee98={};var _0x3b449e;var _0x2fbddd;return db[_0xf42e('0x2b')][_0xf42e('0x4a')]({'where':{'id':_0x3ad965['params']['id']}})[_0xf42e('0x25')](handleEntityNotFound(_0x10a2ee,null))[_0xf42e('0x25')](function(_0x47039e){if(_0x47039e){_0x3b449e=_0x47039e;_0x55ee98[_0xf42e('0x2e')]=_[_0xf42e('0x30')](db[_0xf42e('0x4b')][_0xf42e('0x2c')]);_0x55ee98['query']=_['keys'](_0x3ad965['query']);_0x55ee98['filters']=_[_0xf42e('0x32')](_0x55ee98[_0xf42e('0x2e')],_0x55ee98[_0xf42e('0x2f')]);_0x2caff0[_0xf42e('0x33')]=_['intersection'](_0x55ee98[_0xf42e('0x2e')],qs[_0xf42e('0x34')](_0x3ad965[_0xf42e('0x2f')]['fields']));_0x2caff0[_0xf42e('0x33')]=_0x2caff0[_0xf42e('0x33')][_0xf42e('0x35')]?_0x2caff0[_0xf42e('0x33')]:_0x55ee98[_0xf42e('0x2e')];_0x2caff0[_0xf42e('0x38')]=qs[_0xf42e('0x39')](_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x39')]);_0x2caff0[_0xf42e('0x3a')]=qs[_0xf42e('0x31')](_[_0xf42e('0x3b')](_0x3ad965[_0xf42e('0x2f')],_0x55ee98[_0xf42e('0x31')]));if(_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x3c')]){_0x2caff0[_0xf42e('0x3a')]=_[_0xf42e('0x3f')](_0x2caff0[_0xf42e('0x3a')],{'$or':_[_0xf42e('0x2a')](_0x2caff0[_0xf42e('0x33')],function(_0x523a64){var _0x2d3820={};_0x2d3820[_0x523a64]={'$like':'%'+_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x3c')]+'%'};return _0x2d3820;})});}_0x2caff0=_['merge']({},_0x2caff0,_0x3ad965[_0xf42e('0x40')]);return _0x3b449e['getConfigurations'](_0x2caff0);}})[_0xf42e('0x25')](function(_0x20f97a){if(_0x20f97a){_0x2fbddd=_0x20f97a['length'];if(!_0x3ad965['query'][_0xf42e('0x36')]('nolimit')){_0x2caff0[_0xf42e('0x1a')]=qs[_0xf42e('0x1a')](_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x1a')]);_0x2caff0[_0xf42e('0x1d')]=qs[_0xf42e('0x1d')](_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x1d')]);}return _0x3b449e[_0xf42e('0x49')](_0x2caff0);}})['then'](function(_0x31cc95){if(_0x31cc95){return _0x31cc95?{'count':_0x2fbddd,'rows':_0x31cc95}:null;}})[_0xf42e('0x25')](respondWithResult(_0x10a2ee,null))[_0xf42e('0x44')](handleError(_0x10a2ee,null));};exports[_0xf42e('0x4c')]=function(_0x32a728,_0x4ea75e,_0x7f1078){if(_0x32a728['body']['id']){delete _0x32a728[_0xf42e('0x47')]['id'];}return db['SalesforceAccount'][_0xf42e('0x4a')]({'where':{'id':_0x32a728['params']['id']}})[_0xf42e('0x25')](handleEntityNotFound(_0x4ea75e,null))[_0xf42e('0x25')](function(_0x48bf95){if(_0x48bf95){_0x32a728[_0xf42e('0x47')][_0xf42e('0x4d')]=_0x48bf95['id'];_0x32a728[_0xf42e('0x47')]['Subjects']=integrations[_0xf42e('0x4e')](_0x32a728[_0xf42e('0x47')][_0xf42e('0x4f')],_0x32a728['body']['type']);_0x32a728['body'][_0xf42e('0x50')]=integrations['getDescriptions'](_0x32a728['body'][_0xf42e('0x4f')],_0x32a728[_0xf42e('0x47')]['type']);return db[_0xf42e('0x4b')][_0xf42e('0x46')](_0x32a728[_0xf42e('0x47')],{'include':[{'model':db[_0xf42e('0x51')],'as':_0xf42e('0x52')},{'model':db[_0xf42e('0x51')],'as':_0xf42e('0x50')}]});}return null;})['then'](respondWithResult(_0x4ea75e,null))[_0xf42e('0x44')](handleError(_0x4ea75e,null));};exports['getFields']=function(_0x47fd3f,_0x2a5da8,_0x3d9849){var _0x2527b9;var _0x27b1ca='';var _0x3e520e=_0xf42e('0x53');return db[_0xf42e('0x2b')][_0xf42e('0x4a')]({'where':{'id':_0x47fd3f[_0xf42e('0x45')]['id']},'attributes':['id','remoteUri',_0xf42e('0x54'),_0xf42e('0x55'),_0xf42e('0x56'),_0xf42e('0x57'),_0xf42e('0x58')]})[_0xf42e('0x25')](handleEntityNotFound(_0x2a5da8,null))[_0xf42e('0x25')](function(_0x55aa2f){if(_0x55aa2f){_0x27b1ca=_0x55aa2f[_0xf42e('0x59')];var _0x5a797b=_0x27b1ca['slice'](-0x1);if(_0x5a797b==='/'){_0x27b1ca=_0x27b1ca[_0xf42e('0x5a')](0x0,_0x27b1ca[_0xf42e('0x5b')](_0x5a797b));}_0x2527b9=new jsforce[(_0xf42e('0x5c'))]({'oauth2':{'loginUrl':_0x27b1ca,'clientId':_0x55aa2f[_0xf42e('0x54')],'clientSecret':_0x55aa2f[_0xf42e('0x55')]}});return _0x2527b9[_0xf42e('0x5d')](_0x55aa2f[_0xf42e('0x56')],_0x55aa2f[_0xf42e('0x57')][_0xf42e('0x5e')](_0x55aa2f[_0xf42e('0x58')]));}})[_0xf42e('0x25')](function(_0x12002f){if(_0x12002f){if(!_[_0xf42e('0x5f')](_0x47fd3f[_0xf42e('0x2f')][_0xf42e('0x60')])){_0x3e520e=_0x47fd3f[_0xf42e('0x2f')][_0xf42e('0x60')];}return _0x2527b9['sobject'](_0x3e520e)[_0xf42e('0x61')]();}})[_0xf42e('0x25')](function(_0x5a7131){var _0x21e8d0=['OwnerId',_0xf42e('0x62'),_0xf42e('0x63'),'IsRecurrence',_0xf42e('0x64'),_0xf42e('0x65')];var _0x556279=[_0xf42e('0x66'),'int','picklist','boolean',_0xf42e('0x67'),'textarea',_0xf42e('0x68')];if(_0x5a7131){_[_0xf42e('0x69')](_0x5a7131['fields'],function(_0x22bd39){return _0x21e8d0['includes'](_0x22bd39[_0xf42e('0x28')])||!_0x556279[_0xf42e('0x6a')](_0x22bd39[_0xf42e('0x3d')]);});return{'count':_0x5a7131['fields'][_0xf42e('0x35')],'rows':_[_0xf42e('0x2a')](_0x5a7131[_0xf42e('0x34')],function(_0x319760){return{'id':_0x319760[_0xf42e('0x28')],'name':_0x319760['label'],'custom':_0x319760['custom'],'options':_0x319760[_0xf42e('0x6b')][_0xf42e('0x35')]>0x0?_['map'](_0x319760['picklistValues'],function(_0x28605a){return{'name':_0x28605a['label'],'value':_0x28605a['value']};}):_0x319760['type']==_0xf42e('0x6c')?[{'name':'True','value':_0xf42e('0x6d')},{'name':_0xf42e('0x6e'),'value':_0xf42e('0x6f')}]:[]};})};}})['then'](respondWithResult(_0x2a5da8,null))['catch'](function(_0x34b825){var _0x5e85da=_0x47fd3f['query'][_0xf42e('0x70')]?0x1f4:_0x34b825[_0xf42e('0x71')]||0x1f4;logger[_0xf42e('0x72')](_0xf42e('0x73'),'getFields',_0x5e85da,JSON[_0xf42e('0x74')](_0x34b825));delete _0x34b825['name'];if(_0x5e85da===0x191){_0x5e85da=0x190;}_0x2a5da8['status'](_0x5e85da)[_0xf42e('0x75')](_0x47fd3f['query']['test']?{'message':_0xf42e('0x76'),'statusCode':_0x34b825['statusCode']}:_0x34b825);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index abbdcb0..fec6aa8 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 _0x2670=['../../components/integrations/configuration','exports','define','int_salesforce_accounts','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x3b670b,_0x4fde17){var _0x1929da=function(_0x241a5a){while(--_0x241a5a){_0x3b670b['push'](_0x3b670b['shift']());}};_0x1929da(++_0x4fde17);}(_0x2670,0x180));var _0x0267=function(_0x43af10,_0xb68ed0){_0x43af10=_0x43af10-0x0;var _0x4a75c6=_0x2670[_0x43af10];return _0x4a75c6;};'use strict';var _=require('lodash');var util=require(_0x0267('0x0'));var logger=require(_0x0267('0x1'))(_0x0267('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0267('0x3'));var rimraf=require(_0x0267('0x4'));var config=require(_0x0267('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x0267('0x6'));module[_0x0267('0x7')]=function(_0x486b4b,_0x3724ea){return _0x486b4b[_0x0267('0x8')]('SalesforceAccount',attributes,{'tableName':_0x0267('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed26=['int_salesforce_accounts','lodash','api','moment','bluebird','request-promise','path','./intSalesforceAccount.attributes','exports','define','SalesforceAccount'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xed26,0x64));var _0x6ed2=function(_0x46a372,_0x19c179){_0x46a372=_0x46a372-0x0;var _0x5a7f7d=_0xed26[_0x46a372];return _0x5a7f7d;};'use strict';var _=require(_0x6ed2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ed2('0x1'));var moment=require(_0x6ed2('0x2'));var BPromise=require(_0x6ed2('0x3'));var rp=require(_0x6ed2('0x4'));var fs=require('fs');var path=require(_0x6ed2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6ed2('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x6ed2('0x7')]=function(_0x55189f,_0x5202d3){return _0x55189f[_0x6ed2('0x8')](_0x6ed2('0x9'),attributes,{'tableName':_0x6ed2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 695ef1f..183203d 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 _0x8115=['model','then','GetSalesforceAccount','find','ShowSalesforceAccount','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x8115,0x1c0));var _0x5811=function(_0x5e2d05,_0x2550ef){_0x5e2d05=_0x5e2d05-0x0;var _0x6d2786=_0x8115[_0x5e2d05];return _0x6d2786;};'use strict';var _=require(_0x5811('0x0'));var util=require(_0x5811('0x1'));var moment=require(_0x5811('0x2'));var BPromise=require(_0x5811('0x3'));var rs=require(_0x5811('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5811('0x5'))['db'];var utils=require(_0x5811('0x6'));var logger=require(_0x5811('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5811('0x8'));var client=jayson[_0x5811('0x9')][_0x5811('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc835e1,_0x4461ea,_0x17a1f6){return new BPromise(function(_0xcdc844,_0x4a5146){return client['request'](_0xc835e1,_0x17a1f6)['then'](function(_0x769a11){logger[_0x5811('0xb')](_0x5811('0xc'),_0x4461ea,_0x5811('0xd'));logger[_0x5811('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4461ea,'request\x20sent',JSON[_0x5811('0xf')](_0x769a11));if(_0x769a11[_0x5811('0x10')]){if(_0x769a11['error']['code']===0x1f4){logger['error'](_0x5811('0xc'),_0x4461ea,_0x769a11['error']['message']);return _0x4a5146(_0x769a11[_0x5811('0x10')]['message']);}logger[_0x5811('0x10')](_0x5811('0xc'),_0x4461ea,_0x769a11['error'][_0x5811('0x11')]);return _0xcdc844(_0x769a11['error'][_0x5811('0x11')]);}else{logger[_0x5811('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x4461ea,'request\x20sent');_0xcdc844(_0x769a11[_0x5811('0x12')]['message']);}})['catch'](function(_0x4bfa28){logger['error'](_0x5811('0xc'),_0x4461ea,_0x4bfa28);_0x4a5146(_0x4bfa28);});});}exports['GetSalesforceAccount']=function(_0x285f85){var _0x4da2b9=this;return new Promise(function(_0x127ee4,_0x2bc28d){return db[_0x5811('0x13')][_0x5811('0x14')]({'raw':_0x285f85[_0x5811('0x15')]?_0x285f85[_0x5811('0x15')][_0x5811('0x16')]===undefined?!![]:![]:!![],'where':_0x285f85[_0x5811('0x15')]?_0x285f85[_0x5811('0x15')][_0x5811('0x17')]||null:null,'attributes':_0x285f85['options']?_0x285f85[_0x5811('0x15')][_0x5811('0x18')]||null:null,'limit':_0x285f85[_0x5811('0x15')]?_0x285f85['options'][_0x5811('0x19')]||null:null,'include':_0x285f85[_0x5811('0x15')]?_0x285f85[_0x5811('0x15')]['include']?_[_0x5811('0x1a')](_0x285f85[_0x5811('0x15')][_0x5811('0x1b')],function(_0x5620c3){return{'model':db[_0x5620c3['model']],'as':_0x5620c3['as'],'attributes':_0x5620c3['attributes'],'include':_0x5620c3['include']?_['map'](_0x5620c3[_0x5811('0x1b')],function(_0x1226b0){return{'model':db[_0x1226b0[_0x5811('0x1c')]],'as':_0x1226b0['as'],'attributes':_0x1226b0[_0x5811('0x18')],'include':_0x1226b0['include']?_[_0x5811('0x1a')](_0x1226b0['include'],function(_0x3fca28){return{'model':db[_0x3fca28[_0x5811('0x1c')]],'as':_0x3fca28['as'],'attributes':_0x3fca28[_0x5811('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5811('0x1d')](function(_0xc4a18b){logger[_0x5811('0xb')]('GetSalesforceAccount',_0x285f85);logger['debug']('GetSalesforceAccount',_0x285f85,JSON[_0x5811('0xf')](_0xc4a18b));_0x127ee4(_0xc4a18b);})['catch'](function(_0x2e6333){logger[_0x5811('0x10')](_0x5811('0x1e'),_0x2e6333[_0x5811('0x11')],_0x285f85);_0x2bc28d(_0x4da2b9['error'](0x1f4,_0x2e6333[_0x5811('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x626526){var _0x136772=this;return new Promise(function(_0x468c90,_0x3d8223){return db[_0x5811('0x13')][_0x5811('0x1f')]({'raw':_0x626526[_0x5811('0x15')]?_0x626526[_0x5811('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x626526[_0x5811('0x15')]?_0x626526['options'][_0x5811('0x17')]||null:null,'attributes':_0x626526[_0x5811('0x15')]?_0x626526[_0x5811('0x15')][_0x5811('0x18')]||null:null,'include':_0x626526[_0x5811('0x15')]?_0x626526[_0x5811('0x15')][_0x5811('0x1b')]?_['map'](_0x626526[_0x5811('0x15')]['include'],function(_0x1ac580){return{'model':db[_0x1ac580['model']],'as':_0x1ac580['as'],'attributes':_0x1ac580['attributes'],'include':_0x1ac580['include']?_[_0x5811('0x1a')](_0x1ac580[_0x5811('0x1b')],function(_0x15a39b){return{'model':db[_0x15a39b[_0x5811('0x1c')]],'as':_0x15a39b['as'],'attributes':_0x15a39b['attributes'],'include':_0x15a39b['include']?_['map'](_0x15a39b[_0x5811('0x1b')],function(_0x15856d){return{'model':db[_0x15856d['model']],'as':_0x15856d['as'],'attributes':_0x15856d['attributes']};}):[]};}):[]};}):[]:[]})[_0x5811('0x1d')](function(_0x356447){logger['info'](_0x5811('0x20'),_0x626526);logger[_0x5811('0xe')](_0x5811('0x20'),_0x626526,JSON['stringify'](_0x356447));_0x468c90(_0x356447);})[_0x5811('0x21')](function(_0x3d0fa1){logger[_0x5811('0x10')](_0x5811('0x20'),_0x3d0fa1[_0x5811('0x11')],_0x626526);_0x3d8223(_0x136772[_0x5811('0x10')](0x1f4,_0x3d0fa1[_0x5811('0x11')]));});});}; \ No newline at end of file +var _0xcd19=['model','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0xcd19,0x98));var _0x9cd1=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0xcd19[_0x5538d5];return _0x323b1a;};'use strict';var _=require(_0x9cd1('0x0'));var util=require(_0x9cd1('0x1'));var moment=require(_0x9cd1('0x2'));var BPromise=require(_0x9cd1('0x3'));var rs=require(_0x9cd1('0x4'));var fs=require('fs');var Redis=require(_0x9cd1('0x5'));var db=require(_0x9cd1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9cd1('0x7'))(_0x9cd1('0x8'));var config=require(_0x9cd1('0x9'));var jayson=require(_0x9cd1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4cb594,_0x405c85,_0x408ad4){return new BPromise(function(_0x4b5acd,_0x47544c){return client[_0x9cd1('0xb')](_0x4cb594,_0x408ad4)[_0x9cd1('0xc')](function(_0x38790b){logger[_0x9cd1('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x405c85,_0x9cd1('0xe'));logger[_0x9cd1('0xf')](_0x9cd1('0x10'),_0x405c85,_0x9cd1('0xe'),JSON[_0x9cd1('0x11')](_0x38790b));if(_0x38790b[_0x9cd1('0x12')]){if(_0x38790b[_0x9cd1('0x12')][_0x9cd1('0x13')]===0x1f4){logger['error'](_0x9cd1('0x14'),_0x405c85,_0x38790b['error'][_0x9cd1('0x15')]);return _0x47544c(_0x38790b[_0x9cd1('0x12')][_0x9cd1('0x15')]);}logger[_0x9cd1('0x12')](_0x9cd1('0x14'),_0x405c85,_0x38790b[_0x9cd1('0x12')][_0x9cd1('0x15')]);return _0x4b5acd(_0x38790b[_0x9cd1('0x12')][_0x9cd1('0x15')]);}else{logger[_0x9cd1('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x405c85,'request\x20sent');_0x4b5acd(_0x38790b[_0x9cd1('0x16')][_0x9cd1('0x15')]);}})[_0x9cd1('0x17')](function(_0x27e8a0){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x405c85,_0x27e8a0);_0x47544c(_0x27e8a0);});});}exports[_0x9cd1('0x18')]=function(_0x2821b1){var _0x1ebd4d=this;return new Promise(function(_0x5ea152,_0x22b359){return db[_0x9cd1('0x19')][_0x9cd1('0x1a')]({'raw':_0x2821b1[_0x9cd1('0x1b')]?_0x2821b1['options']['raw']===undefined?!![]:![]:!![],'where':_0x2821b1[_0x9cd1('0x1b')]?_0x2821b1[_0x9cd1('0x1b')][_0x9cd1('0x1c')]||null:null,'attributes':_0x2821b1['options']?_0x2821b1['options'][_0x9cd1('0x1d')]||null:null,'limit':_0x2821b1['options']?_0x2821b1['options'][_0x9cd1('0x1e')]||null:null,'include':_0x2821b1['options']?_0x2821b1[_0x9cd1('0x1b')][_0x9cd1('0x1f')]?_['map'](_0x2821b1[_0x9cd1('0x1b')][_0x9cd1('0x1f')],function(_0x1aafbb){return{'model':db[_0x1aafbb['model']],'as':_0x1aafbb['as'],'attributes':_0x1aafbb[_0x9cd1('0x1d')],'include':_0x1aafbb['include']?_['map'](_0x1aafbb['include'],function(_0x3972d1){return{'model':db[_0x3972d1['model']],'as':_0x3972d1['as'],'attributes':_0x3972d1['attributes'],'include':_0x3972d1[_0x9cd1('0x1f')]?_[_0x9cd1('0x20')](_0x3972d1[_0x9cd1('0x1f')],function(_0x3162ad){return{'model':db[_0x3162ad[_0x9cd1('0x21')]],'as':_0x3162ad['as'],'attributes':_0x3162ad[_0x9cd1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9cd1('0xc')](function(_0x40337d){logger[_0x9cd1('0xd')](_0x9cd1('0x18'),_0x2821b1);logger['debug'](_0x9cd1('0x18'),_0x2821b1,JSON['stringify'](_0x40337d));_0x5ea152(_0x40337d);})['catch'](function(_0x195b56){logger[_0x9cd1('0x12')](_0x9cd1('0x18'),_0x195b56['message'],_0x2821b1);_0x22b359(_0x1ebd4d['error'](0x1f4,_0x195b56[_0x9cd1('0x15')]));});});};exports[_0x9cd1('0x22')]=function(_0x237e32){var _0x5dc55b=this;return new Promise(function(_0x451531,_0x114c00){return db[_0x9cd1('0x19')][_0x9cd1('0x23')]({'raw':_0x237e32[_0x9cd1('0x1b')]?_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x24')]===undefined?!![]:![]:!![],'where':_0x237e32[_0x9cd1('0x1b')]?_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x1c')]||null:null,'attributes':_0x237e32[_0x9cd1('0x1b')]?_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x1d')]||null:null,'include':_0x237e32[_0x9cd1('0x1b')]?_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x1f')]?_[_0x9cd1('0x20')](_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x1f')],function(_0x40a857){return{'model':db[_0x40a857['model']],'as':_0x40a857['as'],'attributes':_0x40a857['attributes'],'include':_0x40a857['include']?_[_0x9cd1('0x20')](_0x40a857['include'],function(_0x2972af){return{'model':db[_0x2972af[_0x9cd1('0x21')]],'as':_0x2972af['as'],'attributes':_0x2972af[_0x9cd1('0x1d')],'include':_0x2972af[_0x9cd1('0x1f')]?_[_0x9cd1('0x20')](_0x2972af['include'],function(_0x40ed21){return{'model':db[_0x40ed21[_0x9cd1('0x21')]],'as':_0x40ed21['as'],'attributes':_0x40ed21[_0x9cd1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9cd1('0xc')](function(_0x5423f1){logger[_0x9cd1('0xd')]('ShowSalesforceAccount',_0x237e32);logger[_0x9cd1('0xf')]('ShowSalesforceAccount',_0x237e32,JSON[_0x9cd1('0x11')](_0x5423f1));_0x451531(_0x5423f1);})[_0x9cd1('0x17')](function(_0x57c48a){logger[_0x9cd1('0x12')](_0x9cd1('0x22'),_0x57c48a[_0x9cd1('0x15')],_0x237e32);_0x114c00(_0x5dc55b[_0x9cd1('0x12')](0x1f4,_0x57c48a[_0x9cd1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f35535c..81fce02 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x12047b,_0x3b5a28){var _0x1c4dc7=function(_0x3f6ffc){while(--_0x3f6ffc){_0x12047b['push'](_0x12047b['shift']());}};_0x1c4dc7(++_0x3b5a28);}(_0xadb5,0xad));var _0x5adb=function(_0x5a6e97,_0x2bc426){_0x5a6e97=_0x5a6e97-0x0;var _0x561fdc=_0xadb5[_0x5a6e97];return _0x561fdc;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x1e96be,_0x488ce5){var _0x23f755=function(_0x12bffd){while(--_0x12bffd){_0x1e96be['push'](_0x1e96be['shift']());}};_0x23f755(++_0x488ce5);}(_0x2ef3,0xba));var _0x32ef=function(_0x513796,_0x4bb1b3){_0x513796=_0x513796-0x0;var _0x1b47fe=_0x2ef3[_0x513796];return _0x1b47fe;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 4124bb1..d6e7e9b 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 _0x5746=['sequelize','exports','STRING','ENUM','Task','contact_lead','contact','lead','account'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x5746,0xd8));var _0x6574=function(_0x2cc8bc,_0x2bea91){_0x2cc8bc=_0x2cc8bc-0x0;var _0x5823d1=_0x5746[_0x2cc8bc];return _0x5823d1;};'use strict';var Sequelize=require(_0x6574('0x0'));module[_0x6574('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6574('0x2')]},'ticketType':{'type':Sequelize[_0x6574('0x3')]('Task','Case'),'defaultValue':_0x6574('0x4')},'moduleSearch':{'type':Sequelize[_0x6574('0x3')](_0x6574('0x5'),_0x6574('0x6'),_0x6574('0x7'),'account_contact_lead','account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x6574('0x3')]('nothing',_0x6574('0x6'),_0x6574('0x7'),_0x6574('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x6574('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x6574('0x2')]}}; \ No newline at end of file +var _0xf619=['Task','contact','lead','account_contact_lead','account','contact_lead','nothing','exports','STRING','ENUM'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0xf619,0x7f));var _0x9f61=function(_0x33e233,_0x31495f){_0x33e233=_0x33e233-0x0;var _0x689d90=_0xf619[_0x33e233];return _0x689d90;};'use strict';var Sequelize=require('sequelize');module[_0x9f61('0x0')]={'name':{'type':Sequelize[_0x9f61('0x1')]},'description':{'type':Sequelize[_0x9f61('0x1')]},'ticketType':{'type':Sequelize[_0x9f61('0x2')](_0x9f61('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x9f61('0x4'),_0x9f61('0x5'),_0x9f61('0x6'),_0x9f61('0x7')),'defaultValue':_0x9f61('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x9f61('0x9'),'contact',_0x9f61('0x5'),_0x9f61('0x7')),'defaultValue':_0x9f61('0x5')},'leadId':{'type':Sequelize[_0x9f61('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x9f61('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x9f61('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8da3832..2bca9c9 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 _0xfb10=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getFields','SalesforceField','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x15cb50,_0x49587b){var _0x423caa=function(_0x501371){while(--_0x501371){_0x15cb50['push'](_0x15cb50['shift']());}};_0x423caa(++_0x49587b);}(_0xfb10,0x13c));var _0x0fb1=function(_0x28e6bd,_0x209fd7){_0x28e6bd=_0x28e6bd-0x0;var _0x3ef264=_0xfb10[_0x28e6bd];return _0x3ef264;};'use strict';var emlformat=require(_0x0fb1('0x0'));var rimraf=require(_0x0fb1('0x1'));var zipdir=require(_0x0fb1('0x2'));var jsonpatch=require(_0x0fb1('0x3'));var rp=require(_0x0fb1('0x4'));var moment=require(_0x0fb1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0fb1('0x6'));var util=require(_0x0fb1('0x7'));var path=require(_0x0fb1('0x8'));var sox=require('sox');var csv=require(_0x0fb1('0x9'));var ejs=require(_0x0fb1('0xa'));var fs=require('fs');var fs_extra=require(_0x0fb1('0xb'));var _=require('lodash');var squel=require(_0x0fb1('0xc'));var crypto=require(_0x0fb1('0xd'));var jsforce=require(_0x0fb1('0xe'));var deskjs=require(_0x0fb1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0fb1('0x10'));var Papa=require(_0x0fb1('0x11'));var Redis=require('ioredis');var authService=require(_0x0fb1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fb1('0x13'));var hardwareService=require(_0x0fb1('0x14'));var logger=require(_0x0fb1('0x15'))(_0x0fb1('0x16'));var utils=require(_0x0fb1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0fb1('0x18'));var db=require(_0x0fb1('0x19'))['db'];function respondWithStatusCode(_0x5d5636,_0x33fd70){_0x33fd70=_0x33fd70||0xcc;return function(_0x1158d0){if(_0x1158d0){return _0x5d5636[_0x0fb1('0x1a')](_0x33fd70);}return _0x5d5636[_0x0fb1('0x1b')](_0x33fd70)[_0x0fb1('0x1c')]();};}function respondWithResult(_0x548a43,_0x7d5bff){_0x7d5bff=_0x7d5bff||0xc8;return function(_0x4f81dc){if(_0x4f81dc){return _0x548a43[_0x0fb1('0x1b')](_0x7d5bff)[_0x0fb1('0x1d')](_0x4f81dc);}};}function respondWithFilteredResult(_0x131ba5,_0x39a4a4){return function(_0x117521){if(_0x117521){var _0x31b872=typeof _0x39a4a4[_0x0fb1('0x1e')]===_0x0fb1('0x1f')&&typeof _0x39a4a4['limit']===_0x0fb1('0x1f');var _0x5d8ed6=_0x117521[_0x0fb1('0x20')];var _0x328a5d=_0x31b872?0x0:_0x39a4a4[_0x0fb1('0x1e')];var _0x4d2821=_0x31b872?_0x117521[_0x0fb1('0x20')]:_0x39a4a4[_0x0fb1('0x1e')]+_0x39a4a4['limit'];var _0x703a82;if(_0x4d2821>=_0x5d8ed6){_0x4d2821=_0x5d8ed6;_0x703a82=0xc8;}else{_0x703a82=0xce;}_0x131ba5[_0x0fb1('0x1b')](_0x703a82);return _0x131ba5['set'](_0x0fb1('0x21'),_0x328a5d+'-'+_0x4d2821+'/'+_0x5d8ed6)['json'](_0x117521);}return null;};}function patchUpdates(_0x2ce3f3){return function(_0x196506){try{jsonpatch[_0x0fb1('0x22')](_0x196506,_0x2ce3f3,!![]);}catch(_0x24b61f){return BPromise['reject'](_0x24b61f);}return _0x196506[_0x0fb1('0x23')]();};}function saveUpdates(_0x347b6c,_0x26953d){return function(_0x7922b9){if(_0x7922b9){return _0x7922b9['update'](_0x347b6c)[_0x0fb1('0x24')](function(_0x73aca4){return _0x73aca4;});}return null;};}function removeEntity(_0x401590,_0x38dfd3){return function(_0x1d97f5){if(_0x1d97f5){return _0x1d97f5[_0x0fb1('0x25')]()['then'](function(){_0x401590['status'](0xcc)[_0x0fb1('0x1c')]();});}};}function handleEntityNotFound(_0x398801,_0x5300ed){return function(_0xfa58ff){if(!_0xfa58ff){_0x398801[_0x0fb1('0x1a')](0x194);}return _0xfa58ff;};}function handleError(_0x5c7064,_0x5ca8d1){_0x5ca8d1=_0x5ca8d1||0x1f4;return function(_0x44f29f){logger[_0x0fb1('0x26')](_0x44f29f[_0x0fb1('0x27')]);if(_0x44f29f[_0x0fb1('0x28')]){delete _0x44f29f[_0x0fb1('0x28')];}_0x5c7064['status'](_0x5ca8d1)[_0x0fb1('0x29')](_0x44f29f);};}exports[_0x0fb1('0x2a')]=function(_0x5c11d1,_0x339162){var _0x328a05={},_0x147e78={},_0x12ff27={'count':0x0,'rows':[]};var _0x2ab8db=_[_0x0fb1('0x2b')](db[_0x0fb1('0x2c')][_0x0fb1('0x2d')],function(_0x46afb0){return{'name':_0x46afb0[_0x0fb1('0x2e')],'type':_0x46afb0['type']['key']};});_0x147e78[_0x0fb1('0x2f')]=_[_0x0fb1('0x2b')](_0x2ab8db,_0x0fb1('0x28'));_0x147e78[_0x0fb1('0x30')]=_[_0x0fb1('0x31')](_0x5c11d1['query']);_0x147e78[_0x0fb1('0x32')]=_[_0x0fb1('0x33')](_0x147e78[_0x0fb1('0x2f')],_0x147e78['query']);_0x328a05['attributes']=_[_0x0fb1('0x33')](_0x147e78['model'],qs['fields'](_0x5c11d1[_0x0fb1('0x30')][_0x0fb1('0x34')]));_0x328a05[_0x0fb1('0x35')]=_0x328a05['attributes'][_0x0fb1('0x36')]?_0x328a05['attributes']:_0x147e78[_0x0fb1('0x2f')];if(!_0x5c11d1['query'][_0x0fb1('0x37')](_0x0fb1('0x38'))){_0x328a05['limit']=qs[_0x0fb1('0x39')](_0x5c11d1['query'][_0x0fb1('0x39')]);_0x328a05[_0x0fb1('0x1e')]=qs[_0x0fb1('0x1e')](_0x5c11d1[_0x0fb1('0x30')][_0x0fb1('0x1e')]);}_0x328a05[_0x0fb1('0x3a')]=qs[_0x0fb1('0x3b')](_0x5c11d1['query'][_0x0fb1('0x3b')]);_0x328a05['where']=qs[_0x0fb1('0x32')](_[_0x0fb1('0x3c')](_0x5c11d1[_0x0fb1('0x30')],_0x147e78[_0x0fb1('0x32')]),_0x2ab8db);if(_0x5c11d1['query'][_0x0fb1('0x3d')]){_0x328a05[_0x0fb1('0x3e')]=_[_0x0fb1('0x3f')](_0x328a05[_0x0fb1('0x3e')],{'$or':_['map'](_0x2ab8db,function(_0x5c8ed1){if(_0x5c8ed1[_0x0fb1('0x40')]!=='VIRTUAL'){var _0x19a4a0={};_0x19a4a0[_0x5c8ed1[_0x0fb1('0x28')]]={'$like':'%'+_0x5c11d1['query'][_0x0fb1('0x3d')]+'%'};return _0x19a4a0;}})});}_0x328a05=_[_0x0fb1('0x3f')]({},_0x328a05,_0x5c11d1[_0x0fb1('0x41')]);var _0x3082c1={'where':_0x328a05['where']};return db['SalesforceConfiguration'][_0x0fb1('0x20')](_0x3082c1)[_0x0fb1('0x24')](function(_0x2682e9){_0x12ff27[_0x0fb1('0x20')]=_0x2682e9;if(_0x5c11d1[_0x0fb1('0x30')][_0x0fb1('0x42')]){_0x328a05[_0x0fb1('0x43')]=[{'all':!![]}];}return db[_0x0fb1('0x2c')][_0x0fb1('0x44')](_0x328a05);})[_0x0fb1('0x24')](function(_0x2c5301){_0x12ff27[_0x0fb1('0x45')]=_0x2c5301;return _0x12ff27;})['then'](respondWithFilteredResult(_0x339162,_0x328a05))[_0x0fb1('0x46')](handleError(_0x339162,null));};exports[_0x0fb1('0x47')]=function(_0x192e53,_0x544e59){var _0x2c97dc={'raw':![],'where':{'id':_0x192e53[_0x0fb1('0x48')]['id']}},_0x1eca3b={};_0x1eca3b[_0x0fb1('0x2f')]=_['keys'](db[_0x0fb1('0x2c')][_0x0fb1('0x2d')]);_0x1eca3b['query']=_['keys'](_0x192e53[_0x0fb1('0x30')]);_0x1eca3b[_0x0fb1('0x32')]=_['intersection'](_0x1eca3b[_0x0fb1('0x2f')],_0x1eca3b[_0x0fb1('0x30')]);_0x2c97dc[_0x0fb1('0x35')]=_[_0x0fb1('0x33')](_0x1eca3b[_0x0fb1('0x2f')],qs[_0x0fb1('0x34')](_0x192e53[_0x0fb1('0x30')]['fields']));_0x2c97dc['attributes']=_0x2c97dc['attributes'][_0x0fb1('0x36')]?_0x2c97dc[_0x0fb1('0x35')]:_0x1eca3b[_0x0fb1('0x2f')];if(_0x192e53[_0x0fb1('0x30')][_0x0fb1('0x42')]){_0x2c97dc[_0x0fb1('0x43')]=[{'all':!![]}];}_0x2c97dc=_[_0x0fb1('0x3f')]({},_0x2c97dc,_0x192e53[_0x0fb1('0x41')]);return db[_0x0fb1('0x2c')][_0x0fb1('0x49')](_0x2c97dc)[_0x0fb1('0x24')](handleEntityNotFound(_0x544e59,null))[_0x0fb1('0x24')](respondWithResult(_0x544e59,null))['catch'](handleError(_0x544e59,null));};exports[_0x0fb1('0x4a')]=function(_0x4f5f76,_0x8644f2){return db[_0x0fb1('0x2c')]['create'](_0x4f5f76[_0x0fb1('0x4b')],{})['then'](respondWithResult(_0x8644f2,0xc9))[_0x0fb1('0x46')](handleError(_0x8644f2,null));};exports[_0x0fb1('0x4c')]=function(_0x272cd2,_0x14a6ae){if(_0x272cd2['body']['id']){delete _0x272cd2[_0x0fb1('0x4b')]['id'];}return db[_0x0fb1('0x2c')][_0x0fb1('0x49')]({'where':{'id':_0x272cd2[_0x0fb1('0x48')]['id']}})['then'](handleEntityNotFound(_0x14a6ae,null))[_0x0fb1('0x24')](saveUpdates(_0x272cd2['body'],null))[_0x0fb1('0x24')](respondWithResult(_0x14a6ae,null))[_0x0fb1('0x46')](handleError(_0x14a6ae,null));};exports['destroy']=function(_0x24f62a,_0x3c5c5e){return db['SalesforceConfiguration'][_0x0fb1('0x49')]({'where':{'id':_0x24f62a[_0x0fb1('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c5c5e,null))['then'](removeEntity(_0x3c5c5e,null))[_0x0fb1('0x46')](handleError(_0x3c5c5e,null));};exports[_0x0fb1('0x4d')]=function(_0x1e2f60,_0x3a9ffd,_0x20d86b){var _0x525ce7={};var _0x3cdaae={};var _0x3039cc;var _0x1672b6;return db[_0x0fb1('0x2c')]['findOne']({'where':{'id':_0x1e2f60[_0x0fb1('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a9ffd,null))[_0x0fb1('0x24')](function(_0x159334){if(_0x159334){_0x3039cc=_0x159334;_0x3cdaae[_0x0fb1('0x2f')]=_[_0x0fb1('0x31')](db[_0x0fb1('0x4e')]['rawAttributes']);_0x3cdaae[_0x0fb1('0x30')]=_[_0x0fb1('0x31')](_0x1e2f60[_0x0fb1('0x30')]);_0x3cdaae[_0x0fb1('0x32')]=_[_0x0fb1('0x33')](_0x3cdaae[_0x0fb1('0x2f')],_0x3cdaae[_0x0fb1('0x30')]);_0x525ce7[_0x0fb1('0x35')]=_[_0x0fb1('0x33')](_0x3cdaae[_0x0fb1('0x2f')],qs[_0x0fb1('0x34')](_0x1e2f60['query'][_0x0fb1('0x34')]));_0x525ce7[_0x0fb1('0x35')]=_0x525ce7['attributes'][_0x0fb1('0x36')]?_0x525ce7[_0x0fb1('0x35')]:_0x3cdaae[_0x0fb1('0x2f')];_0x525ce7['order']=qs[_0x0fb1('0x3b')](_0x1e2f60[_0x0fb1('0x30')][_0x0fb1('0x3b')]);_0x525ce7[_0x0fb1('0x3e')]=qs['filters'](_[_0x0fb1('0x3c')](_0x1e2f60[_0x0fb1('0x30')],_0x3cdaae[_0x0fb1('0x32')]));if(_0x1e2f60[_0x0fb1('0x30')][_0x0fb1('0x3d')]){_0x525ce7[_0x0fb1('0x3e')]=_['merge'](_0x525ce7[_0x0fb1('0x3e')],{'$or':_[_0x0fb1('0x2b')](_0x525ce7[_0x0fb1('0x35')],function(_0x27d0c8){var _0x48e4ac={};_0x48e4ac[_0x27d0c8]={'$like':'%'+_0x1e2f60['query'][_0x0fb1('0x3d')]+'%'};return _0x48e4ac;})});}_0x525ce7=_[_0x0fb1('0x3f')]({},_0x525ce7,_0x1e2f60[_0x0fb1('0x41')]);return _0x3039cc[_0x0fb1('0x4d')](_0x525ce7);}})[_0x0fb1('0x24')](function(_0x50ba14){if(_0x50ba14){_0x1672b6=_0x50ba14['length'];if(!_0x1e2f60[_0x0fb1('0x30')]['hasOwnProperty'](_0x0fb1('0x38'))){_0x525ce7[_0x0fb1('0x39')]=qs[_0x0fb1('0x39')](_0x1e2f60[_0x0fb1('0x30')][_0x0fb1('0x39')]);_0x525ce7['offset']=qs[_0x0fb1('0x1e')](_0x1e2f60[_0x0fb1('0x30')][_0x0fb1('0x1e')]);}return _0x3039cc[_0x0fb1('0x4d')](_0x525ce7);}})[_0x0fb1('0x24')](function(_0x56abc7){if(_0x56abc7){return _0x56abc7?{'count':_0x1672b6,'rows':_0x56abc7}:null;}})[_0x0fb1('0x24')](respondWithResult(_0x3a9ffd,null))[_0x0fb1('0x46')](handleError(_0x3a9ffd,null));};exports[_0x0fb1('0x4f')]=function(_0x16849e,_0x2555ef,_0x5ca211){var _0x30f0bb={};var _0xaca4fe={};var _0x41ed88;var _0x2cbbc5;return db[_0x0fb1('0x2c')][_0x0fb1('0x50')]({'where':{'id':_0x16849e['params']['id']}})[_0x0fb1('0x24')](handleEntityNotFound(_0x2555ef,null))[_0x0fb1('0x24')](function(_0x207af3){if(_0x207af3){_0x41ed88=_0x207af3;_0xaca4fe[_0x0fb1('0x2f')]=_[_0x0fb1('0x31')](db[_0x0fb1('0x4e')]['rawAttributes']);_0xaca4fe['query']=_[_0x0fb1('0x31')](_0x16849e[_0x0fb1('0x30')]);_0xaca4fe[_0x0fb1('0x32')]=_[_0x0fb1('0x33')](_0xaca4fe[_0x0fb1('0x2f')],_0xaca4fe['query']);_0x30f0bb[_0x0fb1('0x35')]=_[_0x0fb1('0x33')](_0xaca4fe[_0x0fb1('0x2f')],qs[_0x0fb1('0x34')](_0x16849e['query'][_0x0fb1('0x34')]));_0x30f0bb[_0x0fb1('0x35')]=_0x30f0bb[_0x0fb1('0x35')][_0x0fb1('0x36')]?_0x30f0bb[_0x0fb1('0x35')]:_0xaca4fe['model'];_0x30f0bb['order']=qs['sort'](_0x16849e[_0x0fb1('0x30')]['sort']);_0x30f0bb[_0x0fb1('0x3e')]=qs[_0x0fb1('0x32')](_[_0x0fb1('0x3c')](_0x16849e['query'],_0xaca4fe['filters']));if(_0x16849e[_0x0fb1('0x30')]['filter']){_0x30f0bb[_0x0fb1('0x3e')]=_[_0x0fb1('0x3f')](_0x30f0bb[_0x0fb1('0x3e')],{'$or':_[_0x0fb1('0x2b')](_0x30f0bb[_0x0fb1('0x35')],function(_0x133e57){var _0x4606b7={};_0x4606b7[_0x133e57]={'$like':'%'+_0x16849e[_0x0fb1('0x30')][_0x0fb1('0x3d')]+'%'};return _0x4606b7;})});}_0x30f0bb=_['merge']({},_0x30f0bb,_0x16849e[_0x0fb1('0x41')]);return _0x41ed88[_0x0fb1('0x4f')](_0x30f0bb);}})[_0x0fb1('0x24')](function(_0x360927){if(_0x360927){_0x2cbbc5=_0x360927[_0x0fb1('0x36')];if(!_0x16849e['query']['hasOwnProperty'](_0x0fb1('0x38'))){_0x30f0bb[_0x0fb1('0x39')]=qs[_0x0fb1('0x39')](_0x16849e['query'][_0x0fb1('0x39')]);_0x30f0bb[_0x0fb1('0x1e')]=qs['offset'](_0x16849e['query'][_0x0fb1('0x1e')]);}return _0x41ed88[_0x0fb1('0x4f')](_0x30f0bb);}})[_0x0fb1('0x24')](function(_0x181c2d){if(_0x181c2d){return _0x181c2d?{'count':_0x2cbbc5,'rows':_0x181c2d}:null;}})[_0x0fb1('0x24')](respondWithResult(_0x2555ef,null))[_0x0fb1('0x46')](handleError(_0x2555ef,null));};exports['getDescriptions']=function(_0x10b6ca,_0x3ccd89,_0x103de1){var _0x1afaa1={};var _0x56066c={};var _0x3167fb;var _0x14fe9c;return db[_0x0fb1('0x2c')][_0x0fb1('0x50')]({'where':{'id':_0x10b6ca[_0x0fb1('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ccd89,null))['then'](function(_0x570daa){if(_0x570daa){_0x3167fb=_0x570daa;_0x56066c['model']=_['keys'](db[_0x0fb1('0x4e')][_0x0fb1('0x2d')]);_0x56066c[_0x0fb1('0x30')]=_[_0x0fb1('0x31')](_0x10b6ca[_0x0fb1('0x30')]);_0x56066c['filters']=_['intersection'](_0x56066c[_0x0fb1('0x2f')],_0x56066c[_0x0fb1('0x30')]);_0x1afaa1['attributes']=_[_0x0fb1('0x33')](_0x56066c[_0x0fb1('0x2f')],qs[_0x0fb1('0x34')](_0x10b6ca['query'][_0x0fb1('0x34')]));_0x1afaa1[_0x0fb1('0x35')]=_0x1afaa1[_0x0fb1('0x35')]['length']?_0x1afaa1['attributes']:_0x56066c[_0x0fb1('0x2f')];_0x1afaa1[_0x0fb1('0x3a')]=qs[_0x0fb1('0x3b')](_0x10b6ca['query'][_0x0fb1('0x3b')]);_0x1afaa1[_0x0fb1('0x3e')]=qs[_0x0fb1('0x32')](_[_0x0fb1('0x3c')](_0x10b6ca[_0x0fb1('0x30')],_0x56066c[_0x0fb1('0x32')]));if(_0x10b6ca[_0x0fb1('0x30')]['filter']){_0x1afaa1[_0x0fb1('0x3e')]=_[_0x0fb1('0x3f')](_0x1afaa1[_0x0fb1('0x3e')],{'$or':_[_0x0fb1('0x2b')](_0x1afaa1['attributes'],function(_0x52de32){var _0x511b02={};_0x511b02[_0x52de32]={'$like':'%'+_0x10b6ca['query']['filter']+'%'};return _0x511b02;})});}_0x1afaa1=_[_0x0fb1('0x3f')]({},_0x1afaa1,_0x10b6ca[_0x0fb1('0x41')]);return _0x3167fb[_0x0fb1('0x51')](_0x1afaa1);}})[_0x0fb1('0x24')](function(_0x10ad39){if(_0x10ad39){_0x14fe9c=_0x10ad39['length'];if(!_0x10b6ca[_0x0fb1('0x30')][_0x0fb1('0x37')](_0x0fb1('0x38'))){_0x1afaa1['limit']=qs['limit'](_0x10b6ca[_0x0fb1('0x30')][_0x0fb1('0x39')]);_0x1afaa1[_0x0fb1('0x1e')]=qs['offset'](_0x10b6ca[_0x0fb1('0x30')][_0x0fb1('0x1e')]);}return _0x3167fb[_0x0fb1('0x51')](_0x1afaa1);}})[_0x0fb1('0x24')](function(_0x120d6f){if(_0x120d6f){return _0x120d6f?{'count':_0x14fe9c,'rows':_0x120d6f}:null;}})[_0x0fb1('0x24')](respondWithResult(_0x3ccd89,null))[_0x0fb1('0x46')](handleError(_0x3ccd89,null));}; \ No newline at end of file +var _0xcd16=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','keys','includeAll','create','body','find','params','findOne','order','hasOwnProperty','getFields','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3a4f18,_0x1af741){var _0x4c20fc=function(_0x27115f){while(--_0x27115f){_0x3a4f18['push'](_0x3a4f18['shift']());}};_0x4c20fc(++_0x1af741);}(_0xcd16,0x13e));var _0x6cd1=function(_0x195029,_0xd5564f){_0x195029=_0x195029-0x0;var _0x154cbe=_0xcd16[_0x195029];return _0x154cbe;};'use strict';var emlformat=require(_0x6cd1('0x0'));var rimraf=require(_0x6cd1('0x1'));var zipdir=require(_0x6cd1('0x2'));var jsonpatch=require(_0x6cd1('0x3'));var rp=require(_0x6cd1('0x4'));var moment=require(_0x6cd1('0x5'));var BPromise=require(_0x6cd1('0x6'));var Mustache=require(_0x6cd1('0x7'));var util=require(_0x6cd1('0x8'));var path=require(_0x6cd1('0x9'));var sox=require(_0x6cd1('0xa'));var csv=require(_0x6cd1('0xb'));var ejs=require(_0x6cd1('0xc'));var fs=require('fs');var fs_extra=require(_0x6cd1('0xd'));var _=require(_0x6cd1('0xe'));var squel=require(_0x6cd1('0xf'));var crypto=require(_0x6cd1('0x10'));var jsforce=require(_0x6cd1('0x11'));var deskjs=require(_0x6cd1('0x12'));var toCsv=require('to-csv');var querystring=require(_0x6cd1('0x13'));var Papa=require(_0x6cd1('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cd1('0x15'));var as=require(_0x6cd1('0x16'));var hardwareService=require(_0x6cd1('0x17'));var logger=require(_0x6cd1('0x18'))(_0x6cd1('0x19'));var utils=require('../../config/utils');var config=require(_0x6cd1('0x1a'));var licenseUtil=require(_0x6cd1('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1651c3,_0x1b328f){_0x1b328f=_0x1b328f||0xcc;return function(_0x429562){if(_0x429562){return _0x1651c3['sendStatus'](_0x1b328f);}return _0x1651c3[_0x6cd1('0x1c')](_0x1b328f)[_0x6cd1('0x1d')]();};}function respondWithResult(_0x221831,_0x34b401){_0x34b401=_0x34b401||0xc8;return function(_0x459dfc){if(_0x459dfc){return _0x221831[_0x6cd1('0x1c')](_0x34b401)['json'](_0x459dfc);}};}function respondWithFilteredResult(_0x4c50dd,_0x59b4bb){return function(_0x228153){if(_0x228153){var _0x414262=typeof _0x59b4bb[_0x6cd1('0x1e')]==='undefined'&&typeof _0x59b4bb[_0x6cd1('0x1f')]===_0x6cd1('0x20');var _0x54e264=_0x228153[_0x6cd1('0x21')];var _0x25c06a=_0x414262?0x0:_0x59b4bb['offset'];var _0x10ac0d=_0x414262?_0x228153[_0x6cd1('0x21')]:_0x59b4bb[_0x6cd1('0x1e')]+_0x59b4bb[_0x6cd1('0x1f')];var _0x46867f;if(_0x10ac0d>=_0x54e264){_0x10ac0d=_0x54e264;_0x46867f=0xc8;}else{_0x46867f=0xce;}_0x4c50dd[_0x6cd1('0x1c')](_0x46867f);return _0x4c50dd['set'](_0x6cd1('0x22'),_0x25c06a+'-'+_0x10ac0d+'/'+_0x54e264)['json'](_0x228153);}return null;};}function patchUpdates(_0x2017df){return function(_0x36aa39){try{jsonpatch[_0x6cd1('0x23')](_0x36aa39,_0x2017df,!![]);}catch(_0x278c20){return BPromise[_0x6cd1('0x24')](_0x278c20);}return _0x36aa39['save']();};}function saveUpdates(_0x41ce38,_0x3c6416){return function(_0x4abb20){if(_0x4abb20){return _0x4abb20[_0x6cd1('0x25')](_0x41ce38)[_0x6cd1('0x26')](function(_0xc59c44){return _0xc59c44;});}return null;};}function removeEntity(_0x1c34e2,_0x2c4825){return function(_0x3b11d1){if(_0x3b11d1){return _0x3b11d1[_0x6cd1('0x27')]()[_0x6cd1('0x26')](function(){_0x1c34e2[_0x6cd1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x368723,_0x432c38){return function(_0x2ea9f2){if(!_0x2ea9f2){_0x368723[_0x6cd1('0x28')](0x194);}return _0x2ea9f2;};}function handleError(_0x30b523,_0x42919a){_0x42919a=_0x42919a||0x1f4;return function(_0x4e431a){logger['error'](_0x4e431a[_0x6cd1('0x29')]);if(_0x4e431a[_0x6cd1('0x2a')]){delete _0x4e431a[_0x6cd1('0x2a')];}_0x30b523[_0x6cd1('0x1c')](_0x42919a)[_0x6cd1('0x2b')](_0x4e431a);};}exports[_0x6cd1('0x2c')]=function(_0x46b06c,_0x24e5a5){var _0x5e2956={},_0x3129ad={},_0x516bb8={'count':0x0,'rows':[]};var _0xb790f=_[_0x6cd1('0x2d')](db[_0x6cd1('0x2e')][_0x6cd1('0x2f')],function(_0x4dae60){return{'name':_0x4dae60[_0x6cd1('0x30')],'type':_0x4dae60[_0x6cd1('0x31')][_0x6cd1('0x32')]};});_0x3129ad[_0x6cd1('0x33')]=_[_0x6cd1('0x2d')](_0xb790f,_0x6cd1('0x2a'));_0x3129ad[_0x6cd1('0x34')]=_['keys'](_0x46b06c[_0x6cd1('0x34')]);_0x3129ad[_0x6cd1('0x35')]=_[_0x6cd1('0x36')](_0x3129ad['model'],_0x3129ad[_0x6cd1('0x34')]);_0x5e2956[_0x6cd1('0x37')]=_[_0x6cd1('0x36')](_0x3129ad[_0x6cd1('0x33')],qs[_0x6cd1('0x38')](_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x5e2956['attributes']=_0x5e2956[_0x6cd1('0x37')][_0x6cd1('0x39')]?_0x5e2956[_0x6cd1('0x37')]:_0x3129ad[_0x6cd1('0x33')];if(!_0x46b06c[_0x6cd1('0x34')]['hasOwnProperty'](_0x6cd1('0x3a'))){_0x5e2956[_0x6cd1('0x1f')]=qs[_0x6cd1('0x1f')](_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x1f')]);_0x5e2956['offset']=qs[_0x6cd1('0x1e')](_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x1e')]);}_0x5e2956['order']=qs[_0x6cd1('0x3b')](_0x46b06c['query']['sort']);_0x5e2956['where']=qs['filters'](_[_0x6cd1('0x3c')](_0x46b06c['query'],_0x3129ad[_0x6cd1('0x35')]),_0xb790f);if(_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x3d')]){_0x5e2956['where']=_['merge'](_0x5e2956[_0x6cd1('0x3e')],{'$or':_[_0x6cd1('0x2d')](_0xb790f,function(_0x864911){if(_0x864911[_0x6cd1('0x31')]!==_0x6cd1('0x3f')){var _0x492014={};_0x492014[_0x864911[_0x6cd1('0x2a')]]={'$like':'%'+_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x3d')]+'%'};return _0x492014;}})});}_0x5e2956=_[_0x6cd1('0x40')]({},_0x5e2956,_0x46b06c[_0x6cd1('0x41')]);var _0x2b2f6b={'where':_0x5e2956[_0x6cd1('0x3e')]};return db[_0x6cd1('0x2e')][_0x6cd1('0x21')](_0x2b2f6b)[_0x6cd1('0x26')](function(_0x5e91fb){_0x516bb8[_0x6cd1('0x21')]=_0x5e91fb;if(_0x46b06c[_0x6cd1('0x34')]['includeAll']){_0x5e2956[_0x6cd1('0x42')]=[{'all':!![]}];}return db[_0x6cd1('0x2e')][_0x6cd1('0x43')](_0x5e2956);})['then'](function(_0x1bfdd0){_0x516bb8['rows']=_0x1bfdd0;return _0x516bb8;})[_0x6cd1('0x26')](respondWithFilteredResult(_0x24e5a5,_0x5e2956))[_0x6cd1('0x44')](handleError(_0x24e5a5,null));};exports[_0x6cd1('0x45')]=function(_0x509dd3,_0x45342b){var _0x4004fb={'raw':![],'where':{'id':_0x509dd3['params']['id']}},_0x1e9e78={};_0x1e9e78[_0x6cd1('0x33')]=_[_0x6cd1('0x46')](db[_0x6cd1('0x2e')]['rawAttributes']);_0x1e9e78['query']=_[_0x6cd1('0x46')](_0x509dd3[_0x6cd1('0x34')]);_0x1e9e78[_0x6cd1('0x35')]=_[_0x6cd1('0x36')](_0x1e9e78['model'],_0x1e9e78[_0x6cd1('0x34')]);_0x4004fb[_0x6cd1('0x37')]=_['intersection'](_0x1e9e78[_0x6cd1('0x33')],qs[_0x6cd1('0x38')](_0x509dd3[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x4004fb[_0x6cd1('0x37')]=_0x4004fb[_0x6cd1('0x37')][_0x6cd1('0x39')]?_0x4004fb[_0x6cd1('0x37')]:_0x1e9e78[_0x6cd1('0x33')];if(_0x509dd3['query'][_0x6cd1('0x47')]){_0x4004fb[_0x6cd1('0x42')]=[{'all':!![]}];}_0x4004fb=_[_0x6cd1('0x40')]({},_0x4004fb,_0x509dd3['options']);return db['SalesforceConfiguration']['find'](_0x4004fb)[_0x6cd1('0x26')](handleEntityNotFound(_0x45342b,null))['then'](respondWithResult(_0x45342b,null))[_0x6cd1('0x44')](handleError(_0x45342b,null));};exports[_0x6cd1('0x48')]=function(_0x5e53f7,_0x59067c){return db[_0x6cd1('0x2e')][_0x6cd1('0x48')](_0x5e53f7[_0x6cd1('0x49')],{})[_0x6cd1('0x26')](respondWithResult(_0x59067c,0xc9))['catch'](handleError(_0x59067c,null));};exports['update']=function(_0x2f57d6,_0x6a0a59){if(_0x2f57d6['body']['id']){delete _0x2f57d6['body']['id'];}return db['SalesforceConfiguration'][_0x6cd1('0x4a')]({'where':{'id':_0x2f57d6[_0x6cd1('0x4b')]['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0x6a0a59,null))[_0x6cd1('0x26')](saveUpdates(_0x2f57d6[_0x6cd1('0x49')],null))['then'](respondWithResult(_0x6a0a59,null))[_0x6cd1('0x44')](handleError(_0x6a0a59,null));};exports[_0x6cd1('0x27')]=function(_0x3081ad,_0x28267c){return db[_0x6cd1('0x2e')][_0x6cd1('0x4a')]({'where':{'id':_0x3081ad[_0x6cd1('0x4b')]['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0x28267c,null))['then'](removeEntity(_0x28267c,null))[_0x6cd1('0x44')](handleError(_0x28267c,null));};exports['getFields']=function(_0x46f905,_0xb10a4f,_0x45b2cb){var _0x520f75={};var _0x10ed04={};var _0x4dff6c;var _0x372cdb;return db['SalesforceConfiguration'][_0x6cd1('0x4c')]({'where':{'id':_0x46f905[_0x6cd1('0x4b')]['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0xb10a4f,null))[_0x6cd1('0x26')](function(_0xf930e){if(_0xf930e){_0x4dff6c=_0xf930e;_0x10ed04[_0x6cd1('0x33')]=_['keys'](db['SalesforceField'][_0x6cd1('0x2f')]);_0x10ed04[_0x6cd1('0x34')]=_[_0x6cd1('0x46')](_0x46f905[_0x6cd1('0x34')]);_0x10ed04[_0x6cd1('0x35')]=_[_0x6cd1('0x36')](_0x10ed04[_0x6cd1('0x33')],_0x10ed04[_0x6cd1('0x34')]);_0x520f75[_0x6cd1('0x37')]=_['intersection'](_0x10ed04[_0x6cd1('0x33')],qs[_0x6cd1('0x38')](_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x520f75[_0x6cd1('0x37')]=_0x520f75[_0x6cd1('0x37')][_0x6cd1('0x39')]?_0x520f75[_0x6cd1('0x37')]:_0x10ed04['model'];_0x520f75[_0x6cd1('0x4d')]=qs['sort'](_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x3b')]);_0x520f75[_0x6cd1('0x3e')]=qs[_0x6cd1('0x35')](_[_0x6cd1('0x3c')](_0x46f905[_0x6cd1('0x34')],_0x10ed04[_0x6cd1('0x35')]));if(_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x3d')]){_0x520f75[_0x6cd1('0x3e')]=_[_0x6cd1('0x40')](_0x520f75[_0x6cd1('0x3e')],{'$or':_[_0x6cd1('0x2d')](_0x520f75['attributes'],function(_0x585202){var _0x2e02ee={};_0x2e02ee[_0x585202]={'$like':'%'+_0x46f905[_0x6cd1('0x34')]['filter']+'%'};return _0x2e02ee;})});}_0x520f75=_['merge']({},_0x520f75,_0x46f905[_0x6cd1('0x41')]);return _0x4dff6c['getFields'](_0x520f75);}})['then'](function(_0x3ab239){if(_0x3ab239){_0x372cdb=_0x3ab239[_0x6cd1('0x39')];if(!_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x4e')]('nolimit')){_0x520f75['limit']=qs[_0x6cd1('0x1f')](_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x1f')]);_0x520f75['offset']=qs[_0x6cd1('0x1e')](_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x1e')]);}return _0x4dff6c[_0x6cd1('0x4f')](_0x520f75);}})[_0x6cd1('0x26')](function(_0x58311b){if(_0x58311b){return _0x58311b?{'count':_0x372cdb,'rows':_0x58311b}:null;}})[_0x6cd1('0x26')](respondWithResult(_0xb10a4f,null))['catch'](handleError(_0xb10a4f,null));};exports[_0x6cd1('0x50')]=function(_0x7df3e8,_0x97bd68,_0x43cd60){var _0x56181={};var _0x1bfc7b={};var _0x4b2366;var _0x229ac8;return db[_0x6cd1('0x2e')][_0x6cd1('0x4c')]({'where':{'id':_0x7df3e8[_0x6cd1('0x4b')]['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0x97bd68,null))[_0x6cd1('0x26')](function(_0x1a1b7f){if(_0x1a1b7f){_0x4b2366=_0x1a1b7f;_0x1bfc7b[_0x6cd1('0x33')]=_[_0x6cd1('0x46')](db[_0x6cd1('0x51')][_0x6cd1('0x2f')]);_0x1bfc7b['query']=_[_0x6cd1('0x46')](_0x7df3e8['query']);_0x1bfc7b['filters']=_[_0x6cd1('0x36')](_0x1bfc7b[_0x6cd1('0x33')],_0x1bfc7b[_0x6cd1('0x34')]);_0x56181['attributes']=_[_0x6cd1('0x36')](_0x1bfc7b['model'],qs[_0x6cd1('0x38')](_0x7df3e8[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x56181[_0x6cd1('0x37')]=_0x56181[_0x6cd1('0x37')]['length']?_0x56181['attributes']:_0x1bfc7b['model'];_0x56181[_0x6cd1('0x4d')]=qs[_0x6cd1('0x3b')](_0x7df3e8[_0x6cd1('0x34')][_0x6cd1('0x3b')]);_0x56181['where']=qs[_0x6cd1('0x35')](_[_0x6cd1('0x3c')](_0x7df3e8[_0x6cd1('0x34')],_0x1bfc7b['filters']));if(_0x7df3e8[_0x6cd1('0x34')][_0x6cd1('0x3d')]){_0x56181[_0x6cd1('0x3e')]=_[_0x6cd1('0x40')](_0x56181[_0x6cd1('0x3e')],{'$or':_['map'](_0x56181['attributes'],function(_0x5b2d57){var _0xb03af4={};_0xb03af4[_0x5b2d57]={'$like':'%'+_0x7df3e8[_0x6cd1('0x34')]['filter']+'%'};return _0xb03af4;})});}_0x56181=_[_0x6cd1('0x40')]({},_0x56181,_0x7df3e8['options']);return _0x4b2366[_0x6cd1('0x50')](_0x56181);}})[_0x6cd1('0x26')](function(_0x3e205b){if(_0x3e205b){_0x229ac8=_0x3e205b[_0x6cd1('0x39')];if(!_0x7df3e8[_0x6cd1('0x34')]['hasOwnProperty'](_0x6cd1('0x3a'))){_0x56181[_0x6cd1('0x1f')]=qs[_0x6cd1('0x1f')](_0x7df3e8[_0x6cd1('0x34')][_0x6cd1('0x1f')]);_0x56181[_0x6cd1('0x1e')]=qs['offset'](_0x7df3e8['query'][_0x6cd1('0x1e')]);}return _0x4b2366[_0x6cd1('0x50')](_0x56181);}})['then'](function(_0x58d8b2){if(_0x58d8b2){return _0x58d8b2?{'count':_0x229ac8,'rows':_0x58d8b2}:null;}})['then'](respondWithResult(_0x97bd68,null))[_0x6cd1('0x44')](handleError(_0x97bd68,null));};exports[_0x6cd1('0x52')]=function(_0x34c122,_0xc58347,_0x28d7ea){var _0x474aff={};var _0x34e6a9={};var _0x37fb37;var _0x5c9e84;return db[_0x6cd1('0x2e')][_0x6cd1('0x4c')]({'where':{'id':_0x34c122['params']['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0xc58347,null))[_0x6cd1('0x26')](function(_0x13a1be){if(_0x13a1be){_0x37fb37=_0x13a1be;_0x34e6a9[_0x6cd1('0x33')]=_['keys'](db['SalesforceField'][_0x6cd1('0x2f')]);_0x34e6a9[_0x6cd1('0x34')]=_[_0x6cd1('0x46')](_0x34c122[_0x6cd1('0x34')]);_0x34e6a9[_0x6cd1('0x35')]=_[_0x6cd1('0x36')](_0x34e6a9[_0x6cd1('0x33')],_0x34e6a9[_0x6cd1('0x34')]);_0x474aff[_0x6cd1('0x37')]=_[_0x6cd1('0x36')](_0x34e6a9[_0x6cd1('0x33')],qs[_0x6cd1('0x38')](_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x474aff[_0x6cd1('0x37')]=_0x474aff[_0x6cd1('0x37')]['length']?_0x474aff[_0x6cd1('0x37')]:_0x34e6a9[_0x6cd1('0x33')];_0x474aff[_0x6cd1('0x4d')]=qs[_0x6cd1('0x3b')](_0x34c122['query'][_0x6cd1('0x3b')]);_0x474aff['where']=qs[_0x6cd1('0x35')](_[_0x6cd1('0x3c')](_0x34c122[_0x6cd1('0x34')],_0x34e6a9[_0x6cd1('0x35')]));if(_0x34c122['query'][_0x6cd1('0x3d')]){_0x474aff[_0x6cd1('0x3e')]=_['merge'](_0x474aff[_0x6cd1('0x3e')],{'$or':_[_0x6cd1('0x2d')](_0x474aff['attributes'],function(_0x3dfc60){var _0x2f013a={};_0x2f013a[_0x3dfc60]={'$like':'%'+_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x3d')]+'%'};return _0x2f013a;})});}_0x474aff=_['merge']({},_0x474aff,_0x34c122[_0x6cd1('0x41')]);return _0x37fb37[_0x6cd1('0x52')](_0x474aff);}})[_0x6cd1('0x26')](function(_0xba136b){if(_0xba136b){_0x5c9e84=_0xba136b[_0x6cd1('0x39')];if(!_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x4e')](_0x6cd1('0x3a'))){_0x474aff[_0x6cd1('0x1f')]=qs['limit'](_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x1f')]);_0x474aff[_0x6cd1('0x1e')]=qs['offset'](_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x1e')]);}return _0x37fb37[_0x6cd1('0x52')](_0x474aff);}})[_0x6cd1('0x26')](function(_0x5ed972){if(_0x5ed972){return _0x5ed972?{'count':_0x5c9e84,'rows':_0x5ed972}:null;}})[_0x6cd1('0x26')](respondWithResult(_0xc58347,null))[_0x6cd1('0x44')](handleError(_0xc58347,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 179a1fc..ec2f149 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 _0x8b35=['./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x156b07,_0x131d73){var _0xa1d674=function(_0x3b9616){while(--_0x3b9616){_0x156b07['push'](_0x156b07['shift']());}};_0xa1d674(++_0x131d73);}(_0x8b35,0xb8));var _0x58b3=function(_0x3a3d23,_0x9dacfa){_0x3a3d23=_0x3a3d23-0x0;var _0x337899=_0x8b35[_0x3a3d23];return _0x337899;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x58b3('0x0'))('api');var moment=require(_0x58b3('0x1'));var BPromise=require(_0x58b3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x58b3('0x3'));var rimraf=require(_0x58b3('0x4'));var config=require(_0x58b3('0x5'));var attributes=require(_0x58b3('0x6'));module[_0x58b3('0x7')]=function(_0x45ace5,_0x2dd9cb){return _0x45ace5[_0x58b3('0x8')](_0x58b3('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeab4=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports'];(function(_0x2ba104,_0x2f5851){var _0x36ccd3=function(_0x4d0779){while(--_0x4d0779){_0x2ba104['push'](_0x2ba104['shift']());}};_0x36ccd3(++_0x2f5851);}(_0xeab4,0x1da));var _0x4eab=function(_0x41cb38,_0x448564){_0x41cb38=_0x41cb38-0x0;var _0x27efe2=_0xeab4[_0x41cb38];return _0x27efe2;};'use strict';var _=require(_0x4eab('0x0'));var util=require(_0x4eab('0x1'));var logger=require(_0x4eab('0x2'))(_0x4eab('0x3'));var moment=require(_0x4eab('0x4'));var BPromise=require('bluebird');var rp=require(_0x4eab('0x5'));var fs=require('fs');var path=require(_0x4eab('0x6'));var rimraf=require(_0x4eab('0x7'));var config=require('../../config/environment');var attributes=require(_0x4eab('0x8'));module[_0x4eab('0x9')]=function(_0x962e01,_0x41d2f8){return _0x962e01['define']('SalesforceConfiguration',attributes,{'tableName':_0x4eab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index aea02e6..fef1c2c 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 _0xc001=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x118e77,_0x5d9158){var _0x494a22=function(_0x22b04e){while(--_0x22b04e){_0x118e77['push'](_0x118e77['shift']());}};_0x494a22(++_0x5d9158);}(_0xc001,0x1d8));var _0x1c00=function(_0x16cdfd,_0x3180cc){_0x16cdfd=_0x16cdfd-0x0;var _0x2d8581=_0xc001[_0x16cdfd];return _0x2d8581;};'use strict';var _=require('lodash');var util=require(_0x1c00('0x0'));var moment=require(_0x1c00('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c00('0x2'));var db=require(_0x1c00('0x3'))['db'];var utils=require(_0x1c00('0x4'));var logger=require(_0x1c00('0x5'))('rpc');var config=require(_0x1c00('0x6'));var jayson=require(_0x1c00('0x7'));var client=jayson[_0x1c00('0x8')][_0x1c00('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2871bc,_0xf7d5df,_0x34855b){return new BPromise(function(_0x373eca,_0x24bc31){return client['request'](_0x2871bc,_0x34855b)[_0x1c00('0xa')](function(_0x4401f0){logger['info'](_0x1c00('0xb'),_0xf7d5df,_0x1c00('0xc'));logger[_0x1c00('0xd')](_0x1c00('0xe'),_0xf7d5df,'request\x20sent',JSON[_0x1c00('0xf')](_0x4401f0));if(_0x4401f0[_0x1c00('0x10')]){if(_0x4401f0[_0x1c00('0x10')][_0x1c00('0x11')]===0x1f4){logger[_0x1c00('0x10')](_0x1c00('0xb'),_0xf7d5df,_0x4401f0[_0x1c00('0x10')][_0x1c00('0x12')]);return _0x24bc31(_0x4401f0[_0x1c00('0x10')]['message']);}logger[_0x1c00('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0xf7d5df,_0x4401f0['error'][_0x1c00('0x12')]);return _0x373eca(_0x4401f0[_0x1c00('0x10')][_0x1c00('0x12')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0xf7d5df,_0x1c00('0xc'));_0x373eca(_0x4401f0[_0x1c00('0x13')][_0x1c00('0x12')]);}})[_0x1c00('0x14')](function(_0x4e32b7){logger['error'](_0x1c00('0xb'),_0xf7d5df,_0x4e32b7);_0x24bc31(_0x4e32b7);});});} \ No newline at end of file +var _0x5941=['code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x349ad5,_0x104a5f){var _0x5e9212=function(_0x5e9d34){while(--_0x5e9d34){_0x349ad5['push'](_0x349ad5['shift']());}};_0x5e9212(++_0x104a5f);}(_0x5941,0x88));var _0x1594=function(_0x212599,_0x5b59af){_0x212599=_0x212599-0x0;var _0x429f2d=_0x5941[_0x212599];return _0x429f2d;};'use strict';var _=require('lodash');var util=require(_0x1594('0x0'));var moment=require('moment');var BPromise=require(_0x1594('0x1'));var rs=require(_0x1594('0x2'));var fs=require('fs');var Redis=require(_0x1594('0x3'));var db=require(_0x1594('0x4'))['db'];var utils=require(_0x1594('0x5'));var logger=require(_0x1594('0x6'))(_0x1594('0x7'));var config=require('../../config/environment');var jayson=require(_0x1594('0x8'));var client=jayson[_0x1594('0x9')][_0x1594('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54dcf0,_0x2ac416,_0x5e168f){return new BPromise(function(_0x3e9a27,_0x3873e2){return client['request'](_0x54dcf0,_0x5e168f)[_0x1594('0xb')](function(_0x26fa23){logger[_0x1594('0xc')](_0x1594('0xd'),_0x2ac416,_0x1594('0xe'));logger[_0x1594('0xf')](_0x1594('0x10'),_0x2ac416,'request\x20sent',JSON['stringify'](_0x26fa23));if(_0x26fa23[_0x1594('0x11')]){if(_0x26fa23[_0x1594('0x11')][_0x1594('0x12')]===0x1f4){logger[_0x1594('0x11')](_0x1594('0xd'),_0x2ac416,_0x26fa23[_0x1594('0x11')][_0x1594('0x13')]);return _0x3873e2(_0x26fa23[_0x1594('0x11')][_0x1594('0x13')]);}logger[_0x1594('0x11')](_0x1594('0xd'),_0x2ac416,_0x26fa23[_0x1594('0x11')][_0x1594('0x13')]);return _0x3e9a27(_0x26fa23[_0x1594('0x11')][_0x1594('0x13')]);}else{logger[_0x1594('0xc')](_0x1594('0xd'),_0x2ac416,'request\x20sent');_0x3e9a27(_0x26fa23[_0x1594('0x14')][_0x1594('0x13')]);}})[_0x1594('0x15')](function(_0x4343f9){logger[_0x1594('0x11')](_0x1594('0xd'),_0x2ac416,_0x4343f9);_0x3873e2(_0x4343f9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 776d3c2..e04b729 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 _0x1a09=['exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','post','put','destroy'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1a09,0x1eb));var _0x91a0=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x1a09[_0x2bf141];return _0x48277b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x91a0('0x0'));var express=require(_0x91a0('0x1'));var router=express[_0x91a0('0x2')]();var fs_extra=require(_0x91a0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x91a0('0x4'));var config=require(_0x91a0('0x5'));var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x91a0('0x6')]);router[_0x91a0('0x7')](_0x91a0('0x8'),auth[_0x91a0('0x9')](),controller['show']);router[_0x91a0('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x91a0('0xb')](_0x91a0('0x8'),auth[_0x91a0('0x9')](),controller['update']);router['delete'](_0x91a0('0x8'),auth[_0x91a0('0x9')](),controller[_0x91a0('0xc')]);module[_0x91a0('0xd')]=router; \ No newline at end of file +var _0xe6a9=['../../config/environment','./intSalesforceField.controller','get','/:id','isAuthenticated','create','update','delete','destroy','exports','util','Router','fs-extra','../../components/auth/service'];(function(_0x383ebb,_0x210f23){var _0x207a70=function(_0x29f8a9){while(--_0x29f8a9){_0x383ebb['push'](_0x383ebb['shift']());}};_0x207a70(++_0x210f23);}(_0xe6a9,0x184));var _0x9e6a=function(_0x20cca4,_0x5f456f){_0x20cca4=_0x20cca4-0x0;var _0x100fa4=_0xe6a9[_0x20cca4];return _0x100fa4;};'use strict';var multer=require('multer');var util=require(_0x9e6a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e6a('0x1')]();var fs_extra=require(_0x9e6a('0x2'));var auth=require(_0x9e6a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9e6a('0x4'));var controller=require(_0x9e6a('0x5'));router[_0x9e6a('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9e6a('0x6')](_0x9e6a('0x7'),auth[_0x9e6a('0x8')](),controller['show']);router['post']('/',auth[_0x9e6a('0x8')](),controller[_0x9e6a('0x9')]);router['put'](_0x9e6a('0x7'),auth[_0x9e6a('0x8')](),controller[_0x9e6a('0xa')]);router[_0x9e6a('0xb')](_0x9e6a('0x7'),auth[_0x9e6a('0x8')](),controller[_0x9e6a('0xc')]);module[_0x9e6a('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 777ad31..3f7d29a 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 _0xfac2=['picklist','STRING','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0xb84057,_0x22ad92){var _0x11c875=function(_0x312b19){while(--_0x312b19){_0xb84057['push'](_0xb84057['shift']());}};_0x11c875(++_0x22ad92);}(_0xfac2,0xfa));var _0x2fac=function(_0x263d88,_0x5cd913){_0x263d88=_0x263d88-0x0;var _0x212585=_0xfac2[_0x263d88];return _0x212585;};'use strict';var Sequelize=require(_0x2fac('0x0'));module[_0x2fac('0x1')]={'type':{'type':Sequelize[_0x2fac('0x2')](_0x2fac('0x3'),_0x2fac('0x4'),'customVariable',_0x2fac('0x5'),_0x2fac('0x6')),'defaultValue':_0x2fac('0x3')},'content':{'type':Sequelize[_0x2fac('0x7')]},'key':{'type':Sequelize[_0x2fac('0x7')]},'keyType':{'type':Sequelize[_0x2fac('0x2')](_0x2fac('0x3'),_0x2fac('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x2fac('0x7')]},'idField':{'type':Sequelize[_0x2fac('0x7')]},'variableName':{'type':Sequelize[_0x2fac('0x7')]}}; \ No newline at end of file +var _0x214b=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x214b,0x170));var _0xb214=function(_0x9ba722,_0xec716c){_0x9ba722=_0x9ba722-0x0;var _0x6a5e79=_0x214b[_0x9ba722];return _0x6a5e79;};'use strict';var Sequelize=require(_0xb214('0x0'));module[_0xb214('0x1')]={'type':{'type':Sequelize[_0xb214('0x2')](_0xb214('0x3'),_0xb214('0x4'),_0xb214('0x5'),_0xb214('0x6'),'picklist'),'defaultValue':_0xb214('0x3')},'content':{'type':Sequelize[_0xb214('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb214('0x2')](_0xb214('0x3'),_0xb214('0x4'),_0xb214('0x5'))},'keyContent':{'type':Sequelize[_0xb214('0x7')]},'idField':{'type':Sequelize[_0xb214('0x7')]},'variableName':{'type':Sequelize[_0xb214('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 611fd1c..435f362 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 _0xd8c0=['options','rows','show','params','keys','include','find','catch','create','body','update','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','apply','reject','save','then','destroy','end','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL'];(function(_0x3e79a1,_0x4aae6d){var _0x37c668=function(_0x28474b){while(--_0x28474b){_0x3e79a1['push'](_0x3e79a1['shift']());}};_0x37c668(++_0x4aae6d);}(_0xd8c0,0x93));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d8c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d8c('0x1'));var Mustache=require(_0x0d8c('0x2'));var util=require(_0x0d8c('0x3'));var path=require('path');var sox=require(_0x0d8c('0x4'));var csv=require(_0x0d8c('0x5'));var ejs=require(_0x0d8c('0x6'));var fs=require('fs');var fs_extra=require(_0x0d8c('0x7'));var _=require(_0x0d8c('0x8'));var squel=require('squel');var crypto=require(_0x0d8c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0d8c('0xa'));var toCsv=require(_0x0d8c('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0d8c('0xb'));var authService=require(_0x0d8c('0xc'));var qs=require(_0x0d8c('0xd'));var as=require(_0x0d8c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d8c('0xf'))(_0x0d8c('0x10'));var utils=require(_0x0d8c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x0d8c('0x12'));var db=require(_0x0d8c('0x13'))['db'];function respondWithStatusCode(_0x829368,_0x3efa55){_0x3efa55=_0x3efa55||0xcc;return function(_0x2f33ba){if(_0x2f33ba){return _0x829368[_0x0d8c('0x14')](_0x3efa55);}return _0x829368[_0x0d8c('0x15')](_0x3efa55)['end']();};}function respondWithResult(_0xd4ceb0,_0x3f974b){_0x3f974b=_0x3f974b||0xc8;return function(_0x2af878){if(_0x2af878){return _0xd4ceb0[_0x0d8c('0x15')](_0x3f974b)[_0x0d8c('0x16')](_0x2af878);}};}function respondWithFilteredResult(_0x53e3dc,_0x3b83e8){return function(_0x2ce4d3){if(_0x2ce4d3){var _0x4a68f4=typeof _0x3b83e8['offset']===_0x0d8c('0x17')&&typeof _0x3b83e8['limit']===_0x0d8c('0x17');var _0x52eb73=_0x2ce4d3[_0x0d8c('0x18')];var _0x3b7240=_0x4a68f4?0x0:_0x3b83e8[_0x0d8c('0x19')];var _0x260d1a=_0x4a68f4?_0x2ce4d3[_0x0d8c('0x18')]:_0x3b83e8[_0x0d8c('0x19')]+_0x3b83e8['limit'];var _0x237e0b;if(_0x260d1a>=_0x52eb73){_0x260d1a=_0x52eb73;_0x237e0b=0xc8;}else{_0x237e0b=0xce;}_0x53e3dc['status'](_0x237e0b);return _0x53e3dc[_0x0d8c('0x1a')]('Content-Range',_0x3b7240+'-'+_0x260d1a+'/'+_0x52eb73)[_0x0d8c('0x16')](_0x2ce4d3);}return null;};}function patchUpdates(_0x429062){return function(_0x23e85b){try{jsonpatch[_0x0d8c('0x1b')](_0x23e85b,_0x429062,!![]);}catch(_0x4af652){return BPromise[_0x0d8c('0x1c')](_0x4af652);}return _0x23e85b[_0x0d8c('0x1d')]();};}function saveUpdates(_0xcd5b78,_0x54f85c){return function(_0x320d06){if(_0x320d06){return _0x320d06['update'](_0xcd5b78)[_0x0d8c('0x1e')](function(_0x2b0974){return _0x2b0974;});}return null;};}function removeEntity(_0x415f1a,_0x49b6f9){return function(_0x314261){if(_0x314261){return _0x314261[_0x0d8c('0x1f')]()[_0x0d8c('0x1e')](function(){_0x415f1a[_0x0d8c('0x15')](0xcc)[_0x0d8c('0x20')]();});}};}function handleEntityNotFound(_0x12682f,_0x496aaa){return function(_0x1ef551){if(!_0x1ef551){_0x12682f[_0x0d8c('0x14')](0x194);}return _0x1ef551;};}function handleError(_0x24e989,_0x2b69db){_0x2b69db=_0x2b69db||0x1f4;return function(_0x3608fe){logger[_0x0d8c('0x21')](_0x3608fe['stack']);if(_0x3608fe[_0x0d8c('0x22')]){delete _0x3608fe[_0x0d8c('0x22')];}_0x24e989['status'](_0x2b69db)[_0x0d8c('0x23')](_0x3608fe);};}exports[_0x0d8c('0x24')]=function(_0x56753c,_0x192586){var _0x4e9319={},_0xc24f7c={},_0x18e046={'count':0x0,'rows':[]};var _0x706892=_[_0x0d8c('0x25')](db[_0x0d8c('0x26')][_0x0d8c('0x27')],function(_0x188293){return{'name':_0x188293[_0x0d8c('0x28')],'type':_0x188293[_0x0d8c('0x29')][_0x0d8c('0x2a')]};});_0xc24f7c['model']=_['map'](_0x706892,_0x0d8c('0x22'));_0xc24f7c[_0x0d8c('0x2b')]=_['keys'](_0x56753c['query']);_0xc24f7c[_0x0d8c('0x2c')]=_['intersection'](_0xc24f7c[_0x0d8c('0x2d')],_0xc24f7c['query']);_0x4e9319['attributes']=_[_0x0d8c('0x2e')](_0xc24f7c[_0x0d8c('0x2d')],qs[_0x0d8c('0x2f')](_0x56753c[_0x0d8c('0x2b')][_0x0d8c('0x2f')]));_0x4e9319[_0x0d8c('0x30')]=_0x4e9319[_0x0d8c('0x30')][_0x0d8c('0x31')]?_0x4e9319[_0x0d8c('0x30')]:_0xc24f7c[_0x0d8c('0x2d')];if(!_0x56753c['query'][_0x0d8c('0x32')](_0x0d8c('0x33'))){_0x4e9319[_0x0d8c('0x34')]=qs[_0x0d8c('0x34')](_0x56753c[_0x0d8c('0x2b')]['limit']);_0x4e9319[_0x0d8c('0x19')]=qs[_0x0d8c('0x19')](_0x56753c['query'][_0x0d8c('0x19')]);}_0x4e9319['order']=qs[_0x0d8c('0x35')](_0x56753c['query'][_0x0d8c('0x35')]);_0x4e9319[_0x0d8c('0x36')]=qs[_0x0d8c('0x2c')](_['pick'](_0x56753c[_0x0d8c('0x2b')],_0xc24f7c[_0x0d8c('0x2c')]),_0x706892);if(_0x56753c['query']['filter']){_0x4e9319[_0x0d8c('0x36')]=_[_0x0d8c('0x37')](_0x4e9319[_0x0d8c('0x36')],{'$or':_[_0x0d8c('0x25')](_0x706892,function(_0x289aa2){if(_0x289aa2[_0x0d8c('0x29')]!==_0x0d8c('0x38')){var _0x39f207={};_0x39f207[_0x289aa2['name']]={'$like':'%'+_0x56753c[_0x0d8c('0x2b')]['filter']+'%'};return _0x39f207;}})});}_0x4e9319=_[_0x0d8c('0x37')]({},_0x4e9319,_0x56753c[_0x0d8c('0x39')]);var _0x415e1d={'where':_0x4e9319[_0x0d8c('0x36')]};return db[_0x0d8c('0x26')][_0x0d8c('0x18')](_0x415e1d)['then'](function(_0x2fdc18){_0x18e046['count']=_0x2fdc18;if(_0x56753c[_0x0d8c('0x2b')]['includeAll']){_0x4e9319['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x4e9319);})['then'](function(_0x58ed75){_0x18e046[_0x0d8c('0x3a')]=_0x58ed75;return _0x18e046;})[_0x0d8c('0x1e')](respondWithFilteredResult(_0x192586,_0x4e9319))['catch'](handleError(_0x192586,null));};exports[_0x0d8c('0x3b')]=function(_0xa002c1,_0x26c26c){var _0x1e2b6e={'raw':!![],'where':{'id':_0xa002c1[_0x0d8c('0x3c')]['id']}},_0x378acb={};_0x378acb[_0x0d8c('0x2d')]=_[_0x0d8c('0x3d')](db[_0x0d8c('0x26')]['rawAttributes']);_0x378acb['query']=_['keys'](_0xa002c1[_0x0d8c('0x2b')]);_0x378acb[_0x0d8c('0x2c')]=_[_0x0d8c('0x2e')](_0x378acb[_0x0d8c('0x2d')],_0x378acb['query']);_0x1e2b6e[_0x0d8c('0x30')]=_[_0x0d8c('0x2e')](_0x378acb[_0x0d8c('0x2d')],qs[_0x0d8c('0x2f')](_0xa002c1[_0x0d8c('0x2b')][_0x0d8c('0x2f')]));_0x1e2b6e[_0x0d8c('0x30')]=_0x1e2b6e[_0x0d8c('0x30')][_0x0d8c('0x31')]?_0x1e2b6e[_0x0d8c('0x30')]:_0x378acb['model'];if(_0xa002c1[_0x0d8c('0x2b')]['includeAll']){_0x1e2b6e[_0x0d8c('0x3e')]=[{'all':!![]}];}_0x1e2b6e=_[_0x0d8c('0x37')]({},_0x1e2b6e,_0xa002c1[_0x0d8c('0x39')]);return db[_0x0d8c('0x26')][_0x0d8c('0x3f')](_0x1e2b6e)[_0x0d8c('0x1e')](handleEntityNotFound(_0x26c26c,null))['then'](respondWithResult(_0x26c26c,null))[_0x0d8c('0x40')](handleError(_0x26c26c,null));};exports['create']=function(_0x5ea02c,_0x15af20){return db[_0x0d8c('0x26')][_0x0d8c('0x41')](_0x5ea02c[_0x0d8c('0x42')],{})[_0x0d8c('0x1e')](respondWithResult(_0x15af20,0xc9))[_0x0d8c('0x40')](handleError(_0x15af20,null));};exports[_0x0d8c('0x43')]=function(_0x2a4000,_0x1d0442){if(_0x2a4000['body']['id']){delete _0x2a4000[_0x0d8c('0x42')]['id'];}return db[_0x0d8c('0x26')][_0x0d8c('0x3f')]({'where':{'id':_0x2a4000[_0x0d8c('0x3c')]['id']}})[_0x0d8c('0x1e')](handleEntityNotFound(_0x1d0442,null))[_0x0d8c('0x1e')](saveUpdates(_0x2a4000[_0x0d8c('0x42')],null))[_0x0d8c('0x1e')](respondWithResult(_0x1d0442,null))[_0x0d8c('0x40')](handleError(_0x1d0442,null));};exports['destroy']=function(_0x14b2bf,_0x2c4bda){return db[_0x0d8c('0x26')][_0x0d8c('0x3f')]({'where':{'id':_0x14b2bf['params']['id']}})[_0x0d8c('0x1e')](handleEntityNotFound(_0x2c4bda,null))['then'](removeEntity(_0x2c4bda,null))[_0x0d8c('0x40')](handleError(_0x2c4bda,null));}; \ No newline at end of file +var _0x7384=['save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','options','where','SalesforceField','findAll','rows','catch','show','params','keys','length','includeAll','include','create','body','find','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','fs-extra','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x46d78e,_0x29e9c5){var _0x557a79=function(_0x26caf7){while(--_0x26caf7){_0x46d78e['push'](_0x46d78e['shift']());}};_0x557a79(++_0x29e9c5);}(_0x7384,0x133));var _0x4738=function(_0x1c0e5f,_0xe7aca0){_0x1c0e5f=_0x1c0e5f-0x0;var _0x3b9b87=_0x7384[_0x1c0e5f];return _0x3b9b87;};'use strict';var emlformat=require(_0x4738('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4738('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4738('0x2'));var moment=require('moment');var BPromise=require(_0x4738('0x3'));var Mustache=require(_0x4738('0x4'));var util=require('util');var path=require(_0x4738('0x5'));var sox=require(_0x4738('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4738('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4738('0x8'));var jsforce=require(_0x4738('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4738('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4738('0xb'));var authService=require(_0x4738('0xc'));var qs=require(_0x4738('0xd'));var as=require(_0x4738('0xe'));var hardwareService=require(_0x4738('0xf'));var logger=require(_0x4738('0x10'))('api');var utils=require(_0x4738('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4738('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b7fd1,_0xa55342){_0xa55342=_0xa55342||0xcc;return function(_0x3fc5dc){if(_0x3fc5dc){return _0x1b7fd1['sendStatus'](_0xa55342);}return _0x1b7fd1[_0x4738('0x13')](_0xa55342)['end']();};}function respondWithResult(_0x1ff4e6,_0x2afbc2){_0x2afbc2=_0x2afbc2||0xc8;return function(_0x9b58f9){if(_0x9b58f9){return _0x1ff4e6[_0x4738('0x13')](_0x2afbc2)['json'](_0x9b58f9);}};}function respondWithFilteredResult(_0x1fb496,_0x1f90ea){return function(_0x5c0c78){if(_0x5c0c78){var _0x2b71c7=typeof _0x1f90ea[_0x4738('0x14')]===_0x4738('0x15')&&typeof _0x1f90ea[_0x4738('0x16')]===_0x4738('0x15');var _0xa0a98c=_0x5c0c78['count'];var _0x4f7515=_0x2b71c7?0x0:_0x1f90ea[_0x4738('0x14')];var _0x4e5dc6=_0x2b71c7?_0x5c0c78[_0x4738('0x17')]:_0x1f90ea[_0x4738('0x14')]+_0x1f90ea[_0x4738('0x16')];var _0x167249;if(_0x4e5dc6>=_0xa0a98c){_0x4e5dc6=_0xa0a98c;_0x167249=0xc8;}else{_0x167249=0xce;}_0x1fb496['status'](_0x167249);return _0x1fb496[_0x4738('0x18')]('Content-Range',_0x4f7515+'-'+_0x4e5dc6+'/'+_0xa0a98c)[_0x4738('0x19')](_0x5c0c78);}return null;};}function patchUpdates(_0x18981a){return function(_0x1f2560){try{jsonpatch[_0x4738('0x1a')](_0x1f2560,_0x18981a,!![]);}catch(_0x59fcd5){return BPromise[_0x4738('0x1b')](_0x59fcd5);}return _0x1f2560[_0x4738('0x1c')]();};}function saveUpdates(_0x212b29,_0x1644ad){return function(_0x1d5568){if(_0x1d5568){return _0x1d5568[_0x4738('0x1d')](_0x212b29)[_0x4738('0x1e')](function(_0x1f5324){return _0x1f5324;});}return null;};}function removeEntity(_0x4fc7cb,_0x55bf2a){return function(_0x111673){if(_0x111673){return _0x111673['destroy']()[_0x4738('0x1e')](function(){_0x4fc7cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x652de5,_0x426d78){return function(_0x2c0bc5){if(!_0x2c0bc5){_0x652de5['sendStatus'](0x194);}return _0x2c0bc5;};}function handleError(_0x80d863,_0x318c65){_0x318c65=_0x318c65||0x1f4;return function(_0x2f9b7c){logger[_0x4738('0x1f')](_0x2f9b7c[_0x4738('0x20')]);if(_0x2f9b7c['name']){delete _0x2f9b7c[_0x4738('0x21')];}_0x80d863[_0x4738('0x13')](_0x318c65)[_0x4738('0x22')](_0x2f9b7c);};}exports[_0x4738('0x23')]=function(_0x8c0e2e,_0x39119f){var _0x1f2b3d={},_0x5e0bbd={},_0x134976={'count':0x0,'rows':[]};var _0x516ff2=_[_0x4738('0x24')](db['SalesforceField'][_0x4738('0x25')],function(_0x138b24){return{'name':_0x138b24[_0x4738('0x26')],'type':_0x138b24[_0x4738('0x27')]['key']};});_0x5e0bbd[_0x4738('0x28')]=_['map'](_0x516ff2,_0x4738('0x21'));_0x5e0bbd['query']=_['keys'](_0x8c0e2e[_0x4738('0x29')]);_0x5e0bbd[_0x4738('0x2a')]=_[_0x4738('0x2b')](_0x5e0bbd[_0x4738('0x28')],_0x5e0bbd[_0x4738('0x29')]);_0x1f2b3d[_0x4738('0x2c')]=_[_0x4738('0x2b')](_0x5e0bbd['model'],qs['fields'](_0x8c0e2e[_0x4738('0x29')][_0x4738('0x2d')]));_0x1f2b3d[_0x4738('0x2c')]=_0x1f2b3d[_0x4738('0x2c')]['length']?_0x1f2b3d[_0x4738('0x2c')]:_0x5e0bbd['model'];if(!_0x8c0e2e[_0x4738('0x29')][_0x4738('0x2e')]('nolimit')){_0x1f2b3d[_0x4738('0x16')]=qs[_0x4738('0x16')](_0x8c0e2e[_0x4738('0x29')]['limit']);_0x1f2b3d[_0x4738('0x14')]=qs[_0x4738('0x14')](_0x8c0e2e[_0x4738('0x29')]['offset']);}_0x1f2b3d['order']=qs[_0x4738('0x2f')](_0x8c0e2e['query']['sort']);_0x1f2b3d['where']=qs[_0x4738('0x2a')](_[_0x4738('0x30')](_0x8c0e2e[_0x4738('0x29')],_0x5e0bbd[_0x4738('0x2a')]),_0x516ff2);if(_0x8c0e2e['query'][_0x4738('0x31')]){_0x1f2b3d['where']=_[_0x4738('0x32')](_0x1f2b3d['where'],{'$or':_[_0x4738('0x24')](_0x516ff2,function(_0x85d344){if(_0x85d344[_0x4738('0x27')]!==_0x4738('0x33')){var _0x52bcd8={};_0x52bcd8[_0x85d344[_0x4738('0x21')]]={'$like':'%'+_0x8c0e2e[_0x4738('0x29')][_0x4738('0x31')]+'%'};return _0x52bcd8;}})});}_0x1f2b3d=_[_0x4738('0x32')]({},_0x1f2b3d,_0x8c0e2e[_0x4738('0x34')]);var _0x441864={'where':_0x1f2b3d[_0x4738('0x35')]};return db[_0x4738('0x36')][_0x4738('0x17')](_0x441864)['then'](function(_0x4ec973){_0x134976[_0x4738('0x17')]=_0x4ec973;if(_0x8c0e2e[_0x4738('0x29')]['includeAll']){_0x1f2b3d['include']=[{'all':!![]}];}return db[_0x4738('0x36')][_0x4738('0x37')](_0x1f2b3d);})['then'](function(_0x3e626a){_0x134976[_0x4738('0x38')]=_0x3e626a;return _0x134976;})[_0x4738('0x1e')](respondWithFilteredResult(_0x39119f,_0x1f2b3d))[_0x4738('0x39')](handleError(_0x39119f,null));};exports[_0x4738('0x3a')]=function(_0x1a9947,_0x5283c6){var _0x52260d={'raw':!![],'where':{'id':_0x1a9947[_0x4738('0x3b')]['id']}},_0x42144f={};_0x42144f[_0x4738('0x28')]=_[_0x4738('0x3c')](db[_0x4738('0x36')][_0x4738('0x25')]);_0x42144f[_0x4738('0x29')]=_[_0x4738('0x3c')](_0x1a9947[_0x4738('0x29')]);_0x42144f[_0x4738('0x2a')]=_[_0x4738('0x2b')](_0x42144f[_0x4738('0x28')],_0x42144f[_0x4738('0x29')]);_0x52260d[_0x4738('0x2c')]=_['intersection'](_0x42144f[_0x4738('0x28')],qs[_0x4738('0x2d')](_0x1a9947[_0x4738('0x29')][_0x4738('0x2d')]));_0x52260d['attributes']=_0x52260d['attributes'][_0x4738('0x3d')]?_0x52260d[_0x4738('0x2c')]:_0x42144f[_0x4738('0x28')];if(_0x1a9947[_0x4738('0x29')][_0x4738('0x3e')]){_0x52260d[_0x4738('0x3f')]=[{'all':!![]}];}_0x52260d=_[_0x4738('0x32')]({},_0x52260d,_0x1a9947[_0x4738('0x34')]);return db['SalesforceField']['find'](_0x52260d)[_0x4738('0x1e')](handleEntityNotFound(_0x5283c6,null))[_0x4738('0x1e')](respondWithResult(_0x5283c6,null))[_0x4738('0x39')](handleError(_0x5283c6,null));};exports[_0x4738('0x40')]=function(_0x4ae5c9,_0x5c6830){return db['SalesforceField'][_0x4738('0x40')](_0x4ae5c9[_0x4738('0x41')],{})[_0x4738('0x1e')](respondWithResult(_0x5c6830,0xc9))[_0x4738('0x39')](handleError(_0x5c6830,null));};exports[_0x4738('0x1d')]=function(_0x1a7a60,_0x31415c){if(_0x1a7a60['body']['id']){delete _0x1a7a60[_0x4738('0x41')]['id'];}return db['SalesforceField'][_0x4738('0x42')]({'where':{'id':_0x1a7a60[_0x4738('0x3b')]['id']}})[_0x4738('0x1e')](handleEntityNotFound(_0x31415c,null))['then'](saveUpdates(_0x1a7a60[_0x4738('0x41')],null))[_0x4738('0x1e')](respondWithResult(_0x31415c,null))[_0x4738('0x39')](handleError(_0x31415c,null));};exports['destroy']=function(_0x3259dd,_0x4bb142){return db['SalesforceField'][_0x4738('0x42')]({'where':{'id':_0x3259dd[_0x4738('0x3b')]['id']}})[_0x4738('0x1e')](handleEntityNotFound(_0x4bb142,null))['then'](removeEntity(_0x4bb142,null))[_0x4738('0x39')](handleError(_0x4bb142,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 89e842c..534f6d4 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 _0x3481=['request-promise','path','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','api','moment','bluebird'];(function(_0x74895e,_0x298c35){var _0x40bc2a=function(_0x558c6d){while(--_0x558c6d){_0x74895e['push'](_0x74895e['shift']());}};_0x40bc2a(++_0x298c35);}(_0x3481,0xb2));var _0x1348=function(_0x3f2a5d,_0x5cb200){_0x3f2a5d=_0x3f2a5d-0x0;var _0x3e29e0=_0x3481[_0x3f2a5d];return _0x3e29e0;};'use strict';var _=require(_0x1348('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1348('0x1'));var moment=require(_0x1348('0x2'));var BPromise=require(_0x1348('0x3'));var rp=require(_0x1348('0x4'));var fs=require('fs');var path=require(_0x1348('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1348('0x6'));module[_0x1348('0x7')]=function(_0x6e5683,_0x14c33b){return _0x6e5683['define'](_0x1348('0x8'),attributes,{'tableName':_0x1348('0x9'),'paranoid':![],'indexes':[{'name':_0x1348('0xa'),'fields':[_0x1348('0xb'),_0x1348('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2308=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','lodash','util'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x2308,0x76));var _0x8230=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x2308[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x8230('0x0'));var util=require(_0x8230('0x1'));var logger=require(_0x8230('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8230('0x3'));var rp=require(_0x8230('0x4'));var fs=require('fs');var path=require(_0x8230('0x5'));var rimraf=require(_0x8230('0x6'));var config=require(_0x8230('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x8230('0x8')]=function(_0x355f6b,_0x560068){return _0x355f6b[_0x8230('0x9')](_0x8230('0xa'),attributes,{'tableName':_0x8230('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index edb980b..479a728 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 _0xa955=['SalesforceField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x415784,_0xc874f7){var _0x29db4c=function(_0x38f7e4){while(--_0x38f7e4){_0x415784['push'](_0x415784['shift']());}};_0x29db4c(++_0xc874f7);}(_0xa955,0x86));var _0x5a95=function(_0x3f973f,_0x2def19){_0x3f973f=_0x3f973f-0x0;var _0x13ff94=_0xa955[_0x3f973f];return _0x13ff94;};'use strict';var _=require(_0x5a95('0x0'));var util=require(_0x5a95('0x1'));var moment=require(_0x5a95('0x2'));var BPromise=require(_0x5a95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a95('0x4'));var db=require(_0x5a95('0x5'))['db'];var utils=require(_0x5a95('0x6'));var logger=require(_0x5a95('0x7'))('rpc');var config=require(_0x5a95('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5a95('0x9')][_0x5a95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33ef9b,_0xfed18b,_0x41e220){return new BPromise(function(_0x5806ed,_0x579178){return client[_0x5a95('0xb')](_0x33ef9b,_0x41e220)['then'](function(_0x4ad419){logger[_0x5a95('0xc')](_0x5a95('0xd'),_0xfed18b,'request\x20sent');logger[_0x5a95('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0xfed18b,_0x5a95('0xf'),JSON[_0x5a95('0x10')](_0x4ad419));if(_0x4ad419['error']){if(_0x4ad419[_0x5a95('0x11')][_0x5a95('0x12')]===0x1f4){logger[_0x5a95('0x11')]('SalesforceField,\x20%s,\x20%s',_0xfed18b,_0x4ad419[_0x5a95('0x11')][_0x5a95('0x13')]);return _0x579178(_0x4ad419[_0x5a95('0x11')]['message']);}logger[_0x5a95('0x11')]('SalesforceField,\x20%s,\x20%s',_0xfed18b,_0x4ad419[_0x5a95('0x11')][_0x5a95('0x13')]);return _0x5806ed(_0x4ad419['error'][_0x5a95('0x13')]);}else{logger[_0x5a95('0xc')]('SalesforceField,\x20%s,\x20%s',_0xfed18b,_0x5a95('0xf'));_0x5806ed(_0x4ad419[_0x5a95('0x14')][_0x5a95('0x13')]);}})['catch'](function(_0x3fc6c3){logger[_0x5a95('0x11')](_0x5a95('0xd'),_0xfed18b,_0x3fc6c3);_0x579178(_0x3fc6c3);});});} \ No newline at end of file +var _0xb20a=['request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x1ebe9a,_0x2ae134){var _0x2f2ed2=function(_0x4857be){while(--_0x4857be){_0x1ebe9a['push'](_0x1ebe9a['shift']());}};_0x2f2ed2(++_0x2ae134);}(_0xb20a,0x1e0));var _0xab20=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xb20a[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0xab20('0x0'));var util=require(_0xab20('0x1'));var moment=require('moment');var BPromise=require(_0xab20('0x2'));var rs=require(_0xab20('0x3'));var fs=require('fs');var Redis=require(_0xab20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xab20('0x5'));var logger=require(_0xab20('0x6'))(_0xab20('0x7'));var config=require(_0xab20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xab20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cd06,_0x45290c,_0x5bb600){return new BPromise(function(_0x374ee7,_0x9605c2){return client['request'](_0x34cd06,_0x5bb600)[_0xab20('0xa')](function(_0x36966b){logger['info'](_0xab20('0xb'),_0x45290c,'request\x20sent');logger[_0xab20('0xc')](_0xab20('0xd'),_0x45290c,_0xab20('0xe'),JSON['stringify'](_0x36966b));if(_0x36966b['error']){if(_0x36966b[_0xab20('0xf')][_0xab20('0x10')]===0x1f4){logger[_0xab20('0xf')]('SalesforceField,\x20%s,\x20%s',_0x45290c,_0x36966b[_0xab20('0xf')][_0xab20('0x11')]);return _0x9605c2(_0x36966b[_0xab20('0xf')][_0xab20('0x11')]);}logger[_0xab20('0xf')](_0xab20('0xb'),_0x45290c,_0x36966b[_0xab20('0xf')]['message']);return _0x374ee7(_0x36966b[_0xab20('0xf')]['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x45290c,_0xab20('0xe'));_0x374ee7(_0x36966b[_0xab20('0x12')][_0xab20('0x11')]);}})['catch'](function(_0x2040e4){logger[_0xab20('0xf')](_0xab20('0xb'),_0x45290c,_0x2040e4);_0x9605c2(_0x2040e4);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b58c96b..6f0eb5f 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 _0x4c0e=['post','create','/:id/configurations','addConfiguration','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','get','show','getConfigurations','/:id/fields','getFields'];(function(_0x24dc31,_0x268d9e){var _0x17ecd5=function(_0x14b9bc){while(--_0x14b9bc){_0x24dc31['push'](_0x24dc31['shift']());}};_0x17ecd5(++_0x268d9e);}(_0x4c0e,0x128));var _0xe4c0=function(_0x110cbb,_0x186ee7){_0x110cbb=_0x110cbb-0x0;var _0x145f91=_0x4c0e[_0x110cbb];return _0x145f91;};'use strict';var multer=require(_0xe4c0('0x0'));var util=require(_0xe4c0('0x1'));var path=require(_0xe4c0('0x2'));var timeout=require(_0xe4c0('0x3'));var express=require(_0xe4c0('0x4'));var router=express[_0xe4c0('0x5')]();var fs_extra=require(_0xe4c0('0x6'));var auth=require(_0xe4c0('0x7'));var interaction=require(_0xe4c0('0x8'));var config=require('../../config/environment');var controller=require(_0xe4c0('0x9'));router['get']('/',auth[_0xe4c0('0xa')](),controller['index']);router[_0xe4c0('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe4c0('0xc')]);router[_0xe4c0('0xb')]('/:id/configurations',auth[_0xe4c0('0xa')](),controller[_0xe4c0('0xd')]);router[_0xe4c0('0xb')](_0xe4c0('0xe'),auth['isAuthenticated'](),controller[_0xe4c0('0xf')]);router[_0xe4c0('0x10')]('/',auth[_0xe4c0('0xa')](),controller[_0xe4c0('0x11')]);router[_0xe4c0('0x10')](_0xe4c0('0x12'),auth[_0xe4c0('0xa')](),controller[_0xe4c0('0x13')]);router[_0xe4c0('0x14')](_0xe4c0('0x15'),auth[_0xe4c0('0xa')](),controller['update']);router[_0xe4c0('0x16')](_0xe4c0('0x15'),auth[_0xe4c0('0xa')](),controller[_0xe4c0('0x17')]);module['exports']=router; \ No newline at end of file +var _0x2bdb=['post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x5bd151,_0x4d80e9){var _0x57b703=function(_0x9d3ed6){while(--_0x9d3ed6){_0x5bd151['push'](_0x5bd151['shift']());}};_0x57b703(++_0x4d80e9);}(_0x2bdb,0x105));var _0xb2bd=function(_0x5ae040,_0x22a074){_0x5ae040=_0x5ae040-0x0;var _0xd5a656=_0x2bdb[_0x5ae040];return _0xd5a656;};'use strict';var multer=require(_0xb2bd('0x0'));var util=require('util');var path=require(_0xb2bd('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2bd('0x2'));var router=express[_0xb2bd('0x3')]();var fs_extra=require(_0xb2bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var controller=require(_0xb2bd('0x7'));router[_0xb2bd('0x8')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xa')]);router[_0xb2bd('0x8')]('/:id',auth[_0xb2bd('0x9')](),controller['show']);router[_0xb2bd('0x8')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xc')]);router[_0xb2bd('0x8')](_0xb2bd('0xd'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xe')]);router[_0xb2bd('0xf')]('/',auth['isAuthenticated'](),controller[_0xb2bd('0x10')]);router[_0xb2bd('0xf')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x11')]);router[_0xb2bd('0x12')](_0xb2bd('0x13'),auth[_0xb2bd('0x9')](),controller['update']);router[_0xb2bd('0x14')]('/:id',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x15')]);module[_0xb2bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 1e6ea72..79b5b9f 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 _0x634d=['remoteUri','sequelize','exports','STRING'];(function(_0xcf861a,_0x4d8d92){var _0x1cd963=function(_0x143f06){while(--_0x143f06){_0xcf861a['push'](_0xcf861a['shift']());}};_0x1cd963(++_0x4d8d92);}(_0x634d,0x169));var _0xd634=function(_0x38a920,_0x532cda){_0x38a920=_0x38a920-0x0;var _0x263dd8=_0x634d[_0x38a920];return _0x263dd8;};'use strict';var Sequelize=require(_0xd634('0x0'));module[_0xd634('0x1')]={'name':{'type':Sequelize[_0xd634('0x2')]},'description':{'type':Sequelize[_0xd634('0x2')]},'username':{'type':Sequelize[_0xd634('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd634('0x2')]},'remoteUri':{'type':Sequelize[_0xd634('0x2')],'unique':_0xd634('0x3')},'serverUrl':{'type':Sequelize[_0xd634('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5c00=['sequelize','STRING'];(function(_0xfad241,_0x30e2e0){var _0x5686d2=function(_0x4267be){while(--_0x4267be){_0xfad241['push'](_0xfad241['shift']());}};_0x5686d2(++_0x30e2e0);}(_0x5c00,0x15c));var _0x05c0=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x5c00[_0xd4636c];return _0x5ee17d;};'use strict';var Sequelize=require(_0x05c0('0x0'));module['exports']={'name':{'type':Sequelize[_0x05c0('0x1')]},'description':{'type':Sequelize[_0x05c0('0x1')]},'username':{'type':Sequelize[_0x05c0('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x05c0('0x1')]},'email':{'type':Sequelize[_0x05c0('0x1')]},'remoteUri':{'type':Sequelize[_0x05c0('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x05c0('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 1dc1bb3..4d67aaa 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 _0xb718=['filters','where','merge','options','ServicenowAccount','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','filter','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','work_notes_list','rfc','time_worked','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','includes','forEach','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','sys_choice?sysparm_query=name=incident^element=','inactive','false','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x13d905,_0x4093f6){var _0x308b2f=function(_0x2baa70){while(--_0x2baa70){_0x13d905['push'](_0x13d905['shift']());}};_0x308b2f(++_0x4093f6);}(_0xb718,0x1df));var _0x8b71=function(_0x39dfd3,_0x4f7173){_0x39dfd3=_0x39dfd3-0x0;var _0x4fcd65=_0xb718[_0x39dfd3];return _0x4fcd65;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b71('0x0'));var rp=require(_0x8b71('0x1'));var moment=require(_0x8b71('0x2'));var BPromise=require(_0x8b71('0x3'));var Mustache=require(_0x8b71('0x4'));var util=require('util');var path=require(_0x8b71('0x5'));var sox=require(_0x8b71('0x6'));var csv=require(_0x8b71('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b71('0x8'));var _=require('lodash');var squel=require(_0x8b71('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b71('0xa'));var toCsv=require(_0x8b71('0x7'));var querystring=require(_0x8b71('0xb'));var Papa=require(_0x8b71('0xc'));var Redis=require(_0x8b71('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b71('0xe'));var hardwareService=require(_0x8b71('0xf'));var logger=require(_0x8b71('0x10'))(_0x8b71('0x11'));var utils=require(_0x8b71('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8b71('0x13'));var db=require(_0x8b71('0x14'))['db'];var integrations=require(_0x8b71('0x15'));function respondWithStatusCode(_0x444cec,_0x99709b){_0x99709b=_0x99709b||0xcc;return function(_0x4fb409){if(_0x4fb409){return _0x444cec[_0x8b71('0x16')](_0x99709b);}return _0x444cec['status'](_0x99709b)[_0x8b71('0x17')]();};}function respondWithResult(_0x301538,_0x2cff57){_0x2cff57=_0x2cff57||0xc8;return function(_0xaa00a9){if(_0xaa00a9){return _0x301538[_0x8b71('0x18')](_0x2cff57)[_0x8b71('0x19')](_0xaa00a9);}};}function respondWithFilteredResult(_0x4acbad,_0x1d9da3){return function(_0x52aeda){if(_0x52aeda){var _0x2eb0e8=typeof _0x1d9da3['offset']===_0x8b71('0x1a')&&typeof _0x1d9da3[_0x8b71('0x1b')]===_0x8b71('0x1a');var _0x453ac9=_0x52aeda[_0x8b71('0x1c')];var _0x25aa4b=_0x2eb0e8?0x0:_0x1d9da3[_0x8b71('0x1d')];var _0x14c372=_0x2eb0e8?_0x52aeda[_0x8b71('0x1c')]:_0x1d9da3[_0x8b71('0x1d')]+_0x1d9da3[_0x8b71('0x1b')];var _0xffe7d8;if(_0x14c372>=_0x453ac9){_0x14c372=_0x453ac9;_0xffe7d8=0xc8;}else{_0xffe7d8=0xce;}_0x4acbad[_0x8b71('0x18')](_0xffe7d8);return _0x4acbad[_0x8b71('0x1e')](_0x8b71('0x1f'),_0x25aa4b+'-'+_0x14c372+'/'+_0x453ac9)[_0x8b71('0x19')](_0x52aeda);}return null;};}function patchUpdates(_0x3ce6b0){return function(_0x1d0645){try{jsonpatch[_0x8b71('0x20')](_0x1d0645,_0x3ce6b0,!![]);}catch(_0x5dbc75){return BPromise[_0x8b71('0x21')](_0x5dbc75);}return _0x1d0645[_0x8b71('0x22')]();};}function saveUpdates(_0x18d477,_0x5bfc5b){return function(_0xf46ace){if(_0xf46ace){return _0xf46ace[_0x8b71('0x23')](_0x18d477)['then'](function(_0x4bb5a9){return _0x4bb5a9;});}return null;};}function removeEntity(_0x49102b,_0x52d5b8){return function(_0x77911){if(_0x77911){return _0x77911[_0x8b71('0x24')]()[_0x8b71('0x25')](function(){_0x49102b['status'](0xcc)[_0x8b71('0x17')]();});}};}function handleEntityNotFound(_0x250e9b,_0x8706e5){return function(_0x37a925){if(!_0x37a925){_0x250e9b[_0x8b71('0x16')](0x194);}return _0x37a925;};}function handleError(_0x1c17c4,_0x1eb041){_0x1eb041=_0x1eb041||0x1f4;return function(_0x43abd3){logger[_0x8b71('0x26')](_0x43abd3[_0x8b71('0x27')]);if(_0x43abd3[_0x8b71('0x28')]){delete _0x43abd3[_0x8b71('0x28')];}_0x1c17c4['status'](_0x1eb041)['send'](_0x43abd3);};}exports[_0x8b71('0x29')]=function(_0x186bcf,_0x369b1b){var _0x2be47b={},_0x2b7759={},_0x33c51e={'count':0x0,'rows':[]};var _0x328bd6=_[_0x8b71('0x2a')](db['ServicenowAccount'][_0x8b71('0x2b')],function(_0x25e8e0){return{'name':_0x25e8e0[_0x8b71('0x2c')],'type':_0x25e8e0[_0x8b71('0x2d')][_0x8b71('0x2e')]};});_0x2b7759[_0x8b71('0x2f')]=_['map'](_0x328bd6,_0x8b71('0x28'));_0x2b7759[_0x8b71('0x30')]=_[_0x8b71('0x31')](_0x186bcf['query']);_0x2b7759['filters']=_[_0x8b71('0x32')](_0x2b7759[_0x8b71('0x2f')],_0x2b7759[_0x8b71('0x30')]);_0x2be47b[_0x8b71('0x33')]=_[_0x8b71('0x32')](_0x2b7759[_0x8b71('0x2f')],qs[_0x8b71('0x34')](_0x186bcf['query'][_0x8b71('0x34')]));_0x2be47b[_0x8b71('0x33')]=_0x2be47b[_0x8b71('0x33')]['length']?_0x2be47b[_0x8b71('0x33')]:_0x2b7759['model'];if(!_0x186bcf[_0x8b71('0x30')][_0x8b71('0x35')](_0x8b71('0x36'))){_0x2be47b[_0x8b71('0x1b')]=qs['limit'](_0x186bcf[_0x8b71('0x30')][_0x8b71('0x1b')]);_0x2be47b['offset']=qs['offset'](_0x186bcf[_0x8b71('0x30')][_0x8b71('0x1d')]);}_0x2be47b[_0x8b71('0x37')]=qs['sort'](_0x186bcf[_0x8b71('0x30')][_0x8b71('0x38')]);_0x2be47b['where']=qs['filters'](_[_0x8b71('0x39')](_0x186bcf['query'],_0x2b7759[_0x8b71('0x3a')]),_0x328bd6);if(_0x186bcf['query']['filter']){_0x2be47b[_0x8b71('0x3b')]=_[_0x8b71('0x3c')](_0x2be47b['where'],{'$or':_[_0x8b71('0x2a')](_0x328bd6,function(_0x28cfa2){if(_0x28cfa2[_0x8b71('0x2d')]!=='VIRTUAL'){var _0x194f43={};_0x194f43[_0x28cfa2[_0x8b71('0x28')]]={'$like':'%'+_0x186bcf[_0x8b71('0x30')]['filter']+'%'};return _0x194f43;}})});}_0x2be47b=_[_0x8b71('0x3c')]({},_0x2be47b,_0x186bcf[_0x8b71('0x3d')]);var _0x52ec0a={'where':_0x2be47b[_0x8b71('0x3b')]};return db[_0x8b71('0x3e')][_0x8b71('0x1c')](_0x52ec0a)[_0x8b71('0x25')](function(_0x24b46a){_0x33c51e['count']=_0x24b46a;if(_0x186bcf['query'][_0x8b71('0x3f')]){_0x2be47b[_0x8b71('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x8b71('0x41')](_0x2be47b);})['then'](function(_0x5c8af1){_0x33c51e[_0x8b71('0x42')]=_0x5c8af1;return _0x33c51e;})['then'](respondWithFilteredResult(_0x369b1b,_0x2be47b))[_0x8b71('0x43')](handleError(_0x369b1b,null));};exports[_0x8b71('0x44')]=function(_0x4022e4,_0x115639){var _0x961358={'raw':![],'where':{'id':_0x4022e4['params']['id']}},_0x57800b={};_0x57800b[_0x8b71('0x2f')]=_[_0x8b71('0x31')](db[_0x8b71('0x3e')]['rawAttributes']);_0x57800b[_0x8b71('0x30')]=_[_0x8b71('0x31')](_0x4022e4['query']);_0x57800b['filters']=_['intersection'](_0x57800b[_0x8b71('0x2f')],_0x57800b[_0x8b71('0x30')]);_0x961358[_0x8b71('0x33')]=_[_0x8b71('0x32')](_0x57800b[_0x8b71('0x2f')],qs[_0x8b71('0x34')](_0x4022e4[_0x8b71('0x30')][_0x8b71('0x34')]));_0x961358[_0x8b71('0x33')]=_0x961358[_0x8b71('0x33')][_0x8b71('0x45')]?_0x961358[_0x8b71('0x33')]:_0x57800b[_0x8b71('0x2f')];if(_0x4022e4[_0x8b71('0x30')][_0x8b71('0x3f')]){_0x961358[_0x8b71('0x40')]=[{'all':!![]}];}_0x961358=_[_0x8b71('0x3c')]({},_0x961358,_0x4022e4[_0x8b71('0x3d')]);return db['ServicenowAccount'][_0x8b71('0x46')](_0x961358)[_0x8b71('0x25')](handleEntityNotFound(_0x115639,null))[_0x8b71('0x25')](respondWithResult(_0x115639,null))[_0x8b71('0x43')](handleError(_0x115639,null));};exports[_0x8b71('0x47')]=function(_0x3ed6e0,_0x486765){return db[_0x8b71('0x3e')][_0x8b71('0x47')](_0x3ed6e0[_0x8b71('0x48')],{})[_0x8b71('0x25')](respondWithResult(_0x486765,0xc9))[_0x8b71('0x43')](handleError(_0x486765,null));};exports[_0x8b71('0x23')]=function(_0x9a7055,_0x2c78a3){if(_0x9a7055[_0x8b71('0x48')]['id']){delete _0x9a7055[_0x8b71('0x48')]['id'];}return db[_0x8b71('0x3e')]['find']({'where':{'id':_0x9a7055[_0x8b71('0x49')]['id']}})[_0x8b71('0x25')](handleEntityNotFound(_0x2c78a3,null))[_0x8b71('0x25')](saveUpdates(_0x9a7055[_0x8b71('0x48')],null))['then'](respondWithResult(_0x2c78a3,null))[_0x8b71('0x43')](handleError(_0x2c78a3,null));};exports[_0x8b71('0x24')]=function(_0x112a52,_0x3d00ac){return db['ServicenowAccount'][_0x8b71('0x46')]({'where':{'id':_0x112a52[_0x8b71('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d00ac,null))['then'](removeEntity(_0x3d00ac,null))['catch'](handleError(_0x3d00ac,null));};exports[_0x8b71('0x4a')]=function(_0x29d3c9,_0x5c3361,_0x4a5c67){var _0x2b3024={};var _0x310f6a={};var _0x8c8ef9;var _0x334177;return db[_0x8b71('0x3e')][_0x8b71('0x4b')]({'where':{'id':_0x29d3c9[_0x8b71('0x49')]['id']}})[_0x8b71('0x25')](handleEntityNotFound(_0x5c3361,null))['then'](function(_0x5322f5){if(_0x5322f5){_0x8c8ef9=_0x5322f5;_0x310f6a[_0x8b71('0x2f')]=_[_0x8b71('0x31')](db[_0x8b71('0x4c')][_0x8b71('0x2b')]);_0x310f6a[_0x8b71('0x30')]=_['keys'](_0x29d3c9[_0x8b71('0x30')]);_0x310f6a[_0x8b71('0x3a')]=_[_0x8b71('0x32')](_0x310f6a[_0x8b71('0x2f')],_0x310f6a[_0x8b71('0x30')]);_0x2b3024[_0x8b71('0x33')]=_[_0x8b71('0x32')](_0x310f6a[_0x8b71('0x2f')],qs[_0x8b71('0x34')](_0x29d3c9[_0x8b71('0x30')][_0x8b71('0x34')]));_0x2b3024[_0x8b71('0x33')]=_0x2b3024[_0x8b71('0x33')]['length']?_0x2b3024[_0x8b71('0x33')]:_0x310f6a[_0x8b71('0x2f')];_0x2b3024['order']=qs['sort'](_0x29d3c9[_0x8b71('0x30')][_0x8b71('0x38')]);_0x2b3024[_0x8b71('0x3b')]=qs[_0x8b71('0x3a')](_[_0x8b71('0x39')](_0x29d3c9[_0x8b71('0x30')],_0x310f6a[_0x8b71('0x3a')]));if(_0x29d3c9['query'][_0x8b71('0x4d')]){_0x2b3024[_0x8b71('0x3b')]=_[_0x8b71('0x3c')](_0x2b3024['where'],{'$or':_['map'](_0x2b3024[_0x8b71('0x33')],function(_0x41eed3){var _0x2c18ea={};_0x2c18ea[_0x41eed3]={'$like':'%'+_0x29d3c9[_0x8b71('0x30')][_0x8b71('0x4d')]+'%'};return _0x2c18ea;})});}_0x2b3024=_[_0x8b71('0x3c')]({},_0x2b3024,_0x29d3c9[_0x8b71('0x3d')]);return _0x8c8ef9[_0x8b71('0x4a')](_0x2b3024);}})[_0x8b71('0x25')](function(_0x30c7f8){if(_0x30c7f8){_0x334177=_0x30c7f8[_0x8b71('0x45')];if(!_0x29d3c9[_0x8b71('0x30')]['hasOwnProperty'](_0x8b71('0x36'))){_0x2b3024['limit']=qs['limit'](_0x29d3c9[_0x8b71('0x30')][_0x8b71('0x1b')]);_0x2b3024[_0x8b71('0x1d')]=qs[_0x8b71('0x1d')](_0x29d3c9['query']['offset']);}return _0x8c8ef9['getConfigurations'](_0x2b3024);}})[_0x8b71('0x25')](function(_0x5aaabe){if(_0x5aaabe){return _0x5aaabe?{'count':_0x334177,'rows':_0x5aaabe}:null;}})[_0x8b71('0x25')](respondWithResult(_0x5c3361,null))[_0x8b71('0x43')](handleError(_0x5c3361,null));};exports[_0x8b71('0x4e')]=function(_0x3c58b4,_0x389c70,_0x1e0a00){if(_0x3c58b4[_0x8b71('0x48')]['id']){delete _0x3c58b4[_0x8b71('0x48')]['id'];}return db[_0x8b71('0x3e')][_0x8b71('0x4b')]({'where':{'id':_0x3c58b4[_0x8b71('0x49')]['id']}})[_0x8b71('0x25')](handleEntityNotFound(_0x389c70,null))[_0x8b71('0x25')](function(_0x180efb){if(_0x180efb){_0x3c58b4[_0x8b71('0x48')]['AccountId']=_0x180efb['id'];_0x3c58b4[_0x8b71('0x48')][_0x8b71('0x4f')]=integrations['getSubjects'](_0x3c58b4[_0x8b71('0x48')][_0x8b71('0x50')],_0x3c58b4['body']['type']);_0x3c58b4[_0x8b71('0x48')][_0x8b71('0x51')]=integrations[_0x8b71('0x52')](_0x3c58b4[_0x8b71('0x48')]['channel'],_0x3c58b4[_0x8b71('0x48')][_0x8b71('0x2d')]);return db['ServicenowConfiguration'][_0x8b71('0x47')](_0x3c58b4[_0x8b71('0x48')],{'include':[{'model':db[_0x8b71('0x53')],'as':_0x8b71('0x4f')},{'model':db[_0x8b71('0x53')],'as':_0x8b71('0x51')}]});}return null;})[_0x8b71('0x25')](respondWithResult(_0x389c70,null))[_0x8b71('0x43')](handleError(_0x389c70,null));};exports[_0x8b71('0x54')]=function(_0x148c9a,_0x2de028,_0x41a769){var _0x3fff2d=[_0x8b71('0x55'),_0x8b71('0x56'),_0x8b71('0x57'),'subcategory',_0x8b71('0x58'),_0x8b71('0x59'),'incident_state',_0x8b71('0x5a'),_0x8b71('0x5b')];var _0x52d91a=['parent',_0x8b71('0x55'),_0x8b71('0x5c'),_0x8b71('0x5d'),_0x8b71('0x5e'),_0x8b71('0x5f'),_0x8b71('0x60'),_0x8b71('0x56'),_0x8b71('0x61'),'number',_0x8b71('0x62'),'sys_updated_by','opened_by',_0x8b71('0x63'),'sys_created_on',_0x8b71('0x64'),_0x8b71('0x65'),_0x8b71('0x66'),_0x8b71('0x57'),'order',_0x8b71('0x67'),_0x8b71('0x68'),_0x8b71('0x69'),'delivery_plan',_0x8b71('0x6a'),'active',_0x8b71('0x6b'),'business_service','priority','sys_domain_path',_0x8b71('0x6c'),_0x8b71('0x6d'),'expected_start',_0x8b71('0x6e'),_0x8b71('0x6f'),'group_list',_0x8b71('0x70'),_0x8b71('0x71'),_0x8b71('0x72'),_0x8b71('0x73'),_0x8b71('0x74'),'subcategory','work_notes',_0x8b71('0x75'),_0x8b71('0x58'),_0x8b71('0x76'),_0x8b71('0x77'),_0x8b71('0x78'),_0x8b71('0x79'),'business_stc',_0x8b71('0x7a'),'description',_0x8b71('0x7b'),'notify',_0x8b71('0x7c'),_0x8b71('0x7d'),'closed_by',_0x8b71('0x7e'),_0x8b71('0x7f'),_0x8b71('0x80'),_0x8b71('0x81'),'reopened_by','incident_state',_0x8b71('0x82'),_0x8b71('0x83'),_0x8b71('0x84'),_0x8b71('0x85'),_0x8b71('0x86'),_0x8b71('0x87'),_0x8b71('0x5a'),'comments',_0x8b71('0x88'),_0x8b71('0x89'),_0x8b71('0x8a'),_0x8b71('0x8b'),_0x8b71('0x8c'),_0x8b71('0x8d'),_0x8b71('0x8e'),_0x8b71('0x8f'),_0x8b71('0x90'),'correlation_id',_0x8b71('0x91'),_0x8b71('0x5b')];var _0x1b83dd='';var _0x1d8fcd='';var _0x13468f=[];var _0x39a39c='';var _0x1d7474='';var _0x5d6a30=[];var _0x454985='';var _0x44f328='';var _0x551e76={};var _0x5ee981='';return db[_0x8b71('0x3e')][_0x8b71('0x4b')]({'where':{'id':_0x148c9a['params']['id']},'attributes':['id',_0x8b71('0x92'),'password','email',_0x8b71('0x93'),_0x8b71('0x94')]})[_0x8b71('0x25')](handleEntityNotFound(_0x2de028,null))[_0x8b71('0x25')](function(_0x326232){if(_0x326232){_0x5ee981=_0x326232['remoteUri'];var _0x4e2665=_0x5ee981[_0x8b71('0x95')](-0x1);if(_0x4e2665==='/'){_0x5ee981=_0x5ee981[_0x8b71('0x96')](0x0,_0x5ee981[_0x8b71('0x97')](_0x4e2665));}_0x44f328=util['format'](_0x8b71('0x98'),_0x5ee981);_0x454985=util[_0x8b71('0x99')](_0x8b71('0x9a'),_0x5ee981);_0x551e76={'user':_0x326232[_0x8b71('0x92')],'pass':_0x326232[_0x8b71('0x9b')]};var _0x57bda2={'method':_0x8b71('0x9c'),'uri':_0x44f328+_0x8b71('0x9d'),'auth':_0x551e76,'json':!![]};return rp(_0x57bda2);}})[_0x8b71('0x25')](function(_0x3b5b78){if(_0x3b5b78[_0x8b71('0x9e')][_0x8b71('0x45')]>0x0){_0x1b83dd=_0x3b5b78[_0x8b71('0x9e')];}console[_0x8b71('0x9f')](_0x8b71('0xa0'),_0x1b83dd);_0x5d6a30=[];_0x1d8fcd=Object['assign']([],_0x1b83dd);_['remove'](_0x1d8fcd,function(_0x10007e){return!_0x3fff2d[_0x8b71('0xa1')](_0x10007e['name']);});_0x1d8fcd[_0x8b71('0xa2')](function(_0x14a5b7){var _0x3d00c8=createFieldObject(_0x454985,_0x551e76,_0x14a5b7['internalType'],_0x14a5b7[_0x8b71('0x28')],_0x14a5b7[_0x8b71('0xa3')],![]);_0x5d6a30[_0x8b71('0xa4')](_0x3d00c8);});return Promise[_0x8b71('0xa5')](_0x5d6a30);})[_0x8b71('0x25')](function(_0x42b239){_0x13468f=_0x42b239;_0x39a39c=Object[_0x8b71('0xa6')]([],_0x1b83dd);console[_0x8b71('0x9f')](_0x8b71('0xa7'),_0x1b83dd);_['remove'](_0x39a39c,function(_0x108127){return _0x52d91a[_0x8b71('0xa1')](_0x108127[_0x8b71('0x28')]);});console['log'](_0x8b71('0xa8'),_0x39a39c);_0x5d6a30=[];_0x39a39c['forEach'](function(_0x20d1fa){var _0x4ce682=createFieldObject(_0x454985,_0x551e76,_0x20d1fa['internalType'],_0x20d1fa[_0x8b71('0x28')],_0x20d1fa[_0x8b71('0xa3')],!![]);_0x5d6a30['push'](_0x4ce682);});return Promise['all'](_0x5d6a30);})[_0x8b71('0x25')](function(_0x3d8371){_0x1d7474=_0x3d8371;var _0x4ee26b=_0x13468f[_0x8b71('0xa9')](_0x1d7474);return{'count':_0x4ee26b[_0x8b71('0x45')],'rows':_0x4ee26b};})[_0x8b71('0x25')](respondWithResult(_0x2de028,null))['catch'](function(_0x577b83){console[_0x8b71('0x9f')](_0x8b71('0xaa')+_0x577b83);var _0xacc18=_0x148c9a[_0x8b71('0x30')][_0x8b71('0xab')]?0x1f4:_0x577b83['statusCode']||0x1f4;logger[_0x8b71('0x26')](_0x577b83[_0x8b71('0x27')]);delete _0x577b83['name'];if(_0xacc18===0x191){_0xacc18=0x190;}_0x2de028[_0x8b71('0x18')](_0xacc18)['send'](_0x148c9a[_0x8b71('0x30')]['test']?{'message':_0x8b71('0xac'),'statusCode':_0x577b83[_0x8b71('0xad')]}:_0x577b83);});};function createFieldObject(_0x13c117,_0x31bc48,_0x1ad713,_0x57ac3a,_0x504352,_0x40ac5e){return new Promise(function(_0x144eb5,_0x37fa6a){var _0x5c08ab={'id':_0x57ac3a,'name':_0x504352,'custom':_0x40ac5e};if(_0x1ad713===_0x8b71('0xae')){_0x5c08ab['options']=[{'name':_0x8b71('0xaf'),'value':'true'},{'name':'False','value':'false'}];_0x144eb5(_0x5c08ab);}else{var _0x3b6c4f={'method':_0x8b71('0x9c'),'uri':_0x13c117+_0x8b71('0xb0')+_0x57ac3a,'auth':_0x31bc48,'json':!![]};return rp(_0x3b6c4f)[_0x8b71('0x25')](function(_0x359cf6){var _0x49df9b=[];if(_0x359cf6[_0x8b71('0x9e')][_0x8b71('0x45')]>0x0){_0x359cf6[_0x8b71('0x9e')][_0x8b71('0xa2')](function(_0x378446){if(_0x378446[_0x8b71('0xb1')]===_0x8b71('0xb2')){var _0x2a19b8={'name':_0x378446[_0x8b71('0xa3')],'value':_0x378446['value']};_0x49df9b[_0x8b71('0xa4')](_0x2a19b8);}});}_0x5c08ab[_0x8b71('0x3d')]=_0x49df9b;if(_0x5c08ab[_0x8b71('0x3d')][_0x8b71('0x45')]>0x0){_0x144eb5(_0x5c08ab);}else{if(_0x40ac5e==![]){_0x144eb5();}else{_0x144eb5(_0x5c08ab);}}});}});} \ No newline at end of file +var _0x1354=['name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','destroy','findOne','keys','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','notify','incident_state','category','parent','watch_list','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','cmdb_ci','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','value','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','error','stack'];(function(_0x192174,_0x471548){var _0x22afe5=function(_0x215a3f){while(--_0x215a3f){_0x192174['push'](_0x192174['shift']());}};_0x22afe5(++_0x471548);}(_0x1354,0x99));var _0x4135=function(_0x16765f,_0x3dd736){_0x16765f=_0x16765f-0x0;var _0x1326d4=_0x1354[_0x16765f];return _0x1326d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4135('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4135('0x1'));var rp=require(_0x4135('0x2'));var moment=require(_0x4135('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4135('0x4'));var util=require(_0x4135('0x5'));var path=require('path');var sox=require(_0x4135('0x6'));var csv=require(_0x4135('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4135('0x8'));var _=require('lodash');var squel=require(_0x4135('0x9'));var crypto=require(_0x4135('0xa'));var jsforce=require(_0x4135('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4135('0xc'));var Papa=require(_0x4135('0xd'));var Redis=require('ioredis');var authService=require(_0x4135('0xe'));var qs=require(_0x4135('0xf'));var as=require(_0x4135('0x10'));var hardwareService=require(_0x4135('0x11'));var logger=require(_0x4135('0x12'))(_0x4135('0x13'));var utils=require(_0x4135('0x14'));var config=require(_0x4135('0x15'));var licenseUtil=require(_0x4135('0x16'));var db=require(_0x4135('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x41464e,_0x4e8eb5){_0x4e8eb5=_0x4e8eb5||0xcc;return function(_0x208120){if(_0x208120){return _0x41464e[_0x4135('0x18')](_0x4e8eb5);}return _0x41464e[_0x4135('0x19')](_0x4e8eb5)['end']();};}function respondWithResult(_0x28d713,_0x234625){_0x234625=_0x234625||0xc8;return function(_0xb1e948){if(_0xb1e948){return _0x28d713[_0x4135('0x19')](_0x234625)['json'](_0xb1e948);}};}function respondWithFilteredResult(_0x840bd3,_0x34455a){return function(_0x543019){if(_0x543019){var _0x1569ec=typeof _0x34455a[_0x4135('0x1a')]===_0x4135('0x1b')&&typeof _0x34455a[_0x4135('0x1c')]===_0x4135('0x1b');var _0x567397=_0x543019[_0x4135('0x1d')];var _0x5c9dec=_0x1569ec?0x0:_0x34455a['offset'];var _0x12b751=_0x1569ec?_0x543019['count']:_0x34455a['offset']+_0x34455a[_0x4135('0x1c')];var _0x5d4c2f;if(_0x12b751>=_0x567397){_0x12b751=_0x567397;_0x5d4c2f=0xc8;}else{_0x5d4c2f=0xce;}_0x840bd3['status'](_0x5d4c2f);return _0x840bd3['set'](_0x4135('0x1e'),_0x5c9dec+'-'+_0x12b751+'/'+_0x567397)['json'](_0x543019);}return null;};}function patchUpdates(_0x463b38){return function(_0x43c5c8){try{jsonpatch[_0x4135('0x1f')](_0x43c5c8,_0x463b38,!![]);}catch(_0x44c167){return BPromise[_0x4135('0x20')](_0x44c167);}return _0x43c5c8[_0x4135('0x21')]();};}function saveUpdates(_0x70e97c,_0x1c237e){return function(_0x48f735){if(_0x48f735){return _0x48f735[_0x4135('0x22')](_0x70e97c)[_0x4135('0x23')](function(_0x329814){return _0x329814;});}return null;};}function removeEntity(_0x1087f9,_0x124c65){return function(_0x31af93){if(_0x31af93){return _0x31af93['destroy']()[_0x4135('0x23')](function(){_0x1087f9[_0x4135('0x19')](0xcc)[_0x4135('0x24')]();});}};}function handleEntityNotFound(_0x4bf0df,_0x2eb590){return function(_0x5c58da){if(!_0x5c58da){_0x4bf0df[_0x4135('0x18')](0x194);}return _0x5c58da;};}function handleError(_0x2b1230,_0x332a9f){_0x332a9f=_0x332a9f||0x1f4;return function(_0x9da506){logger[_0x4135('0x25')](_0x9da506[_0x4135('0x26')]);if(_0x9da506[_0x4135('0x27')]){delete _0x9da506['name'];}_0x2b1230[_0x4135('0x19')](_0x332a9f)[_0x4135('0x28')](_0x9da506);};}exports[_0x4135('0x29')]=function(_0x4820f3,_0x3dae37){var _0x1371cd={},_0x338099={},_0x570449={'count':0x0,'rows':[]};var _0x1690f3=_[_0x4135('0x2a')](db[_0x4135('0x2b')][_0x4135('0x2c')],function(_0x41d3ca){return{'name':_0x41d3ca[_0x4135('0x2d')],'type':_0x41d3ca[_0x4135('0x2e')][_0x4135('0x2f')]};});_0x338099[_0x4135('0x30')]=_[_0x4135('0x2a')](_0x1690f3,_0x4135('0x27'));_0x338099[_0x4135('0x31')]=_['keys'](_0x4820f3[_0x4135('0x31')]);_0x338099[_0x4135('0x32')]=_[_0x4135('0x33')](_0x338099[_0x4135('0x30')],_0x338099['query']);_0x1371cd[_0x4135('0x34')]=_[_0x4135('0x33')](_0x338099['model'],qs[_0x4135('0x35')](_0x4820f3[_0x4135('0x31')][_0x4135('0x35')]));_0x1371cd[_0x4135('0x34')]=_0x1371cd[_0x4135('0x34')][_0x4135('0x36')]?_0x1371cd['attributes']:_0x338099[_0x4135('0x30')];if(!_0x4820f3['query'][_0x4135('0x37')](_0x4135('0x38'))){_0x1371cd[_0x4135('0x1c')]=qs['limit'](_0x4820f3['query'][_0x4135('0x1c')]);_0x1371cd[_0x4135('0x1a')]=qs[_0x4135('0x1a')](_0x4820f3[_0x4135('0x31')][_0x4135('0x1a')]);}_0x1371cd['order']=qs['sort'](_0x4820f3[_0x4135('0x31')][_0x4135('0x39')]);_0x1371cd['where']=qs['filters'](_[_0x4135('0x3a')](_0x4820f3['query'],_0x338099['filters']),_0x1690f3);if(_0x4820f3[_0x4135('0x31')]['filter']){_0x1371cd[_0x4135('0x3b')]=_['merge'](_0x1371cd[_0x4135('0x3b')],{'$or':_['map'](_0x1690f3,function(_0x8d2ecc){if(_0x8d2ecc['type']!==_0x4135('0x3c')){var _0x5d21a4={};_0x5d21a4[_0x8d2ecc[_0x4135('0x27')]]={'$like':'%'+_0x4820f3[_0x4135('0x31')][_0x4135('0x3d')]+'%'};return _0x5d21a4;}})});}_0x1371cd=_['merge']({},_0x1371cd,_0x4820f3[_0x4135('0x3e')]);var _0x48dadd={'where':_0x1371cd[_0x4135('0x3b')]};return db[_0x4135('0x2b')][_0x4135('0x1d')](_0x48dadd)[_0x4135('0x23')](function(_0x175847){_0x570449[_0x4135('0x1d')]=_0x175847;if(_0x4820f3[_0x4135('0x31')][_0x4135('0x3f')]){_0x1371cd[_0x4135('0x40')]=[{'all':!![]}];}return db[_0x4135('0x2b')][_0x4135('0x41')](_0x1371cd);})[_0x4135('0x23')](function(_0x223096){_0x570449[_0x4135('0x42')]=_0x223096;return _0x570449;})[_0x4135('0x23')](respondWithFilteredResult(_0x3dae37,_0x1371cd))[_0x4135('0x43')](handleError(_0x3dae37,null));};exports[_0x4135('0x44')]=function(_0x5d86f7,_0x57e53a){var _0x1be999={'raw':![],'where':{'id':_0x5d86f7[_0x4135('0x45')]['id']}},_0x3170a4={};_0x3170a4[_0x4135('0x30')]=_['keys'](db[_0x4135('0x2b')][_0x4135('0x2c')]);_0x3170a4[_0x4135('0x31')]=_['keys'](_0x5d86f7[_0x4135('0x31')]);_0x3170a4['filters']=_[_0x4135('0x33')](_0x3170a4[_0x4135('0x30')],_0x3170a4['query']);_0x1be999[_0x4135('0x34')]=_[_0x4135('0x33')](_0x3170a4[_0x4135('0x30')],qs[_0x4135('0x35')](_0x5d86f7[_0x4135('0x31')][_0x4135('0x35')]));_0x1be999[_0x4135('0x34')]=_0x1be999['attributes'][_0x4135('0x36')]?_0x1be999['attributes']:_0x3170a4[_0x4135('0x30')];if(_0x5d86f7['query'][_0x4135('0x3f')]){_0x1be999[_0x4135('0x40')]=[{'all':!![]}];}_0x1be999=_[_0x4135('0x46')]({},_0x1be999,_0x5d86f7[_0x4135('0x3e')]);return db[_0x4135('0x2b')]['find'](_0x1be999)[_0x4135('0x23')](handleEntityNotFound(_0x57e53a,null))[_0x4135('0x23')](respondWithResult(_0x57e53a,null))[_0x4135('0x43')](handleError(_0x57e53a,null));};exports[_0x4135('0x47')]=function(_0x1a7048,_0x6bd80b){return db['ServicenowAccount'][_0x4135('0x47')](_0x1a7048[_0x4135('0x48')],{})[_0x4135('0x23')](respondWithResult(_0x6bd80b,0xc9))[_0x4135('0x43')](handleError(_0x6bd80b,null));};exports[_0x4135('0x22')]=function(_0x363907,_0x3da225){if(_0x363907['body']['id']){delete _0x363907[_0x4135('0x48')]['id'];}return db['ServicenowAccount'][_0x4135('0x49')]({'where':{'id':_0x363907[_0x4135('0x45')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x3da225,null))[_0x4135('0x23')](saveUpdates(_0x363907[_0x4135('0x48')],null))[_0x4135('0x23')](respondWithResult(_0x3da225,null))[_0x4135('0x43')](handleError(_0x3da225,null));};exports[_0x4135('0x4a')]=function(_0x39a366,_0x5cdead){return db[_0x4135('0x2b')]['find']({'where':{'id':_0x39a366[_0x4135('0x45')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x5cdead,null))[_0x4135('0x23')](removeEntity(_0x5cdead,null))[_0x4135('0x43')](handleError(_0x5cdead,null));};exports['getConfigurations']=function(_0x565a3d,_0x8919e,_0x2258dd){var _0x4f5e85={};var _0x3fcf34={};var _0x25c683;var _0x144b7b;return db['ServicenowAccount'][_0x4135('0x4b')]({'where':{'id':_0x565a3d[_0x4135('0x45')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x8919e,null))['then'](function(_0x4d4df4){if(_0x4d4df4){_0x25c683=_0x4d4df4;_0x3fcf34[_0x4135('0x30')]=_[_0x4135('0x4c')](db['ServicenowConfiguration']['rawAttributes']);_0x3fcf34['query']=_[_0x4135('0x4c')](_0x565a3d[_0x4135('0x31')]);_0x3fcf34['filters']=_[_0x4135('0x33')](_0x3fcf34[_0x4135('0x30')],_0x3fcf34['query']);_0x4f5e85['attributes']=_[_0x4135('0x33')](_0x3fcf34[_0x4135('0x30')],qs[_0x4135('0x35')](_0x565a3d[_0x4135('0x31')][_0x4135('0x35')]));_0x4f5e85['attributes']=_0x4f5e85['attributes'][_0x4135('0x36')]?_0x4f5e85[_0x4135('0x34')]:_0x3fcf34[_0x4135('0x30')];_0x4f5e85[_0x4135('0x4d')]=qs['sort'](_0x565a3d[_0x4135('0x31')]['sort']);_0x4f5e85[_0x4135('0x3b')]=qs[_0x4135('0x32')](_['pick'](_0x565a3d['query'],_0x3fcf34[_0x4135('0x32')]));if(_0x565a3d[_0x4135('0x31')][_0x4135('0x3d')]){_0x4f5e85[_0x4135('0x3b')]=_[_0x4135('0x46')](_0x4f5e85[_0x4135('0x3b')],{'$or':_['map'](_0x4f5e85['attributes'],function(_0x293f63){var _0x4e2fe7={};_0x4e2fe7[_0x293f63]={'$like':'%'+_0x565a3d[_0x4135('0x31')][_0x4135('0x3d')]+'%'};return _0x4e2fe7;})});}_0x4f5e85=_['merge']({},_0x4f5e85,_0x565a3d[_0x4135('0x3e')]);return _0x25c683[_0x4135('0x4e')](_0x4f5e85);}})[_0x4135('0x23')](function(_0x1a8225){if(_0x1a8225){_0x144b7b=_0x1a8225[_0x4135('0x36')];if(!_0x565a3d[_0x4135('0x31')][_0x4135('0x37')](_0x4135('0x38'))){_0x4f5e85['limit']=qs[_0x4135('0x1c')](_0x565a3d['query'][_0x4135('0x1c')]);_0x4f5e85['offset']=qs[_0x4135('0x1a')](_0x565a3d['query']['offset']);}return _0x25c683[_0x4135('0x4e')](_0x4f5e85);}})['then'](function(_0x10f465){if(_0x10f465){return _0x10f465?{'count':_0x144b7b,'rows':_0x10f465}:null;}})[_0x4135('0x23')](respondWithResult(_0x8919e,null))['catch'](handleError(_0x8919e,null));};exports[_0x4135('0x4f')]=function(_0x18198a,_0x13ead7,_0x2063fb){if(_0x18198a[_0x4135('0x48')]['id']){delete _0x18198a['body']['id'];}return db[_0x4135('0x2b')][_0x4135('0x4b')]({'where':{'id':_0x18198a[_0x4135('0x45')]['id']}})['then'](handleEntityNotFound(_0x13ead7,null))['then'](function(_0x5e6c71){if(_0x5e6c71){_0x18198a['body'][_0x4135('0x50')]=_0x5e6c71['id'];_0x18198a[_0x4135('0x48')][_0x4135('0x51')]=integrations[_0x4135('0x52')](_0x18198a[_0x4135('0x48')]['channel'],_0x18198a[_0x4135('0x48')]['type']);_0x18198a[_0x4135('0x48')][_0x4135('0x53')]=integrations[_0x4135('0x54')](_0x18198a[_0x4135('0x48')][_0x4135('0x55')],_0x18198a[_0x4135('0x48')]['type']);return db[_0x4135('0x56')][_0x4135('0x47')](_0x18198a[_0x4135('0x48')],{'include':[{'model':db[_0x4135('0x57')],'as':'Subjects'},{'model':db[_0x4135('0x57')],'as':_0x4135('0x53')}]});}return null;})[_0x4135('0x23')](respondWithResult(_0x13ead7,null))['catch'](handleError(_0x13ead7,null));};exports[_0x4135('0x58')]=function(_0x295109,_0x269aad,_0x3a8b5f){var _0x237dc8=[_0x4135('0x59'),_0x4135('0x5a'),_0x4135('0x5b'),'subcategory','close_code',_0x4135('0x5c'),_0x4135('0x5d'),'severity',_0x4135('0x5e')];var _0x4d8fc5=[_0x4135('0x5f'),_0x4135('0x59'),'caused_by',_0x4135('0x60'),'upon_reject',_0x4135('0x61'),_0x4135('0x62'),_0x4135('0x5a'),'approval_history',_0x4135('0x63'),_0x4135('0x64'),_0x4135('0x65'),'opened_by',_0x4135('0x66'),_0x4135('0x67'),_0x4135('0x68'),_0x4135('0x69'),_0x4135('0x6a'),_0x4135('0x5b'),_0x4135('0x4d'),'calendar_stc','closed_at',_0x4135('0x6b'),'delivery_plan','impact','active',_0x4135('0x6c'),_0x4135('0x6d'),_0x4135('0x6e'),_0x4135('0x6f'),_0x4135('0x70'),_0x4135('0x71'),_0x4135('0x72'),'opened_at',_0x4135('0x73'),_0x4135('0x74'),_0x4135('0x75'),_0x4135('0x76'),_0x4135('0x77'),_0x4135('0x78'),_0x4135('0x79'),_0x4135('0x7a'),'work_notes',_0x4135('0x7b'),_0x4135('0x7c'),_0x4135('0x7d'),_0x4135('0x7e'),_0x4135('0x7f'),_0x4135('0x80'),_0x4135('0x81'),_0x4135('0x82'),_0x4135('0x83'),_0x4135('0x84'),_0x4135('0x5c'),'sys_class_name',_0x4135('0x85'),_0x4135('0x86'),_0x4135('0x87'),_0x4135('0x88'),_0x4135('0x89'),_0x4135('0x8a'),'reopened_by',_0x4135('0x5d'),_0x4135('0x8b'),_0x4135('0x8c'),_0x4135('0x8d'),_0x4135('0x8e'),_0x4135('0x8f'),_0x4135('0x90'),_0x4135('0x91'),_0x4135('0x92'),_0x4135('0x93'),_0x4135('0x94'),_0x4135('0x95'),_0x4135('0x96'),_0x4135('0x97'),'reopen_count','sys_tags',_0x4135('0x98'),_0x4135('0x99'),_0x4135('0x9a'),_0x4135('0x9b'),'category'];var _0x37d924='';var _0x1b5533='';var _0xdd7fee=[];var _0x17fef8='';var _0x4e46f1='';var _0x15d44e=[];var _0x5c2971='';var _0x71536d='';var _0x2f0b71={};var _0x2725bf='';return db[_0x4135('0x2b')][_0x4135('0x4b')]({'where':{'id':_0x295109['params']['id']},'attributes':['id',_0x4135('0x9c'),_0x4135('0x9d'),_0x4135('0x9e'),_0x4135('0x9f'),_0x4135('0xa0')]})[_0x4135('0x23')](handleEntityNotFound(_0x269aad,null))[_0x4135('0x23')](function(_0x38d246){if(_0x38d246){_0x2725bf=_0x38d246['remoteUri'];var _0x5e2cb0=_0x2725bf[_0x4135('0xa1')](-0x1);if(_0x5e2cb0==='/'){_0x2725bf=_0x2725bf[_0x4135('0xa2')](0x0,_0x2725bf[_0x4135('0xa3')](_0x5e2cb0));}_0x71536d=util[_0x4135('0xa4')](_0x4135('0xa5'),_0x2725bf);_0x5c2971=util['format'](_0x4135('0xa6'),_0x2725bf);_0x2f0b71={'user':_0x38d246[_0x4135('0x9c')],'pass':_0x38d246['password']};var _0x304138={'method':_0x4135('0xa7'),'uri':_0x71536d+_0x4135('0xa8'),'auth':_0x2f0b71,'json':!![]};return rp(_0x304138);}})[_0x4135('0x23')](function(_0x15c2af){if(_0x15c2af['result'][_0x4135('0x36')]>0x0){_0x37d924=_0x15c2af[_0x4135('0xa9')];}console[_0x4135('0xaa')](_0x4135('0xab'),_0x37d924);_0x15d44e=[];_0x1b5533=Object[_0x4135('0xac')]([],_0x37d924);_[_0x4135('0xad')](_0x1b5533,function(_0x2d2874){return!_0x237dc8[_0x4135('0xae')](_0x2d2874[_0x4135('0x27')]);});_0x1b5533['forEach'](function(_0x3e91be){var _0xf03e14=createFieldObject(_0x5c2971,_0x2f0b71,_0x3e91be[_0x4135('0xaf')],_0x3e91be[_0x4135('0x27')],_0x3e91be[_0x4135('0xb0')],![]);_0x15d44e[_0x4135('0xb1')](_0xf03e14);});return Promise[_0x4135('0xb2')](_0x15d44e);})[_0x4135('0x23')](function(_0x5922aa){_0xdd7fee=_0x5922aa;_0x17fef8=Object[_0x4135('0xac')]([],_0x37d924);console[_0x4135('0xaa')]('TCL:\x20_object',_0x37d924);_[_0x4135('0xad')](_0x17fef8,function(_0x2668f8){return _0x4d8fc5[_0x4135('0xae')](_0x2668f8[_0x4135('0x27')]);});console[_0x4135('0xaa')](_0x4135('0xb3'),_0x17fef8);_0x15d44e=[];_0x17fef8[_0x4135('0xb4')](function(_0x287496){var _0x562347=createFieldObject(_0x5c2971,_0x2f0b71,_0x287496['internalType'],_0x287496[_0x4135('0x27')],_0x287496['label'],!![]);_0x15d44e['push'](_0x562347);});return Promise['all'](_0x15d44e);})['then'](function(_0x1c1daa){_0x4e46f1=_0x1c1daa;var _0x1fa282=_0xdd7fee[_0x4135('0xb5')](_0x4e46f1);return{'count':_0x1fa282[_0x4135('0x36')],'rows':_0x1fa282};})['then'](respondWithResult(_0x269aad,null))['catch'](function(_0x5f544a){console[_0x4135('0xaa')](_0x4135('0xb6')+_0x5f544a);var _0x2c44d1=_0x295109[_0x4135('0x31')][_0x4135('0xb7')]?0x1f4:_0x5f544a[_0x4135('0xb8')]||0x1f4;logger[_0x4135('0x25')](_0x5f544a[_0x4135('0x26')]);delete _0x5f544a[_0x4135('0x27')];if(_0x2c44d1===0x191){_0x2c44d1=0x190;}_0x269aad[_0x4135('0x19')](_0x2c44d1)['send'](_0x295109[_0x4135('0x31')][_0x4135('0xb7')]?{'message':_0x4135('0xb9'),'statusCode':_0x5f544a[_0x4135('0xb8')]}:_0x5f544a);});};function createFieldObject(_0x1ef1f6,_0x4cf7d9,_0x4e544b,_0x48e55c,_0x436e2c,_0x51c54a){return new Promise(function(_0x444e83,_0x5b5a66){var _0x4e19aa={'id':_0x48e55c,'name':_0x436e2c,'custom':_0x51c54a};if(_0x4e544b===_0x4135('0xba')){_0x4e19aa[_0x4135('0x3e')]=[{'name':_0x4135('0xbb'),'value':_0x4135('0xbc')},{'name':_0x4135('0xbd'),'value':_0x4135('0xbe')}];_0x444e83(_0x4e19aa);}else{var _0xe269d7={'method':_0x4135('0xa7'),'uri':_0x1ef1f6+'sys_choice?sysparm_query=name=incident^element='+_0x48e55c,'auth':_0x4cf7d9,'json':!![]};return rp(_0xe269d7)[_0x4135('0x23')](function(_0x3bc495){var _0x30290d=[];if(_0x3bc495[_0x4135('0xa9')][_0x4135('0x36')]>0x0){_0x3bc495[_0x4135('0xa9')][_0x4135('0xb4')](function(_0x436fa9){if(_0x436fa9['inactive']===_0x4135('0xbe')){var _0x202c0a={'name':_0x436fa9[_0x4135('0xb0')],'value':_0x436fa9[_0x4135('0xbf')]};_0x30290d['push'](_0x202c0a);}});}_0x4e19aa['options']=_0x30290d;if(_0x4e19aa['options'][_0x4135('0x36')]>0x0){_0x444e83(_0x4e19aa);}else{if(_0x51c54a==![]){_0x444e83();}else{_0x444e83(_0x4e19aa);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 987321f..5ecffd8 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x580238,_0x2adec2){var _0x3d5608=function(_0x281c35){while(--_0x281c35){_0x580238['push'](_0x580238['shift']());}};_0x3d5608(++_0x2adec2);}(_0x1cb9,0x14e));var _0x91cb=function(_0x52802f,_0x29f437){_0x52802f=_0x52802f-0x0;var _0x3407cb=_0x1cb9[_0x52802f];return _0x3407cb;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));var integrations=require(_0x91cb('0x8'));module[_0x91cb('0x9')]=function(_0x28543e,_0x3b9d98){return _0x28543e[_0x91cb('0xa')]('ServicenowAccount',attributes,{'tableName':_0x91cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0x4b94aa,_0x48c0ac){var _0x42b1ff=function(_0x31f42d){while(--_0x31f42d){_0x4b94aa['push'](_0x4b94aa['shift']());}};_0x42b1ff(++_0x48c0ac);}(_0xdc97,0x13b));var _0x7dc9=function(_0x29b4fe,_0x15e092){_0x29b4fe=_0x29b4fe-0x0;var _0x10a930=_0xdc97[_0x29b4fe];return _0x10a930;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index d1d15eb..b2088cc 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 _0x14b7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowServicenowAccount','ServicenowAccount','find','moment','bluebird'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x14b7,0x130));var _0x714b=function(_0x5e3cef,_0x3c57f5){_0x5e3cef=_0x5e3cef-0x0;var _0x34c370=_0x14b7[_0x5e3cef];return _0x34c370;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x714b('0x0'));var BPromise=require(_0x714b('0x1'));var rs=require(_0x714b('0x2'));var fs=require('fs');var Redis=require(_0x714b('0x3'));var db=require(_0x714b('0x4'))['db'];var utils=require(_0x714b('0x5'));var logger=require(_0x714b('0x6'))(_0x714b('0x7'));var config=require('../../config/environment');var jayson=require(_0x714b('0x8'));var client=jayson[_0x714b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dcc21,_0x4e85a6,_0x46e164){return new BPromise(function(_0x23d802,_0x21d277){return client['request'](_0x4dcc21,_0x46e164)[_0x714b('0xa')](function(_0x4af53e){logger[_0x714b('0xb')](_0x714b('0xc'),_0x4e85a6,_0x714b('0xd'));logger[_0x714b('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4e85a6,'request\x20sent',JSON[_0x714b('0xf')](_0x4af53e));if(_0x4af53e[_0x714b('0x10')]){if(_0x4af53e[_0x714b('0x10')][_0x714b('0x11')]===0x1f4){logger['error'](_0x714b('0xc'),_0x4e85a6,_0x4af53e[_0x714b('0x10')][_0x714b('0x12')]);return _0x21d277(_0x4af53e[_0x714b('0x10')][_0x714b('0x12')]);}logger[_0x714b('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x4e85a6,_0x4af53e[_0x714b('0x10')][_0x714b('0x12')]);return _0x23d802(_0x4af53e['error']['message']);}else{logger[_0x714b('0xb')](_0x714b('0xc'),_0x4e85a6,'request\x20sent');_0x23d802(_0x4af53e[_0x714b('0x13')][_0x714b('0x12')]);}})[_0x714b('0x14')](function(_0x50a1bd){logger[_0x714b('0x10')](_0x714b('0xc'),_0x4e85a6,_0x50a1bd);_0x21d277(_0x50a1bd);});});}exports[_0x714b('0x15')]=function(_0x3249a6){var _0x3ae588=this;return new Promise(function(_0x3208c9,_0x2bf46e){return db['ServicenowAccount'][_0x714b('0x16')]({'raw':_0x3249a6[_0x714b('0x17')]?_0x3249a6[_0x714b('0x17')][_0x714b('0x18')]===undefined?!![]:![]:!![],'where':_0x3249a6[_0x714b('0x17')]?_0x3249a6[_0x714b('0x17')][_0x714b('0x19')]||null:null,'attributes':_0x3249a6[_0x714b('0x17')]?_0x3249a6['options'][_0x714b('0x1a')]||null:null,'limit':_0x3249a6[_0x714b('0x17')]?_0x3249a6['options'][_0x714b('0x1b')]||null:null,'include':_0x3249a6[_0x714b('0x17')]?_0x3249a6['options']['include']?_[_0x714b('0x1c')](_0x3249a6[_0x714b('0x17')][_0x714b('0x1d')],function(_0x25033b){return{'model':db[_0x25033b['model']],'as':_0x25033b['as'],'attributes':_0x25033b[_0x714b('0x1a')],'include':_0x25033b[_0x714b('0x1d')]?_[_0x714b('0x1c')](_0x25033b[_0x714b('0x1d')],function(_0x369b75){return{'model':db[_0x369b75[_0x714b('0x1e')]],'as':_0x369b75['as'],'attributes':_0x369b75[_0x714b('0x1a')],'include':_0x369b75[_0x714b('0x1d')]?_['map'](_0x369b75['include'],function(_0x2ee1a0){return{'model':db[_0x2ee1a0[_0x714b('0x1e')]],'as':_0x2ee1a0['as'],'attributes':_0x2ee1a0[_0x714b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x714b('0xa')](function(_0x4c004c){logger[_0x714b('0xb')]('GetServicenowAccount',_0x3249a6);logger[_0x714b('0xe')](_0x714b('0x15'),_0x3249a6,JSON[_0x714b('0xf')](_0x4c004c));_0x3208c9(_0x4c004c);})['catch'](function(_0x5227ad){logger['error'](_0x714b('0x15'),_0x5227ad[_0x714b('0x12')],_0x3249a6);_0x2bf46e(_0x3ae588[_0x714b('0x10')](0x1f4,_0x5227ad['message']));});});};exports[_0x714b('0x1f')]=function(_0x53b0f9){var _0x39c633=this;return new Promise(function(_0x386308,_0x5ec9f0){return db[_0x714b('0x20')][_0x714b('0x21')]({'raw':_0x53b0f9[_0x714b('0x17')]?_0x53b0f9[_0x714b('0x17')][_0x714b('0x18')]===undefined?!![]:![]:!![],'where':_0x53b0f9['options']?_0x53b0f9[_0x714b('0x17')]['where']||null:null,'attributes':_0x53b0f9['options']?_0x53b0f9[_0x714b('0x17')]['attributes']||null:null,'include':_0x53b0f9[_0x714b('0x17')]?_0x53b0f9[_0x714b('0x17')][_0x714b('0x1d')]?_[_0x714b('0x1c')](_0x53b0f9[_0x714b('0x17')]['include'],function(_0x15c819){return{'model':db[_0x15c819[_0x714b('0x1e')]],'as':_0x15c819['as'],'attributes':_0x15c819[_0x714b('0x1a')],'include':_0x15c819[_0x714b('0x1d')]?_[_0x714b('0x1c')](_0x15c819['include'],function(_0x1a0b60){return{'model':db[_0x1a0b60[_0x714b('0x1e')]],'as':_0x1a0b60['as'],'attributes':_0x1a0b60[_0x714b('0x1a')],'include':_0x1a0b60[_0x714b('0x1d')]?_[_0x714b('0x1c')](_0x1a0b60[_0x714b('0x1d')],function(_0x36fa3b){return{'model':db[_0x36fa3b[_0x714b('0x1e')]],'as':_0x36fa3b['as'],'attributes':_0x36fa3b[_0x714b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47bd3c){logger['info']('ShowServicenowAccount',_0x53b0f9);logger[_0x714b('0xe')](_0x714b('0x1f'),_0x53b0f9,JSON[_0x714b('0xf')](_0x47bd3c));_0x386308(_0x47bd3c);})['catch'](function(_0x45976c){logger['error'](_0x714b('0x1f'),_0x45976c[_0x714b('0x12')],_0x53b0f9);_0x5ec9f0(_0x39c633[_0x714b('0x10')](0x1f4,_0x45976c[_0x714b('0x12')]));});});}; \ No newline at end of file +var _0xb495=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','options','raw','attributes','limit','include','map','model','catch','ShowServicenowAccount','where','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb495,0x93));var _0x5b49=function(_0x15133b,_0x23f799){_0x15133b=_0x15133b-0x0;var _0x4b5b08=_0xb495[_0x15133b];return _0x4b5b08;};'use strict';var _=require(_0x5b49('0x0'));var util=require(_0x5b49('0x1'));var moment=require(_0x5b49('0x2'));var BPromise=require(_0x5b49('0x3'));var rs=require(_0x5b49('0x4'));var fs=require('fs');var Redis=require(_0x5b49('0x5'));var db=require(_0x5b49('0x6'))['db'];var utils=require(_0x5b49('0x7'));var logger=require(_0x5b49('0x8'))(_0x5b49('0x9'));var config=require('../../config/environment');var jayson=require(_0x5b49('0xa'));var client=jayson[_0x5b49('0xb')][_0x5b49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x457649,_0x760ed5,_0x4eec8a){return new BPromise(function(_0x29f843,_0x1d2d1b){return client[_0x5b49('0xd')](_0x457649,_0x4eec8a)[_0x5b49('0xe')](function(_0x3b20ea){logger[_0x5b49('0xf')](_0x5b49('0x10'),_0x760ed5,_0x5b49('0x11'));logger[_0x5b49('0x12')](_0x5b49('0x13'),_0x760ed5,'request\x20sent',JSON[_0x5b49('0x14')](_0x3b20ea));if(_0x3b20ea[_0x5b49('0x15')]){if(_0x3b20ea[_0x5b49('0x15')][_0x5b49('0x16')]===0x1f4){logger[_0x5b49('0x15')](_0x5b49('0x10'),_0x760ed5,_0x3b20ea[_0x5b49('0x15')][_0x5b49('0x17')]);return _0x1d2d1b(_0x3b20ea['error']['message']);}logger[_0x5b49('0x15')](_0x5b49('0x10'),_0x760ed5,_0x3b20ea[_0x5b49('0x15')][_0x5b49('0x17')]);return _0x29f843(_0x3b20ea['error'][_0x5b49('0x17')]);}else{logger['info'](_0x5b49('0x10'),_0x760ed5,_0x5b49('0x11'));_0x29f843(_0x3b20ea[_0x5b49('0x18')]['message']);}})['catch'](function(_0x2931c1){logger[_0x5b49('0x15')](_0x5b49('0x10'),_0x760ed5,_0x2931c1);_0x1d2d1b(_0x2931c1);});});}exports[_0x5b49('0x19')]=function(_0x17b594){var _0x2a30be=this;return new Promise(function(_0x23d76b,_0x89377e){return db[_0x5b49('0x1a')]['findAll']({'raw':_0x17b594[_0x5b49('0x1b')]?_0x17b594[_0x5b49('0x1b')][_0x5b49('0x1c')]===undefined?!![]:![]:!![],'where':_0x17b594[_0x5b49('0x1b')]?_0x17b594[_0x5b49('0x1b')]['where']||null:null,'attributes':_0x17b594[_0x5b49('0x1b')]?_0x17b594[_0x5b49('0x1b')][_0x5b49('0x1d')]||null:null,'limit':_0x17b594['options']?_0x17b594[_0x5b49('0x1b')][_0x5b49('0x1e')]||null:null,'include':_0x17b594[_0x5b49('0x1b')]?_0x17b594[_0x5b49('0x1b')][_0x5b49('0x1f')]?_[_0x5b49('0x20')](_0x17b594[_0x5b49('0x1b')]['include'],function(_0x335f99){return{'model':db[_0x335f99[_0x5b49('0x21')]],'as':_0x335f99['as'],'attributes':_0x335f99[_0x5b49('0x1d')],'include':_0x335f99[_0x5b49('0x1f')]?_['map'](_0x335f99['include'],function(_0x16bf27){return{'model':db[_0x16bf27[_0x5b49('0x21')]],'as':_0x16bf27['as'],'attributes':_0x16bf27[_0x5b49('0x1d')],'include':_0x16bf27['include']?_['map'](_0x16bf27[_0x5b49('0x1f')],function(_0x4771b1){return{'model':db[_0x4771b1[_0x5b49('0x21')]],'as':_0x4771b1['as'],'attributes':_0x4771b1[_0x5b49('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5b49('0xe')](function(_0x5cdabe){logger[_0x5b49('0xf')](_0x5b49('0x19'),_0x17b594);logger[_0x5b49('0x12')](_0x5b49('0x19'),_0x17b594,JSON[_0x5b49('0x14')](_0x5cdabe));_0x23d76b(_0x5cdabe);})[_0x5b49('0x22')](function(_0x5cdc44){logger[_0x5b49('0x15')](_0x5b49('0x19'),_0x5cdc44[_0x5b49('0x17')],_0x17b594);_0x89377e(_0x2a30be[_0x5b49('0x15')](0x1f4,_0x5cdc44['message']));});});};exports[_0x5b49('0x23')]=function(_0x5e9462){var _0x2b064a=this;return new Promise(function(_0x4fef75,_0x26cf9){return db['ServicenowAccount']['find']({'raw':_0x5e9462['options']?_0x5e9462['options'][_0x5b49('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e9462['options']?_0x5e9462[_0x5b49('0x1b')][_0x5b49('0x24')]||null:null,'attributes':_0x5e9462['options']?_0x5e9462['options'][_0x5b49('0x1d')]||null:null,'include':_0x5e9462[_0x5b49('0x1b')]?_0x5e9462['options']['include']?_[_0x5b49('0x20')](_0x5e9462[_0x5b49('0x1b')]['include'],function(_0x531fec){return{'model':db[_0x531fec[_0x5b49('0x21')]],'as':_0x531fec['as'],'attributes':_0x531fec['attributes'],'include':_0x531fec[_0x5b49('0x1f')]?_[_0x5b49('0x20')](_0x531fec[_0x5b49('0x1f')],function(_0x20b820){return{'model':db[_0x20b820['model']],'as':_0x20b820['as'],'attributes':_0x20b820[_0x5b49('0x1d')],'include':_0x20b820[_0x5b49('0x1f')]?_['map'](_0x20b820[_0x5b49('0x1f')],function(_0x5505c1){return{'model':db[_0x5505c1[_0x5b49('0x21')]],'as':_0x5505c1['as'],'attributes':_0x5505c1[_0x5b49('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5b49('0xe')](function(_0x562d75){logger[_0x5b49('0xf')](_0x5b49('0x23'),_0x5e9462);logger['debug'](_0x5b49('0x23'),_0x5e9462,JSON['stringify'](_0x562d75));_0x4fef75(_0x562d75);})['catch'](function(_0x4bee6f){logger[_0x5b49('0x15')](_0x5b49('0x23'),_0x4bee6f[_0x5b49('0x17')],_0x5e9462);_0x26cf9(_0x2b064a['error'](0x1f4,_0x4bee6f[_0x5b49('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 4be0fbe..84dafa2 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 _0xd996=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','get','/:id','isAuthenticated','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x28eb09,_0x56aa34){var _0x38ac82=function(_0x384bd2){while(--_0x384bd2){_0x28eb09['push'](_0x28eb09['shift']());}};_0x38ac82(++_0x56aa34);}(_0xd996,0x179));var _0x6d99=function(_0x468290,_0x1f1de7){_0x468290=_0x468290-0x0;var _0x16c3ae=_0xd996[_0x468290];return _0x16c3ae;};'use strict';var multer=require(_0x6d99('0x0'));var util=require(_0x6d99('0x1'));var path=require('path');var timeout=require(_0x6d99('0x2'));var express=require(_0x6d99('0x3'));var router=express[_0x6d99('0x4')]();var fs_extra=require(_0x6d99('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6d99('0x6'));var config=require(_0x6d99('0x7'));var controller=require(_0x6d99('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d99('0x9')]);router[_0x6d99('0xa')](_0x6d99('0xb'),auth[_0x6d99('0xc')](),controller['show']);router['get'](_0x6d99('0xd'),auth[_0x6d99('0xc')](),controller['getFields']);router[_0x6d99('0xa')](_0x6d99('0xe'),auth[_0x6d99('0xc')](),controller['getSubjects']);router['get'](_0x6d99('0xf'),auth[_0x6d99('0xc')](),controller[_0x6d99('0x10')]);router[_0x6d99('0x11')]('/',auth[_0x6d99('0xc')](),controller['create']);router[_0x6d99('0x12')](_0x6d99('0xb'),auth['isAuthenticated'](),controller[_0x6d99('0x13')]);router[_0x6d99('0x14')](_0x6d99('0xb'),auth[_0x6d99('0xc')](),controller[_0x6d99('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2871=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3e14ac,_0x16ce05){var _0xe778ee=function(_0x21f1cd){while(--_0x21f1cd){_0x3e14ac['push'](_0x3e14ac['shift']());}};_0xe778ee(++_0x16ce05);}(_0x2871,0x1c4));var _0x1287=function(_0x4d3c17,_0x317c47){_0x4d3c17=_0x4d3c17-0x0;var _0xe81017=_0x2871[_0x4d3c17];return _0xe81017;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1287('0x0'));var express=require(_0x1287('0x1'));var router=express[_0x1287('0x2')]();var fs_extra=require(_0x1287('0x3'));var auth=require(_0x1287('0x4'));var interaction=require(_0x1287('0x5'));var config=require(_0x1287('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x1287('0x7')]('/',auth[_0x1287('0x8')](),controller[_0x1287('0x9')]);router[_0x1287('0x7')](_0x1287('0xa'),auth[_0x1287('0x8')](),controller[_0x1287('0xb')]);router[_0x1287('0x7')](_0x1287('0xc'),auth[_0x1287('0x8')](),controller[_0x1287('0xd')]);router[_0x1287('0x7')](_0x1287('0xe'),auth['isAuthenticated'](),controller[_0x1287('0xf')]);router[_0x1287('0x7')]('/:id/descriptions',auth[_0x1287('0x8')](),controller[_0x1287('0x10')]);router[_0x1287('0x11')]('/',auth[_0x1287('0x8')](),controller['create']);router[_0x1287('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1287('0x13')]);router[_0x1287('0x14')](_0x1287('0xa'),auth[_0x1287('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 3eef99b..d70690b 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 _0x73a7=['STRING','sequelize'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x73a7,0x1c7));var _0x773a=function(_0x15c97c,_0x3b0c64){_0x15c97c=_0x15c97c-0x0;var _0x3f869a=_0x73a7[_0x15c97c];return _0x3f869a;};'use strict';var Sequelize=require(_0x773a('0x0'));module['exports']={'name':{'type':Sequelize[_0x773a('0x1')]},'description':{'type':Sequelize[_0x773a('0x1')]}}; \ No newline at end of file +var _0xbc0b=['STRING','sequelize','exports'];(function(_0x987090,_0x25995d){var _0x49df8b=function(_0xf9a370){while(--_0xf9a370){_0x987090['push'](_0x987090['shift']());}};_0x49df8b(++_0x25995d);}(_0xbc0b,0x106));var _0xbbc0=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xbc0b[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0xbbc0('0x0'));module[_0xbbc0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbbc0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 129bc09..0759c3d 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 _0xdd53=['path','sox','ejs','fs-extra','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ServicenowConfiguration','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','include','findAll','catch','show','params','keys','includeAll','options','create','body','find','getFields','findOne','ServicenowField','rawAttributes','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x31efbe,_0x2c349f){var _0x3b354d=function(_0x2ba335){while(--_0x2ba335){_0x31efbe['push'](_0x31efbe['shift']());}};_0x3b354d(++_0x2c349f);}(_0xdd53,0x191));var _0x3dd5=function(_0x565115,_0x150f18){_0x565115=_0x565115-0x0;var _0x9a37c0=_0xdd53[_0x565115];return _0x9a37c0;};'use strict';var emlformat=require(_0x3dd5('0x0'));var rimraf=require(_0x3dd5('0x1'));var zipdir=require(_0x3dd5('0x2'));var jsonpatch=require(_0x3dd5('0x3'));var rp=require(_0x3dd5('0x4'));var moment=require(_0x3dd5('0x5'));var BPromise=require(_0x3dd5('0x6'));var Mustache=require(_0x3dd5('0x7'));var util=require(_0x3dd5('0x8'));var path=require(_0x3dd5('0x9'));var sox=require(_0x3dd5('0xa'));var csv=require('to-csv');var ejs=require(_0x3dd5('0xb'));var fs=require('fs');var fs_extra=require(_0x3dd5('0xc'));var _=require('lodash');var squel=require(_0x3dd5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3dd5('0xe'));var toCsv=require(_0x3dd5('0xf'));var querystring=require('querystring');var Papa=require(_0x3dd5('0x10'));var Redis=require('ioredis');var authService=require(_0x3dd5('0x11'));var qs=require(_0x3dd5('0x12'));var as=require(_0x3dd5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dd5('0x14'))(_0x3dd5('0x15'));var utils=require(_0x3dd5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3dd5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcd636b,_0x51d816){_0x51d816=_0x51d816||0xcc;return function(_0x396382){if(_0x396382){return _0xcd636b[_0x3dd5('0x18')](_0x51d816);}return _0xcd636b[_0x3dd5('0x19')](_0x51d816)[_0x3dd5('0x1a')]();};}function respondWithResult(_0x4c321b,_0x453165){_0x453165=_0x453165||0xc8;return function(_0x2e90b7){if(_0x2e90b7){return _0x4c321b[_0x3dd5('0x19')](_0x453165)[_0x3dd5('0x1b')](_0x2e90b7);}};}function respondWithFilteredResult(_0x62765a,_0x3d1838){return function(_0x2cbe65){if(_0x2cbe65){var _0x2d00b9=typeof _0x3d1838['offset']==='undefined'&&typeof _0x3d1838[_0x3dd5('0x1c')]==='undefined';var _0x528d6d=_0x2cbe65[_0x3dd5('0x1d')];var _0x2e4473=_0x2d00b9?0x0:_0x3d1838['offset'];var _0x190b49=_0x2d00b9?_0x2cbe65[_0x3dd5('0x1d')]:_0x3d1838[_0x3dd5('0x1e')]+_0x3d1838['limit'];var _0x4f7634;if(_0x190b49>=_0x528d6d){_0x190b49=_0x528d6d;_0x4f7634=0xc8;}else{_0x4f7634=0xce;}_0x62765a['status'](_0x4f7634);return _0x62765a[_0x3dd5('0x1f')](_0x3dd5('0x20'),_0x2e4473+'-'+_0x190b49+'/'+_0x528d6d)[_0x3dd5('0x1b')](_0x2cbe65);}return null;};}function patchUpdates(_0x5c59a5){return function(_0x3702a1){try{jsonpatch[_0x3dd5('0x21')](_0x3702a1,_0x5c59a5,!![]);}catch(_0x558ff2){return BPromise[_0x3dd5('0x22')](_0x558ff2);}return _0x3702a1[_0x3dd5('0x23')]();};}function saveUpdates(_0x34e5ba,_0x1d086e){return function(_0x4fb458){if(_0x4fb458){return _0x4fb458[_0x3dd5('0x24')](_0x34e5ba)['then'](function(_0xf48e11){return _0xf48e11;});}return null;};}function removeEntity(_0x4404fa,_0xdbf4dc){return function(_0x1674e1){if(_0x1674e1){return _0x1674e1[_0x3dd5('0x25')]()[_0x3dd5('0x26')](function(){_0x4404fa[_0x3dd5('0x19')](0xcc)[_0x3dd5('0x1a')]();});}};}function handleEntityNotFound(_0x156acf,_0x652972){return function(_0x437c77){if(!_0x437c77){_0x156acf['sendStatus'](0x194);}return _0x437c77;};}function handleError(_0x55ce6c,_0x2f9f66){_0x2f9f66=_0x2f9f66||0x1f4;return function(_0x58bb01){logger[_0x3dd5('0x27')](_0x58bb01[_0x3dd5('0x28')]);if(_0x58bb01['name']){delete _0x58bb01[_0x3dd5('0x29')];}_0x55ce6c['status'](_0x2f9f66)[_0x3dd5('0x2a')](_0x58bb01);};}exports[_0x3dd5('0x2b')]=function(_0x42aec2,_0x2a89cb){var _0x51494f={},_0x7b5215={},_0x50618d={'count':0x0,'rows':[]};var _0x5d4f60=_[_0x3dd5('0x2c')](db[_0x3dd5('0x2d')]['rawAttributes'],function(_0x5e57a9){return{'name':_0x5e57a9[_0x3dd5('0x2e')],'type':_0x5e57a9['type'][_0x3dd5('0x2f')]};});_0x7b5215[_0x3dd5('0x30')]=_['map'](_0x5d4f60,_0x3dd5('0x29'));_0x7b5215[_0x3dd5('0x31')]=_['keys'](_0x42aec2[_0x3dd5('0x31')]);_0x7b5215['filters']=_[_0x3dd5('0x32')](_0x7b5215[_0x3dd5('0x30')],_0x7b5215['query']);_0x51494f[_0x3dd5('0x33')]=_['intersection'](_0x7b5215[_0x3dd5('0x30')],qs['fields'](_0x42aec2['query'][_0x3dd5('0x34')]));_0x51494f[_0x3dd5('0x33')]=_0x51494f[_0x3dd5('0x33')][_0x3dd5('0x35')]?_0x51494f[_0x3dd5('0x33')]:_0x7b5215['model'];if(!_0x42aec2['query'][_0x3dd5('0x36')](_0x3dd5('0x37'))){_0x51494f[_0x3dd5('0x1c')]=qs[_0x3dd5('0x1c')](_0x42aec2['query'][_0x3dd5('0x1c')]);_0x51494f[_0x3dd5('0x1e')]=qs[_0x3dd5('0x1e')](_0x42aec2[_0x3dd5('0x31')][_0x3dd5('0x1e')]);}_0x51494f[_0x3dd5('0x38')]=qs['sort'](_0x42aec2[_0x3dd5('0x31')][_0x3dd5('0x39')]);_0x51494f['where']=qs[_0x3dd5('0x3a')](_[_0x3dd5('0x3b')](_0x42aec2[_0x3dd5('0x31')],_0x7b5215[_0x3dd5('0x3a')]),_0x5d4f60);if(_0x42aec2[_0x3dd5('0x31')]['filter']){_0x51494f[_0x3dd5('0x3c')]=_[_0x3dd5('0x3d')](_0x51494f[_0x3dd5('0x3c')],{'$or':_[_0x3dd5('0x2c')](_0x5d4f60,function(_0x464c6f){if(_0x464c6f[_0x3dd5('0x3e')]!==_0x3dd5('0x3f')){var _0x1aa3bb={};_0x1aa3bb[_0x464c6f[_0x3dd5('0x29')]]={'$like':'%'+_0x42aec2[_0x3dd5('0x31')][_0x3dd5('0x40')]+'%'};return _0x1aa3bb;}})});}_0x51494f=_[_0x3dd5('0x3d')]({},_0x51494f,_0x42aec2['options']);var _0x1eca85={'where':_0x51494f[_0x3dd5('0x3c')]};return db[_0x3dd5('0x2d')][_0x3dd5('0x1d')](_0x1eca85)[_0x3dd5('0x26')](function(_0x45c5b0){_0x50618d[_0x3dd5('0x1d')]=_0x45c5b0;if(_0x42aec2[_0x3dd5('0x31')]['includeAll']){_0x51494f[_0x3dd5('0x41')]=[{'all':!![]}];}return db[_0x3dd5('0x2d')][_0x3dd5('0x42')](_0x51494f);})['then'](function(_0x1444b4){_0x50618d['rows']=_0x1444b4;return _0x50618d;})['then'](respondWithFilteredResult(_0x2a89cb,_0x51494f))[_0x3dd5('0x43')](handleError(_0x2a89cb,null));};exports[_0x3dd5('0x44')]=function(_0x1fedae,_0x191b4c){var _0xaf8667={'raw':![],'where':{'id':_0x1fedae[_0x3dd5('0x45')]['id']}},_0x597514={};_0x597514[_0x3dd5('0x30')]=_[_0x3dd5('0x46')](db[_0x3dd5('0x2d')]['rawAttributes']);_0x597514['query']=_[_0x3dd5('0x46')](_0x1fedae[_0x3dd5('0x31')]);_0x597514[_0x3dd5('0x3a')]=_[_0x3dd5('0x32')](_0x597514[_0x3dd5('0x30')],_0x597514['query']);_0xaf8667[_0x3dd5('0x33')]=_['intersection'](_0x597514[_0x3dd5('0x30')],qs['fields'](_0x1fedae[_0x3dd5('0x31')][_0x3dd5('0x34')]));_0xaf8667[_0x3dd5('0x33')]=_0xaf8667[_0x3dd5('0x33')]['length']?_0xaf8667[_0x3dd5('0x33')]:_0x597514[_0x3dd5('0x30')];if(_0x1fedae[_0x3dd5('0x31')][_0x3dd5('0x47')]){_0xaf8667[_0x3dd5('0x41')]=[{'all':!![]}];}_0xaf8667=_[_0x3dd5('0x3d')]({},_0xaf8667,_0x1fedae[_0x3dd5('0x48')]);return db[_0x3dd5('0x2d')]['find'](_0xaf8667)[_0x3dd5('0x26')](handleEntityNotFound(_0x191b4c,null))[_0x3dd5('0x26')](respondWithResult(_0x191b4c,null))[_0x3dd5('0x43')](handleError(_0x191b4c,null));};exports[_0x3dd5('0x49')]=function(_0x1e81f6,_0x4e7e98){return db[_0x3dd5('0x2d')][_0x3dd5('0x49')](_0x1e81f6[_0x3dd5('0x4a')],{})[_0x3dd5('0x26')](respondWithResult(_0x4e7e98,0xc9))['catch'](handleError(_0x4e7e98,null));};exports[_0x3dd5('0x24')]=function(_0x1b10b2,_0x23588a){if(_0x1b10b2[_0x3dd5('0x4a')]['id']){delete _0x1b10b2[_0x3dd5('0x4a')]['id'];}return db[_0x3dd5('0x2d')][_0x3dd5('0x4b')]({'where':{'id':_0x1b10b2[_0x3dd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x23588a,null))[_0x3dd5('0x26')](saveUpdates(_0x1b10b2[_0x3dd5('0x4a')],null))[_0x3dd5('0x26')](respondWithResult(_0x23588a,null))[_0x3dd5('0x43')](handleError(_0x23588a,null));};exports[_0x3dd5('0x25')]=function(_0x56a726,_0x359a34){return db['ServicenowConfiguration'][_0x3dd5('0x4b')]({'where':{'id':_0x56a726[_0x3dd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x359a34,null))[_0x3dd5('0x26')](removeEntity(_0x359a34,null))[_0x3dd5('0x43')](handleError(_0x359a34,null));};exports[_0x3dd5('0x4c')]=function(_0x3053e4,_0x11b74b,_0x5e46b0){var _0x4f973a={};var _0x1791f8={};var _0x14066f;var _0xb9ba10;return db[_0x3dd5('0x2d')][_0x3dd5('0x4d')]({'where':{'id':_0x3053e4[_0x3dd5('0x45')]['id']}})[_0x3dd5('0x26')](handleEntityNotFound(_0x11b74b,null))['then'](function(_0x4f060a){if(_0x4f060a){_0x14066f=_0x4f060a;_0x1791f8['model']=_[_0x3dd5('0x46')](db[_0x3dd5('0x4e')][_0x3dd5('0x4f')]);_0x1791f8['query']=_[_0x3dd5('0x46')](_0x3053e4[_0x3dd5('0x31')]);_0x1791f8['filters']=_['intersection'](_0x1791f8[_0x3dd5('0x30')],_0x1791f8['query']);_0x4f973a[_0x3dd5('0x33')]=_[_0x3dd5('0x32')](_0x1791f8['model'],qs[_0x3dd5('0x34')](_0x3053e4[_0x3dd5('0x31')][_0x3dd5('0x34')]));_0x4f973a['attributes']=_0x4f973a[_0x3dd5('0x33')][_0x3dd5('0x35')]?_0x4f973a[_0x3dd5('0x33')]:_0x1791f8[_0x3dd5('0x30')];_0x4f973a[_0x3dd5('0x38')]=qs[_0x3dd5('0x39')](_0x3053e4[_0x3dd5('0x31')]['sort']);_0x4f973a[_0x3dd5('0x3c')]=qs[_0x3dd5('0x3a')](_[_0x3dd5('0x3b')](_0x3053e4[_0x3dd5('0x31')],_0x1791f8[_0x3dd5('0x3a')]));if(_0x3053e4[_0x3dd5('0x31')]['filter']){_0x4f973a['where']=_[_0x3dd5('0x3d')](_0x4f973a[_0x3dd5('0x3c')],{'$or':_[_0x3dd5('0x2c')](_0x4f973a[_0x3dd5('0x33')],function(_0x41ec98){var _0x424c23={};_0x424c23[_0x41ec98]={'$like':'%'+_0x3053e4['query'][_0x3dd5('0x40')]+'%'};return _0x424c23;})});}_0x4f973a=_[_0x3dd5('0x3d')]({},_0x4f973a,_0x3053e4[_0x3dd5('0x48')]);return _0x14066f[_0x3dd5('0x4c')](_0x4f973a);}})[_0x3dd5('0x26')](function(_0x2e91f8){if(_0x2e91f8){_0xb9ba10=_0x2e91f8[_0x3dd5('0x35')];if(!_0x3053e4[_0x3dd5('0x31')][_0x3dd5('0x36')](_0x3dd5('0x37'))){_0x4f973a['limit']=qs[_0x3dd5('0x1c')](_0x3053e4['query']['limit']);_0x4f973a[_0x3dd5('0x1e')]=qs[_0x3dd5('0x1e')](_0x3053e4[_0x3dd5('0x31')]['offset']);}return _0x14066f[_0x3dd5('0x4c')](_0x4f973a);}})[_0x3dd5('0x26')](function(_0x5e2ca0){if(_0x5e2ca0){return _0x5e2ca0?{'count':_0xb9ba10,'rows':_0x5e2ca0}:null;}})[_0x3dd5('0x26')](respondWithResult(_0x11b74b,null))[_0x3dd5('0x43')](handleError(_0x11b74b,null));};exports[_0x3dd5('0x50')]=function(_0x1de001,_0x48dfeb,_0x556fcb){var _0xd58547={};var _0x252edc={};var _0x2560e9;var _0x2b48c3;return db['ServicenowConfiguration'][_0x3dd5('0x4d')]({'where':{'id':_0x1de001[_0x3dd5('0x45')]['id']}})['then'](handleEntityNotFound(_0x48dfeb,null))[_0x3dd5('0x26')](function(_0x2c9b18){if(_0x2c9b18){_0x2560e9=_0x2c9b18;_0x252edc[_0x3dd5('0x30')]=_['keys'](db['ServicenowField'][_0x3dd5('0x4f')]);_0x252edc[_0x3dd5('0x31')]=_[_0x3dd5('0x46')](_0x1de001['query']);_0x252edc[_0x3dd5('0x3a')]=_[_0x3dd5('0x32')](_0x252edc[_0x3dd5('0x30')],_0x252edc[_0x3dd5('0x31')]);_0xd58547[_0x3dd5('0x33')]=_[_0x3dd5('0x32')](_0x252edc[_0x3dd5('0x30')],qs[_0x3dd5('0x34')](_0x1de001[_0x3dd5('0x31')][_0x3dd5('0x34')]));_0xd58547[_0x3dd5('0x33')]=_0xd58547[_0x3dd5('0x33')][_0x3dd5('0x35')]?_0xd58547[_0x3dd5('0x33')]:_0x252edc[_0x3dd5('0x30')];_0xd58547[_0x3dd5('0x38')]=qs['sort'](_0x1de001[_0x3dd5('0x31')]['sort']);_0xd58547[_0x3dd5('0x3c')]=qs[_0x3dd5('0x3a')](_[_0x3dd5('0x3b')](_0x1de001['query'],_0x252edc[_0x3dd5('0x3a')]));if(_0x1de001[_0x3dd5('0x31')][_0x3dd5('0x40')]){_0xd58547[_0x3dd5('0x3c')]=_[_0x3dd5('0x3d')](_0xd58547['where'],{'$or':_[_0x3dd5('0x2c')](_0xd58547[_0x3dd5('0x33')],function(_0x21fa59){var _0x1a1f06={};_0x1a1f06[_0x21fa59]={'$like':'%'+_0x1de001[_0x3dd5('0x31')]['filter']+'%'};return _0x1a1f06;})});}_0xd58547=_[_0x3dd5('0x3d')]({},_0xd58547,_0x1de001[_0x3dd5('0x48')]);return _0x2560e9['getSubjects'](_0xd58547);}})[_0x3dd5('0x26')](function(_0x272176){if(_0x272176){_0x2b48c3=_0x272176['length'];if(!_0x1de001[_0x3dd5('0x31')][_0x3dd5('0x36')](_0x3dd5('0x37'))){_0xd58547[_0x3dd5('0x1c')]=qs[_0x3dd5('0x1c')](_0x1de001[_0x3dd5('0x31')][_0x3dd5('0x1c')]);_0xd58547[_0x3dd5('0x1e')]=qs['offset'](_0x1de001['query'][_0x3dd5('0x1e')]);}return _0x2560e9['getSubjects'](_0xd58547);}})[_0x3dd5('0x26')](function(_0x217f2e){if(_0x217f2e){return _0x217f2e?{'count':_0x2b48c3,'rows':_0x217f2e}:null;}})['then'](respondWithResult(_0x48dfeb,null))[_0x3dd5('0x43')](handleError(_0x48dfeb,null));};exports[_0x3dd5('0x51')]=function(_0x5ddbf5,_0x367061,_0x206998){var _0x55b9e2={};var _0x495509={};var _0x3075de;var _0x42d344;return db[_0x3dd5('0x2d')][_0x3dd5('0x4d')]({'where':{'id':_0x5ddbf5[_0x3dd5('0x45')]['id']}})[_0x3dd5('0x26')](handleEntityNotFound(_0x367061,null))[_0x3dd5('0x26')](function(_0xe6f7ef){if(_0xe6f7ef){_0x3075de=_0xe6f7ef;_0x495509[_0x3dd5('0x30')]=_[_0x3dd5('0x46')](db[_0x3dd5('0x4e')]['rawAttributes']);_0x495509[_0x3dd5('0x31')]=_[_0x3dd5('0x46')](_0x5ddbf5['query']);_0x495509[_0x3dd5('0x3a')]=_['intersection'](_0x495509[_0x3dd5('0x30')],_0x495509[_0x3dd5('0x31')]);_0x55b9e2[_0x3dd5('0x33')]=_[_0x3dd5('0x32')](_0x495509[_0x3dd5('0x30')],qs[_0x3dd5('0x34')](_0x5ddbf5[_0x3dd5('0x31')][_0x3dd5('0x34')]));_0x55b9e2[_0x3dd5('0x33')]=_0x55b9e2[_0x3dd5('0x33')][_0x3dd5('0x35')]?_0x55b9e2[_0x3dd5('0x33')]:_0x495509[_0x3dd5('0x30')];_0x55b9e2[_0x3dd5('0x38')]=qs[_0x3dd5('0x39')](_0x5ddbf5[_0x3dd5('0x31')][_0x3dd5('0x39')]);_0x55b9e2[_0x3dd5('0x3c')]=qs[_0x3dd5('0x3a')](_[_0x3dd5('0x3b')](_0x5ddbf5['query'],_0x495509[_0x3dd5('0x3a')]));if(_0x5ddbf5['query'][_0x3dd5('0x40')]){_0x55b9e2[_0x3dd5('0x3c')]=_[_0x3dd5('0x3d')](_0x55b9e2[_0x3dd5('0x3c')],{'$or':_[_0x3dd5('0x2c')](_0x55b9e2[_0x3dd5('0x33')],function(_0xdd7240){var _0x12324d={};_0x12324d[_0xdd7240]={'$like':'%'+_0x5ddbf5[_0x3dd5('0x31')][_0x3dd5('0x40')]+'%'};return _0x12324d;})});}_0x55b9e2=_[_0x3dd5('0x3d')]({},_0x55b9e2,_0x5ddbf5[_0x3dd5('0x48')]);return _0x3075de['getDescriptions'](_0x55b9e2);}})['then'](function(_0x1d3c0c){if(_0x1d3c0c){_0x42d344=_0x1d3c0c[_0x3dd5('0x35')];if(!_0x5ddbf5[_0x3dd5('0x31')][_0x3dd5('0x36')](_0x3dd5('0x37'))){_0x55b9e2[_0x3dd5('0x1c')]=qs[_0x3dd5('0x1c')](_0x5ddbf5['query'][_0x3dd5('0x1c')]);_0x55b9e2[_0x3dd5('0x1e')]=qs[_0x3dd5('0x1e')](_0x5ddbf5['query'][_0x3dd5('0x1e')]);}return _0x3075de['getDescriptions'](_0x55b9e2);}})[_0x3dd5('0x26')](function(_0x3554d6){if(_0x3554d6){return _0x3554d6?{'count':_0x42d344,'rows':_0x3554d6}:null;}})[_0x3dd5('0x26')](respondWithResult(_0x367061,null))[_0x3dd5('0x43')](handleError(_0x367061,null));}; \ No newline at end of file +var _0x69e9=['intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','ServicenowField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x467565,_0x4bc0fd){var _0xeda33f=function(_0x5db390){while(--_0x5db390){_0x467565['push'](_0x467565['shift']());}};_0xeda33f(++_0x4bc0fd);}(_0x69e9,0xbf));var _0x969e=function(_0x46605b,_0x2e9da8){_0x46605b=_0x46605b-0x0;var _0x56c96f=_0x69e9[_0x46605b];return _0x56c96f;};'use strict';var emlformat=require(_0x969e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x969e('0x1'));var jsonpatch=require(_0x969e('0x2'));var rp=require(_0x969e('0x3'));var moment=require(_0x969e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x969e('0x5'));var path=require('path');var sox=require(_0x969e('0x6'));var csv=require(_0x969e('0x7'));var ejs=require(_0x969e('0x8'));var fs=require('fs');var fs_extra=require(_0x969e('0x9'));var _=require(_0x969e('0xa'));var squel=require(_0x969e('0xb'));var crypto=require(_0x969e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x969e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x969e('0xe'));var Papa=require(_0x969e('0xf'));var Redis=require(_0x969e('0x10'));var authService=require(_0x969e('0x11'));var qs=require(_0x969e('0x12'));var as=require(_0x969e('0x13'));var hardwareService=require(_0x969e('0x14'));var logger=require(_0x969e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x969e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x969e('0x17'))['db'];function respondWithStatusCode(_0x5f2193,_0x20d3b0){_0x20d3b0=_0x20d3b0||0xcc;return function(_0x2d135c){if(_0x2d135c){return _0x5f2193[_0x969e('0x18')](_0x20d3b0);}return _0x5f2193[_0x969e('0x19')](_0x20d3b0)[_0x969e('0x1a')]();};}function respondWithResult(_0x2f1d87,_0x4daedc){_0x4daedc=_0x4daedc||0xc8;return function(_0x4ea63a){if(_0x4ea63a){return _0x2f1d87[_0x969e('0x19')](_0x4daedc)['json'](_0x4ea63a);}};}function respondWithFilteredResult(_0x53072f,_0x63a9ac){return function(_0x3c3714){if(_0x3c3714){var _0x34ba53=typeof _0x63a9ac[_0x969e('0x1b')]==='undefined'&&typeof _0x63a9ac[_0x969e('0x1c')]===_0x969e('0x1d');var _0x1c58c1=_0x3c3714[_0x969e('0x1e')];var _0xe39663=_0x34ba53?0x0:_0x63a9ac[_0x969e('0x1b')];var _0x31b7aa=_0x34ba53?_0x3c3714[_0x969e('0x1e')]:_0x63a9ac[_0x969e('0x1b')]+_0x63a9ac[_0x969e('0x1c')];var _0x200ad0;if(_0x31b7aa>=_0x1c58c1){_0x31b7aa=_0x1c58c1;_0x200ad0=0xc8;}else{_0x200ad0=0xce;}_0x53072f[_0x969e('0x19')](_0x200ad0);return _0x53072f[_0x969e('0x1f')]('Content-Range',_0xe39663+'-'+_0x31b7aa+'/'+_0x1c58c1)['json'](_0x3c3714);}return null;};}function patchUpdates(_0x4707fb){return function(_0x5cdfa1){try{jsonpatch['apply'](_0x5cdfa1,_0x4707fb,!![]);}catch(_0x121be6){return BPromise[_0x969e('0x20')](_0x121be6);}return _0x5cdfa1[_0x969e('0x21')]();};}function saveUpdates(_0x2e2781,_0x2cfe6b){return function(_0x419e85){if(_0x419e85){return _0x419e85[_0x969e('0x22')](_0x2e2781)[_0x969e('0x23')](function(_0x1860c9){return _0x1860c9;});}return null;};}function removeEntity(_0x265f55,_0x33039c){return function(_0xed79a2){if(_0xed79a2){return _0xed79a2[_0x969e('0x24')]()[_0x969e('0x23')](function(){_0x265f55[_0x969e('0x19')](0xcc)[_0x969e('0x1a')]();});}};}function handleEntityNotFound(_0x2e27aa,_0x115503){return function(_0x4dd90d){if(!_0x4dd90d){_0x2e27aa[_0x969e('0x18')](0x194);}return _0x4dd90d;};}function handleError(_0x72c9be,_0x338f4b){_0x338f4b=_0x338f4b||0x1f4;return function(_0x57c18c){logger[_0x969e('0x25')](_0x57c18c[_0x969e('0x26')]);if(_0x57c18c[_0x969e('0x27')]){delete _0x57c18c[_0x969e('0x27')];}_0x72c9be[_0x969e('0x19')](_0x338f4b)[_0x969e('0x28')](_0x57c18c);};}exports[_0x969e('0x29')]=function(_0x3fd136,_0x290c6f){var _0x28e7bb={},_0x1c35a1={},_0x3aea95={'count':0x0,'rows':[]};var _0x178b61=_[_0x969e('0x2a')](db[_0x969e('0x2b')][_0x969e('0x2c')],function(_0x5f5362){return{'name':_0x5f5362[_0x969e('0x2d')],'type':_0x5f5362[_0x969e('0x2e')][_0x969e('0x2f')]};});_0x1c35a1[_0x969e('0x30')]=_[_0x969e('0x2a')](_0x178b61,_0x969e('0x27'));_0x1c35a1[_0x969e('0x31')]=_[_0x969e('0x32')](_0x3fd136[_0x969e('0x31')]);_0x1c35a1[_0x969e('0x33')]=_[_0x969e('0x34')](_0x1c35a1[_0x969e('0x30')],_0x1c35a1[_0x969e('0x31')]);_0x28e7bb[_0x969e('0x35')]=_[_0x969e('0x34')](_0x1c35a1['model'],qs[_0x969e('0x36')](_0x3fd136[_0x969e('0x31')][_0x969e('0x36')]));_0x28e7bb['attributes']=_0x28e7bb[_0x969e('0x35')][_0x969e('0x37')]?_0x28e7bb[_0x969e('0x35')]:_0x1c35a1['model'];if(!_0x3fd136[_0x969e('0x31')]['hasOwnProperty'](_0x969e('0x38'))){_0x28e7bb[_0x969e('0x1c')]=qs[_0x969e('0x1c')](_0x3fd136[_0x969e('0x31')][_0x969e('0x1c')]);_0x28e7bb[_0x969e('0x1b')]=qs['offset'](_0x3fd136['query'][_0x969e('0x1b')]);}_0x28e7bb[_0x969e('0x39')]=qs['sort'](_0x3fd136['query'][_0x969e('0x3a')]);_0x28e7bb['where']=qs['filters'](_['pick'](_0x3fd136['query'],_0x1c35a1[_0x969e('0x33')]),_0x178b61);if(_0x3fd136[_0x969e('0x31')][_0x969e('0x3b')]){_0x28e7bb['where']=_['merge'](_0x28e7bb[_0x969e('0x3c')],{'$or':_[_0x969e('0x2a')](_0x178b61,function(_0x2467e3){if(_0x2467e3[_0x969e('0x2e')]!==_0x969e('0x3d')){var _0x4c713c={};_0x4c713c[_0x2467e3[_0x969e('0x27')]]={'$like':'%'+_0x3fd136['query'][_0x969e('0x3b')]+'%'};return _0x4c713c;}})});}_0x28e7bb=_[_0x969e('0x3e')]({},_0x28e7bb,_0x3fd136[_0x969e('0x3f')]);var _0x369c7f={'where':_0x28e7bb[_0x969e('0x3c')]};return db[_0x969e('0x2b')][_0x969e('0x1e')](_0x369c7f)['then'](function(_0x444f21){_0x3aea95['count']=_0x444f21;if(_0x3fd136[_0x969e('0x31')]['includeAll']){_0x28e7bb[_0x969e('0x40')]=[{'all':!![]}];}return db[_0x969e('0x2b')][_0x969e('0x41')](_0x28e7bb);})[_0x969e('0x23')](function(_0x255019){_0x3aea95[_0x969e('0x42')]=_0x255019;return _0x3aea95;})[_0x969e('0x23')](respondWithFilteredResult(_0x290c6f,_0x28e7bb))[_0x969e('0x43')](handleError(_0x290c6f,null));};exports[_0x969e('0x44')]=function(_0x5bc8b3,_0x20e8e4){var _0x24dd7a={'raw':![],'where':{'id':_0x5bc8b3[_0x969e('0x45')]['id']}},_0x35e1a1={};_0x35e1a1[_0x969e('0x30')]=_[_0x969e('0x32')](db['ServicenowConfiguration'][_0x969e('0x2c')]);_0x35e1a1['query']=_[_0x969e('0x32')](_0x5bc8b3['query']);_0x35e1a1[_0x969e('0x33')]=_['intersection'](_0x35e1a1[_0x969e('0x30')],_0x35e1a1[_0x969e('0x31')]);_0x24dd7a['attributes']=_[_0x969e('0x34')](_0x35e1a1[_0x969e('0x30')],qs[_0x969e('0x36')](_0x5bc8b3['query'][_0x969e('0x36')]));_0x24dd7a[_0x969e('0x35')]=_0x24dd7a[_0x969e('0x35')][_0x969e('0x37')]?_0x24dd7a['attributes']:_0x35e1a1[_0x969e('0x30')];if(_0x5bc8b3[_0x969e('0x31')][_0x969e('0x46')]){_0x24dd7a[_0x969e('0x40')]=[{'all':!![]}];}_0x24dd7a=_[_0x969e('0x3e')]({},_0x24dd7a,_0x5bc8b3['options']);return db['ServicenowConfiguration'][_0x969e('0x47')](_0x24dd7a)[_0x969e('0x23')](handleEntityNotFound(_0x20e8e4,null))[_0x969e('0x23')](respondWithResult(_0x20e8e4,null))[_0x969e('0x43')](handleError(_0x20e8e4,null));};exports[_0x969e('0x48')]=function(_0x156b50,_0x28483a){return db[_0x969e('0x2b')][_0x969e('0x48')](_0x156b50['body'],{})[_0x969e('0x23')](respondWithResult(_0x28483a,0xc9))[_0x969e('0x43')](handleError(_0x28483a,null));};exports[_0x969e('0x22')]=function(_0x5f29bf,_0xdfbd29){if(_0x5f29bf[_0x969e('0x49')]['id']){delete _0x5f29bf[_0x969e('0x49')]['id'];}return db[_0x969e('0x2b')]['find']({'where':{'id':_0x5f29bf[_0x969e('0x45')]['id']}})[_0x969e('0x23')](handleEntityNotFound(_0xdfbd29,null))[_0x969e('0x23')](saveUpdates(_0x5f29bf[_0x969e('0x49')],null))[_0x969e('0x23')](respondWithResult(_0xdfbd29,null))[_0x969e('0x43')](handleError(_0xdfbd29,null));};exports[_0x969e('0x24')]=function(_0x50145d,_0x1fd34a){return db[_0x969e('0x2b')][_0x969e('0x47')]({'where':{'id':_0x50145d[_0x969e('0x45')]['id']}})[_0x969e('0x23')](handleEntityNotFound(_0x1fd34a,null))[_0x969e('0x23')](removeEntity(_0x1fd34a,null))[_0x969e('0x43')](handleError(_0x1fd34a,null));};exports[_0x969e('0x4a')]=function(_0x2c6268,_0x2e7a23,_0x3c715e){var _0x1677e2={};var _0x3d2fe8={};var _0x1e1f66;var _0x3abeea;return db['ServicenowConfiguration'][_0x969e('0x4b')]({'where':{'id':_0x2c6268[_0x969e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e7a23,null))['then'](function(_0x4fe886){if(_0x4fe886){_0x1e1f66=_0x4fe886;_0x3d2fe8[_0x969e('0x30')]=_[_0x969e('0x32')](db[_0x969e('0x4c')][_0x969e('0x2c')]);_0x3d2fe8[_0x969e('0x31')]=_['keys'](_0x2c6268[_0x969e('0x31')]);_0x3d2fe8[_0x969e('0x33')]=_[_0x969e('0x34')](_0x3d2fe8[_0x969e('0x30')],_0x3d2fe8[_0x969e('0x31')]);_0x1677e2[_0x969e('0x35')]=_[_0x969e('0x34')](_0x3d2fe8[_0x969e('0x30')],qs['fields'](_0x2c6268[_0x969e('0x31')][_0x969e('0x36')]));_0x1677e2['attributes']=_0x1677e2[_0x969e('0x35')][_0x969e('0x37')]?_0x1677e2[_0x969e('0x35')]:_0x3d2fe8['model'];_0x1677e2[_0x969e('0x39')]=qs[_0x969e('0x3a')](_0x2c6268[_0x969e('0x31')]['sort']);_0x1677e2[_0x969e('0x3c')]=qs[_0x969e('0x33')](_[_0x969e('0x4d')](_0x2c6268['query'],_0x3d2fe8['filters']));if(_0x2c6268[_0x969e('0x31')][_0x969e('0x3b')]){_0x1677e2['where']=_[_0x969e('0x3e')](_0x1677e2['where'],{'$or':_[_0x969e('0x2a')](_0x1677e2[_0x969e('0x35')],function(_0x4d7717){var _0x519217={};_0x519217[_0x4d7717]={'$like':'%'+_0x2c6268[_0x969e('0x31')][_0x969e('0x3b')]+'%'};return _0x519217;})});}_0x1677e2=_['merge']({},_0x1677e2,_0x2c6268[_0x969e('0x3f')]);return _0x1e1f66[_0x969e('0x4a')](_0x1677e2);}})[_0x969e('0x23')](function(_0x4a2683){if(_0x4a2683){_0x3abeea=_0x4a2683[_0x969e('0x37')];if(!_0x2c6268[_0x969e('0x31')][_0x969e('0x4e')](_0x969e('0x38'))){_0x1677e2[_0x969e('0x1c')]=qs['limit'](_0x2c6268[_0x969e('0x31')][_0x969e('0x1c')]);_0x1677e2['offset']=qs[_0x969e('0x1b')](_0x2c6268[_0x969e('0x31')][_0x969e('0x1b')]);}return _0x1e1f66['getFields'](_0x1677e2);}})['then'](function(_0x1991ef){if(_0x1991ef){return _0x1991ef?{'count':_0x3abeea,'rows':_0x1991ef}:null;}})[_0x969e('0x23')](respondWithResult(_0x2e7a23,null))['catch'](handleError(_0x2e7a23,null));};exports[_0x969e('0x4f')]=function(_0x2bde8f,_0x530d5e,_0x4c5ac1){var _0x3beea3={};var _0x43b944={};var _0x2aaaba;var _0x104514;return db[_0x969e('0x2b')]['findOne']({'where':{'id':_0x2bde8f[_0x969e('0x45')]['id']}})['then'](handleEntityNotFound(_0x530d5e,null))[_0x969e('0x23')](function(_0x2b4ff4){if(_0x2b4ff4){_0x2aaaba=_0x2b4ff4;_0x43b944[_0x969e('0x30')]=_[_0x969e('0x32')](db['ServicenowField'][_0x969e('0x2c')]);_0x43b944[_0x969e('0x31')]=_[_0x969e('0x32')](_0x2bde8f['query']);_0x43b944['filters']=_['intersection'](_0x43b944[_0x969e('0x30')],_0x43b944[_0x969e('0x31')]);_0x3beea3[_0x969e('0x35')]=_[_0x969e('0x34')](_0x43b944[_0x969e('0x30')],qs[_0x969e('0x36')](_0x2bde8f[_0x969e('0x31')][_0x969e('0x36')]));_0x3beea3[_0x969e('0x35')]=_0x3beea3[_0x969e('0x35')]['length']?_0x3beea3['attributes']:_0x43b944[_0x969e('0x30')];_0x3beea3[_0x969e('0x39')]=qs[_0x969e('0x3a')](_0x2bde8f[_0x969e('0x31')]['sort']);_0x3beea3['where']=qs[_0x969e('0x33')](_['pick'](_0x2bde8f[_0x969e('0x31')],_0x43b944[_0x969e('0x33')]));if(_0x2bde8f[_0x969e('0x31')]['filter']){_0x3beea3[_0x969e('0x3c')]=_[_0x969e('0x3e')](_0x3beea3[_0x969e('0x3c')],{'$or':_[_0x969e('0x2a')](_0x3beea3[_0x969e('0x35')],function(_0x3954f7){var _0x105968={};_0x105968[_0x3954f7]={'$like':'%'+_0x2bde8f['query']['filter']+'%'};return _0x105968;})});}_0x3beea3=_[_0x969e('0x3e')]({},_0x3beea3,_0x2bde8f[_0x969e('0x3f')]);return _0x2aaaba[_0x969e('0x4f')](_0x3beea3);}})[_0x969e('0x23')](function(_0x41902f){if(_0x41902f){_0x104514=_0x41902f['length'];if(!_0x2bde8f[_0x969e('0x31')][_0x969e('0x4e')](_0x969e('0x38'))){_0x3beea3['limit']=qs['limit'](_0x2bde8f['query']['limit']);_0x3beea3['offset']=qs[_0x969e('0x1b')](_0x2bde8f['query']['offset']);}return _0x2aaaba[_0x969e('0x4f')](_0x3beea3);}})[_0x969e('0x23')](function(_0x2a35f2){if(_0x2a35f2){return _0x2a35f2?{'count':_0x104514,'rows':_0x2a35f2}:null;}})['then'](respondWithResult(_0x530d5e,null))['catch'](handleError(_0x530d5e,null));};exports['getDescriptions']=function(_0x95db3b,_0x3be030,_0xce3c28){var _0x47aef2={};var _0x3a2d86={};var _0x11f74b;var _0x4f31b1;return db[_0x969e('0x2b')]['findOne']({'where':{'id':_0x95db3b['params']['id']}})[_0x969e('0x23')](handleEntityNotFound(_0x3be030,null))[_0x969e('0x23')](function(_0xdda65){if(_0xdda65){_0x11f74b=_0xdda65;_0x3a2d86[_0x969e('0x30')]=_['keys'](db[_0x969e('0x4c')][_0x969e('0x2c')]);_0x3a2d86[_0x969e('0x31')]=_[_0x969e('0x32')](_0x95db3b[_0x969e('0x31')]);_0x3a2d86[_0x969e('0x33')]=_[_0x969e('0x34')](_0x3a2d86[_0x969e('0x30')],_0x3a2d86['query']);_0x47aef2[_0x969e('0x35')]=_['intersection'](_0x3a2d86[_0x969e('0x30')],qs[_0x969e('0x36')](_0x95db3b[_0x969e('0x31')][_0x969e('0x36')]));_0x47aef2[_0x969e('0x35')]=_0x47aef2[_0x969e('0x35')]['length']?_0x47aef2[_0x969e('0x35')]:_0x3a2d86[_0x969e('0x30')];_0x47aef2[_0x969e('0x39')]=qs[_0x969e('0x3a')](_0x95db3b[_0x969e('0x31')]['sort']);_0x47aef2[_0x969e('0x3c')]=qs[_0x969e('0x33')](_[_0x969e('0x4d')](_0x95db3b[_0x969e('0x31')],_0x3a2d86[_0x969e('0x33')]));if(_0x95db3b[_0x969e('0x31')][_0x969e('0x3b')]){_0x47aef2['where']=_[_0x969e('0x3e')](_0x47aef2[_0x969e('0x3c')],{'$or':_['map'](_0x47aef2[_0x969e('0x35')],function(_0x76c086){var _0x19cf86={};_0x19cf86[_0x76c086]={'$like':'%'+_0x95db3b['query'][_0x969e('0x3b')]+'%'};return _0x19cf86;})});}_0x47aef2=_[_0x969e('0x3e')]({},_0x47aef2,_0x95db3b[_0x969e('0x3f')]);return _0x11f74b[_0x969e('0x50')](_0x47aef2);}})[_0x969e('0x23')](function(_0x343657){if(_0x343657){_0x4f31b1=_0x343657[_0x969e('0x37')];if(!_0x95db3b[_0x969e('0x31')][_0x969e('0x4e')]('nolimit')){_0x47aef2[_0x969e('0x1c')]=qs[_0x969e('0x1c')](_0x95db3b[_0x969e('0x31')]['limit']);_0x47aef2[_0x969e('0x1b')]=qs['offset'](_0x95db3b[_0x969e('0x31')]['offset']);}return _0x11f74b[_0x969e('0x50')](_0x47aef2);}})[_0x969e('0x23')](function(_0x367049){if(_0x367049){return _0x367049?{'count':_0x4f31b1,'rows':_0x367049}:null;}})[_0x969e('0x23')](respondWithResult(_0x3be030,null))['catch'](handleError(_0x3be030,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e805676..d93580d 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 _0x1cbc=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3a5f9c,_0x257a66){var _0x4290de=function(_0x29aa52){while(--_0x29aa52){_0x3a5f9c['push'](_0x3a5f9c['shift']());}};_0x4290de(++_0x257a66);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x7ad661,_0x1e4efa){_0x7ad661=_0x7ad661-0x0;var _0x363e14=_0x1cbc[_0x7ad661];return _0x363e14;};'use strict';var _=require(_0xc1cb('0x0'));var util=require('util');var logger=require(_0xc1cb('0x1'))(_0xc1cb('0x2'));var moment=require(_0xc1cb('0x3'));var BPromise=require(_0xc1cb('0x4'));var rp=require(_0xc1cb('0x5'));var fs=require('fs');var path=require(_0xc1cb('0x6'));var rimraf=require(_0xc1cb('0x7'));var config=require(_0xc1cb('0x8'));var attributes=require(_0xc1cb('0x9'));module[_0xc1cb('0xa')]=function(_0x1dacec,_0x27423b){return _0x1dacec['define'](_0xc1cb('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dd8=['../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2dd8,0x143));var _0x82dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2dd8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x82dd('0x0'));var util=require(_0x82dd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x82dd('0x2'));var BPromise=require(_0x82dd('0x3'));var rp=require(_0x82dd('0x4'));var fs=require('fs');var path=require(_0x82dd('0x5'));var rimraf=require(_0x82dd('0x6'));var config=require(_0x82dd('0x7'));var attributes=require(_0x82dd('0x8'));module['exports']=function(_0x4026c3,_0x1cfdce){return _0x4026c3[_0x82dd('0x9')](_0x82dd('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 0d3dc0d..8a45128 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 _0x788e=['ioredis','../../config/utils','../../config/logger','../../config/environment','http','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','util','moment','bluebird','randomstring'];(function(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0x788e,0x12e));var _0xe788=function(_0x2b47cd,_0x5ddb7d){_0x2b47cd=_0x2b47cd-0x0;var _0x64714f=_0x788e[_0x2b47cd];return _0x64714f;};'use strict';var _=require('lodash');var util=require(_0xe788('0x0'));var moment=require(_0xe788('0x1'));var BPromise=require(_0xe788('0x2'));var rs=require(_0xe788('0x3'));var fs=require('fs');var Redis=require(_0xe788('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe788('0x5'));var logger=require(_0xe788('0x6'))('rpc');var config=require(_0xe788('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe788('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5427f8,_0x4a64de,_0x2ebb4e){return new BPromise(function(_0x207656,_0x11bd2d){return client['request'](_0x5427f8,_0x2ebb4e)['then'](function(_0xf7ab45){logger['info'](_0xe788('0x9'),_0x4a64de,_0xe788('0xa'));logger['debug'](_0xe788('0xb'),_0x4a64de,'request\x20sent',JSON[_0xe788('0xc')](_0xf7ab45));if(_0xf7ab45[_0xe788('0xd')]){if(_0xf7ab45['error'][_0xe788('0xe')]===0x1f4){logger[_0xe788('0xd')](_0xe788('0x9'),_0x4a64de,_0xf7ab45[_0xe788('0xd')][_0xe788('0xf')]);return _0x11bd2d(_0xf7ab45[_0xe788('0xd')][_0xe788('0xf')]);}logger[_0xe788('0xd')](_0xe788('0x9'),_0x4a64de,_0xf7ab45['error'][_0xe788('0xf')]);return _0x207656(_0xf7ab45['error'][_0xe788('0xf')]);}else{logger[_0xe788('0x10')](_0xe788('0x9'),_0x4a64de,_0xe788('0xa'));_0x207656(_0xf7ab45['result']['message']);}})['catch'](function(_0x2df4d4){logger[_0xe788('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4a64de,_0x2df4d4);_0x11bd2d(_0x2df4d4);});});} \ No newline at end of file +var _0x6a88=['http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4cc1e4,_0x37b9f7){var _0x25cbcc=function(_0x2f617e){while(--_0x2f617e){_0x4cc1e4['push'](_0x4cc1e4['shift']());}};_0x25cbcc(++_0x37b9f7);}(_0x6a88,0x66));var _0x86a8=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0x6a88[_0x4e0b8c];return _0x633ecc;};'use strict';var _=require(_0x86a8('0x0'));var util=require(_0x86a8('0x1'));var moment=require(_0x86a8('0x2'));var BPromise=require(_0x86a8('0x3'));var rs=require(_0x86a8('0x4'));var fs=require('fs');var Redis=require(_0x86a8('0x5'));var db=require(_0x86a8('0x6'))['db'];var utils=require(_0x86a8('0x7'));var logger=require(_0x86a8('0x8'))(_0x86a8('0x9'));var config=require(_0x86a8('0xa'));var jayson=require(_0x86a8('0xb'));var client=jayson[_0x86a8('0xc')][_0x86a8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ad7f4,_0x180a0d,_0x5ab20a){return new BPromise(function(_0x11d890,_0x5c7204){return client[_0x86a8('0xe')](_0x3ad7f4,_0x5ab20a)['then'](function(_0xa5e0ad){logger['info'](_0x86a8('0xf'),_0x180a0d,_0x86a8('0x10'));logger[_0x86a8('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x180a0d,_0x86a8('0x10'),JSON[_0x86a8('0x12')](_0xa5e0ad));if(_0xa5e0ad[_0x86a8('0x13')]){if(_0xa5e0ad[_0x86a8('0x13')][_0x86a8('0x14')]===0x1f4){logger['error'](_0x86a8('0xf'),_0x180a0d,_0xa5e0ad['error'][_0x86a8('0x15')]);return _0x5c7204(_0xa5e0ad[_0x86a8('0x13')]['message']);}logger['error'](_0x86a8('0xf'),_0x180a0d,_0xa5e0ad[_0x86a8('0x13')][_0x86a8('0x15')]);return _0x11d890(_0xa5e0ad['error'][_0x86a8('0x15')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x180a0d,_0x86a8('0x10'));_0x11d890(_0xa5e0ad['result'][_0x86a8('0x15')]);}})[_0x86a8('0x16')](function(_0xcc74a4){logger[_0x86a8('0x13')](_0x86a8('0xf'),_0x180a0d,_0xcc74a4);_0x5c7204(_0xcc74a4);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4d4a70a..357ae06 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 _0x6556=['get','index','show','isAuthenticated','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0xb0ba5a,_0xa4a85f){var _0x211d11=function(_0x12571c){while(--_0x12571c){_0xb0ba5a['push'](_0xb0ba5a['shift']());}};_0x211d11(++_0xa4a85f);}(_0x6556,0x95));var _0x6655=function(_0x5a3cf7,_0x59b0b3){_0x5a3cf7=_0x5a3cf7-0x0;var _0x42987a=_0x6556[_0x5a3cf7];return _0x42987a;};'use strict';var multer=require(_0x6655('0x0'));var util=require(_0x6655('0x1'));var path=require(_0x6655('0x2'));var timeout=require(_0x6655('0x3'));var express=require(_0x6655('0x4'));var router=express[_0x6655('0x5')]();var fs_extra=require(_0x6655('0x6'));var auth=require(_0x6655('0x7'));var interaction=require(_0x6655('0x8'));var config=require(_0x6655('0x9'));var controller=require(_0x6655('0xa'));router[_0x6655('0xb')]('/',auth['isAuthenticated'](),controller[_0x6655('0xc')]);router[_0x6655('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6655('0xd')]);router['post']('/',auth[_0x6655('0xe')](),controller['create']);router[_0x6655('0xf')]('/:id',auth[_0x6655('0xe')](),controller['update']);router[_0x6655('0x10')](_0x6655('0x11'),auth[_0x6655('0xe')](),controller[_0x6655('0x12')]);module[_0x6655('0x13')]=router; \ No newline at end of file +var _0x55a0=['index','/:id','isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get'];(function(_0xa462fc,_0x307e1d){var _0xa850d9=function(_0x202193){while(--_0x202193){_0xa462fc['push'](_0xa462fc['shift']());}};_0xa850d9(++_0x307e1d);}(_0x55a0,0x14b));var _0x055a=function(_0x1cadce,_0xa2642){_0x1cadce=_0x1cadce-0x0;var _0x4e9be9=_0x55a0[_0x1cadce];return _0x4e9be9;};'use strict';var multer=require(_0x055a('0x0'));var util=require(_0x055a('0x1'));var path=require(_0x055a('0x2'));var timeout=require(_0x055a('0x3'));var express=require(_0x055a('0x4'));var router=express[_0x055a('0x5')]();var fs_extra=require(_0x055a('0x6'));var auth=require(_0x055a('0x7'));var interaction=require(_0x055a('0x8'));var config=require('../../config/environment');var controller=require(_0x055a('0x9'));router[_0x055a('0xa')]('/',auth['isAuthenticated'](),controller[_0x055a('0xb')]);router[_0x055a('0xa')](_0x055a('0xc'),auth[_0x055a('0xd')](),controller[_0x055a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x055a('0xf')](_0x055a('0xc'),auth[_0x055a('0xd')](),controller[_0x055a('0x10')]);router[_0x055a('0x11')](_0x055a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x055a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 1ba9ea9..2616b84 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 _0x11e8=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x533e5f,_0x527739){var _0x3aad76=function(_0x2a236f){while(--_0x2a236f){_0x533e5f['push'](_0x533e5f['shift']());}};_0x3aad76(++_0x527739);}(_0x11e8,0x1ec));var _0x811e=function(_0x5b97bc,_0x25dbef){_0x5b97bc=_0x5b97bc-0x0;var _0x3dc797=_0x11e8[_0x5b97bc];return _0x3dc797;};'use strict';var Sequelize=require(_0x811e('0x0'));module[_0x811e('0x1')]={'type':{'type':Sequelize[_0x811e('0x2')](_0x811e('0x3'),_0x811e('0x4'),_0x811e('0x5'),_0x811e('0x6'),_0x811e('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x811e('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x811e('0x3'),_0x811e('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x811e('0x8')]},'idField':{'type':Sequelize[_0x811e('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x811e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x811e('0x8')]}}; \ No newline at end of file +var _0x61cf=['sequelize','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x3feca4,_0xda09bc){var _0x4a8f83=function(_0x39ca42){while(--_0x39ca42){_0x3feca4['push'](_0x3feca4['shift']());}};_0x4a8f83(++_0xda09bc);}(_0x61cf,0xb4));var _0xf61c=function(_0x247e3e,_0x51411e){_0x247e3e=_0x247e3e-0x0;var _0x46085e=_0x61cf[_0x247e3e];return _0x46085e;};'use strict';var Sequelize=require(_0xf61c('0x0'));module['exports']={'type':{'type':Sequelize[_0xf61c('0x1')](_0xf61c('0x2'),'variable',_0xf61c('0x3'),_0xf61c('0x4'),_0xf61c('0x5')),'defaultValue':_0xf61c('0x2')},'content':{'type':Sequelize[_0xf61c('0x6')]},'key':{'type':Sequelize[_0xf61c('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf61c('0x7'),_0xf61c('0x3'))},'keyContent':{'type':Sequelize[_0xf61c('0x6')]},'idField':{'type':Sequelize[_0xf61c('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf61c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf61c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 48d1256..dcec455 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 _0xce53=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv'];(function(_0x323cc3,_0x2b540e){var _0x11a2fb=function(_0x17ae43){while(--_0x17ae43){_0x323cc3['push'](_0x323cc3['shift']());}};_0x11a2fb(++_0x2b540e);}(_0xce53,0x178));var _0x3ce5=function(_0xf1fd56,_0x17124e){_0xf1fd56=_0xf1fd56-0x0;var _0x19bef3=_0xce53[_0xf1fd56];return _0x19bef3;};'use strict';var emlformat=require(_0x3ce5('0x0'));var rimraf=require(_0x3ce5('0x1'));var zipdir=require(_0x3ce5('0x2'));var jsonpatch=require(_0x3ce5('0x3'));var rp=require(_0x3ce5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3ce5('0x5'));var util=require('util');var path=require(_0x3ce5('0x6'));var sox=require(_0x3ce5('0x7'));var csv=require(_0x3ce5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3ce5('0x9'));var crypto=require(_0x3ce5('0xa'));var jsforce=require(_0x3ce5('0xb'));var deskjs=require(_0x3ce5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3ce5('0xd'));var Redis=require(_0x3ce5('0xe'));var authService=require(_0x3ce5('0xf'));var qs=require(_0x3ce5('0x10'));var as=require(_0x3ce5('0x11'));var hardwareService=require(_0x3ce5('0x12'));var logger=require(_0x3ce5('0x13'))(_0x3ce5('0x14'));var utils=require(_0x3ce5('0x15'));var config=require(_0x3ce5('0x16'));var licenseUtil=require(_0x3ce5('0x17'));var db=require(_0x3ce5('0x18'))['db'];function respondWithStatusCode(_0x20214e,_0x1995d9){_0x1995d9=_0x1995d9||0xcc;return function(_0x278a1a){if(_0x278a1a){return _0x20214e['sendStatus'](_0x1995d9);}return _0x20214e['status'](_0x1995d9)[_0x3ce5('0x19')]();};}function respondWithResult(_0x15fc82,_0x1ae111){_0x1ae111=_0x1ae111||0xc8;return function(_0x47af2f){if(_0x47af2f){return _0x15fc82['status'](_0x1ae111)[_0x3ce5('0x1a')](_0x47af2f);}};}function respondWithFilteredResult(_0x44c5e9,_0x103a26){return function(_0x4c4ae9){if(_0x4c4ae9){var _0x3e3298=typeof _0x103a26[_0x3ce5('0x1b')]===_0x3ce5('0x1c')&&typeof _0x103a26[_0x3ce5('0x1d')]===_0x3ce5('0x1c');var _0x47843e=_0x4c4ae9['count'];var _0x11df91=_0x3e3298?0x0:_0x103a26[_0x3ce5('0x1b')];var _0x33a969=_0x3e3298?_0x4c4ae9['count']:_0x103a26['offset']+_0x103a26[_0x3ce5('0x1d')];var _0x132f23;if(_0x33a969>=_0x47843e){_0x33a969=_0x47843e;_0x132f23=0xc8;}else{_0x132f23=0xce;}_0x44c5e9[_0x3ce5('0x1e')](_0x132f23);return _0x44c5e9[_0x3ce5('0x1f')](_0x3ce5('0x20'),_0x11df91+'-'+_0x33a969+'/'+_0x47843e)[_0x3ce5('0x1a')](_0x4c4ae9);}return null;};}function patchUpdates(_0x36198f){return function(_0x1514fd){try{jsonpatch[_0x3ce5('0x21')](_0x1514fd,_0x36198f,!![]);}catch(_0x27afd1){return BPromise['reject'](_0x27afd1);}return _0x1514fd[_0x3ce5('0x22')]();};}function saveUpdates(_0x247b5b,_0x497a03){return function(_0x4f52f6){if(_0x4f52f6){return _0x4f52f6[_0x3ce5('0x23')](_0x247b5b)[_0x3ce5('0x24')](function(_0x212ac5){return _0x212ac5;});}return null;};}function removeEntity(_0x1bfd0a,_0x336bce){return function(_0xb21ac9){if(_0xb21ac9){return _0xb21ac9[_0x3ce5('0x25')]()[_0x3ce5('0x24')](function(){_0x1bfd0a[_0x3ce5('0x1e')](0xcc)[_0x3ce5('0x19')]();});}};}function handleEntityNotFound(_0x326159,_0x5e2414){return function(_0x1c2dad){if(!_0x1c2dad){_0x326159['sendStatus'](0x194);}return _0x1c2dad;};}function handleError(_0x42679b,_0x201ff8){_0x201ff8=_0x201ff8||0x1f4;return function(_0x21dd35){logger[_0x3ce5('0x26')](_0x21dd35[_0x3ce5('0x27')]);if(_0x21dd35[_0x3ce5('0x28')]){delete _0x21dd35[_0x3ce5('0x28')];}_0x42679b[_0x3ce5('0x1e')](_0x201ff8)[_0x3ce5('0x29')](_0x21dd35);};}exports[_0x3ce5('0x2a')]=function(_0x3185c0,_0x15c7b5){var _0x2e19dc={},_0x4aacb5={},_0x14a82d={'count':0x0,'rows':[]};var _0xd845e0=_[_0x3ce5('0x2b')](db[_0x3ce5('0x2c')]['rawAttributes'],function(_0xe7e65b){return{'name':_0xe7e65b[_0x3ce5('0x2d')],'type':_0xe7e65b[_0x3ce5('0x2e')]['key']};});_0x4aacb5['model']=_[_0x3ce5('0x2b')](_0xd845e0,_0x3ce5('0x28'));_0x4aacb5['query']=_[_0x3ce5('0x2f')](_0x3185c0[_0x3ce5('0x30')]);_0x4aacb5[_0x3ce5('0x31')]=_['intersection'](_0x4aacb5[_0x3ce5('0x32')],_0x4aacb5[_0x3ce5('0x30')]);_0x2e19dc[_0x3ce5('0x33')]=_[_0x3ce5('0x34')](_0x4aacb5[_0x3ce5('0x32')],qs[_0x3ce5('0x35')](_0x3185c0[_0x3ce5('0x30')][_0x3ce5('0x35')]));_0x2e19dc['attributes']=_0x2e19dc['attributes'][_0x3ce5('0x36')]?_0x2e19dc['attributes']:_0x4aacb5[_0x3ce5('0x32')];if(!_0x3185c0['query'][_0x3ce5('0x37')](_0x3ce5('0x38'))){_0x2e19dc['limit']=qs[_0x3ce5('0x1d')](_0x3185c0[_0x3ce5('0x30')][_0x3ce5('0x1d')]);_0x2e19dc[_0x3ce5('0x1b')]=qs[_0x3ce5('0x1b')](_0x3185c0[_0x3ce5('0x30')][_0x3ce5('0x1b')]);}_0x2e19dc[_0x3ce5('0x39')]=qs[_0x3ce5('0x3a')](_0x3185c0[_0x3ce5('0x30')][_0x3ce5('0x3a')]);_0x2e19dc[_0x3ce5('0x3b')]=qs[_0x3ce5('0x31')](_[_0x3ce5('0x3c')](_0x3185c0['query'],_0x4aacb5[_0x3ce5('0x31')]),_0xd845e0);if(_0x3185c0['query']['filter']){_0x2e19dc[_0x3ce5('0x3b')]=_[_0x3ce5('0x3d')](_0x2e19dc['where'],{'$or':_['map'](_0xd845e0,function(_0x823523){if(_0x823523[_0x3ce5('0x2e')]!==_0x3ce5('0x3e')){var _0xed9dfd={};_0xed9dfd[_0x823523[_0x3ce5('0x28')]]={'$like':'%'+_0x3185c0[_0x3ce5('0x30')][_0x3ce5('0x3f')]+'%'};return _0xed9dfd;}})});}_0x2e19dc=_[_0x3ce5('0x3d')]({},_0x2e19dc,_0x3185c0[_0x3ce5('0x40')]);var _0x470db0={'where':_0x2e19dc[_0x3ce5('0x3b')]};return db[_0x3ce5('0x2c')][_0x3ce5('0x41')](_0x470db0)[_0x3ce5('0x24')](function(_0x17921e){_0x14a82d[_0x3ce5('0x41')]=_0x17921e;if(_0x3185c0[_0x3ce5('0x30')][_0x3ce5('0x42')]){_0x2e19dc[_0x3ce5('0x43')]=[{'all':!![]}];}return db[_0x3ce5('0x2c')][_0x3ce5('0x44')](_0x2e19dc);})[_0x3ce5('0x24')](function(_0x36d1a6){_0x14a82d[_0x3ce5('0x45')]=_0x36d1a6;return _0x14a82d;})['then'](respondWithFilteredResult(_0x15c7b5,_0x2e19dc))[_0x3ce5('0x46')](handleError(_0x15c7b5,null));};exports[_0x3ce5('0x47')]=function(_0x122029,_0x4be2e){var _0x1d0e56={'raw':!![],'where':{'id':_0x122029[_0x3ce5('0x48')]['id']}},_0x383a92={};_0x383a92[_0x3ce5('0x32')]=_[_0x3ce5('0x2f')](db[_0x3ce5('0x2c')][_0x3ce5('0x49')]);_0x383a92['query']=_[_0x3ce5('0x2f')](_0x122029['query']);_0x383a92[_0x3ce5('0x31')]=_['intersection'](_0x383a92[_0x3ce5('0x32')],_0x383a92[_0x3ce5('0x30')]);_0x1d0e56[_0x3ce5('0x33')]=_[_0x3ce5('0x34')](_0x383a92[_0x3ce5('0x32')],qs[_0x3ce5('0x35')](_0x122029[_0x3ce5('0x30')][_0x3ce5('0x35')]));_0x1d0e56[_0x3ce5('0x33')]=_0x1d0e56[_0x3ce5('0x33')]['length']?_0x1d0e56[_0x3ce5('0x33')]:_0x383a92[_0x3ce5('0x32')];if(_0x122029['query']['includeAll']){_0x1d0e56[_0x3ce5('0x43')]=[{'all':!![]}];}_0x1d0e56=_['merge']({},_0x1d0e56,_0x122029['options']);return db['ServicenowField'][_0x3ce5('0x4a')](_0x1d0e56)[_0x3ce5('0x24')](handleEntityNotFound(_0x4be2e,null))[_0x3ce5('0x24')](respondWithResult(_0x4be2e,null))[_0x3ce5('0x46')](handleError(_0x4be2e,null));};exports[_0x3ce5('0x4b')]=function(_0x4d7ce6,_0x5e115b){return db[_0x3ce5('0x2c')][_0x3ce5('0x4b')](_0x4d7ce6[_0x3ce5('0x4c')],{})[_0x3ce5('0x24')](respondWithResult(_0x5e115b,0xc9))['catch'](handleError(_0x5e115b,null));};exports[_0x3ce5('0x23')]=function(_0x446ceb,_0x378cda){if(_0x446ceb[_0x3ce5('0x4c')]['id']){delete _0x446ceb[_0x3ce5('0x4c')]['id'];}return db[_0x3ce5('0x2c')][_0x3ce5('0x4a')]({'where':{'id':_0x446ceb['params']['id']}})[_0x3ce5('0x24')](handleEntityNotFound(_0x378cda,null))[_0x3ce5('0x24')](saveUpdates(_0x446ceb[_0x3ce5('0x4c')],null))[_0x3ce5('0x24')](respondWithResult(_0x378cda,null))[_0x3ce5('0x46')](handleError(_0x378cda,null));};exports[_0x3ce5('0x25')]=function(_0x57273d,_0x57276d){return db[_0x3ce5('0x2c')]['find']({'where':{'id':_0x57273d[_0x3ce5('0x48')]['id']}})['then'](handleEntityNotFound(_0x57276d,null))[_0x3ce5('0x24')](removeEntity(_0x57276d,null))[_0x3ce5('0x46')](handleError(_0x57276d,null));}; \ No newline at end of file +var _0xa482=['params','rawAttributes','attributes','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','json','undefined','limit','offset','set','Content-Range','reject','save','then','destroy','end','error','stack','name','status','send','index','map','ServicenowField','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x3c3ec7,_0x321114){var _0x535807=function(_0x3bc510){while(--_0x3bc510){_0x3c3ec7['push'](_0x3c3ec7['shift']());}};_0x535807(++_0x321114);}(_0xa482,0x127));var _0x2a48=function(_0x1f01ba,_0x5c456f){_0x1f01ba=_0x1f01ba-0x0;var _0x27598f=_0xa482[_0x1f01ba];return _0x27598f;};'use strict';var emlformat=require(_0x2a48('0x0'));var rimraf=require(_0x2a48('0x1'));var zipdir=require(_0x2a48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a48('0x3'));var moment=require('moment');var BPromise=require(_0x2a48('0x4'));var Mustache=require(_0x2a48('0x5'));var util=require(_0x2a48('0x6'));var path=require(_0x2a48('0x7'));var sox=require(_0x2a48('0x8'));var csv=require(_0x2a48('0x9'));var ejs=require(_0x2a48('0xa'));var fs=require('fs');var fs_extra=require(_0x2a48('0xb'));var _=require(_0x2a48('0xc'));var squel=require(_0x2a48('0xd'));var crypto=require(_0x2a48('0xe'));var jsforce=require(_0x2a48('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2a48('0x9'));var querystring=require(_0x2a48('0x10'));var Papa=require(_0x2a48('0x11'));var Redis=require(_0x2a48('0x12'));var authService=require(_0x2a48('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a48('0x14'));var logger=require(_0x2a48('0x15'))(_0x2a48('0x16'));var utils=require(_0x2a48('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2a48('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45580e,_0x3743e8){_0x3743e8=_0x3743e8||0xcc;return function(_0x44be98){if(_0x44be98){return _0x45580e[_0x2a48('0x19')](_0x3743e8);}return _0x45580e['status'](_0x3743e8)['end']();};}function respondWithResult(_0x36e3ba,_0x23a042){_0x23a042=_0x23a042||0xc8;return function(_0x2b6d00){if(_0x2b6d00){return _0x36e3ba['status'](_0x23a042)[_0x2a48('0x1a')](_0x2b6d00);}};}function respondWithFilteredResult(_0xb0b885,_0x58f690){return function(_0x264d04){if(_0x264d04){var _0x5b035f=typeof _0x58f690['offset']===_0x2a48('0x1b')&&typeof _0x58f690[_0x2a48('0x1c')]===_0x2a48('0x1b');var _0x94551c=_0x264d04['count'];var _0x1952be=_0x5b035f?0x0:_0x58f690['offset'];var _0x52536b=_0x5b035f?_0x264d04['count']:_0x58f690[_0x2a48('0x1d')]+_0x58f690['limit'];var _0x3cae81;if(_0x52536b>=_0x94551c){_0x52536b=_0x94551c;_0x3cae81=0xc8;}else{_0x3cae81=0xce;}_0xb0b885['status'](_0x3cae81);return _0xb0b885[_0x2a48('0x1e')](_0x2a48('0x1f'),_0x1952be+'-'+_0x52536b+'/'+_0x94551c)[_0x2a48('0x1a')](_0x264d04);}return null;};}function patchUpdates(_0x95a80c){return function(_0x2d9ed4){try{jsonpatch['apply'](_0x2d9ed4,_0x95a80c,!![]);}catch(_0x453ecb){return BPromise[_0x2a48('0x20')](_0x453ecb);}return _0x2d9ed4[_0x2a48('0x21')]();};}function saveUpdates(_0x15ce63,_0x5642bf){return function(_0x1b966d){if(_0x1b966d){return _0x1b966d['update'](_0x15ce63)[_0x2a48('0x22')](function(_0x2e2944){return _0x2e2944;});}return null;};}function removeEntity(_0x3dc3d8,_0xb77164){return function(_0x31d528){if(_0x31d528){return _0x31d528[_0x2a48('0x23')]()[_0x2a48('0x22')](function(){_0x3dc3d8['status'](0xcc)[_0x2a48('0x24')]();});}};}function handleEntityNotFound(_0x1222bd,_0x522d51){return function(_0xf22631){if(!_0xf22631){_0x1222bd[_0x2a48('0x19')](0x194);}return _0xf22631;};}function handleError(_0x293a9a,_0x39a5ec){_0x39a5ec=_0x39a5ec||0x1f4;return function(_0x168caf){logger[_0x2a48('0x25')](_0x168caf[_0x2a48('0x26')]);if(_0x168caf[_0x2a48('0x27')]){delete _0x168caf[_0x2a48('0x27')];}_0x293a9a[_0x2a48('0x28')](_0x39a5ec)[_0x2a48('0x29')](_0x168caf);};}exports[_0x2a48('0x2a')]=function(_0x120283,_0x53c625){var _0xecd6cb={},_0x2e15b8={},_0xcb2340={'count':0x0,'rows':[]};var _0x5805ac=_[_0x2a48('0x2b')](db[_0x2a48('0x2c')]['rawAttributes'],function(_0x3855cf){return{'name':_0x3855cf['fieldName'],'type':_0x3855cf[_0x2a48('0x2d')]['key']};});_0x2e15b8[_0x2a48('0x2e')]=_[_0x2a48('0x2b')](_0x5805ac,'name');_0x2e15b8[_0x2a48('0x2f')]=_[_0x2a48('0x30')](_0x120283[_0x2a48('0x2f')]);_0x2e15b8[_0x2a48('0x31')]=_['intersection'](_0x2e15b8['model'],_0x2e15b8[_0x2a48('0x2f')]);_0xecd6cb['attributes']=_[_0x2a48('0x32')](_0x2e15b8[_0x2a48('0x2e')],qs[_0x2a48('0x33')](_0x120283[_0x2a48('0x2f')][_0x2a48('0x33')]));_0xecd6cb['attributes']=_0xecd6cb['attributes'][_0x2a48('0x34')]?_0xecd6cb['attributes']:_0x2e15b8[_0x2a48('0x2e')];if(!_0x120283[_0x2a48('0x2f')][_0x2a48('0x35')](_0x2a48('0x36'))){_0xecd6cb[_0x2a48('0x1c')]=qs['limit'](_0x120283[_0x2a48('0x2f')][_0x2a48('0x1c')]);_0xecd6cb[_0x2a48('0x1d')]=qs[_0x2a48('0x1d')](_0x120283[_0x2a48('0x2f')][_0x2a48('0x1d')]);}_0xecd6cb['order']=qs[_0x2a48('0x37')](_0x120283[_0x2a48('0x2f')][_0x2a48('0x37')]);_0xecd6cb[_0x2a48('0x38')]=qs[_0x2a48('0x31')](_['pick'](_0x120283['query'],_0x2e15b8[_0x2a48('0x31')]),_0x5805ac);if(_0x120283[_0x2a48('0x2f')][_0x2a48('0x39')]){_0xecd6cb[_0x2a48('0x38')]=_[_0x2a48('0x3a')](_0xecd6cb['where'],{'$or':_[_0x2a48('0x2b')](_0x5805ac,function(_0x5956dd){if(_0x5956dd[_0x2a48('0x2d')]!==_0x2a48('0x3b')){var _0x25d206={};_0x25d206[_0x5956dd[_0x2a48('0x27')]]={'$like':'%'+_0x120283[_0x2a48('0x2f')][_0x2a48('0x39')]+'%'};return _0x25d206;}})});}_0xecd6cb=_[_0x2a48('0x3a')]({},_0xecd6cb,_0x120283['options']);var _0x104106={'where':_0xecd6cb['where']};return db[_0x2a48('0x2c')]['count'](_0x104106)[_0x2a48('0x22')](function(_0x57027b){_0xcb2340['count']=_0x57027b;if(_0x120283[_0x2a48('0x2f')][_0x2a48('0x3c')]){_0xecd6cb[_0x2a48('0x3d')]=[{'all':!![]}];}return db['ServicenowField'][_0x2a48('0x3e')](_0xecd6cb);})[_0x2a48('0x22')](function(_0x5ec578){_0xcb2340[_0x2a48('0x3f')]=_0x5ec578;return _0xcb2340;})[_0x2a48('0x22')](respondWithFilteredResult(_0x53c625,_0xecd6cb))[_0x2a48('0x40')](handleError(_0x53c625,null));};exports['show']=function(_0x4e60eb,_0x5d629f){var _0x4885a0={'raw':!![],'where':{'id':_0x4e60eb[_0x2a48('0x41')]['id']}},_0x1142df={};_0x1142df[_0x2a48('0x2e')]=_[_0x2a48('0x30')](db[_0x2a48('0x2c')][_0x2a48('0x42')]);_0x1142df[_0x2a48('0x2f')]=_[_0x2a48('0x30')](_0x4e60eb[_0x2a48('0x2f')]);_0x1142df[_0x2a48('0x31')]=_[_0x2a48('0x32')](_0x1142df[_0x2a48('0x2e')],_0x1142df[_0x2a48('0x2f')]);_0x4885a0[_0x2a48('0x43')]=_[_0x2a48('0x32')](_0x1142df[_0x2a48('0x2e')],qs[_0x2a48('0x33')](_0x4e60eb[_0x2a48('0x2f')]['fields']));_0x4885a0[_0x2a48('0x43')]=_0x4885a0['attributes'][_0x2a48('0x34')]?_0x4885a0['attributes']:_0x1142df['model'];if(_0x4e60eb['query'][_0x2a48('0x3c')]){_0x4885a0[_0x2a48('0x3d')]=[{'all':!![]}];}_0x4885a0=_[_0x2a48('0x3a')]({},_0x4885a0,_0x4e60eb['options']);return db[_0x2a48('0x2c')][_0x2a48('0x44')](_0x4885a0)[_0x2a48('0x22')](handleEntityNotFound(_0x5d629f,null))['then'](respondWithResult(_0x5d629f,null))[_0x2a48('0x40')](handleError(_0x5d629f,null));};exports[_0x2a48('0x45')]=function(_0x1d40d9,_0x7e455){return db[_0x2a48('0x2c')][_0x2a48('0x45')](_0x1d40d9[_0x2a48('0x46')],{})[_0x2a48('0x22')](respondWithResult(_0x7e455,0xc9))[_0x2a48('0x40')](handleError(_0x7e455,null));};exports[_0x2a48('0x47')]=function(_0x568751,_0x58d391){if(_0x568751[_0x2a48('0x46')]['id']){delete _0x568751[_0x2a48('0x46')]['id'];}return db['ServicenowField'][_0x2a48('0x44')]({'where':{'id':_0x568751[_0x2a48('0x41')]['id']}})[_0x2a48('0x22')](handleEntityNotFound(_0x58d391,null))[_0x2a48('0x22')](saveUpdates(_0x568751[_0x2a48('0x46')],null))[_0x2a48('0x22')](respondWithResult(_0x58d391,null))[_0x2a48('0x40')](handleError(_0x58d391,null));};exports[_0x2a48('0x23')]=function(_0x1ec279,_0x56cc6c){return db[_0x2a48('0x2c')][_0x2a48('0x44')]({'where':{'id':_0x1ec279['params']['id']}})[_0x2a48('0x22')](handleEntityNotFound(_0x56cc6c,null))[_0x2a48('0x22')](removeEntity(_0x56cc6c,null))[_0x2a48('0x40')](handleError(_0x56cc6c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 998f327..009c84b 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 _0x04d2=['ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x04d2,0x1e4));var _0x204d=function(_0x3dcd5a,_0xd603e3){_0x3dcd5a=_0x3dcd5a-0x0;var _0x2a81cf=_0x04d2[_0x3dcd5a];return _0x2a81cf;};'use strict';var _=require(_0x204d('0x0'));var util=require(_0x204d('0x1'));var logger=require(_0x204d('0x2'))(_0x204d('0x3'));var moment=require(_0x204d('0x4'));var BPromise=require('bluebird');var rp=require(_0x204d('0x5'));var fs=require('fs');var path=require(_0x204d('0x6'));var rimraf=require(_0x204d('0x7'));var config=require(_0x204d('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x204d('0x9')]=function(_0x136a08,_0x68034){return _0x136a08[_0x204d('0xa')](_0x204d('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x204d('0xc'),'fields':[_0x204d('0xd'),_0x204d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb708=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x3304a0,_0x200247){var _0x33378e=function(_0x216754){while(--_0x216754){_0x3304a0['push'](_0x3304a0['shift']());}};_0x33378e(++_0x200247);}(_0xb708,0x7f));var _0x8b70=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0xb708[_0x292f93];return _0x5a94b1;};'use strict';var _=require(_0x8b70('0x0'));var util=require(_0x8b70('0x1'));var logger=require(_0x8b70('0x2'))(_0x8b70('0x3'));var moment=require(_0x8b70('0x4'));var BPromise=require(_0x8b70('0x5'));var rp=require(_0x8b70('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b70('0x7'));var config=require('../../config/environment');var attributes=require(_0x8b70('0x8'));module[_0x8b70('0x9')]=function(_0x3cb929,_0x2563a3){return _0x3cb929[_0x8b70('0xa')](_0x8b70('0xb'),attributes,{'tableName':_0x8b70('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x8b70('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index ea5db4d..e1147cb 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2fdce0,_0x496242){var _0x36f07e=function(_0x44c8c6){while(--_0x44c8c6){_0x2fdce0['push'](_0x2fdce0['shift']());}};_0x36f07e(++_0x496242);}(_0xda3f,0xec));var _0xfda3=function(_0x5c3795,_0x3baaff){_0x5c3795=_0x5c3795-0x0;var _0x257e54=_0xda3f[_0x5c3795];return _0x257e54;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4eede4,_0x6a1071){var _0xabe8aa=function(_0x3d6200){while(--_0x3d6200){_0x4eede4['push'](_0x4eede4['shift']());}};_0xabe8aa(++_0x6a1071);}(_0xaa88,0x137));var _0x8aa8=function(_0x2fbd0e,_0x3460a9){_0x2fbd0e=_0x2fbd0e-0x0;var _0x481c9f=_0xaa88[_0x2fbd0e];return _0x481c9f;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ffdf560..88ec521 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(_0x55c5fc,_0x41b31a){var _0x2daec2=function(_0x222bea){while(--_0x222bea){_0x55c5fc['push'](_0x55c5fc['shift']());}};_0x2daec2(++_0x41b31a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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(_0x4a153d,_0x2393b6){var _0xfceb84=function(_0x39a805){while(--_0x39a805){_0x4a153d['push'](_0x4a153d['shift']());}};_0xfceb84(++_0x2393b6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 299ed4d..4e8708e 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(_0x16234b,_0x45ac14){var _0x3e503c=function(_0x1d54b6){while(--_0x1d54b6){_0x16234b['push'](_0x16234b['shift']());}};_0x3e503c(++_0x45ac14);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x44128f,_0x5ad1de){var _0x3e82bf=function(_0x3c3feb){while(--_0x3c3feb){_0x44128f['push'](_0x44128f['shift']());}};_0x3e82bf(++_0x5ad1de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index b7b0df6..6f207f7 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 _0x92b6=['reject','save','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','catch','show','params','merge','find','create','update','body','getConfigurations','findOne','SugarcrmConfiguration','length','addConfiguration','AccountId','Subjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','lastIndexOf','format','login','JSON','stringify','username','PLAIN','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x550ceb,_0x59f157){var _0x87cf92=function(_0xa64fa5){while(--_0xa64fa5){_0x550ceb['push'](_0x550ceb['shift']());}};_0x87cf92(++_0x59f157);}(_0x92b6,0x140));var _0x692b=function(_0x52e791,_0x4b3159){_0x52e791=_0x52e791-0x0;var _0x2e4ba3=_0x92b6[_0x52e791];return _0x2e4ba3;};'use strict';var emlformat=require(_0x692b('0x0'));var rimraf=require(_0x692b('0x1'));var zipdir=require(_0x692b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x692b('0x3'));var moment=require(_0x692b('0x4'));var BPromise=require(_0x692b('0x5'));var Mustache=require(_0x692b('0x6'));var util=require(_0x692b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x692b('0x8'));var ejs=require(_0x692b('0x9'));var fs=require('fs');var fs_extra=require(_0x692b('0xa'));var _=require(_0x692b('0xb'));var squel=require(_0x692b('0xc'));var crypto=require(_0x692b('0xd'));var jsforce=require(_0x692b('0xe'));var deskjs=require(_0x692b('0xf'));var toCsv=require(_0x692b('0x8'));var querystring=require(_0x692b('0x10'));var Papa=require('papaparse');var Redis=require(_0x692b('0x11'));var authService=require(_0x692b('0x12'));var qs=require(_0x692b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x692b('0x14'));var logger=require(_0x692b('0x15'))(_0x692b('0x16'));var utils=require(_0x692b('0x17'));var config=require(_0x692b('0x18'));var licenseUtil=require(_0x692b('0x19'));var db=require(_0x692b('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5aa170,_0x4bc78b){_0x4bc78b=_0x4bc78b||0xcc;return function(_0x2da46d){if(_0x2da46d){return _0x5aa170[_0x692b('0x1b')](_0x4bc78b);}return _0x5aa170[_0x692b('0x1c')](_0x4bc78b)[_0x692b('0x1d')]();};}function respondWithResult(_0x55dd0c,_0x2f11c4){_0x2f11c4=_0x2f11c4||0xc8;return function(_0x1cba0){if(_0x1cba0){return _0x55dd0c[_0x692b('0x1c')](_0x2f11c4)[_0x692b('0x1e')](_0x1cba0);}};}function respondWithFilteredResult(_0xa70581,_0x2ad3c7){return function(_0x293dba){if(_0x293dba){var _0x4d967e=typeof _0x2ad3c7[_0x692b('0x1f')]===_0x692b('0x20')&&typeof _0x2ad3c7[_0x692b('0x21')]===_0x692b('0x20');var _0x464248=_0x293dba[_0x692b('0x22')];var _0x4b6465=_0x4d967e?0x0:_0x2ad3c7['offset'];var _0x1f123f=_0x4d967e?_0x293dba[_0x692b('0x22')]:_0x2ad3c7['offset']+_0x2ad3c7[_0x692b('0x21')];var _0x24db42;if(_0x1f123f>=_0x464248){_0x1f123f=_0x464248;_0x24db42=0xc8;}else{_0x24db42=0xce;}_0xa70581[_0x692b('0x1c')](_0x24db42);return _0xa70581['set'](_0x692b('0x23'),_0x4b6465+'-'+_0x1f123f+'/'+_0x464248)['json'](_0x293dba);}return null;};}function patchUpdates(_0x4421e7){return function(_0x96a756){try{jsonpatch[_0x692b('0x24')](_0x96a756,_0x4421e7,!![]);}catch(_0x53dd22){return BPromise[_0x692b('0x25')](_0x53dd22);}return _0x96a756[_0x692b('0x26')]();};}function saveUpdates(_0x165021,_0x5ae1bf){return function(_0xe0096c){if(_0xe0096c){return _0xe0096c['update'](_0x165021)[_0x692b('0x27')](function(_0xdcfd95){return _0xdcfd95;});}return null;};}function removeEntity(_0x3b3747,_0x43f099){return function(_0x1eb6e8){if(_0x1eb6e8){return _0x1eb6e8[_0x692b('0x28')]()[_0x692b('0x27')](function(){_0x3b3747[_0x692b('0x1c')](0xcc)[_0x692b('0x1d')]();});}};}function handleEntityNotFound(_0x1863de,_0x3a1197){return function(_0x53d344){if(!_0x53d344){_0x1863de[_0x692b('0x1b')](0x194);}return _0x53d344;};}function handleError(_0x4e2c4a,_0x9b86fe){_0x9b86fe=_0x9b86fe||0x1f4;return function(_0x214466){logger[_0x692b('0x29')](_0x214466[_0x692b('0x2a')]);if(_0x214466[_0x692b('0x2b')]){delete _0x214466[_0x692b('0x2b')];}_0x4e2c4a[_0x692b('0x1c')](_0x9b86fe)[_0x692b('0x2c')](_0x214466);};}exports[_0x692b('0x2d')]=function(_0x4e4bd0,_0x740a06){var _0x45380e={},_0x22ce03={},_0x20b9f8={'count':0x0,'rows':[]};var _0x3abf2d=_[_0x692b('0x2e')](db[_0x692b('0x2f')][_0x692b('0x30')],function(_0x5d6a8f){return{'name':_0x5d6a8f[_0x692b('0x31')],'type':_0x5d6a8f[_0x692b('0x32')]['key']};});_0x22ce03[_0x692b('0x33')]=_[_0x692b('0x2e')](_0x3abf2d,'name');_0x22ce03[_0x692b('0x34')]=_[_0x692b('0x35')](_0x4e4bd0['query']);_0x22ce03[_0x692b('0x36')]=_[_0x692b('0x37')](_0x22ce03[_0x692b('0x33')],_0x22ce03['query']);_0x45380e[_0x692b('0x38')]=_['intersection'](_0x22ce03['model'],qs['fields'](_0x4e4bd0[_0x692b('0x34')][_0x692b('0x39')]));_0x45380e['attributes']=_0x45380e[_0x692b('0x38')]['length']?_0x45380e['attributes']:_0x22ce03[_0x692b('0x33')];if(!_0x4e4bd0[_0x692b('0x34')][_0x692b('0x3a')](_0x692b('0x3b'))){_0x45380e[_0x692b('0x21')]=qs[_0x692b('0x21')](_0x4e4bd0['query'][_0x692b('0x21')]);_0x45380e[_0x692b('0x1f')]=qs[_0x692b('0x1f')](_0x4e4bd0[_0x692b('0x34')]['offset']);}_0x45380e[_0x692b('0x3c')]=qs[_0x692b('0x3d')](_0x4e4bd0[_0x692b('0x34')][_0x692b('0x3d')]);_0x45380e[_0x692b('0x3e')]=qs[_0x692b('0x36')](_[_0x692b('0x3f')](_0x4e4bd0[_0x692b('0x34')],_0x22ce03[_0x692b('0x36')]),_0x3abf2d);if(_0x4e4bd0['query'][_0x692b('0x40')]){_0x45380e[_0x692b('0x3e')]=_['merge'](_0x45380e[_0x692b('0x3e')],{'$or':_['map'](_0x3abf2d,function(_0x5d504c){if(_0x5d504c['type']!=='VIRTUAL'){var _0x44435b={};_0x44435b[_0x5d504c[_0x692b('0x2b')]]={'$like':'%'+_0x4e4bd0['query']['filter']+'%'};return _0x44435b;}})});}_0x45380e=_['merge']({},_0x45380e,_0x4e4bd0[_0x692b('0x41')]);var _0x2ed72e={'where':_0x45380e[_0x692b('0x3e')]};return db[_0x692b('0x2f')]['count'](_0x2ed72e)['then'](function(_0x3d54a6){_0x20b9f8[_0x692b('0x22')]=_0x3d54a6;if(_0x4e4bd0[_0x692b('0x34')][_0x692b('0x42')]){_0x45380e[_0x692b('0x43')]=[{'all':!![]}];}return db[_0x692b('0x2f')]['findAll'](_0x45380e);})[_0x692b('0x27')](function(_0x1d008a){_0x20b9f8['rows']=_0x1d008a;return _0x20b9f8;})[_0x692b('0x27')](respondWithFilteredResult(_0x740a06,_0x45380e))[_0x692b('0x44')](handleError(_0x740a06,null));};exports[_0x692b('0x45')]=function(_0x6c039b,_0x5a7369){var _0x2b2d4b={'raw':![],'where':{'id':_0x6c039b[_0x692b('0x46')]['id']}},_0x5b3a0b={};_0x5b3a0b[_0x692b('0x33')]=_[_0x692b('0x35')](db[_0x692b('0x2f')][_0x692b('0x30')]);_0x5b3a0b[_0x692b('0x34')]=_[_0x692b('0x35')](_0x6c039b[_0x692b('0x34')]);_0x5b3a0b[_0x692b('0x36')]=_['intersection'](_0x5b3a0b[_0x692b('0x33')],_0x5b3a0b[_0x692b('0x34')]);_0x2b2d4b[_0x692b('0x38')]=_[_0x692b('0x37')](_0x5b3a0b['model'],qs[_0x692b('0x39')](_0x6c039b[_0x692b('0x34')][_0x692b('0x39')]));_0x2b2d4b[_0x692b('0x38')]=_0x2b2d4b[_0x692b('0x38')]['length']?_0x2b2d4b[_0x692b('0x38')]:_0x5b3a0b['model'];if(_0x6c039b[_0x692b('0x34')][_0x692b('0x42')]){_0x2b2d4b[_0x692b('0x43')]=[{'all':!![]}];}_0x2b2d4b=_[_0x692b('0x47')]({},_0x2b2d4b,_0x6c039b[_0x692b('0x41')]);return db[_0x692b('0x2f')][_0x692b('0x48')](_0x2b2d4b)[_0x692b('0x27')](handleEntityNotFound(_0x5a7369,null))[_0x692b('0x27')](respondWithResult(_0x5a7369,null))[_0x692b('0x44')](handleError(_0x5a7369,null));};exports[_0x692b('0x49')]=function(_0x4087ae,_0x1f0568){return db[_0x692b('0x2f')][_0x692b('0x49')](_0x4087ae['body'],{})['then'](respondWithResult(_0x1f0568,0xc9))[_0x692b('0x44')](handleError(_0x1f0568,null));};exports[_0x692b('0x4a')]=function(_0x329530,_0x843fa2){if(_0x329530[_0x692b('0x4b')]['id']){delete _0x329530[_0x692b('0x4b')]['id'];}return db[_0x692b('0x2f')][_0x692b('0x48')]({'where':{'id':_0x329530[_0x692b('0x46')]['id']}})[_0x692b('0x27')](handleEntityNotFound(_0x843fa2,null))[_0x692b('0x27')](saveUpdates(_0x329530[_0x692b('0x4b')],null))[_0x692b('0x27')](respondWithResult(_0x843fa2,null))[_0x692b('0x44')](handleError(_0x843fa2,null));};exports['destroy']=function(_0x1a5128,_0xc01252){return db[_0x692b('0x2f')][_0x692b('0x48')]({'where':{'id':_0x1a5128[_0x692b('0x46')]['id']}})[_0x692b('0x27')](handleEntityNotFound(_0xc01252,null))[_0x692b('0x27')](removeEntity(_0xc01252,null))[_0x692b('0x44')](handleError(_0xc01252,null));};exports[_0x692b('0x4c')]=function(_0x1fe918,_0xde23a7,_0x5c7841){var _0x3523d1={};var _0xaf1f37={};var _0x3bfab2;var _0x2614a1;return db[_0x692b('0x2f')][_0x692b('0x4d')]({'where':{'id':_0x1fe918[_0x692b('0x46')]['id']}})['then'](handleEntityNotFound(_0xde23a7,null))['then'](function(_0x484e08){if(_0x484e08){_0x3bfab2=_0x484e08;_0xaf1f37[_0x692b('0x33')]=_[_0x692b('0x35')](db[_0x692b('0x4e')][_0x692b('0x30')]);_0xaf1f37['query']=_[_0x692b('0x35')](_0x1fe918[_0x692b('0x34')]);_0xaf1f37[_0x692b('0x36')]=_[_0x692b('0x37')](_0xaf1f37[_0x692b('0x33')],_0xaf1f37[_0x692b('0x34')]);_0x3523d1[_0x692b('0x38')]=_[_0x692b('0x37')](_0xaf1f37['model'],qs[_0x692b('0x39')](_0x1fe918[_0x692b('0x34')]['fields']));_0x3523d1[_0x692b('0x38')]=_0x3523d1[_0x692b('0x38')][_0x692b('0x4f')]?_0x3523d1[_0x692b('0x38')]:_0xaf1f37['model'];_0x3523d1[_0x692b('0x3c')]=qs['sort'](_0x1fe918[_0x692b('0x34')][_0x692b('0x3d')]);_0x3523d1[_0x692b('0x3e')]=qs[_0x692b('0x36')](_[_0x692b('0x3f')](_0x1fe918[_0x692b('0x34')],_0xaf1f37[_0x692b('0x36')]));if(_0x1fe918[_0x692b('0x34')][_0x692b('0x40')]){_0x3523d1[_0x692b('0x3e')]=_[_0x692b('0x47')](_0x3523d1['where'],{'$or':_[_0x692b('0x2e')](_0x3523d1[_0x692b('0x38')],function(_0x506473){var _0x5602c6={};_0x5602c6[_0x506473]={'$like':'%'+_0x1fe918[_0x692b('0x34')][_0x692b('0x40')]+'%'};return _0x5602c6;})});}_0x3523d1=_[_0x692b('0x47')]({},_0x3523d1,_0x1fe918['options']);return _0x3bfab2['getConfigurations'](_0x3523d1);}})[_0x692b('0x27')](function(_0x32ce72){if(_0x32ce72){_0x2614a1=_0x32ce72[_0x692b('0x4f')];if(!_0x1fe918[_0x692b('0x34')]['hasOwnProperty'](_0x692b('0x3b'))){_0x3523d1[_0x692b('0x21')]=qs['limit'](_0x1fe918['query'][_0x692b('0x21')]);_0x3523d1[_0x692b('0x1f')]=qs[_0x692b('0x1f')](_0x1fe918['query'][_0x692b('0x1f')]);}return _0x3bfab2[_0x692b('0x4c')](_0x3523d1);}})['then'](function(_0x6e33b4){if(_0x6e33b4){return _0x6e33b4?{'count':_0x2614a1,'rows':_0x6e33b4}:null;}})[_0x692b('0x27')](respondWithResult(_0xde23a7,null))[_0x692b('0x44')](handleError(_0xde23a7,null));};exports[_0x692b('0x50')]=function(_0x2744d3,_0x1589cc,_0x2190dd){if(_0x2744d3[_0x692b('0x4b')]['id']){delete _0x2744d3[_0x692b('0x4b')]['id'];}return db[_0x692b('0x2f')][_0x692b('0x4d')]({'where':{'id':_0x2744d3['params']['id']}})[_0x692b('0x27')](handleEntityNotFound(_0x1589cc,null))[_0x692b('0x27')](function(_0x1f300f){if(_0x1f300f){_0x2744d3[_0x692b('0x4b')][_0x692b('0x51')]=_0x1f300f['id'];_0x2744d3[_0x692b('0x4b')][_0x692b('0x52')]=integrations['getSubjects'](_0x2744d3[_0x692b('0x4b')][_0x692b('0x53')],_0x2744d3[_0x692b('0x4b')]['type']);_0x2744d3[_0x692b('0x4b')][_0x692b('0x54')]=integrations['getDescriptions'](_0x2744d3[_0x692b('0x4b')][_0x692b('0x53')],_0x2744d3['body'][_0x692b('0x32')]);return db['SugarcrmConfiguration'][_0x692b('0x49')](_0x2744d3['body'],{'include':[{'model':db[_0x692b('0x55')],'as':_0x692b('0x52')},{'model':db[_0x692b('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1589cc,null))[_0x692b('0x44')](handleError(_0x1589cc,null));};exports[_0x692b('0x56')]=function(_0x4bd8af,_0x19349a,_0x193579){var _0x50080b='';var _0x527d59=['id',_0x692b('0x2b'),_0x692b('0x57'),_0x692b('0x58'),_0x692b('0x59'),_0x692b('0x5a'),_0x692b('0x5b'),_0x692b('0x5c'),'parent_id',_0x692b('0x5d'),_0x692b('0x5e'),_0x692b('0x5f')];return db[_0x692b('0x2f')]['findOne']({'where':{'id':_0x4bd8af[_0x692b('0x46')]['id']},'attributes':['id','username',_0x692b('0x60'),_0x692b('0x61')]})[_0x692b('0x27')](handleEntityNotFound(_0x19349a,null))[_0x692b('0x27')](function(_0x6d4853){if(_0x6d4853){_0x50080b=_0x6d4853[_0x692b('0x61')];var _0x1bfdc1=_0x50080b['slice'](-0x1);if(_0x1bfdc1==='/'){_0x50080b=_0x50080b['substring'](0x0,_0x50080b[_0x692b('0x62')](_0x1bfdc1));}return rp({'method':'POST','uri':util[_0x692b('0x63')]('%s%s',_0x50080b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x692b('0x64'),'input_type':_0x692b('0x65'),'response_type':_0x692b('0x65'),'rest_data':JSON[_0x692b('0x66')]({'user_auth':{'user_name':_0x6d4853[_0x692b('0x67')],'password':_0x6d4853['password'],'encryption':_0x692b('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x692b('0x27')](function(_0xc94ce2){if(_0xc94ce2&&_0xc94ce2[_0x692b('0x2b')]!==_0x692b('0x69')&&_0xc94ce2[_0x692b('0x2b')]!==_0x692b('0x6a')){return rp({'method':'POST','uri':util[_0x692b('0x63')]('%s%s',_0x50080b,_0x692b('0x6b')),'json':!![],'form':{'method':_0x692b('0x6c'),'input_type':_0x692b('0x65'),'response_type':_0x692b('0x65'),'rest_data':JSON[_0x692b('0x66')]({'session':_0xc94ce2['id'],'module_name':_0x692b('0x6d')})}})[_0x692b('0x27')](function(_0x2cbbf9){if(_0x2cbbf9){var _0x47c21c=_[_0x692b('0x6e')](_0x2cbbf9['module_fields']);_[_0x692b('0x6f')](_0x47c21c,function(_0x3f4668){return _0x527d59[_0x692b('0x70')](_0x3f4668['name']);});return{'count':_0x47c21c[_0x692b('0x4f')],'rows':_[_0x692b('0x2e')](_0x47c21c,function(_0x5a3bf6){return{'id':_0x5a3bf6[_0x692b('0x2b')],'name':_0x5a3bf6[_0x692b('0x71')],'custom':_[_0x692b('0x72')](_0x5a3bf6[_0x692b('0x2b')],'_c')?!![]:![],'options':_0x5a3bf6['options']?_[_0x692b('0x2e')](_[_0x692b('0x6e')](_0x5a3bf6[_0x692b('0x41')]),function(_0x21658e){return{'name':_0x21658e[_0x692b('0x73')],'value':_0x21658e['name']};}):[]};})};}})[_0x692b('0x27')](respondWithResult(_0x19349a,null))[_0x692b('0x44')](function(_0x49fa1f){var _0x38ef7c=_0x4bd8af[_0x692b('0x34')]['test']?0x1f4:_0x49fa1f[_0x692b('0x74')]||0x1f4;logger['error'](_0x692b('0x75'),_0x692b('0x56'),_0x38ef7c,JSON[_0x692b('0x66')](_0x49fa1f));delete _0x49fa1f[_0x692b('0x2b')];if(_0x38ef7c===0x191){_0x38ef7c=0x190;}_0x19349a[_0x692b('0x1c')](_0x38ef7c)[_0x692b('0x2c')](_0x4bd8af[_0x692b('0x34')]['test']?{'message':_0x692b('0x76'),'statusCode':_0x49fa1f['statusCode']}:_0x49fa1f);});}else{var _0x48a1fa=0x1f4;_0x19349a['status'](_0x48a1fa)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xc535=['addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','Subjects','assigned_user_id','created_by','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','substring','format','%s%s','/service/v4_1/rest.php','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','stringify','values','module_fields','remove','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0xc535,0x106));var _0x5c53=function(_0x40952f,_0x291cd8){_0x40952f=_0x40952f-0x0;var _0x3be96c=_0xc535[_0x40952f];return _0x3be96c;};'use strict';var emlformat=require(_0x5c53('0x0'));var rimraf=require(_0x5c53('0x1'));var zipdir=require(_0x5c53('0x2'));var jsonpatch=require(_0x5c53('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5c53('0x4'));var sox=require('sox');var csv=require(_0x5c53('0x5'));var ejs=require(_0x5c53('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5c53('0x7'));var crypto=require(_0x5c53('0x8'));var jsforce=require(_0x5c53('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5c53('0xa'));var Papa=require(_0x5c53('0xb'));var Redis=require('ioredis');var authService=require(_0x5c53('0xc'));var qs=require(_0x5c53('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c53('0xe'));var logger=require(_0x5c53('0xf'))(_0x5c53('0x10'));var utils=require(_0x5c53('0x11'));var config=require(_0x5c53('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c53('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5c6a25,_0x10ccbd){_0x10ccbd=_0x10ccbd||0xcc;return function(_0x349683){if(_0x349683){return _0x5c6a25['sendStatus'](_0x10ccbd);}return _0x5c6a25[_0x5c53('0x14')](_0x10ccbd)[_0x5c53('0x15')]();};}function respondWithResult(_0x45010e,_0x54ab9a){_0x54ab9a=_0x54ab9a||0xc8;return function(_0x4a0802){if(_0x4a0802){return _0x45010e[_0x5c53('0x14')](_0x54ab9a)['json'](_0x4a0802);}};}function respondWithFilteredResult(_0x584e52,_0x1bc811){return function(_0x528e78){if(_0x528e78){var _0x59d6f7=typeof _0x1bc811['offset']==='undefined'&&typeof _0x1bc811[_0x5c53('0x16')]==='undefined';var _0x3401e3=_0x528e78['count'];var _0x4bd31f=_0x59d6f7?0x0:_0x1bc811[_0x5c53('0x17')];var _0x1f778a=_0x59d6f7?_0x528e78[_0x5c53('0x18')]:_0x1bc811[_0x5c53('0x17')]+_0x1bc811[_0x5c53('0x16')];var _0x1bd8a6;if(_0x1f778a>=_0x3401e3){_0x1f778a=_0x3401e3;_0x1bd8a6=0xc8;}else{_0x1bd8a6=0xce;}_0x584e52[_0x5c53('0x14')](_0x1bd8a6);return _0x584e52[_0x5c53('0x19')](_0x5c53('0x1a'),_0x4bd31f+'-'+_0x1f778a+'/'+_0x3401e3)['json'](_0x528e78);}return null;};}function patchUpdates(_0xdfcae7){return function(_0x1002bc){try{jsonpatch[_0x5c53('0x1b')](_0x1002bc,_0xdfcae7,!![]);}catch(_0x44a46c){return BPromise[_0x5c53('0x1c')](_0x44a46c);}return _0x1002bc[_0x5c53('0x1d')]();};}function saveUpdates(_0x1b69f3,_0x4a498f){return function(_0x3eae6d){if(_0x3eae6d){return _0x3eae6d[_0x5c53('0x1e')](_0x1b69f3)[_0x5c53('0x1f')](function(_0x45a9af){return _0x45a9af;});}return null;};}function removeEntity(_0x3d43f5,_0x24a1a1){return function(_0x2cedbf){if(_0x2cedbf){return _0x2cedbf[_0x5c53('0x20')]()['then'](function(){_0x3d43f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x381e85,_0x288a0c){return function(_0x1bcef4){if(!_0x1bcef4){_0x381e85[_0x5c53('0x21')](0x194);}return _0x1bcef4;};}function handleError(_0x37953d,_0x5843d4){_0x5843d4=_0x5843d4||0x1f4;return function(_0x4adca6){logger[_0x5c53('0x22')](_0x4adca6[_0x5c53('0x23')]);if(_0x4adca6['name']){delete _0x4adca6[_0x5c53('0x24')];}_0x37953d['status'](_0x5843d4)['send'](_0x4adca6);};}exports[_0x5c53('0x25')]=function(_0x30ad64,_0x248952){var _0xf24837={},_0x4c95b8={},_0x37e1f2={'count':0x0,'rows':[]};var _0x122aa1=_[_0x5c53('0x26')](db[_0x5c53('0x27')][_0x5c53('0x28')],function(_0x257f25){return{'name':_0x257f25[_0x5c53('0x29')],'type':_0x257f25[_0x5c53('0x2a')]['key']};});_0x4c95b8['model']=_[_0x5c53('0x26')](_0x122aa1,_0x5c53('0x24'));_0x4c95b8[_0x5c53('0x2b')]=_[_0x5c53('0x2c')](_0x30ad64[_0x5c53('0x2b')]);_0x4c95b8['filters']=_[_0x5c53('0x2d')](_0x4c95b8[_0x5c53('0x2e')],_0x4c95b8['query']);_0xf24837[_0x5c53('0x2f')]=_['intersection'](_0x4c95b8[_0x5c53('0x2e')],qs[_0x5c53('0x30')](_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x30')]));_0xf24837[_0x5c53('0x2f')]=_0xf24837[_0x5c53('0x2f')][_0x5c53('0x31')]?_0xf24837[_0x5c53('0x2f')]:_0x4c95b8[_0x5c53('0x2e')];if(!_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x32')](_0x5c53('0x33'))){_0xf24837['limit']=qs[_0x5c53('0x16')](_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x16')]);_0xf24837[_0x5c53('0x17')]=qs[_0x5c53('0x17')](_0x30ad64['query'][_0x5c53('0x17')]);}_0xf24837['order']=qs[_0x5c53('0x34')](_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x34')]);_0xf24837[_0x5c53('0x35')]=qs['filters'](_[_0x5c53('0x36')](_0x30ad64[_0x5c53('0x2b')],_0x4c95b8[_0x5c53('0x37')]),_0x122aa1);if(_0x30ad64['query'][_0x5c53('0x38')]){_0xf24837[_0x5c53('0x35')]=_[_0x5c53('0x39')](_0xf24837['where'],{'$or':_[_0x5c53('0x26')](_0x122aa1,function(_0x279617){if(_0x279617[_0x5c53('0x2a')]!==_0x5c53('0x3a')){var _0xf679e3={};_0xf679e3[_0x279617[_0x5c53('0x24')]]={'$like':'%'+_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x38')]+'%'};return _0xf679e3;}})});}_0xf24837=_[_0x5c53('0x39')]({},_0xf24837,_0x30ad64[_0x5c53('0x3b')]);var _0x473323={'where':_0xf24837[_0x5c53('0x35')]};return db['SugarcrmAccount'][_0x5c53('0x18')](_0x473323)[_0x5c53('0x1f')](function(_0x1bde11){_0x37e1f2[_0x5c53('0x18')]=_0x1bde11;if(_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x3c')]){_0xf24837[_0x5c53('0x3d')]=[{'all':!![]}];}return db[_0x5c53('0x27')][_0x5c53('0x3e')](_0xf24837);})['then'](function(_0x42eb57){_0x37e1f2[_0x5c53('0x3f')]=_0x42eb57;return _0x37e1f2;})[_0x5c53('0x1f')](respondWithFilteredResult(_0x248952,_0xf24837))['catch'](handleError(_0x248952,null));};exports['show']=function(_0x51c5dd,_0x160d1c){var _0x43293a={'raw':![],'where':{'id':_0x51c5dd[_0x5c53('0x40')]['id']}},_0x15a19d={};_0x15a19d[_0x5c53('0x2e')]=_[_0x5c53('0x2c')](db[_0x5c53('0x27')][_0x5c53('0x28')]);_0x15a19d[_0x5c53('0x2b')]=_['keys'](_0x51c5dd[_0x5c53('0x2b')]);_0x15a19d[_0x5c53('0x37')]=_['intersection'](_0x15a19d[_0x5c53('0x2e')],_0x15a19d[_0x5c53('0x2b')]);_0x43293a[_0x5c53('0x2f')]=_[_0x5c53('0x2d')](_0x15a19d['model'],qs[_0x5c53('0x30')](_0x51c5dd['query'][_0x5c53('0x30')]));_0x43293a[_0x5c53('0x2f')]=_0x43293a[_0x5c53('0x2f')][_0x5c53('0x31')]?_0x43293a['attributes']:_0x15a19d[_0x5c53('0x2e')];if(_0x51c5dd[_0x5c53('0x2b')][_0x5c53('0x3c')]){_0x43293a['include']=[{'all':!![]}];}_0x43293a=_[_0x5c53('0x39')]({},_0x43293a,_0x51c5dd[_0x5c53('0x3b')]);return db[_0x5c53('0x27')][_0x5c53('0x41')](_0x43293a)[_0x5c53('0x1f')](handleEntityNotFound(_0x160d1c,null))[_0x5c53('0x1f')](respondWithResult(_0x160d1c,null))[_0x5c53('0x42')](handleError(_0x160d1c,null));};exports[_0x5c53('0x43')]=function(_0x3e973a,_0x46d524){return db['SugarcrmAccount'][_0x5c53('0x43')](_0x3e973a[_0x5c53('0x44')],{})['then'](respondWithResult(_0x46d524,0xc9))[_0x5c53('0x42')](handleError(_0x46d524,null));};exports[_0x5c53('0x1e')]=function(_0x9adc46,_0xe985eb){if(_0x9adc46[_0x5c53('0x44')]['id']){delete _0x9adc46[_0x5c53('0x44')]['id'];}return db[_0x5c53('0x27')][_0x5c53('0x41')]({'where':{'id':_0x9adc46[_0x5c53('0x40')]['id']}})['then'](handleEntityNotFound(_0xe985eb,null))[_0x5c53('0x1f')](saveUpdates(_0x9adc46[_0x5c53('0x44')],null))['then'](respondWithResult(_0xe985eb,null))[_0x5c53('0x42')](handleError(_0xe985eb,null));};exports[_0x5c53('0x20')]=function(_0x2fcca2,_0x5763d3){return db[_0x5c53('0x27')]['find']({'where':{'id':_0x2fcca2['params']['id']}})[_0x5c53('0x1f')](handleEntityNotFound(_0x5763d3,null))[_0x5c53('0x1f')](removeEntity(_0x5763d3,null))[_0x5c53('0x42')](handleError(_0x5763d3,null));};exports[_0x5c53('0x45')]=function(_0x2cfae2,_0x4846b6,_0x2976c6){var _0x1b4c75={};var _0x4b6da0={};var _0x2ea696;var _0x11632f;return db['SugarcrmAccount'][_0x5c53('0x46')]({'where':{'id':_0x2cfae2['params']['id']}})[_0x5c53('0x1f')](handleEntityNotFound(_0x4846b6,null))[_0x5c53('0x1f')](function(_0x25bff4){if(_0x25bff4){_0x2ea696=_0x25bff4;_0x4b6da0[_0x5c53('0x2e')]=_['keys'](db['SugarcrmConfiguration'][_0x5c53('0x28')]);_0x4b6da0[_0x5c53('0x2b')]=_[_0x5c53('0x2c')](_0x2cfae2[_0x5c53('0x2b')]);_0x4b6da0[_0x5c53('0x37')]=_[_0x5c53('0x2d')](_0x4b6da0[_0x5c53('0x2e')],_0x4b6da0['query']);_0x1b4c75[_0x5c53('0x2f')]=_[_0x5c53('0x2d')](_0x4b6da0['model'],qs[_0x5c53('0x30')](_0x2cfae2['query'][_0x5c53('0x30')]));_0x1b4c75[_0x5c53('0x2f')]=_0x1b4c75[_0x5c53('0x2f')][_0x5c53('0x31')]?_0x1b4c75[_0x5c53('0x2f')]:_0x4b6da0['model'];_0x1b4c75['order']=qs[_0x5c53('0x34')](_0x2cfae2[_0x5c53('0x2b')][_0x5c53('0x34')]);_0x1b4c75[_0x5c53('0x35')]=qs[_0x5c53('0x37')](_[_0x5c53('0x36')](_0x2cfae2[_0x5c53('0x2b')],_0x4b6da0[_0x5c53('0x37')]));if(_0x2cfae2[_0x5c53('0x2b')][_0x5c53('0x38')]){_0x1b4c75['where']=_['merge'](_0x1b4c75[_0x5c53('0x35')],{'$or':_[_0x5c53('0x26')](_0x1b4c75['attributes'],function(_0x1477bb){var _0x3f2f63={};_0x3f2f63[_0x1477bb]={'$like':'%'+_0x2cfae2[_0x5c53('0x2b')]['filter']+'%'};return _0x3f2f63;})});}_0x1b4c75=_[_0x5c53('0x39')]({},_0x1b4c75,_0x2cfae2[_0x5c53('0x3b')]);return _0x2ea696[_0x5c53('0x45')](_0x1b4c75);}})[_0x5c53('0x1f')](function(_0xb2377d){if(_0xb2377d){_0x11632f=_0xb2377d[_0x5c53('0x31')];if(!_0x2cfae2[_0x5c53('0x2b')][_0x5c53('0x32')](_0x5c53('0x33'))){_0x1b4c75[_0x5c53('0x16')]=qs[_0x5c53('0x16')](_0x2cfae2[_0x5c53('0x2b')]['limit']);_0x1b4c75['offset']=qs[_0x5c53('0x17')](_0x2cfae2[_0x5c53('0x2b')]['offset']);}return _0x2ea696['getConfigurations'](_0x1b4c75);}})[_0x5c53('0x1f')](function(_0x232647){if(_0x232647){return _0x232647?{'count':_0x11632f,'rows':_0x232647}:null;}})['then'](respondWithResult(_0x4846b6,null))[_0x5c53('0x42')](handleError(_0x4846b6,null));};exports[_0x5c53('0x47')]=function(_0x239161,_0x42a970,_0x251737){if(_0x239161['body']['id']){delete _0x239161[_0x5c53('0x44')]['id'];}return db['SugarcrmAccount'][_0x5c53('0x46')]({'where':{'id':_0x239161[_0x5c53('0x40')]['id']}})['then'](handleEntityNotFound(_0x42a970,null))['then'](function(_0x3a84c1){if(_0x3a84c1){_0x239161[_0x5c53('0x44')][_0x5c53('0x48')]=_0x3a84c1['id'];_0x239161[_0x5c53('0x44')]['Subjects']=integrations[_0x5c53('0x49')](_0x239161['body'][_0x5c53('0x4a')],_0x239161['body'][_0x5c53('0x2a')]);_0x239161[_0x5c53('0x44')][_0x5c53('0x4b')]=integrations[_0x5c53('0x4c')](_0x239161[_0x5c53('0x44')]['channel'],_0x239161[_0x5c53('0x44')]['type']);return db[_0x5c53('0x4d')]['create'](_0x239161['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x5c53('0x4e')},{'model':db['SugarcrmField'],'as':_0x5c53('0x4b')}]});}return null;})[_0x5c53('0x1f')](respondWithResult(_0x42a970,null))[_0x5c53('0x42')](handleError(_0x42a970,null));};exports['getFields']=function(_0x40d3d5,_0x2672bd,_0x2d0150){var _0x4ad88a='';var _0xb05ae4=['id',_0x5c53('0x24'),_0x5c53('0x4f'),_0x5c53('0x50'),'description','date_start',_0x5c53('0x51'),_0x5c53('0x52'),_0x5c53('0x53'),_0x5c53('0x54'),_0x5c53('0x55'),'direction'];return db[_0x5c53('0x27')][_0x5c53('0x46')]({'where':{'id':_0x40d3d5['params']['id']},'attributes':['id','username',_0x5c53('0x56'),_0x5c53('0x57')]})[_0x5c53('0x1f')](handleEntityNotFound(_0x2672bd,null))[_0x5c53('0x1f')](function(_0x22b7c2){if(_0x22b7c2){_0x4ad88a=_0x22b7c2[_0x5c53('0x57')];var _0xc1847b=_0x4ad88a['slice'](-0x1);if(_0xc1847b==='/'){_0x4ad88a=_0x4ad88a[_0x5c53('0x58')](0x0,_0x4ad88a['lastIndexOf'](_0xc1847b));}return rp({'method':'POST','uri':util[_0x5c53('0x59')](_0x5c53('0x5a'),_0x4ad88a,_0x5c53('0x5b')),'json':!![],'form':{'method':'login','input_type':_0x5c53('0x5c'),'response_type':_0x5c53('0x5c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x22b7c2[_0x5c53('0x5d')],'password':_0x22b7c2[_0x5c53('0x56')],'encryption':_0x5c53('0x5e')},'application':_0x5c53('0x5f')})}});}})[_0x5c53('0x1f')](function(_0x325b05){if(_0x325b05&&_0x325b05[_0x5c53('0x24')]!==_0x5c53('0x60')&&_0x325b05[_0x5c53('0x24')]!==_0x5c53('0x61')){return rp({'method':_0x5c53('0x62'),'uri':util[_0x5c53('0x59')](_0x5c53('0x5a'),_0x4ad88a,_0x5c53('0x5b')),'json':!![],'form':{'method':_0x5c53('0x63'),'input_type':_0x5c53('0x5c'),'response_type':_0x5c53('0x5c'),'rest_data':JSON[_0x5c53('0x64')]({'session':_0x325b05['id'],'module_name':'Calls'})}})[_0x5c53('0x1f')](function(_0x569c6e){if(_0x569c6e){var _0x152d5b=_[_0x5c53('0x65')](_0x569c6e[_0x5c53('0x66')]);_[_0x5c53('0x67')](_0x152d5b,function(_0x21a671){return _0xb05ae4['includes'](_0x21a671[_0x5c53('0x24')]);});return{'count':_0x152d5b[_0x5c53('0x31')],'rows':_[_0x5c53('0x26')](_0x152d5b,function(_0x2ddb5c){return{'id':_0x2ddb5c[_0x5c53('0x24')],'name':_0x2ddb5c[_0x5c53('0x68')],'custom':_[_0x5c53('0x69')](_0x2ddb5c['name'],'_c')?!![]:![],'options':_0x2ddb5c[_0x5c53('0x3b')]?_['map'](_[_0x5c53('0x65')](_0x2ddb5c[_0x5c53('0x3b')]),function(_0x564269){return{'name':_0x564269['value'],'value':_0x564269[_0x5c53('0x24')]};}):[]};})};}})[_0x5c53('0x1f')](respondWithResult(_0x2672bd,null))[_0x5c53('0x42')](function(_0x2903ca){var _0x533693=_0x40d3d5[_0x5c53('0x2b')][_0x5c53('0x6a')]?0x1f4:_0x2903ca[_0x5c53('0x6b')]||0x1f4;logger[_0x5c53('0x22')](_0x5c53('0x6c'),'getFields',_0x533693,JSON['stringify'](_0x2903ca));delete _0x2903ca[_0x5c53('0x24')];if(_0x533693===0x191){_0x533693=0x190;}_0x2672bd[_0x5c53('0x14')](_0x533693)[_0x5c53('0x6d')](_0x40d3d5[_0x5c53('0x2b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2903ca['statusCode']}:_0x2903ca);});}else{var _0x1e9d6d=0x1f4;_0x2672bd[_0x5c53('0x14')](_0x1e9d6d)[_0x5c53('0x6d')]({'message':_0x5c53('0x6e'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 663a2e5..34f9919 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 _0x464d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x464d,0x70));var _0xd464=function(_0x50bbd9,_0x3f7db2){_0x50bbd9=_0x50bbd9-0x0;var _0x408f6f=_0x464d[_0x50bbd9];return _0x408f6f;};'use strict';var _=require('lodash');var util=require(_0xd464('0x0'));var logger=require(_0xd464('0x1'))(_0xd464('0x2'));var moment=require(_0xd464('0x3'));var BPromise=require(_0xd464('0x4'));var rp=require(_0xd464('0x5'));var fs=require('fs');var path=require(_0xd464('0x6'));var rimraf=require(_0xd464('0x7'));var config=require(_0xd464('0x8'));var attributes=require(_0xd464('0x9'));var integrations=require(_0xd464('0xa'));module['exports']=function(_0x3f5c42,_0x4010b8){return _0x3f5c42[_0xd464('0xb')](_0xd464('0xc'),attributes,{'tableName':_0xd464('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f4c=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash'];(function(_0x2eeae4,_0x348201){var _0x362004=function(_0x1f2a6a){while(--_0x1f2a6a){_0x2eeae4['push'](_0x2eeae4['shift']());}};_0x362004(++_0x348201);}(_0x8f4c,0x113));var _0xc8f4=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0x8f4c[_0x39157f];return _0x1ae4e2;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xc8f4('0x9'));module['exports']=function(_0x4c86f8,_0x520063){return _0x4c86f8[_0xc8f4('0xa')]('SugarcrmAccount',attributes,{'tableName':_0xc8f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index f3f2ed0..29b9896 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 _0xbb51=['info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSugarcrmAccount','options','raw','where','attributes','limit','map','model','include','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then'];(function(_0x3818c0,_0x542521){var _0x55ec33=function(_0x2be9ea){while(--_0x2be9ea){_0x3818c0['push'](_0x3818c0['shift']());}};_0x55ec33(++_0x542521);}(_0xbb51,0x13f));var _0x1bb5=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xbb51[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x1bb5('0x0'));var util=require(_0x1bb5('0x1'));var moment=require(_0x1bb5('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bb5('0x3'));var fs=require('fs');var Redis=require(_0x1bb5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bb5('0x5'));var logger=require('../../config/logger')(_0x1bb5('0x6'));var config=require('../../config/environment');var jayson=require(_0x1bb5('0x7'));var client=jayson['client'][_0x1bb5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e3079,_0x49dd17,_0x58413c){return new BPromise(function(_0x3f9708,_0x4d4714){return client[_0x1bb5('0x9')](_0x5e3079,_0x58413c)[_0x1bb5('0xa')](function(_0xb3cc63){logger[_0x1bb5('0xb')](_0x1bb5('0xc'),_0x49dd17,'request\x20sent');logger[_0x1bb5('0xd')](_0x1bb5('0xe'),_0x49dd17,_0x1bb5('0xf'),JSON[_0x1bb5('0x10')](_0xb3cc63));if(_0xb3cc63['error']){if(_0xb3cc63['error']['code']===0x1f4){logger[_0x1bb5('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x49dd17,_0xb3cc63[_0x1bb5('0x11')][_0x1bb5('0x12')]);return _0x4d4714(_0xb3cc63[_0x1bb5('0x11')][_0x1bb5('0x12')]);}logger[_0x1bb5('0x11')](_0x1bb5('0xc'),_0x49dd17,_0xb3cc63[_0x1bb5('0x11')][_0x1bb5('0x12')]);return _0x3f9708(_0xb3cc63[_0x1bb5('0x11')][_0x1bb5('0x12')]);}else{logger[_0x1bb5('0xb')](_0x1bb5('0xc'),_0x49dd17,_0x1bb5('0xf'));_0x3f9708(_0xb3cc63[_0x1bb5('0x13')][_0x1bb5('0x12')]);}})[_0x1bb5('0x14')](function(_0x58b658){logger['error'](_0x1bb5('0xc'),_0x49dd17,_0x58b658);_0x4d4714(_0x58b658);});});}exports[_0x1bb5('0x15')]=function(_0x44b55e){var _0x327def=this;return new Promise(function(_0x222f95,_0x23f3ef){return db['SugarcrmAccount']['findAll']({'raw':_0x44b55e[_0x1bb5('0x16')]?_0x44b55e['options'][_0x1bb5('0x17')]===undefined?!![]:![]:!![],'where':_0x44b55e[_0x1bb5('0x16')]?_0x44b55e[_0x1bb5('0x16')][_0x1bb5('0x18')]||null:null,'attributes':_0x44b55e[_0x1bb5('0x16')]?_0x44b55e[_0x1bb5('0x16')][_0x1bb5('0x19')]||null:null,'limit':_0x44b55e[_0x1bb5('0x16')]?_0x44b55e[_0x1bb5('0x16')][_0x1bb5('0x1a')]||null:null,'include':_0x44b55e[_0x1bb5('0x16')]?_0x44b55e[_0x1bb5('0x16')]['include']?_[_0x1bb5('0x1b')](_0x44b55e['options']['include'],function(_0x205ea8){return{'model':db[_0x205ea8[_0x1bb5('0x1c')]],'as':_0x205ea8['as'],'attributes':_0x205ea8[_0x1bb5('0x19')],'include':_0x205ea8[_0x1bb5('0x1d')]?_['map'](_0x205ea8[_0x1bb5('0x1d')],function(_0x4447a2){return{'model':db[_0x4447a2[_0x1bb5('0x1c')]],'as':_0x4447a2['as'],'attributes':_0x4447a2[_0x1bb5('0x19')],'include':_0x4447a2['include']?_[_0x1bb5('0x1b')](_0x4447a2['include'],function(_0x47b6fe){return{'model':db[_0x47b6fe[_0x1bb5('0x1c')]],'as':_0x47b6fe['as'],'attributes':_0x47b6fe[_0x1bb5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1bb5('0xa')](function(_0x867fcf){logger[_0x1bb5('0xb')]('GetSugarcrmAccount',_0x44b55e);logger['debug'](_0x1bb5('0x15'),_0x44b55e,JSON[_0x1bb5('0x10')](_0x867fcf));_0x222f95(_0x867fcf);})['catch'](function(_0x2c892b){logger[_0x1bb5('0x11')]('GetSugarcrmAccount',_0x2c892b['message'],_0x44b55e);_0x23f3ef(_0x327def[_0x1bb5('0x11')](0x1f4,_0x2c892b[_0x1bb5('0x12')]));});});};exports[_0x1bb5('0x1e')]=function(_0x37cc92){var _0x3322c9=this;return new Promise(function(_0x17cdbc,_0x7a1514){return db[_0x1bb5('0x1f')][_0x1bb5('0x20')]({'raw':_0x37cc92[_0x1bb5('0x16')]?_0x37cc92[_0x1bb5('0x16')][_0x1bb5('0x17')]===undefined?!![]:![]:!![],'where':_0x37cc92['options']?_0x37cc92[_0x1bb5('0x16')][_0x1bb5('0x18')]||null:null,'attributes':_0x37cc92[_0x1bb5('0x16')]?_0x37cc92[_0x1bb5('0x16')]['attributes']||null:null,'include':_0x37cc92[_0x1bb5('0x16')]?_0x37cc92[_0x1bb5('0x16')][_0x1bb5('0x1d')]?_[_0x1bb5('0x1b')](_0x37cc92[_0x1bb5('0x16')][_0x1bb5('0x1d')],function(_0xbe8697){return{'model':db[_0xbe8697[_0x1bb5('0x1c')]],'as':_0xbe8697['as'],'attributes':_0xbe8697[_0x1bb5('0x19')],'include':_0xbe8697[_0x1bb5('0x1d')]?_[_0x1bb5('0x1b')](_0xbe8697[_0x1bb5('0x1d')],function(_0x100d6b){return{'model':db[_0x100d6b['model']],'as':_0x100d6b['as'],'attributes':_0x100d6b[_0x1bb5('0x19')],'include':_0x100d6b[_0x1bb5('0x1d')]?_[_0x1bb5('0x1b')](_0x100d6b[_0x1bb5('0x1d')],function(_0x306036){return{'model':db[_0x306036[_0x1bb5('0x1c')]],'as':_0x306036['as'],'attributes':_0x306036['attributes']};}):[]};}):[]};}):[]:[]})[_0x1bb5('0xa')](function(_0x2cb8c8){logger['info'](_0x1bb5('0x1e'),_0x37cc92);logger[_0x1bb5('0xd')]('ShowSugarcrmAccount',_0x37cc92,JSON[_0x1bb5('0x10')](_0x2cb8c8));_0x17cdbc(_0x2cb8c8);})[_0x1bb5('0x14')](function(_0x1cf2ab){logger[_0x1bb5('0x11')](_0x1bb5('0x1e'),_0x1cf2ab[_0x1bb5('0x12')],_0x37cc92);_0x7a1514(_0x3322c9['error'](0x1f4,_0x1cf2ab[_0x1bb5('0x12')]));});});}; \ No newline at end of file +var _0xb9fa=['model','map','debug','catch','ShowSugarcrmAccount','find','where','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','GetSugarcrmAccount','options','raw','attributes','limit','include'];(function(_0x2f2dcc,_0x4bb632){var _0x4ff30f=function(_0x794949){while(--_0x794949){_0x2f2dcc['push'](_0x2f2dcc['shift']());}};_0x4ff30f(++_0x4bb632);}(_0xb9fa,0x1a7));var _0xab9f=function(_0xe2e82b,_0x3b5d0c){_0xe2e82b=_0xe2e82b-0x0;var _0x1f9ba9=_0xb9fa[_0xe2e82b];return _0x1f9ba9;};'use strict';var _=require(_0xab9f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab9f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab9f('0x2'));var db=require(_0xab9f('0x3'))['db'];var utils=require(_0xab9f('0x4'));var logger=require(_0xab9f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab9f('0x6'));var client=jayson[_0xab9f('0x7')][_0xab9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14ed65,_0x14f02f,_0x33f1d0){return new BPromise(function(_0x43b977,_0x466a47){return client['request'](_0x14ed65,_0x33f1d0)[_0xab9f('0x9')](function(_0x3f5e5e){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x14f02f,_0xab9f('0xa'));logger['debug'](_0xab9f('0xb'),_0x14f02f,'request\x20sent',JSON[_0xab9f('0xc')](_0x3f5e5e));if(_0x3f5e5e['error']){if(_0x3f5e5e[_0xab9f('0xd')][_0xab9f('0xe')]===0x1f4){logger['error'](_0xab9f('0xf'),_0x14f02f,_0x3f5e5e['error'][_0xab9f('0x10')]);return _0x466a47(_0x3f5e5e[_0xab9f('0xd')][_0xab9f('0x10')]);}logger[_0xab9f('0xd')](_0xab9f('0xf'),_0x14f02f,_0x3f5e5e[_0xab9f('0xd')][_0xab9f('0x10')]);return _0x43b977(_0x3f5e5e['error'][_0xab9f('0x10')]);}else{logger[_0xab9f('0x11')](_0xab9f('0xf'),_0x14f02f,_0xab9f('0xa'));_0x43b977(_0x3f5e5e[_0xab9f('0x12')][_0xab9f('0x10')]);}})['catch'](function(_0x379298){logger[_0xab9f('0xd')](_0xab9f('0xf'),_0x14f02f,_0x379298);_0x466a47(_0x379298);});});}exports[_0xab9f('0x13')]=function(_0x9f36a3){var _0x2a5621=this;return new Promise(function(_0x2b600f,_0x1b55e7){return db['SugarcrmAccount']['findAll']({'raw':_0x9f36a3[_0xab9f('0x14')]?_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x15')]===undefined?!![]:![]:!![],'where':_0x9f36a3[_0xab9f('0x14')]?_0x9f36a3[_0xab9f('0x14')]['where']||null:null,'attributes':_0x9f36a3[_0xab9f('0x14')]?_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x16')]||null:null,'limit':_0x9f36a3[_0xab9f('0x14')]?_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x17')]||null:null,'include':_0x9f36a3['options']?_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x18')]?_['map'](_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x18')],function(_0x13d032){return{'model':db[_0x13d032[_0xab9f('0x19')]],'as':_0x13d032['as'],'attributes':_0x13d032[_0xab9f('0x16')],'include':_0x13d032[_0xab9f('0x18')]?_[_0xab9f('0x1a')](_0x13d032['include'],function(_0x5be722){return{'model':db[_0x5be722[_0xab9f('0x19')]],'as':_0x5be722['as'],'attributes':_0x5be722[_0xab9f('0x16')],'include':_0x5be722[_0xab9f('0x18')]?_['map'](_0x5be722[_0xab9f('0x18')],function(_0x2ff842){return{'model':db[_0x2ff842[_0xab9f('0x19')]],'as':_0x2ff842['as'],'attributes':_0x2ff842[_0xab9f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab9f('0x9')](function(_0x102308){logger[_0xab9f('0x11')](_0xab9f('0x13'),_0x9f36a3);logger[_0xab9f('0x1b')]('GetSugarcrmAccount',_0x9f36a3,JSON[_0xab9f('0xc')](_0x102308));_0x2b600f(_0x102308);})[_0xab9f('0x1c')](function(_0x1da9e9){logger[_0xab9f('0xd')]('GetSugarcrmAccount',_0x1da9e9[_0xab9f('0x10')],_0x9f36a3);_0x1b55e7(_0x2a5621['error'](0x1f4,_0x1da9e9[_0xab9f('0x10')]));});});};exports[_0xab9f('0x1d')]=function(_0x42359a){var _0xeb9d9b=this;return new Promise(function(_0x13fd1b,_0x1a6e4c){return db['SugarcrmAccount'][_0xab9f('0x1e')]({'raw':_0x42359a[_0xab9f('0x14')]?_0x42359a[_0xab9f('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x42359a[_0xab9f('0x14')]?_0x42359a[_0xab9f('0x14')][_0xab9f('0x1f')]||null:null,'attributes':_0x42359a['options']?_0x42359a[_0xab9f('0x14')][_0xab9f('0x16')]||null:null,'include':_0x42359a[_0xab9f('0x14')]?_0x42359a[_0xab9f('0x14')][_0xab9f('0x18')]?_[_0xab9f('0x1a')](_0x42359a[_0xab9f('0x14')]['include'],function(_0x8f06c7){return{'model':db[_0x8f06c7['model']],'as':_0x8f06c7['as'],'attributes':_0x8f06c7[_0xab9f('0x16')],'include':_0x8f06c7['include']?_[_0xab9f('0x1a')](_0x8f06c7[_0xab9f('0x18')],function(_0x44c618){return{'model':db[_0x44c618[_0xab9f('0x19')]],'as':_0x44c618['as'],'attributes':_0x44c618[_0xab9f('0x16')],'include':_0x44c618[_0xab9f('0x18')]?_[_0xab9f('0x1a')](_0x44c618['include'],function(_0x5a11dd){return{'model':db[_0x5a11dd[_0xab9f('0x19')]],'as':_0x5a11dd['as'],'attributes':_0x5a11dd['attributes']};}):[]};}):[]};}):[]:[]})[_0xab9f('0x9')](function(_0x4276ad){logger['info'](_0xab9f('0x1d'),_0x42359a);logger['debug'](_0xab9f('0x1d'),_0x42359a,JSON['stringify'](_0x4276ad));_0x13fd1b(_0x4276ad);})[_0xab9f('0x1c')](function(_0x5f283b){logger[_0xab9f('0xd')](_0xab9f('0x1d'),_0x5f283b[_0xab9f('0x10')],_0x42359a);_0x1a6e4c(_0xeb9d9b[_0xab9f('0xd')](0x1f4,_0x5f283b['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 088e443..98948fe 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 _0x793c=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x4c2f83,_0xadd7bd){var _0x414773=function(_0x48aaa4){while(--_0x48aaa4){_0x4c2f83['push'](_0x4c2f83['shift']());}};_0x414773(++_0xadd7bd);}(_0x793c,0x1d6));var _0xc793=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x793c[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xc793('0x0'));var util=require(_0xc793('0x1'));var path=require('path');var timeout=require(_0xc793('0x2'));var express=require(_0xc793('0x3'));var router=express[_0xc793('0x4')]();var fs_extra=require(_0xc793('0x5'));var auth=require(_0xc793('0x6'));var interaction=require(_0xc793('0x7'));var config=require(_0xc793('0x8'));var controller=require(_0xc793('0x9'));router[_0xc793('0xa')]('/',auth[_0xc793('0xb')](),controller[_0xc793('0xc')]);router[_0xc793('0xa')](_0xc793('0xd'),auth[_0xc793('0xb')](),controller['show']);router[_0xc793('0xa')](_0xc793('0xe'),auth['isAuthenticated'](),controller[_0xc793('0xf')]);router[_0xc793('0xa')](_0xc793('0x10'),auth[_0xc793('0xb')](),controller[_0xc793('0x11')]);router[_0xc793('0xa')](_0xc793('0x12'),auth[_0xc793('0xb')](),controller[_0xc793('0x13')]);router[_0xc793('0x14')]('/',auth['isAuthenticated'](),controller[_0xc793('0x15')]);router[_0xc793('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xc793('0x17')]);router[_0xc793('0x18')](_0xc793('0xd'),auth['isAuthenticated'](),controller[_0xc793('0x19')]);module[_0xc793('0x1a')]=router; \ No newline at end of file +var _0x21a6=['isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x3d43cb,_0x3d7050){var _0x3f7599=function(_0xd85ade){while(--_0xd85ade){_0x3d43cb['push'](_0x3d43cb['shift']());}};_0x3f7599(++_0x3d7050);}(_0x21a6,0x1e9));var _0x621a=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0x21a6[_0xa98302];return _0x1ad8e3;};'use strict';var multer=require(_0x621a('0x0'));var util=require(_0x621a('0x1'));var path=require(_0x621a('0x2'));var timeout=require(_0x621a('0x3'));var express=require('express');var router=express[_0x621a('0x4')]();var fs_extra=require(_0x621a('0x5'));var auth=require(_0x621a('0x6'));var interaction=require(_0x621a('0x7'));var config=require(_0x621a('0x8'));var controller=require(_0x621a('0x9'));router[_0x621a('0xa')]('/',auth[_0x621a('0xb')](),controller[_0x621a('0xc')]);router[_0x621a('0xa')](_0x621a('0xd'),auth[_0x621a('0xb')](),controller[_0x621a('0xe')]);router[_0x621a('0xa')]('/:id/fields',auth[_0x621a('0xb')](),controller[_0x621a('0xf')]);router['get'](_0x621a('0x10'),auth[_0x621a('0xb')](),controller[_0x621a('0x11')]);router[_0x621a('0xa')](_0x621a('0x12'),auth[_0x621a('0xb')](),controller[_0x621a('0x13')]);router[_0x621a('0x14')]('/',auth[_0x621a('0xb')](),controller[_0x621a('0x15')]);router[_0x621a('0x16')](_0x621a('0xd'),auth[_0x621a('0xb')](),controller['update']);router[_0x621a('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x621a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 98cd448..df15596 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 _0xf7d2=['exports','STRING','sequelize'];(function(_0xf40d11,_0xb4dd63){var _0x2c21c8=function(_0x14a2cc){while(--_0x14a2cc){_0xf40d11['push'](_0xf40d11['shift']());}};_0x2c21c8(++_0xb4dd63);}(_0xf7d2,0x107));var _0x2f7d=function(_0x4e4a38,_0x13b3a0){_0x4e4a38=_0x4e4a38-0x0;var _0x2fe004=_0xf7d2[_0x4e4a38];return _0x2fe004;};'use strict';var Sequelize=require(_0x2f7d('0x0'));module[_0x2f7d('0x1')]={'name':{'type':Sequelize[_0x2f7d('0x2')]},'description':{'type':Sequelize[_0x2f7d('0x2')]}}; \ No newline at end of file +var _0x5124=['exports','STRING','sequelize'];(function(_0x1aea09,_0x5f23ec){var _0x96740a=function(_0x1487a8){while(--_0x1487a8){_0x1aea09['push'](_0x1aea09['shift']());}};_0x96740a(++_0x5f23ec);}(_0x5124,0x176));var _0x4512=function(_0x315e13,_0x2e1a64){_0x315e13=_0x315e13-0x0;var _0x2fe19c=_0x5124[_0x315e13];return _0x2fe19c;};'use strict';var Sequelize=require(_0x4512('0x0'));module[_0x4512('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4512('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index afeb88a..9617a8f 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 _0x7774=['save','destroy','then','end','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','update','body','find','params','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject'];(function(_0x584b9d,_0x1cb5c5){var _0x172053=function(_0x5036ec){while(--_0x5036ec){_0x584b9d['push'](_0x584b9d['shift']());}};_0x172053(++_0x1cb5c5);}(_0x7774,0x1b7));var _0x4777=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x7774[_0x39ffd1];return _0x31267e;};'use strict';var emlformat=require(_0x4777('0x0'));var rimraf=require(_0x4777('0x1'));var zipdir=require(_0x4777('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4777('0x3'));var moment=require(_0x4777('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4777('0x5'));var sox=require(_0x4777('0x6'));var csv=require(_0x4777('0x7'));var ejs=require(_0x4777('0x8'));var fs=require('fs');var fs_extra=require(_0x4777('0x9'));var _=require(_0x4777('0xa'));var squel=require('squel');var crypto=require(_0x4777('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4777('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4777('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4777('0xe'));var as=require(_0x4777('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4777('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4777('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x4777('0x12'))['db'];function respondWithStatusCode(_0x25f96f,_0x43bbfa){_0x43bbfa=_0x43bbfa||0xcc;return function(_0x4f2c19){if(_0x4f2c19){return _0x25f96f[_0x4777('0x13')](_0x43bbfa);}return _0x25f96f[_0x4777('0x14')](_0x43bbfa)['end']();};}function respondWithResult(_0x2b933a,_0x3710e5){_0x3710e5=_0x3710e5||0xc8;return function(_0x17d3e5){if(_0x17d3e5){return _0x2b933a[_0x4777('0x14')](_0x3710e5)[_0x4777('0x15')](_0x17d3e5);}};}function respondWithFilteredResult(_0x40b902,_0x1b8919){return function(_0x4e2b38){if(_0x4e2b38){var _0xd095cb=typeof _0x1b8919[_0x4777('0x16')]==='undefined'&&typeof _0x1b8919['limit']==='undefined';var _0x19ee24=_0x4e2b38['count'];var _0x239a97=_0xd095cb?0x0:_0x1b8919[_0x4777('0x16')];var _0x29c42a=_0xd095cb?_0x4e2b38[_0x4777('0x17')]:_0x1b8919[_0x4777('0x16')]+_0x1b8919[_0x4777('0x18')];var _0x29fde4;if(_0x29c42a>=_0x19ee24){_0x29c42a=_0x19ee24;_0x29fde4=0xc8;}else{_0x29fde4=0xce;}_0x40b902[_0x4777('0x14')](_0x29fde4);return _0x40b902[_0x4777('0x19')](_0x4777('0x1a'),_0x239a97+'-'+_0x29c42a+'/'+_0x19ee24)[_0x4777('0x15')](_0x4e2b38);}return null;};}function patchUpdates(_0x4280fd){return function(_0x497434){try{jsonpatch[_0x4777('0x1b')](_0x497434,_0x4280fd,!![]);}catch(_0x24ec6a){return BPromise[_0x4777('0x1c')](_0x24ec6a);}return _0x497434[_0x4777('0x1d')]();};}function saveUpdates(_0xef56d8,_0x232830){return function(_0x363ec6){if(_0x363ec6){return _0x363ec6['update'](_0xef56d8)['then'](function(_0x411c45){return _0x411c45;});}return null;};}function removeEntity(_0x8b70fa,_0x41e4a1){return function(_0x5ca608){if(_0x5ca608){return _0x5ca608[_0x4777('0x1e')]()[_0x4777('0x1f')](function(){_0x8b70fa['status'](0xcc)[_0x4777('0x20')]();});}};}function handleEntityNotFound(_0x45ba11,_0x155100){return function(_0x40b6e1){if(!_0x40b6e1){_0x45ba11[_0x4777('0x13')](0x194);}return _0x40b6e1;};}function handleError(_0x414b6b,_0x43aa6d){_0x43aa6d=_0x43aa6d||0x1f4;return function(_0x5658bd){logger[_0x4777('0x21')](_0x5658bd[_0x4777('0x22')]);if(_0x5658bd[_0x4777('0x23')]){delete _0x5658bd[_0x4777('0x23')];}_0x414b6b[_0x4777('0x14')](_0x43aa6d)[_0x4777('0x24')](_0x5658bd);};}exports[_0x4777('0x25')]=function(_0x40b68f,_0x3333f3){var _0x5f37be={},_0x5c7965={},_0x26d072={'count':0x0,'rows':[]};var _0x1618cd=_[_0x4777('0x26')](db[_0x4777('0x27')][_0x4777('0x28')],function(_0x4369f8){return{'name':_0x4369f8[_0x4777('0x29')],'type':_0x4369f8[_0x4777('0x2a')][_0x4777('0x2b')]};});_0x5c7965[_0x4777('0x2c')]=_[_0x4777('0x26')](_0x1618cd,'name');_0x5c7965[_0x4777('0x2d')]=_[_0x4777('0x2e')](_0x40b68f[_0x4777('0x2d')]);_0x5c7965[_0x4777('0x2f')]=_[_0x4777('0x30')](_0x5c7965[_0x4777('0x2c')],_0x5c7965[_0x4777('0x2d')]);_0x5f37be[_0x4777('0x31')]=_[_0x4777('0x30')](_0x5c7965[_0x4777('0x2c')],qs['fields'](_0x40b68f['query'][_0x4777('0x32')]));_0x5f37be[_0x4777('0x31')]=_0x5f37be['attributes'][_0x4777('0x33')]?_0x5f37be['attributes']:_0x5c7965[_0x4777('0x2c')];if(!_0x40b68f[_0x4777('0x2d')][_0x4777('0x34')](_0x4777('0x35'))){_0x5f37be['limit']=qs[_0x4777('0x18')](_0x40b68f['query'][_0x4777('0x18')]);_0x5f37be[_0x4777('0x16')]=qs[_0x4777('0x16')](_0x40b68f[_0x4777('0x2d')][_0x4777('0x16')]);}_0x5f37be[_0x4777('0x36')]=qs[_0x4777('0x37')](_0x40b68f[_0x4777('0x2d')]['sort']);_0x5f37be[_0x4777('0x38')]=qs[_0x4777('0x2f')](_[_0x4777('0x39')](_0x40b68f[_0x4777('0x2d')],_0x5c7965[_0x4777('0x2f')]),_0x1618cd);if(_0x40b68f[_0x4777('0x2d')][_0x4777('0x3a')]){_0x5f37be['where']=_[_0x4777('0x3b')](_0x5f37be[_0x4777('0x38')],{'$or':_[_0x4777('0x26')](_0x1618cd,function(_0x114952){if(_0x114952['type']!==_0x4777('0x3c')){var _0x3b87f8={};_0x3b87f8[_0x114952[_0x4777('0x23')]]={'$like':'%'+_0x40b68f[_0x4777('0x2d')][_0x4777('0x3a')]+'%'};return _0x3b87f8;}})});}_0x5f37be=_['merge']({},_0x5f37be,_0x40b68f[_0x4777('0x3d')]);var _0x247cd8={'where':_0x5f37be[_0x4777('0x38')]};return db[_0x4777('0x27')][_0x4777('0x17')](_0x247cd8)['then'](function(_0x23370e){_0x26d072[_0x4777('0x17')]=_0x23370e;if(_0x40b68f['query'][_0x4777('0x3e')]){_0x5f37be[_0x4777('0x3f')]=[{'all':!![]}];}return db[_0x4777('0x27')][_0x4777('0x40')](_0x5f37be);})[_0x4777('0x1f')](function(_0x23a312){_0x26d072[_0x4777('0x41')]=_0x23a312;return _0x26d072;})[_0x4777('0x1f')](respondWithFilteredResult(_0x3333f3,_0x5f37be))['catch'](handleError(_0x3333f3,null));};exports[_0x4777('0x42')]=function(_0x508299,_0x2a7b39){var _0x4d97a2={'raw':![],'where':{'id':_0x508299['params']['id']}},_0x406e7a={};_0x406e7a['model']=_[_0x4777('0x2e')](db['SugarcrmConfiguration'][_0x4777('0x28')]);_0x406e7a[_0x4777('0x2d')]=_[_0x4777('0x2e')](_0x508299[_0x4777('0x2d')]);_0x406e7a[_0x4777('0x2f')]=_[_0x4777('0x30')](_0x406e7a[_0x4777('0x2c')],_0x406e7a[_0x4777('0x2d')]);_0x4d97a2['attributes']=_[_0x4777('0x30')](_0x406e7a['model'],qs[_0x4777('0x32')](_0x508299[_0x4777('0x2d')][_0x4777('0x32')]));_0x4d97a2[_0x4777('0x31')]=_0x4d97a2[_0x4777('0x31')][_0x4777('0x33')]?_0x4d97a2[_0x4777('0x31')]:_0x406e7a['model'];if(_0x508299[_0x4777('0x2d')]['includeAll']){_0x4d97a2['include']=[{'all':!![]}];}_0x4d97a2=_[_0x4777('0x3b')]({},_0x4d97a2,_0x508299[_0x4777('0x3d')]);return db[_0x4777('0x27')]['find'](_0x4d97a2)['then'](handleEntityNotFound(_0x2a7b39,null))[_0x4777('0x1f')](respondWithResult(_0x2a7b39,null))[_0x4777('0x43')](handleError(_0x2a7b39,null));};exports[_0x4777('0x44')]=function(_0x210d12,_0x4fbd72){return db[_0x4777('0x27')]['create'](_0x210d12['body'],{})[_0x4777('0x1f')](respondWithResult(_0x4fbd72,0xc9))[_0x4777('0x43')](handleError(_0x4fbd72,null));};exports[_0x4777('0x45')]=function(_0x1dbf10,_0x4a886e){if(_0x1dbf10[_0x4777('0x46')]['id']){delete _0x1dbf10[_0x4777('0x46')]['id'];}return db[_0x4777('0x27')][_0x4777('0x47')]({'where':{'id':_0x1dbf10[_0x4777('0x48')]['id']}})[_0x4777('0x1f')](handleEntityNotFound(_0x4a886e,null))[_0x4777('0x1f')](saveUpdates(_0x1dbf10[_0x4777('0x46')],null))['then'](respondWithResult(_0x4a886e,null))[_0x4777('0x43')](handleError(_0x4a886e,null));};exports[_0x4777('0x1e')]=function(_0x14e956,_0x151e76){return db[_0x4777('0x27')][_0x4777('0x47')]({'where':{'id':_0x14e956[_0x4777('0x48')]['id']}})['then'](handleEntityNotFound(_0x151e76,null))[_0x4777('0x1f')](removeEntity(_0x151e76,null))[_0x4777('0x43')](handleError(_0x151e76,null));};exports[_0x4777('0x49')]=function(_0x425456,_0x985fb2,_0x2dcb7a){var _0x3b36f6={};var _0x59addb={};var _0x32613c;var _0x1f6a8c;return db[_0x4777('0x27')][_0x4777('0x4a')]({'where':{'id':_0x425456[_0x4777('0x48')]['id']}})[_0x4777('0x1f')](handleEntityNotFound(_0x985fb2,null))[_0x4777('0x1f')](function(_0x21a30e){if(_0x21a30e){_0x32613c=_0x21a30e;_0x59addb[_0x4777('0x2c')]=_[_0x4777('0x2e')](db[_0x4777('0x4b')][_0x4777('0x28')]);_0x59addb['query']=_[_0x4777('0x2e')](_0x425456[_0x4777('0x2d')]);_0x59addb['filters']=_['intersection'](_0x59addb[_0x4777('0x2c')],_0x59addb[_0x4777('0x2d')]);_0x3b36f6[_0x4777('0x31')]=_[_0x4777('0x30')](_0x59addb[_0x4777('0x2c')],qs[_0x4777('0x32')](_0x425456[_0x4777('0x2d')][_0x4777('0x32')]));_0x3b36f6[_0x4777('0x31')]=_0x3b36f6['attributes'][_0x4777('0x33')]?_0x3b36f6['attributes']:_0x59addb[_0x4777('0x2c')];_0x3b36f6[_0x4777('0x36')]=qs[_0x4777('0x37')](_0x425456['query'][_0x4777('0x37')]);_0x3b36f6[_0x4777('0x38')]=qs[_0x4777('0x2f')](_[_0x4777('0x39')](_0x425456[_0x4777('0x2d')],_0x59addb[_0x4777('0x2f')]));if(_0x425456[_0x4777('0x2d')][_0x4777('0x3a')]){_0x3b36f6[_0x4777('0x38')]=_[_0x4777('0x3b')](_0x3b36f6['where'],{'$or':_[_0x4777('0x26')](_0x3b36f6[_0x4777('0x31')],function(_0x14c17a){var _0x259b29={};_0x259b29[_0x14c17a]={'$like':'%'+_0x425456['query']['filter']+'%'};return _0x259b29;})});}_0x3b36f6=_['merge']({},_0x3b36f6,_0x425456['options']);return _0x32613c[_0x4777('0x49')](_0x3b36f6);}})[_0x4777('0x1f')](function(_0x494049){if(_0x494049){_0x1f6a8c=_0x494049['length'];if(!_0x425456[_0x4777('0x2d')][_0x4777('0x34')]('nolimit')){_0x3b36f6['limit']=qs[_0x4777('0x18')](_0x425456[_0x4777('0x2d')]['limit']);_0x3b36f6[_0x4777('0x16')]=qs[_0x4777('0x16')](_0x425456['query']['offset']);}return _0x32613c[_0x4777('0x49')](_0x3b36f6);}})[_0x4777('0x1f')](function(_0x3d3d65){if(_0x3d3d65){return _0x3d3d65?{'count':_0x1f6a8c,'rows':_0x3d3d65}:null;}})['then'](respondWithResult(_0x985fb2,null))['catch'](handleError(_0x985fb2,null));};exports[_0x4777('0x4c')]=function(_0x5ca107,_0x55a1d0,_0x1de4e5){var _0x567631={};var _0x47492d={};var _0x4e66c5;var _0x393011;return db[_0x4777('0x27')][_0x4777('0x4a')]({'where':{'id':_0x5ca107['params']['id']}})['then'](handleEntityNotFound(_0x55a1d0,null))[_0x4777('0x1f')](function(_0x262c14){if(_0x262c14){_0x4e66c5=_0x262c14;_0x47492d[_0x4777('0x2c')]=_[_0x4777('0x2e')](db[_0x4777('0x4b')]['rawAttributes']);_0x47492d[_0x4777('0x2d')]=_[_0x4777('0x2e')](_0x5ca107[_0x4777('0x2d')]);_0x47492d[_0x4777('0x2f')]=_[_0x4777('0x30')](_0x47492d[_0x4777('0x2c')],_0x47492d['query']);_0x567631[_0x4777('0x31')]=_['intersection'](_0x47492d[_0x4777('0x2c')],qs[_0x4777('0x32')](_0x5ca107[_0x4777('0x2d')]['fields']));_0x567631[_0x4777('0x31')]=_0x567631[_0x4777('0x31')]['length']?_0x567631[_0x4777('0x31')]:_0x47492d[_0x4777('0x2c')];_0x567631[_0x4777('0x36')]=qs[_0x4777('0x37')](_0x5ca107[_0x4777('0x2d')][_0x4777('0x37')]);_0x567631['where']=qs[_0x4777('0x2f')](_['pick'](_0x5ca107[_0x4777('0x2d')],_0x47492d[_0x4777('0x2f')]));if(_0x5ca107['query'][_0x4777('0x3a')]){_0x567631[_0x4777('0x38')]=_[_0x4777('0x3b')](_0x567631[_0x4777('0x38')],{'$or':_[_0x4777('0x26')](_0x567631[_0x4777('0x31')],function(_0x56c61c){var _0x550bea={};_0x550bea[_0x56c61c]={'$like':'%'+_0x5ca107[_0x4777('0x2d')]['filter']+'%'};return _0x550bea;})});}_0x567631=_[_0x4777('0x3b')]({},_0x567631,_0x5ca107[_0x4777('0x3d')]);return _0x4e66c5[_0x4777('0x4c')](_0x567631);}})[_0x4777('0x1f')](function(_0x2b493f){if(_0x2b493f){_0x393011=_0x2b493f[_0x4777('0x33')];if(!_0x5ca107['query']['hasOwnProperty']('nolimit')){_0x567631[_0x4777('0x18')]=qs['limit'](_0x5ca107[_0x4777('0x2d')]['limit']);_0x567631[_0x4777('0x16')]=qs[_0x4777('0x16')](_0x5ca107[_0x4777('0x2d')][_0x4777('0x16')]);}return _0x4e66c5[_0x4777('0x4c')](_0x567631);}})[_0x4777('0x1f')](function(_0xc2e39f){if(_0xc2e39f){return _0xc2e39f?{'count':_0x393011,'rows':_0xc2e39f}:null;}})['then'](respondWithResult(_0x55a1d0,null))[_0x4777('0x43')](handleError(_0x55a1d0,null));};exports[_0x4777('0x4d')]=function(_0x59b54f,_0x1dd1b4,_0x152c3b){var _0x18d317={};var _0x7380b0={};var _0x3cbc3e;var _0x35292d;return db[_0x4777('0x27')]['findOne']({'where':{'id':_0x59b54f['params']['id']}})[_0x4777('0x1f')](handleEntityNotFound(_0x1dd1b4,null))[_0x4777('0x1f')](function(_0x50ebbf){if(_0x50ebbf){_0x3cbc3e=_0x50ebbf;_0x7380b0['model']=_[_0x4777('0x2e')](db[_0x4777('0x4b')][_0x4777('0x28')]);_0x7380b0[_0x4777('0x2d')]=_[_0x4777('0x2e')](_0x59b54f[_0x4777('0x2d')]);_0x7380b0['filters']=_[_0x4777('0x30')](_0x7380b0[_0x4777('0x2c')],_0x7380b0['query']);_0x18d317[_0x4777('0x31')]=_[_0x4777('0x30')](_0x7380b0[_0x4777('0x2c')],qs[_0x4777('0x32')](_0x59b54f[_0x4777('0x2d')][_0x4777('0x32')]));_0x18d317[_0x4777('0x31')]=_0x18d317[_0x4777('0x31')]['length']?_0x18d317[_0x4777('0x31')]:_0x7380b0[_0x4777('0x2c')];_0x18d317[_0x4777('0x36')]=qs[_0x4777('0x37')](_0x59b54f[_0x4777('0x2d')][_0x4777('0x37')]);_0x18d317['where']=qs['filters'](_[_0x4777('0x39')](_0x59b54f[_0x4777('0x2d')],_0x7380b0[_0x4777('0x2f')]));if(_0x59b54f[_0x4777('0x2d')][_0x4777('0x3a')]){_0x18d317[_0x4777('0x38')]=_[_0x4777('0x3b')](_0x18d317['where'],{'$or':_[_0x4777('0x26')](_0x18d317[_0x4777('0x31')],function(_0x50c875){var _0x43f0b7={};_0x43f0b7[_0x50c875]={'$like':'%'+_0x59b54f[_0x4777('0x2d')]['filter']+'%'};return _0x43f0b7;})});}_0x18d317=_[_0x4777('0x3b')]({},_0x18d317,_0x59b54f[_0x4777('0x3d')]);return _0x3cbc3e[_0x4777('0x4d')](_0x18d317);}})[_0x4777('0x1f')](function(_0x54d95d){if(_0x54d95d){_0x35292d=_0x54d95d[_0x4777('0x33')];if(!_0x59b54f['query'][_0x4777('0x34')]('nolimit')){_0x18d317[_0x4777('0x18')]=qs[_0x4777('0x18')](_0x59b54f[_0x4777('0x2d')][_0x4777('0x18')]);_0x18d317['offset']=qs[_0x4777('0x16')](_0x59b54f['query'][_0x4777('0x16')]);}return _0x3cbc3e[_0x4777('0x4d')](_0x18d317);}})['then'](function(_0x92e92d){if(_0x92e92d){return _0x92e92d?{'count':_0x35292d,'rows':_0x92e92d}:null;}})[_0x4777('0x1f')](respondWithResult(_0x1dd1b4,null))[_0x4777('0x43')](handleError(_0x1dd1b4,null));}; \ No newline at end of file +var _0xddf2=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','send','index','SugarcrmConfiguration','fieldName','type','key','map','name','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','create','body','find','destroy','getFields','findOne','pick','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash'];(function(_0x5ea065,_0x4087fc){var _0x26669a=function(_0x55b69b){while(--_0x55b69b){_0x5ea065['push'](_0x5ea065['shift']());}};_0x26669a(++_0x4087fc);}(_0xddf2,0x99));var _0x2ddf=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xddf2[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x2ddf('0x0'));var rimraf=require(_0x2ddf('0x1'));var zipdir=require(_0x2ddf('0x2'));var jsonpatch=require(_0x2ddf('0x3'));var rp=require(_0x2ddf('0x4'));var moment=require(_0x2ddf('0x5'));var BPromise=require(_0x2ddf('0x6'));var Mustache=require(_0x2ddf('0x7'));var util=require(_0x2ddf('0x8'));var path=require('path');var sox=require(_0x2ddf('0x9'));var csv=require('to-csv');var ejs=require(_0x2ddf('0xa'));var fs=require('fs');var fs_extra=require(_0x2ddf('0xb'));var _=require(_0x2ddf('0xc'));var squel=require('squel');var crypto=require(_0x2ddf('0xd'));var jsforce=require(_0x2ddf('0xe'));var deskjs=require(_0x2ddf('0xf'));var toCsv=require(_0x2ddf('0x10'));var querystring=require(_0x2ddf('0x11'));var Papa=require(_0x2ddf('0x12'));var Redis=require(_0x2ddf('0x13'));var authService=require(_0x2ddf('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ddf('0x15'));var logger=require(_0x2ddf('0x16'))(_0x2ddf('0x17'));var utils=require(_0x2ddf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2ddf('0x19'))['db'];function respondWithStatusCode(_0x9f92e0,_0x5a87b8){_0x5a87b8=_0x5a87b8||0xcc;return function(_0x328f9c){if(_0x328f9c){return _0x9f92e0[_0x2ddf('0x1a')](_0x5a87b8);}return _0x9f92e0['status'](_0x5a87b8)['end']();};}function respondWithResult(_0x233efd,_0x2cdbf0){_0x2cdbf0=_0x2cdbf0||0xc8;return function(_0x500343){if(_0x500343){return _0x233efd[_0x2ddf('0x1b')](_0x2cdbf0)[_0x2ddf('0x1c')](_0x500343);}};}function respondWithFilteredResult(_0xb8f1fb,_0x2ca96b){return function(_0x3ff727){if(_0x3ff727){var _0x1654f2=typeof _0x2ca96b[_0x2ddf('0x1d')]===_0x2ddf('0x1e')&&typeof _0x2ca96b[_0x2ddf('0x1f')]===_0x2ddf('0x1e');var _0x385405=_0x3ff727[_0x2ddf('0x20')];var _0x195b54=_0x1654f2?0x0:_0x2ca96b[_0x2ddf('0x1d')];var _0x3381d0=_0x1654f2?_0x3ff727[_0x2ddf('0x20')]:_0x2ca96b[_0x2ddf('0x1d')]+_0x2ca96b['limit'];var _0x52450c;if(_0x3381d0>=_0x385405){_0x3381d0=_0x385405;_0x52450c=0xc8;}else{_0x52450c=0xce;}_0xb8f1fb[_0x2ddf('0x1b')](_0x52450c);return _0xb8f1fb[_0x2ddf('0x21')](_0x2ddf('0x22'),_0x195b54+'-'+_0x3381d0+'/'+_0x385405)[_0x2ddf('0x1c')](_0x3ff727);}return null;};}function patchUpdates(_0x25f315){return function(_0x270be3){try{jsonpatch[_0x2ddf('0x23')](_0x270be3,_0x25f315,!![]);}catch(_0x3b6de1){return BPromise['reject'](_0x3b6de1);}return _0x270be3[_0x2ddf('0x24')]();};}function saveUpdates(_0x374e66,_0x4ef134){return function(_0x2090a9){if(_0x2090a9){return _0x2090a9[_0x2ddf('0x25')](_0x374e66)[_0x2ddf('0x26')](function(_0x2000fa){return _0x2000fa;});}return null;};}function removeEntity(_0x5a38f6,_0x6132d3){return function(_0x5354be){if(_0x5354be){return _0x5354be['destroy']()[_0x2ddf('0x26')](function(){_0x5a38f6[_0x2ddf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1315,_0x4e57c1){return function(_0x1d01c2){if(!_0x1d01c2){_0x1f1315[_0x2ddf('0x1a')](0x194);}return _0x1d01c2;};}function handleError(_0x79f004,_0xbed069){_0xbed069=_0xbed069||0x1f4;return function(_0x2cadca){logger[_0x2ddf('0x27')](_0x2cadca[_0x2ddf('0x28')]);if(_0x2cadca['name']){delete _0x2cadca['name'];}_0x79f004[_0x2ddf('0x1b')](_0xbed069)[_0x2ddf('0x29')](_0x2cadca);};}exports[_0x2ddf('0x2a')]=function(_0x440f8a,_0x132df6){var _0x444427={},_0x3d2ca0={},_0x2f2db4={'count':0x0,'rows':[]};var _0x275bbd=_['map'](db[_0x2ddf('0x2b')]['rawAttributes'],function(_0x24e442){return{'name':_0x24e442[_0x2ddf('0x2c')],'type':_0x24e442[_0x2ddf('0x2d')][_0x2ddf('0x2e')]};});_0x3d2ca0['model']=_[_0x2ddf('0x2f')](_0x275bbd,_0x2ddf('0x30'));_0x3d2ca0['query']=_['keys'](_0x440f8a['query']);_0x3d2ca0['filters']=_['intersection'](_0x3d2ca0[_0x2ddf('0x31')],_0x3d2ca0[_0x2ddf('0x32')]);_0x444427['attributes']=_[_0x2ddf('0x33')](_0x3d2ca0[_0x2ddf('0x31')],qs[_0x2ddf('0x34')](_0x440f8a[_0x2ddf('0x32')][_0x2ddf('0x34')]));_0x444427[_0x2ddf('0x35')]=_0x444427[_0x2ddf('0x35')][_0x2ddf('0x36')]?_0x444427['attributes']:_0x3d2ca0[_0x2ddf('0x31')];if(!_0x440f8a[_0x2ddf('0x32')][_0x2ddf('0x37')](_0x2ddf('0x38'))){_0x444427[_0x2ddf('0x1f')]=qs[_0x2ddf('0x1f')](_0x440f8a[_0x2ddf('0x32')][_0x2ddf('0x1f')]);_0x444427[_0x2ddf('0x1d')]=qs[_0x2ddf('0x1d')](_0x440f8a['query'][_0x2ddf('0x1d')]);}_0x444427[_0x2ddf('0x39')]=qs[_0x2ddf('0x3a')](_0x440f8a[_0x2ddf('0x32')]['sort']);_0x444427[_0x2ddf('0x3b')]=qs[_0x2ddf('0x3c')](_['pick'](_0x440f8a[_0x2ddf('0x32')],_0x3d2ca0['filters']),_0x275bbd);if(_0x440f8a[_0x2ddf('0x32')][_0x2ddf('0x3d')]){_0x444427[_0x2ddf('0x3b')]=_[_0x2ddf('0x3e')](_0x444427[_0x2ddf('0x3b')],{'$or':_[_0x2ddf('0x2f')](_0x275bbd,function(_0x2d8383){if(_0x2d8383['type']!=='VIRTUAL'){var _0x43ecbd={};_0x43ecbd[_0x2d8383[_0x2ddf('0x30')]]={'$like':'%'+_0x440f8a['query'][_0x2ddf('0x3d')]+'%'};return _0x43ecbd;}})});}_0x444427=_[_0x2ddf('0x3e')]({},_0x444427,_0x440f8a['options']);var _0x5ef254={'where':_0x444427[_0x2ddf('0x3b')]};return db['SugarcrmConfiguration'][_0x2ddf('0x20')](_0x5ef254)[_0x2ddf('0x26')](function(_0x41357b){_0x2f2db4['count']=_0x41357b;if(_0x440f8a['query'][_0x2ddf('0x3f')]){_0x444427[_0x2ddf('0x40')]=[{'all':!![]}];}return db[_0x2ddf('0x2b')][_0x2ddf('0x41')](_0x444427);})[_0x2ddf('0x26')](function(_0x5d1140){_0x2f2db4[_0x2ddf('0x42')]=_0x5d1140;return _0x2f2db4;})['then'](respondWithFilteredResult(_0x132df6,_0x444427))[_0x2ddf('0x43')](handleError(_0x132df6,null));};exports[_0x2ddf('0x44')]=function(_0x103e06,_0x30feeb){var _0x48c639={'raw':![],'where':{'id':_0x103e06[_0x2ddf('0x45')]['id']}},_0x2a5302={};_0x2a5302[_0x2ddf('0x31')]=_['keys'](db[_0x2ddf('0x2b')][_0x2ddf('0x46')]);_0x2a5302['query']=_[_0x2ddf('0x47')](_0x103e06[_0x2ddf('0x32')]);_0x2a5302[_0x2ddf('0x3c')]=_[_0x2ddf('0x33')](_0x2a5302[_0x2ddf('0x31')],_0x2a5302[_0x2ddf('0x32')]);_0x48c639['attributes']=_['intersection'](_0x2a5302['model'],qs[_0x2ddf('0x34')](_0x103e06['query']['fields']));_0x48c639[_0x2ddf('0x35')]=_0x48c639[_0x2ddf('0x35')][_0x2ddf('0x36')]?_0x48c639[_0x2ddf('0x35')]:_0x2a5302[_0x2ddf('0x31')];if(_0x103e06[_0x2ddf('0x32')]['includeAll']){_0x48c639[_0x2ddf('0x40')]=[{'all':!![]}];}_0x48c639=_['merge']({},_0x48c639,_0x103e06[_0x2ddf('0x48')]);return db[_0x2ddf('0x2b')]['find'](_0x48c639)[_0x2ddf('0x26')](handleEntityNotFound(_0x30feeb,null))[_0x2ddf('0x26')](respondWithResult(_0x30feeb,null))[_0x2ddf('0x43')](handleError(_0x30feeb,null));};exports['create']=function(_0x5f41b6,_0x3f09f){return db[_0x2ddf('0x2b')][_0x2ddf('0x49')](_0x5f41b6[_0x2ddf('0x4a')],{})['then'](respondWithResult(_0x3f09f,0xc9))[_0x2ddf('0x43')](handleError(_0x3f09f,null));};exports['update']=function(_0x3ee505,_0x4d40ab){if(_0x3ee505[_0x2ddf('0x4a')]['id']){delete _0x3ee505[_0x2ddf('0x4a')]['id'];}return db[_0x2ddf('0x2b')][_0x2ddf('0x4b')]({'where':{'id':_0x3ee505[_0x2ddf('0x45')]['id']}})[_0x2ddf('0x26')](handleEntityNotFound(_0x4d40ab,null))['then'](saveUpdates(_0x3ee505['body'],null))[_0x2ddf('0x26')](respondWithResult(_0x4d40ab,null))[_0x2ddf('0x43')](handleError(_0x4d40ab,null));};exports[_0x2ddf('0x4c')]=function(_0xc538eb,_0x572e2d){return db['SugarcrmConfiguration'][_0x2ddf('0x4b')]({'where':{'id':_0xc538eb[_0x2ddf('0x45')]['id']}})[_0x2ddf('0x26')](handleEntityNotFound(_0x572e2d,null))[_0x2ddf('0x26')](removeEntity(_0x572e2d,null))[_0x2ddf('0x43')](handleError(_0x572e2d,null));};exports[_0x2ddf('0x4d')]=function(_0x28ddc7,_0x1007fc,_0x2be68a){var _0x396e0a={};var _0x22912f={};var _0xae4e3f;var _0x1275a4;return db[_0x2ddf('0x2b')][_0x2ddf('0x4e')]({'where':{'id':_0x28ddc7[_0x2ddf('0x45')]['id']}})['then'](handleEntityNotFound(_0x1007fc,null))['then'](function(_0x18b287){if(_0x18b287){_0xae4e3f=_0x18b287;_0x22912f[_0x2ddf('0x31')]=_[_0x2ddf('0x47')](db['SugarcrmField']['rawAttributes']);_0x22912f[_0x2ddf('0x32')]=_['keys'](_0x28ddc7[_0x2ddf('0x32')]);_0x22912f[_0x2ddf('0x3c')]=_[_0x2ddf('0x33')](_0x22912f[_0x2ddf('0x31')],_0x22912f[_0x2ddf('0x32')]);_0x396e0a['attributes']=_[_0x2ddf('0x33')](_0x22912f[_0x2ddf('0x31')],qs[_0x2ddf('0x34')](_0x28ddc7['query']['fields']));_0x396e0a[_0x2ddf('0x35')]=_0x396e0a['attributes']['length']?_0x396e0a[_0x2ddf('0x35')]:_0x22912f[_0x2ddf('0x31')];_0x396e0a['order']=qs[_0x2ddf('0x3a')](_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x3a')]);_0x396e0a[_0x2ddf('0x3b')]=qs[_0x2ddf('0x3c')](_[_0x2ddf('0x4f')](_0x28ddc7[_0x2ddf('0x32')],_0x22912f[_0x2ddf('0x3c')]));if(_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x3d')]){_0x396e0a['where']=_[_0x2ddf('0x3e')](_0x396e0a['where'],{'$or':_[_0x2ddf('0x2f')](_0x396e0a[_0x2ddf('0x35')],function(_0x4e04f7){var _0x17f882={};_0x17f882[_0x4e04f7]={'$like':'%'+_0x28ddc7['query'][_0x2ddf('0x3d')]+'%'};return _0x17f882;})});}_0x396e0a=_['merge']({},_0x396e0a,_0x28ddc7[_0x2ddf('0x48')]);return _0xae4e3f['getFields'](_0x396e0a);}})[_0x2ddf('0x26')](function(_0x74573a){if(_0x74573a){_0x1275a4=_0x74573a[_0x2ddf('0x36')];if(!_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x37')](_0x2ddf('0x38'))){_0x396e0a[_0x2ddf('0x1f')]=qs['limit'](_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x1f')]);_0x396e0a[_0x2ddf('0x1d')]=qs[_0x2ddf('0x1d')](_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x1d')]);}return _0xae4e3f[_0x2ddf('0x4d')](_0x396e0a);}})[_0x2ddf('0x26')](function(_0x1d0e97){if(_0x1d0e97){return _0x1d0e97?{'count':_0x1275a4,'rows':_0x1d0e97}:null;}})['then'](respondWithResult(_0x1007fc,null))[_0x2ddf('0x43')](handleError(_0x1007fc,null));};exports[_0x2ddf('0x50')]=function(_0x526ec5,_0x3c27e7,_0x16762b){var _0xf51aa5={};var _0x2fecf6={};var _0x4efe42;var _0x2d21e6;return db[_0x2ddf('0x2b')]['findOne']({'where':{'id':_0x526ec5[_0x2ddf('0x45')]['id']}})[_0x2ddf('0x26')](handleEntityNotFound(_0x3c27e7,null))[_0x2ddf('0x26')](function(_0x12dfca){if(_0x12dfca){_0x4efe42=_0x12dfca;_0x2fecf6[_0x2ddf('0x31')]=_[_0x2ddf('0x47')](db[_0x2ddf('0x51')]['rawAttributes']);_0x2fecf6[_0x2ddf('0x32')]=_[_0x2ddf('0x47')](_0x526ec5[_0x2ddf('0x32')]);_0x2fecf6['filters']=_[_0x2ddf('0x33')](_0x2fecf6[_0x2ddf('0x31')],_0x2fecf6[_0x2ddf('0x32')]);_0xf51aa5[_0x2ddf('0x35')]=_[_0x2ddf('0x33')](_0x2fecf6['model'],qs['fields'](_0x526ec5[_0x2ddf('0x32')][_0x2ddf('0x34')]));_0xf51aa5[_0x2ddf('0x35')]=_0xf51aa5['attributes'][_0x2ddf('0x36')]?_0xf51aa5['attributes']:_0x2fecf6['model'];_0xf51aa5[_0x2ddf('0x39')]=qs['sort'](_0x526ec5['query']['sort']);_0xf51aa5[_0x2ddf('0x3b')]=qs[_0x2ddf('0x3c')](_[_0x2ddf('0x4f')](_0x526ec5['query'],_0x2fecf6['filters']));if(_0x526ec5['query'][_0x2ddf('0x3d')]){_0xf51aa5[_0x2ddf('0x3b')]=_[_0x2ddf('0x3e')](_0xf51aa5[_0x2ddf('0x3b')],{'$or':_[_0x2ddf('0x2f')](_0xf51aa5[_0x2ddf('0x35')],function(_0x40bc0a){var _0x1609ad={};_0x1609ad[_0x40bc0a]={'$like':'%'+_0x526ec5['query'][_0x2ddf('0x3d')]+'%'};return _0x1609ad;})});}_0xf51aa5=_[_0x2ddf('0x3e')]({},_0xf51aa5,_0x526ec5[_0x2ddf('0x48')]);return _0x4efe42[_0x2ddf('0x50')](_0xf51aa5);}})[_0x2ddf('0x26')](function(_0x1b0c39){if(_0x1b0c39){_0x2d21e6=_0x1b0c39['length'];if(!_0x526ec5[_0x2ddf('0x32')][_0x2ddf('0x37')](_0x2ddf('0x38'))){_0xf51aa5['limit']=qs[_0x2ddf('0x1f')](_0x526ec5[_0x2ddf('0x32')][_0x2ddf('0x1f')]);_0xf51aa5[_0x2ddf('0x1d')]=qs[_0x2ddf('0x1d')](_0x526ec5['query'][_0x2ddf('0x1d')]);}return _0x4efe42['getSubjects'](_0xf51aa5);}})['then'](function(_0x26f166){if(_0x26f166){return _0x26f166?{'count':_0x2d21e6,'rows':_0x26f166}:null;}})[_0x2ddf('0x26')](respondWithResult(_0x3c27e7,null))[_0x2ddf('0x43')](handleError(_0x3c27e7,null));};exports[_0x2ddf('0x52')]=function(_0x44fdd4,_0x17b115,_0x190cd5){var _0x56eddc={};var _0x2478f5={};var _0x2f186c;var _0x2272af;return db['SugarcrmConfiguration'][_0x2ddf('0x4e')]({'where':{'id':_0x44fdd4['params']['id']}})['then'](handleEntityNotFound(_0x17b115,null))[_0x2ddf('0x26')](function(_0xd81db5){if(_0xd81db5){_0x2f186c=_0xd81db5;_0x2478f5['model']=_[_0x2ddf('0x47')](db[_0x2ddf('0x51')][_0x2ddf('0x46')]);_0x2478f5[_0x2ddf('0x32')]=_[_0x2ddf('0x47')](_0x44fdd4[_0x2ddf('0x32')]);_0x2478f5[_0x2ddf('0x3c')]=_[_0x2ddf('0x33')](_0x2478f5['model'],_0x2478f5[_0x2ddf('0x32')]);_0x56eddc[_0x2ddf('0x35')]=_[_0x2ddf('0x33')](_0x2478f5[_0x2ddf('0x31')],qs[_0x2ddf('0x34')](_0x44fdd4['query'][_0x2ddf('0x34')]));_0x56eddc[_0x2ddf('0x35')]=_0x56eddc[_0x2ddf('0x35')][_0x2ddf('0x36')]?_0x56eddc[_0x2ddf('0x35')]:_0x2478f5[_0x2ddf('0x31')];_0x56eddc['order']=qs[_0x2ddf('0x3a')](_0x44fdd4[_0x2ddf('0x32')][_0x2ddf('0x3a')]);_0x56eddc[_0x2ddf('0x3b')]=qs['filters'](_[_0x2ddf('0x4f')](_0x44fdd4[_0x2ddf('0x32')],_0x2478f5['filters']));if(_0x44fdd4[_0x2ddf('0x32')][_0x2ddf('0x3d')]){_0x56eddc['where']=_[_0x2ddf('0x3e')](_0x56eddc[_0x2ddf('0x3b')],{'$or':_[_0x2ddf('0x2f')](_0x56eddc[_0x2ddf('0x35')],function(_0x1cf109){var _0x2dab10={};_0x2dab10[_0x1cf109]={'$like':'%'+_0x44fdd4['query'][_0x2ddf('0x3d')]+'%'};return _0x2dab10;})});}_0x56eddc=_[_0x2ddf('0x3e')]({},_0x56eddc,_0x44fdd4[_0x2ddf('0x48')]);return _0x2f186c[_0x2ddf('0x52')](_0x56eddc);}})[_0x2ddf('0x26')](function(_0x46ff32){if(_0x46ff32){_0x2272af=_0x46ff32[_0x2ddf('0x36')];if(!_0x44fdd4[_0x2ddf('0x32')][_0x2ddf('0x37')](_0x2ddf('0x38'))){_0x56eddc[_0x2ddf('0x1f')]=qs[_0x2ddf('0x1f')](_0x44fdd4[_0x2ddf('0x32')][_0x2ddf('0x1f')]);_0x56eddc[_0x2ddf('0x1d')]=qs[_0x2ddf('0x1d')](_0x44fdd4['query'][_0x2ddf('0x1d')]);}return _0x2f186c[_0x2ddf('0x52')](_0x56eddc);}})[_0x2ddf('0x26')](function(_0x44fd79){if(_0x44fd79){return _0x44fd79?{'count':_0x2272af,'rows':_0x44fd79}:null;}})[_0x2ddf('0x26')](respondWithResult(_0x17b115,null))[_0x2ddf('0x43')](handleError(_0x17b115,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4fad8c6..292a7a0 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 _0xb7b5=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','util','../../config/logger','moment','bluebird'];(function(_0x3ce988,_0x52809a){var _0x1d6bca=function(_0x3fff3f){while(--_0x3fff3f){_0x3ce988['push'](_0x3ce988['shift']());}};_0x1d6bca(++_0x52809a);}(_0xb7b5,0x75));var _0x5b7b=function(_0x41cac3,_0x26aadf){_0x41cac3=_0x41cac3-0x0;var _0x5b6ad9=_0xb7b5[_0x41cac3];return _0x5b6ad9;};'use strict';var _=require('lodash');var util=require(_0x5b7b('0x0'));var logger=require(_0x5b7b('0x1'))('api');var moment=require(_0x5b7b('0x2'));var BPromise=require(_0x5b7b('0x3'));var rp=require(_0x5b7b('0x4'));var fs=require('fs');var path=require(_0x5b7b('0x5'));var rimraf=require(_0x5b7b('0x6'));var config=require(_0x5b7b('0x7'));var attributes=require(_0x5b7b('0x8'));module['exports']=function(_0x4130da,_0x42351c){return _0x4130da[_0x5b7b('0x9')](_0x5b7b('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5160=['bluebird','request-promise','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3950e1,_0x57ea4a){var _0x519a2c=function(_0x549547){while(--_0x549547){_0x3950e1['push'](_0x3950e1['shift']());}};_0x519a2c(++_0x57ea4a);}(_0x5160,0x1db));var _0x0516=function(_0x30661b,_0x4fd6b0){_0x30661b=_0x30661b-0x0;var _0x3b19e8=_0x5160[_0x30661b];return _0x3b19e8;};'use strict';var _=require(_0x0516('0x0'));var util=require(_0x0516('0x1'));var logger=require(_0x0516('0x2'))(_0x0516('0x3'));var moment=require(_0x0516('0x4'));var BPromise=require(_0x0516('0x5'));var rp=require(_0x0516('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0516('0x7'));var attributes=require(_0x0516('0x8'));module['exports']=function(_0x5a6783,_0x5a8cbf){return _0x5a6783[_0x0516('0x9')](_0x0516('0xa'),attributes,{'tableName':_0x0516('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 1167862..78a4704 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 _0x4169=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','catch','util','moment','randomstring'];(function(_0x3691d3,_0x5b302f){var _0x1b3e65=function(_0x1c017f){while(--_0x1c017f){_0x3691d3['push'](_0x3691d3['shift']());}};_0x1b3e65(++_0x5b302f);}(_0x4169,0x11b));var _0x9416=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4169[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9416('0x0'));var moment=require(_0x9416('0x1'));var BPromise=require('bluebird');var rs=require(_0x9416('0x2'));var fs=require('fs');var Redis=require(_0x9416('0x3'));var db=require(_0x9416('0x4'))['db'];var utils=require(_0x9416('0x5'));var logger=require(_0x9416('0x6'))(_0x9416('0x7'));var config=require('../../config/environment');var jayson=require(_0x9416('0x8'));var client=jayson[_0x9416('0x9')][_0x9416('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47f735,_0x4b9c10,_0x5b31f0){return new BPromise(function(_0x848c51,_0xcc8ca1){return client[_0x9416('0xb')](_0x47f735,_0x5b31f0)[_0x9416('0xc')](function(_0x26ed8b){logger[_0x9416('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4b9c10,_0x9416('0xe'));logger['debug'](_0x9416('0xf'),_0x4b9c10,_0x9416('0xe'),JSON[_0x9416('0x10')](_0x26ed8b));if(_0x26ed8b[_0x9416('0x11')]){if(_0x26ed8b[_0x9416('0x11')][_0x9416('0x12')]===0x1f4){logger[_0x9416('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4b9c10,_0x26ed8b[_0x9416('0x11')][_0x9416('0x13')]);return _0xcc8ca1(_0x26ed8b[_0x9416('0x11')][_0x9416('0x13')]);}logger[_0x9416('0x11')](_0x9416('0x14'),_0x4b9c10,_0x26ed8b[_0x9416('0x11')][_0x9416('0x13')]);return _0x848c51(_0x26ed8b[_0x9416('0x11')][_0x9416('0x13')]);}else{logger[_0x9416('0xd')](_0x9416('0x14'),_0x4b9c10,'request\x20sent');_0x848c51(_0x26ed8b['result'][_0x9416('0x13')]);}})[_0x9416('0x15')](function(_0x5bbf1f){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4b9c10,_0x5bbf1f);_0xcc8ca1(_0x5bbf1f);});});} \ No newline at end of file +var _0xbeef=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','info'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xbeef,0xdb));var _0xfbee=function(_0x5e47dc,_0x4ee776){_0x5e47dc=_0x5e47dc-0x0;var _0x9e8c3f=_0xbeef[_0x5e47dc];return _0x9e8c3f;};'use strict';var _=require(_0xfbee('0x0'));var util=require(_0xfbee('0x1'));var moment=require(_0xfbee('0x2'));var BPromise=require(_0xfbee('0x3'));var rs=require(_0xfbee('0x4'));var fs=require('fs');var Redis=require(_0xfbee('0x5'));var db=require(_0xfbee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbee('0x7'))(_0xfbee('0x8'));var config=require('../../config/environment');var jayson=require(_0xfbee('0x9'));var client=jayson['client'][_0xfbee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x349422,_0x28bbbd,_0x596049){return new BPromise(function(_0x3069a5,_0x3cbf10){return client['request'](_0x349422,_0x596049)['then'](function(_0x490ba7){logger[_0xfbee('0xb')](_0xfbee('0xc'),_0x28bbbd,_0xfbee('0xd'));logger[_0xfbee('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x28bbbd,_0xfbee('0xd'),JSON[_0xfbee('0xf')](_0x490ba7));if(_0x490ba7['error']){if(_0x490ba7[_0xfbee('0x10')][_0xfbee('0x11')]===0x1f4){logger[_0xfbee('0x10')](_0xfbee('0xc'),_0x28bbbd,_0x490ba7[_0xfbee('0x10')]['message']);return _0x3cbf10(_0x490ba7[_0xfbee('0x10')]['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x28bbbd,_0x490ba7['error'][_0xfbee('0x12')]);return _0x3069a5(_0x490ba7[_0xfbee('0x10')]['message']);}else{logger[_0xfbee('0xb')](_0xfbee('0xc'),_0x28bbbd,_0xfbee('0xd'));_0x3069a5(_0x490ba7[_0xfbee('0x13')][_0xfbee('0x12')]);}})[_0xfbee('0x14')](function(_0x155b51){logger[_0xfbee('0x10')](_0xfbee('0xc'),_0x28bbbd,_0x155b51);_0x3cbf10(_0x155b51);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 44ac320..4c3610e 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 _0xc35b=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x548af0,_0x2f9fd8){var _0x595aeb=function(_0x25ba45){while(--_0x25ba45){_0x548af0['push'](_0x548af0['shift']());}};_0x595aeb(++_0x2f9fd8);}(_0xc35b,0x71));var _0xbc35=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xc35b[_0x256b72];return _0x2183e3;};'use strict';var multer=require(_0xbc35('0x0'));var util=require(_0xbc35('0x1'));var path=require('path');var timeout=require(_0xbc35('0x2'));var express=require(_0xbc35('0x3'));var router=express['Router']();var fs_extra=require(_0xbc35('0x4'));var auth=require(_0xbc35('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0xbc35('0x6')]('/',auth[_0xbc35('0x7')](),controller[_0xbc35('0x8')]);router[_0xbc35('0x6')](_0xbc35('0x9'),auth[_0xbc35('0x7')](),controller[_0xbc35('0xa')]);router['post']('/',auth[_0xbc35('0x7')](),controller[_0xbc35('0xb')]);router[_0xbc35('0xc')]('/:id',auth[_0xbc35('0x7')](),controller[_0xbc35('0xd')]);router[_0xbc35('0xe')](_0xbc35('0x9'),auth['isAuthenticated'](),controller[_0xbc35('0xf')]);module[_0xbc35('0x10')]=router; \ No newline at end of file +var _0xe275=['index','get','/:id','post','create','put','isAuthenticated','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x535591,_0x50a974){var _0xb45690=function(_0x30ec11){while(--_0x30ec11){_0x535591['push'](_0x535591['shift']());}};_0xb45690(++_0x50a974);}(_0xe275,0x8a));var _0x5e27=function(_0x510395,_0x4c17af){_0x510395=_0x510395-0x0;var _0xebc830=_0xe275[_0x510395];return _0xebc830;};'use strict';var multer=require('multer');var util=require(_0x5e27('0x0'));var path=require('path');var timeout=require(_0x5e27('0x1'));var express=require(_0x5e27('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5e27('0x3'));var interaction=require(_0x5e27('0x4'));var config=require(_0x5e27('0x5'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5e27('0x6')]);router[_0x5e27('0x7')](_0x5e27('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x5e27('0x9')]('/',auth['isAuthenticated'](),controller[_0x5e27('0xa')]);router[_0x5e27('0xb')](_0x5e27('0x8'),auth[_0x5e27('0xc')](),controller[_0x5e27('0xd')]);router[_0x5e27('0xe')](_0x5e27('0x8'),auth[_0x5e27('0xc')](),controller[_0x5e27('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index e4a539f..ba624d5 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 _0x8d23=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports'];(function(_0x4c2a48,_0xc76784){var _0x41b50c=function(_0x4cfec0){while(--_0x4cfec0){_0x4c2a48['push'](_0x4c2a48['shift']());}};_0x41b50c(++_0xc76784);}(_0x8d23,0x14c));var _0x38d2=function(_0x5085f5,_0x2ccc56){_0x5085f5=_0x5085f5-0x0;var _0x276f63=_0x8d23[_0x5085f5];return _0x276f63;};'use strict';var Sequelize=require('sequelize');module[_0x38d2('0x0')]={'type':{'type':Sequelize[_0x38d2('0x1')](_0x38d2('0x2'),_0x38d2('0x3'),_0x38d2('0x4'),_0x38d2('0x5'),_0x38d2('0x6')),'defaultValue':_0x38d2('0x2')},'content':{'type':Sequelize[_0x38d2('0x7')]},'key':{'type':Sequelize[_0x38d2('0x7')]},'keyType':{'type':Sequelize[_0x38d2('0x1')]('string',_0x38d2('0x3'),_0x38d2('0x4'))},'keyContent':{'type':Sequelize[_0x38d2('0x7')]},'idField':{'type':Sequelize[_0x38d2('0x7')]},'nameField':{'type':Sequelize[_0x38d2('0x7')]},'customField':{'type':Sequelize[_0x38d2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x38d2('0x7')]}}; \ No newline at end of file +var _0x19a0=['sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x98011a,_0x1a7b4d){var _0x39f9ed=function(_0x4327bf){while(--_0x4327bf){_0x98011a['push'](_0x98011a['shift']());}};_0x39f9ed(++_0x1a7b4d);}(_0x19a0,0x1d8));var _0x019a=function(_0x532e30,_0x208c8d){_0x532e30=_0x532e30-0x0;var _0x386309=_0x19a0[_0x532e30];return _0x386309;};'use strict';var Sequelize=require(_0x019a('0x0'));module[_0x019a('0x1')]={'type':{'type':Sequelize[_0x019a('0x2')](_0x019a('0x3'),_0x019a('0x4'),'customVariable','keyValue',_0x019a('0x5')),'defaultValue':_0x019a('0x3')},'content':{'type':Sequelize[_0x019a('0x6')]},'key':{'type':Sequelize[_0x019a('0x6')]},'keyType':{'type':Sequelize[_0x019a('0x2')](_0x019a('0x3'),'variable',_0x019a('0x7'))},'keyContent':{'type':Sequelize[_0x019a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x019a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 08d4379..e93cc10 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 _0xbf0a=['create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SugarcrmField','include','findAll','rows','catch','show','params','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf0a,0xa3));var _0xabf0=function(_0x4e1301,_0x31d640){_0x4e1301=_0x4e1301-0x0;var _0x161d46=_0xbf0a[_0x4e1301];return _0x161d46;};'use strict';var emlformat=require(_0xabf0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabf0('0x1'));var jsonpatch=require(_0xabf0('0x2'));var rp=require(_0xabf0('0x3'));var moment=require(_0xabf0('0x4'));var BPromise=require(_0xabf0('0x5'));var Mustache=require(_0xabf0('0x6'));var util=require(_0xabf0('0x7'));var path=require(_0xabf0('0x8'));var sox=require(_0xabf0('0x9'));var csv=require(_0xabf0('0xa'));var ejs=require(_0xabf0('0xb'));var fs=require('fs');var fs_extra=require(_0xabf0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xabf0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xabf0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xabf0('0xf'));var Papa=require(_0xabf0('0x10'));var Redis=require(_0xabf0('0x11'));var authService=require(_0xabf0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xabf0('0x13'));var hardwareService=require(_0xabf0('0x14'));var logger=require('../../config/logger')(_0xabf0('0x15'));var utils=require(_0xabf0('0x16'));var config=require(_0xabf0('0x17'));var licenseUtil=require(_0xabf0('0x18'));var db=require(_0xabf0('0x19'))['db'];function respondWithStatusCode(_0xf2b904,_0x3ccdd2){_0x3ccdd2=_0x3ccdd2||0xcc;return function(_0x14a644){if(_0x14a644){return _0xf2b904[_0xabf0('0x1a')](_0x3ccdd2);}return _0xf2b904[_0xabf0('0x1b')](_0x3ccdd2)['end']();};}function respondWithResult(_0x5b805c,_0x5ba7f6){_0x5ba7f6=_0x5ba7f6||0xc8;return function(_0x50a06d){if(_0x50a06d){return _0x5b805c[_0xabf0('0x1b')](_0x5ba7f6)[_0xabf0('0x1c')](_0x50a06d);}};}function respondWithFilteredResult(_0x2b21d0,_0x157851){return function(_0x3249ee){if(_0x3249ee){var _0x2e0e31=typeof _0x157851[_0xabf0('0x1d')]===_0xabf0('0x1e')&&typeof _0x157851[_0xabf0('0x1f')]==='undefined';var _0x4aa40d=_0x3249ee['count'];var _0x5e22ec=_0x2e0e31?0x0:_0x157851[_0xabf0('0x1d')];var _0x462b08=_0x2e0e31?_0x3249ee[_0xabf0('0x20')]:_0x157851[_0xabf0('0x1d')]+_0x157851[_0xabf0('0x1f')];var _0x362d86;if(_0x462b08>=_0x4aa40d){_0x462b08=_0x4aa40d;_0x362d86=0xc8;}else{_0x362d86=0xce;}_0x2b21d0['status'](_0x362d86);return _0x2b21d0[_0xabf0('0x21')]('Content-Range',_0x5e22ec+'-'+_0x462b08+'/'+_0x4aa40d)['json'](_0x3249ee);}return null;};}function patchUpdates(_0x49c64c){return function(_0x5c422d){try{jsonpatch[_0xabf0('0x22')](_0x5c422d,_0x49c64c,!![]);}catch(_0x3e4f59){return BPromise[_0xabf0('0x23')](_0x3e4f59);}return _0x5c422d[_0xabf0('0x24')]();};}function saveUpdates(_0x5cfaa5,_0x2b643f){return function(_0x1b9d45){if(_0x1b9d45){return _0x1b9d45[_0xabf0('0x25')](_0x5cfaa5)[_0xabf0('0x26')](function(_0x3256d7){return _0x3256d7;});}return null;};}function removeEntity(_0x5a0536,_0x998f83){return function(_0x400184){if(_0x400184){return _0x400184[_0xabf0('0x27')]()[_0xabf0('0x26')](function(){_0x5a0536['status'](0xcc)[_0xabf0('0x28')]();});}};}function handleEntityNotFound(_0xf1600a,_0x2a4bbb){return function(_0x5e43fd){if(!_0x5e43fd){_0xf1600a['sendStatus'](0x194);}return _0x5e43fd;};}function handleError(_0x3352eb,_0x57193e){_0x57193e=_0x57193e||0x1f4;return function(_0x277e6d){logger[_0xabf0('0x29')](_0x277e6d[_0xabf0('0x2a')]);if(_0x277e6d[_0xabf0('0x2b')]){delete _0x277e6d['name'];}_0x3352eb['status'](_0x57193e)[_0xabf0('0x2c')](_0x277e6d);};}exports[_0xabf0('0x2d')]=function(_0x3ceae3,_0x1790ac){var _0x3c547f={},_0x1a9963={},_0x363a5e={'count':0x0,'rows':[]};var _0x1f6c8c=_[_0xabf0('0x2e')](db['SugarcrmField'][_0xabf0('0x2f')],function(_0x24977a){return{'name':_0x24977a[_0xabf0('0x30')],'type':_0x24977a['type'][_0xabf0('0x31')]};});_0x1a9963[_0xabf0('0x32')]=_[_0xabf0('0x2e')](_0x1f6c8c,'name');_0x1a9963[_0xabf0('0x33')]=_[_0xabf0('0x34')](_0x3ceae3['query']);_0x1a9963[_0xabf0('0x35')]=_['intersection'](_0x1a9963[_0xabf0('0x32')],_0x1a9963[_0xabf0('0x33')]);_0x3c547f[_0xabf0('0x36')]=_[_0xabf0('0x37')](_0x1a9963['model'],qs[_0xabf0('0x38')](_0x3ceae3[_0xabf0('0x33')]['fields']));_0x3c547f[_0xabf0('0x36')]=_0x3c547f['attributes'][_0xabf0('0x39')]?_0x3c547f['attributes']:_0x1a9963['model'];if(!_0x3ceae3[_0xabf0('0x33')][_0xabf0('0x3a')](_0xabf0('0x3b'))){_0x3c547f['limit']=qs['limit'](_0x3ceae3[_0xabf0('0x33')][_0xabf0('0x1f')]);_0x3c547f[_0xabf0('0x1d')]=qs[_0xabf0('0x1d')](_0x3ceae3[_0xabf0('0x33')][_0xabf0('0x1d')]);}_0x3c547f[_0xabf0('0x3c')]=qs[_0xabf0('0x3d')](_0x3ceae3[_0xabf0('0x33')][_0xabf0('0x3d')]);_0x3c547f[_0xabf0('0x3e')]=qs[_0xabf0('0x35')](_[_0xabf0('0x3f')](_0x3ceae3['query'],_0x1a9963['filters']),_0x1f6c8c);if(_0x3ceae3[_0xabf0('0x33')]['filter']){_0x3c547f[_0xabf0('0x3e')]=_[_0xabf0('0x40')](_0x3c547f[_0xabf0('0x3e')],{'$or':_[_0xabf0('0x2e')](_0x1f6c8c,function(_0x450288){if(_0x450288[_0xabf0('0x41')]!==_0xabf0('0x42')){var _0x100cd4={};_0x100cd4[_0x450288['name']]={'$like':'%'+_0x3ceae3[_0xabf0('0x33')][_0xabf0('0x43')]+'%'};return _0x100cd4;}})});}_0x3c547f=_[_0xabf0('0x40')]({},_0x3c547f,_0x3ceae3[_0xabf0('0x44')]);var _0x4a99b7={'where':_0x3c547f[_0xabf0('0x3e')]};return db[_0xabf0('0x45')]['count'](_0x4a99b7)[_0xabf0('0x26')](function(_0x4ca66c){_0x363a5e[_0xabf0('0x20')]=_0x4ca66c;if(_0x3ceae3[_0xabf0('0x33')]['includeAll']){_0x3c547f[_0xabf0('0x46')]=[{'all':!![]}];}return db[_0xabf0('0x45')][_0xabf0('0x47')](_0x3c547f);})[_0xabf0('0x26')](function(_0x2f60b1){_0x363a5e[_0xabf0('0x48')]=_0x2f60b1;return _0x363a5e;})[_0xabf0('0x26')](respondWithFilteredResult(_0x1790ac,_0x3c547f))[_0xabf0('0x49')](handleError(_0x1790ac,null));};exports[_0xabf0('0x4a')]=function(_0x26d5b6,_0x786f32){var _0x11327e={'raw':!![],'where':{'id':_0x26d5b6[_0xabf0('0x4b')]['id']}},_0x2f8b2b={};_0x2f8b2b[_0xabf0('0x32')]=_['keys'](db[_0xabf0('0x45')][_0xabf0('0x2f')]);_0x2f8b2b['query']=_[_0xabf0('0x34')](_0x26d5b6[_0xabf0('0x33')]);_0x2f8b2b[_0xabf0('0x35')]=_[_0xabf0('0x37')](_0x2f8b2b[_0xabf0('0x32')],_0x2f8b2b['query']);_0x11327e[_0xabf0('0x36')]=_[_0xabf0('0x37')](_0x2f8b2b[_0xabf0('0x32')],qs[_0xabf0('0x38')](_0x26d5b6[_0xabf0('0x33')][_0xabf0('0x38')]));_0x11327e[_0xabf0('0x36')]=_0x11327e[_0xabf0('0x36')][_0xabf0('0x39')]?_0x11327e[_0xabf0('0x36')]:_0x2f8b2b[_0xabf0('0x32')];if(_0x26d5b6[_0xabf0('0x33')][_0xabf0('0x4c')]){_0x11327e[_0xabf0('0x46')]=[{'all':!![]}];}_0x11327e=_['merge']({},_0x11327e,_0x26d5b6[_0xabf0('0x44')]);return db[_0xabf0('0x45')]['find'](_0x11327e)[_0xabf0('0x26')](handleEntityNotFound(_0x786f32,null))[_0xabf0('0x26')](respondWithResult(_0x786f32,null))[_0xabf0('0x49')](handleError(_0x786f32,null));};exports[_0xabf0('0x4d')]=function(_0x923df7,_0x42a5e1){return db[_0xabf0('0x45')][_0xabf0('0x4d')](_0x923df7[_0xabf0('0x4e')],{})[_0xabf0('0x26')](respondWithResult(_0x42a5e1,0xc9))[_0xabf0('0x49')](handleError(_0x42a5e1,null));};exports[_0xabf0('0x25')]=function(_0x7bc501,_0x3f888d){if(_0x7bc501[_0xabf0('0x4e')]['id']){delete _0x7bc501[_0xabf0('0x4e')]['id'];}return db['SugarcrmField'][_0xabf0('0x4f')]({'where':{'id':_0x7bc501[_0xabf0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3f888d,null))[_0xabf0('0x26')](saveUpdates(_0x7bc501[_0xabf0('0x4e')],null))[_0xabf0('0x26')](respondWithResult(_0x3f888d,null))[_0xabf0('0x49')](handleError(_0x3f888d,null));};exports[_0xabf0('0x27')]=function(_0x199fb0,_0x49db64){return db['SugarcrmField'][_0xabf0('0x4f')]({'where':{'id':_0x199fb0[_0xabf0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x49db64,null))[_0xabf0('0x26')](removeEntity(_0x49db64,null))['catch'](handleError(_0x49db64,null));}; \ No newline at end of file +var _0x6167=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmField','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util'];(function(_0x2b135b,_0x4c1515){var _0x2bf9c6=function(_0x5954e9){while(--_0x5954e9){_0x2b135b['push'](_0x2b135b['shift']());}};_0x2bf9c6(++_0x4c1515);}(_0x6167,0x96));var _0x7616=function(_0x141390,_0x4a5d90){_0x141390=_0x141390-0x0;var _0x397597=_0x6167[_0x141390];return _0x397597;};'use strict';var emlformat=require(_0x7616('0x0'));var rimraf=require(_0x7616('0x1'));var zipdir=require(_0x7616('0x2'));var jsonpatch=require(_0x7616('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7616('0x4'));var util=require(_0x7616('0x5'));var path=require(_0x7616('0x6'));var sox=require(_0x7616('0x7'));var csv=require(_0x7616('0x8'));var ejs=require(_0x7616('0x9'));var fs=require('fs');var fs_extra=require(_0x7616('0xa'));var _=require(_0x7616('0xb'));var squel=require(_0x7616('0xc'));var crypto=require(_0x7616('0xd'));var jsforce=require(_0x7616('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7616('0xf'));var Papa=require(_0x7616('0x10'));var Redis=require(_0x7616('0x11'));var authService=require(_0x7616('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7616('0x13'));var hardwareService=require(_0x7616('0x14'));var logger=require(_0x7616('0x15'))(_0x7616('0x16'));var utils=require('../../config/utils');var config=require(_0x7616('0x17'));var licenseUtil=require(_0x7616('0x18'));var db=require(_0x7616('0x19'))['db'];function respondWithStatusCode(_0x28d921,_0x14dc00){_0x14dc00=_0x14dc00||0xcc;return function(_0x4ea2cf){if(_0x4ea2cf){return _0x28d921[_0x7616('0x1a')](_0x14dc00);}return _0x28d921[_0x7616('0x1b')](_0x14dc00)[_0x7616('0x1c')]();};}function respondWithResult(_0x391f32,_0x37d332){_0x37d332=_0x37d332||0xc8;return function(_0xdcbc71){if(_0xdcbc71){return _0x391f32[_0x7616('0x1b')](_0x37d332)[_0x7616('0x1d')](_0xdcbc71);}};}function respondWithFilteredResult(_0x38914b,_0x32810c){return function(_0x3e9b12){if(_0x3e9b12){var _0x4ce01a=typeof _0x32810c[_0x7616('0x1e')]===_0x7616('0x1f')&&typeof _0x32810c[_0x7616('0x20')]===_0x7616('0x1f');var _0x557c3b=_0x3e9b12[_0x7616('0x21')];var _0x3d09f7=_0x4ce01a?0x0:_0x32810c['offset'];var _0x1be275=_0x4ce01a?_0x3e9b12['count']:_0x32810c[_0x7616('0x1e')]+_0x32810c['limit'];var _0x1cc446;if(_0x1be275>=_0x557c3b){_0x1be275=_0x557c3b;_0x1cc446=0xc8;}else{_0x1cc446=0xce;}_0x38914b[_0x7616('0x1b')](_0x1cc446);return _0x38914b['set'](_0x7616('0x22'),_0x3d09f7+'-'+_0x1be275+'/'+_0x557c3b)[_0x7616('0x1d')](_0x3e9b12);}return null;};}function patchUpdates(_0x1d6dd7){return function(_0x27a61a){try{jsonpatch['apply'](_0x27a61a,_0x1d6dd7,!![]);}catch(_0x8bffc7){return BPromise[_0x7616('0x23')](_0x8bffc7);}return _0x27a61a[_0x7616('0x24')]();};}function saveUpdates(_0x54b59f,_0x3ea462){return function(_0x2ef72f){if(_0x2ef72f){return _0x2ef72f[_0x7616('0x25')](_0x54b59f)[_0x7616('0x26')](function(_0xf93728){return _0xf93728;});}return null;};}function removeEntity(_0x700338,_0x40238b){return function(_0x2f12aa){if(_0x2f12aa){return _0x2f12aa[_0x7616('0x27')]()['then'](function(){_0x700338['status'](0xcc)[_0x7616('0x1c')]();});}};}function handleEntityNotFound(_0x2e1a3f,_0x40dcb7){return function(_0xd9cc5c){if(!_0xd9cc5c){_0x2e1a3f[_0x7616('0x1a')](0x194);}return _0xd9cc5c;};}function handleError(_0xf5742e,_0x4e9ec5){_0x4e9ec5=_0x4e9ec5||0x1f4;return function(_0xdd4ffb){logger[_0x7616('0x28')](_0xdd4ffb[_0x7616('0x29')]);if(_0xdd4ffb[_0x7616('0x2a')]){delete _0xdd4ffb[_0x7616('0x2a')];}_0xf5742e[_0x7616('0x1b')](_0x4e9ec5)[_0x7616('0x2b')](_0xdd4ffb);};}exports[_0x7616('0x2c')]=function(_0x4e0890,_0x22d1bf){var _0x78ef9={},_0x21e608={},_0x55b1c9={'count':0x0,'rows':[]};var _0x23ddff=_[_0x7616('0x2d')](db['SugarcrmField'][_0x7616('0x2e')],function(_0x33c0fb){return{'name':_0x33c0fb['fieldName'],'type':_0x33c0fb[_0x7616('0x2f')][_0x7616('0x30')]};});_0x21e608[_0x7616('0x31')]=_['map'](_0x23ddff,_0x7616('0x2a'));_0x21e608[_0x7616('0x32')]=_['keys'](_0x4e0890['query']);_0x21e608[_0x7616('0x33')]=_['intersection'](_0x21e608['model'],_0x21e608[_0x7616('0x32')]);_0x78ef9[_0x7616('0x34')]=_[_0x7616('0x35')](_0x21e608[_0x7616('0x31')],qs['fields'](_0x4e0890['query'][_0x7616('0x36')]));_0x78ef9[_0x7616('0x34')]=_0x78ef9[_0x7616('0x34')][_0x7616('0x37')]?_0x78ef9['attributes']:_0x21e608[_0x7616('0x31')];if(!_0x4e0890[_0x7616('0x32')][_0x7616('0x38')](_0x7616('0x39'))){_0x78ef9['limit']=qs[_0x7616('0x20')](_0x4e0890[_0x7616('0x32')][_0x7616('0x20')]);_0x78ef9[_0x7616('0x1e')]=qs[_0x7616('0x1e')](_0x4e0890[_0x7616('0x32')]['offset']);}_0x78ef9[_0x7616('0x3a')]=qs[_0x7616('0x3b')](_0x4e0890['query']['sort']);_0x78ef9['where']=qs[_0x7616('0x33')](_[_0x7616('0x3c')](_0x4e0890['query'],_0x21e608['filters']),_0x23ddff);if(_0x4e0890[_0x7616('0x32')][_0x7616('0x3d')]){_0x78ef9[_0x7616('0x3e')]=_[_0x7616('0x3f')](_0x78ef9[_0x7616('0x3e')],{'$or':_[_0x7616('0x2d')](_0x23ddff,function(_0x1e87a6){if(_0x1e87a6[_0x7616('0x2f')]!==_0x7616('0x40')){var _0x4438f8={};_0x4438f8[_0x1e87a6[_0x7616('0x2a')]]={'$like':'%'+_0x4e0890[_0x7616('0x32')][_0x7616('0x3d')]+'%'};return _0x4438f8;}})});}_0x78ef9=_[_0x7616('0x3f')]({},_0x78ef9,_0x4e0890[_0x7616('0x41')]);var _0x4050de={'where':_0x78ef9[_0x7616('0x3e')]};return db[_0x7616('0x42')][_0x7616('0x21')](_0x4050de)[_0x7616('0x26')](function(_0x4ca8dd){_0x55b1c9['count']=_0x4ca8dd;if(_0x4e0890['query'][_0x7616('0x43')]){_0x78ef9['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x7616('0x44')](_0x78ef9);})[_0x7616('0x26')](function(_0x939eb5){_0x55b1c9[_0x7616('0x45')]=_0x939eb5;return _0x55b1c9;})[_0x7616('0x26')](respondWithFilteredResult(_0x22d1bf,_0x78ef9))[_0x7616('0x46')](handleError(_0x22d1bf,null));};exports[_0x7616('0x47')]=function(_0x4d8416,_0x42a531){var _0x52c45c={'raw':!![],'where':{'id':_0x4d8416['params']['id']}},_0x3f2f00={};_0x3f2f00[_0x7616('0x31')]=_[_0x7616('0x48')](db[_0x7616('0x42')][_0x7616('0x2e')]);_0x3f2f00[_0x7616('0x32')]=_['keys'](_0x4d8416[_0x7616('0x32')]);_0x3f2f00[_0x7616('0x33')]=_['intersection'](_0x3f2f00['model'],_0x3f2f00[_0x7616('0x32')]);_0x52c45c[_0x7616('0x34')]=_[_0x7616('0x35')](_0x3f2f00[_0x7616('0x31')],qs[_0x7616('0x36')](_0x4d8416[_0x7616('0x32')]['fields']));_0x52c45c[_0x7616('0x34')]=_0x52c45c[_0x7616('0x34')][_0x7616('0x37')]?_0x52c45c[_0x7616('0x34')]:_0x3f2f00[_0x7616('0x31')];if(_0x4d8416[_0x7616('0x32')]['includeAll']){_0x52c45c[_0x7616('0x49')]=[{'all':!![]}];}_0x52c45c=_['merge']({},_0x52c45c,_0x4d8416['options']);return db['SugarcrmField'][_0x7616('0x4a')](_0x52c45c)[_0x7616('0x26')](handleEntityNotFound(_0x42a531,null))['then'](respondWithResult(_0x42a531,null))['catch'](handleError(_0x42a531,null));};exports[_0x7616('0x4b')]=function(_0x528f84,_0x2cd51a){return db[_0x7616('0x42')][_0x7616('0x4b')](_0x528f84['body'],{})[_0x7616('0x26')](respondWithResult(_0x2cd51a,0xc9))['catch'](handleError(_0x2cd51a,null));};exports[_0x7616('0x25')]=function(_0x3a39fe,_0x1e2575){if(_0x3a39fe['body']['id']){delete _0x3a39fe[_0x7616('0x4c')]['id'];}return db[_0x7616('0x42')][_0x7616('0x4a')]({'where':{'id':_0x3a39fe[_0x7616('0x4d')]['id']}})[_0x7616('0x26')](handleEntityNotFound(_0x1e2575,null))['then'](saveUpdates(_0x3a39fe[_0x7616('0x4c')],null))[_0x7616('0x26')](respondWithResult(_0x1e2575,null))[_0x7616('0x46')](handleError(_0x1e2575,null));};exports['destroy']=function(_0x3b59a1,_0x5e7225){return db[_0x7616('0x42')][_0x7616('0x4a')]({'where':{'id':_0x3b59a1[_0x7616('0x4d')]['id']}})[_0x7616('0x26')](handleEntityNotFound(_0x5e7225,null))[_0x7616('0x26')](removeEntity(_0x5e7225,null))[_0x7616('0x46')](handleError(_0x5e7225,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 1dedc8e..babd80d 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 _0x6c82=['define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./intSugarcrmField.attributes','exports'];(function(_0x2c0278,_0x1e4b63){var _0x34dd90=function(_0x768af5){while(--_0x768af5){_0x2c0278['push'](_0x2c0278['shift']());}};_0x34dd90(++_0x1e4b63);}(_0x6c82,0x1d3));var _0x26c8=function(_0x2c7c93,_0x297b4d){_0x2c7c93=_0x2c7c93-0x0;var _0xf99c2d=_0x6c82[_0x2c7c93];return _0xf99c2d;};'use strict';var _=require(_0x26c8('0x0'));var util=require(_0x26c8('0x1'));var logger=require(_0x26c8('0x2'))(_0x26c8('0x3'));var moment=require(_0x26c8('0x4'));var BPromise=require('bluebird');var rp=require(_0x26c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x26c8('0x6'));var config=require('../../config/environment');var attributes=require(_0x26c8('0x7'));module[_0x26c8('0x8')]=function(_0x3c4370,_0x346f86){return _0x3c4370[_0x26c8('0x9')]('SugarcrmField',attributes,{'tableName':_0x26c8('0xa'),'paranoid':![],'indexes':[{'name':_0x26c8('0xb'),'fields':[_0x26c8('0xc'),_0x26c8('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1c2=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','idField'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0xb1c2,0x97));var _0x2b1c=function(_0x1162f9,_0x35f87c){_0x1162f9=_0x1162f9-0x0;var _0x75257c=_0xb1c2[_0x1162f9];return _0x75257c;};'use strict';var _=require(_0x2b1c('0x0'));var util=require(_0x2b1c('0x1'));var logger=require('../../config/logger')(_0x2b1c('0x2'));var moment=require(_0x2b1c('0x3'));var BPromise=require(_0x2b1c('0x4'));var rp=require(_0x2b1c('0x5'));var fs=require('fs');var path=require(_0x2b1c('0x6'));var rimraf=require(_0x2b1c('0x7'));var config=require(_0x2b1c('0x8'));var attributes=require(_0x2b1c('0x9'));module[_0x2b1c('0xa')]=function(_0x3dd1e4,_0x5c7f87){return _0x3dd1e4['define'](_0x2b1c('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x2b1c('0xc'),'fields':[_0x2b1c('0xd'),_0x2b1c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 8c0072e..3005bd4 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 _0x13c7=['bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x13c7,0x1ca));var _0x713c=function(_0x28d079,_0x1b4734){_0x28d079=_0x28d079-0x0;var _0x5601eb=_0x13c7[_0x28d079];return _0x5601eb;};'use strict';var _=require(_0x713c('0x0'));var util=require('util');var moment=require(_0x713c('0x1'));var BPromise=require(_0x713c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x713c('0x3'));var logger=require(_0x713c('0x4'))(_0x713c('0x5'));var config=require(_0x713c('0x6'));var jayson=require(_0x713c('0x7'));var client=jayson[_0x713c('0x8')][_0x713c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x439af5,_0x522006,_0x208745){return new BPromise(function(_0x58ec90,_0x29ef64){return client[_0x713c('0xa')](_0x439af5,_0x208745)[_0x713c('0xb')](function(_0x902dad){logger[_0x713c('0xc')](_0x713c('0xd'),_0x522006,_0x713c('0xe'));logger[_0x713c('0xf')](_0x713c('0x10'),_0x522006,_0x713c('0xe'),JSON['stringify'](_0x902dad));if(_0x902dad[_0x713c('0x11')]){if(_0x902dad[_0x713c('0x11')][_0x713c('0x12')]===0x1f4){logger[_0x713c('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x522006,_0x902dad[_0x713c('0x11')][_0x713c('0x13')]);return _0x29ef64(_0x902dad[_0x713c('0x11')][_0x713c('0x13')]);}logger[_0x713c('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x522006,_0x902dad['error'][_0x713c('0x13')]);return _0x58ec90(_0x902dad[_0x713c('0x11')][_0x713c('0x13')]);}else{logger[_0x713c('0xc')](_0x713c('0xd'),_0x522006,_0x713c('0xe'));_0x58ec90(_0x902dad['result']['message']);}})['catch'](function(_0xe21088){logger[_0x713c('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x522006,_0xe21088);_0x29ef64(_0xe21088);});});} \ No newline at end of file +var _0xe27f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x1c2546,_0x2a23fe){var _0x90ab17=function(_0x172dbf){while(--_0x172dbf){_0x1c2546['push'](_0x1c2546['shift']());}};_0x90ab17(++_0x2a23fe);}(_0xe27f,0xe6));var _0xfe27=function(_0x2f20f0,_0x348fec){_0x2f20f0=_0x2f20f0-0x0;var _0x22c7cf=_0xe27f[_0x2f20f0];return _0x22c7cf;};'use strict';var _=require(_0xfe27('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfe27('0x1'));var rs=require(_0xfe27('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe27('0x3'))['db'];var utils=require(_0xfe27('0x4'));var logger=require(_0xfe27('0x5'))('rpc');var config=require(_0xfe27('0x6'));var jayson=require(_0xfe27('0x7'));var client=jayson[_0xfe27('0x8')][_0xfe27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3788b1,_0x20a238,_0x56d2b4){return new BPromise(function(_0x1148d3,_0x5cb6cb){return client[_0xfe27('0xa')](_0x3788b1,_0x56d2b4)['then'](function(_0x4c6d43){logger[_0xfe27('0xb')](_0xfe27('0xc'),_0x20a238,_0xfe27('0xd'));logger[_0xfe27('0xe')](_0xfe27('0xf'),_0x20a238,'request\x20sent',JSON['stringify'](_0x4c6d43));if(_0x4c6d43[_0xfe27('0x10')]){if(_0x4c6d43[_0xfe27('0x10')][_0xfe27('0x11')]===0x1f4){logger[_0xfe27('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x20a238,_0x4c6d43[_0xfe27('0x10')][_0xfe27('0x12')]);return _0x5cb6cb(_0x4c6d43[_0xfe27('0x10')][_0xfe27('0x12')]);}logger[_0xfe27('0x10')](_0xfe27('0xc'),_0x20a238,_0x4c6d43[_0xfe27('0x10')]['message']);return _0x1148d3(_0x4c6d43[_0xfe27('0x10')][_0xfe27('0x12')]);}else{logger[_0xfe27('0xb')](_0xfe27('0xc'),_0x20a238,_0xfe27('0xd'));_0x1148d3(_0x4c6d43[_0xfe27('0x13')][_0xfe27('0x12')]);}})[_0xfe27('0x14')](function(_0x37c754){logger[_0xfe27('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x20a238,_0x37c754);_0x5cb6cb(_0x37c754);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 8ec2552..7696587 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 _0xc298=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xc298,0x143));var _0x8c29=function(_0x13b88b,_0x35adaf){_0x13b88b=_0x13b88b-0x0;var _0x5e89ff=_0xc298[_0x13b88b];return _0x5e89ff;};'use strict';var multer=require('multer');var util=require(_0x8c29('0x0'));var path=require(_0x8c29('0x1'));var timeout=require(_0x8c29('0x2'));var express=require(_0x8c29('0x3'));var router=express[_0x8c29('0x4')]();var fs_extra=require(_0x8c29('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8c29('0x6'));var config=require(_0x8c29('0x7'));var controller=require(_0x8c29('0x8'));router[_0x8c29('0x9')]('/',auth[_0x8c29('0xa')](),controller['index']);router[_0x8c29('0x9')](_0x8c29('0xb'),auth[_0x8c29('0xa')](),controller[_0x8c29('0xc')]);router[_0x8c29('0x9')](_0x8c29('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x8c29('0xe'),auth[_0x8c29('0xa')](),controller[_0x8c29('0xf')]);router[_0x8c29('0x10')]('/',auth[_0x8c29('0xa')](),controller[_0x8c29('0x11')]);router[_0x8c29('0x10')](_0x8c29('0xd'),auth[_0x8c29('0xa')](),controller[_0x8c29('0x12')]);router[_0x8c29('0x13')](_0x8c29('0xb'),auth[_0x8c29('0xa')](),controller[_0x8c29('0x14')]);router[_0x8c29('0x15')](_0x8c29('0xb'),auth['isAuthenticated'](),controller[_0x8c29('0x16')]);module[_0x8c29('0x17')]=router; \ No newline at end of file +var _0xe739=['/:id','show','/:id/configurations','isAuthenticated','getConfigurations','post','put','update','destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index'];(function(_0x3b6fa9,_0x91a3b1){var _0x26621c=function(_0x4e19c7){while(--_0x4e19c7){_0x3b6fa9['push'](_0x3b6fa9['shift']());}};_0x26621c(++_0x91a3b1);}(_0xe739,0x105));var _0x9e73=function(_0x536cb8,_0x27997f){_0x536cb8=_0x536cb8-0x0;var _0x733a0d=_0xe739[_0x536cb8];return _0x733a0d;};'use strict';var multer=require(_0x9e73('0x0'));var util=require('util');var path=require(_0x9e73('0x1'));var timeout=require(_0x9e73('0x2'));var express=require(_0x9e73('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9e73('0x4'));var config=require(_0x9e73('0x5'));var controller=require(_0x9e73('0x6'));router[_0x9e73('0x7')]('/',auth['isAuthenticated'](),controller[_0x9e73('0x8')]);router[_0x9e73('0x7')](_0x9e73('0x9'),auth['isAuthenticated'](),controller[_0x9e73('0xa')]);router[_0x9e73('0x7')](_0x9e73('0xb'),auth[_0x9e73('0xc')](),controller[_0x9e73('0xd')]);router[_0x9e73('0x7')]('/:id/fields',auth[_0x9e73('0xc')](),controller['getFields']);router['post']('/',auth[_0x9e73('0xc')](),controller['create']);router[_0x9e73('0xe')](_0x9e73('0xb'),auth[_0x9e73('0xc')](),controller['addConfiguration']);router[_0x9e73('0xf')](_0x9e73('0x9'),auth[_0x9e73('0xc')](),controller[_0x9e73('0x10')]);router['delete'](_0x9e73('0x9'),auth[_0x9e73('0xc')](),controller[_0x9e73('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d641e53..104b5ca 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 _0x359e=['sequelize','STRING'];(function(_0x321ad4,_0x4b17ce){var _0xe2f490=function(_0x4f27ab){while(--_0x4f27ab){_0x321ad4['push'](_0x321ad4['shift']());}};_0xe2f490(++_0x4b17ce);}(_0x359e,0x1ce));var _0xe359=function(_0x23e9ae,_0xb78a99){_0x23e9ae=_0x23e9ae-0x0;var _0x744c35=_0x359e[_0x23e9ae];return _0x744c35;};'use strict';var Sequelize=require(_0xe359('0x0'));module['exports']={'name':{'type':Sequelize[_0xe359('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe359('0x1')]},'username':{'type':Sequelize[_0xe359('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe359('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xe359('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe359('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd9e9=['HelpDesk','sequelize','exports','STRING'];(function(_0x8999f1,_0x2bef0a){var _0x574ced=function(_0x52d3b7){while(--_0x52d3b7){_0x8999f1['push'](_0x8999f1['shift']());}};_0x574ced(++_0x2bef0a);}(_0xd9e9,0x131));var _0x9d9e=function(_0x578056,_0x171bc3){_0x578056=_0x578056-0x0;var _0x5ae470=_0xd9e9[_0x578056];return _0x5ae470;};'use strict';var Sequelize=require(_0x9d9e('0x0'));module[_0x9d9e('0x1')]={'name':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![],'defaultValue':_0x9d9e('0x3')},'remoteUri':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index fbb7cd3..e44f069 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 _0x9656=['autogenerated','reference','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','VtigerAccount','rawAttributes','type','key','model','map','query','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','intersection','length','includeAll','options','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','moduleName','remoteUri','serverUrl','username','accessKey','slice','substring','success','login','result','token','GET','describe'];(function(_0x215c73,_0x272244){var _0x3287b2=function(_0x59c9bc){while(--_0x59c9bc){_0x215c73['push'](_0x215c73['shift']());}};_0x3287b2(++_0x272244);}(_0x9656,0x8d));var _0x6965=function(_0x2f5d1e,_0x1c6993){_0x2f5d1e=_0x2f5d1e-0x0;var _0x33760c=_0x9656[_0x2f5d1e];return _0x33760c;};'use strict';var emlformat=require(_0x6965('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6965('0x1'));var jsonpatch=require(_0x6965('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6965('0x3'));var Mustache=require(_0x6965('0x4'));var util=require(_0x6965('0x5'));var path=require(_0x6965('0x6'));var sox=require(_0x6965('0x7'));var csv=require(_0x6965('0x8'));var ejs=require(_0x6965('0x9'));var fs=require('fs');var fs_extra=require(_0x6965('0xa'));var _=require(_0x6965('0xb'));var squel=require('squel');var crypto=require(_0x6965('0xc'));var jsforce=require(_0x6965('0xd'));var deskjs=require(_0x6965('0xe'));var toCsv=require(_0x6965('0x8'));var querystring=require(_0x6965('0xf'));var Papa=require('papaparse');var Redis=require(_0x6965('0x10'));var authService=require(_0x6965('0x11'));var qs=require(_0x6965('0x12'));var as=require(_0x6965('0x13'));var hardwareService=require(_0x6965('0x14'));var logger=require(_0x6965('0x15'))(_0x6965('0x16'));var utils=require(_0x6965('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6965('0x18'));var db=require(_0x6965('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59577e,_0x5cfd93){_0x5cfd93=_0x5cfd93||0xcc;return function(_0x12b8b9){if(_0x12b8b9){return _0x59577e[_0x6965('0x1a')](_0x5cfd93);}return _0x59577e[_0x6965('0x1b')](_0x5cfd93)[_0x6965('0x1c')]();};}function respondWithResult(_0x1aefd4,_0x15780d){_0x15780d=_0x15780d||0xc8;return function(_0x3390c5){if(_0x3390c5){return _0x1aefd4[_0x6965('0x1b')](_0x15780d)[_0x6965('0x1d')](_0x3390c5);}};}function respondWithFilteredResult(_0x8ac2a3,_0x203806){return function(_0x69f31e){if(_0x69f31e){var _0x3e2ea9=typeof _0x203806[_0x6965('0x1e')]===_0x6965('0x1f')&&typeof _0x203806[_0x6965('0x20')]===_0x6965('0x1f');var _0x46e7af=_0x69f31e[_0x6965('0x21')];var _0x460852=_0x3e2ea9?0x0:_0x203806['offset'];var _0x5a62ba=_0x3e2ea9?_0x69f31e['count']:_0x203806[_0x6965('0x1e')]+_0x203806[_0x6965('0x20')];var _0x9b0380;if(_0x5a62ba>=_0x46e7af){_0x5a62ba=_0x46e7af;_0x9b0380=0xc8;}else{_0x9b0380=0xce;}_0x8ac2a3['status'](_0x9b0380);return _0x8ac2a3[_0x6965('0x22')](_0x6965('0x23'),_0x460852+'-'+_0x5a62ba+'/'+_0x46e7af)[_0x6965('0x1d')](_0x69f31e);}return null;};}function patchUpdates(_0xf29b61){return function(_0x32a427){try{jsonpatch[_0x6965('0x24')](_0x32a427,_0xf29b61,!![]);}catch(_0x465050){return BPromise[_0x6965('0x25')](_0x465050);}return _0x32a427[_0x6965('0x26')]();};}function saveUpdates(_0x889a20,_0x5e8acc){return function(_0x1a0429){if(_0x1a0429){return _0x1a0429[_0x6965('0x27')](_0x889a20)[_0x6965('0x28')](function(_0x43ae7f){return _0x43ae7f;});}return null;};}function removeEntity(_0x16f174,_0x10091a){return function(_0x3ad86d){if(_0x3ad86d){return _0x3ad86d[_0x6965('0x29')]()[_0x6965('0x28')](function(){_0x16f174[_0x6965('0x1b')](0xcc)[_0x6965('0x1c')]();});}};}function handleEntityNotFound(_0x57c39d,_0x5243e0){return function(_0x1cfe06){if(!_0x1cfe06){_0x57c39d[_0x6965('0x1a')](0x194);}return _0x1cfe06;};}function handleError(_0x80c76f,_0x43cc8a){_0x43cc8a=_0x43cc8a||0x1f4;return function(_0x460a7f){logger['error'](_0x460a7f[_0x6965('0x2a')]);if(_0x460a7f[_0x6965('0x2b')]){delete _0x460a7f[_0x6965('0x2b')];}_0x80c76f['status'](_0x43cc8a)[_0x6965('0x2c')](_0x460a7f);};}exports[_0x6965('0x2d')]=function(_0x4a6bfd,_0x3157cb){var _0x34c253={},_0x5d6420={},_0x211332={'count':0x0,'rows':[]};var _0x117281=_['map'](db[_0x6965('0x2e')][_0x6965('0x2f')],function(_0x30c507){return{'name':_0x30c507['fieldName'],'type':_0x30c507[_0x6965('0x30')][_0x6965('0x31')]};});_0x5d6420[_0x6965('0x32')]=_[_0x6965('0x33')](_0x117281,_0x6965('0x2b'));_0x5d6420[_0x6965('0x34')]=_['keys'](_0x4a6bfd[_0x6965('0x34')]);_0x5d6420[_0x6965('0x35')]=_['intersection'](_0x5d6420[_0x6965('0x32')],_0x5d6420[_0x6965('0x34')]);_0x34c253[_0x6965('0x36')]=_['intersection'](_0x5d6420[_0x6965('0x32')],qs[_0x6965('0x37')](_0x4a6bfd[_0x6965('0x34')][_0x6965('0x37')]));_0x34c253[_0x6965('0x36')]=_0x34c253[_0x6965('0x36')]['length']?_0x34c253['attributes']:_0x5d6420['model'];if(!_0x4a6bfd[_0x6965('0x34')]['hasOwnProperty'](_0x6965('0x38'))){_0x34c253[_0x6965('0x20')]=qs[_0x6965('0x20')](_0x4a6bfd[_0x6965('0x34')][_0x6965('0x20')]);_0x34c253['offset']=qs[_0x6965('0x1e')](_0x4a6bfd[_0x6965('0x34')][_0x6965('0x1e')]);}_0x34c253['order']=qs[_0x6965('0x39')](_0x4a6bfd[_0x6965('0x34')][_0x6965('0x39')]);_0x34c253[_0x6965('0x3a')]=qs['filters'](_[_0x6965('0x3b')](_0x4a6bfd[_0x6965('0x34')],_0x5d6420['filters']),_0x117281);if(_0x4a6bfd[_0x6965('0x34')][_0x6965('0x3c')]){_0x34c253[_0x6965('0x3a')]=_[_0x6965('0x3d')](_0x34c253[_0x6965('0x3a')],{'$or':_[_0x6965('0x33')](_0x117281,function(_0xd729f8){if(_0xd729f8[_0x6965('0x30')]!==_0x6965('0x3e')){var _0x1281ee={};_0x1281ee[_0xd729f8[_0x6965('0x2b')]]={'$like':'%'+_0x4a6bfd[_0x6965('0x34')]['filter']+'%'};return _0x1281ee;}})});}_0x34c253=_[_0x6965('0x3d')]({},_0x34c253,_0x4a6bfd['options']);var _0xb1d7e2={'where':_0x34c253[_0x6965('0x3a')]};return db['VtigerAccount'][_0x6965('0x21')](_0xb1d7e2)[_0x6965('0x28')](function(_0x2aedb6){_0x211332['count']=_0x2aedb6;if(_0x4a6bfd[_0x6965('0x34')]['includeAll']){_0x34c253[_0x6965('0x3f')]=[{'all':!![]}];}return db[_0x6965('0x2e')][_0x6965('0x40')](_0x34c253);})[_0x6965('0x28')](function(_0x570ff2){_0x211332[_0x6965('0x41')]=_0x570ff2;return _0x211332;})[_0x6965('0x28')](respondWithFilteredResult(_0x3157cb,_0x34c253))[_0x6965('0x42')](handleError(_0x3157cb,null));};exports[_0x6965('0x43')]=function(_0x5a1c06,_0x29aa91){var _0x49d912={'raw':![],'where':{'id':_0x5a1c06[_0x6965('0x44')]['id']}},_0x524472={};_0x524472[_0x6965('0x32')]=_['keys'](db['VtigerAccount'][_0x6965('0x2f')]);_0x524472[_0x6965('0x34')]=_[_0x6965('0x45')](_0x5a1c06[_0x6965('0x34')]);_0x524472['filters']=_['intersection'](_0x524472[_0x6965('0x32')],_0x524472[_0x6965('0x34')]);_0x49d912['attributes']=_[_0x6965('0x46')](_0x524472['model'],qs['fields'](_0x5a1c06[_0x6965('0x34')][_0x6965('0x37')]));_0x49d912[_0x6965('0x36')]=_0x49d912['attributes'][_0x6965('0x47')]?_0x49d912['attributes']:_0x524472[_0x6965('0x32')];if(_0x5a1c06[_0x6965('0x34')][_0x6965('0x48')]){_0x49d912[_0x6965('0x3f')]=[{'all':!![]}];}_0x49d912=_['merge']({},_0x49d912,_0x5a1c06[_0x6965('0x49')]);return db['VtigerAccount'][_0x6965('0x4a')](_0x49d912)[_0x6965('0x28')](handleEntityNotFound(_0x29aa91,null))['then'](respondWithResult(_0x29aa91,null))['catch'](handleError(_0x29aa91,null));};exports[_0x6965('0x4b')]=function(_0x1a53c,_0x24c1bb){return db[_0x6965('0x2e')]['create'](_0x1a53c[_0x6965('0x4c')],{})[_0x6965('0x28')](respondWithResult(_0x24c1bb,0xc9))[_0x6965('0x42')](handleError(_0x24c1bb,null));};exports[_0x6965('0x27')]=function(_0x2922db,_0x5cb372){if(_0x2922db['body']['id']){delete _0x2922db['body']['id'];}return db[_0x6965('0x2e')][_0x6965('0x4a')]({'where':{'id':_0x2922db['params']['id']}})[_0x6965('0x28')](handleEntityNotFound(_0x5cb372,null))[_0x6965('0x28')](saveUpdates(_0x2922db[_0x6965('0x4c')],null))['then'](respondWithResult(_0x5cb372,null))[_0x6965('0x42')](handleError(_0x5cb372,null));};exports['destroy']=function(_0x193161,_0x56ac54){return db[_0x6965('0x2e')][_0x6965('0x4a')]({'where':{'id':_0x193161['params']['id']}})[_0x6965('0x28')](handleEntityNotFound(_0x56ac54,null))['then'](removeEntity(_0x56ac54,null))[_0x6965('0x42')](handleError(_0x56ac54,null));};exports[_0x6965('0x4d')]=function(_0x557ca9,_0x2a51e7,_0x4e70fc){var _0x2b5c4e={};var _0x1f060c={};var _0x5e273d;var _0x2df5eb;return db['VtigerAccount'][_0x6965('0x4e')]({'where':{'id':_0x557ca9['params']['id']}})[_0x6965('0x28')](handleEntityNotFound(_0x2a51e7,null))[_0x6965('0x28')](function(_0x4ae738){if(_0x4ae738){_0x5e273d=_0x4ae738;_0x1f060c[_0x6965('0x32')]=_['keys'](db[_0x6965('0x4f')]['rawAttributes']);_0x1f060c[_0x6965('0x34')]=_['keys'](_0x557ca9[_0x6965('0x34')]);_0x1f060c[_0x6965('0x35')]=_[_0x6965('0x46')](_0x1f060c['model'],_0x1f060c[_0x6965('0x34')]);_0x2b5c4e['attributes']=_[_0x6965('0x46')](_0x1f060c['model'],qs[_0x6965('0x37')](_0x557ca9[_0x6965('0x34')]['fields']));_0x2b5c4e[_0x6965('0x36')]=_0x2b5c4e[_0x6965('0x36')][_0x6965('0x47')]?_0x2b5c4e[_0x6965('0x36')]:_0x1f060c[_0x6965('0x32')];_0x2b5c4e[_0x6965('0x50')]=qs[_0x6965('0x39')](_0x557ca9[_0x6965('0x34')]['sort']);_0x2b5c4e[_0x6965('0x3a')]=qs[_0x6965('0x35')](_[_0x6965('0x3b')](_0x557ca9[_0x6965('0x34')],_0x1f060c[_0x6965('0x35')]));if(_0x557ca9[_0x6965('0x34')]['filter']){_0x2b5c4e[_0x6965('0x3a')]=_[_0x6965('0x3d')](_0x2b5c4e[_0x6965('0x3a')],{'$or':_[_0x6965('0x33')](_0x2b5c4e[_0x6965('0x36')],function(_0x5bee10){var _0x5b3fce={};_0x5b3fce[_0x5bee10]={'$like':'%'+_0x557ca9[_0x6965('0x34')][_0x6965('0x3c')]+'%'};return _0x5b3fce;})});}_0x2b5c4e=_[_0x6965('0x3d')]({},_0x2b5c4e,_0x557ca9[_0x6965('0x49')]);return _0x5e273d[_0x6965('0x4d')](_0x2b5c4e);}})['then'](function(_0x1de88b){if(_0x1de88b){_0x2df5eb=_0x1de88b[_0x6965('0x47')];if(!_0x557ca9[_0x6965('0x34')][_0x6965('0x51')](_0x6965('0x38'))){_0x2b5c4e[_0x6965('0x20')]=qs[_0x6965('0x20')](_0x557ca9['query'][_0x6965('0x20')]);_0x2b5c4e['offset']=qs[_0x6965('0x1e')](_0x557ca9[_0x6965('0x34')][_0x6965('0x1e')]);}return _0x5e273d['getConfigurations'](_0x2b5c4e);}})['then'](function(_0xc76825){if(_0xc76825){return _0xc76825?{'count':_0x2df5eb,'rows':_0xc76825}:null;}})[_0x6965('0x28')](respondWithResult(_0x2a51e7,null))[_0x6965('0x42')](handleError(_0x2a51e7,null));};exports[_0x6965('0x52')]=function(_0x4398d9,_0x49a154,_0x210bfd){if(_0x4398d9[_0x6965('0x4c')]['id']){delete _0x4398d9['body']['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x4398d9['params']['id']}})[_0x6965('0x28')](handleEntityNotFound(_0x49a154,null))['then'](function(_0x6ae121){if(_0x6ae121){_0x4398d9[_0x6965('0x4c')]['AccountId']=_0x6ae121['id'];_0x4398d9[_0x6965('0x4c')][_0x6965('0x53')]=integrations[_0x6965('0x54')](_0x4398d9['body'][_0x6965('0x55')],_0x4398d9['body'][_0x6965('0x30')]);_0x4398d9[_0x6965('0x4c')][_0x6965('0x56')]=integrations['getDescriptions'](_0x4398d9['body']['channel'],_0x4398d9[_0x6965('0x4c')][_0x6965('0x30')]);return db[_0x6965('0x4f')][_0x6965('0x4b')](_0x4398d9[_0x6965('0x4c')],{'include':[{'model':db[_0x6965('0x57')],'as':_0x6965('0x53')},{'model':db[_0x6965('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x49a154,null))[_0x6965('0x42')](handleError(_0x49a154,null));};var md5=require(_0x6965('0x58'));exports[_0x6965('0x59')]=function(_0x3734b0,_0x582280,_0x3c6a85){var _0x2a4983=null;var _0x34553d=null;var _0x5731c1=null;var _0x4c59f2=null;var _0x5d4b28='';return db[_0x6965('0x2e')][_0x6965('0x4e')]({'where':{'id':_0x3734b0['params']['id']},'attributes':['id',_0x6965('0x2b'),'username','description',_0x6965('0x5a'),_0x6965('0x5b'),_0x6965('0x5c'),'accessKey']})[_0x6965('0x28')](handleEntityNotFound(_0x582280,null))[_0x6965('0x28')](function(_0x598648){if(_0x598648){_0x2a4983=_0x598648[_0x6965('0x5d')];_0x34553d=_0x598648[_0x6965('0x5e')];_0x5731c1=_0x598648[_0x6965('0x5a')];_0x5d4b28=_0x598648[_0x6965('0x5b')];var _0x5d68b4=_0x5d4b28[_0x6965('0x5f')](-0x1);if(_0x5d68b4==='/'){_0x5d4b28=_0x5d4b28[_0x6965('0x60')](0x0,_0x5d4b28['lastIndexOf'](_0x5d68b4));}_0x4c59f2=util['format']('%s/webservice.php',_0x5d4b28);var _0x7e7fe={'method':'GET','uri':_0x4c59f2,'qs':{'operation':'getchallenge','username':_0x598648['username']},'json':!![]};return rp(_0x7e7fe);}})[_0x6965('0x28')](function(_0x3020b7){if(_0x3020b7[_0x6965('0x61')]){var _0x5f3492={'method':'POST','uri':_0x4c59f2,'form':{'operation':_0x6965('0x62'),'username':_0x2a4983,'accessKey':md5(_0x3020b7[_0x6965('0x63')][_0x6965('0x64')]+_0x34553d)},'json':!![]};return rp(_0x5f3492);}})[_0x6965('0x28')](function(_0x35015f){if(_0x35015f['success']){var _0x3a9b6c={'method':_0x6965('0x65'),'uri':_0x4c59f2,'qs':{'operation':_0x6965('0x66'),'username':_0x2a4983,'sessionName':_0x35015f[_0x6965('0x63')]['sessionName'],'elementType':_0x5731c1},'json':!![]};return rp(_0x3a9b6c);}})['then'](function(_0x206f48){if(_0x206f48[_0x6965('0x61')]){var _0x393a1e=[_0x6965('0x67'),_0x6965('0x68'),_0x6965('0x69')];_[_0x6965('0x6a')](_0x206f48[_0x6965('0x63')][_0x6965('0x37')],function(_0x54f135){return _0x393a1e[_0x6965('0x6b')](_0x54f135['type'][_0x6965('0x2b')]);});_['remove'](_0x206f48['result'][_0x6965('0x37')],function(_0xa10527){return _0xa10527[_0x6965('0x6c')]===_0x6965('0x6d');});return{'count':_0x206f48['result']['fields']['length'],'rows':_[_0x6965('0x33')](_0x206f48['result'][_0x6965('0x37')],function(_0x41982c){return{'id':_0x41982c[_0x6965('0x2b')],'name':_0x41982c['label'],'custom':_[_0x6965('0x6e')](_0x41982c['name'],_0x6965('0x6f'))?!![]:![],'options':_0x41982c[_0x6965('0x30')]['name']===_0x6965('0x70')&&_0x41982c[_0x6965('0x30')][_0x6965('0x71')][_0x6965('0x47')]>0x0?_[_0x6965('0x33')](_0x41982c[_0x6965('0x30')]['picklistValues'],function(_0x7ca1fb){return{'name':_0x7ca1fb[_0x6965('0x72')],'value':_0x7ca1fb[_0x6965('0x73')]};}):[]};})};}})[_0x6965('0x28')](respondWithResult(_0x582280,null))['catch'](function(_0x295f60){console[_0x6965('0x74')]('vTiger\x20error:\x20'+_0x295f60);var _0x5bf8bb=_0x3734b0[_0x6965('0x34')]['test']?0x1f4:_0x295f60['statusCode']||0x1f4;logger[_0x6965('0x75')](_0x6965('0x76'),_0x6965('0x59'),_0x5bf8bb,JSON[_0x6965('0x77')](_0x295f60));delete _0x295f60[_0x6965('0x2b')];if(_0x5bf8bb===0x191){_0x5bf8bb=0x190;}_0x582280[_0x6965('0x1b')](_0x5bf8bb)[_0x6965('0x2c')](_0x3734b0['query']['test']?{'message':_0x6965('0x78'),'statusCode':_0x295f60[_0x6965('0x79')]}:_0x295f60);});}; \ No newline at end of file +var _0x6c83=['undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VtigerAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','create','body','update','find','VtigerConfiguration','getConfigurations','addConfiguration','findOne','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','substring','%s/webservice.php','GET','getchallenge','login','result','sessionName','success','autogenerated','reference','owner','remove','includes','editable','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset'];(function(_0x4ccde3,_0x38ca57){var _0x3348ac=function(_0x5433f0){while(--_0x5433f0){_0x4ccde3['push'](_0x4ccde3['shift']());}};_0x3348ac(++_0x38ca57);}(_0x6c83,0x13f));var _0x36c8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c83[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x36c8('0x0'));var rimraf=require(_0x36c8('0x1'));var zipdir=require(_0x36c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36c8('0x3'));var moment=require(_0x36c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x36c8('0x5'));var util=require(_0x36c8('0x6'));var path=require(_0x36c8('0x7'));var sox=require(_0x36c8('0x8'));var csv=require(_0x36c8('0x9'));var ejs=require(_0x36c8('0xa'));var fs=require('fs');var fs_extra=require(_0x36c8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36c8('0xc'));var deskjs=require(_0x36c8('0xd'));var toCsv=require(_0x36c8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36c8('0xe'));var qs=require(_0x36c8('0xf'));var as=require(_0x36c8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x36c8('0x11'))(_0x36c8('0x12'));var utils=require(_0x36c8('0x13'));var config=require(_0x36c8('0x14'));var licenseUtil=require(_0x36c8('0x15'));var db=require(_0x36c8('0x16'))['db'];var integrations=require(_0x36c8('0x17'));function respondWithStatusCode(_0x51b0d6,_0xa3f25b){_0xa3f25b=_0xa3f25b||0xcc;return function(_0x5529c3){if(_0x5529c3){return _0x51b0d6[_0x36c8('0x18')](_0xa3f25b);}return _0x51b0d6[_0x36c8('0x19')](_0xa3f25b)[_0x36c8('0x1a')]();};}function respondWithResult(_0x1491fe,_0x274c0c){_0x274c0c=_0x274c0c||0xc8;return function(_0x3b158b){if(_0x3b158b){return _0x1491fe['status'](_0x274c0c)[_0x36c8('0x1b')](_0x3b158b);}};}function respondWithFilteredResult(_0x3ac85e,_0x33c7bb){return function(_0xb37d88){if(_0xb37d88){var _0x1377f9=typeof _0x33c7bb[_0x36c8('0x1c')]===_0x36c8('0x1d')&&typeof _0x33c7bb['limit']===_0x36c8('0x1d');var _0x5bc988=_0xb37d88[_0x36c8('0x1e')];var _0x1f2197=_0x1377f9?0x0:_0x33c7bb['offset'];var _0x4af6ee=_0x1377f9?_0xb37d88[_0x36c8('0x1e')]:_0x33c7bb[_0x36c8('0x1c')]+_0x33c7bb[_0x36c8('0x1f')];var _0x5b5c4e;if(_0x4af6ee>=_0x5bc988){_0x4af6ee=_0x5bc988;_0x5b5c4e=0xc8;}else{_0x5b5c4e=0xce;}_0x3ac85e[_0x36c8('0x19')](_0x5b5c4e);return _0x3ac85e[_0x36c8('0x20')](_0x36c8('0x21'),_0x1f2197+'-'+_0x4af6ee+'/'+_0x5bc988)[_0x36c8('0x1b')](_0xb37d88);}return null;};}function patchUpdates(_0x5c3828){return function(_0x41059e){try{jsonpatch[_0x36c8('0x22')](_0x41059e,_0x5c3828,!![]);}catch(_0x4abb4a){return BPromise[_0x36c8('0x23')](_0x4abb4a);}return _0x41059e[_0x36c8('0x24')]();};}function saveUpdates(_0x35476d,_0x3e9c7f){return function(_0x3d3e39){if(_0x3d3e39){return _0x3d3e39['update'](_0x35476d)[_0x36c8('0x25')](function(_0x1744b9){return _0x1744b9;});}return null;};}function removeEntity(_0x4f7cf8,_0xbd79d3){return function(_0x3b3929){if(_0x3b3929){return _0x3b3929[_0x36c8('0x26')]()[_0x36c8('0x25')](function(){_0x4f7cf8[_0x36c8('0x19')](0xcc)[_0x36c8('0x1a')]();});}};}function handleEntityNotFound(_0x2497df,_0x36f7c1){return function(_0x3768b3){if(!_0x3768b3){_0x2497df[_0x36c8('0x18')](0x194);}return _0x3768b3;};}function handleError(_0x2670db,_0x331c4e){_0x331c4e=_0x331c4e||0x1f4;return function(_0x35520e){logger['error'](_0x35520e[_0x36c8('0x27')]);if(_0x35520e[_0x36c8('0x28')]){delete _0x35520e['name'];}_0x2670db['status'](_0x331c4e)[_0x36c8('0x29')](_0x35520e);};}exports[_0x36c8('0x2a')]=function(_0xa82363,_0x34e944){var _0x2b7368={},_0x158b13={},_0x57a156={'count':0x0,'rows':[]};var _0x4e21b3=_[_0x36c8('0x2b')](db[_0x36c8('0x2c')]['rawAttributes'],function(_0x143b40){return{'name':_0x143b40[_0x36c8('0x2d')],'type':_0x143b40[_0x36c8('0x2e')][_0x36c8('0x2f')]};});_0x158b13[_0x36c8('0x30')]=_[_0x36c8('0x2b')](_0x4e21b3,_0x36c8('0x28'));_0x158b13['query']=_[_0x36c8('0x31')](_0xa82363[_0x36c8('0x32')]);_0x158b13[_0x36c8('0x33')]=_[_0x36c8('0x34')](_0x158b13[_0x36c8('0x30')],_0x158b13[_0x36c8('0x32')]);_0x2b7368['attributes']=_['intersection'](_0x158b13[_0x36c8('0x30')],qs['fields'](_0xa82363[_0x36c8('0x32')]['fields']));_0x2b7368['attributes']=_0x2b7368[_0x36c8('0x35')][_0x36c8('0x36')]?_0x2b7368[_0x36c8('0x35')]:_0x158b13[_0x36c8('0x30')];if(!_0xa82363[_0x36c8('0x32')][_0x36c8('0x37')](_0x36c8('0x38'))){_0x2b7368['limit']=qs['limit'](_0xa82363[_0x36c8('0x32')][_0x36c8('0x1f')]);_0x2b7368[_0x36c8('0x1c')]=qs[_0x36c8('0x1c')](_0xa82363[_0x36c8('0x32')]['offset']);}_0x2b7368[_0x36c8('0x39')]=qs[_0x36c8('0x3a')](_0xa82363[_0x36c8('0x32')][_0x36c8('0x3a')]);_0x2b7368['where']=qs[_0x36c8('0x33')](_[_0x36c8('0x3b')](_0xa82363['query'],_0x158b13[_0x36c8('0x33')]),_0x4e21b3);if(_0xa82363['query']['filter']){_0x2b7368['where']=_[_0x36c8('0x3c')](_0x2b7368[_0x36c8('0x3d')],{'$or':_[_0x36c8('0x2b')](_0x4e21b3,function(_0x1ef01a){if(_0x1ef01a['type']!==_0x36c8('0x3e')){var _0x3b7525={};_0x3b7525[_0x1ef01a['name']]={'$like':'%'+_0xa82363[_0x36c8('0x32')][_0x36c8('0x3f')]+'%'};return _0x3b7525;}})});}_0x2b7368=_['merge']({},_0x2b7368,_0xa82363['options']);var _0x120a2f={'where':_0x2b7368[_0x36c8('0x3d')]};return db[_0x36c8('0x2c')][_0x36c8('0x1e')](_0x120a2f)[_0x36c8('0x25')](function(_0x429d0f){_0x57a156[_0x36c8('0x1e')]=_0x429d0f;if(_0xa82363[_0x36c8('0x32')]['includeAll']){_0x2b7368[_0x36c8('0x40')]=[{'all':!![]}];}return db[_0x36c8('0x2c')][_0x36c8('0x41')](_0x2b7368);})[_0x36c8('0x25')](function(_0x49eb74){_0x57a156[_0x36c8('0x42')]=_0x49eb74;return _0x57a156;})[_0x36c8('0x25')](respondWithFilteredResult(_0x34e944,_0x2b7368))[_0x36c8('0x43')](handleError(_0x34e944,null));};exports[_0x36c8('0x44')]=function(_0x20ab3a,_0x196fc5){var _0x3f24a0={'raw':![],'where':{'id':_0x20ab3a[_0x36c8('0x45')]['id']}},_0x1e2447={};_0x1e2447[_0x36c8('0x30')]=_['keys'](db[_0x36c8('0x2c')][_0x36c8('0x46')]);_0x1e2447[_0x36c8('0x32')]=_[_0x36c8('0x31')](_0x20ab3a['query']);_0x1e2447[_0x36c8('0x33')]=_[_0x36c8('0x34')](_0x1e2447[_0x36c8('0x30')],_0x1e2447[_0x36c8('0x32')]);_0x3f24a0[_0x36c8('0x35')]=_['intersection'](_0x1e2447[_0x36c8('0x30')],qs[_0x36c8('0x47')](_0x20ab3a[_0x36c8('0x32')][_0x36c8('0x47')]));_0x3f24a0[_0x36c8('0x35')]=_0x3f24a0[_0x36c8('0x35')][_0x36c8('0x36')]?_0x3f24a0['attributes']:_0x1e2447[_0x36c8('0x30')];if(_0x20ab3a[_0x36c8('0x32')][_0x36c8('0x48')]){_0x3f24a0[_0x36c8('0x40')]=[{'all':!![]}];}_0x3f24a0=_[_0x36c8('0x3c')]({},_0x3f24a0,_0x20ab3a['options']);return db[_0x36c8('0x2c')]['find'](_0x3f24a0)[_0x36c8('0x25')](handleEntityNotFound(_0x196fc5,null))[_0x36c8('0x25')](respondWithResult(_0x196fc5,null))[_0x36c8('0x43')](handleError(_0x196fc5,null));};exports[_0x36c8('0x49')]=function(_0xae5838,_0x1931fd){return db[_0x36c8('0x2c')][_0x36c8('0x49')](_0xae5838[_0x36c8('0x4a')],{})[_0x36c8('0x25')](respondWithResult(_0x1931fd,0xc9))[_0x36c8('0x43')](handleError(_0x1931fd,null));};exports[_0x36c8('0x4b')]=function(_0x570190,_0x555181){if(_0x570190[_0x36c8('0x4a')]['id']){delete _0x570190[_0x36c8('0x4a')]['id'];}return db[_0x36c8('0x2c')]['find']({'where':{'id':_0x570190[_0x36c8('0x45')]['id']}})[_0x36c8('0x25')](handleEntityNotFound(_0x555181,null))[_0x36c8('0x25')](saveUpdates(_0x570190['body'],null))[_0x36c8('0x25')](respondWithResult(_0x555181,null))['catch'](handleError(_0x555181,null));};exports[_0x36c8('0x26')]=function(_0x3ff298,_0x523cd4){return db['VtigerAccount'][_0x36c8('0x4c')]({'where':{'id':_0x3ff298[_0x36c8('0x45')]['id']}})[_0x36c8('0x25')](handleEntityNotFound(_0x523cd4,null))[_0x36c8('0x25')](removeEntity(_0x523cd4,null))[_0x36c8('0x43')](handleError(_0x523cd4,null));};exports['getConfigurations']=function(_0x772fa7,_0x5c04da,_0x78a286){var _0x1d578f={};var _0xe28265={};var _0x5765a8;var _0x1aae8f;return db['VtigerAccount']['findOne']({'where':{'id':_0x772fa7[_0x36c8('0x45')]['id']}})[_0x36c8('0x25')](handleEntityNotFound(_0x5c04da,null))[_0x36c8('0x25')](function(_0x5a2f9f){if(_0x5a2f9f){_0x5765a8=_0x5a2f9f;_0xe28265['model']=_[_0x36c8('0x31')](db[_0x36c8('0x4d')][_0x36c8('0x46')]);_0xe28265['query']=_['keys'](_0x772fa7[_0x36c8('0x32')]);_0xe28265[_0x36c8('0x33')]=_['intersection'](_0xe28265['model'],_0xe28265[_0x36c8('0x32')]);_0x1d578f['attributes']=_[_0x36c8('0x34')](_0xe28265[_0x36c8('0x30')],qs[_0x36c8('0x47')](_0x772fa7[_0x36c8('0x32')][_0x36c8('0x47')]));_0x1d578f['attributes']=_0x1d578f[_0x36c8('0x35')][_0x36c8('0x36')]?_0x1d578f['attributes']:_0xe28265[_0x36c8('0x30')];_0x1d578f['order']=qs[_0x36c8('0x3a')](_0x772fa7['query']['sort']);_0x1d578f['where']=qs[_0x36c8('0x33')](_[_0x36c8('0x3b')](_0x772fa7[_0x36c8('0x32')],_0xe28265[_0x36c8('0x33')]));if(_0x772fa7[_0x36c8('0x32')][_0x36c8('0x3f')]){_0x1d578f[_0x36c8('0x3d')]=_['merge'](_0x1d578f['where'],{'$or':_[_0x36c8('0x2b')](_0x1d578f['attributes'],function(_0x364b59){var _0x3bf7fa={};_0x3bf7fa[_0x364b59]={'$like':'%'+_0x772fa7[_0x36c8('0x32')][_0x36c8('0x3f')]+'%'};return _0x3bf7fa;})});}_0x1d578f=_[_0x36c8('0x3c')]({},_0x1d578f,_0x772fa7['options']);return _0x5765a8[_0x36c8('0x4e')](_0x1d578f);}})[_0x36c8('0x25')](function(_0x59a8de){if(_0x59a8de){_0x1aae8f=_0x59a8de['length'];if(!_0x772fa7[_0x36c8('0x32')][_0x36c8('0x37')]('nolimit')){_0x1d578f[_0x36c8('0x1f')]=qs[_0x36c8('0x1f')](_0x772fa7[_0x36c8('0x32')][_0x36c8('0x1f')]);_0x1d578f[_0x36c8('0x1c')]=qs[_0x36c8('0x1c')](_0x772fa7[_0x36c8('0x32')][_0x36c8('0x1c')]);}return _0x5765a8[_0x36c8('0x4e')](_0x1d578f);}})[_0x36c8('0x25')](function(_0x24a934){if(_0x24a934){return _0x24a934?{'count':_0x1aae8f,'rows':_0x24a934}:null;}})[_0x36c8('0x25')](respondWithResult(_0x5c04da,null))[_0x36c8('0x43')](handleError(_0x5c04da,null));};exports[_0x36c8('0x4f')]=function(_0x5c5bab,_0x4767b6,_0x274e84){if(_0x5c5bab['body']['id']){delete _0x5c5bab[_0x36c8('0x4a')]['id'];}return db[_0x36c8('0x2c')][_0x36c8('0x50')]({'where':{'id':_0x5c5bab[_0x36c8('0x45')]['id']}})[_0x36c8('0x25')](handleEntityNotFound(_0x4767b6,null))[_0x36c8('0x25')](function(_0x1ddb37){if(_0x1ddb37){_0x5c5bab['body']['AccountId']=_0x1ddb37['id'];_0x5c5bab[_0x36c8('0x4a')]['Subjects']=integrations['getSubjects'](_0x5c5bab['body'][_0x36c8('0x51')],_0x5c5bab[_0x36c8('0x4a')][_0x36c8('0x2e')]);_0x5c5bab[_0x36c8('0x4a')][_0x36c8('0x52')]=integrations[_0x36c8('0x53')](_0x5c5bab['body'][_0x36c8('0x51')],_0x5c5bab[_0x36c8('0x4a')][_0x36c8('0x2e')]);return db['VtigerConfiguration'][_0x36c8('0x49')](_0x5c5bab['body'],{'include':[{'model':db[_0x36c8('0x54')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x36c8('0x52')}]});}return null;})[_0x36c8('0x25')](respondWithResult(_0x4767b6,null))['catch'](handleError(_0x4767b6,null));};var md5=require(_0x36c8('0x55'));exports[_0x36c8('0x56')]=function(_0xa40c06,_0x4495e7,_0x172b0e){var _0x2dd090=null;var _0x3ff7f9=null;var _0x23fdd2=null;var _0xdc061f=null;var _0x582b97='';return db['VtigerAccount'][_0x36c8('0x50')]({'where':{'id':_0xa40c06['params']['id']},'attributes':['id',_0x36c8('0x28'),_0x36c8('0x57'),_0x36c8('0x58'),'moduleName',_0x36c8('0x59'),_0x36c8('0x5a'),_0x36c8('0x5b')]})['then'](handleEntityNotFound(_0x4495e7,null))[_0x36c8('0x25')](function(_0x3a041e){if(_0x3a041e){_0x2dd090=_0x3a041e[_0x36c8('0x57')];_0x3ff7f9=_0x3a041e[_0x36c8('0x5b')];_0x23fdd2=_0x3a041e[_0x36c8('0x5c')];_0x582b97=_0x3a041e[_0x36c8('0x59')];var _0x56a18e=_0x582b97['slice'](-0x1);if(_0x56a18e==='/'){_0x582b97=_0x582b97[_0x36c8('0x5d')](0x0,_0x582b97['lastIndexOf'](_0x56a18e));}_0xdc061f=util['format'](_0x36c8('0x5e'),_0x582b97);var _0x259950={'method':_0x36c8('0x5f'),'uri':_0xdc061f,'qs':{'operation':_0x36c8('0x60'),'username':_0x3a041e[_0x36c8('0x57')]},'json':!![]};return rp(_0x259950);}})['then'](function(_0x1be25f){if(_0x1be25f['success']){var _0x3ef63c={'method':'POST','uri':_0xdc061f,'form':{'operation':_0x36c8('0x61'),'username':_0x2dd090,'accessKey':md5(_0x1be25f[_0x36c8('0x62')]['token']+_0x3ff7f9)},'json':!![]};return rp(_0x3ef63c);}})[_0x36c8('0x25')](function(_0x248887){if(_0x248887['success']){var _0x384cb7={'method':_0x36c8('0x5f'),'uri':_0xdc061f,'qs':{'operation':'describe','username':_0x2dd090,'sessionName':_0x248887[_0x36c8('0x62')][_0x36c8('0x63')],'elementType':_0x23fdd2},'json':!![]};return rp(_0x384cb7);}})['then'](function(_0xfb2972){if(_0xfb2972[_0x36c8('0x64')]){var _0x44dc02=[_0x36c8('0x65'),_0x36c8('0x66'),_0x36c8('0x67')];_[_0x36c8('0x68')](_0xfb2972[_0x36c8('0x62')]['fields'],function(_0x1814cf){return _0x44dc02[_0x36c8('0x69')](_0x1814cf[_0x36c8('0x2e')][_0x36c8('0x28')]);});_[_0x36c8('0x68')](_0xfb2972[_0x36c8('0x62')][_0x36c8('0x47')],function(_0x1926b9){return _0x1926b9[_0x36c8('0x6a')]===_0x36c8('0x6b');});return{'count':_0xfb2972[_0x36c8('0x62')]['fields']['length'],'rows':_[_0x36c8('0x2b')](_0xfb2972['result'][_0x36c8('0x47')],function(_0x4dfc83){return{'id':_0x4dfc83[_0x36c8('0x28')],'name':_0x4dfc83[_0x36c8('0x6c')],'custom':_['startsWith'](_0x4dfc83[_0x36c8('0x28')],_0x36c8('0x6d'))?!![]:![],'options':_0x4dfc83[_0x36c8('0x2e')][_0x36c8('0x28')]==='picklist'&&_0x4dfc83[_0x36c8('0x2e')][_0x36c8('0x6e')]['length']>0x0?_[_0x36c8('0x2b')](_0x4dfc83[_0x36c8('0x2e')][_0x36c8('0x6e')],function(_0x1fe898){return{'name':_0x1fe898['label'],'value':_0x1fe898[_0x36c8('0x6f')]};}):[]};})};}})['then'](respondWithResult(_0x4495e7,null))['catch'](function(_0x177055){console[_0x36c8('0x70')](_0x36c8('0x71')+_0x177055);var _0x46e4a2=_0xa40c06[_0x36c8('0x32')][_0x36c8('0x72')]?0x1f4:_0x177055['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x46e4a2,JSON['stringify'](_0x177055));delete _0x177055['name'];if(_0x46e4a2===0x191){_0x46e4a2=0x190;}_0x4495e7[_0x36c8('0x19')](_0x46e4a2)[_0x36c8('0x29')](_0xa40c06[_0x36c8('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x177055[_0x36c8('0x73')]}:_0x177055);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 78335d1..66d7b61 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 _0x2ae9=['VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','bluebird','path','../../components/integrations/configuration','define'];(function(_0x130331,_0x4e1df1){var _0x19f22d=function(_0x4975d9){while(--_0x4975d9){_0x130331['push'](_0x130331['shift']());}};_0x19f22d(++_0x4e1df1);}(_0x2ae9,0x107));var _0x92ae=function(_0x1338a1,_0x48c226){_0x1338a1=_0x1338a1-0x0;var _0x39b9e6=_0x2ae9[_0x1338a1];return _0x39b9e6;};'use strict';var _=require('lodash');var util=require(_0x92ae('0x0'));var logger=require(_0x92ae('0x1'))(_0x92ae('0x2'));var moment=require('moment');var BPromise=require(_0x92ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92ae('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x92ae('0x5'));module['exports']=function(_0x5ad955,_0xa02c8b){return _0x5ad955[_0x92ae('0x6')](_0x92ae('0x7'),attributes,{'tableName':_0x92ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5995=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','../../config/logger'];(function(_0x571809,_0x5cd967){var _0xc22642=function(_0x367b52){while(--_0x367b52){_0x571809['push'](_0x571809['shift']());}};_0xc22642(++_0x5cd967);}(_0x5995,0xf6));var _0x5599=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5995[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5599('0x0'))('api');var moment=require(_0x5599('0x1'));var BPromise=require(_0x5599('0x2'));var rp=require(_0x5599('0x3'));var fs=require('fs');var path=require(_0x5599('0x4'));var rimraf=require(_0x5599('0x5'));var config=require(_0x5599('0x6'));var attributes=require(_0x5599('0x7'));var integrations=require(_0x5599('0x8'));module[_0x5599('0x9')]=function(_0x115dea,_0x4d6544){return _0x115dea[_0x5599('0xa')](_0x5599('0xb'),attributes,{'tableName':_0x5599('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 75a6266..00a9468 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 _0x2e54=['error','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','map','include','model','ShowVtigerAccount','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x126c2f,_0x19a958){var _0x421c3a=function(_0x42cc92){while(--_0x42cc92){_0x126c2f['push'](_0x126c2f['shift']());}};_0x421c3a(++_0x19a958);}(_0x2e54,0x1dd));var _0x42e5=function(_0x1f6f41,_0x42980d){_0x1f6f41=_0x1f6f41-0x0;var _0x325802=_0x2e54[_0x1f6f41];return _0x325802;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});}exports[_0x42e5('0x16')]=function(_0x38282d){var _0x11550e=this;return new Promise(function(_0x23fe09,_0x54fcfc){return db[_0x42e5('0x17')]['findAll']({'raw':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1a')]||null:null,'attributes':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1b')]||null:null,'limit':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')]['limit']||null:null,'include':_0x38282d['options']?_0x38282d[_0x42e5('0x18')]['include']?_[_0x42e5('0x1c')](_0x38282d[_0x42e5('0x18')][_0x42e5('0x1d')],function(_0x49490f){return{'model':db[_0x49490f[_0x42e5('0x1e')]],'as':_0x49490f['as'],'attributes':_0x49490f['attributes'],'include':_0x49490f[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x49490f[_0x42e5('0x1d')],function(_0x275c80){return{'model':db[_0x275c80[_0x42e5('0x1e')]],'as':_0x275c80['as'],'attributes':_0x275c80['attributes'],'include':_0x275c80['include']?_[_0x42e5('0x1c')](_0x275c80['include'],function(_0x56f812){return{'model':db[_0x56f812[_0x42e5('0x1e')]],'as':_0x56f812['as'],'attributes':_0x56f812['attributes']};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x2d9e65){logger[_0x42e5('0xd')](_0x42e5('0x16'),_0x38282d);logger[_0x42e5('0x10')](_0x42e5('0x16'),_0x38282d,JSON['stringify'](_0x2d9e65));_0x23fe09(_0x2d9e65);})[_0x42e5('0x15')](function(_0x201d9e){logger[_0x42e5('0x12')](_0x42e5('0x16'),_0x201d9e[_0x42e5('0x13')],_0x38282d);_0x54fcfc(_0x11550e[_0x42e5('0x12')](0x1f4,_0x201d9e[_0x42e5('0x13')]));});});};exports[_0x42e5('0x1f')]=function(_0x5a4930){var _0x2ba9ef=this;return new Promise(function(_0x2c7542,_0x3d9e8b){return db[_0x42e5('0x17')]['find']({'raw':_0x5a4930[_0x42e5('0x18')]?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options']['where']||null:null,'attributes':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options'][_0x42e5('0x1b')]||null:null,'include':_0x5a4930['options']?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x5a4930['options'][_0x42e5('0x1d')],function(_0x3a8d1c){return{'model':db[_0x3a8d1c['model']],'as':_0x3a8d1c['as'],'attributes':_0x3a8d1c[_0x42e5('0x1b')],'include':_0x3a8d1c['include']?_[_0x42e5('0x1c')](_0x3a8d1c[_0x42e5('0x1d')],function(_0x25a040){return{'model':db[_0x25a040[_0x42e5('0x1e')]],'as':_0x25a040['as'],'attributes':_0x25a040[_0x42e5('0x1b')],'include':_0x25a040[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x25a040['include'],function(_0x5a18cc){return{'model':db[_0x5a18cc[_0x42e5('0x1e')]],'as':_0x5a18cc['as'],'attributes':_0x5a18cc[_0x42e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x4a1a8a){logger['info']('ShowVtigerAccount',_0x5a4930);logger['debug'](_0x42e5('0x1f'),_0x5a4930,JSON[_0x42e5('0x20')](_0x4a1a8a));_0x2c7542(_0x4a1a8a);})[_0x42e5('0x15')](function(_0xedb7bc){logger[_0x42e5('0x12')](_0x42e5('0x1f'),_0xedb7bc[_0x42e5('0x13')],_0x5a4930);_0x3d9e8b(_0x2ba9ef[_0x42e5('0x12')](0x1f4,_0xedb7bc['message']));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','ShowVtigerAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x59ef36,_0x101ce4){var _0x24d871=function(_0x1f8887){while(--_0x1f8887){_0x59ef36['push'](_0x59ef36['shift']());}};_0x24d871(++_0x101ce4);}(_0x757a,0xde));var _0xa757=function(_0x1a5baa,_0x55456c){_0x1a5baa=_0x1a5baa-0x0;var _0x379df1=_0x757a[_0x1a5baa];return _0x379df1;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetVtigerAccount',_0x4d9f58);logger['debug']('GetVtigerAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetVtigerAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 80dff18..b2e4ea4 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 _0xce24=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields'];(function(_0x411cd2,_0x5c2f55){var _0x314d25=function(_0x2bdd8c){while(--_0x2bdd8c){_0x411cd2['push'](_0x411cd2['shift']());}};_0x314d25(++_0x5c2f55);}(_0xce24,0xec));var _0x4ce2=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xce24[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x4ce2('0x0'));var util=require(_0x4ce2('0x1'));var path=require('path');var timeout=require(_0x4ce2('0x2'));var express=require(_0x4ce2('0x3'));var router=express[_0x4ce2('0x4')]();var fs_extra=require(_0x4ce2('0x5'));var auth=require(_0x4ce2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4ce2('0x7'));var controller=require(_0x4ce2('0x8'));router[_0x4ce2('0x9')]('/',auth[_0x4ce2('0xa')](),controller['index']);router['get'](_0x4ce2('0xb'),auth[_0x4ce2('0xa')](),controller[_0x4ce2('0xc')]);router[_0x4ce2('0x9')](_0x4ce2('0xd'),auth['isAuthenticated'](),controller[_0x4ce2('0xe')]);router[_0x4ce2('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x4ce2('0xf')]);router[_0x4ce2('0x9')](_0x4ce2('0x10'),auth['isAuthenticated'](),controller[_0x4ce2('0x11')]);router[_0x4ce2('0x12')]('/',auth[_0x4ce2('0xa')](),controller[_0x4ce2('0x13')]);router[_0x4ce2('0x14')](_0x4ce2('0xb'),auth[_0x4ce2('0xa')](),controller[_0x4ce2('0x15')]);router[_0x4ce2('0x16')](_0x4ce2('0xb'),auth[_0x4ce2('0xa')](),controller[_0x4ce2('0x17')]);module[_0x4ce2('0x18')]=router; \ No newline at end of file +var _0x87c7=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer'];(function(_0x329fbf,_0x1e1088){var _0x445278=function(_0x5c4a4d){while(--_0x5c4a4d){_0x329fbf['push'](_0x329fbf['shift']());}};_0x445278(++_0x1e1088);}(_0x87c7,0xc7));var _0x787c=function(_0x5a688b,_0x15223c){_0x5a688b=_0x5a688b-0x0;var _0x68c560=_0x87c7[_0x5a688b];return _0x68c560;};'use strict';var multer=require(_0x787c('0x0'));var util=require(_0x787c('0x1'));var path=require(_0x787c('0x2'));var timeout=require(_0x787c('0x3'));var express=require(_0x787c('0x4'));var router=express['Router']();var fs_extra=require(_0x787c('0x5'));var auth=require(_0x787c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x787c('0x7'));var controller=require(_0x787c('0x8'));router[_0x787c('0x9')]('/',auth['isAuthenticated'](),controller[_0x787c('0xa')]);router['get'](_0x787c('0xb'),auth[_0x787c('0xc')](),controller[_0x787c('0xd')]);router[_0x787c('0x9')](_0x787c('0xe'),auth[_0x787c('0xc')](),controller[_0x787c('0xf')]);router[_0x787c('0x9')](_0x787c('0x10'),auth[_0x787c('0xc')](),controller[_0x787c('0x11')]);router[_0x787c('0x9')](_0x787c('0x12'),auth[_0x787c('0xc')](),controller['getDescriptions']);router[_0x787c('0x13')]('/',auth[_0x787c('0xc')](),controller['create']);router[_0x787c('0x14')](_0x787c('0xb'),auth[_0x787c('0xc')](),controller[_0x787c('0x15')]);router[_0x787c('0x16')](_0x787c('0xb'),auth['isAuthenticated'](),controller[_0x787c('0x17')]);module[_0x787c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index a7c7fcf..9ca9c67 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 _0x2e5b=['STRING','sequelize'];(function(_0x49def9,_0x46014d){var _0x540581=function(_0x59e27a){while(--_0x59e27a){_0x49def9['push'](_0x49def9['shift']());}};_0x540581(++_0x46014d);}(_0x2e5b,0x1d3));var _0xb2e5=function(_0x48e8d5,_0x575cc4){_0x48e8d5=_0x48e8d5-0x0;var _0x1cbfc1=_0x2e5b[_0x48e8d5];return _0x1cbfc1;};'use strict';var Sequelize=require(_0xb2e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xb2e5('0x1')]},'description':{'type':Sequelize[_0xb2e5('0x1')]}}; \ No newline at end of file +var _0xaeb5=['exports','STRING','sequelize'];(function(_0x2c6147,_0x2fb7c1){var _0x2908a7=function(_0x137c2a){while(--_0x137c2a){_0x2c6147['push'](_0x2c6147['shift']());}};_0x2908a7(++_0x2fb7c1);}(_0xaeb5,0x1b8));var _0x5aeb=function(_0x3de80e,_0x5cabca){_0x3de80e=_0x3de80e-0x0;var _0x5629fd=_0xaeb5[_0x3de80e];return _0x5629fd;};'use strict';var Sequelize=require(_0x5aeb('0x0'));module[_0x5aeb('0x1')]={'name':{'type':Sequelize[_0x5aeb('0x2')]},'description':{'type':Sequelize[_0x5aeb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 6ab8804..fa9fbc2 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 _0xa376=['../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','update','getFields','findOne','pick','getSubjects','VtigerField','getDescriptions','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch'];(function(_0x5b7a90,_0xeaeac9){var _0x41c7f6=function(_0x1bb157){while(--_0x1bb157){_0x5b7a90['push'](_0x5b7a90['shift']());}};_0x41c7f6(++_0xeaeac9);}(_0xa376,0x88));var _0x6a37=function(_0xd72144,_0x53e49b){_0xd72144=_0xd72144-0x0;var _0x308f66=_0xa376[_0xd72144];return _0x308f66;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6a37('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a37('0x1'));var moment=require(_0x6a37('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6a37('0x3'));var path=require(_0x6a37('0x4'));var sox=require(_0x6a37('0x5'));var csv=require(_0x6a37('0x6'));var ejs=require(_0x6a37('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a37('0x8'));var squel=require(_0x6a37('0x9'));var crypto=require(_0x6a37('0xa'));var jsforce=require(_0x6a37('0xb'));var deskjs=require(_0x6a37('0xc'));var toCsv=require(_0x6a37('0x6'));var querystring=require(_0x6a37('0xd'));var Papa=require('papaparse');var Redis=require(_0x6a37('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6a37('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6a37('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a37('0x11'))['db'];function respondWithStatusCode(_0x123ef3,_0x47457b){_0x47457b=_0x47457b||0xcc;return function(_0x3b371a){if(_0x3b371a){return _0x123ef3[_0x6a37('0x12')](_0x47457b);}return _0x123ef3['status'](_0x47457b)[_0x6a37('0x13')]();};}function respondWithResult(_0x5a2502,_0xf2f919){_0xf2f919=_0xf2f919||0xc8;return function(_0x58fb53){if(_0x58fb53){return _0x5a2502[_0x6a37('0x14')](_0xf2f919)['json'](_0x58fb53);}};}function respondWithFilteredResult(_0x1ec6e6,_0x3dfd5c){return function(_0x5340b1){if(_0x5340b1){var _0x952417=typeof _0x3dfd5c[_0x6a37('0x15')]===_0x6a37('0x16')&&typeof _0x3dfd5c[_0x6a37('0x17')]===_0x6a37('0x16');var _0x38181a=_0x5340b1[_0x6a37('0x18')];var _0x6b525a=_0x952417?0x0:_0x3dfd5c[_0x6a37('0x15')];var _0x22fc54=_0x952417?_0x5340b1['count']:_0x3dfd5c['offset']+_0x3dfd5c[_0x6a37('0x17')];var _0x1dbd0f;if(_0x22fc54>=_0x38181a){_0x22fc54=_0x38181a;_0x1dbd0f=0xc8;}else{_0x1dbd0f=0xce;}_0x1ec6e6[_0x6a37('0x14')](_0x1dbd0f);return _0x1ec6e6[_0x6a37('0x19')]('Content-Range',_0x6b525a+'-'+_0x22fc54+'/'+_0x38181a)[_0x6a37('0x1a')](_0x5340b1);}return null;};}function patchUpdates(_0x4c6411){return function(_0x5b6516){try{jsonpatch[_0x6a37('0x1b')](_0x5b6516,_0x4c6411,!![]);}catch(_0x1390fe){return BPromise[_0x6a37('0x1c')](_0x1390fe);}return _0x5b6516[_0x6a37('0x1d')]();};}function saveUpdates(_0x24ba24,_0x28a602){return function(_0x135352){if(_0x135352){return _0x135352['update'](_0x24ba24)[_0x6a37('0x1e')](function(_0x3ebe08){return _0x3ebe08;});}return null;};}function removeEntity(_0x4500f1,_0x13fc84){return function(_0x460324){if(_0x460324){return _0x460324[_0x6a37('0x1f')]()[_0x6a37('0x1e')](function(){_0x4500f1['status'](0xcc)[_0x6a37('0x13')]();});}};}function handleEntityNotFound(_0xf8d82d,_0x3a21bd){return function(_0x187ebb){if(!_0x187ebb){_0xf8d82d[_0x6a37('0x12')](0x194);}return _0x187ebb;};}function handleError(_0x5fc322,_0x33347f){_0x33347f=_0x33347f||0x1f4;return function(_0x3c25a5){logger[_0x6a37('0x20')](_0x3c25a5[_0x6a37('0x21')]);if(_0x3c25a5[_0x6a37('0x22')]){delete _0x3c25a5[_0x6a37('0x22')];}_0x5fc322[_0x6a37('0x14')](_0x33347f)[_0x6a37('0x23')](_0x3c25a5);};}exports[_0x6a37('0x24')]=function(_0x18f076,_0x2398d9){var _0x1bf83b={},_0x2573e5={},_0x5cfa53={'count':0x0,'rows':[]};var _0x5be572=_[_0x6a37('0x25')](db[_0x6a37('0x26')][_0x6a37('0x27')],function(_0x22ae1b){return{'name':_0x22ae1b[_0x6a37('0x28')],'type':_0x22ae1b[_0x6a37('0x29')][_0x6a37('0x2a')]};});_0x2573e5[_0x6a37('0x2b')]=_[_0x6a37('0x25')](_0x5be572,_0x6a37('0x22'));_0x2573e5['query']=_[_0x6a37('0x2c')](_0x18f076['query']);_0x2573e5['filters']=_[_0x6a37('0x2d')](_0x2573e5[_0x6a37('0x2b')],_0x2573e5[_0x6a37('0x2e')]);_0x1bf83b[_0x6a37('0x2f')]=_['intersection'](_0x2573e5[_0x6a37('0x2b')],qs[_0x6a37('0x30')](_0x18f076[_0x6a37('0x2e')]['fields']));_0x1bf83b[_0x6a37('0x2f')]=_0x1bf83b[_0x6a37('0x2f')][_0x6a37('0x31')]?_0x1bf83b[_0x6a37('0x2f')]:_0x2573e5[_0x6a37('0x2b')];if(!_0x18f076[_0x6a37('0x2e')][_0x6a37('0x32')](_0x6a37('0x33'))){_0x1bf83b['limit']=qs[_0x6a37('0x17')](_0x18f076[_0x6a37('0x2e')][_0x6a37('0x17')]);_0x1bf83b['offset']=qs[_0x6a37('0x15')](_0x18f076['query'][_0x6a37('0x15')]);}_0x1bf83b[_0x6a37('0x34')]=qs[_0x6a37('0x35')](_0x18f076[_0x6a37('0x2e')]['sort']);_0x1bf83b['where']=qs[_0x6a37('0x36')](_['pick'](_0x18f076[_0x6a37('0x2e')],_0x2573e5['filters']),_0x5be572);if(_0x18f076[_0x6a37('0x2e')][_0x6a37('0x37')]){_0x1bf83b['where']=_[_0x6a37('0x38')](_0x1bf83b[_0x6a37('0x39')],{'$or':_[_0x6a37('0x25')](_0x5be572,function(_0x1b2c1f){if(_0x1b2c1f[_0x6a37('0x29')]!==_0x6a37('0x3a')){var _0x402687={};_0x402687[_0x1b2c1f['name']]={'$like':'%'+_0x18f076['query'][_0x6a37('0x37')]+'%'};return _0x402687;}})});}_0x1bf83b=_[_0x6a37('0x38')]({},_0x1bf83b,_0x18f076[_0x6a37('0x3b')]);var _0x58c04c={'where':_0x1bf83b[_0x6a37('0x39')]};return db['VtigerConfiguration']['count'](_0x58c04c)['then'](function(_0x574b14){_0x5cfa53[_0x6a37('0x18')]=_0x574b14;if(_0x18f076['query']['includeAll']){_0x1bf83b[_0x6a37('0x3c')]=[{'all':!![]}];}return db[_0x6a37('0x26')][_0x6a37('0x3d')](_0x1bf83b);})[_0x6a37('0x1e')](function(_0x165c44){_0x5cfa53[_0x6a37('0x3e')]=_0x165c44;return _0x5cfa53;})[_0x6a37('0x1e')](respondWithFilteredResult(_0x2398d9,_0x1bf83b))[_0x6a37('0x3f')](handleError(_0x2398d9,null));};exports['show']=function(_0x5268d0,_0x3463fe){var _0x517664={'raw':![],'where':{'id':_0x5268d0[_0x6a37('0x40')]['id']}},_0x1c3369={};_0x1c3369[_0x6a37('0x2b')]=_[_0x6a37('0x2c')](db[_0x6a37('0x26')]['rawAttributes']);_0x1c3369[_0x6a37('0x2e')]=_['keys'](_0x5268d0[_0x6a37('0x2e')]);_0x1c3369[_0x6a37('0x36')]=_['intersection'](_0x1c3369[_0x6a37('0x2b')],_0x1c3369['query']);_0x517664[_0x6a37('0x2f')]=_[_0x6a37('0x2d')](_0x1c3369[_0x6a37('0x2b')],qs[_0x6a37('0x30')](_0x5268d0[_0x6a37('0x2e')][_0x6a37('0x30')]));_0x517664[_0x6a37('0x2f')]=_0x517664[_0x6a37('0x2f')]['length']?_0x517664[_0x6a37('0x2f')]:_0x1c3369[_0x6a37('0x2b')];if(_0x5268d0[_0x6a37('0x2e')][_0x6a37('0x41')]){_0x517664[_0x6a37('0x3c')]=[{'all':!![]}];}_0x517664=_[_0x6a37('0x38')]({},_0x517664,_0x5268d0[_0x6a37('0x3b')]);return db[_0x6a37('0x26')][_0x6a37('0x42')](_0x517664)['then'](handleEntityNotFound(_0x3463fe,null))[_0x6a37('0x1e')](respondWithResult(_0x3463fe,null))['catch'](handleError(_0x3463fe,null));};exports[_0x6a37('0x43')]=function(_0x1b99a0,_0x2ea3a6){return db[_0x6a37('0x26')][_0x6a37('0x43')](_0x1b99a0[_0x6a37('0x44')],{})[_0x6a37('0x1e')](respondWithResult(_0x2ea3a6,0xc9))['catch'](handleError(_0x2ea3a6,null));};exports[_0x6a37('0x45')]=function(_0x2fcc95,_0x786497){if(_0x2fcc95[_0x6a37('0x44')]['id']){delete _0x2fcc95['body']['id'];}return db[_0x6a37('0x26')][_0x6a37('0x42')]({'where':{'id':_0x2fcc95[_0x6a37('0x40')]['id']}})[_0x6a37('0x1e')](handleEntityNotFound(_0x786497,null))['then'](saveUpdates(_0x2fcc95['body'],null))['then'](respondWithResult(_0x786497,null))[_0x6a37('0x3f')](handleError(_0x786497,null));};exports['destroy']=function(_0x3b9e0a,_0x3f286a){return db[_0x6a37('0x26')][_0x6a37('0x42')]({'where':{'id':_0x3b9e0a['params']['id']}})[_0x6a37('0x1e')](handleEntityNotFound(_0x3f286a,null))[_0x6a37('0x1e')](removeEntity(_0x3f286a,null))[_0x6a37('0x3f')](handleError(_0x3f286a,null));};exports[_0x6a37('0x46')]=function(_0x3b74b6,_0x5cd706,_0x12e773){var _0x29a2bf={};var _0x4e4d99={};var _0x17edf6;var _0x51c0ce;return db[_0x6a37('0x26')][_0x6a37('0x47')]({'where':{'id':_0x3b74b6['params']['id']}})[_0x6a37('0x1e')](handleEntityNotFound(_0x5cd706,null))['then'](function(_0x2a3509){if(_0x2a3509){_0x17edf6=_0x2a3509;_0x4e4d99[_0x6a37('0x2b')]=_[_0x6a37('0x2c')](db['VtigerField'][_0x6a37('0x27')]);_0x4e4d99[_0x6a37('0x2e')]=_['keys'](_0x3b74b6[_0x6a37('0x2e')]);_0x4e4d99[_0x6a37('0x36')]=_[_0x6a37('0x2d')](_0x4e4d99[_0x6a37('0x2b')],_0x4e4d99[_0x6a37('0x2e')]);_0x29a2bf['attributes']=_[_0x6a37('0x2d')](_0x4e4d99[_0x6a37('0x2b')],qs[_0x6a37('0x30')](_0x3b74b6[_0x6a37('0x2e')][_0x6a37('0x30')]));_0x29a2bf[_0x6a37('0x2f')]=_0x29a2bf['attributes']['length']?_0x29a2bf['attributes']:_0x4e4d99['model'];_0x29a2bf[_0x6a37('0x34')]=qs[_0x6a37('0x35')](_0x3b74b6[_0x6a37('0x2e')][_0x6a37('0x35')]);_0x29a2bf[_0x6a37('0x39')]=qs[_0x6a37('0x36')](_[_0x6a37('0x48')](_0x3b74b6[_0x6a37('0x2e')],_0x4e4d99[_0x6a37('0x36')]));if(_0x3b74b6[_0x6a37('0x2e')][_0x6a37('0x37')]){_0x29a2bf[_0x6a37('0x39')]=_[_0x6a37('0x38')](_0x29a2bf[_0x6a37('0x39')],{'$or':_[_0x6a37('0x25')](_0x29a2bf['attributes'],function(_0x784f9b){var _0x264557={};_0x264557[_0x784f9b]={'$like':'%'+_0x3b74b6[_0x6a37('0x2e')][_0x6a37('0x37')]+'%'};return _0x264557;})});}_0x29a2bf=_[_0x6a37('0x38')]({},_0x29a2bf,_0x3b74b6[_0x6a37('0x3b')]);return _0x17edf6['getFields'](_0x29a2bf);}})[_0x6a37('0x1e')](function(_0x352975){if(_0x352975){_0x51c0ce=_0x352975['length'];if(!_0x3b74b6[_0x6a37('0x2e')][_0x6a37('0x32')](_0x6a37('0x33'))){_0x29a2bf[_0x6a37('0x17')]=qs['limit'](_0x3b74b6[_0x6a37('0x2e')][_0x6a37('0x17')]);_0x29a2bf[_0x6a37('0x15')]=qs[_0x6a37('0x15')](_0x3b74b6[_0x6a37('0x2e')][_0x6a37('0x15')]);}return _0x17edf6[_0x6a37('0x46')](_0x29a2bf);}})[_0x6a37('0x1e')](function(_0x21d03f){if(_0x21d03f){return _0x21d03f?{'count':_0x51c0ce,'rows':_0x21d03f}:null;}})['then'](respondWithResult(_0x5cd706,null))[_0x6a37('0x3f')](handleError(_0x5cd706,null));};exports[_0x6a37('0x49')]=function(_0x2f3a2f,_0x2bf588,_0x2569a9){var _0x56884e={};var _0x4a06a6={};var _0x26153a;var _0x2906a4;return db[_0x6a37('0x26')]['findOne']({'where':{'id':_0x2f3a2f['params']['id']}})['then'](handleEntityNotFound(_0x2bf588,null))['then'](function(_0x280daf){if(_0x280daf){_0x26153a=_0x280daf;_0x4a06a6[_0x6a37('0x2b')]=_['keys'](db[_0x6a37('0x4a')][_0x6a37('0x27')]);_0x4a06a6['query']=_[_0x6a37('0x2c')](_0x2f3a2f['query']);_0x4a06a6[_0x6a37('0x36')]=_[_0x6a37('0x2d')](_0x4a06a6['model'],_0x4a06a6['query']);_0x56884e['attributes']=_[_0x6a37('0x2d')](_0x4a06a6['model'],qs[_0x6a37('0x30')](_0x2f3a2f[_0x6a37('0x2e')][_0x6a37('0x30')]));_0x56884e['attributes']=_0x56884e[_0x6a37('0x2f')]['length']?_0x56884e['attributes']:_0x4a06a6[_0x6a37('0x2b')];_0x56884e[_0x6a37('0x34')]=qs['sort'](_0x2f3a2f['query'][_0x6a37('0x35')]);_0x56884e[_0x6a37('0x39')]=qs[_0x6a37('0x36')](_['pick'](_0x2f3a2f[_0x6a37('0x2e')],_0x4a06a6['filters']));if(_0x2f3a2f[_0x6a37('0x2e')][_0x6a37('0x37')]){_0x56884e[_0x6a37('0x39')]=_[_0x6a37('0x38')](_0x56884e[_0x6a37('0x39')],{'$or':_[_0x6a37('0x25')](_0x56884e[_0x6a37('0x2f')],function(_0x4bc74){var _0x3af6be={};_0x3af6be[_0x4bc74]={'$like':'%'+_0x2f3a2f['query'][_0x6a37('0x37')]+'%'};return _0x3af6be;})});}_0x56884e=_[_0x6a37('0x38')]({},_0x56884e,_0x2f3a2f['options']);return _0x26153a[_0x6a37('0x49')](_0x56884e);}})[_0x6a37('0x1e')](function(_0x252438){if(_0x252438){_0x2906a4=_0x252438['length'];if(!_0x2f3a2f[_0x6a37('0x2e')]['hasOwnProperty'](_0x6a37('0x33'))){_0x56884e['limit']=qs['limit'](_0x2f3a2f['query'][_0x6a37('0x17')]);_0x56884e[_0x6a37('0x15')]=qs[_0x6a37('0x15')](_0x2f3a2f['query']['offset']);}return _0x26153a[_0x6a37('0x49')](_0x56884e);}})[_0x6a37('0x1e')](function(_0x4da881){if(_0x4da881){return _0x4da881?{'count':_0x2906a4,'rows':_0x4da881}:null;}})[_0x6a37('0x1e')](respondWithResult(_0x2bf588,null))[_0x6a37('0x3f')](handleError(_0x2bf588,null));};exports[_0x6a37('0x4b')]=function(_0x55f523,_0x4aeb45,_0x4e3297){var _0x31cc1c={};var _0x57e4b7={};var _0x1f2425;var _0x2c0183;return db[_0x6a37('0x26')][_0x6a37('0x47')]({'where':{'id':_0x55f523[_0x6a37('0x40')]['id']}})[_0x6a37('0x1e')](handleEntityNotFound(_0x4aeb45,null))[_0x6a37('0x1e')](function(_0x2924a5){if(_0x2924a5){_0x1f2425=_0x2924a5;_0x57e4b7[_0x6a37('0x2b')]=_[_0x6a37('0x2c')](db[_0x6a37('0x4a')][_0x6a37('0x27')]);_0x57e4b7[_0x6a37('0x2e')]=_[_0x6a37('0x2c')](_0x55f523[_0x6a37('0x2e')]);_0x57e4b7['filters']=_[_0x6a37('0x2d')](_0x57e4b7[_0x6a37('0x2b')],_0x57e4b7[_0x6a37('0x2e')]);_0x31cc1c['attributes']=_[_0x6a37('0x2d')](_0x57e4b7['model'],qs[_0x6a37('0x30')](_0x55f523[_0x6a37('0x2e')][_0x6a37('0x30')]));_0x31cc1c[_0x6a37('0x2f')]=_0x31cc1c[_0x6a37('0x2f')][_0x6a37('0x31')]?_0x31cc1c[_0x6a37('0x2f')]:_0x57e4b7[_0x6a37('0x2b')];_0x31cc1c['order']=qs['sort'](_0x55f523['query'][_0x6a37('0x35')]);_0x31cc1c[_0x6a37('0x39')]=qs[_0x6a37('0x36')](_['pick'](_0x55f523['query'],_0x57e4b7[_0x6a37('0x36')]));if(_0x55f523[_0x6a37('0x2e')][_0x6a37('0x37')]){_0x31cc1c[_0x6a37('0x39')]=_[_0x6a37('0x38')](_0x31cc1c[_0x6a37('0x39')],{'$or':_['map'](_0x31cc1c[_0x6a37('0x2f')],function(_0x3712a7){var _0x1b4a1c={};_0x1b4a1c[_0x3712a7]={'$like':'%'+_0x55f523[_0x6a37('0x2e')][_0x6a37('0x37')]+'%'};return _0x1b4a1c;})});}_0x31cc1c=_['merge']({},_0x31cc1c,_0x55f523[_0x6a37('0x3b')]);return _0x1f2425[_0x6a37('0x4b')](_0x31cc1c);}})['then'](function(_0x4d5743){if(_0x4d5743){_0x2c0183=_0x4d5743['length'];if(!_0x55f523[_0x6a37('0x2e')][_0x6a37('0x32')](_0x6a37('0x33'))){_0x31cc1c['limit']=qs[_0x6a37('0x17')](_0x55f523[_0x6a37('0x2e')][_0x6a37('0x17')]);_0x31cc1c[_0x6a37('0x15')]=qs[_0x6a37('0x15')](_0x55f523[_0x6a37('0x2e')][_0x6a37('0x15')]);}return _0x1f2425[_0x6a37('0x4b')](_0x31cc1c);}})[_0x6a37('0x1e')](function(_0x207015){if(_0x207015){return _0x207015?{'count':_0x2c0183,'rows':_0x207015}:null;}})[_0x6a37('0x1e')](respondWithResult(_0x4aeb45,null))[_0x6a37('0x3f')](handleError(_0x4aeb45,null));}; \ No newline at end of file +var _0x64f6=['stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','VtigerConfiguration','findAll','catch','show','params','keys','fields','length','options','find','create','body','getFields','findOne','VtigerField','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','then','error'];(function(_0x3fb56f,_0x5f99f2){var _0x287e44=function(_0x660622){while(--_0x660622){_0x3fb56f['push'](_0x3fb56f['shift']());}};_0x287e44(++_0x5f99f2);}(_0x64f6,0x17d));var _0x664f=function(_0x251f85,_0x2be404){_0x251f85=_0x251f85-0x0;var _0x307b74=_0x64f6[_0x251f85];return _0x307b74;};'use strict';var emlformat=require(_0x664f('0x0'));var rimraf=require(_0x664f('0x1'));var zipdir=require(_0x664f('0x2'));var jsonpatch=require(_0x664f('0x3'));var rp=require(_0x664f('0x4'));var moment=require('moment');var BPromise=require(_0x664f('0x5'));var Mustache=require(_0x664f('0x6'));var util=require(_0x664f('0x7'));var path=require(_0x664f('0x8'));var sox=require(_0x664f('0x9'));var csv=require('to-csv');var ejs=require(_0x664f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x664f('0xb'));var squel=require(_0x664f('0xc'));var crypto=require(_0x664f('0xd'));var jsforce=require(_0x664f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x664f('0xf'));var querystring=require(_0x664f('0x10'));var Papa=require(_0x664f('0x11'));var Redis=require(_0x664f('0x12'));var authService=require(_0x664f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x664f('0x14'));var hardwareService=require(_0x664f('0x15'));var logger=require(_0x664f('0x16'))(_0x664f('0x17'));var utils=require(_0x664f('0x18'));var config=require(_0x664f('0x19'));var licenseUtil=require(_0x664f('0x1a'));var db=require(_0x664f('0x1b'))['db'];function respondWithStatusCode(_0x372c81,_0x2d2f07){_0x2d2f07=_0x2d2f07||0xcc;return function(_0xe850e3){if(_0xe850e3){return _0x372c81[_0x664f('0x1c')](_0x2d2f07);}return _0x372c81[_0x664f('0x1d')](_0x2d2f07)[_0x664f('0x1e')]();};}function respondWithResult(_0x180583,_0x2f027e){_0x2f027e=_0x2f027e||0xc8;return function(_0x32cef9){if(_0x32cef9){return _0x180583[_0x664f('0x1d')](_0x2f027e)['json'](_0x32cef9);}};}function respondWithFilteredResult(_0x1d031e,_0x4f21eb){return function(_0x5ceabe){if(_0x5ceabe){var _0x129813=typeof _0x4f21eb[_0x664f('0x1f')]===_0x664f('0x20')&&typeof _0x4f21eb['limit']===_0x664f('0x20');var _0x514d18=_0x5ceabe[_0x664f('0x21')];var _0x439891=_0x129813?0x0:_0x4f21eb[_0x664f('0x1f')];var _0x2e339b=_0x129813?_0x5ceabe[_0x664f('0x21')]:_0x4f21eb[_0x664f('0x1f')]+_0x4f21eb[_0x664f('0x22')];var _0x380c1b;if(_0x2e339b>=_0x514d18){_0x2e339b=_0x514d18;_0x380c1b=0xc8;}else{_0x380c1b=0xce;}_0x1d031e['status'](_0x380c1b);return _0x1d031e[_0x664f('0x23')]('Content-Range',_0x439891+'-'+_0x2e339b+'/'+_0x514d18)[_0x664f('0x24')](_0x5ceabe);}return null;};}function patchUpdates(_0x484db0){return function(_0x36b5f4){try{jsonpatch[_0x664f('0x25')](_0x36b5f4,_0x484db0,!![]);}catch(_0x2adb00){return BPromise[_0x664f('0x26')](_0x2adb00);}return _0x36b5f4[_0x664f('0x27')]();};}function saveUpdates(_0x5474bf,_0x1240c1){return function(_0x12ae69){if(_0x12ae69){return _0x12ae69[_0x664f('0x28')](_0x5474bf)['then'](function(_0x4f95cd){return _0x4f95cd;});}return null;};}function removeEntity(_0x1620a7,_0x50d2cb){return function(_0x17c56a){if(_0x17c56a){return _0x17c56a[_0x664f('0x29')]()[_0x664f('0x2a')](function(){_0x1620a7[_0x664f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1b9c,_0x27b4b8){return function(_0x55f384){if(!_0x55f384){_0x2d1b9c[_0x664f('0x1c')](0x194);}return _0x55f384;};}function handleError(_0x3dc443,_0x3fe5b9){_0x3fe5b9=_0x3fe5b9||0x1f4;return function(_0x1b3e2c){logger[_0x664f('0x2b')](_0x1b3e2c[_0x664f('0x2c')]);if(_0x1b3e2c[_0x664f('0x2d')]){delete _0x1b3e2c[_0x664f('0x2d')];}_0x3dc443['status'](_0x3fe5b9)['send'](_0x1b3e2c);};}exports[_0x664f('0x2e')]=function(_0x46a8b0,_0x32b11b){var _0x550123={},_0x4522c3={},_0x3f9390={'count':0x0,'rows':[]};var _0x5a1654=_[_0x664f('0x2f')](db['VtigerConfiguration'][_0x664f('0x30')],function(_0x201945){return{'name':_0x201945[_0x664f('0x31')],'type':_0x201945['type'][_0x664f('0x32')]};});_0x4522c3[_0x664f('0x33')]=_['map'](_0x5a1654,_0x664f('0x2d'));_0x4522c3[_0x664f('0x34')]=_['keys'](_0x46a8b0['query']);_0x4522c3[_0x664f('0x35')]=_[_0x664f('0x36')](_0x4522c3['model'],_0x4522c3[_0x664f('0x34')]);_0x550123[_0x664f('0x37')]=_['intersection'](_0x4522c3[_0x664f('0x33')],qs['fields'](_0x46a8b0[_0x664f('0x34')]['fields']));_0x550123['attributes']=_0x550123[_0x664f('0x37')]['length']?_0x550123[_0x664f('0x37')]:_0x4522c3['model'];if(!_0x46a8b0[_0x664f('0x34')]['hasOwnProperty'](_0x664f('0x38'))){_0x550123['limit']=qs[_0x664f('0x22')](_0x46a8b0[_0x664f('0x34')][_0x664f('0x22')]);_0x550123[_0x664f('0x1f')]=qs[_0x664f('0x1f')](_0x46a8b0[_0x664f('0x34')][_0x664f('0x1f')]);}_0x550123[_0x664f('0x39')]=qs[_0x664f('0x3a')](_0x46a8b0[_0x664f('0x34')]['sort']);_0x550123[_0x664f('0x3b')]=qs['filters'](_[_0x664f('0x3c')](_0x46a8b0[_0x664f('0x34')],_0x4522c3[_0x664f('0x35')]),_0x5a1654);if(_0x46a8b0[_0x664f('0x34')][_0x664f('0x3d')]){_0x550123[_0x664f('0x3b')]=_[_0x664f('0x3e')](_0x550123[_0x664f('0x3b')],{'$or':_[_0x664f('0x2f')](_0x5a1654,function(_0x420e9d){if(_0x420e9d[_0x664f('0x3f')]!==_0x664f('0x40')){var _0x107707={};_0x107707[_0x420e9d[_0x664f('0x2d')]]={'$like':'%'+_0x46a8b0[_0x664f('0x34')][_0x664f('0x3d')]+'%'};return _0x107707;}})});}_0x550123=_[_0x664f('0x3e')]({},_0x550123,_0x46a8b0['options']);var _0x2b743f={'where':_0x550123[_0x664f('0x3b')]};return db['VtigerConfiguration'][_0x664f('0x21')](_0x2b743f)[_0x664f('0x2a')](function(_0x1356d3){_0x3f9390[_0x664f('0x21')]=_0x1356d3;if(_0x46a8b0['query'][_0x664f('0x41')]){_0x550123[_0x664f('0x42')]=[{'all':!![]}];}return db[_0x664f('0x43')][_0x664f('0x44')](_0x550123);})[_0x664f('0x2a')](function(_0x2619a1){_0x3f9390['rows']=_0x2619a1;return _0x3f9390;})[_0x664f('0x2a')](respondWithFilteredResult(_0x32b11b,_0x550123))[_0x664f('0x45')](handleError(_0x32b11b,null));};exports[_0x664f('0x46')]=function(_0x1f4e83,_0x2db1ca){var _0x17392e={'raw':![],'where':{'id':_0x1f4e83[_0x664f('0x47')]['id']}},_0xbedd31={};_0xbedd31[_0x664f('0x33')]=_[_0x664f('0x48')](db[_0x664f('0x43')]['rawAttributes']);_0xbedd31[_0x664f('0x34')]=_[_0x664f('0x48')](_0x1f4e83[_0x664f('0x34')]);_0xbedd31[_0x664f('0x35')]=_[_0x664f('0x36')](_0xbedd31[_0x664f('0x33')],_0xbedd31[_0x664f('0x34')]);_0x17392e[_0x664f('0x37')]=_[_0x664f('0x36')](_0xbedd31[_0x664f('0x33')],qs[_0x664f('0x49')](_0x1f4e83[_0x664f('0x34')][_0x664f('0x49')]));_0x17392e['attributes']=_0x17392e[_0x664f('0x37')][_0x664f('0x4a')]?_0x17392e['attributes']:_0xbedd31[_0x664f('0x33')];if(_0x1f4e83[_0x664f('0x34')][_0x664f('0x41')]){_0x17392e[_0x664f('0x42')]=[{'all':!![]}];}_0x17392e=_[_0x664f('0x3e')]({},_0x17392e,_0x1f4e83[_0x664f('0x4b')]);return db[_0x664f('0x43')][_0x664f('0x4c')](_0x17392e)[_0x664f('0x2a')](handleEntityNotFound(_0x2db1ca,null))[_0x664f('0x2a')](respondWithResult(_0x2db1ca,null))[_0x664f('0x45')](handleError(_0x2db1ca,null));};exports['create']=function(_0x2177ad,_0x47ea5f){return db[_0x664f('0x43')][_0x664f('0x4d')](_0x2177ad['body'],{})['then'](respondWithResult(_0x47ea5f,0xc9))[_0x664f('0x45')](handleError(_0x47ea5f,null));};exports[_0x664f('0x28')]=function(_0x7e288c,_0x382fb7){if(_0x7e288c[_0x664f('0x4e')]['id']){delete _0x7e288c['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x7e288c['params']['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x382fb7,null))['then'](saveUpdates(_0x7e288c[_0x664f('0x4e')],null))[_0x664f('0x2a')](respondWithResult(_0x382fb7,null))['catch'](handleError(_0x382fb7,null));};exports['destroy']=function(_0x22dde9,_0x95bb18){return db[_0x664f('0x43')]['find']({'where':{'id':_0x22dde9['params']['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x95bb18,null))[_0x664f('0x2a')](removeEntity(_0x95bb18,null))[_0x664f('0x45')](handleError(_0x95bb18,null));};exports[_0x664f('0x4f')]=function(_0x1194c7,_0x3e47fd,_0x101158){var _0x40d4de={};var _0x2f9e8b={};var _0x756195;var _0x402ccc;return db[_0x664f('0x43')][_0x664f('0x50')]({'where':{'id':_0x1194c7['params']['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x3e47fd,null))[_0x664f('0x2a')](function(_0x22209c){if(_0x22209c){_0x756195=_0x22209c;_0x2f9e8b[_0x664f('0x33')]=_[_0x664f('0x48')](db[_0x664f('0x51')][_0x664f('0x30')]);_0x2f9e8b[_0x664f('0x34')]=_[_0x664f('0x48')](_0x1194c7[_0x664f('0x34')]);_0x2f9e8b[_0x664f('0x35')]=_['intersection'](_0x2f9e8b['model'],_0x2f9e8b[_0x664f('0x34')]);_0x40d4de[_0x664f('0x37')]=_['intersection'](_0x2f9e8b['model'],qs[_0x664f('0x49')](_0x1194c7[_0x664f('0x34')][_0x664f('0x49')]));_0x40d4de['attributes']=_0x40d4de[_0x664f('0x37')][_0x664f('0x4a')]?_0x40d4de[_0x664f('0x37')]:_0x2f9e8b[_0x664f('0x33')];_0x40d4de[_0x664f('0x39')]=qs[_0x664f('0x3a')](_0x1194c7[_0x664f('0x34')][_0x664f('0x3a')]);_0x40d4de[_0x664f('0x3b')]=qs[_0x664f('0x35')](_['pick'](_0x1194c7[_0x664f('0x34')],_0x2f9e8b[_0x664f('0x35')]));if(_0x1194c7[_0x664f('0x34')]['filter']){_0x40d4de['where']=_[_0x664f('0x3e')](_0x40d4de['where'],{'$or':_[_0x664f('0x2f')](_0x40d4de['attributes'],function(_0x3e07c0){var _0x17c8fa={};_0x17c8fa[_0x3e07c0]={'$like':'%'+_0x1194c7['query'][_0x664f('0x3d')]+'%'};return _0x17c8fa;})});}_0x40d4de=_[_0x664f('0x3e')]({},_0x40d4de,_0x1194c7[_0x664f('0x4b')]);return _0x756195[_0x664f('0x4f')](_0x40d4de);}})['then'](function(_0x4587d9){if(_0x4587d9){_0x402ccc=_0x4587d9[_0x664f('0x4a')];if(!_0x1194c7[_0x664f('0x34')]['hasOwnProperty'](_0x664f('0x38'))){_0x40d4de['limit']=qs[_0x664f('0x22')](_0x1194c7['query'][_0x664f('0x22')]);_0x40d4de[_0x664f('0x1f')]=qs[_0x664f('0x1f')](_0x1194c7[_0x664f('0x34')]['offset']);}return _0x756195['getFields'](_0x40d4de);}})[_0x664f('0x2a')](function(_0x41946c){if(_0x41946c){return _0x41946c?{'count':_0x402ccc,'rows':_0x41946c}:null;}})[_0x664f('0x2a')](respondWithResult(_0x3e47fd,null))[_0x664f('0x45')](handleError(_0x3e47fd,null));};exports[_0x664f('0x52')]=function(_0x488a22,_0x4ddff2,_0x545e75){var _0x1391b5={};var _0xcf7368={};var _0x21766b;var _0x1f9668;return db['VtigerConfiguration'][_0x664f('0x50')]({'where':{'id':_0x488a22[_0x664f('0x47')]['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x4ddff2,null))['then'](function(_0x1677b4){if(_0x1677b4){_0x21766b=_0x1677b4;_0xcf7368[_0x664f('0x33')]=_[_0x664f('0x48')](db['VtigerField']['rawAttributes']);_0xcf7368[_0x664f('0x34')]=_[_0x664f('0x48')](_0x488a22[_0x664f('0x34')]);_0xcf7368[_0x664f('0x35')]=_[_0x664f('0x36')](_0xcf7368[_0x664f('0x33')],_0xcf7368[_0x664f('0x34')]);_0x1391b5[_0x664f('0x37')]=_[_0x664f('0x36')](_0xcf7368[_0x664f('0x33')],qs[_0x664f('0x49')](_0x488a22[_0x664f('0x34')]['fields']));_0x1391b5['attributes']=_0x1391b5[_0x664f('0x37')]['length']?_0x1391b5[_0x664f('0x37')]:_0xcf7368[_0x664f('0x33')];_0x1391b5[_0x664f('0x39')]=qs[_0x664f('0x3a')](_0x488a22[_0x664f('0x34')][_0x664f('0x3a')]);_0x1391b5[_0x664f('0x3b')]=qs['filters'](_[_0x664f('0x3c')](_0x488a22[_0x664f('0x34')],_0xcf7368[_0x664f('0x35')]));if(_0x488a22[_0x664f('0x34')][_0x664f('0x3d')]){_0x1391b5['where']=_[_0x664f('0x3e')](_0x1391b5[_0x664f('0x3b')],{'$or':_[_0x664f('0x2f')](_0x1391b5[_0x664f('0x37')],function(_0x329106){var _0x410fd6={};_0x410fd6[_0x329106]={'$like':'%'+_0x488a22[_0x664f('0x34')][_0x664f('0x3d')]+'%'};return _0x410fd6;})});}_0x1391b5=_[_0x664f('0x3e')]({},_0x1391b5,_0x488a22['options']);return _0x21766b[_0x664f('0x52')](_0x1391b5);}})[_0x664f('0x2a')](function(_0xd293e){if(_0xd293e){_0x1f9668=_0xd293e[_0x664f('0x4a')];if(!_0x488a22[_0x664f('0x34')][_0x664f('0x53')]('nolimit')){_0x1391b5[_0x664f('0x22')]=qs[_0x664f('0x22')](_0x488a22[_0x664f('0x34')][_0x664f('0x22')]);_0x1391b5[_0x664f('0x1f')]=qs[_0x664f('0x1f')](_0x488a22[_0x664f('0x34')][_0x664f('0x1f')]);}return _0x21766b['getSubjects'](_0x1391b5);}})['then'](function(_0x21e658){if(_0x21e658){return _0x21e658?{'count':_0x1f9668,'rows':_0x21e658}:null;}})[_0x664f('0x2a')](respondWithResult(_0x4ddff2,null))['catch'](handleError(_0x4ddff2,null));};exports[_0x664f('0x54')]=function(_0x303e83,_0x3ccd61,_0x40f838){var _0x4fbc4d={};var _0x58f3b3={};var _0x5a63cf;var _0x5aaa4e;return db['VtigerConfiguration'][_0x664f('0x50')]({'where':{'id':_0x303e83[_0x664f('0x47')]['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x3ccd61,null))[_0x664f('0x2a')](function(_0x3bf8b0){if(_0x3bf8b0){_0x5a63cf=_0x3bf8b0;_0x58f3b3[_0x664f('0x33')]=_[_0x664f('0x48')](db['VtigerField'][_0x664f('0x30')]);_0x58f3b3[_0x664f('0x34')]=_[_0x664f('0x48')](_0x303e83[_0x664f('0x34')]);_0x58f3b3['filters']=_[_0x664f('0x36')](_0x58f3b3['model'],_0x58f3b3['query']);_0x4fbc4d[_0x664f('0x37')]=_['intersection'](_0x58f3b3[_0x664f('0x33')],qs['fields'](_0x303e83[_0x664f('0x34')][_0x664f('0x49')]));_0x4fbc4d[_0x664f('0x37')]=_0x4fbc4d[_0x664f('0x37')][_0x664f('0x4a')]?_0x4fbc4d[_0x664f('0x37')]:_0x58f3b3[_0x664f('0x33')];_0x4fbc4d['order']=qs[_0x664f('0x3a')](_0x303e83[_0x664f('0x34')]['sort']);_0x4fbc4d[_0x664f('0x3b')]=qs['filters'](_[_0x664f('0x3c')](_0x303e83[_0x664f('0x34')],_0x58f3b3[_0x664f('0x35')]));if(_0x303e83['query'][_0x664f('0x3d')]){_0x4fbc4d[_0x664f('0x3b')]=_['merge'](_0x4fbc4d['where'],{'$or':_[_0x664f('0x2f')](_0x4fbc4d[_0x664f('0x37')],function(_0x26cc04){var _0x433461={};_0x433461[_0x26cc04]={'$like':'%'+_0x303e83[_0x664f('0x34')][_0x664f('0x3d')]+'%'};return _0x433461;})});}_0x4fbc4d=_[_0x664f('0x3e')]({},_0x4fbc4d,_0x303e83[_0x664f('0x4b')]);return _0x5a63cf[_0x664f('0x54')](_0x4fbc4d);}})[_0x664f('0x2a')](function(_0x2a7f6d){if(_0x2a7f6d){_0x5aaa4e=_0x2a7f6d['length'];if(!_0x303e83['query'][_0x664f('0x53')](_0x664f('0x38'))){_0x4fbc4d[_0x664f('0x22')]=qs[_0x664f('0x22')](_0x303e83[_0x664f('0x34')][_0x664f('0x22')]);_0x4fbc4d[_0x664f('0x1f')]=qs[_0x664f('0x1f')](_0x303e83[_0x664f('0x34')][_0x664f('0x1f')]);}return _0x5a63cf[_0x664f('0x54')](_0x4fbc4d);}})[_0x664f('0x2a')](function(_0xc5caf2){if(_0xc5caf2){return _0xc5caf2?{'count':_0x5aaa4e,'rows':_0xc5caf2}:null;}})[_0x664f('0x2a')](respondWithResult(_0x3ccd61,null))[_0x664f('0x45')](handleError(_0x3ccd61,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d9bf4c5..b325eb0 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 _0xcbc8=['util','moment','bluebird','request-promise','path','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x194494,_0x57c76e){var _0x45acaf=function(_0x37e62f){while(--_0x37e62f){_0x194494['push'](_0x194494['shift']());}};_0x45acaf(++_0x57c76e);}(_0xcbc8,0xb0));var _0x8cbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbc8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8cbc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8cbc('0x1'));var BPromise=require(_0x8cbc('0x2'));var rp=require(_0x8cbc('0x3'));var fs=require('fs');var path=require(_0x8cbc('0x4'));var rimraf=require(_0x8cbc('0x5'));var config=require('../../config/environment');var attributes=require(_0x8cbc('0x6'));module[_0x8cbc('0x7')]=function(_0x1a91fd,_0x4fbd17){return _0x1a91fd[_0x8cbc('0x8')](_0x8cbc('0x9'),attributes,{'tableName':_0x8cbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd695=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x5ee504,_0x4487fc){var _0x81b927=function(_0x442b76){while(--_0x442b76){_0x5ee504['push'](_0x5ee504['shift']());}};_0x81b927(++_0x4487fc);}(_0xd695,0x1ec));var _0x5d69=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0xd695[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require(_0x5d69('0x0'));var util=require(_0x5d69('0x1'));var logger=require(_0x5d69('0x2'))(_0x5d69('0x3'));var moment=require(_0x5d69('0x4'));var BPromise=require(_0x5d69('0x5'));var rp=require(_0x5d69('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d69('0x7'));var config=require(_0x5d69('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x2f7a9c,_0x52d0d9){return _0x2f7a9c[_0x5d69('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x5d69('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 0c04bf1..77ed567 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 _0x1a74=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util'];(function(_0x3c79d1,_0x1e55d4){var _0x1646e8=function(_0x278dfe){while(--_0x278dfe){_0x3c79d1['push'](_0x3c79d1['shift']());}};_0x1646e8(++_0x1e55d4);}(_0x1a74,0x1da));var _0x41a7=function(_0x1138cd,_0x4fa9a4){_0x1138cd=_0x1138cd-0x0;var _0x5eae44=_0x1a74[_0x1138cd];return _0x5eae44;};'use strict';var _=require('lodash');var util=require(_0x41a7('0x0'));var moment=require(_0x41a7('0x1'));var BPromise=require(_0x41a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41a7('0x3'));var db=require(_0x41a7('0x4'))['db'];var utils=require(_0x41a7('0x5'));var logger=require(_0x41a7('0x6'))(_0x41a7('0x7'));var config=require('../../config/environment');var jayson=require(_0x41a7('0x8'));var client=jayson[_0x41a7('0x9')][_0x41a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a351b,_0x5df65d,_0x37b32a){return new BPromise(function(_0x17da60,_0x839d1d){return client['request'](_0x2a351b,_0x37b32a)[_0x41a7('0xb')](function(_0x29c922){logger['info'](_0x41a7('0xc'),_0x5df65d,_0x41a7('0xd'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x5df65d,_0x41a7('0xd'),JSON[_0x41a7('0xe')](_0x29c922));if(_0x29c922[_0x41a7('0xf')]){if(_0x29c922[_0x41a7('0xf')]['code']===0x1f4){logger['error'](_0x41a7('0xc'),_0x5df65d,_0x29c922[_0x41a7('0xf')][_0x41a7('0x10')]);return _0x839d1d(_0x29c922['error'][_0x41a7('0x10')]);}logger[_0x41a7('0xf')](_0x41a7('0xc'),_0x5df65d,_0x29c922[_0x41a7('0xf')][_0x41a7('0x10')]);return _0x17da60(_0x29c922[_0x41a7('0xf')][_0x41a7('0x10')]);}else{logger['info'](_0x41a7('0xc'),_0x5df65d,_0x41a7('0xd'));_0x17da60(_0x29c922[_0x41a7('0x11')][_0x41a7('0x10')]);}})[_0x41a7('0x12')](function(_0x58ead9){logger[_0x41a7('0xf')](_0x41a7('0xc'),_0x5df65d,_0x58ead9);_0x839d1d(_0x58ead9);});});} \ No newline at end of file +var _0x5cef=['../../config/logger','rpc','client','http','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x47071d,_0x337966){var _0x16ee20=function(_0x3c4075){while(--_0x3c4075){_0x47071d['push'](_0x47071d['shift']());}};_0x16ee20(++_0x337966);}(_0x5cef,0x1dc));var _0xf5ce=function(_0x595c38,_0x36d27a){_0x595c38=_0x595c38-0x0;var _0x22725f=_0x5cef[_0x595c38];return _0x22725f;};'use strict';var _=require(_0xf5ce('0x0'));var util=require(_0xf5ce('0x1'));var moment=require(_0xf5ce('0x2'));var BPromise=require(_0xf5ce('0x3'));var rs=require(_0xf5ce('0x4'));var fs=require('fs');var Redis=require(_0xf5ce('0x5'));var db=require(_0xf5ce('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5ce('0x7'))(_0xf5ce('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5ce('0x9')][_0xf5ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x488484,_0xb061c8,_0x2e020b){return new BPromise(function(_0x21211f,_0x2b7b32){return client['request'](_0x488484,_0x2e020b)[_0xf5ce('0xb')](function(_0x1ea863){logger[_0xf5ce('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0xb061c8,_0xf5ce('0xd'));logger[_0xf5ce('0xe')](_0xf5ce('0xf'),_0xb061c8,_0xf5ce('0xd'),JSON[_0xf5ce('0x10')](_0x1ea863));if(_0x1ea863[_0xf5ce('0x11')]){if(_0x1ea863[_0xf5ce('0x11')]['code']===0x1f4){logger['error'](_0xf5ce('0x12'),_0xb061c8,_0x1ea863['error'][_0xf5ce('0x13')]);return _0x2b7b32(_0x1ea863['error'][_0xf5ce('0x13')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xb061c8,_0x1ea863[_0xf5ce('0x11')][_0xf5ce('0x13')]);return _0x21211f(_0x1ea863[_0xf5ce('0x11')][_0xf5ce('0x13')]);}else{logger[_0xf5ce('0xc')](_0xf5ce('0x12'),_0xb061c8,_0xf5ce('0xd'));_0x21211f(_0x1ea863['result']['message']);}})[_0xf5ce('0x14')](function(_0x1af59f){logger[_0xf5ce('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0xb061c8,_0x1af59f);_0x2b7b32(_0x1af59f);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 969d046..ed5e376 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 _0x1009=['delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x32ba59,_0x5e101f){var _0x343029=function(_0x482901){while(--_0x482901){_0x32ba59['push'](_0x32ba59['shift']());}};_0x343029(++_0x5e101f);}(_0x1009,0x183));var _0x9100=function(_0x107bfe,_0xf91c9c){_0x107bfe=_0x107bfe-0x0;var _0x227a7c=_0x1009[_0x107bfe];return _0x227a7c;};'use strict';var multer=require(_0x9100('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9100('0x1'));var express=require(_0x9100('0x2'));var router=express['Router']();var fs_extra=require(_0x9100('0x3'));var auth=require(_0x9100('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x9100('0x5')]('/',auth[_0x9100('0x6')](),controller['index']);router[_0x9100('0x5')](_0x9100('0x7'),auth[_0x9100('0x6')](),controller[_0x9100('0x8')]);router[_0x9100('0x9')]('/',auth[_0x9100('0x6')](),controller[_0x9100('0xa')]);router[_0x9100('0xb')](_0x9100('0x7'),auth[_0x9100('0x6')](),controller[_0x9100('0xc')]);router[_0x9100('0xd')](_0x9100('0x7'),auth[_0x9100('0x6')](),controller[_0x9100('0xe')]);module[_0x9100('0xf')]=router; \ No newline at end of file +var _0x6085=['update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x22173e,_0x4732dd){var _0x1a0b7a=function(_0x5a6447){while(--_0x5a6447){_0x22173e['push'](_0x22173e['shift']());}};_0x1a0b7a(++_0x4732dd);}(_0x6085,0xd4));var _0x5608=function(_0x78b208,_0x24aa3c){_0x78b208=_0x78b208-0x0;var _0x2faab0=_0x6085[_0x78b208];return _0x2faab0;};'use strict';var multer=require(_0x5608('0x0'));var util=require(_0x5608('0x1'));var path=require('path');var timeout=require(_0x5608('0x2'));var express=require(_0x5608('0x3'));var router=express[_0x5608('0x4')]();var fs_extra=require(_0x5608('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5608('0x6'));var config=require(_0x5608('0x7'));var controller=require(_0x5608('0x8'));router[_0x5608('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5608('0x9')](_0x5608('0xa'),auth[_0x5608('0xb')](),controller[_0x5608('0xc')]);router[_0x5608('0xd')]('/',auth[_0x5608('0xb')](),controller[_0x5608('0xe')]);router[_0x5608('0xf')](_0x5608('0xa'),auth[_0x5608('0xb')](),controller[_0x5608('0x10')]);router['delete'](_0x5608('0xa'),auth[_0x5608('0xb')](),controller[_0x5608('0x11')]);module[_0x5608('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c9511dc..7102a4b 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 _0x066f=['exports','ENUM','variable','keyValue','picklist','string','STRING','customVariable','BOOLEAN'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x066f,0x195));var _0xf066=function(_0x5edc42,_0x4bd24f){_0x5edc42=_0x5edc42-0x0;var _0x7757cd=_0x066f[_0x5edc42];return _0x7757cd;};'use strict';var Sequelize=require('sequelize');module[_0xf066('0x0')]={'type':{'type':Sequelize[_0xf066('0x1')]('string',_0xf066('0x2'),'customVariable',_0xf066('0x3'),_0xf066('0x4')),'defaultValue':_0xf066('0x5')},'content':{'type':Sequelize[_0xf066('0x6')]},'key':{'type':Sequelize[_0xf066('0x6')]},'keyType':{'type':Sequelize[_0xf066('0x1')](_0xf066('0x5'),_0xf066('0x2'),_0xf066('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf066('0x6')]},'nameField':{'type':Sequelize[_0xf066('0x6')]},'customField':{'type':Sequelize[_0xf066('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x133a=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x3226aa,_0x10e43e){var _0x16a6cb=function(_0x58c87c){while(--_0x58c87c){_0x3226aa['push'](_0x3226aa['shift']());}};_0x16a6cb(++_0x10e43e);}(_0x133a,0xb8));var _0xa133=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0x133a[_0x90f34f];return _0x4b18cf;};'use strict';var Sequelize=require(_0xa133('0x0'));module[_0xa133('0x1')]={'type':{'type':Sequelize[_0xa133('0x2')](_0xa133('0x3'),_0xa133('0x4'),_0xa133('0x5'),_0xa133('0x6'),'picklist'),'defaultValue':_0xa133('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa133('0x3'),_0xa133('0x4'),_0xa133('0x5'))},'keyContent':{'type':Sequelize[_0xa133('0x7')]},'idField':{'type':Sequelize[_0xa133('0x7')]},'nameField':{'type':Sequelize[_0xa133('0x7')]},'customField':{'type':Sequelize[_0xa133('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa133('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index d3116e8..5c168e6 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 _0xfe38=['stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','include','VtigerField','findAll','rows','show','params','includeAll','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','end'];(function(_0x4e336a,_0x5d3666){var _0x3f8f1d=function(_0x208edd){while(--_0x208edd){_0x4e336a['push'](_0x4e336a['shift']());}};_0x3f8f1d(++_0x5d3666);}(_0xfe38,0x1bf));var _0x8fe3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfe38[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x8fe3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8fe3('0x1'));var jsonpatch=require(_0x8fe3('0x2'));var rp=require(_0x8fe3('0x3'));var moment=require(_0x8fe3('0x4'));var BPromise=require(_0x8fe3('0x5'));var Mustache=require(_0x8fe3('0x6'));var util=require(_0x8fe3('0x7'));var path=require(_0x8fe3('0x8'));var sox=require(_0x8fe3('0x9'));var csv=require(_0x8fe3('0xa'));var ejs=require(_0x8fe3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8fe3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8fe3('0xa'));var querystring=require(_0x8fe3('0xd'));var Papa=require('papaparse');var Redis=require(_0x8fe3('0xe'));var authService=require(_0x8fe3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8fe3('0x10'));var hardwareService=require(_0x8fe3('0x11'));var logger=require(_0x8fe3('0x12'))(_0x8fe3('0x13'));var utils=require(_0x8fe3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8fe3('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xba30fb,_0x5761c1){_0x5761c1=_0x5761c1||0xcc;return function(_0x31d963){if(_0x31d963){return _0xba30fb[_0x8fe3('0x16')](_0x5761c1);}return _0xba30fb[_0x8fe3('0x17')](_0x5761c1)['end']();};}function respondWithResult(_0x4e2ba2,_0x3a1426){_0x3a1426=_0x3a1426||0xc8;return function(_0x19b57b){if(_0x19b57b){return _0x4e2ba2[_0x8fe3('0x17')](_0x3a1426)['json'](_0x19b57b);}};}function respondWithFilteredResult(_0x4183fa,_0x2c633a){return function(_0x32d8f7){if(_0x32d8f7){var _0x172810=typeof _0x2c633a['offset']===_0x8fe3('0x18')&&typeof _0x2c633a[_0x8fe3('0x19')]===_0x8fe3('0x18');var _0x14b128=_0x32d8f7[_0x8fe3('0x1a')];var _0x490f38=_0x172810?0x0:_0x2c633a['offset'];var _0x32e1e0=_0x172810?_0x32d8f7['count']:_0x2c633a[_0x8fe3('0x1b')]+_0x2c633a[_0x8fe3('0x19')];var _0x298395;if(_0x32e1e0>=_0x14b128){_0x32e1e0=_0x14b128;_0x298395=0xc8;}else{_0x298395=0xce;}_0x4183fa[_0x8fe3('0x17')](_0x298395);return _0x4183fa[_0x8fe3('0x1c')](_0x8fe3('0x1d'),_0x490f38+'-'+_0x32e1e0+'/'+_0x14b128)[_0x8fe3('0x1e')](_0x32d8f7);}return null;};}function patchUpdates(_0x1de98f){return function(_0xac52ab){try{jsonpatch[_0x8fe3('0x1f')](_0xac52ab,_0x1de98f,!![]);}catch(_0x444538){return BPromise[_0x8fe3('0x20')](_0x444538);}return _0xac52ab['save']();};}function saveUpdates(_0x12ab5b,_0x5deb4a){return function(_0x560e9d){if(_0x560e9d){return _0x560e9d[_0x8fe3('0x21')](_0x12ab5b)['then'](function(_0x118947){return _0x118947;});}return null;};}function removeEntity(_0x392174,_0x3c7046){return function(_0x1776d6){if(_0x1776d6){return _0x1776d6['destroy']()[_0x8fe3('0x22')](function(){_0x392174[_0x8fe3('0x17')](0xcc)[_0x8fe3('0x23')]();});}};}function handleEntityNotFound(_0x49e794,_0x2d9880){return function(_0x222b33){if(!_0x222b33){_0x49e794[_0x8fe3('0x16')](0x194);}return _0x222b33;};}function handleError(_0x386b90,_0x2c7ef3){_0x2c7ef3=_0x2c7ef3||0x1f4;return function(_0x1aa8db){logger['error'](_0x1aa8db[_0x8fe3('0x24')]);if(_0x1aa8db[_0x8fe3('0x25')]){delete _0x1aa8db['name'];}_0x386b90['status'](_0x2c7ef3)['send'](_0x1aa8db);};}exports[_0x8fe3('0x26')]=function(_0x315307,_0x5b86a6){var _0x41b9b4={},_0x4bc2b5={},_0x5902fd={'count':0x0,'rows':[]};var _0x527ce4=_[_0x8fe3('0x27')](db['VtigerField']['rawAttributes'],function(_0x41caf1){return{'name':_0x41caf1[_0x8fe3('0x28')],'type':_0x41caf1[_0x8fe3('0x29')][_0x8fe3('0x2a')]};});_0x4bc2b5[_0x8fe3('0x2b')]=_[_0x8fe3('0x27')](_0x527ce4,_0x8fe3('0x25'));_0x4bc2b5[_0x8fe3('0x2c')]=_[_0x8fe3('0x2d')](_0x315307[_0x8fe3('0x2c')]);_0x4bc2b5[_0x8fe3('0x2e')]=_['intersection'](_0x4bc2b5['model'],_0x4bc2b5[_0x8fe3('0x2c')]);_0x41b9b4[_0x8fe3('0x2f')]=_[_0x8fe3('0x30')](_0x4bc2b5[_0x8fe3('0x2b')],qs[_0x8fe3('0x31')](_0x315307[_0x8fe3('0x2c')][_0x8fe3('0x31')]));_0x41b9b4['attributes']=_0x41b9b4[_0x8fe3('0x2f')][_0x8fe3('0x32')]?_0x41b9b4['attributes']:_0x4bc2b5[_0x8fe3('0x2b')];if(!_0x315307[_0x8fe3('0x2c')]['hasOwnProperty'](_0x8fe3('0x33'))){_0x41b9b4[_0x8fe3('0x19')]=qs[_0x8fe3('0x19')](_0x315307['query'][_0x8fe3('0x19')]);_0x41b9b4[_0x8fe3('0x1b')]=qs[_0x8fe3('0x1b')](_0x315307[_0x8fe3('0x2c')][_0x8fe3('0x1b')]);}_0x41b9b4[_0x8fe3('0x34')]=qs['sort'](_0x315307['query']['sort']);_0x41b9b4['where']=qs[_0x8fe3('0x2e')](_[_0x8fe3('0x35')](_0x315307[_0x8fe3('0x2c')],_0x4bc2b5[_0x8fe3('0x2e')]),_0x527ce4);if(_0x315307['query'][_0x8fe3('0x36')]){_0x41b9b4[_0x8fe3('0x37')]=_[_0x8fe3('0x38')](_0x41b9b4[_0x8fe3('0x37')],{'$or':_[_0x8fe3('0x27')](_0x527ce4,function(_0x819716){if(_0x819716[_0x8fe3('0x29')]!==_0x8fe3('0x39')){var _0x2e3d3a={};_0x2e3d3a[_0x819716[_0x8fe3('0x25')]]={'$like':'%'+_0x315307['query'][_0x8fe3('0x36')]+'%'};return _0x2e3d3a;}})});}_0x41b9b4=_['merge']({},_0x41b9b4,_0x315307['options']);var _0x230b54={'where':_0x41b9b4[_0x8fe3('0x37')]};return db['VtigerField'][_0x8fe3('0x1a')](_0x230b54)['then'](function(_0x5a553e){_0x5902fd[_0x8fe3('0x1a')]=_0x5a553e;if(_0x315307['query']['includeAll']){_0x41b9b4[_0x8fe3('0x3a')]=[{'all':!![]}];}return db[_0x8fe3('0x3b')][_0x8fe3('0x3c')](_0x41b9b4);})[_0x8fe3('0x22')](function(_0x5e0c58){_0x5902fd[_0x8fe3('0x3d')]=_0x5e0c58;return _0x5902fd;})[_0x8fe3('0x22')](respondWithFilteredResult(_0x5b86a6,_0x41b9b4))['catch'](handleError(_0x5b86a6,null));};exports[_0x8fe3('0x3e')]=function(_0x258502,_0x1fc5b5){var _0x3acd9b={'raw':!![],'where':{'id':_0x258502[_0x8fe3('0x3f')]['id']}},_0x137fe7={};_0x137fe7[_0x8fe3('0x2b')]=_[_0x8fe3('0x2d')](db['VtigerField']['rawAttributes']);_0x137fe7['query']=_[_0x8fe3('0x2d')](_0x258502['query']);_0x137fe7[_0x8fe3('0x2e')]=_['intersection'](_0x137fe7['model'],_0x137fe7[_0x8fe3('0x2c')]);_0x3acd9b['attributes']=_[_0x8fe3('0x30')](_0x137fe7[_0x8fe3('0x2b')],qs[_0x8fe3('0x31')](_0x258502[_0x8fe3('0x2c')]['fields']));_0x3acd9b[_0x8fe3('0x2f')]=_0x3acd9b['attributes'][_0x8fe3('0x32')]?_0x3acd9b[_0x8fe3('0x2f')]:_0x137fe7[_0x8fe3('0x2b')];if(_0x258502[_0x8fe3('0x2c')][_0x8fe3('0x40')]){_0x3acd9b[_0x8fe3('0x3a')]=[{'all':!![]}];}_0x3acd9b=_[_0x8fe3('0x38')]({},_0x3acd9b,_0x258502['options']);return db[_0x8fe3('0x3b')]['find'](_0x3acd9b)['then'](handleEntityNotFound(_0x1fc5b5,null))['then'](respondWithResult(_0x1fc5b5,null))[_0x8fe3('0x41')](handleError(_0x1fc5b5,null));};exports[_0x8fe3('0x42')]=function(_0x15ea0c,_0x31ed53){return db['VtigerField'][_0x8fe3('0x42')](_0x15ea0c['body'],{})[_0x8fe3('0x22')](respondWithResult(_0x31ed53,0xc9))[_0x8fe3('0x41')](handleError(_0x31ed53,null));};exports['update']=function(_0x2c5415,_0xfe1b8d){if(_0x2c5415[_0x8fe3('0x43')]['id']){delete _0x2c5415[_0x8fe3('0x43')]['id'];}return db['VtigerField'][_0x8fe3('0x44')]({'where':{'id':_0x2c5415[_0x8fe3('0x3f')]['id']}})['then'](handleEntityNotFound(_0xfe1b8d,null))['then'](saveUpdates(_0x2c5415[_0x8fe3('0x43')],null))[_0x8fe3('0x22')](respondWithResult(_0xfe1b8d,null))['catch'](handleError(_0xfe1b8d,null));};exports['destroy']=function(_0x4cab5a,_0x399036){return db[_0x8fe3('0x3b')][_0x8fe3('0x44')]({'where':{'id':_0x4cab5a[_0x8fe3('0x3f')]['id']}})[_0x8fe3('0x22')](handleEntityNotFound(_0x399036,null))[_0x8fe3('0x22')](removeEntity(_0x399036,null))[_0x8fe3('0x41')](handleError(_0x399036,null));}; \ No newline at end of file +var _0xcd56=['limit','count','set','apply','reject','update','then','destroy','error','name','index','map','VtigerField','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','rawAttributes','options','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x45da62,_0x4ef271){var _0x58f420=function(_0x2b0483){while(--_0x2b0483){_0x45da62['push'](_0x45da62['shift']());}};_0x58f420(++_0x4ef271);}(_0xcd56,0x70));var _0x6cd5=function(_0x58837f,_0x3ff290){_0x58837f=_0x58837f-0x0;var _0x46a870=_0xcd56[_0x58837f];return _0x46a870;};'use strict';var emlformat=require(_0x6cd5('0x0'));var rimraf=require(_0x6cd5('0x1'));var zipdir=require(_0x6cd5('0x2'));var jsonpatch=require(_0x6cd5('0x3'));var rp=require(_0x6cd5('0x4'));var moment=require(_0x6cd5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cd5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6cd5('0x7'));var ejs=require(_0x6cd5('0x8'));var fs=require('fs');var fs_extra=require(_0x6cd5('0x9'));var _=require(_0x6cd5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6cd5('0xb'));var deskjs=require(_0x6cd5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6cd5('0xd'));var Redis=require(_0x6cd5('0xe'));var authService=require(_0x6cd5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6cd5('0x10'));var hardwareService=require(_0x6cd5('0x11'));var logger=require('../../config/logger')(_0x6cd5('0x12'));var utils=require('../../config/utils');var config=require(_0x6cd5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6cd5('0x14'))['db'];function respondWithStatusCode(_0x2e9c58,_0x2c2944){_0x2c2944=_0x2c2944||0xcc;return function(_0x5b5fa6){if(_0x5b5fa6){return _0x2e9c58[_0x6cd5('0x15')](_0x2c2944);}return _0x2e9c58[_0x6cd5('0x16')](_0x2c2944)[_0x6cd5('0x17')]();};}function respondWithResult(_0x2315bc,_0x5c3644){_0x5c3644=_0x5c3644||0xc8;return function(_0x1094b2){if(_0x1094b2){return _0x2315bc[_0x6cd5('0x16')](_0x5c3644)['json'](_0x1094b2);}};}function respondWithFilteredResult(_0x2da6d3,_0x401efa){return function(_0x1149da){if(_0x1149da){var _0x360bb0=typeof _0x401efa[_0x6cd5('0x18')]===_0x6cd5('0x19')&&typeof _0x401efa[_0x6cd5('0x1a')]===_0x6cd5('0x19');var _0x7dedfb=_0x1149da[_0x6cd5('0x1b')];var _0x3437a1=_0x360bb0?0x0:_0x401efa[_0x6cd5('0x18')];var _0xfc36d2=_0x360bb0?_0x1149da[_0x6cd5('0x1b')]:_0x401efa[_0x6cd5('0x18')]+_0x401efa[_0x6cd5('0x1a')];var _0x438b62;if(_0xfc36d2>=_0x7dedfb){_0xfc36d2=_0x7dedfb;_0x438b62=0xc8;}else{_0x438b62=0xce;}_0x2da6d3['status'](_0x438b62);return _0x2da6d3[_0x6cd5('0x1c')]('Content-Range',_0x3437a1+'-'+_0xfc36d2+'/'+_0x7dedfb)['json'](_0x1149da);}return null;};}function patchUpdates(_0x486978){return function(_0x1804ba){try{jsonpatch[_0x6cd5('0x1d')](_0x1804ba,_0x486978,!![]);}catch(_0x156250){return BPromise[_0x6cd5('0x1e')](_0x156250);}return _0x1804ba['save']();};}function saveUpdates(_0x5aca29,_0xb06159){return function(_0x484cf8){if(_0x484cf8){return _0x484cf8[_0x6cd5('0x1f')](_0x5aca29)[_0x6cd5('0x20')](function(_0x42a81f){return _0x42a81f;});}return null;};}function removeEntity(_0x1169c8,_0x4a106d){return function(_0x1b9d02){if(_0x1b9d02){return _0x1b9d02[_0x6cd5('0x21')]()[_0x6cd5('0x20')](function(){_0x1169c8[_0x6cd5('0x16')](0xcc)[_0x6cd5('0x17')]();});}};}function handleEntityNotFound(_0x37511e,_0x5a35ee){return function(_0x3e8513){if(!_0x3e8513){_0x37511e[_0x6cd5('0x15')](0x194);}return _0x3e8513;};}function handleError(_0x52e812,_0x4d1a0d){_0x4d1a0d=_0x4d1a0d||0x1f4;return function(_0x4630c8){logger[_0x6cd5('0x22')](_0x4630c8['stack']);if(_0x4630c8[_0x6cd5('0x23')]){delete _0x4630c8['name'];}_0x52e812[_0x6cd5('0x16')](_0x4d1a0d)['send'](_0x4630c8);};}exports[_0x6cd5('0x24')]=function(_0x52344c,_0x32ff66){var _0x6b8273={},_0x3209bb={},_0x4e2469={'count':0x0,'rows':[]};var _0x4138a4=_[_0x6cd5('0x25')](db[_0x6cd5('0x26')]['rawAttributes'],function(_0x2cff30){return{'name':_0x2cff30[_0x6cd5('0x27')],'type':_0x2cff30[_0x6cd5('0x28')][_0x6cd5('0x29')]};});_0x3209bb['model']=_[_0x6cd5('0x25')](_0x4138a4,_0x6cd5('0x23'));_0x3209bb['query']=_[_0x6cd5('0x2a')](_0x52344c[_0x6cd5('0x2b')]);_0x3209bb[_0x6cd5('0x2c')]=_[_0x6cd5('0x2d')](_0x3209bb[_0x6cd5('0x2e')],_0x3209bb['query']);_0x6b8273[_0x6cd5('0x2f')]=_[_0x6cd5('0x2d')](_0x3209bb[_0x6cd5('0x2e')],qs[_0x6cd5('0x30')](_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x30')]));_0x6b8273[_0x6cd5('0x2f')]=_0x6b8273[_0x6cd5('0x2f')][_0x6cd5('0x31')]?_0x6b8273[_0x6cd5('0x2f')]:_0x3209bb[_0x6cd5('0x2e')];if(!_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x32')](_0x6cd5('0x33'))){_0x6b8273[_0x6cd5('0x1a')]=qs[_0x6cd5('0x1a')](_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x1a')]);_0x6b8273[_0x6cd5('0x18')]=qs[_0x6cd5('0x18')](_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x18')]);}_0x6b8273[_0x6cd5('0x34')]=qs['sort'](_0x52344c['query'][_0x6cd5('0x35')]);_0x6b8273['where']=qs[_0x6cd5('0x2c')](_['pick'](_0x52344c[_0x6cd5('0x2b')],_0x3209bb['filters']),_0x4138a4);if(_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x36')]){_0x6b8273[_0x6cd5('0x37')]=_['merge'](_0x6b8273[_0x6cd5('0x37')],{'$or':_[_0x6cd5('0x25')](_0x4138a4,function(_0x1f9751){if(_0x1f9751[_0x6cd5('0x28')]!==_0x6cd5('0x38')){var _0x46176f={};_0x46176f[_0x1f9751[_0x6cd5('0x23')]]={'$like':'%'+_0x52344c['query'][_0x6cd5('0x36')]+'%'};return _0x46176f;}})});}_0x6b8273=_[_0x6cd5('0x39')]({},_0x6b8273,_0x52344c['options']);var _0x1cf668={'where':_0x6b8273[_0x6cd5('0x37')]};return db['VtigerField']['count'](_0x1cf668)[_0x6cd5('0x20')](function(_0x319355){_0x4e2469[_0x6cd5('0x1b')]=_0x319355;if(_0x52344c['query'][_0x6cd5('0x3a')]){_0x6b8273[_0x6cd5('0x3b')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x6b8273);})['then'](function(_0x344e71){_0x4e2469[_0x6cd5('0x3c')]=_0x344e71;return _0x4e2469;})[_0x6cd5('0x20')](respondWithFilteredResult(_0x32ff66,_0x6b8273))[_0x6cd5('0x3d')](handleError(_0x32ff66,null));};exports[_0x6cd5('0x3e')]=function(_0x165aa6,_0x42d0af){var _0x4bc58e={'raw':!![],'where':{'id':_0x165aa6['params']['id']}},_0x40fd4d={};_0x40fd4d[_0x6cd5('0x2e')]=_[_0x6cd5('0x2a')](db[_0x6cd5('0x26')][_0x6cd5('0x3f')]);_0x40fd4d[_0x6cd5('0x2b')]=_[_0x6cd5('0x2a')](_0x165aa6[_0x6cd5('0x2b')]);_0x40fd4d[_0x6cd5('0x2c')]=_[_0x6cd5('0x2d')](_0x40fd4d['model'],_0x40fd4d[_0x6cd5('0x2b')]);_0x4bc58e['attributes']=_[_0x6cd5('0x2d')](_0x40fd4d[_0x6cd5('0x2e')],qs['fields'](_0x165aa6[_0x6cd5('0x2b')][_0x6cd5('0x30')]));_0x4bc58e[_0x6cd5('0x2f')]=_0x4bc58e[_0x6cd5('0x2f')][_0x6cd5('0x31')]?_0x4bc58e[_0x6cd5('0x2f')]:_0x40fd4d['model'];if(_0x165aa6['query']['includeAll']){_0x4bc58e['include']=[{'all':!![]}];}_0x4bc58e=_[_0x6cd5('0x39')]({},_0x4bc58e,_0x165aa6[_0x6cd5('0x40')]);return db[_0x6cd5('0x26')]['find'](_0x4bc58e)[_0x6cd5('0x20')](handleEntityNotFound(_0x42d0af,null))['then'](respondWithResult(_0x42d0af,null))[_0x6cd5('0x3d')](handleError(_0x42d0af,null));};exports[_0x6cd5('0x41')]=function(_0x2f8618,_0x4c6138){return db['VtigerField']['create'](_0x2f8618[_0x6cd5('0x42')],{})[_0x6cd5('0x20')](respondWithResult(_0x4c6138,0xc9))['catch'](handleError(_0x4c6138,null));};exports[_0x6cd5('0x1f')]=function(_0x627df8,_0x3e92ed){if(_0x627df8[_0x6cd5('0x42')]['id']){delete _0x627df8[_0x6cd5('0x42')]['id'];}return db['VtigerField'][_0x6cd5('0x43')]({'where':{'id':_0x627df8[_0x6cd5('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e92ed,null))['then'](saveUpdates(_0x627df8['body'],null))[_0x6cd5('0x20')](respondWithResult(_0x3e92ed,null))[_0x6cd5('0x3d')](handleError(_0x3e92ed,null));};exports[_0x6cd5('0x21')]=function(_0x7b588f,_0x355aba){return db[_0x6cd5('0x26')][_0x6cd5('0x43')]({'where':{'id':_0x7b588f[_0x6cd5('0x44')]['id']}})[_0x6cd5('0x20')](handleEntityNotFound(_0x355aba,null))[_0x6cd5('0x20')](removeEntity(_0x355aba,null))[_0x6cd5('0x3d')](handleError(_0x355aba,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 594dfab..249084a 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 _0xcc40=['vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerField.attributes','define','int_vtiger_fields'];(function(_0x2f2d7a,_0x2a0cc1){var _0x4ddf28=function(_0x296b19){while(--_0x296b19){_0x2f2d7a['push'](_0x2f2d7a['shift']());}};_0x4ddf28(++_0x2a0cc1);}(_0xcc40,0x1a3));var _0x0cc4=function(_0x5d7831,_0xe411a2){_0x5d7831=_0x5d7831-0x0;var _0x450a14=_0xcc40[_0x5d7831];return _0x450a14;};'use strict';var _=require('lodash');var util=require(_0x0cc4('0x0'));var logger=require(_0x0cc4('0x1'))(_0x0cc4('0x2'));var moment=require(_0x0cc4('0x3'));var BPromise=require(_0x0cc4('0x4'));var rp=require(_0x0cc4('0x5'));var fs=require('fs');var path=require(_0x0cc4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0cc4('0x7'));module['exports']=function(_0x2664d3,_0xc72492){return _0x2664d3[_0x0cc4('0x8')]('VtigerField',attributes,{'tableName':_0x0cc4('0x9'),'paranoid':![],'indexes':[{'name':_0x0cc4('0xa'),'fields':[_0x0cc4('0xb'),_0x0cc4('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8179=['int_vtiger_fields','vtiger_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x8179,0x9c));var _0x9817=function(_0x3f963c,_0x8f0b80){_0x3f963c=_0x3f963c-0x0;var _0x53753b=_0x8179[_0x3f963c];return _0x53753b;};'use strict';var _=require(_0x9817('0x0'));var util=require(_0x9817('0x1'));var logger=require(_0x9817('0x2'))(_0x9817('0x3'));var moment=require(_0x9817('0x4'));var BPromise=require(_0x9817('0x5'));var rp=require(_0x9817('0x6'));var fs=require('fs');var path=require(_0x9817('0x7'));var rimraf=require(_0x9817('0x8'));var config=require(_0x9817('0x9'));var attributes=require('./intVtigerField.attributes');module[_0x9817('0xa')]=function(_0x32e1c0,_0x26752f){return _0x32e1c0[_0x9817('0xb')]('VtigerField',attributes,{'tableName':_0x9817('0xc'),'paranoid':![],'indexes':[{'name':_0x9817('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 74d287e..9dab528 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 _0xf19d=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5babe2,_0x2e64fa){var _0x42b9ec=function(_0x11c2ef){while(--_0x11c2ef){_0x5babe2['push'](_0x5babe2['shift']());}};_0x42b9ec(++_0x2e64fa);}(_0xf19d,0x164));var _0xdf19=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xf19d[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0xdf19('0x0'));var util=require(_0xdf19('0x1'));var moment=require(_0xdf19('0x2'));var BPromise=require(_0xdf19('0x3'));var rs=require(_0xdf19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf19('0x5'));var logger=require('../../config/logger')(_0xdf19('0x6'));var config=require(_0xdf19('0x7'));var jayson=require(_0xdf19('0x8'));var client=jayson[_0xdf19('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33fab6,_0x79b9d5,_0xb93039){return new BPromise(function(_0x5eae63,_0x2ac56e){return client[_0xdf19('0xa')](_0x33fab6,_0xb93039)['then'](function(_0x41bf59){logger['info'](_0xdf19('0xb'),_0x79b9d5,_0xdf19('0xc'));logger[_0xdf19('0xd')](_0xdf19('0xe'),_0x79b9d5,'request\x20sent',JSON[_0xdf19('0xf')](_0x41bf59));if(_0x41bf59[_0xdf19('0x10')]){if(_0x41bf59[_0xdf19('0x10')][_0xdf19('0x11')]===0x1f4){logger[_0xdf19('0x10')](_0xdf19('0xb'),_0x79b9d5,_0x41bf59[_0xdf19('0x10')][_0xdf19('0x12')]);return _0x2ac56e(_0x41bf59[_0xdf19('0x10')][_0xdf19('0x12')]);}logger[_0xdf19('0x10')](_0xdf19('0xb'),_0x79b9d5,_0x41bf59['error'][_0xdf19('0x12')]);return _0x5eae63(_0x41bf59[_0xdf19('0x10')][_0xdf19('0x12')]);}else{logger[_0xdf19('0x13')](_0xdf19('0xb'),_0x79b9d5,_0xdf19('0xc'));_0x5eae63(_0x41bf59[_0xdf19('0x14')][_0xdf19('0x12')]);}})[_0xdf19('0x15')](function(_0xb1a50b){logger[_0xdf19('0x10')]('VtigerField,\x20%s,\x20%s',_0x79b9d5,_0xb1a50b);_0x2ac56e(_0xb1a50b);});});} \ No newline at end of file +var _0x6eaf=['util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x6eaf,0xe5));var _0xf6ea=function(_0x18bf88,_0x4b490e){_0x18bf88=_0x18bf88-0x0;var _0x2bfb07=_0x6eaf[_0x18bf88];return _0x2bfb07;};'use strict';var _=require(_0xf6ea('0x0'));var util=require(_0xf6ea('0x1'));var moment=require(_0xf6ea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6ea('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6ea('0x4'))(_0xf6ea('0x5'));var config=require(_0xf6ea('0x6'));var jayson=require(_0xf6ea('0x7'));var client=jayson[_0xf6ea('0x8')][_0xf6ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26aba6,_0x142f30,_0x86aaac){return new BPromise(function(_0x38b9d6,_0x312f69){return client[_0xf6ea('0xa')](_0x26aba6,_0x86aaac)[_0xf6ea('0xb')](function(_0x5df9e1){logger['info'](_0xf6ea('0xc'),_0x142f30,_0xf6ea('0xd'));logger[_0xf6ea('0xe')](_0xf6ea('0xf'),_0x142f30,_0xf6ea('0xd'),JSON[_0xf6ea('0x10')](_0x5df9e1));if(_0x5df9e1[_0xf6ea('0x11')]){if(_0x5df9e1['error'][_0xf6ea('0x12')]===0x1f4){logger[_0xf6ea('0x11')](_0xf6ea('0xc'),_0x142f30,_0x5df9e1['error'][_0xf6ea('0x13')]);return _0x312f69(_0x5df9e1[_0xf6ea('0x11')]['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x142f30,_0x5df9e1[_0xf6ea('0x11')][_0xf6ea('0x13')]);return _0x38b9d6(_0x5df9e1[_0xf6ea('0x11')]['message']);}else{logger[_0xf6ea('0x14')](_0xf6ea('0xc'),_0x142f30,'request\x20sent');_0x38b9d6(_0x5df9e1[_0xf6ea('0x15')][_0xf6ea('0x13')]);}})[_0xf6ea('0x16')](function(_0x8cd237){logger[_0xf6ea('0x11')](_0xf6ea('0xc'),_0x142f30,_0x8cd237);_0x312f69(_0x8cd237);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index fd7ec06..0de54c8 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 _0xbc7b=['get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x470d22,_0x1b6a4f){var _0x3cc44d=function(_0x4a3749){while(--_0x4a3749){_0x470d22['push'](_0x470d22['shift']());}};_0x3cc44d(++_0x1b6a4f);}(_0xbc7b,0xaf));var _0xbbc7=function(_0x33aa93,_0x1a9182){_0x33aa93=_0x33aa93-0x0;var _0x279566=_0xbc7b[_0x33aa93];return _0x279566;};'use strict';var multer=require(_0xbbc7('0x0'));var util=require('util');var path=require(_0xbbc7('0x1'));var timeout=require(_0xbbc7('0x2'));var express=require(_0xbbc7('0x3'));var router=express['Router']();var fs_extra=require(_0xbbc7('0x4'));var auth=require(_0xbbc7('0x5'));var interaction=require(_0xbbc7('0x6'));var config=require(_0xbbc7('0x7'));var controller=require(_0xbbc7('0x8'));router[_0xbbc7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbbc7('0x9')](_0xbbc7('0xa'),auth[_0xbbc7('0xb')](),controller[_0xbbc7('0xc')]);router[_0xbbc7('0x9')](_0xbbc7('0xd'),auth['isAuthenticated'](),controller[_0xbbc7('0xe')]);router[_0xbbc7('0x9')](_0xbbc7('0xf'),auth['isAuthenticated'](),controller[_0xbbc7('0x10')]);router[_0xbbc7('0x11')]('/',auth[_0xbbc7('0xb')](),controller[_0xbbc7('0x12')]);router[_0xbbc7('0x11')](_0xbbc7('0xd'),auth[_0xbbc7('0xb')](),controller[_0xbbc7('0x13')]);router[_0xbbc7('0x14')](_0xbbc7('0xa'),auth[_0xbbc7('0xb')](),controller['update']);router[_0xbbc7('0x15')]('/:id',auth[_0xbbc7('0xb')](),controller['destroy']);module[_0xbbc7('0x16')]=router; \ No newline at end of file +var _0x6aba=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x21095,_0x15034d){var _0x47a0d9=function(_0x97a490){while(--_0x97a490){_0x21095['push'](_0x21095['shift']());}};_0x47a0d9(++_0x15034d);}(_0x6aba,0x152));var _0xa6ab=function(_0x333b10,_0x4adc45){_0x333b10=_0x333b10-0x0;var _0x13773b=_0x6aba[_0x333b10];return _0x13773b;};'use strict';var multer=require(_0xa6ab('0x0'));var util=require(_0xa6ab('0x1'));var path=require(_0xa6ab('0x2'));var timeout=require(_0xa6ab('0x3'));var express=require(_0xa6ab('0x4'));var router=express[_0xa6ab('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa6ab('0x6'));var interaction=require(_0xa6ab('0x7'));var config=require(_0xa6ab('0x8'));var controller=require(_0xa6ab('0x9'));router[_0xa6ab('0xa')]('/',auth[_0xa6ab('0xb')](),controller[_0xa6ab('0xc')]);router[_0xa6ab('0xa')](_0xa6ab('0xd'),auth['isAuthenticated'](),controller[_0xa6ab('0xe')]);router['get'](_0xa6ab('0xf'),auth['isAuthenticated'](),controller[_0xa6ab('0x10')]);router[_0xa6ab('0xa')](_0xa6ab('0x11'),auth[_0xa6ab('0xb')](),controller['getFields']);router[_0xa6ab('0x12')]('/',auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x13')]);router['post'](_0xa6ab('0xf'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x14')]);router['put']('/:id',auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x15')]);router[_0xa6ab('0x16')](_0xa6ab('0xd'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x17')]);module[_0xa6ab('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 2e4df6a..0433473 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 _0x29b1=['token','integrationTab','newTab','STRING','username','remoteUri','ENUM','password'];(function(_0x2851a6,_0x4f01ab){var _0x497c2b=function(_0x5334fb){while(--_0x5334fb){_0x2851a6['push'](_0x2851a6['shift']());}};_0x497c2b(++_0x4f01ab);}(_0x29b1,0x13b));var _0x129b=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x29b1[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x129b('0x0')]},'description':{'type':Sequelize[_0x129b('0x0')]},'username':{'type':Sequelize[_0x129b('0x0')],'unique':_0x129b('0x1')},'password':{'type':Sequelize[_0x129b('0x0')]},'token':{'type':Sequelize[_0x129b('0x0')]},'remoteUri':{'type':Sequelize[_0x129b('0x0')],'unique':_0x129b('0x2')},'authType':{'type':Sequelize[_0x129b('0x3')](_0x129b('0x4'),_0x129b('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x129b('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x129b('0x6'),_0x129b('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9af6=['token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x9af6,0x1d7));var _0x69af=function(_0x19e687,_0x495e0d){_0x19e687=_0x19e687-0x0;var _0x2b0474=_0x9af6[_0x19e687];return _0x2b0474;};'use strict';var Sequelize=require(_0x69af('0x0'));module[_0x69af('0x1')]={'name':{'type':Sequelize[_0x69af('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x69af('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x69af('0x2')],'unique':_0x69af('0x4')},'authType':{'type':Sequelize[_0x69af('0x5')]('password',_0x69af('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x69af('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x69af('0x5')](_0x69af('0x7'),_0x69af('0x8')),'defaultValue':_0x69af('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a3cecc8..f5eb539 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 _0xd87e=['undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x5adf4d,_0xdfd7ef){var _0x17b2db=function(_0x5a9a2f){while(--_0x5a9a2f){_0x5adf4d['push'](_0x5adf4d['shift']());}};_0x17b2db(++_0xdfd7ef);}(_0xd87e,0x1bf));var _0xed87=function(_0x3318fe,_0x3f5d89){_0x3318fe=_0x3318fe-0x0;var _0x574ad=_0xd87e[_0x3318fe];return _0x574ad;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ffc2d,_0x466f35){_0x466f35=_0x466f35||0xcc;return function(_0x32276e){if(_0x32276e){return _0x4ffc2d[_0xed87('0x18')](_0x466f35);}return _0x4ffc2d[_0xed87('0x19')](_0x466f35)[_0xed87('0x1a')]();};}function respondWithResult(_0x3865c5,_0x52dfe8){_0x52dfe8=_0x52dfe8||0xc8;return function(_0x4494da){if(_0x4494da){return _0x3865c5[_0xed87('0x19')](_0x52dfe8)[_0xed87('0x1b')](_0x4494da);}};}function respondWithFilteredResult(_0x1e9a3d,_0x2f2fd3){return function(_0xd34e0e){if(_0xd34e0e){var _0x173413=typeof _0x2f2fd3[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x2f2fd3['limit']===_0xed87('0x1d');var _0x18ab7d=_0xd34e0e[_0xed87('0x1e')];var _0xfb8a44=_0x173413?0x0:_0x2f2fd3['offset'];var _0x211085=_0x173413?_0xd34e0e[_0xed87('0x1e')]:_0x2f2fd3[_0xed87('0x1c')]+_0x2f2fd3[_0xed87('0x1f')];var _0x98a2ca;if(_0x211085>=_0x18ab7d){_0x211085=_0x18ab7d;_0x98a2ca=0xc8;}else{_0x98a2ca=0xce;}_0x1e9a3d[_0xed87('0x19')](_0x98a2ca);return _0x1e9a3d[_0xed87('0x20')](_0xed87('0x21'),_0xfb8a44+'-'+_0x211085+'/'+_0x18ab7d)[_0xed87('0x1b')](_0xd34e0e);}return null;};}function patchUpdates(_0x52e81c){return function(_0x5a7329){try{jsonpatch['apply'](_0x5a7329,_0x52e81c,!![]);}catch(_0x47c121){return BPromise[_0xed87('0x22')](_0x47c121);}return _0x5a7329['save']();};}function saveUpdates(_0x4191a7,_0x2b0b98){return function(_0x5b1659){if(_0x5b1659){return _0x5b1659[_0xed87('0x23')](_0x4191a7)['then'](function(_0x3d1641){return _0x3d1641;});}return null;};}function removeEntity(_0x24962e,_0x27799a){return function(_0x2a8733){if(_0x2a8733){return _0x2a8733[_0xed87('0x24')]()['then'](function(){_0x24962e[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x41e0d4,_0x320bcc){return function(_0x31c600){if(!_0x31c600){_0x41e0d4[_0xed87('0x18')](0x194);}return _0x31c600;};}function handleError(_0x25a6f7,_0x4735b3){_0x4735b3=_0x4735b3||0x1f4;return function(_0x40b2fa){logger[_0xed87('0x25')](_0x40b2fa[_0xed87('0x26')]);if(_0x40b2fa[_0xed87('0x27')]){delete _0x40b2fa[_0xed87('0x27')];}_0x25a6f7[_0xed87('0x19')](_0x4735b3)['send'](_0x40b2fa);};}exports[_0xed87('0x28')]=function(_0x1c4a65,_0x4eaa44){var _0x3dff74={},_0x33c367={},_0x21c93b={'count':0x0,'rows':[]};var _0x4b259e=_['map'](db[_0xed87('0x29')][_0xed87('0x2a')],function(_0x21ab8a){return{'name':_0x21ab8a['fieldName'],'type':_0x21ab8a[_0xed87('0x2b')][_0xed87('0x2c')]};});_0x33c367[_0xed87('0x2d')]=_[_0xed87('0x2e')](_0x4b259e,_0xed87('0x27'));_0x33c367[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x1c4a65[_0xed87('0x2f')]);_0x33c367[_0xed87('0x31')]=_['intersection'](_0x33c367[_0xed87('0x2d')],_0x33c367[_0xed87('0x2f')]);_0x3dff74['attributes']=_[_0xed87('0x32')](_0x33c367['model'],qs[_0xed87('0x33')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x33')]));_0x3dff74[_0xed87('0x34')]=_0x3dff74[_0xed87('0x34')][_0xed87('0x35')]?_0x3dff74[_0xed87('0x34')]:_0x33c367[_0xed87('0x2d')];if(!_0x1c4a65[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x3dff74['limit']=qs[_0xed87('0x1f')](_0x1c4a65[_0xed87('0x2f')]['limit']);_0x3dff74[_0xed87('0x1c')]=qs['offset'](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x1c')]);}_0x3dff74['order']=qs[_0xed87('0x38')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x38')]);_0x3dff74[_0xed87('0x39')]=qs[_0xed87('0x31')](_['pick'](_0x1c4a65[_0xed87('0x2f')],_0x33c367['filters']),_0x4b259e);if(_0x1c4a65[_0xed87('0x2f')]['filter']){_0x3dff74[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x3dff74[_0xed87('0x39')],{'$or':_[_0xed87('0x2e')](_0x4b259e,function(_0x319f69){if(_0x319f69[_0xed87('0x2b')]!==_0xed87('0x3b')){var _0x161491={};_0x161491[_0x319f69[_0xed87('0x27')]]={'$like':'%'+_0x1c4a65['query']['filter']+'%'};return _0x161491;}})});}_0x3dff74=_[_0xed87('0x3a')]({},_0x3dff74,_0x1c4a65[_0xed87('0x3c')]);var _0x1f16a8={'where':_0x3dff74[_0xed87('0x39')]};return db[_0xed87('0x29')][_0xed87('0x1e')](_0x1f16a8)['then'](function(_0x4398a0){_0x21c93b[_0xed87('0x1e')]=_0x4398a0;if(_0x1c4a65[_0xed87('0x2f')]['includeAll']){_0x3dff74[_0xed87('0x3d')]=[{'all':!![]}];}return db[_0xed87('0x29')][_0xed87('0x3e')](_0x3dff74);})[_0xed87('0x3f')](function(_0x1d1e99){_0x21c93b[_0xed87('0x40')]=_0x1d1e99;return _0x21c93b;})[_0xed87('0x3f')](respondWithFilteredResult(_0x4eaa44,_0x3dff74))[_0xed87('0x41')](handleError(_0x4eaa44,null));};exports[_0xed87('0x42')]=function(_0x406b73,_0x5c6925){var _0x7e6cbb={'raw':![],'where':{'id':_0x406b73[_0xed87('0x43')]['id']}},_0x3c7fcc={};_0x3c7fcc['model']=_['keys'](db[_0xed87('0x29')][_0xed87('0x2a')]);_0x3c7fcc[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x406b73['query']);_0x3c7fcc[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3c7fcc['model'],_0x3c7fcc[_0xed87('0x2f')]);_0x7e6cbb[_0xed87('0x34')]=_[_0xed87('0x32')](_0x3c7fcc[_0xed87('0x2d')],qs[_0xed87('0x33')](_0x406b73[_0xed87('0x2f')][_0xed87('0x33')]));_0x7e6cbb[_0xed87('0x34')]=_0x7e6cbb[_0xed87('0x34')][_0xed87('0x35')]?_0x7e6cbb[_0xed87('0x34')]:_0x3c7fcc['model'];if(_0x406b73[_0xed87('0x2f')][_0xed87('0x44')]){_0x7e6cbb[_0xed87('0x3d')]=[{'all':!![]}];}_0x7e6cbb=_[_0xed87('0x3a')]({},_0x7e6cbb,_0x406b73[_0xed87('0x3c')]);return db[_0xed87('0x29')][_0xed87('0x45')](_0x7e6cbb)[_0xed87('0x3f')](handleEntityNotFound(_0x5c6925,null))[_0xed87('0x3f')](respondWithResult(_0x5c6925,null))[_0xed87('0x41')](handleError(_0x5c6925,null));};exports[_0xed87('0x46')]=function(_0x26c8f4,_0x27ed22){return db[_0xed87('0x29')][_0xed87('0x46')](_0x26c8f4[_0xed87('0x47')],{})[_0xed87('0x3f')](respondWithResult(_0x27ed22,0xc9))['catch'](handleError(_0x27ed22,null));};exports[_0xed87('0x23')]=function(_0x1a68a7,_0x3a91c5){if(_0x1a68a7['body']['id']){delete _0x1a68a7[_0xed87('0x47')]['id'];}return db[_0xed87('0x29')]['find']({'where':{'id':_0x1a68a7[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3a91c5,null))[_0xed87('0x3f')](saveUpdates(_0x1a68a7[_0xed87('0x47')],null))['then'](respondWithResult(_0x3a91c5,null))[_0xed87('0x41')](handleError(_0x3a91c5,null));};exports[_0xed87('0x24')]=function(_0x3ca34c,_0x272a07){return db[_0xed87('0x29')][_0xed87('0x45')]({'where':{'id':_0x3ca34c[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x272a07,null))[_0xed87('0x3f')](removeEntity(_0x272a07,null))[_0xed87('0x41')](handleError(_0x272a07,null));};exports[_0xed87('0x48')]=function(_0x18846f,_0x2e5a9f,_0x4df105){var _0x43ffa4={};var _0x4ea4e3={};var _0x17cad7;var _0x329973;return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x18846f[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x2e5a9f,null))[_0xed87('0x3f')](function(_0xccdbb6){if(_0xccdbb6){_0x17cad7=_0xccdbb6;_0x4ea4e3[_0xed87('0x2d')]=_[_0xed87('0x30')](db['ZendeskConfiguration'][_0xed87('0x2a')]);_0x4ea4e3[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x18846f[_0xed87('0x2f')]);_0x4ea4e3[_0xed87('0x31')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],_0x4ea4e3[_0xed87('0x2f')]);_0x43ffa4[_0xed87('0x34')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],qs['fields'](_0x18846f['query'][_0xed87('0x33')]));_0x43ffa4[_0xed87('0x34')]=_0x43ffa4[_0xed87('0x34')][_0xed87('0x35')]?_0x43ffa4[_0xed87('0x34')]:_0x4ea4e3['model'];_0x43ffa4[_0xed87('0x4a')]=qs[_0xed87('0x38')](_0x18846f[_0xed87('0x2f')][_0xed87('0x38')]);_0x43ffa4[_0xed87('0x39')]=qs[_0xed87('0x31')](_[_0xed87('0x4b')](_0x18846f[_0xed87('0x2f')],_0x4ea4e3[_0xed87('0x31')]));if(_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]){_0x43ffa4[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x43ffa4[_0xed87('0x39')],{'$or':_['map'](_0x43ffa4[_0xed87('0x34')],function(_0x10a19c){var _0x2f03d4={};_0x2f03d4[_0x10a19c]={'$like':'%'+_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]+'%'};return _0x2f03d4;})});}_0x43ffa4=_[_0xed87('0x3a')]({},_0x43ffa4,_0x18846f[_0xed87('0x3c')]);return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})['then'](function(_0x4367c3){if(_0x4367c3){_0x329973=_0x4367c3[_0xed87('0x35')];if(!_0x18846f[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x43ffa4[_0xed87('0x1f')]=qs['limit'](_0x18846f['query'][_0xed87('0x1f')]);_0x43ffa4[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0x18846f[_0xed87('0x2f')][_0xed87('0x1c')]);}return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})[_0xed87('0x3f')](function(_0x3bdf7c){if(_0x3bdf7c){return _0x3bdf7c?{'count':_0x329973,'rows':_0x3bdf7c}:null;}})['then'](respondWithResult(_0x2e5a9f,null))[_0xed87('0x41')](handleError(_0x2e5a9f,null));};exports['addConfiguration']=function(_0xd3b300,_0x3c82de,_0x4e5055){if(_0xd3b300[_0xed87('0x47')]['id']){delete _0xd3b300[_0xed87('0x47')]['id'];}return db['ZendeskAccount'][_0xed87('0x49')]({'where':{'id':_0xd3b300[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3c82de,null))[_0xed87('0x3f')](function(_0x112685){if(_0x112685){_0xd3b300['body'][_0xed87('0x4d')]=_0x112685['id'];_0xd3b300[_0xed87('0x47')][_0xed87('0x4e')]=integrations[_0xed87('0x4f')](_0xd3b300['body']['channel'],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);_0xd3b300['body'][_0xed87('0x50')]=integrations[_0xed87('0x51')](_0xd3b300[_0xed87('0x47')][_0xed87('0x52')],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);return db[_0xed87('0x53')][_0xed87('0x46')](_0xd3b300[_0xed87('0x47')],{'include':[{'model':db[_0xed87('0x54')],'as':_0xed87('0x4e')},{'model':db[_0xed87('0x54')],'as':_0xed87('0x50')}]});}return null;})[_0xed87('0x3f')](respondWithResult(_0x3c82de,null))['catch'](handleError(_0x3c82de,null));};exports[_0xed87('0x55')]=function(_0x2686cd,_0x566ace,_0x4f7b92){var _0x5136c9='';return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x2686cd[_0xed87('0x43')]['id']},'attributes':['id',_0xed87('0x56'),_0xed87('0x57'),_0xed87('0x58'),_0xed87('0x59'),'remoteUri']})[_0xed87('0x3f')](handleEntityNotFound(_0x566ace,null))[_0xed87('0x3f')](function(_0x3b6a9b){if(_0x3b6a9b){_0x5136c9=_0x3b6a9b[_0xed87('0x5a')];var _0xc35cab=_0x5136c9[_0xed87('0x5b')](-0x1);if(_0xc35cab==='/'){_0x5136c9=_0x5136c9[_0xed87('0x5c')](0x0,_0x5136c9[_0xed87('0x5d')](_0xc35cab));}var _0x116198={'method':_0xed87('0x5e'),'uri':util['format']('%s/%s',_0x5136c9,'ticket_fields'),'json':!![]};switch(_0x3b6a9b[_0xed87('0x59')]){case _0xed87('0x57'):_0x116198[_0xed87('0x5f')]={'Authorization':util[_0xed87('0x60')](_0xed87('0x61'),new Buffer(util['format'](_0xed87('0x62'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x57')]))[_0xed87('0x63')](_0xed87('0x64')))};break;case _0xed87('0x58'):_0x116198['headers']={'Authorization':util['format'](_0xed87('0x61'),new Buffer(util[_0xed87('0x60')](_0xed87('0x65'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x58')]))[_0xed87('0x63')](_0xed87('0x64')))};break;default:throw new db[(_0xed87('0x66'))][(_0xed87('0x67'))](_0xed87('0x68'));}return rp(_0x116198);}})[_0xed87('0x3f')](function(_0x1a1f95){if(_0x1a1f95){var _0x52af5c=[_0xed87('0x69'),_0xed87('0x6a'),_0xed87('0x6b'),_0xed87('0x6c')];_[_0xed87('0x6d')](_0x1a1f95[_0xed87('0x6e')],function(_0x4ae84c){return _0x52af5c[_0xed87('0x6f')](_0x4ae84c[_0xed87('0x2b')]);});return{'count':_0x1a1f95[_0xed87('0x6e')][_0xed87('0x35')],'rows':_['map'](_0x1a1f95['ticket_fields'],function(_0x4bfca0){return{'id':_0x4bfca0['id'],'name':_0x4bfca0['position']>0x7?_0x4bfca0['title']:_0x4bfca0[_0xed87('0x2b')],'custom':_0x4bfca0[_0xed87('0x70')]>0x7?!![]:![],'options':_0x4bfca0[_0xed87('0x71')]?_0x4bfca0[_0xed87('0x71')]:_0x4bfca0[_0xed87('0x72')]?_0x4bfca0[_0xed87('0x72')]:[]};})};}})[_0xed87('0x3f')](respondWithResult(_0x566ace,null))[_0xed87('0x41')](function(_0x1b223b){var _0x510066=_0x2686cd['query'][_0xed87('0x73')]?0x1f4:_0x1b223b[_0xed87('0x74')]||0x1f4;logger[_0xed87('0x25')](_0xed87('0x75'),_0xed87('0x55'),_0x510066,JSON['stringify'](_0x1b223b));delete _0x1b223b['name'];if(_0x510066===0x191){_0x510066=0x190;}_0x566ace[_0xed87('0x19')](_0x510066)[_0xed87('0x76')](_0x2686cd['query'][_0xed87('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1b223b[_0xed87('0x74')]}:_0x1b223b);});}; \ No newline at end of file +var _0x80ed=['rawAttributes','sort','pick','filter','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','authType','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','position','system_field_options','custom_field_options','test','statusCode','error','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','ZendeskAccount','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne'];(function(_0x1ca56e,_0x5b2d81){var _0x212f8f=function(_0x2e467b){while(--_0x2e467b){_0x1ca56e['push'](_0x1ca56e['shift']());}};_0x212f8f(++_0x5b2d81);}(_0x80ed,0x11c));var _0xd80e=function(_0x1b4179,_0x362f1c){_0x1b4179=_0x1b4179-0x0;var _0x123116=_0x80ed[_0x1b4179];return _0x123116;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];var integrations=require(_0xd80e('0x1b'));function respondWithStatusCode(_0x1d3fcf,_0x4fb01c){_0x4fb01c=_0x4fb01c||0xcc;return function(_0x5691a1){if(_0x5691a1){return _0x1d3fcf['sendStatus'](_0x4fb01c);}return _0x1d3fcf['status'](_0x4fb01c)[_0xd80e('0x1c')]();};}function respondWithResult(_0x3d233b,_0x3096ae){_0x3096ae=_0x3096ae||0xc8;return function(_0x1e8b63){if(_0x1e8b63){return _0x3d233b[_0xd80e('0x1d')](_0x3096ae)['json'](_0x1e8b63);}};}function respondWithFilteredResult(_0x595683,_0x2c8c61){return function(_0x3124e8){if(_0x3124e8){var _0x3b48ae=typeof _0x2c8c61[_0xd80e('0x1e')]===_0xd80e('0x1f')&&typeof _0x2c8c61[_0xd80e('0x20')]===_0xd80e('0x1f');var _0x49e3e5=_0x3124e8[_0xd80e('0x21')];var _0x1cc576=_0x3b48ae?0x0:_0x2c8c61[_0xd80e('0x1e')];var _0x34e239=_0x3b48ae?_0x3124e8['count']:_0x2c8c61[_0xd80e('0x1e')]+_0x2c8c61[_0xd80e('0x20')];var _0xecfe74;if(_0x34e239>=_0x49e3e5){_0x34e239=_0x49e3e5;_0xecfe74=0xc8;}else{_0xecfe74=0xce;}_0x595683['status'](_0xecfe74);return _0x595683[_0xd80e('0x22')](_0xd80e('0x23'),_0x1cc576+'-'+_0x34e239+'/'+_0x49e3e5)[_0xd80e('0x24')](_0x3124e8);}return null;};}function patchUpdates(_0x147134){return function(_0x46b6eb){try{jsonpatch['apply'](_0x46b6eb,_0x147134,!![]);}catch(_0x4b6b8a){return BPromise[_0xd80e('0x25')](_0x4b6b8a);}return _0x46b6eb[_0xd80e('0x26')]();};}function saveUpdates(_0x3b39bf,_0x2d46e7){return function(_0x3eb3ca){if(_0x3eb3ca){return _0x3eb3ca[_0xd80e('0x27')](_0x3b39bf)[_0xd80e('0x28')](function(_0x5430b6){return _0x5430b6;});}return null;};}function removeEntity(_0x1fbf8a,_0x57d70){return function(_0x170109){if(_0x170109){return _0x170109['destroy']()[_0xd80e('0x28')](function(){_0x1fbf8a[_0xd80e('0x1d')](0xcc)[_0xd80e('0x1c')]();});}};}function handleEntityNotFound(_0x482779,_0x521aa4){return function(_0x5420e7){if(!_0x5420e7){_0x482779[_0xd80e('0x29')](0x194);}return _0x5420e7;};}function handleError(_0x4b8291,_0x9f9287){_0x9f9287=_0x9f9287||0x1f4;return function(_0x1044cc){logger['error'](_0x1044cc[_0xd80e('0x2a')]);if(_0x1044cc[_0xd80e('0x2b')]){delete _0x1044cc[_0xd80e('0x2b')];}_0x4b8291[_0xd80e('0x1d')](_0x9f9287)['send'](_0x1044cc);};}exports[_0xd80e('0x2c')]=function(_0x1ad3bc,_0x845451){var _0x39088b={},_0x2b1aaf={},_0x361946={'count':0x0,'rows':[]};var _0x289685=_[_0xd80e('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x30f9bd){return{'name':_0x30f9bd[_0xd80e('0x2e')],'type':_0x30f9bd[_0xd80e('0x2f')][_0xd80e('0x30')]};});_0x2b1aaf[_0xd80e('0x31')]=_[_0xd80e('0x2d')](_0x289685,'name');_0x2b1aaf['query']=_[_0xd80e('0x32')](_0x1ad3bc[_0xd80e('0x33')]);_0x2b1aaf[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x2b1aaf[_0xd80e('0x31')],_0x2b1aaf[_0xd80e('0x33')]);_0x39088b[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2b1aaf['model'],qs['fields'](_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x37')]));_0x39088b[_0xd80e('0x36')]=_0x39088b[_0xd80e('0x36')][_0xd80e('0x38')]?_0x39088b[_0xd80e('0x36')]:_0x2b1aaf[_0xd80e('0x31')];if(!_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x39088b['limit']=qs[_0xd80e('0x20')](_0x1ad3bc['query'][_0xd80e('0x20')]);_0x39088b[_0xd80e('0x1e')]=qs[_0xd80e('0x1e')](_0x1ad3bc[_0xd80e('0x33')]['offset']);}_0x39088b[_0xd80e('0x3b')]=qs['sort'](_0x1ad3bc[_0xd80e('0x33')]['sort']);_0x39088b[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_['pick'](_0x1ad3bc[_0xd80e('0x33')],_0x2b1aaf[_0xd80e('0x34')]),_0x289685);if(_0x1ad3bc[_0xd80e('0x33')]['filter']){_0x39088b[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x39088b[_0xd80e('0x3c')],{'$or':_[_0xd80e('0x2d')](_0x289685,function(_0x3c6f5f){if(_0x3c6f5f[_0xd80e('0x2f')]!==_0xd80e('0x3e')){var _0x137552={};_0x137552[_0x3c6f5f[_0xd80e('0x2b')]]={'$like':'%'+_0x1ad3bc['query']['filter']+'%'};return _0x137552;}})});}_0x39088b=_['merge']({},_0x39088b,_0x1ad3bc[_0xd80e('0x3f')]);var _0x3ff4b4={'where':_0x39088b['where']};return db[_0xd80e('0x40')]['count'](_0x3ff4b4)[_0xd80e('0x28')](function(_0x5ade19){_0x361946[_0xd80e('0x21')]=_0x5ade19;if(_0x1ad3bc[_0xd80e('0x33')]['includeAll']){_0x39088b['include']=[{'all':!![]}];}return db[_0xd80e('0x40')][_0xd80e('0x41')](_0x39088b);})[_0xd80e('0x28')](function(_0x3e65a7){_0x361946[_0xd80e('0x42')]=_0x3e65a7;return _0x361946;})[_0xd80e('0x28')](respondWithFilteredResult(_0x845451,_0x39088b))[_0xd80e('0x43')](handleError(_0x845451,null));};exports[_0xd80e('0x44')]=function(_0x91c6ed,_0x2da5f5){var _0x1bbb36={'raw':![],'where':{'id':_0x91c6ed[_0xd80e('0x45')]['id']}},_0x2e257e={};_0x2e257e[_0xd80e('0x31')]=_[_0xd80e('0x32')](db[_0xd80e('0x40')]['rawAttributes']);_0x2e257e['query']=_['keys'](_0x91c6ed[_0xd80e('0x33')]);_0x2e257e['filters']=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],_0x2e257e[_0xd80e('0x33')]);_0x1bbb36[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],qs['fields'](_0x91c6ed['query']['fields']));_0x1bbb36[_0xd80e('0x36')]=_0x1bbb36['attributes'][_0xd80e('0x38')]?_0x1bbb36[_0xd80e('0x36')]:_0x2e257e[_0xd80e('0x31')];if(_0x91c6ed[_0xd80e('0x33')][_0xd80e('0x46')]){_0x1bbb36['include']=[{'all':!![]}];}_0x1bbb36=_[_0xd80e('0x3d')]({},_0x1bbb36,_0x91c6ed[_0xd80e('0x3f')]);return db[_0xd80e('0x40')]['find'](_0x1bbb36)[_0xd80e('0x28')](handleEntityNotFound(_0x2da5f5,null))[_0xd80e('0x28')](respondWithResult(_0x2da5f5,null))[_0xd80e('0x43')](handleError(_0x2da5f5,null));};exports['create']=function(_0x8d5cb8,_0x29aaa0){return db[_0xd80e('0x40')][_0xd80e('0x47')](_0x8d5cb8[_0xd80e('0x48')],{})[_0xd80e('0x28')](respondWithResult(_0x29aaa0,0xc9))['catch'](handleError(_0x29aaa0,null));};exports['update']=function(_0x275985,_0x27134e){if(_0x275985[_0xd80e('0x48')]['id']){delete _0x275985['body']['id'];}return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x275985[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x27134e,null))[_0xd80e('0x28')](saveUpdates(_0x275985[_0xd80e('0x48')],null))['then'](respondWithResult(_0x27134e,null))[_0xd80e('0x43')](handleError(_0x27134e,null));};exports['destroy']=function(_0x46c781,_0x31107b){return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x46c781[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x31107b,null))[_0xd80e('0x28')](removeEntity(_0x31107b,null))[_0xd80e('0x43')](handleError(_0x31107b,null));};exports[_0xd80e('0x4a')]=function(_0x18dbb0,_0x50be26,_0x178c51){var _0x377e68={};var _0x419df7={};var _0x4a66ca;var _0x52ab04;return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x18dbb0[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x50be26,null))[_0xd80e('0x28')](function(_0x8b7a70){if(_0x8b7a70){_0x4a66ca=_0x8b7a70;_0x419df7[_0xd80e('0x31')]=_[_0xd80e('0x32')](db['ZendeskConfiguration'][_0xd80e('0x4c')]);_0x419df7['query']=_[_0xd80e('0x32')](_0x18dbb0[_0xd80e('0x33')]);_0x419df7[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x419df7[_0xd80e('0x31')],_0x419df7[_0xd80e('0x33')]);_0x377e68['attributes']=_[_0xd80e('0x35')](_0x419df7['model'],qs[_0xd80e('0x37')](_0x18dbb0[_0xd80e('0x33')]['fields']));_0x377e68['attributes']=_0x377e68[_0xd80e('0x36')][_0xd80e('0x38')]?_0x377e68[_0xd80e('0x36')]:_0x419df7['model'];_0x377e68['order']=qs[_0xd80e('0x4d')](_0x18dbb0[_0xd80e('0x33')]['sort']);_0x377e68[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_[_0xd80e('0x4e')](_0x18dbb0['query'],_0x419df7[_0xd80e('0x34')]));if(_0x18dbb0['query'][_0xd80e('0x4f')]){_0x377e68[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x377e68[_0xd80e('0x3c')],{'$or':_['map'](_0x377e68[_0xd80e('0x36')],function(_0x564475){var _0x53b784={};_0x53b784[_0x564475]={'$like':'%'+_0x18dbb0['query'][_0xd80e('0x4f')]+'%'};return _0x53b784;})});}_0x377e68=_[_0xd80e('0x3d')]({},_0x377e68,_0x18dbb0[_0xd80e('0x3f')]);return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x1738ff){if(_0x1738ff){_0x52ab04=_0x1738ff[_0xd80e('0x38')];if(!_0x18dbb0['query'][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x377e68[_0xd80e('0x20')]=qs[_0xd80e('0x20')](_0x18dbb0['query'][_0xd80e('0x20')]);_0x377e68[_0xd80e('0x1e')]=qs['offset'](_0x18dbb0[_0xd80e('0x33')][_0xd80e('0x1e')]);}return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x562ed7){if(_0x562ed7){return _0x562ed7?{'count':_0x52ab04,'rows':_0x562ed7}:null;}})['then'](respondWithResult(_0x50be26,null))['catch'](handleError(_0x50be26,null));};exports[_0xd80e('0x50')]=function(_0x4f283c,_0x3c8ad1,_0x1b0ad4){if(_0x4f283c[_0xd80e('0x48')]['id']){delete _0x4f283c['body']['id'];}return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x4f283c[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x3c8ad1,null))[_0xd80e('0x28')](function(_0x2a34cd){if(_0x2a34cd){_0x4f283c[_0xd80e('0x48')][_0xd80e('0x51')]=_0x2a34cd['id'];_0x4f283c[_0xd80e('0x48')]['Subjects']=integrations['getSubjects'](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')][_0xd80e('0x2f')]);_0x4f283c['body'][_0xd80e('0x53')]=integrations[_0xd80e('0x54')](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')]['type']);return db[_0xd80e('0x55')][_0xd80e('0x47')](_0x4f283c[_0xd80e('0x48')],{'include':[{'model':db[_0xd80e('0x56')],'as':'Subjects'},{'model':db[_0xd80e('0x56')],'as':_0xd80e('0x53')}]});}return null;})[_0xd80e('0x28')](respondWithResult(_0x3c8ad1,null))[_0xd80e('0x43')](handleError(_0x3c8ad1,null));};exports[_0xd80e('0x57')]=function(_0x1edcf4,_0x5cb11c,_0x3e3176){var _0x393fb6='';return db['ZendeskAccount'][_0xd80e('0x4b')]({'where':{'id':_0x1edcf4[_0xd80e('0x45')]['id']},'attributes':['id',_0xd80e('0x58'),_0xd80e('0x59'),'token',_0xd80e('0x5a'),'remoteUri']})[_0xd80e('0x28')](handleEntityNotFound(_0x5cb11c,null))[_0xd80e('0x28')](function(_0x194743){if(_0x194743){_0x393fb6=_0x194743[_0xd80e('0x5b')];var _0x4186bd=_0x393fb6['slice'](-0x1);if(_0x4186bd==='/'){_0x393fb6=_0x393fb6[_0xd80e('0x5c')](0x0,_0x393fb6[_0xd80e('0x5d')](_0x4186bd));}var _0x25e86d={'method':_0xd80e('0x5e'),'uri':util['format'](_0xd80e('0x5f'),_0x393fb6,_0xd80e('0x60')),'json':!![]};switch(_0x194743['authType']){case _0xd80e('0x59'):_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x64'),_0x194743['username'],_0x194743['password']))[_0xd80e('0x65')]('base64'))};break;case'token':_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x66'),_0x194743[_0xd80e('0x58')],_0x194743[_0xd80e('0x67')]))[_0xd80e('0x65')]('base64'))};break;default:throw new db[(_0xd80e('0x68'))][(_0xd80e('0x69'))](_0xd80e('0x6a'));}return rp(_0x25e86d);}})[_0xd80e('0x28')](function(_0x575bf6){if(_0x575bf6){var _0x192178=[_0xd80e('0x6b'),'description',_0xd80e('0x6c'),_0xd80e('0x6d')];_['remove'](_0x575bf6[_0xd80e('0x60')],function(_0x160dc4){return _0x192178[_0xd80e('0x6e')](_0x160dc4[_0xd80e('0x2f')]);});return{'count':_0x575bf6[_0xd80e('0x60')][_0xd80e('0x38')],'rows':_[_0xd80e('0x2d')](_0x575bf6[_0xd80e('0x60')],function(_0x392a8b){return{'id':_0x392a8b['id'],'name':_0x392a8b[_0xd80e('0x6f')]>0x7?_0x392a8b['title']:_0x392a8b[_0xd80e('0x2f')],'custom':_0x392a8b[_0xd80e('0x6f')]>0x7?!![]:![],'options':_0x392a8b['system_field_options']?_0x392a8b[_0xd80e('0x70')]:_0x392a8b[_0xd80e('0x71')]?_0x392a8b[_0xd80e('0x71')]:[]};})};}})['then'](respondWithResult(_0x5cb11c,null))[_0xd80e('0x43')](function(_0x5277a2){var _0x30fc66=_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?0x1f4:_0x5277a2[_0xd80e('0x73')]||0x1f4;logger[_0xd80e('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0xd80e('0x57'),_0x30fc66,JSON[_0xd80e('0x75')](_0x5277a2));delete _0x5277a2[_0xd80e('0x2b')];if(_0x30fc66===0x191){_0x30fc66=0x190;}_0x5cb11c[_0xd80e('0x1d')](_0x30fc66)[_0xd80e('0x76')](_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?{'message':_0xd80e('0x77'),'statusCode':_0x5277a2[_0xd80e('0x73')]}:_0x5277a2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f8486da..179c716 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 _0x8385=['api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger'];(function(_0xb3f0bb,_0xc129c0){var _0x551481=function(_0x307201){while(--_0x307201){_0xb3f0bb['push'](_0xb3f0bb['shift']());}};_0x551481(++_0xc129c0);}(_0x8385,0x12a));var _0x5838=function(_0x2979db,_0x470467){_0x2979db=_0x2979db-0x0;var _0x2c2bed=_0x8385[_0x2979db];return _0x2c2bed;};'use strict';var _=require('lodash');var util=require(_0x5838('0x0'));var logger=require(_0x5838('0x1'))(_0x5838('0x2'));var moment=require(_0x5838('0x3'));var BPromise=require('bluebird');var rp=require(_0x5838('0x4'));var fs=require('fs');var path=require(_0x5838('0x5'));var rimraf=require(_0x5838('0x6'));var config=require(_0x5838('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x5838('0x8'));module['exports']=function(_0x3f155c,_0x365987){return _0x3f155c[_0x5838('0x9')](_0x5838('0xa'),attributes,{'tableName':_0x5838('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa219=['rimraf','../../config/environment','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0xa219,0x14a));var _0x9a21=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xa219[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x9a21('0x0'));var util=require(_0x9a21('0x1'));var logger=require('../../config/logger')(_0x9a21('0x2'));var moment=require(_0x9a21('0x3'));var BPromise=require(_0x9a21('0x4'));var rp=require(_0x9a21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a21('0x6'));var config=require(_0x9a21('0x7'));var attributes=require(_0x9a21('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x190c7a,_0x18fc96){return _0x190c7a[_0x9a21('0x9')](_0x9a21('0xa'),attributes,{'tableName':_0x9a21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 3c6e3f9..1dbf7ac 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 _0x1894=['catch','GetZendeskAccount','ZendeskAccount','options','where','attributes','include','model','map','find','ShowZendeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x1894,0x1af));var _0x4189=function(_0xda6ad1,_0x5f09e3){_0xda6ad1=_0xda6ad1-0x0;var _0xedc3a5=_0x1894[_0xda6ad1];return _0xedc3a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4189('0x0'));var BPromise=require(_0x4189('0x1'));var rs=require(_0x4189('0x2'));var fs=require('fs');var Redis=require(_0x4189('0x3'));var db=require(_0x4189('0x4'))['db'];var utils=require(_0x4189('0x5'));var logger=require(_0x4189('0x6'))(_0x4189('0x7'));var config=require(_0x4189('0x8'));var jayson=require(_0x4189('0x9'));var client=jayson[_0x4189('0xa')][_0x4189('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a0c59,_0xad3195,_0x21043d){return new BPromise(function(_0x5cc832,_0x61439){return client[_0x4189('0xc')](_0x2a0c59,_0x21043d)[_0x4189('0xd')](function(_0x51b466){logger['info'](_0x4189('0xe'),_0xad3195,_0x4189('0xf'));logger[_0x4189('0x10')](_0x4189('0x11'),_0xad3195,'request\x20sent',JSON[_0x4189('0x12')](_0x51b466));if(_0x51b466[_0x4189('0x13')]){if(_0x51b466[_0x4189('0x13')][_0x4189('0x14')]===0x1f4){logger[_0x4189('0x13')](_0x4189('0xe'),_0xad3195,_0x51b466[_0x4189('0x13')][_0x4189('0x15')]);return _0x61439(_0x51b466[_0x4189('0x13')]['message']);}logger[_0x4189('0x13')](_0x4189('0xe'),_0xad3195,_0x51b466[_0x4189('0x13')]['message']);return _0x5cc832(_0x51b466[_0x4189('0x13')]['message']);}else{logger[_0x4189('0x16')](_0x4189('0xe'),_0xad3195,_0x4189('0xf'));_0x5cc832(_0x51b466[_0x4189('0x17')]['message']);}})[_0x4189('0x18')](function(_0x1cb7f1){logger[_0x4189('0x13')](_0x4189('0xe'),_0xad3195,_0x1cb7f1);_0x61439(_0x1cb7f1);});});}exports[_0x4189('0x19')]=function(_0x1ba603){var _0x16a677=this;return new Promise(function(_0x228aac,_0x496b79){return db[_0x4189('0x1a')]['findAll']({'raw':_0x1ba603[_0x4189('0x1b')]?_0x1ba603[_0x4189('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1ba603['options']?_0x1ba603[_0x4189('0x1b')][_0x4189('0x1c')]||null:null,'attributes':_0x1ba603[_0x4189('0x1b')]?_0x1ba603[_0x4189('0x1b')][_0x4189('0x1d')]||null:null,'limit':_0x1ba603[_0x4189('0x1b')]?_0x1ba603[_0x4189('0x1b')]['limit']||null:null,'include':_0x1ba603['options']?_0x1ba603['options']['include']?_['map'](_0x1ba603[_0x4189('0x1b')][_0x4189('0x1e')],function(_0x1420a9){return{'model':db[_0x1420a9[_0x4189('0x1f')]],'as':_0x1420a9['as'],'attributes':_0x1420a9[_0x4189('0x1d')],'include':_0x1420a9['include']?_[_0x4189('0x20')](_0x1420a9['include'],function(_0x4ea922){return{'model':db[_0x4ea922[_0x4189('0x1f')]],'as':_0x4ea922['as'],'attributes':_0x4ea922['attributes'],'include':_0x4ea922[_0x4189('0x1e')]?_[_0x4189('0x20')](_0x4ea922['include'],function(_0x47e44a){return{'model':db[_0x47e44a[_0x4189('0x1f')]],'as':_0x47e44a['as'],'attributes':_0x47e44a[_0x4189('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x562f64){logger[_0x4189('0x16')](_0x4189('0x19'),_0x1ba603);logger[_0x4189('0x10')](_0x4189('0x19'),_0x1ba603,JSON['stringify'](_0x562f64));_0x228aac(_0x562f64);})['catch'](function(_0x56c176){logger[_0x4189('0x13')](_0x4189('0x19'),_0x56c176[_0x4189('0x15')],_0x1ba603);_0x496b79(_0x16a677['error'](0x1f4,_0x56c176['message']));});});};exports['ShowZendeskAccount']=function(_0x40e816){var _0xceeb3f=this;return new Promise(function(_0x679354,_0x3c9c64){return db[_0x4189('0x1a')][_0x4189('0x21')]({'raw':_0x40e816[_0x4189('0x1b')]?_0x40e816[_0x4189('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x40e816['options']?_0x40e816[_0x4189('0x1b')][_0x4189('0x1c')]||null:null,'attributes':_0x40e816[_0x4189('0x1b')]?_0x40e816['options'][_0x4189('0x1d')]||null:null,'include':_0x40e816[_0x4189('0x1b')]?_0x40e816[_0x4189('0x1b')]['include']?_[_0x4189('0x20')](_0x40e816[_0x4189('0x1b')][_0x4189('0x1e')],function(_0x1c8133){return{'model':db[_0x1c8133[_0x4189('0x1f')]],'as':_0x1c8133['as'],'attributes':_0x1c8133[_0x4189('0x1d')],'include':_0x1c8133['include']?_[_0x4189('0x20')](_0x1c8133['include'],function(_0x375f92){return{'model':db[_0x375f92['model']],'as':_0x375f92['as'],'attributes':_0x375f92[_0x4189('0x1d')],'include':_0x375f92['include']?_[_0x4189('0x20')](_0x375f92['include'],function(_0x3d00b9){return{'model':db[_0x3d00b9[_0x4189('0x1f')]],'as':_0x3d00b9['as'],'attributes':_0x3d00b9[_0x4189('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4189('0xd')](function(_0xe9d26e){logger[_0x4189('0x16')](_0x4189('0x22'),_0x40e816);logger['debug']('ShowZendeskAccount',_0x40e816,JSON[_0x4189('0x12')](_0xe9d26e));_0x679354(_0xe9d26e);})[_0x4189('0x18')](function(_0x2efe3b){logger[_0x4189('0x13')](_0x4189('0x22'),_0x2efe3b[_0x4189('0x15')],_0x40e816);_0x3c9c64(_0xceeb3f[_0x4189('0x13')](0x1f4,_0x2efe3b[_0x4189('0x15')]));});});}; \ No newline at end of file +var _0xef64=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowZendeskAccount','find','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x681da9,_0x3e6cad){var _0x3dc903=function(_0x450f49){while(--_0x450f49){_0x681da9['push'](_0x681da9['shift']());}};_0x3dc903(++_0x3e6cad);}(_0xef64,0x137));var _0x4ef6=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xef64[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var util=require(_0x4ef6('0x0'));var moment=require('moment');var BPromise=require(_0x4ef6('0x1'));var rs=require(_0x4ef6('0x2'));var fs=require('fs');var Redis=require(_0x4ef6('0x3'));var db=require(_0x4ef6('0x4'))['db'];var utils=require(_0x4ef6('0x5'));var logger=require('../../config/logger')(_0x4ef6('0x6'));var config=require(_0x4ef6('0x7'));var jayson=require(_0x4ef6('0x8'));var client=jayson[_0x4ef6('0x9')][_0x4ef6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a9859,_0x48638a,_0x2597ba){return new BPromise(function(_0x5bf9f5,_0x15db51){return client[_0x4ef6('0xb')](_0x5a9859,_0x2597ba)['then'](function(_0x3f3655){logger[_0x4ef6('0xc')](_0x4ef6('0xd'),_0x48638a,_0x4ef6('0xe'));logger[_0x4ef6('0xf')](_0x4ef6('0x10'),_0x48638a,'request\x20sent',JSON['stringify'](_0x3f3655));if(_0x3f3655['error']){if(_0x3f3655[_0x4ef6('0x11')][_0x4ef6('0x12')]===0x1f4){logger[_0x4ef6('0x11')](_0x4ef6('0xd'),_0x48638a,_0x3f3655[_0x4ef6('0x11')][_0x4ef6('0x13')]);return _0x15db51(_0x3f3655[_0x4ef6('0x11')]['message']);}logger[_0x4ef6('0x11')](_0x4ef6('0xd'),_0x48638a,_0x3f3655['error'][_0x4ef6('0x13')]);return _0x5bf9f5(_0x3f3655[_0x4ef6('0x11')][_0x4ef6('0x13')]);}else{logger['info'](_0x4ef6('0xd'),_0x48638a,'request\x20sent');_0x5bf9f5(_0x3f3655['result'][_0x4ef6('0x13')]);}})[_0x4ef6('0x14')](function(_0x37f995){logger[_0x4ef6('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x48638a,_0x37f995);_0x15db51(_0x37f995);});});}exports[_0x4ef6('0x15')]=function(_0x27c432){var _0x27e17b=this;return new Promise(function(_0x4463cd,_0xcc9437){return db[_0x4ef6('0x16')][_0x4ef6('0x17')]({'raw':_0x27c432[_0x4ef6('0x18')]?_0x27c432[_0x4ef6('0x18')][_0x4ef6('0x19')]===undefined?!![]:![]:!![],'where':_0x27c432[_0x4ef6('0x18')]?_0x27c432[_0x4ef6('0x18')][_0x4ef6('0x1a')]||null:null,'attributes':_0x27c432[_0x4ef6('0x18')]?_0x27c432[_0x4ef6('0x18')][_0x4ef6('0x1b')]||null:null,'limit':_0x27c432[_0x4ef6('0x18')]?_0x27c432['options'][_0x4ef6('0x1c')]||null:null,'include':_0x27c432[_0x4ef6('0x18')]?_0x27c432[_0x4ef6('0x18')][_0x4ef6('0x1d')]?_['map'](_0x27c432[_0x4ef6('0x18')]['include'],function(_0x48e5eb){return{'model':db[_0x48e5eb[_0x4ef6('0x1e')]],'as':_0x48e5eb['as'],'attributes':_0x48e5eb[_0x4ef6('0x1b')],'include':_0x48e5eb[_0x4ef6('0x1d')]?_[_0x4ef6('0x1f')](_0x48e5eb[_0x4ef6('0x1d')],function(_0x4c8ab7){return{'model':db[_0x4c8ab7[_0x4ef6('0x1e')]],'as':_0x4c8ab7['as'],'attributes':_0x4c8ab7[_0x4ef6('0x1b')],'include':_0x4c8ab7[_0x4ef6('0x1d')]?_[_0x4ef6('0x1f')](_0x4c8ab7[_0x4ef6('0x1d')],function(_0x5a5737){return{'model':db[_0x5a5737[_0x4ef6('0x1e')]],'as':_0x5a5737['as'],'attributes':_0x5a5737['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31f652){logger['info'](_0x4ef6('0x15'),_0x27c432);logger[_0x4ef6('0xf')](_0x4ef6('0x15'),_0x27c432,JSON[_0x4ef6('0x20')](_0x31f652));_0x4463cd(_0x31f652);})['catch'](function(_0x300863){logger[_0x4ef6('0x11')](_0x4ef6('0x15'),_0x300863[_0x4ef6('0x13')],_0x27c432);_0xcc9437(_0x27e17b[_0x4ef6('0x11')](0x1f4,_0x300863[_0x4ef6('0x13')]));});});};exports[_0x4ef6('0x21')]=function(_0x36f9da){var _0x23396b=this;return new Promise(function(_0x4bca1b,_0x4a1656){return db[_0x4ef6('0x16')][_0x4ef6('0x22')]({'raw':_0x36f9da['options']?_0x36f9da[_0x4ef6('0x18')][_0x4ef6('0x19')]===undefined?!![]:![]:!![],'where':_0x36f9da[_0x4ef6('0x18')]?_0x36f9da[_0x4ef6('0x18')]['where']||null:null,'attributes':_0x36f9da[_0x4ef6('0x18')]?_0x36f9da[_0x4ef6('0x18')][_0x4ef6('0x1b')]||null:null,'include':_0x36f9da[_0x4ef6('0x18')]?_0x36f9da[_0x4ef6('0x18')][_0x4ef6('0x1d')]?_[_0x4ef6('0x1f')](_0x36f9da['options']['include'],function(_0x264579){return{'model':db[_0x264579[_0x4ef6('0x1e')]],'as':_0x264579['as'],'attributes':_0x264579[_0x4ef6('0x1b')],'include':_0x264579[_0x4ef6('0x1d')]?_[_0x4ef6('0x1f')](_0x264579[_0x4ef6('0x1d')],function(_0x20ca86){return{'model':db[_0x20ca86['model']],'as':_0x20ca86['as'],'attributes':_0x20ca86[_0x4ef6('0x1b')],'include':_0x20ca86[_0x4ef6('0x1d')]?_['map'](_0x20ca86['include'],function(_0x3c3b1e){return{'model':db[_0x3c3b1e[_0x4ef6('0x1e')]],'as':_0x3c3b1e['as'],'attributes':_0x3c3b1e[_0x4ef6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4ef6('0x23')](function(_0x5c70ad){logger[_0x4ef6('0xc')](_0x4ef6('0x21'),_0x36f9da);logger[_0x4ef6('0xf')](_0x4ef6('0x21'),_0x36f9da,JSON[_0x4ef6('0x20')](_0x5c70ad));_0x4bca1b(_0x5c70ad);})[_0x4ef6('0x14')](function(_0x2458e7){logger['error']('ShowZendeskAccount',_0x2458e7[_0x4ef6('0x13')],_0x36f9da);_0x4a1656(_0x23396b[_0x4ef6('0x11')](0x1f4,_0x2458e7[_0x4ef6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 3bc7e6f..3883f44 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 _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x44f1c0,_0x523564){var _0x2ed1a6=function(_0x3d9b73){while(--_0x3d9b73){_0x44f1c0['push'](_0x44f1c0['shift']());}};_0x2ed1a6(++_0x523564);}(_0x087b,0x11a));var _0xb087=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x087b[_0x2e4e19];return _0x9ba20b;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x2dd976,_0x1b5dc4){var _0x2265fd=function(_0x270d24){while(--_0x270d24){_0x2dd976['push'](_0x2dd976['shift']());}};_0x2265fd(++_0x1b5dc4);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x253714,_0x476a20){_0x253714=_0x253714-0x0;var _0x381e2f=_0x9ffd[_0x253714];return _0x381e2f;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 0fee27f..e5074f7 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 _0x3183=['STRING','sequelize','exports'];(function(_0x48a15e,_0x43ed03){var _0x4ee441=function(_0x11872e){while(--_0x11872e){_0x48a15e['push'](_0x48a15e['shift']());}};_0x4ee441(++_0x43ed03);}(_0x3183,0xa0));var _0x3318=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0x3183[_0x4dbba7];return _0x43ef83;};'use strict';var Sequelize=require(_0x3318('0x0'));module[_0x3318('0x1')]={'name':{'type':Sequelize[_0x3318('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeff9=['exports','STRING','sequelize'];(function(_0x3995c9,_0x5d95f1){var _0xdfa9cf=function(_0x300805){while(--_0x300805){_0x3995c9['push'](_0x3995c9['shift']());}};_0xdfa9cf(++_0x5d95f1);}(_0xeff9,0x110));var _0x9eff=function(_0x5d2588,_0x2153ca){_0x5d2588=_0x5d2588-0x0;var _0x5ca50e=_0xeff9[_0x5d2588];return _0x5ca50e;};'use strict';var Sequelize=require(_0x9eff('0x0'));module[_0x9eff('0x1')]={'name':{'type':Sequelize[_0x9eff('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4dbca64..d705ac3 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 _0xc68d=['count','includeAll','include','findAll','catch','show','params','options','create','body','find','findOne','order','getFields','getSubjects','getDescriptions','ZendeskField','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x2a38dd,_0x3aab0d){var _0x86caea=function(_0xddbd82){while(--_0xddbd82){_0x2a38dd['push'](_0x2a38dd['shift']());}};_0x86caea(++_0x3aab0d);}(_0xc68d,0x6d));var _0xdc68=function(_0x34ea40,_0x709674){_0x34ea40=_0x34ea40-0x0;var _0x482dc5=_0xc68d[_0x34ea40];return _0x482dc5;};'use strict';var emlformat=require(_0xdc68('0x0'));var rimraf=require(_0xdc68('0x1'));var zipdir=require(_0xdc68('0x2'));var jsonpatch=require(_0xdc68('0x3'));var rp=require(_0xdc68('0x4'));var moment=require(_0xdc68('0x5'));var BPromise=require(_0xdc68('0x6'));var Mustache=require(_0xdc68('0x7'));var util=require(_0xdc68('0x8'));var path=require(_0xdc68('0x9'));var sox=require(_0xdc68('0xa'));var csv=require(_0xdc68('0xb'));var ejs=require(_0xdc68('0xc'));var fs=require('fs');var fs_extra=require(_0xdc68('0xd'));var _=require(_0xdc68('0xe'));var squel=require(_0xdc68('0xf'));var crypto=require(_0xdc68('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc68('0xb'));var querystring=require(_0xdc68('0x11'));var Papa=require(_0xdc68('0x12'));var Redis=require(_0xdc68('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdc68('0x14'));var hardwareService=require(_0xdc68('0x15'));var logger=require(_0xdc68('0x16'))(_0xdc68('0x17'));var utils=require(_0xdc68('0x18'));var config=require(_0xdc68('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc68('0x1a'))['db'];function respondWithStatusCode(_0x2be51e,_0xa8b17d){_0xa8b17d=_0xa8b17d||0xcc;return function(_0x24fd41){if(_0x24fd41){return _0x2be51e[_0xdc68('0x1b')](_0xa8b17d);}return _0x2be51e[_0xdc68('0x1c')](_0xa8b17d)['end']();};}function respondWithResult(_0x17bb4b,_0x2f06a6){_0x2f06a6=_0x2f06a6||0xc8;return function(_0x4d4ae8){if(_0x4d4ae8){return _0x17bb4b[_0xdc68('0x1c')](_0x2f06a6)[_0xdc68('0x1d')](_0x4d4ae8);}};}function respondWithFilteredResult(_0x5a8cfa,_0x545d24){return function(_0x19343b){if(_0x19343b){var _0x48c978=typeof _0x545d24[_0xdc68('0x1e')]==='undefined'&&typeof _0x545d24['limit']==='undefined';var _0x4ab9d4=_0x19343b['count'];var _0x1261f0=_0x48c978?0x0:_0x545d24[_0xdc68('0x1e')];var _0x4b856a=_0x48c978?_0x19343b['count']:_0x545d24[_0xdc68('0x1e')]+_0x545d24[_0xdc68('0x1f')];var _0x4ef25f;if(_0x4b856a>=_0x4ab9d4){_0x4b856a=_0x4ab9d4;_0x4ef25f=0xc8;}else{_0x4ef25f=0xce;}_0x5a8cfa[_0xdc68('0x1c')](_0x4ef25f);return _0x5a8cfa[_0xdc68('0x20')](_0xdc68('0x21'),_0x1261f0+'-'+_0x4b856a+'/'+_0x4ab9d4)[_0xdc68('0x1d')](_0x19343b);}return null;};}function patchUpdates(_0x5b47ca){return function(_0x4b2dc7){try{jsonpatch[_0xdc68('0x22')](_0x4b2dc7,_0x5b47ca,!![]);}catch(_0x3fcc20){return BPromise[_0xdc68('0x23')](_0x3fcc20);}return _0x4b2dc7[_0xdc68('0x24')]();};}function saveUpdates(_0xef52f0,_0x5541a1){return function(_0x474931){if(_0x474931){return _0x474931[_0xdc68('0x25')](_0xef52f0)[_0xdc68('0x26')](function(_0x19039b){return _0x19039b;});}return null;};}function removeEntity(_0x416629,_0x5e1e69){return function(_0x392ea5){if(_0x392ea5){return _0x392ea5[_0xdc68('0x27')]()[_0xdc68('0x26')](function(){_0x416629[_0xdc68('0x1c')](0xcc)[_0xdc68('0x28')]();});}};}function handleEntityNotFound(_0x287ca8,_0x5ce1ff){return function(_0x274b41){if(!_0x274b41){_0x287ca8[_0xdc68('0x1b')](0x194);}return _0x274b41;};}function handleError(_0x1b66d9,_0x24aed2){_0x24aed2=_0x24aed2||0x1f4;return function(_0x28eb2a){logger[_0xdc68('0x29')](_0x28eb2a[_0xdc68('0x2a')]);if(_0x28eb2a['name']){delete _0x28eb2a[_0xdc68('0x2b')];}_0x1b66d9['status'](_0x24aed2)[_0xdc68('0x2c')](_0x28eb2a);};}exports['index']=function(_0x335f11,_0x4ede5d){var _0x187321={},_0xd8138e={},_0x159ddf={'count':0x0,'rows':[]};var _0x32c016=_[_0xdc68('0x2d')](db[_0xdc68('0x2e')][_0xdc68('0x2f')],function(_0x3da2ae){return{'name':_0x3da2ae[_0xdc68('0x30')],'type':_0x3da2ae[_0xdc68('0x31')][_0xdc68('0x32')]};});_0xd8138e[_0xdc68('0x33')]=_[_0xdc68('0x2d')](_0x32c016,_0xdc68('0x2b'));_0xd8138e[_0xdc68('0x34')]=_[_0xdc68('0x35')](_0x335f11[_0xdc68('0x34')]);_0xd8138e[_0xdc68('0x36')]=_['intersection'](_0xd8138e[_0xdc68('0x33')],_0xd8138e[_0xdc68('0x34')]);_0x187321[_0xdc68('0x37')]=_[_0xdc68('0x38')](_0xd8138e[_0xdc68('0x33')],qs[_0xdc68('0x39')](_0x335f11[_0xdc68('0x34')][_0xdc68('0x39')]));_0x187321[_0xdc68('0x37')]=_0x187321[_0xdc68('0x37')][_0xdc68('0x3a')]?_0x187321[_0xdc68('0x37')]:_0xd8138e[_0xdc68('0x33')];if(!_0x335f11['query'][_0xdc68('0x3b')](_0xdc68('0x3c'))){_0x187321[_0xdc68('0x1f')]=qs['limit'](_0x335f11[_0xdc68('0x34')][_0xdc68('0x1f')]);_0x187321[_0xdc68('0x1e')]=qs['offset'](_0x335f11[_0xdc68('0x34')][_0xdc68('0x1e')]);}_0x187321['order']=qs[_0xdc68('0x3d')](_0x335f11[_0xdc68('0x34')][_0xdc68('0x3d')]);_0x187321[_0xdc68('0x3e')]=qs['filters'](_[_0xdc68('0x3f')](_0x335f11[_0xdc68('0x34')],_0xd8138e[_0xdc68('0x36')]),_0x32c016);if(_0x335f11['query'][_0xdc68('0x40')]){_0x187321[_0xdc68('0x3e')]=_[_0xdc68('0x41')](_0x187321['where'],{'$or':_[_0xdc68('0x2d')](_0x32c016,function(_0x4f4dda){if(_0x4f4dda['type']!==_0xdc68('0x42')){var _0xdc9613={};_0xdc9613[_0x4f4dda[_0xdc68('0x2b')]]={'$like':'%'+_0x335f11['query'][_0xdc68('0x40')]+'%'};return _0xdc9613;}})});}_0x187321=_[_0xdc68('0x41')]({},_0x187321,_0x335f11['options']);var _0x5c72d9={'where':_0x187321['where']};return db[_0xdc68('0x2e')][_0xdc68('0x43')](_0x5c72d9)['then'](function(_0x2acf4f){_0x159ddf['count']=_0x2acf4f;if(_0x335f11[_0xdc68('0x34')][_0xdc68('0x44')]){_0x187321[_0xdc68('0x45')]=[{'all':!![]}];}return db[_0xdc68('0x2e')][_0xdc68('0x46')](_0x187321);})[_0xdc68('0x26')](function(_0x449210){_0x159ddf['rows']=_0x449210;return _0x159ddf;})['then'](respondWithFilteredResult(_0x4ede5d,_0x187321))[_0xdc68('0x47')](handleError(_0x4ede5d,null));};exports[_0xdc68('0x48')]=function(_0x1d6a08,_0x35e1fc){var _0x3d446b={'raw':![],'where':{'id':_0x1d6a08[_0xdc68('0x49')]['id']}},_0x2434dc={};_0x2434dc[_0xdc68('0x33')]=_['keys'](db[_0xdc68('0x2e')]['rawAttributes']);_0x2434dc[_0xdc68('0x34')]=_[_0xdc68('0x35')](_0x1d6a08['query']);_0x2434dc[_0xdc68('0x36')]=_[_0xdc68('0x38')](_0x2434dc[_0xdc68('0x33')],_0x2434dc[_0xdc68('0x34')]);_0x3d446b[_0xdc68('0x37')]=_[_0xdc68('0x38')](_0x2434dc[_0xdc68('0x33')],qs[_0xdc68('0x39')](_0x1d6a08[_0xdc68('0x34')]['fields']));_0x3d446b['attributes']=_0x3d446b[_0xdc68('0x37')]['length']?_0x3d446b['attributes']:_0x2434dc[_0xdc68('0x33')];if(_0x1d6a08[_0xdc68('0x34')]['includeAll']){_0x3d446b[_0xdc68('0x45')]=[{'all':!![]}];}_0x3d446b=_['merge']({},_0x3d446b,_0x1d6a08[_0xdc68('0x4a')]);return db[_0xdc68('0x2e')]['find'](_0x3d446b)['then'](handleEntityNotFound(_0x35e1fc,null))[_0xdc68('0x26')](respondWithResult(_0x35e1fc,null))[_0xdc68('0x47')](handleError(_0x35e1fc,null));};exports[_0xdc68('0x4b')]=function(_0x13b66f,_0x2fcd18){return db[_0xdc68('0x2e')]['create'](_0x13b66f[_0xdc68('0x4c')],{})[_0xdc68('0x26')](respondWithResult(_0x2fcd18,0xc9))[_0xdc68('0x47')](handleError(_0x2fcd18,null));};exports['update']=function(_0x3368a2,_0x5dccf8){if(_0x3368a2[_0xdc68('0x4c')]['id']){delete _0x3368a2[_0xdc68('0x4c')]['id'];}return db[_0xdc68('0x2e')][_0xdc68('0x4d')]({'where':{'id':_0x3368a2[_0xdc68('0x49')]['id']}})[_0xdc68('0x26')](handleEntityNotFound(_0x5dccf8,null))['then'](saveUpdates(_0x3368a2[_0xdc68('0x4c')],null))[_0xdc68('0x26')](respondWithResult(_0x5dccf8,null))[_0xdc68('0x47')](handleError(_0x5dccf8,null));};exports[_0xdc68('0x27')]=function(_0x23ea7e,_0x2c4aa2){return db[_0xdc68('0x2e')][_0xdc68('0x4d')]({'where':{'id':_0x23ea7e[_0xdc68('0x49')]['id']}})[_0xdc68('0x26')](handleEntityNotFound(_0x2c4aa2,null))[_0xdc68('0x26')](removeEntity(_0x2c4aa2,null))['catch'](handleError(_0x2c4aa2,null));};exports['getFields']=function(_0x3f8fbb,_0x1bc85f,_0x1f74ea){var _0x389b5d={};var _0x261789={};var _0x599882;var _0x584a97;return db['ZendeskConfiguration'][_0xdc68('0x4e')]({'where':{'id':_0x3f8fbb[_0xdc68('0x49')]['id']}})['then'](handleEntityNotFound(_0x1bc85f,null))['then'](function(_0xee9b9f){if(_0xee9b9f){_0x599882=_0xee9b9f;_0x261789['model']=_[_0xdc68('0x35')](db['ZendeskField'][_0xdc68('0x2f')]);_0x261789['query']=_[_0xdc68('0x35')](_0x3f8fbb[_0xdc68('0x34')]);_0x261789[_0xdc68('0x36')]=_[_0xdc68('0x38')](_0x261789['model'],_0x261789[_0xdc68('0x34')]);_0x389b5d[_0xdc68('0x37')]=_[_0xdc68('0x38')](_0x261789[_0xdc68('0x33')],qs[_0xdc68('0x39')](_0x3f8fbb['query'][_0xdc68('0x39')]));_0x389b5d['attributes']=_0x389b5d[_0xdc68('0x37')]['length']?_0x389b5d[_0xdc68('0x37')]:_0x261789[_0xdc68('0x33')];_0x389b5d[_0xdc68('0x4f')]=qs[_0xdc68('0x3d')](_0x3f8fbb['query']['sort']);_0x389b5d[_0xdc68('0x3e')]=qs[_0xdc68('0x36')](_[_0xdc68('0x3f')](_0x3f8fbb['query'],_0x261789[_0xdc68('0x36')]));if(_0x3f8fbb[_0xdc68('0x34')][_0xdc68('0x40')]){_0x389b5d[_0xdc68('0x3e')]=_['merge'](_0x389b5d[_0xdc68('0x3e')],{'$or':_[_0xdc68('0x2d')](_0x389b5d[_0xdc68('0x37')],function(_0x4f693b){var _0x5e832a={};_0x5e832a[_0x4f693b]={'$like':'%'+_0x3f8fbb[_0xdc68('0x34')][_0xdc68('0x40')]+'%'};return _0x5e832a;})});}_0x389b5d=_[_0xdc68('0x41')]({},_0x389b5d,_0x3f8fbb['options']);return _0x599882[_0xdc68('0x50')](_0x389b5d);}})['then'](function(_0x1af182){if(_0x1af182){_0x584a97=_0x1af182[_0xdc68('0x3a')];if(!_0x3f8fbb[_0xdc68('0x34')][_0xdc68('0x3b')](_0xdc68('0x3c'))){_0x389b5d[_0xdc68('0x1f')]=qs[_0xdc68('0x1f')](_0x3f8fbb[_0xdc68('0x34')]['limit']);_0x389b5d[_0xdc68('0x1e')]=qs['offset'](_0x3f8fbb[_0xdc68('0x34')]['offset']);}return _0x599882[_0xdc68('0x50')](_0x389b5d);}})[_0xdc68('0x26')](function(_0x382b39){if(_0x382b39){return _0x382b39?{'count':_0x584a97,'rows':_0x382b39}:null;}})['then'](respondWithResult(_0x1bc85f,null))[_0xdc68('0x47')](handleError(_0x1bc85f,null));};exports[_0xdc68('0x51')]=function(_0x39deec,_0x588f6b,_0x117d14){var _0x1d575c={};var _0x4634a7={};var _0x235728;var _0x2d4a24;return db['ZendeskConfiguration'][_0xdc68('0x4e')]({'where':{'id':_0x39deec[_0xdc68('0x49')]['id']}})['then'](handleEntityNotFound(_0x588f6b,null))[_0xdc68('0x26')](function(_0x32b7c3){if(_0x32b7c3){_0x235728=_0x32b7c3;_0x4634a7[_0xdc68('0x33')]=_[_0xdc68('0x35')](db['ZendeskField'][_0xdc68('0x2f')]);_0x4634a7['query']=_[_0xdc68('0x35')](_0x39deec[_0xdc68('0x34')]);_0x4634a7[_0xdc68('0x36')]=_[_0xdc68('0x38')](_0x4634a7[_0xdc68('0x33')],_0x4634a7[_0xdc68('0x34')]);_0x1d575c[_0xdc68('0x37')]=_[_0xdc68('0x38')](_0x4634a7[_0xdc68('0x33')],qs[_0xdc68('0x39')](_0x39deec[_0xdc68('0x34')][_0xdc68('0x39')]));_0x1d575c[_0xdc68('0x37')]=_0x1d575c[_0xdc68('0x37')][_0xdc68('0x3a')]?_0x1d575c[_0xdc68('0x37')]:_0x4634a7[_0xdc68('0x33')];_0x1d575c[_0xdc68('0x4f')]=qs['sort'](_0x39deec[_0xdc68('0x34')][_0xdc68('0x3d')]);_0x1d575c[_0xdc68('0x3e')]=qs['filters'](_[_0xdc68('0x3f')](_0x39deec[_0xdc68('0x34')],_0x4634a7[_0xdc68('0x36')]));if(_0x39deec[_0xdc68('0x34')][_0xdc68('0x40')]){_0x1d575c[_0xdc68('0x3e')]=_[_0xdc68('0x41')](_0x1d575c[_0xdc68('0x3e')],{'$or':_[_0xdc68('0x2d')](_0x1d575c[_0xdc68('0x37')],function(_0x4958d7){var _0x46b3a0={};_0x46b3a0[_0x4958d7]={'$like':'%'+_0x39deec[_0xdc68('0x34')][_0xdc68('0x40')]+'%'};return _0x46b3a0;})});}_0x1d575c=_['merge']({},_0x1d575c,_0x39deec[_0xdc68('0x4a')]);return _0x235728['getSubjects'](_0x1d575c);}})['then'](function(_0x58f74e){if(_0x58f74e){_0x2d4a24=_0x58f74e[_0xdc68('0x3a')];if(!_0x39deec[_0xdc68('0x34')][_0xdc68('0x3b')](_0xdc68('0x3c'))){_0x1d575c['limit']=qs['limit'](_0x39deec[_0xdc68('0x34')]['limit']);_0x1d575c[_0xdc68('0x1e')]=qs['offset'](_0x39deec['query']['offset']);}return _0x235728['getSubjects'](_0x1d575c);}})[_0xdc68('0x26')](function(_0x361824){if(_0x361824){return _0x361824?{'count':_0x2d4a24,'rows':_0x361824}:null;}})[_0xdc68('0x26')](respondWithResult(_0x588f6b,null))[_0xdc68('0x47')](handleError(_0x588f6b,null));};exports[_0xdc68('0x52')]=function(_0x417fb9,_0x184688,_0x3b6457){var _0x19adba={};var _0xe149c8={};var _0xf0bd44;var _0x3420e6;return db[_0xdc68('0x2e')]['findOne']({'where':{'id':_0x417fb9[_0xdc68('0x49')]['id']}})[_0xdc68('0x26')](handleEntityNotFound(_0x184688,null))[_0xdc68('0x26')](function(_0x5e32e7){if(_0x5e32e7){_0xf0bd44=_0x5e32e7;_0xe149c8[_0xdc68('0x33')]=_[_0xdc68('0x35')](db[_0xdc68('0x53')][_0xdc68('0x2f')]);_0xe149c8[_0xdc68('0x34')]=_[_0xdc68('0x35')](_0x417fb9[_0xdc68('0x34')]);_0xe149c8[_0xdc68('0x36')]=_[_0xdc68('0x38')](_0xe149c8['model'],_0xe149c8['query']);_0x19adba[_0xdc68('0x37')]=_[_0xdc68('0x38')](_0xe149c8['model'],qs[_0xdc68('0x39')](_0x417fb9['query'][_0xdc68('0x39')]));_0x19adba[_0xdc68('0x37')]=_0x19adba['attributes']['length']?_0x19adba['attributes']:_0xe149c8['model'];_0x19adba[_0xdc68('0x4f')]=qs['sort'](_0x417fb9[_0xdc68('0x34')][_0xdc68('0x3d')]);_0x19adba[_0xdc68('0x3e')]=qs[_0xdc68('0x36')](_[_0xdc68('0x3f')](_0x417fb9[_0xdc68('0x34')],_0xe149c8[_0xdc68('0x36')]));if(_0x417fb9[_0xdc68('0x34')]['filter']){_0x19adba[_0xdc68('0x3e')]=_[_0xdc68('0x41')](_0x19adba[_0xdc68('0x3e')],{'$or':_['map'](_0x19adba[_0xdc68('0x37')],function(_0x32b0c8){var _0x208e26={};_0x208e26[_0x32b0c8]={'$like':'%'+_0x417fb9[_0xdc68('0x34')][_0xdc68('0x40')]+'%'};return _0x208e26;})});}_0x19adba=_[_0xdc68('0x41')]({},_0x19adba,_0x417fb9[_0xdc68('0x4a')]);return _0xf0bd44['getDescriptions'](_0x19adba);}})['then'](function(_0x36c8f4){if(_0x36c8f4){_0x3420e6=_0x36c8f4[_0xdc68('0x3a')];if(!_0x417fb9[_0xdc68('0x34')][_0xdc68('0x3b')](_0xdc68('0x3c'))){_0x19adba[_0xdc68('0x1f')]=qs[_0xdc68('0x1f')](_0x417fb9[_0xdc68('0x34')][_0xdc68('0x1f')]);_0x19adba[_0xdc68('0x1e')]=qs[_0xdc68('0x1e')](_0x417fb9[_0xdc68('0x34')]['offset']);}return _0xf0bd44[_0xdc68('0x52')](_0x19adba);}})[_0xdc68('0x26')](function(_0x2b4f7d){if(_0x2b4f7d){return _0x2b4f7d?{'count':_0x3420e6,'rows':_0x2b4f7d}:null;}})[_0xdc68('0x26')](respondWithResult(_0x184688,null))[_0xdc68('0x47')](handleError(_0x184688,null));};exports[_0xdc68('0x54')]=function(_0xeebe1a,_0x42c1e6,_0x3f19b8){var _0x81a778={};var _0x3d4ec0={};var _0x546131;var _0x3e31d5;return db[_0xdc68('0x2e')][_0xdc68('0x4e')]({'where':{'id':_0xeebe1a[_0xdc68('0x49')]['id']}})[_0xdc68('0x26')](handleEntityNotFound(_0x42c1e6,null))[_0xdc68('0x26')](function(_0x1dabe6){if(_0x1dabe6){_0x546131=_0x1dabe6;_0x3d4ec0[_0xdc68('0x33')]=_[_0xdc68('0x35')](db[_0xdc68('0x55')][_0xdc68('0x2f')]);_0x3d4ec0[_0xdc68('0x34')]=_[_0xdc68('0x35')](_0xeebe1a[_0xdc68('0x34')]);_0x3d4ec0[_0xdc68('0x36')]=_[_0xdc68('0x38')](_0x3d4ec0[_0xdc68('0x33')],_0x3d4ec0[_0xdc68('0x34')]);_0x81a778['attributes']=_[_0xdc68('0x38')](_0x3d4ec0[_0xdc68('0x33')],qs[_0xdc68('0x39')](_0xeebe1a['query'][_0xdc68('0x39')]));_0x81a778[_0xdc68('0x37')]=_0x81a778['attributes'][_0xdc68('0x3a')]?_0x81a778['attributes']:_0x3d4ec0[_0xdc68('0x33')];_0x81a778['order']=qs[_0xdc68('0x3d')](_0xeebe1a[_0xdc68('0x34')][_0xdc68('0x3d')]);_0x81a778[_0xdc68('0x3e')]=qs[_0xdc68('0x36')](_[_0xdc68('0x3f')](_0xeebe1a[_0xdc68('0x34')],_0x3d4ec0[_0xdc68('0x36')]));if(_0xeebe1a[_0xdc68('0x34')][_0xdc68('0x40')]){_0x81a778[_0xdc68('0x3e')]=_[_0xdc68('0x41')](_0x81a778[_0xdc68('0x3e')],{'$or':_[_0xdc68('0x2d')](_0x81a778[_0xdc68('0x37')],function(_0x25f899){var _0xe1d4f9={};_0xe1d4f9[_0x25f899]={'$like':'%'+_0xeebe1a[_0xdc68('0x34')][_0xdc68('0x40')]+'%'};return _0xe1d4f9;})});}_0x81a778=_[_0xdc68('0x41')]({},_0x81a778,_0xeebe1a[_0xdc68('0x4a')]);return _0x546131[_0xdc68('0x54')](_0x81a778);}})['then'](function(_0x328726){if(_0x328726){_0x3e31d5=_0x328726[_0xdc68('0x3a')];if(!_0xeebe1a[_0xdc68('0x34')][_0xdc68('0x3b')](_0xdc68('0x3c'))){_0x81a778[_0xdc68('0x1f')]=qs['limit'](_0xeebe1a[_0xdc68('0x34')][_0xdc68('0x1f')]);_0x81a778[_0xdc68('0x1e')]=qs[_0xdc68('0x1e')](_0xeebe1a[_0xdc68('0x34')]['offset']);}return _0x546131['getTags'](_0x81a778);}})[_0xdc68('0x26')](function(_0xc3fa16){if(_0xc3fa16){return _0xc3fa16?{'count':_0x3e31d5,'rows':_0xc3fa16}:null;}})[_0xdc68('0x26')](respondWithResult(_0x42c1e6,null))[_0xdc68('0x47')](handleError(_0x42c1e6,null));};exports[_0xdc68('0x56')]=function(_0x1a61e0,_0x4a2b14,_0x241444){if(_0x1a61e0[_0xdc68('0x4c')]['id']){delete _0x1a61e0[_0xdc68('0x4c')]['id'];}return db[_0xdc68('0x2e')][_0xdc68('0x4e')]({'where':{'id':_0x1a61e0[_0xdc68('0x49')]['id']}})[_0xdc68('0x26')](handleEntityNotFound(_0x4a2b14,null))[_0xdc68('0x26')](function(_0x190148){if(_0x190148){return _0x190148[_0xdc68('0x56')](_0x1a61e0[_0xdc68('0x4c')][_0xdc68('0x57')]||[]);}return null;})[_0xdc68('0x26')](respondWithResult(_0x4a2b14,null))[_0xdc68('0x47')](handleError(_0x4a2b14,null));}; \ No newline at end of file +var _0x548a=['map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','ZendeskConfiguration','findAll','catch','show','params','find','create','update','body','destroy','getFields','findOne','ZendeskField','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','end','error','stack','name','send','index'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x548a,0x81));var _0xa548=function(_0x2a96b6,_0x51e78c){_0x2a96b6=_0x2a96b6-0x0;var _0x59c0de=_0x548a[_0x2a96b6];return _0x59c0de;};'use strict';var emlformat=require(_0xa548('0x0'));var rimraf=require(_0xa548('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa548('0x2'));var rp=require(_0xa548('0x3'));var moment=require(_0xa548('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa548('0x5'));var util=require(_0xa548('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa548('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa548('0x8'));var _=require(_0xa548('0x9'));var squel=require(_0xa548('0xa'));var crypto=require(_0xa548('0xb'));var jsforce=require(_0xa548('0xc'));var deskjs=require(_0xa548('0xd'));var toCsv=require(_0xa548('0x7'));var querystring=require(_0xa548('0xe'));var Papa=require(_0xa548('0xf'));var Redis=require(_0xa548('0x10'));var authService=require(_0xa548('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa548('0x12'));var hardwareService=require(_0xa548('0x13'));var logger=require(_0xa548('0x14'))(_0xa548('0x15'));var utils=require('../../config/utils');var config=require(_0xa548('0x16'));var licenseUtil=require(_0xa548('0x17'));var db=require(_0xa548('0x18'))['db'];function respondWithStatusCode(_0x5dbc03,_0x524921){_0x524921=_0x524921||0xcc;return function(_0xe642ed){if(_0xe642ed){return _0x5dbc03[_0xa548('0x19')](_0x524921);}return _0x5dbc03[_0xa548('0x1a')](_0x524921)['end']();};}function respondWithResult(_0x1486f6,_0x3479d4){_0x3479d4=_0x3479d4||0xc8;return function(_0x567263){if(_0x567263){return _0x1486f6[_0xa548('0x1a')](_0x3479d4)[_0xa548('0x1b')](_0x567263);}};}function respondWithFilteredResult(_0x3a6010,_0x331bc5){return function(_0x1a9542){if(_0x1a9542){var _0x2f5459=typeof _0x331bc5[_0xa548('0x1c')]===_0xa548('0x1d')&&typeof _0x331bc5[_0xa548('0x1e')]==='undefined';var _0x20d7a2=_0x1a9542[_0xa548('0x1f')];var _0xa4d627=_0x2f5459?0x0:_0x331bc5[_0xa548('0x1c')];var _0x507b99=_0x2f5459?_0x1a9542[_0xa548('0x1f')]:_0x331bc5[_0xa548('0x1c')]+_0x331bc5[_0xa548('0x1e')];var _0x2853be;if(_0x507b99>=_0x20d7a2){_0x507b99=_0x20d7a2;_0x2853be=0xc8;}else{_0x2853be=0xce;}_0x3a6010[_0xa548('0x1a')](_0x2853be);return _0x3a6010[_0xa548('0x20')]('Content-Range',_0xa4d627+'-'+_0x507b99+'/'+_0x20d7a2)[_0xa548('0x1b')](_0x1a9542);}return null;};}function patchUpdates(_0x198473){return function(_0xa47e60){try{jsonpatch[_0xa548('0x21')](_0xa47e60,_0x198473,!![]);}catch(_0x370078){return BPromise[_0xa548('0x22')](_0x370078);}return _0xa47e60[_0xa548('0x23')]();};}function saveUpdates(_0xe74f91,_0xd9df3b){return function(_0x10c5fb){if(_0x10c5fb){return _0x10c5fb['update'](_0xe74f91)['then'](function(_0x226dde){return _0x226dde;});}return null;};}function removeEntity(_0x24bfba,_0x1cf248){return function(_0x2367d4){if(_0x2367d4){return _0x2367d4['destroy']()[_0xa548('0x24')](function(){_0x24bfba[_0xa548('0x1a')](0xcc)[_0xa548('0x25')]();});}};}function handleEntityNotFound(_0x2cceba,_0x328d47){return function(_0xbc6f00){if(!_0xbc6f00){_0x2cceba[_0xa548('0x19')](0x194);}return _0xbc6f00;};}function handleError(_0x34be20,_0x4bd87d){_0x4bd87d=_0x4bd87d||0x1f4;return function(_0x36a391){logger[_0xa548('0x26')](_0x36a391[_0xa548('0x27')]);if(_0x36a391[_0xa548('0x28')]){delete _0x36a391[_0xa548('0x28')];}_0x34be20[_0xa548('0x1a')](_0x4bd87d)[_0xa548('0x29')](_0x36a391);};}exports[_0xa548('0x2a')]=function(_0x1254dd,_0x25be58){var _0x16c8e9={},_0x108811={},_0x3cfb31={'count':0x0,'rows':[]};var _0x1db6bf=_[_0xa548('0x2b')](db['ZendeskConfiguration'][_0xa548('0x2c')],function(_0x2d0c90){return{'name':_0x2d0c90[_0xa548('0x2d')],'type':_0x2d0c90[_0xa548('0x2e')][_0xa548('0x2f')]};});_0x108811['model']=_[_0xa548('0x2b')](_0x1db6bf,_0xa548('0x28'));_0x108811[_0xa548('0x30')]=_[_0xa548('0x31')](_0x1254dd['query']);_0x108811['filters']=_[_0xa548('0x32')](_0x108811[_0xa548('0x33')],_0x108811['query']);_0x16c8e9['attributes']=_['intersection'](_0x108811[_0xa548('0x33')],qs[_0xa548('0x34')](_0x1254dd['query']['fields']));_0x16c8e9[_0xa548('0x35')]=_0x16c8e9[_0xa548('0x35')][_0xa548('0x36')]?_0x16c8e9['attributes']:_0x108811[_0xa548('0x33')];if(!_0x1254dd[_0xa548('0x30')][_0xa548('0x37')](_0xa548('0x38'))){_0x16c8e9['limit']=qs['limit'](_0x1254dd[_0xa548('0x30')]['limit']);_0x16c8e9[_0xa548('0x1c')]=qs['offset'](_0x1254dd[_0xa548('0x30')][_0xa548('0x1c')]);}_0x16c8e9[_0xa548('0x39')]=qs[_0xa548('0x3a')](_0x1254dd['query'][_0xa548('0x3a')]);_0x16c8e9[_0xa548('0x3b')]=qs[_0xa548('0x3c')](_['pick'](_0x1254dd[_0xa548('0x30')],_0x108811[_0xa548('0x3c')]),_0x1db6bf);if(_0x1254dd[_0xa548('0x30')]['filter']){_0x16c8e9[_0xa548('0x3b')]=_[_0xa548('0x3d')](_0x16c8e9[_0xa548('0x3b')],{'$or':_['map'](_0x1db6bf,function(_0x2a7645){if(_0x2a7645['type']!=='VIRTUAL'){var _0x112fef={};_0x112fef[_0x2a7645['name']]={'$like':'%'+_0x1254dd['query'][_0xa548('0x3e')]+'%'};return _0x112fef;}})});}_0x16c8e9=_[_0xa548('0x3d')]({},_0x16c8e9,_0x1254dd[_0xa548('0x3f')]);var _0x414e94={'where':_0x16c8e9[_0xa548('0x3b')]};return db['ZendeskConfiguration'][_0xa548('0x1f')](_0x414e94)['then'](function(_0x1314ce){_0x3cfb31[_0xa548('0x1f')]=_0x1314ce;if(_0x1254dd['query'][_0xa548('0x40')]){_0x16c8e9[_0xa548('0x41')]=[{'all':!![]}];}return db[_0xa548('0x42')][_0xa548('0x43')](_0x16c8e9);})[_0xa548('0x24')](function(_0x42270c){_0x3cfb31['rows']=_0x42270c;return _0x3cfb31;})[_0xa548('0x24')](respondWithFilteredResult(_0x25be58,_0x16c8e9))[_0xa548('0x44')](handleError(_0x25be58,null));};exports[_0xa548('0x45')]=function(_0x2519a4,_0x22a4c7){var _0x590d47={'raw':![],'where':{'id':_0x2519a4[_0xa548('0x46')]['id']}},_0x85fc05={};_0x85fc05[_0xa548('0x33')]=_[_0xa548('0x31')](db['ZendeskConfiguration']['rawAttributes']);_0x85fc05[_0xa548('0x30')]=_[_0xa548('0x31')](_0x2519a4[_0xa548('0x30')]);_0x85fc05[_0xa548('0x3c')]=_['intersection'](_0x85fc05[_0xa548('0x33')],_0x85fc05[_0xa548('0x30')]);_0x590d47[_0xa548('0x35')]=_[_0xa548('0x32')](_0x85fc05[_0xa548('0x33')],qs[_0xa548('0x34')](_0x2519a4[_0xa548('0x30')]['fields']));_0x590d47['attributes']=_0x590d47['attributes'][_0xa548('0x36')]?_0x590d47[_0xa548('0x35')]:_0x85fc05[_0xa548('0x33')];if(_0x2519a4[_0xa548('0x30')][_0xa548('0x40')]){_0x590d47[_0xa548('0x41')]=[{'all':!![]}];}_0x590d47=_['merge']({},_0x590d47,_0x2519a4[_0xa548('0x3f')]);return db[_0xa548('0x42')][_0xa548('0x47')](_0x590d47)[_0xa548('0x24')](handleEntityNotFound(_0x22a4c7,null))['then'](respondWithResult(_0x22a4c7,null))[_0xa548('0x44')](handleError(_0x22a4c7,null));};exports[_0xa548('0x48')]=function(_0x4bdfd1,_0x2a8c25){return db[_0xa548('0x42')]['create'](_0x4bdfd1['body'],{})[_0xa548('0x24')](respondWithResult(_0x2a8c25,0xc9))[_0xa548('0x44')](handleError(_0x2a8c25,null));};exports[_0xa548('0x49')]=function(_0x51b71f,_0x189eda){if(_0x51b71f[_0xa548('0x4a')]['id']){delete _0x51b71f[_0xa548('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xa548('0x47')]({'where':{'id':_0x51b71f[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x189eda,null))[_0xa548('0x24')](saveUpdates(_0x51b71f['body'],null))[_0xa548('0x24')](respondWithResult(_0x189eda,null))[_0xa548('0x44')](handleError(_0x189eda,null));};exports[_0xa548('0x4b')]=function(_0x1c6721,_0x4101d7){return db[_0xa548('0x42')][_0xa548('0x47')]({'where':{'id':_0x1c6721['params']['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x4101d7,null))[_0xa548('0x24')](removeEntity(_0x4101d7,null))['catch'](handleError(_0x4101d7,null));};exports[_0xa548('0x4c')]=function(_0x2d7cdc,_0x1343a0,_0x53fe63){var _0x3d7f26={};var _0x21bfb5={};var _0x59479b;var _0x488d43;return db[_0xa548('0x42')][_0xa548('0x4d')]({'where':{'id':_0x2d7cdc[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x1343a0,null))[_0xa548('0x24')](function(_0x31c3a8){if(_0x31c3a8){_0x59479b=_0x31c3a8;_0x21bfb5[_0xa548('0x33')]=_[_0xa548('0x31')](db[_0xa548('0x4e')]['rawAttributes']);_0x21bfb5['query']=_['keys'](_0x2d7cdc[_0xa548('0x30')]);_0x21bfb5['filters']=_['intersection'](_0x21bfb5[_0xa548('0x33')],_0x21bfb5[_0xa548('0x30')]);_0x3d7f26[_0xa548('0x35')]=_['intersection'](_0x21bfb5[_0xa548('0x33')],qs[_0xa548('0x34')](_0x2d7cdc[_0xa548('0x30')][_0xa548('0x34')]));_0x3d7f26[_0xa548('0x35')]=_0x3d7f26[_0xa548('0x35')]['length']?_0x3d7f26['attributes']:_0x21bfb5[_0xa548('0x33')];_0x3d7f26[_0xa548('0x39')]=qs[_0xa548('0x3a')](_0x2d7cdc[_0xa548('0x30')]['sort']);_0x3d7f26[_0xa548('0x3b')]=qs[_0xa548('0x3c')](_['pick'](_0x2d7cdc[_0xa548('0x30')],_0x21bfb5[_0xa548('0x3c')]));if(_0x2d7cdc['query'][_0xa548('0x3e')]){_0x3d7f26[_0xa548('0x3b')]=_[_0xa548('0x3d')](_0x3d7f26[_0xa548('0x3b')],{'$or':_[_0xa548('0x2b')](_0x3d7f26['attributes'],function(_0x47721d){var _0x302ddc={};_0x302ddc[_0x47721d]={'$like':'%'+_0x2d7cdc[_0xa548('0x30')][_0xa548('0x3e')]+'%'};return _0x302ddc;})});}_0x3d7f26=_[_0xa548('0x3d')]({},_0x3d7f26,_0x2d7cdc[_0xa548('0x3f')]);return _0x59479b[_0xa548('0x4c')](_0x3d7f26);}})[_0xa548('0x24')](function(_0x4cfea2){if(_0x4cfea2){_0x488d43=_0x4cfea2['length'];if(!_0x2d7cdc[_0xa548('0x30')]['hasOwnProperty'](_0xa548('0x38'))){_0x3d7f26[_0xa548('0x1e')]=qs[_0xa548('0x1e')](_0x2d7cdc[_0xa548('0x30')][_0xa548('0x1e')]);_0x3d7f26[_0xa548('0x1c')]=qs[_0xa548('0x1c')](_0x2d7cdc[_0xa548('0x30')][_0xa548('0x1c')]);}return _0x59479b['getFields'](_0x3d7f26);}})[_0xa548('0x24')](function(_0x5d4292){if(_0x5d4292){return _0x5d4292?{'count':_0x488d43,'rows':_0x5d4292}:null;}})['then'](respondWithResult(_0x1343a0,null))[_0xa548('0x44')](handleError(_0x1343a0,null));};exports[_0xa548('0x4f')]=function(_0x12cf69,_0x436bf9,_0x26f8d9){var _0x5df31e={};var _0x4c9a93={};var _0x332bbc;var _0x57cb5e;return db[_0xa548('0x42')][_0xa548('0x4d')]({'where':{'id':_0x12cf69[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x436bf9,null))[_0xa548('0x24')](function(_0x46f9c3){if(_0x46f9c3){_0x332bbc=_0x46f9c3;_0x4c9a93['model']=_['keys'](db[_0xa548('0x4e')][_0xa548('0x2c')]);_0x4c9a93['query']=_['keys'](_0x12cf69[_0xa548('0x30')]);_0x4c9a93[_0xa548('0x3c')]=_[_0xa548('0x32')](_0x4c9a93[_0xa548('0x33')],_0x4c9a93[_0xa548('0x30')]);_0x5df31e['attributes']=_[_0xa548('0x32')](_0x4c9a93[_0xa548('0x33')],qs[_0xa548('0x34')](_0x12cf69['query']['fields']));_0x5df31e[_0xa548('0x35')]=_0x5df31e[_0xa548('0x35')][_0xa548('0x36')]?_0x5df31e['attributes']:_0x4c9a93[_0xa548('0x33')];_0x5df31e[_0xa548('0x39')]=qs[_0xa548('0x3a')](_0x12cf69[_0xa548('0x30')][_0xa548('0x3a')]);_0x5df31e[_0xa548('0x3b')]=qs[_0xa548('0x3c')](_[_0xa548('0x50')](_0x12cf69['query'],_0x4c9a93[_0xa548('0x3c')]));if(_0x12cf69[_0xa548('0x30')][_0xa548('0x3e')]){_0x5df31e[_0xa548('0x3b')]=_[_0xa548('0x3d')](_0x5df31e[_0xa548('0x3b')],{'$or':_[_0xa548('0x2b')](_0x5df31e[_0xa548('0x35')],function(_0x1c1987){var _0x2b121b={};_0x2b121b[_0x1c1987]={'$like':'%'+_0x12cf69[_0xa548('0x30')][_0xa548('0x3e')]+'%'};return _0x2b121b;})});}_0x5df31e=_['merge']({},_0x5df31e,_0x12cf69['options']);return _0x332bbc[_0xa548('0x4f')](_0x5df31e);}})['then'](function(_0xa49ce0){if(_0xa49ce0){_0x57cb5e=_0xa49ce0[_0xa548('0x36')];if(!_0x12cf69[_0xa548('0x30')][_0xa548('0x37')]('nolimit')){_0x5df31e[_0xa548('0x1e')]=qs[_0xa548('0x1e')](_0x12cf69[_0xa548('0x30')]['limit']);_0x5df31e[_0xa548('0x1c')]=qs['offset'](_0x12cf69[_0xa548('0x30')][_0xa548('0x1c')]);}return _0x332bbc[_0xa548('0x4f')](_0x5df31e);}})[_0xa548('0x24')](function(_0x748e61){if(_0x748e61){return _0x748e61?{'count':_0x57cb5e,'rows':_0x748e61}:null;}})[_0xa548('0x24')](respondWithResult(_0x436bf9,null))[_0xa548('0x44')](handleError(_0x436bf9,null));};exports[_0xa548('0x51')]=function(_0x2f59e7,_0x387bdd,_0x353008){var _0xd2eafc={};var _0x2319ff={};var _0x20de44;var _0x5ad823;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2f59e7[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x387bdd,null))[_0xa548('0x24')](function(_0x577585){if(_0x577585){_0x20de44=_0x577585;_0x2319ff['model']=_['keys'](db[_0xa548('0x4e')][_0xa548('0x2c')]);_0x2319ff['query']=_[_0xa548('0x31')](_0x2f59e7['query']);_0x2319ff[_0xa548('0x3c')]=_[_0xa548('0x32')](_0x2319ff[_0xa548('0x33')],_0x2319ff[_0xa548('0x30')]);_0xd2eafc[_0xa548('0x35')]=_[_0xa548('0x32')](_0x2319ff[_0xa548('0x33')],qs[_0xa548('0x34')](_0x2f59e7[_0xa548('0x30')][_0xa548('0x34')]));_0xd2eafc[_0xa548('0x35')]=_0xd2eafc[_0xa548('0x35')][_0xa548('0x36')]?_0xd2eafc['attributes']:_0x2319ff[_0xa548('0x33')];_0xd2eafc['order']=qs[_0xa548('0x3a')](_0x2f59e7[_0xa548('0x30')][_0xa548('0x3a')]);_0xd2eafc[_0xa548('0x3b')]=qs['filters'](_[_0xa548('0x50')](_0x2f59e7[_0xa548('0x30')],_0x2319ff[_0xa548('0x3c')]));if(_0x2f59e7[_0xa548('0x30')][_0xa548('0x3e')]){_0xd2eafc[_0xa548('0x3b')]=_[_0xa548('0x3d')](_0xd2eafc[_0xa548('0x3b')],{'$or':_[_0xa548('0x2b')](_0xd2eafc[_0xa548('0x35')],function(_0x310dc1){var _0xca21c2={};_0xca21c2[_0x310dc1]={'$like':'%'+_0x2f59e7[_0xa548('0x30')][_0xa548('0x3e')]+'%'};return _0xca21c2;})});}_0xd2eafc=_[_0xa548('0x3d')]({},_0xd2eafc,_0x2f59e7[_0xa548('0x3f')]);return _0x20de44[_0xa548('0x51')](_0xd2eafc);}})[_0xa548('0x24')](function(_0x624140){if(_0x624140){_0x5ad823=_0x624140[_0xa548('0x36')];if(!_0x2f59e7[_0xa548('0x30')][_0xa548('0x37')]('nolimit')){_0xd2eafc[_0xa548('0x1e')]=qs[_0xa548('0x1e')](_0x2f59e7[_0xa548('0x30')][_0xa548('0x1e')]);_0xd2eafc[_0xa548('0x1c')]=qs['offset'](_0x2f59e7[_0xa548('0x30')][_0xa548('0x1c')]);}return _0x20de44['getDescriptions'](_0xd2eafc);}})[_0xa548('0x24')](function(_0x20c9ab){if(_0x20c9ab){return _0x20c9ab?{'count':_0x5ad823,'rows':_0x20c9ab}:null;}})['then'](respondWithResult(_0x387bdd,null))[_0xa548('0x44')](handleError(_0x387bdd,null));};exports[_0xa548('0x52')]=function(_0x306d0e,_0x4a0abc,_0x42cb9c){var _0x4a90e6={};var _0x5555ee={};var _0x541879;var _0x173989;return db[_0xa548('0x42')][_0xa548('0x4d')]({'where':{'id':_0x306d0e[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x4a0abc,null))['then'](function(_0x482965){if(_0x482965){_0x541879=_0x482965;_0x5555ee[_0xa548('0x33')]=_[_0xa548('0x31')](db[_0xa548('0x53')][_0xa548('0x2c')]);_0x5555ee[_0xa548('0x30')]=_[_0xa548('0x31')](_0x306d0e[_0xa548('0x30')]);_0x5555ee['filters']=_[_0xa548('0x32')](_0x5555ee['model'],_0x5555ee[_0xa548('0x30')]);_0x4a90e6[_0xa548('0x35')]=_[_0xa548('0x32')](_0x5555ee[_0xa548('0x33')],qs[_0xa548('0x34')](_0x306d0e[_0xa548('0x30')][_0xa548('0x34')]));_0x4a90e6[_0xa548('0x35')]=_0x4a90e6[_0xa548('0x35')]['length']?_0x4a90e6[_0xa548('0x35')]:_0x5555ee[_0xa548('0x33')];_0x4a90e6['order']=qs['sort'](_0x306d0e[_0xa548('0x30')][_0xa548('0x3a')]);_0x4a90e6[_0xa548('0x3b')]=qs[_0xa548('0x3c')](_[_0xa548('0x50')](_0x306d0e[_0xa548('0x30')],_0x5555ee[_0xa548('0x3c')]));if(_0x306d0e[_0xa548('0x30')][_0xa548('0x3e')]){_0x4a90e6['where']=_[_0xa548('0x3d')](_0x4a90e6[_0xa548('0x3b')],{'$or':_[_0xa548('0x2b')](_0x4a90e6[_0xa548('0x35')],function(_0x3c3f7a){var _0x1ee54d={};_0x1ee54d[_0x3c3f7a]={'$like':'%'+_0x306d0e[_0xa548('0x30')][_0xa548('0x3e')]+'%'};return _0x1ee54d;})});}_0x4a90e6=_[_0xa548('0x3d')]({},_0x4a90e6,_0x306d0e[_0xa548('0x3f')]);return _0x541879[_0xa548('0x52')](_0x4a90e6);}})['then'](function(_0x252583){if(_0x252583){_0x173989=_0x252583['length'];if(!_0x306d0e['query']['hasOwnProperty']('nolimit')){_0x4a90e6[_0xa548('0x1e')]=qs[_0xa548('0x1e')](_0x306d0e['query'][_0xa548('0x1e')]);_0x4a90e6[_0xa548('0x1c')]=qs[_0xa548('0x1c')](_0x306d0e[_0xa548('0x30')][_0xa548('0x1c')]);}return _0x541879['getTags'](_0x4a90e6);}})[_0xa548('0x24')](function(_0x5d5061){if(_0x5d5061){return _0x5d5061?{'count':_0x173989,'rows':_0x5d5061}:null;}})[_0xa548('0x24')](respondWithResult(_0x4a0abc,null))['catch'](handleError(_0x4a0abc,null));};exports[_0xa548('0x54')]=function(_0x23f745,_0x57d1a8,_0xbfb94f){if(_0x23f745['body']['id']){delete _0x23f745[_0xa548('0x4a')]['id'];}return db[_0xa548('0x42')][_0xa548('0x4d')]({'where':{'id':_0x23f745[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x57d1a8,null))[_0xa548('0x24')](function(_0x42c5eb){if(_0x42c5eb){return _0x42c5eb['setTags'](_0x23f745['body'][_0xa548('0x55')]||[]);}return null;})[_0xa548('0x24')](respondWithResult(_0x57d1a8,null))[_0xa548('0x44')](handleError(_0x57d1a8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index d16853c..0fd2e7f 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 _0x0abf=['define','int_zendesk_configurations','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x3446a2,_0x75daec){var _0xb594fa=function(_0x57c4a0){while(--_0x57c4a0){_0x3446a2['push'](_0x3446a2['shift']());}};_0xb594fa(++_0x75daec);}(_0x0abf,0xe8));var _0xf0ab=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0abf[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var logger=require(_0xf0ab('0x1'))(_0xf0ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf0ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var attributes=require(_0xf0ab('0x6'));module[_0xf0ab('0x7')]=function(_0x2ab7d6,_0x4d2ea8){return _0x2ab7d6[_0xf0ab('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0xf0ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2cf=['request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','util','api','bluebird'];(function(_0x1be26e,_0xf87fe7){var _0x12e661=function(_0x312317){while(--_0x312317){_0x1be26e['push'](_0x1be26e['shift']());}};_0x12e661(++_0xf87fe7);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x4e7d4a,_0x35cdc8){_0x4e7d4a=_0x4e7d4a-0x0;var _0x235800=_0xe2cf[_0x4e7d4a];return _0x235800;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var logger=require('../../config/logger')(_0xfe2c('0x1'));var moment=require('moment');var BPromise=require(_0xfe2c('0x2'));var rp=require(_0xfe2c('0x3'));var fs=require('fs');var path=require(_0xfe2c('0x4'));var rimraf=require(_0xfe2c('0x5'));var config=require('../../config/environment');var attributes=require(_0xfe2c('0x6'));module[_0xfe2c('0x7')]=function(_0x55bb12,_0x4fa079){return _0x55bb12[_0xfe2c('0x8')](_0xfe2c('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 02575d1..e51aa16 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 _0x9380=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment'];(function(_0x3473ec,_0x2170f3){var _0x59bac8=function(_0x369e48){while(--_0x369e48){_0x3473ec['push'](_0x3473ec['shift']());}};_0x59bac8(++_0x2170f3);}(_0x9380,0x156));var _0x0938=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9380[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x0938('0x0'));var util=require(_0x0938('0x1'));var moment=require(_0x0938('0x2'));var BPromise=require('bluebird');var rs=require(_0x0938('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0938('0x4'))['db'];var utils=require(_0x0938('0x5'));var logger=require(_0x0938('0x6'))(_0x0938('0x7'));var config=require(_0x0938('0x8'));var jayson=require(_0x0938('0x9'));var client=jayson[_0x0938('0xa')][_0x0938('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x229e84,_0x203e66,_0x3c76d4){return new BPromise(function(_0x5c799a,_0x22bed1){return client[_0x0938('0xc')](_0x229e84,_0x3c76d4)[_0x0938('0xd')](function(_0x26f827){logger[_0x0938('0xe')](_0x0938('0xf'),_0x203e66,'request\x20sent');logger[_0x0938('0x10')](_0x0938('0x11'),_0x203e66,_0x0938('0x12'),JSON['stringify'](_0x26f827));if(_0x26f827['error']){if(_0x26f827[_0x0938('0x13')][_0x0938('0x14')]===0x1f4){logger['error'](_0x0938('0xf'),_0x203e66,_0x26f827['error'][_0x0938('0x15')]);return _0x22bed1(_0x26f827[_0x0938('0x13')][_0x0938('0x15')]);}logger[_0x0938('0x13')](_0x0938('0xf'),_0x203e66,_0x26f827[_0x0938('0x13')][_0x0938('0x15')]);return _0x5c799a(_0x26f827[_0x0938('0x13')]['message']);}else{logger[_0x0938('0xe')](_0x0938('0xf'),_0x203e66,_0x0938('0x12'));_0x5c799a(_0x26f827[_0x0938('0x16')][_0x0938('0x15')]);}})['catch'](function(_0x4c8ce1){logger['error'](_0x0938('0xf'),_0x203e66,_0x4c8ce1);_0x22bed1(_0x4c8ce1);});});} \ No newline at end of file +var _0xeef3=['code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2903d4,_0x35d7c1){var _0x2d966f=function(_0x2a10c5){while(--_0x2a10c5){_0x2903d4['push'](_0x2903d4['shift']());}};_0x2d966f(++_0x35d7c1);}(_0xeef3,0x1be));var _0x3eef=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xeef3[_0x49052b];return _0x48c045;};'use strict';var _=require(_0x3eef('0x0'));var util=require(_0x3eef('0x1'));var moment=require(_0x3eef('0x2'));var BPromise=require('bluebird');var rs=require(_0x3eef('0x3'));var fs=require('fs');var Redis=require(_0x3eef('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3eef('0x5'))(_0x3eef('0x6'));var config=require(_0x3eef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3eef('0x8')][_0x3eef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360493,_0x1d788a,_0x16a277){return new BPromise(function(_0x14fcf6,_0x37c4f7){return client['request'](_0x360493,_0x16a277)['then'](function(_0x4f4493){logger['info'](_0x3eef('0xa'),_0x1d788a,'request\x20sent');logger[_0x3eef('0xb')](_0x3eef('0xc'),_0x1d788a,_0x3eef('0xd'),JSON[_0x3eef('0xe')](_0x4f4493));if(_0x4f4493['error']){if(_0x4f4493[_0x3eef('0xf')][_0x3eef('0x10')]===0x1f4){logger[_0x3eef('0xf')](_0x3eef('0xa'),_0x1d788a,_0x4f4493[_0x3eef('0xf')][_0x3eef('0x11')]);return _0x37c4f7(_0x4f4493[_0x3eef('0xf')][_0x3eef('0x11')]);}logger[_0x3eef('0xf')](_0x3eef('0xa'),_0x1d788a,_0x4f4493[_0x3eef('0xf')][_0x3eef('0x11')]);return _0x14fcf6(_0x4f4493[_0x3eef('0xf')]['message']);}else{logger[_0x3eef('0x12')](_0x3eef('0xa'),_0x1d788a,_0x3eef('0xd'));_0x14fcf6(_0x4f4493[_0x3eef('0x13')]['message']);}})[_0x3eef('0x14')](function(_0x45a7fa){logger[_0x3eef('0xf')](_0x3eef('0xa'),_0x1d788a,_0x45a7fa);_0x37c4f7(_0x45a7fa);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index fc69ddd..d6cf81b 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 _0x3b08=['post','put','update','delete','/:id','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index'];(function(_0x521ed8,_0x4db93e){var _0x2c4f92=function(_0x4539b1){while(--_0x4539b1){_0x521ed8['push'](_0x521ed8['shift']());}};_0x2c4f92(++_0x4db93e);}(_0x3b08,0xba));var _0x83b0=function(_0x249389,_0x2c8049){_0x249389=_0x249389-0x0;var _0x323dbf=_0x3b08[_0x249389];return _0x323dbf;};'use strict';var multer=require('multer');var util=require(_0x83b0('0x0'));var path=require(_0x83b0('0x1'));var timeout=require(_0x83b0('0x2'));var express=require('express');var router=express[_0x83b0('0x3')]();var fs_extra=require(_0x83b0('0x4'));var auth=require(_0x83b0('0x5'));var interaction=require(_0x83b0('0x6'));var config=require(_0x83b0('0x7'));var controller=require(_0x83b0('0x8'));router[_0x83b0('0x9')]('/',auth[_0x83b0('0xa')](),controller[_0x83b0('0xb')]);router[_0x83b0('0x9')]('/:id',auth[_0x83b0('0xa')](),controller['show']);router[_0x83b0('0xc')]('/',auth[_0x83b0('0xa')](),controller['create']);router[_0x83b0('0xd')]('/:id',auth[_0x83b0('0xa')](),controller[_0x83b0('0xe')]);router[_0x83b0('0xf')](_0x83b0('0x10'),auth[_0x83b0('0xa')](),controller[_0x83b0('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4670=['destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','create','put','delete'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4670,0x1c1));var _0x0467=function(_0x2984bb,_0x2ac711){_0x2984bb=_0x2984bb-0x0;var _0x1dcc12=_0x4670[_0x2984bb];return _0x1dcc12;};'use strict';var multer=require(_0x0467('0x0'));var util=require('util');var path=require(_0x0467('0x1'));var timeout=require(_0x0467('0x2'));var express=require(_0x0467('0x3'));var router=express['Router']();var fs_extra=require(_0x0467('0x4'));var auth=require(_0x0467('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0467('0x6'));var controller=require(_0x0467('0x7'));router[_0x0467('0x8')]('/',auth[_0x0467('0x9')](),controller[_0x0467('0xa')]);router[_0x0467('0x8')](_0x0467('0xb'),auth[_0x0467('0x9')](),controller['show']);router['post']('/',auth[_0x0467('0x9')](),controller[_0x0467('0xc')]);router[_0x0467('0xd')](_0x0467('0xb'),auth[_0x0467('0x9')](),controller['update']);router[_0x0467('0xe')](_0x0467('0xb'),auth[_0x0467('0x9')](),controller[_0x0467('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d4afea6..4a24c7f 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 _0x292d=['string','keyValue','picklist','STRING','ENUM','variable','customVariable','sequelize','exports'];(function(_0x5880ac,_0x86e30c){var _0x2bb201=function(_0x2703b7){while(--_0x2703b7){_0x5880ac['push'](_0x5880ac['shift']());}};_0x2bb201(++_0x86e30c);}(_0x292d,0x178));var _0xd292=function(_0x1bc445,_0x2d6fe0){_0x1bc445=_0x1bc445-0x0;var _0x589e6b=_0x292d[_0x1bc445];return _0x589e6b;};'use strict';var Sequelize=require(_0xd292('0x0'));module[_0xd292('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd292('0x2'),'variable','customVariable',_0xd292('0x3'),_0xd292('0x4')),'defaultValue':_0xd292('0x2')},'content':{'type':Sequelize[_0xd292('0x5')]},'key':{'type':Sequelize[_0xd292('0x5')]},'keyType':{'type':Sequelize[_0xd292('0x6')](_0xd292('0x2'),_0xd292('0x7'),_0xd292('0x8'))},'keyContent':{'type':Sequelize[_0xd292('0x5')]},'idField':{'type':Sequelize[_0xd292('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd292('0x5')]}}; \ No newline at end of file +var _0x8a06=['keyValue','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8a06,0x11a));var _0x68a0=function(_0x4fb6b6,_0x5eb1c7){_0x4fb6b6=_0x4fb6b6-0x0;var _0x3ea470=_0x8a06[_0x4fb6b6];return _0x3ea470;};'use strict';var Sequelize=require(_0x68a0('0x0'));module[_0x68a0('0x1')]={'type':{'type':Sequelize[_0x68a0('0x2')](_0x68a0('0x3'),_0x68a0('0x4'),_0x68a0('0x5'),_0x68a0('0x6'),'picklist'),'defaultValue':_0x68a0('0x3')},'content':{'type':Sequelize[_0x68a0('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x68a0('0x2')]('string',_0x68a0('0x4'),_0x68a0('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x68a0('0x7')]},'nameField':{'type':Sequelize[_0x68a0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x68a0('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 83e420d..48f107c 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 _0x92ba=['type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','name','send','index','ZendeskField','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge'];(function(_0x4f8d92,_0x5e846b){var _0xcbdb79=function(_0x3d5954){while(--_0x3d5954){_0x4f8d92['push'](_0x4f8d92['shift']());}};_0xcbdb79(++_0x5e846b);}(_0x92ba,0x17c));var _0xa92b=function(_0x1e5a76,_0x5351e5){_0x1e5a76=_0x1e5a76-0x0;var _0x22e8fc=_0x92ba[_0x1e5a76];return _0x22e8fc;};'use strict';var emlformat=require(_0xa92b('0x0'));var rimraf=require(_0xa92b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa92b('0x2'));var rp=require(_0xa92b('0x3'));var moment=require(_0xa92b('0x4'));var BPromise=require(_0xa92b('0x5'));var Mustache=require(_0xa92b('0x6'));var util=require('util');var path=require(_0xa92b('0x7'));var sox=require(_0xa92b('0x8'));var csv=require(_0xa92b('0x9'));var ejs=require(_0xa92b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa92b('0xb'));var squel=require(_0xa92b('0xc'));var crypto=require('crypto');var jsforce=require(_0xa92b('0xd'));var deskjs=require(_0xa92b('0xe'));var toCsv=require(_0xa92b('0x9'));var querystring=require(_0xa92b('0xf'));var Papa=require(_0xa92b('0x10'));var Redis=require(_0xa92b('0x11'));var authService=require(_0xa92b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa92b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa92b('0x14'));var licenseUtil=require(_0xa92b('0x15'));var db=require(_0xa92b('0x16'))['db'];function respondWithStatusCode(_0x370c0e,_0xe0fa43){_0xe0fa43=_0xe0fa43||0xcc;return function(_0x49c163){if(_0x49c163){return _0x370c0e[_0xa92b('0x17')](_0xe0fa43);}return _0x370c0e[_0xa92b('0x18')](_0xe0fa43)[_0xa92b('0x19')]();};}function respondWithResult(_0x51c833,_0x229ba9){_0x229ba9=_0x229ba9||0xc8;return function(_0x443323){if(_0x443323){return _0x51c833[_0xa92b('0x18')](_0x229ba9)[_0xa92b('0x1a')](_0x443323);}};}function respondWithFilteredResult(_0x1b297d,_0x192b70){return function(_0x354088){if(_0x354088){var _0x408ed2=typeof _0x192b70[_0xa92b('0x1b')]===_0xa92b('0x1c')&&typeof _0x192b70['limit']===_0xa92b('0x1c');var _0x1a5ff6=_0x354088[_0xa92b('0x1d')];var _0x1c26f1=_0x408ed2?0x0:_0x192b70[_0xa92b('0x1b')];var _0x44512a=_0x408ed2?_0x354088['count']:_0x192b70[_0xa92b('0x1b')]+_0x192b70['limit'];var _0x44df31;if(_0x44512a>=_0x1a5ff6){_0x44512a=_0x1a5ff6;_0x44df31=0xc8;}else{_0x44df31=0xce;}_0x1b297d[_0xa92b('0x18')](_0x44df31);return _0x1b297d[_0xa92b('0x1e')](_0xa92b('0x1f'),_0x1c26f1+'-'+_0x44512a+'/'+_0x1a5ff6)[_0xa92b('0x1a')](_0x354088);}return null;};}function patchUpdates(_0x2e2e71){return function(_0x572ee5){try{jsonpatch[_0xa92b('0x20')](_0x572ee5,_0x2e2e71,!![]);}catch(_0x42eb92){return BPromise[_0xa92b('0x21')](_0x42eb92);}return _0x572ee5['save']();};}function saveUpdates(_0x31cb2,_0x546084){return function(_0xdb21cb){if(_0xdb21cb){return _0xdb21cb[_0xa92b('0x22')](_0x31cb2)[_0xa92b('0x23')](function(_0x5517c4){return _0x5517c4;});}return null;};}function removeEntity(_0x75fb18,_0x4c22bc){return function(_0x48c462){if(_0x48c462){return _0x48c462['destroy']()['then'](function(){_0x75fb18[_0xa92b('0x18')](0xcc)[_0xa92b('0x19')]();});}};}function handleEntityNotFound(_0x568422,_0x422c3a){return function(_0x546d5d){if(!_0x546d5d){_0x568422['sendStatus'](0x194);}return _0x546d5d;};}function handleError(_0x146e24,_0x3a90ea){_0x3a90ea=_0x3a90ea||0x1f4;return function(_0x12d631){logger['error'](_0x12d631['stack']);if(_0x12d631[_0xa92b('0x24')]){delete _0x12d631['name'];}_0x146e24[_0xa92b('0x18')](_0x3a90ea)[_0xa92b('0x25')](_0x12d631);};}exports[_0xa92b('0x26')]=function(_0x5bd1e3,_0x59c24f){var _0x26e579={},_0x14d2f4={},_0x4ae13a={'count':0x0,'rows':[]};var _0x49b70e=_['map'](db[_0xa92b('0x27')]['rawAttributes'],function(_0x98fdb1){return{'name':_0x98fdb1['fieldName'],'type':_0x98fdb1['type'][_0xa92b('0x28')]};});_0x14d2f4[_0xa92b('0x29')]=_[_0xa92b('0x2a')](_0x49b70e,_0xa92b('0x24'));_0x14d2f4[_0xa92b('0x2b')]=_[_0xa92b('0x2c')](_0x5bd1e3[_0xa92b('0x2b')]);_0x14d2f4[_0xa92b('0x2d')]=_[_0xa92b('0x2e')](_0x14d2f4[_0xa92b('0x29')],_0x14d2f4[_0xa92b('0x2b')]);_0x26e579[_0xa92b('0x2f')]=_[_0xa92b('0x2e')](_0x14d2f4['model'],qs[_0xa92b('0x30')](_0x5bd1e3['query'][_0xa92b('0x30')]));_0x26e579[_0xa92b('0x2f')]=_0x26e579[_0xa92b('0x2f')][_0xa92b('0x31')]?_0x26e579[_0xa92b('0x2f')]:_0x14d2f4[_0xa92b('0x29')];if(!_0x5bd1e3['query'][_0xa92b('0x32')](_0xa92b('0x33'))){_0x26e579[_0xa92b('0x34')]=qs['limit'](_0x5bd1e3[_0xa92b('0x2b')]['limit']);_0x26e579[_0xa92b('0x1b')]=qs[_0xa92b('0x1b')](_0x5bd1e3[_0xa92b('0x2b')][_0xa92b('0x1b')]);}_0x26e579['order']=qs[_0xa92b('0x35')](_0x5bd1e3['query'][_0xa92b('0x35')]);_0x26e579[_0xa92b('0x36')]=qs[_0xa92b('0x2d')](_[_0xa92b('0x37')](_0x5bd1e3[_0xa92b('0x2b')],_0x14d2f4[_0xa92b('0x2d')]),_0x49b70e);if(_0x5bd1e3[_0xa92b('0x2b')][_0xa92b('0x38')]){_0x26e579['where']=_[_0xa92b('0x39')](_0x26e579['where'],{'$or':_[_0xa92b('0x2a')](_0x49b70e,function(_0x129031){if(_0x129031[_0xa92b('0x3a')]!==_0xa92b('0x3b')){var _0x8f47aa={};_0x8f47aa[_0x129031[_0xa92b('0x24')]]={'$like':'%'+_0x5bd1e3[_0xa92b('0x2b')]['filter']+'%'};return _0x8f47aa;}})});}_0x26e579=_[_0xa92b('0x39')]({},_0x26e579,_0x5bd1e3[_0xa92b('0x3c')]);var _0x54d31a={'where':_0x26e579[_0xa92b('0x36')]};return db[_0xa92b('0x27')][_0xa92b('0x1d')](_0x54d31a)[_0xa92b('0x23')](function(_0x145036){_0x4ae13a[_0xa92b('0x1d')]=_0x145036;if(_0x5bd1e3[_0xa92b('0x2b')][_0xa92b('0x3d')]){_0x26e579[_0xa92b('0x3e')]=[{'all':!![]}];}return db[_0xa92b('0x27')][_0xa92b('0x3f')](_0x26e579);})[_0xa92b('0x23')](function(_0x137b12){_0x4ae13a[_0xa92b('0x40')]=_0x137b12;return _0x4ae13a;})[_0xa92b('0x23')](respondWithFilteredResult(_0x59c24f,_0x26e579))[_0xa92b('0x41')](handleError(_0x59c24f,null));};exports[_0xa92b('0x42')]=function(_0x4864c3,_0x545201){var _0x35b7b9={'raw':!![],'where':{'id':_0x4864c3[_0xa92b('0x43')]['id']}},_0xc710d8={};_0xc710d8[_0xa92b('0x29')]=_['keys'](db['ZendeskField'][_0xa92b('0x44')]);_0xc710d8[_0xa92b('0x2b')]=_['keys'](_0x4864c3[_0xa92b('0x2b')]);_0xc710d8['filters']=_[_0xa92b('0x2e')](_0xc710d8[_0xa92b('0x29')],_0xc710d8['query']);_0x35b7b9['attributes']=_['intersection'](_0xc710d8[_0xa92b('0x29')],qs[_0xa92b('0x30')](_0x4864c3[_0xa92b('0x2b')][_0xa92b('0x30')]));_0x35b7b9[_0xa92b('0x2f')]=_0x35b7b9[_0xa92b('0x2f')][_0xa92b('0x31')]?_0x35b7b9[_0xa92b('0x2f')]:_0xc710d8[_0xa92b('0x29')];if(_0x4864c3[_0xa92b('0x2b')][_0xa92b('0x3d')]){_0x35b7b9['include']=[{'all':!![]}];}_0x35b7b9=_[_0xa92b('0x39')]({},_0x35b7b9,_0x4864c3[_0xa92b('0x3c')]);return db[_0xa92b('0x27')][_0xa92b('0x45')](_0x35b7b9)[_0xa92b('0x23')](handleEntityNotFound(_0x545201,null))[_0xa92b('0x23')](respondWithResult(_0x545201,null))[_0xa92b('0x41')](handleError(_0x545201,null));};exports[_0xa92b('0x46')]=function(_0x5059a8,_0x39427a){return db['ZendeskField'][_0xa92b('0x46')](_0x5059a8[_0xa92b('0x47')],{})[_0xa92b('0x23')](respondWithResult(_0x39427a,0xc9))[_0xa92b('0x41')](handleError(_0x39427a,null));};exports['update']=function(_0x2ff38b,_0x99513a){if(_0x2ff38b[_0xa92b('0x47')]['id']){delete _0x2ff38b[_0xa92b('0x47')]['id'];}return db['ZendeskField'][_0xa92b('0x45')]({'where':{'id':_0x2ff38b['params']['id']}})[_0xa92b('0x23')](handleEntityNotFound(_0x99513a,null))['then'](saveUpdates(_0x2ff38b[_0xa92b('0x47')],null))[_0xa92b('0x23')](respondWithResult(_0x99513a,null))['catch'](handleError(_0x99513a,null));};exports[_0xa92b('0x48')]=function(_0x2629f6,_0xf3e72b){return db[_0xa92b('0x27')][_0xa92b('0x45')]({'where':{'id':_0x2629f6[_0xa92b('0x43')]['id']}})[_0xa92b('0x23')](handleEntityNotFound(_0xf3e72b,null))['then'](removeEntity(_0xf3e72b,null))['catch'](handleError(_0xf3e72b,null));}; \ No newline at end of file +var _0xbde8=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','then','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbde8,0x155));var _0x8bde=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0xbde8[_0x7729b1];return _0x349504;};'use strict';var emlformat=require(_0x8bde('0x0'));var rimraf=require(_0x8bde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bde('0x2'));var rp=require(_0x8bde('0x3'));var moment=require(_0x8bde('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8bde('0x5'));var util=require(_0x8bde('0x6'));var path=require(_0x8bde('0x7'));var sox=require(_0x8bde('0x8'));var csv=require(_0x8bde('0x9'));var ejs=require(_0x8bde('0xa'));var fs=require('fs');var fs_extra=require(_0x8bde('0xb'));var _=require(_0x8bde('0xc'));var squel=require(_0x8bde('0xd'));var crypto=require('crypto');var jsforce=require(_0x8bde('0xe'));var deskjs=require(_0x8bde('0xf'));var toCsv=require(_0x8bde('0x9'));var querystring=require(_0x8bde('0x10'));var Papa=require('papaparse');var Redis=require(_0x8bde('0x11'));var authService=require(_0x8bde('0x12'));var qs=require(_0x8bde('0x13'));var as=require(_0x8bde('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bde('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8bde('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b8024,_0x5d62d7){_0x5d62d7=_0x5d62d7||0xcc;return function(_0x46eef9){if(_0x46eef9){return _0x2b8024[_0x8bde('0x17')](_0x5d62d7);}return _0x2b8024[_0x8bde('0x18')](_0x5d62d7)[_0x8bde('0x19')]();};}function respondWithResult(_0x536df9,_0x25946c){_0x25946c=_0x25946c||0xc8;return function(_0x6ae7b9){if(_0x6ae7b9){return _0x536df9[_0x8bde('0x18')](_0x25946c)[_0x8bde('0x1a')](_0x6ae7b9);}};}function respondWithFilteredResult(_0x408ac5,_0x3b089b){return function(_0x19356d){if(_0x19356d){var _0x3c76fe=typeof _0x3b089b[_0x8bde('0x1b')]===_0x8bde('0x1c')&&typeof _0x3b089b['limit']===_0x8bde('0x1c');var _0x4e8a1a=_0x19356d['count'];var _0x32d88e=_0x3c76fe?0x0:_0x3b089b[_0x8bde('0x1b')];var _0x119481=_0x3c76fe?_0x19356d['count']:_0x3b089b['offset']+_0x3b089b[_0x8bde('0x1d')];var _0x3eda85;if(_0x119481>=_0x4e8a1a){_0x119481=_0x4e8a1a;_0x3eda85=0xc8;}else{_0x3eda85=0xce;}_0x408ac5[_0x8bde('0x18')](_0x3eda85);return _0x408ac5[_0x8bde('0x1e')]('Content-Range',_0x32d88e+'-'+_0x119481+'/'+_0x4e8a1a)[_0x8bde('0x1a')](_0x19356d);}return null;};}function patchUpdates(_0x469336){return function(_0x42797e){try{jsonpatch[_0x8bde('0x1f')](_0x42797e,_0x469336,!![]);}catch(_0x15f6c9){return BPromise[_0x8bde('0x20')](_0x15f6c9);}return _0x42797e['save']();};}function saveUpdates(_0x4bb436,_0x4c3dc8){return function(_0x109704){if(_0x109704){return _0x109704['update'](_0x4bb436)[_0x8bde('0x21')](function(_0x18f75b){return _0x18f75b;});}return null;};}function removeEntity(_0x478d04,_0x3a679e){return function(_0x29c6d4){if(_0x29c6d4){return _0x29c6d4['destroy']()[_0x8bde('0x21')](function(){_0x478d04['status'](0xcc)[_0x8bde('0x19')]();});}};}function handleEntityNotFound(_0x290b03,_0x2f6381){return function(_0x4fcea1){if(!_0x4fcea1){_0x290b03[_0x8bde('0x17')](0x194);}return _0x4fcea1;};}function handleError(_0x5cef0d,_0x3bbd21){_0x3bbd21=_0x3bbd21||0x1f4;return function(_0x1d98a8){logger[_0x8bde('0x22')](_0x1d98a8[_0x8bde('0x23')]);if(_0x1d98a8['name']){delete _0x1d98a8[_0x8bde('0x24')];}_0x5cef0d[_0x8bde('0x18')](_0x3bbd21)['send'](_0x1d98a8);};}exports[_0x8bde('0x25')]=function(_0x39ceaf,_0x5d4070){var _0x3ad020={},_0x25fd09={},_0x4bdbdb={'count':0x0,'rows':[]};var _0x23d92e=_[_0x8bde('0x26')](db[_0x8bde('0x27')][_0x8bde('0x28')],function(_0x40d188){return{'name':_0x40d188[_0x8bde('0x29')],'type':_0x40d188[_0x8bde('0x2a')][_0x8bde('0x2b')]};});_0x25fd09[_0x8bde('0x2c')]=_[_0x8bde('0x26')](_0x23d92e,_0x8bde('0x24'));_0x25fd09[_0x8bde('0x2d')]=_['keys'](_0x39ceaf[_0x8bde('0x2d')]);_0x25fd09['filters']=_[_0x8bde('0x2e')](_0x25fd09[_0x8bde('0x2c')],_0x25fd09[_0x8bde('0x2d')]);_0x3ad020[_0x8bde('0x2f')]=_['intersection'](_0x25fd09[_0x8bde('0x2c')],qs[_0x8bde('0x30')](_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x30')]));_0x3ad020['attributes']=_0x3ad020['attributes'][_0x8bde('0x31')]?_0x3ad020[_0x8bde('0x2f')]:_0x25fd09[_0x8bde('0x2c')];if(!_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x32')](_0x8bde('0x33'))){_0x3ad020[_0x8bde('0x1d')]=qs['limit'](_0x39ceaf['query']['limit']);_0x3ad020[_0x8bde('0x1b')]=qs[_0x8bde('0x1b')](_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x1b')]);}_0x3ad020[_0x8bde('0x34')]=qs[_0x8bde('0x35')](_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x35')]);_0x3ad020[_0x8bde('0x36')]=qs[_0x8bde('0x37')](_[_0x8bde('0x38')](_0x39ceaf[_0x8bde('0x2d')],_0x25fd09[_0x8bde('0x37')]),_0x23d92e);if(_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x39')]){_0x3ad020[_0x8bde('0x36')]=_[_0x8bde('0x3a')](_0x3ad020['where'],{'$or':_['map'](_0x23d92e,function(_0x21b77a){if(_0x21b77a[_0x8bde('0x2a')]!==_0x8bde('0x3b')){var _0x49dfc6={};_0x49dfc6[_0x21b77a[_0x8bde('0x24')]]={'$like':'%'+_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x39')]+'%'};return _0x49dfc6;}})});}_0x3ad020=_[_0x8bde('0x3a')]({},_0x3ad020,_0x39ceaf[_0x8bde('0x3c')]);var _0x1c828b={'where':_0x3ad020['where']};return db[_0x8bde('0x27')][_0x8bde('0x3d')](_0x1c828b)['then'](function(_0x2db657){_0x4bdbdb[_0x8bde('0x3d')]=_0x2db657;if(_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x3e')]){_0x3ad020['include']=[{'all':!![]}];}return db[_0x8bde('0x27')][_0x8bde('0x3f')](_0x3ad020);})[_0x8bde('0x21')](function(_0x484daf){_0x4bdbdb[_0x8bde('0x40')]=_0x484daf;return _0x4bdbdb;})['then'](respondWithFilteredResult(_0x5d4070,_0x3ad020))[_0x8bde('0x41')](handleError(_0x5d4070,null));};exports['show']=function(_0x35e7d5,_0x40a297){var _0x5c4189={'raw':!![],'where':{'id':_0x35e7d5[_0x8bde('0x42')]['id']}},_0x134345={};_0x134345['model']=_['keys'](db[_0x8bde('0x27')][_0x8bde('0x28')]);_0x134345[_0x8bde('0x2d')]=_['keys'](_0x35e7d5[_0x8bde('0x2d')]);_0x134345[_0x8bde('0x37')]=_[_0x8bde('0x2e')](_0x134345[_0x8bde('0x2c')],_0x134345[_0x8bde('0x2d')]);_0x5c4189['attributes']=_[_0x8bde('0x2e')](_0x134345[_0x8bde('0x2c')],qs[_0x8bde('0x30')](_0x35e7d5['query']['fields']));_0x5c4189[_0x8bde('0x2f')]=_0x5c4189[_0x8bde('0x2f')][_0x8bde('0x31')]?_0x5c4189['attributes']:_0x134345['model'];if(_0x35e7d5['query'][_0x8bde('0x3e')]){_0x5c4189['include']=[{'all':!![]}];}_0x5c4189=_[_0x8bde('0x3a')]({},_0x5c4189,_0x35e7d5[_0x8bde('0x3c')]);return db[_0x8bde('0x27')][_0x8bde('0x43')](_0x5c4189)[_0x8bde('0x21')](handleEntityNotFound(_0x40a297,null))[_0x8bde('0x21')](respondWithResult(_0x40a297,null))['catch'](handleError(_0x40a297,null));};exports[_0x8bde('0x44')]=function(_0x58bf37,_0x9dee8c){return db[_0x8bde('0x27')][_0x8bde('0x44')](_0x58bf37['body'],{})[_0x8bde('0x21')](respondWithResult(_0x9dee8c,0xc9))[_0x8bde('0x41')](handleError(_0x9dee8c,null));};exports['update']=function(_0x5710e9,_0x10df7d){if(_0x5710e9[_0x8bde('0x45')]['id']){delete _0x5710e9[_0x8bde('0x45')]['id'];}return db[_0x8bde('0x27')][_0x8bde('0x43')]({'where':{'id':_0x5710e9[_0x8bde('0x42')]['id']}})['then'](handleEntityNotFound(_0x10df7d,null))['then'](saveUpdates(_0x5710e9[_0x8bde('0x45')],null))[_0x8bde('0x21')](respondWithResult(_0x10df7d,null))['catch'](handleError(_0x10df7d,null));};exports['destroy']=function(_0xea86ab,_0x1709fa){return db[_0x8bde('0x27')][_0x8bde('0x43')]({'where':{'id':_0xea86ab['params']['id']}})[_0x8bde('0x21')](handleEntityNotFound(_0x1709fa,null))['then'](removeEntity(_0x1709fa,null))[_0x8bde('0x41')](handleError(_0x1709fa,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index b2e8b5d..e50ce78 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 _0x6bc3=['define','ZendeskField','int_zendesk_fields','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports'];(function(_0x607d9e,_0x59c257){var _0x114e00=function(_0x23f293){while(--_0x23f293){_0x607d9e['push'](_0x607d9e['shift']());}};_0x114e00(++_0x59c257);}(_0x6bc3,0x11c));var _0x36bc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6bc3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x36bc('0x0'));var util=require(_0x36bc('0x1'));var logger=require(_0x36bc('0x2'))(_0x36bc('0x3'));var moment=require('moment');var BPromise=require(_0x36bc('0x4'));var rp=require(_0x36bc('0x5'));var fs=require('fs');var path=require(_0x36bc('0x6'));var rimraf=require(_0x36bc('0x7'));var config=require('../../config/environment');var attributes=require(_0x36bc('0x8'));module[_0x36bc('0x9')]=function(_0x3683fd,_0x55f453){return _0x3683fd[_0x36bc('0xa')](_0x36bc('0xb'),attributes,{'tableName':_0x36bc('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x36bc('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1fab=['moment','path','rimraf','../../config/environment','define','int_zendesk_fields','idField','FieldId','lodash','../../config/logger','api'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x1fab,0x1aa));var _0xb1fa=function(_0xfb14d8,_0x494226){_0xfb14d8=_0xfb14d8-0x0;var _0x3d66c6=_0x1fab[_0xfb14d8];return _0x3d66c6;};'use strict';var _=require(_0xb1fa('0x0'));var util=require('util');var logger=require(_0xb1fa('0x1'))(_0xb1fa('0x2'));var moment=require(_0xb1fa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1fa('0x4'));var rimraf=require(_0xb1fa('0x5'));var config=require(_0xb1fa('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x158514,_0x238d19){return _0x158514[_0xb1fa('0x7')]('ZendeskField',attributes,{'tableName':_0xb1fa('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xb1fa('0x9'),_0xb1fa('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index d08d1c9..50100ad 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 _0xe912=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2a7aef,_0x53a1c6){var _0x2f9b2f=function(_0x2f8130){while(--_0x2f8130){_0x2a7aef['push'](_0x2a7aef['shift']());}};_0x2f9b2f(++_0x53a1c6);}(_0xe912,0x176));var _0x2e91=function(_0x581733,_0x339f65){_0x581733=_0x581733-0x0;var _0x585638=_0xe912[_0x581733];return _0x585638;};'use strict';var _=require(_0x2e91('0x0'));var util=require('util');var moment=require(_0x2e91('0x1'));var BPromise=require(_0x2e91('0x2'));var rs=require(_0x2e91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e91('0x4'))['db'];var utils=require(_0x2e91('0x5'));var logger=require(_0x2e91('0x6'))(_0x2e91('0x7'));var config=require('../../config/environment');var jayson=require(_0x2e91('0x8'));var client=jayson[_0x2e91('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5db9,_0x32a9e1,_0x4314ff){return new BPromise(function(_0x4b7941,_0x16c0cb){return client[_0x2e91('0xa')](_0x3d5db9,_0x4314ff)[_0x2e91('0xb')](function(_0xae6e47){logger[_0x2e91('0xc')](_0x2e91('0xd'),_0x32a9e1,_0x2e91('0xe'));logger[_0x2e91('0xf')](_0x2e91('0x10'),_0x32a9e1,_0x2e91('0xe'),JSON[_0x2e91('0x11')](_0xae6e47));if(_0xae6e47[_0x2e91('0x12')]){if(_0xae6e47[_0x2e91('0x12')][_0x2e91('0x13')]===0x1f4){logger[_0x2e91('0x12')]('ZendeskField,\x20%s,\x20%s',_0x32a9e1,_0xae6e47[_0x2e91('0x12')]['message']);return _0x16c0cb(_0xae6e47[_0x2e91('0x12')][_0x2e91('0x14')]);}logger[_0x2e91('0x12')](_0x2e91('0xd'),_0x32a9e1,_0xae6e47['error'][_0x2e91('0x14')]);return _0x4b7941(_0xae6e47[_0x2e91('0x12')][_0x2e91('0x14')]);}else{logger[_0x2e91('0xc')](_0x2e91('0xd'),_0x32a9e1,_0x2e91('0xe'));_0x4b7941(_0xae6e47[_0x2e91('0x15')][_0x2e91('0x14')]);}})['catch'](function(_0x2c421c){logger[_0x2e91('0x12')](_0x2e91('0xd'),_0x32a9e1,_0x2c421c);_0x16c0cb(_0x2c421c);});});} \ No newline at end of file +var _0x22d9=['request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5c54a8,_0x5273ff){var _0x4a159a=function(_0x480421){while(--_0x480421){_0x5c54a8['push'](_0x5c54a8['shift']());}};_0x4a159a(++_0x5273ff);}(_0x22d9,0x179));var _0x922d=function(_0x2a34aa,_0x542900){_0x2a34aa=_0x2a34aa-0x0;var _0x3e1050=_0x22d9[_0x2a34aa];return _0x3e1050;};'use strict';var _=require(_0x922d('0x0'));var util=require(_0x922d('0x1'));var moment=require(_0x922d('0x2'));var BPromise=require(_0x922d('0x3'));var rs=require(_0x922d('0x4'));var fs=require('fs');var Redis=require(_0x922d('0x5'));var db=require(_0x922d('0x6'))['db'];var utils=require(_0x922d('0x7'));var logger=require(_0x922d('0x8'))(_0x922d('0x9'));var config=require(_0x922d('0xa'));var jayson=require(_0x922d('0xb'));var client=jayson[_0x922d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30fcce,_0x7795f5,_0x1bd88){return new BPromise(function(_0x2f2db1,_0x227a37){return client[_0x922d('0xd')](_0x30fcce,_0x1bd88)[_0x922d('0xe')](function(_0x2c306f){logger['info'](_0x922d('0xf'),_0x7795f5,'request\x20sent');logger[_0x922d('0x10')](_0x922d('0x11'),_0x7795f5,_0x922d('0x12'),JSON[_0x922d('0x13')](_0x2c306f));if(_0x2c306f[_0x922d('0x14')]){if(_0x2c306f[_0x922d('0x14')][_0x922d('0x15')]===0x1f4){logger[_0x922d('0x14')](_0x922d('0xf'),_0x7795f5,_0x2c306f[_0x922d('0x14')]['message']);return _0x227a37(_0x2c306f[_0x922d('0x14')]['message']);}logger[_0x922d('0x14')](_0x922d('0xf'),_0x7795f5,_0x2c306f['error'][_0x922d('0x16')]);return _0x2f2db1(_0x2c306f[_0x922d('0x14')][_0x922d('0x16')]);}else{logger[_0x922d('0x17')]('ZendeskField,\x20%s,\x20%s',_0x7795f5,_0x922d('0x12'));_0x2f2db1(_0x2c306f[_0x922d('0x18')][_0x922d('0x16')]);}})[_0x922d('0x19')](function(_0x5bfd48){logger['error'](_0x922d('0xf'),_0x7795f5,_0x5bfd48);_0x227a37(_0x5bfd48);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 783d5c3..761c596 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 _0xc3f4=['addConfiguration','put','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','show','isAuthenticated','/:id/fields','getFields','post','/:id/configurations'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xc3f4,0x16e));var _0x4c3f=function(_0x25b384,_0x386d9b){_0x25b384=_0x25b384-0x0;var _0x47ca4a=_0xc3f4[_0x25b384];return _0x47ca4a;};'use strict';var multer=require(_0x4c3f('0x0'));var util=require(_0x4c3f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4c3f('0x2')]();var fs_extra=require(_0x4c3f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4c3f('0x4'));var config=require(_0x4c3f('0x5'));var controller=require('./intZohoAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4c3f('0x6')]);router[_0x4c3f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4c3f('0x8')]);router[_0x4c3f('0x7')]('/:id/configurations',auth[_0x4c3f('0x9')](),controller['getConfigurations']);router['get'](_0x4c3f('0xa'),auth[_0x4c3f('0x9')](),controller[_0x4c3f('0xb')]);router[_0x4c3f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4c3f('0xc')](_0x4c3f('0xd'),auth[_0x4c3f('0x9')](),controller[_0x4c3f('0xe')]);router[_0x4c3f('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4c3f('0x10')](_0x4c3f('0x11'),auth[_0x4c3f('0x9')](),controller[_0x4c3f('0x12')]);module[_0x4c3f('0x13')]=router; \ No newline at end of file +var _0xb624=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x393b51,_0x233cc8){var _0x38e58b=function(_0x3422e0){while(--_0x3422e0){_0x393b51['push'](_0x393b51['shift']());}};_0x38e58b(++_0x233cc8);}(_0xb624,0x1c6));var _0x4b62=function(_0x42bd43,_0x59fb77){_0x42bd43=_0x42bd43-0x0;var _0x421e88=_0xb624[_0x42bd43];return _0x421e88;};'use strict';var multer=require(_0x4b62('0x0'));var util=require(_0x4b62('0x1'));var path=require(_0x4b62('0x2'));var timeout=require(_0x4b62('0x3'));var express=require(_0x4b62('0x4'));var router=express[_0x4b62('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b62('0x6'));var config=require(_0x4b62('0x7'));var controller=require('./intZohoAccount.controller');router[_0x4b62('0x8')]('/',auth[_0x4b62('0x9')](),controller[_0x4b62('0xa')]);router[_0x4b62('0x8')](_0x4b62('0xb'),auth['isAuthenticated'](),controller[_0x4b62('0xc')]);router[_0x4b62('0x8')](_0x4b62('0xd'),auth['isAuthenticated'](),controller[_0x4b62('0xe')]);router[_0x4b62('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4b62('0xf')]);router[_0x4b62('0x10')]('/',auth[_0x4b62('0x9')](),controller[_0x4b62('0x11')]);router[_0x4b62('0x10')](_0x4b62('0xd'),auth[_0x4b62('0x9')](),controller['addConfiguration']);router[_0x4b62('0x12')]('/:id',auth[_0x4b62('0x9')](),controller[_0x4b62('0x13')]);router['delete']('/:id',auth[_0x4b62('0x9')](),controller[_0x4b62('0x14')]);module[_0x4b62('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 22addc7..e4c3a01 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2dae=['STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2dae,0xc3));var _0xe2da=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x2dae[_0x4a7631];return _0x1a5a6f;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2da('0x1')]},'description':{'type':Sequelize[_0xe2da('0x1')]},'host':{'type':Sequelize[_0xe2da('0x1')]},'zone':{'type':Sequelize[_0xe2da('0x1')]},'clientId':{'type':Sequelize[_0xe2da('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe2da('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe2da('0x1')]},'refreshToken':{'type':Sequelize[_0xe2da('0x1')]}}; \ No newline at end of file +var _0x2dae=['STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2dae,0xc3));var _0xe2da=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0x2dae[_0x4c9380];return _0x49a523;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2da('0x1')]},'description':{'type':Sequelize[_0xe2da('0x1')]},'host':{'type':Sequelize[_0xe2da('0x1')]},'zone':{'type':Sequelize[_0xe2da('0x1')]},'clientId':{'type':Sequelize[_0xe2da('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe2da('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe2da('0x1')]},'refreshToken':{'type':Sequelize[_0xe2da('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c647fc0..3772e52 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 _0x6654=['format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','status','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','ZohoAccount','include','findAll','catch','show','params','keys','includeAll','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientSecret','serverUrl','code','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET'];(function(_0x411b68,_0x52e768){var _0x41ff90=function(_0x2ab602){while(--_0x2ab602){_0x411b68['push'](_0x411b68['shift']());}};_0x41ff90(++_0x52e768);}(_0x6654,0x122));var _0x4665=function(_0x58ddd6,_0x56925e){_0x58ddd6=_0x58ddd6-0x0;var _0x541f82=_0x6654[_0x58ddd6];return _0x541f82;};'use strict';var emlformat=require(_0x4665('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4665('0x1'));var jsonpatch=require(_0x4665('0x2'));var rp=require(_0x4665('0x3'));var moment=require(_0x4665('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4665('0x5'));var path=require(_0x4665('0x6'));var sox=require(_0x4665('0x7'));var csv=require(_0x4665('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4665('0x9'));var _=require(_0x4665('0xa'));var squel=require(_0x4665('0xb'));var crypto=require(_0x4665('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4665('0x8'));var querystring=require(_0x4665('0xd'));var Papa=require(_0x4665('0xe'));var Redis=require(_0x4665('0xf'));var authService=require(_0x4665('0x10'));var qs=require(_0x4665('0x11'));var as=require(_0x4665('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4665('0x13'));var utils=require('../../config/utils');var config=require(_0x4665('0x14'));var licenseUtil=require(_0x4665('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4665('0x16'));function respondWithStatusCode(_0x1c75ac,_0x555407){_0x555407=_0x555407||0xcc;return function(_0x1a5f81){if(_0x1a5f81){return _0x1c75ac[_0x4665('0x17')](_0x555407);}return _0x1c75ac['status'](_0x555407)[_0x4665('0x18')]();};}function respondWithResult(_0x15b6a5,_0x45b036){_0x45b036=_0x45b036||0xc8;return function(_0x4fd1b8){if(_0x4fd1b8){return _0x15b6a5['status'](_0x45b036)[_0x4665('0x19')](_0x4fd1b8);}};}function respondWithFilteredResult(_0x17f60b,_0x3032a1){return function(_0x3565c7){if(_0x3565c7){var _0x266093=typeof _0x3032a1['offset']==='undefined'&&typeof _0x3032a1[_0x4665('0x1a')]==='undefined';var _0x55c699=_0x3565c7[_0x4665('0x1b')];var _0x332f73=_0x266093?0x0:_0x3032a1[_0x4665('0x1c')];var _0x5447c1=_0x266093?_0x3565c7['count']:_0x3032a1[_0x4665('0x1c')]+_0x3032a1['limit'];var _0x225697;if(_0x5447c1>=_0x55c699){_0x5447c1=_0x55c699;_0x225697=0xc8;}else{_0x225697=0xce;}_0x17f60b['status'](_0x225697);return _0x17f60b[_0x4665('0x1d')](_0x4665('0x1e'),_0x332f73+'-'+_0x5447c1+'/'+_0x55c699)['json'](_0x3565c7);}return null;};}function patchUpdates(_0x5e732c){return function(_0x13249f){try{jsonpatch['apply'](_0x13249f,_0x5e732c,!![]);}catch(_0x4da556){return BPromise[_0x4665('0x1f')](_0x4da556);}return _0x13249f[_0x4665('0x20')]();};}function saveUpdates(_0x3b803b,_0x571a49){return function(_0x32350e){if(_0x32350e){return _0x32350e[_0x4665('0x21')](_0x3b803b)[_0x4665('0x22')](function(_0x5ef5c9){return _0x5ef5c9;});}return null;};}function removeEntity(_0x212931,_0x27ab75){return function(_0x1fc714){if(_0x1fc714){return _0x1fc714[_0x4665('0x23')]()[_0x4665('0x22')](function(){_0x212931['status'](0xcc)[_0x4665('0x18')]();});}};}function handleEntityNotFound(_0x315676,_0xc2f0ad){return function(_0x1d4bf7){if(!_0x1d4bf7){_0x315676[_0x4665('0x17')](0x194);}return _0x1d4bf7;};}function handleError(_0x5e5907,_0x5738d2){_0x5738d2=_0x5738d2||0x1f4;return function(_0x38a30f){logger[_0x4665('0x24')](_0x38a30f['stack']);if(_0x38a30f[_0x4665('0x25')]){delete _0x38a30f[_0x4665('0x25')];}_0x5e5907[_0x4665('0x26')](_0x5738d2)['send'](_0x38a30f);};}exports[_0x4665('0x27')]=function(_0x1d1071,_0x5cdb26){var _0x134b6b={},_0x40dc84={},_0x30529e={'count':0x0,'rows':[]};var _0x3fa994=_[_0x4665('0x28')](db['ZohoAccount'][_0x4665('0x29')],function(_0x273d0f){return{'name':_0x273d0f[_0x4665('0x2a')],'type':_0x273d0f['type'][_0x4665('0x2b')]};});_0x40dc84[_0x4665('0x2c')]=_[_0x4665('0x28')](_0x3fa994,_0x4665('0x25'));_0x40dc84[_0x4665('0x2d')]=_['keys'](_0x1d1071[_0x4665('0x2d')]);_0x40dc84[_0x4665('0x2e')]=_['intersection'](_0x40dc84[_0x4665('0x2c')],_0x40dc84[_0x4665('0x2d')]);_0x134b6b[_0x4665('0x2f')]=_[_0x4665('0x30')](_0x40dc84['model'],qs[_0x4665('0x31')](_0x1d1071[_0x4665('0x2d')][_0x4665('0x31')]));_0x134b6b[_0x4665('0x2f')]=_0x134b6b[_0x4665('0x2f')][_0x4665('0x32')]?_0x134b6b[_0x4665('0x2f')]:_0x40dc84[_0x4665('0x2c')];if(!_0x1d1071[_0x4665('0x2d')][_0x4665('0x33')](_0x4665('0x34'))){_0x134b6b[_0x4665('0x1a')]=qs['limit'](_0x1d1071[_0x4665('0x2d')]['limit']);_0x134b6b[_0x4665('0x1c')]=qs[_0x4665('0x1c')](_0x1d1071['query']['offset']);}_0x134b6b[_0x4665('0x35')]=qs[_0x4665('0x36')](_0x1d1071[_0x4665('0x2d')]['sort']);_0x134b6b[_0x4665('0x37')]=qs[_0x4665('0x2e')](_[_0x4665('0x38')](_0x1d1071[_0x4665('0x2d')],_0x40dc84['filters']),_0x3fa994);if(_0x1d1071[_0x4665('0x2d')][_0x4665('0x39')]){_0x134b6b['where']=_['merge'](_0x134b6b[_0x4665('0x37')],{'$or':_[_0x4665('0x28')](_0x3fa994,function(_0x318b64){if(_0x318b64[_0x4665('0x3a')]!=='VIRTUAL'){var _0xb45695={};_0xb45695[_0x318b64[_0x4665('0x25')]]={'$like':'%'+_0x1d1071[_0x4665('0x2d')]['filter']+'%'};return _0xb45695;}})});}_0x134b6b=_[_0x4665('0x3b')]({},_0x134b6b,_0x1d1071[_0x4665('0x3c')]);var _0x2850dc={'where':_0x134b6b[_0x4665('0x37')]};return db[_0x4665('0x3d')][_0x4665('0x1b')](_0x2850dc)[_0x4665('0x22')](function(_0x4348b7){_0x30529e[_0x4665('0x1b')]=_0x4348b7;if(_0x1d1071[_0x4665('0x2d')]['includeAll']){_0x134b6b[_0x4665('0x3e')]=[{'all':!![]}];}return db[_0x4665('0x3d')][_0x4665('0x3f')](_0x134b6b);})[_0x4665('0x22')](function(_0x54ac8b){_0x30529e['rows']=_0x54ac8b;return _0x30529e;})[_0x4665('0x22')](respondWithFilteredResult(_0x5cdb26,_0x134b6b))[_0x4665('0x40')](handleError(_0x5cdb26,null));};exports[_0x4665('0x41')]=function(_0x6b72f3,_0x38322c){var _0x1c26f8={'raw':![],'where':{'id':_0x6b72f3[_0x4665('0x42')]['id']}},_0x60c0d3={};_0x60c0d3[_0x4665('0x2c')]=_[_0x4665('0x43')](db['ZohoAccount'][_0x4665('0x29')]);_0x60c0d3[_0x4665('0x2d')]=_[_0x4665('0x43')](_0x6b72f3['query']);_0x60c0d3[_0x4665('0x2e')]=_['intersection'](_0x60c0d3[_0x4665('0x2c')],_0x60c0d3[_0x4665('0x2d')]);_0x1c26f8[_0x4665('0x2f')]=_[_0x4665('0x30')](_0x60c0d3[_0x4665('0x2c')],qs['fields'](_0x6b72f3[_0x4665('0x2d')]['fields']));_0x1c26f8['attributes']=_0x1c26f8[_0x4665('0x2f')][_0x4665('0x32')]?_0x1c26f8[_0x4665('0x2f')]:_0x60c0d3['model'];if(_0x6b72f3[_0x4665('0x2d')][_0x4665('0x44')]){_0x1c26f8[_0x4665('0x3e')]=[{'all':!![]}];}_0x1c26f8=_[_0x4665('0x3b')]({},_0x1c26f8,_0x6b72f3['options']);return db[_0x4665('0x3d')][_0x4665('0x45')](_0x1c26f8)[_0x4665('0x22')](handleEntityNotFound(_0x38322c,null))[_0x4665('0x22')](respondWithResult(_0x38322c,null))[_0x4665('0x40')](handleError(_0x38322c,null));};exports[_0x4665('0x46')]=function(_0x56231d,_0x4b75d6){return db[_0x4665('0x3d')][_0x4665('0x46')](_0x56231d[_0x4665('0x47')],{})[_0x4665('0x22')](respondWithResult(_0x4b75d6,0xc9))[_0x4665('0x40')](handleError(_0x4b75d6,null));};exports['update']=function(_0x3135d3,_0x49a5c2){if(_0x3135d3['body']['id']){delete _0x3135d3['body']['id'];}return db[_0x4665('0x3d')][_0x4665('0x45')]({'where':{'id':_0x3135d3[_0x4665('0x42')]['id']}})[_0x4665('0x22')](handleEntityNotFound(_0x49a5c2,null))[_0x4665('0x22')](saveUpdates(_0x3135d3['body'],null))[_0x4665('0x22')](respondWithResult(_0x49a5c2,null))[_0x4665('0x40')](handleError(_0x49a5c2,null));};exports[_0x4665('0x23')]=function(_0x2e93a8,_0x5ac237){return db[_0x4665('0x3d')][_0x4665('0x45')]({'where':{'id':_0x2e93a8[_0x4665('0x42')]['id']}})[_0x4665('0x22')](handleEntityNotFound(_0x5ac237,null))[_0x4665('0x22')](removeEntity(_0x5ac237,null))['catch'](handleError(_0x5ac237,null));};exports[_0x4665('0x48')]=function(_0x46beab,_0x32c15f,_0x3ffccd){var _0x34822f={};var _0x10749f={};var _0x242b28;var _0x3a063b;return db[_0x4665('0x3d')][_0x4665('0x49')]({'where':{'id':_0x46beab['params']['id']}})[_0x4665('0x22')](handleEntityNotFound(_0x32c15f,null))[_0x4665('0x22')](function(_0x564594){if(_0x564594){_0x242b28=_0x564594;_0x10749f[_0x4665('0x2c')]=_[_0x4665('0x43')](db[_0x4665('0x4a')][_0x4665('0x29')]);_0x10749f[_0x4665('0x2d')]=_[_0x4665('0x43')](_0x46beab[_0x4665('0x2d')]);_0x10749f[_0x4665('0x2e')]=_[_0x4665('0x30')](_0x10749f[_0x4665('0x2c')],_0x10749f[_0x4665('0x2d')]);_0x34822f[_0x4665('0x2f')]=_[_0x4665('0x30')](_0x10749f[_0x4665('0x2c')],qs[_0x4665('0x31')](_0x46beab[_0x4665('0x2d')][_0x4665('0x31')]));_0x34822f[_0x4665('0x2f')]=_0x34822f[_0x4665('0x2f')][_0x4665('0x32')]?_0x34822f[_0x4665('0x2f')]:_0x10749f['model'];_0x34822f[_0x4665('0x35')]=qs[_0x4665('0x36')](_0x46beab[_0x4665('0x2d')][_0x4665('0x36')]);_0x34822f[_0x4665('0x37')]=qs[_0x4665('0x2e')](_['pick'](_0x46beab[_0x4665('0x2d')],_0x10749f[_0x4665('0x2e')]));if(_0x46beab[_0x4665('0x2d')][_0x4665('0x39')]){_0x34822f[_0x4665('0x37')]=_[_0x4665('0x3b')](_0x34822f[_0x4665('0x37')],{'$or':_[_0x4665('0x28')](_0x34822f[_0x4665('0x2f')],function(_0x21ca32){var _0x5f0e16={};_0x5f0e16[_0x21ca32]={'$like':'%'+_0x46beab[_0x4665('0x2d')]['filter']+'%'};return _0x5f0e16;})});}_0x34822f=_['merge']({},_0x34822f,_0x46beab['options']);return _0x242b28[_0x4665('0x48')](_0x34822f);}})[_0x4665('0x22')](function(_0x88a81d){if(_0x88a81d){_0x3a063b=_0x88a81d[_0x4665('0x32')];if(!_0x46beab[_0x4665('0x2d')][_0x4665('0x33')]('nolimit')){_0x34822f[_0x4665('0x1a')]=qs['limit'](_0x46beab[_0x4665('0x2d')][_0x4665('0x1a')]);_0x34822f[_0x4665('0x1c')]=qs[_0x4665('0x1c')](_0x46beab['query'][_0x4665('0x1c')]);}return _0x242b28[_0x4665('0x48')](_0x34822f);}})[_0x4665('0x22')](function(_0x519f77){if(_0x519f77){return _0x519f77?{'count':_0x3a063b,'rows':_0x519f77}:null;}})[_0x4665('0x22')](respondWithResult(_0x32c15f,null))[_0x4665('0x40')](handleError(_0x32c15f,null));};exports[_0x4665('0x4b')]=function(_0x3708fe,_0x14679d,_0x5ba3eb){if(_0x3708fe[_0x4665('0x47')]['id']){delete _0x3708fe['body']['id'];}return db[_0x4665('0x3d')][_0x4665('0x49')]({'where':{'id':_0x3708fe[_0x4665('0x42')]['id']}})['then'](handleEntityNotFound(_0x14679d,null))[_0x4665('0x22')](function(_0x143e96){if(_0x143e96){_0x3708fe[_0x4665('0x47')][_0x4665('0x4c')]=_0x143e96['id'];_0x3708fe[_0x4665('0x47')][_0x4665('0x4d')]=integrations[_0x4665('0x4e')](_0x3708fe[_0x4665('0x47')][_0x4665('0x4f')],_0x3708fe[_0x4665('0x47')][_0x4665('0x3a')]);_0x3708fe[_0x4665('0x47')][_0x4665('0x50')]=integrations['getDescriptions'](_0x3708fe[_0x4665('0x47')][_0x4665('0x4f')],_0x3708fe[_0x4665('0x47')][_0x4665('0x3a')]);return db['ZohoConfiguration'][_0x4665('0x46')](_0x3708fe['body'],{'include':[{'model':db[_0x4665('0x51')],'as':_0x4665('0x4d')},{'model':db['ZohoField'],'as':_0x4665('0x50')}]});}return null;})[_0x4665('0x22')](respondWithResult(_0x14679d,null))[_0x4665('0x40')](handleError(_0x14679d,null));};function getAccessToken(_0x11317a){return new Promise(function(_0x3db8fa,_0x3e49b7){var _0x58a97b;switch(_0x11317a[_0x4665('0x52')]){case'US':_0x58a97b=_0x4665('0x53');break;case'AU':_0x58a97b=_0x4665('0x54');break;case'EU':_0x58a97b='https://accounts.zoho.eu';break;case'IN':_0x58a97b=_0x4665('0x55');break;case'CN':_0x58a97b=_0x4665('0x56');break;default:_0x58a97b='https://accounts.zoho.eu';break;}var _0x2ded3d={'method':_0x4665('0x57'),'uri':_0x58a97b+_0x4665('0x58'),'qs':{'refresh_token':_0x11317a[_0x4665('0x59')],'client_id':_0x11317a[_0x4665('0x5a')],'client_secret':_0x11317a['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2ded3d)[_0x4665('0x22')](function(_0x54b8ac){if(_0x54b8ac['access_token']){_0x3db8fa(_0x54b8ac[_0x4665('0x5b')]);}else{_0x3e49b7(_0x4665('0x5c'));}})[_0x4665('0x40')](function(_0x2fae3c){_0x3e49b7(_0x2fae3c);});});}exports['getFields']=function(_0x39776f,_0x2b8535,_0x429ddf){var _0x559abf,_0x4d074b,_0x22c0b0,_0x4e80a5,_0x1e86b7;return db[_0x4665('0x3d')][_0x4665('0x49')]({'where':{'id':_0x39776f[_0x4665('0x42')]['id']},'attributes':['id',_0x4665('0x5d'),_0x4665('0x52'),'clientId',_0x4665('0x5e'),_0x4665('0x5f'),_0x4665('0x60'),_0x4665('0x59')]})[_0x4665('0x22')](handleEntityNotFound(_0x2b8535,null))[_0x4665('0x22')](function(_0x36800a){_0x1e86b7=_0x36800a;_0x559abf=_0x1e86b7['host'];_0x4d074b=_0x559abf==='zoho.eu'?'eu':_0x4665('0x61');_0x22c0b0=_0x1e86b7['serverUrl'];var _0x1e0543=_0x22c0b0[_0x4665('0x62')](-0x1);if(_0x1e0543==='/'||_0x1e0543==='\x5c'||_0x1e0543===':'){_0x22c0b0=_0x22c0b0[_0x4665('0x63')](0x0,_0x22c0b0[_0x4665('0x64')](_0x1e0543));}if(!_0x1e86b7['refreshToken']){throw new Error(_0x4665('0x65'));}return getAccessToken(_0x1e86b7);})['then'](function(_0x17558c){if(_0x17558c){return rp({'method':_0x4665('0x66'),'uri':util[_0x4665('0x67')](_0x4665('0x68'),_0x4d074b),'qs':{'module':_0x4665('0x69')},'headers':{'Authorization':_0x4665('0x6a')+_0x17558c},'json':!![]});}})[_0x4665('0x22')](function(_0x4851b2){if(_0x4851b2){if(_0x4851b2['response']&&_0x4851b2['response'][_0x4665('0x24')]){throw new Error(_0x4851b2[_0x4665('0x6b')][_0x4665('0x24')][_0x4665('0x6c')]);}var _0x6bd5d9=[];var _0x1e2f3f=[];var _0x528a92=['Owner',_0x4665('0x6d'),_0x4665('0x6e'),_0x4665('0x6f'),_0x4665('0x70'),_0x4665('0x71'),_0x4665('0x72'),_0x4665('0x73')];_0x1e2f3f=_[_0x4665('0x74')](_0x4851b2[_0x4665('0x31')],function(_0x5ebe16){return _0x528a92[_0x4665('0x75')](_0x5ebe16[_0x4665('0x76')]);});for(var _0x364d1a=0x0;_0x364d1a<_0x1e2f3f[_0x4665('0x32')];_0x364d1a++){if(_0x1e2f3f[_0x364d1a][_0x4665('0x77')]===![]){_0x6bd5d9[_0x4665('0x78')]({'id':_0x1e2f3f[_0x364d1a]['id'],'name':_0x1e2f3f[_0x364d1a][_0x4665('0x79')],'custom':_0x1e2f3f[_0x364d1a][_0x4665('0x7a')],'options':_0x1e2f3f[_0x364d1a][_0x4665('0x7b')]===_0x4665('0x7c')&&_0x1e2f3f[_0x364d1a]['pick_list_values']['length']>-0x1?_[_0x4665('0x28')](_0x1e2f3f[_0x364d1a][_0x4665('0x7d')],function(_0x17a70a){return{'name':_0x17a70a,'value':_0x17a70a};}):[]});}}return{'count':_0x6bd5d9[_0x4665('0x32')],'rows':_0x6bd5d9};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2b8535,null))[_0x4665('0x40')](function(_0x318e2e){var _0x4f2025=_0x39776f[_0x4665('0x2d')][_0x4665('0x7e')]?0x1f4:_0x318e2e[_0x4665('0x7f')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4665('0x80'),_0x4f2025,JSON['stringify'](_0x318e2e));delete _0x318e2e['name'];if(_0x4f2025===0x191){_0x4f2025=0x190;}_0x2b8535[_0x4665('0x26')](_0x4f2025)[_0x4665('0x81')](_0x39776f['query'][_0x4665('0x7e')]?{'message':_0x4665('0x82'),'statusCode':_0x318e2e[_0x4665('0x7f')]}:_0x318e2e);});}; \ No newline at end of file +var _0x990c=['display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','getConfigurations','ZohoConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientSecret','access_token','host','clientId','serverUrl','code','com','slice','substring','lastIndexOf','refreshToken','GET','format','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','remove','api_name','system_mandatory','push'];(function(_0x547a0f,_0x4fe37c){var _0x79bf93=function(_0x360cd3){while(--_0x360cd3){_0x547a0f['push'](_0x547a0f['shift']());}};_0x79bf93(++_0x4fe37c);}(_0x990c,0x110));var _0xc990=function(_0x199549,_0x54cceb){_0x199549=_0x199549-0x0;var _0x85550b=_0x990c[_0x199549];return _0x85550b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc990('0x0'));var zipdir=require(_0xc990('0x1'));var jsonpatch=require(_0xc990('0x2'));var rp=require('request-promise');var moment=require(_0xc990('0x3'));var BPromise=require(_0xc990('0x4'));var Mustache=require('mustache');var util=require(_0xc990('0x5'));var path=require(_0xc990('0x6'));var sox=require('sox');var csv=require(_0xc990('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc990('0x8'));var _=require(_0xc990('0x9'));var squel=require(_0xc990('0xa'));var crypto=require(_0xc990('0xb'));var jsforce=require(_0xc990('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc990('0x7'));var querystring=require(_0xc990('0xd'));var Papa=require(_0xc990('0xe'));var Redis=require(_0xc990('0xf'));var authService=require(_0xc990('0x10'));var qs=require(_0xc990('0x11'));var as=require(_0xc990('0x12'));var hardwareService=require(_0xc990('0x13'));var logger=require(_0xc990('0x14'))(_0xc990('0x15'));var utils=require('../../config/utils');var config=require(_0xc990('0x16'));var licenseUtil=require(_0xc990('0x17'));var db=require(_0xc990('0x18'))['db'];var integrations=require(_0xc990('0x19'));function respondWithStatusCode(_0x5eda77,_0x272ab8){_0x272ab8=_0x272ab8||0xcc;return function(_0x49e140){if(_0x49e140){return _0x5eda77[_0xc990('0x1a')](_0x272ab8);}return _0x5eda77[_0xc990('0x1b')](_0x272ab8)[_0xc990('0x1c')]();};}function respondWithResult(_0x5e1983,_0x57bef2){_0x57bef2=_0x57bef2||0xc8;return function(_0x1d5000){if(_0x1d5000){return _0x5e1983[_0xc990('0x1b')](_0x57bef2)['json'](_0x1d5000);}};}function respondWithFilteredResult(_0x2ad4ff,_0x20c72c){return function(_0x235159){if(_0x235159){var _0x2fa123=typeof _0x20c72c[_0xc990('0x1d')]===_0xc990('0x1e')&&typeof _0x20c72c[_0xc990('0x1f')]===_0xc990('0x1e');var _0x20c325=_0x235159[_0xc990('0x20')];var _0x34ef53=_0x2fa123?0x0:_0x20c72c[_0xc990('0x1d')];var _0x1b3812=_0x2fa123?_0x235159[_0xc990('0x20')]:_0x20c72c[_0xc990('0x1d')]+_0x20c72c[_0xc990('0x1f')];var _0x34cca9;if(_0x1b3812>=_0x20c325){_0x1b3812=_0x20c325;_0x34cca9=0xc8;}else{_0x34cca9=0xce;}_0x2ad4ff[_0xc990('0x1b')](_0x34cca9);return _0x2ad4ff[_0xc990('0x21')](_0xc990('0x22'),_0x34ef53+'-'+_0x1b3812+'/'+_0x20c325)['json'](_0x235159);}return null;};}function patchUpdates(_0x15b00e){return function(_0x47bf95){try{jsonpatch[_0xc990('0x23')](_0x47bf95,_0x15b00e,!![]);}catch(_0x51de9f){return BPromise['reject'](_0x51de9f);}return _0x47bf95[_0xc990('0x24')]();};}function saveUpdates(_0x45cba9,_0x5be455){return function(_0x38bdb6){if(_0x38bdb6){return _0x38bdb6[_0xc990('0x25')](_0x45cba9)[_0xc990('0x26')](function(_0x3c79ca){return _0x3c79ca;});}return null;};}function removeEntity(_0x1809ca,_0x4d1bfd){return function(_0x3f37c2){if(_0x3f37c2){return _0x3f37c2[_0xc990('0x27')]()[_0xc990('0x26')](function(){_0x1809ca[_0xc990('0x1b')](0xcc)[_0xc990('0x1c')]();});}};}function handleEntityNotFound(_0x2b9442,_0x4bcb18){return function(_0x17da22){if(!_0x17da22){_0x2b9442[_0xc990('0x1a')](0x194);}return _0x17da22;};}function handleError(_0x2c035b,_0x9f8b5b){_0x9f8b5b=_0x9f8b5b||0x1f4;return function(_0x223f0d){logger['error'](_0x223f0d[_0xc990('0x28')]);if(_0x223f0d[_0xc990('0x29')]){delete _0x223f0d[_0xc990('0x29')];}_0x2c035b[_0xc990('0x1b')](_0x9f8b5b)[_0xc990('0x2a')](_0x223f0d);};}exports['index']=function(_0x1199dc,_0x405648){var _0x494b88={},_0x2d22ba={},_0x3d1125={'count':0x0,'rows':[]};var _0x4a2723=_[_0xc990('0x2b')](db[_0xc990('0x2c')][_0xc990('0x2d')],function(_0x215b4a){return{'name':_0x215b4a[_0xc990('0x2e')],'type':_0x215b4a['type'][_0xc990('0x2f')]};});_0x2d22ba['model']=_['map'](_0x4a2723,_0xc990('0x29'));_0x2d22ba['query']=_['keys'](_0x1199dc[_0xc990('0x30')]);_0x2d22ba[_0xc990('0x31')]=_[_0xc990('0x32')](_0x2d22ba[_0xc990('0x33')],_0x2d22ba[_0xc990('0x30')]);_0x494b88['attributes']=_[_0xc990('0x32')](_0x2d22ba[_0xc990('0x33')],qs['fields'](_0x1199dc[_0xc990('0x30')][_0xc990('0x34')]));_0x494b88[_0xc990('0x35')]=_0x494b88[_0xc990('0x35')][_0xc990('0x36')]?_0x494b88[_0xc990('0x35')]:_0x2d22ba[_0xc990('0x33')];if(!_0x1199dc[_0xc990('0x30')][_0xc990('0x37')](_0xc990('0x38'))){_0x494b88[_0xc990('0x1f')]=qs[_0xc990('0x1f')](_0x1199dc['query'][_0xc990('0x1f')]);_0x494b88[_0xc990('0x1d')]=qs[_0xc990('0x1d')](_0x1199dc[_0xc990('0x30')][_0xc990('0x1d')]);}_0x494b88['order']=qs[_0xc990('0x39')](_0x1199dc[_0xc990('0x30')][_0xc990('0x39')]);_0x494b88[_0xc990('0x3a')]=qs['filters'](_['pick'](_0x1199dc[_0xc990('0x30')],_0x2d22ba[_0xc990('0x31')]),_0x4a2723);if(_0x1199dc[_0xc990('0x30')][_0xc990('0x3b')]){_0x494b88[_0xc990('0x3a')]=_[_0xc990('0x3c')](_0x494b88[_0xc990('0x3a')],{'$or':_[_0xc990('0x2b')](_0x4a2723,function(_0x41189f){if(_0x41189f[_0xc990('0x3d')]!==_0xc990('0x3e')){var _0x535d62={};_0x535d62[_0x41189f[_0xc990('0x29')]]={'$like':'%'+_0x1199dc[_0xc990('0x30')][_0xc990('0x3b')]+'%'};return _0x535d62;}})});}_0x494b88=_[_0xc990('0x3c')]({},_0x494b88,_0x1199dc['options']);var _0x215542={'where':_0x494b88[_0xc990('0x3a')]};return db[_0xc990('0x2c')]['count'](_0x215542)[_0xc990('0x26')](function(_0x5083fa){_0x3d1125[_0xc990('0x20')]=_0x5083fa;if(_0x1199dc['query'][_0xc990('0x3f')]){_0x494b88[_0xc990('0x40')]=[{'all':!![]}];}return db[_0xc990('0x2c')][_0xc990('0x41')](_0x494b88);})[_0xc990('0x26')](function(_0x5080d8){_0x3d1125[_0xc990('0x42')]=_0x5080d8;return _0x3d1125;})[_0xc990('0x26')](respondWithFilteredResult(_0x405648,_0x494b88))[_0xc990('0x43')](handleError(_0x405648,null));};exports[_0xc990('0x44')]=function(_0x148042,_0x193d38){var _0x82c892={'raw':![],'where':{'id':_0x148042[_0xc990('0x45')]['id']}},_0x27d842={};_0x27d842[_0xc990('0x33')]=_[_0xc990('0x46')](db[_0xc990('0x2c')][_0xc990('0x2d')]);_0x27d842[_0xc990('0x30')]=_[_0xc990('0x46')](_0x148042['query']);_0x27d842[_0xc990('0x31')]=_[_0xc990('0x32')](_0x27d842['model'],_0x27d842[_0xc990('0x30')]);_0x82c892[_0xc990('0x35')]=_['intersection'](_0x27d842[_0xc990('0x33')],qs[_0xc990('0x34')](_0x148042['query'][_0xc990('0x34')]));_0x82c892[_0xc990('0x35')]=_0x82c892[_0xc990('0x35')][_0xc990('0x36')]?_0x82c892[_0xc990('0x35')]:_0x27d842['model'];if(_0x148042[_0xc990('0x30')][_0xc990('0x3f')]){_0x82c892['include']=[{'all':!![]}];}_0x82c892=_['merge']({},_0x82c892,_0x148042[_0xc990('0x47')]);return db['ZohoAccount'][_0xc990('0x48')](_0x82c892)[_0xc990('0x26')](handleEntityNotFound(_0x193d38,null))['then'](respondWithResult(_0x193d38,null))[_0xc990('0x43')](handleError(_0x193d38,null));};exports[_0xc990('0x49')]=function(_0x5b8d84,_0x14a69f){return db[_0xc990('0x2c')][_0xc990('0x49')](_0x5b8d84[_0xc990('0x4a')],{})['then'](respondWithResult(_0x14a69f,0xc9))[_0xc990('0x43')](handleError(_0x14a69f,null));};exports[_0xc990('0x25')]=function(_0x2be4b7,_0x8feedd){if(_0x2be4b7['body']['id']){delete _0x2be4b7[_0xc990('0x4a')]['id'];}return db['ZohoAccount'][_0xc990('0x48')]({'where':{'id':_0x2be4b7[_0xc990('0x45')]['id']}})[_0xc990('0x26')](handleEntityNotFound(_0x8feedd,null))['then'](saveUpdates(_0x2be4b7['body'],null))[_0xc990('0x26')](respondWithResult(_0x8feedd,null))['catch'](handleError(_0x8feedd,null));};exports[_0xc990('0x27')]=function(_0xa4fa1d,_0x19e373){return db[_0xc990('0x2c')][_0xc990('0x48')]({'where':{'id':_0xa4fa1d['params']['id']}})[_0xc990('0x26')](handleEntityNotFound(_0x19e373,null))[_0xc990('0x26')](removeEntity(_0x19e373,null))[_0xc990('0x43')](handleError(_0x19e373,null));};exports[_0xc990('0x4b')]=function(_0x324415,_0xf366b7,_0x33e894){var _0x28b267={};var _0x525044={};var _0x3ae3e0;var _0x2ab128;return db[_0xc990('0x2c')]['findOne']({'where':{'id':_0x324415[_0xc990('0x45')]['id']}})[_0xc990('0x26')](handleEntityNotFound(_0xf366b7,null))['then'](function(_0x49cf09){if(_0x49cf09){_0x3ae3e0=_0x49cf09;_0x525044[_0xc990('0x33')]=_[_0xc990('0x46')](db[_0xc990('0x4c')][_0xc990('0x2d')]);_0x525044[_0xc990('0x30')]=_[_0xc990('0x46')](_0x324415[_0xc990('0x30')]);_0x525044[_0xc990('0x31')]=_[_0xc990('0x32')](_0x525044['model'],_0x525044['query']);_0x28b267[_0xc990('0x35')]=_[_0xc990('0x32')](_0x525044['model'],qs[_0xc990('0x34')](_0x324415['query']['fields']));_0x28b267[_0xc990('0x35')]=_0x28b267[_0xc990('0x35')][_0xc990('0x36')]?_0x28b267[_0xc990('0x35')]:_0x525044['model'];_0x28b267['order']=qs[_0xc990('0x39')](_0x324415[_0xc990('0x30')][_0xc990('0x39')]);_0x28b267[_0xc990('0x3a')]=qs['filters'](_[_0xc990('0x4d')](_0x324415['query'],_0x525044[_0xc990('0x31')]));if(_0x324415['query'][_0xc990('0x3b')]){_0x28b267[_0xc990('0x3a')]=_[_0xc990('0x3c')](_0x28b267[_0xc990('0x3a')],{'$or':_['map'](_0x28b267[_0xc990('0x35')],function(_0x39c002){var _0x3e1aa9={};_0x3e1aa9[_0x39c002]={'$like':'%'+_0x324415[_0xc990('0x30')][_0xc990('0x3b')]+'%'};return _0x3e1aa9;})});}_0x28b267=_['merge']({},_0x28b267,_0x324415[_0xc990('0x47')]);return _0x3ae3e0[_0xc990('0x4b')](_0x28b267);}})['then'](function(_0x1ad82f){if(_0x1ad82f){_0x2ab128=_0x1ad82f['length'];if(!_0x324415[_0xc990('0x30')][_0xc990('0x37')](_0xc990('0x38'))){_0x28b267['limit']=qs[_0xc990('0x1f')](_0x324415[_0xc990('0x30')][_0xc990('0x1f')]);_0x28b267[_0xc990('0x1d')]=qs[_0xc990('0x1d')](_0x324415[_0xc990('0x30')][_0xc990('0x1d')]);}return _0x3ae3e0[_0xc990('0x4b')](_0x28b267);}})[_0xc990('0x26')](function(_0x32a58a){if(_0x32a58a){return _0x32a58a?{'count':_0x2ab128,'rows':_0x32a58a}:null;}})[_0xc990('0x26')](respondWithResult(_0xf366b7,null))[_0xc990('0x43')](handleError(_0xf366b7,null));};exports[_0xc990('0x4e')]=function(_0x59db7b,_0x110bc6,_0x32bdb6){if(_0x59db7b[_0xc990('0x4a')]['id']){delete _0x59db7b['body']['id'];}return db[_0xc990('0x2c')][_0xc990('0x4f')]({'where':{'id':_0x59db7b[_0xc990('0x45')]['id']}})[_0xc990('0x26')](handleEntityNotFound(_0x110bc6,null))[_0xc990('0x26')](function(_0x1816e0){if(_0x1816e0){_0x59db7b[_0xc990('0x4a')][_0xc990('0x50')]=_0x1816e0['id'];_0x59db7b[_0xc990('0x4a')][_0xc990('0x51')]=integrations[_0xc990('0x52')](_0x59db7b[_0xc990('0x4a')]['channel'],_0x59db7b[_0xc990('0x4a')][_0xc990('0x3d')]);_0x59db7b[_0xc990('0x4a')][_0xc990('0x53')]=integrations[_0xc990('0x54')](_0x59db7b[_0xc990('0x4a')]['channel'],_0x59db7b[_0xc990('0x4a')][_0xc990('0x3d')]);return db['ZohoConfiguration'][_0xc990('0x49')](_0x59db7b[_0xc990('0x4a')],{'include':[{'model':db[_0xc990('0x55')],'as':'Subjects'},{'model':db[_0xc990('0x55')],'as':_0xc990('0x53')}]});}return null;})['then'](respondWithResult(_0x110bc6,null))['catch'](handleError(_0x110bc6,null));};function getAccessToken(_0x587c4b){return new Promise(function(_0x1dc7c0,_0x528ec1){var _0x2b5d22;switch(_0x587c4b[_0xc990('0x56')]){case'US':_0x2b5d22=_0xc990('0x57');break;case'AU':_0x2b5d22=_0xc990('0x58');break;case'EU':_0x2b5d22='https://accounts.zoho.eu';break;case'IN':_0x2b5d22=_0xc990('0x59');break;case'CN':_0x2b5d22=_0xc990('0x5a');break;default:_0x2b5d22=_0xc990('0x5b');break;}var _0x3839c6={'method':_0xc990('0x5c'),'uri':_0x2b5d22+'/oauth/v2/token','qs':{'refresh_token':_0x587c4b['refreshToken'],'client_id':_0x587c4b['clientId'],'client_secret':_0x587c4b[_0xc990('0x5d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3839c6)[_0xc990('0x26')](function(_0x3dfc2a){if(_0x3dfc2a[_0xc990('0x5e')]){_0x1dc7c0(_0x3dfc2a[_0xc990('0x5e')]);}else{_0x528ec1('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xc990('0x43')](function(_0x3f1a42){_0x528ec1(_0x3f1a42);});});}exports['getFields']=function(_0x252b24,_0x5eef51,_0x51db1b){var _0x4e2dc7,_0xfd73f1,_0x322c5e,_0x1b2053,_0x43a1ef;return db[_0xc990('0x2c')][_0xc990('0x4f')]({'where':{'id':_0x252b24['params']['id']},'attributes':['id',_0xc990('0x5f'),_0xc990('0x56'),_0xc990('0x60'),_0xc990('0x5d'),_0xc990('0x61'),_0xc990('0x62'),'refreshToken']})[_0xc990('0x26')](handleEntityNotFound(_0x5eef51,null))[_0xc990('0x26')](function(_0x1e16cd){_0x43a1ef=_0x1e16cd;_0x4e2dc7=_0x43a1ef[_0xc990('0x5f')];_0xfd73f1=_0x4e2dc7==='zoho.eu'?'eu':_0xc990('0x63');_0x322c5e=_0x43a1ef[_0xc990('0x61')];var _0x233e72=_0x322c5e[_0xc990('0x64')](-0x1);if(_0x233e72==='/'||_0x233e72==='\x5c'||_0x233e72===':'){_0x322c5e=_0x322c5e[_0xc990('0x65')](0x0,_0x322c5e[_0xc990('0x66')](_0x233e72));}if(!_0x43a1ef[_0xc990('0x67')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x43a1ef);})['then'](function(_0x555e2f){if(_0x555e2f){return rp({'method':_0xc990('0x68'),'uri':util[_0xc990('0x69')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xfd73f1),'qs':{'module':_0xc990('0x6a')},'headers':{'Authorization':_0xc990('0x6b')+_0x555e2f},'json':!![]});}})[_0xc990('0x26')](function(_0x46b3c7){if(_0x46b3c7){if(_0x46b3c7['response']&&_0x46b3c7[_0xc990('0x6c')][_0xc990('0x6d')]){throw new Error(_0x46b3c7[_0xc990('0x6c')][_0xc990('0x6d')][_0xc990('0x6e')]);}var _0xe89f5d=[];var _0x2ed01b=[];var _0x3b95b9=[_0xc990('0x6f'),_0xc990('0x70'),_0xc990('0x71'),_0xc990('0x72'),_0xc990('0x73'),'Call_Result','Call_Start_Time',_0xc990('0x74')];_0x2ed01b=_[_0xc990('0x75')](_0x46b3c7[_0xc990('0x34')],function(_0x3fc5d8){return _0x3b95b9['includes'](_0x3fc5d8[_0xc990('0x76')]);});for(var _0x194023=0x0;_0x194023<_0x2ed01b[_0xc990('0x36')];_0x194023++){if(_0x2ed01b[_0x194023][_0xc990('0x77')]===![]){_0xe89f5d[_0xc990('0x78')]({'id':_0x2ed01b[_0x194023]['id'],'name':_0x2ed01b[_0x194023][_0xc990('0x79')],'custom':_0x2ed01b[_0x194023][_0xc990('0x7a')],'options':_0x2ed01b[_0x194023][_0xc990('0x7b')]===_0xc990('0x7c')&&_0x2ed01b[_0x194023][_0xc990('0x7d')][_0xc990('0x36')]>-0x1?_[_0xc990('0x2b')](_0x2ed01b[_0x194023][_0xc990('0x7d')],function(_0x490d00){return{'name':_0x490d00,'value':_0x490d00};}):[]});}}return{'count':_0xe89f5d[_0xc990('0x36')],'rows':_0xe89f5d};}else{return{'count':0x0,'rows':[]};}})[_0xc990('0x26')](respondWithResult(_0x5eef51,null))[_0xc990('0x43')](function(_0x27913f){var _0x2c14f1=_0x252b24[_0xc990('0x30')]['test']?0x1f4:_0x27913f[_0xc990('0x7e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xc990('0x7f'),_0x2c14f1,JSON[_0xc990('0x80')](_0x27913f));delete _0x27913f[_0xc990('0x29')];if(_0x2c14f1===0x191){_0x2c14f1=0x190;}_0x5eef51[_0xc990('0x1b')](_0x2c14f1)[_0xc990('0x2a')](_0x252b24[_0xc990('0x30')][_0xc990('0x81')]?{'message':_0xc990('0x82'),'statusCode':_0x27913f[_0xc990('0x7e')]}:_0x27913f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d0084e7..6807dde 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 _0x46a6=['../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','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','inspect','slice','substring','https://accounts.zoho.com.au','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x269d9b,_0x55d1e8){var _0x518cf5=function(_0x56e7bf){while(--_0x56e7bf){_0x269d9b['push'](_0x269d9b['shift']());}};_0x518cf5(++_0x55d1e8);}(_0x46a6,0x1e6));var _0x646a=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x46a6[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x646a('0x0'));var util=require(_0x646a('0x1'));var logger=require(_0x646a('0x2'))(_0x646a('0x3'));var moment=require('moment');var BPromise=require(_0x646a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x646a('0x5'));var rimraf=require('rimraf');var config=require(_0x646a('0x6'));var attributes=require(_0x646a('0x7'));var integrations=require(_0x646a('0x8'));module['exports']=function(_0x29c5d5,_0x5a638b){return _0x29c5d5[_0x646a('0x9')](_0x646a('0xa'),attributes,{'tableName':_0x646a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x232769,_0x3cb036,_0x2d7d9c){if(_0x232769['changed']('zone')||_0x232769[_0x646a('0xc')](_0x646a('0xd'))||_0x232769['changed'](_0x646a('0xe'))||_0x232769['changed'](_0x646a('0xf'))||_0x232769['changed'](_0x646a('0x10'))||_0x232769[_0x646a('0xc')](_0x646a('0x11'))){var _0x1ff81a,_0x1930ec;_0x1ff81a=_0x232769[_0x646a('0xd')];var _0x31d116=_0x1ff81a['slice'](-0x1);if(_0x31d116==='/'||_0x31d116==='\x5c'||_0x31d116===':'){_0x1ff81a=_0x1ff81a['substring'](0x0,_0x1ff81a[_0x646a('0x12')](_0x31d116));}switch(_0x232769[_0x646a('0x13')]){case'US':_0x1930ec=_0x646a('0x14');break;case'AU':_0x1930ec='https://accounts.zoho.com.au';break;case'IN':_0x1930ec=_0x646a('0x15');break;case'CN':_0x1930ec=_0x646a('0x16');break;default:_0x1930ec=_0x646a('0x17');break;}var _0x1165c6={'method':_0x646a('0x18'),'uri':_0x1930ec+_0x646a('0x19'),'form':{'grant_type':_0x646a('0x1a'),'client_id':_0x232769[_0x646a('0xe')],'client_secret':_0x232769[_0x646a('0xf')],'redirect_uri':_0x232769[_0x646a('0xd')],'code':_0x232769[_0x646a('0x10')]},'headers':{'Content-Type':_0x646a('0x1b')}};return rp(_0x1165c6)[_0x646a('0x1c')](function(_0x1680e7){var _0x3fdd71=JSON[_0x646a('0x1d')](_0x1680e7);if(_0x3fdd71[_0x646a('0x1e')]){_0x232769['refreshToken']=_0x3fdd71[_0x646a('0x1e')];logger[_0x646a('0x1f')](util[_0x646a('0x20')](_0x646a('0x21'),_0x232769['name'],_0x232769['id']));}else{logger[_0x646a('0x22')](util[_0x646a('0x20')](_0x646a('0x23'),_0x232769['name'],_0x232769['id']),util['inspect'](_0x3fdd71,{'showHidden':![],'depth':null}));}return _0x2d7d9c(null,_0x3cb036);})['catch'](function(_0x3b7f66){logger[_0x646a('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x232769[_0x646a('0x24')],_0x232769['id']),util[_0x646a('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2d7d9c(_0x3b7f66);});}else{return _0x2d7d9c(null,_0x3cb036);}},'beforeUpdate':function(_0x506fa9,_0x2176c0,_0x35ac13){if(_0x506fa9[_0x646a('0xc')](_0x646a('0x13'))||_0x506fa9[_0x646a('0xc')](_0x646a('0xd'))||_0x506fa9[_0x646a('0xc')]('clientId')||_0x506fa9[_0x646a('0xc')](_0x646a('0xf'))||_0x506fa9['changed'](_0x646a('0x10'))||_0x506fa9[_0x646a('0xc')](_0x646a('0x11'))){var _0xf56e32,_0x1870ca;_0xf56e32=_0x506fa9[_0x646a('0xd')];var _0x4d4de6=_0xf56e32[_0x646a('0x26')](-0x1);if(_0x4d4de6==='/'||_0x4d4de6==='\x5c'||_0x4d4de6===':'){_0xf56e32=_0xf56e32[_0x646a('0x27')](0x0,_0xf56e32[_0x646a('0x12')](_0x4d4de6));}switch(_0x506fa9[_0x646a('0x13')]){case'US':_0x1870ca='https://accounts.zoho.com';break;case'AU':_0x1870ca=_0x646a('0x28');break;case'IN':_0x1870ca=_0x646a('0x15');break;case'CN':_0x1870ca=_0x646a('0x16');break;default:_0x1870ca=_0x646a('0x17');break;}var _0x2bab01={'method':_0x646a('0x18'),'uri':_0x1870ca+_0x646a('0x19'),'form':{'grant_type':_0x646a('0x1a'),'client_id':_0x506fa9[_0x646a('0xe')],'client_secret':_0x506fa9['clientSecret'],'redirect_uri':_0x506fa9[_0x646a('0xd')],'code':_0x506fa9['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2bab01)['then'](function(_0x1cb396){var _0x349814=JSON['parse'](_0x1cb396);if(_0x349814[_0x646a('0x1e')]){_0x506fa9['refreshToken']=_0x349814[_0x646a('0x1e')];logger['info'](util[_0x646a('0x20')](_0x646a('0x21'),_0x506fa9[_0x646a('0x24')],_0x506fa9['id']));}else{logger[_0x646a('0x22')](util[_0x646a('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x506fa9['name'],_0x506fa9['id']),util['inspect'](_0x349814,{'showHidden':![],'depth':null}));}return _0x35ac13(null,_0x2176c0);})['catch'](function(_0x20dced){logger[_0x646a('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x506fa9['name'],_0x506fa9['id']),util[_0x646a('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x35ac13(_0x20dced);});}else{return _0x35ac13(null,_0x2176c0);}}}});}; \ No newline at end of file +var _0x9597=['ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','host','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','clientId','code','then','parse','refreshToken','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','https://accounts.zoho.in','POST','/oauth/v2/token','application/x-www-form-urlencoded','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x9597,0x14d));var _0x7959=function(_0x2cf73a,_0x2852a6){_0x2cf73a=_0x2cf73a-0x0;var _0x2e088c=_0x9597[_0x2cf73a];return _0x2e088c;};'use strict';var _=require('lodash');var util=require(_0x7959('0x0'));var logger=require(_0x7959('0x1'))(_0x7959('0x2'));var moment=require(_0x7959('0x3'));var BPromise=require(_0x7959('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7959('0x5'));var rimraf=require('rimraf');var config=require(_0x7959('0x6'));var attributes=require(_0x7959('0x7'));var integrations=require(_0x7959('0x8'));module[_0x7959('0x9')]=function(_0x38b027,_0x28830b){return _0x38b027[_0x7959('0xa')](_0x7959('0xb'),attributes,{'tableName':_0x7959('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36b12e,_0x127418,_0x5b787e){if(_0x36b12e[_0x7959('0xd')](_0x7959('0xe'))||_0x36b12e[_0x7959('0xd')](_0x7959('0xf'))||_0x36b12e[_0x7959('0xd')]('clientId')||_0x36b12e['changed'](_0x7959('0x10'))||_0x36b12e['changed']('code')||_0x36b12e[_0x7959('0xd')](_0x7959('0x11'))){var _0x28bc5a,_0x438c92;_0x28bc5a=_0x36b12e['serverUrl'];var _0x23bfbf=_0x28bc5a['slice'](-0x1);if(_0x23bfbf==='/'||_0x23bfbf==='\x5c'||_0x23bfbf===':'){_0x28bc5a=_0x28bc5a[_0x7959('0x12')](0x0,_0x28bc5a['lastIndexOf'](_0x23bfbf));}switch(_0x36b12e[_0x7959('0xe')]){case'US':_0x438c92=_0x7959('0x13');break;case'AU':_0x438c92=_0x7959('0x14');break;case'IN':_0x438c92='https://accounts.zoho.in';break;case'CN':_0x438c92=_0x7959('0x15');break;default:_0x438c92=_0x7959('0x16');break;}var _0x25cf67={'method':'POST','uri':_0x438c92+'/oauth/v2/token','form':{'grant_type':_0x7959('0x17'),'client_id':_0x36b12e[_0x7959('0x18')],'client_secret':_0x36b12e[_0x7959('0x10')],'redirect_uri':_0x36b12e[_0x7959('0xf')],'code':_0x36b12e[_0x7959('0x19')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x25cf67)[_0x7959('0x1a')](function(_0xe7c3c0){var _0x4e2793=JSON[_0x7959('0x1b')](_0xe7c3c0);if(_0x4e2793['refresh_token']){_0x36b12e[_0x7959('0x1c')]=_0x4e2793[_0x7959('0x1d')];logger[_0x7959('0x1e')](util[_0x7959('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x36b12e[_0x7959('0x20')],_0x36b12e['id']));}else{logger[_0x7959('0x21')](util[_0x7959('0x1f')](_0x7959('0x22'),_0x36b12e[_0x7959('0x20')],_0x36b12e['id']),util[_0x7959('0x23')](_0x4e2793,{'showHidden':![],'depth':null}));}return _0x5b787e(null,_0x127418);})[_0x7959('0x24')](function(_0x17e031){logger[_0x7959('0x21')](util[_0x7959('0x1f')](_0x7959('0x22'),_0x36b12e['name'],_0x36b12e['id']),util[_0x7959('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b787e(_0x17e031);});}else{return _0x5b787e(null,_0x127418);}},'beforeUpdate':function(_0x7c4258,_0x337cf8,_0x270d7d){if(_0x7c4258['changed'](_0x7959('0xe'))||_0x7c4258[_0x7959('0xd')](_0x7959('0xf'))||_0x7c4258['changed']('clientId')||_0x7c4258[_0x7959('0xd')](_0x7959('0x10'))||_0x7c4258[_0x7959('0xd')](_0x7959('0x19'))||_0x7c4258['changed'](_0x7959('0x11'))){var _0x4d6f54,_0x19f50;_0x4d6f54=_0x7c4258[_0x7959('0xf')];var _0x7390af=_0x4d6f54[_0x7959('0x25')](-0x1);if(_0x7390af==='/'||_0x7390af==='\x5c'||_0x7390af===':'){_0x4d6f54=_0x4d6f54[_0x7959('0x12')](0x0,_0x4d6f54['lastIndexOf'](_0x7390af));}switch(_0x7c4258[_0x7959('0xe')]){case'US':_0x19f50=_0x7959('0x13');break;case'AU':_0x19f50=_0x7959('0x14');break;case'IN':_0x19f50=_0x7959('0x26');break;case'CN':_0x19f50=_0x7959('0x15');break;default:_0x19f50=_0x7959('0x16');break;}var _0x144b9e={'method':_0x7959('0x27'),'uri':_0x19f50+_0x7959('0x28'),'form':{'grant_type':_0x7959('0x17'),'client_id':_0x7c4258[_0x7959('0x18')],'client_secret':_0x7c4258[_0x7959('0x10')],'redirect_uri':_0x7c4258[_0x7959('0xf')],'code':_0x7c4258[_0x7959('0x19')]},'headers':{'Content-Type':_0x7959('0x29')}};return rp(_0x144b9e)['then'](function(_0x39f87e){var _0x215a7e=JSON['parse'](_0x39f87e);if(_0x215a7e[_0x7959('0x1d')]){_0x7c4258[_0x7959('0x1c')]=_0x215a7e['refresh_token'];logger[_0x7959('0x1e')](util[_0x7959('0x1f')](_0x7959('0x2a'),_0x7c4258[_0x7959('0x20')],_0x7c4258['id']));}else{logger[_0x7959('0x21')](util[_0x7959('0x1f')](_0x7959('0x22'),_0x7c4258[_0x7959('0x20')],_0x7c4258['id']),util[_0x7959('0x23')](_0x215a7e,{'showHidden':![],'depth':null}));}return _0x270d7d(null,_0x337cf8);})[_0x7959('0x24')](function(_0x303bb2){logger[_0x7959('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x7c4258['name'],_0x7c4258['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x270d7d(_0x303bb2);});}else{return _0x270d7d(null,_0x337cf8);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index d19d8f8..54c6114 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 _0xce62=['info','request\x20sent','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowZohoAccount','find','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xce62,0x83));var _0x2ce6=function(_0x7f57d2,_0x1dd696){_0x7f57d2=_0x7f57d2-0x0;var _0x1759da=_0xce62[_0x7f57d2];return _0x1759da;};'use strict';var _=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var moment=require('moment');var BPromise=require(_0x2ce6('0x2'));var rs=require(_0x2ce6('0x3'));var fs=require('fs');var Redis=require(_0x2ce6('0x4'));var db=require(_0x2ce6('0x5'))['db'];var utils=require(_0x2ce6('0x6'));var logger=require(_0x2ce6('0x7'))('rpc');var config=require(_0x2ce6('0x8'));var jayson=require(_0x2ce6('0x9'));var client=jayson[_0x2ce6('0xa')][_0x2ce6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcf425,_0x2c66c2,_0x5b7f02){return new BPromise(function(_0x46ef52,_0x12f647){return client['request'](_0xcf425,_0x5b7f02)[_0x2ce6('0xc')](function(_0x2e6eae){logger[_0x2ce6('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x2c66c2,_0x2ce6('0xe'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2c66c2,_0x2ce6('0xe'),JSON['stringify'](_0x2e6eae));if(_0x2e6eae[_0x2ce6('0xf')]){if(_0x2e6eae['error'][_0x2ce6('0x10')]===0x1f4){logger[_0x2ce6('0xf')](_0x2ce6('0x11'),_0x2c66c2,_0x2e6eae[_0x2ce6('0xf')][_0x2ce6('0x12')]);return _0x12f647(_0x2e6eae[_0x2ce6('0xf')][_0x2ce6('0x12')]);}logger[_0x2ce6('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2c66c2,_0x2e6eae[_0x2ce6('0xf')]['message']);return _0x46ef52(_0x2e6eae[_0x2ce6('0xf')][_0x2ce6('0x12')]);}else{logger[_0x2ce6('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x2c66c2,_0x2ce6('0xe'));_0x46ef52(_0x2e6eae[_0x2ce6('0x13')][_0x2ce6('0x12')]);}})[_0x2ce6('0x14')](function(_0x38032e){logger[_0x2ce6('0xf')](_0x2ce6('0x11'),_0x2c66c2,_0x38032e);_0x12f647(_0x38032e);});});}exports[_0x2ce6('0x15')]=function(_0x353894){var _0x37b5d1=this;return new Promise(function(_0x4f9ceb,_0xa00781){return db[_0x2ce6('0x16')][_0x2ce6('0x17')]({'raw':_0x353894['options']?_0x353894[_0x2ce6('0x18')][_0x2ce6('0x19')]===undefined?!![]:![]:!![],'where':_0x353894[_0x2ce6('0x18')]?_0x353894[_0x2ce6('0x18')][_0x2ce6('0x1a')]||null:null,'attributes':_0x353894['options']?_0x353894[_0x2ce6('0x18')]['attributes']||null:null,'limit':_0x353894['options']?_0x353894[_0x2ce6('0x18')][_0x2ce6('0x1b')]||null:null,'include':_0x353894[_0x2ce6('0x18')]?_0x353894['options'][_0x2ce6('0x1c')]?_[_0x2ce6('0x1d')](_0x353894[_0x2ce6('0x18')][_0x2ce6('0x1c')],function(_0x5a4656){return{'model':db[_0x5a4656[_0x2ce6('0x1e')]],'as':_0x5a4656['as'],'attributes':_0x5a4656[_0x2ce6('0x1f')],'include':_0x5a4656[_0x2ce6('0x1c')]?_[_0x2ce6('0x1d')](_0x5a4656[_0x2ce6('0x1c')],function(_0x366ada){return{'model':db[_0x366ada[_0x2ce6('0x1e')]],'as':_0x366ada['as'],'attributes':_0x366ada['attributes'],'include':_0x366ada['include']?_['map'](_0x366ada[_0x2ce6('0x1c')],function(_0x2df836){return{'model':db[_0x2df836['model']],'as':_0x2df836['as'],'attributes':_0x2df836['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ce6('0xc')](function(_0x126e43){logger[_0x2ce6('0xd')](_0x2ce6('0x15'),_0x353894);logger['debug']('GetZohoAccount',_0x353894,JSON[_0x2ce6('0x20')](_0x126e43));_0x4f9ceb(_0x126e43);})[_0x2ce6('0x14')](function(_0x2fd596){logger['error']('GetZohoAccount',_0x2fd596['message'],_0x353894);_0xa00781(_0x37b5d1[_0x2ce6('0xf')](0x1f4,_0x2fd596['message']));});});};exports[_0x2ce6('0x21')]=function(_0x287568){var _0x1669ae=this;return new Promise(function(_0x396092,_0x3c9bad){return db['ZohoAccount'][_0x2ce6('0x22')]({'raw':_0x287568[_0x2ce6('0x18')]?_0x287568[_0x2ce6('0x18')][_0x2ce6('0x19')]===undefined?!![]:![]:!![],'where':_0x287568['options']?_0x287568[_0x2ce6('0x18')][_0x2ce6('0x1a')]||null:null,'attributes':_0x287568[_0x2ce6('0x18')]?_0x287568['options'][_0x2ce6('0x1f')]||null:null,'include':_0x287568[_0x2ce6('0x18')]?_0x287568[_0x2ce6('0x18')][_0x2ce6('0x1c')]?_[_0x2ce6('0x1d')](_0x287568[_0x2ce6('0x18')]['include'],function(_0x28734c){return{'model':db[_0x28734c['model']],'as':_0x28734c['as'],'attributes':_0x28734c['attributes'],'include':_0x28734c['include']?_[_0x2ce6('0x1d')](_0x28734c[_0x2ce6('0x1c')],function(_0xc50a7b){return{'model':db[_0xc50a7b[_0x2ce6('0x1e')]],'as':_0xc50a7b['as'],'attributes':_0xc50a7b[_0x2ce6('0x1f')],'include':_0xc50a7b[_0x2ce6('0x1c')]?_[_0x2ce6('0x1d')](_0xc50a7b[_0x2ce6('0x1c')],function(_0x3702b0){return{'model':db[_0x3702b0[_0x2ce6('0x1e')]],'as':_0x3702b0['as'],'attributes':_0x3702b0[_0x2ce6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2ce6('0xc')](function(_0x3553d2){logger[_0x2ce6('0xd')](_0x2ce6('0x21'),_0x287568);logger[_0x2ce6('0x23')]('ShowZohoAccount',_0x287568,JSON[_0x2ce6('0x20')](_0x3553d2));_0x396092(_0x3553d2);})[_0x2ce6('0x14')](function(_0x13346e){logger[_0x2ce6('0xf')]('ShowZohoAccount',_0x13346e[_0x2ce6('0x12')],_0x287568);_0x3c9bad(_0x1669ae['error'](0x1f4,_0x13346e[_0x2ce6('0x12')]));});});}; \ No newline at end of file +var _0xef4d=['request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','result','catch','ZohoAccount','options','raw','where','attributes','limit','include','model','map','GetZohoAccount','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xef4d,0x165));var _0xdef4=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xef4d[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0xdef4('0x0'));var util=require(_0xdef4('0x1'));var moment=require(_0xdef4('0x2'));var BPromise=require(_0xdef4('0x3'));var rs=require(_0xdef4('0x4'));var fs=require('fs');var Redis=require(_0xdef4('0x5'));var db=require(_0xdef4('0x6'))['db'];var utils=require(_0xdef4('0x7'));var logger=require(_0xdef4('0x8'))(_0xdef4('0x9'));var config=require(_0xdef4('0xa'));var jayson=require(_0xdef4('0xb'));var client=jayson[_0xdef4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x468dcd,_0x3b875f,_0x2cebfd){return new BPromise(function(_0x1dc5c9,_0x525707){return client[_0xdef4('0xd')](_0x468dcd,_0x2cebfd)[_0xdef4('0xe')](function(_0x87d8a3){logger[_0xdef4('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x3b875f,_0xdef4('0x10'));logger[_0xdef4('0x11')](_0xdef4('0x12'),_0x3b875f,_0xdef4('0x10'),JSON[_0xdef4('0x13')](_0x87d8a3));if(_0x87d8a3[_0xdef4('0x14')]){if(_0x87d8a3[_0xdef4('0x14')]['code']===0x1f4){logger[_0xdef4('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x3b875f,_0x87d8a3['error'][_0xdef4('0x15')]);return _0x525707(_0x87d8a3['error'][_0xdef4('0x15')]);}logger['error'](_0xdef4('0x16'),_0x3b875f,_0x87d8a3[_0xdef4('0x14')][_0xdef4('0x15')]);return _0x1dc5c9(_0x87d8a3[_0xdef4('0x14')]['message']);}else{logger[_0xdef4('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x3b875f,_0xdef4('0x10'));_0x1dc5c9(_0x87d8a3[_0xdef4('0x17')]['message']);}})[_0xdef4('0x18')](function(_0x27463d){logger[_0xdef4('0x14')](_0xdef4('0x16'),_0x3b875f,_0x27463d);_0x525707(_0x27463d);});});}exports['GetZohoAccount']=function(_0x377beb){var _0x3b3a4=this;return new Promise(function(_0x469178,_0x18d3a0){return db[_0xdef4('0x19')]['findAll']({'raw':_0x377beb[_0xdef4('0x1a')]?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1b')]===undefined?!![]:![]:!![],'where':_0x377beb[_0xdef4('0x1a')]?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1c')]||null:null,'attributes':_0x377beb['options']?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1d')]||null:null,'limit':_0x377beb[_0xdef4('0x1a')]?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1e')]||null:null,'include':_0x377beb[_0xdef4('0x1a')]?_0x377beb['options'][_0xdef4('0x1f')]?_['map'](_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1f')],function(_0x35c401){return{'model':db[_0x35c401[_0xdef4('0x20')]],'as':_0x35c401['as'],'attributes':_0x35c401['attributes'],'include':_0x35c401[_0xdef4('0x1f')]?_[_0xdef4('0x21')](_0x35c401[_0xdef4('0x1f')],function(_0xf43627){return{'model':db[_0xf43627[_0xdef4('0x20')]],'as':_0xf43627['as'],'attributes':_0xf43627[_0xdef4('0x1d')],'include':_0xf43627[_0xdef4('0x1f')]?_[_0xdef4('0x21')](_0xf43627['include'],function(_0x3e770f){return{'model':db[_0x3e770f[_0xdef4('0x20')]],'as':_0x3e770f['as'],'attributes':_0x3e770f['attributes']};}):[]};}):[]};}):[]:[]})[_0xdef4('0xe')](function(_0x26718b){logger[_0xdef4('0xf')](_0xdef4('0x22'),_0x377beb);logger[_0xdef4('0x11')](_0xdef4('0x22'),_0x377beb,JSON['stringify'](_0x26718b));_0x469178(_0x26718b);})[_0xdef4('0x18')](function(_0x256165){logger['error'](_0xdef4('0x22'),_0x256165[_0xdef4('0x15')],_0x377beb);_0x18d3a0(_0x3b3a4[_0xdef4('0x14')](0x1f4,_0x256165[_0xdef4('0x15')]));});});};exports[_0xdef4('0x23')]=function(_0x2cadc4){var _0x2f0f33=this;return new Promise(function(_0x25fc2c,_0xe92978){return db[_0xdef4('0x19')][_0xdef4('0x24')]({'raw':_0x2cadc4['options']?_0x2cadc4['options'][_0xdef4('0x1b')]===undefined?!![]:![]:!![],'where':_0x2cadc4[_0xdef4('0x1a')]?_0x2cadc4[_0xdef4('0x1a')]['where']||null:null,'attributes':_0x2cadc4[_0xdef4('0x1a')]?_0x2cadc4[_0xdef4('0x1a')][_0xdef4('0x1d')]||null:null,'include':_0x2cadc4[_0xdef4('0x1a')]?_0x2cadc4['options']['include']?_['map'](_0x2cadc4[_0xdef4('0x1a')][_0xdef4('0x1f')],function(_0x46d84a){return{'model':db[_0x46d84a[_0xdef4('0x20')]],'as':_0x46d84a['as'],'attributes':_0x46d84a[_0xdef4('0x1d')],'include':_0x46d84a['include']?_[_0xdef4('0x21')](_0x46d84a[_0xdef4('0x1f')],function(_0x46f3b2){return{'model':db[_0x46f3b2[_0xdef4('0x20')]],'as':_0x46f3b2['as'],'attributes':_0x46f3b2[_0xdef4('0x1d')],'include':_0x46f3b2['include']?_[_0xdef4('0x21')](_0x46f3b2[_0xdef4('0x1f')],function(_0x3c2028){return{'model':db[_0x3c2028['model']],'as':_0x3c2028['as'],'attributes':_0x3c2028[_0xdef4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5822fe){logger[_0xdef4('0xf')]('ShowZohoAccount',_0x2cadc4);logger[_0xdef4('0x11')](_0xdef4('0x23'),_0x2cadc4,JSON[_0xdef4('0x13')](_0x5822fe));_0x25fc2c(_0x5822fe);})[_0xdef4('0x18')](function(_0x133e0d){logger[_0xdef4('0x14')](_0xdef4('0x23'),_0x133e0d[_0xdef4('0x15')],_0x2cadc4);_0xe92978(_0x2f0f33['error'](0x1f4,_0x133e0d['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index e135f4c..14d988b 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 _0xc0d4=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util'];(function(_0x1bf616,_0x12b164){var _0x1ab4ed=function(_0x35477a){while(--_0x35477a){_0x1bf616['push'](_0x1bf616['shift']());}};_0x1ab4ed(++_0x12b164);}(_0xc0d4,0xfb));var _0x4c0d=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xc0d4[_0x313c96];return _0x522f53;};'use strict';var multer=require(_0x4c0d('0x0'));var util=require(_0x4c0d('0x1'));var path=require('path');var timeout=require(_0x4c0d('0x2'));var express=require(_0x4c0d('0x3'));var router=express[_0x4c0d('0x4')]();var fs_extra=require(_0x4c0d('0x5'));var auth=require(_0x4c0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4c0d('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x4c0d('0x8')]('/',auth['isAuthenticated'](),controller[_0x4c0d('0x9')]);router['get'](_0x4c0d('0xa'),auth[_0x4c0d('0xb')](),controller[_0x4c0d('0xc')]);router[_0x4c0d('0x8')](_0x4c0d('0xd'),auth[_0x4c0d('0xb')](),controller['getFields']);router[_0x4c0d('0x8')]('/:id/subjects',auth[_0x4c0d('0xb')](),controller[_0x4c0d('0xe')]);router[_0x4c0d('0x8')](_0x4c0d('0xf'),auth[_0x4c0d('0xb')](),controller[_0x4c0d('0x10')]);router[_0x4c0d('0x11')]('/',auth[_0x4c0d('0xb')](),controller[_0x4c0d('0x12')]);router['put'](_0x4c0d('0xa'),auth[_0x4c0d('0xb')](),controller[_0x4c0d('0x13')]);router[_0x4c0d('0x14')](_0x4c0d('0xa'),auth['isAuthenticated'](),controller[_0x4c0d('0x15')]);module[_0x4c0d('0x16')]=router; \ No newline at end of file +var _0x37c4=['isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','exports','multer','util','path','express','../../components/interaction/service','get','index','/:id'];(function(_0x5a8c9b,_0x400c54){var _0x40d8b9=function(_0x295c62){while(--_0x295c62){_0x5a8c9b['push'](_0x5a8c9b['shift']());}};_0x40d8b9(++_0x400c54);}(_0x37c4,0x14e));var _0x437c=function(_0x18e459,_0x327ad9){_0x18e459=_0x18e459-0x0;var _0x25321e=_0x37c4[_0x18e459];return _0x25321e;};'use strict';var multer=require(_0x437c('0x0'));var util=require(_0x437c('0x1'));var path=require(_0x437c('0x2'));var timeout=require('connect-timeout');var express=require(_0x437c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x437c('0x4'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x437c('0x5')]('/',auth['isAuthenticated'](),controller[_0x437c('0x6')]);router['get'](_0x437c('0x7'),auth[_0x437c('0x8')](),controller[_0x437c('0x9')]);router[_0x437c('0x5')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x437c('0xa'),auth['isAuthenticated'](),controller[_0x437c('0xb')]);router['get'](_0x437c('0xc'),auth['isAuthenticated'](),controller[_0x437c('0xd')]);router[_0x437c('0xe')]('/',auth[_0x437c('0x8')](),controller['create']);router[_0x437c('0xf')](_0x437c('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x437c('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x437c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6ea0dd7..e96596d 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 _0x01c9=['STRING','lead','contact','contact_lead','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01c9,0x1a3));var _0x901c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01c9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x901c('0x0')]={'name':{'type':Sequelize[_0x901c('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x901c('0x2'),_0x901c('0x3'),'nothing'),'defaultValue':_0x901c('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x901c('0x4'),_0x901c('0x3'),_0x901c('0x2')),'defaultValue':_0x901c('0x4')},'description':{'type':Sequelize[_0x901c('0x1')]}}; \ No newline at end of file +var _0xb412=['exports','STRING','ENUM','lead','contact','contact_lead'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xb412,0x7e));var _0x2b41=function(_0x1d478d,_0x41aaec){_0x1d478d=_0x1d478d-0x0;var _0xedb6c7=_0xb412[_0x1d478d];return _0xedb6c7;};'use strict';var Sequelize=require('sequelize');module[_0x2b41('0x0')]={'name':{'type':Sequelize[_0x2b41('0x1')]},'moduleCreate':{'type':Sequelize[_0x2b41('0x2')](_0x2b41('0x3'),_0x2b41('0x4'),'nothing'),'defaultValue':_0x2b41('0x3')},'moduleSearch':{'type':Sequelize[_0x2b41('0x2')]('contact_lead',_0x2b41('0x4'),'lead'),'defaultValue':_0x2b41('0x5')},'description':{'type':Sequelize[_0x2b41('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2a24a90..830bfda 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 _0x6a56=['intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','ZohoConfiguration','then','includeAll','include','params','rawAttributes','find','catch','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','error','stack','name','index','fieldName','type','key','map','query','keys','filters'];(function(_0x87eaa7,_0x288c0d){var _0x27a4cf=function(_0x468c30){while(--_0x468c30){_0x87eaa7['push'](_0x87eaa7['shift']());}};_0x27a4cf(++_0x288c0d);}(_0x6a56,0x15e));var _0x66a5=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x6a56[_0x5a60ce];return _0x393e5e;};'use strict';var emlformat=require(_0x66a5('0x0'));var rimraf=require(_0x66a5('0x1'));var zipdir=require(_0x66a5('0x2'));var jsonpatch=require(_0x66a5('0x3'));var rp=require(_0x66a5('0x4'));var moment=require(_0x66a5('0x5'));var BPromise=require(_0x66a5('0x6'));var Mustache=require(_0x66a5('0x7'));var util=require(_0x66a5('0x8'));var path=require(_0x66a5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66a5('0xa'));var _=require(_0x66a5('0xb'));var squel=require(_0x66a5('0xc'));var crypto=require(_0x66a5('0xd'));var jsforce=require(_0x66a5('0xe'));var deskjs=require(_0x66a5('0xf'));var toCsv=require(_0x66a5('0x10'));var querystring=require(_0x66a5('0x11'));var Papa=require(_0x66a5('0x12'));var Redis=require(_0x66a5('0x13'));var authService=require(_0x66a5('0x14'));var qs=require(_0x66a5('0x15'));var as=require(_0x66a5('0x16'));var hardwareService=require(_0x66a5('0x17'));var logger=require(_0x66a5('0x18'))(_0x66a5('0x19'));var utils=require(_0x66a5('0x1a'));var config=require(_0x66a5('0x1b'));var licenseUtil=require(_0x66a5('0x1c'));var db=require(_0x66a5('0x1d'))['db'];function respondWithStatusCode(_0x13ce07,_0x1115c6){_0x1115c6=_0x1115c6||0xcc;return function(_0x34b560){if(_0x34b560){return _0x13ce07['sendStatus'](_0x1115c6);}return _0x13ce07[_0x66a5('0x1e')](_0x1115c6)[_0x66a5('0x1f')]();};}function respondWithResult(_0x1c0c5a,_0x1ac286){_0x1ac286=_0x1ac286||0xc8;return function(_0x38c56b){if(_0x38c56b){return _0x1c0c5a[_0x66a5('0x1e')](_0x1ac286)['json'](_0x38c56b);}};}function respondWithFilteredResult(_0x23a563,_0x1a73a5){return function(_0x3232c4){if(_0x3232c4){var _0x12069d=typeof _0x1a73a5[_0x66a5('0x20')]===_0x66a5('0x21')&&typeof _0x1a73a5[_0x66a5('0x22')]===_0x66a5('0x21');var _0x572e0f=_0x3232c4['count'];var _0x43e262=_0x12069d?0x0:_0x1a73a5[_0x66a5('0x20')];var _0x449c2a=_0x12069d?_0x3232c4[_0x66a5('0x23')]:_0x1a73a5[_0x66a5('0x20')]+_0x1a73a5['limit'];var _0x40448a;if(_0x449c2a>=_0x572e0f){_0x449c2a=_0x572e0f;_0x40448a=0xc8;}else{_0x40448a=0xce;}_0x23a563[_0x66a5('0x1e')](_0x40448a);return _0x23a563['set'](_0x66a5('0x24'),_0x43e262+'-'+_0x449c2a+'/'+_0x572e0f)[_0x66a5('0x25')](_0x3232c4);}return null;};}function patchUpdates(_0x15e055){return function(_0x46e639){try{jsonpatch[_0x66a5('0x26')](_0x46e639,_0x15e055,!![]);}catch(_0x391b96){return BPromise['reject'](_0x391b96);}return _0x46e639['save']();};}function saveUpdates(_0x963232,_0x5a4be4){return function(_0x1ccce0){if(_0x1ccce0){return _0x1ccce0['update'](_0x963232)['then'](function(_0x3faa09){return _0x3faa09;});}return null;};}function removeEntity(_0x55901b,_0x1c43ac){return function(_0x4a4d51){if(_0x4a4d51){return _0x4a4d51['destroy']()['then'](function(){_0x55901b[_0x66a5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cbb2a,_0x136d67){return function(_0x1822c7){if(!_0x1822c7){_0x5cbb2a['sendStatus'](0x194);}return _0x1822c7;};}function handleError(_0x1a9bfa,_0x3df585){_0x3df585=_0x3df585||0x1f4;return function(_0x1e7283){logger[_0x66a5('0x27')](_0x1e7283[_0x66a5('0x28')]);if(_0x1e7283[_0x66a5('0x29')]){delete _0x1e7283[_0x66a5('0x29')];}_0x1a9bfa[_0x66a5('0x1e')](_0x3df585)['send'](_0x1e7283);};}exports[_0x66a5('0x2a')]=function(_0x46fe0c,_0x2d84bf){var _0x316623={},_0x14020f={},_0x339c9a={'count':0x0,'rows':[]};var _0x41cab5=_['map'](db['ZohoConfiguration']['rawAttributes'],function(_0x1e00cc){return{'name':_0x1e00cc[_0x66a5('0x2b')],'type':_0x1e00cc[_0x66a5('0x2c')][_0x66a5('0x2d')]};});_0x14020f['model']=_[_0x66a5('0x2e')](_0x41cab5,'name');_0x14020f[_0x66a5('0x2f')]=_[_0x66a5('0x30')](_0x46fe0c[_0x66a5('0x2f')]);_0x14020f[_0x66a5('0x31')]=_[_0x66a5('0x32')](_0x14020f['model'],_0x14020f[_0x66a5('0x2f')]);_0x316623[_0x66a5('0x33')]=_[_0x66a5('0x32')](_0x14020f[_0x66a5('0x34')],qs[_0x66a5('0x35')](_0x46fe0c['query']['fields']));_0x316623[_0x66a5('0x33')]=_0x316623[_0x66a5('0x33')][_0x66a5('0x36')]?_0x316623[_0x66a5('0x33')]:_0x14020f[_0x66a5('0x34')];if(!_0x46fe0c['query'][_0x66a5('0x37')](_0x66a5('0x38'))){_0x316623['limit']=qs[_0x66a5('0x22')](_0x46fe0c[_0x66a5('0x2f')][_0x66a5('0x22')]);_0x316623[_0x66a5('0x20')]=qs[_0x66a5('0x20')](_0x46fe0c['query']['offset']);}_0x316623[_0x66a5('0x39')]=qs[_0x66a5('0x3a')](_0x46fe0c[_0x66a5('0x2f')][_0x66a5('0x3a')]);_0x316623['where']=qs[_0x66a5('0x31')](_[_0x66a5('0x3b')](_0x46fe0c[_0x66a5('0x2f')],_0x14020f['filters']),_0x41cab5);if(_0x46fe0c['query'][_0x66a5('0x3c')]){_0x316623['where']=_[_0x66a5('0x3d')](_0x316623[_0x66a5('0x3e')],{'$or':_[_0x66a5('0x2e')](_0x41cab5,function(_0x21209f){if(_0x21209f[_0x66a5('0x2c')]!==_0x66a5('0x3f')){var _0x3f3e48={};_0x3f3e48[_0x21209f['name']]={'$like':'%'+_0x46fe0c[_0x66a5('0x2f')][_0x66a5('0x3c')]+'%'};return _0x3f3e48;}})});}_0x316623=_[_0x66a5('0x3d')]({},_0x316623,_0x46fe0c[_0x66a5('0x40')]);var _0x543c24={'where':_0x316623[_0x66a5('0x3e')]};return db[_0x66a5('0x41')]['count'](_0x543c24)[_0x66a5('0x42')](function(_0x58d770){_0x339c9a[_0x66a5('0x23')]=_0x58d770;if(_0x46fe0c[_0x66a5('0x2f')][_0x66a5('0x43')]){_0x316623[_0x66a5('0x44')]=[{'all':!![]}];}return db[_0x66a5('0x41')]['findAll'](_0x316623);})[_0x66a5('0x42')](function(_0x44b26f){_0x339c9a['rows']=_0x44b26f;return _0x339c9a;})[_0x66a5('0x42')](respondWithFilteredResult(_0x2d84bf,_0x316623))['catch'](handleError(_0x2d84bf,null));};exports['show']=function(_0x5027c1,_0x1b27dc){var _0x3863ff={'raw':![],'where':{'id':_0x5027c1[_0x66a5('0x45')]['id']}},_0x22d293={};_0x22d293[_0x66a5('0x34')]=_[_0x66a5('0x30')](db[_0x66a5('0x41')][_0x66a5('0x46')]);_0x22d293[_0x66a5('0x2f')]=_[_0x66a5('0x30')](_0x5027c1[_0x66a5('0x2f')]);_0x22d293[_0x66a5('0x31')]=_[_0x66a5('0x32')](_0x22d293['model'],_0x22d293['query']);_0x3863ff[_0x66a5('0x33')]=_[_0x66a5('0x32')](_0x22d293[_0x66a5('0x34')],qs[_0x66a5('0x35')](_0x5027c1[_0x66a5('0x2f')][_0x66a5('0x35')]));_0x3863ff[_0x66a5('0x33')]=_0x3863ff[_0x66a5('0x33')][_0x66a5('0x36')]?_0x3863ff[_0x66a5('0x33')]:_0x22d293[_0x66a5('0x34')];if(_0x5027c1[_0x66a5('0x2f')][_0x66a5('0x43')]){_0x3863ff[_0x66a5('0x44')]=[{'all':!![]}];}_0x3863ff=_[_0x66a5('0x3d')]({},_0x3863ff,_0x5027c1[_0x66a5('0x40')]);return db[_0x66a5('0x41')][_0x66a5('0x47')](_0x3863ff)[_0x66a5('0x42')](handleEntityNotFound(_0x1b27dc,null))[_0x66a5('0x42')](respondWithResult(_0x1b27dc,null))[_0x66a5('0x48')](handleError(_0x1b27dc,null));};exports['create']=function(_0x391e71,_0xf5c187){return db[_0x66a5('0x41')][_0x66a5('0x49')](_0x391e71[_0x66a5('0x4a')],{})[_0x66a5('0x42')](respondWithResult(_0xf5c187,0xc9))[_0x66a5('0x48')](handleError(_0xf5c187,null));};exports['update']=function(_0x55e444,_0x599c69){if(_0x55e444[_0x66a5('0x4a')]['id']){delete _0x55e444[_0x66a5('0x4a')]['id'];}return db['ZohoConfiguration'][_0x66a5('0x47')]({'where':{'id':_0x55e444[_0x66a5('0x45')]['id']}})[_0x66a5('0x42')](handleEntityNotFound(_0x599c69,null))[_0x66a5('0x42')](saveUpdates(_0x55e444[_0x66a5('0x4a')],null))['then'](respondWithResult(_0x599c69,null))[_0x66a5('0x48')](handleError(_0x599c69,null));};exports['destroy']=function(_0x340c15,_0x5c7746){return db['ZohoConfiguration'][_0x66a5('0x47')]({'where':{'id':_0x340c15[_0x66a5('0x45')]['id']}})[_0x66a5('0x42')](handleEntityNotFound(_0x5c7746,null))[_0x66a5('0x42')](removeEntity(_0x5c7746,null))[_0x66a5('0x48')](handleError(_0x5c7746,null));};exports[_0x66a5('0x4b')]=function(_0x517a3d,_0x5db5bc,_0x4e6c93){var _0x46aa7d={};var _0x4d8e09={};var _0x2bb2fb;var _0x518ff1;return db[_0x66a5('0x41')][_0x66a5('0x4c')]({'where':{'id':_0x517a3d[_0x66a5('0x45')]['id']}})[_0x66a5('0x42')](handleEntityNotFound(_0x5db5bc,null))['then'](function(_0x37c4e5){if(_0x37c4e5){_0x2bb2fb=_0x37c4e5;_0x4d8e09['model']=_[_0x66a5('0x30')](db[_0x66a5('0x4d')][_0x66a5('0x46')]);_0x4d8e09[_0x66a5('0x2f')]=_[_0x66a5('0x30')](_0x517a3d[_0x66a5('0x2f')]);_0x4d8e09[_0x66a5('0x31')]=_[_0x66a5('0x32')](_0x4d8e09[_0x66a5('0x34')],_0x4d8e09['query']);_0x46aa7d[_0x66a5('0x33')]=_[_0x66a5('0x32')](_0x4d8e09[_0x66a5('0x34')],qs['fields'](_0x517a3d[_0x66a5('0x2f')][_0x66a5('0x35')]));_0x46aa7d[_0x66a5('0x33')]=_0x46aa7d['attributes'][_0x66a5('0x36')]?_0x46aa7d['attributes']:_0x4d8e09[_0x66a5('0x34')];_0x46aa7d[_0x66a5('0x39')]=qs[_0x66a5('0x3a')](_0x517a3d[_0x66a5('0x2f')][_0x66a5('0x3a')]);_0x46aa7d['where']=qs[_0x66a5('0x31')](_['pick'](_0x517a3d[_0x66a5('0x2f')],_0x4d8e09['filters']));if(_0x517a3d[_0x66a5('0x2f')][_0x66a5('0x3c')]){_0x46aa7d[_0x66a5('0x3e')]=_[_0x66a5('0x3d')](_0x46aa7d[_0x66a5('0x3e')],{'$or':_['map'](_0x46aa7d['attributes'],function(_0x17cab8){var _0x513ac8={};_0x513ac8[_0x17cab8]={'$like':'%'+_0x517a3d[_0x66a5('0x2f')][_0x66a5('0x3c')]+'%'};return _0x513ac8;})});}_0x46aa7d=_[_0x66a5('0x3d')]({},_0x46aa7d,_0x517a3d[_0x66a5('0x40')]);return _0x2bb2fb[_0x66a5('0x4b')](_0x46aa7d);}})[_0x66a5('0x42')](function(_0x3491de){if(_0x3491de){_0x518ff1=_0x3491de['length'];if(!_0x517a3d[_0x66a5('0x2f')]['hasOwnProperty']('nolimit')){_0x46aa7d[_0x66a5('0x22')]=qs['limit'](_0x517a3d[_0x66a5('0x2f')][_0x66a5('0x22')]);_0x46aa7d[_0x66a5('0x20')]=qs[_0x66a5('0x20')](_0x517a3d[_0x66a5('0x2f')][_0x66a5('0x20')]);}return _0x2bb2fb[_0x66a5('0x4b')](_0x46aa7d);}})['then'](function(_0x2ee42c){if(_0x2ee42c){return _0x2ee42c?{'count':_0x518ff1,'rows':_0x2ee42c}:null;}})[_0x66a5('0x42')](respondWithResult(_0x5db5bc,null))[_0x66a5('0x48')](handleError(_0x5db5bc,null));};exports[_0x66a5('0x4e')]=function(_0x5b7f0b,_0x41a7f1,_0x4f1c19){var _0x531ef1={};var _0x5aae09={};var _0xd2316c;var _0x416d21;return db['ZohoConfiguration'][_0x66a5('0x4c')]({'where':{'id':_0x5b7f0b['params']['id']}})['then'](handleEntityNotFound(_0x41a7f1,null))[_0x66a5('0x42')](function(_0x344f79){if(_0x344f79){_0xd2316c=_0x344f79;_0x5aae09[_0x66a5('0x34')]=_[_0x66a5('0x30')](db['ZohoField'][_0x66a5('0x46')]);_0x5aae09[_0x66a5('0x2f')]=_[_0x66a5('0x30')](_0x5b7f0b[_0x66a5('0x2f')]);_0x5aae09[_0x66a5('0x31')]=_[_0x66a5('0x32')](_0x5aae09[_0x66a5('0x34')],_0x5aae09[_0x66a5('0x2f')]);_0x531ef1[_0x66a5('0x33')]=_['intersection'](_0x5aae09[_0x66a5('0x34')],qs['fields'](_0x5b7f0b[_0x66a5('0x2f')]['fields']));_0x531ef1[_0x66a5('0x33')]=_0x531ef1[_0x66a5('0x33')][_0x66a5('0x36')]?_0x531ef1[_0x66a5('0x33')]:_0x5aae09[_0x66a5('0x34')];_0x531ef1[_0x66a5('0x39')]=qs[_0x66a5('0x3a')](_0x5b7f0b[_0x66a5('0x2f')][_0x66a5('0x3a')]);_0x531ef1['where']=qs[_0x66a5('0x31')](_['pick'](_0x5b7f0b[_0x66a5('0x2f')],_0x5aae09[_0x66a5('0x31')]));if(_0x5b7f0b[_0x66a5('0x2f')][_0x66a5('0x3c')]){_0x531ef1[_0x66a5('0x3e')]=_[_0x66a5('0x3d')](_0x531ef1[_0x66a5('0x3e')],{'$or':_[_0x66a5('0x2e')](_0x531ef1[_0x66a5('0x33')],function(_0xf51162){var _0x3e4704={};_0x3e4704[_0xf51162]={'$like':'%'+_0x5b7f0b['query']['filter']+'%'};return _0x3e4704;})});}_0x531ef1=_[_0x66a5('0x3d')]({},_0x531ef1,_0x5b7f0b[_0x66a5('0x40')]);return _0xd2316c[_0x66a5('0x4e')](_0x531ef1);}})['then'](function(_0x11cd10){if(_0x11cd10){_0x416d21=_0x11cd10['length'];if(!_0x5b7f0b[_0x66a5('0x2f')][_0x66a5('0x37')](_0x66a5('0x38'))){_0x531ef1['limit']=qs[_0x66a5('0x22')](_0x5b7f0b[_0x66a5('0x2f')][_0x66a5('0x22')]);_0x531ef1[_0x66a5('0x20')]=qs[_0x66a5('0x20')](_0x5b7f0b[_0x66a5('0x2f')]['offset']);}return _0xd2316c[_0x66a5('0x4e')](_0x531ef1);}})['then'](function(_0x4b1284){if(_0x4b1284){return _0x4b1284?{'count':_0x416d21,'rows':_0x4b1284}:null;}})['then'](respondWithResult(_0x41a7f1,null))['catch'](handleError(_0x41a7f1,null));};exports[_0x66a5('0x4f')]=function(_0x333347,_0xd6a8e3,_0x49cae3){var _0x535159={};var _0x57a200={};var _0x5e2b96;var _0x338d8f;return db[_0x66a5('0x41')][_0x66a5('0x4c')]({'where':{'id':_0x333347['params']['id']}})[_0x66a5('0x42')](handleEntityNotFound(_0xd6a8e3,null))[_0x66a5('0x42')](function(_0xda8167){if(_0xda8167){_0x5e2b96=_0xda8167;_0x57a200['model']=_[_0x66a5('0x30')](db['ZohoField'][_0x66a5('0x46')]);_0x57a200[_0x66a5('0x2f')]=_['keys'](_0x333347[_0x66a5('0x2f')]);_0x57a200['filters']=_[_0x66a5('0x32')](_0x57a200['model'],_0x57a200[_0x66a5('0x2f')]);_0x535159[_0x66a5('0x33')]=_[_0x66a5('0x32')](_0x57a200[_0x66a5('0x34')],qs[_0x66a5('0x35')](_0x333347[_0x66a5('0x2f')][_0x66a5('0x35')]));_0x535159[_0x66a5('0x33')]=_0x535159['attributes'][_0x66a5('0x36')]?_0x535159[_0x66a5('0x33')]:_0x57a200['model'];_0x535159[_0x66a5('0x39')]=qs[_0x66a5('0x3a')](_0x333347[_0x66a5('0x2f')][_0x66a5('0x3a')]);_0x535159['where']=qs['filters'](_[_0x66a5('0x3b')](_0x333347[_0x66a5('0x2f')],_0x57a200[_0x66a5('0x31')]));if(_0x333347[_0x66a5('0x2f')][_0x66a5('0x3c')]){_0x535159[_0x66a5('0x3e')]=_['merge'](_0x535159['where'],{'$or':_['map'](_0x535159[_0x66a5('0x33')],function(_0x24fc41){var _0x5943b0={};_0x5943b0[_0x24fc41]={'$like':'%'+_0x333347['query'][_0x66a5('0x3c')]+'%'};return _0x5943b0;})});}_0x535159=_[_0x66a5('0x3d')]({},_0x535159,_0x333347[_0x66a5('0x40')]);return _0x5e2b96['getDescriptions'](_0x535159);}})['then'](function(_0x1989ff){if(_0x1989ff){_0x338d8f=_0x1989ff[_0x66a5('0x36')];if(!_0x333347[_0x66a5('0x2f')][_0x66a5('0x37')](_0x66a5('0x38'))){_0x535159[_0x66a5('0x22')]=qs[_0x66a5('0x22')](_0x333347[_0x66a5('0x2f')][_0x66a5('0x22')]);_0x535159[_0x66a5('0x20')]=qs[_0x66a5('0x20')](_0x333347[_0x66a5('0x2f')][_0x66a5('0x20')]);}return _0x5e2b96[_0x66a5('0x4f')](_0x535159);}})[_0x66a5('0x42')](function(_0x259dc3){if(_0x259dc3){return _0x259dc3?{'count':_0x338d8f,'rows':_0x259dc3}:null;}})[_0x66a5('0x42')](respondWithResult(_0xd6a8e3,null))[_0x66a5('0x48')](handleError(_0xd6a8e3,null));}; \ No newline at end of file +var _0x857a=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','send','index','map','ZohoConfiguration','rawAttributes','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','ZohoField','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra'];(function(_0x414872,_0x5d5bda){var _0x50b261=function(_0x4849d8){while(--_0x4849d8){_0x414872['push'](_0x414872['shift']());}};_0x50b261(++_0x5d5bda);}(_0x857a,0x12f));var _0xa857=function(_0x3149a9,_0x4ca7f6){_0x3149a9=_0x3149a9-0x0;var _0x5a37ca=_0x857a[_0x3149a9];return _0x5a37ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa857('0x0'));var zipdir=require(_0xa857('0x1'));var jsonpatch=require(_0xa857('0x2'));var rp=require(_0xa857('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa857('0x4'));var path=require('path');var sox=require(_0xa857('0x5'));var csv=require(_0xa857('0x6'));var ejs=require(_0xa857('0x7'));var fs=require('fs');var fs_extra=require(_0xa857('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa857('0x9'));var deskjs=require(_0xa857('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa857('0xb'));var Papa=require(_0xa857('0xc'));var Redis=require('ioredis');var authService=require(_0xa857('0xd'));var qs=require(_0xa857('0xe'));var as=require(_0xa857('0xf'));var hardwareService=require(_0xa857('0x10'));var logger=require(_0xa857('0x11'))(_0xa857('0x12'));var utils=require(_0xa857('0x13'));var config=require(_0xa857('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa857('0x15'))['db'];function respondWithStatusCode(_0x2e9d87,_0xc412a9){_0xc412a9=_0xc412a9||0xcc;return function(_0x91f4fa){if(_0x91f4fa){return _0x2e9d87[_0xa857('0x16')](_0xc412a9);}return _0x2e9d87[_0xa857('0x17')](_0xc412a9)['end']();};}function respondWithResult(_0x2a5de8,_0x248ec7){_0x248ec7=_0x248ec7||0xc8;return function(_0x17f8e2){if(_0x17f8e2){return _0x2a5de8['status'](_0x248ec7)[_0xa857('0x18')](_0x17f8e2);}};}function respondWithFilteredResult(_0x51c4b6,_0x5b3b4f){return function(_0x17088c){if(_0x17088c){var _0x31400c=typeof _0x5b3b4f['offset']===_0xa857('0x19')&&typeof _0x5b3b4f[_0xa857('0x1a')]===_0xa857('0x19');var _0x45b6a2=_0x17088c[_0xa857('0x1b')];var _0x3cc7cb=_0x31400c?0x0:_0x5b3b4f[_0xa857('0x1c')];var _0x4a73fc=_0x31400c?_0x17088c[_0xa857('0x1b')]:_0x5b3b4f['offset']+_0x5b3b4f['limit'];var _0x3482bf;if(_0x4a73fc>=_0x45b6a2){_0x4a73fc=_0x45b6a2;_0x3482bf=0xc8;}else{_0x3482bf=0xce;}_0x51c4b6[_0xa857('0x17')](_0x3482bf);return _0x51c4b6[_0xa857('0x1d')](_0xa857('0x1e'),_0x3cc7cb+'-'+_0x4a73fc+'/'+_0x45b6a2)[_0xa857('0x18')](_0x17088c);}return null;};}function patchUpdates(_0x49149d){return function(_0x5e1f91){try{jsonpatch[_0xa857('0x1f')](_0x5e1f91,_0x49149d,!![]);}catch(_0x35a565){return BPromise['reject'](_0x35a565);}return _0x5e1f91[_0xa857('0x20')]();};}function saveUpdates(_0x396a34,_0x3c56ff){return function(_0x4dd8c9){if(_0x4dd8c9){return _0x4dd8c9[_0xa857('0x21')](_0x396a34)[_0xa857('0x22')](function(_0x391261){return _0x391261;});}return null;};}function removeEntity(_0x25b4db,_0x8f48a2){return function(_0x321f91){if(_0x321f91){return _0x321f91[_0xa857('0x23')]()[_0xa857('0x22')](function(){_0x25b4db[_0xa857('0x17')](0xcc)[_0xa857('0x24')]();});}};}function handleEntityNotFound(_0x220bb3,_0x352f2e){return function(_0x3474ec){if(!_0x3474ec){_0x220bb3[_0xa857('0x16')](0x194);}return _0x3474ec;};}function handleError(_0x3af545,_0x2c8bb2){_0x2c8bb2=_0x2c8bb2||0x1f4;return function(_0x5902df){logger[_0xa857('0x25')](_0x5902df[_0xa857('0x26')]);if(_0x5902df['name']){delete _0x5902df['name'];}_0x3af545[_0xa857('0x17')](_0x2c8bb2)[_0xa857('0x27')](_0x5902df);};}exports[_0xa857('0x28')]=function(_0x25ae2c,_0x1d2358){var _0x3a88cd={},_0x390c72={},_0x47f870={'count':0x0,'rows':[]};var _0x1c0153=_[_0xa857('0x29')](db[_0xa857('0x2a')][_0xa857('0x2b')],function(_0x2d0733){return{'name':_0x2d0733['fieldName'],'type':_0x2d0733['type'][_0xa857('0x2c')]};});_0x390c72[_0xa857('0x2d')]=_[_0xa857('0x29')](_0x1c0153,_0xa857('0x2e'));_0x390c72[_0xa857('0x2f')]=_[_0xa857('0x30')](_0x25ae2c['query']);_0x390c72[_0xa857('0x31')]=_[_0xa857('0x32')](_0x390c72[_0xa857('0x2d')],_0x390c72[_0xa857('0x2f')]);_0x3a88cd['attributes']=_[_0xa857('0x32')](_0x390c72[_0xa857('0x2d')],qs[_0xa857('0x33')](_0x25ae2c['query'][_0xa857('0x33')]));_0x3a88cd[_0xa857('0x34')]=_0x3a88cd[_0xa857('0x34')][_0xa857('0x35')]?_0x3a88cd[_0xa857('0x34')]:_0x390c72[_0xa857('0x2d')];if(!_0x25ae2c[_0xa857('0x2f')][_0xa857('0x36')]('nolimit')){_0x3a88cd[_0xa857('0x1a')]=qs['limit'](_0x25ae2c[_0xa857('0x2f')][_0xa857('0x1a')]);_0x3a88cd[_0xa857('0x1c')]=qs[_0xa857('0x1c')](_0x25ae2c[_0xa857('0x2f')][_0xa857('0x1c')]);}_0x3a88cd[_0xa857('0x37')]=qs[_0xa857('0x38')](_0x25ae2c[_0xa857('0x2f')][_0xa857('0x38')]);_0x3a88cd[_0xa857('0x39')]=qs[_0xa857('0x31')](_[_0xa857('0x3a')](_0x25ae2c[_0xa857('0x2f')],_0x390c72[_0xa857('0x31')]),_0x1c0153);if(_0x25ae2c[_0xa857('0x2f')][_0xa857('0x3b')]){_0x3a88cd[_0xa857('0x39')]=_[_0xa857('0x3c')](_0x3a88cd[_0xa857('0x39')],{'$or':_[_0xa857('0x29')](_0x1c0153,function(_0x47e17e){if(_0x47e17e['type']!==_0xa857('0x3d')){var _0x2ef976={};_0x2ef976[_0x47e17e[_0xa857('0x2e')]]={'$like':'%'+_0x25ae2c[_0xa857('0x2f')]['filter']+'%'};return _0x2ef976;}})});}_0x3a88cd=_[_0xa857('0x3c')]({},_0x3a88cd,_0x25ae2c[_0xa857('0x3e')]);var _0x2260ee={'where':_0x3a88cd[_0xa857('0x39')]};return db[_0xa857('0x2a')][_0xa857('0x1b')](_0x2260ee)[_0xa857('0x22')](function(_0x45f782){_0x47f870['count']=_0x45f782;if(_0x25ae2c[_0xa857('0x2f')][_0xa857('0x3f')]){_0x3a88cd[_0xa857('0x40')]=[{'all':!![]}];}return db[_0xa857('0x2a')]['findAll'](_0x3a88cd);})[_0xa857('0x22')](function(_0x3b048f){_0x47f870[_0xa857('0x41')]=_0x3b048f;return _0x47f870;})[_0xa857('0x22')](respondWithFilteredResult(_0x1d2358,_0x3a88cd))[_0xa857('0x42')](handleError(_0x1d2358,null));};exports[_0xa857('0x43')]=function(_0x45035a,_0x2e3a07){var _0x2dd988={'raw':![],'where':{'id':_0x45035a[_0xa857('0x44')]['id']}},_0x1fcb57={};_0x1fcb57['model']=_[_0xa857('0x30')](db[_0xa857('0x2a')][_0xa857('0x2b')]);_0x1fcb57[_0xa857('0x2f')]=_['keys'](_0x45035a['query']);_0x1fcb57[_0xa857('0x31')]=_[_0xa857('0x32')](_0x1fcb57[_0xa857('0x2d')],_0x1fcb57['query']);_0x2dd988[_0xa857('0x34')]=_['intersection'](_0x1fcb57['model'],qs[_0xa857('0x33')](_0x45035a[_0xa857('0x2f')][_0xa857('0x33')]));_0x2dd988[_0xa857('0x34')]=_0x2dd988[_0xa857('0x34')][_0xa857('0x35')]?_0x2dd988['attributes']:_0x1fcb57[_0xa857('0x2d')];if(_0x45035a['query'][_0xa857('0x3f')]){_0x2dd988[_0xa857('0x40')]=[{'all':!![]}];}_0x2dd988=_[_0xa857('0x3c')]({},_0x2dd988,_0x45035a['options']);return db['ZohoConfiguration'][_0xa857('0x45')](_0x2dd988)[_0xa857('0x22')](handleEntityNotFound(_0x2e3a07,null))['then'](respondWithResult(_0x2e3a07,null))[_0xa857('0x42')](handleError(_0x2e3a07,null));};exports['create']=function(_0x2b64d8,_0x986f93){return db['ZohoConfiguration'][_0xa857('0x46')](_0x2b64d8['body'],{})[_0xa857('0x22')](respondWithResult(_0x986f93,0xc9))[_0xa857('0x42')](handleError(_0x986f93,null));};exports[_0xa857('0x21')]=function(_0x2bdf24,_0x1ab22a){if(_0x2bdf24['body']['id']){delete _0x2bdf24[_0xa857('0x47')]['id'];}return db['ZohoConfiguration'][_0xa857('0x45')]({'where':{'id':_0x2bdf24[_0xa857('0x44')]['id']}})[_0xa857('0x22')](handleEntityNotFound(_0x1ab22a,null))[_0xa857('0x22')](saveUpdates(_0x2bdf24[_0xa857('0x47')],null))[_0xa857('0x22')](respondWithResult(_0x1ab22a,null))[_0xa857('0x42')](handleError(_0x1ab22a,null));};exports['destroy']=function(_0x33e667,_0x3bfe75){return db[_0xa857('0x2a')]['find']({'where':{'id':_0x33e667[_0xa857('0x44')]['id']}})[_0xa857('0x22')](handleEntityNotFound(_0x3bfe75,null))[_0xa857('0x22')](removeEntity(_0x3bfe75,null))['catch'](handleError(_0x3bfe75,null));};exports[_0xa857('0x48')]=function(_0x42ca7f,_0x48ff10,_0xb8a55d){var _0x1ac7a1={};var _0x53b8fc={};var _0x538ee8;var _0x67a0e5;return db[_0xa857('0x2a')]['findOne']({'where':{'id':_0x42ca7f[_0xa857('0x44')]['id']}})[_0xa857('0x22')](handleEntityNotFound(_0x48ff10,null))[_0xa857('0x22')](function(_0x1455fc){if(_0x1455fc){_0x538ee8=_0x1455fc;_0x53b8fc[_0xa857('0x2d')]=_[_0xa857('0x30')](db[_0xa857('0x49')]['rawAttributes']);_0x53b8fc[_0xa857('0x2f')]=_['keys'](_0x42ca7f['query']);_0x53b8fc[_0xa857('0x31')]=_[_0xa857('0x32')](_0x53b8fc[_0xa857('0x2d')],_0x53b8fc[_0xa857('0x2f')]);_0x1ac7a1[_0xa857('0x34')]=_[_0xa857('0x32')](_0x53b8fc[_0xa857('0x2d')],qs['fields'](_0x42ca7f[_0xa857('0x2f')][_0xa857('0x33')]));_0x1ac7a1[_0xa857('0x34')]=_0x1ac7a1['attributes'][_0xa857('0x35')]?_0x1ac7a1[_0xa857('0x34')]:_0x53b8fc[_0xa857('0x2d')];_0x1ac7a1[_0xa857('0x37')]=qs['sort'](_0x42ca7f[_0xa857('0x2f')][_0xa857('0x38')]);_0x1ac7a1[_0xa857('0x39')]=qs['filters'](_[_0xa857('0x3a')](_0x42ca7f['query'],_0x53b8fc[_0xa857('0x31')]));if(_0x42ca7f['query'][_0xa857('0x3b')]){_0x1ac7a1[_0xa857('0x39')]=_['merge'](_0x1ac7a1[_0xa857('0x39')],{'$or':_[_0xa857('0x29')](_0x1ac7a1[_0xa857('0x34')],function(_0x12921e){var _0x97e98b={};_0x97e98b[_0x12921e]={'$like':'%'+_0x42ca7f['query'][_0xa857('0x3b')]+'%'};return _0x97e98b;})});}_0x1ac7a1=_['merge']({},_0x1ac7a1,_0x42ca7f['options']);return _0x538ee8[_0xa857('0x48')](_0x1ac7a1);}})[_0xa857('0x22')](function(_0x506b85){if(_0x506b85){_0x67a0e5=_0x506b85[_0xa857('0x35')];if(!_0x42ca7f['query']['hasOwnProperty'](_0xa857('0x4a'))){_0x1ac7a1[_0xa857('0x1a')]=qs[_0xa857('0x1a')](_0x42ca7f['query'][_0xa857('0x1a')]);_0x1ac7a1[_0xa857('0x1c')]=qs[_0xa857('0x1c')](_0x42ca7f['query'][_0xa857('0x1c')]);}return _0x538ee8[_0xa857('0x48')](_0x1ac7a1);}})['then'](function(_0x290e20){if(_0x290e20){return _0x290e20?{'count':_0x67a0e5,'rows':_0x290e20}:null;}})['then'](respondWithResult(_0x48ff10,null))[_0xa857('0x42')](handleError(_0x48ff10,null));};exports[_0xa857('0x4b')]=function(_0x5d5dcb,_0x43353e,_0x3bfabc){var _0x60e7f6={};var _0x39fa3e={};var _0x5c517e;var _0x4da12b;return db[_0xa857('0x2a')][_0xa857('0x4c')]({'where':{'id':_0x5d5dcb[_0xa857('0x44')]['id']}})[_0xa857('0x22')](handleEntityNotFound(_0x43353e,null))['then'](function(_0xdd2d31){if(_0xdd2d31){_0x5c517e=_0xdd2d31;_0x39fa3e[_0xa857('0x2d')]=_[_0xa857('0x30')](db['ZohoField'][_0xa857('0x2b')]);_0x39fa3e['query']=_['keys'](_0x5d5dcb[_0xa857('0x2f')]);_0x39fa3e[_0xa857('0x31')]=_[_0xa857('0x32')](_0x39fa3e[_0xa857('0x2d')],_0x39fa3e[_0xa857('0x2f')]);_0x60e7f6[_0xa857('0x34')]=_[_0xa857('0x32')](_0x39fa3e[_0xa857('0x2d')],qs[_0xa857('0x33')](_0x5d5dcb['query']['fields']));_0x60e7f6[_0xa857('0x34')]=_0x60e7f6[_0xa857('0x34')][_0xa857('0x35')]?_0x60e7f6[_0xa857('0x34')]:_0x39fa3e['model'];_0x60e7f6['order']=qs[_0xa857('0x38')](_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x38')]);_0x60e7f6[_0xa857('0x39')]=qs[_0xa857('0x31')](_[_0xa857('0x3a')](_0x5d5dcb[_0xa857('0x2f')],_0x39fa3e[_0xa857('0x31')]));if(_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x3b')]){_0x60e7f6[_0xa857('0x39')]=_['merge'](_0x60e7f6[_0xa857('0x39')],{'$or':_[_0xa857('0x29')](_0x60e7f6['attributes'],function(_0x3f2cad){var _0x6dcc3c={};_0x6dcc3c[_0x3f2cad]={'$like':'%'+_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x3b')]+'%'};return _0x6dcc3c;})});}_0x60e7f6=_[_0xa857('0x3c')]({},_0x60e7f6,_0x5d5dcb[_0xa857('0x3e')]);return _0x5c517e[_0xa857('0x4b')](_0x60e7f6);}})[_0xa857('0x22')](function(_0x4e89b9){if(_0x4e89b9){_0x4da12b=_0x4e89b9['length'];if(!_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x36')]('nolimit')){_0x60e7f6['limit']=qs[_0xa857('0x1a')](_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x1a')]);_0x60e7f6['offset']=qs[_0xa857('0x1c')](_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x1c')]);}return _0x5c517e[_0xa857('0x4b')](_0x60e7f6);}})['then'](function(_0x3bafb5){if(_0x3bafb5){return _0x3bafb5?{'count':_0x4da12b,'rows':_0x3bafb5}:null;}})[_0xa857('0x22')](respondWithResult(_0x43353e,null))['catch'](handleError(_0x43353e,null));};exports['getDescriptions']=function(_0x14626e,_0x24d9a9,_0x55184c){var _0x34d297={};var _0xd0a071={};var _0x556619;var _0x49327f;return db[_0xa857('0x2a')][_0xa857('0x4c')]({'where':{'id':_0x14626e[_0xa857('0x44')]['id']}})['then'](handleEntityNotFound(_0x24d9a9,null))[_0xa857('0x22')](function(_0x377552){if(_0x377552){_0x556619=_0x377552;_0xd0a071[_0xa857('0x2d')]=_['keys'](db[_0xa857('0x49')][_0xa857('0x2b')]);_0xd0a071[_0xa857('0x2f')]=_[_0xa857('0x30')](_0x14626e[_0xa857('0x2f')]);_0xd0a071[_0xa857('0x31')]=_[_0xa857('0x32')](_0xd0a071['model'],_0xd0a071['query']);_0x34d297[_0xa857('0x34')]=_[_0xa857('0x32')](_0xd0a071[_0xa857('0x2d')],qs[_0xa857('0x33')](_0x14626e[_0xa857('0x2f')][_0xa857('0x33')]));_0x34d297[_0xa857('0x34')]=_0x34d297[_0xa857('0x34')]['length']?_0x34d297['attributes']:_0xd0a071[_0xa857('0x2d')];_0x34d297[_0xa857('0x37')]=qs[_0xa857('0x38')](_0x14626e['query'][_0xa857('0x38')]);_0x34d297[_0xa857('0x39')]=qs[_0xa857('0x31')](_[_0xa857('0x3a')](_0x14626e[_0xa857('0x2f')],_0xd0a071[_0xa857('0x31')]));if(_0x14626e[_0xa857('0x2f')][_0xa857('0x3b')]){_0x34d297[_0xa857('0x39')]=_['merge'](_0x34d297['where'],{'$or':_[_0xa857('0x29')](_0x34d297['attributes'],function(_0xf9b360){var _0x19e00c={};_0x19e00c[_0xf9b360]={'$like':'%'+_0x14626e[_0xa857('0x2f')]['filter']+'%'};return _0x19e00c;})});}_0x34d297=_[_0xa857('0x3c')]({},_0x34d297,_0x14626e[_0xa857('0x3e')]);return _0x556619[_0xa857('0x4d')](_0x34d297);}})[_0xa857('0x22')](function(_0x538aeb){if(_0x538aeb){_0x49327f=_0x538aeb[_0xa857('0x35')];if(!_0x14626e['query'][_0xa857('0x36')](_0xa857('0x4a'))){_0x34d297[_0xa857('0x1a')]=qs[_0xa857('0x1a')](_0x14626e[_0xa857('0x2f')][_0xa857('0x1a')]);_0x34d297[_0xa857('0x1c')]=qs[_0xa857('0x1c')](_0x14626e[_0xa857('0x2f')]['offset']);}return _0x556619[_0xa857('0x4d')](_0x34d297);}})['then'](function(_0x345582){if(_0x345582){return _0x345582?{'count':_0x49327f,'rows':_0x345582}:null;}})[_0xa857('0x22')](respondWithResult(_0x24d9a9,null))['catch'](handleError(_0x24d9a9,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index bb14762..3aaec77 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 _0x2156=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0x2156,0x107));var _0x6215=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2156[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x6215('0x0'));var logger=require(_0x6215('0x1'))(_0x6215('0x2'));var moment=require(_0x6215('0x3'));var BPromise=require('bluebird');var rp=require(_0x6215('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6215('0x5'));var config=require(_0x6215('0x6'));var attributes=require(_0x6215('0x7'));module[_0x6215('0x8')]=function(_0x36eeae,_0x43f0b5){return _0x36eeae[_0x6215('0x9')](_0x6215('0xa'),attributes,{'tableName':_0x6215('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0126=['bluebird','request-promise','path','rimraf','../../config/environment','ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment'];(function(_0x57f9b9,_0x53b5f9){var _0x17b065=function(_0x2fac09){while(--_0x2fac09){_0x57f9b9['push'](_0x57f9b9['shift']());}};_0x17b065(++_0x53b5f9);}(_0x0126,0xe3));var _0x6012=function(_0x141cf5,_0x4e8720){_0x141cf5=_0x141cf5-0x0;var _0x19ec69=_0x0126[_0x141cf5];return _0x19ec69;};'use strict';var _=require(_0x6012('0x0'));var util=require(_0x6012('0x1'));var logger=require('../../config/logger')(_0x6012('0x2'));var moment=require(_0x6012('0x3'));var BPromise=require(_0x6012('0x4'));var rp=require(_0x6012('0x5'));var fs=require('fs');var path=require(_0x6012('0x6'));var rimraf=require(_0x6012('0x7'));var config=require(_0x6012('0x8'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x3460df,_0x464b1f){return _0x3460df['define'](_0x6012('0x9'),attributes,{'tableName':_0x6012('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index e12e751..b799f23 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 _0x30b8=['then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x30b8,0xd1));var _0x830b=function(_0x2c4fe9,_0x4e5bb4){_0x2c4fe9=_0x2c4fe9-0x0;var _0x5c2eb3=_0x30b8[_0x2c4fe9];return _0x5c2eb3;};'use strict';var _=require(_0x830b('0x0'));var util=require(_0x830b('0x1'));var moment=require(_0x830b('0x2'));var BPromise=require(_0x830b('0x3'));var rs=require(_0x830b('0x4'));var fs=require('fs');var Redis=require(_0x830b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x830b('0x6'));var config=require(_0x830b('0x7'));var jayson=require(_0x830b('0x8'));var client=jayson[_0x830b('0x9')][_0x830b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31d4cf,_0x51305e,_0x2d406f){return new BPromise(function(_0x5ac8a0,_0x4feb32){return client['request'](_0x31d4cf,_0x2d406f)[_0x830b('0xb')](function(_0x6b6ada){logger['info'](_0x830b('0xc'),_0x51305e,_0x830b('0xd'));logger[_0x830b('0xe')](_0x830b('0xf'),_0x51305e,'request\x20sent',JSON[_0x830b('0x10')](_0x6b6ada));if(_0x6b6ada[_0x830b('0x11')]){if(_0x6b6ada[_0x830b('0x11')][_0x830b('0x12')]===0x1f4){logger[_0x830b('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x51305e,_0x6b6ada[_0x830b('0x11')]['message']);return _0x4feb32(_0x6b6ada[_0x830b('0x11')][_0x830b('0x13')]);}logger[_0x830b('0x11')](_0x830b('0xc'),_0x51305e,_0x6b6ada[_0x830b('0x11')][_0x830b('0x13')]);return _0x5ac8a0(_0x6b6ada[_0x830b('0x11')]['message']);}else{logger[_0x830b('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x51305e,_0x830b('0xd'));_0x5ac8a0(_0x6b6ada[_0x830b('0x15')][_0x830b('0x13')]);}})['catch'](function(_0x1a9867){logger[_0x830b('0x11')](_0x830b('0xc'),_0x51305e,_0x1a9867);_0x4feb32(_0x1a9867);});});} \ No newline at end of file +var _0xd9d1=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0xd9d1,0x132));var _0x1d9d=function(_0x4e9c15,_0x16bd10){_0x4e9c15=_0x4e9c15-0x0;var _0x1dfab8=_0xd9d1[_0x4e9c15];return _0x1dfab8;};'use strict';var _=require(_0x1d9d('0x0'));var util=require(_0x1d9d('0x1'));var moment=require(_0x1d9d('0x2'));var BPromise=require(_0x1d9d('0x3'));var rs=require(_0x1d9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d9d('0x5'))['db'];var utils=require(_0x1d9d('0x6'));var logger=require(_0x1d9d('0x7'))(_0x1d9d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1d9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33fc95,_0x54f508,_0x25b2af){return new BPromise(function(_0x4bdf76,_0x98ed74){return client['request'](_0x33fc95,_0x25b2af)[_0x1d9d('0xa')](function(_0x35034f){logger['info'](_0x1d9d('0xb'),_0x54f508,_0x1d9d('0xc'));logger[_0x1d9d('0xd')](_0x1d9d('0xe'),_0x54f508,_0x1d9d('0xc'),JSON['stringify'](_0x35034f));if(_0x35034f[_0x1d9d('0xf')]){if(_0x35034f[_0x1d9d('0xf')][_0x1d9d('0x10')]===0x1f4){logger[_0x1d9d('0xf')](_0x1d9d('0xb'),_0x54f508,_0x35034f[_0x1d9d('0xf')][_0x1d9d('0x11')]);return _0x98ed74(_0x35034f[_0x1d9d('0xf')][_0x1d9d('0x11')]);}logger['error'](_0x1d9d('0xb'),_0x54f508,_0x35034f['error'][_0x1d9d('0x11')]);return _0x4bdf76(_0x35034f[_0x1d9d('0xf')][_0x1d9d('0x11')]);}else{logger['info'](_0x1d9d('0xb'),_0x54f508,_0x1d9d('0xc'));_0x4bdf76(_0x35034f[_0x1d9d('0x12')]['message']);}})[_0x1d9d('0x13')](function(_0x233065){logger['error'](_0x1d9d('0xb'),_0x54f508,_0x233065);_0x98ed74(_0x233065);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e719be9..e8c9704 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 _0xdb19=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d94b7,_0x5988e5){var _0x40a258=function(_0x3da766){while(--_0x3da766){_0x1d94b7['push'](_0x1d94b7['shift']());}};_0x40a258(++_0x5988e5);}(_0xdb19,0x1d4));var _0x9db1=function(_0x1c7cee,_0x36ea41){_0x1c7cee=_0x1c7cee-0x0;var _0x265506=_0xdb19[_0x1c7cee];return _0x265506;};'use strict';var multer=require(_0x9db1('0x0'));var util=require(_0x9db1('0x1'));var path=require(_0x9db1('0x2'));var timeout=require('connect-timeout');var express=require(_0x9db1('0x3'));var router=express[_0x9db1('0x4')]();var fs_extra=require(_0x9db1('0x5'));var auth=require(_0x9db1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9db1('0x7'));var controller=require(_0x9db1('0x8'));router[_0x9db1('0x9')]('/',auth[_0x9db1('0xa')](),controller[_0x9db1('0xb')]);router[_0x9db1('0x9')]('/:id',auth[_0x9db1('0xa')](),controller[_0x9db1('0xc')]);router[_0x9db1('0xd')]('/',auth['isAuthenticated'](),controller[_0x9db1('0xe')]);router['put'](_0x9db1('0xf'),auth[_0x9db1('0xa')](),controller['update']);router[_0x9db1('0x10')]('/:id',auth[_0x9db1('0xa')](),controller[_0x9db1('0x11')]);module[_0x9db1('0x12')]=router; \ No newline at end of file +var _0x8eb6=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x2843f1,_0x433cd8){var _0x3efff0=function(_0x25419c){while(--_0x25419c){_0x2843f1['push'](_0x2843f1['shift']());}};_0x3efff0(++_0x433cd8);}(_0x8eb6,0x192));var _0x68eb=function(_0x577f6e,_0x27cbfa){_0x577f6e=_0x577f6e-0x0;var _0x154b20=_0x8eb6[_0x577f6e];return _0x154b20;};'use strict';var multer=require(_0x68eb('0x0'));var util=require(_0x68eb('0x1'));var path=require(_0x68eb('0x2'));var timeout=require('connect-timeout');var express=require(_0x68eb('0x3'));var router=express[_0x68eb('0x4')]();var fs_extra=require(_0x68eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x68eb('0x6'));var config=require(_0x68eb('0x7'));var controller=require(_0x68eb('0x8'));router['get']('/',auth[_0x68eb('0x9')](),controller[_0x68eb('0xa')]);router['get'](_0x68eb('0xb'),auth[_0x68eb('0x9')](),controller[_0x68eb('0xc')]);router[_0x68eb('0xd')]('/',auth[_0x68eb('0x9')](),controller[_0x68eb('0xe')]);router[_0x68eb('0xf')](_0x68eb('0xb'),auth[_0x68eb('0x9')](),controller[_0x68eb('0x10')]);router[_0x68eb('0x11')]('/:id',auth[_0x68eb('0x9')](),controller[_0x68eb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b129ab7..150f1a8 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 _0x0044=['string','variable','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x321811,_0x4d2670){var _0x4cbd5d=function(_0x1efcf3){while(--_0x1efcf3){_0x321811['push'](_0x321811['shift']());}};_0x4cbd5d(++_0x4d2670);}(_0x0044,0x17f));var _0x4004=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x0044[_0x2abc3d];return _0x252745;};'use strict';var Sequelize=require(_0x4004('0x0'));module['exports']={'type':{'type':Sequelize[_0x4004('0x1')](_0x4004('0x2'),_0x4004('0x3'),_0x4004('0x4'),_0x4004('0x5'),'picklist'),'defaultValue':_0x4004('0x2')},'content':{'type':Sequelize[_0x4004('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4004('0x1')](_0x4004('0x2'),_0x4004('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4004('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4004('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4004('0x6')]}}; \ No newline at end of file +var _0xd48c=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x6fffaf,_0x35d1de){var _0x46f344=function(_0x313cec){while(--_0x313cec){_0x6fffaf['push'](_0x6fffaf['shift']());}};_0x46f344(++_0x35d1de);}(_0xd48c,0x14d));var _0xcd48=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0xd48c[_0x424501];return _0xb719af;};'use strict';var Sequelize=require(_0xcd48('0x0'));module[_0xcd48('0x1')]={'type':{'type':Sequelize['ENUM'](_0xcd48('0x2'),_0xcd48('0x3'),_0xcd48('0x4'),_0xcd48('0x5'),_0xcd48('0x6')),'defaultValue':_0xcd48('0x2')},'content':{'type':Sequelize[_0xcd48('0x7')]},'key':{'type':Sequelize[_0xcd48('0x7')]},'keyType':{'type':Sequelize[_0xcd48('0x8')](_0xcd48('0x2'),_0xcd48('0x3'),_0xcd48('0x4'))},'keyContent':{'type':Sequelize[_0xcd48('0x7')]},'idField':{'type':Sequelize[_0xcd48('0x7')]},'nameField':{'type':Sequelize[_0xcd48('0x7')]},'customField':{'type':Sequelize[_0xcd48('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcd48('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 20b0a9d..2c4f1fa 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 _0xb2ea=['fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','length','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../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','save','update','destroy','then','error','stack','name','send','index','map','ZohoField','rawAttributes'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0xb2ea,0x1eb));var _0xab2e=function(_0x4b2037,_0x41055c){_0x4b2037=_0x4b2037-0x0;var _0x48599b=_0xb2ea[_0x4b2037];return _0x48599b;};'use strict';var emlformat=require(_0xab2e('0x0'));var rimraf=require(_0xab2e('0x1'));var zipdir=require(_0xab2e('0x2'));var jsonpatch=require(_0xab2e('0x3'));var rp=require(_0xab2e('0x4'));var moment=require('moment');var BPromise=require(_0xab2e('0x5'));var Mustache=require(_0xab2e('0x6'));var util=require(_0xab2e('0x7'));var path=require(_0xab2e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab2e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab2e('0xa'));var squel=require('squel');var crypto=require(_0xab2e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xab2e('0xc'));var toCsv=require(_0xab2e('0xd'));var querystring=require(_0xab2e('0xe'));var Papa=require(_0xab2e('0xf'));var Redis=require(_0xab2e('0x10'));var authService=require(_0xab2e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xab2e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab2e('0x13'));var utils=require(_0xab2e('0x14'));var config=require(_0xab2e('0x15'));var licenseUtil=require(_0xab2e('0x16'));var db=require(_0xab2e('0x17'))['db'];function respondWithStatusCode(_0x301823,_0x47e3db){_0x47e3db=_0x47e3db||0xcc;return function(_0x208ccc){if(_0x208ccc){return _0x301823[_0xab2e('0x18')](_0x47e3db);}return _0x301823[_0xab2e('0x19')](_0x47e3db)[_0xab2e('0x1a')]();};}function respondWithResult(_0x9201f2,_0x119f0a){_0x119f0a=_0x119f0a||0xc8;return function(_0xa42166){if(_0xa42166){return _0x9201f2[_0xab2e('0x19')](_0x119f0a)[_0xab2e('0x1b')](_0xa42166);}};}function respondWithFilteredResult(_0x43e7d6,_0x56c9f5){return function(_0x293deb){if(_0x293deb){var _0x2f3ada=typeof _0x56c9f5[_0xab2e('0x1c')]===_0xab2e('0x1d')&&typeof _0x56c9f5[_0xab2e('0x1e')]==='undefined';var _0x228dfc=_0x293deb[_0xab2e('0x1f')];var _0x3ad89f=_0x2f3ada?0x0:_0x56c9f5['offset'];var _0x5a4854=_0x2f3ada?_0x293deb[_0xab2e('0x1f')]:_0x56c9f5[_0xab2e('0x1c')]+_0x56c9f5[_0xab2e('0x1e')];var _0x290526;if(_0x5a4854>=_0x228dfc){_0x5a4854=_0x228dfc;_0x290526=0xc8;}else{_0x290526=0xce;}_0x43e7d6['status'](_0x290526);return _0x43e7d6[_0xab2e('0x20')](_0xab2e('0x21'),_0x3ad89f+'-'+_0x5a4854+'/'+_0x228dfc)[_0xab2e('0x1b')](_0x293deb);}return null;};}function patchUpdates(_0x5b380d){return function(_0x53fa27){try{jsonpatch[_0xab2e('0x22')](_0x53fa27,_0x5b380d,!![]);}catch(_0x2f5072){return BPromise[_0xab2e('0x23')](_0x2f5072);}return _0x53fa27[_0xab2e('0x24')]();};}function saveUpdates(_0x44da43,_0x359cde){return function(_0x51a203){if(_0x51a203){return _0x51a203[_0xab2e('0x25')](_0x44da43)['then'](function(_0x21aef8){return _0x21aef8;});}return null;};}function removeEntity(_0x346927,_0xcb30b0){return function(_0x4b45e8){if(_0x4b45e8){return _0x4b45e8[_0xab2e('0x26')]()[_0xab2e('0x27')](function(){_0x346927[_0xab2e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b3cf0,_0x2e2802){return function(_0x476e1f){if(!_0x476e1f){_0x3b3cf0[_0xab2e('0x18')](0x194);}return _0x476e1f;};}function handleError(_0x11effb,_0x131a18){_0x131a18=_0x131a18||0x1f4;return function(_0x335ddb){logger[_0xab2e('0x28')](_0x335ddb[_0xab2e('0x29')]);if(_0x335ddb[_0xab2e('0x2a')]){delete _0x335ddb[_0xab2e('0x2a')];}_0x11effb[_0xab2e('0x19')](_0x131a18)[_0xab2e('0x2b')](_0x335ddb);};}exports[_0xab2e('0x2c')]=function(_0x4ed55a,_0x45d50e){var _0x25ddb4={},_0x2fd0b6={},_0x27fa11={'count':0x0,'rows':[]};var _0x521c2e=_[_0xab2e('0x2d')](db[_0xab2e('0x2e')][_0xab2e('0x2f')],function(_0x3ad099){return{'name':_0x3ad099[_0xab2e('0x30')],'type':_0x3ad099[_0xab2e('0x31')][_0xab2e('0x32')]};});_0x2fd0b6['model']=_['map'](_0x521c2e,_0xab2e('0x2a'));_0x2fd0b6[_0xab2e('0x33')]=_[_0xab2e('0x34')](_0x4ed55a['query']);_0x2fd0b6[_0xab2e('0x35')]=_[_0xab2e('0x36')](_0x2fd0b6[_0xab2e('0x37')],_0x2fd0b6['query']);_0x25ddb4[_0xab2e('0x38')]=_[_0xab2e('0x36')](_0x2fd0b6['model'],qs['fields'](_0x4ed55a['query'][_0xab2e('0x39')]));_0x25ddb4[_0xab2e('0x38')]=_0x25ddb4[_0xab2e('0x38')]['length']?_0x25ddb4[_0xab2e('0x38')]:_0x2fd0b6['model'];if(!_0x4ed55a['query'][_0xab2e('0x3a')](_0xab2e('0x3b'))){_0x25ddb4[_0xab2e('0x1e')]=qs[_0xab2e('0x1e')](_0x4ed55a[_0xab2e('0x33')][_0xab2e('0x1e')]);_0x25ddb4['offset']=qs[_0xab2e('0x1c')](_0x4ed55a['query']['offset']);}_0x25ddb4[_0xab2e('0x3c')]=qs[_0xab2e('0x3d')](_0x4ed55a[_0xab2e('0x33')]['sort']);_0x25ddb4[_0xab2e('0x3e')]=qs[_0xab2e('0x35')](_[_0xab2e('0x3f')](_0x4ed55a[_0xab2e('0x33')],_0x2fd0b6['filters']),_0x521c2e);if(_0x4ed55a[_0xab2e('0x33')][_0xab2e('0x40')]){_0x25ddb4[_0xab2e('0x3e')]=_[_0xab2e('0x41')](_0x25ddb4['where'],{'$or':_[_0xab2e('0x2d')](_0x521c2e,function(_0x2890ba){if(_0x2890ba['type']!=='VIRTUAL'){var _0x15fdf9={};_0x15fdf9[_0x2890ba[_0xab2e('0x2a')]]={'$like':'%'+_0x4ed55a['query'][_0xab2e('0x40')]+'%'};return _0x15fdf9;}})});}_0x25ddb4=_['merge']({},_0x25ddb4,_0x4ed55a[_0xab2e('0x42')]);var _0x3e1a91={'where':_0x25ddb4[_0xab2e('0x3e')]};return db[_0xab2e('0x2e')][_0xab2e('0x1f')](_0x3e1a91)[_0xab2e('0x27')](function(_0x31b581){_0x27fa11[_0xab2e('0x1f')]=_0x31b581;if(_0x4ed55a[_0xab2e('0x33')][_0xab2e('0x43')]){_0x25ddb4[_0xab2e('0x44')]=[{'all':!![]}];}return db[_0xab2e('0x2e')][_0xab2e('0x45')](_0x25ddb4);})[_0xab2e('0x27')](function(_0x1e9a20){_0x27fa11[_0xab2e('0x46')]=_0x1e9a20;return _0x27fa11;})['then'](respondWithFilteredResult(_0x45d50e,_0x25ddb4))[_0xab2e('0x47')](handleError(_0x45d50e,null));};exports['show']=function(_0x1714a9,_0x5a2959){var _0x54e156={'raw':!![],'where':{'id':_0x1714a9['params']['id']}},_0x246826={};_0x246826[_0xab2e('0x37')]=_[_0xab2e('0x34')](db[_0xab2e('0x2e')][_0xab2e('0x2f')]);_0x246826[_0xab2e('0x33')]=_[_0xab2e('0x34')](_0x1714a9[_0xab2e('0x33')]);_0x246826[_0xab2e('0x35')]=_[_0xab2e('0x36')](_0x246826[_0xab2e('0x37')],_0x246826[_0xab2e('0x33')]);_0x54e156[_0xab2e('0x38')]=_[_0xab2e('0x36')](_0x246826[_0xab2e('0x37')],qs[_0xab2e('0x39')](_0x1714a9[_0xab2e('0x33')]['fields']));_0x54e156[_0xab2e('0x38')]=_0x54e156[_0xab2e('0x38')][_0xab2e('0x48')]?_0x54e156[_0xab2e('0x38')]:_0x246826['model'];if(_0x1714a9['query']['includeAll']){_0x54e156[_0xab2e('0x44')]=[{'all':!![]}];}_0x54e156=_[_0xab2e('0x41')]({},_0x54e156,_0x1714a9['options']);return db[_0xab2e('0x2e')]['find'](_0x54e156)[_0xab2e('0x27')](handleEntityNotFound(_0x5a2959,null))[_0xab2e('0x27')](respondWithResult(_0x5a2959,null))['catch'](handleError(_0x5a2959,null));};exports[_0xab2e('0x49')]=function(_0x40bca7,_0x3f630c){return db[_0xab2e('0x2e')]['create'](_0x40bca7[_0xab2e('0x4a')],{})[_0xab2e('0x27')](respondWithResult(_0x3f630c,0xc9))[_0xab2e('0x47')](handleError(_0x3f630c,null));};exports[_0xab2e('0x25')]=function(_0x46c15b,_0x152988){if(_0x46c15b[_0xab2e('0x4a')]['id']){delete _0x46c15b[_0xab2e('0x4a')]['id'];}return db[_0xab2e('0x2e')][_0xab2e('0x4b')]({'where':{'id':_0x46c15b['params']['id']}})[_0xab2e('0x27')](handleEntityNotFound(_0x152988,null))[_0xab2e('0x27')](saveUpdates(_0x46c15b[_0xab2e('0x4a')],null))[_0xab2e('0x27')](respondWithResult(_0x152988,null))[_0xab2e('0x47')](handleError(_0x152988,null));};exports['destroy']=function(_0x2954e6,_0x5bc3c0){return db[_0xab2e('0x2e')][_0xab2e('0x4b')]({'where':{'id':_0x2954e6[_0xab2e('0x4c')]['id']}})[_0xab2e('0x27')](handleEntityNotFound(_0x5bc3c0,null))[_0xab2e('0x27')](removeEntity(_0x5bc3c0,null))['catch'](handleError(_0x5bc3c0,null));}; \ No newline at end of file +var _0xe288=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','set','Content-Range','apply','save','update','then','error','stack','name','index','ZohoField','rawAttributes'];(function(_0x46be78,_0x5a4ee7){var _0x105199=function(_0x37e2b0){while(--_0x37e2b0){_0x46be78['push'](_0x46be78['shift']());}};_0x105199(++_0x5a4ee7);}(_0xe288,0xbc));var _0x8e28=function(_0x51ffc3,_0x5f03b2){_0x51ffc3=_0x51ffc3-0x0;var _0x14da54=_0xe288[_0x51ffc3];return _0x14da54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e28('0x0'));var zipdir=require(_0x8e28('0x1'));var jsonpatch=require(_0x8e28('0x2'));var rp=require(_0x8e28('0x3'));var moment=require('moment');var BPromise=require(_0x8e28('0x4'));var Mustache=require(_0x8e28('0x5'));var util=require(_0x8e28('0x6'));var path=require(_0x8e28('0x7'));var sox=require(_0x8e28('0x8'));var csv=require(_0x8e28('0x9'));var ejs=require(_0x8e28('0xa'));var fs=require('fs');var fs_extra=require(_0x8e28('0xb'));var _=require(_0x8e28('0xc'));var squel=require(_0x8e28('0xd'));var crypto=require(_0x8e28('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8e28('0xf'));var toCsv=require(_0x8e28('0x9'));var querystring=require(_0x8e28('0x10'));var Papa=require(_0x8e28('0x11'));var Redis=require(_0x8e28('0x12'));var authService=require(_0x8e28('0x13'));var qs=require(_0x8e28('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e28('0x15'));var logger=require(_0x8e28('0x16'))(_0x8e28('0x17'));var utils=require(_0x8e28('0x18'));var config=require(_0x8e28('0x19'));var licenseUtil=require(_0x8e28('0x1a'));var db=require(_0x8e28('0x1b'))['db'];function respondWithStatusCode(_0x1d75d6,_0x5d0d91){_0x5d0d91=_0x5d0d91||0xcc;return function(_0x173161){if(_0x173161){return _0x1d75d6['sendStatus'](_0x5d0d91);}return _0x1d75d6['status'](_0x5d0d91)[_0x8e28('0x1c')]();};}function respondWithResult(_0x335cbc,_0x32fedb){_0x32fedb=_0x32fedb||0xc8;return function(_0x50905d){if(_0x50905d){return _0x335cbc[_0x8e28('0x1d')](_0x32fedb)[_0x8e28('0x1e')](_0x50905d);}};}function respondWithFilteredResult(_0x4bb5d7,_0x438a20){return function(_0x3fb57a){if(_0x3fb57a){var _0xcba67e=typeof _0x438a20[_0x8e28('0x1f')]==='undefined'&&typeof _0x438a20[_0x8e28('0x20')]===_0x8e28('0x21');var _0x1a3218=_0x3fb57a['count'];var _0x27b278=_0xcba67e?0x0:_0x438a20['offset'];var _0x562797=_0xcba67e?_0x3fb57a['count']:_0x438a20[_0x8e28('0x1f')]+_0x438a20[_0x8e28('0x20')];var _0x1fce61;if(_0x562797>=_0x1a3218){_0x562797=_0x1a3218;_0x1fce61=0xc8;}else{_0x1fce61=0xce;}_0x4bb5d7['status'](_0x1fce61);return _0x4bb5d7[_0x8e28('0x22')](_0x8e28('0x23'),_0x27b278+'-'+_0x562797+'/'+_0x1a3218)[_0x8e28('0x1e')](_0x3fb57a);}return null;};}function patchUpdates(_0x7e0b0b){return function(_0x6f9270){try{jsonpatch[_0x8e28('0x24')](_0x6f9270,_0x7e0b0b,!![]);}catch(_0x2abee7){return BPromise['reject'](_0x2abee7);}return _0x6f9270[_0x8e28('0x25')]();};}function saveUpdates(_0x270011,_0xc4ef24){return function(_0x355e89){if(_0x355e89){return _0x355e89[_0x8e28('0x26')](_0x270011)[_0x8e28('0x27')](function(_0x133be9){return _0x133be9;});}return null;};}function removeEntity(_0x22bedc,_0x4f44ed){return function(_0x3f61fe){if(_0x3f61fe){return _0x3f61fe['destroy']()[_0x8e28('0x27')](function(){_0x22bedc[_0x8e28('0x1d')](0xcc)[_0x8e28('0x1c')]();});}};}function handleEntityNotFound(_0x363ca8,_0x3d1c8d){return function(_0x231d2a){if(!_0x231d2a){_0x363ca8['sendStatus'](0x194);}return _0x231d2a;};}function handleError(_0x18931e,_0x2953c3){_0x2953c3=_0x2953c3||0x1f4;return function(_0x428639){logger[_0x8e28('0x28')](_0x428639[_0x8e28('0x29')]);if(_0x428639[_0x8e28('0x2a')]){delete _0x428639[_0x8e28('0x2a')];}_0x18931e[_0x8e28('0x1d')](_0x2953c3)['send'](_0x428639);};}exports[_0x8e28('0x2b')]=function(_0xf9dfdd,_0x1a21a5){var _0x410699={},_0x3056d9={},_0x586912={'count':0x0,'rows':[]};var _0x36c562=_['map'](db[_0x8e28('0x2c')][_0x8e28('0x2d')],function(_0x89fbbd){return{'name':_0x89fbbd[_0x8e28('0x2e')],'type':_0x89fbbd['type'][_0x8e28('0x2f')]};});_0x3056d9[_0x8e28('0x30')]=_['map'](_0x36c562,_0x8e28('0x2a'));_0x3056d9[_0x8e28('0x31')]=_[_0x8e28('0x32')](_0xf9dfdd[_0x8e28('0x31')]);_0x3056d9[_0x8e28('0x33')]=_[_0x8e28('0x34')](_0x3056d9[_0x8e28('0x30')],_0x3056d9[_0x8e28('0x31')]);_0x410699[_0x8e28('0x35')]=_[_0x8e28('0x34')](_0x3056d9[_0x8e28('0x30')],qs['fields'](_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x36')]));_0x410699['attributes']=_0x410699[_0x8e28('0x35')][_0x8e28('0x37')]?_0x410699[_0x8e28('0x35')]:_0x3056d9[_0x8e28('0x30')];if(!_0xf9dfdd[_0x8e28('0x31')]['hasOwnProperty'](_0x8e28('0x38'))){_0x410699[_0x8e28('0x20')]=qs['limit'](_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x20')]);_0x410699[_0x8e28('0x1f')]=qs[_0x8e28('0x1f')](_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x1f')]);}_0x410699[_0x8e28('0x39')]=qs[_0x8e28('0x3a')](_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x3a')]);_0x410699[_0x8e28('0x3b')]=qs['filters'](_[_0x8e28('0x3c')](_0xf9dfdd[_0x8e28('0x31')],_0x3056d9[_0x8e28('0x33')]),_0x36c562);if(_0xf9dfdd['query'][_0x8e28('0x3d')]){_0x410699[_0x8e28('0x3b')]=_[_0x8e28('0x3e')](_0x410699[_0x8e28('0x3b')],{'$or':_[_0x8e28('0x3f')](_0x36c562,function(_0x428dd4){if(_0x428dd4[_0x8e28('0x40')]!==_0x8e28('0x41')){var _0x5f5091={};_0x5f5091[_0x428dd4[_0x8e28('0x2a')]]={'$like':'%'+_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x3d')]+'%'};return _0x5f5091;}})});}_0x410699=_[_0x8e28('0x3e')]({},_0x410699,_0xf9dfdd[_0x8e28('0x42')]);var _0xe190c5={'where':_0x410699[_0x8e28('0x3b')]};return db[_0x8e28('0x2c')]['count'](_0xe190c5)[_0x8e28('0x27')](function(_0x4e824b){_0x586912[_0x8e28('0x43')]=_0x4e824b;if(_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x44')]){_0x410699[_0x8e28('0x45')]=[{'all':!![]}];}return db[_0x8e28('0x2c')][_0x8e28('0x46')](_0x410699);})['then'](function(_0x74937e){_0x586912[_0x8e28('0x47')]=_0x74937e;return _0x586912;})[_0x8e28('0x27')](respondWithFilteredResult(_0x1a21a5,_0x410699))[_0x8e28('0x48')](handleError(_0x1a21a5,null));};exports['show']=function(_0x2ce39e,_0x1a2c79){var _0x45229c={'raw':!![],'where':{'id':_0x2ce39e['params']['id']}},_0x5b38c1={};_0x5b38c1['model']=_[_0x8e28('0x32')](db['ZohoField']['rawAttributes']);_0x5b38c1[_0x8e28('0x31')]=_[_0x8e28('0x32')](_0x2ce39e[_0x8e28('0x31')]);_0x5b38c1[_0x8e28('0x33')]=_[_0x8e28('0x34')](_0x5b38c1[_0x8e28('0x30')],_0x5b38c1[_0x8e28('0x31')]);_0x45229c[_0x8e28('0x35')]=_[_0x8e28('0x34')](_0x5b38c1[_0x8e28('0x30')],qs[_0x8e28('0x36')](_0x2ce39e[_0x8e28('0x31')][_0x8e28('0x36')]));_0x45229c[_0x8e28('0x35')]=_0x45229c[_0x8e28('0x35')][_0x8e28('0x37')]?_0x45229c['attributes']:_0x5b38c1[_0x8e28('0x30')];if(_0x2ce39e[_0x8e28('0x31')][_0x8e28('0x44')]){_0x45229c['include']=[{'all':!![]}];}_0x45229c=_[_0x8e28('0x3e')]({},_0x45229c,_0x2ce39e[_0x8e28('0x42')]);return db[_0x8e28('0x2c')][_0x8e28('0x49')](_0x45229c)[_0x8e28('0x27')](handleEntityNotFound(_0x1a2c79,null))[_0x8e28('0x27')](respondWithResult(_0x1a2c79,null))[_0x8e28('0x48')](handleError(_0x1a2c79,null));};exports['create']=function(_0x2fb6bb,_0x555001){return db[_0x8e28('0x2c')][_0x8e28('0x4a')](_0x2fb6bb[_0x8e28('0x4b')],{})[_0x8e28('0x27')](respondWithResult(_0x555001,0xc9))[_0x8e28('0x48')](handleError(_0x555001,null));};exports[_0x8e28('0x26')]=function(_0xc2b8c3,_0x5da858){if(_0xc2b8c3[_0x8e28('0x4b')]['id']){delete _0xc2b8c3['body']['id'];}return db['ZohoField'][_0x8e28('0x49')]({'where':{'id':_0xc2b8c3[_0x8e28('0x4c')]['id']}})[_0x8e28('0x27')](handleEntityNotFound(_0x5da858,null))['then'](saveUpdates(_0xc2b8c3['body'],null))[_0x8e28('0x27')](respondWithResult(_0x5da858,null))[_0x8e28('0x48')](handleError(_0x5da858,null));};exports[_0x8e28('0x4d')]=function(_0x4bd2f2,_0xcfe5e6){return db[_0x8e28('0x2c')][_0x8e28('0x49')]({'where':{'id':_0x4bd2f2[_0x8e28('0x4c')]['id']}})[_0x8e28('0x27')](handleEntityNotFound(_0xcfe5e6,null))[_0x8e28('0x27')](removeEntity(_0xcfe5e6,null))['catch'](handleError(_0xcfe5e6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 831c1da..7403d0a 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 _0xd046=['util','../../config/logger','api','bluebird','rimraf','./intZohoField.attributes','define','zoho_unique_index','idField'];(function(_0x268f1f,_0x24f2cd){var _0x5c45c0=function(_0x3e2612){while(--_0x3e2612){_0x268f1f['push'](_0x268f1f['shift']());}};_0x5c45c0(++_0x24f2cd);}(_0xd046,0x129));var _0x6d04=function(_0x491606,_0x2c53be){_0x491606=_0x491606-0x0;var _0x593183=_0xd046[_0x491606];return _0x593183;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));module['exports']=function(_0x4bacb1,_0xf3b4e7){return _0x4bacb1[_0x6d04('0x6')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x6d04('0x7'),'fields':[_0x6d04('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_0x21f4f5,_0xd74958){var _0x11c320=function(_0x5a85f6){while(--_0x5a85f6){_0x21f4f5['push'](_0x21f4f5['shift']());}};_0x11c320(++_0xd74958);}(_0x90b1,0x1bb));var _0x190b=function(_0x43d457,_0x1ab41a){_0x43d457=_0x43d457-0x0;var _0x5e24d5=_0x90b1[_0x43d457];return _0x5e24d5;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xb'),_0x190b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 760a92f..84c7558 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 _0x8c21=['../../config/logger','rpc','jayson/promise','client','http','request','info','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoField,\x20%s,\x20%s','request\x20sent','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x8c21,0x12e));var _0x18c2=function(_0xad37e0,_0x4771c7){_0xad37e0=_0xad37e0-0x0;var _0xeeee86=_0x8c21[_0xad37e0];return _0xeeee86;};'use strict';var _=require('lodash');var util=require(_0x18c2('0x0'));var moment=require(_0x18c2('0x1'));var BPromise=require('bluebird');var rs=require(_0x18c2('0x2'));var fs=require('fs');var Redis=require(_0x18c2('0x3'));var db=require(_0x18c2('0x4'))['db'];var utils=require(_0x18c2('0x5'));var logger=require(_0x18c2('0x6'))(_0x18c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x18c2('0x8'));var client=jayson[_0x18c2('0x9')][_0x18c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4df1e3,_0xbe2e54,_0x175e42){return new BPromise(function(_0x474a40,_0x26ffae){return client[_0x18c2('0xb')](_0x4df1e3,_0x175e42)['then'](function(_0x5911b5){logger[_0x18c2('0xc')]('ZohoField,\x20%s,\x20%s',_0xbe2e54,'request\x20sent');logger[_0x18c2('0xd')](_0x18c2('0xe'),_0xbe2e54,'request\x20sent',JSON[_0x18c2('0xf')](_0x5911b5));if(_0x5911b5[_0x18c2('0x10')]){if(_0x5911b5[_0x18c2('0x10')][_0x18c2('0x11')]===0x1f4){logger[_0x18c2('0x10')]('ZohoField,\x20%s,\x20%s',_0xbe2e54,_0x5911b5[_0x18c2('0x10')][_0x18c2('0x12')]);return _0x26ffae(_0x5911b5[_0x18c2('0x10')]['message']);}logger[_0x18c2('0x10')](_0x18c2('0x13'),_0xbe2e54,_0x5911b5[_0x18c2('0x10')]['message']);return _0x474a40(_0x5911b5[_0x18c2('0x10')][_0x18c2('0x12')]);}else{logger[_0x18c2('0xc')](_0x18c2('0x13'),_0xbe2e54,_0x18c2('0x14'));_0x474a40(_0x5911b5[_0x18c2('0x15')][_0x18c2('0x12')]);}})['catch'](function(_0x572e41){logger[_0x18c2('0x10')](_0x18c2('0x13'),_0xbe2e54,_0x572e41);_0x26ffae(_0x572e41);});});} \ No newline at end of file +var _0x791d=['lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x98f6c3,_0x28639f){var _0x29238c=function(_0x585647){while(--_0x585647){_0x98f6c3['push'](_0x98f6c3['shift']());}};_0x29238c(++_0x28639f);}(_0x791d,0x1ee));var _0xd791=function(_0x5ed95e,_0x59ee6a){_0x5ed95e=_0x5ed95e-0x0;var _0x5d82be=_0x791d[_0x5ed95e];return _0x5d82be;};'use strict';var _=require(_0xd791('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd791('0x1'));var rs=require(_0xd791('0x2'));var fs=require('fs');var Redis=require(_0xd791('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd791('0x4'));var logger=require(_0xd791('0x5'))(_0xd791('0x6'));var config=require(_0xd791('0x7'));var jayson=require(_0xd791('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d16fc,_0x2122af,_0x2acbf9){return new BPromise(function(_0xbce1d,_0x1c1821){return client[_0xd791('0x9')](_0x1d16fc,_0x2acbf9)[_0xd791('0xa')](function(_0xf2daaa){logger[_0xd791('0xb')](_0xd791('0xc'),_0x2122af,_0xd791('0xd'));logger['debug'](_0xd791('0xe'),_0x2122af,_0xd791('0xd'),JSON['stringify'](_0xf2daaa));if(_0xf2daaa[_0xd791('0xf')]){if(_0xf2daaa[_0xd791('0xf')][_0xd791('0x10')]===0x1f4){logger['error'](_0xd791('0xc'),_0x2122af,_0xf2daaa['error']['message']);return _0x1c1821(_0xf2daaa[_0xd791('0xf')][_0xd791('0x11')]);}logger[_0xd791('0xf')]('ZohoField,\x20%s,\x20%s',_0x2122af,_0xf2daaa[_0xd791('0xf')][_0xd791('0x11')]);return _0xbce1d(_0xf2daaa[_0xd791('0xf')]['message']);}else{logger['info'](_0xd791('0xc'),_0x2122af,'request\x20sent');_0xbce1d(_0xf2daaa[_0xd791('0x12')]['message']);}})['catch'](function(_0x3116f6){logger[_0xd791('0xf')](_0xd791('0xc'),_0x2122af,_0x3116f6);_0x1c1821(_0x3116f6);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index cf029c5..fce8315 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x127c65,_0xff1c9){var _0x2b09b9=function(_0x24ef65){while(--_0x24ef65){_0x127c65['push'](_0x127c65['shift']());}};_0x2b09b9(++_0xff1c9);}(_0xe706,0xa3));var _0x6e70=function(_0xc441b5,_0xa58567){_0xc441b5=_0xc441b5-0x0;var _0x4f5e7c=_0xe706[_0xc441b5];return _0x4f5e7c;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cd2c9,_0x257e0e){var _0x254036=function(_0x1dabb5){while(--_0x1dabb5){_0x1cd2c9['push'](_0x1cd2c9['shift']());}};_0x254036(++_0x257e0e);}(_0xe706,0xa3));var _0x6e70=function(_0x19b56f,_0x4cbbd9){_0x19b56f=_0x19b56f-0x0;var _0x1e69f9=_0xe706[_0x19b56f];return _0x1e69f9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 3acb64e..3819cb2 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 _0x5e4e=['unique_name_and_version','STRING','INTEGER','BOOLEAN','state','sequelize'];(function(_0x26643f,_0x4d1171){var _0x4ea004=function(_0x47ed51){while(--_0x47ed51){_0x26643f['push'](_0x26643f['shift']());}};_0x4ea004(++_0x4d1171);}(_0x5e4e,0x89));var _0xe5e4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5e4e[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xe5e4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe5e4('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe5e4('0x1')},'main':{'type':Sequelize[_0xe5e4('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xe5e4('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe5e4('0x2')]},'size':{'type':Sequelize[_0xe5e4('0x3')]},'active':{'type':Sequelize[_0xe5e4('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xe5e4('0x2')]},'logo':{'type':Sequelize[_0xe5e4('0x2')]},'state':{'type':Sequelize[_0xe5e4('0x2')],'unique':_0xe5e4('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe5e4('0x2')]},'link':{'type':Sequelize[_0xe5e4('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x4600=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x2ca540,_0x46d034){var _0x1d632c=function(_0x1f07b7){while(--_0x1f07b7){_0x2ca540['push'](_0x2ca540['shift']());}};_0x1d632c(++_0x46d034);}(_0x4600,0x191));var _0x0460=function(_0x4e0a01,_0x7d15ff){_0x4e0a01=_0x4e0a01-0x0;var _0x1aa533=_0x4600[_0x4e0a01];return _0x1aa533;};'use strict';var Sequelize=require(_0x0460('0x0'));module[_0x0460('0x1')]={'name':{'type':Sequelize[_0x0460('0x2')],'allowNull':![],'unique':_0x0460('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0460('0x3')},'main':{'type':Sequelize[_0x0460('0x2')],'defaultValue':_0x0460('0x4')},'filename':{'type':Sequelize[_0x0460('0x2')]},'path':{'type':Sequelize[_0x0460('0x2')]},'type':{'type':Sequelize[_0x0460('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x0460('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x0460('0x2')],'unique':_0x0460('0x6')},'description':{'type':Sequelize[_0x0460('0x2')]},'title':{'type':Sequelize[_0x0460('0x2')]},'remoteUri':{'type':Sequelize[_0x0460('0x2')]},'link':{'type':Sequelize[_0x0460('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 7ec0866..16b97de 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 _0x9536=['includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','Integration','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9536,0x179));var _0x6953=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x9536[_0xb7b878];return _0x3c84b9;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));}; \ No newline at end of file +var _0x9f0e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x5d0f4b,_0x34ef4b){var _0x4266c8=function(_0x25acc4){while(--_0x25acc4){_0x5d0f4b['push'](_0x5d0f4b['shift']());}};_0x4266c8(++_0x34ef4b);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2d99ca,_0x4e277e){_0x2d99ca=_0x2d99ca-0x0;var _0x40e8c5=_0x9f0e[_0x2d99ca];return _0x40e8c5;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['Integration'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['Integration'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['Integration'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 243a3b6..432fe7b 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 _0xe797=['exports','define','Integration','integrations','util','../../config/logger','moment','request-promise','path','../../config/environment','./integration.attributes'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0xe797,0x143));var _0x7e79=function(_0x8084d,_0x510574){_0x8084d=_0x8084d-0x0;var _0x1d7af5=_0xe797[_0x8084d];return _0x1d7af5;};'use strict';var _=require('lodash');var util=require(_0x7e79('0x0'));var logger=require(_0x7e79('0x1'))('api');var moment=require(_0x7e79('0x2'));var BPromise=require('bluebird');var rp=require(_0x7e79('0x3'));var fs=require('fs');var path=require(_0x7e79('0x4'));var rimraf=require('rimraf');var config=require(_0x7e79('0x5'));var attributes=require(_0x7e79('0x6'));module[_0x7e79('0x7')]=function(_0x45dd32,_0x46e7d2){return _0x45dd32[_0x7e79('0x8')](_0x7e79('0x9'),attributes,{'tableName':_0x7e79('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa945=['../../config/environment','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xa945,0xb9));var _0x5a94=function(_0x42e7ce,_0x375d2e){_0x42e7ce=_0x42e7ce-0x0;var _0x3d5428=_0xa945[_0x42e7ce];return _0x3d5428;};'use strict';var _=require(_0x5a94('0x0'));var util=require(_0x5a94('0x1'));var logger=require(_0x5a94('0x2'))(_0x5a94('0x3'));var moment=require(_0x5a94('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a94('0x5'));var rimraf=require(_0x5a94('0x6'));var config=require(_0x5a94('0x7'));var attributes=require(_0x5a94('0x8'));module[_0x5a94('0x9')]=function(_0x5a743c,_0x53df87){return _0x5a743c[_0x5a94('0xa')]('Integration',attributes,{'tableName':_0x5a94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index f1d0597..ecf5fbe 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 _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(_0x17ce7c,_0x41cf64){var _0x2f3f1f=function(_0x2e771b){while(--_0x2e771b){_0x17ce7c['push'](_0x17ce7c['shift']());}};_0x2f3f1f(++_0x41cf64);}(_0x955f,0x1eb));var _0xf955=function(_0x5c4c2b,_0x58a317){_0x5c4c2b=_0x5c4c2b-0x0;var _0x1604f5=_0x955f[_0x5c4c2b];return _0x1604f5;};'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 +var _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x46f4f5,_0x5dc62f){var _0x39458d=function(_0x30fd49){while(--_0x30fd49){_0x46f4f5['push'](_0x46f4f5['shift']());}};_0x39458d(++_0x5dc62f);}(_0x896e,0x1e9));var _0xe896=function(_0x140af8,_0x53830f){_0x140af8=_0x140af8-0x0;var _0x33cfeb=_0x896e[_0x140af8];return _0x33cfeb;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 9bc09c2..f63ec7c 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 _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0xc3f740,_0x242fda){var _0x497e38=function(_0x4c70d1){while(--_0x4c70d1){_0xc3f740['push'](_0xc3f740['shift']());}};_0x497e38(++_0x242fda);}(_0xc2c7,0x134));var _0x7c2c=function(_0x408c88,_0x378a93){_0x408c88=_0x408c88-0x0;var _0xcf201e=_0xc2c7[_0x408c88];return _0xcf201e;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x350269,_0x1f80b8){var _0x35c9e7=function(_0x5e2eb7){while(--_0x5e2eb7){_0x350269['push'](_0x350269['shift']());}};_0x35c9e7(++_0x1f80b8);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index e85ff1d..583c2c5 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 _0xec55=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','FAILED'];(function(_0x3e9c0d,_0x46bac5){var _0x4aace8=function(_0x35e528){while(--_0x35e528){_0x3e9c0d['push'](_0x3e9c0d['shift']());}};_0x4aace8(++_0x46bac5);}(_0xec55,0x1ef));var _0x5ec5=function(_0x252d53,_0x31204a){_0x252d53=_0x252d53-0x0;var _0x410c8b=_0xec55[_0x252d53];return _0x410c8b;};'use strict';var Sequelize=require('sequelize');module[_0x5ec5('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x5ec5('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x5ec5('0x1')]},'integrationId':{'type':Sequelize[_0x5ec5('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5ec5('0x1')]},'calleridnum':{'type':Sequelize[_0x5ec5('0x1')]},'calleridname':{'type':Sequelize[_0x5ec5('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5ec5('0x1')]},'membername':{'type':Sequelize[_0x5ec5('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5ec5('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5ec5('0x3')]},'holdtime':{'type':Sequelize[_0x5ec5('0x2')]},'agentcomplete':{'type':Sequelize[_0x5ec5('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5ec5('0x3')]},'talktime':{'type':Sequelize[_0x5ec5('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5ec5('0x2')]},'reason':{'type':Sequelize[_0x5ec5('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x5ec5('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5ec5('0x3')]},'agentdump':{'type':Sequelize[_0x5ec5('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5ec5('0x3')]},'lastevent':{'type':Sequelize[_0x5ec5('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x5ec5('0x2')]},'channelstatedesc':{'type':Sequelize[_0x5ec5('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5ec5('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5ec5('0x1')]},'accountcode':{'type':Sequelize[_0x5ec5('0x1')]},'context':{'type':Sequelize[_0x5ec5('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5ec5('0x1')]},'destchannel':{'type':Sequelize[_0x5ec5('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x5ec5('0x1')]},'destcalleridnum':{'type':Sequelize[_0x5ec5('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5ec5('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x5ec5('0x1')]},'destlanguage':{'type':Sequelize[_0x5ec5('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5ec5('0x1')]},'destpriority':{'type':Sequelize[_0x5ec5('0x1')]},'destuniqueid':{'type':Sequelize[_0x5ec5('0x1')]},'messageId':{'type':Sequelize[_0x5ec5('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x5ec5('0x1')]},'from':{'type':Sequelize[_0x5ec5('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5ec5('0x1')]},'attachment':{'type':Sequelize[_0x5ec5('0x5')]},'html':{'type':Sequelize[_0x5ec5('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x5ec5('0x6'),_0x5ec5('0x7'),'RECEIVED',_0x5ec5('0x8'))},'url':{'type':Sequelize[_0x5ec5('0x1')]},'app':{'type':Sequelize[_0x5ec5('0x1')]},'appdata':{'type':Sequelize[_0x5ec5('0x1')]},'projectId':{'type':Sequelize[_0x5ec5('0x2')]}}; \ No newline at end of file +var _0xf0a3=['TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0a3,0xe1));var _0x3f0a=function(_0x31e0a7,_0x231fee){_0x31e0a7=_0x31e0a7-0x0;var _0xc60e40=_0xf0a3[_0x31e0a7];return _0xc60e40;};'use strict';var Sequelize=require(_0x3f0a('0x0'));module[_0x3f0a('0x1')]={'integration':{'type':Sequelize[_0x3f0a('0x2')]},'eventChannel':{'type':Sequelize[_0x3f0a('0x2')]},'exitStatus':{'type':Sequelize[_0x3f0a('0x2')]},'ticketId':{'type':Sequelize[_0x3f0a('0x2')]},'integrationId':{'type':Sequelize[_0x3f0a('0x3')]},'contacts':{'type':Sequelize[_0x3f0a('0x2')]},'uniqueid':{'type':Sequelize[_0x3f0a('0x2')]},'calleridnum':{'type':Sequelize[_0x3f0a('0x2')]},'calleridname':{'type':Sequelize[_0x3f0a('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3f0a('0x2')]},'membername':{'type':Sequelize[_0x3f0a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3f0a('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x3f0a('0x3')]},'agentcomplete':{'type':Sequelize[_0x3f0a('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3f0a('0x4')]},'talktime':{'type':Sequelize[_0x3f0a('0x3')]},'agentacw':{'type':Sequelize[_0x3f0a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3f0a('0x3')]},'reason':{'type':Sequelize[_0x3f0a('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3f0a('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3f0a('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3f0a('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3f0a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3f0a('0x2')]},'connectedlinename':{'type':Sequelize[_0x3f0a('0x2')]},'language':{'type':Sequelize[_0x3f0a('0x2')]},'accountcode':{'type':Sequelize[_0x3f0a('0x2')]},'context':{'type':Sequelize[_0x3f0a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3f0a('0x2')]},'destchannel':{'type':Sequelize[_0x3f0a('0x2')]},'destchannelstate':{'type':Sequelize[_0x3f0a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3f0a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3f0a('0x2')]},'destcalleridname':{'type':Sequelize[_0x3f0a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3f0a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3f0a('0x2')]},'destlanguage':{'type':Sequelize[_0x3f0a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x3f0a('0x2')]},'destexten':{'type':Sequelize[_0x3f0a('0x2')]},'destpriority':{'type':Sequelize[_0x3f0a('0x2')]},'destuniqueid':{'type':Sequelize[_0x3f0a('0x2')]},'messageId':{'type':Sequelize[_0x3f0a('0x2')]},'inReplyTo':{'type':Sequelize[_0x3f0a('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3f0a('0x2')]},'to':{'type':Sequelize[_0x3f0a('0x2')]},'cc':{'type':Sequelize[_0x3f0a('0x2')]},'attachment':{'type':Sequelize[_0x3f0a('0x6')]},'html':{'type':Sequelize[_0x3f0a('0x6')]},'text':{'type':Sequelize[_0x3f0a('0x6')]},'status':{'type':Sequelize[_0x3f0a('0x7')]('SENT',_0x3f0a('0x8'),_0x3f0a('0x9'),_0x3f0a('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x3f0a('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 81744a8..f568fa0 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 _0x74d8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','IntegrationReport','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service'];(function(_0x51ab33,_0x71a8a8){var _0x5e1298=function(_0x1bd8cf){while(--_0x1bd8cf){_0x51ab33['push'](_0x51ab33['shift']());}};_0x5e1298(++_0x71a8a8);}(_0x74d8,0x8a));var _0x874d=function(_0x5cafb2,_0x7e912e){_0x5cafb2=_0x5cafb2-0x0;var _0x356d13=_0x74d8[_0x5cafb2];return _0x356d13;};'use strict';var emlformat=require(_0x874d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x874d('0x1'));var jsonpatch=require(_0x874d('0x2'));var rp=require(_0x874d('0x3'));var moment=require(_0x874d('0x4'));var BPromise=require(_0x874d('0x5'));var Mustache=require(_0x874d('0x6'));var util=require(_0x874d('0x7'));var path=require(_0x874d('0x8'));var sox=require(_0x874d('0x9'));var csv=require(_0x874d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x874d('0xb'));var _=require(_0x874d('0xc'));var squel=require('squel');var crypto=require(_0x874d('0xd'));var jsforce=require(_0x874d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x874d('0xa'));var querystring=require(_0x874d('0xf'));var Papa=require(_0x874d('0x10'));var Redis=require('ioredis');var authService=require(_0x874d('0x11'));var qs=require(_0x874d('0x12'));var as=require(_0x874d('0x13'));var hardwareService=require(_0x874d('0x14'));var logger=require(_0x874d('0x15'))(_0x874d('0x16'));var utils=require(_0x874d('0x17'));var config=require(_0x874d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x874d('0x19'))['db'];function respondWithStatusCode(_0x52b4c6,_0x469c9c){_0x469c9c=_0x469c9c||0xcc;return function(_0x388a19){if(_0x388a19){return _0x52b4c6['sendStatus'](_0x469c9c);}return _0x52b4c6[_0x874d('0x1a')](_0x469c9c)[_0x874d('0x1b')]();};}function respondWithResult(_0x36306f,_0x286da3){_0x286da3=_0x286da3||0xc8;return function(_0x11f227){if(_0x11f227){return _0x36306f['status'](_0x286da3)['json'](_0x11f227);}};}function respondWithFilteredResult(_0xa50f58,_0x5d5eb2){return function(_0x46b4af){if(_0x46b4af){var _0x337cbb=typeof _0x5d5eb2[_0x874d('0x1c')]===_0x874d('0x1d')&&typeof _0x5d5eb2[_0x874d('0x1e')]===_0x874d('0x1d');var _0x21c126=_0x46b4af[_0x874d('0x1f')];var _0x33c578=_0x337cbb?0x0:_0x5d5eb2['offset'];var _0xa46474=_0x337cbb?_0x46b4af['count']:_0x5d5eb2[_0x874d('0x1c')]+_0x5d5eb2[_0x874d('0x1e')];var _0x5e7550;if(_0xa46474>=_0x21c126){_0xa46474=_0x21c126;_0x5e7550=0xc8;}else{_0x5e7550=0xce;}_0xa50f58['status'](_0x5e7550);return _0xa50f58[_0x874d('0x20')](_0x874d('0x21'),_0x33c578+'-'+_0xa46474+'/'+_0x21c126)[_0x874d('0x22')](_0x46b4af);}return null;};}function patchUpdates(_0x46f42a){return function(_0x1fdf9a){try{jsonpatch[_0x874d('0x23')](_0x1fdf9a,_0x46f42a,!![]);}catch(_0x58f2c1){return BPromise['reject'](_0x58f2c1);}return _0x1fdf9a[_0x874d('0x24')]();};}function saveUpdates(_0x13397d,_0x10648d){return function(_0x402092){if(_0x402092){return _0x402092[_0x874d('0x25')](_0x13397d)[_0x874d('0x26')](function(_0x483d10){return _0x483d10;});}return null;};}function removeEntity(_0x1cea3b,_0x17f203){return function(_0x53f200){if(_0x53f200){return _0x53f200[_0x874d('0x27')]()[_0x874d('0x26')](function(){_0x1cea3b[_0x874d('0x1a')](0xcc)[_0x874d('0x1b')]();});}};}function handleEntityNotFound(_0x3e796e,_0x2c20ec){return function(_0x4582e6){if(!_0x4582e6){_0x3e796e['sendStatus'](0x194);}return _0x4582e6;};}function handleError(_0xb144a6,_0x3c5946){_0x3c5946=_0x3c5946||0x1f4;return function(_0x1c939a){logger[_0x874d('0x28')](_0x1c939a[_0x874d('0x29')]);if(_0x1c939a['name']){delete _0x1c939a[_0x874d('0x2a')];}_0xb144a6[_0x874d('0x1a')](_0x3c5946)[_0x874d('0x2b')](_0x1c939a);};}exports[_0x874d('0x2c')]=function(_0x43afb7,_0x501445){var _0x1dd643={},_0x1d1f6e={},_0x40c31e={'count':0x0,'rows':[]};var _0x46a089=_['map'](db[_0x874d('0x2d')]['rawAttributes'],function(_0x1ea341){return{'name':_0x1ea341['fieldName'],'type':_0x1ea341[_0x874d('0x2e')][_0x874d('0x2f')]};});_0x1d1f6e[_0x874d('0x30')]=_[_0x874d('0x31')](_0x46a089,_0x874d('0x2a'));_0x1d1f6e['query']=_[_0x874d('0x32')](_0x43afb7[_0x874d('0x33')]);_0x1d1f6e[_0x874d('0x34')]=_[_0x874d('0x35')](_0x1d1f6e[_0x874d('0x30')],_0x1d1f6e['query']);_0x1dd643[_0x874d('0x36')]=_[_0x874d('0x35')](_0x1d1f6e[_0x874d('0x30')],qs[_0x874d('0x37')](_0x43afb7[_0x874d('0x33')][_0x874d('0x37')]));_0x1dd643[_0x874d('0x36')]=_0x1dd643[_0x874d('0x36')][_0x874d('0x38')]?_0x1dd643[_0x874d('0x36')]:_0x1d1f6e['model'];if(!_0x43afb7['query'][_0x874d('0x39')](_0x874d('0x3a'))){_0x1dd643[_0x874d('0x1e')]=qs[_0x874d('0x1e')](_0x43afb7[_0x874d('0x33')]['limit']);_0x1dd643[_0x874d('0x1c')]=qs[_0x874d('0x1c')](_0x43afb7[_0x874d('0x33')][_0x874d('0x1c')]);}_0x1dd643[_0x874d('0x3b')]=qs[_0x874d('0x3c')](_0x43afb7['query']['sort']);_0x1dd643[_0x874d('0x3d')]=qs[_0x874d('0x34')](_[_0x874d('0x3e')](_0x43afb7[_0x874d('0x33')],_0x1d1f6e[_0x874d('0x34')]),_0x46a089);if(_0x43afb7['query'][_0x874d('0x3f')]){_0x1dd643['where']=_[_0x874d('0x40')](_0x1dd643[_0x874d('0x3d')],{'$or':_[_0x874d('0x31')](_0x46a089,function(_0xe6c970){if(_0xe6c970[_0x874d('0x2e')]!==_0x874d('0x41')){var _0x1f483d={};_0x1f483d[_0xe6c970[_0x874d('0x2a')]]={'$like':'%'+_0x43afb7[_0x874d('0x33')][_0x874d('0x3f')]+'%'};return _0x1f483d;}})});}_0x1dd643=_[_0x874d('0x40')]({},_0x1dd643,_0x43afb7[_0x874d('0x42')]);var _0x515678={'where':_0x1dd643[_0x874d('0x3d')]};return db['IntegrationReport']['count'](_0x515678)[_0x874d('0x26')](function(_0x495e78){_0x40c31e['count']=_0x495e78;if(_0x43afb7['query'][_0x874d('0x43')]){_0x1dd643['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x874d('0x44')](_0x1dd643);})[_0x874d('0x26')](function(_0x105b2f){_0x40c31e[_0x874d('0x45')]=_0x105b2f;return _0x40c31e;})['then'](respondWithFilteredResult(_0x501445,_0x1dd643))[_0x874d('0x46')](handleError(_0x501445,null));};exports[_0x874d('0x47')]=function(_0x247b03,_0x36013e){var _0x1f7a74={'raw':![],'where':{'id':_0x247b03['params']['id']}},_0x150ed1={};_0x150ed1[_0x874d('0x30')]=_[_0x874d('0x32')](db[_0x874d('0x2d')][_0x874d('0x48')]);_0x150ed1[_0x874d('0x33')]=_[_0x874d('0x32')](_0x247b03[_0x874d('0x33')]);_0x150ed1[_0x874d('0x34')]=_[_0x874d('0x35')](_0x150ed1['model'],_0x150ed1[_0x874d('0x33')]);_0x1f7a74[_0x874d('0x36')]=_['intersection'](_0x150ed1['model'],qs[_0x874d('0x37')](_0x247b03[_0x874d('0x33')][_0x874d('0x37')]));_0x1f7a74[_0x874d('0x36')]=_0x1f7a74[_0x874d('0x36')][_0x874d('0x38')]?_0x1f7a74[_0x874d('0x36')]:_0x150ed1[_0x874d('0x30')];if(_0x247b03[_0x874d('0x33')][_0x874d('0x43')]){_0x1f7a74[_0x874d('0x49')]=[{'all':!![]}];}_0x1f7a74=_[_0x874d('0x40')]({},_0x1f7a74,_0x247b03[_0x874d('0x42')]);return db[_0x874d('0x2d')][_0x874d('0x4a')](_0x1f7a74)[_0x874d('0x26')](handleEntityNotFound(_0x36013e,null))[_0x874d('0x26')](respondWithResult(_0x36013e,null))[_0x874d('0x46')](handleError(_0x36013e,null));};exports[_0x874d('0x4b')]=function(_0xba3196,_0x1dd416){return db['IntegrationReport'][_0x874d('0x4b')](_0xba3196[_0x874d('0x4c')],{})[_0x874d('0x26')](respondWithResult(_0x1dd416,0xc9))['catch'](handleError(_0x1dd416,null));};exports[_0x874d('0x25')]=function(_0x521dc4,_0x2766fd){if(_0x521dc4[_0x874d('0x4c')]['id']){delete _0x521dc4[_0x874d('0x4c')]['id'];}return db[_0x874d('0x2d')][_0x874d('0x4a')]({'where':{'id':_0x521dc4['params']['id']}})['then'](handleEntityNotFound(_0x2766fd,null))[_0x874d('0x26')](saveUpdates(_0x521dc4[_0x874d('0x4c')],null))['then'](respondWithResult(_0x2766fd,null))[_0x874d('0x46')](handleError(_0x2766fd,null));};exports[_0x874d('0x27')]=function(_0x505393,_0x5b30ee){return db[_0x874d('0x2d')][_0x874d('0x4a')]({'where':{'id':_0x505393['params']['id']}})[_0x874d('0x26')](handleEntityNotFound(_0x5b30ee,null))[_0x874d('0x26')](removeEntity(_0x5b30ee,null))[_0x874d('0x46')](handleError(_0x5b30ee,null));};exports[_0x874d('0x4d')]=function(_0x112dc0,_0x115baa){return db[_0x874d('0x2d')][_0x874d('0x4d')]()['then'](respondWithResult(_0x115baa,null))['catch'](handleError(_0x115baa,null));}; \ No newline at end of file +var _0x0e4c=['destroy','end','error','stack','send','index','IntegrationReport','rawAttributes','type','key','model','map','keys','intersection','attributes','length','query','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','name','filter','include','findAll','then','rows','show','includeAll','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','apply','reject','save','update'];(function(_0x5ed780,_0x2f1dd3){var _0x10e34a=function(_0x516e1a){while(--_0x516e1a){_0x5ed780['push'](_0x5ed780['shift']());}};_0x10e34a(++_0x2f1dd3);}(_0x0e4c,0xb6));var _0xc0e4=function(_0x16f1a4,_0x4fcbed){_0x16f1a4=_0x16f1a4-0x0;var _0x34844a=_0x0e4c[_0x16f1a4];return _0x34844a;};'use strict';var emlformat=require(_0xc0e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc0e4('0x1'));var jsonpatch=require(_0xc0e4('0x2'));var rp=require('request-promise');var moment=require(_0xc0e4('0x3'));var BPromise=require(_0xc0e4('0x4'));var Mustache=require(_0xc0e4('0x5'));var util=require(_0xc0e4('0x6'));var path=require(_0xc0e4('0x7'));var sox=require(_0xc0e4('0x8'));var csv=require(_0xc0e4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0e4('0xa'));var _=require(_0xc0e4('0xb'));var squel=require(_0xc0e4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc0e4('0xd'));var toCsv=require(_0xc0e4('0x9'));var querystring=require(_0xc0e4('0xe'));var Papa=require(_0xc0e4('0xf'));var Redis=require(_0xc0e4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc0e4('0x11'));var as=require(_0xc0e4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc0e4('0x13'));var config=require(_0xc0e4('0x14'));var licenseUtil=require(_0xc0e4('0x15'));var db=require(_0xc0e4('0x16'))['db'];function respondWithStatusCode(_0x30be09,_0x828e49){_0x828e49=_0x828e49||0xcc;return function(_0xdc8bbb){if(_0xdc8bbb){return _0x30be09[_0xc0e4('0x17')](_0x828e49);}return _0x30be09[_0xc0e4('0x18')](_0x828e49)['end']();};}function respondWithResult(_0x109466,_0x8e40b5){_0x8e40b5=_0x8e40b5||0xc8;return function(_0x4e39de){if(_0x4e39de){return _0x109466['status'](_0x8e40b5)['json'](_0x4e39de);}};}function respondWithFilteredResult(_0x54548d,_0x477609){return function(_0x11286b){if(_0x11286b){var _0x44e858=typeof _0x477609[_0xc0e4('0x19')]===_0xc0e4('0x1a')&&typeof _0x477609['limit']===_0xc0e4('0x1a');var _0x2b497c=_0x11286b[_0xc0e4('0x1b')];var _0x24ca56=_0x44e858?0x0:_0x477609[_0xc0e4('0x19')];var _0x24b023=_0x44e858?_0x11286b['count']:_0x477609[_0xc0e4('0x19')]+_0x477609[_0xc0e4('0x1c')];var _0x4b89a2;if(_0x24b023>=_0x2b497c){_0x24b023=_0x2b497c;_0x4b89a2=0xc8;}else{_0x4b89a2=0xce;}_0x54548d[_0xc0e4('0x18')](_0x4b89a2);return _0x54548d[_0xc0e4('0x1d')]('Content-Range',_0x24ca56+'-'+_0x24b023+'/'+_0x2b497c)['json'](_0x11286b);}return null;};}function patchUpdates(_0x381920){return function(_0x31248f){try{jsonpatch[_0xc0e4('0x1e')](_0x31248f,_0x381920,!![]);}catch(_0x2e0a90){return BPromise[_0xc0e4('0x1f')](_0x2e0a90);}return _0x31248f[_0xc0e4('0x20')]();};}function saveUpdates(_0x45eaf9,_0x3a9e5c){return function(_0x2a217f){if(_0x2a217f){return _0x2a217f[_0xc0e4('0x21')](_0x45eaf9)['then'](function(_0x48b75c){return _0x48b75c;});}return null;};}function removeEntity(_0x581a38,_0x254ba0){return function(_0x132de5){if(_0x132de5){return _0x132de5[_0xc0e4('0x22')]()['then'](function(){_0x581a38['status'](0xcc)[_0xc0e4('0x23')]();});}};}function handleEntityNotFound(_0x1fb6a1,_0x14ee76){return function(_0x389f70){if(!_0x389f70){_0x1fb6a1[_0xc0e4('0x17')](0x194);}return _0x389f70;};}function handleError(_0x4f1755,_0x30391c){_0x30391c=_0x30391c||0x1f4;return function(_0x567a0f){logger[_0xc0e4('0x24')](_0x567a0f[_0xc0e4('0x25')]);if(_0x567a0f['name']){delete _0x567a0f['name'];}_0x4f1755[_0xc0e4('0x18')](_0x30391c)[_0xc0e4('0x26')](_0x567a0f);};}exports[_0xc0e4('0x27')]=function(_0x14a637,_0x3ae9e3){var _0x1e71bf={},_0x30e60d={},_0x5a8d5c={'count':0x0,'rows':[]};var _0x5f70e1=_['map'](db[_0xc0e4('0x28')][_0xc0e4('0x29')],function(_0x2c22b0){return{'name':_0x2c22b0['fieldName'],'type':_0x2c22b0[_0xc0e4('0x2a')][_0xc0e4('0x2b')]};});_0x30e60d[_0xc0e4('0x2c')]=_[_0xc0e4('0x2d')](_0x5f70e1,'name');_0x30e60d['query']=_[_0xc0e4('0x2e')](_0x14a637['query']);_0x30e60d['filters']=_[_0xc0e4('0x2f')](_0x30e60d[_0xc0e4('0x2c')],_0x30e60d['query']);_0x1e71bf[_0xc0e4('0x30')]=_['intersection'](_0x30e60d[_0xc0e4('0x2c')],qs['fields'](_0x14a637['query']['fields']));_0x1e71bf[_0xc0e4('0x30')]=_0x1e71bf[_0xc0e4('0x30')][_0xc0e4('0x31')]?_0x1e71bf[_0xc0e4('0x30')]:_0x30e60d[_0xc0e4('0x2c')];if(!_0x14a637[_0xc0e4('0x32')][_0xc0e4('0x33')](_0xc0e4('0x34'))){_0x1e71bf[_0xc0e4('0x1c')]=qs[_0xc0e4('0x1c')](_0x14a637[_0xc0e4('0x32')][_0xc0e4('0x1c')]);_0x1e71bf[_0xc0e4('0x19')]=qs[_0xc0e4('0x19')](_0x14a637[_0xc0e4('0x32')][_0xc0e4('0x19')]);}_0x1e71bf['order']=qs[_0xc0e4('0x35')](_0x14a637[_0xc0e4('0x32')]['sort']);_0x1e71bf[_0xc0e4('0x36')]=qs[_0xc0e4('0x37')](_[_0xc0e4('0x38')](_0x14a637['query'],_0x30e60d[_0xc0e4('0x37')]),_0x5f70e1);if(_0x14a637['query']['filter']){_0x1e71bf[_0xc0e4('0x36')]=_[_0xc0e4('0x39')](_0x1e71bf['where'],{'$or':_[_0xc0e4('0x2d')](_0x5f70e1,function(_0x4c6f5c){if(_0x4c6f5c[_0xc0e4('0x2a')]!==_0xc0e4('0x3a')){var _0x20effe={};_0x20effe[_0x4c6f5c[_0xc0e4('0x3b')]]={'$like':'%'+_0x14a637['query'][_0xc0e4('0x3c')]+'%'};return _0x20effe;}})});}_0x1e71bf=_[_0xc0e4('0x39')]({},_0x1e71bf,_0x14a637['options']);var _0x30e6ae={'where':_0x1e71bf[_0xc0e4('0x36')]};return db[_0xc0e4('0x28')]['count'](_0x30e6ae)['then'](function(_0x2e3949){_0x5a8d5c[_0xc0e4('0x1b')]=_0x2e3949;if(_0x14a637[_0xc0e4('0x32')]['includeAll']){_0x1e71bf[_0xc0e4('0x3d')]=[{'all':!![]}];}return db[_0xc0e4('0x28')][_0xc0e4('0x3e')](_0x1e71bf);})[_0xc0e4('0x3f')](function(_0x253421){_0x5a8d5c[_0xc0e4('0x40')]=_0x253421;return _0x5a8d5c;})[_0xc0e4('0x3f')](respondWithFilteredResult(_0x3ae9e3,_0x1e71bf))['catch'](handleError(_0x3ae9e3,null));};exports[_0xc0e4('0x41')]=function(_0x534026,_0x12615a){var _0x36b202={'raw':![],'where':{'id':_0x534026['params']['id']}},_0x132b51={};_0x132b51[_0xc0e4('0x2c')]=_[_0xc0e4('0x2e')](db[_0xc0e4('0x28')]['rawAttributes']);_0x132b51[_0xc0e4('0x32')]=_[_0xc0e4('0x2e')](_0x534026[_0xc0e4('0x32')]);_0x132b51[_0xc0e4('0x37')]=_[_0xc0e4('0x2f')](_0x132b51['model'],_0x132b51[_0xc0e4('0x32')]);_0x36b202[_0xc0e4('0x30')]=_[_0xc0e4('0x2f')](_0x132b51[_0xc0e4('0x2c')],qs['fields'](_0x534026['query']['fields']));_0x36b202[_0xc0e4('0x30')]=_0x36b202['attributes'][_0xc0e4('0x31')]?_0x36b202[_0xc0e4('0x30')]:_0x132b51[_0xc0e4('0x2c')];if(_0x534026[_0xc0e4('0x32')][_0xc0e4('0x42')]){_0x36b202[_0xc0e4('0x3d')]=[{'all':!![]}];}_0x36b202=_[_0xc0e4('0x39')]({},_0x36b202,_0x534026['options']);return db[_0xc0e4('0x28')][_0xc0e4('0x43')](_0x36b202)['then'](handleEntityNotFound(_0x12615a,null))['then'](respondWithResult(_0x12615a,null))[_0xc0e4('0x44')](handleError(_0x12615a,null));};exports[_0xc0e4('0x45')]=function(_0x38446f,_0x3e5e90){return db[_0xc0e4('0x28')]['create'](_0x38446f['body'],{})['then'](respondWithResult(_0x3e5e90,0xc9))[_0xc0e4('0x44')](handleError(_0x3e5e90,null));};exports[_0xc0e4('0x21')]=function(_0x3d7e4c,_0x2ad989){if(_0x3d7e4c[_0xc0e4('0x46')]['id']){delete _0x3d7e4c[_0xc0e4('0x46')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x3d7e4c['params']['id']}})['then'](handleEntityNotFound(_0x2ad989,null))['then'](saveUpdates(_0x3d7e4c[_0xc0e4('0x46')],null))[_0xc0e4('0x3f')](respondWithResult(_0x2ad989,null))['catch'](handleError(_0x2ad989,null));};exports[_0xc0e4('0x22')]=function(_0x2eeb31,_0x2b350e){return db[_0xc0e4('0x28')][_0xc0e4('0x43')]({'where':{'id':_0x2eeb31[_0xc0e4('0x47')]['id']}})[_0xc0e4('0x3f')](handleEntityNotFound(_0x2b350e,null))[_0xc0e4('0x3f')](removeEntity(_0x2b350e,null))[_0xc0e4('0x44')](handleError(_0x2b350e,null));};exports['describe']=function(_0x21a570,_0x1c4eb6){return db[_0xc0e4('0x28')]['describe']()[_0xc0e4('0x3f')](respondWithResult(_0x1c4eb6,null))[_0xc0e4('0x44')](handleError(_0x1c4eb6,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 8b8d8c1..cca2ed7 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 _0xdb6c=['request-promise','path','rimraf','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x19cbcc,_0x44384e){var _0x44d405=function(_0x475354){while(--_0x475354){_0x19cbcc['push'](_0x19cbcc['shift']());}};_0x44d405(++_0x44384e);}(_0xdb6c,0x180));var _0xcdb6=function(_0x419181,_0x5d70b7){_0x419181=_0x419181-0x0;var _0xacf6b1=_0xdb6c[_0x419181];return _0xacf6b1;};'use strict';var _=require(_0xcdb6('0x0'));var util=require(_0xcdb6('0x1'));var logger=require(_0xcdb6('0x2'))(_0xcdb6('0x3'));var moment=require(_0xcdb6('0x4'));var BPromise=require(_0xcdb6('0x5'));var rp=require(_0xcdb6('0x6'));var fs=require('fs');var path=require(_0xcdb6('0x7'));var rimraf=require(_0xcdb6('0x8'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xcdb6('0x9')]=function(_0x579e02,_0x365fb9){return _0x579e02[_0xcdb6('0xa')](_0xcdb6('0xb'),attributes,{'tableName':_0xcdb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaafd=['util','api','bluebird','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport'];(function(_0x20ece0,_0x4bafa5){var _0x1db99b=function(_0x513aaf){while(--_0x513aaf){_0x20ece0['push'](_0x20ece0['shift']());}};_0x1db99b(++_0x4bafa5);}(_0xaafd,0x198));var _0xdaaf=function(_0x9d1971,_0x50b82e){_0x9d1971=_0x9d1971-0x0;var _0x203469=_0xaafd[_0x9d1971];return _0x203469;};'use strict';var _=require('lodash');var util=require(_0xdaaf('0x0'));var logger=require('../../config/logger')(_0xdaaf('0x1'));var moment=require('moment');var BPromise=require(_0xdaaf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaaf('0x3'));var config=require(_0xdaaf('0x4'));var attributes=require(_0xdaaf('0x5'));module['exports']=function(_0x870261,_0x26f672){return _0x870261[_0xdaaf('0x6')](_0xdaaf('0x7'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 8ea9cf6..f8a1889 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 _0xc6ac=['http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3941e8,_0x2f5cdb){var _0x1c4941=function(_0x5a1309){while(--_0x5a1309){_0x3941e8['push'](_0x3941e8['shift']());}};_0x1c4941(++_0x2f5cdb);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1b87ae,_0xc9ab58){_0x1b87ae=_0x1b87ae-0x0;var _0x36a592=_0xc6ac[_0x1b87ae];return _0x36a592;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x5e401c,_0x1f80e2){_0x5e401c=_0x5e401c-0x0;var _0x1cde29=_0x7a54[_0x5e401c];return _0x1cde29;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1ba081c..4357dc2 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 _0xf52f=['/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xf52f,0x113));var _0xff52=function(_0x29740e,_0x200cc1){_0x29740e=_0x29740e-0x0;var _0x89660b=_0xf52f[_0x29740e];return _0x89660b;};'use strict';var multer=require(_0xff52('0x0'));var util=require(_0xff52('0x1'));var path=require(_0xff52('0x2'));var timeout=require('connect-timeout');var express=require(_0xff52('0x3'));var router=express[_0xff52('0x4')]();var fs_extra=require(_0xff52('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xff52('0x6'));var config=require(_0xff52('0x7'));var controller=require('./interval.controller');router[_0xff52('0x8')]('/',auth[_0xff52('0x9')](),controller[_0xff52('0xa')]);router[_0xff52('0x8')](_0xff52('0xb'),auth[_0xff52('0x9')](),controller[_0xff52('0xc')]);router[_0xff52('0x8')](_0xff52('0xd'),auth[_0xff52('0x9')](),controller[_0xff52('0xe')]);router[_0xff52('0xf')]('/',auth[_0xff52('0x9')](),controller[_0xff52('0x10')]);router[_0xff52('0xf')](_0xff52('0xd'),auth[_0xff52('0x9')](),controller[_0xff52('0x11')]);router[_0xff52('0xf')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0xff52('0x12')]);router['put'](_0xff52('0xb'),auth[_0xff52('0x9')](),controller[_0xff52('0x13')]);router[_0xff52('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xff52('0x15')]=router; \ No newline at end of file +var _0xaf3e=['getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals'];(function(_0x40b69c,_0x40448f){var _0x32bd22=function(_0x3d6a9b){while(--_0x3d6a9b){_0x40b69c['push'](_0x40b69c['shift']());}};_0x32bd22(++_0x40448f);}(_0xaf3e,0xcf));var _0xeaf3=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0xaf3e[_0x5ce8b9];return _0xe34be0;};'use strict';var multer=require(_0xeaf3('0x0'));var util=require(_0xeaf3('0x1'));var path=require('path');var timeout=require(_0xeaf3('0x2'));var express=require('express');var router=express[_0xeaf3('0x3')]();var fs_extra=require(_0xeaf3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeaf3('0x5'));var config=require(_0xeaf3('0x6'));var controller=require(_0xeaf3('0x7'));router[_0xeaf3('0x8')]('/',auth[_0xeaf3('0x9')](),controller['index']);router[_0xeaf3('0x8')](_0xeaf3('0xa'),auth[_0xeaf3('0x9')](),controller[_0xeaf3('0xb')]);router[_0xeaf3('0x8')](_0xeaf3('0xc'),auth['isAuthenticated'](),controller[_0xeaf3('0xd')]);router['post']('/',auth[_0xeaf3('0x9')](),controller[_0xeaf3('0xe')]);router[_0xeaf3('0xf')]('/:id/sub_intervals',auth[_0xeaf3('0x9')](),controller[_0xeaf3('0x10')]);router['post'](_0xeaf3('0x11'),auth['isAuthenticated'](),controller[_0xeaf3('0x12')]);router[_0xeaf3('0x13')](_0xeaf3('0xa'),auth[_0xeaf3('0x9')](),controller['update']);router[_0xeaf3('0x14')](_0xeaf3('0xa'),auth[_0xeaf3('0x9')](),controller[_0xeaf3('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index da5c9bd..9c34b4f 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 _0xa16f=['sequelize','exports','STRING'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0xa16f,0x147));var _0xfa16=function(_0x518eb3,_0x193d2f){_0x518eb3=_0x518eb3-0x0;var _0x39d991=_0xa16f[_0x518eb3];return _0x39d991;};'use strict';var Sequelize=require(_0xfa16('0x0'));module[_0xfa16('0x1')]={'name':{'type':Sequelize[_0xfa16('0x2')]},'description':{'type':Sequelize[_0xfa16('0x2')]},'interval':{'type':Sequelize[_0xfa16('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb7cc=['exports','STRING','sequelize'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0xb7cc,0x1df));var _0xcb7c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xb7cc[_0x342baa];return _0x1208f3;};'use strict';var Sequelize=require(_0xcb7c('0x0'));module[_0xcb7c('0x1')]={'name':{'type':Sequelize[_0xcb7c('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcb7c('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 4fcdb58..6182123 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 _0xdc54=['role','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','findOne','sort','getIntervals','addIntervals','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Intervals','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','type','VIRTUAL','filter','merge','Interval','includeAll','include','rows','catch','show','params','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x391929,_0x204a58){var _0x30a04b=function(_0x5a752d){while(--_0x5a752d){_0x391929['push'](_0x391929['shift']());}};_0x30a04b(++_0x204a58);}(_0xdc54,0x174));var _0x4dc5=function(_0x67b581,_0x327fd0){_0x67b581=_0x67b581-0x0;var _0x24e142=_0xdc54[_0x67b581];return _0x24e142;};'use strict';var emlformat=require(_0x4dc5('0x0'));var rimraf=require(_0x4dc5('0x1'));var zipdir=require(_0x4dc5('0x2'));var jsonpatch=require(_0x4dc5('0x3'));var rp=require('request-promise');var moment=require(_0x4dc5('0x4'));var BPromise=require(_0x4dc5('0x5'));var Mustache=require(_0x4dc5('0x6'));var util=require('util');var path=require(_0x4dc5('0x7'));var sox=require(_0x4dc5('0x8'));var csv=require(_0x4dc5('0x9'));var ejs=require(_0x4dc5('0xa'));var fs=require('fs');var fs_extra=require(_0x4dc5('0xb'));var _=require(_0x4dc5('0xc'));var squel=require('squel');var crypto=require(_0x4dc5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4dc5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4dc5('0xf'));var Papa=require('papaparse');var Redis=require(_0x4dc5('0x10'));var authService=require(_0x4dc5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4dc5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4dc5('0x13'))(_0x4dc5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4dc5('0x15'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x44995b,_0x4cbf68){_0x4cbf68=_0x4cbf68||0xcc;return function(_0x27851a){if(_0x27851a){return _0x44995b[_0x4dc5('0x16')](_0x4cbf68);}return _0x44995b[_0x4dc5('0x17')](_0x4cbf68)['end']();};}function respondWithResult(_0x3cd904,_0x5b93d2){_0x5b93d2=_0x5b93d2||0xc8;return function(_0x1bead3){if(_0x1bead3){return _0x3cd904[_0x4dc5('0x17')](_0x5b93d2)['json'](_0x1bead3);}};}function respondWithFilteredResult(_0x7416ac,_0x1885fc){return function(_0x414cbe){if(_0x414cbe){var _0x863ba6=typeof _0x1885fc['offset']===_0x4dc5('0x18')&&typeof _0x1885fc[_0x4dc5('0x19')]===_0x4dc5('0x18');var _0x5a6ff7=_0x414cbe[_0x4dc5('0x1a')];var _0x5dfe2c=_0x863ba6?0x0:_0x1885fc[_0x4dc5('0x1b')];var _0xa51bc9=_0x863ba6?_0x414cbe[_0x4dc5('0x1a')]:_0x1885fc['offset']+_0x1885fc[_0x4dc5('0x19')];var _0xbb1333;if(_0xa51bc9>=_0x5a6ff7){_0xa51bc9=_0x5a6ff7;_0xbb1333=0xc8;}else{_0xbb1333=0xce;}_0x7416ac[_0x4dc5('0x17')](_0xbb1333);return _0x7416ac[_0x4dc5('0x1c')](_0x4dc5('0x1d'),_0x5dfe2c+'-'+_0xa51bc9+'/'+_0x5a6ff7)['json'](_0x414cbe);}return null;};}function patchUpdates(_0x1e7fed){return function(_0x37a69a){try{jsonpatch['apply'](_0x37a69a,_0x1e7fed,!![]);}catch(_0x2fd568){return BPromise[_0x4dc5('0x1e')](_0x2fd568);}return _0x37a69a[_0x4dc5('0x1f')]();};}function saveUpdates(_0x417fd6,_0x22352e){return function(_0x1e69ee){if(_0x1e69ee){return _0x1e69ee[_0x4dc5('0x20')](_0x417fd6)[_0x4dc5('0x21')](function(_0x1d03ef){return _0x1d03ef;});}return null;};}function removeEntity(_0x2a4b57,_0x2c2ed6){return function(_0x3a971e){if(_0x3a971e){return _0x3a971e[_0x4dc5('0x22')]()[_0x4dc5('0x21')](function(){var _0x582ae6=_0x3a971e[_0x4dc5('0x23')]({'plain':!![]});var _0x44309f=_0x4dc5('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x44309f,'resourceId':_0x582ae6['id']}})['then'](function(){return _0x3a971e;});})[_0x4dc5('0x21')](function(){_0x2a4b57[_0x4dc5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a16db,_0x4fe658){return function(_0x7f30fd){if(!_0x7f30fd){_0x1a16db[_0x4dc5('0x16')](0x194);}return _0x7f30fd;};}function handleError(_0x31672d,_0x46f722){_0x46f722=_0x46f722||0x1f4;return function(_0x42819e){logger['error'](_0x42819e[_0x4dc5('0x25')]);if(_0x42819e[_0x4dc5('0x26')]){delete _0x42819e[_0x4dc5('0x26')];}_0x31672d['status'](_0x46f722)[_0x4dc5('0x27')](_0x42819e);};}exports[_0x4dc5('0x28')]=function(_0x1fe7f7,_0x16f150){var _0x633733={},_0x5c2fa0={},_0xb849c5={'count':0x0,'rows':[]};var _0x11eee2=_[_0x4dc5('0x29')](db['Interval'][_0x4dc5('0x2a')],function(_0x35d713){return{'name':_0x35d713[_0x4dc5('0x2b')],'type':_0x35d713['type'][_0x4dc5('0x2c')]};});_0x5c2fa0['model']=_[_0x4dc5('0x29')](_0x11eee2,_0x4dc5('0x26'));_0x5c2fa0[_0x4dc5('0x2d')]=_['keys'](_0x1fe7f7['query']);_0x5c2fa0[_0x4dc5('0x2e')]=_[_0x4dc5('0x2f')](_0x5c2fa0[_0x4dc5('0x30')],_0x5c2fa0['query']);_0x633733[_0x4dc5('0x31')]=_[_0x4dc5('0x2f')](_0x5c2fa0[_0x4dc5('0x30')],qs['fields'](_0x1fe7f7[_0x4dc5('0x2d')][_0x4dc5('0x32')]));_0x633733['attributes']=_0x633733[_0x4dc5('0x31')][_0x4dc5('0x33')]?_0x633733['attributes']:_0x5c2fa0[_0x4dc5('0x30')];if(!_0x1fe7f7['query'][_0x4dc5('0x34')](_0x4dc5('0x35'))){_0x633733[_0x4dc5('0x19')]=qs[_0x4dc5('0x19')](_0x1fe7f7['query'][_0x4dc5('0x19')]);_0x633733[_0x4dc5('0x1b')]=qs['offset'](_0x1fe7f7[_0x4dc5('0x2d')][_0x4dc5('0x1b')]);}_0x633733['order']=qs['sort'](_0x1fe7f7[_0x4dc5('0x2d')]['sort']);_0x633733[_0x4dc5('0x36')]=qs['filters'](_[_0x4dc5('0x37')](_0x1fe7f7[_0x4dc5('0x2d')],_0x5c2fa0[_0x4dc5('0x2e')]),_0x11eee2);if(_0x1fe7f7['query']['filter']){_0x633733[_0x4dc5('0x36')]=_['merge'](_0x633733[_0x4dc5('0x36')],{'$or':_[_0x4dc5('0x29')](_0x11eee2,function(_0x49e9ff){if(_0x49e9ff[_0x4dc5('0x38')]!==_0x4dc5('0x39')){var _0x32dea7={};_0x32dea7[_0x49e9ff[_0x4dc5('0x26')]]={'$like':'%'+_0x1fe7f7[_0x4dc5('0x2d')][_0x4dc5('0x3a')]+'%'};return _0x32dea7;}})});}_0x633733=_[_0x4dc5('0x3b')]({},_0x633733,_0x1fe7f7['options']);var _0x47b071={'where':_0x633733[_0x4dc5('0x36')]};return db[_0x4dc5('0x3c')][_0x4dc5('0x1a')](_0x47b071)['then'](function(_0x42f7f8){_0xb849c5[_0x4dc5('0x1a')]=_0x42f7f8;if(_0x1fe7f7[_0x4dc5('0x2d')][_0x4dc5('0x3d')]){_0x633733[_0x4dc5('0x3e')]=[{'all':!![]}];}return db[_0x4dc5('0x3c')]['findAll'](_0x633733);})[_0x4dc5('0x21')](function(_0x376f03){_0xb849c5[_0x4dc5('0x3f')]=_0x376f03;return _0xb849c5;})[_0x4dc5('0x21')](respondWithFilteredResult(_0x16f150,_0x633733))[_0x4dc5('0x40')](handleError(_0x16f150,null));};exports[_0x4dc5('0x41')]=function(_0x379a18,_0x394959){var _0x1d4934={'raw':!![],'where':{'id':_0x379a18[_0x4dc5('0x42')]['id']}},_0x33e9df={};_0x33e9df[_0x4dc5('0x30')]=_[_0x4dc5('0x43')](db[_0x4dc5('0x3c')][_0x4dc5('0x2a')]);_0x33e9df[_0x4dc5('0x2d')]=_[_0x4dc5('0x43')](_0x379a18[_0x4dc5('0x2d')]);_0x33e9df[_0x4dc5('0x2e')]=_['intersection'](_0x33e9df['model'],_0x33e9df[_0x4dc5('0x2d')]);_0x1d4934[_0x4dc5('0x31')]=_[_0x4dc5('0x2f')](_0x33e9df[_0x4dc5('0x30')],qs[_0x4dc5('0x32')](_0x379a18['query'][_0x4dc5('0x32')]));_0x1d4934[_0x4dc5('0x31')]=_0x1d4934[_0x4dc5('0x31')][_0x4dc5('0x33')]?_0x1d4934[_0x4dc5('0x31')]:_0x33e9df[_0x4dc5('0x30')];if(_0x379a18[_0x4dc5('0x2d')]['includeAll']){_0x1d4934['include']=[{'all':!![]}];}_0x1d4934=_[_0x4dc5('0x3b')]({},_0x1d4934,_0x379a18[_0x4dc5('0x44')]);return db[_0x4dc5('0x3c')]['find'](_0x1d4934)['then'](handleEntityNotFound(_0x394959,null))[_0x4dc5('0x21')](respondWithResult(_0x394959,null))['catch'](handleError(_0x394959,null));};exports[_0x4dc5('0x45')]=function(_0x58148d,_0x3fa870){return db['Interval'][_0x4dc5('0x45')](_0x58148d[_0x4dc5('0x46')],{})[_0x4dc5('0x21')](function(_0x21a511){var _0x26024f=_0x58148d[_0x4dc5('0x47')][_0x4dc5('0x23')]({'plain':!![]});if(!_0x26024f)throw new Error(_0x4dc5('0x48'));if(_0x26024f[_0x4dc5('0x49')]===_0x4dc5('0x47')){var _0x43bc4d=_0x21a511['get']({'plain':!![]});var _0x5b3a3c=_0x4dc5('0x24');return db['UserProfileSection'][_0x4dc5('0x4a')]({'where':{'name':_0x5b3a3c,'userProfileId':_0x26024f[_0x4dc5('0x4b')]},'raw':!![]})[_0x4dc5('0x21')](function(_0x278168){if(_0x278168&&_0x278168[_0x4dc5('0x4c')]===0x0){return db[_0x4dc5('0x4d')][_0x4dc5('0x45')]({'name':_0x43bc4d[_0x4dc5('0x26')],'resourceId':_0x43bc4d['id'],'type':_0x278168[_0x4dc5('0x26')],'sectionId':_0x278168['id']},{})[_0x4dc5('0x21')](function(){return _0x21a511;});}else{return _0x21a511;}})[_0x4dc5('0x40')](function(_0x45433b){logger[_0x4dc5('0x4e')](_0x4dc5('0x4f'),_0x45433b);throw _0x45433b;});}return _0x21a511;})[_0x4dc5('0x21')](respondWithResult(_0x3fa870,0xc9))[_0x4dc5('0x40')](handleError(_0x3fa870,null));};exports[_0x4dc5('0x20')]=function(_0x474d9d,_0x595d46){if(_0x474d9d[_0x4dc5('0x46')]['id']){delete _0x474d9d[_0x4dc5('0x46')]['id'];}return db[_0x4dc5('0x3c')][_0x4dc5('0x4a')]({'where':{'id':_0x474d9d['params']['id']}})[_0x4dc5('0x21')](handleEntityNotFound(_0x595d46,null))['then'](saveUpdates(_0x474d9d[_0x4dc5('0x46')],null))[_0x4dc5('0x21')](respondWithResult(_0x595d46,null))[_0x4dc5('0x40')](handleError(_0x595d46,null));};exports[_0x4dc5('0x22')]=function(_0x58bd82,_0x5b132c){return db[_0x4dc5('0x3c')]['find']({'where':{'id':_0x58bd82['params']['id']}})[_0x4dc5('0x21')](handleEntityNotFound(_0x5b132c,null))[_0x4dc5('0x21')](removeEntity(_0x5b132c,null))[_0x4dc5('0x40')](handleError(_0x5b132c,null));};exports[_0x4dc5('0x50')]=function(_0x52b760,_0x4b11ff,_0x3901f8){if(_0x52b760['body']['id']){delete _0x52b760[_0x4dc5('0x46')]['id'];}return db[_0x4dc5('0x3c')][_0x4dc5('0x4a')]({'where':{'id':_0x52b760[_0x4dc5('0x42')]['id']}})[_0x4dc5('0x21')](handleEntityNotFound(_0x4b11ff,null))[_0x4dc5('0x21')](function(_0x5053f8){if(_0x5053f8){_0x52b760[_0x4dc5('0x46')][_0x4dc5('0x51')]=_0x5053f8['id'];return db[_0x4dc5('0x3c')]['create'](_0x52b760[_0x4dc5('0x46')]);}})['then'](respondWithResult(_0x4b11ff,null))[_0x4dc5('0x40')](handleError(_0x4b11ff,null));};exports['getIntervals']=function(_0x58ec08,_0x1e1a8e,_0x384a0c){var _0x22c015={};var _0x23f436={};var _0x463d8f;var _0x121658;return db['Interval'][_0x4dc5('0x52')]({'where':{'id':_0x58ec08[_0x4dc5('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1a8e,null))[_0x4dc5('0x21')](function(_0x5039a0){if(_0x5039a0){_0x463d8f=_0x5039a0;_0x23f436[_0x4dc5('0x30')]=_[_0x4dc5('0x43')](db[_0x4dc5('0x3c')]['rawAttributes']);_0x23f436[_0x4dc5('0x2d')]=_[_0x4dc5('0x43')](_0x58ec08[_0x4dc5('0x2d')]);_0x23f436[_0x4dc5('0x2e')]=_[_0x4dc5('0x2f')](_0x23f436[_0x4dc5('0x30')],_0x23f436[_0x4dc5('0x2d')]);_0x22c015[_0x4dc5('0x31')]=_[_0x4dc5('0x2f')](_0x23f436[_0x4dc5('0x30')],qs[_0x4dc5('0x32')](_0x58ec08[_0x4dc5('0x2d')][_0x4dc5('0x32')]));_0x22c015[_0x4dc5('0x31')]=_0x22c015[_0x4dc5('0x31')][_0x4dc5('0x33')]?_0x22c015[_0x4dc5('0x31')]:_0x23f436['model'];_0x22c015['order']=qs[_0x4dc5('0x53')](_0x58ec08['query'][_0x4dc5('0x53')]);_0x22c015['where']=qs[_0x4dc5('0x2e')](_[_0x4dc5('0x37')](_0x58ec08['query'],_0x23f436[_0x4dc5('0x2e')]));if(_0x58ec08[_0x4dc5('0x2d')]['filter']){_0x22c015[_0x4dc5('0x36')]=_[_0x4dc5('0x3b')](_0x22c015[_0x4dc5('0x36')],{'$or':_[_0x4dc5('0x29')](_0x22c015[_0x4dc5('0x31')],function(_0xd4c39b){var _0x435ece={};_0x435ece[_0xd4c39b]={'$like':'%'+_0x58ec08[_0x4dc5('0x2d')][_0x4dc5('0x3a')]+'%'};return _0x435ece;})});}_0x22c015=_[_0x4dc5('0x3b')]({},_0x22c015,_0x58ec08['options']);return _0x463d8f[_0x4dc5('0x54')](_0x22c015);}})[_0x4dc5('0x21')](function(_0x58dfde){if(_0x58dfde){_0x121658=_0x58dfde[_0x4dc5('0x33')];if(!_0x58ec08[_0x4dc5('0x2d')][_0x4dc5('0x34')]('nolimit')){_0x22c015['limit']=qs[_0x4dc5('0x19')](_0x58ec08[_0x4dc5('0x2d')][_0x4dc5('0x19')]);_0x22c015[_0x4dc5('0x1b')]=qs[_0x4dc5('0x1b')](_0x58ec08[_0x4dc5('0x2d')][_0x4dc5('0x1b')]);}return _0x463d8f[_0x4dc5('0x54')](_0x22c015);}})[_0x4dc5('0x21')](function(_0x47d71a){if(_0x47d71a){return _0x47d71a?{'count':_0x121658,'rows':_0x47d71a}:null;}})['then'](respondWithResult(_0x1e1a8e,null))[_0x4dc5('0x40')](handleError(_0x1e1a8e,null));};exports[_0x4dc5('0x55')]=function(_0x8472bd,_0x555c0e,_0x4d00f3){return db['Interval'][_0x4dc5('0x52')]({'where':{'id':_0x8472bd[_0x4dc5('0x42')]['id']}})[_0x4dc5('0x21')](handleEntityNotFound(_0x555c0e,null))['then'](function(_0x32d4c8){if(_0x32d4c8){return db['sequelize'][_0x4dc5('0x56')](function(_0x451679){return db[_0x4dc5('0x3c')][_0x4dc5('0x22')]({'where':{'IntervalId':_0x8472bd[_0x4dc5('0x42')]['id']},'transaction':_0x451679})[_0x4dc5('0x21')](function(_0x3c7361){var _0x28327e=_[_0x4dc5('0x29')](_0x8472bd[_0x4dc5('0x46')],function(_0x2493dd){delete _0x2493dd['id'];_0x2493dd[_0x4dc5('0x51')]=_0x8472bd[_0x4dc5('0x42')]['id'];return _0x2493dd;});return db[_0x4dc5('0x3c')][_0x4dc5('0x57')](_0x28327e,{'transaction':_0x451679});});})[_0x4dc5('0x21')](function(){return db[_0x4dc5('0x3c')][_0x4dc5('0x58')]({'where':{'IntervalId':_0x8472bd[_0x4dc5('0x42')]['id']}});});}})[_0x4dc5('0x21')](respondWithResult(_0x555c0e,null))[_0x4dc5('0x40')](handleError(_0x555c0e,null));}; \ No newline at end of file +var _0x3b99=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','then','end','stack','name','index','map','Interval','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','role','Intervals','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','nolimit','transaction','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5f47b6,_0xdfe79d){var _0x31bb2d=function(_0x32e3ca){while(--_0x32e3ca){_0x5f47b6['push'](_0x5f47b6['shift']());}};_0x31bb2d(++_0xdfe79d);}(_0x3b99,0x9b));var _0x93b9=function(_0x93b863,_0x2bbe3b){_0x93b863=_0x93b863-0x0;var _0x1dff77=_0x3b99[_0x93b863];return _0x1dff77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93b9('0x0'));var zipdir=require(_0x93b9('0x1'));var jsonpatch=require(_0x93b9('0x2'));var rp=require(_0x93b9('0x3'));var moment=require(_0x93b9('0x4'));var BPromise=require(_0x93b9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x93b9('0x6'));var sox=require(_0x93b9('0x7'));var csv=require('to-csv');var ejs=require(_0x93b9('0x8'));var fs=require('fs');var fs_extra=require(_0x93b9('0x9'));var _=require('lodash');var squel=require(_0x93b9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x93b9('0xb'));var toCsv=require(_0x93b9('0xc'));var querystring=require(_0x93b9('0xd'));var Papa=require(_0x93b9('0xe'));var Redis=require(_0x93b9('0xf'));var authService=require(_0x93b9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x93b9('0x11'));var hardwareService=require(_0x93b9('0x12'));var logger=require(_0x93b9('0x13'))(_0x93b9('0x14'));var utils=require('../../config/utils');var config=require(_0x93b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x93b9('0x16'))['db'];var extensions=require(_0x93b9('0x17'));function respondWithStatusCode(_0x21e937,_0x5e29a9){_0x5e29a9=_0x5e29a9||0xcc;return function(_0x3556b5){if(_0x3556b5){return _0x21e937[_0x93b9('0x18')](_0x5e29a9);}return _0x21e937[_0x93b9('0x19')](_0x5e29a9)['end']();};}function respondWithResult(_0x8cb426,_0x3cdf1d){_0x3cdf1d=_0x3cdf1d||0xc8;return function(_0x45decb){if(_0x45decb){return _0x8cb426['status'](_0x3cdf1d)[_0x93b9('0x1a')](_0x45decb);}};}function respondWithFilteredResult(_0x205afd,_0x1789cf){return function(_0x1941fa){if(_0x1941fa){var _0x32609b=typeof _0x1789cf[_0x93b9('0x1b')]===_0x93b9('0x1c')&&typeof _0x1789cf[_0x93b9('0x1d')]===_0x93b9('0x1c');var _0x2fbca3=_0x1941fa[_0x93b9('0x1e')];var _0x8cd9d6=_0x32609b?0x0:_0x1789cf[_0x93b9('0x1b')];var _0xfb5300=_0x32609b?_0x1941fa[_0x93b9('0x1e')]:_0x1789cf['offset']+_0x1789cf[_0x93b9('0x1d')];var _0x11e1d1;if(_0xfb5300>=_0x2fbca3){_0xfb5300=_0x2fbca3;_0x11e1d1=0xc8;}else{_0x11e1d1=0xce;}_0x205afd[_0x93b9('0x19')](_0x11e1d1);return _0x205afd[_0x93b9('0x1f')](_0x93b9('0x20'),_0x8cd9d6+'-'+_0xfb5300+'/'+_0x2fbca3)[_0x93b9('0x1a')](_0x1941fa);}return null;};}function patchUpdates(_0xcb2739){return function(_0x336237){try{jsonpatch[_0x93b9('0x21')](_0x336237,_0xcb2739,!![]);}catch(_0x5329f3){return BPromise[_0x93b9('0x22')](_0x5329f3);}return _0x336237['save']();};}function saveUpdates(_0xb73d22,_0x14342c){return function(_0x375208){if(_0x375208){return _0x375208[_0x93b9('0x23')](_0xb73d22)['then'](function(_0x4775bd){return _0x4775bd;});}return null;};}function removeEntity(_0x35c2a2,_0x30f5b2){return function(_0xe43b34){if(_0xe43b34){return _0xe43b34[_0x93b9('0x24')]()['then'](function(){var _0x1863ce=_0xe43b34[_0x93b9('0x25')]({'plain':!![]});var _0xbb454e='Intervals';return db['UserProfileResource'][_0x93b9('0x24')]({'where':{'type':_0xbb454e,'resourceId':_0x1863ce['id']}})[_0x93b9('0x26')](function(){return _0xe43b34;});})[_0x93b9('0x26')](function(){_0x35c2a2[_0x93b9('0x19')](0xcc)[_0x93b9('0x27')]();});}};}function handleEntityNotFound(_0x197ba9,_0x3d5005){return function(_0x570ef9){if(!_0x570ef9){_0x197ba9[_0x93b9('0x18')](0x194);}return _0x570ef9;};}function handleError(_0x279047,_0x457546){_0x457546=_0x457546||0x1f4;return function(_0x2946ed){logger['error'](_0x2946ed[_0x93b9('0x28')]);if(_0x2946ed[_0x93b9('0x29')]){delete _0x2946ed[_0x93b9('0x29')];}_0x279047[_0x93b9('0x19')](_0x457546)['send'](_0x2946ed);};}exports[_0x93b9('0x2a')]=function(_0x4228b4,_0x36a7f8){var _0x940293={},_0x1b0eb6={},_0x2d9b1e={'count':0x0,'rows':[]};var _0x282e47=_[_0x93b9('0x2b')](db[_0x93b9('0x2c')][_0x93b9('0x2d')],function(_0x24e70c){return{'name':_0x24e70c['fieldName'],'type':_0x24e70c[_0x93b9('0x2e')]['key']};});_0x1b0eb6[_0x93b9('0x2f')]=_[_0x93b9('0x2b')](_0x282e47,_0x93b9('0x29'));_0x1b0eb6[_0x93b9('0x30')]=_[_0x93b9('0x31')](_0x4228b4[_0x93b9('0x30')]);_0x1b0eb6[_0x93b9('0x32')]=_[_0x93b9('0x33')](_0x1b0eb6[_0x93b9('0x2f')],_0x1b0eb6[_0x93b9('0x30')]);_0x940293['attributes']=_[_0x93b9('0x33')](_0x1b0eb6[_0x93b9('0x2f')],qs['fields'](_0x4228b4[_0x93b9('0x30')][_0x93b9('0x34')]));_0x940293[_0x93b9('0x35')]=_0x940293['attributes'][_0x93b9('0x36')]?_0x940293[_0x93b9('0x35')]:_0x1b0eb6[_0x93b9('0x2f')];if(!_0x4228b4[_0x93b9('0x30')]['hasOwnProperty']('nolimit')){_0x940293[_0x93b9('0x1d')]=qs[_0x93b9('0x1d')](_0x4228b4['query'][_0x93b9('0x1d')]);_0x940293['offset']=qs[_0x93b9('0x1b')](_0x4228b4[_0x93b9('0x30')][_0x93b9('0x1b')]);}_0x940293[_0x93b9('0x37')]=qs[_0x93b9('0x38')](_0x4228b4[_0x93b9('0x30')][_0x93b9('0x38')]);_0x940293[_0x93b9('0x39')]=qs[_0x93b9('0x32')](_[_0x93b9('0x3a')](_0x4228b4[_0x93b9('0x30')],_0x1b0eb6['filters']),_0x282e47);if(_0x4228b4[_0x93b9('0x30')][_0x93b9('0x3b')]){_0x940293[_0x93b9('0x39')]=_[_0x93b9('0x3c')](_0x940293[_0x93b9('0x39')],{'$or':_[_0x93b9('0x2b')](_0x282e47,function(_0x252974){if(_0x252974[_0x93b9('0x2e')]!==_0x93b9('0x3d')){var _0x823cdd={};_0x823cdd[_0x252974['name']]={'$like':'%'+_0x4228b4[_0x93b9('0x30')][_0x93b9('0x3b')]+'%'};return _0x823cdd;}})});}_0x940293=_['merge']({},_0x940293,_0x4228b4[_0x93b9('0x3e')]);var _0x1d3508={'where':_0x940293[_0x93b9('0x39')]};return db['Interval'][_0x93b9('0x1e')](_0x1d3508)[_0x93b9('0x26')](function(_0x4ffe00){_0x2d9b1e['count']=_0x4ffe00;if(_0x4228b4[_0x93b9('0x30')]['includeAll']){_0x940293[_0x93b9('0x3f')]=[{'all':!![]}];}return db[_0x93b9('0x2c')][_0x93b9('0x40')](_0x940293);})[_0x93b9('0x26')](function(_0x11fc63){_0x2d9b1e[_0x93b9('0x41')]=_0x11fc63;return _0x2d9b1e;})[_0x93b9('0x26')](respondWithFilteredResult(_0x36a7f8,_0x940293))[_0x93b9('0x42')](handleError(_0x36a7f8,null));};exports[_0x93b9('0x43')]=function(_0x24b740,_0x5676fc){var _0x589ba4={'raw':!![],'where':{'id':_0x24b740[_0x93b9('0x44')]['id']}},_0x3356a1={};_0x3356a1[_0x93b9('0x2f')]=_['keys'](db['Interval']['rawAttributes']);_0x3356a1[_0x93b9('0x30')]=_[_0x93b9('0x31')](_0x24b740[_0x93b9('0x30')]);_0x3356a1[_0x93b9('0x32')]=_['intersection'](_0x3356a1[_0x93b9('0x2f')],_0x3356a1[_0x93b9('0x30')]);_0x589ba4['attributes']=_[_0x93b9('0x33')](_0x3356a1[_0x93b9('0x2f')],qs[_0x93b9('0x34')](_0x24b740[_0x93b9('0x30')][_0x93b9('0x34')]));_0x589ba4[_0x93b9('0x35')]=_0x589ba4[_0x93b9('0x35')][_0x93b9('0x36')]?_0x589ba4['attributes']:_0x3356a1[_0x93b9('0x2f')];if(_0x24b740[_0x93b9('0x30')]['includeAll']){_0x589ba4[_0x93b9('0x3f')]=[{'all':!![]}];}_0x589ba4=_[_0x93b9('0x3c')]({},_0x589ba4,_0x24b740[_0x93b9('0x3e')]);return db[_0x93b9('0x2c')][_0x93b9('0x45')](_0x589ba4)[_0x93b9('0x26')](handleEntityNotFound(_0x5676fc,null))[_0x93b9('0x26')](respondWithResult(_0x5676fc,null))[_0x93b9('0x42')](handleError(_0x5676fc,null));};exports[_0x93b9('0x46')]=function(_0x508137,_0x31d17c){return db['Interval'][_0x93b9('0x46')](_0x508137['body'],{})['then'](function(_0x133ff6){var _0x81966c=_0x508137['user'][_0x93b9('0x25')]({'plain':!![]});if(!_0x81966c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x81966c[_0x93b9('0x47')]==='user'){var _0x14e879=_0x133ff6[_0x93b9('0x25')]({'plain':!![]});var _0x2912d3=_0x93b9('0x48');return db[_0x93b9('0x49')]['find']({'where':{'name':_0x2912d3,'userProfileId':_0x81966c['userProfileId']},'raw':!![]})[_0x93b9('0x26')](function(_0x41c330){if(_0x41c330&&_0x41c330[_0x93b9('0x4a')]===0x0){return db[_0x93b9('0x4b')]['create']({'name':_0x14e879[_0x93b9('0x29')],'resourceId':_0x14e879['id'],'type':_0x41c330[_0x93b9('0x29')],'sectionId':_0x41c330['id']},{})[_0x93b9('0x26')](function(){return _0x133ff6;});}else{return _0x133ff6;}})[_0x93b9('0x42')](function(_0x4ab6ea){logger[_0x93b9('0x4c')](_0x93b9('0x4d'),_0x4ab6ea);throw _0x4ab6ea;});}return _0x133ff6;})[_0x93b9('0x26')](respondWithResult(_0x31d17c,0xc9))[_0x93b9('0x42')](handleError(_0x31d17c,null));};exports[_0x93b9('0x23')]=function(_0x2029ef,_0x20b2f2){if(_0x2029ef[_0x93b9('0x4e')]['id']){delete _0x2029ef[_0x93b9('0x4e')]['id'];}return db['Interval'][_0x93b9('0x45')]({'where':{'id':_0x2029ef[_0x93b9('0x44')]['id']}})[_0x93b9('0x26')](handleEntityNotFound(_0x20b2f2,null))['then'](saveUpdates(_0x2029ef['body'],null))['then'](respondWithResult(_0x20b2f2,null))[_0x93b9('0x42')](handleError(_0x20b2f2,null));};exports[_0x93b9('0x24')]=function(_0xe64dca,_0x42b5d8){return db['Interval'][_0x93b9('0x45')]({'where':{'id':_0xe64dca[_0x93b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x42b5d8,null))[_0x93b9('0x26')](removeEntity(_0x42b5d8,null))[_0x93b9('0x42')](handleError(_0x42b5d8,null));};exports[_0x93b9('0x4f')]=function(_0x350c8e,_0x450b7f,_0x5d5d04){if(_0x350c8e[_0x93b9('0x4e')]['id']){delete _0x350c8e[_0x93b9('0x4e')]['id'];}return db[_0x93b9('0x2c')][_0x93b9('0x45')]({'where':{'id':_0x350c8e['params']['id']}})[_0x93b9('0x26')](handleEntityNotFound(_0x450b7f,null))[_0x93b9('0x26')](function(_0x4bc9af){if(_0x4bc9af){_0x350c8e[_0x93b9('0x4e')][_0x93b9('0x50')]=_0x4bc9af['id'];return db[_0x93b9('0x2c')][_0x93b9('0x46')](_0x350c8e[_0x93b9('0x4e')]);}})[_0x93b9('0x26')](respondWithResult(_0x450b7f,null))['catch'](handleError(_0x450b7f,null));};exports[_0x93b9('0x51')]=function(_0x3d4941,_0x466440,_0x5a1870){var _0x386fe7={};var _0x3d69a5={};var _0x1b5484;var _0x30ad11;return db[_0x93b9('0x2c')][_0x93b9('0x52')]({'where':{'id':_0x3d4941[_0x93b9('0x44')]['id']}})[_0x93b9('0x26')](handleEntityNotFound(_0x466440,null))[_0x93b9('0x26')](function(_0x519ea8){if(_0x519ea8){_0x1b5484=_0x519ea8;_0x3d69a5[_0x93b9('0x2f')]=_[_0x93b9('0x31')](db[_0x93b9('0x2c')][_0x93b9('0x2d')]);_0x3d69a5[_0x93b9('0x30')]=_[_0x93b9('0x31')](_0x3d4941[_0x93b9('0x30')]);_0x3d69a5[_0x93b9('0x32')]=_[_0x93b9('0x33')](_0x3d69a5[_0x93b9('0x2f')],_0x3d69a5[_0x93b9('0x30')]);_0x386fe7[_0x93b9('0x35')]=_['intersection'](_0x3d69a5['model'],qs[_0x93b9('0x34')](_0x3d4941[_0x93b9('0x30')][_0x93b9('0x34')]));_0x386fe7[_0x93b9('0x35')]=_0x386fe7[_0x93b9('0x35')][_0x93b9('0x36')]?_0x386fe7[_0x93b9('0x35')]:_0x3d69a5['model'];_0x386fe7['order']=qs['sort'](_0x3d4941[_0x93b9('0x30')][_0x93b9('0x38')]);_0x386fe7[_0x93b9('0x39')]=qs[_0x93b9('0x32')](_['pick'](_0x3d4941[_0x93b9('0x30')],_0x3d69a5[_0x93b9('0x32')]));if(_0x3d4941[_0x93b9('0x30')]['filter']){_0x386fe7[_0x93b9('0x39')]=_[_0x93b9('0x3c')](_0x386fe7[_0x93b9('0x39')],{'$or':_[_0x93b9('0x2b')](_0x386fe7['attributes'],function(_0x1fec3f){var _0x21ae2d={};_0x21ae2d[_0x1fec3f]={'$like':'%'+_0x3d4941[_0x93b9('0x30')][_0x93b9('0x3b')]+'%'};return _0x21ae2d;})});}_0x386fe7=_[_0x93b9('0x3c')]({},_0x386fe7,_0x3d4941['options']);return _0x1b5484[_0x93b9('0x51')](_0x386fe7);}})[_0x93b9('0x26')](function(_0x7e15fa){if(_0x7e15fa){_0x30ad11=_0x7e15fa[_0x93b9('0x36')];if(!_0x3d4941[_0x93b9('0x30')][_0x93b9('0x53')](_0x93b9('0x54'))){_0x386fe7['limit']=qs[_0x93b9('0x1d')](_0x3d4941[_0x93b9('0x30')][_0x93b9('0x1d')]);_0x386fe7[_0x93b9('0x1b')]=qs[_0x93b9('0x1b')](_0x3d4941[_0x93b9('0x30')][_0x93b9('0x1b')]);}return _0x1b5484['getIntervals'](_0x386fe7);}})['then'](function(_0x4f350c){if(_0x4f350c){return _0x4f350c?{'count':_0x30ad11,'rows':_0x4f350c}:null;}})['then'](respondWithResult(_0x466440,null))[_0x93b9('0x42')](handleError(_0x466440,null));};exports['addIntervals']=function(_0x1e7bd1,_0x476da5,_0x39e84b){return db[_0x93b9('0x2c')]['findOne']({'where':{'id':_0x1e7bd1['params']['id']}})[_0x93b9('0x26')](handleEntityNotFound(_0x476da5,null))[_0x93b9('0x26')](function(_0x2c9555){if(_0x2c9555){return db['sequelize'][_0x93b9('0x55')](function(_0x1e7d30){return db[_0x93b9('0x2c')][_0x93b9('0x24')]({'where':{'IntervalId':_0x1e7bd1['params']['id']},'transaction':_0x1e7d30})[_0x93b9('0x26')](function(_0x2d2c5b){var _0x1acc39=_[_0x93b9('0x2b')](_0x1e7bd1['body'],function(_0x916576){delete _0x916576['id'];_0x916576[_0x93b9('0x50')]=_0x1e7bd1[_0x93b9('0x44')]['id'];return _0x916576;});return db[_0x93b9('0x2c')]['bulkCreate'](_0x1acc39,{'transaction':_0x1e7d30});});})['then'](function(){return db[_0x93b9('0x2c')][_0x93b9('0x40')]({'where':{'IntervalId':_0x1e7bd1[_0x93b9('0x44')]['id']}});});}})['then'](respondWithResult(_0x476da5,null))[_0x93b9('0x42')](handleError(_0x476da5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6a3ac37..d8e5963 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 _0x9817=['../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','then','all','map','./interval.attributes'];(function(_0x528ba1,_0x481d0d){var _0x30127f=function(_0x23016c){while(--_0x23016c){_0x528ba1['push'](_0x528ba1['shift']());}};_0x30127f(++_0x481d0d);}(_0x9817,0x11d));var _0x7981=function(_0x3375b2,_0x571d5a){_0x3375b2=_0x3375b2-0x0;var _0x3fbd8e=_0x9817[_0x3375b2];return _0x3fbd8e;};'use strict';var attributes=require(_0x7981('0x0'));var extensions=require(_0x7981('0x1'));var iftime=require(_0x7981('0x2'))['iftime'];module[_0x7981('0x3')]=function(_0x1a46ce){return _0x1a46ce[_0x7981('0x4')](_0x7981('0x5'),attributes,{'tableName':_0x7981('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a31d7){extensions[_0x7981('0x7')](_0x1a46ce,_0x5a31d7);},'afterBulkCreate':function(_0x45238a,_0x4b6e87,_0xaf58c0){_0xaf58c0();extensions[_0x7981('0x7')](_0x1a46ce,_0x45238a[0x0]);},'afterUpdate':function(_0xbb9d31){extensions['rewrite'](_0x1a46ce,_0xbb9d31);},'afterDestroy':function(_0x1a667f){extensions[_0x7981('0x7')](_0x1a46ce,_0x1a667f);}},'instanceMethods':{'ifTime':function(_0x1379cd=undefined,_0x26fa65=new Date()){if(typeof this[_0x7981('0x8')]===_0x7981('0x9')){return iftime(this[_0x7981('0x8')],_0x1379cd,_0x26fa65);}else{return this['getIntervals']()[_0x7981('0xa')](function(_0x38321e){return Promise[_0x7981('0xb')](_0x38321e[_0x7981('0xc')](function(_0x2206ae){return _0x2206ae['ifTime'](_0x1379cd,_0x26fa65);}));})['then'](function(_0xa39894){return _0xa39894['reduce'](function(_0x24043c,_0x1b8356){return _0x24043c||_0x1b8356;},![]);});}}}});}; \ No newline at end of file +var _0xc729=['string','getIntervals','all','map','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval'];(function(_0x143682,_0x22cfa8){var _0x5712c3=function(_0x11cec6){while(--_0x11cec6){_0x143682['push'](_0x143682['shift']());}};_0x5712c3(++_0x22cfa8);}(_0xc729,0x186));var _0x9c72=function(_0x4a7a50,_0xccc04b){_0x4a7a50=_0x4a7a50-0x0;var _0x341a9a=_0xc729[_0x4a7a50];return _0x341a9a;};'use strict';var attributes=require(_0x9c72('0x0'));var extensions=require(_0x9c72('0x1'));var iftime=require(_0x9c72('0x2'))[_0x9c72('0x3')];module[_0x9c72('0x4')]=function(_0x18693c){return _0x18693c[_0x9c72('0x5')](_0x9c72('0x6'),attributes,{'tableName':_0x9c72('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5754f3){extensions[_0x9c72('0x8')](_0x18693c,_0x5754f3);},'afterBulkCreate':function(_0x2b04ed,_0x39e643,_0x5f0d9f){_0x5f0d9f();extensions[_0x9c72('0x8')](_0x18693c,_0x2b04ed[0x0]);},'afterUpdate':function(_0x231513){extensions[_0x9c72('0x8')](_0x18693c,_0x231513);},'afterDestroy':function(_0x557035){extensions[_0x9c72('0x8')](_0x18693c,_0x557035);}},'instanceMethods':{'ifTime':function(_0x15687b=undefined,_0x30d3ec=new Date()){if(typeof this[_0x9c72('0x9')]===_0x9c72('0xa')){return iftime(this['interval'],_0x15687b,_0x30d3ec);}else{return this[_0x9c72('0xb')]()['then'](function(_0x48bb95){return Promise[_0x9c72('0xc')](_0x48bb95[_0x9c72('0xd')](function(_0x515625){return _0x515625['ifTime'](_0x15687b,_0x30d3ec);}));})[_0x9c72('0xe')](function(_0x39e177){return _0x39e177[_0x9c72('0xf')](function(_0x1833c7,_0x3fc3ef){return _0x1833c7||_0x3fc3ef;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 46859de..9edeba9 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 _0x4ebf=['isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','lodash','../../mysqldb','../../utils/iftime','GetInterval','Interval','findAll','options','raw','where','attributes','limit','map','include','model','then','info','debug','catch','message','error','ShowInterval','find','all','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','ifTime','IntervalIftime'];(function(_0x350a01,_0x5ed763){var _0xc17c6b=function(_0x31aaec){while(--_0x31aaec){_0x350a01['push'](_0x350a01['shift']());}};_0xc17c6b(++_0x5ed763);}(_0x4ebf,0x1cc));var _0xf4eb=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x4ebf[_0x21f931];return _0x3f083c;};'use strict';var _=require(_0xf4eb('0x0'));var util=require('util');var db=require(_0xf4eb('0x1'))['db'];var iftime=require(_0xf4eb('0x2'))['iftime'];var logger=require('../../config/logger')('rpc');exports[_0xf4eb('0x3')]=function(_0x445139){var _0x14f55c=this;return new Promise(function(_0x368c71,_0x1f96bb){return db[_0xf4eb('0x4')][_0xf4eb('0x5')]({'raw':_0x445139[_0xf4eb('0x6')]?_0x445139['options'][_0xf4eb('0x7')]===undefined?!![]:![]:!![],'where':_0x445139[_0xf4eb('0x6')]?_0x445139[_0xf4eb('0x6')][_0xf4eb('0x8')]||null:null,'attributes':_0x445139[_0xf4eb('0x6')]?_0x445139[_0xf4eb('0x6')][_0xf4eb('0x9')]||null:null,'limit':_0x445139[_0xf4eb('0x6')]?_0x445139[_0xf4eb('0x6')][_0xf4eb('0xa')]||null:null,'include':_0x445139['options']?_0x445139['options']['include']?_[_0xf4eb('0xb')](_0x445139[_0xf4eb('0x6')][_0xf4eb('0xc')],function(_0x2712e2){return{'model':db[_0x2712e2[_0xf4eb('0xd')]],'as':_0x2712e2['as'],'attributes':_0x2712e2[_0xf4eb('0x9')],'include':_0x2712e2['include']?_[_0xf4eb('0xb')](_0x2712e2[_0xf4eb('0xc')],function(_0x4ecb52){return{'model':db[_0x4ecb52[_0xf4eb('0xd')]],'as':_0x4ecb52['as'],'attributes':_0x4ecb52[_0xf4eb('0x9')],'include':_0x4ecb52[_0xf4eb('0xc')]?_[_0xf4eb('0xb')](_0x4ecb52[_0xf4eb('0xc')],function(_0x33886f){return{'model':db[_0x33886f[_0xf4eb('0xd')]],'as':_0x33886f['as'],'attributes':_0x33886f[_0xf4eb('0x9')]};}):[]};}):[]};}):[]:[]})[_0xf4eb('0xe')](function(_0x12b20c){logger[_0xf4eb('0xf')](_0xf4eb('0x3'),_0x445139);logger[_0xf4eb('0x10')](_0xf4eb('0x3'),_0x445139,JSON['stringify'](_0x12b20c));_0x368c71(_0x12b20c);})[_0xf4eb('0x11')](function(_0xdb3ecb){logger['error'](_0xf4eb('0x3'),_0xdb3ecb[_0xf4eb('0x12')],_0x445139);_0x1f96bb(_0x14f55c[_0xf4eb('0x13')](0x1f4,_0xdb3ecb[_0xf4eb('0x12')]));});});};exports[_0xf4eb('0x14')]=function(_0x1a9b9a){var _0xcd59c4=this;return new Promise(function(_0x89d2e5,_0x14fa3d){return db[_0xf4eb('0x4')][_0xf4eb('0x15')]({'raw':_0x1a9b9a['options']?_0x1a9b9a['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a9b9a[_0xf4eb('0x6')]?_0x1a9b9a[_0xf4eb('0x6')]['where']||null:null,'attributes':_0x1a9b9a[_0xf4eb('0x6')]?_0x1a9b9a[_0xf4eb('0x6')]['attributes']||null:null,'include':_0x1a9b9a['options']?_0x1a9b9a[_0xf4eb('0x6')][_0xf4eb('0xc')]?_[_0xf4eb('0xb')](_0x1a9b9a[_0xf4eb('0x6')]['include'],function(_0x5a7006){return{'model':db[_0x5a7006[_0xf4eb('0xd')]],'as':_0x5a7006['as'],'attributes':_0x5a7006[_0xf4eb('0x9')],'include':_0x5a7006['include']?_['map'](_0x5a7006[_0xf4eb('0xc')],function(_0x2df285){return{'model':db[_0x2df285[_0xf4eb('0xd')]],'as':_0x2df285['as'],'attributes':_0x2df285[_0xf4eb('0x9')],'include':_0x2df285[_0xf4eb('0xc')]?_[_0xf4eb('0xb')](_0x2df285['include'],function(_0x26244f){return{'model':db[_0x26244f['model']],'as':_0x26244f['as'],'attributes':_0x26244f[_0xf4eb('0x9')]};}):[]};}):[]};}):[]:[]})[_0xf4eb('0xe')](function(_0x23eb60){logger[_0xf4eb('0xf')](_0xf4eb('0x14'),_0x1a9b9a);logger['debug'](_0xf4eb('0x14'),_0x1a9b9a,JSON['stringify'](_0x23eb60));_0x89d2e5(_0x23eb60);})[_0xf4eb('0x11')](function(_0x3b14f7){logger['error']('ShowInterval',_0x3b14f7['message'],_0x1a9b9a);_0x14fa3d(_0xcd59c4[_0xf4eb('0x13')](0x1f4,_0x3b14f7['message']));});});};function checkArrayOfIntervals(_0x3f3eae,_0x174d16){var _0x2021f0=[];return db[_0xf4eb('0x4')][_0xf4eb('0x5')]({'where':{'id':_0x3f3eae}})['then'](function(_0x5d718f){_0x2021f0=_0x5d718f;return Promise[_0xf4eb('0x16')](_0x2021f0[_0xf4eb('0xb')](function(_0x3fb539){return _0x3fb539['ifTime'](_0x174d16);}));})[_0xf4eb('0xe')](function(_0x4c65f4){var _0x4e7479=_0x4c65f4[_0xf4eb('0x17')](function(_0x1d7a7d,_0x19bead){return _0x1d7a7d||_0x19bead;},![]);logger[_0xf4eb('0xf')](util[_0xf4eb('0x18')](_0xf4eb('0x19'),_0x2021f0[_0xf4eb('0xb')](function(_0xa2b675){return _0xa2b675['name'];})[_0xf4eb('0x1a')](',\x20'),_0x2021f0['map'](function(_0xfeb319){return _0xfeb319['id'];})[_0xf4eb('0x1a')](',\x20')));return _0x4e7479;});}function checkSingleInterval(_0x30e6e6,_0x158e3f){return db[_0xf4eb('0x4')][_0xf4eb('0x1b')](_0x30e6e6)[_0xf4eb('0xe')](function(_0x452a81){if(_0x452a81){logger[_0xf4eb('0xf')](util['format'](_0xf4eb('0x1c'),_0x452a81[_0xf4eb('0x1d')],_0x452a81['id']));return _0x452a81[_0xf4eb('0x1e')](_0x158e3f);}});}exports[_0xf4eb('0x1f')]=function(_0x3fbe54){var _0x5b77b7=_0x3fbe54['intervalIds'];var _0x379914=Array[_0xf4eb('0x20')](_0x3fbe54[_0xf4eb('0x21')])?_0x3fbe54['intervals']:typeof _0x3fbe54['intervals']===_0xf4eb('0x22')?[_0x3fbe54['intervals']]:[];var _0x2bc5e8=_0x3fbe54[_0xf4eb('0x23')]||undefined;var _0x120107=![];if(_0x379914[_0xf4eb('0x24')]){logger[_0xf4eb('0xf')](util[_0xf4eb('0x18')](_0xf4eb('0x25'),_0x379914[_0xf4eb('0x1a')](';\x20')));}if(_0x2bc5e8){logger[_0xf4eb('0xf')](util[_0xf4eb('0x18')](_0xf4eb('0x26'),_0x2bc5e8));}logger[_0xf4eb('0x10')](_0xf4eb('0x27'),_0x120107);logger[_0xf4eb('0x28')]('IntervalIftime',_0x3fbe54);return Promise['resolve']()[_0xf4eb('0xe')](function(){if(Array[_0xf4eb('0x20')](_0x5b77b7)){return checkArrayOfIntervals(_0x5b77b7,_0x2bc5e8);}else if(_0x5b77b7){return checkSingleInterval(_0x5b77b7,_0x2bc5e8);}})[_0xf4eb('0xe')](function(_0x3f4308){var _0x569d96=_0x379914[_0xf4eb('0x17')](function(_0x3f2bed,_0x5ef7c2){return _0x3f2bed||iftime(_0x5ef7c2,_0x2bc5e8);},![]);_0x120107=_0x3f4308||_0x569d96;return _0x120107;})['catch'](function(_0x2add94){logger[_0xf4eb('0x13')](_0xf4eb('0x1f'),_0x3fbe54,_0x2add94);throw this[_0xf4eb('0x13')](0x1f4,_0x2add94['message']);});}; \ No newline at end of file +var _0x1e48=['find','where','info','debug','findAll','all','reduce','format','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','Interval','options','raw','include','map','model','attributes','then','stringify','catch','message','error','ShowInterval'];(function(_0x4e1584,_0xa77fc7){var _0x558c0a=function(_0x599d6f){while(--_0x599d6f){_0x4e1584['push'](_0x4e1584['shift']());}};_0x558c0a(++_0xa77fc7);}(_0x1e48,0xb6));var _0x81e4=function(_0x1fcddb,_0x304947){_0x1fcddb=_0x1fcddb-0x0;var _0x5a6b79=_0x1e48[_0x1fcddb];return _0x5a6b79;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0x81e4('0x0'))['db'];var iftime=require('../../utils/iftime')[_0x81e4('0x1')];var logger=require(_0x81e4('0x2'))(_0x81e4('0x3'));exports[_0x81e4('0x4')]=function(_0x802459){var _0x3ab8f8=this;return new Promise(function(_0x593f51,_0x9426c6){return db[_0x81e4('0x5')]['findAll']({'raw':_0x802459[_0x81e4('0x6')]?_0x802459['options'][_0x81e4('0x7')]===undefined?!![]:![]:!![],'where':_0x802459['options']?_0x802459[_0x81e4('0x6')]['where']||null:null,'attributes':_0x802459[_0x81e4('0x6')]?_0x802459[_0x81e4('0x6')]['attributes']||null:null,'limit':_0x802459['options']?_0x802459[_0x81e4('0x6')]['limit']||null:null,'include':_0x802459[_0x81e4('0x6')]?_0x802459['options'][_0x81e4('0x8')]?_[_0x81e4('0x9')](_0x802459[_0x81e4('0x6')]['include'],function(_0x1b6ed0){return{'model':db[_0x1b6ed0[_0x81e4('0xa')]],'as':_0x1b6ed0['as'],'attributes':_0x1b6ed0[_0x81e4('0xb')],'include':_0x1b6ed0[_0x81e4('0x8')]?_[_0x81e4('0x9')](_0x1b6ed0['include'],function(_0x34df16){return{'model':db[_0x34df16[_0x81e4('0xa')]],'as':_0x34df16['as'],'attributes':_0x34df16[_0x81e4('0xb')],'include':_0x34df16['include']?_[_0x81e4('0x9')](_0x34df16[_0x81e4('0x8')],function(_0x18c90a){return{'model':db[_0x18c90a[_0x81e4('0xa')]],'as':_0x18c90a['as'],'attributes':_0x18c90a['attributes']};}):[]};}):[]};}):[]:[]})[_0x81e4('0xc')](function(_0x34b712){logger['info']('GetInterval',_0x802459);logger['debug']('GetInterval',_0x802459,JSON[_0x81e4('0xd')](_0x34b712));_0x593f51(_0x34b712);})[_0x81e4('0xe')](function(_0x1fb8cb){logger['error'](_0x81e4('0x4'),_0x1fb8cb[_0x81e4('0xf')],_0x802459);_0x9426c6(_0x3ab8f8[_0x81e4('0x10')](0x1f4,_0x1fb8cb[_0x81e4('0xf')]));});});};exports[_0x81e4('0x11')]=function(_0xddfb60){var _0x462884=this;return new Promise(function(_0x588b59,_0x59fdc1){return db[_0x81e4('0x5')][_0x81e4('0x12')]({'raw':_0xddfb60[_0x81e4('0x6')]?_0xddfb60[_0x81e4('0x6')][_0x81e4('0x7')]===undefined?!![]:![]:!![],'where':_0xddfb60[_0x81e4('0x6')]?_0xddfb60[_0x81e4('0x6')][_0x81e4('0x13')]||null:null,'attributes':_0xddfb60[_0x81e4('0x6')]?_0xddfb60[_0x81e4('0x6')][_0x81e4('0xb')]||null:null,'include':_0xddfb60[_0x81e4('0x6')]?_0xddfb60[_0x81e4('0x6')][_0x81e4('0x8')]?_['map'](_0xddfb60[_0x81e4('0x6')][_0x81e4('0x8')],function(_0x1d9d6a){return{'model':db[_0x1d9d6a['model']],'as':_0x1d9d6a['as'],'attributes':_0x1d9d6a[_0x81e4('0xb')],'include':_0x1d9d6a[_0x81e4('0x8')]?_[_0x81e4('0x9')](_0x1d9d6a['include'],function(_0x2fed56){return{'model':db[_0x2fed56['model']],'as':_0x2fed56['as'],'attributes':_0x2fed56[_0x81e4('0xb')],'include':_0x2fed56[_0x81e4('0x8')]?_[_0x81e4('0x9')](_0x2fed56[_0x81e4('0x8')],function(_0xe739b0){return{'model':db[_0xe739b0[_0x81e4('0xa')]],'as':_0xe739b0['as'],'attributes':_0xe739b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x81e4('0xc')](function(_0x36b6df){logger[_0x81e4('0x14')](_0x81e4('0x11'),_0xddfb60);logger[_0x81e4('0x15')](_0x81e4('0x11'),_0xddfb60,JSON[_0x81e4('0xd')](_0x36b6df));_0x588b59(_0x36b6df);})['catch'](function(_0x4cc5d1){logger[_0x81e4('0x10')](_0x81e4('0x11'),_0x4cc5d1[_0x81e4('0xf')],_0xddfb60);_0x59fdc1(_0x462884['error'](0x1f4,_0x4cc5d1[_0x81e4('0xf')]));});});};function checkArrayOfIntervals(_0x3883b,_0x8a1cbb){var _0x42fd7d=[];return db[_0x81e4('0x5')][_0x81e4('0x16')]({'where':{'id':_0x3883b}})[_0x81e4('0xc')](function(_0x53c0bc){_0x42fd7d=_0x53c0bc;return Promise[_0x81e4('0x17')](_0x42fd7d[_0x81e4('0x9')](function(_0x5d1693){return _0x5d1693['ifTime'](_0x8a1cbb);}));})['then'](function(_0x2a2207){var _0x2518a0=_0x2a2207[_0x81e4('0x18')](function(_0x3f4090,_0x8c54e9){return _0x3f4090||_0x8c54e9;},![]);logger[_0x81e4('0x14')](util[_0x81e4('0x19')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x42fd7d['map'](function(_0x49a3b6){return _0x49a3b6[_0x81e4('0x1a')];})[_0x81e4('0x1b')](',\x20'),_0x42fd7d['map'](function(_0x5abc76){return _0x5abc76['id'];})[_0x81e4('0x1b')](',\x20')));return _0x2518a0;});}function checkSingleInterval(_0xef462f,_0xdfd263){return db['Interval']['findById'](_0xef462f)[_0x81e4('0xc')](function(_0x133fbc){if(_0x133fbc){logger['info'](util['format'](_0x81e4('0x1c'),_0x133fbc[_0x81e4('0x1a')],_0x133fbc['id']));return _0x133fbc[_0x81e4('0x1d')](_0xdfd263);}});}exports[_0x81e4('0x1e')]=function(_0x517481){var _0x3aaee4=_0x517481['intervalIds'];var _0x46f9af=Array[_0x81e4('0x1f')](_0x517481[_0x81e4('0x20')])?_0x517481[_0x81e4('0x20')]:typeof _0x517481[_0x81e4('0x20')]===_0x81e4('0x21')?[_0x517481['intervals']]:[];var _0x3f5752=_0x517481[_0x81e4('0x22')]||undefined;var _0xc696a0=![];if(_0x46f9af[_0x81e4('0x23')]){logger['info'](util['format'](_0x81e4('0x24'),_0x46f9af[_0x81e4('0x1b')](';\x20')));}if(_0x3f5752){logger[_0x81e4('0x14')](util[_0x81e4('0x19')](_0x81e4('0x25'),_0x3f5752));}logger['debug'](_0x81e4('0x26'),_0xc696a0);logger['silly'](_0x81e4('0x1e'),_0x517481);return Promise[_0x81e4('0x27')]()[_0x81e4('0xc')](function(){if(Array[_0x81e4('0x1f')](_0x3aaee4)){return checkArrayOfIntervals(_0x3aaee4,_0x3f5752);}else if(_0x3aaee4){return checkSingleInterval(_0x3aaee4,_0x3f5752);}})['then'](function(_0x13b079){var _0x1be846=_0x46f9af[_0x81e4('0x18')](function(_0x4f7463,_0x5c184d){return _0x4f7463||iftime(_0x5c184d,_0x3f5752);},![]);_0xc696a0=_0x13b079||_0x1be846;return _0xc696a0;})[_0x81e4('0xe')](function(_0x3fc107){logger[_0x81e4('0x10')](_0x81e4('0x1e'),_0x517481,_0x3fc107);throw this[_0x81e4('0x10')](0x1f4,_0x3fc107[_0x81e4('0xf')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index fcdf011..73fed77 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x297234,_0x4c2770){var _0x2aeb34=function(_0x4c1bcd){while(--_0x4c1bcd){_0x297234['push'](_0x297234['shift']());}};_0x2aeb34(++_0x4c2770);}(_0x2032,0xd9));var _0x2203=function(_0x314397,_0x2e13c0){_0x314397=_0x314397-0x0;var _0x111290=_0x2032[_0x314397];return _0x111290;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x454bd3,_0x3e4d94){_0x454bd3=_0x454bd3-0x0;var _0x4eb066=_0x0b0e[_0x454bd3];return _0x4eb066;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 215b152..43a4aae 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 _0x69ce=['end','status','statusCode','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','base64','request','setEncoding','utf8','data'];(function(_0x4fada1,_0x1548c8){var _0x2fcd57=function(_0x3df47d){while(--_0x3df47d){_0x4fada1['push'](_0x4fada1['shift']());}};_0x2fcd57(++_0x1548c8);}(_0x69ce,0x165));var _0xe69c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x69ce[_0x199572];return _0x13cfa3;};'use strict';var BPromise=require('bluebird');var https=require(_0xe69c('0x0'));var logger=require(_0xe69c('0x1'))('api');var USERNAME=_0xe69c('0x2');var PASSWORD=_0xe69c('0x3');function openIssue(_0x440d14,_0x11d1b2){var _0x2c8ea4={'fields':{'project':{'key':_0x440d14['key']||_0xe69c('0x4')},'summary':(_0x440d14['summary']||_0xe69c('0x5'))+_0xe69c('0x6')+_0x440d14['ip'],'description':_0x440d14[_0xe69c('0x7')]||JSON[_0xe69c('0x8')](_0x440d14),'issuetype':{'name':_0x440d14[_0xe69c('0x9')]||_0xe69c('0xa')}}};_0x2c8ea4[_0xe69c('0xb')]['customfield_11500']=_0x440d14[_0xe69c('0xc')];_0x2c8ea4[_0xe69c('0xb')][_0xe69c('0xd')]=_0x440d14[_0xe69c('0xe')];_0x2c8ea4[_0xe69c('0xb')]['customfield_11502']=_0x440d14[_0xe69c('0xf')];_0x2c8ea4[_0xe69c('0xb')][_0xe69c('0x10')]=_0x440d14[_0xe69c('0x11')];_0x2c8ea4[_0xe69c('0xb')][_0xe69c('0x12')]=_0x440d14[_0xe69c('0x13')];_0x2c8ea4[_0xe69c('0xb')][_0xe69c('0x14')]=_0x440d14['ip'];var _0x16da6d={'host':_0xe69c('0x15'),'port':0x1bb,'path':_0xe69c('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xe69c('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xe69c('0x18')](_0xe69c('0x19'))}};var _0xb3515d=JSON[_0xe69c('0x8')](_0x2c8ea4);var _0x3c1b91=https[_0xe69c('0x1a')](_0x16da6d,function(_0x11c5b7){_0x11c5b7[_0xe69c('0x1b')](_0xe69c('0x1c'));var _0x15d60='';_0x11c5b7['on'](_0xe69c('0x1d'),function(_0x198028){_0x15d60+=_0x198028;});_0x11c5b7['on'](_0xe69c('0x1e'),function(){if(_0x11d1b2){return _0x11d1b2[_0xe69c('0x1f')](_0x11c5b7[_0xe69c('0x20')])['json'](JSON[_0xe69c('0x21')](_0x15d60));}});});_0x3c1b91['on'](_0xe69c('0x22'),function(_0x227727){if(_0x11d1b2){return _0x11d1b2['status'](0x1f4)['json']({'errors':[{'message':_0xe69c('0x23'),'type':_0xe69c('0x24')}]});}});_0x3c1b91['write'](_0xb3515d);_0x3c1b91[_0xe69c('0x1e')]();}exports['openIssue']=openIssue;exports['send']=function(_0x591d93,_0x22aad0){_0x591d93[_0xe69c('0x25')]['ip']=_0x591d93[_0xe69c('0x26')][_0xe69c('0x27')]||_0x591d93[_0xe69c('0x28')][_0xe69c('0x29')]||_0x591d93[_0xe69c('0x2a')]['remoteAddress']||_0x591d93[_0xe69c('0x28')][_0xe69c('0x2a')][_0xe69c('0x29')];return openIssue(_0x591d93[_0xe69c('0x25')],_0x22aad0);}; \ No newline at end of file +var _0x9979=['newToken','name','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','base64','stringify','utf8','data','status','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','body','connection','remoteAddress','socket','https','api','3eAmWpBVP0','key','MOTGUI','summary','Report','description','issuetype','Bug','customfield_11500','email','oldToken','fields','customfield_11502'];(function(_0x101b4b,_0x2eb8e){var _0x12de0e=function(_0x477b73){while(--_0x477b73){_0x101b4b['push'](_0x101b4b['shift']());}};_0x12de0e(++_0x2eb8e);}(_0x9979,0xd5));var _0x9997=function(_0x288478,_0x23303e){_0x288478=_0x288478-0x0;var _0x234c05=_0x9979[_0x288478];return _0x234c05;};'use strict';var BPromise=require('bluebird');var https=require(_0x9997('0x0'));var logger=require('../../config/logger')(_0x9997('0x1'));var USERNAME='support';var PASSWORD=_0x9997('0x2');function openIssue(_0x15c12e,_0x2babd5){var _0x16b954={'fields':{'project':{'key':_0x15c12e[_0x9997('0x3')]||_0x9997('0x4')},'summary':(_0x15c12e[_0x9997('0x5')]||_0x9997('0x6'))+'\x20from\x20'+_0x15c12e['ip'],'description':_0x15c12e[_0x9997('0x7')]||JSON['stringify'](_0x15c12e),'issuetype':{'name':_0x15c12e[_0x9997('0x8')]||_0x9997('0x9')}}};_0x16b954['fields'][_0x9997('0xa')]=_0x15c12e[_0x9997('0xb')];_0x16b954['fields']['customfield_11501']=_0x15c12e[_0x9997('0xc')];_0x16b954[_0x9997('0xd')][_0x9997('0xe')]=_0x15c12e[_0x9997('0xf')];_0x16b954['fields']['customfield_11503']=_0x15c12e[_0x9997('0x10')];_0x16b954[_0x9997('0xd')]['customfield_11504']=_0x15c12e[_0x9997('0x11')];_0x16b954['fields'][_0x9997('0x12')]=_0x15c12e['ip'];var _0x3600b9={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x9997('0x13'),'method':_0x9997('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x9997('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9997('0x16'))}};var _0x4f0aa1=JSON[_0x9997('0x17')](_0x16b954);var _0x13ceb=https['request'](_0x3600b9,function(_0x58f0a6){_0x58f0a6['setEncoding'](_0x9997('0x18'));var _0x446793='';_0x58f0a6['on'](_0x9997('0x19'),function(_0x5caf94){_0x446793+=_0x5caf94;});_0x58f0a6['on']('end',function(){if(_0x2babd5){return _0x2babd5[_0x9997('0x1a')](_0x58f0a6['statusCode'])['json'](JSON[_0x9997('0x1b')](_0x446793));}});});_0x13ceb['on']('error',function(_0x215d5a){if(_0x2babd5){return _0x2babd5[_0x9997('0x1a')](0x1f4)[_0x9997('0x1c')]({'errors':[{'message':_0x9997('0x1d'),'type':_0x9997('0x1e')}]});}});_0x13ceb[_0x9997('0x1f')](_0x4f0aa1);_0x13ceb[_0x9997('0x20')]();}exports[_0x9997('0x21')]=openIssue;exports['send']=function(_0x46296e,_0x1a2410){_0x46296e[_0x9997('0x22')]['ip']=_0x46296e['headers']['x-forwarded-for']||_0x46296e[_0x9997('0x23')][_0x9997('0x24')]||_0x46296e[_0x9997('0x25')][_0x9997('0x24')]||_0x46296e['connection'][_0x9997('0x25')][_0x9997('0x24')];return openIssue(_0x46296e[_0x9997('0x22')],_0x1a2410);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 61dd629..d2ab70c 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 _0xbdb7=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get','describe','show','post','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x407604,_0x58f902){var _0x2da97a=function(_0x461868){while(--_0x461868){_0x407604['push'](_0x407604['shift']());}};_0x2da97a(++_0x58f902);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1fcc7d,_0x4eb620){_0x1fcc7d=_0x1fcc7d-0x0;var _0x3daa39=_0xbdb7[_0x1fcc7d];return _0x3daa39;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')]('/',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')](_0x7bdb('0x12'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0x14')]);module[_0x7bdb('0x15')]=router; \ No newline at end of file +var _0x4483=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x4483,0x1a3));var _0x3448=function(_0x3a407b,_0x25ac68){_0x3a407b=_0x3a407b-0x0;var _0x1da087=_0x4483[_0x3a407b];return _0x1da087;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0xf')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')](_0x3448('0x12'),auth[_0x3448('0xa')](),controller[_0x3448('0x13')]);router[_0x3448('0x14')](_0x3448('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x3448('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index b866abb..7336a0d 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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x1c41dc,_0x317267){_0x1c41dc=_0x1c41dc-0x0;var _0x1753be=_0x7a54[_0x1c41dc];return _0x1753be;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x262277,_0x71492b){_0x262277=_0x262277-0x0;var _0x45d853=_0x7a54[_0x262277];return _0x45d853;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 43d52f3..8fca47d 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 _0xf5a7=['body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','JscriptyAnswerReport','fieldName','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','type','VIRTUAL','merge','where','then','findAll','rows','catch','show','params','rawAttributes','intersection','include','options','create'];(function(_0x1ad574,_0x492d96){var _0x310200=function(_0x3747b0){while(--_0x3747b0){_0x1ad574['push'](_0x1ad574['shift']());}};_0x310200(++_0x492d96);}(_0xf5a7,0x133));var _0x7f5a=function(_0x4f2a2a,_0x392074){_0x4f2a2a=_0x4f2a2a-0x0;var _0x46a537=_0xf5a7[_0x4f2a2a];return _0x46a537;};'use strict';var emlformat=require(_0x7f5a('0x0'));var rimraf=require(_0x7f5a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f5a('0x2'));var rp=require(_0x7f5a('0x3'));var moment=require(_0x7f5a('0x4'));var BPromise=require(_0x7f5a('0x5'));var Mustache=require(_0x7f5a('0x6'));var util=require(_0x7f5a('0x7'));var path=require(_0x7f5a('0x8'));var sox=require(_0x7f5a('0x9'));var csv=require(_0x7f5a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f5a('0xb'));var _=require(_0x7f5a('0xc'));var squel=require('squel');var crypto=require(_0x7f5a('0xd'));var jsforce=require(_0x7f5a('0xe'));var deskjs=require(_0x7f5a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f5a('0x10'));var Redis=require(_0x7f5a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7f5a('0x12'));var hardwareService=require(_0x7f5a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7f5a('0x14'));var config=require(_0x7f5a('0x15'));var licenseUtil=require(_0x7f5a('0x16'));var db=require(_0x7f5a('0x17'))['db'];function respondWithStatusCode(_0x169701,_0x325fda){_0x325fda=_0x325fda||0xcc;return function(_0x55ca4b){if(_0x55ca4b){return _0x169701[_0x7f5a('0x18')](_0x325fda);}return _0x169701[_0x7f5a('0x19')](_0x325fda)[_0x7f5a('0x1a')]();};}function respondWithResult(_0x112311,_0x1f1c17){_0x1f1c17=_0x1f1c17||0xc8;return function(_0x2a25ab){if(_0x2a25ab){return _0x112311[_0x7f5a('0x19')](_0x1f1c17)[_0x7f5a('0x1b')](_0x2a25ab);}};}function respondWithFilteredResult(_0x4ce5c2,_0x2ed7d3){return function(_0x3c6d7c){if(_0x3c6d7c){var _0x5c6810=typeof _0x2ed7d3[_0x7f5a('0x1c')]===_0x7f5a('0x1d')&&typeof _0x2ed7d3[_0x7f5a('0x1e')]===_0x7f5a('0x1d');var _0x568857=_0x3c6d7c[_0x7f5a('0x1f')];var _0xce9655=_0x5c6810?0x0:_0x2ed7d3[_0x7f5a('0x1c')];var _0x3e168e=_0x5c6810?_0x3c6d7c['count']:_0x2ed7d3[_0x7f5a('0x1c')]+_0x2ed7d3[_0x7f5a('0x1e')];var _0x557b16;if(_0x3e168e>=_0x568857){_0x3e168e=_0x568857;_0x557b16=0xc8;}else{_0x557b16=0xce;}_0x4ce5c2['status'](_0x557b16);return _0x4ce5c2[_0x7f5a('0x20')](_0x7f5a('0x21'),_0xce9655+'-'+_0x3e168e+'/'+_0x568857)[_0x7f5a('0x1b')](_0x3c6d7c);}return null;};}function patchUpdates(_0x90c080){return function(_0x208a6e){try{jsonpatch[_0x7f5a('0x22')](_0x208a6e,_0x90c080,!![]);}catch(_0x2942f9){return BPromise[_0x7f5a('0x23')](_0x2942f9);}return _0x208a6e['save']();};}function saveUpdates(_0x4b8d6b,_0x3d5f19){return function(_0x57019e){if(_0x57019e){return _0x57019e[_0x7f5a('0x24')](_0x4b8d6b)['then'](function(_0x3fda96){return _0x3fda96;});}return null;};}function removeEntity(_0x1c43bb,_0xf52b51){return function(_0xb65c0){if(_0xb65c0){return _0xb65c0[_0x7f5a('0x25')]()['then'](function(){_0x1c43bb[_0x7f5a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x280a55,_0x31f206){return function(_0x49902a){if(!_0x49902a){_0x280a55[_0x7f5a('0x18')](0x194);}return _0x49902a;};}function handleError(_0x5d53cc,_0x35c43b){_0x35c43b=_0x35c43b||0x1f4;return function(_0x2bfbfe){logger[_0x7f5a('0x26')](_0x2bfbfe[_0x7f5a('0x27')]);if(_0x2bfbfe['name']){delete _0x2bfbfe[_0x7f5a('0x28')];}_0x5d53cc[_0x7f5a('0x19')](_0x35c43b)[_0x7f5a('0x29')](_0x2bfbfe);};}exports[_0x7f5a('0x2a')]=function(_0x49327f,_0x4ee1ca){var _0x550e81={},_0x30c290={},_0x2f8113={'count':0x0,'rows':[]};var _0x332baa=_['map'](db[_0x7f5a('0x2b')]['rawAttributes'],function(_0x347d5c){return{'name':_0x347d5c[_0x7f5a('0x2c')],'type':_0x347d5c['type'][_0x7f5a('0x2d')]};});_0x30c290[_0x7f5a('0x2e')]=_[_0x7f5a('0x2f')](_0x332baa,_0x7f5a('0x28'));_0x30c290[_0x7f5a('0x30')]=_[_0x7f5a('0x31')](_0x49327f[_0x7f5a('0x30')]);_0x30c290[_0x7f5a('0x32')]=_['intersection'](_0x30c290[_0x7f5a('0x2e')],_0x30c290['query']);_0x550e81['attributes']=_['intersection'](_0x30c290[_0x7f5a('0x2e')],qs[_0x7f5a('0x33')](_0x49327f[_0x7f5a('0x30')][_0x7f5a('0x33')]));_0x550e81[_0x7f5a('0x34')]=_0x550e81['attributes'][_0x7f5a('0x35')]?_0x550e81['attributes']:_0x30c290[_0x7f5a('0x2e')];if(!_0x49327f['query'][_0x7f5a('0x36')](_0x7f5a('0x37'))){_0x550e81[_0x7f5a('0x1e')]=qs['limit'](_0x49327f['query'][_0x7f5a('0x1e')]);_0x550e81[_0x7f5a('0x1c')]=qs[_0x7f5a('0x1c')](_0x49327f['query'][_0x7f5a('0x1c')]);}_0x550e81['order']=qs['sort'](_0x49327f[_0x7f5a('0x30')][_0x7f5a('0x38')]);_0x550e81['where']=qs[_0x7f5a('0x32')](_[_0x7f5a('0x39')](_0x49327f[_0x7f5a('0x30')],_0x30c290[_0x7f5a('0x32')]),_0x332baa);if(_0x49327f[_0x7f5a('0x30')]['filter']){_0x550e81['where']=_['merge'](_0x550e81['where'],{'$or':_[_0x7f5a('0x2f')](_0x332baa,function(_0x5f194b){if(_0x5f194b[_0x7f5a('0x3a')]!==_0x7f5a('0x3b')){var _0x3e06c6={};_0x3e06c6[_0x5f194b[_0x7f5a('0x28')]]={'$like':'%'+_0x49327f[_0x7f5a('0x30')]['filter']+'%'};return _0x3e06c6;}})});}_0x550e81=_[_0x7f5a('0x3c')]({},_0x550e81,_0x49327f['options']);var _0x367be8={'where':_0x550e81[_0x7f5a('0x3d')]};return db[_0x7f5a('0x2b')]['count'](_0x367be8)[_0x7f5a('0x3e')](function(_0x5219e8){_0x2f8113[_0x7f5a('0x1f')]=_0x5219e8;if(_0x49327f[_0x7f5a('0x30')]['includeAll']){_0x550e81['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x7f5a('0x3f')](_0x550e81);})['then'](function(_0x4d65c0){_0x2f8113[_0x7f5a('0x40')]=_0x4d65c0;return _0x2f8113;})[_0x7f5a('0x3e')](respondWithFilteredResult(_0x4ee1ca,_0x550e81))[_0x7f5a('0x41')](handleError(_0x4ee1ca,null));};exports[_0x7f5a('0x42')]=function(_0x1fa1cc,_0x185db9){var _0x121fdf={'raw':!![],'where':{'id':_0x1fa1cc[_0x7f5a('0x43')]['id']}},_0x29b022={};_0x29b022[_0x7f5a('0x2e')]=_[_0x7f5a('0x31')](db['JscriptyAnswerReport'][_0x7f5a('0x44')]);_0x29b022['query']=_[_0x7f5a('0x31')](_0x1fa1cc[_0x7f5a('0x30')]);_0x29b022[_0x7f5a('0x32')]=_['intersection'](_0x29b022[_0x7f5a('0x2e')],_0x29b022[_0x7f5a('0x30')]);_0x121fdf[_0x7f5a('0x34')]=_[_0x7f5a('0x45')](_0x29b022[_0x7f5a('0x2e')],qs[_0x7f5a('0x33')](_0x1fa1cc[_0x7f5a('0x30')]['fields']));_0x121fdf[_0x7f5a('0x34')]=_0x121fdf[_0x7f5a('0x34')][_0x7f5a('0x35')]?_0x121fdf[_0x7f5a('0x34')]:_0x29b022[_0x7f5a('0x2e')];if(_0x1fa1cc[_0x7f5a('0x30')]['includeAll']){_0x121fdf[_0x7f5a('0x46')]=[{'all':!![]}];}_0x121fdf=_[_0x7f5a('0x3c')]({},_0x121fdf,_0x1fa1cc[_0x7f5a('0x47')]);return db[_0x7f5a('0x2b')]['find'](_0x121fdf)[_0x7f5a('0x3e')](handleEntityNotFound(_0x185db9,null))[_0x7f5a('0x3e')](respondWithResult(_0x185db9,null))[_0x7f5a('0x41')](handleError(_0x185db9,null));};exports[_0x7f5a('0x48')]=function(_0x10457b,_0x21c7f6){return db[_0x7f5a('0x2b')][_0x7f5a('0x48')](_0x10457b[_0x7f5a('0x49')],{})[_0x7f5a('0x3e')](respondWithResult(_0x21c7f6,0xc9))[_0x7f5a('0x41')](handleError(_0x21c7f6,null));};exports[_0x7f5a('0x24')]=function(_0xaabf0f,_0x163b97){if(_0xaabf0f['body']['id']){delete _0xaabf0f[_0x7f5a('0x49')]['id'];}return db['JscriptyAnswerReport'][_0x7f5a('0x4a')]({'where':{'id':_0xaabf0f[_0x7f5a('0x43')]['id']}})[_0x7f5a('0x3e')](handleEntityNotFound(_0x163b97,null))['then'](saveUpdates(_0xaabf0f['body'],null))[_0x7f5a('0x3e')](respondWithResult(_0x163b97,null))[_0x7f5a('0x41')](handleError(_0x163b97,null));};exports[_0x7f5a('0x25')]=function(_0x3ad069,_0x5731d0){return db[_0x7f5a('0x2b')][_0x7f5a('0x4a')]({'where':{'id':_0x3ad069['params']['id']}})['then'](handleEntityNotFound(_0x5731d0,null))[_0x7f5a('0x3e')](removeEntity(_0x5731d0,null))[_0x7f5a('0x41')](handleError(_0x5731d0,null));};exports[_0x7f5a('0x4b')]=function(_0x225019,_0x361c56){return db['JscriptyAnswerReport'][_0x7f5a('0x4b')]()[_0x7f5a('0x3e')](respondWithResult(_0x361c56,null))['catch'](handleError(_0x361c56,null));}; \ No newline at end of file +var _0xff2a=['keys','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','destroy','then','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x56af36,_0x54dcb4){var _0x514be6=function(_0x155b75){while(--_0x155b75){_0x56af36['push'](_0x56af36['shift']());}};_0x514be6(++_0x54dcb4);}(_0xff2a,0x93));var _0xaff2=function(_0xb0975b,_0x93b0d6){_0xb0975b=_0xb0975b-0x0;var _0x320d30=_0xff2a[_0xb0975b];return _0x320d30;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaff2('0x0'));var zipdir=require(_0xaff2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaff2('0x2'));var moment=require(_0xaff2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaff2('0x4'));var util=require('util');var path=require(_0xaff2('0x5'));var sox=require(_0xaff2('0x6'));var csv=require('to-csv');var ejs=require(_0xaff2('0x7'));var fs=require('fs');var fs_extra=require(_0xaff2('0x8'));var _=require(_0xaff2('0x9'));var squel=require(_0xaff2('0xa'));var crypto=require(_0xaff2('0xb'));var jsforce=require(_0xaff2('0xc'));var deskjs=require(_0xaff2('0xd'));var toCsv=require(_0xaff2('0xe'));var querystring=require(_0xaff2('0xf'));var Papa=require(_0xaff2('0x10'));var Redis=require('ioredis');var authService=require(_0xaff2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaff2('0x12'));var logger=require(_0xaff2('0x13'))(_0xaff2('0x14'));var utils=require(_0xaff2('0x15'));var config=require(_0xaff2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaff2('0x17'))['db'];function respondWithStatusCode(_0x175f2c,_0x18e9bf){_0x18e9bf=_0x18e9bf||0xcc;return function(_0x58930b){if(_0x58930b){return _0x175f2c[_0xaff2('0x18')](_0x18e9bf);}return _0x175f2c[_0xaff2('0x19')](_0x18e9bf)['end']();};}function respondWithResult(_0x3388d0,_0x56b2d7){_0x56b2d7=_0x56b2d7||0xc8;return function(_0x259c5d){if(_0x259c5d){return _0x3388d0['status'](_0x56b2d7)['json'](_0x259c5d);}};}function respondWithFilteredResult(_0x32ec13,_0x5186d4){return function(_0x423844){if(_0x423844){var _0x19029b=typeof _0x5186d4[_0xaff2('0x1a')]===_0xaff2('0x1b')&&typeof _0x5186d4[_0xaff2('0x1c')]==='undefined';var _0xd2adb8=_0x423844[_0xaff2('0x1d')];var _0x28b387=_0x19029b?0x0:_0x5186d4[_0xaff2('0x1a')];var _0x18591a=_0x19029b?_0x423844[_0xaff2('0x1d')]:_0x5186d4[_0xaff2('0x1a')]+_0x5186d4['limit'];var _0x2e35e8;if(_0x18591a>=_0xd2adb8){_0x18591a=_0xd2adb8;_0x2e35e8=0xc8;}else{_0x2e35e8=0xce;}_0x32ec13['status'](_0x2e35e8);return _0x32ec13[_0xaff2('0x1e')]('Content-Range',_0x28b387+'-'+_0x18591a+'/'+_0xd2adb8)['json'](_0x423844);}return null;};}function patchUpdates(_0x353ed0){return function(_0x4e1d46){try{jsonpatch['apply'](_0x4e1d46,_0x353ed0,!![]);}catch(_0x26bfc4){return BPromise[_0xaff2('0x1f')](_0x26bfc4);}return _0x4e1d46[_0xaff2('0x20')]();};}function saveUpdates(_0x2d1be8,_0x3e2e81){return function(_0x366ac5){if(_0x366ac5){return _0x366ac5['update'](_0x2d1be8)['then'](function(_0x3d0176){return _0x3d0176;});}return null;};}function removeEntity(_0x211cd7,_0x545e23){return function(_0x50d111){if(_0x50d111){return _0x50d111[_0xaff2('0x21')]()[_0xaff2('0x22')](function(){_0x211cd7[_0xaff2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ccfb,_0x306eb6){return function(_0x3d3d39){if(!_0x3d3d39){_0x24ccfb[_0xaff2('0x18')](0x194);}return _0x3d3d39;};}function handleError(_0xac61b9,_0x19635b){_0x19635b=_0x19635b||0x1f4;return function(_0x28d59c){logger[_0xaff2('0x23')](_0x28d59c[_0xaff2('0x24')]);if(_0x28d59c[_0xaff2('0x25')]){delete _0x28d59c[_0xaff2('0x25')];}_0xac61b9[_0xaff2('0x19')](_0x19635b)[_0xaff2('0x26')](_0x28d59c);};}exports['index']=function(_0x3ccb90,_0x29a0ca){var _0x58e572={},_0x3bfca4={},_0x3e182f={'count':0x0,'rows':[]};var _0x4d51ff=_[_0xaff2('0x27')](db[_0xaff2('0x28')][_0xaff2('0x29')],function(_0x2b6959){return{'name':_0x2b6959[_0xaff2('0x2a')],'type':_0x2b6959[_0xaff2('0x2b')][_0xaff2('0x2c')]};});_0x3bfca4[_0xaff2('0x2d')]=_[_0xaff2('0x27')](_0x4d51ff,_0xaff2('0x25'));_0x3bfca4['query']=_['keys'](_0x3ccb90['query']);_0x3bfca4[_0xaff2('0x2e')]=_[_0xaff2('0x2f')](_0x3bfca4['model'],_0x3bfca4['query']);_0x58e572[_0xaff2('0x30')]=_[_0xaff2('0x2f')](_0x3bfca4[_0xaff2('0x2d')],qs[_0xaff2('0x31')](_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x31')]));_0x58e572['attributes']=_0x58e572[_0xaff2('0x30')][_0xaff2('0x33')]?_0x58e572[_0xaff2('0x30')]:_0x3bfca4[_0xaff2('0x2d')];if(!_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x34')](_0xaff2('0x35'))){_0x58e572[_0xaff2('0x1c')]=qs[_0xaff2('0x1c')](_0x3ccb90['query']['limit']);_0x58e572[_0xaff2('0x1a')]=qs[_0xaff2('0x1a')](_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x1a')]);}_0x58e572[_0xaff2('0x36')]=qs[_0xaff2('0x37')](_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x37')]);_0x58e572['where']=qs[_0xaff2('0x2e')](_['pick'](_0x3ccb90[_0xaff2('0x32')],_0x3bfca4['filters']),_0x4d51ff);if(_0x3ccb90['query']['filter']){_0x58e572[_0xaff2('0x38')]=_['merge'](_0x58e572[_0xaff2('0x38')],{'$or':_['map'](_0x4d51ff,function(_0x1e08ce){if(_0x1e08ce[_0xaff2('0x2b')]!=='VIRTUAL'){var _0x2d6de0={};_0x2d6de0[_0x1e08ce[_0xaff2('0x25')]]={'$like':'%'+_0x3ccb90['query'][_0xaff2('0x39')]+'%'};return _0x2d6de0;}})});}_0x58e572=_[_0xaff2('0x3a')]({},_0x58e572,_0x3ccb90[_0xaff2('0x3b')]);var _0x2e5a6f={'where':_0x58e572[_0xaff2('0x38')]};return db[_0xaff2('0x28')][_0xaff2('0x1d')](_0x2e5a6f)[_0xaff2('0x22')](function(_0x1e1bfd){_0x3e182f[_0xaff2('0x1d')]=_0x1e1bfd;if(_0x3ccb90[_0xaff2('0x32')][_0xaff2('0x3c')]){_0x58e572['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xaff2('0x3d')](_0x58e572);})[_0xaff2('0x22')](function(_0x4a1d6f){_0x3e182f[_0xaff2('0x3e')]=_0x4a1d6f;return _0x3e182f;})[_0xaff2('0x22')](respondWithFilteredResult(_0x29a0ca,_0x58e572))[_0xaff2('0x3f')](handleError(_0x29a0ca,null));};exports[_0xaff2('0x40')]=function(_0x56b4ab,_0x4ea1cc){var _0x245f44={'raw':!![],'where':{'id':_0x56b4ab[_0xaff2('0x41')]['id']}},_0x303108={};_0x303108[_0xaff2('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0xaff2('0x29')]);_0x303108['query']=_[_0xaff2('0x42')](_0x56b4ab[_0xaff2('0x32')]);_0x303108[_0xaff2('0x2e')]=_['intersection'](_0x303108[_0xaff2('0x2d')],_0x303108[_0xaff2('0x32')]);_0x245f44[_0xaff2('0x30')]=_['intersection'](_0x303108[_0xaff2('0x2d')],qs[_0xaff2('0x31')](_0x56b4ab[_0xaff2('0x32')][_0xaff2('0x31')]));_0x245f44['attributes']=_0x245f44['attributes'][_0xaff2('0x33')]?_0x245f44[_0xaff2('0x30')]:_0x303108['model'];if(_0x56b4ab[_0xaff2('0x32')]['includeAll']){_0x245f44['include']=[{'all':!![]}];}_0x245f44=_[_0xaff2('0x3a')]({},_0x245f44,_0x56b4ab['options']);return db['JscriptyAnswerReport'][_0xaff2('0x43')](_0x245f44)[_0xaff2('0x22')](handleEntityNotFound(_0x4ea1cc,null))[_0xaff2('0x22')](respondWithResult(_0x4ea1cc,null))[_0xaff2('0x3f')](handleError(_0x4ea1cc,null));};exports[_0xaff2('0x44')]=function(_0xa4b9c5,_0x4cdcf7){return db['JscriptyAnswerReport'][_0xaff2('0x44')](_0xa4b9c5[_0xaff2('0x45')],{})[_0xaff2('0x22')](respondWithResult(_0x4cdcf7,0xc9))[_0xaff2('0x3f')](handleError(_0x4cdcf7,null));};exports['update']=function(_0xd04518,_0x38f241){if(_0xd04518[_0xaff2('0x45')]['id']){delete _0xd04518[_0xaff2('0x45')]['id'];}return db['JscriptyAnswerReport'][_0xaff2('0x43')]({'where':{'id':_0xd04518[_0xaff2('0x41')]['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0x38f241,null))[_0xaff2('0x22')](saveUpdates(_0xd04518[_0xaff2('0x45')],null))[_0xaff2('0x22')](respondWithResult(_0x38f241,null))[_0xaff2('0x3f')](handleError(_0x38f241,null));};exports['destroy']=function(_0x3e6215,_0x2c3855){return db[_0xaff2('0x28')][_0xaff2('0x43')]({'where':{'id':_0x3e6215[_0xaff2('0x41')]['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0x2c3855,null))['then'](removeEntity(_0x2c3855,null))[_0xaff2('0x3f')](handleError(_0x2c3855,null));};exports['describe']=function(_0x31787e,_0x3e2e75){return db['JscriptyAnswerReport'][_0xaff2('0x46')]()[_0xaff2('0x22')](respondWithResult(_0x3e2e75,null))[_0xaff2('0x3f')](handleError(_0x3e2e75,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 2161c03..dd0291a 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 _0x25ee=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x30198b,_0x4a489f){var _0x4255b4=function(_0x158f97){while(--_0x158f97){_0x30198b['push'](_0x30198b['shift']());}};_0x4255b4(++_0x4a489f);}(_0x25ee,0x1b3));var _0xe25e=function(_0x426881,_0x43b2ff){_0x426881=_0x426881-0x0;var _0x97ec6f=_0x25ee[_0x426881];return _0x97ec6f;};'use strict';var _=require(_0xe25e('0x0'));var util=require('util');var logger=require(_0xe25e('0x1'))(_0xe25e('0x2'));var moment=require('moment');var BPromise=require(_0xe25e('0x3'));var rp=require(_0xe25e('0x4'));var fs=require('fs');var path=require(_0xe25e('0x5'));var rimraf=require(_0xe25e('0x6'));var config=require(_0xe25e('0x7'));var attributes=require(_0xe25e('0x8'));module[_0xe25e('0x9')]=function(_0x409b4d,_0x45280d){return _0x409b4d[_0xe25e('0xa')](_0xe25e('0xb'),attributes,{'tableName':_0xe25e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1f1=['bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xa1f1,0x121));var _0x1a1f=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0xa1f1[_0x3a3b9e];return _0x148103;};'use strict';var _=require(_0x1a1f('0x0'));var util=require(_0x1a1f('0x1'));var logger=require(_0x1a1f('0x2'))(_0x1a1f('0x3'));var moment=require(_0x1a1f('0x4'));var BPromise=require(_0x1a1f('0x5'));var rp=require(_0x1a1f('0x6'));var fs=require('fs');var path=require(_0x1a1f('0x7'));var rimraf=require(_0x1a1f('0x8'));var config=require('../../config/environment');var attributes=require(_0x1a1f('0x9'));module[_0x1a1f('0xa')]=function(_0x5214fc,_0x3ec912){return _0x5214fc[_0x1a1f('0xb')](_0x1a1f('0xc'),attributes,{'tableName':_0x1a1f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index b151aa7..593983b 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 _0x911c=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0x911c,0xbd));var _0xc911=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x911c[_0x4914e2];return _0x2dcd07;};'use strict';var _=require(_0xc911('0x0'));var util=require(_0xc911('0x1'));var moment=require(_0xc911('0x2'));var BPromise=require(_0xc911('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc911('0x4'));var db=require(_0xc911('0x5'))['db'];var utils=require(_0xc911('0x6'));var logger=require(_0xc911('0x7'))(_0xc911('0x8'));var config=require(_0xc911('0x9'));var jayson=require(_0xc911('0xa'));var client=jayson[_0xc911('0xb')][_0xc911('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9a78f8,_0x3228a7,_0x2b2285){return new BPromise(function(_0x50cd46,_0x4eebbf){return client[_0xc911('0xd')](_0x9a78f8,_0x2b2285)['then'](function(_0x1537e3){logger[_0xc911('0xe')](_0xc911('0xf'),_0x3228a7,_0xc911('0x10'));logger[_0xc911('0x11')](_0xc911('0x12'),_0x3228a7,_0xc911('0x10'),JSON['stringify'](_0x1537e3));if(_0x1537e3[_0xc911('0x13')]){if(_0x1537e3['error'][_0xc911('0x14')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3228a7,_0x1537e3[_0xc911('0x13')][_0xc911('0x15')]);return _0x4eebbf(_0x1537e3[_0xc911('0x13')][_0xc911('0x15')]);}logger['error'](_0xc911('0xf'),_0x3228a7,_0x1537e3['error'][_0xc911('0x15')]);return _0x50cd46(_0x1537e3['error'][_0xc911('0x15')]);}else{logger[_0xc911('0xe')](_0xc911('0xf'),_0x3228a7,'request\x20sent');_0x50cd46(_0x1537e3['result'][_0xc911('0x15')]);}})[_0xc911('0x16')](function(_0x1cc5c8){logger[_0xc911('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3228a7,_0x1cc5c8);_0x4eebbf(_0x1cc5c8);});});} \ No newline at end of file +var _0xb92a=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x375e6,_0x2648f7){var _0xa290d8=function(_0x1fe89e){while(--_0x1fe89e){_0x375e6['push'](_0x375e6['shift']());}};_0xa290d8(++_0x2648f7);}(_0xb92a,0xc5));var _0xab92=function(_0x5e42ca,_0x5a84c1){_0x5e42ca=_0x5e42ca-0x0;var _0x36cec6=_0xb92a[_0x5e42ca];return _0x36cec6;};'use strict';var _=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var moment=require(_0xab92('0x2'));var BPromise=require(_0xab92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab92('0x4'))['db'];var utils=require(_0xab92('0x5'));var logger=require('../../config/logger')(_0xab92('0x6'));var config=require('../../config/environment');var jayson=require(_0xab92('0x7'));var client=jayson[_0xab92('0x8')][_0xab92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482120,_0x1b7343,_0x530605){return new BPromise(function(_0x539ce5,_0x4af618){return client[_0xab92('0xa')](_0x482120,_0x530605)[_0xab92('0xb')](function(_0x4bd998){logger[_0xab92('0xc')](_0xab92('0xd'),_0x1b7343,_0xab92('0xe'));logger[_0xab92('0xf')](_0xab92('0x10'),_0x1b7343,_0xab92('0xe'),JSON[_0xab92('0x11')](_0x4bd998));if(_0x4bd998[_0xab92('0x12')]){if(_0x4bd998['error'][_0xab92('0x13')]===0x1f4){logger[_0xab92('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1b7343,_0x4bd998[_0xab92('0x12')][_0xab92('0x14')]);return _0x4af618(_0x4bd998['error']['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1b7343,_0x4bd998[_0xab92('0x12')]['message']);return _0x539ce5(_0x4bd998[_0xab92('0x12')][_0xab92('0x14')]);}else{logger[_0xab92('0xc')](_0xab92('0xd'),_0x1b7343,_0xab92('0xe'));_0x539ce5(_0x4bd998[_0xab92('0x15')][_0xab92('0x14')]);}})[_0xab92('0x16')](function(_0x27d90d){logger[_0xab92('0x12')](_0xab92('0xd'),_0x1b7343,_0x27d90d);_0x4af618(_0x27d90d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 4ad60d9..afa49dc 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 _0x0abe=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x48f48a,_0x3371cf){var _0x4c55db=function(_0x2bf15f){while(--_0x2bf15f){_0x48f48a['push'](_0x48f48a['shift']());}};_0x4c55db(++_0x3371cf);}(_0x0abe,0x191));var _0xe0ab=function(_0x51d956,_0x4cce45){_0x51d956=_0x51d956-0x0;var _0x33a70e=_0x0abe[_0x51d956];return _0x33a70e;};'use strict';var multer=require(_0xe0ab('0x0'));var util=require(_0xe0ab('0x1'));var path=require(_0xe0ab('0x2'));var timeout=require(_0xe0ab('0x3'));var express=require(_0xe0ab('0x4'));var router=express[_0xe0ab('0x5')]();var fs_extra=require(_0xe0ab('0x6'));var auth=require(_0xe0ab('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe0ab('0x8'));var controller=require('./jscriptyProject.controller');router[_0xe0ab('0x9')]('/',auth[_0xe0ab('0xa')](),controller[_0xe0ab('0xb')]);router[_0xe0ab('0x9')](_0xe0ab('0xc'),auth[_0xe0ab('0xa')](),controller['show']);router[_0xe0ab('0x9')](_0xe0ab('0xd'),auth[_0xe0ab('0xa')](),controller[_0xe0ab('0xe')]);router['get'](_0xe0ab('0xf'),auth[_0xe0ab('0xa')](),controller[_0xe0ab('0x10')]);router[_0xe0ab('0x9')](_0xe0ab('0x11'),auth[_0xe0ab('0xa')](),timeout(_0xe0ab('0x12')),controller['getSummary']);router[_0xe0ab('0x13')]('/',auth[_0xe0ab('0xa')](),controller['create']);router[_0xe0ab('0x13')](_0xe0ab('0x14'),auth[_0xe0ab('0xa')](),controller[_0xe0ab('0x15')]);router[_0xe0ab('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xe0ab('0x17')]);router[_0xe0ab('0x18')](_0xe0ab('0xc'),auth[_0xe0ab('0xa')](),controller[_0xe0ab('0x19')]);module[_0xe0ab('0x1a')]=router; \ No newline at end of file +var _0x0cb7=['/:id/summary','getSummary','create','post','/:id/clone','clone','put','update','delete','destroy','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers'];(function(_0x9688a3,_0x2ff591){var _0x49de24=function(_0x1778d5){while(--_0x1778d5){_0x9688a3['push'](_0x9688a3['shift']());}};_0x49de24(++_0x2ff591);}(_0x0cb7,0x150));var _0x70cb=function(_0x47cd3a,_0x2390d8){_0x47cd3a=_0x47cd3a-0x0;var _0x2acf91=_0x0cb7[_0x47cd3a];return _0x2acf91;};'use strict';var multer=require('multer');var util=require(_0x70cb('0x0'));var path=require('path');var timeout=require(_0x70cb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x70cb('0x2'));var config=require(_0x70cb('0x3'));var controller=require(_0x70cb('0x4'));router[_0x70cb('0x5')]('/',auth[_0x70cb('0x6')](),controller[_0x70cb('0x7')]);router[_0x70cb('0x5')](_0x70cb('0x8'),auth['isAuthenticated'](),controller[_0x70cb('0x9')]);router[_0x70cb('0x5')](_0x70cb('0xa'),auth[_0x70cb('0x6')](),controller[_0x70cb('0xb')]);router[_0x70cb('0x5')](_0x70cb('0xc'),auth[_0x70cb('0x6')](),controller[_0x70cb('0xd')]);router[_0x70cb('0x5')](_0x70cb('0xe'),auth[_0x70cb('0x6')](),timeout('30s'),controller[_0x70cb('0xf')]);router['post']('/',auth[_0x70cb('0x6')](),controller[_0x70cb('0x10')]);router[_0x70cb('0x11')](_0x70cb('0x12'),auth[_0x70cb('0x6')](),controller[_0x70cb('0x13')]);router[_0x70cb('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x70cb('0x15')]);router[_0x70cb('0x16')](_0x70cb('0x8'),auth[_0x70cb('0x6')](),controller[_0x70cb('0x17')]);module[_0x70cb('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 129da01..ab3bf01 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 _0x90ee=['BOOLEAN','sequelize','lodash','util','name','TEXT','isObjectLike','setDataValue','stringify','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x90ee,0x1a5));var _0xe90e=function(_0x1b1c65,_0x23ca6d){_0x1b1c65=_0x1b1c65-0x0;var _0x1b86d9=_0x90ee[_0x1b1c65];return _0x1b86d9;};'use strict';var Sequelize=require(_0xe90e('0x0'));var _=require(_0xe90e('0x1'));var util=require(_0xe90e('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe90e('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xe90e('0x4')]('long'),'set':function(_0x19982f){if(_[_0xe90e('0x5')](_0x19982f)){this[_0xe90e('0x6')]('formData',JSON[_0xe90e('0x7')](_0x19982f));}else if(_[_0xe90e('0x8')](_0x19982f)){this[_0xe90e('0x6')](_0xe90e('0x9'),_0x19982f);}else{this[_0xe90e('0x6')](_0xe90e('0x9'),util['format'](_0xe90e('0xa'),this[_0xe90e('0xb')](_0xe90e('0x3'))||'',this[_0xe90e('0xb')](_0xe90e('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe90e('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x2b55=['stringify','isString','format','getDataValue','description','BOOLEAN','util','name','STRING','long','setDataValue','formData'];(function(_0x5288f9,_0x1320eb){var _0x4b17ae=function(_0x194dbd){while(--_0x194dbd){_0x5288f9['push'](_0x5288f9['shift']());}};_0x4b17ae(++_0x1320eb);}(_0x2b55,0x96));var _0x52b5=function(_0x1a684c,_0x49a9f4){_0x1a684c=_0x1a684c-0x0;var _0x3d9657=_0x2b55[_0x1a684c];return _0x3d9657;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x52b5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x52b5('0x1')},'description':{'type':Sequelize[_0x52b5('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x52b5('0x3')),'set':function(_0x2f2d81){if(_['isObjectLike'](_0x2f2d81)){this[_0x52b5('0x4')](_0x52b5('0x5'),JSON[_0x52b5('0x6')](_0x2f2d81));}else if(_[_0x52b5('0x7')](_0x2f2d81)){this[_0x52b5('0x4')](_0x52b5('0x5'),_0x2f2d81);}else{this[_0x52b5('0x4')](_0x52b5('0x5'),util[_0x52b5('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x52b5('0x9')](_0x52b5('0x1'))||'',this['getDataValue'](_0x52b5('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x52b5('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 8d56503..7a0679b 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 _0xc87b=['JscriptyProject','findAll','catch','params','rawAttributes','includeAll','include','options','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','order','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','JscriptyQuestionReport','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','error','stack','name','send','index','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc87b,0xb2));var _0xbc87=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc87b[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require(_0xbc87('0x0'));var rimraf=require(_0xbc87('0x1'));var zipdir=require(_0xbc87('0x2'));var jsonpatch=require(_0xbc87('0x3'));var rp=require('request-promise');var moment=require(_0xbc87('0x4'));var BPromise=require(_0xbc87('0x5'));var Mustache=require(_0xbc87('0x6'));var util=require('util');var path=require(_0xbc87('0x7'));var sox=require(_0xbc87('0x8'));var csv=require(_0xbc87('0x9'));var ejs=require(_0xbc87('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc87('0xb'));var squel=require(_0xbc87('0xc'));var crypto=require(_0xbc87('0xd'));var jsforce=require(_0xbc87('0xe'));var deskjs=require(_0xbc87('0xf'));var toCsv=require(_0xbc87('0x9'));var querystring=require(_0xbc87('0x10'));var Papa=require(_0xbc87('0x11'));var Redis=require(_0xbc87('0x12'));var authService=require(_0xbc87('0x13'));var qs=require(_0xbc87('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc87('0x15'));var logger=require('../../config/logger')(_0xbc87('0x16'));var utils=require(_0xbc87('0x17'));var config=require(_0xbc87('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc87('0x19'))['db'];function respondWithStatusCode(_0x3b1906,_0x51a0f0){_0x51a0f0=_0x51a0f0||0xcc;return function(_0x9d0643){if(_0x9d0643){return _0x3b1906[_0xbc87('0x1a')](_0x51a0f0);}return _0x3b1906['status'](_0x51a0f0)[_0xbc87('0x1b')]();};}function respondWithResult(_0x1a8760,_0x4feea6){_0x4feea6=_0x4feea6||0xc8;return function(_0x2b4778){if(_0x2b4778){return _0x1a8760[_0xbc87('0x1c')](_0x4feea6)[_0xbc87('0x1d')](_0x2b4778);}};}function respondWithFilteredResult(_0x472dab,_0x3afc9f){return function(_0x2c3488){if(_0x2c3488){var _0x56c22c=typeof _0x3afc9f['offset']===_0xbc87('0x1e')&&typeof _0x3afc9f[_0xbc87('0x1f')]===_0xbc87('0x1e');var _0x5e6700=_0x2c3488[_0xbc87('0x20')];var _0x461031=_0x56c22c?0x0:_0x3afc9f[_0xbc87('0x21')];var _0x5beeb1=_0x56c22c?_0x2c3488[_0xbc87('0x20')]:_0x3afc9f[_0xbc87('0x21')]+_0x3afc9f[_0xbc87('0x1f')];var _0x46068d;if(_0x5beeb1>=_0x5e6700){_0x5beeb1=_0x5e6700;_0x46068d=0xc8;}else{_0x46068d=0xce;}_0x472dab[_0xbc87('0x1c')](_0x46068d);return _0x472dab[_0xbc87('0x22')](_0xbc87('0x23'),_0x461031+'-'+_0x5beeb1+'/'+_0x5e6700)[_0xbc87('0x1d')](_0x2c3488);}return null;};}function patchUpdates(_0x51d0a4){return function(_0x52e885){try{jsonpatch[_0xbc87('0x24')](_0x52e885,_0x51d0a4,!![]);}catch(_0x22cbd9){return BPromise[_0xbc87('0x25')](_0x22cbd9);}return _0x52e885[_0xbc87('0x26')]();};}function saveUpdates(_0x320102,_0x1bc01e){return function(_0x3edfd5){if(_0x3edfd5){return _0x3edfd5[_0xbc87('0x27')](_0x320102)['then'](function(_0x54036c){return _0x54036c;});}return null;};}function removeEntity(_0x41d595,_0x5860e4){return function(_0x1c6ef8){if(_0x1c6ef8){return _0x1c6ef8[_0xbc87('0x28')]()[_0xbc87('0x29')](function(){var _0x5aee55=_0x1c6ef8[_0xbc87('0x2a')]({'plain':!![]});var _0x3bf85d=_0xbc87('0x2b');return db[_0xbc87('0x2c')][_0xbc87('0x28')]({'where':{'type':_0x3bf85d,'resourceId':_0x5aee55['id']}})['then'](function(){return _0x1c6ef8;});})[_0xbc87('0x29')](function(){_0x41d595['status'](0xcc)[_0xbc87('0x1b')]();});}};}function handleEntityNotFound(_0x3c36f7,_0x59dc4b){return function(_0x96be38){if(!_0x96be38){_0x3c36f7[_0xbc87('0x1a')](0x194);}return _0x96be38;};}function handleError(_0x474215,_0x3155a1){_0x3155a1=_0x3155a1||0x1f4;return function(_0x1b5fd6){logger[_0xbc87('0x2d')](_0x1b5fd6[_0xbc87('0x2e')]);if(_0x1b5fd6['name']){delete _0x1b5fd6[_0xbc87('0x2f')];}_0x474215[_0xbc87('0x1c')](_0x3155a1)[_0xbc87('0x30')](_0x1b5fd6);};}exports[_0xbc87('0x31')]=function(_0x480d2e,_0x1fe23a){var _0x404dfb={},_0xfb3168={},_0x400769={'count':0x0,'rows':[]};var _0x312ebd=_['map'](db['JscriptyProject']['rawAttributes'],function(_0x5c6a0d){return{'name':_0x5c6a0d['fieldName'],'type':_0x5c6a0d['type'][_0xbc87('0x32')]};});_0xfb3168[_0xbc87('0x33')]=_[_0xbc87('0x34')](_0x312ebd,_0xbc87('0x2f'));_0xfb3168[_0xbc87('0x35')]=_[_0xbc87('0x36')](_0x480d2e['query']);_0xfb3168[_0xbc87('0x37')]=_[_0xbc87('0x38')](_0xfb3168['model'],_0xfb3168[_0xbc87('0x35')]);_0x404dfb[_0xbc87('0x39')]=_[_0xbc87('0x38')](_0xfb3168[_0xbc87('0x33')],qs[_0xbc87('0x3a')](_0x480d2e['query'][_0xbc87('0x3a')]));_0x404dfb[_0xbc87('0x39')]=_0x404dfb[_0xbc87('0x39')][_0xbc87('0x3b')]?_0x404dfb[_0xbc87('0x39')]:_0xfb3168['model'];if(!_0x480d2e[_0xbc87('0x35')][_0xbc87('0x3c')](_0xbc87('0x3d'))){_0x404dfb[_0xbc87('0x1f')]=qs[_0xbc87('0x1f')](_0x480d2e[_0xbc87('0x35')][_0xbc87('0x1f')]);_0x404dfb[_0xbc87('0x21')]=qs[_0xbc87('0x21')](_0x480d2e['query'][_0xbc87('0x21')]);}_0x404dfb['order']=qs[_0xbc87('0x3e')](_0x480d2e[_0xbc87('0x35')][_0xbc87('0x3e')]);_0x404dfb[_0xbc87('0x3f')]=qs[_0xbc87('0x37')](_[_0xbc87('0x40')](_0x480d2e[_0xbc87('0x35')],_0xfb3168[_0xbc87('0x37')]),_0x312ebd);if(_0x480d2e[_0xbc87('0x35')][_0xbc87('0x41')]){_0x404dfb[_0xbc87('0x3f')]=_[_0xbc87('0x42')](_0x404dfb['where'],{'$or':_[_0xbc87('0x34')](_0x312ebd,function(_0x455537){if(_0x455537[_0xbc87('0x43')]!=='VIRTUAL'){var _0xdfec35={};_0xdfec35[_0x455537[_0xbc87('0x2f')]]={'$like':'%'+_0x480d2e[_0xbc87('0x35')][_0xbc87('0x41')]+'%'};return _0xdfec35;}})});}_0x404dfb=_[_0xbc87('0x42')]({},_0x404dfb,_0x480d2e['options']);var _0xfd7e4d={'where':_0x404dfb[_0xbc87('0x3f')]};return db[_0xbc87('0x44')][_0xbc87('0x20')](_0xfd7e4d)[_0xbc87('0x29')](function(_0x427a3b){_0x400769[_0xbc87('0x20')]=_0x427a3b;if(_0x480d2e['query']['includeAll']){_0x404dfb['include']=[{'all':!![]}];}return db[_0xbc87('0x44')][_0xbc87('0x45')](_0x404dfb);})['then'](function(_0x1d73b0){_0x400769['rows']=_0x1d73b0;return _0x400769;})[_0xbc87('0x29')](respondWithFilteredResult(_0x1fe23a,_0x404dfb))[_0xbc87('0x46')](handleError(_0x1fe23a,null));};exports['show']=function(_0x45a0cb,_0x2121b1){var _0x3ac1f5={'raw':![],'where':{'id':_0x45a0cb[_0xbc87('0x47')]['id']}},_0xe1870a={};_0xe1870a[_0xbc87('0x33')]=_['keys'](db[_0xbc87('0x44')][_0xbc87('0x48')]);_0xe1870a[_0xbc87('0x35')]=_[_0xbc87('0x36')](_0x45a0cb[_0xbc87('0x35')]);_0xe1870a['filters']=_[_0xbc87('0x38')](_0xe1870a[_0xbc87('0x33')],_0xe1870a['query']);_0x3ac1f5['attributes']=_[_0xbc87('0x38')](_0xe1870a['model'],qs[_0xbc87('0x3a')](_0x45a0cb[_0xbc87('0x35')][_0xbc87('0x3a')]));_0x3ac1f5[_0xbc87('0x39')]=_0x3ac1f5[_0xbc87('0x39')]['length']?_0x3ac1f5[_0xbc87('0x39')]:_0xe1870a['model'];if(_0x45a0cb[_0xbc87('0x35')][_0xbc87('0x49')]){_0x3ac1f5[_0xbc87('0x4a')]=[{'all':!![]}];}_0x3ac1f5=_[_0xbc87('0x42')]({},_0x3ac1f5,_0x45a0cb[_0xbc87('0x4b')]);return db[_0xbc87('0x44')][_0xbc87('0x4c')](_0x3ac1f5)[_0xbc87('0x29')](handleEntityNotFound(_0x2121b1,null))[_0xbc87('0x29')](respondWithResult(_0x2121b1,null))[_0xbc87('0x46')](handleError(_0x2121b1,null));};exports[_0xbc87('0x4d')]=function(_0x2f66f1,_0x225fbe){return db[_0xbc87('0x44')][_0xbc87('0x4d')](_0x2f66f1[_0xbc87('0x4e')],{})[_0xbc87('0x29')](function(_0x530b9c){var _0x6497c1=_0x2f66f1['user'][_0xbc87('0x2a')]({'plain':!![]});if(!_0x6497c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6497c1[_0xbc87('0x4f')]===_0xbc87('0x50')){var _0x578d96=_0x530b9c[_0xbc87('0x2a')]({'plain':!![]});var _0x38ca58=_0xbc87('0x2b');return db[_0xbc87('0x51')][_0xbc87('0x4c')]({'where':{'name':_0x38ca58,'userProfileId':_0x6497c1['userProfileId']},'raw':!![]})[_0xbc87('0x29')](function(_0x40cdc1){if(_0x40cdc1&&_0x40cdc1[_0xbc87('0x52')]===0x0){return db[_0xbc87('0x2c')][_0xbc87('0x4d')]({'name':_0x578d96['name'],'resourceId':_0x578d96['id'],'type':_0x40cdc1[_0xbc87('0x2f')],'sectionId':_0x40cdc1['id']},{})['then'](function(){return _0x530b9c;});}else{return _0x530b9c;}})[_0xbc87('0x46')](function(_0x5f2a82){logger[_0xbc87('0x2d')](_0xbc87('0x53'),_0x5f2a82);throw _0x5f2a82;});}return _0x530b9c;})['then'](respondWithResult(_0x225fbe,0xc9))[_0xbc87('0x46')](handleError(_0x225fbe,null));};exports[_0xbc87('0x54')]=function(_0x112cc7,_0x12109e){var _0x12c4d1={'where':{'id':_0x112cc7['params']['id']}},_0x48294c={};_0x48294c[_0xbc87('0x33')]=_['keys'](db[_0xbc87('0x44')][_0xbc87('0x48')]);_0x12c4d1['attributes']=_[_0xbc87('0x38')](_0x48294c['model'],qs['fields'](_0x112cc7[_0xbc87('0x35')][_0xbc87('0x3a')]));_0x12c4d1[_0xbc87('0x39')]=_0x12c4d1[_0xbc87('0x39')][_0xbc87('0x3b')]?_0x12c4d1[_0xbc87('0x39')]:_0x48294c['model'];if(_0x112cc7['query'][_0xbc87('0x49')]){_0x12c4d1[_0xbc87('0x4a')]=[{'all':!![]}];}_0x12c4d1=_[_0xbc87('0x42')]({},_0x12c4d1,_0x112cc7[_0xbc87('0x4b')]);return db[_0xbc87('0x44')][_0xbc87('0x4c')](_0x12c4d1)[_0xbc87('0x29')](handleEntityNotFound(_0x12109e,null))[_0xbc87('0x29')](function(_0x397b93){if(_0x397b93){var _0x38e4c7=_0x397b93[_0xbc87('0x2a')]({'plain':!![]});_0x38e4c7=qs[_0xbc87('0x55')](_0x38e4c7,['id',_0xbc87('0x56'),_0xbc87('0x57')]);_0x112cc7[_0xbc87('0x4e')]=_[_0xbc87('0x55')](_0x112cc7[_0xbc87('0x4e')],['id',_0xbc87('0x56'),_0xbc87('0x57')]);return db[_0xbc87('0x44')][_0xbc87('0x4d')](_[_0xbc87('0x42')](_0x38e4c7,_0x112cc7[_0xbc87('0x4e')]),{'include':_0x112cc7[_0xbc87('0x35')][_0xbc87('0x49')]?[{'all':!![]}]:undefined})[_0xbc87('0x29')](function(_0x14b27c){var _0x289ad4=_0x112cc7[_0xbc87('0x50')][_0xbc87('0x2a')]({'plain':!![]});if(!_0x289ad4)throw new Error(_0xbc87('0x58'));if(_0x289ad4['role']==='user'){var _0x566414=_0x14b27c[_0xbc87('0x2a')]({'plain':!![]});var _0x257535=_0xbc87('0x2b');return db[_0xbc87('0x51')][_0xbc87('0x4c')]({'where':{'name':_0x257535,'userProfileId':_0x289ad4['userProfileId']},'raw':!![]})[_0xbc87('0x29')](function(_0x70600c){if(_0x70600c&&_0x70600c[_0xbc87('0x52')]===0x0){return db[_0xbc87('0x2c')][_0xbc87('0x4d')]({'name':_0x566414[_0xbc87('0x2f')],'resourceId':_0x566414['id'],'type':_0x70600c[_0xbc87('0x2f')],'sectionId':_0x70600c['id']},{})[_0xbc87('0x29')](function(){return _0x14b27c;});}else{return _0x14b27c;}})[_0xbc87('0x46')](function(_0x57e426){logger[_0xbc87('0x2d')](_0xbc87('0x53'),_0x57e426);throw _0x57e426;});}return _0x14b27c;});}})[_0xbc87('0x29')](respondWithResult(_0x12109e,0xc9))[_0xbc87('0x46')](handleError(_0x12109e,null));};exports[_0xbc87('0x27')]=function(_0xd8b455,_0x4c14cd){if(_0xd8b455['body']['id']){delete _0xd8b455['body']['id'];}return db[_0xbc87('0x44')]['find']({'where':{'id':_0xd8b455[_0xbc87('0x47')]['id']}})[_0xbc87('0x29')](handleEntityNotFound(_0x4c14cd,null))['then'](saveUpdates(_0xd8b455[_0xbc87('0x4e')],null))[_0xbc87('0x29')](respondWithResult(_0x4c14cd,null))[_0xbc87('0x46')](handleError(_0x4c14cd,null));};exports['destroy']=function(_0x5e4885,_0x332bcb){return db['JscriptyProject'][_0xbc87('0x4c')]({'where':{'id':_0x5e4885[_0xbc87('0x47')]['id']}})[_0xbc87('0x29')](handleEntityNotFound(_0x332bcb,null))[_0xbc87('0x29')](removeEntity(_0x332bcb,null))[_0xbc87('0x46')](handleError(_0x332bcb,null));};exports[_0xbc87('0x59')]=function(_0x2745c4,_0x3f666a,_0x421d1f){var _0x1659d7={'raw':!![],'where':{}};var _0x62bb40={};var _0x26e0f5={'count':0x0,'rows':[]};return db[_0xbc87('0x44')][_0xbc87('0x5a')]({'where':{'id':_0x2745c4[_0xbc87('0x47')]['id']}})[_0xbc87('0x29')](handleEntityNotFound(_0x3f666a,null))[_0xbc87('0x29')](function(_0x295b5c){if(_0x295b5c){_0x62bb40[_0xbc87('0x33')]=_[_0xbc87('0x36')](db[_0xbc87('0x5b')][_0xbc87('0x48')]);_0x62bb40[_0xbc87('0x35')]=_[_0xbc87('0x36')](_0x2745c4['query']);_0x62bb40[_0xbc87('0x37')]=_[_0xbc87('0x38')](_0x62bb40[_0xbc87('0x33')],_0x62bb40['query']);_0x1659d7[_0xbc87('0x39')]=_[_0xbc87('0x38')](_0x62bb40[_0xbc87('0x33')],qs[_0xbc87('0x3a')](_0x2745c4[_0xbc87('0x35')][_0xbc87('0x3a')]));_0x1659d7[_0xbc87('0x39')]=_0x1659d7[_0xbc87('0x39')][_0xbc87('0x3b')]?_0x1659d7[_0xbc87('0x39')]:_0x62bb40[_0xbc87('0x33')];if(!_0x2745c4[_0xbc87('0x35')][_0xbc87('0x3c')]('nolimit')){_0x1659d7[_0xbc87('0x1f')]=qs['limit'](_0x2745c4['query'][_0xbc87('0x1f')]);_0x1659d7[_0xbc87('0x21')]=qs[_0xbc87('0x21')](_0x2745c4[_0xbc87('0x35')][_0xbc87('0x21')]);}_0x1659d7[_0xbc87('0x5c')]=qs['sort'](_0x2745c4[_0xbc87('0x35')][_0xbc87('0x3e')]);_0x1659d7[_0xbc87('0x3f')]=qs[_0xbc87('0x37')](_[_0xbc87('0x40')](_0x2745c4[_0xbc87('0x35')],_0x62bb40[_0xbc87('0x37')]));_0x1659d7[_0xbc87('0x3f')][_0xbc87('0x5d')]=_0x295b5c['id'];if(_0x2745c4['query'][_0xbc87('0x41')]){_0x1659d7[_0xbc87('0x3f')]=_[_0xbc87('0x42')](_0x1659d7[_0xbc87('0x3f')],{'$or':_[_0xbc87('0x34')](_0x1659d7[_0xbc87('0x39')],function(_0x26891a){var _0x10d04a={};_0x10d04a[_0x26891a]={'$like':'%'+_0x2745c4[_0xbc87('0x35')][_0xbc87('0x41')]+'%'};return _0x10d04a;})});}_0x1659d7=_['merge']({},_0x1659d7,_0x2745c4[_0xbc87('0x4b')]);return db[_0xbc87('0x5b')][_0xbc87('0x20')]({'where':_0x1659d7[_0xbc87('0x3f')]})['then'](function(_0x3ebd6b){_0x26e0f5['count']=_0x3ebd6b;if(_0x2745c4[_0xbc87('0x35')][_0xbc87('0x49')]){_0x1659d7['include']=[{'all':!![]}];}return db[_0xbc87('0x5b')]['findAll'](_0x1659d7);})['then'](function(_0x4c912c){_0x26e0f5[_0xbc87('0x5e')]=_0x4c912c;return _0x26e0f5;});}})[_0xbc87('0x29')](respondWithFilteredResult(_0x3f666a,_0x1659d7))['catch'](handleError(_0x3f666a,null));};exports[_0xbc87('0x5f')]=function(_0xa2b9a4,_0x509623,_0x2a8171){var _0x40d9a8={'raw':!![],'where':{}};var _0xfdd155={};var _0x4a979e={'count':0x0,'rows':[]};return db[_0xbc87('0x44')][_0xbc87('0x5a')]({'where':{'id':_0xa2b9a4[_0xbc87('0x47')]['id']}})[_0xbc87('0x29')](handleEntityNotFound(_0x509623,null))['then'](function(_0x1d0d57){if(_0x1d0d57){_0xfdd155['model']=_[_0xbc87('0x36')](db[_0xbc87('0x60')][_0xbc87('0x48')]);_0xfdd155['query']=_[_0xbc87('0x36')](_0xa2b9a4['query']);_0xfdd155[_0xbc87('0x37')]=_[_0xbc87('0x38')](_0xfdd155[_0xbc87('0x33')],_0xfdd155[_0xbc87('0x35')]);_0x40d9a8[_0xbc87('0x39')]=_[_0xbc87('0x38')](_0xfdd155[_0xbc87('0x33')],qs['fields'](_0xa2b9a4['query'][_0xbc87('0x3a')]));_0x40d9a8[_0xbc87('0x39')]=_0x40d9a8[_0xbc87('0x39')][_0xbc87('0x3b')]?_0x40d9a8[_0xbc87('0x39')]:_0xfdd155[_0xbc87('0x33')];if(!_0xa2b9a4['query'][_0xbc87('0x3c')]('nolimit')){_0x40d9a8[_0xbc87('0x1f')]=qs[_0xbc87('0x1f')](_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x1f')]);_0x40d9a8[_0xbc87('0x21')]=qs[_0xbc87('0x21')](_0xa2b9a4[_0xbc87('0x35')]['offset']);}_0x40d9a8[_0xbc87('0x5c')]=qs['sort'](_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x3e')]);_0x40d9a8['where']=qs['filters'](_[_0xbc87('0x40')](_0xa2b9a4['query'],_0xfdd155[_0xbc87('0x37')]));_0x40d9a8['where']['ProjectId']=_0x1d0d57['id'];if(_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x41')]){_0x40d9a8[_0xbc87('0x3f')]=_[_0xbc87('0x42')](_0x40d9a8[_0xbc87('0x3f')],{'$or':_[_0xbc87('0x34')](_0x40d9a8[_0xbc87('0x39')],function(_0x8bce11){var _0xe8096d={};_0xe8096d[_0x8bce11]={'$like':'%'+_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x41')]+'%'};return _0xe8096d;})});}_0x40d9a8=_[_0xbc87('0x42')]({},_0x40d9a8,_0xa2b9a4[_0xbc87('0x4b')]);return db[_0xbc87('0x60')][_0xbc87('0x20')]({'where':_0x40d9a8['where']})['then'](function(_0x2c828f){_0x4a979e[_0xbc87('0x20')]=_0x2c828f;if(_0xa2b9a4[_0xbc87('0x35')][_0xbc87('0x49')]){_0x40d9a8['include']=[{'all':!![]}];}return db[_0xbc87('0x60')][_0xbc87('0x45')](_0x40d9a8);})[_0xbc87('0x29')](function(_0xb35e01){_0x4a979e[_0xbc87('0x5e')]=_0xb35e01;return _0x4a979e;});}})[_0xbc87('0x29')](respondWithFilteredResult(_0x509623,_0x40d9a8))['catch'](handleError(_0x509623,null));};function char(_0x37597f){return _0xbc87('0x61')===typeof _0x37597f?String[_0xbc87('0x62')]['apply'](null,arguments):_0x37597f;}function needsEncapsulation(_0x4e002e){return!!_0x4e002e&&(_0x4e002e['toString']()[_0xbc87('0x63')](char(0xd))>=0x0||_0x4e002e[_0xbc87('0x64')]()[_0xbc87('0x63')](char(0xa))>=0x0||_0x4e002e[_0xbc87('0x64')]()[_0xbc87('0x63')](char(0x2c))>=0x0||_0x4e002e[_0xbc87('0x64')]()[_0xbc87('0x63')](char(0x22))>=0x0);}function encapsulate(_0x15faf1){var _0x17043d=char(0x22),_0x30ae73='\x5c'+char(0x22),_0x4fd064=_0x15faf1[_0xbc87('0x64')]()[_0xbc87('0x65')](new RegExp(_0x17043d,'g'),_0x30ae73);return _0x17043d+_0x4fd064+_0x17043d;}exports[_0xbc87('0x66')]=function(_0x42f8c1,_0x48365f,_0x1313ff){var _0x40e4bc,_0x9c13dd;var _0x5e7a07={'where':{'ProjectId':_0x42f8c1[_0xbc87('0x47')]['id']}};if(_0x42f8c1[_0xbc87('0x35')]['startTime']){_0x5e7a07['where']['starttime']=JSON['parse'](_0x42f8c1[_0xbc87('0x35')][_0xbc87('0x67')]);}return db[_0xbc87('0x5b')][_0xbc87('0x45')](_0x5e7a07)['then'](handleEntityNotFound(_0x48365f,null))[_0xbc87('0x29')](function(_0x293421){if(_0x293421){_0x40e4bc=_0x293421;return db[_0xbc87('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0xbc87('0x34')](_0x40e4bc,'id')},'ProjectId':_0x42f8c1['params']['id']},'order':'-createdAt'});}})[_0xbc87('0x29')](handleEntityNotFound(_0x48365f,null))[_0xbc87('0x29')](function(_0x2517a4){if(_0x2517a4){_0x9c13dd=_0x2517a4;var _0x430eb4={};for(var _0x21dbb6=0x0,_0x424fbe=_0x9c13dd[_0xbc87('0x3b')];_0x21dbb6<_0x424fbe;_0x21dbb6++){if(!_0x430eb4[_0xbc87('0x3c')](_0x9c13dd[_0x21dbb6][_0xbc87('0x69')])){_0x430eb4[_0x9c13dd[_0x21dbb6][_0xbc87('0x69')]]=needsEncapsulation(_0x9c13dd[_0x21dbb6][_0xbc87('0x6a')])?encapsulate(_0x9c13dd[_0x21dbb6][_0xbc87('0x6a')]):_0x9c13dd[_0x21dbb6][_0xbc87('0x6a')];}}var _0x34fa7f=[],_0x275bb6={};for(var _0x3330f0=0x0,_0x106728=_0x40e4bc[_0xbc87('0x3b')];_0x3330f0<_0x106728;_0x3330f0++){_0x275bb6={'ProjectId':_0x42f8c1['params']['id'],'SessionId':_0x40e4bc[_0x3330f0]['id'],'StartTime':moment(_0x40e4bc[_0x3330f0][_0xbc87('0x6b')])['format'](_0xbc87('0x6c'))};for(var _0x4d6872=0x0,_0x496949=_0x9c13dd['length'];_0x4d6872<_0x496949;_0x4d6872++){if(_0x9c13dd[_0x4d6872][_0xbc87('0x6d')]==_0x40e4bc[_0x3330f0]['id']&&_0x430eb4[_0xbc87('0x3c')](_0x9c13dd[_0x4d6872][_0xbc87('0x69')])){_0x275bb6[_0x430eb4[_0x9c13dd[_0x4d6872][_0xbc87('0x69')]]]=_0x9c13dd[_0x4d6872]['answer'];}}for(var _0x3060e0 in _0x430eb4){if(!_0x275bb6[_0xbc87('0x3c')](_0x430eb4[_0x3060e0])){_0x275bb6[_0x430eb4[_0x3060e0]]=null;}}_0x34fa7f[_0xbc87('0x6e')](_0x275bb6);}return _0x34fa7f;}})['then'](function(_0x1ca4dc){if(!_[_0xbc87('0x6f')](_0x1ca4dc)){var _0x39feed=toCsv(_0x1ca4dc);var _0x347d85=Date[_0xbc87('0x70')]();fs[_0xbc87('0x71')](util['format'](_0xbc87('0x72'),_0x42f8c1[_0xbc87('0x47')]['id'],_0x347d85),_0x39feed);_0x48365f['setHeader'](_0xbc87('0x73'),_0xbc87('0x74')+util[_0xbc87('0x75')](_0xbc87('0x76'),_0x42f8c1[_0xbc87('0x47')]['id'],_0x347d85));_0x48365f[_0xbc87('0x77')](_0xbc87('0x78'),_0xbc87('0x79'));return _0x48365f[_0xbc87('0x7a')](util[_0xbc87('0x75')](_0xbc87('0x72'),_0x42f8c1['params']['id'],_0x347d85));}else{return _0x48365f[_0xbc87('0x1a')](0xcc);}})[_0xbc87('0x46')](handleError(_0x48365f,null));}; \ No newline at end of file +var _0xe54c=['now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','Projects','error','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','JscriptySessionReport','hasOwnProperty','ProjectId','findOne','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','isEmpty'];(function(_0x64a51,_0x1c61b7){var _0x1eba45=function(_0x230cf8){while(--_0x230cf8){_0x64a51['push'](_0x64a51['shift']());}};_0x1eba45(++_0x1c61b7);}(_0xe54c,0x79));var _0xce54=function(_0x25acfe,_0x3797bc){_0x25acfe=_0x25acfe-0x0;var _0x547928=_0xe54c[_0x25acfe];return _0x547928;};'use strict';var emlformat=require(_0xce54('0x0'));var rimraf=require(_0xce54('0x1'));var zipdir=require(_0xce54('0x2'));var jsonpatch=require(_0xce54('0x3'));var rp=require(_0xce54('0x4'));var moment=require(_0xce54('0x5'));var BPromise=require(_0xce54('0x6'));var Mustache=require(_0xce54('0x7'));var util=require('util');var path=require(_0xce54('0x8'));var sox=require('sox');var csv=require(_0xce54('0x9'));var ejs=require(_0xce54('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce54('0xb'));var squel=require('squel');var crypto=require(_0xce54('0xc'));var jsforce=require(_0xce54('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce54('0x9'));var querystring=require(_0xce54('0xe'));var Papa=require(_0xce54('0xf'));var Redis=require(_0xce54('0x10'));var authService=require(_0xce54('0x11'));var qs=require(_0xce54('0x12'));var as=require(_0xce54('0x13'));var hardwareService=require(_0xce54('0x14'));var logger=require(_0xce54('0x15'))(_0xce54('0x16'));var utils=require(_0xce54('0x17'));var config=require(_0xce54('0x18'));var licenseUtil=require(_0xce54('0x19'));var db=require(_0xce54('0x1a'))['db'];function respondWithStatusCode(_0x5a0590,_0x50f922){_0x50f922=_0x50f922||0xcc;return function(_0x5a0562){if(_0x5a0562){return _0x5a0590[_0xce54('0x1b')](_0x50f922);}return _0x5a0590['status'](_0x50f922)[_0xce54('0x1c')]();};}function respondWithResult(_0x1f7a09,_0x57e827){_0x57e827=_0x57e827||0xc8;return function(_0x586520){if(_0x586520){return _0x1f7a09[_0xce54('0x1d')](_0x57e827)[_0xce54('0x1e')](_0x586520);}};}function respondWithFilteredResult(_0x14b863,_0x19724c){return function(_0x3c8569){if(_0x3c8569){var _0x57effb=typeof _0x19724c['offset']===_0xce54('0x1f')&&typeof _0x19724c[_0xce54('0x20')]===_0xce54('0x1f');var _0x4ed7f3=_0x3c8569[_0xce54('0x21')];var _0x4a670a=_0x57effb?0x0:_0x19724c[_0xce54('0x22')];var _0x523dc3=_0x57effb?_0x3c8569[_0xce54('0x21')]:_0x19724c['offset']+_0x19724c[_0xce54('0x20')];var _0x6c7d2;if(_0x523dc3>=_0x4ed7f3){_0x523dc3=_0x4ed7f3;_0x6c7d2=0xc8;}else{_0x6c7d2=0xce;}_0x14b863[_0xce54('0x1d')](_0x6c7d2);return _0x14b863[_0xce54('0x23')](_0xce54('0x24'),_0x4a670a+'-'+_0x523dc3+'/'+_0x4ed7f3)['json'](_0x3c8569);}return null;};}function patchUpdates(_0x50fe8c){return function(_0x375ae4){try{jsonpatch[_0xce54('0x25')](_0x375ae4,_0x50fe8c,!![]);}catch(_0x217877){return BPromise[_0xce54('0x26')](_0x217877);}return _0x375ae4[_0xce54('0x27')]();};}function saveUpdates(_0x23caa8,_0x35c3a8){return function(_0x486d35){if(_0x486d35){return _0x486d35['update'](_0x23caa8)[_0xce54('0x28')](function(_0x58ee98){return _0x58ee98;});}return null;};}function removeEntity(_0x3a6649,_0x3c41c3){return function(_0x3a96e6){if(_0x3a96e6){return _0x3a96e6[_0xce54('0x29')]()[_0xce54('0x28')](function(){var _0x2d83be=_0x3a96e6['get']({'plain':!![]});var _0xacd220=_0xce54('0x2a');return db['UserProfileResource'][_0xce54('0x29')]({'where':{'type':_0xacd220,'resourceId':_0x2d83be['id']}})[_0xce54('0x28')](function(){return _0x3a96e6;});})[_0xce54('0x28')](function(){_0x3a6649[_0xce54('0x1d')](0xcc)[_0xce54('0x1c')]();});}};}function handleEntityNotFound(_0x1cb75f,_0x4d3495){return function(_0x3e1a28){if(!_0x3e1a28){_0x1cb75f['sendStatus'](0x194);}return _0x3e1a28;};}function handleError(_0x585ef3,_0x1461c7){_0x1461c7=_0x1461c7||0x1f4;return function(_0x243aff){logger[_0xce54('0x2b')](_0x243aff['stack']);if(_0x243aff[_0xce54('0x2c')]){delete _0x243aff[_0xce54('0x2c')];}_0x585ef3['status'](_0x1461c7)['send'](_0x243aff);};}exports[_0xce54('0x2d')]=function(_0x1bb48d,_0x620627){var _0x526b90={},_0xe660d2={},_0x27a65e={'count':0x0,'rows':[]};var _0x3cbdab=_[_0xce54('0x2e')](db[_0xce54('0x2f')][_0xce54('0x30')],function(_0x8ac4d3){return{'name':_0x8ac4d3[_0xce54('0x31')],'type':_0x8ac4d3[_0xce54('0x32')][_0xce54('0x33')]};});_0xe660d2[_0xce54('0x34')]=_[_0xce54('0x2e')](_0x3cbdab,'name');_0xe660d2['query']=_['keys'](_0x1bb48d[_0xce54('0x35')]);_0xe660d2[_0xce54('0x36')]=_['intersection'](_0xe660d2['model'],_0xe660d2[_0xce54('0x35')]);_0x526b90[_0xce54('0x37')]=_[_0xce54('0x38')](_0xe660d2[_0xce54('0x34')],qs[_0xce54('0x39')](_0x1bb48d[_0xce54('0x35')][_0xce54('0x39')]));_0x526b90[_0xce54('0x37')]=_0x526b90[_0xce54('0x37')][_0xce54('0x3a')]?_0x526b90['attributes']:_0xe660d2['model'];if(!_0x1bb48d['query']['hasOwnProperty'](_0xce54('0x3b'))){_0x526b90[_0xce54('0x20')]=qs[_0xce54('0x20')](_0x1bb48d[_0xce54('0x35')]['limit']);_0x526b90[_0xce54('0x22')]=qs['offset'](_0x1bb48d[_0xce54('0x35')][_0xce54('0x22')]);}_0x526b90[_0xce54('0x3c')]=qs['sort'](_0x1bb48d['query'][_0xce54('0x3d')]);_0x526b90['where']=qs['filters'](_[_0xce54('0x3e')](_0x1bb48d[_0xce54('0x35')],_0xe660d2[_0xce54('0x36')]),_0x3cbdab);if(_0x1bb48d[_0xce54('0x35')][_0xce54('0x3f')]){_0x526b90[_0xce54('0x40')]=_[_0xce54('0x41')](_0x526b90[_0xce54('0x40')],{'$or':_[_0xce54('0x2e')](_0x3cbdab,function(_0x2aefb9){if(_0x2aefb9[_0xce54('0x32')]!==_0xce54('0x42')){var _0x324f24={};_0x324f24[_0x2aefb9[_0xce54('0x2c')]]={'$like':'%'+_0x1bb48d[_0xce54('0x35')][_0xce54('0x3f')]+'%'};return _0x324f24;}})});}_0x526b90=_['merge']({},_0x526b90,_0x1bb48d[_0xce54('0x43')]);var _0x59232c={'where':_0x526b90['where']};return db['JscriptyProject'][_0xce54('0x21')](_0x59232c)['then'](function(_0x5b76a6){_0x27a65e[_0xce54('0x21')]=_0x5b76a6;if(_0x1bb48d[_0xce54('0x35')][_0xce54('0x44')]){_0x526b90['include']=[{'all':!![]}];}return db[_0xce54('0x2f')][_0xce54('0x45')](_0x526b90);})['then'](function(_0x34ba65){_0x27a65e[_0xce54('0x46')]=_0x34ba65;return _0x27a65e;})[_0xce54('0x28')](respondWithFilteredResult(_0x620627,_0x526b90))[_0xce54('0x47')](handleError(_0x620627,null));};exports['show']=function(_0x413473,_0x5a40be){var _0x48a9c3={'raw':![],'where':{'id':_0x413473[_0xce54('0x48')]['id']}},_0x171669={};_0x171669['model']=_['keys'](db['JscriptyProject'][_0xce54('0x30')]);_0x171669[_0xce54('0x35')]=_[_0xce54('0x49')](_0x413473[_0xce54('0x35')]);_0x171669[_0xce54('0x36')]=_[_0xce54('0x38')](_0x171669[_0xce54('0x34')],_0x171669[_0xce54('0x35')]);_0x48a9c3[_0xce54('0x37')]=_[_0xce54('0x38')](_0x171669[_0xce54('0x34')],qs[_0xce54('0x39')](_0x413473['query'][_0xce54('0x39')]));_0x48a9c3[_0xce54('0x37')]=_0x48a9c3[_0xce54('0x37')]['length']?_0x48a9c3[_0xce54('0x37')]:_0x171669[_0xce54('0x34')];if(_0x413473[_0xce54('0x35')][_0xce54('0x44')]){_0x48a9c3[_0xce54('0x4a')]=[{'all':!![]}];}_0x48a9c3=_[_0xce54('0x41')]({},_0x48a9c3,_0x413473[_0xce54('0x43')]);return db[_0xce54('0x2f')][_0xce54('0x4b')](_0x48a9c3)[_0xce54('0x28')](handleEntityNotFound(_0x5a40be,null))[_0xce54('0x28')](respondWithResult(_0x5a40be,null))[_0xce54('0x47')](handleError(_0x5a40be,null));};exports['create']=function(_0x4ec949,_0x4c47e6){return db['JscriptyProject'][_0xce54('0x4c')](_0x4ec949[_0xce54('0x4d')],{})[_0xce54('0x28')](function(_0x2ce1fc){var _0x441919=_0x4ec949[_0xce54('0x4e')]['get']({'plain':!![]});if(!_0x441919)throw new Error(_0xce54('0x4f'));if(_0x441919[_0xce54('0x50')]===_0xce54('0x4e')){var _0x1e6360=_0x2ce1fc[_0xce54('0x51')]({'plain':!![]});var _0x324ab1='Projects';return db['UserProfileSection'][_0xce54('0x4b')]({'where':{'name':_0x324ab1,'userProfileId':_0x441919[_0xce54('0x52')]},'raw':!![]})['then'](function(_0x1ecdd0){if(_0x1ecdd0&&_0x1ecdd0['autoAssociation']===0x0){return db[_0xce54('0x53')][_0xce54('0x4c')]({'name':_0x1e6360[_0xce54('0x2c')],'resourceId':_0x1e6360['id'],'type':_0x1ecdd0['name'],'sectionId':_0x1ecdd0['id']},{})[_0xce54('0x28')](function(){return _0x2ce1fc;});}else{return _0x2ce1fc;}})[_0xce54('0x47')](function(_0x322dc4){logger[_0xce54('0x2b')](_0xce54('0x54'),_0x322dc4);throw _0x322dc4;});}return _0x2ce1fc;})[_0xce54('0x28')](respondWithResult(_0x4c47e6,0xc9))[_0xce54('0x47')](handleError(_0x4c47e6,null));};exports['clone']=function(_0x31c0df,_0x8f0279){var _0x1517d4={'where':{'id':_0x31c0df[_0xce54('0x48')]['id']}},_0x432afb={};_0x432afb[_0xce54('0x34')]=_['keys'](db[_0xce54('0x2f')][_0xce54('0x30')]);_0x1517d4['attributes']=_[_0xce54('0x38')](_0x432afb[_0xce54('0x34')],qs[_0xce54('0x39')](_0x31c0df[_0xce54('0x35')][_0xce54('0x39')]));_0x1517d4[_0xce54('0x37')]=_0x1517d4[_0xce54('0x37')]['length']?_0x1517d4[_0xce54('0x37')]:_0x432afb[_0xce54('0x34')];if(_0x31c0df[_0xce54('0x35')]['includeAll']){_0x1517d4['include']=[{'all':!![]}];}_0x1517d4=_[_0xce54('0x41')]({},_0x1517d4,_0x31c0df['options']);return db[_0xce54('0x2f')][_0xce54('0x4b')](_0x1517d4)[_0xce54('0x28')](handleEntityNotFound(_0x8f0279,null))['then'](function(_0x537a47){if(_0x537a47){var _0x2c3c7=_0x537a47[_0xce54('0x51')]({'plain':!![]});_0x2c3c7=qs[_0xce54('0x55')](_0x2c3c7,['id',_0xce54('0x56'),_0xce54('0x57')]);_0x31c0df[_0xce54('0x4d')]=_[_0xce54('0x55')](_0x31c0df['body'],['id',_0xce54('0x56'),_0xce54('0x57')]);return db[_0xce54('0x2f')][_0xce54('0x4c')](_['merge'](_0x2c3c7,_0x31c0df['body']),{'include':_0x31c0df['query'][_0xce54('0x44')]?[{'all':!![]}]:undefined})[_0xce54('0x28')](function(_0x42fb15){var _0x24ecb5=_0x31c0df[_0xce54('0x4e')]['get']({'plain':!![]});if(!_0x24ecb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24ecb5[_0xce54('0x50')]==='user'){var _0x43931e=_0x42fb15[_0xce54('0x51')]({'plain':!![]});var _0x4621a5='Projects';return db['UserProfileSection'][_0xce54('0x4b')]({'where':{'name':_0x4621a5,'userProfileId':_0x24ecb5[_0xce54('0x52')]},'raw':!![]})[_0xce54('0x28')](function(_0x3e2def){if(_0x3e2def&&_0x3e2def['autoAssociation']===0x0){return db['UserProfileResource'][_0xce54('0x4c')]({'name':_0x43931e['name'],'resourceId':_0x43931e['id'],'type':_0x3e2def[_0xce54('0x2c')],'sectionId':_0x3e2def['id']},{})[_0xce54('0x28')](function(){return _0x42fb15;});}else{return _0x42fb15;}})[_0xce54('0x47')](function(_0x18996c){logger[_0xce54('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18996c);throw _0x18996c;});}return _0x42fb15;});}})[_0xce54('0x28')](respondWithResult(_0x8f0279,0xc9))[_0xce54('0x47')](handleError(_0x8f0279,null));};exports['update']=function(_0x396e25,_0x146df4){if(_0x396e25[_0xce54('0x4d')]['id']){delete _0x396e25[_0xce54('0x4d')]['id'];}return db[_0xce54('0x2f')][_0xce54('0x4b')]({'where':{'id':_0x396e25[_0xce54('0x48')]['id']}})[_0xce54('0x28')](handleEntityNotFound(_0x146df4,null))[_0xce54('0x28')](saveUpdates(_0x396e25[_0xce54('0x4d')],null))[_0xce54('0x28')](respondWithResult(_0x146df4,null))[_0xce54('0x47')](handleError(_0x146df4,null));};exports[_0xce54('0x29')]=function(_0x4d74e3,_0xf01211){return db[_0xce54('0x2f')][_0xce54('0x4b')]({'where':{'id':_0x4d74e3['params']['id']}})['then'](handleEntityNotFound(_0xf01211,null))[_0xce54('0x28')](removeEntity(_0xf01211,null))[_0xce54('0x47')](handleError(_0xf01211,null));};exports['getSessions']=function(_0x3c25ed,_0x1ca193,_0x67afb9){var _0x56023d={'raw':!![],'where':{}};var _0x4e15af={};var _0x5a1c15={'count':0x0,'rows':[]};return db[_0xce54('0x2f')]['findOne']({'where':{'id':_0x3c25ed[_0xce54('0x48')]['id']}})[_0xce54('0x28')](handleEntityNotFound(_0x1ca193,null))[_0xce54('0x28')](function(_0x403053){if(_0x403053){_0x4e15af[_0xce54('0x34')]=_[_0xce54('0x49')](db[_0xce54('0x58')][_0xce54('0x30')]);_0x4e15af[_0xce54('0x35')]=_[_0xce54('0x49')](_0x3c25ed[_0xce54('0x35')]);_0x4e15af[_0xce54('0x36')]=_[_0xce54('0x38')](_0x4e15af['model'],_0x4e15af['query']);_0x56023d['attributes']=_[_0xce54('0x38')](_0x4e15af[_0xce54('0x34')],qs[_0xce54('0x39')](_0x3c25ed[_0xce54('0x35')][_0xce54('0x39')]));_0x56023d[_0xce54('0x37')]=_0x56023d[_0xce54('0x37')][_0xce54('0x3a')]?_0x56023d[_0xce54('0x37')]:_0x4e15af[_0xce54('0x34')];if(!_0x3c25ed[_0xce54('0x35')][_0xce54('0x59')](_0xce54('0x3b'))){_0x56023d[_0xce54('0x20')]=qs['limit'](_0x3c25ed[_0xce54('0x35')][_0xce54('0x20')]);_0x56023d['offset']=qs['offset'](_0x3c25ed[_0xce54('0x35')][_0xce54('0x22')]);}_0x56023d[_0xce54('0x3c')]=qs[_0xce54('0x3d')](_0x3c25ed[_0xce54('0x35')]['sort']);_0x56023d['where']=qs['filters'](_[_0xce54('0x3e')](_0x3c25ed[_0xce54('0x35')],_0x4e15af[_0xce54('0x36')]));_0x56023d[_0xce54('0x40')][_0xce54('0x5a')]=_0x403053['id'];if(_0x3c25ed[_0xce54('0x35')][_0xce54('0x3f')]){_0x56023d[_0xce54('0x40')]=_[_0xce54('0x41')](_0x56023d['where'],{'$or':_[_0xce54('0x2e')](_0x56023d[_0xce54('0x37')],function(_0x570432){var _0x3b3f95={};_0x3b3f95[_0x570432]={'$like':'%'+_0x3c25ed[_0xce54('0x35')][_0xce54('0x3f')]+'%'};return _0x3b3f95;})});}_0x56023d=_[_0xce54('0x41')]({},_0x56023d,_0x3c25ed[_0xce54('0x43')]);return db[_0xce54('0x58')][_0xce54('0x21')]({'where':_0x56023d[_0xce54('0x40')]})[_0xce54('0x28')](function(_0xaa583a){_0x5a1c15[_0xce54('0x21')]=_0xaa583a;if(_0x3c25ed[_0xce54('0x35')][_0xce54('0x44')]){_0x56023d[_0xce54('0x4a')]=[{'all':!![]}];}return db[_0xce54('0x58')]['findAll'](_0x56023d);})[_0xce54('0x28')](function(_0x4a8bea){_0x5a1c15[_0xce54('0x46')]=_0x4a8bea;return _0x5a1c15;});}})['then'](respondWithFilteredResult(_0x1ca193,_0x56023d))[_0xce54('0x47')](handleError(_0x1ca193,null));};exports['getAnswers']=function(_0x14e5f6,_0x5884cf,_0x1c6372){var _0x39b06f={'raw':!![],'where':{}};var _0x62c7c1={};var _0x1dc888={'count':0x0,'rows':[]};return db[_0xce54('0x2f')][_0xce54('0x5b')]({'where':{'id':_0x14e5f6[_0xce54('0x48')]['id']}})[_0xce54('0x28')](handleEntityNotFound(_0x5884cf,null))['then'](function(_0x6eb4c8){if(_0x6eb4c8){_0x62c7c1[_0xce54('0x34')]=_[_0xce54('0x49')](db['JscriptyAnswerReport']['rawAttributes']);_0x62c7c1['query']=_[_0xce54('0x49')](_0x14e5f6[_0xce54('0x35')]);_0x62c7c1[_0xce54('0x36')]=_[_0xce54('0x38')](_0x62c7c1[_0xce54('0x34')],_0x62c7c1['query']);_0x39b06f['attributes']=_[_0xce54('0x38')](_0x62c7c1[_0xce54('0x34')],qs[_0xce54('0x39')](_0x14e5f6[_0xce54('0x35')][_0xce54('0x39')]));_0x39b06f[_0xce54('0x37')]=_0x39b06f[_0xce54('0x37')][_0xce54('0x3a')]?_0x39b06f['attributes']:_0x62c7c1[_0xce54('0x34')];if(!_0x14e5f6[_0xce54('0x35')][_0xce54('0x59')](_0xce54('0x3b'))){_0x39b06f['limit']=qs[_0xce54('0x20')](_0x14e5f6[_0xce54('0x35')][_0xce54('0x20')]);_0x39b06f[_0xce54('0x22')]=qs[_0xce54('0x22')](_0x14e5f6[_0xce54('0x35')]['offset']);}_0x39b06f[_0xce54('0x3c')]=qs[_0xce54('0x3d')](_0x14e5f6[_0xce54('0x35')]['sort']);_0x39b06f[_0xce54('0x40')]=qs[_0xce54('0x36')](_[_0xce54('0x3e')](_0x14e5f6['query'],_0x62c7c1['filters']));_0x39b06f[_0xce54('0x40')][_0xce54('0x5a')]=_0x6eb4c8['id'];if(_0x14e5f6[_0xce54('0x35')][_0xce54('0x3f')]){_0x39b06f[_0xce54('0x40')]=_[_0xce54('0x41')](_0x39b06f[_0xce54('0x40')],{'$or':_[_0xce54('0x2e')](_0x39b06f['attributes'],function(_0x5bbc9c){var _0x5c9bf1={};_0x5c9bf1[_0x5bbc9c]={'$like':'%'+_0x14e5f6[_0xce54('0x35')][_0xce54('0x3f')]+'%'};return _0x5c9bf1;})});}_0x39b06f=_[_0xce54('0x41')]({},_0x39b06f,_0x14e5f6[_0xce54('0x43')]);return db['JscriptyAnswerReport'][_0xce54('0x21')]({'where':_0x39b06f['where']})[_0xce54('0x28')](function(_0x1427e9){_0x1dc888[_0xce54('0x21')]=_0x1427e9;if(_0x14e5f6['query'][_0xce54('0x44')]){_0x39b06f['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x39b06f);})[_0xce54('0x28')](function(_0x15a40d){_0x1dc888['rows']=_0x15a40d;return _0x1dc888;});}})[_0xce54('0x28')](respondWithFilteredResult(_0x5884cf,_0x39b06f))[_0xce54('0x47')](handleError(_0x5884cf,null));};function char(_0x39dbb1){return _0xce54('0x5c')===typeof _0x39dbb1?String[_0xce54('0x5d')][_0xce54('0x25')](null,arguments):_0x39dbb1;}function needsEncapsulation(_0x30668b){return!!_0x30668b&&(_0x30668b[_0xce54('0x5e')]()[_0xce54('0x5f')](char(0xd))>=0x0||_0x30668b[_0xce54('0x5e')]()[_0xce54('0x5f')](char(0xa))>=0x0||_0x30668b['toString']()[_0xce54('0x5f')](char(0x2c))>=0x0||_0x30668b[_0xce54('0x5e')]()[_0xce54('0x5f')](char(0x22))>=0x0);}function encapsulate(_0xfd8861){var _0x44baaa=char(0x22),_0x580700='\x5c'+char(0x22),_0x19f346=_0xfd8861[_0xce54('0x5e')]()['replace'](new RegExp(_0x44baaa,'g'),_0x580700);return _0x44baaa+_0x19f346+_0x44baaa;}exports[_0xce54('0x60')]=function(_0x32154b,_0x249297,_0x350010){var _0x2bea25,_0x491491;var _0x48970f={'where':{'ProjectId':_0x32154b['params']['id']}};if(_0x32154b[_0xce54('0x35')][_0xce54('0x61')]){_0x48970f[_0xce54('0x40')][_0xce54('0x62')]=JSON[_0xce54('0x63')](_0x32154b[_0xce54('0x35')][_0xce54('0x61')]);}return db[_0xce54('0x58')]['findAll'](_0x48970f)[_0xce54('0x28')](handleEntityNotFound(_0x249297,null))[_0xce54('0x28')](function(_0x5cc9f1){if(_0x5cc9f1){_0x2bea25=_0x5cc9f1;return db[_0xce54('0x64')][_0xce54('0x45')]({'where':{'SessionId':{'$in':_[_0xce54('0x2e')](_0x2bea25,'id')},'ProjectId':_0x32154b['params']['id']},'order':_0xce54('0x65')});}})[_0xce54('0x28')](handleEntityNotFound(_0x249297,null))[_0xce54('0x28')](function(_0x39428b){if(_0x39428b){_0x491491=_0x39428b;var _0xca45={};for(var _0x48b65a=0x0,_0x256d63=_0x491491[_0xce54('0x3a')];_0x48b65a<_0x256d63;_0x48b65a++){if(!_0xca45['hasOwnProperty'](_0x491491[_0x48b65a][_0xce54('0x66')])){_0xca45[_0x491491[_0x48b65a]['questionId']]=needsEncapsulation(_0x491491[_0x48b65a]['question'])?encapsulate(_0x491491[_0x48b65a][_0xce54('0x67')]):_0x491491[_0x48b65a][_0xce54('0x67')];}}var _0x3903cd=[],_0x263149={};for(var _0x2c5e0a=0x0,_0x686d23=_0x2bea25['length'];_0x2c5e0a<_0x686d23;_0x2c5e0a++){_0x263149={'ProjectId':_0x32154b[_0xce54('0x48')]['id'],'SessionId':_0x2bea25[_0x2c5e0a]['id'],'StartTime':moment(_0x2bea25[_0x2c5e0a][_0xce54('0x62')])[_0xce54('0x68')](_0xce54('0x69'))};for(var _0x15197d=0x0,_0x20a83f=_0x491491[_0xce54('0x3a')];_0x15197d<_0x20a83f;_0x15197d++){if(_0x491491[_0x15197d]['SessionId']==_0x2bea25[_0x2c5e0a]['id']&&_0xca45[_0xce54('0x59')](_0x491491[_0x15197d][_0xce54('0x66')])){_0x263149[_0xca45[_0x491491[_0x15197d]['questionId']]]=_0x491491[_0x15197d]['answer'];}}for(var _0x19bd08 in _0xca45){if(!_0x263149[_0xce54('0x59')](_0xca45[_0x19bd08])){_0x263149[_0xca45[_0x19bd08]]=null;}}_0x3903cd['push'](_0x263149);}return _0x3903cd;}})[_0xce54('0x28')](function(_0x310034){if(!_[_0xce54('0x6a')](_0x310034)){var _0x2d4580=toCsv(_0x310034);var _0x4b6c54=Date[_0xce54('0x6b')]();fs[_0xce54('0x6c')](util['format'](_0xce54('0x6d'),_0x32154b[_0xce54('0x48')]['id'],_0x4b6c54),_0x2d4580);_0x249297['setHeader'](_0xce54('0x6e'),'attachment;\x20filename='+util[_0xce54('0x68')](_0xce54('0x6f'),_0x32154b[_0xce54('0x48')]['id'],_0x4b6c54));_0x249297['setHeader'](_0xce54('0x70'),_0xce54('0x71'));return _0x249297['download'](util[_0xce54('0x68')](_0xce54('0x6d'),_0x32154b['params']['id'],_0x4b6c54));}else{return _0x249297['sendStatus'](0xcc);}})['catch'](handleError(_0x249297,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 3f04811..bae15da 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 _0x1af3=['exports','define','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1af3,0x1ca));var _0x31af=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x1af3[_0x368e09];return _0x14b7df;};'use strict';var _=require(_0x31af('0x0'));var util=require(_0x31af('0x1'));var logger=require(_0x31af('0x2'))(_0x31af('0x3'));var moment=require(_0x31af('0x4'));var BPromise=require(_0x31af('0x5'));var rp=require(_0x31af('0x6'));var fs=require('fs');var path=require(_0x31af('0x7'));var rimraf=require(_0x31af('0x8'));var config=require(_0x31af('0x9'));var attributes=require('./jscriptyProject.attributes');module[_0x31af('0xa')]=function(_0x416162,_0x1ac3f6){return _0x416162[_0x31af('0xb')]('JscriptyProject',attributes,{'tableName':_0x31af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd20=['bluebird','path','../../config/environment','./jscriptyProject.attributes','exports','jscripty_projects','util','moment'];(function(_0x1a333d,_0x483830){var _0x147e89=function(_0x23fa35){while(--_0x23fa35){_0x1a333d['push'](_0x1a333d['shift']());}};_0x147e89(++_0x483830);}(_0xfd20,0x66));var _0x0fd2=function(_0x10e627,_0x26b1a7){_0x10e627=_0x10e627-0x0;var _0x12153a=_0xfd20[_0x10e627];return _0x12153a;};'use strict';var _=require('lodash');var util=require(_0x0fd2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0fd2('0x1'));var BPromise=require(_0x0fd2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fd2('0x3'));var rimraf=require('rimraf');var config=require(_0x0fd2('0x4'));var attributes=require(_0x0fd2('0x5'));module[_0x0fd2('0x6')]=function(_0xf25991,_0x247d6e){return _0xf25991['define']('JscriptyProject',attributes,{'tableName':_0x0fd2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 0ab86b1..741e783 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x1afd7d,_0x53cb05){var _0x46dade=function(_0x550f89){while(--_0x550f89){_0x1afd7d['push'](_0x1afd7d['shift']());}};_0x46dade(++_0x53cb05);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0xcb91[_0x258b93];return _0x35484b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xdc8801,_0x3a3be4){var _0x56009d=function(_0x3287e6){while(--_0x3287e6){_0xdc8801['push'](_0xdc8801['shift']());}};_0x56009d(++_0x3a3be4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1f1a76,_0x550022){_0x1f1a76=_0x1f1a76-0x0;var _0x397a61=_0x9bde[_0x1f1a76];return _0x397a61;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 310206b..b08bf6a 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 _0x212b=['describe','/:id','show','post','create','update','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x212b,0xe7));var _0xb212=function(_0x239d72,_0x1b9283){_0x239d72=_0x239d72-0x0;var _0x47838e=_0x212b[_0x239d72];return _0x47838e;};'use strict';var multer=require(_0xb212('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb212('0x1'));var express=require(_0xb212('0x2'));var router=express['Router']();var fs_extra=require(_0xb212('0x3'));var auth=require(_0xb212('0x4'));var interaction=require(_0xb212('0x5'));var config=require('../../config/environment');var controller=require(_0xb212('0x6'));router[_0xb212('0x7')]('/',auth[_0xb212('0x8')](),controller['index']);router[_0xb212('0x7')]('/describe',auth[_0xb212('0x8')](),controller[_0xb212('0x9')]);router['get'](_0xb212('0xa'),auth[_0xb212('0x8')](),controller[_0xb212('0xb')]);router[_0xb212('0xc')]('/',auth[_0xb212('0x8')](),controller[_0xb212('0xd')]);router['put'](_0xb212('0xa'),auth[_0xb212('0x8')](),controller[_0xb212('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb212('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6b9e=['put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x54b8ac,_0xb1c00c){var _0x123211=function(_0x209f1d){while(--_0x209f1d){_0x54b8ac['push'](_0x54b8ac['shift']());}};_0x123211(++_0xb1c00c);}(_0x6b9e,0x190));var _0xe6b9=function(_0x559355,_0x7e03c7){_0x559355=_0x559355-0x0;var _0x5d3fdc=_0x6b9e[_0x559355];return _0x5d3fdc;};'use strict';var multer=require(_0xe6b9('0x0'));var util=require(_0xe6b9('0x1'));var path=require('path');var timeout=require(_0xe6b9('0x2'));var express=require(_0xe6b9('0x3'));var router=express[_0xe6b9('0x4')]();var fs_extra=require(_0xe6b9('0x5'));var auth=require(_0xe6b9('0x6'));var interaction=require(_0xe6b9('0x7'));var config=require('../../config/environment');var controller=require(_0xe6b9('0x8'));router[_0xe6b9('0x9')]('/',auth['isAuthenticated'](),controller[_0xe6b9('0xa')]);router[_0xe6b9('0x9')](_0xe6b9('0xb'),auth['isAuthenticated'](),controller[_0xe6b9('0xc')]);router[_0xe6b9('0x9')](_0xe6b9('0xd'),auth[_0xe6b9('0xe')](),controller[_0xe6b9('0xf')]);router[_0xe6b9('0x10')]('/',auth['isAuthenticated'](),controller[_0xe6b9('0x11')]);router[_0xe6b9('0x12')](_0xe6b9('0xd'),auth['isAuthenticated'](),controller[_0xe6b9('0x13')]);router[_0xe6b9('0x14')](_0xe6b9('0xd'),auth['isAuthenticated'](),controller[_0xe6b9('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4041b41..961f1e3 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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x4016e5,_0x3d573e){_0x4016e5=_0x4016e5-0x0;var _0xae8aaf=_0x7a54[_0x4016e5];return _0xae8aaf;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x13c922,_0x2bb352){_0x13c922=_0x13c922-0x0;var _0x5200a3=_0x7a54[_0x13c922];return _0x5200a3;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index c0f2a72..d02d732 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 _0xa742=['find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','reject','save','update','destroy','then','stack','name','map','fieldName','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','JscriptyQuestionReport','findAll','rows','keys','intersection','includeAll','include','options'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xa742,0x126));var _0x2a74=function(_0x38b637,_0x42cb70){_0x38b637=_0x38b637-0x0;var _0xc1c2cf=_0xa742[_0x38b637];return _0xc1c2cf;};'use strict';var emlformat=require(_0x2a74('0x0'));var rimraf=require(_0x2a74('0x1'));var zipdir=require(_0x2a74('0x2'));var jsonpatch=require(_0x2a74('0x3'));var rp=require(_0x2a74('0x4'));var moment=require(_0x2a74('0x5'));var BPromise=require(_0x2a74('0x6'));var Mustache=require(_0x2a74('0x7'));var util=require('util');var path=require(_0x2a74('0x8'));var sox=require(_0x2a74('0x9'));var csv=require(_0x2a74('0xa'));var ejs=require(_0x2a74('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a74('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2a74('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2a74('0xe'));var Papa=require(_0x2a74('0xf'));var Redis=require(_0x2a74('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2a74('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a74('0x12'));var logger=require(_0x2a74('0x13'))(_0x2a74('0x14'));var utils=require(_0x2a74('0x15'));var config=require(_0x2a74('0x16'));var licenseUtil=require(_0x2a74('0x17'));var db=require(_0x2a74('0x18'))['db'];function respondWithStatusCode(_0x3cc445,_0x4e6a3e){_0x4e6a3e=_0x4e6a3e||0xcc;return function(_0xe5304e){if(_0xe5304e){return _0x3cc445[_0x2a74('0x19')](_0x4e6a3e);}return _0x3cc445['status'](_0x4e6a3e)[_0x2a74('0x1a')]();};}function respondWithResult(_0x1ea8dc,_0x36aad3){_0x36aad3=_0x36aad3||0xc8;return function(_0xbaef19){if(_0xbaef19){return _0x1ea8dc['status'](_0x36aad3)['json'](_0xbaef19);}};}function respondWithFilteredResult(_0x2d2f8b,_0x2ff669){return function(_0x11842d){if(_0x11842d){var _0x1a8af0=typeof _0x2ff669[_0x2a74('0x1b')]===_0x2a74('0x1c')&&typeof _0x2ff669['limit']===_0x2a74('0x1c');var _0x283a7d=_0x11842d[_0x2a74('0x1d')];var _0x12db6e=_0x1a8af0?0x0:_0x2ff669[_0x2a74('0x1b')];var _0x36fa6f=_0x1a8af0?_0x11842d[_0x2a74('0x1d')]:_0x2ff669['offset']+_0x2ff669[_0x2a74('0x1e')];var _0x428c5d;if(_0x36fa6f>=_0x283a7d){_0x36fa6f=_0x283a7d;_0x428c5d=0xc8;}else{_0x428c5d=0xce;}_0x2d2f8b[_0x2a74('0x1f')](_0x428c5d);return _0x2d2f8b[_0x2a74('0x20')](_0x2a74('0x21'),_0x12db6e+'-'+_0x36fa6f+'/'+_0x283a7d)[_0x2a74('0x22')](_0x11842d);}return null;};}function patchUpdates(_0xdce729){return function(_0x2bdf12){try{jsonpatch['apply'](_0x2bdf12,_0xdce729,!![]);}catch(_0xb00c0a){return BPromise[_0x2a74('0x23')](_0xb00c0a);}return _0x2bdf12[_0x2a74('0x24')]();};}function saveUpdates(_0x5466ca,_0x9c2aae){return function(_0x489532){if(_0x489532){return _0x489532[_0x2a74('0x25')](_0x5466ca)['then'](function(_0x25cf7a){return _0x25cf7a;});}return null;};}function removeEntity(_0x5c8620,_0x24db81){return function(_0x3a6ab0){if(_0x3a6ab0){return _0x3a6ab0[_0x2a74('0x26')]()[_0x2a74('0x27')](function(){_0x5c8620['status'](0xcc)[_0x2a74('0x1a')]();});}};}function handleEntityNotFound(_0x4bef5c,_0x5327af){return function(_0x2158e0){if(!_0x2158e0){_0x4bef5c[_0x2a74('0x19')](0x194);}return _0x2158e0;};}function handleError(_0x8fea15,_0x48b432){_0x48b432=_0x48b432||0x1f4;return function(_0x565925){logger['error'](_0x565925[_0x2a74('0x28')]);if(_0x565925[_0x2a74('0x29')]){delete _0x565925[_0x2a74('0x29')];}_0x8fea15['status'](_0x48b432)['send'](_0x565925);};}exports['index']=function(_0x34bd08,_0x3e28bf){var _0x140759={},_0x214d48={},_0x4b3f01={'count':0x0,'rows':[]};var _0x2b0c1b=_[_0x2a74('0x2a')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x58df94){return{'name':_0x58df94[_0x2a74('0x2b')],'type':_0x58df94['type']['key']};});_0x214d48[_0x2a74('0x2c')]=_['map'](_0x2b0c1b,_0x2a74('0x29'));_0x214d48[_0x2a74('0x2d')]=_['keys'](_0x34bd08[_0x2a74('0x2d')]);_0x214d48[_0x2a74('0x2e')]=_['intersection'](_0x214d48['model'],_0x214d48['query']);_0x140759[_0x2a74('0x2f')]=_['intersection'](_0x214d48[_0x2a74('0x2c')],qs[_0x2a74('0x30')](_0x34bd08[_0x2a74('0x2d')][_0x2a74('0x30')]));_0x140759[_0x2a74('0x2f')]=_0x140759['attributes'][_0x2a74('0x31')]?_0x140759[_0x2a74('0x2f')]:_0x214d48[_0x2a74('0x2c')];if(!_0x34bd08[_0x2a74('0x2d')]['hasOwnProperty'](_0x2a74('0x32'))){_0x140759['limit']=qs['limit'](_0x34bd08[_0x2a74('0x2d')][_0x2a74('0x1e')]);_0x140759[_0x2a74('0x1b')]=qs[_0x2a74('0x1b')](_0x34bd08[_0x2a74('0x2d')][_0x2a74('0x1b')]);}_0x140759[_0x2a74('0x33')]=qs[_0x2a74('0x34')](_0x34bd08[_0x2a74('0x2d')][_0x2a74('0x34')]);_0x140759[_0x2a74('0x35')]=qs[_0x2a74('0x2e')](_[_0x2a74('0x36')](_0x34bd08[_0x2a74('0x2d')],_0x214d48['filters']),_0x2b0c1b);if(_0x34bd08[_0x2a74('0x2d')][_0x2a74('0x37')]){_0x140759[_0x2a74('0x35')]=_[_0x2a74('0x38')](_0x140759[_0x2a74('0x35')],{'$or':_[_0x2a74('0x2a')](_0x2b0c1b,function(_0x51213c){if(_0x51213c['type']!==_0x2a74('0x39')){var _0x3d3b09={};_0x3d3b09[_0x51213c[_0x2a74('0x29')]]={'$like':'%'+_0x34bd08['query'][_0x2a74('0x37')]+'%'};return _0x3d3b09;}})});}_0x140759=_[_0x2a74('0x38')]({},_0x140759,_0x34bd08['options']);var _0x292586={'where':_0x140759['where']};return db['JscriptyQuestionReport'][_0x2a74('0x1d')](_0x292586)[_0x2a74('0x27')](function(_0x2f2c79){_0x4b3f01[_0x2a74('0x1d')]=_0x2f2c79;if(_0x34bd08[_0x2a74('0x2d')]['includeAll']){_0x140759['include']=[{'all':!![]}];}return db[_0x2a74('0x3a')][_0x2a74('0x3b')](_0x140759);})[_0x2a74('0x27')](function(_0x1b19c9){_0x4b3f01[_0x2a74('0x3c')]=_0x1b19c9;return _0x4b3f01;})[_0x2a74('0x27')](respondWithFilteredResult(_0x3e28bf,_0x140759))['catch'](handleError(_0x3e28bf,null));};exports['show']=function(_0x25ac82,_0x81eda0){var _0x11589d={'raw':!![],'where':{'id':_0x25ac82['params']['id']}},_0x5d0fdc={};_0x5d0fdc['model']=_[_0x2a74('0x3d')](db[_0x2a74('0x3a')]['rawAttributes']);_0x5d0fdc[_0x2a74('0x2d')]=_['keys'](_0x25ac82[_0x2a74('0x2d')]);_0x5d0fdc['filters']=_[_0x2a74('0x3e')](_0x5d0fdc[_0x2a74('0x2c')],_0x5d0fdc[_0x2a74('0x2d')]);_0x11589d[_0x2a74('0x2f')]=_[_0x2a74('0x3e')](_0x5d0fdc[_0x2a74('0x2c')],qs['fields'](_0x25ac82['query'][_0x2a74('0x30')]));_0x11589d[_0x2a74('0x2f')]=_0x11589d[_0x2a74('0x2f')][_0x2a74('0x31')]?_0x11589d[_0x2a74('0x2f')]:_0x5d0fdc[_0x2a74('0x2c')];if(_0x25ac82[_0x2a74('0x2d')][_0x2a74('0x3f')]){_0x11589d[_0x2a74('0x40')]=[{'all':!![]}];}_0x11589d=_['merge']({},_0x11589d,_0x25ac82[_0x2a74('0x41')]);return db['JscriptyQuestionReport'][_0x2a74('0x42')](_0x11589d)['then'](handleEntityNotFound(_0x81eda0,null))[_0x2a74('0x27')](respondWithResult(_0x81eda0,null))[_0x2a74('0x43')](handleError(_0x81eda0,null));};exports[_0x2a74('0x44')]=function(_0x15a4b7,_0x49109e){return db['JscriptyQuestionReport']['create'](_0x15a4b7['body'],{})[_0x2a74('0x27')](respondWithResult(_0x49109e,0xc9))['catch'](handleError(_0x49109e,null));};exports[_0x2a74('0x25')]=function(_0x43bc74,_0x49a1e1){if(_0x43bc74[_0x2a74('0x45')]['id']){delete _0x43bc74[_0x2a74('0x45')]['id'];}return db['JscriptyQuestionReport'][_0x2a74('0x42')]({'where':{'id':_0x43bc74['params']['id']}})[_0x2a74('0x27')](handleEntityNotFound(_0x49a1e1,null))['then'](saveUpdates(_0x43bc74[_0x2a74('0x45')],null))[_0x2a74('0x27')](respondWithResult(_0x49a1e1,null))[_0x2a74('0x43')](handleError(_0x49a1e1,null));};exports[_0x2a74('0x26')]=function(_0x5ddafe,_0x584031){return db[_0x2a74('0x3a')][_0x2a74('0x42')]({'where':{'id':_0x5ddafe[_0x2a74('0x46')]['id']}})['then'](handleEntityNotFound(_0x584031,null))['then'](removeEntity(_0x584031,null))['catch'](handleError(_0x584031,null));};exports['describe']=function(_0x31a239,_0x1b8ba1){return db[_0x2a74('0x3a')][_0x2a74('0x47')]()[_0x2a74('0x27')](respondWithResult(_0x1b8ba1,null))['catch'](handleError(_0x1b8ba1,null));}; \ No newline at end of file +var _0xef50=['apply','reject','save','update','then','error','stack','name','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x52df16,_0x11b2a7){var _0x5eeb6a=function(_0x1c77f2){while(--_0x1c77f2){_0x52df16['push'](_0x52df16['shift']());}};_0x5eeb6a(++_0x11b2a7);}(_0xef50,0x6f));var _0x0ef5=function(_0x5b2434,_0x3d9c71){_0x5b2434=_0x5b2434-0x0;var _0x28bd00=_0xef50[_0x5b2434];return _0x28bd00;};'use strict';var emlformat=require(_0x0ef5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ef5('0x1'));var jsonpatch=require(_0x0ef5('0x2'));var rp=require(_0x0ef5('0x3'));var moment=require(_0x0ef5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0ef5('0x5'));var ejs=require(_0x0ef5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ef5('0x7'));var squel=require(_0x0ef5('0x8'));var crypto=require(_0x0ef5('0x9'));var jsforce=require(_0x0ef5('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0ef5('0xb'));var authService=require(_0x0ef5('0xc'));var qs=require(_0x0ef5('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ef5('0xe'))(_0x0ef5('0xf'));var utils=require(_0x0ef5('0x10'));var config=require(_0x0ef5('0x11'));var licenseUtil=require(_0x0ef5('0x12'));var db=require(_0x0ef5('0x13'))['db'];function respondWithStatusCode(_0x5c8fef,_0x4003de){_0x4003de=_0x4003de||0xcc;return function(_0x5309ca){if(_0x5309ca){return _0x5c8fef['sendStatus'](_0x4003de);}return _0x5c8fef[_0x0ef5('0x14')](_0x4003de)[_0x0ef5('0x15')]();};}function respondWithResult(_0x5225ae,_0xf3a107){_0xf3a107=_0xf3a107||0xc8;return function(_0x1e46b9){if(_0x1e46b9){return _0x5225ae['status'](_0xf3a107)[_0x0ef5('0x16')](_0x1e46b9);}};}function respondWithFilteredResult(_0x422f2b,_0x14d8cd){return function(_0x4f404f){if(_0x4f404f){var _0x183cc0=typeof _0x14d8cd[_0x0ef5('0x17')]===_0x0ef5('0x18')&&typeof _0x14d8cd[_0x0ef5('0x19')]===_0x0ef5('0x18');var _0x28e356=_0x4f404f[_0x0ef5('0x1a')];var _0x48ad2f=_0x183cc0?0x0:_0x14d8cd[_0x0ef5('0x17')];var _0x319825=_0x183cc0?_0x4f404f['count']:_0x14d8cd['offset']+_0x14d8cd[_0x0ef5('0x19')];var _0x478ecd;if(_0x319825>=_0x28e356){_0x319825=_0x28e356;_0x478ecd=0xc8;}else{_0x478ecd=0xce;}_0x422f2b['status'](_0x478ecd);return _0x422f2b['set']('Content-Range',_0x48ad2f+'-'+_0x319825+'/'+_0x28e356)[_0x0ef5('0x16')](_0x4f404f);}return null;};}function patchUpdates(_0x3959c8){return function(_0x1495f7){try{jsonpatch[_0x0ef5('0x1b')](_0x1495f7,_0x3959c8,!![]);}catch(_0x15f957){return BPromise[_0x0ef5('0x1c')](_0x15f957);}return _0x1495f7[_0x0ef5('0x1d')]();};}function saveUpdates(_0xf130e8,_0x45f678){return function(_0x1084df){if(_0x1084df){return _0x1084df[_0x0ef5('0x1e')](_0xf130e8)[_0x0ef5('0x1f')](function(_0x5b7026){return _0x5b7026;});}return null;};}function removeEntity(_0x2f50e0,_0x2cf461){return function(_0x50a9aa){if(_0x50a9aa){return _0x50a9aa['destroy']()[_0x0ef5('0x1f')](function(){_0x2f50e0['status'](0xcc)[_0x0ef5('0x15')]();});}};}function handleEntityNotFound(_0x5b017c,_0x490b48){return function(_0x57117c){if(!_0x57117c){_0x5b017c['sendStatus'](0x194);}return _0x57117c;};}function handleError(_0x3c165b,_0x4714de){_0x4714de=_0x4714de||0x1f4;return function(_0xeccdff){logger[_0x0ef5('0x20')](_0xeccdff[_0x0ef5('0x21')]);if(_0xeccdff[_0x0ef5('0x22')]){delete _0xeccdff[_0x0ef5('0x22')];}_0x3c165b[_0x0ef5('0x14')](_0x4714de)['send'](_0xeccdff);};}exports['index']=function(_0x31cf7d,_0x4cf914){var _0x595b3d={},_0x2ed3b8={},_0xbdc507={'count':0x0,'rows':[]};var _0x136ab5=_[_0x0ef5('0x23')](db[_0x0ef5('0x24')][_0x0ef5('0x25')],function(_0xf74a42){return{'name':_0xf74a42['fieldName'],'type':_0xf74a42[_0x0ef5('0x26')][_0x0ef5('0x27')]};});_0x2ed3b8[_0x0ef5('0x28')]=_[_0x0ef5('0x23')](_0x136ab5,'name');_0x2ed3b8[_0x0ef5('0x29')]=_[_0x0ef5('0x2a')](_0x31cf7d['query']);_0x2ed3b8['filters']=_[_0x0ef5('0x2b')](_0x2ed3b8[_0x0ef5('0x28')],_0x2ed3b8['query']);_0x595b3d['attributes']=_[_0x0ef5('0x2b')](_0x2ed3b8[_0x0ef5('0x28')],qs[_0x0ef5('0x2c')](_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x2c')]));_0x595b3d[_0x0ef5('0x2d')]=_0x595b3d[_0x0ef5('0x2d')]['length']?_0x595b3d[_0x0ef5('0x2d')]:_0x2ed3b8['model'];if(!_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x2e')](_0x0ef5('0x2f'))){_0x595b3d[_0x0ef5('0x19')]=qs[_0x0ef5('0x19')](_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x19')]);_0x595b3d['offset']=qs[_0x0ef5('0x17')](_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x17')]);}_0x595b3d[_0x0ef5('0x30')]=qs[_0x0ef5('0x31')](_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x31')]);_0x595b3d[_0x0ef5('0x32')]=qs['filters'](_[_0x0ef5('0x33')](_0x31cf7d[_0x0ef5('0x29')],_0x2ed3b8[_0x0ef5('0x34')]),_0x136ab5);if(_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x35')]){_0x595b3d[_0x0ef5('0x32')]=_['merge'](_0x595b3d[_0x0ef5('0x32')],{'$or':_[_0x0ef5('0x23')](_0x136ab5,function(_0xf60355){if(_0xf60355['type']!==_0x0ef5('0x36')){var _0x4278b9={};_0x4278b9[_0xf60355[_0x0ef5('0x22')]]={'$like':'%'+_0x31cf7d[_0x0ef5('0x29')]['filter']+'%'};return _0x4278b9;}})});}_0x595b3d=_[_0x0ef5('0x37')]({},_0x595b3d,_0x31cf7d[_0x0ef5('0x38')]);var _0x4e797e={'where':_0x595b3d['where']};return db['JscriptyQuestionReport'][_0x0ef5('0x1a')](_0x4e797e)[_0x0ef5('0x1f')](function(_0xd1e493){_0xbdc507[_0x0ef5('0x1a')]=_0xd1e493;if(_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x39')]){_0x595b3d[_0x0ef5('0x3a')]=[{'all':!![]}];}return db[_0x0ef5('0x24')]['findAll'](_0x595b3d);})['then'](function(_0x1337ca){_0xbdc507[_0x0ef5('0x3b')]=_0x1337ca;return _0xbdc507;})[_0x0ef5('0x1f')](respondWithFilteredResult(_0x4cf914,_0x595b3d))[_0x0ef5('0x3c')](handleError(_0x4cf914,null));};exports[_0x0ef5('0x3d')]=function(_0x52432d,_0x4cd8d6){var _0x3e3d24={'raw':!![],'where':{'id':_0x52432d[_0x0ef5('0x3e')]['id']}},_0x1cfaf9={};_0x1cfaf9[_0x0ef5('0x28')]=_[_0x0ef5('0x2a')](db[_0x0ef5('0x24')]['rawAttributes']);_0x1cfaf9['query']=_[_0x0ef5('0x2a')](_0x52432d[_0x0ef5('0x29')]);_0x1cfaf9[_0x0ef5('0x34')]=_[_0x0ef5('0x2b')](_0x1cfaf9[_0x0ef5('0x28')],_0x1cfaf9[_0x0ef5('0x29')]);_0x3e3d24[_0x0ef5('0x2d')]=_['intersection'](_0x1cfaf9[_0x0ef5('0x28')],qs[_0x0ef5('0x2c')](_0x52432d[_0x0ef5('0x29')][_0x0ef5('0x2c')]));_0x3e3d24['attributes']=_0x3e3d24[_0x0ef5('0x2d')][_0x0ef5('0x3f')]?_0x3e3d24[_0x0ef5('0x2d')]:_0x1cfaf9['model'];if(_0x52432d[_0x0ef5('0x29')][_0x0ef5('0x39')]){_0x3e3d24['include']=[{'all':!![]}];}_0x3e3d24=_[_0x0ef5('0x37')]({},_0x3e3d24,_0x52432d['options']);return db[_0x0ef5('0x24')][_0x0ef5('0x40')](_0x3e3d24)[_0x0ef5('0x1f')](handleEntityNotFound(_0x4cd8d6,null))['then'](respondWithResult(_0x4cd8d6,null))[_0x0ef5('0x3c')](handleError(_0x4cd8d6,null));};exports['create']=function(_0x2e6eb6,_0xbec55f){return db[_0x0ef5('0x24')][_0x0ef5('0x41')](_0x2e6eb6['body'],{})[_0x0ef5('0x1f')](respondWithResult(_0xbec55f,0xc9))[_0x0ef5('0x3c')](handleError(_0xbec55f,null));};exports['update']=function(_0x45c0f9,_0x15be45){if(_0x45c0f9[_0x0ef5('0x42')]['id']){delete _0x45c0f9[_0x0ef5('0x42')]['id'];}return db[_0x0ef5('0x24')]['find']({'where':{'id':_0x45c0f9['params']['id']}})[_0x0ef5('0x1f')](handleEntityNotFound(_0x15be45,null))[_0x0ef5('0x1f')](saveUpdates(_0x45c0f9[_0x0ef5('0x42')],null))['then'](respondWithResult(_0x15be45,null))[_0x0ef5('0x3c')](handleError(_0x15be45,null));};exports[_0x0ef5('0x43')]=function(_0x251e12,_0x53c92f){return db[_0x0ef5('0x24')][_0x0ef5('0x40')]({'where':{'id':_0x251e12[_0x0ef5('0x3e')]['id']}})[_0x0ef5('0x1f')](handleEntityNotFound(_0x53c92f,null))[_0x0ef5('0x1f')](removeEntity(_0x53c92f,null))[_0x0ef5('0x3c')](handleError(_0x53c92f,null));};exports[_0x0ef5('0x44')]=function(_0x7a6285,_0x193d93){return db['JscriptyQuestionReport'][_0x0ef5('0x44')]()[_0x0ef5('0x1f')](respondWithResult(_0x193d93,null))[_0x0ef5('0x3c')](handleError(_0x193d93,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 8ce5b9b..e1107d8 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 _0x1b1c=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','path','rimraf','./jscriptyQuestionReport.attributes'];(function(_0x4561fa,_0x4c770b){var _0x52df1b=function(_0x5f1dbb){while(--_0x5f1dbb){_0x4561fa['push'](_0x4561fa['shift']());}};_0x52df1b(++_0x4c770b);}(_0x1b1c,0x101));var _0xc1b1=function(_0x352b44,_0x4a91a1){_0x352b44=_0x352b44-0x0;var _0x3e8baa=_0x1b1c[_0x352b44];return _0x3e8baa;};'use strict';var _=require(_0xc1b1('0x0'));var util=require(_0xc1b1('0x1'));var logger=require(_0xc1b1('0x2'))(_0xc1b1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1b1('0x4'));var rimraf=require(_0xc1b1('0x5'));var config=require('../../config/environment');var attributes=require(_0xc1b1('0x6'));module[_0xc1b1('0x7')]=function(_0x159166,_0x28e51c){return _0x159166[_0xc1b1('0x8')](_0xc1b1('0x9'),attributes,{'tableName':_0xc1b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cd1=['bluebird','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','moment'];(function(_0x1554e2,_0x4efeec){var _0x51aa70=function(_0x33cad5){while(--_0x33cad5){_0x1554e2['push'](_0x1554e2['shift']());}};_0x51aa70(++_0x4efeec);}(_0x2cd1,0x1a1));var _0x12cd=function(_0x19674e,_0xcfb13c){_0x19674e=_0x19674e-0x0;var _0x121d16=_0x2cd1[_0x19674e];return _0x121d16;};'use strict';var _=require(_0x12cd('0x0'));var util=require(_0x12cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x12cd('0x2'));var BPromise=require(_0x12cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x12cd('0x4'));var attributes=require(_0x12cd('0x5'));module[_0x12cd('0x6')]=function(_0x1e2297,_0x192463){return _0x1e2297[_0x12cd('0x7')](_0x12cd('0x8'),attributes,{'tableName':_0x12cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 4c1f8b9..24e22b4 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 _0xacf4=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x9a7d08,_0xe9048){var _0x58e6e8=function(_0x31f047){while(--_0x31f047){_0x9a7d08['push'](_0x9a7d08['shift']());}};_0x58e6e8(++_0xe9048);}(_0xacf4,0x1a7));var _0x4acf=function(_0x251559,_0x5114a6){_0x251559=_0x251559-0x0;var _0x5d5035=_0xacf4[_0x251559];return _0x5d5035;};'use strict';var _=require(_0x4acf('0x0'));var util=require('util');var moment=require(_0x4acf('0x1'));var BPromise=require(_0x4acf('0x2'));var rs=require(_0x4acf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4acf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4acf('0x5'))('rpc');var config=require(_0x4acf('0x6'));var jayson=require(_0x4acf('0x7'));var client=jayson['client'][_0x4acf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x373495,_0x2737ff,_0x5ccede){return new BPromise(function(_0x566e35,_0x5c4680){return client[_0x4acf('0x9')](_0x373495,_0x5ccede)[_0x4acf('0xa')](function(_0x39ee7f){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x2737ff,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x2737ff,_0x4acf('0xd'),JSON[_0x4acf('0xf')](_0x39ee7f));if(_0x39ee7f['error']){if(_0x39ee7f[_0x4acf('0x10')]['code']===0x1f4){logger[_0x4acf('0x10')](_0x4acf('0xc'),_0x2737ff,_0x39ee7f[_0x4acf('0x10')][_0x4acf('0x11')]);return _0x5c4680(_0x39ee7f[_0x4acf('0x10')][_0x4acf('0x11')]);}logger[_0x4acf('0x10')](_0x4acf('0xc'),_0x2737ff,_0x39ee7f[_0x4acf('0x10')][_0x4acf('0x11')]);return _0x566e35(_0x39ee7f[_0x4acf('0x10')]['message']);}else{logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x2737ff,'request\x20sent');_0x566e35(_0x39ee7f[_0x4acf('0x12')]['message']);}})[_0x4acf('0x13')](function(_0x4efe58){logger[_0x4acf('0x10')](_0x4acf('0xc'),_0x2737ff,_0x4efe58);_0x5c4680(_0x4efe58);});});} \ No newline at end of file +var _0xc995=['http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x54fc80,_0x45d643){var _0x2e672d=function(_0x2946ba){while(--_0x2946ba){_0x54fc80['push'](_0x54fc80['shift']());}};_0x2e672d(++_0x45d643);}(_0xc995,0xbe));var _0x5c99=function(_0x3fc0ce,_0x403e20){_0x3fc0ce=_0x3fc0ce-0x0;var _0x5329f6=_0xc995[_0x3fc0ce];return _0x5329f6;};'use strict';var _=require(_0x5c99('0x0'));var util=require(_0x5c99('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5c99('0x2'));var fs=require('fs');var Redis=require(_0x5c99('0x3'));var db=require(_0x5c99('0x4'))['db'];var utils=require(_0x5c99('0x5'));var logger=require(_0x5c99('0x6'))('rpc');var config=require(_0x5c99('0x7'));var jayson=require(_0x5c99('0x8'));var client=jayson[_0x5c99('0x9')][_0x5c99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a7b72,_0x3aab77,_0x3a45cc){return new BPromise(function(_0x2e6b87,_0x4b3304){return client['request'](_0x4a7b72,_0x3a45cc)['then'](function(_0x112004){logger[_0x5c99('0xb')](_0x5c99('0xc'),_0x3aab77,_0x5c99('0xd'));logger[_0x5c99('0xe')](_0x5c99('0xf'),_0x3aab77,_0x5c99('0xd'),JSON[_0x5c99('0x10')](_0x112004));if(_0x112004[_0x5c99('0x11')]){if(_0x112004['error']['code']===0x1f4){logger[_0x5c99('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3aab77,_0x112004[_0x5c99('0x11')][_0x5c99('0x12')]);return _0x4b3304(_0x112004[_0x5c99('0x11')][_0x5c99('0x12')]);}logger[_0x5c99('0x11')](_0x5c99('0xc'),_0x3aab77,_0x112004[_0x5c99('0x11')][_0x5c99('0x12')]);return _0x2e6b87(_0x112004[_0x5c99('0x11')][_0x5c99('0x12')]);}else{logger[_0x5c99('0xb')](_0x5c99('0xc'),_0x3aab77,_0x5c99('0xd'));_0x2e6b87(_0x112004['result'][_0x5c99('0x12')]);}})[_0x5c99('0x13')](function(_0x32c455){logger[_0x5c99('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3aab77,_0x32c455);_0x4b3304(_0x32c455);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7798f31..6b41aa7 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 _0x5b5b=['post','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions'];(function(_0x5a52c3,_0x1ed9b7){var _0x13a8ae=function(_0x437172){while(--_0x437172){_0x5a52c3['push'](_0x5a52c3['shift']());}};_0x13a8ae(++_0x1ed9b7);}(_0x5b5b,0x1d5));var _0xb5b5=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0x5b5b[_0x2a4095];return _0x52eeab;};'use strict';var multer=require(_0xb5b5('0x0'));var util=require(_0xb5b5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb5b5('0x2')]();var fs_extra=require(_0xb5b5('0x3'));var auth=require(_0xb5b5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb5b5('0x5'));var controller=require(_0xb5b5('0x6'));router[_0xb5b5('0x7')]('/',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x9')]);router[_0xb5b5('0x7')]('/describe',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0xa')]);router[_0xb5b5('0x7')](_0xb5b5('0xb'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0xc')]);router[_0xb5b5('0x7')](_0xb5b5('0xd'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0xe')]);router[_0xb5b5('0xf')]('/',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x10')]);router[_0xb5b5('0x11')](_0xb5b5('0xb'),auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x12')]);router[_0xb5b5('0x13')]('/:id',auth[_0xb5b5('0x8')](),controller[_0xb5b5('0x14')]);module[_0xb5b5('0x15')]=router; \ No newline at end of file +var _0x897d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x448eaf,_0x36a4c8){var _0x268530=function(_0x4371f7){while(--_0x4371f7){_0x448eaf['push'](_0x448eaf['shift']());}};_0x268530(++_0x36a4c8);}(_0x897d,0x1ca));var _0xd897=function(_0x3aba1a,_0x3d3635){_0x3aba1a=_0x3aba1a-0x0;var _0x347693=_0x897d[_0x3aba1a];return _0x347693;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd897('0x0'));var timeout=require(_0xd897('0x1'));var express=require(_0xd897('0x2'));var router=express[_0xd897('0x3')]();var fs_extra=require(_0xd897('0x4'));var auth=require(_0xd897('0x5'));var interaction=require(_0xd897('0x6'));var config=require(_0xd897('0x7'));var controller=require(_0xd897('0x8'));router['get']('/',auth[_0xd897('0x9')](),controller[_0xd897('0xa')]);router[_0xd897('0xb')](_0xd897('0xc'),auth[_0xd897('0x9')](),controller[_0xd897('0xd')]);router[_0xd897('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xd897('0xe'),auth[_0xd897('0x9')](),controller[_0xd897('0xf')]);router[_0xd897('0x10')]('/',auth[_0xd897('0x9')](),controller['create']);router[_0xd897('0x11')]('/:id',auth[_0xd897('0x9')](),controller[_0xd897('0x12')]);router[_0xd897('0x13')]('/:id',auth[_0xd897('0x9')](),controller[_0xd897('0x14')]);module[_0xd897('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c82513d..23ebfee 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 _0xd20c=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','setDataValue','starttime','endtime'];(function(_0xff5df6,_0x514e73){var _0x2634bb=function(_0x1bb600){while(--_0x1bb600){_0xff5df6['push'](_0xff5df6['shift']());}};_0x2634bb(++_0x514e73);}(_0xd20c,0x16b));var _0xcd20=function(_0x1fba81,_0x301dda){_0x1fba81=_0x1fba81-0x0;var _0x108093=_0xd20c[_0x1fba81];return _0x108093;};'use strict';var moment=require(_0xcd20('0x0'));var Sequelize=require(_0xcd20('0x1'));module[_0xcd20('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x336f02){this[_0xcd20('0x3')](_0xcd20('0x4'),_0x336f02);this['setDataValue'](_0xcd20('0x5'),moment()[_0xcd20('0x6')](_0xcd20('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xcd20('0x8')]},'projectname':{'type':Sequelize[_0xcd20('0x8')]},'queue':{'type':Sequelize[_0xcd20('0x8')]},'uniqueid':{'type':Sequelize[_0xcd20('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xcd20('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8e8f=['starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','exports','setDataValue'];(function(_0xe25ee9,_0x1f6d98){var _0x56c669=function(_0x32e81a){while(--_0x32e81a){_0xe25ee9['push'](_0xe25ee9['shift']());}};_0x56c669(++_0x1f6d98);}(_0x8e8f,0x96));var _0xf8e8=function(_0x2bd8e5,_0x113d99){_0x2bd8e5=_0x2bd8e5-0x0;var _0x5b0230=_0x8e8f[_0x2bd8e5];return _0x5b0230;};'use strict';var moment=require(_0xf8e8('0x0'));var Sequelize=require('sequelize');module[_0xf8e8('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5ee4ba){this[_0xf8e8('0x2')](_0xf8e8('0x3'),_0x5ee4ba);this['setDataValue'](_0xf8e8('0x4'),moment()['format'](_0xf8e8('0x5')));}},'endtime':{'type':Sequelize[_0xf8e8('0x6')]},'membername':{'type':Sequelize[_0xf8e8('0x7')]},'projectname':{'type':Sequelize[_0xf8e8('0x7')]},'queue':{'type':Sequelize[_0xf8e8('0x7')]},'uniqueid':{'type':Sequelize[_0xf8e8('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf8e8('0x7')]},'completed':{'type':Sequelize[_0xf8e8('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 5aa41c0..a2c6f08 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 _0x6759=['count','set','Content-Range','json','apply','reject','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','key','keys','query','filters','model','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','type','options','JscriptySessionReport','include','findAll','rows','catch','show','params','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','order','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit'];(function(_0x15c916,_0x246612){var _0x10520c=function(_0x3dc0a0){while(--_0x3dc0a0){_0x15c916['push'](_0x15c916['shift']());}};_0x10520c(++_0x246612);}(_0x6759,0x7f));var _0x9675=function(_0x36e0f6,_0x4da6a7){_0x36e0f6=_0x36e0f6-0x0;var _0xc90479=_0x6759[_0x36e0f6];return _0xc90479;};'use strict';var emlformat=require(_0x9675('0x0'));var rimraf=require(_0x9675('0x1'));var zipdir=require(_0x9675('0x2'));var jsonpatch=require(_0x9675('0x3'));var rp=require('request-promise');var moment=require(_0x9675('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9675('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9675('0x6'));var ejs=require(_0x9675('0x7'));var fs=require('fs');var fs_extra=require(_0x9675('0x8'));var _=require(_0x9675('0x9'));var squel=require(_0x9675('0xa'));var crypto=require('crypto');var jsforce=require(_0x9675('0xb'));var deskjs=require(_0x9675('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9675('0xd'));var Papa=require(_0x9675('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9675('0xf'));var as=require(_0x9675('0x10'));var hardwareService=require(_0x9675('0x11'));var logger=require(_0x9675('0x12'))(_0x9675('0x13'));var utils=require(_0x9675('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9675('0x15'));var db=require(_0x9675('0x16'))['db'];function respondWithStatusCode(_0x495d3a,_0x525140){_0x525140=_0x525140||0xcc;return function(_0x56a777){if(_0x56a777){return _0x495d3a[_0x9675('0x17')](_0x525140);}return _0x495d3a['status'](_0x525140)[_0x9675('0x18')]();};}function respondWithResult(_0x4e1207,_0x39fe77){_0x39fe77=_0x39fe77||0xc8;return function(_0x33b84b){if(_0x33b84b){return _0x4e1207[_0x9675('0x19')](_0x39fe77)['json'](_0x33b84b);}};}function respondWithFilteredResult(_0x2d21df,_0x5945fa){return function(_0x15fd39){if(_0x15fd39){var _0x3119ac=typeof _0x5945fa[_0x9675('0x1a')]===_0x9675('0x1b')&&typeof _0x5945fa[_0x9675('0x1c')]===_0x9675('0x1b');var _0xec76e2=_0x15fd39['count'];var _0x45099b=_0x3119ac?0x0:_0x5945fa[_0x9675('0x1a')];var _0x5574ed=_0x3119ac?_0x15fd39[_0x9675('0x1d')]:_0x5945fa[_0x9675('0x1a')]+_0x5945fa[_0x9675('0x1c')];var _0x4d7331;if(_0x5574ed>=_0xec76e2){_0x5574ed=_0xec76e2;_0x4d7331=0xc8;}else{_0x4d7331=0xce;}_0x2d21df[_0x9675('0x19')](_0x4d7331);return _0x2d21df[_0x9675('0x1e')](_0x9675('0x1f'),_0x45099b+'-'+_0x5574ed+'/'+_0xec76e2)[_0x9675('0x20')](_0x15fd39);}return null;};}function patchUpdates(_0xe4c0a4){return function(_0xc6c3b7){try{jsonpatch[_0x9675('0x21')](_0xc6c3b7,_0xe4c0a4,!![]);}catch(_0x1ef218){return BPromise[_0x9675('0x22')](_0x1ef218);}return _0xc6c3b7['save']();};}function saveUpdates(_0x501de6,_0x5d2a02){return function(_0x45623){if(_0x45623){return _0x45623['update'](_0x501de6)['then'](function(_0xee613d){return _0xee613d;});}return null;};}function removeEntity(_0x245eb4,_0x336c98){return function(_0x10dcc8){if(_0x10dcc8){return _0x10dcc8[_0x9675('0x23')]()[_0x9675('0x24')](function(){_0x245eb4[_0x9675('0x19')](0xcc)[_0x9675('0x18')]();});}};}function handleEntityNotFound(_0x2f70f4,_0x443d89){return function(_0x3cb7ac){if(!_0x3cb7ac){_0x2f70f4[_0x9675('0x17')](0x194);}return _0x3cb7ac;};}function handleError(_0x25be00,_0xde10e){_0xde10e=_0xde10e||0x1f4;return function(_0x59d0f7){logger[_0x9675('0x25')](_0x59d0f7[_0x9675('0x26')]);if(_0x59d0f7[_0x9675('0x27')]){delete _0x59d0f7[_0x9675('0x27')];}_0x25be00['status'](_0xde10e)[_0x9675('0x28')](_0x59d0f7);};}exports['index']=function(_0x41e65e,_0x2ec9eb){var _0x5b61b8={},_0x524f7b={},_0x149778={'count':0x0,'rows':[]};var _0x2032d9=_[_0x9675('0x29')](db['JscriptySessionReport'][_0x9675('0x2a')],function(_0x1cc88b){return{'name':_0x1cc88b[_0x9675('0x2b')],'type':_0x1cc88b['type'][_0x9675('0x2c')]};});_0x524f7b['model']=_['map'](_0x2032d9,_0x9675('0x27'));_0x524f7b['query']=_[_0x9675('0x2d')](_0x41e65e[_0x9675('0x2e')]);_0x524f7b[_0x9675('0x2f')]=_['intersection'](_0x524f7b[_0x9675('0x30')],_0x524f7b[_0x9675('0x2e')]);_0x5b61b8['attributes']=_[_0x9675('0x31')](_0x524f7b[_0x9675('0x30')],qs['fields'](_0x41e65e[_0x9675('0x2e')][_0x9675('0x32')]));_0x5b61b8['attributes']=_0x5b61b8[_0x9675('0x33')][_0x9675('0x34')]?_0x5b61b8[_0x9675('0x33')]:_0x524f7b[_0x9675('0x30')];if(!_0x41e65e[_0x9675('0x2e')]['hasOwnProperty'](_0x9675('0x35'))){_0x5b61b8['limit']=qs['limit'](_0x41e65e['query'][_0x9675('0x1c')]);_0x5b61b8[_0x9675('0x1a')]=qs[_0x9675('0x1a')](_0x41e65e['query'][_0x9675('0x1a')]);}_0x5b61b8['order']=qs[_0x9675('0x36')](_0x41e65e[_0x9675('0x2e')]['sort']);_0x5b61b8['where']=qs[_0x9675('0x2f')](_[_0x9675('0x37')](_0x41e65e[_0x9675('0x2e')],_0x524f7b[_0x9675('0x2f')]),_0x2032d9);if(_0x41e65e[_0x9675('0x2e')][_0x9675('0x38')]){_0x5b61b8[_0x9675('0x39')]=_[_0x9675('0x3a')](_0x5b61b8[_0x9675('0x39')],{'$or':_[_0x9675('0x29')](_0x2032d9,function(_0x4b70ea){if(_0x4b70ea[_0x9675('0x3b')]!=='VIRTUAL'){var _0x3f7a88={};_0x3f7a88[_0x4b70ea['name']]={'$like':'%'+_0x41e65e['query'][_0x9675('0x38')]+'%'};return _0x3f7a88;}})});}_0x5b61b8=_[_0x9675('0x3a')]({},_0x5b61b8,_0x41e65e[_0x9675('0x3c')]);var _0x23e200={'where':_0x5b61b8[_0x9675('0x39')]};return db[_0x9675('0x3d')][_0x9675('0x1d')](_0x23e200)[_0x9675('0x24')](function(_0x967b45){_0x149778['count']=_0x967b45;if(_0x41e65e[_0x9675('0x2e')]['includeAll']){_0x5b61b8[_0x9675('0x3e')]=[{'all':!![]}];}return db[_0x9675('0x3d')][_0x9675('0x3f')](_0x5b61b8);})[_0x9675('0x24')](function(_0x407ebe){_0x149778[_0x9675('0x40')]=_0x407ebe;return _0x149778;})[_0x9675('0x24')](respondWithFilteredResult(_0x2ec9eb,_0x5b61b8))[_0x9675('0x41')](handleError(_0x2ec9eb,null));};exports[_0x9675('0x42')]=function(_0x532ab4,_0x2da4f3){var _0x121ebf={'raw':!![],'where':{'id':_0x532ab4[_0x9675('0x43')]['id']}},_0x5c82c7={};_0x5c82c7[_0x9675('0x30')]=_['keys'](db[_0x9675('0x3d')][_0x9675('0x2a')]);_0x5c82c7[_0x9675('0x2e')]=_[_0x9675('0x2d')](_0x532ab4['query']);_0x5c82c7[_0x9675('0x2f')]=_[_0x9675('0x31')](_0x5c82c7[_0x9675('0x30')],_0x5c82c7[_0x9675('0x2e')]);_0x121ebf[_0x9675('0x33')]=_['intersection'](_0x5c82c7['model'],qs[_0x9675('0x32')](_0x532ab4[_0x9675('0x2e')][_0x9675('0x32')]));_0x121ebf[_0x9675('0x33')]=_0x121ebf[_0x9675('0x33')]['length']?_0x121ebf['attributes']:_0x5c82c7[_0x9675('0x30')];if(_0x532ab4[_0x9675('0x2e')]['includeAll']){_0x121ebf[_0x9675('0x3e')]=[{'all':!![]}];}_0x121ebf=_[_0x9675('0x3a')]({},_0x121ebf,_0x532ab4[_0x9675('0x3c')]);return db['JscriptySessionReport'][_0x9675('0x44')](_0x121ebf)[_0x9675('0x24')](handleEntityNotFound(_0x2da4f3,null))[_0x9675('0x24')](respondWithResult(_0x2da4f3,null))['catch'](handleError(_0x2da4f3,null));};exports[_0x9675('0x45')]=function(_0x45c76d,_0x275f54){return db[_0x9675('0x3d')]['create'](_0x45c76d[_0x9675('0x46')],{})[_0x9675('0x24')](respondWithResult(_0x275f54,0xc9))[_0x9675('0x41')](handleError(_0x275f54,null));};exports[_0x9675('0x47')]=function(_0x17bb47,_0x130a39){if(_0x17bb47['body']['id']){delete _0x17bb47[_0x9675('0x46')]['id'];}return db['JscriptySessionReport'][_0x9675('0x44')]({'where':{'id':_0x17bb47[_0x9675('0x43')]['id']}})[_0x9675('0x24')](handleEntityNotFound(_0x130a39,null))[_0x9675('0x24')](saveUpdates(_0x17bb47['body'],null))[_0x9675('0x24')](respondWithResult(_0x130a39,null))[_0x9675('0x41')](handleError(_0x130a39,null));};exports['destroy']=function(_0x119398,_0x512741){return db[_0x9675('0x3d')][_0x9675('0x44')]({'where':{'id':_0x119398['params']['id']}})['then'](handleEntityNotFound(_0x512741,null))['then'](removeEntity(_0x512741,null))[_0x9675('0x41')](handleError(_0x512741,null));};exports[_0x9675('0x48')]=function(_0x171663,_0x2760d1){return db['JscriptySessionReport'][_0x9675('0x48')]()[_0x9675('0x24')](respondWithResult(_0x2760d1,null))[_0x9675('0x41')](handleError(_0x2760d1,null));};exports[_0x9675('0x49')]=function(_0x1a3efd,_0x2b50b8,_0xad1752){var _0x2958df={'raw':!![],'where':{}};var _0xecd10c={};var _0x24c2f3={'count':0x0,'rows':[]};return db[_0x9675('0x3d')][_0x9675('0x4a')]({'where':{'id':_0x1a3efd[_0x9675('0x43')]['id']}})[_0x9675('0x24')](handleEntityNotFound(_0x2b50b8,null))['then'](function(_0x4cc8d8){if(_0x4cc8d8){_0xecd10c[_0x9675('0x30')]=_['keys'](db[_0x9675('0x4b')][_0x9675('0x2a')]);_0xecd10c[_0x9675('0x2e')]=_[_0x9675('0x2d')](_0x1a3efd[_0x9675('0x2e')]);_0xecd10c[_0x9675('0x2f')]=_[_0x9675('0x31')](_0xecd10c[_0x9675('0x30')],_0xecd10c['query']);_0x2958df['attributes']=_['intersection'](_0xecd10c['model'],qs['fields'](_0x1a3efd[_0x9675('0x2e')][_0x9675('0x32')]));_0x2958df[_0x9675('0x33')]=_0x2958df['attributes']['length']?_0x2958df['attributes']:_0xecd10c['model'];if(!_0x1a3efd[_0x9675('0x2e')]['hasOwnProperty']('nolimit')){_0x2958df[_0x9675('0x1c')]=qs[_0x9675('0x1c')](_0x1a3efd[_0x9675('0x2e')][_0x9675('0x1c')]);_0x2958df[_0x9675('0x1a')]=qs[_0x9675('0x1a')](_0x1a3efd[_0x9675('0x2e')][_0x9675('0x1a')]);}_0x2958df[_0x9675('0x4c')]=qs[_0x9675('0x36')](_0x1a3efd[_0x9675('0x2e')][_0x9675('0x36')]);_0x2958df[_0x9675('0x39')]=qs[_0x9675('0x2f')](_[_0x9675('0x37')](_0x1a3efd[_0x9675('0x2e')],_0xecd10c[_0x9675('0x2f')]));_0x2958df[_0x9675('0x39')][_0x9675('0x4d')]=_0x4cc8d8['id'];if(_0x1a3efd['query'][_0x9675('0x38')]){_0x2958df[_0x9675('0x39')]=_[_0x9675('0x3a')](_0x2958df[_0x9675('0x39')],{'$or':_['map'](_0x2958df[_0x9675('0x33')],function(_0x115c15){var _0x1cbb77={};_0x1cbb77[_0x115c15]={'$like':'%'+_0x1a3efd['query'][_0x9675('0x38')]+'%'};return _0x1cbb77;})});}_0x2958df=_['merge']({},_0x2958df,_0x1a3efd[_0x9675('0x3c')]);return db[_0x9675('0x4b')]['count']({'where':_0x2958df['where']})[_0x9675('0x24')](function(_0x14cc2d){_0x24c2f3[_0x9675('0x1d')]=_0x14cc2d;if(_0x1a3efd[_0x9675('0x2e')]['includeAll']){_0x2958df['include']=[{'all':!![]}];}return db[_0x9675('0x4b')][_0x9675('0x3f')](_0x2958df);})[_0x9675('0x24')](function(_0x2018a5){_0x24c2f3[_0x9675('0x40')]=_0x2018a5;return _0x24c2f3;});}})['then'](respondWithFilteredResult(_0x2b50b8,_0x2958df))[_0x9675('0x41')](handleError(_0x2b50b8,null));}; \ No newline at end of file +var _0x2ac3=['include','findAll','then','catch','show','params','find','create','body','getQuestions','findOne','pick','JscriptyQuestionReport','rows','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','end','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','map','keys','query','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll'];(function(_0x189944,_0x52bf5e){var _0x36117a=function(_0x92f6c){while(--_0x92f6c){_0x189944['push'](_0x189944['shift']());}};_0x36117a(++_0x52bf5e);}(_0x2ac3,0x1e8));var _0x32ac=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x2ac3[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x32ac('0x0'));var jsonpatch=require(_0x32ac('0x1'));var rp=require(_0x32ac('0x2'));var moment=require('moment');var BPromise=require(_0x32ac('0x3'));var Mustache=require('mustache');var util=require(_0x32ac('0x4'));var path=require(_0x32ac('0x5'));var sox=require(_0x32ac('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32ac('0x7'));var _=require('lodash');var squel=require(_0x32ac('0x8'));var crypto=require(_0x32ac('0x9'));var jsforce=require(_0x32ac('0xa'));var deskjs=require(_0x32ac('0xb'));var toCsv=require(_0x32ac('0xc'));var querystring=require(_0x32ac('0xd'));var Papa=require('papaparse');var Redis=require(_0x32ac('0xe'));var authService=require(_0x32ac('0xf'));var qs=require(_0x32ac('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ac('0x11'));var logger=require(_0x32ac('0x12'))(_0x32ac('0x13'));var utils=require(_0x32ac('0x14'));var config=require(_0x32ac('0x15'));var licenseUtil=require(_0x32ac('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b0e0f,_0x37915e){_0x37915e=_0x37915e||0xcc;return function(_0x5025e8){if(_0x5025e8){return _0x2b0e0f[_0x32ac('0x17')](_0x37915e);}return _0x2b0e0f[_0x32ac('0x18')](_0x37915e)['end']();};}function respondWithResult(_0xb2af34,_0x858538){_0x858538=_0x858538||0xc8;return function(_0x30f687){if(_0x30f687){return _0xb2af34[_0x32ac('0x18')](_0x858538)['json'](_0x30f687);}};}function respondWithFilteredResult(_0x1cb002,_0x5b623f){return function(_0x417c6b){if(_0x417c6b){var _0x19898a=typeof _0x5b623f[_0x32ac('0x19')]===_0x32ac('0x1a')&&typeof _0x5b623f[_0x32ac('0x1b')]==='undefined';var _0x207fe9=_0x417c6b[_0x32ac('0x1c')];var _0x6919ae=_0x19898a?0x0:_0x5b623f['offset'];var _0x2084d7=_0x19898a?_0x417c6b['count']:_0x5b623f[_0x32ac('0x19')]+_0x5b623f['limit'];var _0x2a89c3;if(_0x2084d7>=_0x207fe9){_0x2084d7=_0x207fe9;_0x2a89c3=0xc8;}else{_0x2a89c3=0xce;}_0x1cb002['status'](_0x2a89c3);return _0x1cb002['set'](_0x32ac('0x1d'),_0x6919ae+'-'+_0x2084d7+'/'+_0x207fe9)[_0x32ac('0x1e')](_0x417c6b);}return null;};}function patchUpdates(_0x405fce){return function(_0x31000d){try{jsonpatch[_0x32ac('0x1f')](_0x31000d,_0x405fce,!![]);}catch(_0x3e867d){return BPromise['reject'](_0x3e867d);}return _0x31000d[_0x32ac('0x20')]();};}function saveUpdates(_0x5b5c68,_0x275c13){return function(_0x3081d9){if(_0x3081d9){return _0x3081d9[_0x32ac('0x21')](_0x5b5c68)['then'](function(_0x4ce689){return _0x4ce689;});}return null;};}function removeEntity(_0x342986,_0x5b1d1f){return function(_0x2dd141){if(_0x2dd141){return _0x2dd141[_0x32ac('0x22')]()['then'](function(){_0x342986[_0x32ac('0x18')](0xcc)[_0x32ac('0x23')]();});}};}function handleEntityNotFound(_0x4cc908,_0x534776){return function(_0x5096b8){if(!_0x5096b8){_0x4cc908[_0x32ac('0x17')](0x194);}return _0x5096b8;};}function handleError(_0x10ed91,_0x4fd02f){_0x4fd02f=_0x4fd02f||0x1f4;return function(_0x5d9bcc){logger[_0x32ac('0x24')](_0x5d9bcc[_0x32ac('0x25')]);if(_0x5d9bcc[_0x32ac('0x26')]){delete _0x5d9bcc['name'];}_0x10ed91[_0x32ac('0x18')](_0x4fd02f)[_0x32ac('0x27')](_0x5d9bcc);};}exports[_0x32ac('0x28')]=function(_0x552aaa,_0x9aca10){var _0x311cf8={},_0x3b762b={},_0x2bcb1e={'count':0x0,'rows':[]};var _0x48aa9b=_['map'](db[_0x32ac('0x29')][_0x32ac('0x2a')],function(_0x30f34b){return{'name':_0x30f34b[_0x32ac('0x2b')],'type':_0x30f34b[_0x32ac('0x2c')][_0x32ac('0x2d')]};});_0x3b762b['model']=_[_0x32ac('0x2e')](_0x48aa9b,'name');_0x3b762b['query']=_[_0x32ac('0x2f')](_0x552aaa[_0x32ac('0x30')]);_0x3b762b['filters']=_['intersection'](_0x3b762b['model'],_0x3b762b['query']);_0x311cf8['attributes']=_[_0x32ac('0x31')](_0x3b762b['model'],qs[_0x32ac('0x32')](_0x552aaa[_0x32ac('0x30')][_0x32ac('0x32')]));_0x311cf8[_0x32ac('0x33')]=_0x311cf8[_0x32ac('0x33')][_0x32ac('0x34')]?_0x311cf8['attributes']:_0x3b762b[_0x32ac('0x35')];if(!_0x552aaa['query'][_0x32ac('0x36')](_0x32ac('0x37'))){_0x311cf8['limit']=qs[_0x32ac('0x1b')](_0x552aaa[_0x32ac('0x30')][_0x32ac('0x1b')]);_0x311cf8[_0x32ac('0x19')]=qs[_0x32ac('0x19')](_0x552aaa['query'][_0x32ac('0x19')]);}_0x311cf8[_0x32ac('0x38')]=qs[_0x32ac('0x39')](_0x552aaa['query'][_0x32ac('0x39')]);_0x311cf8[_0x32ac('0x3a')]=qs[_0x32ac('0x3b')](_['pick'](_0x552aaa[_0x32ac('0x30')],_0x3b762b['filters']),_0x48aa9b);if(_0x552aaa[_0x32ac('0x30')][_0x32ac('0x3c')]){_0x311cf8[_0x32ac('0x3a')]=_[_0x32ac('0x3d')](_0x311cf8[_0x32ac('0x3a')],{'$or':_['map'](_0x48aa9b,function(_0x43bd7d){if(_0x43bd7d[_0x32ac('0x2c')]!==_0x32ac('0x3e')){var _0x50f5fa={};_0x50f5fa[_0x43bd7d[_0x32ac('0x26')]]={'$like':'%'+_0x552aaa[_0x32ac('0x30')][_0x32ac('0x3c')]+'%'};return _0x50f5fa;}})});}_0x311cf8=_[_0x32ac('0x3d')]({},_0x311cf8,_0x552aaa[_0x32ac('0x3f')]);var _0x277d3a={'where':_0x311cf8[_0x32ac('0x3a')]};return db[_0x32ac('0x29')][_0x32ac('0x1c')](_0x277d3a)['then'](function(_0x1576c7){_0x2bcb1e['count']=_0x1576c7;if(_0x552aaa['query'][_0x32ac('0x40')]){_0x311cf8[_0x32ac('0x41')]=[{'all':!![]}];}return db[_0x32ac('0x29')][_0x32ac('0x42')](_0x311cf8);})[_0x32ac('0x43')](function(_0x1df797){_0x2bcb1e['rows']=_0x1df797;return _0x2bcb1e;})[_0x32ac('0x43')](respondWithFilteredResult(_0x9aca10,_0x311cf8))[_0x32ac('0x44')](handleError(_0x9aca10,null));};exports[_0x32ac('0x45')]=function(_0x27d1d6,_0x3c429b){var _0x27c6ce={'raw':!![],'where':{'id':_0x27d1d6[_0x32ac('0x46')]['id']}},_0x495fcb={};_0x495fcb[_0x32ac('0x35')]=_['keys'](db[_0x32ac('0x29')]['rawAttributes']);_0x495fcb['query']=_[_0x32ac('0x2f')](_0x27d1d6[_0x32ac('0x30')]);_0x495fcb[_0x32ac('0x3b')]=_[_0x32ac('0x31')](_0x495fcb['model'],_0x495fcb[_0x32ac('0x30')]);_0x27c6ce[_0x32ac('0x33')]=_[_0x32ac('0x31')](_0x495fcb[_0x32ac('0x35')],qs['fields'](_0x27d1d6['query'][_0x32ac('0x32')]));_0x27c6ce[_0x32ac('0x33')]=_0x27c6ce[_0x32ac('0x33')][_0x32ac('0x34')]?_0x27c6ce['attributes']:_0x495fcb[_0x32ac('0x35')];if(_0x27d1d6['query'][_0x32ac('0x40')]){_0x27c6ce[_0x32ac('0x41')]=[{'all':!![]}];}_0x27c6ce=_[_0x32ac('0x3d')]({},_0x27c6ce,_0x27d1d6['options']);return db['JscriptySessionReport'][_0x32ac('0x47')](_0x27c6ce)[_0x32ac('0x43')](handleEntityNotFound(_0x3c429b,null))[_0x32ac('0x43')](respondWithResult(_0x3c429b,null))[_0x32ac('0x44')](handleError(_0x3c429b,null));};exports[_0x32ac('0x48')]=function(_0x485aa0,_0x270996){return db[_0x32ac('0x29')][_0x32ac('0x48')](_0x485aa0[_0x32ac('0x49')],{})['then'](respondWithResult(_0x270996,0xc9))['catch'](handleError(_0x270996,null));};exports['update']=function(_0x2f19ac,_0x5f349b){if(_0x2f19ac[_0x32ac('0x49')]['id']){delete _0x2f19ac[_0x32ac('0x49')]['id'];}return db[_0x32ac('0x29')]['find']({'where':{'id':_0x2f19ac['params']['id']}})[_0x32ac('0x43')](handleEntityNotFound(_0x5f349b,null))[_0x32ac('0x43')](saveUpdates(_0x2f19ac['body'],null))[_0x32ac('0x43')](respondWithResult(_0x5f349b,null))[_0x32ac('0x44')](handleError(_0x5f349b,null));};exports[_0x32ac('0x22')]=function(_0x2a18ab,_0x160eaa){return db[_0x32ac('0x29')][_0x32ac('0x47')]({'where':{'id':_0x2a18ab[_0x32ac('0x46')]['id']}})[_0x32ac('0x43')](handleEntityNotFound(_0x160eaa,null))['then'](removeEntity(_0x160eaa,null))[_0x32ac('0x44')](handleError(_0x160eaa,null));};exports['describe']=function(_0x44fe83,_0x45c182){return db[_0x32ac('0x29')]['describe']()['then'](respondWithResult(_0x45c182,null))['catch'](handleError(_0x45c182,null));};exports[_0x32ac('0x4a')]=function(_0x47e68a,_0x569c20,_0x8035d0){var _0x152b3b={'raw':!![],'where':{}};var _0x53972c={};var _0x185829={'count':0x0,'rows':[]};return db[_0x32ac('0x29')][_0x32ac('0x4b')]({'where':{'id':_0x47e68a['params']['id']}})[_0x32ac('0x43')](handleEntityNotFound(_0x569c20,null))[_0x32ac('0x43')](function(_0x3e5706){if(_0x3e5706){_0x53972c[_0x32ac('0x35')]=_['keys'](db['JscriptyQuestionReport'][_0x32ac('0x2a')]);_0x53972c[_0x32ac('0x30')]=_['keys'](_0x47e68a['query']);_0x53972c['filters']=_[_0x32ac('0x31')](_0x53972c[_0x32ac('0x35')],_0x53972c[_0x32ac('0x30')]);_0x152b3b[_0x32ac('0x33')]=_[_0x32ac('0x31')](_0x53972c[_0x32ac('0x35')],qs[_0x32ac('0x32')](_0x47e68a['query']['fields']));_0x152b3b[_0x32ac('0x33')]=_0x152b3b[_0x32ac('0x33')][_0x32ac('0x34')]?_0x152b3b[_0x32ac('0x33')]:_0x53972c[_0x32ac('0x35')];if(!_0x47e68a[_0x32ac('0x30')][_0x32ac('0x36')](_0x32ac('0x37'))){_0x152b3b[_0x32ac('0x1b')]=qs['limit'](_0x47e68a['query']['limit']);_0x152b3b[_0x32ac('0x19')]=qs[_0x32ac('0x19')](_0x47e68a['query']['offset']);}_0x152b3b[_0x32ac('0x38')]=qs[_0x32ac('0x39')](_0x47e68a[_0x32ac('0x30')][_0x32ac('0x39')]);_0x152b3b[_0x32ac('0x3a')]=qs[_0x32ac('0x3b')](_[_0x32ac('0x4c')](_0x47e68a['query'],_0x53972c[_0x32ac('0x3b')]));_0x152b3b['where']['SessionId']=_0x3e5706['id'];if(_0x47e68a['query'][_0x32ac('0x3c')]){_0x152b3b['where']=_[_0x32ac('0x3d')](_0x152b3b['where'],{'$or':_[_0x32ac('0x2e')](_0x152b3b[_0x32ac('0x33')],function(_0x2e3e6a){var _0x204dc3={};_0x204dc3[_0x2e3e6a]={'$like':'%'+_0x47e68a[_0x32ac('0x30')][_0x32ac('0x3c')]+'%'};return _0x204dc3;})});}_0x152b3b=_[_0x32ac('0x3d')]({},_0x152b3b,_0x47e68a[_0x32ac('0x3f')]);return db[_0x32ac('0x4d')][_0x32ac('0x1c')]({'where':_0x152b3b[_0x32ac('0x3a')]})['then'](function(_0x4f608c){_0x185829['count']=_0x4f608c;if(_0x47e68a[_0x32ac('0x30')][_0x32ac('0x40')]){_0x152b3b[_0x32ac('0x41')]=[{'all':!![]}];}return db[_0x32ac('0x4d')][_0x32ac('0x42')](_0x152b3b);})['then'](function(_0x22bc17){_0x185829[_0x32ac('0x4e')]=_0x22bc17;return _0x185829;});}})[_0x32ac('0x43')](respondWithFilteredResult(_0x569c20,_0x152b3b))[_0x32ac('0x44')](handleError(_0x569c20,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8bd7320..f2181e2 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 _0xe14b=['bluebird','path','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','moment'];(function(_0x3ae013,_0x17cf25){var _0x518eec=function(_0x3df267){while(--_0x3df267){_0x3ae013['push'](_0x3ae013['shift']());}};_0x518eec(++_0x17cf25);}(_0xe14b,0x93));var _0xbe14=function(_0x11087e,_0x18f738){_0x11087e=_0x11087e-0x0;var _0x1ea4c0=_0xe14b[_0x11087e];return _0x1ea4c0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd4=['rimraf','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x9fd4[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 4f1e0b9..a479bd9 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 _0xd046=['ioredis','../../config/logger','../../config/environment','http','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xd046,0x129));var _0x6d04=function(_0x5d7c5e,_0xf50d25){_0x5d7c5e=_0x5d7c5e-0x0;var _0x1f8ca5=_0xd046[_0x5d7c5e];return _0x1f8ca5;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc2c7,0x134));var _0x7c2c=function(_0x543fc5,_0x268be3){_0x543fc5=_0x543fc5-0x0;var _0x438a94=_0xc2c7[_0x543fc5];return _0x438a94;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index e1b8a7a..28c3cbd 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 _0x9a50=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','put','/:id','isAuthenticated','/download_log_file','exports','multer','path','connect-timeout','express'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0x9a50,0x10a));var _0x09a5=function(_0x544b3f,_0x4d8b66){_0x544b3f=_0x544b3f-0x0;var _0x15787f=_0x9a50[_0x544b3f];return _0x15787f;};'use strict';var multer=require(_0x09a5('0x0'));var util=require('util');var path=require(_0x09a5('0x1'));var timeout=require(_0x09a5('0x2'));var express=require(_0x09a5('0x3'));var router=express[_0x09a5('0x4')]();var fs_extra=require(_0x09a5('0x5'));var auth=require(_0x09a5('0x6'));var interaction=require(_0x09a5('0x7'));var config=require(_0x09a5('0x8'));var controller=require('./license.controller');router[_0x09a5('0x9')]('/',controller['index']);router[_0x09a5('0xa')](_0x09a5('0xb'),auth[_0x09a5('0xc')](),controller['update']);router[_0x09a5('0x9')](_0x09a5('0xd'),auth[_0x09a5('0xc')](),controller['downloadLogFile']);module[_0x09a5('0xe')]=router; \ No newline at end of file +var _0xae86=['./license.controller','get','index','/:id','isAuthenticated','/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x34ac60,_0x4cd52a){var _0x40c3ce=function(_0x32fc67){while(--_0x32fc67){_0x34ac60['push'](_0x34ac60['shift']());}};_0x40c3ce(++_0x4cd52a);}(_0xae86,0x107));var _0x6ae8=function(_0x33b59b,_0x20fb08){_0x33b59b=_0x33b59b-0x0;var _0xc188d5=_0xae86[_0x33b59b];return _0xc188d5;};'use strict';var multer=require(_0x6ae8('0x0'));var util=require('util');var path=require(_0x6ae8('0x1'));var timeout=require(_0x6ae8('0x2'));var express=require(_0x6ae8('0x3'));var router=express[_0x6ae8('0x4')]();var fs_extra=require(_0x6ae8('0x5'));var auth=require(_0x6ae8('0x6'));var interaction=require(_0x6ae8('0x7'));var config=require(_0x6ae8('0x8'));var controller=require(_0x6ae8('0x9'));router[_0x6ae8('0xa')]('/',controller[_0x6ae8('0xb')]);router['put'](_0x6ae8('0xc'),auth[_0x6ae8('0xd')](),controller['update']);router['get'](_0x6ae8('0xe'),auth[_0x6ae8('0xd')](),controller[_0x6ae8('0xf')]);module[_0x6ae8('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 264c4f5..c7d2dd0 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 _0xa2ca=['sequelize','TEXT','STRING','INTEGER'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xa2ca,0x80));var _0xaa2c=function(_0x4b669b,_0x1815ff){_0x4b669b=_0x4b669b-0x0;var _0x49514b=_0xa2ca[_0x4b669b];return _0x49514b;};'use strict';var Sequelize=require(_0xaa2c('0x0'));module['exports']={'license':{'type':Sequelize[_0xaa2c('0x1')]},'data1':{'type':Sequelize[_0xaa2c('0x2')]},'data2':{'type':Sequelize[_0xaa2c('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xaa2c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x110e=['sequelize','TEXT','STRING','INTEGER'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x110e,0x140));var _0xe110=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x110e[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xe110('0x0'));module['exports']={'license':{'type':Sequelize[_0xe110('0x1')]},'data1':{'type':Sequelize[_0xe110('0x2')]},'data2':{'type':Sequelize[_0xe110('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe110('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 0068f09..1fd5897 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 _0x22bd=['jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','downloadLogFile','setHeader','Content-Type','download','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto'];(function(_0x1efc9e,_0x3e530b){var _0x5415ef=function(_0xb5d03f){while(--_0xb5d03f){_0x1efc9e['push'](_0x1efc9e['shift']());}};_0x5415ef(++_0x3e530b);}(_0x22bd,0x17f));var _0xd22b=function(_0x92e367,_0x516971){_0x92e367=_0x92e367-0x0;var _0x505bcb=_0x22bd[_0x92e367];return _0x505bcb;};'use strict';var emlformat=require(_0xd22b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd22b('0x1'));var jsonpatch=require(_0xd22b('0x2'));var rp=require(_0xd22b('0x3'));var moment=require('moment');var BPromise=require(_0xd22b('0x4'));var Mustache=require(_0xd22b('0x5'));var util=require(_0xd22b('0x6'));var path=require(_0xd22b('0x7'));var sox=require(_0xd22b('0x8'));var csv=require('to-csv');var ejs=require(_0xd22b('0x9'));var fs=require('fs');var fs_extra=require(_0xd22b('0xa'));var _=require('lodash');var squel=require(_0xd22b('0xb'));var crypto=require(_0xd22b('0xc'));var jsforce=require(_0xd22b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd22b('0xe'));var querystring=require('querystring');var Papa=require(_0xd22b('0xf'));var Redis=require(_0xd22b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd22b('0x11'));var as=require(_0xd22b('0x12'));var hardwareService=require(_0xd22b('0x13'));var logger=require(_0xd22b('0x14'))(_0xd22b('0x15'));var utils=require('../../config/utils');var config=require(_0xd22b('0x16'));var licenseUtil=require(_0xd22b('0x17'));var db=require(_0xd22b('0x18'))['db'];function respondWithStatusCode(_0x7a65c1,_0xd4b618){_0xd4b618=_0xd4b618||0xcc;return function(_0x323093){if(_0x323093){return _0x7a65c1[_0xd22b('0x19')](_0xd4b618);}return _0x7a65c1[_0xd22b('0x1a')](_0xd4b618)[_0xd22b('0x1b')]();};}function respondWithResult(_0x18a282,_0x2ea630){_0x2ea630=_0x2ea630||0xc8;return function(_0x20a13c){if(_0x20a13c){return _0x18a282[_0xd22b('0x1a')](_0x2ea630)[_0xd22b('0x1c')](_0x20a13c);}};}function respondWithFilteredResult(_0x200f20,_0x11a2ac){return function(_0x2a079f){if(_0x2a079f){var _0x21cb6b=typeof _0x11a2ac['offset']==='undefined'&&typeof _0x11a2ac[_0xd22b('0x1d')]==='undefined';var _0x257cdb=_0x2a079f['count'];var _0x2bb3aa=_0x21cb6b?0x0:_0x11a2ac[_0xd22b('0x1e')];var _0x7b7239=_0x21cb6b?_0x2a079f[_0xd22b('0x1f')]:_0x11a2ac[_0xd22b('0x1e')]+_0x11a2ac[_0xd22b('0x1d')];var _0x1e0961;if(_0x7b7239>=_0x257cdb){_0x7b7239=_0x257cdb;_0x1e0961=0xc8;}else{_0x1e0961=0xce;}_0x200f20['status'](_0x1e0961);return _0x200f20[_0xd22b('0x20')](_0xd22b('0x21'),_0x2bb3aa+'-'+_0x7b7239+'/'+_0x257cdb)['json'](_0x2a079f);}return null;};}function patchUpdates(_0xed9829){return function(_0x5cf47c){try{jsonpatch[_0xd22b('0x22')](_0x5cf47c,_0xed9829,!![]);}catch(_0x4cdc87){return BPromise[_0xd22b('0x23')](_0x4cdc87);}return _0x5cf47c[_0xd22b('0x24')]();};}function saveUpdates(_0x5bd576,_0x55e597){return function(_0x218dff){if(_0x218dff){return _0x218dff[_0xd22b('0x25')](_0x5bd576)[_0xd22b('0x26')](function(_0x1e7210){return _0x1e7210;});}return null;};}function removeEntity(_0x489dd1,_0x58930f){return function(_0xc273a4){if(_0xc273a4){return _0xc273a4[_0xd22b('0x27')]()['then'](function(){_0x489dd1[_0xd22b('0x1a')](0xcc)[_0xd22b('0x1b')]();});}};}function handleEntityNotFound(_0xe04176,_0x2a334c){return function(_0x338d47){if(!_0x338d47){_0xe04176['sendStatus'](0x194);}return _0x338d47;};}function handleError(_0x2c7e1c,_0x41aa34){_0x41aa34=_0x41aa34||0x1f4;return function(_0x55ccf9){logger['error'](_0x55ccf9['stack']);if(_0x55ccf9['name']){delete _0x55ccf9[_0xd22b('0x28')];}_0x2c7e1c[_0xd22b('0x1a')](_0x41aa34)[_0xd22b('0x29')](_0x55ccf9);};}var utilLicense=require(_0xd22b('0x17'));exports[_0xd22b('0x2a')]=function(_0x2e33d2,_0x8dc6ce){var _0x4be677={'raw':!![],'where':{'id':0x1}},_0x32e7d9={};_0x32e7d9[_0xd22b('0x2b')]=_[_0xd22b('0x2c')](db[_0xd22b('0x2d')][_0xd22b('0x2e')]);_0x32e7d9[_0xd22b('0x2f')]=_[_0xd22b('0x2c')](_0x2e33d2[_0xd22b('0x2f')]);_0x32e7d9[_0xd22b('0x30')]=_[_0xd22b('0x31')](_0x32e7d9[_0xd22b('0x2b')],_0x32e7d9[_0xd22b('0x2f')]);_0x4be677[_0xd22b('0x32')]=_[_0xd22b('0x31')](_0x32e7d9['model'],qs[_0xd22b('0x33')](_0x2e33d2[_0xd22b('0x2f')][_0xd22b('0x33')]));_0x4be677[_0xd22b('0x32')]=_0x4be677[_0xd22b('0x32')]['length']?_0x4be677['attributes']:_0x32e7d9[_0xd22b('0x2b')];_0x4be677=_[_0xd22b('0x34')]({},_0x4be677,_0x2e33d2[_0xd22b('0x35')]);return utilLicense[_0xd22b('0x36')](_0x4be677)[_0xd22b('0x26')](respondWithResult(_0x8dc6ce,null))[_0xd22b('0x37')](handleError(_0x8dc6ce,null));};exports['update']=function(_0x4dbdce,_0xa36660){if(_0x4dbdce[_0xd22b('0x38')]['id']){delete _0x4dbdce['body']['id'];}return db[_0xd22b('0x2d')][_0xd22b('0x39')]({'where':{'id':_0x4dbdce[_0xd22b('0x3a')]['id']}})[_0xd22b('0x26')](handleEntityNotFound(_0xa36660,null))[_0xd22b('0x26')](function(_0x4e38b7){var _0x383182=_0x4e38b7[_0xd22b('0x3b')]({'plain':!![]});return utilLicense[_0xd22b('0x3c')](_0x383182,_0x4dbdce[_0xd22b('0x38')][_0xd22b('0x3d')]);})[_0xd22b('0x26')](function(_0x2800ed){if(!_0x2800ed['demo']){return saveUpdates(_0x4dbdce['body'],null);}return _0x2800ed;})[_0xd22b('0x26')](respondWithResult(_0xa36660,null))[_0xd22b('0x37')](handleError(_0xa36660,null));};exports[_0xd22b('0x3e')]=function(_0x226a80,_0x667027){var _0x1cc0f1='license-info.log';var _0x397435=path['join']('/var','log','xcally',_0x1cc0f1);_0x667027[_0xd22b('0x3f')]('Content-disposition','attachment;\x20filename='+_0x1cc0f1);_0x667027['set'](_0xd22b('0x40'),'text/plain');_0x667027[_0xd22b('0x41')](_0x397435);}; \ No newline at end of file +var _0x8829=['options','getLicense','catch','body','License','find','params','demo','downloadLogFile','/var','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','stack','name','send','index','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge'];(function(_0x21192c,_0x2c531a){var _0x2c5cfa=function(_0x34fa8c){while(--_0x34fa8c){_0x21192c['push'](_0x21192c['shift']());}};_0x2c5cfa(++_0x2c531a);}(_0x8829,0xde));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9882('0x0'));var rimraf=require(_0x9882('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9882('0x2'));var rp=require(_0x9882('0x3'));var moment=require(_0x9882('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9882('0x5'));var path=require(_0x9882('0x6'));var sox=require(_0x9882('0x7'));var csv=require('to-csv');var ejs=require(_0x9882('0x8'));var fs=require('fs');var fs_extra=require(_0x9882('0x9'));var _=require(_0x9882('0xa'));var squel=require(_0x9882('0xb'));var crypto=require(_0x9882('0xc'));var jsforce=require(_0x9882('0xd'));var deskjs=require(_0x9882('0xe'));var toCsv=require(_0x9882('0xf'));var querystring=require(_0x9882('0x10'));var Papa=require(_0x9882('0x11'));var Redis=require('ioredis');var authService=require(_0x9882('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9882('0x13'));var hardwareService=require(_0x9882('0x14'));var logger=require('../../config/logger')(_0x9882('0x15'));var utils=require(_0x9882('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9882('0x17'));var db=require(_0x9882('0x18'))['db'];function respondWithStatusCode(_0x5d4035,_0x5ca199){_0x5ca199=_0x5ca199||0xcc;return function(_0x223583){if(_0x223583){return _0x5d4035[_0x9882('0x19')](_0x5ca199);}return _0x5d4035['status'](_0x5ca199)[_0x9882('0x1a')]();};}function respondWithResult(_0x283898,_0x58eaa1){_0x58eaa1=_0x58eaa1||0xc8;return function(_0x9777f){if(_0x9777f){return _0x283898[_0x9882('0x1b')](_0x58eaa1)['json'](_0x9777f);}};}function respondWithFilteredResult(_0xe33fdf,_0x6ba68a){return function(_0x576284){if(_0x576284){var _0x512d8d=typeof _0x6ba68a[_0x9882('0x1c')]===_0x9882('0x1d')&&typeof _0x6ba68a[_0x9882('0x1e')]===_0x9882('0x1d');var _0x1ca13c=_0x576284[_0x9882('0x1f')];var _0x442644=_0x512d8d?0x0:_0x6ba68a[_0x9882('0x1c')];var _0x5235bb=_0x512d8d?_0x576284[_0x9882('0x1f')]:_0x6ba68a[_0x9882('0x1c')]+_0x6ba68a[_0x9882('0x1e')];var _0x1d0d06;if(_0x5235bb>=_0x1ca13c){_0x5235bb=_0x1ca13c;_0x1d0d06=0xc8;}else{_0x1d0d06=0xce;}_0xe33fdf[_0x9882('0x1b')](_0x1d0d06);return _0xe33fdf[_0x9882('0x20')]('Content-Range',_0x442644+'-'+_0x5235bb+'/'+_0x1ca13c)[_0x9882('0x21')](_0x576284);}return null;};}function patchUpdates(_0x43a799){return function(_0x2506b1){try{jsonpatch[_0x9882('0x22')](_0x2506b1,_0x43a799,!![]);}catch(_0xa4f9fa){return BPromise[_0x9882('0x23')](_0xa4f9fa);}return _0x2506b1[_0x9882('0x24')]();};}function saveUpdates(_0x46c19e,_0x1e3488){return function(_0x5227f1){if(_0x5227f1){return _0x5227f1[_0x9882('0x25')](_0x46c19e)[_0x9882('0x26')](function(_0x42deac){return _0x42deac;});}return null;};}function removeEntity(_0x5aa6ab,_0xff5ee0){return function(_0x3beb81){if(_0x3beb81){return _0x3beb81['destroy']()[_0x9882('0x26')](function(){_0x5aa6ab[_0x9882('0x1b')](0xcc)[_0x9882('0x1a')]();});}};}function handleEntityNotFound(_0x2e5685,_0x319350){return function(_0xe10a8b){if(!_0xe10a8b){_0x2e5685[_0x9882('0x19')](0x194);}return _0xe10a8b;};}function handleError(_0x7c7d88,_0x1820e4){_0x1820e4=_0x1820e4||0x1f4;return function(_0xbb310c){logger[_0x9882('0x27')](_0xbb310c[_0x9882('0x28')]);if(_0xbb310c[_0x9882('0x29')]){delete _0xbb310c[_0x9882('0x29')];}_0x7c7d88['status'](_0x1820e4)[_0x9882('0x2a')](_0xbb310c);};}var utilLicense=require('../../config/license/util');exports[_0x9882('0x2b')]=function(_0x2f36f0,_0x2d55f5){var _0xe919fe={'raw':!![],'where':{'id':0x1}},_0x1fa609={};_0x1fa609[_0x9882('0x2c')]=_['keys'](db['License'][_0x9882('0x2d')]);_0x1fa609[_0x9882('0x2e')]=_[_0x9882('0x2f')](_0x2f36f0[_0x9882('0x2e')]);_0x1fa609[_0x9882('0x30')]=_[_0x9882('0x31')](_0x1fa609['model'],_0x1fa609['query']);_0xe919fe[_0x9882('0x32')]=_['intersection'](_0x1fa609[_0x9882('0x2c')],qs['fields'](_0x2f36f0[_0x9882('0x2e')][_0x9882('0x33')]));_0xe919fe['attributes']=_0xe919fe['attributes'][_0x9882('0x34')]?_0xe919fe['attributes']:_0x1fa609[_0x9882('0x2c')];_0xe919fe=_[_0x9882('0x35')]({},_0xe919fe,_0x2f36f0[_0x9882('0x36')]);return utilLicense[_0x9882('0x37')](_0xe919fe)[_0x9882('0x26')](respondWithResult(_0x2d55f5,null))[_0x9882('0x38')](handleError(_0x2d55f5,null));};exports[_0x9882('0x25')]=function(_0x5c56f6,_0x1b4aaa){if(_0x5c56f6[_0x9882('0x39')]['id']){delete _0x5c56f6[_0x9882('0x39')]['id'];}return db[_0x9882('0x3a')][_0x9882('0x3b')]({'where':{'id':_0x5c56f6[_0x9882('0x3c')]['id']}})[_0x9882('0x26')](handleEntityNotFound(_0x1b4aaa,null))[_0x9882('0x26')](function(_0x135105){var _0x17f0f7=_0x135105['get']({'plain':!![]});return utilLicense['checkLicense'](_0x17f0f7,_0x5c56f6[_0x9882('0x39')]['key']);})[_0x9882('0x26')](function(_0x3f61e1){if(!_0x3f61e1[_0x9882('0x3d')]){return saveUpdates(_0x5c56f6[_0x9882('0x39')],null);}return _0x3f61e1;})[_0x9882('0x26')](respondWithResult(_0x1b4aaa,null))[_0x9882('0x38')](handleError(_0x1b4aaa,null));};exports[_0x9882('0x3e')]=function(_0x3114b7,_0x29d21b){var _0x51daea='license-info.log';var _0x392eb0=path['join'](_0x9882('0x3f'),'log','xcally',_0x51daea);_0x29d21b[_0x9882('0x40')]('Content-disposition',_0x9882('0x41')+_0x51daea);_0x29d21b[_0x9882('0x20')](_0x9882('0x42'),_0x9882('0x43'));_0x29d21b[_0x9882('0x44')](_0x392eb0);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4e7b7be..c18577e 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 _0x74af=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','License','license','lodash'];(function(_0x5a1c85,_0xa75d8f){var _0x21d6a5=function(_0x4c0020){while(--_0x4c0020){_0x5a1c85['push'](_0x5a1c85['shift']());}};_0x21d6a5(++_0xa75d8f);}(_0x74af,0x178));var _0xf74a=function(_0x2223c1,_0x1cc229){_0x2223c1=_0x2223c1-0x0;var _0x33573c=_0x74af[_0x2223c1];return _0x33573c;};'use strict';var _=require(_0xf74a('0x0'));var util=require(_0xf74a('0x1'));var logger=require(_0xf74a('0x2'))(_0xf74a('0x3'));var moment=require(_0xf74a('0x4'));var BPromise=require(_0xf74a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf74a('0x6'));var rimraf=require(_0xf74a('0x7'));var config=require(_0xf74a('0x8'));var attributes=require(_0xf74a('0x9'));module[_0xf74a('0xa')]=function(_0x41c258,_0x110741){return _0x41c258['define'](_0xf74a('0xb'),attributes,{'tableName':_0xf74a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a6f=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash'];(function(_0x306bbe,_0x3b846f){var _0x871a9c=function(_0x1568ff){while(--_0x1568ff){_0x306bbe['push'](_0x306bbe['shift']());}};_0x871a9c(++_0x3b846f);}(_0x7a6f,0x1e0));var _0xf7a6=function(_0x1bde82,_0x38452e){_0x1bde82=_0x1bde82-0x0;var _0x4ca54d=_0x7a6f[_0x1bde82];return _0x4ca54d;};'use strict';var _=require(_0xf7a6('0x0'));var util=require('util');var logger=require(_0xf7a6('0x1'))(_0xf7a6('0x2'));var moment=require(_0xf7a6('0x3'));var BPromise=require('bluebird');var rp=require(_0xf7a6('0x4'));var fs=require('fs');var path=require(_0xf7a6('0x5'));var rimraf=require(_0xf7a6('0x6'));var config=require(_0xf7a6('0x7'));var attributes=require(_0xf7a6('0x8'));module[_0xf7a6('0x9')]=function(_0x5a7ff1,_0x2d6bca){return _0x5a7ff1[_0xf7a6('0xa')](_0xf7a6('0xb'),attributes,{'tableName':_0xf7a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 037922b..02daa9b 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 _0xacd2=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','License,\x20%s,\x20%s','message','request\x20sent','result','catch','util','bluebird','randomstring'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0xacd2,0xa5));var _0x2acd=function(_0x330756,_0x39d5d8){_0x330756=_0x330756-0x0;var _0x18c708=_0xacd2[_0x330756];return _0x18c708;};'use strict';var _=require('lodash');var util=require(_0x2acd('0x0'));var moment=require('moment');var BPromise=require(_0x2acd('0x1'));var rs=require(_0x2acd('0x2'));var fs=require('fs');var Redis=require(_0x2acd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2acd('0x4'));var logger=require(_0x2acd('0x5'))('rpc');var config=require(_0x2acd('0x6'));var jayson=require(_0x2acd('0x7'));var client=jayson['client'][_0x2acd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38bd54,_0x1cdd9a,_0x4ba137){return new BPromise(function(_0x16c901,_0xef357){return client[_0x2acd('0x9')](_0x38bd54,_0x4ba137)[_0x2acd('0xa')](function(_0xdb850e){logger[_0x2acd('0xb')]('License,\x20%s,\x20%s',_0x1cdd9a,'request\x20sent');logger[_0x2acd('0xc')](_0x2acd('0xd'),_0x1cdd9a,'request\x20sent',JSON[_0x2acd('0xe')](_0xdb850e));if(_0xdb850e[_0x2acd('0xf')]){if(_0xdb850e[_0x2acd('0xf')]['code']===0x1f4){logger['error'](_0x2acd('0x10'),_0x1cdd9a,_0xdb850e[_0x2acd('0xf')][_0x2acd('0x11')]);return _0xef357(_0xdb850e[_0x2acd('0xf')]['message']);}logger[_0x2acd('0xf')]('License,\x20%s,\x20%s',_0x1cdd9a,_0xdb850e[_0x2acd('0xf')][_0x2acd('0x11')]);return _0x16c901(_0xdb850e[_0x2acd('0xf')][_0x2acd('0x11')]);}else{logger[_0x2acd('0xb')](_0x2acd('0x10'),_0x1cdd9a,_0x2acd('0x12'));_0x16c901(_0xdb850e[_0x2acd('0x13')][_0x2acd('0x11')]);}})[_0x2acd('0x14')](function(_0x19bf97){logger['error'](_0x2acd('0x10'),_0x1cdd9a,_0x19bf97);_0xef357(_0x19bf97);});});} \ No newline at end of file +var _0x06ef=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x06ef,0x12a));var _0xf06e=function(_0x52a073,_0x225c33){_0x52a073=_0x52a073-0x0;var _0x14c817=_0x06ef[_0x52a073];return _0x14c817;};'use strict';var _=require(_0xf06e('0x0'));var util=require(_0xf06e('0x1'));var moment=require(_0xf06e('0x2'));var BPromise=require(_0xf06e('0x3'));var rs=require(_0xf06e('0x4'));var fs=require('fs');var Redis=require(_0xf06e('0x5'));var db=require(_0xf06e('0x6'))['db'];var utils=require(_0xf06e('0x7'));var logger=require(_0xf06e('0x8'))(_0xf06e('0x9'));var config=require('../../config/environment');var jayson=require(_0xf06e('0xa'));var client=jayson[_0xf06e('0xb')][_0xf06e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3407d1,_0x509fda,_0x416ab0){return new BPromise(function(_0xbf87ae,_0x4f7f54){return client['request'](_0x3407d1,_0x416ab0)[_0xf06e('0xd')](function(_0x1ab5d4){logger[_0xf06e('0xe')](_0xf06e('0xf'),_0x509fda,_0xf06e('0x10'));logger[_0xf06e('0x11')](_0xf06e('0x12'),_0x509fda,_0xf06e('0x10'),JSON[_0xf06e('0x13')](_0x1ab5d4));if(_0x1ab5d4[_0xf06e('0x14')]){if(_0x1ab5d4[_0xf06e('0x14')][_0xf06e('0x15')]===0x1f4){logger[_0xf06e('0x14')](_0xf06e('0xf'),_0x509fda,_0x1ab5d4['error'][_0xf06e('0x16')]);return _0x4f7f54(_0x1ab5d4[_0xf06e('0x14')]['message']);}logger[_0xf06e('0x14')](_0xf06e('0xf'),_0x509fda,_0x1ab5d4[_0xf06e('0x14')][_0xf06e('0x16')]);return _0xbf87ae(_0x1ab5d4[_0xf06e('0x14')][_0xf06e('0x16')]);}else{logger[_0xf06e('0xe')](_0xf06e('0xf'),_0x509fda,_0xf06e('0x10'));_0xbf87ae(_0x1ab5d4[_0xf06e('0x17')][_0xf06e('0x16')]);}})[_0xf06e('0x18')](function(_0x13c0d5){logger[_0xf06e('0x14')](_0xf06e('0xf'),_0x509fda,_0x13c0d5);_0x4f7f54(_0x13c0d5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 527e557..355263c 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 _0x8376=['getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','/:id/applications','getMessages','/:id/verify','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','/:id/users','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','/:id/out_servers','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','describe','get','/:id','show','/:id/dispositions'];(function(_0x5a7b37,_0x4eee41){var _0x41fd1e=function(_0x4c1fc6){while(--_0x4c1fc6){_0x5a7b37['push'](_0x5a7b37['shift']());}};_0x41fd1e(++_0x4eee41);}(_0x8376,0x1ab));var _0x6837=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8376[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x6837('0x0'));var util=require('util');var path=require(_0x6837('0x1'));var timeout=require(_0x6837('0x2'));var express=require(_0x6837('0x3'));var router=express[_0x6837('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6837('0x5'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router['get']('/',auth[_0x6837('0x6')](),controller[_0x6837('0x7')]);router['get']('/describe',auth[_0x6837('0x6')](),controller[_0x6837('0x8')]);router[_0x6837('0x9')](_0x6837('0xa'),auth[_0x6837('0x6')](),controller[_0x6837('0xb')]);router['get'](_0x6837('0xc'),auth[_0x6837('0x6')](),controller[_0x6837('0xd')]);router[_0x6837('0x9')](_0x6837('0xe'),auth['isAuthenticated'](),controller[_0x6837('0xf')]);router[_0x6837('0x9')](_0x6837('0x10'),auth[_0x6837('0x6')](),controller[_0x6837('0x11')]);router[_0x6837('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x6837('0x12')]);router[_0x6837('0x9')](_0x6837('0x13'),auth[_0x6837('0x6')](),controller['getInteractions']);router['get'](_0x6837('0x14'),auth[_0x6837('0x6')](),controller['getApplications']);router[_0x6837('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6837('0x15')]);router[_0x6837('0x9')](_0x6837('0x16'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x6837('0x9')]('/:id/users',auth[_0x6837('0x6')](),controller[_0x6837('0x17')]);router[_0x6837('0x18')]('/:id/dispositions',auth[_0x6837('0x6')](),controller[_0x6837('0x19')]);router[_0x6837('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6837('0x1a')]);router[_0x6837('0x18')]('/',auth[_0x6837('0x6')](),controller[_0x6837('0x1b')]);router[_0x6837('0x18')](_0x6837('0x10'),auth[_0x6837('0x6')](),controller[_0x6837('0x1c')]);router[_0x6837('0x18')]('/:id/out_servers',auth[_0x6837('0x6')](),controller[_0x6837('0x1d')]);router[_0x6837('0x18')]('/:id/interactions',auth[_0x6837('0x6')](),controller[_0x6837('0x1e')]);router[_0x6837('0x18')](_0x6837('0x14'),auth['isAuthenticated'](),controller[_0x6837('0x1f')]);router[_0x6837('0x18')](_0x6837('0x20'),auth[_0x6837('0x6')](),controller['send']);router[_0x6837('0x18')](_0x6837('0x21'),auth[_0x6837('0x6')](),controller[_0x6837('0x22')]);router[_0x6837('0x23')](_0x6837('0xa'),auth[_0x6837('0x6')](),controller['update']);router[_0x6837('0x24')](_0x6837('0xc'),auth[_0x6837('0x6')](),controller[_0x6837('0x25')]);router[_0x6837('0x24')](_0x6837('0xe'),auth[_0x6837('0x6')](),controller[_0x6837('0x26')]);router[_0x6837('0x24')]('/:id/in_servers',auth[_0x6837('0x6')](),controller[_0x6837('0x27')]);router['delete'](_0x6837('0x28'),auth[_0x6837('0x6')](),controller['removeSmtp']);router[_0x6837('0x24')](_0x6837('0xa'),auth[_0x6837('0x6')](),controller[_0x6837('0x29')]);router[_0x6837('0x24')](_0x6837('0x21'),auth['isAuthenticated'](),controller[_0x6837('0x2a')]);module[_0x6837('0x2b')]=router; \ No newline at end of file +var _0xf007=['/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create','addSmtp','/:id/interactions','addInteraction','addApplications','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','multer','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf007,0x1d9));var _0x7f00=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0xf007[_0x4bb94b];return _0x36dcc6;};'use strict';var multer=require(_0x7f00('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7f00('0x1'));var express=require(_0x7f00('0x2'));var router=express[_0x7f00('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7f00('0x4'));var controller=require('./mailAccount.controller');router[_0x7f00('0x5')]('/',auth[_0x7f00('0x6')](),controller[_0x7f00('0x7')]);router[_0x7f00('0x5')](_0x7f00('0x8'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x9')]);router[_0x7f00('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x7f00('0xa')]);router[_0x7f00('0x5')](_0x7f00('0xb'),auth[_0x7f00('0x6')](),controller[_0x7f00('0xc')]);router['get'](_0x7f00('0xd'),auth[_0x7f00('0x6')](),controller[_0x7f00('0xe')]);router[_0x7f00('0x5')](_0x7f00('0xf'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x10')]);router[_0x7f00('0x5')](_0x7f00('0x11'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x12')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x7f00('0x13')]);router[_0x7f00('0x5')](_0x7f00('0x14'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x15')]);router['get'](_0x7f00('0x16'),auth['isAuthenticated'](),controller[_0x7f00('0x17')]);router[_0x7f00('0x5')](_0x7f00('0x18'),auth['isAuthenticated'](),controller['verifySmtp']);router['get'](_0x7f00('0x19'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x1a')]);router[_0x7f00('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7f00('0x1c')]);router[_0x7f00('0x1b')](_0x7f00('0xd'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x1d')]);router[_0x7f00('0x1b')]('/',auth[_0x7f00('0x6')](),controller[_0x7f00('0x1e')]);router[_0x7f00('0x1b')]('/:id/in_servers',auth[_0x7f00('0x6')](),controller['addImap']);router[_0x7f00('0x1b')](_0x7f00('0x11'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x1f')]);router['post'](_0x7f00('0x20'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x21')]);router[_0x7f00('0x1b')](_0x7f00('0x14'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x22')]);router['post']('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x7f00('0x1b')]('/:id/users',auth[_0x7f00('0x6')](),controller[_0x7f00('0x23')]);router[_0x7f00('0x24')](_0x7f00('0x25'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x26')]);router[_0x7f00('0x27')](_0x7f00('0xb'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x28')]);router['delete'](_0x7f00('0xd'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x29')]);router['delete'](_0x7f00('0xf'),auth[_0x7f00('0x6')](),controller['removeImap']);router[_0x7f00('0x27')]('/:id/out_servers',auth[_0x7f00('0x6')](),controller[_0x7f00('0x2a')]);router[_0x7f00('0x27')](_0x7f00('0x25'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x2b')]);router[_0x7f00('0x27')](_0x7f00('0x19'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 6c0f242..4d9fb8a 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 _0xc02e=['provider','custom','sequelize','STRING','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','ENUM','hotmail','yahoo','getDataValue'];(function(_0x182064,_0x4114df){var _0x592c69=function(_0x3cf4ca){while(--_0x3cf4ca){_0x182064['push'](_0x182064['shift']());}};_0x592c69(++_0x4114df);}(_0xc02e,0x9c));var _0xec02=function(_0x5cf76b,_0xfbf968){_0x5cf76b=_0x5cf76b-0x0;var _0x50d61f=_0xc02e[_0x5cf76b];return _0x50d61f;};'use strict';var Sequelize=require(_0xec02('0x0'));module['exports']={'description':{'type':Sequelize[_0xec02('0x1')]},'name':{'type':Sequelize[_0xec02('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xec02('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xec02('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xec02('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xec02('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xec02('0x3')]},'markAsUnread':{'type':Sequelize[_0xec02('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xec02('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xec02('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xec02('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xec02('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xec02('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xec02('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xec02('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xec02('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xec02('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xec02('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xec02('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xec02('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xec02('0x5')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x506c30){if(!_0x506c30)this[_0xec02('0x6')](_0xec02('0x7'),null);this[_0xec02('0x6')]('mandatoryDisposition',_0x506c30);}},'provider':{'type':Sequelize[_0xec02('0x8')]('gmail',_0xec02('0x9'),_0xec02('0xa'),'outlook365'),'defaultValue':null,'get':function(){var _0x22c8c1=this[_0xec02('0xb')](_0xec02('0xc'));return _0x22c8c1||_0xec02('0xd');},'set':function(_0x5c9e94){if(_0x5c9e94===_0xec02('0xd')){_0x5c9e94=null;}return this['setDataValue'](_0xec02('0xc'),_0x5c9e94);}}}; \ No newline at end of file +var _0xb3e7=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0xb3e7,0x165));var _0x7b3e=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xb3e7[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0x7b3e('0x0'));module[_0x7b3e('0x1')]={'description':{'type':Sequelize[_0x7b3e('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7b3e('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7b3e('0x4')]},'markAsUnread':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7b3e('0x2')],'allowNull':![],'defaultValue':_0x7b3e('0x5')},'fontSize':{'type':Sequelize[_0x7b3e('0x6')](0x2)[_0x7b3e('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7b3e('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7b3e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7b3e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7b3e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b3e('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![],'comment':_0x7b3e('0x8'),'set':function(_0x2d902b){if(!_0x2d902b)this[_0x7b3e('0x9')]('mandatoryDispositionPauseId',null);this[_0x7b3e('0x9')]('mandatoryDisposition',_0x2d902b);}},'provider':{'type':Sequelize[_0x7b3e('0xa')]('gmail',_0x7b3e('0xb'),_0x7b3e('0xc'),_0x7b3e('0xd')),'defaultValue':null,'get':function(){var _0x5dbc8c=this[_0x7b3e('0xe')](_0x7b3e('0xf'));return _0x5dbc8c||_0x7b3e('0x10');},'set':function(_0x4b9229){if(_0x4b9229===_0x7b3e('0x10')){_0x4b9229=null;}return this[_0x7b3e('0x9')](_0x7b3e('0xf'),_0x4b9229);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4a44b30..ae30eab 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 _0xb07f=['getMessages','MailMessage','$gte','format','inlineCss','true','split','CmList','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','server/files/attachments','SendMail','sendMail','List\x20not\x20found','List','messageId','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','addAgents','omit','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','util','path','lodash','juice','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','request','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','info','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','destroy','then','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','user','pass','modernAuthentication','CloudProviderId','password','host','service','authentication','username','Imap','port','Smtp','index','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','params','MailServerOut','length','update','body','custom','secure','find','MailServerIn','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','CannedAnswer','removeAnswers','provider','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications'];(function(_0xcbd63a,_0x2a5d90){var _0x51bcff=function(_0xdeb511){while(--_0xdeb511){_0xcbd63a['push'](_0xcbd63a['shift']());}};_0x51bcff(++_0x2a5d90);}(_0xb07f,0xe6));var _0xfb07=function(_0x110708,_0x336af6){_0x110708=_0x110708-0x0;var _0x406a86=_0xb07f[_0x110708];return _0x406a86;};'use strict';var moment=require(_0xfb07('0x0'));var BPromise=require('bluebird');var util=require(_0xfb07('0x1'));var path=require(_0xfb07('0x2'));var _=require(_0xfb07('0x3'));var juice=require(_0xfb07('0x4'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xfb07('0x5'));var config=require(_0xfb07('0x6'));var db=require(_0xfb07('0x7'))['db'];config['redis']=_[_0xfb07('0x8')](config[_0xfb07('0x9')],{'host':_0xfb07('0xa'),'port':0x18eb});var socket=require(_0xfb07('0xb'))(new Redis(config[_0xfb07('0x9')]));require(_0xfb07('0xc'))[_0xfb07('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfb07('0xe')]['http']({'port':0x232b});function respondWithRpcPromise(_0x4af898,_0x5d8a15,_0xd79e25,_0xf2356){return new BPromise(function(_0x573f98,_0x5b97b6){var _0x4f96ec=_0xf2356||client;return _0x4f96ec[_0xfb07('0xf')](_0x4af898,_0xd79e25)['then'](function(_0x3fefca){logger['info']('MailAccount,\x20%s,\x20%s',_0x5d8a15,_0xfb07('0x10'));logger[_0xfb07('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5d8a15,'request\x20sent',JSON[_0xfb07('0x12')](_0x3fefca));if(_0x3fefca[_0xfb07('0x13')]){if(_0x3fefca['error']['code']===0x1f4){logger[_0xfb07('0x13')](_0xfb07('0x14'),_0x5d8a15,_0x3fefca['error']['message']);return _0x5b97b6(_0x3fefca[_0xfb07('0x13')]['message']);}logger['error'](_0xfb07('0x14'),_0x5d8a15,_0x3fefca[_0xfb07('0x13')][_0xfb07('0x15')]);return _0x573f98(_0x3fefca[_0xfb07('0x13')]['message']);}else{logger[_0xfb07('0x16')](_0xfb07('0x14'),_0x5d8a15,'request\x20sent');_0x573f98(_0x3fefca['result'][_0xfb07('0x15')]);}})[_0xfb07('0x17')](function(_0x4e82ae){logger['error']('MailAccount,\x20%s,\x20%s',_0x5d8a15,_0x4e82ae);_0x5b97b6(_0x4e82ae);});});}function respondWithStatusCode(_0x35fc83,_0xe59f1d){_0xe59f1d=_0xe59f1d||0xcc;return function(_0x2b9183){if(_0x2b9183){return _0x35fc83[_0xfb07('0x18')](_0xe59f1d);}return _0x35fc83['status'](_0xe59f1d)[_0xfb07('0x19')]();};}function respondWithResult(_0xe4c777,_0x3ba406){_0x3ba406=_0x3ba406||0xc8;return function(_0x321ab4){if(_0x321ab4){return _0xe4c777[_0xfb07('0x1a')](_0x3ba406)[_0xfb07('0x1b')](_0x321ab4);}};}function respondWithFilteredResult(_0x32754d,_0x480997){return function(_0x4aea91){if(_0x4aea91){var _0x40d2c4=typeof _0x480997[_0xfb07('0x1c')]==='undefined'&&typeof _0x480997[_0xfb07('0x1d')]===_0xfb07('0x1e');var _0x3764c0=_0x4aea91[_0xfb07('0x1f')];var _0x3aacee=_0x40d2c4?0x0:_0x480997[_0xfb07('0x1c')];var _0x475844=_0x40d2c4?_0x4aea91[_0xfb07('0x1f')]:_0x480997['offset']+_0x480997['limit'];var _0x2a4b52;if(_0x475844>=_0x3764c0){_0x475844=_0x3764c0;_0x2a4b52=0xc8;}else{_0x2a4b52=0xce;}_0x32754d['status'](_0x2a4b52);return _0x32754d[_0xfb07('0x20')](_0xfb07('0x21'),_0x3aacee+'-'+_0x475844+'/'+_0x3764c0)[_0xfb07('0x1b')](_0x4aea91);}return null;};}function saveUpdates(_0x55a57a){return function(_0x3cbc3c){if(_0x3cbc3c){return _0x3cbc3c['update'](_0x55a57a)['then'](function(_0x287192){return _0x287192;});}return null;};}function removeEntity(_0x1eaa82){return function(_0x21d67e){if(_0x21d67e){return _0x21d67e[_0xfb07('0x22')]()[_0xfb07('0x23')](function(){var _0x3e7271=_0x21d67e[_0xfb07('0x24')]({'plain':!![]});var _0x4762d3=_0xfb07('0x25');return db[_0xfb07('0x26')]['destroy']({'where':{'type':_0x4762d3,'resourceId':_0x3e7271['id']}})[_0xfb07('0x23')](function(){return _0x21d67e;});})['then'](function(){_0x1eaa82[_0xfb07('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2953aa){return function(_0x5a402a){if(!_0x5a402a){_0x2953aa[_0xfb07('0x18')](0x194);}return _0x5a402a;};}function handleError(_0x1e9659,_0x499bb7){_0x499bb7=_0x499bb7||0x1f4;return function(_0x3a0057){logger[_0xfb07('0x13')](_0x3a0057[_0xfb07('0x27')]);if(_0x3a0057[_0xfb07('0x28')]){delete _0x3a0057[_0xfb07('0x28')];}_0x1e9659[_0xfb07('0x1a')](_0x499bb7)[_0xfb07('0x29')](_0x3a0057);};}function getImapHost(_0xf1f95e){switch(_0xf1f95e){case _0xfb07('0x2a'):return'imap.gmail.com';case'yahoo':return _0xfb07('0x2b');case _0xfb07('0x2c'):return _0xfb07('0x2d');case _0xfb07('0x2e'):return _0xfb07('0x2f');}throw new Error(_0xfb07('0x30'),_0xf1f95e);}function getSmtpHost(_0x1b1cac){switch(_0x1b1cac){case _0xfb07('0x2a'):return _0xfb07('0x31');case'yahoo':return'smtp.mail.yahoo.com';case _0xfb07('0x2c'):return _0xfb07('0x32');case'outlook365':return'smtp.office365.com';}throw new Error(_0xfb07('0x30'),_0x1b1cac);}function getAuthenticationOptions(_0x4d8df3,_0x5c2b3c){var _0x1ecaf5={};var _0x35dcbb={};if(_0x4d8df3){_0x1ecaf5[_0xfb07('0x33')]=_0x35dcbb[_0xfb07('0x33')]=_0x5c2b3c['username'];_0x1ecaf5['password']=_0x35dcbb[_0xfb07('0x34')]=_0x5c2b3c['password'];if(_0x5c2b3c[_0xfb07('0x35')]){_0x1ecaf5['modernAuthentication']=_0x35dcbb['modernAuthentication']=!![];_0x1ecaf5[_0xfb07('0x36')]=_0x35dcbb[_0xfb07('0x36')]=_0x5c2b3c[_0xfb07('0x36')];_0x1ecaf5[_0xfb07('0x37')]=_0x35dcbb['pass']=null;}else{_0x1ecaf5['CloudProviderId']=_0x35dcbb[_0xfb07('0x36')]=null;}_0x1ecaf5[_0xfb07('0x38')]=getImapHost(_0x4d8df3);_0x1ecaf5['port']=0x3e1;_0x35dcbb[_0xfb07('0x38')]=getSmtpHost(_0x4d8df3);_0x35dcbb['port']=0x24b;_0x35dcbb['secure']=![];_0x1ecaf5[_0xfb07('0x39')]=_0x35dcbb[_0xfb07('0x39')]=null;}else{if(_0x5c2b3c[_0xfb07('0x3a')]){_0x1ecaf5[_0xfb07('0x33')]=_0x35dcbb[_0xfb07('0x33')]=_0x5c2b3c[_0xfb07('0x3b')];_0x1ecaf5[_0xfb07('0x37')]=_0x35dcbb[_0xfb07('0x34')]=_0x5c2b3c[_0xfb07('0x37')];}else{_0x1ecaf5[_0xfb07('0x3a')]=_0x35dcbb[_0xfb07('0x3a')]=![];_0x1ecaf5['user']=_0x35dcbb[_0xfb07('0x33')]=null;_0x1ecaf5[_0xfb07('0x37')]=_0x35dcbb[_0xfb07('0x34')]=null;}_0x1ecaf5[_0xfb07('0x38')]=_0x5c2b3c[_0xfb07('0x3c')][_0xfb07('0x38')];_0x1ecaf5[_0xfb07('0x3d')]=_0x5c2b3c[_0xfb07('0x3c')][_0xfb07('0x3d')];_0x35dcbb[_0xfb07('0x38')]=_0x5c2b3c[_0xfb07('0x3e')][_0xfb07('0x38')];_0x35dcbb['port']=_0x5c2b3c[_0xfb07('0x3e')][_0xfb07('0x3d')];}return{'Imap':_0x1ecaf5,'Smtp':_0x35dcbb};}exports[_0xfb07('0x3f')]=function(_0x189ebc,_0x27a1de){var _0x525136={'include':[{'model':db['MailServerIn'],'as':_0xfb07('0x3c')},{'model':db['MailServerOut'],'as':_0xfb07('0x3e')},{'model':db[_0xfb07('0x40')],'as':_0xfb07('0x41')}]},_0x59ce7e={},_0x1ebab3={'count':0x0,'rows':[]};var _0x594f8e=_[_0xfb07('0x42')](db[_0xfb07('0x43')][_0xfb07('0x44')],function(_0x31dd4e){return{'name':_0x31dd4e['fieldName'],'type':_0x31dd4e[_0xfb07('0x45')][_0xfb07('0x46')]};});_0x59ce7e['model']=_[_0xfb07('0x42')](_0x594f8e,'name');_0x59ce7e['query']=_[_0xfb07('0x47')](_0x189ebc[_0xfb07('0x48')]);_0x59ce7e[_0xfb07('0x49')]=_[_0xfb07('0x4a')](_0x59ce7e['model'],_0x59ce7e[_0xfb07('0x48')]);_0x525136['attributes']=_[_0xfb07('0x4a')](_0x59ce7e[_0xfb07('0x4b')],qs[_0xfb07('0x4c')](_0x189ebc[_0xfb07('0x48')][_0xfb07('0x4c')]));_0x525136[_0xfb07('0x4d')]=_0x525136[_0xfb07('0x4d')]['length']?_0x525136[_0xfb07('0x4d')]:_0x59ce7e[_0xfb07('0x4b')];if(!_0x189ebc[_0xfb07('0x48')]['hasOwnProperty'](_0xfb07('0x4e'))){_0x525136[_0xfb07('0x1d')]=qs[_0xfb07('0x1d')](_0x189ebc[_0xfb07('0x48')][_0xfb07('0x1d')]);_0x525136[_0xfb07('0x1c')]=qs[_0xfb07('0x1c')](_0x189ebc[_0xfb07('0x48')][_0xfb07('0x1c')]);}_0x525136[_0xfb07('0x4f')]=qs[_0xfb07('0x50')](_0x189ebc[_0xfb07('0x48')][_0xfb07('0x50')]);_0x525136['where']=qs['filters'](_[_0xfb07('0x51')](_0x189ebc[_0xfb07('0x48')],_0x59ce7e['filters']),_0x594f8e);if(_0x189ebc['query'][_0xfb07('0x52')]){_0x525136['where']=_[_0xfb07('0x53')](_0x525136[_0xfb07('0x54')],{'$or':_[_0xfb07('0x42')](_0x594f8e,function(_0x5d7917){if(_0x5d7917[_0xfb07('0x45')]!==_0xfb07('0x55')){var _0x1814ed={};_0x1814ed[_0x5d7917[_0xfb07('0x28')]]={'$like':'%'+_0x189ebc[_0xfb07('0x48')][_0xfb07('0x52')]+'%'};return _0x1814ed;}})});}_0x525136=_[_0xfb07('0x53')]({},_0x525136,_0x189ebc[_0xfb07('0x56')]);var _0xc434aa={'where':_0x525136['where']};return db[_0xfb07('0x43')]['count'](_0xc434aa)['then'](function(_0x34dd99){_0x1ebab3['count']=_0x34dd99;if(_0x189ebc[_0xfb07('0x48')][_0xfb07('0x57')]){_0x525136[_0xfb07('0x58')]=[{'all':!![]}];}return db[_0xfb07('0x43')][_0xfb07('0x59')](_0x525136);})[_0xfb07('0x23')](function(_0x1ffe4b){_0x1ebab3[_0xfb07('0x5a')]=_0x1ffe4b;return _0x1ebab3;})[_0xfb07('0x23')](respondWithFilteredResult(_0x27a1de,_0x525136))[_0xfb07('0x17')](handleError(_0x27a1de,null));};exports['show']=function(_0xb92a75,_0x275132){var _0x4649c5={'raw':![],'where':{'id':_0xb92a75[_0xfb07('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xfb07('0x3c')},{'model':db[_0xfb07('0x5c')],'as':'Smtp'},{'model':db[_0xfb07('0x40')],'as':_0xfb07('0x41')}]},_0x238b1c={};_0x238b1c[_0xfb07('0x4b')]=_[_0xfb07('0x47')](db[_0xfb07('0x43')][_0xfb07('0x44')]);_0x238b1c[_0xfb07('0x48')]=_[_0xfb07('0x47')](_0xb92a75['query']);_0x238b1c[_0xfb07('0x49')]=_[_0xfb07('0x4a')](_0x238b1c[_0xfb07('0x4b')],_0x238b1c[_0xfb07('0x48')]);_0x4649c5[_0xfb07('0x4d')]=_[_0xfb07('0x4a')](_0x238b1c['model'],qs['fields'](_0xb92a75[_0xfb07('0x48')][_0xfb07('0x4c')]));_0x4649c5[_0xfb07('0x4d')]=_0x4649c5[_0xfb07('0x4d')][_0xfb07('0x5d')]?_0x4649c5[_0xfb07('0x4d')]:_0x238b1c[_0xfb07('0x4b')];if(_0xb92a75[_0xfb07('0x48')][_0xfb07('0x57')]){_0x4649c5['include']=[{'all':!![]}];}_0x4649c5=_[_0xfb07('0x53')]({},_0x4649c5,_0xb92a75[_0xfb07('0x56')]);return db[_0xfb07('0x43')]['find'](_0x4649c5)[_0xfb07('0x23')](handleEntityNotFound(_0x275132,null))[_0xfb07('0x23')](respondWithResult(_0x275132,null))['catch'](handleError(_0x275132,null));};exports[_0xfb07('0x5e')]=function(_0x22129e,_0x19d3dc){if(_0x22129e[_0xfb07('0x5f')]['id']){delete _0x22129e[_0xfb07('0x5f')]['id'];}var _0x4e8173=_0x22129e[_0xfb07('0x5f')]['provider']===_0xfb07('0x60')?null:_0x22129e[_0xfb07('0x5f')]['provider'];var _0x43230f=_0x22129e['body']['Imap']||{};var _0x52cd7b=_0x22129e['body']['Smtp']||{};if(_0x4e8173){_0x43230f[_0xfb07('0x38')]=getImapHost(_0x4e8173);_0x43230f[_0xfb07('0x3d')]=0x3e1;_0x52cd7b[_0xfb07('0x38')]=getSmtpHost(_0x4e8173);_0x52cd7b['port']=0x24b;_0x52cd7b[_0xfb07('0x61')]=![];}if(_0x52cd7b[_0xfb07('0x35')]){_0x52cd7b[_0xfb07('0x61')]=![];}else{_0x52cd7b[_0xfb07('0x36')]=null;}if(!_0x43230f[_0xfb07('0x35')])_0x43230f[_0xfb07('0x36')]=null;_0x22129e['body'][_0xfb07('0x3c')]=_0x43230f;_0x22129e['body'][_0xfb07('0x3e')]=_0x52cd7b;return db[_0xfb07('0x43')][_0xfb07('0x62')]({'where':{'id':_0x22129e[_0xfb07('0x5b')]['id']},'include':[{'model':db[_0xfb07('0x63')],'as':'Imap'},{'model':db[_0xfb07('0x5c')],'as':_0xfb07('0x3e')},{'model':db[_0xfb07('0x40')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x19d3dc,null))[_0xfb07('0x23')](function(_0x21c06d){if(!_0x21c06d)throw new Error(_0xfb07('0x64'));if(_0x21c06d['service'])delete _0x22129e['body'][_0xfb07('0x3c')];return _0x21c06d;})['then'](saveUpdates(_0x22129e['body'],null))[_0xfb07('0x23')](function(_0xbeb9e){if(!_0x22129e[_0xfb07('0x5f')][_0xfb07('0x3c')])return _0xbeb9e;return db[_0xfb07('0x63')]['update'](_0x22129e['body']['Imap'],{'where':{'MailAccountId':_0xbeb9e['id']}})['then'](function(){return _0xbeb9e;});})[_0xfb07('0x23')](function(_0x4cbee8){if(!_0x22129e[_0xfb07('0x5f')]['Smtp'])return _0x4cbee8;return db[_0xfb07('0x5c')]['update'](_0x22129e['body']['Smtp'],{'where':{'MailAccountId':_0x4cbee8['id']}})[_0xfb07('0x23')](function(){return _0x4cbee8;});})['then'](respondWithResult(_0x19d3dc,null))['catch'](handleError(_0x19d3dc,null));};exports['describe']=function(_0x26158c,_0x3a7839){return db[_0xfb07('0x43')][_0xfb07('0x65')]()['then'](respondWithResult(_0x3a7839,null))[_0xfb07('0x17')](handleError(_0x3a7839,null));};exports['addDisposition']=function(_0xbe8e22,_0x1d5329){if(_0xbe8e22[_0xfb07('0x5f')]['id']){delete _0xbe8e22[_0xfb07('0x5f')]['id'];}return db[_0xfb07('0x43')][_0xfb07('0x62')]({'where':{'id':_0xbe8e22[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x1d5329,null))[_0xfb07('0x23')](function(_0x23c0e2){if(_0x23c0e2){_0xbe8e22[_0xfb07('0x5f')][_0xfb07('0x66')]=_0x23c0e2['id'];return db[_0xfb07('0x67')][_0xfb07('0x68')](_0xbe8e22[_0xfb07('0x5f')]);}})[_0xfb07('0x23')](respondWithResult(_0x1d5329,null))['catch'](handleError(_0x1d5329,null));};exports[_0xfb07('0x69')]=function(_0x1b700d,_0x14f15e){var _0x59c729={'raw':![],'where':{}};var _0x32dd57={};var _0x3fe63c={'count':0x0,'rows':[]};return db[_0xfb07('0x43')][_0xfb07('0x6a')]({'where':{'id':_0x1b700d[_0xfb07('0x5b')]['id']}})['then'](handleEntityNotFound(_0x14f15e,null))['then'](function(_0x410ef0){if(_0x410ef0){_0x32dd57['model']=_[_0xfb07('0x47')](db[_0xfb07('0x67')][_0xfb07('0x44')]);_0x32dd57[_0xfb07('0x48')]=_[_0xfb07('0x47')](_0x1b700d['query']);_0x32dd57[_0xfb07('0x49')]=_[_0xfb07('0x4a')](_0x32dd57[_0xfb07('0x4b')],_0x32dd57['query']);_0x59c729[_0xfb07('0x4d')]=_[_0xfb07('0x4a')](_0x32dd57[_0xfb07('0x4b')],qs[_0xfb07('0x4c')](_0x1b700d['query'][_0xfb07('0x4c')]));_0x59c729[_0xfb07('0x4d')]=_0x59c729['attributes'][_0xfb07('0x5d')]?_0x59c729[_0xfb07('0x4d')]:_0x32dd57[_0xfb07('0x4b')];if(!_0x1b700d['query'][_0xfb07('0x6b')](_0xfb07('0x4e'))){_0x59c729[_0xfb07('0x1d')]=qs[_0xfb07('0x1d')](_0x1b700d[_0xfb07('0x48')][_0xfb07('0x1d')]);_0x59c729['offset']=qs[_0xfb07('0x1c')](_0x1b700d['query'][_0xfb07('0x1c')]);}_0x59c729[_0xfb07('0x4f')]=qs['sort'](_0x1b700d[_0xfb07('0x48')][_0xfb07('0x50')]);_0x59c729['where']=qs[_0xfb07('0x49')](_['pick'](_0x1b700d['query'],_0x32dd57[_0xfb07('0x49')]));_0x59c729[_0xfb07('0x54')]['MailAccountId']=_0x410ef0['id'];if(_0x1b700d[_0xfb07('0x48')][_0xfb07('0x52')]){_0x59c729[_0xfb07('0x54')]=_[_0xfb07('0x53')](_0x59c729[_0xfb07('0x54')],{'$or':_['map'](_0x59c729[_0xfb07('0x4d')],function(_0x5f5f29){var _0x233be1={};_0x233be1[_0x5f5f29]={'$like':'%'+_0x1b700d[_0xfb07('0x48')][_0xfb07('0x52')]+'%'};return _0x233be1;})});}_0x59c729=_[_0xfb07('0x53')]({},_0x59c729,_0x1b700d['options']);return db[_0xfb07('0x67')][_0xfb07('0x1f')]({'where':_0x59c729[_0xfb07('0x54')]})[_0xfb07('0x23')](function(_0xb5be65){_0x3fe63c[_0xfb07('0x1f')]=_0xb5be65;if(_0x1b700d[_0xfb07('0x48')][_0xfb07('0x57')]){_0x59c729['include']=[{'all':!![]}];}return db[_0xfb07('0x67')]['findAll'](_0x59c729);})['then'](function(_0x5c0054){_0x3fe63c[_0xfb07('0x5a')]=_0x5c0054;return _0x3fe63c;});}})['then'](respondWithFilteredResult(_0x14f15e,_0x59c729))[_0xfb07('0x17')](handleError(_0x14f15e,null));};exports[_0xfb07('0x6c')]=function(_0x15c2bf,_0x596fee){return db['MailAccount'][_0xfb07('0x62')]({'where':{'id':_0x15c2bf[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x596fee,null))[_0xfb07('0x23')](function(_0x4b4976){if(_0x4b4976){return _0x4b4976['removeDispositions'](_0x15c2bf[_0xfb07('0x48')][_0xfb07('0x6d')]);}})['then'](respondWithStatusCode(_0x596fee,null))[_0xfb07('0x17')](handleError(_0x596fee,null));};exports['addAnswer']=function(_0x567976,_0x686ec7){if(_0x567976[_0xfb07('0x5f')]['id']){delete _0x567976[_0xfb07('0x5f')]['id'];}return db['MailAccount'][_0xfb07('0x62')]({'where':{'id':_0x567976['params']['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x686ec7,null))[_0xfb07('0x23')](function(_0x211e94){if(_0x211e94){_0x567976[_0xfb07('0x5f')]['MailAccountId']=_0x211e94['id'];return db[_0xfb07('0x6e')]['create'](_0x567976[_0xfb07('0x5f')]);}})[_0xfb07('0x23')](respondWithResult(_0x686ec7,null))[_0xfb07('0x17')](handleError(_0x686ec7,null));};exports['getAnswers']=function(_0x488852,_0x112216){var _0x53831b={'raw':![],'where':{}};var _0x3a87f6={};var _0x5c34f9={'count':0x0,'rows':[]};return db[_0xfb07('0x43')][_0xfb07('0x6a')]({'where':{'id':_0x488852[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x112216,null))['then'](function(_0x1cd8b1){if(_0x1cd8b1){_0x3a87f6[_0xfb07('0x4b')]=_[_0xfb07('0x47')](db[_0xfb07('0x6e')][_0xfb07('0x44')]);_0x3a87f6['query']=_[_0xfb07('0x47')](_0x488852[_0xfb07('0x48')]);_0x3a87f6[_0xfb07('0x49')]=_['intersection'](_0x3a87f6[_0xfb07('0x4b')],_0x3a87f6['query']);_0x53831b[_0xfb07('0x4d')]=_[_0xfb07('0x4a')](_0x3a87f6[_0xfb07('0x4b')],qs[_0xfb07('0x4c')](_0x488852[_0xfb07('0x48')]['fields']));_0x53831b[_0xfb07('0x4d')]=_0x53831b[_0xfb07('0x4d')][_0xfb07('0x5d')]?_0x53831b['attributes']:_0x3a87f6[_0xfb07('0x4b')];if(!_0x488852[_0xfb07('0x48')][_0xfb07('0x6b')]('nolimit')){_0x53831b[_0xfb07('0x1d')]=qs[_0xfb07('0x1d')](_0x488852[_0xfb07('0x48')][_0xfb07('0x1d')]);_0x53831b[_0xfb07('0x1c')]=qs[_0xfb07('0x1c')](_0x488852[_0xfb07('0x48')][_0xfb07('0x1c')]);}_0x53831b['order']=qs[_0xfb07('0x50')](_0x488852[_0xfb07('0x48')][_0xfb07('0x50')]);_0x53831b[_0xfb07('0x54')]=qs[_0xfb07('0x49')](_[_0xfb07('0x51')](_0x488852[_0xfb07('0x48')],_0x3a87f6[_0xfb07('0x49')]));_0x53831b[_0xfb07('0x54')][_0xfb07('0x66')]=_0x1cd8b1['id'];if(_0x488852[_0xfb07('0x48')][_0xfb07('0x52')]){_0x53831b['where']=_[_0xfb07('0x53')](_0x53831b[_0xfb07('0x54')],{'$or':_[_0xfb07('0x42')](_0x53831b[_0xfb07('0x4d')],function(_0x2d95fc){var _0x1ec430={};_0x1ec430[_0x2d95fc]={'$like':'%'+_0x488852[_0xfb07('0x48')][_0xfb07('0x52')]+'%'};return _0x1ec430;})});}_0x53831b=_[_0xfb07('0x53')]({},_0x53831b,_0x488852[_0xfb07('0x56')]);return db[_0xfb07('0x6e')]['count']({'where':_0x53831b[_0xfb07('0x54')]})['then'](function(_0x237a2d){_0x5c34f9[_0xfb07('0x1f')]=_0x237a2d;if(_0x488852[_0xfb07('0x48')][_0xfb07('0x57')]){_0x53831b[_0xfb07('0x58')]=[{'all':!![]}];}return db[_0xfb07('0x6e')]['findAll'](_0x53831b);})[_0xfb07('0x23')](function(_0x202bff){_0x5c34f9[_0xfb07('0x5a')]=_0x202bff;return _0x5c34f9;});}})[_0xfb07('0x23')](respondWithFilteredResult(_0x112216,_0x53831b))['catch'](handleError(_0x112216,null));};exports[_0xfb07('0x6f')]=function(_0x349996,_0x36683a){return db[_0xfb07('0x43')][_0xfb07('0x62')]({'where':{'id':_0x349996[_0xfb07('0x5b')]['id']}})['then'](handleEntityNotFound(_0x36683a,null))[_0xfb07('0x23')](function(_0x1a6c81){if(_0x1a6c81){return _0x1a6c81[_0xfb07('0x6f')](_0x349996['query'][_0xfb07('0x6d')]);}})[_0xfb07('0x23')](respondWithStatusCode(_0x36683a,null))[_0xfb07('0x17')](handleError(_0x36683a,null));};exports[_0xfb07('0x68')]=function(_0x430510,_0x364108){var _0x9f2400={'name':_0x430510[_0xfb07('0x5f')][_0xfb07('0x28')],'key':_0x430510['body']['key'],'provider':_0x430510[_0xfb07('0x5f')][_0xfb07('0x70')]==='custom'?null:_0x430510[_0xfb07('0x5f')][_0xfb07('0x70')],'email':_0x430510[_0xfb07('0x5f')]['email'],'ListId':_0x430510['body'][_0xfb07('0x71')],'active':!_[_0xfb07('0x72')](_0x430510[_0xfb07('0x5f')][_0xfb07('0x73')])?_0x430510[_0xfb07('0x5f')]['active']:!![],'description':_0x430510[_0xfb07('0x5f')]['description']||null};var _0x46b72e=getAuthenticationOptions(_0x9f2400[_0xfb07('0x70')],_0x430510[_0xfb07('0x5f')]);_0x9f2400[_0xfb07('0x3c')]=_0x46b72e[_0xfb07('0x3c')];_0x9f2400[_0xfb07('0x3e')]=_0x46b72e[_0xfb07('0x3e')];return db['MailAccount'][_0xfb07('0x68')](_0x9f2400,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xfb07('0x63')],'as':_0xfb07('0x3c')}]})['then'](function(_0x3d4eca){var _0x1169f3=_0x430510[_0xfb07('0x33')]['get']({'plain':!![]});if(!_0x1169f3)throw new Error(_0xfb07('0x74'));if(_0x1169f3['role']===_0xfb07('0x33')){var _0x2c60ab=_0x3d4eca[_0xfb07('0x24')]({'plain':!![]});return db[_0xfb07('0x75')]['find']({'where':{'name':_0xfb07('0x25'),'userProfileId':_0x1169f3[_0xfb07('0x76')]},'raw':!![]})[_0xfb07('0x23')](function(_0x44e5f0){if(_0x44e5f0&&_0x44e5f0[_0xfb07('0x77')]===0x0){return db[_0xfb07('0x26')][_0xfb07('0x68')]({'name':_0x2c60ab[_0xfb07('0x28')],'resourceId':_0x2c60ab['id'],'type':_0x44e5f0[_0xfb07('0x28')],'sectionId':_0x44e5f0['id']},{})[_0xfb07('0x23')](function(){return _0x3d4eca;});}else{return _0x3d4eca;}})[_0xfb07('0x17')](function(_0x11470c){logger['error'](_0xfb07('0x78'),_0x11470c);throw _0x11470c;});}return _0x3d4eca;})[_0xfb07('0x23')](respondWithResult(_0x364108,0xc9))[_0xfb07('0x17')](handleError(_0x364108,null));};exports[_0xfb07('0x79')]=function(_0x49519a,_0x23d598){return db['MailAccount'][_0xfb07('0x6a')]({'where':{'id':_0x49519a[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x23d598,null))['then'](function(_0x36b6dd){if(_0x36b6dd){return _0x36b6dd[_0xfb07('0x79')]();}return null;})[_0xfb07('0x23')](respondWithResult(_0x23d598,null))['catch'](handleError(_0x23d598,null));};exports[_0xfb07('0x7a')]=function(_0x5ed646,_0x5592c9){if(_0x5ed646[_0xfb07('0x5f')]['id']){delete _0x5ed646[_0xfb07('0x5f')]['id'];}return db[_0xfb07('0x43')][_0xfb07('0x62')]({'where':{'id':_0x5ed646['params']['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x5592c9,null))[_0xfb07('0x23')](function(_0x46b3e5){if(_0x46b3e5){_0x5ed646[_0xfb07('0x5f')]['MailAccountId']=_0x46b3e5['id'];return db[_0xfb07('0x63')][_0xfb07('0x68')](_0x5ed646[_0xfb07('0x5f')]);}})['then'](respondWithResult(_0x5592c9,null))[_0xfb07('0x17')](handleError(_0x5592c9,null));};exports['removeImap']=function(_0x20534a,_0x222bc2){return db[_0xfb07('0x43')]['findOne']({'where':{'id':_0x20534a[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x222bc2,null))['then'](function(_0x233c0b){if(_0x233c0b){return _0x233c0b[_0xfb07('0x7b')](null);}return null;})[_0xfb07('0x23')](respondWithStatusCode(_0x222bc2,null))[_0xfb07('0x17')](handleError(_0x222bc2,null));};exports[_0xfb07('0x7c')]=function(_0x582753,_0x43b383){return db[_0xfb07('0x43')][_0xfb07('0x6a')]({'where':{'id':_0x582753[_0xfb07('0x5b')]['id']}})['then'](handleEntityNotFound(_0x43b383,null))[_0xfb07('0x23')](function(_0x50dfbe){if(_0x50dfbe){return _0x50dfbe['getSmtp']();}return null;})['then'](respondWithResult(_0x43b383,null))['catch'](handleError(_0x43b383,null));};exports[_0xfb07('0x7d')]=function(_0x50221b,_0xf53ef3){if(_0x50221b[_0xfb07('0x5f')]['id']){delete _0x50221b['body']['id'];}return db[_0xfb07('0x43')]['find']({'where':{'id':_0x50221b[_0xfb07('0x5b')]['id']}})['then'](handleEntityNotFound(_0xf53ef3,null))[_0xfb07('0x23')](function(_0x3086a5){if(_0x3086a5){_0x50221b[_0xfb07('0x5f')][_0xfb07('0x66')]=_0x3086a5['id'];return db[_0xfb07('0x5c')]['create'](_0x50221b[_0xfb07('0x5f')]);}})['then'](respondWithResult(_0xf53ef3,null))[_0xfb07('0x17')](handleError(_0xf53ef3,null));};exports[_0xfb07('0x7e')]=function(_0x446bd3,_0x2c2a8c){return db[_0xfb07('0x43')][_0xfb07('0x6a')]({'where':{'id':_0x446bd3[_0xfb07('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2c2a8c,null))['then'](function(_0x55ca08){if(_0x55ca08){return _0x55ca08[_0xfb07('0x7f')](null);}return null;})[_0xfb07('0x23')](respondWithStatusCode(_0x2c2a8c,null))[_0xfb07('0x17')](handleError(_0x2c2a8c,null));};exports[_0xfb07('0x80')]=function(_0x4d545a,_0x461c1f){return db[_0xfb07('0x81')][_0xfb07('0x62')]({'where':{'id':_0x4d545a['params']['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x461c1f,null))['then'](function(_0x22520a){if(_0x22520a){return _0x22520a['addInteraction'](_0x4d545a['body'][_0xfb07('0x6d')],_['omit'](_0x4d545a[_0xfb07('0x5f')],[_0xfb07('0x6d'),'id'])||{});}})[_0xfb07('0x23')](respondWithResult(_0x461c1f,null))[_0xfb07('0x17')](handleError(_0x461c1f,null));};exports[_0xfb07('0x82')]=function(_0x2fdff4,_0x384608){var _0x262774={'raw':![],'where':{}};var _0x5a3f41={};var _0x21607a={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2fdff4[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x384608,null))[_0xfb07('0x23')](function(_0x190481){if(_0x190481){_0x5a3f41[_0xfb07('0x4b')]=_[_0xfb07('0x47')](db['MailInteraction'][_0xfb07('0x44')]);_0x5a3f41['query']=_[_0xfb07('0x47')](_0x2fdff4[_0xfb07('0x48')]);_0x5a3f41[_0xfb07('0x49')]=_[_0xfb07('0x4a')](_0x5a3f41[_0xfb07('0x4b')],_0x5a3f41[_0xfb07('0x48')]);_0x262774[_0xfb07('0x4d')]=_[_0xfb07('0x4a')](_0x5a3f41['model'],qs[_0xfb07('0x4c')](_0x2fdff4[_0xfb07('0x48')][_0xfb07('0x4c')]));_0x262774[_0xfb07('0x4d')]=_0x262774[_0xfb07('0x4d')][_0xfb07('0x5d')]?_0x262774[_0xfb07('0x4d')]:_0x5a3f41[_0xfb07('0x4b')];if(!_0x2fdff4[_0xfb07('0x48')][_0xfb07('0x6b')](_0xfb07('0x4e'))){_0x262774[_0xfb07('0x1d')]=qs[_0xfb07('0x1d')](_0x2fdff4[_0xfb07('0x48')][_0xfb07('0x1d')]);_0x262774[_0xfb07('0x1c')]=qs[_0xfb07('0x1c')](_0x2fdff4[_0xfb07('0x48')][_0xfb07('0x1c')]);}_0x262774[_0xfb07('0x4f')]=qs[_0xfb07('0x50')](_0x2fdff4[_0xfb07('0x48')][_0xfb07('0x50')]);_0x262774['where']=qs[_0xfb07('0x49')](_[_0xfb07('0x51')](_0x2fdff4[_0xfb07('0x48')],_0x5a3f41[_0xfb07('0x49')]));_0x262774[_0xfb07('0x54')][_0xfb07('0x66')]=_0x190481['id'];if(_0x2fdff4[_0xfb07('0x48')][_0xfb07('0x52')]){_0x262774[_0xfb07('0x54')]=_[_0xfb07('0x53')](_0x262774[_0xfb07('0x54')],{'$or':_[_0xfb07('0x42')](_0x262774['attributes'],function(_0x378d94){var _0xa44235={};_0xa44235[_0x378d94]={'$like':'%'+_0x2fdff4['query'][_0xfb07('0x52')]+'%'};return _0xa44235;})});}_0x262774=_[_0xfb07('0x53')]({},_0x262774,_0x2fdff4[_0xfb07('0x56')]);return db[_0xfb07('0x81')]['count']({'where':_0x262774[_0xfb07('0x54')]})[_0xfb07('0x23')](function(_0x28f0d9){_0x21607a[_0xfb07('0x1f')]=_0x28f0d9;if(_0x2fdff4[_0xfb07('0x48')][_0xfb07('0x57')]){_0x262774[_0xfb07('0x58')]=[{'model':db[_0xfb07('0x83')],'as':_0xfb07('0x84'),'required':![]},{'model':db['User'],'as':_0xfb07('0x85'),'attributes':[_0xfb07('0x28'),_0xfb07('0x86'),_0xfb07('0x87')],'required':![]},{'model':db[_0xfb07('0x88')],'as':_0xfb07('0x89'),'attributes':['id','name',_0xfb07('0x8a')],'where':_0x2fdff4[_0xfb07('0x48')][_0xfb07('0x8b')]?{'id':_0x2fdff4['query'][_0xfb07('0x8b')]}:undefined,'required':_0x2fdff4[_0xfb07('0x48')][_0xfb07('0x8b')]?!![]:![]}];}return db[_0xfb07('0x81')][_0xfb07('0x59')](_0x262774);})['then'](function(_0x489461){_0x21607a['rows']=_0x489461;return _0x21607a;});}})[_0xfb07('0x23')](respondWithFilteredResult(_0x384608,_0x262774))[_0xfb07('0x17')](handleError(_0x384608,null));};exports['addApplications']=function addApplications(_0x53f1be,_0x2bd8a2){var _0x38d87f=_0x53f1be[_0xfb07('0x5b')]['id'];var _0x4a486c=_0x53f1be['body'];var _0x14f247=0xc8;var _0x554d25=null;return db[_0xfb07('0x8c')][_0xfb07('0x8d')]({'isolationLevel':db['sequelize'][_0xfb07('0x8e')][_0xfb07('0x8f')][_0xfb07('0x90')]},function(_0x5ef0b4){return db[_0xfb07('0x43')][_0xfb07('0x6a')]({'where':{'id':_0x38d87f},'transaction':_0x5ef0b4})['then'](function(_0x5d61dc){if(_0x5d61dc){return db[_0xfb07('0x91')][_0xfb07('0x22')]({'where':{'MailAccountId':_0x38d87f},'transaction':_0x5ef0b4})['then'](function(){var _0x963b7e=_[_0xfb07('0x42')](_0x4a486c,function(_0xe39395){_0xe39395[_0xfb07('0x66')]=_0x38d87f;return _0xe39395;});return db[_0xfb07('0x91')][_0xfb07('0x92')](_0x963b7e,{'transaction':_0x5ef0b4});});}else{_0x14f247=0x194;_0x554d25=[];}});})[_0xfb07('0x23')](function(){if(_0x14f247!==0x194){return db[_0xfb07('0x91')][_0xfb07('0x93')]({'where':{'MailAccountId':_0x38d87f},'order':_0xfb07('0x94')})['then'](function(_0x32f9ee){_0x554d25=_0x32f9ee;});}})[_0xfb07('0x17')](function(_0x41668b){_0x14f247=0x1f4;logger[_0xfb07('0x13')](_0x41668b[_0xfb07('0x27')]);if(_0x41668b['name']){delete _0x41668b[_0xfb07('0x28')];}_0x554d25=_0x41668b;})['finally'](function(){if(_0x554d25===null){_0x2bd8a2['sendStatus'](_0x14f247);}else{if(_0x14f247===0x1f4){_0x2bd8a2[_0xfb07('0x1a')](_0x14f247)[_0xfb07('0x29')](_0x554d25);}else{_0x2bd8a2[_0xfb07('0x1a')](_0x14f247)[_0xfb07('0x1b')](_0x554d25);}}});};exports[_0xfb07('0x95')]=function(_0x185a8a,_0x12d721){var _0x113c7d={};var _0x52af28={};var _0x16f38f;var _0x470b10;return db[_0xfb07('0x43')]['findOne']({'where':{'id':_0x185a8a['params']['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x12d721,null))['then'](function(_0x32da44){if(_0x32da44){_0x16f38f=_0x32da44;_0x52af28[_0xfb07('0x4b')]=_[_0xfb07('0x47')](db['MailApplication'][_0xfb07('0x44')]);_0x52af28[_0xfb07('0x48')]=_['keys'](_0x185a8a[_0xfb07('0x48')]);_0x52af28[_0xfb07('0x49')]=_['intersection'](_0x52af28['model'],_0x52af28['query']);_0x113c7d[_0xfb07('0x4d')]=_['intersection'](_0x52af28[_0xfb07('0x4b')],qs[_0xfb07('0x4c')](_0x185a8a[_0xfb07('0x48')]['fields']));_0x113c7d[_0xfb07('0x4d')]=_0x113c7d['attributes'][_0xfb07('0x5d')]?_0x113c7d['attributes']:_0x52af28[_0xfb07('0x4b')];_0x113c7d[_0xfb07('0x4f')]=qs[_0xfb07('0x50')](_0x185a8a[_0xfb07('0x48')][_0xfb07('0x50')]);_0x113c7d['where']=qs['filters'](_['pick'](_0x185a8a[_0xfb07('0x48')],_0x52af28['filters']));if(_0x185a8a[_0xfb07('0x48')]['filter']){_0x113c7d[_0xfb07('0x54')]=_[_0xfb07('0x53')](_0x113c7d[_0xfb07('0x54')],{'$or':_['map'](_0x113c7d[_0xfb07('0x4d')],function(_0xbd7313){var _0x342452={};_0x342452[_0xbd7313]={'$like':'%'+_0x185a8a[_0xfb07('0x48')][_0xfb07('0x52')]+'%'};return _0x342452;})});}_0x113c7d=_['merge']({},_0x113c7d,_0x185a8a[_0xfb07('0x56')]);return _0x16f38f['getApplications'](_0x113c7d);}})[_0xfb07('0x23')](function(_0x17ce46){if(_0x17ce46){_0x470b10=_0x17ce46[_0xfb07('0x5d')];if(!_0x185a8a[_0xfb07('0x48')][_0xfb07('0x6b')]('nolimit')){_0x113c7d[_0xfb07('0x1d')]=qs[_0xfb07('0x1d')](_0x185a8a[_0xfb07('0x48')][_0xfb07('0x1d')]);_0x113c7d['offset']=qs['offset'](_0x185a8a['query'][_0xfb07('0x1c')]);}return _0x16f38f[_0xfb07('0x95')](_0x113c7d);}})[_0xfb07('0x23')](function(_0x23e28e){if(_0x23e28e){return _0x23e28e?{'count':_0x470b10,'rows':_0x23e28e}:null;}})['then'](respondWithResult(_0x12d721,null))[_0xfb07('0x17')](handleError(_0x12d721,null));};exports[_0xfb07('0x96')]=function(_0x517896,_0x55b4c8){var _0x4f119d={'raw':!![],'where':{}};var _0xc636b8={};var _0x17b7f8={'count':0x0,'rows':[]};return db[_0xfb07('0x43')]['findOne']({'where':{'id':_0x517896[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x55b4c8,null))['then'](function(_0x3dd272){if(_0x3dd272){_0xc636b8[_0xfb07('0x4b')]=_[_0xfb07('0x47')](db[_0xfb07('0x97')]['rawAttributes']);_0xc636b8['query']=_[_0xfb07('0x47')](_0x517896[_0xfb07('0x48')]);_0xc636b8['filters']=_['intersection'](_0xc636b8[_0xfb07('0x4b')],_0xc636b8[_0xfb07('0x48')]);_0x4f119d['attributes']=_[_0xfb07('0x4a')](_0xc636b8[_0xfb07('0x4b')],qs[_0xfb07('0x4c')](_0x517896[_0xfb07('0x48')][_0xfb07('0x4c')]));_0x4f119d[_0xfb07('0x4d')]=_0x4f119d[_0xfb07('0x4d')]['length']?_0x4f119d[_0xfb07('0x4d')]:_0xc636b8[_0xfb07('0x4b')];if(!_0x517896[_0xfb07('0x48')][_0xfb07('0x6b')](_0xfb07('0x4e'))){_0x4f119d[_0xfb07('0x1d')]=qs['limit'](_0x517896[_0xfb07('0x48')][_0xfb07('0x1d')]);_0x4f119d[_0xfb07('0x1c')]=qs[_0xfb07('0x1c')](_0x517896['query'][_0xfb07('0x1c')]);}_0x4f119d[_0xfb07('0x4f')]=qs[_0xfb07('0x50')](_0x517896[_0xfb07('0x48')][_0xfb07('0x50')]);_0x4f119d[_0xfb07('0x54')]=qs[_0xfb07('0x49')](_['pick'](_0x517896['query'],_0xc636b8[_0xfb07('0x49')]));_0x4f119d['where']['MailAccountId']=_0x3dd272['id'];if(_0x517896[_0xfb07('0x48')][_0xfb07('0x52')]){_0x4f119d['where']=_['merge'](_0x4f119d[_0xfb07('0x54')],{'$or':_['map'](_0x4f119d[_0xfb07('0x4d')],function(_0x3cd8f2){var _0x1473e6={};_0x1473e6[_0x3cd8f2]={'$like':'%'+_0x517896[_0xfb07('0x48')][_0xfb07('0x52')]+'%'};return _0x1473e6;})});}if(_0x517896[_0xfb07('0x48')][_0xfb07('0x98')]){var _0x1baaa3=_0x517896[_0xfb07('0x48')][_0xfb07('0x98')]['split'](',');var _0x15355c={};_0x15355c[_0x1baaa3[0x0]]={'$gte':moment(_0x1baaa3[0x1])[_0xfb07('0x99')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4f119d[_0xfb07('0x54')]=_[_0xfb07('0x53')](_0x4f119d['where'],_0x15355c);}_0x4f119d=_[_0xfb07('0x53')]({},_0x4f119d,_0x517896[_0xfb07('0x56')]);return db['MailMessage'][_0xfb07('0x1f')]({'where':_0x4f119d[_0xfb07('0x54')]})['then'](function(_0x5e3a7e){_0x17b7f8['count']=_0x5e3a7e;if(_0x517896[_0xfb07('0x48')][_0xfb07('0x57')]){_0x4f119d[_0xfb07('0x58')]=[{'all':!![]}];}return db[_0xfb07('0x97')][_0xfb07('0x59')](_0x4f119d);})[_0xfb07('0x23')](function(_0x2223b2){if(_0x517896[_0xfb07('0x48')][_0xfb07('0x9a')]===_0xfb07('0x9b')){for(var _0x2719f0=0x0;_0x2719f0<_0x2223b2[_0xfb07('0x5d')];_0x2719f0++){_0x2223b2[_0x2719f0][_0xfb07('0x5f')]=juice(_0x2223b2[_0x2719f0]['body']);}}_0x17b7f8[_0xfb07('0x5a')]=_0x2223b2;return _0x17b7f8;});}})[_0xfb07('0x23')](respondWithFilteredResult(_0x55b4c8,_0x4f119d))['catch'](handleError(_0x55b4c8,null));};exports['send']=function(_0x3c7529,_0x37cc62){var _0x1fa7f8,_0x5bedb9={},_0x151556;if(_0x3c7529['body']['to']){_0x151556=_0x3c7529[_0xfb07('0x5f')]['to'][_0xfb07('0x9c')](',')[0x0];}return db[_0xfb07('0x43')][_0xfb07('0x62')]({'where':{'id':_0x3c7529['params']['id']},'include':[{'model':db[_0xfb07('0x9d')],'as':'List','include':[{'model':db[_0xfb07('0x83')],'as':_0xfb07('0x9e'),'where':{'email':_0x151556},'limit':0x1,'order':[['updatedAt',_0xfb07('0x9f')]]}]},{'model':db['MailServerOut'],'as':_0xfb07('0x3e'),'raw':!![],'include':[{'model':db[_0xfb07('0xa0')],'as':_0xfb07('0xa0'),'raw':!![]}]}]})[_0xfb07('0x23')](handleEntityNotFound(_0x37cc62,null))[_0xfb07('0x23')](function(_0x493a57){if(!_0x493a57)return;_0x1fa7f8=_0x493a57;if(!_0x493a57[_0xfb07('0x3e')])throw new Error(_0xfb07('0xa1'));if(_['isNil'](_0x3c7529[_0xfb07('0x5f')][_0xfb07('0xa2')])){_0x3c7529['body'][_0xfb07('0xa2')]=util[_0xfb07('0x99')](_0xfb07('0xa3'),_0x493a57[_0xfb07('0x28')],_0x493a57[_0xfb07('0xa4')]||_0x493a57['Smtp'][_0xfb07('0x33')]);}if(_0x3c7529[_0xfb07('0x5f')][_0xfb07('0xa5')]&&_0x3c7529[_0xfb07('0x5f')][_0xfb07('0xa5')][_0xfb07('0x5d')]){for(var _0x39bc11=0x0;_0x39bc11<_0x3c7529['body'][_0xfb07('0xa5')][_0xfb07('0x5d')];_0x39bc11+=0x1){_0x3c7529['body'][_0xfb07('0xa5')][_0x39bc11]={'filename':_0x3c7529['body'][_0xfb07('0xa5')][_0x39bc11][_0xfb07('0x28')],'path':path[_0xfb07('0xa6')](config['root'],_0xfb07('0xa7'),_0x3c7529[_0xfb07('0x5f')][_0xfb07('0xa5')][_0x39bc11]['basename'])};}}var _0x59f64c=_0x493a57['getSmtpOptions']();return respondWithRpcPromise(_0xfb07('0xa8'),_0xfb07('0xa9'),{'account':_0x59f64c,'message':_0x3c7529['body']});})[_0xfb07('0x23')](function(_0x253d84){if(!_0x253d84)return;_0x5bedb9=_0x253d84;if(!_0x1fa7f8['List'])throw new Error(_0xfb07('0xaa'));if(_0x1fa7f8['List']['Contacts'][_0xfb07('0x5d')])return _0x1fa7f8[_0xfb07('0xab')][_0xfb07('0x9e')][0x0];return db[_0xfb07('0x83')]['create'](_[_0xfb07('0x8')](_0x3c7529[_0xfb07('0x5f')],{'firstName':_0x3c7529['body']['to'],'email':_0x3c7529[_0xfb07('0x5f')]['to'],'phone':_0x3c7529['body']['to'],'ListId':_0x1fa7f8[_0xfb07('0x71')]}));})[_0xfb07('0x23')](function(_0x43711c){if(!_0x43711c)return;var _0x349c87={'UserId':_0x3c7529['user']['id'],'ContactId':_0x43711c['id'],'MailAccountId':_0x1fa7f8['id'],'inReplyTo':_0x5bedb9[_0xfb07('0xac')],'to':_0x3c7529['body']['from'],'cc':_0x3c7529[_0xfb07('0x5f')]['cc'],'subject':_0x3c7529[_0xfb07('0x5f')]['subject'],'attach':_0x3c7529[_0xfb07('0x5f')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xfb07('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xfb07('0xad'),'Messages':[_['merge'](_0x3c7529[_0xfb07('0x5f')],{'messageId':_0x5bedb9[_0xfb07('0xac')],'sentAt':moment()[_0xfb07('0x99')](_0xfb07('0xae')),'read':!![],'MailAccountId':_0x1fa7f8['id'],'UserId':_0x3c7529[_0xfb07('0x33')]['id'],'ContactId':_0x43711c['id']})]};if(_0x3c7529[_0xfb07('0x5f')][_0xfb07('0xaf')]){_0x349c87=_[_0xfb07('0x53')](_0x349c87,_0x3c7529[_0xfb07('0x5f')]['Interaction']);}return db['MailInteraction'][_0xfb07('0x68')](_0x349c87,{'include':[{'model':db[_0xfb07('0x97')],'as':_0xfb07('0xb0')}]});})[_0xfb07('0x23')](respondWithResult(_0x37cc62,null))[_0xfb07('0x17')](handleError(_0x37cc62,null));};exports[_0xfb07('0xb1')]=function(_0x251d6a,_0x2c2567){return db[_0xfb07('0x43')][_0xfb07('0x62')]({'where':{'id':_0x251d6a['params']['id']},'include':[{'model':db[_0xfb07('0x5c')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xfb07('0xa0')],'as':_0xfb07('0xa0'),'raw':!![]}]}]})[_0xfb07('0x23')](handleEntityNotFound(_0x2c2567,null))[_0xfb07('0x23')](function(_0x31155b){if(!_0x31155b[_0xfb07('0x3e')])return;var _0x42449a=_0x31155b[_0xfb07('0xb2')]();return respondWithRpcPromise(_0xfb07('0xb3'),_0xfb07('0xb1'),{'account':_0x42449a});})[_0xfb07('0x23')](respondWithResult(_0x2c2567,null))[_0xfb07('0x17')](handleError(_0x2c2567,null));};exports['destroy']=function(_0x12ef36,_0x3628b2){return db[_0xfb07('0x43')][_0xfb07('0x62')]({'where':{'id':_0x12ef36[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x3628b2,null))[_0xfb07('0x23')](function(_0x379c5a){if(_0x379c5a&&_0x379c5a['service']){throw new db[(_0xfb07('0xb4'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x379c5a;})['then'](removeEntity(_0x3628b2,null))[_0xfb07('0x17')](handleError(_0x3628b2,null));};exports[_0xfb07('0xb5')]=function(_0x1699a7,_0x3c2b45){return db['MailAccount']['find']({'where':{'id':_0x1699a7[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x3c2b45,null))['then'](function(_0x2d5674){if(_0x2d5674){return _0x2d5674[_0xfb07('0xb5')](_0x1699a7[_0xfb07('0x5f')][_0xfb07('0x6d')],_[_0xfb07('0xb6')](_0x1699a7['body'],['ids','id'])||{})[_0xfb07('0xb7')](function(_0x5d62f8){for(var _0x461f3b=0x0;_0x461f3b<_0x1699a7[_0xfb07('0x5f')]['ids'][_0xfb07('0x5d')];_0x461f3b+=0x1){socket[_0xfb07('0xb8')]('userMailAccount:save',{'UserId':Number(_0x1699a7[_0xfb07('0x5f')][_0xfb07('0x6d')][_0x461f3b]),'MailAccountId':Number(_0x1699a7['params']['id'])});}return _0x5d62f8;});}})['then'](respondWithResult(_0x3c2b45,null))[_0xfb07('0x17')](handleError(_0x3c2b45,null));};exports[_0xfb07('0xb9')]=function(_0x56d96c,_0x384f96){return db[_0xfb07('0x43')][_0xfb07('0x62')]({'where':{'id':_0x56d96c[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x384f96,null))['then'](function(_0x257886){if(_0x257886){return _0x257886[_0xfb07('0xb9')](_0x56d96c['query']['ids'])['then'](function(){if(_[_0xfb07('0xba')](_0x56d96c[_0xfb07('0x48')]['ids'])){for(var _0x5d0d75=0x0;_0x5d0d75<_0x56d96c[_0xfb07('0x48')][_0xfb07('0x6d')][_0xfb07('0x5d')];_0x5d0d75+=0x1){socket[_0xfb07('0xb8')](_0xfb07('0xbb'),{'UserId':Number(_0x56d96c['query'][_0xfb07('0x6d')][_0x5d0d75]),'MailAccountId':Number(_0x56d96c[_0xfb07('0x5b')]['id'])});}}else{socket[_0xfb07('0xb8')](_0xfb07('0xbb'),{'UserId':Number(_0x56d96c[_0xfb07('0x48')][_0xfb07('0x6d')]),'MailAccountId':Number(_0x56d96c['params']['id'])});}});}})[_0xfb07('0x23')](respondWithStatusCode(_0x384f96,null))['catch'](handleError(_0x384f96,null));};exports[_0xfb07('0xbc')]=function(_0x3436bb,_0x39d9eb){var _0x37184c={};var _0x3337a8={};var _0x3d269e;var _0x2507f5;return db[_0xfb07('0x43')][_0xfb07('0x6a')]({'where':{'id':_0x3436bb[_0xfb07('0x5b')]['id']}})[_0xfb07('0x23')](handleEntityNotFound(_0x39d9eb,null))[_0xfb07('0x23')](function(_0x1f8964){if(_0x1f8964){_0x3d269e=_0x1f8964;_0x3337a8[_0xfb07('0x4b')]=_[_0xfb07('0x47')](db[_0xfb07('0xbd')][_0xfb07('0x44')]);_0x3337a8['query']=_[_0xfb07('0x47')](_0x3436bb[_0xfb07('0x48')]);_0x3337a8[_0xfb07('0x49')]=_['intersection'](_0x3337a8[_0xfb07('0x4b')],_0x3337a8[_0xfb07('0x48')]);_0x37184c[_0xfb07('0x4d')]=_[_0xfb07('0x4a')](_0x3337a8[_0xfb07('0x4b')],qs[_0xfb07('0x4c')](_0x3436bb['query'][_0xfb07('0x4c')]));_0x37184c[_0xfb07('0x4d')]=_0x37184c['attributes'][_0xfb07('0x5d')]?_0x37184c[_0xfb07('0x4d')]:_0x3337a8[_0xfb07('0x4b')];_0x37184c[_0xfb07('0x4f')]=qs['sort'](_0x3436bb[_0xfb07('0x48')][_0xfb07('0x50')]);_0x37184c[_0xfb07('0x54')]=qs[_0xfb07('0x49')](_[_0xfb07('0x51')](_0x3436bb['query'],_0x3337a8['filters']));if(_0x3436bb[_0xfb07('0x48')][_0xfb07('0x52')]){_0x37184c[_0xfb07('0x54')]=_[_0xfb07('0x53')](_0x37184c['where'],{'$or':_[_0xfb07('0x42')](_0x37184c['attributes'],function(_0x524c8d){var _0x1f25a1={};_0x1f25a1[_0x524c8d]={'$like':'%'+_0x3436bb['query'][_0xfb07('0x52')]+'%'};return _0x1f25a1;})});}_0x37184c=_['merge']({},_0x37184c,_0x3436bb[_0xfb07('0x56')]);return _0x3d269e[_0xfb07('0xbc')](_0x37184c);}})[_0xfb07('0x23')](function(_0x475217){if(_0x475217){_0x2507f5=_0x475217[_0xfb07('0x5d')];if(!_0x3436bb[_0xfb07('0x48')][_0xfb07('0x6b')](_0xfb07('0x4e'))){_0x37184c[_0xfb07('0x1d')]=qs[_0xfb07('0x1d')](_0x3436bb[_0xfb07('0x48')]['limit']);_0x37184c['offset']=qs[_0xfb07('0x1c')](_0x3436bb[_0xfb07('0x48')]['offset']);}return _0x3d269e['getAgents'](_0x37184c);}})[_0xfb07('0x23')](function(_0xa7b604){if(_0xa7b604){return _0xa7b604?{'count':_0x2507f5,'rows':_0xa7b604}:null;}})['then'](respondWithResult(_0x39d9eb,null))[_0xfb07('0x17')](handleError(_0x39d9eb,null));}; \ No newline at end of file +var _0xe733=['getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','%s\x20<%s>','email','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','List','List\x20not\x20found','messageId','from','subject','out','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','isArray','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','MailAccounts','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','user','password','pass','CloudProviderId','host','port','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','MailAccount','includeAll','include','findAll','rows','params','find','body','provider','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','nolimit','pick','Disposition','removeDispositions','ids','CannedAnswer','removeAnswers','custom','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap'];(function(_0x344539,_0x564660){var _0x268ad8=function(_0x57aafa){while(--_0x57aafa){_0x344539['push'](_0x344539['shift']());}};_0x268ad8(++_0x564660);}(_0xe733,0x1b7));var _0x3e73=function(_0x4fc4c5,_0x58cefa){_0x4fc4c5=_0x4fc4c5-0x0;var _0x35873c=_0xe733[_0x4fc4c5];return _0x35873c;};'use strict';var moment=require(_0x3e73('0x0'));var BPromise=require(_0x3e73('0x1'));var util=require('util');var path=require(_0x3e73('0x2'));var _=require(_0x3e73('0x3'));var juice=require(_0x3e73('0x4'));var Redis=require(_0x3e73('0x5'));var qs=require(_0x3e73('0x6'));var logger=require(_0x3e73('0x7'))('api');var config=require(_0x3e73('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3e73('0x9')](config[_0x3e73('0xa')],{'host':_0x3e73('0xb'),'port':0x18eb});var socket=require(_0x3e73('0xc'))(new Redis(config[_0x3e73('0xa')]));require(_0x3e73('0xd'))[_0x3e73('0xe')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x3e73('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x4da14f,_0x283069,_0x2f5a11,_0x4f6d6f){return new BPromise(function(_0x18d3b2,_0x339ec6){var _0x4bcb61=_0x4f6d6f||client;return _0x4bcb61[_0x3e73('0x10')](_0x4da14f,_0x2f5a11)[_0x3e73('0x11')](function(_0x2e02bc){logger[_0x3e73('0x12')](_0x3e73('0x13'),_0x283069,_0x3e73('0x14'));logger[_0x3e73('0x15')](_0x3e73('0x16'),_0x283069,_0x3e73('0x14'),JSON[_0x3e73('0x17')](_0x2e02bc));if(_0x2e02bc[_0x3e73('0x18')]){if(_0x2e02bc[_0x3e73('0x18')][_0x3e73('0x19')]===0x1f4){logger[_0x3e73('0x18')](_0x3e73('0x13'),_0x283069,_0x2e02bc['error'][_0x3e73('0x1a')]);return _0x339ec6(_0x2e02bc['error'][_0x3e73('0x1a')]);}logger[_0x3e73('0x18')](_0x3e73('0x13'),_0x283069,_0x2e02bc['error']['message']);return _0x18d3b2(_0x2e02bc[_0x3e73('0x18')][_0x3e73('0x1a')]);}else{logger[_0x3e73('0x12')]('MailAccount,\x20%s,\x20%s',_0x283069,_0x3e73('0x14'));_0x18d3b2(_0x2e02bc['result'][_0x3e73('0x1a')]);}})[_0x3e73('0x1b')](function(_0x1bd384){logger[_0x3e73('0x18')]('MailAccount,\x20%s,\x20%s',_0x283069,_0x1bd384);_0x339ec6(_0x1bd384);});});}function respondWithStatusCode(_0x24b9e3,_0x30bbff){_0x30bbff=_0x30bbff||0xcc;return function(_0x3cbe62){if(_0x3cbe62){return _0x24b9e3[_0x3e73('0x1c')](_0x30bbff);}return _0x24b9e3[_0x3e73('0x1d')](_0x30bbff)[_0x3e73('0x1e')]();};}function respondWithResult(_0x39122e,_0x302ce8){_0x302ce8=_0x302ce8||0xc8;return function(_0x3581cc){if(_0x3581cc){return _0x39122e[_0x3e73('0x1d')](_0x302ce8)[_0x3e73('0x1f')](_0x3581cc);}};}function respondWithFilteredResult(_0x2a8763,_0x37acd8){return function(_0x15069a){if(_0x15069a){var _0xe8aa95=typeof _0x37acd8[_0x3e73('0x20')]===_0x3e73('0x21')&&typeof _0x37acd8[_0x3e73('0x22')]===_0x3e73('0x21');var _0x14593a=_0x15069a['count'];var _0x10be35=_0xe8aa95?0x0:_0x37acd8[_0x3e73('0x20')];var _0x5493c5=_0xe8aa95?_0x15069a[_0x3e73('0x23')]:_0x37acd8[_0x3e73('0x20')]+_0x37acd8['limit'];var _0x3ad559;if(_0x5493c5>=_0x14593a){_0x5493c5=_0x14593a;_0x3ad559=0xc8;}else{_0x3ad559=0xce;}_0x2a8763[_0x3e73('0x1d')](_0x3ad559);return _0x2a8763[_0x3e73('0x24')]('Content-Range',_0x10be35+'-'+_0x5493c5+'/'+_0x14593a)[_0x3e73('0x1f')](_0x15069a);}return null;};}function saveUpdates(_0x4736){return function(_0x235ec3){if(_0x235ec3){return _0x235ec3[_0x3e73('0x25')](_0x4736)['then'](function(_0x6ef1da){return _0x6ef1da;});}return null;};}function removeEntity(_0x123a2e){return function(_0x126a2c){if(_0x126a2c){return _0x126a2c[_0x3e73('0x26')]()['then'](function(){var _0x2431bc=_0x126a2c['get']({'plain':!![]});var _0x4a8670=_0x3e73('0x27');return db[_0x3e73('0x28')][_0x3e73('0x26')]({'where':{'type':_0x4a8670,'resourceId':_0x2431bc['id']}})[_0x3e73('0x11')](function(){return _0x126a2c;});})[_0x3e73('0x11')](function(){_0x123a2e[_0x3e73('0x1d')](0xcc)[_0x3e73('0x1e')]();});}};}function handleEntityNotFound(_0x53c1a4){return function(_0x1db2f4){if(!_0x1db2f4){_0x53c1a4[_0x3e73('0x1c')](0x194);}return _0x1db2f4;};}function handleError(_0x34caed,_0x3a820f){_0x3a820f=_0x3a820f||0x1f4;return function(_0x38993c){logger[_0x3e73('0x18')](_0x38993c[_0x3e73('0x29')]);if(_0x38993c['name']){delete _0x38993c[_0x3e73('0x2a')];}_0x34caed[_0x3e73('0x1d')](_0x3a820f)[_0x3e73('0x2b')](_0x38993c);};}function getImapHost(_0x273438){switch(_0x273438){case'gmail':return _0x3e73('0x2c');case _0x3e73('0x2d'):return _0x3e73('0x2e');case'hotmail':return _0x3e73('0x2f');case _0x3e73('0x30'):return'outlook.office365.com';}throw new Error(_0x3e73('0x31'),_0x273438);}function getSmtpHost(_0x11a210){switch(_0x11a210){case _0x3e73('0x32'):return _0x3e73('0x33');case _0x3e73('0x2d'):return _0x3e73('0x34');case _0x3e73('0x35'):return'smtp-mail.outlook.com';case'outlook365':return'smtp.office365.com';}throw new Error(_0x3e73('0x31'),_0x11a210);}function getAuthenticationOptions(_0x4e540c,_0x253576){var _0x52f163={};var _0x3569ad={};if(_0x4e540c){_0x52f163['user']=_0x3569ad[_0x3e73('0x36')]=_0x253576['username'];_0x52f163[_0x3e73('0x37')]=_0x3569ad[_0x3e73('0x38')]=_0x253576['password'];if(_0x253576['modernAuthentication']){_0x52f163['modernAuthentication']=_0x3569ad['modernAuthentication']=!![];_0x52f163[_0x3e73('0x39')]=_0x3569ad['CloudProviderId']=_0x253576[_0x3e73('0x39')];_0x52f163[_0x3e73('0x37')]=_0x3569ad[_0x3e73('0x38')]=null;}else{_0x52f163[_0x3e73('0x39')]=_0x3569ad[_0x3e73('0x39')]=null;}_0x52f163[_0x3e73('0x3a')]=getImapHost(_0x4e540c);_0x52f163['port']=0x3e1;_0x3569ad[_0x3e73('0x3a')]=getSmtpHost(_0x4e540c);_0x3569ad[_0x3e73('0x3b')]=0x24b;_0x3569ad['secure']=![];_0x52f163[_0x3e73('0x3c')]=_0x3569ad['service']=null;}else{if(_0x253576[_0x3e73('0x3d')]){_0x52f163[_0x3e73('0x36')]=_0x3569ad[_0x3e73('0x36')]=_0x253576['username'];_0x52f163[_0x3e73('0x37')]=_0x3569ad[_0x3e73('0x38')]=_0x253576[_0x3e73('0x37')];}else{_0x52f163[_0x3e73('0x3d')]=_0x3569ad['authentication']=![];_0x52f163['user']=_0x3569ad[_0x3e73('0x36')]=null;_0x52f163[_0x3e73('0x37')]=_0x3569ad[_0x3e73('0x38')]=null;}_0x52f163[_0x3e73('0x3a')]=_0x253576[_0x3e73('0x3e')]['host'];_0x52f163[_0x3e73('0x3b')]=_0x253576['Imap'][_0x3e73('0x3b')];_0x3569ad[_0x3e73('0x3a')]=_0x253576[_0x3e73('0x3f')]['host'];_0x3569ad['port']=_0x253576[_0x3e73('0x3f')]['port'];}return{'Imap':_0x52f163,'Smtp':_0x3569ad};}exports['index']=function(_0x2f2267,_0x347dde){var _0x2b8e3d={'include':[{'model':db[_0x3e73('0x40')],'as':_0x3e73('0x3e')},{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f')},{'model':db[_0x3e73('0x42')],'as':_0x3e73('0x43')}]},_0x50cb43={},_0x5b0479={'count':0x0,'rows':[]};var _0x306fb4=_[_0x3e73('0x44')](db['MailAccount'][_0x3e73('0x45')],function(_0x131b1d){return{'name':_0x131b1d[_0x3e73('0x46')],'type':_0x131b1d[_0x3e73('0x47')][_0x3e73('0x48')]};});_0x50cb43[_0x3e73('0x49')]=_[_0x3e73('0x44')](_0x306fb4,'name');_0x50cb43[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x2f2267['query']);_0x50cb43['filters']=_[_0x3e73('0x4c')](_0x50cb43[_0x3e73('0x49')],_0x50cb43[_0x3e73('0x4a')]);_0x2b8e3d[_0x3e73('0x4d')]=_['intersection'](_0x50cb43[_0x3e73('0x49')],qs[_0x3e73('0x4e')](_0x2f2267[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x2b8e3d['attributes']=_0x2b8e3d[_0x3e73('0x4d')][_0x3e73('0x4f')]?_0x2b8e3d[_0x3e73('0x4d')]:_0x50cb43[_0x3e73('0x49')];if(!_0x2f2267[_0x3e73('0x4a')][_0x3e73('0x50')]('nolimit')){_0x2b8e3d[_0x3e73('0x22')]=qs[_0x3e73('0x22')](_0x2f2267['query'][_0x3e73('0x22')]);_0x2b8e3d[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0x2f2267[_0x3e73('0x4a')]['offset']);}_0x2b8e3d[_0x3e73('0x51')]=qs[_0x3e73('0x52')](_0x2f2267[_0x3e73('0x4a')]['sort']);_0x2b8e3d[_0x3e73('0x53')]=qs['filters'](_['pick'](_0x2f2267[_0x3e73('0x4a')],_0x50cb43[_0x3e73('0x54')]),_0x306fb4);if(_0x2f2267[_0x3e73('0x4a')][_0x3e73('0x55')]){_0x2b8e3d[_0x3e73('0x53')]=_['merge'](_0x2b8e3d['where'],{'$or':_[_0x3e73('0x44')](_0x306fb4,function(_0x412bf2){if(_0x412bf2[_0x3e73('0x47')]!==_0x3e73('0x56')){var _0x963612={};_0x963612[_0x412bf2[_0x3e73('0x2a')]]={'$like':'%'+_0x2f2267['query'][_0x3e73('0x55')]+'%'};return _0x963612;}})});}_0x2b8e3d=_[_0x3e73('0x57')]({},_0x2b8e3d,_0x2f2267[_0x3e73('0x58')]);var _0x52f9c9={'where':_0x2b8e3d[_0x3e73('0x53')]};return db[_0x3e73('0x59')]['count'](_0x52f9c9)[_0x3e73('0x11')](function(_0x2a843e){_0x5b0479[_0x3e73('0x23')]=_0x2a843e;if(_0x2f2267[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x2b8e3d[_0x3e73('0x5b')]=[{'all':!![]}];}return db[_0x3e73('0x59')][_0x3e73('0x5c')](_0x2b8e3d);})[_0x3e73('0x11')](function(_0x2a3324){_0x5b0479[_0x3e73('0x5d')]=_0x2a3324;return _0x5b0479;})[_0x3e73('0x11')](respondWithFilteredResult(_0x347dde,_0x2b8e3d))[_0x3e73('0x1b')](handleError(_0x347dde,null));};exports['show']=function(_0xee1ea9,_0x45068a){var _0x140109={'raw':![],'where':{'id':_0xee1ea9[_0x3e73('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x3e73('0x3e')},{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f')},{'model':db[_0x3e73('0x42')],'as':'mandatoryDispositionPause'}]},_0x22e5fd={};_0x22e5fd[_0x3e73('0x49')]=_['keys'](db['MailAccount'][_0x3e73('0x45')]);_0x22e5fd[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0xee1ea9[_0x3e73('0x4a')]);_0x22e5fd['filters']=_[_0x3e73('0x4c')](_0x22e5fd[_0x3e73('0x49')],_0x22e5fd['query']);_0x140109[_0x3e73('0x4d')]=_[_0x3e73('0x4c')](_0x22e5fd[_0x3e73('0x49')],qs[_0x3e73('0x4e')](_0xee1ea9[_0x3e73('0x4a')]['fields']));_0x140109[_0x3e73('0x4d')]=_0x140109['attributes'][_0x3e73('0x4f')]?_0x140109[_0x3e73('0x4d')]:_0x22e5fd[_0x3e73('0x49')];if(_0xee1ea9[_0x3e73('0x4a')]['includeAll']){_0x140109['include']=[{'all':!![]}];}_0x140109=_[_0x3e73('0x57')]({},_0x140109,_0xee1ea9['options']);return db['MailAccount'][_0x3e73('0x5f')](_0x140109)[_0x3e73('0x11')](handleEntityNotFound(_0x45068a,null))[_0x3e73('0x11')](respondWithResult(_0x45068a,null))[_0x3e73('0x1b')](handleError(_0x45068a,null));};exports['update']=function(_0x4807bc,_0x5252d9){if(_0x4807bc[_0x3e73('0x60')]['id']){delete _0x4807bc[_0x3e73('0x60')]['id'];}var _0xa577af=_0x4807bc[_0x3e73('0x60')]['provider']==='custom'?null:_0x4807bc['body'][_0x3e73('0x61')];var _0x18b384=_0x4807bc[_0x3e73('0x60')][_0x3e73('0x3e')]||{};var _0x1b34e5=_0x4807bc['body'][_0x3e73('0x3f')]||{};if(_0xa577af){_0x18b384[_0x3e73('0x3a')]=getImapHost(_0xa577af);_0x18b384[_0x3e73('0x3b')]=0x3e1;_0x1b34e5[_0x3e73('0x3a')]=getSmtpHost(_0xa577af);_0x1b34e5[_0x3e73('0x3b')]=0x24b;_0x1b34e5[_0x3e73('0x62')]=![];}if(_0x1b34e5['modernAuthentication']){_0x1b34e5['secure']=![];}else{_0x1b34e5[_0x3e73('0x39')]=null;}if(!_0x18b384['modernAuthentication'])_0x18b384['CloudProviderId']=null;_0x4807bc[_0x3e73('0x60')][_0x3e73('0x3e')]=_0x18b384;_0x4807bc[_0x3e73('0x60')][_0x3e73('0x3f')]=_0x1b34e5;return db['MailAccount'][_0x3e73('0x5f')]({'where':{'id':_0x4807bc[_0x3e73('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x3e73('0x3e')},{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f')},{'model':db[_0x3e73('0x42')],'as':_0x3e73('0x43')}]})[_0x3e73('0x11')](handleEntityNotFound(_0x5252d9,null))[_0x3e73('0x11')](function(_0x2077eb){if(!_0x2077eb)throw new Error(_0x3e73('0x63'));if(_0x2077eb[_0x3e73('0x3c')])delete _0x4807bc[_0x3e73('0x60')]['Imap'];return _0x2077eb;})[_0x3e73('0x11')](saveUpdates(_0x4807bc[_0x3e73('0x60')],null))[_0x3e73('0x11')](function(_0x408f17){if(!_0x4807bc['body'][_0x3e73('0x3e')])return _0x408f17;return db[_0x3e73('0x40')][_0x3e73('0x25')](_0x4807bc['body'][_0x3e73('0x3e')],{'where':{'MailAccountId':_0x408f17['id']}})[_0x3e73('0x11')](function(){return _0x408f17;});})['then'](function(_0x42ef03){if(!_0x4807bc['body']['Smtp'])return _0x42ef03;return db[_0x3e73('0x41')][_0x3e73('0x25')](_0x4807bc['body']['Smtp'],{'where':{'MailAccountId':_0x42ef03['id']}})[_0x3e73('0x11')](function(){return _0x42ef03;});})[_0x3e73('0x11')](respondWithResult(_0x5252d9,null))[_0x3e73('0x1b')](handleError(_0x5252d9,null));};exports[_0x3e73('0x64')]=function(_0x2e6463,_0xdb1c7d){return db[_0x3e73('0x59')]['describe']()['then'](respondWithResult(_0xdb1c7d,null))['catch'](handleError(_0xdb1c7d,null));};exports[_0x3e73('0x65')]=function(_0x23f85e,_0x3ebcc9){if(_0x23f85e['body']['id']){delete _0x23f85e['body']['id'];}return db['MailAccount'][_0x3e73('0x5f')]({'where':{'id':_0x23f85e['params']['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x3ebcc9,null))[_0x3e73('0x11')](function(_0x47e3a2){if(_0x47e3a2){_0x23f85e[_0x3e73('0x60')][_0x3e73('0x66')]=_0x47e3a2['id'];return db['Disposition'][_0x3e73('0x67')](_0x23f85e[_0x3e73('0x60')]);}})[_0x3e73('0x11')](respondWithResult(_0x3ebcc9,null))['catch'](handleError(_0x3ebcc9,null));};exports[_0x3e73('0x68')]=function(_0x5cf7c5,_0x17c1d1){var _0x3cf2bf={'raw':![],'where':{}};var _0x259e55={};var _0x30c23d={'count':0x0,'rows':[]};return db['MailAccount'][_0x3e73('0x69')]({'where':{'id':_0x5cf7c5['params']['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x17c1d1,null))[_0x3e73('0x11')](function(_0x39af16){if(_0x39af16){_0x259e55[_0x3e73('0x49')]=_[_0x3e73('0x4b')](db['Disposition'][_0x3e73('0x45')]);_0x259e55[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x5cf7c5[_0x3e73('0x4a')]);_0x259e55[_0x3e73('0x54')]=_['intersection'](_0x259e55[_0x3e73('0x49')],_0x259e55[_0x3e73('0x4a')]);_0x3cf2bf['attributes']=_['intersection'](_0x259e55['model'],qs['fields'](_0x5cf7c5[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x3cf2bf[_0x3e73('0x4d')]=_0x3cf2bf[_0x3e73('0x4d')][_0x3e73('0x4f')]?_0x3cf2bf[_0x3e73('0x4d')]:_0x259e55['model'];if(!_0x5cf7c5[_0x3e73('0x4a')]['hasOwnProperty'](_0x3e73('0x6a'))){_0x3cf2bf[_0x3e73('0x22')]=qs[_0x3e73('0x22')](_0x5cf7c5['query'][_0x3e73('0x22')]);_0x3cf2bf[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0x5cf7c5[_0x3e73('0x4a')][_0x3e73('0x20')]);}_0x3cf2bf[_0x3e73('0x51')]=qs[_0x3e73('0x52')](_0x5cf7c5[_0x3e73('0x4a')]['sort']);_0x3cf2bf['where']=qs[_0x3e73('0x54')](_[_0x3e73('0x6b')](_0x5cf7c5[_0x3e73('0x4a')],_0x259e55['filters']));_0x3cf2bf[_0x3e73('0x53')][_0x3e73('0x66')]=_0x39af16['id'];if(_0x5cf7c5['query']['filter']){_0x3cf2bf[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x3cf2bf[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x3cf2bf['attributes'],function(_0x11b9b0){var _0xc552d9={};_0xc552d9[_0x11b9b0]={'$like':'%'+_0x5cf7c5[_0x3e73('0x4a')]['filter']+'%'};return _0xc552d9;})});}_0x3cf2bf=_[_0x3e73('0x57')]({},_0x3cf2bf,_0x5cf7c5[_0x3e73('0x58')]);return db['Disposition']['count']({'where':_0x3cf2bf[_0x3e73('0x53')]})[_0x3e73('0x11')](function(_0x1b475f){_0x30c23d[_0x3e73('0x23')]=_0x1b475f;if(_0x5cf7c5[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x3cf2bf[_0x3e73('0x5b')]=[{'all':!![]}];}return db[_0x3e73('0x6c')][_0x3e73('0x5c')](_0x3cf2bf);})['then'](function(_0x49f53d){_0x30c23d[_0x3e73('0x5d')]=_0x49f53d;return _0x30c23d;});}})[_0x3e73('0x11')](respondWithFilteredResult(_0x17c1d1,_0x3cf2bf))['catch'](handleError(_0x17c1d1,null));};exports[_0x3e73('0x6d')]=function(_0x4237d3,_0x218679){return db[_0x3e73('0x59')][_0x3e73('0x5f')]({'where':{'id':_0x4237d3[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x218679,null))[_0x3e73('0x11')](function(_0x1bde27){if(_0x1bde27){return _0x1bde27[_0x3e73('0x6d')](_0x4237d3[_0x3e73('0x4a')][_0x3e73('0x6e')]);}})[_0x3e73('0x11')](respondWithStatusCode(_0x218679,null))[_0x3e73('0x1b')](handleError(_0x218679,null));};exports['addAnswer']=function(_0x487d0c,_0x5c0e0f){if(_0x487d0c[_0x3e73('0x60')]['id']){delete _0x487d0c[_0x3e73('0x60')]['id'];}return db[_0x3e73('0x59')][_0x3e73('0x5f')]({'where':{'id':_0x487d0c[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5c0e0f,null))[_0x3e73('0x11')](function(_0x2e389f){if(_0x2e389f){_0x487d0c[_0x3e73('0x60')][_0x3e73('0x66')]=_0x2e389f['id'];return db['CannedAnswer']['create'](_0x487d0c[_0x3e73('0x60')]);}})[_0x3e73('0x11')](respondWithResult(_0x5c0e0f,null))[_0x3e73('0x1b')](handleError(_0x5c0e0f,null));};exports['getAnswers']=function(_0xbe96b6,_0x525c67){var _0x2b885c={'raw':![],'where':{}};var _0x6e6d85={};var _0x1c71a7={'count':0x0,'rows':[]};return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0xbe96b6[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x525c67,null))[_0x3e73('0x11')](function(_0x36a5ac){if(_0x36a5ac){_0x6e6d85['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x6e6d85[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0xbe96b6[_0x3e73('0x4a')]);_0x6e6d85['filters']=_[_0x3e73('0x4c')](_0x6e6d85[_0x3e73('0x49')],_0x6e6d85['query']);_0x2b885c[_0x3e73('0x4d')]=_[_0x3e73('0x4c')](_0x6e6d85[_0x3e73('0x49')],qs['fields'](_0xbe96b6['query'][_0x3e73('0x4e')]));_0x2b885c[_0x3e73('0x4d')]=_0x2b885c[_0x3e73('0x4d')]['length']?_0x2b885c[_0x3e73('0x4d')]:_0x6e6d85['model'];if(!_0xbe96b6['query'][_0x3e73('0x50')](_0x3e73('0x6a'))){_0x2b885c[_0x3e73('0x22')]=qs['limit'](_0xbe96b6['query'][_0x3e73('0x22')]);_0x2b885c[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0xbe96b6[_0x3e73('0x4a')][_0x3e73('0x20')]);}_0x2b885c['order']=qs[_0x3e73('0x52')](_0xbe96b6[_0x3e73('0x4a')]['sort']);_0x2b885c['where']=qs[_0x3e73('0x54')](_['pick'](_0xbe96b6['query'],_0x6e6d85[_0x3e73('0x54')]));_0x2b885c['where'][_0x3e73('0x66')]=_0x36a5ac['id'];if(_0xbe96b6[_0x3e73('0x4a')]['filter']){_0x2b885c[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x2b885c[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x2b885c['attributes'],function(_0x410f58){var _0x37c1bd={};_0x37c1bd[_0x410f58]={'$like':'%'+_0xbe96b6[_0x3e73('0x4a')]['filter']+'%'};return _0x37c1bd;})});}_0x2b885c=_[_0x3e73('0x57')]({},_0x2b885c,_0xbe96b6[_0x3e73('0x58')]);return db['CannedAnswer'][_0x3e73('0x23')]({'where':_0x2b885c[_0x3e73('0x53')]})[_0x3e73('0x11')](function(_0x3b1e9a){_0x1c71a7[_0x3e73('0x23')]=_0x3b1e9a;if(_0xbe96b6[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x2b885c['include']=[{'all':!![]}];}return db[_0x3e73('0x6f')][_0x3e73('0x5c')](_0x2b885c);})[_0x3e73('0x11')](function(_0x232e05){_0x1c71a7[_0x3e73('0x5d')]=_0x232e05;return _0x1c71a7;});}})[_0x3e73('0x11')](respondWithFilteredResult(_0x525c67,_0x2b885c))[_0x3e73('0x1b')](handleError(_0x525c67,null));};exports['removeAnswers']=function(_0x4f55cc,_0x48dd20){return db['MailAccount']['find']({'where':{'id':_0x4f55cc[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x48dd20,null))[_0x3e73('0x11')](function(_0xa979f6){if(_0xa979f6){return _0xa979f6[_0x3e73('0x70')](_0x4f55cc[_0x3e73('0x4a')]['ids']);}})[_0x3e73('0x11')](respondWithStatusCode(_0x48dd20,null))['catch'](handleError(_0x48dd20,null));};exports[_0x3e73('0x67')]=function(_0x266ca8,_0x366a98){var _0x4e9744={'name':_0x266ca8[_0x3e73('0x60')]['name'],'key':_0x266ca8['body']['key'],'provider':_0x266ca8[_0x3e73('0x60')]['provider']===_0x3e73('0x71')?null:_0x266ca8[_0x3e73('0x60')][_0x3e73('0x61')],'email':_0x266ca8[_0x3e73('0x60')]['email'],'ListId':_0x266ca8[_0x3e73('0x60')][_0x3e73('0x72')],'active':!_[_0x3e73('0x73')](_0x266ca8[_0x3e73('0x60')]['active'])?_0x266ca8[_0x3e73('0x60')][_0x3e73('0x74')]:!![],'description':_0x266ca8[_0x3e73('0x60')][_0x3e73('0x75')]||null};var _0x34fb20=getAuthenticationOptions(_0x4e9744[_0x3e73('0x61')],_0x266ca8[_0x3e73('0x60')]);_0x4e9744[_0x3e73('0x3e')]=_0x34fb20[_0x3e73('0x3e')];_0x4e9744[_0x3e73('0x3f')]=_0x34fb20[_0x3e73('0x3f')];return db[_0x3e73('0x59')][_0x3e73('0x67')](_0x4e9744,{'include':[{'model':db['MailServerOut'],'as':_0x3e73('0x3f')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x3e73('0x11')](function(_0x4fc2fc){var _0x2327b2=_0x266ca8[_0x3e73('0x36')][_0x3e73('0x76')]({'plain':!![]});if(!_0x2327b2)throw new Error(_0x3e73('0x77'));if(_0x2327b2[_0x3e73('0x78')]==='user'){var _0x2806ba=_0x4fc2fc[_0x3e73('0x76')]({'plain':!![]});return db[_0x3e73('0x79')][_0x3e73('0x5f')]({'where':{'name':_0x3e73('0x27'),'userProfileId':_0x2327b2[_0x3e73('0x7a')]},'raw':!![]})[_0x3e73('0x11')](function(_0x1e67c0){if(_0x1e67c0&&_0x1e67c0['autoAssociation']===0x0){return db[_0x3e73('0x28')]['create']({'name':_0x2806ba[_0x3e73('0x2a')],'resourceId':_0x2806ba['id'],'type':_0x1e67c0[_0x3e73('0x2a')],'sectionId':_0x1e67c0['id']},{})[_0x3e73('0x11')](function(){return _0x4fc2fc;});}else{return _0x4fc2fc;}})[_0x3e73('0x1b')](function(_0x28d74b){logger[_0x3e73('0x18')](_0x3e73('0x7b'),_0x28d74b);throw _0x28d74b;});}return _0x4fc2fc;})[_0x3e73('0x11')](respondWithResult(_0x366a98,0xc9))['catch'](handleError(_0x366a98,null));};exports[_0x3e73('0x7c')]=function(_0x3a700c,_0x5e19d8){return db[_0x3e73('0x59')]['findOne']({'where':{'id':_0x3a700c['params']['id']}})['then'](handleEntityNotFound(_0x5e19d8,null))['then'](function(_0x12b707){if(_0x12b707){return _0x12b707['getImap']();}return null;})[_0x3e73('0x11')](respondWithResult(_0x5e19d8,null))[_0x3e73('0x1b')](handleError(_0x5e19d8,null));};exports[_0x3e73('0x7d')]=function(_0x584ee3,_0x4845a8){if(_0x584ee3[_0x3e73('0x60')]['id']){delete _0x584ee3[_0x3e73('0x60')]['id'];}return db[_0x3e73('0x59')]['find']({'where':{'id':_0x584ee3[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x4845a8,null))[_0x3e73('0x11')](function(_0x5dc000){if(_0x5dc000){_0x584ee3[_0x3e73('0x60')]['MailAccountId']=_0x5dc000['id'];return db[_0x3e73('0x40')][_0x3e73('0x67')](_0x584ee3[_0x3e73('0x60')]);}})[_0x3e73('0x11')](respondWithResult(_0x4845a8,null))[_0x3e73('0x1b')](handleError(_0x4845a8,null));};exports[_0x3e73('0x7e')]=function(_0x46893b,_0x573458){return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x46893b[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x573458,null))[_0x3e73('0x11')](function(_0x1a218c){if(_0x1a218c){return _0x1a218c[_0x3e73('0x7f')](null);}return null;})[_0x3e73('0x11')](respondWithStatusCode(_0x573458,null))[_0x3e73('0x1b')](handleError(_0x573458,null));};exports[_0x3e73('0x80')]=function(_0x455307,_0x26d015){return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x455307[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x26d015,null))['then'](function(_0x449067){if(_0x449067){return _0x449067['getSmtp']();}return null;})['then'](respondWithResult(_0x26d015,null))['catch'](handleError(_0x26d015,null));};exports[_0x3e73('0x81')]=function(_0xb6eeef,_0x142342){if(_0xb6eeef[_0x3e73('0x60')]['id']){delete _0xb6eeef[_0x3e73('0x60')]['id'];}return db[_0x3e73('0x59')][_0x3e73('0x5f')]({'where':{'id':_0xb6eeef[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x142342,null))[_0x3e73('0x11')](function(_0x444545){if(_0x444545){_0xb6eeef[_0x3e73('0x60')][_0x3e73('0x66')]=_0x444545['id'];return db['MailServerOut'][_0x3e73('0x67')](_0xb6eeef[_0x3e73('0x60')]);}})['then'](respondWithResult(_0x142342,null))[_0x3e73('0x1b')](handleError(_0x142342,null));};exports[_0x3e73('0x82')]=function(_0x359d65,_0x41fe03){return db[_0x3e73('0x59')]['findOne']({'where':{'id':_0x359d65[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x41fe03,null))[_0x3e73('0x11')](function(_0x41510a){if(_0x41510a){return _0x41510a[_0x3e73('0x83')](null);}return null;})[_0x3e73('0x11')](respondWithStatusCode(_0x41fe03,null))[_0x3e73('0x1b')](handleError(_0x41fe03,null));};exports[_0x3e73('0x84')]=function(_0x4912f5,_0x223d5c){return db[_0x3e73('0x85')]['find']({'where':{'id':_0x4912f5[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x223d5c,null))[_0x3e73('0x11')](function(_0xe932d4){if(_0xe932d4){return _0xe932d4['addInteraction'](_0x4912f5[_0x3e73('0x60')][_0x3e73('0x6e')],_['omit'](_0x4912f5[_0x3e73('0x60')],[_0x3e73('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x223d5c,null))[_0x3e73('0x1b')](handleError(_0x223d5c,null));};exports['getInteractions']=function(_0x21642b,_0x132e2d){var _0x42d951={'raw':![],'where':{}};var _0x1c17f9={};var _0xda4306={'count':0x0,'rows':[]};return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x21642b['params']['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x132e2d,null))['then'](function(_0x956c72){if(_0x956c72){_0x1c17f9['model']=_['keys'](db[_0x3e73('0x85')][_0x3e73('0x45')]);_0x1c17f9[_0x3e73('0x4a')]=_['keys'](_0x21642b[_0x3e73('0x4a')]);_0x1c17f9[_0x3e73('0x54')]=_['intersection'](_0x1c17f9[_0x3e73('0x49')],_0x1c17f9[_0x3e73('0x4a')]);_0x42d951[_0x3e73('0x4d')]=_[_0x3e73('0x4c')](_0x1c17f9[_0x3e73('0x49')],qs[_0x3e73('0x4e')](_0x21642b[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x42d951['attributes']=_0x42d951[_0x3e73('0x4d')][_0x3e73('0x4f')]?_0x42d951[_0x3e73('0x4d')]:_0x1c17f9[_0x3e73('0x49')];if(!_0x21642b['query']['hasOwnProperty'](_0x3e73('0x6a'))){_0x42d951[_0x3e73('0x22')]=qs['limit'](_0x21642b[_0x3e73('0x4a')][_0x3e73('0x22')]);_0x42d951[_0x3e73('0x20')]=qs['offset'](_0x21642b[_0x3e73('0x4a')][_0x3e73('0x20')]);}_0x42d951[_0x3e73('0x51')]=qs[_0x3e73('0x52')](_0x21642b[_0x3e73('0x4a')][_0x3e73('0x52')]);_0x42d951[_0x3e73('0x53')]=qs[_0x3e73('0x54')](_['pick'](_0x21642b[_0x3e73('0x4a')],_0x1c17f9['filters']));_0x42d951[_0x3e73('0x53')][_0x3e73('0x66')]=_0x956c72['id'];if(_0x21642b[_0x3e73('0x4a')][_0x3e73('0x55')]){_0x42d951[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x42d951[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x42d951[_0x3e73('0x4d')],function(_0x27c46a){var _0x737559={};_0x737559[_0x27c46a]={'$like':'%'+_0x21642b[_0x3e73('0x4a')][_0x3e73('0x55')]+'%'};return _0x737559;})});}_0x42d951=_[_0x3e73('0x57')]({},_0x42d951,_0x21642b[_0x3e73('0x58')]);return db['MailInteraction'][_0x3e73('0x23')]({'where':_0x42d951['where']})['then'](function(_0x92ff9a){_0xda4306[_0x3e73('0x23')]=_0x92ff9a;if(_0x21642b[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x42d951['include']=[{'model':db['CmContact'],'as':_0x3e73('0x86'),'required':![]},{'model':db[_0x3e73('0x87')],'as':_0x3e73('0x88'),'attributes':[_0x3e73('0x2a'),_0x3e73('0x89'),_0x3e73('0x8a')],'required':![]},{'model':db[_0x3e73('0x8b')],'as':_0x3e73('0x8c'),'attributes':['id',_0x3e73('0x2a'),_0x3e73('0x8d')],'where':_0x21642b[_0x3e73('0x4a')][_0x3e73('0x8e')]?{'id':_0x21642b[_0x3e73('0x4a')][_0x3e73('0x8e')]}:undefined,'required':_0x21642b[_0x3e73('0x4a')]['tag']?!![]:![]}];}return db[_0x3e73('0x85')][_0x3e73('0x5c')](_0x42d951);})[_0x3e73('0x11')](function(_0x1b4f04){_0xda4306[_0x3e73('0x5d')]=_0x1b4f04;return _0xda4306;});}})[_0x3e73('0x11')](respondWithFilteredResult(_0x132e2d,_0x42d951))[_0x3e73('0x1b')](handleError(_0x132e2d,null));};exports[_0x3e73('0x8f')]=function addApplications(_0x709f0e,_0x161c6d){var _0x108903=_0x709f0e[_0x3e73('0x5e')]['id'];var _0x433dd5=_0x709f0e['body'];var _0x3d05e5=0xc8;var _0x45f79e=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x3e73('0x90')]['Transaction'][_0x3e73('0x91')][_0x3e73('0x92')]},function(_0x573a0e){return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x108903},'transaction':_0x573a0e})[_0x3e73('0x11')](function(_0x4b98c5){if(_0x4b98c5){return db[_0x3e73('0x93')]['destroy']({'where':{'MailAccountId':_0x108903},'transaction':_0x573a0e})[_0x3e73('0x11')](function(){var _0xe2fa18=_[_0x3e73('0x44')](_0x433dd5,function(_0x5b5b20){_0x5b5b20['MailAccountId']=_0x108903;return _0x5b5b20;});return db[_0x3e73('0x93')]['bulkCreate'](_0xe2fa18,{'transaction':_0x573a0e});});}else{_0x3d05e5=0x194;_0x45f79e=[];}});})[_0x3e73('0x11')](function(){if(_0x3d05e5!==0x194){return db['MailApplication'][_0x3e73('0x94')]({'where':{'MailAccountId':_0x108903},'order':_0x3e73('0x95')})[_0x3e73('0x11')](function(_0x39df95){_0x45f79e=_0x39df95;});}})['catch'](function(_0x4f5abe){_0x3d05e5=0x1f4;logger[_0x3e73('0x18')](_0x4f5abe[_0x3e73('0x29')]);if(_0x4f5abe[_0x3e73('0x2a')]){delete _0x4f5abe[_0x3e73('0x2a')];}_0x45f79e=_0x4f5abe;})[_0x3e73('0x96')](function(){if(_0x45f79e===null){_0x161c6d[_0x3e73('0x1c')](_0x3d05e5);}else{if(_0x3d05e5===0x1f4){_0x161c6d[_0x3e73('0x1d')](_0x3d05e5)['send'](_0x45f79e);}else{_0x161c6d['status'](_0x3d05e5)[_0x3e73('0x1f')](_0x45f79e);}}});};exports[_0x3e73('0x97')]=function(_0x30b9ae,_0x520bf7){var _0x53c07c={};var _0x7db7a9={};var _0x55a015;var _0x3d6d11;return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x30b9ae[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x520bf7,null))['then'](function(_0xe2f0d){if(_0xe2f0d){_0x55a015=_0xe2f0d;_0x7db7a9[_0x3e73('0x49')]=_['keys'](db[_0x3e73('0x93')][_0x3e73('0x45')]);_0x7db7a9[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x30b9ae['query']);_0x7db7a9[_0x3e73('0x54')]=_[_0x3e73('0x4c')](_0x7db7a9[_0x3e73('0x49')],_0x7db7a9[_0x3e73('0x4a')]);_0x53c07c[_0x3e73('0x4d')]=_['intersection'](_0x7db7a9['model'],qs[_0x3e73('0x4e')](_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x53c07c[_0x3e73('0x4d')]=_0x53c07c[_0x3e73('0x4d')]['length']?_0x53c07c[_0x3e73('0x4d')]:_0x7db7a9[_0x3e73('0x49')];_0x53c07c['order']=qs[_0x3e73('0x52')](_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x52')]);_0x53c07c[_0x3e73('0x53')]=qs[_0x3e73('0x54')](_[_0x3e73('0x6b')](_0x30b9ae[_0x3e73('0x4a')],_0x7db7a9[_0x3e73('0x54')]));if(_0x30b9ae['query'][_0x3e73('0x55')]){_0x53c07c[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x53c07c[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x53c07c[_0x3e73('0x4d')],function(_0x55a6aa){var _0x4e7dbb={};_0x4e7dbb[_0x55a6aa]={'$like':'%'+_0x30b9ae[_0x3e73('0x4a')]['filter']+'%'};return _0x4e7dbb;})});}_0x53c07c=_[_0x3e73('0x57')]({},_0x53c07c,_0x30b9ae[_0x3e73('0x58')]);return _0x55a015[_0x3e73('0x97')](_0x53c07c);}})['then'](function(_0x2b3786){if(_0x2b3786){_0x3d6d11=_0x2b3786[_0x3e73('0x4f')];if(!_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x50')](_0x3e73('0x6a'))){_0x53c07c[_0x3e73('0x22')]=qs[_0x3e73('0x22')](_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x22')]);_0x53c07c['offset']=qs['offset'](_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x20')]);}return _0x55a015['getApplications'](_0x53c07c);}})[_0x3e73('0x11')](function(_0x3cf102){if(_0x3cf102){return _0x3cf102?{'count':_0x3d6d11,'rows':_0x3cf102}:null;}})['then'](respondWithResult(_0x520bf7,null))['catch'](handleError(_0x520bf7,null));};exports[_0x3e73('0x98')]=function(_0x2d41a6,_0x2eeaea){var _0x5d15da={'raw':!![],'where':{}};var _0x4287b8={};var _0x3517a4={'count':0x0,'rows':[]};return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x2d41a6[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x2eeaea,null))[_0x3e73('0x11')](function(_0x1fc556){if(_0x1fc556){_0x4287b8[_0x3e73('0x49')]=_[_0x3e73('0x4b')](db[_0x3e73('0x99')][_0x3e73('0x45')]);_0x4287b8[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x2d41a6['query']);_0x4287b8[_0x3e73('0x54')]=_[_0x3e73('0x4c')](_0x4287b8[_0x3e73('0x49')],_0x4287b8[_0x3e73('0x4a')]);_0x5d15da[_0x3e73('0x4d')]=_['intersection'](_0x4287b8[_0x3e73('0x49')],qs[_0x3e73('0x4e')](_0x2d41a6['query']['fields']));_0x5d15da[_0x3e73('0x4d')]=_0x5d15da['attributes'][_0x3e73('0x4f')]?_0x5d15da[_0x3e73('0x4d')]:_0x4287b8[_0x3e73('0x49')];if(!_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x50')](_0x3e73('0x6a'))){_0x5d15da['limit']=qs[_0x3e73('0x22')](_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x22')]);_0x5d15da[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x20')]);}_0x5d15da[_0x3e73('0x51')]=qs[_0x3e73('0x52')](_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x52')]);_0x5d15da[_0x3e73('0x53')]=qs[_0x3e73('0x54')](_[_0x3e73('0x6b')](_0x2d41a6[_0x3e73('0x4a')],_0x4287b8[_0x3e73('0x54')]));_0x5d15da[_0x3e73('0x53')][_0x3e73('0x66')]=_0x1fc556['id'];if(_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x55')]){_0x5d15da[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x5d15da['where'],{'$or':_[_0x3e73('0x44')](_0x5d15da['attributes'],function(_0x22833a){var _0x49d536={};_0x49d536[_0x22833a]={'$like':'%'+_0x2d41a6[_0x3e73('0x4a')]['filter']+'%'};return _0x49d536;})});}if(_0x2d41a6['query']['$gte']){var _0x1569c8=_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x9a')]['split'](',');var _0x459879={};_0x459879[_0x1569c8[0x0]]={'$gte':moment(_0x1569c8[0x1])[_0x3e73('0x9b')](_0x3e73('0x9c'))};_0x5d15da[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x5d15da[_0x3e73('0x53')],_0x459879);}_0x5d15da=_[_0x3e73('0x57')]({},_0x5d15da,_0x2d41a6[_0x3e73('0x58')]);return db[_0x3e73('0x99')][_0x3e73('0x23')]({'where':_0x5d15da[_0x3e73('0x53')]})['then'](function(_0x3deade){_0x3517a4[_0x3e73('0x23')]=_0x3deade;if(_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x5d15da[_0x3e73('0x5b')]=[{'all':!![]}];}return db['MailMessage'][_0x3e73('0x5c')](_0x5d15da);})[_0x3e73('0x11')](function(_0x56587d){if(_0x2d41a6[_0x3e73('0x4a')]['inlineCss']==='true'){for(var _0x5acf2b=0x0;_0x5acf2b<_0x56587d[_0x3e73('0x4f')];_0x5acf2b++){_0x56587d[_0x5acf2b][_0x3e73('0x60')]=juice(_0x56587d[_0x5acf2b][_0x3e73('0x60')]);}}_0x3517a4[_0x3e73('0x5d')]=_0x56587d;return _0x3517a4;});}})['then'](respondWithFilteredResult(_0x2eeaea,_0x5d15da))[_0x3e73('0x1b')](handleError(_0x2eeaea,null));};exports['send']=function(_0x5d2f58,_0x119d07){var _0x1b700e,_0xdc81bd={},_0x17af55;if(_0x5d2f58[_0x3e73('0x60')]['to']){_0x17af55=_0x5d2f58[_0x3e73('0x60')]['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x5d2f58[_0x3e73('0x5e')]['id']},'include':[{'model':db[_0x3e73('0x9d')],'as':'List','include':[{'model':db[_0x3e73('0x9e')],'as':_0x3e73('0x9f'),'where':{'email':_0x17af55},'limit':0x1,'order':[[_0x3e73('0xa0'),_0x3e73('0xa1')]]}]},{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f'),'raw':!![],'include':[{'model':db[_0x3e73('0xa2')],'as':_0x3e73('0xa2'),'raw':!![]}]}]})[_0x3e73('0x11')](handleEntityNotFound(_0x119d07,null))[_0x3e73('0x11')](function(_0x7e13ea){if(!_0x7e13ea)return;_0x1b700e=_0x7e13ea;if(!_0x7e13ea['Smtp'])throw new Error(_0x3e73('0xa3'));if(_[_0x3e73('0x73')](_0x5d2f58[_0x3e73('0x60')]['from'])){_0x5d2f58[_0x3e73('0x60')]['from']=util['format'](_0x3e73('0xa4'),_0x7e13ea[_0x3e73('0x2a')],_0x7e13ea[_0x3e73('0xa5')]||_0x7e13ea[_0x3e73('0x3f')]['user']);}if(_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xa6')]&&_0x5d2f58[_0x3e73('0x60')]['attachments'][_0x3e73('0x4f')]){for(var _0x596e21=0x0;_0x596e21<_0x5d2f58[_0x3e73('0x60')]['attachments']['length'];_0x596e21+=0x1){_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xa6')][_0x596e21]={'filename':_0x5d2f58['body'][_0x3e73('0xa6')][_0x596e21][_0x3e73('0x2a')],'path':path[_0x3e73('0xa7')](config[_0x3e73('0xa8')],_0x3e73('0xa9'),_0x5d2f58['body']['attachments'][_0x596e21]['basename'])};}}var _0x15f4dc=_0x7e13ea[_0x3e73('0xaa')]();return respondWithRpcPromise(_0x3e73('0xab'),'sendMail',{'account':_0x15f4dc,'message':_0x5d2f58[_0x3e73('0x60')]});})[_0x3e73('0x11')](function(_0x59d920){if(!_0x59d920)return;_0xdc81bd=_0x59d920;if(!_0x1b700e[_0x3e73('0xac')])throw new Error(_0x3e73('0xad'));if(_0x1b700e[_0x3e73('0xac')][_0x3e73('0x9f')]['length'])return _0x1b700e[_0x3e73('0xac')][_0x3e73('0x9f')][0x0];return db['CmContact']['create'](_[_0x3e73('0x9')](_0x5d2f58[_0x3e73('0x60')],{'firstName':_0x5d2f58[_0x3e73('0x60')]['to'],'email':_0x5d2f58[_0x3e73('0x60')]['to'],'phone':_0x5d2f58[_0x3e73('0x60')]['to'],'ListId':_0x1b700e[_0x3e73('0x72')]}));})[_0x3e73('0x11')](function(_0x281efc){if(!_0x281efc)return;var _0x44570b={'UserId':_0x5d2f58['user']['id'],'ContactId':_0x281efc['id'],'MailAccountId':_0x1b700e['id'],'inReplyTo':_0xdc81bd[_0x3e73('0xae')],'to':_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xaf')],'cc':_0x5d2f58[_0x3e73('0x60')]['cc'],'subject':_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xb0')],'attach':_0x5d2f58[_0x3e73('0x60')]['attach'],'firstMsgDirection':_0x3e73('0xb1'),'lastMsgAt':moment()[_0x3e73('0x9b')](_0x3e73('0x9c')),'lastMsgDirection':_0x3e73('0xb1'),'Messages':[_[_0x3e73('0x57')](_0x5d2f58[_0x3e73('0x60')],{'messageId':_0xdc81bd[_0x3e73('0xae')],'sentAt':moment()[_0x3e73('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x1b700e['id'],'UserId':_0x5d2f58[_0x3e73('0x36')]['id'],'ContactId':_0x281efc['id']})]};if(_0x5d2f58['body'][_0x3e73('0xb2')]){_0x44570b=_[_0x3e73('0x57')](_0x44570b,_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xb2')]);}return db[_0x3e73('0x85')][_0x3e73('0x67')](_0x44570b,{'include':[{'model':db[_0x3e73('0x99')],'as':_0x3e73('0xb3')}]});})[_0x3e73('0x11')](respondWithResult(_0x119d07,null))[_0x3e73('0x1b')](handleError(_0x119d07,null));};exports[_0x3e73('0xb4')]=function(_0x4fba78,_0x2e2dc5){return db['MailAccount']['find']({'where':{'id':_0x4fba78[_0x3e73('0x5e')]['id']},'include':[{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f'),'raw':!![],'include':[{'model':db[_0x3e73('0xa2')],'as':'CloudProvider','raw':!![]}]}]})[_0x3e73('0x11')](handleEntityNotFound(_0x2e2dc5,null))['then'](function(_0x15a08f){if(!_0x15a08f['Smtp'])return;var _0x1300f4=_0x15a08f['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0x3e73('0xb4'),{'account':_0x1300f4});})['then'](respondWithResult(_0x2e2dc5,null))[_0x3e73('0x1b')](handleError(_0x2e2dc5,null));};exports[_0x3e73('0x26')]=function(_0x4409f4,_0x233a75){return db[_0x3e73('0x59')][_0x3e73('0x5f')]({'where':{'id':_0x4409f4['params']['id']}})['then'](handleEntityNotFound(_0x233a75,null))[_0x3e73('0x11')](function(_0x1d9ce0){if(_0x1d9ce0&&_0x1d9ce0['service']){throw new db['Sequelize'][(_0x3e73('0xb5'))](_0x3e73('0xb6'));}return _0x1d9ce0;})[_0x3e73('0x11')](removeEntity(_0x233a75,null))[_0x3e73('0x1b')](handleError(_0x233a75,null));};exports[_0x3e73('0xb7')]=function(_0xd498a2,_0x416f2b){return db[_0x3e73('0x59')]['find']({'where':{'id':_0xd498a2[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x416f2b,null))[_0x3e73('0x11')](function(_0x15c883){if(_0x15c883){return _0x15c883['addAgents'](_0xd498a2[_0x3e73('0x60')][_0x3e73('0x6e')],_[_0x3e73('0xb8')](_0xd498a2['body'],['ids','id'])||{})[_0x3e73('0xb9')](function(_0x144e5f){for(var _0xbd9377=0x0;_0xbd9377<_0xd498a2[_0x3e73('0x60')][_0x3e73('0x6e')][_0x3e73('0x4f')];_0xbd9377+=0x1){socket[_0x3e73('0xba')]('userMailAccount:save',{'UserId':Number(_0xd498a2[_0x3e73('0x60')]['ids'][_0xbd9377]),'MailAccountId':Number(_0xd498a2[_0x3e73('0x5e')]['id'])});}return _0x144e5f;});}})[_0x3e73('0x11')](respondWithResult(_0x416f2b,null))['catch'](handleError(_0x416f2b,null));};exports['removeAgents']=function(_0x2c56cf,_0x200570){return db[_0x3e73('0x59')]['find']({'where':{'id':_0x2c56cf[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x200570,null))[_0x3e73('0x11')](function(_0x4c233d){if(_0x4c233d){return _0x4c233d['removeAgents'](_0x2c56cf['query'][_0x3e73('0x6e')])['then'](function(){if(_[_0x3e73('0xbb')](_0x2c56cf[_0x3e73('0x4a')][_0x3e73('0x6e')])){for(var _0x4c5f35=0x0;_0x4c5f35<_0x2c56cf[_0x3e73('0x4a')]['ids'][_0x3e73('0x4f')];_0x4c5f35+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x2c56cf[_0x3e73('0x4a')]['ids'][_0x4c5f35]),'MailAccountId':Number(_0x2c56cf[_0x3e73('0x5e')]['id'])});}}else{socket[_0x3e73('0xba')]('userMailAccount:remove',{'UserId':Number(_0x2c56cf[_0x3e73('0x4a')][_0x3e73('0x6e')]),'MailAccountId':Number(_0x2c56cf[_0x3e73('0x5e')]['id'])});}});}})[_0x3e73('0x11')](respondWithStatusCode(_0x200570,null))['catch'](handleError(_0x200570,null));};exports[_0x3e73('0xbc')]=function(_0x169807,_0x4e547c){var _0x290adc={};var _0x2ed991={};var _0x15bb8c;var _0x44d188;return db[_0x3e73('0x59')]['findOne']({'where':{'id':_0x169807[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x4e547c,null))[_0x3e73('0x11')](function(_0x321d8a){if(_0x321d8a){_0x15bb8c=_0x321d8a;_0x2ed991[_0x3e73('0x49')]=_['keys'](db[_0x3e73('0x87')]['rawAttributes']);_0x2ed991[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x169807['query']);_0x2ed991['filters']=_['intersection'](_0x2ed991[_0x3e73('0x49')],_0x2ed991['query']);_0x290adc[_0x3e73('0x4d')]=_[_0x3e73('0x4c')](_0x2ed991[_0x3e73('0x49')],qs['fields'](_0x169807[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x290adc[_0x3e73('0x4d')]=_0x290adc[_0x3e73('0x4d')][_0x3e73('0x4f')]?_0x290adc[_0x3e73('0x4d')]:_0x2ed991[_0x3e73('0x49')];_0x290adc['order']=qs[_0x3e73('0x52')](_0x169807['query']['sort']);_0x290adc[_0x3e73('0x53')]=qs[_0x3e73('0x54')](_[_0x3e73('0x6b')](_0x169807[_0x3e73('0x4a')],_0x2ed991['filters']));if(_0x169807['query'][_0x3e73('0x55')]){_0x290adc[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x290adc[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x290adc[_0x3e73('0x4d')],function(_0x11e035){var _0x3609a2={};_0x3609a2[_0x11e035]={'$like':'%'+_0x169807['query']['filter']+'%'};return _0x3609a2;})});}_0x290adc=_['merge']({},_0x290adc,_0x169807[_0x3e73('0x58')]);return _0x15bb8c[_0x3e73('0xbc')](_0x290adc);}})[_0x3e73('0x11')](function(_0x2d459c){if(_0x2d459c){_0x44d188=_0x2d459c[_0x3e73('0x4f')];if(!_0x169807['query'][_0x3e73('0x50')]('nolimit')){_0x290adc[_0x3e73('0x22')]=qs[_0x3e73('0x22')](_0x169807[_0x3e73('0x4a')][_0x3e73('0x22')]);_0x290adc[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0x169807[_0x3e73('0x4a')][_0x3e73('0x20')]);}return _0x15bb8c[_0x3e73('0xbc')](_0x290adc);}})['then'](function(_0x20af80){if(_0x20af80){return _0x20af80?{'count':_0x44d188,'rows':_0x20af80}:null;}})[_0x3e73('0x11')](respondWithResult(_0x4e547c,null))[_0x3e73('0x1b')](handleError(_0x4e547c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 963123e..72c7999 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 _0x9df5=['exports','events','../../mysqldb','MailAccount','update','emit','hook'];(function(_0x1db413,_0xc971e4){var _0x30ff34=function(_0x10d9bf){while(--_0x10d9bf){_0x1db413['push'](_0x1db413['shift']());}};_0x30ff34(++_0xc971e4);}(_0x9df5,0x9b));var _0x59df=function(_0x2de1b0,_0x48681c){_0x2de1b0=_0x2de1b0-0x0;var _0x3aef9e=_0x9df5[_0x2de1b0];return _0x3aef9e;};'use strict';var EventEmitter=require(_0x59df('0x0'));var MailAccount=require(_0x59df('0x1'))['db'][_0x59df('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x59df('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3dee4f){return function(_0x4e7910,_0xd96d42,_0x2b478c){MailAccountEvents[_0x59df('0x4')](_0x3dee4f+':'+_0x4e7910['id'],_0x4e7910);MailAccountEvents[_0x59df('0x4')](_0x3dee4f,_0x4e7910);_0x2b478c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x59df('0x5')](e,emitEvent(event));}}module[_0x59df('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xd43e=['events','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd43e,0x88));var _0xed43=function(_0x5e11e6,_0x18584e){_0x5e11e6=_0x5e11e6-0x0;var _0x3f5cbe=_0xd43e[_0x5e11e6];return _0x3f5cbe;};'use strict';var EventEmitter=require(_0xed43('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xed43('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xed43('0x2')](0x0);var events={'afterCreate':_0xed43('0x3'),'afterUpdate':_0xed43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5749a9){return function(_0x2c4a41,_0x2c6a4b,_0x269f36){MailAccountEvents[_0xed43('0x5')](_0x5749a9+':'+_0x2c4a41['id'],_0x2c4a41);MailAccountEvents['emit'](_0x5749a9,_0x2c4a41);_0x269f36(null);};}for(var e in events){if(events[_0xed43('0x6')](e)){var event=events[e];MailAccount[_0xed43('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 5b7c141..6861b4f 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 _0xa4b0=['MailAccount','provider','custom','service','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','pass','exports','define'];(function(_0x167214,_0x5c57c3){var _0x3e9391=function(_0x13ef03){while(--_0x13ef03){_0x167214['push'](_0x167214['shift']());}};_0x3e9391(++_0x5c57c3);}(_0xa4b0,0x1a7));var _0x0a4b=function(_0x2a9866,_0x48a165){_0x2a9866=_0x2a9866-0x0;var _0x574f95=_0xa4b0[_0x2a9866];return _0x574f95;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x0a4b('0x0')]=function(_0x33f776){return _0x33f776[_0x0a4b('0x1')](_0x0a4b('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2c41b2=this;var _0x3f7947={'id':_0x2c41b2['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2c41b2[_0x0a4b('0x3')]!==_0x0a4b('0x4')){_0x3f7947[_0x0a4b('0x5')]=_0x2c41b2[_0x0a4b('0x3')];}else{_0x3f7947[_0x0a4b('0x6')]=_0x2c41b2[_0x0a4b('0x7')]['host'];_0x3f7947[_0x0a4b('0x8')]=_0x2c41b2['Smtp'][_0x0a4b('0x8')];_0x3f7947[_0x0a4b('0x9')]=_0x2c41b2['Smtp'][_0x0a4b('0x9')];}if(_0x2c41b2[_0x0a4b('0x7')]['authentication']){if(_0x2c41b2[_0x0a4b('0x7')][_0x0a4b('0xa')]){if(!_0x2c41b2[_0x0a4b('0x7')][_0x0a4b('0xb')])throw new Error(_0x0a4b('0xc'));_0x3f7947[_0x0a4b('0xd')]={'type':_0x0a4b('0xe'),'user':_0x2c41b2['Smtp']['user'],'accessToken':_0x2c41b2['Smtp'][_0x0a4b('0xb')][_0x0a4b('0xf')]};}else{_0x3f7947[_0x0a4b('0xd')]={'user':_0x2c41b2[_0x0a4b('0x7')]['user'],'pass':_0x2c41b2[_0x0a4b('0x7')][_0x0a4b('0x10')]};}}return _0x3f7947;}}});}; \ No newline at end of file +var _0x879a=['secure','authentication','modernAuthentication','CloudProvider','OAuth2','user','data5','auth','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','custom','service','Smtp','host','port'];(function(_0x5820ff,_0x344938){var _0x5f50e1=function(_0x3934fc){while(--_0x3934fc){_0x5820ff['push'](_0x5820ff['shift']());}};_0x5f50e1(++_0x344938);}(_0x879a,0xa1));var _0xa879=function(_0x8c8995,_0x2a31ca){_0x8c8995=_0x8c8995-0x0;var _0x4777cf=_0x879a[_0x8c8995];return _0x4777cf;};'use strict';var attributes=require(_0xa879('0x0'));module['exports']=function(_0x39698e){return _0x39698e[_0xa879('0x1')](_0xa879('0x2'),attributes,{'tableName':_0xa879('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3b37b3=this;var _0x22d556={'id':_0x3b37b3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3b37b3[_0xa879('0x4')]!==_0xa879('0x5')){_0x22d556[_0xa879('0x6')]=_0x3b37b3[_0xa879('0x4')];}else{_0x22d556['host']=_0x3b37b3[_0xa879('0x7')][_0xa879('0x8')];_0x22d556[_0xa879('0x9')]=_0x3b37b3[_0xa879('0x7')][_0xa879('0x9')];_0x22d556[_0xa879('0xa')]=_0x3b37b3['Smtp'][_0xa879('0xa')];}if(_0x3b37b3[_0xa879('0x7')][_0xa879('0xb')]){if(_0x3b37b3[_0xa879('0x7')][_0xa879('0xc')]){if(!_0x3b37b3[_0xa879('0x7')][_0xa879('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x22d556['auth']={'type':_0xa879('0xe'),'user':_0x3b37b3[_0xa879('0x7')][_0xa879('0xf')],'accessToken':_0x3b37b3[_0xa879('0x7')]['CloudProvider'][_0xa879('0x10')]};}else{_0x22d556[_0xa879('0x11')]={'user':_0x3b37b3[_0xa879('0x7')][_0xa879('0xf')],'pass':_0x3b37b3[_0xa879('0x7')][_0xa879('0x12')]};}}return _0x22d556;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f1ce879..163e95e 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 _0xdbb1=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','List','Contacts','DESC','Applications','CloudProvider','get','getSmtpOptions','applications','orderBy','priority','autoclose','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','Contact\x20not\x20found','spread','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','unshift','name','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','ioredis','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty'];(function(_0x8f82df,_0x4ad0e9){var _0x19212a=function(_0xa30958){while(--_0xa30958){_0x8f82df['push'](_0x8f82df['shift']());}};_0x19212a(++_0x4ad0e9);}(_0xdbb1,0x105));var _0x1dbb=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xdbb1[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x1dbb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0x1dbb('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x1dbb('0x2'));var config=require('../../config/environment');var jayson=require(_0x1dbb('0x3'));var client=jayson[_0x1dbb('0x4')]['http']({'port':0x232c});config['redis']=_[_0x1dbb('0x5')](config[_0x1dbb('0x6')],{'host':_0x1dbb('0x7'),'port':0x18eb});var socket=require(_0x1dbb('0x8'))(new Redis(config['redis']));require(_0x1dbb('0x9'))[_0x1dbb('0xa')](socket);function respondWithRpcPromise(_0x5d2d5c,_0x208220,_0x232c1c){return new BPromise(function(_0x1e7ac5,_0x3ce7e9){return client[_0x1dbb('0xb')](_0x5d2d5c,_0x232c1c)[_0x1dbb('0xc')](function(_0x111841){logger[_0x1dbb('0xd')](_0x1dbb('0xe'),_0x208220,_0x1dbb('0xf'));logger[_0x1dbb('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x208220,_0x1dbb('0xf'),JSON[_0x1dbb('0x11')](_0x111841));if(_0x111841[_0x1dbb('0x12')]){if(_0x111841[_0x1dbb('0x12')]['code']===0x1f4){logger['error'](_0x1dbb('0xe'),_0x208220,_0x111841[_0x1dbb('0x12')][_0x1dbb('0x13')]);return _0x3ce7e9(_0x111841[_0x1dbb('0x12')][_0x1dbb('0x13')]);}logger['error'](_0x1dbb('0xe'),_0x208220,_0x111841[_0x1dbb('0x12')][_0x1dbb('0x13')]);return _0x1e7ac5(_0x111841['error'][_0x1dbb('0x13')]);}else{logger[_0x1dbb('0xd')]('MailAccount,\x20%s,\x20%s',_0x208220,_0x1dbb('0xf'));_0x1e7ac5(_0x111841[_0x1dbb('0x14')][_0x1dbb('0x13')]);}})[_0x1dbb('0x15')](function(_0xb21bc5){logger[_0x1dbb('0x12')](_0x1dbb('0xe'),_0x208220,_0xb21bc5);_0x3ce7e9(_0xb21bc5);});});}exports[_0x1dbb('0x16')]=function(_0x58aa43){var _0x550dd4=this;return new Promise(function(_0x4802ba,_0x4248d7){return db[_0x1dbb('0x17')]['findAll']({'raw':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x19')]===undefined?!![]:![]:!![],'where':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1a')]||null:null,'attributes':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1b')]||null:null,'limit':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1c')]||null:null,'include':_0x58aa43[_0x1dbb('0x18')]?_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x58aa43[_0x1dbb('0x18')][_0x1dbb('0x1d')],function(_0x18f188){return{'model':db[_0x18f188['model']],'as':_0x18f188['as'],'attributes':_0x18f188[_0x1dbb('0x1b')],'include':_0x18f188['include']?_[_0x1dbb('0x1e')](_0x18f188['include'],function(_0x72cfed){return{'model':db[_0x72cfed[_0x1dbb('0x1f')]],'as':_0x72cfed['as'],'attributes':_0x72cfed[_0x1dbb('0x1b')],'include':_0x72cfed[_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x72cfed[_0x1dbb('0x1d')],function(_0x5e5059){return{'model':db[_0x5e5059[_0x1dbb('0x1f')]],'as':_0x5e5059['as'],'attributes':_0x5e5059[_0x1dbb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1dbb('0xc')](function(_0x4c0a9d){logger['info'](_0x1dbb('0x16'),_0x58aa43);logger['debug']('GetMailAccount',_0x58aa43,JSON[_0x1dbb('0x11')](_0x4c0a9d));_0x4802ba(_0x4c0a9d);})[_0x1dbb('0x15')](function(_0x4511b3){logger[_0x1dbb('0x12')](_0x1dbb('0x16'),_0x4511b3[_0x1dbb('0x13')],_0x58aa43);_0x4248d7(_0x550dd4[_0x1dbb('0x12')](0x1f4,_0x4511b3[_0x1dbb('0x13')]));});});};exports[_0x1dbb('0x20')]=function(_0x5126a3){var _0x4d70fc=this;return new Promise(function(_0x15672c,_0x110b7a){return db[_0x1dbb('0x17')]['find']({'raw':_0x5126a3['options']?_0x5126a3[_0x1dbb('0x18')][_0x1dbb('0x19')]===undefined?!![]:![]:!![],'where':_0x5126a3[_0x1dbb('0x18')]?_0x5126a3['options']['where']||null:null,'attributes':_0x5126a3[_0x1dbb('0x18')]?_0x5126a3[_0x1dbb('0x18')]['attributes']||null:null,'include':_0x5126a3[_0x1dbb('0x18')]?_0x5126a3[_0x1dbb('0x18')][_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x5126a3['options'][_0x1dbb('0x1d')],function(_0x22e40b){return{'model':db[_0x22e40b[_0x1dbb('0x1f')]],'as':_0x22e40b['as'],'attributes':_0x22e40b[_0x1dbb('0x1b')],'include':_0x22e40b[_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x22e40b['include'],function(_0x5a9c2){return{'model':db[_0x5a9c2[_0x1dbb('0x1f')]],'as':_0x5a9c2['as'],'attributes':_0x5a9c2['attributes'],'include':_0x5a9c2[_0x1dbb('0x1d')]?_[_0x1dbb('0x1e')](_0x5a9c2[_0x1dbb('0x1d')],function(_0xde3241){return{'model':db[_0xde3241[_0x1dbb('0x1f')]],'as':_0xde3241['as'],'attributes':_0xde3241['attributes']};}):[]};}):[]};}):[]:[]})[_0x1dbb('0xc')](function(_0x28db37){if(_0x5126a3[_0x1dbb('0x18')][_0x1dbb('0x21')]===!![])_0x28db37[_0x1dbb('0x22')](_0x1dbb('0x23'),_0x28db37['getSmtpOptions']());logger[_0x1dbb('0xd')](_0x1dbb('0x20'),_0x5126a3);logger['debug'](_0x1dbb('0x20'),_0x5126a3,JSON[_0x1dbb('0x11')](_0x28db37));_0x15672c(_0x28db37);})[_0x1dbb('0x15')](function(_0x311f6e){logger[_0x1dbb('0x12')](_0x1dbb('0x20'),_0x311f6e[_0x1dbb('0x13')],_0x5126a3);_0x110b7a(_0x4d70fc[_0x1dbb('0x12')](0x1f4,_0x311f6e[_0x1dbb('0x13')]));});});};exports[_0x1dbb('0x24')]=function(_0x3fed14){var _0x366f44=this;return new Promise(function(_0x2a74a3,_0x55a8f6){var _0x1b94ab={'body':_0x3fed14[_0x1dbb('0x25')],'channel':_0x1dbb('0x26')};var _0x2af34d=_[_0x1dbb('0x27')](_[_0x1dbb('0x28')](db[_0x1dbb('0x29')][_0x1dbb('0x2a')]),[_0x1dbb('0x2b'),_0x1dbb('0x2c'),_0x1dbb('0x2d'),_0x1dbb('0x2e')]);var _0x139cb4=![];if(_0x3fed14['body']['id']){delete _0x3fed14[_0x1dbb('0x25')]['id'];}if(_[_0x1dbb('0x2f')](_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x30')])){return _0x55a8f6(_0x366f44['error'](0x1f4,_0x1dbb('0x31')));}if(_[_0x1dbb('0x2f')](_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x25')])||_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x25')]===''){return _0x55a8f6(_0x366f44[_0x1dbb('0x12')](0x1f4,_0x1dbb('0x32')));}if(_['isNil'](_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x33')])){return _0x55a8f6(_0x366f44[_0x1dbb('0x12')](0x1f4,_0x1dbb('0x34')+_0x2af34d));}if(!_[_0x1dbb('0x35')](_0x2af34d,_0x3fed14[_0x1dbb('0x25')]['mapKey'])){return _0x55a8f6(_0x366f44[_0x1dbb('0x12')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2af34d));}var _0x11ae4c={};_0x11ae4c[_0x3fed14[_0x1dbb('0x25')]['mapKey']]=_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x30')];return db[_0x1dbb('0x17')][_0x1dbb('0x36')]({'where':{'id':_0x3fed14[_0x1dbb('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x1dbb('0x38'),'include':[{'model':db[_0x1dbb('0x29')],'as':_0x1dbb('0x39'),'where':_0x11ae4c,'limit':0x1,'order':[[_0x1dbb('0x2c'),_0x1dbb('0x3a')]]}]},{'model':db['MailApplication'],'as':_0x1dbb('0x3b')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x1dbb('0x3c')],'as':'CloudProvider'}]}]})[_0x1dbb('0xc')](function(_0xb47fb7){if(_0xb47fb7&&_0xb47fb7[_0x1dbb('0x38')]){var _0x3085ab=_0xb47fb7[_0x1dbb('0x3d')]({'plain':!![]});_0x1b94ab[_0x1dbb('0x37')]=_['omit'](_0x3085ab,[_0x1dbb('0x3b'),_0x1dbb('0x38')]);_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x23')]=_0xb47fb7[_0x1dbb('0x3e')]();_0x1b94ab[_0x1dbb('0x3f')]=_0x3085ab['Applications'];_0x1b94ab['list']=_0x3085ab[_0x1dbb('0x38')];_0x1b94ab['applications']=_[_0x1dbb('0x40')](_0x1b94ab[_0x1dbb('0x3f')],[_0x1dbb('0x41')],['asc']);if(_0x1b94ab[_0x1dbb('0x37')]&&_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x42')]){_0x1b94ab[_0x1dbb('0x3f')]['push']({'id':0x0,'priority':_0x1b94ab[_0x1dbb('0x3f')][_0x1dbb('0x43')]+0x1,'app':_0x1dbb('0x44'),'appdata':_0x1dbb('0x42'),'interval':_0x1dbb('0x45')});}if(_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x3b')]){delete _0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x3b')];}if(_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x38')]){delete _0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x38')];}if(_0x3085ab[_0x1dbb('0x38')]['Contacts']['length']){return _0x3085ab[_0x1dbb('0x38')]['Contacts'][0x0];}var _0x100828=_[_0x1dbb('0x5')](_0x3fed14[_0x1dbb('0x25')],{'firstName':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x30')],'ListId':_0x3085ab[_0x1dbb('0x2e')]});_0x100828[_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x33')]]=_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x30')];return db[_0x1dbb('0x29')]['create'](_0x100828);}else{throw new Error(_0x1dbb('0x46'));}})[_0x1dbb('0xc')](function(_0x558ac9){_0x1b94ab[_0x1dbb('0x47')]=_0x558ac9;if(_0x558ac9){if(!_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')]['messageId']){_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x48')]=rs[_0x1dbb('0x49')]()+'\x20'+_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x30')];}var _0x3958f6={'ContactId':_0x558ac9['id'],'MailAccountId':_0x3fed14[_0x1dbb('0x37')]['id'],'inReplyTo':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x48')],'to':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x30')],'cc':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')]['cc'],'subject':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x4a')],'attach':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x4b')],'lastMsgAt':moment()[_0x1dbb('0x4c')](_0x1dbb('0x4d')),'lastMsgDirection':'in'};return db[_0x1dbb('0x4e')][_0x1dbb('0x36')]({'where':{'closed':![],'MailAccountId':_0x3fed14[_0x1dbb('0x37')]['id']},'include':[{'model':db[_0x1dbb('0x4f')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x50')]}}]})[_0x1dbb('0xc')](function(_0x53004c){if(_0x53004c){return[_0x53004c,![]];}return db['MailInteraction'][_0x1dbb('0x51')](_0x3958f6)[_0x1dbb('0xc')](function(_0x3770c0){return[_0x3770c0,!![]];});});}else{throw new Error(_0x1dbb('0x52'));}})[_0x1dbb('0x53')](function(_0x322b54,_0x2b2746){if(_0x322b54){_0x139cb4=_0x2b2746;if(!_0x2b2746){return _0x322b54['update']({'inReplyTo':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x48')],'to':_0x3fed14[_0x1dbb('0x25')]['message'][_0x1dbb('0x30')],'cc':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')]['cc'],'subject':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x4a')],'attach':_0x322b54[_0x1dbb('0x4b')]?_0x322b54[_0x1dbb('0x4b')]:_0x3fed14[_0x1dbb('0x25')]['message'][_0x1dbb('0x4b')],'substatus':null,'substatusAt':moment()[_0x1dbb('0x4c')](_0x1dbb('0x4d')),'lastMsgAt':moment()[_0x1dbb('0x4c')](_0x1dbb('0x4d')),'lastMsgDirection':'in'});}else{return _0x322b54;}}})['then'](function(_0x40927c){_0x1b94ab[_0x1dbb('0x54')]=_0x40927c['get']({'plain':!![]});_0x1b94ab[_0x1dbb('0x54')][_0x1dbb('0x55')]=_0x139cb4;return db[_0x1dbb('0x4f')][_0x1dbb('0x51')]({'body':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x25')],'MailAccountId':_0x3fed14[_0x1dbb('0x37')]['id'],'MailInteractionId':_0x40927c['id'],'direction':'in','ContactId':_0x1b94ab['contact']['id'],'messageId':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x48')],'from':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x30')],'to':_0x3fed14[_0x1dbb('0x25')]['message']['to'],'cc':_0x3fed14[_0x1dbb('0x25')]['message']['cc'],'subject':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x4a')],'attach':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x4b')],'Attachments':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x56')],'originTo':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x57')],'originCc':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')]['originCc'],'bcc':_0x3fed14[_0x1dbb('0x25')]['message'][_0x1dbb('0x58')],'ChatWebsiteId':_0x3fed14[_0x1dbb('0x25')]['message'][_0x1dbb('0x59')]||null,'originChannel':_0x3fed14[_0x1dbb('0x25')][_0x1dbb('0x13')][_0x1dbb('0x5a')]||_0x1dbb('0x5b'),'ChatOfflineMessageId':_0x3fed14['body'][_0x1dbb('0x13')][_0x1dbb('0x5c')]||null},{'include':[{'model':db[_0x1dbb('0x5d')],'as':_0x1dbb('0x5e')}]});})[_0x1dbb('0xc')](function(_0x430bec){_0x1b94ab['message']=_0x430bec;if(!_0x1b94ab[_0x1dbb('0x54')]['UserId']){return;}return db['User'][_0x1dbb('0x36')]({'attributes':['id','name'],'where':{'id':_0x1b94ab[_0x1dbb('0x54')][_0x1dbb('0x5f')]}});})[_0x1dbb('0xc')](function(_0x3efd93){if(_0x3efd93){_0x1b94ab[_0x1dbb('0x3f')][_0x1dbb('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3efd93[_0x1dbb('0x61')]+','+(_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x62')]||0xa),'interval':_0x1dbb('0x45')});}if(!_0x1b94ab[_0x1dbb('0x54')]['queueId']){return;}return db['MailQueue'][_0x1dbb('0x36')]({'attributes':['id',_0x1dbb('0x61')],'where':{'id':_0x1b94ab['interaction'][_0x1dbb('0x63')]}});})[_0x1dbb('0xc')](function(_0x12008c){if(_0x12008c){_0x1b94ab['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x1dbb('0x64'),'appdata':_0x12008c[_0x1dbb('0x61')]+','+(_0x1b94ab[_0x1dbb('0x37')][_0x1dbb('0x65')]||0x12c),'interval':_0x1dbb('0x45')});}return respondWithRpcPromise(_0x1dbb('0x66'),_0x1dbb('0x67'),_0x1b94ab);})[_0x1dbb('0xc')](function(_0x43788f){_0x2a74a3(_0x43788f);})[_0x1dbb('0x15')](function(_0x48f548){_0x55a8f6(_0x366f44[_0x1dbb('0x12')](0x1f4,_0x48f548[_0x1dbb('0x13')]));});});}; \ No newline at end of file +var _0x7d9f=['ChatOfflineMessageId','UserId','User','name','waitForTheAssignedAgent','queueId','unshift','queue','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','register','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','MailAccount,\x20%s,\x20%s','info','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','getSmtpOptions','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','MailInteraction','Contact\x20not\x20found','update','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email'];(function(_0x53fd23,_0xbdb442){var _0x97d025=function(_0x465372){while(--_0x465372){_0x53fd23['push'](_0x53fd23['shift']());}};_0x97d025(++_0xbdb442);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x4d579b,_0x2327f3){_0x4d579b=_0x4d579b-0x0;var _0x288145=_0x7d9f[_0x4d579b];return _0x288145;};'use strict';var _=require(_0xf7d9('0x0'));var moment=require(_0xf7d9('0x1'));var BPromise=require(_0xf7d9('0x2'));var rs=require(_0xf7d9('0x3'));var Redis=require(_0xf7d9('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xf7d9('0x5'))(_0xf7d9('0x6'));var config=require(_0xf7d9('0x7'));var jayson=require(_0xf7d9('0x8'));var client=jayson[_0xf7d9('0x9')]['http']({'port':0x232c});config['redis']=_[_0xf7d9('0xa')](config[_0xf7d9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf7d9('0xc'))(new Redis(config[_0xf7d9('0xb')]));require('./mailAccount.socket')[_0xf7d9('0xd')](socket);function respondWithRpcPromise(_0x4cd620,_0x265548,_0x33360a){return new BPromise(function(_0x5d2735,_0x560a34){return client[_0xf7d9('0xe')](_0x4cd620,_0x33360a)[_0xf7d9('0xf')](function(_0x2a14e2){logger['info']('MailAccount,\x20%s,\x20%s',_0x265548,_0xf7d9('0x10'));logger[_0xf7d9('0x11')](_0xf7d9('0x12'),_0x265548,_0xf7d9('0x10'),JSON['stringify'](_0x2a14e2));if(_0x2a14e2[_0xf7d9('0x13')]){if(_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x14')]===0x1f4){logger[_0xf7d9('0x13')]('MailAccount,\x20%s,\x20%s',_0x265548,_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x15')]);return _0x560a34(_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x15')]);}logger['error'](_0xf7d9('0x16'),_0x265548,_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x15')]);return _0x5d2735(_0x2a14e2['error']['message']);}else{logger[_0xf7d9('0x17')](_0xf7d9('0x16'),_0x265548,_0xf7d9('0x10'));_0x5d2735(_0x2a14e2['result'][_0xf7d9('0x15')]);}})[_0xf7d9('0x18')](function(_0x5eb7c9){logger[_0xf7d9('0x13')]('MailAccount,\x20%s,\x20%s',_0x265548,_0x5eb7c9);_0x560a34(_0x5eb7c9);});});}exports[_0xf7d9('0x19')]=function(_0x1bbc77){var _0x5e0b9e=this;return new Promise(function(_0x34acd2,_0x43dcff){return db[_0xf7d9('0x1a')][_0xf7d9('0x1b')]({'raw':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77[_0xf7d9('0x1c')][_0xf7d9('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options']['where']||null:null,'attributes':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options'][_0xf7d9('0x1e')]||null:null,'limit':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options'][_0xf7d9('0x1f')]||null:null,'include':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options']['include']?_[_0xf7d9('0x20')](_0x1bbc77[_0xf7d9('0x1c')][_0xf7d9('0x21')],function(_0x595556){return{'model':db[_0x595556[_0xf7d9('0x22')]],'as':_0x595556['as'],'attributes':_0x595556['attributes'],'include':_0x595556[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x595556[_0xf7d9('0x21')],function(_0x5b1ea5){return{'model':db[_0x5b1ea5[_0xf7d9('0x22')]],'as':_0x5b1ea5['as'],'attributes':_0x5b1ea5[_0xf7d9('0x1e')],'include':_0x5b1ea5[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x5b1ea5[_0xf7d9('0x21')],function(_0x540086){return{'model':db[_0x540086[_0xf7d9('0x22')]],'as':_0x540086['as'],'attributes':_0x540086[_0xf7d9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf7d9('0xf')](function(_0x2c04c3){logger['info'](_0xf7d9('0x19'),_0x1bbc77);logger[_0xf7d9('0x11')](_0xf7d9('0x19'),_0x1bbc77,JSON[_0xf7d9('0x23')](_0x2c04c3));_0x34acd2(_0x2c04c3);})[_0xf7d9('0x18')](function(_0x16318f){logger['error']('GetMailAccount',_0x16318f['message'],_0x1bbc77);_0x43dcff(_0x5e0b9e[_0xf7d9('0x13')](0x1f4,_0x16318f['message']));});});};exports[_0xf7d9('0x24')]=function(_0x48c13c){var _0x3ecbb9=this;return new Promise(function(_0x59c246,_0x4ecfbd){return db['MailAccount'][_0xf7d9('0x25')]({'raw':_0x48c13c['options']?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x1d')]===undefined?!![]:![]:!![],'where':_0x48c13c[_0xf7d9('0x1c')]?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x26')]||null:null,'attributes':_0x48c13c[_0xf7d9('0x1c')]?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x1e')]||null:null,'include':_0x48c13c['options']?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x21')]?_['map'](_0x48c13c['options'][_0xf7d9('0x21')],function(_0x1fd532){return{'model':db[_0x1fd532[_0xf7d9('0x22')]],'as':_0x1fd532['as'],'attributes':_0x1fd532['attributes'],'include':_0x1fd532[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x1fd532[_0xf7d9('0x21')],function(_0x1be610){return{'model':db[_0x1be610[_0xf7d9('0x22')]],'as':_0x1be610['as'],'attributes':_0x1be610[_0xf7d9('0x1e')],'include':_0x1be610[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x1be610[_0xf7d9('0x21')],function(_0x1c42bb){return{'model':db[_0x1c42bb[_0xf7d9('0x22')]],'as':_0x1c42bb['as'],'attributes':_0x1c42bb['attributes']};}):[]};}):[]};}):[]:[]})[_0xf7d9('0xf')](function(_0x4ce081){if(_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x27')]===!![])_0x4ce081[_0xf7d9('0x28')](_0xf7d9('0x29'),_0x4ce081['getSmtpOptions']());logger['info'](_0xf7d9('0x24'),_0x48c13c);logger['debug'](_0xf7d9('0x24'),_0x48c13c,JSON[_0xf7d9('0x23')](_0x4ce081));_0x59c246(_0x4ce081);})[_0xf7d9('0x18')](function(_0x1e412b){logger['error']('ShowMailAccount',_0x1e412b[_0xf7d9('0x15')],_0x48c13c);_0x4ecfbd(_0x3ecbb9[_0xf7d9('0x13')](0x1f4,_0x1e412b[_0xf7d9('0x15')]));});});};exports[_0xf7d9('0x2a')]=function(_0x4b4389){var _0x17731b=this;return new Promise(function(_0xd6d84f,_0xd7f316){var _0x33e692={'body':_0x4b4389[_0xf7d9('0x2b')],'channel':'mail'};var _0x28c932=_[_0xf7d9('0x2c')](_[_0xf7d9('0x2d')](db[_0xf7d9('0x2e')][_0xf7d9('0x2f')]),[_0xf7d9('0x30'),_0xf7d9('0x31'),_0xf7d9('0x32'),_0xf7d9('0x33')]);var _0x3d056f=![];if(_0x4b4389[_0xf7d9('0x2b')]['id']){delete _0x4b4389[_0xf7d9('0x2b')]['id'];}if(_['isNil'](_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x34')])){return _0xd7f316(_0x17731b['error'](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x4b4389[_0xf7d9('0x2b')]['body'])||_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x2b')]===''){return _0xd7f316(_0x17731b[_0xf7d9('0x13')](0x1f4,_0xf7d9('0x35')));}if(_[_0xf7d9('0x36')](_0x4b4389['body'][_0xf7d9('0x37')])){return _0xd7f316(_0x17731b[_0xf7d9('0x13')](0x1f4,_0xf7d9('0x38')+_0x28c932));}if(!_[_0xf7d9('0x39')](_0x28c932,_0x4b4389[_0xf7d9('0x2b')]['mapKey'])){return _0xd7f316(_0x17731b['error'](0x1f4,_0xf7d9('0x3a')+_0x28c932));}var _0x113a2b={};_0x113a2b[_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x37')]]=_0x4b4389[_0xf7d9('0x2b')]['from'];return db[_0xf7d9('0x1a')]['find']({'where':{'id':_0x4b4389[_0xf7d9('0x3b')]['id']},'include':[{'model':db[_0xf7d9('0x3c')],'as':_0xf7d9('0x3d'),'include':[{'model':db[_0xf7d9('0x2e')],'as':_0xf7d9('0x3e'),'where':_0x113a2b,'limit':0x1,'order':[[_0xf7d9('0x31'),_0xf7d9('0x3f')]]}]},{'model':db[_0xf7d9('0x40')],'as':_0xf7d9('0x41')},{'model':db[_0xf7d9('0x42')],'as':_0xf7d9('0x43'),'include':[{'model':db[_0xf7d9('0x44')],'as':_0xf7d9('0x44')}]}]})[_0xf7d9('0xf')](function(_0x50731a){if(_0x50731a&&_0x50731a[_0xf7d9('0x3d')]){var _0x1f1ee5=_0x50731a['get']({'plain':!![]});_0x33e692['account']=_[_0xf7d9('0x45')](_0x1f1ee5,['Applications','List']);_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x29')]=_0x50731a[_0xf7d9('0x46')]();_0x33e692[_0xf7d9('0x47')]=_0x1f1ee5[_0xf7d9('0x41')];_0x33e692[_0xf7d9('0x48')]=_0x1f1ee5[_0xf7d9('0x3d')];_0x33e692[_0xf7d9('0x47')]=_[_0xf7d9('0x49')](_0x33e692[_0xf7d9('0x47')],[_0xf7d9('0x4a')],[_0xf7d9('0x4b')]);if(_0x33e692['account']&&_0x33e692['account'][_0xf7d9('0x4c')]){_0x33e692[_0xf7d9('0x47')][_0xf7d9('0x4d')]({'id':0x0,'priority':_0x33e692[_0xf7d9('0x47')]['length']+0x1,'app':_0xf7d9('0x4e'),'appdata':_0xf7d9('0x4c'),'interval':_0xf7d9('0x4f')});}if(_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x41')]){delete _0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x41')];}if(_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x3d')]){delete _0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x3d')];}if(_0x1f1ee5['List'][_0xf7d9('0x3e')][_0xf7d9('0x50')]){return _0x1f1ee5[_0xf7d9('0x3d')][_0xf7d9('0x3e')][0x0];}var _0x3c3bd3=_[_0xf7d9('0xa')](_0x4b4389['body'],{'firstName':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x34')],'ListId':_0x1f1ee5[_0xf7d9('0x33')]});_0x3c3bd3[_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x37')]]=_0x4b4389['body'][_0xf7d9('0x34')];return db[_0xf7d9('0x2e')][_0xf7d9('0x51')](_0x3c3bd3);}else{throw new Error(_0xf7d9('0x52'));}})[_0xf7d9('0xf')](function(_0x379f88){_0x33e692[_0xf7d9('0x53')]=_0x379f88;if(_0x379f88){if(!_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x54')]){_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x54')]=rs[_0xf7d9('0x55')]()+'\x20'+_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['from'];}var _0x310c05={'ContactId':_0x379f88['id'],'MailAccountId':_0x4b4389[_0xf7d9('0x3b')]['id'],'inReplyTo':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x54')],'to':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x34')],'cc':_0x4b4389['body'][_0xf7d9('0x15')]['cc'],'subject':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x56')],'attach':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x57')],'lastMsgAt':moment()[_0xf7d9('0x58')](_0xf7d9('0x59')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x4b4389['account']['id']},'include':[{'model':db[_0xf7d9('0x5a')],'as':'Messages','attributes':[_0xf7d9('0x54')],'where':{'messageId':_0x4b4389['body']['message'][_0xf7d9('0x5b')]}}]})[_0xf7d9('0xf')](function(_0x2f469c){if(_0x2f469c){return[_0x2f469c,![]];}return db[_0xf7d9('0x5c')][_0xf7d9('0x51')](_0x310c05)[_0xf7d9('0xf')](function(_0x56feae){return[_0x56feae,!![]];});});}else{throw new Error(_0xf7d9('0x5d'));}})['spread'](function(_0x2ca4e5,_0x3d33f2){if(_0x2ca4e5){_0x3d056f=_0x3d33f2;if(!_0x3d33f2){return _0x2ca4e5[_0xf7d9('0x5e')]({'inReplyTo':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x54')],'to':_0x4b4389[_0xf7d9('0x2b')]['message']['from'],'cc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['cc'],'subject':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x56')],'attach':_0x2ca4e5['attach']?_0x2ca4e5[_0xf7d9('0x57')]:_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x57')],'substatus':null,'substatusAt':moment()[_0xf7d9('0x58')](_0xf7d9('0x59')),'lastMsgAt':moment()['format'](_0xf7d9('0x59')),'lastMsgDirection':'in'});}else{return _0x2ca4e5;}}})[_0xf7d9('0xf')](function(_0x5c25d6){_0x33e692[_0xf7d9('0x5f')]=_0x5c25d6['get']({'plain':!![]});_0x33e692[_0xf7d9('0x5f')][_0xf7d9('0x60')]=_0x3d056f;return db['MailMessage']['create']({'body':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x2b')],'MailAccountId':_0x4b4389[_0xf7d9('0x3b')]['id'],'MailInteractionId':_0x5c25d6['id'],'direction':'in','ContactId':_0x33e692[_0xf7d9('0x53')]['id'],'messageId':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x54')],'from':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x34')],'to':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['to'],'cc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['cc'],'subject':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x56')],'attach':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x57')],'Attachments':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x61')],'originTo':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x62')],'originCc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x63')],'bcc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x64')],'ChatWebsiteId':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x65')]||null,'originChannel':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x66')]||_0xf7d9('0x67'),'ChatOfflineMessageId':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x68')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0xf7d9('0xf')](function(_0x437240){_0x33e692[_0xf7d9('0x15')]=_0x437240;if(!_0x33e692[_0xf7d9('0x5f')][_0xf7d9('0x69')]){return;}return db[_0xf7d9('0x6a')][_0xf7d9('0x25')]({'attributes':['id',_0xf7d9('0x6b')],'where':{'id':_0x33e692[_0xf7d9('0x5f')]['UserId']}});})[_0xf7d9('0xf')](function(_0x424774){if(_0x424774){_0x33e692['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x424774['name']+','+(_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x6c')]||0xa),'interval':_0xf7d9('0x4f')});}if(!_0x33e692['interaction'][_0xf7d9('0x6d')]){return;}return db['MailQueue'][_0xf7d9('0x25')]({'attributes':['id','name'],'where':{'id':_0x33e692[_0xf7d9('0x5f')]['queueId']}});})[_0xf7d9('0xf')](function(_0x4abd04){if(_0x4abd04){_0x33e692[_0xf7d9('0x47')][_0xf7d9('0x6e')]({'id':0x0,'priority':0x1,'app':_0xf7d9('0x6f'),'appdata':_0x4abd04[_0xf7d9('0x6b')]+','+(_0x33e692[_0xf7d9('0x3b')]['waitForTheAssignedQueue']||0x12c),'interval':_0xf7d9('0x4f')});}return respondWithRpcPromise('Start',_0xf7d9('0x70'),_0x33e692);})[_0xf7d9('0xf')](function(_0x52673b){_0xd6d84f(_0x52673b);})[_0xf7d9('0x18')](function(_0x50ec3c){_0xd7f316(_0x17731b[_0xf7d9('0x13')](0x1f4,_0x50ec3c[_0xf7d9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index fef4cec..47c3442 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 _0xcd30=['removeListener','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xcd30,0x1e8));var _0x0cd3=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0xcd30[_0x57cc22];return _0x6f7bdc;};'use strict';var MailAccountEvents=require(_0x0cd3('0x0'));var events=[_0x0cd3('0x1'),_0x0cd3('0x2'),_0x0cd3('0x3')];function createListener(_0x392d43,_0x21311c){return function(_0x163b0c){_0x21311c['emit'](_0x392d43,_0x163b0c);};}function removeListener(_0x196d58,_0x3531d9){return function(){MailAccountEvents[_0x0cd3('0x4')](_0x196d58,_0x3531d9);};}exports['register']=function(_0x472566){for(var _0x5d321f=0x0,_0xe1ece5=events['length'];_0x5d321f<_0xe1ece5;_0x5d321f++){var _0x15ff66=events[_0x5d321f];var _0x18d6f3=createListener(_0x0cd3('0x5')+_0x15ff66,_0x472566);MailAccountEvents['on'](_0x15ff66,_0x18d6f3);}}; \ No newline at end of file +var _0x9672=['update','removeListener','length','mailAccount:','./mailAccount.events','save'];(function(_0x17809c,_0xa6ceb9){var _0x144a29=function(_0x44b044){while(--_0x44b044){_0x17809c['push'](_0x17809c['shift']());}};_0x144a29(++_0xa6ceb9);}(_0x9672,0xee));var _0x2967=function(_0x32cfc0,_0x44debf){_0x32cfc0=_0x32cfc0-0x0;var _0x4855b9=_0x9672[_0x32cfc0];return _0x4855b9;};'use strict';var MailAccountEvents=require(_0x2967('0x0'));var events=[_0x2967('0x1'),'remove',_0x2967('0x2')];function createListener(_0xcaaf25,_0x1228b8){return function(_0xb323a5){_0x1228b8['emit'](_0xcaaf25,_0xb323a5);};}function removeListener(_0x264152,_0xa53659){return function(){MailAccountEvents[_0x2967('0x3')](_0x264152,_0xa53659);};}exports['register']=function(_0x4baad7){for(var _0x24424d=0x0,_0x355e82=events[_0x2967('0x4')];_0x24424d<_0x355e82;_0x24424d++){var _0x77f846=events[_0x24424d];var _0x3bcd7e=createListener(_0x2967('0x5')+_0x77f846,_0x4baad7);MailAccountEvents['on'](_0x77f846,_0x3bcd7e);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 539a9be..84d4862 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 _0xf9b9=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','connect-timeout'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0xf9b9,0xc1));var _0x9f9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9b9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9f9b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9f9b('0x1'));var express=require(_0x9f9b('0x2'));var router=express[_0x9f9b('0x3')]();var fs_extra=require(_0x9f9b('0x4'));var auth=require(_0x9f9b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f9b('0x6'));var controller=require('./mailApplication.controller');router[_0x9f9b('0x7')](_0x9f9b('0x8'),auth[_0x9f9b('0x9')](),controller[_0x9f9b('0xa')]);router[_0x9f9b('0xb')]('/:id',auth[_0x9f9b('0x9')](),controller[_0x9f9b('0xc')]);router[_0x9f9b('0xd')](_0x9f9b('0x8'),auth[_0x9f9b('0x9')](),controller[_0x9f9b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x34ac=['get','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x5ddc42,_0x5615ea){var _0x36bc75=function(_0x578150){while(--_0x578150){_0x5ddc42['push'](_0x5ddc42['shift']());}};_0x36bc75(++_0x5615ea);}(_0x34ac,0xe7));var _0xc34a=function(_0x348e31,_0x5713f4){_0x348e31=_0x348e31-0x0;var _0xd3fd8e=_0x34ac[_0x348e31];return _0xd3fd8e;};'use strict';var multer=require(_0xc34a('0x0'));var util=require(_0xc34a('0x1'));var path=require(_0xc34a('0x2'));var timeout=require(_0xc34a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc34a('0x4'));var auth=require(_0xc34a('0x5'));var interaction=require(_0xc34a('0x6'));var config=require(_0xc34a('0x7'));var controller=require(_0xc34a('0x8'));router[_0xc34a('0x9')](_0xc34a('0xa'),auth[_0xc34a('0xb')](),controller['show']);router['put']('/:id',auth[_0xc34a('0xb')](),controller[_0xc34a('0xc')]);router['delete']('/:id',auth[_0xc34a('0xb')](),controller[_0xc34a('0xd')]);module[_0xc34a('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 9a9fe1c..0f14780 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 _0x184c=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2b16e9,_0xfa271c){var _0x54fa32=function(_0xd04ade){while(--_0xd04ade){_0x2b16e9['push'](_0x2b16e9['shift']());}};_0x54fa32(++_0xfa271c);}(_0x184c,0x1c3));var _0xc184=function(_0x3f7a88,_0x17c43e){_0x3f7a88=_0x3f7a88-0x0;var _0x4fda88=_0x184c[_0x3f7a88];return _0x4fda88;};'use strict';var Sequelize=require(_0xc184('0x0'));module[_0xc184('0x1')]={'priority':{'type':Sequelize[_0xc184('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc184('0x3')],'allowNull':![],'defaultValue':_0xc184('0x4')},'appdata':{'type':Sequelize[_0xc184('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc184('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x25a5=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x3a18f3,_0xa6b079){var _0x431120=function(_0x3ce96e){while(--_0x3ce96e){_0x3a18f3['push'](_0x3a18f3['shift']());}};_0x431120(++_0xa6b079);}(_0x25a5,0xa2));var _0x525a=function(_0x4e5c44,_0x4865ee){_0x4e5c44=_0x4e5c44-0x0;var _0x50f8a3=_0x25a5[_0x4e5c44];return _0x50f8a3;};'use strict';var Sequelize=require(_0x525a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x525a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x525a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x525a('0x3')]()},'description':{'type':Sequelize[_0x525a('0x2')]},'interval':{'type':Sequelize[_0x525a('0x2')],'defaultValue':_0x525a('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 12e386f..4d67dfc 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 _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x781aa2,_0x27b779){var _0x6c19f3=function(_0x3f14a3){while(--_0x3f14a3){_0x781aa2['push'](_0x781aa2['shift']());}};_0x6c19f3(++_0x27b779);}(_0x9bde,0xe1));var _0xe9bd=function(_0x35ae65,_0x3235d3){_0x35ae65=_0x35ae65-0x0;var _0x29b347=_0x9bde[_0x35ae65];return _0x29b347;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x70e0,0x17b));var _0x070e=function(_0x17a462,_0x16fdef){_0x17a462=_0x17a462-0x0;var _0x46398a=_0x70e0[_0x17a462];return _0x46398a;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7fe254e..2215bea 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 _0x355d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x443cc5,_0x237fca){var _0x6271e9=function(_0x57a38){while(--_0x57a38){_0x443cc5['push'](_0x443cc5['shift']());}};_0x6271e9(++_0x237fca);}(_0x355d,0x15c));var _0xd355=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x355d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd355('0x0'));var logger=require(_0xd355('0x1'))(_0xd355('0x2'));var moment=require(_0xd355('0x3'));var BPromise=require(_0xd355('0x4'));var rp=require(_0xd355('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd355('0x6'));var config=require(_0xd355('0x7'));var attributes=require('./mailApplication.attributes');module[_0xd355('0x8')]=function(_0x14d9d9,_0x2f83ed){return _0x14d9d9[_0xd355('0x9')](_0xd355('0xa'),attributes,{'tableName':_0xd355('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd355('0xc'),'collate':_0xd355('0xd')});}; \ No newline at end of file +var _0x3da7=['lodash','util','api','moment','bluebird','request-promise','define','MailApplication','mail_applications'];(function(_0x317374,_0x16f47c){var _0x4db57a=function(_0x3a732){while(--_0x3a732){_0x317374['push'](_0x317374['shift']());}};_0x4db57a(++_0x16f47c);}(_0x3da7,0x90));var _0x73da=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x3da7[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x73da('0x0'));var util=require(_0x73da('0x1'));var logger=require('../../config/logger')(_0x73da('0x2'));var moment=require(_0x73da('0x3'));var BPromise=require(_0x73da('0x4'));var rp=require(_0x73da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x8d07f2,_0x11a231){return _0x8d07f2[_0x73da('0x6')](_0x73da('0x7'),attributes,{'tableName':_0x73da('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ae97fd5..ba1dc58 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 _0x47c6=['stringify','error','code','message','result','MailApplication','body','options','raw','attributes','limit','UpdateMailApplication','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2fd1de,_0x44e945){var _0x292851=function(_0x3c2192){while(--_0x3c2192){_0x2fd1de['push'](_0x2fd1de['shift']());}};_0x292851(++_0x44e945);}(_0x47c6,0x192));var _0x647c=function(_0x35bad0,_0x21927d){_0x35bad0=_0x35bad0-0x0;var _0x4fe50f=_0x47c6[_0x35bad0];return _0x4fe50f;};'use strict';var _=require('lodash');var util=require(_0x647c('0x0'));var moment=require(_0x647c('0x1'));var BPromise=require(_0x647c('0x2'));var rs=require(_0x647c('0x3'));var fs=require('fs');var Redis=require(_0x647c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x647c('0x5'));var logger=require(_0x647c('0x6'))(_0x647c('0x7'));var config=require(_0x647c('0x8'));var jayson=require(_0x647c('0x9'));var client=jayson[_0x647c('0xa')][_0x647c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30f620,_0x27c9aa,_0x53d4d0){return new BPromise(function(_0x2a56ac,_0x3f10ba){return client['request'](_0x30f620,_0x53d4d0)[_0x647c('0xc')](function(_0x4da5de){logger[_0x647c('0xd')](_0x647c('0xe'),_0x27c9aa,_0x647c('0xf'));logger[_0x647c('0x10')](_0x647c('0x11'),_0x27c9aa,'request\x20sent',JSON[_0x647c('0x12')](_0x4da5de));if(_0x4da5de[_0x647c('0x13')]){if(_0x4da5de[_0x647c('0x13')][_0x647c('0x14')]===0x1f4){logger[_0x647c('0x13')](_0x647c('0xe'),_0x27c9aa,_0x4da5de[_0x647c('0x13')][_0x647c('0x15')]);return _0x3f10ba(_0x4da5de['error'][_0x647c('0x15')]);}logger[_0x647c('0x13')](_0x647c('0xe'),_0x27c9aa,_0x4da5de[_0x647c('0x13')][_0x647c('0x15')]);return _0x2a56ac(_0x4da5de[_0x647c('0x13')][_0x647c('0x15')]);}else{logger[_0x647c('0xd')](_0x647c('0xe'),_0x27c9aa,_0x647c('0xf'));_0x2a56ac(_0x4da5de[_0x647c('0x16')]['message']);}})['catch'](function(_0x42031e){logger[_0x647c('0x13')](_0x647c('0xe'),_0x27c9aa,_0x42031e);_0x3f10ba(_0x42031e);});});}exports['UpdateMailApplication']=function(_0x5f1c92){var _0x1dad0b=this;return new Promise(function(_0x5ed95a,_0x1dfcfa){return db[_0x647c('0x17')]['update'](_0x5f1c92[_0x647c('0x18')],{'raw':_0x5f1c92[_0x647c('0x19')]?_0x5f1c92['options'][_0x647c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f1c92['options']?_0x5f1c92[_0x647c('0x19')]['where']||null:null,'attributes':_0x5f1c92[_0x647c('0x19')]?_0x5f1c92[_0x647c('0x19')][_0x647c('0x1b')]||null:null,'limit':_0x5f1c92['options']?_0x5f1c92[_0x647c('0x19')][_0x647c('0x1c')]||null:null})[_0x647c('0xc')](function(_0x49f5d9){logger[_0x647c('0xd')](_0x647c('0x1d'),_0x5f1c92);logger[_0x647c('0x10')]('UpdateMailApplication',_0x5f1c92,JSON['stringify'](_0x49f5d9));_0x5ed95a(_0x49f5d9);})['catch'](function(_0x4fe091){logger[_0x647c('0x13')](_0x647c('0x1d'),_0x4fe091['message'],_0x5f1c92);_0x1dfcfa(_0x1dad0b[_0x647c('0x13')](0x1f4,_0x4fe091[_0x647c('0x15')]));});});}; \ No newline at end of file +var _0x6a77=['options','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateMailApplication','body','raw'];(function(_0x306afa,_0x50b923){var _0x1b6d81=function(_0x499530){while(--_0x499530){_0x306afa['push'](_0x306afa['shift']());}};_0x1b6d81(++_0x50b923);}(_0x6a77,0xc1));var _0x76a7=function(_0x23df0a,_0x3aa851){_0x23df0a=_0x23df0a-0x0;var _0xa54d98=_0x6a77[_0x23df0a];return _0xa54d98;};'use strict';var _=require(_0x76a7('0x0'));var util=require(_0x76a7('0x1'));var moment=require(_0x76a7('0x2'));var BPromise=require(_0x76a7('0x3'));var rs=require(_0x76a7('0x4'));var fs=require('fs');var Redis=require(_0x76a7('0x5'));var db=require(_0x76a7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x76a7('0x7'));var config=require('../../config/environment');var jayson=require(_0x76a7('0x8'));var client=jayson[_0x76a7('0x9')][_0x76a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b3545,_0x4370f7,_0x20dbe5){return new BPromise(function(_0x1e42f3,_0x314ee3){return client['request'](_0x5b3545,_0x20dbe5)[_0x76a7('0xb')](function(_0x34204c){logger['info'](_0x76a7('0xc'),_0x4370f7,_0x76a7('0xd'));logger['debug'](_0x76a7('0xe'),_0x4370f7,_0x76a7('0xd'),JSON[_0x76a7('0xf')](_0x34204c));if(_0x34204c[_0x76a7('0x10')]){if(_0x34204c[_0x76a7('0x10')]['code']===0x1f4){logger[_0x76a7('0x10')]('MailApplication,\x20%s,\x20%s',_0x4370f7,_0x34204c[_0x76a7('0x10')]['message']);return _0x314ee3(_0x34204c['error'][_0x76a7('0x11')]);}logger[_0x76a7('0x10')](_0x76a7('0xc'),_0x4370f7,_0x34204c['error']['message']);return _0x1e42f3(_0x34204c[_0x76a7('0x10')][_0x76a7('0x11')]);}else{logger[_0x76a7('0x12')](_0x76a7('0xc'),_0x4370f7,'request\x20sent');_0x1e42f3(_0x34204c['result'][_0x76a7('0x11')]);}})[_0x76a7('0x13')](function(_0x1944db){logger[_0x76a7('0x10')]('MailApplication,\x20%s,\x20%s',_0x4370f7,_0x1944db);_0x314ee3(_0x1944db);});});}exports[_0x76a7('0x14')]=function(_0x35e648){var _0x9cabcb=this;return new Promise(function(_0x5cc0de,_0x35e52e){return db['MailApplication']['update'](_0x35e648[_0x76a7('0x15')],{'raw':_0x35e648['options']?_0x35e648['options'][_0x76a7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35e648[_0x76a7('0x17')]?_0x35e648[_0x76a7('0x17')][_0x76a7('0x18')]||null:null,'attributes':_0x35e648[_0x76a7('0x17')]?_0x35e648['options'][_0x76a7('0x19')]||null:null,'limit':_0x35e648[_0x76a7('0x17')]?_0x35e648[_0x76a7('0x17')]['limit']||null:null})[_0x76a7('0xb')](function(_0x5e02bf){logger[_0x76a7('0x12')](_0x76a7('0x14'),_0x35e648);logger[_0x76a7('0x1a')](_0x76a7('0x14'),_0x35e648,JSON[_0x76a7('0xf')](_0x5e02bf));_0x5cc0de(_0x5e02bf);})[_0x76a7('0x13')](function(_0x10dc12){logger['error'](_0x76a7('0x14'),_0x10dc12[_0x76a7('0x11')],_0x35e648);_0x35e52e(_0x9cabcb[_0x76a7('0x10')](0x1f4,_0x10dc12[_0x76a7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 6e6a76a..e3fe129 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 _0x71e2=['delete','mailinteraction:destroy','destroy','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','put','mail','mailinteraction:update','update'];(function(_0x1ff6a4,_0x1a0729){var _0x4b9301=function(_0x315d3f){while(--_0x315d3f){_0x1ff6a4['push'](_0x1ff6a4['shift']());}};_0x4b9301(++_0x1a0729);}(_0x71e2,0x99));var _0x271e=function(_0x3e820b,_0xcc2f78){_0x3e820b=_0x3e820b-0x0;var _0x15edf7=_0x71e2[_0x3e820b];return _0x15edf7;};'use strict';var express=require('express');var router=express[_0x271e('0x0')]();var auth=require(_0x271e('0x1'));var interaction=require(_0x271e('0x2'));var controller=require(_0x271e('0x3'));router['get']('/',auth[_0x271e('0x4')](),controller[_0x271e('0x5')]);router[_0x271e('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x271e('0x7')]);router['get'](_0x271e('0x8'),auth[_0x271e('0x4')](),controller[_0x271e('0x9')]);router[_0x271e('0x6')]('/:id/messages',auth[_0x271e('0x4')](),controller['getMessages']);router[_0x271e('0x6')](_0x271e('0xa'),auth[_0x271e('0x4')](),controller[_0x271e('0xb')]);router[_0x271e('0xc')]('/',auth['isAuthenticated'](),controller[_0x271e('0xd')]);router[_0x271e('0xc')]('/:id/messages',auth[_0x271e('0x4')](),controller[_0x271e('0xe')]);router['post'](_0x271e('0xf'),auth['isAuthenticated'](),interaction[_0x271e('0x10')]('mail',_0x271e('0x11')),controller['addTags']);router[_0x271e('0x12')](_0x271e('0x8'),auth[_0x271e('0x4')](),interaction[_0x271e('0x10')](_0x271e('0x13'),_0x271e('0x14')),controller[_0x271e('0x15')]);router[_0x271e('0x16')](_0x271e('0x8'),auth[_0x271e('0x4')](),interaction[_0x271e('0x10')](_0x271e('0x13'),_0x271e('0x17')),controller[_0x271e('0x18')]);router['delete'](_0x271e('0xf'),auth[_0x271e('0x4')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xccb0=['express','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags'];(function(_0x1ca0ed,_0x445d81){var _0x19e17c=function(_0x25c357){while(--_0x25c357){_0x1ca0ed['push'](_0x1ca0ed['shift']());}};_0x19e17c(++_0x445d81);}(_0xccb0,0x177));var _0x0ccb=function(_0x50b315,_0x471db5){_0x50b315=_0x50b315-0x0;var _0x3d342a=_0xccb0[_0x50b315];return _0x3d342a;};'use strict';var express=require(_0x0ccb('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0ccb('0x1'));var controller=require(_0x0ccb('0x2'));router[_0x0ccb('0x3')]('/',auth[_0x0ccb('0x4')](),controller['index']);router[_0x0ccb('0x3')](_0x0ccb('0x5'),auth['isAuthenticated'](),controller[_0x0ccb('0x6')]);router['get'](_0x0ccb('0x7'),auth[_0x0ccb('0x4')](),controller['show']);router[_0x0ccb('0x3')](_0x0ccb('0x8'),auth['isAuthenticated'](),controller[_0x0ccb('0x9')]);router['get'](_0x0ccb('0xa'),auth['isAuthenticated'](),controller[_0x0ccb('0xb')]);router[_0x0ccb('0xc')]('/',auth[_0x0ccb('0x4')](),controller[_0x0ccb('0xd')]);router[_0x0ccb('0xc')](_0x0ccb('0x8'),auth[_0x0ccb('0x4')](),controller['addMessage']);router['post'](_0x0ccb('0xe'),auth[_0x0ccb('0x4')](),interaction[_0x0ccb('0xf')](_0x0ccb('0x10'),_0x0ccb('0x11')),controller[_0x0ccb('0x12')]);router['put']('/:id',auth[_0x0ccb('0x4')](),interaction[_0x0ccb('0xf')](_0x0ccb('0x10'),_0x0ccb('0x13')),controller[_0x0ccb('0x14')]);router[_0x0ccb('0x15')]('/:id',auth[_0x0ccb('0x4')](),interaction[_0x0ccb('0xf')]('mail',_0x0ccb('0x16')),controller[_0x0ccb('0x17')]);router['delete'](_0x0ccb('0xe'),auth[_0x0ccb('0x4')](),controller[_0x0ccb('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 3a5146b..8459e5e 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 _0xae6c=['TEXT','long','ENUM','out','sequelize','iconv','BOOLEAN','DATE','STRING'];(function(_0x3c87a7,_0x67d072){var _0x38e1c0=function(_0x3f56a4){while(--_0x3f56a4){_0x3c87a7['push'](_0x3c87a7['shift']());}};_0x38e1c0(++_0x67d072);}(_0xae6c,0xd3));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xcae6('0x0'));var iconv=require(_0xcae6('0x1'));module['exports']={'closed':{'type':Sequelize[_0xcae6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcae6('0x3')]},'disposition':{'type':Sequelize[_0xcae6('0x4')]},'secondDisposition':{'type':Sequelize[_0xcae6('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xcae6('0x4')]},'inReplyTo':{'type':Sequelize[_0xcae6('0x4')](0x1fe)},'to':{'type':Sequelize[_0xcae6('0x4')]},'cc':{'type':Sequelize[_0xcae6('0x5')](_0xcae6('0x6'))},'subject':{'type':Sequelize[_0xcae6('0x5')]()},'attach':{'type':Sequelize[_0xcae6('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xcae6('0x3')]},'substatus':{'type':Sequelize[_0xcae6('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xcae6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcae6('0x7')]('in',_0xcae6('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcae6('0x7')]('in',_0xcae6('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcae6('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8aac=['out','ENUM','INTEGER','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x485a43,_0xea4833){var _0x5797c2=function(_0x57af0a){while(--_0x57af0a){_0x485a43['push'](_0x485a43['shift']());}};_0x5797c2(++_0xea4833);}(_0x8aac,0x71));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc8aa('0x0'));var iconv=require(_0xc8aa('0x1'));module['exports']={'closed':{'type':Sequelize[_0xc8aa('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8aa('0x3')]},'disposition':{'type':Sequelize[_0xc8aa('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc8aa('0x4')]},'note':{'type':Sequelize[_0xc8aa('0x4')]},'inReplyTo':{'type':Sequelize[_0xc8aa('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc8aa('0x4')]},'cc':{'type':Sequelize[_0xc8aa('0x5')](_0xc8aa('0x6'))},'subject':{'type':Sequelize[_0xc8aa('0x5')]()},'attach':{'type':Sequelize[_0xc8aa('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xc8aa('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc8aa('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc8aa('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc8aa('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc8aa('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc8aa('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc8aa('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 94f79ff..7c3469e 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 _0x26fd=['omit','getMessages','filters','hasOwnProperty','order','sort','where','pick','filter','$gte','split','format','include','inlineCss','true','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','removeTags','download','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachments','Messages','bcc','subject','createdAt','mkdirSync','from','missing.recipient@your.company.com','decode','headers','Bcc','message%d.eml','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','end','status','json','offset','undefined','limit','count','set','update','then','error','stack','name','send','map','MailInteraction','fieldName','type','key','getOptions','findAll','catch','show','model','rawAttributes','query','keys','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','params','destroy','describe','addMessage','MailMessage','ids'];(function(_0x14af6d,_0xcd93b9){var _0x49c300=function(_0x1d1a85){while(--_0x1d1a85){_0x14af6d['push'](_0x14af6d['shift']());}};_0x49c300(++_0xcd93b9);}(_0x26fd,0x96));var _0xd26f=function(_0x152999,_0x1dd83b){_0x152999=_0x152999-0x0;var _0x32ef67=_0x26fd[_0x152999];return _0x32ef67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd26f('0x0'));var zipdir=require(_0xd26f('0x1'));var moment=require(_0xd26f('0x2'));var BPromise=require(_0xd26f('0x3'));var util=require(_0xd26f('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xd26f('0x5'));var juice=require(_0xd26f('0x6'));var Redis=require(_0xd26f('0x7'));var interaction=require(_0xd26f('0x8'));var qs=require(_0xd26f('0x9'));var logger=require(_0xd26f('0xa'))('api');var config=require(_0xd26f('0xb'));var db=require(_0xd26f('0xc'))['db'];var htmlEntities=require(_0xd26f('0xd'));config[_0xd26f('0xe')]=_[_0xd26f('0xf')](config[_0xd26f('0xe')],{'host':_0xd26f('0x10'),'port':0x18eb});var socket=require(_0xd26f('0x11'))(new Redis(config[_0xd26f('0xe')]));require(_0xd26f('0x12'))['register'](socket);function respondWithStatusCode(_0x2b52a7,_0x17893d){_0x17893d=_0x17893d||0xcc;return function(_0x124186){if(_0x124186){return _0x2b52a7['sendStatus'](_0x17893d);}return _0x2b52a7['status'](_0x17893d)[_0xd26f('0x13')]();};}function respondWithResult(_0x121a43,_0x1881be){_0x1881be=_0x1881be||0xc8;return function(_0xbacc66){if(_0xbacc66){return _0x121a43[_0xd26f('0x14')](_0x1881be)[_0xd26f('0x15')](_0xbacc66);}};}function respondWithFilteredResult(_0x65b8d,_0x5d27e1){return function(_0x51a449){if(_0x51a449){var _0x8dafb5=typeof _0x5d27e1[_0xd26f('0x16')]===_0xd26f('0x17')&&typeof _0x5d27e1[_0xd26f('0x18')]===_0xd26f('0x17');var _0x2806cb=_0x51a449[_0xd26f('0x19')];var _0x44eb2e=_0x8dafb5?0x0:_0x5d27e1[_0xd26f('0x16')];var _0x31a499=_0x8dafb5?_0x51a449[_0xd26f('0x19')]:_0x5d27e1[_0xd26f('0x16')]+_0x5d27e1[_0xd26f('0x18')];var _0xabf773;if(_0x31a499>=_0x2806cb){_0x31a499=_0x2806cb;_0xabf773=0xc8;}else{_0xabf773=0xce;}_0x65b8d[_0xd26f('0x14')](_0xabf773);return _0x65b8d[_0xd26f('0x1a')]('Content-Range',_0x44eb2e+'-'+_0x31a499+'/'+_0x2806cb)[_0xd26f('0x15')](_0x51a449);}return null;};}function saveUpdates(_0x3d617e){return function(_0x3058ff){if(_0x3058ff){return _0x3058ff[_0xd26f('0x1b')](_0x3d617e)[_0xd26f('0x1c')](function(_0x528075){return _0x528075;});}return null;};}function removeEntity(_0x445163){return function(_0x341110){if(_0x341110){return _0x341110['destroy']()[_0xd26f('0x1c')](function(){_0x445163[_0xd26f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x387977){return function(_0x214a18){if(!_0x214a18){_0x387977['sendStatus'](0x194);}return _0x214a18;};}function handleError(_0x5b026e,_0x255eec){_0x255eec=_0x255eec||0x1f4;return function(_0x320a7f){logger[_0xd26f('0x1d')](_0x320a7f[_0xd26f('0x1e')]);if(_0x320a7f['name']){delete _0x320a7f[_0xd26f('0x1f')];}_0x5b026e[_0xd26f('0x14')](_0x255eec)[_0xd26f('0x20')](_0x320a7f);};}exports['index']=function(_0x463a2a,_0x33dce2){var _0x3ea413={};var _0x1fdcfa=_[_0xd26f('0x21')](db[_0xd26f('0x22')]['rawAttributes'],function(_0x5e39cc){return{'name':_0x5e39cc[_0xd26f('0x23')],'type':_0x5e39cc[_0xd26f('0x24')][_0xd26f('0x25')]};});_0x3ea413=qs[_0xd26f('0x26')](_0x1fdcfa,_0x463a2a);return interaction[_0xd26f('0x27')]('mail',_0x463a2a['query'],_0x463a2a['user'],_0x3ea413,_0x1fdcfa)[_0xd26f('0x1c')](respondWithFilteredResult(_0x33dce2,_0x3ea413))[_0xd26f('0x28')](handleError(_0x33dce2,null));};exports[_0xd26f('0x29')]=function(_0x19ec59,_0x1cba41){var _0x4fa607={'raw':![],'where':{'id':_0x19ec59['params']['id']}},_0x1a0c1b={};_0x1a0c1b[_0xd26f('0x2a')]=_['keys'](db['MailInteraction'][_0xd26f('0x2b')]);_0x1a0c1b[_0xd26f('0x2c')]=_[_0xd26f('0x2d')](_0x19ec59[_0xd26f('0x2c')]);_0x1a0c1b['filters']=_[_0xd26f('0x2e')](_0x1a0c1b[_0xd26f('0x2a')],_0x1a0c1b[_0xd26f('0x2c')]);_0x4fa607[_0xd26f('0x2f')]=_[_0xd26f('0x2e')](_0x1a0c1b[_0xd26f('0x2a')],qs[_0xd26f('0x30')](_0x19ec59[_0xd26f('0x2c')][_0xd26f('0x30')]));_0x4fa607[_0xd26f('0x2f')]=_0x4fa607[_0xd26f('0x2f')][_0xd26f('0x31')]?_0x4fa607[_0xd26f('0x2f')]:_0x1a0c1b['model'];if(_0x19ec59[_0xd26f('0x2c')][_0xd26f('0x32')]){_0x4fa607['include']=[{'all':!![]}];}_0x4fa607=_[_0xd26f('0x33')]({},_0x4fa607,_0x19ec59[_0xd26f('0x34')]);return db[_0xd26f('0x22')][_0xd26f('0x35')](_0x4fa607)[_0xd26f('0x1c')](handleEntityNotFound(_0x1cba41,null))[_0xd26f('0x1c')](respondWithResult(_0x1cba41,null))[_0xd26f('0x28')](handleError(_0x1cba41,null));};exports[_0xd26f('0x36')]=function(_0x2b0d12,_0x34d90b){return db[_0xd26f('0x22')][_0xd26f('0x36')](_0x2b0d12[_0xd26f('0x37')],{})['then'](respondWithResult(_0x34d90b,0xc9))['catch'](handleError(_0x34d90b,null));};exports['update']=function(_0x1b7b55,_0x2b8c2e){if(_0x1b7b55[_0xd26f('0x37')]['id']){delete _0x1b7b55['body']['id'];}return db[_0xd26f('0x22')][_0xd26f('0x35')]({'where':{'id':_0x1b7b55[_0xd26f('0x38')]['id']}})[_0xd26f('0x1c')](handleEntityNotFound(_0x2b8c2e,null))[_0xd26f('0x1c')](saveUpdates(_0x1b7b55['body'],null))[_0xd26f('0x1c')](respondWithResult(_0x2b8c2e,null))[_0xd26f('0x28')](handleError(_0x2b8c2e,null));};exports[_0xd26f('0x39')]=function(_0x1297e0,_0x1bced5){return db[_0xd26f('0x22')][_0xd26f('0x35')]({'where':{'id':_0x1297e0[_0xd26f('0x38')]['id']}})[_0xd26f('0x1c')](handleEntityNotFound(_0x1bced5,null))[_0xd26f('0x1c')](removeEntity(_0x1bced5,null))[_0xd26f('0x28')](handleError(_0x1bced5,null));};exports[_0xd26f('0x3a')]=function(_0x56d77c,_0xf44a23){return db[_0xd26f('0x22')][_0xd26f('0x3a')]()[_0xd26f('0x1c')](respondWithResult(_0xf44a23,null))[_0xd26f('0x28')](handleError(_0xf44a23,null));};exports[_0xd26f('0x3b')]=function(_0x574d51,_0x642b9e){return db[_0xd26f('0x3c')][_0xd26f('0x35')]({'where':{'id':_0x574d51[_0xd26f('0x38')]['id']}})['then'](handleEntityNotFound(_0x642b9e,null))[_0xd26f('0x1c')](function(_0xf49732){if(_0xf49732){return _0xf49732['addMessage'](_0x574d51[_0xd26f('0x37')][_0xd26f('0x3d')],_[_0xd26f('0x3e')](_0x574d51[_0xd26f('0x37')],[_0xd26f('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x642b9e,null))['catch'](handleError(_0x642b9e,null));};exports[_0xd26f('0x3f')]=function(_0x3a0963,_0x358a6e){var _0x30a480={'raw':![],'where':{}};var _0x3251a6={};var _0x61be1d={'count':0x0,'rows':[]};return db[_0xd26f('0x22')]['findOne']({'where':{'id':_0x3a0963[_0xd26f('0x38')]['id']}})[_0xd26f('0x1c')](handleEntityNotFound(_0x358a6e,null))[_0xd26f('0x1c')](function(_0x497d43){if(_0x497d43){_0x3251a6[_0xd26f('0x2a')]=_['keys'](db[_0xd26f('0x3c')][_0xd26f('0x2b')]);_0x3251a6['query']=_[_0xd26f('0x2d')](_0x3a0963[_0xd26f('0x2c')]);_0x3251a6[_0xd26f('0x40')]=_[_0xd26f('0x2e')](_0x3251a6[_0xd26f('0x2a')],_0x3251a6[_0xd26f('0x2c')]);_0x30a480[_0xd26f('0x2f')]=_[_0xd26f('0x2e')](_0x3251a6[_0xd26f('0x2a')],qs[_0xd26f('0x30')](_0x3a0963[_0xd26f('0x2c')]['fields']));_0x30a480[_0xd26f('0x2f')]=_0x30a480[_0xd26f('0x2f')][_0xd26f('0x31')]?_0x30a480['attributes']:_0x3251a6['model'];if(!_0x3a0963[_0xd26f('0x2c')][_0xd26f('0x41')]('nolimit')){_0x30a480[_0xd26f('0x18')]=qs[_0xd26f('0x18')](_0x3a0963['query'][_0xd26f('0x18')]);_0x30a480[_0xd26f('0x16')]=qs['offset'](_0x3a0963[_0xd26f('0x2c')][_0xd26f('0x16')]);}_0x30a480[_0xd26f('0x42')]=qs[_0xd26f('0x43')](_0x3a0963[_0xd26f('0x2c')][_0xd26f('0x43')]);_0x30a480[_0xd26f('0x44')]=qs[_0xd26f('0x40')](_[_0xd26f('0x45')](_0x3a0963[_0xd26f('0x2c')],_0x3251a6[_0xd26f('0x40')]));_0x30a480[_0xd26f('0x44')]['MailInteractionId']=_0x497d43['id'];if(_0x3a0963['query']['filter']){_0x30a480[_0xd26f('0x44')]=_['merge'](_0x30a480[_0xd26f('0x44')],{'$or':_[_0xd26f('0x21')](_0x30a480[_0xd26f('0x2f')],function(_0x1806cc){var _0x2bdf72={};_0x2bdf72[_0x1806cc]={'$like':'%'+_0x3a0963[_0xd26f('0x2c')][_0xd26f('0x46')]+'%'};return _0x2bdf72;})});}if(_0x3a0963[_0xd26f('0x2c')][_0xd26f('0x47')]){var _0x46cbd3=_0x3a0963['query'][_0xd26f('0x47')][_0xd26f('0x48')](',');var _0x2e5ac2={};_0x2e5ac2[_0x46cbd3[0x0]]={'$gte':moment(_0x46cbd3[0x1])[_0xd26f('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30a480[_0xd26f('0x44')]=_['merge'](_0x30a480[_0xd26f('0x44')],_0x2e5ac2);}_0x30a480=_[_0xd26f('0x33')]({},_0x30a480,_0x3a0963[_0xd26f('0x34')]);return db[_0xd26f('0x3c')][_0xd26f('0x19')]({'where':_0x30a480[_0xd26f('0x44')]})[_0xd26f('0x1c')](function(_0x1349fc){_0x61be1d[_0xd26f('0x19')]=_0x1349fc;if(_0x3a0963[_0xd26f('0x2c')][_0xd26f('0x32')]){_0x30a480[_0xd26f('0x4a')]=[{'all':!![]}];}return db[_0xd26f('0x3c')][_0xd26f('0x27')](_0x30a480);})['then'](function(_0x322a0d){if(_0x3a0963[_0xd26f('0x2c')][_0xd26f('0x4b')]===_0xd26f('0x4c')){for(var _0x1a166c=0x0;_0x1a166c<_0x322a0d[_0xd26f('0x31')];_0x1a166c++){_0x322a0d[_0x1a166c][_0xd26f('0x37')]=juice(_0x322a0d[_0x1a166c][_0xd26f('0x37')]);}}_0x61be1d['rows']=_0x322a0d;return _0x61be1d;});}})[_0xd26f('0x1c')](respondWithFilteredResult(_0x358a6e,_0x30a480))[_0xd26f('0x28')](handleError(_0x358a6e,null));};exports[_0xd26f('0x4d')]=function(_0x187d13,_0xfbbeff){return db[_0xd26f('0x22')]['find']({'where':{'id':_0x187d13[_0xd26f('0x38')]['id']}})[_0xd26f('0x1c')](handleEntityNotFound(_0xfbbeff,null))[_0xd26f('0x1c')](function(_0x375807){if(_0x375807){return _0x375807[_0xd26f('0x4e')](_0x187d13[_0xd26f('0x37')][_0xd26f('0x3d')],_[_0xd26f('0x3e')](_0x187d13['body'],['ids','id'])||{})[_0xd26f('0x4f')](function(){return db[_0xd26f('0x50')]['findAll']({'attributes':['id',_0xd26f('0x1f'),'color'],'where':{'id':_0x187d13['body']['ids']}});})[_0xd26f('0x1c')](function(_0x1979a6){socket[_0xd26f('0x51')](_0xd26f('0x52'),{'id':Number(_0x187d13[_0xd26f('0x38')]['id']),'tags':_0x1979a6||[]});return{'id':Number(_0x187d13['params']['id']),'tags':_0x1979a6||[]};});}})['then'](respondWithResult(_0xfbbeff,null))[_0xd26f('0x28')](handleError(_0xfbbeff,null));};exports[_0xd26f('0x53')]=function(_0x1823a9,_0x361c43){return db[_0xd26f('0x22')][_0xd26f('0x35')]({'where':{'id':_0x1823a9['params']['id']}})[_0xd26f('0x1c')](handleEntityNotFound(_0x361c43,null))[_0xd26f('0x1c')](function(_0x149080){if(_0x149080){return _0x149080[_0xd26f('0x53')](_0x1823a9[_0xd26f('0x2c')][_0xd26f('0x3d')]);}})['then'](respondWithStatusCode(_0x361c43,null))[_0xd26f('0x28')](handleError(_0x361c43,null));};exports[_0xd26f('0x54')]=function(_0x444ca2,_0x583511){var _0x1001ec=moment()['unix']()['toString']();var _0x2358dd=path['join'](config['root'],_0xd26f('0x55'),_0xd26f('0x56'),_0xd26f('0x57'));var _0x411d52=path[_0xd26f('0x58')](config['root'],_0xd26f('0x55'),_0xd26f('0x56'),_0xd26f('0x59'));var _0x2b25bf=path['join'](_0x2358dd,_0x1001ec);var _0x12c3e8=util['format'](_0xd26f('0x5a'),_0x444ca2[_0xd26f('0x38')]['id'],_0x1001ec);var _0x341ef0=path[_0xd26f('0x58')](_0x2358dd,_0x12c3e8);var _0x351430=[];if(_0x444ca2[_0xd26f('0x2c')][_0xd26f('0x59')]){_0x351430[_0xd26f('0x5b')]({'model':db['Attachment'],'as':_0xd26f('0x5c'),'raw':!![]});}var _0x45efe3=[{'model':db['MailMessage'],'as':_0xd26f('0x5d'),'attributes':['id',_0xd26f('0x37'),'from','to','cc',_0xd26f('0x5e'),_0xd26f('0x5f'),_0xd26f('0x60')],'where':{'secret':![]},'order':qs[_0xd26f('0x43')]('id'),'include':_0x351430}];return db[_0xd26f('0x22')][_0xd26f('0x35')]({'where':{'id':_0x444ca2[_0xd26f('0x38')]['id']},'include':_0x45efe3})[_0xd26f('0x1c')](handleEntityNotFound(_0x583511,null))[_0xd26f('0x1c')](function(_0x2cf9e9){if(_0x2cf9e9&&_0x2cf9e9[_0xd26f('0x5d')]){var _0x5cef47=_0x2cf9e9['get']({'plain':!![]});fs[_0xd26f('0x61')](_0x2b25bf);return BPromise['each'](_0x5cef47[_0xd26f('0x5d')],function(_0x53ae2d,_0x2c2197){var _0x5e43c6={'from':_0x53ae2d[_0xd26f('0x62')],'to':_0x53ae2d['to']||_0xd26f('0x63'),'subject':_0x53ae2d[_0xd26f('0x5f')],'html':htmlEntities[_0xd26f('0x64')](_0x53ae2d['body']),'headers':{'Date':moment(_0x53ae2d['createdAt'])[_0xd26f('0x49')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x53ae2d['cc']){_0x5e43c6[_0xd26f('0x65')]['Cc']=_0x53ae2d['cc'];}if(_0x53ae2d['bcc']){_0x5e43c6[_0xd26f('0x65')][_0xd26f('0x66')]=_0x53ae2d[_0xd26f('0x5e')];}return new BPromise(function(_0x50217c,_0x148d18){if(_0x53ae2d[_0xd26f('0x5c')]){for(var _0x509e13=0x0;_0x509e13<_0x53ae2d[_0xd26f('0x5c')][_0xd26f('0x31')];_0x509e13++){var _0x7d359=_0x53ae2d[_0xd26f('0x5c')][_0x509e13];var _0x3fdfba=path[_0xd26f('0x58')](_0x411d52,_0x7d359['basename']);if(fs['existsSync'](_0x3fdfba)){_0x5e43c6[_0xd26f('0x59')][_0xd26f('0x5b')]({'name':_0x7d359[_0xd26f('0x1f')],'contentType':_0x7d359[_0xd26f('0x24')],'data':fs['readFileSync'](_0x3fdfba)});}}}emlformat['build'](_0x5e43c6,function(_0x46139c,_0x41a092){if(_0x46139c)return _0x148d18(_0x46139c);fs['writeFileSync'](path['join'](_0x2b25bf,util[_0xd26f('0x49')](_0xd26f('0x67'),_0x2c2197)),_0x41a092);return _0x50217c(_0x41a092);});});})['then'](function(){return new BPromise(function(_0x5a4377,_0x7fbb6d){zipdir(_0x2b25bf,{'saveTo':_0x341ef0},function(_0x38c350,_0x427c01){if(_0x38c350)return _0x7fbb6d(_0x38c350);return _0x5a4377(_0x427c01);});})[_0xd26f('0x1c')](function(){return new BPromise(function(_0x24c550,_0x5f7cd0){rimraf(_0x2b25bf,function(_0x195f65){if(_0x195f65)_0x5f7cd0(_0x195f65);return _0x24c550();});});})['then'](function(){return _0x583511['download'](_0x341ef0,_0x12c3e8,function(_0x247ca6){if(!_0x247ca6)fs[_0xd26f('0x68')](_0x341ef0);});});});}else{return _0x583511[_0xd26f('0x69')](0xc8);}})['catch'](handleError(_0x583511,null));}; \ No newline at end of file +var _0xedec=['juice','ioredis','../../components/interaction/service','../../config/logger','../../mysqldb','html-entities','redis','localhost','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','mail','query','user','catch','show','params','keys','intersection','model','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','ids','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','findAll','inlineCss','true','rows','addTags','setTags','omit','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','attachments','transcript-%d-%s.zip','push','Attachments','from','bcc','createdAt','Messages','get','each','missing.recipient@your.company.com','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','lodash'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xedec,0x1be));var _0xcede=function(_0x4ae2fb,_0x1c1c67){_0x4ae2fb=_0x4ae2fb-0x0;var _0x4f5268=_0xedec[_0x4ae2fb];return _0x4f5268;};'use strict';var emlformat=require(_0xcede('0x0'));var rimraf=require(_0xcede('0x1'));var zipdir=require(_0xcede('0x2'));var moment=require('moment');var BPromise=require(_0xcede('0x3'));var util=require(_0xcede('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xcede('0x5'));var juice=require(_0xcede('0x6'));var Redis=require(_0xcede('0x7'));var interaction=require(_0xcede('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xcede('0x9'))('api');var config=require('../../config/environment');var db=require(_0xcede('0xa'))['db'];var htmlEntities=require(_0xcede('0xb'));config[_0xcede('0xc')]=_['defaults'](config[_0xcede('0xc')],{'host':_0xcede('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcede('0xe'))[_0xcede('0xf')](socket);function respondWithStatusCode(_0x265658,_0x53c86a){_0x53c86a=_0x53c86a||0xcc;return function(_0x4d5905){if(_0x4d5905){return _0x265658['sendStatus'](_0x53c86a);}return _0x265658[_0xcede('0x10')](_0x53c86a)['end']();};}function respondWithResult(_0x81919b,_0x5a5c4c){_0x5a5c4c=_0x5a5c4c||0xc8;return function(_0x46d5b0){if(_0x46d5b0){return _0x81919b[_0xcede('0x10')](_0x5a5c4c)[_0xcede('0x11')](_0x46d5b0);}};}function respondWithFilteredResult(_0x46e428,_0x485e28){return function(_0x7e5ac1){if(_0x7e5ac1){var _0xbae630=typeof _0x485e28[_0xcede('0x12')]===_0xcede('0x13')&&typeof _0x485e28[_0xcede('0x14')]===_0xcede('0x13');var _0x4093d6=_0x7e5ac1[_0xcede('0x15')];var _0xaf41b6=_0xbae630?0x0:_0x485e28['offset'];var _0x2adf4f=_0xbae630?_0x7e5ac1[_0xcede('0x15')]:_0x485e28[_0xcede('0x12')]+_0x485e28['limit'];var _0x62b594;if(_0x2adf4f>=_0x4093d6){_0x2adf4f=_0x4093d6;_0x62b594=0xc8;}else{_0x62b594=0xce;}_0x46e428[_0xcede('0x10')](_0x62b594);return _0x46e428['set'](_0xcede('0x16'),_0xaf41b6+'-'+_0x2adf4f+'/'+_0x4093d6)[_0xcede('0x11')](_0x7e5ac1);}return null;};}function saveUpdates(_0x138338){return function(_0x27e91e){if(_0x27e91e){return _0x27e91e[_0xcede('0x17')](_0x138338)['then'](function(_0x102afa){return _0x102afa;});}return null;};}function removeEntity(_0x1d62d4){return function(_0x1db290){if(_0x1db290){return _0x1db290[_0xcede('0x18')]()[_0xcede('0x19')](function(){_0x1d62d4[_0xcede('0x10')](0xcc)[_0xcede('0x1a')]();});}};}function handleEntityNotFound(_0x304d05){return function(_0x38f009){if(!_0x38f009){_0x304d05[_0xcede('0x1b')](0x194);}return _0x38f009;};}function handleError(_0xdfe74a,_0x3dccce){_0x3dccce=_0x3dccce||0x1f4;return function(_0x16963c){logger[_0xcede('0x1c')](_0x16963c[_0xcede('0x1d')]);if(_0x16963c[_0xcede('0x1e')]){delete _0x16963c[_0xcede('0x1e')];}_0xdfe74a[_0xcede('0x10')](_0x3dccce)[_0xcede('0x1f')](_0x16963c);};}exports[_0xcede('0x20')]=function(_0x4ecc21,_0x30c393){var _0x5e3f8c={};var _0x32ba36=_[_0xcede('0x21')](db[_0xcede('0x22')][_0xcede('0x23')],function(_0x592cf6){return{'name':_0x592cf6[_0xcede('0x24')],'type':_0x592cf6[_0xcede('0x25')][_0xcede('0x26')]};});_0x5e3f8c=qs['getOptions'](_0x32ba36,_0x4ecc21);return interaction['findAll'](_0xcede('0x27'),_0x4ecc21[_0xcede('0x28')],_0x4ecc21[_0xcede('0x29')],_0x5e3f8c,_0x32ba36)[_0xcede('0x19')](respondWithFilteredResult(_0x30c393,_0x5e3f8c))[_0xcede('0x2a')](handleError(_0x30c393,null));};exports[_0xcede('0x2b')]=function(_0x41d9b7,_0x3d1435){var _0x19ffc1={'raw':![],'where':{'id':_0x41d9b7[_0xcede('0x2c')]['id']}},_0x1058f5={};_0x1058f5['model']=_[_0xcede('0x2d')](db['MailInteraction'][_0xcede('0x23')]);_0x1058f5['query']=_[_0xcede('0x2d')](_0x41d9b7['query']);_0x1058f5['filters']=_[_0xcede('0x2e')](_0x1058f5[_0xcede('0x2f')],_0x1058f5[_0xcede('0x28')]);_0x19ffc1[_0xcede('0x30')]=_[_0xcede('0x2e')](_0x1058f5[_0xcede('0x2f')],qs[_0xcede('0x31')](_0x41d9b7[_0xcede('0x28')][_0xcede('0x31')]));_0x19ffc1[_0xcede('0x30')]=_0x19ffc1[_0xcede('0x30')][_0xcede('0x32')]?_0x19ffc1[_0xcede('0x30')]:_0x1058f5[_0xcede('0x2f')];if(_0x41d9b7['query'][_0xcede('0x33')]){_0x19ffc1[_0xcede('0x34')]=[{'all':!![]}];}_0x19ffc1=_[_0xcede('0x35')]({},_0x19ffc1,_0x41d9b7[_0xcede('0x36')]);return db[_0xcede('0x22')]['find'](_0x19ffc1)[_0xcede('0x19')](handleEntityNotFound(_0x3d1435,null))[_0xcede('0x19')](respondWithResult(_0x3d1435,null))[_0xcede('0x2a')](handleError(_0x3d1435,null));};exports[_0xcede('0x37')]=function(_0x1eea63,_0x3f4239){return db[_0xcede('0x22')][_0xcede('0x37')](_0x1eea63[_0xcede('0x38')],{})['then'](respondWithResult(_0x3f4239,0xc9))['catch'](handleError(_0x3f4239,null));};exports['update']=function(_0xa16bcf,_0x37e220){if(_0xa16bcf[_0xcede('0x38')]['id']){delete _0xa16bcf[_0xcede('0x38')]['id'];}return db[_0xcede('0x22')]['find']({'where':{'id':_0xa16bcf[_0xcede('0x2c')]['id']}})[_0xcede('0x19')](handleEntityNotFound(_0x37e220,null))[_0xcede('0x19')](saveUpdates(_0xa16bcf[_0xcede('0x38')],null))[_0xcede('0x19')](respondWithResult(_0x37e220,null))[_0xcede('0x2a')](handleError(_0x37e220,null));};exports['destroy']=function(_0x765baf,_0x3d08d1){return db[_0xcede('0x22')][_0xcede('0x39')]({'where':{'id':_0x765baf['params']['id']}})[_0xcede('0x19')](handleEntityNotFound(_0x3d08d1,null))[_0xcede('0x19')](removeEntity(_0x3d08d1,null))[_0xcede('0x2a')](handleError(_0x3d08d1,null));};exports[_0xcede('0x3a')]=function(_0x3ad16c,_0x142c70){return db[_0xcede('0x22')]['describe']()[_0xcede('0x19')](respondWithResult(_0x142c70,null))[_0xcede('0x2a')](handleError(_0x142c70,null));};exports[_0xcede('0x3b')]=function(_0x451a47,_0x245188){return db['MailMessage'][_0xcede('0x39')]({'where':{'id':_0x451a47[_0xcede('0x2c')]['id']}})['then'](handleEntityNotFound(_0x245188,null))['then'](function(_0x4427ae){if(_0x4427ae){return _0x4427ae[_0xcede('0x3b')](_0x451a47['body'][_0xcede('0x3c')],_['omit'](_0x451a47[_0xcede('0x38')],[_0xcede('0x3c'),'id'])||{});}})[_0xcede('0x19')](respondWithResult(_0x245188,null))[_0xcede('0x2a')](handleError(_0x245188,null));};exports['getMessages']=function(_0x2df002,_0x105d56){var _0x27cee1={'raw':![],'where':{}};var _0x1e78e8={};var _0x2495b8={'count':0x0,'rows':[]};return db[_0xcede('0x22')][_0xcede('0x3d')]({'where':{'id':_0x2df002[_0xcede('0x2c')]['id']}})['then'](handleEntityNotFound(_0x105d56,null))[_0xcede('0x19')](function(_0x3f4be3){if(_0x3f4be3){_0x1e78e8['model']=_['keys'](db['MailMessage'][_0xcede('0x23')]);_0x1e78e8['query']=_[_0xcede('0x2d')](_0x2df002[_0xcede('0x28')]);_0x1e78e8[_0xcede('0x3e')]=_[_0xcede('0x2e')](_0x1e78e8[_0xcede('0x2f')],_0x1e78e8[_0xcede('0x28')]);_0x27cee1[_0xcede('0x30')]=_[_0xcede('0x2e')](_0x1e78e8[_0xcede('0x2f')],qs[_0xcede('0x31')](_0x2df002[_0xcede('0x28')][_0xcede('0x31')]));_0x27cee1[_0xcede('0x30')]=_0x27cee1[_0xcede('0x30')][_0xcede('0x32')]?_0x27cee1['attributes']:_0x1e78e8[_0xcede('0x2f')];if(!_0x2df002[_0xcede('0x28')][_0xcede('0x3f')](_0xcede('0x40'))){_0x27cee1[_0xcede('0x14')]=qs[_0xcede('0x14')](_0x2df002[_0xcede('0x28')][_0xcede('0x14')]);_0x27cee1[_0xcede('0x12')]=qs[_0xcede('0x12')](_0x2df002[_0xcede('0x28')][_0xcede('0x12')]);}_0x27cee1[_0xcede('0x41')]=qs[_0xcede('0x42')](_0x2df002[_0xcede('0x28')][_0xcede('0x42')]);_0x27cee1[_0xcede('0x43')]=qs[_0xcede('0x3e')](_[_0xcede('0x44')](_0x2df002[_0xcede('0x28')],_0x1e78e8['filters']));_0x27cee1[_0xcede('0x43')][_0xcede('0x45')]=_0x3f4be3['id'];if(_0x2df002[_0xcede('0x28')][_0xcede('0x46')]){_0x27cee1['where']=_[_0xcede('0x35')](_0x27cee1[_0xcede('0x43')],{'$or':_[_0xcede('0x21')](_0x27cee1[_0xcede('0x30')],function(_0x5418a7){var _0x5dc400={};_0x5dc400[_0x5418a7]={'$like':'%'+_0x2df002[_0xcede('0x28')][_0xcede('0x46')]+'%'};return _0x5dc400;})});}if(_0x2df002['query'][_0xcede('0x47')]){var _0x46573c=_0x2df002[_0xcede('0x28')][_0xcede('0x47')][_0xcede('0x48')](',');var _0x1ef56c={};_0x1ef56c[_0x46573c[0x0]]={'$gte':moment(_0x46573c[0x1])[_0xcede('0x49')](_0xcede('0x4a'))};_0x27cee1[_0xcede('0x43')]=_[_0xcede('0x35')](_0x27cee1[_0xcede('0x43')],_0x1ef56c);}_0x27cee1=_[_0xcede('0x35')]({},_0x27cee1,_0x2df002['options']);return db[_0xcede('0x4b')][_0xcede('0x15')]({'where':_0x27cee1[_0xcede('0x43')]})[_0xcede('0x19')](function(_0x145a1d){_0x2495b8[_0xcede('0x15')]=_0x145a1d;if(_0x2df002[_0xcede('0x28')]['includeAll']){_0x27cee1[_0xcede('0x34')]=[{'all':!![]}];}return db['MailMessage'][_0xcede('0x4c')](_0x27cee1);})[_0xcede('0x19')](function(_0x92b6b){if(_0x2df002[_0xcede('0x28')][_0xcede('0x4d')]===_0xcede('0x4e')){for(var _0x3d901b=0x0;_0x3d901b<_0x92b6b[_0xcede('0x32')];_0x3d901b++){_0x92b6b[_0x3d901b][_0xcede('0x38')]=juice(_0x92b6b[_0x3d901b][_0xcede('0x38')]);}}_0x2495b8[_0xcede('0x4f')]=_0x92b6b;return _0x2495b8;});}})[_0xcede('0x19')](respondWithFilteredResult(_0x105d56,_0x27cee1))[_0xcede('0x2a')](handleError(_0x105d56,null));};exports[_0xcede('0x50')]=function(_0x4d9a4e,_0x3c626e){return db['MailInteraction']['find']({'where':{'id':_0x4d9a4e[_0xcede('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3c626e,null))[_0xcede('0x19')](function(_0x2e4212){if(_0x2e4212){return _0x2e4212[_0xcede('0x51')](_0x4d9a4e[_0xcede('0x38')]['ids'],_[_0xcede('0x52')](_0x4d9a4e[_0xcede('0x38')],[_0xcede('0x3c'),'id'])||{})[_0xcede('0x53')](function(){return db[_0xcede('0x54')][_0xcede('0x4c')]({'attributes':['id',_0xcede('0x1e'),'color'],'where':{'id':_0x4d9a4e[_0xcede('0x38')][_0xcede('0x3c')]}});})[_0xcede('0x19')](function(_0x13e760){socket[_0xcede('0x55')](_0xcede('0x56'),{'id':Number(_0x4d9a4e['params']['id']),'tags':_0x13e760||[]});return{'id':Number(_0x4d9a4e[_0xcede('0x2c')]['id']),'tags':_0x13e760||[]};});}})['then'](respondWithResult(_0x3c626e,null))[_0xcede('0x2a')](handleError(_0x3c626e,null));};exports['removeTags']=function(_0x241dfc,_0x1e84cd){return db[_0xcede('0x22')]['find']({'where':{'id':_0x241dfc[_0xcede('0x2c')]['id']}})[_0xcede('0x19')](handleEntityNotFound(_0x1e84cd,null))[_0xcede('0x19')](function(_0x22e3d7){if(_0x22e3d7){return _0x22e3d7[_0xcede('0x57')](_0x241dfc[_0xcede('0x28')][_0xcede('0x3c')]);}})[_0xcede('0x19')](respondWithStatusCode(_0x1e84cd,null))['catch'](handleError(_0x1e84cd,null));};exports[_0xcede('0x58')]=function(_0x13e489,_0x275361){var _0x3a88d2=moment()[_0xcede('0x59')]()[_0xcede('0x5a')]();var _0x4ddb16=path[_0xcede('0x5b')](config[_0xcede('0x5c')],'server',_0xcede('0x5d'),'tmp');var _0x4ea74e=path[_0xcede('0x5b')](config[_0xcede('0x5c')],'server',_0xcede('0x5d'),_0xcede('0x5e'));var _0x2d1cd3=path[_0xcede('0x5b')](_0x4ddb16,_0x3a88d2);var _0x13876d=util[_0xcede('0x49')](_0xcede('0x5f'),_0x13e489[_0xcede('0x2c')]['id'],_0x3a88d2);var _0x1a2811=path[_0xcede('0x5b')](_0x4ddb16,_0x13876d);var _0x1e49f3=[];if(_0x13e489[_0xcede('0x28')][_0xcede('0x5e')]){_0x1e49f3[_0xcede('0x60')]({'model':db['Attachment'],'as':_0xcede('0x61'),'raw':!![]});}var _0x2bc888=[{'model':db[_0xcede('0x4b')],'as':'Messages','attributes':['id','body',_0xcede('0x62'),'to','cc',_0xcede('0x63'),'subject',_0xcede('0x64')],'where':{'secret':![]},'order':qs[_0xcede('0x42')]('id'),'include':_0x1e49f3}];return db[_0xcede('0x22')]['find']({'where':{'id':_0x13e489[_0xcede('0x2c')]['id']},'include':_0x2bc888})[_0xcede('0x19')](handleEntityNotFound(_0x275361,null))[_0xcede('0x19')](function(_0x20d8eb){if(_0x20d8eb&&_0x20d8eb[_0xcede('0x65')]){var _0x343315=_0x20d8eb[_0xcede('0x66')]({'plain':!![]});fs['mkdirSync'](_0x2d1cd3);return BPromise[_0xcede('0x67')](_0x343315[_0xcede('0x65')],function(_0x596c57,_0x410e97){var _0x30dcbc={'from':_0x596c57[_0xcede('0x62')],'to':_0x596c57['to']||_0xcede('0x68'),'subject':_0x596c57[_0xcede('0x69')],'html':htmlEntities['decode'](_0x596c57[_0xcede('0x38')]),'headers':{'Date':moment(_0x596c57[_0xcede('0x64')])['format'](_0xcede('0x6a'))},'attachments':[]};if(_0x596c57['cc']){_0x30dcbc[_0xcede('0x6b')]['Cc']=_0x596c57['cc'];}if(_0x596c57[_0xcede('0x63')]){_0x30dcbc[_0xcede('0x6b')][_0xcede('0x6c')]=_0x596c57['bcc'];}return new BPromise(function(_0x3b142d,_0x44f9cf){if(_0x596c57[_0xcede('0x61')]){for(var _0x36fda8=0x0;_0x36fda8<_0x596c57[_0xcede('0x61')][_0xcede('0x32')];_0x36fda8++){var _0x3f4934=_0x596c57[_0xcede('0x61')][_0x36fda8];var _0x422a86=path['join'](_0x4ea74e,_0x3f4934['basename']);if(fs[_0xcede('0x6d')](_0x422a86)){_0x30dcbc[_0xcede('0x5e')][_0xcede('0x60')]({'name':_0x3f4934[_0xcede('0x1e')],'contentType':_0x3f4934[_0xcede('0x25')],'data':fs['readFileSync'](_0x422a86)});}}}emlformat[_0xcede('0x6e')](_0x30dcbc,function(_0x1fc644,_0x736907){if(_0x1fc644)return _0x44f9cf(_0x1fc644);fs['writeFileSync'](path[_0xcede('0x5b')](_0x2d1cd3,util[_0xcede('0x49')](_0xcede('0x6f'),_0x410e97)),_0x736907);return _0x3b142d(_0x736907);});});})[_0xcede('0x19')](function(){return new BPromise(function(_0x34974e,_0x45acee){zipdir(_0x2d1cd3,{'saveTo':_0x1a2811},function(_0x19ac25,_0x444085){if(_0x19ac25)return _0x45acee(_0x19ac25);return _0x34974e(_0x444085);});})[_0xcede('0x19')](function(){return new BPromise(function(_0x2f83f4,_0x28f861){rimraf(_0x2d1cd3,function(_0x35fa2a){if(_0x35fa2a)_0x28f861(_0x35fa2a);return _0x2f83f4();});});})[_0xcede('0x19')](function(){return _0x275361[_0xcede('0x58')](_0x1a2811,_0x13876d,function(_0x2df9b3){if(!_0x2df9b3)fs[_0xcede('0x70')](_0x1a2811);});});});}else{return _0x275361[_0xcede('0x1b')](0xc8);}})['catch'](handleError(_0x275361,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index ae60239..c381a91 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 _0x2b74=['hasOwnProperty','exports','../../mysqldb','MailInteraction','MailMessage','save','update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x3df822,_0x299495){var _0x4e457d=function(_0x68a45f){while(--_0x68a45f){_0x3df822['push'](_0x3df822['shift']());}};_0x4e457d(++_0x299495);}(_0x2b74,0xd4));var _0x42b7=function(_0x4ad047,_0x1d7e61){_0x4ad047=_0x4ad047-0x0;var _0x1ab662=_0x2b74[_0x4ad047];return _0x1ab662;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x42b7('0x0'))['db'][_0x42b7('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x42b7('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x42b7('0x3'),'afterUpdate':_0x42b7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x264aa9){return function(_0xfc981b,_0x12ff51,_0x46625d){_0xfc981b['getUsers']({'attributes':['id'],'raw':!![]})[_0x42b7('0x5')](function(_0x81115b){_0xfc981b[_0x42b7('0x6')](_0x42b7('0x7'),_0x81115b[_0x42b7('0x8')](function(_0x38b94d){return{'id':_0x38b94d['id']};}));return MailMessage[_0x42b7('0x9')]({'where':{'MailInteractionId':_0xfc981b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x42b7('0x5')](function(_0x26f589){_0xfc981b['setDataValue'](_0x42b7('0xa'),_0x26f589[_0x42b7('0xb')]);MailInteractionEvents[_0x42b7('0xc')](_0x264aa9+':'+_0xfc981b['id'],_0xfc981b);MailInteractionEvents[_0x42b7('0xc')](_0x264aa9,_0xfc981b);_0x46625d(null);})['catch'](_0x46625d(null));};}for(var e in events){if(events[_0x42b7('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x42b7('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x335f=['../../mysqldb','MailInteraction','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x1d1f4d,_0x8583d2){var _0x472ffa=function(_0x1aa8fe){while(--_0x1aa8fe){_0x1d1f4d['push'](_0x1d1f4d['shift']());}};_0x472ffa(++_0x8583d2);}(_0x335f,0xfb));var _0xf335=function(_0x289b42,_0x43db5){_0x289b42=_0x289b42-0x0;var _0x3171e8=_0x335f[_0x289b42];return _0x3171e8;};'use strict';var EventEmitter=require(_0xf335('0x0'));var MailInteraction=require(_0xf335('0x1'))['db'][_0xf335('0x2')];var MailMessage=require(_0xf335('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf335('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf335('0x4'),'afterDestroy':_0xf335('0x5')};function emitEvent(_0x3dd964){return function(_0x3a7c6e,_0x18971f,_0x386c51){_0x3a7c6e[_0xf335('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x563afe){_0x3a7c6e[_0xf335('0x7')](_0xf335('0x8'),_0x563afe[_0xf335('0x9')](function(_0xa11d5a){return{'id':_0xa11d5a['id']};}));return MailMessage[_0xf335('0xa')]({'where':{'MailInteractionId':_0x3a7c6e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf335('0xb')](function(_0x3e349b){_0x3a7c6e[_0xf335('0x7')]('unreadMessages',_0x3e349b[_0xf335('0xc')]);MailInteractionEvents[_0xf335('0xd')](_0x3dd964+':'+_0x3a7c6e['id'],_0x3a7c6e);MailInteractionEvents['emit'](_0x3dd964,_0x3a7c6e);_0x386c51(null);})[_0xf335('0xe')](_0x386c51(null));};}for(var e in events){if(events[_0xf335('0xf')](e)){var event=events[e];MailInteraction[_0xf335('0x10')](e,emitEvent(event));}}module[_0xf335('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 5554a50..ebe9f23 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 _0x4038=['then','catch','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','MailMessage'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4038,0xb9));var _0x8403=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x4038[_0x1ac120];return _0x19b703;};'use strict';var _=require('lodash');var util=require(_0x8403('0x0'));var logger=require(_0x8403('0x1'))(_0x8403('0x2'));var moment=require(_0x8403('0x3'));var BPromise=require(_0x8403('0x4'));var rp=require(_0x8403('0x5'));var fs=require('fs');var path=require(_0x8403('0x6'));var rimraf=require(_0x8403('0x7'));var config=require(_0x8403('0x8'));var attributes=require(_0x8403('0x9'));module[_0x8403('0xa')]=function(_0x2cd93f,_0x5ba744){return _0x2cd93f[_0x8403('0xb')](_0x8403('0xc'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x8403('0xd'),'fields':['subject','to'],'type':_0x8403('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2a797e,_0x184ce4,_0x55694c){if(_0x2a797e[_0x8403('0xf')]){_0x2a797e[_0x8403('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2a797e[_0x8403('0x11')]){_0x2a797e[_0x8403('0x12')]=moment()[_0x8403('0x13')](_0x8403('0x14'));}_0x55694c(null,_0x184ce4);},'beforeUpdate':function(_0x5d5a45,_0x1d7ae8,_0x5a39c2){if(_0x5d5a45[_0x8403('0x15')](_0x8403('0xf'))){_0x5d5a45[_0x8403('0x10')]=_0x5d5a45[_0x8403('0xf')]?moment()[_0x8403('0x13')](_0x8403('0x14')):null;}if(_0x5d5a45['changed'](_0x8403('0x11'))){_0x5d5a45[_0x8403('0x12')]=moment()[_0x8403('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d5a45[_0x8403('0xf')]=null;_0x5d5a45[_0x8403('0x10')]=null;}_0x5a39c2(null,_0x5d5a45);},'afterUpdate':function(_0x1fed99,_0x40ec79,_0x51ffd5){var _0x18aa08=_0x2cd93f['models'];var _0x3d67b3=_0x1fed99['get']({'plain':!![]});if(_0x3d67b3[_0x8403('0x11')]){return _0x18aa08[_0x8403('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3d67b3['id']}})[_0x8403('0x17')](function(){_0x51ffd5();})[_0x8403('0x18')](function(_0x4f0dc3){_0x51ffd5(_0x4f0dc3);});}else{_0x51ffd5();}}},'charset':_0x8403('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6740=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','get','update','then'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6740,0x16e));var _0x0674=function(_0x3a3add,_0x5589b3){_0x3a3add=_0x3a3add-0x0;var _0x532b6a=_0x6740[_0x3a3add];return _0x532b6a;};'use strict';var _=require(_0x0674('0x0'));var util=require(_0x0674('0x1'));var logger=require('../../config/logger')(_0x0674('0x2'));var moment=require(_0x0674('0x3'));var BPromise=require(_0x0674('0x4'));var rp=require(_0x0674('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0674('0x6'));var config=require(_0x0674('0x7'));var attributes=require(_0x0674('0x8'));module[_0x0674('0x9')]=function(_0xbc288e,_0x338ce2){return _0xbc288e[_0x0674('0xa')](_0x0674('0xb'),attributes,{'tableName':_0x0674('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x0674('0xd'),'to'],'type':_0x0674('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3775d9,_0x1e2ca7,_0x4c5c8c){if(_0x3775d9[_0x0674('0xf')]){_0x3775d9[_0x0674('0x10')]=moment()[_0x0674('0x11')](_0x0674('0x12'));}if(_0x3775d9[_0x0674('0x13')]){_0x3775d9['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4c5c8c(null,_0x1e2ca7);},'beforeUpdate':function(_0x1a315f,_0x4632d8,_0x5db373){if(_0x1a315f[_0x0674('0x14')](_0x0674('0xf'))){_0x1a315f['substatusAt']=_0x1a315f['substatus']?moment()[_0x0674('0x11')](_0x0674('0x12')):null;}if(_0x1a315f[_0x0674('0x14')](_0x0674('0x13'))){_0x1a315f[_0x0674('0x15')]=moment()['format'](_0x0674('0x12'));_0x1a315f[_0x0674('0xf')]=null;_0x1a315f[_0x0674('0x10')]=null;}_0x5db373(null,_0x1a315f);},'afterUpdate':function(_0x4f41d2,_0x272b86,_0x42471e){var _0x4b3a88=_0xbc288e[_0x0674('0x16')];var _0x3b008e=_0x4f41d2[_0x0674('0x17')]({'plain':!![]});if(_0x3b008e[_0x0674('0x13')]){return _0x4b3a88['MailMessage'][_0x0674('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3b008e['id']}})[_0x0674('0x19')](function(){_0x42471e();})['catch'](function(_0x42f786){_0x42471e(_0x42f786);});}else{_0x42471e();}}},'charset':_0x0674('0x1a'),'collate':_0x0674('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index be9f418..9972b30 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 _0xe7db=['http','defaults','localhost','redis','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','limit','AddTagsToMailInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3b1ac0,_0x3f626c){var _0x3a8c5b=function(_0x110468){while(--_0x110468){_0x3b1ac0['push'](_0x3b1ac0['shift']());}};_0x3a8c5b(++_0x3f626c);}(_0xe7db,0x1bd));var _0xbe7d=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xe7db[_0x3b4b1d];return _0x488c36;};'use strict';var _=require(_0xbe7d('0x0'));var util=require(_0xbe7d('0x1'));var moment=require(_0xbe7d('0x2'));var BPromise=require(_0xbe7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe7d('0x4'));var db=require(_0xbe7d('0x5'))['db'];var utils=require(_0xbe7d('0x6'));var logger=require(_0xbe7d('0x7'))('rpc');var config=require(_0xbe7d('0x8'));var jayson=require(_0xbe7d('0x9'));var client=jayson[_0xbe7d('0xa')][_0xbe7d('0xb')]({'port':0x232a});config['redis']=_[_0xbe7d('0xc')](config['redis'],{'host':_0xbe7d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe7d('0xe')]));require(_0xbe7d('0xf'))['register'](socket);function respondWithRpcPromise(_0x5e7b9a,_0x567926,_0x21a0b5){return new BPromise(function(_0x580551,_0x145967){return client[_0xbe7d('0x10')](_0x5e7b9a,_0x21a0b5)['then'](function(_0xa2fad7){logger[_0xbe7d('0x11')](_0xbe7d('0x12'),_0x567926,_0xbe7d('0x13'));logger[_0xbe7d('0x14')](_0xbe7d('0x15'),_0x567926,_0xbe7d('0x13'),JSON[_0xbe7d('0x16')](_0xa2fad7));if(_0xa2fad7[_0xbe7d('0x17')]){if(_0xa2fad7[_0xbe7d('0x17')]['code']===0x1f4){logger[_0xbe7d('0x17')](_0xbe7d('0x12'),_0x567926,_0xa2fad7[_0xbe7d('0x17')][_0xbe7d('0x18')]);return _0x145967(_0xa2fad7[_0xbe7d('0x17')][_0xbe7d('0x18')]);}logger[_0xbe7d('0x17')](_0xbe7d('0x12'),_0x567926,_0xa2fad7[_0xbe7d('0x17')][_0xbe7d('0x18')]);return _0x580551(_0xa2fad7[_0xbe7d('0x17')]['message']);}else{logger[_0xbe7d('0x11')](_0xbe7d('0x12'),_0x567926,_0xbe7d('0x13'));_0x580551(_0xa2fad7['result'][_0xbe7d('0x18')]);}})[_0xbe7d('0x19')](function(_0x319597){logger['error'](_0xbe7d('0x12'),_0x567926,_0x319597);_0x145967(_0x319597);});});}exports[_0xbe7d('0x1a')]=function(_0x190568){var _0x3c7e5a=this;return new Promise(function(_0x12d4c8,_0x15dfc5){return db[_0xbe7d('0x1b')]['update'](_0x190568[_0xbe7d('0x1c')],{'raw':_0x190568[_0xbe7d('0x1d')]?_0x190568[_0xbe7d('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x190568['options']?_0x190568[_0xbe7d('0x1d')][_0xbe7d('0x1e')]||null:null,'attributes':_0x190568['options']?_0x190568['options'][_0xbe7d('0x1f')]||null:null,'limit':_0x190568[_0xbe7d('0x1d')]?_0x190568[_0xbe7d('0x1d')][_0xbe7d('0x20')]||null:null})['then'](function(_0x486f33){logger[_0xbe7d('0x11')](_0xbe7d('0x1a'),_0x190568);logger[_0xbe7d('0x14')](_0xbe7d('0x1a'),_0x190568,JSON[_0xbe7d('0x16')](_0x486f33));_0x12d4c8(_0x486f33);})[_0xbe7d('0x19')](function(_0x5c2529){logger[_0xbe7d('0x17')]('UpdateMailInteraction',_0x5c2529[_0xbe7d('0x18')],_0x190568);_0x15dfc5(_0x3c7e5a[_0xbe7d('0x17')](0x1f4,_0x5c2529['message']));});});};exports[_0xbe7d('0x21')]=function(_0x2d823c){return new Promise(function(_0x136643,_0x2acfb3){return db[_0xbe7d('0x1b')][_0xbe7d('0x22')]({'where':_0x2d823c[_0xbe7d('0x1d')]?_0x2d823c[_0xbe7d('0x1d')][_0xbe7d('0x1e')]||null:null})['then'](function(_0x24ab26){if(_0x24ab26){return _0x24ab26['addTags'](_0x2d823c[_0xbe7d('0x1c')][_0xbe7d('0x23')],_['omit'](_0x2d823c[_0xbe7d('0x1c')],['ids','id'])||{});}})[_0xbe7d('0x24')](function(_0x12f910){logger[_0xbe7d('0x11')](_0xbe7d('0x25'),_0x2d823c);logger[_0xbe7d('0x14')](_0xbe7d('0x25'),_0x2d823c,JSON['stringify'](_0x12f910));_0x136643(_0x12f910);})[_0xbe7d('0x19')](function(_0x2538e7){logger['error'](_0xbe7d('0x25'),_0x2538e7[_0xbe7d('0x18')],_0x2d823c);_0x2acfb3(_this[_0xbe7d('0x17')](0x1f4,_0x2538e7[_0xbe7d('0x18')]));});});}; \ No newline at end of file +var _0x5557=['error','code','message','info','result','catch','MailInteraction','update','options','where','attributes','limit','UpdateMailInteraction','debug','stringify','AddTagsToMailInteraction','find','addTags','body','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0x5557,0x1ba));var _0x7555=function(_0x48d5da,_0x2c85e4){_0x48d5da=_0x48d5da-0x0;var _0x5ab43b=_0x5557[_0x48d5da];return _0x5ab43b;};'use strict';var _=require(_0x7555('0x0'));var util=require('util');var moment=require(_0x7555('0x1'));var BPromise=require('bluebird');var rs=require(_0x7555('0x2'));var fs=require('fs');var Redis=require(_0x7555('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7555('0x4'));var logger=require('../../config/logger')(_0x7555('0x5'));var config=require(_0x7555('0x6'));var jayson=require(_0x7555('0x7'));var client=jayson[_0x7555('0x8')][_0x7555('0x9')]({'port':0x232a});config[_0x7555('0xa')]=_[_0x7555('0xb')](config[_0x7555('0xa')],{'host':_0x7555('0xc'),'port':0x18eb});var socket=require(_0x7555('0xd'))(new Redis(config[_0x7555('0xa')]));require(_0x7555('0xe'))[_0x7555('0xf')](socket);function respondWithRpcPromise(_0x4eacd6,_0x121ad7,_0x3d3487){return new BPromise(function(_0x2a6a51,_0x5ddd00){return client['request'](_0x4eacd6,_0x3d3487)[_0x7555('0x10')](function(_0x5baec9){logger['info'](_0x7555('0x11'),_0x121ad7,_0x7555('0x12'));logger['debug'](_0x7555('0x13'),_0x121ad7,_0x7555('0x12'),JSON['stringify'](_0x5baec9));if(_0x5baec9[_0x7555('0x14')]){if(_0x5baec9[_0x7555('0x14')][_0x7555('0x15')]===0x1f4){logger[_0x7555('0x14')](_0x7555('0x11'),_0x121ad7,_0x5baec9[_0x7555('0x14')]['message']);return _0x5ddd00(_0x5baec9[_0x7555('0x14')][_0x7555('0x16')]);}logger[_0x7555('0x14')]('MailInteraction,\x20%s,\x20%s',_0x121ad7,_0x5baec9['error']['message']);return _0x2a6a51(_0x5baec9[_0x7555('0x14')]['message']);}else{logger[_0x7555('0x17')](_0x7555('0x11'),_0x121ad7,_0x7555('0x12'));_0x2a6a51(_0x5baec9[_0x7555('0x18')]['message']);}})[_0x7555('0x19')](function(_0x295a9f){logger[_0x7555('0x14')](_0x7555('0x11'),_0x121ad7,_0x295a9f);_0x5ddd00(_0x295a9f);});});}exports['UpdateMailInteraction']=function(_0x59d32a){var _0xa6b572=this;return new Promise(function(_0x46a5b2,_0x54725c){return db[_0x7555('0x1a')][_0x7555('0x1b')](_0x59d32a['body'],{'raw':_0x59d32a[_0x7555('0x1c')]?_0x59d32a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d32a[_0x7555('0x1c')]?_0x59d32a[_0x7555('0x1c')][_0x7555('0x1d')]||null:null,'attributes':_0x59d32a[_0x7555('0x1c')]?_0x59d32a['options'][_0x7555('0x1e')]||null:null,'limit':_0x59d32a[_0x7555('0x1c')]?_0x59d32a[_0x7555('0x1c')][_0x7555('0x1f')]||null:null})[_0x7555('0x10')](function(_0x4d9517){logger[_0x7555('0x17')](_0x7555('0x20'),_0x59d32a);logger[_0x7555('0x21')]('UpdateMailInteraction',_0x59d32a,JSON[_0x7555('0x22')](_0x4d9517));_0x46a5b2(_0x4d9517);})[_0x7555('0x19')](function(_0x24eba1){logger[_0x7555('0x14')]('UpdateMailInteraction',_0x24eba1[_0x7555('0x16')],_0x59d32a);_0x54725c(_0xa6b572['error'](0x1f4,_0x24eba1['message']));});});};exports[_0x7555('0x23')]=function(_0xcfbf24){return new Promise(function(_0x1330cc,_0x212da6){return db[_0x7555('0x1a')][_0x7555('0x24')]({'where':_0xcfbf24[_0x7555('0x1c')]?_0xcfbf24[_0x7555('0x1c')][_0x7555('0x1d')]||null:null})[_0x7555('0x10')](function(_0x473072){if(_0x473072){return _0x473072[_0x7555('0x25')](_0xcfbf24[_0x7555('0x26')]['ids'],_[_0x7555('0x27')](_0xcfbf24[_0x7555('0x26')],['ids','id'])||{});}})[_0x7555('0x28')](function(_0x24d66d){logger[_0x7555('0x17')](_0x7555('0x29'),_0xcfbf24);logger['debug'](_0x7555('0x29'),_0xcfbf24,JSON[_0x7555('0x22')](_0x24d66d));_0x1330cc(_0x24d66d);})[_0x7555('0x19')](function(_0x2da43d){logger['error']('AddTags',_0x2da43d[_0x7555('0x16')],_0xcfbf24);_0x212da6(_this[_0x7555('0x14')](0x1f4,_0x2da43d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d2e2a47..c9b070c 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 _0x39d8=['save','remove','update','emit','register','./mailInteraction.events'];(function(_0xde0217,_0x43aa70){var _0x2346c5=function(_0x1b72fd){while(--_0x1b72fd){_0xde0217['push'](_0xde0217['shift']());}};_0x2346c5(++_0x43aa70);}(_0x39d8,0xd1));var _0x839d=function(_0x21e0cc,_0x2094c4){_0x21e0cc=_0x21e0cc-0x0;var _0x3a29a9=_0x39d8[_0x21e0cc];return _0x3a29a9;};'use strict';var MailInteractionEvents=require(_0x839d('0x0'));var events=[_0x839d('0x1'),_0x839d('0x2'),_0x839d('0x3')];function createListener(_0x22b53a,_0x4c7349){return function(_0x2d09c){_0x4c7349[_0x839d('0x4')](_0x22b53a,_0x2d09c);};}function removeListener(_0xd8c111,_0x4869b9){return function(){MailInteractionEvents['removeListener'](_0xd8c111,_0x4869b9);};}exports[_0x839d('0x5')]=function(_0x3afdde){for(var _0xc42386=0x0,_0x161131=events['length'];_0xc42386<_0x161131;_0xc42386++){var _0x13dcab=events[_0xc42386];var _0xaa52fb=createListener('mailInteraction:'+_0x13dcab,_0x3afdde);MailInteractionEvents['on'](_0x13dcab,_0xaa52fb);}}; \ No newline at end of file +var _0x4ac1=['register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x74f919,_0x183d33){var _0x2225aa=function(_0x5beec7){while(--_0x5beec7){_0x74f919['push'](_0x74f919['shift']());}};_0x2225aa(++_0x183d33);}(_0x4ac1,0xc0));var _0x14ac=function(_0x4d9a84,_0x47ee97){_0x4d9a84=_0x4d9a84-0x0;var _0x49af09=_0x4ac1[_0x4d9a84];return _0x49af09;};'use strict';var MailInteractionEvents=require(_0x14ac('0x0'));var events=[_0x14ac('0x1'),_0x14ac('0x2'),_0x14ac('0x3')];function createListener(_0x19187c,_0x5021ef){return function(_0x168641){_0x5021ef[_0x14ac('0x4')](_0x19187c,_0x168641);};}function removeListener(_0x5a30e1,_0x4d2ffd){return function(){MailInteractionEvents[_0x14ac('0x5')](_0x5a30e1,_0x4d2ffd);};}exports[_0x14ac('0x6')]=function(_0x2d3cff){for(var _0x350e87=0x0,_0x5b26cd=events[_0x14ac('0x7')];_0x350e87<_0x5b26cd;_0x350e87++){var _0x41205c=events[_0x350e87];var _0x284d32=createListener(_0x14ac('0x8')+_0x41205c,_0x2d3cff);MailInteractionEvents['on'](_0x41205c,_0x284d32);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index c56801f..e0c30ee 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc69b=['/describe','isAuthenticated','exports','express','../../components/auth/service','get'];(function(_0x871ef5,_0x58880b){var _0x1f62ea=function(_0x13934c){while(--_0x13934c){_0x871ef5['push'](_0x871ef5['shift']());}};_0x1f62ea(++_0x58880b);}(_0xc69b,0xcf));var _0xbc69=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xc69b[_0x5c6994];return _0x1d5c84;};'use strict';var express=require(_0xbc69('0x0'));var router=express['Router']();var auth=require(_0xbc69('0x1'));var controller=require('./mailInteractionHasTag.controller');router[_0xbc69('0x2')](_0xbc69('0x3'),auth[_0xbc69('0x4')](),controller['describe']);module[_0xbc69('0x5')]=router; \ No newline at end of file +var _0x61f1=['./mailInteractionHasTag.controller','get','/describe','exports','Router'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x61f1,0x18a));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var express=require('express');var router=express[_0x161f('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x161f('0x1'));router[_0x161f('0x2')](_0x161f('0x3'),auth['isAuthenticated'](),controller['describe']);module[_0x161f('0x4')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index db469be..c097a7b 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x5957ab,_0x58515c){var _0x4515ba=function(_0x51878b){while(--_0x51878b){_0x5957ab['push'](_0x5957ab['shift']());}};_0x4515ba(++_0x58515c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x1c3d91,_0x5f5cdd){var _0x1e7d3e=function(_0x498322){while(--_0x498322){_0x1c3d91['push'](_0x1c3d91['shift']());}};_0x1e7d3e(++_0x5f5cdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index e9f6651..a25a179 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf2b=['sequelize','INTEGER'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xcf2b,0x1a6));var _0xbcf2=function(_0x21c068,_0x369d6a){_0x21c068=_0x21c068-0x0;var _0x5cf199=_0xcf2b[_0x21c068];return _0x5cf199;};'use strict';var Sequelize=require(_0xbcf2('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xbcf2('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xa618=['exports','INTEGER','sequelize'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa618,0xb9));var _0x8a61=function(_0x585f10,_0x32ae99){_0x585f10=_0x585f10-0x0;var _0x337f2a=_0xa618[_0x585f10];return _0x337f2a;};'use strict';var Sequelize=require(_0x8a61('0x0'));module[_0x8a61('0x1')]={'MailInteractionId':{'type':Sequelize[_0x8a61('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 4e38f20..f657a82 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69fc=['./mailInteractionHasTag','exports','define'];(function(_0x1e756c,_0x529247){var _0x15c5a9=function(_0x3fb132){while(--_0x3fb132){_0x1e756c['push'](_0x1e756c['shift']());}};_0x15c5a9(++_0x529247);}(_0x69fc,0xdb));var _0xc69f=function(_0x2be4bf,_0x2216a5){_0x2be4bf=_0x2be4bf-0x0;var _0x1907d1=_0x69fc[_0x2be4bf];return _0x1907d1;};'use strict';var attributes=require(_0xc69f('0x0'));module[_0xc69f('0x1')]=function(_0x38c8e9){return _0x38c8e9[_0xc69f('0x2')]('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1371=['MailInteractionHasTag','exports','define'];(function(_0x2603dd,_0x1b5477){var _0x493b9e=function(_0x182e13){while(--_0x182e13){_0x2603dd['push'](_0x2603dd['shift']());}};_0x493b9e(++_0x1b5477);}(_0x1371,0x106));var _0x1137=function(_0x25a0cc,_0x928e71){_0x25a0cc=_0x25a0cc-0x0;var _0x125770=_0x1371[_0x25a0cc];return _0x125770;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x1137('0x0')]=function(_0x538d0d){return _0x538d0d[_0x1137('0x1')](_0x1137('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5a4e912..49bcecb 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 _0x7d13=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x3b8aa9,_0x3d2c3a){var _0x19fa6a=function(_0x56a21b){while(--_0x56a21b){_0x3b8aa9['push'](_0x3b8aa9['shift']());}};_0x19fa6a(++_0x3d2c3a);}(_0x7d13,0x6c));var _0x37d1=function(_0x5619c3,_0x568923){_0x5619c3=_0x5619c3-0x0;var _0x66cf19=_0x7d13[_0x5619c3];return _0x66cf19;};'use strict';var multer=require('multer');var util=require(_0x37d1('0x0'));var path=require('path');var timeout=require(_0x37d1('0x1'));var express=require('express');var router=express[_0x37d1('0x2')]();var fs_extra=require(_0x37d1('0x3'));var auth=require(_0x37d1('0x4'));var interaction=require(_0x37d1('0x5'));var config=require(_0x37d1('0x6'));var controller=require('./mailMessage.controller');router[_0x37d1('0x7')]('/',auth[_0x37d1('0x8')](),controller[_0x37d1('0x9')]);router[_0x37d1('0x7')]('/describe',auth[_0x37d1('0x8')](),controller[_0x37d1('0xa')]);router[_0x37d1('0x7')](_0x37d1('0xb'),auth[_0x37d1('0x8')](),controller[_0x37d1('0xc')]);router[_0x37d1('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x37d1('0xd')]);router[_0x37d1('0xe')]('/',auth['isAuthenticated'](),interaction[_0x37d1('0xf')](_0x37d1('0x10'),_0x37d1('0x11')),controller[_0x37d1('0x12')]);router[_0x37d1('0x13')](_0x37d1('0xb'),auth[_0x37d1('0x8')](),controller[_0x37d1('0x14')]);router['put'](_0x37d1('0x15'),auth[_0x37d1('0x8')](),controller['accept']);router[_0x37d1('0x13')](_0x37d1('0x16'),auth['isAuthenticated'](),controller[_0x37d1('0x17')]);router[_0x37d1('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x37d1('0x19')]);module[_0x37d1('0x1a')]=router; \ No newline at end of file +var _0x0712=['destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','update','accept','reject','delete'];(function(_0x198644,_0x10b68f){var _0x5deaf1=function(_0x2c7b4d){while(--_0x2c7b4d){_0x198644['push'](_0x198644['shift']());}};_0x5deaf1(++_0x10b68f);}(_0x0712,0x147));var _0x2071=function(_0x27664a,_0x245e64){_0x27664a=_0x27664a-0x0;var _0x476c9b=_0x0712[_0x27664a];return _0x476c9b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2071('0x0'));var timeout=require(_0x2071('0x1'));var express=require('express');var router=express[_0x2071('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2071('0x3'));var interaction=require(_0x2071('0x4'));var config=require(_0x2071('0x5'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0x2071('0x6')](),controller[_0x2071('0x7')]);router['get']('/describe',auth[_0x2071('0x6')](),controller[_0x2071('0x8')]);router[_0x2071('0x9')](_0x2071('0xa'),auth[_0x2071('0x6')](),controller[_0x2071('0xb')]);router[_0x2071('0x9')](_0x2071('0xc'),auth[_0x2071('0x6')](),controller['download']);router[_0x2071('0xd')]('/',auth[_0x2071('0x6')](),interaction[_0x2071('0xe')](_0x2071('0xf'),_0x2071('0x10')),controller[_0x2071('0x11')]);router[_0x2071('0x12')](_0x2071('0xa'),auth[_0x2071('0x6')](),controller[_0x2071('0x13')]);router[_0x2071('0x12')]('/:id/accept',auth[_0x2071('0x6')](),controller[_0x2071('0x14')]);router[_0x2071('0x12')]('/:id/reject',auth[_0x2071('0x6')](),controller[_0x2071('0x15')]);router[_0x2071('0x16')](_0x2071('0xa'),auth[_0x2071('0x6')](),controller[_0x2071('0x17')]);module[_0x2071('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 5299078..3822975 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 _0x70eb=['DATE','INTEGER','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x141016,_0x244c99){var _0x116459=function(_0x558c7d){while(--_0x558c7d){_0x141016['push'](_0x141016['shift']());}};_0x116459(++_0x244c99);}(_0x70eb,0xba));var _0xb70e=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x70eb[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0xb70e('0x0'));var _=require(_0xb70e('0x1'));module[_0xb70e('0x2')]={'body':{'type':Sequelize[_0xb70e('0x3')](_0xb70e('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb70e('0x3')](_0xb70e('0x5'))},'read':{'type':Sequelize[_0xb70e('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb70e('0x7')]('in',_0xb70e('0x8')),'defaultValue':_0xb70e('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb70e('0x9')](0x1fe)},'from':{'type':Sequelize[_0xb70e('0x9')]},'to':{'type':Sequelize[_0xb70e('0x3')](_0xb70e('0x4'))},'cc':{'type':Sequelize['TEXT'](_0xb70e('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0xb70e('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xb70e('0xa')]},'attach':{'type':Sequelize[_0xb70e('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb70e('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xb70e('0x3')]('long')},'originCc':{'type':Sequelize[_0xb70e('0x3')](_0xb70e('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0xb70e('0xc'),_0xb70e('0xd')),'defaultValue':_0xb70e('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xa24a=['INTEGER','ENUM','Email','Chat','sequelize','TEXT','long','BOOLEAN','out','STRING','DATE'];(function(_0xde2209,_0x119f0d){var _0x358ecb=function(_0x1a5104){while(--_0x1a5104){_0xde2209['push'](_0xde2209['shift']());}};_0x358ecb(++_0x119f0d);}(_0xa24a,0x159));var _0xaa24=function(_0x4425c2,_0x21744c){_0x4425c2=_0x4425c2-0x0;var _0x8826c=_0xa24a[_0x4425c2];return _0x8826c;};'use strict';var Sequelize=require(_0xaa24('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xaa24('0x1')](_0xaa24('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xaa24('0x1')]('medium')},'read':{'type':Sequelize[_0xaa24('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaa24('0x4')),'defaultValue':_0xaa24('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa24('0x5')](0x1fe)},'from':{'type':Sequelize[_0xaa24('0x5')]},'to':{'type':Sequelize[_0xaa24('0x1')](_0xaa24('0x2'))},'cc':{'type':Sequelize[_0xaa24('0x1')]('long')},'bcc':{'type':Sequelize[_0xaa24('0x1')](_0xaa24('0x2'))},'subject':{'type':Sequelize[_0xaa24('0x1')]},'sentAt':{'type':Sequelize[_0xaa24('0x6')]},'attach':{'type':Sequelize[_0xaa24('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xaa24('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaa24('0x6')]},'originTo':{'type':Sequelize['TEXT'](_0xaa24('0x2'))},'originCc':{'type':Sequelize[_0xaa24('0x1')](_0xaa24('0x2'))},'originChannel':{'type':Sequelize[_0xaa24('0x8')](_0xaa24('0x9'),_0xaa24('0xa')),'defaultValue':_0xaa24('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 149a5b2..53751d5 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 _0x7720=['MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','show','params','keys','length','body','find','describe','create','direction','out','MailAccount','findOne','MailAccountId','CmList','List','Contacts','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','defaults','ListId','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','format','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','manual','interface','channel','motionChannel','event','fromString','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','fullname','SIP/%s','EventManager','rejectmessage','download','unix','root','server','files','message-%s.eml','Attachment','Attachments','from','subject','decode','createdAt','bcc','headers','Bcc','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','register','jayson/promise','http','client','request','then','info','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7720,0x129));var _0x0772=function(_0x356e79,_0x4587d4){_0x356e79=_0x356e79-0x0;var _0xffdae7=_0x7720[_0x356e79];return _0xffdae7;};'use strict';var emlformat=require(_0x0772('0x0'));var moment=require(_0x0772('0x1'));var BPromise=require(_0x0772('0x2'));var util=require('util');var path=require(_0x0772('0x3'));var fs=require('fs');var _=require(_0x0772('0x4'));var Redis=require(_0x0772('0x5'));var htmlToText=require(_0x0772('0x6'));var qs=require(_0x0772('0x7'));var logger=require('../../config/logger')(_0x0772('0x8'));var interaction_log=require(_0x0772('0x9'))('mail-interactions');var config=require(_0x0772('0xa'));var db=require(_0x0772('0xb'))['db'];config['redis']=_['defaults'](config[_0x0772('0xc')],{'host':_0x0772('0xd'),'port':0x18eb});var socket=require(_0x0772('0xe'))(new Redis(config[_0x0772('0xc')]));var htmlEntities=require(_0x0772('0xf'));require('./mailMessage.socket')[_0x0772('0x10')](socket);var jayson=require(_0x0772('0x11'));var client=jayson['client'][_0x0772('0x12')]({'port':0x232c});var client9003=jayson[_0x0772('0x13')]['http']({'port':0x232b});var client9002=jayson['client'][_0x0772('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x529e15,_0x296aee,_0xcf96b2,_0x5ce51f){return new BPromise(function(_0x5a822b,_0x15c800){var _0x3ee9ab=_0x5ce51f||client;return _0x3ee9ab[_0x0772('0x14')](_0x529e15,_0xcf96b2)[_0x0772('0x15')](function(_0x19852f){logger[_0x0772('0x16')]('MailMessage,\x20%s,\x20%s',_0x296aee,_0x0772('0x17'));logger[_0x0772('0x18')](_0x0772('0x19'),_0x296aee,'request\x20sent',JSON[_0x0772('0x1a')](_0x19852f));if(_0x19852f[_0x0772('0x1b')]){if(_0x19852f['error'][_0x0772('0x1c')]===0x1f4){logger[_0x0772('0x1b')](_0x0772('0x1d'),_0x296aee,_0x19852f[_0x0772('0x1b')][_0x0772('0x1e')]);return _0x15c800(_0x19852f[_0x0772('0x1b')][_0x0772('0x1e')]);}logger[_0x0772('0x1b')](_0x0772('0x1d'),_0x296aee,_0x19852f[_0x0772('0x1b')][_0x0772('0x1e')]);return _0x5a822b(_0x19852f[_0x0772('0x1b')]['message']);}else{logger[_0x0772('0x16')](_0x0772('0x1d'),_0x296aee,_0x0772('0x17'));_0x5a822b(_0x19852f[_0x0772('0x1f')][_0x0772('0x1e')]);}})[_0x0772('0x20')](function(_0x53d59e){logger['error'](_0x0772('0x1d'),_0x296aee,_0x53d59e);_0x15c800(_0x53d59e);});});}function respondWithResult(_0x2f32c4,_0x3c3c3c){_0x3c3c3c=_0x3c3c3c||0xc8;return function(_0x4f5434){if(_0x4f5434){return _0x2f32c4[_0x0772('0x21')](_0x3c3c3c)[_0x0772('0x22')](_0x4f5434);}};}function respondWithFilteredResult(_0x2fd286,_0xff3e99){return function(_0x13c025){if(_0x13c025){var _0x2f3097=typeof _0xff3e99[_0x0772('0x23')]==='undefined'&&typeof _0xff3e99[_0x0772('0x24')]===_0x0772('0x25');var _0x149a51=_0x13c025['count'];var _0x495d9d=_0x2f3097?0x0:_0xff3e99[_0x0772('0x23')];var _0x38ca68=_0x2f3097?_0x13c025[_0x0772('0x26')]:_0xff3e99[_0x0772('0x23')]+_0xff3e99['limit'];var _0x4fc5d5;if(_0x38ca68>=_0x149a51){_0x38ca68=_0x149a51;_0x4fc5d5=0xc8;}else{_0x4fc5d5=0xce;}_0x2fd286['status'](_0x4fc5d5);return _0x2fd286[_0x0772('0x27')](_0x0772('0x28'),_0x495d9d+'-'+_0x38ca68+'/'+_0x149a51)[_0x0772('0x22')](_0x13c025);}return null;};}function saveUpdates(_0x28f00c){return function(_0x28e419){if(_0x28e419){return _0x28e419[_0x0772('0x29')](_0x28f00c)[_0x0772('0x15')](function(_0xdb4b1){return _0xdb4b1;});}return null;};}function removeEntity(_0x6dce96){return function(_0x14ae52){if(_0x14ae52){return _0x14ae52[_0x0772('0x2a')]()[_0x0772('0x15')](function(){_0x6dce96[_0x0772('0x21')](0xcc)[_0x0772('0x2b')]();});}};}function handleEntityNotFound(_0x35286d){return function(_0x28930d){if(!_0x28930d){_0x35286d[_0x0772('0x2c')](0x194);}return _0x28930d;};}function handleError(_0x12cf3b,_0x38b92e){_0x38b92e=_0x38b92e||0x1f4;return function(_0x319669){logger['error'](_0x319669[_0x0772('0x2d')]);if(_0x319669[_0x0772('0x2e')]){delete _0x319669[_0x0772('0x2e')];}_0x12cf3b[_0x0772('0x21')](_0x38b92e)[_0x0772('0x2f')](_0x319669);};}exports[_0x0772('0x30')]=function(_0x24702d,_0x1ae41d){var _0x2b5119={},_0x250201={},_0x216db1={'count':0x0,'rows':[]};var _0x151de7=_['map'](db[_0x0772('0x31')][_0x0772('0x32')],function(_0x2e07e0){return{'name':_0x2e07e0[_0x0772('0x33')],'type':_0x2e07e0[_0x0772('0x34')][_0x0772('0x35')]};});_0x250201['model']=_[_0x0772('0x36')](_0x151de7,_0x0772('0x2e'));_0x250201[_0x0772('0x37')]=_['keys'](_0x24702d[_0x0772('0x37')]);_0x250201[_0x0772('0x38')]=_[_0x0772('0x39')](_0x250201[_0x0772('0x3a')],_0x250201[_0x0772('0x37')]);_0x2b5119[_0x0772('0x3b')]=_[_0x0772('0x39')](_0x250201[_0x0772('0x3a')],qs['fields'](_0x24702d[_0x0772('0x37')][_0x0772('0x3c')]));_0x2b5119[_0x0772('0x3b')]=_0x2b5119['attributes']['length']?_0x2b5119[_0x0772('0x3b')]:_0x250201[_0x0772('0x3a')];if(!_0x24702d['query']['hasOwnProperty'](_0x0772('0x3d'))){_0x2b5119['limit']=qs[_0x0772('0x24')](_0x24702d['query'][_0x0772('0x24')]);_0x2b5119[_0x0772('0x23')]=qs[_0x0772('0x23')](_0x24702d[_0x0772('0x37')][_0x0772('0x23')]);}_0x2b5119[_0x0772('0x3e')]=qs[_0x0772('0x3f')](_0x24702d[_0x0772('0x37')][_0x0772('0x3f')]);_0x2b5119[_0x0772('0x40')]=qs[_0x0772('0x38')](_[_0x0772('0x41')](_0x24702d[_0x0772('0x37')],_0x250201[_0x0772('0x38')]),_0x151de7);if(_0x24702d['query'][_0x0772('0x42')]){_0x2b5119['where']=_['merge'](_0x2b5119['where'],{'$or':_[_0x0772('0x36')](_0x151de7,function(_0x18d70f){if(_0x18d70f[_0x0772('0x34')]!=='VIRTUAL'){var _0x1eb860={};_0x1eb860[_0x18d70f[_0x0772('0x2e')]]={'$like':'%'+_0x24702d[_0x0772('0x37')]['filter']+'%'};return _0x1eb860;}})});}_0x2b5119=_[_0x0772('0x43')]({},_0x2b5119,_0x24702d[_0x0772('0x44')]);var _0x4d5023={'where':_0x2b5119[_0x0772('0x40')]};return db[_0x0772('0x31')][_0x0772('0x26')](_0x4d5023)[_0x0772('0x15')](function(_0x50ebe5){_0x216db1[_0x0772('0x26')]=_0x50ebe5;if(_0x24702d['query'][_0x0772('0x45')]){_0x2b5119[_0x0772('0x46')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x2b5119);})['then'](function(_0x4ec03e){_0x216db1['rows']=_0x4ec03e;return _0x216db1;})[_0x0772('0x15')](respondWithFilteredResult(_0x1ae41d,_0x2b5119))[_0x0772('0x20')](handleError(_0x1ae41d,null));};exports[_0x0772('0x47')]=function(_0xd3558b,_0x41ef09){var _0x5a5460={'raw':!![],'where':{'id':_0xd3558b[_0x0772('0x48')]['id']}},_0x286c43={};_0x286c43[_0x0772('0x3a')]=_[_0x0772('0x49')](db[_0x0772('0x31')][_0x0772('0x32')]);_0x286c43[_0x0772('0x37')]=_['keys'](_0xd3558b[_0x0772('0x37')]);_0x286c43['filters']=_[_0x0772('0x39')](_0x286c43['model'],_0x286c43[_0x0772('0x37')]);_0x5a5460[_0x0772('0x3b')]=_['intersection'](_0x286c43[_0x0772('0x3a')],qs[_0x0772('0x3c')](_0xd3558b[_0x0772('0x37')][_0x0772('0x3c')]));_0x5a5460[_0x0772('0x3b')]=_0x5a5460[_0x0772('0x3b')][_0x0772('0x4a')]?_0x5a5460[_0x0772('0x3b')]:_0x286c43[_0x0772('0x3a')];if(_0xd3558b['query'][_0x0772('0x45')]){_0x5a5460[_0x0772('0x46')]=[{'all':!![]}];}_0x5a5460=_['merge']({},_0x5a5460,_0xd3558b[_0x0772('0x44')]);return db[_0x0772('0x31')]['find'](_0x5a5460)[_0x0772('0x15')](handleEntityNotFound(_0x41ef09,null))[_0x0772('0x15')](respondWithResult(_0x41ef09,null))['catch'](handleError(_0x41ef09,null));};exports[_0x0772('0x29')]=function(_0x4ddcd9,_0x1b261a){if(_0x4ddcd9[_0x0772('0x4b')]['id']){delete _0x4ddcd9['body']['id'];}return db[_0x0772('0x31')][_0x0772('0x4c')]({'where':{'id':_0x4ddcd9[_0x0772('0x48')]['id']}})[_0x0772('0x15')](handleEntityNotFound(_0x1b261a,null))[_0x0772('0x15')](saveUpdates(_0x4ddcd9[_0x0772('0x4b')],null))[_0x0772('0x15')](respondWithResult(_0x1b261a,null))['catch'](handleError(_0x1b261a,null));};exports[_0x0772('0x2a')]=function(_0x2b12f8,_0xdbc8ad){return db[_0x0772('0x31')][_0x0772('0x4c')]({'where':{'id':_0x2b12f8['params']['id']}})['then'](handleEntityNotFound(_0xdbc8ad,null))[_0x0772('0x15')](removeEntity(_0xdbc8ad,null))[_0x0772('0x20')](handleError(_0xdbc8ad,null));};exports['describe']=function(_0x4dc4f9,_0x3c9158){return db[_0x0772('0x31')][_0x0772('0x4d')]()[_0x0772('0x15')](respondWithResult(_0x3c9158,null))['catch'](handleError(_0x3c9158,null));};exports[_0x0772('0x4e')]=function(_0x5214af,_0x560172){return db[_0x0772('0x31')][_0x0772('0x4e')](_0x5214af[_0x0772('0x4b')])[_0x0772('0x15')](function(_0xb90398){if(_0xb90398){if(_0xb90398[_0x0772('0x4f')]===_0x0772('0x50')&&!_0xb90398['secret']){var _0x1ad151,_0x4c84ff,_0x4aa998;if(_0x5214af[_0x0772('0x4b')]['to']){_0x4c84ff=_0x5214af[_0x0772('0x4b')]['to']['split'](',')[0x0];}return db[_0x0772('0x51')][_0x0772('0x52')]({'where':{'id':_0xb90398[_0x0772('0x53')]},'include':[{'model':db[_0x0772('0x54')],'as':_0x0772('0x55'),'include':[{'model':db['CmContact'],'as':_0x0772('0x56'),'where':{'email':_0x4c84ff},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x0772('0x57')],'as':_0x0772('0x58'),'raw':!![],'include':[{'model':db[_0x0772('0x59')],'as':_0x0772('0x59'),'raw':!![]}]}]})['then'](function(_0x190528){_0x1ad151=_0x190528;if(!_0x1ad151||!_0x1ad151[_0x0772('0x58')])return;var _0x277f6f=_0x1ad151[_0x0772('0x5a')]();if(_0x5214af[_0x0772('0x4b')][_0x0772('0x5b')]&&_0x5214af['body'][_0x0772('0x5b')]['length']){for(var _0x10b602=0x0;_0x10b602<_0x5214af[_0x0772('0x4b')][_0x0772('0x5b')][_0x0772('0x4a')];_0x10b602+=0x1){_0x5214af[_0x0772('0x4b')]['attachments'][_0x10b602]={'filename':_0x5214af[_0x0772('0x4b')][_0x0772('0x5b')][_0x10b602][_0x0772('0x2e')],'path':path[_0x0772('0x5c')](config['root'],_0x0772('0x5d'),_0x5214af[_0x0772('0x4b')][_0x0772('0x5b')][_0x10b602][_0x0772('0x5e')])};}}_0x4aa998={'account':_0x277f6f,'message':_0x5214af[_0x0772('0x4b')]};return;})[_0x0772('0x15')](function(){if(_0x1ad151[_0x0772('0x55')]){if(_0x1ad151[_0x0772('0x55')][_0x0772('0x56')]['length']){return _0x1ad151[_0x0772('0x55')]['Contacts'][0x0];}else{return db['CmContact'][_0x0772('0x4e')](_[_0x0772('0x5f')](_0x5214af[_0x0772('0x4b')],{'firstName':_0x5214af[_0x0772('0x4b')]['to'],'email':_0x5214af[_0x0772('0x4b')]['to'],'phone':_0x5214af[_0x0772('0x4b')]['to'],'ListId':_0x1ad151[_0x0772('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x0772('0x15')](function(){if(_0x4aa998){return respondWithRpcPromise(_0x0772('0x61'),_0x0772('0x62'),_0x4aa998,client9003)[_0x0772('0x15')](function(_0x38d7f7){return _0xb90398[_0x0772('0x29')]({'read':!![],'messageId':_0x38d7f7['messageId'],'sentAt':moment()['format'](_0x0772('0x63'))});})[_0x0772('0x20')](function(_0x136e13){logger[_0x0772('0x1b')]('%s',JSON[_0x0772('0x1a')](_0x136e13));return _0xb90398;});}return _0xb90398;});}return _0xb90398;}})['then'](respondWithResult(_0x560172,0xc9))[_0x0772('0x20')](handleError(_0x560172,null));};exports[_0x0772('0x64')]=function(_0x247b81,_0x55ac8e){var _0x52c255={'agent':{},'channel':_0x0772('0x65')};if(_0x247b81['body']['id']){delete _0x247b81[_0x0772('0x4b')]['id'];}_0x247b81[_0x0772('0x4b')][_0x0772('0x66')]=!![];_0x247b81[_0x0772('0x4b')]['readAt']=moment()['format'](_0x0772('0x63'));_0x247b81[_0x0772('0x4b')][_0x0772('0x67')]=_0x247b81[_0x0772('0x4b')][_0x0772('0x67')]||_0x247b81[_0x0772('0x68')]['id'];_0x52c255[_0x0772('0x69')]['id']=_0x247b81[_0x0772('0x4b')][_0x0772('0x67')];return db[_0x0772('0x31')]['find']({'where':{'id':_0x247b81['params']['id'],'UserId':null}})[_0x0772('0x15')](handleEntityNotFound(_0x55ac8e,null))[_0x0772('0x15')](saveUpdates(_0x247b81[_0x0772('0x4b')],null))['then'](function(_0x3a7f88){if(_0x3a7f88){_0x52c255['message']=_0x3a7f88[_0x0772('0x6a')]({'plain':!![]});return db[_0x0772('0x6b')]['find']({'where':{'id':_0x3a7f88[_0x0772('0x6c')]}});}return null;})[_0x0772('0x15')](handleEntityNotFound(_0x55ac8e,null))['then'](function(_0x49ad5a){if(_0x49ad5a){return _0x49ad5a[_0x0772('0x29')]({'UserId':_0x247b81['body'][_0x0772('0x67')],'read1stAt':_[_0x0772('0x6d')](_0x49ad5a[_0x0772('0x6e')])?moment()[_0x0772('0x6f')](_0x0772('0x63')):undefined});}return null;})['then'](function(_0x537dab){if(_0x537dab){_0x52c255['interaction']=_0x537dab[_0x0772('0x6a')]({'plain':!![]});interaction_log[_0x0772('0x16')](_0x0772('0x70'),_0x247b81[_0x0772('0x68')]['id'],_0x247b81[_0x0772('0x68')]['name'],_0x247b81['user'][_0x0772('0x71')],_0x52c255[_0x0772('0x72')]['id'],_0x247b81[_0x0772('0x4b')]?JSON[_0x0772('0x1a')](_0x247b81[_0x0772('0x4b')]):'null');return respondWithRpcPromise('AcceptMessage',_0x0772('0x73'),_0x52c255);}return null;})[_0x0772('0x15')](function(_0x3f0b76){var _0x5a8630=_0x0772('0x74')+_0x3f0b76[_0x0772('0x1e')][_0x0772('0x75')];return db[_0x0772('0x76')][_0x0772('0x37')](_0x5a8630,{'type':db[_0x0772('0x77')]['QueryTypes'][_0x0772('0x78')],'raw':!![]})[_0x0772('0x15')](function(_0x341ef5){return _0x341ef5;});})['then'](function(_0x456913){if(_0x456913){_0x52c255['message'][_0x0772('0x79')]=_0x456913[0x0];if(!_0x247b81['body']['UserId'])return;return db[_0x0772('0x7a')][_0x0772('0x4c')]({'where':{'id':_0x247b81[_0x0772('0x4b')][_0x0772('0x67')],'role':_0x0772('0x69')},'attributes':['id',_0x0772('0x2e'),'fullname',_0x0772('0x7b'),_0x0772('0x7c')],'raw':!![]});}return null;})[_0x0772('0x15')](function(_0x4603ac){if(!_0x4603ac)return null;_0x52c255[_0x0772('0x1e')][_0x0772('0x69')]=_0x4603ac;return _0x52c255;})[_0x0772('0x15')](function(_0x265e2a){if(_0x265e2a){if(_0x247b81[_0x0772('0x4b')][_0x0772('0x7d')]){_0x52c255[_0x0772('0x1e')][_0x0772('0x7e')]=util[_0x0772('0x6f')]('SIP/%s',_0x247b81[_0x0772('0x68')][_0x0772('0x2e')]);_0x52c255[_0x0772('0x1e')][_0x0772('0x7f')]=_0x52c255[_0x0772('0x7f')];_0x52c255[_0x0772('0x1e')][_0x0772('0x80')]=_0x52c255['channel'];_0x52c255['message'][_0x0772('0x81')]=_0x0772('0x64');_0x52c255[_0x0772('0x1e')][_0x0772('0x4b')]=htmlToText[_0x0772('0x82')](_0x52c255['message'][_0x0772('0x4b')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0x0772('0x83'),'message':_0x52c255[_0x0772('0x1e')]},client9002)[_0x0772('0x15')](function(){return _0x52c255;});}return _0x52c255;}return null;})[_0x0772('0x15')](respondWithResult(_0x55ac8e,null))['catch'](handleError(_0x55ac8e,null));};exports[_0x0772('0x84')]=function(_0x48831c,_0x383ebb){var _0x2fffc3={'agent':{},'channel':_0x0772('0x65')};if(_0x48831c['body']['id']){delete _0x48831c[_0x0772('0x4b')]['id'];}_0x48831c[_0x0772('0x4b')][_0x0772('0x67')]=_0x48831c[_0x0772('0x4b')][_0x0772('0x67')]||_0x48831c[_0x0772('0x68')]['id'];_0x2fffc3[_0x0772('0x69')]['id']=_0x48831c['body'][_0x0772('0x67')];return db['MailMessage']['find']({'where':{'id':_0x48831c[_0x0772('0x48')]['id'],'UserId':null}})[_0x0772('0x15')](handleEntityNotFound(_0x383ebb,null))[_0x0772('0x15')](function(_0x5487bc){if(_0x5487bc){_0x2fffc3[_0x0772('0x1e')]=_0x5487bc['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x5487bc[_0x0772('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x383ebb,null))[_0x0772('0x15')](function(_0x1266c4){if(_0x1266c4){_0x2fffc3[_0x0772('0x72')]=_0x1266c4[_0x0772('0x6a')]({'plain':!![]});interaction_log[_0x0772('0x16')](_0x0772('0x85'),_0x48831c[_0x0772('0x68')]['id'],_0x48831c[_0x0772('0x68')][_0x0772('0x2e')],_0x48831c[_0x0772('0x68')][_0x0772('0x71')],_0x2fffc3[_0x0772('0x72')]['id'],_0x48831c[_0x0772('0x4b')]?JSON[_0x0772('0x1a')](_0x48831c['body']):_0x0772('0x86'));return respondWithRpcPromise(_0x0772('0x87'),_0x0772('0x88'),_0x2fffc3);}return null;})[_0x0772('0x15')](function(_0x501573){var _0x13ece7=_0x0772('0x74')+_0x501573[_0x0772('0x1e')][_0x0772('0x75')];return db[_0x0772('0x76')][_0x0772('0x37')](_0x13ece7,{'type':db[_0x0772('0x77')][_0x0772('0x89')][_0x0772('0x78')],'raw':!![]})[_0x0772('0x15')](function(_0x519f6d){return _0x519f6d;});})[_0x0772('0x15')](function(_0x30f1de){if(_0x30f1de){_0x2fffc3[_0x0772('0x1e')][_0x0772('0x79')]=_0x30f1de[0x0];if(!_0x48831c[_0x0772('0x4b')][_0x0772('0x67')])return;return db[_0x0772('0x7a')][_0x0772('0x4c')]({'where':{'id':_0x48831c[_0x0772('0x4b')]['UserId'],'role':_0x0772('0x69')},'attributes':['id',_0x0772('0x2e'),_0x0772('0x8a'),_0x0772('0x7b'),_0x0772('0x7c')],'raw':!![]});}return null;})['then'](function(_0x4acd83){if(!_0x4acd83)return null;_0x2fffc3[_0x0772('0x1e')][_0x0772('0x69')]=_0x4acd83;return _0x2fffc3;})['then'](function(_0x5df13c){if(_0x5df13c){_0x5df13c[_0x0772('0x1e')][_0x0772('0x7e')]=util[_0x0772('0x6f')](_0x0772('0x8b'),_0x48831c[_0x0772('0x68')][_0x0772('0x2e')]);_0x5df13c[_0x0772('0x1e')]['channel']=_0x2fffc3['channel'];_0x5df13c['message'][_0x0772('0x80')]=_0x2fffc3[_0x0772('0x7f')];_0x5df13c[_0x0772('0x1e')]['event']=_0x0772('0x84');_0x5df13c[_0x0772('0x1e')]['body']=htmlToText[_0x0772('0x82')](_0x2fffc3[_0x0772('0x1e')]['body']);respondWithRpcPromise(_0x0772('0x8c'),_0x0772('0x8c'),{'event':_0x0772('0x8d'),'message':_0x5df13c[_0x0772('0x1e')]},client9002);return _0x2fffc3;}return null;})[_0x0772('0x15')](respondWithResult(_0x383ebb,null))[_0x0772('0x20')](handleError(_0x383ebb,null));};exports[_0x0772('0x8e')]=function(_0x4e8d4a,_0x4ee5b3){var _0x1e8d5e=moment()[_0x0772('0x8f')]()['toString']();var _0x4c9b39=path['join'](config[_0x0772('0x90')],_0x0772('0x91'),_0x0772('0x92'),'tmp');var _0x259880=path[_0x0772('0x5c')](config[_0x0772('0x90')],_0x0772('0x91'),'files',_0x0772('0x5b'));var _0x2cef86=util[_0x0772('0x6f')](_0x0772('0x93'),_0x1e8d5e);return db[_0x0772('0x31')][_0x0772('0x4c')]({'where':{'id':_0x4e8d4a[_0x0772('0x48')]['id']},'attributes':['id','body','from','to','cc','bcc','subject','createdAt'],'include':_0x4e8d4a[_0x0772('0x37')][_0x0772('0x5b')]?[{'model':db[_0x0772('0x94')],'as':_0x0772('0x95')}]:undefined})['then'](handleEntityNotFound(_0x4ee5b3,null))[_0x0772('0x15')](function(_0x2b185a){if(_0x2b185a){var _0x230284=_0x2b185a;var _0xe32496={'from':_0x230284[_0x0772('0x96')],'to':_0x230284['to'],'subject':_0x230284[_0x0772('0x97')],'html':htmlEntities[_0x0772('0x98')](_0x230284['body']),'headers':{'Date':moment(_0x230284[_0x0772('0x99')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2b185a['cc']){_0xe32496['headers']['Cc']=_0x2b185a['cc'];}if(_0x2b185a[_0x0772('0x9a')]){_0xe32496[_0x0772('0x9b')][_0x0772('0x9c')]=_0x2b185a[_0x0772('0x9a')];}return new BPromise(function(_0xd7526f,_0x151845){if(_0x2b185a['Attachments']){for(var _0x583c8f=0x0;_0x583c8f<_0x2b185a[_0x0772('0x95')]['length'];_0x583c8f++){var _0xfc4746=_0x2b185a['Attachments'][_0x583c8f];var _0x1b4072=path[_0x0772('0x5c')](_0x259880,_0xfc4746[_0x0772('0x5e')]);if(fs['existsSync'](_0x1b4072)){_0xe32496[_0x0772('0x5b')][_0x0772('0x9d')]({'name':_0xfc4746[_0x0772('0x2e')],'contentType':_0xfc4746[_0x0772('0x34')],'data':fs[_0x0772('0x9e')](_0x1b4072)});}}}emlformat['build'](_0xe32496,function(_0x52ac92,_0xb50bf6){if(_0x52ac92)return _0x151845(_0x52ac92);fs[_0x0772('0x9f')](path[_0x0772('0x5c')](_0x4c9b39,_0x2cef86),_0xb50bf6);return _0xd7526f(_0xb50bf6);});});}})[_0x0772('0x15')](function(_0x43f14d){if(_0x43f14d){return _0x4ee5b3['download'](path[_0x0772('0x5c')](_0x4c9b39,_0x2cef86),_0x2cef86,function(_0x55a992){if(!_0x55a992)fs[_0x0772('0xa0')](path[_0x0772('0x5c')](_0x4c9b39,_0x2cef86));});}})[_0x0772('0x20')](handleError(_0x4ee5b3,null));}; \ No newline at end of file +var _0xb2fc=['accept','fromString','EventManager','acceptmessage','reject','mail','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','contact','internal','SIP/%s','rejectmessage','download','files','tmp','root','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','writeFileSync','unlinkSync','moment','bluebird','path','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','status','json','offset','limit','undefined','count','set','update','destroy','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','body','describe','create','direction','out','secret','findOne','MailAccountId','CmList','List','CmContact','Contacts','MailServerOut','Smtp','CloudProvider','attachments','join','server/files/attachments','basename','defaults','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','readAt','UserId','agent','get','MailInteractionId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','manual','interface','channel','event'];(function(_0x2d616c,_0x417478){var _0x323f2=function(_0x304ef5){while(--_0x304ef5){_0x2d616c['push'](_0x2d616c['shift']());}};_0x323f2(++_0x417478);}(_0xb2fc,0xbd));var _0xcb2f=function(_0x26b2a2,_0x3afb26){_0x26b2a2=_0x26b2a2-0x0;var _0x342d7b=_0xb2fc[_0x26b2a2];return _0x342d7b;};'use strict';var emlformat=require('eml-format');var moment=require(_0xcb2f('0x0'));var BPromise=require(_0xcb2f('0x1'));var util=require('util');var path=require(_0xcb2f('0x2'));var fs=require('fs');var _=require(_0xcb2f('0x3'));var Redis=require(_0xcb2f('0x4'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0xcb2f('0x5'))('api');var interaction_log=require(_0xcb2f('0x5'))('mail-interactions');var config=require(_0xcb2f('0x6'));var db=require(_0xcb2f('0x7'))['db'];config[_0xcb2f('0x8')]=_['defaults'](config['redis'],{'host':_0xcb2f('0x9'),'port':0x18eb});var socket=require(_0xcb2f('0xa'))(new Redis(config[_0xcb2f('0x8')]));var htmlEntities=require(_0xcb2f('0xb'));require(_0xcb2f('0xc'))[_0xcb2f('0xd')](socket);var jayson=require(_0xcb2f('0xe'));var client=jayson[_0xcb2f('0xf')][_0xcb2f('0x10')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0xcb2f('0xf')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30fb9b,_0x5cb387,_0x1b1391,_0x404bf3){return new BPromise(function(_0x323969,_0x205306){var _0x1af828=_0x404bf3||client;return _0x1af828[_0xcb2f('0x11')](_0x30fb9b,_0x1b1391)[_0xcb2f('0x12')](function(_0x125eff){logger[_0xcb2f('0x13')]('MailMessage,\x20%s,\x20%s',_0x5cb387,_0xcb2f('0x14'));logger[_0xcb2f('0x15')](_0xcb2f('0x16'),_0x5cb387,_0xcb2f('0x14'),JSON[_0xcb2f('0x17')](_0x125eff));if(_0x125eff[_0xcb2f('0x18')]){if(_0x125eff[_0xcb2f('0x18')]['code']===0x1f4){logger[_0xcb2f('0x18')](_0xcb2f('0x19'),_0x5cb387,_0x125eff[_0xcb2f('0x18')][_0xcb2f('0x1a')]);return _0x205306(_0x125eff[_0xcb2f('0x18')][_0xcb2f('0x1a')]);}logger['error'](_0xcb2f('0x19'),_0x5cb387,_0x125eff[_0xcb2f('0x18')]['message']);return _0x323969(_0x125eff[_0xcb2f('0x18')][_0xcb2f('0x1a')]);}else{logger[_0xcb2f('0x13')](_0xcb2f('0x19'),_0x5cb387,_0xcb2f('0x14'));_0x323969(_0x125eff[_0xcb2f('0x1b')]['message']);}})['catch'](function(_0x543339){logger[_0xcb2f('0x18')](_0xcb2f('0x19'),_0x5cb387,_0x543339);_0x205306(_0x543339);});});}function respondWithResult(_0x238c25,_0x3248c2){_0x3248c2=_0x3248c2||0xc8;return function(_0x3b136f){if(_0x3b136f){return _0x238c25[_0xcb2f('0x1c')](_0x3248c2)[_0xcb2f('0x1d')](_0x3b136f);}};}function respondWithFilteredResult(_0x3d7a04,_0x3967f9){return function(_0x360bbc){if(_0x360bbc){var _0x22ac4b=typeof _0x3967f9[_0xcb2f('0x1e')]==='undefined'&&typeof _0x3967f9[_0xcb2f('0x1f')]===_0xcb2f('0x20');var _0x25fefe=_0x360bbc[_0xcb2f('0x21')];var _0x389762=_0x22ac4b?0x0:_0x3967f9[_0xcb2f('0x1e')];var _0x3eab4f=_0x22ac4b?_0x360bbc[_0xcb2f('0x21')]:_0x3967f9[_0xcb2f('0x1e')]+_0x3967f9[_0xcb2f('0x1f')];var _0x173e18;if(_0x3eab4f>=_0x25fefe){_0x3eab4f=_0x25fefe;_0x173e18=0xc8;}else{_0x173e18=0xce;}_0x3d7a04[_0xcb2f('0x1c')](_0x173e18);return _0x3d7a04[_0xcb2f('0x22')]('Content-Range',_0x389762+'-'+_0x3eab4f+'/'+_0x25fefe)[_0xcb2f('0x1d')](_0x360bbc);}return null;};}function saveUpdates(_0x3539ad){return function(_0x578544){if(_0x578544){return _0x578544[_0xcb2f('0x23')](_0x3539ad)[_0xcb2f('0x12')](function(_0x5d4eda){return _0x5d4eda;});}return null;};}function removeEntity(_0x149327){return function(_0x2268e8){if(_0x2268e8){return _0x2268e8[_0xcb2f('0x24')]()['then'](function(){_0x149327[_0xcb2f('0x1c')](0xcc)[_0xcb2f('0x25')]();});}};}function handleEntityNotFound(_0xd836bd){return function(_0x56c12e){if(!_0x56c12e){_0xd836bd[_0xcb2f('0x26')](0x194);}return _0x56c12e;};}function handleError(_0x13850d,_0x405232){_0x405232=_0x405232||0x1f4;return function(_0x1021cb){logger['error'](_0x1021cb[_0xcb2f('0x27')]);if(_0x1021cb['name']){delete _0x1021cb[_0xcb2f('0x28')];}_0x13850d[_0xcb2f('0x1c')](_0x405232)[_0xcb2f('0x29')](_0x1021cb);};}exports['index']=function(_0x2d69d4,_0x46612a){var _0x389dee={},_0x540e5a={},_0x5044f6={'count':0x0,'rows':[]};var _0x396942=_[_0xcb2f('0x2a')](db[_0xcb2f('0x2b')][_0xcb2f('0x2c')],function(_0x37f8fc){return{'name':_0x37f8fc['fieldName'],'type':_0x37f8fc[_0xcb2f('0x2d')]['key']};});_0x540e5a[_0xcb2f('0x2e')]=_[_0xcb2f('0x2a')](_0x396942,'name');_0x540e5a['query']=_['keys'](_0x2d69d4[_0xcb2f('0x2f')]);_0x540e5a[_0xcb2f('0x30')]=_[_0xcb2f('0x31')](_0x540e5a['model'],_0x540e5a[_0xcb2f('0x2f')]);_0x389dee[_0xcb2f('0x32')]=_[_0xcb2f('0x31')](_0x540e5a['model'],qs[_0xcb2f('0x33')](_0x2d69d4[_0xcb2f('0x2f')][_0xcb2f('0x33')]));_0x389dee['attributes']=_0x389dee[_0xcb2f('0x32')]['length']?_0x389dee[_0xcb2f('0x32')]:_0x540e5a[_0xcb2f('0x2e')];if(!_0x2d69d4[_0xcb2f('0x2f')]['hasOwnProperty'](_0xcb2f('0x34'))){_0x389dee[_0xcb2f('0x1f')]=qs[_0xcb2f('0x1f')](_0x2d69d4[_0xcb2f('0x2f')]['limit']);_0x389dee[_0xcb2f('0x1e')]=qs[_0xcb2f('0x1e')](_0x2d69d4[_0xcb2f('0x2f')]['offset']);}_0x389dee[_0xcb2f('0x35')]=qs[_0xcb2f('0x36')](_0x2d69d4['query']['sort']);_0x389dee['where']=qs[_0xcb2f('0x30')](_['pick'](_0x2d69d4[_0xcb2f('0x2f')],_0x540e5a['filters']),_0x396942);if(_0x2d69d4[_0xcb2f('0x2f')]['filter']){_0x389dee['where']=_[_0xcb2f('0x37')](_0x389dee[_0xcb2f('0x38')],{'$or':_[_0xcb2f('0x2a')](_0x396942,function(_0x2c3a2e){if(_0x2c3a2e[_0xcb2f('0x2d')]!==_0xcb2f('0x39')){var _0x36016b={};_0x36016b[_0x2c3a2e['name']]={'$like':'%'+_0x2d69d4[_0xcb2f('0x2f')]['filter']+'%'};return _0x36016b;}})});}_0x389dee=_[_0xcb2f('0x37')]({},_0x389dee,_0x2d69d4['options']);var _0x212c66={'where':_0x389dee['where']};return db['MailMessage'][_0xcb2f('0x21')](_0x212c66)[_0xcb2f('0x12')](function(_0xce3c89){_0x5044f6[_0xcb2f('0x21')]=_0xce3c89;if(_0x2d69d4[_0xcb2f('0x2f')]['includeAll']){_0x389dee[_0xcb2f('0x3a')]=[{'all':!![]}];}return db[_0xcb2f('0x2b')][_0xcb2f('0x3b')](_0x389dee);})['then'](function(_0x36ff79){_0x5044f6[_0xcb2f('0x3c')]=_0x36ff79;return _0x5044f6;})['then'](respondWithFilteredResult(_0x46612a,_0x389dee))[_0xcb2f('0x3d')](handleError(_0x46612a,null));};exports[_0xcb2f('0x3e')]=function(_0x22a3d2,_0x516471){var _0x285055={'raw':!![],'where':{'id':_0x22a3d2[_0xcb2f('0x3f')]['id']}},_0x3f5392={};_0x3f5392[_0xcb2f('0x2e')]=_[_0xcb2f('0x40')](db['MailMessage'][_0xcb2f('0x2c')]);_0x3f5392[_0xcb2f('0x2f')]=_[_0xcb2f('0x40')](_0x22a3d2[_0xcb2f('0x2f')]);_0x3f5392['filters']=_[_0xcb2f('0x31')](_0x3f5392[_0xcb2f('0x2e')],_0x3f5392['query']);_0x285055[_0xcb2f('0x32')]=_[_0xcb2f('0x31')](_0x3f5392['model'],qs['fields'](_0x22a3d2['query']['fields']));_0x285055[_0xcb2f('0x32')]=_0x285055[_0xcb2f('0x32')][_0xcb2f('0x41')]?_0x285055[_0xcb2f('0x32')]:_0x3f5392[_0xcb2f('0x2e')];if(_0x22a3d2[_0xcb2f('0x2f')][_0xcb2f('0x42')]){_0x285055[_0xcb2f('0x3a')]=[{'all':!![]}];}_0x285055=_['merge']({},_0x285055,_0x22a3d2[_0xcb2f('0x43')]);return db[_0xcb2f('0x2b')][_0xcb2f('0x44')](_0x285055)[_0xcb2f('0x12')](handleEntityNotFound(_0x516471,null))[_0xcb2f('0x12')](respondWithResult(_0x516471,null))[_0xcb2f('0x3d')](handleError(_0x516471,null));};exports[_0xcb2f('0x23')]=function(_0x3f38ba,_0x1d6c78){if(_0x3f38ba[_0xcb2f('0x45')]['id']){delete _0x3f38ba[_0xcb2f('0x45')]['id'];}return db[_0xcb2f('0x2b')][_0xcb2f('0x44')]({'where':{'id':_0x3f38ba[_0xcb2f('0x3f')]['id']}})[_0xcb2f('0x12')](handleEntityNotFound(_0x1d6c78,null))[_0xcb2f('0x12')](saveUpdates(_0x3f38ba[_0xcb2f('0x45')],null))[_0xcb2f('0x12')](respondWithResult(_0x1d6c78,null))[_0xcb2f('0x3d')](handleError(_0x1d6c78,null));};exports[_0xcb2f('0x24')]=function(_0x2fc69e,_0x3c8718){return db['MailMessage'][_0xcb2f('0x44')]({'where':{'id':_0x2fc69e[_0xcb2f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3c8718,null))['then'](removeEntity(_0x3c8718,null))['catch'](handleError(_0x3c8718,null));};exports[_0xcb2f('0x46')]=function(_0x43e305,_0x152e3e){return db[_0xcb2f('0x2b')][_0xcb2f('0x46')]()[_0xcb2f('0x12')](respondWithResult(_0x152e3e,null))['catch'](handleError(_0x152e3e,null));};exports['create']=function(_0x3e4933,_0x4c6edc){return db[_0xcb2f('0x2b')][_0xcb2f('0x47')](_0x3e4933['body'])[_0xcb2f('0x12')](function(_0x3575f9){if(_0x3575f9){if(_0x3575f9[_0xcb2f('0x48')]===_0xcb2f('0x49')&&!_0x3575f9[_0xcb2f('0x4a')]){var _0x10bdab,_0x511e94,_0x202a3c;if(_0x3e4933['body']['to']){_0x511e94=_0x3e4933[_0xcb2f('0x45')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xcb2f('0x4b')]({'where':{'id':_0x3575f9[_0xcb2f('0x4c')]},'include':[{'model':db[_0xcb2f('0x4d')],'as':_0xcb2f('0x4e'),'include':[{'model':db[_0xcb2f('0x4f')],'as':_0xcb2f('0x50'),'where':{'email':_0x511e94},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xcb2f('0x51')],'as':_0xcb2f('0x52'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xcb2f('0x53'),'raw':!![]}]}]})[_0xcb2f('0x12')](function(_0xde468a){_0x10bdab=_0xde468a;if(!_0x10bdab||!_0x10bdab[_0xcb2f('0x52')])return;var _0xe4f134=_0x10bdab['getSmtpOptions']();if(_0x3e4933['body'][_0xcb2f('0x54')]&&_0x3e4933[_0xcb2f('0x45')][_0xcb2f('0x54')][_0xcb2f('0x41')]){for(var _0x30038e=0x0;_0x30038e<_0x3e4933[_0xcb2f('0x45')][_0xcb2f('0x54')]['length'];_0x30038e+=0x1){_0x3e4933['body'][_0xcb2f('0x54')][_0x30038e]={'filename':_0x3e4933[_0xcb2f('0x45')][_0xcb2f('0x54')][_0x30038e][_0xcb2f('0x28')],'path':path[_0xcb2f('0x55')](config['root'],_0xcb2f('0x56'),_0x3e4933['body']['attachments'][_0x30038e][_0xcb2f('0x57')])};}}_0x202a3c={'account':_0xe4f134,'message':_0x3e4933[_0xcb2f('0x45')]};return;})['then'](function(){if(_0x10bdab['List']){if(_0x10bdab['List'][_0xcb2f('0x50')][_0xcb2f('0x41')]){return _0x10bdab[_0xcb2f('0x4e')][_0xcb2f('0x50')][0x0];}else{return db[_0xcb2f('0x4f')][_0xcb2f('0x47')](_[_0xcb2f('0x58')](_0x3e4933[_0xcb2f('0x45')],{'firstName':_0x3e4933[_0xcb2f('0x45')]['to'],'email':_0x3e4933[_0xcb2f('0x45')]['to'],'phone':_0x3e4933[_0xcb2f('0x45')]['to'],'ListId':_0x10bdab['ListId']}));}}else{throw new Error(_0xcb2f('0x59'));}})[_0xcb2f('0x12')](function(){if(_0x202a3c){return respondWithRpcPromise(_0xcb2f('0x5a'),_0xcb2f('0x5b'),_0x202a3c,client9003)[_0xcb2f('0x12')](function(_0x3b0107){return _0x3575f9[_0xcb2f('0x23')]({'read':!![],'messageId':_0x3b0107[_0xcb2f('0x5c')],'sentAt':moment()[_0xcb2f('0x5d')](_0xcb2f('0x5e'))});})[_0xcb2f('0x3d')](function(_0x207620){logger[_0xcb2f('0x18')]('%s',JSON[_0xcb2f('0x17')](_0x207620));return _0x3575f9;});}return _0x3575f9;});}return _0x3575f9;}})['then'](respondWithResult(_0x4c6edc,0xc9))[_0xcb2f('0x3d')](handleError(_0x4c6edc,null));};exports['accept']=function(_0x27f7d6,_0x452546){var _0x1aa9f9={'agent':{},'channel':'mail'};if(_0x27f7d6[_0xcb2f('0x45')]['id']){delete _0x27f7d6[_0xcb2f('0x45')]['id'];}_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x5f')]=!![];_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x60')]=moment()['format'](_0xcb2f('0x5e'));_0x27f7d6['body'][_0xcb2f('0x61')]=_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x61')]||_0x27f7d6['user']['id'];_0x1aa9f9[_0xcb2f('0x62')]['id']=_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x61')];return db[_0xcb2f('0x2b')]['find']({'where':{'id':_0x27f7d6[_0xcb2f('0x3f')]['id'],'UserId':null}})[_0xcb2f('0x12')](handleEntityNotFound(_0x452546,null))[_0xcb2f('0x12')](saveUpdates(_0x27f7d6[_0xcb2f('0x45')],null))[_0xcb2f('0x12')](function(_0x524f55){if(_0x524f55){_0x1aa9f9['message']=_0x524f55[_0xcb2f('0x63')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x524f55[_0xcb2f('0x64')]}});}return null;})[_0xcb2f('0x12')](handleEntityNotFound(_0x452546,null))['then'](function(_0x160d52){if(_0x160d52){return _0x160d52[_0xcb2f('0x23')]({'UserId':_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x61')],'read1stAt':_[_0xcb2f('0x65')](_0x160d52[_0xcb2f('0x66')])?moment()[_0xcb2f('0x5d')](_0xcb2f('0x5e')):undefined});}return null;})[_0xcb2f('0x12')](function(_0xc91abe){if(_0xc91abe){_0x1aa9f9[_0xcb2f('0x67')]=_0xc91abe[_0xcb2f('0x63')]({'plain':!![]});interaction_log[_0xcb2f('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x27f7d6[_0xcb2f('0x68')]['id'],_0x27f7d6[_0xcb2f('0x68')]['name'],_0x27f7d6['user'][_0xcb2f('0x69')],_0x1aa9f9[_0xcb2f('0x67')]['id'],_0x27f7d6[_0xcb2f('0x45')]?JSON['stringify'](_0x27f7d6['body']):_0xcb2f('0x6a'));return respondWithRpcPromise(_0xcb2f('0x6b'),_0xcb2f('0x6c'),_0x1aa9f9);}return null;})[_0xcb2f('0x12')](function(_0x3ccead){var _0x30e11e=_0xcb2f('0x6d')+_0x3ccead[_0xcb2f('0x1a')][_0xcb2f('0x6e')];return db[_0xcb2f('0x6f')][_0xcb2f('0x2f')](_0x30e11e,{'type':db[_0xcb2f('0x70')][_0xcb2f('0x71')]['SELECT'],'raw':!![]})[_0xcb2f('0x12')](function(_0x389f49){return _0x389f49;});})[_0xcb2f('0x12')](function(_0x51faab){if(_0x51faab){_0x1aa9f9[_0xcb2f('0x1a')]['contact']=_0x51faab[0x0];if(!_0x27f7d6['body'][_0xcb2f('0x61')])return;return db[_0xcb2f('0x72')][_0xcb2f('0x44')]({'where':{'id':_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x61')],'role':_0xcb2f('0x62')},'attributes':['id',_0xcb2f('0x28'),_0xcb2f('0x73'),_0xcb2f('0x74'),'internal'],'raw':!![]});}return null;})[_0xcb2f('0x12')](function(_0x4441ba){if(!_0x4441ba)return null;_0x1aa9f9['message'][_0xcb2f('0x62')]=_0x4441ba;return _0x1aa9f9;})[_0xcb2f('0x12')](function(_0x2134b9){if(_0x2134b9){if(_0x27f7d6['body'][_0xcb2f('0x75')]){_0x1aa9f9[_0xcb2f('0x1a')][_0xcb2f('0x76')]=util['format']('SIP/%s',_0x27f7d6[_0xcb2f('0x68')][_0xcb2f('0x28')]);_0x1aa9f9[_0xcb2f('0x1a')][_0xcb2f('0x77')]=_0x1aa9f9[_0xcb2f('0x77')];_0x1aa9f9[_0xcb2f('0x1a')]['motionChannel']=_0x1aa9f9[_0xcb2f('0x77')];_0x1aa9f9[_0xcb2f('0x1a')][_0xcb2f('0x78')]=_0xcb2f('0x79');_0x1aa9f9[_0xcb2f('0x1a')]['body']=htmlToText[_0xcb2f('0x7a')](_0x1aa9f9[_0xcb2f('0x1a')][_0xcb2f('0x45')]);return respondWithRpcPromise(_0xcb2f('0x7b'),_0xcb2f('0x7b'),{'event':_0xcb2f('0x7c'),'message':_0x1aa9f9[_0xcb2f('0x1a')]},client9002)[_0xcb2f('0x12')](function(){return _0x1aa9f9;});}return _0x1aa9f9;}return null;})['then'](respondWithResult(_0x452546,null))[_0xcb2f('0x3d')](handleError(_0x452546,null));};exports[_0xcb2f('0x7d')]=function(_0xc74d5f,_0x3aaf2f){var _0x858367={'agent':{},'channel':_0xcb2f('0x7e')};if(_0xc74d5f[_0xcb2f('0x45')]['id']){delete _0xc74d5f[_0xcb2f('0x45')]['id'];}_0xc74d5f[_0xcb2f('0x45')][_0xcb2f('0x61')]=_0xc74d5f['body']['UserId']||_0xc74d5f[_0xcb2f('0x68')]['id'];_0x858367['agent']['id']=_0xc74d5f[_0xcb2f('0x45')]['UserId'];return db['MailMessage'][_0xcb2f('0x44')]({'where':{'id':_0xc74d5f[_0xcb2f('0x3f')]['id'],'UserId':null}})[_0xcb2f('0x12')](handleEntityNotFound(_0x3aaf2f,null))['then'](function(_0x3f3917){if(_0x3f3917){_0x858367['message']=_0x3f3917['get']({'plain':!![]});return db[_0xcb2f('0x7f')][_0xcb2f('0x44')]({'where':{'id':_0x3f3917[_0xcb2f('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3aaf2f,null))[_0xcb2f('0x12')](function(_0x1f8c6e){if(_0x1f8c6e){_0x858367['interaction']=_0x1f8c6e[_0xcb2f('0x63')]({'plain':!![]});interaction_log[_0xcb2f('0x13')](_0xcb2f('0x80'),_0xc74d5f[_0xcb2f('0x68')]['id'],_0xc74d5f[_0xcb2f('0x68')][_0xcb2f('0x28')],_0xc74d5f[_0xcb2f('0x68')][_0xcb2f('0x69')],_0x858367[_0xcb2f('0x67')]['id'],_0xc74d5f['body']?JSON[_0xcb2f('0x17')](_0xc74d5f[_0xcb2f('0x45')]):_0xcb2f('0x6a'));return respondWithRpcPromise('RejectMessage',_0xcb2f('0x81'),_0x858367);}return null;})[_0xcb2f('0x12')](function(_0x39a18f){var _0x220c95='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x39a18f[_0xcb2f('0x1a')][_0xcb2f('0x6e')];return db[_0xcb2f('0x6f')][_0xcb2f('0x2f')](_0x220c95,{'type':db['Sequelize'][_0xcb2f('0x71')][_0xcb2f('0x82')],'raw':!![]})['then'](function(_0x145248){return _0x145248;});})[_0xcb2f('0x12')](function(_0x351bdb){if(_0x351bdb){_0x858367[_0xcb2f('0x1a')][_0xcb2f('0x83')]=_0x351bdb[0x0];if(!_0xc74d5f[_0xcb2f('0x45')]['UserId'])return;return db[_0xcb2f('0x72')][_0xcb2f('0x44')]({'where':{'id':_0xc74d5f[_0xcb2f('0x45')][_0xcb2f('0x61')],'role':_0xcb2f('0x62')},'attributes':['id',_0xcb2f('0x28'),'fullname','email',_0xcb2f('0x84')],'raw':!![]});}return null;})[_0xcb2f('0x12')](function(_0x6d90a3){if(!_0x6d90a3)return null;_0x858367['message'][_0xcb2f('0x62')]=_0x6d90a3;return _0x858367;})[_0xcb2f('0x12')](function(_0x1640c5){if(_0x1640c5){_0x1640c5[_0xcb2f('0x1a')][_0xcb2f('0x76')]=util[_0xcb2f('0x5d')](_0xcb2f('0x85'),_0xc74d5f[_0xcb2f('0x68')]['name']);_0x1640c5[_0xcb2f('0x1a')][_0xcb2f('0x77')]=_0x858367[_0xcb2f('0x77')];_0x1640c5[_0xcb2f('0x1a')]['motionChannel']=_0x858367[_0xcb2f('0x77')];_0x1640c5[_0xcb2f('0x1a')][_0xcb2f('0x78')]=_0xcb2f('0x7d');_0x1640c5[_0xcb2f('0x1a')]['body']=htmlToText['fromString'](_0x858367['message'][_0xcb2f('0x45')]);respondWithRpcPromise(_0xcb2f('0x7b'),_0xcb2f('0x7b'),{'event':_0xcb2f('0x86'),'message':_0x1640c5['message']},client9002);return _0x858367;}return null;})[_0xcb2f('0x12')](respondWithResult(_0x3aaf2f,null))[_0xcb2f('0x3d')](handleError(_0x3aaf2f,null));};exports[_0xcb2f('0x87')]=function(_0x32acb6,_0x322781){var _0x17cf8b=moment()['unix']()['toString']();var _0x366d2e=path['join'](config['root'],'server',_0xcb2f('0x88'),_0xcb2f('0x89'));var _0x24140e=path[_0xcb2f('0x55')](config[_0xcb2f('0x8a')],_0xcb2f('0x8b'),_0xcb2f('0x88'),_0xcb2f('0x54'));var _0x46beb4=util[_0xcb2f('0x5d')](_0xcb2f('0x8c'),_0x17cf8b);return db['MailMessage']['find']({'where':{'id':_0x32acb6['params']['id']},'attributes':['id',_0xcb2f('0x45'),_0xcb2f('0x8d'),'to','cc',_0xcb2f('0x8e'),_0xcb2f('0x8f'),_0xcb2f('0x90')],'include':_0x32acb6['query'][_0xcb2f('0x54')]?[{'model':db[_0xcb2f('0x91')],'as':'Attachments'}]:undefined})[_0xcb2f('0x12')](handleEntityNotFound(_0x322781,null))[_0xcb2f('0x12')](function(_0x196210){if(_0x196210){var _0x22b769=_0x196210;var _0x15ec78={'from':_0x22b769['from'],'to':_0x22b769['to'],'subject':_0x22b769[_0xcb2f('0x8f')],'html':htmlEntities['decode'](_0x22b769[_0xcb2f('0x45')]),'headers':{'Date':moment(_0x22b769['createdAt'])[_0xcb2f('0x5d')](_0xcb2f('0x92'))},'attachments':[]};if(_0x196210['cc']){_0x15ec78['headers']['Cc']=_0x196210['cc'];}if(_0x196210[_0xcb2f('0x8e')]){_0x15ec78[_0xcb2f('0x93')][_0xcb2f('0x94')]=_0x196210[_0xcb2f('0x8e')];}return new BPromise(function(_0x32373f,_0x1552c9){if(_0x196210[_0xcb2f('0x95')]){for(var _0x4b3aaf=0x0;_0x4b3aaf<_0x196210[_0xcb2f('0x95')][_0xcb2f('0x41')];_0x4b3aaf++){var _0x25ba15=_0x196210[_0xcb2f('0x95')][_0x4b3aaf];var _0x2b3393=path[_0xcb2f('0x55')](_0x24140e,_0x25ba15['basename']);if(fs[_0xcb2f('0x96')](_0x2b3393)){_0x15ec78[_0xcb2f('0x54')][_0xcb2f('0x97')]({'name':_0x25ba15['name'],'contentType':_0x25ba15[_0xcb2f('0x2d')],'data':fs[_0xcb2f('0x98')](_0x2b3393)});}}}emlformat['build'](_0x15ec78,function(_0x251d14,_0x41684a){if(_0x251d14)return _0x1552c9(_0x251d14);fs[_0xcb2f('0x99')](path['join'](_0x366d2e,_0x46beb4),_0x41684a);return _0x32373f(_0x41684a);});});}})[_0xcb2f('0x12')](function(_0x50f9ba){if(_0x50f9ba){return _0x322781[_0xcb2f('0x87')](path['join'](_0x366d2e,_0x46beb4),_0x46beb4,function(_0x1cd278){if(!_0x1cd278)fs[_0xcb2f('0x9a')](path['join'](_0x366d2e,_0x46beb4));});}})[_0xcb2f('0x3d')](handleError(_0x322781,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7c41bec..c5c73aa 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 _0x884b=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x202dfd,_0x9ac39b){var _0x1c3464=function(_0x26b4cd){while(--_0x26b4cd){_0x202dfd['push'](_0x202dfd['shift']());}};_0x1c3464(++_0x9ac39b);}(_0x884b,0x162));var _0xb884=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0x884b[_0x3616bb];return _0x1c0994;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xb884('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb884('0x1')](0x0);var events={'afterCreate':_0xb884('0x2'),'afterUpdate':_0xb884('0x3'),'afterDestroy':_0xb884('0x4')};function emitEvent(_0x3846fd){return function(_0x263633,_0x33c7b2,_0x4f8234){MailMessageEvents[_0xb884('0x5')](_0x3846fd+':'+_0x263633['id'],_0x263633);MailMessageEvents[_0xb884('0x5')](_0x3846fd,_0x263633);_0x4f8234(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xb884('0x6')](e,emitEvent(event));}}module[_0xb884('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x7678=['../../mysqldb','MailMessage','save','remove','hook','events'];(function(_0x3c6c44,_0x3aae67){var _0x1ecffd=function(_0x46a5f8){while(--_0x46a5f8){_0x3c6c44['push'](_0x3c6c44['shift']());}};_0x1ecffd(++_0x3aae67);}(_0x7678,0xc5));var _0x8767=function(_0x253c6c,_0x5226a9){_0x253c6c=_0x253c6c-0x0;var _0x1a7f8d=_0x7678[_0x253c6c];return _0x1a7f8d;};'use strict';var EventEmitter=require(_0x8767('0x0'));var MailMessage=require(_0x8767('0x1'))['db'][_0x8767('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8767('0x3'),'afterUpdate':'update','afterDestroy':_0x8767('0x4')};function emitEvent(_0x1b2f89){return function(_0x57c167,_0x30d799,_0xd08a2c){MailMessageEvents['emit'](_0x1b2f89+':'+_0x57c167['id'],_0x57c167);MailMessageEvents['emit'](_0x1b2f89,_0x57c167);_0xd08a2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x8767('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index b19b0f0..11a0e3d 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 _0xaeb5=['subject','FULLTEXT','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','update','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailMessage','mail_messages','messageId','plainBody'];(function(_0xd448a5,_0x52a055){var _0x4222a3=function(_0x12cbdd){while(--_0x12cbdd){_0xd448a5['push'](_0xd448a5['shift']());}};_0x4222a3(++_0x52a055);}(_0xaeb5,0x1c3));var _0x5aeb=function(_0x450f20,_0x159bb3){_0x450f20=_0x450f20-0x0;var _0x15bd66=_0xaeb5[_0x450f20];return _0x15bd66;};'use strict';var _=require(_0x5aeb('0x0'));var util=require('util');var logger=require(_0x5aeb('0x1'))(_0x5aeb('0x2'));var moment=require(_0x5aeb('0x3'));var BPromise=require(_0x5aeb('0x4'));var rp=require(_0x5aeb('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x5aeb('0x6'));var rimraf=require(_0x5aeb('0x7'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x5aeb('0x8')]=function(_0x3ba9a7,_0x460f9e){return _0x3ba9a7[_0x5aeb('0x9')](_0x5aeb('0xa'),attributes,{'tableName':_0x5aeb('0xb'),'paranoid':![],'indexes':[{'name':_0x5aeb('0xc'),'fields':[_0x5aeb('0xc')]},{'name':'fti_mail_messages','fields':[_0x5aeb('0xd'),_0x5aeb('0xe')],'type':_0x5aeb('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x103bcc,_0x17d6ef,_0x4cf02e){if(_0x103bcc['body']){_0x103bcc[_0x5aeb('0xd')]=htmlToText[_0x5aeb('0x10')](_0x103bcc['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4cf02e(null,_0x17d6ef);},'afterCreate':function(_0x20df76,_0x13c9c4,_0x37cbe5){var _0x5f02b5=_0x3ba9a7[_0x5aeb('0x11')];var _0x44ffa9=_0x20df76[_0x5aeb('0x12')]({'plain':!![]});if(_0x44ffa9[_0x5aeb('0x13')][_0x5aeb('0x14')]()==='in'||_0x44ffa9[_0x5aeb('0x13')]['toLowerCase']()===_0x5aeb('0x15')&&!_0x44ffa9[_0x5aeb('0x16')]&&!_[_0x5aeb('0x17')](_0x44ffa9['UserId'])){_0x5f02b5[_0x5aeb('0x18')][_0x5aeb('0x19')]({'where':{'id':_0x44ffa9[_0x5aeb('0x1a')]}})['then'](function(_0x5c833b){if(_0x5c833b){_0x5c833b[_0x5aeb('0x1b')]({'lastMsgAt':_0x44ffa9['createdAt'],'lastMsgDirection':_0x44ffa9[_0x5aeb('0x13')][_0x5aeb('0x14')]()});}})[_0x5aeb('0x1c')](function(_0xa105e){console[_0x5aeb('0x1d')](_0xa105e);});}_0x37cbe5();}},'charset':'utf8mb4','collate':_0x5aeb('0x1e')});}; \ No newline at end of file +var _0x7c5a=['isNil','MailInteraction','MailInteractionId','then','createdAt','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret'];(function(_0x4e73d8,_0x3ffb7d){var _0x974f0a=function(_0x34d9bc){while(--_0x34d9bc){_0x4e73d8['push'](_0x4e73d8['shift']());}};_0x974f0a(++_0x3ffb7d);}(_0x7c5a,0x163));var _0xa7c5=function(_0x4854fb,_0x5e654d){_0x4854fb=_0x4854fb-0x0;var _0x2d787d=_0x7c5a[_0x4854fb];return _0x2d787d;};'use strict';var _=require('lodash');var util=require(_0xa7c5('0x0'));var logger=require(_0xa7c5('0x1'))('api');var moment=require(_0xa7c5('0x2'));var BPromise=require(_0xa7c5('0x3'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa7c5('0x4'));var attributes=require(_0xa7c5('0x5'));module[_0xa7c5('0x6')]=function(_0x844982,_0x5f5565){return _0x844982[_0xa7c5('0x7')](_0xa7c5('0x8'),attributes,{'tableName':_0xa7c5('0x9'),'paranoid':![],'indexes':[{'name':_0xa7c5('0xa'),'fields':[_0xa7c5('0xa')]},{'name':_0xa7c5('0xb'),'fields':[_0xa7c5('0xc'),_0xa7c5('0xd')],'type':_0xa7c5('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5641a1,_0x4c0d2d,_0x3831a5){if(_0x5641a1[_0xa7c5('0xf')]){_0x5641a1['plainBody']=htmlToText['fromString'](_0x5641a1[_0xa7c5('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3831a5(null,_0x4c0d2d);},'afterCreate':function(_0x50cda3,_0x419667,_0x190526){var _0x361d6d=_0x844982[_0xa7c5('0x10')];var _0x1c458a=_0x50cda3[_0xa7c5('0x11')]({'plain':!![]});if(_0x1c458a[_0xa7c5('0x12')][_0xa7c5('0x13')]()==='in'||_0x1c458a[_0xa7c5('0x12')][_0xa7c5('0x13')]()===_0xa7c5('0x14')&&!_0x1c458a[_0xa7c5('0x15')]&&!_[_0xa7c5('0x16')](_0x1c458a['UserId'])){_0x361d6d[_0xa7c5('0x17')]['findOne']({'where':{'id':_0x1c458a[_0xa7c5('0x18')]}})[_0xa7c5('0x19')](function(_0x235ab8){if(_0x235ab8){_0x235ab8['update']({'lastMsgAt':_0x1c458a[_0xa7c5('0x1a')],'lastMsgDirection':_0x1c458a[_0xa7c5('0x12')][_0xa7c5('0x13')]()});}})['catch'](function(_0xa2b255){console['error'](_0xa2b255);});}_0x190526();}},'charset':_0xa7c5('0x1b'),'collate':_0xa7c5('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 735c2d0..b928650 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 _0x93e9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','then','debug'];(function(_0x842858,_0x3a3ca0){var _0x46c2a2=function(_0x47f795){while(--_0x47f795){_0x842858['push'](_0x842858['shift']());}};_0x46c2a2(++_0x3a3ca0);}(_0x93e9,0xcc));var _0x993e=function(_0x3aa0ac,_0x5f5da6){_0x3aa0ac=_0x3aa0ac-0x0;var _0x568a11=_0x93e9[_0x3aa0ac];return _0x568a11;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rs=require(_0x993e('0x4'));var fs=require('fs');var Redis=require(_0x993e('0x5'));var db=require(_0x993e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x993e('0x7'));var config=require(_0x993e('0x8'));var jayson=require(_0x993e('0x9'));var client=jayson[_0x993e('0xa')][_0x993e('0xb')]({'port':0x232a});config[_0x993e('0xc')]=_[_0x993e('0xd')](config[_0x993e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x993e('0xe'))(new Redis(config[_0x993e('0xc')]));require(_0x993e('0xf'))[_0x993e('0x10')](socket);function respondWithRpcPromise(_0x2cd389,_0x27a28f,_0x1c2324){return new BPromise(function(_0x48291a,_0x196f6d){return client[_0x993e('0x11')](_0x2cd389,_0x1c2324)['then'](function(_0x5ebc8c){logger[_0x993e('0x12')]('MailMessage,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x27a28f,_0x993e('0x13'),JSON[_0x993e('0x14')](_0x5ebc8c));if(_0x5ebc8c[_0x993e('0x15')]){if(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x16')]===0x1f4){logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x196f6d(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}logger[_0x993e('0x15')](_0x993e('0x17'),_0x27a28f,_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);return _0x48291a(_0x5ebc8c[_0x993e('0x15')][_0x993e('0x18')]);}else{logger['info'](_0x993e('0x17'),_0x27a28f,_0x993e('0x13'));_0x48291a(_0x5ebc8c[_0x993e('0x19')][_0x993e('0x18')]);}})[_0x993e('0x1a')](function(_0x3eda77){logger['error'](_0x993e('0x17'),_0x27a28f,_0x3eda77);_0x196f6d(_0x3eda77);});});}exports[_0x993e('0x1b')]=function(_0x1eaf57){var _0x22390e=this;return new Promise(function(_0x130a8a,_0x425ab4){return db[_0x993e('0x1c')][_0x993e('0x1d')](_0x1eaf57['body'],{'raw':_0x1eaf57[_0x993e('0x1e')]?_0x1eaf57['options'][_0x993e('0x1f')]===undefined?!![]:![]:!![]})[_0x993e('0x20')](function(_0x32b09e){logger['info'](_0x993e('0x1b'),_0x1eaf57);logger[_0x993e('0x21')](_0x993e('0x1b'),_0x1eaf57,JSON[_0x993e('0x14')](_0x32b09e));_0x130a8a(_0x32b09e);})[_0x993e('0x1a')](function(_0x328d22){logger[_0x993e('0x15')](_0x993e('0x1b'),_0x328d22[_0x993e('0x18')],_0x1eaf57);_0x425ab4(_0x22390e[_0x993e('0x15')](0x1f4,_0x328d22[_0x993e('0x18')]));});});}; \ No newline at end of file +var _0x1399=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify'];(function(_0x119e7a,_0x3949d3){var _0x1fb90a=function(_0x57eb3f){while(--_0x57eb3f){_0x119e7a['push'](_0x119e7a['shift']());}};_0x1fb90a(++_0x3949d3);}(_0x1399,0x16c));var _0x9139=function(_0x5f013e,_0x138a7b){_0x5f013e=_0x5f013e-0x0;var _0x247274=_0x1399[_0x5f013e];return _0x247274;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});config[_0x9139('0xa')]=_[_0x9139('0xb')](config['redis'],{'host':_0x9139('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9139('0xd'))[_0x9139('0xe')](socket);function respondWithRpcPromise(_0x4830cd,_0x315de8,_0x1bfa6b){return new BPromise(function(_0x5c90eb,_0x4f7f3a){return client[_0x9139('0xf')](_0x4830cd,_0x1bfa6b)[_0x9139('0x10')](function(_0x23357c){logger[_0x9139('0x11')](_0x9139('0x12'),_0x315de8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'),JSON['stringify'](_0x23357c));if(_0x23357c[_0x9139('0x14')]){if(_0x23357c[_0x9139('0x14')][_0x9139('0x15')]===0x1f4){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x23357c[_0x9139('0x14')]['message']);return _0x4f7f3a(_0x23357c['error']['message']);}logger[_0x9139('0x14')](_0x9139('0x12'),_0x315de8,_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);return _0x5c90eb(_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'));_0x5c90eb(_0x23357c[_0x9139('0x17')]['message']);}})['catch'](function(_0x30a363){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x30a363);_0x4f7f3a(_0x30a363);});});}exports[_0x9139('0x18')]=function(_0x1ef57b){var _0x1a592e=this;return new Promise(function(_0x3c8296,_0xd2eb33){return db[_0x9139('0x19')][_0x9139('0x1a')](_0x1ef57b[_0x9139('0x1b')],{'raw':_0x1ef57b[_0x9139('0x1c')]?_0x1ef57b[_0x9139('0x1c')][_0x9139('0x1d')]===undefined?!![]:![]:!![]})[_0x9139('0x10')](function(_0x5a3e2e){logger[_0x9139('0x11')](_0x9139('0x18'),_0x1ef57b);logger[_0x9139('0x1e')](_0x9139('0x18'),_0x1ef57b,JSON[_0x9139('0x1f')](_0x5a3e2e));_0x3c8296(_0x5a3e2e);})[_0x9139('0x20')](function(_0x4b7fe0){logger[_0x9139('0x14')](_0x9139('0x18'),_0x4b7fe0['message'],_0x1ef57b);_0xd2eb33(_0x1a592e[_0x9139('0x14')](0x1f4,_0x4b7fe0[_0x9139('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 055bfb0..79eb241 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 _0x802c=['length','mailMessage:','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x2fa76b,_0x2fef86){var _0x547c53=function(_0x210b55){while(--_0x210b55){_0x2fa76b['push'](_0x2fa76b['shift']());}};_0x547c53(++_0x2fef86);}(_0x802c,0xd1));var _0xc802=function(_0x363789,_0x285ecd){_0x363789=_0x363789-0x0;var _0x129141=_0x802c[_0x363789];return _0x129141;};'use strict';var MailMessageEvents=require(_0xc802('0x0'));var events=[_0xc802('0x1'),_0xc802('0x2'),_0xc802('0x3')];function createListener(_0x1b07c7,_0x262600){return function(_0x2ee49a){_0x262600[_0xc802('0x4')](_0x1b07c7,_0x2ee49a);};}function removeListener(_0x7d0b02,_0x4fc45e){return function(){MailMessageEvents[_0xc802('0x5')](_0x7d0b02,_0x4fc45e);};}exports[_0xc802('0x6')]=function(_0x45da20){for(var _0x450195=0x0,_0x5aeb37=events[_0xc802('0x7')];_0x450195<_0x5aeb37;_0x450195++){var _0x300985=events[_0x450195];var _0x144b78=createListener(_0xc802('0x8')+_0x300985,_0x45da20);MailMessageEvents['on'](_0x300985,_0x144b78);}}; \ No newline at end of file +var _0x74a1=['save','remove','emit','removeListener','register','mailMessage:','./mailMessage.events'];(function(_0x4c7ecf,_0x31a471){var _0x411b1e=function(_0x5b5404){while(--_0x5b5404){_0x4c7ecf['push'](_0x4c7ecf['shift']());}};_0x411b1e(++_0x31a471);}(_0x74a1,0x7d));var _0x174a=function(_0x31f8aa,_0x1d1aa1){_0x31f8aa=_0x31f8aa-0x0;var _0x5ef007=_0x74a1[_0x31f8aa];return _0x5ef007;};'use strict';var MailMessageEvents=require(_0x174a('0x0'));var events=[_0x174a('0x1'),_0x174a('0x2'),'update'];function createListener(_0x1f349d,_0x245cd4){return function(_0x304b85){_0x245cd4[_0x174a('0x3')](_0x1f349d,_0x304b85);};}function removeListener(_0x511332,_0x4843c2){return function(){MailMessageEvents[_0x174a('0x4')](_0x511332,_0x4843c2);};}exports[_0x174a('0x5')]=function(_0x2e951e){for(var _0x76fd51=0x0,_0x29bef3=events['length'];_0x76fd51<_0x29bef3;_0x76fd51++){var _0x1761e4=events[_0x76fd51];var _0x40cbc2=createListener(_0x174a('0x6')+_0x1761e4,_0x2e951e);MailMessageEvents['on'](_0x1761e4,_0x40cbc2);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index eded641..a734d54 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 _0x6e31=['/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','addAgents','put','destroy','removeTeams','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index'];(function(_0x1ec8fb,_0x8c43a9){var _0x166128=function(_0x41a20b){while(--_0x41a20b){_0x1ec8fb['push'](_0x1ec8fb['shift']());}};_0x166128(++_0x8c43a9);}(_0x6e31,0x89));var _0x16e3=function(_0x47f11f,_0x5e7078){_0x47f11f=_0x47f11f-0x0;var _0x3d8bdb=_0x6e31[_0x47f11f];return _0x3d8bdb;};'use strict';var multer=require('multer');var util=require(_0x16e3('0x0'));var path=require(_0x16e3('0x1'));var timeout=require(_0x16e3('0x2'));var express=require(_0x16e3('0x3'));var router=express[_0x16e3('0x4')]();var fs_extra=require(_0x16e3('0x5'));var auth=require(_0x16e3('0x6'));var interaction=require(_0x16e3('0x7'));var config=require(_0x16e3('0x8'));var controller=require(_0x16e3('0x9'));router[_0x16e3('0xa')]('/',auth[_0x16e3('0xb')](),controller[_0x16e3('0xc')]);router[_0x16e3('0xa')](_0x16e3('0xd'),auth[_0x16e3('0xb')](),controller['describe']);router[_0x16e3('0xa')](_0x16e3('0xe'),auth['isAuthenticated'](),controller[_0x16e3('0xf')]);router[_0x16e3('0xa')](_0x16e3('0x10'),auth[_0x16e3('0xb')](),controller[_0x16e3('0x11')]);router[_0x16e3('0xa')](_0x16e3('0x12'),auth[_0x16e3('0xb')](),controller[_0x16e3('0x13')]);router[_0x16e3('0xa')](_0x16e3('0x14'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x16e3('0xb')](),controller[_0x16e3('0x15')]);router[_0x16e3('0x16')]('/:id/teams',auth[_0x16e3('0xb')](),controller[_0x16e3('0x17')]);router['post'](_0x16e3('0x14'),auth[_0x16e3('0xb')](),controller[_0x16e3('0x18')]);router[_0x16e3('0x19')](_0x16e3('0xe'),auth[_0x16e3('0xb')](),controller['update']);router['delete'](_0x16e3('0xe'),auth['isAuthenticated'](),controller[_0x16e3('0x1a')]);router['delete'](_0x16e3('0x12'),auth['isAuthenticated'](),controller[_0x16e3('0x1b')]);router[_0x16e3('0x1c')](_0x16e3('0x14'),auth[_0x16e3('0xb')](),controller['removeAgents']);module[_0x16e3('0x1d')]=router; \ No newline at end of file +var _0x85c6=['/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x410654,_0x261af9){var _0x514041=function(_0x4638a9){while(--_0x4638a9){_0x410654['push'](_0x410654['shift']());}};_0x514041(++_0x261af9);}(_0x85c6,0x98));var _0x685c=function(_0x15c124,_0x15bc08){_0x15c124=_0x15c124-0x0;var _0x27f3f0=_0x85c6[_0x15c124];return _0x27f3f0;};'use strict';var multer=require('multer');var util=require(_0x685c('0x0'));var path=require(_0x685c('0x1'));var timeout=require(_0x685c('0x2'));var express=require(_0x685c('0x3'));var router=express[_0x685c('0x4')]();var fs_extra=require(_0x685c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x685c('0x6'));var config=require('../../config/environment');var controller=require(_0x685c('0x7'));router[_0x685c('0x8')]('/',auth[_0x685c('0x9')](),controller['index']);router['get'](_0x685c('0xa'),auth[_0x685c('0x9')](),controller[_0x685c('0xb')]);router[_0x685c('0x8')](_0x685c('0xc'),auth[_0x685c('0x9')](),controller[_0x685c('0xd')]);router['get'](_0x685c('0xe'),auth[_0x685c('0x9')](),controller[_0x685c('0xf')]);router['get'](_0x685c('0x10'),auth[_0x685c('0x9')](),controller[_0x685c('0x11')]);router[_0x685c('0x8')](_0x685c('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x685c('0x13')]('/',auth[_0x685c('0x9')](),controller[_0x685c('0x14')]);router[_0x685c('0x13')](_0x685c('0x10'),auth[_0x685c('0x9')](),controller[_0x685c('0x15')]);router[_0x685c('0x13')](_0x685c('0x12'),auth[_0x685c('0x9')](),controller[_0x685c('0x16')]);router['put'](_0x685c('0xc'),auth[_0x685c('0x9')](),controller[_0x685c('0x17')]);router['delete'](_0x685c('0xc'),auth[_0x685c('0x9')](),controller[_0x685c('0x18')]);router[_0x685c('0x19')]('/:id/teams',auth[_0x685c('0x9')](),controller[_0x685c('0x1a')]);router[_0x685c('0x19')]('/:id/users',auth[_0x685c('0x9')](),controller['removeAgents']);module[_0x685c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 75a8813..b0e30d6 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 _0xb773=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb773,0x88));var _0x3b77=function(_0x20008a,_0x362490){_0x20008a=_0x20008a-0x0;var _0x5d0f1c=_0xb773[_0x20008a];return _0x5d0f1c;};'use strict';var Sequelize=require(_0x3b77('0x0'));module[_0x3b77('0x1')]={'name':{'type':Sequelize[_0x3b77('0x2')],'unique':_0x3b77('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3b77('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3b77('0x4')](_0x3b77('0x5'),_0x3b77('0x6'),_0x3b77('0x7'))}}; \ No newline at end of file +var _0x0d78=['exports','STRING','name','rrmemory','roundrobin'];(function(_0x4bcff9,_0x11806a){var _0x5b42e5=function(_0x37c2ed){while(--_0x37c2ed){_0x4bcff9['push'](_0x4bcff9['shift']());}};_0x5b42e5(++_0x11806a);}(_0x0d78,0xc3));var _0x80d7=function(_0xe4d35a,_0x4bd94d){_0xe4d35a=_0xe4d35a-0x0;var _0x249363=_0x0d78[_0xe4d35a];return _0x249363;};'use strict';var Sequelize=require('sequelize');module[_0x80d7('0x0')]={'name':{'type':Sequelize[_0x80d7('0x1')],'unique':_0x80d7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x80d7('0x3'),'beepall',_0x80d7('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ac6b462..5aa7509 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 _0x3bf2=['attributes','fields','length','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','nolimit','sort','pick','MailQueueId','filter','UserMailQueue','findAll','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','SIP','getTeams','Team','order','addTeams','ids','User','Agents','online','voicePause','sequelize','transaction','forEach','removeTeams','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','MailQueues','UserProfileResource','then','end','error','stack','name','map','MailQueue','rawAttributes','type','key','where','include','query','rows','catch','params','model','keys','filters','intersection'];(function(_0x2cac89,_0x134362){var _0x375819=function(_0x1be5d5){while(--_0x1be5d5){_0x2cac89['push'](_0x2cac89['shift']());}};_0x375819(++_0x134362);}(_0x3bf2,0x1a6));var _0x23bf=function(_0x1bae3e,_0x12950c){_0x1bae3e=_0x1bae3e-0x0;var _0x170b37=_0x3bf2[_0x1bae3e];return _0x170b37;};'use strict';var BPromise=require(_0x23bf('0x0'));var util=require(_0x23bf('0x1'));var _=require(_0x23bf('0x2'));var squel=require(_0x23bf('0x3'));var Redis=require('ioredis');var qs=require(_0x23bf('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x23bf('0x5'));var db=require(_0x23bf('0x6'))['db'];config[_0x23bf('0x7')]=_[_0x23bf('0x8')](config[_0x23bf('0x7')],{'host':_0x23bf('0x9'),'port':0x18eb});var socket=require(_0x23bf('0xa'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x23bf('0xb')](socket);function respondWithStatusCode(_0x32f64a,_0x5a8a5d){_0x5a8a5d=_0x5a8a5d||0xcc;return function(_0x186404){if(_0x186404){return _0x32f64a[_0x23bf('0xc')](_0x5a8a5d);}return _0x32f64a[_0x23bf('0xd')](_0x5a8a5d)['end']();};}function respondWithResult(_0x3e9a55,_0x421b13){_0x421b13=_0x421b13||0xc8;return function(_0xa87b23){if(_0xa87b23){return _0x3e9a55['status'](_0x421b13)[_0x23bf('0xe')](_0xa87b23);}};}function respondWithFilteredResult(_0xfa1b98,_0x2439da){return function(_0x3d79f4){if(_0x3d79f4){var _0x15d493=typeof _0x2439da[_0x23bf('0xf')]===_0x23bf('0x10')&&typeof _0x2439da['limit']===_0x23bf('0x10');var _0x1a33c5=_0x3d79f4[_0x23bf('0x11')];var _0x468222=_0x15d493?0x0:_0x2439da[_0x23bf('0xf')];var _0x59b9c0=_0x15d493?_0x3d79f4[_0x23bf('0x11')]:_0x2439da[_0x23bf('0xf')]+_0x2439da[_0x23bf('0x12')];var _0x1acc04;if(_0x59b9c0>=_0x1a33c5){_0x59b9c0=_0x1a33c5;_0x1acc04=0xc8;}else{_0x1acc04=0xce;}_0xfa1b98['status'](_0x1acc04);return _0xfa1b98[_0x23bf('0x13')](_0x23bf('0x14'),_0x468222+'-'+_0x59b9c0+'/'+_0x1a33c5)[_0x23bf('0xe')](_0x3d79f4);}return null;};}function saveUpdates(_0x4fab2a){return function(_0x19a683){if(_0x19a683){return _0x19a683[_0x23bf('0x15')](_0x4fab2a)['then'](function(_0x4daa94){return _0x4daa94;});}return null;};}function removeEntity(_0x190da4){return function(_0x547340){if(_0x547340){return _0x547340[_0x23bf('0x16')]()['then'](function(){var _0x3907fc=_0x547340[_0x23bf('0x17')]({'plain':!![]});var _0x24d59b=_0x23bf('0x18');return db[_0x23bf('0x19')]['destroy']({'where':{'type':_0x24d59b,'resourceId':_0x3907fc['id']}})[_0x23bf('0x1a')](function(){return _0x547340;});})['then'](function(){_0x190da4[_0x23bf('0xd')](0xcc)[_0x23bf('0x1b')]();});}};}function handleEntityNotFound(_0xba483f){return function(_0x528979){if(!_0x528979){_0xba483f[_0x23bf('0xc')](0x194);}return _0x528979;};}function handleError(_0x3455ae,_0x25374c){_0x25374c=_0x25374c||0x1f4;return function(_0x4fe2e1){logger[_0x23bf('0x1c')](_0x4fe2e1[_0x23bf('0x1d')]);if(_0x4fe2e1[_0x23bf('0x1e')]){delete _0x4fe2e1[_0x23bf('0x1e')];}_0x3455ae[_0x23bf('0xd')](_0x25374c)['send'](_0x4fe2e1);};}exports['index']=function(_0x4be0f9,_0x1feda9){var _0x3c161a={};var _0x53bf73={'count':0x0,'rows':[]};var _0x5ec7ee=_[_0x23bf('0x1f')](db[_0x23bf('0x20')][_0x23bf('0x21')],function(_0x3cc7bd){return{'name':_0x3cc7bd['fieldName'],'type':_0x3cc7bd[_0x23bf('0x22')][_0x23bf('0x23')]};});_0x3c161a=qs['getOptions'](_0x5ec7ee,_0x4be0f9);var _0x55326d={'where':_0x3c161a[_0x23bf('0x24')]};return db[_0x23bf('0x20')][_0x23bf('0x11')](_0x55326d)[_0x23bf('0x1a')](function(_0x57ecdc){_0x53bf73[_0x23bf('0x11')]=_0x57ecdc;_0x3c161a['include']=qs[_0x23bf('0x25')](_0x4be0f9[_0x23bf('0x26')]);return db['MailQueue']['findAll'](_0x3c161a);})[_0x23bf('0x1a')](function(_0x213027){_0x53bf73[_0x23bf('0x27')]=_0x213027;return _0x53bf73;})['then'](respondWithFilteredResult(_0x1feda9,_0x3c161a))[_0x23bf('0x28')](handleError(_0x1feda9,null));};exports['show']=function(_0x28d5b8,_0x35feb1){var _0xef337c={'raw':!![],'where':{'id':_0x28d5b8[_0x23bf('0x29')]['id']}},_0x14a2d2={};_0x14a2d2[_0x23bf('0x2a')]=_[_0x23bf('0x2b')](db[_0x23bf('0x20')]['rawAttributes']);_0x14a2d2['query']=_[_0x23bf('0x2b')](_0x28d5b8[_0x23bf('0x26')]);_0x14a2d2[_0x23bf('0x2c')]=_[_0x23bf('0x2d')](_0x14a2d2['model'],_0x14a2d2[_0x23bf('0x26')]);_0xef337c[_0x23bf('0x2e')]=_[_0x23bf('0x2d')](_0x14a2d2[_0x23bf('0x2a')],qs[_0x23bf('0x2f')](_0x28d5b8['query'][_0x23bf('0x2f')]));_0xef337c[_0x23bf('0x2e')]=_0xef337c[_0x23bf('0x2e')][_0x23bf('0x30')]?_0xef337c['attributes']:_0x14a2d2['model'];if(_0x28d5b8['query']['includeAll']){_0xef337c[_0x23bf('0x25')]=[{'all':!![]}];}_0xef337c=_[_0x23bf('0x31')]({},_0xef337c,_0x28d5b8[_0x23bf('0x32')]);return db[_0x23bf('0x20')]['find'](_0xef337c)[_0x23bf('0x1a')](handleEntityNotFound(_0x35feb1,null))[_0x23bf('0x1a')](respondWithResult(_0x35feb1,null))['catch'](handleError(_0x35feb1,null));};exports[_0x23bf('0x33')]=function(_0x412e08,_0x3d23f1){return db[_0x23bf('0x20')][_0x23bf('0x33')](_0x412e08['body'],{})[_0x23bf('0x1a')](function(_0x14bcc7){var _0xbdf21e=_0x412e08[_0x23bf('0x34')][_0x23bf('0x17')]({'plain':!![]});if(!_0xbdf21e)throw new Error(_0x23bf('0x35'));if(_0xbdf21e['role']===_0x23bf('0x34')){var _0x3ea5aa=_0x14bcc7[_0x23bf('0x17')]({'plain':!![]});var _0x4ec991=_0x23bf('0x18');return db[_0x23bf('0x36')][_0x23bf('0x37')]({'where':{'name':_0x4ec991,'userProfileId':_0xbdf21e[_0x23bf('0x38')]},'raw':!![]})['then'](function(_0x1291fc){if(_0x1291fc&&_0x1291fc[_0x23bf('0x39')]===0x0){return db['UserProfileResource']['create']({'name':_0x3ea5aa['name'],'resourceId':_0x3ea5aa['id'],'type':_0x1291fc[_0x23bf('0x1e')],'sectionId':_0x1291fc['id']},{})[_0x23bf('0x1a')](function(){return _0x14bcc7;});}else{return _0x14bcc7;}})['catch'](function(_0x519581){logger[_0x23bf('0x1c')](_0x23bf('0x3a'),_0x519581);throw _0x519581;});}return _0x14bcc7;})[_0x23bf('0x1a')](respondWithResult(_0x3d23f1,0xc9))['catch'](handleError(_0x3d23f1,null));};exports[_0x23bf('0x15')]=function(_0x63dbb7,_0x1596c3){if(_0x63dbb7[_0x23bf('0x3b')]['id']){delete _0x63dbb7[_0x23bf('0x3b')]['id'];}return db[_0x23bf('0x20')][_0x23bf('0x37')]({'where':{'id':_0x63dbb7['params']['id']}})[_0x23bf('0x1a')](handleEntityNotFound(_0x1596c3,null))['then'](saveUpdates(_0x63dbb7[_0x23bf('0x3b')],null))['then'](respondWithResult(_0x1596c3,null))[_0x23bf('0x28')](handleError(_0x1596c3,null));};exports['destroy']=function(_0x2ad3c4,_0x3a08cd){return db[_0x23bf('0x20')][_0x23bf('0x37')]({'where':{'id':_0x2ad3c4['params']['id']}})[_0x23bf('0x1a')](handleEntityNotFound(_0x3a08cd,null))['then'](removeEntity(_0x3a08cd,null))[_0x23bf('0x28')](handleError(_0x3a08cd,null));};exports['describe']=function(_0x3b70fd,_0x1a4f02){return db['MailQueue'][_0x23bf('0x3c')]()['then'](respondWithResult(_0x1a4f02,null))[_0x23bf('0x28')](handleError(_0x1a4f02,null));};exports[_0x23bf('0x3d')]=function(_0x45862a,_0x29bbfe){var _0x315429={'raw':!![],'where':{}},_0x44e9f2={},_0x17e9b;return db[_0x23bf('0x20')][_0x23bf('0x3e')]({'where':{'id':_0x45862a[_0x23bf('0x29')]['id']}})[_0x23bf('0x1a')](handleEntityNotFound(_0x29bbfe,null))[_0x23bf('0x1a')](function(_0x3b3e8){if(_0x3b3e8){_0x17e9b=_0x3b3e8[_0x23bf('0x17')]({'plain':!![]});_0x44e9f2[_0x23bf('0x2a')]=_[_0x23bf('0x2b')](db['UserMailQueue'][_0x23bf('0x21')]);_0x44e9f2[_0x23bf('0x26')]=_['keys'](_0x45862a[_0x23bf('0x26')]);_0x44e9f2[_0x23bf('0x2c')]=_[_0x23bf('0x2d')](_0x44e9f2[_0x23bf('0x2a')],_0x44e9f2[_0x23bf('0x26')]);_0x315429['attributes']=_[_0x23bf('0x2d')](_0x44e9f2['model'],qs[_0x23bf('0x2f')](_0x45862a['query'][_0x23bf('0x2f')]));_0x315429[_0x23bf('0x2e')]=_0x315429['attributes'][_0x23bf('0x30')]?_0x315429[_0x23bf('0x2e')]:_0x44e9f2[_0x23bf('0x2a')];if(!_0x45862a['query'][_0x23bf('0x3f')](_0x23bf('0x40'))){_0x315429[_0x23bf('0x12')]=qs[_0x23bf('0x12')](_0x45862a[_0x23bf('0x26')]['limit']);_0x315429[_0x23bf('0xf')]=qs[_0x23bf('0xf')](_0x45862a['query'][_0x23bf('0xf')]);}_0x315429['order']=qs[_0x23bf('0x41')](_0x45862a[_0x23bf('0x26')][_0x23bf('0x41')]);_0x315429['where']=qs['filters'](_[_0x23bf('0x42')](_0x45862a['query'],_0x44e9f2[_0x23bf('0x2c')]));_0x315429[_0x23bf('0x24')][_0x23bf('0x43')]=_0x3b3e8['id'];if(_0x45862a[_0x23bf('0x26')][_0x23bf('0x44')]){_0x315429[_0x23bf('0x24')]=_[_0x23bf('0x31')](_0x315429[_0x23bf('0x24')],{'$or':_[_0x23bf('0x1f')](_0x315429[_0x23bf('0x2e')],function(_0x3ccfd0){var _0x31c3ed={};_0x31c3ed[_0x3ccfd0]={'$like':'%'+_0x45862a['query'][_0x23bf('0x44')]+'%'};return _0x31c3ed;})});}_0x315429=_[_0x23bf('0x31')]({},_0x315429,_0x45862a['options']);return db[_0x23bf('0x45')][_0x23bf('0x46')](_0x315429);}})[_0x23bf('0x1a')](function(_0x1935cf){if(_0x1935cf){return db['User'][_0x23bf('0x47')]({'where':{'id':_[_0x23bf('0x1f')](_0x1935cf,_0x23bf('0x48')),'role':_0x23bf('0x49')},'attributes':['id',_0x23bf('0x1e'),_0x23bf('0x4a'),_0x23bf('0x4b'),_0x23bf('0x4c')]});}})[_0x23bf('0x1a')](function(_0x5d65ea){if(_0x5d65ea){return{'count':_0x5d65ea[_0x23bf('0x11')],'rows':_[_0x23bf('0x1f')](_0x5d65ea['rows'],function(_0x4cdcf5){return{'membername':_0x4cdcf5[_0x23bf('0x1e')],'UserId':_0x4cdcf5['id'],'queue_name':_0x17e9b[_0x23bf('0x1e')],'MailQueueId':_0x17e9b['id'],'interface':util['format']('%s/%s',_0x23bf('0x4d'),_0x4cdcf5[_0x23bf('0x1e')]),'penalty':0x0,'paused':_0x4cdcf5[_0x23bf('0x4a')],'createdAt':_0x4cdcf5[_0x23bf('0x4c')],'updatedAt':_0x4cdcf5[_0x23bf('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x23bf('0x1a')](respondWithFilteredResult(_0x29bbfe,_0x315429))[_0x23bf('0x28')](handleError(_0x29bbfe,null));};exports[_0x23bf('0x4e')]=function(_0x5175ad,_0x3c31a4){var _0x1d8869={};var _0x1d4b31={};var _0x1a5053;var _0x468812;return db['MailQueue'][_0x23bf('0x3e')]({'where':{'id':_0x5175ad['params']['id']}})['then'](handleEntityNotFound(_0x3c31a4,null))['then'](function(_0x29b66a){if(_0x29b66a){_0x1a5053=_0x29b66a;_0x1d4b31[_0x23bf('0x2a')]=_['keys'](db[_0x23bf('0x4f')][_0x23bf('0x21')]);_0x1d4b31[_0x23bf('0x26')]=_['keys'](_0x5175ad['query']);_0x1d4b31['filters']=_[_0x23bf('0x2d')](_0x1d4b31[_0x23bf('0x2a')],_0x1d4b31[_0x23bf('0x26')]);_0x1d8869['attributes']=_['intersection'](_0x1d4b31['model'],qs[_0x23bf('0x2f')](_0x5175ad['query'][_0x23bf('0x2f')]));_0x1d8869[_0x23bf('0x2e')]=_0x1d8869['attributes'][_0x23bf('0x30')]?_0x1d8869['attributes']:_0x1d4b31[_0x23bf('0x2a')];_0x1d8869[_0x23bf('0x50')]=qs[_0x23bf('0x41')](_0x5175ad[_0x23bf('0x26')][_0x23bf('0x41')]);_0x1d8869['where']=qs[_0x23bf('0x2c')](_[_0x23bf('0x42')](_0x5175ad[_0x23bf('0x26')],_0x1d4b31['filters']));if(_0x5175ad[_0x23bf('0x26')][_0x23bf('0x44')]){_0x1d8869[_0x23bf('0x24')]=_[_0x23bf('0x31')](_0x1d8869[_0x23bf('0x24')],{'$or':_[_0x23bf('0x1f')](_0x1d8869[_0x23bf('0x2e')],function(_0x5c6496){var _0x559c4e={};_0x559c4e[_0x5c6496]={'$like':'%'+_0x5175ad[_0x23bf('0x26')][_0x23bf('0x44')]+'%'};return _0x559c4e;})});}_0x1d8869=_[_0x23bf('0x31')]({},_0x1d8869,_0x5175ad[_0x23bf('0x32')]);return _0x1a5053[_0x23bf('0x4e')](_0x1d8869);}})[_0x23bf('0x1a')](function(_0x34a0e9){if(_0x34a0e9){_0x468812=_0x34a0e9[_0x23bf('0x30')];if(!_0x5175ad[_0x23bf('0x26')][_0x23bf('0x3f')](_0x23bf('0x40'))){_0x1d8869[_0x23bf('0x12')]=qs['limit'](_0x5175ad[_0x23bf('0x26')][_0x23bf('0x12')]);_0x1d8869[_0x23bf('0xf')]=qs[_0x23bf('0xf')](_0x5175ad[_0x23bf('0x26')]['offset']);}return _0x1a5053[_0x23bf('0x4e')](_0x1d8869);}})[_0x23bf('0x1a')](function(_0x528c42){if(_0x528c42){return _0x528c42?{'count':_0x468812,'rows':_0x528c42}:null;}})['then'](respondWithResult(_0x3c31a4,null))[_0x23bf('0x28')](handleError(_0x3c31a4,null));};exports[_0x23bf('0x51')]=function(_0x1c0fad,_0x22b6ae){var _0x1173ff=_0x1c0fad['body'][_0x23bf('0x52')];return db['Team'][_0x23bf('0x46')]({'where':{'id':_0x1173ff},'attributes':['id'],'include':[{'model':db[_0x23bf('0x53')],'as':_0x23bf('0x54'),'attributes':['id',_0x23bf('0x1e'),_0x23bf('0x55'),_0x23bf('0x56'),'interface'],'raw':!![]}]})[_0x23bf('0x1a')](function(_0x131468){if(_0x131468){var _0x732992=_['flatMap'](_0x131468,function(_0x4ffdaa){var _0x3153d6=_0x4ffdaa[_0x23bf('0x17')]({'plain':!![]});return _0x3153d6[_0x23bf('0x54')];});return db[_0x23bf('0x20')][_0x23bf('0x37')]({'where':{'id':_0x1c0fad[_0x23bf('0x29')]['id']}})[_0x23bf('0x1a')](function(_0x506ab0){return db[_0x23bf('0x57')][_0x23bf('0x58')](function(_0xaf8ba0){return _0x506ab0[_0x23bf('0x51')](_0x1173ff,{'transaction':_0xaf8ba0})[_0x23bf('0x1a')](function(){return BPromise['each'](_0x732992,function(_0x3368e3){return db[_0x23bf('0x45')]['findOrCreate']({'where':{'UserId':_0x3368e3['id'],'MailQueueId':_0x1c0fad[_0x23bf('0x29')]['id']},'transaction':_0xaf8ba0});});})[_0x23bf('0x1a')](function(){_0x732992[_0x23bf('0x59')](function(_0x5f1510){socket['emit']('userMailQueue:save',{'UserId':_0x5f1510['id'],'MailQueueId':_0x506ab0['id']});});});});});}})[_0x23bf('0x1a')](respondWithStatusCode(_0x22b6ae,null))['catch'](handleError(_0x22b6ae,null));};exports[_0x23bf('0x5a')]=function(_0x35ef83,_0x3947f8){return db['Team'][_0x23bf('0x46')]({'where':{'id':_0x35ef83[_0x23bf('0x26')][_0x23bf('0x52')]},'attributes':['id'],'include':[{'model':db[_0x23bf('0x53')],'as':_0x23bf('0x54'),'attributes':['id'],'raw':!![]}]})[_0x23bf('0x1a')](handleEntityNotFound(_0x3947f8,null))[_0x23bf('0x1a')](function(_0x1d6233){var _0x545450=_['map'](_0x1d6233,'id');var _0x3287dc=[];var _0x3d187f=[];var _0x20c581=squel['select']();_0x20c581[_0x23bf('0x5b')]('tq.TeamId')[_0x23bf('0x5c')]('team_has_mail_queues','tq')[_0x23bf('0x5d')](_0x23bf('0x5e'),'ut',_0x23bf('0x5f'))[_0x23bf('0x24')](_0x23bf('0x60'),_0x35ef83['params']['id']);for(var _0x1cea28=0x0;_0x1cea28<_0x1d6233[_0x23bf('0x30')];_0x1cea28+=0x1){let _0x11a6c4=_0x1d6233[_0x1cea28];for(var _0x1408d8=0x0;_0x1408d8<_0x11a6c4[_0x23bf('0x54')][_0x23bf('0x30')];_0x1408d8+=0x1){let _0x13812a=_0x11a6c4[_0x23bf('0x54')][_0x1408d8];var _0x49b0aa=_0x20c581[_0x23bf('0x61')]();_0x49b0aa[_0x23bf('0x24')](_0x23bf('0x62'),_0x13812a['id']);_0x3d187f[_0x23bf('0x63')](db[_0x23bf('0x57')][_0x23bf('0x26')](_0x49b0aa[_0x23bf('0x64')](),{'type':db[_0x23bf('0x57')][_0x23bf('0x65')][_0x23bf('0x66')]})[_0x23bf('0x1a')](function(_0x5e39d0){if(_0x5e39d0['length']===0x1){return _0x13812a['id'];}else{var _0x8416d4=_['every'](_[_0x23bf('0x1f')](_0x5e39d0,_0x23bf('0x67')),function(_0x388d8d){return _[_0x23bf('0x68')](_0x545450,_0x388d8d);});if(_0x8416d4){return _0x13812a['id'];}}}));}}return BPromise[_0x23bf('0x69')](_0x3d187f)[_0x23bf('0x1a')](function(_0x21af31){_0x3287dc=_(_0x3287dc)['union'](_0x21af31)[_0x23bf('0x6a')]()['value']();return db[_0x23bf('0x20')]['find']({'where':{'id':_0x35ef83[_0x23bf('0x29')]['id']}})[_0x23bf('0x1a')](function(_0x2eca03){return db[_0x23bf('0x57')][_0x23bf('0x58')](function(_0x2883ce){return _0x2eca03[_0x23bf('0x5a')](_0x35ef83[_0x23bf('0x26')][_0x23bf('0x52')],{'transaction':_0x2883ce})['then'](function(){if(!_[_0x23bf('0x6b')](_0x3287dc)){return _0x2eca03[_0x23bf('0x6c')](_0x3287dc,{'transaction':_0x2883ce});}})[_0x23bf('0x1a')](function(){_0x3287dc[_0x23bf('0x59')](function(_0xeb8fc8){socket[_0x23bf('0x6d')](_0x23bf('0x6e'),{'UserId':_0xeb8fc8,'MailQueueId':_0x2eca03['id']});});});});});});})[_0x23bf('0x1a')](respondWithStatusCode(_0x3947f8,null))['catch'](handleError(_0x3947f8,null));};exports['addAgents']=function(_0x207bf9,_0x743ff5){return db[_0x23bf('0x20')][_0x23bf('0x37')]({'where':{'id':_0x207bf9[_0x23bf('0x29')]['id']}})[_0x23bf('0x1a')](handleEntityNotFound(_0x743ff5,null))[_0x23bf('0x1a')](function(_0x519948){if(_0x519948){return _0x519948[_0x23bf('0x6f')](_0x207bf9[_0x23bf('0x3b')][_0x23bf('0x52')],_[_0x23bf('0x70')](_0x207bf9['body'],[_0x23bf('0x52'),'id'])||{})[_0x23bf('0x71')](function(_0x5b6e45){for(var _0x4ac5c3=0x0;_0x4ac5c3<_0x207bf9[_0x23bf('0x3b')][_0x23bf('0x52')][_0x23bf('0x30')];_0x4ac5c3+=0x1){socket[_0x23bf('0x6d')](_0x23bf('0x72'),{'UserId':Number(_0x207bf9[_0x23bf('0x3b')][_0x23bf('0x52')][_0x4ac5c3]),'MailQueueId':Number(_0x207bf9[_0x23bf('0x29')]['id'])});}return _0x5b6e45;});}})[_0x23bf('0x1a')](respondWithResult(_0x743ff5,null))[_0x23bf('0x28')](handleError(_0x743ff5,null));};exports[_0x23bf('0x6c')]=function(_0x30aafb,_0x473b08){return db[_0x23bf('0x20')]['find']({'where':{'id':_0x30aafb[_0x23bf('0x29')]['id']}})[_0x23bf('0x1a')](handleEntityNotFound(_0x473b08,null))[_0x23bf('0x1a')](function(_0x70671e){if(_0x70671e){return _0x70671e['removeAgents'](_0x30aafb[_0x23bf('0x26')]['ids'])['then'](function(){if(_[_0x23bf('0x73')](_0x30aafb[_0x23bf('0x26')]['ids'])){for(var _0x2db36b=0x0;_0x2db36b<_0x30aafb[_0x23bf('0x26')][_0x23bf('0x52')][_0x23bf('0x30')];_0x2db36b+=0x1){socket[_0x23bf('0x6d')]('userMailQueue:remove',{'UserId':Number(_0x30aafb[_0x23bf('0x26')][_0x23bf('0x52')][_0x2db36b]),'MailQueueId':Number(_0x30aafb[_0x23bf('0x29')]['id'])});}}else{socket[_0x23bf('0x6d')](_0x23bf('0x6e'),{'UserId':Number(_0x30aafb[_0x23bf('0x26')]['ids']),'MailQueueId':Number(_0x30aafb[_0x23bf('0x29')]['id'])});}});}})[_0x23bf('0x1a')](respondWithStatusCode(_0x473b08,null))[_0x23bf('0x28')](handleError(_0x473b08,null));};exports[_0x23bf('0x74')]=function(_0x4aad8f,_0x2275c5){var _0x34d799={};var _0x5e899a={};var _0x5641f6;var _0x4d4654;return db[_0x23bf('0x20')]['findOne']({'where':{'id':_0x4aad8f[_0x23bf('0x29')]['id']}})[_0x23bf('0x1a')](handleEntityNotFound(_0x2275c5,null))[_0x23bf('0x1a')](function(_0xf6f227){if(_0xf6f227){_0x5641f6=_0xf6f227;_0x5e899a[_0x23bf('0x2a')]=_['keys'](db[_0x23bf('0x53')][_0x23bf('0x21')]);_0x5e899a[_0x23bf('0x26')]=_[_0x23bf('0x2b')](_0x4aad8f['query']);_0x5e899a[_0x23bf('0x2c')]=_['intersection'](_0x5e899a[_0x23bf('0x2a')],_0x5e899a[_0x23bf('0x26')]);_0x34d799[_0x23bf('0x2e')]=_['intersection'](_0x5e899a[_0x23bf('0x2a')],qs[_0x23bf('0x2f')](_0x4aad8f[_0x23bf('0x26')][_0x23bf('0x2f')]));_0x34d799[_0x23bf('0x2e')]=_0x34d799['attributes'][_0x23bf('0x30')]?_0x34d799['attributes']:_0x5e899a[_0x23bf('0x2a')];_0x34d799[_0x23bf('0x50')]=qs[_0x23bf('0x41')](_0x4aad8f[_0x23bf('0x26')][_0x23bf('0x41')]);_0x34d799['where']=qs[_0x23bf('0x2c')](_['pick'](_0x4aad8f[_0x23bf('0x26')],_0x5e899a[_0x23bf('0x2c')]));if(_0x4aad8f['query']['filter']){_0x34d799[_0x23bf('0x24')]=_['merge'](_0x34d799[_0x23bf('0x24')],{'$or':_['map'](_0x34d799[_0x23bf('0x2e')],function(_0x3a4609){var _0x4c6616={};_0x4c6616[_0x3a4609]={'$like':'%'+_0x4aad8f['query']['filter']+'%'};return _0x4c6616;})});}_0x34d799=_[_0x23bf('0x31')]({},_0x34d799,_0x4aad8f[_0x23bf('0x32')]);return _0x5641f6[_0x23bf('0x74')](_0x34d799);}})[_0x23bf('0x1a')](function(_0x13618f){if(_0x13618f){_0x4d4654=_0x13618f[_0x23bf('0x30')];if(!_0x4aad8f['query']['hasOwnProperty']('nolimit')){_0x34d799[_0x23bf('0x12')]=qs[_0x23bf('0x12')](_0x4aad8f['query'][_0x23bf('0x12')]);_0x34d799[_0x23bf('0xf')]=qs[_0x23bf('0xf')](_0x4aad8f[_0x23bf('0x26')]['offset']);}return _0x5641f6[_0x23bf('0x74')](_0x34d799);}})[_0x23bf('0x1a')](function(_0x556aaf){if(_0x556aaf){return _0x556aaf?{'count':_0x4d4654,'rows':_0x556aaf}:null;}})[_0x23bf('0x1a')](respondWithResult(_0x2275c5,null))[_0x23bf('0x28')](handleError(_0x2275c5,null));}; \ No newline at end of file +var _0x4f11=['mailPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','User','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','removeAgents','addAgents','omit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','query','keys','attributes','intersection','fields','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','filters','nolimit','limit','order','sort','pick','MailQueueId','filter','merge','UserMailQueue','findAndCountAll','UserId','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f11,0x1a7));var _0x14f1=function(_0x4c5279,_0x21aeb8){_0x4c5279=_0x4c5279-0x0;var _0x455832=_0x4f11[_0x4c5279];return _0x455832;};'use strict';var BPromise=require(_0x14f1('0x0'));var util=require(_0x14f1('0x1'));var _=require(_0x14f1('0x2'));var squel=require(_0x14f1('0x3'));var Redis=require('ioredis');var qs=require(_0x14f1('0x4'));var logger=require(_0x14f1('0x5'))('api');var config=require(_0x14f1('0x6'));var db=require('../../mysqldb')['db'];config[_0x14f1('0x7')]=_[_0x14f1('0x8')](config[_0x14f1('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x14f1('0x9'))(new Redis(config[_0x14f1('0x7')]));require(_0x14f1('0xa'))[_0x14f1('0xb')](socket);function respondWithStatusCode(_0x39a31b,_0x2768a0){_0x2768a0=_0x2768a0||0xcc;return function(_0xf19e5d){if(_0xf19e5d){return _0x39a31b[_0x14f1('0xc')](_0x2768a0);}return _0x39a31b[_0x14f1('0xd')](_0x2768a0)[_0x14f1('0xe')]();};}function respondWithResult(_0x116bc3,_0x4b0055){_0x4b0055=_0x4b0055||0xc8;return function(_0x335776){if(_0x335776){return _0x116bc3['status'](_0x4b0055)[_0x14f1('0xf')](_0x335776);}};}function respondWithFilteredResult(_0x3131d0,_0x313b83){return function(_0x98651d){if(_0x98651d){var _0x22eddf=typeof _0x313b83[_0x14f1('0x10')]===_0x14f1('0x11')&&typeof _0x313b83['limit']===_0x14f1('0x11');var _0x53e6e0=_0x98651d[_0x14f1('0x12')];var _0x322fd1=_0x22eddf?0x0:_0x313b83['offset'];var _0x183597=_0x22eddf?_0x98651d[_0x14f1('0x12')]:_0x313b83['offset']+_0x313b83['limit'];var _0x531042;if(_0x183597>=_0x53e6e0){_0x183597=_0x53e6e0;_0x531042=0xc8;}else{_0x531042=0xce;}_0x3131d0[_0x14f1('0xd')](_0x531042);return _0x3131d0['set'](_0x14f1('0x13'),_0x322fd1+'-'+_0x183597+'/'+_0x53e6e0)[_0x14f1('0xf')](_0x98651d);}return null;};}function saveUpdates(_0x2c9b81){return function(_0x27ff18){if(_0x27ff18){return _0x27ff18['update'](_0x2c9b81)[_0x14f1('0x14')](function(_0x38f018){return _0x38f018;});}return null;};}function removeEntity(_0x164325){return function(_0x30e371){if(_0x30e371){return _0x30e371[_0x14f1('0x15')]()['then'](function(){var _0x1a667e=_0x30e371[_0x14f1('0x16')]({'plain':!![]});var _0x1f5df7='MailQueues';return db[_0x14f1('0x17')][_0x14f1('0x15')]({'where':{'type':_0x1f5df7,'resourceId':_0x1a667e['id']}})['then'](function(){return _0x30e371;});})[_0x14f1('0x14')](function(){_0x164325['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f838d){return function(_0x238543){if(!_0x238543){_0x3f838d['sendStatus'](0x194);}return _0x238543;};}function handleError(_0x1f54a2,_0x134237){_0x134237=_0x134237||0x1f4;return function(_0x582c86){logger[_0x14f1('0x18')](_0x582c86[_0x14f1('0x19')]);if(_0x582c86[_0x14f1('0x1a')]){delete _0x582c86[_0x14f1('0x1a')];}_0x1f54a2[_0x14f1('0xd')](_0x134237)[_0x14f1('0x1b')](_0x582c86);};}exports[_0x14f1('0x1c')]=function(_0x1f45b0,_0x56992d){var _0x2cbba7={};var _0x321c64={'count':0x0,'rows':[]};var _0x3021ed=_[_0x14f1('0x1d')](db[_0x14f1('0x1e')][_0x14f1('0x1f')],function(_0x1898c4){return{'name':_0x1898c4['fieldName'],'type':_0x1898c4[_0x14f1('0x20')][_0x14f1('0x21')]};});_0x2cbba7=qs[_0x14f1('0x22')](_0x3021ed,_0x1f45b0);var _0x524829={'where':_0x2cbba7[_0x14f1('0x23')]};return db[_0x14f1('0x1e')][_0x14f1('0x12')](_0x524829)[_0x14f1('0x14')](function(_0x4520ae){_0x321c64[_0x14f1('0x12')]=_0x4520ae;_0x2cbba7[_0x14f1('0x24')]=qs['include'](_0x1f45b0['query']);return db['MailQueue'][_0x14f1('0x25')](_0x2cbba7);})['then'](function(_0x704b1){_0x321c64[_0x14f1('0x26')]=_0x704b1;return _0x321c64;})[_0x14f1('0x14')](respondWithFilteredResult(_0x56992d,_0x2cbba7))[_0x14f1('0x27')](handleError(_0x56992d,null));};exports[_0x14f1('0x28')]=function(_0x21ab42,_0x3510d5){var _0x21a4a3={'raw':!![],'where':{'id':_0x21ab42[_0x14f1('0x29')]['id']}},_0x40a829={};_0x40a829[_0x14f1('0x2a')]=_['keys'](db[_0x14f1('0x1e')][_0x14f1('0x1f')]);_0x40a829[_0x14f1('0x2b')]=_[_0x14f1('0x2c')](_0x21ab42[_0x14f1('0x2b')]);_0x40a829['filters']=_['intersection'](_0x40a829[_0x14f1('0x2a')],_0x40a829[_0x14f1('0x2b')]);_0x21a4a3[_0x14f1('0x2d')]=_[_0x14f1('0x2e')](_0x40a829['model'],qs[_0x14f1('0x2f')](_0x21ab42['query'][_0x14f1('0x2f')]));_0x21a4a3[_0x14f1('0x2d')]=_0x21a4a3[_0x14f1('0x2d')][_0x14f1('0x30')]?_0x21a4a3[_0x14f1('0x2d')]:_0x40a829[_0x14f1('0x2a')];if(_0x21ab42[_0x14f1('0x2b')]['includeAll']){_0x21a4a3['include']=[{'all':!![]}];}_0x21a4a3=_['merge']({},_0x21a4a3,_0x21ab42[_0x14f1('0x31')]);return db[_0x14f1('0x1e')][_0x14f1('0x32')](_0x21a4a3)[_0x14f1('0x14')](handleEntityNotFound(_0x3510d5,null))['then'](respondWithResult(_0x3510d5,null))[_0x14f1('0x27')](handleError(_0x3510d5,null));};exports['create']=function(_0x294165,_0x1b28b9){return db[_0x14f1('0x1e')][_0x14f1('0x33')](_0x294165['body'],{})[_0x14f1('0x14')](function(_0x407980){var _0x4b6fc6=_0x294165[_0x14f1('0x34')][_0x14f1('0x16')]({'plain':!![]});if(!_0x4b6fc6)throw new Error(_0x14f1('0x35'));if(_0x4b6fc6[_0x14f1('0x36')]===_0x14f1('0x34')){var _0x5a5bad=_0x407980[_0x14f1('0x16')]({'plain':!![]});var _0x5ddda1=_0x14f1('0x37');return db[_0x14f1('0x38')][_0x14f1('0x32')]({'where':{'name':_0x5ddda1,'userProfileId':_0x4b6fc6['userProfileId']},'raw':!![]})[_0x14f1('0x14')](function(_0x338a14){if(_0x338a14&&_0x338a14[_0x14f1('0x39')]===0x0){return db[_0x14f1('0x17')]['create']({'name':_0x5a5bad[_0x14f1('0x1a')],'resourceId':_0x5a5bad['id'],'type':_0x338a14[_0x14f1('0x1a')],'sectionId':_0x338a14['id']},{})[_0x14f1('0x14')](function(){return _0x407980;});}else{return _0x407980;}})[_0x14f1('0x27')](function(_0x2221d6){logger[_0x14f1('0x18')](_0x14f1('0x3a'),_0x2221d6);throw _0x2221d6;});}return _0x407980;})[_0x14f1('0x14')](respondWithResult(_0x1b28b9,0xc9))['catch'](handleError(_0x1b28b9,null));};exports[_0x14f1('0x3b')]=function(_0x276053,_0x58e42e){if(_0x276053['body']['id']){delete _0x276053[_0x14f1('0x3c')]['id'];}return db[_0x14f1('0x1e')][_0x14f1('0x32')]({'where':{'id':_0x276053['params']['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x58e42e,null))[_0x14f1('0x14')](saveUpdates(_0x276053[_0x14f1('0x3c')],null))[_0x14f1('0x14')](respondWithResult(_0x58e42e,null))[_0x14f1('0x27')](handleError(_0x58e42e,null));};exports[_0x14f1('0x15')]=function(_0x3b1ae9,_0x5fa62f){return db[_0x14f1('0x1e')][_0x14f1('0x32')]({'where':{'id':_0x3b1ae9['params']['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x5fa62f,null))['then'](removeEntity(_0x5fa62f,null))[_0x14f1('0x27')](handleError(_0x5fa62f,null));};exports[_0x14f1('0x3d')]=function(_0x32d842,_0x5a7894){return db[_0x14f1('0x1e')][_0x14f1('0x3d')]()[_0x14f1('0x14')](respondWithResult(_0x5a7894,null))[_0x14f1('0x27')](handleError(_0x5a7894,null));};exports[_0x14f1('0x3e')]=function(_0x1400f8,_0x14ba3d){var _0x5d7fe2={'raw':!![],'where':{}},_0x358af5={},_0x2f4f0b;return db[_0x14f1('0x1e')][_0x14f1('0x3f')]({'where':{'id':_0x1400f8['params']['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x14ba3d,null))[_0x14f1('0x14')](function(_0x28d023){if(_0x28d023){_0x2f4f0b=_0x28d023[_0x14f1('0x16')]({'plain':!![]});_0x358af5[_0x14f1('0x2a')]=_[_0x14f1('0x2c')](db['UserMailQueue']['rawAttributes']);_0x358af5[_0x14f1('0x2b')]=_[_0x14f1('0x2c')](_0x1400f8['query']);_0x358af5[_0x14f1('0x40')]=_[_0x14f1('0x2e')](_0x358af5[_0x14f1('0x2a')],_0x358af5[_0x14f1('0x2b')]);_0x5d7fe2[_0x14f1('0x2d')]=_[_0x14f1('0x2e')](_0x358af5['model'],qs[_0x14f1('0x2f')](_0x1400f8[_0x14f1('0x2b')]['fields']));_0x5d7fe2[_0x14f1('0x2d')]=_0x5d7fe2[_0x14f1('0x2d')][_0x14f1('0x30')]?_0x5d7fe2['attributes']:_0x358af5['model'];if(!_0x1400f8[_0x14f1('0x2b')]['hasOwnProperty'](_0x14f1('0x41'))){_0x5d7fe2[_0x14f1('0x42')]=qs[_0x14f1('0x42')](_0x1400f8[_0x14f1('0x2b')][_0x14f1('0x42')]);_0x5d7fe2[_0x14f1('0x10')]=qs['offset'](_0x1400f8[_0x14f1('0x2b')][_0x14f1('0x10')]);}_0x5d7fe2[_0x14f1('0x43')]=qs[_0x14f1('0x44')](_0x1400f8[_0x14f1('0x2b')][_0x14f1('0x44')]);_0x5d7fe2[_0x14f1('0x23')]=qs[_0x14f1('0x40')](_[_0x14f1('0x45')](_0x1400f8[_0x14f1('0x2b')],_0x358af5[_0x14f1('0x40')]));_0x5d7fe2[_0x14f1('0x23')][_0x14f1('0x46')]=_0x28d023['id'];if(_0x1400f8[_0x14f1('0x2b')][_0x14f1('0x47')]){_0x5d7fe2[_0x14f1('0x23')]=_['merge'](_0x5d7fe2['where'],{'$or':_[_0x14f1('0x1d')](_0x5d7fe2['attributes'],function(_0x337822){var _0x2b05ca={};_0x2b05ca[_0x337822]={'$like':'%'+_0x1400f8[_0x14f1('0x2b')]['filter']+'%'};return _0x2b05ca;})});}_0x5d7fe2=_[_0x14f1('0x48')]({},_0x5d7fe2,_0x1400f8[_0x14f1('0x31')]);return db[_0x14f1('0x49')][_0x14f1('0x25')](_0x5d7fe2);}})[_0x14f1('0x14')](function(_0x3a7d72){if(_0x3a7d72){return db['User'][_0x14f1('0x4a')]({'where':{'id':_[_0x14f1('0x1d')](_0x3a7d72,_0x14f1('0x4b')),'role':_0x14f1('0x4c')},'attributes':['id',_0x14f1('0x1a'),_0x14f1('0x4d'),'updatedAt','createdAt']});}})[_0x14f1('0x14')](function(_0x2adfc2){if(_0x2adfc2){return{'count':_0x2adfc2[_0x14f1('0x12')],'rows':_[_0x14f1('0x1d')](_0x2adfc2[_0x14f1('0x26')],function(_0x3196a9){return{'membername':_0x3196a9[_0x14f1('0x1a')],'UserId':_0x3196a9['id'],'queue_name':_0x2f4f0b[_0x14f1('0x1a')],'MailQueueId':_0x2f4f0b['id'],'interface':util[_0x14f1('0x4e')](_0x14f1('0x4f'),_0x14f1('0x50'),_0x3196a9['name']),'penalty':0x0,'paused':_0x3196a9[_0x14f1('0x4d')],'createdAt':_0x3196a9[_0x14f1('0x51')],'updatedAt':_0x3196a9[_0x14f1('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x14f1('0x14')](respondWithFilteredResult(_0x14ba3d,_0x5d7fe2))[_0x14f1('0x27')](handleError(_0x14ba3d,null));};exports[_0x14f1('0x53')]=function(_0x302d28,_0xb3dfcb){var _0x2e88a0={};var _0x4d3159={};var _0x13dc70;var _0x4aa762;return db['MailQueue'][_0x14f1('0x3f')]({'where':{'id':_0x302d28[_0x14f1('0x29')]['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0xb3dfcb,null))[_0x14f1('0x14')](function(_0x2a7a60){if(_0x2a7a60){_0x13dc70=_0x2a7a60;_0x4d3159[_0x14f1('0x2a')]=_['keys'](db[_0x14f1('0x54')][_0x14f1('0x1f')]);_0x4d3159['query']=_['keys'](_0x302d28[_0x14f1('0x2b')]);_0x4d3159[_0x14f1('0x40')]=_[_0x14f1('0x2e')](_0x4d3159['model'],_0x4d3159[_0x14f1('0x2b')]);_0x2e88a0[_0x14f1('0x2d')]=_[_0x14f1('0x2e')](_0x4d3159[_0x14f1('0x2a')],qs[_0x14f1('0x2f')](_0x302d28[_0x14f1('0x2b')][_0x14f1('0x2f')]));_0x2e88a0[_0x14f1('0x2d')]=_0x2e88a0[_0x14f1('0x2d')][_0x14f1('0x30')]?_0x2e88a0[_0x14f1('0x2d')]:_0x4d3159[_0x14f1('0x2a')];_0x2e88a0[_0x14f1('0x43')]=qs[_0x14f1('0x44')](_0x302d28[_0x14f1('0x2b')][_0x14f1('0x44')]);_0x2e88a0[_0x14f1('0x23')]=qs[_0x14f1('0x40')](_['pick'](_0x302d28['query'],_0x4d3159[_0x14f1('0x40')]));if(_0x302d28[_0x14f1('0x2b')]['filter']){_0x2e88a0['where']=_[_0x14f1('0x48')](_0x2e88a0[_0x14f1('0x23')],{'$or':_[_0x14f1('0x1d')](_0x2e88a0['attributes'],function(_0x1b88ea){var _0x4d1b4d={};_0x4d1b4d[_0x1b88ea]={'$like':'%'+_0x302d28['query'][_0x14f1('0x47')]+'%'};return _0x4d1b4d;})});}_0x2e88a0=_[_0x14f1('0x48')]({},_0x2e88a0,_0x302d28[_0x14f1('0x31')]);return _0x13dc70['getTeams'](_0x2e88a0);}})['then'](function(_0x239fa1){if(_0x239fa1){_0x4aa762=_0x239fa1[_0x14f1('0x30')];if(!_0x302d28[_0x14f1('0x2b')][_0x14f1('0x55')]('nolimit')){_0x2e88a0[_0x14f1('0x42')]=qs['limit'](_0x302d28[_0x14f1('0x2b')]['limit']);_0x2e88a0[_0x14f1('0x10')]=qs[_0x14f1('0x10')](_0x302d28[_0x14f1('0x2b')][_0x14f1('0x10')]);}return _0x13dc70[_0x14f1('0x53')](_0x2e88a0);}})[_0x14f1('0x14')](function(_0x2fd510){if(_0x2fd510){return _0x2fd510?{'count':_0x4aa762,'rows':_0x2fd510}:null;}})[_0x14f1('0x14')](respondWithResult(_0xb3dfcb,null))['catch'](handleError(_0xb3dfcb,null));};exports[_0x14f1('0x56')]=function(_0x4c6f6a,_0x3eec03){var _0x53bdd4=_0x4c6f6a[_0x14f1('0x3c')][_0x14f1('0x57')];return db[_0x14f1('0x54')]['findAll']({'where':{'id':_0x53bdd4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x14f1('0x58'),'attributes':['id',_0x14f1('0x1a'),_0x14f1('0x59'),'voicePause',_0x14f1('0x5a')],'raw':!![]}]})[_0x14f1('0x14')](function(_0x3e07e0){if(_0x3e07e0){var _0x4e52f7=_[_0x14f1('0x5b')](_0x3e07e0,function(_0x29ab26){var _0x2518f9=_0x29ab26[_0x14f1('0x16')]({'plain':!![]});return _0x2518f9['Agents'];});return db[_0x14f1('0x1e')]['find']({'where':{'id':_0x4c6f6a['params']['id']}})['then'](function(_0x5288f6){return db[_0x14f1('0x5c')][_0x14f1('0x5d')](function(_0x5e2799){return _0x5288f6[_0x14f1('0x56')](_0x53bdd4,{'transaction':_0x5e2799})[_0x14f1('0x14')](function(){return BPromise['each'](_0x4e52f7,function(_0x1fcc67){return db['UserMailQueue'][_0x14f1('0x5e')]({'where':{'UserId':_0x1fcc67['id'],'MailQueueId':_0x4c6f6a[_0x14f1('0x29')]['id']},'transaction':_0x5e2799});});})[_0x14f1('0x14')](function(){_0x4e52f7[_0x14f1('0x5f')](function(_0x451e1a){socket[_0x14f1('0x60')]('userMailQueue:save',{'UserId':_0x451e1a['id'],'MailQueueId':_0x5288f6['id']});});});});});}})[_0x14f1('0x14')](respondWithStatusCode(_0x3eec03,null))[_0x14f1('0x27')](handleError(_0x3eec03,null));};exports[_0x14f1('0x61')]=function(_0x1e82d2,_0x43ca8){return db[_0x14f1('0x54')][_0x14f1('0x25')]({'where':{'id':_0x1e82d2[_0x14f1('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x14f1('0x62')],'as':_0x14f1('0x58'),'attributes':['id'],'raw':!![]}]})[_0x14f1('0x14')](handleEntityNotFound(_0x43ca8,null))[_0x14f1('0x14')](function(_0x3ccc14){var _0x4e34ba=_['map'](_0x3ccc14,'id');var _0x445d57=[];var _0x5c7930=[];var _0x279fb2=squel[_0x14f1('0x63')]();_0x279fb2[_0x14f1('0x64')](_0x14f1('0x65'))[_0x14f1('0x66')](_0x14f1('0x67'),'tq')[_0x14f1('0x68')](_0x14f1('0x69'),'ut',_0x14f1('0x6a'))['where']('MailQueueId\x20=\x20?',_0x1e82d2[_0x14f1('0x29')]['id']);for(var _0x211055=0x0;_0x211055<_0x3ccc14[_0x14f1('0x30')];_0x211055+=0x1){let _0xe92124=_0x3ccc14[_0x211055];for(var _0x1c1999=0x0;_0x1c1999<_0xe92124['Agents'][_0x14f1('0x30')];_0x1c1999+=0x1){let _0xa7dcc7=_0xe92124[_0x14f1('0x58')][_0x1c1999];var _0x5c67bb=_0x279fb2[_0x14f1('0x6b')]();_0x5c67bb[_0x14f1('0x23')](_0x14f1('0x6c'),_0xa7dcc7['id']);_0x5c7930[_0x14f1('0x6d')](db[_0x14f1('0x5c')]['query'](_0x5c67bb[_0x14f1('0x6e')](),{'type':db['sequelize'][_0x14f1('0x6f')][_0x14f1('0x70')]})[_0x14f1('0x14')](function(_0x4efeda){if(_0x4efeda['length']===0x1){return _0xa7dcc7['id'];}else{var _0x2b1730=_[_0x14f1('0x71')](_[_0x14f1('0x1d')](_0x4efeda,_0x14f1('0x72')),function(_0x2ffee1){return _[_0x14f1('0x73')](_0x4e34ba,_0x2ffee1);});if(_0x2b1730){return _0xa7dcc7['id'];}}}));}}return BPromise[_0x14f1('0x74')](_0x5c7930)[_0x14f1('0x14')](function(_0xa04450){_0x445d57=_(_0x445d57)[_0x14f1('0x75')](_0xa04450)['compact']()['value']();return db[_0x14f1('0x1e')][_0x14f1('0x32')]({'where':{'id':_0x1e82d2['params']['id']}})[_0x14f1('0x14')](function(_0x45717f){return db[_0x14f1('0x5c')][_0x14f1('0x5d')](function(_0x4a5520){return _0x45717f[_0x14f1('0x61')](_0x1e82d2[_0x14f1('0x2b')]['ids'],{'transaction':_0x4a5520})[_0x14f1('0x14')](function(){if(!_['isEmpty'](_0x445d57)){return _0x45717f[_0x14f1('0x76')](_0x445d57,{'transaction':_0x4a5520});}})[_0x14f1('0x14')](function(){_0x445d57[_0x14f1('0x5f')](function(_0x2b95cf){socket[_0x14f1('0x60')]('userMailQueue:remove',{'UserId':_0x2b95cf,'MailQueueId':_0x45717f['id']});});});});});});})['then'](respondWithStatusCode(_0x43ca8,null))[_0x14f1('0x27')](handleError(_0x43ca8,null));};exports[_0x14f1('0x77')]=function(_0xeb48b2,_0x2e395e){return db[_0x14f1('0x1e')][_0x14f1('0x32')]({'where':{'id':_0xeb48b2['params']['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x2e395e,null))[_0x14f1('0x14')](function(_0x5d74a1){if(_0x5d74a1){return _0x5d74a1[_0x14f1('0x77')](_0xeb48b2[_0x14f1('0x3c')][_0x14f1('0x57')],_[_0x14f1('0x78')](_0xeb48b2[_0x14f1('0x3c')],[_0x14f1('0x57'),'id'])||{})['spread'](function(_0x29f479){for(var _0x539ae2=0x0;_0x539ae2<_0xeb48b2[_0x14f1('0x3c')][_0x14f1('0x57')][_0x14f1('0x30')];_0x539ae2+=0x1){socket[_0x14f1('0x60')](_0x14f1('0x79'),{'UserId':Number(_0xeb48b2[_0x14f1('0x3c')][_0x14f1('0x57')][_0x539ae2]),'MailQueueId':Number(_0xeb48b2['params']['id'])});}return _0x29f479;});}})['then'](respondWithResult(_0x2e395e,null))[_0x14f1('0x27')](handleError(_0x2e395e,null));};exports[_0x14f1('0x76')]=function(_0x131e7d,_0x562e0c){return db['MailQueue'][_0x14f1('0x32')]({'where':{'id':_0x131e7d[_0x14f1('0x29')]['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x562e0c,null))['then'](function(_0x11f865){if(_0x11f865){return _0x11f865[_0x14f1('0x76')](_0x131e7d[_0x14f1('0x2b')][_0x14f1('0x57')])[_0x14f1('0x14')](function(){if(_[_0x14f1('0x7a')](_0x131e7d[_0x14f1('0x2b')]['ids'])){for(var _0x5ab809=0x0;_0x5ab809<_0x131e7d[_0x14f1('0x2b')][_0x14f1('0x57')]['length'];_0x5ab809+=0x1){socket[_0x14f1('0x60')](_0x14f1('0x7b'),{'UserId':Number(_0x131e7d[_0x14f1('0x2b')][_0x14f1('0x57')][_0x5ab809]),'MailQueueId':Number(_0x131e7d[_0x14f1('0x29')]['id'])});}}else{socket[_0x14f1('0x60')](_0x14f1('0x7b'),{'UserId':Number(_0x131e7d[_0x14f1('0x2b')][_0x14f1('0x57')]),'MailQueueId':Number(_0x131e7d[_0x14f1('0x29')]['id'])});}});}})[_0x14f1('0x14')](respondWithStatusCode(_0x562e0c,null))[_0x14f1('0x27')](handleError(_0x562e0c,null));};exports['getAgents']=function(_0x266f96,_0x10273c){var _0x321ac5={};var _0x4b9041={};var _0x3c9002;var _0x33de7d;return db['MailQueue'][_0x14f1('0x3f')]({'where':{'id':_0x266f96[_0x14f1('0x29')]['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x10273c,null))[_0x14f1('0x14')](function(_0x5c159b){if(_0x5c159b){_0x3c9002=_0x5c159b;_0x4b9041[_0x14f1('0x2a')]=_[_0x14f1('0x2c')](db[_0x14f1('0x62')][_0x14f1('0x1f')]);_0x4b9041[_0x14f1('0x2b')]=_[_0x14f1('0x2c')](_0x266f96[_0x14f1('0x2b')]);_0x4b9041['filters']=_['intersection'](_0x4b9041[_0x14f1('0x2a')],_0x4b9041[_0x14f1('0x2b')]);_0x321ac5['attributes']=_[_0x14f1('0x2e')](_0x4b9041[_0x14f1('0x2a')],qs[_0x14f1('0x2f')](_0x266f96['query'][_0x14f1('0x2f')]));_0x321ac5[_0x14f1('0x2d')]=_0x321ac5[_0x14f1('0x2d')][_0x14f1('0x30')]?_0x321ac5[_0x14f1('0x2d')]:_0x4b9041['model'];_0x321ac5[_0x14f1('0x43')]=qs[_0x14f1('0x44')](_0x266f96[_0x14f1('0x2b')][_0x14f1('0x44')]);_0x321ac5[_0x14f1('0x23')]=qs['filters'](_[_0x14f1('0x45')](_0x266f96['query'],_0x4b9041[_0x14f1('0x40')]));if(_0x266f96[_0x14f1('0x2b')][_0x14f1('0x47')]){_0x321ac5[_0x14f1('0x23')]=_[_0x14f1('0x48')](_0x321ac5['where'],{'$or':_[_0x14f1('0x1d')](_0x321ac5[_0x14f1('0x2d')],function(_0x4ed7f0){var _0x49fa35={};_0x49fa35[_0x4ed7f0]={'$like':'%'+_0x266f96[_0x14f1('0x2b')][_0x14f1('0x47')]+'%'};return _0x49fa35;})});}_0x321ac5=_[_0x14f1('0x48')]({},_0x321ac5,_0x266f96[_0x14f1('0x31')]);return _0x3c9002[_0x14f1('0x7c')](_0x321ac5);}})['then'](function(_0x5629a2){if(_0x5629a2){_0x33de7d=_0x5629a2[_0x14f1('0x30')];if(!_0x266f96['query'][_0x14f1('0x55')](_0x14f1('0x41'))){_0x321ac5['limit']=qs[_0x14f1('0x42')](_0x266f96['query'][_0x14f1('0x42')]);_0x321ac5[_0x14f1('0x10')]=qs[_0x14f1('0x10')](_0x266f96[_0x14f1('0x2b')][_0x14f1('0x10')]);}return _0x3c9002[_0x14f1('0x7c')](_0x321ac5);}})['then'](function(_0x272cc7){if(_0x272cc7){return _0x272cc7?{'count':_0x33de7d,'rows':_0x272cc7}:null;}})['then'](respondWithResult(_0x10273c,null))[_0x14f1('0x27')](handleError(_0x10273c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 2f90e77..7b2bac5 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 _0x1e00=['events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4a669e,_0xb69e75){var _0x4d5df8=function(_0x3f3d0a){while(--_0x3f3d0a){_0x4a669e['push'](_0x4a669e['shift']());}};_0x4d5df8(++_0xb69e75);}(_0x1e00,0x104));var _0x01e0=function(_0x5c69ad,_0x40449a){_0x5c69ad=_0x5c69ad-0x0;var _0x310705=_0x1e00[_0x5c69ad];return _0x310705;};'use strict';var EventEmitter=require(_0x01e0('0x0'));var MailQueue=require(_0x01e0('0x1'))['db'][_0x01e0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x01e0('0x3')](0x0);var events={'afterCreate':_0x01e0('0x4'),'afterUpdate':_0x01e0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x475be3){return function(_0x4a2236,_0x3a633,_0x14ef88){MailQueueEvents[_0x01e0('0x6')](_0x475be3+':'+_0x4a2236['id'],_0x4a2236);MailQueueEvents[_0x01e0('0x6')](_0x475be3,_0x4a2236);_0x14ef88(null);};}for(var e in events){if(events[_0x01e0('0x7')](e)){var event=events[e];MailQueue[_0x01e0('0x8')](e,emitEvent(event));}}module[_0x01e0('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x5fb2=['emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','save','update','remove'];(function(_0x529b9a,_0x3ddafe){var _0x15b1f2=function(_0x584921){while(--_0x584921){_0x529b9a['push'](_0x529b9a['shift']());}};_0x15b1f2(++_0x3ddafe);}(_0x5fb2,0x159));var _0x25fb=function(_0x1418a5,_0x19c106){_0x1418a5=_0x1418a5-0x0;var _0x22c849=_0x5fb2[_0x1418a5];return _0x22c849;};'use strict';var EventEmitter=require(_0x25fb('0x0'));var MailQueue=require(_0x25fb('0x1'))['db'][_0x25fb('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x25fb('0x3'),'afterUpdate':_0x25fb('0x4'),'afterDestroy':_0x25fb('0x5')};function emitEvent(_0x1b40a2){return function(_0x1997b7,_0x471f9e,_0x434cbf){MailQueueEvents['emit'](_0x1b40a2+':'+_0x1997b7['id'],_0x1997b7);MailQueueEvents[_0x25fb('0x6')](_0x1b40a2,_0x1997b7);_0x434cbf(null);};}for(var e in events){if(events[_0x25fb('0x7')](e)){var event=events[e];MailQueue[_0x25fb('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 50ab9ca..5ad090d 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 _0xdd51=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','lodash','util'];(function(_0x56e2ed,_0x1c4781){var _0x5237b2=function(_0x587150){while(--_0x587150){_0x56e2ed['push'](_0x56e2ed['shift']());}};_0x5237b2(++_0x1c4781);}(_0xdd51,0xc1));var _0x1dd5=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xdd51[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x1dd5('0x0'));var util=require(_0x1dd5('0x1'));var logger=require(_0x1dd5('0x2'))(_0x1dd5('0x3'));var moment=require(_0x1dd5('0x4'));var BPromise=require(_0x1dd5('0x5'));var rp=require(_0x1dd5('0x6'));var fs=require('fs');var path=require(_0x1dd5('0x7'));var rimraf=require(_0x1dd5('0x8'));var config=require(_0x1dd5('0x9'));var attributes=require(_0x1dd5('0xa'));module[_0x1dd5('0xb')]=function(_0x1913a9,_0x32231a){return _0x1913a9['define'](_0x1dd5('0xc'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73ab=['../../config/environment','exports','define','mail_queues','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2c16a8,_0x14d2de){var _0x4f09bb=function(_0x5cde39){while(--_0x5cde39){_0x2c16a8['push'](_0x2c16a8['shift']());}};_0x4f09bb(++_0x14d2de);}(_0x73ab,0xd5));var _0xb73a=function(_0x2730da,_0x1098bd){_0x2730da=_0x2730da-0x0;var _0xfe9991=_0x73ab[_0x2730da];return _0xfe9991;};'use strict';var _=require(_0xb73a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb73a('0x1'));var moment=require(_0xb73a('0x2'));var BPromise=require(_0xb73a('0x3'));var rp=require(_0xb73a('0x4'));var fs=require('fs');var path=require(_0xb73a('0x5'));var rimraf=require(_0xb73a('0x6'));var config=require(_0xb73a('0x7'));var attributes=require('./mailQueue.attributes');module[_0xb73a('0x8')]=function(_0x3dc075,_0xf315c){return _0x3dc075[_0xb73a('0x9')]('MailQueue',attributes,{'tableName':_0xb73a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 7274908..1e1223a 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 _0x0d16=['model','ShowMailQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailQueue.socket','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x535ae1,_0x31fd5e){var _0x2460ae=function(_0x2156f6){while(--_0x2156f6){_0x535ae1['push'](_0x535ae1['shift']());}};_0x2460ae(++_0x31fd5e);}(_0x0d16,0xbb));var _0x60d1=function(_0x4fdf1b,_0x5f3f9b){_0x4fdf1b=_0x4fdf1b-0x0;var _0x2b5592=_0x0d16[_0x4fdf1b];return _0x2b5592;};'use strict';var _=require(_0x60d1('0x0'));var util=require(_0x60d1('0x1'));var moment=require(_0x60d1('0x2'));var BPromise=require(_0x60d1('0x3'));var rs=require(_0x60d1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x60d1('0x5'));var logger=require('../../config/logger')(_0x60d1('0x6'));var config=require(_0x60d1('0x7'));var jayson=require(_0x60d1('0x8'));var client=jayson[_0x60d1('0x9')][_0x60d1('0xa')]({'port':0x232a});config[_0x60d1('0xb')]=_['defaults'](config[_0x60d1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x60d1('0xc'))(new Redis(config[_0x60d1('0xb')]));require(_0x60d1('0xd'))['register'](socket);function respondWithRpcPromise(_0xc7eef6,_0xd03da4,_0x598531){return new BPromise(function(_0x256910,_0x4460f3){return client[_0x60d1('0xe')](_0xc7eef6,_0x598531)['then'](function(_0x520447){logger[_0x60d1('0xf')](_0x60d1('0x10'),_0xd03da4,'request\x20sent');logger[_0x60d1('0x11')](_0x60d1('0x12'),_0xd03da4,'request\x20sent',JSON[_0x60d1('0x13')](_0x520447));if(_0x520447['error']){if(_0x520447['error'][_0x60d1('0x14')]===0x1f4){logger[_0x60d1('0x15')](_0x60d1('0x10'),_0xd03da4,_0x520447[_0x60d1('0x15')][_0x60d1('0x16')]);return _0x4460f3(_0x520447['error'][_0x60d1('0x16')]);}logger[_0x60d1('0x15')](_0x60d1('0x10'),_0xd03da4,_0x520447[_0x60d1('0x15')][_0x60d1('0x16')]);return _0x256910(_0x520447[_0x60d1('0x15')][_0x60d1('0x16')]);}else{logger['info'](_0x60d1('0x10'),_0xd03da4,_0x60d1('0x17'));_0x256910(_0x520447['result']['message']);}})[_0x60d1('0x18')](function(_0x38a1e6){logger[_0x60d1('0x15')](_0x60d1('0x10'),_0xd03da4,_0x38a1e6);_0x4460f3(_0x38a1e6);});});}exports[_0x60d1('0x19')]=function(_0x54c850){var _0x25fbaf=this;return new Promise(function(_0x314554,_0x6c47fd){return db[_0x60d1('0x1a')][_0x60d1('0x1b')]({'raw':_0x54c850[_0x60d1('0x1c')]?_0x54c850[_0x60d1('0x1c')][_0x60d1('0x1d')]===undefined?!![]:![]:!![],'where':_0x54c850['options']?_0x54c850[_0x60d1('0x1c')][_0x60d1('0x1e')]||null:null,'attributes':_0x54c850[_0x60d1('0x1c')]?_0x54c850['options'][_0x60d1('0x1f')]||null:null,'limit':_0x54c850['options']?_0x54c850['options'][_0x60d1('0x20')]||null:null,'include':_0x54c850[_0x60d1('0x1c')]?_0x54c850[_0x60d1('0x1c')][_0x60d1('0x21')]?_[_0x60d1('0x22')](_0x54c850[_0x60d1('0x1c')][_0x60d1('0x21')],function(_0xb6817f){return{'model':db[_0xb6817f[_0x60d1('0x23')]],'as':_0xb6817f['as'],'attributes':_0xb6817f[_0x60d1('0x1f')],'include':_0xb6817f[_0x60d1('0x21')]?_[_0x60d1('0x22')](_0xb6817f['include'],function(_0x2ae05f){return{'model':db[_0x2ae05f['model']],'as':_0x2ae05f['as'],'attributes':_0x2ae05f[_0x60d1('0x1f')],'include':_0x2ae05f[_0x60d1('0x21')]?_[_0x60d1('0x22')](_0x2ae05f[_0x60d1('0x21')],function(_0x3c4d3b){return{'model':db[_0x3c4d3b['model']],'as':_0x3c4d3b['as'],'attributes':_0x3c4d3b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21b1e3){logger[_0x60d1('0xf')](_0x60d1('0x19'),_0x54c850);logger[_0x60d1('0x11')](_0x60d1('0x19'),_0x54c850,JSON[_0x60d1('0x13')](_0x21b1e3));_0x314554(_0x21b1e3);})[_0x60d1('0x18')](function(_0xaf643c){logger[_0x60d1('0x15')](_0x60d1('0x19'),_0xaf643c[_0x60d1('0x16')],_0x54c850);_0x6c47fd(_0x25fbaf[_0x60d1('0x15')](0x1f4,_0xaf643c[_0x60d1('0x16')]));});});};exports[_0x60d1('0x24')]=function(_0x514892){var _0x18ddb8=this;return new Promise(function(_0x279834,_0x27a398){return db[_0x60d1('0x1a')]['find']({'raw':_0x514892['options']?_0x514892[_0x60d1('0x1c')][_0x60d1('0x1d')]===undefined?!![]:![]:!![],'where':_0x514892[_0x60d1('0x1c')]?_0x514892['options']['where']||null:null,'attributes':_0x514892[_0x60d1('0x1c')]?_0x514892[_0x60d1('0x1c')][_0x60d1('0x1f')]||null:null,'include':_0x514892['options']?_0x514892[_0x60d1('0x1c')][_0x60d1('0x21')]?_[_0x60d1('0x22')](_0x514892['options'][_0x60d1('0x21')],function(_0x10bf54){return{'model':db[_0x10bf54[_0x60d1('0x23')]],'as':_0x10bf54['as'],'attributes':_0x10bf54[_0x60d1('0x1f')],'include':_0x10bf54['include']?_[_0x60d1('0x22')](_0x10bf54[_0x60d1('0x21')],function(_0x3e31e2){return{'model':db[_0x3e31e2[_0x60d1('0x23')]],'as':_0x3e31e2['as'],'attributes':_0x3e31e2[_0x60d1('0x1f')],'include':_0x3e31e2[_0x60d1('0x21')]?_[_0x60d1('0x22')](_0x3e31e2[_0x60d1('0x21')],function(_0x38d713){return{'model':db[_0x38d713[_0x60d1('0x23')]],'as':_0x38d713['as'],'attributes':_0x38d713['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x238623){logger[_0x60d1('0xf')](_0x60d1('0x24'),_0x514892);logger['debug'](_0x60d1('0x24'),_0x514892,JSON[_0x60d1('0x13')](_0x238623));_0x279834(_0x238623);})[_0x60d1('0x18')](function(_0x33e455){logger[_0x60d1('0x15')]('ShowMailQueue',_0x33e455[_0x60d1('0x16')],_0x514892);_0x27a398(_0x18ddb8['error'](0x1f4,_0x33e455[_0x60d1('0x16')]));});});}; \ No newline at end of file +var _0x7084=['./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','attributes','limit','include','map','model','GetMailQueue','find','where','ShowMailQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x7084,0x118));var _0x4708=function(_0x539bde,_0x14b7db){_0x539bde=_0x539bde-0x0;var _0x1718d4=_0x7084[_0x539bde];return _0x1718d4;};'use strict';var _=require(_0x4708('0x0'));var util=require('util');var moment=require(_0x4708('0x1'));var BPromise=require(_0x4708('0x2'));var rs=require(_0x4708('0x3'));var fs=require('fs');var Redis=require(_0x4708('0x4'));var db=require(_0x4708('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4708('0x6'))('rpc');var config=require(_0x4708('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4708('0x8')][_0x4708('0x9')]({'port':0x232a});config[_0x4708('0xa')]=_[_0x4708('0xb')](config[_0x4708('0xa')],{'host':_0x4708('0xc'),'port':0x18eb});var socket=require(_0x4708('0xd'))(new Redis(config[_0x4708('0xa')]));require(_0x4708('0xe'))[_0x4708('0xf')](socket);function respondWithRpcPromise(_0x1c3f3d,_0x1029d8,_0x3a66e5){return new BPromise(function(_0x41df0b,_0x456aba){return client[_0x4708('0x10')](_0x1c3f3d,_0x3a66e5)[_0x4708('0x11')](function(_0x3bb353){logger[_0x4708('0x12')](_0x4708('0x13'),_0x1029d8,_0x4708('0x14'));logger[_0x4708('0x15')](_0x4708('0x16'),_0x1029d8,_0x4708('0x14'),JSON[_0x4708('0x17')](_0x3bb353));if(_0x3bb353[_0x4708('0x18')]){if(_0x3bb353['error'][_0x4708('0x19')]===0x1f4){logger[_0x4708('0x18')](_0x4708('0x13'),_0x1029d8,_0x3bb353[_0x4708('0x18')][_0x4708('0x1a')]);return _0x456aba(_0x3bb353[_0x4708('0x18')][_0x4708('0x1a')]);}logger[_0x4708('0x18')](_0x4708('0x13'),_0x1029d8,_0x3bb353['error'][_0x4708('0x1a')]);return _0x41df0b(_0x3bb353[_0x4708('0x18')][_0x4708('0x1a')]);}else{logger[_0x4708('0x12')](_0x4708('0x13'),_0x1029d8,'request\x20sent');_0x41df0b(_0x3bb353[_0x4708('0x1b')][_0x4708('0x1a')]);}})[_0x4708('0x1c')](function(_0x45d9c9){logger[_0x4708('0x18')](_0x4708('0x13'),_0x1029d8,_0x45d9c9);_0x456aba(_0x45d9c9);});});}exports['GetMailQueue']=function(_0x4ccd16){var _0x29dc02=this;return new Promise(function(_0x27de08,_0x40e9f4){return db[_0x4708('0x1d')][_0x4708('0x1e')]({'raw':_0x4ccd16[_0x4708('0x1f')]?_0x4ccd16[_0x4708('0x1f')][_0x4708('0x20')]===undefined?!![]:![]:!![],'where':_0x4ccd16[_0x4708('0x1f')]?_0x4ccd16['options']['where']||null:null,'attributes':_0x4ccd16[_0x4708('0x1f')]?_0x4ccd16[_0x4708('0x1f')][_0x4708('0x21')]||null:null,'limit':_0x4ccd16['options']?_0x4ccd16[_0x4708('0x1f')][_0x4708('0x22')]||null:null,'include':_0x4ccd16[_0x4708('0x1f')]?_0x4ccd16[_0x4708('0x1f')][_0x4708('0x23')]?_[_0x4708('0x24')](_0x4ccd16[_0x4708('0x1f')]['include'],function(_0x3db434){return{'model':db[_0x3db434[_0x4708('0x25')]],'as':_0x3db434['as'],'attributes':_0x3db434[_0x4708('0x21')],'include':_0x3db434['include']?_[_0x4708('0x24')](_0x3db434['include'],function(_0x4049d3){return{'model':db[_0x4049d3[_0x4708('0x25')]],'as':_0x4049d3['as'],'attributes':_0x4049d3[_0x4708('0x21')],'include':_0x4049d3[_0x4708('0x23')]?_[_0x4708('0x24')](_0x4049d3[_0x4708('0x23')],function(_0x467ea5){return{'model':db[_0x467ea5[_0x4708('0x25')]],'as':_0x467ea5['as'],'attributes':_0x467ea5[_0x4708('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4708('0x11')](function(_0x48ee67){logger[_0x4708('0x12')]('GetMailQueue',_0x4ccd16);logger[_0x4708('0x15')](_0x4708('0x26'),_0x4ccd16,JSON['stringify'](_0x48ee67));_0x27de08(_0x48ee67);})[_0x4708('0x1c')](function(_0x2c601d){logger[_0x4708('0x18')](_0x4708('0x26'),_0x2c601d[_0x4708('0x1a')],_0x4ccd16);_0x40e9f4(_0x29dc02[_0x4708('0x18')](0x1f4,_0x2c601d[_0x4708('0x1a')]));});});};exports['ShowMailQueue']=function(_0x3fcfb6){var _0x158669=this;return new Promise(function(_0x302e5e,_0x2f6d2c){return db[_0x4708('0x1d')][_0x4708('0x27')]({'raw':_0x3fcfb6[_0x4708('0x1f')]?_0x3fcfb6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3fcfb6[_0x4708('0x1f')]?_0x3fcfb6[_0x4708('0x1f')][_0x4708('0x28')]||null:null,'attributes':_0x3fcfb6[_0x4708('0x1f')]?_0x3fcfb6[_0x4708('0x1f')][_0x4708('0x21')]||null:null,'include':_0x3fcfb6[_0x4708('0x1f')]?_0x3fcfb6[_0x4708('0x1f')][_0x4708('0x23')]?_[_0x4708('0x24')](_0x3fcfb6[_0x4708('0x1f')][_0x4708('0x23')],function(_0x1608e5){return{'model':db[_0x1608e5[_0x4708('0x25')]],'as':_0x1608e5['as'],'attributes':_0x1608e5[_0x4708('0x21')],'include':_0x1608e5['include']?_[_0x4708('0x24')](_0x1608e5['include'],function(_0x3edc39){return{'model':db[_0x3edc39[_0x4708('0x25')]],'as':_0x3edc39['as'],'attributes':_0x3edc39[_0x4708('0x21')],'include':_0x3edc39[_0x4708('0x23')]?_[_0x4708('0x24')](_0x3edc39[_0x4708('0x23')],function(_0x1048b0){return{'model':db[_0x1048b0[_0x4708('0x25')]],'as':_0x1048b0['as'],'attributes':_0x1048b0[_0x4708('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4708('0x11')](function(_0x2b78d4){logger[_0x4708('0x12')](_0x4708('0x29'),_0x3fcfb6);logger['debug'](_0x4708('0x29'),_0x3fcfb6,JSON[_0x4708('0x17')](_0x2b78d4));_0x302e5e(_0x2b78d4);})[_0x4708('0x1c')](function(_0x261195){logger[_0x4708('0x18')](_0x4708('0x29'),_0x261195['message'],_0x3fcfb6);_0x2f6d2c(_0x158669['error'](0x1f4,_0x261195[_0x4708('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9f33ca9..fccf371 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 _0x301b=['mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x4d23c9,_0x4f4886){var _0x15f28c=function(_0x150107){while(--_0x150107){_0x4d23c9['push'](_0x4d23c9['shift']());}};_0x15f28c(++_0x4f4886);}(_0x301b,0x111));var _0xb301=function(_0x2a4ef7,_0x407d00){_0x2a4ef7=_0x2a4ef7-0x0;var _0x4ac204=_0x301b[_0x2a4ef7];return _0x4ac204;};'use strict';var MailQueueEvents=require(_0xb301('0x0'));var events=[_0xb301('0x1'),_0xb301('0x2'),_0xb301('0x3')];function createListener(_0x3aca16,_0x1cdfb9){return function(_0x459b71){_0x1cdfb9[_0xb301('0x4')](_0x3aca16,_0x459b71);};}function removeListener(_0x4fdab0,_0x44353f){return function(){MailQueueEvents[_0xb301('0x5')](_0x4fdab0,_0x44353f);};}exports[_0xb301('0x6')]=function(_0x12d167){for(var _0x5d9b0d=0x0,_0x535fcf=events['length'];_0x5d9b0d<_0x535fcf;_0x5d9b0d++){var _0x3612c9=events[_0x5d9b0d];var _0x1017f2=createListener(_0xb301('0x7')+_0x3612c9,_0x12d167);MailQueueEvents['on'](_0x3612c9,_0x1017f2);}}; \ No newline at end of file +var _0x051f=['removeListener','register','length','mailQueue:','save','remove','update'];(function(_0x2a5585,_0x41e3c1){var _0x1c5f9b=function(_0x354c11){while(--_0x354c11){_0x2a5585['push'](_0x2a5585['shift']());}};_0x1c5f9b(++_0x41e3c1);}(_0x051f,0x177));var _0xf051=function(_0x5221a0,_0x6a9b30){_0x5221a0=_0x5221a0-0x0;var _0xb7f453=_0x051f[_0x5221a0];return _0xb7f453;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xf051('0x0'),_0xf051('0x1'),_0xf051('0x2')];function createListener(_0x349894,_0x105ae8){return function(_0x3133ab){_0x105ae8['emit'](_0x349894,_0x3133ab);};}function removeListener(_0x6caa73,_0x1dca27){return function(){MailQueueEvents[_0xf051('0x3')](_0x6caa73,_0x1dca27);};}exports[_0xf051('0x4')]=function(_0x4cc8a1){for(var _0x166be3=0x0,_0x3da4cd=events[_0xf051('0x5')];_0x166be3<_0x3da4cd;_0x166be3++){var _0x5ae688=events[_0x166be3];var _0x31942c=createListener(_0xf051('0x6')+_0x5ae688,_0x4cc8a1);MailQueueEvents['on'](_0x5ae688,_0x31942c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 3764499..e68d5a3 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 _0xde11=['get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xde11,0x184));var _0x1de1=function(_0x365dbe,_0x4d3979){_0x365dbe=_0x365dbe-0x0;var _0xaa71bb=_0xde11[_0x365dbe];return _0xaa71bb;};'use strict';var multer=require(_0x1de1('0x0'));var util=require(_0x1de1('0x1'));var path=require(_0x1de1('0x2'));var timeout=require(_0x1de1('0x3'));var express=require(_0x1de1('0x4'));var router=express[_0x1de1('0x5')]();var fs_extra=require(_0x1de1('0x6'));var auth=require(_0x1de1('0x7'));var interaction=require(_0x1de1('0x8'));var config=require(_0x1de1('0x9'));var controller=require(_0x1de1('0xa'));router[_0x1de1('0xb')]('/',auth[_0x1de1('0xc')](),controller[_0x1de1('0xd')]);router[_0x1de1('0xb')](_0x1de1('0xe'),auth[_0x1de1('0xc')](),controller[_0x1de1('0xf')]);router[_0x1de1('0xb')](_0x1de1('0x10'),auth[_0x1de1('0xc')](),controller[_0x1de1('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1de1('0x12')]);router['put']('/:id',auth[_0x1de1('0xc')](),controller[_0x1de1('0x13')]);router['delete'](_0x1de1('0x10'),auth[_0x1de1('0xc')](),controller[_0x1de1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7f73=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7f73,0x9a));var _0x37f7=function(_0x24b798,_0x477b4d){_0x24b798=_0x24b798-0x0;var _0x3454ed=_0x7f73[_0x24b798];return _0x3454ed;};'use strict';var multer=require(_0x37f7('0x0'));var util=require(_0x37f7('0x1'));var path=require(_0x37f7('0x2'));var timeout=require(_0x37f7('0x3'));var express=require('express');var router=express[_0x37f7('0x4')]();var fs_extra=require(_0x37f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x37f7('0x6'));var config=require(_0x37f7('0x7'));var controller=require(_0x37f7('0x8'));router['get']('/',auth[_0x37f7('0x9')](),controller[_0x37f7('0xa')]);router[_0x37f7('0xb')](_0x37f7('0xc'),auth[_0x37f7('0x9')](),controller[_0x37f7('0xd')]);router[_0x37f7('0xb')](_0x37f7('0xe'),auth[_0x37f7('0x9')](),controller['show']);router[_0x37f7('0xf')]('/',auth[_0x37f7('0x9')](),controller['create']);router[_0x37f7('0x10')](_0x37f7('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x37f7('0x11')](_0x37f7('0xe'),auth['isAuthenticated'](),controller[_0x37f7('0x12')]);module[_0x37f7('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index d0b1ba9..eecb184 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 _0x0853=['STRING','DATE','moment','sequelize','exports'];(function(_0x1c5304,_0x3866d4){var _0x211c1b=function(_0x4e7433){while(--_0x4e7433){_0x1c5304['push'](_0x1c5304['shift']());}};_0x211c1b(++_0x3866d4);}(_0x0853,0x101));var _0x3085=function(_0xcf715c,_0x11d1b3){_0xcf715c=_0xcf715c-0x0;var _0x4f0e2f=_0x0853[_0xcf715c];return _0x4f0e2f;};'use strict';var moment=require(_0x3085('0x0'));var Sequelize=require(_0x3085('0x1'));module[_0x3085('0x2')]={'uniqueid':{'type':Sequelize[_0x3085('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3085('0x3')]},'joinAt':{'type':Sequelize[_0x3085('0x4')]},'leaveAt':{'type':Sequelize[_0x3085('0x4')]},'acceptAt':{'type':Sequelize[_0x3085('0x4')]},'exitAt':{'type':Sequelize[_0x3085('0x4')]},'reason':{'type':Sequelize[_0x3085('0x3')]}}; \ No newline at end of file +var _0x1572=['DATE','moment','STRING'];(function(_0x57a5d0,_0x3dbe9e){var _0xd7f06c=function(_0x5729b4){while(--_0x5729b4){_0x57a5d0['push'](_0x57a5d0['shift']());}};_0xd7f06c(++_0x3dbe9e);}(_0x1572,0xf7));var _0x2157=function(_0x14469b,_0x42637d){_0x14469b=_0x14469b-0x0;var _0x583683=_0x1572[_0x14469b];return _0x583683;};'use strict';var moment=require(_0x2157('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x2157('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x2157('0x1')]},'joinAt':{'type':Sequelize[_0x2157('0x2')]},'leaveAt':{'type':Sequelize[_0x2157('0x2')]},'acceptAt':{'type':Sequelize[_0x2157('0x2')]},'exitAt':{'type':Sequelize[_0x2157('0x2')]},'reason':{'type':Sequelize[_0x2157('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 21d7587..c997d1a 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 _0x0295=['params','intersection','include','find','create','body','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','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','MailQueueReport','includeAll','rows','catch','show'];(function(_0x216e58,_0x497adc){var _0x5adcad=function(_0x22197f){while(--_0x22197f){_0x216e58['push'](_0x216e58['shift']());}};_0x5adcad(++_0x497adc);}(_0x0295,0x1f0));var _0x5029=function(_0x3d8243,_0x431106){_0x3d8243=_0x3d8243-0x0;var _0x140fb4=_0x0295[_0x3d8243];return _0x140fb4;};'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'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['MailQueueReport'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['MailQueueReport'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file +var _0x524e=['end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5a5cc6,_0x28ea26){var _0x58876d=function(_0x33737e){while(--_0x33737e){_0x5a5cc6['push'](_0x5a5cc6['shift']());}};_0x58876d(++_0x28ea26);}(_0x524e,0x15e));var _0xe524=function(_0x279409,_0xd61f0a){_0x279409=_0x279409-0x0;var _0x13c710=_0x524e[_0x279409];return _0x13c710;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['MailQueueReport'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['MailQueueReport'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));};exports[_0xe524('0x4b')]=function(_0x208aa8,_0x2fa143){return db['MailQueueReport'][_0xe524('0x4b')]()[_0xe524('0x3f')](respondWithResult(_0x2fa143,null))[_0xe524('0x44')](handleError(_0x2fa143,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index c91c5f7..dec26c6 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 _0xd706=['uniqueid','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x37870d,_0x356e02){var _0x1ae695=function(_0x508f6c){while(--_0x508f6c){_0x37870d['push'](_0x37870d['shift']());}};_0x1ae695(++_0x356e02);}(_0xd706,0x115));var _0x6d70=function(_0x1a3a08,_0x41e91b){_0x1a3a08=_0x1a3a08-0x0;var _0x55c399=_0xd706[_0x1a3a08];return _0x55c399;};'use strict';var _=require(_0x6d70('0x0'));var util=require(_0x6d70('0x1'));var logger=require(_0x6d70('0x2'))('api');var moment=require(_0x6d70('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d70('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6d70('0x5'));var attributes=require(_0x6d70('0x6'));module[_0x6d70('0x7')]=function(_0x4592ae,_0x1ea538){return _0x4592ae[_0x6d70('0x8')](_0x6d70('0x9'),attributes,{'tableName':_0x6d70('0xa'),'paranoid':![],'indexes':[{'name':_0x6d70('0xb'),'fields':[_0x6d70('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8597=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x5aeaa8,_0x903aac){var _0x12a7e6=function(_0x125c97){while(--_0x125c97){_0x5aeaa8['push'](_0x5aeaa8['shift']());}};_0x12a7e6(++_0x903aac);}(_0x8597,0xe1));var _0x7859=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8597[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7859('0x0'));var util=require('util');var logger=require(_0x7859('0x1'))(_0x7859('0x2'));var moment=require(_0x7859('0x3'));var BPromise=require(_0x7859('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7859('0x5'));var rimraf=require(_0x7859('0x6'));var config=require(_0x7859('0x7'));var attributes=require(_0x7859('0x8'));module[_0x7859('0x9')]=function(_0x5b3e77,_0x14fd59){return _0x5b3e77['define']('MailQueueReport',attributes,{'tableName':_0x7859('0xa'),'paranoid':![],'indexes':[{'name':_0x7859('0xb'),'fields':[_0x7859('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index d5ff6e8..70d17e6 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x874709,_0x20b492){var _0x351b20=function(_0x87c907){while(--_0x87c907){_0x874709['push'](_0x874709['shift']());}};_0x351b20(++_0x20b492);}(_0xdb28,0x106));var _0x8db2=function(_0xa2bafc,_0x2f38bc){_0xa2bafc=_0xa2bafc-0x0;var _0x547ab4=_0xdb28[_0xa2bafc];return _0x547ab4;};'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')]('MailQueueReport,\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);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0xf3d8f2,_0x3a04c3){var _0x4b9e0d=function(_0xbf511f){while(--_0xbf511f){_0xf3d8f2['push'](_0xf3d8f2['shift']());}};_0x4b9e0d(++_0x3a04c3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index b68c6b3..2d63586 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2987bf,_0x1877d1){var _0x41f722=function(_0x33ccf9){while(--_0x33ccf9){_0x2987bf['push'](_0x2987bf['shift']());}};_0x41f722(++_0x1877d1);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x66af94,_0x3b8b55){var _0x3572c9=function(_0x2e98a3){while(--_0x2e98a3){_0x66af94['push'](_0x66af94['shift']());}};_0x3572c9(++_0x3b8b55);}(_0xe706,0xa3));var _0x6e70=function(_0x3b1caf,_0x8a35c5){_0x3b1caf=_0x3b1caf-0x0;var _0x416b17=_0xe706[_0x3b1caf];return _0x416b17;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 89b952e..ea1f0e0 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 _0x1f38=['STRING','INTEGER','sequelize','exports'];(function(_0xb6454a,_0x5576d4){var _0x40561f=function(_0x323815){while(--_0x323815){_0xb6454a['push'](_0xb6454a['shift']());}};_0x40561f(++_0x5576d4);}(_0x1f38,0x116));var _0x81f3=function(_0x57fbc8,_0x5f1746){_0x57fbc8=_0x57fbc8-0x0;var _0xfcf1de=_0x1f38[_0x57fbc8];return _0xfcf1de;};'use strict';var Sequelize=require(_0x81f3('0x0'));module[_0x81f3('0x1')]={'description':{'type':Sequelize[_0x81f3('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x81f3('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x81f3('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x81f3('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x81f3('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xced6=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x41ec10,_0x4c3698){var _0xbf245=function(_0x212f2f){while(--_0x212f2f){_0x41ec10['push'](_0x41ec10['shift']());}};_0xbf245(++_0x4c3698);}(_0xced6,0x1b5));var _0x6ced=function(_0x1f10e0,_0x37b402){_0x1f10e0=_0x1f10e0-0x0;var _0x39b7e1=_0xced6[_0x1f10e0];return _0x39b7e1;};'use strict';var Sequelize=require(_0x6ced('0x0'));module['exports']={'description':{'type':Sequelize[_0x6ced('0x1')]},'host':{'type':Sequelize[_0x6ced('0x1')]},'authentication':{'type':Sequelize[_0x6ced('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6ced('0x1')]},'password':{'type':Sequelize[_0x6ced('0x1')]},'port':{'type':Sequelize[_0x6ced('0x3')]},'tls':{'type':Sequelize[_0x6ced('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x6ced('0x1')]},'modernAuthentication':{'type':Sequelize[_0x6ced('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1b595e5..6e43347 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 _0xeda1=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','define','mail_servers_in','lodash','util'];(function(_0x4b7498,_0x57aa70){var _0x3e80ae=function(_0x9c66b5){while(--_0x9c66b5){_0x4b7498['push'](_0x4b7498['shift']());}};_0x3e80ae(++_0x57aa70);}(_0xeda1,0x1ab));var _0x1eda=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0xeda1[_0x500c0];return _0xdd146f;};'use strict';var _=require(_0x1eda('0x0'));var util=require(_0x1eda('0x1'));var logger=require(_0x1eda('0x2'))(_0x1eda('0x3'));var moment=require(_0x1eda('0x4'));var BPromise=require('bluebird');var rp=require(_0x1eda('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1eda('0x6'));var config=require(_0x1eda('0x7'));var attributes=require(_0x1eda('0x8'));module['exports']=function(_0x103860,_0x409845){return _0x103860[_0x1eda('0x9')]('MailServerIn',attributes,{'tableName':_0x1eda('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4245=['path','rimraf','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','../../config/logger','api','moment','request-promise'];(function(_0x50f598,_0x488f2f){var _0x1ae639=function(_0x1d4f93){while(--_0x1d4f93){_0x50f598['push'](_0x50f598['shift']());}};_0x1ae639(++_0x488f2f);}(_0x4245,0xb6));var _0x5424=function(_0x42d842,_0x1683ca){_0x42d842=_0x42d842-0x0;var _0x4c5036=_0x4245[_0x42d842];return _0x4c5036;};'use strict';var _=require(_0x5424('0x0'));var util=require('util');var logger=require(_0x5424('0x1'))(_0x5424('0x2'));var moment=require(_0x5424('0x3'));var BPromise=require('bluebird');var rp=require(_0x5424('0x4'));var fs=require('fs');var path=require(_0x5424('0x5'));var rimraf=require(_0x5424('0x6'));var config=require('../../config/environment');var attributes=require(_0x5424('0x7'));module[_0x5424('0x8')]=function(_0x5df7bf,_0x51f52a){return _0x5df7bf[_0x5424('0x9')]('MailServerIn',attributes,{'tableName':_0x5424('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 0fbffdb..bea561c 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 _0xc2e5=['GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','map','include','attributes','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result'];(function(_0x4b1dcd,_0x24091c){var _0x4038bb=function(_0x112c92){while(--_0x112c92){_0x4b1dcd['push'](_0x4b1dcd['shift']());}};_0x4038bb(++_0x24091c);}(_0xc2e5,0x87));var _0x5c2e=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0xc2e5[_0x4d35f3];return _0x382fea;};'use strict';var _=require(_0x5c2e('0x0'));var util=require(_0x5c2e('0x1'));var moment=require(_0x5c2e('0x2'));var BPromise=require(_0x5c2e('0x3'));var rs=require(_0x5c2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c2e('0x5'))['db'];var utils=require(_0x5c2e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5c2e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c2e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x65371e,_0x1046a3,_0x22781f){return new BPromise(function(_0x1a3d16,_0x2d8cb6){return client[_0x5c2e('0x9')](_0x65371e,_0x22781f)[_0x5c2e('0xa')](function(_0x13a949){logger[_0x5c2e('0xb')]('MailServerIn,\x20%s,\x20%s',_0x1046a3,_0x5c2e('0xc'));logger[_0x5c2e('0xd')](_0x5c2e('0xe'),_0x1046a3,_0x5c2e('0xc'),JSON[_0x5c2e('0xf')](_0x13a949));if(_0x13a949[_0x5c2e('0x10')]){if(_0x13a949[_0x5c2e('0x10')]['code']===0x1f4){logger[_0x5c2e('0x10')](_0x5c2e('0x11'),_0x1046a3,_0x13a949['error']['message']);return _0x2d8cb6(_0x13a949[_0x5c2e('0x10')][_0x5c2e('0x12')]);}logger[_0x5c2e('0x10')](_0x5c2e('0x11'),_0x1046a3,_0x13a949[_0x5c2e('0x10')][_0x5c2e('0x12')]);return _0x1a3d16(_0x13a949[_0x5c2e('0x10')][_0x5c2e('0x12')]);}else{logger[_0x5c2e('0xb')](_0x5c2e('0x11'),_0x1046a3,'request\x20sent');_0x1a3d16(_0x13a949[_0x5c2e('0x13')][_0x5c2e('0x12')]);}})['catch'](function(_0x54925b){logger[_0x5c2e('0x10')]('MailServerIn,\x20%s,\x20%s',_0x1046a3,_0x54925b);_0x2d8cb6(_0x54925b);});});}exports[_0x5c2e('0x14')]=function(_0x1b1f67){var _0x5237e3=this;return new Promise(function(_0x3f4d44,_0x1aafdc){return db[_0x5c2e('0x15')][_0x5c2e('0x16')]({'raw':_0x1b1f67['options']?_0x1b1f67[_0x5c2e('0x17')][_0x5c2e('0x18')]===undefined?!![]:![]:!![],'where':_0x1b1f67[_0x5c2e('0x17')]?_0x1b1f67[_0x5c2e('0x17')][_0x5c2e('0x19')]||null:null,'attributes':_0x1b1f67[_0x5c2e('0x17')]?_0x1b1f67['options']['attributes']||null:null,'limit':_0x1b1f67[_0x5c2e('0x17')]?_0x1b1f67['options'][_0x5c2e('0x1a')]||null:null,'include':_0x1b1f67['options']?_0x1b1f67['options']['include']?_[_0x5c2e('0x1b')](_0x1b1f67[_0x5c2e('0x17')][_0x5c2e('0x1c')],function(_0x1660f3){return{'model':db[_0x1660f3['model']],'as':_0x1660f3['as'],'attributes':_0x1660f3[_0x5c2e('0x1d')],'include':_0x1660f3[_0x5c2e('0x1c')]?_[_0x5c2e('0x1b')](_0x1660f3[_0x5c2e('0x1c')],function(_0x317e3e){return{'model':db[_0x317e3e['model']],'as':_0x317e3e['as'],'attributes':_0x317e3e[_0x5c2e('0x1d')],'include':_0x317e3e[_0x5c2e('0x1c')]?_[_0x5c2e('0x1b')](_0x317e3e['include'],function(_0x475c4d){return{'model':db[_0x475c4d['model']],'as':_0x475c4d['as'],'attributes':_0x475c4d[_0x5c2e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5c2e('0xa')](function(_0x28aa56){logger[_0x5c2e('0xb')]('GetMailServerIn',_0x1b1f67);logger[_0x5c2e('0xd')](_0x5c2e('0x14'),_0x1b1f67,JSON[_0x5c2e('0xf')](_0x28aa56));_0x3f4d44(_0x28aa56);})[_0x5c2e('0x1e')](function(_0x2de061){logger['error']('GetMailServerIn',_0x2de061[_0x5c2e('0x12')],_0x1b1f67);_0x1aafdc(_0x5237e3[_0x5c2e('0x10')](0x1f4,_0x2de061[_0x5c2e('0x12')]));});});}; \ No newline at end of file +var _0x4cdd=['stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','MailServerIn','options','raw','attributes','limit','include','map','model','GetMailServerIn'];(function(_0x2398b8,_0x4acb6c){var _0x3b2af1=function(_0x57512a){while(--_0x57512a){_0x2398b8['push'](_0x2398b8['shift']());}};_0x3b2af1(++_0x4acb6c);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x4db703,_0x2715fc){_0x4db703=_0x4db703-0x0;var _0x4b9eaa=_0x4cdd[_0x4db703];return _0x4b9eaa;};'use strict';var _=require(_0xd4cd('0x0'));var util=require(_0xd4cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4cd('0x2'));var fs=require('fs');var Redis=require(_0xd4cd('0x3'));var db=require(_0xd4cd('0x4'))['db'];var utils=require(_0xd4cd('0x5'));var logger=require(_0xd4cd('0x6'))(_0xd4cd('0x7'));var config=require(_0xd4cd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3065,_0x4f4739,_0x24db75){return new BPromise(function(_0x4a0e74,_0x168dc1){return client[_0xd4cd('0x9')](_0x3c3065,_0x24db75)[_0xd4cd('0xa')](function(_0x456c40){logger[_0xd4cd('0xb')](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');logger[_0xd4cd('0xd')](_0xd4cd('0xe'),_0x4f4739,_0xd4cd('0xf'),JSON['stringify'](_0x456c40));if(_0x456c40['error']){if(_0x456c40['error'][_0xd4cd('0x10')]===0x1f4){logger[_0xd4cd('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40['error'][_0xd4cd('0x12')]);return _0x168dc1(_0x456c40[_0xd4cd('0x11')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40[_0xd4cd('0x11')][_0xd4cd('0x12')]);return _0x4a0e74(_0x456c40['error']['message']);}else{logger['info'](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');_0x4a0e74(_0x456c40['result'][_0xd4cd('0x12')]);}})[_0xd4cd('0x13')](function(_0x346760){logger[_0xd4cd('0x11')](_0xd4cd('0xc'),_0x4f4739,_0x346760);_0x168dc1(_0x346760);});});}exports['GetMailServerIn']=function(_0x3062e6){var _0x3888fe=this;return new Promise(function(_0x4eea06,_0x3e0a87){return db[_0xd4cd('0x14')]['findAll']({'raw':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x16')]===undefined?!![]:![]:!![],'where':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')]['where']||null:null,'attributes':_0x3062e6['options']?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x17')]||null:null,'limit':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x18')]||null:null,'include':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6['options'][_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x3062e6['options'][_0xd4cd('0x19')],function(_0x2e2dbf){return{'model':db[_0x2e2dbf['model']],'as':_0x2e2dbf['as'],'attributes':_0x2e2dbf[_0xd4cd('0x17')],'include':_0x2e2dbf['include']?_['map'](_0x2e2dbf[_0xd4cd('0x19')],function(_0x27bbe8){return{'model':db[_0x27bbe8[_0xd4cd('0x1b')]],'as':_0x27bbe8['as'],'attributes':_0x27bbe8[_0xd4cd('0x17')],'include':_0x27bbe8[_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x27bbe8[_0xd4cd('0x19')],function(_0x443f9e){return{'model':db[_0x443f9e[_0xd4cd('0x1b')]],'as':_0x443f9e['as'],'attributes':_0x443f9e[_0xd4cd('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd4cd('0xa')](function(_0x43f459){logger[_0xd4cd('0xb')](_0xd4cd('0x1c'),_0x3062e6);logger['debug'](_0xd4cd('0x1c'),_0x3062e6,JSON[_0xd4cd('0x1d')](_0x43f459));_0x4eea06(_0x43f459);})['catch'](function(_0xe245f3){logger[_0xd4cd('0x11')]('GetMailServerIn',_0xe245f3[_0xd4cd('0x12')],_0x3062e6);_0x3e0a87(_0x3888fe[_0xd4cd('0x11')](0x1f4,_0xe245f3[_0xd4cd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 308b48c..236f8b6 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(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7a54,0x106));var _0x47a5=function(_0x56804c,_0x5d5f3a){_0x56804c=_0x56804c-0x0;var _0x215443=_0x7a54[_0x56804c];return _0x215443;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 9a3fb98..b70fd30 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 _0xa5fa=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x1368fa,_0x48ea18){var _0x2debec=function(_0x1f5748){while(--_0x1f5748){_0x1368fa['push'](_0x1368fa['shift']());}};_0x2debec(++_0x48ea18);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x3b2ac8,_0x3819fe){_0x3b2ac8=_0x3b2ac8-0x0;var _0x3574f2=_0xa5fa[_0x3b2ac8];return _0x3574f2;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'description':{'type':Sequelize[_0xaa5f('0x1')]},'host':{'type':Sequelize[_0xaa5f('0x1')]},'user':{'type':Sequelize[_0xaa5f('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaa5f('0x2')]},'secure':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x282b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3a09ba,_0x5c5f5b){var _0x408d8c=function(_0x47b0f7){while(--_0x47b0f7){_0x3a09ba['push'](_0x3a09ba['shift']());}};_0x408d8c(++_0x5c5f5b);}(_0x282b,0xec));var _0xb282=function(_0x5a22b4,_0x2860af){_0x5a22b4=_0x5a22b4-0x0;var _0x34bf57=_0x282b[_0x5a22b4];return _0x34bf57;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'description':{'type':Sequelize[_0xb282('0x2')]},'host':{'type':Sequelize[_0xb282('0x2')]},'user':{'type':Sequelize[_0xb282('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb282('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index de9d36a..b8b979f 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 _0xfe14=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','params','find','catch','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','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','end','json','limit','undefined','count','offset','status','set','apply','reject','save','update','then','destroy','stack','name'];(function(_0x269c42,_0xeed101){var _0x4dad76=function(_0x167b87){while(--_0x167b87){_0x269c42['push'](_0x269c42['shift']());}};_0x4dad76(++_0xeed101);}(_0xfe14,0xb0));var _0x4fe1=function(_0x823a0b,_0x5824ff){_0x823a0b=_0x823a0b-0x0;var _0x162120=_0xfe14[_0x823a0b];return _0x162120;};'use strict';var emlformat=require(_0x4fe1('0x0'));var rimraf=require(_0x4fe1('0x1'));var zipdir=require(_0x4fe1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4fe1('0x3'));var Mustache=require(_0x4fe1('0x4'));var util=require(_0x4fe1('0x5'));var path=require('path');var sox=require(_0x4fe1('0x6'));var csv=require('to-csv');var ejs=require(_0x4fe1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fe1('0x8'));var squel=require(_0x4fe1('0x9'));var crypto=require(_0x4fe1('0xa'));var jsforce=require(_0x4fe1('0xb'));var deskjs=require(_0x4fe1('0xc'));var toCsv=require(_0x4fe1('0xd'));var querystring=require(_0x4fe1('0xe'));var Papa=require(_0x4fe1('0xf'));var Redis=require('ioredis');var authService=require(_0x4fe1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4fe1('0x11'));var hardwareService=require(_0x4fe1('0x12'));var logger=require('../../config/logger')(_0x4fe1('0x13'));var utils=require(_0x4fe1('0x14'));var config=require(_0x4fe1('0x15'));var licenseUtil=require(_0x4fe1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a4488,_0x326f75){_0x326f75=_0x326f75||0xcc;return function(_0x318616){if(_0x318616){return _0x3a4488[_0x4fe1('0x17')](_0x326f75);}return _0x3a4488['status'](_0x326f75)[_0x4fe1('0x18')]();};}function respondWithResult(_0xd39640,_0x2832ad){_0x2832ad=_0x2832ad||0xc8;return function(_0xcf0bbc){if(_0xcf0bbc){return _0xd39640['status'](_0x2832ad)[_0x4fe1('0x19')](_0xcf0bbc);}};}function respondWithFilteredResult(_0x4bdf92,_0x2afcc2){return function(_0x227b13){if(_0x227b13){var _0x328b0a=typeof _0x2afcc2['offset']==='undefined'&&typeof _0x2afcc2[_0x4fe1('0x1a')]===_0x4fe1('0x1b');var _0x3ef03f=_0x227b13[_0x4fe1('0x1c')];var _0x1d6498=_0x328b0a?0x0:_0x2afcc2[_0x4fe1('0x1d')];var _0x90a4fc=_0x328b0a?_0x227b13['count']:_0x2afcc2[_0x4fe1('0x1d')]+_0x2afcc2['limit'];var _0x4068bf;if(_0x90a4fc>=_0x3ef03f){_0x90a4fc=_0x3ef03f;_0x4068bf=0xc8;}else{_0x4068bf=0xce;}_0x4bdf92[_0x4fe1('0x1e')](_0x4068bf);return _0x4bdf92[_0x4fe1('0x1f')]('Content-Range',_0x1d6498+'-'+_0x90a4fc+'/'+_0x3ef03f)[_0x4fe1('0x19')](_0x227b13);}return null;};}function patchUpdates(_0x1c8651){return function(_0x2d1195){try{jsonpatch[_0x4fe1('0x20')](_0x2d1195,_0x1c8651,!![]);}catch(_0x51f46c){return BPromise[_0x4fe1('0x21')](_0x51f46c);}return _0x2d1195[_0x4fe1('0x22')]();};}function saveUpdates(_0x5e674e,_0x50b3dd){return function(_0x439c89){if(_0x439c89){return _0x439c89[_0x4fe1('0x23')](_0x5e674e)[_0x4fe1('0x24')](function(_0x51a161){return _0x51a161;});}return null;};}function removeEntity(_0x3e61d9,_0x4ba579){return function(_0x1b292e){if(_0x1b292e){return _0x1b292e[_0x4fe1('0x25')]()[_0x4fe1('0x24')](function(){_0x3e61d9['status'](0xcc)[_0x4fe1('0x18')]();});}};}function handleEntityNotFound(_0x3158d8,_0x3e28e4){return function(_0x238b64){if(!_0x238b64){_0x3158d8[_0x4fe1('0x17')](0x194);}return _0x238b64;};}function handleError(_0x303128,_0xb9fefc){_0xb9fefc=_0xb9fefc||0x1f4;return function(_0x4cdf27){logger['error'](_0x4cdf27[_0x4fe1('0x26')]);if(_0x4cdf27[_0x4fe1('0x27')]){delete _0x4cdf27[_0x4fe1('0x27')];}_0x303128[_0x4fe1('0x1e')](_0xb9fefc)['send'](_0x4cdf27);};}exports[_0x4fe1('0x28')]=function(_0x177efc,_0x33ca96){var _0x1970ea={},_0x507ed0={},_0x1aa6ce={'count':0x0,'rows':[]};var _0x58fa2d=_[_0x4fe1('0x29')](db['MailServerOut'][_0x4fe1('0x2a')],function(_0x471ea7){return{'name':_0x471ea7[_0x4fe1('0x2b')],'type':_0x471ea7[_0x4fe1('0x2c')][_0x4fe1('0x2d')]};});_0x507ed0[_0x4fe1('0x2e')]=_[_0x4fe1('0x29')](_0x58fa2d,'name');_0x507ed0[_0x4fe1('0x2f')]=_[_0x4fe1('0x30')](_0x177efc['query']);_0x507ed0[_0x4fe1('0x31')]=_[_0x4fe1('0x32')](_0x507ed0[_0x4fe1('0x2e')],_0x507ed0[_0x4fe1('0x2f')]);_0x1970ea[_0x4fe1('0x33')]=_[_0x4fe1('0x32')](_0x507ed0[_0x4fe1('0x2e')],qs[_0x4fe1('0x34')](_0x177efc['query'][_0x4fe1('0x34')]));_0x1970ea[_0x4fe1('0x33')]=_0x1970ea['attributes'][_0x4fe1('0x35')]?_0x1970ea['attributes']:_0x507ed0['model'];if(!_0x177efc[_0x4fe1('0x2f')][_0x4fe1('0x36')]('nolimit')){_0x1970ea['limit']=qs[_0x4fe1('0x1a')](_0x177efc[_0x4fe1('0x2f')]['limit']);_0x1970ea[_0x4fe1('0x1d')]=qs[_0x4fe1('0x1d')](_0x177efc[_0x4fe1('0x2f')]['offset']);}_0x1970ea[_0x4fe1('0x37')]=qs[_0x4fe1('0x38')](_0x177efc[_0x4fe1('0x2f')][_0x4fe1('0x38')]);_0x1970ea['where']=qs[_0x4fe1('0x31')](_[_0x4fe1('0x39')](_0x177efc[_0x4fe1('0x2f')],_0x507ed0[_0x4fe1('0x31')]),_0x58fa2d);if(_0x177efc[_0x4fe1('0x2f')]['filter']){_0x1970ea[_0x4fe1('0x3a')]=_[_0x4fe1('0x3b')](_0x1970ea[_0x4fe1('0x3a')],{'$or':_[_0x4fe1('0x29')](_0x58fa2d,function(_0x4d74a3){if(_0x4d74a3[_0x4fe1('0x2c')]!==_0x4fe1('0x3c')){var _0x29ec77={};_0x29ec77[_0x4d74a3['name']]={'$like':'%'+_0x177efc[_0x4fe1('0x2f')]['filter']+'%'};return _0x29ec77;}})});}_0x1970ea=_[_0x4fe1('0x3b')]({},_0x1970ea,_0x177efc[_0x4fe1('0x3d')]);var _0x1e7392={'where':_0x1970ea[_0x4fe1('0x3a')]};return db[_0x4fe1('0x3e')][_0x4fe1('0x1c')](_0x1e7392)[_0x4fe1('0x24')](function(_0x11e020){_0x1aa6ce[_0x4fe1('0x1c')]=_0x11e020;if(_0x177efc['query'][_0x4fe1('0x3f')]){_0x1970ea[_0x4fe1('0x40')]=[{'all':!![]}];}return db[_0x4fe1('0x3e')][_0x4fe1('0x41')](_0x1970ea);})[_0x4fe1('0x24')](function(_0x2f43ea){_0x1aa6ce[_0x4fe1('0x42')]=_0x2f43ea;return _0x1aa6ce;})[_0x4fe1('0x24')](respondWithFilteredResult(_0x33ca96,_0x1970ea))['catch'](handleError(_0x33ca96,null));};exports['show']=function(_0x3de05d,_0x5ded0d){var _0x3c1bbd={'raw':!![],'where':{'id':_0x3de05d[_0x4fe1('0x43')]['id']}},_0x188c7d={};_0x188c7d[_0x4fe1('0x2e')]=_['keys'](db['MailServerOut'][_0x4fe1('0x2a')]);_0x188c7d['query']=_['keys'](_0x3de05d[_0x4fe1('0x2f')]);_0x188c7d[_0x4fe1('0x31')]=_['intersection'](_0x188c7d[_0x4fe1('0x2e')],_0x188c7d[_0x4fe1('0x2f')]);_0x3c1bbd['attributes']=_[_0x4fe1('0x32')](_0x188c7d[_0x4fe1('0x2e')],qs[_0x4fe1('0x34')](_0x3de05d[_0x4fe1('0x2f')][_0x4fe1('0x34')]));_0x3c1bbd[_0x4fe1('0x33')]=_0x3c1bbd[_0x4fe1('0x33')][_0x4fe1('0x35')]?_0x3c1bbd[_0x4fe1('0x33')]:_0x188c7d[_0x4fe1('0x2e')];if(_0x3de05d['query'][_0x4fe1('0x3f')]){_0x3c1bbd['include']=[{'all':!![]}];}_0x3c1bbd=_[_0x4fe1('0x3b')]({},_0x3c1bbd,_0x3de05d[_0x4fe1('0x3d')]);return db[_0x4fe1('0x3e')][_0x4fe1('0x44')](_0x3c1bbd)['then'](handleEntityNotFound(_0x5ded0d,null))[_0x4fe1('0x24')](respondWithResult(_0x5ded0d,null))[_0x4fe1('0x45')](handleError(_0x5ded0d,null));};exports[_0x4fe1('0x46')]=function(_0x18358b,_0x5cbd19){return db[_0x4fe1('0x3e')][_0x4fe1('0x46')](_0x18358b['body'],{})[_0x4fe1('0x24')](respondWithResult(_0x5cbd19,0xc9))[_0x4fe1('0x45')](handleError(_0x5cbd19,null));};exports['update']=function(_0x96e220,_0x186e3f){if(_0x96e220[_0x4fe1('0x47')]['id']){delete _0x96e220[_0x4fe1('0x47')]['id'];}return db[_0x4fe1('0x3e')][_0x4fe1('0x44')]({'where':{'id':_0x96e220[_0x4fe1('0x43')]['id']}})[_0x4fe1('0x24')](handleEntityNotFound(_0x186e3f,null))['then'](saveUpdates(_0x96e220[_0x4fe1('0x47')],null))[_0x4fe1('0x24')](respondWithResult(_0x186e3f,null))[_0x4fe1('0x45')](handleError(_0x186e3f,null));};exports[_0x4fe1('0x25')]=function(_0x2e4052,_0x273bbe){return db[_0x4fe1('0x3e')][_0x4fe1('0x44')]({'where':{'id':_0x2e4052['params']['id']}})[_0x4fe1('0x24')](handleEntityNotFound(_0x273bbe,null))[_0x4fe1('0x24')](removeEntity(_0x273bbe,null))[_0x4fe1('0x45')](handleError(_0x273bbe,null));}; \ No newline at end of file +var _0x4519=['sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','includeAll','find','create','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/environment','../../config/license/util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4519,0x1db));var _0x9451=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4519[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x9451('0x0'));var rimraf=require(_0x9451('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9451('0x2'));var BPromise=require(_0x9451('0x3'));var Mustache=require(_0x9451('0x4'));var util=require(_0x9451('0x5'));var path=require(_0x9451('0x6'));var sox=require(_0x9451('0x7'));var csv=require(_0x9451('0x8'));var ejs=require(_0x9451('0x9'));var fs=require('fs');var fs_extra=require(_0x9451('0xa'));var _=require(_0x9451('0xb'));var squel=require(_0x9451('0xc'));var crypto=require(_0x9451('0xd'));var jsforce=require(_0x9451('0xe'));var deskjs=require(_0x9451('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9451('0x10'));var Papa=require(_0x9451('0x11'));var Redis=require(_0x9451('0x12'));var authService=require(_0x9451('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9451('0x14'));var licenseUtil=require(_0x9451('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32e7f7,_0x39fa43){_0x39fa43=_0x39fa43||0xcc;return function(_0x528517){if(_0x528517){return _0x32e7f7[_0x9451('0x16')](_0x39fa43);}return _0x32e7f7[_0x9451('0x17')](_0x39fa43)[_0x9451('0x18')]();};}function respondWithResult(_0x586704,_0x413b7c){_0x413b7c=_0x413b7c||0xc8;return function(_0xa78f7){if(_0xa78f7){return _0x586704[_0x9451('0x17')](_0x413b7c)[_0x9451('0x19')](_0xa78f7);}};}function respondWithFilteredResult(_0xb25c0f,_0x4e2530){return function(_0x1c77f7){if(_0x1c77f7){var _0x464aa7=typeof _0x4e2530['offset']===_0x9451('0x1a')&&typeof _0x4e2530['limit']===_0x9451('0x1a');var _0x240eba=_0x1c77f7[_0x9451('0x1b')];var _0x3578f9=_0x464aa7?0x0:_0x4e2530[_0x9451('0x1c')];var _0xe3b99f=_0x464aa7?_0x1c77f7['count']:_0x4e2530[_0x9451('0x1c')]+_0x4e2530[_0x9451('0x1d')];var _0x4ba263;if(_0xe3b99f>=_0x240eba){_0xe3b99f=_0x240eba;_0x4ba263=0xc8;}else{_0x4ba263=0xce;}_0xb25c0f['status'](_0x4ba263);return _0xb25c0f[_0x9451('0x1e')](_0x9451('0x1f'),_0x3578f9+'-'+_0xe3b99f+'/'+_0x240eba)[_0x9451('0x19')](_0x1c77f7);}return null;};}function patchUpdates(_0x22b718){return function(_0x3781a4){try{jsonpatch['apply'](_0x3781a4,_0x22b718,!![]);}catch(_0x1f7ee4){return BPromise[_0x9451('0x20')](_0x1f7ee4);}return _0x3781a4['save']();};}function saveUpdates(_0x25f02c,_0x55e05c){return function(_0x49dd82){if(_0x49dd82){return _0x49dd82[_0x9451('0x21')](_0x25f02c)[_0x9451('0x22')](function(_0x113f38){return _0x113f38;});}return null;};}function removeEntity(_0x82459,_0x2d6069){return function(_0x2c6700){if(_0x2c6700){return _0x2c6700[_0x9451('0x23')]()[_0x9451('0x22')](function(){_0x82459[_0x9451('0x17')](0xcc)[_0x9451('0x18')]();});}};}function handleEntityNotFound(_0x1946a7,_0x5bab48){return function(_0x117957){if(!_0x117957){_0x1946a7[_0x9451('0x16')](0x194);}return _0x117957;};}function handleError(_0x52ae4d,_0x4bb28b){_0x4bb28b=_0x4bb28b||0x1f4;return function(_0x36fcd5){logger[_0x9451('0x24')](_0x36fcd5[_0x9451('0x25')]);if(_0x36fcd5[_0x9451('0x26')]){delete _0x36fcd5[_0x9451('0x26')];}_0x52ae4d['status'](_0x4bb28b)['send'](_0x36fcd5);};}exports[_0x9451('0x27')]=function(_0x34397d,_0x18e3a6){var _0x3461a6={},_0x4437bc={},_0xb18706={'count':0x0,'rows':[]};var _0x21e518=_[_0x9451('0x28')](db[_0x9451('0x29')][_0x9451('0x2a')],function(_0x3a05fc){return{'name':_0x3a05fc[_0x9451('0x2b')],'type':_0x3a05fc[_0x9451('0x2c')][_0x9451('0x2d')]};});_0x4437bc['model']=_['map'](_0x21e518,_0x9451('0x26'));_0x4437bc['query']=_[_0x9451('0x2e')](_0x34397d[_0x9451('0x2f')]);_0x4437bc[_0x9451('0x30')]=_[_0x9451('0x31')](_0x4437bc[_0x9451('0x32')],_0x4437bc['query']);_0x3461a6['attributes']=_[_0x9451('0x31')](_0x4437bc['model'],qs[_0x9451('0x33')](_0x34397d['query'][_0x9451('0x33')]));_0x3461a6[_0x9451('0x34')]=_0x3461a6['attributes'][_0x9451('0x35')]?_0x3461a6[_0x9451('0x34')]:_0x4437bc['model'];if(!_0x34397d[_0x9451('0x2f')]['hasOwnProperty'](_0x9451('0x36'))){_0x3461a6[_0x9451('0x1d')]=qs[_0x9451('0x1d')](_0x34397d[_0x9451('0x2f')]['limit']);_0x3461a6['offset']=qs['offset'](_0x34397d[_0x9451('0x2f')][_0x9451('0x1c')]);}_0x3461a6[_0x9451('0x37')]=qs[_0x9451('0x38')](_0x34397d[_0x9451('0x2f')][_0x9451('0x38')]);_0x3461a6['where']=qs[_0x9451('0x30')](_['pick'](_0x34397d[_0x9451('0x2f')],_0x4437bc[_0x9451('0x30')]),_0x21e518);if(_0x34397d['query'][_0x9451('0x39')]){_0x3461a6[_0x9451('0x3a')]=_['merge'](_0x3461a6[_0x9451('0x3a')],{'$or':_[_0x9451('0x28')](_0x21e518,function(_0x4eb5a8){if(_0x4eb5a8[_0x9451('0x2c')]!==_0x9451('0x3b')){var _0x21d25e={};_0x21d25e[_0x4eb5a8['name']]={'$like':'%'+_0x34397d[_0x9451('0x2f')][_0x9451('0x39')]+'%'};return _0x21d25e;}})});}_0x3461a6=_[_0x9451('0x3c')]({},_0x3461a6,_0x34397d['options']);var _0x7faca9={'where':_0x3461a6[_0x9451('0x3a')]};return db[_0x9451('0x29')][_0x9451('0x1b')](_0x7faca9)[_0x9451('0x22')](function(_0x384052){_0xb18706[_0x9451('0x1b')]=_0x384052;if(_0x34397d[_0x9451('0x2f')]['includeAll']){_0x3461a6[_0x9451('0x3d')]=[{'all':!![]}];}return db[_0x9451('0x29')][_0x9451('0x3e')](_0x3461a6);})[_0x9451('0x22')](function(_0x26d4b0){_0xb18706[_0x9451('0x3f')]=_0x26d4b0;return _0xb18706;})[_0x9451('0x22')](respondWithFilteredResult(_0x18e3a6,_0x3461a6))[_0x9451('0x40')](handleError(_0x18e3a6,null));};exports[_0x9451('0x41')]=function(_0x45eee4,_0x39068b){var _0x195947={'raw':!![],'where':{'id':_0x45eee4['params']['id']}},_0x110129={};_0x110129['model']=_[_0x9451('0x2e')](db['MailServerOut'][_0x9451('0x2a')]);_0x110129[_0x9451('0x2f')]=_[_0x9451('0x2e')](_0x45eee4['query']);_0x110129[_0x9451('0x30')]=_[_0x9451('0x31')](_0x110129['model'],_0x110129[_0x9451('0x2f')]);_0x195947[_0x9451('0x34')]=_[_0x9451('0x31')](_0x110129[_0x9451('0x32')],qs[_0x9451('0x33')](_0x45eee4[_0x9451('0x2f')][_0x9451('0x33')]));_0x195947[_0x9451('0x34')]=_0x195947[_0x9451('0x34')][_0x9451('0x35')]?_0x195947[_0x9451('0x34')]:_0x110129[_0x9451('0x32')];if(_0x45eee4[_0x9451('0x2f')][_0x9451('0x42')]){_0x195947['include']=[{'all':!![]}];}_0x195947=_[_0x9451('0x3c')]({},_0x195947,_0x45eee4['options']);return db[_0x9451('0x29')][_0x9451('0x43')](_0x195947)['then'](handleEntityNotFound(_0x39068b,null))['then'](respondWithResult(_0x39068b,null))[_0x9451('0x40')](handleError(_0x39068b,null));};exports['create']=function(_0x1aaa81,_0x57ced8){return db[_0x9451('0x29')][_0x9451('0x44')](_0x1aaa81[_0x9451('0x45')],{})[_0x9451('0x22')](respondWithResult(_0x57ced8,0xc9))['catch'](handleError(_0x57ced8,null));};exports['update']=function(_0x2a491f,_0x45af50){if(_0x2a491f['body']['id']){delete _0x2a491f['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x2a491f['params']['id']}})[_0x9451('0x22')](handleEntityNotFound(_0x45af50,null))['then'](saveUpdates(_0x2a491f[_0x9451('0x45')],null))[_0x9451('0x22')](respondWithResult(_0x45af50,null))['catch'](handleError(_0x45af50,null));};exports[_0x9451('0x23')]=function(_0x1624c6,_0x5b63b9){return db[_0x9451('0x29')]['find']({'where':{'id':_0x1624c6[_0x9451('0x46')]['id']}})[_0x9451('0x22')](handleEntityNotFound(_0x5b63b9,null))[_0x9451('0x22')](removeEntity(_0x5b63b9,null))[_0x9451('0x40')](handleError(_0x5b63b9,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 70d5776..d70a4cc 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 _0xff66=['api','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','lodash','../../config/logger'];(function(_0x223300,_0x504980){var _0x37baac=function(_0x1a97ea){while(--_0x1a97ea){_0x223300['push'](_0x223300['shift']());}};_0x37baac(++_0x504980);}(_0xff66,0xda));var _0x6ff6=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xff66[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x6ff6('0x0'));var util=require('util');var logger=require(_0x6ff6('0x1'))(_0x6ff6('0x2'));var moment=require('moment');var BPromise=require(_0x6ff6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ff6('0x4'));var rimraf=require(_0x6ff6('0x5'));var config=require(_0x6ff6('0x6'));var attributes=require(_0x6ff6('0x7'));module['exports']=function(_0x1f4ba1,_0x42c398){return _0x1f4ba1[_0x6ff6('0x8')](_0x6ff6('0x9'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf875=['path','rimraf','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4dfe12,_0x14adb1){var _0x1b778c=function(_0xf133d3){while(--_0xf133d3){_0x4dfe12['push'](_0x4dfe12['shift']());}};_0x1b778c(++_0x14adb1);}(_0xf875,0x66));var _0x5f87=function(_0x2dc0d9,_0x535d73){_0x2dc0d9=_0x2dc0d9-0x0;var _0x16e1da=_0xf875[_0x2dc0d9];return _0x16e1da;};'use strict';var _=require(_0x5f87('0x0'));var util=require('util');var logger=require(_0x5f87('0x1'))(_0x5f87('0x2'));var moment=require(_0x5f87('0x3'));var BPromise=require(_0x5f87('0x4'));var rp=require(_0x5f87('0x5'));var fs=require('fs');var path=require(_0x5f87('0x6'));var rimraf=require(_0x5f87('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f87('0x8'));module[_0x5f87('0x9')]=function(_0x10cddd,_0x540179){return _0x10cddd[_0x5f87('0xa')]('MailServerOut',attributes,{'tableName':_0x5f87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 5cf5cc1..30b4012 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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\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(_0x5ee9f1,_0x32f9d2){var _0x366ca=function(_0x59b4ea){while(--_0x59b4ea){_0x5ee9f1['push'](_0x5ee9f1['shift']());}};_0x366ca(++_0x32f9d2);}(_0x1261,0x144));var _0x1126=function(_0x272d8a,_0x45184b){_0x272d8a=_0x272d8a-0x0;var _0x26286e=_0x1261[_0x272d8a];return _0x26286e;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x414d01,_0x8d6d24){var _0x2c525c=function(_0x363740){while(--_0x363740){_0x414d01['push'](_0x414d01['shift']());}};_0x2c525c(++_0x8d6d24);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 12c6fef..18e869a 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 _0xc967=['describe','/:id','show','post','create','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc967,0x85));var _0x7c96=function(_0x3fbb30,_0x3e4709){_0x3fbb30=_0x3fbb30-0x0;var _0x49b150=_0xc967[_0x3fbb30];return _0x49b150;};'use strict';var multer=require('multer');var util=require(_0x7c96('0x0'));var path=require(_0x7c96('0x1'));var timeout=require(_0x7c96('0x2'));var express=require(_0x7c96('0x3'));var router=express[_0x7c96('0x4')]();var fs_extra=require(_0x7c96('0x5'));var auth=require(_0x7c96('0x6'));var interaction=require(_0x7c96('0x7'));var config=require(_0x7c96('0x8'));var controller=require(_0x7c96('0x9'));router[_0x7c96('0xa')]('/',auth[_0x7c96('0xb')](),controller[_0x7c96('0xc')]);router['get'](_0x7c96('0xd'),auth[_0x7c96('0xb')](),controller[_0x7c96('0xe')]);router[_0x7c96('0xa')](_0x7c96('0xf'),auth[_0x7c96('0xb')](),controller[_0x7c96('0x10')]);router[_0x7c96('0x11')]('/',auth[_0x7c96('0xb')](),controller[_0x7c96('0x12')]);router['put'](_0x7c96('0xf'),auth[_0x7c96('0xb')](),controller[_0x7c96('0x13')]);router['delete'](_0x7c96('0xf'),auth[_0x7c96('0xb')](),controller[_0x7c96('0x14')]);module['exports']=router; \ No newline at end of file +var _0x85fb=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailSubstatus.controller','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x2bf7ce,_0x1ea138){var _0xa026b9=function(_0xa38980){while(--_0xa38980){_0x2bf7ce['push'](_0x2bf7ce['shift']());}};_0xa026b9(++_0x1ea138);}(_0x85fb,0x146));var _0xb85f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x85fb[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xb85f('0x0'));var path=require(_0xb85f('0x1'));var timeout=require(_0xb85f('0x2'));var express=require(_0xb85f('0x3'));var router=express[_0xb85f('0x4')]();var fs_extra=require(_0xb85f('0x5'));var auth=require(_0xb85f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb85f('0x7'));router[_0xb85f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb85f('0x8')]('/describe',auth[_0xb85f('0x9')](),controller[_0xb85f('0xa')]);router[_0xb85f('0x8')](_0xb85f('0xb'),auth[_0xb85f('0x9')](),controller[_0xb85f('0xc')]);router[_0xb85f('0xd')]('/',auth[_0xb85f('0x9')](),controller['create']);router[_0xb85f('0xe')](_0xb85f('0xb'),auth[_0xb85f('0x9')](),controller[_0xb85f('0xf')]);router[_0xb85f('0x10')](_0xb85f('0xb'),auth[_0xb85f('0x9')](),controller[_0xb85f('0x11')]);module[_0xb85f('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 8b09c03..bddd2cc 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 _0x0d4d=['STRING','name','sequelize','exports'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x0d4d,0x132));var _0xd0d4=function(_0x39ddf7,_0x192b71){_0x39ddf7=_0x39ddf7-0x0;var _0x85671d=_0x0d4d[_0x39ddf7];return _0x85671d;};'use strict';var Sequelize=require(_0xd0d4('0x0'));module[_0xd0d4('0x1')]={'name':{'type':Sequelize[_0xd0d4('0x2')],'unique':_0xd0d4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd0d4('0x2')]}}; \ No newline at end of file +var _0x1db9=['STRING','name','sequelize','exports'];(function(_0xf25afa,_0x1c11aa){var _0x246934=function(_0x38daae){while(--_0x38daae){_0xf25afa['push'](_0xf25afa['shift']());}};_0x246934(++_0x1c11aa);}(_0x1db9,0x176));var _0x91db=function(_0x32e170,_0xce274f){_0x32e170=_0x32e170-0x0;var _0x25bf24=_0x1db9[_0x32e170];return _0x25bf24;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'name':{'type':Sequelize[_0x91db('0x2')],'unique':_0x91db('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91db('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 9813419..35370a3 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 _0x37ed=['pick','filter','merge','map','VIRTUAL','include','findAll','rows','show','keys','includeAll','options','find','create','body','update','params','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','error','name','send','MailSubstatus','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters'];(function(_0x48053c,_0x106254){var _0x3ef1ad=function(_0x132cc7){while(--_0x132cc7){_0x48053c['push'](_0x48053c['shift']());}};_0x3ef1ad(++_0x106254);}(_0x37ed,0xb3));var _0xd37e=function(_0x3954d6,_0x1c4120){_0x3954d6=_0x3954d6-0x0;var _0x5d0798=_0x37ed[_0x3954d6];return _0x5d0798;};'use strict';var emlformat=require(_0xd37e('0x0'));var rimraf=require(_0xd37e('0x1'));var zipdir=require(_0xd37e('0x2'));var jsonpatch=require(_0xd37e('0x3'));var rp=require(_0xd37e('0x4'));var moment=require(_0xd37e('0x5'));var BPromise=require(_0xd37e('0x6'));var Mustache=require(_0xd37e('0x7'));var util=require(_0xd37e('0x8'));var path=require(_0xd37e('0x9'));var sox=require(_0xd37e('0xa'));var csv=require('to-csv');var ejs=require(_0xd37e('0xb'));var fs=require('fs');var fs_extra=require(_0xd37e('0xc'));var _=require(_0xd37e('0xd'));var squel=require(_0xd37e('0xe'));var crypto=require(_0xd37e('0xf'));var jsforce=require(_0xd37e('0x10'));var deskjs=require(_0xd37e('0x11'));var toCsv=require(_0xd37e('0x12'));var querystring=require(_0xd37e('0x13'));var Papa=require(_0xd37e('0x14'));var Redis=require(_0xd37e('0x15'));var authService=require(_0xd37e('0x16'));var qs=require(_0xd37e('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd37e('0x18'));var logger=require('../../config/logger')(_0xd37e('0x19'));var utils=require(_0xd37e('0x1a'));var config=require(_0xd37e('0x1b'));var licenseUtil=require(_0xd37e('0x1c'));var db=require(_0xd37e('0x1d'))['db'];function respondWithStatusCode(_0x4ebce6,_0x4afe23){_0x4afe23=_0x4afe23||0xcc;return function(_0x5554e6){if(_0x5554e6){return _0x4ebce6[_0xd37e('0x1e')](_0x4afe23);}return _0x4ebce6['status'](_0x4afe23)[_0xd37e('0x1f')]();};}function respondWithResult(_0x4aecc8,_0xaf15cd){_0xaf15cd=_0xaf15cd||0xc8;return function(_0x2f6fdd){if(_0x2f6fdd){return _0x4aecc8[_0xd37e('0x20')](_0xaf15cd)[_0xd37e('0x21')](_0x2f6fdd);}};}function respondWithFilteredResult(_0x3ccaab,_0x88efcd){return function(_0x258f1f){if(_0x258f1f){var _0x44971f=typeof _0x88efcd[_0xd37e('0x22')]==='undefined'&&typeof _0x88efcd[_0xd37e('0x23')]===_0xd37e('0x24');var _0x4d5fac=_0x258f1f[_0xd37e('0x25')];var _0x35d9fc=_0x44971f?0x0:_0x88efcd[_0xd37e('0x22')];var _0x245546=_0x44971f?_0x258f1f[_0xd37e('0x25')]:_0x88efcd['offset']+_0x88efcd['limit'];var _0x198865;if(_0x245546>=_0x4d5fac){_0x245546=_0x4d5fac;_0x198865=0xc8;}else{_0x198865=0xce;}_0x3ccaab[_0xd37e('0x20')](_0x198865);return _0x3ccaab['set'](_0xd37e('0x26'),_0x35d9fc+'-'+_0x245546+'/'+_0x4d5fac)[_0xd37e('0x21')](_0x258f1f);}return null;};}function patchUpdates(_0x2c8fcc){return function(_0x3249d6){try{jsonpatch[_0xd37e('0x27')](_0x3249d6,_0x2c8fcc,!![]);}catch(_0x19b9af){return BPromise['reject'](_0x19b9af);}return _0x3249d6[_0xd37e('0x28')]();};}function saveUpdates(_0x555c87,_0x1226bb){return function(_0x5218f9){if(_0x5218f9){return _0x5218f9['update'](_0x555c87)[_0xd37e('0x29')](function(_0x226cee){return _0x226cee;});}return null;};}function removeEntity(_0x33b800,_0x4d0be5){return function(_0xb6e370){if(_0xb6e370){return _0xb6e370[_0xd37e('0x2a')]()['then'](function(){_0x33b800[_0xd37e('0x20')](0xcc)[_0xd37e('0x1f')]();});}};}function handleEntityNotFound(_0x6427b2,_0xf6f2d1){return function(_0x34e9cd){if(!_0x34e9cd){_0x6427b2[_0xd37e('0x1e')](0x194);}return _0x34e9cd;};}function handleError(_0x4d34b0,_0x4579a4){_0x4579a4=_0x4579a4||0x1f4;return function(_0xff4109){logger[_0xd37e('0x2b')](_0xff4109['stack']);if(_0xff4109[_0xd37e('0x2c')]){delete _0xff4109[_0xd37e('0x2c')];}_0x4d34b0[_0xd37e('0x20')](_0x4579a4)[_0xd37e('0x2d')](_0xff4109);};}exports['index']=function(_0x195117,_0xc1006e){var _0x4c31f3={},_0x2bbae1={},_0x30d8d2={'count':0x0,'rows':[]};var _0x51ac48=_['map'](db[_0xd37e('0x2e')][_0xd37e('0x2f')],function(_0xb31aa5){return{'name':_0xb31aa5[_0xd37e('0x30')],'type':_0xb31aa5[_0xd37e('0x31')]['key']};});_0x2bbae1[_0xd37e('0x32')]=_['map'](_0x51ac48,_0xd37e('0x2c'));_0x2bbae1['query']=_['keys'](_0x195117[_0xd37e('0x33')]);_0x2bbae1['filters']=_[_0xd37e('0x34')](_0x2bbae1[_0xd37e('0x32')],_0x2bbae1[_0xd37e('0x33')]);_0x4c31f3[_0xd37e('0x35')]=_[_0xd37e('0x34')](_0x2bbae1[_0xd37e('0x32')],qs[_0xd37e('0x36')](_0x195117[_0xd37e('0x33')]['fields']));_0x4c31f3['attributes']=_0x4c31f3[_0xd37e('0x35')][_0xd37e('0x37')]?_0x4c31f3[_0xd37e('0x35')]:_0x2bbae1[_0xd37e('0x32')];if(!_0x195117[_0xd37e('0x33')]['hasOwnProperty'](_0xd37e('0x38'))){_0x4c31f3[_0xd37e('0x23')]=qs['limit'](_0x195117[_0xd37e('0x33')][_0xd37e('0x23')]);_0x4c31f3[_0xd37e('0x22')]=qs[_0xd37e('0x22')](_0x195117['query'][_0xd37e('0x22')]);}_0x4c31f3[_0xd37e('0x39')]=qs['sort'](_0x195117[_0xd37e('0x33')][_0xd37e('0x3a')]);_0x4c31f3[_0xd37e('0x3b')]=qs[_0xd37e('0x3c')](_[_0xd37e('0x3d')](_0x195117[_0xd37e('0x33')],_0x2bbae1['filters']),_0x51ac48);if(_0x195117[_0xd37e('0x33')][_0xd37e('0x3e')]){_0x4c31f3[_0xd37e('0x3b')]=_[_0xd37e('0x3f')](_0x4c31f3[_0xd37e('0x3b')],{'$or':_[_0xd37e('0x40')](_0x51ac48,function(_0x56b171){if(_0x56b171['type']!==_0xd37e('0x41')){var _0x26bb8a={};_0x26bb8a[_0x56b171[_0xd37e('0x2c')]]={'$like':'%'+_0x195117[_0xd37e('0x33')][_0xd37e('0x3e')]+'%'};return _0x26bb8a;}})});}_0x4c31f3=_[_0xd37e('0x3f')]({},_0x4c31f3,_0x195117['options']);var _0x158c65={'where':_0x4c31f3[_0xd37e('0x3b')]};return db['MailSubstatus']['count'](_0x158c65)[_0xd37e('0x29')](function(_0x7fdaf1){_0x30d8d2['count']=_0x7fdaf1;if(_0x195117[_0xd37e('0x33')]['includeAll']){_0x4c31f3[_0xd37e('0x42')]=[{'all':!![]}];}return db[_0xd37e('0x2e')][_0xd37e('0x43')](_0x4c31f3);})['then'](function(_0x35d1a6){_0x30d8d2[_0xd37e('0x44')]=_0x35d1a6;return _0x30d8d2;})['then'](respondWithFilteredResult(_0xc1006e,_0x4c31f3))['catch'](handleError(_0xc1006e,null));};exports[_0xd37e('0x45')]=function(_0x3f6fe2,_0x40ee94){var _0x2351a4={'raw':!![],'where':{'id':_0x3f6fe2['params']['id']}},_0x19ff02={};_0x19ff02['model']=_['keys'](db['MailSubstatus']['rawAttributes']);_0x19ff02[_0xd37e('0x33')]=_[_0xd37e('0x46')](_0x3f6fe2[_0xd37e('0x33')]);_0x19ff02[_0xd37e('0x3c')]=_[_0xd37e('0x34')](_0x19ff02[_0xd37e('0x32')],_0x19ff02['query']);_0x2351a4[_0xd37e('0x35')]=_['intersection'](_0x19ff02['model'],qs['fields'](_0x3f6fe2[_0xd37e('0x33')]['fields']));_0x2351a4[_0xd37e('0x35')]=_0x2351a4[_0xd37e('0x35')][_0xd37e('0x37')]?_0x2351a4[_0xd37e('0x35')]:_0x19ff02[_0xd37e('0x32')];if(_0x3f6fe2[_0xd37e('0x33')][_0xd37e('0x47')]){_0x2351a4[_0xd37e('0x42')]=[{'all':!![]}];}_0x2351a4=_[_0xd37e('0x3f')]({},_0x2351a4,_0x3f6fe2[_0xd37e('0x48')]);return db[_0xd37e('0x2e')][_0xd37e('0x49')](_0x2351a4)[_0xd37e('0x29')](handleEntityNotFound(_0x40ee94,null))['then'](respondWithResult(_0x40ee94,null))['catch'](handleError(_0x40ee94,null));};exports[_0xd37e('0x4a')]=function(_0x3c8a05,_0x162fcb){return db[_0xd37e('0x2e')][_0xd37e('0x4a')](_0x3c8a05[_0xd37e('0x4b')],{})[_0xd37e('0x29')](respondWithResult(_0x162fcb,0xc9))['catch'](handleError(_0x162fcb,null));};exports[_0xd37e('0x4c')]=function(_0xb704d6,_0x366bc9){if(_0xb704d6[_0xd37e('0x4b')]['id']){delete _0xb704d6[_0xd37e('0x4b')]['id'];}return db[_0xd37e('0x2e')][_0xd37e('0x49')]({'where':{'id':_0xb704d6[_0xd37e('0x4d')]['id']}})[_0xd37e('0x29')](handleEntityNotFound(_0x366bc9,null))[_0xd37e('0x29')](saveUpdates(_0xb704d6['body'],null))[_0xd37e('0x29')](respondWithResult(_0x366bc9,null))[_0xd37e('0x4e')](handleError(_0x366bc9,null));};exports['destroy']=function(_0x5392a7,_0x4f9178){return db[_0xd37e('0x2e')][_0xd37e('0x49')]({'where':{'id':_0x5392a7['params']['id']}})[_0xd37e('0x29')](handleEntityNotFound(_0x4f9178,null))[_0xd37e('0x29')](removeEntity(_0x4f9178,null))[_0xd37e('0x4e')](handleError(_0x4f9178,null));};exports[_0xd37e('0x4f')]=function(_0x2954fd,_0x358d18){return db[_0xd37e('0x2e')][_0xd37e('0x4f')]()[_0xd37e('0x29')](respondWithResult(_0x358d18,null))[_0xd37e('0x4e')](handleError(_0x358d18,null));}; \ No newline at end of file +var _0x8a28=['type','query','keys','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','VIRTUAL','includeAll','rows','show','params','include','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','MailSubstatus','rawAttributes'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8a28,0xe7));var _0x88a2=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x8a28[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require(_0x88a2('0x0'));var rimraf=require(_0x88a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88a2('0x2'));var rp=require(_0x88a2('0x3'));var moment=require('moment');var BPromise=require(_0x88a2('0x4'));var Mustache=require('mustache');var util=require(_0x88a2('0x5'));var path=require('path');var sox=require(_0x88a2('0x6'));var csv=require(_0x88a2('0x7'));var ejs=require(_0x88a2('0x8'));var fs=require('fs');var fs_extra=require(_0x88a2('0x9'));var _=require(_0x88a2('0xa'));var squel=require(_0x88a2('0xb'));var crypto=require(_0x88a2('0xc'));var jsforce=require(_0x88a2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x88a2('0x7'));var querystring=require(_0x88a2('0xe'));var Papa=require(_0x88a2('0xf'));var Redis=require(_0x88a2('0x10'));var authService=require(_0x88a2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x88a2('0x12'));var hardwareService=require(_0x88a2('0x13'));var logger=require('../../config/logger')(_0x88a2('0x14'));var utils=require(_0x88a2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x88a2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48715f,_0x33daf3){_0x33daf3=_0x33daf3||0xcc;return function(_0x4664b5){if(_0x4664b5){return _0x48715f[_0x88a2('0x17')](_0x33daf3);}return _0x48715f['status'](_0x33daf3)[_0x88a2('0x18')]();};}function respondWithResult(_0x650cf3,_0x5efecb){_0x5efecb=_0x5efecb||0xc8;return function(_0x26d42d){if(_0x26d42d){return _0x650cf3[_0x88a2('0x19')](_0x5efecb)[_0x88a2('0x1a')](_0x26d42d);}};}function respondWithFilteredResult(_0x1ca3fd,_0x59b860){return function(_0x127744){if(_0x127744){var _0x53bef4=typeof _0x59b860['offset']==='undefined'&&typeof _0x59b860[_0x88a2('0x1b')]==='undefined';var _0x530588=_0x127744[_0x88a2('0x1c')];var _0x3d5dae=_0x53bef4?0x0:_0x59b860[_0x88a2('0x1d')];var _0x437ce5=_0x53bef4?_0x127744[_0x88a2('0x1c')]:_0x59b860['offset']+_0x59b860[_0x88a2('0x1b')];var _0x7ee5ec;if(_0x437ce5>=_0x530588){_0x437ce5=_0x530588;_0x7ee5ec=0xc8;}else{_0x7ee5ec=0xce;}_0x1ca3fd[_0x88a2('0x19')](_0x7ee5ec);return _0x1ca3fd[_0x88a2('0x1e')](_0x88a2('0x1f'),_0x3d5dae+'-'+_0x437ce5+'/'+_0x530588)[_0x88a2('0x1a')](_0x127744);}return null;};}function patchUpdates(_0x3403ab){return function(_0x5b88bf){try{jsonpatch[_0x88a2('0x20')](_0x5b88bf,_0x3403ab,!![]);}catch(_0x2a5d27){return BPromise[_0x88a2('0x21')](_0x2a5d27);}return _0x5b88bf[_0x88a2('0x22')]();};}function saveUpdates(_0x488bc8,_0x36fbdf){return function(_0x43ee56){if(_0x43ee56){return _0x43ee56[_0x88a2('0x23')](_0x488bc8)[_0x88a2('0x24')](function(_0x4d98c9){return _0x4d98c9;});}return null;};}function removeEntity(_0x192a67,_0x2e7abf){return function(_0x57c10c){if(_0x57c10c){return _0x57c10c[_0x88a2('0x25')]()['then'](function(){_0x192a67[_0x88a2('0x19')](0xcc)[_0x88a2('0x18')]();});}};}function handleEntityNotFound(_0x20702f,_0x4660b1){return function(_0x3a3ea1){if(!_0x3a3ea1){_0x20702f['sendStatus'](0x194);}return _0x3a3ea1;};}function handleError(_0x4e5b43,_0x3eecf2){_0x3eecf2=_0x3eecf2||0x1f4;return function(_0x3d7e4d){logger[_0x88a2('0x26')](_0x3d7e4d['stack']);if(_0x3d7e4d[_0x88a2('0x27')]){delete _0x3d7e4d['name'];}_0x4e5b43[_0x88a2('0x19')](_0x3eecf2)[_0x88a2('0x28')](_0x3d7e4d);};}exports[_0x88a2('0x29')]=function(_0xf9f4c5,_0x32c9b3){var _0x2ca93b={},_0x52dc58={},_0x22f071={'count':0x0,'rows':[]};var _0x4e28fb=_[_0x88a2('0x2a')](db[_0x88a2('0x2b')][_0x88a2('0x2c')],function(_0x172ee1){return{'name':_0x172ee1['fieldName'],'type':_0x172ee1[_0x88a2('0x2d')]['key']};});_0x52dc58['model']=_[_0x88a2('0x2a')](_0x4e28fb,_0x88a2('0x27'));_0x52dc58[_0x88a2('0x2e')]=_[_0x88a2('0x2f')](_0xf9f4c5[_0x88a2('0x2e')]);_0x52dc58[_0x88a2('0x30')]=_[_0x88a2('0x31')](_0x52dc58[_0x88a2('0x32')],_0x52dc58[_0x88a2('0x2e')]);_0x2ca93b[_0x88a2('0x33')]=_[_0x88a2('0x31')](_0x52dc58[_0x88a2('0x32')],qs[_0x88a2('0x34')](_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x34')]));_0x2ca93b['attributes']=_0x2ca93b['attributes'][_0x88a2('0x35')]?_0x2ca93b[_0x88a2('0x33')]:_0x52dc58['model'];if(!_0xf9f4c5[_0x88a2('0x2e')]['hasOwnProperty']('nolimit')){_0x2ca93b[_0x88a2('0x1b')]=qs[_0x88a2('0x1b')](_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x1b')]);_0x2ca93b[_0x88a2('0x1d')]=qs[_0x88a2('0x1d')](_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x1d')]);}_0x2ca93b['order']=qs[_0x88a2('0x36')](_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x36')]);_0x2ca93b[_0x88a2('0x37')]=qs[_0x88a2('0x30')](_['pick'](_0xf9f4c5[_0x88a2('0x2e')],_0x52dc58['filters']),_0x4e28fb);if(_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x38')]){_0x2ca93b[_0x88a2('0x37')]=_[_0x88a2('0x39')](_0x2ca93b[_0x88a2('0x37')],{'$or':_[_0x88a2('0x2a')](_0x4e28fb,function(_0x9267b1){if(_0x9267b1[_0x88a2('0x2d')]!==_0x88a2('0x3a')){var _0x3fe10c={};_0x3fe10c[_0x9267b1[_0x88a2('0x27')]]={'$like':'%'+_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x38')]+'%'};return _0x3fe10c;}})});}_0x2ca93b=_[_0x88a2('0x39')]({},_0x2ca93b,_0xf9f4c5['options']);var _0x7d92fa={'where':_0x2ca93b[_0x88a2('0x37')]};return db[_0x88a2('0x2b')][_0x88a2('0x1c')](_0x7d92fa)[_0x88a2('0x24')](function(_0xfdb7e2){_0x22f071['count']=_0xfdb7e2;if(_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x3b')]){_0x2ca93b['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x2ca93b);})[_0x88a2('0x24')](function(_0x5f2587){_0x22f071[_0x88a2('0x3c')]=_0x5f2587;return _0x22f071;})[_0x88a2('0x24')](respondWithFilteredResult(_0x32c9b3,_0x2ca93b))['catch'](handleError(_0x32c9b3,null));};exports[_0x88a2('0x3d')]=function(_0x24de4d,_0x2258bb){var _0x1add4a={'raw':!![],'where':{'id':_0x24de4d[_0x88a2('0x3e')]['id']}},_0x526a13={};_0x526a13[_0x88a2('0x32')]=_[_0x88a2('0x2f')](db[_0x88a2('0x2b')][_0x88a2('0x2c')]);_0x526a13[_0x88a2('0x2e')]=_[_0x88a2('0x2f')](_0x24de4d['query']);_0x526a13[_0x88a2('0x30')]=_[_0x88a2('0x31')](_0x526a13[_0x88a2('0x32')],_0x526a13[_0x88a2('0x2e')]);_0x1add4a[_0x88a2('0x33')]=_[_0x88a2('0x31')](_0x526a13['model'],qs[_0x88a2('0x34')](_0x24de4d[_0x88a2('0x2e')][_0x88a2('0x34')]));_0x1add4a[_0x88a2('0x33')]=_0x1add4a[_0x88a2('0x33')][_0x88a2('0x35')]?_0x1add4a[_0x88a2('0x33')]:_0x526a13[_0x88a2('0x32')];if(_0x24de4d[_0x88a2('0x2e')][_0x88a2('0x3b')]){_0x1add4a[_0x88a2('0x3f')]=[{'all':!![]}];}_0x1add4a=_['merge']({},_0x1add4a,_0x24de4d['options']);return db[_0x88a2('0x2b')]['find'](_0x1add4a)[_0x88a2('0x24')](handleEntityNotFound(_0x2258bb,null))[_0x88a2('0x24')](respondWithResult(_0x2258bb,null))[_0x88a2('0x40')](handleError(_0x2258bb,null));};exports[_0x88a2('0x41')]=function(_0x5616e6,_0x8cb91c){return db[_0x88a2('0x2b')]['create'](_0x5616e6[_0x88a2('0x42')],{})[_0x88a2('0x24')](respondWithResult(_0x8cb91c,0xc9))[_0x88a2('0x40')](handleError(_0x8cb91c,null));};exports['update']=function(_0xb3853b,_0x288ba1){if(_0xb3853b['body']['id']){delete _0xb3853b['body']['id'];}return db['MailSubstatus'][_0x88a2('0x43')]({'where':{'id':_0xb3853b[_0x88a2('0x3e')]['id']}})[_0x88a2('0x24')](handleEntityNotFound(_0x288ba1,null))[_0x88a2('0x24')](saveUpdates(_0xb3853b[_0x88a2('0x42')],null))['then'](respondWithResult(_0x288ba1,null))[_0x88a2('0x40')](handleError(_0x288ba1,null));};exports[_0x88a2('0x25')]=function(_0x5f32d5,_0x5adfee){return db['MailSubstatus'][_0x88a2('0x43')]({'where':{'id':_0x5f32d5['params']['id']}})[_0x88a2('0x24')](handleEntityNotFound(_0x5adfee,null))['then'](removeEntity(_0x5adfee,null))[_0x88a2('0x40')](handleError(_0x5adfee,null));};exports[_0x88a2('0x44')]=function(_0x17a9fe,_0x557e50){return db[_0x88a2('0x2b')][_0x88a2('0x44')]()['then'](respondWithResult(_0x557e50,null))[_0x88a2('0x40')](handleError(_0x557e50,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ad5dd02..59a4728 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 _0xa28c=['emit','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa28c,0x18b));var _0xca28=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xa28c[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0xca28('0x0'));var MailSubstatus=require(_0xca28('0x1'))['db'][_0xca28('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xca28('0x3')](0x0);var events={'afterUpdate':_0xca28('0x4')};function emitEvent(_0x3abb91){return function(_0x11da0e,_0x515f8f,_0x96086c){MailSubstatusEvents['emit'](_0x3abb91+':'+_0x11da0e['id'],_0x11da0e);MailSubstatusEvents[_0xca28('0x5')](_0x3abb91,_0x11da0e);_0x96086c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xca28('0x6')](e,emitEvent(event));}}module[_0xca28('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xb4a8=['events','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0xb4a8,0x1ab));var _0x8b4a=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0xb4a8[_0x211fef];return _0x5447bf;};'use strict';var EventEmitter=require(_0x8b4a('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8b4a('0x1')](0x0);var events={'afterUpdate':_0x8b4a('0x2')};function emitEvent(_0x589a55){return function(_0x150e5e,_0x23ac8f,_0x5e38d0){MailSubstatusEvents[_0x8b4a('0x3')](_0x589a55+':'+_0x150e5e['id'],_0x150e5e);MailSubstatusEvents[_0x8b4a('0x3')](_0x589a55,_0x150e5e);_0x5e38d0(null);};}for(var e in events){if(events[_0x8b4a('0x4')](e)){var event=events[e];MailSubstatus[_0x8b4a('0x5')](e,emitEvent(event));}}module[_0x8b4a('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index bff43ee..e2bea90 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 _0x8b56=['update','name','mailSubstatus','then','catch','exports','models','define','MailSubstatus','mail_substatuses'];(function(_0x580907,_0xbde208){var _0x50ab75=function(_0xfdc075){while(--_0xfdc075){_0x580907['push'](_0x580907['shift']());}};_0x50ab75(++_0xbde208);}(_0x8b56,0x127));var _0x68b5=function(_0x5d20ec,_0x2dbfb0){_0x5d20ec=_0x5d20ec-0x0;var _0x96d947=_0x8b56[_0x5d20ec];return _0x96d947;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x68b5('0x0')]=function(_0x368292){var _0x4dfa42=_0x368292[_0x68b5('0x1')];return _0x368292[_0x68b5('0x2')](_0x68b5('0x3'),attributes,{'tableName':_0x68b5('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x231017,_0x340a1f,_0x3ef515){return _0x4dfa42['Condition'][_0x68b5('0x5')]({'value':_0x231017[_0x68b5('0x6')]},{'where':{'field':_0x68b5('0x7'),'value':_0x231017['_previousDataValues'][_0x68b5('0x6')]}})[_0x68b5('0x8')](function(){_0x3ef515();})[_0x68b5('0x9')](function(_0xe844bb){_0x3ef515(_0xe844bb);});}}});}; \ No newline at end of file +var _0xab86=['MailSubstatus','Condition','update','name','_previousDataValues','catch','exports','define'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xab86,0xce));var _0x6ab8=function(_0x1a93a5,_0x13f256){_0x1a93a5=_0x1a93a5-0x0;var _0x4893a2=_0xab86[_0x1a93a5];return _0x4893a2;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x6ab8('0x0')]=function(_0x58cfab){var _0x3267a3=_0x58cfab['models'];return _0x58cfab[_0x6ab8('0x1')](_0x6ab8('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xbcdb96,_0x4e805a,_0x2b55b4){return _0x3267a3[_0x6ab8('0x3')][_0x6ab8('0x4')]({'value':_0xbcdb96[_0x6ab8('0x5')]},{'where':{'field':'mailSubstatus','value':_0xbcdb96[_0x6ab8('0x6')][_0x6ab8('0x5')]}})['then'](function(){_0x2b55b4();})[_0x6ab8('0x7')](function(_0x4256d2){_0x2b55b4(_0x4256d2);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a56e478..eb68f0a 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 _0xdf97=['request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailSubstatus,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf97,0x11d));var _0x7df9=function(_0x144352,_0x239a85){_0x144352=_0x144352-0x0;var _0x553511=_0xdf97[_0x144352];return _0x553511;};'use strict';var _=require('lodash');var util=require(_0x7df9('0x0'));var moment=require(_0x7df9('0x1'));var BPromise=require(_0x7df9('0x2'));var rs=require(_0x7df9('0x3'));var fs=require('fs');var Redis=require(_0x7df9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7df9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7df9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7df9('0x7')][_0x7df9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59c4fa,_0x37fe1f,_0x3fc5b4){return new BPromise(function(_0xcba2a7,_0x37990f){return client[_0x7df9('0x9')](_0x59c4fa,_0x3fc5b4)[_0x7df9('0xa')](function(_0x35e3eb){logger[_0x7df9('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x37fe1f,'request\x20sent');logger[_0x7df9('0xc')](_0x7df9('0xd'),_0x37fe1f,_0x7df9('0xe'),JSON[_0x7df9('0xf')](_0x35e3eb));if(_0x35e3eb['error']){if(_0x35e3eb[_0x7df9('0x10')]['code']===0x1f4){logger[_0x7df9('0x10')](_0x7df9('0x11'),_0x37fe1f,_0x35e3eb[_0x7df9('0x10')]['message']);return _0x37990f(_0x35e3eb['error'][_0x7df9('0x12')]);}logger['error'](_0x7df9('0x11'),_0x37fe1f,_0x35e3eb['error'][_0x7df9('0x12')]);return _0xcba2a7(_0x35e3eb[_0x7df9('0x10')][_0x7df9('0x12')]);}else{logger['info'](_0x7df9('0x11'),_0x37fe1f,_0x7df9('0xe'));_0xcba2a7(_0x35e3eb[_0x7df9('0x13')]['message']);}})[_0x7df9('0x14')](function(_0x2467ba){logger[_0x7df9('0x10')](_0x7df9('0x11'),_0x37fe1f,_0x2467ba);_0x37990f(_0x2467ba);});});} \ No newline at end of file +var _0x0c5b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailSubstatus,\x20%s,\x20%s,\x20%s','error','MailSubstatus,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util'];(function(_0x1ca090,_0x1890ba){var _0x495cbb=function(_0x533836){while(--_0x533836){_0x1ca090['push'](_0x1ca090['shift']());}};_0x495cbb(++_0x1890ba);}(_0x0c5b,0x9e));var _0xb0c5=function(_0x545c58,_0x3bff18){_0x545c58=_0x545c58-0x0;var _0xe42d93=_0x0c5b[_0x545c58];return _0xe42d93;};'use strict';var _=require(_0xb0c5('0x0'));var util=require(_0xb0c5('0x1'));var moment=require('moment');var BPromise=require(_0xb0c5('0x2'));var rs=require(_0xb0c5('0x3'));var fs=require('fs');var Redis=require(_0xb0c5('0x4'));var db=require(_0xb0c5('0x5'))['db'];var utils=require(_0xb0c5('0x6'));var logger=require(_0xb0c5('0x7'))(_0xb0c5('0x8'));var config=require(_0xb0c5('0x9'));var jayson=require(_0xb0c5('0xa'));var client=jayson[_0xb0c5('0xb')][_0xb0c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c35cc,_0x3011e1,_0x5c4fab){return new BPromise(function(_0x3ce140,_0x31e18a){return client['request'](_0x1c35cc,_0x5c4fab)['then'](function(_0x22e340){logger[_0xb0c5('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x3011e1,'request\x20sent');logger['debug'](_0xb0c5('0xe'),_0x3011e1,'request\x20sent',JSON['stringify'](_0x22e340));if(_0x22e340['error']){if(_0x22e340[_0xb0c5('0xf')]['code']===0x1f4){logger['error'](_0xb0c5('0x10'),_0x3011e1,_0x22e340[_0xb0c5('0xf')][_0xb0c5('0x11')]);return _0x31e18a(_0x22e340[_0xb0c5('0xf')][_0xb0c5('0x11')]);}logger[_0xb0c5('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x3011e1,_0x22e340[_0xb0c5('0xf')][_0xb0c5('0x11')]);return _0x3ce140(_0x22e340[_0xb0c5('0xf')][_0xb0c5('0x11')]);}else{logger[_0xb0c5('0xd')](_0xb0c5('0x10'),_0x3011e1,_0xb0c5('0x12'));_0x3ce140(_0x22e340['result'][_0xb0c5('0x11')]);}})[_0xb0c5('0x13')](function(_0x16cae6){logger[_0xb0c5('0xf')](_0xb0c5('0x10'),_0x3011e1,_0x16cae6);_0x31e18a(_0x16cae6);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c378179..ff088a1 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 _0x4143=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x7172da,_0x140d33){var _0x2819d=function(_0x2cdd6b){while(--_0x2cdd6b){_0x7172da['push'](_0x7172da['shift']());}};_0x2819d(++_0x140d33);}(_0x4143,0x97));var _0x3414=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x4143[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x3414('0x0'));var util=require(_0x3414('0x1'));var path=require(_0x3414('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3414('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3414('0x4'));var interaction=require(_0x3414('0x5'));var config=require(_0x3414('0x6'));var controller=require(_0x3414('0x7'));router[_0x3414('0x8')]('/',auth[_0x3414('0x9')](),controller[_0x3414('0xa')]);router[_0x3414('0x8')](_0x3414('0xb'),auth[_0x3414('0x9')](),controller[_0x3414('0xc')]);router[_0x3414('0x8')](_0x3414('0xd'),auth['isAuthenticated'](),controller[_0x3414('0xe')]);router[_0x3414('0xf')]('/',auth[_0x3414('0x9')](),controller[_0x3414('0x10')]);router[_0x3414('0x11')]('/:id',auth[_0x3414('0x9')](),controller[_0x3414('0x12')]);router[_0x3414('0x13')](_0x3414('0xd'),auth[_0x3414('0x9')](),controller[_0x3414('0x14')]);module[_0x3414('0x15')]=router; \ No newline at end of file +var _0xbf4d=['get','isAuthenticated','/describe','describe','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf4d,0x1d9));var _0xdbf4=function(_0x22a1e0,_0x279d8b){_0x22a1e0=_0x22a1e0-0x0;var _0x5d0dc7=_0xbf4d[_0x22a1e0];return _0x5d0dc7;};'use strict';var multer=require(_0xdbf4('0x0'));var util=require(_0xdbf4('0x1'));var path=require(_0xdbf4('0x2'));var timeout=require(_0xdbf4('0x3'));var express=require(_0xdbf4('0x4'));var router=express['Router']();var fs_extra=require(_0xdbf4('0x5'));var auth=require(_0xdbf4('0x6'));var interaction=require(_0xdbf4('0x7'));var config=require(_0xdbf4('0x8'));var controller=require(_0xdbf4('0x9'));router[_0xdbf4('0xa')]('/',auth[_0xdbf4('0xb')](),controller['index']);router[_0xdbf4('0xa')](_0xdbf4('0xc'),auth[_0xdbf4('0xb')](),controller[_0xdbf4('0xd')]);router[_0xdbf4('0xa')]('/:id',auth[_0xdbf4('0xb')](),controller['show']);router[_0xdbf4('0xe')]('/',auth[_0xdbf4('0xb')](),controller[_0xdbf4('0xf')]);router[_0xdbf4('0x10')](_0xdbf4('0x11'),auth[_0xdbf4('0xb')](),controller[_0xdbf4('0x12')]);router['delete'](_0xdbf4('0x11'),auth[_0xdbf4('0xb')](),controller[_0xdbf4('0x13')]);module[_0xdbf4('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index bdd2429..07fb770 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x27d001,_0x2969ac){var _0x52380e=function(_0x2ae8f4){while(--_0x2ae8f4){_0x27d001['push'](_0x27d001['shift']());}};_0x52380e(++_0x2969ac);}(_0xaa88,0x137));var _0x8aa8=function(_0x50e0b4,_0x1057f7){_0x50e0b4=_0x50e0b4-0x0;var _0x2fa8b0=_0xaa88[_0x50e0b4];return _0x2fa8b0;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x468c76,_0x32065b){var _0x4d991d=function(_0x26b413){while(--_0x26b413){_0x468c76['push'](_0x468c76['shift']());}};_0x4d991d(++_0x32065b);}(_0xaa88,0x137));var _0x8aa8=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xaa88[_0x30cc1a];return _0xb3f18f;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 59f928a..9d83dec 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 _0x8f30=['destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailTransferReport','includeAll','include','rows','show','params','keys','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','count','reject','update','then'];(function(_0x2e9f19,_0x5db93b){var _0xb80fdf=function(_0x144658){while(--_0x144658){_0x2e9f19['push'](_0x2e9f19['shift']());}};_0xb80fdf(++_0x5db93b);}(_0x8f30,0x109));var _0x08f3=function(_0x3adf27,_0x2942e7){_0x3adf27=_0x3adf27-0x0;var _0x5bd490=_0x8f30[_0x3adf27];return _0x5bd490;};'use strict';var emlformat=require(_0x08f3('0x0'));var rimraf=require(_0x08f3('0x1'));var zipdir=require(_0x08f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08f3('0x3'));var moment=require(_0x08f3('0x4'));var BPromise=require(_0x08f3('0x5'));var Mustache=require(_0x08f3('0x6'));var util=require(_0x08f3('0x7'));var path=require(_0x08f3('0x8'));var sox=require(_0x08f3('0x9'));var csv=require(_0x08f3('0xa'));var ejs=require(_0x08f3('0xb'));var fs=require('fs');var fs_extra=require(_0x08f3('0xc'));var _=require(_0x08f3('0xd'));var squel=require(_0x08f3('0xe'));var crypto=require(_0x08f3('0xf'));var jsforce=require(_0x08f3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x08f3('0xa'));var querystring=require(_0x08f3('0x11'));var Papa=require(_0x08f3('0x12'));var Redis=require('ioredis');var authService=require(_0x08f3('0x13'));var qs=require(_0x08f3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08f3('0x15'));var logger=require(_0x08f3('0x16'))(_0x08f3('0x17'));var utils=require(_0x08f3('0x18'));var config=require(_0x08f3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x08f3('0x1a'))['db'];function respondWithStatusCode(_0x135ce7,_0x1a89e8){_0x1a89e8=_0x1a89e8||0xcc;return function(_0xfaaf28){if(_0xfaaf28){return _0x135ce7['sendStatus'](_0x1a89e8);}return _0x135ce7[_0x08f3('0x1b')](_0x1a89e8)['end']();};}function respondWithResult(_0x1c3aac,_0xd2ee1d){_0xd2ee1d=_0xd2ee1d||0xc8;return function(_0x242cf6){if(_0x242cf6){return _0x1c3aac[_0x08f3('0x1b')](_0xd2ee1d)[_0x08f3('0x1c')](_0x242cf6);}};}function respondWithFilteredResult(_0x2e5d4e,_0x5e0e0e){return function(_0x3f8dab){if(_0x3f8dab){var _0x2d8d4c=typeof _0x5e0e0e[_0x08f3('0x1d')]==='undefined'&&typeof _0x5e0e0e[_0x08f3('0x1e')]==='undefined';var _0x199031=_0x3f8dab[_0x08f3('0x1f')];var _0x3d35bb=_0x2d8d4c?0x0:_0x5e0e0e[_0x08f3('0x1d')];var _0x2459a2=_0x2d8d4c?_0x3f8dab[_0x08f3('0x1f')]:_0x5e0e0e[_0x08f3('0x1d')]+_0x5e0e0e['limit'];var _0x4c6812;if(_0x2459a2>=_0x199031){_0x2459a2=_0x199031;_0x4c6812=0xc8;}else{_0x4c6812=0xce;}_0x2e5d4e['status'](_0x4c6812);return _0x2e5d4e['set']('Content-Range',_0x3d35bb+'-'+_0x2459a2+'/'+_0x199031)[_0x08f3('0x1c')](_0x3f8dab);}return null;};}function patchUpdates(_0x12faa9){return function(_0x622917){try{jsonpatch['apply'](_0x622917,_0x12faa9,!![]);}catch(_0x4a1ad2){return BPromise[_0x08f3('0x20')](_0x4a1ad2);}return _0x622917['save']();};}function saveUpdates(_0xcd425e,_0xc5d26d){return function(_0x15448c){if(_0x15448c){return _0x15448c[_0x08f3('0x21')](_0xcd425e)[_0x08f3('0x22')](function(_0x57dbeb){return _0x57dbeb;});}return null;};}function removeEntity(_0x1a2f00,_0x4dc708){return function(_0x175c0f){if(_0x175c0f){return _0x175c0f[_0x08f3('0x23')]()[_0x08f3('0x22')](function(){_0x1a2f00[_0x08f3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x77dc70,_0x34b6be){return function(_0x34b1f0){if(!_0x34b1f0){_0x77dc70[_0x08f3('0x24')](0x194);}return _0x34b1f0;};}function handleError(_0x3e5bf3,_0x414043){_0x414043=_0x414043||0x1f4;return function(_0x4569fa){logger[_0x08f3('0x25')](_0x4569fa[_0x08f3('0x26')]);if(_0x4569fa[_0x08f3('0x27')]){delete _0x4569fa[_0x08f3('0x27')];}_0x3e5bf3[_0x08f3('0x1b')](_0x414043)[_0x08f3('0x28')](_0x4569fa);};}exports[_0x08f3('0x29')]=function(_0x580f1c,_0x3705ec){var _0x25d4a0={},_0x219e0d={},_0x4494ff={'count':0x0,'rows':[]};var _0x4fbe01=_[_0x08f3('0x2a')](db['MailTransferReport'][_0x08f3('0x2b')],function(_0x3fc2dd){return{'name':_0x3fc2dd[_0x08f3('0x2c')],'type':_0x3fc2dd[_0x08f3('0x2d')][_0x08f3('0x2e')]};});_0x219e0d[_0x08f3('0x2f')]=_[_0x08f3('0x2a')](_0x4fbe01,'name');_0x219e0d[_0x08f3('0x30')]=_['keys'](_0x580f1c[_0x08f3('0x30')]);_0x219e0d[_0x08f3('0x31')]=_['intersection'](_0x219e0d['model'],_0x219e0d[_0x08f3('0x30')]);_0x25d4a0['attributes']=_['intersection'](_0x219e0d['model'],qs['fields'](_0x580f1c[_0x08f3('0x30')][_0x08f3('0x32')]));_0x25d4a0[_0x08f3('0x33')]=_0x25d4a0[_0x08f3('0x33')][_0x08f3('0x34')]?_0x25d4a0[_0x08f3('0x33')]:_0x219e0d[_0x08f3('0x2f')];if(!_0x580f1c[_0x08f3('0x30')][_0x08f3('0x35')](_0x08f3('0x36'))){_0x25d4a0[_0x08f3('0x1e')]=qs['limit'](_0x580f1c['query'][_0x08f3('0x1e')]);_0x25d4a0[_0x08f3('0x1d')]=qs[_0x08f3('0x1d')](_0x580f1c['query'][_0x08f3('0x1d')]);}_0x25d4a0[_0x08f3('0x37')]=qs['sort'](_0x580f1c[_0x08f3('0x30')][_0x08f3('0x38')]);_0x25d4a0[_0x08f3('0x39')]=qs[_0x08f3('0x31')](_[_0x08f3('0x3a')](_0x580f1c[_0x08f3('0x30')],_0x219e0d[_0x08f3('0x31')]),_0x4fbe01);if(_0x580f1c[_0x08f3('0x30')][_0x08f3('0x3b')]){_0x25d4a0[_0x08f3('0x39')]=_[_0x08f3('0x3c')](_0x25d4a0[_0x08f3('0x39')],{'$or':_['map'](_0x4fbe01,function(_0x39235f){if(_0x39235f[_0x08f3('0x2d')]!==_0x08f3('0x3d')){var _0x4985d0={};_0x4985d0[_0x39235f[_0x08f3('0x27')]]={'$like':'%'+_0x580f1c[_0x08f3('0x30')][_0x08f3('0x3b')]+'%'};return _0x4985d0;}})});}_0x25d4a0=_[_0x08f3('0x3c')]({},_0x25d4a0,_0x580f1c['options']);var _0x13a098={'where':_0x25d4a0[_0x08f3('0x39')]};return db[_0x08f3('0x3e')]['count'](_0x13a098)[_0x08f3('0x22')](function(_0x111717){_0x4494ff['count']=_0x111717;if(_0x580f1c[_0x08f3('0x30')][_0x08f3('0x3f')]){_0x25d4a0[_0x08f3('0x40')]=[{'all':!![]}];}return db[_0x08f3('0x3e')]['findAll'](_0x25d4a0);})[_0x08f3('0x22')](function(_0x5209e5){_0x4494ff[_0x08f3('0x41')]=_0x5209e5;return _0x4494ff;})['then'](respondWithFilteredResult(_0x3705ec,_0x25d4a0))['catch'](handleError(_0x3705ec,null));};exports[_0x08f3('0x42')]=function(_0xaf67d3,_0x30adc7){var _0x39ef62={'raw':!![],'where':{'id':_0xaf67d3[_0x08f3('0x43')]['id']}},_0x4dca33={};_0x4dca33[_0x08f3('0x2f')]=_[_0x08f3('0x44')](db[_0x08f3('0x3e')][_0x08f3('0x2b')]);_0x4dca33[_0x08f3('0x30')]=_[_0x08f3('0x44')](_0xaf67d3[_0x08f3('0x30')]);_0x4dca33['filters']=_['intersection'](_0x4dca33[_0x08f3('0x2f')],_0x4dca33[_0x08f3('0x30')]);_0x39ef62['attributes']=_['intersection'](_0x4dca33[_0x08f3('0x2f')],qs[_0x08f3('0x32')](_0xaf67d3[_0x08f3('0x30')][_0x08f3('0x32')]));_0x39ef62[_0x08f3('0x33')]=_0x39ef62[_0x08f3('0x33')]['length']?_0x39ef62['attributes']:_0x4dca33['model'];if(_0xaf67d3[_0x08f3('0x30')][_0x08f3('0x3f')]){_0x39ef62[_0x08f3('0x40')]=[{'all':!![]}];}_0x39ef62=_[_0x08f3('0x3c')]({},_0x39ef62,_0xaf67d3[_0x08f3('0x45')]);return db[_0x08f3('0x3e')][_0x08f3('0x46')](_0x39ef62)['then'](handleEntityNotFound(_0x30adc7,null))[_0x08f3('0x22')](respondWithResult(_0x30adc7,null))['catch'](handleError(_0x30adc7,null));};exports[_0x08f3('0x47')]=function(_0x3cb2f6,_0x1bf13f){return db[_0x08f3('0x3e')][_0x08f3('0x47')](_0x3cb2f6[_0x08f3('0x48')],{})[_0x08f3('0x22')](respondWithResult(_0x1bf13f,0xc9))[_0x08f3('0x49')](handleError(_0x1bf13f,null));};exports[_0x08f3('0x21')]=function(_0x3a930a,_0x4ec77f){if(_0x3a930a[_0x08f3('0x48')]['id']){delete _0x3a930a[_0x08f3('0x48')]['id'];}return db[_0x08f3('0x3e')][_0x08f3('0x46')]({'where':{'id':_0x3a930a[_0x08f3('0x43')]['id']}})[_0x08f3('0x22')](handleEntityNotFound(_0x4ec77f,null))[_0x08f3('0x22')](saveUpdates(_0x3a930a[_0x08f3('0x48')],null))['then'](respondWithResult(_0x4ec77f,null))[_0x08f3('0x49')](handleError(_0x4ec77f,null));};exports['destroy']=function(_0x190489,_0x18e8cb){return db[_0x08f3('0x3e')][_0x08f3('0x46')]({'where':{'id':_0x190489[_0x08f3('0x43')]['id']}})[_0x08f3('0x22')](handleEntityNotFound(_0x18e8cb,null))['then'](removeEntity(_0x18e8cb,null))[_0x08f3('0x49')](handleError(_0x18e8cb,null));};exports['describe']=function(_0x49badf,_0x300cf3){return db[_0x08f3('0x3e')][_0x08f3('0x4a')]()['then'](respondWithResult(_0x300cf3,null))['catch'](handleError(_0x300cf3,null));}; \ No newline at end of file +var _0x7a3b=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','map','MailTransferReport'];(function(_0x19e39c,_0x1e2c7e){var _0xce0070=function(_0xe47a84){while(--_0xe47a84){_0x19e39c['push'](_0x19e39c['shift']());}};_0xce0070(++_0x1e2c7e);}(_0x7a3b,0x18f));var _0xb7a3=function(_0x201d73,_0x531e70){_0x201d73=_0x201d73-0x0;var _0x2e93b0=_0x7a3b[_0x201d73];return _0x2e93b0;};'use strict';var emlformat=require(_0xb7a3('0x0'));var rimraf=require(_0xb7a3('0x1'));var zipdir=require(_0xb7a3('0x2'));var jsonpatch=require(_0xb7a3('0x3'));var rp=require(_0xb7a3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb7a3('0x5'));var util=require(_0xb7a3('0x6'));var path=require(_0xb7a3('0x7'));var sox=require(_0xb7a3('0x8'));var csv=require('to-csv');var ejs=require(_0xb7a3('0x9'));var fs=require('fs');var fs_extra=require(_0xb7a3('0xa'));var _=require('lodash');var squel=require(_0xb7a3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb7a3('0xc'));var toCsv=require(_0xb7a3('0xd'));var querystring=require(_0xb7a3('0xe'));var Papa=require('papaparse');var Redis=require(_0xb7a3('0xf'));var authService=require(_0xb7a3('0x10'));var qs=require(_0xb7a3('0x11'));var as=require(_0xb7a3('0x12'));var hardwareService=require(_0xb7a3('0x13'));var logger=require('../../config/logger')(_0xb7a3('0x14'));var utils=require(_0xb7a3('0x15'));var config=require(_0xb7a3('0x16'));var licenseUtil=require(_0xb7a3('0x17'));var db=require(_0xb7a3('0x18'))['db'];function respondWithStatusCode(_0x5a31b5,_0xa21f38){_0xa21f38=_0xa21f38||0xcc;return function(_0x506bc5){if(_0x506bc5){return _0x5a31b5[_0xb7a3('0x19')](_0xa21f38);}return _0x5a31b5[_0xb7a3('0x1a')](_0xa21f38)['end']();};}function respondWithResult(_0x99ccce,_0x6176f){_0x6176f=_0x6176f||0xc8;return function(_0x34f023){if(_0x34f023){return _0x99ccce[_0xb7a3('0x1a')](_0x6176f)[_0xb7a3('0x1b')](_0x34f023);}};}function respondWithFilteredResult(_0x1c78dc,_0x58c709){return function(_0x4c0727){if(_0x4c0727){var _0x1af29e=typeof _0x58c709[_0xb7a3('0x1c')]===_0xb7a3('0x1d')&&typeof _0x58c709[_0xb7a3('0x1e')]===_0xb7a3('0x1d');var _0x26765a=_0x4c0727[_0xb7a3('0x1f')];var _0x3a8df0=_0x1af29e?0x0:_0x58c709[_0xb7a3('0x1c')];var _0x41779d=_0x1af29e?_0x4c0727['count']:_0x58c709['offset']+_0x58c709[_0xb7a3('0x1e')];var _0x4893c4;if(_0x41779d>=_0x26765a){_0x41779d=_0x26765a;_0x4893c4=0xc8;}else{_0x4893c4=0xce;}_0x1c78dc[_0xb7a3('0x1a')](_0x4893c4);return _0x1c78dc[_0xb7a3('0x20')](_0xb7a3('0x21'),_0x3a8df0+'-'+_0x41779d+'/'+_0x26765a)[_0xb7a3('0x1b')](_0x4c0727);}return null;};}function patchUpdates(_0x536201){return function(_0x4d8708){try{jsonpatch[_0xb7a3('0x22')](_0x4d8708,_0x536201,!![]);}catch(_0x17c4ae){return BPromise['reject'](_0x17c4ae);}return _0x4d8708[_0xb7a3('0x23')]();};}function saveUpdates(_0x5e1ffc,_0x1e4f44){return function(_0x3da09f){if(_0x3da09f){return _0x3da09f[_0xb7a3('0x24')](_0x5e1ffc)[_0xb7a3('0x25')](function(_0x5cf42d){return _0x5cf42d;});}return null;};}function removeEntity(_0x27b1da,_0x8b8b8){return function(_0x2c4c91){if(_0x2c4c91){return _0x2c4c91[_0xb7a3('0x26')]()['then'](function(){_0x27b1da[_0xb7a3('0x1a')](0xcc)[_0xb7a3('0x27')]();});}};}function handleEntityNotFound(_0x7de82,_0x532f7d){return function(_0x4d39e3){if(!_0x4d39e3){_0x7de82[_0xb7a3('0x19')](0x194);}return _0x4d39e3;};}function handleError(_0xae4c56,_0xf81ce2){_0xf81ce2=_0xf81ce2||0x1f4;return function(_0x5dcb33){logger[_0xb7a3('0x28')](_0x5dcb33['stack']);if(_0x5dcb33['name']){delete _0x5dcb33[_0xb7a3('0x29')];}_0xae4c56[_0xb7a3('0x1a')](_0xf81ce2)[_0xb7a3('0x2a')](_0x5dcb33);};}exports['index']=function(_0x4b1e67,_0x304262){var _0x3d5197={},_0x245364={},_0x6ebb8c={'count':0x0,'rows':[]};var _0x5891f3=_[_0xb7a3('0x2b')](db[_0xb7a3('0x2c')]['rawAttributes'],function(_0x204292){return{'name':_0x204292[_0xb7a3('0x2d')],'type':_0x204292[_0xb7a3('0x2e')][_0xb7a3('0x2f')]};});_0x245364[_0xb7a3('0x30')]=_[_0xb7a3('0x2b')](_0x5891f3,_0xb7a3('0x29'));_0x245364[_0xb7a3('0x31')]=_[_0xb7a3('0x32')](_0x4b1e67[_0xb7a3('0x31')]);_0x245364[_0xb7a3('0x33')]=_[_0xb7a3('0x34')](_0x245364[_0xb7a3('0x30')],_0x245364['query']);_0x3d5197['attributes']=_['intersection'](_0x245364[_0xb7a3('0x30')],qs[_0xb7a3('0x35')](_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x35')]));_0x3d5197[_0xb7a3('0x36')]=_0x3d5197[_0xb7a3('0x36')][_0xb7a3('0x37')]?_0x3d5197[_0xb7a3('0x36')]:_0x245364[_0xb7a3('0x30')];if(!_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x38')]('nolimit')){_0x3d5197['limit']=qs[_0xb7a3('0x1e')](_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x1e')]);_0x3d5197[_0xb7a3('0x1c')]=qs[_0xb7a3('0x1c')](_0x4b1e67['query'][_0xb7a3('0x1c')]);}_0x3d5197[_0xb7a3('0x39')]=qs[_0xb7a3('0x3a')](_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x3a')]);_0x3d5197[_0xb7a3('0x3b')]=qs['filters'](_[_0xb7a3('0x3c')](_0x4b1e67['query'],_0x245364[_0xb7a3('0x33')]),_0x5891f3);if(_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x3d')]){_0x3d5197[_0xb7a3('0x3b')]=_[_0xb7a3('0x3e')](_0x3d5197[_0xb7a3('0x3b')],{'$or':_['map'](_0x5891f3,function(_0x165452){if(_0x165452[_0xb7a3('0x2e')]!==_0xb7a3('0x3f')){var _0x49a6c3={};_0x49a6c3[_0x165452['name']]={'$like':'%'+_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x3d')]+'%'};return _0x49a6c3;}})});}_0x3d5197=_['merge']({},_0x3d5197,_0x4b1e67[_0xb7a3('0x40')]);var _0x14ac7b={'where':_0x3d5197[_0xb7a3('0x3b')]};return db[_0xb7a3('0x2c')][_0xb7a3('0x1f')](_0x14ac7b)[_0xb7a3('0x25')](function(_0x51f68d){_0x6ebb8c['count']=_0x51f68d;if(_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x41')]){_0x3d5197['include']=[{'all':!![]}];}return db[_0xb7a3('0x2c')][_0xb7a3('0x42')](_0x3d5197);})[_0xb7a3('0x25')](function(_0x48d63f){_0x6ebb8c['rows']=_0x48d63f;return _0x6ebb8c;})[_0xb7a3('0x25')](respondWithFilteredResult(_0x304262,_0x3d5197))[_0xb7a3('0x43')](handleError(_0x304262,null));};exports['show']=function(_0x35de65,_0x1a476e){var _0x4a4db9={'raw':!![],'where':{'id':_0x35de65['params']['id']}},_0x67dcb3={};_0x67dcb3[_0xb7a3('0x30')]=_[_0xb7a3('0x32')](db['MailTransferReport'][_0xb7a3('0x44')]);_0x67dcb3[_0xb7a3('0x31')]=_[_0xb7a3('0x32')](_0x35de65[_0xb7a3('0x31')]);_0x67dcb3['filters']=_['intersection'](_0x67dcb3[_0xb7a3('0x30')],_0x67dcb3[_0xb7a3('0x31')]);_0x4a4db9[_0xb7a3('0x36')]=_['intersection'](_0x67dcb3[_0xb7a3('0x30')],qs[_0xb7a3('0x35')](_0x35de65[_0xb7a3('0x31')][_0xb7a3('0x35')]));_0x4a4db9[_0xb7a3('0x36')]=_0x4a4db9[_0xb7a3('0x36')][_0xb7a3('0x37')]?_0x4a4db9[_0xb7a3('0x36')]:_0x67dcb3[_0xb7a3('0x30')];if(_0x35de65[_0xb7a3('0x31')][_0xb7a3('0x41')]){_0x4a4db9[_0xb7a3('0x45')]=[{'all':!![]}];}_0x4a4db9=_[_0xb7a3('0x3e')]({},_0x4a4db9,_0x35de65[_0xb7a3('0x40')]);return db[_0xb7a3('0x2c')]['find'](_0x4a4db9)[_0xb7a3('0x25')](handleEntityNotFound(_0x1a476e,null))[_0xb7a3('0x25')](respondWithResult(_0x1a476e,null))[_0xb7a3('0x43')](handleError(_0x1a476e,null));};exports[_0xb7a3('0x46')]=function(_0x54f30d,_0x2710bc){return db[_0xb7a3('0x2c')]['create'](_0x54f30d['body'],{})[_0xb7a3('0x25')](respondWithResult(_0x2710bc,0xc9))[_0xb7a3('0x43')](handleError(_0x2710bc,null));};exports['update']=function(_0x4d32b9,_0x5143f1){if(_0x4d32b9[_0xb7a3('0x47')]['id']){delete _0x4d32b9['body']['id'];}return db[_0xb7a3('0x2c')][_0xb7a3('0x48')]({'where':{'id':_0x4d32b9['params']['id']}})[_0xb7a3('0x25')](handleEntityNotFound(_0x5143f1,null))['then'](saveUpdates(_0x4d32b9[_0xb7a3('0x47')],null))[_0xb7a3('0x25')](respondWithResult(_0x5143f1,null))[_0xb7a3('0x43')](handleError(_0x5143f1,null));};exports[_0xb7a3('0x26')]=function(_0x2ba32e,_0x3b4e52){return db[_0xb7a3('0x2c')][_0xb7a3('0x48')]({'where':{'id':_0x2ba32e['params']['id']}})['then'](handleEntityNotFound(_0x3b4e52,null))[_0xb7a3('0x25')](removeEntity(_0x3b4e52,null))[_0xb7a3('0x43')](handleError(_0x3b4e52,null));};exports[_0xb7a3('0x49')]=function(_0x1e6a04,_0x4949a9){return db[_0xb7a3('0x2c')][_0xb7a3('0x49')]()[_0xb7a3('0x25')](respondWithResult(_0x4949a9,null))['catch'](handleError(_0x4949a9,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 7b4368f..11c2faf 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 _0x38fb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x1720f6,_0x5e9128){var _0x46e9fd=function(_0x4e3c53){while(--_0x4e3c53){_0x1720f6['push'](_0x1720f6['shift']());}};_0x46e9fd(++_0x5e9128);}(_0x38fb,0x1b0));var _0xb38f=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0x38fb[_0x40aaa4];return _0x4e21e5;};'use strict';var _=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var logger=require(_0xb38f('0x2'))(_0xb38f('0x3'));var moment=require(_0xb38f('0x4'));var BPromise=require(_0xb38f('0x5'));var rp=require(_0xb38f('0x6'));var fs=require('fs');var path=require(_0xb38f('0x7'));var rimraf=require(_0xb38f('0x8'));var config=require(_0xb38f('0x9'));var attributes=require(_0xb38f('0xa'));module[_0xb38f('0xb')]=function(_0x4674f7,_0x3ad4be){return _0x4674f7[_0xb38f('0xc')](_0xb38f('0xd'),attributes,{'tableName':_0xb38f('0xe'),'paranoid':![],'indexes':[{'name':_0xb38f('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xad68=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x76a371,_0x532f13){var _0x3284ae=function(_0x5d08d7){while(--_0x5d08d7){_0x76a371['push'](_0x76a371['shift']());}};_0x3284ae(++_0x532f13);}(_0xad68,0x102));var _0x8ad6=function(_0x590deb,_0x249ee5){_0x590deb=_0x590deb-0x0;var _0x1b0022=_0xad68[_0x590deb];return _0x1b0022;};'use strict';var _=require(_0x8ad6('0x0'));var util=require(_0x8ad6('0x1'));var logger=require(_0x8ad6('0x2'))(_0x8ad6('0x3'));var moment=require('moment');var BPromise=require(_0x8ad6('0x4'));var rp=require(_0x8ad6('0x5'));var fs=require('fs');var path=require(_0x8ad6('0x6'));var rimraf=require(_0x8ad6('0x7'));var config=require(_0x8ad6('0x8'));var attributes=require(_0x8ad6('0x9'));module[_0x8ad6('0xa')]=function(_0x4cc20e,_0x2ac999){return _0x4cc20e['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x8ad6('0xb'),'fields':[_0x8ad6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 80e1cc6..28bd561 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 _0x3e0f=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailTransferReport,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then'];(function(_0x71a2d1,_0x4eb572){var _0x28f76a=function(_0x3d80c9){while(--_0x3d80c9){_0x71a2d1['push'](_0x71a2d1['shift']());}};_0x28f76a(++_0x4eb572);}(_0x3e0f,0x113));var _0xf3e0=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x3e0f[_0x16db8b];return _0x5ba017;};'use strict';var _=require(_0xf3e0('0x0'));var util=require(_0xf3e0('0x1'));var moment=require('moment');var BPromise=require(_0xf3e0('0x2'));var rs=require(_0xf3e0('0x3'));var fs=require('fs');var Redis=require(_0xf3e0('0x4'));var db=require(_0xf3e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf3e0('0x6'));var config=require('../../config/environment');var jayson=require(_0xf3e0('0x7'));var client=jayson[_0xf3e0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd84009,_0x27d858,_0xbd8821){return new BPromise(function(_0xe0dad6,_0x2a488d){return client[_0xf3e0('0x9')](_0xd84009,_0xbd8821)[_0xf3e0('0xa')](function(_0x1d516d){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x27d858,_0xf3e0('0xb'));logger[_0xf3e0('0xc')](_0xf3e0('0xd'),_0x27d858,_0xf3e0('0xb'),JSON[_0xf3e0('0xe')](_0x1d516d));if(_0x1d516d['error']){if(_0x1d516d[_0xf3e0('0xf')][_0xf3e0('0x10')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x27d858,_0x1d516d[_0xf3e0('0xf')][_0xf3e0('0x11')]);return _0x2a488d(_0x1d516d['error'][_0xf3e0('0x11')]);}logger[_0xf3e0('0xf')](_0xf3e0('0x12'),_0x27d858,_0x1d516d[_0xf3e0('0xf')]['message']);return _0xe0dad6(_0x1d516d[_0xf3e0('0xf')]['message']);}else{logger[_0xf3e0('0x13')](_0xf3e0('0x12'),_0x27d858,_0xf3e0('0xb'));_0xe0dad6(_0x1d516d[_0xf3e0('0x14')][_0xf3e0('0x11')]);}})[_0xf3e0('0x15')](function(_0x14c539){logger[_0xf3e0('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x27d858,_0x14c539);_0x2a488d(_0x14c539);});});} \ No newline at end of file +var _0x1684=['message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c169a,_0x321e59){var _0x57394e=function(_0x228203){while(--_0x228203){_0x3c169a['push'](_0x3c169a['shift']());}};_0x57394e(++_0x321e59);}(_0x1684,0x1b1));var _0x4168=function(_0x5d487a,_0x5f5157){_0x5d487a=_0x5d487a-0x0;var _0x5c8087=_0x1684[_0x5d487a];return _0x5c8087;};'use strict';var _=require(_0x4168('0x0'));var util=require(_0x4168('0x1'));var moment=require(_0x4168('0x2'));var BPromise=require(_0x4168('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4168('0x4'))['db'];var utils=require(_0x4168('0x5'));var logger=require(_0x4168('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4168('0x7')][_0x4168('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2000bd,_0x182895,_0x59a0a0){return new BPromise(function(_0x19d62e,_0x521eb2){return client['request'](_0x2000bd,_0x59a0a0)['then'](function(_0xe52395){logger[_0x4168('0x9')](_0x4168('0xa'),_0x182895,_0x4168('0xb'));logger[_0x4168('0xc')](_0x4168('0xd'),_0x182895,_0x4168('0xb'),JSON[_0x4168('0xe')](_0xe52395));if(_0xe52395['error']){if(_0xe52395[_0x4168('0xf')][_0x4168('0x10')]===0x1f4){logger['error'](_0x4168('0xa'),_0x182895,_0xe52395['error'][_0x4168('0x11')]);return _0x521eb2(_0xe52395[_0x4168('0xf')][_0x4168('0x11')]);}logger[_0x4168('0xf')](_0x4168('0xa'),_0x182895,_0xe52395[_0x4168('0xf')]['message']);return _0x19d62e(_0xe52395[_0x4168('0xf')][_0x4168('0x11')]);}else{logger[_0x4168('0x9')](_0x4168('0xa'),_0x182895,_0x4168('0xb'));_0x19d62e(_0xe52395['result'][_0x4168('0x11')]);}})['catch'](function(_0x16dcbf){logger['error'](_0x4168('0xa'),_0x182895,_0x16dcbf);_0x521eb2(_0x16dcbf);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 003eed9..e9e7cc5 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 _0xe56e=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0x4436eb,_0x47c691){var _0x134f2c=function(_0x467eb4){while(--_0x467eb4){_0x4436eb['push'](_0x4436eb['shift']());}};_0x134f2c(++_0x47c691);}(_0xe56e,0x16b));var _0xee56=function(_0x1d72d0,_0x89db32){_0x1d72d0=_0x1d72d0-0x0;var _0x234ae9=_0xe56e[_0x1d72d0];return _0x234ae9;};'use strict';var multer=require(_0xee56('0x0'));var util=require(_0xee56('0x1'));var path=require(_0xee56('0x2'));var timeout=require(_0xee56('0x3'));var express=require(_0xee56('0x4'));var router=express['Router']();var fs_extra=require(_0xee56('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xee56('0x6'));var controller=require(_0xee56('0x7'));router[_0xee56('0x8')]('/',auth[_0xee56('0x9')](),controller[_0xee56('0xa')]);router['get'](_0xee56('0xb'),auth['isAuthenticated'](),controller[_0xee56('0xc')]);router[_0xee56('0x8')](_0xee56('0xd'),auth[_0xee56('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xee56('0xe')](_0xee56('0xd'),auth[_0xee56('0x9')](),controller['update']);router[_0xee56('0xf')](_0xee56('0xd'),auth[_0xee56('0x9')](),controller[_0xee56('0x10')]);module[_0xee56('0x11')]=router; \ No newline at end of file +var _0x4696=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x26b827,_0xe40c59){var _0x584752=function(_0x214a86){while(--_0x214a86){_0x26b827['push'](_0x26b827['shift']());}};_0x584752(++_0xe40c59);}(_0x4696,0xa8));var _0x6469=function(_0x36ed4b,_0x3269d5){_0x36ed4b=_0x36ed4b-0x0;var _0x391dc4=_0x4696[_0x36ed4b];return _0x391dc4;};'use strict';var multer=require(_0x6469('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6469('0x1'));var express=require(_0x6469('0x2'));var router=express['Router']();var fs_extra=require(_0x6469('0x3'));var auth=require(_0x6469('0x4'));var interaction=require(_0x6469('0x5'));var config=require(_0x6469('0x6'));var controller=require(_0x6469('0x7'));router[_0x6469('0x8')]('/',auth[_0x6469('0x9')](),controller['index']);router[_0x6469('0x8')](_0x6469('0xa'),auth[_0x6469('0x9')](),controller['describe']);router['get'](_0x6469('0xb'),auth['isAuthenticated'](),controller[_0x6469('0xc')]);router[_0x6469('0xd')]('/',auth[_0x6469('0x9')](),controller[_0x6469('0xe')]);router[_0x6469('0xf')](_0x6469('0xb'),auth[_0x6469('0x9')](),controller['update']);router[_0x6469('0x10')](_0x6469('0xb'),auth[_0x6469('0x9')](),controller[_0x6469('0x11')]);module[_0x6469('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ed6798d..056bade 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 _0x903e=['talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]'];(function(_0x5b8a99,_0x2e0c12){var _0x31fa01=function(_0x21396c){while(--_0x21396c){_0x5b8a99['push'](_0x5b8a99['shift']());}};_0x31fa01(++_0x2e0c12);}(_0x903e,0x1b5));var _0xe903=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x903e[_0x602ca8];return _0x26e8ab;};'use strict';var Sequelize=require(_0xe903('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0xe903('0x1')]},'membername':{'type':Sequelize[_0xe903('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe903('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xe903('0x2')},'duration':{'type':Sequelize[_0xe903('0x3')]},'enterAt':{'type':Sequelize[_0xe903('0x4')]},'exitAt':{'type':Sequelize[_0xe903('0x4')],'set':function(_0x15c13a){var _0x43f290=moment(_0x15c13a);var _0x5591cf=moment(this[_0xe903('0x5')]('enterAt'));var _0x426379=_0x43f290['diff'](_0x5591cf,_0xe903('0x6'));this[_0xe903('0x7')]('exitAt',_0x15c13a);this[_0xe903('0x7')](_0xe903('0x8'),_0x426379>=0x0?_0x426379:null);}},'data1':{'type':Sequelize[_0xe903('0x1')],'comment':_0xe903('0x9')},'data2':{'type':Sequelize[_0xe903('0x1')],'comment':_0xe903('0xa')},'data3':{'type':Sequelize[_0xe903('0x1')],'comment':_0xe903('0xb')},'data4':{'type':Sequelize[_0xe903('0x1')],'comment':_0xe903('0xc')},'data5':{'type':Sequelize[_0xe903('0x1')],'comment':_0xe903('0xd')},'role':{'type':Sequelize[_0xe903('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe903('0x1')]}}; \ No newline at end of file +var _0x201e=['seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt'];(function(_0x44bf54,_0x5be3d6){var _0x2c4a96=function(_0x2bd0ee){while(--_0x2bd0ee){_0x44bf54['push'](_0x44bf54['shift']());}};_0x2c4a96(++_0x5be3d6);}(_0x201e,0xd8));var _0xe201=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x201e[_0x609988];return _0x159984;};'use strict';var Sequelize=require(_0xe201('0x0'));var moment=require(_0xe201('0x1'));module['exports']={'channel':{'type':Sequelize[_0xe201('0x2')]},'membername':{'type':Sequelize[_0xe201('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xe201('0x3')},'duration':{'type':Sequelize[_0xe201('0x4')]},'enterAt':{'type':Sequelize[_0xe201('0x5')]},'exitAt':{'type':Sequelize[_0xe201('0x5')],'set':function(_0x3a73b6){var _0x36f0a3=moment(_0x3a73b6);var _0x12ae9e=moment(this[_0xe201('0x6')](_0xe201('0x7')));var _0x545f84=_0x36f0a3['diff'](_0x12ae9e,_0xe201('0x8'));this[_0xe201('0x9')](_0xe201('0xa'),_0x3a73b6);this[_0xe201('0x9')](_0xe201('0xb'),_0x545f84>=0x0?_0x545f84:null);}},'data1':{'type':Sequelize[_0xe201('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xe201('0x2')],'comment':_0xe201('0xc')},'data3':{'type':Sequelize[_0xe201('0x2')],'comment':_0xe201('0xd')},'data4':{'type':Sequelize[_0xe201('0x2')],'comment':_0xe201('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0xe201('0xf')},'role':{'type':Sequelize[_0xe201('0x2')]},'internal':{'type':Sequelize[_0xe201('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 788b3da..83a60e8 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(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x34e8,0x12c));var _0x834e=function(_0x2b5aee,_0x2a4c62){_0x2b5aee=_0x2b5aee-0x0;var _0x3098d7=_0x34e8[_0x2b5aee];return _0x3098d7;};'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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x2f653f,_0x1cef4e){var _0x479836=function(_0x4182c2){while(--_0x4182c2){_0x2f653f['push'](_0x2f653f['shift']());}};_0x479836(++_0x1cef4e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index a147f9d..ce8f3fb 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 _0x3abc=['report_member','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport'];(function(_0x2f474c,_0x16ea55){var _0x1874b7=function(_0x29171f){while(--_0x29171f){_0x2f474c['push'](_0x2f474c['shift']());}};_0x1874b7(++_0x16ea55);}(_0x3abc,0xfe));var _0xc3ab=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x3abc[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xc3ab('0x0'));var util=require(_0xc3ab('0x1'));var logger=require(_0xc3ab('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc3ab('0x3'));var rp=require(_0xc3ab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ab('0x5'));var config=require(_0xc3ab('0x6'));var attributes=require(_0xc3ab('0x7'));module['exports']=function(_0x1ef146,_0x3a1e70){return _0x1ef146[_0xc3ab('0x8')](_0xc3ab('0x9'),attributes,{'tableName':_0xc3ab('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x67bc=['define','membername_interface','interface','lodash','moment','bluebird','request-promise','rimraf','./memberReport.attributes'];(function(_0x1f60a5,_0x287639){var _0x93fb38=function(_0x190ce1){while(--_0x190ce1){_0x1f60a5['push'](_0x1f60a5['shift']());}};_0x93fb38(++_0x287639);}(_0x67bc,0x1d7));var _0xc67b=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0x67bc[_0x28fe94];return _0x3560da;};'use strict';var _=require(_0xc67b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc67b('0x1'));var BPromise=require(_0xc67b('0x2'));var rp=require(_0xc67b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc67b('0x4'));var config=require('../../config/environment');var attributes=require(_0xc67b('0x5'));module['exports']=function(_0x326ef7,_0x4efed4){return _0x326ef7[_0xc67b('0x6')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xc67b('0x7'),'fields':['membername',_0xc67b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index b5c5399..a61ce10 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 _0xd69e=['lodash','util','moment','randomstring','ioredis','../../config/environment','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','include','map','model','attributes','debug','CreateMemberReport','body','UpdateMemberReport'];(function(_0x49ad25,_0x3e7198){var _0x45e7e0=function(_0x2527e7){while(--_0x2527e7){_0x49ad25['push'](_0x49ad25['shift']());}};_0x45e7e0(++_0x3e7198);}(_0xd69e,0xa0));var _0xed69=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd69e[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xed69('0x0'));var util=require(_0xed69('0x1'));var moment=require(_0xed69('0x2'));var BPromise=require('bluebird');var rs=require(_0xed69('0x3'));var fs=require('fs');var Redis=require(_0xed69('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xed69('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed69('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1f2757,_0xd7eed4,_0x20a74f){return new BPromise(function(_0x4bcb61,_0x3dec07){return client['request'](_0x1f2757,_0x20a74f)[_0xed69('0x7')](function(_0x42c0b0){logger['info'](_0xed69('0x8'),_0xd7eed4,_0xed69('0x9'));logger['debug'](_0xed69('0xa'),_0xd7eed4,'request\x20sent',JSON[_0xed69('0xb')](_0x42c0b0));if(_0x42c0b0[_0xed69('0xc')]){if(_0x42c0b0['error'][_0xed69('0xd')]===0x1f4){logger['error'](_0xed69('0x8'),_0xd7eed4,_0x42c0b0[_0xed69('0xc')][_0xed69('0xe')]);return _0x3dec07(_0x42c0b0['error']['message']);}logger[_0xed69('0xc')](_0xed69('0x8'),_0xd7eed4,_0x42c0b0[_0xed69('0xc')][_0xed69('0xe')]);return _0x4bcb61(_0x42c0b0[_0xed69('0xc')]['message']);}else{logger[_0xed69('0xf')](_0xed69('0x8'),_0xd7eed4,_0xed69('0x9'));_0x4bcb61(_0x42c0b0[_0xed69('0x10')][_0xed69('0xe')]);}})[_0xed69('0x11')](function(_0x465db9){logger[_0xed69('0xc')](_0xed69('0x8'),_0xd7eed4,_0x465db9);_0x3dec07(_0x465db9);});});}exports[_0xed69('0x12')]=function(_0x4df35e){var _0x4843bf=this;return new Promise(function(_0x553824,_0x2c8d25){return db[_0xed69('0x13')][_0xed69('0x14')]({'raw':_0x4df35e['options']?_0x4df35e[_0xed69('0x15')][_0xed69('0x16')]===undefined?!![]:![]:!![],'where':_0x4df35e['options']?_0x4df35e[_0xed69('0x15')][_0xed69('0x17')]||null:null,'attributes':_0x4df35e[_0xed69('0x15')]?_0x4df35e[_0xed69('0x15')]['attributes']||null:null,'limit':_0x4df35e[_0xed69('0x15')]?_0x4df35e[_0xed69('0x15')]['limit']||null:null,'include':_0x4df35e[_0xed69('0x15')]?_0x4df35e[_0xed69('0x15')][_0xed69('0x18')]?_[_0xed69('0x19')](_0x4df35e[_0xed69('0x15')][_0xed69('0x18')],function(_0x513337){return{'model':db[_0x513337[_0xed69('0x1a')]],'as':_0x513337['as'],'attributes':_0x513337[_0xed69('0x1b')],'include':_0x513337[_0xed69('0x18')]?_[_0xed69('0x19')](_0x513337[_0xed69('0x18')],function(_0xd182bd){return{'model':db[_0xd182bd[_0xed69('0x1a')]],'as':_0xd182bd['as'],'attributes':_0xd182bd[_0xed69('0x1b')],'include':_0xd182bd[_0xed69('0x18')]?_[_0xed69('0x19')](_0xd182bd[_0xed69('0x18')],function(_0x4c2986){return{'model':db[_0x4c2986['model']],'as':_0x4c2986['as'],'attributes':_0x4c2986[_0xed69('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xed69('0x7')](function(_0x2c77d4){logger[_0xed69('0xf')](_0xed69('0x12'),_0x4df35e);logger[_0xed69('0x1c')](_0xed69('0x12'),_0x4df35e,JSON[_0xed69('0xb')](_0x2c77d4));_0x553824(_0x2c77d4);})[_0xed69('0x11')](function(_0x1b24d7){logger['error']('GetMemberReport',_0x1b24d7[_0xed69('0xe')],_0x4df35e);_0x2c8d25(_0x4843bf['error'](0x1f4,_0x1b24d7[_0xed69('0xe')]));});});};exports[_0xed69('0x1d')]=function(_0x164316){var _0x1f4e54=this;return new Promise(function(_0xe5cb74,_0x327298){return db[_0xed69('0x13')]['create'](_0x164316[_0xed69('0x1e')],{'raw':_0x164316[_0xed69('0x15')]?_0x164316[_0xed69('0x15')][_0xed69('0x16')]===undefined?!![]:![]:!![]})[_0xed69('0x7')](function(_0x200dfb){logger[_0xed69('0xf')]('CreateMemberReport',_0x164316);logger['debug'](_0xed69('0x1d'),_0x164316,JSON[_0xed69('0xb')](_0x200dfb));_0xe5cb74(_0x200dfb);})[_0xed69('0x11')](function(_0x1b7095){logger[_0xed69('0xc')](_0xed69('0x1d'),_0x1b7095['message'],_0x164316);_0x327298(_0x1f4e54[_0xed69('0xc')](0x1f4,_0x1b7095[_0xed69('0xe')]));});});};exports[_0xed69('0x1f')]=function(_0x166694){var _0x29f407=this;return new Promise(function(_0x42680f,_0x4d6a2c){return db['MemberReport']['update'](_0x166694[_0xed69('0x1e')],{'raw':_0x166694[_0xed69('0x15')]?_0x166694[_0xed69('0x15')][_0xed69('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x166694['options']?_0x166694[_0xed69('0x15')][_0xed69('0x17')]||null:null,'attributes':_0x166694['options']?_0x166694[_0xed69('0x15')][_0xed69('0x1b')]||null:null,'limit':_0x166694[_0xed69('0x15')]?_0x166694[_0xed69('0x15')]['limit']||null:null})[_0xed69('0x7')](function(_0x1defcf){logger[_0xed69('0xf')](_0xed69('0x1f'),_0x166694);logger[_0xed69('0x1c')](_0xed69('0x1f'),_0x166694,JSON[_0xed69('0xb')](_0x1defcf));_0x42680f(_0x1defcf);})[_0xed69('0x11')](function(_0x521ec9){logger[_0xed69('0xc')]('UpdateMemberReport',_0x521ec9[_0xed69('0xe')],_0x166694);_0x4d6a2c(_0x29f407[_0xed69('0xc')](0x1f4,_0x521ec9[_0xed69('0xe')]));});});}; \ No newline at end of file +var _0x980e=['options','raw','where','attributes','map','include','model','CreateMemberReport','create','body','then','UpdateMemberReport','update','limit','lodash','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x14ae95,_0x4b6519){var _0xe2b584=function(_0x4514c5){while(--_0x4514c5){_0x14ae95['push'](_0x14ae95['shift']());}};_0xe2b584(++_0x4b6519);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe980('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe980('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe980('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe980('0x3'));var logger=require(_0xe980('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe980('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5825c1,_0xc47bdf,_0x27cc8c){return new BPromise(function(_0x3683df,_0x2d76d0){return client[_0xe980('0x6')](_0x5825c1,_0x27cc8c)['then'](function(_0xf9f019){logger[_0xe980('0x7')](_0xe980('0x8'),_0xc47bdf,'request\x20sent');logger[_0xe980('0x9')](_0xe980('0xa'),_0xc47bdf,_0xe980('0xb'),JSON[_0xe980('0xc')](_0xf9f019));if(_0xf9f019[_0xe980('0xd')]){if(_0xf9f019['error']['code']===0x1f4){logger['error'](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')]['message']);return _0x2d76d0(_0xf9f019['error'][_0xe980('0xe')]);}logger[_0xe980('0xd')](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);return _0x3683df(_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0xc47bdf,'request\x20sent');_0x3683df(_0xf9f019[_0xe980('0xf')][_0xe980('0xe')]);}})[_0xe980('0x10')](function(_0x406418){logger[_0xe980('0xd')]('MemberReport,\x20%s,\x20%s',_0xc47bdf,_0x406418);_0x2d76d0(_0x406418);});});}exports[_0xe980('0x11')]=function(_0x1c6354){var _0x1ddb12=this;return new Promise(function(_0x538d32,_0x5aa2c1){return db[_0xe980('0x12')][_0xe980('0x13')]({'raw':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![],'where':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')][_0xe980('0x16')]||null:null,'attributes':_0x1c6354['options']?_0x1c6354['options'][_0xe980('0x17')]||null:null,'limit':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')]['limit']||null:null,'include':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')]['include']?_[_0xe980('0x18')](_0x1c6354[_0xe980('0x14')][_0xe980('0x19')],function(_0x4b7888){return{'model':db[_0x4b7888[_0xe980('0x1a')]],'as':_0x4b7888['as'],'attributes':_0x4b7888['attributes'],'include':_0x4b7888[_0xe980('0x19')]?_[_0xe980('0x18')](_0x4b7888[_0xe980('0x19')],function(_0x40a34e){return{'model':db[_0x40a34e['model']],'as':_0x40a34e['as'],'attributes':_0x40a34e[_0xe980('0x17')],'include':_0x40a34e[_0xe980('0x19')]?_[_0xe980('0x18')](_0x40a34e['include'],function(_0x54e755){return{'model':db[_0x54e755[_0xe980('0x1a')]],'as':_0x54e755['as'],'attributes':_0x54e755[_0xe980('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16f2fe){logger['info'](_0xe980('0x11'),_0x1c6354);logger[_0xe980('0x9')](_0xe980('0x11'),_0x1c6354,JSON[_0xe980('0xc')](_0x16f2fe));_0x538d32(_0x16f2fe);})[_0xe980('0x10')](function(_0x43a7c2){logger['error'](_0xe980('0x11'),_0x43a7c2['message'],_0x1c6354);_0x5aa2c1(_0x1ddb12[_0xe980('0xd')](0x1f4,_0x43a7c2[_0xe980('0xe')]));});});};exports[_0xe980('0x1b')]=function(_0x38ab6d){var _0x2a9ea2=this;return new Promise(function(_0x56fbf7,_0x4bf013){return db[_0xe980('0x12')][_0xe980('0x1c')](_0x38ab6d[_0xe980('0x1d')],{'raw':_0x38ab6d[_0xe980('0x14')]?_0x38ab6d[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![]})[_0xe980('0x1e')](function(_0x369c3a){logger[_0xe980('0x7')](_0xe980('0x1b'),_0x38ab6d);logger[_0xe980('0x9')]('CreateMemberReport',_0x38ab6d,JSON['stringify'](_0x369c3a));_0x56fbf7(_0x369c3a);})[_0xe980('0x10')](function(_0x4702e0){logger[_0xe980('0xd')]('CreateMemberReport',_0x4702e0[_0xe980('0xe')],_0x38ab6d);_0x4bf013(_0x2a9ea2[_0xe980('0xd')](0x1f4,_0x4702e0[_0xe980('0xe')]));});});};exports[_0xe980('0x1f')]=function(_0x163db9){var _0x44686a=this;return new Promise(function(_0x1811b3,_0x36ab72){return db[_0xe980('0x12')][_0xe980('0x20')](_0x163db9['body'],{'raw':_0x163db9['options']?_0x163db9[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163db9['options']?_0x163db9[_0xe980('0x14')]['where']||null:null,'attributes':_0x163db9[_0xe980('0x14')]?_0x163db9[_0xe980('0x14')][_0xe980('0x17')]||null:null,'limit':_0x163db9[_0xe980('0x14')]?_0x163db9[_0xe980('0x14')][_0xe980('0x21')]||null:null})['then'](function(_0x11fb5b){logger[_0xe980('0x7')](_0xe980('0x1f'),_0x163db9);logger[_0xe980('0x9')](_0xe980('0x1f'),_0x163db9,JSON['stringify'](_0x11fb5b));_0x1811b3(_0x11fb5b);})[_0xe980('0x10')](function(_0x1f35ed){logger[_0xe980('0xd')]('UpdateMemberReport',_0x1f35ed[_0xe980('0xe')],_0x163db9);_0x36ab72(_0x44686a['error'](0x1f4,_0x1f35ed[_0xe980('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d6b7c4d..7800091 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 _0x078c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','path','connect-timeout'];(function(_0x1006ad,_0x26a309){var _0x3edfe2=function(_0x392ed5){while(--_0x392ed5){_0x1006ad['push'](_0x1006ad['shift']());}};_0x3edfe2(++_0x26a309);}(_0x078c,0x19f));var _0xc078=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x078c[_0x3c4f1f];return _0x19cb69;};'use strict';var multer=require(_0xc078('0x0'));var util=require('util');var path=require(_0xc078('0x1'));var timeout=require(_0xc078('0x2'));var express=require('express');var router=express[_0xc078('0x3')]();var fs_extra=require(_0xc078('0x4'));var auth=require(_0xc078('0x5'));var interaction=require(_0xc078('0x6'));var config=require('../../config/environment');var controller=require(_0xc078('0x7'));router[_0xc078('0x8')]('/',controller[_0xc078('0x9')]);module[_0xc078('0xa')]=router; \ No newline at end of file +var _0x8f18=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','exports','multer','util'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x8f18,0x1ea));var _0x88f1=function(_0x4ff4b1,_0x167bad){_0x4ff4b1=_0x4ff4b1-0x0;var _0x4b6552=_0x8f18[_0x4ff4b1];return _0x4b6552;};'use strict';var multer=require(_0x88f1('0x0'));var util=require(_0x88f1('0x1'));var path=require(_0x88f1('0x2'));var timeout=require(_0x88f1('0x3'));var express=require(_0x88f1('0x4'));var router=express[_0x88f1('0x5')]();var fs_extra=require(_0x88f1('0x6'));var auth=require(_0x88f1('0x7'));var interaction=require(_0x88f1('0x8'));var config=require(_0x88f1('0x9'));var controller=require('./migration.controller');router[_0x88f1('0xa')]('/',controller['index']);module[_0x88f1('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 8f99703..09a1634 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 _0x6873=['version','sequelize','exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x6873,0x112));var _0x3687=function(_0x86c6cb,_0x30bb53){_0x86c6cb=_0x86c6cb-0x0;var _0x1b1592=_0x6873[_0x86c6cb];return _0x1b1592;};'use strict';var Sequelize=require(_0x3687('0x0'));module[_0x3687('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x3687('0x2')}}; \ No newline at end of file +var _0x94c3=['version','sequelize','exports','STRING'];(function(_0x495f46,_0x4e98fb){var _0x5e999d=function(_0x502e53){while(--_0x502e53){_0x495f46['push'](_0x495f46['shift']());}};_0x5e999d(++_0x4e98fb);}(_0x94c3,0x1c5));var _0x394c=function(_0x35b9af,_0x2d6211){_0x35b9af=_0x35b9af-0x0;var _0x1fb437=_0x94c3[_0x35b9af];return _0x1fb437;};'use strict';var Sequelize=require(_0x394c('0x0'));module[_0x394c('0x1')]={'version':{'type':Sequelize[_0x394c('0x2')],'unique':_0x394c('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 043e1a4..c778ba3 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 _0xbb68=['VIRTUAL','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','name','send','index','map','Migration','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x2c4f1f,_0x4b5de4){var _0x418135=function(_0x2db28d){while(--_0x2db28d){_0x2c4f1f['push'](_0x2c4f1f['shift']());}};_0x418135(++_0x4b5de4);}(_0xbb68,0x140));var _0x8bb6=function(_0xc829a6,_0x554812){_0xc829a6=_0xc829a6-0x0;var _0xf19a92=_0xbb68[_0xc829a6];return _0xf19a92;};'use strict';var emlformat=require(_0x8bb6('0x0'));var rimraf=require(_0x8bb6('0x1'));var zipdir=require(_0x8bb6('0x2'));var jsonpatch=require(_0x8bb6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8bb6('0x4'));var Mustache=require(_0x8bb6('0x5'));var util=require(_0x8bb6('0x6'));var path=require('path');var sox=require(_0x8bb6('0x7'));var csv=require(_0x8bb6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bb6('0x9'));var squel=require(_0x8bb6('0xa'));var crypto=require('crypto');var jsforce=require(_0x8bb6('0xb'));var deskjs=require(_0x8bb6('0xc'));var toCsv=require(_0x8bb6('0x8'));var querystring=require(_0x8bb6('0xd'));var Papa=require('papaparse');var Redis=require(_0x8bb6('0xe'));var authService=require(_0x8bb6('0xf'));var qs=require(_0x8bb6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bb6('0x11'));var logger=require('../../config/logger')(_0x8bb6('0x12'));var utils=require(_0x8bb6('0x13'));var config=require(_0x8bb6('0x14'));var licenseUtil=require(_0x8bb6('0x15'));var db=require(_0x8bb6('0x16'))['db'];function respondWithStatusCode(_0x29b966,_0x159ce9){_0x159ce9=_0x159ce9||0xcc;return function(_0x356cc3){if(_0x356cc3){return _0x29b966[_0x8bb6('0x17')](_0x159ce9);}return _0x29b966[_0x8bb6('0x18')](_0x159ce9)[_0x8bb6('0x19')]();};}function respondWithResult(_0x13b21c,_0x49f035){_0x49f035=_0x49f035||0xc8;return function(_0x4946a1){if(_0x4946a1){return _0x13b21c['status'](_0x49f035)[_0x8bb6('0x1a')](_0x4946a1);}};}function respondWithFilteredResult(_0x248f8f,_0xd6e43b){return function(_0x50e10f){if(_0x50e10f){var _0x31c0ba=typeof _0xd6e43b[_0x8bb6('0x1b')]==='undefined'&&typeof _0xd6e43b[_0x8bb6('0x1c')]===_0x8bb6('0x1d');var _0x5c5032=_0x50e10f['count'];var _0x120737=_0x31c0ba?0x0:_0xd6e43b[_0x8bb6('0x1b')];var _0x1c7389=_0x31c0ba?_0x50e10f[_0x8bb6('0x1e')]:_0xd6e43b[_0x8bb6('0x1b')]+_0xd6e43b[_0x8bb6('0x1c')];var _0x3aa628;if(_0x1c7389>=_0x5c5032){_0x1c7389=_0x5c5032;_0x3aa628=0xc8;}else{_0x3aa628=0xce;}_0x248f8f[_0x8bb6('0x18')](_0x3aa628);return _0x248f8f[_0x8bb6('0x1f')](_0x8bb6('0x20'),_0x120737+'-'+_0x1c7389+'/'+_0x5c5032)[_0x8bb6('0x1a')](_0x50e10f);}return null;};}function patchUpdates(_0x31f534){return function(_0x1bda45){try{jsonpatch[_0x8bb6('0x21')](_0x1bda45,_0x31f534,!![]);}catch(_0x51bc3a){return BPromise[_0x8bb6('0x22')](_0x51bc3a);}return _0x1bda45['save']();};}function saveUpdates(_0x138a70,_0x126c3e){return function(_0x2dc820){if(_0x2dc820){return _0x2dc820[_0x8bb6('0x23')](_0x138a70)['then'](function(_0x4fab68){return _0x4fab68;});}return null;};}function removeEntity(_0x1120c0,_0x4306b0){return function(_0x3289ef){if(_0x3289ef){return _0x3289ef['destroy']()[_0x8bb6('0x24')](function(){_0x1120c0[_0x8bb6('0x18')](0xcc)[_0x8bb6('0x19')]();});}};}function handleEntityNotFound(_0x2097e6,_0x4d9863){return function(_0x174b46){if(!_0x174b46){_0x2097e6['sendStatus'](0x194);}return _0x174b46;};}function handleError(_0x2f4228,_0x50ce47){_0x50ce47=_0x50ce47||0x1f4;return function(_0x4ea31f){logger[_0x8bb6('0x25')](_0x4ea31f['stack']);if(_0x4ea31f['name']){delete _0x4ea31f[_0x8bb6('0x26')];}_0x2f4228[_0x8bb6('0x18')](_0x50ce47)[_0x8bb6('0x27')](_0x4ea31f);};}exports[_0x8bb6('0x28')]=function(_0x46d8be,_0x3898ac){var _0x38e093={},_0xd98bb7={},_0x55b658={'count':0x0,'rows':[]};var _0x56d721=_[_0x8bb6('0x29')](db[_0x8bb6('0x2a')]['rawAttributes'],function(_0x175279){return{'name':_0x175279['fieldName'],'type':_0x175279[_0x8bb6('0x2b')]['key']};});_0xd98bb7[_0x8bb6('0x2c')]=_['map'](_0x56d721,'name');_0xd98bb7[_0x8bb6('0x2d')]=_[_0x8bb6('0x2e')](_0x46d8be[_0x8bb6('0x2d')]);_0xd98bb7[_0x8bb6('0x2f')]=_['intersection'](_0xd98bb7['model'],_0xd98bb7[_0x8bb6('0x2d')]);_0x38e093[_0x8bb6('0x30')]=_['intersection'](_0xd98bb7[_0x8bb6('0x2c')],qs[_0x8bb6('0x31')](_0x46d8be[_0x8bb6('0x2d')][_0x8bb6('0x31')]));_0x38e093['attributes']=_0x38e093[_0x8bb6('0x30')][_0x8bb6('0x32')]?_0x38e093['attributes']:_0xd98bb7[_0x8bb6('0x2c')];if(!_0x46d8be[_0x8bb6('0x2d')][_0x8bb6('0x33')](_0x8bb6('0x34'))){_0x38e093['limit']=qs[_0x8bb6('0x1c')](_0x46d8be[_0x8bb6('0x2d')]['limit']);_0x38e093['offset']=qs[_0x8bb6('0x1b')](_0x46d8be[_0x8bb6('0x2d')]['offset']);}_0x38e093[_0x8bb6('0x35')]=qs[_0x8bb6('0x36')](_0x46d8be['query'][_0x8bb6('0x36')]);_0x38e093[_0x8bb6('0x37')]=qs[_0x8bb6('0x2f')](_['pick'](_0x46d8be[_0x8bb6('0x2d')],_0xd98bb7[_0x8bb6('0x2f')]),_0x56d721);if(_0x46d8be[_0x8bb6('0x2d')][_0x8bb6('0x38')]){_0x38e093[_0x8bb6('0x37')]=_[_0x8bb6('0x39')](_0x38e093[_0x8bb6('0x37')],{'$or':_[_0x8bb6('0x29')](_0x56d721,function(_0x4a2972){if(_0x4a2972[_0x8bb6('0x2b')]!==_0x8bb6('0x3a')){var _0x165de7={};_0x165de7[_0x4a2972[_0x8bb6('0x26')]]={'$like':'%'+_0x46d8be[_0x8bb6('0x2d')]['filter']+'%'};return _0x165de7;}})});}_0x38e093=_[_0x8bb6('0x39')]({},_0x38e093,_0x46d8be['options']);var _0x450523={'where':_0x38e093[_0x8bb6('0x37')]};return db[_0x8bb6('0x2a')][_0x8bb6('0x1e')](_0x450523)[_0x8bb6('0x24')](function(_0x16c92a){_0x55b658[_0x8bb6('0x1e')]=_0x16c92a;if(_0x46d8be[_0x8bb6('0x2d')][_0x8bb6('0x3b')]){_0x38e093[_0x8bb6('0x3c')]=[{'all':!![]}];}return db[_0x8bb6('0x2a')][_0x8bb6('0x3d')](_0x38e093);})['then'](function(_0x5de38a){_0x55b658['rows']=_0x5de38a;return _0x55b658;})['then'](respondWithFilteredResult(_0x3898ac,_0x38e093))[_0x8bb6('0x3e')](handleError(_0x3898ac,null));}; \ No newline at end of file +var _0x7089=['where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x504e47,_0x14833d){var _0x286028=function(_0x1460d3){while(--_0x1460d3){_0x504e47['push'](_0x504e47['shift']());}};_0x286028(++_0x14833d);}(_0x7089,0xd8));var _0x9708=function(_0x1c83b7,_0x1e1ce1){_0x1c83b7=_0x1c83b7-0x0;var _0x3a7eef=_0x7089[_0x1c83b7];return _0x3a7eef;};'use strict';var emlformat=require(_0x9708('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9708('0x1'));var jsonpatch=require(_0x9708('0x2'));var rp=require('request-promise');var moment=require(_0x9708('0x3'));var BPromise=require(_0x9708('0x4'));var Mustache=require(_0x9708('0x5'));var util=require('util');var path=require(_0x9708('0x6'));var sox=require(_0x9708('0x7'));var csv=require('to-csv');var ejs=require(_0x9708('0x8'));var fs=require('fs');var fs_extra=require(_0x9708('0x9'));var _=require(_0x9708('0xa'));var squel=require('squel');var crypto=require(_0x9708('0xb'));var jsforce=require(_0x9708('0xc'));var deskjs=require(_0x9708('0xd'));var toCsv=require(_0x9708('0xe'));var querystring=require('querystring');var Papa=require(_0x9708('0xf'));var Redis=require(_0x9708('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9708('0x11'));var logger=require(_0x9708('0x12'))(_0x9708('0x13'));var utils=require(_0x9708('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9708('0x15'))['db'];function respondWithStatusCode(_0xa548fa,_0x3f6bab){_0x3f6bab=_0x3f6bab||0xcc;return function(_0x577fb7){if(_0x577fb7){return _0xa548fa[_0x9708('0x16')](_0x3f6bab);}return _0xa548fa['status'](_0x3f6bab)[_0x9708('0x17')]();};}function respondWithResult(_0x31397f,_0x138a65){_0x138a65=_0x138a65||0xc8;return function(_0x1c5d95){if(_0x1c5d95){return _0x31397f[_0x9708('0x18')](_0x138a65)[_0x9708('0x19')](_0x1c5d95);}};}function respondWithFilteredResult(_0x1eddc0,_0x3bcae4){return function(_0x980735){if(_0x980735){var _0x154a6a=typeof _0x3bcae4[_0x9708('0x1a')]===_0x9708('0x1b')&&typeof _0x3bcae4[_0x9708('0x1c')]===_0x9708('0x1b');var _0xbe3004=_0x980735[_0x9708('0x1d')];var _0x453835=_0x154a6a?0x0:_0x3bcae4[_0x9708('0x1a')];var _0x5935fd=_0x154a6a?_0x980735[_0x9708('0x1d')]:_0x3bcae4['offset']+_0x3bcae4[_0x9708('0x1c')];var _0x5e41d7;if(_0x5935fd>=_0xbe3004){_0x5935fd=_0xbe3004;_0x5e41d7=0xc8;}else{_0x5e41d7=0xce;}_0x1eddc0[_0x9708('0x18')](_0x5e41d7);return _0x1eddc0[_0x9708('0x1e')](_0x9708('0x1f'),_0x453835+'-'+_0x5935fd+'/'+_0xbe3004)[_0x9708('0x19')](_0x980735);}return null;};}function patchUpdates(_0x2ee0b1){return function(_0x3cd803){try{jsonpatch[_0x9708('0x20')](_0x3cd803,_0x2ee0b1,!![]);}catch(_0x117ce2){return BPromise[_0x9708('0x21')](_0x117ce2);}return _0x3cd803[_0x9708('0x22')]();};}function saveUpdates(_0x3bea52,_0x5055ba){return function(_0x2186c8){if(_0x2186c8){return _0x2186c8[_0x9708('0x23')](_0x3bea52)['then'](function(_0x59a10c){return _0x59a10c;});}return null;};}function removeEntity(_0x152c6e,_0x554af6){return function(_0x2eb3eb){if(_0x2eb3eb){return _0x2eb3eb['destroy']()['then'](function(){_0x152c6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bbbf,_0x4bc5c5){return function(_0x51145e){if(!_0x51145e){_0x29bbbf[_0x9708('0x16')](0x194);}return _0x51145e;};}function handleError(_0x22f944,_0x224eb7){_0x224eb7=_0x224eb7||0x1f4;return function(_0x4fd3cd){logger[_0x9708('0x24')](_0x4fd3cd['stack']);if(_0x4fd3cd[_0x9708('0x25')]){delete _0x4fd3cd[_0x9708('0x25')];}_0x22f944[_0x9708('0x18')](_0x224eb7)[_0x9708('0x26')](_0x4fd3cd);};}exports[_0x9708('0x27')]=function(_0x4c079d,_0x59398b){var _0x4643cb={},_0x193c84={},_0x361fd2={'count':0x0,'rows':[]};var _0x227fe5=_[_0x9708('0x28')](db[_0x9708('0x29')][_0x9708('0x2a')],function(_0x2a77a7){return{'name':_0x2a77a7[_0x9708('0x2b')],'type':_0x2a77a7['type'][_0x9708('0x2c')]};});_0x193c84[_0x9708('0x2d')]=_['map'](_0x227fe5,_0x9708('0x25'));_0x193c84[_0x9708('0x2e')]=_[_0x9708('0x2f')](_0x4c079d[_0x9708('0x2e')]);_0x193c84[_0x9708('0x30')]=_[_0x9708('0x31')](_0x193c84['model'],_0x193c84[_0x9708('0x2e')]);_0x4643cb[_0x9708('0x32')]=_[_0x9708('0x31')](_0x193c84[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x4c079d[_0x9708('0x2e')][_0x9708('0x33')]));_0x4643cb['attributes']=_0x4643cb[_0x9708('0x32')][_0x9708('0x34')]?_0x4643cb['attributes']:_0x193c84['model'];if(!_0x4c079d[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x4643cb[_0x9708('0x1c')]=qs['limit'](_0x4c079d[_0x9708('0x2e')]['limit']);_0x4643cb[_0x9708('0x1a')]=qs['offset'](_0x4c079d[_0x9708('0x2e')][_0x9708('0x1a')]);}_0x4643cb['order']=qs[_0x9708('0x37')](_0x4c079d[_0x9708('0x2e')]['sort']);_0x4643cb[_0x9708('0x38')]=qs[_0x9708('0x30')](_[_0x9708('0x39')](_0x4c079d[_0x9708('0x2e')],_0x193c84['filters']),_0x227fe5);if(_0x4c079d[_0x9708('0x2e')][_0x9708('0x3a')]){_0x4643cb['where']=_[_0x9708('0x3b')](_0x4643cb[_0x9708('0x38')],{'$or':_[_0x9708('0x28')](_0x227fe5,function(_0x304bd2){if(_0x304bd2[_0x9708('0x3c')]!==_0x9708('0x3d')){var _0x42f2d0={};_0x42f2d0[_0x304bd2['name']]={'$like':'%'+_0x4c079d[_0x9708('0x2e')][_0x9708('0x3a')]+'%'};return _0x42f2d0;}})});}_0x4643cb=_[_0x9708('0x3b')]({},_0x4643cb,_0x4c079d[_0x9708('0x3e')]);var _0x50b3f3={'where':_0x4643cb[_0x9708('0x38')]};return db['Migration'][_0x9708('0x1d')](_0x50b3f3)[_0x9708('0x3f')](function(_0x2b6175){_0x361fd2[_0x9708('0x1d')]=_0x2b6175;if(_0x4c079d[_0x9708('0x2e')][_0x9708('0x40')]){_0x4643cb['include']=[{'all':!![]}];}return db[_0x9708('0x29')][_0x9708('0x41')](_0x4643cb);})[_0x9708('0x3f')](function(_0x11f406){_0x361fd2[_0x9708('0x42')]=_0x11f406;return _0x361fd2;})[_0x9708('0x3f')](respondWithFilteredResult(_0x59398b,_0x4643cb))[_0x9708('0x43')](handleError(_0x59398b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7297d4a..86df717 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 _0xe90e=['api','moment','bluebird','request-promise','path','../../config/environment','exports','migrations','util'];(function(_0x2bd4e3,_0x4d9b53){var _0x259f7c=function(_0x419754){while(--_0x419754){_0x2bd4e3['push'](_0x2bd4e3['shift']());}};_0x259f7c(++_0x4d9b53);}(_0xe90e,0x1e5));var _0xee90=function(_0x3a70ef,_0x7fdf5f){_0x3a70ef=_0x3a70ef-0x0;var _0x5197bf=_0xe90e[_0x3a70ef];return _0x5197bf;};'use strict';var _=require('lodash');var util=require(_0xee90('0x0'));var logger=require('../../config/logger')(_0xee90('0x1'));var moment=require(_0xee90('0x2'));var BPromise=require(_0xee90('0x3'));var rp=require(_0xee90('0x4'));var fs=require('fs');var path=require(_0xee90('0x5'));var rimraf=require('rimraf');var config=require(_0xee90('0x6'));var attributes=require('./migration.attributes');module[_0xee90('0x7')]=function(_0x2a53c2,_0xe5932a){return _0x2a53c2['define']('Migration',attributes,{'tableName':_0xee90('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bfd=['./migration.attributes','exports','Migration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3da7ed,_0x38c5f2){var _0x1bdd8e=function(_0x4fe142){while(--_0x4fe142){_0x3da7ed['push'](_0x3da7ed['shift']());}};_0x1bdd8e(++_0x38c5f2);}(_0x4bfd,0x1b3));var _0xd4bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4bfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd4bf('0x0'));var util=require(_0xd4bf('0x1'));var logger=require(_0xd4bf('0x2'))('api');var moment=require(_0xd4bf('0x3'));var BPromise=require(_0xd4bf('0x4'));var rp=require(_0xd4bf('0x5'));var fs=require('fs');var path=require(_0xd4bf('0x6'));var rimraf=require(_0xd4bf('0x7'));var config=require(_0xd4bf('0x8'));var attributes=require(_0xd4bf('0x9'));module[_0xd4bf('0xa')]=function(_0x4ffe28,_0x4994c5){return _0x4ffe28['define'](_0xd4bf('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index ec4d6dd..df01e5e 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 _0x1152=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x30ae75,_0x11f79f){var _0x28b317=function(_0x3740ca){while(--_0x3740ca){_0x30ae75['push'](_0x30ae75['shift']());}};_0x28b317(++_0x11f79f);}(_0x1152,0x182));var _0x2115=function(_0x242bb9,_0x5575b7){_0x242bb9=_0x242bb9-0x0;var _0x2a2760=_0x1152[_0x242bb9];return _0x2a2760;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var moment=require(_0x2115('0x2'));var BPromise=require(_0x2115('0x3'));var rs=require(_0x2115('0x4'));var fs=require('fs');var Redis=require(_0x2115('0x5'));var db=require(_0x2115('0x6'))['db'];var utils=require(_0x2115('0x7'));var logger=require('../../config/logger')(_0x2115('0x8'));var config=require('../../config/environment');var jayson=require(_0x2115('0x9'));var client=jayson[_0x2115('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x564071,_0x54cdd0,_0x5dbb85){return new BPromise(function(_0x5df6db,_0x158711){return client[_0x2115('0xb')](_0x564071,_0x5dbb85)[_0x2115('0xc')](function(_0x5156f2){logger[_0x2115('0xd')]('Migration,\x20%s,\x20%s',_0x54cdd0,'request\x20sent');logger[_0x2115('0xe')](_0x2115('0xf'),_0x54cdd0,_0x2115('0x10'),JSON['stringify'](_0x5156f2));if(_0x5156f2[_0x2115('0x11')]){if(_0x5156f2['error'][_0x2115('0x12')]===0x1f4){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x158711(_0x5156f2['error'][_0x2115('0x14')]);}logger['error'](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x5df6db(_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);}else{logger[_0x2115('0xd')](_0x2115('0x13'),_0x54cdd0,'request\x20sent');_0x5df6db(_0x5156f2[_0x2115('0x15')][_0x2115('0x14')]);}})[_0x2115('0x16')](function(_0x184c05){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x184c05);_0x158711(_0x184c05);});});} \ No newline at end of file +var _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x20d2c1,_0x5ce7b3){var _0x57948a=function(_0x10cd89){while(--_0x10cd89){_0x20d2c1['push'](_0x20d2c1['shift']());}};_0x57948a(++_0x5ce7b3);}(_0x153f,0x15b));var _0xf153=function(_0x31b491,_0x59026d){_0x31b491=_0x31b491-0x0;var _0x31a751=_0x153f[_0x31b491];return _0x31a751;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('Migration,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 7f0a7d0..feade04 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 _0xbe54=['update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','./network.controller','isAuthenticated','index','get','show','post','create','put'];(function(_0x119e6d,_0xe3377d){var _0x56b2d5=function(_0x31d728){while(--_0x31d728){_0x119e6d['push'](_0x119e6d['shift']());}};_0x56b2d5(++_0xe3377d);}(_0xbe54,0x9e));var _0x4be5=function(_0x58bf28,_0x31bdb5){_0x58bf28=_0x58bf28-0x0;var _0x18534a=_0xbe54[_0x58bf28];return _0x18534a;};'use strict';var multer=require(_0x4be5('0x0'));var util=require(_0x4be5('0x1'));var path=require('path');var timeout=require(_0x4be5('0x2'));var express=require('express');var router=express[_0x4be5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4be5('0x4'));router['get']('/',auth[_0x4be5('0x5')](),controller[_0x4be5('0x6')]);router[_0x4be5('0x7')]('/:id',auth[_0x4be5('0x5')](),controller[_0x4be5('0x8')]);router[_0x4be5('0x9')]('/',auth[_0x4be5('0x5')](),controller[_0x4be5('0xa')]);router[_0x4be5('0xb')]('/:id',auth[_0x4be5('0x5')](),controller[_0x4be5('0xc')]);router[_0x4be5('0xd')](_0x4be5('0xe'),auth[_0x4be5('0x5')](),controller[_0x4be5('0xf')]);module[_0x4be5('0x10')]=router; \ No newline at end of file +var _0xbd9e=['index','get','/:id','show','create','put','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','isAuthenticated'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xbd9e,0x108));var _0xebd9=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xbd9e[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebd9('0x0'));var timeout=require('connect-timeout');var express=require(_0xebd9('0x1'));var router=express[_0xebd9('0x2')]();var fs_extra=require(_0xebd9('0x3'));var auth=require(_0xebd9('0x4'));var interaction=require(_0xebd9('0x5'));var config=require('../../config/environment');var controller=require(_0xebd9('0x6'));router['get']('/',auth[_0xebd9('0x7')](),controller[_0xebd9('0x8')]);router[_0xebd9('0x9')](_0xebd9('0xa'),auth[_0xebd9('0x7')](),controller[_0xebd9('0xb')]);router['post']('/',auth[_0xebd9('0x7')](),controller[_0xebd9('0xc')]);router[_0xebd9('0xd')](_0xebd9('0xa'),auth[_0xebd9('0x7')](),controller['update']);router[_0xebd9('0xe')]('/:id',auth[_0xebd9('0x7')](),controller['destroy']);module[_0xebd9('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index fef441d..e3392ac 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 _0x3e65=['STRING','ENUM','localnet','externip'];(function(_0x152cb8,_0x2cd976){var _0x494c94=function(_0x33b057){while(--_0x33b057){_0x152cb8['push'](_0x152cb8['shift']());}};_0x494c94(++_0x2cd976);}(_0x3e65,0x1ad));var _0x53e6=function(_0x33ccb0,_0x47aa54){_0x33ccb0=_0x33ccb0-0x0;var _0x390ed2=_0x3e65[_0x33ccb0];return _0x390ed2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x53e6('0x0')](_0x53e6('0x1'),_0x53e6('0x2'),'stun','turn')},'value':{'type':Sequelize[_0x53e6('0x3')]},'username':{'type':Sequelize[_0x53e6('0x3')]},'password':{'type':Sequelize[_0x53e6('0x3')]}}; \ No newline at end of file +var _0x9047=['turn','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x109c0a,_0x287604){var _0x2e2aa5=function(_0x10e4ed){while(--_0x10e4ed){_0x109c0a['push'](_0x109c0a['shift']());}};_0x2e2aa5(++_0x287604);}(_0x9047,0xdb));var _0x7904=function(_0x3e1465,_0x214d66){_0x3e1465=_0x3e1465-0x0;var _0x34e42d=_0x9047[_0x3e1465];return _0x34e42d;};'use strict';var Sequelize=require(_0x7904('0x0'));module[_0x7904('0x1')]={'type':{'type':Sequelize[_0x7904('0x2')](_0x7904('0x3'),_0x7904('0x4'),'stun',_0x7904('0x5'))},'value':{'type':Sequelize[_0x7904('0x6')]},'username':{'type':Sequelize[_0x7904('0x6')]},'password':{'type':Sequelize[_0x7904('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 004360d..accaf0c 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 _0x9883=['body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','findAll','server/files/templates/turn_multiple.ejs','toLowerCase','util','path','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','http','request','then','info','request\x20sent','debug','error','code','message','Network,\x20%s,\x20%s','result','catch','status','json','limit','undefined','offset','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','rows','show','params','keys','include','find','create'];(function(_0x3cef4d,_0x3f3516){var _0x8c5437=function(_0x12bf9e){while(--_0x12bf9e){_0x3cef4d['push'](_0x3cef4d['shift']());}};_0x8c5437(++_0x3f3516);}(_0x9883,0x6d));var _0x3988=function(_0x332f6c,_0x5f3dec){_0x332f6c=_0x332f6c-0x0;var _0x239327=_0x9883[_0x332f6c];return _0x239327;};'use strict';var util=require(_0x3988('0x0'));var path=require(_0x3988('0x1'));var ejs=require(_0x3988('0x2'));var fs=require('fs');var _=require(_0x3988('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x3988('0x4'))(_0x3988('0x5'));var config=require(_0x3988('0x6'));var db=require(_0x3988('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3988('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x260f9a,_0x1ec9eb,_0x107fd6,_0xb37f43){return new Promise(function(_0xc62e37,_0x48f27a){var _0x379f95=_0xb37f43||client;return _0x379f95[_0x3988('0x9')](_0x260f9a,_0x107fd6)[_0x3988('0xa')](function(_0x273915){logger[_0x3988('0xb')]('Network,\x20%s,\x20%s',_0x1ec9eb,_0x3988('0xc'));logger[_0x3988('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x1ec9eb,_0x3988('0xc'),JSON['stringify'](_0x273915));if(_0x273915[_0x3988('0xe')]){if(_0x273915[_0x3988('0xe')][_0x3988('0xf')]===0x1f4){logger[_0x3988('0xe')]('Network,\x20%s,\x20%s',_0x1ec9eb,_0x273915['error'][_0x3988('0x10')]);return _0x48f27a(_0x273915[_0x3988('0xe')][_0x3988('0x10')]);}logger[_0x3988('0xe')](_0x3988('0x11'),_0x1ec9eb,_0x273915[_0x3988('0xe')][_0x3988('0x10')]);return _0xc62e37(_0x273915[_0x3988('0xe')][_0x3988('0x10')]);}else{logger[_0x3988('0xb')]('Network,\x20%s,\x20%s',_0x1ec9eb,'request\x20sent');_0xc62e37(_0x273915[_0x3988('0x12')][_0x3988('0x10')]);}})[_0x3988('0x13')](function(_0xd19919){logger[_0x3988('0xe')](_0x3988('0x11'),_0x1ec9eb,_0xd19919);_0x48f27a(_0xd19919);});});}function respondWithResult(_0x19421b,_0x65680){_0x65680=_0x65680||0xc8;return function(_0x4b5ae7){if(_0x4b5ae7){return _0x19421b[_0x3988('0x14')](_0x65680)[_0x3988('0x15')](_0x4b5ae7);}};}function respondWithFilteredResult(_0x47735a,_0x1b4d6b){return function(_0x3f929b){if(_0x3f929b){var _0x3beb86=typeof _0x1b4d6b['offset']==='undefined'&&typeof _0x1b4d6b[_0x3988('0x16')]===_0x3988('0x17');var _0x3dd319=_0x3f929b['count'];var _0xaebb2=_0x3beb86?0x0:_0x1b4d6b[_0x3988('0x18')];var _0x5aa8ea=_0x3beb86?_0x3f929b[_0x3988('0x19')]:_0x1b4d6b[_0x3988('0x18')]+_0x1b4d6b[_0x3988('0x16')];var _0x5129d7;if(_0x5aa8ea>=_0x3dd319){_0x5aa8ea=_0x3dd319;_0x5129d7=0xc8;}else{_0x5129d7=0xce;}_0x47735a[_0x3988('0x14')](_0x5129d7);return _0x47735a[_0x3988('0x1a')](_0x3988('0x1b'),_0xaebb2+'-'+_0x5aa8ea+'/'+_0x3dd319)[_0x3988('0x15')](_0x3f929b);}return null;};}function saveUpdates(_0x29152f){return function(_0x2162c7){if(_0x2162c7){return _0x2162c7[_0x3988('0x1c')](_0x29152f)[_0x3988('0xa')](function(_0x268617){return _0x268617;});}return null;};}function removeEntity(_0x390197){return function(_0x1b806a){if(_0x1b806a){return _0x1b806a[_0x3988('0x1d')]()['then'](function(){_0x390197[_0x3988('0x14')](0xcc)[_0x3988('0x1e')]();});}};}function handleEntityNotFound(_0x429df1){return function(_0x580a71){if(!_0x580a71){_0x429df1[_0x3988('0x1f')](0x194);}return _0x580a71;};}function handleError(_0x27b201,_0x41f51a){_0x41f51a=_0x41f51a||0x1f4;return function(_0x4824a3){logger[_0x3988('0xe')](_0x4824a3[_0x3988('0x20')]);if(_0x4824a3['name']){delete _0x4824a3[_0x3988('0x21')];}_0x27b201['status'](_0x41f51a)[_0x3988('0x22')](_0x4824a3);};}exports[_0x3988('0x23')]=function(_0xab14d9,_0x28eb85){var _0x2ad2ee={},_0x1535a5={},_0xd59678={'count':0x0,'rows':[]};var _0x1dc1b1=_[_0x3988('0x24')](db[_0x3988('0x25')][_0x3988('0x26')],function(_0x25776e){return{'name':_0x25776e[_0x3988('0x27')],'type':_0x25776e['type'][_0x3988('0x28')]};});_0x1535a5[_0x3988('0x29')]=_[_0x3988('0x24')](_0x1dc1b1,_0x3988('0x21'));_0x1535a5[_0x3988('0x2a')]=_['keys'](_0xab14d9[_0x3988('0x2a')]);_0x1535a5[_0x3988('0x2b')]=_[_0x3988('0x2c')](_0x1535a5['model'],_0x1535a5[_0x3988('0x2a')]);_0x2ad2ee['attributes']=_[_0x3988('0x2c')](_0x1535a5[_0x3988('0x29')],qs[_0x3988('0x2d')](_0xab14d9['query'][_0x3988('0x2d')]));_0x2ad2ee[_0x3988('0x2e')]=_0x2ad2ee[_0x3988('0x2e')][_0x3988('0x2f')]?_0x2ad2ee[_0x3988('0x2e')]:_0x1535a5[_0x3988('0x29')];if(!_0xab14d9[_0x3988('0x2a')][_0x3988('0x30')](_0x3988('0x31'))){_0x2ad2ee[_0x3988('0x16')]=qs[_0x3988('0x16')](_0xab14d9[_0x3988('0x2a')][_0x3988('0x16')]);_0x2ad2ee[_0x3988('0x18')]=qs[_0x3988('0x18')](_0xab14d9['query'][_0x3988('0x18')]);}_0x2ad2ee[_0x3988('0x32')]=qs[_0x3988('0x33')](_0xab14d9[_0x3988('0x2a')]['sort']);_0x2ad2ee['where']=qs[_0x3988('0x2b')](_['pick'](_0xab14d9[_0x3988('0x2a')],_0x1535a5[_0x3988('0x2b')]),_0x1dc1b1);if(_0xab14d9[_0x3988('0x2a')]['filter']){_0x2ad2ee[_0x3988('0x34')]=_[_0x3988('0x35')](_0x2ad2ee[_0x3988('0x34')],{'$or':_['map'](_0x1dc1b1,function(_0x3aaca8){if(_0x3aaca8[_0x3988('0x36')]!==_0x3988('0x37')){var _0x313fad={};_0x313fad[_0x3aaca8[_0x3988('0x21')]]={'$like':'%'+_0xab14d9[_0x3988('0x2a')]['filter']+'%'};return _0x313fad;}})});}_0x2ad2ee=_['merge']({},_0x2ad2ee,_0xab14d9[_0x3988('0x38')]);var _0x93a3d8={'where':_0x2ad2ee[_0x3988('0x34')]};return db[_0x3988('0x25')][_0x3988('0x19')](_0x93a3d8)[_0x3988('0xa')](function(_0x3541c7){_0xd59678[_0x3988('0x19')]=_0x3541c7;if(_0xab14d9[_0x3988('0x2a')][_0x3988('0x39')]){_0x2ad2ee['include']=[{'all':!![]}];}return db[_0x3988('0x25')]['findAll'](_0x2ad2ee);})[_0x3988('0xa')](function(_0x13f2aa){_0xd59678[_0x3988('0x3a')]=_0x13f2aa;return _0xd59678;})[_0x3988('0xa')](respondWithFilteredResult(_0x28eb85,_0x2ad2ee))[_0x3988('0x13')](handleError(_0x28eb85,null));};exports[_0x3988('0x3b')]=function(_0x29da43,_0x82480b){var _0x30e6af={'raw':!![],'where':{'id':_0x29da43[_0x3988('0x3c')]['id']}},_0x14a533={};_0x14a533[_0x3988('0x29')]=_[_0x3988('0x3d')](db[_0x3988('0x25')][_0x3988('0x26')]);_0x14a533[_0x3988('0x2a')]=_[_0x3988('0x3d')](_0x29da43['query']);_0x14a533[_0x3988('0x2b')]=_[_0x3988('0x2c')](_0x14a533['model'],_0x14a533[_0x3988('0x2a')]);_0x30e6af['attributes']=_['intersection'](_0x14a533[_0x3988('0x29')],qs[_0x3988('0x2d')](_0x29da43[_0x3988('0x2a')][_0x3988('0x2d')]));_0x30e6af[_0x3988('0x2e')]=_0x30e6af[_0x3988('0x2e')]['length']?_0x30e6af[_0x3988('0x2e')]:_0x14a533[_0x3988('0x29')];if(_0x29da43[_0x3988('0x2a')][_0x3988('0x39')]){_0x30e6af[_0x3988('0x3e')]=[{'all':!![]}];}_0x30e6af=_[_0x3988('0x35')]({},_0x30e6af,_0x29da43['options']);return db[_0x3988('0x25')][_0x3988('0x3f')](_0x30e6af)[_0x3988('0xa')](handleEntityNotFound(_0x82480b,null))[_0x3988('0xa')](respondWithResult(_0x82480b,null))[_0x3988('0x13')](handleError(_0x82480b,null));};exports[_0x3988('0x40')]=function(_0x55d7fd,_0x1ea514){var _0x51f439;return db['Network'][_0x3988('0x40')](_0x55d7fd['body'],{'raw':!![]})[_0x3988('0xa')](function(_0x2652e1){_0x51f439=_0x2652e1;return db[_0x3988('0x25')]['findAll']({'where':{'type':_0x55d7fd[_0x3988('0x41')][_0x3988('0x36')]},'raw':!![]});})['then'](function(_0x4d3133){if(_0x51f439[_0x3988('0x36')][_0x3988('0x42')]()==_0x3988('0x43')){var _0x495324=fs[_0x3988('0x44')](path[_0x3988('0x45')](config[_0x3988('0x46')],_0x3988('0x47')),_0x3988('0x48'));var _0x25620d=ejs[_0x3988('0x49')](_0x495324,{'networks':_0x4d3133||[]});fs[_0x3988('0x4a')](_0x3988('0x4b'),_0x25620d);return respondWithRpcPromise(_0x3988('0x4c'),'create',{'module':_0x3988('0x4d')});}else if(_0x51f439['type'][_0x3988('0x42')]()==_0x3988('0x4e')){var _0xebae87=fs[_0x3988('0x44')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x3988('0x48'));var _0x2d4dbf=ejs[_0x3988('0x49')](_0xebae87,{'networks':_0x4d3133||[]});fs[_0x3988('0x4a')](_0x3988('0x4f'),_0x2d4dbf);return respondWithRpcPromise(_0x3988('0x4c'),'create',{'module':_0x3988('0x4d')});}else{var _0x4bbf42=fs[_0x3988('0x44')](path[_0x3988('0x45')](config[_0x3988('0x46')],_0x3988('0x50')),_0x3988('0x48'));var _0x1c3bed=ejs['render'](_0x4bbf42,{'networks':_0x4d3133||[]});fs['writeFileSync'](util[_0x3988('0x51')](_0x3988('0x52'),_0x55d7fd['body'][_0x3988('0x36')]['toLowerCase']()),_0x1c3bed);return respondWithRpcPromise(_0x3988('0x4c'),'create',{'module':_0x3988('0x53')});}})['then'](function(){return _0x51f439;})[_0x3988('0xa')](respondWithResult(_0x1ea514,0xc9))[_0x3988('0x13')](handleError(_0x1ea514,null));};exports[_0x3988('0x1c')]=function(_0x5aba50,_0x4935f9){var _0x3387b6;return db[_0x3988('0x25')][_0x3988('0x3f')]({'where':{'id':_0x5aba50[_0x3988('0x3c')]['id']}})[_0x3988('0xa')](handleEntityNotFound(_0x4935f9,null))['then'](saveUpdates(_0x5aba50[_0x3988('0x41')],null))[_0x3988('0xa')](function(_0x45f871){if(_0x45f871){_0x3387b6=_0x45f871;return db[_0x3988('0x25')][_0x3988('0x54')]({'where':{'type':_0x3387b6['type']},'raw':!![]});}return null;})[_0x3988('0xa')](function(_0x273e5c){if(_0x3387b6[_0x3988('0x36')]['toUpperCase']()=='STUN'){var _0x452677=fs[_0x3988('0x44')](path[_0x3988('0x45')](config['root'],_0x3988('0x47')),'utf8');var _0xd26cd2=ejs[_0x3988('0x49')](_0x452677,{'networks':_0x273e5c||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0xd26cd2);return respondWithRpcPromise(_0x3988('0x4c'),_0x3988('0x1c'),{'module':_0x3988('0x4d')});}else if(_0x3387b6[_0x3988('0x36')][_0x3988('0x42')]()==_0x3988('0x4e')){var _0x2d505e=fs['readFileSync'](path['join'](config['root'],_0x3988('0x55')),_0x3988('0x48'));var _0x5d2bbe=ejs['render'](_0x2d505e,{'networks':_0x273e5c||[]});fs[_0x3988('0x4a')]('/etc/asterisk/turn_xcally.conf',_0x5d2bbe);return respondWithRpcPromise(_0x3988('0x4c'),_0x3988('0x1c'),{'module':_0x3988('0x4d')});}else{var _0x1ec2fa=fs[_0x3988('0x44')](path['join'](config['root'],_0x3988('0x50')),_0x3988('0x48'));var _0x43c358=ejs[_0x3988('0x49')](_0x1ec2fa,{'networks':_0x273e5c||[]});fs['writeFileSync'](util[_0x3988('0x51')](_0x3988('0x52'),_0x5aba50[_0x3988('0x41')]['type'][_0x3988('0x56')]()),_0x43c358);return respondWithRpcPromise(_0x3988('0x4c'),'update',{'module':_0x3988('0x53')});}})[_0x3988('0xa')](function(_0x226d76){if(_0x226d76){return _0x3387b6;}return null;})[_0x3988('0xa')](respondWithResult(_0x4935f9,null))[_0x3988('0x13')](handleError(_0x4935f9,null));};exports[_0x3988('0x1d')]=function(_0xd9eeb3,_0x125867){var _0xa080f5;return db[_0x3988('0x25')][_0x3988('0x3f')]({'where':{'id':_0xd9eeb3[_0x3988('0x3c')]['id']}})[_0x3988('0xa')](function(_0x56d756){_0xa080f5=_0x56d756;return _0x56d756;})[_0x3988('0xa')](handleEntityNotFound(_0x125867,null))[_0x3988('0xa')](removeEntity(_0x125867,null))[_0x3988('0xa')](function(){if(_0xa080f5){return db[_0x3988('0x25')]['findAll']({'where':{'type':_0xa080f5[_0x3988('0x36')]},'raw':!![]});}})[_0x3988('0xa')](function(_0x3e8989){if(_0xa080f5[_0x3988('0x36')]['toUpperCase']()=='STUN'){var _0x96836b=fs[_0x3988('0x44')](path[_0x3988('0x45')](config['root'],_0x3988('0x47')),_0x3988('0x48'));var _0x3986c1=ejs['render'](_0x96836b,{'networks':_0x3e8989||[]});fs[_0x3988('0x4a')]('/etc/asterisk/stun_xcally.conf',_0x3986c1);return respondWithRpcPromise(_0x3988('0x4c'),_0x3988('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0xa080f5[_0x3988('0x36')][_0x3988('0x42')]()==_0x3988('0x4e')){var _0x18c5c3=fs['readFileSync'](path[_0x3988('0x45')](config[_0x3988('0x46')],_0x3988('0x55')),_0x3988('0x48'));var _0x59f296=ejs[_0x3988('0x49')](_0x18c5c3,{'networks':_0x3e8989||[]});fs[_0x3988('0x4a')](_0x3988('0x4f'),_0x59f296);return respondWithRpcPromise(_0x3988('0x4c'),_0x3988('0x1d'),{'module':_0x3988('0x4d')});}else{var _0x42342c=fs[_0x3988('0x44')](path[_0x3988('0x45')](config['root'],_0x3988('0x50')),_0x3988('0x48'));var _0x35a10f=ejs['render'](_0x42342c,{'networks':_0x3e8989||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xa080f5[_0x3988('0x36')][_0x3988('0x56')]()),_0x35a10f);return respondWithRpcPromise(_0x3988('0x4c'),_0x3988('0x1d'),{'module':_0x3988('0x53')});}})[_0x3988('0x13')](handleError(_0x125867,null));}; \ No newline at end of file +var _0xa171=['jayson/promise','http','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','offset','undefined','limit','count','Content-Range','json','update','destroy','sendStatus','send','index','map','rawAttributes','fieldName','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Network','include','findAll','rows','show','params','includeAll','find','create','body','type','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','root','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x213c34,_0x5ada0d){var _0x3c7bec=function(_0x362b8e){while(--_0x362b8e){_0x213c34['push'](_0x213c34['shift']());}};_0x3c7bec(++_0x5ada0d);}(_0xa171,0xfd));var _0x1a17=function(_0x417ea3,_0x156e87){_0x417ea3=_0x417ea3-0x0;var _0x18c29d=_0xa171[_0x417ea3];return _0x18c29d;};'use strict';var util=require('util');var path=require(_0x1a17('0x0'));var ejs=require(_0x1a17('0x1'));var fs=require('fs');var _=require(_0x1a17('0x2'));var qs=require(_0x1a17('0x3'));var logger=require(_0x1a17('0x4'))(_0x1a17('0x5'));var config=require(_0x1a17('0x6'));var db=require(_0x1a17('0x7'))['db'];var jayson=require(_0x1a17('0x8'));var client=jayson['client'][_0x1a17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d63b2,_0x5d50e6,_0x2be9df,_0x3b4d85){return new Promise(function(_0x5760ad,_0x3f8b3e){var _0x130b85=_0x3b4d85||client;return _0x130b85['request'](_0x3d63b2,_0x2be9df)[_0x1a17('0xa')](function(_0x254c8c){logger[_0x1a17('0xb')](_0x1a17('0xc'),_0x5d50e6,'request\x20sent');logger['debug'](_0x1a17('0xd'),_0x5d50e6,'request\x20sent',JSON[_0x1a17('0xe')](_0x254c8c));if(_0x254c8c[_0x1a17('0xf')]){if(_0x254c8c[_0x1a17('0xf')][_0x1a17('0x10')]===0x1f4){logger['error'](_0x1a17('0xc'),_0x5d50e6,_0x254c8c[_0x1a17('0xf')]['message']);return _0x3f8b3e(_0x254c8c['error'][_0x1a17('0x11')]);}logger[_0x1a17('0xf')](_0x1a17('0xc'),_0x5d50e6,_0x254c8c['error'][_0x1a17('0x11')]);return _0x5760ad(_0x254c8c[_0x1a17('0xf')][_0x1a17('0x11')]);}else{logger['info'](_0x1a17('0xc'),_0x5d50e6,_0x1a17('0x12'));_0x5760ad(_0x254c8c[_0x1a17('0x13')][_0x1a17('0x11')]);}})[_0x1a17('0x14')](function(_0xb01899){logger[_0x1a17('0xf')](_0x1a17('0xc'),_0x5d50e6,_0xb01899);_0x3f8b3e(_0xb01899);});});}function respondWithResult(_0x15e368,_0x3786ad){_0x3786ad=_0x3786ad||0xc8;return function(_0x28a5a0){if(_0x28a5a0){return _0x15e368[_0x1a17('0x15')](_0x3786ad)['json'](_0x28a5a0);}};}function respondWithFilteredResult(_0xf0e9f8,_0x33aca4){return function(_0xbf1182){if(_0xbf1182){var _0x5c175c=typeof _0x33aca4[_0x1a17('0x16')]===_0x1a17('0x17')&&typeof _0x33aca4[_0x1a17('0x18')]===_0x1a17('0x17');var _0x2b0068=_0xbf1182[_0x1a17('0x19')];var _0x3eef26=_0x5c175c?0x0:_0x33aca4[_0x1a17('0x16')];var _0x369dc0=_0x5c175c?_0xbf1182[_0x1a17('0x19')]:_0x33aca4[_0x1a17('0x16')]+_0x33aca4[_0x1a17('0x18')];var _0x20d9b2;if(_0x369dc0>=_0x2b0068){_0x369dc0=_0x2b0068;_0x20d9b2=0xc8;}else{_0x20d9b2=0xce;}_0xf0e9f8[_0x1a17('0x15')](_0x20d9b2);return _0xf0e9f8['set'](_0x1a17('0x1a'),_0x3eef26+'-'+_0x369dc0+'/'+_0x2b0068)[_0x1a17('0x1b')](_0xbf1182);}return null;};}function saveUpdates(_0x4929e9){return function(_0x407adb){if(_0x407adb){return _0x407adb[_0x1a17('0x1c')](_0x4929e9)[_0x1a17('0xa')](function(_0x90269d){return _0x90269d;});}return null;};}function removeEntity(_0x21df70){return function(_0x359160){if(_0x359160){return _0x359160[_0x1a17('0x1d')]()[_0x1a17('0xa')](function(){_0x21df70['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cddc7){return function(_0x1adced){if(!_0x1adced){_0x5cddc7[_0x1a17('0x1e')](0x194);}return _0x1adced;};}function handleError(_0x108264,_0x598954){_0x598954=_0x598954||0x1f4;return function(_0x4dc6c0){logger[_0x1a17('0xf')](_0x4dc6c0['stack']);if(_0x4dc6c0['name']){delete _0x4dc6c0['name'];}_0x108264['status'](_0x598954)[_0x1a17('0x1f')](_0x4dc6c0);};}exports[_0x1a17('0x20')]=function(_0x1be694,_0x47afeb){var _0x34642b={},_0x4d48f4={},_0xc89a2a={'count':0x0,'rows':[]};var _0x57486a=_[_0x1a17('0x21')](db['Network'][_0x1a17('0x22')],function(_0x5167e2){return{'name':_0x5167e2[_0x1a17('0x23')],'type':_0x5167e2['type'][_0x1a17('0x24')]};});_0x4d48f4[_0x1a17('0x25')]=_[_0x1a17('0x21')](_0x57486a,_0x1a17('0x26'));_0x4d48f4['query']=_[_0x1a17('0x27')](_0x1be694['query']);_0x4d48f4[_0x1a17('0x28')]=_[_0x1a17('0x29')](_0x4d48f4[_0x1a17('0x25')],_0x4d48f4[_0x1a17('0x2a')]);_0x34642b[_0x1a17('0x2b')]=_[_0x1a17('0x29')](_0x4d48f4[_0x1a17('0x25')],qs[_0x1a17('0x2c')](_0x1be694['query'][_0x1a17('0x2c')]));_0x34642b[_0x1a17('0x2b')]=_0x34642b[_0x1a17('0x2b')][_0x1a17('0x2d')]?_0x34642b['attributes']:_0x4d48f4['model'];if(!_0x1be694['query'][_0x1a17('0x2e')](_0x1a17('0x2f'))){_0x34642b[_0x1a17('0x18')]=qs['limit'](_0x1be694[_0x1a17('0x2a')]['limit']);_0x34642b[_0x1a17('0x16')]=qs[_0x1a17('0x16')](_0x1be694[_0x1a17('0x2a')][_0x1a17('0x16')]);}_0x34642b[_0x1a17('0x30')]=qs[_0x1a17('0x31')](_0x1be694[_0x1a17('0x2a')][_0x1a17('0x31')]);_0x34642b[_0x1a17('0x32')]=qs[_0x1a17('0x28')](_[_0x1a17('0x33')](_0x1be694[_0x1a17('0x2a')],_0x4d48f4[_0x1a17('0x28')]),_0x57486a);if(_0x1be694[_0x1a17('0x2a')][_0x1a17('0x34')]){_0x34642b[_0x1a17('0x32')]=_[_0x1a17('0x35')](_0x34642b['where'],{'$or':_[_0x1a17('0x21')](_0x57486a,function(_0x241f2a){if(_0x241f2a['type']!==_0x1a17('0x36')){var _0x1d517f={};_0x1d517f[_0x241f2a['name']]={'$like':'%'+_0x1be694['query'][_0x1a17('0x34')]+'%'};return _0x1d517f;}})});}_0x34642b=_[_0x1a17('0x35')]({},_0x34642b,_0x1be694[_0x1a17('0x37')]);var _0x465f22={'where':_0x34642b[_0x1a17('0x32')]};return db[_0x1a17('0x38')]['count'](_0x465f22)[_0x1a17('0xa')](function(_0x61f472){_0xc89a2a[_0x1a17('0x19')]=_0x61f472;if(_0x1be694[_0x1a17('0x2a')]['includeAll']){_0x34642b[_0x1a17('0x39')]=[{'all':!![]}];}return db[_0x1a17('0x38')][_0x1a17('0x3a')](_0x34642b);})[_0x1a17('0xa')](function(_0x415f26){_0xc89a2a[_0x1a17('0x3b')]=_0x415f26;return _0xc89a2a;})[_0x1a17('0xa')](respondWithFilteredResult(_0x47afeb,_0x34642b))[_0x1a17('0x14')](handleError(_0x47afeb,null));};exports[_0x1a17('0x3c')]=function(_0x1eee42,_0x20ad75){var _0x8a678e={'raw':!![],'where':{'id':_0x1eee42[_0x1a17('0x3d')]['id']}},_0x1af51a={};_0x1af51a[_0x1a17('0x25')]=_[_0x1a17('0x27')](db['Network'][_0x1a17('0x22')]);_0x1af51a[_0x1a17('0x2a')]=_[_0x1a17('0x27')](_0x1eee42['query']);_0x1af51a[_0x1a17('0x28')]=_['intersection'](_0x1af51a[_0x1a17('0x25')],_0x1af51a[_0x1a17('0x2a')]);_0x8a678e[_0x1a17('0x2b')]=_[_0x1a17('0x29')](_0x1af51a['model'],qs[_0x1a17('0x2c')](_0x1eee42['query'][_0x1a17('0x2c')]));_0x8a678e[_0x1a17('0x2b')]=_0x8a678e[_0x1a17('0x2b')][_0x1a17('0x2d')]?_0x8a678e['attributes']:_0x1af51a['model'];if(_0x1eee42[_0x1a17('0x2a')][_0x1a17('0x3e')]){_0x8a678e[_0x1a17('0x39')]=[{'all':!![]}];}_0x8a678e=_[_0x1a17('0x35')]({},_0x8a678e,_0x1eee42['options']);return db[_0x1a17('0x38')][_0x1a17('0x3f')](_0x8a678e)[_0x1a17('0xa')](handleEntityNotFound(_0x20ad75,null))[_0x1a17('0xa')](respondWithResult(_0x20ad75,null))['catch'](handleError(_0x20ad75,null));};exports[_0x1a17('0x40')]=function(_0xf1e364,_0x20e596){var _0x4ef9e7;return db[_0x1a17('0x38')][_0x1a17('0x40')](_0xf1e364[_0x1a17('0x41')],{'raw':!![]})['then'](function(_0x4bd6a0){_0x4ef9e7=_0x4bd6a0;return db['Network'][_0x1a17('0x3a')]({'where':{'type':_0xf1e364[_0x1a17('0x41')][_0x1a17('0x42')]},'raw':!![]});})['then'](function(_0x4c4857){if(_0x4ef9e7[_0x1a17('0x42')][_0x1a17('0x43')]()==_0x1a17('0x44')){var _0x1b7e0b=fs['readFileSync'](path[_0x1a17('0x45')](config['root'],_0x1a17('0x46')),_0x1a17('0x47'));var _0x8e1871=ejs[_0x1a17('0x48')](_0x1b7e0b,{'networks':_0x4c4857||[]});fs[_0x1a17('0x49')](_0x1a17('0x4a'),_0x8e1871);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x40'),{'module':_0x1a17('0x4c')});}else if(_0x4ef9e7['type'][_0x1a17('0x43')]()==_0x1a17('0x4d')){var _0x384dbb=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],'server/files/templates/turn_multiple.ejs'),_0x1a17('0x47'));var _0x290a8d=ejs['render'](_0x384dbb,{'networks':_0x4c4857||[]});fs[_0x1a17('0x49')](_0x1a17('0x50'),_0x290a8d);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x40'),{'module':_0x1a17('0x4c')});}else{var _0x8fb6fc=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x51')),_0x1a17('0x47'));var _0x4a223f=ejs[_0x1a17('0x48')](_0x8fb6fc,{'networks':_0x4c4857||[]});fs['writeFileSync'](util[_0x1a17('0x52')](_0x1a17('0x53'),_0xf1e364[_0x1a17('0x41')][_0x1a17('0x42')][_0x1a17('0x54')]()),_0x4a223f);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x40'),{'module':_0x1a17('0x55')});}})[_0x1a17('0xa')](function(){return _0x4ef9e7;})[_0x1a17('0xa')](respondWithResult(_0x20e596,0xc9))['catch'](handleError(_0x20e596,null));};exports['update']=function(_0x446524,_0x32da89){var _0xa4eb25;return db[_0x1a17('0x38')][_0x1a17('0x3f')]({'where':{'id':_0x446524[_0x1a17('0x3d')]['id']}})['then'](handleEntityNotFound(_0x32da89,null))[_0x1a17('0xa')](saveUpdates(_0x446524['body'],null))['then'](function(_0x4dc3d6){if(_0x4dc3d6){_0xa4eb25=_0x4dc3d6;return db[_0x1a17('0x38')][_0x1a17('0x3a')]({'where':{'type':_0xa4eb25[_0x1a17('0x42')]},'raw':!![]});}return null;})[_0x1a17('0xa')](function(_0x24b914){if(_0xa4eb25[_0x1a17('0x42')][_0x1a17('0x43')]()==_0x1a17('0x44')){var _0x149f1c=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x46')),_0x1a17('0x47'));var _0x2c98cc=ejs['render'](_0x149f1c,{'networks':_0x24b914||[]});fs[_0x1a17('0x49')](_0x1a17('0x4a'),_0x2c98cc);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x1c'),{'module':_0x1a17('0x4c')});}else if(_0xa4eb25[_0x1a17('0x42')][_0x1a17('0x43')]()=='TURN'){var _0x393c4e=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x56')),_0x1a17('0x47'));var _0x1aa7a3=ejs[_0x1a17('0x48')](_0x393c4e,{'networks':_0x24b914||[]});fs[_0x1a17('0x49')](_0x1a17('0x50'),_0x1aa7a3);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x1c'),{'module':_0x1a17('0x4c')});}else{var _0x37db63=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x51')),_0x1a17('0x47'));var _0x5ba381=ejs[_0x1a17('0x48')](_0x37db63,{'networks':_0x24b914||[]});fs['writeFileSync'](util[_0x1a17('0x52')](_0x1a17('0x53'),_0x446524[_0x1a17('0x41')][_0x1a17('0x42')][_0x1a17('0x54')]()),_0x5ba381);return respondWithRpcPromise(_0x1a17('0x4b'),'update',{'module':_0x1a17('0x55')});}})[_0x1a17('0xa')](function(_0x414208){if(_0x414208){return _0xa4eb25;}return null;})[_0x1a17('0xa')](respondWithResult(_0x32da89,null))[_0x1a17('0x14')](handleError(_0x32da89,null));};exports[_0x1a17('0x1d')]=function(_0x55f5b5,_0x2b029d){var _0x43e9be;return db['Network'][_0x1a17('0x3f')]({'where':{'id':_0x55f5b5[_0x1a17('0x3d')]['id']}})['then'](function(_0x516d7b){_0x43e9be=_0x516d7b;return _0x516d7b;})[_0x1a17('0xa')](handleEntityNotFound(_0x2b029d,null))[_0x1a17('0xa')](removeEntity(_0x2b029d,null))['then'](function(){if(_0x43e9be){return db[_0x1a17('0x38')][_0x1a17('0x3a')]({'where':{'type':_0x43e9be[_0x1a17('0x42')]},'raw':!![]});}})[_0x1a17('0xa')](function(_0x272cae){if(_0x43e9be['type'][_0x1a17('0x43')]()=='STUN'){var _0x472cba=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x46')),'utf8');var _0x207b8e=ejs[_0x1a17('0x48')](_0x472cba,{'networks':_0x272cae||[]});fs[_0x1a17('0x49')](_0x1a17('0x4a'),_0x207b8e);return respondWithRpcPromise('Reload',_0x1a17('0x1d'),{'module':_0x1a17('0x4c')});}else if(_0x43e9be[_0x1a17('0x42')][_0x1a17('0x43')]()==_0x1a17('0x4d')){var _0x11e45d=fs[_0x1a17('0x4e')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x1a17('0x47'));var _0x33609d=ejs['render'](_0x11e45d,{'networks':_0x272cae||[]});fs['writeFileSync'](_0x1a17('0x50'),_0x33609d);return respondWithRpcPromise('Reload',_0x1a17('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x4dfbe8=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x51')),_0x1a17('0x47'));var _0x40520e=ejs[_0x1a17('0x48')](_0x4dfbe8,{'networks':_0x272cae||[]});fs['writeFileSync'](util[_0x1a17('0x52')](_0x1a17('0x53'),_0x43e9be[_0x1a17('0x42')]['toLowerCase']()),_0x40520e);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x1d'),{'module':_0x1a17('0x55')});}})['catch'](handleError(_0x2b029d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 4d0b4e7..f6f3129 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 _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./network.attributes','define','Network'];(function(_0x277bfb,_0x30e01a){var _0x2079dc=function(_0x2a4cc1){while(--_0x2a4cc1){_0x277bfb['push'](_0x277bfb['shift']());}};_0x2079dc(++_0x30e01a);}(_0x99e9,0xb4));var _0x999e=function(_0x38ae4f,_0x1d3180){_0x38ae4f=_0x38ae4f-0x0;var _0x1e92db=_0x99e9[_0x38ae4f];return _0x1e92db;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd547=['define','../../config/logger','api','moment','bluebird','rimraf','./network.attributes'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xd547,0x1c1));var _0x7d54=function(_0x3c4322,_0x145a37){_0x3c4322=_0x3c4322-0x0;var _0x225310=_0xd547[_0x3c4322];return _0x225310;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d54('0x0'))(_0x7d54('0x1'));var moment=require(_0x7d54('0x2'));var BPromise=require(_0x7d54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d54('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x5'));module['exports']=function(_0x296dd6,_0x37defc){return _0x296dd6[_0x7d54('0x6')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 98e2dff..eb219a0 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3f96df,_0xd87399){var _0x88f46=function(_0x9ab960){while(--_0x9ab960){_0x3f96df['push'](_0x3f96df['shift']());}};_0x88f46(++_0xd87399);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x508984,_0x35201b){_0x508984=_0x508984-0x0;var _0x2d0a3f=_0x7a54[_0x508984];return _0x2d0a3f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 611b9ef..cf09d85 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 _0x5f2f=['./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','addAgents','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3432b0,_0x5f3622){var _0x483ca7=function(_0x15f8c6){while(--_0x15f8c6){_0x3432b0['push'](_0x3432b0['shift']());}};_0x483ca7(++_0x5f3622);}(_0x5f2f,0x73));var _0xf5f2=function(_0xa3b5cb,_0xf15eca){_0xa3b5cb=_0xa3b5cb-0x0;var _0x43d598=_0x5f2f[_0xa3b5cb];return _0x43d598;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/canned_answers',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['get'](_0xf5f2('0x13'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);router[_0xf5f2('0x9')](_0xf5f2('0x15'),auth[_0xf5f2('0xa')](),controller['getInteractions']);router[_0xf5f2('0x9')](_0xf5f2('0x16'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x18')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x18')](_0xf5f2('0x10'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x18')](_0xf5f2('0x1b'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x18')](_0xf5f2('0x1d'),controller[_0xf5f2('0x1e')]);router[_0xf5f2('0x18')](_0xf5f2('0x13'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1f')]);router[_0xf5f2('0x18')]('/:id/users',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x20')]);router['post']('/:id/send',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x21')]);router['put'](_0xf5f2('0xe'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x22')]);router[_0xf5f2('0x23')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0x24')]);router[_0xf5f2('0x23')](_0xf5f2('0x10'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x25')]);router['delete']('/:id/canned_answers',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x26')]);router[_0xf5f2('0x23')](_0xf5f2('0x16'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x27')]);module[_0xf5f2('0x28')]=router; \ No newline at end of file +var _0xb10b=['show','/:id/dispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x2f9b52,_0x124e9c){var _0x42706a=function(_0x50711a){while(--_0x50711a){_0x2f9b52['push'](_0x2f9b52['shift']());}};_0x42706a(++_0x124e9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xb10b[_0x41c381];return _0x427981;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getAnswers']);router[_0xbb10('0x9')]('/:id/applications',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x16')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x16')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x18')]);router['post'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);router[_0xbb10('0x16')](_0xbb10('0x1a'),controller[_0xbb10('0x1b')]);router[_0xbb10('0x16')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['post'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x16')](_0xbb10('0x1f'),auth[_0xbb10('0xb')](),controller['send']);router[_0xbb10('0x20')](_0xbb10('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xbb10('0x21')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x22')]);router[_0xbb10('0x21')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x23')]);router[_0xbb10('0x21')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xbb10('0x25')]);module[_0xbb10('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index f43ce13..cff486a 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 _0xfdff=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x12c289,_0x3376b8){var _0x9e28d5=function(_0x33cb58){while(--_0x33cb58){_0x12c289['push'](_0x12c289['shift']());}};_0x9e28d5(++_0x3376b8);}(_0xfdff,0x19a));var _0xffdf=function(_0x303a0c,_0x597a64){_0x303a0c=_0x303a0c-0x0;var _0x47aaf7=_0xfdff[_0x303a0c];return _0x47aaf7;};'use strict';var Sequelize=require(_0xffdf('0x0'));var rs=require('randomstring');module[_0xffdf('0x1')]={'name':{'type':Sequelize[_0xffdf('0x2')],'unique':_0xffdf('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xffdf('0x2')],'defaultValue':function(){return rs[_0xffdf('0x4')]();}},'replyUri':{'type':Sequelize[_0xffdf('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xffdf('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xffdf('0x5');}},'notificationSound':{'type':Sequelize[_0xffdf('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xffdf('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xffdf('0x2')]},'queueTransfer':{'type':Sequelize[_0xffdf('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xffdf('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xffdf('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xffdf('0x6')],'defaultValue':![],'comment':_0xffdf('0x8'),'set':function(_0xcdef6f){if(!_0xcdef6f)this[_0xffdf('0x9')](_0xffdf('0xa'),null);this['setDataValue'](_0xffdf('0xb'),_0xcdef6f);}}}; \ No newline at end of file +var _0xa5a1=['name','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','exports','STRING'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xa5a1,0x154));var _0x1a5a=function(_0x1ca8dd,_0x2b2f46){_0x1ca8dd=_0x1ca8dd-0x0;var _0x26e5bf=_0xa5a1[_0x1ca8dd];return _0x26e5bf;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1a5a('0x0')]={'name':{'type':Sequelize[_0x1a5a('0x1')],'unique':_0x1a5a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1a5a('0x1')]},'token':{'type':Sequelize[_0x1a5a('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1a5a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1a5a('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a5a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1a5a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a5a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a5a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1a5a('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x78f673){if(!_0x78f673)this[_0x1a5a('0x7')](_0x1a5a('0x8'),null);this[_0x1a5a('0x7')]('mandatoryDisposition',_0x78f673);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index e3e4191..784bfa8 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 _0x3c03=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','get','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','show','params','mandatoryDispositionPause','find','create','user','role','UserProfileSection','autoAssociation','body','describe','Disposition','getDispositions','findOne','length','hasOwnProperty','ids','OpenchannelAccountId','CannedAnswer','getAnswers','pick','includeAll','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','list','applications','orderBy','priority','account','Applications','lastName','threadId','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','CmList','out','OpenchannelMessage','dataValues','Messages','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x4f39b8,_0x2d685e){var _0x297147=function(_0x3a0862){while(--_0x3a0862){_0x4f39b8['push'](_0x4f39b8['shift']());}};_0x297147(++_0x2d685e);}(_0x3c03,0x16d));var _0x33c0=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x3c03[_0x47a349];return _0x18ab75;};'use strict';var emlformat=require(_0x33c0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x33c0('0x1'));var moment=require(_0x33c0('0x2'));var BPromise=require(_0x33c0('0x3'));var Mustache=require(_0x33c0('0x4'));var util=require('util');var path=require(_0x33c0('0x5'));var sox=require(_0x33c0('0x6'));var csv=require(_0x33c0('0x7'));var ejs=require(_0x33c0('0x8'));var fs=require('fs');var fs_extra=require(_0x33c0('0x9'));var _=require(_0x33c0('0xa'));var squel=require(_0x33c0('0xb'));var crypto=require('crypto');var jsforce=require(_0x33c0('0xc'));var deskjs=require(_0x33c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x33c0('0xe'));var Papa=require(_0x33c0('0xf'));var Redis=require('ioredis');var authService=require(_0x33c0('0x10'));var qs=require(_0x33c0('0x11'));var as=require(_0x33c0('0x12'));var hardwareService=require(_0x33c0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x33c0('0x14'));var config=require(_0x33c0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x33c0('0x16')](config[_0x33c0('0x17')],{'host':_0x33c0('0x18'),'port':0x18eb});var socket=require(_0x33c0('0x19'))(new Redis(config[_0x33c0('0x17')]));require(_0x33c0('0x1a'))['register'](socket);var jayson=require(_0x33c0('0x1b'));var client=jayson[_0x33c0('0x1c')][_0x33c0('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x33c0('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x58c21e,_0x1e4134,_0x5a88cb,_0x115715){return new BPromise(function(_0x3e208a,_0x341302){var _0x1729b9=_0x115715||client;return _0x1729b9[_0x33c0('0x1e')](_0x58c21e,_0x5a88cb)[_0x33c0('0x1f')](function(_0x4a1fd3){logger[_0x33c0('0x20')](_0x33c0('0x21'),_0x1e4134,_0x33c0('0x22'));logger[_0x33c0('0x23')](_0x33c0('0x24'),_0x1e4134,_0x33c0('0x22'),JSON['stringify'](_0x4a1fd3));if(_0x4a1fd3[_0x33c0('0x25')]){if(_0x4a1fd3[_0x33c0('0x25')][_0x33c0('0x26')]===0x1f4){logger[_0x33c0('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x1e4134,_0x4a1fd3[_0x33c0('0x25')][_0x33c0('0x27')]);return _0x341302(_0x4a1fd3[_0x33c0('0x25')][_0x33c0('0x27')]);}logger[_0x33c0('0x25')](_0x33c0('0x21'),_0x1e4134,_0x4a1fd3[_0x33c0('0x25')][_0x33c0('0x27')]);return _0x3e208a(_0x4a1fd3[_0x33c0('0x25')][_0x33c0('0x27')]);}else{logger[_0x33c0('0x20')](_0x33c0('0x21'),_0x1e4134,_0x33c0('0x22'));_0x3e208a(_0x4a1fd3[_0x33c0('0x28')]['message']);}})[_0x33c0('0x29')](function(_0x2b1af2){logger[_0x33c0('0x25')](_0x33c0('0x21'),_0x1e4134,_0x2b1af2);_0x341302(_0x2b1af2);});});}function respondWithStatusCode(_0x4ac4ff,_0x2505db){_0x2505db=_0x2505db||0xcc;return function(_0x2e603f){if(_0x2e603f){return _0x4ac4ff[_0x33c0('0x2a')](_0x2505db);}return _0x4ac4ff[_0x33c0('0x2b')](_0x2505db)[_0x33c0('0x2c')]();};}function respondWithResult(_0x4f6d3b,_0x547675){_0x547675=_0x547675||0xc8;return function(_0x5f3720){if(_0x5f3720){return _0x4f6d3b[_0x33c0('0x2b')](_0x547675)[_0x33c0('0x2d')](_0x5f3720);}};}function respondWithFilteredResult(_0x254830,_0x1358c9){return function(_0x6e93f9){if(_0x6e93f9){var _0x4059dc=typeof _0x1358c9[_0x33c0('0x2e')]==='undefined'&&typeof _0x1358c9[_0x33c0('0x2f')]==='undefined';var _0x23ae3f=_0x6e93f9[_0x33c0('0x30')];var _0x25b91a=_0x4059dc?0x0:_0x1358c9[_0x33c0('0x2e')];var _0x483461=_0x4059dc?_0x6e93f9[_0x33c0('0x30')]:_0x1358c9[_0x33c0('0x2e')]+_0x1358c9[_0x33c0('0x2f')];var _0x3419da;if(_0x483461>=_0x23ae3f){_0x483461=_0x23ae3f;_0x3419da=0xc8;}else{_0x3419da=0xce;}_0x254830[_0x33c0('0x2b')](_0x3419da);return _0x254830['set'](_0x33c0('0x31'),_0x25b91a+'-'+_0x483461+'/'+_0x23ae3f)[_0x33c0('0x2d')](_0x6e93f9);}return null;};}function patchUpdates(_0x5fe38c){return function(_0x2933b3){try{jsonpatch[_0x33c0('0x32')](_0x2933b3,_0x5fe38c,!![]);}catch(_0x2d84e4){return BPromise[_0x33c0('0x33')](_0x2d84e4);}return _0x2933b3[_0x33c0('0x34')]();};}function saveUpdates(_0x1b63bb,_0xc9c56b){return function(_0x25a117){if(_0x25a117){return _0x25a117[_0x33c0('0x35')](_0x1b63bb)[_0x33c0('0x1f')](function(_0x364813){return _0x364813;});}return null;};}function removeEntity(_0xf65e1d,_0x15eeca){return function(_0x931cce){if(_0x931cce){return _0x931cce[_0x33c0('0x36')]()[_0x33c0('0x1f')](function(){var _0x556d70=_0x931cce[_0x33c0('0x37')]({'plain':!![]});var _0x105084='OpenchannelAccounts';return db['UserProfileResource'][_0x33c0('0x36')]({'where':{'type':_0x105084,'resourceId':_0x556d70['id']}})[_0x33c0('0x1f')](function(){return _0x931cce;});})[_0x33c0('0x1f')](function(){_0xf65e1d[_0x33c0('0x2b')](0xcc)[_0x33c0('0x2c')]();});}};}function handleEntityNotFound(_0x1959e1,_0x4a88c5){return function(_0x2da23f){if(!_0x2da23f){_0x1959e1[_0x33c0('0x2a')](0x194);}return _0x2da23f;};}function handleError(_0x5c2bc1,_0x303060){_0x303060=_0x303060||0x1f4;return function(_0x290a2f){logger[_0x33c0('0x25')](_0x290a2f['stack']);if(_0x290a2f[_0x33c0('0x38')]){delete _0x290a2f[_0x33c0('0x38')];}_0x5c2bc1[_0x33c0('0x2b')](_0x303060)[_0x33c0('0x39')](_0x290a2f);};}exports[_0x33c0('0x3a')]=function(_0x4cf55b,_0x134004){var _0x14fa7b={'include':[{'model':db[_0x33c0('0x3b')],'as':'mandatoryDispositionPause'}]},_0x1fb181={},_0xac7516={'count':0x0,'rows':[]};var _0x45e295=_[_0x33c0('0x3c')](db[_0x33c0('0x3d')][_0x33c0('0x3e')],function(_0x2544e5){return{'name':_0x2544e5['fieldName'],'type':_0x2544e5[_0x33c0('0x3f')]['key']};});_0x1fb181[_0x33c0('0x40')]=_[_0x33c0('0x3c')](_0x45e295,_0x33c0('0x38'));_0x1fb181[_0x33c0('0x41')]=_[_0x33c0('0x42')](_0x4cf55b[_0x33c0('0x41')]);_0x1fb181[_0x33c0('0x43')]=_[_0x33c0('0x44')](_0x1fb181[_0x33c0('0x40')],_0x1fb181['query']);_0x14fa7b['attributes']=_['intersection'](_0x1fb181[_0x33c0('0x40')],qs[_0x33c0('0x45')](_0x4cf55b[_0x33c0('0x41')]['fields']));_0x14fa7b[_0x33c0('0x46')]=_0x14fa7b[_0x33c0('0x46')]['length']?_0x14fa7b['attributes']:_0x1fb181[_0x33c0('0x40')];if(!_0x4cf55b[_0x33c0('0x41')]['hasOwnProperty'](_0x33c0('0x47'))){_0x14fa7b[_0x33c0('0x2f')]=qs[_0x33c0('0x2f')](_0x4cf55b[_0x33c0('0x41')][_0x33c0('0x2f')]);_0x14fa7b[_0x33c0('0x2e')]=qs[_0x33c0('0x2e')](_0x4cf55b['query'][_0x33c0('0x2e')]);}_0x14fa7b[_0x33c0('0x48')]=qs[_0x33c0('0x49')](_0x4cf55b[_0x33c0('0x41')][_0x33c0('0x49')]);_0x14fa7b[_0x33c0('0x4a')]=qs[_0x33c0('0x43')](_['pick'](_0x4cf55b[_0x33c0('0x41')],_0x1fb181[_0x33c0('0x43')]),_0x45e295);if(_0x4cf55b[_0x33c0('0x41')][_0x33c0('0x4b')]){_0x14fa7b[_0x33c0('0x4a')]=_[_0x33c0('0x4c')](_0x14fa7b['where'],{'$or':_[_0x33c0('0x3c')](_0x45e295,function(_0x585a0d){if(_0x585a0d[_0x33c0('0x3f')]!=='VIRTUAL'){var _0x10250d={};_0x10250d[_0x585a0d['name']]={'$like':'%'+_0x4cf55b[_0x33c0('0x41')][_0x33c0('0x4b')]+'%'};return _0x10250d;}})});}_0x14fa7b=_[_0x33c0('0x4c')]({},_0x14fa7b,_0x4cf55b[_0x33c0('0x4d')]);var _0x17a831={'where':_0x14fa7b[_0x33c0('0x4a')]};return db[_0x33c0('0x3d')]['count'](_0x17a831)[_0x33c0('0x1f')](function(_0x44488c){_0xac7516[_0x33c0('0x30')]=_0x44488c;if(_0x4cf55b[_0x33c0('0x41')]['includeAll']){_0x14fa7b[_0x33c0('0x4e')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x33c0('0x4f')](_0x14fa7b);})[_0x33c0('0x1f')](function(_0x1deb98){_0xac7516[_0x33c0('0x50')]=_0x1deb98;return _0xac7516;})[_0x33c0('0x1f')](respondWithFilteredResult(_0x134004,_0x14fa7b))[_0x33c0('0x29')](handleError(_0x134004,null));};exports[_0x33c0('0x51')]=function(_0x58499f,_0x271a27){var _0x483cdf={'raw':![],'where':{'id':_0x58499f[_0x33c0('0x52')]['id']},'include':[{'model':db[_0x33c0('0x3b')],'as':_0x33c0('0x53')}]},_0x454f49={};_0x454f49[_0x33c0('0x40')]=_[_0x33c0('0x42')](db[_0x33c0('0x3d')]['rawAttributes']);_0x454f49[_0x33c0('0x41')]=_[_0x33c0('0x42')](_0x58499f[_0x33c0('0x41')]);_0x454f49[_0x33c0('0x43')]=_[_0x33c0('0x44')](_0x454f49['model'],_0x454f49[_0x33c0('0x41')]);_0x483cdf[_0x33c0('0x46')]=_[_0x33c0('0x44')](_0x454f49[_0x33c0('0x40')],qs['fields'](_0x58499f[_0x33c0('0x41')]['fields']));_0x483cdf[_0x33c0('0x46')]=_0x483cdf[_0x33c0('0x46')]['length']?_0x483cdf[_0x33c0('0x46')]:_0x454f49[_0x33c0('0x40')];if(_0x58499f[_0x33c0('0x41')]['includeAll']){_0x483cdf['include']=[{'all':!![]}];}_0x483cdf=_[_0x33c0('0x4c')]({},_0x483cdf,_0x58499f[_0x33c0('0x4d')]);return db[_0x33c0('0x3d')][_0x33c0('0x54')](_0x483cdf)[_0x33c0('0x1f')](handleEntityNotFound(_0x271a27,null))[_0x33c0('0x1f')](respondWithResult(_0x271a27,null))['catch'](handleError(_0x271a27,null));};exports[_0x33c0('0x55')]=function(_0x396536,_0x541448){return db[_0x33c0('0x3d')][_0x33c0('0x55')](_0x396536['body'],{})[_0x33c0('0x1f')](function(_0x42caf7){var _0x324483=_0x396536[_0x33c0('0x56')][_0x33c0('0x37')]({'plain':!![]});if(!_0x324483)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x324483[_0x33c0('0x57')]===_0x33c0('0x56')){var _0x3f6a6e=_0x42caf7[_0x33c0('0x37')]({'plain':!![]});var _0x4f7ac5='OpenchannelAccounts';return db[_0x33c0('0x58')][_0x33c0('0x54')]({'where':{'name':_0x4f7ac5,'userProfileId':_0x324483['userProfileId']},'raw':!![]})[_0x33c0('0x1f')](function(_0x3212c8){if(_0x3212c8&&_0x3212c8[_0x33c0('0x59')]===0x0){return db['UserProfileResource'][_0x33c0('0x55')]({'name':_0x3f6a6e['name'],'resourceId':_0x3f6a6e['id'],'type':_0x3212c8[_0x33c0('0x38')],'sectionId':_0x3212c8['id']},{})['then'](function(){return _0x42caf7;});}else{return _0x42caf7;}})[_0x33c0('0x29')](function(_0xeadf76){logger[_0x33c0('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeadf76);throw _0xeadf76;});}return _0x42caf7;})[_0x33c0('0x1f')](respondWithResult(_0x541448,0xc9))[_0x33c0('0x29')](handleError(_0x541448,null));};exports[_0x33c0('0x35')]=function(_0x520406,_0x33f05b){if(_0x520406[_0x33c0('0x5a')]['id']){delete _0x520406[_0x33c0('0x5a')]['id'];}return db[_0x33c0('0x3d')][_0x33c0('0x54')]({'where':{'id':_0x520406[_0x33c0('0x52')]['id']},'include':[{'model':db[_0x33c0('0x3b')],'as':_0x33c0('0x53')}]})[_0x33c0('0x1f')](handleEntityNotFound(_0x33f05b,null))[_0x33c0('0x1f')](saveUpdates(_0x520406[_0x33c0('0x5a')],null))[_0x33c0('0x1f')](respondWithResult(_0x33f05b,null))['catch'](handleError(_0x33f05b,null));};exports[_0x33c0('0x36')]=function(_0x547f19,_0x17fac4){return db['OpenchannelAccount'][_0x33c0('0x54')]({'where':{'id':_0x547f19[_0x33c0('0x52')]['id']}})['then'](handleEntityNotFound(_0x17fac4,null))['then'](removeEntity(_0x17fac4,null))[_0x33c0('0x29')](handleError(_0x17fac4,null));};exports['describe']=function(_0x3c38e9,_0x13fb98){return db[_0x33c0('0x3d')][_0x33c0('0x5b')]()[_0x33c0('0x1f')](respondWithResult(_0x13fb98,null))[_0x33c0('0x29')](handleError(_0x13fb98,null));};exports['addDisposition']=function(_0x466007,_0x1973ed,_0x1dae63){if(_0x466007[_0x33c0('0x5a')]['id']){delete _0x466007[_0x33c0('0x5a')]['id'];}return db['OpenchannelAccount'][_0x33c0('0x54')]({'where':{'id':_0x466007[_0x33c0('0x52')]['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0x1973ed,null))[_0x33c0('0x1f')](function(_0x1f787e){if(_0x1f787e){_0x466007[_0x33c0('0x5a')]['OpenchannelAccountId']=_0x1f787e['id'];return db[_0x33c0('0x5c')]['create'](_0x466007['body']);}})[_0x33c0('0x1f')](respondWithResult(_0x1973ed,null))[_0x33c0('0x29')](handleError(_0x1973ed,null));};exports[_0x33c0('0x5d')]=function(_0x2511f7,_0x425e3f,_0x1789e5){var _0x4cf732={'raw':![],'where':{}};var _0x879c9a={};var _0x61dea3={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x33c0('0x5e')]({'where':{'id':_0x2511f7['params']['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0x425e3f,null))[_0x33c0('0x1f')](function(_0x3b561c){if(_0x3b561c){_0x879c9a['model']=_['keys'](db['Disposition'][_0x33c0('0x3e')]);_0x879c9a[_0x33c0('0x41')]=_[_0x33c0('0x42')](_0x2511f7['query']);_0x879c9a[_0x33c0('0x43')]=_[_0x33c0('0x44')](_0x879c9a[_0x33c0('0x40')],_0x879c9a[_0x33c0('0x41')]);_0x4cf732['attributes']=_['intersection'](_0x879c9a[_0x33c0('0x40')],qs['fields'](_0x2511f7['query'][_0x33c0('0x45')]));_0x4cf732[_0x33c0('0x46')]=_0x4cf732[_0x33c0('0x46')][_0x33c0('0x5f')]?_0x4cf732['attributes']:_0x879c9a[_0x33c0('0x40')];if(!_0x2511f7[_0x33c0('0x41')][_0x33c0('0x60')]('nolimit')){_0x4cf732['limit']=qs[_0x33c0('0x2f')](_0x2511f7[_0x33c0('0x41')][_0x33c0('0x2f')]);_0x4cf732[_0x33c0('0x2e')]=qs[_0x33c0('0x2e')](_0x2511f7[_0x33c0('0x41')][_0x33c0('0x2e')]);}_0x4cf732['order']=qs[_0x33c0('0x49')](_0x2511f7[_0x33c0('0x41')][_0x33c0('0x49')]);_0x4cf732[_0x33c0('0x4a')]=qs[_0x33c0('0x43')](_['pick'](_0x2511f7['query'],_0x879c9a[_0x33c0('0x43')]));_0x4cf732[_0x33c0('0x4a')]['OpenchannelAccountId']=_0x3b561c['id'];if(_0x2511f7[_0x33c0('0x41')]['filter']){_0x4cf732[_0x33c0('0x4a')]=_[_0x33c0('0x4c')](_0x4cf732[_0x33c0('0x4a')],{'$or':_[_0x33c0('0x3c')](_0x4cf732['attributes'],function(_0x121ae2){var _0x30ec1e={};_0x30ec1e[_0x121ae2]={'$like':'%'+_0x2511f7[_0x33c0('0x41')]['filter']+'%'};return _0x30ec1e;})});}_0x4cf732=_['merge']({},_0x4cf732,_0x2511f7[_0x33c0('0x4d')]);return db[_0x33c0('0x5c')][_0x33c0('0x30')]({'where':_0x4cf732[_0x33c0('0x4a')]})[_0x33c0('0x1f')](function(_0x95fa1d){_0x61dea3[_0x33c0('0x30')]=_0x95fa1d;if(_0x2511f7[_0x33c0('0x41')]['includeAll']){_0x4cf732[_0x33c0('0x4e')]=[{'all':!![]}];}return db[_0x33c0('0x5c')][_0x33c0('0x4f')](_0x4cf732);})[_0x33c0('0x1f')](function(_0xc9aeff){_0x61dea3[_0x33c0('0x50')]=_0xc9aeff;return _0x61dea3;});}})['then'](respondWithFilteredResult(_0x425e3f,_0x4cf732))[_0x33c0('0x29')](handleError(_0x425e3f,null));};exports['removeDispositions']=function(_0x3ed1c8,_0x326934,_0x249415){return db[_0x33c0('0x3d')][_0x33c0('0x54')]({'where':{'id':_0x3ed1c8['params']['id']}})['then'](handleEntityNotFound(_0x326934,null))['then'](function(_0x23de10){if(_0x23de10){return _0x23de10['removeDispositions'](_0x3ed1c8[_0x33c0('0x41')][_0x33c0('0x61')]);}})[_0x33c0('0x1f')](respondWithStatusCode(_0x326934,null))[_0x33c0('0x29')](handleError(_0x326934,null));};exports['addAnswer']=function(_0x155e31,_0x9dbde4,_0xc7bcd6){if(_0x155e31[_0x33c0('0x5a')]['id']){delete _0x155e31[_0x33c0('0x5a')]['id'];}return db['OpenchannelAccount'][_0x33c0('0x54')]({'where':{'id':_0x155e31['params']['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0x9dbde4,null))[_0x33c0('0x1f')](function(_0x594bb0){if(_0x594bb0){_0x155e31[_0x33c0('0x5a')][_0x33c0('0x62')]=_0x594bb0['id'];return db[_0x33c0('0x63')][_0x33c0('0x55')](_0x155e31[_0x33c0('0x5a')]);}})[_0x33c0('0x1f')](respondWithResult(_0x9dbde4,null))[_0x33c0('0x29')](handleError(_0x9dbde4,null));};exports[_0x33c0('0x64')]=function(_0x42b3c1,_0x4f3d6a,_0x59e679){var _0x450096={'raw':![],'where':{}};var _0x5b4d73={};var _0x58079c={'count':0x0,'rows':[]};return db[_0x33c0('0x3d')]['findOne']({'where':{'id':_0x42b3c1[_0x33c0('0x52')]['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0x4f3d6a,null))[_0x33c0('0x1f')](function(_0x59fd5c){if(_0x59fd5c){_0x5b4d73[_0x33c0('0x40')]=_[_0x33c0('0x42')](db[_0x33c0('0x63')][_0x33c0('0x3e')]);_0x5b4d73[_0x33c0('0x41')]=_['keys'](_0x42b3c1[_0x33c0('0x41')]);_0x5b4d73['filters']=_['intersection'](_0x5b4d73[_0x33c0('0x40')],_0x5b4d73[_0x33c0('0x41')]);_0x450096[_0x33c0('0x46')]=_[_0x33c0('0x44')](_0x5b4d73[_0x33c0('0x40')],qs[_0x33c0('0x45')](_0x42b3c1[_0x33c0('0x41')][_0x33c0('0x45')]));_0x450096['attributes']=_0x450096[_0x33c0('0x46')][_0x33c0('0x5f')]?_0x450096[_0x33c0('0x46')]:_0x5b4d73[_0x33c0('0x40')];if(!_0x42b3c1[_0x33c0('0x41')]['hasOwnProperty'](_0x33c0('0x47'))){_0x450096['limit']=qs['limit'](_0x42b3c1[_0x33c0('0x41')][_0x33c0('0x2f')]);_0x450096['offset']=qs['offset'](_0x42b3c1[_0x33c0('0x41')][_0x33c0('0x2e')]);}_0x450096[_0x33c0('0x48')]=qs['sort'](_0x42b3c1[_0x33c0('0x41')][_0x33c0('0x49')]);_0x450096[_0x33c0('0x4a')]=qs[_0x33c0('0x43')](_[_0x33c0('0x65')](_0x42b3c1[_0x33c0('0x41')],_0x5b4d73[_0x33c0('0x43')]));_0x450096['where'][_0x33c0('0x62')]=_0x59fd5c['id'];if(_0x42b3c1[_0x33c0('0x41')][_0x33c0('0x4b')]){_0x450096[_0x33c0('0x4a')]=_[_0x33c0('0x4c')](_0x450096['where'],{'$or':_[_0x33c0('0x3c')](_0x450096['attributes'],function(_0x3cec18){var _0x29a55e={};_0x29a55e[_0x3cec18]={'$like':'%'+_0x42b3c1[_0x33c0('0x41')][_0x33c0('0x4b')]+'%'};return _0x29a55e;})});}_0x450096=_['merge']({},_0x450096,_0x42b3c1[_0x33c0('0x4d')]);return db[_0x33c0('0x63')][_0x33c0('0x30')]({'where':_0x450096['where']})[_0x33c0('0x1f')](function(_0x8d4e57){_0x58079c['count']=_0x8d4e57;if(_0x42b3c1[_0x33c0('0x41')][_0x33c0('0x66')]){_0x450096[_0x33c0('0x4e')]=[{'all':!![]}];}return db[_0x33c0('0x63')]['findAll'](_0x450096);})[_0x33c0('0x1f')](function(_0x54fc77){_0x58079c[_0x33c0('0x50')]=_0x54fc77;return _0x58079c;});}})[_0x33c0('0x1f')](respondWithFilteredResult(_0x4f3d6a,_0x450096))[_0x33c0('0x29')](handleError(_0x4f3d6a,null));};exports[_0x33c0('0x67')]=function(_0x2f5e98,_0x42b8b6,_0x8163c8){return db[_0x33c0('0x3d')][_0x33c0('0x54')]({'where':{'id':_0x2f5e98[_0x33c0('0x52')]['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0x42b8b6,null))['then'](function(_0x4dfce6){if(_0x4dfce6){return _0x4dfce6[_0x33c0('0x67')](_0x2f5e98['query']['ids']);}})[_0x33c0('0x1f')](respondWithStatusCode(_0x42b8b6,null))['catch'](handleError(_0x42b8b6,null));};exports['notify']=function(_0x17de40,_0x2f5b57,_0xe271c4){var _0x3c8ca0={'body':_0x17de40[_0x33c0('0x5a')],'channel':_0x33c0('0x68')};var _0x3ac09d=[];var _0x17aa30=[];var _0x1df3cb={};var _0x3b6c29=![];return db[_0x33c0('0x69')][_0x33c0('0x5b')]()[_0x33c0('0x1f')](function(_0x450e97){if(!_0x450e97){throw new db[(_0x33c0('0x6a'))][(_0x33c0('0x6b'))](_0x33c0('0x6c'));}_0x3ac09d=_[_0x33c0('0x6d')](_[_0x33c0('0x42')](_0x450e97),[_0x33c0('0x6e'),_0x33c0('0x6f')]);_0x17aa30=_[_0x33c0('0x6d')](_[_0x33c0('0x42')](_0x450e97),[_0x33c0('0x6e'),_0x33c0('0x6f'),_0x33c0('0x70'),_0x33c0('0x71')]);if(_0x17de40[_0x33c0('0x5a')]['id']){delete _0x17de40[_0x33c0('0x5a')]['id'];}if(_[_0x33c0('0x72')](_0x17de40[_0x33c0('0x5a')][_0x33c0('0x73')])){throw new db['Sequelize'][(_0x33c0('0x6b'))](_0x33c0('0x74'));}if(_['isNil'](_0x17de40[_0x33c0('0x5a')][_0x33c0('0x5a')])||_0x17de40[_0x33c0('0x5a')][_0x33c0('0x5a')]===''){throw new db['Sequelize']['ValidationError'](_0x33c0('0x75'));}if(_['isNil'](_0x17de40[_0x33c0('0x5a')][_0x33c0('0x76')])){throw new db[(_0x33c0('0x6a'))][(_0x33c0('0x6b'))](_0x33c0('0x77')+_0x17aa30);}if(!_['includes'](_0x17aa30,_0x17de40[_0x33c0('0x5a')][_0x33c0('0x76')])){throw new db[(_0x33c0('0x6a'))][(_0x33c0('0x6b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17aa30);}_0x1df3cb[_0x17de40[_0x33c0('0x5a')][_0x33c0('0x76')]]=_0x17de40['body'][_0x33c0('0x73')];})[_0x33c0('0x1f')](function(){return db['OpenchannelAccount'][_0x33c0('0x54')]({'where':{'id':_0x17de40[_0x33c0('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x33c0('0x78'),'include':[{'model':db[_0x33c0('0x69')],'as':_0x33c0('0x79'),'where':_0x1df3cb,'limit':0x1,'order':[['updatedAt',_0x33c0('0x7a')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0x33c0('0x1f')](handleEntityNotFound(_0x2f5b57,null))[_0x33c0('0x1f')](function(_0x4219fb){if(_0x4219fb&&_0x4219fb[_0x33c0('0x78')]){_0x3c8ca0['account']=_0x4219fb;_0x3c8ca0['applications']=_0x4219fb['Applications'];_0x3c8ca0[_0x33c0('0x7b')]=_0x4219fb[_0x33c0('0x78')];_0x3c8ca0[_0x33c0('0x7c')]=_[_0x33c0('0x7d')](_0x3c8ca0[_0x33c0('0x7c')],[_0x33c0('0x7e')],['asc']);if(_0x3c8ca0['account']['Applications']){delete _0x3c8ca0[_0x33c0('0x7f')][_0x33c0('0x80')];}if(_0x3c8ca0['account'][_0x33c0('0x78')]&&_0x3c8ca0['account'][_0x33c0('0x78')]['Contacts'][_0x33c0('0x5f')]){return _0x3c8ca0[_0x33c0('0x7f')][_0x33c0('0x78')][_0x33c0('0x79')][0x0];}var _0x2a103c=_[_0x33c0('0x16')](_0x17de40[_0x33c0('0x5a')],{'firstName':_0x17de40[_0x33c0('0x5a')][_0x33c0('0x73')],'ListId':_0x4219fb[_0x33c0('0x71')]});_0x2a103c[_0x17de40[_0x33c0('0x5a')]['mapKey']]=_0x17de40[_0x33c0('0x5a')][_0x33c0('0x73')];return db[_0x33c0('0x69')][_0x33c0('0x55')](_0x2a103c,{'fields':_0x3ac09d,'raw':!![]});}})[_0x33c0('0x1f')](handleEntityNotFound(_0x2f5b57,null))[_0x33c0('0x1f')](function(_0x743acf){_0x3c8ca0['contact']=_0x743acf;if(_0x743acf){var _0x577e87={'ContactId':_0x743acf['id'],'OpenchannelAccountId':_0x17de40[_0x33c0('0x52')]['id'],'from':(_0x743acf['firstName']||'')+'\x20'+(_0x743acf[_0x33c0('0x81')]||'')};var _0x466c29={'OpenchannelAccountId':_0x17de40[_0x33c0('0x52')]['id'],'closed':![]};if(_0x17de40[_0x33c0('0x5a')]['threadId']){_0x466c29['threadId']=_0x17de40[_0x33c0('0x5a')][_0x33c0('0x82')];return db[_0x33c0('0x83')][_0x33c0('0x54')]({'where':_0x466c29})['then'](function(_0xb64ef6){if(_0xb64ef6){return[_0xb64ef6,![]];}_0x577e87[_0x33c0('0x82')]=_0x17de40[_0x33c0('0x5a')]['threadId'];_0x577e87['externalUrl']=_0x17de40[_0x33c0('0x5a')]['externalUrl'];return db[_0x33c0('0x83')][_0x33c0('0x55')](_0x577e87)['then'](function(_0x10c881){return[_0x10c881,!![]];});});}else{_0x466c29[_0x33c0('0x82')]=null;}_0x466c29[_0x33c0('0x84')]=_0x743acf['id'];return db[_0x33c0('0x83')][_0x33c0('0x54')]({'where':_0x466c29})[_0x33c0('0x1f')](function(_0x595d56){if(_0x595d56){return[_0x595d56,![]];}return db[_0x33c0('0x83')][_0x33c0('0x55')](_0x577e87)[_0x33c0('0x1f')](function(_0x9a23d3){return[_0x9a23d3,!![]];});});}})[_0x33c0('0x85')](function(_0x3fa077,_0x3069e0){if(_0x3fa077){_0x3b6c29=_0x3069e0;if(!_0x3069e0){var _0x3eb569={'from':(_0x3c8ca0[_0x33c0('0x86')]['firstName']||'')+'\x20'+(_0x3c8ca0['contact'][_0x33c0('0x81')]||'')};if(_0x17de40['body']['threadId']&&_0x17de40[_0x33c0('0x5a')][_0x33c0('0x87')]&&_0x17de40[_0x33c0('0x5a')][_0x33c0('0x82')]!=_0x17de40['body'][_0x33c0('0x87')]){_0x3eb569[_0x33c0('0x82')]=_0x17de40[_0x33c0('0x5a')][_0x33c0('0x87')];}return _0x3fa077[_0x33c0('0x35')](_0x3eb569);}else{return _0x3fa077;}}})['then'](function(_0x5f1d0f){_0x3c8ca0['interaction']=_0x5f1d0f['get']({'plain':!![]});_0x3c8ca0[_0x33c0('0x88')][_0x33c0('0x89')]=_0x3b6c29;if(_0x3c8ca0[_0x33c0('0x88')][_0x33c0('0x89')]){if(_0x3c8ca0['account'][_0x33c0('0x8a')]){_0x3c8ca0[_0x33c0('0x7c')][_0x33c0('0x8b')]({'id':0x0,'priority':_0x3c8ca0['applications'][_0x33c0('0x5f')]+0x1,'app':_0x33c0('0x8c'),'appdata':_0x33c0('0x8d'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x33c0('0x55')]({'body':_0x17de40[_0x33c0('0x5a')][_0x33c0('0x5a')],'OpenchannelAccountId':_0x17de40[_0x33c0('0x52')]['id'],'OpenchannelInteractionId':_0x5f1d0f['id'],'direction':'in','ContactId':_0x3c8ca0[_0x33c0('0x86')]['id'],'AttachmentId':_0x17de40[_0x33c0('0x5a')][_0x33c0('0x8e')]});})[_0x33c0('0x1f')](function(_0x5f2220){_0x3c8ca0[_0x33c0('0x27')]=_0x5f2220;if(!_0x3c8ca0[_0x33c0('0x88')][_0x33c0('0x8f')])return;return db['User'][_0x33c0('0x54')]({'attributes':['id',_0x33c0('0x38')],'where':{'id':_0x3c8ca0[_0x33c0('0x88')][_0x33c0('0x8f')]}});})[_0x33c0('0x1f')](function(_0x306073){if(_0x306073){_0x3c8ca0[_0x33c0('0x7c')][_0x33c0('0x90')]({'id':0x0,'priority':0x0,'app':_0x33c0('0x91'),'appdata':_0x306073[_0x33c0('0x38')]+','+(_0x3c8ca0[_0x33c0('0x7f')][_0x33c0('0x92')]||0xa),'interval':_0x33c0('0x93')});}if(!_0x3c8ca0[_0x33c0('0x88')][_0x33c0('0x94')])return;return db[_0x33c0('0x95')]['find']({'attributes':['id',_0x33c0('0x38')],'where':{'id':_0x3c8ca0[_0x33c0('0x88')]['queueId']}});})[_0x33c0('0x1f')](function(_0x208fa3){if(_0x208fa3){_0x3c8ca0[_0x33c0('0x7c')][_0x33c0('0x90')]({'id':0x0,'priority':0x1,'app':_0x33c0('0x96'),'appdata':_0x208fa3['name']+','+(_0x3c8ca0[_0x33c0('0x7f')][_0x33c0('0x97')]||0x12c),'interval':_0x33c0('0x93')});}return respondWithRpcPromise(_0x33c0('0x98'),_0x33c0('0x99'),_0x3c8ca0);})[_0x33c0('0x1f')](function(_0x2751c1){respondWithRpcPromise(_0x33c0('0x9a'),_0x33c0('0x9a'),{'event':'notify','message':_0x2751c1},client9002);return _0x2751c1;})[_0x33c0('0x1f')](respondWithResult(_0x2f5b57,null))[_0x33c0('0x29')](handleError(_0x2f5b57,null));};exports[_0x33c0('0x9b')]=function(_0x4be6a3,_0x321011){var _0x2d7549=_0x4be6a3[_0x33c0('0x52')]['id'];var _0x1a40da=_0x4be6a3[_0x33c0('0x5a')];var _0x373676=0xc8;var _0x5f24fd=null;return db['sequelize'][_0x33c0('0x9c')]({'isolationLevel':db[_0x33c0('0x9d')][_0x33c0('0x9e')][_0x33c0('0x9f')][_0x33c0('0xa0')]},function(_0x15dc50){return db[_0x33c0('0x3d')][_0x33c0('0x5e')]({'where':{'id':_0x2d7549},'transaction':_0x15dc50})['then'](function(_0x5e6f55){if(_0x5e6f55){return db[_0x33c0('0xa1')][_0x33c0('0x36')]({'where':{'OpenchannelAccountId':_0x2d7549},'transaction':_0x15dc50})[_0x33c0('0x1f')](function(){var _0x745b94=_[_0x33c0('0x3c')](_0x1a40da,function(_0x983628){_0x983628[_0x33c0('0x62')]=_0x2d7549;return _0x983628;});return db[_0x33c0('0xa1')][_0x33c0('0xa2')](_0x745b94,{'transaction':_0x15dc50});});}else{_0x373676=0x194;_0x5f24fd=[];}});})['then'](function(){if(_0x373676!==0x194){return db[_0x33c0('0xa1')][_0x33c0('0xa3')]({'where':{'OpenchannelAccountId':_0x2d7549},'order':_0x33c0('0x7e')})['then'](function(_0x3eff05){_0x5f24fd=_0x3eff05;});}})[_0x33c0('0x29')](function(_0x55ba37){_0x373676=0x1f4;logger[_0x33c0('0x25')](_0x55ba37['stack']);if(_0x55ba37[_0x33c0('0x38')]){delete _0x55ba37[_0x33c0('0x38')];}_0x5f24fd=_0x55ba37;})[_0x33c0('0xa4')](function(){if(_0x5f24fd===null){_0x321011[_0x33c0('0x2a')](_0x373676);}else{if(_0x373676===0x1f4){_0x321011['status'](_0x373676)[_0x33c0('0x39')](_0x5f24fd);}else{_0x321011[_0x33c0('0x2b')](_0x373676)['json'](_0x5f24fd);}}});};exports[_0x33c0('0xa5')]=function(_0x34546a,_0x150c9f,_0x41f728){var _0x5b158c={};var _0x5d9e0f={};var _0xfef18c;var _0x8fe4de;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x34546a[_0x33c0('0x52')]['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0x150c9f,null))[_0x33c0('0x1f')](function(_0x1a8db4){if(_0x1a8db4){_0xfef18c=_0x1a8db4;_0x5d9e0f[_0x33c0('0x40')]=_[_0x33c0('0x42')](db[_0x33c0('0xa1')]['rawAttributes']);_0x5d9e0f['query']=_[_0x33c0('0x42')](_0x34546a[_0x33c0('0x41')]);_0x5d9e0f['filters']=_[_0x33c0('0x44')](_0x5d9e0f['model'],_0x5d9e0f['query']);_0x5b158c['attributes']=_[_0x33c0('0x44')](_0x5d9e0f[_0x33c0('0x40')],qs[_0x33c0('0x45')](_0x34546a[_0x33c0('0x41')]['fields']));_0x5b158c[_0x33c0('0x46')]=_0x5b158c[_0x33c0('0x46')][_0x33c0('0x5f')]?_0x5b158c[_0x33c0('0x46')]:_0x5d9e0f['model'];_0x5b158c[_0x33c0('0x48')]=qs[_0x33c0('0x49')](_0x34546a[_0x33c0('0x41')][_0x33c0('0x49')]);_0x5b158c[_0x33c0('0x4a')]=qs[_0x33c0('0x43')](_['pick'](_0x34546a[_0x33c0('0x41')],_0x5d9e0f[_0x33c0('0x43')]));if(_0x34546a['query'][_0x33c0('0x4b')]){_0x5b158c[_0x33c0('0x4a')]=_['merge'](_0x5b158c[_0x33c0('0x4a')],{'$or':_[_0x33c0('0x3c')](_0x5b158c['attributes'],function(_0x4e8b2c){var _0x3ca642={};_0x3ca642[_0x4e8b2c]={'$like':'%'+_0x34546a['query']['filter']+'%'};return _0x3ca642;})});}_0x5b158c=_['merge']({},_0x5b158c,_0x34546a[_0x33c0('0x4d')]);return _0xfef18c['getApplications'](_0x5b158c);}})[_0x33c0('0x1f')](function(_0x44a32d){if(_0x44a32d){_0x8fe4de=_0x44a32d['length'];if(!_0x34546a[_0x33c0('0x41')][_0x33c0('0x60')]('nolimit')){_0x5b158c[_0x33c0('0x2f')]=qs[_0x33c0('0x2f')](_0x34546a[_0x33c0('0x41')][_0x33c0('0x2f')]);_0x5b158c[_0x33c0('0x2e')]=qs[_0x33c0('0x2e')](_0x34546a[_0x33c0('0x41')]['offset']);}return _0xfef18c[_0x33c0('0xa5')](_0x5b158c);}})[_0x33c0('0x1f')](function(_0x46698d){if(_0x46698d){return _0x46698d?{'count':_0x8fe4de,'rows':_0x46698d}:null;}})[_0x33c0('0x1f')](respondWithResult(_0x150c9f,null))[_0x33c0('0x29')](handleError(_0x150c9f,null));};exports[_0x33c0('0xa6')]=function(_0x34bf4b,_0x563181,_0x108182){var _0x2406ce={'raw':![],'where':{}};var _0xaf8848={};var _0x41508e={'count':0x0,'rows':[]};return db[_0x33c0('0x3d')][_0x33c0('0x5e')]({'where':{'id':_0x34bf4b[_0x33c0('0x52')]['id']}})['then'](handleEntityNotFound(_0x563181,null))[_0x33c0('0x1f')](function(_0x522674){if(_0x522674){_0xaf8848[_0x33c0('0x40')]=_[_0x33c0('0x42')](db['OpenchannelInteraction'][_0x33c0('0x3e')]);_0xaf8848['query']=_[_0x33c0('0x42')](_0x34bf4b[_0x33c0('0x41')]);_0xaf8848[_0x33c0('0x43')]=_['intersection'](_0xaf8848[_0x33c0('0x40')],_0xaf8848[_0x33c0('0x41')]);_0x2406ce['attributes']=_['intersection'](_0xaf8848[_0x33c0('0x40')],qs['fields'](_0x34bf4b[_0x33c0('0x41')][_0x33c0('0x45')]));_0x2406ce[_0x33c0('0x46')]=_0x2406ce['attributes'][_0x33c0('0x5f')]?_0x2406ce[_0x33c0('0x46')]:_0xaf8848['model'];if(!_0x34bf4b[_0x33c0('0x41')][_0x33c0('0x60')]('nolimit')){_0x2406ce[_0x33c0('0x2f')]=qs[_0x33c0('0x2f')](_0x34bf4b['query'][_0x33c0('0x2f')]);_0x2406ce[_0x33c0('0x2e')]=qs['offset'](_0x34bf4b['query']['offset']);}_0x2406ce[_0x33c0('0x48')]=qs[_0x33c0('0x49')](_0x34bf4b['query'][_0x33c0('0x49')]);_0x2406ce[_0x33c0('0x4a')]=qs['filters'](_[_0x33c0('0x65')](_0x34bf4b[_0x33c0('0x41')],_0xaf8848[_0x33c0('0x43')]));_0x2406ce[_0x33c0('0x4a')][_0x33c0('0x62')]=_0x522674['id'];if(_0x34bf4b[_0x33c0('0x41')][_0x33c0('0x4b')]){_0x2406ce[_0x33c0('0x4a')]=_['merge'](_0x2406ce[_0x33c0('0x4a')],{'$or':_[_0x33c0('0x3c')](_0x2406ce['attributes'],function(_0x4e2a57){var _0x1f8a75={};_0x1f8a75[_0x4e2a57]={'$like':'%'+_0x34bf4b[_0x33c0('0x41')]['filter']+'%'};return _0x1f8a75;})});}_0x2406ce=_['merge']({},_0x2406ce,_0x34bf4b[_0x33c0('0x4d')]);return db['OpenchannelInteraction'][_0x33c0('0x30')]({'where':_0x2406ce[_0x33c0('0x4a')]})[_0x33c0('0x1f')](function(_0x3a6643){_0x41508e[_0x33c0('0x30')]=_0x3a6643;if(_0x34bf4b[_0x33c0('0x41')][_0x33c0('0x66')]){_0x2406ce[_0x33c0('0x4e')]=[{'model':db[_0x33c0('0x69')],'as':_0x33c0('0xa7'),'required':![]},{'model':db[_0x33c0('0xa8')],'as':_0x33c0('0xa9'),'attributes':[_0x33c0('0x38'),_0x33c0('0xaa'),_0x33c0('0xab')],'required':![]},{'model':db[_0x33c0('0xac')],'as':_0x33c0('0xad'),'attributes':['id','name',_0x33c0('0xae')],'where':_0x34bf4b[_0x33c0('0x41')]['tag']?{'id':_0x34bf4b['query']['tag']}:undefined,'required':_0x34bf4b[_0x33c0('0x41')][_0x33c0('0xaf')]?!![]:![]}];}return db[_0x33c0('0x83')]['findAll'](_0x2406ce);})[_0x33c0('0x1f')](function(_0x2758c3){_0x41508e[_0x33c0('0x50')]=_0x2758c3;return _0x41508e;});}})[_0x33c0('0x1f')](respondWithFilteredResult(_0x563181,_0x2406ce))[_0x33c0('0x29')](handleError(_0x563181,null));};exports[_0x33c0('0xb0')]=function(_0x543e85,_0xf3a9b7,_0x3d87dc){return db[_0x33c0('0x3d')][_0x33c0('0x54')]({'where':{'id':_0x543e85[_0x33c0('0x52')]['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0xf3a9b7,null))[_0x33c0('0x1f')](function(_0x59dfb8){if(_0x59dfb8){return _0x59dfb8['addAgents'](_0x543e85['body'][_0x33c0('0x61')],_[_0x33c0('0xb1')](_0x543e85[_0x33c0('0x5a')],['ids','id'])||{})[_0x33c0('0x85')](function(_0x53b3e5){for(var _0x2b0785=0x0;_0x2b0785<_0x543e85['body']['ids'][_0x33c0('0x5f')];_0x2b0785+=0x1){socket['emit'](_0x33c0('0xb2'),{'UserId':Number(_0x543e85[_0x33c0('0x5a')][_0x33c0('0x61')][_0x2b0785]),'OpenchannelAccountId':Number(_0x543e85[_0x33c0('0x52')]['id'])});}return _0x53b3e5;});}})[_0x33c0('0x1f')](respondWithResult(_0xf3a9b7,null))['catch'](handleError(_0xf3a9b7,null));};exports[_0x33c0('0xb3')]=function(_0x3d0f5a,_0x46a6a5,_0x3023a2){return db['OpenchannelAccount'][_0x33c0('0x54')]({'where':{'id':_0x3d0f5a['params']['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0x46a6a5,null))[_0x33c0('0x1f')](function(_0x556266){if(_0x556266){return _0x556266['removeAgents'](_0x3d0f5a[_0x33c0('0x41')][_0x33c0('0x61')])['then'](function(){if(_[_0x33c0('0xb4')](_0x3d0f5a[_0x33c0('0x41')][_0x33c0('0x61')])){for(var _0x2dc901=0x0;_0x2dc901<_0x3d0f5a[_0x33c0('0x41')][_0x33c0('0x61')]['length'];_0x2dc901+=0x1){socket[_0x33c0('0xb5')](_0x33c0('0xb6'),{'UserId':Number(_0x3d0f5a['query'][_0x33c0('0x61')][_0x2dc901]),'OpenchannelAccountId':Number(_0x3d0f5a['params']['id'])});}}else{socket['emit'](_0x33c0('0xb6'),{'UserId':Number(_0x3d0f5a[_0x33c0('0x41')][_0x33c0('0x61')]),'OpenchannelAccountId':Number(_0x3d0f5a[_0x33c0('0x52')]['id'])});}});}})[_0x33c0('0x1f')](respondWithStatusCode(_0x46a6a5,null))[_0x33c0('0x29')](handleError(_0x46a6a5,null));};exports['getAgents']=function(_0x53876e,_0x37cdff,_0x1b4d4d){var _0x52f397={};var _0x529a3d={};var _0x55f67e;var _0x5d5887;return db[_0x33c0('0x3d')]['findOne']({'where':{'id':_0x53876e['params']['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0x37cdff,null))[_0x33c0('0x1f')](function(_0x525a22){if(_0x525a22){_0x55f67e=_0x525a22;_0x529a3d[_0x33c0('0x40')]=_[_0x33c0('0x42')](db[_0x33c0('0xa8')]['rawAttributes']);_0x529a3d[_0x33c0('0x41')]=_[_0x33c0('0x42')](_0x53876e[_0x33c0('0x41')]);_0x529a3d[_0x33c0('0x43')]=_[_0x33c0('0x44')](_0x529a3d['model'],_0x529a3d[_0x33c0('0x41')]);_0x52f397[_0x33c0('0x46')]=_['intersection'](_0x529a3d[_0x33c0('0x40')],qs[_0x33c0('0x45')](_0x53876e[_0x33c0('0x41')][_0x33c0('0x45')]));_0x52f397['attributes']=_0x52f397[_0x33c0('0x46')][_0x33c0('0x5f')]?_0x52f397[_0x33c0('0x46')]:_0x529a3d['model'];_0x52f397[_0x33c0('0x48')]=qs[_0x33c0('0x49')](_0x53876e[_0x33c0('0x41')]['sort']);_0x52f397[_0x33c0('0x4a')]=qs[_0x33c0('0x43')](_[_0x33c0('0x65')](_0x53876e[_0x33c0('0x41')],_0x529a3d[_0x33c0('0x43')]));if(_0x53876e[_0x33c0('0x41')][_0x33c0('0x4b')]){_0x52f397[_0x33c0('0x4a')]=_[_0x33c0('0x4c')](_0x52f397[_0x33c0('0x4a')],{'$or':_[_0x33c0('0x3c')](_0x52f397[_0x33c0('0x46')],function(_0x295796){var _0x19110f={};_0x19110f[_0x295796]={'$like':'%'+_0x53876e['query']['filter']+'%'};return _0x19110f;})});}_0x52f397=_[_0x33c0('0x4c')]({},_0x52f397,_0x53876e['options']);return _0x55f67e[_0x33c0('0xb7')](_0x52f397);}})[_0x33c0('0x1f')](function(_0x53a375){if(_0x53a375){_0x5d5887=_0x53a375['length'];if(!_0x53876e[_0x33c0('0x41')][_0x33c0('0x60')](_0x33c0('0x47'))){_0x52f397[_0x33c0('0x2f')]=qs[_0x33c0('0x2f')](_0x53876e['query'][_0x33c0('0x2f')]);_0x52f397[_0x33c0('0x2e')]=qs[_0x33c0('0x2e')](_0x53876e[_0x33c0('0x41')][_0x33c0('0x2e')]);}return _0x55f67e[_0x33c0('0xb7')](_0x52f397);}})['then'](function(_0x161581){if(_0x161581){return _0x161581?{'count':_0x5d5887,'rows':_0x161581}:null;}})[_0x33c0('0x1f')](respondWithResult(_0x37cdff,null))[_0x33c0('0x29')](handleError(_0x37cdff,null));};exports['send']=function(_0x307dfd,_0x73af3b,_0x23eb44){var _0x5d7680,_0x26771d,_0x497751;if(_[_0x33c0('0x72')](_0x307dfd[_0x33c0('0x5a')][_0x33c0('0x5a')])||_0x307dfd[_0x33c0('0x5a')][_0x33c0('0x5a')]===''){throw new db[(_0x33c0('0x6a'))][(_0x33c0('0x6b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x33c0('0x72')](_0x307dfd[_0x33c0('0x5a')]['to'])){}_0x5d7680=_0x307dfd['body']['to'];return db[_0x33c0('0x3d')][_0x33c0('0x5e')]({'where':{'id':_0x307dfd[_0x33c0('0x52')]['id']}})[_0x33c0('0x1f')](handleEntityNotFound(_0x73af3b,null))['then'](function(_0x17767f){if(_0x17767f){return db[_0x33c0('0x3d')][_0x33c0('0x54')]({'where':{'id':_0x17767f['id']},'include':[{'model':db[_0x33c0('0xb8')],'as':_0x33c0('0x78'),'include':[{'model':db[_0x33c0('0x69')],'as':_0x33c0('0x79'),'where':{[_0x17767f['mapKey']]:_0x5d7680},'limit':0x1,'order':[[_0x33c0('0x6f'),_0x33c0('0x7a')]]}]}]})[_0x33c0('0x1f')](handleEntityNotFound(_0x73af3b,null))['then'](function(_0x79fc2d){if(_0x79fc2d&&_0x79fc2d[_0x33c0('0x78')]){_0x26771d=_0x79fc2d[_0x33c0('0x37')]({'plain':!![]});if(_0x26771d[_0x33c0('0x78')]&&_0x26771d[_0x33c0('0x78')][_0x33c0('0x79')][_0x33c0('0x5f')]){return _0x26771d[_0x33c0('0x78')][_0x33c0('0x79')][0x0];}return db['CmContact'][_0x33c0('0x55')](_[_0x33c0('0x16')](_0x307dfd[_0x33c0('0x5a')],{'firstName':_0x5d7680,[_0x79fc2d['mapKey']]:_0x5d7680,'phone':_0x5d7680,'ListId':_0x26771d[_0x33c0('0x71')]}));}})[_0x33c0('0x1f')](handleEntityNotFound(_0x73af3b,null))['then'](function(_0x4f6180){if(_0x4f6180){_0x497751=_0x4f6180;return db[_0x33c0('0x83')]['find']({'where':{'ContactId':_0x497751['id'],'closed':![],'OpenchannelAccountId':_0x26771d['id']}})[_0x33c0('0x1f')](function(_0x359240){if(_0x359240){return[_0x359240,![]];}return db[_0x33c0('0x83')][_0x33c0('0x55')]({'UserId':_0x307dfd[_0x33c0('0x56')]['id'],'ContactId':_0x497751['id'],'OpenchannelAccountId':_0x26771d['id'],'lastMsgDirection':'out','firstMsgDirection':_0x33c0('0xb9'),'Messages':[_[_0x33c0('0x4c')](_0x307dfd[_0x33c0('0x5a')],{'read':![],'body':_0x307dfd[_0x33c0('0x5a')]['body'],'OpenchannelAccountId':_0x26771d['id'],'UserId':_0x307dfd['user']['id'],'ContactId':_0x497751['id']})]},{'include':[{'model':db[_0x33c0('0xba')],'as':'Messages'}]})[_0x33c0('0x1f')](function(_0x331cb4){return[_0x331cb4,!![]];});});}})[_0x33c0('0x85')](function(_0x1a3ccd,_0x475738){if(_0x475738){return _0x1a3ccd;}return db[_0x33c0('0xba')]['create'](_[_0x33c0('0x4c')](_0x307dfd[_0x33c0('0x5a')],{'read':![],'body':_0x307dfd[_0x33c0('0x5a')]['body'],'OpenchannelAccountId':_0x26771d['id'],'OpenchannelInteractionId':_0x1a3ccd['id'],'UserId':_0x307dfd[_0x33c0('0x56')]['id'],'ContactId':_0x497751['id']}))[_0x33c0('0x1f')](function(_0x59437c){_0x1a3ccd[_0x33c0('0xbb')][_0x33c0('0xbc')]=[];_0x1a3ccd[_0x33c0('0xbb')][_0x33c0('0xbc')][_0x33c0('0x8b')](_0x59437c[_0x33c0('0xbb')]);return _0x1a3ccd;});});}})[_0x33c0('0x1f')](respondWithResult(_0x73af3b,null))[_0x33c0('0x29')](handleError(_0x73af3b,null));}; \ No newline at end of file +var _0x7e4b=['UserProfileResource','stack','name','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelAccount','include','findAll','rows','show','params','Pause','keys','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','Applications','account','applications','orderBy','contact','firstName','threadId','OpenchannelInteraction','externalUrl','lastName','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','get'];(function(_0x7a531a,_0x41dd70){var _0x4d8d90=function(_0x3d2648){while(--_0x3d2648){_0x7a531a['push'](_0x7a531a['shift']());}};_0x4d8d90(++_0x41dd70);}(_0x7e4b,0x84));var _0xb7e4=function(_0x4f15f,_0x4f80cd){_0x4f15f=_0x4f15f-0x0;var _0x31a7ff=_0x7e4b[_0x4f15f];return _0x31a7ff;};'use strict';var emlformat=require(_0xb7e4('0x0'));var rimraf=require(_0xb7e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7e4('0x2'));var rp=require(_0xb7e4('0x3'));var moment=require('moment');var BPromise=require(_0xb7e4('0x4'));var Mustache=require(_0xb7e4('0x5'));var util=require(_0xb7e4('0x6'));var path=require(_0xb7e4('0x7'));var sox=require(_0xb7e4('0x8'));var csv=require(_0xb7e4('0x9'));var ejs=require(_0xb7e4('0xa'));var fs=require('fs');var fs_extra=require(_0xb7e4('0xb'));var _=require(_0xb7e4('0xc'));var squel=require('squel');var crypto=require(_0xb7e4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb7e4('0xe'));var toCsv=require(_0xb7e4('0x9'));var querystring=require(_0xb7e4('0xf'));var Papa=require(_0xb7e4('0x10'));var Redis=require(_0xb7e4('0x11'));var authService=require(_0xb7e4('0x12'));var qs=require(_0xb7e4('0x13'));var as=require(_0xb7e4('0x14'));var hardwareService=require(_0xb7e4('0x15'));var logger=require(_0xb7e4('0x16'))(_0xb7e4('0x17'));var utils=require(_0xb7e4('0x18'));var config=require(_0xb7e4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb7e4('0x1a')]=_[_0xb7e4('0x1b')](config['redis'],{'host':_0xb7e4('0x1c'),'port':0x18eb});var socket=require(_0xb7e4('0x1d'))(new Redis(config[_0xb7e4('0x1a')]));require(_0xb7e4('0x1e'))[_0xb7e4('0x1f')](socket);var jayson=require(_0xb7e4('0x20'));var client=jayson[_0xb7e4('0x21')][_0xb7e4('0x22')]({'port':0x232c});var client9002=jayson[_0xb7e4('0x21')][_0xb7e4('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x15653d,_0x983d60,_0x70481a,_0x3a08f1){return new BPromise(function(_0x4d4220,_0x1a6999){var _0x170e17=_0x3a08f1||client;return _0x170e17[_0xb7e4('0x23')](_0x15653d,_0x70481a)[_0xb7e4('0x24')](function(_0x44a6c9){logger[_0xb7e4('0x25')](_0xb7e4('0x26'),_0x983d60,_0xb7e4('0x27'));logger[_0xb7e4('0x28')](_0xb7e4('0x29'),_0x983d60,'request\x20sent',JSON[_0xb7e4('0x2a')](_0x44a6c9));if(_0x44a6c9[_0xb7e4('0x2b')]){if(_0x44a6c9[_0xb7e4('0x2b')][_0xb7e4('0x2c')]===0x1f4){logger[_0xb7e4('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x983d60,_0x44a6c9[_0xb7e4('0x2b')][_0xb7e4('0x2d')]);return _0x1a6999(_0x44a6c9[_0xb7e4('0x2b')][_0xb7e4('0x2d')]);}logger[_0xb7e4('0x2b')](_0xb7e4('0x26'),_0x983d60,_0x44a6c9['error'][_0xb7e4('0x2d')]);return _0x4d4220(_0x44a6c9[_0xb7e4('0x2b')][_0xb7e4('0x2d')]);}else{logger[_0xb7e4('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x983d60,_0xb7e4('0x27'));_0x4d4220(_0x44a6c9[_0xb7e4('0x2e')]['message']);}})[_0xb7e4('0x2f')](function(_0xedb514){logger[_0xb7e4('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x983d60,_0xedb514);_0x1a6999(_0xedb514);});});}function respondWithStatusCode(_0x3d5198,_0x457d9e){_0x457d9e=_0x457d9e||0xcc;return function(_0x4cff42){if(_0x4cff42){return _0x3d5198[_0xb7e4('0x30')](_0x457d9e);}return _0x3d5198[_0xb7e4('0x31')](_0x457d9e)['end']();};}function respondWithResult(_0x1a9d1c,_0xd0b54c){_0xd0b54c=_0xd0b54c||0xc8;return function(_0x33a80e){if(_0x33a80e){return _0x1a9d1c['status'](_0xd0b54c)[_0xb7e4('0x32')](_0x33a80e);}};}function respondWithFilteredResult(_0x1e2b8f,_0x248cc0){return function(_0x4e6a2b){if(_0x4e6a2b){var _0x41011d=typeof _0x248cc0[_0xb7e4('0x33')]===_0xb7e4('0x34')&&typeof _0x248cc0[_0xb7e4('0x35')]===_0xb7e4('0x34');var _0x1f7436=_0x4e6a2b[_0xb7e4('0x36')];var _0x601559=_0x41011d?0x0:_0x248cc0[_0xb7e4('0x33')];var _0x52ec18=_0x41011d?_0x4e6a2b[_0xb7e4('0x36')]:_0x248cc0[_0xb7e4('0x33')]+_0x248cc0[_0xb7e4('0x35')];var _0x222529;if(_0x52ec18>=_0x1f7436){_0x52ec18=_0x1f7436;_0x222529=0xc8;}else{_0x222529=0xce;}_0x1e2b8f['status'](_0x222529);return _0x1e2b8f[_0xb7e4('0x37')](_0xb7e4('0x38'),_0x601559+'-'+_0x52ec18+'/'+_0x1f7436)[_0xb7e4('0x32')](_0x4e6a2b);}return null;};}function patchUpdates(_0x2287fc){return function(_0x7404b3){try{jsonpatch['apply'](_0x7404b3,_0x2287fc,!![]);}catch(_0x1fe213){return BPromise['reject'](_0x1fe213);}return _0x7404b3[_0xb7e4('0x39')]();};}function saveUpdates(_0xffa6b4,_0x3c003e){return function(_0x2245a1){if(_0x2245a1){return _0x2245a1[_0xb7e4('0x3a')](_0xffa6b4)[_0xb7e4('0x24')](function(_0x399891){return _0x399891;});}return null;};}function removeEntity(_0x38d510,_0x132c01){return function(_0x5ea49f){if(_0x5ea49f){return _0x5ea49f[_0xb7e4('0x3b')]()[_0xb7e4('0x24')](function(){var _0x1ebf15=_0x5ea49f[_0xb7e4('0x3c')]({'plain':!![]});var _0x1c9608='OpenchannelAccounts';return db[_0xb7e4('0x3d')][_0xb7e4('0x3b')]({'where':{'type':_0x1c9608,'resourceId':_0x1ebf15['id']}})['then'](function(){return _0x5ea49f;});})[_0xb7e4('0x24')](function(){_0x38d510['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc84c,_0x21e749){return function(_0x53d097){if(!_0x53d097){_0xcc84c[_0xb7e4('0x30')](0x194);}return _0x53d097;};}function handleError(_0x56b7e8,_0x1b4cd2){_0x1b4cd2=_0x1b4cd2||0x1f4;return function(_0x2365f1){logger[_0xb7e4('0x2b')](_0x2365f1[_0xb7e4('0x3e')]);if(_0x2365f1[_0xb7e4('0x3f')]){delete _0x2365f1[_0xb7e4('0x3f')];}_0x56b7e8['status'](_0x1b4cd2)['send'](_0x2365f1);};}exports[_0xb7e4('0x40')]=function(_0x359bc4,_0x2b2514){var _0x4cf4ea={'include':[{'model':db['Pause'],'as':_0xb7e4('0x41')}]},_0x10dc8e={},_0x438028={'count':0x0,'rows':[]};var _0x5efa7e=_[_0xb7e4('0x42')](db['OpenchannelAccount'][_0xb7e4('0x43')],function(_0x1af4e6){return{'name':_0x1af4e6[_0xb7e4('0x44')],'type':_0x1af4e6[_0xb7e4('0x45')]['key']};});_0x10dc8e[_0xb7e4('0x46')]=_['map'](_0x5efa7e,_0xb7e4('0x3f'));_0x10dc8e[_0xb7e4('0x47')]=_['keys'](_0x359bc4[_0xb7e4('0x47')]);_0x10dc8e[_0xb7e4('0x48')]=_[_0xb7e4('0x49')](_0x10dc8e['model'],_0x10dc8e[_0xb7e4('0x47')]);_0x4cf4ea[_0xb7e4('0x4a')]=_['intersection'](_0x10dc8e[_0xb7e4('0x46')],qs[_0xb7e4('0x4b')](_0x359bc4['query'][_0xb7e4('0x4b')]));_0x4cf4ea['attributes']=_0x4cf4ea['attributes'][_0xb7e4('0x4c')]?_0x4cf4ea[_0xb7e4('0x4a')]:_0x10dc8e['model'];if(!_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x4d')](_0xb7e4('0x4e'))){_0x4cf4ea[_0xb7e4('0x35')]=qs[_0xb7e4('0x35')](_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x4cf4ea['offset']=qs[_0xb7e4('0x33')](_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x33')]);}_0x4cf4ea[_0xb7e4('0x4f')]=qs['sort'](_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x4cf4ea[_0xb7e4('0x51')]=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0x359bc4[_0xb7e4('0x47')],_0x10dc8e[_0xb7e4('0x48')]),_0x5efa7e);if(_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x53')]){_0x4cf4ea[_0xb7e4('0x51')]=_[_0xb7e4('0x54')](_0x4cf4ea[_0xb7e4('0x51')],{'$or':_[_0xb7e4('0x42')](_0x5efa7e,function(_0x1b27e0){if(_0x1b27e0[_0xb7e4('0x45')]!=='VIRTUAL'){var _0x10b657={};_0x10b657[_0x1b27e0[_0xb7e4('0x3f')]]={'$like':'%'+_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x53')]+'%'};return _0x10b657;}})});}_0x4cf4ea=_[_0xb7e4('0x54')]({},_0x4cf4ea,_0x359bc4[_0xb7e4('0x55')]);var _0x962201={'where':_0x4cf4ea['where']};return db[_0xb7e4('0x56')]['count'](_0x962201)[_0xb7e4('0x24')](function(_0x270577){_0x438028[_0xb7e4('0x36')]=_0x270577;if(_0x359bc4[_0xb7e4('0x47')]['includeAll']){_0x4cf4ea[_0xb7e4('0x57')]=[{'all':!![]}];}return db[_0xb7e4('0x56')][_0xb7e4('0x58')](_0x4cf4ea);})[_0xb7e4('0x24')](function(_0x35b549){_0x438028[_0xb7e4('0x59')]=_0x35b549;return _0x438028;})['then'](respondWithFilteredResult(_0x2b2514,_0x4cf4ea))[_0xb7e4('0x2f')](handleError(_0x2b2514,null));};exports[_0xb7e4('0x5a')]=function(_0x20f030,_0xe3c060){var _0x2e136e={'raw':![],'where':{'id':_0x20f030[_0xb7e4('0x5b')]['id']},'include':[{'model':db[_0xb7e4('0x5c')],'as':'mandatoryDispositionPause'}]},_0x3c6d0c={};_0x3c6d0c[_0xb7e4('0x46')]=_[_0xb7e4('0x5d')](db['OpenchannelAccount'][_0xb7e4('0x43')]);_0x3c6d0c['query']=_[_0xb7e4('0x5d')](_0x20f030[_0xb7e4('0x47')]);_0x3c6d0c[_0xb7e4('0x48')]=_[_0xb7e4('0x49')](_0x3c6d0c[_0xb7e4('0x46')],_0x3c6d0c['query']);_0x2e136e[_0xb7e4('0x4a')]=_[_0xb7e4('0x49')](_0x3c6d0c[_0xb7e4('0x46')],qs[_0xb7e4('0x4b')](_0x20f030['query'][_0xb7e4('0x4b')]));_0x2e136e[_0xb7e4('0x4a')]=_0x2e136e[_0xb7e4('0x4a')][_0xb7e4('0x4c')]?_0x2e136e[_0xb7e4('0x4a')]:_0x3c6d0c[_0xb7e4('0x46')];if(_0x20f030[_0xb7e4('0x47')][_0xb7e4('0x5e')]){_0x2e136e[_0xb7e4('0x57')]=[{'all':!![]}];}_0x2e136e=_[_0xb7e4('0x54')]({},_0x2e136e,_0x20f030['options']);return db['OpenchannelAccount'][_0xb7e4('0x5f')](_0x2e136e)[_0xb7e4('0x24')](handleEntityNotFound(_0xe3c060,null))[_0xb7e4('0x24')](respondWithResult(_0xe3c060,null))[_0xb7e4('0x2f')](handleError(_0xe3c060,null));};exports['create']=function(_0x4859f9,_0x50af79){return db[_0xb7e4('0x56')]['create'](_0x4859f9[_0xb7e4('0x60')],{})[_0xb7e4('0x24')](function(_0x2f6d40){var _0x75bbd0=_0x4859f9[_0xb7e4('0x61')][_0xb7e4('0x3c')]({'plain':!![]});if(!_0x75bbd0)throw new Error(_0xb7e4('0x62'));if(_0x75bbd0['role']===_0xb7e4('0x61')){var _0x37b2cc=_0x2f6d40[_0xb7e4('0x3c')]({'plain':!![]});var _0x5ec77e=_0xb7e4('0x63');return db[_0xb7e4('0x64')][_0xb7e4('0x5f')]({'where':{'name':_0x5ec77e,'userProfileId':_0x75bbd0['userProfileId']},'raw':!![]})['then'](function(_0x234f78){if(_0x234f78&&_0x234f78[_0xb7e4('0x65')]===0x0){return db[_0xb7e4('0x3d')][_0xb7e4('0x66')]({'name':_0x37b2cc[_0xb7e4('0x3f')],'resourceId':_0x37b2cc['id'],'type':_0x234f78['name'],'sectionId':_0x234f78['id']},{})[_0xb7e4('0x24')](function(){return _0x2f6d40;});}else{return _0x2f6d40;}})['catch'](function(_0x359101){logger['error'](_0xb7e4('0x67'),_0x359101);throw _0x359101;});}return _0x2f6d40;})[_0xb7e4('0x24')](respondWithResult(_0x50af79,0xc9))[_0xb7e4('0x2f')](handleError(_0x50af79,null));};exports[_0xb7e4('0x3a')]=function(_0x1eaf8d,_0x276395){if(_0x1eaf8d[_0xb7e4('0x60')]['id']){delete _0x1eaf8d[_0xb7e4('0x60')]['id'];}return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x1eaf8d[_0xb7e4('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xb7e4('0x41')}]})[_0xb7e4('0x24')](handleEntityNotFound(_0x276395,null))[_0xb7e4('0x24')](saveUpdates(_0x1eaf8d[_0xb7e4('0x60')],null))[_0xb7e4('0x24')](respondWithResult(_0x276395,null))['catch'](handleError(_0x276395,null));};exports[_0xb7e4('0x3b')]=function(_0x16fb3a,_0x4817df){return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x16fb3a[_0xb7e4('0x5b')]['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x4817df,null))[_0xb7e4('0x24')](removeEntity(_0x4817df,null))['catch'](handleError(_0x4817df,null));};exports[_0xb7e4('0x68')]=function(_0x2acb96,_0x48ee64){return db[_0xb7e4('0x56')][_0xb7e4('0x68')]()[_0xb7e4('0x24')](respondWithResult(_0x48ee64,null))[_0xb7e4('0x2f')](handleError(_0x48ee64,null));};exports[_0xb7e4('0x69')]=function(_0x3a13b4,_0x561423,_0x2b0f46){if(_0x3a13b4[_0xb7e4('0x60')]['id']){delete _0x3a13b4[_0xb7e4('0x60')]['id'];}return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x3a13b4[_0xb7e4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x561423,null))[_0xb7e4('0x24')](function(_0x468090){if(_0x468090){_0x3a13b4['body'][_0xb7e4('0x6a')]=_0x468090['id'];return db[_0xb7e4('0x6b')][_0xb7e4('0x66')](_0x3a13b4[_0xb7e4('0x60')]);}})['then'](respondWithResult(_0x561423,null))[_0xb7e4('0x2f')](handleError(_0x561423,null));};exports[_0xb7e4('0x6c')]=function(_0x172521,_0x12854e,_0x1d39a3){var _0x2f8388={'raw':![],'where':{}};var _0x202490={};var _0x4b5f6d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb7e4('0x6d')]({'where':{'id':_0x172521[_0xb7e4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x12854e,null))[_0xb7e4('0x24')](function(_0x233f9c){if(_0x233f9c){_0x202490[_0xb7e4('0x46')]=_[_0xb7e4('0x5d')](db[_0xb7e4('0x6b')]['rawAttributes']);_0x202490[_0xb7e4('0x47')]=_[_0xb7e4('0x5d')](_0x172521['query']);_0x202490['filters']=_[_0xb7e4('0x49')](_0x202490[_0xb7e4('0x46')],_0x202490['query']);_0x2f8388[_0xb7e4('0x4a')]=_[_0xb7e4('0x49')](_0x202490['model'],qs[_0xb7e4('0x4b')](_0x172521[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x2f8388['attributes']=_0x2f8388[_0xb7e4('0x4a')][_0xb7e4('0x4c')]?_0x2f8388[_0xb7e4('0x4a')]:_0x202490[_0xb7e4('0x46')];if(!_0x172521[_0xb7e4('0x47')][_0xb7e4('0x4d')](_0xb7e4('0x4e'))){_0x2f8388['limit']=qs['limit'](_0x172521[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x2f8388['offset']=qs[_0xb7e4('0x33')](_0x172521[_0xb7e4('0x47')][_0xb7e4('0x33')]);}_0x2f8388[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0x172521[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x2f8388['where']=qs['filters'](_['pick'](_0x172521[_0xb7e4('0x47')],_0x202490[_0xb7e4('0x48')]));_0x2f8388[_0xb7e4('0x51')][_0xb7e4('0x6a')]=_0x233f9c['id'];if(_0x172521[_0xb7e4('0x47')][_0xb7e4('0x53')]){_0x2f8388[_0xb7e4('0x51')]=_[_0xb7e4('0x54')](_0x2f8388['where'],{'$or':_[_0xb7e4('0x42')](_0x2f8388[_0xb7e4('0x4a')],function(_0x2ddf5e){var _0x1b172b={};_0x1b172b[_0x2ddf5e]={'$like':'%'+_0x172521[_0xb7e4('0x47')][_0xb7e4('0x53')]+'%'};return _0x1b172b;})});}_0x2f8388=_[_0xb7e4('0x54')]({},_0x2f8388,_0x172521['options']);return db[_0xb7e4('0x6b')][_0xb7e4('0x36')]({'where':_0x2f8388['where']})[_0xb7e4('0x24')](function(_0x4d8cc8){_0x4b5f6d[_0xb7e4('0x36')]=_0x4d8cc8;if(_0x172521[_0xb7e4('0x47')][_0xb7e4('0x5e')]){_0x2f8388[_0xb7e4('0x57')]=[{'all':!![]}];}return db[_0xb7e4('0x6b')][_0xb7e4('0x58')](_0x2f8388);})['then'](function(_0x37a27c){_0x4b5f6d[_0xb7e4('0x59')]=_0x37a27c;return _0x4b5f6d;});}})[_0xb7e4('0x24')](respondWithFilteredResult(_0x12854e,_0x2f8388))[_0xb7e4('0x2f')](handleError(_0x12854e,null));};exports[_0xb7e4('0x6e')]=function(_0x8f020d,_0x29fb08,_0x138672){return db['OpenchannelAccount'][_0xb7e4('0x5f')]({'where':{'id':_0x8f020d['params']['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x29fb08,null))[_0xb7e4('0x24')](function(_0x272b8d){if(_0x272b8d){return _0x272b8d['removeDispositions'](_0x8f020d[_0xb7e4('0x47')]['ids']);}})[_0xb7e4('0x24')](respondWithStatusCode(_0x29fb08,null))[_0xb7e4('0x2f')](handleError(_0x29fb08,null));};exports[_0xb7e4('0x6f')]=function(_0x83a245,_0x451877,_0x424932){if(_0x83a245[_0xb7e4('0x60')]['id']){delete _0x83a245['body']['id'];}return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x83a245['params']['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x451877,null))[_0xb7e4('0x24')](function(_0x4fffbe){if(_0x4fffbe){_0x83a245['body'][_0xb7e4('0x6a')]=_0x4fffbe['id'];return db[_0xb7e4('0x70')]['create'](_0x83a245[_0xb7e4('0x60')]);}})['then'](respondWithResult(_0x451877,null))[_0xb7e4('0x2f')](handleError(_0x451877,null));};exports[_0xb7e4('0x71')]=function(_0x51f372,_0x476ed2,_0x1f8336){var _0x10a1fe={'raw':![],'where':{}};var _0x37ba22={};var _0x15e84f={'count':0x0,'rows':[]};return db[_0xb7e4('0x56')][_0xb7e4('0x6d')]({'where':{'id':_0x51f372['params']['id']}})['then'](handleEntityNotFound(_0x476ed2,null))[_0xb7e4('0x24')](function(_0x544954){if(_0x544954){_0x37ba22[_0xb7e4('0x46')]=_[_0xb7e4('0x5d')](db[_0xb7e4('0x70')][_0xb7e4('0x43')]);_0x37ba22[_0xb7e4('0x47')]=_[_0xb7e4('0x5d')](_0x51f372[_0xb7e4('0x47')]);_0x37ba22[_0xb7e4('0x48')]=_[_0xb7e4('0x49')](_0x37ba22[_0xb7e4('0x46')],_0x37ba22[_0xb7e4('0x47')]);_0x10a1fe['attributes']=_['intersection'](_0x37ba22[_0xb7e4('0x46')],qs[_0xb7e4('0x4b')](_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x10a1fe[_0xb7e4('0x4a')]=_0x10a1fe['attributes']['length']?_0x10a1fe[_0xb7e4('0x4a')]:_0x37ba22['model'];if(!_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x4d')]('nolimit')){_0x10a1fe[_0xb7e4('0x35')]=qs['limit'](_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x10a1fe['offset']=qs[_0xb7e4('0x33')](_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x33')]);}_0x10a1fe[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x10a1fe['where']=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0x51f372['query'],_0x37ba22[_0xb7e4('0x48')]));_0x10a1fe['where'][_0xb7e4('0x6a')]=_0x544954['id'];if(_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x53')]){_0x10a1fe[_0xb7e4('0x51')]=_['merge'](_0x10a1fe[_0xb7e4('0x51')],{'$or':_[_0xb7e4('0x42')](_0x10a1fe[_0xb7e4('0x4a')],function(_0x1f9bfc){var _0xfccc80={};_0xfccc80[_0x1f9bfc]={'$like':'%'+_0x51f372[_0xb7e4('0x47')]['filter']+'%'};return _0xfccc80;})});}_0x10a1fe=_[_0xb7e4('0x54')]({},_0x10a1fe,_0x51f372[_0xb7e4('0x55')]);return db[_0xb7e4('0x70')][_0xb7e4('0x36')]({'where':_0x10a1fe[_0xb7e4('0x51')]})['then'](function(_0x4060d9){_0x15e84f['count']=_0x4060d9;if(_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x5e')]){_0x10a1fe[_0xb7e4('0x57')]=[{'all':!![]}];}return db[_0xb7e4('0x70')]['findAll'](_0x10a1fe);})[_0xb7e4('0x24')](function(_0x37d9fc){_0x15e84f['rows']=_0x37d9fc;return _0x15e84f;});}})[_0xb7e4('0x24')](respondWithFilteredResult(_0x476ed2,_0x10a1fe))['catch'](handleError(_0x476ed2,null));};exports[_0xb7e4('0x72')]=function(_0x40ac45,_0x4b2433,_0x38649f){return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x40ac45['params']['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x4b2433,null))[_0xb7e4('0x24')](function(_0x553880){if(_0x553880){return _0x553880[_0xb7e4('0x72')](_0x40ac45['query'][_0xb7e4('0x73')]);}})[_0xb7e4('0x24')](respondWithStatusCode(_0x4b2433,null))[_0xb7e4('0x2f')](handleError(_0x4b2433,null));};exports['notify']=function(_0x5f4fe2,_0x3e9dcc,_0x1107d8){var _0x52328b={'body':_0x5f4fe2[_0xb7e4('0x60')],'channel':'openchannel'};var _0x5cad96=[];var _0x209503=[];var _0x3d7716={};var _0x34ea13=![];return db[_0xb7e4('0x74')][_0xb7e4('0x68')]()[_0xb7e4('0x24')](function(_0x5bd5e1){if(!_0x5bd5e1){throw new db[(_0xb7e4('0x75'))][(_0xb7e4('0x76'))](_0xb7e4('0x77'));}_0x5cad96=_['difference'](_[_0xb7e4('0x5d')](_0x5bd5e1),['createdAt',_0xb7e4('0x78')]);_0x209503=_['difference'](_[_0xb7e4('0x5d')](_0x5bd5e1),[_0xb7e4('0x79'),_0xb7e4('0x78'),_0xb7e4('0x7a'),_0xb7e4('0x7b')]);if(_0x5f4fe2[_0xb7e4('0x60')]['id']){delete _0x5f4fe2[_0xb7e4('0x60')]['id'];}if(_[_0xb7e4('0x7c')](_0x5f4fe2[_0xb7e4('0x60')]['from'])){throw new db['Sequelize'][(_0xb7e4('0x76'))](_0xb7e4('0x7d'));}if(_['isNil'](_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x60')])||_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x60')]===''){throw new db[(_0xb7e4('0x75'))][(_0xb7e4('0x76'))](_0xb7e4('0x7e'));}if(_[_0xb7e4('0x7c')](_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x7f')])){throw new db['Sequelize']['ValidationError'](_0xb7e4('0x80')+_0x209503);}if(!_['includes'](_0x209503,_0x5f4fe2[_0xb7e4('0x60')]['mapKey'])){throw new db[(_0xb7e4('0x75'))][(_0xb7e4('0x76'))](_0xb7e4('0x81')+_0x209503);}_0x3d7716[_0x5f4fe2['body']['mapKey']]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x82')];})[_0xb7e4('0x24')](function(){return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x5f4fe2[_0xb7e4('0x5b')]['id']},'include':[{'model':db[_0xb7e4('0x83')],'as':_0xb7e4('0x84'),'include':[{'model':db[_0xb7e4('0x74')],'as':_0xb7e4('0x85'),'where':_0x3d7716,'limit':0x1,'order':[['updatedAt',_0xb7e4('0x86')]]}]},{'model':db['OpenchannelApplication'],'as':_0xb7e4('0x87')}]});})[_0xb7e4('0x24')](handleEntityNotFound(_0x3e9dcc,null))[_0xb7e4('0x24')](function(_0x32e12a){if(_0x32e12a&&_0x32e12a[_0xb7e4('0x84')]){_0x52328b[_0xb7e4('0x88')]=_0x32e12a;_0x52328b[_0xb7e4('0x89')]=_0x32e12a[_0xb7e4('0x87')];_0x52328b['list']=_0x32e12a[_0xb7e4('0x84')];_0x52328b[_0xb7e4('0x89')]=_[_0xb7e4('0x8a')](_0x52328b[_0xb7e4('0x89')],['priority'],['asc']);if(_0x52328b[_0xb7e4('0x88')][_0xb7e4('0x87')]){delete _0x52328b['account']['Applications'];}if(_0x52328b[_0xb7e4('0x88')][_0xb7e4('0x84')]&&_0x52328b['account']['List'][_0xb7e4('0x85')][_0xb7e4('0x4c')]){return _0x52328b[_0xb7e4('0x88')]['List'][_0xb7e4('0x85')][0x0];}var _0x295cd9=_[_0xb7e4('0x1b')](_0x5f4fe2[_0xb7e4('0x60')],{'firstName':_0x5f4fe2['body'][_0xb7e4('0x82')],'ListId':_0x32e12a[_0xb7e4('0x7b')]});_0x295cd9[_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x7f')]]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x82')];return db['CmContact'][_0xb7e4('0x66')](_0x295cd9,{'fields':_0x5cad96,'raw':!![]});}})['then'](handleEntityNotFound(_0x3e9dcc,null))[_0xb7e4('0x24')](function(_0x17982f){_0x52328b[_0xb7e4('0x8b')]=_0x17982f;if(_0x17982f){var _0x5aa5f9={'ContactId':_0x17982f['id'],'OpenchannelAccountId':_0x5f4fe2[_0xb7e4('0x5b')]['id'],'from':(_0x17982f[_0xb7e4('0x8c')]||'')+'\x20'+(_0x17982f['lastName']||'')};var _0x173d6a={'OpenchannelAccountId':_0x5f4fe2['params']['id'],'closed':![]};if(_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8d')]){_0x173d6a[_0xb7e4('0x8d')]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8d')];return db[_0xb7e4('0x8e')][_0xb7e4('0x5f')]({'where':_0x173d6a})['then'](function(_0x5269c4){if(_0x5269c4){return[_0x5269c4,![]];}_0x5aa5f9[_0xb7e4('0x8d')]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8d')];_0x5aa5f9[_0xb7e4('0x8f')]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8f')];return db[_0xb7e4('0x8e')][_0xb7e4('0x66')](_0x5aa5f9)[_0xb7e4('0x24')](function(_0x5f1984){return[_0x5f1984,!![]];});});}else{_0x173d6a['threadId']=null;}_0x173d6a['ContactId']=_0x17982f['id'];return db[_0xb7e4('0x8e')][_0xb7e4('0x5f')]({'where':_0x173d6a})[_0xb7e4('0x24')](function(_0x93582a){if(_0x93582a){return[_0x93582a,![]];}return db[_0xb7e4('0x8e')][_0xb7e4('0x66')](_0x5aa5f9)[_0xb7e4('0x24')](function(_0x47c982){return[_0x47c982,!![]];});});}})['spread'](function(_0x24f8f4,_0x53f148){if(_0x24f8f4){_0x34ea13=_0x53f148;if(!_0x53f148){var _0x2da8aa={'from':(_0x52328b[_0xb7e4('0x8b')][_0xb7e4('0x8c')]||'')+'\x20'+(_0x52328b['contact'][_0xb7e4('0x90')]||'')};if(_0x5f4fe2['body']['threadId']&&_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x91')]&&_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8d')]!=_0x5f4fe2[_0xb7e4('0x60')]['messageId']){_0x2da8aa['threadId']=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x91')];}return _0x24f8f4[_0xb7e4('0x3a')](_0x2da8aa);}else{return _0x24f8f4;}}})['then'](function(_0x328b61){_0x52328b[_0xb7e4('0x92')]=_0x328b61[_0xb7e4('0x3c')]({'plain':!![]});_0x52328b['interaction'][_0xb7e4('0x93')]=_0x34ea13;if(_0x52328b[_0xb7e4('0x92')][_0xb7e4('0x93')]){if(_0x52328b[_0xb7e4('0x88')][_0xb7e4('0x94')]){_0x52328b['applications'][_0xb7e4('0x95')]({'id':0x0,'priority':_0x52328b[_0xb7e4('0x89')][_0xb7e4('0x4c')]+0x1,'app':_0xb7e4('0x96'),'appdata':'unmanaged','interval':_0xb7e4('0x97')});}}return db[_0xb7e4('0x98')][_0xb7e4('0x66')]({'body':_0x5f4fe2[_0xb7e4('0x60')]['body'],'OpenchannelAccountId':_0x5f4fe2[_0xb7e4('0x5b')]['id'],'OpenchannelInteractionId':_0x328b61['id'],'direction':'in','ContactId':_0x52328b[_0xb7e4('0x8b')]['id'],'AttachmentId':_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x99')]});})['then'](function(_0x41f4c0){_0x52328b['message']=_0x41f4c0;if(!_0x52328b[_0xb7e4('0x92')]['UserId'])return;return db[_0xb7e4('0x9a')]['find']({'attributes':['id','name'],'where':{'id':_0x52328b[_0xb7e4('0x92')]['UserId']}});})[_0xb7e4('0x24')](function(_0x5a0d66){if(_0x5a0d66){_0x52328b[_0xb7e4('0x89')][_0xb7e4('0x9b')]({'id':0x0,'priority':0x0,'app':_0xb7e4('0x9c'),'appdata':_0x5a0d66[_0xb7e4('0x3f')]+','+(_0x52328b['account'][_0xb7e4('0x9d')]||0xa),'interval':'*,*,*,*'});}if(!_0x52328b[_0xb7e4('0x92')][_0xb7e4('0x9e')])return;return db[_0xb7e4('0x9f')][_0xb7e4('0x5f')]({'attributes':['id','name'],'where':{'id':_0x52328b[_0xb7e4('0x92')][_0xb7e4('0x9e')]}});})['then'](function(_0x4d84bb){if(_0x4d84bb){_0x52328b['applications'][_0xb7e4('0x9b')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4d84bb[_0xb7e4('0x3f')]+','+(_0x52328b['account'][_0xb7e4('0xa0')]||0x12c),'interval':_0xb7e4('0x97')});}return respondWithRpcPromise(_0xb7e4('0xa1'),_0xb7e4('0xa2'),_0x52328b);})['then'](function(_0x324d9f){respondWithRpcPromise(_0xb7e4('0xa3'),'EventManager',{'event':_0xb7e4('0xa4'),'message':_0x324d9f},client9002);return _0x324d9f;})[_0xb7e4('0x24')](respondWithResult(_0x3e9dcc,null))[_0xb7e4('0x2f')](handleError(_0x3e9dcc,null));};exports[_0xb7e4('0xa5')]=function(_0x28b3b1,_0x5a74ba){var _0x143f0f=_0x28b3b1[_0xb7e4('0x5b')]['id'];var _0x51f921=_0x28b3b1[_0xb7e4('0x60')];var _0x503a66=0xc8;var _0x1110fe=null;return db[_0xb7e4('0xa6')][_0xb7e4('0xa7')]({'isolationLevel':db[_0xb7e4('0xa6')][_0xb7e4('0xa8')][_0xb7e4('0xa9')][_0xb7e4('0xaa')]},function(_0x323861){return db[_0xb7e4('0x56')]['findOne']({'where':{'id':_0x143f0f},'transaction':_0x323861})[_0xb7e4('0x24')](function(_0xf09e77){if(_0xf09e77){return db[_0xb7e4('0xab')][_0xb7e4('0x3b')]({'where':{'OpenchannelAccountId':_0x143f0f},'transaction':_0x323861})[_0xb7e4('0x24')](function(){var _0x5b9c23=_[_0xb7e4('0x42')](_0x51f921,function(_0x14bced){_0x14bced[_0xb7e4('0x6a')]=_0x143f0f;return _0x14bced;});return db[_0xb7e4('0xab')]['bulkCreate'](_0x5b9c23,{'transaction':_0x323861});});}else{_0x503a66=0x194;_0x1110fe=[];}});})['then'](function(){if(_0x503a66!==0x194){return db[_0xb7e4('0xab')][_0xb7e4('0xac')]({'where':{'OpenchannelAccountId':_0x143f0f},'order':'priority'})[_0xb7e4('0x24')](function(_0x4cf9aa){_0x1110fe=_0x4cf9aa;});}})[_0xb7e4('0x2f')](function(_0x3d8933){_0x503a66=0x1f4;logger[_0xb7e4('0x2b')](_0x3d8933[_0xb7e4('0x3e')]);if(_0x3d8933[_0xb7e4('0x3f')]){delete _0x3d8933['name'];}_0x1110fe=_0x3d8933;})['finally'](function(){if(_0x1110fe===null){_0x5a74ba[_0xb7e4('0x30')](_0x503a66);}else{if(_0x503a66===0x1f4){_0x5a74ba[_0xb7e4('0x31')](_0x503a66)['send'](_0x1110fe);}else{_0x5a74ba['status'](_0x503a66)[_0xb7e4('0x32')](_0x1110fe);}}});};exports[_0xb7e4('0xad')]=function(_0xc94235,_0x53bb2c,_0x1d0d9f){var _0x34f152={};var _0x304d49={};var _0x1b1100;var _0x539440;return db[_0xb7e4('0x56')][_0xb7e4('0x6d')]({'where':{'id':_0xc94235[_0xb7e4('0x5b')]['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x53bb2c,null))[_0xb7e4('0x24')](function(_0x34acaa){if(_0x34acaa){_0x1b1100=_0x34acaa;_0x304d49[_0xb7e4('0x46')]=_[_0xb7e4('0x5d')](db['OpenchannelApplication'][_0xb7e4('0x43')]);_0x304d49['query']=_['keys'](_0xc94235[_0xb7e4('0x47')]);_0x304d49[_0xb7e4('0x48')]=_[_0xb7e4('0x49')](_0x304d49[_0xb7e4('0x46')],_0x304d49[_0xb7e4('0x47')]);_0x34f152[_0xb7e4('0x4a')]=_[_0xb7e4('0x49')](_0x304d49[_0xb7e4('0x46')],qs[_0xb7e4('0x4b')](_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x34f152[_0xb7e4('0x4a')]=_0x34f152[_0xb7e4('0x4a')][_0xb7e4('0x4c')]?_0x34f152[_0xb7e4('0x4a')]:_0x304d49['model'];_0x34f152[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x34f152[_0xb7e4('0x51')]=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0xc94235[_0xb7e4('0x47')],_0x304d49[_0xb7e4('0x48')]));if(_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x53')]){_0x34f152[_0xb7e4('0x51')]=_[_0xb7e4('0x54')](_0x34f152[_0xb7e4('0x51')],{'$or':_[_0xb7e4('0x42')](_0x34f152['attributes'],function(_0x501329){var _0x1d1c70={};_0x1d1c70[_0x501329]={'$like':'%'+_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x53')]+'%'};return _0x1d1c70;})});}_0x34f152=_[_0xb7e4('0x54')]({},_0x34f152,_0xc94235[_0xb7e4('0x55')]);return _0x1b1100[_0xb7e4('0xad')](_0x34f152);}})[_0xb7e4('0x24')](function(_0x5e23b5){if(_0x5e23b5){_0x539440=_0x5e23b5['length'];if(!_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x4d')]('nolimit')){_0x34f152[_0xb7e4('0x35')]=qs[_0xb7e4('0x35')](_0xc94235[_0xb7e4('0x47')]['limit']);_0x34f152[_0xb7e4('0x33')]=qs[_0xb7e4('0x33')](_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x33')]);}return _0x1b1100[_0xb7e4('0xad')](_0x34f152);}})[_0xb7e4('0x24')](function(_0x4e9fb0){if(_0x4e9fb0){return _0x4e9fb0?{'count':_0x539440,'rows':_0x4e9fb0}:null;}})[_0xb7e4('0x24')](respondWithResult(_0x53bb2c,null))[_0xb7e4('0x2f')](handleError(_0x53bb2c,null));};exports['getInteractions']=function(_0x166a6e,_0xd30902,_0x396e54){var _0x43a609={'raw':![],'where':{}};var _0x39bc5e={};var _0x3f873d={'count':0x0,'rows':[]};return db[_0xb7e4('0x56')][_0xb7e4('0x6d')]({'where':{'id':_0x166a6e['params']['id']}})['then'](handleEntityNotFound(_0xd30902,null))[_0xb7e4('0x24')](function(_0x2a8020){if(_0x2a8020){_0x39bc5e['model']=_[_0xb7e4('0x5d')](db[_0xb7e4('0x8e')][_0xb7e4('0x43')]);_0x39bc5e[_0xb7e4('0x47')]=_[_0xb7e4('0x5d')](_0x166a6e[_0xb7e4('0x47')]);_0x39bc5e[_0xb7e4('0x48')]=_['intersection'](_0x39bc5e[_0xb7e4('0x46')],_0x39bc5e[_0xb7e4('0x47')]);_0x43a609[_0xb7e4('0x4a')]=_[_0xb7e4('0x49')](_0x39bc5e[_0xb7e4('0x46')],qs['fields'](_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x43a609[_0xb7e4('0x4a')]=_0x43a609[_0xb7e4('0x4a')][_0xb7e4('0x4c')]?_0x43a609[_0xb7e4('0x4a')]:_0x39bc5e[_0xb7e4('0x46')];if(!_0x166a6e['query'][_0xb7e4('0x4d')](_0xb7e4('0x4e'))){_0x43a609[_0xb7e4('0x35')]=qs[_0xb7e4('0x35')](_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x43a609[_0xb7e4('0x33')]=qs['offset'](_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x33')]);}_0x43a609[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x43a609[_0xb7e4('0x51')]=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0x166a6e[_0xb7e4('0x47')],_0x39bc5e[_0xb7e4('0x48')]));_0x43a609[_0xb7e4('0x51')][_0xb7e4('0x6a')]=_0x2a8020['id'];if(_0x166a6e['query'][_0xb7e4('0x53')]){_0x43a609['where']=_[_0xb7e4('0x54')](_0x43a609[_0xb7e4('0x51')],{'$or':_['map'](_0x43a609[_0xb7e4('0x4a')],function(_0x569854){var _0x4298fa={};_0x4298fa[_0x569854]={'$like':'%'+_0x166a6e[_0xb7e4('0x47')]['filter']+'%'};return _0x4298fa;})});}_0x43a609=_[_0xb7e4('0x54')]({},_0x43a609,_0x166a6e[_0xb7e4('0x55')]);return db[_0xb7e4('0x8e')][_0xb7e4('0x36')]({'where':_0x43a609[_0xb7e4('0x51')]})['then'](function(_0x5d315f){_0x3f873d[_0xb7e4('0x36')]=_0x5d315f;if(_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x5e')]){_0x43a609['include']=[{'model':db['CmContact'],'as':_0xb7e4('0xae'),'required':![]},{'model':db[_0xb7e4('0x9a')],'as':_0xb7e4('0xaf'),'attributes':[_0xb7e4('0x3f'),_0xb7e4('0xb0'),_0xb7e4('0xb1')],'required':![]},{'model':db[_0xb7e4('0xb2')],'as':_0xb7e4('0xb3'),'attributes':['id',_0xb7e4('0x3f'),_0xb7e4('0xb4')],'where':_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0xb5')]?{'id':_0x166a6e['query']['tag']}:undefined,'required':_0x166a6e[_0xb7e4('0x47')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xb7e4('0x58')](_0x43a609);})[_0xb7e4('0x24')](function(_0x5b5de7){_0x3f873d[_0xb7e4('0x59')]=_0x5b5de7;return _0x3f873d;});}})[_0xb7e4('0x24')](respondWithFilteredResult(_0xd30902,_0x43a609))[_0xb7e4('0x2f')](handleError(_0xd30902,null));};exports[_0xb7e4('0xb6')]=function(_0x180380,_0x4efcf9,_0x167bc6){return db['OpenchannelAccount']['find']({'where':{'id':_0x180380[_0xb7e4('0x5b')]['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x4efcf9,null))['then'](function(_0x12445c){if(_0x12445c){return _0x12445c[_0xb7e4('0xb6')](_0x180380[_0xb7e4('0x60')][_0xb7e4('0x73')],_[_0xb7e4('0xb7')](_0x180380[_0xb7e4('0x60')],[_0xb7e4('0x73'),'id'])||{})[_0xb7e4('0xb8')](function(_0x214a26){for(var _0x3407c4=0x0;_0x3407c4<_0x180380['body']['ids'][_0xb7e4('0x4c')];_0x3407c4+=0x1){socket[_0xb7e4('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x180380[_0xb7e4('0x60')]['ids'][_0x3407c4]),'OpenchannelAccountId':Number(_0x180380['params']['id'])});}return _0x214a26;});}})[_0xb7e4('0x24')](respondWithResult(_0x4efcf9,null))['catch'](handleError(_0x4efcf9,null));};exports[_0xb7e4('0xba')]=function(_0x2c62c1,_0x4524a4,_0x161c60){return db['OpenchannelAccount'][_0xb7e4('0x5f')]({'where':{'id':_0x2c62c1[_0xb7e4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4524a4,null))[_0xb7e4('0x24')](function(_0x44c332){if(_0x44c332){return _0x44c332[_0xb7e4('0xba')](_0x2c62c1[_0xb7e4('0x47')][_0xb7e4('0x73')])[_0xb7e4('0x24')](function(){if(_[_0xb7e4('0xbb')](_0x2c62c1[_0xb7e4('0x47')]['ids'])){for(var _0x3ed7db=0x0;_0x3ed7db<_0x2c62c1[_0xb7e4('0x47')][_0xb7e4('0x73')][_0xb7e4('0x4c')];_0x3ed7db+=0x1){socket[_0xb7e4('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2c62c1[_0xb7e4('0x47')][_0xb7e4('0x73')][_0x3ed7db]),'OpenchannelAccountId':Number(_0x2c62c1['params']['id'])});}}else{socket['emit'](_0xb7e4('0xbc'),{'UserId':Number(_0x2c62c1[_0xb7e4('0x47')]['ids']),'OpenchannelAccountId':Number(_0x2c62c1['params']['id'])});}});}})[_0xb7e4('0x24')](respondWithStatusCode(_0x4524a4,null))[_0xb7e4('0x2f')](handleError(_0x4524a4,null));};exports[_0xb7e4('0xbd')]=function(_0x39e5e4,_0x587b97,_0x297a24){var _0x172fa6={};var _0x409d74={};var _0x3049b5;var _0x4bbeba;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x39e5e4[_0xb7e4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x587b97,null))['then'](function(_0x3018a1){if(_0x3018a1){_0x3049b5=_0x3018a1;_0x409d74['model']=_[_0xb7e4('0x5d')](db['User'][_0xb7e4('0x43')]);_0x409d74[_0xb7e4('0x47')]=_['keys'](_0x39e5e4[_0xb7e4('0x47')]);_0x409d74['filters']=_[_0xb7e4('0x49')](_0x409d74[_0xb7e4('0x46')],_0x409d74['query']);_0x172fa6[_0xb7e4('0x4a')]=_['intersection'](_0x409d74[_0xb7e4('0x46')],qs['fields'](_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x172fa6[_0xb7e4('0x4a')]=_0x172fa6[_0xb7e4('0x4a')]['length']?_0x172fa6[_0xb7e4('0x4a')]:_0x409d74[_0xb7e4('0x46')];_0x172fa6[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0x39e5e4['query'][_0xb7e4('0x50')]);_0x172fa6[_0xb7e4('0x51')]=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0x39e5e4[_0xb7e4('0x47')],_0x409d74[_0xb7e4('0x48')]));if(_0x39e5e4[_0xb7e4('0x47')]['filter']){_0x172fa6[_0xb7e4('0x51')]=_[_0xb7e4('0x54')](_0x172fa6[_0xb7e4('0x51')],{'$or':_[_0xb7e4('0x42')](_0x172fa6[_0xb7e4('0x4a')],function(_0x35d759){var _0x440f89={};_0x440f89[_0x35d759]={'$like':'%'+_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x53')]+'%'};return _0x440f89;})});}_0x172fa6=_[_0xb7e4('0x54')]({},_0x172fa6,_0x39e5e4[_0xb7e4('0x55')]);return _0x3049b5[_0xb7e4('0xbd')](_0x172fa6);}})[_0xb7e4('0x24')](function(_0x50b7cf){if(_0x50b7cf){_0x4bbeba=_0x50b7cf[_0xb7e4('0x4c')];if(!_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x4d')](_0xb7e4('0x4e'))){_0x172fa6['limit']=qs['limit'](_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x172fa6[_0xb7e4('0x33')]=qs[_0xb7e4('0x33')](_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x33')]);}return _0x3049b5[_0xb7e4('0xbd')](_0x172fa6);}})[_0xb7e4('0x24')](function(_0x5310cb){if(_0x5310cb){return _0x5310cb?{'count':_0x4bbeba,'rows':_0x5310cb}:null;}})[_0xb7e4('0x24')](respondWithResult(_0x587b97,null))[_0xb7e4('0x2f')](handleError(_0x587b97,null));};exports['send']=function(_0x283cd6,_0x1097e8,_0x26d7d0){var _0x369e29,_0x3e89c7,_0x827cba;if(_['isNil'](_0x283cd6[_0xb7e4('0x60')][_0xb7e4('0x60')])||_0x283cd6['body'][_0xb7e4('0x60')]===''){throw new db[(_0xb7e4('0x75'))][(_0xb7e4('0x76'))](_0xb7e4('0x7e'));}if(_[_0xb7e4('0x7c')](_0x283cd6[_0xb7e4('0x60')]['to'])){}_0x369e29=_0x283cd6[_0xb7e4('0x60')]['to'];return db[_0xb7e4('0x56')][_0xb7e4('0x6d')]({'where':{'id':_0x283cd6[_0xb7e4('0x5b')]['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x1097e8,null))[_0xb7e4('0x24')](function(_0xc22249){if(_0xc22249){return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0xc22249['id']},'include':[{'model':db[_0xb7e4('0x83')],'as':_0xb7e4('0x84'),'include':[{'model':db[_0xb7e4('0x74')],'as':'Contacts','where':{[_0xc22249['mapKey']]:_0x369e29},'limit':0x1,'order':[[_0xb7e4('0x78'),_0xb7e4('0x86')]]}]}]})[_0xb7e4('0x24')](handleEntityNotFound(_0x1097e8,null))[_0xb7e4('0x24')](function(_0x3a20b4){if(_0x3a20b4&&_0x3a20b4['List']){_0x3e89c7=_0x3a20b4[_0xb7e4('0x3c')]({'plain':!![]});if(_0x3e89c7[_0xb7e4('0x84')]&&_0x3e89c7[_0xb7e4('0x84')][_0xb7e4('0x85')]['length']){return _0x3e89c7[_0xb7e4('0x84')]['Contacts'][0x0];}return db[_0xb7e4('0x74')][_0xb7e4('0x66')](_[_0xb7e4('0x1b')](_0x283cd6['body'],{'firstName':_0x369e29,[_0x3a20b4[_0xb7e4('0x7f')]]:_0x369e29,'phone':_0x369e29,'ListId':_0x3e89c7[_0xb7e4('0x7b')]}));}})[_0xb7e4('0x24')](handleEntityNotFound(_0x1097e8,null))[_0xb7e4('0x24')](function(_0x5ab583){if(_0x5ab583){_0x827cba=_0x5ab583;return db[_0xb7e4('0x8e')]['find']({'where':{'ContactId':_0x827cba['id'],'closed':![],'OpenchannelAccountId':_0x3e89c7['id']}})[_0xb7e4('0x24')](function(_0xfb09a4){if(_0xfb09a4){return[_0xfb09a4,![]];}return db['OpenchannelInteraction'][_0xb7e4('0x66')]({'UserId':_0x283cd6[_0xb7e4('0x61')]['id'],'ContactId':_0x827cba['id'],'OpenchannelAccountId':_0x3e89c7['id'],'lastMsgDirection':_0xb7e4('0xbe'),'firstMsgDirection':_0xb7e4('0xbe'),'Messages':[_[_0xb7e4('0x54')](_0x283cd6[_0xb7e4('0x60')],{'read':![],'body':_0x283cd6[_0xb7e4('0x60')]['body'],'OpenchannelAccountId':_0x3e89c7['id'],'UserId':_0x283cd6[_0xb7e4('0x61')]['id'],'ContactId':_0x827cba['id']})]},{'include':[{'model':db[_0xb7e4('0x98')],'as':_0xb7e4('0xbf')}]})['then'](function(_0x20aa28){return[_0x20aa28,!![]];});});}})[_0xb7e4('0xb8')](function(_0x21c265,_0x5bf841){if(_0x5bf841){return _0x21c265;}return db[_0xb7e4('0x98')][_0xb7e4('0x66')](_['merge'](_0x283cd6[_0xb7e4('0x60')],{'read':![],'body':_0x283cd6[_0xb7e4('0x60')][_0xb7e4('0x60')],'OpenchannelAccountId':_0x3e89c7['id'],'OpenchannelInteractionId':_0x21c265['id'],'UserId':_0x283cd6[_0xb7e4('0x61')]['id'],'ContactId':_0x827cba['id']}))[_0xb7e4('0x24')](function(_0x5b8d8d){_0x21c265['dataValues'][_0xb7e4('0xbf')]=[];_0x21c265[_0xb7e4('0xc0')]['Messages'][_0xb7e4('0x95')](_0x5b8d8d[_0xb7e4('0xc0')]);return _0x21c265;});});}})[_0xb7e4('0x24')](respondWithResult(_0x1097e8,null))[_0xb7e4('0x2f')](handleError(_0x1097e8,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8a6c88e..e475d7f 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 _0x91a7=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x91a7,0xe7));var _0x791a=function(_0x4912f2,_0x1d2a00){_0x4912f2=_0x4912f2-0x0;var _0x2f2b52=_0x91a7[_0x4912f2];return _0x2f2b52;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){OpenchannelAccountEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);OpenchannelAccountEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x4522=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x344c09,_0x210de4){var _0x270e15=function(_0x26f910){while(--_0x26f910){_0x344c09['push'](_0x344c09['shift']());}};_0x270e15(++_0x210de4);}(_0x4522,0x1a0));var _0x2452=function(_0x168a88,_0x3cc193){_0x168a88=_0x168a88-0x0;var _0x40943b=_0x4522[_0x168a88];return _0x40943b;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x2452('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x2452('0x1')](0x0);var events={'afterCreate':_0x2452('0x2'),'afterUpdate':'update','afterDestroy':_0x2452('0x3')};function emitEvent(_0x1fdf5b){return function(_0x35e30a,_0x2f21dc,_0x34ff44){OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b+':'+_0x35e30a['id'],_0x35e30a);OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b,_0x35e30a);_0x34ff44(null);};}for(var e in events){if(events[_0x2452('0x5')](e)){var event=events[e];OpenchannelAccount[_0x2452('0x6')](e,emitEvent(event));}}module[_0x2452('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 423e263..ab521d5 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(_0x458129,_0x1a9dea){var _0x2c751d=function(_0x29b240){while(--_0x29b240){_0x458129['push'](_0x458129['shift']());}};_0x2c751d(++_0x1a9dea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x55d654,_0x56f88e){var _0x26e7d8=function(_0x1bc1d6){while(--_0x1bc1d6){_0x55d654['push'](_0x55d654['shift']());}};_0x26e7d8(++_0x56f88e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index e3f4be7..7cd43cc 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 _0xc788=['defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x21be0e,_0xc791d){var _0x4f4456=function(_0x367432){while(--_0x367432){_0x21be0e['push'](_0x21be0e['shift']());}};_0x4f4456(++_0xc791d);}(_0xc788,0xc4));var _0x8c78=function(_0x3ca29d,_0x5a8d31){_0x3ca29d=_0x3ca29d-0x0;var _0x5c5d2e=_0xc788[_0x3ca29d];return _0x5c5d2e;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});config[_0x8c78('0xb')]=_[_0x8c78('0xc')](config['redis'],{'host':_0x8c78('0xd'),'port':0x18eb});var socket=require(_0x8c78('0xe'))(new Redis(config[_0x8c78('0xb')]));require(_0x8c78('0xf'))[_0x8c78('0x10')](socket);function respondWithRpcPromise(_0x39e116,_0x4f3e43,_0x13db9c){return new BPromise(function(_0x47a54b,_0x3d55f0){return client[_0x8c78('0x11')](_0x39e116,_0x13db9c)['then'](function(_0x1a05a7){logger[_0x8c78('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x4f3e43,_0x8c78('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4f3e43,_0x8c78('0x13'),JSON[_0x8c78('0x14')](_0x1a05a7));if(_0x1a05a7[_0x8c78('0x15')]){if(_0x1a05a7[_0x8c78('0x15')][_0x8c78('0x16')]===0x1f4){logger[_0x8c78('0x15')](_0x8c78('0x17'),_0x4f3e43,_0x1a05a7[_0x8c78('0x15')][_0x8c78('0x18')]);return _0x3d55f0(_0x1a05a7[_0x8c78('0x15')]['message']);}logger[_0x8c78('0x15')](_0x8c78('0x17'),_0x4f3e43,_0x1a05a7['error'][_0x8c78('0x18')]);return _0x47a54b(_0x1a05a7[_0x8c78('0x15')][_0x8c78('0x18')]);}else{logger[_0x8c78('0x12')](_0x8c78('0x17'),_0x4f3e43,_0x8c78('0x13'));_0x47a54b(_0x1a05a7['result']['message']);}})[_0x8c78('0x19')](function(_0x4a81a4){logger['error'](_0x8c78('0x17'),_0x4f3e43,_0x4a81a4);_0x3d55f0(_0x4a81a4);});});} \ No newline at end of file +var _0x5ec6=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x5ec6,0x7f));var _0x65ec=function(_0x5ea7c6,_0xdfb668){_0x5ea7c6=_0x5ea7c6-0x0;var _0x1eac37=_0x5ec6[_0x5ea7c6];return _0x1eac37;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});config['redis']=_[_0x65ec('0x9')](config[_0x65ec('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x65ec('0xb'))(new Redis(config[_0x65ec('0xa')]));require(_0x65ec('0xc'))['register'](socket);function respondWithRpcPromise(_0x49aacd,_0x3cf126,_0x5e78f8){return new BPromise(function(_0x136928,_0x28fe68){return client['request'](_0x49aacd,_0x5e78f8)[_0x65ec('0xd')](function(_0xd7cf80){logger['info'](_0x65ec('0xe'),_0x3cf126,_0x65ec('0xf'));logger['debug'](_0x65ec('0x10'),_0x3cf126,_0x65ec('0xf'),JSON[_0x65ec('0x11')](_0xd7cf80));if(_0xd7cf80[_0x65ec('0x12')]){if(_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x13')]===0x1f4){logger[_0x65ec('0x12')](_0x65ec('0xe'),_0x3cf126,_0xd7cf80['error'][_0x65ec('0x14')]);return _0x28fe68(_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x14')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3cf126,_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x14')]);return _0x136928(_0xd7cf80[_0x65ec('0x12')]['message']);}else{logger[_0x65ec('0x15')](_0x65ec('0xe'),_0x3cf126,_0x65ec('0xf'));_0x136928(_0xd7cf80[_0x65ec('0x16')][_0x65ec('0x14')]);}})[_0x65ec('0x17')](function(_0x37c494){logger[_0x65ec('0x12')](_0x65ec('0xe'),_0x3cf126,_0x37c494);_0x28fe68(_0x37c494);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e42a8a9..ab4892a 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 _0xb2b3=['openchannelAccount:','./openchannelAccount.events','save','remove','update','removeListener','register','length'];(function(_0x4c414b,_0x17bfa2){var _0x2b0c92=function(_0x2a48d3){while(--_0x2a48d3){_0x4c414b['push'](_0x4c414b['shift']());}};_0x2b0c92(++_0x17bfa2);}(_0xb2b3,0x71));var _0x3b2b=function(_0x970aa8,_0x371931){_0x970aa8=_0x970aa8-0x0;var _0x6ea9bd=_0xb2b3[_0x970aa8];return _0x6ea9bd;};'use strict';var OpenchannelAccountEvents=require(_0x3b2b('0x0'));var events=[_0x3b2b('0x1'),_0x3b2b('0x2'),_0x3b2b('0x3')];function createListener(_0xf005ed,_0x3de73b){return function(_0x2059f0){_0x3de73b['emit'](_0xf005ed,_0x2059f0);};}function removeListener(_0x3eff63,_0x222c10){return function(){OpenchannelAccountEvents[_0x3b2b('0x4')](_0x3eff63,_0x222c10);};}exports[_0x3b2b('0x5')]=function(_0x2581eb){for(var _0xc53a84=0x0,_0x83e7ef=events[_0x3b2b('0x6')];_0xc53a84<_0x83e7ef;_0xc53a84++){var _0x1a9054=events[_0xc53a84];var _0x3ec416=createListener(_0x3b2b('0x7')+_0x1a9054,_0x2581eb);OpenchannelAccountEvents['on'](_0x1a9054,_0x3ec416);}}; \ No newline at end of file +var _0x9bde=['openchannelAccount:','save','update','emit','removeListener','register','length'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4f698e,_0x9ad3e8){_0x4f698e=_0x4f698e-0x0;var _0x57f818=_0x9bde[_0x4f698e];return _0x57f818;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelAccountEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelAccountEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 678a43c..c108707 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 _0x9267=['../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x9267,0x1dd));var _0x7926=function(_0x2cb05c,_0x2ab0d6){_0x2cb05c=_0x2cb05c-0x0;var _0x1ae777=_0x9267[_0x2cb05c];return _0x1ae777;};'use strict';var multer=require(_0x7926('0x0'));var util=require('util');var path=require(_0x7926('0x1'));var timeout=require(_0x7926('0x2'));var express=require(_0x7926('0x3'));var router=express[_0x7926('0x4')]();var fs_extra=require(_0x7926('0x5'));var auth=require(_0x7926('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7926('0x7'));var controller=require(_0x7926('0x8'));router[_0x7926('0x9')]('/',auth[_0x7926('0xa')](),controller[_0x7926('0xb')]);router[_0x7926('0x9')](_0x7926('0xc'),auth[_0x7926('0xa')](),controller[_0x7926('0xd')]);router[_0x7926('0xe')]('/',auth[_0x7926('0xa')](),controller[_0x7926('0xf')]);router[_0x7926('0x10')](_0x7926('0xc'),auth[_0x7926('0xa')](),controller[_0x7926('0x11')]);router[_0x7926('0x12')]('/:id',auth[_0x7926('0xa')](),controller[_0x7926('0x13')]);module[_0x7926('0x14')]=router; \ No newline at end of file +var _0x7e13=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7e13,0xe9));var _0x37e1=function(_0x2535f1,_0x18e168){_0x2535f1=_0x2535f1-0x0;var _0x22a776=_0x7e13[_0x2535f1];return _0x22a776;};'use strict';var multer=require('multer');var util=require(_0x37e1('0x0'));var path=require('path');var timeout=require(_0x37e1('0x1'));var express=require(_0x37e1('0x2'));var router=express['Router']();var fs_extra=require(_0x37e1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x37e1('0x4'));var config=require(_0x37e1('0x5'));var controller=require(_0x37e1('0x6'));router[_0x37e1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x37e1('0x7')](_0x37e1('0x8'),auth['isAuthenticated'](),controller[_0x37e1('0x9')]);router[_0x37e1('0xa')]('/',auth[_0x37e1('0xb')](),controller[_0x37e1('0xc')]);router[_0x37e1('0xd')](_0x37e1('0x8'),auth['isAuthenticated'](),controller[_0x37e1('0xe')]);router[_0x37e1('0xf')](_0x37e1('0x8'),auth['isAuthenticated'](),controller[_0x37e1('0x10')]);module[_0x37e1('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 463acc3..09d9a88 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 _0xd3b8=['*,*,*,*','exports','STRING','noop'];(function(_0x552a9b,_0x3f2cd9){var _0x48d23f=function(_0x50cf48){while(--_0x50cf48){_0x552a9b['push'](_0x552a9b['shift']());}};_0x48d23f(++_0x3f2cd9);}(_0xd3b8,0x19d));var _0x8d3b=function(_0x159f9b,_0x5b015c){_0x159f9b=_0x159f9b-0x0;var _0x5af408=_0xd3b8[_0x159f9b];return _0x5af408;};'use strict';var Sequelize=require('sequelize');module[_0x8d3b('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8d3b('0x1')],'allowNull':![],'defaultValue':_0x8d3b('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8d3b('0x1')],'defaultValue':_0x8d3b('0x3')}}; \ No newline at end of file +var _0x443f=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5263af,_0x26f9d5){var _0x50c6f5=function(_0x23c402){while(--_0x23c402){_0x5263af['push'](_0x5263af['shift']());}};_0x50c6f5(++_0x26f9d5);}(_0x443f,0x1f2));var _0xf443=function(_0x2c6671,_0x36b506){_0x2c6671=_0x2c6671-0x0;var _0x5ad496=_0x443f[_0x2c6671];return _0x5ad496;};'use strict';var Sequelize=require(_0xf443('0x0'));module[_0xf443('0x1')]={'priority':{'type':Sequelize[_0xf443('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf443('0x3')],'allowNull':![],'defaultValue':_0xf443('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf443('0x3')]},'interval':{'type':Sequelize[_0xf443('0x3')],'defaultValue':_0xf443('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e9726ae..07126f6 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 _0xc846=['index','map','OpenchannelApplication','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','end','stack','name','send'];(function(_0x5aa480,_0x4317b3){var _0xbde51d=function(_0x4bb9be){while(--_0x4bb9be){_0x5aa480['push'](_0x5aa480['shift']());}};_0xbde51d(++_0x4317b3);}(_0xc846,0xfa));var _0x6c84=function(_0x9290eb,_0x4209a8){_0x9290eb=_0x9290eb-0x0;var _0x41ffda=_0xc846[_0x9290eb];return _0x41ffda;};'use strict';var emlformat=require(_0x6c84('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6c84('0x1'));var rp=require(_0x6c84('0x2'));var moment=require(_0x6c84('0x3'));var BPromise=require(_0x6c84('0x4'));var Mustache=require('mustache');var util=require(_0x6c84('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6c84('0x6'));var ejs=require(_0x6c84('0x7'));var fs=require('fs');var fs_extra=require(_0x6c84('0x8'));var _=require('lodash');var squel=require(_0x6c84('0x9'));var crypto=require(_0x6c84('0xa'));var jsforce=require(_0x6c84('0xb'));var deskjs=require(_0x6c84('0xc'));var toCsv=require(_0x6c84('0x6'));var querystring=require(_0x6c84('0xd'));var Papa=require('papaparse');var Redis=require(_0x6c84('0xe'));var authService=require(_0x6c84('0xf'));var qs=require(_0x6c84('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c84('0x11'));var logger=require(_0x6c84('0x12'))(_0x6c84('0x13'));var utils=require(_0x6c84('0x14'));var config=require(_0x6c84('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d5d7f,_0x260d29){_0x260d29=_0x260d29||0xcc;return function(_0x26a9c3){if(_0x26a9c3){return _0x1d5d7f[_0x6c84('0x16')](_0x260d29);}return _0x1d5d7f[_0x6c84('0x17')](_0x260d29)['end']();};}function respondWithResult(_0x14ff0e,_0x12b4c8){_0x12b4c8=_0x12b4c8||0xc8;return function(_0x52fae5){if(_0x52fae5){return _0x14ff0e[_0x6c84('0x17')](_0x12b4c8)[_0x6c84('0x18')](_0x52fae5);}};}function respondWithFilteredResult(_0x135288,_0x3b88f5){return function(_0x2592dc){if(_0x2592dc){var _0x744778=typeof _0x3b88f5['offset']==='undefined'&&typeof _0x3b88f5[_0x6c84('0x19')]===_0x6c84('0x1a');var _0x1e0c18=_0x2592dc[_0x6c84('0x1b')];var _0x253b1a=_0x744778?0x0:_0x3b88f5['offset'];var _0x307963=_0x744778?_0x2592dc[_0x6c84('0x1b')]:_0x3b88f5[_0x6c84('0x1c')]+_0x3b88f5[_0x6c84('0x19')];var _0x4a3fa3;if(_0x307963>=_0x1e0c18){_0x307963=_0x1e0c18;_0x4a3fa3=0xc8;}else{_0x4a3fa3=0xce;}_0x135288[_0x6c84('0x17')](_0x4a3fa3);return _0x135288[_0x6c84('0x1d')](_0x6c84('0x1e'),_0x253b1a+'-'+_0x307963+'/'+_0x1e0c18)['json'](_0x2592dc);}return null;};}function patchUpdates(_0x3be86f){return function(_0x3c9442){try{jsonpatch[_0x6c84('0x1f')](_0x3c9442,_0x3be86f,!![]);}catch(_0x3d09b9){return BPromise[_0x6c84('0x20')](_0x3d09b9);}return _0x3c9442['save']();};}function saveUpdates(_0x4dfd81,_0x14c0c2){return function(_0x423b16){if(_0x423b16){return _0x423b16['update'](_0x4dfd81)['then'](function(_0x10a2f2){return _0x10a2f2;});}return null;};}function removeEntity(_0x18bdfb,_0x1aed87){return function(_0x202651){if(_0x202651){return _0x202651['destroy']()[_0x6c84('0x21')](function(){_0x18bdfb['status'](0xcc)[_0x6c84('0x22')]();});}};}function handleEntityNotFound(_0x1ae99a,_0x35d77d){return function(_0x2576a7){if(!_0x2576a7){_0x1ae99a[_0x6c84('0x16')](0x194);}return _0x2576a7;};}function handleError(_0x510c80,_0x3b0bc9){_0x3b0bc9=_0x3b0bc9||0x1f4;return function(_0x2acce9){logger['error'](_0x2acce9[_0x6c84('0x23')]);if(_0x2acce9['name']){delete _0x2acce9[_0x6c84('0x24')];}_0x510c80[_0x6c84('0x17')](_0x3b0bc9)[_0x6c84('0x25')](_0x2acce9);};}exports[_0x6c84('0x26')]=function(_0x5864c8,_0x1152d2){var _0x5b39fc={},_0x7b53b5={},_0x5b349d={'count':0x0,'rows':[]};var _0x125df5=_[_0x6c84('0x27')](db[_0x6c84('0x28')]['rawAttributes'],function(_0x4da33d){return{'name':_0x4da33d[_0x6c84('0x29')],'type':_0x4da33d[_0x6c84('0x2a')][_0x6c84('0x2b')]};});_0x7b53b5[_0x6c84('0x2c')]=_[_0x6c84('0x27')](_0x125df5,_0x6c84('0x24'));_0x7b53b5['query']=_[_0x6c84('0x2d')](_0x5864c8[_0x6c84('0x2e')]);_0x7b53b5['filters']=_['intersection'](_0x7b53b5[_0x6c84('0x2c')],_0x7b53b5[_0x6c84('0x2e')]);_0x5b39fc[_0x6c84('0x2f')]=_[_0x6c84('0x30')](_0x7b53b5[_0x6c84('0x2c')],qs[_0x6c84('0x31')](_0x5864c8['query'][_0x6c84('0x31')]));_0x5b39fc['attributes']=_0x5b39fc['attributes']['length']?_0x5b39fc[_0x6c84('0x2f')]:_0x7b53b5[_0x6c84('0x2c')];if(!_0x5864c8['query'][_0x6c84('0x32')](_0x6c84('0x33'))){_0x5b39fc['limit']=qs[_0x6c84('0x19')](_0x5864c8[_0x6c84('0x2e')][_0x6c84('0x19')]);_0x5b39fc[_0x6c84('0x1c')]=qs['offset'](_0x5864c8[_0x6c84('0x2e')][_0x6c84('0x1c')]);}_0x5b39fc['order']=qs[_0x6c84('0x34')](_0x5864c8['query'][_0x6c84('0x34')]);_0x5b39fc[_0x6c84('0x35')]=qs['filters'](_[_0x6c84('0x36')](_0x5864c8[_0x6c84('0x2e')],_0x7b53b5[_0x6c84('0x37')]),_0x125df5);if(_0x5864c8[_0x6c84('0x2e')]['filter']){_0x5b39fc['where']=_['merge'](_0x5b39fc['where'],{'$or':_[_0x6c84('0x27')](_0x125df5,function(_0x1c7ae5){if(_0x1c7ae5[_0x6c84('0x2a')]!==_0x6c84('0x38')){var _0x20fc85={};_0x20fc85[_0x1c7ae5[_0x6c84('0x24')]]={'$like':'%'+_0x5864c8[_0x6c84('0x2e')][_0x6c84('0x39')]+'%'};return _0x20fc85;}})});}_0x5b39fc=_[_0x6c84('0x3a')]({},_0x5b39fc,_0x5864c8[_0x6c84('0x3b')]);var _0x5c77c6={'where':_0x5b39fc[_0x6c84('0x35')]};return db[_0x6c84('0x28')]['count'](_0x5c77c6)[_0x6c84('0x21')](function(_0x23fa03){_0x5b349d[_0x6c84('0x1b')]=_0x23fa03;if(_0x5864c8[_0x6c84('0x2e')][_0x6c84('0x3c')]){_0x5b39fc['include']=[{'all':!![]}];}return db[_0x6c84('0x28')][_0x6c84('0x3d')](_0x5b39fc);})['then'](function(_0xb98423){_0x5b349d[_0x6c84('0x3e')]=_0xb98423;return _0x5b349d;})[_0x6c84('0x21')](respondWithFilteredResult(_0x1152d2,_0x5b39fc))[_0x6c84('0x3f')](handleError(_0x1152d2,null));};exports[_0x6c84('0x40')]=function(_0x39ebe5,_0x16e247){var _0x312720={'raw':!![],'where':{'id':_0x39ebe5[_0x6c84('0x41')]['id']}},_0x271224={};_0x271224[_0x6c84('0x2c')]=_['keys'](db[_0x6c84('0x28')][_0x6c84('0x42')]);_0x271224[_0x6c84('0x2e')]=_['keys'](_0x39ebe5[_0x6c84('0x2e')]);_0x271224['filters']=_[_0x6c84('0x30')](_0x271224[_0x6c84('0x2c')],_0x271224[_0x6c84('0x2e')]);_0x312720[_0x6c84('0x2f')]=_[_0x6c84('0x30')](_0x271224[_0x6c84('0x2c')],qs[_0x6c84('0x31')](_0x39ebe5['query']['fields']));_0x312720[_0x6c84('0x2f')]=_0x312720[_0x6c84('0x2f')][_0x6c84('0x43')]?_0x312720[_0x6c84('0x2f')]:_0x271224[_0x6c84('0x2c')];if(_0x39ebe5[_0x6c84('0x2e')][_0x6c84('0x3c')]){_0x312720[_0x6c84('0x44')]=[{'all':!![]}];}_0x312720=_['merge']({},_0x312720,_0x39ebe5[_0x6c84('0x3b')]);return db[_0x6c84('0x28')]['find'](_0x312720)[_0x6c84('0x21')](handleEntityNotFound(_0x16e247,null))[_0x6c84('0x21')](respondWithResult(_0x16e247,null))['catch'](handleError(_0x16e247,null));};exports[_0x6c84('0x45')]=function(_0x1c8755,_0x54ff7d){return db[_0x6c84('0x28')][_0x6c84('0x45')](_0x1c8755[_0x6c84('0x46')],{})[_0x6c84('0x21')](respondWithResult(_0x54ff7d,0xc9))[_0x6c84('0x3f')](handleError(_0x54ff7d,null));};exports['update']=function(_0x1cb56e,_0x22085b){if(_0x1cb56e[_0x6c84('0x46')]['id']){delete _0x1cb56e[_0x6c84('0x46')]['id'];}return db[_0x6c84('0x28')][_0x6c84('0x47')]({'where':{'id':_0x1cb56e[_0x6c84('0x41')]['id']}})[_0x6c84('0x21')](handleEntityNotFound(_0x22085b,null))[_0x6c84('0x21')](saveUpdates(_0x1cb56e[_0x6c84('0x46')],null))[_0x6c84('0x21')](respondWithResult(_0x22085b,null))[_0x6c84('0x3f')](handleError(_0x22085b,null));};exports['destroy']=function(_0x236f01,_0x4322a5){return db['OpenchannelApplication'][_0x6c84('0x47')]({'where':{'id':_0x236f01[_0x6c84('0x41')]['id']}})[_0x6c84('0x21')](handleEntityNotFound(_0x4322a5,null))[_0x6c84('0x21')](removeEntity(_0x4322a5,null))[_0x6c84('0x3f')](handleError(_0x4322a5,null));}; \ No newline at end of file +var _0xea53=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','map','OpenchannelApplication','rawAttributes','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','includeAll','include','params','options','find','catch','create','body'];(function(_0x9688a3,_0x2ff591){var _0x49de24=function(_0x1778d5){while(--_0x1778d5){_0x9688a3['push'](_0x9688a3['shift']());}};_0x49de24(++_0x2ff591);}(_0xea53,0x1f1));var _0x3ea5=function(_0x507c1d,_0x2e50cb){_0x507c1d=_0x507c1d-0x0;var _0x40a871=_0xea53[_0x507c1d];return _0x40a871;};'use strict';var emlformat=require(_0x3ea5('0x0'));var rimraf=require(_0x3ea5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ea5('0x2'));var rp=require(_0x3ea5('0x3'));var moment=require(_0x3ea5('0x4'));var BPromise=require(_0x3ea5('0x5'));var Mustache=require(_0x3ea5('0x6'));var util=require(_0x3ea5('0x7'));var path=require('path');var sox=require(_0x3ea5('0x8'));var csv=require(_0x3ea5('0x9'));var ejs=require(_0x3ea5('0xa'));var fs=require('fs');var fs_extra=require(_0x3ea5('0xb'));var _=require(_0x3ea5('0xc'));var squel=require(_0x3ea5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3ea5('0xe'));var toCsv=require(_0x3ea5('0x9'));var querystring=require(_0x3ea5('0xf'));var Papa=require(_0x3ea5('0x10'));var Redis=require('ioredis');var authService=require(_0x3ea5('0x11'));var qs=require(_0x3ea5('0x12'));var as=require(_0x3ea5('0x13'));var hardwareService=require(_0x3ea5('0x14'));var logger=require(_0x3ea5('0x15'))('api');var utils=require(_0x3ea5('0x16'));var config=require(_0x3ea5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ea5('0x18'))['db'];function respondWithStatusCode(_0xcfce88,_0x5d2232){_0x5d2232=_0x5d2232||0xcc;return function(_0x75ba0c){if(_0x75ba0c){return _0xcfce88[_0x3ea5('0x19')](_0x5d2232);}return _0xcfce88[_0x3ea5('0x1a')](_0x5d2232)['end']();};}function respondWithResult(_0x51a75a,_0x46ebce){_0x46ebce=_0x46ebce||0xc8;return function(_0x176209){if(_0x176209){return _0x51a75a['status'](_0x46ebce)[_0x3ea5('0x1b')](_0x176209);}};}function respondWithFilteredResult(_0x9cfb56,_0x96fb52){return function(_0x1b9aad){if(_0x1b9aad){var _0x348d1e=typeof _0x96fb52['offset']==='undefined'&&typeof _0x96fb52[_0x3ea5('0x1c')]==='undefined';var _0x176cb0=_0x1b9aad[_0x3ea5('0x1d')];var _0x4a9d0f=_0x348d1e?0x0:_0x96fb52['offset'];var _0x1ead27=_0x348d1e?_0x1b9aad[_0x3ea5('0x1d')]:_0x96fb52[_0x3ea5('0x1e')]+_0x96fb52[_0x3ea5('0x1c')];var _0x168df3;if(_0x1ead27>=_0x176cb0){_0x1ead27=_0x176cb0;_0x168df3=0xc8;}else{_0x168df3=0xce;}_0x9cfb56[_0x3ea5('0x1a')](_0x168df3);return _0x9cfb56[_0x3ea5('0x1f')](_0x3ea5('0x20'),_0x4a9d0f+'-'+_0x1ead27+'/'+_0x176cb0)[_0x3ea5('0x1b')](_0x1b9aad);}return null;};}function patchUpdates(_0x480845){return function(_0x13d04b){try{jsonpatch[_0x3ea5('0x21')](_0x13d04b,_0x480845,!![]);}catch(_0x24e0e3){return BPromise[_0x3ea5('0x22')](_0x24e0e3);}return _0x13d04b[_0x3ea5('0x23')]();};}function saveUpdates(_0x2085c0,_0x4718eb){return function(_0x41b506){if(_0x41b506){return _0x41b506[_0x3ea5('0x24')](_0x2085c0)[_0x3ea5('0x25')](function(_0x527806){return _0x527806;});}return null;};}function removeEntity(_0x3157f2,_0x142d28){return function(_0xb5d743){if(_0xb5d743){return _0xb5d743[_0x3ea5('0x26')]()[_0x3ea5('0x25')](function(){_0x3157f2[_0x3ea5('0x1a')](0xcc)[_0x3ea5('0x27')]();});}};}function handleEntityNotFound(_0x4511c1,_0x244e06){return function(_0x2c8ac2){if(!_0x2c8ac2){_0x4511c1[_0x3ea5('0x19')](0x194);}return _0x2c8ac2;};}function handleError(_0x212c2a,_0x64097d){_0x64097d=_0x64097d||0x1f4;return function(_0x41facf){logger[_0x3ea5('0x28')](_0x41facf['stack']);if(_0x41facf[_0x3ea5('0x29')]){delete _0x41facf[_0x3ea5('0x29')];}_0x212c2a[_0x3ea5('0x1a')](_0x64097d)['send'](_0x41facf);};}exports['index']=function(_0x1b6ff6,_0x40a98e){var _0x1d65a0={},_0x2e17ad={},_0x1615f1={'count':0x0,'rows':[]};var _0x34273b=_[_0x3ea5('0x2a')](db[_0x3ea5('0x2b')][_0x3ea5('0x2c')],function(_0x1ec11f){return{'name':_0x1ec11f['fieldName'],'type':_0x1ec11f[_0x3ea5('0x2d')][_0x3ea5('0x2e')]};});_0x2e17ad['model']=_[_0x3ea5('0x2a')](_0x34273b,'name');_0x2e17ad['query']=_[_0x3ea5('0x2f')](_0x1b6ff6['query']);_0x2e17ad['filters']=_[_0x3ea5('0x30')](_0x2e17ad[_0x3ea5('0x31')],_0x2e17ad[_0x3ea5('0x32')]);_0x1d65a0[_0x3ea5('0x33')]=_[_0x3ea5('0x30')](_0x2e17ad[_0x3ea5('0x31')],qs[_0x3ea5('0x34')](_0x1b6ff6['query'][_0x3ea5('0x34')]));_0x1d65a0['attributes']=_0x1d65a0[_0x3ea5('0x33')][_0x3ea5('0x35')]?_0x1d65a0[_0x3ea5('0x33')]:_0x2e17ad[_0x3ea5('0x31')];if(!_0x1b6ff6[_0x3ea5('0x32')][_0x3ea5('0x36')](_0x3ea5('0x37'))){_0x1d65a0[_0x3ea5('0x1c')]=qs[_0x3ea5('0x1c')](_0x1b6ff6['query'][_0x3ea5('0x1c')]);_0x1d65a0[_0x3ea5('0x1e')]=qs['offset'](_0x1b6ff6[_0x3ea5('0x32')][_0x3ea5('0x1e')]);}_0x1d65a0[_0x3ea5('0x38')]=qs[_0x3ea5('0x39')](_0x1b6ff6[_0x3ea5('0x32')][_0x3ea5('0x39')]);_0x1d65a0['where']=qs[_0x3ea5('0x3a')](_[_0x3ea5('0x3b')](_0x1b6ff6[_0x3ea5('0x32')],_0x2e17ad[_0x3ea5('0x3a')]),_0x34273b);if(_0x1b6ff6['query'][_0x3ea5('0x3c')]){_0x1d65a0['where']=_[_0x3ea5('0x3d')](_0x1d65a0['where'],{'$or':_[_0x3ea5('0x2a')](_0x34273b,function(_0x3237af){if(_0x3237af['type']!==_0x3ea5('0x3e')){var _0x10a517={};_0x10a517[_0x3237af[_0x3ea5('0x29')]]={'$like':'%'+_0x1b6ff6['query'][_0x3ea5('0x3c')]+'%'};return _0x10a517;}})});}_0x1d65a0=_[_0x3ea5('0x3d')]({},_0x1d65a0,_0x1b6ff6['options']);var _0x25ad88={'where':_0x1d65a0['where']};return db[_0x3ea5('0x2b')][_0x3ea5('0x1d')](_0x25ad88)[_0x3ea5('0x25')](function(_0x3698e2){_0x1615f1['count']=_0x3698e2;if(_0x1b6ff6['query'][_0x3ea5('0x3f')]){_0x1d65a0[_0x3ea5('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x1d65a0);})[_0x3ea5('0x25')](function(_0x1a69e0){_0x1615f1['rows']=_0x1a69e0;return _0x1615f1;})[_0x3ea5('0x25')](respondWithFilteredResult(_0x40a98e,_0x1d65a0))['catch'](handleError(_0x40a98e,null));};exports['show']=function(_0x5d74bf,_0x90d883){var _0x43b03f={'raw':!![],'where':{'id':_0x5d74bf[_0x3ea5('0x41')]['id']}},_0x85bc2a={};_0x85bc2a[_0x3ea5('0x31')]=_[_0x3ea5('0x2f')](db[_0x3ea5('0x2b')]['rawAttributes']);_0x85bc2a[_0x3ea5('0x32')]=_['keys'](_0x5d74bf[_0x3ea5('0x32')]);_0x85bc2a[_0x3ea5('0x3a')]=_[_0x3ea5('0x30')](_0x85bc2a[_0x3ea5('0x31')],_0x85bc2a[_0x3ea5('0x32')]);_0x43b03f[_0x3ea5('0x33')]=_[_0x3ea5('0x30')](_0x85bc2a[_0x3ea5('0x31')],qs[_0x3ea5('0x34')](_0x5d74bf[_0x3ea5('0x32')]['fields']));_0x43b03f[_0x3ea5('0x33')]=_0x43b03f[_0x3ea5('0x33')][_0x3ea5('0x35')]?_0x43b03f[_0x3ea5('0x33')]:_0x85bc2a[_0x3ea5('0x31')];if(_0x5d74bf[_0x3ea5('0x32')][_0x3ea5('0x3f')]){_0x43b03f['include']=[{'all':!![]}];}_0x43b03f=_[_0x3ea5('0x3d')]({},_0x43b03f,_0x5d74bf[_0x3ea5('0x42')]);return db['OpenchannelApplication'][_0x3ea5('0x43')](_0x43b03f)[_0x3ea5('0x25')](handleEntityNotFound(_0x90d883,null))[_0x3ea5('0x25')](respondWithResult(_0x90d883,null))[_0x3ea5('0x44')](handleError(_0x90d883,null));};exports[_0x3ea5('0x45')]=function(_0x25e240,_0x406068){return db[_0x3ea5('0x2b')]['create'](_0x25e240[_0x3ea5('0x46')],{})[_0x3ea5('0x25')](respondWithResult(_0x406068,0xc9))['catch'](handleError(_0x406068,null));};exports['update']=function(_0x3b8f94,_0x18d9f0){if(_0x3b8f94[_0x3ea5('0x46')]['id']){delete _0x3b8f94[_0x3ea5('0x46')]['id'];}return db[_0x3ea5('0x2b')]['find']({'where':{'id':_0x3b8f94[_0x3ea5('0x41')]['id']}})[_0x3ea5('0x25')](handleEntityNotFound(_0x18d9f0,null))[_0x3ea5('0x25')](saveUpdates(_0x3b8f94[_0x3ea5('0x46')],null))[_0x3ea5('0x25')](respondWithResult(_0x18d9f0,null))['catch'](handleError(_0x18d9f0,null));};exports['destroy']=function(_0x561448,_0x3f0ca8){return db[_0x3ea5('0x2b')]['find']({'where':{'id':_0x561448['params']['id']}})[_0x3ea5('0x25')](handleEntityNotFound(_0x3f0ca8,null))[_0x3ea5('0x25')](removeEntity(_0x3f0ca8,null))[_0x3ea5('0x44')](handleError(_0x3f0ca8,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e6d4339..37b188c 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 _0xb766=['../../config/logger','api','../../config/environment','./openchannelApplication.attributes','exports','define','utf8mb4','util'];(function(_0xb47624,_0x28a633){var _0x22c7b5=function(_0x508482){while(--_0x508482){_0xb47624['push'](_0xb47624['shift']());}};_0x22c7b5(++_0x28a633);}(_0xb766,0x107));var _0x6b76=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0xb766[_0x1ac6e5];return _0x5877dc;};'use strict';var _=require('lodash');var util=require(_0x6b76('0x0'));var logger=require(_0x6b76('0x1'))(_0x6b76('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b76('0x3'));var attributes=require(_0x6b76('0x4'));module[_0x6b76('0x5')]=function(_0x42021e,_0x150d67){return _0x42021e[_0x6b76('0x6')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b76('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbeca=['../../config/logger','api','moment','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xbeca,0xb3));var _0xabec=function(_0x5710c9,_0x44780c){_0x5710c9=_0x5710c9-0x0;var _0x5dd2d5=_0xbeca[_0x5710c9];return _0x5dd2d5;};'use strict';var _=require(_0xabec('0x0'));var util=require('util');var logger=require(_0xabec('0x1'))(_0xabec('0x2'));var moment=require(_0xabec('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xabec('0x4'));var config=require(_0xabec('0x5'));var attributes=require(_0xabec('0x6'));module[_0xabec('0x7')]=function(_0x5ecd7e,_0x207c83){return _0x5ecd7e[_0xabec('0x8')](_0xabec('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabec('0xa'),'collate':_0xabec('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index dcf85d3..00c02fe 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 _0x29a4=['info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','limit'];(function(_0x904760,_0x302820){var _0xfcd8f0=function(_0x3439b0){while(--_0x3439b0){_0x904760['push'](_0x904760['shift']());}};_0xfcd8f0(++_0x302820);}(_0x29a4,0xf1));var _0x429a=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x29a4[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x429a('0x0'));var util=require('util');var moment=require(_0x429a('0x1'));var BPromise=require(_0x429a('0x2'));var rs=require(_0x429a('0x3'));var fs=require('fs');var Redis=require(_0x429a('0x4'));var db=require(_0x429a('0x5'))['db'];var utils=require(_0x429a('0x6'));var logger=require('../../config/logger')(_0x429a('0x7'));var config=require(_0x429a('0x8'));var jayson=require(_0x429a('0x9'));var client=jayson[_0x429a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f76ee,_0x568e30,_0x4c3cc9){return new BPromise(function(_0x365bee,_0xc80f77){return client[_0x429a('0xb')](_0x3f76ee,_0x4c3cc9)[_0x429a('0xc')](function(_0x44eb55){logger['info'](_0x429a('0xd'),_0x568e30,'request\x20sent');logger[_0x429a('0xe')](_0x429a('0xf'),_0x568e30,'request\x20sent',JSON[_0x429a('0x10')](_0x44eb55));if(_0x44eb55[_0x429a('0x11')]){if(_0x44eb55[_0x429a('0x11')][_0x429a('0x12')]===0x1f4){logger['error'](_0x429a('0xd'),_0x568e30,_0x44eb55['error'][_0x429a('0x13')]);return _0xc80f77(_0x44eb55[_0x429a('0x11')]['message']);}logger['error'](_0x429a('0xd'),_0x568e30,_0x44eb55[_0x429a('0x11')]['message']);return _0x365bee(_0x44eb55['error'][_0x429a('0x13')]);}else{logger['info'](_0x429a('0xd'),_0x568e30,'request\x20sent');_0x365bee(_0x44eb55['result'][_0x429a('0x13')]);}})[_0x429a('0x14')](function(_0x245af2){logger[_0x429a('0x11')](_0x429a('0xd'),_0x568e30,_0x245af2);_0xc80f77(_0x245af2);});});}exports[_0x429a('0x15')]=function(_0x71b6f8){var _0xe2fdbc=this;return new Promise(function(_0x23f4fd,_0xeabcdc){return db[_0x429a('0x16')]['update'](_0x71b6f8[_0x429a('0x17')],{'raw':_0x71b6f8['options']?_0x71b6f8[_0x429a('0x18')][_0x429a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x71b6f8[_0x429a('0x18')]?_0x71b6f8[_0x429a('0x18')][_0x429a('0x1a')]||null:null,'attributes':_0x71b6f8['options']?_0x71b6f8[_0x429a('0x18')][_0x429a('0x1b')]||null:null,'limit':_0x71b6f8[_0x429a('0x18')]?_0x71b6f8[_0x429a('0x18')][_0x429a('0x1c')]||null:null})[_0x429a('0xc')](function(_0x54706a){logger[_0x429a('0x1d')](_0x429a('0x15'),_0x71b6f8);logger[_0x429a('0xe')]('UpdateOpenchannelApplication',_0x71b6f8,JSON[_0x429a('0x10')](_0x54706a));_0x23f4fd(_0x54706a);})[_0x429a('0x14')](function(_0x3d7f51){logger['error']('UpdateOpenchannelApplication',_0x3d7f51[_0x429a('0x13')],_0x71b6f8);_0xeabcdc(_0xe2fdbc['error'](0x1f4,_0x3d7f51[_0x429a('0x13')]));});});}; \ No newline at end of file +var _0xd452=['jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x45584b,_0x267045){var _0x4faaf1=function(_0xe5c890){while(--_0xe5c890){_0x45584b['push'](_0x45584b['shift']());}};_0x4faaf1(++_0x267045);}(_0xd452,0xe9));var _0x2d45=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0xd452[_0x1269c6];return _0x4868c7;};'use strict';var _=require(_0x2d45('0x0'));var util=require(_0x2d45('0x1'));var moment=require(_0x2d45('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d45('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d45('0x4'));var logger=require(_0x2d45('0x5'))(_0x2d45('0x6'));var config=require('../../config/environment');var jayson=require(_0x2d45('0x7'));var client=jayson[_0x2d45('0x8')][_0x2d45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x144134,_0x294bfc,_0x4285ea){return new BPromise(function(_0x4d2bbc,_0xa460a4){return client[_0x2d45('0xa')](_0x144134,_0x4285ea)[_0x2d45('0xb')](function(_0x426de9){logger[_0x2d45('0xc')](_0x2d45('0xd'),_0x294bfc,_0x2d45('0xe'));logger[_0x2d45('0xf')](_0x2d45('0x10'),_0x294bfc,'request\x20sent',JSON[_0x2d45('0x11')](_0x426de9));if(_0x426de9[_0x2d45('0x12')]){if(_0x426de9[_0x2d45('0x12')]['code']===0x1f4){logger[_0x2d45('0x12')](_0x2d45('0xd'),_0x294bfc,_0x426de9['error']['message']);return _0xa460a4(_0x426de9[_0x2d45('0x12')][_0x2d45('0x13')]);}logger[_0x2d45('0x12')](_0x2d45('0xd'),_0x294bfc,_0x426de9[_0x2d45('0x12')]['message']);return _0x4d2bbc(_0x426de9[_0x2d45('0x12')][_0x2d45('0x13')]);}else{logger['info'](_0x2d45('0xd'),_0x294bfc,_0x2d45('0xe'));_0x4d2bbc(_0x426de9[_0x2d45('0x14')][_0x2d45('0x13')]);}})[_0x2d45('0x15')](function(_0x51de8b){logger['error'](_0x2d45('0xd'),_0x294bfc,_0x51de8b);_0xa460a4(_0x51de8b);});});}exports[_0x2d45('0x16')]=function(_0x31b1f8){var _0x5426a0=this;return new Promise(function(_0x150db2,_0x59eb37){return db[_0x2d45('0x17')][_0x2d45('0x18')](_0x31b1f8[_0x2d45('0x19')],{'raw':_0x31b1f8[_0x2d45('0x1a')]?_0x31b1f8[_0x2d45('0x1a')][_0x2d45('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31b1f8[_0x2d45('0x1a')]?_0x31b1f8[_0x2d45('0x1a')][_0x2d45('0x1c')]||null:null,'attributes':_0x31b1f8[_0x2d45('0x1a')]?_0x31b1f8[_0x2d45('0x1a')]['attributes']||null:null,'limit':_0x31b1f8[_0x2d45('0x1a')]?_0x31b1f8[_0x2d45('0x1a')][_0x2d45('0x1d')]||null:null})['then'](function(_0x239b16){logger[_0x2d45('0xc')](_0x2d45('0x16'),_0x31b1f8);logger['debug'](_0x2d45('0x16'),_0x31b1f8,JSON[_0x2d45('0x11')](_0x239b16));_0x150db2(_0x239b16);})[_0x2d45('0x15')](function(_0x5d2b10){logger[_0x2d45('0x12')](_0x2d45('0x16'),_0x5d2b10[_0x2d45('0x13')],_0x31b1f8);_0x59eb37(_0x5426a0[_0x2d45('0x12')](0x1f4,_0x5d2b10['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 241218a..d8b9089 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 _0xde65=['fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x283732,_0x5f16f3){var _0x413231=function(_0x2d2855){while(--_0x2d2855){_0x283732['push'](_0x283732['shift']());}};_0x413231(++_0x5f16f3);}(_0xde65,0x156));var _0x5de6=function(_0x616e7e,_0x43fe95){_0x616e7e=_0x616e7e-0x0;var _0x4cead9=_0xde65[_0x616e7e];return _0x4cead9;};'use strict';var multer=require(_0x5de6('0x0'));var util=require(_0x5de6('0x1'));var path=require(_0x5de6('0x2'));var timeout=require(_0x5de6('0x3'));var express=require(_0x5de6('0x4'));var router=express[_0x5de6('0x5')]();var fs_extra=require(_0x5de6('0x6'));var auth=require(_0x5de6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5de6('0x8'));router[_0x5de6('0x9')]('/',auth['isAuthenticated'](),controller[_0x5de6('0xa')]);router[_0x5de6('0x9')](_0x5de6('0xb'),auth[_0x5de6('0xc')](),controller['describe']);router[_0x5de6('0x9')](_0x5de6('0xd'),auth['isAuthenticated'](),controller[_0x5de6('0xe')]);router['get'](_0x5de6('0xf'),auth['isAuthenticated'](),controller[_0x5de6('0x10')]);router[_0x5de6('0x9')]('/:id/download',auth[_0x5de6('0xc')](),controller['download']);router[_0x5de6('0x11')]('/',auth[_0x5de6('0xc')](),controller['create']);router[_0x5de6('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5de6('0x12')]);router[_0x5de6('0x11')]('/:id/tags',auth[_0x5de6('0xc')](),interaction[_0x5de6('0x13')](_0x5de6('0x14'),_0x5de6('0x15')),controller[_0x5de6('0x16')]);router['put']('/:id',auth[_0x5de6('0xc')](),interaction[_0x5de6('0x13')]('openchannel',_0x5de6('0x17')),controller[_0x5de6('0x18')]);router[_0x5de6('0x19')](_0x5de6('0xd'),auth[_0x5de6('0xc')](),interaction['tracked'](_0x5de6('0x14'),_0x5de6('0x1a')),controller['destroy']);router[_0x5de6('0x19')](_0x5de6('0x1b'),auth[_0x5de6('0xc')](),controller['removeTags']);module[_0x5de6('0x1c')]=router; \ No newline at end of file +var _0xb547=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','addTags','put','openchannel','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports'];(function(_0x128a3d,_0x2a8813){var _0x4a8ed5=function(_0x283164){while(--_0x283164){_0x128a3d['push'](_0x128a3d['shift']());}};_0x4a8ed5(++_0x2a8813);}(_0xb547,0x136));var _0x7b54=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0xb547[_0x5c7a85];return _0x35290f;};'use strict';var multer=require(_0x7b54('0x0'));var util=require(_0x7b54('0x1'));var path=require('path');var timeout=require(_0x7b54('0x2'));var express=require(_0x7b54('0x3'));var router=express[_0x7b54('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7b54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7b54('0x6'));var controller=require(_0x7b54('0x7'));router[_0x7b54('0x8')]('/',auth[_0x7b54('0x9')](),controller['index']);router[_0x7b54('0x8')](_0x7b54('0xa'),auth[_0x7b54('0x9')](),controller[_0x7b54('0xb')]);router['get'](_0x7b54('0xc'),auth[_0x7b54('0x9')](),controller[_0x7b54('0xd')]);router[_0x7b54('0x8')]('/:id/messages',auth[_0x7b54('0x9')](),controller['getMessages']);router[_0x7b54('0x8')](_0x7b54('0xe'),auth[_0x7b54('0x9')](),controller[_0x7b54('0xf')]);router['post']('/',auth[_0x7b54('0x9')](),controller[_0x7b54('0x10')]);router[_0x7b54('0x11')](_0x7b54('0x12'),auth[_0x7b54('0x9')](),controller[_0x7b54('0x13')]);router[_0x7b54('0x11')](_0x7b54('0x14'),auth[_0x7b54('0x9')](),interaction[_0x7b54('0x15')]('openchannel','openchannelinteraction:addtags'),controller[_0x7b54('0x16')]);router[_0x7b54('0x17')](_0x7b54('0xc'),auth[_0x7b54('0x9')](),interaction['tracked'](_0x7b54('0x18'),'openchannelinteraction:update'),controller[_0x7b54('0x19')]);router[_0x7b54('0x1a')](_0x7b54('0xc'),auth[_0x7b54('0x9')](),interaction[_0x7b54('0x15')](_0x7b54('0x18'),_0x7b54('0x1b')),controller[_0x7b54('0x1c')]);router[_0x7b54('0x1a')](_0x7b54('0x14'),auth['isAuthenticated'](),controller[_0x7b54('0x1d')]);module[_0x7b54('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 87077af..4f7800f 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 _0xccde=['out','sequelize','BOOLEAN','STRING','DATE','ENUM'];(function(_0x4aaff3,_0x18b012){var _0x3a20f3=function(_0x550df8){while(--_0x550df8){_0x4aaff3['push'](_0x4aaff3['shift']());}};_0x3a20f3(++_0x18b012);}(_0xccde,0x1e1));var _0xeccd=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0xccde[_0x12833b];return _0x3acad3;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'closed':{'type':Sequelize[_0xeccd('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xeccd('0x2')]},'secondDisposition':{'type':Sequelize[_0xeccd('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xeccd('0x3')]},'threadId':{'type':Sequelize[_0xeccd('0x2')]},'externalUrl':{'type':Sequelize[_0xeccd('0x2')]},'lastMsgAt':{'type':Sequelize[_0xeccd('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xeccd('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xeccd('0x4')]('in',_0xeccd('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xeccd('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xeccd('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc038=['STRING','ENUM','out','BOOLEAN','sequelize','exports','DATE'];(function(_0x98220c,_0x1c14f1){var _0x4607fc=function(_0x111bff){while(--_0x111bff){_0x98220c['push'](_0x98220c['shift']());}};_0x4607fc(++_0x1c14f1);}(_0xc038,0x17e));var _0x8c03=function(_0xc7e587,_0x5913c0){_0xc7e587=_0xc7e587-0x0;var _0x458f27=_0xc038[_0xc7e587];return _0x458f27;};'use strict';var Sequelize=require(_0x8c03('0x0'));module[_0x8c03('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8c03('0x2')]},'disposition':{'type':Sequelize[_0x8c03('0x3')]},'secondDisposition':{'type':Sequelize[_0x8c03('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8c03('0x3')]},'note':{'type':Sequelize[_0x8c03('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x8c03('0x3')]},'externalUrl':{'type':Sequelize[_0x8c03('0x3')]},'lastMsgAt':{'type':Sequelize[_0x8c03('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x8c03('0x4')]('in',_0x8c03('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8c03('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x8c03('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d6b7cbc..78aff29 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 _0xf62f=['moment','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','update','then','destroy','stack','name','send','OpenchannelInteraction','rawAttributes','fieldName','getOptions','findAll','openchannel','query','catch','show','type','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','nolimit','order','sort','where','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','root','server','files','attachments','transcript-%d-%s.zip','join','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','OpenchannelAccount','Account','get','Openchannel','Owner','N.A.','closed','disposition','threadId','Private','existsSync','createReadStream','basename','out','System','read','value','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir'];(function(_0x263fe7,_0x17d0f7){var _0x5377dd=function(_0x4f87cf){while(--_0x4f87cf){_0x263fe7['push'](_0x263fe7['shift']());}};_0x5377dd(++_0x17d0f7);}(_0xf62f,0x173));var _0xff62=function(_0x848d91,_0x1a688a){_0x848d91=_0x848d91-0x0;var _0x273685=_0xf62f[_0x848d91];return _0x273685;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xff62('0x0'));var moment=require(_0xff62('0x1'));var util=require(_0xff62('0x2'));var path=require(_0xff62('0x3'));var ejs=require(_0xff62('0x4'));var fs=require('fs');var _=require(_0xff62('0x5'));var Redis=require('ioredis');var interaction=require(_0xff62('0x6'));var qs=require(_0xff62('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xff62('0x8'))('api');var config=require(_0xff62('0x9'));var db=require(_0xff62('0xa'))['db'];config[_0xff62('0xb')]=_[_0xff62('0xc')](config['redis'],{'host':_0xff62('0xd'),'port':0x18eb});var socket=require(_0xff62('0xe'))(new Redis(config[_0xff62('0xb')]));require(_0xff62('0xf'))[_0xff62('0x10')](socket);function respondWithStatusCode(_0x5f5286,_0x38ba94){_0x38ba94=_0x38ba94||0xcc;return function(_0x1c4a52){if(_0x1c4a52){return _0x5f5286[_0xff62('0x11')](_0x38ba94);}return _0x5f5286[_0xff62('0x12')](_0x38ba94)[_0xff62('0x13')]();};}function respondWithResult(_0x285dea,_0x4436e7){_0x4436e7=_0x4436e7||0xc8;return function(_0x4bf61b){if(_0x4bf61b){return _0x285dea[_0xff62('0x12')](_0x4436e7)[_0xff62('0x14')](_0x4bf61b);}};}function respondWithFilteredResult(_0x4b4381,_0x2f2c9f){return function(_0x5977c4){if(_0x5977c4){var _0x2ed094=typeof _0x2f2c9f['offset']==='undefined'&&typeof _0x2f2c9f[_0xff62('0x15')]===_0xff62('0x16');var _0x3b0da5=_0x5977c4['count'];var _0x13f08b=_0x2ed094?0x0:_0x2f2c9f[_0xff62('0x17')];var _0xb6b876=_0x2ed094?_0x5977c4[_0xff62('0x18')]:_0x2f2c9f['offset']+_0x2f2c9f[_0xff62('0x15')];var _0x2aca13;if(_0xb6b876>=_0x3b0da5){_0xb6b876=_0x3b0da5;_0x2aca13=0xc8;}else{_0x2aca13=0xce;}_0x4b4381['status'](_0x2aca13);return _0x4b4381[_0xff62('0x19')](_0xff62('0x1a'),_0x13f08b+'-'+_0xb6b876+'/'+_0x3b0da5)[_0xff62('0x14')](_0x5977c4);}return null;};}function saveUpdates(_0x4cf074){return function(_0x5d41d5){if(_0x5d41d5){return _0x5d41d5[_0xff62('0x1b')](_0x4cf074)[_0xff62('0x1c')](function(_0x502635){return _0x502635;});}return null;};}function removeEntity(_0x2b1053){return function(_0x87ae84){if(_0x87ae84){return _0x87ae84[_0xff62('0x1d')]()[_0xff62('0x1c')](function(){_0x2b1053[_0xff62('0x12')](0xcc)[_0xff62('0x13')]();});}};}function handleEntityNotFound(_0x391dd4){return function(_0x7af8fe){if(!_0x7af8fe){_0x391dd4[_0xff62('0x11')](0x194);}return _0x7af8fe;};}function handleError(_0x7d9ec6,_0x4fd286){_0x4fd286=_0x4fd286||0x1f4;return function(_0x484a88){logger['error'](_0x484a88[_0xff62('0x1e')]);if(_0x484a88[_0xff62('0x1f')]){delete _0x484a88['name'];}_0x7d9ec6[_0xff62('0x12')](_0x4fd286)[_0xff62('0x20')](_0x484a88);};}exports['index']=function(_0x4cbdd5,_0x1c0f84){var _0xd8ad93={};var _0x528e06=_['map'](db[_0xff62('0x21')][_0xff62('0x22')],function(_0x4ceef5){return{'name':_0x4ceef5[_0xff62('0x23')],'type':_0x4ceef5['type']['key']};});_0xd8ad93=qs[_0xff62('0x24')](_0x528e06,_0x4cbdd5);return interaction[_0xff62('0x25')](_0xff62('0x26'),_0x4cbdd5[_0xff62('0x27')],_0x4cbdd5['user'],_0xd8ad93,_0x528e06)[_0xff62('0x1c')](respondWithFilteredResult(_0x1c0f84,_0xd8ad93))[_0xff62('0x28')](handleError(_0x1c0f84,null));};exports[_0xff62('0x29')]=function(_0x2b051f,_0x1eaa1a){var _0x2c1aea={};if(_0x2b051f[_0xff62('0x27')][_0xff62('0x2a')]&&_0x2b051f[_0xff62('0x27')][_0xff62('0x2a')]==='from'){_0x2c1aea['from']=_0x2b051f[_0xff62('0x2b')]['id'];}else{_0x2c1aea['id']=_0x2b051f['params']['id'];}var _0x4c636d={'raw':![],'where':_0x2c1aea},_0x343793={};_0x343793[_0xff62('0x2c')]=_['keys'](db[_0xff62('0x21')][_0xff62('0x22')]);_0x343793[_0xff62('0x27')]=_[_0xff62('0x2d')](_0x2b051f[_0xff62('0x27')]);_0x343793[_0xff62('0x2e')]=_[_0xff62('0x2f')](_0x343793[_0xff62('0x2c')],_0x343793[_0xff62('0x27')]);_0x4c636d[_0xff62('0x30')]=_[_0xff62('0x2f')](_0x343793[_0xff62('0x2c')],qs[_0xff62('0x31')](_0x2b051f['query']['fields']));_0x4c636d[_0xff62('0x30')]=_0x4c636d[_0xff62('0x30')][_0xff62('0x32')]?_0x4c636d[_0xff62('0x30')]:_0x343793[_0xff62('0x2c')];if(_0x2b051f[_0xff62('0x27')][_0xff62('0x33')]){_0x4c636d['include']=[{'all':!![]}];}_0x4c636d=_[_0xff62('0x34')]({},_0x4c636d,_0x2b051f['options']);return db[_0xff62('0x21')][_0xff62('0x35')](_0x4c636d)['then'](handleEntityNotFound(_0x1eaa1a,null))[_0xff62('0x1c')](respondWithResult(_0x1eaa1a,null))[_0xff62('0x28')](handleError(_0x1eaa1a,null));};exports[_0xff62('0x36')]=function(_0x519b79,_0x42c6a3){return db[_0xff62('0x21')][_0xff62('0x36')](_0x519b79[_0xff62('0x37')],{})[_0xff62('0x1c')](respondWithResult(_0x42c6a3,0xc9))['catch'](handleError(_0x42c6a3,null));};exports['update']=function(_0x42eed5,_0x14ccbb){if(_0x42eed5[_0xff62('0x37')]['id']){delete _0x42eed5[_0xff62('0x37')]['id'];}return db['OpenchannelInteraction'][_0xff62('0x35')]({'where':{'id':_0x42eed5[_0xff62('0x2b')]['id']}})[_0xff62('0x1c')](handleEntityNotFound(_0x14ccbb,null))['then'](saveUpdates(_0x42eed5[_0xff62('0x37')],null))[_0xff62('0x1c')](respondWithResult(_0x14ccbb,null))[_0xff62('0x28')](handleError(_0x14ccbb,null));};exports[_0xff62('0x1d')]=function(_0x1ea89c,_0x5d86a3){return db['OpenchannelInteraction'][_0xff62('0x35')]({'where':{'id':_0x1ea89c[_0xff62('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d86a3,null))[_0xff62('0x1c')](removeEntity(_0x5d86a3,null))[_0xff62('0x28')](handleError(_0x5d86a3,null));};exports[_0xff62('0x38')]=function(_0x5e2898,_0x51c43a){return db['OpenchannelInteraction'][_0xff62('0x38')]()['then'](respondWithResult(_0x51c43a,null))['catch'](handleError(_0x51c43a,null));};exports[_0xff62('0x39')]=function(_0x48e4f5,_0x445aba){return db[_0xff62('0x3a')][_0xff62('0x35')]({'where':{'id':_0x48e4f5[_0xff62('0x2b')]['id']}})[_0xff62('0x1c')](handleEntityNotFound(_0x445aba,null))[_0xff62('0x1c')](function(_0x4cca10){if(_0x4cca10){return _0x4cca10['addMessage'](_0x48e4f5['body'][_0xff62('0x3b')],_[_0xff62('0x3c')](_0x48e4f5[_0xff62('0x37')],[_0xff62('0x3b'),'id'])||{});}})[_0xff62('0x1c')](respondWithResult(_0x445aba,null))[_0xff62('0x28')](handleError(_0x445aba,null));};exports[_0xff62('0x3d')]=function(_0x3bb7e1,_0x2ea70c){var _0x56e6ae={'raw':![],'where':{}};var _0x1315dc={};var _0x31cc91={'count':0x0,'rows':[]};return db[_0xff62('0x21')]['findOne']({'where':{'id':_0x3bb7e1[_0xff62('0x2b')]['id']}})[_0xff62('0x1c')](handleEntityNotFound(_0x2ea70c,null))['then'](function(_0x2113cd){if(_0x2113cd){_0x1315dc['model']=_[_0xff62('0x2d')](db['OpenchannelMessage']['rawAttributes']);_0x1315dc[_0xff62('0x27')]=_[_0xff62('0x2d')](_0x3bb7e1[_0xff62('0x27')]);_0x1315dc[_0xff62('0x2e')]=_[_0xff62('0x2f')](_0x1315dc[_0xff62('0x2c')],_0x1315dc[_0xff62('0x27')]);_0x56e6ae[_0xff62('0x30')]=_['intersection'](_0x1315dc[_0xff62('0x2c')],qs[_0xff62('0x31')](_0x3bb7e1[_0xff62('0x27')]['fields']));_0x56e6ae[_0xff62('0x30')]=_0x56e6ae['attributes'][_0xff62('0x32')]?_0x56e6ae[_0xff62('0x30')]:_0x1315dc[_0xff62('0x2c')];if(!_0x3bb7e1[_0xff62('0x27')]['hasOwnProperty'](_0xff62('0x3e'))){_0x56e6ae[_0xff62('0x15')]=qs['limit'](_0x3bb7e1[_0xff62('0x27')][_0xff62('0x15')]);_0x56e6ae[_0xff62('0x17')]=qs[_0xff62('0x17')](_0x3bb7e1[_0xff62('0x27')]['offset']);}_0x56e6ae[_0xff62('0x3f')]=qs['sort'](_0x3bb7e1['query'][_0xff62('0x40')]);_0x56e6ae[_0xff62('0x41')]=qs[_0xff62('0x2e')](_['pick'](_0x3bb7e1[_0xff62('0x27')],_0x1315dc[_0xff62('0x2e')]));_0x56e6ae[_0xff62('0x41')]['OpenchannelInteractionId']=_0x2113cd['id'];if(_0x3bb7e1[_0xff62('0x27')]['filter']){_0x56e6ae[_0xff62('0x41')]=_[_0xff62('0x34')](_0x56e6ae[_0xff62('0x41')],{'$or':_[_0xff62('0x42')](_0x56e6ae[_0xff62('0x30')],function(_0x40df43){var _0x51cdeb={};_0x51cdeb[_0x40df43]={'$like':'%'+_0x3bb7e1['query'][_0xff62('0x43')]+'%'};return _0x51cdeb;})});}if(_0x3bb7e1[_0xff62('0x27')][_0xff62('0x44')]){var _0x5f4177=_0x3bb7e1['query']['$gte'][_0xff62('0x45')](',');var _0x3c7e12={};_0x3c7e12[_0x5f4177[0x0]]={'$gte':moment(_0x5f4177[0x1])[_0xff62('0x46')](_0xff62('0x47'))};_0x56e6ae[_0xff62('0x41')]=_[_0xff62('0x34')](_0x56e6ae[_0xff62('0x41')],_0x3c7e12);}_0x56e6ae=_[_0xff62('0x34')]({},_0x56e6ae,_0x3bb7e1[_0xff62('0x48')]);return db[_0xff62('0x3a')][_0xff62('0x18')]({'where':_0x56e6ae[_0xff62('0x41')]})[_0xff62('0x1c')](function(_0x484d6b){_0x31cc91[_0xff62('0x18')]=_0x484d6b;if(_0x3bb7e1[_0xff62('0x27')][_0xff62('0x33')]){_0x56e6ae[_0xff62('0x49')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x56e6ae);})[_0xff62('0x1c')](function(_0x12012d){_0x31cc91[_0xff62('0x4a')]=_0x12012d;return _0x31cc91;});}})[_0xff62('0x1c')](respondWithFilteredResult(_0x2ea70c,_0x56e6ae))[_0xff62('0x28')](handleError(_0x2ea70c,null));};exports['addTags']=function(_0x782cd7,_0x310758){return db['OpenchannelInteraction'][_0xff62('0x35')]({'where':{'id':_0x782cd7[_0xff62('0x2b')]['id']}})['then'](handleEntityNotFound(_0x310758,null))[_0xff62('0x1c')](function(_0x4ec961){if(_0x4ec961){return _0x4ec961[_0xff62('0x4b')](_0x782cd7[_0xff62('0x37')][_0xff62('0x3b')],_[_0xff62('0x3c')](_0x782cd7['body'],[_0xff62('0x3b'),'id'])||{})[_0xff62('0x4c')](function(){return db[_0xff62('0x4d')][_0xff62('0x25')]({'attributes':['id',_0xff62('0x1f'),_0xff62('0x4e')],'where':{'id':_0x782cd7[_0xff62('0x37')]['ids']}});})[_0xff62('0x1c')](function(_0x4364c5){socket[_0xff62('0x4f')]('openchannelInteractionTags:save',{'id':Number(_0x782cd7[_0xff62('0x2b')]['id']),'tags':_0x4364c5||[]});return{'id':Number(_0x782cd7[_0xff62('0x2b')]['id']),'tags':_0x4364c5||[]};});}})[_0xff62('0x1c')](respondWithResult(_0x310758,null))[_0xff62('0x28')](handleError(_0x310758,null));};exports['removeTags']=function(_0x28d1d2,_0x36db47){return db[_0xff62('0x21')][_0xff62('0x35')]({'where':{'id':_0x28d1d2[_0xff62('0x2b')]['id']}})[_0xff62('0x1c')](handleEntityNotFound(_0x36db47,null))['then'](function(_0x5683a6){if(_0x5683a6){return _0x5683a6[_0xff62('0x50')](_0x28d1d2[_0xff62('0x27')][_0xff62('0x3b')]);}})[_0xff62('0x1c')](respondWithStatusCode(_0x36db47,null))[_0xff62('0x28')](handleError(_0x36db47,null));};exports[_0xff62('0x51')]=function(_0x20e55d,_0x2fa53a){var _0x48b90c=moment()[_0xff62('0x52')]()[_0xff62('0x53')]();var _0x57dbb8=path['join'](config[_0xff62('0x54')],_0xff62('0x55'),_0xff62('0x56'),'tmp');var _0x34894c=path['join'](config['root'],'server',_0xff62('0x56'),_0xff62('0x57'));var _0x34c185=path['join'](_0x57dbb8,_0x48b90c);var _0x1c11cc=util[_0xff62('0x46')](_0xff62('0x58'),_0x20e55d[_0xff62('0x2b')]['id'],_0x48b90c);var _0xf81289=path[_0xff62('0x59')](_0x57dbb8,_0x1c11cc);var _0x4e6f40=[];_0x4e6f40[_0xff62('0x5a')]({'model':db[_0xff62('0x5b')],'as':_0xff62('0x5b'),'attributes':['id',_0xff62('0x5c')],'raw':!![]});_0x4e6f40[_0xff62('0x5a')]({'model':db[_0xff62('0x5d')],'as':_0xff62('0x5e'),'attributes':['id',_0xff62('0x5f'),_0xff62('0x60')],'raw':!![]});if(_0x20e55d['query'][_0xff62('0x57')]){_0x4e6f40[_0xff62('0x5a')]({'model':db[_0xff62('0x61')],'as':_0xff62('0x61'),'raw':!![]});}var _0x46d28e=[{'model':db[_0xff62('0x3a')],'as':'Messages','attributes':['id','body',_0xff62('0x62'),_0xff62('0x63'),_0xff62('0x64'),'read'],'include':_0x4e6f40}];_0x46d28e[_0xff62('0x5a')]({'model':db[_0xff62('0x65')],'as':_0xff62('0x66'),'attributes':['id',_0xff62('0x1f')]});_0x46d28e['push']({'model':db[_0xff62('0x5b')],'as':'Owner','attributes':['id',_0xff62('0x5c')]});return db[_0xff62('0x21')][_0xff62('0x35')]({'where':{'id':_0x20e55d['params']['id']},'include':_0x46d28e})[_0xff62('0x1c')](handleEntityNotFound(_0x2fa53a,null))[_0xff62('0x1c')](function(_0x3f43ed){if(_0x3f43ed){var _0x1884ba=_0x3f43ed[_0xff62('0x67')]({'plain':!![]});fs['mkdirSync'](_0x34c185);var _0x5b4b9a={'channel':_0xff62('0x68'),'account':_0x1884ba[_0xff62('0x66')][_0xff62('0x1f')],'agent':_0x1884ba['Owner']?_0x1884ba[_0xff62('0x69')][_0xff62('0x5c')]:_0xff62('0x6a'),'createdAt':moment(_0x1884ba[_0xff62('0x62')])[_0xff62('0x46')](_0xff62('0x47'))[_0xff62('0x53')](),'closedAt':_0x1884ba[_0xff62('0x6b')]?moment(_0x1884ba['closedAt'])[_0xff62('0x46')](_0xff62('0x47'))[_0xff62('0x53')]():'','disposition':_0x1884ba[_0xff62('0x6c')],'visibility':_0x1884ba[_0xff62('0x6d')]?'Public':_0xff62('0x6e'),'messages':_(_0x1884ba['Messages'])['filter']({'secret':![]})[_0xff62('0x42')](function(_0x472930){if(_0x472930['Attachment']){var _0x23ed3e=path['join'](_0x34894c,_0x472930[_0xff62('0x61')]['basename']);if(fs[_0xff62('0x6f')](_0x23ed3e)){fs[_0xff62('0x70')](_0x23ed3e)['pipe'](fs['createWriteStream'](path[_0xff62('0x59')](_0x34c185,_0x472930[_0xff62('0x61')][_0xff62('0x71')])));}}return{'date':moment(_0x472930['createdAt'])[_0xff62('0x46')](_0xff62('0x47'))[_0xff62('0x53')](),'sender':_0x472930[_0xff62('0x63')]===_0xff62('0x72')?_0x472930['User']?_0x472930[_0xff62('0x5b')][_0xff62('0x5c')]:_0xff62('0x73'):_0x472930[_0xff62('0x5e')][_0xff62('0x5f')]+(_0x472930[_0xff62('0x5e')][_0xff62('0x60')]?'\x20'+_0x472930[_0xff62('0x5e')][_0xff62('0x60')]:''),'body':_0x472930['Attachment']?_0x472930['Attachment']['basename']:_0x472930[_0xff62('0x37')],'direction':_0x472930[_0xff62('0x63')]===_0xff62('0x72')?'A':'C','secret':_0x472930[_0xff62('0x64')],'read':_0x472930[_0xff62('0x74')],'attachment':_0x472930[_0xff62('0x61')]};})[_0xff62('0x75')]()};return ejs[_0xff62('0x76')](path['join'](config['root'],_0xff62('0x55'),'views',_0xff62('0x77')),{'interaction':_0x5b4b9a})[_0xff62('0x1c')](function(_0x4ed81a){var _0x3dfec9=path[_0xff62('0x59')](_0x34c185,'transcript-'+_0x1884ba['id']+'-'+_0x48b90c+_0xff62('0x78'));var _0x3e4963={'path':_0x3dfec9,'channel':_0xff62('0x68'),'interactionId':_0x1884ba['id']};return pdf[_0xff62('0x79')](_0x4ed81a,_0x3e4963);})[_0xff62('0x1c')](function(){return new Promise(function(_0x1c5c75,_0x129e2d){zipdir(_0x34c185,{'saveTo':_0xf81289},function(_0x10e46d,_0x1560a6){if(_0x10e46d)return _0x129e2d(_0x10e46d);return _0x1c5c75(_0x1560a6);});})[_0xff62('0x1c')](function(){return new Promise(function(_0x3f4fb2,_0x115edc){rimraf(_0x34c185,function(_0x7fe249){if(_0x7fe249)_0x115edc(_0x7fe249);return _0x3f4fb2();});});})['then'](function(){return _0x2fa53a[_0xff62('0x51')](_0xf81289,_0x1c11cc,function(_0x1eb3b7){if(_0x1eb3b7){logger['error'](_0xff62('0x7a'),_0x1eb3b7);}else{fs[_0xff62('0x7b')](_0xf81289);}});});});}else{return _0x2fa53a['sendStatus'](0xc8);}})[_0xff62('0x28')](handleError(_0x2fa53a,null));}; \ No newline at end of file +var _0x25e4=['direction','secret','OpenchannelAccount','Account','Owner','get','Openchannel','closedAt','format','threadId','Public','Private','map','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','read','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','OpenchannelInteraction','rawAttributes','type','getOptions','openchannel','query','user','catch','show','from','params','model','keys','filters','attributes','intersection','includeAll','merge','options','create','body','find','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','fields','hasOwnProperty','limit','order','sort','where','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','color','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','root','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt'];(function(_0x4c9a56,_0x1f060a){var _0xfef63f=function(_0x2ef2ea){while(--_0x2ef2ea){_0x4c9a56['push'](_0x4c9a56['shift']());}};_0xfef63f(++_0x1f060a);}(_0x25e4,0x193));var _0x425e=function(_0x55c992,_0x3dcc79){_0x55c992=_0x55c992-0x0;var _0x187011=_0x25e4[_0x55c992];return _0x187011;};'use strict';var rimraf=require(_0x425e('0x0'));var zipdir=require('zip-dir');var moment=require(_0x425e('0x1'));var util=require(_0x425e('0x2'));var path=require('path');var ejs=require(_0x425e('0x3'));var fs=require('fs');var _=require(_0x425e('0x4'));var Redis=require(_0x425e('0x5'));var interaction=require(_0x425e('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x425e('0x7'));var logger=require('../../config/logger')(_0x425e('0x8'));var config=require(_0x425e('0x9'));var db=require('../../mysqldb')['db'];config[_0x425e('0xa')]=_[_0x425e('0xb')](config[_0x425e('0xa')],{'host':_0x425e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x425e('0xa')]));require(_0x425e('0xd'))[_0x425e('0xe')](socket);function respondWithStatusCode(_0x3c9977,_0x440709){_0x440709=_0x440709||0xcc;return function(_0x53f21e){if(_0x53f21e){return _0x3c9977[_0x425e('0xf')](_0x440709);}return _0x3c9977[_0x425e('0x10')](_0x440709)[_0x425e('0x11')]();};}function respondWithResult(_0x4cc0a8,_0x36ca33){_0x36ca33=_0x36ca33||0xc8;return function(_0x48fae2){if(_0x48fae2){return _0x4cc0a8[_0x425e('0x10')](_0x36ca33)[_0x425e('0x12')](_0x48fae2);}};}function respondWithFilteredResult(_0x1a928f,_0x228690){return function(_0x22b3a6){if(_0x22b3a6){var _0x44a183=typeof _0x228690[_0x425e('0x13')]==='undefined'&&typeof _0x228690['limit']==='undefined';var _0x1eebff=_0x22b3a6[_0x425e('0x14')];var _0x4ea724=_0x44a183?0x0:_0x228690[_0x425e('0x13')];var _0x2d611c=_0x44a183?_0x22b3a6[_0x425e('0x14')]:_0x228690[_0x425e('0x13')]+_0x228690['limit'];var _0x36e6aa;if(_0x2d611c>=_0x1eebff){_0x2d611c=_0x1eebff;_0x36e6aa=0xc8;}else{_0x36e6aa=0xce;}_0x1a928f[_0x425e('0x10')](_0x36e6aa);return _0x1a928f[_0x425e('0x15')](_0x425e('0x16'),_0x4ea724+'-'+_0x2d611c+'/'+_0x1eebff)['json'](_0x22b3a6);}return null;};}function saveUpdates(_0x5190b6){return function(_0x1e4a06){if(_0x1e4a06){return _0x1e4a06[_0x425e('0x17')](_0x5190b6)[_0x425e('0x18')](function(_0x5808c5){return _0x5808c5;});}return null;};}function removeEntity(_0x5710f6){return function(_0x443750){if(_0x443750){return _0x443750[_0x425e('0x19')]()[_0x425e('0x18')](function(){_0x5710f6[_0x425e('0x10')](0xcc)[_0x425e('0x11')]();});}};}function handleEntityNotFound(_0x2bba49){return function(_0x3ed1ea){if(!_0x3ed1ea){_0x2bba49['sendStatus'](0x194);}return _0x3ed1ea;};}function handleError(_0x1a3968,_0x31ed2d){_0x31ed2d=_0x31ed2d||0x1f4;return function(_0x2d6521){logger[_0x425e('0x1a')](_0x2d6521[_0x425e('0x1b')]);if(_0x2d6521[_0x425e('0x1c')]){delete _0x2d6521['name'];}_0x1a3968[_0x425e('0x10')](_0x31ed2d)[_0x425e('0x1d')](_0x2d6521);};}exports[_0x425e('0x1e')]=function(_0x26977d,_0x420966){var _0x1a6fb4={};var _0xd1d3b5=_['map'](db[_0x425e('0x1f')][_0x425e('0x20')],function(_0x15fe9a){return{'name':_0x15fe9a['fieldName'],'type':_0x15fe9a[_0x425e('0x21')]['key']};});_0x1a6fb4=qs[_0x425e('0x22')](_0xd1d3b5,_0x26977d);return interaction['findAll'](_0x425e('0x23'),_0x26977d[_0x425e('0x24')],_0x26977d[_0x425e('0x25')],_0x1a6fb4,_0xd1d3b5)[_0x425e('0x18')](respondWithFilteredResult(_0x420966,_0x1a6fb4))[_0x425e('0x26')](handleError(_0x420966,null));};exports[_0x425e('0x27')]=function(_0x10f737,_0x355da1){var _0xc100ad={};if(_0x10f737[_0x425e('0x24')][_0x425e('0x21')]&&_0x10f737[_0x425e('0x24')][_0x425e('0x21')]===_0x425e('0x28')){_0xc100ad['from']=_0x10f737[_0x425e('0x29')]['id'];}else{_0xc100ad['id']=_0x10f737[_0x425e('0x29')]['id'];}var _0x418b25={'raw':![],'where':_0xc100ad},_0x40b351={};_0x40b351[_0x425e('0x2a')]=_['keys'](db['OpenchannelInteraction'][_0x425e('0x20')]);_0x40b351[_0x425e('0x24')]=_[_0x425e('0x2b')](_0x10f737['query']);_0x40b351[_0x425e('0x2c')]=_['intersection'](_0x40b351['model'],_0x40b351['query']);_0x418b25[_0x425e('0x2d')]=_[_0x425e('0x2e')](_0x40b351[_0x425e('0x2a')],qs['fields'](_0x10f737[_0x425e('0x24')]['fields']));_0x418b25[_0x425e('0x2d')]=_0x418b25[_0x425e('0x2d')]['length']?_0x418b25[_0x425e('0x2d')]:_0x40b351['model'];if(_0x10f737[_0x425e('0x24')][_0x425e('0x2f')]){_0x418b25['include']=[{'all':!![]}];}_0x418b25=_[_0x425e('0x30')]({},_0x418b25,_0x10f737[_0x425e('0x31')]);return db[_0x425e('0x1f')]['find'](_0x418b25)[_0x425e('0x18')](handleEntityNotFound(_0x355da1,null))[_0x425e('0x18')](respondWithResult(_0x355da1,null))[_0x425e('0x26')](handleError(_0x355da1,null));};exports[_0x425e('0x32')]=function(_0x521e7d,_0x13cf4c){return db[_0x425e('0x1f')]['create'](_0x521e7d[_0x425e('0x33')],{})[_0x425e('0x18')](respondWithResult(_0x13cf4c,0xc9))[_0x425e('0x26')](handleError(_0x13cf4c,null));};exports['update']=function(_0x53d285,_0x3cd2de){if(_0x53d285['body']['id']){delete _0x53d285[_0x425e('0x33')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x53d285['params']['id']}})['then'](handleEntityNotFound(_0x3cd2de,null))[_0x425e('0x18')](saveUpdates(_0x53d285['body'],null))[_0x425e('0x18')](respondWithResult(_0x3cd2de,null))['catch'](handleError(_0x3cd2de,null));};exports[_0x425e('0x19')]=function(_0x407be3,_0x2b46ab){return db[_0x425e('0x1f')][_0x425e('0x34')]({'where':{'id':_0x407be3['params']['id']}})[_0x425e('0x18')](handleEntityNotFound(_0x2b46ab,null))[_0x425e('0x18')](removeEntity(_0x2b46ab,null))[_0x425e('0x26')](handleError(_0x2b46ab,null));};exports[_0x425e('0x35')]=function(_0x238fcc,_0x422471){return db[_0x425e('0x1f')][_0x425e('0x35')]()[_0x425e('0x18')](respondWithResult(_0x422471,null))['catch'](handleError(_0x422471,null));};exports[_0x425e('0x36')]=function(_0x1531b7,_0x2af58c){return db[_0x425e('0x37')][_0x425e('0x34')]({'where':{'id':_0x1531b7['params']['id']}})['then'](handleEntityNotFound(_0x2af58c,null))['then'](function(_0x4960ac){if(_0x4960ac){return _0x4960ac[_0x425e('0x36')](_0x1531b7[_0x425e('0x33')][_0x425e('0x38')],_[_0x425e('0x39')](_0x1531b7[_0x425e('0x33')],['ids','id'])||{});}})[_0x425e('0x18')](respondWithResult(_0x2af58c,null))[_0x425e('0x26')](handleError(_0x2af58c,null));};exports[_0x425e('0x3a')]=function(_0x3d225a,_0x3f46e9){var _0x54977b={'raw':![],'where':{}};var _0x2a50ba={};var _0x3e4136={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x425e('0x3b')]({'where':{'id':_0x3d225a[_0x425e('0x29')]['id']}})[_0x425e('0x18')](handleEntityNotFound(_0x3f46e9,null))[_0x425e('0x18')](function(_0x426e68){if(_0x426e68){_0x2a50ba['model']=_[_0x425e('0x2b')](db[_0x425e('0x37')][_0x425e('0x20')]);_0x2a50ba[_0x425e('0x24')]=_[_0x425e('0x2b')](_0x3d225a[_0x425e('0x24')]);_0x2a50ba['filters']=_[_0x425e('0x2e')](_0x2a50ba[_0x425e('0x2a')],_0x2a50ba['query']);_0x54977b[_0x425e('0x2d')]=_[_0x425e('0x2e')](_0x2a50ba[_0x425e('0x2a')],qs[_0x425e('0x3c')](_0x3d225a[_0x425e('0x24')][_0x425e('0x3c')]));_0x54977b[_0x425e('0x2d')]=_0x54977b[_0x425e('0x2d')]['length']?_0x54977b[_0x425e('0x2d')]:_0x2a50ba[_0x425e('0x2a')];if(!_0x3d225a[_0x425e('0x24')][_0x425e('0x3d')]('nolimit')){_0x54977b[_0x425e('0x3e')]=qs[_0x425e('0x3e')](_0x3d225a[_0x425e('0x24')][_0x425e('0x3e')]);_0x54977b[_0x425e('0x13')]=qs[_0x425e('0x13')](_0x3d225a[_0x425e('0x24')][_0x425e('0x13')]);}_0x54977b[_0x425e('0x3f')]=qs[_0x425e('0x40')](_0x3d225a['query'][_0x425e('0x40')]);_0x54977b[_0x425e('0x41')]=qs[_0x425e('0x2c')](_['pick'](_0x3d225a['query'],_0x2a50ba[_0x425e('0x2c')]));_0x54977b[_0x425e('0x41')][_0x425e('0x42')]=_0x426e68['id'];if(_0x3d225a[_0x425e('0x24')][_0x425e('0x43')]){_0x54977b[_0x425e('0x41')]=_[_0x425e('0x30')](_0x54977b['where'],{'$or':_['map'](_0x54977b[_0x425e('0x2d')],function(_0x857bd5){var _0x3221fb={};_0x3221fb[_0x857bd5]={'$like':'%'+_0x3d225a[_0x425e('0x24')][_0x425e('0x43')]+'%'};return _0x3221fb;})});}if(_0x3d225a[_0x425e('0x24')][_0x425e('0x44')]){var _0x2b29d2=_0x3d225a[_0x425e('0x24')]['$gte']['split'](',');var _0x435b88={};_0x435b88[_0x2b29d2[0x0]]={'$gte':moment(_0x2b29d2[0x1])['format'](_0x425e('0x45'))};_0x54977b['where']=_['merge'](_0x54977b[_0x425e('0x41')],_0x435b88);}_0x54977b=_[_0x425e('0x30')]({},_0x54977b,_0x3d225a[_0x425e('0x31')]);return db[_0x425e('0x37')][_0x425e('0x14')]({'where':_0x54977b[_0x425e('0x41')]})['then'](function(_0x1de044){_0x3e4136[_0x425e('0x14')]=_0x1de044;if(_0x3d225a['query'][_0x425e('0x2f')]){_0x54977b[_0x425e('0x46')]=[{'all':!![]}];}return db[_0x425e('0x37')][_0x425e('0x47')](_0x54977b);})[_0x425e('0x18')](function(_0x90a80c){_0x3e4136[_0x425e('0x48')]=_0x90a80c;return _0x3e4136;});}})[_0x425e('0x18')](respondWithFilteredResult(_0x3f46e9,_0x54977b))[_0x425e('0x26')](handleError(_0x3f46e9,null));};exports[_0x425e('0x49')]=function(_0x14f697,_0x47749e){return db['OpenchannelInteraction'][_0x425e('0x34')]({'where':{'id':_0x14f697[_0x425e('0x29')]['id']}})[_0x425e('0x18')](handleEntityNotFound(_0x47749e,null))['then'](function(_0x43a874){if(_0x43a874){return _0x43a874[_0x425e('0x4a')](_0x14f697[_0x425e('0x33')][_0x425e('0x38')],_[_0x425e('0x39')](_0x14f697[_0x425e('0x33')],[_0x425e('0x38'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x425e('0x1c'),_0x425e('0x4b')],'where':{'id':_0x14f697[_0x425e('0x33')][_0x425e('0x38')]}});})[_0x425e('0x18')](function(_0x516323){socket['emit'](_0x425e('0x4c'),{'id':Number(_0x14f697[_0x425e('0x29')]['id']),'tags':_0x516323||[]});return{'id':Number(_0x14f697[_0x425e('0x29')]['id']),'tags':_0x516323||[]};});}})[_0x425e('0x18')](respondWithResult(_0x47749e,null))[_0x425e('0x26')](handleError(_0x47749e,null));};exports[_0x425e('0x4d')]=function(_0x50848d,_0x2abacd){return db[_0x425e('0x1f')][_0x425e('0x34')]({'where':{'id':_0x50848d[_0x425e('0x29')]['id']}})[_0x425e('0x18')](handleEntityNotFound(_0x2abacd,null))['then'](function(_0xbaa449){if(_0xbaa449){return _0xbaa449['removeTags'](_0x50848d[_0x425e('0x24')][_0x425e('0x38')]);}})[_0x425e('0x18')](respondWithStatusCode(_0x2abacd,null))['catch'](handleError(_0x2abacd,null));};exports[_0x425e('0x4e')]=function(_0x2d49cc,_0x24abb5){var _0x11dc09=moment()[_0x425e('0x4f')]()[_0x425e('0x50')]();var _0x30d9c3=path[_0x425e('0x51')](config['root'],_0x425e('0x52'),'files','tmp');var _0x25065a=path[_0x425e('0x51')](config[_0x425e('0x53')],_0x425e('0x52'),_0x425e('0x54'),'attachments');var _0x4d8f6f=path[_0x425e('0x51')](_0x30d9c3,_0x11dc09);var _0x24cef5=util['format'](_0x425e('0x55'),_0x2d49cc['params']['id'],_0x11dc09);var _0x4765db=path[_0x425e('0x51')](_0x30d9c3,_0x24cef5);var _0x53d918=[];_0x53d918[_0x425e('0x56')]({'model':db[_0x425e('0x57')],'as':_0x425e('0x57'),'attributes':['id',_0x425e('0x58')],'raw':!![]});_0x53d918['push']({'model':db[_0x425e('0x59')],'as':_0x425e('0x5a'),'attributes':['id',_0x425e('0x5b'),_0x425e('0x5c')],'raw':!![]});if(_0x2d49cc[_0x425e('0x24')][_0x425e('0x5d')]){_0x53d918[_0x425e('0x56')]({'model':db['Attachment'],'as':_0x425e('0x5e'),'raw':!![]});}var _0x3b83a8=[{'model':db[_0x425e('0x37')],'as':_0x425e('0x5f'),'attributes':['id','body',_0x425e('0x60'),_0x425e('0x61'),_0x425e('0x62'),'read'],'include':_0x53d918}];_0x3b83a8[_0x425e('0x56')]({'model':db[_0x425e('0x63')],'as':_0x425e('0x64'),'attributes':['id','name']});_0x3b83a8[_0x425e('0x56')]({'model':db[_0x425e('0x57')],'as':_0x425e('0x65'),'attributes':['id',_0x425e('0x58')]});return db[_0x425e('0x1f')][_0x425e('0x34')]({'where':{'id':_0x2d49cc['params']['id']},'include':_0x3b83a8})['then'](handleEntityNotFound(_0x24abb5,null))['then'](function(_0x3c4bd2){if(_0x3c4bd2){var _0x3a172f=_0x3c4bd2[_0x425e('0x66')]({'plain':!![]});fs['mkdirSync'](_0x4d8f6f);var _0x4ee437={'channel':_0x425e('0x67'),'account':_0x3a172f[_0x425e('0x64')][_0x425e('0x1c')],'agent':_0x3a172f[_0x425e('0x65')]?_0x3a172f['Owner'][_0x425e('0x58')]:'N.A.','createdAt':moment(_0x3a172f[_0x425e('0x60')])['format'](_0x425e('0x45'))[_0x425e('0x50')](),'closedAt':_0x3a172f['closed']?moment(_0x3a172f[_0x425e('0x68')])[_0x425e('0x69')](_0x425e('0x45'))[_0x425e('0x50')]():'','disposition':_0x3a172f['disposition'],'visibility':_0x3a172f[_0x425e('0x6a')]?_0x425e('0x6b'):_0x425e('0x6c'),'messages':_(_0x3a172f['Messages'])[_0x425e('0x43')]({'secret':![]})[_0x425e('0x6d')](function(_0x4f8063){if(_0x4f8063[_0x425e('0x5e')]){var _0x513b01=path[_0x425e('0x51')](_0x25065a,_0x4f8063[_0x425e('0x5e')]['basename']);if(fs[_0x425e('0x6e')](_0x513b01)){fs[_0x425e('0x6f')](_0x513b01)[_0x425e('0x70')](fs[_0x425e('0x71')](path[_0x425e('0x51')](_0x4d8f6f,_0x4f8063[_0x425e('0x5e')][_0x425e('0x72')])));}}return{'date':moment(_0x4f8063[_0x425e('0x60')])['format'](_0x425e('0x45'))[_0x425e('0x50')](),'sender':_0x4f8063['direction']===_0x425e('0x73')?_0x4f8063['User']?_0x4f8063[_0x425e('0x57')]['fullname']:_0x425e('0x74'):_0x4f8063['Contact'][_0x425e('0x5b')]+(_0x4f8063[_0x425e('0x5a')]['lastName']?'\x20'+_0x4f8063[_0x425e('0x5a')]['lastName']:''),'body':_0x4f8063[_0x425e('0x5e')]?_0x4f8063['Attachment'][_0x425e('0x72')]:_0x4f8063[_0x425e('0x33')],'direction':_0x4f8063[_0x425e('0x61')]===_0x425e('0x73')?'A':'C','secret':_0x4f8063['secret'],'read':_0x4f8063[_0x425e('0x75')],'attachment':_0x4f8063[_0x425e('0x5e')]};})['value']()};return ejs[_0x425e('0x76')](path[_0x425e('0x51')](config[_0x425e('0x53')],'server',_0x425e('0x77'),_0x425e('0x78')),{'interaction':_0x4ee437})['then'](function(_0x30dd61){var _0x23cda5=path[_0x425e('0x51')](_0x4d8f6f,_0x425e('0x79')+_0x3a172f['id']+'-'+_0x11dc09+_0x425e('0x7a'));var _0x18b52d={'path':_0x23cda5,'channel':_0x425e('0x67'),'interactionId':_0x3a172f['id']};return pdf[_0x425e('0x7b')](_0x30dd61,_0x18b52d);})['then'](function(){return new Promise(function(_0x561849,_0x2615a9){zipdir(_0x4d8f6f,{'saveTo':_0x4765db},function(_0x283f11,_0x4e7e3c){if(_0x283f11)return _0x2615a9(_0x283f11);return _0x561849(_0x4e7e3c);});})['then'](function(){return new Promise(function(_0x3a9858,_0x1069d6){rimraf(_0x4d8f6f,function(_0x821a60){if(_0x821a60)_0x1069d6(_0x821a60);return _0x3a9858();});});})[_0x425e('0x18')](function(){return _0x24abb5[_0x425e('0x4e')](_0x4765db,_0x24cef5,function(_0x50c7e3){if(_0x50c7e3){logger[_0x425e('0x1a')]('Unable\x20to\x20delete\x20zip\x20file',_0x50c7e3);}else{fs[_0x425e('0x7c')](_0x4765db);}});});});}else{return _0x24abb5[_0x425e('0xf')](0xc8);}})['catch'](handleError(_0x24abb5,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index d0d9568..61d5975 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 _0x96be=['OpenchannelInteraction','OpenchannelMessage','save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0x96be,0xa1));var _0xe96b=function(_0x5d661a,_0x300155){_0x5d661a=_0x5d661a-0x0;var _0x20b789=_0x96be[_0x5d661a];return _0x20b789;};'use strict';var EventEmitter=require(_0xe96b('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xe96b('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xe96b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe96b('0x3'),'afterUpdate':_0xe96b('0x4'),'afterDestroy':_0xe96b('0x5')};function emitEvent(_0x3749b7){return function(_0x142dcf,_0x2027a8,_0x325ab1){_0x142dcf['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3d2f2b){_0x142dcf[_0xe96b('0x6')](_0xe96b('0x7'),_0x3d2f2b[_0xe96b('0x8')](function(_0x22ed5a){return{'id':_0x22ed5a['id']};}));return OpenchannelMessage[_0xe96b('0x9')]({'where':{'OpenchannelInteractionId':_0x142dcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe96b('0xa')](function(_0x28ca2d){_0x142dcf[_0xe96b('0x6')](_0xe96b('0xb'),_0x28ca2d[_0xe96b('0xc')]);OpenchannelInteractionEvents[_0xe96b('0xd')](_0x3749b7+':'+_0x142dcf['id'],_0x142dcf);OpenchannelInteractionEvents[_0xe96b('0xd')](_0x3749b7,_0x142dcf);_0x325ab1(null);})[_0xe96b('0xe')](_0x325ab1(null));};}for(var e in events){if(events[_0xe96b('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xe96b('0x10')](e,emitEvent(event));}}module[_0xe96b('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2664=['length','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map'];(function(_0x28e692,_0x248ddb){var _0x485625=function(_0x3cdf6e){while(--_0x3cdf6e){_0x28e692['push'](_0x28e692['shift']());}};_0x485625(++_0x248ddb);}(_0x2664,0x121));var _0x4266=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2664[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x4266('0x0'));var OpenchannelInteraction=require(_0x4266('0x1'))['db'][_0x4266('0x2')];var OpenchannelMessage=require(_0x4266('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4266('0x3')](0x0);var events={'afterCreate':_0x4266('0x4'),'afterUpdate':_0x4266('0x5'),'afterDestroy':_0x4266('0x6')};function emitEvent(_0x48ecd5){return function(_0x115997,_0x4bb15f,_0x46e11f){_0x115997[_0x4266('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x50ea25){_0x115997[_0x4266('0x8')](_0x4266('0x9'),_0x50ea25[_0x4266('0xa')](function(_0x1d958a){return{'id':_0x1d958a['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x115997['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x46b572){_0x115997[_0x4266('0x8')]('unreadMessages',_0x46b572[_0x4266('0xb')]);OpenchannelInteractionEvents['emit'](_0x48ecd5+':'+_0x115997['id'],_0x115997);OpenchannelInteractionEvents['emit'](_0x48ecd5,_0x115997);_0x46e11f(null);})['catch'](_0x46e11f(null));};}for(var e in events){if(events[_0x4266('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x4266('0xd')](e,emitEvent(event));}}module[_0x4266('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index e2d0b1a..25811e3 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 _0xac9c=['openchannel_interactions','utf8mb4','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction'];(function(_0x4f81d2,_0x3f5e10){var _0x161dff=function(_0x4fce38){while(--_0x4fce38){_0x4f81d2['push'](_0x4f81d2['shift']());}};_0x161dff(++_0x3f5e10);}(_0xac9c,0x146));var _0xcac9=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xac9c[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0xcac9('0x0'));var util=require(_0xcac9('0x1'));var logger=require(_0xcac9('0x2'))(_0xcac9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcac9('0x4'));var fs=require('fs');var path=require(_0xcac9('0x5'));var rimraf=require('rimraf');var config=require(_0xcac9('0x6'));var attributes=require(_0xcac9('0x7'));module['exports']=function(_0x3b943b,_0xd2df29){return _0x3b943b[_0xcac9('0x8')](_0xcac9('0x9'),attributes,{'tableName':_0xcac9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcac9('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x2ad67f,_0xe2cee0,_0xc0e79b){if(_0x2ad67f[_0xcac9('0xc')](_0xcac9('0xd'))){_0x2ad67f['closedAt']=moment()[_0xcac9('0xe')](_0xcac9('0xf'));}_0xc0e79b(null,_0x2ad67f);}}});}; \ No newline at end of file +var _0x3441=['path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','utf8mb4_unicode_ci','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3441,0xf9));var _0x1344=function(_0x17325e,_0x5863f2){_0x17325e=_0x17325e-0x0;var _0x51062a=_0x3441[_0x17325e];return _0x51062a;};'use strict';var _=require(_0x1344('0x0'));var util=require('util');var logger=require(_0x1344('0x1'))(_0x1344('0x2'));var moment=require(_0x1344('0x3'));var BPromise=require(_0x1344('0x4'));var rp=require(_0x1344('0x5'));var fs=require('fs');var path=require(_0x1344('0x6'));var rimraf=require(_0x1344('0x7'));var config=require(_0x1344('0x8'));var attributes=require(_0x1344('0x9'));module[_0x1344('0xa')]=function(_0x29a2af,_0x3292aa){return _0x29a2af['define'](_0x1344('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1344('0xc'),'hooks':{'beforeUpdate':function(_0x2cd767,_0x1dd2cc,_0x5d3e51){if(_0x2cd767[_0x1344('0xd')]('closed')){_0x2cd767['closedAt']=moment()['format'](_0x1344('0xe'));}_0x5d3e51(null,_0x2cd767);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 68b77af..16cfa0d 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 _0x4910=['request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','attributes','limit','find','addTags','body','ids','omit','spread','AddTags','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4910,0x70));var _0x0491=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4910[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0491('0x0'));var util=require(_0x0491('0x1'));var moment=require(_0x0491('0x2'));var BPromise=require(_0x0491('0x3'));var rs=require(_0x0491('0x4'));var fs=require('fs');var Redis=require(_0x0491('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0491('0x6'));var logger=require(_0x0491('0x7'))(_0x0491('0x8'));var config=require(_0x0491('0x9'));var jayson=require(_0x0491('0xa'));var client=jayson[_0x0491('0xb')][_0x0491('0xc')]({'port':0x232a});config[_0x0491('0xd')]=_[_0x0491('0xe')](config[_0x0491('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0491('0xd')]));require(_0x0491('0xf'))[_0x0491('0x10')](socket);function respondWithRpcPromise(_0x5d5923,_0x5bb6cc,_0x4048b3){return new BPromise(function(_0x109b49,_0x3651e3){return client[_0x0491('0x11')](_0x5d5923,_0x4048b3)[_0x0491('0x12')](function(_0x1f4139){logger['info'](_0x0491('0x13'),_0x5bb6cc,_0x0491('0x14'));logger[_0x0491('0x15')](_0x0491('0x16'),_0x5bb6cc,'request\x20sent',JSON['stringify'](_0x1f4139));if(_0x1f4139[_0x0491('0x17')]){if(_0x1f4139['error'][_0x0491('0x18')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x5bb6cc,_0x1f4139['error'][_0x0491('0x19')]);return _0x3651e3(_0x1f4139[_0x0491('0x17')][_0x0491('0x19')]);}logger['error'](_0x0491('0x13'),_0x5bb6cc,_0x1f4139[_0x0491('0x17')]['message']);return _0x109b49(_0x1f4139['error'][_0x0491('0x19')]);}else{logger[_0x0491('0x1a')](_0x0491('0x13'),_0x5bb6cc,_0x0491('0x14'));_0x109b49(_0x1f4139[_0x0491('0x1b')]['message']);}})['catch'](function(_0xbc3f89){logger['error'](_0x0491('0x13'),_0x5bb6cc,_0xbc3f89);_0x3651e3(_0xbc3f89);});});}exports[_0x0491('0x1c')]=function(_0x4cc0a6){var _0x1c07cb=this;return new Promise(function(_0x2cb777,_0x545f60){return db[_0x0491('0x1d')][_0x0491('0x1e')](_0x4cc0a6['body'],{'raw':_0x4cc0a6[_0x0491('0x1f')]?_0x4cc0a6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cc0a6[_0x0491('0x1f')]?_0x4cc0a6[_0x0491('0x1f')]['where']||null:null,'attributes':_0x4cc0a6[_0x0491('0x1f')]?_0x4cc0a6['options'][_0x0491('0x20')]||null:null,'limit':_0x4cc0a6['options']?_0x4cc0a6[_0x0491('0x1f')][_0x0491('0x21')]||null:null})[_0x0491('0x12')](function(_0x30dffc){logger[_0x0491('0x1a')](_0x0491('0x1c'),_0x4cc0a6);logger[_0x0491('0x15')](_0x0491('0x1c'),_0x4cc0a6,JSON['stringify'](_0x30dffc));_0x2cb777(_0x30dffc);})['catch'](function(_0x3dcce7){logger['error']('UpdateOpenchannelInteraction',_0x3dcce7[_0x0491('0x19')],_0x4cc0a6);_0x545f60(_0x1c07cb[_0x0491('0x17')](0x1f4,_0x3dcce7[_0x0491('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4fbe79){return new Promise(function(_0x4b75a3,_0xa1bbc7){return db[_0x0491('0x1d')][_0x0491('0x22')]({'where':_0x4fbe79[_0x0491('0x1f')]?_0x4fbe79[_0x0491('0x1f')]['where']||null:null})[_0x0491('0x12')](function(_0xc0fdd){if(_0xc0fdd){return _0xc0fdd[_0x0491('0x23')](_0x4fbe79[_0x0491('0x24')][_0x0491('0x25')],_[_0x0491('0x26')](_0x4fbe79[_0x0491('0x24')],[_0x0491('0x25'),'id'])||{});}})[_0x0491('0x27')](function(_0x19cf96){logger[_0x0491('0x1a')](_0x0491('0x28'),_0x4fbe79);logger['debug'](_0x0491('0x28'),_0x4fbe79,JSON[_0x0491('0x29')](_0x19cf96));_0x4b75a3(_0x19cf96);})[_0x0491('0x2a')](function(_0x55a77d){logger['error'](_0x0491('0x28'),_0x55a77d[_0x0491('0x19')],_0x4fbe79);_0xa1bbc7(_this['error'](0x1f4,_0x55a77d[_0x0491('0x19')]));});});}; \ No newline at end of file +var _0x8d3f=['redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelInteraction','update','body','options','where','attributes','UpdateOpenchannelInteraction','debug','stringify','find','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d3f,0x120));var _0xf8d3=function(_0x58722d,_0x139d86){_0x58722d=_0x58722d-0x0;var _0x1f8a71=_0x8d3f[_0x58722d];return _0x1f8a71;};'use strict';var _=require(_0xf8d3('0x0'));var util=require(_0xf8d3('0x1'));var moment=require(_0xf8d3('0x2'));var BPromise=require(_0xf8d3('0x3'));var rs=require(_0xf8d3('0x4'));var fs=require('fs');var Redis=require(_0xf8d3('0x5'));var db=require(_0xf8d3('0x6'))['db'];var utils=require(_0xf8d3('0x7'));var logger=require(_0xf8d3('0x8'))(_0xf8d3('0x9'));var config=require('../../config/environment');var jayson=require(_0xf8d3('0xa'));var client=jayson[_0xf8d3('0xb')][_0xf8d3('0xc')]({'port':0x232a});config[_0xf8d3('0xd')]=_[_0xf8d3('0xe')](config[_0xf8d3('0xd')],{'host':_0xf8d3('0xf'),'port':0x18eb});var socket=require(_0xf8d3('0x10'))(new Redis(config[_0xf8d3('0xd')]));require(_0xf8d3('0x11'))[_0xf8d3('0x12')](socket);function respondWithRpcPromise(_0x4ea5f2,_0x2619b4,_0x181205){return new BPromise(function(_0x52d7c2,_0x3d6a44){return client[_0xf8d3('0x13')](_0x4ea5f2,_0x181205)[_0xf8d3('0x14')](function(_0x493ebc){logger[_0xf8d3('0x15')](_0xf8d3('0x16'),_0x2619b4,_0xf8d3('0x17'));logger['debug'](_0xf8d3('0x18'),_0x2619b4,_0xf8d3('0x17'),JSON['stringify'](_0x493ebc));if(_0x493ebc['error']){if(_0x493ebc[_0xf8d3('0x19')][_0xf8d3('0x1a')]===0x1f4){logger[_0xf8d3('0x19')](_0xf8d3('0x16'),_0x2619b4,_0x493ebc[_0xf8d3('0x19')][_0xf8d3('0x1b')]);return _0x3d6a44(_0x493ebc[_0xf8d3('0x19')][_0xf8d3('0x1b')]);}logger['error'](_0xf8d3('0x16'),_0x2619b4,_0x493ebc['error'][_0xf8d3('0x1b')]);return _0x52d7c2(_0x493ebc['error']['message']);}else{logger[_0xf8d3('0x15')](_0xf8d3('0x16'),_0x2619b4,_0xf8d3('0x17'));_0x52d7c2(_0x493ebc[_0xf8d3('0x1c')][_0xf8d3('0x1b')]);}})[_0xf8d3('0x1d')](function(_0x4b22ac){logger[_0xf8d3('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2619b4,_0x4b22ac);_0x3d6a44(_0x4b22ac);});});}exports['UpdateOpenchannelInteraction']=function(_0xabaada){var _0x4bb875=this;return new Promise(function(_0x44b47a,_0x179253){return db[_0xf8d3('0x1e')][_0xf8d3('0x1f')](_0xabaada[_0xf8d3('0x20')],{'raw':_0xabaada['options']?_0xabaada[_0xf8d3('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xabaada[_0xf8d3('0x21')]?_0xabaada[_0xf8d3('0x21')][_0xf8d3('0x22')]||null:null,'attributes':_0xabaada[_0xf8d3('0x21')]?_0xabaada[_0xf8d3('0x21')][_0xf8d3('0x23')]||null:null,'limit':_0xabaada[_0xf8d3('0x21')]?_0xabaada[_0xf8d3('0x21')]['limit']||null:null})['then'](function(_0x57c6de){logger[_0xf8d3('0x15')](_0xf8d3('0x24'),_0xabaada);logger[_0xf8d3('0x25')](_0xf8d3('0x24'),_0xabaada,JSON[_0xf8d3('0x26')](_0x57c6de));_0x44b47a(_0x57c6de);})[_0xf8d3('0x1d')](function(_0x3d9a2c){logger[_0xf8d3('0x19')](_0xf8d3('0x24'),_0x3d9a2c['message'],_0xabaada);_0x179253(_0x4bb875[_0xf8d3('0x19')](0x1f4,_0x3d9a2c[_0xf8d3('0x1b')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x534b67){return new Promise(function(_0x1dd8f6,_0xf9a4a4){return db[_0xf8d3('0x1e')][_0xf8d3('0x27')]({'where':_0x534b67[_0xf8d3('0x21')]?_0x534b67[_0xf8d3('0x21')][_0xf8d3('0x22')]||null:null})[_0xf8d3('0x14')](function(_0x2c3c8f){if(_0x2c3c8f){return _0x2c3c8f['addTags'](_0x534b67[_0xf8d3('0x20')]['ids'],_[_0xf8d3('0x28')](_0x534b67[_0xf8d3('0x20')],['ids','id'])||{});}})[_0xf8d3('0x29')](function(_0x3e183c){logger[_0xf8d3('0x15')](_0xf8d3('0x2a'),_0x534b67);logger[_0xf8d3('0x25')](_0xf8d3('0x2a'),_0x534b67,JSON[_0xf8d3('0x26')](_0x3e183c));_0x1dd8f6(_0x3e183c);})['catch'](function(_0x6b4744){logger[_0xf8d3('0x19')](_0xf8d3('0x2a'),_0x6b4744[_0xf8d3('0x1b')],_0x534b67);_0xf9a4a4(_this[_0xf8d3('0x19')](0x1f4,_0x6b4744[_0xf8d3('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 420d67d..ac4c098 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 _0xa265=['./openchannelInteraction.events','save','update','removeListener','register','openchannelInteraction:'];(function(_0x2a3194,_0x4fbacc){var _0x4401ae=function(_0x5d0496){while(--_0x5d0496){_0x2a3194['push'](_0x2a3194['shift']());}};_0x4401ae(++_0x4fbacc);}(_0xa265,0xb4));var _0x5a26=function(_0x2d1e29,_0x4d4b79){_0x2d1e29=_0x2d1e29-0x0;var _0x5928db=_0xa265[_0x2d1e29];return _0x5928db;};'use strict';var OpenchannelInteractionEvents=require(_0x5a26('0x0'));var events=[_0x5a26('0x1'),'remove',_0x5a26('0x2')];function createListener(_0x4c18d1,_0x25a61a){return function(_0x2869a7){_0x25a61a['emit'](_0x4c18d1,_0x2869a7);};}function removeListener(_0xbc32c3,_0x1cf4d4){return function(){OpenchannelInteractionEvents[_0x5a26('0x3')](_0xbc32c3,_0x1cf4d4);};}exports[_0x5a26('0x4')]=function(_0x5b00c8){for(var _0x1083a0=0x0,_0x44f84c=events['length'];_0x1083a0<_0x44f84c;_0x1083a0++){var _0x435f39=events[_0x1083a0];var _0x171f85=createListener(_0x5a26('0x5')+_0x435f39,_0x5b00c8);OpenchannelInteractionEvents['on'](_0x435f39,_0x171f85);}}; \ No newline at end of file +var _0x9fe4=['update','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x58cfd1,_0x496c65){var _0x46ed96=function(_0x591208){while(--_0x591208){_0x58cfd1['push'](_0x58cfd1['shift']());}};_0x46ed96(++_0x496c65);}(_0x9fe4,0x1ee));var _0x49fe=function(_0x44880f,_0x1ef6c1){_0x44880f=_0x44880f-0x0;var _0x4f4302=_0x9fe4[_0x44880f];return _0x4f4302;};'use strict';var OpenchannelInteractionEvents=require(_0x49fe('0x0'));var events=[_0x49fe('0x1'),_0x49fe('0x2'),_0x49fe('0x3')];function createListener(_0x20359a,_0xba438b){return function(_0x5212fd){_0xba438b['emit'](_0x20359a,_0x5212fd);};}function removeListener(_0x5f13d5,_0xc187b){return function(){OpenchannelInteractionEvents[_0x49fe('0x4')](_0x5f13d5,_0xc187b);};}exports[_0x49fe('0x5')]=function(_0x4c4b3a){for(var _0x279e0e=0x0,_0x405d24=events['length'];_0x279e0e<_0x405d24;_0x279e0e++){var _0x209d99=events[_0x279e0e];var _0x1f7ae5=createListener(_0x49fe('0x6')+_0x209d99,_0x4c4b3a);OpenchannelInteractionEvents['on'](_0x209d99,_0x1f7ae5);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 72b1f4d..a17150a 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(_0x2e7fb5,_0x84b930){var _0x321aab=function(_0x38f8cc){while(--_0x38f8cc){_0x2e7fb5['push'](_0x2e7fb5['shift']());}};_0x321aab(++_0x84b930);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x8ffcd3,_0xb070d4){var _0x11d0c9=function(_0x141d58){while(--_0x141d58){_0x8ffcd3['push'](_0x8ffcd3['shift']());}};_0x11d0c9(++_0xb070d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a78a40f..0247bc7 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 _0x3306=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0xb4cc12,_0x41436e){var _0x8593b5=function(_0x13b840){while(--_0x13b840){_0xb4cc12['push'](_0xb4cc12['shift']());}};_0x8593b5(++_0x41436e);}(_0x3306,0x107));var _0x6330=function(_0xf4d05b,_0x490732){_0xf4d05b=_0xf4d05b-0x0;var _0x8ad782=_0x3306[_0xf4d05b];return _0x8ad782;};'use strict';var Sequelize=require(_0x6330('0x0'));module[_0x6330('0x1')]={'body':{'type':Sequelize[_0x6330('0x2')](_0x6330('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x6330('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6330('0x5')]('in',_0x6330('0x6')),'defaultValue':_0x6330('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6330('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6330('0x2')]}}; \ No newline at end of file +var _0x97db=['TEXT','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x35216f,_0x1fe4d3){var _0x429b12=function(_0x3863d7){while(--_0x3863d7){_0x35216f['push'](_0x35216f['shift']());}};_0x429b12(++_0x1fe4d3);}(_0x97db,0x1b4));var _0xb97d=function(_0x42ef79,_0xc8d68f){_0x42ef79=_0x42ef79-0x0;var _0x596001=_0x97db[_0x42ef79];return _0x596001;};'use strict';var Sequelize=require(_0xb97d('0x0'));module[_0xb97d('0x1')]={'body':{'type':Sequelize[_0xb97d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xb97d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb97d('0x4')]('in',_0xb97d('0x5')),'defaultValue':_0xb97d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb97d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 02feffc..b530ffb 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 _0xc051=['findAll','rows','show','params','filters','length','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','OpenchannelInteraction','find','OpenchannelInteractionId','isNil','read1stAt','format','interaction','role','null','AcceptMessage','sequelize','QueryTypes','agent','fullname','email','manual','SIP/%s','channel','motionChannel','event','acceptmessage','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','contact','User','internal','EventManager','rejectmessage','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc051,0xb5));var _0x1c05=function(_0x20592f,_0x2ae891){_0x20592f=_0x20592f-0x0;var _0x4e7211=_0xc051[_0x20592f];return _0x4e7211;};'use strict';var emlformat=require(_0x1c05('0x0'));var rimraf=require(_0x1c05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1c05('0x2'));var moment=require(_0x1c05('0x3'));var BPromise=require(_0x1c05('0x4'));var Mustache=require(_0x1c05('0x5'));var util=require('util');var path=require(_0x1c05('0x6'));var sox=require(_0x1c05('0x7'));var csv=require(_0x1c05('0x8'));var ejs=require(_0x1c05('0x9'));var fs=require('fs');var fs_extra=require(_0x1c05('0xa'));var _=require(_0x1c05('0xb'));var squel=require(_0x1c05('0xc'));var crypto=require(_0x1c05('0xd'));var jsforce=require(_0x1c05('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1c05('0x8'));var querystring=require(_0x1c05('0xf'));var Papa=require(_0x1c05('0x10'));var Redis=require(_0x1c05('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1c05('0x12'));var as=require(_0x1c05('0x13'));var hardwareService=require(_0x1c05('0x14'));var logger=require(_0x1c05('0x15'))('api');var utils=require(_0x1c05('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1c05('0x17'));var db=require(_0x1c05('0x18'))['db'];config[_0x1c05('0x19')]=_[_0x1c05('0x1a')](config[_0x1c05('0x19')],{'host':_0x1c05('0x1b'),'port':0x18eb});var socket=require(_0x1c05('0x1c'))(new Redis(config[_0x1c05('0x19')]));require(_0x1c05('0x1d'))[_0x1c05('0x1e')](socket);var jayson=require(_0x1c05('0x1f'));var client=jayson[_0x1c05('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x1c05('0x20')][_0x1c05('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x26a61e,_0x568633,_0x1e713f,_0x49b538){return new BPromise(function(_0x2ad711,_0x439aa5){var _0x3af388=_0x49b538||client;return _0x3af388[_0x1c05('0x22')](_0x26a61e,_0x1e713f)[_0x1c05('0x23')](function(_0x5d9a7e){logger[_0x1c05('0x24')](_0x1c05('0x25'),_0x568633,_0x1c05('0x26'));logger['debug'](_0x1c05('0x27'),_0x568633,_0x1c05('0x26'),JSON[_0x1c05('0x28')](_0x5d9a7e));if(_0x5d9a7e['error']){if(_0x5d9a7e[_0x1c05('0x29')][_0x1c05('0x2a')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x568633,_0x5d9a7e[_0x1c05('0x29')]['message']);return _0x439aa5(_0x5d9a7e['error']['message']);}logger[_0x1c05('0x29')](_0x1c05('0x25'),_0x568633,_0x5d9a7e['error'][_0x1c05('0x2b')]);return _0x2ad711(_0x5d9a7e[_0x1c05('0x29')][_0x1c05('0x2b')]);}else{logger[_0x1c05('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x568633,_0x1c05('0x26'));_0x2ad711(_0x5d9a7e[_0x1c05('0x2c')][_0x1c05('0x2b')]);}})[_0x1c05('0x2d')](function(_0x25d863){logger[_0x1c05('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x568633,_0x25d863);_0x439aa5(_0x25d863);});});}function respondWithStatusCode(_0xa841fb,_0x1dd767){_0x1dd767=_0x1dd767||0xcc;return function(_0x248f1d){if(_0x248f1d){return _0xa841fb[_0x1c05('0x2e')](_0x1dd767);}return _0xa841fb[_0x1c05('0x2f')](_0x1dd767)[_0x1c05('0x30')]();};}function respondWithResult(_0x190987,_0x4f7658){_0x4f7658=_0x4f7658||0xc8;return function(_0x32e88d){if(_0x32e88d){return _0x190987[_0x1c05('0x2f')](_0x4f7658)[_0x1c05('0x31')](_0x32e88d);}};}function respondWithFilteredResult(_0x5026ab,_0x52bc85){return function(_0x21594d){if(_0x21594d){var _0x1d548e=typeof _0x52bc85[_0x1c05('0x32')]===_0x1c05('0x33')&&typeof _0x52bc85[_0x1c05('0x34')]===_0x1c05('0x33');var _0x104678=_0x21594d[_0x1c05('0x35')];var _0x1224da=_0x1d548e?0x0:_0x52bc85[_0x1c05('0x32')];var _0x24b53f=_0x1d548e?_0x21594d[_0x1c05('0x35')]:_0x52bc85[_0x1c05('0x32')]+_0x52bc85[_0x1c05('0x34')];var _0x5aab6b;if(_0x24b53f>=_0x104678){_0x24b53f=_0x104678;_0x5aab6b=0xc8;}else{_0x5aab6b=0xce;}_0x5026ab[_0x1c05('0x2f')](_0x5aab6b);return _0x5026ab['set']('Content-Range',_0x1224da+'-'+_0x24b53f+'/'+_0x104678)[_0x1c05('0x31')](_0x21594d);}return null;};}function patchUpdates(_0x19323d){return function(_0xdd7dae){try{jsonpatch[_0x1c05('0x36')](_0xdd7dae,_0x19323d,!![]);}catch(_0x5b0ef4){return BPromise[_0x1c05('0x37')](_0x5b0ef4);}return _0xdd7dae['save']();};}function saveUpdates(_0x1513d4,_0x54269a){return function(_0x12a75a){if(_0x12a75a){return _0x12a75a[_0x1c05('0x38')](_0x1513d4)[_0x1c05('0x23')](function(_0xecd06f){return _0xecd06f;});}return null;};}function removeEntity(_0x230f48,_0x1513e3){return function(_0x361813){if(_0x361813){return _0x361813[_0x1c05('0x39')]()[_0x1c05('0x23')](function(){_0x230f48[_0x1c05('0x2f')](0xcc)[_0x1c05('0x30')]();});}};}function handleEntityNotFound(_0x1932b8,_0x63167b){return function(_0x418219){if(!_0x418219){_0x1932b8[_0x1c05('0x2e')](0x194);}return _0x418219;};}function handleError(_0x182e0a,_0x3a9196){_0x3a9196=_0x3a9196||0x1f4;return function(_0x385dcc){logger['error'](_0x385dcc[_0x1c05('0x3a')]);if(_0x385dcc[_0x1c05('0x3b')]){delete _0x385dcc['name'];}_0x182e0a['status'](_0x3a9196)[_0x1c05('0x3c')](_0x385dcc);};}exports[_0x1c05('0x3d')]=function(_0x1eb5bb,_0x530350){var _0x20f3dc={},_0x12b7d3={},_0xc1d675={'count':0x0,'rows':[]};var _0x4a022b=_[_0x1c05('0x3e')](db[_0x1c05('0x3f')][_0x1c05('0x40')],function(_0x5b4e12){return{'name':_0x5b4e12['fieldName'],'type':_0x5b4e12['type']['key']};});_0x12b7d3[_0x1c05('0x41')]=_['map'](_0x4a022b,'name');_0x12b7d3[_0x1c05('0x42')]=_[_0x1c05('0x43')](_0x1eb5bb[_0x1c05('0x42')]);_0x12b7d3['filters']=_[_0x1c05('0x44')](_0x12b7d3[_0x1c05('0x41')],_0x12b7d3[_0x1c05('0x42')]);_0x20f3dc[_0x1c05('0x45')]=_[_0x1c05('0x44')](_0x12b7d3[_0x1c05('0x41')],qs[_0x1c05('0x46')](_0x1eb5bb[_0x1c05('0x42')]['fields']));_0x20f3dc[_0x1c05('0x45')]=_0x20f3dc[_0x1c05('0x45')]['length']?_0x20f3dc[_0x1c05('0x45')]:_0x12b7d3[_0x1c05('0x41')];if(!_0x1eb5bb['query'][_0x1c05('0x47')](_0x1c05('0x48'))){_0x20f3dc[_0x1c05('0x34')]=qs[_0x1c05('0x34')](_0x1eb5bb['query'][_0x1c05('0x34')]);_0x20f3dc['offset']=qs['offset'](_0x1eb5bb[_0x1c05('0x42')][_0x1c05('0x32')]);}_0x20f3dc[_0x1c05('0x49')]=qs['sort'](_0x1eb5bb[_0x1c05('0x42')]['sort']);_0x20f3dc[_0x1c05('0x4a')]=qs['filters'](_[_0x1c05('0x4b')](_0x1eb5bb[_0x1c05('0x42')],_0x12b7d3['filters']),_0x4a022b);if(_0x1eb5bb[_0x1c05('0x42')][_0x1c05('0x4c')]){_0x20f3dc[_0x1c05('0x4a')]=_[_0x1c05('0x4d')](_0x20f3dc[_0x1c05('0x4a')],{'$or':_[_0x1c05('0x3e')](_0x4a022b,function(_0x2df92f){if(_0x2df92f[_0x1c05('0x4e')]!==_0x1c05('0x4f')){var _0x4ab1de={};_0x4ab1de[_0x2df92f[_0x1c05('0x3b')]]={'$like':'%'+_0x1eb5bb[_0x1c05('0x42')][_0x1c05('0x4c')]+'%'};return _0x4ab1de;}})});}_0x20f3dc=_['merge']({},_0x20f3dc,_0x1eb5bb[_0x1c05('0x50')]);var _0x20efb2={'where':_0x20f3dc[_0x1c05('0x4a')]};return db[_0x1c05('0x3f')][_0x1c05('0x35')](_0x20efb2)[_0x1c05('0x23')](function(_0xfa3a5e){_0xc1d675[_0x1c05('0x35')]=_0xfa3a5e;if(_0x1eb5bb[_0x1c05('0x42')][_0x1c05('0x51')]){_0x20f3dc[_0x1c05('0x52')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1c05('0x53')](_0x20f3dc);})['then'](function(_0x744b57){_0xc1d675[_0x1c05('0x54')]=_0x744b57;return _0xc1d675;})[_0x1c05('0x23')](respondWithFilteredResult(_0x530350,_0x20f3dc))['catch'](handleError(_0x530350,null));};exports[_0x1c05('0x55')]=function(_0x5e9e1b,_0x1df18b){var _0x10c553={'raw':!![],'where':{'id':_0x5e9e1b[_0x1c05('0x56')]['id']}},_0xf1a0bc={};_0xf1a0bc[_0x1c05('0x41')]=_[_0x1c05('0x43')](db[_0x1c05('0x3f')][_0x1c05('0x40')]);_0xf1a0bc[_0x1c05('0x42')]=_['keys'](_0x5e9e1b[_0x1c05('0x42')]);_0xf1a0bc[_0x1c05('0x57')]=_[_0x1c05('0x44')](_0xf1a0bc[_0x1c05('0x41')],_0xf1a0bc[_0x1c05('0x42')]);_0x10c553[_0x1c05('0x45')]=_[_0x1c05('0x44')](_0xf1a0bc[_0x1c05('0x41')],qs[_0x1c05('0x46')](_0x5e9e1b[_0x1c05('0x42')][_0x1c05('0x46')]));_0x10c553[_0x1c05('0x45')]=_0x10c553[_0x1c05('0x45')][_0x1c05('0x58')]?_0x10c553[_0x1c05('0x45')]:_0xf1a0bc[_0x1c05('0x41')];if(_0x5e9e1b[_0x1c05('0x42')]['includeAll']){_0x10c553[_0x1c05('0x52')]=[{'all':!![]}];}_0x10c553=_['merge']({},_0x10c553,_0x5e9e1b[_0x1c05('0x50')]);return db[_0x1c05('0x3f')]['find'](_0x10c553)[_0x1c05('0x23')](handleEntityNotFound(_0x1df18b,null))[_0x1c05('0x23')](respondWithResult(_0x1df18b,null))[_0x1c05('0x2d')](handleError(_0x1df18b,null));};exports[_0x1c05('0x59')]=function(_0x2af082,_0x4eef01){return db[_0x1c05('0x3f')]['create'](_0x2af082[_0x1c05('0x5a')],{})['then'](respondWithResult(_0x4eef01,0xc9))[_0x1c05('0x2d')](handleError(_0x4eef01,null));};exports['update']=function(_0x1e912,_0x200e75){if(_0x1e912['body']['id']){delete _0x1e912[_0x1c05('0x5a')]['id'];}return db[_0x1c05('0x3f')]['find']({'where':{'id':_0x1e912['params']['id']}})[_0x1c05('0x23')](handleEntityNotFound(_0x200e75,null))[_0x1c05('0x23')](saveUpdates(_0x1e912[_0x1c05('0x5a')],null))['then'](respondWithResult(_0x200e75,null))[_0x1c05('0x2d')](handleError(_0x200e75,null));};exports['destroy']=function(_0x13bf02,_0x33b932){return db[_0x1c05('0x3f')]['find']({'where':{'id':_0x13bf02[_0x1c05('0x56')]['id']}})[_0x1c05('0x23')](handleEntityNotFound(_0x33b932,null))[_0x1c05('0x23')](removeEntity(_0x33b932,null))['catch'](handleError(_0x33b932,null));};exports[_0x1c05('0x5b')]=function(_0x531f25,_0x2b3eb5){return db[_0x1c05('0x3f')]['describe']()['then'](respondWithResult(_0x2b3eb5,null))[_0x1c05('0x2d')](handleError(_0x2b3eb5,null));};var interaction_log=require(_0x1c05('0x15'))(_0x1c05('0x5c'));exports[_0x1c05('0x5d')]=function(_0x2a3fbf,_0x523476,_0x3bbfa0){var _0x1e39fa={'agent':{},'channel':_0x1c05('0x5e')};if(_0x2a3fbf['body']['id']){delete _0x2a3fbf['body']['id'];}_0x2a3fbf[_0x1c05('0x5a')][_0x1c05('0x5f')]=!![];_0x2a3fbf['body'][_0x1c05('0x60')]=moment()['format'](_0x1c05('0x61'));_0x2a3fbf[_0x1c05('0x5a')][_0x1c05('0x62')]=_0x2a3fbf[_0x1c05('0x5a')][_0x1c05('0x62')]||_0x2a3fbf[_0x1c05('0x63')]['id'];_0x1e39fa['agent']['id']=_0x2a3fbf['body'][_0x1c05('0x62')];return db[_0x1c05('0x3f')]['find']({'where':{'id':_0x2a3fbf[_0x1c05('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x523476,null))['then'](saveUpdates(_0x2a3fbf[_0x1c05('0x5a')],null))['then'](function(_0x29e86b){if(_0x29e86b){_0x1e39fa[_0x1c05('0x2b')]=_0x29e86b['get']({'plain':!![]});return db[_0x1c05('0x64')][_0x1c05('0x65')]({'where':{'id':_0x29e86b[_0x1c05('0x66')]}});}return null;})[_0x1c05('0x23')](handleEntityNotFound(_0x523476,null))['then'](function(_0x4c587f){if(_0x4c587f){return _0x4c587f['update']({'UserId':_0x2a3fbf[_0x1c05('0x5a')]['UserId'],'read1stAt':_[_0x1c05('0x67')](_0x4c587f[_0x1c05('0x68')])?moment()[_0x1c05('0x69')](_0x1c05('0x61')):undefined});}return null;})[_0x1c05('0x23')](function(_0x273884){if(_0x273884){_0x1e39fa[_0x1c05('0x6a')]=_0x273884['get']({'plain':!![]});interaction_log[_0x1c05('0x24')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a3fbf[_0x1c05('0x63')]['id'],_0x2a3fbf[_0x1c05('0x63')][_0x1c05('0x3b')],_0x2a3fbf['user'][_0x1c05('0x6b')],_0x1e39fa[_0x1c05('0x6a')]['id'],_0x2a3fbf['body']?JSON[_0x1c05('0x28')](_0x2a3fbf[_0x1c05('0x5a')]):_0x1c05('0x6c'));return respondWithRpcPromise(_0x1c05('0x6d'),'acceptMessage',_0x1e39fa);}return null;})[_0x1c05('0x23')](function(_0x4dbba9){var _0x16d751='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4dbba9[_0x1c05('0x2b')]['ContactId'];return db[_0x1c05('0x6e')]['query'](_0x16d751,{'type':db['Sequelize'][_0x1c05('0x6f')]['SELECT'],'raw':!![]})[_0x1c05('0x23')](function(_0xb00a1){return _0xb00a1;});})[_0x1c05('0x23')](function(_0x5c7125){if(_0x5c7125){_0x1e39fa[_0x1c05('0x2b')]['contact']=_0x5c7125[0x0];if(!_0x2a3fbf['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x2a3fbf[_0x1c05('0x5a')][_0x1c05('0x62')],'role':_0x1c05('0x70')},'attributes':['id','name',_0x1c05('0x71'),_0x1c05('0x72'),'internal'],'raw':!![]});}return null;})[_0x1c05('0x23')](function(_0x59caa6){if(!_0x59caa6)return null;_0x1e39fa['message'][_0x1c05('0x70')]=_0x59caa6;return _0x1e39fa;})[_0x1c05('0x23')](function(_0x487e25){if(_0x487e25){if(_0x2a3fbf[_0x1c05('0x5a')][_0x1c05('0x73')]){_0x1e39fa[_0x1c05('0x2b')]['interface']=util[_0x1c05('0x69')](_0x1c05('0x74'),_0x2a3fbf[_0x1c05('0x63')][_0x1c05('0x3b')]);_0x1e39fa[_0x1c05('0x2b')][_0x1c05('0x75')]=_0x1e39fa[_0x1c05('0x75')];_0x1e39fa[_0x1c05('0x2b')][_0x1c05('0x76')]=_0x1e39fa[_0x1c05('0x75')];_0x1e39fa[_0x1c05('0x2b')][_0x1c05('0x77')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x1c05('0x78'),'message':_0x1e39fa[_0x1c05('0x2b')]},client9002)[_0x1c05('0x23')](function(){return _0x1e39fa;});}return _0x1e39fa;}return null;})['then'](respondWithResult(_0x523476,null))[_0x1c05('0x2d')](handleError(_0x523476,null));};var interaction_log=require(_0x1c05('0x15'))('openchannel-interactions');exports[_0x1c05('0x37')]=function(_0x66e432,_0x48f857,_0x5400d3){var _0x55fc0b={'agent':{},'channel':_0x1c05('0x5e')};if(_0x66e432[_0x1c05('0x5a')]['id']){delete _0x66e432[_0x1c05('0x5a')]['id'];}_0x66e432[_0x1c05('0x5a')][_0x1c05('0x62')]=_0x66e432[_0x1c05('0x5a')][_0x1c05('0x62')]||_0x66e432[_0x1c05('0x63')]['id'];_0x55fc0b['agent']['id']=_0x66e432[_0x1c05('0x5a')][_0x1c05('0x62')];return db['OpenchannelMessage'][_0x1c05('0x65')]({'where':{'id':_0x66e432[_0x1c05('0x56')]['id'],'UserId':null}})[_0x1c05('0x23')](handleEntityNotFound(_0x48f857,null))[_0x1c05('0x23')](function(_0x51e283){if(_0x51e283){_0x55fc0b[_0x1c05('0x2b')]=_0x51e283[_0x1c05('0x79')]({'plain':!![]});return db[_0x1c05('0x64')][_0x1c05('0x65')]({'where':{'id':_0x51e283[_0x1c05('0x66')]}});}return null;})[_0x1c05('0x23')](handleEntityNotFound(_0x48f857,null))[_0x1c05('0x23')](function(_0x2f099e){if(_0x2f099e){_0x55fc0b[_0x1c05('0x6a')]=_0x2f099e['get']({'plain':!![]});interaction_log[_0x1c05('0x24')](_0x1c05('0x7a'),_0x66e432[_0x1c05('0x63')]['id'],_0x66e432[_0x1c05('0x63')][_0x1c05('0x3b')],_0x66e432[_0x1c05('0x63')]['role'],_0x55fc0b[_0x1c05('0x6a')]['id'],_0x66e432['body']?JSON[_0x1c05('0x28')](_0x66e432['body']):'null');return respondWithRpcPromise('RejectMessage',_0x1c05('0x7b'),_0x55fc0b);}return null;})[_0x1c05('0x23')](function(_0x32204b){var _0x10fbd9=_0x1c05('0x7c')+_0x32204b[_0x1c05('0x2b')][_0x1c05('0x7d')];return db[_0x1c05('0x6e')]['query'](_0x10fbd9,{'type':db[_0x1c05('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x1c05('0x23')](function(_0x31c768){return _0x31c768;});})[_0x1c05('0x23')](function(_0x4a2307){if(_0x4a2307){_0x55fc0b[_0x1c05('0x2b')][_0x1c05('0x7f')]=_0x4a2307[0x0];if(!_0x66e432[_0x1c05('0x5a')][_0x1c05('0x62')])return;return db[_0x1c05('0x80')][_0x1c05('0x65')]({'where':{'id':_0x66e432[_0x1c05('0x5a')][_0x1c05('0x62')],'role':_0x1c05('0x70')},'attributes':['id','name',_0x1c05('0x71'),_0x1c05('0x72'),_0x1c05('0x81')],'raw':!![]});}return null;})[_0x1c05('0x23')](function(_0x4c3a9f){if(!_0x4c3a9f)return null;_0x55fc0b[_0x1c05('0x2b')][_0x1c05('0x70')]=_0x4c3a9f;return _0x55fc0b;})[_0x1c05('0x23')](function(_0x4a2b47){if(_0x4a2b47){_0x4a2b47[_0x1c05('0x2b')]['interface']=util['format'](_0x1c05('0x74'),_0x66e432[_0x1c05('0x63')]['name']);_0x4a2b47[_0x1c05('0x2b')]['channel']=_0x55fc0b[_0x1c05('0x75')];_0x4a2b47[_0x1c05('0x2b')][_0x1c05('0x76')]=_0x55fc0b[_0x1c05('0x75')];_0x4a2b47[_0x1c05('0x2b')][_0x1c05('0x77')]=_0x1c05('0x37');respondWithRpcPromise(_0x1c05('0x82'),_0x1c05('0x82'),{'event':_0x1c05('0x83'),'message':_0x4a2b47[_0x1c05('0x2b')]},client9002);return _0x55fc0b;}return null;})[_0x1c05('0x23')](respondWithResult(_0x48f857,null))['catch'](handleError(_0x48f857,null));}; \ No newline at end of file +var _0x7044=['message','OpenchannelMessage,\x20%s,\x20%s','catch','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','end','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','length','create','body','find','params','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5f5df5,_0x2f41c8){var _0x511d12=function(_0x33bbd6){while(--_0x33bbd6){_0x5f5df5['push'](_0x5f5df5['shift']());}};_0x511d12(++_0x2f41c8);}(_0x7044,0x1ce));var _0x4704=function(_0x1e0152,_0x1693d9){_0x1e0152=_0x1e0152-0x0;var _0x36be50=_0x7044[_0x1e0152];return _0x36be50;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4704('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4704('0x1'));var BPromise=require(_0x4704('0x2'));var Mustache=require(_0x4704('0x3'));var util=require(_0x4704('0x4'));var path=require(_0x4704('0x5'));var sox=require(_0x4704('0x6'));var csv=require(_0x4704('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4704('0x8'));var _=require(_0x4704('0x9'));var squel=require(_0x4704('0xa'));var crypto=require(_0x4704('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4704('0xc'));var toCsv=require(_0x4704('0x7'));var querystring=require('querystring');var Papa=require(_0x4704('0xd'));var Redis=require(_0x4704('0xe'));var authService=require(_0x4704('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4704('0x10'));var hardwareService=require(_0x4704('0x11'));var logger=require(_0x4704('0x12'))(_0x4704('0x13'));var utils=require('../../config/utils');var config=require(_0x4704('0x14'));var licenseUtil=require(_0x4704('0x15'));var db=require(_0x4704('0x16'))['db'];config['redis']=_['defaults'](config[_0x4704('0x17')],{'host':_0x4704('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4704('0x19'))[_0x4704('0x1a')](socket);var jayson=require(_0x4704('0x1b'));var client=jayson[_0x4704('0x1c')][_0x4704('0x1d')]({'port':0x232c});var client9002=jayson[_0x4704('0x1c')][_0x4704('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4d0cfc,_0x13abd8,_0xf79f94,_0x58d13a){return new BPromise(function(_0xa68891,_0x2a9b11){var _0x1aeb98=_0x58d13a||client;return _0x1aeb98['request'](_0x4d0cfc,_0xf79f94)[_0x4704('0x1e')](function(_0xa1af58){logger[_0x4704('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x13abd8,_0x4704('0x20'));logger[_0x4704('0x21')](_0x4704('0x22'),_0x13abd8,'request\x20sent',JSON[_0x4704('0x23')](_0xa1af58));if(_0xa1af58[_0x4704('0x24')]){if(_0xa1af58[_0x4704('0x24')][_0x4704('0x25')]===0x1f4){logger[_0x4704('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x13abd8,_0xa1af58[_0x4704('0x24')]['message']);return _0x2a9b11(_0xa1af58[_0x4704('0x24')][_0x4704('0x26')]);}logger[_0x4704('0x24')](_0x4704('0x27'),_0x13abd8,_0xa1af58[_0x4704('0x24')][_0x4704('0x26')]);return _0xa68891(_0xa1af58[_0x4704('0x24')][_0x4704('0x26')]);}else{logger[_0x4704('0x1f')](_0x4704('0x27'),_0x13abd8,_0x4704('0x20'));_0xa68891(_0xa1af58['result'][_0x4704('0x26')]);}})[_0x4704('0x28')](function(_0x40c831){logger[_0x4704('0x24')](_0x4704('0x27'),_0x13abd8,_0x40c831);_0x2a9b11(_0x40c831);});});}function respondWithStatusCode(_0x37b8d8,_0x269c6d){_0x269c6d=_0x269c6d||0xcc;return function(_0x5427b9){if(_0x5427b9){return _0x37b8d8['sendStatus'](_0x269c6d);}return _0x37b8d8[_0x4704('0x29')](_0x269c6d)['end']();};}function respondWithResult(_0x28074,_0xe210d7){_0xe210d7=_0xe210d7||0xc8;return function(_0x45f940){if(_0x45f940){return _0x28074[_0x4704('0x29')](_0xe210d7)[_0x4704('0x2a')](_0x45f940);}};}function respondWithFilteredResult(_0x83ee34,_0x5c025d){return function(_0x260b88){if(_0x260b88){var _0x57ab11=typeof _0x5c025d[_0x4704('0x2b')]==='undefined'&&typeof _0x5c025d[_0x4704('0x2c')]===_0x4704('0x2d');var _0x52e082=_0x260b88['count'];var _0x2ab537=_0x57ab11?0x0:_0x5c025d[_0x4704('0x2b')];var _0x241b48=_0x57ab11?_0x260b88[_0x4704('0x2e')]:_0x5c025d['offset']+_0x5c025d[_0x4704('0x2c')];var _0x17590c;if(_0x241b48>=_0x52e082){_0x241b48=_0x52e082;_0x17590c=0xc8;}else{_0x17590c=0xce;}_0x83ee34[_0x4704('0x29')](_0x17590c);return _0x83ee34[_0x4704('0x2f')](_0x4704('0x30'),_0x2ab537+'-'+_0x241b48+'/'+_0x52e082)[_0x4704('0x2a')](_0x260b88);}return null;};}function patchUpdates(_0x4a1bea){return function(_0xa17cf9){try{jsonpatch['apply'](_0xa17cf9,_0x4a1bea,!![]);}catch(_0x5cd316){return BPromise[_0x4704('0x31')](_0x5cd316);}return _0xa17cf9['save']();};}function saveUpdates(_0x1ae947,_0x4f8502){return function(_0x4b5a2e){if(_0x4b5a2e){return _0x4b5a2e[_0x4704('0x32')](_0x1ae947)[_0x4704('0x1e')](function(_0xa38b27){return _0xa38b27;});}return null;};}function removeEntity(_0x382278,_0x4eb4f7){return function(_0x2c3bb6){if(_0x2c3bb6){return _0x2c3bb6[_0x4704('0x33')]()['then'](function(){_0x382278['status'](0xcc)[_0x4704('0x34')]();});}};}function handleEntityNotFound(_0x35dae3,_0x1e8a9b){return function(_0x47b45c){if(!_0x47b45c){_0x35dae3[_0x4704('0x35')](0x194);}return _0x47b45c;};}function handleError(_0x2c72d7,_0x314769){_0x314769=_0x314769||0x1f4;return function(_0x3c72d5){logger[_0x4704('0x24')](_0x3c72d5[_0x4704('0x36')]);if(_0x3c72d5[_0x4704('0x37')]){delete _0x3c72d5[_0x4704('0x37')];}_0x2c72d7['status'](_0x314769)[_0x4704('0x38')](_0x3c72d5);};}exports['index']=function(_0x570c59,_0x574fbf){var _0x397fcf={},_0x483788={},_0x33de1e={'count':0x0,'rows':[]};var _0x1b1c36=_[_0x4704('0x39')](db[_0x4704('0x3a')][_0x4704('0x3b')],function(_0x3c717b){return{'name':_0x3c717b[_0x4704('0x3c')],'type':_0x3c717b[_0x4704('0x3d')][_0x4704('0x3e')]};});_0x483788['model']=_['map'](_0x1b1c36,_0x4704('0x37'));_0x483788[_0x4704('0x3f')]=_['keys'](_0x570c59[_0x4704('0x3f')]);_0x483788[_0x4704('0x40')]=_[_0x4704('0x41')](_0x483788[_0x4704('0x42')],_0x483788[_0x4704('0x3f')]);_0x397fcf['attributes']=_['intersection'](_0x483788[_0x4704('0x42')],qs[_0x4704('0x43')](_0x570c59[_0x4704('0x3f')][_0x4704('0x43')]));_0x397fcf[_0x4704('0x44')]=_0x397fcf[_0x4704('0x44')]['length']?_0x397fcf[_0x4704('0x44')]:_0x483788['model'];if(!_0x570c59['query'][_0x4704('0x45')]('nolimit')){_0x397fcf['limit']=qs[_0x4704('0x2c')](_0x570c59[_0x4704('0x3f')][_0x4704('0x2c')]);_0x397fcf[_0x4704('0x2b')]=qs['offset'](_0x570c59[_0x4704('0x3f')][_0x4704('0x2b')]);}_0x397fcf[_0x4704('0x46')]=qs[_0x4704('0x47')](_0x570c59['query'][_0x4704('0x47')]);_0x397fcf[_0x4704('0x48')]=qs[_0x4704('0x40')](_[_0x4704('0x49')](_0x570c59[_0x4704('0x3f')],_0x483788[_0x4704('0x40')]),_0x1b1c36);if(_0x570c59[_0x4704('0x3f')][_0x4704('0x4a')]){_0x397fcf[_0x4704('0x48')]=_[_0x4704('0x4b')](_0x397fcf[_0x4704('0x48')],{'$or':_[_0x4704('0x39')](_0x1b1c36,function(_0x3a1c55){if(_0x3a1c55[_0x4704('0x3d')]!==_0x4704('0x4c')){var _0x4c5bd2={};_0x4c5bd2[_0x3a1c55[_0x4704('0x37')]]={'$like':'%'+_0x570c59[_0x4704('0x3f')][_0x4704('0x4a')]+'%'};return _0x4c5bd2;}})});}_0x397fcf=_[_0x4704('0x4b')]({},_0x397fcf,_0x570c59[_0x4704('0x4d')]);var _0x11c64f={'where':_0x397fcf['where']};return db[_0x4704('0x3a')][_0x4704('0x2e')](_0x11c64f)[_0x4704('0x1e')](function(_0x58bd21){_0x33de1e['count']=_0x58bd21;if(_0x570c59['query']['includeAll']){_0x397fcf[_0x4704('0x4e')]=[{'all':!![]}];}return db[_0x4704('0x3a')][_0x4704('0x4f')](_0x397fcf);})[_0x4704('0x1e')](function(_0x16f291){_0x33de1e[_0x4704('0x50')]=_0x16f291;return _0x33de1e;})[_0x4704('0x1e')](respondWithFilteredResult(_0x574fbf,_0x397fcf))[_0x4704('0x28')](handleError(_0x574fbf,null));};exports['show']=function(_0x4725c2,_0xfc3c21){var _0x5c9046={'raw':!![],'where':{'id':_0x4725c2['params']['id']}},_0x794665={};_0x794665[_0x4704('0x42')]=_['keys'](db[_0x4704('0x3a')][_0x4704('0x3b')]);_0x794665[_0x4704('0x3f')]=_['keys'](_0x4725c2[_0x4704('0x3f')]);_0x794665['filters']=_['intersection'](_0x794665[_0x4704('0x42')],_0x794665['query']);_0x5c9046[_0x4704('0x44')]=_[_0x4704('0x41')](_0x794665[_0x4704('0x42')],qs[_0x4704('0x43')](_0x4725c2['query'][_0x4704('0x43')]));_0x5c9046[_0x4704('0x44')]=_0x5c9046[_0x4704('0x44')][_0x4704('0x51')]?_0x5c9046[_0x4704('0x44')]:_0x794665[_0x4704('0x42')];if(_0x4725c2[_0x4704('0x3f')]['includeAll']){_0x5c9046['include']=[{'all':!![]}];}_0x5c9046=_[_0x4704('0x4b')]({},_0x5c9046,_0x4725c2['options']);return db[_0x4704('0x3a')]['find'](_0x5c9046)['then'](handleEntityNotFound(_0xfc3c21,null))['then'](respondWithResult(_0xfc3c21,null))[_0x4704('0x28')](handleError(_0xfc3c21,null));};exports[_0x4704('0x52')]=function(_0x1fd8fd,_0x37d41f){return db[_0x4704('0x3a')][_0x4704('0x52')](_0x1fd8fd['body'],{})['then'](respondWithResult(_0x37d41f,0xc9))['catch'](handleError(_0x37d41f,null));};exports[_0x4704('0x32')]=function(_0xac83b5,_0x2371f1){if(_0xac83b5['body']['id']){delete _0xac83b5[_0x4704('0x53')]['id'];}return db[_0x4704('0x3a')][_0x4704('0x54')]({'where':{'id':_0xac83b5['params']['id']}})[_0x4704('0x1e')](handleEntityNotFound(_0x2371f1,null))[_0x4704('0x1e')](saveUpdates(_0xac83b5[_0x4704('0x53')],null))['then'](respondWithResult(_0x2371f1,null))['catch'](handleError(_0x2371f1,null));};exports['destroy']=function(_0x1a20fe,_0x36b389){return db[_0x4704('0x3a')][_0x4704('0x54')]({'where':{'id':_0x1a20fe[_0x4704('0x55')]['id']}})[_0x4704('0x1e')](handleEntityNotFound(_0x36b389,null))[_0x4704('0x1e')](removeEntity(_0x36b389,null))[_0x4704('0x28')](handleError(_0x36b389,null));};exports[_0x4704('0x56')]=function(_0x1b0a51,_0x58ce2e){return db[_0x4704('0x3a')]['describe']()[_0x4704('0x1e')](respondWithResult(_0x58ce2e,null))[_0x4704('0x28')](handleError(_0x58ce2e,null));};var interaction_log=require(_0x4704('0x12'))(_0x4704('0x57'));exports['accept']=function(_0x4a4464,_0x31debd,_0x4bd3a9){var _0x195ffc={'agent':{},'channel':_0x4704('0x58')};if(_0x4a4464[_0x4704('0x53')]['id']){delete _0x4a4464[_0x4704('0x53')]['id'];}_0x4a4464['body'][_0x4704('0x59')]=!![];_0x4a4464['body'][_0x4704('0x5a')]=moment()[_0x4704('0x5b')](_0x4704('0x5c'));_0x4a4464[_0x4704('0x53')][_0x4704('0x5d')]=_0x4a4464['body'][_0x4704('0x5d')]||_0x4a4464[_0x4704('0x5e')]['id'];_0x195ffc[_0x4704('0x5f')]['id']=_0x4a4464[_0x4704('0x53')][_0x4704('0x5d')];return db[_0x4704('0x3a')][_0x4704('0x54')]({'where':{'id':_0x4a4464['params']['id'],'UserId':null}})[_0x4704('0x1e')](handleEntityNotFound(_0x31debd,null))[_0x4704('0x1e')](saveUpdates(_0x4a4464[_0x4704('0x53')],null))['then'](function(_0x49429e){if(_0x49429e){_0x195ffc[_0x4704('0x26')]=_0x49429e[_0x4704('0x60')]({'plain':!![]});return db[_0x4704('0x61')][_0x4704('0x54')]({'where':{'id':_0x49429e[_0x4704('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x31debd,null))['then'](function(_0x406bd2){if(_0x406bd2){return _0x406bd2[_0x4704('0x32')]({'UserId':_0x4a4464[_0x4704('0x53')]['UserId'],'read1stAt':_['isNil'](_0x406bd2['read1stAt'])?moment()['format'](_0x4704('0x5c')):undefined});}return null;})['then'](function(_0x52e5d0){if(_0x52e5d0){_0x195ffc[_0x4704('0x63')]=_0x52e5d0[_0x4704('0x60')]({'plain':!![]});interaction_log[_0x4704('0x1f')](_0x4704('0x64'),_0x4a4464['user']['id'],_0x4a4464[_0x4704('0x5e')]['name'],_0x4a4464[_0x4704('0x5e')]['role'],_0x195ffc[_0x4704('0x63')]['id'],_0x4a4464[_0x4704('0x53')]?JSON['stringify'](_0x4a4464[_0x4704('0x53')]):_0x4704('0x65'));return respondWithRpcPromise('AcceptMessage',_0x4704('0x66'),_0x195ffc);}return null;})[_0x4704('0x1e')](function(_0x463406){var _0x1b51d5=_0x4704('0x67')+_0x463406['message'][_0x4704('0x68')];return db[_0x4704('0x69')][_0x4704('0x3f')](_0x1b51d5,{'type':db[_0x4704('0x6a')][_0x4704('0x6b')][_0x4704('0x6c')],'raw':!![]})['then'](function(_0x95569){return _0x95569;});})['then'](function(_0x56cab0){if(_0x56cab0){_0x195ffc[_0x4704('0x26')]['contact']=_0x56cab0[0x0];if(!_0x4a4464[_0x4704('0x53')][_0x4704('0x5d')])return;return db[_0x4704('0x6d')][_0x4704('0x54')]({'where':{'id':_0x4a4464[_0x4704('0x53')][_0x4704('0x5d')],'role':_0x4704('0x5f')},'attributes':['id',_0x4704('0x37'),_0x4704('0x6e'),_0x4704('0x6f'),_0x4704('0x70')],'raw':!![]});}return null;})[_0x4704('0x1e')](function(_0x378b74){if(!_0x378b74)return null;_0x195ffc['message'][_0x4704('0x5f')]=_0x378b74;return _0x195ffc;})[_0x4704('0x1e')](function(_0x34d3d6){if(_0x34d3d6){if(_0x4a4464[_0x4704('0x53')][_0x4704('0x71')]){_0x195ffc['message'][_0x4704('0x72')]=util[_0x4704('0x5b')](_0x4704('0x73'),_0x4a4464[_0x4704('0x5e')][_0x4704('0x37')]);_0x195ffc[_0x4704('0x26')][_0x4704('0x74')]=_0x195ffc[_0x4704('0x74')];_0x195ffc[_0x4704('0x26')][_0x4704('0x75')]=_0x195ffc[_0x4704('0x74')];_0x195ffc['message'][_0x4704('0x76')]=_0x4704('0x77');return respondWithRpcPromise(_0x4704('0x78'),'EventManager',{'event':'acceptmessage','message':_0x195ffc[_0x4704('0x26')]},client9002)[_0x4704('0x1e')](function(){return _0x195ffc;});}return _0x195ffc;}return null;})[_0x4704('0x1e')](respondWithResult(_0x31debd,null))['catch'](handleError(_0x31debd,null));};var interaction_log=require(_0x4704('0x12'))(_0x4704('0x57'));exports['reject']=function(_0x51bfda,_0x125027,_0x305545){var _0x307349={'agent':{},'channel':_0x4704('0x58')};if(_0x51bfda[_0x4704('0x53')]['id']){delete _0x51bfda[_0x4704('0x53')]['id'];}_0x51bfda['body'][_0x4704('0x5d')]=_0x51bfda[_0x4704('0x53')]['UserId']||_0x51bfda[_0x4704('0x5e')]['id'];_0x307349[_0x4704('0x5f')]['id']=_0x51bfda[_0x4704('0x53')][_0x4704('0x5d')];return db[_0x4704('0x3a')][_0x4704('0x54')]({'where':{'id':_0x51bfda[_0x4704('0x55')]['id'],'UserId':null}})[_0x4704('0x1e')](handleEntityNotFound(_0x125027,null))['then'](function(_0x5ac92d){if(_0x5ac92d){_0x307349[_0x4704('0x26')]=_0x5ac92d[_0x4704('0x60')]({'plain':!![]});return db[_0x4704('0x61')][_0x4704('0x54')]({'where':{'id':_0x5ac92d[_0x4704('0x62')]}});}return null;})[_0x4704('0x1e')](handleEntityNotFound(_0x125027,null))[_0x4704('0x1e')](function(_0x4898df){if(_0x4898df){_0x307349[_0x4704('0x63')]=_0x4898df[_0x4704('0x60')]({'plain':!![]});interaction_log[_0x4704('0x1f')](_0x4704('0x79'),_0x51bfda[_0x4704('0x5e')]['id'],_0x51bfda[_0x4704('0x5e')]['name'],_0x51bfda[_0x4704('0x5e')]['role'],_0x307349['interaction']['id'],_0x51bfda[_0x4704('0x53')]?JSON[_0x4704('0x23')](_0x51bfda[_0x4704('0x53')]):_0x4704('0x65'));return respondWithRpcPromise(_0x4704('0x7a'),_0x4704('0x7b'),_0x307349);}return null;})[_0x4704('0x1e')](function(_0x4aa378){var _0x1b3224='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4aa378['message'][_0x4704('0x68')];return db[_0x4704('0x69')][_0x4704('0x3f')](_0x1b3224,{'type':db['Sequelize'][_0x4704('0x6b')][_0x4704('0x6c')],'raw':!![]})[_0x4704('0x1e')](function(_0x62cba9){return _0x62cba9;});})[_0x4704('0x1e')](function(_0x395684){if(_0x395684){_0x307349['message']['contact']=_0x395684[0x0];if(!_0x51bfda[_0x4704('0x53')][_0x4704('0x5d')])return;return db[_0x4704('0x6d')]['find']({'where':{'id':_0x51bfda[_0x4704('0x53')][_0x4704('0x5d')],'role':_0x4704('0x5f')},'attributes':['id','name',_0x4704('0x6e'),_0x4704('0x6f'),_0x4704('0x70')],'raw':!![]});}return null;})['then'](function(_0x49dcb3){if(!_0x49dcb3)return null;_0x307349[_0x4704('0x26')][_0x4704('0x5f')]=_0x49dcb3;return _0x307349;})[_0x4704('0x1e')](function(_0x5ac64c){if(_0x5ac64c){_0x5ac64c[_0x4704('0x26')][_0x4704('0x72')]=util[_0x4704('0x5b')]('SIP/%s',_0x51bfda['user'][_0x4704('0x37')]);_0x5ac64c[_0x4704('0x26')][_0x4704('0x74')]=_0x307349[_0x4704('0x74')];_0x5ac64c[_0x4704('0x26')][_0x4704('0x75')]=_0x307349[_0x4704('0x74')];_0x5ac64c[_0x4704('0x26')][_0x4704('0x76')]=_0x4704('0x31');respondWithRpcPromise(_0x4704('0x78'),_0x4704('0x78'),{'event':_0x4704('0x7c'),'message':_0x5ac64c[_0x4704('0x26')]},client9002);return _0x307349;}return null;})[_0x4704('0x1e')](respondWithResult(_0x125027,null))[_0x4704('0x28')](handleError(_0x125027,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 96d1494..be87771 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 _0xec31=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x4b6feb,_0x158c73){var _0x749123=function(_0x1ba59f){while(--_0x1ba59f){_0x4b6feb['push'](_0x4b6feb['shift']());}};_0x749123(++_0x158c73);}(_0xec31,0xa7));var _0x1ec3=function(_0x480a4a,_0x56eabb){_0x480a4a=_0x480a4a-0x0;var _0x34a858=_0xec31[_0x480a4a];return _0x34a858;};'use strict';var EventEmitter=require(_0x1ec3('0x0'));var OpenchannelMessage=require(_0x1ec3('0x1'))['db'][_0x1ec3('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1ec3('0x3')](0x0);var events={'afterCreate':_0x1ec3('0x4'),'afterUpdate':_0x1ec3('0x5'),'afterDestroy':_0x1ec3('0x6')};function emitEvent(_0x25873f){return function(_0x3c5cfc,_0x18def6,_0xc612e){OpenchannelMessageEvents['emit'](_0x25873f+':'+_0x3c5cfc['id'],_0x3c5cfc);OpenchannelMessageEvents[_0x1ec3('0x7')](_0x25873f,_0x3c5cfc);_0xc612e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x1ec3('0x8')](e,emitEvent(event));}}module[_0x1ec3('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x4e5c=['update','emit','hasOwnProperty','hook','events','setMaxListeners','save'];(function(_0x3778d6,_0x2e4fd0){var _0x30c1cd=function(_0x1ab516){while(--_0x1ab516){_0x3778d6['push'](_0x3778d6['shift']());}};_0x30c1cd(++_0x2e4fd0);}(_0x4e5c,0x170));var _0xc4e5=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x4e5c[_0x2235bf];return _0x4c3a64;};'use strict';var EventEmitter=require(_0xc4e5('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc4e5('0x1')](0x0);var events={'afterCreate':_0xc4e5('0x2'),'afterUpdate':_0xc4e5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3f83fb){return function(_0x53b1db,_0x5adbf8,_0x514ca6){OpenchannelMessageEvents[_0xc4e5('0x4')](_0x3f83fb+':'+_0x53b1db['id'],_0x53b1db);OpenchannelMessageEvents[_0xc4e5('0x4')](_0x3f83fb,_0x53b1db);_0x514ca6(null);};}for(var e in events){if(events[_0xc4e5('0x5')](e)){var event=events[e];OpenchannelMessage[_0xc4e5('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 451a055..8f767f2 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 _0x3806=['threadId','update','finally','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelMessage.attributes','exports','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','OpenchannelInteraction','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s'];(function(_0x1daa7a,_0x4ec4bd){var _0x1e4da3=function(_0x5cc820){while(--_0x5cc820){_0x1daa7a['push'](_0x1daa7a['shift']());}};_0x1e4da3(++_0x4ec4bd);}(_0x3806,0x14c));var _0x6380=function(_0x2d4276,_0x544dc1){_0x2d4276=_0x2d4276-0x0;var _0x21f410=_0x3806[_0x2d4276];return _0x21f410;};'use strict';var _=require(_0x6380('0x0'));var util=require('util');var logger=require(_0x6380('0x1'))(_0x6380('0x2'));var moment=require(_0x6380('0x3'));var BPromise=require('bluebird');var rp=require(_0x6380('0x4'));var fs=require('fs');var path=require(_0x6380('0x5'));var rimraf=require(_0x6380('0x6'));var config=require('../../config/environment');var attributes=require(_0x6380('0x7'));module[_0x6380('0x8')]=function(_0x1cd994,_0x227bff){return _0x1cd994['define'](_0x6380('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x6380('0xa'),'fields':[_0x6380('0xb')],'type':_0x6380('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b52ce,_0x23fba8,_0x255966){var _0xe3f714=_0x1cd994[_0x6380('0xd')];var _0x98ece1=_0x5b52ce[_0x6380('0xe')]({'plain':!![]});if(_0x98ece1['direction'][_0x6380('0xf')]()==='in'||_0x98ece1[_0x6380('0x10')][_0x6380('0xf')]()===_0x6380('0x11')&&!_0x98ece1[_0x6380('0x12')]&&!_['isNil'](_0x98ece1['UserId'])){_0xe3f714[_0x6380('0x13')][_0x6380('0x14')]({'where':{'id':_0x98ece1[_0x6380('0x15')]}})['then'](function(_0xef514a){if(_0xef514a){_0xef514a['update']({'lastMsgAt':_0x98ece1[_0x6380('0x16')],'lastMsgDirection':_0x98ece1[_0x6380('0x10')][_0x6380('0xf')]()});}})[_0x6380('0x17')](function(_0x4c41b3){console[_0x6380('0x18')](_0x4c41b3);});}if(_0x98ece1[_0x6380('0x10')]==='out'&&!_0x98ece1[_0x6380('0x12')]){var _0x3844e6;_0xe3f714[_0x6380('0x19')][_0x6380('0x1a')]()[_0x6380('0x1b')](function(_0x1a4d0f){return _0xe3f714[_0x6380('0x1c')]['find']({'where':{'id':_0x98ece1['OpenchannelAccountId']},'include':[{'model':_0xe3f714[_0x6380('0x13')],'as':_0x6380('0x1d'),'where':{'id':_0x98ece1[_0x6380('0x15')]},'limit':0x1,'include':[{'model':_0xe3f714['CmContact'],'as':_0x6380('0x1e'),'attributes':_[_0x6380('0x1f')](_0x1a4d0f)}]}]});})['then'](function(_0x4af10f){_0x3844e6=_0x4af10f[_0x6380('0xe')]({'plain':!![]});if(_0x3844e6&&_0x3844e6[_0x6380('0x20')]){logger[_0x6380('0x21')](_0x6380('0x22'),'afterCreate',util[_0x6380('0x23')](_0x6380('0x24'),_0x98ece1['id'],_0x3844e6[_0x6380('0x20')]));if(_0x3844e6[_0x6380('0x1d')]&&_0x3844e6[_0x6380('0x1d')][_0x6380('0x25')]){_0x98ece1[_0x6380('0x26')]=_[_0x6380('0x27')](_0x3844e6[_0x6380('0x1d')][0x0],_0x6380('0x1e'));_0x98ece1[_0x6380('0x1e')]=_0x3844e6[_0x6380('0x1d')][0x0][_0x6380('0x1e')];}var _0x23fba8={'method':_0x6380('0x28'),'uri':encodeURI(_0x3844e6['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x23fba8[_0x6380('0x29')]){case'GET':_0x23fba8['qs']=_0x98ece1;break;case'POST':_0x23fba8['body']=_0x98ece1;break;}return rp(_0x23fba8)[_0x6380('0x1b')](function(_0x335f5b){logger[_0x6380('0x21')](_0x6380('0x22'),_0x6380('0x2a'),util[_0x6380('0x23')](_0x6380('0x2b'),_0x98ece1['id'],_0x3844e6[_0x6380('0x20')]));if(_0x335f5b[_0x6380('0xb')]['threadId']&&_0x335f5b[_0x6380('0xb')][_0x6380('0x2c')]!=_0x98ece1[_0x6380('0x26')][_0x6380('0x2c')]){return _0xe3f714[_0x6380('0x13')][_0x6380('0x2d')]({'threadId':_0x335f5b[_0x6380('0xb')][_0x6380('0x2c')]},{'where':{'id':_0x98ece1[_0x6380('0x26')]['id']}});}else{return;}})['then'](function(){return _0x5b52ce['update']({'read':!![]});})[_0x6380('0x17')](function(_0xdb7199){logger[_0x6380('0x18')](_0x6380('0x22'),'afterCreate',util['inspect'](_0xdb7199,{'showHidden':![],'depth':null}));_0x255966();});}else{_0x255966();}})[_0x6380('0x2e')](function(){_0x255966();});}else{_0x255966();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa692=['rimraf','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','createdAt','catch','error','out','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x1e6737,_0x3a00b9){var _0x13209b=function(_0x161523){while(--_0x161523){_0x1e6737['push'](_0x1e6737['shift']());}};_0x13209b(++_0x3a00b9);}(_0xa692,0x1ee));var _0x2a69=function(_0x28e71a,_0x4405bd){_0x28e71a=_0x28e71a-0x0;var _0x268fed=_0xa692[_0x28e71a];return _0x268fed;};'use strict';var _=require(_0x2a69('0x0'));var util=require(_0x2a69('0x1'));var logger=require(_0x2a69('0x2'))(_0x2a69('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2a69('0x4'));var fs=require('fs');var path=require(_0x2a69('0x5'));var rimraf=require(_0x2a69('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a69('0x7'));module[_0x2a69('0x8')]=function(_0x1da0d4,_0x33f129){return _0x1da0d4[_0x2a69('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x2a69('0xa'),'fields':[_0x2a69('0xb')],'type':_0x2a69('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1abe45,_0x298a2c,_0x4855b4){var _0x203d81=_0x1da0d4[_0x2a69('0xd')];var _0x24e348=_0x1abe45[_0x2a69('0xe')]({'plain':!![]});if(_0x24e348[_0x2a69('0xf')]['toLowerCase']()==='in'||_0x24e348[_0x2a69('0xf')][_0x2a69('0x10')]()==='out'&&!_0x24e348[_0x2a69('0x11')]&&!_[_0x2a69('0x12')](_0x24e348[_0x2a69('0x13')])){_0x203d81['OpenchannelInteraction'][_0x2a69('0x14')]({'where':{'id':_0x24e348[_0x2a69('0x15')]}})[_0x2a69('0x16')](function(_0x59974c){if(_0x59974c){_0x59974c['update']({'lastMsgAt':_0x24e348[_0x2a69('0x17')],'lastMsgDirection':_0x24e348[_0x2a69('0xf')][_0x2a69('0x10')]()});}})[_0x2a69('0x18')](function(_0x136d72){console[_0x2a69('0x19')](_0x136d72);});}if(_0x24e348['direction']===_0x2a69('0x1a')&&!_0x24e348[_0x2a69('0x11')]){var _0x81f61b;_0x203d81[_0x2a69('0x1b')]['describe']()[_0x2a69('0x16')](function(_0x4218fb){return _0x203d81[_0x2a69('0x1c')][_0x2a69('0x1d')]({'where':{'id':_0x24e348[_0x2a69('0x1e')]},'include':[{'model':_0x203d81['OpenchannelInteraction'],'as':_0x2a69('0x1f'),'where':{'id':_0x24e348[_0x2a69('0x15')]},'limit':0x1,'include':[{'model':_0x203d81[_0x2a69('0x1b')],'as':_0x2a69('0x20'),'attributes':_['keys'](_0x4218fb)}]}]});})['then'](function(_0x5d73ec){_0x81f61b=_0x5d73ec[_0x2a69('0xe')]({'plain':!![]});if(_0x81f61b&&_0x81f61b[_0x2a69('0x21')]){logger[_0x2a69('0x22')](_0x2a69('0x23'),_0x2a69('0x24'),util['format'](_0x2a69('0x25'),_0x24e348['id'],_0x81f61b[_0x2a69('0x21')]));if(_0x81f61b[_0x2a69('0x1f')]&&_0x81f61b['Interactions'][_0x2a69('0x26')]){_0x24e348[_0x2a69('0x27')]=_[_0x2a69('0x28')](_0x81f61b[_0x2a69('0x1f')][0x0],_0x2a69('0x20'));_0x24e348[_0x2a69('0x20')]=_0x81f61b[_0x2a69('0x1f')][0x0]['Contact'];}var _0x298a2c={'method':_0x2a69('0x29'),'uri':encodeURI(_0x81f61b['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x298a2c[_0x2a69('0x2a')]){case'GET':_0x298a2c['qs']=_0x24e348;break;case _0x2a69('0x29'):_0x298a2c[_0x2a69('0xb')]=_0x24e348;break;}return rp(_0x298a2c)[_0x2a69('0x16')](function(_0x5510fc){logger[_0x2a69('0x22')](_0x2a69('0x23'),_0x2a69('0x24'),util[_0x2a69('0x2b')](_0x2a69('0x2c'),_0x24e348['id'],_0x81f61b[_0x2a69('0x21')]));if(_0x5510fc[_0x2a69('0xb')][_0x2a69('0x2d')]&&_0x5510fc['body'][_0x2a69('0x2d')]!=_0x24e348['Interaction'][_0x2a69('0x2d')]){return _0x203d81['OpenchannelInteraction'][_0x2a69('0x2e')]({'threadId':_0x5510fc[_0x2a69('0xb')][_0x2a69('0x2d')]},{'where':{'id':_0x24e348[_0x2a69('0x27')]['id']}});}else{return;}})['then'](function(){return _0x1abe45[_0x2a69('0x2e')]({'read':!![]});})[_0x2a69('0x18')](function(_0x49e2b2){logger['error'](_0x2a69('0x23'),_0x2a69('0x24'),util[_0x2a69('0x2f')](_0x49e2b2,{'showHidden':![],'depth':null}));_0x4855b4();});}else{_0x4855b4();}})['finally'](function(){_0x4855b4();});}else{_0x4855b4();}}},'charset':_0x2a69('0x30'),'collate':_0x2a69('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ac9e7ee..2f0b2aa 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x22754d,_0x3ffa6b){var _0x4e2724=function(_0x3e4691){while(--_0x3e4691){_0x22754d['push'](_0x22754d['shift']());}};_0x4e2724(++_0x3ffa6b);}(_0xdb28,0x106));var _0x8db2=function(_0x14aafa,_0x1a5995){_0x14aafa=_0x14aafa-0x0;var _0x27ce00=_0xdb28[_0x14aafa];return _0x27ce00;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x16f365,_0x117a19){var _0x9eddc8=function(_0x37e200){while(--_0x37e200){_0x16f365['push'](_0x16f365['shift']());}};_0x9eddc8(++_0x117a19);}(_0xadb5,0xad));var _0x5adb=function(_0x3a9c9f,_0x1488b3){_0x3a9c9f=_0x3a9c9f-0x0;var _0x52dd4c=_0xadb5[_0x3a9c9f];return _0x52dd4c;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6623c6a..b5035b6 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 _0xfa3a=['removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit'];(function(_0x1b2db8,_0x337cbf){var _0x5c24f3=function(_0x31b304){while(--_0x31b304){_0x1b2db8['push'](_0x1b2db8['shift']());}};_0x5c24f3(++_0x337cbf);}(_0xfa3a,0xa6));var _0xafa3=function(_0x4a7874,_0x5464ed){_0x4a7874=_0x4a7874-0x0;var _0x336b94=_0xfa3a[_0x4a7874];return _0x336b94;};'use strict';var OpenchannelMessageEvents=require(_0xafa3('0x0'));var events=[_0xafa3('0x1'),_0xafa3('0x2'),_0xafa3('0x3')];function createListener(_0xf3d662,_0x2b6d94){return function(_0x36a15b){_0x2b6d94[_0xafa3('0x4')](_0xf3d662,_0x36a15b);};}function removeListener(_0x49410f,_0x29b287){return function(){OpenchannelMessageEvents[_0xafa3('0x5')](_0x49410f,_0x29b287);};}exports[_0xafa3('0x6')]=function(_0x1e3b62){for(var _0x21e8f9=0x0,_0x1cc2fd=events[_0xafa3('0x7')];_0x21e8f9<_0x1cc2fd;_0x21e8f9++){var _0x5297a6=events[_0x21e8f9];var _0x22f539=createListener(_0xafa3('0x8')+_0x5297a6,_0x1e3b62);OpenchannelMessageEvents['on'](_0x5297a6,_0x22f539);}}; \ No newline at end of file +var _0x1396=['removeListener','register','length','openchannelMessage:','./openchannelMessage.events','remove'];(function(_0x4160ff,_0x3d6483){var _0x402af5=function(_0x245afa){while(--_0x245afa){_0x4160ff['push'](_0x4160ff['shift']());}};_0x402af5(++_0x3d6483);}(_0x1396,0x1ea));var _0x6139=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0x1396[_0x74745d];return _0x174ab3;};'use strict';var OpenchannelMessageEvents=require(_0x6139('0x0'));var events=['save',_0x6139('0x1'),'update'];function createListener(_0x56c0d8,_0xc1512c){return function(_0x15153d){_0xc1512c['emit'](_0x56c0d8,_0x15153d);};}function removeListener(_0x409054,_0x55c7d4){return function(){OpenchannelMessageEvents[_0x6139('0x2')](_0x409054,_0x55c7d4);};}exports[_0x6139('0x3')]=function(_0x5fe8f0){for(var _0x9e7835=0x0,_0x453449=events[_0x6139('0x4')];_0x9e7835<_0x453449;_0x9e7835++){var _0x32f7e9=events[_0x9e7835];var _0x488fba=createListener(_0x6139('0x5')+_0x32f7e9,_0x5fe8f0);OpenchannelMessageEvents['on'](_0x32f7e9,_0x488fba);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 82d9ae0..14e392b 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 _0x0484=['show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2b6249,_0x5f5345){var _0x28cd3c=function(_0x65fd75){while(--_0x65fd75){_0x2b6249['push'](_0x2b6249['shift']());}};_0x28cd3c(++_0x5f5345);}(_0x0484,0x190));var _0x4048=function(_0x3a2082,_0x579236){_0x3a2082=_0x3a2082-0x0;var _0x55beaa=_0x0484[_0x3a2082];return _0x55beaa;};'use strict';var multer=require(_0x4048('0x0'));var util=require(_0x4048('0x1'));var path=require(_0x4048('0x2'));var timeout=require(_0x4048('0x3'));var express=require(_0x4048('0x4'));var router=express['Router']();var fs_extra=require(_0x4048('0x5'));var auth=require(_0x4048('0x6'));var interaction=require(_0x4048('0x7'));var config=require(_0x4048('0x8'));var controller=require(_0x4048('0x9'));router[_0x4048('0xa')]('/',auth[_0x4048('0xb')](),controller[_0x4048('0xc')]);router[_0x4048('0xa')](_0x4048('0xd'),auth[_0x4048('0xb')](),controller[_0x4048('0xe')]);router['get'](_0x4048('0xf'),auth[_0x4048('0xb')](),controller[_0x4048('0x10')]);router[_0x4048('0xa')](_0x4048('0x11'),auth[_0x4048('0xb')](),controller[_0x4048('0x12')]);router[_0x4048('0xa')]('/:id/teams',auth[_0x4048('0xb')](),controller[_0x4048('0x13')]);router[_0x4048('0xa')](_0x4048('0x14'),auth['isAuthenticated'](),controller[_0x4048('0x15')]);router['post']('/',auth[_0x4048('0xb')](),controller['create']);router[_0x4048('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4048('0x17')]);router[_0x4048('0x16')](_0x4048('0x14'),auth[_0x4048('0xb')](),controller[_0x4048('0x18')]);router[_0x4048('0x19')](_0x4048('0xf'),auth['isAuthenticated'](),controller[_0x4048('0x1a')]);router[_0x4048('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x4048('0x1c')]);router[_0x4048('0x1b')](_0x4048('0x1d'),auth['isAuthenticated'](),controller[_0x4048('0x1e')]);router[_0x4048('0x1b')](_0x4048('0x14'),auth[_0x4048('0xb')](),controller[_0x4048('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x86ca=['post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','express','Router','fs-extra','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create'];(function(_0x2880ab,_0x37fc24){var _0x50792b=function(_0x991a93){while(--_0x991a93){_0x2880ab['push'](_0x2880ab['shift']());}};_0x50792b(++_0x37fc24);}(_0x86ca,0xd9));var _0xa86c=function(_0x386e9c,_0x1d508c){_0x386e9c=_0x386e9c-0x0;var _0x13d254=_0x86ca[_0x386e9c];return _0x13d254;};'use strict';var multer=require(_0xa86c('0x0'));var util=require('util');var path=require(_0xa86c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa86c('0x2'));var router=express[_0xa86c('0x3')]();var fs_extra=require(_0xa86c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0xa86c('0x5')]('/',auth[_0xa86c('0x6')](),controller[_0xa86c('0x7')]);router[_0xa86c('0x5')](_0xa86c('0x8'),auth[_0xa86c('0x6')](),controller['describe']);router[_0xa86c('0x5')](_0xa86c('0x9'),auth[_0xa86c('0x6')](),controller[_0xa86c('0xa')]);router[_0xa86c('0x5')](_0xa86c('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xa86c('0x5')](_0xa86c('0xc'),auth[_0xa86c('0x6')](),controller[_0xa86c('0xd')]);router[_0xa86c('0x5')](_0xa86c('0xe'),auth['isAuthenticated'](),controller[_0xa86c('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa86c('0x10')]);router[_0xa86c('0x11')](_0xa86c('0xc'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa86c('0x11')](_0xa86c('0xe'),auth[_0xa86c('0x6')](),controller[_0xa86c('0x12')]);router[_0xa86c('0x13')](_0xa86c('0x9'),auth[_0xa86c('0x6')](),controller[_0xa86c('0x14')]);router['delete'](_0xa86c('0x9'),auth[_0xa86c('0x6')](),controller[_0xa86c('0x15')]);router[_0xa86c('0x16')](_0xa86c('0xc'),auth[_0xa86c('0x6')](),controller[_0xa86c('0x17')]);router[_0xa86c('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xa86c('0x18')]);module[_0xa86c('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index d55012d..aa28b04 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 _0x35b1=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x32bbb1,_0xa0e27e){var _0x42b415=function(_0x23f4e2){while(--_0x23f4e2){_0x32bbb1['push'](_0x32bbb1['shift']());}};_0x42b415(++_0xa0e27e);}(_0x35b1,0x1ba));var _0x135b=function(_0x324645,_0xdc9c60){_0x324645=_0x324645-0x0;var _0x518909=_0x35b1[_0x324645];return _0x518909;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x135b('0x0')],'unique':_0x135b('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x135b('0x0')]},'timeout':{'type':Sequelize[_0x135b('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x135b('0x3')](_0x135b('0x4'),_0x135b('0x5'),_0x135b('0x6'))}}; \ No newline at end of file +var _0xb601=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x10a540,_0xfaa1bd){var _0xb724c4=function(_0x1ad592){while(--_0x1ad592){_0x10a540['push'](_0x10a540['shift']());}};_0xb724c4(++_0xfaa1bd);}(_0xb601,0xac));var _0x1b60=function(_0x394c4c,_0x201031){_0x394c4c=_0x394c4c-0x0;var _0x5bfa5a=_0xb601[_0x394c4c];return _0x5bfa5a;};'use strict';var Sequelize=require(_0x1b60('0x0'));module[_0x1b60('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1b60('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b60('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b60('0x4')](_0x1b60('0x5'),_0x1b60('0x6'),_0x1b60('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 2b76e05..7c699cc 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 _0x09fd=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','length','hasOwnProperty','nolimit','order','sort','pick','OpenchannelQueueId','map','User','UserId','agent','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','keys','filter','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','UserOpenchannelQueue','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','includes','union','compact','value','removeAgents','forEach','addAgents','spread','isArray','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','update','then','get','UserProfileResource','destroy','sendStatus','stack','name','send','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','show','filters','attributes','intersection','model','fields','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x4ecffb,_0x69b339){var _0x1f9bdb=function(_0x269c8b){while(--_0x269c8b){_0x4ecffb['push'](_0x4ecffb['shift']());}};_0x1f9bdb(++_0x69b339);}(_0x09fd,0xb6));var _0xd09f=function(_0x156489,_0x2bbaf2){_0x156489=_0x156489-0x0;var _0x4d2814=_0x09fd[_0x156489];return _0x4d2814;};'use strict';var BPromise=require(_0xd09f('0x0'));var util=require(_0xd09f('0x1'));var _=require(_0xd09f('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xd09f('0x3'))(_0xd09f('0x4'));var config=require(_0xd09f('0x5'));var db=require(_0xd09f('0x6'))['db'];config[_0xd09f('0x7')]=_[_0xd09f('0x8')](config[_0xd09f('0x7')],{'host':_0xd09f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd09f('0x7')]));require(_0xd09f('0xa'))[_0xd09f('0xb')](socket);function respondWithStatusCode(_0x1ad371,_0x1733e9){_0x1733e9=_0x1733e9||0xcc;return function(_0x16fc0a){if(_0x16fc0a){return _0x1ad371['sendStatus'](_0x1733e9);}return _0x1ad371[_0xd09f('0xc')](_0x1733e9)[_0xd09f('0xd')]();};}function respondWithResult(_0x4646b2,_0x2ec105){_0x2ec105=_0x2ec105||0xc8;return function(_0x3d4cf5){if(_0x3d4cf5){return _0x4646b2[_0xd09f('0xc')](_0x2ec105)[_0xd09f('0xe')](_0x3d4cf5);}};}function respondWithFilteredResult(_0x41e3ee,_0x57a559){return function(_0x14d62d){if(_0x14d62d){var _0x2a5656=typeof _0x57a559[_0xd09f('0xf')]===_0xd09f('0x10')&&typeof _0x57a559[_0xd09f('0x11')]===_0xd09f('0x10');var _0x2f0a71=_0x14d62d['count'];var _0x1ce63b=_0x2a5656?0x0:_0x57a559[_0xd09f('0xf')];var _0x4c5fda=_0x2a5656?_0x14d62d[_0xd09f('0x12')]:_0x57a559[_0xd09f('0xf')]+_0x57a559[_0xd09f('0x11')];var _0x435ef9;if(_0x4c5fda>=_0x2f0a71){_0x4c5fda=_0x2f0a71;_0x435ef9=0xc8;}else{_0x435ef9=0xce;}_0x41e3ee['status'](_0x435ef9);return _0x41e3ee[_0xd09f('0x13')]('Content-Range',_0x1ce63b+'-'+_0x4c5fda+'/'+_0x2f0a71)['json'](_0x14d62d);}return null;};}function saveUpdates(_0x525b25){return function(_0x3b5a54){if(_0x3b5a54){return _0x3b5a54[_0xd09f('0x14')](_0x525b25)[_0xd09f('0x15')](function(_0x35dcbb){return _0x35dcbb;});}return null;};}function removeEntity(_0x30feb2){return function(_0x10e887){if(_0x10e887){return _0x10e887['destroy']()[_0xd09f('0x15')](function(){var _0x54c6e9=_0x10e887[_0xd09f('0x16')]({'plain':!![]});var _0x466bee='OpenchannelQueues';return db[_0xd09f('0x17')][_0xd09f('0x18')]({'where':{'type':_0x466bee,'resourceId':_0x54c6e9['id']}})[_0xd09f('0x15')](function(){return _0x10e887;});})['then'](function(){_0x30feb2[_0xd09f('0xc')](0xcc)[_0xd09f('0xd')]();});}};}function handleEntityNotFound(_0x3e84f3){return function(_0x15bee0){if(!_0x15bee0){_0x3e84f3[_0xd09f('0x19')](0x194);}return _0x15bee0;};}function handleError(_0x1838d5,_0x32286e){_0x32286e=_0x32286e||0x1f4;return function(_0x4014b1){logger['error'](_0x4014b1[_0xd09f('0x1a')]);if(_0x4014b1[_0xd09f('0x1b')]){delete _0x4014b1['name'];}_0x1838d5[_0xd09f('0xc')](_0x32286e)[_0xd09f('0x1c')](_0x4014b1);};}exports['index']=function(_0x5279ff,_0x5db15e){var _0x5c529e={};var _0x400ac6={'count':0x0,'rows':[]};var _0x20e4ef=_['map'](db[_0xd09f('0x1d')][_0xd09f('0x1e')],function(_0x95f7fe){return{'name':_0x95f7fe[_0xd09f('0x1f')],'type':_0x95f7fe[_0xd09f('0x20')][_0xd09f('0x21')]};});_0x5c529e=qs[_0xd09f('0x22')](_0x20e4ef,_0x5279ff);var _0xd3f5bd={'where':_0x5c529e[_0xd09f('0x23')]};return db[_0xd09f('0x1d')][_0xd09f('0x12')](_0xd3f5bd)[_0xd09f('0x15')](function(_0x203095){_0x400ac6[_0xd09f('0x12')]=_0x203095;_0x5c529e[_0xd09f('0x24')]=qs[_0xd09f('0x24')](_0x5279ff[_0xd09f('0x25')]);return db[_0xd09f('0x1d')][_0xd09f('0x26')](_0x5c529e);})['then'](function(_0x12b9b3){_0x400ac6['rows']=_0x12b9b3;return _0x400ac6;})[_0xd09f('0x15')](respondWithFilteredResult(_0x5db15e,_0x5c529e))['catch'](handleError(_0x5db15e,null));};exports[_0xd09f('0x27')]=function(_0xba8055,_0x4909ff){var _0x4e055c={'raw':!![],'where':{'id':_0xba8055['params']['id']}},_0x1226f1={};_0x1226f1['model']=_['keys'](db[_0xd09f('0x1d')][_0xd09f('0x1e')]);_0x1226f1[_0xd09f('0x25')]=_['keys'](_0xba8055[_0xd09f('0x25')]);_0x1226f1[_0xd09f('0x28')]=_['intersection'](_0x1226f1['model'],_0x1226f1[_0xd09f('0x25')]);_0x4e055c[_0xd09f('0x29')]=_[_0xd09f('0x2a')](_0x1226f1[_0xd09f('0x2b')],qs[_0xd09f('0x2c')](_0xba8055[_0xd09f('0x25')][_0xd09f('0x2c')]));_0x4e055c['attributes']=_0x4e055c[_0xd09f('0x29')]['length']?_0x4e055c[_0xd09f('0x29')]:_0x1226f1[_0xd09f('0x2b')];if(_0xba8055[_0xd09f('0x25')]['includeAll']){_0x4e055c[_0xd09f('0x24')]=[{'all':!![]}];}_0x4e055c=_[_0xd09f('0x2d')]({},_0x4e055c,_0xba8055[_0xd09f('0x2e')]);return db[_0xd09f('0x1d')][_0xd09f('0x2f')](_0x4e055c)[_0xd09f('0x15')](handleEntityNotFound(_0x4909ff,null))[_0xd09f('0x15')](respondWithResult(_0x4909ff,null))[_0xd09f('0x30')](handleError(_0x4909ff,null));};exports['create']=function(_0x5db341,_0xe7f0a6){return db['OpenchannelQueue'][_0xd09f('0x31')](_0x5db341[_0xd09f('0x32')],{})[_0xd09f('0x15')](function(_0xccea26){var _0x45b4bd=_0x5db341[_0xd09f('0x33')][_0xd09f('0x16')]({'plain':!![]});if(!_0x45b4bd)throw new Error(_0xd09f('0x34'));if(_0x45b4bd[_0xd09f('0x35')]===_0xd09f('0x33')){var _0x220657=_0xccea26[_0xd09f('0x16')]({'plain':!![]});var _0x370aed='OpenchannelQueues';return db[_0xd09f('0x36')][_0xd09f('0x2f')]({'where':{'name':_0x370aed,'userProfileId':_0x45b4bd[_0xd09f('0x37')]},'raw':!![]})[_0xd09f('0x15')](function(_0x5a264e){if(_0x5a264e&&_0x5a264e['autoAssociation']===0x0){return db['UserProfileResource'][_0xd09f('0x31')]({'name':_0x220657[_0xd09f('0x1b')],'resourceId':_0x220657['id'],'type':_0x5a264e[_0xd09f('0x1b')],'sectionId':_0x5a264e['id']},{})[_0xd09f('0x15')](function(){return _0xccea26;});}else{return _0xccea26;}})[_0xd09f('0x30')](function(_0x394bac){logger[_0xd09f('0x38')](_0xd09f('0x39'),_0x394bac);throw _0x394bac;});}return _0xccea26;})[_0xd09f('0x15')](respondWithResult(_0xe7f0a6,0xc9))[_0xd09f('0x30')](handleError(_0xe7f0a6,null));};exports[_0xd09f('0x14')]=function(_0x2e5381,_0x86813e){if(_0x2e5381[_0xd09f('0x32')]['id']){delete _0x2e5381[_0xd09f('0x32')]['id'];}return db[_0xd09f('0x1d')]['find']({'where':{'id':_0x2e5381[_0xd09f('0x3a')]['id']}})[_0xd09f('0x15')](handleEntityNotFound(_0x86813e,null))['then'](saveUpdates(_0x2e5381['body'],null))[_0xd09f('0x15')](respondWithResult(_0x86813e,null))[_0xd09f('0x30')](handleError(_0x86813e,null));};exports[_0xd09f('0x18')]=function(_0x40fd6b,_0x11f5fb){return db[_0xd09f('0x1d')][_0xd09f('0x2f')]({'where':{'id':_0x40fd6b['params']['id']}})[_0xd09f('0x15')](handleEntityNotFound(_0x11f5fb,null))[_0xd09f('0x15')](removeEntity(_0x11f5fb,null))[_0xd09f('0x30')](handleError(_0x11f5fb,null));};exports['describe']=function(_0x776d5d,_0x484dbb){return db[_0xd09f('0x1d')]['describe']()['then'](respondWithResult(_0x484dbb,null))[_0xd09f('0x30')](handleError(_0x484dbb,null));};exports[_0xd09f('0x3b')]=function(_0x4c3955,_0x51c25a){var _0x15764b={'raw':!![],'where':{}},_0x4d5f38={},_0x517455;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x4c3955[_0xd09f('0x3a')]['id']}})['then'](handleEntityNotFound(_0x51c25a,null))[_0xd09f('0x15')](function(_0x3a4343){if(_0x3a4343){_0x517455=_0x3a4343['get']({'plain':!![]});_0x4d5f38[_0xd09f('0x2b')]=_['keys'](db['UserOpenchannelQueue'][_0xd09f('0x1e')]);_0x4d5f38[_0xd09f('0x25')]=_['keys'](_0x4c3955[_0xd09f('0x25')]);_0x4d5f38['filters']=_[_0xd09f('0x2a')](_0x4d5f38[_0xd09f('0x2b')],_0x4d5f38[_0xd09f('0x25')]);_0x15764b['attributes']=_[_0xd09f('0x2a')](_0x4d5f38[_0xd09f('0x2b')],qs[_0xd09f('0x2c')](_0x4c3955[_0xd09f('0x25')][_0xd09f('0x2c')]));_0x15764b[_0xd09f('0x29')]=_0x15764b['attributes'][_0xd09f('0x3c')]?_0x15764b[_0xd09f('0x29')]:_0x4d5f38['model'];if(!_0x4c3955['query'][_0xd09f('0x3d')](_0xd09f('0x3e'))){_0x15764b[_0xd09f('0x11')]=qs['limit'](_0x4c3955['query'][_0xd09f('0x11')]);_0x15764b[_0xd09f('0xf')]=qs[_0xd09f('0xf')](_0x4c3955[_0xd09f('0x25')][_0xd09f('0xf')]);}_0x15764b[_0xd09f('0x3f')]=qs[_0xd09f('0x40')](_0x4c3955[_0xd09f('0x25')][_0xd09f('0x40')]);_0x15764b[_0xd09f('0x23')]=qs[_0xd09f('0x28')](_[_0xd09f('0x41')](_0x4c3955['query'],_0x4d5f38['filters']));_0x15764b[_0xd09f('0x23')][_0xd09f('0x42')]=_0x3a4343['id'];if(_0x4c3955[_0xd09f('0x25')]['filter']){_0x15764b[_0xd09f('0x23')]=_['merge'](_0x15764b['where'],{'$or':_[_0xd09f('0x43')](_0x15764b['attributes'],function(_0x30e444){var _0x36d193={};_0x36d193[_0x30e444]={'$like':'%'+_0x4c3955[_0xd09f('0x25')]['filter']+'%'};return _0x36d193;})});}_0x15764b=_[_0xd09f('0x2d')]({},_0x15764b,_0x4c3955['options']);return db['UserOpenchannelQueue'][_0xd09f('0x26')](_0x15764b);}})['then'](function(_0x4b17f4){if(_0x4b17f4){return db[_0xd09f('0x44')]['findAndCountAll']({'where':{'id':_['map'](_0x4b17f4,_0xd09f('0x45')),'role':_0xd09f('0x46')},'attributes':['id',_0xd09f('0x1b'),'openchannelPause','updatedAt',_0xd09f('0x47')]});}})[_0xd09f('0x15')](function(_0xed3b3b){if(_0xed3b3b){return{'count':_0xed3b3b[_0xd09f('0x12')],'rows':_[_0xd09f('0x43')](_0xed3b3b['rows'],function(_0x497cb0){return{'membername':_0x497cb0['name'],'UserId':_0x497cb0['id'],'queue_name':_0x517455[_0xd09f('0x1b')],'OpenchannelQueueId':_0x517455['id'],'interface':util[_0xd09f('0x48')](_0xd09f('0x49'),_0xd09f('0x4a'),_0x497cb0[_0xd09f('0x1b')]),'penalty':0x0,'paused':_0x497cb0['openchannelPause'],'createdAt':_0x497cb0[_0xd09f('0x47')],'updatedAt':_0x497cb0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd09f('0x15')](respondWithFilteredResult(_0x51c25a,_0x15764b))[_0xd09f('0x30')](handleError(_0x51c25a,null));};exports[_0xd09f('0x4b')]=function(_0x1632f9,_0x1579f1){var _0x5af4d5={};var _0x44c873={};var _0x4bb4e9;var _0x289f59;return db['OpenchannelQueue'][_0xd09f('0x4c')]({'where':{'id':_0x1632f9[_0xd09f('0x3a')]['id']}})[_0xd09f('0x15')](handleEntityNotFound(_0x1579f1,null))[_0xd09f('0x15')](function(_0x255bf5){if(_0x255bf5){_0x4bb4e9=_0x255bf5;_0x44c873[_0xd09f('0x2b')]=_['keys'](db[_0xd09f('0x4d')][_0xd09f('0x1e')]);_0x44c873['query']=_[_0xd09f('0x4e')](_0x1632f9['query']);_0x44c873[_0xd09f('0x28')]=_[_0xd09f('0x2a')](_0x44c873[_0xd09f('0x2b')],_0x44c873[_0xd09f('0x25')]);_0x5af4d5['attributes']=_[_0xd09f('0x2a')](_0x44c873['model'],qs[_0xd09f('0x2c')](_0x1632f9['query'][_0xd09f('0x2c')]));_0x5af4d5[_0xd09f('0x29')]=_0x5af4d5[_0xd09f('0x29')][_0xd09f('0x3c')]?_0x5af4d5[_0xd09f('0x29')]:_0x44c873[_0xd09f('0x2b')];_0x5af4d5[_0xd09f('0x3f')]=qs['sort'](_0x1632f9[_0xd09f('0x25')]['sort']);_0x5af4d5[_0xd09f('0x23')]=qs['filters'](_['pick'](_0x1632f9[_0xd09f('0x25')],_0x44c873[_0xd09f('0x28')]));if(_0x1632f9[_0xd09f('0x25')]['filter']){_0x5af4d5['where']=_['merge'](_0x5af4d5['where'],{'$or':_[_0xd09f('0x43')](_0x5af4d5[_0xd09f('0x29')],function(_0xe1aa53){var _0xe41cae={};_0xe41cae[_0xe1aa53]={'$like':'%'+_0x1632f9[_0xd09f('0x25')][_0xd09f('0x4f')]+'%'};return _0xe41cae;})});}_0x5af4d5=_['merge']({},_0x5af4d5,_0x1632f9['options']);return _0x4bb4e9[_0xd09f('0x4b')](_0x5af4d5);}})[_0xd09f('0x15')](function(_0x3bf37c){if(_0x3bf37c){_0x289f59=_0x3bf37c[_0xd09f('0x3c')];if(!_0x1632f9[_0xd09f('0x25')][_0xd09f('0x3d')](_0xd09f('0x3e'))){_0x5af4d5[_0xd09f('0x11')]=qs['limit'](_0x1632f9[_0xd09f('0x25')]['limit']);_0x5af4d5['offset']=qs[_0xd09f('0xf')](_0x1632f9[_0xd09f('0x25')][_0xd09f('0xf')]);}return _0x4bb4e9[_0xd09f('0x4b')](_0x5af4d5);}})['then'](function(_0x25e309){if(_0x25e309){return _0x25e309?{'count':_0x289f59,'rows':_0x25e309}:null;}})[_0xd09f('0x15')](respondWithResult(_0x1579f1,null))[_0xd09f('0x30')](handleError(_0x1579f1,null));};exports[_0xd09f('0x50')]=function(_0x5cdbae,_0x56f948){var _0x3e4c12=_0x5cdbae[_0xd09f('0x32')][_0xd09f('0x51')];return db['Team'][_0xd09f('0x26')]({'where':{'id':_0x3e4c12},'attributes':['id'],'include':[{'model':db[_0xd09f('0x44')],'as':_0xd09f('0x52'),'attributes':['id',_0xd09f('0x1b'),_0xd09f('0x53'),_0xd09f('0x54'),_0xd09f('0x55')],'raw':!![]}]})[_0xd09f('0x15')](function(_0x483017){if(_0x483017){var _0x271d14=_['flatMap'](_0x483017,function(_0x2a17aa){var _0x4b2e64=_0x2a17aa[_0xd09f('0x16')]({'plain':!![]});return _0x4b2e64[_0xd09f('0x52')];});return db[_0xd09f('0x1d')]['find']({'where':{'id':_0x5cdbae[_0xd09f('0x3a')]['id']}})['then'](function(_0xb98bc5){return db[_0xd09f('0x56')][_0xd09f('0x57')](function(_0x1d1849){return _0xb98bc5[_0xd09f('0x50')](_0x3e4c12,{'transaction':_0x1d1849})[_0xd09f('0x15')](function(){return BPromise[_0xd09f('0x58')](_0x271d14,function(_0x5477be){return db[_0xd09f('0x59')][_0xd09f('0x5a')]({'where':{'UserId':_0x5477be['id'],'OpenchannelQueueId':_0x5cdbae[_0xd09f('0x3a')]['id']},'transaction':_0x1d1849});});})['then'](function(){_0x271d14['forEach'](function(_0x4e3db4){socket[_0xd09f('0x5b')](_0xd09f('0x5c'),{'UserId':_0x4e3db4['id'],'OpenchannelQueueId':_0xb98bc5['id']});});});});});}})['then'](respondWithStatusCode(_0x56f948,null))[_0xd09f('0x30')](handleError(_0x56f948,null));};exports[_0xd09f('0x5d')]=function(_0x1e8171,_0x24170f){return db[_0xd09f('0x4d')]['findAll']({'where':{'id':_0x1e8171['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xd09f('0x44')],'as':_0xd09f('0x52'),'attributes':['id'],'raw':!![]}]})[_0xd09f('0x15')](handleEntityNotFound(_0x24170f,null))[_0xd09f('0x15')](function(_0x2d7932){var _0x522ec3=_[_0xd09f('0x43')](_0x2d7932,'id');var _0xec64ff=[];var _0x1ce710=[];var _0x35b3e7=squel[_0xd09f('0x5e')]();_0x35b3e7[_0xd09f('0x5f')](_0xd09f('0x60'))[_0xd09f('0x61')](_0xd09f('0x62'),'tq')[_0xd09f('0x63')]('user_has_teams','ut',_0xd09f('0x64'))[_0xd09f('0x23')](_0xd09f('0x65'),_0x1e8171[_0xd09f('0x3a')]['id']);for(var _0x353a57=0x0;_0x353a57<_0x2d7932[_0xd09f('0x3c')];_0x353a57+=0x1){let _0x52aa93=_0x2d7932[_0x353a57];for(var _0x178421=0x0;_0x178421<_0x52aa93[_0xd09f('0x52')][_0xd09f('0x3c')];_0x178421+=0x1){let _0x2a8035=_0x52aa93[_0xd09f('0x52')][_0x178421];var _0x744bbd=_0x35b3e7[_0xd09f('0x66')]();_0x744bbd[_0xd09f('0x23')]('ut.UserId\x20=\x20?',_0x2a8035['id']);_0x1ce710[_0xd09f('0x67')](db[_0xd09f('0x56')][_0xd09f('0x25')](_0x744bbd[_0xd09f('0x68')](),{'type':db[_0xd09f('0x56')]['QueryTypes'][_0xd09f('0x69')]})['then'](function(_0x5980c5){if(_0x5980c5[_0xd09f('0x3c')]===0x1){return _0x2a8035['id'];}else{var _0x281848=_[_0xd09f('0x6a')](_['map'](_0x5980c5,_0xd09f('0x6b')),function(_0x5599a3){return _[_0xd09f('0x6c')](_0x522ec3,_0x5599a3);});if(_0x281848){return _0x2a8035['id'];}}}));}}return BPromise['all'](_0x1ce710)[_0xd09f('0x15')](function(_0x434d84){_0xec64ff=_(_0xec64ff)[_0xd09f('0x6d')](_0x434d84)[_0xd09f('0x6e')]()[_0xd09f('0x6f')]();return db[_0xd09f('0x1d')][_0xd09f('0x2f')]({'where':{'id':_0x1e8171[_0xd09f('0x3a')]['id']}})[_0xd09f('0x15')](function(_0x47e553){return db[_0xd09f('0x56')][_0xd09f('0x57')](function(_0x33071c){return _0x47e553['removeTeams'](_0x1e8171[_0xd09f('0x25')]['ids'],{'transaction':_0x33071c})['then'](function(){if(!_['isEmpty'](_0xec64ff)){return _0x47e553[_0xd09f('0x70')](_0xec64ff,{'transaction':_0x33071c});}})[_0xd09f('0x15')](function(){_0xec64ff[_0xd09f('0x71')](function(_0x4e682b){socket[_0xd09f('0x5b')]('userOpenchannelQueue:remove',{'UserId':_0x4e682b,'OpenchannelQueueId':_0x47e553['id']});});});});});});})[_0xd09f('0x15')](respondWithStatusCode(_0x24170f,null))[_0xd09f('0x30')](handleError(_0x24170f,null));};exports[_0xd09f('0x72')]=function(_0x312d84,_0x34ce9d){return db[_0xd09f('0x1d')][_0xd09f('0x2f')]({'where':{'id':_0x312d84[_0xd09f('0x3a')]['id']}})[_0xd09f('0x15')](handleEntityNotFound(_0x34ce9d,null))['then'](function(_0x4534b2){if(_0x4534b2){return _0x4534b2[_0xd09f('0x72')](_0x312d84[_0xd09f('0x32')]['ids'],_['omit'](_0x312d84[_0xd09f('0x32')],[_0xd09f('0x51'),'id'])||{})[_0xd09f('0x73')](function(_0x6a8a98){for(var _0x303018=0x0;_0x303018<_0x312d84[_0xd09f('0x32')][_0xd09f('0x51')][_0xd09f('0x3c')];_0x303018+=0x1){socket[_0xd09f('0x5b')](_0xd09f('0x5c'),{'UserId':Number(_0x312d84[_0xd09f('0x32')][_0xd09f('0x51')][_0x303018]),'OpenchannelQueueId':Number(_0x312d84[_0xd09f('0x3a')]['id'])});}return _0x6a8a98;});}})['then'](respondWithResult(_0x34ce9d,null))[_0xd09f('0x30')](handleError(_0x34ce9d,null));};exports['removeAgents']=function(_0x5df46f,_0x132650){return db[_0xd09f('0x1d')]['find']({'where':{'id':_0x5df46f[_0xd09f('0x3a')]['id']}})[_0xd09f('0x15')](handleEntityNotFound(_0x132650,null))[_0xd09f('0x15')](function(_0x614dfb){if(_0x614dfb){return _0x614dfb[_0xd09f('0x70')](_0x5df46f['query'][_0xd09f('0x51')])[_0xd09f('0x15')](function(){if(_[_0xd09f('0x74')](_0x5df46f[_0xd09f('0x25')][_0xd09f('0x51')])){for(var _0x514b36=0x0;_0x514b36<_0x5df46f['query'][_0xd09f('0x51')]['length'];_0x514b36+=0x1){socket[_0xd09f('0x5b')](_0xd09f('0x75'),{'UserId':Number(_0x5df46f[_0xd09f('0x25')][_0xd09f('0x51')][_0x514b36]),'OpenchannelQueueId':Number(_0x5df46f[_0xd09f('0x3a')]['id'])});}}else{socket['emit'](_0xd09f('0x75'),{'UserId':Number(_0x5df46f[_0xd09f('0x25')][_0xd09f('0x51')]),'OpenchannelQueueId':Number(_0x5df46f[_0xd09f('0x3a')]['id'])});}});}})[_0xd09f('0x15')](respondWithStatusCode(_0x132650,null))[_0xd09f('0x30')](handleError(_0x132650,null));};exports[_0xd09f('0x76')]=function(_0x5156c7,_0x23c789){var _0x2763f0={};var _0x125469={};var _0x13360b;var _0x31074d;return db[_0xd09f('0x1d')][_0xd09f('0x4c')]({'where':{'id':_0x5156c7[_0xd09f('0x3a')]['id']}})[_0xd09f('0x15')](handleEntityNotFound(_0x23c789,null))['then'](function(_0x16e955){if(_0x16e955){_0x13360b=_0x16e955;_0x125469[_0xd09f('0x2b')]=_[_0xd09f('0x4e')](db[_0xd09f('0x44')]['rawAttributes']);_0x125469[_0xd09f('0x25')]=_[_0xd09f('0x4e')](_0x5156c7[_0xd09f('0x25')]);_0x125469[_0xd09f('0x28')]=_[_0xd09f('0x2a')](_0x125469[_0xd09f('0x2b')],_0x125469['query']);_0x2763f0[_0xd09f('0x29')]=_[_0xd09f('0x2a')](_0x125469[_0xd09f('0x2b')],qs[_0xd09f('0x2c')](_0x5156c7[_0xd09f('0x25')]['fields']));_0x2763f0['attributes']=_0x2763f0[_0xd09f('0x29')]['length']?_0x2763f0[_0xd09f('0x29')]:_0x125469[_0xd09f('0x2b')];_0x2763f0[_0xd09f('0x3f')]=qs['sort'](_0x5156c7['query'][_0xd09f('0x40')]);_0x2763f0[_0xd09f('0x23')]=qs[_0xd09f('0x28')](_[_0xd09f('0x41')](_0x5156c7[_0xd09f('0x25')],_0x125469['filters']));if(_0x5156c7[_0xd09f('0x25')]['filter']){_0x2763f0[_0xd09f('0x23')]=_[_0xd09f('0x2d')](_0x2763f0[_0xd09f('0x23')],{'$or':_[_0xd09f('0x43')](_0x2763f0['attributes'],function(_0x4af123){var _0xb68201={};_0xb68201[_0x4af123]={'$like':'%'+_0x5156c7[_0xd09f('0x25')]['filter']+'%'};return _0xb68201;})});}_0x2763f0=_[_0xd09f('0x2d')]({},_0x2763f0,_0x5156c7[_0xd09f('0x2e')]);return _0x13360b[_0xd09f('0x76')](_0x2763f0);}})[_0xd09f('0x15')](function(_0x2e4c09){if(_0x2e4c09){_0x31074d=_0x2e4c09[_0xd09f('0x3c')];if(!_0x5156c7[_0xd09f('0x25')][_0xd09f('0x3d')]('nolimit')){_0x2763f0[_0xd09f('0x11')]=qs['limit'](_0x5156c7[_0xd09f('0x25')]['limit']);_0x2763f0[_0xd09f('0xf')]=qs[_0xd09f('0xf')](_0x5156c7[_0xd09f('0x25')][_0xd09f('0xf')]);}return _0x13360b['getAgents'](_0x2763f0);}})['then'](function(_0x224736){if(_0x224736){return _0x224736?{'count':_0x31074d,'rows':_0x224736}:null;}})[_0xd09f('0x15')](respondWithResult(_0x23c789,null))[_0xd09f('0x30')](handleError(_0x23c789,null));}; \ No newline at end of file +var _0x9158=['format','%s/%s','SIP','getTeams','findOne','Team','addTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','omit','spread','ids','removeAgents','isArray','emit','userOpenchannelQueue:remove','getAgents','nolimit','bluebird','util','lodash','squel','api','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','limit','set','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','where','OpenchannelQueue','count','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','UserOpenchannelQueue','filters','hasOwnProperty','order','sort','pick','OpenchannelQueueId','filter','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt'];(function(_0x5ac273,_0x34bad0){var _0x3b9515=function(_0xc8d6f8){while(--_0xc8d6f8){_0x5ac273['push'](_0x5ac273['shift']());}};_0x3b9515(++_0x34bad0);}(_0x9158,0x129));var _0x8915=function(_0x544bc6,_0x5bce7a){_0x544bc6=_0x544bc6-0x0;var _0x1bdee1=_0x9158[_0x544bc6];return _0x1bdee1;};'use strict';var BPromise=require(_0x8915('0x0'));var util=require(_0x8915('0x1'));var _=require(_0x8915('0x2'));var squel=require(_0x8915('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8915('0x4'));var config=require('../../config/environment');var db=require(_0x8915('0x5'))['db'];config[_0x8915('0x6')]=_['defaults'](config[_0x8915('0x6')],{'host':_0x8915('0x7'),'port':0x18eb});var socket=require(_0x8915('0x8'))(new Redis(config[_0x8915('0x6')]));require(_0x8915('0x9'))[_0x8915('0xa')](socket);function respondWithStatusCode(_0x29c6b3,_0x62712a){_0x62712a=_0x62712a||0xcc;return function(_0xba774f){if(_0xba774f){return _0x29c6b3[_0x8915('0xb')](_0x62712a);}return _0x29c6b3['status'](_0x62712a)['end']();};}function respondWithResult(_0x5159fc,_0x3ca9f2){_0x3ca9f2=_0x3ca9f2||0xc8;return function(_0xbb2196){if(_0xbb2196){return _0x5159fc[_0x8915('0xc')](_0x3ca9f2)[_0x8915('0xd')](_0xbb2196);}};}function respondWithFilteredResult(_0x3aec03,_0xf0fc40){return function(_0x484e52){if(_0x484e52){var _0x4745f7=typeof _0xf0fc40[_0x8915('0xe')]===_0x8915('0xf')&&typeof _0xf0fc40[_0x8915('0x10')]===_0x8915('0xf');var _0x45a4cc=_0x484e52['count'];var _0x1b257b=_0x4745f7?0x0:_0xf0fc40[_0x8915('0xe')];var _0xd3769a=_0x4745f7?_0x484e52['count']:_0xf0fc40[_0x8915('0xe')]+_0xf0fc40['limit'];var _0xa17829;if(_0xd3769a>=_0x45a4cc){_0xd3769a=_0x45a4cc;_0xa17829=0xc8;}else{_0xa17829=0xce;}_0x3aec03[_0x8915('0xc')](_0xa17829);return _0x3aec03[_0x8915('0x11')]('Content-Range',_0x1b257b+'-'+_0xd3769a+'/'+_0x45a4cc)[_0x8915('0xd')](_0x484e52);}return null;};}function saveUpdates(_0x32ac46){return function(_0xb7e457){if(_0xb7e457){return _0xb7e457[_0x8915('0x12')](_0x32ac46)[_0x8915('0x13')](function(_0x26e5cc){return _0x26e5cc;});}return null;};}function removeEntity(_0x4516fa){return function(_0xb1acc4){if(_0xb1acc4){return _0xb1acc4[_0x8915('0x14')]()['then'](function(){var _0x2a2472=_0xb1acc4[_0x8915('0x15')]({'plain':!![]});var _0xa1e3ee=_0x8915('0x16');return db[_0x8915('0x17')][_0x8915('0x14')]({'where':{'type':_0xa1e3ee,'resourceId':_0x2a2472['id']}})[_0x8915('0x13')](function(){return _0xb1acc4;});})[_0x8915('0x13')](function(){_0x4516fa[_0x8915('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491575){return function(_0x588b4a){if(!_0x588b4a){_0x491575[_0x8915('0xb')](0x194);}return _0x588b4a;};}function handleError(_0x4fae44,_0x17c0c6){_0x17c0c6=_0x17c0c6||0x1f4;return function(_0x296563){logger[_0x8915('0x18')](_0x296563[_0x8915('0x19')]);if(_0x296563['name']){delete _0x296563[_0x8915('0x1a')];}_0x4fae44[_0x8915('0xc')](_0x17c0c6)[_0x8915('0x1b')](_0x296563);};}exports[_0x8915('0x1c')]=function(_0xab0598,_0x306f9a){var _0x5efd97={};var _0x4885f6={'count':0x0,'rows':[]};var _0x4e15e1=_[_0x8915('0x1d')](db['OpenchannelQueue'][_0x8915('0x1e')],function(_0x3cf17c){return{'name':_0x3cf17c[_0x8915('0x1f')],'type':_0x3cf17c[_0x8915('0x20')][_0x8915('0x21')]};});_0x5efd97=qs['getOptions'](_0x4e15e1,_0xab0598);var _0x550ec7={'where':_0x5efd97[_0x8915('0x22')]};return db[_0x8915('0x23')][_0x8915('0x24')](_0x550ec7)[_0x8915('0x13')](function(_0x23d80b){_0x4885f6[_0x8915('0x24')]=_0x23d80b;_0x5efd97[_0x8915('0x25')]=qs[_0x8915('0x25')](_0xab0598['query']);return db[_0x8915('0x23')][_0x8915('0x26')](_0x5efd97);})[_0x8915('0x13')](function(_0x4efd82){_0x4885f6[_0x8915('0x27')]=_0x4efd82;return _0x4885f6;})[_0x8915('0x13')](respondWithFilteredResult(_0x306f9a,_0x5efd97))[_0x8915('0x28')](handleError(_0x306f9a,null));};exports[_0x8915('0x29')]=function(_0x3015a0,_0x425d92){var _0x19df16={'raw':!![],'where':{'id':_0x3015a0[_0x8915('0x2a')]['id']}},_0x16dd92={};_0x16dd92[_0x8915('0x2b')]=_[_0x8915('0x2c')](db['OpenchannelQueue'][_0x8915('0x1e')]);_0x16dd92[_0x8915('0x2d')]=_[_0x8915('0x2c')](_0x3015a0[_0x8915('0x2d')]);_0x16dd92['filters']=_[_0x8915('0x2e')](_0x16dd92[_0x8915('0x2b')],_0x16dd92['query']);_0x19df16[_0x8915('0x2f')]=_[_0x8915('0x2e')](_0x16dd92[_0x8915('0x2b')],qs['fields'](_0x3015a0['query'][_0x8915('0x30')]));_0x19df16[_0x8915('0x2f')]=_0x19df16[_0x8915('0x2f')][_0x8915('0x31')]?_0x19df16[_0x8915('0x2f')]:_0x16dd92[_0x8915('0x2b')];if(_0x3015a0['query'][_0x8915('0x32')]){_0x19df16[_0x8915('0x25')]=[{'all':!![]}];}_0x19df16=_[_0x8915('0x33')]({},_0x19df16,_0x3015a0[_0x8915('0x34')]);return db[_0x8915('0x23')][_0x8915('0x35')](_0x19df16)[_0x8915('0x13')](handleEntityNotFound(_0x425d92,null))['then'](respondWithResult(_0x425d92,null))[_0x8915('0x28')](handleError(_0x425d92,null));};exports[_0x8915('0x36')]=function(_0x5ae34e,_0x1eb7fc){return db[_0x8915('0x23')]['create'](_0x5ae34e['body'],{})['then'](function(_0x331a9e){var _0x256ec6=_0x5ae34e[_0x8915('0x37')][_0x8915('0x15')]({'plain':!![]});if(!_0x256ec6)throw new Error(_0x8915('0x38'));if(_0x256ec6[_0x8915('0x39')]==='user'){var _0x1b7520=_0x331a9e[_0x8915('0x15')]({'plain':!![]});var _0x1dc7cb=_0x8915('0x16');return db[_0x8915('0x3a')][_0x8915('0x35')]({'where':{'name':_0x1dc7cb,'userProfileId':_0x256ec6[_0x8915('0x3b')]},'raw':!![]})[_0x8915('0x13')](function(_0x280cea){if(_0x280cea&&_0x280cea[_0x8915('0x3c')]===0x0){return db[_0x8915('0x17')][_0x8915('0x36')]({'name':_0x1b7520[_0x8915('0x1a')],'resourceId':_0x1b7520['id'],'type':_0x280cea[_0x8915('0x1a')],'sectionId':_0x280cea['id']},{})[_0x8915('0x13')](function(){return _0x331a9e;});}else{return _0x331a9e;}})[_0x8915('0x28')](function(_0x12413f){logger[_0x8915('0x18')](_0x8915('0x3d'),_0x12413f);throw _0x12413f;});}return _0x331a9e;})[_0x8915('0x13')](respondWithResult(_0x1eb7fc,0xc9))[_0x8915('0x28')](handleError(_0x1eb7fc,null));};exports[_0x8915('0x12')]=function(_0x1a163f,_0x1e7021){if(_0x1a163f[_0x8915('0x3e')]['id']){delete _0x1a163f[_0x8915('0x3e')]['id'];}return db[_0x8915('0x23')][_0x8915('0x35')]({'where':{'id':_0x1a163f['params']['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x1e7021,null))[_0x8915('0x13')](saveUpdates(_0x1a163f[_0x8915('0x3e')],null))['then'](respondWithResult(_0x1e7021,null))[_0x8915('0x28')](handleError(_0x1e7021,null));};exports[_0x8915('0x14')]=function(_0x324ec2,_0x5af593){return db[_0x8915('0x23')][_0x8915('0x35')]({'where':{'id':_0x324ec2[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x5af593,null))['then'](removeEntity(_0x5af593,null))[_0x8915('0x28')](handleError(_0x5af593,null));};exports[_0x8915('0x3f')]=function(_0x46e67f,_0x2da118){return db[_0x8915('0x23')][_0x8915('0x3f')]()[_0x8915('0x13')](respondWithResult(_0x2da118,null))['catch'](handleError(_0x2da118,null));};exports['getMembers']=function(_0x46d5b7,_0x4d253a){var _0x455275={'raw':!![],'where':{}},_0x2b4407={},_0x2bd8db;return db[_0x8915('0x23')]['findOne']({'where':{'id':_0x46d5b7[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x4d253a,null))['then'](function(_0x1f7018){if(_0x1f7018){_0x2bd8db=_0x1f7018[_0x8915('0x15')]({'plain':!![]});_0x2b4407[_0x8915('0x2b')]=_[_0x8915('0x2c')](db[_0x8915('0x40')][_0x8915('0x1e')]);_0x2b4407['query']=_[_0x8915('0x2c')](_0x46d5b7[_0x8915('0x2d')]);_0x2b4407[_0x8915('0x41')]=_[_0x8915('0x2e')](_0x2b4407[_0x8915('0x2b')],_0x2b4407['query']);_0x455275[_0x8915('0x2f')]=_[_0x8915('0x2e')](_0x2b4407[_0x8915('0x2b')],qs[_0x8915('0x30')](_0x46d5b7[_0x8915('0x2d')][_0x8915('0x30')]));_0x455275[_0x8915('0x2f')]=_0x455275[_0x8915('0x2f')][_0x8915('0x31')]?_0x455275[_0x8915('0x2f')]:_0x2b4407[_0x8915('0x2b')];if(!_0x46d5b7[_0x8915('0x2d')][_0x8915('0x42')]('nolimit')){_0x455275['limit']=qs['limit'](_0x46d5b7[_0x8915('0x2d')][_0x8915('0x10')]);_0x455275[_0x8915('0xe')]=qs[_0x8915('0xe')](_0x46d5b7[_0x8915('0x2d')]['offset']);}_0x455275[_0x8915('0x43')]=qs[_0x8915('0x44')](_0x46d5b7[_0x8915('0x2d')][_0x8915('0x44')]);_0x455275['where']=qs[_0x8915('0x41')](_[_0x8915('0x45')](_0x46d5b7[_0x8915('0x2d')],_0x2b4407[_0x8915('0x41')]));_0x455275[_0x8915('0x22')][_0x8915('0x46')]=_0x1f7018['id'];if(_0x46d5b7[_0x8915('0x2d')][_0x8915('0x47')]){_0x455275[_0x8915('0x22')]=_['merge'](_0x455275[_0x8915('0x22')],{'$or':_[_0x8915('0x1d')](_0x455275[_0x8915('0x2f')],function(_0x58d443){var _0xac8cf4={};_0xac8cf4[_0x58d443]={'$like':'%'+_0x46d5b7[_0x8915('0x2d')][_0x8915('0x47')]+'%'};return _0xac8cf4;})});}_0x455275=_[_0x8915('0x33')]({},_0x455275,_0x46d5b7['options']);return db['UserOpenchannelQueue'][_0x8915('0x26')](_0x455275);}})[_0x8915('0x13')](function(_0x36f196){if(_0x36f196){return db['User'][_0x8915('0x48')]({'where':{'id':_[_0x8915('0x1d')](_0x36f196,_0x8915('0x49')),'role':_0x8915('0x4a')},'attributes':['id',_0x8915('0x1a'),_0x8915('0x4b'),_0x8915('0x4c'),_0x8915('0x4d')]});}})[_0x8915('0x13')](function(_0x350513){if(_0x350513){return{'count':_0x350513[_0x8915('0x24')],'rows':_['map'](_0x350513[_0x8915('0x27')],function(_0x3f1134){return{'membername':_0x3f1134['name'],'UserId':_0x3f1134['id'],'queue_name':_0x2bd8db[_0x8915('0x1a')],'OpenchannelQueueId':_0x2bd8db['id'],'interface':util[_0x8915('0x4e')](_0x8915('0x4f'),_0x8915('0x50'),_0x3f1134[_0x8915('0x1a')]),'penalty':0x0,'paused':_0x3f1134[_0x8915('0x4b')],'createdAt':_0x3f1134[_0x8915('0x4d')],'updatedAt':_0x3f1134[_0x8915('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d253a,_0x455275))[_0x8915('0x28')](handleError(_0x4d253a,null));};exports[_0x8915('0x51')]=function(_0x167f3a,_0x3423da){var _0x1e1a80={};var _0x325a06={};var _0xe6ce82;var _0x5021d7;return db[_0x8915('0x23')][_0x8915('0x52')]({'where':{'id':_0x167f3a[_0x8915('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3423da,null))[_0x8915('0x13')](function(_0x1c9f69){if(_0x1c9f69){_0xe6ce82=_0x1c9f69;_0x325a06[_0x8915('0x2b')]=_[_0x8915('0x2c')](db[_0x8915('0x53')][_0x8915('0x1e')]);_0x325a06[_0x8915('0x2d')]=_[_0x8915('0x2c')](_0x167f3a[_0x8915('0x2d')]);_0x325a06[_0x8915('0x41')]=_['intersection'](_0x325a06[_0x8915('0x2b')],_0x325a06[_0x8915('0x2d')]);_0x1e1a80[_0x8915('0x2f')]=_['intersection'](_0x325a06[_0x8915('0x2b')],qs[_0x8915('0x30')](_0x167f3a['query'][_0x8915('0x30')]));_0x1e1a80[_0x8915('0x2f')]=_0x1e1a80['attributes'][_0x8915('0x31')]?_0x1e1a80['attributes']:_0x325a06[_0x8915('0x2b')];_0x1e1a80[_0x8915('0x43')]=qs[_0x8915('0x44')](_0x167f3a[_0x8915('0x2d')][_0x8915('0x44')]);_0x1e1a80[_0x8915('0x22')]=qs[_0x8915('0x41')](_[_0x8915('0x45')](_0x167f3a[_0x8915('0x2d')],_0x325a06[_0x8915('0x41')]));if(_0x167f3a[_0x8915('0x2d')][_0x8915('0x47')]){_0x1e1a80[_0x8915('0x22')]=_[_0x8915('0x33')](_0x1e1a80[_0x8915('0x22')],{'$or':_[_0x8915('0x1d')](_0x1e1a80['attributes'],function(_0x44cbb0){var _0x121a04={};_0x121a04[_0x44cbb0]={'$like':'%'+_0x167f3a['query'][_0x8915('0x47')]+'%'};return _0x121a04;})});}_0x1e1a80=_[_0x8915('0x33')]({},_0x1e1a80,_0x167f3a[_0x8915('0x34')]);return _0xe6ce82['getTeams'](_0x1e1a80);}})[_0x8915('0x13')](function(_0x1cfa67){if(_0x1cfa67){_0x5021d7=_0x1cfa67[_0x8915('0x31')];if(!_0x167f3a[_0x8915('0x2d')][_0x8915('0x42')]('nolimit')){_0x1e1a80[_0x8915('0x10')]=qs[_0x8915('0x10')](_0x167f3a[_0x8915('0x2d')][_0x8915('0x10')]);_0x1e1a80[_0x8915('0xe')]=qs['offset'](_0x167f3a['query']['offset']);}return _0xe6ce82[_0x8915('0x51')](_0x1e1a80);}})[_0x8915('0x13')](function(_0x4dd1b1){if(_0x4dd1b1){return _0x4dd1b1?{'count':_0x5021d7,'rows':_0x4dd1b1}:null;}})[_0x8915('0x13')](respondWithResult(_0x3423da,null))['catch'](handleError(_0x3423da,null));};exports[_0x8915('0x54')]=function(_0x4f0ede,_0x2b3a6f){var _0x5d6c17=_0x4f0ede[_0x8915('0x3e')]['ids'];return db['Team'][_0x8915('0x26')]({'where':{'id':_0x5d6c17},'attributes':['id'],'include':[{'model':db[_0x8915('0x55')],'as':_0x8915('0x56'),'attributes':['id',_0x8915('0x1a'),'online',_0x8915('0x57'),_0x8915('0x58')],'raw':!![]}]})[_0x8915('0x13')](function(_0x6f6ba9){if(_0x6f6ba9){var _0x41d5b8=_[_0x8915('0x59')](_0x6f6ba9,function(_0x43d3f1){var _0x592cc0=_0x43d3f1[_0x8915('0x15')]({'plain':!![]});return _0x592cc0[_0x8915('0x56')];});return db[_0x8915('0x23')]['find']({'where':{'id':_0x4f0ede[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](function(_0x111ed1){return db[_0x8915('0x5a')][_0x8915('0x5b')](function(_0x10c17c){return _0x111ed1['addTeams'](_0x5d6c17,{'transaction':_0x10c17c})[_0x8915('0x13')](function(){return BPromise[_0x8915('0x5c')](_0x41d5b8,function(_0x2501a8){return db[_0x8915('0x40')][_0x8915('0x5d')]({'where':{'UserId':_0x2501a8['id'],'OpenchannelQueueId':_0x4f0ede[_0x8915('0x2a')]['id']},'transaction':_0x10c17c});});})[_0x8915('0x13')](function(){_0x41d5b8[_0x8915('0x5e')](function(_0x59305a){socket['emit'](_0x8915('0x5f'),{'UserId':_0x59305a['id'],'OpenchannelQueueId':_0x111ed1['id']});});});});});}})[_0x8915('0x13')](respondWithStatusCode(_0x2b3a6f,null))['catch'](handleError(_0x2b3a6f,null));};exports[_0x8915('0x60')]=function(_0x2b2cbf,_0x4953b8){return db[_0x8915('0x53')][_0x8915('0x26')]({'where':{'id':_0x2b2cbf['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x8915('0x55')],'as':_0x8915('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4953b8,null))['then'](function(_0x569b28){var _0x3fb50b=_['map'](_0x569b28,'id');var _0x4ad416=[];var _0x27f1ba=[];var _0x141139=squel['select']();_0x141139[_0x8915('0x61')](_0x8915('0x62'))[_0x8915('0x63')](_0x8915('0x64'),'tq')[_0x8915('0x65')](_0x8915('0x66'),'ut',_0x8915('0x67'))['where'](_0x8915('0x68'),_0x2b2cbf[_0x8915('0x2a')]['id']);for(var _0x5eaf86=0x0;_0x5eaf86<_0x569b28[_0x8915('0x31')];_0x5eaf86+=0x1){let _0x21b151=_0x569b28[_0x5eaf86];for(var _0x5c306b=0x0;_0x5c306b<_0x21b151['Agents']['length'];_0x5c306b+=0x1){let _0x6a5432=_0x21b151[_0x8915('0x56')][_0x5c306b];var _0x486cba=_0x141139[_0x8915('0x69')]();_0x486cba['where'](_0x8915('0x6a'),_0x6a5432['id']);_0x27f1ba[_0x8915('0x6b')](db[_0x8915('0x5a')][_0x8915('0x2d')](_0x486cba[_0x8915('0x6c')](),{'type':db[_0x8915('0x5a')][_0x8915('0x6d')][_0x8915('0x6e')]})[_0x8915('0x13')](function(_0x427e75){if(_0x427e75[_0x8915('0x31')]===0x1){return _0x6a5432['id'];}else{var _0x2cce47=_[_0x8915('0x6f')](_['map'](_0x427e75,_0x8915('0x70')),function(_0x191d5f){return _[_0x8915('0x71')](_0x3fb50b,_0x191d5f);});if(_0x2cce47){return _0x6a5432['id'];}}}));}}return BPromise[_0x8915('0x72')](_0x27f1ba)[_0x8915('0x13')](function(_0x555d1d){_0x4ad416=_(_0x4ad416)['union'](_0x555d1d)[_0x8915('0x73')]()['value']();return db[_0x8915('0x23')][_0x8915('0x35')]({'where':{'id':_0x2b2cbf[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](function(_0x46466d){return db['sequelize'][_0x8915('0x5b')](function(_0x4df07b){return _0x46466d['removeTeams'](_0x2b2cbf['query']['ids'],{'transaction':_0x4df07b})[_0x8915('0x13')](function(){if(!_['isEmpty'](_0x4ad416)){return _0x46466d['removeAgents'](_0x4ad416,{'transaction':_0x4df07b});}})[_0x8915('0x13')](function(){_0x4ad416[_0x8915('0x5e')](function(_0x38b5d3){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x38b5d3,'OpenchannelQueueId':_0x46466d['id']});});});});});});})[_0x8915('0x13')](respondWithStatusCode(_0x4953b8,null))[_0x8915('0x28')](handleError(_0x4953b8,null));};exports['addAgents']=function(_0x4b4353,_0x21d859){return db[_0x8915('0x23')][_0x8915('0x35')]({'where':{'id':_0x4b4353[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x21d859,null))[_0x8915('0x13')](function(_0x3d14c3){if(_0x3d14c3){return _0x3d14c3['addAgents'](_0x4b4353[_0x8915('0x3e')]['ids'],_[_0x8915('0x74')](_0x4b4353[_0x8915('0x3e')],['ids','id'])||{})[_0x8915('0x75')](function(_0x251186){for(var _0x5bed78=0x0;_0x5bed78<_0x4b4353[_0x8915('0x3e')][_0x8915('0x76')][_0x8915('0x31')];_0x5bed78+=0x1){socket['emit'](_0x8915('0x5f'),{'UserId':Number(_0x4b4353[_0x8915('0x3e')]['ids'][_0x5bed78]),'OpenchannelQueueId':Number(_0x4b4353[_0x8915('0x2a')]['id'])});}return _0x251186;});}})[_0x8915('0x13')](respondWithResult(_0x21d859,null))[_0x8915('0x28')](handleError(_0x21d859,null));};exports['removeAgents']=function(_0x221919,_0x3dc47b){return db[_0x8915('0x23')]['find']({'where':{'id':_0x221919[_0x8915('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3dc47b,null))[_0x8915('0x13')](function(_0x33d04c){if(_0x33d04c){return _0x33d04c[_0x8915('0x77')](_0x221919[_0x8915('0x2d')][_0x8915('0x76')])['then'](function(){if(_[_0x8915('0x78')](_0x221919[_0x8915('0x2d')]['ids'])){for(var _0x1a3c8e=0x0;_0x1a3c8e<_0x221919[_0x8915('0x2d')][_0x8915('0x76')]['length'];_0x1a3c8e+=0x1){socket[_0x8915('0x79')](_0x8915('0x7a'),{'UserId':Number(_0x221919['query'][_0x8915('0x76')][_0x1a3c8e]),'OpenchannelQueueId':Number(_0x221919[_0x8915('0x2a')]['id'])});}}else{socket['emit'](_0x8915('0x7a'),{'UserId':Number(_0x221919[_0x8915('0x2d')]['ids']),'OpenchannelQueueId':Number(_0x221919[_0x8915('0x2a')]['id'])});}});}})[_0x8915('0x13')](respondWithStatusCode(_0x3dc47b,null))['catch'](handleError(_0x3dc47b,null));};exports[_0x8915('0x7b')]=function(_0x56b22e,_0x488093){var _0x194554={};var _0xe5fbae={};var _0x4b974d;var _0x49e0b3;return db['OpenchannelQueue'][_0x8915('0x52')]({'where':{'id':_0x56b22e[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x488093,null))['then'](function(_0x546702){if(_0x546702){_0x4b974d=_0x546702;_0xe5fbae[_0x8915('0x2b')]=_['keys'](db[_0x8915('0x55')][_0x8915('0x1e')]);_0xe5fbae[_0x8915('0x2d')]=_['keys'](_0x56b22e[_0x8915('0x2d')]);_0xe5fbae[_0x8915('0x41')]=_['intersection'](_0xe5fbae[_0x8915('0x2b')],_0xe5fbae['query']);_0x194554[_0x8915('0x2f')]=_['intersection'](_0xe5fbae[_0x8915('0x2b')],qs[_0x8915('0x30')](_0x56b22e[_0x8915('0x2d')]['fields']));_0x194554['attributes']=_0x194554[_0x8915('0x2f')][_0x8915('0x31')]?_0x194554[_0x8915('0x2f')]:_0xe5fbae[_0x8915('0x2b')];_0x194554[_0x8915('0x43')]=qs[_0x8915('0x44')](_0x56b22e['query'][_0x8915('0x44')]);_0x194554[_0x8915('0x22')]=qs[_0x8915('0x41')](_[_0x8915('0x45')](_0x56b22e['query'],_0xe5fbae[_0x8915('0x41')]));if(_0x56b22e[_0x8915('0x2d')][_0x8915('0x47')]){_0x194554[_0x8915('0x22')]=_[_0x8915('0x33')](_0x194554['where'],{'$or':_[_0x8915('0x1d')](_0x194554[_0x8915('0x2f')],function(_0x347616){var _0x44a39b={};_0x44a39b[_0x347616]={'$like':'%'+_0x56b22e[_0x8915('0x2d')][_0x8915('0x47')]+'%'};return _0x44a39b;})});}_0x194554=_[_0x8915('0x33')]({},_0x194554,_0x56b22e[_0x8915('0x34')]);return _0x4b974d['getAgents'](_0x194554);}})['then'](function(_0x32870b){if(_0x32870b){_0x49e0b3=_0x32870b[_0x8915('0x31')];if(!_0x56b22e['query'][_0x8915('0x42')](_0x8915('0x7c'))){_0x194554[_0x8915('0x10')]=qs[_0x8915('0x10')](_0x56b22e[_0x8915('0x2d')][_0x8915('0x10')]);_0x194554[_0x8915('0xe')]=qs[_0x8915('0xe')](_0x56b22e[_0x8915('0x2d')]['offset']);}return _0x4b974d[_0x8915('0x7b')](_0x194554);}})['then'](function(_0x1aec9e){if(_0x1aec9e){return _0x1aec9e?{'count':_0x49e0b3,'rows':_0x1aec9e}:null;}})['then'](respondWithResult(_0x488093,null))[_0x8915('0x28')](handleError(_0x488093,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index e021ab6..08b176c 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 _0x5733=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x5733,0x142));var _0x3573=function(_0x1952ce,_0x4a2cad){_0x1952ce=_0x1952ce-0x0;var _0x6a6aff=_0x5733[_0x1952ce];return _0x6a6aff;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x3573('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3573('0x1')](0x0);var events={'afterCreate':_0x3573('0x2'),'afterUpdate':_0x3573('0x3'),'afterDestroy':_0x3573('0x4')};function emitEvent(_0x4c6470){return function(_0x3a6e35,_0x1f900c,_0x593d1c){OpenchannelQueueEvents[_0x3573('0x5')](_0x4c6470+':'+_0x3a6e35['id'],_0x3a6e35);OpenchannelQueueEvents[_0x3573('0x5')](_0x4c6470,_0x3a6e35);_0x593d1c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x3573('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x2bc9=['remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x37fe26,_0x26e5ea){var _0xef9bec=function(_0x567867){while(--_0x567867){_0x37fe26['push'](_0x37fe26['shift']());}};_0xef9bec(++_0x26e5ea);}(_0x2bc9,0x1bd));var _0x92bc=function(_0x56d1b5,_0x289333){_0x56d1b5=_0x56d1b5-0x0;var _0x4ad91e=_0x2bc9[_0x56d1b5];return _0x4ad91e;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x92bc('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x92bc('0x1')](0x0);var events={'afterCreate':_0x92bc('0x2'),'afterUpdate':'update','afterDestroy':_0x92bc('0x3')};function emitEvent(_0x18bb97){return function(_0x4afb38,_0x3323d6,_0x4d72bf){OpenchannelQueueEvents[_0x92bc('0x4')](_0x18bb97+':'+_0x4afb38['id'],_0x4afb38);OpenchannelQueueEvents[_0x92bc('0x4')](_0x18bb97,_0x4afb38);_0x4d72bf(null);};}for(var e in events){if(events[_0x92bc('0x5')](e)){var event=events[e];OpenchannelQueue[_0x92bc('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 5fc6731..6ea2810 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 _0x90f9=['openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','./openchannelQueue.attributes','define','OpenchannelQueue'];(function(_0x5af565,_0xe531a7){var _0x2a311f=function(_0x59429a){while(--_0x59429a){_0x5af565['push'](_0x5af565['shift']());}};_0x2a311f(++_0xe531a7);}(_0x90f9,0x1eb));var _0x990f=function(_0x2dc2c8,_0x1efe21){_0x2dc2c8=_0x2dc2c8-0x0;var _0x40c1fe=_0x90f9[_0x2dc2c8];return _0x40c1fe;};'use strict';var _=require(_0x990f('0x0'));var util=require(_0x990f('0x1'));var logger=require(_0x990f('0x2'))(_0x990f('0x3'));var moment=require(_0x990f('0x4'));var BPromise=require(_0x990f('0x5'));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(_0x990f('0x6'));module['exports']=function(_0x5029a6,_0xda139b){return _0x5029a6[_0x990f('0x7')](_0x990f('0x8'),attributes,{'tableName':_0x990f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6907=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','lodash','util','../../config/logger'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x6907,0x8c));var _0x7690=function(_0x564c3f,_0x563c13){_0x564c3f=_0x564c3f-0x0;var _0xdeb099=_0x6907[_0x564c3f];return _0xdeb099;};'use strict';var _=require(_0x7690('0x0'));var util=require(_0x7690('0x1'));var logger=require(_0x7690('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7690('0x3'));var rp=require(_0x7690('0x4'));var fs=require('fs');var path=require(_0x7690('0x5'));var rimraf=require(_0x7690('0x6'));var config=require(_0x7690('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x7690('0x8')]=function(_0x5732fb,_0x240ec5){return _0x5732fb[_0x7690('0x9')](_0x7690('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index ef6c527..ef1cc8f 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 _0x5dfb=['redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetOpenchannelQueue','findAll','options','raw','attributes','limit','map','include','model','ShowOpenchannelQueue','OpenchannelQueue','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5dfb,0x8c));var _0xb5df=function(_0x67754c,_0x4ee2c1){_0x67754c=_0x67754c-0x0;var _0x1f09ec=_0x5dfb[_0x67754c];return _0x1f09ec;};'use strict';var _=require(_0xb5df('0x0'));var util=require(_0xb5df('0x1'));var moment=require(_0xb5df('0x2'));var BPromise=require('bluebird');var rs=require(_0xb5df('0x3'));var fs=require('fs');var Redis=require(_0xb5df('0x4'));var db=require(_0xb5df('0x5'))['db'];var utils=require(_0xb5df('0x6'));var logger=require(_0xb5df('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xb5df('0x8')]=_['defaults'](config[_0xb5df('0x8')],{'host':_0xb5df('0x9'),'port':0x18eb});var socket=require(_0xb5df('0xa'))(new Redis(config[_0xb5df('0x8')]));require(_0xb5df('0xb'))[_0xb5df('0xc')](socket);function respondWithRpcPromise(_0x216b39,_0x133de0,_0x531370){return new BPromise(function(_0x214221,_0x279e60){return client[_0xb5df('0xd')](_0x216b39,_0x531370)[_0xb5df('0xe')](function(_0x37b044){logger[_0xb5df('0xf')](_0xb5df('0x10'),_0x133de0,_0xb5df('0x11'));logger[_0xb5df('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x133de0,_0xb5df('0x11'),JSON[_0xb5df('0x13')](_0x37b044));if(_0x37b044[_0xb5df('0x14')]){if(_0x37b044[_0xb5df('0x14')][_0xb5df('0x15')]===0x1f4){logger[_0xb5df('0x14')](_0xb5df('0x10'),_0x133de0,_0x37b044[_0xb5df('0x14')]['message']);return _0x279e60(_0x37b044[_0xb5df('0x14')]['message']);}logger[_0xb5df('0x14')](_0xb5df('0x10'),_0x133de0,_0x37b044[_0xb5df('0x14')][_0xb5df('0x16')]);return _0x214221(_0x37b044[_0xb5df('0x14')][_0xb5df('0x16')]);}else{logger[_0xb5df('0xf')](_0xb5df('0x10'),_0x133de0,_0xb5df('0x11'));_0x214221(_0x37b044['result'][_0xb5df('0x16')]);}})[_0xb5df('0x17')](function(_0x42297b){logger['error'](_0xb5df('0x10'),_0x133de0,_0x42297b);_0x279e60(_0x42297b);});});}exports[_0xb5df('0x18')]=function(_0x199e20){var _0x3bf1e9=this;return new Promise(function(_0x4ccdbe,_0x57ce23){return db['OpenchannelQueue'][_0xb5df('0x19')]({'raw':_0x199e20[_0xb5df('0x1a')]?_0x199e20[_0xb5df('0x1a')][_0xb5df('0x1b')]===undefined?!![]:![]:!![],'where':_0x199e20[_0xb5df('0x1a')]?_0x199e20['options']['where']||null:null,'attributes':_0x199e20[_0xb5df('0x1a')]?_0x199e20[_0xb5df('0x1a')][_0xb5df('0x1c')]||null:null,'limit':_0x199e20['options']?_0x199e20[_0xb5df('0x1a')][_0xb5df('0x1d')]||null:null,'include':_0x199e20[_0xb5df('0x1a')]?_0x199e20[_0xb5df('0x1a')]['include']?_[_0xb5df('0x1e')](_0x199e20[_0xb5df('0x1a')][_0xb5df('0x1f')],function(_0x5e83cc){return{'model':db[_0x5e83cc['model']],'as':_0x5e83cc['as'],'attributes':_0x5e83cc[_0xb5df('0x1c')],'include':_0x5e83cc['include']?_[_0xb5df('0x1e')](_0x5e83cc[_0xb5df('0x1f')],function(_0x22b6c3){return{'model':db[_0x22b6c3[_0xb5df('0x20')]],'as':_0x22b6c3['as'],'attributes':_0x22b6c3[_0xb5df('0x1c')],'include':_0x22b6c3[_0xb5df('0x1f')]?_['map'](_0x22b6c3[_0xb5df('0x1f')],function(_0xc3935e){return{'model':db[_0xc3935e[_0xb5df('0x20')]],'as':_0xc3935e['as'],'attributes':_0xc3935e[_0xb5df('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf013ff){logger[_0xb5df('0xf')](_0xb5df('0x18'),_0x199e20);logger[_0xb5df('0x12')](_0xb5df('0x18'),_0x199e20,JSON['stringify'](_0xf013ff));_0x4ccdbe(_0xf013ff);})[_0xb5df('0x17')](function(_0x2e602c){logger[_0xb5df('0x14')](_0xb5df('0x18'),_0x2e602c['message'],_0x199e20);_0x57ce23(_0x3bf1e9[_0xb5df('0x14')](0x1f4,_0x2e602c[_0xb5df('0x16')]));});});};exports[_0xb5df('0x21')]=function(_0x4a9ebf){var _0x149f44=this;return new Promise(function(_0x143aa5,_0x4bd0b6){return db[_0xb5df('0x22')][_0xb5df('0x23')]({'raw':_0x4a9ebf['options']?_0x4a9ebf[_0xb5df('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4a9ebf['options']?_0x4a9ebf[_0xb5df('0x1a')][_0xb5df('0x24')]||null:null,'attributes':_0x4a9ebf[_0xb5df('0x1a')]?_0x4a9ebf['options'][_0xb5df('0x1c')]||null:null,'include':_0x4a9ebf[_0xb5df('0x1a')]?_0x4a9ebf['options'][_0xb5df('0x1f')]?_[_0xb5df('0x1e')](_0x4a9ebf[_0xb5df('0x1a')][_0xb5df('0x1f')],function(_0x3e455d){return{'model':db[_0x3e455d[_0xb5df('0x20')]],'as':_0x3e455d['as'],'attributes':_0x3e455d[_0xb5df('0x1c')],'include':_0x3e455d[_0xb5df('0x1f')]?_[_0xb5df('0x1e')](_0x3e455d[_0xb5df('0x1f')],function(_0x30e552){return{'model':db[_0x30e552[_0xb5df('0x20')]],'as':_0x30e552['as'],'attributes':_0x30e552[_0xb5df('0x1c')],'include':_0x30e552[_0xb5df('0x1f')]?_[_0xb5df('0x1e')](_0x30e552[_0xb5df('0x1f')],function(_0xfa5453){return{'model':db[_0xfa5453['model']],'as':_0xfa5453['as'],'attributes':_0xfa5453[_0xb5df('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3093a2){logger[_0xb5df('0xf')](_0xb5df('0x21'),_0x4a9ebf);logger[_0xb5df('0x12')](_0xb5df('0x21'),_0x4a9ebf,JSON[_0xb5df('0x13')](_0x3093a2));_0x143aa5(_0x3093a2);})['catch'](function(_0x252d12){logger['error'](_0xb5df('0x21'),_0x252d12['message'],_0x4a9ebf);_0x4bd0b6(_0x149f44[_0xb5df('0x14')](0x1f4,_0x252d12[_0xb5df('0x16')]));});});}; \ No newline at end of file +var _0x5d96=['find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0x5d96,0xd4));var _0x65d9=function(_0x2af394,_0x1e6132){_0x2af394=_0x2af394-0x0;var _0x316104=_0x5d96[_0x2af394];return _0x316104;};'use strict';var _=require('lodash');var util=require(_0x65d9('0x0'));var moment=require(_0x65d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x65d9('0x2'));var fs=require('fs');var Redis=require(_0x65d9('0x3'));var db=require(_0x65d9('0x4'))['db'];var utils=require(_0x65d9('0x5'));var logger=require(_0x65d9('0x6'))(_0x65d9('0x7'));var config=require(_0x65d9('0x8'));var jayson=require(_0x65d9('0x9'));var client=jayson[_0x65d9('0xa')]['http']({'port':0x232a});config[_0x65d9('0xb')]=_[_0x65d9('0xc')](config[_0x65d9('0xb')],{'host':_0x65d9('0xd'),'port':0x18eb});var socket=require(_0x65d9('0xe'))(new Redis(config[_0x65d9('0xb')]));require(_0x65d9('0xf'))[_0x65d9('0x10')](socket);function respondWithRpcPromise(_0x59316b,_0x4092dd,_0x38f221){return new BPromise(function(_0x47a53c,_0x3e85b1){return client[_0x65d9('0x11')](_0x59316b,_0x38f221)[_0x65d9('0x12')](function(_0x3aff99){logger[_0x65d9('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x4092dd,_0x65d9('0x14'));logger[_0x65d9('0x15')](_0x65d9('0x16'),_0x4092dd,'request\x20sent',JSON[_0x65d9('0x17')](_0x3aff99));if(_0x3aff99[_0x65d9('0x18')]){if(_0x3aff99[_0x65d9('0x18')][_0x65d9('0x19')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4092dd,_0x3aff99[_0x65d9('0x18')][_0x65d9('0x1a')]);return _0x3e85b1(_0x3aff99[_0x65d9('0x18')]['message']);}logger[_0x65d9('0x18')](_0x65d9('0x1b'),_0x4092dd,_0x3aff99[_0x65d9('0x18')][_0x65d9('0x1a')]);return _0x47a53c(_0x3aff99[_0x65d9('0x18')]['message']);}else{logger[_0x65d9('0x13')](_0x65d9('0x1b'),_0x4092dd,_0x65d9('0x14'));_0x47a53c(_0x3aff99[_0x65d9('0x1c')][_0x65d9('0x1a')]);}})[_0x65d9('0x1d')](function(_0x1426c7){logger[_0x65d9('0x18')](_0x65d9('0x1b'),_0x4092dd,_0x1426c7);_0x3e85b1(_0x1426c7);});});}exports[_0x65d9('0x1e')]=function(_0x303cb5){var _0x39aeea=this;return new Promise(function(_0x5c6688,_0xdd3059){return db[_0x65d9('0x1f')]['findAll']({'raw':_0x303cb5['options']?_0x303cb5[_0x65d9('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x303cb5[_0x65d9('0x20')]?_0x303cb5[_0x65d9('0x20')][_0x65d9('0x21')]||null:null,'attributes':_0x303cb5['options']?_0x303cb5[_0x65d9('0x20')][_0x65d9('0x22')]||null:null,'limit':_0x303cb5[_0x65d9('0x20')]?_0x303cb5[_0x65d9('0x20')][_0x65d9('0x23')]||null:null,'include':_0x303cb5[_0x65d9('0x20')]?_0x303cb5[_0x65d9('0x20')][_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x303cb5[_0x65d9('0x20')][_0x65d9('0x24')],function(_0x43f918){return{'model':db[_0x43f918[_0x65d9('0x26')]],'as':_0x43f918['as'],'attributes':_0x43f918[_0x65d9('0x22')],'include':_0x43f918[_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x43f918[_0x65d9('0x24')],function(_0x84493d){return{'model':db[_0x84493d[_0x65d9('0x26')]],'as':_0x84493d['as'],'attributes':_0x84493d[_0x65d9('0x22')],'include':_0x84493d['include']?_[_0x65d9('0x25')](_0x84493d[_0x65d9('0x24')],function(_0x56e4e1){return{'model':db[_0x56e4e1[_0x65d9('0x26')]],'as':_0x56e4e1['as'],'attributes':_0x56e4e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x65d9('0x12')](function(_0x5471ca){logger[_0x65d9('0x13')](_0x65d9('0x1e'),_0x303cb5);logger[_0x65d9('0x15')]('GetOpenchannelQueue',_0x303cb5,JSON[_0x65d9('0x17')](_0x5471ca));_0x5c6688(_0x5471ca);})[_0x65d9('0x1d')](function(_0x4545a8){logger[_0x65d9('0x18')](_0x65d9('0x1e'),_0x4545a8['message'],_0x303cb5);_0xdd3059(_0x39aeea[_0x65d9('0x18')](0x1f4,_0x4545a8['message']));});});};exports[_0x65d9('0x27')]=function(_0x4971d1){var _0x56c6e1=this;return new Promise(function(_0x785a68,_0x1c5766){return db[_0x65d9('0x1f')][_0x65d9('0x28')]({'raw':_0x4971d1[_0x65d9('0x20')]?_0x4971d1[_0x65d9('0x20')][_0x65d9('0x29')]===undefined?!![]:![]:!![],'where':_0x4971d1[_0x65d9('0x20')]?_0x4971d1[_0x65d9('0x20')][_0x65d9('0x21')]||null:null,'attributes':_0x4971d1[_0x65d9('0x20')]?_0x4971d1[_0x65d9('0x20')][_0x65d9('0x22')]||null:null,'include':_0x4971d1['options']?_0x4971d1[_0x65d9('0x20')][_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x4971d1[_0x65d9('0x20')][_0x65d9('0x24')],function(_0x325d30){return{'model':db[_0x325d30[_0x65d9('0x26')]],'as':_0x325d30['as'],'attributes':_0x325d30[_0x65d9('0x22')],'include':_0x325d30[_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x325d30[_0x65d9('0x24')],function(_0x5cea1f){return{'model':db[_0x5cea1f[_0x65d9('0x26')]],'as':_0x5cea1f['as'],'attributes':_0x5cea1f['attributes'],'include':_0x5cea1f[_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x5cea1f['include'],function(_0x468da4){return{'model':db[_0x468da4['model']],'as':_0x468da4['as'],'attributes':_0x468da4['attributes']};}):[]};}):[]};}):[]:[]})[_0x65d9('0x12')](function(_0x4107e8){logger[_0x65d9('0x13')](_0x65d9('0x27'),_0x4971d1);logger['debug'](_0x65d9('0x27'),_0x4971d1,JSON['stringify'](_0x4107e8));_0x785a68(_0x4107e8);})['catch'](function(_0x20ae4f){logger[_0x65d9('0x18')](_0x65d9('0x27'),_0x20ae4f[_0x65d9('0x1a')],_0x4971d1);_0x1c5766(_0x56c6e1['error'](0x1f4,_0x20ae4f['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5e41787..61c1387 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 _0xe00b=['./openchannelQueue.events','save','remove','update','removeListener','length','openchannelQueue:'];(function(_0xce6f11,_0x3c3137){var _0x35b709=function(_0x1755c6){while(--_0x1755c6){_0xce6f11['push'](_0xce6f11['shift']());}};_0x35b709(++_0x3c3137);}(_0xe00b,0xa1));var _0xbe00=function(_0x3c9175,_0x3d39b2){_0x3c9175=_0x3c9175-0x0;var _0x476098=_0xe00b[_0x3c9175];return _0x476098;};'use strict';var OpenchannelQueueEvents=require(_0xbe00('0x0'));var events=[_0xbe00('0x1'),_0xbe00('0x2'),_0xbe00('0x3')];function createListener(_0x16baaf,_0x100792){return function(_0x552d69){_0x100792['emit'](_0x16baaf,_0x552d69);};}function removeListener(_0x5dec98,_0x185596){return function(){OpenchannelQueueEvents[_0xbe00('0x4')](_0x5dec98,_0x185596);};}exports['register']=function(_0x11edfa){for(var _0x2b8dc0=0x0,_0x3dc56b=events[_0xbe00('0x5')];_0x2b8dc0<_0x3dc56b;_0x2b8dc0++){var _0x201340=events[_0x2b8dc0];var _0x28f470=createListener(_0xbe00('0x6')+_0x201340,_0x11edfa);OpenchannelQueueEvents['on'](_0x201340,_0x28f470);}}; \ No newline at end of file +var _0x45bc=['remove','emit','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x45bc,0x10c));var _0xc45b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x45bc[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelQueueEvents=require(_0xc45b('0x0'));var events=[_0xc45b('0x1'),_0xc45b('0x2'),'update'];function createListener(_0x207a81,_0x44e464){return function(_0x55b992){_0x44e464[_0xc45b('0x3')](_0x207a81,_0x55b992);};}function removeListener(_0x1b3524,_0x29e9e6){return function(){OpenchannelQueueEvents['removeListener'](_0x1b3524,_0x29e9e6);};}exports[_0xc45b('0x4')]=function(_0x4b684c){for(var _0x4a6351=0x0,_0x4322d0=events['length'];_0x4a6351<_0x4322d0;_0x4a6351++){var _0x11adbf=events[_0x4a6351];var _0x3853c0=createListener(_0xc45b('0x5')+_0x11adbf,_0x4b684c);OpenchannelQueueEvents['on'](_0x11adbf,_0x3853c0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 1f513f3..17d8620 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 _0xa534=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','update','destroy','path','fs-extra'];(function(_0x12fa9b,_0x167b4e){var _0xb717f1=function(_0x3c65ef){while(--_0x3c65ef){_0x12fa9b['push'](_0x12fa9b['shift']());}};_0xb717f1(++_0x167b4e);}(_0xa534,0xfa));var _0x4a53=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xa534[_0x2fc012];return _0x2891f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4a53('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4a53('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x4a53('0x2'));var config=require(_0x4a53('0x3'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x4a53('0x4')](),controller[_0x4a53('0x5')]);router[_0x4a53('0x6')]('/describe',auth[_0x4a53('0x4')](),controller['describe']);router[_0x4a53('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4a53('0x7')]);router[_0x4a53('0x8')]('/',auth[_0x4a53('0x4')](),controller[_0x4a53('0x9')]);router[_0x4a53('0xa')](_0x4a53('0xb'),auth['isAuthenticated'](),controller[_0x4a53('0xc')]);router['delete'](_0x4a53('0xb'),auth[_0x4a53('0x4')](),controller[_0x4a53('0xd')]);module['exports']=router; \ No newline at end of file +var _0x2294=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x2294,0x13c));var _0x4229=function(_0x42e299,_0x5dddde){_0x42e299=_0x42e299-0x0;var _0x1f09f8=_0x2294[_0x42e299];return _0x1f09f8;};'use strict';var multer=require(_0x4229('0x0'));var util=require(_0x4229('0x1'));var path=require(_0x4229('0x2'));var timeout=require(_0x4229('0x3'));var express=require(_0x4229('0x4'));var router=express[_0x4229('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4229('0x6'));var interaction=require(_0x4229('0x7'));var config=require(_0x4229('0x8'));var controller=require(_0x4229('0x9'));router[_0x4229('0xa')]('/',auth['isAuthenticated'](),controller[_0x4229('0xb')]);router[_0x4229('0xa')](_0x4229('0xc'),auth[_0x4229('0xd')](),controller[_0x4229('0xe')]);router[_0x4229('0xa')](_0x4229('0xf'),auth[_0x4229('0xd')](),controller[_0x4229('0x10')]);router[_0x4229('0x11')]('/',auth[_0x4229('0xd')](),controller[_0x4229('0x12')]);router[_0x4229('0x13')](_0x4229('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4229('0x14')]('/:id',auth[_0x4229('0xd')](),controller[_0x4229('0x15')]);module[_0x4229('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 48f7aec..79c0086 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 _0x9175=['STRING','DATE','sequelize'];(function(_0x3ae8f4,_0x2920f4){var _0x367312=function(_0x4dffbf){while(--_0x4dffbf){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x367312(++_0x2920f4);}(_0x9175,0x14f));var _0x5917=function(_0x198ccc,_0x538804){_0x198ccc=_0x198ccc-0x0;var _0x79f72a=_0x9175[_0x198ccc];return _0x79f72a;};'use strict';var moment=require('moment');var Sequelize=require(_0x5917('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5917('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5917('0x2')]},'acceptAt':{'type':Sequelize[_0x5917('0x2')]},'exitAt':{'type':Sequelize[_0x5917('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5aa7=['DATE','moment','sequelize','STRING'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x5aa7,0x131));var _0x75aa=function(_0x3b3b97,_0x362e97){_0x3b3b97=_0x3b3b97-0x0;var _0x4e691e=_0x5aa7[_0x3b3b97];return _0x4e691e;};'use strict';var moment=require(_0x75aa('0x0'));var Sequelize=require(_0x75aa('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x75aa('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x75aa('0x2')]},'joinAt':{'type':Sequelize[_0x75aa('0x3')]},'leaveAt':{'type':Sequelize[_0x75aa('0x3')]},'acceptAt':{'type':Sequelize[_0x75aa('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x75aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 47c8cdf..8623e33 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 _0xc212=['hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','OpenchannelQueueReport','include','rows','includeAll','options','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model'];(function(_0x51aac2,_0x25a645){var _0x1028c1=function(_0x176da5){while(--_0x176da5){_0x51aac2['push'](_0x51aac2['shift']());}};_0x1028c1(++_0x25a645);}(_0xc212,0x149));var _0x2c21=function(_0x2ce31e,_0x1de58a){_0x2ce31e=_0x2ce31e-0x0;var _0x64772a=_0xc212[_0x2ce31e];return _0x64772a;};'use strict';var emlformat=require(_0x2c21('0x0'));var rimraf=require(_0x2c21('0x1'));var zipdir=require(_0x2c21('0x2'));var jsonpatch=require(_0x2c21('0x3'));var rp=require(_0x2c21('0x4'));var moment=require(_0x2c21('0x5'));var BPromise=require(_0x2c21('0x6'));var Mustache=require('mustache');var util=require(_0x2c21('0x7'));var path=require(_0x2c21('0x8'));var sox=require(_0x2c21('0x9'));var csv=require(_0x2c21('0xa'));var ejs=require(_0x2c21('0xb'));var fs=require('fs');var fs_extra=require(_0x2c21('0xc'));var _=require(_0x2c21('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c21('0xe'));var deskjs=require(_0x2c21('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2c21('0x10'));var Papa=require(_0x2c21('0x11'));var Redis=require(_0x2c21('0x12'));var authService=require(_0x2c21('0x13'));var qs=require(_0x2c21('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c21('0x15'));var logger=require(_0x2c21('0x16'))('api');var utils=require(_0x2c21('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2c21('0x18'));var db=require(_0x2c21('0x19'))['db'];function respondWithStatusCode(_0x4cd69f,_0x17ac76){_0x17ac76=_0x17ac76||0xcc;return function(_0x186457){if(_0x186457){return _0x4cd69f[_0x2c21('0x1a')](_0x17ac76);}return _0x4cd69f['status'](_0x17ac76)[_0x2c21('0x1b')]();};}function respondWithResult(_0x4d0271,_0x5c45b4){_0x5c45b4=_0x5c45b4||0xc8;return function(_0x374c5e){if(_0x374c5e){return _0x4d0271[_0x2c21('0x1c')](_0x5c45b4)[_0x2c21('0x1d')](_0x374c5e);}};}function respondWithFilteredResult(_0x30578a,_0x53d022){return function(_0x2790ac){if(_0x2790ac){var _0x13ca72=typeof _0x53d022['offset']===_0x2c21('0x1e')&&typeof _0x53d022[_0x2c21('0x1f')]==='undefined';var _0x31e78e=_0x2790ac[_0x2c21('0x20')];var _0x51bf0d=_0x13ca72?0x0:_0x53d022[_0x2c21('0x21')];var _0xd266c1=_0x13ca72?_0x2790ac[_0x2c21('0x20')]:_0x53d022[_0x2c21('0x21')]+_0x53d022[_0x2c21('0x1f')];var _0x375a8f;if(_0xd266c1>=_0x31e78e){_0xd266c1=_0x31e78e;_0x375a8f=0xc8;}else{_0x375a8f=0xce;}_0x30578a[_0x2c21('0x1c')](_0x375a8f);return _0x30578a[_0x2c21('0x22')](_0x2c21('0x23'),_0x51bf0d+'-'+_0xd266c1+'/'+_0x31e78e)['json'](_0x2790ac);}return null;};}function patchUpdates(_0x3fdecb){return function(_0x149612){try{jsonpatch['apply'](_0x149612,_0x3fdecb,!![]);}catch(_0x1f36c7){return BPromise['reject'](_0x1f36c7);}return _0x149612[_0x2c21('0x24')]();};}function saveUpdates(_0x444bf,_0x33c18c){return function(_0x89f3d2){if(_0x89f3d2){return _0x89f3d2['update'](_0x444bf)[_0x2c21('0x25')](function(_0x1c7275){return _0x1c7275;});}return null;};}function removeEntity(_0x3d22b5,_0x5c5bb0){return function(_0xbb2575){if(_0xbb2575){return _0xbb2575[_0x2c21('0x26')]()[_0x2c21('0x25')](function(){_0x3d22b5[_0x2c21('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47f9c4,_0x4d34f4){return function(_0xd99a51){if(!_0xd99a51){_0x47f9c4[_0x2c21('0x1a')](0x194);}return _0xd99a51;};}function handleError(_0x1d16bf,_0x17f711){_0x17f711=_0x17f711||0x1f4;return function(_0x322e70){logger[_0x2c21('0x27')](_0x322e70[_0x2c21('0x28')]);if(_0x322e70[_0x2c21('0x29')]){delete _0x322e70[_0x2c21('0x29')];}_0x1d16bf[_0x2c21('0x1c')](_0x17f711)[_0x2c21('0x2a')](_0x322e70);};}exports['index']=function(_0xc7c438,_0x1367a1){var _0x36f76c={},_0x50e47c={},_0x302883={'count':0x0,'rows':[]};var _0x5a4eca=_[_0x2c21('0x2b')](db['OpenchannelQueueReport'][_0x2c21('0x2c')],function(_0x3d6287){return{'name':_0x3d6287[_0x2c21('0x2d')],'type':_0x3d6287[_0x2c21('0x2e')][_0x2c21('0x2f')]};});_0x50e47c['model']=_[_0x2c21('0x2b')](_0x5a4eca,'name');_0x50e47c[_0x2c21('0x30')]=_[_0x2c21('0x31')](_0xc7c438['query']);_0x50e47c[_0x2c21('0x32')]=_['intersection'](_0x50e47c['model'],_0x50e47c[_0x2c21('0x30')]);_0x36f76c['attributes']=_[_0x2c21('0x33')](_0x50e47c['model'],qs[_0x2c21('0x34')](_0xc7c438['query'][_0x2c21('0x34')]));_0x36f76c[_0x2c21('0x35')]=_0x36f76c[_0x2c21('0x35')][_0x2c21('0x36')]?_0x36f76c['attributes']:_0x50e47c[_0x2c21('0x37')];if(!_0xc7c438[_0x2c21('0x30')][_0x2c21('0x38')](_0x2c21('0x39'))){_0x36f76c[_0x2c21('0x1f')]=qs[_0x2c21('0x1f')](_0xc7c438[_0x2c21('0x30')][_0x2c21('0x1f')]);_0x36f76c[_0x2c21('0x21')]=qs[_0x2c21('0x21')](_0xc7c438['query'][_0x2c21('0x21')]);}_0x36f76c[_0x2c21('0x3a')]=qs[_0x2c21('0x3b')](_0xc7c438['query']['sort']);_0x36f76c['where']=qs[_0x2c21('0x32')](_[_0x2c21('0x3c')](_0xc7c438['query'],_0x50e47c[_0x2c21('0x32')]),_0x5a4eca);if(_0xc7c438[_0x2c21('0x30')][_0x2c21('0x3d')]){_0x36f76c['where']=_[_0x2c21('0x3e')](_0x36f76c[_0x2c21('0x3f')],{'$or':_[_0x2c21('0x2b')](_0x5a4eca,function(_0x36c491){if(_0x36c491[_0x2c21('0x2e')]!==_0x2c21('0x40')){var _0x1c7beb={};_0x1c7beb[_0x36c491[_0x2c21('0x29')]]={'$like':'%'+_0xc7c438[_0x2c21('0x30')][_0x2c21('0x3d')]+'%'};return _0x1c7beb;}})});}_0x36f76c=_[_0x2c21('0x3e')]({},_0x36f76c,_0xc7c438['options']);var _0x1ceed8={'where':_0x36f76c['where']};return db[_0x2c21('0x41')][_0x2c21('0x20')](_0x1ceed8)[_0x2c21('0x25')](function(_0x2c847a){_0x302883[_0x2c21('0x20')]=_0x2c847a;if(_0xc7c438['query']['includeAll']){_0x36f76c[_0x2c21('0x42')]=[{'all':!![]}];}return db[_0x2c21('0x41')]['findAll'](_0x36f76c);})[_0x2c21('0x25')](function(_0x47f0a6){_0x302883[_0x2c21('0x43')]=_0x47f0a6;return _0x302883;})[_0x2c21('0x25')](respondWithFilteredResult(_0x1367a1,_0x36f76c))['catch'](handleError(_0x1367a1,null));};exports['show']=function(_0x4881f2,_0x42a542){var _0x457460={'raw':!![],'where':{'id':_0x4881f2['params']['id']}},_0x4f5bdb={};_0x4f5bdb['model']=_[_0x2c21('0x31')](db['OpenchannelQueueReport']['rawAttributes']);_0x4f5bdb['query']=_[_0x2c21('0x31')](_0x4881f2[_0x2c21('0x30')]);_0x4f5bdb[_0x2c21('0x32')]=_[_0x2c21('0x33')](_0x4f5bdb[_0x2c21('0x37')],_0x4f5bdb[_0x2c21('0x30')]);_0x457460[_0x2c21('0x35')]=_[_0x2c21('0x33')](_0x4f5bdb['model'],qs[_0x2c21('0x34')](_0x4881f2[_0x2c21('0x30')][_0x2c21('0x34')]));_0x457460['attributes']=_0x457460['attributes'][_0x2c21('0x36')]?_0x457460[_0x2c21('0x35')]:_0x4f5bdb['model'];if(_0x4881f2[_0x2c21('0x30')][_0x2c21('0x44')]){_0x457460[_0x2c21('0x42')]=[{'all':!![]}];}_0x457460=_['merge']({},_0x457460,_0x4881f2[_0x2c21('0x45')]);return db['OpenchannelQueueReport'][_0x2c21('0x46')](_0x457460)['then'](handleEntityNotFound(_0x42a542,null))[_0x2c21('0x25')](respondWithResult(_0x42a542,null))[_0x2c21('0x47')](handleError(_0x42a542,null));};exports[_0x2c21('0x48')]=function(_0x370ad5,_0x1a217b){return db[_0x2c21('0x41')]['create'](_0x370ad5[_0x2c21('0x49')],{})[_0x2c21('0x25')](respondWithResult(_0x1a217b,0xc9))[_0x2c21('0x47')](handleError(_0x1a217b,null));};exports[_0x2c21('0x4a')]=function(_0x1bfcc4,_0x1d5dc6){if(_0x1bfcc4[_0x2c21('0x49')]['id']){delete _0x1bfcc4[_0x2c21('0x49')]['id'];}return db[_0x2c21('0x41')][_0x2c21('0x46')]({'where':{'id':_0x1bfcc4[_0x2c21('0x4b')]['id']}})[_0x2c21('0x25')](handleEntityNotFound(_0x1d5dc6,null))[_0x2c21('0x25')](saveUpdates(_0x1bfcc4[_0x2c21('0x49')],null))[_0x2c21('0x25')](respondWithResult(_0x1d5dc6,null))[_0x2c21('0x47')](handleError(_0x1d5dc6,null));};exports['destroy']=function(_0x39a3df,_0x230cb3){return db['OpenchannelQueueReport'][_0x2c21('0x46')]({'where':{'id':_0x39a3df['params']['id']}})['then'](handleEntityNotFound(_0x230cb3,null))[_0x2c21('0x25')](removeEntity(_0x230cb3,null))[_0x2c21('0x47')](handleError(_0x230cb3,null));};exports[_0x2c21('0x4c')]=function(_0x177d5b,_0x51b7b0){return db[_0x2c21('0x41')]['describe']()['then'](respondWithResult(_0x51b7b0,null))[_0x2c21('0x47')](handleError(_0x51b7b0,null));}; \ No newline at end of file +var _0xfbe7=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','save','destroy','then','sendStatus','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','body','update','rimraf','zip-dir','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1fdcd4,_0x4cc208){var _0x355d6a=function(_0x17826a){while(--_0x17826a){_0x1fdcd4['push'](_0x1fdcd4['shift']());}};_0x355d6a(++_0x4cc208);}(_0xfbe7,0x82));var _0x7fbe=function(_0x150737,_0x5bee68){_0x150737=_0x150737-0x0;var _0x4c0e80=_0xfbe7[_0x150737];return _0x4c0e80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fbe('0x0'));var zipdir=require(_0x7fbe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7fbe('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7fbe('0x3'));var csv=require('to-csv');var ejs=require(_0x7fbe('0x4'));var fs=require('fs');var fs_extra=require(_0x7fbe('0x5'));var _=require(_0x7fbe('0x6'));var squel=require(_0x7fbe('0x7'));var crypto=require(_0x7fbe('0x8'));var jsforce=require(_0x7fbe('0x9'));var deskjs=require(_0x7fbe('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7fbe('0xb'));var Papa=require(_0x7fbe('0xc'));var Redis=require(_0x7fbe('0xd'));var authService=require(_0x7fbe('0xe'));var qs=require(_0x7fbe('0xf'));var as=require(_0x7fbe('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fbe('0x11'))(_0x7fbe('0x12'));var utils=require(_0x7fbe('0x13'));var config=require(_0x7fbe('0x14'));var licenseUtil=require(_0x7fbe('0x15'));var db=require(_0x7fbe('0x16'))['db'];function respondWithStatusCode(_0x50d761,_0x3b7c7e){_0x3b7c7e=_0x3b7c7e||0xcc;return function(_0x1f7cff){if(_0x1f7cff){return _0x50d761['sendStatus'](_0x3b7c7e);}return _0x50d761[_0x7fbe('0x17')](_0x3b7c7e)[_0x7fbe('0x18')]();};}function respondWithResult(_0x41b42f,_0x448d92){_0x448d92=_0x448d92||0xc8;return function(_0x4fe9fc){if(_0x4fe9fc){return _0x41b42f[_0x7fbe('0x17')](_0x448d92)[_0x7fbe('0x19')](_0x4fe9fc);}};}function respondWithFilteredResult(_0x5d2084,_0x3b171d){return function(_0x5337a7){if(_0x5337a7){var _0x1aa9c2=typeof _0x3b171d[_0x7fbe('0x1a')]===_0x7fbe('0x1b')&&typeof _0x3b171d[_0x7fbe('0x1c')]==='undefined';var _0x508266=_0x5337a7[_0x7fbe('0x1d')];var _0x2a4fee=_0x1aa9c2?0x0:_0x3b171d['offset'];var _0x43710f=_0x1aa9c2?_0x5337a7['count']:_0x3b171d[_0x7fbe('0x1a')]+_0x3b171d[_0x7fbe('0x1c')];var _0x34d579;if(_0x43710f>=_0x508266){_0x43710f=_0x508266;_0x34d579=0xc8;}else{_0x34d579=0xce;}_0x5d2084['status'](_0x34d579);return _0x5d2084['set']('Content-Range',_0x2a4fee+'-'+_0x43710f+'/'+_0x508266)['json'](_0x5337a7);}return null;};}function patchUpdates(_0x30847f){return function(_0x4825ab){try{jsonpatch['apply'](_0x4825ab,_0x30847f,!![]);}catch(_0x1036b0){return BPromise['reject'](_0x1036b0);}return _0x4825ab[_0x7fbe('0x1e')]();};}function saveUpdates(_0x388569,_0x20580b){return function(_0x2f6851){if(_0x2f6851){return _0x2f6851['update'](_0x388569)['then'](function(_0xb1963f){return _0xb1963f;});}return null;};}function removeEntity(_0x3c0445,_0x5173fb){return function(_0x5b6669){if(_0x5b6669){return _0x5b6669[_0x7fbe('0x1f')]()[_0x7fbe('0x20')](function(){_0x3c0445['status'](0xcc)[_0x7fbe('0x18')]();});}};}function handleEntityNotFound(_0x10275f,_0x3b356b){return function(_0x2bdc95){if(!_0x2bdc95){_0x10275f[_0x7fbe('0x21')](0x194);}return _0x2bdc95;};}function handleError(_0x4fad93,_0x50c08d){_0x50c08d=_0x50c08d||0x1f4;return function(_0x4d00c4){logger[_0x7fbe('0x22')](_0x4d00c4['stack']);if(_0x4d00c4[_0x7fbe('0x23')]){delete _0x4d00c4['name'];}_0x4fad93['status'](_0x50c08d)[_0x7fbe('0x24')](_0x4d00c4);};}exports[_0x7fbe('0x25')]=function(_0x1006f0,_0x5244dc){var _0x5cb690={},_0x2b15bb={},_0x3e0297={'count':0x0,'rows':[]};var _0xb92f56=_[_0x7fbe('0x26')](db[_0x7fbe('0x27')][_0x7fbe('0x28')],function(_0x1f9dd4){return{'name':_0x1f9dd4[_0x7fbe('0x29')],'type':_0x1f9dd4[_0x7fbe('0x2a')][_0x7fbe('0x2b')]};});_0x2b15bb[_0x7fbe('0x2c')]=_['map'](_0xb92f56,_0x7fbe('0x23'));_0x2b15bb[_0x7fbe('0x2d')]=_[_0x7fbe('0x2e')](_0x1006f0[_0x7fbe('0x2d')]);_0x2b15bb[_0x7fbe('0x2f')]=_[_0x7fbe('0x30')](_0x2b15bb[_0x7fbe('0x2c')],_0x2b15bb[_0x7fbe('0x2d')]);_0x5cb690[_0x7fbe('0x31')]=_[_0x7fbe('0x30')](_0x2b15bb[_0x7fbe('0x2c')],qs[_0x7fbe('0x32')](_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x32')]));_0x5cb690['attributes']=_0x5cb690[_0x7fbe('0x31')][_0x7fbe('0x33')]?_0x5cb690['attributes']:_0x2b15bb[_0x7fbe('0x2c')];if(!_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x34')](_0x7fbe('0x35'))){_0x5cb690['limit']=qs[_0x7fbe('0x1c')](_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x1c')]);_0x5cb690[_0x7fbe('0x1a')]=qs[_0x7fbe('0x1a')](_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x1a')]);}_0x5cb690[_0x7fbe('0x36')]=qs[_0x7fbe('0x37')](_0x1006f0['query'][_0x7fbe('0x37')]);_0x5cb690[_0x7fbe('0x38')]=qs[_0x7fbe('0x2f')](_[_0x7fbe('0x39')](_0x1006f0[_0x7fbe('0x2d')],_0x2b15bb[_0x7fbe('0x2f')]),_0xb92f56);if(_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x3a')]){_0x5cb690[_0x7fbe('0x38')]=_[_0x7fbe('0x3b')](_0x5cb690['where'],{'$or':_[_0x7fbe('0x26')](_0xb92f56,function(_0x3ace53){if(_0x3ace53[_0x7fbe('0x2a')]!==_0x7fbe('0x3c')){var _0x5f3842={};_0x5f3842[_0x3ace53[_0x7fbe('0x23')]]={'$like':'%'+_0x1006f0['query'][_0x7fbe('0x3a')]+'%'};return _0x5f3842;}})});}_0x5cb690=_[_0x7fbe('0x3b')]({},_0x5cb690,_0x1006f0[_0x7fbe('0x3d')]);var _0x908ee6={'where':_0x5cb690[_0x7fbe('0x38')]};return db['OpenchannelQueueReport'][_0x7fbe('0x1d')](_0x908ee6)[_0x7fbe('0x20')](function(_0x1320bc){_0x3e0297[_0x7fbe('0x1d')]=_0x1320bc;if(_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x3e')]){_0x5cb690[_0x7fbe('0x3f')]=[{'all':!![]}];}return db[_0x7fbe('0x27')][_0x7fbe('0x40')](_0x5cb690);})[_0x7fbe('0x20')](function(_0x557191){_0x3e0297[_0x7fbe('0x41')]=_0x557191;return _0x3e0297;})[_0x7fbe('0x20')](respondWithFilteredResult(_0x5244dc,_0x5cb690))['catch'](handleError(_0x5244dc,null));};exports['show']=function(_0x39dbf0,_0x3db3b9){var _0x47be02={'raw':!![],'where':{'id':_0x39dbf0[_0x7fbe('0x42')]['id']}},_0x1e4dd7={};_0x1e4dd7[_0x7fbe('0x2c')]=_['keys'](db[_0x7fbe('0x27')][_0x7fbe('0x28')]);_0x1e4dd7['query']=_[_0x7fbe('0x2e')](_0x39dbf0[_0x7fbe('0x2d')]);_0x1e4dd7[_0x7fbe('0x2f')]=_[_0x7fbe('0x30')](_0x1e4dd7[_0x7fbe('0x2c')],_0x1e4dd7[_0x7fbe('0x2d')]);_0x47be02[_0x7fbe('0x31')]=_[_0x7fbe('0x30')](_0x1e4dd7[_0x7fbe('0x2c')],qs['fields'](_0x39dbf0['query']['fields']));_0x47be02[_0x7fbe('0x31')]=_0x47be02[_0x7fbe('0x31')][_0x7fbe('0x33')]?_0x47be02[_0x7fbe('0x31')]:_0x1e4dd7['model'];if(_0x39dbf0[_0x7fbe('0x2d')][_0x7fbe('0x3e')]){_0x47be02[_0x7fbe('0x3f')]=[{'all':!![]}];}_0x47be02=_[_0x7fbe('0x3b')]({},_0x47be02,_0x39dbf0[_0x7fbe('0x3d')]);return db[_0x7fbe('0x27')][_0x7fbe('0x43')](_0x47be02)['then'](handleEntityNotFound(_0x3db3b9,null))['then'](respondWithResult(_0x3db3b9,null))[_0x7fbe('0x44')](handleError(_0x3db3b9,null));};exports['create']=function(_0xd6a4b4,_0x2fffae){return db[_0x7fbe('0x27')]['create'](_0xd6a4b4[_0x7fbe('0x45')],{})[_0x7fbe('0x20')](respondWithResult(_0x2fffae,0xc9))['catch'](handleError(_0x2fffae,null));};exports[_0x7fbe('0x46')]=function(_0x1afb7a,_0x403965){if(_0x1afb7a[_0x7fbe('0x45')]['id']){delete _0x1afb7a['body']['id'];}return db[_0x7fbe('0x27')]['find']({'where':{'id':_0x1afb7a[_0x7fbe('0x42')]['id']}})[_0x7fbe('0x20')](handleEntityNotFound(_0x403965,null))[_0x7fbe('0x20')](saveUpdates(_0x1afb7a[_0x7fbe('0x45')],null))[_0x7fbe('0x20')](respondWithResult(_0x403965,null))[_0x7fbe('0x44')](handleError(_0x403965,null));};exports[_0x7fbe('0x1f')]=function(_0x3c5b3d,_0x9cb913){return db[_0x7fbe('0x27')][_0x7fbe('0x43')]({'where':{'id':_0x3c5b3d['params']['id']}})[_0x7fbe('0x20')](handleEntityNotFound(_0x9cb913,null))['then'](removeEntity(_0x9cb913,null))[_0x7fbe('0x44')](handleError(_0x9cb913,null));};exports['describe']=function(_0x3a7ee7,_0x4dd24d){return db[_0x7fbe('0x27')]['describe']()[_0x7fbe('0x20')](respondWithResult(_0x4dd24d,null))[_0x7fbe('0x44')](handleError(_0x4dd24d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index b6d0ec5..c5853ba 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x814b,0x1a2));var _0xb814=function(_0x5ff464,_0x5038d7){_0x5ff464=_0x5ff464-0x0;var _0x347182=_0x814b[_0x5ff464];return _0x347182;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x27c421,_0x179355){var _0xc84af5=function(_0x4a43dc){while(--_0x4a43dc){_0x27c421['push'](_0x27c421['shift']());}};_0xc84af5(++_0x179355);}(_0x326f,0xd1));var _0xf326=function(_0x3dffdd,_0x1532b5){_0x3dffdd=_0x3dffdd-0x0;var _0x12a046=_0x326f[_0x3dffdd];return _0x12a046;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 2adb98b..eaffb06 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 _0x97c1=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash'];(function(_0x37b769,_0x2a975d){var _0x288257=function(_0x775d8e){while(--_0x775d8e){_0x37b769['push'](_0x37b769['shift']());}};_0x288257(++_0x2a975d);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});}exports['CreateOpenchannelQueueReport']=function(_0x372311){var _0x47aaa9=this;return new Promise(function(_0x50ac52,_0x1725d9){return db[_0x197c('0x13')][_0x197c('0x14')](_0x372311[_0x197c('0x15')],{'raw':_0x372311['options']?_0x372311[_0x197c('0x16')][_0x197c('0x17')]===undefined?!![]:![]:!![]})[_0x197c('0x18')](function(_0x5c278a){logger[_0x197c('0xa')](_0x197c('0x19'),_0x372311);logger[_0x197c('0x1a')](_0x197c('0x19'),_0x372311,JSON[_0x197c('0xe')](_0x5c278a));_0x50ac52(_0x5c278a);})[_0x197c('0x12')](function(_0x362bbf){logger[_0x197c('0xf')](_0x197c('0x19'),_0x362bbf[_0x197c('0x10')],_0x372311);_0x1725d9(_0x47aaa9[_0x197c('0xf')](0x1f4,_0x362bbf[_0x197c('0x10')]));});});};exports[_0x197c('0x1b')]=function(_0x2a1310){var _0x37b040=this;return new Promise(function(_0x25486a,_0x5f4a02){return db[_0x197c('0x13')][_0x197c('0x1c')](_0x2a1310[_0x197c('0x15')],{'raw':_0x2a1310['options']?_0x2a1310[_0x197c('0x16')][_0x197c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a1310['options']?_0x2a1310['options'][_0x197c('0x1d')]||null:null,'attributes':_0x2a1310['options']?_0x2a1310[_0x197c('0x16')][_0x197c('0x1e')]||null:null,'limit':_0x2a1310[_0x197c('0x16')]?_0x2a1310[_0x197c('0x16')][_0x197c('0x1f')]||null:null})[_0x197c('0x18')](function(_0x2b6154){logger[_0x197c('0xa')](_0x197c('0x1b'),_0x2a1310);logger['debug']('UpdateOpenchannelQueueReport',_0x2a1310,JSON['stringify'](_0x2b6154));_0x25486a(_0x2b6154);})['catch'](function(_0x5f7425){logger['error'](_0x197c('0x1b'),_0x5f7425[_0x197c('0x10')],_0x2a1310);_0x5f4a02(_0x37b040['error'](0x1f4,_0x5f7425[_0x197c('0x10')]));});});}; \ No newline at end of file +var _0xd290=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x23d2ff,_0x21c665){var _0x32725f=function(_0x37bccc){while(--_0x37bccc){_0x23d2ff['push'](_0x23d2ff['shift']());}};_0x32725f(++_0x21c665);}(_0xd290,0x165));var _0x0d29=function(_0x4b71cf,_0x1d5e7c){_0x4b71cf=_0x4b71cf-0x0;var _0x1e234b=_0xd290[_0x4b71cf];return _0x1e234b;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require('moment');var BPromise=require(_0x0d29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d29('0x3'))['db'];var utils=require(_0x0d29('0x4'));var logger=require(_0x0d29('0x5'))(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d29('0x8')][_0x0d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151d32,_0x376d19,_0x276aeb){return new BPromise(function(_0x4edfcd,_0x3ee63c){return client[_0x0d29('0xa')](_0x151d32,_0x276aeb)[_0x0d29('0xb')](function(_0x4b876e){logger[_0x0d29('0xc')](_0x0d29('0xd'),_0x376d19,'request\x20sent');logger[_0x0d29('0xe')](_0x0d29('0xf'),_0x376d19,'request\x20sent',JSON[_0x0d29('0x10')](_0x4b876e));if(_0x4b876e['error']){if(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x12')]===0x1f4){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x3ee63c(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x13')]);}logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x4edfcd(_0x4b876e['error']['message']);}else{logger[_0x0d29('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x376d19,_0x0d29('0x14'));_0x4edfcd(_0x4b876e['result'][_0x0d29('0x13')]);}})[_0x0d29('0x15')](function(_0x2a04d6){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x2a04d6);_0x3ee63c(_0x2a04d6);});});}exports[_0x0d29('0x16')]=function(_0x488fa2){var _0x319a36=this;return new Promise(function(_0x2600b3,_0xca30af){return db[_0x0d29('0x17')][_0x0d29('0x18')](_0x488fa2[_0x0d29('0x19')],{'raw':_0x488fa2[_0x0d29('0x1a')]?_0x488fa2['options'][_0x0d29('0x1b')]===undefined?!![]:![]:!![]})[_0x0d29('0xb')](function(_0x215cd7){logger[_0x0d29('0xc')](_0x0d29('0x16'),_0x488fa2);logger[_0x0d29('0xe')](_0x0d29('0x16'),_0x488fa2,JSON[_0x0d29('0x10')](_0x215cd7));_0x2600b3(_0x215cd7);})[_0x0d29('0x15')](function(_0xed8228){logger[_0x0d29('0x11')](_0x0d29('0x16'),_0xed8228[_0x0d29('0x13')],_0x488fa2);_0xca30af(_0x319a36['error'](0x1f4,_0xed8228[_0x0d29('0x13')]));});});};exports[_0x0d29('0x1c')]=function(_0x2f0fe2){var _0xd3afa0=this;return new Promise(function(_0x4adc85,_0x249205){return db[_0x0d29('0x17')][_0x0d29('0x1d')](_0x2f0fe2[_0x0d29('0x19')],{'raw':_0x2f0fe2[_0x0d29('0x1a')]?_0x2f0fe2[_0x0d29('0x1a')][_0x0d29('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f0fe2['options']?_0x2f0fe2['options'][_0x0d29('0x1e')]||null:null,'attributes':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['attributes']||null:null,'limit':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['limit']||null:null})[_0x0d29('0xb')](function(_0x5c197f){logger[_0x0d29('0xc')](_0x0d29('0x1c'),_0x2f0fe2);logger['debug'](_0x0d29('0x1c'),_0x2f0fe2,JSON[_0x0d29('0x10')](_0x5c197f));_0x4adc85(_0x5c197f);})[_0x0d29('0x15')](function(_0x58caa6){logger[_0x0d29('0x11')](_0x0d29('0x1c'),_0x58caa6[_0x0d29('0x13')],_0x2f0fe2);_0x249205(_0xd3afa0[_0x0d29('0x11')](0x1f4,_0x58caa6[_0x0d29('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 538e4bd..a049db3 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 _0x1e40=['../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2bf4d9,_0xc537b4){var _0x5a8fed=function(_0x452193){while(--_0x452193){_0x2bf4d9['push'](_0x2bf4d9['shift']());}};_0x5a8fed(++_0xc537b4);}(_0x1e40,0x148));var _0x01e4=function(_0x77e4bf,_0x4ff911){_0x77e4bf=_0x77e4bf-0x0;var _0x3aa027=_0x1e40[_0x77e4bf];return _0x3aa027;};'use strict';var multer=require(_0x01e4('0x0'));var util=require(_0x01e4('0x1'));var path=require(_0x01e4('0x2'));var timeout=require(_0x01e4('0x3'));var express=require(_0x01e4('0x4'));var router=express[_0x01e4('0x5')]();var fs_extra=require(_0x01e4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x01e4('0x7'));var config=require(_0x01e4('0x8'));var controller=require(_0x01e4('0x9'));router[_0x01e4('0xa')]('/',auth[_0x01e4('0xb')](),controller[_0x01e4('0xc')]);router[_0x01e4('0xa')](_0x01e4('0xd'),auth[_0x01e4('0xb')](),controller[_0x01e4('0xe')]);router['get'](_0x01e4('0xf'),auth[_0x01e4('0xb')](),controller[_0x01e4('0x10')]);router['post']('/',auth[_0x01e4('0xb')](),controller['create']);router[_0x01e4('0x11')]('/:id',auth[_0x01e4('0xb')](),controller['update']);router[_0x01e4('0x12')](_0x01e4('0xf'),auth[_0x01e4('0xb')](),controller[_0x01e4('0x13')]);module[_0x01e4('0x14')]=router; \ No newline at end of file +var _0x29f9=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','get','/:id','show','post','update'];(function(_0x4e518d,_0x32a45d){var _0x458ff2=function(_0xc96c49){while(--_0xc96c49){_0x4e518d['push'](_0x4e518d['shift']());}};_0x458ff2(++_0x32a45d);}(_0x29f9,0x1c5));var _0x929f=function(_0x44cc07,_0x4ae8f7){_0x44cc07=_0x44cc07-0x0;var _0x59acb4=_0x29f9[_0x44cc07];return _0x59acb4;};'use strict';var multer=require(_0x929f('0x0'));var util=require('util');var path=require(_0x929f('0x1'));var timeout=require(_0x929f('0x2'));var express=require(_0x929f('0x3'));var router=express[_0x929f('0x4')]();var fs_extra=require(_0x929f('0x5'));var auth=require(_0x929f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x929f('0x7'));var controller=require(_0x929f('0x8'));router['get']('/',auth[_0x929f('0x9')](),controller['index']);router[_0x929f('0xa')]('/describe',auth[_0x929f('0x9')](),controller['describe']);router[_0x929f('0xa')](_0x929f('0xb'),auth['isAuthenticated'](),controller[_0x929f('0xc')]);router[_0x929f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x929f('0x9')](),controller[_0x929f('0xe')]);router[_0x929f('0xf')](_0x929f('0xb'),auth[_0x929f('0x9')](),controller[_0x929f('0x10')]);module[_0x929f('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 4be81f9..84efd04 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x552352,_0x51e3b0){var _0x1e0d71=function(_0xa0c4f5){while(--_0xa0c4f5){_0x552352['push'](_0x552352['shift']());}};_0x1e0d71(++_0x51e3b0);}(_0x34e8,0x12c));var _0x834e=function(_0x446073,_0x325311){_0x446073=_0x446073-0x0;var _0x158da0=_0x34e8[_0x446073];return _0x158da0;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x9ac89b,_0x25b61d){var _0x40da74=function(_0x2643a2){while(--_0x2643a2){_0x9ac89b['push'](_0x9ac89b['shift']());}};_0x40da74(++_0x25b61d);}(_0x34e8,0x12c));var _0x834e=function(_0x339bf2,_0x311442){_0x339bf2=_0x339bf2-0x0;var _0x1d3768=_0x34e8[_0x339bf2];return _0x1d3768;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 08861c9..280fa24 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 _0x3a52=['crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','stack','name','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','then','show','params','length','find','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash'];(function(_0x2d2a9b,_0x5870ff){var _0x3d2d49=function(_0x13884d){while(--_0x13884d){_0x2d2a9b['push'](_0x2d2a9b['shift']());}};_0x3d2d49(++_0x5870ff);}(_0x3a52,0xd3));var _0x23a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a52[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x23a5('0x0'));var rimraf=require(_0x23a5('0x1'));var zipdir=require(_0x23a5('0x2'));var jsonpatch=require(_0x23a5('0x3'));var rp=require(_0x23a5('0x4'));var moment=require(_0x23a5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x23a5('0x6'));var util=require('util');var path=require(_0x23a5('0x7'));var sox=require(_0x23a5('0x8'));var csv=require('to-csv');var ejs=require(_0x23a5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23a5('0xa'));var squel=require('squel');var crypto=require(_0x23a5('0xb'));var jsforce=require(_0x23a5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x23a5('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x23a5('0xe'));var authService=require(_0x23a5('0xf'));var qs=require(_0x23a5('0x10'));var as=require(_0x23a5('0x11'));var hardwareService=require(_0x23a5('0x12'));var logger=require('../../config/logger')(_0x23a5('0x13'));var utils=require(_0x23a5('0x14'));var config=require(_0x23a5('0x15'));var licenseUtil=require(_0x23a5('0x16'));var db=require(_0x23a5('0x17'))['db'];function respondWithStatusCode(_0x498816,_0x214941){_0x214941=_0x214941||0xcc;return function(_0x1667f7){if(_0x1667f7){return _0x498816[_0x23a5('0x18')](_0x214941);}return _0x498816[_0x23a5('0x19')](_0x214941)[_0x23a5('0x1a')]();};}function respondWithResult(_0x4e2562,_0x4bdaa0){_0x4bdaa0=_0x4bdaa0||0xc8;return function(_0x409702){if(_0x409702){return _0x4e2562[_0x23a5('0x19')](_0x4bdaa0)[_0x23a5('0x1b')](_0x409702);}};}function respondWithFilteredResult(_0x2c7ca0,_0x1265f1){return function(_0x1cd2cc){if(_0x1cd2cc){var _0x4dead0=typeof _0x1265f1[_0x23a5('0x1c')]===_0x23a5('0x1d')&&typeof _0x1265f1[_0x23a5('0x1e')]===_0x23a5('0x1d');var _0x38a91f=_0x1cd2cc[_0x23a5('0x1f')];var _0x40e1ca=_0x4dead0?0x0:_0x1265f1[_0x23a5('0x1c')];var _0x445350=_0x4dead0?_0x1cd2cc['count']:_0x1265f1[_0x23a5('0x1c')]+_0x1265f1[_0x23a5('0x1e')];var _0x4fb7a4;if(_0x445350>=_0x38a91f){_0x445350=_0x38a91f;_0x4fb7a4=0xc8;}else{_0x4fb7a4=0xce;}_0x2c7ca0[_0x23a5('0x19')](_0x4fb7a4);return _0x2c7ca0[_0x23a5('0x20')](_0x23a5('0x21'),_0x40e1ca+'-'+_0x445350+'/'+_0x38a91f)[_0x23a5('0x1b')](_0x1cd2cc);}return null;};}function patchUpdates(_0x3ad61f){return function(_0x305446){try{jsonpatch[_0x23a5('0x22')](_0x305446,_0x3ad61f,!![]);}catch(_0x9d00c1){return BPromise[_0x23a5('0x23')](_0x9d00c1);}return _0x305446['save']();};}function saveUpdates(_0x2cdccb,_0x246bc3){return function(_0x40a75d){if(_0x40a75d){return _0x40a75d[_0x23a5('0x24')](_0x2cdccb)['then'](function(_0x280eca){return _0x280eca;});}return null;};}function removeEntity(_0x479f3,_0x1b971d){return function(_0x2933bd){if(_0x2933bd){return _0x2933bd[_0x23a5('0x25')]()['then'](function(){_0x479f3[_0x23a5('0x19')](0xcc)[_0x23a5('0x1a')]();});}};}function handleEntityNotFound(_0x144c1e,_0x3c3bdc){return function(_0x13bea2){if(!_0x13bea2){_0x144c1e['sendStatus'](0x194);}return _0x13bea2;};}function handleError(_0x174f16,_0x26b5cd){_0x26b5cd=_0x26b5cd||0x1f4;return function(_0x47d902){logger[_0x23a5('0x26')](_0x47d902[_0x23a5('0x27')]);if(_0x47d902[_0x23a5('0x28')]){delete _0x47d902[_0x23a5('0x28')];}_0x174f16[_0x23a5('0x19')](_0x26b5cd)['send'](_0x47d902);};}exports['index']=function(_0xeeb3b3,_0x248953){var _0x1782f7={},_0x21320a={},_0x1888cb={'count':0x0,'rows':[]};var _0x47c2fb=_[_0x23a5('0x29')](db[_0x23a5('0x2a')]['rawAttributes'],function(_0x25ea37){return{'name':_0x25ea37[_0x23a5('0x2b')],'type':_0x25ea37[_0x23a5('0x2c')][_0x23a5('0x2d')]};});_0x21320a[_0x23a5('0x2e')]=_[_0x23a5('0x29')](_0x47c2fb,'name');_0x21320a[_0x23a5('0x2f')]=_[_0x23a5('0x30')](_0xeeb3b3[_0x23a5('0x2f')]);_0x21320a['filters']=_[_0x23a5('0x31')](_0x21320a[_0x23a5('0x2e')],_0x21320a['query']);_0x1782f7[_0x23a5('0x32')]=_[_0x23a5('0x31')](_0x21320a[_0x23a5('0x2e')],qs[_0x23a5('0x33')](_0xeeb3b3[_0x23a5('0x2f')][_0x23a5('0x33')]));_0x1782f7[_0x23a5('0x32')]=_0x1782f7[_0x23a5('0x32')]['length']?_0x1782f7[_0x23a5('0x32')]:_0x21320a['model'];if(!_0xeeb3b3['query'][_0x23a5('0x34')](_0x23a5('0x35'))){_0x1782f7[_0x23a5('0x1e')]=qs[_0x23a5('0x1e')](_0xeeb3b3[_0x23a5('0x2f')][_0x23a5('0x1e')]);_0x1782f7[_0x23a5('0x1c')]=qs[_0x23a5('0x1c')](_0xeeb3b3['query'][_0x23a5('0x1c')]);}_0x1782f7[_0x23a5('0x36')]=qs[_0x23a5('0x37')](_0xeeb3b3[_0x23a5('0x2f')]['sort']);_0x1782f7['where']=qs[_0x23a5('0x38')](_[_0x23a5('0x39')](_0xeeb3b3[_0x23a5('0x2f')],_0x21320a[_0x23a5('0x38')]),_0x47c2fb);if(_0xeeb3b3[_0x23a5('0x2f')]['filter']){_0x1782f7[_0x23a5('0x3a')]=_[_0x23a5('0x3b')](_0x1782f7[_0x23a5('0x3a')],{'$or':_[_0x23a5('0x29')](_0x47c2fb,function(_0x15a8cb){if(_0x15a8cb['type']!==_0x23a5('0x3c')){var _0xa7843d={};_0xa7843d[_0x15a8cb['name']]={'$like':'%'+_0xeeb3b3[_0x23a5('0x2f')][_0x23a5('0x3d')]+'%'};return _0xa7843d;}})});}_0x1782f7=_['merge']({},_0x1782f7,_0xeeb3b3[_0x23a5('0x3e')]);var _0x46e8e5={'where':_0x1782f7[_0x23a5('0x3a')]};return db[_0x23a5('0x2a')][_0x23a5('0x1f')](_0x46e8e5)['then'](function(_0x4eedcd){_0x1888cb[_0x23a5('0x1f')]=_0x4eedcd;if(_0xeeb3b3[_0x23a5('0x2f')][_0x23a5('0x3f')]){_0x1782f7[_0x23a5('0x40')]=[{'all':!![]}];}return db[_0x23a5('0x2a')]['findAll'](_0x1782f7);})['then'](function(_0x136dff){_0x1888cb[_0x23a5('0x41')]=_0x136dff;return _0x1888cb;})[_0x23a5('0x42')](respondWithFilteredResult(_0x248953,_0x1782f7))['catch'](handleError(_0x248953,null));};exports[_0x23a5('0x43')]=function(_0x5ee15d,_0x48a1fc){var _0x5487e4={'raw':!![],'where':{'id':_0x5ee15d[_0x23a5('0x44')]['id']}},_0x1c7024={};_0x1c7024[_0x23a5('0x2e')]=_[_0x23a5('0x30')](db[_0x23a5('0x2a')]['rawAttributes']);_0x1c7024[_0x23a5('0x2f')]=_[_0x23a5('0x30')](_0x5ee15d[_0x23a5('0x2f')]);_0x1c7024['filters']=_[_0x23a5('0x31')](_0x1c7024[_0x23a5('0x2e')],_0x1c7024[_0x23a5('0x2f')]);_0x5487e4[_0x23a5('0x32')]=_[_0x23a5('0x31')](_0x1c7024[_0x23a5('0x2e')],qs[_0x23a5('0x33')](_0x5ee15d['query'][_0x23a5('0x33')]));_0x5487e4['attributes']=_0x5487e4['attributes'][_0x23a5('0x45')]?_0x5487e4[_0x23a5('0x32')]:_0x1c7024[_0x23a5('0x2e')];if(_0x5ee15d[_0x23a5('0x2f')][_0x23a5('0x3f')]){_0x5487e4['include']=[{'all':!![]}];}_0x5487e4=_[_0x23a5('0x3b')]({},_0x5487e4,_0x5ee15d[_0x23a5('0x3e')]);return db[_0x23a5('0x2a')][_0x23a5('0x46')](_0x5487e4)['then'](handleEntityNotFound(_0x48a1fc,null))['then'](respondWithResult(_0x48a1fc,null))['catch'](handleError(_0x48a1fc,null));};exports['create']=function(_0x2267e9,_0x2523ee){return db[_0x23a5('0x2a')]['create'](_0x2267e9[_0x23a5('0x47')],{})['then'](respondWithResult(_0x2523ee,0xc9))[_0x23a5('0x48')](handleError(_0x2523ee,null));};exports[_0x23a5('0x24')]=function(_0x286ae2,_0x5dacd2){if(_0x286ae2['body']['id']){delete _0x286ae2['body']['id'];}return db[_0x23a5('0x2a')]['find']({'where':{'id':_0x286ae2[_0x23a5('0x44')]['id']}})[_0x23a5('0x42')](handleEntityNotFound(_0x5dacd2,null))[_0x23a5('0x42')](saveUpdates(_0x286ae2[_0x23a5('0x47')],null))['then'](respondWithResult(_0x5dacd2,null))[_0x23a5('0x48')](handleError(_0x5dacd2,null));};exports[_0x23a5('0x25')]=function(_0x41c70a,_0x5f00c4){return db[_0x23a5('0x2a')][_0x23a5('0x46')]({'where':{'id':_0x41c70a[_0x23a5('0x44')]['id']}})[_0x23a5('0x42')](handleEntityNotFound(_0x5f00c4,null))['then'](removeEntity(_0x5f00c4,null))[_0x23a5('0x48')](handleError(_0x5f00c4,null));};exports[_0x23a5('0x49')]=function(_0x4e2a9d,_0x381adc){return db[_0x23a5('0x2a')]['describe']()[_0x23a5('0x42')](respondWithResult(_0x381adc,null))[_0x23a5('0x48')](handleError(_0x381adc,null));}; \ No newline at end of file +var _0xfe95=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','params','length','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xfe95,0xd5));var _0x5fe9=function(_0x3af2ff,_0x39ab4d){_0x3af2ff=_0x3af2ff-0x0;var _0x5657cb=_0xfe95[_0x3af2ff];return _0x5657cb;};'use strict';var emlformat=require(_0x5fe9('0x0'));var rimraf=require(_0x5fe9('0x1'));var zipdir=require(_0x5fe9('0x2'));var jsonpatch=require(_0x5fe9('0x3'));var rp=require(_0x5fe9('0x4'));var moment=require(_0x5fe9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5fe9('0x6'));var path=require(_0x5fe9('0x7'));var sox=require(_0x5fe9('0x8'));var csv=require(_0x5fe9('0x9'));var ejs=require(_0x5fe9('0xa'));var fs=require('fs');var fs_extra=require(_0x5fe9('0xb'));var _=require(_0x5fe9('0xc'));var squel=require(_0x5fe9('0xd'));var crypto=require('crypto');var jsforce=require(_0x5fe9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5fe9('0xf'));var Papa=require('papaparse');var Redis=require(_0x5fe9('0x10'));var authService=require(_0x5fe9('0x11'));var qs=require(_0x5fe9('0x12'));var as=require(_0x5fe9('0x13'));var hardwareService=require(_0x5fe9('0x14'));var logger=require(_0x5fe9('0x15'))(_0x5fe9('0x16'));var utils=require(_0x5fe9('0x17'));var config=require(_0x5fe9('0x18'));var licenseUtil=require(_0x5fe9('0x19'));var db=require(_0x5fe9('0x1a'))['db'];function respondWithStatusCode(_0x5dbc2d,_0x3b1e70){_0x3b1e70=_0x3b1e70||0xcc;return function(_0x36e766){if(_0x36e766){return _0x5dbc2d[_0x5fe9('0x1b')](_0x3b1e70);}return _0x5dbc2d[_0x5fe9('0x1c')](_0x3b1e70)[_0x5fe9('0x1d')]();};}function respondWithResult(_0x13128b,_0x5d40d4){_0x5d40d4=_0x5d40d4||0xc8;return function(_0x1481a6){if(_0x1481a6){return _0x13128b[_0x5fe9('0x1c')](_0x5d40d4)[_0x5fe9('0x1e')](_0x1481a6);}};}function respondWithFilteredResult(_0x1ddb1e,_0x26fea8){return function(_0x170c58){if(_0x170c58){var _0x529457=typeof _0x26fea8['offset']===_0x5fe9('0x1f')&&typeof _0x26fea8[_0x5fe9('0x20')]===_0x5fe9('0x1f');var _0x54eecf=_0x170c58[_0x5fe9('0x21')];var _0x16cb61=_0x529457?0x0:_0x26fea8['offset'];var _0x4bdb60=_0x529457?_0x170c58[_0x5fe9('0x21')]:_0x26fea8[_0x5fe9('0x22')]+_0x26fea8[_0x5fe9('0x20')];var _0x11e7cf;if(_0x4bdb60>=_0x54eecf){_0x4bdb60=_0x54eecf;_0x11e7cf=0xc8;}else{_0x11e7cf=0xce;}_0x1ddb1e[_0x5fe9('0x1c')](_0x11e7cf);return _0x1ddb1e[_0x5fe9('0x23')](_0x5fe9('0x24'),_0x16cb61+'-'+_0x4bdb60+'/'+_0x54eecf)['json'](_0x170c58);}return null;};}function patchUpdates(_0x542272){return function(_0x15ba89){try{jsonpatch[_0x5fe9('0x25')](_0x15ba89,_0x542272,!![]);}catch(_0x527e3e){return BPromise[_0x5fe9('0x26')](_0x527e3e);}return _0x15ba89[_0x5fe9('0x27')]();};}function saveUpdates(_0x5233b0,_0x1f9cde){return function(_0x129746){if(_0x129746){return _0x129746[_0x5fe9('0x28')](_0x5233b0)[_0x5fe9('0x29')](function(_0xb1fb3){return _0xb1fb3;});}return null;};}function removeEntity(_0x1eef25,_0x3b71c1){return function(_0x44f09e){if(_0x44f09e){return _0x44f09e[_0x5fe9('0x2a')]()[_0x5fe9('0x29')](function(){_0x1eef25[_0x5fe9('0x1c')](0xcc)[_0x5fe9('0x1d')]();});}};}function handleEntityNotFound(_0x313a96,_0xb1cbbf){return function(_0x6de5eb){if(!_0x6de5eb){_0x313a96[_0x5fe9('0x1b')](0x194);}return _0x6de5eb;};}function handleError(_0x54b831,_0x55e4b3){_0x55e4b3=_0x55e4b3||0x1f4;return function(_0x1b8b19){logger[_0x5fe9('0x2b')](_0x1b8b19['stack']);if(_0x1b8b19[_0x5fe9('0x2c')]){delete _0x1b8b19[_0x5fe9('0x2c')];}_0x54b831[_0x5fe9('0x1c')](_0x55e4b3)[_0x5fe9('0x2d')](_0x1b8b19);};}exports[_0x5fe9('0x2e')]=function(_0x4cb4ca,_0x243032){var _0x5f20b3={},_0x30f9d5={},_0x13e437={'count':0x0,'rows':[]};var _0x3817ef=_[_0x5fe9('0x2f')](db['OpenchannelTransferReport'][_0x5fe9('0x30')],function(_0x337574){return{'name':_0x337574['fieldName'],'type':_0x337574[_0x5fe9('0x31')][_0x5fe9('0x32')]};});_0x30f9d5[_0x5fe9('0x33')]=_[_0x5fe9('0x2f')](_0x3817ef,'name');_0x30f9d5[_0x5fe9('0x34')]=_[_0x5fe9('0x35')](_0x4cb4ca['query']);_0x30f9d5[_0x5fe9('0x36')]=_[_0x5fe9('0x37')](_0x30f9d5[_0x5fe9('0x33')],_0x30f9d5['query']);_0x5f20b3[_0x5fe9('0x38')]=_[_0x5fe9('0x37')](_0x30f9d5['model'],qs[_0x5fe9('0x39')](_0x4cb4ca[_0x5fe9('0x34')][_0x5fe9('0x39')]));_0x5f20b3['attributes']=_0x5f20b3[_0x5fe9('0x38')]['length']?_0x5f20b3['attributes']:_0x30f9d5[_0x5fe9('0x33')];if(!_0x4cb4ca[_0x5fe9('0x34')][_0x5fe9('0x3a')](_0x5fe9('0x3b'))){_0x5f20b3[_0x5fe9('0x20')]=qs[_0x5fe9('0x20')](_0x4cb4ca['query'][_0x5fe9('0x20')]);_0x5f20b3[_0x5fe9('0x22')]=qs[_0x5fe9('0x22')](_0x4cb4ca[_0x5fe9('0x34')][_0x5fe9('0x22')]);}_0x5f20b3[_0x5fe9('0x3c')]=qs['sort'](_0x4cb4ca[_0x5fe9('0x34')][_0x5fe9('0x3d')]);_0x5f20b3[_0x5fe9('0x3e')]=qs[_0x5fe9('0x36')](_['pick'](_0x4cb4ca[_0x5fe9('0x34')],_0x30f9d5[_0x5fe9('0x36')]),_0x3817ef);if(_0x4cb4ca['query'][_0x5fe9('0x3f')]){_0x5f20b3[_0x5fe9('0x3e')]=_[_0x5fe9('0x40')](_0x5f20b3[_0x5fe9('0x3e')],{'$or':_['map'](_0x3817ef,function(_0x1d924b){if(_0x1d924b[_0x5fe9('0x31')]!=='VIRTUAL'){var _0x4bf80b={};_0x4bf80b[_0x1d924b[_0x5fe9('0x2c')]]={'$like':'%'+_0x4cb4ca['query'][_0x5fe9('0x3f')]+'%'};return _0x4bf80b;}})});}_0x5f20b3=_['merge']({},_0x5f20b3,_0x4cb4ca['options']);var _0x24bfe7={'where':_0x5f20b3[_0x5fe9('0x3e')]};return db[_0x5fe9('0x41')][_0x5fe9('0x21')](_0x24bfe7)[_0x5fe9('0x29')](function(_0x32185e){_0x13e437['count']=_0x32185e;if(_0x4cb4ca['query'][_0x5fe9('0x42')]){_0x5f20b3[_0x5fe9('0x43')]=[{'all':!![]}];}return db[_0x5fe9('0x41')][_0x5fe9('0x44')](_0x5f20b3);})[_0x5fe9('0x29')](function(_0x2f0028){_0x13e437[_0x5fe9('0x45')]=_0x2f0028;return _0x13e437;})[_0x5fe9('0x29')](respondWithFilteredResult(_0x243032,_0x5f20b3))[_0x5fe9('0x46')](handleError(_0x243032,null));};exports['show']=function(_0x457570,_0x8d264){var _0x457b5f={'raw':!![],'where':{'id':_0x457570[_0x5fe9('0x47')]['id']}},_0x792f46={};_0x792f46[_0x5fe9('0x33')]=_[_0x5fe9('0x35')](db[_0x5fe9('0x41')]['rawAttributes']);_0x792f46['query']=_[_0x5fe9('0x35')](_0x457570['query']);_0x792f46[_0x5fe9('0x36')]=_[_0x5fe9('0x37')](_0x792f46[_0x5fe9('0x33')],_0x792f46['query']);_0x457b5f[_0x5fe9('0x38')]=_['intersection'](_0x792f46[_0x5fe9('0x33')],qs['fields'](_0x457570['query'][_0x5fe9('0x39')]));_0x457b5f['attributes']=_0x457b5f[_0x5fe9('0x38')][_0x5fe9('0x48')]?_0x457b5f['attributes']:_0x792f46['model'];if(_0x457570[_0x5fe9('0x34')][_0x5fe9('0x42')]){_0x457b5f[_0x5fe9('0x43')]=[{'all':!![]}];}_0x457b5f=_[_0x5fe9('0x40')]({},_0x457b5f,_0x457570[_0x5fe9('0x49')]);return db['OpenchannelTransferReport']['find'](_0x457b5f)[_0x5fe9('0x29')](handleEntityNotFound(_0x8d264,null))[_0x5fe9('0x29')](respondWithResult(_0x8d264,null))['catch'](handleError(_0x8d264,null));};exports[_0x5fe9('0x4a')]=function(_0x4633ee,_0x185063){return db[_0x5fe9('0x41')][_0x5fe9('0x4a')](_0x4633ee[_0x5fe9('0x4b')],{})[_0x5fe9('0x29')](respondWithResult(_0x185063,0xc9))[_0x5fe9('0x46')](handleError(_0x185063,null));};exports['update']=function(_0x2a6958,_0x1c6eb2){if(_0x2a6958[_0x5fe9('0x4b')]['id']){delete _0x2a6958[_0x5fe9('0x4b')]['id'];}return db['OpenchannelTransferReport'][_0x5fe9('0x4c')]({'where':{'id':_0x2a6958[_0x5fe9('0x47')]['id']}})[_0x5fe9('0x29')](handleEntityNotFound(_0x1c6eb2,null))[_0x5fe9('0x29')](saveUpdates(_0x2a6958['body'],null))['then'](respondWithResult(_0x1c6eb2,null))[_0x5fe9('0x46')](handleError(_0x1c6eb2,null));};exports[_0x5fe9('0x2a')]=function(_0x4a1fbb,_0x13f474){return db[_0x5fe9('0x41')][_0x5fe9('0x4c')]({'where':{'id':_0x4a1fbb[_0x5fe9('0x47')]['id']}})['then'](handleEntityNotFound(_0x13f474,null))[_0x5fe9('0x29')](removeEntity(_0x13f474,null))['catch'](handleError(_0x13f474,null));};exports[_0x5fe9('0x4d')]=function(_0x19df59,_0x4c62cf){return db['OpenchannelTransferReport'][_0x5fe9('0x4d')]()['then'](respondWithResult(_0x4c62cf,null))[_0x5fe9('0x46')](handleError(_0x4c62cf,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ea8bc06..f48fdb8 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 _0x8626=['moment','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8626,0xc0));var _0x6862=function(_0x21b408,_0x405f04){_0x21b408=_0x21b408-0x0;var _0x551d6b=_0x8626[_0x21b408];return _0x551d6b;};'use strict';var _=require(_0x6862('0x0'));var util=require(_0x6862('0x1'));var logger=require(_0x6862('0x2'))(_0x6862('0x3'));var moment=require(_0x6862('0x4'));var BPromise=require('bluebird');var rp=require(_0x6862('0x5'));var fs=require('fs');var path=require(_0x6862('0x6'));var rimraf=require('rimraf');var config=require(_0x6862('0x7'));var attributes=require(_0x6862('0x8'));module[_0x6862('0x9')]=function(_0x51bbca,_0x328551){return _0x51bbca[_0x6862('0xa')](_0x6862('0xb'),attributes,{'tableName':_0x6862('0xc'),'paranoid':![],'indexes':[{'name':_0x6862('0xd'),'fields':[_0x6862('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9593=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x19c037,_0x3269b3){var _0x2dc6b8=function(_0x3f43a7){while(--_0x3f43a7){_0x19c037['push'](_0x19c037['shift']());}};_0x2dc6b8(++_0x3269b3);}(_0x9593,0x1db));var _0x3959=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x9593[_0x571c1d];return _0x33c609;};'use strict';var _=require(_0x3959('0x0'));var util=require(_0x3959('0x1'));var logger=require('../../config/logger')(_0x3959('0x2'));var moment=require(_0x3959('0x3'));var BPromise=require(_0x3959('0x4'));var rp=require(_0x3959('0x5'));var fs=require('fs');var path=require(_0x3959('0x6'));var rimraf=require('rimraf');var config=require(_0x3959('0x7'));var attributes=require(_0x3959('0x8'));module[_0x3959('0x9')]=function(_0x2af95d,_0x15823d){return _0x2af95d[_0x3959('0xa')](_0x3959('0xb'),attributes,{'tableName':_0x3959('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3959('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index e9df70f..e4562e3 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 _0x9fc5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment'];(function(_0x43c6d1,_0x20edf8){var _0x334a91=function(_0x499115){while(--_0x499115){_0x43c6d1['push'](_0x43c6d1['shift']());}};_0x334a91(++_0x20edf8);}(_0x9fc5,0xb6));var _0x59fc=function(_0x4a96d2,_0x689504){_0x4a96d2=_0x4a96d2-0x0;var _0x38af04=_0x9fc5[_0x4a96d2];return _0x38af04;};'use strict';var _=require('lodash');var util=require(_0x59fc('0x0'));var moment=require(_0x59fc('0x1'));var BPromise=require('bluebird');var rs=require(_0x59fc('0x2'));var fs=require('fs');var Redis=require(_0x59fc('0x3'));var db=require(_0x59fc('0x4'))['db'];var utils=require(_0x59fc('0x5'));var logger=require(_0x59fc('0x6'))(_0x59fc('0x7'));var config=require(_0x59fc('0x8'));var jayson=require(_0x59fc('0x9'));var client=jayson['client'][_0x59fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13897f,_0x2c47fb,_0x55fa6d){return new BPromise(function(_0xdd2bb9,_0x313063){return client[_0x59fc('0xb')](_0x13897f,_0x55fa6d)[_0x59fc('0xc')](function(_0x39bc72){logger[_0x59fc('0xd')](_0x59fc('0xe'),_0x2c47fb,'request\x20sent');logger[_0x59fc('0xf')](_0x59fc('0x10'),_0x2c47fb,_0x59fc('0x11'),JSON[_0x59fc('0x12')](_0x39bc72));if(_0x39bc72[_0x59fc('0x13')]){if(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x14')]===0x1f4){logger['error'](_0x59fc('0xe'),_0x2c47fb,_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);return _0x313063(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);}logger[_0x59fc('0x13')](_0x59fc('0xe'),_0x2c47fb,_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);return _0xdd2bb9(_0x39bc72[_0x59fc('0x13')][_0x59fc('0x15')]);}else{logger['info'](_0x59fc('0xe'),_0x2c47fb,_0x59fc('0x11'));_0xdd2bb9(_0x39bc72['result'][_0x59fc('0x15')]);}})[_0x59fc('0x16')](function(_0x4162c4){logger[_0x59fc('0x13')](_0x59fc('0xe'),_0x2c47fb,_0x4162c4);_0x313063(_0x4162c4);});});} \ No newline at end of file +var _0xa990=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xa990,0xc9));var _0x0a99=function(_0x12a910,_0x50d299){_0x12a910=_0x12a910-0x0;var _0x490af7=_0xa990[_0x12a910];return _0x490af7;};'use strict';var _=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var moment=require(_0x0a99('0x2'));var BPromise=require(_0x0a99('0x3'));var rs=require(_0x0a99('0x4'));var fs=require('fs');var Redis=require(_0x0a99('0x5'));var db=require(_0x0a99('0x6'))['db'];var utils=require(_0x0a99('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a99('0x8'));var jayson=require(_0x0a99('0x9'));var client=jayson[_0x0a99('0xa')][_0x0a99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b195,_0x398d95,_0xc6001b){return new BPromise(function(_0x599c7,_0x3cf0ef){return client[_0x0a99('0xc')](_0x45b195,_0xc6001b)[_0x0a99('0xd')](function(_0x56810b){logger[_0x0a99('0xe')](_0x0a99('0xf'),_0x398d95,'request\x20sent');logger['debug'](_0x0a99('0x10'),_0x398d95,_0x0a99('0x11'),JSON[_0x0a99('0x12')](_0x56810b));if(_0x56810b[_0x0a99('0x13')]){if(_0x56810b[_0x0a99('0x13')]['code']===0x1f4){logger[_0x0a99('0x13')](_0x0a99('0xf'),_0x398d95,_0x56810b['error'][_0x0a99('0x14')]);return _0x3cf0ef(_0x56810b[_0x0a99('0x13')][_0x0a99('0x14')]);}logger[_0x0a99('0x13')](_0x0a99('0xf'),_0x398d95,_0x56810b[_0x0a99('0x13')][_0x0a99('0x14')]);return _0x599c7(_0x56810b[_0x0a99('0x13')]['message']);}else{logger['info'](_0x0a99('0xf'),_0x398d95,_0x0a99('0x11'));_0x599c7(_0x56810b[_0x0a99('0x15')]['message']);}})[_0x0a99('0x16')](function(_0x5c91f9){logger['error'](_0x0a99('0xf'),_0x398d95,_0x5c91f9);_0x3cf0ef(_0x5c91f9);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ffe9644..b61ea39 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 _0xbd9a=['update','delete','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x196e05,_0x11204a){var _0x162ae3=function(_0x363beb){while(--_0x363beb){_0x196e05['push'](_0x196e05['shift']());}};_0x162ae3(++_0x11204a);}(_0xbd9a,0x157));var _0xabd9=function(_0x56525e,_0x101ba8){_0x56525e=_0x56525e-0x0;var _0x20b22c=_0xbd9a[_0x56525e];return _0x20b22c;};'use strict';var multer=require(_0xabd9('0x0'));var util=require('util');var path=require(_0xabd9('0x1'));var timeout=require('connect-timeout');var express=require(_0xabd9('0x2'));var router=express['Router']();var fs_extra=require(_0xabd9('0x3'));var auth=require(_0xabd9('0x4'));var interaction=require(_0xabd9('0x5'));var config=require('../../config/environment');var controller=require(_0xabd9('0x6'));router[_0xabd9('0x7')]('/',auth[_0xabd9('0x8')](),controller['index']);router[_0xabd9('0x7')]('/:id',auth[_0xabd9('0x8')](),controller[_0xabd9('0x9')]);router[_0xabd9('0xa')]('/',auth[_0xabd9('0x8')](),controller[_0xabd9('0xb')]);router[_0xabd9('0xc')](_0xabd9('0xd'),auth[_0xabd9('0x8')](),controller[_0xabd9('0xe')]);router[_0xabd9('0xf')]('/:id',auth[_0xabd9('0x8')](),controller['destroy']);module[_0xabd9('0x10')]=router; \ No newline at end of file +var _0xcd96=['fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','show','post','create','put','delete','/:id','exports','util','path','connect-timeout','express','Router'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xcd96,0x1e1));var _0x6cd9=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xcd96[_0x5eb22e];return _0x27fed5;};'use strict';var multer=require('multer');var util=require(_0x6cd9('0x0'));var path=require(_0x6cd9('0x1'));var timeout=require(_0x6cd9('0x2'));var express=require(_0x6cd9('0x3'));var router=express[_0x6cd9('0x4')]();var fs_extra=require(_0x6cd9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6cd9('0x6'));var config=require(_0x6cd9('0x7'));var controller=require(_0x6cd9('0x8'));router[_0x6cd9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x6cd9('0xa')](),controller[_0x6cd9('0xb')]);router[_0x6cd9('0xc')]('/',auth[_0x6cd9('0xa')](),controller[_0x6cd9('0xd')]);router[_0x6cd9('0xe')]('/:id',auth[_0x6cd9('0xa')](),controller['update']);router[_0x6cd9('0xf')](_0x6cd9('0x10'),auth[_0x6cd9('0xa')](),controller['destroy']);module[_0x6cd9('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index da52cae..4cc8f69 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 _0x1e48=['exports','STRING','name','sequelize'];(function(_0x1c2d28,_0x305b58){var _0x56c101=function(_0xf8eb23){while(--_0xf8eb23){_0x1c2d28['push'](_0x1c2d28['shift']());}};_0x56c101(++_0x305b58);}(_0x1e48,0x15b));var _0x81e4=function(_0x9bfc6c,_0x159ef2){_0x9bfc6c=_0x9bfc6c-0x0;var _0x1f8376=_0x1e48[_0x9bfc6c];return _0x1f8376;};'use strict';var Sequelize=require(_0x81e4('0x0'));module[_0x81e4('0x1')]={'name':{'type':Sequelize[_0x81e4('0x2')],'unique':_0x81e4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x81e4('0x2')]}}; \ No newline at end of file +var _0xdaad=['sequelize','STRING'];(function(_0x1b376c,_0x19f3c1){var _0x429a60=function(_0xe76a08){while(--_0xe76a08){_0x1b376c['push'](_0x1b376c['shift']());}};_0x429a60(++_0x19f3c1);}(_0xdaad,0x16a));var _0xddaa=function(_0x153b2f,_0x5a9b00){_0x153b2f=_0x153b2f-0x0;var _0x3bca6c=_0xdaad[_0x153b2f];return _0x3bca6c;};'use strict';var Sequelize=require(_0xddaa('0x0'));module['exports']={'name':{'type':Sequelize[_0xddaa('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xddaa('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b2b5d1f..894a5ee 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 _0xfa5b=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Pauses','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','includeAll','include','find'];(function(_0x3f2f19,_0x2ea0c4){var _0x18f929=function(_0x358d09){while(--_0x358d09){_0x3f2f19['push'](_0x3f2f19['shift']());}};_0x18f929(++_0x2ea0c4);}(_0xfa5b,0x152));var _0xbfa5=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xfa5b[_0x5c9307];return _0x373e29;};'use strict';var emlformat=require(_0xbfa5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbfa5('0x1'));var jsonpatch=require(_0xbfa5('0x2'));var rp=require(_0xbfa5('0x3'));var moment=require('moment');var BPromise=require(_0xbfa5('0x4'));var Mustache=require(_0xbfa5('0x5'));var util=require('util');var path=require(_0xbfa5('0x6'));var sox=require(_0xbfa5('0x7'));var csv=require(_0xbfa5('0x8'));var ejs=require(_0xbfa5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbfa5('0xa'));var squel=require('squel');var crypto=require(_0xbfa5('0xb'));var jsforce=require(_0xbfa5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbfa5('0x8'));var querystring=require(_0xbfa5('0xd'));var Papa=require(_0xbfa5('0xe'));var Redis=require('ioredis');var authService=require(_0xbfa5('0xf'));var qs=require(_0xbfa5('0x10'));var as=require(_0xbfa5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbfa5('0x12'))(_0xbfa5('0x13'));var utils=require(_0xbfa5('0x14'));var config=require(_0xbfa5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbfa5('0x16'))['db'];function respondWithStatusCode(_0x35944a,_0x74a955){_0x74a955=_0x74a955||0xcc;return function(_0x358ba6){if(_0x358ba6){return _0x35944a[_0xbfa5('0x17')](_0x74a955);}return _0x35944a[_0xbfa5('0x18')](_0x74a955)[_0xbfa5('0x19')]();};}function respondWithResult(_0x265c6a,_0x11bc78){_0x11bc78=_0x11bc78||0xc8;return function(_0x305316){if(_0x305316){return _0x265c6a[_0xbfa5('0x18')](_0x11bc78)[_0xbfa5('0x1a')](_0x305316);}};}function respondWithFilteredResult(_0x5abf3a,_0x34475e){return function(_0x124546){if(_0x124546){var _0x56f96a=typeof _0x34475e['offset']==='undefined'&&typeof _0x34475e[_0xbfa5('0x1b')]==='undefined';var _0x1027ed=_0x124546['count'];var _0x4f1a2c=_0x56f96a?0x0:_0x34475e[_0xbfa5('0x1c')];var _0x3400e2=_0x56f96a?_0x124546[_0xbfa5('0x1d')]:_0x34475e[_0xbfa5('0x1c')]+_0x34475e['limit'];var _0xe71025;if(_0x3400e2>=_0x1027ed){_0x3400e2=_0x1027ed;_0xe71025=0xc8;}else{_0xe71025=0xce;}_0x5abf3a[_0xbfa5('0x18')](_0xe71025);return _0x5abf3a[_0xbfa5('0x1e')](_0xbfa5('0x1f'),_0x4f1a2c+'-'+_0x3400e2+'/'+_0x1027ed)[_0xbfa5('0x1a')](_0x124546);}return null;};}function patchUpdates(_0x567f18){return function(_0x3b5f83){try{jsonpatch[_0xbfa5('0x20')](_0x3b5f83,_0x567f18,!![]);}catch(_0x1d62c9){return BPromise[_0xbfa5('0x21')](_0x1d62c9);}return _0x3b5f83[_0xbfa5('0x22')]();};}function saveUpdates(_0x4abae3,_0x3a5a20){return function(_0xbc74fc){if(_0xbc74fc){return _0xbc74fc[_0xbfa5('0x23')](_0x4abae3)['then'](function(_0x2b1f4d){return _0x2b1f4d;});}return null;};}function removeEntity(_0x427f1c,_0x326252){return function(_0x16fca8){if(_0x16fca8){return _0x16fca8[_0xbfa5('0x24')]()[_0xbfa5('0x25')](function(){var _0x1638b9=_0x16fca8[_0xbfa5('0x26')]({'plain':!![]});var _0x12f681=_0xbfa5('0x27');return db['UserProfileResource'][_0xbfa5('0x24')]({'where':{'type':_0x12f681,'resourceId':_0x1638b9['id']}})[_0xbfa5('0x25')](function(){return _0x16fca8;});})[_0xbfa5('0x25')](function(){_0x427f1c['status'](0xcc)[_0xbfa5('0x19')]();});}};}function handleEntityNotFound(_0x41c54c,_0x5511d6){return function(_0x403e58){if(!_0x403e58){_0x41c54c['sendStatus'](0x194);}return _0x403e58;};}function handleError(_0x1e8549,_0x5d7eb9){_0x5d7eb9=_0x5d7eb9||0x1f4;return function(_0x579991){logger[_0xbfa5('0x28')](_0x579991['stack']);if(_0x579991[_0xbfa5('0x29')]){delete _0x579991[_0xbfa5('0x29')];}_0x1e8549['status'](_0x5d7eb9)[_0xbfa5('0x2a')](_0x579991);};}exports[_0xbfa5('0x2b')]=function(_0x51046e,_0x33fa8c){var _0x2d6730={},_0x1c58e5={},_0x114bde={'count':0x0,'rows':[]};var _0x38d92f=_[_0xbfa5('0x2c')](db[_0xbfa5('0x2d')][_0xbfa5('0x2e')],function(_0x296650){return{'name':_0x296650[_0xbfa5('0x2f')],'type':_0x296650[_0xbfa5('0x30')][_0xbfa5('0x31')]};});_0x1c58e5[_0xbfa5('0x32')]=_[_0xbfa5('0x2c')](_0x38d92f,_0xbfa5('0x29'));_0x1c58e5[_0xbfa5('0x33')]=_[_0xbfa5('0x34')](_0x51046e[_0xbfa5('0x33')]);_0x1c58e5['filters']=_[_0xbfa5('0x35')](_0x1c58e5[_0xbfa5('0x32')],_0x1c58e5[_0xbfa5('0x33')]);_0x2d6730[_0xbfa5('0x36')]=_[_0xbfa5('0x35')](_0x1c58e5[_0xbfa5('0x32')],qs[_0xbfa5('0x37')](_0x51046e[_0xbfa5('0x33')][_0xbfa5('0x37')]));_0x2d6730[_0xbfa5('0x36')]=_0x2d6730[_0xbfa5('0x36')][_0xbfa5('0x38')]?_0x2d6730['attributes']:_0x1c58e5[_0xbfa5('0x32')];if(!_0x51046e['query'][_0xbfa5('0x39')]('nolimit')){_0x2d6730[_0xbfa5('0x1b')]=qs[_0xbfa5('0x1b')](_0x51046e[_0xbfa5('0x33')][_0xbfa5('0x1b')]);_0x2d6730[_0xbfa5('0x1c')]=qs['offset'](_0x51046e[_0xbfa5('0x33')]['offset']);}_0x2d6730['order']=qs['sort'](_0x51046e[_0xbfa5('0x33')]['sort']);_0x2d6730[_0xbfa5('0x3a')]=qs[_0xbfa5('0x3b')](_[_0xbfa5('0x3c')](_0x51046e[_0xbfa5('0x33')],_0x1c58e5[_0xbfa5('0x3b')]),_0x38d92f);if(_0x51046e[_0xbfa5('0x33')]['filter']){_0x2d6730[_0xbfa5('0x3a')]=_[_0xbfa5('0x3d')](_0x2d6730[_0xbfa5('0x3a')],{'$or':_[_0xbfa5('0x2c')](_0x38d92f,function(_0x26871b){if(_0x26871b[_0xbfa5('0x30')]!==_0xbfa5('0x3e')){var _0x332f94={};_0x332f94[_0x26871b['name']]={'$like':'%'+_0x51046e[_0xbfa5('0x33')][_0xbfa5('0x3f')]+'%'};return _0x332f94;}})});}_0x2d6730=_['merge']({},_0x2d6730,_0x51046e[_0xbfa5('0x40')]);var _0x227375={'where':_0x2d6730['where']};return db[_0xbfa5('0x2d')][_0xbfa5('0x1d')](_0x227375)['then'](function(_0x4e1896){_0x114bde[_0xbfa5('0x1d')]=_0x4e1896;if(_0x51046e[_0xbfa5('0x33')]['includeAll']){_0x2d6730['include']=[{'all':!![]}];}return db[_0xbfa5('0x2d')][_0xbfa5('0x41')](_0x2d6730);})[_0xbfa5('0x25')](function(_0x4033bf){_0x114bde[_0xbfa5('0x42')]=_0x4033bf;return _0x114bde;})['then'](respondWithFilteredResult(_0x33fa8c,_0x2d6730))[_0xbfa5('0x43')](handleError(_0x33fa8c,null));};exports[_0xbfa5('0x44')]=function(_0x5cbb67,_0x597250){var _0x4577f0={'raw':!![],'where':{'id':_0x5cbb67['params']['id']}},_0x1eaff8={};_0x1eaff8['model']=_[_0xbfa5('0x34')](db['Pause'][_0xbfa5('0x2e')]);_0x1eaff8[_0xbfa5('0x33')]=_[_0xbfa5('0x34')](_0x5cbb67[_0xbfa5('0x33')]);_0x1eaff8[_0xbfa5('0x3b')]=_[_0xbfa5('0x35')](_0x1eaff8[_0xbfa5('0x32')],_0x1eaff8[_0xbfa5('0x33')]);_0x4577f0[_0xbfa5('0x36')]=_[_0xbfa5('0x35')](_0x1eaff8[_0xbfa5('0x32')],qs[_0xbfa5('0x37')](_0x5cbb67[_0xbfa5('0x33')][_0xbfa5('0x37')]));_0x4577f0[_0xbfa5('0x36')]=_0x4577f0[_0xbfa5('0x36')][_0xbfa5('0x38')]?_0x4577f0[_0xbfa5('0x36')]:_0x1eaff8[_0xbfa5('0x32')];if(_0x5cbb67[_0xbfa5('0x33')][_0xbfa5('0x45')]){_0x4577f0[_0xbfa5('0x46')]=[{'all':!![]}];}_0x4577f0=_[_0xbfa5('0x3d')]({},_0x4577f0,_0x5cbb67['options']);return db[_0xbfa5('0x2d')][_0xbfa5('0x47')](_0x4577f0)[_0xbfa5('0x25')](handleEntityNotFound(_0x597250,null))[_0xbfa5('0x25')](respondWithResult(_0x597250,null))[_0xbfa5('0x43')](handleError(_0x597250,null));};exports[_0xbfa5('0x48')]=function(_0x10f7e5,_0x2c0b29){return db['Pause']['create'](_0x10f7e5[_0xbfa5('0x49')],{})['then'](function(_0x4235e4){var _0x359d01=_0x10f7e5[_0xbfa5('0x4a')]['get']({'plain':!![]});if(!_0x359d01)throw new Error(_0xbfa5('0x4b'));if(_0x359d01[_0xbfa5('0x4c')]===_0xbfa5('0x4a')){var _0x4950dc=_0x4235e4[_0xbfa5('0x26')]({'plain':!![]});var _0x1133db='Pauses';return db[_0xbfa5('0x4d')][_0xbfa5('0x47')]({'where':{'name':_0x1133db,'userProfileId':_0x359d01[_0xbfa5('0x4e')]},'raw':!![]})['then'](function(_0x24aa22){if(_0x24aa22&&_0x24aa22[_0xbfa5('0x4f')]===0x0){return db[_0xbfa5('0x50')][_0xbfa5('0x48')]({'name':_0x4950dc[_0xbfa5('0x29')],'resourceId':_0x4950dc['id'],'type':_0x24aa22[_0xbfa5('0x29')],'sectionId':_0x24aa22['id']},{})[_0xbfa5('0x25')](function(){return _0x4235e4;});}else{return _0x4235e4;}})[_0xbfa5('0x43')](function(_0xf69af9){logger[_0xbfa5('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf69af9);throw _0xf69af9;});}return _0x4235e4;})[_0xbfa5('0x25')](respondWithResult(_0x2c0b29,0xc9))[_0xbfa5('0x43')](handleError(_0x2c0b29,null));};exports[_0xbfa5('0x23')]=function(_0x345c93,_0x3f1148){if(_0x345c93['body']['id']){delete _0x345c93['body']['id'];}return db['Pause']['find']({'where':{'id':_0x345c93[_0xbfa5('0x51')]['id']}})['then'](handleEntityNotFound(_0x3f1148,null))['then'](saveUpdates(_0x345c93[_0xbfa5('0x49')],null))[_0xbfa5('0x25')](respondWithResult(_0x3f1148,null))['catch'](handleError(_0x3f1148,null));};exports[_0xbfa5('0x24')]=function(_0x50557c,_0x3d72d8){return db[_0xbfa5('0x2d')][_0xbfa5('0x47')]({'where':{'id':_0x50557c[_0xbfa5('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d72d8,null))[_0xbfa5('0x25')](removeEntity(_0x3d72d8,null))[_0xbfa5('0x43')](handleError(_0x3d72d8,null));}; \ No newline at end of file +var _0xdca5=['catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','UserProfileResource','error','name','send','index','map','Pause','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows'];(function(_0x45435b,_0x8f2922){var _0x55379f=function(_0x1d78d5){while(--_0x1d78d5){_0x45435b['push'](_0x45435b['shift']());}};_0x55379f(++_0x8f2922);}(_0xdca5,0x168));var _0x5dca=function(_0x3bbaae,_0xb69da){_0x3bbaae=_0x3bbaae-0x0;var _0x4c69ac=_0xdca5[_0x3bbaae];return _0x4c69ac;};'use strict';var emlformat=require(_0x5dca('0x0'));var rimraf=require(_0x5dca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5dca('0x2'));var rp=require(_0x5dca('0x3'));var moment=require(_0x5dca('0x4'));var BPromise=require(_0x5dca('0x5'));var Mustache=require(_0x5dca('0x6'));var util=require('util');var path=require(_0x5dca('0x7'));var sox=require('sox');var csv=require(_0x5dca('0x8'));var ejs=require(_0x5dca('0x9'));var fs=require('fs');var fs_extra=require(_0x5dca('0xa'));var _=require(_0x5dca('0xb'));var squel=require(_0x5dca('0xc'));var crypto=require(_0x5dca('0xd'));var jsforce=require(_0x5dca('0xe'));var deskjs=require(_0x5dca('0xf'));var toCsv=require(_0x5dca('0x8'));var querystring=require('querystring');var Papa=require(_0x5dca('0x10'));var Redis=require(_0x5dca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5dca('0x12'));var as=require(_0x5dca('0x13'));var hardwareService=require(_0x5dca('0x14'));var logger=require(_0x5dca('0x15'))(_0x5dca('0x16'));var utils=require('../../config/utils');var config=require(_0x5dca('0x17'));var licenseUtil=require(_0x5dca('0x18'));var db=require(_0x5dca('0x19'))['db'];function respondWithStatusCode(_0x1ae9a2,_0x10a1f6){_0x10a1f6=_0x10a1f6||0xcc;return function(_0x231659){if(_0x231659){return _0x1ae9a2[_0x5dca('0x1a')](_0x10a1f6);}return _0x1ae9a2[_0x5dca('0x1b')](_0x10a1f6)[_0x5dca('0x1c')]();};}function respondWithResult(_0x334163,_0x1cbe2a){_0x1cbe2a=_0x1cbe2a||0xc8;return function(_0x1b4902){if(_0x1b4902){return _0x334163[_0x5dca('0x1b')](_0x1cbe2a)[_0x5dca('0x1d')](_0x1b4902);}};}function respondWithFilteredResult(_0x4f6fe6,_0x34f054){return function(_0x5b62ba){if(_0x5b62ba){var _0x1444f1=typeof _0x34f054['offset']==='undefined'&&typeof _0x34f054['limit']===_0x5dca('0x1e');var _0x4548f4=_0x5b62ba[_0x5dca('0x1f')];var _0x3cbb64=_0x1444f1?0x0:_0x34f054[_0x5dca('0x20')];var _0x249e85=_0x1444f1?_0x5b62ba[_0x5dca('0x1f')]:_0x34f054['offset']+_0x34f054[_0x5dca('0x21')];var _0x45cef4;if(_0x249e85>=_0x4548f4){_0x249e85=_0x4548f4;_0x45cef4=0xc8;}else{_0x45cef4=0xce;}_0x4f6fe6[_0x5dca('0x1b')](_0x45cef4);return _0x4f6fe6[_0x5dca('0x22')](_0x5dca('0x23'),_0x3cbb64+'-'+_0x249e85+'/'+_0x4548f4)[_0x5dca('0x1d')](_0x5b62ba);}return null;};}function patchUpdates(_0x16bf89){return function(_0x36af01){try{jsonpatch[_0x5dca('0x24')](_0x36af01,_0x16bf89,!![]);}catch(_0x25854a){return BPromise[_0x5dca('0x25')](_0x25854a);}return _0x36af01['save']();};}function saveUpdates(_0x387902,_0x555d14){return function(_0x1e81ea){if(_0x1e81ea){return _0x1e81ea['update'](_0x387902)[_0x5dca('0x26')](function(_0x30abf5){return _0x30abf5;});}return null;};}function removeEntity(_0x2fdae9,_0x454dcb){return function(_0x51b789){if(_0x51b789){return _0x51b789[_0x5dca('0x27')]()[_0x5dca('0x26')](function(){var _0x266b94=_0x51b789['get']({'plain':!![]});var _0x565faa='Pauses';return db[_0x5dca('0x28')]['destroy']({'where':{'type':_0x565faa,'resourceId':_0x266b94['id']}})[_0x5dca('0x26')](function(){return _0x51b789;});})[_0x5dca('0x26')](function(){_0x2fdae9[_0x5dca('0x1b')](0xcc)[_0x5dca('0x1c')]();});}};}function handleEntityNotFound(_0x1d708c,_0x77396d){return function(_0x26c4d1){if(!_0x26c4d1){_0x1d708c[_0x5dca('0x1a')](0x194);}return _0x26c4d1;};}function handleError(_0x4fab64,_0x24c179){_0x24c179=_0x24c179||0x1f4;return function(_0xbf8fb5){logger[_0x5dca('0x29')](_0xbf8fb5['stack']);if(_0xbf8fb5[_0x5dca('0x2a')]){delete _0xbf8fb5[_0x5dca('0x2a')];}_0x4fab64['status'](_0x24c179)[_0x5dca('0x2b')](_0xbf8fb5);};}exports[_0x5dca('0x2c')]=function(_0x346bad,_0x533d0a){var _0xfcc753={},_0x2318fd={},_0xe5dcd0={'count':0x0,'rows':[]};var _0xeb9b36=_[_0x5dca('0x2d')](db[_0x5dca('0x2e')][_0x5dca('0x2f')],function(_0x1f634d){return{'name':_0x1f634d[_0x5dca('0x30')],'type':_0x1f634d['type']['key']};});_0x2318fd['model']=_[_0x5dca('0x2d')](_0xeb9b36,_0x5dca('0x2a'));_0x2318fd[_0x5dca('0x31')]=_['keys'](_0x346bad[_0x5dca('0x31')]);_0x2318fd[_0x5dca('0x32')]=_[_0x5dca('0x33')](_0x2318fd[_0x5dca('0x34')],_0x2318fd[_0x5dca('0x31')]);_0xfcc753[_0x5dca('0x35')]=_['intersection'](_0x2318fd[_0x5dca('0x34')],qs[_0x5dca('0x36')](_0x346bad[_0x5dca('0x31')][_0x5dca('0x36')]));_0xfcc753[_0x5dca('0x35')]=_0xfcc753[_0x5dca('0x35')][_0x5dca('0x37')]?_0xfcc753[_0x5dca('0x35')]:_0x2318fd[_0x5dca('0x34')];if(!_0x346bad[_0x5dca('0x31')][_0x5dca('0x38')](_0x5dca('0x39'))){_0xfcc753[_0x5dca('0x21')]=qs[_0x5dca('0x21')](_0x346bad['query'][_0x5dca('0x21')]);_0xfcc753[_0x5dca('0x20')]=qs[_0x5dca('0x20')](_0x346bad[_0x5dca('0x31')]['offset']);}_0xfcc753[_0x5dca('0x3a')]=qs['sort'](_0x346bad[_0x5dca('0x31')][_0x5dca('0x3b')]);_0xfcc753[_0x5dca('0x3c')]=qs[_0x5dca('0x32')](_[_0x5dca('0x3d')](_0x346bad[_0x5dca('0x31')],_0x2318fd[_0x5dca('0x32')]),_0xeb9b36);if(_0x346bad['query'][_0x5dca('0x3e')]){_0xfcc753[_0x5dca('0x3c')]=_[_0x5dca('0x3f')](_0xfcc753['where'],{'$or':_[_0x5dca('0x2d')](_0xeb9b36,function(_0x118a95){if(_0x118a95[_0x5dca('0x40')]!==_0x5dca('0x41')){var _0x4aca30={};_0x4aca30[_0x118a95['name']]={'$like':'%'+_0x346bad[_0x5dca('0x31')]['filter']+'%'};return _0x4aca30;}})});}_0xfcc753=_[_0x5dca('0x3f')]({},_0xfcc753,_0x346bad[_0x5dca('0x42')]);var _0x597eec={'where':_0xfcc753[_0x5dca('0x3c')]};return db[_0x5dca('0x2e')][_0x5dca('0x1f')](_0x597eec)[_0x5dca('0x26')](function(_0x6d09eb){_0xe5dcd0['count']=_0x6d09eb;if(_0x346bad[_0x5dca('0x31')]['includeAll']){_0xfcc753[_0x5dca('0x43')]=[{'all':!![]}];}return db['Pause'][_0x5dca('0x44')](_0xfcc753);})['then'](function(_0x396afa){_0xe5dcd0[_0x5dca('0x45')]=_0x396afa;return _0xe5dcd0;})[_0x5dca('0x26')](respondWithFilteredResult(_0x533d0a,_0xfcc753))[_0x5dca('0x46')](handleError(_0x533d0a,null));};exports[_0x5dca('0x47')]=function(_0x4c8d39,_0x3d71fb){var _0x433b52={'raw':!![],'where':{'id':_0x4c8d39[_0x5dca('0x48')]['id']}},_0x11a5b3={};_0x11a5b3[_0x5dca('0x34')]=_['keys'](db[_0x5dca('0x2e')][_0x5dca('0x2f')]);_0x11a5b3['query']=_[_0x5dca('0x49')](_0x4c8d39[_0x5dca('0x31')]);_0x11a5b3[_0x5dca('0x32')]=_[_0x5dca('0x33')](_0x11a5b3[_0x5dca('0x34')],_0x11a5b3['query']);_0x433b52[_0x5dca('0x35')]=_[_0x5dca('0x33')](_0x11a5b3[_0x5dca('0x34')],qs[_0x5dca('0x36')](_0x4c8d39[_0x5dca('0x31')][_0x5dca('0x36')]));_0x433b52[_0x5dca('0x35')]=_0x433b52[_0x5dca('0x35')][_0x5dca('0x37')]?_0x433b52[_0x5dca('0x35')]:_0x11a5b3['model'];if(_0x4c8d39['query'][_0x5dca('0x4a')]){_0x433b52[_0x5dca('0x43')]=[{'all':!![]}];}_0x433b52=_[_0x5dca('0x3f')]({},_0x433b52,_0x4c8d39[_0x5dca('0x42')]);return db[_0x5dca('0x2e')][_0x5dca('0x4b')](_0x433b52)[_0x5dca('0x26')](handleEntityNotFound(_0x3d71fb,null))['then'](respondWithResult(_0x3d71fb,null))[_0x5dca('0x46')](handleError(_0x3d71fb,null));};exports[_0x5dca('0x4c')]=function(_0x27631f,_0x82613e){return db[_0x5dca('0x2e')]['create'](_0x27631f[_0x5dca('0x4d')],{})[_0x5dca('0x26')](function(_0x3e6ffd){var _0x2c91c1=_0x27631f[_0x5dca('0x4e')]['get']({'plain':!![]});if(!_0x2c91c1)throw new Error(_0x5dca('0x4f'));if(_0x2c91c1[_0x5dca('0x50')]===_0x5dca('0x4e')){var _0x30f079=_0x3e6ffd[_0x5dca('0x51')]({'plain':!![]});var _0x59fdc9='Pauses';return db[_0x5dca('0x52')]['find']({'where':{'name':_0x59fdc9,'userProfileId':_0x2c91c1[_0x5dca('0x53')]},'raw':!![]})['then'](function(_0x1a1da3){if(_0x1a1da3&&_0x1a1da3[_0x5dca('0x54')]===0x0){return db[_0x5dca('0x28')][_0x5dca('0x4c')]({'name':_0x30f079[_0x5dca('0x2a')],'resourceId':_0x30f079['id'],'type':_0x1a1da3[_0x5dca('0x2a')],'sectionId':_0x1a1da3['id']},{})[_0x5dca('0x26')](function(){return _0x3e6ffd;});}else{return _0x3e6ffd;}})[_0x5dca('0x46')](function(_0x290b1a){logger[_0x5dca('0x29')](_0x5dca('0x55'),_0x290b1a);throw _0x290b1a;});}return _0x3e6ffd;})['then'](respondWithResult(_0x82613e,0xc9))[_0x5dca('0x46')](handleError(_0x82613e,null));};exports['update']=function(_0x1baf98,_0x415a26){if(_0x1baf98[_0x5dca('0x4d')]['id']){delete _0x1baf98['body']['id'];}return db[_0x5dca('0x2e')][_0x5dca('0x4b')]({'where':{'id':_0x1baf98[_0x5dca('0x48')]['id']}})[_0x5dca('0x26')](handleEntityNotFound(_0x415a26,null))[_0x5dca('0x26')](saveUpdates(_0x1baf98[_0x5dca('0x4d')],null))[_0x5dca('0x26')](respondWithResult(_0x415a26,null))[_0x5dca('0x46')](handleError(_0x415a26,null));};exports[_0x5dca('0x27')]=function(_0x381a12,_0x3680a7){return db[_0x5dca('0x2e')]['find']({'where':{'id':_0x381a12[_0x5dca('0x48')]['id']}})[_0x5dca('0x26')](handleEntityNotFound(_0x3680a7,null))[_0x5dca('0x26')](removeEntity(_0x3680a7,null))[_0x5dca('0x46')](handleError(_0x3680a7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 3d45ab5..5e1e055 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 _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x1c1a05,_0x31d226){var _0x2b3fb8=function(_0x2feda0){while(--_0x2feda0){_0x1c1a05['push'](_0x1c1a05['shift']());}};_0x2b3fb8(++_0x31d226);}(_0x53ec,0x192));var _0xc53e=function(_0x4b40de,_0x3efe59){_0x4b40de=_0x4b40de-0x0;var _0x5c9460=_0x53ec[_0x4b40de];return _0x5c9460;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x24d4a9,_0x529407){var _0x29fd2d=function(_0x57caf1){while(--_0x57caf1){_0x24d4a9['push'](_0x24d4a9['shift']());}};_0x29fd2d(++_0x529407);}(_0x814b,0x1a2));var _0xb814=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x814b[_0x30c649];return _0x3edfb9;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1d3e8f8..621c0b5 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x4e70fe,_0x4d2438){var _0x1c9808=function(_0x23708f){while(--_0x23708f){_0x4e70fe['push'](_0x4e70fe['shift']());}};_0x1c9808(++_0x4d2438);}(_0x7a54,0x106));var _0x47a5=function(_0x4ea8e3,_0x2b81ce){_0x4ea8e3=_0x4ea8e3-0x0;var _0x5aa438=_0x7a54[_0x4ea8e3];return _0x5aa438;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x521fa2,_0x1139fc){var _0x2b9b65=function(_0x342d5b){while(--_0x342d5b){_0x521fa2['push'](_0x521fa2['shift']());}};_0x2b9b65(++_0x1139fc);}(_0x7a54,0x106));var _0x47a5=function(_0xb209b8,_0x66e824){_0xb209b8=_0xb209b8-0x0;var _0x38a496=_0x7a54[_0xb209b8];return _0x38a496;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index bb0a2ff..57317a2 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 _0x6737=['diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','upload','webhookPost','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','index','/:id','show','get','download'];(function(_0x21d100,_0x2d4eb8){var _0x2325a3=function(_0x523949){while(--_0x523949){_0x21d100['push'](_0x21d100['shift']());}};_0x2325a3(++_0x2d4eb8);}(_0x6737,0xe2));var _0x7673=function(_0x2a32b7,_0x237442){_0x2a32b7=_0x2a32b7-0x0;var _0x4cb28c=_0x6737[_0x2a32b7];return _0x4cb28c;};'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']('/webhook',controller['webhookGet']);router['get'](_0x7673('0xa'),auth['isAuthenticated'](),controller[_0x7673('0xb')]);router[_0x7673('0xc')]('/:id/download',auth[_0x7673('0x8')](),controller[_0x7673('0xd')]);var upload=multer({'storage':multer[_0x7673('0xe')]({'destination':function(_0x4d40ce,_0x49fcb2,_0x3ca258){_0x3ca258(null,path['join'](config[_0x7673('0xf')],_0x7673('0x10')));},'filename':function(_0x38090f,_0x451c87,_0x41d6bd){_0x451c87[_0x7673('0x11')]=_0x451c87[_0x7673('0x11')][_0x7673('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41d6bd(null,util[_0x7673('0x13')](_0x7673('0x14'),path['basename'](_0x451c87[_0x7673('0x11')],path[_0x7673('0x15')](_0x451c87[_0x7673('0x11')])),Date[_0x7673('0x16')](),path[_0x7673('0x15')](_0x451c87[_0x7673('0x11')])));}})});router[_0x7673('0x17')]('/',upload['single']('file'),controller[_0x7673('0x18')]);router[_0x7673('0x17')]('/webhook',controller[_0x7673('0x19')]);router[_0x7673('0x1a')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0x1b')]);router[_0x7673('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x7673('0x1c')]);module[_0x7673('0x1d')]=router; \ No newline at end of file +var _0xbd50=['extname','post','single','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/webhook','webhookGet','show','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename'];(function(_0x410532,_0x201fc0){var _0x2123a7=function(_0x54be79){while(--_0x54be79){_0x410532['push'](_0x410532['shift']());}};_0x2123a7(++_0x201fc0);}(_0xbd50,0x196));var _0x0bd5=function(_0x3fd222,_0x27f900){_0x3fd222=_0x3fd222-0x0;var _0xb7371d=_0xbd50[_0x3fd222];return _0xb7371d;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./plugin.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),controller[_0x0bd5('0xc')]);router['get']('/:id',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xa')]('/:id/download',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x210f45,_0x7db86e,_0x4d7d17){_0x4d7d17(null,path[_0x0bd5('0xf')](config[_0x0bd5('0x10')],_0x0bd5('0x11')));},'filename':function(_0x5f49ee,_0x2f7a0c,_0x23982f){_0x2f7a0c[_0x0bd5('0x12')]=_0x2f7a0c[_0x0bd5('0x12')][_0x0bd5('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23982f(null,util[_0x0bd5('0x14')](_0x0bd5('0x15'),path[_0x0bd5('0x16')](_0x2f7a0c['originalname'],path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])),Date['now'](),path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])));}})});router[_0x0bd5('0x18')]('/',upload[_0x0bd5('0x19')]('file'),controller[_0x0bd5('0x1a')]);router[_0x0bd5('0x18')](_0x0bd5('0xb'),controller[_0x0bd5('0x1b')]);router[_0x0bd5('0x1c')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1e')]);router[_0x0bd5('0x1f')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1f')]);module[_0x0bd5('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 57bf167..4d86837 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 _0xb3d1=['ENUM','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x134462,_0xc16949){var _0xa4a061=function(_0x589e2e){while(--_0x589e2e){_0x134462['push'](_0x134462['shift']());}};_0xa4a061(++_0xc16949);}(_0xb3d1,0x132));var _0x1b3d=function(_0xeb4c8b,_0x1dc497){_0xeb4c8b=_0xeb4c8b-0x0;var _0x90b0d0=_0xb3d1[_0xeb4c8b];return _0x90b0d0;};'use strict';var Sequelize=require(_0x1b3d('0x0'));module[_0x1b3d('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x1b3d('0x2'),_0x1b3d('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x1b3d('0x4')]},'path':{'type':Sequelize[_0x1b3d('0x5')],'comment':_0x1b3d('0x6')},'active':{'type':Sequelize[_0x1b3d('0x7')],'defaultValue':0x0,'comment':_0x1b3d('0x8')},'sidebar':{'type':Sequelize[_0x1b3d('0x9')](_0x1b3d('0xa'),_0x1b3d('0xb'),_0x1b3d('0xc'),_0x1b3d('0xd')),'defaultValue':_0x1b3d('0xc'),'comment':_0x1b3d('0xe')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x1b3d('0x5')]},'scriptPath':{'type':Sequelize[_0x1b3d('0x5')]}}; \ No newline at end of file +var _0x5450=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x423a84,_0x5d8ae0){var _0xd6ee39=function(_0x2cf03b){while(--_0x2cf03b){_0x423a84['push'](_0x423a84['shift']());}};_0xd6ee39(++_0x5d8ae0);}(_0x5450,0x1de));var _0x0545=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5450[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x0545('0x0'));module[_0x0545('0x1')]={'name':{'type':Sequelize[_0x0545('0x2')]},'type':{'type':Sequelize[_0x0545('0x3')](_0x0545('0x4'),_0x0545('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x0545('0x6')},'active':{'type':Sequelize[_0x0545('0x7')],'defaultValue':0x0,'comment':_0x0545('0x8')},'sidebar':{'type':Sequelize[_0x0545('0x3')](_0x0545('0x9'),_0x0545('0xa'),_0x0545('0xb'),_0x0545('0xc')),'defaultValue':_0x0545('0xb'),'comment':_0x0545('0xd')},'icon':{'type':Sequelize[_0x0545('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 569129b..368be21 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 _0xe34f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','stack','send','index','map','Plugin','rawAttributes','type','key','model','name','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','catch','show','params','attributes','find','download','join','root','server/files/plugins','format','%s.zip','basename','path','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','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','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','method','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','encoding','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x35d883,_0x28c2af){var _0x47864a=function(_0x311c4c){while(--_0x311c4c){_0x35d883['push'](_0x35d883['shift']());}};_0x47864a(++_0x28c2af);}(_0xe34f,0x1e7));var _0xfe34=function(_0x8450ef,_0xe7187b){_0x8450ef=_0x8450ef-0x0;var _0x5d81e9=_0xe34f[_0x8450ef];return _0x5d81e9;};'use strict';var emlformat=require(_0xfe34('0x0'));var rimraf=require(_0xfe34('0x1'));var zipdir=require(_0xfe34('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfe34('0x3'));var BPromise=require(_0xfe34('0x4'));var Mustache=require(_0xfe34('0x5'));var util=require('util');var path=require('path');var sox=require(_0xfe34('0x6'));var csv=require(_0xfe34('0x7'));var ejs=require(_0xfe34('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe34('0x9'));var crypto=require(_0xfe34('0xa'));var jsforce=require(_0xfe34('0xb'));var deskjs=require(_0xfe34('0xc'));var toCsv=require(_0xfe34('0x7'));var querystring=require(_0xfe34('0xd'));var Papa=require(_0xfe34('0xe'));var extract=require(_0xfe34('0xf'));var rimraf=require(_0xfe34('0x1'));var archiver=require('archiver');var Redis=require(_0xfe34('0x10'));var authService=require(_0xfe34('0x11'));var qs=require(_0xfe34('0x12'));var as=require(_0xfe34('0x13'));var hardwareService=require(_0xfe34('0x14'));var logger=require(_0xfe34('0x15'))(_0xfe34('0x16'));var utils=require(_0xfe34('0x17'));var config=require(_0xfe34('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe34('0x19'))['db'];config['redis']=_[_0xfe34('0x1a')](config[_0xfe34('0x1b')],{'host':_0xfe34('0x1c'),'port':0x18eb});var socket=require(_0xfe34('0x1d'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x352322,_0xba9ebc){_0xba9ebc=_0xba9ebc||0xcc;return function(_0x1d1e8b){if(_0x1d1e8b){return _0x352322[_0xfe34('0x1e')](_0xba9ebc);}return _0x352322['status'](_0xba9ebc)['end']();};}function respondWithResult(_0x5793bb,_0x6f0d76){_0x6f0d76=_0x6f0d76||0xc8;return function(_0x30310f){if(_0x30310f){return _0x5793bb[_0xfe34('0x1f')](_0x6f0d76)[_0xfe34('0x20')](_0x30310f);}};}function respondWithFilteredResult(_0x10b49e,_0x479830){return function(_0x4b07cc){if(_0x4b07cc){var _0x2c3417=typeof _0x479830['offset']===_0xfe34('0x21')&&typeof _0x479830[_0xfe34('0x22')]==='undefined';var _0x12763f=_0x4b07cc[_0xfe34('0x23')];var _0x72051c=_0x2c3417?0x0:_0x479830[_0xfe34('0x24')];var _0x707f42=_0x2c3417?_0x4b07cc['count']:_0x479830['offset']+_0x479830[_0xfe34('0x22')];var _0x9e38d3;if(_0x707f42>=_0x12763f){_0x707f42=_0x12763f;_0x9e38d3=0xc8;}else{_0x9e38d3=0xce;}_0x10b49e[_0xfe34('0x1f')](_0x9e38d3);return _0x10b49e[_0xfe34('0x25')](_0xfe34('0x26'),_0x72051c+'-'+_0x707f42+'/'+_0x12763f)[_0xfe34('0x20')](_0x4b07cc);}return null;};}function patchUpdates(_0x3d56f4){return function(_0x29379c){try{jsonpatch[_0xfe34('0x27')](_0x29379c,_0x3d56f4,!![]);}catch(_0x2cb450){return BPromise[_0xfe34('0x28')](_0x2cb450);}return _0x29379c[_0xfe34('0x29')]();};}function saveUpdates(_0x5c8a0a,_0x14f97c){return function(_0x531d2d){if(_0x531d2d){return _0x531d2d[_0xfe34('0x2a')](_0x5c8a0a)[_0xfe34('0x2b')](function(_0x4a98c0){return _0x4a98c0;});}return null;};}function removeEntity(_0xec8187,_0x152452){return function(_0x508a4b){if(_0x508a4b){return _0x508a4b[_0xfe34('0x2c')]()['then'](function(){var _0x4669b1=_0x508a4b[_0xfe34('0x2d')]({'plain':!![]});var _0x15662c=_0xfe34('0x2e');return db[_0xfe34('0x2f')]['destroy']({'where':{'type':_0x15662c,'resourceId':_0x4669b1['id']}})['then'](function(){return _0x508a4b;});})[_0xfe34('0x2b')](function(){_0xec8187[_0xfe34('0x1f')](0xcc)[_0xfe34('0x30')]();});}};}function handleEntityNotFound(_0x4db32a,_0x1f00b8){return function(_0x27fa8f){if(!_0x27fa8f){_0x4db32a[_0xfe34('0x1e')](0x194);}return _0x27fa8f;};}function handleError(_0x4571f3,_0x4a88f1){_0x4a88f1=_0x4a88f1||0x1f4;return function(_0x3f84a4){logger[_0xfe34('0x31')](_0x3f84a4[_0xfe34('0x32')]);if(_0x3f84a4['name']){delete _0x3f84a4['name'];}_0x4571f3['status'](_0x4a88f1)[_0xfe34('0x33')](_0x3f84a4);};}exports[_0xfe34('0x34')]=function(_0x396a2f,_0x4ef9c0){var _0xb6550={},_0x37783e={},_0x12d0c4={'count':0x0,'rows':[]};var _0x5ec5f2=_[_0xfe34('0x35')](db[_0xfe34('0x36')][_0xfe34('0x37')],function(_0x18369a){return{'name':_0x18369a['fieldName'],'type':_0x18369a[_0xfe34('0x38')][_0xfe34('0x39')]};});_0x37783e[_0xfe34('0x3a')]=_['map'](_0x5ec5f2,_0xfe34('0x3b'));_0x37783e[_0xfe34('0x3c')]=_[_0xfe34('0x3d')](_0x396a2f[_0xfe34('0x3c')]);_0x37783e[_0xfe34('0x3e')]=_[_0xfe34('0x3f')](_0x37783e['model'],_0x37783e[_0xfe34('0x3c')]);_0xb6550['attributes']=_['intersection'](_0x37783e[_0xfe34('0x3a')],qs['fields'](_0x396a2f['query'][_0xfe34('0x40')]));_0xb6550['attributes']=_0xb6550['attributes'][_0xfe34('0x41')]?_0xb6550['attributes']:_0x37783e['model'];if(!_0x396a2f['query'][_0xfe34('0x42')](_0xfe34('0x43'))){_0xb6550[_0xfe34('0x22')]=qs[_0xfe34('0x22')](_0x396a2f['query'][_0xfe34('0x22')]);_0xb6550[_0xfe34('0x24')]=qs['offset'](_0x396a2f[_0xfe34('0x3c')][_0xfe34('0x24')]);}_0xb6550[_0xfe34('0x44')]=qs[_0xfe34('0x45')](_0x396a2f['query'][_0xfe34('0x45')]);_0xb6550[_0xfe34('0x46')]=qs[_0xfe34('0x3e')](_[_0xfe34('0x47')](_0x396a2f['query'],_0x37783e[_0xfe34('0x3e')]),_0x5ec5f2);if(_0x396a2f[_0xfe34('0x3c')]['filter']){_0xb6550[_0xfe34('0x46')]=_[_0xfe34('0x48')](_0xb6550[_0xfe34('0x46')],{'$or':_[_0xfe34('0x35')](_0x5ec5f2,function(_0x72a56c){if(_0x72a56c['type']!=='VIRTUAL'){var _0xec76fd={};_0xec76fd[_0x72a56c[_0xfe34('0x3b')]]={'$like':'%'+_0x396a2f[_0xfe34('0x3c')][_0xfe34('0x49')]+'%'};return _0xec76fd;}})});}_0xb6550=_[_0xfe34('0x48')]({},_0xb6550,_0x396a2f['options']);var _0x101e8f={'where':_0xb6550[_0xfe34('0x46')]};return db[_0xfe34('0x36')][_0xfe34('0x23')](_0x101e8f)[_0xfe34('0x2b')](function(_0x38d476){_0x12d0c4[_0xfe34('0x23')]=_0x38d476;if(_0x396a2f[_0xfe34('0x3c')][_0xfe34('0x4a')]){_0xb6550[_0xfe34('0x4b')]=[{'all':!![]}];}return db[_0xfe34('0x36')]['findAll'](_0xb6550);})[_0xfe34('0x2b')](function(_0x4de7c6){_0x12d0c4['rows']=_0x4de7c6;return _0x12d0c4;})[_0xfe34('0x2b')](respondWithFilteredResult(_0x4ef9c0,_0xb6550))[_0xfe34('0x4c')](handleError(_0x4ef9c0,null));};exports[_0xfe34('0x4d')]=function(_0x20a186,_0x77972a){var _0x53e96d={'raw':!![],'where':{'id':_0x20a186[_0xfe34('0x4e')]['id']}},_0x4234d7={};_0x4234d7[_0xfe34('0x3a')]=_[_0xfe34('0x3d')](db[_0xfe34('0x36')][_0xfe34('0x37')]);_0x4234d7[_0xfe34('0x3c')]=_[_0xfe34('0x3d')](_0x20a186[_0xfe34('0x3c')]);_0x4234d7[_0xfe34('0x3e')]=_['intersection'](_0x4234d7['model'],_0x4234d7['query']);_0x53e96d['attributes']=_[_0xfe34('0x3f')](_0x4234d7[_0xfe34('0x3a')],qs[_0xfe34('0x40')](_0x20a186['query'][_0xfe34('0x40')]));_0x53e96d['attributes']=_0x53e96d['attributes'][_0xfe34('0x41')]?_0x53e96d[_0xfe34('0x4f')]:_0x4234d7[_0xfe34('0x3a')];if(_0x20a186[_0xfe34('0x3c')][_0xfe34('0x4a')]){_0x53e96d[_0xfe34('0x4b')]=[{'all':!![]}];}_0x53e96d=_[_0xfe34('0x48')]({},_0x53e96d,_0x20a186['options']);return db[_0xfe34('0x36')][_0xfe34('0x50')](_0x53e96d)['then'](handleEntityNotFound(_0x77972a,null))[_0xfe34('0x2b')](respondWithResult(_0x77972a,null))['catch'](handleError(_0x77972a,null));};exports[_0xfe34('0x51')]=function(_0x34dca7,_0xb0d31c,_0x3bd8ac){return db[_0xfe34('0x36')]['find']({'where':{'id':_0x34dca7[_0xfe34('0x4e')]['id']},'attributes':['name','path'],'raw':!![]})[_0xfe34('0x2b')](handleEntityNotFound(_0xb0d31c,null))[_0xfe34('0x2b')](function(_0x21f34f){if(_0x21f34f){var _0x267a98=path[_0xfe34('0x52')](config[_0xfe34('0x53')],_0xfe34('0x54'),util[_0xfe34('0x55')](_0xfe34('0x56'),path[_0xfe34('0x57')](_0x21f34f[_0xfe34('0x58')])));var _0x1b8947=fs[_0xfe34('0x59')](_0x267a98);var _0x32063d=archiver(_0xfe34('0x5a'),{'zlib':{'level':0x9}});_0x32063d['on'](_0xfe34('0x5b'),function(_0x4fb641){if(_0x4fb641[_0xfe34('0x5c')]===_0xfe34('0x5d')){logger[_0xfe34('0x31')](_0x4fb641);}else{throw new db[(_0xfe34('0x5e'))][(_0xfe34('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x32063d['on'](_0xfe34('0x31'),function(_0x29643d){throw new db[(_0xfe34('0x5e'))][(_0xfe34('0x5f'))](_0xfe34('0x60'));});_0x32063d['pipe'](_0x1b8947);_0x32063d[_0xfe34('0x61')](_0xfe34('0x62'),{'cwd':path[_0xfe34('0x52')](config[_0xfe34('0x53')],_0xfe34('0x54'),path[_0xfe34('0x63')](_0x21f34f[_0xfe34('0x58')])),'ignore':[path['join'](path['basename'](_0x21f34f[_0xfe34('0x58')]),_0xfe34('0x64')),path['join'](path[_0xfe34('0x57')](_0x21f34f[_0xfe34('0x58')]),_0xfe34('0x65'))],'nodir':!![]})[_0xfe34('0x66')]();_0x1b8947['on']('close',function(){if(!fs[_0xfe34('0x67')](_0x267a98)){throw new db[(_0xfe34('0x5e'))][(_0xfe34('0x5f'))]('Plugin\x20not\x20found');}return _0xb0d31c[_0xfe34('0x51')](_0x267a98,util[_0xfe34('0x55')](_0xfe34('0x56'),path[_0xfe34('0x57')](_0x21f34f['path'])),function(_0x54c3b4){if(_0x54c3b4){throw new db[(_0xfe34('0x5e'))][(_0xfe34('0x5f'))](_0xfe34('0x68'));}fs['unlinkSync'](_0x267a98);logger[_0xfe34('0x69')](_0xfe34('0x6a'));logger[_0xfe34('0x69')](_0xfe34('0x6b'));});});}return null;})['catch'](handleError(_0xb0d31c,null));};exports[_0xfe34('0x6c')]=function(_0xfff1fe,_0x79b895,_0x51f26a){var _0x47d7ec=path[_0xfe34('0x57')](_0xfff1fe[_0xfe34('0x6d')][_0xfe34('0x6e')],path[_0xfe34('0x6f')](_0xfff1fe[_0xfe34('0x6d')]['filename']));var _0x4f4a77=path[_0xfe34('0x52')](config[_0xfe34('0x53')],_0xfe34('0x54'),_0xfff1fe[_0xfe34('0x6d')][_0xfe34('0x6e')]);var _0x30f1a8=path['join'](config[_0xfe34('0x53')],_0xfe34('0x54'),_0x47d7ec);logger[_0xfe34('0x69')]('Plugin\x20upload\x20filepath:\x20%s',_0x4f4a77);logger[_0xfe34('0x69')](_0xfe34('0x70'),_0x30f1a8);try{fs[_0xfe34('0x71')](_0x4f4a77,parseInt(_0xfe34('0x72'),0x8));extract(_0x4f4a77,{'dir':_0x30f1a8},function(_0x2580ff){if(_0x2580ff){logger[_0xfe34('0x31')](_0x2580ff);handleError(_0x2580ff,!![]);};var _0x6c397a=fs[_0xfe34('0x73')](_0x30f1a8);if(_0x6c397a[_0xfe34('0x41')]>0x1){removeReferences(_0x4f4a77,_0x30f1a8);logger['error'](_0xfe34('0x74'));return _0x51f26a(new Error(_0xfe34('0x74')));}var _0x3e9625=fs['lstatSync'](path[_0xfe34('0x52')](_0x30f1a8,_0x6c397a[0x0]));if(_0x3e9625[_0xfe34('0x75')]()){removeReferences(_0x4f4a77,_0x30f1a8);logger[_0xfe34('0x31')](_0xfe34('0x74'));return _0x51f26a(new Error(_0xfe34('0x74')));}if(_0x3e9625['isDirectory']()){var _0x54b46c=fs[_0xfe34('0x73')](path[_0xfe34('0x52')](_0x30f1a8,_0x6c397a[0x0]));if(_0x54b46c['length']===0x0){removeReferences(_0x4f4a77,_0x30f1a8);logger['error']('Invalid\x20plugin\x20structure');return _0x51f26a(new Error('Invalid\x20plugin\x20structure'));}var _0x1ccf43=_0x54b46c[_0xfe34('0x76')](function(_0x24d4fb){return _0x24d4fb===_0xfe34('0x77');});if(!_0x1ccf43){return _0x51f26a(new Error(_0xfe34('0x78')));}var _0x44417a=fs[_0xfe34('0x79')](path[_0xfe34('0x52')](_0x30f1a8,_0x6c397a[0x0],'manifest.json'));var _0x30d8de=JSON[_0xfe34('0x7a')](_0x44417a);if(_0xfe34('0x21')==typeof _0x30d8de['name']){return _0x51f26a(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xfe34('0x21')==typeof _0x30d8de['type']){return _0x51f26a(new Error(_0xfe34('0x7b')));}if(_0xfe34('0x21')==typeof _0x30d8de[_0xfe34('0x7c')]){return _0x51f26a(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xfe34('0x21')==typeof _0x30d8de[_0xfe34('0x7d')]){return _0x51f26a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x30d8de[_0xfe34('0x38')]===_0xfe34('0x7e')){if(_0xfe34('0x21')==typeof _0x30d8de['parameters'][_0xfe34('0x7f')]){return _0x51f26a(new Error(_0xfe34('0x80')));}if(_0xfe34('0x21')==typeof _0x30d8de[_0xfe34('0x7d')][_0xfe34('0x7f')][_0xfe34('0x81')]&&_0xfe34('0x21')==typeof _0x30d8de[_0xfe34('0x7d')][_0xfe34('0x7f')][_0xfe34('0x82')]){return _0x51f26a(new Error(_0xfe34('0x83')));}}else if(_0x30d8de['type']==='script'){if(_0xfe34('0x21')==typeof _0x30d8de[_0xfe34('0x7d')]['scriptName']){return _0x51f26a(new Error(_0xfe34('0x84')));}if(_0xfe34('0x21')==typeof _0x30d8de[_0xfe34('0x7d')][_0xfe34('0x85')]){return _0x51f26a(new Error(_0xfe34('0x86')));}}else{return _0x51f26a(new Error(_0xfe34('0x87')));}var _0x2074f0=_0x30d8de[_0xfe34('0x3b')];var _0x259b25=_0x30d8de[_0xfe34('0x88')];var _0x107a5b=_0x30d8de[_0xfe34('0x38')];var _0xec9c51=_0x30d8de['sidebar']?_0x30d8de['sidebar']:_0xfe34('0x89');var _0x20023b=_0x30d8de[_0xfe34('0x8a')]?_0x30d8de['icon']:'icon-apps';var _0xc50bb8='';var _0xf6e1ff='';var _0xcd007b='';var _0x207d58='';var _0xc2d80e=_0x30d8de[_0xfe34('0x7c')];if(_0x107a5b===_0xfe34('0x7e')){if(_0xfe34('0x21')!=typeof _0x30d8de[_0xfe34('0x7d')][_0xfe34('0x7f')]['admin']){var _0x33d28e=_0x30d8de[_0xfe34('0x7d')][_0xfe34('0x7f')][_0xfe34('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x33d28e)){_0xc50bb8=path['join'](_0xfe34('0x8b'),_0x47d7ec,_0x6c397a[0x0],_0x33d28e);}else{_0xc50bb8=_0x33d28e;}}else{logger['info'](_0xfe34('0x8c'));}if(_0xfe34('0x21')!=typeof _0x30d8de[_0xfe34('0x7d')]['views'][_0xfe34('0x82')]){var _0x4bf1d5=_0x30d8de[_0xfe34('0x7d')][_0xfe34('0x7f')][_0xfe34('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xfe34('0x8d')](_0x4bf1d5)){_0xf6e1ff=path['join'](_0xfe34('0x8b'),_0x47d7ec,_0x6c397a[0x0],_0x4bf1d5);}else{_0xf6e1ff=_0x4bf1d5;}}else{logger[_0xfe34('0x69')](_0xfe34('0x8e'));}}else if(_0x107a5b==='script'){_0xcd007b=_0x30d8de['parameters'][_0xfe34('0x8f')];_0x207d58=_0x30d8de['parameters']['scriptPath'];if('undefined'!=typeof _0x30d8de[_0xfe34('0x7d')][_0xfe34('0x7f')]){if(_0xfe34('0x21')!=typeof _0x30d8de[_0xfe34('0x7d')]['views']['admin']){var _0x33d28e=_0x30d8de['parameters'][_0xfe34('0x7f')][_0xfe34('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xfe34('0x8d')](_0x33d28e)){_0xc50bb8=path[_0xfe34('0x52')](_0xfe34('0x8b'),_0x47d7ec,_0x6c397a[0x0],_0x33d28e);}else{_0xc50bb8=_0x33d28e;}}if('undefined'!=typeof _0x30d8de[_0xfe34('0x7d')][_0xfe34('0x7f')][_0xfe34('0x82')]){var _0x4bf1d5=_0x30d8de['parameters'][_0xfe34('0x7f')][_0xfe34('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xfe34('0x8d')](_0x4bf1d5)){_0xf6e1ff=path[_0xfe34('0x52')]('plugins',_0x47d7ec,_0x6c397a[0x0],_0x4bf1d5);}else{_0xf6e1ff=_0x4bf1d5;}}}}var _0x1d0431={'name':_0x2074f0,'description':_0x259b25,'path':path['join'](_0x47d7ec,_0x6c397a[0x0]),'type':_0x107a5b,'sidebar':_0xec9c51,'icon':_0x20023b,'adminUrl':_0xc50bb8,'agentUrl':_0xf6e1ff,'scriptName':_0xcd007b,'scriptPath':_0x207d58,'version':_0xc2d80e};removeReferences(_0x4f4a77,null);return db[_0xfe34('0x36')][_0xfe34('0x90')](_0x1d0431)[_0xfe34('0x2b')](function(_0x5bd936){var _0x50fad7={'role':_0xfff1fe['body'][_0xfe34('0x91')],'userProfileId':_0xfff1fe[_0xfe34('0x92')][_0xfe34('0x93')]};if(!_0x50fad7)throw new Error(_0xfe34('0x94'));if(_0x50fad7[_0xfe34('0x91')]===_0xfe34('0x95')){var _0x17e7c8=_0x5bd936[_0xfe34('0x2d')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xfe34('0x2e'),'userProfileId':_0x50fad7[_0xfe34('0x93')]},'raw':!![]})['then'](function(_0xf355e6){if(_0xf355e6&&_0xf355e6[_0xfe34('0x96')]===0x0){return db[_0xfe34('0x2f')][_0xfe34('0x90')]({'name':_0x17e7c8[_0xfe34('0x3b')],'resourceId':_0x17e7c8['id'],'type':_0xf355e6['name'],'sectionId':_0xf355e6['id']},{})[_0xfe34('0x2b')](function(){return _0x5bd936;});}else{return _0x5bd936;}})[_0xfe34('0x4c')](function(_0x516afc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x516afc);throw _0x516afc;});}return _0x5bd936;})['then'](respondWithResult(_0x79b895,null))[_0xfe34('0x4c')](handleError(_0x79b895,null));}});}catch(_0x1cf3cd){_0x79b895[_0xfe34('0x1f')](0x1f4)['send'](_0x1cf3cd);}};function removeReferences(_0x2b9cb3,_0x302b78){try{if(_0x2b9cb3){fs[_0xfe34('0x97')](_0x2b9cb3);logger[_0xfe34('0x69')](_0xfe34('0x98'));}if(_0x302b78){rimraf(_0x302b78,function(){});logger['info'](_0xfe34('0x99'));}}catch(_0x524c10){logger[_0xfe34('0x31')](_0x524c10);}}exports[_0xfe34('0x2a')]=function(_0x2a8204,_0x20335b,_0x33d530){return db[_0xfe34('0x36')]['find']({'where':{'id':_0x2a8204[_0xfe34('0x4e')]['id']}})[_0xfe34('0x2b')](handleEntityNotFound(_0x20335b,null))[_0xfe34('0x2b')](saveUpdates(_0x2a8204[_0xfe34('0x92')],null))['then'](respondWithResult(_0x20335b,null))[_0xfe34('0x4c')](handleError(_0x20335b,null));};exports[_0xfe34('0x9a')]=function(_0x1e6f8c,_0x3547ff,_0x2a953b){return db[_0xfe34('0x36')][_0xfe34('0x50')]({'where':{'id':_0x1e6f8c[_0xfe34('0x4e')]['id']}})[_0xfe34('0x2b')](function(_0xd81b38){if(_0xd81b38){return _0xd81b38[_0xfe34('0x2c')]();}})[_0xfe34('0x2b')](function(_0x13e02b){rimraf(path[_0xfe34('0x52')](config['root'],_0xfe34('0x54'),path['dirname'](_0x13e02b[_0xfe34('0x58')])),function(){});return _0x13e02b;})[_0xfe34('0x2b')](handleEntityNotFound(_0x3547ff,null))[_0xfe34('0x2b')](respondWithStatusCode(_0x3547ff,null))['catch'](handleError(_0x3547ff,null));};exports['webhookGet']=function(_0xea0502,_0x443747,_0x19dd51){return BPromise[_0xfe34('0x9b')]()[_0xfe34('0x2b')](function(){if(!_0xea0502[_0xfe34('0x3c')][_0xfe34('0x58')]){throw new Error(_0xfe34('0x9c'));}if(!_0xea0502[_0xfe34('0x3c')][_0xfe34('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x29f334=_0xea0502[_0xfe34('0x3c')]['hostname']?_0xea0502['query'][_0xfe34('0x9e')]+':'+_0xea0502['query'][_0xfe34('0x9d')]:_0xfe34('0x9f')+_0xea0502['query'][_0xfe34('0x9d')];var _0x19a5b5=_0xea0502[_0xfe34('0x3c')][_0xfe34('0x20')]?_0xea0502['query'][_0xfe34('0x20')]:!![];var _0x19edc9=_0xea0502[_0xfe34('0x3c')]['encoding']?_0xea0502[_0xfe34('0x3c')]['encoding']:null;var _0x1da99d={'method':_0xea0502[_0xfe34('0xa0')],'uri':util[_0xfe34('0x55')](_0xfe34('0xa1'),_0x29f334,_0xea0502['query'][_0xfe34('0x58')]),'json':_0x19a5b5,'resolveWithFullResponse':!![],'encoding':_0x19edc9,'qs':_0xea0502[_0xfe34('0x3c')]};if(_0xea0502[_0xfe34('0xa2')]){_0x1da99d[_0xfe34('0xa2')]=_0xea0502[_0xfe34('0xa2')];if(_0x1da99d['headers']['content-length']){delete _0x1da99d['headers'][_0xfe34('0xa3')];}}if(_0x1da99d[_0xfe34('0xa2')]['content-type']){delete _0x1da99d['headers'][_0xfe34('0xa4')];}return rp(_0x1da99d);})[_0xfe34('0x2b')](function(_0x1ed5a9){if(_0x1ed5a9){_0x443747[_0xfe34('0x25')](_0x1ed5a9[_0xfe34('0xa2')]);logger[_0xfe34('0x69')](_0x1ed5a9[_0xfe34('0x92')]);if(_[_0xfe34('0xa5')](_0xea0502[_0xfe34('0x3c')][_0xfe34('0x58')],'download')&&_0x1ed5a9['statusCode']==0x1f4){return _0x443747[_0xfe34('0x1e')](_0x1ed5a9[_0xfe34('0xa6')]);}else{return _0x443747['status'](_0x1ed5a9[_0xfe34('0xa6')])['send'](_0x1ed5a9[_0xfe34('0x92')]);}}else{return _0x443747[_0xfe34('0x1e')](0xc8);}})['catch'](handleError(_0x443747,null));};exports['webhookPost']=function(_0x172d02,_0x266d5e,_0x3dafbe){return BPromise['resolve']()[_0xfe34('0x2b')](function(){if(!_0x172d02['query'][_0xfe34('0x58')]){throw new Error(_0xfe34('0x9c'));}if(!_0x172d02['query']['port']){throw new Error(_0xfe34('0xa7'));}var _0x34d8fc=_0x172d02[_0xfe34('0x3c')][_0xfe34('0x9e')]?_0x172d02[_0xfe34('0x3c')][_0xfe34('0x9e')]+':'+_0x172d02[_0xfe34('0x3c')][_0xfe34('0x9d')]:_0xfe34('0x9f')+_0x172d02[_0xfe34('0x3c')][_0xfe34('0x9d')];var _0x517b13=_0x172d02[_0xfe34('0x3c')][_0xfe34('0x20')]?_0x172d02['query'][_0xfe34('0x20')]:!![];var _0x176413=_0x172d02[_0xfe34('0x3c')][_0xfe34('0xa8')]?_0x172d02[_0xfe34('0x3c')]['encoding']:null;var _0x4cd286={'method':_0x172d02[_0xfe34('0xa0')],'uri':util[_0xfe34('0x55')]('%s%s',_0x34d8fc,_0x172d02[_0xfe34('0x3c')][_0xfe34('0x58')]),'json':_0x517b13,'resolveWithFullResponse':!![],'encoding':_0x176413,'body':_0x172d02['body']};if(_0x172d02[_0xfe34('0xa2')]){_0x4cd286[_0xfe34('0xa2')]=_0x172d02[_0xfe34('0xa2')];if(_0x4cd286[_0xfe34('0xa2')][_0xfe34('0xa3')]){delete _0x4cd286['headers'][_0xfe34('0xa3')];}}if(_0x4cd286[_0xfe34('0xa2')][_0xfe34('0xa4')]){delete _0x4cd286[_0xfe34('0xa2')][_0xfe34('0xa4')];}return rp(_0x4cd286);})[_0xfe34('0x2b')](function(_0x3dc516){if(_0x3dc516){_0x266d5e[_0xfe34('0x25')](_0x3dc516[_0xfe34('0xa2')]);logger[_0xfe34('0x69')](_0x3dc516['body']);return _0x266d5e[_0xfe34('0x1f')](_0x3dc516[_0xfe34('0xa6')])[_0xfe34('0x33')](_0x3dc516[_0xfe34('0x92')]);}else{return _0x266d5e[_0xfe34('0x1e')](0xc8);}})['catch'](handleError(_0x266d5e,null));}; \ No newline at end of file +var _0x8a4e=['options','Plugin','includeAll','include','findAll','rows','find','catch','params','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','**/*','root','node_modules/**/*','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','webhookGet','resolve','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','./plugin.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x854a47,_0x414f99){var _0x34d49f=function(_0x62a29a){while(--_0x62a29a){_0x854a47['push'](_0x854a47['shift']());}};_0x34d49f(++_0x414f99);}(_0x8a4e,0x108));var _0xe8a4=function(_0x15185f,_0x2003a5){_0x15185f=_0x15185f-0x0;var _0x3c9c47=_0x8a4e[_0x15185f];return _0x3c9c47;};'use strict';var emlformat=require(_0xe8a4('0x0'));var rimraf=require(_0xe8a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8a4('0x2'));var rp=require(_0xe8a4('0x3'));var moment=require(_0xe8a4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe8a4('0x5'));var util=require(_0xe8a4('0x6'));var path=require(_0xe8a4('0x7'));var sox=require(_0xe8a4('0x8'));var csv=require(_0xe8a4('0x9'));var ejs=require(_0xe8a4('0xa'));var fs=require('fs');var fs_extra=require(_0xe8a4('0xb'));var _=require(_0xe8a4('0xc'));var squel=require(_0xe8a4('0xd'));var crypto=require(_0xe8a4('0xe'));var jsforce=require(_0xe8a4('0xf'));var deskjs=require(_0xe8a4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe8a4('0x11'));var Papa=require(_0xe8a4('0x12'));var extract=require('extract-zip');var rimraf=require(_0xe8a4('0x1'));var archiver=require(_0xe8a4('0x13'));var Redis=require(_0xe8a4('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe8a4('0x15'));var as=require(_0xe8a4('0x16'));var hardwareService=require(_0xe8a4('0x17'));var logger=require(_0xe8a4('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xe8a4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe8a4('0x1a')]=_[_0xe8a4('0x1b')](config[_0xe8a4('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8a4('0x1a')]));require(_0xe8a4('0x1c'))['register'](socket);function respondWithStatusCode(_0x16027f,_0x52bc2a){_0x52bc2a=_0x52bc2a||0xcc;return function(_0x33d4c8){if(_0x33d4c8){return _0x16027f['sendStatus'](_0x52bc2a);}return _0x16027f[_0xe8a4('0x1d')](_0x52bc2a)[_0xe8a4('0x1e')]();};}function respondWithResult(_0x18ff45,_0x3c3283){_0x3c3283=_0x3c3283||0xc8;return function(_0x2aefa3){if(_0x2aefa3){return _0x18ff45[_0xe8a4('0x1d')](_0x3c3283)['json'](_0x2aefa3);}};}function respondWithFilteredResult(_0x2c1a78,_0xe2dc9){return function(_0x4932de){if(_0x4932de){var _0x5bba68=typeof _0xe2dc9[_0xe8a4('0x1f')]===_0xe8a4('0x20')&&typeof _0xe2dc9[_0xe8a4('0x21')]===_0xe8a4('0x20');var _0x33533f=_0x4932de['count'];var _0x34fb6a=_0x5bba68?0x0:_0xe2dc9[_0xe8a4('0x1f')];var _0x2afe85=_0x5bba68?_0x4932de[_0xe8a4('0x22')]:_0xe2dc9[_0xe8a4('0x1f')]+_0xe2dc9[_0xe8a4('0x21')];var _0x56b925;if(_0x2afe85>=_0x33533f){_0x2afe85=_0x33533f;_0x56b925=0xc8;}else{_0x56b925=0xce;}_0x2c1a78[_0xe8a4('0x1d')](_0x56b925);return _0x2c1a78[_0xe8a4('0x23')](_0xe8a4('0x24'),_0x34fb6a+'-'+_0x2afe85+'/'+_0x33533f)[_0xe8a4('0x25')](_0x4932de);}return null;};}function patchUpdates(_0x4c6e55){return function(_0x20def8){try{jsonpatch[_0xe8a4('0x26')](_0x20def8,_0x4c6e55,!![]);}catch(_0x604a39){return BPromise['reject'](_0x604a39);}return _0x20def8[_0xe8a4('0x27')]();};}function saveUpdates(_0x57e4b2,_0x4841a3){return function(_0x109e9c){if(_0x109e9c){return _0x109e9c[_0xe8a4('0x28')](_0x57e4b2)[_0xe8a4('0x29')](function(_0x43c9bb){return _0x43c9bb;});}return null;};}function removeEntity(_0x224fc0,_0x269dad){return function(_0x119188){if(_0x119188){return _0x119188[_0xe8a4('0x2a')]()[_0xe8a4('0x29')](function(){var _0xbb89d8=_0x119188[_0xe8a4('0x2b')]({'plain':!![]});var _0x44412a=_0xe8a4('0x2c');return db[_0xe8a4('0x2d')]['destroy']({'where':{'type':_0x44412a,'resourceId':_0xbb89d8['id']}})['then'](function(){return _0x119188;});})[_0xe8a4('0x29')](function(){_0x224fc0[_0xe8a4('0x1d')](0xcc)[_0xe8a4('0x1e')]();});}};}function handleEntityNotFound(_0x16d376,_0x5adba2){return function(_0x162291){if(!_0x162291){_0x16d376[_0xe8a4('0x2e')](0x194);}return _0x162291;};}function handleError(_0x20283a,_0x57a05c){_0x57a05c=_0x57a05c||0x1f4;return function(_0xf7d9c9){logger[_0xe8a4('0x2f')](_0xf7d9c9[_0xe8a4('0x30')]);if(_0xf7d9c9['name']){delete _0xf7d9c9[_0xe8a4('0x31')];}_0x20283a['status'](_0x57a05c)[_0xe8a4('0x32')](_0xf7d9c9);};}exports[_0xe8a4('0x33')]=function(_0x3c04f8,_0x33859e){var _0x15ccb6={},_0xd7be6f={},_0x301f90={'count':0x0,'rows':[]};var _0x551bb6=_[_0xe8a4('0x34')](db['Plugin']['rawAttributes'],function(_0x5d353b){return{'name':_0x5d353b['fieldName'],'type':_0x5d353b[_0xe8a4('0x35')][_0xe8a4('0x36')]};});_0xd7be6f[_0xe8a4('0x37')]=_[_0xe8a4('0x34')](_0x551bb6,_0xe8a4('0x31'));_0xd7be6f[_0xe8a4('0x38')]=_[_0xe8a4('0x39')](_0x3c04f8[_0xe8a4('0x38')]);_0xd7be6f[_0xe8a4('0x3a')]=_[_0xe8a4('0x3b')](_0xd7be6f['model'],_0xd7be6f[_0xe8a4('0x38')]);_0x15ccb6['attributes']=_['intersection'](_0xd7be6f[_0xe8a4('0x37')],qs[_0xe8a4('0x3c')](_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x3c')]));_0x15ccb6[_0xe8a4('0x3d')]=_0x15ccb6[_0xe8a4('0x3d')][_0xe8a4('0x3e')]?_0x15ccb6[_0xe8a4('0x3d')]:_0xd7be6f[_0xe8a4('0x37')];if(!_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x3f')]('nolimit')){_0x15ccb6[_0xe8a4('0x21')]=qs['limit'](_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x21')]);_0x15ccb6['offset']=qs[_0xe8a4('0x1f')](_0x3c04f8[_0xe8a4('0x38')]['offset']);}_0x15ccb6[_0xe8a4('0x40')]=qs[_0xe8a4('0x41')](_0x3c04f8['query'][_0xe8a4('0x41')]);_0x15ccb6[_0xe8a4('0x42')]=qs[_0xe8a4('0x3a')](_[_0xe8a4('0x43')](_0x3c04f8[_0xe8a4('0x38')],_0xd7be6f[_0xe8a4('0x3a')]),_0x551bb6);if(_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x44')]){_0x15ccb6[_0xe8a4('0x42')]=_[_0xe8a4('0x45')](_0x15ccb6[_0xe8a4('0x42')],{'$or':_[_0xe8a4('0x34')](_0x551bb6,function(_0xda8fee){if(_0xda8fee[_0xe8a4('0x35')]!=='VIRTUAL'){var _0x2dd3eb={};_0x2dd3eb[_0xda8fee[_0xe8a4('0x31')]]={'$like':'%'+_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x44')]+'%'};return _0x2dd3eb;}})});}_0x15ccb6=_[_0xe8a4('0x45')]({},_0x15ccb6,_0x3c04f8[_0xe8a4('0x46')]);var _0x44d255={'where':_0x15ccb6[_0xe8a4('0x42')]};return db[_0xe8a4('0x47')]['count'](_0x44d255)[_0xe8a4('0x29')](function(_0x40bbec){_0x301f90[_0xe8a4('0x22')]=_0x40bbec;if(_0x3c04f8['query'][_0xe8a4('0x48')]){_0x15ccb6[_0xe8a4('0x49')]=[{'all':!![]}];}return db[_0xe8a4('0x47')][_0xe8a4('0x4a')](_0x15ccb6);})[_0xe8a4('0x29')](function(_0x38385a){_0x301f90[_0xe8a4('0x4b')]=_0x38385a;return _0x301f90;})[_0xe8a4('0x29')](respondWithFilteredResult(_0x33859e,_0x15ccb6))['catch'](handleError(_0x33859e,null));};exports['show']=function(_0x542d76,_0x2e8fbd){var _0x1c30ff={'raw':!![],'where':{'id':_0x542d76['params']['id']}},_0x1cf86e={};_0x1cf86e[_0xe8a4('0x37')]=_[_0xe8a4('0x39')](db[_0xe8a4('0x47')]['rawAttributes']);_0x1cf86e[_0xe8a4('0x38')]=_[_0xe8a4('0x39')](_0x542d76[_0xe8a4('0x38')]);_0x1cf86e[_0xe8a4('0x3a')]=_[_0xe8a4('0x3b')](_0x1cf86e[_0xe8a4('0x37')],_0x1cf86e['query']);_0x1c30ff[_0xe8a4('0x3d')]=_[_0xe8a4('0x3b')](_0x1cf86e[_0xe8a4('0x37')],qs[_0xe8a4('0x3c')](_0x542d76['query'][_0xe8a4('0x3c')]));_0x1c30ff[_0xe8a4('0x3d')]=_0x1c30ff['attributes'][_0xe8a4('0x3e')]?_0x1c30ff['attributes']:_0x1cf86e[_0xe8a4('0x37')];if(_0x542d76[_0xe8a4('0x38')][_0xe8a4('0x48')]){_0x1c30ff['include']=[{'all':!![]}];}_0x1c30ff=_[_0xe8a4('0x45')]({},_0x1c30ff,_0x542d76[_0xe8a4('0x46')]);return db['Plugin'][_0xe8a4('0x4c')](_0x1c30ff)['then'](handleEntityNotFound(_0x2e8fbd,null))[_0xe8a4('0x29')](respondWithResult(_0x2e8fbd,null))[_0xe8a4('0x4d')](handleError(_0x2e8fbd,null));};exports['download']=function(_0x49809d,_0x5aa98f,_0x3cf76a){return db['Plugin'][_0xe8a4('0x4c')]({'where':{'id':_0x49809d[_0xe8a4('0x4e')]['id']},'attributes':[_0xe8a4('0x31'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x5aa98f,null))[_0xe8a4('0x29')](function(_0x5c382e){if(_0x5c382e){var _0x5d9786=path[_0xe8a4('0x4f')](config['root'],_0xe8a4('0x50'),util[_0xe8a4('0x51')](_0xe8a4('0x52'),path[_0xe8a4('0x53')](_0x5c382e[_0xe8a4('0x7')])));var _0x30053a=fs[_0xe8a4('0x54')](_0x5d9786);var _0x4ef7e5=archiver(_0xe8a4('0x55'),{'zlib':{'level':0x9}});_0x4ef7e5['on'](_0xe8a4('0x56'),function(_0x34f61b){if(_0x34f61b[_0xe8a4('0x57')]===_0xe8a4('0x58')){logger[_0xe8a4('0x2f')](_0x34f61b);}else{throw new db['Sequelize'][(_0xe8a4('0x59'))](_0xe8a4('0x5a'));}});_0x4ef7e5['on'](_0xe8a4('0x2f'),function(_0x541573){throw new db[(_0xe8a4('0x5b'))][(_0xe8a4('0x59'))](_0xe8a4('0x5a'));});_0x4ef7e5['pipe'](_0x30053a);_0x4ef7e5[_0xe8a4('0x5c')](_0xe8a4('0x5d'),{'cwd':path[_0xe8a4('0x4f')](config[_0xe8a4('0x5e')],_0xe8a4('0x50'),path['dirname'](_0x5c382e['path'])),'ignore':[path[_0xe8a4('0x4f')](path['basename'](_0x5c382e[_0xe8a4('0x7')]),_0xe8a4('0x5f')),path['join'](path[_0xe8a4('0x53')](_0x5c382e[_0xe8a4('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x30053a['on']('close',function(){if(!fs[_0xe8a4('0x60')](_0x5d9786)){throw new db[(_0xe8a4('0x5b'))][(_0xe8a4('0x59'))](_0xe8a4('0x61'));}return _0x5aa98f[_0xe8a4('0x62')](_0x5d9786,util[_0xe8a4('0x51')](_0xe8a4('0x52'),path[_0xe8a4('0x53')](_0x5c382e[_0xe8a4('0x7')])),function(_0x1bc08a){if(_0x1bc08a){throw new db[(_0xe8a4('0x5b'))][(_0xe8a4('0x59'))](_0xe8a4('0x63'));}fs['unlinkSync'](_0x5d9786);logger[_0xe8a4('0x64')](_0xe8a4('0x65'));logger['info'](_0xe8a4('0x66'));});});}return null;})[_0xe8a4('0x4d')](handleError(_0x5aa98f,null));};exports[_0xe8a4('0x67')]=function(_0xa02c81,_0x269160,_0x509510){var _0x595c3c=path[_0xe8a4('0x53')](_0xa02c81[_0xe8a4('0x68')][_0xe8a4('0x69')],path[_0xe8a4('0x6a')](_0xa02c81[_0xe8a4('0x68')][_0xe8a4('0x69')]));var _0x44af30=path[_0xe8a4('0x4f')](config['root'],_0xe8a4('0x50'),_0xa02c81['file'][_0xe8a4('0x69')]);var _0x4c7870=path[_0xe8a4('0x4f')](config['root'],_0xe8a4('0x50'),_0x595c3c);logger[_0xe8a4('0x64')](_0xe8a4('0x6b'),_0x44af30);logger[_0xe8a4('0x64')](_0xe8a4('0x6c'),_0x4c7870);try{fs['chmodSync'](_0x44af30,parseInt(_0xe8a4('0x6d'),0x8));extract(_0x44af30,{'dir':_0x4c7870},function(_0x12c2c1){if(_0x12c2c1){logger[_0xe8a4('0x2f')](_0x12c2c1);handleError(_0x12c2c1,!![]);};var _0x3c5ad8=fs['readdirSync'](_0x4c7870);if(_0x3c5ad8[_0xe8a4('0x3e')]>0x1){removeReferences(_0x44af30,_0x4c7870);logger[_0xe8a4('0x2f')](_0xe8a4('0x6e'));return _0x509510(new Error('Invalid\x20plugin\x20structure'));}var _0x559850=fs[_0xe8a4('0x6f')](path[_0xe8a4('0x4f')](_0x4c7870,_0x3c5ad8[0x0]));if(_0x559850['isFile']()){removeReferences(_0x44af30,_0x4c7870);logger[_0xe8a4('0x2f')](_0xe8a4('0x6e'));return _0x509510(new Error('Invalid\x20plugin\x20structure'));}if(_0x559850['isDirectory']()){var _0x10a1b9=fs[_0xe8a4('0x70')](path[_0xe8a4('0x4f')](_0x4c7870,_0x3c5ad8[0x0]));if(_0x10a1b9['length']===0x0){removeReferences(_0x44af30,_0x4c7870);logger['error'](_0xe8a4('0x6e'));return _0x509510(new Error('Invalid\x20plugin\x20structure'));}var _0x2c0c8a=_0x10a1b9[_0xe8a4('0x71')](function(_0x30115b){return _0x30115b===_0xe8a4('0x72');});if(!_0x2c0c8a){return _0x509510(new Error(_0xe8a4('0x73')));}var _0x34ef4d=fs[_0xe8a4('0x74')](path[_0xe8a4('0x4f')](_0x4c7870,_0x3c5ad8[0x0],_0xe8a4('0x72')));var _0x327597=JSON[_0xe8a4('0x75')](_0x34ef4d);if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x31')]){return _0x509510(new Error(_0xe8a4('0x76')));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x35')]){return _0x509510(new Error(_0xe8a4('0x77')));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x78')]){return _0x509510(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x79')]){return _0x509510(new Error(_0xe8a4('0x7a')));}if(_0x327597['type']===_0xe8a4('0x7b')){if('undefined'==typeof _0x327597[_0xe8a4('0x79')]['views']){return _0x509510(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x7c')][_0xe8a4('0x7d')]&&_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x7c')][_0xe8a4('0x7e')]){return _0x509510(new Error(_0xe8a4('0x7f')));}}else if(_0x327597[_0xe8a4('0x35')]==='script'){if('undefined'==typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x80')]){return _0x509510(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x81')]){return _0x509510(new Error(_0xe8a4('0x82')));}}else{return _0x509510(new Error(_0xe8a4('0x83')));}var _0x3d6ef7=_0x327597[_0xe8a4('0x31')];var _0x2d7656=_0x327597[_0xe8a4('0x84')];var _0x5ef61e=_0x327597[_0xe8a4('0x35')];var _0x5c3ac1=_0x327597[_0xe8a4('0x85')]?_0x327597[_0xe8a4('0x85')]:'always';var _0x27896d=_0x327597[_0xe8a4('0x86')]?_0x327597[_0xe8a4('0x86')]:_0xe8a4('0x87');var _0x527d80='';var _0x590fa5='';var _0x264d4a='';var _0x4dd010='';var _0x27cf60=_0x327597['version'];if(_0x5ef61e===_0xe8a4('0x7b')){if(_0xe8a4('0x20')!=typeof _0x327597['parameters'][_0xe8a4('0x7c')][_0xe8a4('0x7d')]){var _0x3ad2c4=_0x327597[_0xe8a4('0x79')]['views'][_0xe8a4('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3ad2c4)){_0x527d80=path[_0xe8a4('0x4f')](_0xe8a4('0x88'),_0x595c3c,_0x3c5ad8[0x0],_0x3ad2c4);}else{_0x527d80=_0x3ad2c4;}}else{logger[_0xe8a4('0x64')](_0xe8a4('0x89'));}if(_0xe8a4('0x20')!=typeof _0x327597[_0xe8a4('0x79')]['views'][_0xe8a4('0x7e')]){var _0x580381=_0x327597[_0xe8a4('0x79')]['views'][_0xe8a4('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x580381)){_0x590fa5=path[_0xe8a4('0x4f')]('plugins',_0x595c3c,_0x3c5ad8[0x0],_0x580381);}else{_0x590fa5=_0x580381;}}else{logger[_0xe8a4('0x64')](_0xe8a4('0x8a'));}}else if(_0x5ef61e===_0xe8a4('0x8b')){_0x264d4a=_0x327597[_0xe8a4('0x79')][_0xe8a4('0x80')];_0x4dd010=_0x327597[_0xe8a4('0x79')][_0xe8a4('0x81')];if(_0xe8a4('0x20')!=typeof _0x327597['parameters'][_0xe8a4('0x7c')]){if('undefined'!=typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x7c')]['admin']){var _0x3ad2c4=_0x327597[_0xe8a4('0x79')][_0xe8a4('0x7c')][_0xe8a4('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3ad2c4)){_0x527d80=path[_0xe8a4('0x4f')](_0xe8a4('0x88'),_0x595c3c,_0x3c5ad8[0x0],_0x3ad2c4);}else{_0x527d80=_0x3ad2c4;}}if(_0xe8a4('0x20')!=typeof _0x327597[_0xe8a4('0x79')]['views'][_0xe8a4('0x7e')]){var _0x580381=_0x327597['parameters'][_0xe8a4('0x7c')][_0xe8a4('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x580381)){_0x590fa5=path['join']('plugins',_0x595c3c,_0x3c5ad8[0x0],_0x580381);}else{_0x590fa5=_0x580381;}}}}var _0x48c3f6={'name':_0x3d6ef7,'description':_0x2d7656,'path':path[_0xe8a4('0x4f')](_0x595c3c,_0x3c5ad8[0x0]),'type':_0x5ef61e,'sidebar':_0x5c3ac1,'icon':_0x27896d,'adminUrl':_0x527d80,'agentUrl':_0x590fa5,'scriptName':_0x264d4a,'scriptPath':_0x4dd010,'version':_0x27cf60};removeReferences(_0x44af30,null);return db['Plugin']['create'](_0x48c3f6)[_0xe8a4('0x29')](function(_0x54666c){var _0x397e6e={'role':_0xa02c81[_0xe8a4('0x8c')]['role'],'userProfileId':_0xa02c81['body']['userProfileId']};if(!_0x397e6e)throw new Error(_0xe8a4('0x8d'));if(_0x397e6e['role']===_0xe8a4('0x8e')){var _0x392fa4=_0x54666c['get']({'plain':!![]});return db[_0xe8a4('0x8f')]['find']({'where':{'name':_0xe8a4('0x2c'),'userProfileId':_0x397e6e[_0xe8a4('0x90')]},'raw':!![]})[_0xe8a4('0x29')](function(_0x59793e){if(_0x59793e&&_0x59793e[_0xe8a4('0x91')]===0x0){return db[_0xe8a4('0x2d')][_0xe8a4('0x92')]({'name':_0x392fa4[_0xe8a4('0x31')],'resourceId':_0x392fa4['id'],'type':_0x59793e[_0xe8a4('0x31')],'sectionId':_0x59793e['id']},{})[_0xe8a4('0x29')](function(){return _0x54666c;});}else{return _0x54666c;}})[_0xe8a4('0x4d')](function(_0x2414f3){logger[_0xe8a4('0x2f')](_0xe8a4('0x93'),_0x2414f3);throw _0x2414f3;});}return _0x54666c;})['then'](respondWithResult(_0x269160,null))[_0xe8a4('0x4d')](handleError(_0x269160,null));}});}catch(_0x35f45a){_0x269160['status'](0x1f4)[_0xe8a4('0x32')](_0x35f45a);}};function removeReferences(_0x5d58bc,_0x50301b){try{if(_0x5d58bc){fs['unlinkSync'](_0x5d58bc);logger[_0xe8a4('0x64')](_0xe8a4('0x94'));}if(_0x50301b){rimraf(_0x50301b,function(){});logger[_0xe8a4('0x64')](_0xe8a4('0x95'));}}catch(_0x37af72){logger[_0xe8a4('0x2f')](_0x37af72);}}exports[_0xe8a4('0x28')]=function(_0x168ef8,_0x27f540,_0x354523){return db[_0xe8a4('0x47')][_0xe8a4('0x4c')]({'where':{'id':_0x168ef8[_0xe8a4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x27f540,null))[_0xe8a4('0x29')](saveUpdates(_0x168ef8['body'],null))[_0xe8a4('0x29')](respondWithResult(_0x27f540,null))['catch'](handleError(_0x27f540,null));};exports['delete']=function(_0x4ee139,_0x24a86e,_0x502444){return db[_0xe8a4('0x47')][_0xe8a4('0x4c')]({'where':{'id':_0x4ee139[_0xe8a4('0x4e')]['id']}})[_0xe8a4('0x29')](function(_0x10b51b){if(_0x10b51b){return _0x10b51b['destroy']();}})['then'](function(_0x24bf07){rimraf(path[_0xe8a4('0x4f')](config['root'],_0xe8a4('0x50'),path[_0xe8a4('0x96')](_0x24bf07[_0xe8a4('0x7')])),function(){});return _0x24bf07;})['then'](handleEntityNotFound(_0x24a86e,null))[_0xe8a4('0x29')](respondWithStatusCode(_0x24a86e,null))[_0xe8a4('0x4d')](handleError(_0x24a86e,null));};exports[_0xe8a4('0x97')]=function(_0xdbc7bc,_0x11969c,_0x10b696){return BPromise[_0xe8a4('0x98')]()[_0xe8a4('0x29')](function(){if(!_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xdbc7bc[_0xe8a4('0x38')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x621ffb=_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x99')]?_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x99')]+':'+_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x9a')]:_0xe8a4('0x9b')+_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x9a')];var _0x48f1b7=_0xdbc7bc['query'][_0xe8a4('0x25')]?_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x25')]:!![];var _0x479dfe=_0xdbc7bc[_0xe8a4('0x38')]['encoding']?_0xdbc7bc['query'][_0xe8a4('0x9c')]:null;var _0xdf7439={'method':_0xdbc7bc[_0xe8a4('0x9d')],'uri':util[_0xe8a4('0x51')](_0xe8a4('0x9e'),_0x621ffb,_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x7')]),'json':_0x48f1b7,'resolveWithFullResponse':!![],'encoding':_0x479dfe,'qs':_0xdbc7bc[_0xe8a4('0x38')]};if(_0xdbc7bc[_0xe8a4('0x9f')]){_0xdf7439[_0xe8a4('0x9f')]=_0xdbc7bc[_0xe8a4('0x9f')];if(_0xdf7439[_0xe8a4('0x9f')][_0xe8a4('0xa0')]){delete _0xdf7439[_0xe8a4('0x9f')][_0xe8a4('0xa0')];}}if(_0xdf7439[_0xe8a4('0x9f')][_0xe8a4('0xa1')]){delete _0xdf7439[_0xe8a4('0x9f')][_0xe8a4('0xa1')];}return rp(_0xdf7439);})['then'](function(_0x771de9){if(_0x771de9){_0x11969c[_0xe8a4('0x23')](_0x771de9[_0xe8a4('0x9f')]);logger['info'](_0x771de9[_0xe8a4('0x8c')]);if(_[_0xe8a4('0xa2')](_0xdbc7bc['query'][_0xe8a4('0x7')],_0xe8a4('0x62'))&&_0x771de9[_0xe8a4('0xa3')]==0x1f4){return _0x11969c[_0xe8a4('0x2e')](_0x771de9[_0xe8a4('0xa3')]);}else{return _0x11969c[_0xe8a4('0x1d')](_0x771de9[_0xe8a4('0xa3')])[_0xe8a4('0x32')](_0x771de9['body']);}}else{return _0x11969c[_0xe8a4('0x2e')](0xc8);}})[_0xe8a4('0x4d')](handleError(_0x11969c,null));};exports[_0xe8a4('0xa4')]=function(_0x290f09,_0x6bf6ef,_0x4e6af8){return BPromise[_0xe8a4('0x98')]()['then'](function(){if(!_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x7')]){throw new Error(_0xe8a4('0xa5'));}if(!_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x9a')]){throw new Error(_0xe8a4('0xa6'));}var _0x42f4d5=_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x99')]?_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x99')]+':'+_0x290f09['query']['port']:_0xe8a4('0x9b')+_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x9a')];var _0x3ba456=_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x25')]?_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x25')]:!![];var _0x3cc506=_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x9c')]?_0x290f09['query'][_0xe8a4('0x9c')]:null;var _0x44d3de={'method':_0x290f09[_0xe8a4('0x9d')],'uri':util[_0xe8a4('0x51')](_0xe8a4('0x9e'),_0x42f4d5,_0x290f09['query'][_0xe8a4('0x7')]),'json':_0x3ba456,'resolveWithFullResponse':!![],'encoding':_0x3cc506,'body':_0x290f09[_0xe8a4('0x8c')]};if(_0x290f09[_0xe8a4('0x9f')]){_0x44d3de[_0xe8a4('0x9f')]=_0x290f09['headers'];if(_0x44d3de[_0xe8a4('0x9f')][_0xe8a4('0xa0')]){delete _0x44d3de[_0xe8a4('0x9f')][_0xe8a4('0xa0')];}}if(_0x44d3de[_0xe8a4('0x9f')][_0xe8a4('0xa1')]){delete _0x44d3de[_0xe8a4('0x9f')][_0xe8a4('0xa1')];}return rp(_0x44d3de);})[_0xe8a4('0x29')](function(_0x28eb2b){if(_0x28eb2b){_0x6bf6ef[_0xe8a4('0x23')](_0x28eb2b['headers']);logger['info'](_0x28eb2b[_0xe8a4('0x8c')]);return _0x6bf6ef[_0xe8a4('0x1d')](_0x28eb2b[_0xe8a4('0xa3')])['send'](_0x28eb2b[_0xe8a4('0x8c')]);}else{return _0x6bf6ef['sendStatus'](0xc8);}})[_0xe8a4('0x4d')](handleError(_0x6bf6ef,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 048ec6a..bc5bd90 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 _0xc9ab=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x100133,_0x27082a){var _0x50086e=function(_0x33bddb){while(--_0x33bddb){_0x100133['push'](_0x100133['shift']());}};_0x50086e(++_0x27082a);}(_0xc9ab,0x125));var _0xbc9a=function(_0x4b86e5,_0xebe1df){_0x4b86e5=_0x4b86e5-0x0;var _0x473bc3=_0xc9ab[_0x4b86e5];return _0x473bc3;};'use strict';var EventEmitter=require(_0xbc9a('0x0'));var Plugin=require(_0xbc9a('0x1'))['db'][_0xbc9a('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbc9a('0x3')};function emitEvent(_0x20e8eb){return function(_0x23d40c,_0x33e557,_0x16f84d){PluginEvents[_0xbc9a('0x4')](_0x20e8eb+':'+_0x23d40c['id'],_0x23d40c);PluginEvents[_0xbc9a('0x4')](_0x20e8eb,_0x23d40c);_0x16f84d(null);};}for(var e in events){if(events[_0xbc9a('0x5')](e)){var event=events[e];Plugin[_0xbc9a('0x6')](e,emitEvent(event));}}module[_0xbc9a('0x7')]=PluginEvents; \ No newline at end of file +var _0x9aac=['hook','events','Plugin','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x33a573,_0x5e88b2){var _0xa8c4c0=function(_0x17fe11){while(--_0x17fe11){_0x33a573['push'](_0x33a573['shift']());}};_0xa8c4c0(++_0x5e88b2);}(_0x9aac,0x135));var _0xc9aa=function(_0x3769c4,_0x11890f){_0x3769c4=_0x3769c4-0x0;var _0x3898dc=_0x9aac[_0x3769c4];return _0x3898dc;};'use strict';var EventEmitter=require(_0xc9aa('0x0'));var Plugin=require('../../mysqldb')['db'][_0xc9aa('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc9aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9aa('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8ca086){return function(_0x5c8ce2,_0x28c49c,_0x267772){PluginEvents['emit'](_0x8ca086+':'+_0x5c8ce2['id'],_0x5c8ce2);PluginEvents[_0xc9aa('0x4')](_0x8ca086,_0x5c8ce2);_0x267772(null);};}for(var e in events){if(events[_0xc9aa('0x5')](e)){var event=events[e];Plugin[_0xc9aa('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index bdd6ee3..cdfc346 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 _0xcd0d=['moment','rimraf','./plugin.attributes','exports','define','Plugin','lodash','util','../../config/logger','api'];(function(_0x53874d,_0x522af1){var _0x391c4e=function(_0x48ad91){while(--_0x48ad91){_0x53874d['push'](_0x53874d['shift']());}};_0x391c4e(++_0x522af1);}(_0xcd0d,0x10a));var _0xdcd0=function(_0x5f55b5,_0x372ef9){_0x5f55b5=_0x5f55b5-0x0;var _0x489ba1=_0xcd0d[_0x5f55b5];return _0x489ba1;};'use strict';var _=require(_0xdcd0('0x0'));var util=require(_0xdcd0('0x1'));var logger=require(_0xdcd0('0x2'))(_0xdcd0('0x3'));var moment=require(_0xdcd0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdcd0('0x5'));var config=require('../../config/environment');var attributes=require(_0xdcd0('0x6'));module[_0xdcd0('0x7')]=function(_0x782b28,_0x3d71ef){return _0x782b28[_0xdcd0('0x8')](_0xdcd0('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf883=['rimraf','../../config/environment','./plugin.attributes','exports','define','lodash','util','api','bluebird','request-promise'];(function(_0x45a1c1,_0x3a40f2){var _0x3428b6=function(_0x5365d3){while(--_0x5365d3){_0x45a1c1['push'](_0x45a1c1['shift']());}};_0x3428b6(++_0x3a40f2);}(_0xf883,0x177));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3f88('0x0'));var util=require(_0x3f88('0x1'));var logger=require('../../config/logger')(_0x3f88('0x2'));var moment=require('moment');var BPromise=require(_0x3f88('0x3'));var rp=require(_0x3f88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f88('0x5'));var config=require(_0x3f88('0x6'));var attributes=require(_0x3f88('0x7'));module[_0x3f88('0x8')]=function(_0x391e1c,_0x26139d){return _0x391e1c[_0x3f88('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 22a5c98..ade66d4 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 _0x98bc=['../../mysqldb','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./plugin.socket','register','request','then','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','Plugin,\x20%s,\x20%s','message','info','Plugin','create','body','options','raw','CreatePlugin','debug','stringify','catch','lodash','util','bluebird','ioredis'];(function(_0x39acbd,_0x5500fe){var _0x1e146f=function(_0x5b7434){while(--_0x5b7434){_0x39acbd['push'](_0x39acbd['shift']());}};_0x1e146f(++_0x5500fe);}(_0x98bc,0xce));var _0xc98b=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x98bc[_0x1a89a1];return _0x3d5b46;};'use strict';var _=require(_0xc98b('0x0'));var util=require(_0xc98b('0x1'));var moment=require('moment');var BPromise=require(_0xc98b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc98b('0x3'));var db=require(_0xc98b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc98b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc98b('0x6'));var client=jayson[_0xc98b('0x7')][_0xc98b('0x8')]({'port':0x232a});config[_0xc98b('0x9')]=_['defaults'](config[_0xc98b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc98b('0xa'))(new Redis(config['redis']));require(_0xc98b('0xb'))[_0xc98b('0xc')](socket);function respondWithRpcPromise(_0x1369c5,_0x425341,_0x384902){return new BPromise(function(_0x4d5080,_0x4de8d8){return client[_0xc98b('0xd')](_0x1369c5,_0x384902)[_0xc98b('0xe')](function(_0x3f804e){logger['info']('Plugin,\x20%s,\x20%s',_0x425341,_0xc98b('0xf'));logger['debug'](_0xc98b('0x10'),_0x425341,'request\x20sent',JSON['stringify'](_0x3f804e));if(_0x3f804e['error']){if(_0x3f804e[_0xc98b('0x11')]['code']===0x1f4){logger[_0xc98b('0x11')](_0xc98b('0x12'),_0x425341,_0x3f804e[_0xc98b('0x11')]['message']);return _0x4de8d8(_0x3f804e[_0xc98b('0x11')][_0xc98b('0x13')]);}logger['error'](_0xc98b('0x12'),_0x425341,_0x3f804e[_0xc98b('0x11')][_0xc98b('0x13')]);return _0x4d5080(_0x3f804e[_0xc98b('0x11')][_0xc98b('0x13')]);}else{logger[_0xc98b('0x14')](_0xc98b('0x12'),_0x425341,_0xc98b('0xf'));_0x4d5080(_0x3f804e['result'][_0xc98b('0x13')]);}})['catch'](function(_0x289fc3){logger[_0xc98b('0x11')](_0xc98b('0x12'),_0x425341,_0x289fc3);_0x4de8d8(_0x289fc3);});});}exports['CreatePlugin']=function(_0x34cd78){var _0x17e2c2=this;return new Promise(function(_0x3ef60a,_0x2bd6ba){return db[_0xc98b('0x15')][_0xc98b('0x16')](_0x34cd78[_0xc98b('0x17')],{'raw':_0x34cd78['options']?_0x34cd78[_0xc98b('0x18')][_0xc98b('0x19')]===undefined?!![]:![]:!![]})[_0xc98b('0xe')](function(_0x437001){logger[_0xc98b('0x14')](_0xc98b('0x1a'),_0x34cd78);logger[_0xc98b('0x1b')](_0xc98b('0x1a'),_0x34cd78,JSON[_0xc98b('0x1c')](_0x437001));_0x3ef60a(_0x437001);})[_0xc98b('0x1d')](function(_0x13e899){logger[_0xc98b('0x11')](_0xc98b('0x1a'),_0x13e899['message'],_0x34cd78);_0x2bd6ba(_0x17e2c2[_0xc98b('0x11')](0x1f4,_0x13e899[_0xc98b('0x13')]));});});}; \ No newline at end of file +var _0x826d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','create','options','raw','util','moment','bluebird','randomstring'];(function(_0x378cf6,_0x30ea0a){var _0x561525=function(_0x291d7a){while(--_0x291d7a){_0x378cf6['push'](_0x378cf6['shift']());}};_0x561525(++_0x30ea0a);}(_0x826d,0x184));var _0xd826=function(_0x1121c6,_0x4b400d){_0x1121c6=_0x1121c6-0x0;var _0x207280=_0x826d[_0x1121c6];return _0x207280;};'use strict';var _=require('lodash');var util=require(_0xd826('0x0'));var moment=require(_0xd826('0x1'));var BPromise=require(_0xd826('0x2'));var rs=require(_0xd826('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd826('0x4'))['db'];var utils=require(_0xd826('0x5'));var logger=require(_0xd826('0x6'))(_0xd826('0x7'));var config=require(_0xd826('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd826('0x9')]=_['defaults'](config[_0xd826('0x9')],{'host':_0xd826('0xa'),'port':0x18eb});var socket=require(_0xd826('0xb'))(new Redis(config[_0xd826('0x9')]));require('./plugin.socket')[_0xd826('0xc')](socket);function respondWithRpcPromise(_0x3aed65,_0x1aa3dd,_0x2dc436){return new BPromise(function(_0x11d786,_0x1562fd){return client['request'](_0x3aed65,_0x2dc436)[_0xd826('0xd')](function(_0x442c29){logger[_0xd826('0xe')](_0xd826('0xf'),_0x1aa3dd,_0xd826('0x10'));logger['debug'](_0xd826('0x11'),_0x1aa3dd,_0xd826('0x10'),JSON[_0xd826('0x12')](_0x442c29));if(_0x442c29[_0xd826('0x13')]){if(_0x442c29['error'][_0xd826('0x14')]===0x1f4){logger[_0xd826('0x13')](_0xd826('0xf'),_0x1aa3dd,_0x442c29[_0xd826('0x13')][_0xd826('0x15')]);return _0x1562fd(_0x442c29['error'][_0xd826('0x15')]);}logger[_0xd826('0x13')]('Plugin,\x20%s,\x20%s',_0x1aa3dd,_0x442c29[_0xd826('0x13')]['message']);return _0x11d786(_0x442c29[_0xd826('0x13')]['message']);}else{logger['info'](_0xd826('0xf'),_0x1aa3dd,'request\x20sent');_0x11d786(_0x442c29[_0xd826('0x16')][_0xd826('0x15')]);}})[_0xd826('0x17')](function(_0x39d88f){logger[_0xd826('0x13')]('Plugin,\x20%s,\x20%s',_0x1aa3dd,_0x39d88f);_0x1562fd(_0x39d88f);});});}exports[_0xd826('0x18')]=function(_0x2591af){var _0x4822ca=this;return new Promise(function(_0x177880,_0x191a55){return db['Plugin'][_0xd826('0x19')](_0x2591af['body'],{'raw':_0x2591af[_0xd826('0x1a')]?_0x2591af[_0xd826('0x1a')][_0xd826('0x1b')]===undefined?!![]:![]:!![]})[_0xd826('0xd')](function(_0x3cf7a1){logger[_0xd826('0xe')](_0xd826('0x18'),_0x2591af);logger['debug'](_0xd826('0x18'),_0x2591af,JSON[_0xd826('0x12')](_0x3cf7a1));_0x177880(_0x3cf7a1);})[_0xd826('0x17')](function(_0x4c2f71){logger[_0xd826('0x13')](_0xd826('0x18'),_0x4c2f71[_0xd826('0x15')],_0x2591af);_0x191a55(_0x4822ca['error'](0x1f4,_0x4c2f71[_0xd826('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1cd1df2..ef8a38a 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 _0xc505=['length','plugin:','./plugin.events','save','emit','removeListener','register'];(function(_0xf9f689,_0xaa7d83){var _0x1f1f46=function(_0x492246){while(--_0x492246){_0xf9f689['push'](_0xf9f689['shift']());}};_0x1f1f46(++_0xaa7d83);}(_0xc505,0x12f));var _0x5c50=function(_0x68d9f8,_0xc44731){_0x68d9f8=_0x68d9f8-0x0;var _0x53966d=_0xc505[_0x68d9f8];return _0x53966d;};'use strict';var PluginEvents=require(_0x5c50('0x0'));var events=[_0x5c50('0x1'),'remove','update'];function createListener(_0x5a2058,_0x27b67c){return function(_0x395f68){_0x27b67c[_0x5c50('0x2')](_0x5a2058,_0x395f68);};}function removeListener(_0x48525b,_0x15f83d){return function(){PluginEvents[_0x5c50('0x3')](_0x48525b,_0x15f83d);};}exports[_0x5c50('0x4')]=function(_0x18f716){for(var _0x362176=0x0,_0x2a3677=events[_0x5c50('0x5')];_0x362176<_0x2a3677;_0x362176++){var _0x49dc38=events[_0x362176];var _0x27a046=createListener(_0x5c50('0x6')+_0x49dc38,_0x18f716);PluginEvents['on'](_0x49dc38,_0x27a046);}}; \ No newline at end of file +var _0x238b=['remove','update','emit','removeListener','register','plugin:','./plugin.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x238b,0x196));var _0xb238=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x238b[_0x20a584];return _0x4b41a8;};'use strict';var PluginEvents=require(_0xb238('0x0'));var events=[_0xb238('0x1'),_0xb238('0x2'),_0xb238('0x3')];function createListener(_0x9f1294,_0x2e6082){return function(_0x2a18fb){_0x2e6082[_0xb238('0x4')](_0x9f1294,_0x2a18fb);};}function removeListener(_0x3088c3,_0xa089e0){return function(){PluginEvents[_0xb238('0x5')](_0x3088c3,_0xa089e0);};}exports[_0xb238('0x6')]=function(_0xbe4be4){for(var _0xe2ecbd=0x0,_0x4d7623=events['length'];_0xe2ecbd<_0x4d7623;_0xe2ecbd++){var _0x4ceb99=events[_0xe2ecbd];var _0x228361=createListener(_0xb238('0x7')+_0x4ceb99,_0xbe4be4);PluginEvents['on'](_0x4ceb99,_0x228361);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 8a03501..a5ec6bf 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(_0x27b7d2,_0x56c091){var _0x3ef6be=function(_0x6e8a35){while(--_0x6e8a35){_0x27b7d2['push'](_0x27b7d2['shift']());}};_0x3ef6be(++_0x56c091);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x4ee07e,_0xb7eab0){var _0x37f9cd=function(_0x41cceb){while(--_0x41cceb){_0x4ee07e['push'](_0x4ee07e['shift']());}};_0x37f9cd(++_0xb7eab0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 0b2ba38..e6c3524 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 _0xb4e6=['express','motion2','length','describe','params','catch','create','body','script','join','cwd','chdir','dirname','dump','update','restart','hasOwnProperty','Unknown\x20status','delete','lodash','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','send','npm\x20install','info','index','then','reject'];(function(_0x3e5ae1,_0x3d2e00){var _0x2dea96=function(_0x57a927){while(--_0x57a927){_0x3e5ae1['push'](_0x3e5ae1['shift']());}};_0x2dea96(++_0x3d2e00);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0xb4e6[_0x211fef];return _0x5447bf;};'use strict';var _=require(_0x6b4e('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var path=require(_0x6b4e('0x3'));var exec=require(_0x6b4e('0x4'))[_0x6b4e('0x5')];var BPromise=require(_0x6b4e('0x6'));function handleEntityNotFound(_0x1929b8,_0x52313b){return function(_0x40da90){if(!_0x40da90){_0x1929b8[_0x6b4e('0x7')](0x194);;}return _0x40da90;};}function respondWithResult(_0x1f67a2,_0x49de51){_0x49de51=_0x49de51||0xc8;return function(_0xd3138f){if(_0xd3138f){return _0x1f67a2['status'](_0x49de51)['json'](_0xd3138f);}return null;};}function handleError(_0x2311d9,_0x48c870){_0x48c870=_0x48c870||0x1f4;return function(_0x53a71f){logger[_0x6b4e('0x8')](_0x53a71f[_0x6b4e('0x9')]);if(_0x53a71f[_0x6b4e('0xa')]){delete _0x53a71f[_0x6b4e('0xa')];}_0x2311d9[_0x6b4e('0xb')](_0x48c870)[_0x6b4e('0xc')](_0x53a71f);};}function execChildProcess(){return new BPromise(function(_0x323487,_0x49c734){exec(_0x6b4e('0xd'),function(_0x3bba86,_0x58c67d,_0x2a4d0f){logger[_0x6b4e('0xe')](_0x58c67d);logger[_0x6b4e('0xe')](_0x2a4d0f);if(_0x3bba86){logger[_0x6b4e('0x8')](_0x3bba86);return _0x49c734(_0x3bba86);}return _0x323487(_0x58c67d);});});}exports[_0x6b4e('0xf')]=function(_0xa3d358,_0x1db513){return pm2['list']()[_0x6b4e('0x10')](function(_0x29bdee){if(_0x29bdee){var _0x4788cf=_[_0x6b4e('0x11')](_0x29bdee,function(_0x4b62ad){return _0x4b62ad[_0x6b4e('0xa')]===_0x6b4e('0x12')||_0x4b62ad[_0x6b4e('0xa')]===_0x6b4e('0x13');});return{'rows':_0x4788cf,'count':_0x4788cf[_0x6b4e('0x14')]};}return null;})[_0x6b4e('0x10')](respondWithResult(_0x1db513,null))['catch'](handleError(_0x1db513,null));};exports['show']=function(_0x67496d,_0x1beb73){return pm2[_0x6b4e('0x15')](_0x67496d[_0x6b4e('0x16')]['id'])[_0x6b4e('0x10')](respondWithResult(_0x1beb73,null))[_0x6b4e('0x10')](handleEntityNotFound(_0x1beb73,null))[_0x6b4e('0x17')](handleError(_0x1beb73,null));};exports[_0x6b4e('0x18')]=function(_0x35aee1,_0x20a178){if(_0x35aee1[_0x6b4e('0x19')]['name']&&_0x35aee1[_0x6b4e('0x19')][_0x6b4e('0x1a')]){var _0x31fb9d=path[_0x6b4e('0x1b')](__dirname,'../../files/plugins',_0x35aee1[_0x6b4e('0x19')]['script']);var _0x2503a5=process[_0x6b4e('0x1c')]();process[_0x6b4e('0x1d')](path[_0x6b4e('0x1e')](_0x31fb9d));return execChildProcess()[_0x6b4e('0x10')](function(_0x346566){process[_0x6b4e('0x1d')](_0x2503a5);return pm2['start']({'name':_0x35aee1[_0x6b4e('0x19')]['name'],'script':_0x31fb9d});})[_0x6b4e('0x10')](function(_0x884b7e){pm2[_0x6b4e('0x1f')]();return _0x884b7e[0x0];})[_0x6b4e('0x10')](respondWithResult(_0x20a178,0xc9))['catch'](handleError(_0x20a178,null));}else{return _0x20a178[_0x6b4e('0xb')](0x1f4)[_0x6b4e('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x6b4e('0x20')]=function(_0x381ff0,_0x3513b2){if(_0x381ff0[_0x6b4e('0x19')]['id']){delete _0x381ff0['body']['id'];}var _0x2d42be={'online':_0x6b4e('0x21'),'stopped':'stop'};if(_0x2d42be[_0x6b4e('0x22')](_0x381ff0[_0x6b4e('0x19')][_0x6b4e('0xb')])){return pm2[_0x2d42be[_0x381ff0[_0x6b4e('0x19')]['status']]](_0x381ff0[_0x6b4e('0x16')]['id'])[_0x6b4e('0x10')](respondWithResult(_0x3513b2,0xc8))['catch'](handleError(_0x3513b2,null));}else{return _0x3513b2[_0x6b4e('0xb')](0x1f4)[_0x6b4e('0xc')]({'message':_0x6b4e('0x23')});}};exports['destroy']=function(_0x5c2200,_0x11156e){if(_0x5c2200[_0x6b4e('0x19')]['id']){delete _0x5c2200[_0x6b4e('0x19')]['id'];}if(_0x5c2200['params']['id']){return pm2[_0x6b4e('0x24')](_0x5c2200[_0x6b4e('0x16')]['id'])[_0x6b4e('0x10')](function(_0x5c1444){pm2['dump']();return _0x5c1444[0x0];})[_0x6b4e('0x10')](respondWithResult(_0x11156e,null))['catch'](handleError(_0x11156e,null));}else{return _0x11156e[_0x6b4e('0xb')](0x1f4)[_0x6b4e('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xc6d8=['Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/logger','path','exec','sendStatus','status','stack','name','send','npm\x20install','info','error','index','list','then','reject','length','show','describe','create','body','join','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','params','catch'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2f4748,_0x24af55){_0x2f4748=_0x2f4748-0x0;var _0x18eece=_0xc6d8[_0x2f4748];return _0x18eece;};'use strict';var _=require(_0x8c6d('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x8c6d('0x1'))('api');var path=require(_0x8c6d('0x2'));var exec=require('child_process')[_0x8c6d('0x3')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5b6b04,_0x352b8c){return function(_0xdff6f){if(!_0xdff6f){_0x5b6b04[_0x8c6d('0x4')](0x194);;}return _0xdff6f;};}function respondWithResult(_0x4f5e8f,_0x3c265c){_0x3c265c=_0x3c265c||0xc8;return function(_0x2dbb52){if(_0x2dbb52){return _0x4f5e8f[_0x8c6d('0x5')](_0x3c265c)['json'](_0x2dbb52);}return null;};}function handleError(_0x1496ba,_0x75c49f){_0x75c49f=_0x75c49f||0x1f4;return function(_0x16d4b2){logger['error'](_0x16d4b2[_0x8c6d('0x6')]);if(_0x16d4b2[_0x8c6d('0x7')]){delete _0x16d4b2[_0x8c6d('0x7')];}_0x1496ba[_0x8c6d('0x5')](_0x75c49f)[_0x8c6d('0x8')](_0x16d4b2);};}function execChildProcess(){return new BPromise(function(_0x43a7ab,_0x60cd5c){exec(_0x8c6d('0x9'),function(_0x50af75,_0x36d6fb,_0x559d17){logger['info'](_0x36d6fb);logger[_0x8c6d('0xa')](_0x559d17);if(_0x50af75){logger[_0x8c6d('0xb')](_0x50af75);return _0x60cd5c(_0x50af75);}return _0x43a7ab(_0x36d6fb);});});}exports[_0x8c6d('0xc')]=function(_0x8ec2d4,_0x30ecfa){return pm2[_0x8c6d('0xd')]()[_0x8c6d('0xe')](function(_0x103699){if(_0x103699){var _0x14c1ee=_[_0x8c6d('0xf')](_0x103699,function(_0x4fb956){return _0x4fb956[_0x8c6d('0x7')]==='express'||_0x4fb956[_0x8c6d('0x7')]==='motion2';});return{'rows':_0x14c1ee,'count':_0x14c1ee[_0x8c6d('0x10')]};}return null;})[_0x8c6d('0xe')](respondWithResult(_0x30ecfa,null))['catch'](handleError(_0x30ecfa,null));};exports[_0x8c6d('0x11')]=function(_0x2b8a26,_0x51a5fa){return pm2[_0x8c6d('0x12')](_0x2b8a26['params']['id'])['then'](respondWithResult(_0x51a5fa,null))[_0x8c6d('0xe')](handleEntityNotFound(_0x51a5fa,null))['catch'](handleError(_0x51a5fa,null));};exports[_0x8c6d('0x13')]=function(_0x174a4f,_0x1d0f0a){if(_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')]&&_0x174a4f['body']['script']){var _0x550079=path[_0x8c6d('0x15')](__dirname,'../../files/plugins',_0x174a4f[_0x8c6d('0x14')]['script']);var _0x4c378b=process[_0x8c6d('0x16')]();process[_0x8c6d('0x17')](path['dirname'](_0x550079));return execChildProcess()['then'](function(_0x51bb08){process['chdir'](_0x4c378b);return pm2[_0x8c6d('0x18')]({'name':_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')],'script':_0x550079});})['then'](function(_0x41c904){pm2['dump']();return _0x41c904[0x0];})[_0x8c6d('0xe')](respondWithResult(_0x1d0f0a,0xc9))['catch'](handleError(_0x1d0f0a,null));}else{return _0x1d0f0a[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x19')});}};exports[_0x8c6d('0x1a')]=function(_0x1e6755,_0x3e3cd3){if(_0x1e6755[_0x8c6d('0x14')]['id']){delete _0x1e6755[_0x8c6d('0x14')]['id'];}var _0x3eab38={'online':'restart','stopped':'stop'};if(_0x3eab38[_0x8c6d('0x1b')](_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')])){return pm2[_0x3eab38[_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')]]](_0x1e6755[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](respondWithResult(_0x3e3cd3,0xc8))[_0x8c6d('0x1d')](handleError(_0x3e3cd3,null));}else{return _0x3e3cd3[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x1e')});}};exports[_0x8c6d('0x1f')]=function(_0x4e5203,_0x3af625){if(_0x4e5203[_0x8c6d('0x14')]['id']){delete _0x4e5203[_0x8c6d('0x14')]['id'];}if(_0x4e5203[_0x8c6d('0x1c')]['id']){return pm2[_0x8c6d('0x20')](_0x4e5203[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](function(_0x1857f9){pm2[_0x8c6d('0x21')]();return _0x1857f9[0x0];})['then'](respondWithResult(_0x3af625,null))[_0x8c6d('0x1d')](handleError(_0x3af625,null));}else{return _0x3af625['status'](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 5d11478..caa9632 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 _0x808e=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','/queues'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0x808e,0x149));var _0xe808=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x808e[_0x257642];return _0x3d813b;};'use strict';var express=require(_0xe808('0x0'));var router=express[_0xe808('0x1')]();var auth=require(_0xe808('0x2'));var controller=require(_0xe808('0x3'));router[_0xe808('0x4')](_0xe808('0x5'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xe808('0x6'),auth['isAuthenticated'](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0xd8b6=['Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents','/queues','getQueues','express'];(function(_0x227ea0,_0x4d3e91){var _0x5edb7e=function(_0x7c4636){while(--_0x7c4636){_0x227ea0['push'](_0x227ea0['shift']());}};_0x5edb7e(++_0x4d3e91);}(_0xd8b6,0xfb));var _0x6d8b=function(_0x1dcaa3,_0x4601c6){_0x1dcaa3=_0x1dcaa3-0x0;var _0xf670fc=_0xd8b6[_0x1dcaa3];return _0xf670fc;};'use strict';var express=require(_0x6d8b('0x0'));var router=express[_0x6d8b('0x1')]();var auth=require(_0x6d8b('0x2'));var controller=require('./realtime.controller');router[_0x6d8b('0x3')](_0x6d8b('0x4'),auth[_0x6d8b('0x5')](),controller[_0x6d8b('0x6')]);router[_0x6d8b('0x3')](_0x6d8b('0x7'),auth[_0x6d8b('0x5')](),controller[_0x6d8b('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index a955f2b..fd641d7 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 _0x5e58=['map','User','fieldName','role','raw','length','push','literal','order','Pause','forEach','where','merge','user','Agents','agent','online','extraQueryConditions','omit','UserProfile','getResources','findAndCountAll','filterAgentAttributes','globalStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','rawAttributes','type','key','name','outbound','getOptions','QueueCampaigns','filter','assign','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','undefined','count','offset','set','Content-Range','json','getAgents','getChannels','query','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','rows','getAgentIdsByStatus'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x5e58,0x172));var _0x85e5=function(_0x4abcf4,_0x4d80bc){_0x4abcf4=_0x4abcf4-0x0;var _0x24c066=_0x5e58[_0x4abcf4];return _0x24c066;};'use strict';var _=require(_0x85e5('0x0'));var util=require(_0x85e5('0x1'));var rta=require(_0x85e5('0x2'));var rtq=require(_0x85e5('0x3'));var qs=require(_0x85e5('0x4'));var utils=require(_0x85e5('0x5'));var db=require(_0x85e5('0x6'))['db'];var APIBadRequestError=require(_0x85e5('0x7'))['APIBadRequestError'];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x5913eb,_0xc93f99){return function(_0x32f6d5){if(_0x32f6d5){var _0x490c06=typeof _0xc93f99['offset']===_0x85e5('0x8')&&typeof _0xc93f99['limit']===_0x85e5('0x8');var _0x300e76=_0x32f6d5[_0x85e5('0x9')];var _0x5b5802=_0x490c06?0x0:_0xc93f99[_0x85e5('0xa')];var _0x37b08d=_0x490c06?_0x32f6d5[_0x85e5('0x9')]:_0xc93f99[_0x85e5('0xa')]+_0xc93f99['limit'];var _0x2a29f6;if(_0x37b08d>=_0x300e76){_0x37b08d=_0x300e76;_0x2a29f6=0xc8;}else{_0x2a29f6=0xce;}_0x5913eb['status'](_0x2a29f6);return _0x5913eb[_0x85e5('0xb')](_0x85e5('0xc'),_0x5b5802+'-'+_0x37b08d+'/'+_0x300e76)[_0x85e5('0xd')](_0x32f6d5);}return null;};}exports[_0x85e5('0xe')]=function(_0x422fe6,_0x32a560){var _0x103588={'count':0x0,'rows':[]};var _0x350fa5={};var _0x316c84;var _0x97730d=utils[_0x85e5('0xf')]();var _0x4510d4;var _0x572d21;var _0x362351=_0x422fe6[_0x85e5('0x10')]['globalQueueFilter'];var _0x47b40d=_0x422fe6[_0x85e5('0x10')]['globalStatusFilter'];var _0x4f2135=_0x422fe6[_0x85e5('0x10')][_0x85e5('0x11')];var _0x2b7676=_0x47b40d===_0x85e5('0x12')||_0x47b40d===_0x85e5('0x13')?!![]:![];var _0x3981f0=[];var _0x1a2c16;var _0x115663;Promise[_0x85e5('0x14')]()[_0x85e5('0x15')](function(){if(_0x422fe6[_0x85e5('0x10')][_0x85e5('0x16')]){if(!utils[_0x85e5('0x17')](_0x422fe6[_0x85e5('0x10')][_0x85e5('0x16')])){throw new APIBadRequestError(util[_0x85e5('0x18')](_0x85e5('0x19'),_0x422fe6[_0x85e5('0x10')][_0x85e5('0x16')]));}_0x316c84=_0x422fe6[_0x85e5('0x10')][_0x85e5('0x16')][_0x85e5('0x1a')]();}if(!_0x422fe6[_0x85e5('0x10')][_0x85e5('0x1b')]||!_0x422fe6[_0x85e5('0x10')]['sort'][_0x85e5('0x1c')]('globalStatus')){_0x422fe6[_0x85e5('0x10')][_0x85e5('0x1b')]=rta['validateSortParameter'](_0x422fe6[_0x85e5('0x10')][_0x85e5('0x1b')]);return;}var _0x5c7fa6=rta[_0x85e5('0x1d')](_0x422fe6[_0x85e5('0x10')][_0x85e5('0x1b')]);_0x422fe6[_0x85e5('0x10')][_0x85e5('0x1b')]=_0x5c7fa6[_0x85e5('0x1e')][_0x85e5('0x1f')](',');_0x1a2c16=_0x5c7fa6['order'];})[_0x85e5('0x15')](function(){if(!_0x362351){return[];}return rta[_0x85e5('0x20')](_0x362351,_0x316c84);})[_0x85e5('0x15')](function(_0xb3016b){_0x3981f0=_0xb3016b;return rta['getRealtimeAgents']();})[_0x85e5('0x15')](function(_0x57a654){_0x572d21=_0x57a654[_0x85e5('0x21')];if((!_0x47b40d||_0x2b7676)&&!_0x1a2c16){return _0x3981f0;}if(_0x1a2c16&&!_0x47b40d){return rta['getSortedAgentsIdsByStatus'](_0x572d21,_0x3981f0,_0x1a2c16);}else{return rta[_0x85e5('0x22')](_0x572d21,_0x3981f0,_0x47b40d);}})[_0x85e5('0x15')](function(_0x5e78dc){_0x3981f0=_0x5e78dc;var _0x4e3ba5=![];if(_0x3981f0['length']===0x0){if(_0x362351||_0x47b40d){_0x4e3ba5=!![];}if(_0x2b7676){_0x4e3ba5=![];}}if(_0x4e3ba5){return _0x103588;}var _0x388e4a=_[_0x85e5('0x23')](db[_0x85e5('0x24')]['rawAttributes'],function(_0x517f35){return{'name':_0x517f35[_0x85e5('0x25')],'type':_0x517f35['type']['key']};});_0x422fe6[_0x85e5('0x10')][_0x85e5('0x26')]='agent';_0x350fa5=qs['getOptions'](_0x388e4a,_0x422fe6);_0x350fa5[_0x85e5('0x27')]=!![];var _0x428d96=[];if(_0x3981f0[_0x85e5('0x28')]>0x0){_0x428d96[_0x85e5('0x29')]({'id':{'$in':_0x3981f0}});if(_0x1a2c16&&!_0x47b40d){_0x115663=[db['sequelize'][_0x85e5('0x2a')]('FIELD(id,'+_0x3981f0+')')];_0x350fa5[_0x85e5('0x2b')]=_0x115663;}}if(_0x2b7676){_0x97730d['forEach'](function(_0x4dc2dc){var _0x19795b=!![];if(_0x47b40d===_0x85e5('0x13')&&_0x316c84!==_0x4dc2dc){_0x19795b=![];}_0x428d96[_0x85e5('0x29')]({[_0x4dc2dc+_0x85e5('0x2c')]:_0x19795b});});if(_0x4f2135){_0x428d96['push']({'pauseType':_0x4f2135});}}else if(_0x47b40d){_0x97730d[_0x85e5('0x2d')](function(_0x5a0b14){_0x428d96[_0x85e5('0x29')]({[_0x5a0b14+_0x85e5('0x2c')]:![]});});}_0x350fa5[_0x85e5('0x2e')]=_[_0x85e5('0x2f')](_0x350fa5['where'],{'$and':_0x428d96});if(_0x422fe6[_0x85e5('0x30')][_0x85e5('0x26')]===_0x85e5('0x30')){var _0xc9b35={'params':{'id':_0x422fe6[_0x85e5('0x30')]['userProfileId']},'query':{'section':_0x85e5('0x31'),'role':_0x85e5('0x32'),'raw':!![],'ids':_0x3981f0,'customSorting':_0x115663}};if(_0x422fe6['query'][_0x85e5('0x33')]){_0xc9b35[_0x85e5('0x10')][_0x85e5('0x33')]=!![];}if(_0x2b7676){_0xc9b35[_0x85e5('0x10')][_0x85e5('0x34')]=_0x428d96;}_0xc9b35[_0x85e5('0x10')]=Object['assign'](_0xc9b35[_0x85e5('0x10')],_[_0x85e5('0x35')](_0x422fe6[_0x85e5('0x10')],'id'));return db[_0x85e5('0x36')][_0x85e5('0x37')](_0xc9b35);}return db[_0x85e5('0x24')][_0x85e5('0x38')](_0x350fa5);})[_0x85e5('0x15')](function(_0x8e59e5){_0x103588[_0x85e5('0x9')]=_0x8e59e5[_0x85e5('0x9')];_0x4510d4=_0x8e59e5[_0x85e5('0x21')];return _0x4510d4[_0x85e5('0x23')](function(_0xfbff36){var _0x24814f=_['find'](_0x572d21,['id',_0xfbff36['id']]);if(_0x24814f){var _0x3acdd8=rta[_0x85e5('0x39')](_0x24814f);_[_0x85e5('0x2f')](_0xfbff36,_0x3acdd8);}_0xfbff36['globalStatus']=rta['getAgentStatus'](_0xfbff36);if(_0xfbff36[_0x85e5('0x3a')][_0x85e5('0x1c')]('pause')){_0x97730d['forEach'](function(_0x583400){if(_0xfbff36[_0x583400+_0x85e5('0x2c')]){if(_0x583400===_0x85e5('0x3b')){if(_0xfbff36[_0x85e5('0x3c')]!==_0x85e5('0x3d')){_0xfbff36[_0x85e5('0x3c')]=_0x85e5('0x12');}}else{_0xfbff36[_0x583400+_0x85e5('0x3e')]='pause';}}});}return _0xfbff36;});})['then'](function(_0x59f288){if(!_0x1a2c16||_0x115663){return _0x59f288;}return rta[_0x85e5('0x3f')](_0x59f288,_0x1a2c16);})[_0x85e5('0x15')](function(_0x14b30d){var _0x4131aa=rta[_0x85e5('0x40')]();_0x103588[_0x85e5('0x21')]=_0x14b30d[_0x85e5('0x23')](function(_0xf94ebf){return _[_0x85e5('0x41')](_0xf94ebf,_0x4131aa);});return _0x103588;})[_0x85e5('0x15')](respondWithFilteredResult(_0x32a560,_0x350fa5))[_0x85e5('0x42')](APIHandleError(_0x32a560));};exports[_0x85e5('0x43')]=function(_0x5b4788,_0x16fca0){var _0x219d84={'count':0x0,'rows':[]};var _0x4d37ac={};var _0x4f1df3;var _0x5910ab;var _0xeb0e35;Promise[_0x85e5('0x14')]()[_0x85e5('0x15')](function(){if(_0x5b4788[_0x85e5('0x10')]['channel']){if(!utils[_0x85e5('0x17')](_0x5b4788[_0x85e5('0x10')][_0x85e5('0x16')])){throw new APIBadRequestError(util[_0x85e5('0x18')](_0x85e5('0x19'),_0x5b4788[_0x85e5('0x10')][_0x85e5('0x16')]));}_0x4f1df3=_0x5b4788[_0x85e5('0x10')]['channel'][_0x85e5('0x1a')]();}var _0x34484e=_[_0x85e5('0x44')](_0x4f1df3)+_0x85e5('0x45');var _0x2a567f=_[_0x85e5('0x23')](db[_0x34484e][_0x85e5('0x46')],function(_0xcc25e8){return{'name':_0xcc25e8['fieldName'],'type':_0xcc25e8[_0x85e5('0x47')][_0x85e5('0x48')]};});if(!_0x5b4788['query'][_0x85e5('0x1e')]){var _0x4a4669=['id',_0x85e5('0x49')];if(_0x4f1df3===_0x85e5('0x3b')){_0x4a4669[_0x85e5('0x29')](_0x85e5('0x47'));if(_0x5b4788[_0x85e5('0x10')][_0x85e5('0x47')]===_0x85e5('0x4a')){_0x4a4669[_0x85e5('0x29')](['dialActive','dialMethod']);}}_0x5b4788[_0x85e5('0x10')][_0x85e5('0x1e')]=_0x4a4669[_0x85e5('0x1f')](',');}_0x4d37ac=qs[_0x85e5('0x4b')](_0x2a567f,_0x5b4788);if(_0x5b4788[_0x85e5('0x30')]['role']===_0x85e5('0x30')){var _0x120283={'params':{'id':_0x5b4788[_0x85e5('0x30')]['userProfileId']},'query':{'section':_0x4f1df3===_0x85e5('0x3b')&&_0x5b4788[_0x85e5('0x10')][_0x85e5('0x47')]===_0x85e5('0x4a')?_0x85e5('0x4c'):_[_0x85e5('0x44')](_0x4f1df3)+'Queues','type':_0x5b4788['query'][_0x85e5('0x47')],'nolimit':!![],'sort':_0x85e5('0x49'),'filter':_0x5b4788[_0x85e5('0x10')][_0x85e5('0x4d')]}};_0x120283[_0x85e5('0x10')]=Object[_0x85e5('0x4e')](_0x120283[_0x85e5('0x10')],_0x5b4788[_0x85e5('0x10')]);delete _0x120283[_0x85e5('0x10')]['id'];return db[_0x85e5('0x36')][_0x85e5('0x37')](_0x120283);}return db[_0x34484e][_0x85e5('0x38')](_0x4d37ac);})[_0x85e5('0x15')](function(_0x5f5674){_0x219d84[_0x85e5('0x9')]=_0x5f5674[_0x85e5('0x9')];_0x5910ab=_0x5f5674[_0x85e5('0x21')];return rtq[_0x85e5('0x4f')](_0x5b4788,_0x4f1df3);})[_0x85e5('0x15')](function(_0xce485f){_0xeb0e35=_0xce485f[_0x85e5('0x21')];return rtq[_0x85e5('0x50')](_0x5910ab,_0xeb0e35,_0x4f1df3,_0x5b4788[_0x85e5('0x10')][_0x85e5('0x47')]);})['then'](function(_0x190026){_0x219d84['rows']=_0x190026;return _0x219d84;})['then'](respondWithFilteredResult(_0x16fca0,_0x4d37ac))[_0x85e5('0x42')](APIHandleError(_0x16fca0));}; \ No newline at end of file +var _0x9730=['getUpdatedSortOptions','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','UserProfile','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voice','talking','voiceStatus','pause','Status','sortAgentsByStatus','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','fields','dialActive','dialMethod','outbound','QueueCampaigns','assign','getResources','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','*pause','resolve','then','isValidChannel','channel','format','toLowerCase','sort','globalStatus','validateSortParameter'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9730,0x1e1));var _0x0973=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9730[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0973('0x0'));var util=require('util');var rta=require(_0x0973('0x1'));var rtq=require(_0x0973('0x2'));var qs=require(_0x0973('0x3'));var utils=require(_0x0973('0x4'));var db=require(_0x0973('0x5'))['db'];var APIBadRequestError=require(_0x0973('0x6'))['APIBadRequestError'];var APIHandleError=require(_0x0973('0x6'))['handleError'];function respondWithFilteredResult(_0x3d8c6d,_0x41ccc1){return function(_0xdd4d6c){if(_0xdd4d6c){var _0x40e2ca=typeof _0x41ccc1[_0x0973('0x7')]===_0x0973('0x8')&&typeof _0x41ccc1[_0x0973('0x9')]===_0x0973('0x8');var _0x3b840f=_0xdd4d6c[_0x0973('0xa')];var _0x108ce5=_0x40e2ca?0x0:_0x41ccc1[_0x0973('0x7')];var _0x3e1fc7=_0x40e2ca?_0xdd4d6c['count']:_0x41ccc1[_0x0973('0x7')]+_0x41ccc1['limit'];var _0x2188ce;if(_0x3e1fc7>=_0x3b840f){_0x3e1fc7=_0x3b840f;_0x2188ce=0xc8;}else{_0x2188ce=0xce;}_0x3d8c6d[_0x0973('0xb')](_0x2188ce);return _0x3d8c6d[_0x0973('0xc')](_0x0973('0xd'),_0x108ce5+'-'+_0x3e1fc7+'/'+_0x3b840f)[_0x0973('0xe')](_0xdd4d6c);}return null;};}exports[_0x0973('0xf')]=function(_0x2707c2,_0x19e6f4){var _0x235edb={'count':0x0,'rows':[]};var _0x3cb072={};var _0x2b2019;var _0x2f1492=utils[_0x0973('0x10')]();var _0x190b2b;var _0x53ff35;var _0x47dfbb=_0x2707c2[_0x0973('0x11')][_0x0973('0x12')];var _0x58dba3=_0x2707c2[_0x0973('0x11')]['globalStatusFilter'];var _0x24920a=_0x2707c2['query']['pauseTypeFilter'];var _0x49a13a=_0x58dba3==='pause'||_0x58dba3===_0x0973('0x13')?!![]:![];var _0x55658f=[];var _0x1d90d2;var _0xf02341;Promise[_0x0973('0x14')]()[_0x0973('0x15')](function(){if(_0x2707c2[_0x0973('0x11')]['channel']){if(!utils[_0x0973('0x16')](_0x2707c2[_0x0973('0x11')][_0x0973('0x17')])){throw new APIBadRequestError(util[_0x0973('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2707c2[_0x0973('0x11')][_0x0973('0x17')]));}_0x2b2019=_0x2707c2['query'][_0x0973('0x17')][_0x0973('0x19')]();}if(!_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]||!_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]['includes'](_0x0973('0x1b'))){_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]=rta[_0x0973('0x1c')](_0x2707c2[_0x0973('0x11')]['sort']);return;}var _0xc30250=rta[_0x0973('0x1d')](_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]);_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]=_0xc30250['fields'][_0x0973('0x1e')](',');_0x1d90d2=_0xc30250[_0x0973('0x1f')];})[_0x0973('0x15')](function(){if(!_0x47dfbb){return[];}return rta[_0x0973('0x20')](_0x47dfbb,_0x2b2019);})['then'](function(_0x156358){_0x55658f=_0x156358;return rta[_0x0973('0x21')]();})[_0x0973('0x15')](function(_0x54f73f){_0x53ff35=_0x54f73f[_0x0973('0x22')];if((!_0x58dba3||_0x49a13a)&&!_0x1d90d2){return _0x55658f;}if(_0x1d90d2&&!_0x58dba3){return rta[_0x0973('0x23')](_0x53ff35,_0x55658f,_0x1d90d2);}else{return rta[_0x0973('0x24')](_0x53ff35,_0x55658f,_0x58dba3);}})[_0x0973('0x15')](function(_0x51114c){_0x55658f=_0x51114c;var _0x416eb4=![];if(_0x55658f[_0x0973('0x25')]===0x0){if(_0x47dfbb||_0x58dba3){_0x416eb4=!![];}if(_0x49a13a){_0x416eb4=![];}}if(_0x416eb4){return _0x235edb;}var _0x134761=_[_0x0973('0x26')](db[_0x0973('0x27')][_0x0973('0x28')],function(_0x54324c){return{'name':_0x54324c[_0x0973('0x29')],'type':_0x54324c[_0x0973('0x2a')][_0x0973('0x2b')]};});_0x2707c2[_0x0973('0x11')][_0x0973('0x2c')]=_0x0973('0x2d');_0x3cb072=qs[_0x0973('0x2e')](_0x134761,_0x2707c2);_0x3cb072[_0x0973('0x2f')]=!![];var _0x4ec339=[];if(_0x55658f[_0x0973('0x25')]>0x0){_0x4ec339[_0x0973('0x30')]({'id':{'$in':_0x55658f}});if(_0x1d90d2&&!_0x58dba3){_0xf02341=[db['sequelize'][_0x0973('0x31')](_0x0973('0x32')+_0x55658f+')')];_0x3cb072[_0x0973('0x1f')]=_0xf02341;}}if(_0x49a13a){_0x2f1492[_0x0973('0x33')](function(_0x5d4af9){var _0x51a5a0=!![];if(_0x58dba3===_0x0973('0x13')&&_0x2b2019!==_0x5d4af9){_0x51a5a0=![];}_0x4ec339[_0x0973('0x30')]({[_0x5d4af9+_0x0973('0x34')]:_0x51a5a0});});if(_0x24920a){_0x4ec339['push']({'pauseType':_0x24920a});}}else if(_0x58dba3){_0x2f1492['forEach'](function(_0x5ac474){_0x4ec339['push']({[_0x5ac474+_0x0973('0x34')]:![]});});}_0x3cb072[_0x0973('0x35')]=_[_0x0973('0x36')](_0x3cb072[_0x0973('0x35')],{'$and':_0x4ec339});if(_0x2707c2[_0x0973('0x37')][_0x0973('0x2c')]===_0x0973('0x37')){var _0x57069b={'params':{'id':_0x2707c2[_0x0973('0x37')][_0x0973('0x38')]},'query':{'section':_0x0973('0x39'),'role':_0x0973('0x2d'),'raw':!![],'ids':_0x55658f,'customSorting':_0xf02341}};if(_0x2707c2[_0x0973('0x11')][_0x0973('0x3a')]){_0x57069b[_0x0973('0x11')][_0x0973('0x3a')]=!![];}if(_0x49a13a){_0x57069b[_0x0973('0x11')][_0x0973('0x3b')]=_0x4ec339;}_0x57069b[_0x0973('0x11')]=Object['assign'](_0x57069b['query'],_['omit'](_0x2707c2[_0x0973('0x11')],'id'));return db[_0x0973('0x3c')]['getResources'](_0x57069b);}return db['User'][_0x0973('0x3d')](_0x3cb072);})[_0x0973('0x15')](function(_0x14e419){_0x235edb[_0x0973('0xa')]=_0x14e419['count'];_0x190b2b=_0x14e419[_0x0973('0x22')];return _0x190b2b['map'](function(_0x315e9a){var _0x2c7962=_[_0x0973('0x3e')](_0x53ff35,['id',_0x315e9a['id']]);if(_0x2c7962){var _0x28895d=rta[_0x0973('0x3f')](_0x2c7962);_[_0x0973('0x36')](_0x315e9a,_0x28895d);}_0x315e9a['globalStatus']=rta[_0x0973('0x40')](_0x315e9a);if(_0x315e9a['globalStatus']['includes']('pause')){_0x2f1492[_0x0973('0x33')](function(_0x23f122){if(_0x315e9a[_0x23f122+_0x0973('0x34')]){if(_0x23f122===_0x0973('0x41')){if(_0x315e9a['voiceStatus']!==_0x0973('0x42')){_0x315e9a[_0x0973('0x43')]=_0x0973('0x44');}}else{_0x315e9a[_0x23f122+_0x0973('0x45')]=_0x0973('0x44');}}});}return _0x315e9a;});})[_0x0973('0x15')](function(_0x58e8e7){if(!_0x1d90d2||_0xf02341){return _0x58e8e7;}return rta[_0x0973('0x46')](_0x58e8e7,_0x1d90d2);})[_0x0973('0x15')](function(_0x47623a){var _0x270597=rta['getRealtimeAgentsQueryFields']();_0x235edb['rows']=_0x47623a[_0x0973('0x26')](function(_0x2ce059){return _[_0x0973('0x47')](_0x2ce059,_0x270597);});return _0x235edb;})['then'](respondWithFilteredResult(_0x19e6f4,_0x3cb072))[_0x0973('0x48')](APIHandleError(_0x19e6f4));};exports[_0x0973('0x49')]=function(_0x4498ed,_0x51195b){var _0x3bd841={'count':0x0,'rows':[]};var _0x160776={};var _0x231db3;var _0x14c296;var _0x50276f;Promise[_0x0973('0x14')]()[_0x0973('0x15')](function(){if(_0x4498ed['query']['channel']){if(!utils[_0x0973('0x16')](_0x4498ed[_0x0973('0x11')][_0x0973('0x17')])){throw new APIBadRequestError(util['format'](_0x0973('0x4a'),_0x4498ed[_0x0973('0x11')][_0x0973('0x17')]));}_0x231db3=_0x4498ed['query'][_0x0973('0x17')][_0x0973('0x19')]();}var _0x83bd9=_[_0x0973('0x4b')](_0x231db3)+'Queue';var _0xb10b18=_[_0x0973('0x26')](db[_0x83bd9][_0x0973('0x28')],function(_0x320240){return{'name':_0x320240[_0x0973('0x29')],'type':_0x320240[_0x0973('0x2a')][_0x0973('0x2b')]};});if(!_0x4498ed[_0x0973('0x11')][_0x0973('0x4c')]){var _0x25368c=['id','name'];if(_0x231db3===_0x0973('0x41')){_0x25368c[_0x0973('0x30')](_0x0973('0x2a'));if(_0x4498ed[_0x0973('0x11')][_0x0973('0x2a')]==='outbound'){_0x25368c[_0x0973('0x30')]([_0x0973('0x4d'),_0x0973('0x4e')]);}}_0x4498ed[_0x0973('0x11')]['fields']=_0x25368c[_0x0973('0x1e')](',');}_0x160776=qs[_0x0973('0x2e')](_0xb10b18,_0x4498ed);if(_0x4498ed['user'][_0x0973('0x2c')]===_0x0973('0x37')){var _0x4a1375={'params':{'id':_0x4498ed['user'][_0x0973('0x38')]},'query':{'section':_0x231db3==='voice'&&_0x4498ed[_0x0973('0x11')][_0x0973('0x2a')]===_0x0973('0x4f')?_0x0973('0x50'):_[_0x0973('0x4b')](_0x231db3)+'Queues','type':_0x4498ed[_0x0973('0x11')]['type'],'nolimit':!![],'sort':'name','filter':_0x4498ed[_0x0973('0x11')]['filter']}};_0x4a1375[_0x0973('0x11')]=Object[_0x0973('0x51')](_0x4a1375[_0x0973('0x11')],_0x4498ed[_0x0973('0x11')]);delete _0x4a1375[_0x0973('0x11')]['id'];return db[_0x0973('0x3c')][_0x0973('0x52')](_0x4a1375);}return db[_0x83bd9][_0x0973('0x3d')](_0x160776);})['then'](function(_0x40e5cc){_0x3bd841[_0x0973('0xa')]=_0x40e5cc[_0x0973('0xa')];_0x14c296=_0x40e5cc[_0x0973('0x22')];return rtq[_0x0973('0x53')](_0x4498ed,_0x231db3);})[_0x0973('0x15')](function(_0x1ff8e0){_0x50276f=_0x1ff8e0[_0x0973('0x22')];return rtq[_0x0973('0x54')](_0x14c296,_0x50276f,_0x231db3,_0x4498ed[_0x0973('0x11')][_0x0973('0x2a')]);})[_0x0973('0x15')](function(_0xe30678){_0x3bd841['rows']=_0xe30678;return _0x3bd841;})['then'](respondWithFilteredResult(_0x51195b,_0x160776))[_0x0973('0x48')](APIHandleError(_0x51195b));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f3e0fbb..d38d89c 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(_0x1ddcc9,_0x277532){var _0x55b618=function(_0x5d1b07){while(--_0x5d1b07){_0x1ddcc9['push'](_0x1ddcc9['shift']());}};_0x55b618(++_0x277532);}(_0x70e0,0x17b));var _0x070e=function(_0x5cd0e3,_0x2d99cd){_0x5cd0e3=_0x5cd0e3-0x0;var _0xf9cea4=_0x70e0[_0x5cd0e3];return _0xf9cea4;};'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(_0x5c9f2a,_0x4f465c){var _0x27266e=function(_0x5abed){while(--_0x5abed){_0x5c9f2a['push'](_0x5c9f2a['shift']());}};_0x27266e(++_0x4f465c);}(_0xe706,0xa3));var _0x6e70=function(_0x5a039f,_0x2c6ee6){_0x5a039f=_0x5a039f-0x0;var _0x304d1d=_0xe706[_0x5a039f];return _0x304d1d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c39d526..d212b48 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 _0xd307=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xd307,0x110));var _0x7d30=function(_0x49493d,_0x344a57){_0x49493d=_0x49493d-0x0;var _0x31c28e=_0xd307[_0x49493d];return _0x31c28e;};'use strict';var Sequelize=require(_0x7d30('0x0'));module[_0x7d30('0x1')]={'state':{'type':Sequelize[_0x7d30('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7d30('0x3')]},'scheduledat':{'type':Sequelize[_0x7d30('0x4')]},'uniqueid':{'type':Sequelize[_0x7d30('0x3')]},'starttime':{'type':Sequelize[_0x7d30('0x4')]},'responsetime':{'type':Sequelize[_0x7d30('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7d30('0x3')]},'campaigntype':{'type':Sequelize[_0x7d30('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa46e=['STRING','DATE','sequelize','exports'];(function(_0x3a037b,_0x25ec24){var _0x11b964=function(_0x267d89){while(--_0x267d89){_0x3a037b['push'](_0x3a037b['shift']());}};_0x11b964(++_0x25ec24);}(_0xa46e,0x8a));var _0xea46=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xa46e[_0x597484];return _0x218e64;};'use strict';var Sequelize=require(_0xea46('0x0'));module[_0xea46('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xea46('0x2')]},'scheduledat':{'type':Sequelize[_0xea46('0x3')]},'uniqueid':{'type':Sequelize[_0xea46('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xea46('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xea46('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xea46('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 9bbfbd2..a32f7c1 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 _0x9e52=['bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','ReportAgentPreview','lodash','../../config/logger','api'];(function(_0x4fb808,_0xee34b5){var _0x2dec98=function(_0x30626e){while(--_0x30626e){_0x4fb808['push'](_0x4fb808['shift']());}};_0x2dec98(++_0xee34b5);}(_0x9e52,0x165));var _0x29e5=function(_0x2394ad,_0x7dabc6){_0x2394ad=_0x2394ad-0x0;var _0x138983=_0x9e52[_0x2394ad];return _0x138983;};'use strict';var _=require(_0x29e5('0x0'));var util=require('util');var logger=require(_0x29e5('0x1'))(_0x29e5('0x2'));var moment=require('moment');var BPromise=require(_0x29e5('0x3'));var rp=require(_0x29e5('0x4'));var fs=require('fs');var path=require(_0x29e5('0x5'));var rimraf=require(_0x29e5('0x6'));var config=require('../../config/environment');var attributes=require(_0x29e5('0x7'));module[_0x29e5('0x8')]=function(_0x23e01c,_0x14d937){return _0x23e01c['define'](_0x29e5('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6196=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','define'];(function(_0x4878aa,_0x9d272d){var _0x4f5086=function(_0x55f9e0){while(--_0x55f9e0){_0x4878aa['push'](_0x4878aa['shift']());}};_0x4f5086(++_0x9d272d);}(_0x6196,0x12d));var _0x6619=function(_0x7c94a3,_0x19083e){_0x7c94a3=_0x7c94a3-0x0;var _0x58063d=_0x6196[_0x7c94a3];return _0x58063d;};'use strict';var _=require(_0x6619('0x0'));var util=require(_0x6619('0x1'));var logger=require(_0x6619('0x2'))(_0x6619('0x3'));var moment=require(_0x6619('0x4'));var BPromise=require(_0x6619('0x5'));var rp=require(_0x6619('0x6'));var fs=require('fs');var path=require(_0x6619('0x7'));var rimraf=require('rimraf');var config=require(_0x6619('0x8'));var attributes=require(_0x6619('0x9'));module['exports']=function(_0x17fa50,_0x584194){return _0x17fa50[_0x6619('0xa')](_0x6619('0xb'),attributes,{'tableName':_0x6619('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 308a924..90c943e 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 _0x3368=['stringify','lodash','moment','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','raw','CreateReportAgentPreview'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0x3368,0x19f));var _0x8336=function(_0x4e5f6f,_0x462fbb){_0x4e5f6f=_0x4e5f6f-0x0;var _0x5b489b=_0x3368[_0x4e5f6f];return _0x5b489b;};'use strict';var _=require(_0x8336('0x0'));var util=require('util');var moment=require(_0x8336('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8336('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8336('0x3'))('rpc');var config=require(_0x8336('0x4'));var jayson=require(_0x8336('0x5'));var client=jayson['client'][_0x8336('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x478322,_0x5d5aec,_0x5a4133){return new BPromise(function(_0x40f371,_0x590d2f){return client[_0x8336('0x7')](_0x478322,_0x5a4133)[_0x8336('0x8')](function(_0x102e26){logger[_0x8336('0x9')](_0x8336('0xa'),_0x5d5aec,_0x8336('0xb'));logger[_0x8336('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5d5aec,_0x8336('0xb'),JSON['stringify'](_0x102e26));if(_0x102e26['error']){if(_0x102e26[_0x8336('0xd')][_0x8336('0xe')]===0x1f4){logger['error'](_0x8336('0xa'),_0x5d5aec,_0x102e26['error'][_0x8336('0xf')]);return _0x590d2f(_0x102e26[_0x8336('0xd')][_0x8336('0xf')]);}logger[_0x8336('0xd')](_0x8336('0xa'),_0x5d5aec,_0x102e26[_0x8336('0xd')][_0x8336('0xf')]);return _0x40f371(_0x102e26[_0x8336('0xd')][_0x8336('0xf')]);}else{logger[_0x8336('0x9')](_0x8336('0xa'),_0x5d5aec,_0x8336('0xb'));_0x40f371(_0x102e26[_0x8336('0x10')][_0x8336('0xf')]);}})[_0x8336('0x11')](function(_0x12f3cc){logger[_0x8336('0xd')](_0x8336('0xa'),_0x5d5aec,_0x12f3cc);_0x590d2f(_0x12f3cc);});});}exports['CreateReportAgentPreview']=function(_0x5c1735){var _0x54fcd4=this;return new Promise(function(_0x47af12,_0x5b7838){return db['ReportAgentPreview'][_0x8336('0x12')](_0x5c1735[_0x8336('0x13')],{'raw':_0x5c1735['options']?_0x5c1735['options'][_0x8336('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x386a16){logger[_0x8336('0x9')](_0x8336('0x15'),_0x5c1735);logger[_0x8336('0xc')]('CreateReportAgentPreview',_0x5c1735,JSON[_0x8336('0x16')](_0x386a16));_0x47af12(_0x386a16);})[_0x8336('0x11')](function(_0x4378d3){logger[_0x8336('0xd')](_0x8336('0x15'),_0x4378d3[_0x8336('0xf')],_0x5c1735);_0x5b7838(_0x54fcd4[_0x8336('0xd')](0x1f4,_0x4378d3['message']));});});}; \ No newline at end of file +var _0xd76c=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','stringify','moment'];(function(_0x1bc6d3,_0x24ec7e){var _0x30db07=function(_0x46caf1){while(--_0x46caf1){_0x1bc6d3['push'](_0x1bc6d3['shift']());}};_0x30db07(++_0x24ec7e);}(_0xd76c,0x1cb));var _0xcd76=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xd76c[_0x5cc8];return _0x450661;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcd76('0x0'));var BPromise=require('bluebird');var rs=require(_0xcd76('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd76('0x2'))['db'];var utils=require(_0xcd76('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xcd76('0x4'));var jayson=require(_0xcd76('0x5'));var client=jayson[_0xcd76('0x6')][_0xcd76('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2772ed,_0x5c72ee,_0x373c10){return new BPromise(function(_0x58cbfa,_0xecc20b){return client['request'](_0x2772ed,_0x373c10)[_0xcd76('0x8')](function(_0x1a162f){logger[_0xcd76('0x9')](_0xcd76('0xa'),_0x5c72ee,_0xcd76('0xb'));logger[_0xcd76('0xc')](_0xcd76('0xd'),_0x5c72ee,'request\x20sent',JSON['stringify'](_0x1a162f));if(_0x1a162f[_0xcd76('0xe')]){if(_0x1a162f[_0xcd76('0xe')][_0xcd76('0xf')]===0x1f4){logger[_0xcd76('0xe')](_0xcd76('0xa'),_0x5c72ee,_0x1a162f[_0xcd76('0xe')][_0xcd76('0x10')]);return _0xecc20b(_0x1a162f[_0xcd76('0xe')][_0xcd76('0x10')]);}logger[_0xcd76('0xe')](_0xcd76('0xa'),_0x5c72ee,_0x1a162f[_0xcd76('0xe')][_0xcd76('0x10')]);return _0x58cbfa(_0x1a162f[_0xcd76('0xe')][_0xcd76('0x10')]);}else{logger[_0xcd76('0x9')](_0xcd76('0xa'),_0x5c72ee,'request\x20sent');_0x58cbfa(_0x1a162f['result'][_0xcd76('0x10')]);}})[_0xcd76('0x11')](function(_0x579516){logger[_0xcd76('0xe')](_0xcd76('0xa'),_0x5c72ee,_0x579516);_0xecc20b(_0x579516);});});}exports[_0xcd76('0x12')]=function(_0x2d27b5){var _0x1b92f8=this;return new Promise(function(_0x181bd5,_0x399ecc){return db[_0xcd76('0x13')][_0xcd76('0x14')](_0x2d27b5['body'],{'raw':_0x2d27b5[_0xcd76('0x15')]?_0x2d27b5['options']['raw']===undefined?!![]:![]:!![]})[_0xcd76('0x8')](function(_0x1a74b7){logger['info']('CreateReportAgentPreview',_0x2d27b5);logger[_0xcd76('0xc')](_0xcd76('0x12'),_0x2d27b5,JSON[_0xcd76('0x16')](_0x1a74b7));_0x181bd5(_0x1a74b7);})[_0xcd76('0x11')](function(_0x137269){logger['error']('CreateReportAgentPreview',_0x137269[_0xcd76('0x10')],_0x2d27b5);_0x399ecc(_0x1b92f8[_0xcd76('0xe')](0x1f4,_0x137269[_0xcd76('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3bf75cc..daca559 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 _0xdace=['/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdace,0xad));var _0xedac=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0xdace[_0x5192de];return _0x4e287e;};'use strict';var multer=require(_0xedac('0x0'));var util=require(_0xedac('0x1'));var path=require(_0xedac('0x2'));var express=require(_0xedac('0x3'));var router=express[_0xedac('0x4')]();var auth=require(_0xedac('0x5'));var controller=require(_0xedac('0x6'));router[_0xedac('0x7')](_0xedac('0x8'),auth[_0xedac('0x9')](),controller[_0xedac('0xa')]);router[_0xedac('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xedac('0x9')](),controller[_0xedac('0xb')]);router[_0xedac('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xedac('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0xedac('0x7')]('/voice/queues',auth[_0xedac('0x9')](),controller[_0xedac('0xc')]);router['get'](_0xedac('0xd'),auth['isAuthenticated'](),controller[_0xedac('0xe')]);router[_0xedac('0x7')](_0xedac('0xf'),auth['isAuthenticated'](),controller[_0xedac('0x10')]);router[_0xedac('0x7')](_0xedac('0x11'),auth[_0xedac('0x9')](),controller[_0xedac('0x12')]);router[_0xedac('0x7')](_0xedac('0x13'),auth[_0xedac('0x9')](),controller[_0xedac('0x14')]);router['get'](_0xedac('0x15'),auth[_0xedac('0x9')](),controller[_0xedac('0x16')]);router['get'](_0xedac('0x17'),auth[_0xedac('0x9')](),controller['whatsappQueues']);router[_0xedac('0x7')](_0xedac('0x18'),auth[_0xedac('0x9')](),controller[_0xedac('0x19')]);router[_0xedac('0x7')](_0xedac('0x1a'),auth['isAuthenticated'](),controller[_0xedac('0x1b')]);router[_0xedac('0x7')](_0xedac('0x1c'),auth[_0xedac('0x9')](),controller[_0xedac('0x1d')]);router[_0xedac('0x7')]('/voice/queues/channels/:uniqueid',auth[_0xedac('0x9')](),controller[_0xedac('0x1e')]);router[_0xedac('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xedac('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xedac('0x9')](),controller[_0xedac('0x20')]);router[_0xedac('0x7')](_0xedac('0x21'),auth[_0xedac('0x9')](),controller[_0xedac('0x22')]);router[_0xedac('0x23')]('/voice/queues/:id',auth[_0xedac('0x9')](),controller[_0xedac('0x24')]);router[_0xedac('0x7')]('/outbound',auth[_0xedac('0x9')](),controller['outbound']);router[_0xedac('0x7')](_0xedac('0x25'),auth[_0xedac('0x9')](),controller[_0xedac('0x26')]);router[_0xedac('0x7')](_0xedac('0x27'),auth['isAuthenticated'](),controller[_0xedac('0x28')]);router[_0xedac('0x23')](_0xedac('0x29'),auth[_0xedac('0x9')](),controller[_0xedac('0x2a')]);router['get'](_0xedac('0x2b'),auth[_0xedac('0x9')](),controller[_0xedac('0x2c')]);router[_0xedac('0x7')](_0xedac('0x2d'),auth[_0xedac('0x9')](),controller[_0xedac('0x2e')]);router[_0xedac('0x7')]('/campaigns',auth[_0xedac('0x9')](),controller['campaigns']);router[_0xedac('0x7')](_0xedac('0x2f'),auth[_0xedac('0x9')](),controller['faxAccounts']);router[_0xedac('0x7')](_0xedac('0x30'),auth[_0xedac('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0xedac('0x7')](_0xedac('0x31'),auth[_0xedac('0x9')](),controller[_0xedac('0x32')]);router[_0xedac('0x7')](_0xedac('0x33'),auth[_0xedac('0x9')](),controller['openchannelQueuesWaitingInteractions']);router[_0xedac('0x7')](_0xedac('0x34'),auth[_0xedac('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0xedac('0x35'),auth[_0xedac('0x9')](),controller[_0xedac('0x36')]);router[_0xedac('0x7')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xedac('0x37')]);router[_0xedac('0x7')](_0xedac('0x38'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0xedac('0x39')](_0xedac('0x3a'),auth['isAuthenticated'](),controller[_0xedac('0x3b')](_0xedac('0x3c')));router['get'](_0xedac('0x3d'),auth[_0xedac('0x9')](),controller[_0xedac('0x3e')]);router['post'](_0xedac('0x3f'),auth[_0xedac('0x9')](),controller[_0xedac('0x3b')](_0xedac('0x40')));router[_0xedac('0x7')](_0xedac('0x41'),auth[_0xedac('0x9')](),controller['showChatQueues']);router[_0xedac('0x39')](_0xedac('0x42'),auth[_0xedac('0x9')](),controller['queueNotify']('fax'));router['get'](_0xedac('0x43'),auth['isAuthenticated'](),controller[_0xedac('0x44')]);router[_0xedac('0x39')]('/openchannel/queues/:id/notify',auth[_0xedac('0x9')](),controller['queueNotify'](_0xedac('0x45')));router[_0xedac('0x7')](_0xedac('0x46'),auth[_0xedac('0x9')](),controller[_0xedac('0x47')]);router['post'](_0xedac('0x48'),auth['isAuthenticated'](),controller[_0xedac('0x3b')](_0xedac('0x49')));router['post'](_0xedac('0x4a'),auth[_0xedac('0x9')](),controller[_0xedac('0x3b')](_0xedac('0x4b')));router[_0xedac('0x7')]('/sms/queues/:id',auth[_0xedac('0x9')](),controller[_0xedac('0x4c')]);router[_0xedac('0x7')](_0xedac('0x4d'),auth[_0xedac('0x9')](),controller[_0xedac('0x4e')]);router[_0xedac('0x39')]('/agents/:id/notify',auth[_0xedac('0x9')](),controller[_0xedac('0x4f')]);module['exports']=router; \ No newline at end of file +var _0xfff2=['Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/agents/:id/notify','exports','multer','util'];(function(_0x9187c1,_0x76c6a8){var _0x26cda5=function(_0x533beb){while(--_0x533beb){_0x9187c1['push'](_0x9187c1['shift']());}};_0x26cda5(++_0x76c6a8);}(_0xfff2,0x98));var _0x2fff=function(_0x5e31ef,_0xf54ce8){_0x5e31ef=_0x5e31ef-0x0;var _0xc39185=_0xfff2[_0x5e31ef];return _0xc39185;};'use strict';var multer=require(_0x2fff('0x0'));var util=require(_0x2fff('0x1'));var path=require('path');var express=require('express');var router=express[_0x2fff('0x2')]();var auth=require(_0x2fff('0x3'));var controller=require(_0x2fff('0x4'));router[_0x2fff('0x5')](_0x2fff('0x6'),auth['isAuthenticated'](),controller[_0x2fff('0x7')]);router[_0x2fff('0x5')](_0x2fff('0x8'),auth[_0x2fff('0x9')](),controller[_0x2fff('0xa')]);router[_0x2fff('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x2fff('0xb')]);router[_0x2fff('0x5')](_0x2fff('0xc'),auth[_0x2fff('0x9')](),controller[_0x2fff('0xd')]);router['get'](_0x2fff('0xe'),auth['isAuthenticated'](),controller[_0x2fff('0xf')]);router[_0x2fff('0x5')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x2fff('0x5')](_0x2fff('0x10'),auth['isAuthenticated'](),controller[_0x2fff('0x11')]);router['get']('/openchannel/queues',auth[_0x2fff('0x9')](),controller[_0x2fff('0x12')]);router[_0x2fff('0x5')](_0x2fff('0x13'),auth[_0x2fff('0x9')](),controller['smsQueues']);router[_0x2fff('0x5')](_0x2fff('0x14'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x15')]);router[_0x2fff('0x5')](_0x2fff('0x16'),auth[_0x2fff('0x9')](),controller['faxQueues']);router[_0x2fff('0x5')](_0x2fff('0x17'),auth['isAuthenticated'](),controller[_0x2fff('0x18')]);router[_0x2fff('0x5')](_0x2fff('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router['get'](_0x2fff('0x1a'),auth['isAuthenticated'](),controller[_0x2fff('0x1b')]);router['get'](_0x2fff('0x1c'),auth[_0x2fff('0x9')](),controller['voiceQueuesChannelHangup']);router['get'](_0x2fff('0x1d'),auth[_0x2fff('0x9')](),controller['voiceQueuesChannelRedirect']);router[_0x2fff('0x5')]('/voice/queues/:id',auth[_0x2fff('0x9')](),controller['showVoiceQueues']);router[_0x2fff('0x1e')](_0x2fff('0x1f'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x20')]);router[_0x2fff('0x5')](_0x2fff('0x21'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x22')]);router[_0x2fff('0x5')](_0x2fff('0x23'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x24')]);router[_0x2fff('0x5')](_0x2fff('0x25'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x26')]);router[_0x2fff('0x1e')](_0x2fff('0x27'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x28')]);router[_0x2fff('0x5')](_0x2fff('0x29'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x2a')]);router[_0x2fff('0x5')](_0x2fff('0x2b'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x2c')]);router[_0x2fff('0x5')](_0x2fff('0x2d'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x2e')]);router[_0x2fff('0x5')](_0x2fff('0x2f'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x30')]);router[_0x2fff('0x5')](_0x2fff('0x31'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x32')]);router[_0x2fff('0x5')](_0x2fff('0x33'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x34')]);router['get'](_0x2fff('0x35'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x2fff('0x5')](_0x2fff('0x36'),auth[_0x2fff('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x2fff('0x5')](_0x2fff('0x37'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x38')]);router[_0x2fff('0x5')](_0x2fff('0x39'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x3a')]);router[_0x2fff('0x5')]('/fax/queues/waitinginteractions',auth[_0x2fff('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x2fff('0x3b')](_0x2fff('0x3c'),auth['isAuthenticated'](),controller[_0x2fff('0x3d')](_0x2fff('0x3e')));router['get'](_0x2fff('0x3f'),auth[_0x2fff('0x9')](),controller['showMailQueues']);router[_0x2fff('0x3b')]('/chat/queues/:id/notify',auth[_0x2fff('0x9')](),controller[_0x2fff('0x3d')](_0x2fff('0x40')));router[_0x2fff('0x5')](_0x2fff('0x41'),auth[_0x2fff('0x9')](),controller['showChatQueues']);router[_0x2fff('0x3b')]('/fax/queues/:id/notify',auth[_0x2fff('0x9')](),controller['queueNotify'](_0x2fff('0x42')));router[_0x2fff('0x5')](_0x2fff('0x43'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x44')]);router[_0x2fff('0x3b')](_0x2fff('0x45'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x3d')](_0x2fff('0x46')));router[_0x2fff('0x5')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x2fff('0x3b')](_0x2fff('0x47'),auth['isAuthenticated'](),controller['queueNotify']('sms'));router[_0x2fff('0x3b')](_0x2fff('0x48'),auth[_0x2fff('0x9')](),controller['queueNotify'](_0x2fff('0x49')));router[_0x2fff('0x5')]('/sms/queues/:id',auth[_0x2fff('0x9')](),controller[_0x2fff('0x4a')]);router[_0x2fff('0x5')]('/whatsapp/queues/:id',auth[_0x2fff('0x9')](),controller['showWhatsappQueues']);router[_0x2fff('0x3b')](_0x2fff('0x4b'),auth[_0x2fff('0x9')](),controller['agentNotify']);module[_0x2fff('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 8e2d7ad..5d40ad2 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x434316,_0x1853f6){var _0xbdb9a9=function(_0x336d4b){while(--_0x336d4b){_0x434316['push'](_0x434316['shift']());}};_0xbdb9a9(++_0x1853f6);}(_0xe706,0xa3));var _0x6e70=function(_0x48d218,_0x38ae7b){_0x48d218=_0x48d218-0x0;var _0x5d86c7=_0xe706[_0x48d218];return _0x5d86c7;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x338c9,_0x44383e){var _0x29e8d0=function(_0x302125){while(--_0x302125){_0x338c9['push'](_0x338c9['shift']());}};_0x29e8d0(++_0x44383e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index bdcbd81..1ee6fc6 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 _0xb68d=['show','/:id/run','post','create','put','update','delete','/:id','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xb68d,0x198));var _0xdb68=function(_0x3cbe27,_0x228fdb){_0x3cbe27=_0x3cbe27-0x0;var _0x567bbd=_0xb68d[_0x3cbe27];return _0x567bbd;};'use strict';var multer=require(_0xdb68('0x0'));var util=require(_0xdb68('0x1'));var path=require(_0xdb68('0x2'));var timeout=require(_0xdb68('0x3'));var express=require(_0xdb68('0x4'));var router=express[_0xdb68('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb68('0x6'));var interaction=require(_0xdb68('0x7'));var config=require(_0xdb68('0x8'));var controller=require(_0xdb68('0x9'));router[_0xdb68('0xa')]('/',auth[_0xdb68('0xb')](),controller['index']);router[_0xdb68('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xdb68('0xc')]);router[_0xdb68('0xa')](_0xdb68('0xd'),auth[_0xdb68('0xb')](),controller['run']);router[_0xdb68('0xe')]('/',auth[_0xdb68('0xb')](),controller[_0xdb68('0xf')]);router[_0xdb68('0x10')]('/:id',auth[_0xdb68('0xb')](),controller[_0xdb68('0x11')]);router[_0xdb68('0x12')](_0xdb68('0x13'),auth[_0xdb68('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbf29=['run','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','get','/:id/run'];(function(_0x3358c9,_0xff1065){var _0x4859e6=function(_0x5a88bf){while(--_0x5a88bf){_0x3358c9['push'](_0x3358c9['shift']());}};_0x4859e6(++_0xff1065);}(_0xbf29,0x13f));var _0x9bf2=function(_0x298e3a,_0x52c9b1){_0x298e3a=_0x298e3a-0x0;var _0x9ddbae=_0xbf29[_0x298e3a];return _0x9ddbae;};'use strict';var multer=require(_0x9bf2('0x0'));var util=require(_0x9bf2('0x1'));var path=require(_0x9bf2('0x2'));var timeout=require(_0x9bf2('0x3'));var express=require(_0x9bf2('0x4'));var router=express[_0x9bf2('0x5')]();var fs_extra=require(_0x9bf2('0x6'));var auth=require(_0x9bf2('0x7'));var interaction=require(_0x9bf2('0x8'));var config=require(_0x9bf2('0x9'));var controller=require(_0x9bf2('0xa'));router['get']('/',auth[_0x9bf2('0xb')](),controller[_0x9bf2('0xc')]);router['get'](_0x9bf2('0xd'),auth['isAuthenticated'](),controller[_0x9bf2('0xe')]);router[_0x9bf2('0xf')](_0x9bf2('0x10'),auth['isAuthenticated'](),controller[_0x9bf2('0x11')]);router[_0x9bf2('0x12')]('/',auth[_0x9bf2('0xb')](),controller[_0x9bf2('0x13')]);router[_0x9bf2('0x14')](_0x9bf2('0xd'),auth['isAuthenticated'](),controller[_0x9bf2('0x15')]);router['delete'](_0x9bf2('0xd'),auth[_0x9bf2('0xb')](),controller[_0x9bf2('0x16')]);module[_0x9bf2('0x17')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 15c934c..efe1445 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 _0xfbf0=['days','hours','minutes','ENUM','csv','xlsx','custom','default','TEXT','BOOLEAN','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','months','weeks'];(function(_0x334676,_0x821ff4){var _0x58a7ab=function(_0x3b7087){while(--_0x3b7087){_0x334676['push'](_0x334676['shift']());}};_0x58a7ab(++_0x821ff4);}(_0xfbf0,0xe2));var _0x0fbf=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xfbf0[_0x381589];return _0x2a075d;};'use strict';var Sequelize=require('sequelize');module[_0x0fbf('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0fbf('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0fbf('0x1')],'allowNull':![],'defaultValue':_0x0fbf('0x2')},'startAt':{'type':Sequelize[_0x0fbf('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x0fbf('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0fbf('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x0fbf('0x5'),'quarters',_0x0fbf('0x6'),_0x0fbf('0x7'),_0x0fbf('0x8'),_0x0fbf('0x9'),_0x0fbf('0xa')),'allowNull':![],'defaultValue':_0x0fbf('0x8')},'output':{'type':Sequelize[_0x0fbf('0xb')](_0x0fbf('0xc'),'pdf',_0x0fbf('0xd')),'allowNull':![],'defaultValue':_0x0fbf('0xc')},'type':{'type':Sequelize['ENUM'](_0x0fbf('0xe'),_0x0fbf('0xf')),'allowNull':![],'defaultValue':_0x0fbf('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x0fbf('0x1')]},'cc':{'type':Sequelize[_0x0fbf('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x0fbf('0x11')],'defaultValue':!![]}}; \ No newline at end of file +var _0x494b=['csv','xlsx','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes'];(function(_0x49dd5a,_0x1da7e6){var _0x91c8da=function(_0x46408e){while(--_0x46408e){_0x49dd5a['push'](_0x49dd5a['shift']());}};_0x91c8da(++_0x1da7e6);}(_0x494b,0x147));var _0xb494=function(_0x4e63f1,_0x34a2db){_0x4e63f1=_0x4e63f1-0x0;var _0xdbd910=_0x494b[_0x4e63f1];return _0xdbd910;};'use strict';var Sequelize=require(_0xb494('0x0'));module['exports']={'name':{'type':Sequelize[_0xb494('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb494('0x1')]},'active':{'type':Sequelize[_0xb494('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb494('0x1')],'allowNull':![],'defaultValue':_0xb494('0x3')},'startAt':{'type':Sequelize[_0xb494('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb494('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb494('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb494('0x6')]('years',_0xb494('0x7'),_0xb494('0x8'),_0xb494('0x9'),_0xb494('0xa'),_0xb494('0xb'),_0xb494('0xc')),'allowNull':![],'defaultValue':_0xb494('0xa')},'output':{'type':Sequelize['ENUM'](_0xb494('0xd'),'pdf',_0xb494('0xe')),'allowNull':![],'defaultValue':_0xb494('0xd')},'type':{'type':Sequelize['ENUM']('custom',_0xb494('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xb494('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb494('0x10')]},'bcc':{'type':Sequelize[_0xb494('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 7d0a0a7..8ac41b3 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 _0xbad4=['../../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','get','Scheduler','stack','name','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x56f1bc,_0x2812f1){var _0x4a41dc=function(_0x46d080){while(--_0x46d080){_0x56f1bc['push'](_0x56f1bc['shift']());}};_0x4a41dc(++_0x2812f1);}(_0xbad4,0x95));var _0x4bad=function(_0x36b330,_0x28274e){_0x36b330=_0x36b330-0x0;var _0x7b8dfc=_0xbad4[_0x36b330];return _0x7b8dfc;};'use strict';var emlformat=require(_0x4bad('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4bad('0x1'));var rp=require(_0x4bad('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4bad('0x3'));var util=require(_0x4bad('0x4'));var path=require(_0x4bad('0x5'));var sox=require('sox');var csv=require(_0x4bad('0x6'));var ejs=require(_0x4bad('0x7'));var fs=require('fs');var fs_extra=require(_0x4bad('0x8'));var _=require('lodash');var squel=require(_0x4bad('0x9'));var crypto=require('crypto');var jsforce=require(_0x4bad('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4bad('0x6'));var querystring=require(_0x4bad('0xb'));var Papa=require(_0x4bad('0xc'));var Redis=require(_0x4bad('0xd'));var authService=require(_0x4bad('0xe'));var qs=require(_0x4bad('0xf'));var as=require(_0x4bad('0x10'));var hardwareService=require(_0x4bad('0x11'));var logger=require(_0x4bad('0x12'))(_0x4bad('0x13'));var utils=require(_0x4bad('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4bad('0x15'));var db=require(_0x4bad('0x16'))['db'];function respondWithStatusCode(_0x1ba571,_0x1f7289){_0x1f7289=_0x1f7289||0xcc;return function(_0x27c042){if(_0x27c042){return _0x1ba571[_0x4bad('0x17')](_0x1f7289);}return _0x1ba571[_0x4bad('0x18')](_0x1f7289)[_0x4bad('0x19')]();};}function respondWithResult(_0x5d9123,_0x316bd5){_0x316bd5=_0x316bd5||0xc8;return function(_0x2faed5){if(_0x2faed5){return _0x5d9123[_0x4bad('0x18')](_0x316bd5)[_0x4bad('0x1a')](_0x2faed5);}};}function respondWithFilteredResult(_0x3118cd,_0x397279){return function(_0x515532){if(_0x515532){var _0x4dab6c=typeof _0x397279[_0x4bad('0x1b')]==='undefined'&&typeof _0x397279[_0x4bad('0x1c')]===_0x4bad('0x1d');var _0x35b15f=_0x515532['count'];var _0x129eec=_0x4dab6c?0x0:_0x397279['offset'];var _0x110bb0=_0x4dab6c?_0x515532['count']:_0x397279['offset']+_0x397279['limit'];var _0x571323;if(_0x110bb0>=_0x35b15f){_0x110bb0=_0x35b15f;_0x571323=0xc8;}else{_0x571323=0xce;}_0x3118cd[_0x4bad('0x18')](_0x571323);return _0x3118cd['set'](_0x4bad('0x1e'),_0x129eec+'-'+_0x110bb0+'/'+_0x35b15f)['json'](_0x515532);}return null;};}function patchUpdates(_0x59f4aa){return function(_0x32f207){try{jsonpatch[_0x4bad('0x1f')](_0x32f207,_0x59f4aa,!![]);}catch(_0x5b11f1){return BPromise[_0x4bad('0x20')](_0x5b11f1);}return _0x32f207[_0x4bad('0x21')]();};}function saveUpdates(_0x60f5eb,_0x1b3432){return function(_0x5d82f8){if(_0x5d82f8){return _0x5d82f8[_0x4bad('0x22')](_0x60f5eb)[_0x4bad('0x23')](function(_0x49cad0){return _0x49cad0;});}return null;};}function removeEntity(_0x4431e0,_0x546bc9){return function(_0x3dda15){if(_0x3dda15){return _0x3dda15[_0x4bad('0x24')]()[_0x4bad('0x23')](function(){var _0x1b8c27=_0x3dda15[_0x4bad('0x25')]({'plain':!![]});var _0x4da201=_0x4bad('0x26');return db['UserProfileResource'][_0x4bad('0x24')]({'where':{'type':_0x4da201,'resourceId':_0x1b8c27['id']}})[_0x4bad('0x23')](function(){return _0x3dda15;});})[_0x4bad('0x23')](function(){_0x4431e0[_0x4bad('0x18')](0xcc)[_0x4bad('0x19')]();});}};}function handleEntityNotFound(_0x139974,_0x13fcab){return function(_0x46a6fe){if(!_0x46a6fe){_0x139974[_0x4bad('0x17')](0x194);}return _0x46a6fe;};}function handleError(_0x46443d,_0x5891f8){_0x5891f8=_0x5891f8||0x1f4;return function(_0x205aa3){logger['error'](_0x205aa3[_0x4bad('0x27')]);if(_0x205aa3[_0x4bad('0x28')]){delete _0x205aa3[_0x4bad('0x28')];}_0x46443d['status'](_0x5891f8)['send'](_0x205aa3);};}exports[_0x4bad('0x29')]=function(_0x6a96d3,_0xba901){var _0x3653a5={},_0x114ea9={},_0x23217a={'count':0x0,'rows':[]};var _0x69c9ee=_['map'](db[_0x4bad('0x2a')][_0x4bad('0x2b')],function(_0x1263c9){return{'name':_0x1263c9[_0x4bad('0x2c')],'type':_0x1263c9[_0x4bad('0x2d')][_0x4bad('0x2e')]};});_0x114ea9[_0x4bad('0x2f')]=_[_0x4bad('0x30')](_0x69c9ee,_0x4bad('0x28'));_0x114ea9[_0x4bad('0x31')]=_['keys'](_0x6a96d3['query']);_0x114ea9[_0x4bad('0x32')]=_[_0x4bad('0x33')](_0x114ea9[_0x4bad('0x2f')],_0x114ea9[_0x4bad('0x31')]);_0x3653a5[_0x4bad('0x34')]=_['intersection'](_0x114ea9[_0x4bad('0x2f')],qs[_0x4bad('0x35')](_0x6a96d3[_0x4bad('0x31')][_0x4bad('0x35')]));_0x3653a5[_0x4bad('0x34')]=_0x3653a5[_0x4bad('0x34')]['length']?_0x3653a5[_0x4bad('0x34')]:_0x114ea9[_0x4bad('0x2f')];if(!_0x6a96d3[_0x4bad('0x31')]['hasOwnProperty'](_0x4bad('0x36'))){_0x3653a5[_0x4bad('0x1c')]=qs[_0x4bad('0x1c')](_0x6a96d3['query']['limit']);_0x3653a5[_0x4bad('0x1b')]=qs['offset'](_0x6a96d3['query'][_0x4bad('0x1b')]);}_0x3653a5['order']=qs[_0x4bad('0x37')](_0x6a96d3['query'][_0x4bad('0x37')]);_0x3653a5[_0x4bad('0x38')]=qs[_0x4bad('0x32')](_[_0x4bad('0x39')](_0x6a96d3[_0x4bad('0x31')],_0x114ea9[_0x4bad('0x32')]),_0x69c9ee);if(_0x6a96d3[_0x4bad('0x31')][_0x4bad('0x3a')]){_0x3653a5[_0x4bad('0x38')]=_[_0x4bad('0x3b')](_0x3653a5['where'],{'$or':_['map'](_0x69c9ee,function(_0x30f2f9){if(_0x30f2f9['type']!==_0x4bad('0x3c')){var _0x1b1dcd={};_0x1b1dcd[_0x30f2f9[_0x4bad('0x28')]]={'$like':'%'+_0x6a96d3[_0x4bad('0x31')]['filter']+'%'};return _0x1b1dcd;}})});}_0x3653a5=_[_0x4bad('0x3b')]({},_0x3653a5,_0x6a96d3[_0x4bad('0x3d')]);var _0x172e42={'where':_0x3653a5[_0x4bad('0x38')]};return db[_0x4bad('0x2a')][_0x4bad('0x3e')](_0x172e42)['then'](function(_0x27a3df){_0x23217a[_0x4bad('0x3e')]=_0x27a3df;if(_0x6a96d3['query'][_0x4bad('0x3f')]){_0x3653a5[_0x4bad('0x40')]=[{'all':!![]}];}return db[_0x4bad('0x2a')][_0x4bad('0x41')](_0x3653a5);})[_0x4bad('0x23')](function(_0x344507){_0x23217a[_0x4bad('0x42')]=_0x344507;return _0x23217a;})[_0x4bad('0x23')](respondWithFilteredResult(_0xba901,_0x3653a5))[_0x4bad('0x43')](handleError(_0xba901,null));};exports[_0x4bad('0x44')]=function(_0x24d68c,_0x1057a8){var _0x317724={'raw':![],'where':{'id':_0x24d68c[_0x4bad('0x45')]['id']}},_0x38f37b={};_0x38f37b[_0x4bad('0x2f')]=_[_0x4bad('0x46')](db['Schedule'][_0x4bad('0x2b')]);_0x38f37b[_0x4bad('0x31')]=_[_0x4bad('0x46')](_0x24d68c['query']);_0x38f37b[_0x4bad('0x32')]=_[_0x4bad('0x33')](_0x38f37b[_0x4bad('0x2f')],_0x38f37b['query']);_0x317724['attributes']=_['intersection'](_0x38f37b[_0x4bad('0x2f')],qs['fields'](_0x24d68c[_0x4bad('0x31')][_0x4bad('0x35')]));_0x317724[_0x4bad('0x34')]=_0x317724[_0x4bad('0x34')][_0x4bad('0x47')]?_0x317724[_0x4bad('0x34')]:_0x38f37b[_0x4bad('0x2f')];if(_0x24d68c[_0x4bad('0x31')][_0x4bad('0x3f')]){_0x317724['include']=[{'all':!![]}];}_0x317724=_[_0x4bad('0x3b')]({},_0x317724,_0x24d68c[_0x4bad('0x3d')]);return db[_0x4bad('0x2a')][_0x4bad('0x48')](_0x317724)['then'](handleEntityNotFound(_0x1057a8,null))[_0x4bad('0x23')](respondWithResult(_0x1057a8,null))['catch'](handleError(_0x1057a8,null));};exports[_0x4bad('0x49')]=function(_0x5a7a8e,_0x20d35f){return db['Schedule'][_0x4bad('0x49')](_0x5a7a8e[_0x4bad('0x4a')],{})[_0x4bad('0x23')](function(_0xafa3d5){var _0x1286a3=_0x5a7a8e[_0x4bad('0x4b')][_0x4bad('0x25')]({'plain':!![]});if(!_0x1286a3)throw new Error(_0x4bad('0x4c'));if(_0x1286a3['role']===_0x4bad('0x4b')){var _0x39bad2=_0xafa3d5['get']({'plain':!![]});var _0x59e0a7=_0x4bad('0x26');return db['UserProfileSection'][_0x4bad('0x48')]({'where':{'name':_0x59e0a7,'userProfileId':_0x1286a3[_0x4bad('0x4d')]},'raw':!![]})[_0x4bad('0x23')](function(_0x558363){if(_0x558363&&_0x558363[_0x4bad('0x4e')]===0x0){return db[_0x4bad('0x4f')]['create']({'name':_0x39bad2[_0x4bad('0x28')],'resourceId':_0x39bad2['id'],'type':_0x558363['name'],'sectionId':_0x558363['id']},{})['then'](function(){return _0xafa3d5;});}else{return _0xafa3d5;}})[_0x4bad('0x43')](function(_0x13f00e){logger['error'](_0x4bad('0x50'),_0x13f00e);throw _0x13f00e;});}return _0xafa3d5;})['then'](respondWithResult(_0x20d35f,0xc9))['catch'](handleError(_0x20d35f,null));};exports[_0x4bad('0x22')]=function(_0x381cdd,_0x1240d7){if(_0x381cdd[_0x4bad('0x4a')]['id']){delete _0x381cdd[_0x4bad('0x4a')]['id'];}return db[_0x4bad('0x2a')]['find']({'where':{'id':_0x381cdd['params']['id']}})[_0x4bad('0x23')](handleEntityNotFound(_0x1240d7,null))[_0x4bad('0x23')](saveUpdates(_0x381cdd['body'],null))[_0x4bad('0x23')](respondWithResult(_0x1240d7,null))[_0x4bad('0x43')](handleError(_0x1240d7,null));};exports[_0x4bad('0x24')]=function(_0x46c9d1,_0x12eb82){return db[_0x4bad('0x2a')][_0x4bad('0x48')]({'where':{'id':_0x46c9d1[_0x4bad('0x45')]['id']}})[_0x4bad('0x23')](handleEntityNotFound(_0x12eb82,null))[_0x4bad('0x23')](removeEntity(_0x12eb82,null))[_0x4bad('0x43')](handleError(_0x12eb82,null));};exports[_0x4bad('0x51')]=function(_0x2bb870,_0xbcc1cc,_0x3d0803){var _0x30f1cb=require(_0x4bad('0x52'));return db['Schedule'][_0x4bad('0x48')]({'where':{'id':_0x2bb870['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0xbcc1cc,null))[_0x4bad('0x23')](function(){_0x30f1cb['run'](_0x2bb870[_0x4bad('0x45')]['id']);})[_0x4bad('0x23')](respondWithStatusCode(_0xbcc1cc,null))[_0x4bad('0x43')](handleError(_0xbcc1cc,null));}; \ No newline at end of file +var _0x44d2=['includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','get','Scheduler','UserProfileResource','destroy','end','error','stack','name','send','index','map','Schedule','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x44d2,0xc8));var _0x244d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x44d2[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x244d('0x0'));var zipdir=require(_0x244d('0x1'));var jsonpatch=require(_0x244d('0x2'));var rp=require(_0x244d('0x3'));var moment=require(_0x244d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x244d('0x5'));var util=require(_0x244d('0x6'));var path=require(_0x244d('0x7'));var sox=require(_0x244d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x244d('0x9'));var _=require(_0x244d('0xa'));var squel=require(_0x244d('0xb'));var crypto=require('crypto');var jsforce=require(_0x244d('0xc'));var deskjs=require(_0x244d('0xd'));var toCsv=require(_0x244d('0xe'));var querystring=require(_0x244d('0xf'));var Papa=require(_0x244d('0x10'));var Redis=require(_0x244d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x244d('0x12'));var as=require(_0x244d('0x13'));var hardwareService=require(_0x244d('0x14'));var logger=require(_0x244d('0x15'))('api');var utils=require(_0x244d('0x16'));var config=require(_0x244d('0x17'));var licenseUtil=require(_0x244d('0x18'));var db=require(_0x244d('0x19'))['db'];function respondWithStatusCode(_0x12ab5a,_0x54c64f){_0x54c64f=_0x54c64f||0xcc;return function(_0x516df2){if(_0x516df2){return _0x12ab5a[_0x244d('0x1a')](_0x54c64f);}return _0x12ab5a[_0x244d('0x1b')](_0x54c64f)['end']();};}function respondWithResult(_0x476c3f,_0x562789){_0x562789=_0x562789||0xc8;return function(_0x49bc02){if(_0x49bc02){return _0x476c3f[_0x244d('0x1b')](_0x562789)[_0x244d('0x1c')](_0x49bc02);}};}function respondWithFilteredResult(_0x321b7c,_0x4ac344){return function(_0x3cb3ec){if(_0x3cb3ec){var _0x2847ef=typeof _0x4ac344[_0x244d('0x1d')]===_0x244d('0x1e')&&typeof _0x4ac344[_0x244d('0x1f')]===_0x244d('0x1e');var _0x477850=_0x3cb3ec[_0x244d('0x20')];var _0x66555=_0x2847ef?0x0:_0x4ac344[_0x244d('0x1d')];var _0x20516f=_0x2847ef?_0x3cb3ec['count']:_0x4ac344[_0x244d('0x1d')]+_0x4ac344[_0x244d('0x1f')];var _0x4e6aef;if(_0x20516f>=_0x477850){_0x20516f=_0x477850;_0x4e6aef=0xc8;}else{_0x4e6aef=0xce;}_0x321b7c[_0x244d('0x1b')](_0x4e6aef);return _0x321b7c[_0x244d('0x21')]('Content-Range',_0x66555+'-'+_0x20516f+'/'+_0x477850)['json'](_0x3cb3ec);}return null;};}function patchUpdates(_0x3399b7){return function(_0x289ab7){try{jsonpatch[_0x244d('0x22')](_0x289ab7,_0x3399b7,!![]);}catch(_0xc89df0){return BPromise[_0x244d('0x23')](_0xc89df0);}return _0x289ab7[_0x244d('0x24')]();};}function saveUpdates(_0x14cde5,_0x4f13f3){return function(_0x1fb317){if(_0x1fb317){return _0x1fb317['update'](_0x14cde5)['then'](function(_0x15edb7){return _0x15edb7;});}return null;};}function removeEntity(_0x686767,_0x1d0d2f){return function(_0x3a3e1d){if(_0x3a3e1d){return _0x3a3e1d['destroy']()[_0x244d('0x25')](function(){var _0x54e9d8=_0x3a3e1d[_0x244d('0x26')]({'plain':!![]});var _0x59769a=_0x244d('0x27');return db[_0x244d('0x28')][_0x244d('0x29')]({'where':{'type':_0x59769a,'resourceId':_0x54e9d8['id']}})['then'](function(){return _0x3a3e1d;});})['then'](function(){_0x686767[_0x244d('0x1b')](0xcc)[_0x244d('0x2a')]();});}};}function handleEntityNotFound(_0x2f95d4,_0x2c4cef){return function(_0x10d461){if(!_0x10d461){_0x2f95d4['sendStatus'](0x194);}return _0x10d461;};}function handleError(_0xe13b2c,_0x31f279){_0x31f279=_0x31f279||0x1f4;return function(_0x3abf9f){logger[_0x244d('0x2b')](_0x3abf9f[_0x244d('0x2c')]);if(_0x3abf9f[_0x244d('0x2d')]){delete _0x3abf9f[_0x244d('0x2d')];}_0xe13b2c[_0x244d('0x1b')](_0x31f279)[_0x244d('0x2e')](_0x3abf9f);};}exports[_0x244d('0x2f')]=function(_0xa79e45,_0x564772){var _0x4af49e={},_0x51c3b8={},_0x52f319={'count':0x0,'rows':[]};var _0x44c8c7=_[_0x244d('0x30')](db[_0x244d('0x31')]['rawAttributes'],function(_0x3c14da){return{'name':_0x3c14da[_0x244d('0x32')],'type':_0x3c14da[_0x244d('0x33')][_0x244d('0x34')]};});_0x51c3b8['model']=_[_0x244d('0x30')](_0x44c8c7,_0x244d('0x2d'));_0x51c3b8[_0x244d('0x35')]=_['keys'](_0xa79e45[_0x244d('0x35')]);_0x51c3b8[_0x244d('0x36')]=_[_0x244d('0x37')](_0x51c3b8[_0x244d('0x38')],_0x51c3b8[_0x244d('0x35')]);_0x4af49e[_0x244d('0x39')]=_[_0x244d('0x37')](_0x51c3b8[_0x244d('0x38')],qs['fields'](_0xa79e45[_0x244d('0x35')][_0x244d('0x3a')]));_0x4af49e[_0x244d('0x39')]=_0x4af49e[_0x244d('0x39')]['length']?_0x4af49e['attributes']:_0x51c3b8[_0x244d('0x38')];if(!_0xa79e45[_0x244d('0x35')][_0x244d('0x3b')](_0x244d('0x3c'))){_0x4af49e[_0x244d('0x1f')]=qs[_0x244d('0x1f')](_0xa79e45[_0x244d('0x35')][_0x244d('0x1f')]);_0x4af49e[_0x244d('0x1d')]=qs[_0x244d('0x1d')](_0xa79e45[_0x244d('0x35')][_0x244d('0x1d')]);}_0x4af49e[_0x244d('0x3d')]=qs[_0x244d('0x3e')](_0xa79e45[_0x244d('0x35')][_0x244d('0x3e')]);_0x4af49e[_0x244d('0x3f')]=qs[_0x244d('0x36')](_[_0x244d('0x40')](_0xa79e45[_0x244d('0x35')],_0x51c3b8['filters']),_0x44c8c7);if(_0xa79e45[_0x244d('0x35')][_0x244d('0x41')]){_0x4af49e['where']=_['merge'](_0x4af49e[_0x244d('0x3f')],{'$or':_[_0x244d('0x30')](_0x44c8c7,function(_0x4ecbef){if(_0x4ecbef[_0x244d('0x33')]!=='VIRTUAL'){var _0x3cf3df={};_0x3cf3df[_0x4ecbef[_0x244d('0x2d')]]={'$like':'%'+_0xa79e45[_0x244d('0x35')]['filter']+'%'};return _0x3cf3df;}})});}_0x4af49e=_[_0x244d('0x42')]({},_0x4af49e,_0xa79e45['options']);var _0x4077ee={'where':_0x4af49e[_0x244d('0x3f')]};return db[_0x244d('0x31')][_0x244d('0x20')](_0x4077ee)[_0x244d('0x25')](function(_0x3efb10){_0x52f319['count']=_0x3efb10;if(_0xa79e45[_0x244d('0x35')][_0x244d('0x43')]){_0x4af49e[_0x244d('0x44')]=[{'all':!![]}];}return db['Schedule'][_0x244d('0x45')](_0x4af49e);})['then'](function(_0x4b18ac){_0x52f319[_0x244d('0x46')]=_0x4b18ac;return _0x52f319;})[_0x244d('0x25')](respondWithFilteredResult(_0x564772,_0x4af49e))[_0x244d('0x47')](handleError(_0x564772,null));};exports[_0x244d('0x48')]=function(_0x2b1dc1,_0x558e5e){var _0x2aa690={'raw':![],'where':{'id':_0x2b1dc1['params']['id']}},_0x233867={};_0x233867[_0x244d('0x38')]=_[_0x244d('0x49')](db[_0x244d('0x31')][_0x244d('0x4a')]);_0x233867['query']=_[_0x244d('0x49')](_0x2b1dc1[_0x244d('0x35')]);_0x233867[_0x244d('0x36')]=_['intersection'](_0x233867[_0x244d('0x38')],_0x233867[_0x244d('0x35')]);_0x2aa690[_0x244d('0x39')]=_[_0x244d('0x37')](_0x233867[_0x244d('0x38')],qs['fields'](_0x2b1dc1[_0x244d('0x35')][_0x244d('0x3a')]));_0x2aa690['attributes']=_0x2aa690[_0x244d('0x39')][_0x244d('0x4b')]?_0x2aa690['attributes']:_0x233867[_0x244d('0x38')];if(_0x2b1dc1[_0x244d('0x35')]['includeAll']){_0x2aa690[_0x244d('0x44')]=[{'all':!![]}];}_0x2aa690=_['merge']({},_0x2aa690,_0x2b1dc1['options']);return db[_0x244d('0x31')][_0x244d('0x4c')](_0x2aa690)[_0x244d('0x25')](handleEntityNotFound(_0x558e5e,null))[_0x244d('0x25')](respondWithResult(_0x558e5e,null))[_0x244d('0x47')](handleError(_0x558e5e,null));};exports['create']=function(_0x571e11,_0x58b494){return db[_0x244d('0x31')]['create'](_0x571e11['body'],{})[_0x244d('0x25')](function(_0x3d634c){var _0x48ce2c=_0x571e11[_0x244d('0x4d')][_0x244d('0x26')]({'plain':!![]});if(!_0x48ce2c)throw new Error(_0x244d('0x4e'));if(_0x48ce2c[_0x244d('0x4f')]===_0x244d('0x4d')){var _0x556d48=_0x3d634c['get']({'plain':!![]});var _0x2503f5=_0x244d('0x27');return db['UserProfileSection'][_0x244d('0x4c')]({'where':{'name':_0x2503f5,'userProfileId':_0x48ce2c[_0x244d('0x50')]},'raw':!![]})[_0x244d('0x25')](function(_0x1b4141){if(_0x1b4141&&_0x1b4141[_0x244d('0x51')]===0x0){return db['UserProfileResource'][_0x244d('0x52')]({'name':_0x556d48['name'],'resourceId':_0x556d48['id'],'type':_0x1b4141['name'],'sectionId':_0x1b4141['id']},{})[_0x244d('0x25')](function(){return _0x3d634c;});}else{return _0x3d634c;}})['catch'](function(_0x309658){logger[_0x244d('0x2b')](_0x244d('0x53'),_0x309658);throw _0x309658;});}return _0x3d634c;})[_0x244d('0x25')](respondWithResult(_0x58b494,0xc9))[_0x244d('0x47')](handleError(_0x58b494,null));};exports[_0x244d('0x54')]=function(_0x3a2065,_0x1fe5c0){if(_0x3a2065[_0x244d('0x55')]['id']){delete _0x3a2065['body']['id'];}return db['Schedule'][_0x244d('0x4c')]({'where':{'id':_0x3a2065[_0x244d('0x56')]['id']}})[_0x244d('0x25')](handleEntityNotFound(_0x1fe5c0,null))['then'](saveUpdates(_0x3a2065[_0x244d('0x55')],null))[_0x244d('0x25')](respondWithResult(_0x1fe5c0,null))[_0x244d('0x47')](handleError(_0x1fe5c0,null));};exports[_0x244d('0x29')]=function(_0xcac3a9,_0x35935c){return db['Schedule'][_0x244d('0x4c')]({'where':{'id':_0xcac3a9[_0x244d('0x56')]['id']}})[_0x244d('0x25')](handleEntityNotFound(_0x35935c,null))['then'](removeEntity(_0x35935c,null))[_0x244d('0x47')](handleError(_0x35935c,null));};exports[_0x244d('0x57')]=function(_0x59d29e,_0x6781a3,_0x48a7c2){var _0x32ae9f=require(_0x244d('0x58'));return db[_0x244d('0x31')]['find']({'where':{'id':_0x59d29e[_0x244d('0x56')]['id']},'raw':!![]})[_0x244d('0x25')](handleEntityNotFound(_0x6781a3,null))[_0x244d('0x25')](function(){_0x32ae9f[_0x244d('0x57')](_0x59d29e[_0x244d('0x56')]['id']);})[_0x244d('0x25')](respondWithStatusCode(_0x6781a3,null))[_0x244d('0x47')](handleError(_0x6781a3,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 0a433be..5aa4296 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 _0xd741=['rimraf','../../config/environment','./schedule.attributes','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1fb559,_0x10760c){var _0x16f0de=function(_0x6b7d3b){while(--_0x6b7d3b){_0x1fb559['push'](_0x1fb559['shift']());}};_0x16f0de(++_0x10760c);}(_0xd741,0xc3));var _0x1d74=function(_0x525add,_0x2b8e24){_0x525add=_0x525add-0x0;var _0x47f592=_0xd741[_0x525add];return _0x47f592;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1d74('0x0'))(_0x1d74('0x1'));var moment=require('moment');var BPromise=require(_0x1d74('0x2'));var rp=require(_0x1d74('0x3'));var fs=require('fs');var path=require(_0x1d74('0x4'));var rimraf=require(_0x1d74('0x5'));var config=require(_0x1d74('0x6'));var attributes=require(_0x1d74('0x7'));module['exports']=function(_0xa6a5e4,_0x23db10){return _0xa6a5e4['define']('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b04=['api','moment','request-promise','path','./schedule.attributes','tools_schedules','lodash','../../config/logger'];(function(_0x2b16b8,_0x336263){var _0x47763d=function(_0x4e9c6c){while(--_0x4e9c6c){_0x2b16b8['push'](_0x2b16b8['shift']());}};_0x47763d(++_0x336263);}(_0x6b04,0x1b6));var _0x46b0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6b04[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x46b0('0x0'));var util=require('util');var logger=require(_0x46b0('0x1'))(_0x46b0('0x2'));var moment=require(_0x46b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x46b0('0x4'));var fs=require('fs');var path=require(_0x46b0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x46b0('0x6'));module['exports']=function(_0x5008ba,_0x365bab){return _0x5008ba['define']('Schedule',attributes,{'tableName':_0x46b0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b93725b..48551e9 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 _0xb64f=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Schedule,\x20%s,\x20%s','message'];(function(_0x561899,_0x11947b){var _0x12e019=function(_0x16dbf2){while(--_0x16dbf2){_0x561899['push'](_0x561899['shift']());}};_0x12e019(++_0x11947b);}(_0xb64f,0x126));var _0xfb64=function(_0x4f3da4,_0x121375){_0x4f3da4=_0x4f3da4-0x0;var _0x1df1a1=_0xb64f[_0x4f3da4];return _0x1df1a1;};'use strict';var _=require(_0xfb64('0x0'));var util=require(_0xfb64('0x1'));var moment=require(_0xfb64('0x2'));var BPromise=require(_0xfb64('0x3'));var rs=require(_0xfb64('0x4'));var fs=require('fs');var Redis=require(_0xfb64('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb64('0x6'));var logger=require('../../config/logger')(_0xfb64('0x7'));var config=require(_0xfb64('0x8'));var jayson=require(_0xfb64('0x9'));var client=jayson[_0xfb64('0xa')][_0xfb64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35af66,_0x4aa641,_0x5cb56e){return new BPromise(function(_0x4971a5,_0x219045){return client[_0xfb64('0xc')](_0x35af66,_0x5cb56e)['then'](function(_0x25d9c7){logger[_0xfb64('0xd')]('Schedule,\x20%s,\x20%s',_0x4aa641,_0xfb64('0xe'));logger[_0xfb64('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x4aa641,_0xfb64('0xe'),JSON[_0xfb64('0x10')](_0x25d9c7));if(_0x25d9c7[_0xfb64('0x11')]){if(_0x25d9c7[_0xfb64('0x11')][_0xfb64('0x12')]===0x1f4){logger[_0xfb64('0x11')](_0xfb64('0x13'),_0x4aa641,_0x25d9c7[_0xfb64('0x11')][_0xfb64('0x14')]);return _0x219045(_0x25d9c7[_0xfb64('0x11')]['message']);}logger['error'](_0xfb64('0x13'),_0x4aa641,_0x25d9c7[_0xfb64('0x11')][_0xfb64('0x14')]);return _0x4971a5(_0x25d9c7[_0xfb64('0x11')][_0xfb64('0x14')]);}else{logger[_0xfb64('0xd')]('Schedule,\x20%s,\x20%s',_0x4aa641,_0xfb64('0xe'));_0x4971a5(_0x25d9c7['result']['message']);}})['catch'](function(_0x390329){logger[_0xfb64('0x11')](_0xfb64('0x13'),_0x4aa641,_0x390329);_0x219045(_0x390329);});});} \ No newline at end of file +var _0x68a6=['lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x68a6,0x1db));var _0x668a=function(_0x1597b8,_0x3a1392){_0x1597b8=_0x1597b8-0x0;var _0x43464c=_0x68a6[_0x1597b8];return _0x43464c;};'use strict';var _=require(_0x668a('0x0'));var util=require(_0x668a('0x1'));var moment=require(_0x668a('0x2'));var BPromise=require(_0x668a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x668a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x668a('0x5'));var logger=require('../../config/logger')(_0x668a('0x6'));var config=require(_0x668a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x668a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x447583,_0x4fd32e,_0x553c3f){return new BPromise(function(_0x387b51,_0x1061d1){return client[_0x668a('0x9')](_0x447583,_0x553c3f)[_0x668a('0xa')](function(_0x433aa5){logger[_0x668a('0xb')](_0x668a('0xc'),_0x4fd32e,'request\x20sent');logger[_0x668a('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x4fd32e,_0x668a('0xe'),JSON[_0x668a('0xf')](_0x433aa5));if(_0x433aa5[_0x668a('0x10')]){if(_0x433aa5['error'][_0x668a('0x11')]===0x1f4){logger[_0x668a('0x10')](_0x668a('0xc'),_0x4fd32e,_0x433aa5[_0x668a('0x10')][_0x668a('0x12')]);return _0x1061d1(_0x433aa5[_0x668a('0x10')][_0x668a('0x12')]);}logger['error'](_0x668a('0xc'),_0x4fd32e,_0x433aa5[_0x668a('0x10')][_0x668a('0x12')]);return _0x387b51(_0x433aa5[_0x668a('0x10')][_0x668a('0x12')]);}else{logger[_0x668a('0xb')](_0x668a('0xc'),_0x4fd32e,_0x668a('0xe'));_0x387b51(_0x433aa5['result']['message']);}})['catch'](function(_0x4b5cdd){logger[_0x668a('0x10')](_0x668a('0xc'),_0x4fd32e,_0x4b5cdd);_0x1061d1(_0x4b5cdd);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 2d27c99..218c136 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 _0x5bd1=['isAuthenticated','show','/:id/download','download','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','describe','/:id'];(function(_0x1bcfcc,_0x3b7eb3){var _0x4dd23a=function(_0x368142){while(--_0x368142){_0x1bcfcc['push'](_0x1bcfcc['shift']());}};_0x4dd23a(++_0x3b7eb3);}(_0x5bd1,0x7d));var _0x15bd=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x5bd1[_0x508685];return _0x976a76;};'use strict';var multer=require(_0x15bd('0x0'));var util=require('util');var path=require(_0x15bd('0x1'));var timeout=require('connect-timeout');var express=require(_0x15bd('0x2'));var router=express[_0x15bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x15bd('0x4'));var interaction=require(_0x15bd('0x5'));var config=require(_0x15bd('0x6'));var controller=require(_0x15bd('0x7'));router[_0x15bd('0x8')]('/',auth['isAuthenticated'](),controller[_0x15bd('0x9')]);router[_0x15bd('0x8')](_0x15bd('0xa'),auth['isAuthenticated'](),controller[_0x15bd('0xb')]);router[_0x15bd('0x8')](_0x15bd('0xc'),auth[_0x15bd('0xd')](),controller[_0x15bd('0xe')]);router[_0x15bd('0x8')](_0x15bd('0xf'),auth[_0x15bd('0xd')](),controller[_0x15bd('0x10')]);router[_0x15bd('0x11')]('/',auth[_0x15bd('0xd')](),controller['create']);router[_0x15bd('0x12')]('/:id',auth[_0x15bd('0xd')](),controller[_0x15bd('0x13')]);router[_0x15bd('0x14')](_0x15bd('0xc'),auth[_0x15bd('0xd')](),controller[_0x15bd('0x15')]);module[_0x15bd('0x16')]=router; \ No newline at end of file +var _0x756c=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','put','delete','destroy','exports','multer','util'];(function(_0x3f90fb,_0x3ac912){var _0x239540=function(_0x1c7476){while(--_0x1c7476){_0x3f90fb['push'](_0x3f90fb['shift']());}};_0x239540(++_0x3ac912);}(_0x756c,0x163));var _0xc756=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x756c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc756('0x0'));var util=require(_0xc756('0x1'));var path=require(_0xc756('0x2'));var timeout=require('connect-timeout');var express=require(_0xc756('0x3'));var router=express[_0xc756('0x4')]();var fs_extra=require(_0xc756('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc756('0x6'));var config=require(_0xc756('0x7'));var controller=require(_0xc756('0x8'));router[_0xc756('0x9')]('/',auth[_0xc756('0xa')](),controller['index']);router[_0xc756('0x9')](_0xc756('0xb'),auth[_0xc756('0xa')](),controller[_0xc756('0xc')]);router[_0xc756('0x9')](_0xc756('0xd'),auth[_0xc756('0xa')](),controller['show']);router[_0xc756('0x9')](_0xc756('0xe'),auth['isAuthenticated'](),controller[_0xc756('0xf')]);router[_0xc756('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc756('0x11')]('/:id',auth[_0xc756('0xa')](),controller['update']);router[_0xc756('0x12')](_0xc756('0xd'),auth['isAuthenticated'](),controller[_0xc756('0x13')]);module[_0xc756('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 9fbef16..721499c 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 _0x2fc9=['format','MM-DD-YYYY\x20HH:mm','closedAt','createdAt','toString','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE'];(function(_0x563568,_0x1d3e90){var _0x543aec=function(_0x890855){while(--_0x890855){_0x563568['push'](_0x563568['shift']());}};_0x543aec(++_0x1d3e90);}(_0x2fc9,0xc2));var _0x92fc=function(_0x54e6f5,_0x4f4e99){_0x54e6f5=_0x54e6f5-0x0;var _0x5e8794=_0x2fc9[_0x54e6f5];return _0x5e8794;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x92fc('0x0'));var path=require(_0x92fc('0x1'));var config=require(_0x92fc('0x2'));module[_0x92fc('0x3')]={'format':{'type':Sequelize[_0x92fc('0x4')],'get':function(){return this[_0x92fc('0x5')](_0x92fc('0x6'))?path[_0x92fc('0x7')](this[_0x92fc('0x5')](_0x92fc('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x92fc('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x5c79a5){var _0x340518=_0x5c79a5[_0x92fc('0x9')](/\\/g,'/');this[_0x92fc('0xa')](_0x92fc('0x6'),_0x340518);}},'rating':{'type':Sequelize[_0x92fc('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x92fc('0xb')],'set':function(_0x2805f4){this['setDataValue'](_0x92fc('0xc'),moment()[_0x92fc('0xd')](_0x2805f4,'ms'));this[_0x92fc('0xa')]('closedAt',moment());this[_0x92fc('0xa')](_0x92fc('0xe'),_0x2805f4);}},'startedAt':{'type':Sequelize[_0x92fc('0xf')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x92fc('0x10')](_0x92fc('0x11'))['toString']();}},'closedAt':{'type':Sequelize[_0x92fc('0xf')],'get':function(){return moment(this[_0x92fc('0x5')](_0x92fc('0x12')))[_0x92fc('0x10')](_0x92fc('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x92fc('0xf')],'get':function(){return moment(this[_0x92fc('0x5')](_0x92fc('0x13')))[_0x92fc('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x92fc('0xf')],'get':function(){return moment(this[_0x92fc('0x5')]('updatedAt'))[_0x92fc('0x10')](_0x92fc('0x11'))[_0x92fc('0x14')]();}}}; \ No newline at end of file +var _0x4253=['INTEGER','closedAt','duration','startedAt','format','toString','DATE','MM-DD-YYYY\x20HH:mm','sequelize','moment','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue'];(function(_0x3d83cb,_0x3e1202){var _0x5418cc=function(_0x1f128c){while(--_0x1f128c){_0x3d83cb['push'](_0x3d83cb['shift']());}};_0x5418cc(++_0x3e1202);}(_0x4253,0x14c));var _0x3425=function(_0x57d24d,_0x36220d){_0x57d24d=_0x57d24d-0x0;var _0x51ea82=_0x4253[_0x57d24d];return _0x51ea82;};'use strict';var Sequelize=require(_0x3425('0x0'));var moment=require(_0x3425('0x1'));var path=require('path');var config=require(_0x3425('0x2'));module['exports']={'format':{'type':Sequelize[_0x3425('0x3')],'get':function(){return this[_0x3425('0x4')](_0x3425('0x5'))?path[_0x3425('0x6')](this[_0x3425('0x4')](_0x3425('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x3425('0x7')]},'channel':{'type':Sequelize[_0x3425('0x7')]},'value':{'type':Sequelize[_0x3425('0x7')],'set':function(_0x53cc1f){var _0x1bb3ca=_0x53cc1f[_0x3425('0x8')](/\\/g,'/');this[_0x3425('0x9')]('value',_0x1bb3ca);}},'rating':{'type':Sequelize[_0x3425('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x3425('0xa')],'set':function(_0x5a2bc6){this[_0x3425('0x9')]('startedAt',moment()['subtract'](_0x5a2bc6,'ms'));this['setDataValue'](_0x3425('0xb'),moment());this[_0x3425('0x9')](_0x3425('0xc'),_0x5a2bc6);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3425('0x4')](_0x3425('0xd')))[_0x3425('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x3425('0xf')]();}},'closedAt':{'type':Sequelize[_0x3425('0x10')],'get':function(){return moment(this[_0x3425('0x4')](_0x3425('0xb')))[_0x3425('0xe')](_0x3425('0x11'))[_0x3425('0xf')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3425('0x4')]('createdAt'))[_0x3425('0xe')](_0x3425('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x3425('0x10')],'get':function(){return moment(this[_0x3425('0x4')]('updatedAt'))[_0x3425('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x3425('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index b895ad2..1376144 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 _0x6f47=['zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ScreenRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','duration','createdAt','closedAt','value','find','describe','uniqueid','join','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','root','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','rimraf'];(function(_0x3210a6,_0x5c6345){var _0x2121b0=function(_0x5f285d){while(--_0x5f285d){_0x3210a6['push'](_0x3210a6['shift']());}};_0x2121b0(++_0x5c6345);}(_0x6f47,0xc7));var _0x76f4=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x6f47[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['differenceBy'](_['map'](_0x1dea0e,_0x76f4('0x27')),[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0x5346be[_0x76f4('0x2f')]);_0x30f02e[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2f')]);_0x10ddb4[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],qs['fields'](_0x5346be['query']['fields']));_0x10ddb4['attributes']=_0x10ddb4[_0x76f4('0x33')][_0x76f4('0x34')]?_0x10ddb4[_0x76f4('0x33')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2f')]['hasOwnProperty'](_0x76f4('0x35'))){_0x10ddb4[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x31')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2f')],_0x30f02e[_0x76f4('0x31')]),_0x1dea0e);if(_0x5346be['query'][_0x76f4('0x3a')]){_0x10ddb4[_0x76f4('0x38')]=_[_0x76f4('0x3b')](_0x10ddb4['where'],{'$or':_['map'](_0x1dea0e,function(_0x237fba){if(_0x237fba['type']!==_0x76f4('0x3c')){var _0x5ac18f={};_0x5ac18f[_0x237fba[_0x76f4('0x27')]]={'$like':'%'+_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3a')]+'%'};return _0x5ac18f;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3d')]);var _0x2d99e3={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x2d99e3)[_0x76f4('0x23')](function(_0x5340a9){_0x41dea4['count']=_0x5340a9;if(_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3e')]){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x42754d){_0x41dea4[_0x76f4('0x41')]=_0x42754d;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))['catch'](handleError(_0x5b3f07,null));};exports[_0x76f4('0x42')]=function(_0xe744af,_0x4f0d1a){var _0x5ad90a={'raw':![],'where':{'id':_0xe744af[_0x76f4('0x43')]['id']}},_0x26c411={};_0x26c411[_0x76f4('0x2d')]=_[_0x76f4('0x30')](db[_0x76f4('0x29')]['rawAttributes']);_0x26c411[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0xe744af[_0x76f4('0x2f')]);_0x26c411[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],_0x26c411['query']);_0x5ad90a[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],qs['fields'](_0xe744af['query'][_0x76f4('0x44')]));_0x5ad90a[_0x76f4('0x33')]=_0x5ad90a[_0x76f4('0x33')][_0x76f4('0x34')]?_0x5ad90a[_0x76f4('0x33')]:_0x26c411['model'];if(_0xe744af['query'][_0x76f4('0x3e')]){_0x5ad90a['include']=[{'all':!![]}];}_0x5ad90a=_[_0x76f4('0x3b')]({},_0x5ad90a,_0xe744af[_0x76f4('0x3d')]);return db['ScreenRecording']['find'](_0x5ad90a)[_0x76f4('0x23')](handleEntityNotFound(_0x4f0d1a,null))[_0x76f4('0x23')](respondWithResult(_0x4f0d1a,null))[_0x76f4('0x45')](handleError(_0x4f0d1a,null));};exports[_0x76f4('0x46')]=function(_0x55e4cc,_0x9baa0f){return db[_0x76f4('0x29')][_0x76f4('0x46')](_0x55e4cc['body'],{})[_0x76f4('0x23')](respondWithResult(_0x9baa0f,0xc9))[_0x76f4('0x45')](handleError(_0x9baa0f,null));};exports['update']=function(_0x56d905,_0x4ab620){if(_0x56d905[_0x76f4('0x47')]['id']){delete _0x56d905[_0x76f4('0x47')]['id'];}delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x48')];delete _0x56d905['body'][_0x76f4('0x49')];delete _0x56d905['body'][_0x76f4('0x4a')];delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x4b')];return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x56d905[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ab620,null))[_0x76f4('0x23')](saveUpdates(_0x56d905[_0x76f4('0x47')],null))[_0x76f4('0x23')](respondWithResult(_0x4ab620,null))[_0x76f4('0x45')](handleError(_0x4ab620,null));};exports[_0x76f4('0x4d')]=function(_0x479c4b,_0x1041da){return db['ScreenRecording'][_0x76f4('0x4d')]()[_0x76f4('0x23')](respondWithResult(_0x1041da,null))[_0x76f4('0x45')](handleError(_0x1041da,null));};exports['download']=function(_0x141b1c,_0x46c944,_0x3fc794){var _0x3bec16=require('../../components/encryptor');var _0x2028e9=![];var _0xf11e07={};if(_0x141b1c[_0x76f4('0x2f')][_0x76f4('0x2b')]&&_0x141b1c['query'][_0x76f4('0x2b')]==='uniqueid'){_0xf11e07[_0x76f4('0x4e')]=_0x141b1c[_0x76f4('0x43')]['id'];}else{_0xf11e07['id']=_0x141b1c['params']['id'];}return db['ScreenRecording'][_0x76f4('0x4c')]({'where':_0xf11e07,'attributes':['id',_0x76f4('0x4b')],'raw':!![]})[_0x76f4('0x23')](handleEntityNotFound(_0x46c944,null))['then'](function(_0x27ba06){if(_0x27ba06){var _0x15ec0f=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x27ba06[_0x76f4('0x4b')]);var _0x367238=util['format']('%s.cypher',_0x15ec0f);if(fs[_0x76f4('0x50')](_0x367238)){_0x2028e9=!![];return _0x3bec16[_0x76f4('0x51')](_0x367238,_0x15ec0f,config[_0x76f4('0x52')][_0x76f4('0x53')])[_0x76f4('0x23')](function(){return _0x27ba06;});}return _0x27ba06;}})[_0x76f4('0x23')](function(_0x97be11){if(_0x97be11){var _0x36a52a=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x97be11['value']);if(!fs[_0x76f4('0x50')](_0x36a52a)){throw new db[(_0x76f4('0x54'))][(_0x76f4('0x55'))](_0x76f4('0x56'));}if(_0x97be11['filename']){return _0x46c944['download'](_0x36a52a,_0x97be11[_0x76f4('0x57')]+path['extname'](_0x36a52a),function(){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}else{return _0x46c944['download'](_0x36a52a,function(_0x4285dd){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}}})[_0x76f4('0x45')](function(_0x3317a4){if(_0x3317a4['message']===_0x76f4('0x56')){_0x46c944[_0x76f4('0x1d')](0x194)[_0x76f4('0x28')](_0x76f4('0x59'));}else{return handleError(_0x46c944,null);}});};exports[_0x76f4('0x24')]=function(_0x2a6f19,_0x46245f){return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x2a6f19[_0x76f4('0x43')]['id']}})[_0x76f4('0x23')](function(_0x320a87){if(_[_0x76f4('0x5a')](_0x320a87)){throw new ReferenceError(_0x76f4('0x5b'));}return _0x320a87;})[_0x76f4('0x23')](function(_0x551d38){var _0x5724c3=path['join'](config[_0x76f4('0x5c')],_0x76f4('0x5d'),_0x551d38[_0x76f4('0x4b')]);logger['info'](_0x76f4('0x5e'),_0x5724c3);if(!_['isNil'](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger['info'](_0x76f4('0x5f')+_0x5724c3+_0x76f4('0x60'));fs[_0x76f4('0x61')](_0x5724c3);}_0x5724c3=_0x5724c3+_0x76f4('0x62');if(!_[_0x76f4('0x5a')](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger[_0x76f4('0x63')](_0x76f4('0x5f')+_0x5724c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76f4('0x61')](_0x5724c3);}return _0x551d38;})['then'](function(_0x318fcb){if(!_0x318fcb)throw new InternalError();return _0x318fcb[_0x76f4('0x24')]();})[_0x76f4('0x23')](function(){_0x46245f[_0x76f4('0x1d')](0xcc)[_0x76f4('0x17')]();})[_0x76f4('0x45')](handleError(_0x46245f,null));}; \ No newline at end of file +var _0x207c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0x14ceb2,_0xeb2ff2){var _0x102bd1=function(_0x22de3d){while(--_0x22de3d){_0x14ceb2['push'](_0x14ceb2['shift']());}};_0x102bd1(++_0xeb2ff2);}(_0x207c,0x1e8));var _0xc207=function(_0x174a4d,_0x203ae3){_0x174a4d=_0x174a4d-0x0;var _0x240fa1=_0x207c[_0x174a4d];return _0x240fa1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_['map'](_0x1bec3f,_0xc207('0x26')),[_0xc207('0x31')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x6a653d[_0xc207('0x32')]);_0x463ac8[_0xc207('0x34')]=_['intersection'](_0x463ac8[_0xc207('0x2f')],_0x463ac8[_0xc207('0x32')]);_0xe5e848[_0xc207('0x35')]=_[_0xc207('0x36')](_0x463ac8['model'],qs[_0xc207('0x37')](_0x6a653d[_0xc207('0x32')][_0xc207('0x37')]));_0xe5e848[_0xc207('0x35')]=_0xe5e848[_0xc207('0x35')][_0xc207('0x38')]?_0xe5e848[_0xc207('0x35')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x32')]['hasOwnProperty']('nolimit')){_0xe5e848[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1c')]);_0xe5e848['offset']=qs[_0xc207('0x1a')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d['query'][_0xc207('0x3a')]);_0xe5e848[_0xc207('0x3b')]=qs['filters'](_[_0xc207('0x3c')](_0x6a653d['query'],_0x463ac8[_0xc207('0x34')]),_0x1bec3f);if(_0x6a653d[_0xc207('0x32')]['filter']){_0xe5e848[_0xc207('0x3b')]=_[_0xc207('0x3d')](_0xe5e848[_0xc207('0x3b')],{'$or':_['map'](_0x1bec3f,function(_0x5b3041){if(_0x5b3041[_0xc207('0x2d')]!==_0xc207('0x3e')){var _0x41d66c={};_0x41d66c[_0x5b3041[_0xc207('0x26')]]={'$like':'%'+_0x6a653d['query'][_0xc207('0x3f')]+'%'};return _0x41d66c;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d['options']);var _0x4c10ed={'where':_0xe5e848['where']};return db[_0xc207('0x2a')][_0xc207('0x1d')](_0x4c10ed)[_0xc207('0x23')](function(_0x487f98){_0x6223ef[_0xc207('0x1d')]=_0x487f98;if(_0x6a653d[_0xc207('0x32')][_0xc207('0x40')]){_0xe5e848[_0xc207('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc207('0x42')](_0xe5e848);})[_0xc207('0x23')](function(_0x123a46){_0x6223ef[_0xc207('0x43')]=_0x123a46;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))['catch'](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x19a67d,_0x3a935a){var _0x471a85={'raw':![],'where':{'id':_0x19a67d[_0xc207('0x45')]['id']}},_0x153490={};_0x153490[_0xc207('0x2f')]=_[_0xc207('0x33')](db[_0xc207('0x2a')]['rawAttributes']);_0x153490[_0xc207('0x32')]=_[_0xc207('0x33')](_0x19a67d['query']);_0x153490[_0xc207('0x34')]=_[_0xc207('0x36')](_0x153490[_0xc207('0x2f')],_0x153490[_0xc207('0x32')]);_0x471a85[_0xc207('0x35')]=_['intersection'](_0x153490[_0xc207('0x2f')],qs[_0xc207('0x37')](_0x19a67d[_0xc207('0x32')]['fields']));_0x471a85[_0xc207('0x35')]=_0x471a85[_0xc207('0x35')][_0xc207('0x38')]?_0x471a85[_0xc207('0x35')]:_0x153490['model'];if(_0x19a67d['query'][_0xc207('0x40')]){_0x471a85[_0xc207('0x41')]=[{'all':!![]}];}_0x471a85=_[_0xc207('0x3d')]({},_0x471a85,_0x19a67d[_0xc207('0x46')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x471a85)[_0xc207('0x23')](handleEntityNotFound(_0x3a935a,null))[_0xc207('0x23')](respondWithResult(_0x3a935a,null))[_0xc207('0x48')](handleError(_0x3a935a,null));};exports[_0xc207('0x49')]=function(_0x2afcd1,_0x2fda4f){return db['ScreenRecording']['create'](_0x2afcd1[_0xc207('0x4a')],{})[_0xc207('0x23')](respondWithResult(_0x2fda4f,0xc9))[_0xc207('0x48')](handleError(_0x2fda4f,null));};exports['update']=function(_0x2b89e0,_0x3f712d){if(_0x2b89e0[_0xc207('0x4a')]['id']){delete _0x2b89e0[_0xc207('0x4a')]['id'];}delete _0x2b89e0['body'][_0xc207('0x4b')];delete _0x2b89e0['body'][_0xc207('0x4c')];delete _0x2b89e0['body']['closedAt'];delete _0x2b89e0[_0xc207('0x4a')][_0xc207('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x2b89e0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3f712d,null))[_0xc207('0x23')](saveUpdates(_0x2b89e0[_0xc207('0x4a')],null))[_0xc207('0x23')](respondWithResult(_0x3f712d,null))[_0xc207('0x48')](handleError(_0x3f712d,null));};exports[_0xc207('0x4e')]=function(_0x3dc457,_0x1dfdee){return db['ScreenRecording'][_0xc207('0x4e')]()[_0xc207('0x23')](respondWithResult(_0x1dfdee,null))['catch'](handleError(_0x1dfdee,null));};exports['download']=function(_0x362001,_0x47c630,_0x49a78b){var _0x2634d6=require(_0xc207('0x4f'));var _0x356c8c=![];var _0x3b2448={};if(_0x362001[_0xc207('0x32')][_0xc207('0x2d')]&&_0x362001[_0xc207('0x32')][_0xc207('0x2d')]===_0xc207('0x50')){_0x3b2448[_0xc207('0x50')]=_0x362001[_0xc207('0x45')]['id'];}else{_0x3b2448['id']=_0x362001['params']['id'];}return db['ScreenRecording'][_0xc207('0x47')]({'where':_0x3b2448,'attributes':['id',_0xc207('0x4d')],'raw':!![]})[_0xc207('0x23')](handleEntityNotFound(_0x47c630,null))[_0xc207('0x23')](function(_0xaff7a0){if(_0xaff7a0){var _0x21c12b=path[_0xc207('0x51')](config[_0xc207('0x52')],_0xc207('0x53'),_0xaff7a0['value']);var _0x1cc4e3=util[_0xc207('0x31')](_0xc207('0x54'),_0x21c12b);if(fs[_0xc207('0x55')](_0x1cc4e3)){_0x356c8c=!![];return _0x2634d6['decryptFile'](_0x1cc4e3,_0x21c12b,config[_0xc207('0x56')][_0xc207('0x57')])[_0xc207('0x23')](function(){return _0xaff7a0;});}return _0xaff7a0;}})[_0xc207('0x23')](function(_0x464263){if(_0x464263){var _0x45ad58=path[_0xc207('0x51')](config['root'],_0xc207('0x53'),_0x464263[_0xc207('0x4d')]);if(!fs[_0xc207('0x55')](_0x45ad58)){throw new db[(_0xc207('0x58'))]['ValidationError'](_0xc207('0x59'));}if(_0x464263['filename']){return _0x47c630['download'](_0x45ad58,_0x464263[_0xc207('0x5a')]+path[_0xc207('0x5b')](_0x45ad58),function(){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}else{return _0x47c630[_0xc207('0x5d')](_0x45ad58,function(_0x441d5f){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}}})[_0xc207('0x48')](function(_0x33c372){if(_0x33c372[_0xc207('0x5e')]===_0xc207('0x59')){_0x47c630[_0xc207('0x17')](0x194)[_0xc207('0x27')](_0xc207('0x5f'));}else{return handleError(_0x47c630,null);}});};exports[_0xc207('0x24')]=function(_0x282ae5,_0x501bca){return db[_0xc207('0x2a')]['find']({'where':{'id':_0x282ae5[_0xc207('0x45')]['id']}})[_0xc207('0x23')](function(_0x2ade23){if(_['isNil'](_0x2ade23)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ade23;})[_0xc207('0x23')](function(_0x3ac0dd){var _0x2f18a2=path['join'](config[_0xc207('0x52')],_0xc207('0x53'),_0x3ac0dd[_0xc207('0x4d')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f18a2);if(!_[_0xc207('0x60')](_0x3ac0dd['value'])&&fs[_0xc207('0x55')](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}_0x2f18a2=_0x2f18a2+_0xc207('0x65');if(!_[_0xc207('0x60')](_0x3ac0dd[_0xc207('0x4d')])&&fs['existsSync'](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}return _0x3ac0dd;})[_0xc207('0x23')](function(_0x14050a){if(!_0x14050a)throw new InternalError();return _0x14050a[_0xc207('0x24')]();})[_0xc207('0x23')](function(){_0x501bca[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();})[_0xc207('0x48')](handleError(_0x501bca,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 1125646..761fafe 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 _0x2963=['../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4ee8da,_0x111e61){var _0x2d485c=function(_0x2550d1){while(--_0x2550d1){_0x4ee8da['push'](_0x4ee8da['shift']());}};_0x2d485c(++_0x111e61);}(_0x2963,0x132));var _0x3296=function(_0x1b9e1a,_0xe8e24d){_0x1b9e1a=_0x1b9e1a-0x0;var _0xc66289=_0x2963[_0x1b9e1a];return _0xc66289;};'use strict';var _=require(_0x3296('0x0'));var util=require(_0x3296('0x1'));var logger=require(_0x3296('0x2'))(_0x3296('0x3'));var moment=require(_0x3296('0x4'));var BPromise=require(_0x3296('0x5'));var rp=require(_0x3296('0x6'));var fs=require('fs');var path=require(_0x3296('0x7'));var rimraf=require(_0x3296('0x8'));var config=require(_0x3296('0x9'));var attributes=require('./screenRecording.attributes');module[_0x3296('0xa')]=function(_0x32a317,_0x320e15){return _0x32a317[_0x3296('0xb')](_0x3296('0xc'),attributes,{'tableName':_0x3296('0xd'),'paranoid':![],'indexes':[{'name':_0x3296('0xe'),'fields':[_0x3296('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa654=['util','api','moment','bluebird','path','rimraf','../../config/environment','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x223bdb,_0x5882e6){var _0xef8e68=function(_0x55ab83){while(--_0x55ab83){_0x223bdb['push'](_0x223bdb['shift']());}};_0xef8e68(++_0x5882e6);}(_0xa654,0x17f));var _0x4a65=function(_0x231d56,_0x4d8bfe){_0x231d56=_0x231d56-0x0;var _0x220261=_0xa654[_0x231d56];return _0x220261;};'use strict';var _=require(_0x4a65('0x0'));var util=require(_0x4a65('0x1'));var logger=require('../../config/logger')(_0x4a65('0x2'));var moment=require(_0x4a65('0x3'));var BPromise=require(_0x4a65('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a65('0x5'));var rimraf=require(_0x4a65('0x6'));var config=require(_0x4a65('0x7'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x19f242,_0x5ce921){return _0x19f242[_0x4a65('0x8')](_0x4a65('0x9'),attributes,{'tableName':_0x4a65('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x4a65('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 0febbfa..3699181 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 _0x3b2f=['../../mysqldb','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ScreenRecording,\x20%s,\x20%s','catch','lodash','moment','bluebird','ioredis'];(function(_0x791c4a,_0x926241){var _0x20d6a3=function(_0x53a195){while(--_0x53a195){_0x791c4a['push'](_0x791c4a['shift']());}};_0x20d6a3(++_0x926241);}(_0x3b2f,0x14c));var _0xf3b2=function(_0xc34c19,_0x1fe3d9){_0xc34c19=_0xc34c19-0x0;var _0x1592db=_0x3b2f[_0xc34c19];return _0x1592db;};'use strict';var _=require(_0xf3b2('0x0'));var util=require('util');var moment=require(_0xf3b2('0x1'));var BPromise=require(_0xf3b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3b2('0x3'));var db=require(_0xf3b2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf3b2('0x5'));var config=require(_0xf3b2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf3b2('0x7')][_0xf3b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40c7a2,_0x4c7d55,_0x1a0d56){return new BPromise(function(_0x28a419,_0x3b9d8d){return client[_0xf3b2('0x9')](_0x40c7a2,_0x1a0d56)[_0xf3b2('0xa')](function(_0x88abea){logger[_0xf3b2('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x4c7d55,_0xf3b2('0xc'));logger[_0xf3b2('0xd')](_0xf3b2('0xe'),_0x4c7d55,'request\x20sent',JSON[_0xf3b2('0xf')](_0x88abea));if(_0x88abea[_0xf3b2('0x10')]){if(_0x88abea['error'][_0xf3b2('0x11')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x4c7d55,_0x88abea[_0xf3b2('0x10')][_0xf3b2('0x12')]);return _0x3b9d8d(_0x88abea[_0xf3b2('0x10')]['message']);}logger[_0xf3b2('0x10')](_0xf3b2('0x13'),_0x4c7d55,_0x88abea[_0xf3b2('0x10')][_0xf3b2('0x12')]);return _0x28a419(_0x88abea[_0xf3b2('0x10')][_0xf3b2('0x12')]);}else{logger[_0xf3b2('0xb')](_0xf3b2('0x13'),_0x4c7d55,_0xf3b2('0xc'));_0x28a419(_0x88abea['result'][_0xf3b2('0x12')]);}})[_0xf3b2('0x14')](function(_0x503110){logger['error'](_0xf3b2('0x13'),_0x4c7d55,_0x503110);_0x3b9d8d(_0x503110);});});} \ No newline at end of file +var _0xc3d4=['http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x518c78,_0x4abc5d){var _0x5c5b01=function(_0x3357c6){while(--_0x3357c6){_0x518c78['push'](_0x518c78['shift']());}};_0x5c5b01(++_0x4abc5d);}(_0xc3d4,0x115));var _0x4c3d=function(_0xedf622,_0x5a854d){_0xedf622=_0xedf622-0x0;var _0x245b71=_0xc3d4[_0xedf622];return _0x245b71;};'use strict';var _=require('lodash');var util=require(_0x4c3d('0x0'));var moment=require(_0x4c3d('0x1'));var BPromise=require(_0x4c3d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c3d('0x3'));var db=require(_0x4c3d('0x4'))['db'];var utils=require(_0x4c3d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4c3d('0x6'));var jayson=require(_0x4c3d('0x7'));var client=jayson[_0x4c3d('0x8')][_0x4c3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9f35,_0x334b35,_0x519f50){return new BPromise(function(_0x7df253,_0x59fa3c){return client[_0x4c3d('0xa')](_0x2e9f35,_0x519f50)['then'](function(_0x3d6bd4){logger[_0x4c3d('0xb')](_0x4c3d('0xc'),_0x334b35,_0x4c3d('0xd'));logger[_0x4c3d('0xe')](_0x4c3d('0xf'),_0x334b35,_0x4c3d('0xd'),JSON[_0x4c3d('0x10')](_0x3d6bd4));if(_0x3d6bd4[_0x4c3d('0x11')]){if(_0x3d6bd4[_0x4c3d('0x11')][_0x4c3d('0x12')]===0x1f4){logger[_0x4c3d('0x11')](_0x4c3d('0xc'),_0x334b35,_0x3d6bd4[_0x4c3d('0x11')][_0x4c3d('0x13')]);return _0x59fa3c(_0x3d6bd4[_0x4c3d('0x11')][_0x4c3d('0x13')]);}logger[_0x4c3d('0x11')](_0x4c3d('0xc'),_0x334b35,_0x3d6bd4['error'][_0x4c3d('0x13')]);return _0x7df253(_0x3d6bd4[_0x4c3d('0x11')][_0x4c3d('0x13')]);}else{logger[_0x4c3d('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x334b35,_0x4c3d('0xd'));_0x7df253(_0x3d6bd4[_0x4c3d('0x14')][_0x4c3d('0x13')]);}})[_0x4c3d('0x15')](function(_0xf60ed){logger[_0x4c3d('0x11')](_0x4c3d('0xc'),_0x334b35,_0xf60ed);_0x59fa3c(_0xf60ed);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9883849..317d6c1 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 _0x053c=['file','single','addLogoLogin','preferred','post','addPreferred','favicon','put','/:id','isAuthenticated','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','getDate','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname'];(function(_0xf1175c,_0x4a27e1){var _0x5b7b4a=function(_0x1d890a){while(--_0x1d890a){_0xf1175c['push'](_0xf1175c['shift']());}};_0x5b7b4a(++_0x4a27e1);}(_0x053c,0xfc));var _0xc053=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x053c[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xc053('0x0'));var util=require(_0xc053('0x1'));var path=require(_0xc053('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc053('0x3')]();var fs_extra=require(_0xc053('0x4'));var auth=require(_0xc053('0x5'));var interaction=require(_0xc053('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xc053('0x7')]('/',auth['isAuthenticated'](),controller[_0xc053('0x8')]);router['get']('/now',controller[_0xc053('0x9')]);router[_0xc053('0x7')]('/:id',controller[_0xc053('0xa')]);router['get'](_0xc053('0xb'),controller[_0xc053('0xc')]);router['get'](_0xc053('0xd'),controller['getLogoLogin']);router[_0xc053('0x7')](_0xc053('0xe'),controller[_0xc053('0xf')]);router[_0xc053('0x7')](_0xc053('0x10'),controller[_0xc053('0x11')]);router[_0xc053('0x7')](_0xc053('0x12'),controller[_0xc053('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a5749,_0x32032e,_0x24f7fb){_0x24f7fb(null,path[_0xc053('0x14')](config[_0xc053('0x15')],_0xc053('0x16')));},'filename':function(_0x22d111,_0x2b1854,_0x54a7d0){_0x54a7d0(null,util[_0xc053('0x17')](_0xc053('0x18'),_0xc053('0x19'),path[_0xc053('0x1a')](_0x2b1854[_0xc053('0x1b')])));}})});router['post'](_0xc053('0xb'),upload['single'](_0xc053('0x1c')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x55a034,_0x1468bd,_0x521734){_0x521734(null,path[_0xc053('0x14')](config[_0xc053('0x15')],_0xc053('0x16')));},'filename':function(_0x23287e,_0x5ba8b5,_0x2a45ca){_0x2a45ca(null,util[_0xc053('0x17')](_0xc053('0x18'),'logologin',path['extname'](_0x5ba8b5[_0xc053('0x1b')])));}})});router['post'](_0xc053('0xd'),upload[_0xc053('0x1d')](_0xc053('0x1c')),controller[_0xc053('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xe57474,_0x47443e,_0x27e75d){_0x27e75d(null,path['join'](config[_0xc053('0x15')],_0xc053('0x16')));},'filename':function(_0xf51d6b,_0x5bd3eb,_0x29d74b){_0x29d74b(null,util['format'](_0xc053('0x18'),_0xc053('0x1f'),path[_0xc053('0x1a')](_0x5bd3eb[_0xc053('0x1b')])));}})});router[_0xc053('0x20')]('/:id/preferred',upload[_0xc053('0x1d')]('file'),controller[_0xc053('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x55b3e6,_0x1c9e00,_0x4b6b47){_0x4b6b47(null,path[_0xc053('0x14')](config[_0xc053('0x15')],'server/files/images/logos/'));},'filename':function(_0x20e643,_0x7f37dd,_0x105eaa){_0x105eaa(null,util['format']('%s%s',_0xc053('0x22'),path['extname'](_0x7f37dd['originalname'])));}})});router[_0xc053('0x20')](_0xc053('0x12'),upload[_0xc053('0x1d')](_0xc053('0x1c')),controller['addFavicon']);router[_0xc053('0x23')](_0xc053('0x24'),auth[_0xc053('0x25')](),controller[_0xc053('0x26')]);module[_0xc053('0x27')]=router; \ No newline at end of file +var _0x8629=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/now','getDate','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','root','format','%s%s','logo','originalname','post','/:id/logo','single','file','addLogo','diskStorage','join','server/files/images/logos/','logologin','extname','addLogoLogin','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','/:id','update','exports','util','connect-timeout'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x8629,0x193));var _0x9862=function(_0x4a6071,_0x13ea96){_0x4a6071=_0x4a6071-0x0;var _0x2e67b8=_0x8629[_0x4a6071];return _0x2e67b8;};'use strict';var multer=require('multer');var util=require(_0x9862('0x0'));var path=require('path');var timeout=require(_0x9862('0x1'));var express=require(_0x9862('0x2'));var router=express['Router']();var fs_extra=require(_0x9862('0x3'));var auth=require(_0x9862('0x4'));var interaction=require(_0x9862('0x5'));var config=require(_0x9862('0x6'));var controller=require('./setting.controller');router['get']('/',auth[_0x9862('0x7')](),controller[_0x9862('0x8')]);router[_0x9862('0x9')](_0x9862('0xa'),controller[_0x9862('0xb')]);router[_0x9862('0x9')]('/:id',controller[_0x9862('0xc')]);router[_0x9862('0x9')]('/:id/logo',controller[_0x9862('0xd')]);router[_0x9862('0x9')](_0x9862('0xe'),controller[_0x9862('0xf')]);router['get'](_0x9862('0x10'),controller[_0x9862('0x11')]);router['get'](_0x9862('0x12'),controller[_0x9862('0x13')]);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d9332,_0x503e5c,_0x11fe29){_0x11fe29(null,path['join'](config[_0x9862('0x14')],'server/files/images/logos/'));},'filename':function(_0x4acae5,_0x3928f1,_0x10178d){_0x10178d(null,util[_0x9862('0x15')](_0x9862('0x16'),_0x9862('0x17'),path['extname'](_0x3928f1[_0x9862('0x18')])));}})});router[_0x9862('0x19')](_0x9862('0x1a'),upload[_0x9862('0x1b')](_0x9862('0x1c')),controller[_0x9862('0x1d')]);var upload=multer({'storage':multer[_0x9862('0x1e')]({'destination':function(_0x1adb55,_0x4a1938,_0x3ffd9){_0x3ffd9(null,path[_0x9862('0x1f')](config[_0x9862('0x14')],_0x9862('0x20')));},'filename':function(_0x26dd4e,_0x54d432,_0x1ce88e){_0x1ce88e(null,util['format'](_0x9862('0x16'),_0x9862('0x21'),path[_0x9862('0x22')](_0x54d432[_0x9862('0x18')])));}})});router[_0x9862('0x19')](_0x9862('0xe'),upload[_0x9862('0x1b')](_0x9862('0x1c')),controller[_0x9862('0x23')]);var upload=multer({'storage':multer[_0x9862('0x1e')]({'destination':function(_0x2c52c,_0x15d57e,_0x3ae44f){_0x3ae44f(null,path[_0x9862('0x1f')](config[_0x9862('0x14')],_0x9862('0x20')));},'filename':function(_0x38840e,_0x2f17ef,_0x43cff4){_0x43cff4(null,util[_0x9862('0x15')]('%s%s',_0x9862('0x24'),path[_0x9862('0x22')](_0x2f17ef[_0x9862('0x18')])));}})});router['post'](_0x9862('0x12'),upload['single'](_0x9862('0x1c')),controller[_0x9862('0x25')]);var upload=multer({'storage':multer[_0x9862('0x1e')]({'destination':function(_0x2ecc2d,_0x3088be,_0x46bccb){_0x46bccb(null,path[_0x9862('0x1f')](config[_0x9862('0x14')],'server/files/images/logos/'));},'filename':function(_0x339a65,_0x3085ff,_0x2ff386){_0x2ff386(null,util[_0x9862('0x15')](_0x9862('0x16'),_0x9862('0x26'),path[_0x9862('0x22')](_0x3085ff[_0x9862('0x18')])));}})});router[_0x9862('0x19')](_0x9862('0x27'),upload['single']('file'),controller[_0x9862('0x28')]);router[_0x9862('0x29')](_0x9862('0x2a'),auth[_0x9862('0x7')](),controller[_0x9862('0x2b')]);module[_0x9862('0x2c')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 085aef4..f8a6336 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 _0x5d3b=['min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0x5d3b,0x6e));var _0xb5d3=function(_0x44c1a3,_0x153fb1){_0x44c1a3=_0x44c1a3-0x0;var _0x4eac52=_0x5d3b[_0x44c1a3];return _0x4eac52;};'use strict';var Sequelize=require('sequelize');module[_0xb5d3('0x0')]={'min_internal':{'type':Sequelize[_0xb5d3('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb5d3('0x1')](0xb),'unique':_0xb5d3('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xb5d3('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xb5d3('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb5d3('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xb5d3('0x3')]},'turnusername':{'type':Sequelize[_0xb5d3('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xb5d3('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb5d3('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xb5d3('0x3')],'defaultValue':_0xb5d3('0x5')},'enableEmailPreview':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb5d3('0x3')],'defaultValue':_0xb5d3('0x6')},'chatTimeout':{'type':Sequelize[_0xb5d3('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb5d3('0x3')]},'defaultPreferred':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xb5d3('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xb5d3('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xb5d3('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb5d3('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb5d3('0x1')]},'transcribeRegion':{'type':Sequelize[_0xb5d3('0x3')]},'sentiment':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb5d3('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xb5d3('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xb5d3('0x1')](0x2)[_0xb5d3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xb5d3('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xb5d3('0x1')](0x2)[_0xb5d3('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xb5d3('0x1')](0x2)[_0xb5d3('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb5d3('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xb5d3('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb5d3('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xb5d3('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xb5d3('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xb5d3('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xe4a7=['STRING','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','BOOLEAN'];(function(_0x4875e2,_0x3e656f){var _0x34d2c2=function(_0x29cf79){while(--_0x29cf79){_0x4875e2['push'](_0x4875e2['shift']());}};_0x34d2c2(++_0x3e656f);}(_0xe4a7,0x18a));var _0x7e4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe4a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7e4a('0x0'));module[_0x7e4a('0x1')]={'min_internal':{'type':Sequelize[_0x7e4a('0x2')](0xb),'unique':_0x7e4a('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7e4a('0x2')](0xb),'unique':_0x7e4a('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7e4a('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7e4a('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7e4a('0x6')]},'turnaddr':{'type':Sequelize[_0x7e4a('0x6')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x7e4a('0x6')]},'pageTitle':{'type':Sequelize[_0x7e4a('0x6')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7e4a('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7e4a('0x6')],'defaultValue':_0x7e4a('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x7e4a('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7e4a('0x6')]},'defaultPreferred':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x7e4a('0x6')]},'defaultFavicon':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7e4a('0x2')]},'transcribeRegion':{'type':Sequelize[_0x7e4a('0x6')]},'sentiment':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7e4a('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7e4a('0x6')]},'bucket':{'type':Sequelize[_0x7e4a('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7e4a('0x2')](0x2)[_0x7e4a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7e4a('0x2')](0x2)[_0x7e4a('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x7e4a('0x2')](0x2)[_0x7e4a('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7e4a('0x2')](0x2)[_0x7e4a('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 57606c7..733ea45 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 _0x47aa=['getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','defaultPreferred','default_loginLogo.svg','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','destroy','stack','name','send','map','Setting','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','params','options','update','body','addLogo','file','filename','find','addLogoLogin','loginLogo'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0x47aa,0x9e));var _0xa47a=function(_0x5888b6,_0x1cd36f){_0x5888b6=_0x5888b6-0x0;var _0x23621f=_0x47aa[_0x5888b6];return _0x23621f;};'use strict';var emlformat=require(_0xa47a('0x0'));var rimraf=require(_0xa47a('0x1'));var zipdir=require(_0xa47a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa47a('0x3'));var moment=require('moment');var BPromise=require(_0xa47a('0x4'));var Mustache=require(_0xa47a('0x5'));var util=require(_0xa47a('0x6'));var path=require(_0xa47a('0x7'));var sox=require(_0xa47a('0x8'));var csv=require(_0xa47a('0x9'));var ejs=require(_0xa47a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa47a('0xb'));var squel=require('squel');var crypto=require(_0xa47a('0xc'));var jsforce=require(_0xa47a('0xd'));var deskjs=require(_0xa47a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa47a('0xf'));var Papa=require(_0xa47a('0x10'));var Redis=require(_0xa47a('0x11'));var authService=require(_0xa47a('0x12'));var qs=require(_0xa47a('0x13'));var as=require(_0xa47a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa47a('0x15'));var utils=require(_0xa47a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa47a('0x17'));var db=require(_0xa47a('0x18'))['db'];var jayson=require(_0xa47a('0x19'));var client=jayson[_0xa47a('0x1a')][_0xa47a('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x799da,_0x567b0a,_0x290553,_0x59cb36){return new BPromise(function(_0x52a672,_0x235a99){var _0x4447a1=_0x59cb36||client;return _0x4447a1[_0xa47a('0x1c')](_0x799da,_0x290553)[_0xa47a('0x1d')](function(_0x3a2eb3){logger[_0xa47a('0x1e')](_0xa47a('0x1f'),_0x567b0a,'request\x20sent');logger[_0xa47a('0x20')](_0xa47a('0x21'),_0x567b0a,_0xa47a('0x22'),JSON[_0xa47a('0x23')](_0x3a2eb3));if(_0x3a2eb3['error']){if(_0x3a2eb3[_0xa47a('0x24')][_0xa47a('0x25')]===0x1f4){logger[_0xa47a('0x24')]('Setting,\x20%s,\x20%s',_0x567b0a,_0x3a2eb3[_0xa47a('0x24')][_0xa47a('0x26')]);return _0x235a99(_0x3a2eb3[_0xa47a('0x24')]['message']);}logger[_0xa47a('0x24')]('Setting,\x20%s,\x20%s',_0x567b0a,_0x3a2eb3[_0xa47a('0x24')][_0xa47a('0x26')]);return _0x52a672(_0x3a2eb3[_0xa47a('0x24')][_0xa47a('0x26')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x567b0a,_0xa47a('0x22'));_0x52a672(_0x3a2eb3[_0xa47a('0x27')][_0xa47a('0x26')]);}})[_0xa47a('0x28')](function(_0x4c701f){logger[_0xa47a('0x24')]('Setting,\x20%s,\x20%s',_0x567b0a,_0x4c701f);_0x235a99(_0x4c701f);});});}function respondWithStatusCode(_0x4b0aab,_0x456d75){_0x456d75=_0x456d75||0xcc;return function(_0x542028){if(_0x542028){return _0x4b0aab[_0xa47a('0x29')](_0x456d75);}return _0x4b0aab[_0xa47a('0x2a')](_0x456d75)[_0xa47a('0x2b')]();};}function respondWithResult(_0x12ea8c,_0x31f149){_0x31f149=_0x31f149||0xc8;return function(_0x32510f){if(_0x32510f){return _0x12ea8c['status'](_0x31f149)[_0xa47a('0x2c')](_0x32510f);}};}function respondWithFilteredResult(_0x500315,_0x2684a0){return function(_0x2e5b64){if(_0x2e5b64){var _0x1166c1=typeof _0x2684a0[_0xa47a('0x2d')]===_0xa47a('0x2e')&&typeof _0x2684a0[_0xa47a('0x2f')]===_0xa47a('0x2e');var _0xabaeb3=_0x2e5b64[_0xa47a('0x30')];var _0x5508ec=_0x1166c1?0x0:_0x2684a0[_0xa47a('0x2d')];var _0x19d70d=_0x1166c1?_0x2e5b64[_0xa47a('0x30')]:_0x2684a0[_0xa47a('0x2d')]+_0x2684a0['limit'];var _0x26b71e;if(_0x19d70d>=_0xabaeb3){_0x19d70d=_0xabaeb3;_0x26b71e=0xc8;}else{_0x26b71e=0xce;}_0x500315[_0xa47a('0x2a')](_0x26b71e);return _0x500315['set'](_0xa47a('0x31'),_0x5508ec+'-'+_0x19d70d+'/'+_0xabaeb3)['json'](_0x2e5b64);}return null;};}function patchUpdates(_0x394fec){return function(_0x52a8a7){try{jsonpatch[_0xa47a('0x32')](_0x52a8a7,_0x394fec,!![]);}catch(_0x370811){return BPromise['reject'](_0x370811);}return _0x52a8a7['save']();};}function saveUpdates(_0x1997ad,_0x1c1ecb){return function(_0x2b790a){if(_0x2b790a){return _0x2b790a['update'](_0x1997ad)[_0xa47a('0x1d')](function(_0x89c333){return _0x89c333;});}return null;};}function removeEntity(_0x3a0fa0,_0xec6e0b){return function(_0x2be74e){if(_0x2be74e){return _0x2be74e[_0xa47a('0x33')]()[_0xa47a('0x1d')](function(){_0x3a0fa0[_0xa47a('0x2a')](0xcc)[_0xa47a('0x2b')]();});}};}function handleEntityNotFound(_0x435bcf,_0x48285b){return function(_0x1c9bf6){if(!_0x1c9bf6){_0x435bcf[_0xa47a('0x29')](0x194);}return _0x1c9bf6;};}function handleError(_0x568e39,_0x1918ca){_0x1918ca=_0x1918ca||0x1f4;return function(_0x4c3dba){logger[_0xa47a('0x24')](_0x4c3dba[_0xa47a('0x34')]);if(_0x4c3dba[_0xa47a('0x35')]){delete _0x4c3dba[_0xa47a('0x35')];}_0x568e39[_0xa47a('0x2a')](_0x1918ca)[_0xa47a('0x36')](_0x4c3dba);};}exports['index']=function(_0x3a69c0,_0x3452bd){var _0x173d4d={},_0xe467ab={},_0x1b3ced={'count':0x0,'rows':[]};var _0x2f6814=_[_0xa47a('0x37')](db[_0xa47a('0x38')]['rawAttributes'],function(_0x443d3f){return{'name':_0x443d3f[_0xa47a('0x39')],'type':_0x443d3f[_0xa47a('0x3a')]['key']};});_0xe467ab[_0xa47a('0x3b')]=_[_0xa47a('0x37')](_0x2f6814,_0xa47a('0x35'));_0xe467ab['query']=_[_0xa47a('0x3c')](_0x3a69c0[_0xa47a('0x3d')]);_0xe467ab['filters']=_[_0xa47a('0x3e')](_0xe467ab[_0xa47a('0x3b')],_0xe467ab[_0xa47a('0x3d')]);_0x173d4d['attributes']=_[_0xa47a('0x3e')](_0xe467ab[_0xa47a('0x3b')],qs[_0xa47a('0x3f')](_0x3a69c0[_0xa47a('0x3d')][_0xa47a('0x3f')]));_0x173d4d[_0xa47a('0x40')]=_0x173d4d[_0xa47a('0x40')][_0xa47a('0x41')]?_0x173d4d[_0xa47a('0x40')]:_0xe467ab['model'];if(!_0x3a69c0[_0xa47a('0x3d')][_0xa47a('0x42')](_0xa47a('0x43'))){_0x173d4d[_0xa47a('0x2f')]=qs['limit'](_0x3a69c0['query'][_0xa47a('0x2f')]);_0x173d4d['offset']=qs[_0xa47a('0x2d')](_0x3a69c0[_0xa47a('0x3d')][_0xa47a('0x2d')]);}_0x173d4d[_0xa47a('0x44')]=qs[_0xa47a('0x45')](_0x3a69c0[_0xa47a('0x3d')][_0xa47a('0x45')]);_0x173d4d['where']=qs[_0xa47a('0x46')](_[_0xa47a('0x47')](_0x3a69c0['query'],_0xe467ab[_0xa47a('0x46')]),_0x2f6814);if(_0x3a69c0['query'][_0xa47a('0x48')]){_0x173d4d[_0xa47a('0x49')]=_['merge'](_0x173d4d[_0xa47a('0x49')],{'$or':_[_0xa47a('0x37')](_0x2f6814,function(_0x2ebf33){if(_0x2ebf33[_0xa47a('0x3a')]!==_0xa47a('0x4a')){var _0x5f1c71={};_0x5f1c71[_0x2ebf33[_0xa47a('0x35')]]={'$like':'%'+_0x3a69c0[_0xa47a('0x3d')][_0xa47a('0x48')]+'%'};return _0x5f1c71;}})});}_0x173d4d=_[_0xa47a('0x4b')]({},_0x173d4d,_0x3a69c0['options']);var _0x48ce06={'where':_0x173d4d['where']};return db[_0xa47a('0x38')][_0xa47a('0x30')](_0x48ce06)[_0xa47a('0x1d')](function(_0x335d4e){_0x1b3ced[_0xa47a('0x30')]=_0x335d4e;if(_0x3a69c0[_0xa47a('0x3d')][_0xa47a('0x4c')]){_0x173d4d[_0xa47a('0x4d')]=[{'all':!![]}];}return db['Setting'][_0xa47a('0x4e')](_0x173d4d);})['then'](function(_0x31bc78){_0x1b3ced[_0xa47a('0x4f')]=_0x31bc78;return _0x1b3ced;})[_0xa47a('0x1d')](respondWithFilteredResult(_0x3452bd,_0x173d4d))[_0xa47a('0x28')](handleError(_0x3452bd,null));};exports['show']=function(_0xd09f98,_0x22d933){var _0x509dc3={'raw':![],'where':{'id':_0xd09f98[_0xa47a('0x50')]['id']}},_0x1e7c82={};_0x1e7c82[_0xa47a('0x3b')]=_[_0xa47a('0x3c')](db['Setting']['rawAttributes']);_0x1e7c82[_0xa47a('0x3d')]=_['keys'](_0xd09f98[_0xa47a('0x3d')]);_0x1e7c82[_0xa47a('0x46')]=_[_0xa47a('0x3e')](_0x1e7c82['model'],_0x1e7c82[_0xa47a('0x3d')]);_0x509dc3[_0xa47a('0x40')]=_['intersection'](_0x1e7c82[_0xa47a('0x3b')],qs['fields'](_0xd09f98[_0xa47a('0x3d')][_0xa47a('0x3f')]));_0x509dc3[_0xa47a('0x40')]=_0x509dc3[_0xa47a('0x40')][_0xa47a('0x41')]?_0x509dc3[_0xa47a('0x40')]:_0x1e7c82[_0xa47a('0x3b')];if(_0xd09f98[_0xa47a('0x3d')][_0xa47a('0x4c')]){_0x509dc3[_0xa47a('0x4d')]=[{'all':!![]}];}_0x509dc3=_[_0xa47a('0x4b')]({},_0x509dc3,_0xd09f98[_0xa47a('0x51')]);return db['Setting']['find'](_0x509dc3)[_0xa47a('0x1d')](handleEntityNotFound(_0x22d933,null))[_0xa47a('0x1d')](respondWithResult(_0x22d933,null))[_0xa47a('0x28')](handleError(_0x22d933,null));};exports[_0xa47a('0x52')]=function(_0x3c4abb,_0x110217){if(_0x3c4abb[_0xa47a('0x53')]['id']){delete _0x3c4abb[_0xa47a('0x53')]['id'];}return db[_0xa47a('0x38')]['find']({'where':{'id':_0x3c4abb[_0xa47a('0x50')]['id']}})[_0xa47a('0x1d')](handleEntityNotFound(_0x110217,null))[_0xa47a('0x1d')](saveUpdates(_0x3c4abb[_0xa47a('0x53')],null))[_0xa47a('0x1d')](respondWithResult(_0x110217,null))['catch'](handleError(_0x110217,null));};exports[_0xa47a('0x54')]=function(_0x33ed31,_0x54b81f,_0x24ae76){if(_0x33ed31[_0xa47a('0x55')]&&_0x33ed31[_0xa47a('0x55')][_0xa47a('0x56')]){_0x33ed31[_0xa47a('0x53')]['logo']=_0x33ed31[_0xa47a('0x55')]['filename'];}return db[_0xa47a('0x38')][_0xa47a('0x57')]({'where':{'id':_0x33ed31[_0xa47a('0x50')]['id']}})['then'](handleEntityNotFound(_0x54b81f,null))[_0xa47a('0x1d')](saveUpdates(_0x33ed31[_0xa47a('0x53')],null))[_0xa47a('0x1d')](respondWithResult(_0x54b81f,null))[_0xa47a('0x28')](handleError(_0x54b81f,null));};exports[_0xa47a('0x58')]=function(_0xda4a30,_0x13c55b,_0x8b48c8){if(_0xda4a30[_0xa47a('0x55')]&&_0xda4a30[_0xa47a('0x55')][_0xa47a('0x56')]){_0xda4a30[_0xa47a('0x53')][_0xa47a('0x59')]=_0xda4a30[_0xa47a('0x55')]['filename'];}return db[_0xa47a('0x38')][_0xa47a('0x57')]({'where':{'id':_0xda4a30['params']['id']}})[_0xa47a('0x1d')](handleEntityNotFound(_0x13c55b,null))[_0xa47a('0x1d')](saveUpdates(_0xda4a30['body'],null))[_0xa47a('0x1d')](respondWithResult(_0x13c55b,null))[_0xa47a('0x28')](handleError(_0x13c55b,null));};var utilLicense=require('../../config/license/util');exports[_0xa47a('0x5a')]=function(_0x456131,_0xb76921,_0x1beab6){var _0x125e0c=_0xa47a('0x5b');var _0x12b2ef={'custom':![]};return utilLicense[_0xa47a('0x5c')]()['then'](function(_0x53ab29){if(_0x53ab29){_0x12b2ef=_0x53ab29;}return db[_0xa47a('0x38')][_0xa47a('0x57')]({'where':{'id':_0x456131[_0xa47a('0x50')]['id']},'attributes':[_0xa47a('0x5d'),_0xa47a('0x59'),_0xa47a('0x5e'),_0xa47a('0x5f'),'defaultLogo',_0xa47a('0x60'),'defaultPreferred',_0xa47a('0x61')],'raw':!![]});})[_0xa47a('0x1d')](handleEntityNotFound(_0xb76921,null))[_0xa47a('0x1d')](function(_0x390772){if(_0x390772){var _0x52e333=_0x390772[_0xa47a('0x5d')]&&fs[_0xa47a('0x62')](path[_0xa47a('0x63')](config[_0xa47a('0x64')],_0x125e0c,_[_0xa47a('0x65')](_0x390772[_0xa47a('0x5d')])))?path['join'](config[_0xa47a('0x64')],_0x125e0c,_['toLower'](_0x390772['logo'])):path[_0xa47a('0x63')](config[_0xa47a('0x64')],_0x125e0c,_[_0xa47a('0x65')](_0xa47a('0x66')));var _0x1c8a9d=_0xa47a('0x67')+_[_0xa47a('0x68')]('logo');if(_0x390772[_0x1c8a9d]||!_0x12b2ef[_0xa47a('0x69')]){_0x52e333=path[_0xa47a('0x63')](config['root'],_0x125e0c,_[_0xa47a('0x65')](_0xa47a('0x66')));}if(!fs[_0xa47a('0x62')](_0x52e333)){throw new db[(_0xa47a('0x6a'))][(_0xa47a('0x6b'))](_[_0xa47a('0x68')](_0xa47a('0x5d'))+_0xa47a('0x6c'));}return _0xb76921[_0xa47a('0x6d')](_0x52e333);}})['catch'](handleError(_0xb76921,null));};var utilLicense=require(_0xa47a('0x17'));exports[_0xa47a('0x6e')]=function(_0x16f1c3,_0x2d62aa,_0x9d047b){var _0x5184b5=_0xa47a('0x5b');var _0x414d25={'custom':![]};return utilLicense[_0xa47a('0x5c')]()[_0xa47a('0x1d')](function(_0x44e84e){if(_0x44e84e){_0x414d25=_0x44e84e;}return db['Setting'][_0xa47a('0x57')]({'where':{'id':_0x16f1c3[_0xa47a('0x50')]['id']},'attributes':[_0xa47a('0x5d'),_0xa47a('0x59'),_0xa47a('0x5e'),_0xa47a('0x5f'),_0xa47a('0x6f'),'defaultLoginLogo',_0xa47a('0x70'),_0xa47a('0x61')],'raw':!![]});})[_0xa47a('0x1d')](handleEntityNotFound(_0x2d62aa,null))[_0xa47a('0x1d')](function(_0x2f1fb7){if(_0x2f1fb7){var _0x42a7b9=_0x2f1fb7[_0xa47a('0x59')]&&fs[_0xa47a('0x62')](path[_0xa47a('0x63')](config[_0xa47a('0x64')],_0x5184b5,_[_0xa47a('0x65')](_0x2f1fb7[_0xa47a('0x59')])))?path[_0xa47a('0x63')](config['root'],_0x5184b5,_[_0xa47a('0x65')](_0x2f1fb7[_0xa47a('0x59')])):path['join'](config[_0xa47a('0x64')],_0x5184b5,_[_0xa47a('0x65')]('default_loginLogo.svg'));var _0x5e8dcf=_0xa47a('0x67')+_[_0xa47a('0x68')]('loginLogo');if(_0x2f1fb7[_0x5e8dcf]||!_0x414d25[_0xa47a('0x69')]){_0x42a7b9=path[_0xa47a('0x63')](config[_0xa47a('0x64')],_0x5184b5,_[_0xa47a('0x65')](_0xa47a('0x71')));}if(!fs[_0xa47a('0x62')](_0x42a7b9)){throw new db[(_0xa47a('0x6a'))][(_0xa47a('0x6b'))](_['upperFirst'](_0xa47a('0x59'))+_0xa47a('0x6c'));}return _0x2d62aa[_0xa47a('0x6d')](_0x42a7b9);}})[_0xa47a('0x28')](handleError(_0x2d62aa,null));};exports[_0xa47a('0x72')]=function(_0xae9719,_0x33b255){return db[_0xa47a('0x38')]['find']({'where':{'id':_0xae9719['params']['id']},'attributes':['securePassword']})[_0xa47a('0x1d')](respondWithResult(_0x33b255,null))[_0xa47a('0x28')](handleError(_0x33b255,null));};exports[_0xa47a('0x73')]=function(_0x53a200,_0x4b3aa1,_0x13dfd4){if(_0x53a200[_0xa47a('0x55')]&&_0x53a200[_0xa47a('0x55')][_0xa47a('0x56')]){_0x53a200[_0xa47a('0x53')][_0xa47a('0x5e')]=_0x53a200[_0xa47a('0x55')][_0xa47a('0x56')];}return db['Setting'][_0xa47a('0x57')]({'where':{'id':_0x53a200['params']['id']}})[_0xa47a('0x1d')](handleEntityNotFound(_0x4b3aa1,null))[_0xa47a('0x1d')](saveUpdates(_0x53a200[_0xa47a('0x53')],null))[_0xa47a('0x1d')](respondWithResult(_0x4b3aa1,null))[_0xa47a('0x28')](handleError(_0x4b3aa1,null));};var utilLicense=require('../../config/license/util');exports[_0xa47a('0x74')]=function(_0xaead1a,_0x1f59f4,_0x3a61f0){var _0x4a7c6a=_0xa47a('0x5b');var _0x1eeb4b={'custom':![]};return utilLicense[_0xa47a('0x5c')]()[_0xa47a('0x1d')](function(_0x6feb99){if(_0x6feb99){_0x1eeb4b=_0x6feb99;}return db[_0xa47a('0x38')][_0xa47a('0x57')]({'where':{'id':_0xaead1a[_0xa47a('0x50')]['id']},'attributes':[_0xa47a('0x5d'),_0xa47a('0x59'),_0xa47a('0x5e'),_0xa47a('0x5f'),'defaultLogo',_0xa47a('0x60'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa47a('0x1d')](handleEntityNotFound(_0x1f59f4,null))[_0xa47a('0x1d')](function(_0x12f443){if(_0x12f443){var _0x294293=_0x12f443['preferred']&&fs[_0xa47a('0x62')](path[_0xa47a('0x63')](config[_0xa47a('0x64')],_0x4a7c6a,_[_0xa47a('0x65')](_0x12f443[_0xa47a('0x5e')])))?path[_0xa47a('0x63')](config[_0xa47a('0x64')],_0x4a7c6a,_[_0xa47a('0x65')](_0x12f443[_0xa47a('0x5e')])):path['join'](config[_0xa47a('0x64')],_0x4a7c6a,_['toLower'](_0xa47a('0x75')));var _0x88d0da=_0xa47a('0x67')+_[_0xa47a('0x68')](_0xa47a('0x5e'));if(_0x12f443[_0x88d0da]||!_0x1eeb4b[_0xa47a('0x69')]||!_0x1eeb4b[_0xa47a('0x5e')]){_0x294293=path['join'](config[_0xa47a('0x64')],_0x4a7c6a,_[_0xa47a('0x65')](_0xa47a('0x75')));}if(!fs[_0xa47a('0x62')](_0x294293)){throw new db[(_0xa47a('0x6a'))]['ValidationError'](_[_0xa47a('0x68')](_0xa47a('0x5e'))+_0xa47a('0x6c'));}return _0x1f59f4[_0xa47a('0x6d')](_0x294293);}})[_0xa47a('0x28')](handleError(_0x1f59f4,null));};exports[_0xa47a('0x76')]=function(_0x52b01e,_0x24fbe5,_0x109539){if(_0x52b01e['file']&&_0x52b01e[_0xa47a('0x55')][_0xa47a('0x56')]){_0x52b01e[_0xa47a('0x53')][_0xa47a('0x5f')]=_0x52b01e[_0xa47a('0x55')][_0xa47a('0x56')];}return db['Setting'][_0xa47a('0x57')]({'where':{'id':_0x52b01e[_0xa47a('0x50')]['id']}})['then'](handleEntityNotFound(_0x24fbe5,null))[_0xa47a('0x1d')](saveUpdates(_0x52b01e[_0xa47a('0x53')],null))[_0xa47a('0x1d')](respondWithResult(_0x24fbe5,null))[_0xa47a('0x28')](handleError(_0x24fbe5,null));};var utilLicense=require('../../config/license/util');exports[_0xa47a('0x77')]=function(_0x2d69f,_0x2b73d5,_0x55d60a){var _0x23c405='server/files/images/logos';var _0x3ff479={'custom':![]};return utilLicense[_0xa47a('0x5c')]()[_0xa47a('0x1d')](function(_0x1fff6c){if(_0x1fff6c){_0x3ff479=_0x1fff6c;}return db['Setting'][_0xa47a('0x57')]({'where':{'id':_0x2d69f[_0xa47a('0x50')]['id']},'attributes':[_0xa47a('0x5d'),_0xa47a('0x59'),_0xa47a('0x5e'),_0xa47a('0x5f'),'defaultLogo',_0xa47a('0x60'),'defaultPreferred',_0xa47a('0x61')],'raw':!![]});})[_0xa47a('0x1d')](handleEntityNotFound(_0x2b73d5,null))['then'](function(_0x517e0b){if(_0x517e0b){var _0x535a87=_0x517e0b['favicon']&&fs[_0xa47a('0x62')](path[_0xa47a('0x63')](config['root'],_0x23c405,_[_0xa47a('0x65')](_0x517e0b[_0xa47a('0x5f')])))?path[_0xa47a('0x63')](config[_0xa47a('0x64')],_0x23c405,_[_0xa47a('0x65')](_0x517e0b['favicon'])):path[_0xa47a('0x63')](config['root'],_0x23c405,_['toLower'](_0xa47a('0x78')));var _0x32f1b9=_0xa47a('0x67')+_[_0xa47a('0x68')](_0xa47a('0x5f'));if(_0x517e0b[_0x32f1b9]||!_0x3ff479['custom']){_0x535a87=path[_0xa47a('0x63')](config[_0xa47a('0x64')],_0x23c405,_[_0xa47a('0x65')](_0xa47a('0x78')));}if(!fs['existsSync'](_0x535a87)){throw new db[(_0xa47a('0x6a'))][(_0xa47a('0x6b'))](_[_0xa47a('0x68')](_0xa47a('0x5f'))+_0xa47a('0x6c'));}return _0x2b73d5[_0xa47a('0x6d')](_0x535a87);}})[_0xa47a('0x28')](handleError(_0x2b73d5,null));};exports[_0xa47a('0x79')]=function(_0x198f8e,_0x292676){var _0x184981={'offset':moment()[_0xa47a('0x7a')]()};_0x184981[_0xa47a('0x7b')]=moment()[_0xa47a('0x7a')](_0x184981['offset'])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x292676['status'](0xc8)[_0xa47a('0x36')](_0x184981);}; \ No newline at end of file +var _0x6ddd=['where','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','toLower','root','join','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','existsSync','default_loginLogo.svg','default','securePassword','addPreferred','preferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','end','name','send','map','Setting','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter'];(function(_0x2c4542,_0x1af293){var _0x178c28=function(_0x4fbc72){while(--_0x4fbc72){_0x2c4542['push'](_0x2c4542['shift']());}};_0x178c28(++_0x1af293);}(_0x6ddd,0xae));var _0xd6dd=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6ddd[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd6dd('0x0'));var jsonpatch=require(_0xd6dd('0x1'));var rp=require(_0xd6dd('0x2'));var moment=require(_0xd6dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd6dd('0x4'));var util=require('util');var path=require(_0xd6dd('0x5'));var sox=require('sox');var csv=require(_0xd6dd('0x6'));var ejs=require(_0xd6dd('0x7'));var fs=require('fs');var fs_extra=require(_0xd6dd('0x8'));var _=require('lodash');var squel=require(_0xd6dd('0x9'));var crypto=require(_0xd6dd('0xa'));var jsforce=require(_0xd6dd('0xb'));var deskjs=require(_0xd6dd('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd6dd('0xd'));var Papa=require(_0xd6dd('0xe'));var Redis=require(_0xd6dd('0xf'));var authService=require(_0xd6dd('0x10'));var qs=require(_0xd6dd('0x11'));var as=require(_0xd6dd('0x12'));var hardwareService=require(_0xd6dd('0x13'));var logger=require(_0xd6dd('0x14'))(_0xd6dd('0x15'));var utils=require(_0xd6dd('0x16'));var config=require(_0xd6dd('0x17'));var licenseUtil=require(_0xd6dd('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd6dd('0x19'));var client=jayson[_0xd6dd('0x1a')][_0xd6dd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x19bdc1,_0x304f44,_0x11f224,_0x302760){return new BPromise(function(_0x550953,_0x305928){var _0x40db91=_0x302760||client;return _0x40db91[_0xd6dd('0x1c')](_0x19bdc1,_0x11f224)[_0xd6dd('0x1d')](function(_0x3381e9){logger[_0xd6dd('0x1e')](_0xd6dd('0x1f'),_0x304f44,_0xd6dd('0x20'));logger[_0xd6dd('0x21')](_0xd6dd('0x22'),_0x304f44,_0xd6dd('0x20'),JSON[_0xd6dd('0x23')](_0x3381e9));if(_0x3381e9['error']){if(_0x3381e9[_0xd6dd('0x24')][_0xd6dd('0x25')]===0x1f4){logger[_0xd6dd('0x24')](_0xd6dd('0x1f'),_0x304f44,_0x3381e9['error']['message']);return _0x305928(_0x3381e9[_0xd6dd('0x24')][_0xd6dd('0x26')]);}logger['error'](_0xd6dd('0x1f'),_0x304f44,_0x3381e9[_0xd6dd('0x24')]['message']);return _0x550953(_0x3381e9[_0xd6dd('0x24')][_0xd6dd('0x26')]);}else{logger[_0xd6dd('0x1e')]('Setting,\x20%s,\x20%s',_0x304f44,_0xd6dd('0x20'));_0x550953(_0x3381e9[_0xd6dd('0x27')][_0xd6dd('0x26')]);}})['catch'](function(_0x436dd0){logger[_0xd6dd('0x24')](_0xd6dd('0x1f'),_0x304f44,_0x436dd0);_0x305928(_0x436dd0);});});}function respondWithStatusCode(_0x1b9275,_0x23d5bc){_0x23d5bc=_0x23d5bc||0xcc;return function(_0x33f40b){if(_0x33f40b){return _0x1b9275[_0xd6dd('0x28')](_0x23d5bc);}return _0x1b9275['status'](_0x23d5bc)['end']();};}function respondWithResult(_0x284a95,_0x48c31a){_0x48c31a=_0x48c31a||0xc8;return function(_0x5be1c6){if(_0x5be1c6){return _0x284a95['status'](_0x48c31a)[_0xd6dd('0x29')](_0x5be1c6);}};}function respondWithFilteredResult(_0x4a03a5,_0x5274fe){return function(_0x5b6424){if(_0x5b6424){var _0x2a2253=typeof _0x5274fe[_0xd6dd('0x2a')]===_0xd6dd('0x2b')&&typeof _0x5274fe[_0xd6dd('0x2c')]===_0xd6dd('0x2b');var _0x315e97=_0x5b6424['count'];var _0x108c10=_0x2a2253?0x0:_0x5274fe['offset'];var _0x336ec7=_0x2a2253?_0x5b6424[_0xd6dd('0x2d')]:_0x5274fe[_0xd6dd('0x2a')]+_0x5274fe[_0xd6dd('0x2c')];var _0x1a0c49;if(_0x336ec7>=_0x315e97){_0x336ec7=_0x315e97;_0x1a0c49=0xc8;}else{_0x1a0c49=0xce;}_0x4a03a5[_0xd6dd('0x2e')](_0x1a0c49);return _0x4a03a5[_0xd6dd('0x2f')](_0xd6dd('0x30'),_0x108c10+'-'+_0x336ec7+'/'+_0x315e97)[_0xd6dd('0x29')](_0x5b6424);}return null;};}function patchUpdates(_0x17e11c){return function(_0x5aa9c0){try{jsonpatch[_0xd6dd('0x31')](_0x5aa9c0,_0x17e11c,!![]);}catch(_0x46348c){return BPromise[_0xd6dd('0x32')](_0x46348c);}return _0x5aa9c0[_0xd6dd('0x33')]();};}function saveUpdates(_0x2a5a73,_0x5ef0bc){return function(_0x590da5){if(_0x590da5){return _0x590da5[_0xd6dd('0x34')](_0x2a5a73)[_0xd6dd('0x1d')](function(_0x3c7c86){return _0x3c7c86;});}return null;};}function removeEntity(_0x157de2,_0x2f1322){return function(_0x166b39){if(_0x166b39){return _0x166b39[_0xd6dd('0x35')]()[_0xd6dd('0x1d')](function(){_0x157de2['status'](0xcc)[_0xd6dd('0x36')]();});}};}function handleEntityNotFound(_0x177fad,_0x30535c){return function(_0xdc693a){if(!_0xdc693a){_0x177fad[_0xd6dd('0x28')](0x194);}return _0xdc693a;};}function handleError(_0x470b9b,_0x69c01d){_0x69c01d=_0x69c01d||0x1f4;return function(_0x59b93e){logger[_0xd6dd('0x24')](_0x59b93e['stack']);if(_0x59b93e[_0xd6dd('0x37')]){delete _0x59b93e['name'];}_0x470b9b[_0xd6dd('0x2e')](_0x69c01d)[_0xd6dd('0x38')](_0x59b93e);};}exports['index']=function(_0x3abd50,_0x2fa2ee){var _0x52141d={},_0x4f6c79={},_0x470bd2={'count':0x0,'rows':[]};var _0xecfa70=_[_0xd6dd('0x39')](db[_0xd6dd('0x3a')][_0xd6dd('0x3b')],function(_0x4b7a53){return{'name':_0x4b7a53['fieldName'],'type':_0x4b7a53[_0xd6dd('0x3c')][_0xd6dd('0x3d')]};});_0x4f6c79[_0xd6dd('0x3e')]=_[_0xd6dd('0x39')](_0xecfa70,_0xd6dd('0x37'));_0x4f6c79[_0xd6dd('0x3f')]=_['keys'](_0x3abd50[_0xd6dd('0x3f')]);_0x4f6c79['filters']=_['intersection'](_0x4f6c79[_0xd6dd('0x3e')],_0x4f6c79[_0xd6dd('0x3f')]);_0x52141d[_0xd6dd('0x40')]=_[_0xd6dd('0x41')](_0x4f6c79[_0xd6dd('0x3e')],qs[_0xd6dd('0x42')](_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x42')]));_0x52141d['attributes']=_0x52141d[_0xd6dd('0x40')][_0xd6dd('0x43')]?_0x52141d[_0xd6dd('0x40')]:_0x4f6c79[_0xd6dd('0x3e')];if(!_0x3abd50['query'][_0xd6dd('0x44')](_0xd6dd('0x45'))){_0x52141d['limit']=qs[_0xd6dd('0x2c')](_0x3abd50['query'][_0xd6dd('0x2c')]);_0x52141d[_0xd6dd('0x2a')]=qs['offset'](_0x3abd50['query'][_0xd6dd('0x2a')]);}_0x52141d['order']=qs[_0xd6dd('0x46')](_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x46')]);_0x52141d['where']=qs['filters'](_[_0xd6dd('0x47')](_0x3abd50[_0xd6dd('0x3f')],_0x4f6c79[_0xd6dd('0x48')]),_0xecfa70);if(_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x49')]){_0x52141d[_0xd6dd('0x4a')]=_[_0xd6dd('0x4b')](_0x52141d['where'],{'$or':_[_0xd6dd('0x39')](_0xecfa70,function(_0x5d5d2c){if(_0x5d5d2c[_0xd6dd('0x3c')]!=='VIRTUAL'){var _0x413fd7={};_0x413fd7[_0x5d5d2c[_0xd6dd('0x37')]]={'$like':'%'+_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x49')]+'%'};return _0x413fd7;}})});}_0x52141d=_[_0xd6dd('0x4b')]({},_0x52141d,_0x3abd50[_0xd6dd('0x4c')]);var _0x1aab46={'where':_0x52141d[_0xd6dd('0x4a')]};return db['Setting'][_0xd6dd('0x2d')](_0x1aab46)[_0xd6dd('0x1d')](function(_0x46f600){_0x470bd2['count']=_0x46f600;if(_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x4d')]){_0x52141d[_0xd6dd('0x4e')]=[{'all':!![]}];}return db['Setting'][_0xd6dd('0x4f')](_0x52141d);})[_0xd6dd('0x1d')](function(_0x3ca93f){_0x470bd2[_0xd6dd('0x50')]=_0x3ca93f;return _0x470bd2;})[_0xd6dd('0x1d')](respondWithFilteredResult(_0x2fa2ee,_0x52141d))[_0xd6dd('0x51')](handleError(_0x2fa2ee,null));};exports['show']=function(_0x2fb3df,_0x14d15d){var _0x36befa={'raw':![],'where':{'id':_0x2fb3df[_0xd6dd('0x52')]['id']}},_0x9de2ea={};_0x9de2ea['model']=_[_0xd6dd('0x53')](db[_0xd6dd('0x3a')]['rawAttributes']);_0x9de2ea[_0xd6dd('0x3f')]=_[_0xd6dd('0x53')](_0x2fb3df[_0xd6dd('0x3f')]);_0x9de2ea['filters']=_[_0xd6dd('0x41')](_0x9de2ea[_0xd6dd('0x3e')],_0x9de2ea[_0xd6dd('0x3f')]);_0x36befa[_0xd6dd('0x40')]=_[_0xd6dd('0x41')](_0x9de2ea['model'],qs[_0xd6dd('0x42')](_0x2fb3df['query']['fields']));_0x36befa[_0xd6dd('0x40')]=_0x36befa[_0xd6dd('0x40')][_0xd6dd('0x43')]?_0x36befa[_0xd6dd('0x40')]:_0x9de2ea[_0xd6dd('0x3e')];if(_0x2fb3df['query']['includeAll']){_0x36befa[_0xd6dd('0x4e')]=[{'all':!![]}];}_0x36befa=_[_0xd6dd('0x4b')]({},_0x36befa,_0x2fb3df['options']);return db[_0xd6dd('0x3a')][_0xd6dd('0x54')](_0x36befa)[_0xd6dd('0x1d')](handleEntityNotFound(_0x14d15d,null))[_0xd6dd('0x1d')](respondWithResult(_0x14d15d,null))['catch'](handleError(_0x14d15d,null));};exports[_0xd6dd('0x34')]=function(_0x3348e4,_0x93fbd8){if(_0x3348e4[_0xd6dd('0x55')]['id']){delete _0x3348e4[_0xd6dd('0x55')]['id'];}return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x3348e4[_0xd6dd('0x52')]['id']}})['then'](handleEntityNotFound(_0x93fbd8,null))[_0xd6dd('0x1d')](saveUpdates(_0x3348e4[_0xd6dd('0x55')],null))['then'](respondWithResult(_0x93fbd8,null))[_0xd6dd('0x51')](handleError(_0x93fbd8,null));};exports[_0xd6dd('0x56')]=function(_0x287610,_0x5623dd,_0x4ebb58){if(_0x287610[_0xd6dd('0x57')]&&_0x287610['file'][_0xd6dd('0x58')]){_0x287610[_0xd6dd('0x55')][_0xd6dd('0x59')]=_0x287610['file'][_0xd6dd('0x58')];}return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x287610[_0xd6dd('0x52')]['id']}})[_0xd6dd('0x1d')](handleEntityNotFound(_0x5623dd,null))[_0xd6dd('0x1d')](saveUpdates(_0x287610[_0xd6dd('0x55')],null))[_0xd6dd('0x1d')](respondWithResult(_0x5623dd,null))[_0xd6dd('0x51')](handleError(_0x5623dd,null));};exports[_0xd6dd('0x5a')]=function(_0x51b96b,_0x37ff51,_0x1e6ba0){if(_0x51b96b[_0xd6dd('0x57')]&&_0x51b96b[_0xd6dd('0x57')]['filename']){_0x51b96b['body'][_0xd6dd('0x5b')]=_0x51b96b['file'][_0xd6dd('0x58')];}return db['Setting']['find']({'where':{'id':_0x51b96b[_0xd6dd('0x52')]['id']}})[_0xd6dd('0x1d')](handleEntityNotFound(_0x37ff51,null))[_0xd6dd('0x1d')](saveUpdates(_0x51b96b[_0xd6dd('0x55')],null))['then'](respondWithResult(_0x37ff51,null))['catch'](handleError(_0x37ff51,null));};var utilLicense=require(_0xd6dd('0x18'));exports['getLogo']=function(_0x54abb3,_0x54bafe,_0x5bca41){var _0x265fef=_0xd6dd('0x5c');var _0x2e19c6={'custom':![]};return utilLicense[_0xd6dd('0x5d')]()[_0xd6dd('0x1d')](function(_0x25eca3){if(_0x25eca3){_0x2e19c6=_0x25eca3;}return db['Setting'][_0xd6dd('0x54')]({'where':{'id':_0x54abb3[_0xd6dd('0x52')]['id']},'attributes':[_0xd6dd('0x59'),_0xd6dd('0x5b'),'preferred',_0xd6dd('0x5e'),_0xd6dd('0x5f'),_0xd6dd('0x60'),_0xd6dd('0x61'),_0xd6dd('0x62')],'raw':!![]});})[_0xd6dd('0x1d')](handleEntityNotFound(_0x54bafe,null))[_0xd6dd('0x1d')](function(_0x40ad0f){if(_0x40ad0f){var _0x1103bc=_0x40ad0f[_0xd6dd('0x59')]&&fs['existsSync'](path['join'](config['root'],_0x265fef,_[_0xd6dd('0x63')](_0x40ad0f[_0xd6dd('0x59')])))?path['join'](config[_0xd6dd('0x64')],_0x265fef,_[_0xd6dd('0x63')](_0x40ad0f['logo'])):path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x265fef,_[_0xd6dd('0x63')](_0xd6dd('0x66')));var _0x2b1b4e='default'+_[_0xd6dd('0x67')](_0xd6dd('0x59'));if(_0x40ad0f[_0x2b1b4e]||!_0x2e19c6[_0xd6dd('0x68')]){_0x1103bc=path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x265fef,_['toLower'](_0xd6dd('0x66')));}if(!fs['existsSync'](_0x1103bc)){throw new db[(_0xd6dd('0x69'))][(_0xd6dd('0x6a'))](_[_0xd6dd('0x67')](_0xd6dd('0x59'))+_0xd6dd('0x6b'));}return _0x54bafe[_0xd6dd('0x6c')](_0x1103bc);}})[_0xd6dd('0x51')](handleError(_0x54bafe,null));};var utilLicense=require(_0xd6dd('0x18'));exports[_0xd6dd('0x6d')]=function(_0xbca4b3,_0xb8bfe6,_0x527b1b){var _0x5b2d42=_0xd6dd('0x5c');var _0x3282ee={'custom':![]};return utilLicense['getLicense']()[_0xd6dd('0x1d')](function(_0xf82af0){if(_0xf82af0){_0x3282ee=_0xf82af0;}return db['Setting'][_0xd6dd('0x54')]({'where':{'id':_0xbca4b3[_0xd6dd('0x52')]['id']},'attributes':[_0xd6dd('0x59'),_0xd6dd('0x5b'),'preferred',_0xd6dd('0x5e'),_0xd6dd('0x5f'),_0xd6dd('0x60'),_0xd6dd('0x61'),_0xd6dd('0x62')],'raw':!![]});})[_0xd6dd('0x1d')](handleEntityNotFound(_0xb8bfe6,null))[_0xd6dd('0x1d')](function(_0x5e6ab7){if(_0x5e6ab7){var _0x40b30b=_0x5e6ab7[_0xd6dd('0x5b')]&&fs[_0xd6dd('0x6e')](path[_0xd6dd('0x65')](config['root'],_0x5b2d42,_[_0xd6dd('0x63')](_0x5e6ab7[_0xd6dd('0x5b')])))?path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x5b2d42,_['toLower'](_0x5e6ab7[_0xd6dd('0x5b')])):path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x5b2d42,_['toLower'](_0xd6dd('0x6f')));var _0x47289f=_0xd6dd('0x70')+_[_0xd6dd('0x67')]('loginLogo');if(_0x5e6ab7[_0x47289f]||!_0x3282ee[_0xd6dd('0x68')]){_0x40b30b=path[_0xd6dd('0x65')](config['root'],_0x5b2d42,_[_0xd6dd('0x63')](_0xd6dd('0x6f')));}if(!fs['existsSync'](_0x40b30b)){throw new db[(_0xd6dd('0x69'))][(_0xd6dd('0x6a'))](_[_0xd6dd('0x67')](_0xd6dd('0x5b'))+_0xd6dd('0x6b'));}return _0xb8bfe6[_0xd6dd('0x6c')](_0x40b30b);}})[_0xd6dd('0x51')](handleError(_0xb8bfe6,null));};exports['gdpr']=function(_0x4e9562,_0x3cd9e9){return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x4e9562[_0xd6dd('0x52')]['id']},'attributes':[_0xd6dd('0x71')]})['then'](respondWithResult(_0x3cd9e9,null))[_0xd6dd('0x51')](handleError(_0x3cd9e9,null));};exports[_0xd6dd('0x72')]=function(_0x3acf65,_0x985f41,_0x44bdd0){if(_0x3acf65['file']&&_0x3acf65[_0xd6dd('0x57')][_0xd6dd('0x58')]){_0x3acf65[_0xd6dd('0x55')][_0xd6dd('0x73')]=_0x3acf65['file'][_0xd6dd('0x58')];}return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x3acf65[_0xd6dd('0x52')]['id']}})[_0xd6dd('0x1d')](handleEntityNotFound(_0x985f41,null))[_0xd6dd('0x1d')](saveUpdates(_0x3acf65[_0xd6dd('0x55')],null))[_0xd6dd('0x1d')](respondWithResult(_0x985f41,null))[_0xd6dd('0x51')](handleError(_0x985f41,null));};var utilLicense=require(_0xd6dd('0x18'));exports['getPreferred']=function(_0x9eea8,_0x42ad31,_0x169e7c){var _0x3167b4=_0xd6dd('0x5c');var _0x543411={'custom':![]};return utilLicense[_0xd6dd('0x5d')]()[_0xd6dd('0x1d')](function(_0x108690){if(_0x108690){_0x543411=_0x108690;}return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x9eea8['params']['id']},'attributes':['logo','loginLogo','preferred',_0xd6dd('0x5e'),_0xd6dd('0x5f'),'defaultLoginLogo',_0xd6dd('0x61'),'defaultFavicon'],'raw':!![]});})[_0xd6dd('0x1d')](handleEntityNotFound(_0x42ad31,null))[_0xd6dd('0x1d')](function(_0x5e376b){if(_0x5e376b){var _0x2abb0b=_0x5e376b[_0xd6dd('0x73')]&&fs[_0xd6dd('0x6e')](path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x3167b4,_[_0xd6dd('0x63')](_0x5e376b[_0xd6dd('0x73')])))?path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x3167b4,_['toLower'](_0x5e376b[_0xd6dd('0x73')])):path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x3167b4,_[_0xd6dd('0x63')](_0xd6dd('0x74')));var _0x3f907b='default'+_[_0xd6dd('0x67')](_0xd6dd('0x73'));if(_0x5e376b[_0x3f907b]||!_0x543411[_0xd6dd('0x68')]||!_0x543411[_0xd6dd('0x73')]){_0x2abb0b=path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x3167b4,_['toLower']('default_preferred.png'));}if(!fs[_0xd6dd('0x6e')](_0x2abb0b)){throw new db[(_0xd6dd('0x69'))][(_0xd6dd('0x6a'))](_[_0xd6dd('0x67')](_0xd6dd('0x73'))+_0xd6dd('0x6b'));}return _0x42ad31[_0xd6dd('0x6c')](_0x2abb0b);}})['catch'](handleError(_0x42ad31,null));};exports[_0xd6dd('0x75')]=function(_0xff18bd,_0x3d4448,_0x1d781d){if(_0xff18bd['file']&&_0xff18bd[_0xd6dd('0x57')]['filename']){_0xff18bd[_0xd6dd('0x55')]['favicon']=_0xff18bd[_0xd6dd('0x57')]['filename'];}return db['Setting']['find']({'where':{'id':_0xff18bd[_0xd6dd('0x52')]['id']}})[_0xd6dd('0x1d')](handleEntityNotFound(_0x3d4448,null))[_0xd6dd('0x1d')](saveUpdates(_0xff18bd[_0xd6dd('0x55')],null))[_0xd6dd('0x1d')](respondWithResult(_0x3d4448,null))['catch'](handleError(_0x3d4448,null));};var utilLicense=require(_0xd6dd('0x18'));exports[_0xd6dd('0x76')]=function(_0x897466,_0x169550,_0x33029f){var _0x4701ea=_0xd6dd('0x5c');var _0x542a7d={'custom':![]};return utilLicense['getLicense']()[_0xd6dd('0x1d')](function(_0x17cc70){if(_0x17cc70){_0x542a7d=_0x17cc70;}return db['Setting'][_0xd6dd('0x54')]({'where':{'id':_0x897466[_0xd6dd('0x52')]['id']},'attributes':[_0xd6dd('0x59'),_0xd6dd('0x5b'),'preferred',_0xd6dd('0x5e'),_0xd6dd('0x5f'),_0xd6dd('0x60'),_0xd6dd('0x61'),_0xd6dd('0x62')],'raw':!![]});})[_0xd6dd('0x1d')](handleEntityNotFound(_0x169550,null))['then'](function(_0x1e60b1){if(_0x1e60b1){var _0x38b0e0=_0x1e60b1[_0xd6dd('0x5e')]&&fs[_0xd6dd('0x6e')](path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x4701ea,_[_0xd6dd('0x63')](_0x1e60b1['favicon'])))?path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x4701ea,_['toLower'](_0x1e60b1[_0xd6dd('0x5e')])):path['join'](config[_0xd6dd('0x64')],_0x4701ea,_[_0xd6dd('0x63')](_0xd6dd('0x77')));var _0x33adbb=_0xd6dd('0x70')+_[_0xd6dd('0x67')]('favicon');if(_0x1e60b1[_0x33adbb]||!_0x542a7d[_0xd6dd('0x68')]){_0x38b0e0=path[_0xd6dd('0x65')](config['root'],_0x4701ea,_['toLower'](_0xd6dd('0x77')));}if(!fs[_0xd6dd('0x6e')](_0x38b0e0)){throw new db[(_0xd6dd('0x69'))][(_0xd6dd('0x6a'))](_[_0xd6dd('0x67')]('favicon')+_0xd6dd('0x6b'));}return _0x169550[_0xd6dd('0x6c')](_0x38b0e0);}})[_0xd6dd('0x51')](handleError(_0x169550,null));};exports[_0xd6dd('0x78')]=function(_0x599213,_0x581635){var _0x5a5d2c={'offset':moment()['utcOffset']()};_0x5a5d2c[_0xd6dd('0x79')]=moment()[_0xd6dd('0x7a')](_0x5a5d2c[_0xd6dd('0x2a')])[_0xd6dd('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x581635[_0xd6dd('0x2e')](0xc8)[_0xd6dd('0x38')](_0x5a5d2c);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 680869f..4586922 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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x321df4,_0x3efec5){var _0x50d06c=function(_0x3ac0f4){while(--_0x3ac0f4){_0x321df4['push'](_0x321df4['shift']());}};_0x50d06c(++_0x3efec5);}(_0x3e74,0x175));var _0x43e7=function(_0x2e0890,_0x5733bc){_0x2e0890=_0x2e0890-0x0;var _0x726ed0=_0x3e74[_0x2e0890];return _0x726ed0;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x7217,0x19e));var _0x7721=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x7217[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f2b2b8d..f3ee209 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 _0x0082=['info','ShowSetting','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','Setting','options','include','model','attributes','map'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0x0082,0x111));var _0x2008=function(_0x14e6eb,_0x12864f){_0x14e6eb=_0x14e6eb-0x0;var _0x517ddf=_0x0082[_0x14e6eb];return _0x517ddf;};'use strict';var _=require(_0x2008('0x0'));var util=require('util');var moment=require(_0x2008('0x1'));var BPromise=require(_0x2008('0x2'));var rs=require(_0x2008('0x3'));var fs=require('fs');var Redis=require(_0x2008('0x4'));var db=require(_0x2008('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2008('0x6'))(_0x2008('0x7'));var config=require(_0x2008('0x8'));var jayson=require(_0x2008('0x9'));var client=jayson[_0x2008('0xa')][_0x2008('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36c8be,_0x1f980d,_0x22c74a){return new BPromise(function(_0x396df8,_0x6c83b6){return client['request'](_0x36c8be,_0x22c74a)[_0x2008('0xc')](function(_0x5a74ce){logger['info'](_0x2008('0xd'),_0x1f980d,'request\x20sent');logger[_0x2008('0xe')](_0x2008('0xf'),_0x1f980d,_0x2008('0x10'),JSON['stringify'](_0x5a74ce));if(_0x5a74ce[_0x2008('0x11')]){if(_0x5a74ce[_0x2008('0x11')]['code']===0x1f4){logger['error'](_0x2008('0xd'),_0x1f980d,_0x5a74ce[_0x2008('0x11')][_0x2008('0x12')]);return _0x6c83b6(_0x5a74ce[_0x2008('0x11')][_0x2008('0x12')]);}logger[_0x2008('0x11')](_0x2008('0xd'),_0x1f980d,_0x5a74ce[_0x2008('0x11')]['message']);return _0x396df8(_0x5a74ce['error'][_0x2008('0x12')]);}else{logger['info'](_0x2008('0xd'),_0x1f980d,_0x2008('0x10'));_0x396df8(_0x5a74ce[_0x2008('0x13')][_0x2008('0x12')]);}})[_0x2008('0x14')](function(_0x41b2d1){logger[_0x2008('0x11')](_0x2008('0xd'),_0x1f980d,_0x41b2d1);_0x6c83b6(_0x41b2d1);});});}exports['ShowSetting']=function(_0x397a92){var _0x18da16=this;return new Promise(function(_0x240f1f,_0x47c929){return db[_0x2008('0x15')]['find']({'raw':_0x397a92[_0x2008('0x16')]?_0x397a92[_0x2008('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x397a92[_0x2008('0x16')]?_0x397a92[_0x2008('0x16')]['where']||null:null,'attributes':_0x397a92['options']?_0x397a92[_0x2008('0x16')]['attributes']||null:null,'include':_0x397a92[_0x2008('0x16')]?_0x397a92[_0x2008('0x16')][_0x2008('0x17')]?_['map'](_0x397a92['options'][_0x2008('0x17')],function(_0x1e0f5c){return{'model':db[_0x1e0f5c[_0x2008('0x18')]],'as':_0x1e0f5c['as'],'attributes':_0x1e0f5c[_0x2008('0x19')],'include':_0x1e0f5c[_0x2008('0x17')]?_['map'](_0x1e0f5c[_0x2008('0x17')],function(_0xc9ada5){return{'model':db[_0xc9ada5[_0x2008('0x18')]],'as':_0xc9ada5['as'],'attributes':_0xc9ada5[_0x2008('0x19')],'include':_0xc9ada5[_0x2008('0x17')]?_[_0x2008('0x1a')](_0xc9ada5[_0x2008('0x17')],function(_0xf957cc){return{'model':db[_0xf957cc['model']],'as':_0xf957cc['as'],'attributes':_0xf957cc[_0x2008('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e0322){logger[_0x2008('0x1b')](_0x2008('0x1c'),_0x397a92);logger[_0x2008('0xe')](_0x2008('0x1c'),_0x397a92,JSON[_0x2008('0x1d')](_0x5e0322));_0x240f1f(_0x5e0322);})[_0x2008('0x14')](function(_0x632548){logger[_0x2008('0x11')](_0x2008('0x1c'),_0x632548[_0x2008('0x12')],_0x397a92);_0x47c929(_0x18da16[_0x2008('0x11')](0x1f4,_0x632548[_0x2008('0x12')]));});});}; \ No newline at end of file +var _0x35d6=['then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','ShowSetting','find','options','raw','where','attributes','include','map','model','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x30f797,_0x3ed32b){var _0x49723c=function(_0x10bdca){while(--_0x10bdca){_0x30f797['push'](_0x30f797['shift']());}};_0x49723c(++_0x3ed32b);}(_0x35d6,0x1e3));var _0x635d=function(_0x33416c,_0x475f62){_0x33416c=_0x33416c-0x0;var _0x52d193=_0x35d6[_0x33416c];return _0x52d193;};'use strict';var _=require('lodash');var util=require(_0x635d('0x0'));var moment=require(_0x635d('0x1'));var BPromise=require(_0x635d('0x2'));var rs=require(_0x635d('0x3'));var fs=require('fs');var Redis=require(_0x635d('0x4'));var db=require(_0x635d('0x5'))['db'];var utils=require(_0x635d('0x6'));var logger=require(_0x635d('0x7'))(_0x635d('0x8'));var config=require(_0x635d('0x9'));var jayson=require(_0x635d('0xa'));var client=jayson[_0x635d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x242ae5,_0x2de7e3,_0x48f9ad){return new BPromise(function(_0x3cfcd3,_0x320b5f){return client['request'](_0x242ae5,_0x48f9ad)[_0x635d('0xc')](function(_0x390fd8){logger[_0x635d('0xd')]('Setting,\x20%s,\x20%s',_0x2de7e3,_0x635d('0xe'));logger['debug'](_0x635d('0xf'),_0x2de7e3,_0x635d('0xe'),JSON[_0x635d('0x10')](_0x390fd8));if(_0x390fd8[_0x635d('0x11')]){if(_0x390fd8[_0x635d('0x11')][_0x635d('0x12')]===0x1f4){logger[_0x635d('0x11')]('Setting,\x20%s,\x20%s',_0x2de7e3,_0x390fd8[_0x635d('0x11')][_0x635d('0x13')]);return _0x320b5f(_0x390fd8[_0x635d('0x11')][_0x635d('0x13')]);}logger[_0x635d('0x11')](_0x635d('0x14'),_0x2de7e3,_0x390fd8[_0x635d('0x11')][_0x635d('0x13')]);return _0x3cfcd3(_0x390fd8[_0x635d('0x11')][_0x635d('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x2de7e3,'request\x20sent');_0x3cfcd3(_0x390fd8[_0x635d('0x15')][_0x635d('0x13')]);}})[_0x635d('0x16')](function(_0x287663){logger[_0x635d('0x11')](_0x635d('0x14'),_0x2de7e3,_0x287663);_0x320b5f(_0x287663);});});}exports[_0x635d('0x17')]=function(_0x29e7ee){var _0x47a8a4=this;return new Promise(function(_0x13ad33,_0x4692ba){return db['Setting'][_0x635d('0x18')]({'raw':_0x29e7ee[_0x635d('0x19')]?_0x29e7ee['options'][_0x635d('0x1a')]===undefined?!![]:![]:!![],'where':_0x29e7ee[_0x635d('0x19')]?_0x29e7ee[_0x635d('0x19')][_0x635d('0x1b')]||null:null,'attributes':_0x29e7ee[_0x635d('0x19')]?_0x29e7ee[_0x635d('0x19')][_0x635d('0x1c')]||null:null,'include':_0x29e7ee[_0x635d('0x19')]?_0x29e7ee['options'][_0x635d('0x1d')]?_[_0x635d('0x1e')](_0x29e7ee[_0x635d('0x19')][_0x635d('0x1d')],function(_0x1e2e6c){return{'model':db[_0x1e2e6c[_0x635d('0x1f')]],'as':_0x1e2e6c['as'],'attributes':_0x1e2e6c[_0x635d('0x1c')],'include':_0x1e2e6c[_0x635d('0x1d')]?_[_0x635d('0x1e')](_0x1e2e6c[_0x635d('0x1d')],function(_0x2c1233){return{'model':db[_0x2c1233[_0x635d('0x1f')]],'as':_0x2c1233['as'],'attributes':_0x2c1233[_0x635d('0x1c')],'include':_0x2c1233[_0x635d('0x1d')]?_['map'](_0x2c1233['include'],function(_0x1cd716){return{'model':db[_0x1cd716[_0x635d('0x1f')]],'as':_0x1cd716['as'],'attributes':_0x1cd716[_0x635d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x658d1b){logger[_0x635d('0xd')](_0x635d('0x17'),_0x29e7ee);logger[_0x635d('0x20')](_0x635d('0x17'),_0x29e7ee,JSON[_0x635d('0x10')](_0x658d1b));_0x13ad33(_0x658d1b);})['catch'](function(_0x13e989){logger['error']('ShowSetting',_0x13e989[_0x635d('0x13')],_0x29e7ee);_0x4692ba(_0x47a8a4['error'](0x1f4,_0x13e989[_0x635d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 041ee59..a3253fb 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x328305,_0x19098d){var _0xf0347=function(_0xa391c1){while(--_0xa391c1){_0x328305['push'](_0x328305['shift']());}};_0xf0347(++_0x19098d);}(_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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x2d7d06,_0x7cc9f3){var _0x59a463=function(_0x20d777){while(--_0x20d777){_0x2d7d06['push'](_0x2d7d06['shift']());}};_0x59a463(++_0x7cc9f3);}(_0x7a54,0x106));var _0x47a5=function(_0x42838b,_0x56c4b7){_0x42838b=_0x42838b-0x0;var _0x49b156=_0x7a54[_0x42838b];return _0x49b156;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 282653e..bef2c0d 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 _0xcf87=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','plivo','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xcf87,0x10d));var _0x7cf8=function(_0x1fccde,_0x135012){_0x1fccde=_0x1fccde-0x0;var _0x30ea0d=_0xcf87[_0x1fccde];return _0x30ea0d;};'use strict';var Sequelize=require(_0x7cf8('0x0'));var rs=require(_0x7cf8('0x1'));module[_0x7cf8('0x2')]={'name':{'type':Sequelize[_0x7cf8('0x3')],'unique':_0x7cf8('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x7cf8('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x7cf8('0x3')],'defaultValue':function(){return rs[_0x7cf8('0x5')]();}},'phone':{'type':Sequelize[_0x7cf8('0x3')]},'type':{'type':Sequelize[_0x7cf8('0x6')]('twilio',_0x7cf8('0x7'),_0x7cf8('0x8'),_0x7cf8('0x9'),_0x7cf8('0xa'),'clickatell','bandwidth',_0x7cf8('0xb'),_0x7cf8('0xc'),_0x7cf8('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x7cf8('0x3')]},'smsMethod':{'type':Sequelize[_0x7cf8('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x7cf8('0x3')]},'password':{'type':Sequelize[_0x7cf8('0x3')]},'apiKey':{'type':Sequelize[_0x7cf8('0x3')]},'applicationId':{'type':Sequelize[_0x7cf8('0x3')]},'accountId':{'type':Sequelize[_0x7cf8('0x3')]},'senderString':{'type':Sequelize[_0x7cf8('0x3')]},'deliveryReport':{'type':Sequelize[_0x7cf8('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x7cf8('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7cf8('0xf')],'defaultValue':function(){return _0x7cf8('0x10');}},'notificationSound':{'type':Sequelize[_0x7cf8('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7cf8('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7cf8('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7cf8('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7cf8('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7cf8('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7cf8('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7cf8('0x11')],'comment':_0x7cf8('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x7cf8('0xe')],'defaultValue':![],'comment':_0x7cf8('0x13'),'set':function(_0x33b668){if(!_0x33b668)this[_0x7cf8('0x14')]('mandatoryDispositionPauseId',null);this[_0x7cf8('0x14')](_0x7cf8('0x15'),_0x33b668);}}}; \ No newline at end of file +var _0x3aa0=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x369178,_0x5eb7bb){var _0x13e004=function(_0x3855f5){while(--_0x3855f5){_0x369178['push'](_0x369178['shift']());}};_0x13e004(++_0x5eb7bb);}(_0x3aa0,0x72));var _0x03aa=function(_0x24e2f7,_0x5c8bac){_0x24e2f7=_0x24e2f7-0x0;var _0x31232c=_0x3aa0[_0x24e2f7];return _0x31232c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x03aa('0x0'));module[_0x03aa('0x1')]={'name':{'type':Sequelize[_0x03aa('0x2')],'unique':_0x03aa('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x03aa('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x03aa('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x03aa('0x2')],'defaultValue':function(){return rs[_0x03aa('0x4')]();}},'phone':{'type':Sequelize[_0x03aa('0x2')]},'type':{'type':Sequelize[_0x03aa('0x5')](_0x03aa('0x6'),'skebby',_0x03aa('0x7'),'clicksend',_0x03aa('0x8'),_0x03aa('0x9'),_0x03aa('0xa'),_0x03aa('0xb'),_0x03aa('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x03aa('0x2')]},'authId':{'type':Sequelize[_0x03aa('0x2')]},'authToken':{'type':Sequelize[_0x03aa('0x2')]},'smsMethod':{'type':Sequelize[_0x03aa('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x03aa('0x2')]},'apiKey':{'type':Sequelize[_0x03aa('0x2')]},'applicationId':{'type':Sequelize[_0x03aa('0x2')]},'accountId':{'type':Sequelize[_0x03aa('0x2')]},'senderString':{'type':Sequelize[_0x03aa('0x2')]},'deliveryReport':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x03aa('0x2')]},'notificationTemplate':{'type':Sequelize[_0x03aa('0xe')],'defaultValue':function(){return _0x03aa('0xf');}},'notificationSound':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x03aa('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x03aa('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x03aa('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x03aa('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![],'comment':_0x03aa('0x12'),'set':function(_0x3b9e86){if(!_0x3b9e86)this['setDataValue'](_0x03aa('0x13'),null);this[_0x03aa('0x14')](_0x03aa('0x15'),_0x3b9e86);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index dd69d83..c945906 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 _0x0e76=['DELIVERED','connectel','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','UserProfileResource','stack','name','send','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','mandatoryDispositionPause','includeAll','find','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','length','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','updatedAt','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','text','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','waitForTheAssignedQueue','startRouting','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','DESC','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','groupName','clickatell','intelepeer','redif'];(function(_0x2394fd,_0x5e8f2b){var _0x4caa72=function(_0x294536){while(--_0x294536){_0x2394fd['push'](_0x2394fd['shift']());}};_0x4caa72(++_0x5e8f2b);}(_0x0e76,0x102));var _0x60e7=function(_0x28fbbf,_0x11f896){_0x28fbbf=_0x28fbbf-0x0;var _0x543af6=_0x0e76[_0x28fbbf];return _0x543af6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60e7('0x0'));var zipdir=require(_0x60e7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60e7('0x2'));var moment=require(_0x60e7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x60e7('0x4'));var util=require('util');var path=require(_0x60e7('0x5'));var sox=require(_0x60e7('0x6'));var csv=require('to-csv');var ejs=require(_0x60e7('0x7'));var fs=require('fs');var fs_extra=require(_0x60e7('0x8'));var _=require(_0x60e7('0x9'));var squel=require('squel');var crypto=require(_0x60e7('0xa'));var jsforce=require(_0x60e7('0xb'));var deskjs=require(_0x60e7('0xc'));var toCsv=require(_0x60e7('0xd'));var querystring=require(_0x60e7('0xe'));var Papa=require(_0x60e7('0xf'));var Redis=require(_0x60e7('0x10'));var authService=require(_0x60e7('0x11'));var qs=require(_0x60e7('0x12'));var as=require(_0x60e7('0x13'));var hardwareService=require(_0x60e7('0x14'));var logger=require(_0x60e7('0x15'))(_0x60e7('0x16'));var utils=require(_0x60e7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x60e7('0x18'));var db=require(_0x60e7('0x19'))['db'];config[_0x60e7('0x1a')]=_[_0x60e7('0x1b')](config[_0x60e7('0x1a')],{'host':_0x60e7('0x1c'),'port':0x18eb});var socket=require(_0x60e7('0x1d'))(new Redis(config[_0x60e7('0x1a')]));require(_0x60e7('0x1e'))[_0x60e7('0x1f')](socket);var jayson=require(_0x60e7('0x20'));var client=jayson[_0x60e7('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x589191,_0x230e9c,_0x219c5d,_0x58f604){return new BPromise(function(_0x464cd7,_0x549389){var _0x4188eb=_0x58f604||client;return _0x4188eb[_0x60e7('0x22')](_0x589191,_0x219c5d)['then'](function(_0x66a3dc){logger[_0x60e7('0x23')](_0x60e7('0x24'),_0x230e9c,_0x60e7('0x25'));logger['debug'](_0x60e7('0x26'),_0x230e9c,_0x60e7('0x25'),JSON[_0x60e7('0x27')](_0x66a3dc));if(_0x66a3dc['error']){if(_0x66a3dc[_0x60e7('0x28')][_0x60e7('0x29')]===0x1f4){logger[_0x60e7('0x28')](_0x60e7('0x24'),_0x230e9c,_0x66a3dc[_0x60e7('0x28')][_0x60e7('0x2a')]);return _0x549389(_0x66a3dc[_0x60e7('0x28')]['message']);}logger[_0x60e7('0x28')]('SmsAccount,\x20%s,\x20%s',_0x230e9c,_0x66a3dc[_0x60e7('0x28')][_0x60e7('0x2a')]);return _0x464cd7(_0x66a3dc[_0x60e7('0x28')][_0x60e7('0x2a')]);}else{logger[_0x60e7('0x23')](_0x60e7('0x24'),_0x230e9c,_0x60e7('0x25'));_0x464cd7(_0x66a3dc[_0x60e7('0x2b')][_0x60e7('0x2a')]);}})['catch'](function(_0x1ec157){logger[_0x60e7('0x28')](_0x60e7('0x24'),_0x230e9c,_0x1ec157);_0x549389(_0x1ec157);});});}function respondWithStatusCode(_0x1787dc,_0x655254){_0x655254=_0x655254||0xcc;return function(_0x4cba17){if(_0x4cba17){return _0x1787dc[_0x60e7('0x2c')](_0x655254);}return _0x1787dc[_0x60e7('0x2d')](_0x655254)[_0x60e7('0x2e')]();};}function respondWithResult(_0x49fc90,_0x5024f0){_0x5024f0=_0x5024f0||0xc8;return function(_0x34053b){if(_0x34053b){return _0x49fc90[_0x60e7('0x2d')](_0x5024f0)[_0x60e7('0x2f')](_0x34053b);}};}function respondWithFilteredResult(_0x18eead,_0x219d5b){return function(_0xde3fd4){if(_0xde3fd4){var _0x12ff24=typeof _0x219d5b[_0x60e7('0x30')]==='undefined'&&typeof _0x219d5b[_0x60e7('0x31')]===_0x60e7('0x32');var _0x4530ca=_0xde3fd4['count'];var _0x5c24f7=_0x12ff24?0x0:_0x219d5b[_0x60e7('0x30')];var _0x525d3c=_0x12ff24?_0xde3fd4[_0x60e7('0x33')]:_0x219d5b[_0x60e7('0x30')]+_0x219d5b[_0x60e7('0x31')];var _0x5a83ae;if(_0x525d3c>=_0x4530ca){_0x525d3c=_0x4530ca;_0x5a83ae=0xc8;}else{_0x5a83ae=0xce;}_0x18eead[_0x60e7('0x2d')](_0x5a83ae);return _0x18eead[_0x60e7('0x34')](_0x60e7('0x35'),_0x5c24f7+'-'+_0x525d3c+'/'+_0x4530ca)[_0x60e7('0x2f')](_0xde3fd4);}return null;};}function patchUpdates(_0x3e8b35){return function(_0x1bbb4a){try{jsonpatch[_0x60e7('0x36')](_0x1bbb4a,_0x3e8b35,!![]);}catch(_0x428e5e){return BPromise['reject'](_0x428e5e);}return _0x1bbb4a[_0x60e7('0x37')]();};}function saveUpdates(_0x53f71,_0xa81709){return function(_0x33a485){if(_0x33a485){return _0x33a485[_0x60e7('0x38')](_0x53f71)['then'](function(_0x2a30fe){return _0x2a30fe;});}return null;};}function removeEntity(_0x50e0a9,_0x36188e){return function(_0x2e4613){if(_0x2e4613){return _0x2e4613[_0x60e7('0x39')]()[_0x60e7('0x3a')](function(){var _0x5c4829=_0x2e4613['get']({'plain':!![]});var _0x51437f='SmsAccounts';return db[_0x60e7('0x3b')][_0x60e7('0x39')]({'where':{'type':_0x51437f,'resourceId':_0x5c4829['id']}})[_0x60e7('0x3a')](function(){return _0x2e4613;});})[_0x60e7('0x3a')](function(){_0x50e0a9[_0x60e7('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ea7c9,_0x316b96){return function(_0x21716f){if(!_0x21716f){_0x4ea7c9[_0x60e7('0x2c')](0x194);}return _0x21716f;};}function handleError(_0x16d19a,_0x3e63c8){_0x3e63c8=_0x3e63c8||0x1f4;return function(_0x3269f2){logger['error'](_0x3269f2[_0x60e7('0x3c')]);if(_0x3269f2['name']){delete _0x3269f2[_0x60e7('0x3d')];}_0x16d19a[_0x60e7('0x2d')](_0x3e63c8)[_0x60e7('0x3e')](_0x3269f2);};}exports[_0x60e7('0x3f')]=function(_0x448c55,_0x283c5f){var _0x2c8b1c={'include':[{'model':db[_0x60e7('0x40')],'as':'mandatoryDispositionPause'}]},_0x46f193={},_0x44ad03={'count':0x0,'rows':[]};var _0x430880=_[_0x60e7('0x41')](db[_0x60e7('0x42')][_0x60e7('0x43')],function(_0x442690){return{'name':_0x442690[_0x60e7('0x44')],'type':_0x442690[_0x60e7('0x45')][_0x60e7('0x46')]};});_0x46f193['model']=_[_0x60e7('0x41')](_0x430880,_0x60e7('0x3d'));_0x46f193[_0x60e7('0x47')]=_[_0x60e7('0x48')](_0x448c55[_0x60e7('0x47')]);_0x46f193[_0x60e7('0x49')]=_[_0x60e7('0x4a')](_0x46f193[_0x60e7('0x4b')],_0x46f193[_0x60e7('0x47')]);_0x2c8b1c[_0x60e7('0x4c')]=_[_0x60e7('0x4a')](_0x46f193[_0x60e7('0x4b')],qs[_0x60e7('0x4d')](_0x448c55[_0x60e7('0x47')][_0x60e7('0x4d')]));_0x2c8b1c[_0x60e7('0x4c')]=_0x2c8b1c[_0x60e7('0x4c')]['length']?_0x2c8b1c[_0x60e7('0x4c')]:_0x46f193[_0x60e7('0x4b')];if(!_0x448c55['query'][_0x60e7('0x4e')]('nolimit')){_0x2c8b1c[_0x60e7('0x31')]=qs[_0x60e7('0x31')](_0x448c55[_0x60e7('0x47')]['limit']);_0x2c8b1c[_0x60e7('0x30')]=qs['offset'](_0x448c55['query'][_0x60e7('0x30')]);}_0x2c8b1c[_0x60e7('0x4f')]=qs[_0x60e7('0x50')](_0x448c55[_0x60e7('0x47')][_0x60e7('0x50')]);_0x2c8b1c[_0x60e7('0x51')]=qs['filters'](_[_0x60e7('0x52')](_0x448c55[_0x60e7('0x47')],_0x46f193[_0x60e7('0x49')]),_0x430880);if(_0x448c55['query'][_0x60e7('0x53')]){_0x2c8b1c[_0x60e7('0x51')]=_[_0x60e7('0x54')](_0x2c8b1c['where'],{'$or':_['map'](_0x430880,function(_0x208a4b){if(_0x208a4b[_0x60e7('0x45')]!==_0x60e7('0x55')){var _0x17332e={};_0x17332e[_0x208a4b[_0x60e7('0x3d')]]={'$like':'%'+_0x448c55['query'][_0x60e7('0x53')]+'%'};return _0x17332e;}})});}_0x2c8b1c=_['merge']({},_0x2c8b1c,_0x448c55[_0x60e7('0x56')]);var _0x3ea19b={'where':_0x2c8b1c[_0x60e7('0x51')]};return db[_0x60e7('0x42')][_0x60e7('0x33')](_0x3ea19b)[_0x60e7('0x3a')](function(_0x2b94a0){_0x44ad03[_0x60e7('0x33')]=_0x2b94a0;if(_0x448c55['query']['includeAll']){_0x2c8b1c[_0x60e7('0x57')]=[{'all':!![]}];}return db['SmsAccount'][_0x60e7('0x58')](_0x2c8b1c);})[_0x60e7('0x3a')](function(_0x173ead){_0x44ad03[_0x60e7('0x59')]=_0x173ead;return _0x44ad03;})[_0x60e7('0x3a')](respondWithFilteredResult(_0x283c5f,_0x2c8b1c))[_0x60e7('0x5a')](handleError(_0x283c5f,null));};exports[_0x60e7('0x5b')]=function(_0x1fa6ac,_0x35c7b1){var _0x1e3703={'raw':![],'where':{'id':_0x1fa6ac[_0x60e7('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x60e7('0x5d')}]},_0xcac76e={};_0xcac76e[_0x60e7('0x4b')]=_['keys'](db[_0x60e7('0x42')][_0x60e7('0x43')]);_0xcac76e[_0x60e7('0x47')]=_[_0x60e7('0x48')](_0x1fa6ac['query']);_0xcac76e['filters']=_[_0x60e7('0x4a')](_0xcac76e[_0x60e7('0x4b')],_0xcac76e['query']);_0x1e3703[_0x60e7('0x4c')]=_[_0x60e7('0x4a')](_0xcac76e['model'],qs['fields'](_0x1fa6ac[_0x60e7('0x47')][_0x60e7('0x4d')]));_0x1e3703['attributes']=_0x1e3703[_0x60e7('0x4c')]['length']?_0x1e3703[_0x60e7('0x4c')]:_0xcac76e[_0x60e7('0x4b')];if(_0x1fa6ac['query'][_0x60e7('0x5e')]){_0x1e3703[_0x60e7('0x57')]=[{'all':!![]}];}_0x1e3703=_[_0x60e7('0x54')]({},_0x1e3703,_0x1fa6ac['options']);return db[_0x60e7('0x42')][_0x60e7('0x5f')](_0x1e3703)[_0x60e7('0x3a')](handleEntityNotFound(_0x35c7b1,null))[_0x60e7('0x3a')](respondWithResult(_0x35c7b1,null))[_0x60e7('0x5a')](handleError(_0x35c7b1,null));};exports['create']=function(_0x403abf,_0x657c){return db[_0x60e7('0x42')][_0x60e7('0x60')](_0x403abf[_0x60e7('0x61')],{})[_0x60e7('0x3a')](function(_0xf7c448){var _0xf20385=_0x403abf[_0x60e7('0x62')]['get']({'plain':!![]});if(!_0xf20385)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf20385['role']===_0x60e7('0x62')){var _0x18f0b9=_0xf7c448[_0x60e7('0x63')]({'plain':!![]});var _0x3a8ced='SmsAccounts';return db[_0x60e7('0x64')]['find']({'where':{'name':_0x3a8ced,'userProfileId':_0xf20385['userProfileId']},'raw':!![]})[_0x60e7('0x3a')](function(_0x4ded24){if(_0x4ded24&&_0x4ded24[_0x60e7('0x65')]===0x0){return db['UserProfileResource'][_0x60e7('0x60')]({'name':_0x18f0b9['name'],'resourceId':_0x18f0b9['id'],'type':_0x4ded24['name'],'sectionId':_0x4ded24['id']},{})[_0x60e7('0x3a')](function(){return _0xf7c448;});}else{return _0xf7c448;}})[_0x60e7('0x5a')](function(_0x20dc64){logger[_0x60e7('0x28')](_0x60e7('0x66'),_0x20dc64);throw _0x20dc64;});}return _0xf7c448;})[_0x60e7('0x3a')](respondWithResult(_0x657c,0xc9))[_0x60e7('0x5a')](handleError(_0x657c,null));};exports[_0x60e7('0x38')]=function(_0x1dbad9,_0x3b64aa){if(_0x1dbad9[_0x60e7('0x61')]['id']){delete _0x1dbad9['body']['id'];}return db[_0x60e7('0x42')][_0x60e7('0x5f')]({'where':{'id':_0x1dbad9[_0x60e7('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x60e7('0x5d')}]})['then'](handleEntityNotFound(_0x3b64aa,null))['then'](saveUpdates(_0x1dbad9[_0x60e7('0x61')],null))[_0x60e7('0x3a')](respondWithResult(_0x3b64aa,null))[_0x60e7('0x5a')](handleError(_0x3b64aa,null));};exports[_0x60e7('0x39')]=function(_0x1402f9,_0x91acbc){return db[_0x60e7('0x42')][_0x60e7('0x5f')]({'where':{'id':_0x1402f9[_0x60e7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x91acbc,null))[_0x60e7('0x3a')](removeEntity(_0x91acbc,null))[_0x60e7('0x5a')](handleError(_0x91acbc,null));};exports['describe']=function(_0x1afcb8,_0x3cb0ec){return db[_0x60e7('0x42')][_0x60e7('0x67')]()[_0x60e7('0x3a')](respondWithResult(_0x3cb0ec,null))['catch'](handleError(_0x3cb0ec,null));};exports[_0x60e7('0x68')]=function(_0x33c9e8,_0x2c874f,_0x3814c9){if(_0x33c9e8[_0x60e7('0x61')]['id']){delete _0x33c9e8[_0x60e7('0x61')]['id'];}return db['SmsAccount'][_0x60e7('0x5f')]({'where':{'id':_0x33c9e8[_0x60e7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2c874f,null))['then'](function(_0x588253){if(_0x588253){_0x33c9e8[_0x60e7('0x61')][_0x60e7('0x69')]=_0x588253['id'];return db[_0x60e7('0x6a')]['create'](_0x33c9e8[_0x60e7('0x61')]);}})[_0x60e7('0x3a')](respondWithResult(_0x2c874f,null))[_0x60e7('0x5a')](handleError(_0x2c874f,null));};exports[_0x60e7('0x6b')]=function(_0x1abe43,_0x26ceb2,_0x707e9c){var _0x274dc2={'raw':![],'where':{}};var _0x46f4f4={};var _0xc87c13={'count':0x0,'rows':[]};return db[_0x60e7('0x42')][_0x60e7('0x6c')]({'where':{'id':_0x1abe43[_0x60e7('0x5c')]['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0x26ceb2,null))[_0x60e7('0x3a')](function(_0x411ceb){if(_0x411ceb){_0x46f4f4[_0x60e7('0x4b')]=_[_0x60e7('0x48')](db[_0x60e7('0x6a')][_0x60e7('0x43')]);_0x46f4f4[_0x60e7('0x47')]=_[_0x60e7('0x48')](_0x1abe43[_0x60e7('0x47')]);_0x46f4f4[_0x60e7('0x49')]=_[_0x60e7('0x4a')](_0x46f4f4['model'],_0x46f4f4['query']);_0x274dc2['attributes']=_[_0x60e7('0x4a')](_0x46f4f4[_0x60e7('0x4b')],qs['fields'](_0x1abe43[_0x60e7('0x47')][_0x60e7('0x4d')]));_0x274dc2['attributes']=_0x274dc2[_0x60e7('0x4c')][_0x60e7('0x6d')]?_0x274dc2['attributes']:_0x46f4f4['model'];if(!_0x1abe43[_0x60e7('0x47')][_0x60e7('0x4e')](_0x60e7('0x6e'))){_0x274dc2[_0x60e7('0x31')]=qs[_0x60e7('0x31')](_0x1abe43[_0x60e7('0x47')][_0x60e7('0x31')]);_0x274dc2[_0x60e7('0x30')]=qs[_0x60e7('0x30')](_0x1abe43[_0x60e7('0x47')][_0x60e7('0x30')]);}_0x274dc2['order']=qs[_0x60e7('0x50')](_0x1abe43['query']['sort']);_0x274dc2[_0x60e7('0x51')]=qs[_0x60e7('0x49')](_[_0x60e7('0x52')](_0x1abe43[_0x60e7('0x47')],_0x46f4f4[_0x60e7('0x49')]));_0x274dc2[_0x60e7('0x51')][_0x60e7('0x69')]=_0x411ceb['id'];if(_0x1abe43['query'][_0x60e7('0x53')]){_0x274dc2['where']=_[_0x60e7('0x54')](_0x274dc2[_0x60e7('0x51')],{'$or':_[_0x60e7('0x41')](_0x274dc2[_0x60e7('0x4c')],function(_0x353f0a){var _0x14eb35={};_0x14eb35[_0x353f0a]={'$like':'%'+_0x1abe43[_0x60e7('0x47')][_0x60e7('0x53')]+'%'};return _0x14eb35;})});}_0x274dc2=_[_0x60e7('0x54')]({},_0x274dc2,_0x1abe43[_0x60e7('0x56')]);return db['Disposition'][_0x60e7('0x33')]({'where':_0x274dc2['where']})['then'](function(_0x3b34c1){_0xc87c13[_0x60e7('0x33')]=_0x3b34c1;if(_0x1abe43['query']['includeAll']){_0x274dc2[_0x60e7('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x60e7('0x58')](_0x274dc2);})[_0x60e7('0x3a')](function(_0xc811af){_0xc87c13['rows']=_0xc811af;return _0xc87c13;});}})['then'](respondWithFilteredResult(_0x26ceb2,_0x274dc2))['catch'](handleError(_0x26ceb2,null));};exports[_0x60e7('0x6f')]=function(_0x18f4e6,_0x3845f2,_0x29eb9c){return db[_0x60e7('0x42')][_0x60e7('0x5f')]({'where':{'id':_0x18f4e6[_0x60e7('0x5c')]['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0x3845f2,null))[_0x60e7('0x3a')](function(_0x345af4){if(_0x345af4){return _0x345af4[_0x60e7('0x6f')](_0x18f4e6[_0x60e7('0x47')][_0x60e7('0x70')]);}})[_0x60e7('0x3a')](respondWithStatusCode(_0x3845f2,null))[_0x60e7('0x5a')](handleError(_0x3845f2,null));};exports[_0x60e7('0x71')]=function(_0x115f1f,_0x306a5a,_0x44a00c){if(_0x115f1f[_0x60e7('0x61')]['id']){delete _0x115f1f[_0x60e7('0x61')]['id'];}return db[_0x60e7('0x42')]['find']({'where':{'id':_0x115f1f[_0x60e7('0x5c')]['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0x306a5a,null))[_0x60e7('0x3a')](function(_0x510019){if(_0x510019){_0x115f1f[_0x60e7('0x61')]['SmsAccountId']=_0x510019['id'];return db[_0x60e7('0x72')]['create'](_0x115f1f[_0x60e7('0x61')]);}})[_0x60e7('0x3a')](respondWithResult(_0x306a5a,null))[_0x60e7('0x5a')](handleError(_0x306a5a,null));};exports['getAnswers']=function(_0x245988,_0x34a72f,_0x1063ce){var _0x32265a={'raw':![],'where':{}};var _0x160da2={};var _0x13bc05={'count':0x0,'rows':[]};return db['SmsAccount'][_0x60e7('0x6c')]({'where':{'id':_0x245988[_0x60e7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x34a72f,null))[_0x60e7('0x3a')](function(_0x389e31){if(_0x389e31){_0x160da2[_0x60e7('0x4b')]=_[_0x60e7('0x48')](db[_0x60e7('0x72')]['rawAttributes']);_0x160da2[_0x60e7('0x47')]=_[_0x60e7('0x48')](_0x245988[_0x60e7('0x47')]);_0x160da2[_0x60e7('0x49')]=_[_0x60e7('0x4a')](_0x160da2['model'],_0x160da2['query']);_0x32265a['attributes']=_[_0x60e7('0x4a')](_0x160da2[_0x60e7('0x4b')],qs[_0x60e7('0x4d')](_0x245988[_0x60e7('0x47')]['fields']));_0x32265a[_0x60e7('0x4c')]=_0x32265a[_0x60e7('0x4c')]['length']?_0x32265a['attributes']:_0x160da2[_0x60e7('0x4b')];if(!_0x245988[_0x60e7('0x47')]['hasOwnProperty'](_0x60e7('0x6e'))){_0x32265a[_0x60e7('0x31')]=qs[_0x60e7('0x31')](_0x245988[_0x60e7('0x47')]['limit']);_0x32265a[_0x60e7('0x30')]=qs['offset'](_0x245988['query']['offset']);}_0x32265a['order']=qs['sort'](_0x245988[_0x60e7('0x47')][_0x60e7('0x50')]);_0x32265a[_0x60e7('0x51')]=qs[_0x60e7('0x49')](_[_0x60e7('0x52')](_0x245988[_0x60e7('0x47')],_0x160da2[_0x60e7('0x49')]));_0x32265a['where'][_0x60e7('0x69')]=_0x389e31['id'];if(_0x245988[_0x60e7('0x47')][_0x60e7('0x53')]){_0x32265a[_0x60e7('0x51')]=_[_0x60e7('0x54')](_0x32265a[_0x60e7('0x51')],{'$or':_['map'](_0x32265a[_0x60e7('0x4c')],function(_0x404fd5){var _0x1cfd7a={};_0x1cfd7a[_0x404fd5]={'$like':'%'+_0x245988[_0x60e7('0x47')][_0x60e7('0x53')]+'%'};return _0x1cfd7a;})});}_0x32265a=_[_0x60e7('0x54')]({},_0x32265a,_0x245988[_0x60e7('0x56')]);return db[_0x60e7('0x72')][_0x60e7('0x33')]({'where':_0x32265a[_0x60e7('0x51')]})[_0x60e7('0x3a')](function(_0x30b55f){_0x13bc05[_0x60e7('0x33')]=_0x30b55f;if(_0x245988[_0x60e7('0x47')]['includeAll']){_0x32265a[_0x60e7('0x57')]=[{'all':!![]}];}return db[_0x60e7('0x72')][_0x60e7('0x58')](_0x32265a);})[_0x60e7('0x3a')](function(_0x12660f){_0x13bc05['rows']=_0x12660f;return _0x13bc05;});}})['then'](respondWithFilteredResult(_0x34a72f,_0x32265a))[_0x60e7('0x5a')](handleError(_0x34a72f,null));};exports['removeAnswers']=function(_0x190158,_0x2a62d8,_0x2c73c0){return db[_0x60e7('0x42')]['find']({'where':{'id':_0x190158[_0x60e7('0x5c')]['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0x2a62d8,null))[_0x60e7('0x3a')](function(_0x47eacb){if(_0x47eacb){return _0x47eacb[_0x60e7('0x73')](_0x190158[_0x60e7('0x47')][_0x60e7('0x70')]);}})[_0x60e7('0x3a')](respondWithStatusCode(_0x2a62d8,null))['catch'](handleError(_0x2a62d8,null));};exports[_0x60e7('0x74')]=function(_0x158d83,_0x303201,_0x32b57b){var _0x18dcbe={'channel':'sms'};var _0x26dfdf=[];var _0x2c07f1=[];var _0x29278e={};return db[_0x60e7('0x42')][_0x60e7('0x5f')]({'where':{'id':_0x158d83[_0x60e7('0x5c')]['id']},'include':[{'model':db[_0x60e7('0x75')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x303201,null))['then'](function(_0x113cff){_0x18dcbe['account']=_0x113cff;_0x18dcbe[_0x60e7('0x76')]=_[_0x60e7('0x77')](_0x113cff[_0x60e7('0x78')],[_0x60e7('0x79')],[_0x60e7('0x7a')]);if(_0x18dcbe[_0x60e7('0x7b')][_0x60e7('0x78')]){delete _0x18dcbe[_0x60e7('0x7b')]['Applications'];}return db[_0x60e7('0x7c')][_0x60e7('0x67')]();})[_0x60e7('0x3a')](function(_0x623293){if(!_0x623293){throw new db[(_0x60e7('0x7d'))][(_0x60e7('0x7e'))]('no\x20available\x20attributes');}_0x26dfdf=_['difference'](_[_0x60e7('0x48')](_0x623293),['createdAt',_0x60e7('0x7f')]);_0x2c07f1=_[_0x60e7('0x80')](_[_0x60e7('0x48')](_0x623293),[_0x60e7('0x81'),_0x60e7('0x7f'),_0x60e7('0x82'),_0x60e7('0x83')]);_0x18dcbe[_0x60e7('0x61')]={'mapKey':_0x60e7('0x84')};if(_0x18dcbe[_0x60e7('0x7b')][_0x60e7('0x45')]){switch(_0x18dcbe[_0x60e7('0x7b')][_0x60e7('0x45')]){case _0x60e7('0x85'):_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x86')]=_0x158d83[_0x60e7('0x61')][_0x60e7('0x87')];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x61')]=_0x158d83['body'][_0x60e7('0x88')];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x89')]=_0x158d83['body'][_0x60e7('0x8a')];break;case'skebby':_0x18dcbe[_0x60e7('0x61')]['from']='+'+_0x158d83[_0x60e7('0x61')]['sender'];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x61')]=_0x158d83['body'][_0x60e7('0x8b')];break;case'connectel':_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x86')]=_0x158d83['body'][_0x60e7('0x86')];_0x18dcbe[_0x60e7('0x61')]['body']=_0x158d83[_0x60e7('0x61')]['message'];break;case _0x60e7('0x8c'):_0x18dcbe[_0x60e7('0x61')]['from']=_0x158d83['body'][_0x60e7('0x86')];_0x18dcbe['body'][_0x60e7('0x61')]=_0x158d83[_0x60e7('0x61')][_0x60e7('0x61')];_0x18dcbe['body'][_0x60e7('0x89')]=_0x158d83[_0x60e7('0x61')][_0x60e7('0x8d')];break;case _0x60e7('0x8e'):_0x18dcbe['body'][_0x60e7('0x86')]=_0x158d83['body'][_0x60e7('0x87')];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x61')]=_0x158d83[_0x60e7('0x61')]['Text'];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x89')]=_0x158d83[_0x60e7('0x61')][_0x60e7('0x8f')];break;case _0x60e7('0x90'):_0x18dcbe['body'][_0x60e7('0x86')]='+'+_0x158d83[_0x60e7('0x61')][_0x60e7('0x91')][0x0][_0x60e7('0x86')];_0x18dcbe['body'][_0x60e7('0x61')]=_0x158d83[_0x60e7('0x61')]['results'][0x0][_0x60e7('0x8b')];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x89')]=_0x158d83[_0x60e7('0x61')][_0x60e7('0x91')][0x0]['messageId'];break;case _0x60e7('0x92'):_0x18dcbe['body'][_0x60e7('0x86')]=_0x158d83['body'][_0x60e7('0x93')];_0x18dcbe[_0x60e7('0x61')]['body']=_0x158d83[_0x60e7('0x61')][_0x60e7('0x94')]['message'];break;case'clickatell':_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x86')]=_0x158d83[_0x60e7('0x61')][_0x60e7('0x95')];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x61')]=_0x158d83[_0x60e7('0x61')][_0x60e7('0x8b')];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x89')]=_0x158d83[_0x60e7('0x61')][_0x60e7('0x96')];break;case _0x60e7('0x97'):_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x89')]=_0x158d83[_0x60e7('0x61')][0x0][_0x60e7('0x2a')]['id'];_0x18dcbe['body'][_0x60e7('0x86')]=_0x158d83[_0x60e7('0x61')][0x0][_0x60e7('0x2a')][_0x60e7('0x86')];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x61')]=_0x158d83['body'][0x0]['message'][_0x60e7('0x8b')];break;case'intelepeer':_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x86')]=_0x158d83[_0x60e7('0x61')][_0x60e7('0x86')];_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x61')]=_0x158d83[_0x60e7('0x61')]['message'];_0x18dcbe[_0x60e7('0x61')]['messageId']=_0x158d83[_0x60e7('0x61')][_0x60e7('0x98')];break;}}if(_0x18dcbe[_0x60e7('0x61')]['id']){delete _0x18dcbe[_0x60e7('0x61')]['id'];}if(_[_0x60e7('0x99')](_0x18dcbe['body'][_0x60e7('0x86')])){throw new db['Sequelize'][(_0x60e7('0x7e'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x18dcbe['body'][_0x60e7('0x61')])||_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x61')]===''){throw new db[(_0x60e7('0x7d'))]['ValidationError'](_0x60e7('0x9a'));}if(_['isNil'](_0x18dcbe[_0x60e7('0x61')]['mapKey'])){throw new db[(_0x60e7('0x7d'))][(_0x60e7('0x7e'))](_0x60e7('0x9b')+_0x2c07f1);}if(!_[_0x60e7('0x9c')](_0x2c07f1,_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x9d')])){throw new db[(_0x60e7('0x7d'))]['ValidationError'](_0x60e7('0x9e')+_0x2c07f1);}_0x29278e[_0x18dcbe[_0x60e7('0x61')]['mapKey']]=_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x86')];return db[_0x60e7('0x9f')][_0x60e7('0x5f')]({'where':{'id':_0x18dcbe[_0x60e7('0x7b')][_0x60e7('0x83')]},'include':[{'model':db[_0x60e7('0x7c')],'as':_0x60e7('0xa0'),'where':_0x29278e,'limit':0x1,'order':[[_0x60e7('0x7f'),'DESC']]}]});})[_0x60e7('0x3a')](handleEntityNotFound(_0x303201,null))[_0x60e7('0x3a')](function(_0xb4d9e4){if(_0xb4d9e4){_0x18dcbe[_0x60e7('0xa1')]=_[_0x60e7('0xa2')](_0xb4d9e4,[_0x60e7('0xa0')]);if(_0xb4d9e4[_0x60e7('0xa0')][_0x60e7('0x6d')]){return _0xb4d9e4['Contacts'][0x0];}var _0x2ce6f2=_[_0x60e7('0x1b')](_0x18dcbe[_0x60e7('0x61')],{'firstName':_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x86')],'ListId':_0xb4d9e4['id']});_0x2ce6f2[_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x9d')]]=_0x18dcbe[_0x60e7('0x61')]['from'];return db[_0x60e7('0x7c')][_0x60e7('0x60')](_0x2ce6f2,{'fields':_0x26dfdf,'raw':!![]});}})[_0x60e7('0x3a')](handleEntityNotFound(_0x303201,null))[_0x60e7('0x3a')](function(_0x1b4eec){if(_0x1b4eec){_0x18dcbe[_0x60e7('0xa3')]=_0x1b4eec;var _0x56c6f9={'ContactId':_0x1b4eec['id'],'phone':_0x18dcbe[_0x60e7('0x61')][_0x60e7('0x86')],'SmsAccountId':_0x158d83['params']['id']};var _0x2ecb3e={'ContactId':_0x1b4eec['id'],'SmsAccountId':_0x158d83[_0x60e7('0x5c')]['id'],'closed':![]};return db[_0x60e7('0xa4')][_0x60e7('0x5f')]({'where':_0x2ecb3e})[_0x60e7('0x3a')](function(_0x4ab14c){if(_0x4ab14c){return[_0x4ab14c,![]];}return db[_0x60e7('0xa4')][_0x60e7('0x60')](_0x56c6f9)['then'](function(_0x2dfd8d){return[_0x2dfd8d,!![]];});});}})[_0x60e7('0xa5')](function(_0x5daad2,_0x10d839){_0x18dcbe[_0x60e7('0xa6')]=_0x5daad2[_0x60e7('0x63')]({'plain':!![]});_0x18dcbe[_0x60e7('0xa6')][_0x60e7('0xa7')]=![];if(_0x10d839){if(_0x18dcbe[_0x60e7('0x7b')][_0x60e7('0xa8')]){_0x18dcbe['applications'][_0x60e7('0xa9')]({'id':0x0,'priority':_0x18dcbe[_0x60e7('0x76')]['length']+0x1,'app':_0x60e7('0xaa'),'appdata':_0x60e7('0xab'),'interval':'*,*,*,*'});}_0x18dcbe[_0x60e7('0xa6')][_0x60e7('0xa7')]=!![];}return db[_0x60e7('0xac')][_0x60e7('0x60')]({'phone':_0x18dcbe['body'][_0x60e7('0x86')],'messageId':_0x18dcbe['body'][_0x60e7('0x89')],'body':_0x18dcbe['body'][_0x60e7('0x61')],'SmsAccountId':_0x158d83[_0x60e7('0x5c')]['id'],'SmsInteractionId':_0x5daad2['id'],'direction':'in','ContactId':_0x5daad2[_0x60e7('0xad')],'AttachmentId':_0x18dcbe['body'][_0x60e7('0xae')]});})[_0x60e7('0x3a')](function(_0x4be56a){_0x18dcbe[_0x60e7('0x2a')]=_0x4be56a;if(!_0x18dcbe[_0x60e7('0xa6')][_0x60e7('0xaf')])return;return db[_0x60e7('0xb0')][_0x60e7('0x5f')]({'attributes':['id',_0x60e7('0x3d')],'where':{'id':_0x18dcbe[_0x60e7('0xa6')]['UserId']}});})[_0x60e7('0x3a')](function(_0x58a7f9){if(_0x58a7f9){_0x18dcbe[_0x60e7('0x76')][_0x60e7('0xb1')]({'id':0x0,'priority':0x0,'app':_0x60e7('0xb2'),'appdata':_0x58a7f9[_0x60e7('0x3d')]+','+(_0x18dcbe[_0x60e7('0x7b')][_0x60e7('0xb3')]||0xa),'interval':_0x60e7('0xb4')});}if(!_0x18dcbe['interaction'][_0x60e7('0xb5')])return;return db[_0x60e7('0xb6')][_0x60e7('0x5f')]({'attributes':['id',_0x60e7('0x3d')],'where':{'id':_0x18dcbe[_0x60e7('0xa6')][_0x60e7('0xb5')]}});})[_0x60e7('0x3a')](function(_0x3746da){if(_0x3746da){_0x18dcbe[_0x60e7('0x76')][_0x60e7('0xb1')]({'id':0x0,'priority':0x1,'app':_0x60e7('0xb7'),'appdata':_0x3746da[_0x60e7('0x3d')]+','+(_0x18dcbe[_0x60e7('0x7b')][_0x60e7('0xb8')]||0x12c),'interval':_0x60e7('0xb4')});}return respondWithRpcPromise('Start',_0x60e7('0xb9'),_0x18dcbe);})['then'](function(_0x2b1756){if(_0x2b1756){var _0x26f0c3=0xc8;var _0x3b0b0b='receiveMessage';logger[_0x60e7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3b0b0b,_0x26f0c3,_0x60e7('0xba'));logger[_0x60e7('0xbb')](_0x60e7('0xbc'),_0x3b0b0b,_0x26f0c3,_0x60e7('0xba'),JSON['stringify'](_0x2b1756));if(_0x18dcbe['account'][_0x60e7('0x45')]===_0x60e7('0x85')){return _0x303201[_0x60e7('0x2d')](_0x26f0c3)['set']('Content-Type',_0x60e7('0xbd'))[_0x60e7('0x3e')]('\x0a');}else{return _0x303201[_0x60e7('0x2d')](_0x26f0c3)[_0x60e7('0x2f')](_0x2b1756);}}})['catch'](handleError(_0x303201,null));};exports[_0x60e7('0xbe')]=function(_0x2820b4,_0x3a6b3c){var _0x38ac61=_0x2820b4['params']['id'];var _0x339a28=_0x2820b4[_0x60e7('0x61')];var _0x51c0d4=0xc8;var _0x12b244=null;return db[_0x60e7('0xbf')][_0x60e7('0xc0')]({'isolationLevel':db[_0x60e7('0xbf')]['Transaction'][_0x60e7('0xc1')][_0x60e7('0xc2')]},function(_0x2c4674){return db[_0x60e7('0x42')][_0x60e7('0x6c')]({'where':{'id':_0x38ac61},'transaction':_0x2c4674})[_0x60e7('0x3a')](function(_0x290b72){if(_0x290b72){return db[_0x60e7('0x75')]['destroy']({'where':{'SmsAccountId':_0x38ac61},'transaction':_0x2c4674})[_0x60e7('0x3a')](function(){var _0x5add63=_[_0x60e7('0x41')](_0x339a28,function(_0x2577b8){_0x2577b8['SmsAccountId']=_0x38ac61;return _0x2577b8;});return db[_0x60e7('0x75')][_0x60e7('0xc3')](_0x5add63,{'transaction':_0x2c4674});});}else{_0x51c0d4=0x194;_0x12b244=[];}});})[_0x60e7('0x3a')](function(){if(_0x51c0d4!==0x194){return db['SmsApplication'][_0x60e7('0xc4')]({'where':{'SmsAccountId':_0x38ac61},'order':'priority'})['then'](function(_0x3b8603){_0x12b244=_0x3b8603;});}})[_0x60e7('0x5a')](function(_0xf5e982){_0x51c0d4=0x1f4;logger[_0x60e7('0x28')](_0xf5e982['stack']);if(_0xf5e982[_0x60e7('0x3d')]){delete _0xf5e982[_0x60e7('0x3d')];}_0x12b244=_0xf5e982;})['finally'](function(){if(_0x12b244===null){_0x3a6b3c[_0x60e7('0x2c')](_0x51c0d4);}else{if(_0x51c0d4===0x1f4){_0x3a6b3c['status'](_0x51c0d4)[_0x60e7('0x3e')](_0x12b244);}else{_0x3a6b3c[_0x60e7('0x2d')](_0x51c0d4)[_0x60e7('0x2f')](_0x12b244);}}});};exports[_0x60e7('0xc5')]=function(_0x3ffdde,_0x3de187,_0x1da62d){var _0x688544={};var _0x2d7167={};var _0x43433d;var _0x451eac;return db[_0x60e7('0x42')][_0x60e7('0x6c')]({'where':{'id':_0x3ffdde['params']['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0x3de187,null))[_0x60e7('0x3a')](function(_0x11e9d9){if(_0x11e9d9){_0x43433d=_0x11e9d9;_0x2d7167['model']=_[_0x60e7('0x48')](db[_0x60e7('0x75')][_0x60e7('0x43')]);_0x2d7167[_0x60e7('0x47')]=_['keys'](_0x3ffdde[_0x60e7('0x47')]);_0x2d7167[_0x60e7('0x49')]=_[_0x60e7('0x4a')](_0x2d7167['model'],_0x2d7167['query']);_0x688544[_0x60e7('0x4c')]=_['intersection'](_0x2d7167[_0x60e7('0x4b')],qs['fields'](_0x3ffdde[_0x60e7('0x47')]['fields']));_0x688544['attributes']=_0x688544[_0x60e7('0x4c')]['length']?_0x688544[_0x60e7('0x4c')]:_0x2d7167[_0x60e7('0x4b')];_0x688544['order']=qs[_0x60e7('0x50')](_0x3ffdde['query']['sort']);_0x688544[_0x60e7('0x51')]=qs[_0x60e7('0x49')](_['pick'](_0x3ffdde['query'],_0x2d7167[_0x60e7('0x49')]));if(_0x3ffdde[_0x60e7('0x47')][_0x60e7('0x53')]){_0x688544['where']=_[_0x60e7('0x54')](_0x688544[_0x60e7('0x51')],{'$or':_[_0x60e7('0x41')](_0x688544[_0x60e7('0x4c')],function(_0xe6510d){var _0x4ea7aa={};_0x4ea7aa[_0xe6510d]={'$like':'%'+_0x3ffdde[_0x60e7('0x47')][_0x60e7('0x53')]+'%'};return _0x4ea7aa;})});}_0x688544=_[_0x60e7('0x54')]({},_0x688544,_0x3ffdde[_0x60e7('0x56')]);return _0x43433d[_0x60e7('0xc5')](_0x688544);}})['then'](function(_0x189f69){if(_0x189f69){_0x451eac=_0x189f69['length'];if(!_0x3ffdde[_0x60e7('0x47')][_0x60e7('0x4e')]('nolimit')){_0x688544[_0x60e7('0x31')]=qs[_0x60e7('0x31')](_0x3ffdde[_0x60e7('0x47')][_0x60e7('0x31')]);_0x688544['offset']=qs[_0x60e7('0x30')](_0x3ffdde['query'][_0x60e7('0x30')]);}return _0x43433d[_0x60e7('0xc5')](_0x688544);}})[_0x60e7('0x3a')](function(_0x132ff5){if(_0x132ff5){return _0x132ff5?{'count':_0x451eac,'rows':_0x132ff5}:null;}})[_0x60e7('0x3a')](respondWithResult(_0x3de187,null))[_0x60e7('0x5a')](handleError(_0x3de187,null));};exports[_0x60e7('0xc6')]=function(_0x223c7b,_0x71e140,_0x4023f2){var _0x4ffc56={'raw':![],'where':{}};var _0x2e2e24={};var _0x361066={'count':0x0,'rows':[]};return db[_0x60e7('0x42')][_0x60e7('0x6c')]({'where':{'id':_0x223c7b[_0x60e7('0x5c')]['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0x71e140,null))[_0x60e7('0x3a')](function(_0x309909){if(_0x309909){_0x2e2e24[_0x60e7('0x4b')]=_['keys'](db[_0x60e7('0xa4')][_0x60e7('0x43')]);_0x2e2e24['query']=_['keys'](_0x223c7b['query']);_0x2e2e24[_0x60e7('0x49')]=_[_0x60e7('0x4a')](_0x2e2e24['model'],_0x2e2e24[_0x60e7('0x47')]);_0x4ffc56[_0x60e7('0x4c')]=_[_0x60e7('0x4a')](_0x2e2e24[_0x60e7('0x4b')],qs[_0x60e7('0x4d')](_0x223c7b[_0x60e7('0x47')][_0x60e7('0x4d')]));_0x4ffc56[_0x60e7('0x4c')]=_0x4ffc56[_0x60e7('0x4c')][_0x60e7('0x6d')]?_0x4ffc56[_0x60e7('0x4c')]:_0x2e2e24['model'];if(!_0x223c7b['query']['hasOwnProperty'](_0x60e7('0x6e'))){_0x4ffc56['limit']=qs[_0x60e7('0x31')](_0x223c7b[_0x60e7('0x47')][_0x60e7('0x31')]);_0x4ffc56[_0x60e7('0x30')]=qs[_0x60e7('0x30')](_0x223c7b[_0x60e7('0x47')][_0x60e7('0x30')]);}_0x4ffc56[_0x60e7('0x4f')]=qs[_0x60e7('0x50')](_0x223c7b['query'][_0x60e7('0x50')]);_0x4ffc56[_0x60e7('0x51')]=qs[_0x60e7('0x49')](_[_0x60e7('0x52')](_0x223c7b['query'],_0x2e2e24[_0x60e7('0x49')]));_0x4ffc56[_0x60e7('0x51')][_0x60e7('0x69')]=_0x309909['id'];if(_0x223c7b[_0x60e7('0x47')][_0x60e7('0x53')]){_0x4ffc56['where']=_[_0x60e7('0x54')](_0x4ffc56[_0x60e7('0x51')],{'$or':_[_0x60e7('0x41')](_0x4ffc56[_0x60e7('0x4c')],function(_0x91ecd8){var _0x4a5748={};_0x4a5748[_0x91ecd8]={'$like':'%'+_0x223c7b['query'][_0x60e7('0x53')]+'%'};return _0x4a5748;})});}_0x4ffc56=_[_0x60e7('0x54')]({},_0x4ffc56,_0x223c7b[_0x60e7('0x56')]);return db[_0x60e7('0xa4')][_0x60e7('0x33')]({'where':_0x4ffc56[_0x60e7('0x51')]})[_0x60e7('0x3a')](function(_0x3ba37e){_0x361066[_0x60e7('0x33')]=_0x3ba37e;if(_0x223c7b['query'][_0x60e7('0x5e')]){_0x4ffc56['include']=[{'model':db[_0x60e7('0x7c')],'as':'Contact','required':![]},{'model':db[_0x60e7('0xb0')],'as':_0x60e7('0xc7'),'attributes':['name',_0x60e7('0xc8'),_0x60e7('0xc9')],'required':![]},{'model':db[_0x60e7('0xca')],'as':_0x60e7('0xcb'),'attributes':['id',_0x60e7('0x3d'),_0x60e7('0xcc')],'where':_0x223c7b[_0x60e7('0x47')][_0x60e7('0xcd')]?{'id':_0x223c7b['query'][_0x60e7('0xcd')]}:undefined,'required':_0x223c7b[_0x60e7('0x47')][_0x60e7('0xcd')]?!![]:![]}];}return db['SmsInteraction'][_0x60e7('0x58')](_0x4ffc56);})[_0x60e7('0x3a')](function(_0x2976e2){_0x361066['rows']=_0x2976e2;return _0x361066;});}})[_0x60e7('0x3a')](respondWithFilteredResult(_0x71e140,_0x4ffc56))[_0x60e7('0x5a')](handleError(_0x71e140,null));};exports[_0x60e7('0x3e')]=function(_0x3dbd4b,_0x1eb0bb,_0x35be92){var _0x54f13a,_0x19a82b,_0x56bdb7;if(_[_0x60e7('0x99')](_0x3dbd4b[_0x60e7('0x61')]['body'])||_0x3dbd4b['body'][_0x60e7('0x61')]===''){throw new db[(_0x60e7('0x7d'))][(_0x60e7('0x7e'))](_0x60e7('0x9a'));}if(_[_0x60e7('0x99')](_0x3dbd4b[_0x60e7('0x61')]['to'])){throw new db[(_0x60e7('0x7d'))][(_0x60e7('0x7e'))](_0x60e7('0xce'));}_0x54f13a=_0x3dbd4b[_0x60e7('0x61')]['to'];return db[_0x60e7('0x42')]['find']({'where':{'id':_0x3dbd4b[_0x60e7('0x5c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x60e7('0x7c')],'as':'Contacts','where':{'mobile':_0x54f13a},'limit':0x1,'order':[[_0x60e7('0x7f'),_0x60e7('0xcf')]]}]}]})[_0x60e7('0x3a')](handleEntityNotFound(_0x1eb0bb,null))[_0x60e7('0x3a')](function(_0x5dfa30){if(_0x5dfa30&&_0x5dfa30[_0x60e7('0xd0')]){_0x19a82b=_0x5dfa30[_0x60e7('0x63')]({'plain':!![]});if(_0x19a82b[_0x60e7('0xd0')]&&_0x19a82b[_0x60e7('0xd0')][_0x60e7('0xa0')]['length']){return _0x19a82b[_0x60e7('0xd0')][_0x60e7('0xa0')][0x0];}return db[_0x60e7('0x7c')]['create'](_[_0x60e7('0x1b')](_0x3dbd4b[_0x60e7('0x61')],{'firstName':_0x54f13a,'mobile':_0x54f13a,'phone':_0x54f13a,'ListId':_0x19a82b[_0x60e7('0x83')]}));}})[_0x60e7('0x3a')](handleEntityNotFound(_0x1eb0bb,null))['then'](function(_0x40b4fc){if(_0x40b4fc){_0x56bdb7=_0x40b4fc;return db['SmsInteraction']['find']({'where':{'ContactId':_0x56bdb7['id'],'closed':![],'SmsAccountId':_0x19a82b['id']}})[_0x60e7('0x3a')](function(_0x14996b){if(_0x14996b){return[_0x14996b,![]];}return db['SmsInteraction'][_0x60e7('0x60')]({'UserId':_0x3dbd4b[_0x60e7('0x62')]['id'],'ContactId':_0x56bdb7['id'],'SmsAccountId':_0x19a82b['id'],'phone':_0x54f13a,'firstMsgDirection':_0x60e7('0xd1'),'Messages':[_[_0x60e7('0x54')](_0x3dbd4b['body'],{'read':![],'body':_0x3dbd4b[_0x60e7('0x61')][_0x60e7('0x61')],'phone':_0x54f13a,'SmsAccountId':_0x19a82b['id'],'UserId':_0x3dbd4b[_0x60e7('0x62')]['id'],'ContactId':_0x56bdb7['id']})]},{'include':[{'model':db[_0x60e7('0xac')],'as':'Messages'}]})['then'](function(_0x402257){return[_0x402257,!![]];});});}})[_0x60e7('0xa5')](function(_0xf44be8,_0x33a8c6){if(_0x33a8c6){return _0xf44be8;}return db['SmsMessage'][_0x60e7('0x60')](_['merge'](_0x3dbd4b[_0x60e7('0x61')],{'read':![],'body':_0x3dbd4b[_0x60e7('0x61')]['body'],'phone':_0x54f13a,'SmsAccountId':_0x19a82b['id'],'SmsInteractionId':_0xf44be8['id'],'UserId':_0x3dbd4b[_0x60e7('0x62')]['id'],'ContactId':_0x56bdb7['id']}))[_0x60e7('0x3a')](function(_0x59bd22){_0xf44be8['dataValues']['Messages']=[];_0xf44be8[_0x60e7('0xd2')][_0x60e7('0xd3')]['push'](_0x59bd22[_0x60e7('0xd2')]);return _0xf44be8;});})[_0x60e7('0x3a')](respondWithResult(_0x1eb0bb,null))['catch'](handleError(_0x1eb0bb,null));};exports[_0x60e7('0x2d')]=function(_0x33b4e0,_0xd9651c,_0x165a88){if(_0x33b4e0[_0x60e7('0x61')]['id']){delete _0x33b4e0[_0x60e7('0x61')]['id'];}var _0xd0eea5,_0xdbe48,_0x553192;return db[_0x60e7('0x42')][_0x60e7('0x5f')]({'where':{'id':_0x33b4e0[_0x60e7('0x5c')]['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0xd9651c,null))[_0x60e7('0x3a')](function(_0xdd6fc9){if(_0xdd6fc9){_0x553192=_0xdd6fc9;logger[_0x60e7('0xbb')](_0x60e7('0x26'),_0x60e7('0x2d'),_0x60e7('0xd4'),_0xdd6fc9[_0x60e7('0x45')],util[_0x60e7('0xd5')](_0x33b4e0[_0x60e7('0x61')],{'showHidden':![],'depth':null}));switch(_0xdd6fc9[_0x60e7('0x45')]){case _0x60e7('0xd6'):if(_0x33b4e0[_0x60e7('0x61')][_0x60e7('0xd7')]&&_0x33b4e0['body'][_0x60e7('0x2d')]){_0xdbe48=_0x33b4e0[_0x60e7('0x61')][_0x60e7('0x2d')];return db[_0x60e7('0xac')][_0x60e7('0x5f')]({'where':{'messageId':_0x33b4e0['body'][_0x60e7('0xd7')]}});}break;case'connectel':if(_0x33b4e0[_0x60e7('0x61')][_0x60e7('0xd8')]&&_0x33b4e0[_0x60e7('0x61')][_0x60e7('0xd9')]){_0xdbe48=_0x33b4e0['body']['statusInt'];return db[_0x60e7('0xac')][_0x60e7('0x5f')]({'where':{'messageId':_0x33b4e0[_0x60e7('0x61')][_0x60e7('0xd8')]}});}break;case _0x60e7('0x8c'):if(_0x33b4e0[_0x60e7('0x61')][_0x60e7('0x8d')]&&_0x33b4e0[_0x60e7('0x61')]['status_code']){_0xdbe48=_0x33b4e0[_0x60e7('0x61')]['status_code'];return db[_0x60e7('0xac')][_0x60e7('0x5f')]({'where':{'messageId':_0x33b4e0['body']['message_id']}});}break;case _0x60e7('0x90'):var _0x251c02=_0x33b4e0[_0x60e7('0x61')]['results'][0x0];if(_0x251c02[_0x60e7('0x89')]&&_0x251c02['status']['groupName']==='DELIVERED'){_0xdbe48=_0x251c02['status'][_0x60e7('0xda')];return db['SmsMessage'][_0x60e7('0x5f')]({'where':{'messageId':_0x251c02[_0x60e7('0x89')]}});}break;case _0x60e7('0xdb'):if(_0x33b4e0['body'][_0x60e7('0x89')]&&_0x33b4e0[_0x60e7('0x61')][_0x60e7('0x2d')]){_0xdbe48=_0x33b4e0[_0x60e7('0x61')]['status'];return db[_0x60e7('0xac')][_0x60e7('0x5f')]({'where':{'messageId':_0x33b4e0[_0x60e7('0x61')][_0x60e7('0x89')]}});}break;case _0x60e7('0x97'):if(_0x33b4e0['body'][0x0][_0x60e7('0x2a')]['id']){_0xdbe48=_0x33b4e0['body'][0x0][_0x60e7('0x45')];return db[_0x60e7('0xac')]['find']({'where':{'messageId':_0x33b4e0['body'][0x0][_0x60e7('0x2a')]['id']}});}break;case _0x60e7('0xdc'):if(_0x33b4e0[_0x60e7('0x61')][_0x60e7('0xdd')]&&_0x33b4e0[_0x60e7('0x61')][_0x60e7('0x2d')]){_0xdbe48=_0x33b4e0[_0x60e7('0x61')][_0x60e7('0x2d')];return db[_0x60e7('0xac')][_0x60e7('0x5f')]({'where':{'messageId':_0x33b4e0[_0x60e7('0x61')]['redif']}});}break;}}})[_0x60e7('0x3a')](handleEntityNotFound(_0xd9651c,null))[_0x60e7('0x3a')](function(_0x3b5419){if(_0x3b5419){_0xd0eea5=_0x3b5419;switch(_0x553192[_0x60e7('0x45')]){case'skebby':if(_0xdbe48===_0x60e7('0xde')){return _0xd0eea5['update']({'read':!![]});}else{logger[_0x60e7('0x28')](_0x60e7('0x26'),'status',_0x60e7('0xd6'),util['inspect'](_0x33b4e0[_0x60e7('0x61')],{'showHidden':![],'depth':null}));}break;case _0x60e7('0xdf'):if(_0xdbe48==='1'){return _0xd0eea5[_0x60e7('0x38')]({'read':!![]});}else{logger['error'](_0x60e7('0x26'),'status',_0x60e7('0xd6'),util[_0x60e7('0xd5')](_0x33b4e0[_0x60e7('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x33b4e0[_0x60e7('0x61')][_0x60e7('0xe0')]&&_0xdbe48>=0xc8&&_0xdbe48<=0xce){return _0xd0eea5['update']({'read':!![]});}else{logger[_0x60e7('0x28')](_0x60e7('0x26'),_0x60e7('0x2d'),'clicksend',util['inspect'](_0x33b4e0[_0x60e7('0x61')],{'showHidden':![],'depth':null}));}break;case _0x60e7('0x90'):var _0x16e481=_0x33b4e0[_0x60e7('0x61')]['results'][0x0];if(_0x16e481[_0x60e7('0x2d')][_0x60e7('0xda')]===_0x60e7('0xde')){return _0xd0eea5['update']({'read':!![]});}else{logger[_0x60e7('0x28')](_0x60e7('0x26'),'status',_0x60e7('0x90'),util[_0x60e7('0xd5')](_0x33b4e0[_0x60e7('0x61')],{'showHidden':![],'depth':null}));}break;case _0x60e7('0xdb'):if(_0xdbe48==_0x60e7('0xe1')||_0xdbe48==_0x60e7('0xe2')){return _0xd0eea5[_0x60e7('0x38')]({'read':!![]});}else{logger[_0x60e7('0x28')](_0x60e7('0x26'),_0x60e7('0x2d'),_0x60e7('0xdb'),util[_0x60e7('0xd5')](_0x33b4e0[_0x60e7('0x61')],{'showHidden':![],'depth':null}));}break;case _0x60e7('0x97'):if(_0xdbe48==_0x60e7('0xe3')){return _0xd0eea5[_0x60e7('0x38')]({'read':!![]});}else{logger[_0x60e7('0x28')](_0x60e7('0x26'),_0x60e7('0x2d'),_0x60e7('0x97'),util[_0x60e7('0xd5')](_0x33b4e0['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xdbe48===_0x60e7('0xe4')||_0xdbe48===_0x60e7('0xe5')){return _0xd0eea5[_0x60e7('0x38')]({'read':!![]});}else{logger['error'](_0x60e7('0x26'),_0x60e7('0x2d'),_0x60e7('0xdc'),util[_0x60e7('0xd5')](_0x33b4e0['body'],{'showHidden':![],'depth':null}));}break;}return _0xd0eea5;}})[_0x60e7('0x3a')](respondWithResult(_0xd9651c,null))['catch'](handleError(_0xd9651c,null));};exports[_0x60e7('0xe6')]=function(_0x3a87bb,_0x536034,_0x144748){var _0x1d1178,_0x37f925,_0x704a7a;return db[_0x60e7('0x42')]['find']({'where':{'id':_0x3a87bb[_0x60e7('0x5c')]['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0x536034,null))['then'](function(_0x3de2dc){if(_0x3de2dc){_0x704a7a=_0x3de2dc;logger['debug'](_0x60e7('0x26'),_0x60e7('0x2d'),_0x60e7('0xd4'),_0x3de2dc[_0x60e7('0x45')],util[_0x60e7('0xd5')](_0x3a87bb[_0x60e7('0x47')],{'showHidden':![],'depth':null}));switch(_0x3de2dc[_0x60e7('0x45')]){case _0x60e7('0x92'):if(_0x3a87bb[_0x60e7('0x47')][_0x60e7('0xe7')]&&_0x3a87bb[_0x60e7('0x47')][_0x60e7('0xe8')]){_0x37f925=_0x3a87bb['query'][_0x60e7('0xe8')];return db['SmsMessage'][_0x60e7('0x5f')]({'where':{'messageId':_0x3a87bb[_0x60e7('0x47')]['message-id']}});}break;}}})[_0x60e7('0x3a')](handleEntityNotFound(_0x536034,null))[_0x60e7('0x3a')](function(_0x1a8fdc){if(_0x1a8fdc){_0x1d1178=_0x1a8fdc;switch(_0x704a7a[_0x60e7('0x45')]){case _0x60e7('0x92'):if(_0x37f925==='2'||_0x37f925==='6'){return _0x1d1178[_0x60e7('0x38')]({'read':!![]});}else{logger[_0x60e7('0x28')](_0x60e7('0x26'),_0x60e7('0x2d'),_0x60e7('0x92'),util[_0x60e7('0xd5')](_0x3a87bb[_0x60e7('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x1d1178;}})[_0x60e7('0x3a')](respondWithResult(_0x536034,null))['catch'](handleError(_0x536034,null));};exports[_0x60e7('0xe9')]=function(_0x247ea7,_0x4bf29c,_0x40ce5b){return db[_0x60e7('0x42')][_0x60e7('0x5f')]({'where':{'id':_0x247ea7[_0x60e7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4bf29c,null))['then'](function(_0x2a7370){if(_0x2a7370){return _0x2a7370[_0x60e7('0xe9')](_0x247ea7[_0x60e7('0x61')][_0x60e7('0x70')],_[_0x60e7('0xa2')](_0x247ea7[_0x60e7('0x61')],[_0x60e7('0x70'),'id'])||{})[_0x60e7('0xa5')](function(_0x305e7f){for(var _0x31cd39=0x0;_0x31cd39<_0x247ea7[_0x60e7('0x61')]['ids'][_0x60e7('0x6d')];_0x31cd39+=0x1){socket[_0x60e7('0xea')](_0x60e7('0xeb'),{'UserId':Number(_0x247ea7[_0x60e7('0x61')][_0x60e7('0x70')][_0x31cd39]),'SmsAccountId':Number(_0x247ea7[_0x60e7('0x5c')]['id'])});}return _0x305e7f;});}})[_0x60e7('0x3a')](respondWithResult(_0x4bf29c,null))[_0x60e7('0x5a')](handleError(_0x4bf29c,null));};exports[_0x60e7('0xec')]=function(_0x234d59,_0x309f77,_0x3c82d0){return db[_0x60e7('0x42')]['find']({'where':{'id':_0x234d59[_0x60e7('0x5c')]['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0x309f77,null))[_0x60e7('0x3a')](function(_0x721184){if(_0x721184){return _0x721184['removeAgents'](_0x234d59[_0x60e7('0x47')][_0x60e7('0x70')])[_0x60e7('0x3a')](function(){if(_[_0x60e7('0xed')](_0x234d59[_0x60e7('0x47')][_0x60e7('0x70')])){for(var _0x2ac348=0x0;_0x2ac348<_0x234d59['query'][_0x60e7('0x70')][_0x60e7('0x6d')];_0x2ac348+=0x1){socket['emit'](_0x60e7('0xee'),{'UserId':Number(_0x234d59['query']['ids'][_0x2ac348]),'SmsAccountId':Number(_0x234d59[_0x60e7('0x5c')]['id'])});}}else{socket['emit'](_0x60e7('0xee'),{'UserId':Number(_0x234d59[_0x60e7('0x47')][_0x60e7('0x70')]),'SmsAccountId':Number(_0x234d59[_0x60e7('0x5c')]['id'])});}});}})[_0x60e7('0x3a')](respondWithStatusCode(_0x309f77,null))[_0x60e7('0x5a')](handleError(_0x309f77,null));};exports['getAgents']=function(_0x27d85c,_0x596adf,_0x319d73){var _0x1261b1={};var _0x49646b={};var _0x1c7443;var _0x11b4a8;return db['SmsAccount'][_0x60e7('0x6c')]({'where':{'id':_0x27d85c[_0x60e7('0x5c')]['id']}})[_0x60e7('0x3a')](handleEntityNotFound(_0x596adf,null))[_0x60e7('0x3a')](function(_0x522dd5){if(_0x522dd5){_0x1c7443=_0x522dd5;_0x49646b[_0x60e7('0x4b')]=_[_0x60e7('0x48')](db[_0x60e7('0xb0')]['rawAttributes']);_0x49646b[_0x60e7('0x47')]=_[_0x60e7('0x48')](_0x27d85c[_0x60e7('0x47')]);_0x49646b[_0x60e7('0x49')]=_[_0x60e7('0x4a')](_0x49646b[_0x60e7('0x4b')],_0x49646b[_0x60e7('0x47')]);_0x1261b1[_0x60e7('0x4c')]=_[_0x60e7('0x4a')](_0x49646b[_0x60e7('0x4b')],qs[_0x60e7('0x4d')](_0x27d85c[_0x60e7('0x47')]['fields']));_0x1261b1[_0x60e7('0x4c')]=_0x1261b1[_0x60e7('0x4c')][_0x60e7('0x6d')]?_0x1261b1[_0x60e7('0x4c')]:_0x49646b[_0x60e7('0x4b')];_0x1261b1[_0x60e7('0x4f')]=qs['sort'](_0x27d85c[_0x60e7('0x47')][_0x60e7('0x50')]);_0x1261b1['where']=qs[_0x60e7('0x49')](_[_0x60e7('0x52')](_0x27d85c[_0x60e7('0x47')],_0x49646b['filters']));if(_0x27d85c[_0x60e7('0x47')][_0x60e7('0x53')]){_0x1261b1[_0x60e7('0x51')]=_['merge'](_0x1261b1[_0x60e7('0x51')],{'$or':_[_0x60e7('0x41')](_0x1261b1[_0x60e7('0x4c')],function(_0x54e9dd){var _0x34d7a3={};_0x34d7a3[_0x54e9dd]={'$like':'%'+_0x27d85c[_0x60e7('0x47')]['filter']+'%'};return _0x34d7a3;})});}_0x1261b1=_[_0x60e7('0x54')]({},_0x1261b1,_0x27d85c[_0x60e7('0x56')]);return _0x1c7443[_0x60e7('0xef')](_0x1261b1);}})['then'](function(_0x36912e){if(_0x36912e){_0x11b4a8=_0x36912e['length'];if(!_0x27d85c[_0x60e7('0x47')][_0x60e7('0x4e')](_0x60e7('0x6e'))){_0x1261b1[_0x60e7('0x31')]=qs[_0x60e7('0x31')](_0x27d85c['query'][_0x60e7('0x31')]);_0x1261b1[_0x60e7('0x30')]=qs['offset'](_0x27d85c[_0x60e7('0x47')]['offset']);}return _0x1c7443[_0x60e7('0xef')](_0x1261b1);}})[_0x60e7('0x3a')](function(_0x4cfa2f){if(_0x4cfa2f){return _0x4cfa2f?{'count':_0x11b4a8,'rows':_0x4cfa2f}:null;}})[_0x60e7('0x3a')](respondWithResult(_0x596adf,null))[_0x60e7('0x5a')](handleError(_0x596adf,null));}; \ No newline at end of file +var _0xdc71=['list','omit','CmContact','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','text/xml','send','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','internal','Tags','color','DESC','List','Messages','dataValues','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','redif','update','inspect','error_code','groupName','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','userSmsAccount:save','removeAgents','isArray','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsAccount.socket','jayson/promise','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','SmsAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','SmsAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','MessageSid','skebby','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts'];(function(_0x4d8e57,_0x22f23c){var _0xb126d2=function(_0xc811){while(--_0xc811){_0x4d8e57['push'](_0x4d8e57['shift']());}};_0xb126d2(++_0x22f23c);}(_0xdc71,0x12b));var _0x1dc7=function(_0xe884c3,_0x2ed518){_0xe884c3=_0xe884c3-0x0;var _0x303fc6=_0xdc71[_0xe884c3];return _0x303fc6;};'use strict';var emlformat=require(_0x1dc7('0x0'));var rimraf=require(_0x1dc7('0x1'));var zipdir=require(_0x1dc7('0x2'));var jsonpatch=require(_0x1dc7('0x3'));var rp=require(_0x1dc7('0x4'));var moment=require('moment');var BPromise=require(_0x1dc7('0x5'));var Mustache=require(_0x1dc7('0x6'));var util=require('util');var path=require(_0x1dc7('0x7'));var sox=require(_0x1dc7('0x8'));var csv=require(_0x1dc7('0x9'));var ejs=require(_0x1dc7('0xa'));var fs=require('fs');var fs_extra=require(_0x1dc7('0xb'));var _=require(_0x1dc7('0xc'));var squel=require('squel');var crypto=require(_0x1dc7('0xd'));var jsforce=require(_0x1dc7('0xe'));var deskjs=require(_0x1dc7('0xf'));var toCsv=require(_0x1dc7('0x9'));var querystring=require(_0x1dc7('0x10'));var Papa=require(_0x1dc7('0x11'));var Redis=require(_0x1dc7('0x12'));var authService=require(_0x1dc7('0x13'));var qs=require(_0x1dc7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1dc7('0x15'));var logger=require(_0x1dc7('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1dc7('0x17'));var licenseUtil=require(_0x1dc7('0x18'));var db=require('../../mysqldb')['db'];config[_0x1dc7('0x19')]=_[_0x1dc7('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1dc7('0x1b'))(new Redis(config[_0x1dc7('0x19')]));require(_0x1dc7('0x1c'))['register'](socket);var jayson=require(_0x1dc7('0x1d'));var client=jayson['client'][_0x1dc7('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x56907b,_0x188f5c,_0x2e7171,_0x1b1661){return new BPromise(function(_0x39b059,_0x48e20f){var _0x5d1cb9=_0x1b1661||client;return _0x5d1cb9[_0x1dc7('0x1f')](_0x56907b,_0x2e7171)['then'](function(_0x5db17d){logger[_0x1dc7('0x20')](_0x1dc7('0x21'),_0x188f5c,_0x1dc7('0x22'));logger[_0x1dc7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x188f5c,_0x1dc7('0x22'),JSON['stringify'](_0x5db17d));if(_0x5db17d[_0x1dc7('0x24')]){if(_0x5db17d[_0x1dc7('0x24')][_0x1dc7('0x25')]===0x1f4){logger[_0x1dc7('0x24')](_0x1dc7('0x21'),_0x188f5c,_0x5db17d['error']['message']);return _0x48e20f(_0x5db17d['error'][_0x1dc7('0x26')]);}logger[_0x1dc7('0x24')](_0x1dc7('0x21'),_0x188f5c,_0x5db17d[_0x1dc7('0x24')][_0x1dc7('0x26')]);return _0x39b059(_0x5db17d[_0x1dc7('0x24')][_0x1dc7('0x26')]);}else{logger[_0x1dc7('0x20')](_0x1dc7('0x21'),_0x188f5c,_0x1dc7('0x22'));_0x39b059(_0x5db17d[_0x1dc7('0x27')][_0x1dc7('0x26')]);}})[_0x1dc7('0x28')](function(_0xb35874){logger['error'](_0x1dc7('0x21'),_0x188f5c,_0xb35874);_0x48e20f(_0xb35874);});});}function respondWithStatusCode(_0x3356f4,_0x579ada){_0x579ada=_0x579ada||0xcc;return function(_0x1fe170){if(_0x1fe170){return _0x3356f4[_0x1dc7('0x29')](_0x579ada);}return _0x3356f4['status'](_0x579ada)['end']();};}function respondWithResult(_0x173dd6,_0x49503d){_0x49503d=_0x49503d||0xc8;return function(_0x1413d4){if(_0x1413d4){return _0x173dd6[_0x1dc7('0x2a')](_0x49503d)[_0x1dc7('0x2b')](_0x1413d4);}};}function respondWithFilteredResult(_0x3081ee,_0x7ee593){return function(_0x5f16bd){if(_0x5f16bd){var _0xe5d2d5=typeof _0x7ee593[_0x1dc7('0x2c')]==='undefined'&&typeof _0x7ee593[_0x1dc7('0x2d')]===_0x1dc7('0x2e');var _0x297f67=_0x5f16bd[_0x1dc7('0x2f')];var _0xfd48ea=_0xe5d2d5?0x0:_0x7ee593[_0x1dc7('0x2c')];var _0xbb4447=_0xe5d2d5?_0x5f16bd[_0x1dc7('0x2f')]:_0x7ee593[_0x1dc7('0x2c')]+_0x7ee593[_0x1dc7('0x2d')];var _0x435f04;if(_0xbb4447>=_0x297f67){_0xbb4447=_0x297f67;_0x435f04=0xc8;}else{_0x435f04=0xce;}_0x3081ee['status'](_0x435f04);return _0x3081ee[_0x1dc7('0x30')](_0x1dc7('0x31'),_0xfd48ea+'-'+_0xbb4447+'/'+_0x297f67)[_0x1dc7('0x2b')](_0x5f16bd);}return null;};}function patchUpdates(_0x36c2c3){return function(_0x9a8038){try{jsonpatch['apply'](_0x9a8038,_0x36c2c3,!![]);}catch(_0x58ca3d){return BPromise['reject'](_0x58ca3d);}return _0x9a8038[_0x1dc7('0x32')]();};}function saveUpdates(_0x493be9,_0x2c9f2f){return function(_0x393cbb){if(_0x393cbb){return _0x393cbb['update'](_0x493be9)[_0x1dc7('0x33')](function(_0x4e93e8){return _0x4e93e8;});}return null;};}function removeEntity(_0x118ee,_0x329f70){return function(_0x56865e){if(_0x56865e){return _0x56865e[_0x1dc7('0x34')]()[_0x1dc7('0x33')](function(){var _0x57f915=_0x56865e['get']({'plain':!![]});var _0x923b68=_0x1dc7('0x35');return db[_0x1dc7('0x36')]['destroy']({'where':{'type':_0x923b68,'resourceId':_0x57f915['id']}})[_0x1dc7('0x33')](function(){return _0x56865e;});})[_0x1dc7('0x33')](function(){_0x118ee[_0x1dc7('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x436a12,_0x41b812){return function(_0x4d8df8){if(!_0x4d8df8){_0x436a12[_0x1dc7('0x29')](0x194);}return _0x4d8df8;};}function handleError(_0xb41abf,_0x4980ce){_0x4980ce=_0x4980ce||0x1f4;return function(_0xbd6a75){logger[_0x1dc7('0x24')](_0xbd6a75[_0x1dc7('0x37')]);if(_0xbd6a75[_0x1dc7('0x38')]){delete _0xbd6a75[_0x1dc7('0x38')];}_0xb41abf['status'](_0x4980ce)['send'](_0xbd6a75);};}exports[_0x1dc7('0x39')]=function(_0x5df0d5,_0xafe108){var _0x50b1fd={'include':[{'model':db['Pause'],'as':_0x1dc7('0x3a')}]},_0x16822f={},_0x2a11a0={'count':0x0,'rows':[]};var _0x4d5e3d=_[_0x1dc7('0x3b')](db[_0x1dc7('0x3c')][_0x1dc7('0x3d')],function(_0x2c5dc8){return{'name':_0x2c5dc8['fieldName'],'type':_0x2c5dc8[_0x1dc7('0x3e')][_0x1dc7('0x3f')]};});_0x16822f[_0x1dc7('0x40')]=_['map'](_0x4d5e3d,_0x1dc7('0x38'));_0x16822f[_0x1dc7('0x41')]=_[_0x1dc7('0x42')](_0x5df0d5['query']);_0x16822f['filters']=_['intersection'](_0x16822f[_0x1dc7('0x40')],_0x16822f[_0x1dc7('0x41')]);_0x50b1fd[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0x16822f[_0x1dc7('0x40')],qs[_0x1dc7('0x45')](_0x5df0d5[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0x50b1fd[_0x1dc7('0x43')]=_0x50b1fd[_0x1dc7('0x43')][_0x1dc7('0x46')]?_0x50b1fd[_0x1dc7('0x43')]:_0x16822f[_0x1dc7('0x40')];if(!_0x5df0d5[_0x1dc7('0x41')]['hasOwnProperty'](_0x1dc7('0x47'))){_0x50b1fd[_0x1dc7('0x2d')]=qs['limit'](_0x5df0d5['query'][_0x1dc7('0x2d')]);_0x50b1fd[_0x1dc7('0x2c')]=qs[_0x1dc7('0x2c')](_0x5df0d5[_0x1dc7('0x41')]['offset']);}_0x50b1fd[_0x1dc7('0x48')]=qs['sort'](_0x5df0d5['query'][_0x1dc7('0x49')]);_0x50b1fd[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_[_0x1dc7('0x4c')](_0x5df0d5[_0x1dc7('0x41')],_0x16822f[_0x1dc7('0x4b')]),_0x4d5e3d);if(_0x5df0d5['query'][_0x1dc7('0x4d')]){_0x50b1fd[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0x50b1fd[_0x1dc7('0x4a')],{'$or':_[_0x1dc7('0x3b')](_0x4d5e3d,function(_0x231014){if(_0x231014[_0x1dc7('0x3e')]!==_0x1dc7('0x4f')){var _0x4ca98d={};_0x4ca98d[_0x231014[_0x1dc7('0x38')]]={'$like':'%'+_0x5df0d5['query'][_0x1dc7('0x4d')]+'%'};return _0x4ca98d;}})});}_0x50b1fd=_[_0x1dc7('0x4e')]({},_0x50b1fd,_0x5df0d5[_0x1dc7('0x50')]);var _0x191848={'where':_0x50b1fd[_0x1dc7('0x4a')]};return db[_0x1dc7('0x3c')][_0x1dc7('0x2f')](_0x191848)[_0x1dc7('0x33')](function(_0x351d1f){_0x2a11a0[_0x1dc7('0x2f')]=_0x351d1f;if(_0x5df0d5[_0x1dc7('0x41')][_0x1dc7('0x51')]){_0x50b1fd[_0x1dc7('0x52')]=[{'all':!![]}];}return db[_0x1dc7('0x3c')][_0x1dc7('0x53')](_0x50b1fd);})['then'](function(_0x4787c9){_0x2a11a0[_0x1dc7('0x54')]=_0x4787c9;return _0x2a11a0;})['then'](respondWithFilteredResult(_0xafe108,_0x50b1fd))[_0x1dc7('0x28')](handleError(_0xafe108,null));};exports[_0x1dc7('0x55')]=function(_0x508f33,_0x298245){var _0x2b1dfc={'raw':![],'where':{'id':_0x508f33[_0x1dc7('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x1dc7('0x3a')}]},_0x78d502={};_0x78d502[_0x1dc7('0x40')]=_['keys'](db[_0x1dc7('0x3c')][_0x1dc7('0x3d')]);_0x78d502[_0x1dc7('0x41')]=_[_0x1dc7('0x42')](_0x508f33[_0x1dc7('0x41')]);_0x78d502[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0x78d502[_0x1dc7('0x40')],_0x78d502[_0x1dc7('0x41')]);_0x2b1dfc['attributes']=_[_0x1dc7('0x44')](_0x78d502[_0x1dc7('0x40')],qs['fields'](_0x508f33[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0x2b1dfc[_0x1dc7('0x43')]=_0x2b1dfc['attributes'][_0x1dc7('0x46')]?_0x2b1dfc[_0x1dc7('0x43')]:_0x78d502['model'];if(_0x508f33['query']['includeAll']){_0x2b1dfc[_0x1dc7('0x52')]=[{'all':!![]}];}_0x2b1dfc=_[_0x1dc7('0x4e')]({},_0x2b1dfc,_0x508f33[_0x1dc7('0x50')]);return db['SmsAccount'][_0x1dc7('0x57')](_0x2b1dfc)[_0x1dc7('0x33')](handleEntityNotFound(_0x298245,null))[_0x1dc7('0x33')](respondWithResult(_0x298245,null))[_0x1dc7('0x28')](handleError(_0x298245,null));};exports[_0x1dc7('0x58')]=function(_0x583648,_0x470e5e){return db[_0x1dc7('0x3c')][_0x1dc7('0x58')](_0x583648[_0x1dc7('0x59')],{})[_0x1dc7('0x33')](function(_0x36fc40){var _0x2d74b4=_0x583648[_0x1dc7('0x5a')]['get']({'plain':!![]});if(!_0x2d74b4)throw new Error(_0x1dc7('0x5b'));if(_0x2d74b4[_0x1dc7('0x5c')]==='user'){var _0x2cea6f=_0x36fc40[_0x1dc7('0x5d')]({'plain':!![]});var _0x5f1543='SmsAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x5f1543,'userProfileId':_0x2d74b4['userProfileId']},'raw':!![]})[_0x1dc7('0x33')](function(_0x2cbc1b){if(_0x2cbc1b&&_0x2cbc1b[_0x1dc7('0x5e')]===0x0){return db['UserProfileResource'][_0x1dc7('0x58')]({'name':_0x2cea6f[_0x1dc7('0x38')],'resourceId':_0x2cea6f['id'],'type':_0x2cbc1b[_0x1dc7('0x38')],'sectionId':_0x2cbc1b['id']},{})[_0x1dc7('0x33')](function(){return _0x36fc40;});}else{return _0x36fc40;}})[_0x1dc7('0x28')](function(_0x23fab6){logger['error'](_0x1dc7('0x5f'),_0x23fab6);throw _0x23fab6;});}return _0x36fc40;})[_0x1dc7('0x33')](respondWithResult(_0x470e5e,0xc9))['catch'](handleError(_0x470e5e,null));};exports['update']=function(_0x105db7,_0x1b93ac){if(_0x105db7[_0x1dc7('0x59')]['id']){delete _0x105db7[_0x1dc7('0x59')]['id'];}return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x105db7['params']['id']},'include':[{'model':db[_0x1dc7('0x60')],'as':_0x1dc7('0x3a')}]})[_0x1dc7('0x33')](handleEntityNotFound(_0x1b93ac,null))['then'](saveUpdates(_0x105db7[_0x1dc7('0x59')],null))[_0x1dc7('0x33')](respondWithResult(_0x1b93ac,null))[_0x1dc7('0x28')](handleError(_0x1b93ac,null));};exports['destroy']=function(_0xb47fe1,_0x536cc8){return db[_0x1dc7('0x3c')]['find']({'where':{'id':_0xb47fe1[_0x1dc7('0x56')]['id']}})['then'](handleEntityNotFound(_0x536cc8,null))['then'](removeEntity(_0x536cc8,null))[_0x1dc7('0x28')](handleError(_0x536cc8,null));};exports[_0x1dc7('0x61')]=function(_0x59afca,_0x52cc93){return db[_0x1dc7('0x3c')][_0x1dc7('0x61')]()[_0x1dc7('0x33')](respondWithResult(_0x52cc93,null))[_0x1dc7('0x28')](handleError(_0x52cc93,null));};exports['addDisposition']=function(_0x4c118e,_0x538403,_0x33bf8c){if(_0x4c118e[_0x1dc7('0x59')]['id']){delete _0x4c118e[_0x1dc7('0x59')]['id'];}return db[_0x1dc7('0x3c')][_0x1dc7('0x57')]({'where':{'id':_0x4c118e['params']['id']}})['then'](handleEntityNotFound(_0x538403,null))['then'](function(_0x1992eb){if(_0x1992eb){_0x4c118e[_0x1dc7('0x59')][_0x1dc7('0x62')]=_0x1992eb['id'];return db['Disposition']['create'](_0x4c118e[_0x1dc7('0x59')]);}})['then'](respondWithResult(_0x538403,null))['catch'](handleError(_0x538403,null));};exports[_0x1dc7('0x63')]=function(_0x14700b,_0x31a63c,_0x54501b){var _0x1c9f47={'raw':![],'where':{}};var _0x6d4675={};var _0x4ad8f1={'count':0x0,'rows':[]};return db[_0x1dc7('0x3c')][_0x1dc7('0x64')]({'where':{'id':_0x14700b[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x31a63c,null))[_0x1dc7('0x33')](function(_0x8c7f6a){if(_0x8c7f6a){_0x6d4675[_0x1dc7('0x40')]=_[_0x1dc7('0x42')](db[_0x1dc7('0x65')][_0x1dc7('0x3d')]);_0x6d4675[_0x1dc7('0x41')]=_['keys'](_0x14700b[_0x1dc7('0x41')]);_0x6d4675[_0x1dc7('0x4b')]=_['intersection'](_0x6d4675[_0x1dc7('0x40')],_0x6d4675['query']);_0x1c9f47[_0x1dc7('0x43')]=_['intersection'](_0x6d4675[_0x1dc7('0x40')],qs['fields'](_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0x1c9f47['attributes']=_0x1c9f47['attributes'][_0x1dc7('0x46')]?_0x1c9f47[_0x1dc7('0x43')]:_0x6d4675[_0x1dc7('0x40')];if(!_0x14700b['query'][_0x1dc7('0x66')](_0x1dc7('0x47'))){_0x1c9f47[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x14700b['query'][_0x1dc7('0x2d')]);_0x1c9f47[_0x1dc7('0x2c')]=qs['offset'](_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x2c')]);}_0x1c9f47['order']=qs[_0x1dc7('0x49')](_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x49')]);_0x1c9f47[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_['pick'](_0x14700b[_0x1dc7('0x41')],_0x6d4675[_0x1dc7('0x4b')]));_0x1c9f47[_0x1dc7('0x4a')]['SmsAccountId']=_0x8c7f6a['id'];if(_0x14700b['query'][_0x1dc7('0x4d')]){_0x1c9f47[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0x1c9f47[_0x1dc7('0x4a')],{'$or':_[_0x1dc7('0x3b')](_0x1c9f47[_0x1dc7('0x43')],function(_0x43e9a3){var _0x59020e={};_0x59020e[_0x43e9a3]={'$like':'%'+_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x4d')]+'%'};return _0x59020e;})});}_0x1c9f47=_[_0x1dc7('0x4e')]({},_0x1c9f47,_0x14700b[_0x1dc7('0x50')]);return db[_0x1dc7('0x65')][_0x1dc7('0x2f')]({'where':_0x1c9f47['where']})[_0x1dc7('0x33')](function(_0x42def9){_0x4ad8f1[_0x1dc7('0x2f')]=_0x42def9;if(_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x51')]){_0x1c9f47[_0x1dc7('0x52')]=[{'all':!![]}];}return db[_0x1dc7('0x65')][_0x1dc7('0x53')](_0x1c9f47);})[_0x1dc7('0x33')](function(_0xcf21f9){_0x4ad8f1[_0x1dc7('0x54')]=_0xcf21f9;return _0x4ad8f1;});}})[_0x1dc7('0x33')](respondWithFilteredResult(_0x31a63c,_0x1c9f47))[_0x1dc7('0x28')](handleError(_0x31a63c,null));};exports[_0x1dc7('0x67')]=function(_0x21e3e4,_0x3ad20b,_0x1adc5e){return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x21e3e4['params']['id']}})['then'](handleEntityNotFound(_0x3ad20b,null))[_0x1dc7('0x33')](function(_0x272157){if(_0x272157){return _0x272157[_0x1dc7('0x67')](_0x21e3e4[_0x1dc7('0x41')][_0x1dc7('0x68')]);}})['then'](respondWithStatusCode(_0x3ad20b,null))[_0x1dc7('0x28')](handleError(_0x3ad20b,null));};exports[_0x1dc7('0x69')]=function(_0x3b66c9,_0x2385c2,_0x327a2b){if(_0x3b66c9[_0x1dc7('0x59')]['id']){delete _0x3b66c9['body']['id'];}return db[_0x1dc7('0x3c')][_0x1dc7('0x57')]({'where':{'id':_0x3b66c9['params']['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x2385c2,null))[_0x1dc7('0x33')](function(_0x53e4c8){if(_0x53e4c8){_0x3b66c9[_0x1dc7('0x59')][_0x1dc7('0x62')]=_0x53e4c8['id'];return db['CannedAnswer']['create'](_0x3b66c9[_0x1dc7('0x59')]);}})['then'](respondWithResult(_0x2385c2,null))[_0x1dc7('0x28')](handleError(_0x2385c2,null));};exports['getAnswers']=function(_0x8cf6fa,_0x35f698,_0xe30886){var _0x586d8a={'raw':![],'where':{}};var _0x50a97e={};var _0x58f84f={'count':0x0,'rows':[]};return db[_0x1dc7('0x3c')]['findOne']({'where':{'id':_0x8cf6fa[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x35f698,null))[_0x1dc7('0x33')](function(_0x257e9c){if(_0x257e9c){_0x50a97e['model']=_[_0x1dc7('0x42')](db[_0x1dc7('0x6a')][_0x1dc7('0x3d')]);_0x50a97e[_0x1dc7('0x41')]=_['keys'](_0x8cf6fa['query']);_0x50a97e[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0x50a97e[_0x1dc7('0x40')],_0x50a97e[_0x1dc7('0x41')]);_0x586d8a[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0x50a97e[_0x1dc7('0x40')],qs[_0x1dc7('0x45')](_0x8cf6fa[_0x1dc7('0x41')]['fields']));_0x586d8a[_0x1dc7('0x43')]=_0x586d8a[_0x1dc7('0x43')][_0x1dc7('0x46')]?_0x586d8a[_0x1dc7('0x43')]:_0x50a97e['model'];if(!_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x66')]('nolimit')){_0x586d8a[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x8cf6fa[_0x1dc7('0x41')]['limit']);_0x586d8a[_0x1dc7('0x2c')]=qs['offset'](_0x8cf6fa[_0x1dc7('0x41')]['offset']);}_0x586d8a['order']=qs[_0x1dc7('0x49')](_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x49')]);_0x586d8a[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_[_0x1dc7('0x4c')](_0x8cf6fa[_0x1dc7('0x41')],_0x50a97e['filters']));_0x586d8a[_0x1dc7('0x4a')]['SmsAccountId']=_0x257e9c['id'];if(_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x4d')]){_0x586d8a['where']=_[_0x1dc7('0x4e')](_0x586d8a['where'],{'$or':_['map'](_0x586d8a[_0x1dc7('0x43')],function(_0x25f4f4){var _0x26b34c={};_0x26b34c[_0x25f4f4]={'$like':'%'+_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x4d')]+'%'};return _0x26b34c;})});}_0x586d8a=_[_0x1dc7('0x4e')]({},_0x586d8a,_0x8cf6fa['options']);return db[_0x1dc7('0x6a')]['count']({'where':_0x586d8a[_0x1dc7('0x4a')]})[_0x1dc7('0x33')](function(_0x169455){_0x58f84f[_0x1dc7('0x2f')]=_0x169455;if(_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x51')]){_0x586d8a[_0x1dc7('0x52')]=[{'all':!![]}];}return db[_0x1dc7('0x6a')]['findAll'](_0x586d8a);})[_0x1dc7('0x33')](function(_0x350530){_0x58f84f['rows']=_0x350530;return _0x58f84f;});}})[_0x1dc7('0x33')](respondWithFilteredResult(_0x35f698,_0x586d8a))[_0x1dc7('0x28')](handleError(_0x35f698,null));};exports[_0x1dc7('0x6b')]=function(_0x41f26d,_0x215d59,_0x456e2a){return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x41f26d[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x215d59,null))['then'](function(_0x5dafe0){if(_0x5dafe0){return _0x5dafe0[_0x1dc7('0x6b')](_0x41f26d[_0x1dc7('0x41')][_0x1dc7('0x68')]);}})['then'](respondWithStatusCode(_0x215d59,null))[_0x1dc7('0x28')](handleError(_0x215d59,null));};exports['notify']=function(_0x501e90,_0x16e458,_0x4f3bdb){var _0x51ed43={'channel':_0x1dc7('0x6c')};var _0xada450=[];var _0xe1d2eb=[];var _0x18cd93={};return db[_0x1dc7('0x3c')]['find']({'where':{'id':_0x501e90[_0x1dc7('0x56')]['id']},'include':[{'model':db[_0x1dc7('0x6d')],'as':_0x1dc7('0x6e')}]})[_0x1dc7('0x33')](handleEntityNotFound(_0x16e458,null))[_0x1dc7('0x33')](function(_0x258d8d){_0x51ed43[_0x1dc7('0x6f')]=_0x258d8d;_0x51ed43[_0x1dc7('0x70')]=_[_0x1dc7('0x71')](_0x258d8d[_0x1dc7('0x6e')],['priority'],['asc']);if(_0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0x6e')]){delete _0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0x6e')];}return db['CmContact'][_0x1dc7('0x61')]();})[_0x1dc7('0x33')](function(_0x39c597){if(!_0x39c597){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))](_0x1dc7('0x74'));}_0xada450=_[_0x1dc7('0x75')](_[_0x1dc7('0x42')](_0x39c597),['createdAt',_0x1dc7('0x76')]);_0xe1d2eb=_[_0x1dc7('0x75')](_[_0x1dc7('0x42')](_0x39c597),[_0x1dc7('0x77'),_0x1dc7('0x76'),_0x1dc7('0x78'),_0x1dc7('0x79')]);_0x51ed43['body']={'mapKey':_0x1dc7('0x7a')};if(_0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0x3e')]){switch(_0x51ed43['account']['type']){case _0x1dc7('0x7b'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x7d')];_0x51ed43[_0x1dc7('0x59')]['body']=_0x501e90['body']['Body'];_0x51ed43['body']['messageId']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x7e')];break;case _0x1dc7('0x7f'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]='+'+_0x501e90[_0x1dc7('0x59')]['sender'];_0x51ed43[_0x1dc7('0x59')]['body']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x80')];break;case _0x1dc7('0x81'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x7c')];_0x51ed43['body']['body']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x26')];break;case _0x1dc7('0x82'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')]['from'];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x59')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x84')];break;case _0x1dc7('0x85'):_0x51ed43[_0x1dc7('0x59')]['from']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x7d')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x86')];_0x51ed43['body'][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x87')];break;case _0x1dc7('0x88'):_0x51ed43['body']['from']='+'+_0x501e90[_0x1dc7('0x59')]['results'][0x0]['from'];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x89')][0x0][_0x1dc7('0x80')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x89')][0x0][_0x1dc7('0x83')];break;case _0x1dc7('0x8a'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x8b')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x8c')][_0x1dc7('0x26')];break;case _0x1dc7('0x8d'):_0x51ed43['body'][_0x1dc7('0x7c')]=_0x501e90['body']['fromNumber'];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90['body'][_0x1dc7('0x80')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')]['replyMessageId'];break;case _0x1dc7('0x8e'):_0x51ed43['body'][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')][0x0]['message']['id'];_0x51ed43[_0x1dc7('0x59')]['from']=_0x501e90[_0x1dc7('0x59')][0x0][_0x1dc7('0x26')][_0x1dc7('0x7c')];_0x51ed43['body']['body']=_0x501e90[_0x1dc7('0x59')][0x0][_0x1dc7('0x26')][_0x1dc7('0x80')];break;case _0x1dc7('0x8f'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')]['from'];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90['body'][_0x1dc7('0x26')];_0x51ed43[_0x1dc7('0x59')]['messageId']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x90')];break;}}if(_0x51ed43['body']['id']){delete _0x51ed43['body']['id'];}if(_[_0x1dc7('0x91')](_0x51ed43['body']['from'])){throw new db['Sequelize'][(_0x1dc7('0x73'))](_0x1dc7('0x92'));}if(_[_0x1dc7('0x91')](_0x51ed43['body']['body'])||_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]===''){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))](_0x1dc7('0x93'));}if(_[_0x1dc7('0x91')](_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x94')])){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe1d2eb);}if(!_[_0x1dc7('0x95')](_0xe1d2eb,_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x94')])){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))](_0x1dc7('0x96')+_0xe1d2eb);}_0x18cd93[_0x51ed43[_0x1dc7('0x59')]['mapKey']]=_0x51ed43['body'][_0x1dc7('0x7c')];return db[_0x1dc7('0x97')][_0x1dc7('0x57')]({'where':{'id':_0x51ed43[_0x1dc7('0x6f')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x1dc7('0x98'),'where':_0x18cd93,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x1dc7('0x33')](handleEntityNotFound(_0x16e458,null))[_0x1dc7('0x33')](function(_0xaecff4){if(_0xaecff4){_0x51ed43[_0x1dc7('0x99')]=_[_0x1dc7('0x9a')](_0xaecff4,[_0x1dc7('0x98')]);if(_0xaecff4[_0x1dc7('0x98')]['length']){return _0xaecff4['Contacts'][0x0];}var _0x2d442f=_[_0x1dc7('0x1a')](_0x51ed43[_0x1dc7('0x59')],{'firstName':_0x51ed43['body'][_0x1dc7('0x7c')],'ListId':_0xaecff4['id']});_0x2d442f[_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x94')]]=_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')];return db[_0x1dc7('0x9b')][_0x1dc7('0x58')](_0x2d442f,{'fields':_0xada450,'raw':!![]});}})[_0x1dc7('0x33')](handleEntityNotFound(_0x16e458,null))[_0x1dc7('0x33')](function(_0x11ff7f){if(_0x11ff7f){_0x51ed43[_0x1dc7('0x9c')]=_0x11ff7f;var _0x543cb5={'ContactId':_0x11ff7f['id'],'phone':_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')],'SmsAccountId':_0x501e90[_0x1dc7('0x56')]['id']};var _0x585c25={'ContactId':_0x11ff7f['id'],'SmsAccountId':_0x501e90['params']['id'],'closed':![]};return db['SmsInteraction'][_0x1dc7('0x57')]({'where':_0x585c25})[_0x1dc7('0x33')](function(_0x20b208){if(_0x20b208){return[_0x20b208,![]];}return db[_0x1dc7('0x9d')][_0x1dc7('0x58')](_0x543cb5)[_0x1dc7('0x33')](function(_0x1b2e94){return[_0x1b2e94,!![]];});});}})[_0x1dc7('0x9e')](function(_0x2baab9,_0x24e6d5){_0x51ed43[_0x1dc7('0x9f')]=_0x2baab9[_0x1dc7('0x5d')]({'plain':!![]});_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xa0')]=![];if(_0x24e6d5){if(_0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0xa1')]){_0x51ed43['applications'][_0x1dc7('0xa2')]({'id':0x0,'priority':_0x51ed43[_0x1dc7('0x70')][_0x1dc7('0x46')]+0x1,'app':_0x1dc7('0xa3'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xa0')]=!![];}return db[_0x1dc7('0xa4')][_0x1dc7('0x58')]({'phone':_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')],'messageId':_0x51ed43['body'][_0x1dc7('0x83')],'body':_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')],'SmsAccountId':_0x501e90[_0x1dc7('0x56')]['id'],'SmsInteractionId':_0x2baab9['id'],'direction':'in','ContactId':_0x2baab9[_0x1dc7('0xa5')],'AttachmentId':_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0xa6')]});})['then'](function(_0x54e8d6){_0x51ed43['message']=_0x54e8d6;if(!_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xa7')])return;return db[_0x1dc7('0xa8')]['find']({'attributes':['id','name'],'where':{'id':_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xa7')]}});})[_0x1dc7('0x33')](function(_0xef2d08){if(_0xef2d08){_0x51ed43[_0x1dc7('0x70')][_0x1dc7('0xa9')]({'id':0x0,'priority':0x0,'app':_0x1dc7('0xaa'),'appdata':_0xef2d08[_0x1dc7('0x38')]+','+(_0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0xab')]||0xa),'interval':_0x1dc7('0xac')});}if(!_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xad')])return;return db[_0x1dc7('0xae')][_0x1dc7('0x57')]({'attributes':['id',_0x1dc7('0x38')],'where':{'id':_0x51ed43['interaction'][_0x1dc7('0xad')]}});})[_0x1dc7('0x33')](function(_0x204a75){if(_0x204a75){_0x51ed43[_0x1dc7('0x70')][_0x1dc7('0xa9')]({'id':0x0,'priority':0x1,'app':_0x1dc7('0xaf'),'appdata':_0x204a75['name']+','+(_0x51ed43[_0x1dc7('0x6f')]['waitForTheAssignedQueue']||0x12c),'interval':_0x1dc7('0xac')});}return respondWithRpcPromise(_0x1dc7('0xb0'),_0x1dc7('0xb1'),_0x51ed43);})[_0x1dc7('0x33')](function(_0x3a30e7){if(_0x3a30e7){var _0x426acb=0xc8;var _0x1957d3='receiveMessage';logger[_0x1dc7('0x20')](_0x1dc7('0xb2'),_0x1957d3,_0x426acb,'entity\x20found');logger[_0x1dc7('0x23')](_0x1dc7('0xb3'),_0x1957d3,_0x426acb,_0x1dc7('0xb4'),JSON[_0x1dc7('0xb5')](_0x3a30e7));if(_0x51ed43['account']['type']===_0x1dc7('0x7b')){return _0x16e458[_0x1dc7('0x2a')](_0x426acb)[_0x1dc7('0x30')]('Content-Type',_0x1dc7('0xb6'))[_0x1dc7('0xb7')]('\x0a');}else{return _0x16e458[_0x1dc7('0x2a')](_0x426acb)[_0x1dc7('0x2b')](_0x3a30e7);}}})[_0x1dc7('0x28')](handleError(_0x16e458,null));};exports[_0x1dc7('0xb8')]=function(_0x11f3d2,_0x27d63c){var _0xaaf521=_0x11f3d2['params']['id'];var _0x58a68e=_0x11f3d2['body'];var _0x2b8f5a=0xc8;var _0x3e0fbc=null;return db[_0x1dc7('0xb9')][_0x1dc7('0xba')]({'isolationLevel':db['sequelize'][_0x1dc7('0xbb')][_0x1dc7('0xbc')][_0x1dc7('0xbd')]},function(_0x25ba97){return db[_0x1dc7('0x3c')][_0x1dc7('0x64')]({'where':{'id':_0xaaf521},'transaction':_0x25ba97})[_0x1dc7('0x33')](function(_0xee5333){if(_0xee5333){return db['SmsApplication'][_0x1dc7('0x34')]({'where':{'SmsAccountId':_0xaaf521},'transaction':_0x25ba97})[_0x1dc7('0x33')](function(){var _0x3fab30=_['map'](_0x58a68e,function(_0x2a52ca){_0x2a52ca['SmsAccountId']=_0xaaf521;return _0x2a52ca;});return db[_0x1dc7('0x6d')][_0x1dc7('0xbe')](_0x3fab30,{'transaction':_0x25ba97});});}else{_0x2b8f5a=0x194;_0x3e0fbc=[];}});})[_0x1dc7('0x33')](function(){if(_0x2b8f5a!==0x194){return db[_0x1dc7('0x6d')][_0x1dc7('0xbf')]({'where':{'SmsAccountId':_0xaaf521},'order':_0x1dc7('0xc0')})[_0x1dc7('0x33')](function(_0x3d88c5){_0x3e0fbc=_0x3d88c5;});}})[_0x1dc7('0x28')](function(_0x2da04a){_0x2b8f5a=0x1f4;logger[_0x1dc7('0x24')](_0x2da04a['stack']);if(_0x2da04a[_0x1dc7('0x38')]){delete _0x2da04a[_0x1dc7('0x38')];}_0x3e0fbc=_0x2da04a;})['finally'](function(){if(_0x3e0fbc===null){_0x27d63c['sendStatus'](_0x2b8f5a);}else{if(_0x2b8f5a===0x1f4){_0x27d63c[_0x1dc7('0x2a')](_0x2b8f5a)[_0x1dc7('0xb7')](_0x3e0fbc);}else{_0x27d63c[_0x1dc7('0x2a')](_0x2b8f5a)[_0x1dc7('0x2b')](_0x3e0fbc);}}});};exports[_0x1dc7('0xc1')]=function(_0x345851,_0x18167f,_0x2a75ef){var _0x1b5ade={};var _0x2eec8d={};var _0x53021c;var _0x1cad63;return db[_0x1dc7('0x3c')][_0x1dc7('0x64')]({'where':{'id':_0x345851[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x18167f,null))['then'](function(_0x25b631){if(_0x25b631){_0x53021c=_0x25b631;_0x2eec8d['model']=_[_0x1dc7('0x42')](db[_0x1dc7('0x6d')][_0x1dc7('0x3d')]);_0x2eec8d[_0x1dc7('0x41')]=_[_0x1dc7('0x42')](_0x345851['query']);_0x2eec8d[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0x2eec8d[_0x1dc7('0x40')],_0x2eec8d[_0x1dc7('0x41')]);_0x1b5ade[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0x2eec8d[_0x1dc7('0x40')],qs[_0x1dc7('0x45')](_0x345851['query'][_0x1dc7('0x45')]));_0x1b5ade[_0x1dc7('0x43')]=_0x1b5ade['attributes'][_0x1dc7('0x46')]?_0x1b5ade[_0x1dc7('0x43')]:_0x2eec8d[_0x1dc7('0x40')];_0x1b5ade[_0x1dc7('0x48')]=qs['sort'](_0x345851[_0x1dc7('0x41')][_0x1dc7('0x49')]);_0x1b5ade[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_['pick'](_0x345851['query'],_0x2eec8d[_0x1dc7('0x4b')]));if(_0x345851[_0x1dc7('0x41')][_0x1dc7('0x4d')]){_0x1b5ade[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0x1b5ade['where'],{'$or':_['map'](_0x1b5ade[_0x1dc7('0x43')],function(_0x1c76a0){var _0x5e70f2={};_0x5e70f2[_0x1c76a0]={'$like':'%'+_0x345851[_0x1dc7('0x41')][_0x1dc7('0x4d')]+'%'};return _0x5e70f2;})});}_0x1b5ade=_['merge']({},_0x1b5ade,_0x345851['options']);return _0x53021c[_0x1dc7('0xc1')](_0x1b5ade);}})[_0x1dc7('0x33')](function(_0x408864){if(_0x408864){_0x1cad63=_0x408864[_0x1dc7('0x46')];if(!_0x345851['query']['hasOwnProperty'](_0x1dc7('0x47'))){_0x1b5ade[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x345851[_0x1dc7('0x41')][_0x1dc7('0x2d')]);_0x1b5ade[_0x1dc7('0x2c')]=qs[_0x1dc7('0x2c')](_0x345851['query'][_0x1dc7('0x2c')]);}return _0x53021c[_0x1dc7('0xc1')](_0x1b5ade);}})[_0x1dc7('0x33')](function(_0x6bafba){if(_0x6bafba){return _0x6bafba?{'count':_0x1cad63,'rows':_0x6bafba}:null;}})['then'](respondWithResult(_0x18167f,null))[_0x1dc7('0x28')](handleError(_0x18167f,null));};exports[_0x1dc7('0xc2')]=function(_0x4555a3,_0x11b709,_0x2930ba){var _0xbf8a39={'raw':![],'where':{}};var _0x2accf0={};var _0x50f950={'count':0x0,'rows':[]};return db[_0x1dc7('0x3c')][_0x1dc7('0x64')]({'where':{'id':_0x4555a3[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x11b709,null))[_0x1dc7('0x33')](function(_0x33e1bd){if(_0x33e1bd){_0x2accf0[_0x1dc7('0x40')]=_[_0x1dc7('0x42')](db[_0x1dc7('0x9d')][_0x1dc7('0x3d')]);_0x2accf0[_0x1dc7('0x41')]=_['keys'](_0x4555a3[_0x1dc7('0x41')]);_0x2accf0[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0x2accf0[_0x1dc7('0x40')],_0x2accf0[_0x1dc7('0x41')]);_0xbf8a39[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0x2accf0[_0x1dc7('0x40')],qs[_0x1dc7('0x45')](_0x4555a3[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0xbf8a39[_0x1dc7('0x43')]=_0xbf8a39['attributes'][_0x1dc7('0x46')]?_0xbf8a39[_0x1dc7('0x43')]:_0x2accf0[_0x1dc7('0x40')];if(!_0x4555a3[_0x1dc7('0x41')][_0x1dc7('0x66')](_0x1dc7('0x47'))){_0xbf8a39[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x4555a3[_0x1dc7('0x41')][_0x1dc7('0x2d')]);_0xbf8a39[_0x1dc7('0x2c')]=qs[_0x1dc7('0x2c')](_0x4555a3[_0x1dc7('0x41')][_0x1dc7('0x2c')]);}_0xbf8a39[_0x1dc7('0x48')]=qs['sort'](_0x4555a3[_0x1dc7('0x41')]['sort']);_0xbf8a39[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_[_0x1dc7('0x4c')](_0x4555a3[_0x1dc7('0x41')],_0x2accf0[_0x1dc7('0x4b')]));_0xbf8a39[_0x1dc7('0x4a')][_0x1dc7('0x62')]=_0x33e1bd['id'];if(_0x4555a3['query'][_0x1dc7('0x4d')]){_0xbf8a39[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0xbf8a39['where'],{'$or':_['map'](_0xbf8a39[_0x1dc7('0x43')],function(_0x4768d2){var _0x8320b={};_0x8320b[_0x4768d2]={'$like':'%'+_0x4555a3['query'][_0x1dc7('0x4d')]+'%'};return _0x8320b;})});}_0xbf8a39=_[_0x1dc7('0x4e')]({},_0xbf8a39,_0x4555a3[_0x1dc7('0x50')]);return db[_0x1dc7('0x9d')]['count']({'where':_0xbf8a39[_0x1dc7('0x4a')]})[_0x1dc7('0x33')](function(_0x39d58b){_0x50f950[_0x1dc7('0x2f')]=_0x39d58b;if(_0x4555a3[_0x1dc7('0x41')]['includeAll']){_0xbf8a39[_0x1dc7('0x52')]=[{'model':db[_0x1dc7('0x9b')],'as':_0x1dc7('0xc3'),'required':![]},{'model':db[_0x1dc7('0xa8')],'as':_0x1dc7('0xc4'),'attributes':[_0x1dc7('0x38'),'fullname',_0x1dc7('0xc5')],'required':![]},{'model':db['Tag'],'as':_0x1dc7('0xc6'),'attributes':['id',_0x1dc7('0x38'),_0x1dc7('0xc7')],'where':_0x4555a3['query']['tag']?{'id':_0x4555a3[_0x1dc7('0x41')]['tag']}:undefined,'required':_0x4555a3[_0x1dc7('0x41')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x1dc7('0x53')](_0xbf8a39);})['then'](function(_0x2a7ac5){_0x50f950[_0x1dc7('0x54')]=_0x2a7ac5;return _0x50f950;});}})[_0x1dc7('0x33')](respondWithFilteredResult(_0x11b709,_0xbf8a39))[_0x1dc7('0x28')](handleError(_0x11b709,null));};exports['send']=function(_0x7ae488,_0x33668f,_0x42f576){var _0x59cda4,_0x2b6fe9,_0x1dcd26;if(_[_0x1dc7('0x91')](_0x7ae488[_0x1dc7('0x59')][_0x1dc7('0x59')])||_0x7ae488[_0x1dc7('0x59')][_0x1dc7('0x59')]===''){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))](_0x1dc7('0x93'));}if(_['isNil'](_0x7ae488[_0x1dc7('0x59')]['to'])){throw new db['Sequelize'][(_0x1dc7('0x73'))]('to\x20is\x20mandatory');}_0x59cda4=_0x7ae488[_0x1dc7('0x59')]['to'];return db[_0x1dc7('0x3c')][_0x1dc7('0x57')]({'where':{'id':_0x7ae488[_0x1dc7('0x56')]['id']},'include':[{'model':db[_0x1dc7('0x97')],'as':'List','include':[{'model':db[_0x1dc7('0x9b')],'as':'Contacts','where':{'mobile':_0x59cda4},'limit':0x1,'order':[[_0x1dc7('0x76'),_0x1dc7('0xc8')]]}]}]})[_0x1dc7('0x33')](handleEntityNotFound(_0x33668f,null))[_0x1dc7('0x33')](function(_0x3f56e0){if(_0x3f56e0&&_0x3f56e0[_0x1dc7('0xc9')]){_0x2b6fe9=_0x3f56e0['get']({'plain':!![]});if(_0x2b6fe9[_0x1dc7('0xc9')]&&_0x2b6fe9['List'][_0x1dc7('0x98')][_0x1dc7('0x46')]){return _0x2b6fe9[_0x1dc7('0xc9')][_0x1dc7('0x98')][0x0];}return db['CmContact']['create'](_['defaults'](_0x7ae488['body'],{'firstName':_0x59cda4,'mobile':_0x59cda4,'phone':_0x59cda4,'ListId':_0x2b6fe9[_0x1dc7('0x79')]}));}})['then'](handleEntityNotFound(_0x33668f,null))[_0x1dc7('0x33')](function(_0x529de7){if(_0x529de7){_0x1dcd26=_0x529de7;return db['SmsInteraction'][_0x1dc7('0x57')]({'where':{'ContactId':_0x1dcd26['id'],'closed':![],'SmsAccountId':_0x2b6fe9['id']}})['then'](function(_0x4a1fee){if(_0x4a1fee){return[_0x4a1fee,![]];}return db[_0x1dc7('0x9d')]['create']({'UserId':_0x7ae488[_0x1dc7('0x5a')]['id'],'ContactId':_0x1dcd26['id'],'SmsAccountId':_0x2b6fe9['id'],'phone':_0x59cda4,'firstMsgDirection':'out','Messages':[_[_0x1dc7('0x4e')](_0x7ae488[_0x1dc7('0x59')],{'read':![],'body':_0x7ae488['body'][_0x1dc7('0x59')],'phone':_0x59cda4,'SmsAccountId':_0x2b6fe9['id'],'UserId':_0x7ae488[_0x1dc7('0x5a')]['id'],'ContactId':_0x1dcd26['id']})]},{'include':[{'model':db[_0x1dc7('0xa4')],'as':_0x1dc7('0xca')}]})[_0x1dc7('0x33')](function(_0x960091){return[_0x960091,!![]];});});}})[_0x1dc7('0x9e')](function(_0x56f5a5,_0x298718){if(_0x298718){return _0x56f5a5;}return db[_0x1dc7('0xa4')]['create'](_[_0x1dc7('0x4e')](_0x7ae488[_0x1dc7('0x59')],{'read':![],'body':_0x7ae488[_0x1dc7('0x59')][_0x1dc7('0x59')],'phone':_0x59cda4,'SmsAccountId':_0x2b6fe9['id'],'SmsInteractionId':_0x56f5a5['id'],'UserId':_0x7ae488['user']['id'],'ContactId':_0x1dcd26['id']}))[_0x1dc7('0x33')](function(_0x58911b){_0x56f5a5[_0x1dc7('0xcb')]['Messages']=[];_0x56f5a5[_0x1dc7('0xcb')][_0x1dc7('0xca')][_0x1dc7('0xa2')](_0x58911b['dataValues']);return _0x56f5a5;});})[_0x1dc7('0x33')](respondWithResult(_0x33668f,null))[_0x1dc7('0x28')](handleError(_0x33668f,null));};exports['status']=function(_0x188ca4,_0x3292ea,_0x2dc499){if(_0x188ca4[_0x1dc7('0x59')]['id']){delete _0x188ca4[_0x1dc7('0x59')]['id'];}var _0x53ce86,_0x4b30f2,_0x4d7d25;return db[_0x1dc7('0x3c')]['find']({'where':{'id':_0x188ca4['params']['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x3292ea,null))['then'](function(_0x198b42){if(_0x198b42){_0x4d7d25=_0x198b42;logger[_0x1dc7('0x23')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),'received\x20delivery\x20report\x20from',_0x198b42[_0x1dc7('0x3e')],util['inspect'](_0x188ca4['body'],{'showHidden':![],'depth':null}));switch(_0x198b42['type']){case'skebby':if(_0x188ca4[_0x1dc7('0x59')]['skebby_dispatch_id']&&_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x2a')]){_0x4b30f2=_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x2a')];return db['SmsMessage'][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xcc')]}});}break;case _0x1dc7('0x81'):if(_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xcd')]&&_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xce')]){_0x4b30f2=_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xce')];return db[_0x1dc7('0xa4')][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')]['requestid']}});}break;case _0x1dc7('0x82'):if(_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x84')]&&_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xcf')]){_0x4b30f2=_0x188ca4['body'][_0x1dc7('0xcf')];return db[_0x1dc7('0xa4')]['find']({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x84')]}});}break;case _0x1dc7('0x88'):var _0x1811d0=_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x89')][0x0];if(_0x1811d0[_0x1dc7('0x83')]&&_0x1811d0[_0x1dc7('0x2a')]['groupName']===_0x1dc7('0xd0')){_0x4b30f2=_0x1811d0[_0x1dc7('0x2a')]['groupName'];return db[_0x1dc7('0xa4')]['find']({'where':{'messageId':_0x1811d0['messageId']}});}break;case'clickatell':if(_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x83')]&&_0x188ca4['body'][_0x1dc7('0x2a')]){_0x4b30f2=_0x188ca4['body'][_0x1dc7('0x2a')];return db['SmsMessage'][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')]['messageId']}});}break;case _0x1dc7('0x8e'):if(_0x188ca4[_0x1dc7('0x59')][0x0][_0x1dc7('0x26')]['id']){_0x4b30f2=_0x188ca4[_0x1dc7('0x59')][0x0][_0x1dc7('0x3e')];return db[_0x1dc7('0xa4')][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')][0x0][_0x1dc7('0x26')]['id']}});}break;case _0x1dc7('0x8f'):if(_0x188ca4['body'][_0x1dc7('0xd1')]&&_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x2a')]){_0x4b30f2=_0x188ca4[_0x1dc7('0x59')]['status'];return db[_0x1dc7('0xa4')][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xd1')]}});}break;}}})['then'](handleEntityNotFound(_0x3292ea,null))[_0x1dc7('0x33')](function(_0x3de22f){if(_0x3de22f){_0x53ce86=_0x3de22f;switch(_0x4d7d25['type']){case _0x1dc7('0x7f'):if(_0x4b30f2===_0x1dc7('0xd0')){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1dc7('0x7f'),util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x4b30f2==='1'){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x7f'),util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x82'):if(!_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xd4')]&&_0x4b30f2>=0xc8&&_0x4b30f2<=0xce){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x82'),util[_0x1dc7('0xd3')](_0x188ca4['body'],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x88'):var _0x10333f=_0x188ca4['body'][_0x1dc7('0x89')][0x0];if(_0x10333f['status'][_0x1dc7('0xd5')]===_0x1dc7('0xd0')){return _0x53ce86['update']({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x88'),util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x8d'):if(_0x4b30f2=='DELIVERED_TO_GATEWAY'||_0x4b30f2==_0x1dc7('0xd6')){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),'clickatell',util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x8e'):if(_0x4b30f2==_0x1dc7('0xd7')){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x8e'),util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x8f'):if(_0x4b30f2===_0x1dc7('0xd8')||_0x4b30f2===_0x1dc7('0xd9')){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),'intelepeer',util['inspect'](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x53ce86;}})[_0x1dc7('0x33')](respondWithResult(_0x3292ea,null))[_0x1dc7('0x28')](handleError(_0x3292ea,null));};exports[_0x1dc7('0xda')]=function(_0x528632,_0x5728e2,_0x5800f2){var _0x2ce399,_0x1bea9c,_0x149d7d;return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x528632['params']['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x5728e2,null))['then'](function(_0x3f8d3f){if(_0x3f8d3f){_0x149d7d=_0x3f8d3f;logger[_0x1dc7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1dc7('0x2a'),'received\x20delivery\x20report\x20from',_0x3f8d3f[_0x1dc7('0x3e')],util['inspect'](_0x528632[_0x1dc7('0x41')],{'showHidden':![],'depth':null}));switch(_0x3f8d3f[_0x1dc7('0x3e')]){case _0x1dc7('0x8a'):if(_0x528632['query'][_0x1dc7('0xdb')]&&_0x528632[_0x1dc7('0x41')][_0x1dc7('0xdc')]){_0x1bea9c=_0x528632[_0x1dc7('0x41')][_0x1dc7('0xdc')];return db[_0x1dc7('0xa4')][_0x1dc7('0x57')]({'where':{'messageId':_0x528632['query'][_0x1dc7('0xdb')]}});}break;}}})[_0x1dc7('0x33')](handleEntityNotFound(_0x5728e2,null))[_0x1dc7('0x33')](function(_0x4199b3){if(_0x4199b3){_0x2ce399=_0x4199b3;switch(_0x149d7d[_0x1dc7('0x3e')]){case _0x1dc7('0x8a'):if(_0x1bea9c==='2'||_0x1bea9c==='6'){return _0x2ce399[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x8a'),util['inspect'](_0x528632[_0x1dc7('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x2ce399;}})['then'](respondWithResult(_0x5728e2,null))[_0x1dc7('0x28')](handleError(_0x5728e2,null));};exports['addAgents']=function(_0x21eb0d,_0x147d88,_0x59339f){return db[_0x1dc7('0x3c')][_0x1dc7('0x57')]({'where':{'id':_0x21eb0d[_0x1dc7('0x56')]['id']}})['then'](handleEntityNotFound(_0x147d88,null))[_0x1dc7('0x33')](function(_0x1b01a8){if(_0x1b01a8){return _0x1b01a8['addAgents'](_0x21eb0d['body']['ids'],_['omit'](_0x21eb0d[_0x1dc7('0x59')],[_0x1dc7('0x68'),'id'])||{})['spread'](function(_0xaddf88){for(var _0x7711a9=0x0;_0x7711a9<_0x21eb0d[_0x1dc7('0x59')][_0x1dc7('0x68')][_0x1dc7('0x46')];_0x7711a9+=0x1){socket['emit'](_0x1dc7('0xdd'),{'UserId':Number(_0x21eb0d[_0x1dc7('0x59')][_0x1dc7('0x68')][_0x7711a9]),'SmsAccountId':Number(_0x21eb0d['params']['id'])});}return _0xaddf88;});}})['then'](respondWithResult(_0x147d88,null))[_0x1dc7('0x28')](handleError(_0x147d88,null));};exports['removeAgents']=function(_0x4ef951,_0x7cecb8,_0x5bcf50){return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x4ef951[_0x1dc7('0x56')]['id']}})['then'](handleEntityNotFound(_0x7cecb8,null))[_0x1dc7('0x33')](function(_0x51768a){if(_0x51768a){return _0x51768a[_0x1dc7('0xde')](_0x4ef951[_0x1dc7('0x41')][_0x1dc7('0x68')])['then'](function(){if(_[_0x1dc7('0xdf')](_0x4ef951['query'][_0x1dc7('0x68')])){for(var _0x3ffb1c=0x0;_0x3ffb1c<_0x4ef951[_0x1dc7('0x41')][_0x1dc7('0x68')][_0x1dc7('0x46')];_0x3ffb1c+=0x1){socket[_0x1dc7('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x4ef951['query'][_0x1dc7('0x68')][_0x3ffb1c]),'SmsAccountId':Number(_0x4ef951[_0x1dc7('0x56')]['id'])});}}else{socket[_0x1dc7('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x4ef951[_0x1dc7('0x41')][_0x1dc7('0x68')]),'SmsAccountId':Number(_0x4ef951['params']['id'])});}});}})[_0x1dc7('0x33')](respondWithStatusCode(_0x7cecb8,null))[_0x1dc7('0x28')](handleError(_0x7cecb8,null));};exports[_0x1dc7('0xe1')]=function(_0x4e16c8,_0x1a1d31,_0x363d74){var _0x26b40b={};var _0xc15914={};var _0x3848f4;var _0xec13a0;return db['SmsAccount'][_0x1dc7('0x64')]({'where':{'id':_0x4e16c8['params']['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x1a1d31,null))[_0x1dc7('0x33')](function(_0x51c6a5){if(_0x51c6a5){_0x3848f4=_0x51c6a5;_0xc15914[_0x1dc7('0x40')]=_['keys'](db[_0x1dc7('0xa8')]['rawAttributes']);_0xc15914['query']=_[_0x1dc7('0x42')](_0x4e16c8[_0x1dc7('0x41')]);_0xc15914[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0xc15914['model'],_0xc15914['query']);_0x26b40b[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0xc15914[_0x1dc7('0x40')],qs['fields'](_0x4e16c8[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0x26b40b['attributes']=_0x26b40b[_0x1dc7('0x43')][_0x1dc7('0x46')]?_0x26b40b[_0x1dc7('0x43')]:_0xc15914[_0x1dc7('0x40')];_0x26b40b[_0x1dc7('0x48')]=qs[_0x1dc7('0x49')](_0x4e16c8['query'][_0x1dc7('0x49')]);_0x26b40b['where']=qs[_0x1dc7('0x4b')](_[_0x1dc7('0x4c')](_0x4e16c8[_0x1dc7('0x41')],_0xc15914[_0x1dc7('0x4b')]));if(_0x4e16c8[_0x1dc7('0x41')][_0x1dc7('0x4d')]){_0x26b40b[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0x26b40b[_0x1dc7('0x4a')],{'$or':_[_0x1dc7('0x3b')](_0x26b40b[_0x1dc7('0x43')],function(_0x516ec7){var _0x315515={};_0x315515[_0x516ec7]={'$like':'%'+_0x4e16c8[_0x1dc7('0x41')][_0x1dc7('0x4d')]+'%'};return _0x315515;})});}_0x26b40b=_['merge']({},_0x26b40b,_0x4e16c8[_0x1dc7('0x50')]);return _0x3848f4[_0x1dc7('0xe1')](_0x26b40b);}})[_0x1dc7('0x33')](function(_0x79bc5){if(_0x79bc5){_0xec13a0=_0x79bc5[_0x1dc7('0x46')];if(!_0x4e16c8[_0x1dc7('0x41')]['hasOwnProperty'](_0x1dc7('0x47'))){_0x26b40b[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x4e16c8[_0x1dc7('0x41')]['limit']);_0x26b40b[_0x1dc7('0x2c')]=qs[_0x1dc7('0x2c')](_0x4e16c8[_0x1dc7('0x41')][_0x1dc7('0x2c')]);}return _0x3848f4[_0x1dc7('0xe1')](_0x26b40b);}})[_0x1dc7('0x33')](function(_0x3676d9){if(_0x3676d9){return _0x3676d9?{'count':_0xec13a0,'rows':_0x3676d9}:null;}})[_0x1dc7('0x33')](respondWithResult(_0x1a1d31,null))[_0x1dc7('0x28')](handleError(_0x1a1d31,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d981900..98831bc 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 _0xda28=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0xda28,0xc5));var _0x8da2=function(_0x56e2bb,_0x420140){_0x56e2bb=_0x56e2bb-0x0;var _0x5eb398=_0xda28[_0x56e2bb];return _0x5eb398;};'use strict';var EventEmitter=require(_0x8da2('0x0'));var SmsAccount=require(_0x8da2('0x1'))['db'][_0x8da2('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8da2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x178939){return function(_0x8216ce,_0x407229,_0x2e7953){SmsAccountEvents[_0x8da2('0x4')](_0x178939+':'+_0x8216ce['id'],_0x8216ce);SmsAccountEvents[_0x8da2('0x4')](_0x178939,_0x8216ce);_0x2e7953(null);};}for(var e in events){if(events[_0x8da2('0x5')](e)){var event=events[e];SmsAccount[_0x8da2('0x6')](e,emitEvent(event));}}module[_0x8da2('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x7b1e=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x2dcfe4,_0x2cc090){var _0x4f4f03=function(_0x191be4){while(--_0x191be4){_0x2dcfe4['push'](_0x2dcfe4['shift']());}};_0x4f4f03(++_0x2cc090);}(_0x7b1e,0x178));var _0xe7b1=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x7b1e[_0xaa6a4];return _0xdc31a4;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xe7b1('0x0'))['db'][_0xe7b1('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe7b1('0x2')](0x0);var events={'afterCreate':_0xe7b1('0x3'),'afterUpdate':_0xe7b1('0x4'),'afterDestroy':_0xe7b1('0x5')};function emitEvent(_0x3a3d23){return function(_0x44b05e,_0x30f0b1,_0xe0c2f1){SmsAccountEvents[_0xe7b1('0x6')](_0x3a3d23+':'+_0x44b05e['id'],_0x44b05e);SmsAccountEvents[_0xe7b1('0x6')](_0x3a3d23,_0x44b05e);_0xe0c2f1(null);};}for(var e in events){if(events[_0xe7b1('0x7')](e)){var event=events[e];SmsAccount[_0xe7b1('0x8')](e,emitEvent(event));}}module[_0xe7b1('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 140b4a5..fd64183 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 _0x0f4d=['define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x104354,_0x1d5cdc){var _0x5ce198=function(_0x12a899){while(--_0x12a899){_0x104354['push'](_0x104354['shift']());}};_0x5ce198(++_0x1d5cdc);}(_0x0f4d,0xb9));var _0xd0f4=function(_0x455973,_0x298913){_0x455973=_0x455973-0x0;var _0x68923c=_0x0f4d[_0x455973];return _0x68923c;};'use strict';var _=require(_0xd0f4('0x0'));var util=require(_0xd0f4('0x1'));var logger=require(_0xd0f4('0x2'))(_0xd0f4('0x3'));var moment=require('moment');var BPromise=require(_0xd0f4('0x4'));var rp=require(_0xd0f4('0x5'));var fs=require('fs');var path=require(_0xd0f4('0x6'));var rimraf=require(_0xd0f4('0x7'));var config=require(_0xd0f4('0x8'));var attributes=require(_0xd0f4('0x9'));module[_0xd0f4('0xa')]=function(_0x467a0a,_0x47587c){return _0x467a0a[_0xd0f4('0xb')](_0xd0f4('0xc'),attributes,{'tableName':_0xd0f4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea92=['rimraf','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xcb813d,_0x204798){var _0x259ee8=function(_0x48d828){while(--_0x48d828){_0xcb813d['push'](_0xcb813d['shift']());}};_0x259ee8(++_0x204798);}(_0xea92,0x95));var _0x2ea9=function(_0x4fd206,_0x216111){_0x4fd206=_0x4fd206-0x0;var _0x3416aa=_0xea92[_0x4fd206];return _0x3416aa;};'use strict';var _=require(_0x2ea9('0x0'));var util=require(_0x2ea9('0x1'));var logger=require(_0x2ea9('0x2'))(_0x2ea9('0x3'));var moment=require(_0x2ea9('0x4'));var BPromise=require('bluebird');var rp=require(_0x2ea9('0x5'));var fs=require('fs');var path=require(_0x2ea9('0x6'));var rimraf=require(_0x2ea9('0x7'));var config=require('../../config/environment');var attributes=require(_0x2ea9('0x8'));module['exports']=function(_0x3599d4,_0x4db54c){return _0x3599d4[_0x2ea9('0x9')](_0x2ea9('0xa'),attributes,{'tableName':_0x2ea9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 4dbede8..59e138d 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 _0x7d94=['info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./smsAccount.socket','request','then'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x7d94,0x1c1));var _0x47d9=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x7d94[_0x5b8b97];return _0x1fdf84;};'use strict';var _=require(_0x47d9('0x0'));var util=require(_0x47d9('0x1'));var moment=require(_0x47d9('0x2'));var BPromise=require(_0x47d9('0x3'));var rs=require(_0x47d9('0x4'));var fs=require('fs');var Redis=require(_0x47d9('0x5'));var db=require(_0x47d9('0x6'))['db'];var utils=require(_0x47d9('0x7'));var logger=require(_0x47d9('0x8'))(_0x47d9('0x9'));var config=require(_0x47d9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x47d9('0xb')][_0x47d9('0xc')]({'port':0x232a});config['redis']=_[_0x47d9('0xd')](config[_0x47d9('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x47d9('0xf'))(new Redis(config[_0x47d9('0xe')]));require(_0x47d9('0x10'))['register'](socket);function respondWithRpcPromise(_0x2fdbd3,_0x2d05f1,_0x183d7c){return new BPromise(function(_0x28e049,_0x2bdb57){return client[_0x47d9('0x11')](_0x2fdbd3,_0x183d7c)[_0x47d9('0x12')](function(_0x2a062e){logger[_0x47d9('0x13')](_0x47d9('0x14'),_0x2d05f1,_0x47d9('0x15'));logger['debug'](_0x47d9('0x16'),_0x2d05f1,_0x47d9('0x15'),JSON[_0x47d9('0x17')](_0x2a062e));if(_0x2a062e[_0x47d9('0x18')]){if(_0x2a062e[_0x47d9('0x18')][_0x47d9('0x19')]===0x1f4){logger['error'](_0x47d9('0x14'),_0x2d05f1,_0x2a062e[_0x47d9('0x18')][_0x47d9('0x1a')]);return _0x2bdb57(_0x2a062e['error'][_0x47d9('0x1a')]);}logger['error'](_0x47d9('0x14'),_0x2d05f1,_0x2a062e['error'][_0x47d9('0x1a')]);return _0x28e049(_0x2a062e[_0x47d9('0x18')][_0x47d9('0x1a')]);}else{logger[_0x47d9('0x13')](_0x47d9('0x14'),_0x2d05f1,'request\x20sent');_0x28e049(_0x2a062e[_0x47d9('0x1b')][_0x47d9('0x1a')]);}})[_0x47d9('0x1c')](function(_0x3540a1){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2d05f1,_0x3540a1);_0x2bdb57(_0x3540a1);});});}exports[_0x47d9('0x1d')]=function(_0xc8698e){var _0x44c966=this;return new Promise(function(_0x46d9f6,_0x321890){return db[_0x47d9('0x1e')][_0x47d9('0x1f')]({'raw':_0xc8698e['options']?_0xc8698e['options'][_0x47d9('0x20')]===undefined?!![]:![]:!![],'where':_0xc8698e[_0x47d9('0x21')]?_0xc8698e[_0x47d9('0x21')]['where']||null:null,'attributes':_0xc8698e['options']?_0xc8698e[_0x47d9('0x21')][_0x47d9('0x22')]||null:null,'include':_0xc8698e[_0x47d9('0x21')]?_0xc8698e[_0x47d9('0x21')][_0x47d9('0x23')]?_[_0x47d9('0x24')](_0xc8698e[_0x47d9('0x21')]['include'],function(_0xc0318a){return{'model':db[_0xc0318a[_0x47d9('0x25')]],'as':_0xc0318a['as'],'attributes':_0xc0318a[_0x47d9('0x22')],'include':_0xc0318a[_0x47d9('0x23')]?_[_0x47d9('0x24')](_0xc0318a[_0x47d9('0x23')],function(_0x30be73){return{'model':db[_0x30be73[_0x47d9('0x25')]],'as':_0x30be73['as'],'attributes':_0x30be73['attributes'],'include':_0x30be73[_0x47d9('0x23')]?_[_0x47d9('0x24')](_0x30be73[_0x47d9('0x23')],function(_0x1e835b){return{'model':db[_0x1e835b['model']],'as':_0x1e835b['as'],'attributes':_0x1e835b[_0x47d9('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27c1e2){logger[_0x47d9('0x13')](_0x47d9('0x1d'),_0xc8698e);logger[_0x47d9('0x26')](_0x47d9('0x1d'),_0xc8698e,JSON[_0x47d9('0x17')](_0x27c1e2));_0x46d9f6(_0x27c1e2);})[_0x47d9('0x1c')](function(_0x23ec6d){logger[_0x47d9('0x18')](_0x47d9('0x1d'),_0x23ec6d[_0x47d9('0x1a')],_0xc8698e);_0x321890(_0x44c966[_0x47d9('0x18')](0x1f4,_0x23ec6d[_0x47d9('0x1a')]));});});}; \ No newline at end of file +var _0xbf30=['defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','model','include','debug','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2e6a69,_0x1ba014){var _0x583b2a=function(_0x1e8d49){while(--_0x1e8d49){_0x2e6a69['push'](_0x2e6a69['shift']());}};_0x583b2a(++_0x1ba014);}(_0xbf30,0x1e4));var _0x0bf3=function(_0x17be32,_0x23310d){_0x17be32=_0x17be32-0x0;var _0x3ae4a8=_0xbf30[_0x17be32];return _0x3ae4a8;};'use strict';var _=require('lodash');var util=require(_0x0bf3('0x0'));var moment=require(_0x0bf3('0x1'));var BPromise=require(_0x0bf3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bf3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bf3('0x4'));var logger=require(_0x0bf3('0x5'))(_0x0bf3('0x6'));var config=require(_0x0bf3('0x7'));var jayson=require(_0x0bf3('0x8'));var client=jayson[_0x0bf3('0x9')]['http']({'port':0x232a});config['redis']=_[_0x0bf3('0xa')](config['redis'],{'host':_0x0bf3('0xb'),'port':0x18eb});var socket=require(_0x0bf3('0xc'))(new Redis(config[_0x0bf3('0xd')]));require(_0x0bf3('0xe'))[_0x0bf3('0xf')](socket);function respondWithRpcPromise(_0x490f0d,_0x32a85c,_0x3fb532){return new BPromise(function(_0x3a0f88,_0x14ce9d){return client['request'](_0x490f0d,_0x3fb532)[_0x0bf3('0x10')](function(_0x42c5ef){logger[_0x0bf3('0x11')](_0x0bf3('0x12'),_0x32a85c,_0x0bf3('0x13'));logger['debug'](_0x0bf3('0x14'),_0x32a85c,_0x0bf3('0x13'),JSON[_0x0bf3('0x15')](_0x42c5ef));if(_0x42c5ef[_0x0bf3('0x16')]){if(_0x42c5ef[_0x0bf3('0x16')][_0x0bf3('0x17')]===0x1f4){logger[_0x0bf3('0x16')]('SmsAccount,\x20%s,\x20%s',_0x32a85c,_0x42c5ef[_0x0bf3('0x16')][_0x0bf3('0x18')]);return _0x14ce9d(_0x42c5ef[_0x0bf3('0x16')][_0x0bf3('0x18')]);}logger[_0x0bf3('0x16')](_0x0bf3('0x12'),_0x32a85c,_0x42c5ef[_0x0bf3('0x16')]['message']);return _0x3a0f88(_0x42c5ef['error']['message']);}else{logger[_0x0bf3('0x11')](_0x0bf3('0x12'),_0x32a85c,_0x0bf3('0x13'));_0x3a0f88(_0x42c5ef[_0x0bf3('0x19')][_0x0bf3('0x18')]);}})[_0x0bf3('0x1a')](function(_0x250aaa){logger['error'](_0x0bf3('0x12'),_0x32a85c,_0x250aaa);_0x14ce9d(_0x250aaa);});});}exports[_0x0bf3('0x1b')]=function(_0x3e5f0e){var _0x38d70e=this;return new Promise(function(_0x356180,_0x1617a6){return db[_0x0bf3('0x1c')][_0x0bf3('0x1d')]({'raw':_0x3e5f0e[_0x0bf3('0x1e')]?_0x3e5f0e[_0x0bf3('0x1e')][_0x0bf3('0x1f')]===undefined?!![]:![]:!![],'where':_0x3e5f0e[_0x0bf3('0x1e')]?_0x3e5f0e[_0x0bf3('0x1e')][_0x0bf3('0x20')]||null:null,'attributes':_0x3e5f0e[_0x0bf3('0x1e')]?_0x3e5f0e[_0x0bf3('0x1e')][_0x0bf3('0x21')]||null:null,'include':_0x3e5f0e[_0x0bf3('0x1e')]?_0x3e5f0e[_0x0bf3('0x1e')]['include']?_[_0x0bf3('0x22')](_0x3e5f0e[_0x0bf3('0x1e')]['include'],function(_0x5d82c0){return{'model':db[_0x5d82c0[_0x0bf3('0x23')]],'as':_0x5d82c0['as'],'attributes':_0x5d82c0[_0x0bf3('0x21')],'include':_0x5d82c0[_0x0bf3('0x24')]?_[_0x0bf3('0x22')](_0x5d82c0[_0x0bf3('0x24')],function(_0x110fdb){return{'model':db[_0x110fdb[_0x0bf3('0x23')]],'as':_0x110fdb['as'],'attributes':_0x110fdb['attributes'],'include':_0x110fdb[_0x0bf3('0x24')]?_[_0x0bf3('0x22')](_0x110fdb['include'],function(_0x237173){return{'model':db[_0x237173[_0x0bf3('0x23')]],'as':_0x237173['as'],'attributes':_0x237173[_0x0bf3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0bf3('0x10')](function(_0x2b4237){logger[_0x0bf3('0x11')](_0x0bf3('0x1b'),_0x3e5f0e);logger[_0x0bf3('0x25')](_0x0bf3('0x1b'),_0x3e5f0e,JSON['stringify'](_0x2b4237));_0x356180(_0x2b4237);})[_0x0bf3('0x1a')](function(_0x26ebdc){logger[_0x0bf3('0x16')](_0x0bf3('0x1b'),_0x26ebdc['message'],_0x3e5f0e);_0x1617a6(_0x38d70e[_0x0bf3('0x16')](0x1f4,_0x26ebdc[_0x0bf3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 305fa02..8eb28bd 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 345b34b..06d43a5 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x3c2e17,_0x1d65c6){var _0x8a1c8b=function(_0x5e9d6b){while(--_0x5e9d6b){_0x3c2e17['push'](_0x3c2e17['shift']());}};_0x8a1c8b(++_0x1d65c6);}(_0x008c,0x188));var _0xc008=function(_0xf0ab7c,_0x23bbc2){_0xf0ab7c=_0xf0ab7c-0x0;var _0x198144=_0x008c[_0xf0ab7c];return _0x198144;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=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(_0x46ee1c,_0x45a091){var _0x23d17b=function(_0x29348b){while(--_0x29348b){_0x46ee1c['push'](_0x46ee1c['shift']());}};_0x23d17b(++_0x45a091);}(_0x34e8,0x12c));var _0x834e=function(_0x2cd1bd,_0x167f12){_0x2cd1bd=_0x2cd1bd-0x0;var _0x4694c0=_0x34e8[_0x2cd1bd];return _0x4694c0;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 2acb7ee..20f0117 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 _0x69d7=['TEXT','*,*,*,*','INTEGER','STRING','noop'];(function(_0x90131f,_0x5a5d80){var _0x32eb41=function(_0x4cdb03){while(--_0x4cdb03){_0x90131f['push'](_0x90131f['shift']());}};_0x32eb41(++_0x5a5d80);}(_0x69d7,0x1f1));var _0x769d=function(_0x31e96b,_0x2d6732){_0x31e96b=_0x31e96b-0x0;var _0x1cec18=_0x69d7[_0x31e96b];return _0x1cec18;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x769d('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x769d('0x1')],'allowNull':![],'defaultValue':_0x769d('0x2')},'appdata':{'type':Sequelize[_0x769d('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x769d('0x1')],'defaultValue':_0x769d('0x4')}}; \ No newline at end of file +var _0xb617=['TEXT','STRING','INTEGER','noop'];(function(_0x28f412,_0x5c00c8){var _0x312e7b=function(_0x29a0f3){while(--_0x29a0f3){_0x28f412['push'](_0x28f412['shift']());}};_0x312e7b(++_0x5c00c8);}(_0xb617,0x15a));var _0x7b61=function(_0x3ccd29,_0x4339d1){_0x3ccd29=_0x3ccd29-0x0;var _0x4f9c9c=_0xb617[_0x3ccd29];return _0x4f9c9c;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7b61('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7b61('0x1')},'appdata':{'type':Sequelize[_0x7b61('0x2')]()},'description':{'type':Sequelize[_0x7b61('0x3')]},'interval':{'type':Sequelize[_0x7b61('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6ebd6bb..0879e35 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 _0x90aa=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x131249,_0x3f9d36){var _0x26df63=function(_0x2efd6c){while(--_0x2efd6c){_0x131249['push'](_0x131249['shift']());}};_0x26df63(++_0x3f9d36);}(_0x90aa,0x1b9));var _0xa90a=function(_0x5e9386,_0x1bde2d){_0x5e9386=_0x5e9386-0x0;var _0x6dbbe=_0x90aa[_0x5e9386];return _0x6dbbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa90a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa90a('0x1'));var rp=require(_0xa90a('0x2'));var moment=require(_0xa90a('0x3'));var BPromise=require(_0xa90a('0x4'));var Mustache=require('mustache');var util=require(_0xa90a('0x5'));var path=require(_0xa90a('0x6'));var sox=require(_0xa90a('0x7'));var csv=require(_0xa90a('0x8'));var ejs=require(_0xa90a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa90a('0xa'));var squel=require(_0xa90a('0xb'));var crypto=require('crypto');var jsforce=require(_0xa90a('0xc'));var deskjs=require(_0xa90a('0xd'));var toCsv=require(_0xa90a('0x8'));var querystring=require(_0xa90a('0xe'));var Papa=require('papaparse');var Redis=require(_0xa90a('0xf'));var authService=require(_0xa90a('0x10'));var qs=require(_0xa90a('0x11'));var as=require(_0xa90a('0x12'));var hardwareService=require(_0xa90a('0x13'));var logger=require(_0xa90a('0x14'))(_0xa90a('0x15'));var utils=require(_0xa90a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa90a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba4ed,_0x3e1d96){_0x3e1d96=_0x3e1d96||0xcc;return function(_0x24741a){if(_0x24741a){return _0x5ba4ed['sendStatus'](_0x3e1d96);}return _0x5ba4ed['status'](_0x3e1d96)[_0xa90a('0x18')]();};}function respondWithResult(_0x1fdefe,_0x43bfda){_0x43bfda=_0x43bfda||0xc8;return function(_0x5c8e3c){if(_0x5c8e3c){return _0x1fdefe['status'](_0x43bfda)[_0xa90a('0x19')](_0x5c8e3c);}};}function respondWithFilteredResult(_0x1da1f9,_0x4f8bb6){return function(_0x127053){if(_0x127053){var _0x420250=typeof _0x4f8bb6[_0xa90a('0x1a')]===_0xa90a('0x1b')&&typeof _0x4f8bb6[_0xa90a('0x1c')]===_0xa90a('0x1b');var _0x572377=_0x127053[_0xa90a('0x1d')];var _0x380672=_0x420250?0x0:_0x4f8bb6['offset'];var _0x4dc17f=_0x420250?_0x127053['count']:_0x4f8bb6[_0xa90a('0x1a')]+_0x4f8bb6[_0xa90a('0x1c')];var _0x19c57e;if(_0x4dc17f>=_0x572377){_0x4dc17f=_0x572377;_0x19c57e=0xc8;}else{_0x19c57e=0xce;}_0x1da1f9[_0xa90a('0x1e')](_0x19c57e);return _0x1da1f9[_0xa90a('0x1f')](_0xa90a('0x20'),_0x380672+'-'+_0x4dc17f+'/'+_0x572377)['json'](_0x127053);}return null;};}function patchUpdates(_0x40c723){return function(_0x4da9f7){try{jsonpatch[_0xa90a('0x21')](_0x4da9f7,_0x40c723,!![]);}catch(_0x3bd704){return BPromise[_0xa90a('0x22')](_0x3bd704);}return _0x4da9f7[_0xa90a('0x23')]();};}function saveUpdates(_0x134c58,_0x3f1447){return function(_0x23abdf){if(_0x23abdf){return _0x23abdf[_0xa90a('0x24')](_0x134c58)[_0xa90a('0x25')](function(_0x2cdd7e){return _0x2cdd7e;});}return null;};}function removeEntity(_0x8161c5,_0x517cbb){return function(_0x3b424d){if(_0x3b424d){return _0x3b424d['destroy']()[_0xa90a('0x25')](function(){_0x8161c5[_0xa90a('0x1e')](0xcc)[_0xa90a('0x18')]();});}};}function handleEntityNotFound(_0x1353db,_0x215905){return function(_0x45dec0){if(!_0x45dec0){_0x1353db[_0xa90a('0x26')](0x194);}return _0x45dec0;};}function handleError(_0x1eab35,_0x3d6b87){_0x3d6b87=_0x3d6b87||0x1f4;return function(_0x412eec){logger[_0xa90a('0x27')](_0x412eec[_0xa90a('0x28')]);if(_0x412eec[_0xa90a('0x29')]){delete _0x412eec[_0xa90a('0x29')];}_0x1eab35[_0xa90a('0x1e')](_0x3d6b87)[_0xa90a('0x2a')](_0x412eec);};}exports['index']=function(_0x3d0a91,_0x4c22a3){var _0x436bca={},_0xb4fc31={},_0x560f6c={'count':0x0,'rows':[]};var _0x1c84ca=_[_0xa90a('0x2b')](db[_0xa90a('0x2c')][_0xa90a('0x2d')],function(_0x1c6569){return{'name':_0x1c6569[_0xa90a('0x2e')],'type':_0x1c6569['type'][_0xa90a('0x2f')]};});_0xb4fc31['model']=_[_0xa90a('0x2b')](_0x1c84ca,_0xa90a('0x29'));_0xb4fc31[_0xa90a('0x30')]=_[_0xa90a('0x31')](_0x3d0a91[_0xa90a('0x30')]);_0xb4fc31[_0xa90a('0x32')]=_[_0xa90a('0x33')](_0xb4fc31['model'],_0xb4fc31[_0xa90a('0x30')]);_0x436bca['attributes']=_[_0xa90a('0x33')](_0xb4fc31[_0xa90a('0x34')],qs[_0xa90a('0x35')](_0x3d0a91['query'][_0xa90a('0x35')]));_0x436bca[_0xa90a('0x36')]=_0x436bca[_0xa90a('0x36')][_0xa90a('0x37')]?_0x436bca[_0xa90a('0x36')]:_0xb4fc31[_0xa90a('0x34')];if(!_0x3d0a91[_0xa90a('0x30')][_0xa90a('0x38')](_0xa90a('0x39'))){_0x436bca['limit']=qs[_0xa90a('0x1c')](_0x3d0a91[_0xa90a('0x30')][_0xa90a('0x1c')]);_0x436bca['offset']=qs[_0xa90a('0x1a')](_0x3d0a91[_0xa90a('0x30')][_0xa90a('0x1a')]);}_0x436bca[_0xa90a('0x3a')]=qs[_0xa90a('0x3b')](_0x3d0a91[_0xa90a('0x30')][_0xa90a('0x3b')]);_0x436bca[_0xa90a('0x3c')]=qs[_0xa90a('0x32')](_[_0xa90a('0x3d')](_0x3d0a91[_0xa90a('0x30')],_0xb4fc31[_0xa90a('0x32')]),_0x1c84ca);if(_0x3d0a91['query'][_0xa90a('0x3e')]){_0x436bca[_0xa90a('0x3c')]=_[_0xa90a('0x3f')](_0x436bca[_0xa90a('0x3c')],{'$or':_['map'](_0x1c84ca,function(_0x3a8bc2){if(_0x3a8bc2[_0xa90a('0x40')]!==_0xa90a('0x41')){var _0x3b5eab={};_0x3b5eab[_0x3a8bc2[_0xa90a('0x29')]]={'$like':'%'+_0x3d0a91[_0xa90a('0x30')][_0xa90a('0x3e')]+'%'};return _0x3b5eab;}})});}_0x436bca=_['merge']({},_0x436bca,_0x3d0a91[_0xa90a('0x42')]);var _0x83f2d3={'where':_0x436bca[_0xa90a('0x3c')]};return db[_0xa90a('0x2c')][_0xa90a('0x1d')](_0x83f2d3)[_0xa90a('0x25')](function(_0x44d867){_0x560f6c[_0xa90a('0x1d')]=_0x44d867;if(_0x3d0a91[_0xa90a('0x30')]['includeAll']){_0x436bca[_0xa90a('0x43')]=[{'all':!![]}];}return db[_0xa90a('0x2c')]['findAll'](_0x436bca);})[_0xa90a('0x25')](function(_0x34448f){_0x560f6c[_0xa90a('0x44')]=_0x34448f;return _0x560f6c;})[_0xa90a('0x25')](respondWithFilteredResult(_0x4c22a3,_0x436bca))[_0xa90a('0x45')](handleError(_0x4c22a3,null));};exports[_0xa90a('0x46')]=function(_0x52dda3,_0x4fa7a1){var _0x30cbc4={'raw':!![],'where':{'id':_0x52dda3[_0xa90a('0x47')]['id']}},_0x42fb12={};_0x42fb12[_0xa90a('0x34')]=_[_0xa90a('0x31')](db[_0xa90a('0x2c')][_0xa90a('0x2d')]);_0x42fb12['query']=_[_0xa90a('0x31')](_0x52dda3[_0xa90a('0x30')]);_0x42fb12[_0xa90a('0x32')]=_[_0xa90a('0x33')](_0x42fb12[_0xa90a('0x34')],_0x42fb12[_0xa90a('0x30')]);_0x30cbc4[_0xa90a('0x36')]=_[_0xa90a('0x33')](_0x42fb12[_0xa90a('0x34')],qs['fields'](_0x52dda3[_0xa90a('0x30')][_0xa90a('0x35')]));_0x30cbc4[_0xa90a('0x36')]=_0x30cbc4[_0xa90a('0x36')][_0xa90a('0x37')]?_0x30cbc4[_0xa90a('0x36')]:_0x42fb12[_0xa90a('0x34')];if(_0x52dda3[_0xa90a('0x30')][_0xa90a('0x48')]){_0x30cbc4['include']=[{'all':!![]}];}_0x30cbc4=_[_0xa90a('0x3f')]({},_0x30cbc4,_0x52dda3['options']);return db['SmsApplication'][_0xa90a('0x49')](_0x30cbc4)[_0xa90a('0x25')](handleEntityNotFound(_0x4fa7a1,null))[_0xa90a('0x25')](respondWithResult(_0x4fa7a1,null))[_0xa90a('0x45')](handleError(_0x4fa7a1,null));};exports[_0xa90a('0x4a')]=function(_0x5afb21,_0x482db7){return db[_0xa90a('0x2c')]['create'](_0x5afb21[_0xa90a('0x4b')],{})[_0xa90a('0x25')](respondWithResult(_0x482db7,0xc9))['catch'](handleError(_0x482db7,null));};exports['update']=function(_0x411cd3,_0x2b8e48){if(_0x411cd3[_0xa90a('0x4b')]['id']){delete _0x411cd3[_0xa90a('0x4b')]['id'];}return db[_0xa90a('0x2c')][_0xa90a('0x49')]({'where':{'id':_0x411cd3[_0xa90a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b8e48,null))[_0xa90a('0x25')](saveUpdates(_0x411cd3[_0xa90a('0x4b')],null))[_0xa90a('0x25')](respondWithResult(_0x2b8e48,null))[_0xa90a('0x45')](handleError(_0x2b8e48,null));};exports['destroy']=function(_0x34b58b,_0x1e9a55){return db[_0xa90a('0x2c')][_0xa90a('0x49')]({'where':{'id':_0x34b58b[_0xa90a('0x47')]['id']}})[_0xa90a('0x25')](handleEntityNotFound(_0x1e9a55,null))['then'](removeEntity(_0x1e9a55,null))[_0xa90a('0x45')](handleError(_0x1e9a55,null));}; \ No newline at end of file +var _0x90df=['map','SmsApplication','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','show','keys','create','body','update','params','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index'];(function(_0xa192fc,_0x1fd64a){var _0x283a70=function(_0x9dc9d6){while(--_0x9dc9d6){_0xa192fc['push'](_0xa192fc['shift']());}};_0x283a70(++_0x1fd64a);}(_0x90df,0x148));var _0xf90d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90df[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf90d('0x0'));var zipdir=require(_0xf90d('0x1'));var jsonpatch=require(_0xf90d('0x2'));var rp=require(_0xf90d('0x3'));var moment=require('moment');var BPromise=require(_0xf90d('0x4'));var Mustache=require(_0xf90d('0x5'));var util=require(_0xf90d('0x6'));var path=require('path');var sox=require(_0xf90d('0x7'));var csv=require(_0xf90d('0x8'));var ejs=require(_0xf90d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf90d('0xa'));var squel=require('squel');var crypto=require(_0xf90d('0xb'));var jsforce=require(_0xf90d('0xc'));var deskjs=require(_0xf90d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf90d('0xe'));var Papa=require('papaparse');var Redis=require(_0xf90d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf90d('0x10'));var as=require(_0xf90d('0x11'));var hardwareService=require(_0xf90d('0x12'));var logger=require(_0xf90d('0x13'))(_0xf90d('0x14'));var utils=require('../../config/utils');var config=require(_0xf90d('0x15'));var licenseUtil=require(_0xf90d('0x16'));var db=require(_0xf90d('0x17'))['db'];function respondWithStatusCode(_0x2b034b,_0x3e1b7b){_0x3e1b7b=_0x3e1b7b||0xcc;return function(_0x5e54e9){if(_0x5e54e9){return _0x2b034b[_0xf90d('0x18')](_0x3e1b7b);}return _0x2b034b[_0xf90d('0x19')](_0x3e1b7b)['end']();};}function respondWithResult(_0x586473,_0x582bca){_0x582bca=_0x582bca||0xc8;return function(_0x462389){if(_0x462389){return _0x586473['status'](_0x582bca)[_0xf90d('0x1a')](_0x462389);}};}function respondWithFilteredResult(_0x5ce07d,_0x371828){return function(_0x25db1a){if(_0x25db1a){var _0x12c119=typeof _0x371828['offset']==='undefined'&&typeof _0x371828['limit']==='undefined';var _0x3cca1d=_0x25db1a[_0xf90d('0x1b')];var _0x4eb5c5=_0x12c119?0x0:_0x371828[_0xf90d('0x1c')];var _0x1ea544=_0x12c119?_0x25db1a[_0xf90d('0x1b')]:_0x371828[_0xf90d('0x1c')]+_0x371828['limit'];var _0x54caa2;if(_0x1ea544>=_0x3cca1d){_0x1ea544=_0x3cca1d;_0x54caa2=0xc8;}else{_0x54caa2=0xce;}_0x5ce07d[_0xf90d('0x19')](_0x54caa2);return _0x5ce07d[_0xf90d('0x1d')](_0xf90d('0x1e'),_0x4eb5c5+'-'+_0x1ea544+'/'+_0x3cca1d)['json'](_0x25db1a);}return null;};}function patchUpdates(_0x818543){return function(_0x198911){try{jsonpatch[_0xf90d('0x1f')](_0x198911,_0x818543,!![]);}catch(_0x1782d0){return BPromise[_0xf90d('0x20')](_0x1782d0);}return _0x198911[_0xf90d('0x21')]();};}function saveUpdates(_0x590e13,_0x4b3dbb){return function(_0x2df657){if(_0x2df657){return _0x2df657['update'](_0x590e13)[_0xf90d('0x22')](function(_0x200481){return _0x200481;});}return null;};}function removeEntity(_0x352654,_0x2ed617){return function(_0x72de7a){if(_0x72de7a){return _0x72de7a[_0xf90d('0x23')]()['then'](function(){_0x352654[_0xf90d('0x19')](0xcc)[_0xf90d('0x24')]();});}};}function handleEntityNotFound(_0x36e749,_0x488002){return function(_0x12811c){if(!_0x12811c){_0x36e749[_0xf90d('0x18')](0x194);}return _0x12811c;};}function handleError(_0x40090f,_0x22bbef){_0x22bbef=_0x22bbef||0x1f4;return function(_0x3c221d){logger[_0xf90d('0x25')](_0x3c221d[_0xf90d('0x26')]);if(_0x3c221d[_0xf90d('0x27')]){delete _0x3c221d['name'];}_0x40090f['status'](_0x22bbef)[_0xf90d('0x28')](_0x3c221d);};}exports[_0xf90d('0x29')]=function(_0x47cd9c,_0x93957b){var _0x57d32d={},_0x274d3c={},_0x5856c7={'count':0x0,'rows':[]};var _0x3ca0b7=_[_0xf90d('0x2a')](db[_0xf90d('0x2b')]['rawAttributes'],function(_0x52bc13){return{'name':_0x52bc13[_0xf90d('0x2c')],'type':_0x52bc13[_0xf90d('0x2d')][_0xf90d('0x2e')]};});_0x274d3c[_0xf90d('0x2f')]=_[_0xf90d('0x2a')](_0x3ca0b7,_0xf90d('0x27'));_0x274d3c[_0xf90d('0x30')]=_['keys'](_0x47cd9c[_0xf90d('0x30')]);_0x274d3c['filters']=_[_0xf90d('0x31')](_0x274d3c['model'],_0x274d3c['query']);_0x57d32d[_0xf90d('0x32')]=_['intersection'](_0x274d3c[_0xf90d('0x2f')],qs[_0xf90d('0x33')](_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x33')]));_0x57d32d[_0xf90d('0x32')]=_0x57d32d[_0xf90d('0x32')][_0xf90d('0x34')]?_0x57d32d[_0xf90d('0x32')]:_0x274d3c[_0xf90d('0x2f')];if(!_0x47cd9c['query'][_0xf90d('0x35')]('nolimit')){_0x57d32d['limit']=qs[_0xf90d('0x36')](_0x47cd9c['query'][_0xf90d('0x36')]);_0x57d32d['offset']=qs[_0xf90d('0x1c')](_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x1c')]);}_0x57d32d[_0xf90d('0x37')]=qs[_0xf90d('0x38')](_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x38')]);_0x57d32d[_0xf90d('0x39')]=qs[_0xf90d('0x3a')](_[_0xf90d('0x3b')](_0x47cd9c[_0xf90d('0x30')],_0x274d3c[_0xf90d('0x3a')]),_0x3ca0b7);if(_0x47cd9c['query']['filter']){_0x57d32d[_0xf90d('0x39')]=_[_0xf90d('0x3c')](_0x57d32d[_0xf90d('0x39')],{'$or':_['map'](_0x3ca0b7,function(_0x537391){if(_0x537391['type']!=='VIRTUAL'){var _0x5a04f0={};_0x5a04f0[_0x537391[_0xf90d('0x27')]]={'$like':'%'+_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x3d')]+'%'};return _0x5a04f0;}})});}_0x57d32d=_['merge']({},_0x57d32d,_0x47cd9c[_0xf90d('0x3e')]);var _0x5d559f={'where':_0x57d32d[_0xf90d('0x39')]};return db['SmsApplication'][_0xf90d('0x1b')](_0x5d559f)[_0xf90d('0x22')](function(_0x6076dd){_0x5856c7[_0xf90d('0x1b')]=_0x6076dd;if(_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x3f')]){_0x57d32d[_0xf90d('0x40')]=[{'all':!![]}];}return db['SmsApplication'][_0xf90d('0x41')](_0x57d32d);})[_0xf90d('0x22')](function(_0xc0195b){_0x5856c7['rows']=_0xc0195b;return _0x5856c7;})[_0xf90d('0x22')](respondWithFilteredResult(_0x93957b,_0x57d32d))[_0xf90d('0x42')](handleError(_0x93957b,null));};exports[_0xf90d('0x43')]=function(_0x26301c,_0x1521a2){var _0x36b583={'raw':!![],'where':{'id':_0x26301c['params']['id']}},_0x1997e2={};_0x1997e2[_0xf90d('0x2f')]=_['keys'](db[_0xf90d('0x2b')]['rawAttributes']);_0x1997e2['query']=_[_0xf90d('0x44')](_0x26301c[_0xf90d('0x30')]);_0x1997e2[_0xf90d('0x3a')]=_[_0xf90d('0x31')](_0x1997e2['model'],_0x1997e2['query']);_0x36b583[_0xf90d('0x32')]=_['intersection'](_0x1997e2['model'],qs[_0xf90d('0x33')](_0x26301c['query']['fields']));_0x36b583[_0xf90d('0x32')]=_0x36b583[_0xf90d('0x32')][_0xf90d('0x34')]?_0x36b583[_0xf90d('0x32')]:_0x1997e2[_0xf90d('0x2f')];if(_0x26301c[_0xf90d('0x30')]['includeAll']){_0x36b583[_0xf90d('0x40')]=[{'all':!![]}];}_0x36b583=_[_0xf90d('0x3c')]({},_0x36b583,_0x26301c[_0xf90d('0x3e')]);return db[_0xf90d('0x2b')]['find'](_0x36b583)['then'](handleEntityNotFound(_0x1521a2,null))[_0xf90d('0x22')](respondWithResult(_0x1521a2,null))[_0xf90d('0x42')](handleError(_0x1521a2,null));};exports['create']=function(_0x599803,_0x39b892){return db[_0xf90d('0x2b')][_0xf90d('0x45')](_0x599803[_0xf90d('0x46')],{})[_0xf90d('0x22')](respondWithResult(_0x39b892,0xc9))[_0xf90d('0x42')](handleError(_0x39b892,null));};exports[_0xf90d('0x47')]=function(_0x823dcd,_0x40a634){if(_0x823dcd[_0xf90d('0x46')]['id']){delete _0x823dcd[_0xf90d('0x46')]['id'];}return db[_0xf90d('0x2b')]['find']({'where':{'id':_0x823dcd[_0xf90d('0x48')]['id']}})['then'](handleEntityNotFound(_0x40a634,null))['then'](saveUpdates(_0x823dcd[_0xf90d('0x46')],null))[_0xf90d('0x22')](respondWithResult(_0x40a634,null))[_0xf90d('0x42')](handleError(_0x40a634,null));};exports[_0xf90d('0x23')]=function(_0x37e3bb,_0x27baf7){return db[_0xf90d('0x2b')][_0xf90d('0x49')]({'where':{'id':_0x37e3bb[_0xf90d('0x48')]['id']}})[_0xf90d('0x22')](handleEntityNotFound(_0x27baf7,null))['then'](removeEntity(_0x27baf7,null))[_0xf90d('0x42')](handleError(_0x27baf7,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d147c64..db18b70 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 _0x4262=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x340ea5,_0x1c0c96){var _0xd74a4e=function(_0x23d040){while(--_0x23d040){_0x340ea5['push'](_0x340ea5['shift']());}};_0xd74a4e(++_0x1c0c96);}(_0x4262,0x15f));var _0x2426=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4262[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2426('0x0'));var util=require(_0x2426('0x1'));var logger=require(_0x2426('0x2'))('api');var moment=require(_0x2426('0x3'));var BPromise=require('bluebird');var rp=require(_0x2426('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2426('0x5'));var attributes=require(_0x2426('0x6'));module[_0x2426('0x7')]=function(_0x127500,_0x4a6553){return _0x127500[_0x2426('0x8')](_0x2426('0x9'),attributes,{'tableName':_0x2426('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2426('0xb'),'collate':_0x2426('0xc')});}; \ No newline at end of file +var _0x770d=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x2ba8cc,_0x2ccb6d){var _0x53b54c=function(_0x37042a){while(--_0x37042a){_0x2ba8cc['push'](_0x2ba8cc['shift']());}};_0x53b54c(++_0x2ccb6d);}(_0x770d,0x122));var _0xd770=function(_0x931c95,_0x2b3e1e){_0x931c95=_0x931c95-0x0;var _0x5b3d92=_0x770d[_0x931c95];return _0x5b3d92;};'use strict';var _=require(_0xd770('0x0'));var util=require(_0xd770('0x1'));var logger=require(_0xd770('0x2'))(_0xd770('0x3'));var moment=require(_0xd770('0x4'));var BPromise=require(_0xd770('0x5'));var rp=require(_0xd770('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd770('0x7'));var config=require(_0xd770('0x8'));var attributes=require(_0xd770('0x9'));module[_0xd770('0xa')]=function(_0x5d3b18,_0x554c5e){return _0x5d3b18[_0xd770('0xb')](_0xd770('0xc'),attributes,{'tableName':_0xd770('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd770('0xe'),'collate':_0xd770('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 7cff0ee..0141289 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 _0x80c4=['request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xdb01a,_0x54a83a){var _0x107ede=function(_0x98f457){while(--_0x98f457){_0xdb01a['push'](_0xdb01a['shift']());}};_0x107ede(++_0x54a83a);}(_0x80c4,0xa3));var _0x480c=function(_0x2c58c8,_0x24c958){_0x2c58c8=_0x2c58c8-0x0;var _0x49efef=_0x80c4[_0x2c58c8];return _0x49efef;};'use strict';var _=require(_0x480c('0x0'));var util=require('util');var moment=require(_0x480c('0x1'));var BPromise=require(_0x480c('0x2'));var rs=require(_0x480c('0x3'));var fs=require('fs');var Redis=require(_0x480c('0x4'));var db=require(_0x480c('0x5'))['db'];var utils=require(_0x480c('0x6'));var logger=require('../../config/logger')(_0x480c('0x7'));var config=require(_0x480c('0x8'));var jayson=require(_0x480c('0x9'));var client=jayson[_0x480c('0xa')][_0x480c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40a5a6,_0x3a69ec,_0x277efe){return new BPromise(function(_0x21545d,_0x510038){return client[_0x480c('0xc')](_0x40a5a6,_0x277efe)[_0x480c('0xd')](function(_0x292aca){logger[_0x480c('0xe')](_0x480c('0xf'),_0x3a69ec,_0x480c('0x10'));logger[_0x480c('0x11')](_0x480c('0x12'),_0x3a69ec,_0x480c('0x10'),JSON[_0x480c('0x13')](_0x292aca));if(_0x292aca[_0x480c('0x14')]){if(_0x292aca[_0x480c('0x14')][_0x480c('0x15')]===0x1f4){logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);return _0x510038(_0x292aca[_0x480c('0x14')]['message']);}logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca['error'][_0x480c('0x16')]);return _0x21545d(_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x3a69ec,_0x480c('0x10'));_0x21545d(_0x292aca[_0x480c('0x17')][_0x480c('0x16')]);}})[_0x480c('0x18')](function(_0x93d6c5){logger['error']('SmsApplication,\x20%s,\x20%s',_0x3a69ec,_0x93d6c5);_0x510038(_0x93d6c5);});});} \ No newline at end of file +var _0x8b0e=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x8b0e,0x166));var _0xe8b0=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x8b0e[_0xe8129c];return _0x709fc5;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var moment=require(_0xe8b0('0x2'));var BPromise=require(_0xe8b0('0x3'));var rs=require(_0xe8b0('0x4'));var fs=require('fs');var Redis=require(_0xe8b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8b0('0x6'));var logger=require('../../config/logger')(_0xe8b0('0x7'));var config=require(_0xe8b0('0x8'));var jayson=require(_0xe8b0('0x9'));var client=jayson[_0xe8b0('0xa')][_0xe8b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35fe3d,_0x25faf7,_0x2e56f4){return new BPromise(function(_0x59f3a4,_0x103966){return client[_0xe8b0('0xc')](_0x35fe3d,_0x2e56f4)[_0xe8b0('0xd')](function(_0x82589f){logger[_0xe8b0('0xe')](_0xe8b0('0xf'),_0x25faf7,_0xe8b0('0x10'));logger[_0xe8b0('0x11')](_0xe8b0('0x12'),_0x25faf7,'request\x20sent',JSON['stringify'](_0x82589f));if(_0x82589f[_0xe8b0('0x13')]){if(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x14')]===0x1f4){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);return _0x103966(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}logger[_0xe8b0('0x13')](_0xe8b0('0xf'),_0x25faf7,_0x82589f['error'][_0xe8b0('0x15')]);return _0x59f3a4(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}else{logger['info'](_0xe8b0('0xf'),_0x25faf7,'request\x20sent');_0x59f3a4(_0x82589f['result']['message']);}})[_0xe8b0('0x16')](function(_0x3818a7){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x3818a7);_0x103966(_0x3818a7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 690862f..3f8a97b 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 _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x7708,0x188));var _0x8770=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x7708[_0x3747ae];return _0x339035;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file +var _0xed3c=['sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x24181a,_0x1ef764){var _0xe3d59a=function(_0x434449){while(--_0x434449){_0x24181a['push'](_0x24181a['shift']());}};_0xe3d59a(++_0x1ef764);}(_0xed3c,0x1a6));var _0xced3=function(_0x321728,_0x1fbc48){_0x321728=_0x321728-0x0;var _0x211876=_0xed3c[_0x321728];return _0x211876;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xc')]);router[_0xced3('0x8')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router['get'](_0xced3('0xf'),auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);router['post']('/',auth[_0xced3('0x9')](),controller[_0xced3('0x11')]);router[_0xced3('0x12')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0x13')]);router[_0xced3('0x12')]('/:id/tags',auth[_0xced3('0x9')](),interaction['tracked'](_0xced3('0x14'),_0xced3('0x15')),controller[_0xced3('0x16')]);router[_0xced3('0x17')]('/:id',auth[_0xced3('0x9')](),interaction[_0xced3('0x18')]('sms',_0xced3('0x19')),controller[_0xced3('0x1a')]);router[_0xced3('0x1b')](_0xced3('0x1c'),auth['isAuthenticated'](),interaction[_0xced3('0x18')]('sms',_0xced3('0x1d')),controller[_0xced3('0x1e')]);router[_0xced3('0x1b')](_0xced3('0x1f'),auth[_0xced3('0x9')](),controller[_0xced3('0x20')]);module[_0xced3('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 5c062eb..afdfe26 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 _0xc74c=['out','BOOLEAN','INTEGER','sequelize','moment','DATE','STRING','ENUM'];(function(_0x30af1b,_0x476f62){var _0x5ed313=function(_0x552b9d){while(--_0x552b9d){_0x30af1b['push'](_0x30af1b['shift']());}};_0x5ed313(++_0x476f62);}(_0xc74c,0x163));var _0xcc74=function(_0x51a4fc,_0x397414){_0x51a4fc=_0x51a4fc-0x0;var _0x46ce2e=_0xc74c[_0x51a4fc];return _0x46ce2e;};'use strict';var Sequelize=require(_0xcc74('0x0'));var moment=require(_0xcc74('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcc74('0x2')]},'disposition':{'type':Sequelize[_0xcc74('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcc74('0x3')]},'note':{'type':Sequelize[_0xcc74('0x3')]},'phone':{'type':Sequelize[_0xcc74('0x3')]},'read1stAt':{'type':Sequelize[_0xcc74('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xcc74('0x4')]('in',_0xcc74('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcc74('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcc74('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcc74('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xcc74('0x7')]}}; \ No newline at end of file +var _0x00ea=['STRING','ENUM','out','BOOLEAN','INTEGER','moment','exports','DATE'];(function(_0x56974d,_0xf84545){var _0x27e676=function(_0x584e8b){while(--_0x584e8b){_0x56974d['push'](_0x56974d['shift']());}};_0x27e676(++_0xf84545);}(_0x00ea,0x19d));var _0xa00e=function(_0x22c45b,_0x36c4d6){_0x22c45b=_0x22c45b-0x0;var _0xe984ad=_0x00ea[_0x22c45b];return _0xe984ad;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa00e('0x0'));module[_0xa00e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa00e('0x2')]},'disposition':{'type':Sequelize[_0xa00e('0x3')]},'secondDisposition':{'type':Sequelize[_0xa00e('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa00e('0x3')]},'note':{'type':Sequelize[_0xa00e('0x3')]},'phone':{'type':Sequelize[_0xa00e('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa00e('0x4')]('in',_0xa00e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa00e('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa00e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa00e('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa00e('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 6e3a369..5c48263 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 _0xf2cc=['emit','removeTags','download','unix','toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','createdAt','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closed','disposition','Messages','direction','out','System','lastName','read','value','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','unlinkSync','rimraf','moment','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','end','error','name','send','index','SmsInteraction','rawAttributes','type','key','getOptions','sms','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','order','sort','pick','where','filter','map','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','Tag','color'];(function(_0x2ff535,_0xd6516e){var _0x244584=function(_0x275c11){while(--_0x275c11){_0x2ff535['push'](_0x2ff535['shift']());}};_0x244584(++_0xd6516e);}(_0xf2cc,0x112));var _0xcf2c=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xf2cc[_0xa1e3e3];return _0xc980e9;};'use strict';var rimraf=require(_0xcf2c('0x0'));var zipdir=require('zip-dir');var moment=require(_0xcf2c('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xcf2c('0x2'));var ejs=require(_0xcf2c('0x3'));var fs=require('fs');var _=require(_0xcf2c('0x4'));var Redis=require(_0xcf2c('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xcf2c('0x6'));var pdf=require(_0xcf2c('0x7'));var logger=require('../../config/logger')(_0xcf2c('0x8'));var config=require(_0xcf2c('0x9'));var db=require(_0xcf2c('0xa'))['db'];config[_0xcf2c('0xb')]=_[_0xcf2c('0xc')](config[_0xcf2c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf2c('0xd'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1496d6,_0x5da44b){_0x5da44b=_0x5da44b||0xcc;return function(_0x6b5521){if(_0x6b5521){return _0x1496d6[_0xcf2c('0xe')](_0x5da44b);}return _0x1496d6[_0xcf2c('0xf')](_0x5da44b)['end']();};}function respondWithResult(_0x30ae7a,_0x4cf86f){_0x4cf86f=_0x4cf86f||0xc8;return function(_0x2674b9){if(_0x2674b9){return _0x30ae7a[_0xcf2c('0xf')](_0x4cf86f)['json'](_0x2674b9);}};}function respondWithFilteredResult(_0x2abcce,_0x12f1c9){return function(_0x17bc86){if(_0x17bc86){var _0x5d9007=typeof _0x12f1c9['offset']===_0xcf2c('0x10')&&typeof _0x12f1c9[_0xcf2c('0x11')]==='undefined';var _0x3aaba8=_0x17bc86[_0xcf2c('0x12')];var _0x55edf1=_0x5d9007?0x0:_0x12f1c9[_0xcf2c('0x13')];var _0x156514=_0x5d9007?_0x17bc86[_0xcf2c('0x12')]:_0x12f1c9['offset']+_0x12f1c9[_0xcf2c('0x11')];var _0x59db18;if(_0x156514>=_0x3aaba8){_0x156514=_0x3aaba8;_0x59db18=0xc8;}else{_0x59db18=0xce;}_0x2abcce[_0xcf2c('0xf')](_0x59db18);return _0x2abcce[_0xcf2c('0x14')](_0xcf2c('0x15'),_0x55edf1+'-'+_0x156514+'/'+_0x3aaba8)[_0xcf2c('0x16')](_0x17bc86);}return null;};}function saveUpdates(_0x33f66a){return function(_0x4f1a7f){if(_0x4f1a7f){return _0x4f1a7f[_0xcf2c('0x17')](_0x33f66a)[_0xcf2c('0x18')](function(_0x151f00){return _0x151f00;});}return null;};}function removeEntity(_0xbf5da){return function(_0x5313df){if(_0x5313df){return _0x5313df[_0xcf2c('0x19')]()[_0xcf2c('0x18')](function(){_0xbf5da['status'](0xcc)[_0xcf2c('0x1a')]();});}};}function handleEntityNotFound(_0x57fe2c){return function(_0xcbcdd7){if(!_0xcbcdd7){_0x57fe2c['sendStatus'](0x194);}return _0xcbcdd7;};}function handleError(_0x3134f0,_0x5139ff){_0x5139ff=_0x5139ff||0x1f4;return function(_0x240f9d){logger[_0xcf2c('0x1b')](_0x240f9d['stack']);if(_0x240f9d['name']){delete _0x240f9d[_0xcf2c('0x1c')];}_0x3134f0[_0xcf2c('0xf')](_0x5139ff)[_0xcf2c('0x1d')](_0x240f9d);};}exports[_0xcf2c('0x1e')]=function(_0x5f0e7c,_0x58fc8b){var _0x20c7f6={};var _0x28f074=_['map'](db[_0xcf2c('0x1f')][_0xcf2c('0x20')],function(_0x355cdf){return{'name':_0x355cdf['fieldName'],'type':_0x355cdf[_0xcf2c('0x21')][_0xcf2c('0x22')]};});_0x20c7f6=qs[_0xcf2c('0x23')](_0x28f074,_0x5f0e7c);return interaction['findAll'](_0xcf2c('0x24'),_0x5f0e7c[_0xcf2c('0x25')],_0x5f0e7c[_0xcf2c('0x26')],_0x20c7f6,_0x28f074)[_0xcf2c('0x18')](respondWithFilteredResult(_0x58fc8b,_0x20c7f6))[_0xcf2c('0x27')](handleError(_0x58fc8b,null));};exports[_0xcf2c('0x28')]=function(_0x85f05f,_0x31f113){var _0x3326e8={'raw':![],'where':{'id':_0x85f05f[_0xcf2c('0x29')]['id']}},_0x596235={};_0x596235[_0xcf2c('0x2a')]=_[_0xcf2c('0x2b')](db[_0xcf2c('0x1f')][_0xcf2c('0x20')]);_0x596235[_0xcf2c('0x25')]=_[_0xcf2c('0x2b')](_0x85f05f[_0xcf2c('0x25')]);_0x596235[_0xcf2c('0x2c')]=_[_0xcf2c('0x2d')](_0x596235[_0xcf2c('0x2a')],_0x596235[_0xcf2c('0x25')]);_0x3326e8[_0xcf2c('0x2e')]=_[_0xcf2c('0x2d')](_0x596235['model'],qs[_0xcf2c('0x2f')](_0x85f05f[_0xcf2c('0x25')][_0xcf2c('0x2f')]));_0x3326e8[_0xcf2c('0x2e')]=_0x3326e8['attributes'][_0xcf2c('0x30')]?_0x3326e8[_0xcf2c('0x2e')]:_0x596235[_0xcf2c('0x2a')];if(_0x85f05f['query'][_0xcf2c('0x31')]){_0x3326e8[_0xcf2c('0x32')]=[{'all':!![]}];}_0x3326e8=_[_0xcf2c('0x33')]({},_0x3326e8,_0x85f05f[_0xcf2c('0x34')]);return db[_0xcf2c('0x1f')][_0xcf2c('0x35')](_0x3326e8)['then'](handleEntityNotFound(_0x31f113,null))[_0xcf2c('0x18')](respondWithResult(_0x31f113,null))[_0xcf2c('0x27')](handleError(_0x31f113,null));};exports['create']=function(_0x48a725,_0x1a54a6){return db[_0xcf2c('0x1f')]['create'](_0x48a725[_0xcf2c('0x36')],{})[_0xcf2c('0x18')](respondWithResult(_0x1a54a6,0xc9))[_0xcf2c('0x27')](handleError(_0x1a54a6,null));};exports[_0xcf2c('0x17')]=function(_0x14798f,_0x4f616b){if(_0x14798f[_0xcf2c('0x36')]['id']){delete _0x14798f['body']['id'];}return db['SmsInteraction'][_0xcf2c('0x35')]({'where':{'id':_0x14798f[_0xcf2c('0x29')]['id']}})[_0xcf2c('0x18')](handleEntityNotFound(_0x4f616b,null))['then'](saveUpdates(_0x14798f[_0xcf2c('0x36')],null))['then'](respondWithResult(_0x4f616b,null))['catch'](handleError(_0x4f616b,null));};exports[_0xcf2c('0x19')]=function(_0x49072e,_0x5b89ba){return db[_0xcf2c('0x1f')][_0xcf2c('0x35')]({'where':{'id':_0x49072e[_0xcf2c('0x29')]['id']}})['then'](handleEntityNotFound(_0x5b89ba,null))[_0xcf2c('0x18')](removeEntity(_0x5b89ba,null))[_0xcf2c('0x27')](handleError(_0x5b89ba,null));};exports['describe']=function(_0x2b310e,_0x3858d2){return db[_0xcf2c('0x1f')]['describe']()['then'](respondWithResult(_0x3858d2,null))[_0xcf2c('0x27')](handleError(_0x3858d2,null));};exports['addMessage']=function(_0xf71384,_0xc07851){return db['SmsMessage']['find']({'where':{'id':_0xf71384[_0xcf2c('0x29')]['id']}})[_0xcf2c('0x18')](handleEntityNotFound(_0xc07851,null))[_0xcf2c('0x18')](function(_0x3a3e5e){if(_0x3a3e5e){return _0x3a3e5e[_0xcf2c('0x37')](_0xf71384[_0xcf2c('0x36')][_0xcf2c('0x38')],_[_0xcf2c('0x39')](_0xf71384[_0xcf2c('0x36')],[_0xcf2c('0x38'),'id'])||{});}})[_0xcf2c('0x18')](respondWithResult(_0xc07851,null))[_0xcf2c('0x27')](handleError(_0xc07851,null));};exports[_0xcf2c('0x3a')]=function(_0x44e3fa,_0xbc8930){var _0x47b33d={'raw':![],'where':{}};var _0x3e93d2={};var _0x53843e={'count':0x0,'rows':[]};return db[_0xcf2c('0x1f')][_0xcf2c('0x3b')]({'where':{'id':_0x44e3fa['params']['id']}})[_0xcf2c('0x18')](handleEntityNotFound(_0xbc8930,null))['then'](function(_0x4cee0e){if(_0x4cee0e){_0x3e93d2['model']=_['keys'](db[_0xcf2c('0x3c')]['rawAttributes']);_0x3e93d2[_0xcf2c('0x25')]=_[_0xcf2c('0x2b')](_0x44e3fa[_0xcf2c('0x25')]);_0x3e93d2[_0xcf2c('0x2c')]=_[_0xcf2c('0x2d')](_0x3e93d2['model'],_0x3e93d2['query']);_0x47b33d[_0xcf2c('0x2e')]=_[_0xcf2c('0x2d')](_0x3e93d2[_0xcf2c('0x2a')],qs[_0xcf2c('0x2f')](_0x44e3fa[_0xcf2c('0x25')][_0xcf2c('0x2f')]));_0x47b33d[_0xcf2c('0x2e')]=_0x47b33d[_0xcf2c('0x2e')][_0xcf2c('0x30')]?_0x47b33d[_0xcf2c('0x2e')]:_0x3e93d2[_0xcf2c('0x2a')];if(!_0x44e3fa['query'][_0xcf2c('0x3d')](_0xcf2c('0x3e'))){_0x47b33d[_0xcf2c('0x11')]=qs['limit'](_0x44e3fa[_0xcf2c('0x25')][_0xcf2c('0x11')]);_0x47b33d[_0xcf2c('0x13')]=qs[_0xcf2c('0x13')](_0x44e3fa[_0xcf2c('0x25')]['offset']);}_0x47b33d[_0xcf2c('0x3f')]=qs[_0xcf2c('0x40')](_0x44e3fa[_0xcf2c('0x25')][_0xcf2c('0x40')]);_0x47b33d['where']=qs[_0xcf2c('0x2c')](_[_0xcf2c('0x41')](_0x44e3fa['query'],_0x3e93d2[_0xcf2c('0x2c')]));_0x47b33d[_0xcf2c('0x42')]['SmsInteractionId']=_0x4cee0e['id'];if(_0x44e3fa[_0xcf2c('0x25')][_0xcf2c('0x43')]){_0x47b33d[_0xcf2c('0x42')]=_[_0xcf2c('0x33')](_0x47b33d['where'],{'$or':_[_0xcf2c('0x44')](_0x47b33d[_0xcf2c('0x2e')],function(_0x57ac8c){var _0x2609d6={};_0x2609d6[_0x57ac8c]={'$like':'%'+_0x44e3fa['query'][_0xcf2c('0x43')]+'%'};return _0x2609d6;})});}if(_0x44e3fa[_0xcf2c('0x25')][_0xcf2c('0x45')]){var _0x3448a1=_0x44e3fa[_0xcf2c('0x25')][_0xcf2c('0x45')]['split'](',');var _0x46829f={};_0x46829f[_0x3448a1[0x0]]={'$gte':moment(_0x3448a1[0x1])['format'](_0xcf2c('0x46'))};_0x47b33d[_0xcf2c('0x42')]=_[_0xcf2c('0x33')](_0x47b33d['where'],_0x46829f);}_0x47b33d=_[_0xcf2c('0x33')]({},_0x47b33d,_0x44e3fa['options']);return db[_0xcf2c('0x3c')]['count']({'where':_0x47b33d[_0xcf2c('0x42')]})[_0xcf2c('0x18')](function(_0x53938f){_0x53843e[_0xcf2c('0x12')]=_0x53938f;if(_0x44e3fa[_0xcf2c('0x25')][_0xcf2c('0x31')]){_0x47b33d['include']=[{'all':!![]}];}return db[_0xcf2c('0x3c')][_0xcf2c('0x47')](_0x47b33d);})['then'](function(_0x417d9a){_0x53843e[_0xcf2c('0x48')]=_0x417d9a;return _0x53843e;});}})[_0xcf2c('0x18')](respondWithFilteredResult(_0xbc8930,_0x47b33d))[_0xcf2c('0x27')](handleError(_0xbc8930,null));};exports[_0xcf2c('0x49')]=function(_0x14d82b,_0x422a8){return db[_0xcf2c('0x1f')][_0xcf2c('0x35')]({'where':{'id':_0x14d82b[_0xcf2c('0x29')]['id']}})[_0xcf2c('0x18')](handleEntityNotFound(_0x422a8,null))[_0xcf2c('0x18')](function(_0x623571){if(_0x623571){return _0x623571[_0xcf2c('0x4a')](_0x14d82b[_0xcf2c('0x36')][_0xcf2c('0x38')],_[_0xcf2c('0x39')](_0x14d82b['body'],[_0xcf2c('0x38'),'id'])||{})['spread'](function(){return db[_0xcf2c('0x4b')][_0xcf2c('0x47')]({'attributes':['id',_0xcf2c('0x1c'),_0xcf2c('0x4c')],'where':{'id':_0x14d82b[_0xcf2c('0x36')][_0xcf2c('0x38')]}});})[_0xcf2c('0x18')](function(_0x296535){socket[_0xcf2c('0x4d')]('smsInteractionTags:save',{'id':Number(_0x14d82b['params']['id']),'tags':_0x296535||[]});return{'id':Number(_0x14d82b['params']['id']),'tags':_0x296535||[]};});}})['then'](respondWithResult(_0x422a8,null))['catch'](handleError(_0x422a8,null));};exports[_0xcf2c('0x4e')]=function(_0x560425,_0x20d6ab){return db[_0xcf2c('0x1f')][_0xcf2c('0x35')]({'where':{'id':_0x560425[_0xcf2c('0x29')]['id']}})[_0xcf2c('0x18')](handleEntityNotFound(_0x20d6ab,null))[_0xcf2c('0x18')](function(_0x3833b5){if(_0x3833b5){return _0x3833b5['removeTags'](_0x560425[_0xcf2c('0x25')][_0xcf2c('0x38')]);}})[_0xcf2c('0x18')](respondWithStatusCode(_0x20d6ab,null))[_0xcf2c('0x27')](handleError(_0x20d6ab,null));};exports[_0xcf2c('0x4f')]=function(_0xeb9472,_0x3eb604){var _0x208890=moment()[_0xcf2c('0x50')]()[_0xcf2c('0x51')]();var _0x39433c=path[_0xcf2c('0x52')](config[_0xcf2c('0x53')],_0xcf2c('0x54'),_0xcf2c('0x55'),_0xcf2c('0x56'));var _0x5c4cd8=path[_0xcf2c('0x52')](_0x39433c,_0x208890);var _0x2adc83=util[_0xcf2c('0x57')](_0xcf2c('0x58'),_0xeb9472[_0xcf2c('0x29')]['id'],_0x208890);var _0x1c7043=path[_0xcf2c('0x52')](_0x39433c,_0x2adc83);var _0x17bcc3=[];_0x17bcc3[_0xcf2c('0x59')]({'model':db[_0xcf2c('0x5a')],'as':_0xcf2c('0x5a'),'attributes':['id',_0xcf2c('0x5b')],'raw':!![]});_0x17bcc3[_0xcf2c('0x59')]({'model':db['CmContact'],'as':_0xcf2c('0x5c'),'attributes':['id',_0xcf2c('0x5d'),'lastName'],'raw':!![]});var _0x195895=[{'model':db[_0xcf2c('0x3c')],'as':'Messages','attributes':['id',_0xcf2c('0x36'),_0xcf2c('0x5e'),'direction',_0xcf2c('0x5f'),'read'],'include':_0x17bcc3}];_0x195895[_0xcf2c('0x59')]({'model':db[_0xcf2c('0x60')],'as':_0xcf2c('0x61'),'attributes':['id',_0xcf2c('0x1c')]});_0x195895[_0xcf2c('0x59')]({'model':db['User'],'as':_0xcf2c('0x62'),'attributes':['id','fullname']});return db['SmsInteraction']['find']({'where':{'id':_0xeb9472[_0xcf2c('0x29')]['id']},'include':_0x195895})[_0xcf2c('0x18')](handleEntityNotFound(_0x3eb604,null))['then'](function(_0x1afacb){if(_0x1afacb){var _0x40dc67=_0x1afacb['get']({'plain':!![]});fs[_0xcf2c('0x63')](_0x5c4cd8);var _0x37a86f={'channel':_0xcf2c('0x64'),'account':_0x40dc67[_0xcf2c('0x61')][_0xcf2c('0x1c')],'agent':_0x40dc67[_0xcf2c('0x62')]?_0x40dc67[_0xcf2c('0x62')]['fullname']:_0xcf2c('0x65'),'createdAt':moment(_0x40dc67[_0xcf2c('0x5e')])[_0xcf2c('0x57')](_0xcf2c('0x46'))[_0xcf2c('0x51')](),'closedAt':_0x40dc67[_0xcf2c('0x66')]?moment(_0x40dc67['closedAt'])['format'](_0xcf2c('0x46'))[_0xcf2c('0x51')]():'','disposition':_0x40dc67[_0xcf2c('0x67')],'messages':_(_0x40dc67[_0xcf2c('0x68')])[_0xcf2c('0x43')]({'secret':![]})['map'](function(_0xdc08be){return{'date':moment(_0xdc08be[_0xcf2c('0x5e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xcf2c('0x51')](),'sender':_0xdc08be[_0xcf2c('0x69')]===_0xcf2c('0x6a')?_0xdc08be['User']?_0xdc08be[_0xcf2c('0x5a')][_0xcf2c('0x5b')]:_0xcf2c('0x6b'):_0xdc08be[_0xcf2c('0x5c')][_0xcf2c('0x5d')]+(_0xdc08be[_0xcf2c('0x5c')][_0xcf2c('0x6c')]?'\x20'+_0xdc08be[_0xcf2c('0x5c')][_0xcf2c('0x6c')]:''),'body':_0xdc08be[_0xcf2c('0x36')],'direction':_0xdc08be[_0xcf2c('0x69')]===_0xcf2c('0x6a')?'A':'C','secret':_0xdc08be[_0xcf2c('0x5f')],'read':_0xdc08be[_0xcf2c('0x6d')]};})[_0xcf2c('0x6e')]()};return ejs[_0xcf2c('0x6f')](path['join'](config['root'],_0xcf2c('0x54'),_0xcf2c('0x70'),_0xcf2c('0x71')),{'interaction':_0x37a86f})['then'](function(_0x4ae2c0){var _0x5af3b7=path[_0xcf2c('0x52')](_0x5c4cd8,'transcript-'+_0x40dc67['id']+'-'+_0x208890+'.pdf');var _0x429d49={'path':_0x5af3b7,'channel':_0xcf2c('0x64'),'interactionId':_0x40dc67['id']};return pdf[_0xcf2c('0x72')](_0x4ae2c0,_0x429d49);})[_0xcf2c('0x18')](function(){return new BPromise(function(_0x3dfb78,_0x52c2cb){zipdir(_0x5c4cd8,{'saveTo':_0x1c7043},function(_0x40074c,_0x5b3bb7){if(_0x40074c)return _0x52c2cb(_0x40074c);return _0x3dfb78(_0x5b3bb7);});})[_0xcf2c('0x18')](function(){return new BPromise(function(_0x26ab1b,_0x37e5c6){rimraf(_0x5c4cd8,function(_0x432551){if(_0x432551)_0x37e5c6(_0x432551);return _0x26ab1b();});});})[_0xcf2c('0x18')](function(){return _0x3eb604['download'](_0x1c7043,_0x2adc83,function(_0x597be4){if(_0x597be4){console[_0xcf2c('0x73')]('err',_0x597be4);}else{fs[_0xcf2c('0x74')](_0x1c7043);}});});});}else{return _0x3eb604[_0xcf2c('0xe')](0xc8);}})[_0xcf2c('0x27')](handleError(_0x3eb604,null));}; \ No newline at end of file +var _0xd0cd=['../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','limit','undefined','count','offset','set','update','sendStatus','error','stack','send','SmsInteraction','fieldName','type','key','findAll','sms','query','user','then','catch','show','keys','filters','model','intersection','fields','attributes','length','includeAll','include','merge','options','create','body','find','params','destroy','describe','SmsMessage','ids','omit','getMessages','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','name','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','Sms','createdAt','closedAt','disposition','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0xd0cd,0xe5));var _0xdd0c=function(_0x1ff414,_0x12c95d){_0x1ff414=_0x1ff414-0x0;var _0x52c0fa=_0xd0cd[_0x1ff414];return _0x52c0fa;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xdd0c('0x0'));var BPromise=require(_0xdd0c('0x1'));var util=require('util');var path=require(_0xdd0c('0x2'));var ejs=require(_0xdd0c('0x3'));var fs=require('fs');var _=require(_0xdd0c('0x4'));var Redis=require(_0xdd0c('0x5'));var interaction=require(_0xdd0c('0x6'));var qs=require(_0xdd0c('0x7'));var pdf=require(_0xdd0c('0x8'));var logger=require(_0xdd0c('0x9'))(_0xdd0c('0xa'));var config=require('../../config/environment');var db=require(_0xdd0c('0xb'))['db'];config[_0xdd0c('0xc')]=_['defaults'](config[_0xdd0c('0xc')],{'host':_0xdd0c('0xd'),'port':0x18eb});var socket=require(_0xdd0c('0xe'))(new Redis(config[_0xdd0c('0xc')]));require(_0xdd0c('0xf'))[_0xdd0c('0x10')](socket);function respondWithStatusCode(_0x1de343,_0x4d0aca){_0x4d0aca=_0x4d0aca||0xcc;return function(_0x389ea9){if(_0x389ea9){return _0x1de343['sendStatus'](_0x4d0aca);}return _0x1de343[_0xdd0c('0x11')](_0x4d0aca)[_0xdd0c('0x12')]();};}function respondWithResult(_0x4e7cdf,_0x1674be){_0x1674be=_0x1674be||0xc8;return function(_0x262d9c){if(_0x262d9c){return _0x4e7cdf[_0xdd0c('0x11')](_0x1674be)[_0xdd0c('0x13')](_0x262d9c);}};}function respondWithFilteredResult(_0x5f5f1,_0x1fd833){return function(_0x565bf6){if(_0x565bf6){var _0x2bac95=typeof _0x1fd833['offset']==='undefined'&&typeof _0x1fd833[_0xdd0c('0x14')]===_0xdd0c('0x15');var _0x166f37=_0x565bf6[_0xdd0c('0x16')];var _0x3c469e=_0x2bac95?0x0:_0x1fd833[_0xdd0c('0x17')];var _0x3a8e2b=_0x2bac95?_0x565bf6[_0xdd0c('0x16')]:_0x1fd833[_0xdd0c('0x17')]+_0x1fd833['limit'];var _0x2c2eee;if(_0x3a8e2b>=_0x166f37){_0x3a8e2b=_0x166f37;_0x2c2eee=0xc8;}else{_0x2c2eee=0xce;}_0x5f5f1[_0xdd0c('0x11')](_0x2c2eee);return _0x5f5f1[_0xdd0c('0x18')]('Content-Range',_0x3c469e+'-'+_0x3a8e2b+'/'+_0x166f37)[_0xdd0c('0x13')](_0x565bf6);}return null;};}function saveUpdates(_0x57b13f){return function(_0x365af0){if(_0x365af0){return _0x365af0[_0xdd0c('0x19')](_0x57b13f)['then'](function(_0x19c3d9){return _0x19c3d9;});}return null;};}function removeEntity(_0x44fd0c){return function(_0x4d35e2){if(_0x4d35e2){return _0x4d35e2['destroy']()['then'](function(){_0x44fd0c[_0xdd0c('0x11')](0xcc)[_0xdd0c('0x12')]();});}};}function handleEntityNotFound(_0x425134){return function(_0x562972){if(!_0x562972){_0x425134[_0xdd0c('0x1a')](0x194);}return _0x562972;};}function handleError(_0x42beef,_0x38ed8f){_0x38ed8f=_0x38ed8f||0x1f4;return function(_0x340694){logger[_0xdd0c('0x1b')](_0x340694[_0xdd0c('0x1c')]);if(_0x340694['name']){delete _0x340694['name'];}_0x42beef['status'](_0x38ed8f)[_0xdd0c('0x1d')](_0x340694);};}exports['index']=function(_0x138f32,_0x30222d){var _0x5ee802={};var _0x2e37a1=_['map'](db[_0xdd0c('0x1e')]['rawAttributes'],function(_0x2ad977){return{'name':_0x2ad977[_0xdd0c('0x1f')],'type':_0x2ad977[_0xdd0c('0x20')][_0xdd0c('0x21')]};});_0x5ee802=qs['getOptions'](_0x2e37a1,_0x138f32);return interaction[_0xdd0c('0x22')](_0xdd0c('0x23'),_0x138f32[_0xdd0c('0x24')],_0x138f32[_0xdd0c('0x25')],_0x5ee802,_0x2e37a1)[_0xdd0c('0x26')](respondWithFilteredResult(_0x30222d,_0x5ee802))[_0xdd0c('0x27')](handleError(_0x30222d,null));};exports[_0xdd0c('0x28')]=function(_0x3269b6,_0x18c3e9){var _0x6ed3d4={'raw':![],'where':{'id':_0x3269b6['params']['id']}},_0x4f6c13={};_0x4f6c13['model']=_[_0xdd0c('0x29')](db[_0xdd0c('0x1e')]['rawAttributes']);_0x4f6c13['query']=_[_0xdd0c('0x29')](_0x3269b6['query']);_0x4f6c13[_0xdd0c('0x2a')]=_['intersection'](_0x4f6c13[_0xdd0c('0x2b')],_0x4f6c13[_0xdd0c('0x24')]);_0x6ed3d4['attributes']=_[_0xdd0c('0x2c')](_0x4f6c13[_0xdd0c('0x2b')],qs[_0xdd0c('0x2d')](_0x3269b6[_0xdd0c('0x24')]['fields']));_0x6ed3d4['attributes']=_0x6ed3d4[_0xdd0c('0x2e')][_0xdd0c('0x2f')]?_0x6ed3d4[_0xdd0c('0x2e')]:_0x4f6c13[_0xdd0c('0x2b')];if(_0x3269b6[_0xdd0c('0x24')][_0xdd0c('0x30')]){_0x6ed3d4[_0xdd0c('0x31')]=[{'all':!![]}];}_0x6ed3d4=_[_0xdd0c('0x32')]({},_0x6ed3d4,_0x3269b6[_0xdd0c('0x33')]);return db[_0xdd0c('0x1e')]['find'](_0x6ed3d4)[_0xdd0c('0x26')](handleEntityNotFound(_0x18c3e9,null))[_0xdd0c('0x26')](respondWithResult(_0x18c3e9,null))[_0xdd0c('0x27')](handleError(_0x18c3e9,null));};exports[_0xdd0c('0x34')]=function(_0x4e6404,_0x4d84a8){return db[_0xdd0c('0x1e')][_0xdd0c('0x34')](_0x4e6404[_0xdd0c('0x35')],{})[_0xdd0c('0x26')](respondWithResult(_0x4d84a8,0xc9))[_0xdd0c('0x27')](handleError(_0x4d84a8,null));};exports[_0xdd0c('0x19')]=function(_0x21a0f7,_0x28fc3d){if(_0x21a0f7[_0xdd0c('0x35')]['id']){delete _0x21a0f7[_0xdd0c('0x35')]['id'];}return db['SmsInteraction'][_0xdd0c('0x36')]({'where':{'id':_0x21a0f7[_0xdd0c('0x37')]['id']}})[_0xdd0c('0x26')](handleEntityNotFound(_0x28fc3d,null))[_0xdd0c('0x26')](saveUpdates(_0x21a0f7['body'],null))[_0xdd0c('0x26')](respondWithResult(_0x28fc3d,null))[_0xdd0c('0x27')](handleError(_0x28fc3d,null));};exports[_0xdd0c('0x38')]=function(_0x5647a5,_0x319be9){return db[_0xdd0c('0x1e')][_0xdd0c('0x36')]({'where':{'id':_0x5647a5['params']['id']}})[_0xdd0c('0x26')](handleEntityNotFound(_0x319be9,null))[_0xdd0c('0x26')](removeEntity(_0x319be9,null))[_0xdd0c('0x27')](handleError(_0x319be9,null));};exports[_0xdd0c('0x39')]=function(_0x103feb,_0x60f0a4){return db['SmsInteraction'][_0xdd0c('0x39')]()[_0xdd0c('0x26')](respondWithResult(_0x60f0a4,null))[_0xdd0c('0x27')](handleError(_0x60f0a4,null));};exports['addMessage']=function(_0x158415,_0x197a89){return db[_0xdd0c('0x3a')][_0xdd0c('0x36')]({'where':{'id':_0x158415['params']['id']}})[_0xdd0c('0x26')](handleEntityNotFound(_0x197a89,null))[_0xdd0c('0x26')](function(_0x28f3f2){if(_0x28f3f2){return _0x28f3f2['addMessage'](_0x158415[_0xdd0c('0x35')][_0xdd0c('0x3b')],_[_0xdd0c('0x3c')](_0x158415[_0xdd0c('0x35')],[_0xdd0c('0x3b'),'id'])||{});}})[_0xdd0c('0x26')](respondWithResult(_0x197a89,null))[_0xdd0c('0x27')](handleError(_0x197a89,null));};exports[_0xdd0c('0x3d')]=function(_0x46b063,_0x1e1fac){var _0x3b2efa={'raw':![],'where':{}};var _0x3824e6={};var _0x538803={'count':0x0,'rows':[]};return db[_0xdd0c('0x1e')][_0xdd0c('0x3e')]({'where':{'id':_0x46b063[_0xdd0c('0x37')]['id']}})['then'](handleEntityNotFound(_0x1e1fac,null))[_0xdd0c('0x26')](function(_0x115888){if(_0x115888){_0x3824e6[_0xdd0c('0x2b')]=_['keys'](db[_0xdd0c('0x3a')][_0xdd0c('0x3f')]);_0x3824e6[_0xdd0c('0x24')]=_['keys'](_0x46b063[_0xdd0c('0x24')]);_0x3824e6[_0xdd0c('0x2a')]=_[_0xdd0c('0x2c')](_0x3824e6[_0xdd0c('0x2b')],_0x3824e6[_0xdd0c('0x24')]);_0x3b2efa['attributes']=_[_0xdd0c('0x2c')](_0x3824e6[_0xdd0c('0x2b')],qs[_0xdd0c('0x2d')](_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x2d')]));_0x3b2efa[_0xdd0c('0x2e')]=_0x3b2efa[_0xdd0c('0x2e')]['length']?_0x3b2efa[_0xdd0c('0x2e')]:_0x3824e6[_0xdd0c('0x2b')];if(!_0x46b063['query'][_0xdd0c('0x40')](_0xdd0c('0x41'))){_0x3b2efa[_0xdd0c('0x14')]=qs[_0xdd0c('0x14')](_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x14')]);_0x3b2efa['offset']=qs[_0xdd0c('0x17')](_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x17')]);}_0x3b2efa[_0xdd0c('0x42')]=qs[_0xdd0c('0x43')](_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x43')]);_0x3b2efa[_0xdd0c('0x44')]=qs[_0xdd0c('0x2a')](_['pick'](_0x46b063[_0xdd0c('0x24')],_0x3824e6[_0xdd0c('0x2a')]));_0x3b2efa[_0xdd0c('0x44')][_0xdd0c('0x45')]=_0x115888['id'];if(_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x46')]){_0x3b2efa[_0xdd0c('0x44')]=_[_0xdd0c('0x32')](_0x3b2efa[_0xdd0c('0x44')],{'$or':_[_0xdd0c('0x47')](_0x3b2efa[_0xdd0c('0x2e')],function(_0x37b776){var _0x3573e0={};_0x3573e0[_0x37b776]={'$like':'%'+_0x46b063[_0xdd0c('0x24')]['filter']+'%'};return _0x3573e0;})});}if(_0x46b063['query'][_0xdd0c('0x48')]){var _0x497d1a=_0x46b063['query'][_0xdd0c('0x48')][_0xdd0c('0x49')](',');var _0x298320={};_0x298320[_0x497d1a[0x0]]={'$gte':moment(_0x497d1a[0x1])['format'](_0xdd0c('0x4a'))};_0x3b2efa['where']=_[_0xdd0c('0x32')](_0x3b2efa[_0xdd0c('0x44')],_0x298320);}_0x3b2efa=_[_0xdd0c('0x32')]({},_0x3b2efa,_0x46b063['options']);return db[_0xdd0c('0x3a')]['count']({'where':_0x3b2efa[_0xdd0c('0x44')]})[_0xdd0c('0x26')](function(_0x34ab2e){_0x538803[_0xdd0c('0x16')]=_0x34ab2e;if(_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x30')]){_0x3b2efa[_0xdd0c('0x31')]=[{'all':!![]}];}return db['SmsMessage'][_0xdd0c('0x22')](_0x3b2efa);})[_0xdd0c('0x26')](function(_0x3eb0d4){_0x538803[_0xdd0c('0x4b')]=_0x3eb0d4;return _0x538803;});}})[_0xdd0c('0x26')](respondWithFilteredResult(_0x1e1fac,_0x3b2efa))[_0xdd0c('0x27')](handleError(_0x1e1fac,null));};exports[_0xdd0c('0x4c')]=function(_0x2e0920,_0xb7ea77){return db['SmsInteraction'][_0xdd0c('0x36')]({'where':{'id':_0x2e0920[_0xdd0c('0x37')]['id']}})['then'](handleEntityNotFound(_0xb7ea77,null))[_0xdd0c('0x26')](function(_0x173e53){if(_0x173e53){return _0x173e53[_0xdd0c('0x4d')](_0x2e0920[_0xdd0c('0x35')]['ids'],_[_0xdd0c('0x3c')](_0x2e0920[_0xdd0c('0x35')],[_0xdd0c('0x3b'),'id'])||{})[_0xdd0c('0x4e')](function(){return db['Tag']['findAll']({'attributes':['id',_0xdd0c('0x4f'),_0xdd0c('0x50')],'where':{'id':_0x2e0920[_0xdd0c('0x35')][_0xdd0c('0x3b')]}});})['then'](function(_0x2e7855){socket[_0xdd0c('0x51')](_0xdd0c('0x52'),{'id':Number(_0x2e0920[_0xdd0c('0x37')]['id']),'tags':_0x2e7855||[]});return{'id':Number(_0x2e0920[_0xdd0c('0x37')]['id']),'tags':_0x2e7855||[]};});}})[_0xdd0c('0x26')](respondWithResult(_0xb7ea77,null))[_0xdd0c('0x27')](handleError(_0xb7ea77,null));};exports[_0xdd0c('0x53')]=function(_0x3b5d92,_0x3f059a){return db['SmsInteraction'][_0xdd0c('0x36')]({'where':{'id':_0x3b5d92[_0xdd0c('0x37')]['id']}})[_0xdd0c('0x26')](handleEntityNotFound(_0x3f059a,null))[_0xdd0c('0x26')](function(_0x15b85c){if(_0x15b85c){return _0x15b85c['removeTags'](_0x3b5d92[_0xdd0c('0x24')][_0xdd0c('0x3b')]);}})[_0xdd0c('0x26')](respondWithStatusCode(_0x3f059a,null))['catch'](handleError(_0x3f059a,null));};exports[_0xdd0c('0x54')]=function(_0x4334b4,_0x1221b1){var _0x5b1694=moment()[_0xdd0c('0x55')]()[_0xdd0c('0x56')]();var _0x4bd57c=path[_0xdd0c('0x57')](config[_0xdd0c('0x58')],_0xdd0c('0x59'),'files',_0xdd0c('0x5a'));var _0x50cc78=path[_0xdd0c('0x57')](_0x4bd57c,_0x5b1694);var _0x27f1f2=util[_0xdd0c('0x5b')](_0xdd0c('0x5c'),_0x4334b4[_0xdd0c('0x37')]['id'],_0x5b1694);var _0x5d7a21=path[_0xdd0c('0x57')](_0x4bd57c,_0x27f1f2);var _0x15fd60=[];_0x15fd60[_0xdd0c('0x5d')]({'model':db[_0xdd0c('0x5e')],'as':'User','attributes':['id',_0xdd0c('0x5f')],'raw':!![]});_0x15fd60['push']({'model':db[_0xdd0c('0x60')],'as':_0xdd0c('0x61'),'attributes':['id',_0xdd0c('0x62'),_0xdd0c('0x63')],'raw':!![]});var _0x4302bb=[{'model':db['SmsMessage'],'as':_0xdd0c('0x64'),'attributes':['id',_0xdd0c('0x35'),'createdAt',_0xdd0c('0x65'),_0xdd0c('0x66'),'read'],'include':_0x15fd60}];_0x4302bb[_0xdd0c('0x5d')]({'model':db[_0xdd0c('0x67')],'as':_0xdd0c('0x68'),'attributes':['id',_0xdd0c('0x4f')]});_0x4302bb['push']({'model':db[_0xdd0c('0x5e')],'as':_0xdd0c('0x69'),'attributes':['id',_0xdd0c('0x5f')]});return db[_0xdd0c('0x1e')][_0xdd0c('0x36')]({'where':{'id':_0x4334b4[_0xdd0c('0x37')]['id']},'include':_0x4302bb})[_0xdd0c('0x26')](handleEntityNotFound(_0x1221b1,null))[_0xdd0c('0x26')](function(_0x1df146){if(_0x1df146){var _0x33b157=_0x1df146['get']({'plain':!![]});fs['mkdirSync'](_0x50cc78);var _0x2ddaf6={'channel':_0xdd0c('0x6a'),'account':_0x33b157[_0xdd0c('0x68')][_0xdd0c('0x4f')],'agent':_0x33b157[_0xdd0c('0x69')]?_0x33b157[_0xdd0c('0x69')][_0xdd0c('0x5f')]:'N.A.','createdAt':moment(_0x33b157[_0xdd0c('0x6b')])[_0xdd0c('0x5b')](_0xdd0c('0x4a'))[_0xdd0c('0x56')](),'closedAt':_0x33b157['closed']?moment(_0x33b157[_0xdd0c('0x6c')])[_0xdd0c('0x5b')](_0xdd0c('0x4a'))[_0xdd0c('0x56')]():'','disposition':_0x33b157[_0xdd0c('0x6d')],'messages':_(_0x33b157['Messages'])[_0xdd0c('0x46')]({'secret':![]})[_0xdd0c('0x47')](function(_0x35a751){return{'date':moment(_0x35a751[_0xdd0c('0x6b')])[_0xdd0c('0x5b')](_0xdd0c('0x4a'))[_0xdd0c('0x56')](),'sender':_0x35a751[_0xdd0c('0x65')]===_0xdd0c('0x6e')?_0x35a751[_0xdd0c('0x5e')]?_0x35a751['User'][_0xdd0c('0x5f')]:_0xdd0c('0x6f'):_0x35a751['Contact'][_0xdd0c('0x62')]+(_0x35a751[_0xdd0c('0x61')]['lastName']?'\x20'+_0x35a751[_0xdd0c('0x61')][_0xdd0c('0x63')]:''),'body':_0x35a751[_0xdd0c('0x35')],'direction':_0x35a751[_0xdd0c('0x65')]===_0xdd0c('0x6e')?'A':'C','secret':_0x35a751[_0xdd0c('0x66')],'read':_0x35a751[_0xdd0c('0x70')]};})[_0xdd0c('0x71')]()};return ejs[_0xdd0c('0x72')](path['join'](config['root'],_0xdd0c('0x59'),_0xdd0c('0x73'),_0xdd0c('0x74')),{'interaction':_0x2ddaf6})[_0xdd0c('0x26')](function(_0x28b9b1){var _0xddc2ef=path['join'](_0x50cc78,_0xdd0c('0x75')+_0x33b157['id']+'-'+_0x5b1694+'.pdf');var _0xa3cb25={'path':_0xddc2ef,'channel':_0xdd0c('0x6a'),'interactionId':_0x33b157['id']};return pdf[_0xdd0c('0x76')](_0x28b9b1,_0xa3cb25);})[_0xdd0c('0x26')](function(){return new BPromise(function(_0x5d1a95,_0x5326f0){zipdir(_0x50cc78,{'saveTo':_0x5d7a21},function(_0x7c9ec6,_0x17c29c){if(_0x7c9ec6)return _0x5326f0(_0x7c9ec6);return _0x5d1a95(_0x17c29c);});})[_0xdd0c('0x26')](function(){return new BPromise(function(_0x316367,_0x1ce420){rimraf(_0x50cc78,function(_0x312784){if(_0x312784)_0x1ce420(_0x312784);return _0x316367();});});})[_0xdd0c('0x26')](function(){return _0x1221b1[_0xdd0c('0x54')](_0x5d7a21,_0x27f1f2,function(_0x2b9fb9){if(_0x2b9fb9){console['log']('err',_0x2b9fb9);}else{fs['unlinkSync'](_0x5d7a21);}});});});}else{return _0x1221b1[_0xdd0c('0x1a')](0xc8);}})[_0xdd0c('0x27')](handleError(_0x1221b1,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 3322ae3..06cb33c 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 _0x583c=['../../mysqldb','SmsInteraction','setMaxListeners','save','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','hasOwnProperty','hook','events'];(function(_0x4a2c30,_0x4136f1){var _0x106c25=function(_0x36a533){while(--_0x36a533){_0x4a2c30['push'](_0x4a2c30['shift']());}};_0x106c25(++_0x4136f1);}(_0x583c,0x12b));var _0xc583=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0x583c[_0x483d8b];return _0x6500f1;};'use strict';var EventEmitter=require(_0xc583('0x0'));var SmsInteraction=require(_0xc583('0x1'))['db'][_0xc583('0x2')];var SmsMessage=require(_0xc583('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc583('0x3')](0x0);var events={'afterCreate':_0xc583('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x13b8a7){return function(_0xf03852,_0x5b7292,_0xd3a750){_0xf03852[_0xc583('0x5')]({'attributes':['id'],'raw':!![]})[_0xc583('0x6')](function(_0x1dd37c){_0xf03852['setDataValue'](_0xc583('0x7'),_0x1dd37c[_0xc583('0x8')](function(_0x5b456e){return{'id':_0x5b456e['id']};}));return SmsMessage[_0xc583('0x9')]({'where':{'SmsInteractionId':_0xf03852['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc583('0x6')](function(_0x25f8d3){_0xf03852[_0xc583('0xa')](_0xc583('0xb'),_0x25f8d3['length']);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7+':'+_0xf03852['id'],_0xf03852);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7,_0xf03852);_0xd3a750(null);})['catch'](_0xd3a750(null));};}for(var e in events){if(events[_0xc583('0xd')](e)){var event=events[e];SmsInteraction[_0xc583('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x9f0e=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','SmsInteraction','SmsMessage','update','remove','then','setDataValue','map','findAll'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0x9f0e,0x116));var _0xe9f0=function(_0x10be36,_0x9b47f7){_0x10be36=_0x10be36-0x0;var _0x458c11=_0x9f0e[_0x10be36];return _0x458c11;};'use strict';var EventEmitter=require(_0xe9f0('0x0'));var SmsInteraction=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x2')];var SmsMessage=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9f0('0x4'),'afterDestroy':_0xe9f0('0x5')};function emitEvent(_0x3c589d){return function(_0x202d69,_0x1eed45,_0x50313d){_0x202d69['getUsers']({'attributes':['id'],'raw':!![]})[_0xe9f0('0x6')](function(_0x167198){_0x202d69[_0xe9f0('0x7')]('Users',_0x167198[_0xe9f0('0x8')](function(_0x335b82){return{'id':_0x335b82['id']};}));return SmsMessage[_0xe9f0('0x9')]({'where':{'SmsInteractionId':_0x202d69['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe9f0('0x6')](function(_0xa523c0){_0x202d69[_0xe9f0('0x7')](_0xe9f0('0xa'),_0xa523c0[_0xe9f0('0xb')]);SmsInteractionEvents[_0xe9f0('0xc')](_0x3c589d+':'+_0x202d69['id'],_0x202d69);SmsInteractionEvents['emit'](_0x3c589d,_0x202d69);_0x50313d(null);})[_0xe9f0('0xd')](_0x50313d(null));};}for(var e in events){if(events[_0xe9f0('0xe')](e)){var event=events[e];SmsInteraction[_0xe9f0('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index ba5c827..2c13c65 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 _0x17e6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x3168e1,_0xa046e0){var _0x13ad69=function(_0x136b1f){while(--_0x136b1f){_0x3168e1['push'](_0x3168e1['shift']());}};_0x13ad69(++_0xa046e0);}(_0x17e6,0x166));var _0x617e=function(_0x162404,_0x3903c7){_0x162404=_0x162404-0x0;var _0x1d7869=_0x17e6[_0x162404];return _0x1d7869;};'use strict';var _=require(_0x617e('0x0'));var util=require(_0x617e('0x1'));var logger=require(_0x617e('0x2'))(_0x617e('0x3'));var moment=require(_0x617e('0x4'));var BPromise=require(_0x617e('0x5'));var rp=require(_0x617e('0x6'));var fs=require('fs');var path=require(_0x617e('0x7'));var rimraf=require(_0x617e('0x8'));var config=require(_0x617e('0x9'));var attributes=require(_0x617e('0xa'));module[_0x617e('0xb')]=function(_0x24ca21,_0x431212){return _0x24ca21[_0x617e('0xc')](_0x617e('0xd'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x440ae0,_0x5a58b8,_0x8718d1){if(_0x440ae0['changed'](_0x617e('0xe'))){_0x440ae0[_0x617e('0xf')]=moment()[_0x617e('0x10')](_0x617e('0x11'));}_0x8718d1(null,_0x440ae0);}}});}; \ No newline at end of file +var _0x4d9a=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt','format'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x4d9a,0x19f));var _0xa4d9=function(_0x5acda3,_0x22eede){_0x5acda3=_0x5acda3-0x0;var _0x53dfd5=_0x4d9a[_0x5acda3];return _0x53dfd5;};'use strict';var _=require(_0xa4d9('0x0'));var util=require(_0xa4d9('0x1'));var logger=require(_0xa4d9('0x2'))(_0xa4d9('0x3'));var moment=require('moment');var BPromise=require(_0xa4d9('0x4'));var rp=require(_0xa4d9('0x5'));var fs=require('fs');var path=require(_0xa4d9('0x6'));var rimraf=require(_0xa4d9('0x7'));var config=require(_0xa4d9('0x8'));var attributes=require(_0xa4d9('0x9'));module[_0xa4d9('0xa')]=function(_0x7f9000,_0x922105){return _0x7f9000[_0xa4d9('0xb')](_0xa4d9('0xc'),attributes,{'tableName':_0xa4d9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a71e1,_0x4a658f,_0xcf3b5c){if(_0x1a71e1[_0xa4d9('0xe')]('closed')){_0x1a71e1[_0xa4d9('0xf')]=moment()[_0xa4d9('0x10')](_0xa4d9('0x11'));}_0xcf3b5c(null,_0x1a71e1);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ded066e..c13c668 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 _0x3373=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','raw','options','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','addTags','omit','body','ids','spread','AddTags','util','moment'];(function(_0x44fe52,_0x1eb4fe){var _0x63f28f=function(_0x1c2515){while(--_0x1c2515){_0x44fe52['push'](_0x44fe52['shift']());}};_0x63f28f(++_0x1eb4fe);}(_0x3373,0x18a));var _0x3337=function(_0x52181a,_0x43495e){_0x52181a=_0x52181a-0x0;var _0x5a2e36=_0x3373[_0x52181a];return _0x5a2e36;};'use strict';var _=require('lodash');var util=require(_0x3337('0x0'));var moment=require(_0x3337('0x1'));var BPromise=require(_0x3337('0x2'));var rs=require(_0x3337('0x3'));var fs=require('fs');var Redis=require(_0x3337('0x4'));var db=require(_0x3337('0x5'))['db'];var utils=require(_0x3337('0x6'));var logger=require(_0x3337('0x7'))(_0x3337('0x8'));var config=require(_0x3337('0x9'));var jayson=require(_0x3337('0xa'));var client=jayson[_0x3337('0xb')][_0x3337('0xc')]({'port':0x232a});config[_0x3337('0xd')]=_[_0x3337('0xe')](config[_0x3337('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3337('0xd')]));require(_0x3337('0xf'))['register'](socket);function respondWithRpcPromise(_0x2f97bc,_0x1d0b95,_0x4ff367){return new BPromise(function(_0x4d6237,_0x723f40){return client['request'](_0x2f97bc,_0x4ff367)[_0x3337('0x10')](function(_0x5584dc){logger[_0x3337('0x11')](_0x3337('0x12'),_0x1d0b95,_0x3337('0x13'));logger[_0x3337('0x14')](_0x3337('0x15'),_0x1d0b95,_0x3337('0x13'),JSON[_0x3337('0x16')](_0x5584dc));if(_0x5584dc['error']){if(_0x5584dc[_0x3337('0x17')][_0x3337('0x18')]===0x1f4){logger['error'](_0x3337('0x12'),_0x1d0b95,_0x5584dc[_0x3337('0x17')][_0x3337('0x19')]);return _0x723f40(_0x5584dc[_0x3337('0x17')][_0x3337('0x19')]);}logger[_0x3337('0x17')](_0x3337('0x12'),_0x1d0b95,_0x5584dc[_0x3337('0x17')][_0x3337('0x19')]);return _0x4d6237(_0x5584dc[_0x3337('0x17')][_0x3337('0x19')]);}else{logger[_0x3337('0x11')](_0x3337('0x12'),_0x1d0b95,_0x3337('0x13'));_0x4d6237(_0x5584dc[_0x3337('0x1a')][_0x3337('0x19')]);}})[_0x3337('0x1b')](function(_0x5395f5){logger[_0x3337('0x17')](_0x3337('0x12'),_0x1d0b95,_0x5395f5);_0x723f40(_0x5395f5);});});}exports[_0x3337('0x1c')]=function(_0x3a37f1){var _0x42c927=this;return new Promise(function(_0x61a039,_0x31bc9b){return db['SmsInteraction'][_0x3337('0x1d')](_0x3a37f1['body'],{'raw':_0x3a37f1['options']?_0x3a37f1['options'][_0x3337('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a37f1['options']?_0x3a37f1[_0x3337('0x1f')][_0x3337('0x20')]||null:null,'attributes':_0x3a37f1[_0x3337('0x1f')]?_0x3a37f1['options'][_0x3337('0x21')]||null:null,'limit':_0x3a37f1[_0x3337('0x1f')]?_0x3a37f1[_0x3337('0x1f')][_0x3337('0x22')]||null:null})[_0x3337('0x10')](function(_0x2958a2){logger['info'](_0x3337('0x1c'),_0x3a37f1);logger[_0x3337('0x14')]('UpdateSmsInteraction',_0x3a37f1,JSON[_0x3337('0x16')](_0x2958a2));_0x61a039(_0x2958a2);})[_0x3337('0x1b')](function(_0x4c2f15){logger[_0x3337('0x17')](_0x3337('0x1c'),_0x4c2f15['message'],_0x3a37f1);_0x31bc9b(_0x42c927['error'](0x1f4,_0x4c2f15['message']));});});};exports[_0x3337('0x23')]=function(_0x178210){return new Promise(function(_0x343f8e,_0x1f4b6c){return db[_0x3337('0x24')][_0x3337('0x25')]({'where':_0x178210['options']?_0x178210[_0x3337('0x1f')][_0x3337('0x20')]||null:null})['then'](function(_0x453523){if(_0x453523){return _0x453523[_0x3337('0x26')](_0x178210['body']['ids'],_[_0x3337('0x27')](_0x178210[_0x3337('0x28')],[_0x3337('0x29'),'id'])||{});}})[_0x3337('0x2a')](function(_0x5ea24e){logger['info'](_0x3337('0x2b'),_0x178210);logger[_0x3337('0x14')]('AddTags',_0x178210,JSON['stringify'](_0x5ea24e));_0x343f8e(_0x5ea24e);})[_0x3337('0x1b')](function(_0x21bcf9){logger[_0x3337('0x17')]('AddTags',_0x21bcf9[_0x3337('0x19')],_0x178210);_0x1f4b6c(_this[_0x3337('0x17')](0x1f4,_0x21bcf9['message']));});});}; \ No newline at end of file +var _0x804a=['update','body','options','where','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','find','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','localhost','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x432ac2,_0x238b44){var _0x5a17cf=function(_0x4e9e1a){while(--_0x4e9e1a){_0x432ac2['push'](_0x432ac2['shift']());}};_0x5a17cf(++_0x238b44);}(_0x804a,0xaf));var _0xa804=function(_0x318c82,_0x4b37f6){_0x318c82=_0x318c82-0x0;var _0x19ee4a=_0x804a[_0x318c82];return _0x19ee4a;};'use strict';var _=require(_0xa804('0x0'));var util=require(_0xa804('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa804('0x2'));var fs=require('fs');var Redis=require(_0xa804('0x3'));var db=require(_0xa804('0x4'))['db'];var utils=require(_0xa804('0x5'));var logger=require(_0xa804('0x6'))(_0xa804('0x7'));var config=require('../../config/environment');var jayson=require(_0xa804('0x8'));var client=jayson[_0xa804('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa804('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa804('0xb'))[_0xa804('0xc')](socket);function respondWithRpcPromise(_0x25eb7f,_0x4bf4f7,_0x2a7b01){return new BPromise(function(_0x2b66e5,_0x387544){return client[_0xa804('0xd')](_0x25eb7f,_0x2a7b01)['then'](function(_0x3a75ff){logger[_0xa804('0xe')](_0xa804('0xf'),_0x4bf4f7,_0xa804('0x10'));logger[_0xa804('0x11')](_0xa804('0x12'),_0x4bf4f7,_0xa804('0x10'),JSON[_0xa804('0x13')](_0x3a75ff));if(_0x3a75ff[_0xa804('0x14')]){if(_0x3a75ff[_0xa804('0x14')][_0xa804('0x15')]===0x1f4){logger[_0xa804('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x4bf4f7,_0x3a75ff['error'][_0xa804('0x16')]);return _0x387544(_0x3a75ff[_0xa804('0x14')][_0xa804('0x16')]);}logger[_0xa804('0x14')](_0xa804('0xf'),_0x4bf4f7,_0x3a75ff[_0xa804('0x14')][_0xa804('0x16')]);return _0x2b66e5(_0x3a75ff['error']['message']);}else{logger[_0xa804('0xe')](_0xa804('0xf'),_0x4bf4f7,_0xa804('0x10'));_0x2b66e5(_0x3a75ff[_0xa804('0x17')][_0xa804('0x16')]);}})[_0xa804('0x18')](function(_0x594ec6){logger[_0xa804('0x14')](_0xa804('0xf'),_0x4bf4f7,_0x594ec6);_0x387544(_0x594ec6);});});}exports['UpdateSmsInteraction']=function(_0x4a65a2){var _0x2f15e2=this;return new Promise(function(_0x63a7e,_0x50b9ba){return db['SmsInteraction'][_0xa804('0x19')](_0x4a65a2[_0xa804('0x1a')],{'raw':_0x4a65a2[_0xa804('0x1b')]?_0x4a65a2[_0xa804('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a65a2[_0xa804('0x1b')]?_0x4a65a2[_0xa804('0x1b')][_0xa804('0x1c')]||null:null,'attributes':_0x4a65a2[_0xa804('0x1b')]?_0x4a65a2[_0xa804('0x1b')][_0xa804('0x1d')]||null:null,'limit':_0x4a65a2['options']?_0x4a65a2['options'][_0xa804('0x1e')]||null:null})[_0xa804('0x1f')](function(_0x1ceebe){logger[_0xa804('0xe')](_0xa804('0x20'),_0x4a65a2);logger[_0xa804('0x11')](_0xa804('0x20'),_0x4a65a2,JSON['stringify'](_0x1ceebe));_0x63a7e(_0x1ceebe);})['catch'](function(_0x5b7290){logger[_0xa804('0x14')](_0xa804('0x20'),_0x5b7290[_0xa804('0x16')],_0x4a65a2);_0x50b9ba(_0x2f15e2[_0xa804('0x14')](0x1f4,_0x5b7290[_0xa804('0x16')]));});});};exports[_0xa804('0x21')]=function(_0x2add96){return new Promise(function(_0x2f8518,_0x435343){return db[_0xa804('0x22')][_0xa804('0x23')]({'where':_0x2add96[_0xa804('0x1b')]?_0x2add96[_0xa804('0x1b')][_0xa804('0x1c')]||null:null})[_0xa804('0x1f')](function(_0x2e9087){if(_0x2e9087){return _0x2e9087['addTags'](_0x2add96[_0xa804('0x1a')][_0xa804('0x24')],_[_0xa804('0x25')](_0x2add96[_0xa804('0x1a')],[_0xa804('0x24'),'id'])||{});}})[_0xa804('0x26')](function(_0x391d5e){logger[_0xa804('0xe')](_0xa804('0x27'),_0x2add96);logger['debug'](_0xa804('0x27'),_0x2add96,JSON[_0xa804('0x13')](_0x391d5e));_0x2f8518(_0x391d5e);})['catch'](function(_0x16567f){logger['error'](_0xa804('0x27'),_0x16567f[_0xa804('0x16')],_0x2add96);_0x435343(_this['error'](0x1f4,_0x16567f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index ccb01d0..1e78cd7 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 _0x10e9=['save','remove','update','emit','removeListener','register','smsInteraction:','./smsInteraction.events'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x10e9,0x177));var _0x910e=function(_0x58b3d5,_0x5584f8){_0x58b3d5=_0x58b3d5-0x0;var _0x2f6de9=_0x10e9[_0x58b3d5];return _0x2f6de9;};'use strict';var SmsInteractionEvents=require(_0x910e('0x0'));var events=[_0x910e('0x1'),_0x910e('0x2'),_0x910e('0x3')];function createListener(_0x10a77f,_0x265b97){return function(_0x55d4f2){_0x265b97[_0x910e('0x4')](_0x10a77f,_0x55d4f2);};}function removeListener(_0x3c2e90,_0x379954){return function(){SmsInteractionEvents[_0x910e('0x5')](_0x3c2e90,_0x379954);};}exports[_0x910e('0x6')]=function(_0x339609){for(var _0x5225a4=0x0,_0x29651a=events['length'];_0x5225a4<_0x29651a;_0x5225a4++){var _0x37f6a2=events[_0x5225a4];var _0x3e2786=createListener(_0x910e('0x7')+_0x37f6a2,_0x339609);SmsInteractionEvents['on'](_0x37f6a2,_0x3e2786);}}; \ No newline at end of file +var _0x5aad=['./smsInteraction.events','remove','update','smsInteraction:'];(function(_0x5dc919,_0x1c3b6e){var _0x34e5a1=function(_0x363df2){while(--_0x363df2){_0x5dc919['push'](_0x5dc919['shift']());}};_0x34e5a1(++_0x1c3b6e);}(_0x5aad,0x8c));var _0xd5aa=function(_0x5905c0,_0x240ec8){_0x5905c0=_0x5905c0-0x0;var _0xcaf7ed=_0x5aad[_0x5905c0];return _0xcaf7ed;};'use strict';var SmsInteractionEvents=require(_0xd5aa('0x0'));var events=['save',_0xd5aa('0x1'),_0xd5aa('0x2')];function createListener(_0x2795c1,_0x1bb219){return function(_0x441090){_0x1bb219['emit'](_0x2795c1,_0x441090);};}function removeListener(_0x238814,_0x8aaa4f){return function(){SmsInteractionEvents['removeListener'](_0x238814,_0x8aaa4f);};}exports['register']=function(_0x1508f5){for(var _0x522a18=0x0,_0x4a8d43=events['length'];_0x522a18<_0x4a8d43;_0x522a18++){var _0x7d3772=events[_0x522a18];var _0x4b9690=createListener(_0xd5aa('0x3')+_0x7d3772,_0x1508f5);SmsInteractionEvents['on'](_0x7d3772,_0x4b9690);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 40a3a04..c7d20f8 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 _0x2136=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','reject','delete','destroy','multer','util'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x2136,0x1eb));var _0x6213=function(_0x17ec16,_0x2436e3){_0x17ec16=_0x17ec16-0x0;var _0x1f59f5=_0x2136[_0x17ec16];return _0x1f59f5;};'use strict';var multer=require(_0x6213('0x0'));var util=require(_0x6213('0x1'));var path=require(_0x6213('0x2'));var timeout=require(_0x6213('0x3'));var express=require(_0x6213('0x4'));var router=express[_0x6213('0x5')]();var fs_extra=require(_0x6213('0x6'));var auth=require(_0x6213('0x7'));var interaction=require(_0x6213('0x8'));var config=require(_0x6213('0x9'));var controller=require('./smsMessage.controller');router[_0x6213('0xa')]('/',auth[_0x6213('0xb')](),controller[_0x6213('0xc')]);router['get'](_0x6213('0xd'),auth['isAuthenticated'](),controller[_0x6213('0xe')]);router[_0x6213('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6213('0xf')]);router[_0x6213('0x10')]('/',auth[_0x6213('0xb')](),interaction[_0x6213('0x11')](_0x6213('0x12'),_0x6213('0x13')),controller[_0x6213('0x14')]);router['post'](_0x6213('0x15'),controller[_0x6213('0x16')]);router[_0x6213('0x17')]('/:id',auth[_0x6213('0xb')](),controller[_0x6213('0x18')]);router[_0x6213('0x17')](_0x6213('0x19'),auth[_0x6213('0xb')](),controller['accept']);router[_0x6213('0x17')]('/:id/reject',auth[_0x6213('0xb')](),controller[_0x6213('0x1a')]);router[_0x6213('0x1b')]('/:id',auth[_0x6213('0xb')](),controller[_0x6213('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x7f0e=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','reject','delete','exports','multer'];(function(_0x2f2b66,_0x6825bd){var _0xdd99be=function(_0x4147a6){while(--_0x4147a6){_0x2f2b66['push'](_0x2f2b66['shift']());}};_0xdd99be(++_0x6825bd);}(_0x7f0e,0xd1));var _0xe7f0=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7f0e[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xe7f0('0x0'));var util=require(_0xe7f0('0x1'));var path=require(_0xe7f0('0x2'));var timeout=require(_0xe7f0('0x3'));var express=require(_0xe7f0('0x4'));var router=express[_0xe7f0('0x5')]();var fs_extra=require(_0xe7f0('0x6'));var auth=require(_0xe7f0('0x7'));var interaction=require(_0xe7f0('0x8'));var config=require('../../config/environment');var controller=require(_0xe7f0('0x9'));router[_0xe7f0('0xa')]('/',auth[_0xe7f0('0xb')](),controller[_0xe7f0('0xc')]);router['get'](_0xe7f0('0xd'),auth[_0xe7f0('0xb')](),controller[_0xe7f0('0xe')]);router[_0xe7f0('0xa')](_0xe7f0('0xf'),auth[_0xe7f0('0xb')](),controller[_0xe7f0('0x10')]);router[_0xe7f0('0x11')]('/',auth[_0xe7f0('0xb')](),interaction[_0xe7f0('0x12')](_0xe7f0('0x13'),_0xe7f0('0x14')),controller[_0xe7f0('0x15')]);router[_0xe7f0('0x11')](_0xe7f0('0x16'),controller[_0xe7f0('0x17')]);router[_0xe7f0('0x18')](_0xe7f0('0xf'),auth[_0xe7f0('0xb')](),controller[_0xe7f0('0x19')]);router[_0xe7f0('0x18')](_0xe7f0('0x1a'),auth[_0xe7f0('0xb')](),controller['accept']);router[_0xe7f0('0x18')]('/:id/reject',auth['isAuthenticated'](),controller[_0xe7f0('0x1b')]);router[_0xe7f0('0x1c')](_0xe7f0('0xf'),auth[_0xe7f0('0xb')](),controller['destroy']);module[_0xe7f0('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 1fb8127..5eef300 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 _0xbeb0=['DATE','BOOLEAN','TEXT','sequelize','exports','ENUM','out','STRING'];(function(_0x279d70,_0x2dfb96){var _0x457e54=function(_0x321de2){while(--_0x321de2){_0x279d70['push'](_0x279d70['shift']());}};_0x457e54(++_0x2dfb96);}(_0xbeb0,0x15b));var _0x0beb=function(_0x4c5bf2,_0x2fd36f){_0x4c5bf2=_0x4c5bf2-0x0;var _0xd74663=_0xbeb0[_0x4c5bf2];return _0xd74663;};'use strict';var Sequelize=require(_0x0beb('0x0'));module[_0x0beb('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0beb('0x2')]('in',_0x0beb('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x0beb('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0beb('0x5')]},'secret':{'type':Sequelize[_0x0beb('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0beb('0x4')]},'providerResponse':{'type':Sequelize[_0x0beb('0x7')]}}; \ No newline at end of file +var _0xdd05=['exports','medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x1e440c,_0x3b2ca5){var _0x3cfab5=function(_0x905734){while(--_0x905734){_0x1e440c['push'](_0x1e440c['shift']());}};_0x3cfab5(++_0x3b2ca5);}(_0xdd05,0xfb));var _0x5dd0=function(_0x4ce315,_0x388074){_0x4ce315=_0x4ce315-0x0;var _0x1a6160=_0xdd05[_0x4ce315];return _0x1a6160;};'use strict';var Sequelize=require(_0x5dd0('0x0'));module[_0x5dd0('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5dd0('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5dd0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5dd0('0x4')),'defaultValue':_0x5dd0('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5dd0('0x5')](0xbe)},'phone':{'type':Sequelize[_0x5dd0('0x5')]},'readAt':{'type':Sequelize[_0x5dd0('0x6')]},'secret':{'type':Sequelize[_0x5dd0('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5dd0('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index aea8a37..79bfa54 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 _0x199d=['channel','motionChannel','EventManager','acceptmessage','../../config/logger','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','User','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','Status','plivio','infobip','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','name','send','index','map','SmsMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','options','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x199d,0x13d));var _0xd199=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x199d[_0x1e172a];return _0x96338b;};'use strict';var emlformat=require(_0xd199('0x0'));var rimraf=require(_0xd199('0x1'));var zipdir=require(_0xd199('0x2'));var jsonpatch=require(_0xd199('0x3'));var rp=require(_0xd199('0x4'));var moment=require('moment');var BPromise=require(_0xd199('0x5'));var Mustache=require('mustache');var util=require(_0xd199('0x6'));var path=require(_0xd199('0x7'));var sox=require(_0xd199('0x8'));var csv=require('to-csv');var ejs=require(_0xd199('0x9'));var fs=require('fs');var fs_extra=require(_0xd199('0xa'));var _=require('lodash');var squel=require(_0xd199('0xb'));var crypto=require(_0xd199('0xc'));var jsforce=require(_0xd199('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd199('0xe'));var querystring=require(_0xd199('0xf'));var Papa=require(_0xd199('0x10'));var Redis=require('ioredis');var authService=require(_0xd199('0x11'));var qs=require(_0xd199('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd199('0x13'));var logger=require('../../config/logger')(_0xd199('0x14'));var utils=require(_0xd199('0x15'));var config=require(_0xd199('0x16'));var licenseUtil=require(_0xd199('0x17'));var db=require(_0xd199('0x18'))['db'];config[_0xd199('0x19')]=_[_0xd199('0x1a')](config[_0xd199('0x19')],{'host':_0xd199('0x1b'),'port':0x18eb});var socket=require(_0xd199('0x1c'))(new Redis(config[_0xd199('0x19')]));require('./smsMessage.socket')[_0xd199('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd199('0x1e')][_0xd199('0x1f')]({'port':0x232c});var client9002=jayson[_0xd199('0x1e')][_0xd199('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5ee42f,_0x1e8132,_0xe48c1b,_0x1251a6){return new BPromise(function(_0x16a7c5,_0x4354d1){var _0x51379e=_0x1251a6||client;return _0x51379e[_0xd199('0x20')](_0x5ee42f,_0xe48c1b)['then'](function(_0xf97c6e){logger[_0xd199('0x21')](_0xd199('0x22'),_0x1e8132,_0xd199('0x23'));logger[_0xd199('0x24')](_0xd199('0x25'),_0x1e8132,_0xd199('0x23'),JSON['stringify'](_0xf97c6e));if(_0xf97c6e[_0xd199('0x26')]){if(_0xf97c6e[_0xd199('0x26')][_0xd199('0x27')]===0x1f4){logger[_0xd199('0x26')]('SmsMessage,\x20%s,\x20%s',_0x1e8132,_0xf97c6e[_0xd199('0x26')]['message']);return _0x4354d1(_0xf97c6e['error'][_0xd199('0x28')]);}logger[_0xd199('0x26')](_0xd199('0x22'),_0x1e8132,_0xf97c6e['error']['message']);return _0x16a7c5(_0xf97c6e[_0xd199('0x26')][_0xd199('0x28')]);}else{logger['info'](_0xd199('0x22'),_0x1e8132,_0xd199('0x23'));_0x16a7c5(_0xf97c6e[_0xd199('0x29')][_0xd199('0x28')]);}})[_0xd199('0x2a')](function(_0x3aa616){logger[_0xd199('0x26')](_0xd199('0x22'),_0x1e8132,_0x3aa616);_0x4354d1(_0x3aa616);});});}function respondWithStatusCode(_0x59408c,_0x5b50b2){_0x5b50b2=_0x5b50b2||0xcc;return function(_0x5a29cd){if(_0x5a29cd){return _0x59408c[_0xd199('0x2b')](_0x5b50b2);}return _0x59408c[_0xd199('0x2c')](_0x5b50b2)[_0xd199('0x2d')]();};}function respondWithResult(_0x57d6ff,_0x49bd83){_0x49bd83=_0x49bd83||0xc8;return function(_0x44c073){if(_0x44c073){return _0x57d6ff[_0xd199('0x2c')](_0x49bd83)[_0xd199('0x2e')](_0x44c073);}};}function respondWithFilteredResult(_0x263390,_0x232b5d){return function(_0x18f61d){if(_0x18f61d){var _0x3c1269=typeof _0x232b5d[_0xd199('0x2f')]===_0xd199('0x30')&&typeof _0x232b5d[_0xd199('0x31')]==='undefined';var _0x1caa61=_0x18f61d['count'];var _0x5220a3=_0x3c1269?0x0:_0x232b5d[_0xd199('0x2f')];var _0x444380=_0x3c1269?_0x18f61d[_0xd199('0x32')]:_0x232b5d[_0xd199('0x2f')]+_0x232b5d[_0xd199('0x31')];var _0x364343;if(_0x444380>=_0x1caa61){_0x444380=_0x1caa61;_0x364343=0xc8;}else{_0x364343=0xce;}_0x263390['status'](_0x364343);return _0x263390[_0xd199('0x33')](_0xd199('0x34'),_0x5220a3+'-'+_0x444380+'/'+_0x1caa61)[_0xd199('0x2e')](_0x18f61d);}return null;};}function patchUpdates(_0x21aaf3){return function(_0x50ab5b){try{jsonpatch[_0xd199('0x35')](_0x50ab5b,_0x21aaf3,!![]);}catch(_0x13aabd){return BPromise['reject'](_0x13aabd);}return _0x50ab5b['save']();};}function saveUpdates(_0x584af8,_0x38da97){return function(_0x3e8a6f){if(_0x3e8a6f){return _0x3e8a6f[_0xd199('0x36')](_0x584af8)['then'](function(_0x5db55c){return _0x5db55c;});}return null;};}function removeEntity(_0x426cb5,_0x5c9cef){return function(_0x28e3b7){if(_0x28e3b7){return _0x28e3b7[_0xd199('0x37')]()[_0xd199('0x38')](function(){_0x426cb5[_0xd199('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ea308,_0x38a98a){return function(_0x17c945){if(!_0x17c945){_0x2ea308[_0xd199('0x2b')](0x194);}return _0x17c945;};}function handleError(_0x20892f,_0x2de443){_0x2de443=_0x2de443||0x1f4;return function(_0x1662c5){logger[_0xd199('0x26')](_0x1662c5['stack']);if(_0x1662c5['name']){delete _0x1662c5[_0xd199('0x39')];}_0x20892f['status'](_0x2de443)[_0xd199('0x3a')](_0x1662c5);};}exports[_0xd199('0x3b')]=function(_0x103ddd,_0xa59d29){var _0x481b02={},_0x5a8ac3={},_0xff388c={'count':0x0,'rows':[]};var _0x19626d=_[_0xd199('0x3c')](db[_0xd199('0x3d')]['rawAttributes'],function(_0x391b69){return{'name':_0x391b69[_0xd199('0x3e')],'type':_0x391b69[_0xd199('0x3f')][_0xd199('0x40')]};});_0x5a8ac3[_0xd199('0x41')]=_[_0xd199('0x3c')](_0x19626d,_0xd199('0x39'));_0x5a8ac3[_0xd199('0x42')]=_[_0xd199('0x43')](_0x103ddd['query']);_0x5a8ac3['filters']=_[_0xd199('0x44')](_0x5a8ac3[_0xd199('0x41')],_0x5a8ac3[_0xd199('0x42')]);_0x481b02[_0xd199('0x45')]=_[_0xd199('0x44')](_0x5a8ac3[_0xd199('0x41')],qs[_0xd199('0x46')](_0x103ddd[_0xd199('0x42')][_0xd199('0x46')]));_0x481b02[_0xd199('0x45')]=_0x481b02[_0xd199('0x45')][_0xd199('0x47')]?_0x481b02[_0xd199('0x45')]:_0x5a8ac3[_0xd199('0x41')];if(!_0x103ddd[_0xd199('0x42')]['hasOwnProperty'](_0xd199('0x48'))){_0x481b02[_0xd199('0x31')]=qs[_0xd199('0x31')](_0x103ddd[_0xd199('0x42')][_0xd199('0x31')]);_0x481b02[_0xd199('0x2f')]=qs['offset'](_0x103ddd['query'][_0xd199('0x2f')]);}_0x481b02[_0xd199('0x49')]=qs[_0xd199('0x4a')](_0x103ddd[_0xd199('0x42')]['sort']);_0x481b02[_0xd199('0x4b')]=qs[_0xd199('0x4c')](_[_0xd199('0x4d')](_0x103ddd[_0xd199('0x42')],_0x5a8ac3[_0xd199('0x4c')]),_0x19626d);if(_0x103ddd[_0xd199('0x42')][_0xd199('0x4e')]){_0x481b02['where']=_[_0xd199('0x4f')](_0x481b02['where'],{'$or':_['map'](_0x19626d,function(_0x2d4747){if(_0x2d4747[_0xd199('0x3f')]!==_0xd199('0x50')){var _0x2f6c04={};_0x2f6c04[_0x2d4747[_0xd199('0x39')]]={'$like':'%'+_0x103ddd['query'][_0xd199('0x4e')]+'%'};return _0x2f6c04;}})});}_0x481b02=_[_0xd199('0x4f')]({},_0x481b02,_0x103ddd['options']);var _0x406b67={'where':_0x481b02[_0xd199('0x4b')]};return db['SmsMessage'][_0xd199('0x32')](_0x406b67)[_0xd199('0x38')](function(_0x2822cb){_0xff388c[_0xd199('0x32')]=_0x2822cb;if(_0x103ddd[_0xd199('0x42')][_0xd199('0x51')]){_0x481b02[_0xd199('0x52')]=[{'all':!![]}];}return db[_0xd199('0x3d')][_0xd199('0x53')](_0x481b02);})[_0xd199('0x38')](function(_0x510583){_0xff388c[_0xd199('0x54')]=_0x510583;return _0xff388c;})[_0xd199('0x38')](respondWithFilteredResult(_0xa59d29,_0x481b02))[_0xd199('0x2a')](handleError(_0xa59d29,null));};exports['show']=function(_0x458abf,_0x5f2b6d){var _0x342134={'raw':!![],'where':{'id':_0x458abf['params']['id']}},_0x1585aa={};_0x1585aa[_0xd199('0x41')]=_[_0xd199('0x43')](db[_0xd199('0x3d')]['rawAttributes']);_0x1585aa[_0xd199('0x42')]=_[_0xd199('0x43')](_0x458abf[_0xd199('0x42')]);_0x1585aa[_0xd199('0x4c')]=_[_0xd199('0x44')](_0x1585aa[_0xd199('0x41')],_0x1585aa[_0xd199('0x42')]);_0x342134[_0xd199('0x45')]=_[_0xd199('0x44')](_0x1585aa[_0xd199('0x41')],qs[_0xd199('0x46')](_0x458abf[_0xd199('0x42')][_0xd199('0x46')]));_0x342134[_0xd199('0x45')]=_0x342134[_0xd199('0x45')][_0xd199('0x47')]?_0x342134[_0xd199('0x45')]:_0x1585aa[_0xd199('0x41')];if(_0x458abf[_0xd199('0x42')][_0xd199('0x51')]){_0x342134[_0xd199('0x52')]=[{'all':!![]}];}_0x342134=_['merge']({},_0x342134,_0x458abf[_0xd199('0x55')]);return db[_0xd199('0x3d')][_0xd199('0x56')](_0x342134)['then'](handleEntityNotFound(_0x5f2b6d,null))[_0xd199('0x38')](respondWithResult(_0x5f2b6d,null))['catch'](handleError(_0x5f2b6d,null));};exports['create']=function(_0x3a86e5,_0x46fd3c){return db[_0xd199('0x3d')][_0xd199('0x57')](_0x3a86e5[_0xd199('0x58')],{})[_0xd199('0x38')](respondWithResult(_0x46fd3c,0xc9))[_0xd199('0x2a')](handleError(_0x46fd3c,null));};exports['update']=function(_0x3bf23a,_0xe8cb26){if(_0x3bf23a[_0xd199('0x58')]['id']){delete _0x3bf23a[_0xd199('0x58')]['id'];}return db[_0xd199('0x3d')][_0xd199('0x56')]({'where':{'id':_0x3bf23a['params']['id']}})[_0xd199('0x38')](handleEntityNotFound(_0xe8cb26,null))[_0xd199('0x38')](saveUpdates(_0x3bf23a[_0xd199('0x58')],null))[_0xd199('0x38')](respondWithResult(_0xe8cb26,null))['catch'](handleError(_0xe8cb26,null));};exports[_0xd199('0x37')]=function(_0x27cff7,_0xa0d838){return db[_0xd199('0x3d')][_0xd199('0x56')]({'where':{'id':_0x27cff7[_0xd199('0x59')]['id']}})[_0xd199('0x38')](handleEntityNotFound(_0xa0d838,null))[_0xd199('0x38')](removeEntity(_0xa0d838,null))[_0xd199('0x2a')](handleError(_0xa0d838,null));};exports[_0xd199('0x5a')]=function(_0xc73c7d,_0x368a23){return db[_0xd199('0x3d')][_0xd199('0x5a')]()['then'](respondWithResult(_0x368a23,null))[_0xd199('0x2a')](handleError(_0x368a23,null));};var interaction_log=require('../../config/logger')(_0xd199('0x5b'));exports[_0xd199('0x5c')]=function(_0x3a7905,_0x3e291e,_0x3d99a9){var _0x284396={'agent':{},'channel':_0xd199('0x5d')};if(_0x3a7905['body']['id']){delete _0x3a7905['body']['id'];}_0x3a7905[_0xd199('0x58')][_0xd199('0x5e')]=!![];_0x3a7905['body'][_0xd199('0x5f')]=moment()[_0xd199('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a7905['body'][_0xd199('0x61')]=_0x3a7905['body']['UserId']||_0x3a7905[_0xd199('0x62')]['id'];_0x284396[_0xd199('0x63')]['id']=_0x3a7905[_0xd199('0x58')][_0xd199('0x61')];return db[_0xd199('0x3d')][_0xd199('0x56')]({'where':{'id':_0x3a7905[_0xd199('0x59')]['id'],'UserId':null}})[_0xd199('0x38')](handleEntityNotFound(_0x3e291e,null))['then'](saveUpdates(_0x3a7905['body'],null))[_0xd199('0x38')](function(_0x5ee813){if(_0x5ee813){_0x284396[_0xd199('0x28')]=_0x5ee813[_0xd199('0x64')]({'plain':!![]});return db[_0xd199('0x65')][_0xd199('0x56')]({'where':{'id':_0x5ee813[_0xd199('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x3e291e,null))[_0xd199('0x38')](function(_0x10c518){if(_0x10c518){return _0x10c518[_0xd199('0x36')]({'UserId':_0x3a7905['body'][_0xd199('0x61')],'read1stAt':_[_0xd199('0x67')](_0x10c518[_0xd199('0x68')])?moment()[_0xd199('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1e01e2){if(_0x1e01e2){_0x284396[_0xd199('0x69')]=_0x1e01e2[_0xd199('0x64')]({'plain':!![]});interaction_log[_0xd199('0x21')](_0xd199('0x6a'),_0x3a7905[_0xd199('0x62')]['id'],_0x3a7905[_0xd199('0x62')][_0xd199('0x39')],_0x3a7905[_0xd199('0x62')][_0xd199('0x6b')],_0x284396[_0xd199('0x69')]['id'],_0x3a7905[_0xd199('0x58')]?JSON[_0xd199('0x6c')](_0x3a7905[_0xd199('0x58')]):'null');return respondWithRpcPromise(_0xd199('0x6d'),'acceptMessage',_0x284396);}return null;})[_0xd199('0x38')](function(_0x58c09c){var _0x594da2=_0xd199('0x6e')+_0x58c09c['message'][_0xd199('0x6f')];return db['sequelize'][_0xd199('0x42')](_0x594da2,{'type':db[_0xd199('0x70')]['QueryTypes'][_0xd199('0x71')],'raw':!![]})[_0xd199('0x38')](function(_0x2c00d5){return _0x2c00d5;});})[_0xd199('0x38')](function(_0x38412d){if(_0x38412d){_0x284396['message'][_0xd199('0x72')]=_0x38412d[0x0];if(!_0x3a7905['body']['UserId'])return;return db['User'][_0xd199('0x56')]({'where':{'id':_0x3a7905[_0xd199('0x58')][_0xd199('0x61')],'role':'agent'},'attributes':['id','name',_0xd199('0x73'),_0xd199('0x74'),_0xd199('0x75')],'raw':!![]});}return null;})[_0xd199('0x38')](function(_0x46c3ce){if(!_0x46c3ce)return null;_0x284396[_0xd199('0x28')][_0xd199('0x63')]=_0x46c3ce;return _0x284396;})[_0xd199('0x38')](function(_0x1e4a8e){if(_0x1e4a8e){if(_0x3a7905[_0xd199('0x58')][_0xd199('0x76')]){_0x284396[_0xd199('0x28')][_0xd199('0x77')]=util[_0xd199('0x60')](_0xd199('0x78'),_0x3a7905[_0xd199('0x62')][_0xd199('0x39')]);_0x284396['message'][_0xd199('0x79')]=_0x284396[_0xd199('0x79')];_0x284396[_0xd199('0x28')][_0xd199('0x7a')]=_0x284396[_0xd199('0x79')];_0x284396[_0xd199('0x28')]['event']=_0xd199('0x5c');return respondWithRpcPromise(_0xd199('0x7b'),_0xd199('0x7b'),{'event':_0xd199('0x7c'),'message':_0x284396['message']},client9002)[_0xd199('0x38')](function(){return _0x284396;});}return _0x284396;}return null;})[_0xd199('0x38')](respondWithResult(_0x3e291e,null))[_0xd199('0x2a')](handleError(_0x3e291e,null));};var interaction_log=require(_0xd199('0x7d'))('sms-interactions');exports[_0xd199('0x7e')]=function(_0x57eb3b,_0x1214dc,_0x57858f){var _0x328cfb={'agent':{},'channel':_0xd199('0x5d')};if(_0x57eb3b[_0xd199('0x58')]['id']){delete _0x57eb3b['body']['id'];}_0x57eb3b[_0xd199('0x58')][_0xd199('0x61')]=_0x57eb3b[_0xd199('0x58')][_0xd199('0x61')]||_0x57eb3b[_0xd199('0x62')]['id'];_0x328cfb[_0xd199('0x63')]['id']=_0x57eb3b['body'][_0xd199('0x61')];return db[_0xd199('0x3d')][_0xd199('0x56')]({'where':{'id':_0x57eb3b[_0xd199('0x59')]['id'],'UserId':null}})[_0xd199('0x38')](handleEntityNotFound(_0x1214dc,null))[_0xd199('0x38')](function(_0x5f3697){if(_0x5f3697){_0x328cfb['message']=_0x5f3697[_0xd199('0x64')]({'plain':!![]});return db[_0xd199('0x65')][_0xd199('0x56')]({'where':{'id':_0x5f3697['SmsInteractionId']}});}return null;})[_0xd199('0x38')](handleEntityNotFound(_0x1214dc,null))['then'](function(_0x512f00){if(_0x512f00){_0x328cfb[_0xd199('0x69')]=_0x512f00[_0xd199('0x64')]({'plain':!![]});interaction_log[_0xd199('0x21')](_0xd199('0x7f'),_0x57eb3b[_0xd199('0x62')]['id'],_0x57eb3b[_0xd199('0x62')][_0xd199('0x39')],_0x57eb3b[_0xd199('0x62')][_0xd199('0x6b')],_0x328cfb['interaction']['id'],_0x57eb3b[_0xd199('0x58')]?JSON['stringify'](_0x57eb3b[_0xd199('0x58')]):_0xd199('0x80'));return respondWithRpcPromise(_0xd199('0x81'),_0xd199('0x82'),_0x328cfb);}return null;})[_0xd199('0x38')](function(_0x5e59fd){var _0x5c983d=_0xd199('0x6e')+_0x5e59fd[_0xd199('0x28')][_0xd199('0x6f')];return db['sequelize']['query'](_0x5c983d,{'type':db['Sequelize'][_0xd199('0x83')][_0xd199('0x71')],'raw':!![]})[_0xd199('0x38')](function(_0xd23b5a){return _0xd23b5a;});})[_0xd199('0x38')](function(_0x40f2aa){if(_0x40f2aa){_0x328cfb[_0xd199('0x28')][_0xd199('0x72')]=_0x40f2aa[0x0];if(!_0x57eb3b[_0xd199('0x58')][_0xd199('0x61')])return;return db[_0xd199('0x84')][_0xd199('0x56')]({'where':{'id':_0x57eb3b['body']['UserId'],'role':_0xd199('0x63')},'attributes':['id',_0xd199('0x39'),_0xd199('0x73'),_0xd199('0x74'),_0xd199('0x75')],'raw':!![]});}return null;})[_0xd199('0x38')](function(_0x56cca6){if(!_0x56cca6)return null;_0x328cfb['message'][_0xd199('0x63')]=_0x56cca6;return _0x328cfb;})[_0xd199('0x38')](function(_0x374b4c){if(_0x374b4c){_0x374b4c['message'][_0xd199('0x77')]=util['format'](_0xd199('0x78'),_0x57eb3b['user'][_0xd199('0x39')]);_0x374b4c[_0xd199('0x28')][_0xd199('0x79')]=_0x328cfb[_0xd199('0x79')];_0x374b4c[_0xd199('0x28')][_0xd199('0x7a')]=_0x328cfb[_0xd199('0x79')];_0x374b4c[_0xd199('0x28')]['event']=_0xd199('0x7e');respondWithRpcPromise(_0xd199('0x7b'),_0xd199('0x7b'),{'event':_0xd199('0x85'),'message':_0x374b4c[_0xd199('0x28')]},client9002);return _0x328cfb;}return null;})[_0xd199('0x38')](respondWithResult(_0x1214dc,null))[_0xd199('0x2a')](handleError(_0x1214dc,null));};exports[_0xd199('0x2c')]=function(_0x3eb3a0,_0x2792b1,_0x56cc89){if(_0x3eb3a0[_0xd199('0x58')]['id']){delete _0x3eb3a0[_0xd199('0x58')]['id'];}var _0x3b6b09;return db[_0xd199('0x3d')][_0xd199('0x56')]({'where':{'id':_0x3eb3a0[_0xd199('0x59')]['id']}})[_0xd199('0x38')](handleEntityNotFound(_0x2792b1,null))[_0xd199('0x38')](function(_0x32ba4d){if(_0x32ba4d){_0x3b6b09=_0x32ba4d;return db['SmsAccount'][_0xd199('0x56')]({'where':{'id':_0x32ba4d[_0xd199('0x86')]}});}})[_0xd199('0x38')](handleEntityNotFound(_0x2792b1,null))[_0xd199('0x38')](function(_0x54a1a6){if(_0x54a1a6){logger[_0xd199('0x24')](_0xd199('0x25'),_0xd199('0x2c'),_0xd199('0x87'),_0x54a1a6[_0xd199('0x3f')],util[_0xd199('0x88')](_0x3eb3a0[_0xd199('0x58')],{'showHidden':![],'depth':null}));switch(_0x54a1a6['type']){case'twilio':if(_0x3eb3a0['body'][_0xd199('0x89')]&&_0x3eb3a0[_0xd199('0x58')]['MessageSid']===_0x3b6b09[_0xd199('0x8a')]){return _0x3b6b09['update']({'read':!![]});}else{logger[_0xd199('0x26')](_0xd199('0x8b'),_0xd199('0x2c'),'twilio',util[_0xd199('0x88')](_0x3eb3a0[_0xd199('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3eb3a0[_0xd199('0x58')][_0xd199('0x8c')]&&_0x3eb3a0[_0xd199('0x58')][_0xd199('0x8c')]===_0x3b6b09[_0xd199('0x8a')]&&_[_0xd199('0x8d')](['sent','delivered'],_0x3eb3a0[_0xd199('0x58')][_0xd199('0x8e')])>=0x0){return _0x3b6b09[_0xd199('0x36')]({'read':!![]});}else{logger[_0xd199('0x26')](_0xd199('0x8b'),_0xd199('0x2c'),_0xd199('0x8f'),util[_0xd199('0x88')](_0x3eb3a0[_0xd199('0x58')],{'showHidden':![],'depth':null}));}break;case _0xd199('0x90'):var _0x5a9e62=_0x3eb3a0[_0xd199('0x58')]['results'][0x0];if(_0x5a9e62[_0xd199('0x2c')]['groupName']===_0xd199('0x91')){return _0x3b6b09['update']({'read':!![]});}else{logger[_0xd199('0x26')](_0xd199('0x8b'),'status','infobip',util['inspect'](_0x3eb3a0[_0xd199('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3b6b09;}})[_0xd199('0x38')](respondWithResult(_0x2792b1,null))[_0xd199('0x2a')](handleError(_0x2792b1,null));}; \ No newline at end of file +var _0x0d78=['interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','SmsInteraction','SmsInteractionId','null','RejectMessage','rejectMessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','delivered','Status','plivio','groupName','DELIVERED','infobip','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','./smsMessage.socket','register','jayson/promise','client','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','info','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','end','sendStatus','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','show','params','intersection','includeAll','find','create','body','update','destroy','describe','../../config/logger','sms-interactions','accept','UserId','agent','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x0d78,0x134));var _0x80d7=function(_0x5962b4,_0x84be73){_0x5962b4=_0x5962b4-0x0;var _0xe6443c=_0x0d78[_0x5962b4];return _0xe6443c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x80d7('0x0'));var rp=require('request-promise');var moment=require(_0x80d7('0x1'));var BPromise=require(_0x80d7('0x2'));var Mustache=require(_0x80d7('0x3'));var util=require(_0x80d7('0x4'));var path=require('path');var sox=require(_0x80d7('0x5'));var csv=require('to-csv');var ejs=require(_0x80d7('0x6'));var fs=require('fs');var fs_extra=require(_0x80d7('0x7'));var _=require(_0x80d7('0x8'));var squel=require(_0x80d7('0x9'));var crypto=require(_0x80d7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x80d7('0xb'));var querystring=require(_0x80d7('0xc'));var Papa=require(_0x80d7('0xd'));var Redis=require(_0x80d7('0xe'));var authService=require(_0x80d7('0xf'));var qs=require(_0x80d7('0x10'));var as=require(_0x80d7('0x11'));var hardwareService=require(_0x80d7('0x12'));var logger=require('../../config/logger')(_0x80d7('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x80d7('0x14'))['db'];config[_0x80d7('0x15')]=_[_0x80d7('0x16')](config[_0x80d7('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x80d7('0x17'))[_0x80d7('0x18')](socket);var jayson=require(_0x80d7('0x19'));var client=jayson[_0x80d7('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x80d7('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d27e5,_0x5bfdd5,_0xc7ba3f,_0x37bc0c){return new BPromise(function(_0xdbe61c,_0x4ab691){var _0x5051ad=_0x37bc0c||client;return _0x5051ad[_0x80d7('0x1b')](_0x3d27e5,_0xc7ba3f)[_0x80d7('0x1c')](function(_0x46c695){logger['info']('SmsMessage,\x20%s,\x20%s',_0x5bfdd5,_0x80d7('0x1d'));logger[_0x80d7('0x1e')](_0x80d7('0x1f'),_0x5bfdd5,_0x80d7('0x1d'),JSON[_0x80d7('0x20')](_0x46c695));if(_0x46c695['error']){if(_0x46c695[_0x80d7('0x21')][_0x80d7('0x22')]===0x1f4){logger[_0x80d7('0x21')]('SmsMessage,\x20%s,\x20%s',_0x5bfdd5,_0x46c695[_0x80d7('0x21')][_0x80d7('0x23')]);return _0x4ab691(_0x46c695['error'][_0x80d7('0x23')]);}logger[_0x80d7('0x21')](_0x80d7('0x24'),_0x5bfdd5,_0x46c695[_0x80d7('0x21')][_0x80d7('0x23')]);return _0xdbe61c(_0x46c695['error'][_0x80d7('0x23')]);}else{logger[_0x80d7('0x25')](_0x80d7('0x24'),_0x5bfdd5,_0x80d7('0x1d'));_0xdbe61c(_0x46c695[_0x80d7('0x26')][_0x80d7('0x23')]);}})[_0x80d7('0x27')](function(_0x54416d){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5bfdd5,_0x54416d);_0x4ab691(_0x54416d);});});}function respondWithStatusCode(_0x12a69b,_0x1a17f7){_0x1a17f7=_0x1a17f7||0xcc;return function(_0x3d632a){if(_0x3d632a){return _0x12a69b['sendStatus'](_0x1a17f7);}return _0x12a69b[_0x80d7('0x28')](_0x1a17f7)['end']();};}function respondWithResult(_0x370876,_0x1d6489){_0x1d6489=_0x1d6489||0xc8;return function(_0x75155a){if(_0x75155a){return _0x370876[_0x80d7('0x28')](_0x1d6489)['json'](_0x75155a);}};}function respondWithFilteredResult(_0x178ee0,_0x347ecd){return function(_0x3aed24){if(_0x3aed24){var _0x1782bb=typeof _0x347ecd[_0x80d7('0x29')]===_0x80d7('0x2a')&&typeof _0x347ecd[_0x80d7('0x2b')]===_0x80d7('0x2a');var _0x430692=_0x3aed24[_0x80d7('0x2c')];var _0x2e513c=_0x1782bb?0x0:_0x347ecd[_0x80d7('0x29')];var _0x257d00=_0x1782bb?_0x3aed24[_0x80d7('0x2c')]:_0x347ecd[_0x80d7('0x29')]+_0x347ecd['limit'];var _0xd47106;if(_0x257d00>=_0x430692){_0x257d00=_0x430692;_0xd47106=0xc8;}else{_0xd47106=0xce;}_0x178ee0['status'](_0xd47106);return _0x178ee0[_0x80d7('0x2d')](_0x80d7('0x2e'),_0x2e513c+'-'+_0x257d00+'/'+_0x430692)[_0x80d7('0x2f')](_0x3aed24);}return null;};}function patchUpdates(_0x517ffb){return function(_0x460f30){try{jsonpatch[_0x80d7('0x30')](_0x460f30,_0x517ffb,!![]);}catch(_0x461895){return BPromise[_0x80d7('0x31')](_0x461895);}return _0x460f30['save']();};}function saveUpdates(_0x1439ab,_0x42ee9e){return function(_0x24e548){if(_0x24e548){return _0x24e548['update'](_0x1439ab)[_0x80d7('0x1c')](function(_0x5643ae){return _0x5643ae;});}return null;};}function removeEntity(_0x2e1060,_0x2ef379){return function(_0x1ed1c1){if(_0x1ed1c1){return _0x1ed1c1['destroy']()[_0x80d7('0x1c')](function(){_0x2e1060[_0x80d7('0x28')](0xcc)[_0x80d7('0x32')]();});}};}function handleEntityNotFound(_0x5c97d6,_0x476c67){return function(_0x4458ee){if(!_0x4458ee){_0x5c97d6[_0x80d7('0x33')](0x194);}return _0x4458ee;};}function handleError(_0xe6d493,_0x166dd8){_0x166dd8=_0x166dd8||0x1f4;return function(_0x20013d){logger[_0x80d7('0x21')](_0x20013d['stack']);if(_0x20013d['name']){delete _0x20013d[_0x80d7('0x34')];}_0xe6d493[_0x80d7('0x28')](_0x166dd8)[_0x80d7('0x35')](_0x20013d);};}exports[_0x80d7('0x36')]=function(_0x239173,_0x148474){var _0x4214e4={},_0x51e041={},_0x169039={'count':0x0,'rows':[]};var _0x14d45c=_[_0x80d7('0x37')](db[_0x80d7('0x38')][_0x80d7('0x39')],function(_0x436af6){return{'name':_0x436af6[_0x80d7('0x3a')],'type':_0x436af6[_0x80d7('0x3b')][_0x80d7('0x3c')]};});_0x51e041[_0x80d7('0x3d')]=_[_0x80d7('0x37')](_0x14d45c,_0x80d7('0x34'));_0x51e041[_0x80d7('0x3e')]=_[_0x80d7('0x3f')](_0x239173['query']);_0x51e041['filters']=_['intersection'](_0x51e041[_0x80d7('0x3d')],_0x51e041[_0x80d7('0x3e')]);_0x4214e4[_0x80d7('0x40')]=_['intersection'](_0x51e041[_0x80d7('0x3d')],qs['fields'](_0x239173[_0x80d7('0x3e')][_0x80d7('0x41')]));_0x4214e4[_0x80d7('0x40')]=_0x4214e4[_0x80d7('0x40')][_0x80d7('0x42')]?_0x4214e4[_0x80d7('0x40')]:_0x51e041[_0x80d7('0x3d')];if(!_0x239173[_0x80d7('0x3e')][_0x80d7('0x43')](_0x80d7('0x44'))){_0x4214e4[_0x80d7('0x2b')]=qs[_0x80d7('0x2b')](_0x239173['query']['limit']);_0x4214e4[_0x80d7('0x29')]=qs[_0x80d7('0x29')](_0x239173[_0x80d7('0x3e')][_0x80d7('0x29')]);}_0x4214e4[_0x80d7('0x45')]=qs[_0x80d7('0x46')](_0x239173[_0x80d7('0x3e')][_0x80d7('0x46')]);_0x4214e4[_0x80d7('0x47')]=qs[_0x80d7('0x48')](_['pick'](_0x239173['query'],_0x51e041[_0x80d7('0x48')]),_0x14d45c);if(_0x239173[_0x80d7('0x3e')][_0x80d7('0x49')]){_0x4214e4[_0x80d7('0x47')]=_[_0x80d7('0x4a')](_0x4214e4[_0x80d7('0x47')],{'$or':_[_0x80d7('0x37')](_0x14d45c,function(_0x3f54d9){if(_0x3f54d9[_0x80d7('0x3b')]!==_0x80d7('0x4b')){var _0x518ff8={};_0x518ff8[_0x3f54d9[_0x80d7('0x34')]]={'$like':'%'+_0x239173['query']['filter']+'%'};return _0x518ff8;}})});}_0x4214e4=_[_0x80d7('0x4a')]({},_0x4214e4,_0x239173[_0x80d7('0x4c')]);var _0x71350f={'where':_0x4214e4[_0x80d7('0x47')]};return db[_0x80d7('0x38')][_0x80d7('0x2c')](_0x71350f)[_0x80d7('0x1c')](function(_0x1ffaf1){_0x169039[_0x80d7('0x2c')]=_0x1ffaf1;if(_0x239173[_0x80d7('0x3e')]['includeAll']){_0x4214e4[_0x80d7('0x4d')]=[{'all':!![]}];}return db[_0x80d7('0x38')]['findAll'](_0x4214e4);})['then'](function(_0x333c1f){_0x169039[_0x80d7('0x4e')]=_0x333c1f;return _0x169039;})[_0x80d7('0x1c')](respondWithFilteredResult(_0x148474,_0x4214e4))[_0x80d7('0x27')](handleError(_0x148474,null));};exports[_0x80d7('0x4f')]=function(_0x41173f,_0x57fa70){var _0x17d1d9={'raw':!![],'where':{'id':_0x41173f[_0x80d7('0x50')]['id']}},_0x2a074e={};_0x2a074e[_0x80d7('0x3d')]=_[_0x80d7('0x3f')](db[_0x80d7('0x38')][_0x80d7('0x39')]);_0x2a074e[_0x80d7('0x3e')]=_['keys'](_0x41173f[_0x80d7('0x3e')]);_0x2a074e[_0x80d7('0x48')]=_[_0x80d7('0x51')](_0x2a074e[_0x80d7('0x3d')],_0x2a074e[_0x80d7('0x3e')]);_0x17d1d9[_0x80d7('0x40')]=_[_0x80d7('0x51')](_0x2a074e[_0x80d7('0x3d')],qs[_0x80d7('0x41')](_0x41173f[_0x80d7('0x3e')][_0x80d7('0x41')]));_0x17d1d9[_0x80d7('0x40')]=_0x17d1d9[_0x80d7('0x40')][_0x80d7('0x42')]?_0x17d1d9[_0x80d7('0x40')]:_0x2a074e[_0x80d7('0x3d')];if(_0x41173f[_0x80d7('0x3e')][_0x80d7('0x52')]){_0x17d1d9[_0x80d7('0x4d')]=[{'all':!![]}];}_0x17d1d9=_[_0x80d7('0x4a')]({},_0x17d1d9,_0x41173f['options']);return db[_0x80d7('0x38')][_0x80d7('0x53')](_0x17d1d9)['then'](handleEntityNotFound(_0x57fa70,null))[_0x80d7('0x1c')](respondWithResult(_0x57fa70,null))[_0x80d7('0x27')](handleError(_0x57fa70,null));};exports[_0x80d7('0x54')]=function(_0x357397,_0x11f00d){return db[_0x80d7('0x38')]['create'](_0x357397[_0x80d7('0x55')],{})[_0x80d7('0x1c')](respondWithResult(_0x11f00d,0xc9))[_0x80d7('0x27')](handleError(_0x11f00d,null));};exports[_0x80d7('0x56')]=function(_0x1a82c4,_0x477b54){if(_0x1a82c4[_0x80d7('0x55')]['id']){delete _0x1a82c4[_0x80d7('0x55')]['id'];}return db[_0x80d7('0x38')][_0x80d7('0x53')]({'where':{'id':_0x1a82c4[_0x80d7('0x50')]['id']}})['then'](handleEntityNotFound(_0x477b54,null))[_0x80d7('0x1c')](saveUpdates(_0x1a82c4[_0x80d7('0x55')],null))[_0x80d7('0x1c')](respondWithResult(_0x477b54,null))[_0x80d7('0x27')](handleError(_0x477b54,null));};exports[_0x80d7('0x57')]=function(_0x95c0b9,_0x12e178){return db['SmsMessage'][_0x80d7('0x53')]({'where':{'id':_0x95c0b9[_0x80d7('0x50')]['id']}})[_0x80d7('0x1c')](handleEntityNotFound(_0x12e178,null))[_0x80d7('0x1c')](removeEntity(_0x12e178,null))[_0x80d7('0x27')](handleError(_0x12e178,null));};exports[_0x80d7('0x58')]=function(_0x232b59,_0xff0698){return db[_0x80d7('0x38')][_0x80d7('0x58')]()['then'](respondWithResult(_0xff0698,null))['catch'](handleError(_0xff0698,null));};var interaction_log=require(_0x80d7('0x59'))(_0x80d7('0x5a'));exports[_0x80d7('0x5b')]=function(_0x59599c,_0x110b7c,_0x21b37a){var _0x54634b={'agent':{},'channel':'sms'};if(_0x59599c[_0x80d7('0x55')]['id']){delete _0x59599c[_0x80d7('0x55')]['id'];}_0x59599c[_0x80d7('0x55')]['read']=!![];_0x59599c[_0x80d7('0x55')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')]=_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')]||_0x59599c['user']['id'];_0x54634b[_0x80d7('0x5d')]['id']=_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')];return db['SmsMessage']['find']({'where':{'id':_0x59599c[_0x80d7('0x50')]['id'],'UserId':null}})[_0x80d7('0x1c')](handleEntityNotFound(_0x110b7c,null))[_0x80d7('0x1c')](saveUpdates(_0x59599c['body'],null))[_0x80d7('0x1c')](function(_0x2c439d){if(_0x2c439d){_0x54634b[_0x80d7('0x23')]=_0x2c439d['get']({'plain':!![]});return db['SmsInteraction'][_0x80d7('0x53')]({'where':{'id':_0x2c439d['SmsInteractionId']}});}return null;})[_0x80d7('0x1c')](handleEntityNotFound(_0x110b7c,null))[_0x80d7('0x1c')](function(_0x50e346){if(_0x50e346){return _0x50e346[_0x80d7('0x56')]({'UserId':_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')],'read1stAt':_[_0x80d7('0x5e')](_0x50e346[_0x80d7('0x5f')])?moment()[_0x80d7('0x60')](_0x80d7('0x61')):undefined});}return null;})[_0x80d7('0x1c')](function(_0x9e69bf){if(_0x9e69bf){_0x54634b[_0x80d7('0x62')]=_0x9e69bf[_0x80d7('0x63')]({'plain':!![]});interaction_log[_0x80d7('0x25')](_0x80d7('0x64'),_0x59599c['user']['id'],_0x59599c[_0x80d7('0x65')][_0x80d7('0x34')],_0x59599c[_0x80d7('0x65')][_0x80d7('0x66')],_0x54634b['interaction']['id'],_0x59599c[_0x80d7('0x55')]?JSON[_0x80d7('0x20')](_0x59599c['body']):'null');return respondWithRpcPromise(_0x80d7('0x67'),_0x80d7('0x68'),_0x54634b);}return null;})[_0x80d7('0x1c')](function(_0x55a19c){var _0x53d584=_0x80d7('0x69')+_0x55a19c[_0x80d7('0x23')][_0x80d7('0x6a')];return db[_0x80d7('0x6b')][_0x80d7('0x3e')](_0x53d584,{'type':db['Sequelize'][_0x80d7('0x6c')][_0x80d7('0x6d')],'raw':!![]})[_0x80d7('0x1c')](function(_0x541344){return _0x541344;});})['then'](function(_0x2109bd){if(_0x2109bd){_0x54634b[_0x80d7('0x23')][_0x80d7('0x6e')]=_0x2109bd[0x0];if(!_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')])return;return db[_0x80d7('0x6f')][_0x80d7('0x53')]({'where':{'id':_0x59599c[_0x80d7('0x55')]['UserId'],'role':_0x80d7('0x5d')},'attributes':['id',_0x80d7('0x34'),_0x80d7('0x70'),_0x80d7('0x71'),'internal'],'raw':!![]});}return null;})[_0x80d7('0x1c')](function(_0xe3aea1){if(!_0xe3aea1)return null;_0x54634b['message']['agent']=_0xe3aea1;return _0x54634b;})['then'](function(_0x5f29d6){if(_0x5f29d6){if(_0x59599c['body'][_0x80d7('0x72')]){_0x54634b[_0x80d7('0x23')][_0x80d7('0x73')]=util[_0x80d7('0x60')](_0x80d7('0x74'),_0x59599c[_0x80d7('0x65')][_0x80d7('0x34')]);_0x54634b[_0x80d7('0x23')]['channel']=_0x54634b[_0x80d7('0x75')];_0x54634b['message'][_0x80d7('0x76')]=_0x54634b['channel'];_0x54634b[_0x80d7('0x23')][_0x80d7('0x77')]=_0x80d7('0x5b');return respondWithRpcPromise(_0x80d7('0x78'),_0x80d7('0x78'),{'event':_0x80d7('0x79'),'message':_0x54634b[_0x80d7('0x23')]},client9002)['then'](function(){return _0x54634b;});}return _0x54634b;}return null;})[_0x80d7('0x1c')](respondWithResult(_0x110b7c,null))[_0x80d7('0x27')](handleError(_0x110b7c,null));};var interaction_log=require(_0x80d7('0x59'))(_0x80d7('0x5a'));exports[_0x80d7('0x31')]=function(_0x46921f,_0x5ae980,_0x5f6a6a){var _0x3f30b7={'agent':{},'channel':_0x80d7('0x7a')};if(_0x46921f[_0x80d7('0x55')]['id']){delete _0x46921f[_0x80d7('0x55')]['id'];}_0x46921f[_0x80d7('0x55')]['UserId']=_0x46921f['body'][_0x80d7('0x5c')]||_0x46921f['user']['id'];_0x3f30b7[_0x80d7('0x5d')]['id']=_0x46921f['body'][_0x80d7('0x5c')];return db['SmsMessage'][_0x80d7('0x53')]({'where':{'id':_0x46921f[_0x80d7('0x50')]['id'],'UserId':null}})[_0x80d7('0x1c')](handleEntityNotFound(_0x5ae980,null))[_0x80d7('0x1c')](function(_0x43ca41){if(_0x43ca41){_0x3f30b7[_0x80d7('0x23')]=_0x43ca41[_0x80d7('0x63')]({'plain':!![]});return db[_0x80d7('0x7b')][_0x80d7('0x53')]({'where':{'id':_0x43ca41[_0x80d7('0x7c')]}});}return null;})[_0x80d7('0x1c')](handleEntityNotFound(_0x5ae980,null))[_0x80d7('0x1c')](function(_0x22b21e){if(_0x22b21e){_0x3f30b7[_0x80d7('0x62')]=_0x22b21e['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46921f[_0x80d7('0x65')]['id'],_0x46921f[_0x80d7('0x65')][_0x80d7('0x34')],_0x46921f[_0x80d7('0x65')][_0x80d7('0x66')],_0x3f30b7['interaction']['id'],_0x46921f[_0x80d7('0x55')]?JSON[_0x80d7('0x20')](_0x46921f[_0x80d7('0x55')]):_0x80d7('0x7d'));return respondWithRpcPromise(_0x80d7('0x7e'),_0x80d7('0x7f'),_0x3f30b7);}return null;})[_0x80d7('0x1c')](function(_0x5bdc44){var _0x1f721e=_0x80d7('0x69')+_0x5bdc44[_0x80d7('0x23')][_0x80d7('0x6a')];return db['sequelize'][_0x80d7('0x3e')](_0x1f721e,{'type':db['Sequelize']['QueryTypes'][_0x80d7('0x6d')],'raw':!![]})['then'](function(_0xe8e837){return _0xe8e837;});})['then'](function(_0x5de17b){if(_0x5de17b){_0x3f30b7[_0x80d7('0x23')]['contact']=_0x5de17b[0x0];if(!_0x46921f[_0x80d7('0x55')][_0x80d7('0x5c')])return;return db['User'][_0x80d7('0x53')]({'where':{'id':_0x46921f[_0x80d7('0x55')]['UserId'],'role':_0x80d7('0x5d')},'attributes':['id',_0x80d7('0x34'),_0x80d7('0x70'),_0x80d7('0x71'),'internal'],'raw':!![]});}return null;})[_0x80d7('0x1c')](function(_0x1e9fee){if(!_0x1e9fee)return null;_0x3f30b7[_0x80d7('0x23')][_0x80d7('0x5d')]=_0x1e9fee;return _0x3f30b7;})[_0x80d7('0x1c')](function(_0x507dc4){if(_0x507dc4){_0x507dc4['message'][_0x80d7('0x73')]=util['format'](_0x80d7('0x74'),_0x46921f[_0x80d7('0x65')]['name']);_0x507dc4[_0x80d7('0x23')][_0x80d7('0x75')]=_0x3f30b7[_0x80d7('0x75')];_0x507dc4[_0x80d7('0x23')]['motionChannel']=_0x3f30b7[_0x80d7('0x75')];_0x507dc4[_0x80d7('0x23')]['event']='reject';respondWithRpcPromise(_0x80d7('0x78'),_0x80d7('0x78'),{'event':'rejectmessage','message':_0x507dc4[_0x80d7('0x23')]},client9002);return _0x3f30b7;}return null;})[_0x80d7('0x1c')](respondWithResult(_0x5ae980,null))[_0x80d7('0x27')](handleError(_0x5ae980,null));};exports[_0x80d7('0x28')]=function(_0x5d56a4,_0x3782c1,_0x5e1385){if(_0x5d56a4[_0x80d7('0x55')]['id']){delete _0x5d56a4[_0x80d7('0x55')]['id'];}var _0x45bbed;return db['SmsMessage'][_0x80d7('0x53')]({'where':{'id':_0x5d56a4[_0x80d7('0x50')]['id']}})[_0x80d7('0x1c')](handleEntityNotFound(_0x3782c1,null))[_0x80d7('0x1c')](function(_0x22c547){if(_0x22c547){_0x45bbed=_0x22c547;return db['SmsAccount'][_0x80d7('0x53')]({'where':{'id':_0x22c547[_0x80d7('0x80')]}});}})[_0x80d7('0x1c')](handleEntityNotFound(_0x3782c1,null))[_0x80d7('0x1c')](function(_0x4cb4ca){if(_0x4cb4ca){logger[_0x80d7('0x1e')](_0x80d7('0x1f'),_0x80d7('0x28'),_0x80d7('0x81'),_0x4cb4ca['type'],util[_0x80d7('0x82')](_0x5d56a4['body'],{'showHidden':![],'depth':null}));switch(_0x4cb4ca['type']){case'twilio':if(_0x5d56a4[_0x80d7('0x55')][_0x80d7('0x83')]&&_0x5d56a4[_0x80d7('0x55')][_0x80d7('0x83')]===_0x45bbed[_0x80d7('0x84')]){return _0x45bbed['update']({'read':!![]});}else{logger[_0x80d7('0x21')](_0x80d7('0x85'),'status',_0x80d7('0x86'),util[_0x80d7('0x82')](_0x5d56a4[_0x80d7('0x55')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5d56a4[_0x80d7('0x55')]['MessageUUID']&&_0x5d56a4[_0x80d7('0x55')]['MessageUUID']===_0x45bbed[_0x80d7('0x84')]&&_['indexOf'](['sent',_0x80d7('0x87')],_0x5d56a4[_0x80d7('0x55')][_0x80d7('0x88')])>=0x0){return _0x45bbed[_0x80d7('0x56')]({'read':!![]});}else{logger['error'](_0x80d7('0x85'),_0x80d7('0x28'),_0x80d7('0x89'),util[_0x80d7('0x82')](_0x5d56a4[_0x80d7('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x56d01a=_0x5d56a4[_0x80d7('0x55')]['results'][0x0];if(_0x56d01a[_0x80d7('0x28')][_0x80d7('0x8a')]===_0x80d7('0x8b')){return _0x45bbed[_0x80d7('0x56')]({'read':!![]});}else{logger[_0x80d7('0x21')](_0x80d7('0x85'),_0x80d7('0x28'),_0x80d7('0x8c'),util[_0x80d7('0x82')](_0x5d56a4[_0x80d7('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x45bbed;}})['then'](respondWithResult(_0x3782c1,null))[_0x80d7('0x27')](handleError(_0x3782c1,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index cfe27c0..19427b2 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 _0x7605=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x7605,0x13f));var _0x5760=function(_0x3d949c,_0x411a05){_0x3d949c=_0x3d949c-0x0;var _0x1d5c67=_0x7605[_0x3d949c];return _0x1d5c67;};'use strict';var EventEmitter=require(_0x5760('0x0'));var SmsMessage=require(_0x5760('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5760('0x2')](0x0);var events={'afterCreate':_0x5760('0x3'),'afterUpdate':'update','afterDestroy':_0x5760('0x4')};function emitEvent(_0x3bccac){return function(_0x212060,_0x428061,_0x5a1db7){SmsMessageEvents[_0x5760('0x5')](_0x3bccac+':'+_0x212060['id'],_0x212060);SmsMessageEvents[_0x5760('0x5')](_0x3bccac,_0x212060);_0x5a1db7(null);};}for(var e in events){if(events[_0x5760('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x5760('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x3888=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x35fc6a,_0xd05315){var _0x4a2f4b=function(_0x4a86a7){while(--_0x4a86a7){_0x35fc6a['push'](_0x35fc6a['shift']());}};_0x4a2f4b(++_0xd05315);}(_0x3888,0x11c));var _0x8388=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0x3888[_0xd58823];return _0x249c0a;};'use strict';var EventEmitter=require(_0x8388('0x0'));var SmsMessage=require(_0x8388('0x1'))['db'][_0x8388('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8388('0x3')](0x0);var events={'afterCreate':_0x8388('0x4'),'afterUpdate':_0x8388('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58c76e){return function(_0x24b14a,_0x1ddf44,_0x254461){SmsMessageEvents['emit'](_0x58c76e+':'+_0x24b14a['id'],_0x24b14a);SmsMessageEvents[_0x8388('0x6')](_0x58c76e,_0x24b14a);_0x254461(null);};}for(var e in events){if(events[_0x8388('0x7')](e)){var event=events[e];SmsMessage[_0x8388('0x8')](e,emitEvent(event));}}module[_0x8388('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 0764b2e..c3f7433 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 _0x1fda=['token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','session_key','total_sent','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','username','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','data','queued_count','head','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','crypto','apiKey','text','keys','length','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','accountId','/messages','applicationId','bandwidth','code','message','refid','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token='];(function(_0x288ef7,_0x4aee60){var _0x2c6598=function(_0xacae37){while(--_0xacae37){_0x288ef7['push'](_0x288ef7['shift']());}};_0x2c6598(++_0x4aee60);}(_0x1fda,0xc0));var _0xa1fd=function(_0x7a9d49,_0x437b3d){_0x7a9d49=_0x7a9d49-0x0;var _0x10a6e0=_0x1fda[_0x7a9d49];return _0x10a6e0;};'use strict';var _=require('lodash');var util=require(_0xa1fd('0x0'));var logger=require('../../config/logger')(_0xa1fd('0x1'));var moment=require(_0xa1fd('0x2'));var BPromise=require(_0xa1fd('0x3'));var rp=require(_0xa1fd('0x4'));var fs=require('fs');var path=require(_0xa1fd('0x5'));var rimraf=require('rimraf');var config=require(_0xa1fd('0x6'));var attributes=require(_0xa1fd('0x7'));module['exports']=function(_0x920c3,_0x14f22f){return _0x920c3[_0xa1fd('0x8')](_0xa1fd('0x9'),attributes,{'tableName':_0xa1fd('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa1fd('0xb')]},{'name':_0xa1fd('0xc'),'fields':[_0xa1fd('0xd')],'type':_0xa1fd('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22de6b,_0x1eaf90,_0xd1028e){var _0x53bd20=_0x920c3[_0xa1fd('0xf')];var _0x524674=_0x22de6b[_0xa1fd('0x10')]({'plain':!![]});if(_0x524674[_0xa1fd('0x11')]['toLowerCase']()==='in'||_0x524674[_0xa1fd('0x11')][_0xa1fd('0x12')]()===_0xa1fd('0x13')&&!_0x524674[_0xa1fd('0x14')]&&!_[_0xa1fd('0x15')](_0x524674[_0xa1fd('0x16')])&&!_[_0xa1fd('0x15')](_0x524674[_0xa1fd('0x17')])){_0x53bd20['SmsInteraction'][_0xa1fd('0x18')]({'where':{'id':_0x524674[_0xa1fd('0x17')]}})[_0xa1fd('0x19')](function(_0x1366a9){if(_0x1366a9){_0x1366a9[_0xa1fd('0x1a')]({'lastMsgAt':_0x524674[_0xa1fd('0x1b')],'lastMsgDirection':_0x524674['direction'][_0xa1fd('0x12')]()});}})[_0xa1fd('0x1c')](function(_0x411397){console[_0xa1fd('0x1d')](_0x411397);});}if(_0x524674[_0xa1fd('0x11')]===_0xa1fd('0x13')&&!_0x524674[_0xa1fd('0x14')]){var _0x565b8f;_0x53bd20[_0xa1fd('0x1e')]['find']({'where':{'id':_0x524674[_0xa1fd('0x1f')]},'raw':!![]})['then'](function(_0x13b334){_0x565b8f=_0x13b334;if(_0x565b8f&&_0x565b8f['type']){switch(_0x565b8f[_0xa1fd('0x20')]){case _0xa1fd('0x21'):var _0x272d14=require(_0xa1fd('0x21'));if(_0x565b8f[_0xa1fd('0x22')]&&_0x565b8f[_0xa1fd('0x23')]&&_0x565b8f[_0xa1fd('0x24')]){var _0x57dd0=new _0x272d14(_0x565b8f['accountSid'],_0x565b8f['authToken']);_0x57dd0[_0xa1fd('0x25')][_0xa1fd('0x26')]({'body':_0x524674[_0xa1fd('0xd')],'to':_0x524674['phone'],'from':_0x565b8f[_0xa1fd('0x24')],'statusCallback':_0x565b8f[_0xa1fd('0x27')]+_0xa1fd('0x28')+_0x524674['id']+_0xa1fd('0x29')+_0x565b8f[_0xa1fd('0x2a')]})[_0xa1fd('0x19')](function(_0x4591a4){if(_0x4591a4[_0xa1fd('0x2b')]){return _0x22de6b[_0xa1fd('0x1a')]({'messageId':_0x4591a4[_0xa1fd('0x2b')]});}})[_0xa1fd('0x1c')](function(_0x410ff2){logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x21'),util['inspect'](_0x410ff2,{'showHidden':![],'depth':null}));});}else{logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),'afterCreate',_0xa1fd('0x21'),_0xa1fd('0x2e'));}break;case _0xa1fd('0x2f'):var _0x30c152=_0xa1fd('0x30');if(_0x565b8f['username']&&_0x565b8f[_0xa1fd('0x31')]){var _0x5e47db={'recipient':[_0x524674['phone']],'message':_0x524674[_0xa1fd('0xd')],'message_type':_0x565b8f['smsMethod']};if(_0x565b8f[_0xa1fd('0x32')]&&_0x565b8f[_0xa1fd('0x32')]!=='SI'){_0x5e47db[_0xa1fd('0x33')]=_0x565b8f[_0xa1fd('0x24')];}var _0x5add0f={'url':_0x30c152+_0xa1fd('0x34')+_0x565b8f['username']+_0xa1fd('0x35')+_0x565b8f[_0xa1fd('0x31')],'method':_0xa1fd('0x36')};rp(_0x5add0f)[_0xa1fd('0x19')](function(_0x2609d5){var _0x4f07c9=_0x2609d5['split'](';');var _0x32fd23={'user_key':_0x4f07c9[0x0],'session_key':_0x4f07c9[0x1]};_0x5add0f={'url':_0x30c152+_0xa1fd('0x37'),'method':_0xa1fd('0x38'),'headers':{'user_key':_0x32fd23[_0xa1fd('0x39')],'Session_key':_0x32fd23[_0xa1fd('0x3a')]},'json':!![],'body':_0x5e47db};return rp(_0x5add0f);})['then'](function(_0x193310){if(_0x193310[_0xa1fd('0x3b')]>=0x1){var _0x2ea230={'messageId':_0x193310['internal_order_id']};if(_0x565b8f['smsMethod']!=='GP'||!_0x565b8f['deliveryReport']){_0x2ea230[_0xa1fd('0x3c')]=!![];}return _0x22de6b[_0xa1fd('0x1a')](_0x2ea230);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa1fd('0x2d'),_0xa1fd('0x2f'),util[_0xa1fd('0x3d')](_0x193310,{'showHidden':![],'depth':null}));}})[_0xa1fd('0x1c')](function(_0x22b9dd){return logger[_0xa1fd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa1fd('0x2d'),'skebby',util[_0xa1fd('0x3d')](_0x22b9dd,{'showHidden':![],'depth':null}));});}else{logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),'afterCreate',_0xa1fd('0x2f'),_0xa1fd('0x3e'));}break;case _0xa1fd('0x3f'):if(_0x565b8f['authToken']){var _0x558e1a={'recipient':_0x524674['phone'],'message':_0x524674['body'],'sender':_0x565b8f[_0xa1fd('0x40')]||_0x565b8f['phone'],'authorization':_0x565b8f[_0xa1fd('0x23')]};var _0x1eaf90={'method':_0xa1fd('0x38'),'uri':_0xa1fd('0x41'),'body':_0x558e1a,'json':!![]};rp(_0x1eaf90)['then'](function(_0x279055){var _0x2063b3={'messageId':_0x279055[_0xa1fd('0x42')]};if(!_0x565b8f[_0xa1fd('0x43')]){_0x2063b3[_0xa1fd('0x3c')]=!![];}return _0x22de6b[_0xa1fd('0x1a')](_0x2063b3);})[_0xa1fd('0x1c')](function(_0x29d7b1){logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x3f'),util[_0xa1fd('0x3d')](_0x29d7b1,{'showHidden':![],'depth':null}));});}else{logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),'connectel',_0xa1fd('0x44'));}break;case'clicksend':if(_0x565b8f[_0xa1fd('0x45')]&&_0x565b8f[_0xa1fd('0x31')]){var _0x558e1a={'messages':[{'source':_0xa1fd('0x46'),'to':_0x524674[_0xa1fd('0x24')],'body':_0x524674[_0xa1fd('0xd')],'from':_0x565b8f[_0xa1fd('0x40')]||_0x565b8f['phone']}]};var _0x4b64e9=util['format']('%s:%s',_0x565b8f[_0xa1fd('0x45')],_0x565b8f[_0xa1fd('0x31')]);var _0x1eaf90={'method':_0xa1fd('0x38'),'uri':_0xa1fd('0x47'),'body':_0x558e1a,'headers':{'Authorization':util[_0xa1fd('0x48')](_0xa1fd('0x49'),new Buffer(_0x4b64e9)[_0xa1fd('0x4a')]('base64'))},'json':!![]};rp(_0x1eaf90)[_0xa1fd('0x19')](function(_0x105821){if(_0x105821['http_code']>=0xc8&&_0x105821['http_code']<=0xce){if(_0x105821[_0xa1fd('0x4b')]&&_0x105821[_0xa1fd('0x4b')][_0xa1fd('0x4c')]>0x0){var _0x5a0205=_[_0xa1fd('0x4d')](_0x105821[_0xa1fd('0x4b')][_0xa1fd('0x25')]);var _0x521cb7={'messageId':_0x5a0205['message_id']};if(!_0x565b8f[_0xa1fd('0x43')]){_0x521cb7[_0xa1fd('0x3c')]=!![];}return _0x22de6b[_0xa1fd('0x1a')](_0x521cb7);}else{logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),'afterCreate',_0xa1fd('0x4e'),util[_0xa1fd('0x3d')](_0x105821,{'showHidden':![],'depth':null}));}}else{logger[_0xa1fd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa1fd('0x4e'),util[_0xa1fd('0x3d')](_0x105821,{'showHidden':![],'depth':null}));}})['catch'](function(_0x348451){logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x4e'),util[_0xa1fd('0x3d')](_0x348451,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa1fd('0x2c'),'afterCreate',_0xa1fd('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa1fd('0x4f'):if(_0x565b8f[_0xa1fd('0x50')]&&_0x565b8f[_0xa1fd('0x23')]){var _0x558e1a={'dst':_0x524674[_0xa1fd('0x24')],'text':_0x524674['body'],'src':_0x565b8f[_0xa1fd('0x40')]||_0x565b8f['phone'],'url':_0x565b8f[_0xa1fd('0x27')]+'/api/sms/messages/'+_0x524674['id']+'/status?token='+_0x565b8f[_0xa1fd('0x2a')]};var _0x4b64e9=util[_0xa1fd('0x48')](_0xa1fd('0x51'),_0x565b8f[_0xa1fd('0x50')],_0x565b8f[_0xa1fd('0x23')]);var _0x1eaf90={'method':_0xa1fd('0x38'),'uri':util['format'](_0xa1fd('0x52'),_0x565b8f['authId']),'body':_0x558e1a,'headers':{'Authorization':util[_0xa1fd('0x48')](_0xa1fd('0x49'),new Buffer(_0x4b64e9)[_0xa1fd('0x4a')](_0xa1fd('0x53')))},'json':!![]};rp(_0x1eaf90)[_0xa1fd('0x19')](function(_0x4e5566){var _0x3494da={'messageId':_0x4e5566[_0xa1fd('0x54')][0x0]};return _0x22de6b['update'](_0x3494da);})[_0xa1fd('0x1c')](function(_0x467832){logger[_0xa1fd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa1fd('0x4f'),util['inspect'](_0x467832,{'showHidden':![],'depth':null}));});}else{logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),'plivo',_0xa1fd('0x55'));}break;case'infobip':if(_0x565b8f[_0xa1fd('0x45')]&&_0x565b8f['password']){if(_0x565b8f[_0xa1fd('0x56')]){var _0x26f08d={'method':'POST','uri':_0x565b8f['baseUrl']+_0xa1fd('0x57'),'body':{'username':_0x565b8f['username'],'password':_0x565b8f[_0xa1fd('0x31')]},'json':!![]};return rp(_0x26f08d)['then'](function(_0x54277b){var _0x529bfa={'method':_0xa1fd('0x38'),'uri':_0x565b8f['baseUrl']+_0xa1fd('0x58'),'body':{'messages':[{'from':_0x565b8f[_0xa1fd('0x24')],'destinations':[{'to':_0x524674['phone']}],'text':_0x524674[_0xa1fd('0xd')],'notifyUrl':_0x565b8f[_0xa1fd('0x27')]+_0xa1fd('0x28')+_0x524674['id']+_0xa1fd('0x29')+_0x565b8f['token'],'notifyContentType':_0xa1fd('0x59'),'callbackData':_0x565b8f['phone']+';'+_0x524674['body']}]},'headers':{'Authorization':_0xa1fd('0x5a')+_0x54277b['token']},'json':!![]};return rp(_0x529bfa)[_0xa1fd('0x19')](function(_0xef630b){if(_0xef630b[_0xa1fd('0x25')]){var _0x2285cd={'messageId':_0xef630b[_0xa1fd('0x25')][0x0][_0xa1fd('0xb')]};if(!_0x565b8f[_0xa1fd('0x43')]){_0x2285cd[_0xa1fd('0x3c')]=!![];}return _0x22de6b[_0xa1fd('0x1a')](_0x2285cd);}else{return logger['error'](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x5b'),util[_0xa1fd('0x3d')](_0xef630b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x341f7d){return logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x5b'),util[_0xa1fd('0x3d')](_0x341f7d,{'showHidden':![],'depth':null}));});}else{logger[_0xa1fd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa1fd('0x2d'),_0xa1fd('0x5b'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x5b'),_0xa1fd('0x3e'));}break;case'csc':var _0x471001=require(_0xa1fd('0x5c'));if(_0x565b8f[_0xa1fd('0x5d')]){var _0x3b6778={};_0x3b6778['login']=_0x565b8f[_0xa1fd('0x45')];_0x3b6778[_0xa1fd('0x24')]=_0x524674[_0xa1fd('0x24')];_0x3b6778['sender']=_0x565b8f[_0xa1fd('0x24')];_0x3b6778[_0xa1fd('0x5e')]=_0x524674['body'];_0x3b6778['timestamp']=+new Date();var _0x2b5bc3='';var _0x94a4a3='';var _0x2a0015=Object[_0xa1fd('0x5f')](_0x3b6778);_0x2a0015['sort']();for(var _0x158c1f=0x0;_0x158c1f<_0x2a0015[_0xa1fd('0x60')];_0x158c1f++){if(_0x2b5bc3!=''){_0x2b5bc3+='&';}_0x2b5bc3+=_0x2a0015[_0x158c1f]+'='+encodeURIComponent(_0x3b6778[_0x2a0015[_0x158c1f]]);_0x94a4a3+=_0x3b6778[_0x2a0015[_0x158c1f]];}_0x94a4a3+=_0x565b8f[_0xa1fd('0x5d')];_0x94a4a3=_0x471001[_0xa1fd('0x61')](_0xa1fd('0x62'))[_0xa1fd('0x1a')](_0x94a4a3)['digest'](_0xa1fd('0x63'));if(_0x2b5bc3!==''){_0x2b5bc3+='&';}_0x2b5bc3+=_0xa1fd('0x64')+_0x94a4a3;var _0x5add0f={'method':_0xa1fd('0x36'),'uri':_0x565b8f['baseUrl']+_0xa1fd('0x65')+_0x2b5bc3,'json':!![]};return rp(_0x5add0f)[_0xa1fd('0x19')](function(_0x54b220){var _0x4840fd=Object[_0xa1fd('0x5f')](_0x54b220);if(_0x54b220[_0x4840fd[0x0]][_0xa1fd('0x1d')]&&parseInt(_0x54b220[_0x4840fd[0x0]]['error'])===0x0){var _0x46bb42={'messageId':_0x54b220[_0x4840fd[0x0]][_0xa1fd('0x66')]};if(!_0x565b8f['deliveryReport']){_0x46bb42['read']=!![];}return _0x22de6b[_0xa1fd('0x1a')](_0x46bb42);}else{return logger['error'](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x67'),util[_0xa1fd('0x3d')](_0x54b220['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2dff92){return logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x67'),util['inspect'](_0x2dff92,{'showHidden':![],'depth':null}));});}else{logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),'afterCreate',_0xa1fd('0x67'),_0xa1fd('0x68'));}break;case _0xa1fd('0x69'):if(_0x565b8f['apiKey']){var _0x21970e={'method':_0xa1fd('0x38'),'uri':_0xa1fd('0x6a'),'headers':{'Authorization':_0x565b8f[_0xa1fd('0x5d')]},'body':{'content':_0x524674[_0xa1fd('0xd')],'to':[_0x524674[_0xa1fd('0x24')]],'from':_0x565b8f[_0xa1fd('0x24')],'binary':![],'clientMessageId':'uuid','charset':_0xa1fd('0x6b')},'json':!![]};rp(_0x21970e)['then'](function(_0x2acb8a){if(!_0x2acb8a[_0xa1fd('0x1d')]){var _0x4a6295={'messageId':_0x2acb8a['messages'][0x0][_0xa1fd('0x6c')]};if(!_0x565b8f[_0xa1fd('0x43')]){_0x4a6295[_0xa1fd('0x3c')]=!![];}return _0x22de6b[_0xa1fd('0x1a')](_0x4a6295);}else{return logger[_0xa1fd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa1fd('0x2d'),'clickatell',util[_0xa1fd('0x3d')](_0x2acb8a[_0xa1fd('0x1d')],{'showHidden':![],'depth':null}));}})[_0xa1fd('0x1c')](function(_0x8a4f08){return logger['error'](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x69'),util[_0xa1fd('0x3d')](_0x8a4f08,{'showHidden':![],'depth':null}));});}else{logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x69'),_0xa1fd('0x68'));}break;case'bandwidth':if(_0x565b8f[_0xa1fd('0x45')]&&_0x565b8f[_0xa1fd('0x31')]){var _0x4b64e9=util['format']('%s:%s',_0x565b8f[_0xa1fd('0x45')],_0x565b8f[_0xa1fd('0x31')]);var _0x1eaf90={'method':_0xa1fd('0x38'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x565b8f[_0xa1fd('0x6d')]+_0xa1fd('0x6e'),'body':{'to':[_0x524674[_0xa1fd('0x24')]],'text':_0x524674['body'],'from':_0x565b8f[_0xa1fd('0x24')],'applicationId':_0x565b8f[_0xa1fd('0x6f')]},'headers':{'Authorization':util[_0xa1fd('0x48')](_0xa1fd('0x49'),new Buffer(_0x4b64e9)['toString'](_0xa1fd('0x53')))},'json':!![]};rp(_0x1eaf90)[_0xa1fd('0x19')](function(_0x722880){if(_0x722880['id']){var _0x2e7573={'messageId':_0x722880['id']};return _0x22de6b['update'](_0x2e7573);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa1fd('0x70'),util[_0xa1fd('0x3d')](_0x722880,{'showHidden':![],'depth':null}));}})[_0xa1fd('0x1c')](function(_0x313872){logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x70'),util[_0xa1fd('0x3d')](_0x313872,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa1fd('0x2c'),_0xa1fd('0x2d'),_0xa1fd('0x70'),_0xa1fd('0x3e'));}break;case'intelepeer':if(_0x565b8f['apiKey']){var _0x29429c={};var _0x5add0f={'method':_0xa1fd('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x565b8f[_0xa1fd('0x5d')],'Content-Type':_0xa1fd('0x59')},'body':{'from':_0x565b8f[_0xa1fd('0x24')],'to':_0x524674[_0xa1fd('0x24')],'text':_0x524674[_0xa1fd('0xd')]},'json':!![]};return rp(_0x5add0f)[_0xa1fd('0x19')](function(_0x503b4e){if(_0x503b4e[_0xa1fd('0x71')]==0xca){_0x29429c[_0xa1fd('0x72')]=_0x503b4e;var _0x30c1d1={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x565b8f[_0xa1fd('0x5d')],'Content-Type':_0xa1fd('0x59')},'body':{'refid':_0x29429c[_0xa1fd('0x72')][_0xa1fd('0x73')]},'json':!![]};return rp(_0x30c1d1)[_0xa1fd('0x19')](function(_0x1e143c){_0x29429c['status']=_0x1e143c;var _0x146124={'messageId':_0x29429c['message'][_0xa1fd('0x73')],'read':!![]};return _0x22de6b[_0xa1fd('0x1a')](_0x146124);});}else{return logger['error'](_0xa1fd('0x2c'),_0xa1fd('0x2d'),'intelepeer',util[_0xa1fd('0x3d')](_0x503b4e,{'showHidden':![],'depth':null}));}})[_0xa1fd('0x1c')](function(_0x49a70e){return logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),_0xa1fd('0x2d'),'intelepeer',util[_0xa1fd('0x3d')](_0x49a70e,{'showHidden':![],'depth':null}));});}else{return logger[_0xa1fd('0x1d')](_0xa1fd('0x2c'),'afterCreate','intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0xd1028e();});}else{_0xd1028e();}}},'charset':'utf8mb4','collate':_0xa1fd('0x74')});}; \ No newline at end of file +var _0x095a=['password','smsMethod','sender','login?username=','username','GET','split','sms','total_sent','internal_order_id','deliveryReport','skebby','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','head','message_id','read','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','bandwidth','accountId','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','phone','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/'];(function(_0x40beba,_0xbb8fef){var _0x54e971=function(_0x3a0d63){while(--_0x3a0d63){_0x40beba['push'](_0x40beba['shift']());}};_0x54e971(++_0xbb8fef);}(_0x095a,0xc6));var _0xa095=function(_0x35b77e,_0x25d76a){_0x35b77e=_0x35b77e-0x0;var _0xb5b2b2=_0x095a[_0x35b77e];return _0xb5b2b2;};'use strict';var _=require('lodash');var util=require(_0xa095('0x0'));var logger=require('../../config/logger')(_0xa095('0x1'));var moment=require(_0xa095('0x2'));var BPromise=require(_0xa095('0x3'));var rp=require(_0xa095('0x4'));var fs=require('fs');var path=require(_0xa095('0x5'));var rimraf=require(_0xa095('0x6'));var config=require('../../config/environment');var attributes=require(_0xa095('0x7'));module[_0xa095('0x8')]=function(_0x3f70b0,_0x4312ea){return _0x3f70b0[_0xa095('0x9')](_0xa095('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xa095('0xb'),'fields':[_0xa095('0xb')]},{'name':'fti_sms_messages','fields':[_0xa095('0xc')],'type':_0xa095('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d7fab,_0x16e9f1,_0x19a491){var _0x122320=_0x3f70b0[_0xa095('0xe')];var _0x5d9249=_0x3d7fab[_0xa095('0xf')]({'plain':!![]});if(_0x5d9249[_0xa095('0x10')][_0xa095('0x11')]()==='in'||_0x5d9249[_0xa095('0x10')]['toLowerCase']()===_0xa095('0x12')&&!_0x5d9249[_0xa095('0x13')]&&!_[_0xa095('0x14')](_0x5d9249[_0xa095('0x15')])&&!_['isNil'](_0x5d9249[_0xa095('0x16')])){_0x122320[_0xa095('0x17')][_0xa095('0x18')]({'where':{'id':_0x5d9249[_0xa095('0x16')]}})[_0xa095('0x19')](function(_0x4fa331){if(_0x4fa331){_0x4fa331[_0xa095('0x1a')]({'lastMsgAt':_0x5d9249['createdAt'],'lastMsgDirection':_0x5d9249[_0xa095('0x10')][_0xa095('0x11')]()});}})[_0xa095('0x1b')](function(_0x2f5536){console[_0xa095('0x1c')](_0x2f5536);});}if(_0x5d9249['direction']==='out'&&!_0x5d9249[_0xa095('0x13')]){var _0x3e99fa;_0x122320[_0xa095('0x1d')][_0xa095('0x1e')]({'where':{'id':_0x5d9249[_0xa095('0x1f')]},'raw':!![]})[_0xa095('0x19')](function(_0x18220a){_0x3e99fa=_0x18220a;if(_0x3e99fa&&_0x3e99fa[_0xa095('0x20')]){switch(_0x3e99fa['type']){case _0xa095('0x21'):var _0x312b2d=require(_0xa095('0x21'));if(_0x3e99fa[_0xa095('0x22')]&&_0x3e99fa[_0xa095('0x23')]&&_0x3e99fa['phone']){var _0x1f5c66=new _0x312b2d(_0x3e99fa['accountSid'],_0x3e99fa['authToken']);_0x1f5c66[_0xa095('0x24')]['create']({'body':_0x5d9249[_0xa095('0xc')],'to':_0x5d9249[_0xa095('0x25')],'from':_0x3e99fa[_0xa095('0x25')],'statusCallback':_0x3e99fa[_0xa095('0x26')]+'/api/sms/messages/'+_0x5d9249['id']+_0xa095('0x27')+_0x3e99fa['token']})[_0xa095('0x19')](function(_0x54c4dc){if(_0x54c4dc[_0xa095('0x28')]){return _0x3d7fab['update']({'messageId':_0x54c4dc[_0xa095('0x28')]});}})[_0xa095('0x1b')](function(_0x26a14b){logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),'twilio',util['inspect'](_0x26a14b,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate',_0xa095('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x161ada=_0xa095('0x2b');if(_0x3e99fa['username']&&_0x3e99fa[_0xa095('0x2c')]){var _0x508b21={'recipient':[_0x5d9249[_0xa095('0x25')]],'message':_0x5d9249[_0xa095('0xc')],'message_type':_0x3e99fa[_0xa095('0x2d')]};if(_0x3e99fa[_0xa095('0x2d')]&&_0x3e99fa[_0xa095('0x2d')]!=='SI'){_0x508b21[_0xa095('0x2e')]=_0x3e99fa[_0xa095('0x25')];}var _0x3c7557={'url':_0x161ada+_0xa095('0x2f')+_0x3e99fa[_0xa095('0x30')]+'&password='+_0x3e99fa[_0xa095('0x2c')],'method':_0xa095('0x31')};rp(_0x3c7557)['then'](function(_0x506914){var _0x493d0a=_0x506914[_0xa095('0x32')](';');var _0x56e10f={'user_key':_0x493d0a[0x0],'session_key':_0x493d0a[0x1]};_0x3c7557={'url':_0x161ada+_0xa095('0x33'),'method':'POST','headers':{'user_key':_0x56e10f['user_key'],'Session_key':_0x56e10f['session_key']},'json':!![],'body':_0x508b21};return rp(_0x3c7557);})[_0xa095('0x19')](function(_0x573191){if(_0x573191[_0xa095('0x34')]>=0x1){var _0x2eee74={'messageId':_0x573191[_0xa095('0x35')]};if(_0x3e99fa[_0xa095('0x2d')]!=='GP'||!_0x3e99fa[_0xa095('0x36')]){_0x2eee74['read']=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x2eee74);}else{return logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate',_0xa095('0x37'),util['inspect'](_0x573191,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2da8c0){return logger['error'](_0xa095('0x29'),'afterCreate',_0xa095('0x37'),util[_0xa095('0x38')](_0x2da8c0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xa095('0x39'):if(_0x3e99fa[_0xa095('0x23')]){var _0x529e2a={'recipient':_0x5d9249[_0xa095('0x25')],'message':_0x5d9249[_0xa095('0xc')],'sender':_0x3e99fa[_0xa095('0x3a')]||_0x3e99fa['phone'],'authorization':_0x3e99fa['authToken']};var _0x16e9f1={'method':'POST','uri':_0xa095('0x3b'),'body':_0x529e2a,'json':!![]};rp(_0x16e9f1)[_0xa095('0x19')](function(_0x489ce3){var _0x434acc={'messageId':_0x489ce3[_0xa095('0x3c')]};if(!_0x3e99fa[_0xa095('0x36')]){_0x434acc['read']=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x434acc);})[_0xa095('0x1b')](function(_0x5afb73){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),'connectel',util['inspect'](_0x5afb73,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x39'),_0xa095('0x3d'));}break;case _0xa095('0x3e'):if(_0x3e99fa[_0xa095('0x30')]&&_0x3e99fa[_0xa095('0x2c')]){var _0x529e2a={'messages':[{'source':_0xa095('0x3f'),'to':_0x5d9249[_0xa095('0x25')],'body':_0x5d9249[_0xa095('0xc')],'from':_0x3e99fa[_0xa095('0x3a')]||_0x3e99fa[_0xa095('0x25')]}]};var _0x577bab=util[_0xa095('0x40')](_0xa095('0x41'),_0x3e99fa['username'],_0x3e99fa[_0xa095('0x2c')]);var _0x16e9f1={'method':_0xa095('0x42'),'uri':_0xa095('0x43'),'body':_0x529e2a,'headers':{'Authorization':util[_0xa095('0x40')](_0xa095('0x44'),new Buffer(_0x577bab)[_0xa095('0x45')]('base64'))},'json':!![]};rp(_0x16e9f1)['then'](function(_0x5ea149){if(_0x5ea149[_0xa095('0x46')]>=0xc8&&_0x5ea149['http_code']<=0xce){if(_0x5ea149[_0xa095('0x47')]&&_0x5ea149['data']['queued_count']>0x0){var _0x53462d=_[_0xa095('0x48')](_0x5ea149[_0xa095('0x47')][_0xa095('0x24')]);var _0x264846={'messageId':_0x53462d[_0xa095('0x49')]};if(!_0x3e99fa[_0xa095('0x36')]){_0x264846[_0xa095('0x4a')]=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x264846);}else{logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate','clickSend',util[_0xa095('0x38')](_0x5ea149,{'showHidden':![],'depth':null}));}}else{logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x4b'),util[_0xa095('0x38')](_0x5ea149,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3b372d){logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x4b'),util[_0xa095('0x38')](_0x3b372d,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x4b'),_0xa095('0x4c'));}break;case _0xa095('0x4d'):if(_0x3e99fa[_0xa095('0x4e')]&&_0x3e99fa[_0xa095('0x23')]){var _0x529e2a={'dst':_0x5d9249[_0xa095('0x25')],'text':_0x5d9249['body'],'src':_0x3e99fa[_0xa095('0x3a')]||_0x3e99fa[_0xa095('0x25')],'url':_0x3e99fa['remote']+_0xa095('0x4f')+_0x5d9249['id']+'/status?token='+_0x3e99fa[_0xa095('0x50')]};var _0x577bab=util[_0xa095('0x40')](_0xa095('0x41'),_0x3e99fa[_0xa095('0x4e')],_0x3e99fa[_0xa095('0x23')]);var _0x16e9f1={'method':_0xa095('0x42'),'uri':util[_0xa095('0x40')](_0xa095('0x51'),_0x3e99fa['authId']),'body':_0x529e2a,'headers':{'Authorization':util[_0xa095('0x40')](_0xa095('0x44'),new Buffer(_0x577bab)[_0xa095('0x45')]('base64'))},'json':!![]};rp(_0x16e9f1)['then'](function(_0x2d46f6){var _0x48fc6c={'messageId':_0x2d46f6[_0xa095('0x52')][0x0]};return _0x3d7fab['update'](_0x48fc6c);})[_0xa095('0x1b')](function(_0x2670aa){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x4d'),util['inspect'](_0x2670aa,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x4d'),_0xa095('0x53'));}break;case _0xa095('0x54'):if(_0x3e99fa[_0xa095('0x30')]&&_0x3e99fa[_0xa095('0x2c')]){if(_0x3e99fa[_0xa095('0x55')]){var _0x3b85d0={'method':'POST','uri':_0x3e99fa[_0xa095('0x55')]+'/auth/1/session','body':{'username':_0x3e99fa[_0xa095('0x30')],'password':_0x3e99fa[_0xa095('0x2c')]},'json':!![]};return rp(_0x3b85d0)['then'](function(_0xb7bcf8){var _0x584ba6={'method':_0xa095('0x42'),'uri':_0x3e99fa[_0xa095('0x55')]+_0xa095('0x56'),'body':{'messages':[{'from':_0x3e99fa[_0xa095('0x25')],'destinations':[{'to':_0x5d9249[_0xa095('0x25')]}],'text':_0x5d9249[_0xa095('0xc')],'notifyUrl':_0x3e99fa[_0xa095('0x26')]+_0xa095('0x4f')+_0x5d9249['id']+_0xa095('0x27')+_0x3e99fa[_0xa095('0x50')],'notifyContentType':_0xa095('0x57'),'callbackData':_0x3e99fa[_0xa095('0x25')]+';'+_0x5d9249[_0xa095('0xc')]}]},'headers':{'Authorization':_0xa095('0x58')+_0xb7bcf8[_0xa095('0x50')]},'json':!![]};return rp(_0x584ba6)[_0xa095('0x19')](function(_0x397454){if(_0x397454[_0xa095('0x24')]){var _0x2c8814={'messageId':_0x397454[_0xa095('0x24')][0x0][_0xa095('0xb')]};if(!_0x3e99fa[_0xa095('0x36')]){_0x2c8814['read']=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x2c8814);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa095('0x54'),util[_0xa095('0x38')](_0x397454,{'showHidden':![],'depth':null}));}});})[_0xa095('0x1b')](function(_0x305a0e){return logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x54'),util['inspect'](_0x305a0e,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x54'),_0xa095('0x59'));}}else{logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa095('0x5a'):var _0x9a1941=require(_0xa095('0x5b'));if(_0x3e99fa['apiKey']){var _0xeebe0b={};_0xeebe0b[_0xa095('0x5c')]=_0x3e99fa[_0xa095('0x30')];_0xeebe0b[_0xa095('0x25')]=_0x5d9249[_0xa095('0x25')];_0xeebe0b[_0xa095('0x2e')]=_0x3e99fa['phone'];_0xeebe0b[_0xa095('0x5d')]=_0x5d9249[_0xa095('0xc')];_0xeebe0b[_0xa095('0x5e')]=+new Date();var _0x2d392c='';var _0x5de608='';var _0x2c6a4e=Object[_0xa095('0x5f')](_0xeebe0b);_0x2c6a4e[_0xa095('0x60')]();for(var _0xe6d9af=0x0;_0xe6d9af<_0x2c6a4e[_0xa095('0x61')];_0xe6d9af++){if(_0x2d392c!=''){_0x2d392c+='&';}_0x2d392c+=_0x2c6a4e[_0xe6d9af]+'='+encodeURIComponent(_0xeebe0b[_0x2c6a4e[_0xe6d9af]]);_0x5de608+=_0xeebe0b[_0x2c6a4e[_0xe6d9af]];}_0x5de608+=_0x3e99fa[_0xa095('0x62')];_0x5de608=_0x9a1941['createHash'](_0xa095('0x63'))[_0xa095('0x1a')](_0x5de608)[_0xa095('0x64')](_0xa095('0x65'));if(_0x2d392c!==''){_0x2d392c+='&';}_0x2d392c+=_0xa095('0x66')+_0x5de608;var _0x3c7557={'method':'GET','uri':_0x3e99fa[_0xa095('0x55')]+'/external/get/send.php?'+_0x2d392c,'json':!![]};return rp(_0x3c7557)[_0xa095('0x19')](function(_0x43c5fb){var _0x48f863=Object[_0xa095('0x5f')](_0x43c5fb);if(_0x43c5fb[_0x48f863[0x0]][_0xa095('0x1c')]&&parseInt(_0x43c5fb[_0x48f863[0x0]]['error'])===0x0){var _0x51c7c5={'messageId':_0x43c5fb[_0x48f863[0x0]][_0xa095('0x67')]};if(!_0x3e99fa['deliveryReport']){_0x51c7c5[_0xa095('0x4a')]=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x51c7c5);}else{return logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa095('0x5a'),util[_0xa095('0x38')](_0x43c5fb['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1d225f){return logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate',_0xa095('0x5a'),util[_0xa095('0x38')](_0x1d225f,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x5a'),_0xa095('0x68'));}break;case _0xa095('0x69'):if(_0x3e99fa[_0xa095('0x62')]){var _0x47bc42={'method':_0xa095('0x42'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3e99fa[_0xa095('0x62')]},'body':{'content':_0x5d9249[_0xa095('0xc')],'to':[_0x5d9249[_0xa095('0x25')]],'from':_0x3e99fa['phone'],'binary':![],'clientMessageId':_0xa095('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x47bc42)[_0xa095('0x19')](function(_0x35fb48){if(!_0x35fb48[_0xa095('0x1c')]){var _0x3eefc7={'messageId':_0x35fb48['messages'][0x0]['apiMessageId']};if(!_0x3e99fa[_0xa095('0x36')]){_0x3eefc7[_0xa095('0x4a')]=!![];}return _0x3d7fab['update'](_0x3eefc7);}else{return logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate',_0xa095('0x69'),util[_0xa095('0x38')](_0x35fb48[_0xa095('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4343f8){return logger['error'](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x69'),util['inspect'](_0x4343f8,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate','clickatell',_0xa095('0x68'));}break;case _0xa095('0x6b'):if(_0x3e99fa[_0xa095('0x30')]&&_0x3e99fa[_0xa095('0x2c')]){var _0x577bab=util['format'](_0xa095('0x41'),_0x3e99fa[_0xa095('0x30')],_0x3e99fa[_0xa095('0x2c')]);var _0x16e9f1={'method':_0xa095('0x42'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3e99fa[_0xa095('0x6c')]+'/messages','body':{'to':[_0x5d9249[_0xa095('0x25')]],'text':_0x5d9249[_0xa095('0xc')],'from':_0x3e99fa['phone'],'applicationId':_0x3e99fa['applicationId']},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x577bab)['toString'](_0xa095('0x6d')))},'json':!![]};rp(_0x16e9f1)[_0xa095('0x19')](function(_0x29860c){if(_0x29860c['id']){var _0x4d897b={'messageId':_0x29860c['id']};return _0x3d7fab[_0xa095('0x1a')](_0x4d897b);}else{logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x6b'),util[_0xa095('0x38')](_0x29860c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x521ab7){logger['error'](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x6b'),util['inspect'](_0x521ab7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa095('0x29'),_0xa095('0x2a'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xa095('0x6e'):if(_0x3e99fa[_0xa095('0x62')]){var _0x4f3694={};var _0x3c7557={'method':'POST','uri':_0xa095('0x6f'),'headers':{'Authorization':_0xa095('0x70')+_0x3e99fa[_0xa095('0x62')],'Content-Type':'application/json'},'body':{'from':_0x3e99fa[_0xa095('0x25')],'to':_0x5d9249['phone'],'text':_0x5d9249[_0xa095('0xc')]},'json':!![]};return rp(_0x3c7557)[_0xa095('0x19')](function(_0x43d7df){if(_0x43d7df[_0xa095('0x71')]==0xca){_0x4f3694[_0xa095('0x72')]=_0x43d7df;var _0x206bd9={'method':_0xa095('0x42'),'uri':_0xa095('0x73'),'headers':{'Authorization':_0xa095('0x70')+_0x3e99fa[_0xa095('0x62')],'Content-Type':'application/json'},'body':{'refid':_0x4f3694[_0xa095('0x72')]['refid']},'json':!![]};return rp(_0x206bd9)[_0xa095('0x19')](function(_0x4a0fbf){_0x4f3694[_0xa095('0x74')]=_0x4a0fbf;var _0x3ec43a={'messageId':_0x4f3694[_0xa095('0x72')][_0xa095('0x75')],'read':!![]};return _0x3d7fab[_0xa095('0x1a')](_0x3ec43a);});}else{return logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x6e'),util[_0xa095('0x38')](_0x43d7df,{'showHidden':![],'depth':null}));}})[_0xa095('0x1b')](function(_0x51f79c){return logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa095('0x6e'),util[_0xa095('0x38')](_0x51f79c,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x6e'),_0xa095('0x76'));}break;}}})['finally'](function(){_0x19a491();});}else{_0x19a491();}}},'charset':_0xa095('0x77'),'collate':_0xa095('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 430082e..a31ec18 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 _0xc57b=['lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','SmsMessage,\x20%s,\x20%s','debug','code','error','message','request\x20sent','catch','CreateSmsMessage','SmsMessage','body','options','raw','then','stringify'];(function(_0x109e1d,_0x4474f0){var _0x549e93=function(_0x214d66){while(--_0x214d66){_0x109e1d['push'](_0x109e1d['shift']());}};_0x549e93(++_0x4474f0);}(_0xc57b,0x186));var _0xbc57=function(_0x54c68e,_0x3bb911){_0x54c68e=_0x54c68e-0x0;var _0x3dc1be=_0xc57b[_0x54c68e];return _0x3dc1be;};'use strict';var _=require(_0xbc57('0x0'));var util=require(_0xbc57('0x1'));var moment=require(_0xbc57('0x2'));var BPromise=require(_0xbc57('0x3'));var rs=require(_0xbc57('0x4'));var fs=require('fs');var Redis=require(_0xbc57('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbc57('0x6'));var config=require('../../config/environment');var jayson=require(_0xbc57('0x7'));var client=jayson[_0xbc57('0x8')][_0xbc57('0x9')]({'port':0x232a});config[_0xbc57('0xa')]=_['defaults'](config[_0xbc57('0xa')],{'host':_0xbc57('0xb'),'port':0x18eb});var socket=require(_0xbc57('0xc'))(new Redis(config[_0xbc57('0xa')]));require('./smsMessage.socket')[_0xbc57('0xd')](socket);function respondWithRpcPromise(_0x556cd6,_0x1afc3f,_0x49f8aa){return new BPromise(function(_0x43dd2f,_0x27be9a){return client[_0xbc57('0xe')](_0x556cd6,_0x49f8aa)['then'](function(_0x30f18a){logger[_0xbc57('0xf')](_0xbc57('0x10'),_0x1afc3f,'request\x20sent');logger[_0xbc57('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1afc3f,'request\x20sent',JSON['stringify'](_0x30f18a));if(_0x30f18a['error']){if(_0x30f18a['error'][_0xbc57('0x12')]===0x1f4){logger['error'](_0xbc57('0x10'),_0x1afc3f,_0x30f18a['error']['message']);return _0x27be9a(_0x30f18a[_0xbc57('0x13')][_0xbc57('0x14')]);}logger['error'](_0xbc57('0x10'),_0x1afc3f,_0x30f18a[_0xbc57('0x13')][_0xbc57('0x14')]);return _0x43dd2f(_0x30f18a[_0xbc57('0x13')][_0xbc57('0x14')]);}else{logger[_0xbc57('0xf')](_0xbc57('0x10'),_0x1afc3f,_0xbc57('0x15'));_0x43dd2f(_0x30f18a['result'][_0xbc57('0x14')]);}})[_0xbc57('0x16')](function(_0x50df2b){logger[_0xbc57('0x13')](_0xbc57('0x10'),_0x1afc3f,_0x50df2b);_0x27be9a(_0x50df2b);});});}exports[_0xbc57('0x17')]=function(_0x485429){var _0x4a77cf=this;return new Promise(function(_0x1a8536,_0x116eea){return db[_0xbc57('0x18')]['create'](_0x485429[_0xbc57('0x19')],{'raw':_0x485429[_0xbc57('0x1a')]?_0x485429[_0xbc57('0x1a')][_0xbc57('0x1b')]===undefined?!![]:![]:!![]})[_0xbc57('0x1c')](function(_0x44deca){logger[_0xbc57('0xf')](_0xbc57('0x17'),_0x485429);logger[_0xbc57('0x11')](_0xbc57('0x17'),_0x485429,JSON[_0xbc57('0x1d')](_0x44deca));_0x1a8536(_0x44deca);})['catch'](function(_0x271825){logger['error'](_0xbc57('0x17'),_0x271825['message'],_0x485429);_0x116eea(_0x4a77cf[_0xbc57('0x13')](0x1f4,_0x271825[_0xbc57('0x14')]));});});}; \ No newline at end of file +var _0x593b=['info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then'];(function(_0x3944b3,_0xf05375){var _0xbf7a53=function(_0x1c5aa2){while(--_0x1c5aa2){_0x3944b3['push'](_0x3944b3['shift']());}};_0xbf7a53(++_0xf05375);}(_0x593b,0x9c));var _0xb593=function(_0x53372c,_0x3ae72c){_0x53372c=_0x53372c-0x0;var _0x15ac02=_0x593b[_0x53372c];return _0x15ac02;};'use strict';var _=require('lodash');var util=require(_0xb593('0x0'));var moment=require(_0xb593('0x1'));var BPromise=require(_0xb593('0x2'));var rs=require(_0xb593('0x3'));var fs=require('fs');var Redis=require(_0xb593('0x4'));var db=require(_0xb593('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb593('0x6'))(_0xb593('0x7'));var config=require(_0xb593('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb593('0x9')][_0xb593('0xa')]({'port':0x232a});config[_0xb593('0xb')]=_[_0xb593('0xc')](config[_0xb593('0xb')],{'host':_0xb593('0xd'),'port':0x18eb});var socket=require(_0xb593('0xe'))(new Redis(config[_0xb593('0xb')]));require(_0xb593('0xf'))[_0xb593('0x10')](socket);function respondWithRpcPromise(_0xe2fbc,_0x505657,_0x50a759){return new BPromise(function(_0x598216,_0x1ca0a5){return client[_0xb593('0x11')](_0xe2fbc,_0x50a759)[_0xb593('0x12')](function(_0x34a2d4){logger[_0xb593('0x13')](_0xb593('0x14'),_0x505657,'request\x20sent');logger[_0xb593('0x15')](_0xb593('0x16'),_0x505657,_0xb593('0x17'),JSON[_0xb593('0x18')](_0x34a2d4));if(_0x34a2d4[_0xb593('0x19')]){if(_0x34a2d4[_0xb593('0x19')][_0xb593('0x1a')]===0x1f4){logger[_0xb593('0x19')](_0xb593('0x14'),_0x505657,_0x34a2d4['error'][_0xb593('0x1b')]);return _0x1ca0a5(_0x34a2d4[_0xb593('0x19')][_0xb593('0x1b')]);}logger[_0xb593('0x19')]('SmsMessage,\x20%s,\x20%s',_0x505657,_0x34a2d4[_0xb593('0x19')][_0xb593('0x1b')]);return _0x598216(_0x34a2d4['error'][_0xb593('0x1b')]);}else{logger[_0xb593('0x13')]('SmsMessage,\x20%s,\x20%s',_0x505657,_0xb593('0x17'));_0x598216(_0x34a2d4[_0xb593('0x1c')][_0xb593('0x1b')]);}})[_0xb593('0x1d')](function(_0x3d6f70){logger['error'](_0xb593('0x14'),_0x505657,_0x3d6f70);_0x1ca0a5(_0x3d6f70);});});}exports[_0xb593('0x1e')]=function(_0x2de3eb){var _0x850759=this;return new Promise(function(_0x1a2c99,_0x22395a){return db[_0xb593('0x1f')][_0xb593('0x20')](_0x2de3eb['body'],{'raw':_0x2de3eb[_0xb593('0x21')]?_0x2de3eb[_0xb593('0x21')][_0xb593('0x22')]===undefined?!![]:![]:!![]})[_0xb593('0x12')](function(_0x447d85){logger[_0xb593('0x13')](_0xb593('0x1e'),_0x2de3eb);logger[_0xb593('0x15')](_0xb593('0x1e'),_0x2de3eb,JSON['stringify'](_0x447d85));_0x1a2c99(_0x447d85);})[_0xb593('0x1d')](function(_0x34b40c){logger[_0xb593('0x19')](_0xb593('0x1e'),_0x34b40c[_0xb593('0x1b')],_0x2de3eb);_0x22395a(_0x850759[_0xb593('0x19')](0x1f4,_0x34b40c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 85602be..3e43f5f 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 _0x4029=['./smsMessage.events','save','remove','update','emit','register','length','smsMessage:'];(function(_0x3e0d8b,_0x394db3){var _0x323aad=function(_0x377aa9){while(--_0x377aa9){_0x3e0d8b['push'](_0x3e0d8b['shift']());}};_0x323aad(++_0x394db3);}(_0x4029,0x160));var _0x9402=function(_0x8d672b,_0x590368){_0x8d672b=_0x8d672b-0x0;var _0xdd43f=_0x4029[_0x8d672b];return _0xdd43f;};'use strict';var SmsMessageEvents=require(_0x9402('0x0'));var events=[_0x9402('0x1'),_0x9402('0x2'),_0x9402('0x3')];function createListener(_0x1ec535,_0x3785e9){return function(_0x619574){_0x3785e9[_0x9402('0x4')](_0x1ec535,_0x619574);};}function removeListener(_0x51f656,_0x44cc7a){return function(){SmsMessageEvents['removeListener'](_0x51f656,_0x44cc7a);};}exports[_0x9402('0x5')]=function(_0x1e89c8){for(var _0x1e82ca=0x0,_0x3adef3=events[_0x9402('0x6')];_0x1e82ca<_0x3adef3;_0x1e82ca++){var _0x4cd65e=events[_0x1e82ca];var _0x51367a=createListener(_0x9402('0x7')+_0x4cd65e,_0x1e89c8);SmsMessageEvents['on'](_0x4cd65e,_0x51367a);}}; \ No newline at end of file +var _0x5e98=['emit','removeListener','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0xc889c2,_0x513cab){var _0x2355ea=function(_0x417b23){while(--_0x417b23){_0xc889c2['push'](_0xc889c2['shift']());}};_0x2355ea(++_0x513cab);}(_0x5e98,0xe4));var _0x85e9=function(_0x26035d,_0xc68032){_0x26035d=_0x26035d-0x0;var _0x18de85=_0x5e98[_0x26035d];return _0x18de85;};'use strict';var SmsMessageEvents=require(_0x85e9('0x0'));var events=[_0x85e9('0x1'),_0x85e9('0x2'),_0x85e9('0x3')];function createListener(_0x448453,_0x4afd5e){return function(_0x356102){_0x4afd5e[_0x85e9('0x4')](_0x448453,_0x356102);};}function removeListener(_0xc5bd73,_0x130184){return function(){SmsMessageEvents[_0x85e9('0x5')](_0xc5bd73,_0x130184);};}exports['register']=function(_0x21a93f){for(var _0x25078a=0x0,_0x389f38=events[_0x85e9('0x6')];_0x25078a<_0x389f38;_0x25078a++){var _0x447ad4=events[_0x25078a];var _0x50f714=createListener(_0x85e9('0x7')+_0x447ad4,_0x21a93f);SmsMessageEvents['on'](_0x447ad4,_0x50f714);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index fa81371..d977753 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 _0x61b6=['destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete'];(function(_0x1c1c7b,_0x2a8416){var _0x1b17e3=function(_0x4f7bd5){while(--_0x4f7bd5){_0x1c1c7b['push'](_0x1c1c7b['shift']());}};_0x1b17e3(++_0x2a8416);}(_0x61b6,0x1e0));var _0x661b=function(_0x546add,_0x261c01){_0x546add=_0x546add-0x0;var _0x45694a=_0x61b6[_0x546add];return _0x45694a;};'use strict';var multer=require(_0x661b('0x0'));var util=require(_0x661b('0x1'));var path=require(_0x661b('0x2'));var timeout=require(_0x661b('0x3'));var express=require(_0x661b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x661b('0x5'));var config=require(_0x661b('0x6'));var controller=require('./smsQueue.controller');router[_0x661b('0x7')]('/',auth[_0x661b('0x8')](),controller['index']);router[_0x661b('0x7')](_0x661b('0x9'),auth['isAuthenticated'](),controller[_0x661b('0xa')]);router['get'](_0x661b('0xb'),auth['isAuthenticated'](),controller[_0x661b('0xc')]);router[_0x661b('0x7')]('/:id/members',auth[_0x661b('0x8')](),controller['getMembers']);router[_0x661b('0x7')](_0x661b('0xd'),auth[_0x661b('0x8')](),controller[_0x661b('0xe')]);router[_0x661b('0x7')](_0x661b('0xf'),auth['isAuthenticated'](),controller[_0x661b('0x10')]);router[_0x661b('0x11')]('/',auth[_0x661b('0x8')](),controller[_0x661b('0x12')]);router[_0x661b('0x11')](_0x661b('0xd'),auth[_0x661b('0x8')](),controller[_0x661b('0x13')]);router[_0x661b('0x11')](_0x661b('0xf'),auth[_0x661b('0x8')](),controller[_0x661b('0x14')]);router[_0x661b('0x15')](_0x661b('0xb'),auth[_0x661b('0x8')](),controller[_0x661b('0x16')]);router[_0x661b('0x17')](_0x661b('0xb'),auth[_0x661b('0x8')](),controller[_0x661b('0x18')]);router[_0x661b('0x17')](_0x661b('0xd'),auth[_0x661b('0x8')](),controller[_0x661b('0x19')]);router['delete'](_0x661b('0xf'),auth[_0x661b('0x8')](),controller[_0x661b('0x1a')]);module[_0x661b('0x1b')]=router; \ No newline at end of file +var _0x809e=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2862b1,_0x51a367){var _0x817ee6=function(_0x59cc5b){while(--_0x59cc5b){_0x2862b1['push'](_0x2862b1['shift']());}};_0x817ee6(++_0x51a367);}(_0x809e,0xfe));var _0xe809=function(_0x5150fc,_0x499418){_0x5150fc=_0x5150fc-0x0;var _0x4ee25=_0x809e[_0x5150fc];return _0x4ee25;};'use strict';var multer=require(_0xe809('0x0'));var util=require(_0xe809('0x1'));var path=require(_0xe809('0x2'));var timeout=require(_0xe809('0x3'));var express=require(_0xe809('0x4'));var router=express[_0xe809('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe809('0x6'));var interaction=require(_0xe809('0x7'));var config=require(_0xe809('0x8'));var controller=require(_0xe809('0x9'));router[_0xe809('0xa')]('/',auth[_0xe809('0xb')](),controller['index']);router[_0xe809('0xa')](_0xe809('0xc'),auth[_0xe809('0xb')](),controller[_0xe809('0xd')]);router[_0xe809('0xa')](_0xe809('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xe809('0xa')](_0xe809('0xf'),auth['isAuthenticated'](),controller[_0xe809('0x10')]);router[_0xe809('0xa')]('/:id/teams',auth[_0xe809('0xb')](),controller[_0xe809('0x11')]);router[_0xe809('0xa')](_0xe809('0x12'),auth[_0xe809('0xb')](),controller[_0xe809('0x13')]);router[_0xe809('0x14')]('/',auth[_0xe809('0xb')](),controller['create']);router[_0xe809('0x14')](_0xe809('0x15'),auth[_0xe809('0xb')](),controller[_0xe809('0x16')]);router[_0xe809('0x14')](_0xe809('0x12'),auth['isAuthenticated'](),controller[_0xe809('0x17')]);router['put'](_0xe809('0xe'),auth['isAuthenticated'](),controller[_0xe809('0x18')]);router[_0xe809('0x19')]('/:id',auth[_0xe809('0xb')](),controller[_0xe809('0x1a')]);router[_0xe809('0x19')](_0xe809('0x15'),auth[_0xe809('0xb')](),controller[_0xe809('0x1b')]);router[_0xe809('0x19')](_0xe809('0x12'),auth[_0xe809('0xb')](),controller['removeAgents']);module[_0xe809('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 532e6c4..4d0a071 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 _0x8b04=['STRING','ENUM','rrmemory','beepall','exports'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x8b04,0x95));var _0x48b0=function(_0x287080,_0xa8071c){_0x287080=_0x287080-0x0;var _0x2eba52=_0x8b04[_0x287080];return _0x2eba52;};'use strict';var Sequelize=require('sequelize');module[_0x48b0('0x0')]={'name':{'type':Sequelize[_0x48b0('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[_0x48b0('0x2')](_0x48b0('0x3'),_0x48b0('0x4'),'roundrobin')}}; \ No newline at end of file +var _0xccef=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x11337a,_0x6127b3){var _0x546b3d=function(_0x22a1a7){while(--_0x22a1a7){_0x11337a['push'](_0x11337a['shift']());}};_0x546b3d(++_0x6127b3);}(_0xccef,0xd6));var _0xfcce=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xccef[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xfcce('0x0'));module[_0xfcce('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfcce('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfcce('0x3')]},'timeout':{'type':Sequelize[_0xfcce('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfcce('0x5')](_0xfcce('0x6'),_0xfcce('0x7'),_0xfcce('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 421dba6..40cf9de 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 _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x546f6b,_0x5620a7){var _0x3f407e=function(_0x118ab4){while(--_0x118ab4){_0x546f6b['push'](_0x546f6b['shift']());}};_0x3f407e(++_0x5620a7);}(_0x7a54,0x106));var _0x47a5=function(_0x53e98c,_0x5c7b5f){_0x53e98c=_0x53e98c-0x0;var _0x4b33b8=_0x7a54[_0x53e98c];return _0x4b33b8;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file +var _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x2032,0xd9));var _0x2203=function(_0x5b787d,_0x141ae7){_0x5b787d=_0x5b787d-0x0;var _0x191771=_0x2032[_0x5b787d];return _0x191771;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index cc17495..d6f8773 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 _0x99a0=['hook','events','../../mysqldb','remove','emit','hasOwnProperty'];(function(_0xc06747,_0x21be67){var _0x33cc3e=function(_0x2a902a){while(--_0x2a902a){_0xc06747['push'](_0xc06747['shift']());}};_0x33cc3e(++_0x21be67);}(_0x99a0,0x121));var _0x099a=function(_0x16ebf0,_0x28f49d){_0x16ebf0=_0x16ebf0-0x0;var _0x449e27=_0x99a0[_0x16ebf0];return _0x449e27;};'use strict';var EventEmitter=require(_0x099a('0x0'));var SmsQueue=require(_0x099a('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x099a('0x2')};function emitEvent(_0x2b5e88){return function(_0x5d6b40,_0x21d681,_0x1d3f16){SmsQueueEvents[_0x099a('0x3')](_0x2b5e88+':'+_0x5d6b40['id'],_0x5d6b40);SmsQueueEvents[_0x099a('0x3')](_0x2b5e88,_0x5d6b40);_0x1d3f16(null);};}for(var e in events){if(events[_0x099a('0x4')](e)){var event=events[e];SmsQueue[_0x099a('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x3a90=['hasOwnProperty','hook','exports','events','../../mysqldb','update','emit'];(function(_0x5c8f9f,_0xadc68){var _0x3a9576=function(_0x2eca1e){while(--_0x2eca1e){_0x5c8f9f['push'](_0x5c8f9f['shift']());}};_0x3a9576(++_0xadc68);}(_0x3a90,0xe3));var _0x03a9=function(_0x492afc,_0x52fde5){_0x492afc=_0x492afc-0x0;var _0x44b4f5=_0x3a90[_0x492afc];return _0x44b4f5;};'use strict';var EventEmitter=require(_0x03a9('0x0'));var SmsQueue=require(_0x03a9('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x03a9('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3113c1){return function(_0x3deb00,_0x4339f1,_0x4e77bd){SmsQueueEvents[_0x03a9('0x3')](_0x3113c1+':'+_0x3deb00['id'],_0x3deb00);SmsQueueEvents[_0x03a9('0x3')](_0x3113c1,_0x3deb00);_0x4e77bd(null);};}for(var e in events){if(events[_0x03a9('0x4')](e)){var event=events[e];SmsQueue[_0x03a9('0x5')](e,emitEvent(event));}}module[_0x03a9('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4fd7a33..c3f05b9 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 _0xcac5=['path','./smsQueue.attributes','exports','SmsQueue','lodash','util','api','moment','request-promise'];(function(_0x5030a4,_0x897564){var _0x34594e=function(_0x13d1e5){while(--_0x13d1e5){_0x5030a4['push'](_0x5030a4['shift']());}};_0x34594e(++_0x897564);}(_0xcac5,0x1d8));var _0x5cac=function(_0xeaade3,_0x16eae5){_0xeaade3=_0xeaade3-0x0;var _0x5504ab=_0xcac5[_0xeaade3];return _0x5504ab;};'use strict';var _=require(_0x5cac('0x0'));var util=require(_0x5cac('0x1'));var logger=require('../../config/logger')(_0x5cac('0x2'));var moment=require(_0x5cac('0x3'));var BPromise=require('bluebird');var rp=require(_0x5cac('0x4'));var fs=require('fs');var path=require(_0x5cac('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5cac('0x6'));module[_0x5cac('0x7')]=function(_0x40a1f7,_0x39e19a){return _0x40a1f7['define'](_0x5cac('0x8'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a8c=['define','SmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0xb128cb,_0x213bb3){var _0x3f7b43=function(_0x38ab8d){while(--_0x38ab8d){_0xb128cb['push'](_0xb128cb['shift']());}};_0x3f7b43(++_0x213bb3);}(_0x2a8c,0x8e));var _0xc2a8=function(_0x4d239f,_0x4f4b1b){_0x4d239f=_0x4d239f-0x0;var _0x1c1fe0=_0x2a8c[_0x4d239f];return _0x1c1fe0;};'use strict';var _=require(_0xc2a8('0x0'));var util=require(_0xc2a8('0x1'));var logger=require(_0xc2a8('0x2'))(_0xc2a8('0x3'));var moment=require(_0xc2a8('0x4'));var BPromise=require(_0xc2a8('0x5'));var rp=require(_0xc2a8('0x6'));var fs=require('fs');var path=require(_0xc2a8('0x7'));var rimraf=require(_0xc2a8('0x8'));var config=require(_0xc2a8('0x9'));var attributes=require(_0xc2a8('0xa'));module[_0xc2a8('0xb')]=function(_0x54468d,_0x36b93d){return _0x54468d[_0xc2a8('0xc')](_0xc2a8('0xd'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index bb07bf1..df9006b 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 _0xdc25=['jayson/promise','http','redis','defaults','localhost','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','map','model','then','debug','catch','ShowSmsQueue','find','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xdc25,0x1cd));var _0x5dc2=function(_0x39e06f,_0x9a2555){_0x39e06f=_0x39e06f-0x0;var _0x389749=_0xdc25[_0x39e06f];return _0x389749;};'use strict';var _=require(_0x5dc2('0x0'));var util=require(_0x5dc2('0x1'));var moment=require(_0x5dc2('0x2'));var BPromise=require(_0x5dc2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5dc2('0x4'));var logger=require(_0x5dc2('0x5'))(_0x5dc2('0x6'));var config=require('../../config/environment');var jayson=require(_0x5dc2('0x7'));var client=jayson['client'][_0x5dc2('0x8')]({'port':0x232a});config[_0x5dc2('0x9')]=_[_0x5dc2('0xa')](config[_0x5dc2('0x9')],{'host':_0x5dc2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5dc2('0x9')]));require(_0x5dc2('0xc'))[_0x5dc2('0xd')](socket);function respondWithRpcPromise(_0x27b7ad,_0x2c43d0,_0x422e0f){return new BPromise(function(_0x43d3b2,_0x48907e){return client[_0x5dc2('0xe')](_0x27b7ad,_0x422e0f)['then'](function(_0x355ee4){logger[_0x5dc2('0xf')](_0x5dc2('0x10'),_0x2c43d0,_0x5dc2('0x11'));logger['debug'](_0x5dc2('0x12'),_0x2c43d0,_0x5dc2('0x11'),JSON[_0x5dc2('0x13')](_0x355ee4));if(_0x355ee4[_0x5dc2('0x14')]){if(_0x355ee4[_0x5dc2('0x14')][_0x5dc2('0x15')]===0x1f4){logger[_0x5dc2('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2c43d0,_0x355ee4[_0x5dc2('0x14')][_0x5dc2('0x16')]);return _0x48907e(_0x355ee4[_0x5dc2('0x14')][_0x5dc2('0x16')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x2c43d0,_0x355ee4[_0x5dc2('0x14')][_0x5dc2('0x16')]);return _0x43d3b2(_0x355ee4[_0x5dc2('0x14')][_0x5dc2('0x16')]);}else{logger[_0x5dc2('0xf')](_0x5dc2('0x10'),_0x2c43d0,'request\x20sent');_0x43d3b2(_0x355ee4[_0x5dc2('0x17')]['message']);}})['catch'](function(_0x487c26){logger[_0x5dc2('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2c43d0,_0x487c26);_0x48907e(_0x487c26);});});}exports[_0x5dc2('0x18')]=function(_0x1f7d72){var _0x251f44=this;return new Promise(function(_0x400537,_0x5e237f){return db[_0x5dc2('0x19')][_0x5dc2('0x1a')]({'raw':_0x1f7d72[_0x5dc2('0x1b')]?_0x1f7d72[_0x5dc2('0x1b')][_0x5dc2('0x1c')]===undefined?!![]:![]:!![],'where':_0x1f7d72[_0x5dc2('0x1b')]?_0x1f7d72[_0x5dc2('0x1b')][_0x5dc2('0x1d')]||null:null,'attributes':_0x1f7d72[_0x5dc2('0x1b')]?_0x1f7d72[_0x5dc2('0x1b')][_0x5dc2('0x1e')]||null:null,'limit':_0x1f7d72[_0x5dc2('0x1b')]?_0x1f7d72[_0x5dc2('0x1b')]['limit']||null:null,'include':_0x1f7d72[_0x5dc2('0x1b')]?_0x1f7d72['options'][_0x5dc2('0x1f')]?_[_0x5dc2('0x20')](_0x1f7d72[_0x5dc2('0x1b')][_0x5dc2('0x1f')],function(_0x5f4a12){return{'model':db[_0x5f4a12['model']],'as':_0x5f4a12['as'],'attributes':_0x5f4a12[_0x5dc2('0x1e')],'include':_0x5f4a12[_0x5dc2('0x1f')]?_[_0x5dc2('0x20')](_0x5f4a12[_0x5dc2('0x1f')],function(_0x64b308){return{'model':db[_0x64b308[_0x5dc2('0x21')]],'as':_0x64b308['as'],'attributes':_0x64b308['attributes'],'include':_0x64b308[_0x5dc2('0x1f')]?_[_0x5dc2('0x20')](_0x64b308['include'],function(_0x43db97){return{'model':db[_0x43db97['model']],'as':_0x43db97['as'],'attributes':_0x43db97[_0x5dc2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5dc2('0x22')](function(_0x353231){logger[_0x5dc2('0xf')](_0x5dc2('0x18'),_0x1f7d72);logger[_0x5dc2('0x23')](_0x5dc2('0x18'),_0x1f7d72,JSON[_0x5dc2('0x13')](_0x353231));_0x400537(_0x353231);})[_0x5dc2('0x24')](function(_0x5a4a12){logger[_0x5dc2('0x14')](_0x5dc2('0x18'),_0x5a4a12[_0x5dc2('0x16')],_0x1f7d72);_0x5e237f(_0x251f44['error'](0x1f4,_0x5a4a12[_0x5dc2('0x16')]));});});};exports[_0x5dc2('0x25')]=function(_0x10d26a){var _0x139f87=this;return new Promise(function(_0x397aa9,_0x3b3f98){return db[_0x5dc2('0x19')][_0x5dc2('0x26')]({'raw':_0x10d26a['options']?_0x10d26a['options']['raw']===undefined?!![]:![]:!![],'where':_0x10d26a[_0x5dc2('0x1b')]?_0x10d26a[_0x5dc2('0x1b')][_0x5dc2('0x1d')]||null:null,'attributes':_0x10d26a[_0x5dc2('0x1b')]?_0x10d26a['options'][_0x5dc2('0x1e')]||null:null,'include':_0x10d26a[_0x5dc2('0x1b')]?_0x10d26a[_0x5dc2('0x1b')][_0x5dc2('0x1f')]?_[_0x5dc2('0x20')](_0x10d26a['options'][_0x5dc2('0x1f')],function(_0x1bc081){return{'model':db[_0x1bc081[_0x5dc2('0x21')]],'as':_0x1bc081['as'],'attributes':_0x1bc081['attributes'],'include':_0x1bc081[_0x5dc2('0x1f')]?_['map'](_0x1bc081[_0x5dc2('0x1f')],function(_0x41280e){return{'model':db[_0x41280e['model']],'as':_0x41280e['as'],'attributes':_0x41280e['attributes'],'include':_0x41280e[_0x5dc2('0x1f')]?_['map'](_0x41280e[_0x5dc2('0x1f')],function(_0x28e35e){return{'model':db[_0x28e35e[_0x5dc2('0x21')]],'as':_0x28e35e['as'],'attributes':_0x28e35e[_0x5dc2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5dc2('0x22')](function(_0x2c6732){logger[_0x5dc2('0xf')](_0x5dc2('0x25'),_0x10d26a);logger['debug'](_0x5dc2('0x25'),_0x10d26a,JSON[_0x5dc2('0x13')](_0x2c6732));_0x397aa9(_0x2c6732);})['catch'](function(_0x195654){logger['error'](_0x5dc2('0x25'),_0x195654[_0x5dc2('0x16')],_0x10d26a);_0x3b3f98(_0x139f87[_0x5dc2('0x14')](0x1f4,_0x195654[_0x5dc2('0x16')]));});});}; \ No newline at end of file +var _0x1f62=['http','redis','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','then','catch','ShowSmsQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client'];(function(_0x2150c8,_0xfb4121){var _0x113c31=function(_0x418a92){while(--_0x418a92){_0x2150c8['push'](_0x2150c8['shift']());}};_0x113c31(++_0xfb4121);}(_0x1f62,0x13c));var _0x21f6=function(_0x389fee,_0x18baf5){_0x389fee=_0x389fee-0x0;var _0x1511f6=_0x1f62[_0x389fee];return _0x1511f6;};'use strict';var _=require(_0x21f6('0x0'));var util=require('util');var moment=require(_0x21f6('0x1'));var BPromise=require(_0x21f6('0x2'));var rs=require(_0x21f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21f6('0x4'))['db'];var utils=require(_0x21f6('0x5'));var logger=require('../../config/logger')(_0x21f6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x21f6('0x7')][_0x21f6('0x8')]({'port':0x232a});config[_0x21f6('0x9')]=_['defaults'](config[_0x21f6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x21f6('0xa'))(new Redis(config['redis']));require(_0x21f6('0xb'))[_0x21f6('0xc')](socket);function respondWithRpcPromise(_0x4c38e4,_0x52ec2e,_0x4b0a40){return new BPromise(function(_0x166eb4,_0xc1c396){return client[_0x21f6('0xd')](_0x4c38e4,_0x4b0a40)['then'](function(_0x115c15){logger[_0x21f6('0xe')](_0x21f6('0xf'),_0x52ec2e,_0x21f6('0x10'));logger[_0x21f6('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x52ec2e,'request\x20sent',JSON[_0x21f6('0x12')](_0x115c15));if(_0x115c15[_0x21f6('0x13')]){if(_0x115c15['error'][_0x21f6('0x14')]===0x1f4){logger[_0x21f6('0x13')](_0x21f6('0xf'),_0x52ec2e,_0x115c15[_0x21f6('0x13')]['message']);return _0xc1c396(_0x115c15[_0x21f6('0x13')][_0x21f6('0x15')]);}logger[_0x21f6('0x13')]('SmsQueue,\x20%s,\x20%s',_0x52ec2e,_0x115c15[_0x21f6('0x13')][_0x21f6('0x15')]);return _0x166eb4(_0x115c15[_0x21f6('0x13')][_0x21f6('0x15')]);}else{logger[_0x21f6('0xe')](_0x21f6('0xf'),_0x52ec2e,_0x21f6('0x10'));_0x166eb4(_0x115c15[_0x21f6('0x16')]['message']);}})['catch'](function(_0x312729){logger[_0x21f6('0x13')](_0x21f6('0xf'),_0x52ec2e,_0x312729);_0xc1c396(_0x312729);});});}exports[_0x21f6('0x17')]=function(_0x541b70){var _0xbdf631=this;return new Promise(function(_0x26bf22,_0x1758bc){return db[_0x21f6('0x18')][_0x21f6('0x19')]({'raw':_0x541b70[_0x21f6('0x1a')]?_0x541b70['options']['raw']===undefined?!![]:![]:!![],'where':_0x541b70['options']?_0x541b70[_0x21f6('0x1a')][_0x21f6('0x1b')]||null:null,'attributes':_0x541b70[_0x21f6('0x1a')]?_0x541b70[_0x21f6('0x1a')][_0x21f6('0x1c')]||null:null,'limit':_0x541b70[_0x21f6('0x1a')]?_0x541b70[_0x21f6('0x1a')][_0x21f6('0x1d')]||null:null,'include':_0x541b70['options']?_0x541b70[_0x21f6('0x1a')][_0x21f6('0x1e')]?_[_0x21f6('0x1f')](_0x541b70['options'][_0x21f6('0x1e')],function(_0x58921b){return{'model':db[_0x58921b[_0x21f6('0x20')]],'as':_0x58921b['as'],'attributes':_0x58921b[_0x21f6('0x1c')],'include':_0x58921b[_0x21f6('0x1e')]?_[_0x21f6('0x1f')](_0x58921b[_0x21f6('0x1e')],function(_0x6ea499){return{'model':db[_0x6ea499[_0x21f6('0x20')]],'as':_0x6ea499['as'],'attributes':_0x6ea499['attributes'],'include':_0x6ea499['include']?_[_0x21f6('0x1f')](_0x6ea499[_0x21f6('0x1e')],function(_0x404ad9){return{'model':db[_0x404ad9[_0x21f6('0x20')]],'as':_0x404ad9['as'],'attributes':_0x404ad9[_0x21f6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x21f6('0x21')](function(_0x1495d9){logger[_0x21f6('0xe')]('GetSmsQueue',_0x541b70);logger[_0x21f6('0x11')](_0x21f6('0x17'),_0x541b70,JSON[_0x21f6('0x12')](_0x1495d9));_0x26bf22(_0x1495d9);})[_0x21f6('0x22')](function(_0x31d98f){logger[_0x21f6('0x13')](_0x21f6('0x17'),_0x31d98f['message'],_0x541b70);_0x1758bc(_0xbdf631[_0x21f6('0x13')](0x1f4,_0x31d98f[_0x21f6('0x15')]));});});};exports['ShowSmsQueue']=function(_0x286a4a){var _0x3cad9d=this;return new Promise(function(_0x224bd0,_0x4e8aa5){return db[_0x21f6('0x18')]['find']({'raw':_0x286a4a[_0x21f6('0x1a')]?_0x286a4a[_0x21f6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x286a4a[_0x21f6('0x1a')]?_0x286a4a[_0x21f6('0x1a')][_0x21f6('0x1b')]||null:null,'attributes':_0x286a4a['options']?_0x286a4a['options']['attributes']||null:null,'include':_0x286a4a[_0x21f6('0x1a')]?_0x286a4a[_0x21f6('0x1a')]['include']?_[_0x21f6('0x1f')](_0x286a4a['options'][_0x21f6('0x1e')],function(_0x2483ce){return{'model':db[_0x2483ce[_0x21f6('0x20')]],'as':_0x2483ce['as'],'attributes':_0x2483ce[_0x21f6('0x1c')],'include':_0x2483ce[_0x21f6('0x1e')]?_[_0x21f6('0x1f')](_0x2483ce['include'],function(_0x41ecf6){return{'model':db[_0x41ecf6[_0x21f6('0x20')]],'as':_0x41ecf6['as'],'attributes':_0x41ecf6['attributes'],'include':_0x41ecf6[_0x21f6('0x1e')]?_['map'](_0x41ecf6['include'],function(_0xe62c82){return{'model':db[_0xe62c82[_0x21f6('0x20')]],'as':_0xe62c82['as'],'attributes':_0xe62c82[_0x21f6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f3f3b){logger[_0x21f6('0xe')](_0x21f6('0x23'),_0x286a4a);logger[_0x21f6('0x11')]('ShowSmsQueue',_0x286a4a,JSON[_0x21f6('0x12')](_0x4f3f3b));_0x224bd0(_0x4f3f3b);})[_0x21f6('0x22')](function(_0x3b23e5){logger[_0x21f6('0x13')]('ShowSmsQueue',_0x3b23e5[_0x21f6('0x15')],_0x286a4a);_0x4e8aa5(_0x3cad9d[_0x21f6('0x13')](0x1f4,_0x3b23e5[_0x21f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 6647c52..cc7687c 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 _0xb7a1=['./smsQueue.events','remove','update','emit','removeListener','length'];(function(_0x2675da,_0x5a250e){var _0x5e6153=function(_0xf93114){while(--_0xf93114){_0x2675da['push'](_0x2675da['shift']());}};_0x5e6153(++_0x5a250e);}(_0xb7a1,0xd2));var _0x1b7a=function(_0x1fb6b1,_0xe802db){_0x1fb6b1=_0x1fb6b1-0x0;var _0x39d305=_0xb7a1[_0x1fb6b1];return _0x39d305;};'use strict';var SmsQueueEvents=require(_0x1b7a('0x0'));var events=['save',_0x1b7a('0x1'),_0x1b7a('0x2')];function createListener(_0x4cc763,_0x203f84){return function(_0x3f7ae9){_0x203f84[_0x1b7a('0x3')](_0x4cc763,_0x3f7ae9);};}function removeListener(_0x187838,_0x6eec9c){return function(){SmsQueueEvents[_0x1b7a('0x4')](_0x187838,_0x6eec9c);};}exports['register']=function(_0x10a5e5){for(var _0x4f08dd=0x0,_0x25f832=events[_0x1b7a('0x5')];_0x4f08dd<_0x25f832;_0x4f08dd++){var _0x54b334=events[_0x4f08dd];var _0x2529d2=createListener('smsQueue:'+_0x54b334,_0x10a5e5);SmsQueueEvents['on'](_0x54b334,_0x2529d2);}}; \ No newline at end of file +var _0x7d46=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0xa79afb,_0x4fc78f){var _0x33ccb8=function(_0x2b3751){while(--_0x2b3751){_0xa79afb['push'](_0xa79afb['shift']());}};_0x33ccb8(++_0x4fc78f);}(_0x7d46,0x1de));var _0x67d4=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x7d46[_0x18cd5b];return _0x5eaa52;};'use strict';var SmsQueueEvents=require(_0x67d4('0x0'));var events=[_0x67d4('0x1'),'remove',_0x67d4('0x2')];function createListener(_0xa1e686,_0x23c4b0){return function(_0x1c281e){_0x23c4b0[_0x67d4('0x3')](_0xa1e686,_0x1c281e);};}function removeListener(_0x39067d,_0x5d96c3){return function(){SmsQueueEvents[_0x67d4('0x4')](_0x39067d,_0x5d96c3);};}exports[_0x67d4('0x5')]=function(_0x58983c){for(var _0x71492=0x0,_0x52f25b=events[_0x67d4('0x6')];_0x71492<_0x52f25b;_0x71492++){var _0x359e16=events[_0x71492];var _0x5a86e9=createListener(_0x67d4('0x7')+_0x359e16,_0x58983c);SmsQueueEvents['on'](_0x359e16,_0x5a86e9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f079991..64b439d 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 _0x0852=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','exports','multer','path'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x0852,0x108));var _0x2085=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0852[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x2085('0x0'));var util=require('util');var path=require(_0x2085('0x1'));var timeout=require(_0x2085('0x2'));var express=require('express');var router=express[_0x2085('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2085('0x4'));var interaction=require(_0x2085('0x5'));var config=require(_0x2085('0x6'));var controller=require('./smsQueueReport.controller');router[_0x2085('0x7')]('/',auth['isAuthenticated'](),controller[_0x2085('0x8')]);router[_0x2085('0x7')](_0x2085('0x9'),auth[_0x2085('0xa')](),controller[_0x2085('0xb')]);router['get'](_0x2085('0xc'),auth[_0x2085('0xa')](),controller['show']);router[_0x2085('0xd')]('/',auth[_0x2085('0xa')](),controller[_0x2085('0xe')]);router[_0x2085('0xf')](_0x2085('0xc'),auth[_0x2085('0xa')](),controller[_0x2085('0x10')]);router[_0x2085('0x11')](_0x2085('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x2085('0x12')]=router; \ No newline at end of file +var _0x108e=['describe','/:id','show','post','update','destroy','util','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x38c21f,_0x5d27a5){var _0x2e1b03=function(_0x70cc69){while(--_0x70cc69){_0x38c21f['push'](_0x38c21f['shift']());}};_0x2e1b03(++_0x5d27a5);}(_0x108e,0x141));var _0xe108=function(_0x30cd1d,_0x440373){_0x30cd1d=_0x30cd1d-0x0;var _0x12b888=_0x108e[_0x30cd1d];return _0x12b888;};'use strict';var multer=require('multer');var util=require(_0xe108('0x0'));var path=require(_0xe108('0x1'));var timeout=require('connect-timeout');var express=require(_0xe108('0x2'));var router=express['Router']();var fs_extra=require(_0xe108('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe108('0x4'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xe108('0x5')]('/',auth[_0xe108('0x6')](),controller[_0xe108('0x7')]);router[_0xe108('0x5')](_0xe108('0x8'),auth[_0xe108('0x6')](),controller[_0xe108('0x9')]);router[_0xe108('0x5')](_0xe108('0xa'),auth['isAuthenticated'](),controller[_0xe108('0xb')]);router[_0xe108('0xc')]('/',auth[_0xe108('0x6')](),controller['create']);router['put'](_0xe108('0xa'),auth[_0xe108('0x6')](),controller[_0xe108('0xd')]);router['delete'](_0xe108('0xa'),auth[_0xe108('0x6')](),controller[_0xe108('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index dd5b83c..e156903 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 _0x1db9=['sequelize','exports','STRING','DATE','moment'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x1db9,0x176));var _0x91db=function(_0x359110,_0x105af4){_0x359110=_0x359110-0x0;var _0x5d3edf=_0x1db9[_0x359110];return _0x5d3edf;};'use strict';var moment=require(_0x91db('0x0'));var Sequelize=require(_0x91db('0x1'));module[_0x91db('0x2')]={'uniqueid':{'type':Sequelize[_0x91db('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x91db('0x3')]},'joinAt':{'type':Sequelize[_0x91db('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x91db('0x4')]},'exitAt':{'type':Sequelize[_0x91db('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe75f=['DATE','moment','sequelize','exports','STRING'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xe75f,0x11e));var _0xfe75=function(_0x22b2f1,_0x8af4ca){_0x22b2f1=_0x22b2f1-0x0;var _0x1a139b=_0xe75f[_0x22b2f1];return _0x1a139b;};'use strict';var moment=require(_0xfe75('0x0'));var Sequelize=require(_0xfe75('0x1'));module[_0xfe75('0x2')]={'uniqueid':{'type':Sequelize[_0xfe75('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfe75('0x4')]},'leaveAt':{'type':Sequelize[_0xfe75('0x4')]},'acceptAt':{'type':Sequelize[_0xfe75('0x4')]},'exitAt':{'type':Sequelize[_0xfe75('0x4')]},'reason':{'type':Sequelize[_0xfe75('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index fa83e0a..d589a8b 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 _0x5155=['count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','SmsQueueReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','map','type','VIRTUAL','merge','include','findAll','catch','show','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit'];(function(_0x1fdca1,_0x22eebb){var _0x1974af=function(_0x9bc26d){while(--_0x9bc26d){_0x1fdca1['push'](_0x1fdca1['shift']());}};_0x1974af(++_0x22eebb);}(_0x5155,0xc5));var _0x5515=function(_0xa40e6e,_0x5eb1c4){_0xa40e6e=_0xa40e6e-0x0;var _0x420221=_0x5155[_0xa40e6e];return _0x420221;};'use strict';var emlformat=require(_0x5515('0x0'));var rimraf=require(_0x5515('0x1'));var zipdir=require(_0x5515('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5515('0x3'));var moment=require(_0x5515('0x4'));var BPromise=require(_0x5515('0x5'));var Mustache=require(_0x5515('0x6'));var util=require(_0x5515('0x7'));var path=require(_0x5515('0x8'));var sox=require(_0x5515('0x9'));var csv=require(_0x5515('0xa'));var ejs=require(_0x5515('0xb'));var fs=require('fs');var fs_extra=require(_0x5515('0xc'));var _=require(_0x5515('0xd'));var squel=require('squel');var crypto=require(_0x5515('0xe'));var jsforce=require(_0x5515('0xf'));var deskjs=require(_0x5515('0x10'));var toCsv=require(_0x5515('0xa'));var querystring=require('querystring');var Papa=require(_0x5515('0x11'));var Redis=require('ioredis');var authService=require(_0x5515('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5515('0x13'));var logger=require(_0x5515('0x14'))(_0x5515('0x15'));var utils=require(_0x5515('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5515('0x17'));var db=require(_0x5515('0x18'))['db'];function respondWithStatusCode(_0x49a3ee,_0x31a743){_0x31a743=_0x31a743||0xcc;return function(_0xff8295){if(_0xff8295){return _0x49a3ee['sendStatus'](_0x31a743);}return _0x49a3ee[_0x5515('0x19')](_0x31a743)[_0x5515('0x1a')]();};}function respondWithResult(_0x174ef7,_0x4a9fc6){_0x4a9fc6=_0x4a9fc6||0xc8;return function(_0x475c89){if(_0x475c89){return _0x174ef7[_0x5515('0x19')](_0x4a9fc6)[_0x5515('0x1b')](_0x475c89);}};}function respondWithFilteredResult(_0x38363f,_0x2fc817){return function(_0x218ffe){if(_0x218ffe){var _0x88cb54=typeof _0x2fc817[_0x5515('0x1c')]===_0x5515('0x1d')&&typeof _0x2fc817[_0x5515('0x1e')]===_0x5515('0x1d');var _0x9cfc77=_0x218ffe['count'];var _0x360da1=_0x88cb54?0x0:_0x2fc817[_0x5515('0x1c')];var _0x48b450=_0x88cb54?_0x218ffe[_0x5515('0x1f')]:_0x2fc817[_0x5515('0x1c')]+_0x2fc817['limit'];var _0x17109e;if(_0x48b450>=_0x9cfc77){_0x48b450=_0x9cfc77;_0x17109e=0xc8;}else{_0x17109e=0xce;}_0x38363f[_0x5515('0x19')](_0x17109e);return _0x38363f[_0x5515('0x20')](_0x5515('0x21'),_0x360da1+'-'+_0x48b450+'/'+_0x9cfc77)[_0x5515('0x1b')](_0x218ffe);}return null;};}function patchUpdates(_0x30ef0b){return function(_0x3a55fd){try{jsonpatch[_0x5515('0x22')](_0x3a55fd,_0x30ef0b,!![]);}catch(_0x139e0f){return BPromise[_0x5515('0x23')](_0x139e0f);}return _0x3a55fd[_0x5515('0x24')]();};}function saveUpdates(_0xb6dd15,_0x2eb47c){return function(_0x5955b6){if(_0x5955b6){return _0x5955b6[_0x5515('0x25')](_0xb6dd15)['then'](function(_0x225bec){return _0x225bec;});}return null;};}function removeEntity(_0x157fa9,_0x3e45b6){return function(_0xf54b4b){if(_0xf54b4b){return _0xf54b4b[_0x5515('0x26')]()[_0x5515('0x27')](function(){_0x157fa9[_0x5515('0x19')](0xcc)[_0x5515('0x1a')]();});}};}function handleEntityNotFound(_0x1885db,_0x1beaf7){return function(_0x49a30e){if(!_0x49a30e){_0x1885db[_0x5515('0x28')](0x194);}return _0x49a30e;};}function handleError(_0x1ce532,_0x2c5e32){_0x2c5e32=_0x2c5e32||0x1f4;return function(_0x48654a){logger[_0x5515('0x29')](_0x48654a[_0x5515('0x2a')]);if(_0x48654a[_0x5515('0x2b')]){delete _0x48654a[_0x5515('0x2b')];}_0x1ce532[_0x5515('0x19')](_0x2c5e32)[_0x5515('0x2c')](_0x48654a);};}exports['index']=function(_0x1f5b6,_0x145271){var _0x4c018f={},_0x3060e8={},_0x1a9e3c={'count':0x0,'rows':[]};var _0x23531=_['map'](db[_0x5515('0x2d')][_0x5515('0x2e')],function(_0x486890){return{'name':_0x486890['fieldName'],'type':_0x486890['type'][_0x5515('0x2f')]};});_0x3060e8[_0x5515('0x30')]=_['map'](_0x23531,_0x5515('0x2b'));_0x3060e8[_0x5515('0x31')]=_[_0x5515('0x32')](_0x1f5b6[_0x5515('0x31')]);_0x3060e8[_0x5515('0x33')]=_['intersection'](_0x3060e8[_0x5515('0x30')],_0x3060e8[_0x5515('0x31')]);_0x4c018f['attributes']=_[_0x5515('0x34')](_0x3060e8[_0x5515('0x30')],qs[_0x5515('0x35')](_0x1f5b6['query']['fields']));_0x4c018f[_0x5515('0x36')]=_0x4c018f[_0x5515('0x36')][_0x5515('0x37')]?_0x4c018f[_0x5515('0x36')]:_0x3060e8['model'];if(!_0x1f5b6[_0x5515('0x31')][_0x5515('0x38')](_0x5515('0x39'))){_0x4c018f[_0x5515('0x1e')]=qs[_0x5515('0x1e')](_0x1f5b6[_0x5515('0x31')][_0x5515('0x1e')]);_0x4c018f['offset']=qs[_0x5515('0x1c')](_0x1f5b6[_0x5515('0x31')][_0x5515('0x1c')]);}_0x4c018f['order']=qs['sort'](_0x1f5b6['query']['sort']);_0x4c018f[_0x5515('0x3a')]=qs[_0x5515('0x33')](_[_0x5515('0x3b')](_0x1f5b6['query'],_0x3060e8[_0x5515('0x33')]),_0x23531);if(_0x1f5b6[_0x5515('0x31')][_0x5515('0x3c')]){_0x4c018f['where']=_['merge'](_0x4c018f[_0x5515('0x3a')],{'$or':_[_0x5515('0x3d')](_0x23531,function(_0x545061){if(_0x545061[_0x5515('0x3e')]!==_0x5515('0x3f')){var _0x14a7ee={};_0x14a7ee[_0x545061[_0x5515('0x2b')]]={'$like':'%'+_0x1f5b6[_0x5515('0x31')][_0x5515('0x3c')]+'%'};return _0x14a7ee;}})});}_0x4c018f=_[_0x5515('0x40')]({},_0x4c018f,_0x1f5b6['options']);var _0x2afc7c={'where':_0x4c018f[_0x5515('0x3a')]};return db[_0x5515('0x2d')]['count'](_0x2afc7c)[_0x5515('0x27')](function(_0x3640a8){_0x1a9e3c[_0x5515('0x1f')]=_0x3640a8;if(_0x1f5b6[_0x5515('0x31')]['includeAll']){_0x4c018f[_0x5515('0x41')]=[{'all':!![]}];}return db[_0x5515('0x2d')][_0x5515('0x42')](_0x4c018f);})[_0x5515('0x27')](function(_0x234fc4){_0x1a9e3c['rows']=_0x234fc4;return _0x1a9e3c;})['then'](respondWithFilteredResult(_0x145271,_0x4c018f))[_0x5515('0x43')](handleError(_0x145271,null));};exports[_0x5515('0x44')]=function(_0x4cac16,_0x500b2f){var _0x1e0fbc={'raw':!![],'where':{'id':_0x4cac16[_0x5515('0x45')]['id']}},_0x520f94={};_0x520f94[_0x5515('0x30')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x520f94[_0x5515('0x31')]=_[_0x5515('0x32')](_0x4cac16[_0x5515('0x31')]);_0x520f94[_0x5515('0x33')]=_[_0x5515('0x34')](_0x520f94[_0x5515('0x30')],_0x520f94['query']);_0x1e0fbc[_0x5515('0x36')]=_[_0x5515('0x34')](_0x520f94[_0x5515('0x30')],qs[_0x5515('0x35')](_0x4cac16[_0x5515('0x31')][_0x5515('0x35')]));_0x1e0fbc[_0x5515('0x36')]=_0x1e0fbc['attributes'][_0x5515('0x37')]?_0x1e0fbc[_0x5515('0x36')]:_0x520f94['model'];if(_0x4cac16[_0x5515('0x31')][_0x5515('0x46')]){_0x1e0fbc[_0x5515('0x41')]=[{'all':!![]}];}_0x1e0fbc=_['merge']({},_0x1e0fbc,_0x4cac16[_0x5515('0x47')]);return db[_0x5515('0x2d')][_0x5515('0x48')](_0x1e0fbc)[_0x5515('0x27')](handleEntityNotFound(_0x500b2f,null))[_0x5515('0x27')](respondWithResult(_0x500b2f,null))[_0x5515('0x43')](handleError(_0x500b2f,null));};exports['create']=function(_0x27521d,_0x2562b2){return db[_0x5515('0x2d')][_0x5515('0x49')](_0x27521d[_0x5515('0x4a')],{})['then'](respondWithResult(_0x2562b2,0xc9))[_0x5515('0x43')](handleError(_0x2562b2,null));};exports[_0x5515('0x25')]=function(_0x200fa7,_0x4402e9){if(_0x200fa7['body']['id']){delete _0x200fa7[_0x5515('0x4a')]['id'];}return db['SmsQueueReport'][_0x5515('0x48')]({'where':{'id':_0x200fa7[_0x5515('0x45')]['id']}})[_0x5515('0x27')](handleEntityNotFound(_0x4402e9,null))[_0x5515('0x27')](saveUpdates(_0x200fa7[_0x5515('0x4a')],null))[_0x5515('0x27')](respondWithResult(_0x4402e9,null))[_0x5515('0x43')](handleError(_0x4402e9,null));};exports[_0x5515('0x26')]=function(_0x5eda93,_0x8a9788){return db[_0x5515('0x2d')][_0x5515('0x48')]({'where':{'id':_0x5eda93[_0x5515('0x45')]['id']}})[_0x5515('0x27')](handleEntityNotFound(_0x8a9788,null))[_0x5515('0x27')](removeEntity(_0x8a9788,null))[_0x5515('0x43')](handleError(_0x8a9788,null));};exports[_0x5515('0x4b')]=function(_0x5e5cd5,_0x2b93af){return db['SmsQueueReport']['describe']()[_0x5515('0x27')](respondWithResult(_0x2b93af,null))['catch'](handleError(_0x2b93af,null));}; \ No newline at end of file +var _0x082f=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SmsQueueReport','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5f343f,_0x157119){var _0x509d92=function(_0x111a69){while(--_0x111a69){_0x5f343f['push'](_0x5f343f['shift']());}};_0x509d92(++_0x157119);}(_0x082f,0x14f));var _0xf082=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x082f[_0x568496];return _0x26c5c1;};'use strict';var emlformat=require(_0xf082('0x0'));var rimraf=require(_0xf082('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf082('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf082('0x3'));var Mustache=require('mustache');var util=require(_0xf082('0x4'));var path=require(_0xf082('0x5'));var sox=require(_0xf082('0x6'));var csv=require(_0xf082('0x7'));var ejs=require(_0xf082('0x8'));var fs=require('fs');var fs_extra=require(_0xf082('0x9'));var _=require(_0xf082('0xa'));var squel=require(_0xf082('0xb'));var crypto=require(_0xf082('0xc'));var jsforce=require(_0xf082('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf082('0x7'));var querystring=require(_0xf082('0xe'));var Papa=require(_0xf082('0xf'));var Redis=require(_0xf082('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf082('0x11'));var hardwareService=require(_0xf082('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf082('0x13'));var licenseUtil=require(_0xf082('0x14'));var db=require(_0xf082('0x15'))['db'];function respondWithStatusCode(_0x24fe6e,_0x3f2cff){_0x3f2cff=_0x3f2cff||0xcc;return function(_0x1063a2){if(_0x1063a2){return _0x24fe6e['sendStatus'](_0x3f2cff);}return _0x24fe6e[_0xf082('0x16')](_0x3f2cff)[_0xf082('0x17')]();};}function respondWithResult(_0x1caff9,_0x4dfd62){_0x4dfd62=_0x4dfd62||0xc8;return function(_0x9c9c4){if(_0x9c9c4){return _0x1caff9[_0xf082('0x16')](_0x4dfd62)[_0xf082('0x18')](_0x9c9c4);}};}function respondWithFilteredResult(_0x419430,_0x3f8881){return function(_0x105e9c){if(_0x105e9c){var _0x1c9d99=typeof _0x3f8881[_0xf082('0x19')]===_0xf082('0x1a')&&typeof _0x3f8881[_0xf082('0x1b')]===_0xf082('0x1a');var _0x376417=_0x105e9c[_0xf082('0x1c')];var _0x46a7d6=_0x1c9d99?0x0:_0x3f8881[_0xf082('0x19')];var _0x8284f5=_0x1c9d99?_0x105e9c[_0xf082('0x1c')]:_0x3f8881[_0xf082('0x19')]+_0x3f8881[_0xf082('0x1b')];var _0x19b1bd;if(_0x8284f5>=_0x376417){_0x8284f5=_0x376417;_0x19b1bd=0xc8;}else{_0x19b1bd=0xce;}_0x419430[_0xf082('0x16')](_0x19b1bd);return _0x419430['set'](_0xf082('0x1d'),_0x46a7d6+'-'+_0x8284f5+'/'+_0x376417)[_0xf082('0x18')](_0x105e9c);}return null;};}function patchUpdates(_0x56cd85){return function(_0x3f5f9a){try{jsonpatch['apply'](_0x3f5f9a,_0x56cd85,!![]);}catch(_0x52a05a){return BPromise[_0xf082('0x1e')](_0x52a05a);}return _0x3f5f9a[_0xf082('0x1f')]();};}function saveUpdates(_0x422913,_0x240c91){return function(_0xe1af09){if(_0xe1af09){return _0xe1af09[_0xf082('0x20')](_0x422913)[_0xf082('0x21')](function(_0x367835){return _0x367835;});}return null;};}function removeEntity(_0x101ec3,_0x3951d1){return function(_0xff535a){if(_0xff535a){return _0xff535a[_0xf082('0x22')]()['then'](function(){_0x101ec3[_0xf082('0x16')](0xcc)[_0xf082('0x17')]();});}};}function handleEntityNotFound(_0x10e835,_0x1d83c0){return function(_0x1368dd){if(!_0x1368dd){_0x10e835['sendStatus'](0x194);}return _0x1368dd;};}function handleError(_0x3cf777,_0x1d954d){_0x1d954d=_0x1d954d||0x1f4;return function(_0x6b47a2){logger[_0xf082('0x23')](_0x6b47a2[_0xf082('0x24')]);if(_0x6b47a2[_0xf082('0x25')]){delete _0x6b47a2[_0xf082('0x25')];}_0x3cf777[_0xf082('0x16')](_0x1d954d)['send'](_0x6b47a2);};}exports[_0xf082('0x26')]=function(_0x44fc4a,_0x5e9ea3){var _0x1c9bc8={},_0x1ffbab={},_0x1d0161={'count':0x0,'rows':[]};var _0x3cc64b=_[_0xf082('0x27')](db[_0xf082('0x28')]['rawAttributes'],function(_0x67423f){return{'name':_0x67423f['fieldName'],'type':_0x67423f['type']['key']};});_0x1ffbab[_0xf082('0x29')]=_[_0xf082('0x27')](_0x3cc64b,_0xf082('0x25'));_0x1ffbab[_0xf082('0x2a')]=_[_0xf082('0x2b')](_0x44fc4a[_0xf082('0x2a')]);_0x1ffbab['filters']=_['intersection'](_0x1ffbab[_0xf082('0x29')],_0x1ffbab[_0xf082('0x2a')]);_0x1c9bc8[_0xf082('0x2c')]=_[_0xf082('0x2d')](_0x1ffbab[_0xf082('0x29')],qs[_0xf082('0x2e')](_0x44fc4a[_0xf082('0x2a')][_0xf082('0x2e')]));_0x1c9bc8[_0xf082('0x2c')]=_0x1c9bc8['attributes']['length']?_0x1c9bc8[_0xf082('0x2c')]:_0x1ffbab['model'];if(!_0x44fc4a[_0xf082('0x2a')][_0xf082('0x2f')]('nolimit')){_0x1c9bc8['limit']=qs['limit'](_0x44fc4a[_0xf082('0x2a')][_0xf082('0x1b')]);_0x1c9bc8[_0xf082('0x19')]=qs[_0xf082('0x19')](_0x44fc4a[_0xf082('0x2a')][_0xf082('0x19')]);}_0x1c9bc8[_0xf082('0x30')]=qs['sort'](_0x44fc4a[_0xf082('0x2a')][_0xf082('0x31')]);_0x1c9bc8[_0xf082('0x32')]=qs[_0xf082('0x33')](_[_0xf082('0x34')](_0x44fc4a['query'],_0x1ffbab[_0xf082('0x33')]),_0x3cc64b);if(_0x44fc4a[_0xf082('0x2a')][_0xf082('0x35')]){_0x1c9bc8['where']=_[_0xf082('0x36')](_0x1c9bc8['where'],{'$or':_[_0xf082('0x27')](_0x3cc64b,function(_0x96afb3){if(_0x96afb3[_0xf082('0x37')]!==_0xf082('0x38')){var _0x10c3e7={};_0x10c3e7[_0x96afb3[_0xf082('0x25')]]={'$like':'%'+_0x44fc4a[_0xf082('0x2a')][_0xf082('0x35')]+'%'};return _0x10c3e7;}})});}_0x1c9bc8=_[_0xf082('0x36')]({},_0x1c9bc8,_0x44fc4a[_0xf082('0x39')]);var _0x3fa109={'where':_0x1c9bc8[_0xf082('0x32')]};return db[_0xf082('0x28')][_0xf082('0x1c')](_0x3fa109)['then'](function(_0xbdcf74){_0x1d0161[_0xf082('0x1c')]=_0xbdcf74;if(_0x44fc4a[_0xf082('0x2a')][_0xf082('0x3a')]){_0x1c9bc8[_0xf082('0x3b')]=[{'all':!![]}];}return db[_0xf082('0x28')][_0xf082('0x3c')](_0x1c9bc8);})[_0xf082('0x21')](function(_0x575e11){_0x1d0161[_0xf082('0x3d')]=_0x575e11;return _0x1d0161;})[_0xf082('0x21')](respondWithFilteredResult(_0x5e9ea3,_0x1c9bc8))[_0xf082('0x3e')](handleError(_0x5e9ea3,null));};exports['show']=function(_0x5d4772,_0x1088c8){var _0x2e4718={'raw':!![],'where':{'id':_0x5d4772['params']['id']}},_0x5e1647={};_0x5e1647[_0xf082('0x29')]=_[_0xf082('0x2b')](db[_0xf082('0x28')]['rawAttributes']);_0x5e1647['query']=_[_0xf082('0x2b')](_0x5d4772[_0xf082('0x2a')]);_0x5e1647['filters']=_[_0xf082('0x2d')](_0x5e1647['model'],_0x5e1647[_0xf082('0x2a')]);_0x2e4718[_0xf082('0x2c')]=_['intersection'](_0x5e1647[_0xf082('0x29')],qs[_0xf082('0x2e')](_0x5d4772['query'][_0xf082('0x2e')]));_0x2e4718['attributes']=_0x2e4718[_0xf082('0x2c')][_0xf082('0x3f')]?_0x2e4718[_0xf082('0x2c')]:_0x5e1647[_0xf082('0x29')];if(_0x5d4772[_0xf082('0x2a')][_0xf082('0x3a')]){_0x2e4718['include']=[{'all':!![]}];}_0x2e4718=_[_0xf082('0x36')]({},_0x2e4718,_0x5d4772[_0xf082('0x39')]);return db[_0xf082('0x28')][_0xf082('0x40')](_0x2e4718)[_0xf082('0x21')](handleEntityNotFound(_0x1088c8,null))[_0xf082('0x21')](respondWithResult(_0x1088c8,null))[_0xf082('0x3e')](handleError(_0x1088c8,null));};exports[_0xf082('0x41')]=function(_0x2ba576,_0x470877){return db[_0xf082('0x28')][_0xf082('0x41')](_0x2ba576[_0xf082('0x42')],{})[_0xf082('0x21')](respondWithResult(_0x470877,0xc9))[_0xf082('0x3e')](handleError(_0x470877,null));};exports[_0xf082('0x20')]=function(_0x3d2ce9,_0x1e630b){if(_0x3d2ce9[_0xf082('0x42')]['id']){delete _0x3d2ce9[_0xf082('0x42')]['id'];}return db['SmsQueueReport'][_0xf082('0x40')]({'where':{'id':_0x3d2ce9[_0xf082('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e630b,null))['then'](saveUpdates(_0x3d2ce9[_0xf082('0x42')],null))[_0xf082('0x21')](respondWithResult(_0x1e630b,null))['catch'](handleError(_0x1e630b,null));};exports['destroy']=function(_0x33322f,_0x51d52a){return db['SmsQueueReport'][_0xf082('0x40')]({'where':{'id':_0x33322f['params']['id']}})[_0xf082('0x21')](handleEntityNotFound(_0x51d52a,null))[_0xf082('0x21')](removeEntity(_0x51d52a,null))[_0xf082('0x3e')](handleError(_0x51d52a,null));};exports[_0xf082('0x44')]=function(_0x4c99a7,_0x30f655){return db[_0xf082('0x28')][_0xf082('0x44')]()['then'](respondWithResult(_0x30f655,null))[_0xf082('0x3e')](handleError(_0x30f655,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 0175e03..b6bae33 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x2fee0b,_0x43ab54){var _0x357d87=function(_0x3fbfb1){while(--_0x3fbfb1){_0x2fee0b['push'](_0x2fee0b['shift']());}};_0x357d87(++_0x43ab54);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 083f1c2..b1180fe 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 _0xfbef=['then','UpdateSmsQueueReport','update','raw','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateSmsQueueReport','create','body','options'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xfbef,0xc5));var _0xffbe=function(_0x6d099b,_0x3e388b){_0x6d099b=_0x6d099b-0x0;var _0x385c68=_0xfbef[_0x6d099b];return _0x385c68;};'use strict';var _=require(_0xffbe('0x0'));var util=require(_0xffbe('0x1'));var moment=require(_0xffbe('0x2'));var BPromise=require(_0xffbe('0x3'));var rs=require(_0xffbe('0x4'));var fs=require('fs');var Redis=require(_0xffbe('0x5'));var db=require(_0xffbe('0x6'))['db'];var utils=require(_0xffbe('0x7'));var logger=require('../../config/logger')(_0xffbe('0x8'));var config=require(_0xffbe('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xffbe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf4782e,_0x6b3a7b,_0x407c44){return new BPromise(function(_0x25417c,_0x4dced3){return client[_0xffbe('0xb')](_0xf4782e,_0x407c44)['then'](function(_0x15d43e){logger[_0xffbe('0xc')](_0xffbe('0xd'),_0x6b3a7b,'request\x20sent');logger[_0xffbe('0xe')](_0xffbe('0xf'),_0x6b3a7b,'request\x20sent',JSON[_0xffbe('0x10')](_0x15d43e));if(_0x15d43e[_0xffbe('0x11')]){if(_0x15d43e[_0xffbe('0x11')][_0xffbe('0x12')]===0x1f4){logger[_0xffbe('0x11')](_0xffbe('0xd'),_0x6b3a7b,_0x15d43e[_0xffbe('0x11')][_0xffbe('0x13')]);return _0x4dced3(_0x15d43e['error'][_0xffbe('0x13')]);}logger[_0xffbe('0x11')](_0xffbe('0xd'),_0x6b3a7b,_0x15d43e['error'][_0xffbe('0x13')]);return _0x25417c(_0x15d43e[_0xffbe('0x11')][_0xffbe('0x13')]);}else{logger[_0xffbe('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x6b3a7b,_0xffbe('0x14'));_0x25417c(_0x15d43e[_0xffbe('0x15')][_0xffbe('0x13')]);}})[_0xffbe('0x16')](function(_0x3f416b){logger[_0xffbe('0x11')](_0xffbe('0xd'),_0x6b3a7b,_0x3f416b);_0x4dced3(_0x3f416b);});});}exports[_0xffbe('0x17')]=function(_0x1992c5){var _0x340736=this;return new Promise(function(_0x5b709e,_0x56c72d){return db['SmsQueueReport'][_0xffbe('0x18')](_0x1992c5[_0xffbe('0x19')],{'raw':_0x1992c5[_0xffbe('0x1a')]?_0x1992c5[_0xffbe('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xffbe('0x1b')](function(_0x243c72){logger[_0xffbe('0xc')](_0xffbe('0x17'),_0x1992c5);logger[_0xffbe('0xe')](_0xffbe('0x17'),_0x1992c5,JSON[_0xffbe('0x10')](_0x243c72));_0x5b709e(_0x243c72);})[_0xffbe('0x16')](function(_0x1aa500){logger[_0xffbe('0x11')]('CreateSmsQueueReport',_0x1aa500[_0xffbe('0x13')],_0x1992c5);_0x56c72d(_0x340736[_0xffbe('0x11')](0x1f4,_0x1aa500['message']));});});};exports[_0xffbe('0x1c')]=function(_0x34f843){var _0x55b455=this;return new Promise(function(_0x425f33,_0x1585bf){return db['SmsQueueReport'][_0xffbe('0x1d')](_0x34f843['body'],{'raw':_0x34f843['options']?_0x34f843['options'][_0xffbe('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34f843[_0xffbe('0x1a')]?_0x34f843['options']['where']||null:null,'attributes':_0x34f843[_0xffbe('0x1a')]?_0x34f843[_0xffbe('0x1a')]['attributes']||null:null,'limit':_0x34f843[_0xffbe('0x1a')]?_0x34f843[_0xffbe('0x1a')][_0xffbe('0x1f')]||null:null})[_0xffbe('0x1b')](function(_0x5587c0){logger[_0xffbe('0xc')](_0xffbe('0x1c'),_0x34f843);logger[_0xffbe('0xe')](_0xffbe('0x1c'),_0x34f843,JSON[_0xffbe('0x10')](_0x5587c0));_0x425f33(_0x5587c0);})[_0xffbe('0x16')](function(_0x5300e3){logger[_0xffbe('0x11')](_0xffbe('0x1c'),_0x5300e3[_0xffbe('0x13')],_0x34f843);_0x1585bf(_0x55b455['error'](0x1f4,_0x5300e3[_0xffbe('0x13')]));});});}; \ No newline at end of file +var _0x6ef7=['jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x6ef7,0xe0));var _0x76ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ef7[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x76ef('0x0'));var moment=require(_0x76ef('0x1'));var BPromise=require(_0x76ef('0x2'));var rs=require(_0x76ef('0x3'));var fs=require('fs');var Redis=require(_0x76ef('0x4'));var db=require(_0x76ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x76ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x76ef('0x7'));var client=jayson[_0x76ef('0x8')][_0x76ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x416e13,_0x2624a3,_0xb2b2ab){return new BPromise(function(_0x3558d6,_0x18fccf){return client[_0x76ef('0xa')](_0x416e13,_0xb2b2ab)[_0x76ef('0xb')](function(_0x13896d){logger[_0x76ef('0xc')](_0x76ef('0xd'),_0x2624a3,_0x76ef('0xe'));logger[_0x76ef('0xf')](_0x76ef('0x10'),_0x2624a3,_0x76ef('0xe'),JSON[_0x76ef('0x11')](_0x13896d));if(_0x13896d[_0x76ef('0x12')]){if(_0x13896d[_0x76ef('0x12')][_0x76ef('0x13')]===0x1f4){logger[_0x76ef('0x12')](_0x76ef('0xd'),_0x2624a3,_0x13896d[_0x76ef('0x12')][_0x76ef('0x14')]);return _0x18fccf(_0x13896d[_0x76ef('0x12')]['message']);}logger[_0x76ef('0x12')](_0x76ef('0xd'),_0x2624a3,_0x13896d[_0x76ef('0x12')][_0x76ef('0x14')]);return _0x3558d6(_0x13896d['error'][_0x76ef('0x14')]);}else{logger['info'](_0x76ef('0xd'),_0x2624a3,_0x76ef('0xe'));_0x3558d6(_0x13896d[_0x76ef('0x15')][_0x76ef('0x14')]);}})[_0x76ef('0x16')](function(_0x492086){logger[_0x76ef('0x12')](_0x76ef('0xd'),_0x2624a3,_0x492086);_0x18fccf(_0x492086);});});}exports[_0x76ef('0x17')]=function(_0x4172b2){var _0x1e8ee4=this;return new Promise(function(_0x3cbc09,_0x27ceff){return db[_0x76ef('0x18')][_0x76ef('0x19')](_0x4172b2['body'],{'raw':_0x4172b2[_0x76ef('0x1a')]?_0x4172b2[_0x76ef('0x1a')][_0x76ef('0x1b')]===undefined?!![]:![]:!![]})[_0x76ef('0xb')](function(_0x3b6359){logger['info'](_0x76ef('0x17'),_0x4172b2);logger['debug'](_0x76ef('0x17'),_0x4172b2,JSON[_0x76ef('0x11')](_0x3b6359));_0x3cbc09(_0x3b6359);})[_0x76ef('0x16')](function(_0x344fb3){logger['error']('CreateSmsQueueReport',_0x344fb3[_0x76ef('0x14')],_0x4172b2);_0x27ceff(_0x1e8ee4[_0x76ef('0x12')](0x1f4,_0x344fb3[_0x76ef('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x41e376){var _0x20e481=this;return new Promise(function(_0x29dc9b,_0x56b659){return db['SmsQueueReport'][_0x76ef('0x1c')](_0x41e376['body'],{'raw':_0x41e376[_0x76ef('0x1a')]?_0x41e376[_0x76ef('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e376[_0x76ef('0x1a')]?_0x41e376[_0x76ef('0x1a')][_0x76ef('0x1d')]||null:null,'attributes':_0x41e376[_0x76ef('0x1a')]?_0x41e376['options'][_0x76ef('0x1e')]||null:null,'limit':_0x41e376[_0x76ef('0x1a')]?_0x41e376[_0x76ef('0x1a')][_0x76ef('0x1f')]||null:null})[_0x76ef('0xb')](function(_0x42124c){logger['info'](_0x76ef('0x20'),_0x41e376);logger[_0x76ef('0xf')](_0x76ef('0x20'),_0x41e376,JSON[_0x76ef('0x11')](_0x42124c));_0x29dc9b(_0x42124c);})['catch'](function(_0x2d6626){logger[_0x76ef('0x12')](_0x76ef('0x20'),_0x2d6626[_0x76ef('0x14')],_0x41e376);_0x56b659(_0x20e481[_0x76ef('0x12')](0x1f4,_0x2d6626[_0x76ef('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index eeef53f..e12ba5f 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 _0x9c5a=['fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','isAuthenticated','show','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x51d9f9,_0x1415bf){_0x51d9f9=_0x51d9f9-0x0;var _0x4bafb9=_0x9c5a[_0x51d9f9];return _0x4bafb9;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./smsTransferReport.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['post']('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xd')]);router['put']('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0xf')](_0xa9c5('0x10'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);module[_0xa9c5('0x12')]=router; \ No newline at end of file +var _0x5075=['get','isAuthenticated','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index'];(function(_0xcd9668,_0x376ccd){var _0x488dc4=function(_0x24f7a6){while(--_0x24f7a6){_0xcd9668['push'](_0xcd9668['shift']());}};_0x488dc4(++_0x376ccd);}(_0x5075,0x73));var _0x5507=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x5075[_0x1df7b8];return _0x29d911;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5507('0xa')]);router[_0x5507('0xb')]('/describe',auth[_0x5507('0xc')](),controller[_0x5507('0xd')]);router[_0x5507('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')]('/',auth[_0x5507('0xc')](),controller[_0x5507('0x10')]);router['put'](_0x5507('0x11'),auth[_0x5507('0xc')](),controller['update']);router[_0x5507('0x12')](_0x5507('0x11'),auth['isAuthenticated'](),controller[_0x5507('0x13')]);module[_0x5507('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f766bf6..3c9d09a 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xbaa79f,_0x4d59e9){var _0x33fbdc=function(_0x44cb54){while(--_0x44cb54){_0xbaa79f['push'](_0xbaa79f['shift']());}};_0x33fbdc(++_0x4d59e9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x55e839,_0x3b5345){_0x55e839=_0x55e839-0x0;var _0x39c61a=_0xf3cd[_0x55e839];return _0x39c61a;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4aa7cd,_0x2ee3c1){var _0x84be32=function(_0x10b2e7){while(--_0x10b2e7){_0x4aa7cd['push'](_0x4aa7cd['shift']());}};_0x84be32(++_0x2ee3c1);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 60c6074..4f0d9a3 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 _0xadd6=['SmsTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','merge','body','find','describe','eml-format','rimraf','zip-dir','request-promise','util','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map'];(function(_0x13b80d,_0xeaca9f){var _0x495ca2=function(_0x1cd7ca){while(--_0x1cd7ca){_0x13b80d['push'](_0x13b80d['shift']());}};_0x495ca2(++_0xeaca9f);}(_0xadd6,0x103));var _0x6add=function(_0x50d8ab,_0x31dbf2){_0x50d8ab=_0x50d8ab-0x0;var _0x1c76d2=_0xadd6[_0x50d8ab];return _0x1c76d2;};'use strict';var emlformat=require(_0x6add('0x0'));var rimraf=require(_0x6add('0x1'));var zipdir=require(_0x6add('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6add('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6add('0x4'));var path=require(_0x6add('0x5'));var sox=require(_0x6add('0x6'));var csv=require(_0x6add('0x7'));var ejs=require(_0x6add('0x8'));var fs=require('fs');var fs_extra=require(_0x6add('0x9'));var _=require(_0x6add('0xa'));var squel=require(_0x6add('0xb'));var crypto=require(_0x6add('0xc'));var jsforce=require(_0x6add('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6add('0x7'));var querystring=require(_0x6add('0xe'));var Papa=require(_0x6add('0xf'));var Redis=require('ioredis');var authService=require(_0x6add('0x10'));var qs=require(_0x6add('0x11'));var as=require(_0x6add('0x12'));var hardwareService=require(_0x6add('0x13'));var logger=require(_0x6add('0x14'))(_0x6add('0x15'));var utils=require(_0x6add('0x16'));var config=require(_0x6add('0x17'));var licenseUtil=require(_0x6add('0x18'));var db=require(_0x6add('0x19'))['db'];function respondWithStatusCode(_0x5f2d97,_0x164236){_0x164236=_0x164236||0xcc;return function(_0x19c3f0){if(_0x19c3f0){return _0x5f2d97[_0x6add('0x1a')](_0x164236);}return _0x5f2d97[_0x6add('0x1b')](_0x164236)['end']();};}function respondWithResult(_0x172df2,_0x434f7a){_0x434f7a=_0x434f7a||0xc8;return function(_0x478cc4){if(_0x478cc4){return _0x172df2['status'](_0x434f7a)[_0x6add('0x1c')](_0x478cc4);}};}function respondWithFilteredResult(_0x75582f,_0x562cf7){return function(_0x15be39){if(_0x15be39){var _0x194141=typeof _0x562cf7['offset']===_0x6add('0x1d')&&typeof _0x562cf7['limit']===_0x6add('0x1d');var _0x13c732=_0x15be39['count'];var _0x332b04=_0x194141?0x0:_0x562cf7[_0x6add('0x1e')];var _0x436be7=_0x194141?_0x15be39[_0x6add('0x1f')]:_0x562cf7[_0x6add('0x1e')]+_0x562cf7['limit'];var _0x45d9e6;if(_0x436be7>=_0x13c732){_0x436be7=_0x13c732;_0x45d9e6=0xc8;}else{_0x45d9e6=0xce;}_0x75582f[_0x6add('0x1b')](_0x45d9e6);return _0x75582f[_0x6add('0x20')](_0x6add('0x21'),_0x332b04+'-'+_0x436be7+'/'+_0x13c732)[_0x6add('0x1c')](_0x15be39);}return null;};}function patchUpdates(_0x2dfb85){return function(_0x4c8769){try{jsonpatch[_0x6add('0x22')](_0x4c8769,_0x2dfb85,!![]);}catch(_0x9496ce){return BPromise[_0x6add('0x23')](_0x9496ce);}return _0x4c8769[_0x6add('0x24')]();};}function saveUpdates(_0x7474da,_0x4a2e90){return function(_0x3ebdbc){if(_0x3ebdbc){return _0x3ebdbc['update'](_0x7474da)[_0x6add('0x25')](function(_0x2c393a){return _0x2c393a;});}return null;};}function removeEntity(_0x2c3d9c,_0x5cace1){return function(_0x1acf63){if(_0x1acf63){return _0x1acf63[_0x6add('0x26')]()[_0x6add('0x25')](function(){_0x2c3d9c[_0x6add('0x1b')](0xcc)[_0x6add('0x27')]();});}};}function handleEntityNotFound(_0x16a9bb,_0x3ef05b){return function(_0x267b34){if(!_0x267b34){_0x16a9bb['sendStatus'](0x194);}return _0x267b34;};}function handleError(_0x2c07ac,_0x3fd40a){_0x3fd40a=_0x3fd40a||0x1f4;return function(_0x59c355){logger[_0x6add('0x28')](_0x59c355['stack']);if(_0x59c355[_0x6add('0x29')]){delete _0x59c355[_0x6add('0x29')];}_0x2c07ac[_0x6add('0x1b')](_0x3fd40a)[_0x6add('0x2a')](_0x59c355);};}exports[_0x6add('0x2b')]=function(_0x4ddf09,_0x2c94b1){var _0x547f5d={},_0x4a2e51={},_0x478a72={'count':0x0,'rows':[]};var _0x21472d=_[_0x6add('0x2c')](db[_0x6add('0x2d')][_0x6add('0x2e')],function(_0x43457e){return{'name':_0x43457e[_0x6add('0x2f')],'type':_0x43457e[_0x6add('0x30')]['key']};});_0x4a2e51[_0x6add('0x31')]=_[_0x6add('0x2c')](_0x21472d,_0x6add('0x29'));_0x4a2e51[_0x6add('0x32')]=_[_0x6add('0x33')](_0x4ddf09[_0x6add('0x32')]);_0x4a2e51['filters']=_[_0x6add('0x34')](_0x4a2e51[_0x6add('0x31')],_0x4a2e51[_0x6add('0x32')]);_0x547f5d[_0x6add('0x35')]=_[_0x6add('0x34')](_0x4a2e51[_0x6add('0x31')],qs[_0x6add('0x36')](_0x4ddf09[_0x6add('0x32')][_0x6add('0x36')]));_0x547f5d['attributes']=_0x547f5d[_0x6add('0x35')][_0x6add('0x37')]?_0x547f5d[_0x6add('0x35')]:_0x4a2e51[_0x6add('0x31')];if(!_0x4ddf09['query'][_0x6add('0x38')](_0x6add('0x39'))){_0x547f5d[_0x6add('0x3a')]=qs['limit'](_0x4ddf09[_0x6add('0x32')][_0x6add('0x3a')]);_0x547f5d[_0x6add('0x1e')]=qs[_0x6add('0x1e')](_0x4ddf09[_0x6add('0x32')][_0x6add('0x1e')]);}_0x547f5d[_0x6add('0x3b')]=qs['sort'](_0x4ddf09[_0x6add('0x32')][_0x6add('0x3c')]);_0x547f5d[_0x6add('0x3d')]=qs[_0x6add('0x3e')](_[_0x6add('0x3f')](_0x4ddf09[_0x6add('0x32')],_0x4a2e51[_0x6add('0x3e')]),_0x21472d);if(_0x4ddf09[_0x6add('0x32')]['filter']){_0x547f5d[_0x6add('0x3d')]=_['merge'](_0x547f5d[_0x6add('0x3d')],{'$or':_['map'](_0x21472d,function(_0x7a8893){if(_0x7a8893[_0x6add('0x30')]!==_0x6add('0x40')){var _0x3ed23c={};_0x3ed23c[_0x7a8893[_0x6add('0x29')]]={'$like':'%'+_0x4ddf09[_0x6add('0x32')][_0x6add('0x41')]+'%'};return _0x3ed23c;}})});}_0x547f5d=_['merge']({},_0x547f5d,_0x4ddf09[_0x6add('0x42')]);var _0x12bb6b={'where':_0x547f5d['where']};return db[_0x6add('0x2d')]['count'](_0x12bb6b)[_0x6add('0x25')](function(_0x4019a4){_0x478a72[_0x6add('0x1f')]=_0x4019a4;if(_0x4ddf09[_0x6add('0x32')][_0x6add('0x43')]){_0x547f5d['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x6add('0x44')](_0x547f5d);})[_0x6add('0x25')](function(_0x42ce8f){_0x478a72[_0x6add('0x45')]=_0x42ce8f;return _0x478a72;})[_0x6add('0x25')](respondWithFilteredResult(_0x2c94b1,_0x547f5d))[_0x6add('0x46')](handleError(_0x2c94b1,null));};exports['show']=function(_0x4f8287,_0x56ed28){var _0x3e2473={'raw':!![],'where':{'id':_0x4f8287[_0x6add('0x47')]['id']}},_0x550816={};_0x550816[_0x6add('0x31')]=_['keys'](db[_0x6add('0x2d')]['rawAttributes']);_0x550816[_0x6add('0x32')]=_[_0x6add('0x33')](_0x4f8287['query']);_0x550816[_0x6add('0x3e')]=_[_0x6add('0x34')](_0x550816['model'],_0x550816[_0x6add('0x32')]);_0x3e2473['attributes']=_['intersection'](_0x550816[_0x6add('0x31')],qs[_0x6add('0x36')](_0x4f8287['query'][_0x6add('0x36')]));_0x3e2473['attributes']=_0x3e2473['attributes']['length']?_0x3e2473[_0x6add('0x35')]:_0x550816['model'];if(_0x4f8287['query']['includeAll']){_0x3e2473['include']=[{'all':!![]}];}_0x3e2473=_[_0x6add('0x48')]({},_0x3e2473,_0x4f8287['options']);return db[_0x6add('0x2d')]['find'](_0x3e2473)[_0x6add('0x25')](handleEntityNotFound(_0x56ed28,null))['then'](respondWithResult(_0x56ed28,null))[_0x6add('0x46')](handleError(_0x56ed28,null));};exports['create']=function(_0x3be699,_0x36e0d2){return db[_0x6add('0x2d')]['create'](_0x3be699[_0x6add('0x49')],{})[_0x6add('0x25')](respondWithResult(_0x36e0d2,0xc9))['catch'](handleError(_0x36e0d2,null));};exports['update']=function(_0x38f50b,_0x41f786){if(_0x38f50b['body']['id']){delete _0x38f50b[_0x6add('0x49')]['id'];}return db[_0x6add('0x2d')]['find']({'where':{'id':_0x38f50b[_0x6add('0x47')]['id']}})[_0x6add('0x25')](handleEntityNotFound(_0x41f786,null))[_0x6add('0x25')](saveUpdates(_0x38f50b[_0x6add('0x49')],null))[_0x6add('0x25')](respondWithResult(_0x41f786,null))[_0x6add('0x46')](handleError(_0x41f786,null));};exports[_0x6add('0x26')]=function(_0xf3ef45,_0x3e887d){return db[_0x6add('0x2d')][_0x6add('0x4a')]({'where':{'id':_0xf3ef45['params']['id']}})['then'](handleEntityNotFound(_0x3e887d,null))['then'](removeEntity(_0x3e887d,null))[_0x6add('0x46')](handleError(_0x3e887d,null));};exports[_0x6add('0x4b')]=function(_0x23b429,_0xc4659f){return db[_0x6add('0x2d')][_0x6add('0x4b')]()[_0x6add('0x25')](respondWithResult(_0xc4659f,null))['catch'](handleError(_0xc4659f,null));}; \ No newline at end of file +var _0xc32f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe'];(function(_0x45ef66,_0x3f609e){var _0x3847cf=function(_0x4875e5){while(--_0x4875e5){_0x45ef66['push'](_0x45ef66['shift']());}};_0x3847cf(++_0x3f609e);}(_0xc32f,0xed));var _0xfc32=function(_0x3f67ab,_0x5a843c){_0x3f67ab=_0x3f67ab-0x0;var _0x13d5ae=_0xc32f[_0x3f67ab];return _0x13d5ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc32('0x0'));var zipdir=require(_0xfc32('0x1'));var jsonpatch=require(_0xfc32('0x2'));var rp=require(_0xfc32('0x3'));var moment=require(_0xfc32('0x4'));var BPromise=require(_0xfc32('0x5'));var Mustache=require(_0xfc32('0x6'));var util=require(_0xfc32('0x7'));var path=require(_0xfc32('0x8'));var sox=require(_0xfc32('0x9'));var csv=require(_0xfc32('0xa'));var ejs=require(_0xfc32('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfc32('0xc'));var crypto=require(_0xfc32('0xd'));var jsforce=require(_0xfc32('0xe'));var deskjs=require(_0xfc32('0xf'));var toCsv=require(_0xfc32('0xa'));var querystring=require(_0xfc32('0x10'));var Papa=require(_0xfc32('0x11'));var Redis=require(_0xfc32('0x12'));var authService=require(_0xfc32('0x13'));var qs=require(_0xfc32('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc32('0x15'))('api');var utils=require(_0xfc32('0x16'));var config=require(_0xfc32('0x17'));var licenseUtil=require(_0xfc32('0x18'));var db=require(_0xfc32('0x19'))['db'];function respondWithStatusCode(_0x4f5df2,_0x5c1a0f){_0x5c1a0f=_0x5c1a0f||0xcc;return function(_0x194cb2){if(_0x194cb2){return _0x4f5df2[_0xfc32('0x1a')](_0x5c1a0f);}return _0x4f5df2[_0xfc32('0x1b')](_0x5c1a0f)[_0xfc32('0x1c')]();};}function respondWithResult(_0x3693e6,_0x21c398){_0x21c398=_0x21c398||0xc8;return function(_0x98498e){if(_0x98498e){return _0x3693e6[_0xfc32('0x1b')](_0x21c398)[_0xfc32('0x1d')](_0x98498e);}};}function respondWithFilteredResult(_0x4d1220,_0x4325ec){return function(_0x277e0e){if(_0x277e0e){var _0x67c3bc=typeof _0x4325ec[_0xfc32('0x1e')]==='undefined'&&typeof _0x4325ec['limit']===_0xfc32('0x1f');var _0xeafc07=_0x277e0e['count'];var _0xe863ff=_0x67c3bc?0x0:_0x4325ec[_0xfc32('0x1e')];var _0x3a1965=_0x67c3bc?_0x277e0e[_0xfc32('0x20')]:_0x4325ec['offset']+_0x4325ec[_0xfc32('0x21')];var _0x4bbeef;if(_0x3a1965>=_0xeafc07){_0x3a1965=_0xeafc07;_0x4bbeef=0xc8;}else{_0x4bbeef=0xce;}_0x4d1220['status'](_0x4bbeef);return _0x4d1220[_0xfc32('0x22')](_0xfc32('0x23'),_0xe863ff+'-'+_0x3a1965+'/'+_0xeafc07)['json'](_0x277e0e);}return null;};}function patchUpdates(_0x2ca882){return function(_0x2c1bb6){try{jsonpatch[_0xfc32('0x24')](_0x2c1bb6,_0x2ca882,!![]);}catch(_0x1623f5){return BPromise[_0xfc32('0x25')](_0x1623f5);}return _0x2c1bb6[_0xfc32('0x26')]();};}function saveUpdates(_0x3f9749,_0xfcd1c9){return function(_0x2f6183){if(_0x2f6183){return _0x2f6183[_0xfc32('0x27')](_0x3f9749)[_0xfc32('0x28')](function(_0x2ff5f9){return _0x2ff5f9;});}return null;};}function removeEntity(_0x644122,_0x218787){return function(_0x1d6c5a){if(_0x1d6c5a){return _0x1d6c5a[_0xfc32('0x29')]()[_0xfc32('0x28')](function(){_0x644122[_0xfc32('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x287477,_0x450ffa){return function(_0x2f18ec){if(!_0x2f18ec){_0x287477[_0xfc32('0x1a')](0x194);}return _0x2f18ec;};}function handleError(_0x422f23,_0x407b9d){_0x407b9d=_0x407b9d||0x1f4;return function(_0x63dc2d){logger[_0xfc32('0x2a')](_0x63dc2d[_0xfc32('0x2b')]);if(_0x63dc2d[_0xfc32('0x2c')]){delete _0x63dc2d[_0xfc32('0x2c')];}_0x422f23[_0xfc32('0x1b')](_0x407b9d)['send'](_0x63dc2d);};}exports[_0xfc32('0x2d')]=function(_0x350b7d,_0x13d265){var _0x1701cc={},_0x13c92a={},_0x248c18={'count':0x0,'rows':[]};var _0x1d351f=_[_0xfc32('0x2e')](db['SmsTransferReport'][_0xfc32('0x2f')],function(_0x5e448b){return{'name':_0x5e448b[_0xfc32('0x30')],'type':_0x5e448b[_0xfc32('0x31')]['key']};});_0x13c92a[_0xfc32('0x32')]=_[_0xfc32('0x2e')](_0x1d351f,_0xfc32('0x2c'));_0x13c92a[_0xfc32('0x33')]=_[_0xfc32('0x34')](_0x350b7d['query']);_0x13c92a['filters']=_['intersection'](_0x13c92a[_0xfc32('0x32')],_0x13c92a[_0xfc32('0x33')]);_0x1701cc['attributes']=_[_0xfc32('0x35')](_0x13c92a['model'],qs['fields'](_0x350b7d[_0xfc32('0x33')][_0xfc32('0x36')]));_0x1701cc[_0xfc32('0x37')]=_0x1701cc[_0xfc32('0x37')][_0xfc32('0x38')]?_0x1701cc[_0xfc32('0x37')]:_0x13c92a[_0xfc32('0x32')];if(!_0x350b7d['query'][_0xfc32('0x39')](_0xfc32('0x3a'))){_0x1701cc[_0xfc32('0x21')]=qs['limit'](_0x350b7d[_0xfc32('0x33')][_0xfc32('0x21')]);_0x1701cc['offset']=qs['offset'](_0x350b7d[_0xfc32('0x33')][_0xfc32('0x1e')]);}_0x1701cc[_0xfc32('0x3b')]=qs[_0xfc32('0x3c')](_0x350b7d[_0xfc32('0x33')][_0xfc32('0x3c')]);_0x1701cc[_0xfc32('0x3d')]=qs['filters'](_['pick'](_0x350b7d[_0xfc32('0x33')],_0x13c92a[_0xfc32('0x3e')]),_0x1d351f);if(_0x350b7d[_0xfc32('0x33')][_0xfc32('0x3f')]){_0x1701cc[_0xfc32('0x3d')]=_[_0xfc32('0x40')](_0x1701cc[_0xfc32('0x3d')],{'$or':_['map'](_0x1d351f,function(_0x19ad85){if(_0x19ad85[_0xfc32('0x31')]!==_0xfc32('0x41')){var _0x479e01={};_0x479e01[_0x19ad85[_0xfc32('0x2c')]]={'$like':'%'+_0x350b7d[_0xfc32('0x33')][_0xfc32('0x3f')]+'%'};return _0x479e01;}})});}_0x1701cc=_[_0xfc32('0x40')]({},_0x1701cc,_0x350b7d[_0xfc32('0x42')]);var _0x4d6c24={'where':_0x1701cc[_0xfc32('0x3d')]};return db[_0xfc32('0x43')][_0xfc32('0x20')](_0x4d6c24)[_0xfc32('0x28')](function(_0x23ae74){_0x248c18[_0xfc32('0x20')]=_0x23ae74;if(_0x350b7d[_0xfc32('0x33')][_0xfc32('0x44')]){_0x1701cc[_0xfc32('0x45')]=[{'all':!![]}];}return db[_0xfc32('0x43')][_0xfc32('0x46')](_0x1701cc);})[_0xfc32('0x28')](function(_0x5e7c8e){_0x248c18[_0xfc32('0x47')]=_0x5e7c8e;return _0x248c18;})[_0xfc32('0x28')](respondWithFilteredResult(_0x13d265,_0x1701cc))[_0xfc32('0x48')](handleError(_0x13d265,null));};exports[_0xfc32('0x49')]=function(_0x2a144c,_0x493cd6){var _0x5ca32={'raw':!![],'where':{'id':_0x2a144c[_0xfc32('0x4a')]['id']}},_0x4b112d={};_0x4b112d[_0xfc32('0x32')]=_['keys'](db['SmsTransferReport'][_0xfc32('0x2f')]);_0x4b112d[_0xfc32('0x33')]=_[_0xfc32('0x34')](_0x2a144c[_0xfc32('0x33')]);_0x4b112d[_0xfc32('0x3e')]=_[_0xfc32('0x35')](_0x4b112d[_0xfc32('0x32')],_0x4b112d['query']);_0x5ca32[_0xfc32('0x37')]=_[_0xfc32('0x35')](_0x4b112d[_0xfc32('0x32')],qs['fields'](_0x2a144c[_0xfc32('0x33')]['fields']));_0x5ca32[_0xfc32('0x37')]=_0x5ca32[_0xfc32('0x37')][_0xfc32('0x38')]?_0x5ca32[_0xfc32('0x37')]:_0x4b112d[_0xfc32('0x32')];if(_0x2a144c[_0xfc32('0x33')]['includeAll']){_0x5ca32[_0xfc32('0x45')]=[{'all':!![]}];}_0x5ca32=_['merge']({},_0x5ca32,_0x2a144c[_0xfc32('0x42')]);return db['SmsTransferReport'][_0xfc32('0x4b')](_0x5ca32)[_0xfc32('0x28')](handleEntityNotFound(_0x493cd6,null))[_0xfc32('0x28')](respondWithResult(_0x493cd6,null))[_0xfc32('0x48')](handleError(_0x493cd6,null));};exports[_0xfc32('0x4c')]=function(_0x38092b,_0x5938ea){return db['SmsTransferReport'][_0xfc32('0x4c')](_0x38092b[_0xfc32('0x4d')],{})[_0xfc32('0x28')](respondWithResult(_0x5938ea,0xc9))[_0xfc32('0x48')](handleError(_0x5938ea,null));};exports[_0xfc32('0x27')]=function(_0x455a2b,_0x21d629){if(_0x455a2b[_0xfc32('0x4d')]['id']){delete _0x455a2b[_0xfc32('0x4d')]['id'];}return db[_0xfc32('0x43')][_0xfc32('0x4b')]({'where':{'id':_0x455a2b[_0xfc32('0x4a')]['id']}})[_0xfc32('0x28')](handleEntityNotFound(_0x21d629,null))[_0xfc32('0x28')](saveUpdates(_0x455a2b[_0xfc32('0x4d')],null))[_0xfc32('0x28')](respondWithResult(_0x21d629,null))[_0xfc32('0x48')](handleError(_0x21d629,null));};exports[_0xfc32('0x29')]=function(_0x1981d2,_0x3b22c1){return db[_0xfc32('0x43')]['find']({'where':{'id':_0x1981d2[_0xfc32('0x4a')]['id']}})[_0xfc32('0x28')](handleEntityNotFound(_0x3b22c1,null))['then'](removeEntity(_0x3b22c1,null))['catch'](handleError(_0x3b22c1,null));};exports[_0xfc32('0x4e')]=function(_0xd568cb,_0x27a02b){return db[_0xfc32('0x43')][_0xfc32('0x4e')]()['then'](respondWithResult(_0x27a02b,null))[_0xfc32('0x48')](handleError(_0x27a02b,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 2339d43..5401ace 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 _0x5294=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','report_sms_transfer','uniqueid'];(function(_0xb67faa,_0x3bc17b){var _0x14effc=function(_0x1792c6){while(--_0x1792c6){_0xb67faa['push'](_0xb67faa['shift']());}};_0x14effc(++_0x3bc17b);}(_0x5294,0x111));var _0x4529=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x5294[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var logger=require(_0x4529('0x2'))(_0x4529('0x3'));var moment=require(_0x4529('0x4'));var BPromise=require(_0x4529('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4529('0x6'));var rimraf=require(_0x4529('0x7'));var config=require(_0x4529('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0x4529('0x9')]=function(_0x2c78e9,_0x10192d){return _0x2c78e9[_0x4529('0xa')]('SmsTransferReport',attributes,{'tableName':_0x4529('0xb'),'paranoid':![],'indexes':[{'name':_0x4529('0xc'),'fields':[_0x4529('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79c6=['moment','bluebird','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api'];(function(_0x4fef08,_0x4c98c7){var _0x1bde5d=function(_0x192d56){while(--_0x192d56){_0x4fef08['push'](_0x4fef08['shift']());}};_0x1bde5d(++_0x4c98c7);}(_0x79c6,0x81));var _0x679c=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x79c6[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x679c('0x0'));var util=require('util');var logger=require(_0x679c('0x1'))(_0x679c('0x2'));var moment=require(_0x679c('0x3'));var BPromise=require(_0x679c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x679c('0x5'));var config=require(_0x679c('0x6'));var attributes=require(_0x679c('0x7'));module[_0x679c('0x8')]=function(_0x2d8a16,_0x1969be){return _0x2d8a16[_0x679c('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x679c('0xa'),'fields':[_0x679c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8a02b85..87a604f 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 _0xff2a=['request\x20sent','stringify','error','message','info','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x837006,_0x326159){var _0x4cf513=function(_0x2ac68e){while(--_0x2ac68e){_0x837006['push'](_0x837006['shift']());}};_0x4cf513(++_0x326159);}(_0xff2a,0x93));var _0xaff2=function(_0x33c090,_0x184b69){_0x33c090=_0x33c090-0x0;var _0x4081df=_0xff2a[_0x33c090];return _0x4081df;};'use strict';var _=require('lodash');var util=require(_0xaff2('0x0'));var moment=require(_0xaff2('0x1'));var BPromise=require('bluebird');var rs=require(_0xaff2('0x2'));var fs=require('fs');var Redis=require(_0xaff2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaff2('0x4'));var logger=require('../../config/logger')(_0xaff2('0x5'));var config=require(_0xaff2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaff2('0x7')][_0xaff2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e4f44,_0x3498b7,_0x33229b){return new BPromise(function(_0x1125e,_0xe0d6d3){return client[_0xaff2('0x9')](_0x2e4f44,_0x33229b)[_0xaff2('0xa')](function(_0x3ecb3f){logger['info'](_0xaff2('0xb'),_0x3498b7,'request\x20sent');logger['debug'](_0xaff2('0xc'),_0x3498b7,_0xaff2('0xd'),JSON[_0xaff2('0xe')](_0x3ecb3f));if(_0x3ecb3f[_0xaff2('0xf')]){if(_0x3ecb3f[_0xaff2('0xf')]['code']===0x1f4){logger[_0xaff2('0xf')](_0xaff2('0xb'),_0x3498b7,_0x3ecb3f[_0xaff2('0xf')]['message']);return _0xe0d6d3(_0x3ecb3f[_0xaff2('0xf')][_0xaff2('0x10')]);}logger['error'](_0xaff2('0xb'),_0x3498b7,_0x3ecb3f['error'][_0xaff2('0x10')]);return _0x1125e(_0x3ecb3f['error']['message']);}else{logger[_0xaff2('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x3498b7,_0xaff2('0xd'));_0x1125e(_0x3ecb3f[_0xaff2('0x12')][_0xaff2('0x10')]);}})[_0xaff2('0x13')](function(_0x1bb23f){logger['error'](_0xaff2('0xb'),_0x3498b7,_0x1bb23f);_0xe0d6d3(_0x1bb23f);});});} \ No newline at end of file +var _0x0ef0=['code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2580f4,_0x2016b5){var _0x5a8838=function(_0x5b72bc){while(--_0x5b72bc){_0x2580f4['push'](_0x2580f4['shift']());}};_0x5a8838(++_0x2016b5);}(_0x0ef0,0x80));var _0x00ef=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x0ef0[_0x44039a];return _0x525de5;};'use strict';var _=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var moment=require('moment');var BPromise=require(_0x00ef('0x2'));var rs=require(_0x00ef('0x3'));var fs=require('fs');var Redis=require(_0x00ef('0x4'));var db=require(_0x00ef('0x5'))['db'];var utils=require(_0x00ef('0x6'));var logger=require(_0x00ef('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x00ef('0x8'));var client=jayson[_0x00ef('0x9')][_0x00ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19321c,_0x50cbde,_0x303c49){return new BPromise(function(_0x3dd5cd,_0x2ee1a6){return client[_0x00ef('0xb')](_0x19321c,_0x303c49)[_0x00ef('0xc')](function(_0x4984c2){logger[_0x00ef('0xd')](_0x00ef('0xe'),_0x50cbde,_0x00ef('0xf'));logger['debug'](_0x00ef('0x10'),_0x50cbde,'request\x20sent',JSON[_0x00ef('0x11')](_0x4984c2));if(_0x4984c2[_0x00ef('0x12')]){if(_0x4984c2[_0x00ef('0x12')][_0x00ef('0x13')]===0x1f4){logger[_0x00ef('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x50cbde,_0x4984c2[_0x00ef('0x12')]['message']);return _0x2ee1a6(_0x4984c2[_0x00ef('0x12')][_0x00ef('0x14')]);}logger[_0x00ef('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x50cbde,_0x4984c2[_0x00ef('0x12')]['message']);return _0x3dd5cd(_0x4984c2['error'][_0x00ef('0x14')]);}else{logger[_0x00ef('0xd')](_0x00ef('0xe'),_0x50cbde,_0x00ef('0xf'));_0x3dd5cd(_0x4984c2['result'][_0x00ef('0x14')]);}})['catch'](function(_0xbd149a){logger[_0x00ef('0x12')](_0x00ef('0xe'),_0x50cbde,_0xbd149a);_0x2ee1a6(_0xbd149a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 8a4a424..66c073a 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 _0xf120=['format','%s-%s%s','extname','now','post','single','file','put','update','delete','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace'];(function(_0x1fede3,_0x5e506e){var _0x4b2b2c=function(_0x216ccb){while(--_0x216ccb){_0x1fede3['push'](_0x1fede3['shift']());}};_0x4b2b2c(++_0x5e506e);}(_0xf120,0xb3));var _0x0f12=function(_0x460c4e,_0x1fa04b){_0x460c4e=_0x460c4e-0x0;var _0x3a23a0=_0xf120[_0x460c4e];return _0x3a23a0;};'use strict';var multer=require(_0x0f12('0x0'));var util=require('util');var path=require(_0x0f12('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0f12('0x2')]();var fs_extra=require(_0x0f12('0x3'));var auth=require(_0x0f12('0x4'));var interaction=require(_0x0f12('0x5'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x0f12('0x6')]('/',auth[_0x0f12('0x7')](),controller[_0x0f12('0x8')]);router[_0x0f12('0x6')](_0x0f12('0x9'),auth[_0x0f12('0x7')](),controller['show']);router[_0x0f12('0x6')](_0x0f12('0xa'),auth[_0x0f12('0x7')](),controller[_0x0f12('0xb')]);var upload=multer({'storage':multer[_0x0f12('0xc')]({'destination':function(_0x840df9,_0x2a7f34,_0x2ad856){_0x2ad856(null,path[_0x0f12('0xd')](config['root'],_0x0f12('0xe')));},'filename':function(_0x130542,_0x26961d,_0xea3ffb){_0x26961d[_0x0f12('0xf')]=_0x26961d[_0x0f12('0xf')][_0x0f12('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xea3ffb(null,util[_0x0f12('0x11')](_0x0f12('0x12'),path['basename'](_0x26961d[_0x0f12('0xf')],path[_0x0f12('0x13')](_0x26961d[_0x0f12('0xf')])),Date[_0x0f12('0x14')](),path['extname'](_0x26961d['originalname'])));}})});router[_0x0f12('0x15')]('/',upload[_0x0f12('0x16')](_0x0f12('0x17')),controller['create']);router[_0x0f12('0x18')](_0x0f12('0x9'),auth[_0x0f12('0x7')](),controller[_0x0f12('0x19')]);router[_0x0f12('0x1a')](_0x0f12('0x9'),auth[_0x0f12('0x7')](),controller[_0x0f12('0x1a')]);module[_0x0f12('0x1b')]=router; \ No newline at end of file +var _0x91df=['originalname','replace','format','basename','now','post','single','file','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','isAuthenticated','download','diskStorage','root'];(function(_0x5bb148,_0x34eaff){var _0x5e3648=function(_0x30ae6a){while(--_0x30ae6a){_0x5bb148['push'](_0x5bb148['shift']());}};_0x5e3648(++_0x34eaff);}(_0x91df,0x11c));var _0xf91d=function(_0x3b932f,_0x512078){_0x3b932f=_0x3b932f-0x0;var _0x4519be=_0x91df[_0x3b932f];return _0x4519be;};'use strict';var multer=require(_0xf91d('0x0'));var util=require(_0xf91d('0x1'));var path=require(_0xf91d('0x2'));var timeout=require(_0xf91d('0x3'));var express=require(_0xf91d('0x4'));var router=express[_0xf91d('0x5')]();var fs_extra=require(_0xf91d('0x6'));var auth=require(_0xf91d('0x7'));var interaction=require(_0xf91d('0x8'));var config=require('../../config/environment');var controller=require(_0xf91d('0x9'));router[_0xf91d('0xa')]('/',auth['isAuthenticated'](),controller[_0xf91d('0xb')]);router[_0xf91d('0xa')]('/:id',auth[_0xf91d('0xc')](),controller['show']);router['get']('/:id/download',auth[_0xf91d('0xc')](),controller[_0xf91d('0xd')]);var upload=multer({'storage':multer[_0xf91d('0xe')]({'destination':function(_0x44611a,_0x525874,_0x572f8f){_0x572f8f(null,path['join'](config[_0xf91d('0xf')],'server/files/sounds/original/'));},'filename':function(_0x4027f0,_0x350e76,_0xb6013f){_0x350e76['originalname']=_0x350e76[_0xf91d('0x10')][_0xf91d('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb6013f(null,util[_0xf91d('0x12')]('%s-%s%s',path[_0xf91d('0x13')](_0x350e76[_0xf91d('0x10')],path['extname'](_0x350e76[_0xf91d('0x10')])),Date[_0xf91d('0x14')](),path['extname'](_0x350e76['originalname'])));}})});router[_0xf91d('0x15')]('/',upload[_0xf91d('0x16')](_0xf91d('0x17')),controller[_0xf91d('0x18')]);router[_0xf91d('0x19')]('/:id',auth[_0xf91d('0xc')](),controller[_0xf91d('0x1a')]);router[_0xf91d('0x1b')](_0xf91d('0x1c'),auth[_0xf91d('0xc')](),controller[_0xf91d('0x1b')]);module[_0xf91d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c669604..886d9f8 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 _0x4c54=['INTEGER','FLOAT','exports','STRING','name','BIGINT'];(function(_0x3d03c9,_0x377cf2){var _0x2505d7=function(_0x592ada){while(--_0x592ada){_0x3d03c9['push'](_0x3d03c9['shift']());}};_0x2505d7(++_0x377cf2);}(_0x4c54,0xaa));var _0x44c5=function(_0x5c13f0,_0x3722cd){_0x5c13f0=_0x5c13f0-0x0;var _0x5e28a0=_0x4c54[_0x5c13f0];return _0x5e28a0;};'use strict';var Sequelize=require('sequelize');module[_0x44c5('0x0')]={'name':{'type':Sequelize[_0x44c5('0x1')],'unique':_0x44c5('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x44c5('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x44c5('0x1')]},'original_format':{'type':Sequelize[_0x44c5('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x44c5('0x3')]},'original_channelCount':{'type':Sequelize[_0x44c5('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x44c5('0x4')]},'converted_format':{'type':Sequelize[_0x44c5('0x1')]},'converted_duration':{'type':Sequelize[_0x44c5('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x44c5('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x44c5('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x35d2=['INTEGER','BIGINT','exports','name','STRING','FLOAT'];(function(_0x53995f,_0x1b135c){var _0x1649a9=function(_0x4da99b){while(--_0x4da99b){_0x53995f['push'](_0x53995f['shift']());}};_0x1649a9(++_0x1b135c);}(_0x35d2,0x1ca));var _0x235d=function(_0x5136c0,_0x32f5c3){_0x5136c0=_0x5136c0-0x0;var _0x42eb2e=_0x35d2[_0x5136c0];return _0x42eb2e;};'use strict';var Sequelize=require('sequelize');module[_0x235d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x235d('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x235d('0x2')]},'display_name':{'type':Sequelize[_0x235d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x235d('0x2')]},'original_format':{'type':Sequelize[_0x235d('0x2')]},'original_duration':{'type':Sequelize[_0x235d('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x235d('0x4')]},'original_bitRate':{'type':Sequelize[_0x235d('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x235d('0x2')]},'converted_duration':{'type':Sequelize[_0x235d('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x235d('0x5')]},'converted_channelCount':{'type':Sequelize[_0x235d('0x4')]},'converted_bitRate':{'type':Sequelize[_0x235d('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x235d('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 647efa7..c69e70a 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 _0x8cc3=['unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','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/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','find','params','converted_format','existsSync','join','server/files/sounds/converted','save_name','Sequelize','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0x8cc3,0x19b));var _0x38cc=function(_0x763fc,_0x4a985b){_0x763fc=_0x763fc-0x0;var _0x589adf=_0x8cc3[_0x763fc];return _0x589adf;};'use strict';var emlformat=require(_0x38cc('0x0'));var rimraf=require(_0x38cc('0x1'));var zipdir=require(_0x38cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x38cc('0x3'));var moment=require(_0x38cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x38cc('0x5'));var util=require(_0x38cc('0x6'));var path=require(_0x38cc('0x7'));var sox=require(_0x38cc('0x8'));var csv=require(_0x38cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38cc('0xa'));var _=require(_0x38cc('0xb'));var squel=require(_0x38cc('0xc'));var crypto=require(_0x38cc('0xd'));var jsforce=require(_0x38cc('0xe'));var deskjs=require(_0x38cc('0xf'));var toCsv=require(_0x38cc('0x9'));var querystring=require(_0x38cc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x38cc('0x11'));var qs=require(_0x38cc('0x12'));var as=require(_0x38cc('0x13'));var hardwareService=require(_0x38cc('0x14'));var logger=require(_0x38cc('0x15'))(_0x38cc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x38cc('0x17'));var db=require(_0x38cc('0x18'))['db'];function respondWithStatusCode(_0x51efa5,_0x1751f1){_0x1751f1=_0x1751f1||0xcc;return function(_0x2159b1){if(_0x2159b1){return _0x51efa5[_0x38cc('0x19')](_0x1751f1);}return _0x51efa5[_0x38cc('0x1a')](_0x1751f1)['end']();};}function respondWithResult(_0x47ae26,_0x430ec8){_0x430ec8=_0x430ec8||0xc8;return function(_0xc720dd){if(_0xc720dd){return _0x47ae26[_0x38cc('0x1a')](_0x430ec8)[_0x38cc('0x1b')](_0xc720dd);}};}function respondWithFilteredResult(_0x10385f,_0x201961){return function(_0x44c0e5){if(_0x44c0e5){var _0x5285d0=typeof _0x201961['offset']===_0x38cc('0x1c')&&typeof _0x201961['limit']===_0x38cc('0x1c');var _0x30f5e7=_0x44c0e5[_0x38cc('0x1d')];var _0x5adf21=_0x5285d0?0x0:_0x201961[_0x38cc('0x1e')];var _0x1ba822=_0x5285d0?_0x44c0e5['count']:_0x201961[_0x38cc('0x1e')]+_0x201961[_0x38cc('0x1f')];var _0x513180;if(_0x1ba822>=_0x30f5e7){_0x1ba822=_0x30f5e7;_0x513180=0xc8;}else{_0x513180=0xce;}_0x10385f[_0x38cc('0x1a')](_0x513180);return _0x10385f[_0x38cc('0x20')](_0x38cc('0x21'),_0x5adf21+'-'+_0x1ba822+'/'+_0x30f5e7)[_0x38cc('0x1b')](_0x44c0e5);}return null;};}function patchUpdates(_0x197d19){return function(_0x1eb5dc){try{jsonpatch[_0x38cc('0x22')](_0x1eb5dc,_0x197d19,!![]);}catch(_0x44c2d6){return BPromise[_0x38cc('0x23')](_0x44c2d6);}return _0x1eb5dc[_0x38cc('0x24')]();};}function saveUpdates(_0x595924,_0x2530cb){return function(_0x413175){if(_0x413175){return _0x413175['update'](_0x595924)['then'](function(_0x360890){return _0x360890;});}return null;};}function removeEntity(_0x273583,_0x15d4cd){return function(_0xfceb14){if(_0xfceb14){return _0xfceb14['destroy']()[_0x38cc('0x25')](function(){var _0x4ec3a7=_0xfceb14[_0x38cc('0x26')]({'plain':!![]});var _0x5f2149='Sounds';return db[_0x38cc('0x27')][_0x38cc('0x28')]({'where':{'type':_0x5f2149,'resourceId':_0x4ec3a7['id']}})[_0x38cc('0x25')](function(){return _0xfceb14;});})['then'](function(){_0x273583[_0x38cc('0x1a')](0xcc)[_0x38cc('0x29')]();});}};}function handleEntityNotFound(_0x43e920,_0x41ecdc){return function(_0x93a0fd){if(!_0x93a0fd){_0x43e920[_0x38cc('0x19')](0x194);}return _0x93a0fd;};}function handleError(_0x2a67f8,_0x383cba){_0x383cba=_0x383cba||0x1f4;return function(_0x39f690){logger[_0x38cc('0x2a')](_0x39f690[_0x38cc('0x2b')]);if(_0x39f690[_0x38cc('0x2c')]){delete _0x39f690[_0x38cc('0x2c')];}_0x2a67f8[_0x38cc('0x1a')](_0x383cba)[_0x38cc('0x2d')](_0x39f690);};}exports[_0x38cc('0x2e')]=function(_0x58a7fb,_0x5f51f5){var _0x1a16f6={},_0x219eee={},_0x5211d1={'count':0x0,'rows':[]};var _0x55f9f8=_[_0x38cc('0x2f')](db[_0x38cc('0x30')][_0x38cc('0x31')],function(_0xabe664){return{'name':_0xabe664[_0x38cc('0x32')],'type':_0xabe664[_0x38cc('0x33')]['key']};});_0x219eee['model']=_[_0x38cc('0x2f')](_0x55f9f8,'name');_0x219eee[_0x38cc('0x34')]=_[_0x38cc('0x35')](_0x58a7fb[_0x38cc('0x34')]);_0x219eee[_0x38cc('0x36')]=_[_0x38cc('0x37')](_0x219eee[_0x38cc('0x38')],_0x219eee[_0x38cc('0x34')]);_0x1a16f6[_0x38cc('0x39')]=_[_0x38cc('0x37')](_0x219eee['model'],qs[_0x38cc('0x3a')](_0x58a7fb[_0x38cc('0x34')][_0x38cc('0x3a')]));_0x1a16f6['attributes']=_0x1a16f6[_0x38cc('0x39')][_0x38cc('0x3b')]?_0x1a16f6[_0x38cc('0x39')]:_0x219eee[_0x38cc('0x38')];if(!_0x58a7fb['query'][_0x38cc('0x3c')](_0x38cc('0x3d'))){_0x1a16f6[_0x38cc('0x1f')]=qs[_0x38cc('0x1f')](_0x58a7fb[_0x38cc('0x34')][_0x38cc('0x1f')]);_0x1a16f6['offset']=qs[_0x38cc('0x1e')](_0x58a7fb[_0x38cc('0x34')][_0x38cc('0x1e')]);}_0x1a16f6[_0x38cc('0x3e')]=qs[_0x38cc('0x3f')](_0x58a7fb[_0x38cc('0x34')][_0x38cc('0x3f')]);_0x1a16f6['where']=qs[_0x38cc('0x36')](_[_0x38cc('0x40')](_0x58a7fb[_0x38cc('0x34')],_0x219eee[_0x38cc('0x36')]),_0x55f9f8);if(_0x58a7fb['query'][_0x38cc('0x41')]){_0x1a16f6[_0x38cc('0x42')]=_[_0x38cc('0x43')](_0x1a16f6[_0x38cc('0x42')],{'$or':_['map'](_0x55f9f8,function(_0x2b753f){if(_0x2b753f['type']!==_0x38cc('0x44')){var _0x3668f9={};_0x3668f9[_0x2b753f['name']]={'$like':'%'+_0x58a7fb[_0x38cc('0x34')][_0x38cc('0x41')]+'%'};return _0x3668f9;}})});}_0x1a16f6=_[_0x38cc('0x43')]({},_0x1a16f6,_0x58a7fb[_0x38cc('0x45')]);var _0x47a543={'where':_0x1a16f6['where']};return db['Sound'][_0x38cc('0x1d')](_0x47a543)[_0x38cc('0x25')](function(_0x40388c){_0x5211d1[_0x38cc('0x1d')]=_0x40388c;if(_0x58a7fb['query'][_0x38cc('0x46')]){_0x1a16f6[_0x38cc('0x47')]=[{'all':!![]}];}return db[_0x38cc('0x30')]['findAll'](_0x1a16f6);})[_0x38cc('0x25')](function(_0xa0401e){_0x5211d1['rows']=_0xa0401e;return _0x5211d1;})[_0x38cc('0x25')](respondWithFilteredResult(_0x5f51f5,_0x1a16f6))[_0x38cc('0x48')](handleError(_0x5f51f5,null));};exports['show']=function(_0x1f8c0f,_0x1d277d){var _0x44e2e2={'raw':!![],'where':{'id':_0x1f8c0f['params']['id']}},_0x276c2c={};_0x276c2c[_0x38cc('0x38')]=_[_0x38cc('0x35')](db[_0x38cc('0x30')][_0x38cc('0x31')]);_0x276c2c[_0x38cc('0x34')]=_[_0x38cc('0x35')](_0x1f8c0f[_0x38cc('0x34')]);_0x276c2c['filters']=_['intersection'](_0x276c2c[_0x38cc('0x38')],_0x276c2c[_0x38cc('0x34')]);_0x44e2e2[_0x38cc('0x39')]=_[_0x38cc('0x37')](_0x276c2c['model'],qs[_0x38cc('0x3a')](_0x1f8c0f[_0x38cc('0x34')][_0x38cc('0x3a')]));_0x44e2e2[_0x38cc('0x39')]=_0x44e2e2['attributes']['length']?_0x44e2e2[_0x38cc('0x39')]:_0x276c2c[_0x38cc('0x38')];if(_0x1f8c0f[_0x38cc('0x34')]['includeAll']){_0x44e2e2[_0x38cc('0x47')]=[{'all':!![]}];}_0x44e2e2=_[_0x38cc('0x43')]({},_0x44e2e2,_0x1f8c0f[_0x38cc('0x45')]);return db['Sound'][_0x38cc('0x49')](_0x44e2e2)[_0x38cc('0x25')](handleEntityNotFound(_0x1d277d,null))[_0x38cc('0x25')](respondWithResult(_0x1d277d,null))[_0x38cc('0x48')](handleError(_0x1d277d,null));};exports['download']=function(_0x11f312,_0x17e099,_0x744d80){return db[_0x38cc('0x30')][_0x38cc('0x49')]({'where':{'id':_0x11f312[_0x38cc('0x4a')]['id']},'attributes':['name','save_name',_0x38cc('0x4b')],'raw':!![]})[_0x38cc('0x25')](handleEntityNotFound(_0x17e099,null))[_0x38cc('0x25')](function(_0xae341e){if(_0xae341e){if(!fs[_0x38cc('0x4c')](path[_0x38cc('0x4d')](config['root'],_0x38cc('0x4e'),_0xae341e[_0x38cc('0x4f')]+'.'+_0xae341e[_0x38cc('0x4b')]))){throw new db[(_0x38cc('0x50'))]['ValidationError'](_0x38cc('0x51'));}return _0x17e099['download'](path['join'](config[_0x38cc('0x52')],_0x38cc('0x4e'),util[_0x38cc('0x53')]('%s.%s',_0xae341e[_0x38cc('0x4f')],_0xae341e[_0x38cc('0x4b')])),util[_0x38cc('0x53')](_0x38cc('0x54'),_0xae341e['name'],_0xae341e['converted_format']));}return null;})[_0x38cc('0x48')](handleError(_0x17e099,null));};exports[_0x38cc('0x55')]=function(_0x5d27ff,_0x59c006,_0x4bc4e4){var _0x2b364a={'name':path[_0x38cc('0x56')](_0x5d27ff[_0x38cc('0x57')][_0x38cc('0x58')],path['extname'](_0x5d27ff[_0x38cc('0x57')][_0x38cc('0x58')])),'save_name':path['basename'](_0x5d27ff[_0x38cc('0x57')][_0x38cc('0x59')],path[_0x38cc('0x5a')](_0x5d27ff[_0x38cc('0x57')]['filename'])),'original_format':path[_0x38cc('0x5a')](_0x5d27ff[_0x38cc('0x57')]['originalname'])[_0x38cc('0x5b')](0x1),'converted_format':'wav'};var _0x5289fa=path[_0x38cc('0x4d')](config[_0x38cc('0x52')],_0x38cc('0x5c'),_0x5d27ff[_0x38cc('0x57')]['filename']);var _0x1965d5=path[_0x38cc('0x4d')](config[_0x38cc('0x52')],_0x38cc('0x4e'),util[_0x38cc('0x53')](_0x38cc('0x54'),path['basename'](_0x5d27ff['file'][_0x38cc('0x59')],path[_0x38cc('0x5a')](_0x5d27ff[_0x38cc('0x57')]['filename'])),_0x2b364a['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x5289fa);logger[_0x38cc('0x5d')](_0x38cc('0x5e'),_0x1965d5);try{fs['chmodSync'](_0x5289fa,parseInt(_0x38cc('0x5f'),0x8));var _0x1da96d=sox[_0x38cc('0x60')](_0x5289fa,_0x1965d5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1da96d['on'](_0x38cc('0x2a'),function(_0x4e1a73){fs[_0x38cc('0x61')](_0x5289fa);_0x59c006[_0x38cc('0x1a')](0x1f4)[_0x38cc('0x2d')](_0x4e1a73);});_0x1da96d['on']('src',function(_0x5ea4be){_0x2b364a[_0x38cc('0x62')]=isNaN(_0x5ea4be[_0x38cc('0x63')])?null:_0x5ea4be[_0x38cc('0x63')]*0x3e8;_0x2b364a[_0x38cc('0x64')]=isNaN(_0x5ea4be[_0x38cc('0x65')])?null:_0x5ea4be[_0x38cc('0x65')];_0x2b364a[_0x38cc('0x66')]=isNaN(_0x5ea4be[_0x38cc('0x67')])?null:_0x5ea4be[_0x38cc('0x67')];_0x2b364a[_0x38cc('0x68')]=isNaN(_0x5ea4be[_0x38cc('0x69')])?null:_0x5ea4be[_0x38cc('0x69')];_0x2b364a[_0x38cc('0x6a')]=isNaN(_0x5ea4be['sampleRate'])?null:_0x5ea4be[_0x38cc('0x6b')];});_0x1da96d['on']('dest',function(_0x82c466){_0x2b364a[_0x38cc('0x6c')]=isNaN(_0x82c466['duration'])?null:_0x82c466['duration']*0x3e8;_0x2b364a[_0x38cc('0x6d')]=isNaN(_0x82c466[_0x38cc('0x65')])?null:_0x82c466['sampleCount'];_0x2b364a[_0x38cc('0x6e')]=isNaN(_0x82c466[_0x38cc('0x67')])?null:_0x82c466[_0x38cc('0x67')];_0x2b364a[_0x38cc('0x6f')]=isNaN(_0x82c466[_0x38cc('0x69')])?null:_0x82c466[_0x38cc('0x69')];_0x2b364a[_0x38cc('0x70')]=isNaN(_0x82c466[_0x38cc('0x6b')])?null:_0x82c466[_0x38cc('0x6b')];});_0x1da96d['on'](_0x38cc('0x29'),function(){fs[_0x38cc('0x71')](_0x1965d5,parseInt('0777',0x8));return db['Sound'][_0x38cc('0x55')](_0x2b364a)[_0x38cc('0x25')](function(_0x184ece){var _0x113a25={'role':_0x5d27ff[_0x38cc('0x72')][_0x38cc('0x73')],'userProfileId':_0x5d27ff['body'][_0x38cc('0x74')]};if(!_0x113a25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x113a25['role']===_0x38cc('0x75')){var _0x3b99da=_0x184ece['get']({'plain':!![]});return db[_0x38cc('0x76')][_0x38cc('0x49')]({'where':{'name':_0x38cc('0x77'),'userProfileId':_0x113a25[_0x38cc('0x74')]},'raw':!![]})[_0x38cc('0x25')](function(_0x4365b7){if(_0x4365b7&&_0x4365b7[_0x38cc('0x78')]===0x0){return db[_0x38cc('0x27')][_0x38cc('0x55')]({'name':_0x3b99da[_0x38cc('0x2c')],'resourceId':_0x3b99da['id'],'type':_0x4365b7[_0x38cc('0x2c')],'sectionId':_0x4365b7['id']},{})[_0x38cc('0x25')](function(){return _0x184ece;});}else{return _0x184ece;}})[_0x38cc('0x48')](function(_0xf2b981){logger[_0x38cc('0x2a')](_0x38cc('0x79'),_0xf2b981);throw _0xf2b981;});}return _0x184ece;})[_0x38cc('0x25')](respondWithResult(_0x59c006,null))[_0x38cc('0x48')](handleError(_0x59c006,null));});_0x1da96d[_0x38cc('0x7a')]();}catch(_0x139c37){_0x59c006[_0x38cc('0x1a')](0x1f4)[_0x38cc('0x2d')](_0x139c37);}};exports[_0x38cc('0x7b')]=function(_0x560ab5,_0x2d7735,_0x23f3b7){return db[_0x38cc('0x30')][_0x38cc('0x49')]({'where':{'id':_0x560ab5[_0x38cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2d7735,null))[_0x38cc('0x25')](saveUpdates(_['pick'](_0x560ab5[_0x38cc('0x72')],[_0x38cc('0x2c'),_0x38cc('0x7c')]),null))[_0x38cc('0x25')](respondWithResult(_0x2d7735,null))[_0x38cc('0x48')](handleError(_0x2d7735,null));};exports[_0x38cc('0x7d')]=function(_0x447efa,_0x3a61dd,_0x1236d7){return db[_0x38cc('0x30')][_0x38cc('0x49')]({'where':{'id':_0x447efa['params']['id']}})[_0x38cc('0x25')](function(_0x3b08a6){if(_0x3b08a6){return _0x3b08a6[_0x38cc('0x28')]();}})[_0x38cc('0x25')](function(_0x23787d){var _0x141d3a=path['join'](config[_0x38cc('0x52')],_0x38cc('0x5c'),util[_0x38cc('0x53')](_0x38cc('0x54'),_0x23787d['save_name'],_0x23787d[_0x38cc('0x7e')]));var _0x46fc5f=path[_0x38cc('0x4d')](config[_0x38cc('0x52')],_0x38cc('0x4e'),util[_0x38cc('0x53')]('%s.%s',_0x23787d['save_name'],_0x23787d[_0x38cc('0x4b')]));fs['unlinkSync'](_0x141d3a);fs[_0x38cc('0x61')](_0x46fc5f);return _0x23787d;})[_0x38cc('0x25')](function(_0xd8fc93){if(_0xd8fc93){return _0x3a61dd[_0x38cc('0x1a')](0xcc)['end']();}})[_0x38cc('0x25')](handleEntityNotFound(_0x3a61dd,null))['catch'](handleError(_0x3a61dd,null));}; \ No newline at end of file +var _0x67d6=['catch','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','transcode','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','sampleRate','chmodSync','0777','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','destroy','original_format','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Sounds','sendStatus','error','stack','name','send','map','Sound','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','show','params','find','download','save_name','join','root','converted_format','Sequelize','ValidationError','server/files/sounds/converted','format','%s.%s'];(function(_0x120fdb,_0x586aa3){var _0xc2f5ba=function(_0x34c71a){while(--_0x34c71a){_0x120fdb['push'](_0x120fdb['shift']());}};_0xc2f5ba(++_0x586aa3);}(_0x67d6,0xa9));var _0x667d=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x67d6[_0x173d7e];return _0x2220d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x667d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x667d('0x1'));var rp=require(_0x667d('0x2'));var moment=require(_0x667d('0x3'));var BPromise=require(_0x667d('0x4'));var Mustache=require(_0x667d('0x5'));var util=require(_0x667d('0x6'));var path=require(_0x667d('0x7'));var sox=require('sox');var csv=require(_0x667d('0x8'));var ejs=require(_0x667d('0x9'));var fs=require('fs');var fs_extra=require(_0x667d('0xa'));var _=require(_0x667d('0xb'));var squel=require(_0x667d('0xc'));var crypto=require(_0x667d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x667d('0xe'));var toCsv=require(_0x667d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x667d('0xf'));var authService=require(_0x667d('0x10'));var qs=require(_0x667d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x667d('0x12'));var logger=require(_0x667d('0x13'))(_0x667d('0x14'));var utils=require('../../config/utils');var config=require(_0x667d('0x15'));var licenseUtil=require(_0x667d('0x16'));var db=require(_0x667d('0x17'))['db'];function respondWithStatusCode(_0x1d30c0,_0x3a8391){_0x3a8391=_0x3a8391||0xcc;return function(_0x42b7fa){if(_0x42b7fa){return _0x1d30c0['sendStatus'](_0x3a8391);}return _0x1d30c0['status'](_0x3a8391)[_0x667d('0x18')]();};}function respondWithResult(_0x23a8d0,_0x2c09e1){_0x2c09e1=_0x2c09e1||0xc8;return function(_0x483832){if(_0x483832){return _0x23a8d0[_0x667d('0x19')](_0x2c09e1)[_0x667d('0x1a')](_0x483832);}};}function respondWithFilteredResult(_0x3152f8,_0x96adcb){return function(_0x712e94){if(_0x712e94){var _0x3856fd=typeof _0x96adcb[_0x667d('0x1b')]===_0x667d('0x1c')&&typeof _0x96adcb[_0x667d('0x1d')]===_0x667d('0x1c');var _0x5417cc=_0x712e94[_0x667d('0x1e')];var _0x27a96e=_0x3856fd?0x0:_0x96adcb[_0x667d('0x1b')];var _0x41959e=_0x3856fd?_0x712e94[_0x667d('0x1e')]:_0x96adcb['offset']+_0x96adcb[_0x667d('0x1d')];var _0x2ea14c;if(_0x41959e>=_0x5417cc){_0x41959e=_0x5417cc;_0x2ea14c=0xc8;}else{_0x2ea14c=0xce;}_0x3152f8[_0x667d('0x19')](_0x2ea14c);return _0x3152f8[_0x667d('0x1f')](_0x667d('0x20'),_0x27a96e+'-'+_0x41959e+'/'+_0x5417cc)[_0x667d('0x1a')](_0x712e94);}return null;};}function patchUpdates(_0x5b9adf){return function(_0x56e6fa){try{jsonpatch['apply'](_0x56e6fa,_0x5b9adf,!![]);}catch(_0x286113){return BPromise[_0x667d('0x21')](_0x286113);}return _0x56e6fa[_0x667d('0x22')]();};}function saveUpdates(_0x5ea273,_0x1446d8){return function(_0x56509c){if(_0x56509c){return _0x56509c[_0x667d('0x23')](_0x5ea273)['then'](function(_0xabf794){return _0xabf794;});}return null;};}function removeEntity(_0x844453,_0x53b733){return function(_0x411660){if(_0x411660){return _0x411660['destroy']()['then'](function(){var _0x5afc79=_0x411660[_0x667d('0x24')]({'plain':!![]});var _0x25cea7=_0x667d('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x25cea7,'resourceId':_0x5afc79['id']}})['then'](function(){return _0x411660;});})['then'](function(){_0x844453[_0x667d('0x19')](0xcc)[_0x667d('0x18')]();});}};}function handleEntityNotFound(_0x1678ab,_0x2a7ebb){return function(_0x8f361a){if(!_0x8f361a){_0x1678ab[_0x667d('0x26')](0x194);}return _0x8f361a;};}function handleError(_0x21b85e,_0x993e6c){_0x993e6c=_0x993e6c||0x1f4;return function(_0x3cc309){logger[_0x667d('0x27')](_0x3cc309[_0x667d('0x28')]);if(_0x3cc309[_0x667d('0x29')]){delete _0x3cc309[_0x667d('0x29')];}_0x21b85e[_0x667d('0x19')](_0x993e6c)[_0x667d('0x2a')](_0x3cc309);};}exports['index']=function(_0x9c19ec,_0x55a864){var _0x1fdd5b={},_0x5881e0={},_0x47f7bb={'count':0x0,'rows':[]};var _0x45e33c=_[_0x667d('0x2b')](db[_0x667d('0x2c')][_0x667d('0x2d')],function(_0x384295){return{'name':_0x384295[_0x667d('0x2e')],'type':_0x384295[_0x667d('0x2f')]['key']};});_0x5881e0[_0x667d('0x30')]=_[_0x667d('0x2b')](_0x45e33c,_0x667d('0x29'));_0x5881e0['query']=_[_0x667d('0x31')](_0x9c19ec[_0x667d('0x32')]);_0x5881e0[_0x667d('0x33')]=_['intersection'](_0x5881e0[_0x667d('0x30')],_0x5881e0[_0x667d('0x32')]);_0x1fdd5b[_0x667d('0x34')]=_[_0x667d('0x35')](_0x5881e0[_0x667d('0x30')],qs[_0x667d('0x36')](_0x9c19ec[_0x667d('0x32')]['fields']));_0x1fdd5b[_0x667d('0x34')]=_0x1fdd5b[_0x667d('0x34')][_0x667d('0x37')]?_0x1fdd5b[_0x667d('0x34')]:_0x5881e0[_0x667d('0x30')];if(!_0x9c19ec[_0x667d('0x32')][_0x667d('0x38')](_0x667d('0x39'))){_0x1fdd5b[_0x667d('0x1d')]=qs['limit'](_0x9c19ec['query']['limit']);_0x1fdd5b[_0x667d('0x1b')]=qs[_0x667d('0x1b')](_0x9c19ec[_0x667d('0x32')][_0x667d('0x1b')]);}_0x1fdd5b[_0x667d('0x3a')]=qs[_0x667d('0x3b')](_0x9c19ec[_0x667d('0x32')][_0x667d('0x3b')]);_0x1fdd5b[_0x667d('0x3c')]=qs[_0x667d('0x33')](_[_0x667d('0x3d')](_0x9c19ec[_0x667d('0x32')],_0x5881e0[_0x667d('0x33')]),_0x45e33c);if(_0x9c19ec['query'][_0x667d('0x3e')]){_0x1fdd5b[_0x667d('0x3c')]=_[_0x667d('0x3f')](_0x1fdd5b[_0x667d('0x3c')],{'$or':_[_0x667d('0x2b')](_0x45e33c,function(_0xd5ac7b){if(_0xd5ac7b[_0x667d('0x2f')]!==_0x667d('0x40')){var _0x3e3ebb={};_0x3e3ebb[_0xd5ac7b['name']]={'$like':'%'+_0x9c19ec[_0x667d('0x32')][_0x667d('0x3e')]+'%'};return _0x3e3ebb;}})});}_0x1fdd5b=_['merge']({},_0x1fdd5b,_0x9c19ec['options']);var _0x221fdb={'where':_0x1fdd5b['where']};return db[_0x667d('0x2c')][_0x667d('0x1e')](_0x221fdb)[_0x667d('0x41')](function(_0x2d80e1){_0x47f7bb[_0x667d('0x1e')]=_0x2d80e1;if(_0x9c19ec[_0x667d('0x32')][_0x667d('0x42')]){_0x1fdd5b[_0x667d('0x43')]=[{'all':!![]}];}return db[_0x667d('0x2c')][_0x667d('0x44')](_0x1fdd5b);})[_0x667d('0x41')](function(_0x3fd856){_0x47f7bb[_0x667d('0x45')]=_0x3fd856;return _0x47f7bb;})[_0x667d('0x41')](respondWithFilteredResult(_0x55a864,_0x1fdd5b))['catch'](handleError(_0x55a864,null));};exports[_0x667d('0x46')]=function(_0x53e535,_0xf22ee5){var _0x529db9={'raw':!![],'where':{'id':_0x53e535[_0x667d('0x47')]['id']}},_0x18c7da={};_0x18c7da['model']=_[_0x667d('0x31')](db[_0x667d('0x2c')][_0x667d('0x2d')]);_0x18c7da[_0x667d('0x32')]=_[_0x667d('0x31')](_0x53e535[_0x667d('0x32')]);_0x18c7da[_0x667d('0x33')]=_[_0x667d('0x35')](_0x18c7da[_0x667d('0x30')],_0x18c7da[_0x667d('0x32')]);_0x529db9[_0x667d('0x34')]=_['intersection'](_0x18c7da[_0x667d('0x30')],qs[_0x667d('0x36')](_0x53e535[_0x667d('0x32')][_0x667d('0x36')]));_0x529db9[_0x667d('0x34')]=_0x529db9[_0x667d('0x34')][_0x667d('0x37')]?_0x529db9['attributes']:_0x18c7da['model'];if(_0x53e535[_0x667d('0x32')][_0x667d('0x42')]){_0x529db9[_0x667d('0x43')]=[{'all':!![]}];}_0x529db9=_[_0x667d('0x3f')]({},_0x529db9,_0x53e535['options']);return db[_0x667d('0x2c')][_0x667d('0x48')](_0x529db9)[_0x667d('0x41')](handleEntityNotFound(_0xf22ee5,null))['then'](respondWithResult(_0xf22ee5,null))['catch'](handleError(_0xf22ee5,null));};exports[_0x667d('0x49')]=function(_0x10da2e,_0x12f23d,_0xb2001d){return db[_0x667d('0x2c')]['find']({'where':{'id':_0x10da2e[_0x667d('0x47')]['id']},'attributes':['name',_0x667d('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x12f23d,null))[_0x667d('0x41')](function(_0x518668){if(_0x518668){if(!fs['existsSync'](path[_0x667d('0x4b')](config[_0x667d('0x4c')],'server/files/sounds/converted',_0x518668['save_name']+'.'+_0x518668[_0x667d('0x4d')]))){throw new db[(_0x667d('0x4e'))][(_0x667d('0x4f'))]('Sound\x20not\x20found');}return _0x12f23d[_0x667d('0x49')](path[_0x667d('0x4b')](config['root'],_0x667d('0x50'),util[_0x667d('0x51')](_0x667d('0x52'),_0x518668[_0x667d('0x4a')],_0x518668[_0x667d('0x4d')])),util[_0x667d('0x51')](_0x667d('0x52'),_0x518668['name'],_0x518668[_0x667d('0x4d')]));}return null;})[_0x667d('0x53')](handleError(_0x12f23d,null));};exports['create']=function(_0x2b2e5d,_0x43dddf,_0x42adf8){var _0x5d752a={'name':path[_0x667d('0x54')](_0x2b2e5d[_0x667d('0x55')][_0x667d('0x56')],path[_0x667d('0x57')](_0x2b2e5d['file'][_0x667d('0x56')])),'save_name':path[_0x667d('0x54')](_0x2b2e5d[_0x667d('0x55')][_0x667d('0x58')],path[_0x667d('0x57')](_0x2b2e5d['file'][_0x667d('0x58')])),'original_format':path[_0x667d('0x57')](_0x2b2e5d[_0x667d('0x55')][_0x667d('0x56')])['substring'](0x1),'converted_format':_0x667d('0x59')};var _0x337386=path[_0x667d('0x4b')](config[_0x667d('0x4c')],_0x667d('0x5a'),_0x2b2e5d['file'][_0x667d('0x58')]);var _0x312844=path[_0x667d('0x4b')](config['root'],_0x667d('0x50'),util[_0x667d('0x51')]('%s.%s',path[_0x667d('0x54')](_0x2b2e5d[_0x667d('0x55')][_0x667d('0x58')],path[_0x667d('0x57')](_0x2b2e5d[_0x667d('0x55')]['filename'])),_0x5d752a[_0x667d('0x4d')]));logger[_0x667d('0x5b')]('Sound\x20upload\x20filepath:\x20%s',_0x337386);logger[_0x667d('0x5b')](_0x667d('0x5c'),_0x312844);try{fs['chmodSync'](_0x337386,parseInt('0777',0x8));var _0x5bd717=sox[_0x667d('0x5d')](_0x337386,_0x312844,{'sampleRate':0x1f40,'format':_0x667d('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bd717['on']('error',function(_0x1712b9){fs['unlinkSync'](_0x337386);_0x43dddf['status'](0x1f4)[_0x667d('0x2a')](_0x1712b9);});_0x5bd717['on'](_0x667d('0x5e'),function(_0xe2bb7a){_0x5d752a[_0x667d('0x5f')]=isNaN(_0xe2bb7a['duration'])?null:_0xe2bb7a[_0x667d('0x60')]*0x3e8;_0x5d752a['original_sampleCount']=isNaN(_0xe2bb7a[_0x667d('0x61')])?null:_0xe2bb7a[_0x667d('0x61')];_0x5d752a[_0x667d('0x62')]=isNaN(_0xe2bb7a['channelCount'])?null:_0xe2bb7a[_0x667d('0x63')];_0x5d752a[_0x667d('0x64')]=isNaN(_0xe2bb7a[_0x667d('0x65')])?null:_0xe2bb7a[_0x667d('0x65')];_0x5d752a['original_sampleRate']=isNaN(_0xe2bb7a['sampleRate'])?null:_0xe2bb7a['sampleRate'];});_0x5bd717['on'](_0x667d('0x66'),function(_0x2a2d36){_0x5d752a[_0x667d('0x67')]=isNaN(_0x2a2d36[_0x667d('0x60')])?null:_0x2a2d36['duration']*0x3e8;_0x5d752a[_0x667d('0x68')]=isNaN(_0x2a2d36['sampleCount'])?null:_0x2a2d36[_0x667d('0x61')];_0x5d752a['converted_channelCount']=isNaN(_0x2a2d36[_0x667d('0x63')])?null:_0x2a2d36[_0x667d('0x63')];_0x5d752a[_0x667d('0x69')]=isNaN(_0x2a2d36[_0x667d('0x65')])?null:_0x2a2d36[_0x667d('0x65')];_0x5d752a[_0x667d('0x6a')]=isNaN(_0x2a2d36[_0x667d('0x6b')])?null:_0x2a2d36[_0x667d('0x6b')];});_0x5bd717['on'](_0x667d('0x18'),function(){fs[_0x667d('0x6c')](_0x312844,parseInt(_0x667d('0x6d'),0x8));return db[_0x667d('0x2c')][_0x667d('0x6e')](_0x5d752a)[_0x667d('0x41')](function(_0x43bc4e){var _0x22a5a3={'role':_0x2b2e5d[_0x667d('0x6f')][_0x667d('0x70')],'userProfileId':_0x2b2e5d[_0x667d('0x6f')]['userProfileId']};if(!_0x22a5a3)throw new Error(_0x667d('0x71'));if(_0x22a5a3[_0x667d('0x70')]===_0x667d('0x72')){var _0x2789ba=_0x43bc4e['get']({'plain':!![]});return db[_0x667d('0x73')][_0x667d('0x48')]({'where':{'name':_0x667d('0x25'),'userProfileId':_0x22a5a3[_0x667d('0x74')]},'raw':!![]})[_0x667d('0x41')](function(_0x545dd0){if(_0x545dd0&&_0x545dd0[_0x667d('0x75')]===0x0){return db[_0x667d('0x76')][_0x667d('0x6e')]({'name':_0x2789ba[_0x667d('0x29')],'resourceId':_0x2789ba['id'],'type':_0x545dd0[_0x667d('0x29')],'sectionId':_0x545dd0['id']},{})[_0x667d('0x41')](function(){return _0x43bc4e;});}else{return _0x43bc4e;}})[_0x667d('0x53')](function(_0x2dd51b){logger['error'](_0x667d('0x77'),_0x2dd51b);throw _0x2dd51b;});}return _0x43bc4e;})['then'](respondWithResult(_0x43dddf,null))['catch'](handleError(_0x43dddf,null));});_0x5bd717[_0x667d('0x78')]();}catch(_0x432107){_0x43dddf[_0x667d('0x19')](0x1f4)[_0x667d('0x2a')](_0x432107);}};exports[_0x667d('0x23')]=function(_0x35d37e,_0x479cc9,_0x18492d){return db[_0x667d('0x2c')]['find']({'where':{'id':_0x35d37e[_0x667d('0x47')]['id']}})[_0x667d('0x41')](handleEntityNotFound(_0x479cc9,null))[_0x667d('0x41')](saveUpdates(_[_0x667d('0x3d')](_0x35d37e[_0x667d('0x6f')],[_0x667d('0x29'),_0x667d('0x79')]),null))[_0x667d('0x41')](respondWithResult(_0x479cc9,null))[_0x667d('0x53')](handleError(_0x479cc9,null));};exports[_0x667d('0x7a')]=function(_0x5b2c49,_0x440535,_0x56add1){return db[_0x667d('0x2c')][_0x667d('0x48')]({'where':{'id':_0x5b2c49['params']['id']}})[_0x667d('0x41')](function(_0xbfed3b){if(_0xbfed3b){return _0xbfed3b[_0x667d('0x7b')]();}})['then'](function(_0x4ff2cd){var _0x4321c9=path['join'](config[_0x667d('0x4c')],'server/files/sounds/original',util['format'](_0x667d('0x52'),_0x4ff2cd['save_name'],_0x4ff2cd[_0x667d('0x7c')]));var _0x2a2aad=path['join'](config['root'],_0x667d('0x50'),util[_0x667d('0x51')]('%s.%s',_0x4ff2cd[_0x667d('0x4a')],_0x4ff2cd['converted_format']));fs[_0x667d('0x7d')](_0x4321c9);fs[_0x667d('0x7d')](_0x2a2aad);return _0x4ff2cd;})[_0x667d('0x41')](function(_0x2e0111){if(_0x2e0111){return _0x440535['status'](0xcc)[_0x667d('0x18')]();}})[_0x667d('0x41')](handleEntityNotFound(_0x440535,null))['catch'](handleError(_0x440535,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 6f798d9..7e22bd6 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 _0x0cdf=['define','tools_sounds','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4b82f0,_0x4a1487){var _0x494eff=function(_0x4ea3fc){while(--_0x4ea3fc){_0x4b82f0['push'](_0x4b82f0['shift']());}};_0x494eff(++_0x4a1487);}(_0x0cdf,0x13d));var _0xf0cd=function(_0x3e7b59,_0x14a4cd){_0x3e7b59=_0x3e7b59-0x0;var _0x4bd64a=_0x0cdf[_0x3e7b59];return _0x4bd64a;};'use strict';var _=require('lodash');var util=require(_0xf0cd('0x0'));var logger=require(_0xf0cd('0x1'))('api');var moment=require(_0xf0cd('0x2'));var BPromise=require('bluebird');var rp=require(_0xf0cd('0x3'));var fs=require('fs');var path=require(_0xf0cd('0x4'));var rimraf=require(_0xf0cd('0x5'));var config=require(_0xf0cd('0x6'));var attributes=require('./sound.attributes');module['exports']=function(_0x13ded1,_0x38d2be){return _0x13ded1[_0xf0cd('0x7')]('Sound',attributes,{'tableName':_0xf0cd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc77d=['./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xe96ecf,_0x369b43){var _0x25b9b0=function(_0x44190f){while(--_0x44190f){_0xe96ecf['push'](_0xe96ecf['shift']());}};_0x25b9b0(++_0x369b43);}(_0xc77d,0x1d8));var _0xdc77=function(_0x21f28f,_0x3be6b8){_0x21f28f=_0x21f28f-0x0;var _0x180f21=_0xc77d[_0x21f28f];return _0x180f21;};'use strict';var _=require(_0xdc77('0x0'));var util=require(_0xdc77('0x1'));var logger=require(_0xdc77('0x2'))(_0xdc77('0x3'));var moment=require(_0xdc77('0x4'));var BPromise=require(_0xdc77('0x5'));var rp=require(_0xdc77('0x6'));var fs=require('fs');var path=require(_0xdc77('0x7'));var rimraf=require(_0xdc77('0x8'));var config=require('../../config/environment');var attributes=require(_0xdc77('0x9'));module[_0xdc77('0xa')]=function(_0x15ec11,_0x1735b8){return _0x15ec11['define'](_0xdc77('0xb'),attributes,{'tableName':_0xdc77('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 50ef02a..3813e2b 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 _0x0d44=['attributes','include','model','map','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSound','Sound','options','raw','where'];(function(_0x10feaf,_0x15d7bf){var _0x459d54=function(_0x1f9312){while(--_0x1f9312){_0x10feaf['push'](_0x10feaf['shift']());}};_0x459d54(++_0x15d7bf);}(_0x0d44,0x112));var _0x40d4=function(_0x191830,_0x199a04){_0x191830=_0x191830-0x0;var _0x4494ab=_0x0d44[_0x191830];return _0x4494ab;};'use strict';var _=require(_0x40d4('0x0'));var util=require(_0x40d4('0x1'));var moment=require(_0x40d4('0x2'));var BPromise=require(_0x40d4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40d4('0x4'));var db=require(_0x40d4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40d4('0x6'))(_0x40d4('0x7'));var config=require(_0x40d4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x40d4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f4821,_0x4b812f,_0x2e0e56){return new BPromise(function(_0x2524cd,_0x4b5298){return client[_0x40d4('0xa')](_0x1f4821,_0x2e0e56)[_0x40d4('0xb')](function(_0x35aa6f){logger[_0x40d4('0xc')](_0x40d4('0xd'),_0x4b812f,_0x40d4('0xe'));logger[_0x40d4('0xf')](_0x40d4('0x10'),_0x4b812f,_0x40d4('0xe'),JSON[_0x40d4('0x11')](_0x35aa6f));if(_0x35aa6f[_0x40d4('0x12')]){if(_0x35aa6f['error'][_0x40d4('0x13')]===0x1f4){logger[_0x40d4('0x12')](_0x40d4('0xd'),_0x4b812f,_0x35aa6f[_0x40d4('0x12')][_0x40d4('0x14')]);return _0x4b5298(_0x35aa6f[_0x40d4('0x12')][_0x40d4('0x14')]);}logger[_0x40d4('0x12')]('Sound,\x20%s,\x20%s',_0x4b812f,_0x35aa6f[_0x40d4('0x12')][_0x40d4('0x14')]);return _0x2524cd(_0x35aa6f[_0x40d4('0x12')][_0x40d4('0x14')]);}else{logger[_0x40d4('0xc')](_0x40d4('0xd'),_0x4b812f,_0x40d4('0xe'));_0x2524cd(_0x35aa6f['result'][_0x40d4('0x14')]);}})['catch'](function(_0x381d8b){logger[_0x40d4('0x12')](_0x40d4('0xd'),_0x4b812f,_0x381d8b);_0x4b5298(_0x381d8b);});});}exports[_0x40d4('0x15')]=function(_0x6eb977){var _0x49c67e=this;return new Promise(function(_0x183bd5,_0x397808){return db[_0x40d4('0x16')]['find']({'raw':_0x6eb977[_0x40d4('0x17')]?_0x6eb977[_0x40d4('0x17')][_0x40d4('0x18')]===undefined?!![]:![]:!![],'where':_0x6eb977[_0x40d4('0x17')]?_0x6eb977[_0x40d4('0x17')][_0x40d4('0x19')]||null:null,'attributes':_0x6eb977[_0x40d4('0x17')]?_0x6eb977[_0x40d4('0x17')][_0x40d4('0x1a')]||null:null,'include':_0x6eb977[_0x40d4('0x17')]?_0x6eb977[_0x40d4('0x17')]['include']?_['map'](_0x6eb977[_0x40d4('0x17')][_0x40d4('0x1b')],function(_0x3d1977){return{'model':db[_0x3d1977[_0x40d4('0x1c')]],'as':_0x3d1977['as'],'attributes':_0x3d1977[_0x40d4('0x1a')],'include':_0x3d1977[_0x40d4('0x1b')]?_[_0x40d4('0x1d')](_0x3d1977[_0x40d4('0x1b')],function(_0x1ad615){return{'model':db[_0x1ad615['model']],'as':_0x1ad615['as'],'attributes':_0x1ad615[_0x40d4('0x1a')],'include':_0x1ad615[_0x40d4('0x1b')]?_[_0x40d4('0x1d')](_0x1ad615[_0x40d4('0x1b')],function(_0x93138a){return{'model':db[_0x93138a[_0x40d4('0x1c')]],'as':_0x93138a['as'],'attributes':_0x93138a[_0x40d4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x40d4('0xb')](function(_0x3e4f46){logger['info']('ShowSound',_0x6eb977);logger[_0x40d4('0xf')](_0x40d4('0x15'),_0x6eb977,JSON[_0x40d4('0x11')](_0x3e4f46));_0x183bd5(_0x3e4f46);})['catch'](function(_0x477673){logger[_0x40d4('0x12')](_0x40d4('0x15'),_0x477673[_0x40d4('0x14')],_0x6eb977);_0x397808(_0x49c67e[_0x40d4('0x12')](0x1f4,_0x477673['message']));});});}; \ No newline at end of file +var _0x6146=['error','code','message','catch','Sound','find','options','attributes','include','model','map','ShowSound','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x52733b,_0xabcaa5){var _0xee7369=function(_0xec8462){while(--_0xec8462){_0x52733b['push'](_0x52733b['shift']());}};_0xee7369(++_0xabcaa5);}(_0x6146,0x124));var _0x6614=function(_0x575f33,_0x3e34e3){_0x575f33=_0x575f33-0x0;var _0x3e153b=_0x6146[_0x575f33];return _0x3e153b;};'use strict';var _=require('lodash');var util=require(_0x6614('0x0'));var moment=require(_0x6614('0x1'));var BPromise=require(_0x6614('0x2'));var rs=require(_0x6614('0x3'));var fs=require('fs');var Redis=require(_0x6614('0x4'));var db=require(_0x6614('0x5'))['db'];var utils=require(_0x6614('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6614('0x7'));var jayson=require(_0x6614('0x8'));var client=jayson[_0x6614('0x9')][_0x6614('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b2c0d,_0x33112a,_0x39f8a3){return new BPromise(function(_0x50c611,_0x1e5fcb){return client['request'](_0x2b2c0d,_0x39f8a3)[_0x6614('0xb')](function(_0x53e4af){logger[_0x6614('0xc')](_0x6614('0xd'),_0x33112a,_0x6614('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x33112a,_0x6614('0xe'),JSON[_0x6614('0xf')](_0x53e4af));if(_0x53e4af[_0x6614('0x10')]){if(_0x53e4af[_0x6614('0x10')][_0x6614('0x11')]===0x1f4){logger[_0x6614('0x10')](_0x6614('0xd'),_0x33112a,_0x53e4af['error'][_0x6614('0x12')]);return _0x1e5fcb(_0x53e4af[_0x6614('0x10')][_0x6614('0x12')]);}logger['error'](_0x6614('0xd'),_0x33112a,_0x53e4af[_0x6614('0x10')][_0x6614('0x12')]);return _0x50c611(_0x53e4af['error']['message']);}else{logger[_0x6614('0xc')](_0x6614('0xd'),_0x33112a,_0x6614('0xe'));_0x50c611(_0x53e4af['result']['message']);}})[_0x6614('0x13')](function(_0x1dd0d2){logger[_0x6614('0x10')](_0x6614('0xd'),_0x33112a,_0x1dd0d2);_0x1e5fcb(_0x1dd0d2);});});}exports['ShowSound']=function(_0x26c8bf){var _0x5626cc=this;return new Promise(function(_0x31f92d,_0x573547){return db[_0x6614('0x14')][_0x6614('0x15')]({'raw':_0x26c8bf[_0x6614('0x16')]?_0x26c8bf['options']['raw']===undefined?!![]:![]:!![],'where':_0x26c8bf[_0x6614('0x16')]?_0x26c8bf['options']['where']||null:null,'attributes':_0x26c8bf[_0x6614('0x16')]?_0x26c8bf[_0x6614('0x16')][_0x6614('0x17')]||null:null,'include':_0x26c8bf[_0x6614('0x16')]?_0x26c8bf['options'][_0x6614('0x18')]?_['map'](_0x26c8bf[_0x6614('0x16')][_0x6614('0x18')],function(_0x36e98f){return{'model':db[_0x36e98f[_0x6614('0x19')]],'as':_0x36e98f['as'],'attributes':_0x36e98f['attributes'],'include':_0x36e98f[_0x6614('0x18')]?_['map'](_0x36e98f[_0x6614('0x18')],function(_0x520c81){return{'model':db[_0x520c81[_0x6614('0x19')]],'as':_0x520c81['as'],'attributes':_0x520c81[_0x6614('0x17')],'include':_0x520c81[_0x6614('0x18')]?_[_0x6614('0x1a')](_0x520c81[_0x6614('0x18')],function(_0x4e1b42){return{'model':db[_0x4e1b42['model']],'as':_0x4e1b42['as'],'attributes':_0x4e1b42['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x222787){logger[_0x6614('0xc')](_0x6614('0x1b'),_0x26c8bf);logger['debug'](_0x6614('0x1b'),_0x26c8bf,JSON[_0x6614('0xf')](_0x222787));_0x31f92d(_0x222787);})[_0x6614('0x13')](function(_0x19eacf){logger[_0x6614('0x10')](_0x6614('0x1b'),_0x19eacf[_0x6614('0x12')],_0x26c8bf);_0x573547(_0x5626cc[_0x6614('0x10')](0x1f4,_0x19eacf[_0x6614('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b6f41ff..89c60df 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xda2d,0x102));var _0xdda2=function(_0x3aee6e,_0x28a8e8){_0x3aee6e=_0x3aee6e-0x0;var _0x3c3948=_0xda2d[_0x3aee6e];return _0x3c3948;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0xf21e71,_0x16e276){var _0x1a0e33=function(_0x857e1){while(--_0x857e1){_0xf21e71['push'](_0xf21e71['shift']());}};_0x1a0e33(++_0x16e276);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index d671252..b82408b 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 _0x8f04=['ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f04,0x176));var _0x48f0=function(_0xe4bb6d,_0x2723ee){_0xe4bb6d=_0xe4bb6d-0x0;var _0x15cfe6=_0x8f04[_0xe4bb6d];return _0x15cfe6;};'use strict';var Sequelize=require(_0x48f0('0x0'));module[_0x48f0('0x1')]={'uniqueid':{'type':Sequelize[_0x48f0('0x2')]},'body':{'type':Sequelize[_0x48f0('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x48f0('0x4')]('in','out'),'defaultValue':_0x48f0('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x48f0('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4fb1=['out','sequelize','STRING','TEXT','medium','ENUM'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x4fb1,0x8b));var _0x14fb=function(_0x15da57,_0x1f1240){_0x15da57=_0x15da57-0x0;var _0x1933b1=_0x4fb1[_0x15da57];return _0x1933b1;};'use strict';var Sequelize=require(_0x14fb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x14fb('0x1')]},'body':{'type':Sequelize[_0x14fb('0x2')](_0x14fb('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x14fb('0x4')]('in',_0x14fb('0x5')),'defaultValue':_0x14fb('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x14fb('0x1')]},'providerResponse':{'type':Sequelize[_0x14fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 5be923e..cc0d7f8 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 _0x5d30=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','filters','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','then','destroy','error','stack','name','send','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter'];(function(_0x3e6ee3,_0x497ba4){var _0x44a25a=function(_0x22222e){while(--_0x22222e){_0x3e6ee3['push'](_0x3e6ee3['shift']());}};_0x44a25a(++_0x497ba4);}(_0x5d30,0x135));var _0x05d3=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0x5d30[_0x61b3ab];return _0x57097f;};'use strict';var emlformat=require(_0x05d3('0x0'));var rimraf=require(_0x05d3('0x1'));var zipdir=require(_0x05d3('0x2'));var jsonpatch=require(_0x05d3('0x3'));var rp=require(_0x05d3('0x4'));var moment=require(_0x05d3('0x5'));var BPromise=require(_0x05d3('0x6'));var Mustache=require(_0x05d3('0x7'));var util=require(_0x05d3('0x8'));var path=require(_0x05d3('0x9'));var sox=require(_0x05d3('0xa'));var csv=require(_0x05d3('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05d3('0xc'));var _=require('lodash');var squel=require(_0x05d3('0xd'));var crypto=require(_0x05d3('0xe'));var jsforce=require(_0x05d3('0xf'));var deskjs=require(_0x05d3('0x10'));var toCsv=require(_0x05d3('0xb'));var querystring=require('querystring');var Papa=require(_0x05d3('0x11'));var Redis=require('ioredis');var authService=require(_0x05d3('0x12'));var qs=require(_0x05d3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x05d3('0x14'));var config=require(_0x05d3('0x15'));var licenseUtil=require(_0x05d3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x586326,_0x133b67){_0x133b67=_0x133b67||0xcc;return function(_0x108731){if(_0x108731){return _0x586326[_0x05d3('0x17')](_0x133b67);}return _0x586326[_0x05d3('0x18')](_0x133b67)[_0x05d3('0x19')]();};}function respondWithResult(_0x13278f,_0x3cdd0d){_0x3cdd0d=_0x3cdd0d||0xc8;return function(_0x773a31){if(_0x773a31){return _0x13278f['status'](_0x3cdd0d)[_0x05d3('0x1a')](_0x773a31);}};}function respondWithFilteredResult(_0x3a0e4c,_0x190525){return function(_0x1d56c1){if(_0x1d56c1){var _0x64bc41=typeof _0x190525[_0x05d3('0x1b')]==='undefined'&&typeof _0x190525['limit']===_0x05d3('0x1c');var _0x118343=_0x1d56c1[_0x05d3('0x1d')];var _0x5256f6=_0x64bc41?0x0:_0x190525[_0x05d3('0x1b')];var _0xce4f77=_0x64bc41?_0x1d56c1[_0x05d3('0x1d')]:_0x190525['offset']+_0x190525[_0x05d3('0x1e')];var _0x3e4822;if(_0xce4f77>=_0x118343){_0xce4f77=_0x118343;_0x3e4822=0xc8;}else{_0x3e4822=0xce;}_0x3a0e4c['status'](_0x3e4822);return _0x3a0e4c[_0x05d3('0x1f')]('Content-Range',_0x5256f6+'-'+_0xce4f77+'/'+_0x118343)[_0x05d3('0x1a')](_0x1d56c1);}return null;};}function patchUpdates(_0x1a8206){return function(_0x571bd9){try{jsonpatch[_0x05d3('0x20')](_0x571bd9,_0x1a8206,!![]);}catch(_0x3a5528){return BPromise[_0x05d3('0x21')](_0x3a5528);}return _0x571bd9['save']();};}function saveUpdates(_0x3e20a4,_0x1c209c){return function(_0x27bb32){if(_0x27bb32){return _0x27bb32['update'](_0x3e20a4)[_0x05d3('0x22')](function(_0x454965){return _0x454965;});}return null;};}function removeEntity(_0x359bf7,_0x13af4d){return function(_0x2504b9){if(_0x2504b9){return _0x2504b9[_0x05d3('0x23')]()[_0x05d3('0x22')](function(){_0x359bf7[_0x05d3('0x18')](0xcc)[_0x05d3('0x19')]();});}};}function handleEntityNotFound(_0x3885fa,_0x4fd4aa){return function(_0x55bdae){if(!_0x55bdae){_0x3885fa[_0x05d3('0x17')](0x194);}return _0x55bdae;};}function handleError(_0x46568e,_0x1daf46){_0x1daf46=_0x1daf46||0x1f4;return function(_0x3cc1e2){logger[_0x05d3('0x24')](_0x3cc1e2[_0x05d3('0x25')]);if(_0x3cc1e2[_0x05d3('0x26')]){delete _0x3cc1e2[_0x05d3('0x26')];}_0x46568e[_0x05d3('0x18')](_0x1daf46)[_0x05d3('0x27')](_0x3cc1e2);};}exports['index']=function(_0x44ad63,_0x1b8ed0){var _0x4a344d={},_0x12f676={},_0x11f0ee={'count':0x0,'rows':[]};var _0x4074fd=_[_0x05d3('0x28')](db[_0x05d3('0x29')][_0x05d3('0x2a')],function(_0x5de653){return{'name':_0x5de653[_0x05d3('0x2b')],'type':_0x5de653[_0x05d3('0x2c')][_0x05d3('0x2d')]};});_0x12f676[_0x05d3('0x2e')]=_[_0x05d3('0x28')](_0x4074fd,_0x05d3('0x26'));_0x12f676[_0x05d3('0x2f')]=_['keys'](_0x44ad63['query']);_0x12f676['filters']=_[_0x05d3('0x30')](_0x12f676[_0x05d3('0x2e')],_0x12f676[_0x05d3('0x2f')]);_0x4a344d['attributes']=_[_0x05d3('0x30')](_0x12f676['model'],qs['fields'](_0x44ad63['query']['fields']));_0x4a344d[_0x05d3('0x31')]=_0x4a344d['attributes'][_0x05d3('0x32')]?_0x4a344d[_0x05d3('0x31')]:_0x12f676[_0x05d3('0x2e')];if(!_0x44ad63['query'][_0x05d3('0x33')](_0x05d3('0x34'))){_0x4a344d[_0x05d3('0x1e')]=qs[_0x05d3('0x1e')](_0x44ad63[_0x05d3('0x2f')][_0x05d3('0x1e')]);_0x4a344d[_0x05d3('0x1b')]=qs[_0x05d3('0x1b')](_0x44ad63[_0x05d3('0x2f')]['offset']);}_0x4a344d['order']=qs[_0x05d3('0x35')](_0x44ad63[_0x05d3('0x2f')][_0x05d3('0x35')]);_0x4a344d['where']=qs['filters'](_[_0x05d3('0x36')](_0x44ad63['query'],_0x12f676['filters']),_0x4074fd);if(_0x44ad63[_0x05d3('0x2f')][_0x05d3('0x37')]){_0x4a344d[_0x05d3('0x38')]=_[_0x05d3('0x39')](_0x4a344d['where'],{'$or':_[_0x05d3('0x28')](_0x4074fd,function(_0x2fb29e){if(_0x2fb29e[_0x05d3('0x2c')]!==_0x05d3('0x3a')){var _0x2efec9={};_0x2efec9[_0x2fb29e[_0x05d3('0x26')]]={'$like':'%'+_0x44ad63['query'][_0x05d3('0x37')]+'%'};return _0x2efec9;}})});}_0x4a344d=_[_0x05d3('0x39')]({},_0x4a344d,_0x44ad63[_0x05d3('0x3b')]);var _0x1320ca={'where':_0x4a344d[_0x05d3('0x38')]};return db['SquareMessage']['count'](_0x1320ca)[_0x05d3('0x22')](function(_0x3c0b49){_0x11f0ee[_0x05d3('0x1d')]=_0x3c0b49;if(_0x44ad63[_0x05d3('0x2f')][_0x05d3('0x3c')]){_0x4a344d[_0x05d3('0x3d')]=[{'all':!![]}];}return db[_0x05d3('0x29')][_0x05d3('0x3e')](_0x4a344d);})[_0x05d3('0x22')](function(_0x21310c){_0x11f0ee[_0x05d3('0x3f')]=_0x21310c;return _0x11f0ee;})[_0x05d3('0x22')](respondWithFilteredResult(_0x1b8ed0,_0x4a344d))[_0x05d3('0x40')](handleError(_0x1b8ed0,null));};exports[_0x05d3('0x41')]=function(_0x207882,_0x58f1f5){var _0x34d3f3={'raw':!![],'where':{'id':_0x207882[_0x05d3('0x42')]['id']}},_0x25194f={};_0x25194f[_0x05d3('0x2e')]=_[_0x05d3('0x43')](db[_0x05d3('0x29')][_0x05d3('0x2a')]);_0x25194f['query']=_[_0x05d3('0x43')](_0x207882[_0x05d3('0x2f')]);_0x25194f[_0x05d3('0x44')]=_[_0x05d3('0x30')](_0x25194f[_0x05d3('0x2e')],_0x25194f[_0x05d3('0x2f')]);_0x34d3f3[_0x05d3('0x31')]=_['intersection'](_0x25194f[_0x05d3('0x2e')],qs['fields'](_0x207882[_0x05d3('0x2f')]['fields']));_0x34d3f3['attributes']=_0x34d3f3[_0x05d3('0x31')][_0x05d3('0x32')]?_0x34d3f3['attributes']:_0x25194f[_0x05d3('0x2e')];if(_0x207882[_0x05d3('0x2f')][_0x05d3('0x3c')]){_0x34d3f3[_0x05d3('0x3d')]=[{'all':!![]}];}_0x34d3f3=_[_0x05d3('0x39')]({},_0x34d3f3,_0x207882[_0x05d3('0x3b')]);return db[_0x05d3('0x29')][_0x05d3('0x45')](_0x34d3f3)[_0x05d3('0x22')](handleEntityNotFound(_0x58f1f5,null))[_0x05d3('0x22')](respondWithResult(_0x58f1f5,null))['catch'](handleError(_0x58f1f5,null));};exports[_0x05d3('0x46')]=function(_0xe49019,_0x27cfb6){return db['SquareMessage']['create'](_0xe49019[_0x05d3('0x47')],{})[_0x05d3('0x22')](respondWithResult(_0x27cfb6,0xc9))['catch'](handleError(_0x27cfb6,null));};exports[_0x05d3('0x48')]=function(_0x11b0ba,_0x2eb2ef){if(_0x11b0ba['body']['id']){delete _0x11b0ba[_0x05d3('0x47')]['id'];}return db[_0x05d3('0x29')]['find']({'where':{'id':_0x11b0ba[_0x05d3('0x42')]['id']}})['then'](handleEntityNotFound(_0x2eb2ef,null))[_0x05d3('0x22')](saveUpdates(_0x11b0ba[_0x05d3('0x47')],null))[_0x05d3('0x22')](respondWithResult(_0x2eb2ef,null))['catch'](handleError(_0x2eb2ef,null));};exports[_0x05d3('0x23')]=function(_0x26dcda,_0x3eab6a){return db[_0x05d3('0x29')][_0x05d3('0x45')]({'where':{'id':_0x26dcda[_0x05d3('0x42')]['id']}})[_0x05d3('0x22')](handleEntityNotFound(_0x3eab6a,null))[_0x05d3('0x22')](removeEntity(_0x3eab6a,null))[_0x05d3('0x40')](handleError(_0x3eab6a,null));}; \ No newline at end of file +var _0xf3d0=['name','filter','includeAll','findAll','catch','show','params','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','map','SquareMessage','rawAttributes','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0xf3d0,0x160));var _0x0f3d=function(_0x26592a,_0x15b3d3){_0x26592a=_0x26592a-0x0;var _0x37acfa=_0xf3d0[_0x26592a];return _0x37acfa;};'use strict';var emlformat=require(_0x0f3d('0x0'));var rimraf=require(_0x0f3d('0x1'));var zipdir=require(_0x0f3d('0x2'));var jsonpatch=require(_0x0f3d('0x3'));var rp=require('request-promise');var moment=require(_0x0f3d('0x4'));var BPromise=require(_0x0f3d('0x5'));var Mustache=require(_0x0f3d('0x6'));var util=require(_0x0f3d('0x7'));var path=require(_0x0f3d('0x8'));var sox=require('sox');var csv=require(_0x0f3d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f3d('0xa'));var _=require(_0x0f3d('0xb'));var squel=require('squel');var crypto=require(_0x0f3d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0f3d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0f3d('0xe'));var as=require(_0x0f3d('0xf'));var hardwareService=require(_0x0f3d('0x10'));var logger=require('../../config/logger')(_0x0f3d('0x11'));var utils=require(_0x0f3d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0f3d('0x13'));var db=require(_0x0f3d('0x14'))['db'];function respondWithStatusCode(_0x4138ce,_0x5b78cd){_0x5b78cd=_0x5b78cd||0xcc;return function(_0x370450){if(_0x370450){return _0x4138ce[_0x0f3d('0x15')](_0x5b78cd);}return _0x4138ce['status'](_0x5b78cd)[_0x0f3d('0x16')]();};}function respondWithResult(_0x521846,_0x5b9ffb){_0x5b9ffb=_0x5b9ffb||0xc8;return function(_0x1e7874){if(_0x1e7874){return _0x521846[_0x0f3d('0x17')](_0x5b9ffb)[_0x0f3d('0x18')](_0x1e7874);}};}function respondWithFilteredResult(_0x5e6fcc,_0x188110){return function(_0x415053){if(_0x415053){var _0x205d2f=typeof _0x188110['offset']===_0x0f3d('0x19')&&typeof _0x188110[_0x0f3d('0x1a')]===_0x0f3d('0x19');var _0x444d61=_0x415053[_0x0f3d('0x1b')];var _0x5eb0c1=_0x205d2f?0x0:_0x188110[_0x0f3d('0x1c')];var _0x19b85f=_0x205d2f?_0x415053['count']:_0x188110[_0x0f3d('0x1c')]+_0x188110[_0x0f3d('0x1a')];var _0x4f1149;if(_0x19b85f>=_0x444d61){_0x19b85f=_0x444d61;_0x4f1149=0xc8;}else{_0x4f1149=0xce;}_0x5e6fcc[_0x0f3d('0x17')](_0x4f1149);return _0x5e6fcc[_0x0f3d('0x1d')](_0x0f3d('0x1e'),_0x5eb0c1+'-'+_0x19b85f+'/'+_0x444d61)[_0x0f3d('0x18')](_0x415053);}return null;};}function patchUpdates(_0xae0cd0){return function(_0x4f3ab2){try{jsonpatch[_0x0f3d('0x1f')](_0x4f3ab2,_0xae0cd0,!![]);}catch(_0x32b41f){return BPromise[_0x0f3d('0x20')](_0x32b41f);}return _0x4f3ab2['save']();};}function saveUpdates(_0x13638d,_0x18a5c5){return function(_0x3e0f94){if(_0x3e0f94){return _0x3e0f94[_0x0f3d('0x21')](_0x13638d)[_0x0f3d('0x22')](function(_0x55d846){return _0x55d846;});}return null;};}function removeEntity(_0x331ec3,_0x40e83e){return function(_0x3a362d){if(_0x3a362d){return _0x3a362d[_0x0f3d('0x23')]()[_0x0f3d('0x22')](function(){_0x331ec3[_0x0f3d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c89a0,_0x357866){return function(_0x16c8fb){if(!_0x16c8fb){_0x8c89a0['sendStatus'](0x194);}return _0x16c8fb;};}function handleError(_0x2bacb5,_0x3abe5b){_0x3abe5b=_0x3abe5b||0x1f4;return function(_0x47b536){logger[_0x0f3d('0x24')](_0x47b536[_0x0f3d('0x25')]);if(_0x47b536['name']){delete _0x47b536['name'];}_0x2bacb5[_0x0f3d('0x17')](_0x3abe5b)[_0x0f3d('0x26')](_0x47b536);};}exports['index']=function(_0x2fceca,_0xc98a0){var _0x128a81={},_0x9a3ee2={},_0x43664a={'count':0x0,'rows':[]};var _0x5e3b1e=_[_0x0f3d('0x27')](db[_0x0f3d('0x28')][_0x0f3d('0x29')],function(_0x3d0fb5){return{'name':_0x3d0fb5['fieldName'],'type':_0x3d0fb5[_0x0f3d('0x2a')]['key']};});_0x9a3ee2[_0x0f3d('0x2b')]=_[_0x0f3d('0x27')](_0x5e3b1e,'name');_0x9a3ee2[_0x0f3d('0x2c')]=_[_0x0f3d('0x2d')](_0x2fceca[_0x0f3d('0x2c')]);_0x9a3ee2[_0x0f3d('0x2e')]=_['intersection'](_0x9a3ee2['model'],_0x9a3ee2[_0x0f3d('0x2c')]);_0x128a81[_0x0f3d('0x2f')]=_['intersection'](_0x9a3ee2[_0x0f3d('0x2b')],qs[_0x0f3d('0x30')](_0x2fceca['query'][_0x0f3d('0x30')]));_0x128a81[_0x0f3d('0x2f')]=_0x128a81[_0x0f3d('0x2f')][_0x0f3d('0x31')]?_0x128a81['attributes']:_0x9a3ee2[_0x0f3d('0x2b')];if(!_0x2fceca[_0x0f3d('0x2c')]['hasOwnProperty'](_0x0f3d('0x32'))){_0x128a81[_0x0f3d('0x1a')]=qs[_0x0f3d('0x1a')](_0x2fceca[_0x0f3d('0x2c')][_0x0f3d('0x1a')]);_0x128a81[_0x0f3d('0x1c')]=qs[_0x0f3d('0x1c')](_0x2fceca[_0x0f3d('0x2c')]['offset']);}_0x128a81[_0x0f3d('0x33')]=qs[_0x0f3d('0x34')](_0x2fceca[_0x0f3d('0x2c')][_0x0f3d('0x34')]);_0x128a81[_0x0f3d('0x35')]=qs['filters'](_['pick'](_0x2fceca[_0x0f3d('0x2c')],_0x9a3ee2[_0x0f3d('0x2e')]),_0x5e3b1e);if(_0x2fceca[_0x0f3d('0x2c')]['filter']){_0x128a81['where']=_[_0x0f3d('0x36')](_0x128a81[_0x0f3d('0x35')],{'$or':_['map'](_0x5e3b1e,function(_0x5098aa){if(_0x5098aa[_0x0f3d('0x2a')]!==_0x0f3d('0x37')){var _0x39c804={};_0x39c804[_0x5098aa[_0x0f3d('0x38')]]={'$like':'%'+_0x2fceca[_0x0f3d('0x2c')][_0x0f3d('0x39')]+'%'};return _0x39c804;}})});}_0x128a81=_[_0x0f3d('0x36')]({},_0x128a81,_0x2fceca['options']);var _0x29fc70={'where':_0x128a81[_0x0f3d('0x35')]};return db[_0x0f3d('0x28')]['count'](_0x29fc70)[_0x0f3d('0x22')](function(_0x9bc5f8){_0x43664a[_0x0f3d('0x1b')]=_0x9bc5f8;if(_0x2fceca['query'][_0x0f3d('0x3a')]){_0x128a81['include']=[{'all':!![]}];}return db[_0x0f3d('0x28')][_0x0f3d('0x3b')](_0x128a81);})[_0x0f3d('0x22')](function(_0x53ce1e){_0x43664a['rows']=_0x53ce1e;return _0x43664a;})['then'](respondWithFilteredResult(_0xc98a0,_0x128a81))[_0x0f3d('0x3c')](handleError(_0xc98a0,null));};exports[_0x0f3d('0x3d')]=function(_0x2e103b,_0x23020e){var _0x126433={'raw':!![],'where':{'id':_0x2e103b[_0x0f3d('0x3e')]['id']}},_0x30ef8a={};_0x30ef8a[_0x0f3d('0x2b')]=_[_0x0f3d('0x2d')](db[_0x0f3d('0x28')][_0x0f3d('0x29')]);_0x30ef8a['query']=_['keys'](_0x2e103b[_0x0f3d('0x2c')]);_0x30ef8a['filters']=_[_0x0f3d('0x3f')](_0x30ef8a[_0x0f3d('0x2b')],_0x30ef8a[_0x0f3d('0x2c')]);_0x126433[_0x0f3d('0x2f')]=_['intersection'](_0x30ef8a[_0x0f3d('0x2b')],qs[_0x0f3d('0x30')](_0x2e103b['query']['fields']));_0x126433[_0x0f3d('0x2f')]=_0x126433[_0x0f3d('0x2f')][_0x0f3d('0x31')]?_0x126433['attributes']:_0x30ef8a['model'];if(_0x2e103b[_0x0f3d('0x2c')]['includeAll']){_0x126433[_0x0f3d('0x40')]=[{'all':!![]}];}_0x126433=_['merge']({},_0x126433,_0x2e103b['options']);return db['SquareMessage'][_0x0f3d('0x41')](_0x126433)[_0x0f3d('0x22')](handleEntityNotFound(_0x23020e,null))['then'](respondWithResult(_0x23020e,null))['catch'](handleError(_0x23020e,null));};exports[_0x0f3d('0x42')]=function(_0x88f6e0,_0x4fe1b2){return db['SquareMessage'][_0x0f3d('0x42')](_0x88f6e0[_0x0f3d('0x43')],{})[_0x0f3d('0x22')](respondWithResult(_0x4fe1b2,0xc9))[_0x0f3d('0x3c')](handleError(_0x4fe1b2,null));};exports[_0x0f3d('0x21')]=function(_0xa64698,_0x419806){if(_0xa64698[_0x0f3d('0x43')]['id']){delete _0xa64698[_0x0f3d('0x43')]['id'];}return db[_0x0f3d('0x28')][_0x0f3d('0x41')]({'where':{'id':_0xa64698[_0x0f3d('0x3e')]['id']}})[_0x0f3d('0x22')](handleEntityNotFound(_0x419806,null))[_0x0f3d('0x22')](saveUpdates(_0xa64698[_0x0f3d('0x43')],null))[_0x0f3d('0x22')](respondWithResult(_0x419806,null))[_0x0f3d('0x3c')](handleError(_0x419806,null));};exports[_0x0f3d('0x23')]=function(_0x33028b,_0x3004c5){return db[_0x0f3d('0x28')][_0x0f3d('0x41')]({'where':{'id':_0x33028b[_0x0f3d('0x3e')]['id']}})[_0x0f3d('0x22')](handleEntityNotFound(_0x3004c5,null))['then'](removeEntity(_0x3004c5,null))[_0x0f3d('0x3c')](handleError(_0x3004c5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3d87327..ea74a22 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 _0xe79c=['define','SquareMessage','square_messages','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5770ea,_0x2973dc){var _0x40d868=function(_0x1c7053){while(--_0x1c7053){_0x5770ea['push'](_0x5770ea['shift']());}};_0x40d868(++_0x2973dc);}(_0xe79c,0x117));var _0xce79=function(_0x5d688d,_0x2103cc){_0x5d688d=_0x5d688d-0x0;var _0x41a514=_0xe79c[_0x5d688d];return _0x41a514;};'use strict';var _=require(_0xce79('0x0'));var util=require(_0xce79('0x1'));var logger=require(_0xce79('0x2'))('api');var moment=require(_0xce79('0x3'));var BPromise=require('bluebird');var rp=require(_0xce79('0x4'));var fs=require('fs');var path=require(_0xce79('0x5'));var rimraf=require(_0xce79('0x6'));var config=require(_0xce79('0x7'));var attributes=require('./squareMessage.attributes');module[_0xce79('0x8')]=function(_0x2c6389,_0x1e7dd7){return _0x2c6389[_0xce79('0x9')](_0xce79('0xa'),attributes,{'tableName':_0xce79('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bf0=['path','../../config/environment','./squareMessage.attributes','exports','define','square_messages','util','api','bluebird'];(function(_0x3296d1,_0x14a8a7){var _0x1df975=function(_0x111bb5){while(--_0x111bb5){_0x3296d1['push'](_0x3296d1['shift']());}};_0x1df975(++_0x14a8a7);}(_0x9bf0,0x14a));var _0x09bf=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x9bf0[_0x4cbf20];return _0x582ae4;};'use strict';var _=require('lodash');var util=require(_0x09bf('0x0'));var logger=require('../../config/logger')(_0x09bf('0x1'));var moment=require('moment');var BPromise=require(_0x09bf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09bf('0x3'));var rimraf=require('rimraf');var config=require(_0x09bf('0x4'));var attributes=require(_0x09bf('0x5'));module[_0x09bf('0x6')]=function(_0x2fb85b,_0x52556c){return _0x2fb85b[_0x09bf('0x7')]('SquareMessage',attributes,{'tableName':_0x09bf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 7d082d3..ca991bf 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 _0xb4a6=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','options','raw','then','info','CreateSquareMessage','lodash','util','moment','bluebird','randomstring'];(function(_0x44400d,_0x2167c7){var _0x32c4ba=function(_0x36dda7){while(--_0x36dda7){_0x44400d['push'](_0x44400d['shift']());}};_0x32c4ba(++_0x2167c7);}(_0xb4a6,0x9d));var _0x6b4a=function(_0x1b9720,_0x4310b8){_0x1b9720=_0x1b9720-0x0;var _0x22db39=_0xb4a6[_0x1b9720];return _0x22db39;};'use strict';var _=require(_0x6b4a('0x0'));var util=require(_0x6b4a('0x1'));var moment=require(_0x6b4a('0x2'));var BPromise=require(_0x6b4a('0x3'));var rs=require(_0x6b4a('0x4'));var fs=require('fs');var Redis=require(_0x6b4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6b4a('0x6'))('rpc');var config=require(_0x6b4a('0x7'));var jayson=require(_0x6b4a('0x8'));var client=jayson[_0x6b4a('0x9')][_0x6b4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b0372,_0x34d34a,_0x2bcbf8){return new BPromise(function(_0x5bfcef,_0x31fb87){return client['request'](_0x3b0372,_0x2bcbf8)['then'](function(_0x95066a){logger['info'](_0x6b4a('0xb'),_0x34d34a,_0x6b4a('0xc'));logger[_0x6b4a('0xd')](_0x6b4a('0xe'),_0x34d34a,_0x6b4a('0xc'),JSON[_0x6b4a('0xf')](_0x95066a));if(_0x95066a[_0x6b4a('0x10')]){if(_0x95066a[_0x6b4a('0x10')][_0x6b4a('0x11')]===0x1f4){logger['error'](_0x6b4a('0xb'),_0x34d34a,_0x95066a[_0x6b4a('0x10')]['message']);return _0x31fb87(_0x95066a['error'][_0x6b4a('0x12')]);}logger['error'](_0x6b4a('0xb'),_0x34d34a,_0x95066a[_0x6b4a('0x10')][_0x6b4a('0x12')]);return _0x5bfcef(_0x95066a[_0x6b4a('0x10')][_0x6b4a('0x12')]);}else{logger['info'](_0x6b4a('0xb'),_0x34d34a,_0x6b4a('0xc'));_0x5bfcef(_0x95066a[_0x6b4a('0x13')]['message']);}})[_0x6b4a('0x14')](function(_0x146717){logger[_0x6b4a('0x10')](_0x6b4a('0xb'),_0x34d34a,_0x146717);_0x31fb87(_0x146717);});});}exports['CreateSquareMessage']=function(_0x1048a3){var _0x41ad3f=this;return new Promise(function(_0x5e9a56,_0x1186ee){return db['SquareMessage'][_0x6b4a('0x15')](_0x1048a3['body'],{'raw':_0x1048a3[_0x6b4a('0x16')]?_0x1048a3[_0x6b4a('0x16')][_0x6b4a('0x17')]===undefined?!![]:![]:!![]})[_0x6b4a('0x18')](function(_0x1ccf61){logger[_0x6b4a('0x19')](_0x6b4a('0x1a'),_0x1048a3);logger[_0x6b4a('0xd')](_0x6b4a('0x1a'),_0x1048a3,JSON[_0x6b4a('0xf')](_0x1ccf61));_0x5e9a56(_0x1ccf61);})[_0x6b4a('0x14')](function(_0x4a07c2){logger[_0x6b4a('0x10')](_0x6b4a('0x1a'),_0x4a07c2[_0x6b4a('0x12')],_0x1048a3);_0x1186ee(_0x41ad3f[_0x6b4a('0x10')](0x1f4,_0x4a07c2[_0x6b4a('0x12')]));});});}; \ No newline at end of file +var _0x833a=['client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareMessage','body','options','raw','CreateSquareMessage','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4cd727,_0x37335e){var _0x9f3a81=function(_0x2940bd){while(--_0x2940bd){_0x4cd727['push'](_0x4cd727['shift']());}};_0x9f3a81(++_0x37335e);}(_0x833a,0x10f));var _0xa833=function(_0x20a67a,_0x519dee){_0x20a67a=_0x20a67a-0x0;var _0x777bd7=_0x833a[_0x20a67a];return _0x777bd7;};'use strict';var _=require(_0xa833('0x0'));var util=require(_0xa833('0x1'));var moment=require(_0xa833('0x2'));var BPromise=require(_0xa833('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa833('0x4'));var db=require(_0xa833('0x5'))['db'];var utils=require(_0xa833('0x6'));var logger=require(_0xa833('0x7'))('rpc');var config=require(_0xa833('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa833('0x9')][_0xa833('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fdd1a,_0x3f05e3,_0x6d016f){return new BPromise(function(_0x23582e,_0x44ebac){return client[_0xa833('0xb')](_0x4fdd1a,_0x6d016f)['then'](function(_0x2ea7e6){logger[_0xa833('0xc')](_0xa833('0xd'),_0x3f05e3,_0xa833('0xe'));logger['debug'](_0xa833('0xf'),_0x3f05e3,_0xa833('0xe'),JSON[_0xa833('0x10')](_0x2ea7e6));if(_0x2ea7e6[_0xa833('0x11')]){if(_0x2ea7e6[_0xa833('0x11')][_0xa833('0x12')]===0x1f4){logger[_0xa833('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3f05e3,_0x2ea7e6[_0xa833('0x11')]['message']);return _0x44ebac(_0x2ea7e6['error'][_0xa833('0x13')]);}logger[_0xa833('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3f05e3,_0x2ea7e6[_0xa833('0x11')][_0xa833('0x13')]);return _0x23582e(_0x2ea7e6[_0xa833('0x11')][_0xa833('0x13')]);}else{logger[_0xa833('0xc')](_0xa833('0xd'),_0x3f05e3,_0xa833('0xe'));_0x23582e(_0x2ea7e6[_0xa833('0x14')][_0xa833('0x13')]);}})[_0xa833('0x15')](function(_0x361624){logger[_0xa833('0x11')](_0xa833('0xd'),_0x3f05e3,_0x361624);_0x44ebac(_0x361624);});});}exports['CreateSquareMessage']=function(_0x6be428){var _0x5ea276=this;return new Promise(function(_0x380c6e,_0x597775){return db[_0xa833('0x16')]['create'](_0x6be428[_0xa833('0x17')],{'raw':_0x6be428['options']?_0x6be428[_0xa833('0x18')][_0xa833('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3dc062){logger[_0xa833('0xc')](_0xa833('0x1a'),_0x6be428);logger[_0xa833('0x1b')](_0xa833('0x1a'),_0x6be428,JSON['stringify'](_0x3dc062));_0x380c6e(_0x3dc062);})['catch'](function(_0x25121b){logger[_0xa833('0x11')](_0xa833('0x1a'),_0x25121b[_0xa833('0x13')],_0x6be428);_0x597775(_0x5ea276[_0xa833('0x11')](0x1f4,_0x25121b[_0xa833('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 899dfd8..eb6f146 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 _0x304e=['fs-extra','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x1d7599,_0x49929f){var _0x55da12=function(_0x3f7a5f){while(--_0x3f7a5f){_0x1d7599['push'](_0x1d7599['shift']());}};_0x55da12(++_0x49929f);}(_0x304e,0x1b5));var _0xe304=function(_0x5356f5,_0x412004){_0x5356f5=_0x5356f5-0x0;var _0x5595a5=_0x304e[_0x5356f5];return _0x5595a5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe304('0x0'));var timeout=require(_0xe304('0x1'));var express=require(_0xe304('0x2'));var router=express[_0xe304('0x3')]();var fs_extra=require(_0xe304('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe304('0x5'));var config=require('../../config/environment');var controller=require(_0xe304('0x6'));router[_0xe304('0x7')]('/',auth[_0xe304('0x8')](),controller[_0xe304('0x9')]);router[_0xe304('0x7')](_0xe304('0xa'),auth[_0xe304('0x8')](),controller[_0xe304('0xb')]);router[_0xe304('0x7')](_0xe304('0xc'),auth['isAuthenticated'](),timeout(_0xe304('0xd')),controller[_0xe304('0xe')]);router[_0xe304('0xf')]('/',auth[_0xe304('0x8')](),controller[_0xe304('0x10')]);router['put'](_0xe304('0xa'),auth[_0xe304('0x8')](),controller[_0xe304('0x11')]);router[_0xe304('0x12')](_0xe304('0xa'),auth[_0xe304('0x8')](),controller[_0xe304('0x13')]);module[_0xe304('0x14')]=router; \ No newline at end of file +var _0xdeff=['test','post','create','put','/:id','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show'];(function(_0x1f1c15,_0x479902){var _0xd09c74=function(_0x3dca16){while(--_0x3dca16){_0x1f1c15['push'](_0x1f1c15['shift']());}};_0xd09c74(++_0x479902);}(_0xdeff,0x116));var _0xfdef=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0xdeff[_0x1f99a0];return _0x1e0849;};'use strict';var multer=require('multer');var util=require(_0xfdef('0x0'));var path=require('path');var timeout=require(_0xfdef('0x1'));var express=require(_0xfdef('0x2'));var router=express[_0xfdef('0x3')]();var fs_extra=require(_0xfdef('0x4'));var auth=require(_0xfdef('0x5'));var interaction=require(_0xfdef('0x6'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0xfdef('0x7')]('/',auth[_0xfdef('0x8')](),controller['index']);router[_0xfdef('0x7')]('/:id',auth[_0xfdef('0x8')](),controller[_0xfdef('0x9')]);router[_0xfdef('0x7')]('/:id/test',auth[_0xfdef('0x8')](),timeout('15s'),controller[_0xfdef('0xa')]);router[_0xfdef('0xb')]('/',auth[_0xfdef('0x8')](),controller[_0xfdef('0xc')]);router[_0xfdef('0xd')](_0xfdef('0xe'),auth[_0xfdef('0x8')](),controller[_0xfdef('0xf')]);router[_0xfdef('0x10')](_0xfdef('0xe'),auth[_0xfdef('0x8')](),controller['destroy']);module[_0xfdef('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index dd70d6e..cec9884 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 _0x9539=['sequelize','exports','STRING','name'];(function(_0x1cb95b,_0x50a7da){var _0x4ad1ff=function(_0x383dd8){while(--_0x383dd8){_0x1cb95b['push'](_0x1cb95b['shift']());}};_0x4ad1ff(++_0x50a7da);}(_0x9539,0xd4));var _0x9953=function(_0x142a17,_0xefa6c8){_0x142a17=_0x142a17-0x0;var _0xc54d0c=_0x9539[_0x142a17];return _0xc54d0c;};'use strict';var Sequelize=require(_0x9953('0x0'));module[_0x9953('0x1')]={'name':{'type':Sequelize[_0x9953('0x2')],'unique':_0x9953('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x500a=['STRING','name','sequelize','exports'];(function(_0x3e9395,_0x2c3433){var _0x11193a=function(_0x9baecc){while(--_0x9baecc){_0x3e9395['push'](_0x3e9395['shift']());}};_0x11193a(++_0x2c3433);}(_0x500a,0x12e));var _0xa500=function(_0x2073fa,_0x56d893){_0x2073fa=_0x2073fa-0x0;var _0x35173a=_0x500a[_0x2073fa];return _0x35173a;};'use strict';var Sequelize=require(_0xa500('0x0'));module[_0xa500('0x1')]={'name':{'type':Sequelize[_0xa500('0x2')],'unique':_0xa500('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa500('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9081a57..3cf9b06 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 _0x053d=['../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','get','ODBC','UserProfileResource','stack','name','send','index','SquareOdbc','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x2e76a7,_0x23871a){var _0x454cde=function(_0x51724d){while(--_0x51724d){_0x2e76a7['push'](_0x2e76a7['shift']());}};_0x454cde(++_0x23871a);}(_0x053d,0x93));var _0xd053=function(_0xe7c4b5,_0x15a6d2){_0xe7c4b5=_0xe7c4b5-0x0;var _0x5e7c91=_0x053d[_0xe7c4b5];return _0x5e7c91;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd053('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd053('0x1'));var rp=require('request-promise');var moment=require(_0xd053('0x2'));var BPromise=require(_0xd053('0x3'));var Mustache=require(_0xd053('0x4'));var util=require(_0xd053('0x5'));var path=require(_0xd053('0x6'));var sox=require(_0xd053('0x7'));var csv=require(_0xd053('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd053('0x9'));var _=require(_0xd053('0xa'));var squel=require('squel');var crypto=require(_0xd053('0xb'));var jsforce=require(_0xd053('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd053('0x8'));var querystring=require('querystring');var Papa=require(_0xd053('0xd'));var Redis=require('ioredis');var authService=require(_0xd053('0xe'));var qs=require(_0xd053('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd053('0x10'));var logger=require(_0xd053('0x11'))(_0xd053('0x12'));var utils=require('../../config/utils');var config=require(_0xd053('0x13'));var licenseUtil=require(_0xd053('0x14'));var db=require(_0xd053('0x15'))['db'];function respondWithStatusCode(_0x28061f,_0x296c3e){_0x296c3e=_0x296c3e||0xcc;return function(_0x4cd249){if(_0x4cd249){return _0x28061f['sendStatus'](_0x296c3e);}return _0x28061f[_0xd053('0x16')](_0x296c3e)[_0xd053('0x17')]();};}function respondWithResult(_0x36e46a,_0x2a3633){_0x2a3633=_0x2a3633||0xc8;return function(_0x323284){if(_0x323284){return _0x36e46a[_0xd053('0x16')](_0x2a3633)[_0xd053('0x18')](_0x323284);}};}function respondWithFilteredResult(_0x27c09d,_0x4dbac3){return function(_0x228ae5){if(_0x228ae5){var _0x2b6d5c=typeof _0x4dbac3[_0xd053('0x19')]==='undefined'&&typeof _0x4dbac3[_0xd053('0x1a')]===_0xd053('0x1b');var _0x5ab88f=_0x228ae5[_0xd053('0x1c')];var _0x3b13a4=_0x2b6d5c?0x0:_0x4dbac3[_0xd053('0x19')];var _0x49922d=_0x2b6d5c?_0x228ae5[_0xd053('0x1c')]:_0x4dbac3[_0xd053('0x19')]+_0x4dbac3[_0xd053('0x1a')];var _0x2958dc;if(_0x49922d>=_0x5ab88f){_0x49922d=_0x5ab88f;_0x2958dc=0xc8;}else{_0x2958dc=0xce;}_0x27c09d[_0xd053('0x16')](_0x2958dc);return _0x27c09d[_0xd053('0x1d')](_0xd053('0x1e'),_0x3b13a4+'-'+_0x49922d+'/'+_0x5ab88f)[_0xd053('0x18')](_0x228ae5);}return null;};}function patchUpdates(_0xfd6983){return function(_0x18da24){try{jsonpatch['apply'](_0x18da24,_0xfd6983,!![]);}catch(_0x52bdba){return BPromise[_0xd053('0x1f')](_0x52bdba);}return _0x18da24[_0xd053('0x20')]();};}function saveUpdates(_0x502679,_0x305e88){return function(_0x49d869){if(_0x49d869){return _0x49d869['update'](_0x502679)['then'](function(_0x7fcca8){return _0x7fcca8;});}return null;};}function removeEntity(_0x421959,_0x13c8d9){return function(_0x117fe2){if(_0x117fe2){return _0x117fe2[_0xd053('0x21')]()[_0xd053('0x22')](function(){var _0x4bf9d6=_0x117fe2[_0xd053('0x23')]({'plain':!![]});var _0x4a926a=_0xd053('0x24');return db[_0xd053('0x25')][_0xd053('0x21')]({'where':{'type':_0x4a926a,'resourceId':_0x4bf9d6['id']}})[_0xd053('0x22')](function(){return _0x117fe2;});})[_0xd053('0x22')](function(){_0x421959[_0xd053('0x16')](0xcc)[_0xd053('0x17')]();});}};}function handleEntityNotFound(_0x4b8a81,_0x2f950d){return function(_0x10ddc4){if(!_0x10ddc4){_0x4b8a81['sendStatus'](0x194);}return _0x10ddc4;};}function handleError(_0x46d12e,_0xb17c40){_0xb17c40=_0xb17c40||0x1f4;return function(_0x336b63){logger['error'](_0x336b63[_0xd053('0x26')]);if(_0x336b63[_0xd053('0x27')]){delete _0x336b63[_0xd053('0x27')];}_0x46d12e[_0xd053('0x16')](_0xb17c40)[_0xd053('0x28')](_0x336b63);};}exports[_0xd053('0x29')]=function(_0x5988af,_0x1dea62){var _0x29e094={},_0x1a2077={},_0x24cdea={'count':0x0,'rows':[]};var _0x35728c=_['map'](db[_0xd053('0x2a')]['rawAttributes'],function(_0xebd599){return{'name':_0xebd599[_0xd053('0x2b')],'type':_0xebd599['type'][_0xd053('0x2c')]};});_0x1a2077[_0xd053('0x2d')]=_[_0xd053('0x2e')](_0x35728c,_0xd053('0x27'));_0x1a2077[_0xd053('0x2f')]=_[_0xd053('0x30')](_0x5988af[_0xd053('0x2f')]);_0x1a2077[_0xd053('0x31')]=_[_0xd053('0x32')](_0x1a2077['model'],_0x1a2077[_0xd053('0x2f')]);_0x29e094['attributes']=_[_0xd053('0x32')](_0x1a2077[_0xd053('0x2d')],qs[_0xd053('0x33')](_0x5988af[_0xd053('0x2f')]['fields']));_0x29e094[_0xd053('0x34')]=_0x29e094[_0xd053('0x34')][_0xd053('0x35')]?_0x29e094['attributes']:_0x1a2077[_0xd053('0x2d')];if(!_0x5988af[_0xd053('0x2f')][_0xd053('0x36')](_0xd053('0x37'))){_0x29e094[_0xd053('0x1a')]=qs[_0xd053('0x1a')](_0x5988af[_0xd053('0x2f')][_0xd053('0x1a')]);_0x29e094[_0xd053('0x19')]=qs['offset'](_0x5988af['query'][_0xd053('0x19')]);}_0x29e094[_0xd053('0x38')]=qs['sort'](_0x5988af[_0xd053('0x2f')][_0xd053('0x39')]);_0x29e094[_0xd053('0x3a')]=qs[_0xd053('0x31')](_['pick'](_0x5988af[_0xd053('0x2f')],_0x1a2077[_0xd053('0x31')]),_0x35728c);if(_0x5988af[_0xd053('0x2f')][_0xd053('0x3b')]){_0x29e094[_0xd053('0x3a')]=_['merge'](_0x29e094[_0xd053('0x3a')],{'$or':_[_0xd053('0x2e')](_0x35728c,function(_0x512963){if(_0x512963['type']!==_0xd053('0x3c')){var _0x2feda5={};_0x2feda5[_0x512963['name']]={'$like':'%'+_0x5988af['query'][_0xd053('0x3b')]+'%'};return _0x2feda5;}})});}_0x29e094=_[_0xd053('0x3d')]({},_0x29e094,_0x5988af[_0xd053('0x3e')]);var _0x525b20={'where':_0x29e094['where']};return db[_0xd053('0x2a')][_0xd053('0x1c')](_0x525b20)[_0xd053('0x22')](function(_0x4942b6){_0x24cdea[_0xd053('0x1c')]=_0x4942b6;if(_0x5988af[_0xd053('0x2f')][_0xd053('0x3f')]){_0x29e094['include']=[{'all':!![]}];}return db[_0xd053('0x2a')][_0xd053('0x40')](_0x29e094);})[_0xd053('0x22')](function(_0x3d45a2){_0x24cdea[_0xd053('0x41')]=_0x3d45a2;return _0x24cdea;})['then'](respondWithFilteredResult(_0x1dea62,_0x29e094))[_0xd053('0x42')](handleError(_0x1dea62,null));};exports[_0xd053('0x43')]=function(_0x3f51d9,_0x13b477){var _0x34b217={'raw':!![],'where':{'id':_0x3f51d9[_0xd053('0x44')]['id']}},_0x41d13e={};_0x41d13e[_0xd053('0x2d')]=_[_0xd053('0x30')](db['SquareOdbc'][_0xd053('0x45')]);_0x41d13e[_0xd053('0x2f')]=_[_0xd053('0x30')](_0x3f51d9[_0xd053('0x2f')]);_0x41d13e[_0xd053('0x31')]=_['intersection'](_0x41d13e['model'],_0x41d13e[_0xd053('0x2f')]);_0x34b217[_0xd053('0x34')]=_[_0xd053('0x32')](_0x41d13e[_0xd053('0x2d')],qs[_0xd053('0x33')](_0x3f51d9[_0xd053('0x2f')][_0xd053('0x33')]));_0x34b217[_0xd053('0x34')]=_0x34b217[_0xd053('0x34')]['length']?_0x34b217['attributes']:_0x41d13e[_0xd053('0x2d')];if(_0x3f51d9[_0xd053('0x2f')][_0xd053('0x3f')]){_0x34b217['include']=[{'all':!![]}];}_0x34b217=_[_0xd053('0x3d')]({},_0x34b217,_0x3f51d9[_0xd053('0x3e')]);return db[_0xd053('0x2a')]['find'](_0x34b217)[_0xd053('0x22')](handleEntityNotFound(_0x13b477,null))[_0xd053('0x22')](respondWithResult(_0x13b477,null))[_0xd053('0x42')](handleError(_0x13b477,null));};exports[_0xd053('0x46')]=function(_0x400f97,_0x3775ae){return db[_0xd053('0x2a')][_0xd053('0x46')](_0x400f97[_0xd053('0x47')],{})[_0xd053('0x22')](function(_0x4ba3a4){var _0x205405=_0x400f97[_0xd053('0x48')][_0xd053('0x23')]({'plain':!![]});if(!_0x205405)throw new Error(_0xd053('0x49'));if(_0x205405[_0xd053('0x4a')]==='user'){var _0x532811=_0x4ba3a4[_0xd053('0x23')]({'plain':!![]});var _0x39b696=_0xd053('0x24');return db['UserProfileSection'][_0xd053('0x4b')]({'where':{'name':_0x39b696,'userProfileId':_0x205405['userProfileId']},'raw':!![]})[_0xd053('0x22')](function(_0x513518){if(_0x513518&&_0x513518[_0xd053('0x4c')]===0x0){return db['UserProfileResource'][_0xd053('0x46')]({'name':_0x532811[_0xd053('0x27')],'resourceId':_0x532811['id'],'type':_0x513518[_0xd053('0x27')],'sectionId':_0x513518['id']},{})['then'](function(){return _0x4ba3a4;});}else{return _0x4ba3a4;}})[_0xd053('0x42')](function(_0x14ede7){logger[_0xd053('0x4d')](_0xd053('0x4e'),_0x14ede7);throw _0x14ede7;});}return _0x4ba3a4;})[_0xd053('0x22')](respondWithResult(_0x3775ae,0xc9))['catch'](handleError(_0x3775ae,null));};exports[_0xd053('0x4f')]=function(_0x5eedcb,_0x5e9757){if(_0x5eedcb[_0xd053('0x47')]['id']){delete _0x5eedcb[_0xd053('0x47')]['id'];}return db[_0xd053('0x2a')][_0xd053('0x4b')]({'where':{'id':_0x5eedcb['params']['id']}})[_0xd053('0x22')](handleEntityNotFound(_0x5e9757,null))['then'](saveUpdates(_0x5eedcb[_0xd053('0x47')],null))[_0xd053('0x22')](respondWithResult(_0x5e9757,null))[_0xd053('0x42')](handleError(_0x5e9757,null));};exports[_0xd053('0x21')]=function(_0x53bcb9,_0x4242f7){return db[_0xd053('0x2a')][_0xd053('0x4b')]({'where':{'id':_0x53bcb9[_0xd053('0x44')]['id']}})[_0xd053('0x22')](handleEntityNotFound(_0x4242f7,null))[_0xd053('0x22')](removeEntity(_0x4242f7,null))['catch'](handleError(_0x4242f7,null));};exports['test']=function(_0x1c75de,_0x243c34,_0x2e665c){var _0x25cb28;return db[_0xd053('0x2a')][_0xd053('0x4b')]({'where':{'id':_0x1c75de[_0xd053('0x44')]['id']},'attributes':['id',_0xd053('0x50')]})[_0xd053('0x22')](handleEntityNotFound(_0x243c34,null))[_0xd053('0x22')](function(_0x5dea4f){if(_0x5dea4f){var _0x4ca7c4=require(_0xd053('0x51'))();_0x4ca7c4[_0xd053('0x52')](_0x5dea4f['dsn']);_0x4ca7c4[_0xd053('0x53')]();return _0x5dea4f;}})['then'](respondWithResult(_0x243c34,null))[_0xd053('0x42')](handleError(_0x243c34,null));}; \ No newline at end of file +var _0x7c4b=['Content-Range','apply','reject','save','update','destroy','then','get','sendStatus','error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','findAll','catch','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0x7c4b,0xdf));var _0xb7c4=function(_0x5517f4,_0x22232d){_0x5517f4=_0x5517f4-0x0;var _0x404d02=_0x7c4b[_0x5517f4];return _0x404d02;};'use strict';var emlformat=require(_0xb7c4('0x0'));var rimraf=require(_0xb7c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7c4('0x2'));var rp=require(_0xb7c4('0x3'));var moment=require(_0xb7c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb7c4('0x5'));var util=require(_0xb7c4('0x6'));var path=require(_0xb7c4('0x7'));var sox=require('sox');var csv=require(_0xb7c4('0x8'));var ejs=require(_0xb7c4('0x9'));var fs=require('fs');var fs_extra=require(_0xb7c4('0xa'));var _=require('lodash');var squel=require(_0xb7c4('0xb'));var crypto=require(_0xb7c4('0xc'));var jsforce=require(_0xb7c4('0xd'));var deskjs=require(_0xb7c4('0xe'));var toCsv=require(_0xb7c4('0x8'));var querystring=require(_0xb7c4('0xf'));var Papa=require(_0xb7c4('0x10'));var Redis=require(_0xb7c4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb7c4('0x12'));var as=require(_0xb7c4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb7c4('0x14'));var config=require(_0xb7c4('0x15'));var licenseUtil=require(_0xb7c4('0x16'));var db=require(_0xb7c4('0x17'))['db'];function respondWithStatusCode(_0x530c02,_0x580e23){_0x580e23=_0x580e23||0xcc;return function(_0x4dce36){if(_0x4dce36){return _0x530c02['sendStatus'](_0x580e23);}return _0x530c02[_0xb7c4('0x18')](_0x580e23)[_0xb7c4('0x19')]();};}function respondWithResult(_0x1ffe08,_0x3c831d){_0x3c831d=_0x3c831d||0xc8;return function(_0x35178b){if(_0x35178b){return _0x1ffe08['status'](_0x3c831d)[_0xb7c4('0x1a')](_0x35178b);}};}function respondWithFilteredResult(_0x46efc2,_0x5b7b33){return function(_0x12b980){if(_0x12b980){var _0x2291c4=typeof _0x5b7b33[_0xb7c4('0x1b')]==='undefined'&&typeof _0x5b7b33[_0xb7c4('0x1c')]===_0xb7c4('0x1d');var _0x118f60=_0x12b980['count'];var _0x158f83=_0x2291c4?0x0:_0x5b7b33[_0xb7c4('0x1b')];var _0x366741=_0x2291c4?_0x12b980[_0xb7c4('0x1e')]:_0x5b7b33['offset']+_0x5b7b33[_0xb7c4('0x1c')];var _0x21637b;if(_0x366741>=_0x118f60){_0x366741=_0x118f60;_0x21637b=0xc8;}else{_0x21637b=0xce;}_0x46efc2[_0xb7c4('0x18')](_0x21637b);return _0x46efc2[_0xb7c4('0x1f')](_0xb7c4('0x20'),_0x158f83+'-'+_0x366741+'/'+_0x118f60)[_0xb7c4('0x1a')](_0x12b980);}return null;};}function patchUpdates(_0x49b0e3){return function(_0x3d3f2e){try{jsonpatch[_0xb7c4('0x21')](_0x3d3f2e,_0x49b0e3,!![]);}catch(_0x12ba71){return BPromise[_0xb7c4('0x22')](_0x12ba71);}return _0x3d3f2e[_0xb7c4('0x23')]();};}function saveUpdates(_0x195fed,_0x3801b8){return function(_0x223389){if(_0x223389){return _0x223389[_0xb7c4('0x24')](_0x195fed)['then'](function(_0x112ae4){return _0x112ae4;});}return null;};}function removeEntity(_0x1f4052,_0x28759b){return function(_0x1e3bde){if(_0x1e3bde){return _0x1e3bde[_0xb7c4('0x25')]()[_0xb7c4('0x26')](function(){var _0x1faf2d=_0x1e3bde[_0xb7c4('0x27')]({'plain':!![]});var _0x43e2df='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x43e2df,'resourceId':_0x1faf2d['id']}})[_0xb7c4('0x26')](function(){return _0x1e3bde;});})[_0xb7c4('0x26')](function(){_0x1f4052[_0xb7c4('0x18')](0xcc)[_0xb7c4('0x19')]();});}};}function handleEntityNotFound(_0x30a2ae,_0x14bec4){return function(_0x507232){if(!_0x507232){_0x30a2ae[_0xb7c4('0x28')](0x194);}return _0x507232;};}function handleError(_0x4c9d37,_0x204384){_0x204384=_0x204384||0x1f4;return function(_0x3cf125){logger[_0xb7c4('0x29')](_0x3cf125[_0xb7c4('0x2a')]);if(_0x3cf125[_0xb7c4('0x2b')]){delete _0x3cf125['name'];}_0x4c9d37[_0xb7c4('0x18')](_0x204384)[_0xb7c4('0x2c')](_0x3cf125);};}exports[_0xb7c4('0x2d')]=function(_0x4dfbb8,_0x1da466){var _0x264ebf={},_0x2b4f98={},_0x2d102d={'count':0x0,'rows':[]};var _0x16b16b=_['map'](db[_0xb7c4('0x2e')][_0xb7c4('0x2f')],function(_0xab59fc){return{'name':_0xab59fc[_0xb7c4('0x30')],'type':_0xab59fc[_0xb7c4('0x31')][_0xb7c4('0x32')]};});_0x2b4f98[_0xb7c4('0x33')]=_[_0xb7c4('0x34')](_0x16b16b,_0xb7c4('0x2b'));_0x2b4f98[_0xb7c4('0x35')]=_['keys'](_0x4dfbb8[_0xb7c4('0x35')]);_0x2b4f98[_0xb7c4('0x36')]=_['intersection'](_0x2b4f98['model'],_0x2b4f98[_0xb7c4('0x35')]);_0x264ebf[_0xb7c4('0x37')]=_[_0xb7c4('0x38')](_0x2b4f98[_0xb7c4('0x33')],qs[_0xb7c4('0x39')](_0x4dfbb8[_0xb7c4('0x35')][_0xb7c4('0x39')]));_0x264ebf['attributes']=_0x264ebf[_0xb7c4('0x37')][_0xb7c4('0x3a')]?_0x264ebf[_0xb7c4('0x37')]:_0x2b4f98[_0xb7c4('0x33')];if(!_0x4dfbb8[_0xb7c4('0x35')][_0xb7c4('0x3b')](_0xb7c4('0x3c'))){_0x264ebf[_0xb7c4('0x1c')]=qs['limit'](_0x4dfbb8['query'][_0xb7c4('0x1c')]);_0x264ebf['offset']=qs['offset'](_0x4dfbb8['query'][_0xb7c4('0x1b')]);}_0x264ebf[_0xb7c4('0x3d')]=qs[_0xb7c4('0x3e')](_0x4dfbb8[_0xb7c4('0x35')][_0xb7c4('0x3e')]);_0x264ebf['where']=qs[_0xb7c4('0x36')](_['pick'](_0x4dfbb8[_0xb7c4('0x35')],_0x2b4f98[_0xb7c4('0x36')]),_0x16b16b);if(_0x4dfbb8[_0xb7c4('0x35')][_0xb7c4('0x3f')]){_0x264ebf[_0xb7c4('0x40')]=_[_0xb7c4('0x41')](_0x264ebf['where'],{'$or':_[_0xb7c4('0x34')](_0x16b16b,function(_0x226dae){if(_0x226dae[_0xb7c4('0x31')]!=='VIRTUAL'){var _0x4d5182={};_0x4d5182[_0x226dae[_0xb7c4('0x2b')]]={'$like':'%'+_0x4dfbb8[_0xb7c4('0x35')]['filter']+'%'};return _0x4d5182;}})});}_0x264ebf=_[_0xb7c4('0x41')]({},_0x264ebf,_0x4dfbb8[_0xb7c4('0x42')]);var _0x53e1b4={'where':_0x264ebf[_0xb7c4('0x40')]};return db['SquareOdbc'][_0xb7c4('0x1e')](_0x53e1b4)[_0xb7c4('0x26')](function(_0x3fa446){_0x2d102d['count']=_0x3fa446;if(_0x4dfbb8['query']['includeAll']){_0x264ebf[_0xb7c4('0x43')]=[{'all':!![]}];}return db[_0xb7c4('0x2e')][_0xb7c4('0x44')](_0x264ebf);})['then'](function(_0x159b4f){_0x2d102d['rows']=_0x159b4f;return _0x2d102d;})['then'](respondWithFilteredResult(_0x1da466,_0x264ebf))[_0xb7c4('0x45')](handleError(_0x1da466,null));};exports['show']=function(_0x1dc4f1,_0x1c9563){var _0x306e6c={'raw':!![],'where':{'id':_0x1dc4f1[_0xb7c4('0x46')]['id']}},_0x57ea25={};_0x57ea25[_0xb7c4('0x33')]=_[_0xb7c4('0x47')](db[_0xb7c4('0x2e')][_0xb7c4('0x2f')]);_0x57ea25[_0xb7c4('0x35')]=_['keys'](_0x1dc4f1['query']);_0x57ea25[_0xb7c4('0x36')]=_[_0xb7c4('0x38')](_0x57ea25['model'],_0x57ea25[_0xb7c4('0x35')]);_0x306e6c['attributes']=_[_0xb7c4('0x38')](_0x57ea25[_0xb7c4('0x33')],qs['fields'](_0x1dc4f1['query'][_0xb7c4('0x39')]));_0x306e6c[_0xb7c4('0x37')]=_0x306e6c['attributes'][_0xb7c4('0x3a')]?_0x306e6c[_0xb7c4('0x37')]:_0x57ea25[_0xb7c4('0x33')];if(_0x1dc4f1[_0xb7c4('0x35')][_0xb7c4('0x48')]){_0x306e6c[_0xb7c4('0x43')]=[{'all':!![]}];}_0x306e6c=_[_0xb7c4('0x41')]({},_0x306e6c,_0x1dc4f1['options']);return db[_0xb7c4('0x2e')]['find'](_0x306e6c)[_0xb7c4('0x26')](handleEntityNotFound(_0x1c9563,null))[_0xb7c4('0x26')](respondWithResult(_0x1c9563,null))[_0xb7c4('0x45')](handleError(_0x1c9563,null));};exports[_0xb7c4('0x49')]=function(_0x124fc1,_0x459920){return db[_0xb7c4('0x2e')][_0xb7c4('0x49')](_0x124fc1[_0xb7c4('0x4a')],{})['then'](function(_0x2bd588){var _0x17dbf3=_0x124fc1[_0xb7c4('0x4b')]['get']({'plain':!![]});if(!_0x17dbf3)throw new Error(_0xb7c4('0x4c'));if(_0x17dbf3[_0xb7c4('0x4d')]==='user'){var _0x3388ec=_0x2bd588['get']({'plain':!![]});var _0x57a099='ODBC';return db[_0xb7c4('0x4e')][_0xb7c4('0x4f')]({'where':{'name':_0x57a099,'userProfileId':_0x17dbf3[_0xb7c4('0x50')]},'raw':!![]})[_0xb7c4('0x26')](function(_0x167eb7){if(_0x167eb7&&_0x167eb7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3388ec[_0xb7c4('0x2b')],'resourceId':_0x3388ec['id'],'type':_0x167eb7['name'],'sectionId':_0x167eb7['id']},{})[_0xb7c4('0x26')](function(){return _0x2bd588;});}else{return _0x2bd588;}})[_0xb7c4('0x45')](function(_0x2c7386){logger[_0xb7c4('0x29')](_0xb7c4('0x51'),_0x2c7386);throw _0x2c7386;});}return _0x2bd588;})[_0xb7c4('0x26')](respondWithResult(_0x459920,0xc9))[_0xb7c4('0x45')](handleError(_0x459920,null));};exports[_0xb7c4('0x24')]=function(_0x3d4fe7,_0x13a14b){if(_0x3d4fe7['body']['id']){delete _0x3d4fe7[_0xb7c4('0x4a')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x3d4fe7[_0xb7c4('0x46')]['id']}})[_0xb7c4('0x26')](handleEntityNotFound(_0x13a14b,null))[_0xb7c4('0x26')](saveUpdates(_0x3d4fe7['body'],null))[_0xb7c4('0x26')](respondWithResult(_0x13a14b,null))[_0xb7c4('0x45')](handleError(_0x13a14b,null));};exports['destroy']=function(_0x4d8d5b,_0xa5e03c){return db['SquareOdbc'][_0xb7c4('0x4f')]({'where':{'id':_0x4d8d5b['params']['id']}})['then'](handleEntityNotFound(_0xa5e03c,null))['then'](removeEntity(_0xa5e03c,null))[_0xb7c4('0x45')](handleError(_0xa5e03c,null));};exports['test']=function(_0x97f58e,_0x99e030,_0x143282){var _0x57b54e;return db[_0xb7c4('0x2e')][_0xb7c4('0x4f')]({'where':{'id':_0x97f58e[_0xb7c4('0x46')]['id']},'attributes':['id',_0xb7c4('0x52')]})[_0xb7c4('0x26')](handleEntityNotFound(_0x99e030,null))[_0xb7c4('0x26')](function(_0x38196f){if(_0x38196f){var _0x366087=require(_0xb7c4('0x53'))();_0x366087['openSync'](_0x38196f['dsn']);_0x366087[_0xb7c4('0x54')]();return _0x38196f;}})[_0xb7c4('0x26')](respondWithResult(_0x99e030,null))[_0xb7c4('0x45')](handleError(_0x99e030,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 12346c3..a90bb33 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 _0xea2a=['path','../../config/environment','./squareOdbc.attributes','define','util','../../config/logger','bluebird','request-promise'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xea2a,0xbc));var _0xaea2=function(_0x71bca8,_0x46656e){_0x71bca8=_0x71bca8-0x0;var _0x2691f5=_0xea2a[_0x71bca8];return _0x2691f5;};'use strict';var _=require('lodash');var util=require(_0xaea2('0x0'));var logger=require(_0xaea2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xaea2('0x2'));var rp=require(_0xaea2('0x3'));var fs=require('fs');var path=require(_0xaea2('0x4'));var rimraf=require('rimraf');var config=require(_0xaea2('0x5'));var attributes=require(_0xaea2('0x6'));module['exports']=function(_0x56c264,_0x3fca24){return _0x56c264[_0xaea2('0x7')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ae9=['SquareOdbc','square_odbc','util','../../config/logger','api','bluebird','path','exports','define'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x2ae9,0x107));var _0x92ae=function(_0x42f036,_0x5e6443){_0x42f036=_0x42f036-0x0;var _0xcda4b=_0x2ae9[_0x42f036];return _0xcda4b;};'use strict';var _=require('lodash');var util=require(_0x92ae('0x0'));var logger=require(_0x92ae('0x1'))(_0x92ae('0x2'));var moment=require('moment');var BPromise=require(_0x92ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92ae('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x92ae('0x5')]=function(_0x5d7357,_0x5ad955){return _0x5d7357[_0x92ae('0x6')](_0x92ae('0x7'),attributes,{'tableName':_0x92ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 844c7b9..8b04070 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 _0xb629=['raw','where','attributes','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','options'];(function(_0x187e50,_0x13774f){var _0x33a722=function(_0x43e0fb){while(--_0x43e0fb){_0x187e50['push'](_0x187e50['shift']());}};_0x33a722(++_0x13774f);}(_0xb629,0x66));var _0x9b62=function(_0x3cb405,_0xd5c09c){_0x3cb405=_0x3cb405-0x0;var _0x35a28e=_0xb629[_0x3cb405];return _0x35a28e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9b62('0x0'));var BPromise=require(_0x9b62('0x1'));var rs=require(_0x9b62('0x2'));var fs=require('fs');var Redis=require(_0x9b62('0x3'));var db=require(_0x9b62('0x4'))['db'];var utils=require(_0x9b62('0x5'));var logger=require(_0x9b62('0x6'))(_0x9b62('0x7'));var config=require('../../config/environment');var jayson=require(_0x9b62('0x8'));var client=jayson[_0x9b62('0x9')][_0x9b62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50753d,_0x50d801,_0x25f72b){return new BPromise(function(_0x4ab82d,_0x3ea8b7){return client['request'](_0x50753d,_0x25f72b)[_0x9b62('0xb')](function(_0x2748f0){logger['info'](_0x9b62('0xc'),_0x50d801,_0x9b62('0xd'));logger[_0x9b62('0xe')](_0x9b62('0xf'),_0x50d801,_0x9b62('0xd'),JSON[_0x9b62('0x10')](_0x2748f0));if(_0x2748f0[_0x9b62('0x11')]){if(_0x2748f0[_0x9b62('0x11')][_0x9b62('0x12')]===0x1f4){logger['error'](_0x9b62('0xc'),_0x50d801,_0x2748f0[_0x9b62('0x11')][_0x9b62('0x13')]);return _0x3ea8b7(_0x2748f0[_0x9b62('0x11')][_0x9b62('0x13')]);}logger[_0x9b62('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x50d801,_0x2748f0[_0x9b62('0x11')][_0x9b62('0x13')]);return _0x4ab82d(_0x2748f0[_0x9b62('0x11')][_0x9b62('0x13')]);}else{logger[_0x9b62('0x14')](_0x9b62('0xc'),_0x50d801,'request\x20sent');_0x4ab82d(_0x2748f0[_0x9b62('0x15')][_0x9b62('0x13')]);}})[_0x9b62('0x16')](function(_0x5536ea){logger[_0x9b62('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x50d801,_0x5536ea);_0x3ea8b7(_0x5536ea);});});}exports[_0x9b62('0x17')]=function(_0x5cd577){var _0x499967=this;return new Promise(function(_0x8225b7,_0x23a11e){return db[_0x9b62('0x18')]['find']({'raw':_0x5cd577[_0x9b62('0x19')]?_0x5cd577[_0x9b62('0x19')][_0x9b62('0x1a')]===undefined?!![]:![]:!![],'where':_0x5cd577[_0x9b62('0x19')]?_0x5cd577[_0x9b62('0x19')][_0x9b62('0x1b')]||null:null,'attributes':_0x5cd577['options']?_0x5cd577['options'][_0x9b62('0x1c')]||null:null,'include':_0x5cd577['options']?_0x5cd577[_0x9b62('0x19')][_0x9b62('0x1d')]?_[_0x9b62('0x1e')](_0x5cd577['options'][_0x9b62('0x1d')],function(_0x1ea69b){return{'model':db[_0x1ea69b[_0x9b62('0x1f')]],'as':_0x1ea69b['as'],'attributes':_0x1ea69b[_0x9b62('0x1c')],'include':_0x1ea69b['include']?_['map'](_0x1ea69b[_0x9b62('0x1d')],function(_0x5d9e7b){return{'model':db[_0x5d9e7b['model']],'as':_0x5d9e7b['as'],'attributes':_0x5d9e7b[_0x9b62('0x1c')],'include':_0x5d9e7b[_0x9b62('0x1d')]?_['map'](_0x5d9e7b[_0x9b62('0x1d')],function(_0x6e895f){return{'model':db[_0x6e895f[_0x9b62('0x1f')]],'as':_0x6e895f['as'],'attributes':_0x6e895f[_0x9b62('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9b62('0xb')](function(_0x19686c){logger['info'](_0x9b62('0x17'),_0x5cd577);logger[_0x9b62('0xe')](_0x9b62('0x17'),_0x5cd577,JSON[_0x9b62('0x10')](_0x19686c));_0x8225b7(_0x19686c);})['catch'](function(_0x477057){logger[_0x9b62('0x11')](_0x9b62('0x17'),_0x477057[_0x9b62('0x13')],_0x5cd577);_0x23a11e(_0x499967['error'](0x1f4,_0x477057[_0x9b62('0x13')]));});});}; \ No newline at end of file +var _0x9363=['jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowSquareOdbc','SquareOdbc','options','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x250f7c,_0xadc77b){var _0x395f32=function(_0x503061){while(--_0x503061){_0x250f7c['push'](_0x250f7c['shift']());}};_0x395f32(++_0xadc77b);}(_0x9363,0x105));var _0x3936=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0x9363[_0x441563];return _0x2369ec;};'use strict';var _=require(_0x3936('0x0'));var util=require(_0x3936('0x1'));var moment=require(_0x3936('0x2'));var BPromise=require(_0x3936('0x3'));var rs=require(_0x3936('0x4'));var fs=require('fs');var Redis=require(_0x3936('0x5'));var db=require(_0x3936('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3936('0x7'))(_0x3936('0x8'));var config=require('../../config/environment');var jayson=require(_0x3936('0x9'));var client=jayson['client'][_0x3936('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221bba,_0x5419b3,_0x1641b2){return new BPromise(function(_0x2f9d32,_0x4a2ba6){return client[_0x3936('0xb')](_0x221bba,_0x1641b2)[_0x3936('0xc')](function(_0x103ea1){logger[_0x3936('0xd')](_0x3936('0xe'),_0x5419b3,_0x3936('0xf'));logger['debug'](_0x3936('0x10'),_0x5419b3,_0x3936('0xf'),JSON[_0x3936('0x11')](_0x103ea1));if(_0x103ea1['error']){if(_0x103ea1['error'][_0x3936('0x12')]===0x1f4){logger[_0x3936('0x13')](_0x3936('0xe'),_0x5419b3,_0x103ea1['error'][_0x3936('0x14')]);return _0x4a2ba6(_0x103ea1['error'][_0x3936('0x14')]);}logger[_0x3936('0x13')](_0x3936('0xe'),_0x5419b3,_0x103ea1[_0x3936('0x13')][_0x3936('0x14')]);return _0x2f9d32(_0x103ea1['error']['message']);}else{logger['info'](_0x3936('0xe'),_0x5419b3,'request\x20sent');_0x2f9d32(_0x103ea1['result'][_0x3936('0x14')]);}})[_0x3936('0x15')](function(_0x1b0725){logger[_0x3936('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x5419b3,_0x1b0725);_0x4a2ba6(_0x1b0725);});});}exports[_0x3936('0x16')]=function(_0x455269){var _0x32b3ca=this;return new Promise(function(_0x2329c9,_0x3d487f){return db[_0x3936('0x17')]['find']({'raw':_0x455269[_0x3936('0x18')]?_0x455269[_0x3936('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x455269[_0x3936('0x18')]?_0x455269['options']['where']||null:null,'attributes':_0x455269[_0x3936('0x18')]?_0x455269[_0x3936('0x18')][_0x3936('0x19')]||null:null,'include':_0x455269['options']?_0x455269[_0x3936('0x18')][_0x3936('0x1a')]?_[_0x3936('0x1b')](_0x455269['options'][_0x3936('0x1a')],function(_0x15feaa){return{'model':db[_0x15feaa[_0x3936('0x1c')]],'as':_0x15feaa['as'],'attributes':_0x15feaa[_0x3936('0x19')],'include':_0x15feaa[_0x3936('0x1a')]?_[_0x3936('0x1b')](_0x15feaa[_0x3936('0x1a')],function(_0x48ea22){return{'model':db[_0x48ea22[_0x3936('0x1c')]],'as':_0x48ea22['as'],'attributes':_0x48ea22['attributes'],'include':_0x48ea22[_0x3936('0x1a')]?_[_0x3936('0x1b')](_0x48ea22[_0x3936('0x1a')],function(_0x532225){return{'model':db[_0x532225['model']],'as':_0x532225['as'],'attributes':_0x532225['attributes']};}):[]};}):[]};}):[]:[]})[_0x3936('0xc')](function(_0x1edb24){logger[_0x3936('0xd')](_0x3936('0x16'),_0x455269);logger[_0x3936('0x1d')](_0x3936('0x16'),_0x455269,JSON[_0x3936('0x11')](_0x1edb24));_0x2329c9(_0x1edb24);})[_0x3936('0x15')](function(_0x26615a){logger[_0x3936('0x13')](_0x3936('0x16'),_0x26615a[_0x3936('0x14')],_0x455269);_0x3d487f(_0x32b3ca['error'](0x1f4,_0x26615a[_0x3936('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2eca0aa..670b4be 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 _0x7dbb=['get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./squareProject.controller'];(function(_0x19ff64,_0x3c9dec){var _0x372e50=function(_0xe615f5){while(--_0xe615f5){_0x19ff64['push'](_0x19ff64['shift']());}};_0x372e50(++_0x3c9dec);}(_0x7dbb,0x1a2));var _0xb7db=function(_0x1e7450,_0x4665a9){_0x1e7450=_0x1e7450-0x0;var _0x7bddf8=_0x7dbb[_0x1e7450];return _0x7bddf8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb7db('0x0'));var timeout=require(_0xb7db('0x1'));var express=require(_0xb7db('0x2'));var router=express[_0xb7db('0x3')]();var fs_extra=require(_0xb7db('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7db('0x5'));var controller=require(_0xb7db('0x6'));router[_0xb7db('0x7')]('/',auth[_0xb7db('0x8')](),controller[_0xb7db('0x9')]);router[_0xb7db('0x7')](_0xb7db('0xa'),auth[_0xb7db('0x8')](),controller[_0xb7db('0xb')]);router[_0xb7db('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb7db('0xd')](_0xb7db('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xb7db('0xe')](_0xb7db('0xa'),auth[_0xb7db('0x8')](),controller[_0xb7db('0xf')]);module[_0xb7db('0x10')]=router; \ No newline at end of file +var _0xc5af=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3e7a1e,_0x1589be){var _0x267c30=function(_0x1f6a70){while(--_0x1f6a70){_0x3e7a1e['push'](_0x3e7a1e['shift']());}};_0x267c30(++_0x1589be);}(_0xc5af,0x135));var _0xfc5a=function(_0x5a0fc8,_0x21be76){_0x5a0fc8=_0x5a0fc8-0x0;var _0x4afc31=_0xc5af[_0x5a0fc8];return _0x4afc31;};'use strict';var multer=require(_0xfc5a('0x0'));var util=require(_0xfc5a('0x1'));var path=require(_0xfc5a('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc5a('0x3'));var router=express[_0xfc5a('0x4')]();var fs_extra=require(_0xfc5a('0x5'));var auth=require(_0xfc5a('0x6'));var interaction=require(_0xfc5a('0x7'));var config=require(_0xfc5a('0x8'));var controller=require(_0xfc5a('0x9'));router[_0xfc5a('0xa')]('/',auth[_0xfc5a('0xb')](),controller[_0xfc5a('0xc')]);router[_0xfc5a('0xa')](_0xfc5a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xfc5a('0xe')]('/',auth[_0xfc5a('0xb')](),controller[_0xfc5a('0xf')]);router[_0xfc5a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfc5a('0x11')]);router[_0xfc5a('0x12')](_0xfc5a('0xd'),auth[_0xfc5a('0xb')](),controller[_0xfc5a('0x13')]);module[_0xfc5a('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index cf108b6..ceb6a1c 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 _0x8b43=['preproduction','getDataValue','toString','utf8','production','DATE','sequelize','exports','STRING','TEXT','BLOB','long'];(function(_0x16716e,_0x3b8362){var _0x4d5a77=function(_0x18d99e){while(--_0x18d99e){_0x16716e['push'](_0x16716e['shift']());}};_0x4d5a77(++_0x3b8362);}(_0x8b43,0x7e));var _0x38b4=function(_0x2860b4,_0x12a944){_0x2860b4=_0x2860b4-0x0;var _0x5d7967=_0x8b43[_0x2860b4];return _0x5d7967;};'use strict';var Sequelize=require(_0x38b4('0x0'));module[_0x38b4('0x1')]={'name':{'type':Sequelize[_0x38b4('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x38b4('0x3')]},'preproduction':{'type':Sequelize[_0x38b4('0x4')](_0x38b4('0x5')),'get':function(){if(this['getDataValue'](_0x38b4('0x6'))){return this[_0x38b4('0x7')](_0x38b4('0x6'))[_0x38b4('0x8')](_0x38b4('0x9'));}}},'production':{'type':Sequelize[_0x38b4('0x4')](_0x38b4('0x5')),'get':function(){if(this['getDataValue'](_0x38b4('0xa'))){return this[_0x38b4('0x7')](_0x38b4('0xa'))[_0x38b4('0x8')](_0x38b4('0x9'));}}},'savedAt':{'type':Sequelize[_0x38b4('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2ca2=['long','preproduction','getDataValue','toString','BLOB','production','utf8','DATE','sequelize','exports','STRING','name'];(function(_0x468383,_0x15c0f1){var _0x9dc1c4=function(_0x203a23){while(--_0x203a23){_0x468383['push'](_0x468383['shift']());}};_0x9dc1c4(++_0x15c0f1);}(_0x2ca2,0x11c));var _0x22ca=function(_0x3c4313,_0x4c508f){_0x3c4313=_0x3c4313-0x0;var _0x177120=_0x2ca2[_0x3c4313];return _0x177120;};'use strict';var Sequelize=require(_0x22ca('0x0'));module[_0x22ca('0x1')]={'name':{'type':Sequelize[_0x22ca('0x2')],'unique':_0x22ca('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x22ca('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x22ca('0x4')),'get':function(){if(this['getDataValue'](_0x22ca('0x5'))){return this[_0x22ca('0x6')](_0x22ca('0x5'))[_0x22ca('0x7')]('utf8');}}},'production':{'type':Sequelize[_0x22ca('0x8')]('long'),'get':function(){if(this[_0x22ca('0x6')]('production')){return this[_0x22ca('0x6')](_0x22ca('0x9'))[_0x22ca('0x7')](_0x22ca('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x22ca('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 8e7ebdb..31a1eae 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 _0x9c21=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','stringify','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','undefined','count','offset','set','Content-Range','then','get','SquareProjects','UserProfileResource','publish','agi','end','sendStatus','error','stack','name','SquareProject','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','include','rows','show','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch'];(function(_0x1d8b83,_0x5e4e57){var _0xca8ff=function(_0x274a60){while(--_0x274a60){_0x1d8b83['push'](_0x1d8b83['shift']());}};_0xca8ff(++_0x5e4e57);}(_0x9c21,0x162));var _0x19c2=function(_0x594f04,_0xa805b5){_0x594f04=_0x594f04-0x0;var _0x162144=_0x9c21[_0x594f04];return _0x162144;};'use strict';var _=require(_0x19c2('0x0'));var Redis=require(_0x19c2('0x1'));var qs=require(_0x19c2('0x2'));var logger=require(_0x19c2('0x3'))(_0x19c2('0x4'));var config=require(_0x19c2('0x5'));var db=require('../../mysqldb')['db'];config[_0x19c2('0x6')]=_[_0x19c2('0x7')](config[_0x19c2('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x19c2('0x8'))(new Redis(config['redis']));require(_0x19c2('0x9'))[_0x19c2('0xa')](socket);function respondWithResult(_0x4e176f,_0x300d6f){_0x300d6f=_0x300d6f||0xc8;return function(_0x39baac){if(_0x39baac){return _0x4e176f[_0x19c2('0xb')](_0x300d6f)[_0x19c2('0xc')](_0x39baac);}};}function respondWithFilteredResult(_0x3f1d5b,_0x5273fc){return function(_0x27a9d2){if(_0x27a9d2){var _0x4df6cc=typeof _0x5273fc['offset']===_0x19c2('0xd')&&typeof _0x5273fc['limit']===_0x19c2('0xd');var _0x285b09=_0x27a9d2['count'];var _0x322273=_0x4df6cc?0x0:_0x5273fc['offset'];var _0x14ca17=_0x4df6cc?_0x27a9d2[_0x19c2('0xe')]:_0x5273fc[_0x19c2('0xf')]+_0x5273fc['limit'];var _0xdf14db;if(_0x14ca17>=_0x285b09){_0x14ca17=_0x285b09;_0xdf14db=0xc8;}else{_0xdf14db=0xce;}_0x3f1d5b[_0x19c2('0xb')](_0xdf14db);return _0x3f1d5b[_0x19c2('0x10')](_0x19c2('0x11'),_0x322273+'-'+_0x14ca17+'/'+_0x285b09)[_0x19c2('0xc')](_0x27a9d2);}return null;};}function saveUpdates(_0x599296){return function(_0x544c19){if(_0x544c19){return _0x544c19['update'](_0x599296)[_0x19c2('0x12')](function(_0x24149c){return _0x24149c;});}return null;};}function removeEntity(_0xb2ba7d){return function(_0x470921){if(_0x470921){return _0x470921['destroy']()[_0x19c2('0x12')](function(){var _0x50fda0=_0x470921[_0x19c2('0x13')]({'plain':!![]});var _0x41312c=_0x19c2('0x14');return db[_0x19c2('0x15')]['destroy']({'where':{'type':_0x41312c,'resourceId':_0x50fda0['id']}})[_0x19c2('0x12')](function(){return _0x470921;});})[_0x19c2('0x12')](function(){var _0x3d90c8=new Redis(config['redis']);_0x3d90c8[_0x19c2('0x16')](_0x19c2('0x17'),JSON['stringify']({'id':_0x470921['id'],'deleted':!![]}));})[_0x19c2('0x12')](function(){_0xb2ba7d[_0x19c2('0xb')](0xcc)[_0x19c2('0x18')]();});}};}function handleEntityNotFound(_0x26b57a){return function(_0x342efe){if(!_0x342efe){_0x26b57a[_0x19c2('0x19')](0x194);}return _0x342efe;};}function handleError(_0x126333,_0x3087de){_0x3087de=_0x3087de||0x1f4;return function(_0x18462c){logger[_0x19c2('0x1a')](_0x18462c[_0x19c2('0x1b')]);if(_0x18462c['name']){delete _0x18462c[_0x19c2('0x1c')];}_0x126333[_0x19c2('0xb')](_0x3087de)['send'](_0x18462c);};}exports['index']=function(_0xeef8e0,_0x5b40e6){var _0x2246a2={},_0x163ef4={},_0x57202e={'count':0x0,'rows':[]};var _0x500a01=_['map'](db[_0x19c2('0x1d')][_0x19c2('0x1e')],function(_0x4c79e3){return{'name':_0x4c79e3[_0x19c2('0x1f')],'type':_0x4c79e3[_0x19c2('0x20')][_0x19c2('0x21')]};});_0x163ef4['model']=_['map'](_0x500a01,_0x19c2('0x1c'));_0x163ef4[_0x19c2('0x22')]=_[_0x19c2('0x23')](_0xeef8e0[_0x19c2('0x22')]);_0x163ef4[_0x19c2('0x24')]=_['intersection'](_0x163ef4[_0x19c2('0x25')],_0x163ef4[_0x19c2('0x22')]);_0x2246a2[_0x19c2('0x26')]=_[_0x19c2('0x27')](_0x163ef4[_0x19c2('0x25')],qs['fields'](_0xeef8e0['query'][_0x19c2('0x28')]));_0x2246a2['attributes']=_0x2246a2[_0x19c2('0x26')][_0x19c2('0x29')]?_0x2246a2['attributes']:_0x163ef4[_0x19c2('0x25')];if(!_0xeef8e0['query'][_0x19c2('0x2a')](_0x19c2('0x2b'))){_0x2246a2[_0x19c2('0x2c')]=qs[_0x19c2('0x2c')](_0xeef8e0[_0x19c2('0x22')][_0x19c2('0x2c')]);_0x2246a2['offset']=qs[_0x19c2('0xf')](_0xeef8e0[_0x19c2('0x22')]['offset']);}_0x2246a2[_0x19c2('0x2d')]=qs[_0x19c2('0x2e')](_0xeef8e0[_0x19c2('0x22')][_0x19c2('0x2e')]);_0x2246a2[_0x19c2('0x2f')]=qs[_0x19c2('0x24')](_[_0x19c2('0x30')](_0xeef8e0[_0x19c2('0x22')],_0x163ef4[_0x19c2('0x24')]),_0x500a01);if(_0xeef8e0[_0x19c2('0x22')][_0x19c2('0x31')]){_0x2246a2[_0x19c2('0x2f')]=_[_0x19c2('0x32')](_0x2246a2[_0x19c2('0x2f')],{'$or':_['map'](_0x500a01,function(_0x344fe9){if(_0x344fe9['type']!=='VIRTUAL'){var _0x4e1b7f={};_0x4e1b7f[_0x344fe9[_0x19c2('0x1c')]]={'$like':'%'+_0xeef8e0['query'][_0x19c2('0x31')]+'%'};return _0x4e1b7f;}})});}_0x2246a2=_['merge']({},_0x2246a2,_0xeef8e0['options']);var _0x59ff70={'where':_0x2246a2['where']};return db[_0x19c2('0x1d')][_0x19c2('0xe')](_0x59ff70)[_0x19c2('0x12')](function(_0x332c5d){_0x57202e[_0x19c2('0xe')]=_0x332c5d;if(_0xeef8e0[_0x19c2('0x22')]['includeAll']){_0x2246a2[_0x19c2('0x33')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x2246a2);})[_0x19c2('0x12')](function(_0x358fb2){_0x57202e[_0x19c2('0x34')]=_0x358fb2;return _0x57202e;})[_0x19c2('0x12')](respondWithFilteredResult(_0x5b40e6,_0x2246a2))['catch'](handleError(_0x5b40e6,null));};exports[_0x19c2('0x35')]=function(_0x5886d7,_0x35e3f6){var _0x569572={'raw':![],'where':{'id':_0x5886d7['params']['id']}},_0x38c225={};_0x38c225[_0x19c2('0x25')]=_[_0x19c2('0x23')](db[_0x19c2('0x1d')][_0x19c2('0x1e')]);_0x38c225[_0x19c2('0x22')]=_[_0x19c2('0x23')](_0x5886d7['query']);_0x38c225['filters']=_['intersection'](_0x38c225[_0x19c2('0x25')],_0x38c225[_0x19c2('0x22')]);_0x569572['attributes']=_[_0x19c2('0x27')](_0x38c225['model'],qs[_0x19c2('0x28')](_0x5886d7[_0x19c2('0x22')][_0x19c2('0x28')]));_0x569572[_0x19c2('0x26')]=_0x569572['attributes'][_0x19c2('0x29')]?_0x569572[_0x19c2('0x26')]:_0x38c225[_0x19c2('0x25')];if(_0x5886d7['query'][_0x19c2('0x36')]){_0x569572[_0x19c2('0x33')]=[{'all':!![]}];}_0x569572=_[_0x19c2('0x32')]({},_0x569572,_0x5886d7[_0x19c2('0x37')]);return db[_0x19c2('0x1d')][_0x19c2('0x38')](_0x569572)[_0x19c2('0x12')](handleEntityNotFound(_0x35e3f6,null))['then'](respondWithResult(_0x35e3f6,null))['catch'](handleError(_0x35e3f6,null));};exports[_0x19c2('0x39')]=function(_0x5935e0,_0x150dfe){return db[_0x19c2('0x1d')][_0x19c2('0x39')](_0x5935e0[_0x19c2('0x3a')],{})['then'](function(_0x201ef6){var _0x17f2b0=_0x5935e0['user'][_0x19c2('0x13')]({'plain':!![]});if(!_0x17f2b0)throw new Error(_0x19c2('0x3b'));if(_0x17f2b0[_0x19c2('0x3c')]===_0x19c2('0x3d')){var _0x4e8dea=_0x201ef6[_0x19c2('0x13')]({'plain':!![]});var _0x53a082=_0x19c2('0x14');return db[_0x19c2('0x3e')]['find']({'where':{'name':_0x53a082,'userProfileId':_0x17f2b0[_0x19c2('0x3f')]},'raw':!![]})[_0x19c2('0x12')](function(_0x43c748){if(_0x43c748&&_0x43c748[_0x19c2('0x40')]===0x0){return db[_0x19c2('0x15')][_0x19c2('0x39')]({'name':_0x4e8dea['name'],'resourceId':_0x4e8dea['id'],'type':_0x43c748[_0x19c2('0x1c')],'sectionId':_0x43c748['id']},{})['then'](function(){return _0x201ef6;});}else{return _0x201ef6;}})[_0x19c2('0x41')](function(_0x110340){logger[_0x19c2('0x1a')](_0x19c2('0x42'),_0x110340);throw _0x110340;});}return _0x201ef6;})['then'](respondWithResult(_0x150dfe,0xc9))[_0x19c2('0x41')](handleError(_0x150dfe,null));};exports['update']=function(_0x4e34d9,_0x41e71b){if(_0x4e34d9[_0x19c2('0x3a')]['id']){delete _0x4e34d9['body']['id'];}return db['SquareProject'][_0x19c2('0x38')]({'where':{'id':_0x4e34d9[_0x19c2('0x43')]['id']}})[_0x19c2('0x12')](handleEntityNotFound(_0x41e71b,null))['then'](saveUpdates(_0x4e34d9[_0x19c2('0x3a')],null))[_0x19c2('0x12')](function(_0x5f5733){if(!_0x5f5733)return;var _0xca90a9=_0x5f5733[_0x19c2('0x13')]({'plain':!![]});return _0xca90a9;})[_0x19c2('0x12')](function(_0x4fc055){var _0x48e675=new Redis(config['redis']);_0x48e675[_0x19c2('0x16')]('agi',JSON[_0x19c2('0x44')](_[_0x19c2('0x30')](_0x4fc055,['id',_0x19c2('0x1c'),_0x19c2('0x45')])));return _0x4fc055;})[_0x19c2('0x12')](respondWithResult(_0x41e71b,null))[_0x19c2('0x41')](handleError(_0x41e71b,null));};exports['destroy']=function(_0x30576e,_0x24aa0f){return db[_0x19c2('0x1d')]['find']({'where':{'id':_0x30576e[_0x19c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x24aa0f,null))[_0x19c2('0x12')](removeEntity(_0x24aa0f,null))[_0x19c2('0x41')](handleError(_0x24aa0f,null));}; \ No newline at end of file +var _0xbe3d=['Content-Range','update','then','destroy','get','SquareProjects','publish','agi','stringify','end','sendStatus','error','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','undefined','limit','count','offset'];(function(_0x155d16,_0x30ff43){var _0xda9a99=function(_0x449ee9){while(--_0x449ee9){_0x155d16['push'](_0x155d16['shift']());}};_0xda9a99(++_0x30ff43);}(_0xbe3d,0x79));var _0xdbe3=function(_0xbb6c3e,_0x4bf721){_0xbb6c3e=_0xbb6c3e-0x0;var _0x3a0f89=_0xbe3d[_0xbb6c3e];return _0x3a0f89;};'use strict';var _=require(_0xdbe3('0x0'));var Redis=require(_0xdbe3('0x1'));var qs=require(_0xdbe3('0x2'));var logger=require(_0xdbe3('0x3'))('api');var config=require(_0xdbe3('0x4'));var db=require(_0xdbe3('0x5'))['db'];config[_0xdbe3('0x6')]=_[_0xdbe3('0x7')](config[_0xdbe3('0x6')],{'host':_0xdbe3('0x8'),'port':0x18eb});var socket=require(_0xdbe3('0x9'))(new Redis(config[_0xdbe3('0x6')]));require(_0xdbe3('0xa'))['register'](socket);function respondWithResult(_0x5a2bf0,_0x342bf0){_0x342bf0=_0x342bf0||0xc8;return function(_0x5aa936){if(_0x5aa936){return _0x5a2bf0[_0xdbe3('0xb')](_0x342bf0)[_0xdbe3('0xc')](_0x5aa936);}};}function respondWithFilteredResult(_0x34476a,_0x489568){return function(_0x3989c8){if(_0x3989c8){var _0x27ff46=typeof _0x489568['offset']===_0xdbe3('0xd')&&typeof _0x489568[_0xdbe3('0xe')]===_0xdbe3('0xd');var _0x554985=_0x3989c8[_0xdbe3('0xf')];var _0x40596f=_0x27ff46?0x0:_0x489568[_0xdbe3('0x10')];var _0x52e708=_0x27ff46?_0x3989c8['count']:_0x489568['offset']+_0x489568[_0xdbe3('0xe')];var _0x3a4a48;if(_0x52e708>=_0x554985){_0x52e708=_0x554985;_0x3a4a48=0xc8;}else{_0x3a4a48=0xce;}_0x34476a['status'](_0x3a4a48);return _0x34476a['set'](_0xdbe3('0x11'),_0x40596f+'-'+_0x52e708+'/'+_0x554985)[_0xdbe3('0xc')](_0x3989c8);}return null;};}function saveUpdates(_0x88519){return function(_0x5afc41){if(_0x5afc41){return _0x5afc41[_0xdbe3('0x12')](_0x88519)[_0xdbe3('0x13')](function(_0x570c06){return _0x570c06;});}return null;};}function removeEntity(_0x7ebfe6){return function(_0x2e70ba){if(_0x2e70ba){return _0x2e70ba[_0xdbe3('0x14')]()['then'](function(){var _0x3d26ea=_0x2e70ba[_0xdbe3('0x15')]({'plain':!![]});var _0x1c27ef=_0xdbe3('0x16');return db['UserProfileResource']['destroy']({'where':{'type':_0x1c27ef,'resourceId':_0x3d26ea['id']}})[_0xdbe3('0x13')](function(){return _0x2e70ba;});})['then'](function(){var _0x139555=new Redis(config['redis']);_0x139555[_0xdbe3('0x17')](_0xdbe3('0x18'),JSON[_0xdbe3('0x19')]({'id':_0x2e70ba['id'],'deleted':!![]}));})[_0xdbe3('0x13')](function(){_0x7ebfe6[_0xdbe3('0xb')](0xcc)[_0xdbe3('0x1a')]();});}};}function handleEntityNotFound(_0x5b6a16){return function(_0x4dcbb6){if(!_0x4dcbb6){_0x5b6a16[_0xdbe3('0x1b')](0x194);}return _0x4dcbb6;};}function handleError(_0x4300bd,_0x314368){_0x314368=_0x314368||0x1f4;return function(_0x1923d7){logger[_0xdbe3('0x1c')](_0x1923d7['stack']);if(_0x1923d7[_0xdbe3('0x1d')]){delete _0x1923d7[_0xdbe3('0x1d')];}_0x4300bd[_0xdbe3('0xb')](_0x314368)[_0xdbe3('0x1e')](_0x1923d7);};}exports['index']=function(_0x8784c3,_0x5379e0){var _0x5ea931={},_0x5f07f7={},_0x2c1e1a={'count':0x0,'rows':[]};var _0x2119ff=_[_0xdbe3('0x1f')](db[_0xdbe3('0x20')][_0xdbe3('0x21')],function(_0x262a46){return{'name':_0x262a46[_0xdbe3('0x22')],'type':_0x262a46[_0xdbe3('0x23')][_0xdbe3('0x24')]};});_0x5f07f7[_0xdbe3('0x25')]=_['map'](_0x2119ff,_0xdbe3('0x1d'));_0x5f07f7[_0xdbe3('0x26')]=_['keys'](_0x8784c3['query']);_0x5f07f7[_0xdbe3('0x27')]=_[_0xdbe3('0x28')](_0x5f07f7[_0xdbe3('0x25')],_0x5f07f7['query']);_0x5ea931[_0xdbe3('0x29')]=_[_0xdbe3('0x28')](_0x5f07f7[_0xdbe3('0x25')],qs[_0xdbe3('0x2a')](_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0x2a')]));_0x5ea931[_0xdbe3('0x29')]=_0x5ea931['attributes'][_0xdbe3('0x2b')]?_0x5ea931[_0xdbe3('0x29')]:_0x5f07f7[_0xdbe3('0x25')];if(!_0x8784c3['query'][_0xdbe3('0x2c')](_0xdbe3('0x2d'))){_0x5ea931[_0xdbe3('0xe')]=qs['limit'](_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0xe')]);_0x5ea931[_0xdbe3('0x10')]=qs[_0xdbe3('0x10')](_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0x10')]);}_0x5ea931['order']=qs[_0xdbe3('0x2e')](_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0x2e')]);_0x5ea931['where']=qs[_0xdbe3('0x27')](_[_0xdbe3('0x2f')](_0x8784c3[_0xdbe3('0x26')],_0x5f07f7['filters']),_0x2119ff);if(_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0x30')]){_0x5ea931[_0xdbe3('0x31')]=_[_0xdbe3('0x32')](_0x5ea931['where'],{'$or':_[_0xdbe3('0x1f')](_0x2119ff,function(_0x36a1e3){if(_0x36a1e3[_0xdbe3('0x23')]!==_0xdbe3('0x33')){var _0x26de9a={};_0x26de9a[_0x36a1e3[_0xdbe3('0x1d')]]={'$like':'%'+_0x8784c3['query'][_0xdbe3('0x30')]+'%'};return _0x26de9a;}})});}_0x5ea931=_[_0xdbe3('0x32')]({},_0x5ea931,_0x8784c3['options']);var _0x4c2cf1={'where':_0x5ea931[_0xdbe3('0x31')]};return db['SquareProject']['count'](_0x4c2cf1)[_0xdbe3('0x13')](function(_0x45ab44){_0x2c1e1a[_0xdbe3('0xf')]=_0x45ab44;if(_0x8784c3['query']['includeAll']){_0x5ea931[_0xdbe3('0x34')]=[{'all':!![]}];}return db[_0xdbe3('0x20')]['findAll'](_0x5ea931);})['then'](function(_0x20d48d){_0x2c1e1a[_0xdbe3('0x35')]=_0x20d48d;return _0x2c1e1a;})[_0xdbe3('0x13')](respondWithFilteredResult(_0x5379e0,_0x5ea931))[_0xdbe3('0x36')](handleError(_0x5379e0,null));};exports[_0xdbe3('0x37')]=function(_0x177cce,_0x3d7351){var _0xcba29e={'raw':![],'where':{'id':_0x177cce[_0xdbe3('0x38')]['id']}},_0x1c7df5={};_0x1c7df5[_0xdbe3('0x25')]=_[_0xdbe3('0x39')](db[_0xdbe3('0x20')][_0xdbe3('0x21')]);_0x1c7df5[_0xdbe3('0x26')]=_[_0xdbe3('0x39')](_0x177cce[_0xdbe3('0x26')]);_0x1c7df5[_0xdbe3('0x27')]=_[_0xdbe3('0x28')](_0x1c7df5[_0xdbe3('0x25')],_0x1c7df5['query']);_0xcba29e['attributes']=_['intersection'](_0x1c7df5[_0xdbe3('0x25')],qs[_0xdbe3('0x2a')](_0x177cce[_0xdbe3('0x26')][_0xdbe3('0x2a')]));_0xcba29e['attributes']=_0xcba29e['attributes'][_0xdbe3('0x2b')]?_0xcba29e[_0xdbe3('0x29')]:_0x1c7df5['model'];if(_0x177cce[_0xdbe3('0x26')]['includeAll']){_0xcba29e[_0xdbe3('0x34')]=[{'all':!![]}];}_0xcba29e=_[_0xdbe3('0x32')]({},_0xcba29e,_0x177cce[_0xdbe3('0x3a')]);return db[_0xdbe3('0x20')][_0xdbe3('0x3b')](_0xcba29e)['then'](handleEntityNotFound(_0x3d7351,null))['then'](respondWithResult(_0x3d7351,null))[_0xdbe3('0x36')](handleError(_0x3d7351,null));};exports['create']=function(_0x319171,_0x40530b){return db[_0xdbe3('0x20')][_0xdbe3('0x3c')](_0x319171[_0xdbe3('0x3d')],{})[_0xdbe3('0x13')](function(_0x53a7a9){var _0x2de9ee=_0x319171[_0xdbe3('0x3e')][_0xdbe3('0x15')]({'plain':!![]});if(!_0x2de9ee)throw new Error(_0xdbe3('0x3f'));if(_0x2de9ee[_0xdbe3('0x40')]==='user'){var _0x10f724=_0x53a7a9[_0xdbe3('0x15')]({'plain':!![]});var _0xf9d61a=_0xdbe3('0x16');return db[_0xdbe3('0x41')][_0xdbe3('0x3b')]({'where':{'name':_0xf9d61a,'userProfileId':_0x2de9ee['userProfileId']},'raw':!![]})[_0xdbe3('0x13')](function(_0x25d5cd){if(_0x25d5cd&&_0x25d5cd['autoAssociation']===0x0){return db[_0xdbe3('0x42')][_0xdbe3('0x3c')]({'name':_0x10f724[_0xdbe3('0x1d')],'resourceId':_0x10f724['id'],'type':_0x25d5cd[_0xdbe3('0x1d')],'sectionId':_0x25d5cd['id']},{})['then'](function(){return _0x53a7a9;});}else{return _0x53a7a9;}})[_0xdbe3('0x36')](function(_0x30e3dc){logger[_0xdbe3('0x1c')](_0xdbe3('0x43'),_0x30e3dc);throw _0x30e3dc;});}return _0x53a7a9;})[_0xdbe3('0x13')](respondWithResult(_0x40530b,0xc9))[_0xdbe3('0x36')](handleError(_0x40530b,null));};exports[_0xdbe3('0x12')]=function(_0x3b6f1a,_0x4da62d){if(_0x3b6f1a[_0xdbe3('0x3d')]['id']){delete _0x3b6f1a[_0xdbe3('0x3d')]['id'];}return db[_0xdbe3('0x20')][_0xdbe3('0x3b')]({'where':{'id':_0x3b6f1a['params']['id']}})['then'](handleEntityNotFound(_0x4da62d,null))[_0xdbe3('0x13')](saveUpdates(_0x3b6f1a[_0xdbe3('0x3d')],null))['then'](function(_0x37814c){if(!_0x37814c)return;var _0x23fe25=_0x37814c[_0xdbe3('0x15')]({'plain':!![]});return _0x23fe25;})[_0xdbe3('0x13')](function(_0x4a8f5e){var _0x797358=new Redis(config[_0xdbe3('0x6')]);_0x797358[_0xdbe3('0x17')](_0xdbe3('0x18'),JSON[_0xdbe3('0x19')](_['pick'](_0x4a8f5e,['id',_0xdbe3('0x1d'),_0xdbe3('0x44')])));return _0x4a8f5e;})['then'](respondWithResult(_0x4da62d,null))[_0xdbe3('0x36')](handleError(_0x4da62d,null));};exports['destroy']=function(_0x4b44e9,_0x4b9f76){return db[_0xdbe3('0x20')][_0xdbe3('0x3b')]({'where':{'id':_0x4b44e9[_0xdbe3('0x38')]['id']}})[_0xdbe3('0x13')](handleEntityNotFound(_0x4b9f76,null))[_0xdbe3('0x13')](removeEntity(_0x4b9f76,null))[_0xdbe3('0x36')](handleError(_0x4b9f76,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 518b749..84193ef 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 _0x72a2=['events','../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ac5f3,_0x17ea51){var _0x65249d=function(_0x2da55b){while(--_0x2da55b){_0x3ac5f3['push'](_0x3ac5f3['shift']());}};_0x65249d(++_0x17ea51);}(_0x72a2,0x186));var _0x272a=function(_0xb3df2e,_0x472ddc){_0xb3df2e=_0xb3df2e-0x0;var _0xde69be=_0x72a2[_0xb3df2e];return _0xde69be;};'use strict';var EventEmitter=require(_0x272a('0x0'));var SquareProject=require(_0x272a('0x1'))['db'][_0x272a('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x272a('0x3')](0x0);var events={'afterCreate':_0x272a('0x4'),'afterUpdate':'update','afterDestroy':_0x272a('0x5')};function emitEvent(_0x13eaf3){return function(_0x2672d8,_0x3e5cdc,_0x9a4205){SquareProjectEvents['emit'](_0x13eaf3+':'+_0x2672d8['id'],_0x2672d8);SquareProjectEvents[_0x272a('0x6')](_0x13eaf3,_0x2672d8);_0x9a4205(null);};}for(var e in events){if(events[_0x272a('0x7')](e)){var event=events[e];SquareProject[_0x272a('0x8')](e,emitEvent(event));}}module[_0x272a('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x7316=['../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x5e4e70,_0xd62f42){var _0x5018c1=function(_0x37d67d){while(--_0x37d67d){_0x5e4e70['push'](_0x5e4e70['shift']());}};_0x5018c1(++_0xd62f42);}(_0x7316,0x1ee));var _0x6731=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x7316[_0x5ddaac];return _0x2a9c58;};'use strict';var EventEmitter=require(_0x6731('0x0'));var SquareProject=require(_0x6731('0x1'))['db'][_0x6731('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6731('0x3')](0x0);var events={'afterCreate':_0x6731('0x4'),'afterUpdate':_0x6731('0x5'),'afterDestroy':_0x6731('0x6')};function emitEvent(_0x3ea6a0){return function(_0xbcf012,_0x317dfa,_0x315d55){SquareProjectEvents[_0x6731('0x7')](_0x3ea6a0+':'+_0xbcf012['id'],_0xbcf012);SquareProjectEvents[_0x6731('0x7')](_0x3ea6a0,_0xbcf012);_0x315d55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x6731('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b80c64b..e29b892 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 _0xc202=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','square_projects','changed','preproduction','YYYY-MM-DD\x20HH:mm:ss','format','lodash'];(function(_0x4c1f9d,_0x345d5d){var _0x4a18e0=function(_0x516575){while(--_0x516575){_0x4c1f9d['push'](_0x4c1f9d['shift']());}};_0x4a18e0(++_0x345d5d);}(_0xc202,0xdc));var _0x2c20=function(_0x1c1174,_0x226715){_0x1c1174=_0x1c1174-0x0;var _0x2d4433=_0xc202[_0x1c1174];return _0x2d4433;};'use strict';var _=require(_0x2c20('0x0'));var util=require(_0x2c20('0x1'));var logger=require(_0x2c20('0x2'))(_0x2c20('0x3'));var moment=require(_0x2c20('0x4'));var BPromise=require(_0x2c20('0x5'));var rp=require(_0x2c20('0x6'));var fs=require('fs');var path=require(_0x2c20('0x7'));var rimraf=require(_0x2c20('0x8'));var config=require(_0x2c20('0x9'));var attributes=require(_0x2c20('0xa'));module['exports']=function(_0x22b2d5,_0x5b6c33){return _0x22b2d5[_0x2c20('0xb')]('SquareProject',attributes,{'tableName':_0x2c20('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29ccc2,_0x133de9,_0x57d71d){if(_0x29ccc2[_0x2c20('0xd')](_0x2c20('0xe'))){_0x29ccc2['savedAt']=moment()['format'](_0x2c20('0xf'));}if(_0x29ccc2[_0x2c20('0xd')]('production')){_0x29ccc2['publishedAt']=moment()[_0x2c20('0x10')](_0x2c20('0xf'));}_0x57d71d(null,_0x29ccc2);}}});}; \ No newline at end of file +var _0xcbd9=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3eac77,_0x3153c1){var _0x180cf2=function(_0x3a4f11){while(--_0x3a4f11){_0x3eac77['push'](_0x3eac77['shift']());}};_0x180cf2(++_0x3153c1);}(_0xcbd9,0x168));var _0x9cbd=function(_0x54e49f,_0x3733ba){_0x54e49f=_0x54e49f-0x0;var _0x1d6c09=_0xcbd9[_0x54e49f];return _0x1d6c09;};'use strict';var _=require(_0x9cbd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9cbd('0x1'));var moment=require(_0x9cbd('0x2'));var BPromise=require(_0x9cbd('0x3'));var rp=require(_0x9cbd('0x4'));var fs=require('fs');var path=require(_0x9cbd('0x5'));var rimraf=require('rimraf');var config=require(_0x9cbd('0x6'));var attributes=require(_0x9cbd('0x7'));module[_0x9cbd('0x8')]=function(_0x1f9d49,_0x3542b3){return _0x1f9d49['define'](_0x9cbd('0x9'),attributes,{'tableName':_0x9cbd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7155da,_0x39ebba,_0x1b2e2e){if(_0x7155da[_0x9cbd('0xb')](_0x9cbd('0xc'))){_0x7155da[_0x9cbd('0xd')]=moment()[_0x9cbd('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x7155da[_0x9cbd('0xb')](_0x9cbd('0xf'))){_0x7155da[_0x9cbd('0x10')]=moment()['format'](_0x9cbd('0x11'));}_0x1b2e2e(null,_0x7155da);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a000a4a..97e300a 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 _0xc750=['catch','error','ShowSquareProject','raw','where','message','lodash','ioredis','../../mysqldb','../../config/logger','defaults','redis','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','attributes','map','model','include','then','info','debug','stringify'];(function(_0x3ccbc7,_0x37e98e){var _0x38203e=function(_0x3ead3f){while(--_0x3ead3f){_0x3ccbc7['push'](_0x3ccbc7['shift']());}};_0x38203e(++_0x37e98e);}(_0xc750,0x14b));var _0x0c75=function(_0x16a83b,_0x3db981){_0x16a83b=_0x16a83b-0x0;var _0x2d403a=_0xc750[_0x16a83b];return _0x2d403a;};'use strict';var _=require(_0x0c75('0x0'));var Redis=require(_0x0c75('0x1'));var db=require(_0x0c75('0x2'))['db'];var logger=require(_0x0c75('0x3'))('rpc');var config=require('../../config/environment');config['redis']=_[_0x0c75('0x4')](config[_0x0c75('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0c75('0x6'))['register'](socket);exports[_0x0c75('0x7')]=function(_0x153b0a){var _0x1a753c=this;return new Promise(function(_0x1f4744,_0x4f001c){return db[_0x0c75('0x8')][_0x0c75('0x9')]({'raw':_0x153b0a['options']?_0x153b0a[_0x0c75('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x153b0a['options']?_0x153b0a['options']['where']||null:null,'attributes':_0x153b0a['options']?_0x153b0a[_0x0c75('0xa')][_0x0c75('0xb')]||null:null,'limit':_0x153b0a[_0x0c75('0xa')]?_0x153b0a[_0x0c75('0xa')]['limit']||null:null,'include':_0x153b0a[_0x0c75('0xa')]?_0x153b0a['options']['include']?_[_0x0c75('0xc')](_0x153b0a[_0x0c75('0xa')]['include'],function(_0x533c81){return{'model':db[_0x533c81[_0x0c75('0xd')]],'as':_0x533c81['as'],'attributes':_0x533c81[_0x0c75('0xb')],'include':_0x533c81[_0x0c75('0xe')]?_[_0x0c75('0xc')](_0x533c81[_0x0c75('0xe')],function(_0x1af9b){return{'model':db[_0x1af9b[_0x0c75('0xd')]],'as':_0x1af9b['as'],'attributes':_0x1af9b[_0x0c75('0xb')],'include':_0x1af9b[_0x0c75('0xe')]?_[_0x0c75('0xc')](_0x1af9b[_0x0c75('0xe')],function(_0x49e45d){return{'model':db[_0x49e45d[_0x0c75('0xd')]],'as':_0x49e45d['as'],'attributes':_0x49e45d['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c75('0xf')](function(_0x1ab31e){logger[_0x0c75('0x10')]('GetSquareProjects',_0x153b0a);logger[_0x0c75('0x11')]('GetSquareProjects',_0x153b0a,JSON[_0x0c75('0x12')](_0x1ab31e));_0x1f4744(_0x1ab31e);})[_0x0c75('0x13')](function(_0x506c9a){logger[_0x0c75('0x14')](_0x0c75('0x7'),_0x506c9a['message'],_0x153b0a);_0x4f001c(_0x1a753c[_0x0c75('0x14')](0x1f4,_0x506c9a['message']));});});};exports[_0x0c75('0x15')]=function(_0x2e597d){var _0x1f7e6d=this;return new Promise(function(_0x3b8488,_0x4b31dd){return db['SquareProject']['find']({'raw':_0x2e597d[_0x0c75('0xa')]?_0x2e597d[_0x0c75('0xa')][_0x0c75('0x16')]===undefined?!![]:![]:!![],'where':_0x2e597d[_0x0c75('0xa')]?_0x2e597d['options'][_0x0c75('0x17')]||null:null,'attributes':_0x2e597d[_0x0c75('0xa')]?_0x2e597d[_0x0c75('0xa')]['attributes']||null:null,'include':_0x2e597d[_0x0c75('0xa')]?_0x2e597d[_0x0c75('0xa')][_0x0c75('0xe')]?_[_0x0c75('0xc')](_0x2e597d['options'][_0x0c75('0xe')],function(_0x572e3c){return{'model':db[_0x572e3c[_0x0c75('0xd')]],'as':_0x572e3c['as'],'attributes':_0x572e3c[_0x0c75('0xb')],'include':_0x572e3c[_0x0c75('0xe')]?_['map'](_0x572e3c['include'],function(_0x5bc092){return{'model':db[_0x5bc092[_0x0c75('0xd')]],'as':_0x5bc092['as'],'attributes':_0x5bc092[_0x0c75('0xb')],'include':_0x5bc092[_0x0c75('0xe')]?_[_0x0c75('0xc')](_0x5bc092[_0x0c75('0xe')],function(_0x5ee24f){return{'model':db[_0x5ee24f[_0x0c75('0xd')]],'as':_0x5ee24f['as'],'attributes':_0x5ee24f[_0x0c75('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50eacf){logger[_0x0c75('0x10')](_0x0c75('0x15'),_0x2e597d);logger['debug'](_0x0c75('0x15'),_0x2e597d,JSON[_0x0c75('0x12')](_0x50eacf));_0x3b8488(_0x50eacf);})[_0x0c75('0x13')](function(_0x9ce31b){logger['error'](_0x0c75('0x15'),_0x9ce31b[_0x0c75('0x18')],_0x2e597d);_0x4b31dd(_0x1f7e6d[_0x0c75('0x14')](0x1f4,_0x9ce31b[_0x0c75('0x18')]));});});}; \ No newline at end of file +var _0xb57e=['attributes','limit','map','include','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','ioredis','../../mysqldb','rpc','redis','localhost','GetSquareProjects','SquareProject','findAll','options','where'];(function(_0x4ef11c,_0x387510){var _0x1c3026=function(_0x582d43){while(--_0x582d43){_0x4ef11c['push'](_0x4ef11c['shift']());}};_0x1c3026(++_0x387510);}(_0xb57e,0x16c));var _0xeb57=function(_0x5517d6,_0x36dbb6){_0x5517d6=_0x5517d6-0x0;var _0x1f61d9=_0xb57e[_0x5517d6];return _0x1f61d9;};'use strict';var _=require(_0xeb57('0x0'));var Redis=require(_0xeb57('0x1'));var db=require(_0xeb57('0x2'))['db'];var logger=require('../../config/logger')(_0xeb57('0x3'));var config=require('../../config/environment');config[_0xeb57('0x4')]=_['defaults'](config['redis'],{'host':_0xeb57('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb57('0x4')]));require('./squareProject.socket')['register'](socket);exports[_0xeb57('0x6')]=function(_0x2df100){var _0x425e7d=this;return new Promise(function(_0x3fa689,_0x107ec4){return db[_0xeb57('0x7')][_0xeb57('0x8')]({'raw':_0x2df100[_0xeb57('0x9')]?_0x2df100['options']['raw']===undefined?!![]:![]:!![],'where':_0x2df100[_0xeb57('0x9')]?_0x2df100[_0xeb57('0x9')][_0xeb57('0xa')]||null:null,'attributes':_0x2df100[_0xeb57('0x9')]?_0x2df100[_0xeb57('0x9')][_0xeb57('0xb')]||null:null,'limit':_0x2df100['options']?_0x2df100[_0xeb57('0x9')][_0xeb57('0xc')]||null:null,'include':_0x2df100['options']?_0x2df100[_0xeb57('0x9')]['include']?_[_0xeb57('0xd')](_0x2df100[_0xeb57('0x9')][_0xeb57('0xe')],function(_0x42afa6){return{'model':db[_0x42afa6[_0xeb57('0xf')]],'as':_0x42afa6['as'],'attributes':_0x42afa6[_0xeb57('0xb')],'include':_0x42afa6[_0xeb57('0xe')]?_[_0xeb57('0xd')](_0x42afa6[_0xeb57('0xe')],function(_0x2be09d){return{'model':db[_0x2be09d['model']],'as':_0x2be09d['as'],'attributes':_0x2be09d[_0xeb57('0xb')],'include':_0x2be09d[_0xeb57('0xe')]?_[_0xeb57('0xd')](_0x2be09d[_0xeb57('0xe')],function(_0x623ccd){return{'model':db[_0x623ccd['model']],'as':_0x623ccd['as'],'attributes':_0x623ccd[_0xeb57('0xb')]};}):[]};}):[]};}):[]:[]})[_0xeb57('0x10')](function(_0x2be9b0){logger[_0xeb57('0x11')](_0xeb57('0x6'),_0x2df100);logger[_0xeb57('0x12')](_0xeb57('0x6'),_0x2df100,JSON[_0xeb57('0x13')](_0x2be9b0));_0x3fa689(_0x2be9b0);})[_0xeb57('0x14')](function(_0x1c2371){logger[_0xeb57('0x15')](_0xeb57('0x6'),_0x1c2371[_0xeb57('0x16')],_0x2df100);_0x107ec4(_0x425e7d['error'](0x1f4,_0x1c2371[_0xeb57('0x16')]));});});};exports[_0xeb57('0x17')]=function(_0x988567){var _0x39fce9=this;return new Promise(function(_0x9fd3de,_0xc59eac){return db[_0xeb57('0x7')][_0xeb57('0x18')]({'raw':_0x988567[_0xeb57('0x9')]?_0x988567['options']['raw']===undefined?!![]:![]:!![],'where':_0x988567[_0xeb57('0x9')]?_0x988567['options'][_0xeb57('0xa')]||null:null,'attributes':_0x988567[_0xeb57('0x9')]?_0x988567[_0xeb57('0x9')][_0xeb57('0xb')]||null:null,'include':_0x988567['options']?_0x988567[_0xeb57('0x9')][_0xeb57('0xe')]?_[_0xeb57('0xd')](_0x988567[_0xeb57('0x9')][_0xeb57('0xe')],function(_0x3ef998){return{'model':db[_0x3ef998[_0xeb57('0xf')]],'as':_0x3ef998['as'],'attributes':_0x3ef998[_0xeb57('0xb')],'include':_0x3ef998['include']?_[_0xeb57('0xd')](_0x3ef998[_0xeb57('0xe')],function(_0x54f6c0){return{'model':db[_0x54f6c0[_0xeb57('0xf')]],'as':_0x54f6c0['as'],'attributes':_0x54f6c0[_0xeb57('0xb')],'include':_0x54f6c0[_0xeb57('0xe')]?_[_0xeb57('0xd')](_0x54f6c0[_0xeb57('0xe')],function(_0x587461){return{'model':db[_0x587461[_0xeb57('0xf')]],'as':_0x587461['as'],'attributes':_0x587461[_0xeb57('0xb')]};}):[]};}):[]};}):[]:[]})[_0xeb57('0x10')](function(_0x1998f4){logger[_0xeb57('0x11')]('ShowSquareProject',_0x988567);logger[_0xeb57('0x12')]('ShowSquareProject',_0x988567,JSON[_0xeb57('0x13')](_0x1998f4));_0x9fd3de(_0x1998f4);})['catch'](function(_0x364cfb){logger[_0xeb57('0x15')](_0xeb57('0x17'),_0x364cfb[_0xeb57('0x16')],_0x988567);_0xc59eac(_0x39fce9[_0xeb57('0x15')](0x1f4,_0x364cfb['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 913ecd3..e260beb 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 _0x701e=['update','removeListener','register','length','./squareProject.events','save','remove'];(function(_0x407c6c,_0x57f7af){var _0x3168f3=function(_0x5d9f9c){while(--_0x5d9f9c){_0x407c6c['push'](_0x407c6c['shift']());}};_0x3168f3(++_0x57f7af);}(_0x701e,0x100));var _0xe701=function(_0x447057,_0xeadb8f){_0x447057=_0x447057-0x0;var _0x27df86=_0x701e[_0x447057];return _0x27df86;};'use strict';var SquareProjectEvents=require(_0xe701('0x0'));var events=[_0xe701('0x1'),_0xe701('0x2'),_0xe701('0x3')];function createListener(_0x2dfed8,_0x29d69f){return function(_0x200b81){_0x29d69f['emit'](_0x2dfed8,_0x200b81);};}function removeListener(_0x8eb43,_0x3c6c46){return function(){SquareProjectEvents[_0xe701('0x4')](_0x8eb43,_0x3c6c46);};}exports[_0xe701('0x5')]=function(_0x25e841){for(var _0xd968ec=0x0,_0x31bdda=events[_0xe701('0x6')];_0xd968ec<_0x31bdda;_0xd968ec++){var _0x4939b8=events[_0xd968ec];var _0x57638b=createListener('squareProject:'+_0x4939b8,_0x25e841);SquareProjectEvents['on'](_0x4939b8,_0x57638b);}}; \ No newline at end of file +var _0x0e8b=['remove','update','emit','length','./squareProject.events'];(function(_0x217a53,_0x5bd9fa){var _0xac141f=function(_0x4e5975){while(--_0x4e5975){_0x217a53['push'](_0x217a53['shift']());}};_0xac141f(++_0x5bd9fa);}(_0x0e8b,0x13f));var _0xb0e8=function(_0x5c438d,_0x4d256b){_0x5c438d=_0x5c438d-0x0;var _0x33704f=_0x0e8b[_0x5c438d];return _0x33704f;};'use strict';var SquareProjectEvents=require(_0xb0e8('0x0'));var events=['save',_0xb0e8('0x1'),_0xb0e8('0x2')];function createListener(_0x4ea868,_0x6918f1){return function(_0x18afb6){_0x6918f1[_0xb0e8('0x3')](_0x4ea868,_0x18afb6);};}function removeListener(_0x3c44fd,_0x4e7140){return function(){SquareProjectEvents['removeListener'](_0x3c44fd,_0x4e7140);};}exports['register']=function(_0x2b0635){for(var _0x21b92f=0x0,_0x2e1ee6=events[_0xb0e8('0x4')];_0x21b92f<_0x2e1ee6;_0x21b92f++){var _0x34b1c1=events[_0x21b92f];var _0x5a1c01=createListener('squareProject:'+_0x34b1c1,_0x2b0635);SquareProjectEvents['on'](_0x34b1c1,_0x5a1c01);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ecfc1c9..96cf505 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3c562d,_0x4e51b6){var _0x512bf1=function(_0x2295c6){while(--_0x2295c6){_0x3c562d['push'](_0x3c562d['shift']());}};_0x512bf1(++_0x4e51b6);}(_0x4975,0x86));var _0x5497=function(_0x2241d5,_0xaefc81){_0x2241d5=_0x2241d5-0x0;var _0x227bb2=_0x4975[_0x2241d5];return _0x227bb2;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x1ded63,_0x613b5d){var _0x126a33=function(_0x1a56a7){while(--_0x1a56a7){_0x1ded63['push'](_0x1ded63['shift']());}};_0x126a33(++_0x613b5d);}(_0x5fab,0x177));var _0xb5fa=function(_0x5c1930,_0x1b15e7){_0x5c1930=_0x5c1930-0x0;var _0x163a34=_0x5fab[_0x5c1930];return _0x163a34;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 2ac539e..143d47f 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 _0xb458=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x5d29a8,_0x38512b){var _0x12f651=function(_0x59af22){while(--_0x59af22){_0x5d29a8['push'](_0x5d29a8['shift']());}};_0x12f651(++_0x38512b);}(_0xb458,0x103));var _0x8b45=function(_0x1a91f0,_0x11e203){_0x1a91f0=_0x1a91f0-0x0;var _0x12f862=_0xb458[_0x1a91f0];return _0x12f862;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8b45('0x2')]},'extension':{'type':Sequelize[_0x8b45('0x2')]},'priority':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize[_0x8b45('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x8b45('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x8b45('0x2')]},'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){var _0x2daa9a='';var _0x3a8ccb=this[_0x8b45('0x4')]('savePath');if(_0x3a8ccb){_0x2daa9a=_0x3a8ccb[_0x8b45('0x5')](_0x3a8ccb[_0x8b45('0x6')]('.'));}return _0x2daa9a;}}}; \ No newline at end of file +var _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x521500,_0x4cc29f){var _0x4c0a73=function(_0xfbfda){while(--_0xfbfda){_0x521500['push'](_0x521500['shift']());}};_0x4c0a73(++_0x4cc29f);}(_0x2675,0x75));var _0x5267=function(_0x308288,_0x300c57){_0x308288=_0x308288-0x0;var _0x153718=_0x2675[_0x308288];return _0x153718;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index fd5ad13..5c502a0 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 _0x749c=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareRecording','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','keys','include','create','body','find','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','download','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x38b059,_0x219f26){var _0x4f55e8=function(_0x3e3f82){while(--_0x3e3f82){_0x38b059['push'](_0x38b059['shift']());}};_0x4f55e8(++_0x219f26);}(_0x749c,0xcd));var _0xc749=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x749c[_0x3b150c];return _0x5cd414;};'use strict';var emlformat=require(_0xc749('0x0'));var rimraf=require(_0xc749('0x1'));var zipdir=require(_0xc749('0x2'));var jsonpatch=require(_0xc749('0x3'));var rp=require(_0xc749('0x4'));var moment=require(_0xc749('0x5'));var BPromise=require(_0xc749('0x6'));var Mustache=require('mustache');var util=require(_0xc749('0x7'));var path=require(_0xc749('0x8'));var sox=require(_0xc749('0x9'));var csv=require(_0xc749('0xa'));var ejs=require(_0xc749('0xb'));var fs=require('fs');var fs_extra=require(_0xc749('0xc'));var _=require(_0xc749('0xd'));var squel=require(_0xc749('0xe'));var crypto=require('crypto');var jsforce=require(_0xc749('0xf'));var deskjs=require(_0xc749('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc749('0x11'));var Papa=require(_0xc749('0x12'));var Redis=require(_0xc749('0x13'));var authService=require(_0xc749('0x14'));var qs=require(_0xc749('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc749('0x16'));var logger=require(_0xc749('0x17'))(_0xc749('0x18'));var utils=require(_0xc749('0x19'));var config=require(_0xc749('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xc749('0x1b'))['db'];function respondWithStatusCode(_0x243831,_0x412e7b){_0x412e7b=_0x412e7b||0xcc;return function(_0x42e3a1){if(_0x42e3a1){return _0x243831['sendStatus'](_0x412e7b);}return _0x243831[_0xc749('0x1c')](_0x412e7b)[_0xc749('0x1d')]();};}function respondWithResult(_0x1f9c9a,_0x357a21){_0x357a21=_0x357a21||0xc8;return function(_0x3b71a2){if(_0x3b71a2){return _0x1f9c9a['status'](_0x357a21)[_0xc749('0x1e')](_0x3b71a2);}};}function respondWithFilteredResult(_0x253d3a,_0x44b390){return function(_0x2d783b){if(_0x2d783b){var _0x2810f3=typeof _0x44b390[_0xc749('0x1f')]===_0xc749('0x20')&&typeof _0x44b390[_0xc749('0x21')]==='undefined';var _0xb73ed2=_0x2d783b[_0xc749('0x22')];var _0x144633=_0x2810f3?0x0:_0x44b390[_0xc749('0x1f')];var _0x70c857=_0x2810f3?_0x2d783b[_0xc749('0x22')]:_0x44b390[_0xc749('0x1f')]+_0x44b390['limit'];var _0x3a2ce3;if(_0x70c857>=_0xb73ed2){_0x70c857=_0xb73ed2;_0x3a2ce3=0xc8;}else{_0x3a2ce3=0xce;}_0x253d3a[_0xc749('0x1c')](_0x3a2ce3);return _0x253d3a[_0xc749('0x23')](_0xc749('0x24'),_0x144633+'-'+_0x70c857+'/'+_0xb73ed2)['json'](_0x2d783b);}return null;};}function patchUpdates(_0x2a6221){return function(_0x1067c2){try{jsonpatch[_0xc749('0x25')](_0x1067c2,_0x2a6221,!![]);}catch(_0x300867){return BPromise[_0xc749('0x26')](_0x300867);}return _0x1067c2[_0xc749('0x27')]();};}function saveUpdates(_0xb9e988,_0x444c42){return function(_0x2e04bd){if(_0x2e04bd){return _0x2e04bd[_0xc749('0x28')](_0xb9e988)[_0xc749('0x29')](function(_0xb64d6f){return _0xb64d6f;});}return null;};}function removeEntity(_0x426a61,_0x23019d){return function(_0xb43d6a){if(_0xb43d6a){return _0xb43d6a[_0xc749('0x2a')]()['then'](function(){_0x426a61[_0xc749('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab7a0,_0x33c06d){return function(_0xb9d777){if(!_0xb9d777){_0x3ab7a0[_0xc749('0x2b')](0x194);}return _0xb9d777;};}function handleError(_0x244823,_0x463a96){_0x463a96=_0x463a96||0x1f4;return function(_0x4eda16){logger[_0xc749('0x2c')](_0x4eda16[_0xc749('0x2d')]);if(_0x4eda16[_0xc749('0x2e')]){delete _0x4eda16[_0xc749('0x2e')];}_0x244823[_0xc749('0x1c')](_0x463a96)[_0xc749('0x2f')](_0x4eda16);};}exports[_0xc749('0x30')]=function(_0x440c52,_0x1c1113){var _0x3972fa={},_0x570bc9={},_0x36e598={'count':0x0,'rows':[]};var _0x5f6e62=_[_0xc749('0x31')](db[_0xc749('0x32')]['rawAttributes'],function(_0x4515ee){return{'name':_0x4515ee['fieldName'],'type':_0x4515ee[_0xc749('0x33')][_0xc749('0x34')]};});_0x570bc9[_0xc749('0x35')]=_[_0xc749('0x31')](_0x5f6e62,_0xc749('0x2e'));_0x570bc9[_0xc749('0x36')]=_['keys'](_0x440c52['query']);_0x570bc9[_0xc749('0x37')]=_[_0xc749('0x38')](_0x570bc9[_0xc749('0x35')],_0x570bc9[_0xc749('0x36')]);_0x3972fa[_0xc749('0x39')]=_['intersection'](_0x570bc9[_0xc749('0x35')],qs['fields'](_0x440c52[_0xc749('0x36')][_0xc749('0x3a')]));_0x3972fa[_0xc749('0x39')]=_0x3972fa['attributes'][_0xc749('0x3b')]?_0x3972fa['attributes']:_0x570bc9[_0xc749('0x35')];if(!_0x440c52[_0xc749('0x36')][_0xc749('0x3c')](_0xc749('0x3d'))){_0x3972fa['limit']=qs[_0xc749('0x21')](_0x440c52[_0xc749('0x36')][_0xc749('0x21')]);_0x3972fa['offset']=qs[_0xc749('0x1f')](_0x440c52[_0xc749('0x36')]['offset']);}_0x3972fa[_0xc749('0x3e')]=qs[_0xc749('0x3f')](_0x440c52[_0xc749('0x36')][_0xc749('0x3f')]);_0x3972fa[_0xc749('0x40')]=qs[_0xc749('0x37')](_[_0xc749('0x41')](_0x440c52[_0xc749('0x36')],_0x570bc9[_0xc749('0x37')]),_0x5f6e62);if(_0x440c52['query'][_0xc749('0x42')]){_0x3972fa[_0xc749('0x40')]=_[_0xc749('0x43')](_0x3972fa['where'],{'$or':_[_0xc749('0x31')](_0x5f6e62,function(_0x40bf5c){if(_0x40bf5c['type']!==_0xc749('0x44')){var _0x1816a0={};_0x1816a0[_0x40bf5c[_0xc749('0x2e')]]={'$like':'%'+_0x440c52[_0xc749('0x36')][_0xc749('0x42')]+'%'};return _0x1816a0;}})});}_0x3972fa=_[_0xc749('0x43')]({},_0x3972fa,_0x440c52[_0xc749('0x45')]);var _0xacb22d={'where':_0x3972fa['where']};return db[_0xc749('0x32')][_0xc749('0x22')](_0xacb22d)[_0xc749('0x29')](function(_0x167603){_0x36e598[_0xc749('0x22')]=_0x167603;if(_0x440c52['query'][_0xc749('0x46')]){_0x3972fa['include']=[{'all':!![]}];}return db['SquareRecording'][_0xc749('0x47')](_0x3972fa);})[_0xc749('0x29')](function(_0x4daa26){_0x36e598['rows']=_0x4daa26;return _0x36e598;})[_0xc749('0x29')](respondWithFilteredResult(_0x1c1113,_0x3972fa))[_0xc749('0x48')](handleError(_0x1c1113,null));};exports[_0xc749('0x49')]=function(_0x2c6520,_0x172dec){var _0x791e39={'raw':!![],'where':{'id':_0x2c6520[_0xc749('0x4a')]['id']}},_0x143a27={};_0x143a27['model']=_['keys'](db[_0xc749('0x32')][_0xc749('0x4b')]);_0x143a27[_0xc749('0x36')]=_[_0xc749('0x4c')](_0x2c6520['query']);_0x143a27[_0xc749('0x37')]=_[_0xc749('0x38')](_0x143a27[_0xc749('0x35')],_0x143a27[_0xc749('0x36')]);_0x791e39[_0xc749('0x39')]=_[_0xc749('0x38')](_0x143a27[_0xc749('0x35')],qs[_0xc749('0x3a')](_0x2c6520[_0xc749('0x36')][_0xc749('0x3a')]));_0x791e39[_0xc749('0x39')]=_0x791e39[_0xc749('0x39')][_0xc749('0x3b')]?_0x791e39[_0xc749('0x39')]:_0x143a27['model'];if(_0x2c6520[_0xc749('0x36')][_0xc749('0x46')]){_0x791e39[_0xc749('0x4d')]=[{'all':!![]}];}_0x791e39=_[_0xc749('0x43')]({},_0x791e39,_0x2c6520[_0xc749('0x45')]);return db[_0xc749('0x32')]['find'](_0x791e39)[_0xc749('0x29')](handleEntityNotFound(_0x172dec,null))['then'](respondWithResult(_0x172dec,null))[_0xc749('0x48')](handleError(_0x172dec,null));};exports[_0xc749('0x4e')]=function(_0x52879f,_0x46a5d6){return db[_0xc749('0x32')][_0xc749('0x4e')](_0x52879f[_0xc749('0x4f')],{})[_0xc749('0x29')](respondWithResult(_0x46a5d6,0xc9))['catch'](handleError(_0x46a5d6,null));};exports[_0xc749('0x28')]=function(_0x540d14,_0x3a59ba){if(_0x540d14[_0xc749('0x4f')]['id']){delete _0x540d14[_0xc749('0x4f')]['id'];}return db['SquareRecording'][_0xc749('0x50')]({'where':{'id':_0x540d14['params']['id']}})[_0xc749('0x29')](handleEntityNotFound(_0x3a59ba,null))[_0xc749('0x29')](saveUpdates(_0x540d14[_0xc749('0x4f')],null))[_0xc749('0x29')](respondWithResult(_0x3a59ba,null))[_0xc749('0x48')](handleError(_0x3a59ba,null));};exports['download']=function(_0x1f9356,_0x231d38,_0x45c986){var _0x26dfb2=require(_0xc749('0x51'));var _0x1dbece=![];var _0x568c64={};if(_0x1f9356[_0xc749('0x36')][_0xc749('0x33')]&&_0x1f9356['query']['type']==='uniqueid'){_0x568c64[_0xc749('0x52')]=_0x1f9356[_0xc749('0x4a')]['id'];}else{_0x568c64['id']=_0x1f9356[_0xc749('0x4a')]['id'];}return db[_0xc749('0x32')][_0xc749('0x50')]({'where':_0x568c64,'attributes':['id','savePath',_0xc749('0x53')],'raw':!![]})[_0xc749('0x29')](handleEntityNotFound(_0x231d38,null))[_0xc749('0x29')](function(_0x62e73b){if(_0x62e73b){var _0x231b2c=_0x62e73b[_0xc749('0x54')];var _0x344407=util[_0xc749('0x55')](_0xc749('0x56'),_0x231b2c);if(fs[_0xc749('0x57')](_0x344407)){_0x1dbece=!![];return _0x26dfb2[_0xc749('0x58')](_0x344407,_0x231b2c,config[_0xc749('0x59')][_0xc749('0x5a')])['then'](function(){return _0x62e73b;});}return _0x62e73b;}})[_0xc749('0x29')](function(_0x4ce727){if(_0x4ce727){var _0x1b20fb=_0x4ce727[_0xc749('0x54')];if(!fs[_0xc749('0x57')](_0x1b20fb)){throw new db[(_0xc749('0x5b'))][(_0xc749('0x5c'))](_0xc749('0x5d'));}if(_0x4ce727[_0xc749('0x53')]){return _0x231d38['download'](_0x1b20fb,_0x4ce727[_0xc749('0x53')]+path[_0xc749('0x5e')](_0x1b20fb),function(){if(_0x1dbece){fs[_0xc749('0x5f')](_0x1b20fb);}});}else{return _0x231d38[_0xc749('0x60')](_0x1b20fb,function(_0x4bb42a){if(_0x1dbece){fs[_0xc749('0x5f')](_0x1b20fb);}});}}})[_0xc749('0x48')](function(_0x3b3b81){if(_0x3b3b81[_0xc749('0x61')]==='SquareRecording\x20not\x20found'){_0x231d38[_0xc749('0x1c')](0x194)[_0xc749('0x2f')](_0xc749('0x62'));}else{return handleError(_0x231d38,null);}});};exports['destroy']=function(_0x2d7137,_0x206aef){return db[_0xc749('0x32')][_0xc749('0x50')]({'where':{'id':_0x2d7137[_0xc749('0x4a')]['id']}})['then'](function(_0x1fefb9){if(_['isNil'](_0x1fefb9)){throw new ReferenceError(_0xc749('0x63'));}return _0x1fefb9;})[_0xc749('0x29')](function(_0x3ed65d){var _0x2b0fba=_0x3ed65d[_0xc749('0x54')];logger[_0xc749('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x2b0fba);if(!_[_0xc749('0x65')](_0x3ed65d[_0xc749('0x54')])&&fs[_0xc749('0x57')](_0x2b0fba)){logger[_0xc749('0x64')](_0xc749('0x66')+_0x2b0fba+_0xc749('0x67'));fs['unlinkSync'](_0x2b0fba);}_0x2b0fba=_0x2b0fba+_0xc749('0x68');if(!_[_0xc749('0x65')](_0x3ed65d[_0xc749('0x54')])&&fs[_0xc749('0x57')](_0x2b0fba)){logger['info'](_0xc749('0x66')+_0x2b0fba+_0xc749('0x67'));fs[_0xc749('0x69')](_0x2b0fba);}return _0x3ed65d;})['then'](function(_0x144aa0){if(!_0x144aa0)throw new InternalError();return _0x144aa0[_0xc749('0x2a')]();})['then'](function(){_0x206aef[_0xc749('0x1c')](0xcc)[_0xc749('0x1d')]();})['catch'](handleError(_0x206aef,null));}; \ No newline at end of file +var _0xc138=['fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','then','destroy','sendStatus','error','stack','send','index','SquareRecording','rawAttributes','name','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','download','../../components/encryptor','type','uniqueid','savePath','filename','format','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xc138,0x172));var _0x8c13=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc138[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x8c13('0x0'));var rimraf=require(_0x8c13('0x1'));var zipdir=require(_0x8c13('0x2'));var jsonpatch=require(_0x8c13('0x3'));var rp=require('request-promise');var moment=require(_0x8c13('0x4'));var BPromise=require(_0x8c13('0x5'));var Mustache=require(_0x8c13('0x6'));var util=require(_0x8c13('0x7'));var path=require('path');var sox=require(_0x8c13('0x8'));var csv=require('to-csv');var ejs=require(_0x8c13('0x9'));var fs=require('fs');var fs_extra=require(_0x8c13('0xa'));var _=require('lodash');var squel=require(_0x8c13('0xb'));var crypto=require(_0x8c13('0xc'));var jsforce=require(_0x8c13('0xd'));var deskjs=require(_0x8c13('0xe'));var toCsv=require(_0x8c13('0xf'));var querystring=require(_0x8c13('0x10'));var Papa=require(_0x8c13('0x11'));var Redis=require(_0x8c13('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8c13('0x13'));var as=require(_0x8c13('0x14'));var hardwareService=require(_0x8c13('0x15'));var logger=require('../../config/logger')(_0x8c13('0x16'));var utils=require('../../config/utils');var config=require(_0x8c13('0x17'));var licenseUtil=require(_0x8c13('0x18'));var db=require(_0x8c13('0x19'))['db'];function respondWithStatusCode(_0x4b5b17,_0x1edc4d){_0x1edc4d=_0x1edc4d||0xcc;return function(_0x2f3de5){if(_0x2f3de5){return _0x4b5b17['sendStatus'](_0x1edc4d);}return _0x4b5b17[_0x8c13('0x1a')](_0x1edc4d)[_0x8c13('0x1b')]();};}function respondWithResult(_0x2aeedf,_0x2dca00){_0x2dca00=_0x2dca00||0xc8;return function(_0x99548b){if(_0x99548b){return _0x2aeedf[_0x8c13('0x1a')](_0x2dca00)['json'](_0x99548b);}};}function respondWithFilteredResult(_0x308712,_0x574162){return function(_0xf243cb){if(_0xf243cb){var _0xaa1056=typeof _0x574162[_0x8c13('0x1c')]===_0x8c13('0x1d')&&typeof _0x574162[_0x8c13('0x1e')]==='undefined';var _0x145a38=_0xf243cb[_0x8c13('0x1f')];var _0x1859be=_0xaa1056?0x0:_0x574162[_0x8c13('0x1c')];var _0x289604=_0xaa1056?_0xf243cb[_0x8c13('0x1f')]:_0x574162[_0x8c13('0x1c')]+_0x574162[_0x8c13('0x1e')];var _0x4a6b26;if(_0x289604>=_0x145a38){_0x289604=_0x145a38;_0x4a6b26=0xc8;}else{_0x4a6b26=0xce;}_0x308712['status'](_0x4a6b26);return _0x308712['set']('Content-Range',_0x1859be+'-'+_0x289604+'/'+_0x145a38)[_0x8c13('0x20')](_0xf243cb);}return null;};}function patchUpdates(_0x3a2e7b){return function(_0x12be33){try{jsonpatch[_0x8c13('0x21')](_0x12be33,_0x3a2e7b,!![]);}catch(_0x29dc02){return BPromise['reject'](_0x29dc02);}return _0x12be33['save']();};}function saveUpdates(_0x1f6de8,_0xd47abd){return function(_0x34b118){if(_0x34b118){return _0x34b118['update'](_0x1f6de8)[_0x8c13('0x22')](function(_0x516610){return _0x516610;});}return null;};}function removeEntity(_0x11c993,_0x1ac07f){return function(_0x289587){if(_0x289587){return _0x289587[_0x8c13('0x23')]()['then'](function(){_0x11c993[_0x8c13('0x1a')](0xcc)[_0x8c13('0x1b')]();});}};}function handleEntityNotFound(_0xa3708b,_0x2df9d8){return function(_0x50d6a5){if(!_0x50d6a5){_0xa3708b[_0x8c13('0x24')](0x194);}return _0x50d6a5;};}function handleError(_0x2f7f21,_0xcbf49){_0xcbf49=_0xcbf49||0x1f4;return function(_0x295cc0){logger[_0x8c13('0x25')](_0x295cc0[_0x8c13('0x26')]);if(_0x295cc0['name']){delete _0x295cc0['name'];}_0x2f7f21['status'](_0xcbf49)[_0x8c13('0x27')](_0x295cc0);};}exports[_0x8c13('0x28')]=function(_0x541d21,_0x4b0c7e){var _0x14d250={},_0x291207={},_0x1c9507={'count':0x0,'rows':[]};var _0x50d29c=_['map'](db[_0x8c13('0x29')][_0x8c13('0x2a')],function(_0x56cbc){return{'name':_0x56cbc['fieldName'],'type':_0x56cbc['type']['key']};});_0x291207['model']=_['map'](_0x50d29c,_0x8c13('0x2b'));_0x291207['query']=_[_0x8c13('0x2c')](_0x541d21[_0x8c13('0x2d')]);_0x291207[_0x8c13('0x2e')]=_[_0x8c13('0x2f')](_0x291207[_0x8c13('0x30')],_0x291207[_0x8c13('0x2d')]);_0x14d250['attributes']=_[_0x8c13('0x2f')](_0x291207['model'],qs['fields'](_0x541d21[_0x8c13('0x2d')][_0x8c13('0x31')]));_0x14d250[_0x8c13('0x32')]=_0x14d250[_0x8c13('0x32')][_0x8c13('0x33')]?_0x14d250[_0x8c13('0x32')]:_0x291207[_0x8c13('0x30')];if(!_0x541d21[_0x8c13('0x2d')]['hasOwnProperty'](_0x8c13('0x34'))){_0x14d250[_0x8c13('0x1e')]=qs[_0x8c13('0x1e')](_0x541d21[_0x8c13('0x2d')][_0x8c13('0x1e')]);_0x14d250[_0x8c13('0x1c')]=qs['offset'](_0x541d21[_0x8c13('0x2d')][_0x8c13('0x1c')]);}_0x14d250[_0x8c13('0x35')]=qs['sort'](_0x541d21[_0x8c13('0x2d')][_0x8c13('0x36')]);_0x14d250[_0x8c13('0x37')]=qs['filters'](_['pick'](_0x541d21['query'],_0x291207[_0x8c13('0x2e')]),_0x50d29c);if(_0x541d21[_0x8c13('0x2d')][_0x8c13('0x38')]){_0x14d250[_0x8c13('0x37')]=_[_0x8c13('0x39')](_0x14d250[_0x8c13('0x37')],{'$or':_[_0x8c13('0x3a')](_0x50d29c,function(_0x927c9e){if(_0x927c9e['type']!==_0x8c13('0x3b')){var _0xd428fa={};_0xd428fa[_0x927c9e[_0x8c13('0x2b')]]={'$like':'%'+_0x541d21['query'][_0x8c13('0x38')]+'%'};return _0xd428fa;}})});}_0x14d250=_['merge']({},_0x14d250,_0x541d21[_0x8c13('0x3c')]);var _0x3fd993={'where':_0x14d250[_0x8c13('0x37')]};return db[_0x8c13('0x29')][_0x8c13('0x1f')](_0x3fd993)[_0x8c13('0x22')](function(_0x447599){_0x1c9507[_0x8c13('0x1f')]=_0x447599;if(_0x541d21[_0x8c13('0x2d')][_0x8c13('0x3d')]){_0x14d250[_0x8c13('0x3e')]=[{'all':!![]}];}return db[_0x8c13('0x29')][_0x8c13('0x3f')](_0x14d250);})[_0x8c13('0x22')](function(_0x4ca4f0){_0x1c9507[_0x8c13('0x40')]=_0x4ca4f0;return _0x1c9507;})[_0x8c13('0x22')](respondWithFilteredResult(_0x4b0c7e,_0x14d250))[_0x8c13('0x41')](handleError(_0x4b0c7e,null));};exports[_0x8c13('0x42')]=function(_0x2526bc,_0x39040f){var _0x3cf2fb={'raw':!![],'where':{'id':_0x2526bc[_0x8c13('0x43')]['id']}},_0x337018={};_0x337018[_0x8c13('0x30')]=_[_0x8c13('0x2c')](db[_0x8c13('0x29')][_0x8c13('0x2a')]);_0x337018['query']=_[_0x8c13('0x2c')](_0x2526bc[_0x8c13('0x2d')]);_0x337018['filters']=_['intersection'](_0x337018[_0x8c13('0x30')],_0x337018[_0x8c13('0x2d')]);_0x3cf2fb['attributes']=_[_0x8c13('0x2f')](_0x337018['model'],qs[_0x8c13('0x31')](_0x2526bc[_0x8c13('0x2d')][_0x8c13('0x31')]));_0x3cf2fb[_0x8c13('0x32')]=_0x3cf2fb[_0x8c13('0x32')][_0x8c13('0x33')]?_0x3cf2fb['attributes']:_0x337018[_0x8c13('0x30')];if(_0x2526bc['query']['includeAll']){_0x3cf2fb[_0x8c13('0x3e')]=[{'all':!![]}];}_0x3cf2fb=_['merge']({},_0x3cf2fb,_0x2526bc[_0x8c13('0x3c')]);return db[_0x8c13('0x29')][_0x8c13('0x44')](_0x3cf2fb)[_0x8c13('0x22')](handleEntityNotFound(_0x39040f,null))[_0x8c13('0x22')](respondWithResult(_0x39040f,null))[_0x8c13('0x41')](handleError(_0x39040f,null));};exports[_0x8c13('0x45')]=function(_0x569ad6,_0x5cddd6){return db[_0x8c13('0x29')][_0x8c13('0x45')](_0x569ad6[_0x8c13('0x46')],{})[_0x8c13('0x22')](respondWithResult(_0x5cddd6,0xc9))[_0x8c13('0x41')](handleError(_0x5cddd6,null));};exports[_0x8c13('0x47')]=function(_0x1994c4,_0x486ff8){if(_0x1994c4[_0x8c13('0x46')]['id']){delete _0x1994c4[_0x8c13('0x46')]['id'];}return db[_0x8c13('0x29')][_0x8c13('0x44')]({'where':{'id':_0x1994c4['params']['id']}})[_0x8c13('0x22')](handleEntityNotFound(_0x486ff8,null))['then'](saveUpdates(_0x1994c4['body'],null))[_0x8c13('0x22')](respondWithResult(_0x486ff8,null))['catch'](handleError(_0x486ff8,null));};exports[_0x8c13('0x48')]=function(_0x58ab72,_0x4b8375,_0x41afe5){var _0x1bf793=require(_0x8c13('0x49'));var _0x25983e=![];var _0x5e2e56={};if(_0x58ab72[_0x8c13('0x2d')]['type']&&_0x58ab72[_0x8c13('0x2d')][_0x8c13('0x4a')]==='uniqueid'){_0x5e2e56[_0x8c13('0x4b')]=_0x58ab72[_0x8c13('0x43')]['id'];}else{_0x5e2e56['id']=_0x58ab72['params']['id'];}return db[_0x8c13('0x29')]['find']({'where':_0x5e2e56,'attributes':['id',_0x8c13('0x4c'),_0x8c13('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x4b8375,null))['then'](function(_0x393c72){if(_0x393c72){var _0x948ee4=_0x393c72['savePath'];var _0x5b80a9=util[_0x8c13('0x4e')]('%s.cypher',_0x948ee4);if(fs[_0x8c13('0x4f')](_0x5b80a9)){_0x25983e=!![];return _0x1bf793['decryptFile'](_0x5b80a9,_0x948ee4,config[_0x8c13('0x50')][_0x8c13('0x51')])['then'](function(){return _0x393c72;});}return _0x393c72;}})[_0x8c13('0x22')](function(_0x49243a){if(_0x49243a){var _0x25dbb6=_0x49243a[_0x8c13('0x4c')];if(!fs[_0x8c13('0x4f')](_0x25dbb6)){throw new db[(_0x8c13('0x52'))][(_0x8c13('0x53'))](_0x8c13('0x54'));}if(_0x49243a[_0x8c13('0x4d')]){return _0x4b8375[_0x8c13('0x48')](_0x25dbb6,_0x49243a[_0x8c13('0x4d')]+path['extname'](_0x25dbb6),function(){if(_0x25983e){fs['unlink'](_0x25dbb6);}});}else{return _0x4b8375[_0x8c13('0x48')](_0x25dbb6,function(_0x1cc456){if(_0x25983e){fs[_0x8c13('0x55')](_0x25dbb6);}});}}})[_0x8c13('0x41')](function(_0x4572c5){if(_0x4572c5[_0x8c13('0x56')]==='SquareRecording\x20not\x20found'){_0x4b8375[_0x8c13('0x1a')](0x194)[_0x8c13('0x27')](_0x8c13('0x57'));}else{return handleError(_0x4b8375,null);}});};exports[_0x8c13('0x23')]=function(_0x4c9982,_0x408935){return db['SquareRecording'][_0x8c13('0x44')]({'where':{'id':_0x4c9982[_0x8c13('0x43')]['id']}})[_0x8c13('0x22')](function(_0x561aa0){if(_[_0x8c13('0x58')](_0x561aa0)){throw new ReferenceError('Entity\x20not\x20found');}return _0x561aa0;})[_0x8c13('0x22')](function(_0x1c88fc){var _0x238f56=_0x1c88fc[_0x8c13('0x4c')];logger[_0x8c13('0x59')](_0x8c13('0x5a'),_0x238f56);if(!_[_0x8c13('0x58')](_0x1c88fc[_0x8c13('0x4c')])&&fs[_0x8c13('0x4f')](_0x238f56)){logger[_0x8c13('0x59')](_0x8c13('0x5b')+_0x238f56+_0x8c13('0x5c'));fs[_0x8c13('0x5d')](_0x238f56);}_0x238f56=_0x238f56+_0x8c13('0x5e');if(!_[_0x8c13('0x58')](_0x1c88fc[_0x8c13('0x4c')])&&fs[_0x8c13('0x4f')](_0x238f56)){logger[_0x8c13('0x59')](_0x8c13('0x5b')+_0x238f56+_0x8c13('0x5c'));fs[_0x8c13('0x5d')](_0x238f56);}return _0x1c88fc;})[_0x8c13('0x22')](function(_0x5f2059){if(!_0x5f2059)throw new InternalError();return _0x5f2059[_0x8c13('0x23')]();})[_0x8c13('0x22')](function(){_0x408935['status'](0xcc)[_0x8c13('0x1b')]();})[_0x8c13('0x41')](handleError(_0x408935,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 5755788..1b555e8 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 _0x0eeb=['../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0eeb[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require(_0xb0ee('0x4'));var BPromise=require(_0xb0ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x209dda,_0x453fa4){return _0x209dda[_0xb0ee('0xa')]('SquareRecording',attributes,{'tableName':_0xb0ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x958a=['bluebird','request-promise','path','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util','api','moment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x958a,0x128));var _0xa958=function(_0xf70548,_0x5bb4d0){_0xf70548=_0xf70548-0x0;var _0x44b74e=_0x958a[_0xf70548];return _0x44b74e;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')(_0xa958('0x2'));var moment=require(_0xa958('0x3'));var BPromise=require(_0xa958('0x4'));var rp=require(_0xa958('0x5'));var fs=require('fs');var path=require(_0xa958('0x6'));var rimraf=require('rimraf');var config=require(_0xa958('0x7'));var attributes=require('./squareRecording.attributes');module[_0xa958('0x8')]=function(_0x9b7d9e,_0x2692d6){return _0x9b7d9e[_0xa958('0x9')](_0xa958('0xa'),attributes,{'tableName':_0xa958('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index e72a844..273fdc3 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 _0x3987=['error','message','result','CreateSquareRecording','create','body','options','raw','stringify','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x3987,0x14f));var _0x7398=function(_0x3fd059,_0xc153df){_0x3fd059=_0x3fd059-0x0;var _0x21816e=_0x3987[_0x3fd059];return _0x21816e;};'use strict';var _=require(_0x7398('0x0'));var util=require('util');var moment=require(_0x7398('0x1'));var BPromise=require('bluebird');var rs=require(_0x7398('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7398('0x3'))['db'];var utils=require(_0x7398('0x4'));var logger=require('../../config/logger')(_0x7398('0x5'));var config=require(_0x7398('0x6'));var jayson=require(_0x7398('0x7'));var client=jayson['client'][_0x7398('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4896e9,_0x3aba35,_0xae4641){return new BPromise(function(_0x20f4f9,_0x5978af){return client['request'](_0x4896e9,_0xae4641)[_0x7398('0x9')](function(_0x331994){logger[_0x7398('0xa')](_0x7398('0xb'),_0x3aba35,_0x7398('0xc'));logger[_0x7398('0xd')](_0x7398('0xe'),_0x3aba35,_0x7398('0xc'),JSON['stringify'](_0x331994));if(_0x331994[_0x7398('0xf')]){if(_0x331994[_0x7398('0xf')]['code']===0x1f4){logger[_0x7398('0xf')](_0x7398('0xb'),_0x3aba35,_0x331994[_0x7398('0xf')][_0x7398('0x10')]);return _0x5978af(_0x331994['error'][_0x7398('0x10')]);}logger[_0x7398('0xf')](_0x7398('0xb'),_0x3aba35,_0x331994['error'][_0x7398('0x10')]);return _0x20f4f9(_0x331994['error']['message']);}else{logger[_0x7398('0xa')](_0x7398('0xb'),_0x3aba35,'request\x20sent');_0x20f4f9(_0x331994[_0x7398('0x11')][_0x7398('0x10')]);}})['catch'](function(_0x4d8ca4){logger[_0x7398('0xf')](_0x7398('0xb'),_0x3aba35,_0x4d8ca4);_0x5978af(_0x4d8ca4);});});}exports[_0x7398('0x12')]=function(_0x2b2631){var _0x22d2ec=this;return new Promise(function(_0x8f28eb,_0x730c6c){return db['SquareRecording'][_0x7398('0x13')](_0x2b2631[_0x7398('0x14')],{'raw':_0x2b2631[_0x7398('0x15')]?_0x2b2631[_0x7398('0x15')][_0x7398('0x16')]===undefined?!![]:![]:!![]})[_0x7398('0x9')](function(_0x3c0252){logger[_0x7398('0xa')](_0x7398('0x12'),_0x2b2631);logger[_0x7398('0xd')]('CreateSquareRecording',_0x2b2631,JSON[_0x7398('0x17')](_0x3c0252));_0x8f28eb(_0x3c0252);})[_0x7398('0x18')](function(_0x5b6cdf){logger['error'](_0x7398('0x12'),_0x5b6cdf['message'],_0x2b2631);_0x730c6c(_0x22d2ec['error'](0x1f4,_0x5b6cdf[_0x7398('0x10')]));});});}; \ No newline at end of file +var _0x69c6=['client','http','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','create','body','options','info','debug','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x69c6,0xe2));var _0x669c=function(_0x1687b4,_0x2661ab){_0x1687b4=_0x1687b4-0x0;var _0x45d6b0=_0x69c6[_0x1687b4];return _0x45d6b0;};'use strict';var _=require(_0x669c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x669c('0x1'));var rs=require(_0x669c('0x2'));var fs=require('fs');var Redis=require(_0x669c('0x3'));var db=require(_0x669c('0x4'))['db'];var utils=require(_0x669c('0x5'));var logger=require('../../config/logger')(_0x669c('0x6'));var config=require(_0x669c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x669c('0x8')][_0x669c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58bae3,_0x169e58,_0x2d9116){return new BPromise(function(_0x737daa,_0x523b98){return client['request'](_0x58bae3,_0x2d9116)[_0x669c('0xa')](function(_0x45f431){logger['info'](_0x669c('0xb'),_0x169e58,_0x669c('0xc'));logger['debug'](_0x669c('0xd'),_0x169e58,_0x669c('0xc'),JSON[_0x669c('0xe')](_0x45f431));if(_0x45f431[_0x669c('0xf')]){if(_0x45f431[_0x669c('0xf')][_0x669c('0x10')]===0x1f4){logger[_0x669c('0xf')](_0x669c('0xb'),_0x169e58,_0x45f431[_0x669c('0xf')][_0x669c('0x11')]);return _0x523b98(_0x45f431[_0x669c('0xf')][_0x669c('0x11')]);}logger[_0x669c('0xf')](_0x669c('0xb'),_0x169e58,_0x45f431[_0x669c('0xf')][_0x669c('0x11')]);return _0x737daa(_0x45f431[_0x669c('0xf')]['message']);}else{logger['info'](_0x669c('0xb'),_0x169e58,_0x669c('0xc'));_0x737daa(_0x45f431[_0x669c('0x12')]['message']);}})['catch'](function(_0x1e41ab){logger[_0x669c('0xf')](_0x669c('0xb'),_0x169e58,_0x1e41ab);_0x523b98(_0x1e41ab);});});}exports[_0x669c('0x13')]=function(_0x1d6a3e){var _0x4cbde3=this;return new Promise(function(_0x713237,_0x498923){return db['SquareRecording'][_0x669c('0x14')](_0x1d6a3e[_0x669c('0x15')],{'raw':_0x1d6a3e[_0x669c('0x16')]?_0x1d6a3e[_0x669c('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x400f40){logger[_0x669c('0x17')](_0x669c('0x13'),_0x1d6a3e);logger[_0x669c('0x18')]('CreateSquareRecording',_0x1d6a3e,JSON[_0x669c('0xe')](_0x400f40));_0x713237(_0x400f40);})[_0x669c('0x19')](function(_0x51ba2f){logger[_0x669c('0xf')]('CreateSquareRecording',_0x51ba2f[_0x669c('0x11')],_0x1d6a3e);_0x498923(_0x4cbde3[_0x669c('0xf')](0x1f4,_0x51ba2f[_0x669c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1cd9b4b..11d1734 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(_0x2cf702,_0x333323){var _0x15f7a6=function(_0x164eeb){while(--_0x164eeb){_0x2cf702['push'](_0x2cf702['shift']());}};_0x15f7a6(++_0x333323);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 2dcdb60..5fed21a 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 _0xc946=['sequelize','exports','STRING','DATE'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xc946,0x140));var _0x6c94=function(_0x1b75fb,_0x2680ec){_0x1b75fb=_0x1b75fb-0x0;var _0x2e0ee2=_0xc946[_0x1b75fb];return _0x2e0ee2;};'use strict';var Sequelize=require(_0x6c94('0x0'));module[_0x6c94('0x1')]={'network':{'type':Sequelize[_0x6c94('0x2')]},'network_script':{'type':Sequelize[_0x6c94('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6c94('0x2')]},'language':{'type':Sequelize[_0x6c94('0x2')]},'type':{'type':Sequelize[_0x6c94('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x6c94('0x2')]},'callerid':{'type':Sequelize[_0x6c94('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x6c94('0x2')]},'callingani2':{'type':Sequelize[_0x6c94('0x2')]},'callington':{'type':Sequelize[_0x6c94('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6c94('0x2')]},'rdnis':{'type':Sequelize[_0x6c94('0x2')]},'context':{'type':Sequelize[_0x6c94('0x2')]},'extension':{'type':Sequelize[_0x6c94('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x6c94('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6c94('0x3')]},'leaveAt':{'type':Sequelize[_0x6c94('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xaa56=['DATE','BOOLEAN','exports','STRING'];(function(_0x4d1083,_0x186e4c){var _0x444e4c=function(_0x5ee74d){while(--_0x5ee74d){_0x4d1083['push'](_0x4d1083['shift']());}};_0x444e4c(++_0x186e4c);}(_0xaa56,0xc6));var _0x6aa5=function(_0x31929e,_0x5121dd){_0x31929e=_0x31929e-0x0;var _0x5c3ec5=_0xaa56[_0x31929e];return _0x5c3ec5;};'use strict';var Sequelize=require('sequelize');module[_0x6aa5('0x0')]={'network':{'type':Sequelize[_0x6aa5('0x1')]},'network_script':{'type':Sequelize[_0x6aa5('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6aa5('0x1')]},'language':{'type':Sequelize[_0x6aa5('0x1')]},'type':{'type':Sequelize[_0x6aa5('0x1')]},'uniqueid':{'type':Sequelize[_0x6aa5('0x1')]},'version':{'type':Sequelize[_0x6aa5('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6aa5('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x6aa5('0x1')]},'callington':{'type':Sequelize[_0x6aa5('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6aa5('0x1')]},'rdnis':{'type':Sequelize[_0x6aa5('0x1')]},'context':{'type':Sequelize[_0x6aa5('0x1')]},'extension':{'type':Sequelize[_0x6aa5('0x1')]},'priority':{'type':Sequelize[_0x6aa5('0x1')]},'enhanced':{'type':Sequelize[_0x6aa5('0x1')]},'accountcode':{'type':Sequelize[_0x6aa5('0x1')]},'threadid':{'type':Sequelize[_0x6aa5('0x1')]},'project_name':{'type':Sequelize[_0x6aa5('0x1')]},'joinAt':{'type':Sequelize[_0x6aa5('0x2')]},'leaveAt':{'type':Sequelize[_0x6aa5('0x2')]},'bot':{'type':Sequelize[_0x6aa5('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 0d7ae1c..7dafff2 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 _0xa7d4=['squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','SquareReport','includeAll','include','findAll','rows','find','create','body','update','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash'];(function(_0xd27c3e,_0x18dc7f){var _0x12a81e=function(_0x515b7d){while(--_0x515b7d){_0xd27c3e['push'](_0xd27c3e['shift']());}};_0x12a81e(++_0x18dc7f);}(_0xa7d4,0xd3));var _0x4a7d=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xa7d4[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0x4a7d('0x0'));var rimraf=require(_0x4a7d('0x1'));var zipdir=require(_0x4a7d('0x2'));var jsonpatch=require(_0x4a7d('0x3'));var rp=require(_0x4a7d('0x4'));var moment=require('moment');var BPromise=require(_0x4a7d('0x5'));var Mustache=require(_0x4a7d('0x6'));var util=require(_0x4a7d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4a7d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a7d('0x9'));var _=require(_0x4a7d('0xa'));var squel=require(_0x4a7d('0xb'));var crypto=require(_0x4a7d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4a7d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4a7d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a7d('0xf'));var qs=require(_0x4a7d('0x10'));var as=require(_0x4a7d('0x11'));var hardwareService=require(_0x4a7d('0x12'));var logger=require('../../config/logger')(_0x4a7d('0x13'));var utils=require(_0x4a7d('0x14'));var config=require(_0x4a7d('0x15'));var licenseUtil=require(_0x4a7d('0x16'));var db=require(_0x4a7d('0x17'))['db'];function respondWithStatusCode(_0x5c6caf,_0x5b51b0){_0x5b51b0=_0x5b51b0||0xcc;return function(_0x4dd7b4){if(_0x4dd7b4){return _0x5c6caf['sendStatus'](_0x5b51b0);}return _0x5c6caf[_0x4a7d('0x18')](_0x5b51b0)[_0x4a7d('0x19')]();};}function respondWithResult(_0x33c01b,_0x201a5f){_0x201a5f=_0x201a5f||0xc8;return function(_0x3f4ed2){if(_0x3f4ed2){return _0x33c01b[_0x4a7d('0x18')](_0x201a5f)[_0x4a7d('0x1a')](_0x3f4ed2);}};}function respondWithFilteredResult(_0x76464a,_0x4b6e1c){return function(_0x226f09){if(_0x226f09){var _0x500143=typeof _0x4b6e1c[_0x4a7d('0x1b')]==='undefined'&&typeof _0x4b6e1c[_0x4a7d('0x1c')]===_0x4a7d('0x1d');var _0x2317a5=_0x226f09[_0x4a7d('0x1e')];var _0x5e84ea=_0x500143?0x0:_0x4b6e1c[_0x4a7d('0x1b')];var _0x20b7f8=_0x500143?_0x226f09[_0x4a7d('0x1e')]:_0x4b6e1c['offset']+_0x4b6e1c[_0x4a7d('0x1c')];var _0xedf70d;if(_0x20b7f8>=_0x2317a5){_0x20b7f8=_0x2317a5;_0xedf70d=0xc8;}else{_0xedf70d=0xce;}_0x76464a[_0x4a7d('0x18')](_0xedf70d);return _0x76464a[_0x4a7d('0x1f')]('Content-Range',_0x5e84ea+'-'+_0x20b7f8+'/'+_0x2317a5)[_0x4a7d('0x1a')](_0x226f09);}return null;};}function patchUpdates(_0x4956a8){return function(_0x259a84){try{jsonpatch[_0x4a7d('0x20')](_0x259a84,_0x4956a8,!![]);}catch(_0x495989){return BPromise[_0x4a7d('0x21')](_0x495989);}return _0x259a84[_0x4a7d('0x22')]();};}function saveUpdates(_0x5a46a2,_0x22c09c){return function(_0x7acf79){if(_0x7acf79){return _0x7acf79['update'](_0x5a46a2)[_0x4a7d('0x23')](function(_0x315e61){return _0x315e61;});}return null;};}function removeEntity(_0x20e68d,_0x17ee0d){return function(_0x462ebd){if(_0x462ebd){return _0x462ebd[_0x4a7d('0x24')]()[_0x4a7d('0x23')](function(){_0x20e68d['status'](0xcc)[_0x4a7d('0x19')]();});}};}function handleEntityNotFound(_0x328b24,_0x49954f){return function(_0x2ed816){if(!_0x2ed816){_0x328b24[_0x4a7d('0x25')](0x194);}return _0x2ed816;};}function handleError(_0x5697d1,_0x3ee922){_0x3ee922=_0x3ee922||0x1f4;return function(_0x360c6a){logger[_0x4a7d('0x26')](_0x360c6a[_0x4a7d('0x27')]);if(_0x360c6a['name']){delete _0x360c6a[_0x4a7d('0x28')];}_0x5697d1[_0x4a7d('0x18')](_0x3ee922)['send'](_0x360c6a);};}exports[_0x4a7d('0x29')]=function(_0x27d312,_0x271562){var _0x4a6af3={},_0x4941d0={},_0x22bf32={'count':0x0,'rows':[]};var _0x2a76ab=_[_0x4a7d('0x2a')](db['SquareReport'][_0x4a7d('0x2b')],function(_0x246950){return{'name':_0x246950[_0x4a7d('0x2c')],'type':_0x246950[_0x4a7d('0x2d')][_0x4a7d('0x2e')]};});_0x4941d0[_0x4a7d('0x2f')]=_['map'](_0x2a76ab,_0x4a7d('0x28'));_0x4941d0[_0x4a7d('0x30')]=_[_0x4a7d('0x31')](_0x27d312[_0x4a7d('0x30')]);_0x4941d0[_0x4a7d('0x32')]=_[_0x4a7d('0x33')](_0x4941d0['model'],_0x4941d0[_0x4a7d('0x30')]);_0x4a6af3[_0x4a7d('0x34')]=_['intersection'](_0x4941d0[_0x4a7d('0x2f')],qs[_0x4a7d('0x35')](_0x27d312[_0x4a7d('0x30')][_0x4a7d('0x35')]));_0x4a6af3[_0x4a7d('0x34')]=_0x4a6af3[_0x4a7d('0x34')][_0x4a7d('0x36')]?_0x4a6af3['attributes']:_0x4941d0['model'];if(!_0x27d312[_0x4a7d('0x30')][_0x4a7d('0x37')]('nolimit')){_0x4a6af3[_0x4a7d('0x1c')]=qs['limit'](_0x27d312['query'][_0x4a7d('0x1c')]);_0x4a6af3['offset']=qs[_0x4a7d('0x1b')](_0x27d312[_0x4a7d('0x30')][_0x4a7d('0x1b')]);}_0x4a6af3[_0x4a7d('0x38')]=qs[_0x4a7d('0x39')](_0x27d312[_0x4a7d('0x30')]['sort']);_0x4a6af3[_0x4a7d('0x3a')]=qs[_0x4a7d('0x32')](_['pick'](_0x27d312['query'],_0x4941d0[_0x4a7d('0x32')]),_0x2a76ab);if(_0x27d312[_0x4a7d('0x30')][_0x4a7d('0x3b')]){_0x4a6af3[_0x4a7d('0x3a')]=_['merge'](_0x4a6af3['where'],{'$or':_[_0x4a7d('0x2a')](_0x2a76ab,function(_0x491eaf){if(_0x491eaf[_0x4a7d('0x2d')]!==_0x4a7d('0x3c')){var _0x473a20={};_0x473a20[_0x491eaf[_0x4a7d('0x28')]]={'$like':'%'+_0x27d312[_0x4a7d('0x30')][_0x4a7d('0x3b')]+'%'};return _0x473a20;}})});}_0x4a6af3=_[_0x4a7d('0x3d')]({},_0x4a6af3,_0x27d312[_0x4a7d('0x3e')]);var _0x52e128={'where':_0x4a6af3[_0x4a7d('0x3a')]};return db[_0x4a7d('0x3f')]['count'](_0x52e128)[_0x4a7d('0x23')](function(_0x5a33ca){_0x22bf32['count']=_0x5a33ca;if(_0x27d312[_0x4a7d('0x30')][_0x4a7d('0x40')]){_0x4a6af3[_0x4a7d('0x41')]=[{'all':!![]}];}return db[_0x4a7d('0x3f')][_0x4a7d('0x42')](_0x4a6af3);})[_0x4a7d('0x23')](function(_0x5e9984){_0x22bf32[_0x4a7d('0x43')]=_0x5e9984;return _0x22bf32;})['then'](respondWithFilteredResult(_0x271562,_0x4a6af3))['catch'](handleError(_0x271562,null));};exports['show']=function(_0x47654c,_0x4d5191){var _0x72a52d={'raw':!![],'where':{'id':_0x47654c['params']['id']}},_0x5bb6de={};_0x5bb6de[_0x4a7d('0x2f')]=_['keys'](db[_0x4a7d('0x3f')]['rawAttributes']);_0x5bb6de[_0x4a7d('0x30')]=_['keys'](_0x47654c[_0x4a7d('0x30')]);_0x5bb6de[_0x4a7d('0x32')]=_[_0x4a7d('0x33')](_0x5bb6de[_0x4a7d('0x2f')],_0x5bb6de[_0x4a7d('0x30')]);_0x72a52d[_0x4a7d('0x34')]=_[_0x4a7d('0x33')](_0x5bb6de['model'],qs[_0x4a7d('0x35')](_0x47654c[_0x4a7d('0x30')][_0x4a7d('0x35')]));_0x72a52d[_0x4a7d('0x34')]=_0x72a52d['attributes']['length']?_0x72a52d[_0x4a7d('0x34')]:_0x5bb6de['model'];if(_0x47654c['query']['includeAll']){_0x72a52d[_0x4a7d('0x41')]=[{'all':!![]}];}_0x72a52d=_[_0x4a7d('0x3d')]({},_0x72a52d,_0x47654c[_0x4a7d('0x3e')]);return db[_0x4a7d('0x3f')][_0x4a7d('0x44')](_0x72a52d)[_0x4a7d('0x23')](handleEntityNotFound(_0x4d5191,null))[_0x4a7d('0x23')](respondWithResult(_0x4d5191,null))['catch'](handleError(_0x4d5191,null));};exports[_0x4a7d('0x45')]=function(_0x34f84b,_0x1369e7){return db[_0x4a7d('0x3f')][_0x4a7d('0x45')](_0x34f84b[_0x4a7d('0x46')],{})[_0x4a7d('0x23')](respondWithResult(_0x1369e7,0xc9))['catch'](handleError(_0x1369e7,null));};exports[_0x4a7d('0x47')]=function(_0x4e9a31,_0x47cf3a){if(_0x4e9a31['body']['id']){delete _0x4e9a31['body']['id'];}return db[_0x4a7d('0x3f')][_0x4a7d('0x44')]({'where':{'id':_0x4e9a31[_0x4a7d('0x48')]['id']}})['then'](handleEntityNotFound(_0x47cf3a,null))[_0x4a7d('0x23')](saveUpdates(_0x4e9a31[_0x4a7d('0x46')],null))[_0x4a7d('0x23')](respondWithResult(_0x47cf3a,null))[_0x4a7d('0x49')](handleError(_0x47cf3a,null));};exports[_0x4a7d('0x24')]=function(_0xcac625,_0x58a15e){return db['SquareReport']['find']({'where':{'id':_0xcac625[_0x4a7d('0x48')]['id']}})['then'](handleEntityNotFound(_0x58a15e,null))[_0x4a7d('0x23')](removeEntity(_0x58a15e,null))['catch'](handleError(_0x58a15e,null));};exports['describe']=function(_0x3945cc,_0x195a9c){return db[_0x4a7d('0x3f')]['describe']()[_0x4a7d('0x23')](respondWithResult(_0x195a9c,null))['catch'](handleError(_0x195a9c,null));}; \ No newline at end of file +var _0x7ebe=['body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','SquareReport','findAll','rows','catch','show','params','find','create','update'];(function(_0x2eae90,_0x3b09f2){var _0x27fce6=function(_0x30c5c7){while(--_0x30c5c7){_0x2eae90['push'](_0x2eae90['shift']());}};_0x27fce6(++_0x3b09f2);}(_0x7ebe,0xf8));var _0xe7eb=function(_0x3e660e,_0x443de6){_0x3e660e=_0x3e660e-0x0;var _0x113b80=_0x7ebe[_0x3e660e];return _0x113b80;};'use strict';var emlformat=require(_0xe7eb('0x0'));var rimraf=require(_0xe7eb('0x1'));var zipdir=require(_0xe7eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7eb('0x3'));var moment=require('moment');var BPromise=require(_0xe7eb('0x4'));var Mustache=require(_0xe7eb('0x5'));var util=require(_0xe7eb('0x6'));var path=require(_0xe7eb('0x7'));var sox=require(_0xe7eb('0x8'));var csv=require(_0xe7eb('0x9'));var ejs=require(_0xe7eb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7eb('0xb'));var _=require(_0xe7eb('0xc'));var squel=require(_0xe7eb('0xd'));var crypto=require(_0xe7eb('0xe'));var jsforce=require(_0xe7eb('0xf'));var deskjs=require(_0xe7eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe7eb('0x11'));var Papa=require(_0xe7eb('0x12'));var Redis=require(_0xe7eb('0x13'));var authService=require(_0xe7eb('0x14'));var qs=require(_0xe7eb('0x15'));var as=require(_0xe7eb('0x16'));var hardwareService=require(_0xe7eb('0x17'));var logger=require(_0xe7eb('0x18'))(_0xe7eb('0x19'));var utils=require(_0xe7eb('0x1a'));var config=require(_0xe7eb('0x1b'));var licenseUtil=require(_0xe7eb('0x1c'));var db=require(_0xe7eb('0x1d'))['db'];function respondWithStatusCode(_0x34c6d8,_0x226f73){_0x226f73=_0x226f73||0xcc;return function(_0x500e45){if(_0x500e45){return _0x34c6d8[_0xe7eb('0x1e')](_0x226f73);}return _0x34c6d8[_0xe7eb('0x1f')](_0x226f73)[_0xe7eb('0x20')]();};}function respondWithResult(_0x8b26c6,_0x36fa50){_0x36fa50=_0x36fa50||0xc8;return function(_0x20ce7b){if(_0x20ce7b){return _0x8b26c6[_0xe7eb('0x1f')](_0x36fa50)[_0xe7eb('0x21')](_0x20ce7b);}};}function respondWithFilteredResult(_0x1e0b69,_0x9d9670){return function(_0x3396ff){if(_0x3396ff){var _0x20bc30=typeof _0x9d9670[_0xe7eb('0x22')]===_0xe7eb('0x23')&&typeof _0x9d9670['limit']===_0xe7eb('0x23');var _0x4e90b5=_0x3396ff[_0xe7eb('0x24')];var _0x5f0c39=_0x20bc30?0x0:_0x9d9670['offset'];var _0x4e626c=_0x20bc30?_0x3396ff[_0xe7eb('0x24')]:_0x9d9670[_0xe7eb('0x22')]+_0x9d9670[_0xe7eb('0x25')];var _0x54f135;if(_0x4e626c>=_0x4e90b5){_0x4e626c=_0x4e90b5;_0x54f135=0xc8;}else{_0x54f135=0xce;}_0x1e0b69[_0xe7eb('0x1f')](_0x54f135);return _0x1e0b69['set'](_0xe7eb('0x26'),_0x5f0c39+'-'+_0x4e626c+'/'+_0x4e90b5)['json'](_0x3396ff);}return null;};}function patchUpdates(_0x18a540){return function(_0x37db86){try{jsonpatch[_0xe7eb('0x27')](_0x37db86,_0x18a540,!![]);}catch(_0x1f4b34){return BPromise[_0xe7eb('0x28')](_0x1f4b34);}return _0x37db86[_0xe7eb('0x29')]();};}function saveUpdates(_0xe27c3,_0x5efc8b){return function(_0xfd2357){if(_0xfd2357){return _0xfd2357['update'](_0xe27c3)['then'](function(_0xd4b6f9){return _0xd4b6f9;});}return null;};}function removeEntity(_0x1d7516,_0x40dc38){return function(_0x46f9cf){if(_0x46f9cf){return _0x46f9cf[_0xe7eb('0x2a')]()[_0xe7eb('0x2b')](function(){_0x1d7516[_0xe7eb('0x1f')](0xcc)[_0xe7eb('0x20')]();});}};}function handleEntityNotFound(_0x287f0e,_0x3a4a80){return function(_0x4dad21){if(!_0x4dad21){_0x287f0e[_0xe7eb('0x1e')](0x194);}return _0x4dad21;};}function handleError(_0x2d6545,_0x4c7922){_0x4c7922=_0x4c7922||0x1f4;return function(_0x4cbe85){logger[_0xe7eb('0x2c')](_0x4cbe85[_0xe7eb('0x2d')]);if(_0x4cbe85[_0xe7eb('0x2e')]){delete _0x4cbe85['name'];}_0x2d6545[_0xe7eb('0x1f')](_0x4c7922)[_0xe7eb('0x2f')](_0x4cbe85);};}exports['index']=function(_0x1bad98,_0x594e8b){var _0x3441bc={},_0x54e443={},_0x224d9e={'count':0x0,'rows':[]};var _0x285446=_[_0xe7eb('0x30')](db['SquareReport'][_0xe7eb('0x31')],function(_0x321dca){return{'name':_0x321dca[_0xe7eb('0x32')],'type':_0x321dca[_0xe7eb('0x33')][_0xe7eb('0x34')]};});_0x54e443[_0xe7eb('0x35')]=_[_0xe7eb('0x30')](_0x285446,_0xe7eb('0x2e'));_0x54e443[_0xe7eb('0x36')]=_['keys'](_0x1bad98[_0xe7eb('0x36')]);_0x54e443['filters']=_[_0xe7eb('0x37')](_0x54e443[_0xe7eb('0x35')],_0x54e443[_0xe7eb('0x36')]);_0x3441bc[_0xe7eb('0x38')]=_[_0xe7eb('0x37')](_0x54e443[_0xe7eb('0x35')],qs[_0xe7eb('0x39')](_0x1bad98['query']['fields']));_0x3441bc['attributes']=_0x3441bc[_0xe7eb('0x38')][_0xe7eb('0x3a')]?_0x3441bc[_0xe7eb('0x38')]:_0x54e443[_0xe7eb('0x35')];if(!_0x1bad98[_0xe7eb('0x36')]['hasOwnProperty'](_0xe7eb('0x3b'))){_0x3441bc[_0xe7eb('0x25')]=qs[_0xe7eb('0x25')](_0x1bad98['query'][_0xe7eb('0x25')]);_0x3441bc[_0xe7eb('0x22')]=qs[_0xe7eb('0x22')](_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x22')]);}_0x3441bc[_0xe7eb('0x3c')]=qs[_0xe7eb('0x3d')](_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x3d')]);_0x3441bc[_0xe7eb('0x3e')]=qs[_0xe7eb('0x3f')](_[_0xe7eb('0x40')](_0x1bad98[_0xe7eb('0x36')],_0x54e443[_0xe7eb('0x3f')]),_0x285446);if(_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x41')]){_0x3441bc['where']=_[_0xe7eb('0x42')](_0x3441bc[_0xe7eb('0x3e')],{'$or':_[_0xe7eb('0x30')](_0x285446,function(_0x47724c){if(_0x47724c[_0xe7eb('0x33')]!==_0xe7eb('0x43')){var _0x49f807={};_0x49f807[_0x47724c[_0xe7eb('0x2e')]]={'$like':'%'+_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x41')]+'%'};return _0x49f807;}})});}_0x3441bc=_[_0xe7eb('0x42')]({},_0x3441bc,_0x1bad98[_0xe7eb('0x44')]);var _0x4d9589={'where':_0x3441bc[_0xe7eb('0x3e')]};return db['SquareReport'][_0xe7eb('0x24')](_0x4d9589)[_0xe7eb('0x2b')](function(_0x71dd51){_0x224d9e[_0xe7eb('0x24')]=_0x71dd51;if(_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x45')]){_0x3441bc[_0xe7eb('0x46')]=[{'all':!![]}];}return db[_0xe7eb('0x47')][_0xe7eb('0x48')](_0x3441bc);})[_0xe7eb('0x2b')](function(_0x166cf2){_0x224d9e[_0xe7eb('0x49')]=_0x166cf2;return _0x224d9e;})[_0xe7eb('0x2b')](respondWithFilteredResult(_0x594e8b,_0x3441bc))[_0xe7eb('0x4a')](handleError(_0x594e8b,null));};exports[_0xe7eb('0x4b')]=function(_0xab3225,_0x2d6266){var _0x54cf11={'raw':!![],'where':{'id':_0xab3225[_0xe7eb('0x4c')]['id']}},_0x37de08={};_0x37de08[_0xe7eb('0x35')]=_['keys'](db[_0xe7eb('0x47')][_0xe7eb('0x31')]);_0x37de08[_0xe7eb('0x36')]=_['keys'](_0xab3225[_0xe7eb('0x36')]);_0x37de08['filters']=_[_0xe7eb('0x37')](_0x37de08['model'],_0x37de08[_0xe7eb('0x36')]);_0x54cf11[_0xe7eb('0x38')]=_[_0xe7eb('0x37')](_0x37de08[_0xe7eb('0x35')],qs['fields'](_0xab3225['query'][_0xe7eb('0x39')]));_0x54cf11[_0xe7eb('0x38')]=_0x54cf11[_0xe7eb('0x38')][_0xe7eb('0x3a')]?_0x54cf11[_0xe7eb('0x38')]:_0x37de08[_0xe7eb('0x35')];if(_0xab3225[_0xe7eb('0x36')][_0xe7eb('0x45')]){_0x54cf11[_0xe7eb('0x46')]=[{'all':!![]}];}_0x54cf11=_[_0xe7eb('0x42')]({},_0x54cf11,_0xab3225[_0xe7eb('0x44')]);return db[_0xe7eb('0x47')][_0xe7eb('0x4d')](_0x54cf11)[_0xe7eb('0x2b')](handleEntityNotFound(_0x2d6266,null))[_0xe7eb('0x2b')](respondWithResult(_0x2d6266,null))['catch'](handleError(_0x2d6266,null));};exports['create']=function(_0xd8f9a0,_0x1ae74e){return db[_0xe7eb('0x47')][_0xe7eb('0x4e')](_0xd8f9a0['body'],{})[_0xe7eb('0x2b')](respondWithResult(_0x1ae74e,0xc9))['catch'](handleError(_0x1ae74e,null));};exports[_0xe7eb('0x4f')]=function(_0x3105f2,_0xdf5a41){if(_0x3105f2[_0xe7eb('0x50')]['id']){delete _0x3105f2[_0xe7eb('0x50')]['id'];}return db[_0xe7eb('0x47')][_0xe7eb('0x4d')]({'where':{'id':_0x3105f2[_0xe7eb('0x4c')]['id']}})[_0xe7eb('0x2b')](handleEntityNotFound(_0xdf5a41,null))[_0xe7eb('0x2b')](saveUpdates(_0x3105f2[_0xe7eb('0x50')],null))[_0xe7eb('0x2b')](respondWithResult(_0xdf5a41,null))[_0xe7eb('0x4a')](handleError(_0xdf5a41,null));};exports['destroy']=function(_0x1e3af6,_0x5694ab){return db[_0xe7eb('0x47')]['find']({'where':{'id':_0x1e3af6['params']['id']}})['then'](handleEntityNotFound(_0x5694ab,null))[_0xe7eb('0x2b')](removeEntity(_0x5694ab,null))[_0xe7eb('0x4a')](handleError(_0x5694ab,null));};exports[_0xe7eb('0x51')]=function(_0x1db503,_0x3433a8){return db[_0xe7eb('0x47')]['describe']()['then'](respondWithResult(_0x3433a8,null))[_0xe7eb('0x4a')](handleError(_0x3433a8,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2aecfc0..1300f74 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 _0x9f7b=['../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','project_name','leaveAt','util','api','moment','request-promise','path'];(function(_0xcdda78,_0x4a51e7){var _0x251064=function(_0x28f112){while(--_0x28f112){_0xcdda78['push'](_0xcdda78['shift']());}};_0x251064(++_0x4a51e7);}(_0x9f7b,0x7d));var _0xb9f7=function(_0x2864eb,_0x292273){_0x2864eb=_0x2864eb-0x0;var _0x1e537e=_0x9f7b[_0x2864eb];return _0x1e537e;};'use strict';var _=require('lodash');var util=require(_0xb9f7('0x0'));var logger=require('../../config/logger')(_0xb9f7('0x1'));var moment=require(_0xb9f7('0x2'));var BPromise=require('bluebird');var rp=require(_0xb9f7('0x3'));var fs=require('fs');var path=require(_0xb9f7('0x4'));var rimraf=require('rimraf');var config=require(_0xb9f7('0x5'));var attributes=require(_0xb9f7('0x6'));module[_0xb9f7('0x7')]=function(_0x2125eb,_0x43b611){return _0x2125eb[_0xb9f7('0x8')](_0xb9f7('0x9'),attributes,{'tableName':_0xb9f7('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0xb9f7('0xb')]},{'name':_0xb9f7('0xc'),'fields':[_0xb9f7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c59=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5c59,0x12a));var _0x95c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c59[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x95c5('0x0'));var util=require(_0x95c5('0x1'));var logger=require(_0x95c5('0x2'))('api');var moment=require(_0x95c5('0x3'));var BPromise=require(_0x95c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95c5('0x5'));var config=require(_0x95c5('0x6'));var attributes=require(_0x95c5('0x7'));module[_0x95c5('0x8')]=function(_0x38bcc6,_0x54e85c){return _0x38bcc6[_0x95c5('0x9')](_0x95c5('0xa'),attributes,{'tableName':_0x95c5('0xb'),'paranoid':![],'indexes':[{'name':_0x95c5('0xc'),'fields':['uniqueid',_0x95c5('0xd')]},{'name':_0x95c5('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index dfb1258..c64ca5a 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 _0xa394=['attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','then','catch','UpdateSquareReport','update','where'];(function(_0x5e8deb,_0x5dff57){var _0x3d6fbd=function(_0x1c8be6){while(--_0x1c8be6){_0x5e8deb['push'](_0x5e8deb['shift']());}};_0x3d6fbd(++_0x5dff57);}(_0xa394,0x1c9));var _0x4a39=function(_0x397948,_0x3e2212){_0x397948=_0x397948-0x0;var _0x43cb1f=_0xa394[_0x397948];return _0x43cb1f;};'use strict';var _=require(_0x4a39('0x0'));var util=require('util');var moment=require(_0x4a39('0x1'));var BPromise=require(_0x4a39('0x2'));var rs=require(_0x4a39('0x3'));var fs=require('fs');var Redis=require(_0x4a39('0x4'));var db=require(_0x4a39('0x5'))['db'];var utils=require(_0x4a39('0x6'));var logger=require(_0x4a39('0x7'))(_0x4a39('0x8'));var config=require(_0x4a39('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4a39('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19fe29,_0x18d131,_0x42c93b){return new BPromise(function(_0x3846d0,_0x4d247c){return client[_0x4a39('0xb')](_0x19fe29,_0x42c93b)['then'](function(_0x352b1c){logger[_0x4a39('0xc')](_0x4a39('0xd'),_0x18d131,_0x4a39('0xe'));logger[_0x4a39('0xf')](_0x4a39('0x10'),_0x18d131,_0x4a39('0xe'),JSON[_0x4a39('0x11')](_0x352b1c));if(_0x352b1c['error']){if(_0x352b1c[_0x4a39('0x12')][_0x4a39('0x13')]===0x1f4){logger[_0x4a39('0x12')]('SquareReport,\x20%s,\x20%s',_0x18d131,_0x352b1c[_0x4a39('0x12')][_0x4a39('0x14')]);return _0x4d247c(_0x352b1c[_0x4a39('0x12')][_0x4a39('0x14')]);}logger[_0x4a39('0x12')](_0x4a39('0xd'),_0x18d131,_0x352b1c[_0x4a39('0x12')][_0x4a39('0x14')]);return _0x3846d0(_0x352b1c[_0x4a39('0x12')][_0x4a39('0x14')]);}else{logger[_0x4a39('0xc')](_0x4a39('0xd'),_0x18d131,_0x4a39('0xe'));_0x3846d0(_0x352b1c[_0x4a39('0x15')][_0x4a39('0x14')]);}})['catch'](function(_0x425aac){logger[_0x4a39('0x12')](_0x4a39('0xd'),_0x18d131,_0x425aac);_0x4d247c(_0x425aac);});});}exports[_0x4a39('0x16')]=function(_0x45a234){var _0x2ec5d6=this;return new Promise(function(_0x29d91c,_0x567330){return db[_0x4a39('0x17')][_0x4a39('0x18')](_0x45a234[_0x4a39('0x19')],{'raw':_0x45a234['options']?_0x45a234[_0x4a39('0x1a')][_0x4a39('0x1b')]===undefined?!![]:![]:!![]})[_0x4a39('0x1c')](function(_0x458e72){logger[_0x4a39('0xc')](_0x4a39('0x16'),_0x45a234);logger[_0x4a39('0xf')]('CreateSquareReport',_0x45a234,JSON[_0x4a39('0x11')](_0x458e72));_0x29d91c(_0x458e72);})[_0x4a39('0x1d')](function(_0x4b8fa1){logger[_0x4a39('0x12')](_0x4a39('0x16'),_0x4b8fa1[_0x4a39('0x14')],_0x45a234);_0x567330(_0x2ec5d6[_0x4a39('0x12')](0x1f4,_0x4b8fa1[_0x4a39('0x14')]));});});};exports[_0x4a39('0x1e')]=function(_0x586139){var _0x1632c1=this;return new Promise(function(_0x3664ea,_0x1cabdf){return db[_0x4a39('0x17')][_0x4a39('0x1f')](_0x586139[_0x4a39('0x19')],{'raw':_0x586139[_0x4a39('0x1a')]?_0x586139[_0x4a39('0x1a')][_0x4a39('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x586139[_0x4a39('0x1a')]?_0x586139['options'][_0x4a39('0x20')]||null:null,'attributes':_0x586139[_0x4a39('0x1a')]?_0x586139[_0x4a39('0x1a')][_0x4a39('0x21')]||null:null,'limit':_0x586139[_0x4a39('0x1a')]?_0x586139[_0x4a39('0x1a')][_0x4a39('0x22')]||null:null})[_0x4a39('0x1c')](function(_0x521c7a){logger[_0x4a39('0xc')](_0x4a39('0x1e'),_0x586139);logger[_0x4a39('0xf')](_0x4a39('0x1e'),_0x586139,JSON['stringify'](_0x521c7a));_0x3664ea(_0x521c7a);})[_0x4a39('0x1d')](function(_0x539b37){logger[_0x4a39('0x12')](_0x4a39('0x1e'),_0x539b37[_0x4a39('0x14')],_0x586139);_0x1cabdf(_0x1632c1[_0x4a39('0x12')](0x1f4,_0x539b37[_0x4a39('0x14')]));});});}; \ No newline at end of file +var _0xeb54=['error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x57a060,_0x3daa47){var _0x3b5ed6=function(_0x11d3e1){while(--_0x11d3e1){_0x57a060['push'](_0x57a060['shift']());}};_0x3b5ed6(++_0x3daa47);}(_0xeb54,0x14c));var _0x4eb5=function(_0x2c0fa9,_0x4277b9){_0x2c0fa9=_0x2c0fa9-0x0;var _0x5224aa=_0xeb54[_0x2c0fa9];return _0x5224aa;};'use strict';var _=require(_0x4eb5('0x0'));var util=require(_0x4eb5('0x1'));var moment=require(_0x4eb5('0x2'));var BPromise=require('bluebird');var rs=require(_0x4eb5('0x3'));var fs=require('fs');var Redis=require(_0x4eb5('0x4'));var db=require(_0x4eb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb5('0x6'))('rpc');var config=require(_0x4eb5('0x7'));var jayson=require(_0x4eb5('0x8'));var client=jayson[_0x4eb5('0x9')][_0x4eb5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f0a4c,_0x3e5ef8,_0x20adb9){return new BPromise(function(_0x3f1383,_0x2e747e){return client[_0x4eb5('0xb')](_0x4f0a4c,_0x20adb9)['then'](function(_0x25c11b){logger[_0x4eb5('0xc')](_0x4eb5('0xd'),_0x3e5ef8,_0x4eb5('0xe'));logger[_0x4eb5('0xf')](_0x4eb5('0x10'),_0x3e5ef8,_0x4eb5('0xe'),JSON[_0x4eb5('0x11')](_0x25c11b));if(_0x25c11b[_0x4eb5('0x12')]){if(_0x25c11b[_0x4eb5('0x12')][_0x4eb5('0x13')]===0x1f4){logger[_0x4eb5('0x12')](_0x4eb5('0xd'),_0x3e5ef8,_0x25c11b[_0x4eb5('0x12')][_0x4eb5('0x14')]);return _0x2e747e(_0x25c11b['error'][_0x4eb5('0x14')]);}logger['error'](_0x4eb5('0xd'),_0x3e5ef8,_0x25c11b['error']['message']);return _0x3f1383(_0x25c11b[_0x4eb5('0x12')][_0x4eb5('0x14')]);}else{logger[_0x4eb5('0xc')](_0x4eb5('0xd'),_0x3e5ef8,_0x4eb5('0xe'));_0x3f1383(_0x25c11b[_0x4eb5('0x15')]['message']);}})['catch'](function(_0x1a2a69){logger['error'](_0x4eb5('0xd'),_0x3e5ef8,_0x1a2a69);_0x2e747e(_0x1a2a69);});});}exports[_0x4eb5('0x16')]=function(_0x5315cb){var _0x30188d=this;return new Promise(function(_0x135827,_0x5c9e2f){return db[_0x4eb5('0x17')][_0x4eb5('0x18')](_0x5315cb[_0x4eb5('0x19')],{'raw':_0x5315cb['options']?_0x5315cb[_0x4eb5('0x1a')][_0x4eb5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1e6d95){logger[_0x4eb5('0xc')](_0x4eb5('0x16'),_0x5315cb);logger[_0x4eb5('0xf')]('CreateSquareReport',_0x5315cb,JSON[_0x4eb5('0x11')](_0x1e6d95));_0x135827(_0x1e6d95);})[_0x4eb5('0x1c')](function(_0x3024ed){logger['error'](_0x4eb5('0x16'),_0x3024ed[_0x4eb5('0x14')],_0x5315cb);_0x5c9e2f(_0x30188d[_0x4eb5('0x12')](0x1f4,_0x3024ed[_0x4eb5('0x14')]));});});};exports[_0x4eb5('0x1d')]=function(_0x522d6e){var _0x19fe02=this;return new Promise(function(_0x4b1078,_0x7caf4d){return db[_0x4eb5('0x17')][_0x4eb5('0x1e')](_0x522d6e[_0x4eb5('0x19')],{'raw':_0x522d6e['options']?_0x522d6e[_0x4eb5('0x1a')][_0x4eb5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522d6e[_0x4eb5('0x1a')]?_0x522d6e[_0x4eb5('0x1a')][_0x4eb5('0x1f')]||null:null,'attributes':_0x522d6e[_0x4eb5('0x1a')]?_0x522d6e[_0x4eb5('0x1a')][_0x4eb5('0x20')]||null:null,'limit':_0x522d6e[_0x4eb5('0x1a')]?_0x522d6e[_0x4eb5('0x1a')][_0x4eb5('0x21')]||null:null})[_0x4eb5('0x22')](function(_0x2dbf45){logger[_0x4eb5('0xc')](_0x4eb5('0x1d'),_0x522d6e);logger[_0x4eb5('0xf')]('UpdateSquareReport',_0x522d6e,JSON[_0x4eb5('0x11')](_0x2dbf45));_0x4b1078(_0x2dbf45);})[_0x4eb5('0x1c')](function(_0x34c33f){logger[_0x4eb5('0x12')](_0x4eb5('0x1d'),_0x34c33f[_0x4eb5('0x14')],_0x522d6e);_0x7caf4d(_0x19fe02['error'](0x1f4,_0x34c33f[_0x4eb5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6a74572..16ceec3 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 _0x53f4=['/:id','show','create','put','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5c7e00,_0x48e6c1){var _0x289ba9=function(_0x38da0d){while(--_0x38da0d){_0x5c7e00['push'](_0x5c7e00['shift']());}};_0x289ba9(++_0x48e6c1);}(_0x53f4,0x1e2));var _0x453f=function(_0x40feb0,_0x10f1a4){_0x40feb0=_0x40feb0-0x0;var _0x4b45bf=_0x53f4[_0x40feb0];return _0x4b45bf;};'use strict';var multer=require('multer');var util=require(_0x453f('0x0'));var path=require('path');var timeout=require(_0x453f('0x1'));var express=require(_0x453f('0x2'));var router=express['Router']();var fs_extra=require(_0x453f('0x3'));var auth=require(_0x453f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x453f('0x5'));var controller=require(_0x453f('0x6'));router[_0x453f('0x7')]('/',auth[_0x453f('0x8')](),controller[_0x453f('0x9')]);router[_0x453f('0x7')](_0x453f('0xa'),auth[_0x453f('0x8')](),controller[_0x453f('0xb')]);router[_0x453f('0x7')](_0x453f('0xc'),auth[_0x453f('0x8')](),controller[_0x453f('0xd')]);router['post']('/',auth[_0x453f('0x8')](),controller[_0x453f('0xe')]);router[_0x453f('0xf')](_0x453f('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x453f('0x10')](_0x453f('0xc'),auth[_0x453f('0x8')](),controller[_0x453f('0x11')]);module[_0x453f('0x12')]=router; \ No newline at end of file +var _0x3eda=['create','/:id','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show'];(function(_0x323626,_0x23a399){var _0x32d9c7=function(_0x3b5789){while(--_0x3b5789){_0x323626['push'](_0x323626['shift']());}};_0x32d9c7(++_0x23a399);}(_0x3eda,0x1e1));var _0xa3ed=function(_0x3cb679,_0x28195f){_0x3cb679=_0x3cb679-0x0;var _0x18f926=_0x3eda[_0x3cb679];return _0x18f926;};'use strict';var multer=require(_0xa3ed('0x0'));var util=require('util');var path=require(_0xa3ed('0x1'));var timeout=require('connect-timeout');var express=require(_0xa3ed('0x2'));var router=express[_0xa3ed('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa3ed('0x4'));var interaction=require(_0xa3ed('0x5'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xa3ed('0x6')]('/',auth['isAuthenticated'](),controller[_0xa3ed('0x7')]);router['get'](_0xa3ed('0x8'),auth[_0xa3ed('0x9')](),controller[_0xa3ed('0xa')]);router['get']('/:id',auth[_0xa3ed('0x9')](),controller[_0xa3ed('0xb')]);router['post']('/',auth[_0xa3ed('0x9')](),controller[_0xa3ed('0xc')]);router['put'](_0xa3ed('0xd'),auth['isAuthenticated'](),controller[_0xa3ed('0xe')]);router[_0xa3ed('0xf')]('/:id',auth[_0xa3ed('0x9')](),controller[_0xa3ed('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index d133ad6..eb8ef06 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 _0x1bb7=['STRING','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1bb7,0x1c0));var _0x71bb=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1bb7[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x71bb('0x0'));module[_0x71bb('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x71bb('0x2')]},'application':{'type':Sequelize[_0x71bb('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x71bb('0x2')]},'callerid':{'type':Sequelize[_0x71bb('0x2')]}}; \ No newline at end of file +var _0x1af6=['exports','STRING','sequelize'];(function(_0x32f834,_0x29d346){var _0x57e253=function(_0x86c610){while(--_0x86c610){_0x32f834['push'](_0x32f834['shift']());}};_0x57e253(++_0x29d346);}(_0x1af6,0x1c7));var _0x61af=function(_0x3e7a28,_0x25a64e){_0x3e7a28=_0x3e7a28-0x0;var _0x51387b=_0x1af6[_0x3e7a28];return _0x51387b;};'use strict';var Sequelize=require(_0x61af('0x0'));module[_0x61af('0x1')]={'uniqueid':{'type':Sequelize[_0x61af('0x2')]},'node':{'type':Sequelize[_0x61af('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x61af('0x2')]},'callerid':{'type':Sequelize[_0x61af('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 3557942..5e5b4a2 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 _0x0dd9=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x2913b5,_0x2387c0){var _0x2ca1cc=function(_0xc2045b){while(--_0xc2045b){_0x2913b5['push'](_0x2913b5['shift']());}};_0x2ca1cc(++_0x2387c0);}(_0x0dd9,0x84));var _0x90dd=function(_0x22a413,_0x86da8b){_0x22a413=_0x22a413-0x0;var _0x4d0ecb=_0x0dd9[_0x22a413];return _0x4d0ecb;};'use strict';var emlformat=require(_0x90dd('0x0'));var rimraf=require(_0x90dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90dd('0x2'));var rp=require(_0x90dd('0x3'));var moment=require('moment');var BPromise=require(_0x90dd('0x4'));var Mustache=require(_0x90dd('0x5'));var util=require('util');var path=require(_0x90dd('0x6'));var sox=require(_0x90dd('0x7'));var csv=require(_0x90dd('0x8'));var ejs=require(_0x90dd('0x9'));var fs=require('fs');var fs_extra=require(_0x90dd('0xa'));var _=require(_0x90dd('0xb'));var squel=require(_0x90dd('0xc'));var crypto=require('crypto');var jsforce=require(_0x90dd('0xd'));var deskjs=require(_0x90dd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x90dd('0xf'));var Papa=require(_0x90dd('0x10'));var Redis=require('ioredis');var authService=require(_0x90dd('0x11'));var qs=require(_0x90dd('0x12'));var as=require(_0x90dd('0x13'));var hardwareService=require(_0x90dd('0x14'));var logger=require(_0x90dd('0x15'))(_0x90dd('0x16'));var utils=require(_0x90dd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x90dd('0x18'))['db'];function respondWithStatusCode(_0x24357e,_0x2514fb){_0x2514fb=_0x2514fb||0xcc;return function(_0x4b2eba){if(_0x4b2eba){return _0x24357e[_0x90dd('0x19')](_0x2514fb);}return _0x24357e[_0x90dd('0x1a')](_0x2514fb)[_0x90dd('0x1b')]();};}function respondWithResult(_0x20fe79,_0x422f33){_0x422f33=_0x422f33||0xc8;return function(_0x45509f){if(_0x45509f){return _0x20fe79[_0x90dd('0x1a')](_0x422f33)[_0x90dd('0x1c')](_0x45509f);}};}function respondWithFilteredResult(_0x890369,_0x335cc5){return function(_0x1ce609){if(_0x1ce609){var _0x4fd433=typeof _0x335cc5[_0x90dd('0x1d')]===_0x90dd('0x1e')&&typeof _0x335cc5[_0x90dd('0x1f')]===_0x90dd('0x1e');var _0x2be68b=_0x1ce609['count'];var _0x140e37=_0x4fd433?0x0:_0x335cc5[_0x90dd('0x1d')];var _0x331318=_0x4fd433?_0x1ce609[_0x90dd('0x20')]:_0x335cc5[_0x90dd('0x1d')]+_0x335cc5[_0x90dd('0x1f')];var _0x2c7692;if(_0x331318>=_0x2be68b){_0x331318=_0x2be68b;_0x2c7692=0xc8;}else{_0x2c7692=0xce;}_0x890369[_0x90dd('0x1a')](_0x2c7692);return _0x890369['set']('Content-Range',_0x140e37+'-'+_0x331318+'/'+_0x2be68b)['json'](_0x1ce609);}return null;};}function patchUpdates(_0x52ac20){return function(_0x3cfe8a){try{jsonpatch[_0x90dd('0x21')](_0x3cfe8a,_0x52ac20,!![]);}catch(_0x50fd7c){return BPromise[_0x90dd('0x22')](_0x50fd7c);}return _0x3cfe8a[_0x90dd('0x23')]();};}function saveUpdates(_0x195512,_0x23fe07){return function(_0x5d3771){if(_0x5d3771){return _0x5d3771[_0x90dd('0x24')](_0x195512)[_0x90dd('0x25')](function(_0x5f4653){return _0x5f4653;});}return null;};}function removeEntity(_0x5e55bf,_0x24327d){return function(_0xef5ee){if(_0xef5ee){return _0xef5ee['destroy']()[_0x90dd('0x25')](function(){_0x5e55bf[_0x90dd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14cb9c,_0x3c17db){return function(_0x40e110){if(!_0x40e110){_0x14cb9c[_0x90dd('0x19')](0x194);}return _0x40e110;};}function handleError(_0x335ea5,_0x43ae86){_0x43ae86=_0x43ae86||0x1f4;return function(_0x2e3a21){logger['error'](_0x2e3a21[_0x90dd('0x26')]);if(_0x2e3a21[_0x90dd('0x27')]){delete _0x2e3a21[_0x90dd('0x27')];}_0x335ea5[_0x90dd('0x1a')](_0x43ae86)[_0x90dd('0x28')](_0x2e3a21);};}exports[_0x90dd('0x29')]=function(_0x128e11,_0x5b7118){var _0x36e409={},_0xa8496a={},_0x58bac9={'count':0x0,'rows':[]};var _0x37c839=_[_0x90dd('0x2a')](db[_0x90dd('0x2b')][_0x90dd('0x2c')],function(_0x417c8f){return{'name':_0x417c8f[_0x90dd('0x2d')],'type':_0x417c8f[_0x90dd('0x2e')][_0x90dd('0x2f')]};});_0xa8496a[_0x90dd('0x30')]=_[_0x90dd('0x2a')](_0x37c839,_0x90dd('0x27'));_0xa8496a[_0x90dd('0x31')]=_[_0x90dd('0x32')](_0x128e11[_0x90dd('0x31')]);_0xa8496a[_0x90dd('0x33')]=_[_0x90dd('0x34')](_0xa8496a[_0x90dd('0x30')],_0xa8496a[_0x90dd('0x31')]);_0x36e409['attributes']=_['intersection'](_0xa8496a[_0x90dd('0x30')],qs[_0x90dd('0x35')](_0x128e11[_0x90dd('0x31')][_0x90dd('0x35')]));_0x36e409[_0x90dd('0x36')]=_0x36e409['attributes'][_0x90dd('0x37')]?_0x36e409[_0x90dd('0x36')]:_0xa8496a[_0x90dd('0x30')];if(!_0x128e11['query']['hasOwnProperty'](_0x90dd('0x38'))){_0x36e409[_0x90dd('0x1f')]=qs[_0x90dd('0x1f')](_0x128e11[_0x90dd('0x31')]['limit']);_0x36e409[_0x90dd('0x1d')]=qs[_0x90dd('0x1d')](_0x128e11[_0x90dd('0x31')][_0x90dd('0x1d')]);}_0x36e409[_0x90dd('0x39')]=qs[_0x90dd('0x3a')](_0x128e11[_0x90dd('0x31')]['sort']);_0x36e409[_0x90dd('0x3b')]=qs['filters'](_[_0x90dd('0x3c')](_0x128e11[_0x90dd('0x31')],_0xa8496a[_0x90dd('0x33')]),_0x37c839);if(_0x128e11[_0x90dd('0x31')][_0x90dd('0x3d')]){_0x36e409[_0x90dd('0x3b')]=_['merge'](_0x36e409[_0x90dd('0x3b')],{'$or':_['map'](_0x37c839,function(_0x535ab3){if(_0x535ab3[_0x90dd('0x2e')]!==_0x90dd('0x3e')){var _0x335e3b={};_0x335e3b[_0x535ab3['name']]={'$like':'%'+_0x128e11[_0x90dd('0x31')][_0x90dd('0x3d')]+'%'};return _0x335e3b;}})});}_0x36e409=_[_0x90dd('0x3f')]({},_0x36e409,_0x128e11[_0x90dd('0x40')]);var _0x2bfbda={'where':_0x36e409[_0x90dd('0x3b')]};return db[_0x90dd('0x2b')][_0x90dd('0x20')](_0x2bfbda)['then'](function(_0x53bd17){_0x58bac9[_0x90dd('0x20')]=_0x53bd17;if(_0x128e11['query'][_0x90dd('0x41')]){_0x36e409['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x36e409);})[_0x90dd('0x25')](function(_0x3b7bd0){_0x58bac9[_0x90dd('0x42')]=_0x3b7bd0;return _0x58bac9;})['then'](respondWithFilteredResult(_0x5b7118,_0x36e409))[_0x90dd('0x43')](handleError(_0x5b7118,null));};exports['show']=function(_0x28eb90,_0x3abc5c){var _0x5f21c6={'raw':!![],'where':{'id':_0x28eb90[_0x90dd('0x44')]['id']}},_0x141b85={};_0x141b85['model']=_['keys'](db[_0x90dd('0x2b')]['rawAttributes']);_0x141b85[_0x90dd('0x31')]=_[_0x90dd('0x32')](_0x28eb90[_0x90dd('0x31')]);_0x141b85[_0x90dd('0x33')]=_[_0x90dd('0x34')](_0x141b85['model'],_0x141b85[_0x90dd('0x31')]);_0x5f21c6[_0x90dd('0x36')]=_['intersection'](_0x141b85['model'],qs[_0x90dd('0x35')](_0x28eb90[_0x90dd('0x31')][_0x90dd('0x35')]));_0x5f21c6[_0x90dd('0x36')]=_0x5f21c6[_0x90dd('0x36')][_0x90dd('0x37')]?_0x5f21c6[_0x90dd('0x36')]:_0x141b85[_0x90dd('0x30')];if(_0x28eb90[_0x90dd('0x31')][_0x90dd('0x41')]){_0x5f21c6['include']=[{'all':!![]}];}_0x5f21c6=_['merge']({},_0x5f21c6,_0x28eb90[_0x90dd('0x40')]);return db[_0x90dd('0x2b')][_0x90dd('0x45')](_0x5f21c6)[_0x90dd('0x25')](handleEntityNotFound(_0x3abc5c,null))[_0x90dd('0x25')](respondWithResult(_0x3abc5c,null))['catch'](handleError(_0x3abc5c,null));};exports[_0x90dd('0x46')]=function(_0x41825a,_0x7ca784){return db[_0x90dd('0x2b')][_0x90dd('0x46')](_0x41825a['body'],{})[_0x90dd('0x25')](respondWithResult(_0x7ca784,0xc9))[_0x90dd('0x43')](handleError(_0x7ca784,null));};exports['update']=function(_0x8c0a6a,_0x395d2c){if(_0x8c0a6a[_0x90dd('0x47')]['id']){delete _0x8c0a6a[_0x90dd('0x47')]['id'];}return db[_0x90dd('0x2b')][_0x90dd('0x45')]({'where':{'id':_0x8c0a6a[_0x90dd('0x44')]['id']}})['then'](handleEntityNotFound(_0x395d2c,null))[_0x90dd('0x25')](saveUpdates(_0x8c0a6a['body'],null))['then'](respondWithResult(_0x395d2c,null))[_0x90dd('0x43')](handleError(_0x395d2c,null));};exports[_0x90dd('0x48')]=function(_0x2fba76,_0xaab39d){return db[_0x90dd('0x2b')][_0x90dd('0x45')]({'where':{'id':_0x2fba76[_0x90dd('0x44')]['id']}})[_0x90dd('0x25')](handleEntityNotFound(_0xaab39d,null))[_0x90dd('0x25')](removeEntity(_0xaab39d,null))['catch'](handleError(_0xaab39d,null));};exports[_0x90dd('0x49')]=function(_0xc30378,_0x5945f6){return db[_0x90dd('0x2b')]['describe']()[_0x90dd('0x25')](respondWithResult(_0x5945f6,null))[_0x90dd('0x43')](handleError(_0x5945f6,null));}; \ No newline at end of file +var _0xf6d4=['pick','merge','VIRTUAL','SquareDetailsReport','count','then','rows','show','params','rawAttributes','intersection','include','options','catch','create','body','find','destroy','describe','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','stack','name','map','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x196bca,_0x570e9b){var _0x54fb4c=function(_0x28ccac){while(--_0x28ccac){_0x196bca['push'](_0x196bca['shift']());}};_0x54fb4c(++_0x570e9b);}(_0xf6d4,0x180));var _0x4f6d=function(_0x198156,_0x4b6fcc){_0x198156=_0x198156-0x0;var _0x2be896=_0xf6d4[_0x198156];return _0x2be896;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f6d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f6d('0x1'));var rp=require('request-promise');var moment=require(_0x4f6d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4f6d('0x3'));var util=require('util');var path=require(_0x4f6d('0x4'));var sox=require(_0x4f6d('0x5'));var csv=require(_0x4f6d('0x6'));var ejs=require(_0x4f6d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f6d('0x8'));var squel=require(_0x4f6d('0x9'));var crypto=require(_0x4f6d('0xa'));var jsforce=require(_0x4f6d('0xb'));var deskjs=require(_0x4f6d('0xc'));var toCsv=require(_0x4f6d('0x6'));var querystring=require(_0x4f6d('0xd'));var Papa=require(_0x4f6d('0xe'));var Redis=require('ioredis');var authService=require(_0x4f6d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4f6d('0x10'));var hardwareService=require(_0x4f6d('0x11'));var logger=require(_0x4f6d('0x12'))(_0x4f6d('0x13'));var utils=require(_0x4f6d('0x14'));var config=require(_0x4f6d('0x15'));var licenseUtil=require(_0x4f6d('0x16'));var db=require(_0x4f6d('0x17'))['db'];function respondWithStatusCode(_0x120f97,_0x1e281b){_0x1e281b=_0x1e281b||0xcc;return function(_0x337e09){if(_0x337e09){return _0x120f97[_0x4f6d('0x18')](_0x1e281b);}return _0x120f97[_0x4f6d('0x19')](_0x1e281b)[_0x4f6d('0x1a')]();};}function respondWithResult(_0x2f8e47,_0x2439fe){_0x2439fe=_0x2439fe||0xc8;return function(_0x476a5f){if(_0x476a5f){return _0x2f8e47[_0x4f6d('0x19')](_0x2439fe)[_0x4f6d('0x1b')](_0x476a5f);}};}function respondWithFilteredResult(_0x1a13c7,_0x45b5dd){return function(_0xb34f14){if(_0xb34f14){var _0x47d9ed=typeof _0x45b5dd[_0x4f6d('0x1c')]===_0x4f6d('0x1d')&&typeof _0x45b5dd[_0x4f6d('0x1e')]===_0x4f6d('0x1d');var _0x5b1001=_0xb34f14['count'];var _0x17ba4d=_0x47d9ed?0x0:_0x45b5dd[_0x4f6d('0x1c')];var _0x2cac3b=_0x47d9ed?_0xb34f14['count']:_0x45b5dd[_0x4f6d('0x1c')]+_0x45b5dd[_0x4f6d('0x1e')];var _0x42de24;if(_0x2cac3b>=_0x5b1001){_0x2cac3b=_0x5b1001;_0x42de24=0xc8;}else{_0x42de24=0xce;}_0x1a13c7[_0x4f6d('0x19')](_0x42de24);return _0x1a13c7[_0x4f6d('0x1f')](_0x4f6d('0x20'),_0x17ba4d+'-'+_0x2cac3b+'/'+_0x5b1001)[_0x4f6d('0x1b')](_0xb34f14);}return null;};}function patchUpdates(_0x5d9132){return function(_0x3eeb01){try{jsonpatch[_0x4f6d('0x21')](_0x3eeb01,_0x5d9132,!![]);}catch(_0x1b7ff8){return BPromise[_0x4f6d('0x22')](_0x1b7ff8);}return _0x3eeb01[_0x4f6d('0x23')]();};}function saveUpdates(_0x5c7c34,_0x51a468){return function(_0x221286){if(_0x221286){return _0x221286[_0x4f6d('0x24')](_0x5c7c34)['then'](function(_0x17b0df){return _0x17b0df;});}return null;};}function removeEntity(_0xc4ce8c,_0x150a4e){return function(_0x24ddfd){if(_0x24ddfd){return _0x24ddfd['destroy']()['then'](function(){_0xc4ce8c[_0x4f6d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c90e,_0x306e2b){return function(_0x45219c){if(!_0x45219c){_0x46c90e[_0x4f6d('0x18')](0x194);}return _0x45219c;};}function handleError(_0xc91d55,_0x5c13d7){_0x5c13d7=_0x5c13d7||0x1f4;return function(_0x5690f7){logger['error'](_0x5690f7[_0x4f6d('0x25')]);if(_0x5690f7[_0x4f6d('0x26')]){delete _0x5690f7['name'];}_0xc91d55[_0x4f6d('0x19')](_0x5c13d7)['send'](_0x5690f7);};}exports['index']=function(_0x2361e9,_0x2518e4){var _0x32ecbf={},_0x288333={},_0x19f0e4={'count':0x0,'rows':[]};var _0x534204=_[_0x4f6d('0x27')](db['SquareDetailsReport']['rawAttributes'],function(_0x563ef4){return{'name':_0x563ef4[_0x4f6d('0x28')],'type':_0x563ef4[_0x4f6d('0x29')][_0x4f6d('0x2a')]};});_0x288333['model']=_[_0x4f6d('0x27')](_0x534204,_0x4f6d('0x26'));_0x288333[_0x4f6d('0x2b')]=_[_0x4f6d('0x2c')](_0x2361e9[_0x4f6d('0x2b')]);_0x288333[_0x4f6d('0x2d')]=_['intersection'](_0x288333[_0x4f6d('0x2e')],_0x288333[_0x4f6d('0x2b')]);_0x32ecbf['attributes']=_['intersection'](_0x288333[_0x4f6d('0x2e')],qs[_0x4f6d('0x2f')](_0x2361e9[_0x4f6d('0x2b')]['fields']));_0x32ecbf[_0x4f6d('0x30')]=_0x32ecbf[_0x4f6d('0x30')][_0x4f6d('0x31')]?_0x32ecbf['attributes']:_0x288333[_0x4f6d('0x2e')];if(!_0x2361e9['query'][_0x4f6d('0x32')]('nolimit')){_0x32ecbf[_0x4f6d('0x1e')]=qs[_0x4f6d('0x1e')](_0x2361e9[_0x4f6d('0x2b')][_0x4f6d('0x1e')]);_0x32ecbf[_0x4f6d('0x1c')]=qs[_0x4f6d('0x1c')](_0x2361e9['query'][_0x4f6d('0x1c')]);}_0x32ecbf[_0x4f6d('0x33')]=qs['sort'](_0x2361e9[_0x4f6d('0x2b')][_0x4f6d('0x34')]);_0x32ecbf[_0x4f6d('0x35')]=qs[_0x4f6d('0x2d')](_[_0x4f6d('0x36')](_0x2361e9[_0x4f6d('0x2b')],_0x288333[_0x4f6d('0x2d')]),_0x534204);if(_0x2361e9[_0x4f6d('0x2b')]['filter']){_0x32ecbf[_0x4f6d('0x35')]=_[_0x4f6d('0x37')](_0x32ecbf[_0x4f6d('0x35')],{'$or':_[_0x4f6d('0x27')](_0x534204,function(_0x461c71){if(_0x461c71[_0x4f6d('0x29')]!==_0x4f6d('0x38')){var _0x3a2b8e={};_0x3a2b8e[_0x461c71[_0x4f6d('0x26')]]={'$like':'%'+_0x2361e9[_0x4f6d('0x2b')]['filter']+'%'};return _0x3a2b8e;}})});}_0x32ecbf=_[_0x4f6d('0x37')]({},_0x32ecbf,_0x2361e9['options']);var _0x3fff4c={'where':_0x32ecbf[_0x4f6d('0x35')]};return db[_0x4f6d('0x39')][_0x4f6d('0x3a')](_0x3fff4c)['then'](function(_0x48a91e){_0x19f0e4[_0x4f6d('0x3a')]=_0x48a91e;if(_0x2361e9[_0x4f6d('0x2b')]['includeAll']){_0x32ecbf['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x32ecbf);})[_0x4f6d('0x3b')](function(_0x744410){_0x19f0e4[_0x4f6d('0x3c')]=_0x744410;return _0x19f0e4;})[_0x4f6d('0x3b')](respondWithFilteredResult(_0x2518e4,_0x32ecbf))['catch'](handleError(_0x2518e4,null));};exports[_0x4f6d('0x3d')]=function(_0xa217b9,_0x5c8bda){var _0x48eded={'raw':!![],'where':{'id':_0xa217b9[_0x4f6d('0x3e')]['id']}},_0x3d9fad={};_0x3d9fad['model']=_[_0x4f6d('0x2c')](db[_0x4f6d('0x39')][_0x4f6d('0x3f')]);_0x3d9fad['query']=_[_0x4f6d('0x2c')](_0xa217b9['query']);_0x3d9fad[_0x4f6d('0x2d')]=_[_0x4f6d('0x40')](_0x3d9fad[_0x4f6d('0x2e')],_0x3d9fad[_0x4f6d('0x2b')]);_0x48eded['attributes']=_[_0x4f6d('0x40')](_0x3d9fad[_0x4f6d('0x2e')],qs[_0x4f6d('0x2f')](_0xa217b9[_0x4f6d('0x2b')][_0x4f6d('0x2f')]));_0x48eded[_0x4f6d('0x30')]=_0x48eded[_0x4f6d('0x30')][_0x4f6d('0x31')]?_0x48eded[_0x4f6d('0x30')]:_0x3d9fad['model'];if(_0xa217b9['query']['includeAll']){_0x48eded[_0x4f6d('0x41')]=[{'all':!![]}];}_0x48eded=_[_0x4f6d('0x37')]({},_0x48eded,_0xa217b9[_0x4f6d('0x42')]);return db[_0x4f6d('0x39')]['find'](_0x48eded)[_0x4f6d('0x3b')](handleEntityNotFound(_0x5c8bda,null))[_0x4f6d('0x3b')](respondWithResult(_0x5c8bda,null))[_0x4f6d('0x43')](handleError(_0x5c8bda,null));};exports[_0x4f6d('0x44')]=function(_0x5314e4,_0x20fddc){return db[_0x4f6d('0x39')][_0x4f6d('0x44')](_0x5314e4['body'],{})['then'](respondWithResult(_0x20fddc,0xc9))[_0x4f6d('0x43')](handleError(_0x20fddc,null));};exports[_0x4f6d('0x24')]=function(_0xd6ba4e,_0x3fbf79){if(_0xd6ba4e[_0x4f6d('0x45')]['id']){delete _0xd6ba4e['body']['id'];}return db[_0x4f6d('0x39')][_0x4f6d('0x46')]({'where':{'id':_0xd6ba4e['params']['id']}})['then'](handleEntityNotFound(_0x3fbf79,null))['then'](saveUpdates(_0xd6ba4e[_0x4f6d('0x45')],null))[_0x4f6d('0x3b')](respondWithResult(_0x3fbf79,null))['catch'](handleError(_0x3fbf79,null));};exports[_0x4f6d('0x47')]=function(_0x319384,_0x595552){return db[_0x4f6d('0x39')][_0x4f6d('0x46')]({'where':{'id':_0x319384['params']['id']}})[_0x4f6d('0x3b')](handleEntityNotFound(_0x595552,null))[_0x4f6d('0x3b')](removeEntity(_0x595552,null))[_0x4f6d('0x43')](handleError(_0x595552,null));};exports[_0x4f6d('0x48')]=function(_0x4dfceb,_0x2f4720){return db[_0x4f6d('0x39')][_0x4f6d('0x48')]()[_0x4f6d('0x3b')](respondWithResult(_0x2f4720,null))['catch'](handleError(_0x2f4720,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 54b4557..af4cb71 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 _0xcf7f=['rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','util','../../config/logger','api','request-promise'];(function(_0x786ad4,_0x4ffe58){var _0x5cae2d=function(_0x4acd79){while(--_0x4acd79){_0x786ad4['push'](_0x786ad4['shift']());}};_0x5cae2d(++_0x4ffe58);}(_0xcf7f,0x13c));var _0xfcf7=function(_0x4c1697,_0x15cb88){_0x4c1697=_0x4c1697-0x0;var _0x80e10a=_0xcf7f[_0x4c1697];return _0x80e10a;};'use strict';var _=require('lodash');var util=require(_0xfcf7('0x0'));var logger=require(_0xfcf7('0x1'))(_0xfcf7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfcf7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcf7('0x4'));var config=require(_0xfcf7('0x5'));var attributes=require(_0xfcf7('0x6'));module[_0xfcf7('0x7')]=function(_0x302a4c,_0x4d0122){return _0x302a4c['define'](_0xfcf7('0x8'),attributes,{'tableName':_0xfcf7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x262e=['path','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','util','request-promise'];(function(_0x2ec5c3,_0x835a4f){var _0x367052=function(_0x81c406){while(--_0x81c406){_0x2ec5c3['push'](_0x2ec5c3['shift']());}};_0x367052(++_0x835a4f);}(_0x262e,0x19e));var _0xe262=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x262e[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xe262('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe262('0x1'));var fs=require('fs');var path=require(_0xe262('0x2'));var rimraf=require('rimraf');var config=require(_0xe262('0x3'));var attributes=require(_0xe262('0x4'));module[_0xe262('0x5')]=function(_0x2af798,_0x32336e){return _0x2af798['define'](_0xe262('0x6'),attributes,{'tableName':_0xe262('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 5b807ba..ec1ec16 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 _0xc2da=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareDetailsReport','create','body','options','stringify','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xc2da,0x124));var _0xac2d=function(_0x13a68a,_0x2daaaa){_0x13a68a=_0x13a68a-0x0;var _0x27f857=_0xc2da[_0x13a68a];return _0x27f857;};'use strict';var _=require(_0xac2d('0x0'));var util=require('util');var moment=require(_0xac2d('0x1'));var BPromise=require('bluebird');var rs=require(_0xac2d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac2d('0x3'))['db'];var utils=require(_0xac2d('0x4'));var logger=require(_0xac2d('0x5'))(_0xac2d('0x6'));var config=require(_0xac2d('0x7'));var jayson=require(_0xac2d('0x8'));var client=jayson[_0xac2d('0x9')][_0xac2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b0a36,_0x3ef58a,_0x41d5ae){return new BPromise(function(_0x515055,_0x5cbc87){return client[_0xac2d('0xb')](_0x2b0a36,_0x41d5ae)['then'](function(_0x4271fa){logger[_0xac2d('0xc')](_0xac2d('0xd'),_0x3ef58a,_0xac2d('0xe'));logger[_0xac2d('0xf')](_0xac2d('0x10'),_0x3ef58a,'request\x20sent',JSON['stringify'](_0x4271fa));if(_0x4271fa[_0xac2d('0x11')]){if(_0x4271fa[_0xac2d('0x11')][_0xac2d('0x12')]===0x1f4){logger[_0xac2d('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3ef58a,_0x4271fa[_0xac2d('0x11')][_0xac2d('0x13')]);return _0x5cbc87(_0x4271fa[_0xac2d('0x11')][_0xac2d('0x13')]);}logger[_0xac2d('0x11')](_0xac2d('0xd'),_0x3ef58a,_0x4271fa[_0xac2d('0x11')][_0xac2d('0x13')]);return _0x515055(_0x4271fa[_0xac2d('0x11')][_0xac2d('0x13')]);}else{logger[_0xac2d('0xc')](_0xac2d('0xd'),_0x3ef58a,_0xac2d('0xe'));_0x515055(_0x4271fa[_0xac2d('0x14')][_0xac2d('0x13')]);}})['catch'](function(_0x3170ae){logger[_0xac2d('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3ef58a,_0x3170ae);_0x5cbc87(_0x3170ae);});});}exports[_0xac2d('0x15')]=function(_0xed956b){var _0x1d8e9f=this;return new Promise(function(_0x4d34fa,_0x45c12b){return db['SquareDetailsReport'][_0xac2d('0x16')](_0xed956b[_0xac2d('0x17')],{'raw':_0xed956b['options']?_0xed956b[_0xac2d('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x510e85){logger['info'](_0xac2d('0x15'),_0xed956b);logger[_0xac2d('0xf')](_0xac2d('0x15'),_0xed956b,JSON[_0xac2d('0x19')](_0x510e85));_0x4d34fa(_0x510e85);})[_0xac2d('0x1a')](function(_0x391911){logger[_0xac2d('0x11')](_0xac2d('0x15'),_0x391911[_0xac2d('0x13')],_0xed956b);_0x45c12b(_0x1d8e9f[_0xac2d('0x11')](0x1f4,_0x391911[_0xac2d('0x13')]));});});}; \ No newline at end of file +var _0xd5fc=['SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateSquareDetailsReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xd5fc,0xae));var _0xcd5f=function(_0x23eaf7,_0x50e9cb){_0x23eaf7=_0x23eaf7-0x0;var _0x46dd9c=_0xd5fc[_0x23eaf7];return _0x46dd9c;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateSquareDetailsReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['SquareDetailsReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateSquareDetailsReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b07bfb9..5fd8192 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 _0xdd4d=['/process/:pid/kill','exports','express','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x2195da,_0x5c9934){var _0x4db83c=function(_0x15af7c){while(--_0x15af7c){_0x2195da['push'](_0x2195da['shift']());}};_0x4db83c(++_0x5c9934);}(_0xdd4d,0x1b4));var _0xddd4=function(_0x4cbff5,_0x204225){_0x4cbff5=_0x4cbff5-0x0;var _0x44758f=_0xdd4d[_0x4cbff5];return _0x44758f;};'use strict';var express=require(_0xddd4('0x0'));var router=express['Router']();var auth=require(_0xddd4('0x1'));var controller=require(_0xddd4('0x2'));router[_0xddd4('0x3')]('/',auth[_0xddd4('0x4')](),controller['index']);router[_0xddd4('0x3')](_0xddd4('0x5'),auth[_0xddd4('0x4')](),controller['killProcess']);module[_0xddd4('0x6')]=router; \ No newline at end of file +var _0xe7d7=['isAuthenticated','/process/:pid/kill','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x11beab,_0x2100c4){var _0x182daf=function(_0x48ca51){while(--_0x48ca51){_0x11beab['push'](_0x11beab['shift']());}};_0x182daf(++_0x2100c4);}(_0xe7d7,0x17b));var _0x7e7d=function(_0x4d1597,_0x2987ed){_0x4d1597=_0x4d1597-0x0;var _0x3fc5ba=_0xe7d7[_0x4d1597];return _0x3fc5ba;};'use strict';var express=require(_0x7e7d('0x0'));var router=express[_0x7e7d('0x1')]();var auth=require(_0x7e7d('0x2'));var controller=require(_0x7e7d('0x3'));router[_0x7e7d('0x4')]('/',auth[_0x7e7d('0x5')](),controller['index']);router['get'](_0x7e7d('0x6'),auth[_0x7e7d('0x5')](),controller['killProcess']);module[_0x7e7d('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 7f21754..3f214b7 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 _0xb169=['name','status','send','index','getAllData','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xb169,0x13f));var _0x9b16=function(_0xf273f9,_0x486198){_0xf273f9=_0xf273f9-0x0;var _0xb4abcc=_0xb169[_0xf273f9];return _0xb4abcc;};'use strict';var info=require(_0x9b16('0x0'));var exec=require('child_process')[_0x9b16('0x1')];var logger=require(_0x9b16('0x2'))('api');var util=require('util');var BPromise=require(_0x9b16('0x3'));var _=require(_0x9b16('0x4'));function handleError(_0x47ce6b,_0x1aef8f,_0x96c8fb){_0x1aef8f=_0x1aef8f||0x1f4;return function(_0x3b756c){logger['error'](_0x9b16('0x5'),_0x96c8fb,_0x1aef8f,util['inspect'](_0x3b756c,{'showHidden':![],'depth':null}));delete _0x3b756c[_0x9b16('0x6')];_0x47ce6b[_0x9b16('0x7')](_0x1aef8f)[_0x9b16('0x8')](_0x3b756c);};}exports[_0x9b16('0x9')]=function(_0x36b98f,_0x3f82c6){return info[_0x9b16('0xa')]()[_0x9b16('0xb')](function(_0xca0a4){return _0x3f82c6[_0x9b16('0x7')](0xc8)['json'](_0xca0a4);})[_0x9b16('0xc')](function(_0x5d960a){return _0x3f82c6[_0x9b16('0x7')](0x1f4)[_0x9b16('0xd')](_0x5d960a);});};exports[_0x9b16('0xe')]=function(_0x22d414,_0x45245b){var _0x49fda3=[_0x9b16('0xf')];return new BPromise(function(_0x3e6eb5,_0x3e219c){return exec(util[_0x9b16('0x10')](_0x9b16('0x11'),_0x22d414[_0x9b16('0x12')][_0x9b16('0x13')]),function(_0x165efb,_0x188378,_0xfc8cdf){if(_0x165efb){return _0x3e219c(_0x165efb);}return _0x3e6eb5(_0x188378);});})[_0x9b16('0xb')](function(_0x396a58){var _0x251d04=![];var _0x3ee35c=_0x396a58['split'](/\n/);for(var _0x1836ae=0x0,_0xb9ff26=_0x49fda3[_0x9b16('0x14')];_0x1836ae<_0xb9ff26,_0x251d04===![];_0x1836ae+=0x1){if(_0x396a58[_0x9b16('0x15')](_0x49fda3[_0x1836ae])>=0x0){_0x251d04=!![];}}if(!_0x251d04){throw new Error(util[_0x9b16('0x10')](_0x9b16('0x16'),_0x22d414[_0x9b16('0x12')]['pid']));}process['kill'](_0x22d414[_0x9b16('0x12')][_0x9b16('0x13')],_0x9b16('0x17'));return _0x45245b[_0x9b16('0x7')](0xc8)[_0x9b16('0xd')]({'message':util[_0x9b16('0x10')](_0x9b16('0x18'),_0x22d414[_0x9b16('0x12')]['pid'])});})[_0x9b16('0xc')](handleError(_0x45245b,null,_0x9b16('0xe')));}; \ No newline at end of file +var _0xfaba=['status','send','index','getAllData','json','catch','killProcess','format','params','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x458eef,_0x551783){var _0x2fb384=function(_0x28465e){while(--_0x28465e){_0x458eef['push'](_0x458eef['shift']());}};_0x2fb384(++_0x551783);}(_0xfaba,0x102));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0xafab('0x0'));var exec=require(_0xafab('0x1'))[_0xafab('0x2')];var logger=require(_0xafab('0x3'))(_0xafab('0x4'));var util=require(_0xafab('0x5'));var BPromise=require(_0xafab('0x6'));var _=require(_0xafab('0x7'));function handleError(_0x5d60cc,_0x5e4b45,_0x2f847){_0x5e4b45=_0x5e4b45||0x1f4;return function(_0x265084){logger[_0xafab('0x8')](_0xafab('0x9'),_0x2f847,_0x5e4b45,util[_0xafab('0xa')](_0x265084,{'showHidden':![],'depth':null}));delete _0x265084[_0xafab('0xb')];_0x5d60cc[_0xafab('0xc')](_0x5e4b45)[_0xafab('0xd')](_0x265084);};}exports[_0xafab('0xe')]=function(_0x26f348,_0x3622a9){return info[_0xafab('0xf')]()['then'](function(_0x476983){return _0x3622a9['status'](0xc8)[_0xafab('0x10')](_0x476983);})[_0xafab('0x11')](function(_0x1d219a){return _0x3622a9['status'](0x1f4)[_0xafab('0x10')](_0x1d219a);});};exports[_0xafab('0x12')]=function(_0x5103e0,_0x48989d){var _0x3bf6d8=['components/import/cm'];return new BPromise(function(_0x2db380,_0xb86170){return exec(util[_0xafab('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5103e0[_0xafab('0x14')][_0xafab('0x15')]),function(_0x434b7c,_0x551dbd,_0x588bce){if(_0x434b7c){return _0xb86170(_0x434b7c);}return _0x2db380(_0x551dbd);});})[_0xafab('0x16')](function(_0x409e59){var _0x14efbf=![];var _0x1f3f42=_0x409e59[_0xafab('0x17')](/\n/);for(var _0x1d5034=0x0,_0xdda691=_0x3bf6d8[_0xafab('0x18')];_0x1d5034<_0xdda691,_0x14efbf===![];_0x1d5034+=0x1){if(_0x409e59[_0xafab('0x19')](_0x3bf6d8[_0x1d5034])>=0x0){_0x14efbf=!![];}}if(!_0x14efbf){throw new Error(util[_0xafab('0x13')](_0xafab('0x1a'),_0x5103e0[_0xafab('0x14')][_0xafab('0x15')]));}process[_0xafab('0x1b')](_0x5103e0[_0xafab('0x14')][_0xafab('0x15')],_0xafab('0x1c'));return _0x48989d[_0xafab('0xc')](0xc8)[_0xafab('0x10')]({'message':util['format'](_0xafab('0x1d'),_0x5103e0[_0xafab('0x14')][_0xafab('0x15')])});})[_0xafab('0x11')](handleError(_0x48989d,null,_0xafab('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 37c371a..3e54b40 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 _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x17ba,0xab));var _0xa17b=function(_0x2040fe,_0x50efd5){_0x2040fe=_0x2040fe-0x0;var _0x247998=_0x17ba[_0x2040fe];return _0x247998;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file +var _0x22fb=['./tag.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xc70631,_0x2a3f9b){var _0x54be7f=function(_0x22485c){while(--_0x22485c){_0xc70631['push'](_0xc70631['shift']());}};_0x54be7f(++_0x2a3f9b);}(_0x22fb,0x192));var _0xb22f=function(_0x344143,_0x391cba){_0x344143=_0x344143-0x0;var _0x424d1a=_0x22fb[_0x344143];return _0x424d1a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f301a3f..4b46a5d 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 _0xd844=['STRING','sequelize','exports','name'];(function(_0x2b38ec,_0x587dd6){var _0x1577bc=function(_0x58d6c5){while(--_0x58d6c5){_0x2b38ec['push'](_0x2b38ec['shift']());}};_0x1577bc(++_0x587dd6);}(_0xd844,0x6d));var _0x4d84=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd844[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x4d84('0x0'));module[_0x4d84('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4d84('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4d84('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd1f1=['sequelize','exports','STRING','name'];(function(_0x599ad4,_0x4b2612){var _0x3a634c=function(_0x44b62d){while(--_0x44b62d){_0x599ad4['push'](_0x599ad4['shift']());}};_0x3a634c(++_0x4b2612);}(_0xd1f1,0x84));var _0x1d1f=function(_0x246a98,_0xdf59a8){_0x246a98=_0x246a98-0x0;var _0x3b8b79=_0xd1f1[_0x246a98];return _0x3b8b79;};'use strict';var Sequelize=require(_0x1d1f('0x0'));module[_0x1d1f('0x1')]={'name':{'type':Sequelize[_0x1d1f('0x2')],'unique':_0x1d1f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x1d1f('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x1d1f('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ebe3b29..5a50255 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 _0x41f6=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','Tags','UserProfileResource','destroy','error','name','send','map','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','Tag','include','rows','catch','show','params','length','includeAll','find'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0x41f6,0x1e9));var _0x641f=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x41f6[_0x47b15f];return _0x55bf25;};'use strict';var emlformat=require(_0x641f('0x0'));var rimraf=require(_0x641f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x641f('0x2'));var rp=require(_0x641f('0x3'));var moment=require(_0x641f('0x4'));var BPromise=require(_0x641f('0x5'));var Mustache=require('mustache');var util=require(_0x641f('0x6'));var path=require(_0x641f('0x7'));var sox=require('sox');var csv=require(_0x641f('0x8'));var ejs=require(_0x641f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x641f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x641f('0xb'));var deskjs=require(_0x641f('0xc'));var toCsv=require(_0x641f('0x8'));var querystring=require(_0x641f('0xd'));var Papa=require(_0x641f('0xe'));var Redis=require(_0x641f('0xf'));var authService=require(_0x641f('0x10'));var qs=require(_0x641f('0x11'));var as=require(_0x641f('0x12'));var hardwareService=require(_0x641f('0x13'));var logger=require('../../config/logger')(_0x641f('0x14'));var utils=require('../../config/utils');var config=require(_0x641f('0x15'));var licenseUtil=require(_0x641f('0x16'));var db=require(_0x641f('0x17'))['db'];function respondWithStatusCode(_0x58663a,_0x1eaae8){_0x1eaae8=_0x1eaae8||0xcc;return function(_0x3202f4){if(_0x3202f4){return _0x58663a[_0x641f('0x18')](_0x1eaae8);}return _0x58663a[_0x641f('0x19')](_0x1eaae8)[_0x641f('0x1a')]();};}function respondWithResult(_0x10ad52,_0x571a59){_0x571a59=_0x571a59||0xc8;return function(_0x18f9fa){if(_0x18f9fa){return _0x10ad52['status'](_0x571a59)[_0x641f('0x1b')](_0x18f9fa);}};}function respondWithFilteredResult(_0x8114,_0x543ee9){return function(_0x24a4ea){if(_0x24a4ea){var _0x52ac21=typeof _0x543ee9[_0x641f('0x1c')]===_0x641f('0x1d')&&typeof _0x543ee9[_0x641f('0x1e')]==='undefined';var _0x319d1a=_0x24a4ea[_0x641f('0x1f')];var _0x1e69c0=_0x52ac21?0x0:_0x543ee9[_0x641f('0x1c')];var _0x808334=_0x52ac21?_0x24a4ea[_0x641f('0x1f')]:_0x543ee9['offset']+_0x543ee9[_0x641f('0x1e')];var _0x244b58;if(_0x808334>=_0x319d1a){_0x808334=_0x319d1a;_0x244b58=0xc8;}else{_0x244b58=0xce;}_0x8114[_0x641f('0x19')](_0x244b58);return _0x8114[_0x641f('0x20')](_0x641f('0x21'),_0x1e69c0+'-'+_0x808334+'/'+_0x319d1a)['json'](_0x24a4ea);}return null;};}function patchUpdates(_0x13fe00){return function(_0x3af6bf){try{jsonpatch[_0x641f('0x22')](_0x3af6bf,_0x13fe00,!![]);}catch(_0x61578b){return BPromise[_0x641f('0x23')](_0x61578b);}return _0x3af6bf['save']();};}function saveUpdates(_0x45af5b,_0xc5df09){return function(_0x274337){if(_0x274337){return _0x274337[_0x641f('0x24')](_0x45af5b)['then'](function(_0x37c91c){return _0x37c91c;});}return null;};}function removeEntity(_0x494b52,_0x2403e1){return function(_0x2e9609){if(_0x2e9609){return _0x2e9609['destroy']()[_0x641f('0x25')](function(){var _0x2596dd=_0x2e9609['get']({'plain':!![]});var _0x1e15d8=_0x641f('0x26');return db[_0x641f('0x27')][_0x641f('0x28')]({'where':{'type':_0x1e15d8,'resourceId':_0x2596dd['id']}})[_0x641f('0x25')](function(){return _0x2e9609;});})[_0x641f('0x25')](function(){_0x494b52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e5ffb,_0x3da248){return function(_0xc9d3f){if(!_0xc9d3f){_0x2e5ffb['sendStatus'](0x194);}return _0xc9d3f;};}function handleError(_0x3997fa,_0x45b6c8){_0x45b6c8=_0x45b6c8||0x1f4;return function(_0x219ff3){logger[_0x641f('0x29')](_0x219ff3['stack']);if(_0x219ff3[_0x641f('0x2a')]){delete _0x219ff3[_0x641f('0x2a')];}_0x3997fa[_0x641f('0x19')](_0x45b6c8)[_0x641f('0x2b')](_0x219ff3);};}exports['index']=function(_0x9d2835,_0x3d87ed){var _0x517579={},_0x5f5b33={},_0x303ca8={'count':0x0,'rows':[]};var _0x2e1140=_[_0x641f('0x2c')](db['Tag'][_0x641f('0x2d')],function(_0x94b753){return{'name':_0x94b753[_0x641f('0x2e')],'type':_0x94b753['type']['key']};});_0x5f5b33[_0x641f('0x2f')]=_[_0x641f('0x2c')](_0x2e1140,_0x641f('0x2a'));_0x5f5b33['query']=_[_0x641f('0x30')](_0x9d2835[_0x641f('0x31')]);_0x5f5b33[_0x641f('0x32')]=_[_0x641f('0x33')](_0x5f5b33[_0x641f('0x2f')],_0x5f5b33['query']);_0x517579[_0x641f('0x34')]=_[_0x641f('0x33')](_0x5f5b33['model'],qs['fields'](_0x9d2835['query'][_0x641f('0x35')]));_0x517579[_0x641f('0x34')]=_0x517579[_0x641f('0x34')]['length']?_0x517579['attributes']:_0x5f5b33[_0x641f('0x2f')];if(!_0x9d2835[_0x641f('0x31')][_0x641f('0x36')](_0x641f('0x37'))){_0x517579[_0x641f('0x1e')]=qs['limit'](_0x9d2835['query'][_0x641f('0x1e')]);_0x517579[_0x641f('0x1c')]=qs[_0x641f('0x1c')](_0x9d2835[_0x641f('0x31')][_0x641f('0x1c')]);}_0x517579['order']=qs['sort'](_0x9d2835['query']['sort']);_0x517579[_0x641f('0x38')]=qs['filters'](_[_0x641f('0x39')](_0x9d2835[_0x641f('0x31')],_0x5f5b33[_0x641f('0x32')]),_0x2e1140);if(_0x9d2835[_0x641f('0x31')][_0x641f('0x3a')]){_0x517579[_0x641f('0x38')]=_[_0x641f('0x3b')](_0x517579[_0x641f('0x38')],{'$or':_[_0x641f('0x2c')](_0x2e1140,function(_0x4d9c7c){if(_0x4d9c7c['type']!==_0x641f('0x3c')){var _0x281e94={};_0x281e94[_0x4d9c7c[_0x641f('0x2a')]]={'$like':'%'+_0x9d2835[_0x641f('0x31')][_0x641f('0x3a')]+'%'};return _0x281e94;}})});}_0x517579=_[_0x641f('0x3b')]({},_0x517579,_0x9d2835[_0x641f('0x3d')]);var _0x2a41f7={'where':_0x517579[_0x641f('0x38')]};return db[_0x641f('0x3e')][_0x641f('0x1f')](_0x2a41f7)[_0x641f('0x25')](function(_0x5d7145){_0x303ca8['count']=_0x5d7145;if(_0x9d2835[_0x641f('0x31')]['includeAll']){_0x517579[_0x641f('0x3f')]=[{'all':!![]}];}return db[_0x641f('0x3e')]['findAll'](_0x517579);})['then'](function(_0x4410ce){_0x303ca8[_0x641f('0x40')]=_0x4410ce;return _0x303ca8;})[_0x641f('0x25')](respondWithFilteredResult(_0x3d87ed,_0x517579))[_0x641f('0x41')](handleError(_0x3d87ed,null));};exports[_0x641f('0x42')]=function(_0x5926a4,_0x1439f9){var _0x2fc3da={'raw':!![],'where':{'id':_0x5926a4[_0x641f('0x43')]['id']}},_0x7339ad={};_0x7339ad[_0x641f('0x2f')]=_['keys'](db['Tag']['rawAttributes']);_0x7339ad[_0x641f('0x31')]=_['keys'](_0x5926a4[_0x641f('0x31')]);_0x7339ad[_0x641f('0x32')]=_['intersection'](_0x7339ad[_0x641f('0x2f')],_0x7339ad['query']);_0x2fc3da[_0x641f('0x34')]=_['intersection'](_0x7339ad[_0x641f('0x2f')],qs['fields'](_0x5926a4[_0x641f('0x31')][_0x641f('0x35')]));_0x2fc3da['attributes']=_0x2fc3da['attributes'][_0x641f('0x44')]?_0x2fc3da['attributes']:_0x7339ad[_0x641f('0x2f')];if(_0x5926a4[_0x641f('0x31')][_0x641f('0x45')]){_0x2fc3da[_0x641f('0x3f')]=[{'all':!![]}];}_0x2fc3da=_[_0x641f('0x3b')]({},_0x2fc3da,_0x5926a4[_0x641f('0x3d')]);return db[_0x641f('0x3e')][_0x641f('0x46')](_0x2fc3da)[_0x641f('0x25')](handleEntityNotFound(_0x1439f9,null))[_0x641f('0x25')](respondWithResult(_0x1439f9,null))[_0x641f('0x41')](handleError(_0x1439f9,null));};exports[_0x641f('0x47')]=function(_0x4ea4d8,_0x375f32){return db[_0x641f('0x3e')][_0x641f('0x47')](_0x4ea4d8[_0x641f('0x48')],{})[_0x641f('0x25')](function(_0x91a601){var _0x265feb=_0x4ea4d8[_0x641f('0x49')][_0x641f('0x4a')]({'plain':!![]});if(!_0x265feb)throw new Error(_0x641f('0x4b'));if(_0x265feb[_0x641f('0x4c')]===_0x641f('0x49')){var _0x580ee7=_0x91a601[_0x641f('0x4a')]({'plain':!![]});var _0xeea2ef=_0x641f('0x26');return db[_0x641f('0x4d')][_0x641f('0x46')]({'where':{'name':_0xeea2ef,'userProfileId':_0x265feb['userProfileId']},'raw':!![]})['then'](function(_0x1f7bd6){if(_0x1f7bd6&&_0x1f7bd6[_0x641f('0x4e')]===0x0){return db[_0x641f('0x27')][_0x641f('0x47')]({'name':_0x580ee7[_0x641f('0x2a')],'resourceId':_0x580ee7['id'],'type':_0x1f7bd6[_0x641f('0x2a')],'sectionId':_0x1f7bd6['id']},{})[_0x641f('0x25')](function(){return _0x91a601;});}else{return _0x91a601;}})['catch'](function(_0x3d5376){logger[_0x641f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d5376);throw _0x3d5376;});}return _0x91a601;})['then'](respondWithResult(_0x375f32,0xc9))[_0x641f('0x41')](handleError(_0x375f32,null));};exports[_0x641f('0x24')]=function(_0x1c6da1,_0x231244){if(_0x1c6da1[_0x641f('0x48')]['id']){delete _0x1c6da1[_0x641f('0x48')]['id'];}return db[_0x641f('0x3e')][_0x641f('0x46')]({'where':{'id':_0x1c6da1[_0x641f('0x43')]['id']}})[_0x641f('0x25')](handleEntityNotFound(_0x231244,null))['then'](saveUpdates(_0x1c6da1[_0x641f('0x48')],null))['then'](respondWithResult(_0x231244,null))[_0x641f('0x41')](handleError(_0x231244,null));};exports[_0x641f('0x28')]=function(_0x1ab200,_0x27c844){return db[_0x641f('0x3e')][_0x641f('0x46')]({'where':{'id':_0x1ab200['params']['id']}})['then'](handleEntityNotFound(_0x27c844,null))[_0x641f('0x25')](removeEntity(_0x27c844,null))['catch'](handleError(_0x27c844,null));};exports[_0x641f('0x4f')]=function(_0x128232,_0x45776b){return db[_0x641f('0x3e')][_0x641f('0x4f')]()[_0x641f('0x25')](respondWithResult(_0x45776b,null))[_0x641f('0x41')](handleError(_0x45776b,null));}; \ No newline at end of file +var _0xd056=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x2abc78,_0x4f6b41){var _0x10e462=function(_0x136510){while(--_0x136510){_0x2abc78['push'](_0x2abc78['shift']());}};_0x10e462(++_0x4f6b41);}(_0xd056,0x13f));var _0x6d05=function(_0x588b55,_0x80d4c){_0x588b55=_0x588b55-0x0;var _0x54c685=_0xd056[_0x588b55];return _0x54c685;};'use strict';var emlformat=require(_0x6d05('0x0'));var rimraf=require(_0x6d05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d05('0x2'));var rp=require(_0x6d05('0x3'));var moment=require(_0x6d05('0x4'));var BPromise=require(_0x6d05('0x5'));var Mustache=require(_0x6d05('0x6'));var util=require(_0x6d05('0x7'));var path=require(_0x6d05('0x8'));var sox=require(_0x6d05('0x9'));var csv=require('to-csv');var ejs=require(_0x6d05('0xa'));var fs=require('fs');var fs_extra=require(_0x6d05('0xb'));var _=require(_0x6d05('0xc'));var squel=require('squel');var crypto=require(_0x6d05('0xd'));var jsforce=require(_0x6d05('0xe'));var deskjs=require(_0x6d05('0xf'));var toCsv=require(_0x6d05('0x10'));var querystring=require('querystring');var Papa=require(_0x6d05('0x11'));var Redis=require(_0x6d05('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6d05('0x13'));var as=require(_0x6d05('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6d05('0x15'));var config=require(_0x6d05('0x16'));var licenseUtil=require(_0x6d05('0x17'));var db=require(_0x6d05('0x18'))['db'];function respondWithStatusCode(_0x24f317,_0x17119c){_0x17119c=_0x17119c||0xcc;return function(_0x1c92c7){if(_0x1c92c7){return _0x24f317[_0x6d05('0x19')](_0x17119c);}return _0x24f317['status'](_0x17119c)[_0x6d05('0x1a')]();};}function respondWithResult(_0x5729bd,_0x35c5f6){_0x35c5f6=_0x35c5f6||0xc8;return function(_0x37c7e5){if(_0x37c7e5){return _0x5729bd[_0x6d05('0x1b')](_0x35c5f6)[_0x6d05('0x1c')](_0x37c7e5);}};}function respondWithFilteredResult(_0x2c92b4,_0xc2efd1){return function(_0x320634){if(_0x320634){var _0x4ee183=typeof _0xc2efd1[_0x6d05('0x1d')]===_0x6d05('0x1e')&&typeof _0xc2efd1[_0x6d05('0x1f')]===_0x6d05('0x1e');var _0x219db5=_0x320634[_0x6d05('0x20')];var _0x3e71c7=_0x4ee183?0x0:_0xc2efd1[_0x6d05('0x1d')];var _0x3eadfb=_0x4ee183?_0x320634[_0x6d05('0x20')]:_0xc2efd1['offset']+_0xc2efd1[_0x6d05('0x1f')];var _0x164b93;if(_0x3eadfb>=_0x219db5){_0x3eadfb=_0x219db5;_0x164b93=0xc8;}else{_0x164b93=0xce;}_0x2c92b4[_0x6d05('0x1b')](_0x164b93);return _0x2c92b4[_0x6d05('0x21')](_0x6d05('0x22'),_0x3e71c7+'-'+_0x3eadfb+'/'+_0x219db5)[_0x6d05('0x1c')](_0x320634);}return null;};}function patchUpdates(_0x18f3e9){return function(_0x2b6f4b){try{jsonpatch[_0x6d05('0x23')](_0x2b6f4b,_0x18f3e9,!![]);}catch(_0x5327c6){return BPromise[_0x6d05('0x24')](_0x5327c6);}return _0x2b6f4b[_0x6d05('0x25')]();};}function saveUpdates(_0xe1d6fc,_0x219092){return function(_0x5a87b7){if(_0x5a87b7){return _0x5a87b7[_0x6d05('0x26')](_0xe1d6fc)['then'](function(_0x3f2829){return _0x3f2829;});}return null;};}function removeEntity(_0x55fc6d,_0x17944d){return function(_0x471d3d){if(_0x471d3d){return _0x471d3d[_0x6d05('0x27')]()[_0x6d05('0x28')](function(){var _0x34bb77=_0x471d3d['get']({'plain':!![]});var _0x57a8d1='Tags';return db[_0x6d05('0x29')]['destroy']({'where':{'type':_0x57a8d1,'resourceId':_0x34bb77['id']}})[_0x6d05('0x28')](function(){return _0x471d3d;});})[_0x6d05('0x28')](function(){_0x55fc6d['status'](0xcc)[_0x6d05('0x1a')]();});}};}function handleEntityNotFound(_0x59df33,_0xe7e1f9){return function(_0x546c8e){if(!_0x546c8e){_0x59df33[_0x6d05('0x19')](0x194);}return _0x546c8e;};}function handleError(_0x578287,_0x4e1dcc){_0x4e1dcc=_0x4e1dcc||0x1f4;return function(_0x94dad5){logger[_0x6d05('0x2a')](_0x94dad5[_0x6d05('0x2b')]);if(_0x94dad5[_0x6d05('0x2c')]){delete _0x94dad5[_0x6d05('0x2c')];}_0x578287['status'](_0x4e1dcc)[_0x6d05('0x2d')](_0x94dad5);};}exports['index']=function(_0x514a5c,_0x41e9fc){var _0x499006={},_0x56a0c={},_0xdb074f={'count':0x0,'rows':[]};var _0x39870b=_[_0x6d05('0x2e')](db[_0x6d05('0x2f')][_0x6d05('0x30')],function(_0x5198a7){return{'name':_0x5198a7[_0x6d05('0x31')],'type':_0x5198a7[_0x6d05('0x32')][_0x6d05('0x33')]};});_0x56a0c['model']=_[_0x6d05('0x2e')](_0x39870b,_0x6d05('0x2c'));_0x56a0c['query']=_[_0x6d05('0x34')](_0x514a5c[_0x6d05('0x35')]);_0x56a0c[_0x6d05('0x36')]=_[_0x6d05('0x37')](_0x56a0c[_0x6d05('0x38')],_0x56a0c[_0x6d05('0x35')]);_0x499006[_0x6d05('0x39')]=_[_0x6d05('0x37')](_0x56a0c[_0x6d05('0x38')],qs[_0x6d05('0x3a')](_0x514a5c[_0x6d05('0x35')][_0x6d05('0x3a')]));_0x499006['attributes']=_0x499006[_0x6d05('0x39')][_0x6d05('0x3b')]?_0x499006[_0x6d05('0x39')]:_0x56a0c['model'];if(!_0x514a5c['query']['hasOwnProperty'](_0x6d05('0x3c'))){_0x499006[_0x6d05('0x1f')]=qs[_0x6d05('0x1f')](_0x514a5c[_0x6d05('0x35')][_0x6d05('0x1f')]);_0x499006[_0x6d05('0x1d')]=qs['offset'](_0x514a5c[_0x6d05('0x35')]['offset']);}_0x499006['order']=qs['sort'](_0x514a5c[_0x6d05('0x35')][_0x6d05('0x3d')]);_0x499006[_0x6d05('0x3e')]=qs[_0x6d05('0x36')](_[_0x6d05('0x3f')](_0x514a5c['query'],_0x56a0c['filters']),_0x39870b);if(_0x514a5c['query'][_0x6d05('0x40')]){_0x499006[_0x6d05('0x3e')]=_[_0x6d05('0x41')](_0x499006[_0x6d05('0x3e')],{'$or':_[_0x6d05('0x2e')](_0x39870b,function(_0xf09d0e){if(_0xf09d0e[_0x6d05('0x32')]!==_0x6d05('0x42')){var _0x455cea={};_0x455cea[_0xf09d0e[_0x6d05('0x2c')]]={'$like':'%'+_0x514a5c['query'][_0x6d05('0x40')]+'%'};return _0x455cea;}})});}_0x499006=_[_0x6d05('0x41')]({},_0x499006,_0x514a5c['options']);var _0x5b7fb9={'where':_0x499006[_0x6d05('0x3e')]};return db[_0x6d05('0x2f')][_0x6d05('0x20')](_0x5b7fb9)[_0x6d05('0x28')](function(_0x483edd){_0xdb074f['count']=_0x483edd;if(_0x514a5c['query'][_0x6d05('0x43')]){_0x499006['include']=[{'all':!![]}];}return db[_0x6d05('0x2f')][_0x6d05('0x44')](_0x499006);})['then'](function(_0x4e19bf){_0xdb074f['rows']=_0x4e19bf;return _0xdb074f;})[_0x6d05('0x28')](respondWithFilteredResult(_0x41e9fc,_0x499006))[_0x6d05('0x45')](handleError(_0x41e9fc,null));};exports[_0x6d05('0x46')]=function(_0x527daa,_0x3613a5){var _0x16edb3={'raw':!![],'where':{'id':_0x527daa[_0x6d05('0x47')]['id']}},_0x4c825f={};_0x4c825f[_0x6d05('0x38')]=_[_0x6d05('0x34')](db['Tag']['rawAttributes']);_0x4c825f['query']=_[_0x6d05('0x34')](_0x527daa['query']);_0x4c825f[_0x6d05('0x36')]=_[_0x6d05('0x37')](_0x4c825f[_0x6d05('0x38')],_0x4c825f[_0x6d05('0x35')]);_0x16edb3['attributes']=_['intersection'](_0x4c825f[_0x6d05('0x38')],qs[_0x6d05('0x3a')](_0x527daa[_0x6d05('0x35')][_0x6d05('0x3a')]));_0x16edb3[_0x6d05('0x39')]=_0x16edb3[_0x6d05('0x39')][_0x6d05('0x3b')]?_0x16edb3['attributes']:_0x4c825f['model'];if(_0x527daa[_0x6d05('0x35')][_0x6d05('0x43')]){_0x16edb3[_0x6d05('0x48')]=[{'all':!![]}];}_0x16edb3=_[_0x6d05('0x41')]({},_0x16edb3,_0x527daa[_0x6d05('0x49')]);return db[_0x6d05('0x2f')][_0x6d05('0x4a')](_0x16edb3)['then'](handleEntityNotFound(_0x3613a5,null))['then'](respondWithResult(_0x3613a5,null))['catch'](handleError(_0x3613a5,null));};exports[_0x6d05('0x4b')]=function(_0x11db73,_0xc1f2cd){return db[_0x6d05('0x2f')][_0x6d05('0x4b')](_0x11db73[_0x6d05('0x4c')],{})['then'](function(_0x4443d8){var _0x4a28a1=_0x11db73[_0x6d05('0x4d')]['get']({'plain':!![]});if(!_0x4a28a1)throw new Error(_0x6d05('0x4e'));if(_0x4a28a1['role']===_0x6d05('0x4d')){var _0x3eeff2=_0x4443d8['get']({'plain':!![]});var _0x1ac130=_0x6d05('0x4f');return db[_0x6d05('0x50')][_0x6d05('0x4a')]({'where':{'name':_0x1ac130,'userProfileId':_0x4a28a1['userProfileId']},'raw':!![]})[_0x6d05('0x28')](function(_0x28db8c){if(_0x28db8c&&_0x28db8c[_0x6d05('0x51')]===0x0){return db[_0x6d05('0x29')]['create']({'name':_0x3eeff2['name'],'resourceId':_0x3eeff2['id'],'type':_0x28db8c[_0x6d05('0x2c')],'sectionId':_0x28db8c['id']},{})[_0x6d05('0x28')](function(){return _0x4443d8;});}else{return _0x4443d8;}})[_0x6d05('0x45')](function(_0x3640ab){logger['error'](_0x6d05('0x52'),_0x3640ab);throw _0x3640ab;});}return _0x4443d8;})[_0x6d05('0x28')](respondWithResult(_0xc1f2cd,0xc9))[_0x6d05('0x45')](handleError(_0xc1f2cd,null));};exports[_0x6d05('0x26')]=function(_0x846e68,_0x164697){if(_0x846e68['body']['id']){delete _0x846e68[_0x6d05('0x4c')]['id'];}return db[_0x6d05('0x2f')][_0x6d05('0x4a')]({'where':{'id':_0x846e68[_0x6d05('0x47')]['id']}})[_0x6d05('0x28')](handleEntityNotFound(_0x164697,null))[_0x6d05('0x28')](saveUpdates(_0x846e68['body'],null))['then'](respondWithResult(_0x164697,null))['catch'](handleError(_0x164697,null));};exports['destroy']=function(_0x98ab52,_0x4ec2ea){return db[_0x6d05('0x2f')]['find']({'where':{'id':_0x98ab52[_0x6d05('0x47')]['id']}})[_0x6d05('0x28')](handleEntityNotFound(_0x4ec2ea,null))['then'](removeEntity(_0x4ec2ea,null))[_0x6d05('0x45')](handleError(_0x4ec2ea,null));};exports[_0x6d05('0x53')]=function(_0x5391c6,_0x8b2054){return db[_0x6d05('0x2f')]['describe']()[_0x6d05('0x28')](respondWithResult(_0x8b2054,null))['catch'](handleError(_0x8b2054,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 086f51e..e4773cb 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 _0xabbe=['../../config/environment','./tag.attributes','Tag','tools_tags','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0xabbe,0x70));var _0xeabb=function(_0x3ca3fc,_0x307e84){_0x3ca3fc=_0x3ca3fc-0x0;var _0x41c26e=_0xabbe[_0x3ca3fc];return _0x41c26e;};'use strict';var _=require(_0xeabb('0x0'));var util=require('util');var logger=require(_0xeabb('0x1'))('api');var moment=require(_0xeabb('0x2'));var BPromise=require(_0xeabb('0x3'));var rp=require(_0xeabb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeabb('0x5'));var attributes=require(_0xeabb('0x6'));module['exports']=function(_0xfb506,_0x3cb3a4){return _0xfb506['define'](_0xeabb('0x7'),attributes,{'tableName':_0xeabb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf350=['rimraf','exports','define','Tag','tools_tags','lodash','util','api','moment','bluebird','request-promise'];(function(_0x24fd53,_0x281a15){var _0x5dc7ed=function(_0x4f9e15){while(--_0x4f9e15){_0x24fd53['push'](_0x24fd53['shift']());}};_0x5dc7ed(++_0x281a15);}(_0xf350,0x1e9));var _0x0f35=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf350[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0f35('0x0'));var util=require(_0x0f35('0x1'));var logger=require('../../config/logger')(_0x0f35('0x2'));var moment=require(_0x0f35('0x3'));var BPromise=require(_0x0f35('0x4'));var rp=require(_0x0f35('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f35('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x0f35('0x7')]=function(_0x51ed13,_0x3753e7){return _0x51ed13[_0x0f35('0x8')](_0x0f35('0x9'),attributes,{'tableName':_0x0f35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 6a8a276..cc08d05 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x51f941,_0x4ff4be){var _0x536f5f=function(_0x10933f){while(--_0x10933f){_0x51f941['push'](_0x51f941['shift']());}};_0x536f5f(++_0x4ff4be);}(_0xb43b,0x1b2));var _0xbb43=function(_0x30c853,_0x53d943){_0x30c853=_0x30c853-0x0;var _0x2fc231=_0xb43b[_0x30c853];return _0x2fc231;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('Tag,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('Tag,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('Tag,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x274cc2,_0xed72ce){var _0x201e34=function(_0x5a281a){while(--_0x5a281a){_0x274cc2['push'](_0x274cc2['shift']());}};_0x201e34(++_0xed72ce);}(_0x6aa7,0x178));var _0x76aa=function(_0x3b95df,_0x3ba3a0){_0x3b95df=_0x3b95df-0x0;var _0x59b22a=_0x6aa7[_0x3b95df];return _0x59b22a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b488f41..b1701fb 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index d23f9de..500b38c 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 _0xb7e7=['STRING','sequelize'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xb7e7,0x121));var _0x7b7e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb7e7[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x14cdd1,_0x1f1e6d){var _0xad9607=function(_0xdbb85){while(--_0xdbb85){_0x14cdd1['push'](_0x14cdd1['shift']());}};_0xad9607(++_0x1f1e6d);}(_0x2032,0xd9));var _0x2203=function(_0x412710,_0x4ff6ce){_0x412710=_0x412710-0x0;var _0x279aa6=_0x2032[_0x412710];return _0x279aa6;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 26570f0..59da1ce 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 _0x750d=['emit','Queue:save','User','findAll','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','all','UserVoicePrefix','spread','removeAgents','Whatsapp','transaction','Queue:remove','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','error','stack','name','send','Team','rawAttributes','fieldName','key','map','query','filters','model','attributes','intersection','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','options','then','includeAll','include','rows','catch','show','params','keys','fields','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SmsQueueId','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','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','order','addQueues','Unknown\x20channel','Queues','ids','removeQueues','addAgents','isArray','Chat','Mail','Sms','Fax','Openchannel','Voice','through','QueueId','TeamVoiceQueue','penalty','Queue','findOrCreate'];(function(_0x354298,_0x1e6d78){var _0x3956ad=function(_0x26158c){while(--_0x26158c){_0x354298['push'](_0x354298['shift']());}};_0x3956ad(++_0x1e6d78);}(_0x750d,0x157));var _0xd750=function(_0x167464,_0x4a0a6a){_0x167464=_0x167464-0x0;var _0x55e3bc=_0x750d[_0x167464];return _0x55e3bc;};'use strict';var emlformat=require(_0xd750('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd750('0x1'));var jsonpatch=require(_0xd750('0x2'));var rp=require(_0xd750('0x3'));var moment=require(_0xd750('0x4'));var BPromise=require(_0xd750('0x5'));var Mustache=require(_0xd750('0x6'));var util=require(_0xd750('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd750('0x8'));var fs=require('fs');var fs_extra=require(_0xd750('0x9'));var _=require(_0xd750('0xa'));var squel=require(_0xd750('0xb'));var crypto=require(_0xd750('0xc'));var jsforce=require(_0xd750('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd750('0xe'));var querystring=require(_0xd750('0xf'));var Papa=require(_0xd750('0x10'));var Redis=require('ioredis');var authService=require(_0xd750('0x11'));var qs=require(_0xd750('0x12'));var as=require(_0xd750('0x13'));var hardwareService=require(_0xd750('0x14'));var logger=require(_0xd750('0x15'))(_0xd750('0x16'));var utils=require(_0xd750('0x17'));var config=require(_0xd750('0x18'));var licenseUtil=require(_0xd750('0x19'));var db=require(_0xd750('0x1a'))['db'];config[_0xd750('0x1b')]=_[_0xd750('0x1c')](config[_0xd750('0x1b')],{'host':_0xd750('0x1d'),'port':0x18eb});var socket=require(_0xd750('0x1e'))(new Redis(config[_0xd750('0x1b')]));require(_0xd750('0x1f'))['register'](socket);function respondWithStatusCode(_0x216dc1,_0x17c214){_0x17c214=_0x17c214||0xcc;return function(_0x1817b6){if(_0x1817b6){return _0x216dc1[_0xd750('0x20')](_0x17c214);}return _0x216dc1[_0xd750('0x21')](_0x17c214)['end']();};}function respondWithResult(_0x57f5ea,_0x25232e){_0x25232e=_0x25232e||0xc8;return function(_0x46db09){if(_0x46db09){return _0x57f5ea[_0xd750('0x21')](_0x25232e)[_0xd750('0x22')](_0x46db09);}};}function respondWithFilteredResult(_0x2c334b,_0x5814dc){return function(_0x567505){if(_0x567505){var _0x1edcc5=typeof _0x5814dc[_0xd750('0x23')]===_0xd750('0x24')&&typeof _0x5814dc['limit']===_0xd750('0x24');var _0x30cb62=_0x567505[_0xd750('0x25')];var _0x2c1a47=_0x1edcc5?0x0:_0x5814dc['offset'];var _0x561786=_0x1edcc5?_0x567505['count']:_0x5814dc['offset']+_0x5814dc[_0xd750('0x26')];var _0xa49561;if(_0x561786>=_0x30cb62){_0x561786=_0x30cb62;_0xa49561=0xc8;}else{_0xa49561=0xce;}_0x2c334b['status'](_0xa49561);return _0x2c334b[_0xd750('0x27')](_0xd750('0x28'),_0x2c1a47+'-'+_0x561786+'/'+_0x30cb62)['json'](_0x567505);}return null;};}function patchUpdates(_0x1e1cc7){return function(_0x1de2bf){try{jsonpatch['apply'](_0x1de2bf,_0x1e1cc7,!![]);}catch(_0xac2687){return BPromise[_0xd750('0x29')](_0xac2687);}return _0x1de2bf[_0xd750('0x2a')]();};}function saveUpdates(_0x28f0b9,_0x59a7c5){return function(_0x3c83bf){if(_0x3c83bf){return _0x3c83bf[_0xd750('0x2b')](_0x28f0b9)['then'](function(_0xad4408){return _0xad4408;});}return null;};}function handleEntityNotFound(_0x2122a2,_0x352484){return function(_0x495720){if(!_0x495720){_0x2122a2[_0xd750('0x20')](0x194);}return _0x495720;};}function handleError(_0x12d2b5,_0x1179b4){_0x1179b4=_0x1179b4||0x1f4;return function(_0x18ebda){logger[_0xd750('0x2c')](_0x18ebda[_0xd750('0x2d')]);if(_0x18ebda[_0xd750('0x2e')]){delete _0x18ebda['name'];}_0x12d2b5[_0xd750('0x21')](_0x1179b4)[_0xd750('0x2f')](_0x18ebda);};}exports['index']=function(_0x3a003f,_0x4954f5){var _0x59a3b3={},_0x14a441={},_0x433a11={'count':0x0,'rows':[]};var _0x390875=_['map'](db[_0xd750('0x30')][_0xd750('0x31')],function(_0x2b5497){return{'name':_0x2b5497[_0xd750('0x32')],'type':_0x2b5497['type'][_0xd750('0x33')]};});_0x14a441['model']=_[_0xd750('0x34')](_0x390875,_0xd750('0x2e'));_0x14a441['query']=_['keys'](_0x3a003f[_0xd750('0x35')]);_0x14a441[_0xd750('0x36')]=_['intersection'](_0x14a441[_0xd750('0x37')],_0x14a441[_0xd750('0x35')]);_0x59a3b3[_0xd750('0x38')]=_[_0xd750('0x39')](_0x14a441[_0xd750('0x37')],qs['fields'](_0x3a003f[_0xd750('0x35')]['fields']));_0x59a3b3[_0xd750('0x38')]=_0x59a3b3[_0xd750('0x38')][_0xd750('0x3a')]?_0x59a3b3[_0xd750('0x38')]:_0x14a441[_0xd750('0x37')];if(!_0x3a003f[_0xd750('0x35')][_0xd750('0x3b')]('nolimit')){_0x59a3b3['limit']=qs[_0xd750('0x26')](_0x3a003f[_0xd750('0x35')][_0xd750('0x26')]);_0x59a3b3[_0xd750('0x23')]=qs[_0xd750('0x23')](_0x3a003f['query'][_0xd750('0x23')]);}_0x59a3b3['order']=qs[_0xd750('0x3c')](_0x3a003f[_0xd750('0x35')][_0xd750('0x3c')]);_0x59a3b3[_0xd750('0x3d')]=qs[_0xd750('0x36')](_[_0xd750('0x3e')](_0x3a003f[_0xd750('0x35')],_0x14a441[_0xd750('0x36')]),_0x390875);if(_0x3a003f[_0xd750('0x35')]['filter']){_0x59a3b3[_0xd750('0x3d')]=_[_0xd750('0x3f')](_0x59a3b3[_0xd750('0x3d')],{'$or':_['map'](_0x390875,function(_0x369527){if(_0x369527[_0xd750('0x40')]!==_0xd750('0x41')){var _0x23d658={};_0x23d658[_0x369527[_0xd750('0x2e')]]={'$like':'%'+_0x3a003f[_0xd750('0x35')][_0xd750('0x42')]+'%'};return _0x23d658;}})});}_0x59a3b3=_[_0xd750('0x3f')]({},_0x59a3b3,_0x3a003f[_0xd750('0x43')]);var _0xb71e82={'where':_0x59a3b3['where']};return db[_0xd750('0x30')][_0xd750('0x25')](_0xb71e82)[_0xd750('0x44')](function(_0x5db04d){_0x433a11['count']=_0x5db04d;if(_0x3a003f[_0xd750('0x35')][_0xd750('0x45')]){_0x59a3b3[_0xd750('0x46')]=[{'all':!![]}];}return db['Team']['findAll'](_0x59a3b3);})[_0xd750('0x44')](function(_0x2d2ab5){_0x433a11[_0xd750('0x47')]=_0x2d2ab5;return _0x433a11;})[_0xd750('0x44')](respondWithFilteredResult(_0x4954f5,_0x59a3b3))[_0xd750('0x48')](handleError(_0x4954f5,null));};exports[_0xd750('0x49')]=function(_0x1a43a2,_0x334105){var _0x386974={'raw':![],'where':{'id':_0x1a43a2[_0xd750('0x4a')]['id']}},_0x1c242c={};_0x1c242c['model']=_[_0xd750('0x4b')](db[_0xd750('0x30')][_0xd750('0x31')]);_0x1c242c[_0xd750('0x35')]=_['keys'](_0x1a43a2[_0xd750('0x35')]);_0x1c242c[_0xd750('0x36')]=_['intersection'](_0x1c242c[_0xd750('0x37')],_0x1c242c[_0xd750('0x35')]);_0x386974[_0xd750('0x38')]=_[_0xd750('0x39')](_0x1c242c['model'],qs['fields'](_0x1a43a2[_0xd750('0x35')][_0xd750('0x4c')]));_0x386974[_0xd750('0x38')]=_0x386974['attributes'][_0xd750('0x3a')]?_0x386974['attributes']:_0x1c242c[_0xd750('0x37')];if(_0x1a43a2[_0xd750('0x35')][_0xd750('0x45')]){_0x386974['include']=[{'all':!![]}];}_0x386974=_[_0xd750('0x3f')]({},_0x386974,_0x1a43a2['options']);return db[_0xd750('0x30')][_0xd750('0x4d')](_0x386974)['then'](handleEntityNotFound(_0x334105,null))[_0xd750('0x44')](respondWithResult(_0x334105,null))[_0xd750('0x48')](handleError(_0x334105,null));};exports[_0xd750('0x4e')]=function(_0x5fd4f4,_0x3f3313){return db[_0xd750('0x30')]['create'](_0x5fd4f4[_0xd750('0x4f')],{})[_0xd750('0x44')](function(_0x401bc3){var _0xd62ba0=_0x5fd4f4['user'][_0xd750('0x50')]({'plain':!![]});if(!_0xd62ba0)throw new Error(_0xd750('0x51'));if(_0xd62ba0[_0xd750('0x52')]===_0xd750('0x53')){var _0x969c04=_0x401bc3[_0xd750('0x50')]({'plain':!![]});var _0x2a42d6='Teams';return db[_0xd750('0x54')][_0xd750('0x4d')]({'where':{'name':_0x2a42d6,'userProfileId':_0xd62ba0[_0xd750('0x55')]},'raw':!![]})[_0xd750('0x44')](function(_0x34f89c){if(_0x34f89c&&_0x34f89c[_0xd750('0x56')]===0x0){return db['UserProfileResource'][_0xd750('0x4e')]({'name':_0x969c04[_0xd750('0x2e')],'resourceId':_0x969c04['id'],'type':_0x34f89c[_0xd750('0x2e')],'sectionId':_0x34f89c['id']},{})['then'](function(){return _0x401bc3;});}else{return _0x401bc3;}})[_0xd750('0x48')](function(_0x47eefc){logger[_0xd750('0x2c')](_0xd750('0x57'),_0x47eefc);throw _0x47eefc;});}return _0x401bc3;})[_0xd750('0x44')](respondWithResult(_0x3f3313,0xc9))[_0xd750('0x48')](handleError(_0x3f3313,null));};exports['update']=function(_0xf343b6,_0x428e9a){if(_0xf343b6['body']['id']){delete _0xf343b6[_0xd750('0x4f')]['id'];}return db[_0xd750('0x30')][_0xd750('0x4d')]({'where':{'id':_0xf343b6[_0xd750('0x4a')]['id']}})[_0xd750('0x44')](handleEntityNotFound(_0x428e9a,null))[_0xd750('0x44')](saveUpdates(_0xf343b6['body'],null))[_0xd750('0x44')](respondWithResult(_0x428e9a,null))[_0xd750('0x48')](handleError(_0x428e9a,null));};exports[_0xd750('0x58')]=function(_0x55f6d5,_0x54f9de){var _0x2adab6=_0x55f6d5[_0xd750('0x4a')]['id'];var _0x1b527a=[];return db['sequelize']['transaction'](function(_0x424b61){var _0x4328ff=_0xd750('0x59')+_0x2adab6;return db[_0xd750('0x5a')][_0xd750('0x35')](_0x4328ff,{'type':db[_0xd750('0x5b')]['QueryTypes'][_0xd750('0x5c')],'raw':!![],'transaction':_0x424b61})['then'](function(_0x4c317f){_0x1b527a=_[_0xd750('0x34')](_0x4c317f,function(_0x1fbd07){return Number(_0x1fbd07[_0xd750('0x5d')]);});})[_0xd750('0x44')](function(){var _0x289ac3=_0xd750('0x5e')+_0x2adab6;return db['sequelize'][_0xd750('0x35')](_0x289ac3,{'type':db[_0xd750('0x5b')][_0xd750('0x5f')]['SELECT'],'raw':!![],'transaction':_0x424b61});})['then'](function(_0x35b238){var _0x57326d=_[_0xd750('0x34')](_0x35b238,function(_0x53f7ad){return Number(_0x53f7ad[_0xd750('0x60')]);});return db[_0xd750('0x61')][_0xd750('0x58')]({'where':{'UserId':{'$in':_0x1b527a},'VoiceQueueId':{'$in':_0x57326d}},'transaction':_0x424b61});})['then'](function(){var _0x189d5d=_0xd750('0x62')+_0x2adab6;return db[_0xd750('0x5a')][_0xd750('0x35')](_0x189d5d,{'type':db[_0xd750('0x5b')][_0xd750('0x5f')][_0xd750('0x5c')],'raw':!![],'transaction':_0x424b61});})[_0xd750('0x44')](function(_0x3e5f9e){var _0x2699da=_[_0xd750('0x34')](_0x3e5f9e,function(_0x4d025d){return Number(_0x4d025d['MailQueueId']);});return db[_0xd750('0x63')]['destroy']({'where':{'UserId':{'$in':_0x1b527a},'MailQueueId':{'$in':_0x2699da}},'transaction':_0x424b61});})[_0xd750('0x44')](function(){var _0x547d1e='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2adab6;return db['sequelize'][_0xd750('0x35')](_0x547d1e,{'type':db[_0xd750('0x5b')][_0xd750('0x5f')][_0xd750('0x5c')],'raw':!![],'transaction':_0x424b61});})[_0xd750('0x44')](function(_0x2a6f62){var _0x1eff0a=_[_0xd750('0x34')](_0x2a6f62,function(_0x4e3037){return Number(_0x4e3037[_0xd750('0x64')]);});return db['UserSmsQueue'][_0xd750('0x58')]({'where':{'UserId':{'$in':_0x1b527a},'SmsQueueId':{'$in':_0x1eff0a}},'transaction':_0x424b61});})['then'](function(){var _0x1a8ccd=_0xd750('0x65')+_0x2adab6;return db['sequelize'][_0xd750('0x35')](_0x1a8ccd,{'type':db[_0xd750('0x5b')][_0xd750('0x5f')][_0xd750('0x5c')],'raw':!![],'transaction':_0x424b61});})[_0xd750('0x44')](function(_0x20c6f1){var _0x5d6eaf=_[_0xd750('0x34')](_0x20c6f1,function(_0x379035){return Number(_0x379035[_0xd750('0x66')]);});return db[_0xd750('0x67')][_0xd750('0x58')]({'where':{'UserId':{'$in':_0x1b527a},'ChatQueueId':{'$in':_0x5d6eaf}},'transaction':_0x424b61});})[_0xd750('0x44')](function(){var _0x5bb23a=_0xd750('0x68')+_0x2adab6;return db[_0xd750('0x5a')][_0xd750('0x35')](_0x5bb23a,{'type':db['Sequelize'][_0xd750('0x5f')][_0xd750('0x5c')],'raw':!![],'transaction':_0x424b61});})[_0xd750('0x44')](function(_0x3b6ddd){var _0x27fb17=_[_0xd750('0x34')](_0x3b6ddd,function(_0x27a30e){return Number(_0x27a30e[_0xd750('0x69')]);});return db[_0xd750('0x6a')][_0xd750('0x58')]({'where':{'UserId':{'$in':_0x1b527a},'FaxQueueId':{'$in':_0x27fb17}},'transaction':_0x424b61});})['then'](function(){var _0x880e12=_0xd750('0x6b')+_0x2adab6;return db[_0xd750('0x5a')]['query'](_0x880e12,{'type':db[_0xd750('0x5b')]['QueryTypes'][_0xd750('0x5c')],'raw':!![],'transaction':_0x424b61});})[_0xd750('0x44')](function(_0x4c2acb){var _0x590198=_['map'](_0x4c2acb,function(_0x90bdf7){return Number(_0x90bdf7[_0xd750('0x6c')]);});return db[_0xd750('0x6d')][_0xd750('0x58')]({'where':{'UserId':{'$in':_0x1b527a},'OpenchannelQueueId':{'$in':_0x590198}},'transaction':_0x424b61});})[_0xd750('0x44')](function(){var _0xd58f38=_0xd750('0x6e')+_0x2adab6;return db[_0xd750('0x5a')][_0xd750('0x35')](_0xd58f38,{'type':db['Sequelize']['QueryTypes'][_0xd750('0x5c')],'raw':!![],'transaction':_0x424b61});})[_0xd750('0x44')](function(_0x59089e){var _0xf70e6d=_['map'](_0x59089e,function(_0x5a53b7){return Number(_0x5a53b7[_0xd750('0x6f')]);});return db[_0xd750('0x70')][_0xd750('0x58')]({'where':{'UserId':{'$in':_0x1b527a},'WhatsappQueueId':{'$in':_0xf70e6d}},'transaction':_0x424b61});})[_0xd750('0x44')](function(){return db[_0xd750('0x71')][_0xd750('0x4d')]({'where':{'TeamId':_0x2adab6}});})[_0xd750('0x44')](function(_0x18dda0){if(_0x18dda0===null){return;}return db['UserVoicePrefix'][_0xd750('0x58')]({'where':{'UserId':{'$in':_0x1b527a},'VoicePrefixId':_0x18dda0[_0xd750('0x72')]},'transaction':_0x424b61});})[_0xd750('0x44')](function(){return db['Team'][_0xd750('0x58')]({'where':{'id':_0x2adab6},'cascade':!![],'transaction':_0x424b61});})['then'](function(_0x43c753){if(_0x43c753===0x0){_0x54f9de[_0xd750('0x20')](0x194);}else{return db['UserProfileResource'][_0xd750('0x58')]({'where':{'type':_0xd750('0x73'),'resourceId':_0x2adab6},'cascade':!![],'transaction':_0x424b61})['then'](function(){_0x54f9de[_0xd750('0x21')](0xcc)['end']();});}})[_0xd750('0x48')](function(_0x442b7){_0x54f9de[_0xd750('0x21')](0x1f4)[_0xd750('0x2f')](_0x442b7);});});};exports[_0xd750('0x74')]=function(_0x23eacc,_0x33b468,_0x5f179c){return db['Team'][_0xd750('0x75')]({'where':{'id':_0x23eacc[_0xd750('0x4a')]['id']}})[_0xd750('0x44')](handleEntityNotFound(_0x33b468,null))[_0xd750('0x44')](function(_0x424f6f){if(!_0x23eacc[_0xd750('0x35')][_0xd750('0x76')]||!utils[_0xd750('0x77')](_0x23eacc[_0xd750('0x35')][_0xd750('0x76')])){throw new db['Sequelize'][(_0xd750('0x78'))]('Unknown\x20channel');}var _0x58fcae={};var _0x2a77d9={};_0x2a77d9[_0xd750('0x37')]=_['keys'](db[_[_0xd750('0x79')](_0x23eacc[_0xd750('0x35')][_0xd750('0x76')][_0xd750('0x7a')]())+'Queue']['rawAttributes']);_0x2a77d9[_0xd750('0x35')]=_[_0xd750('0x4b')](_0x23eacc[_0xd750('0x35')]);_0x2a77d9['filters']=_[_0xd750('0x39')](_0x2a77d9[_0xd750('0x37')],_0x2a77d9[_0xd750('0x35')]);_0x58fcae[_0xd750('0x38')]=_[_0xd750('0x39')](_0x2a77d9['model'],qs[_0xd750('0x4c')](_0x23eacc[_0xd750('0x35')]['fields']));_0x58fcae[_0xd750('0x38')]=_0x58fcae[_0xd750('0x38')][_0xd750('0x3a')]?_0x58fcae['attributes']:_0x2a77d9['model'];_0x58fcae[_0xd750('0x26')]=qs['limit'](_0x23eacc['query'][_0xd750('0x26')]);_0x58fcae[_0xd750('0x23')]=qs[_0xd750('0x23')](_0x23eacc[_0xd750('0x35')][_0xd750('0x23')]);_0x58fcae[_0xd750('0x7b')]=qs[_0xd750('0x3c')](_0x23eacc['query']['sort']);_0x58fcae[_0xd750('0x3d')]=qs[_0xd750('0x36')](_['pick'](_0x23eacc[_0xd750('0x35')],_0x2a77d9[_0xd750('0x36')]));_0x58fcae=_[_0xd750('0x3f')]({},_0x58fcae,_0x23eacc['options']);return _0x424f6f['get'+_['capitalize'](_0x23eacc[_0xd750('0x35')]['channel'][_0xd750('0x7a')]())+'Queues'](_0x58fcae);})['then'](respondWithResult(_0x33b468,null))[_0xd750('0x48')](handleError(_0x33b468,null));};exports[_0xd750('0x7c')]=function(_0x87dfc3,_0x25929a,_0x54462a){return db[_0xd750('0x30')][_0xd750('0x75')]({'where':{'id':_0x87dfc3[_0xd750('0x4a')]['id']}})[_0xd750('0x44')](function(_0x37d724){if(_0x37d724){if(!_0x87dfc3[_0xd750('0x4f')]['channel']||!utils['isValidChannel'](_0x87dfc3[_0xd750('0x4f')][_0xd750('0x76')])){throw new db[(_0xd750('0x5b'))]['ValidationError'](_0xd750('0x7d'));}return _0x37d724['add'+_[_0xd750('0x79')](_0x87dfc3['body']['channel'][_0xd750('0x7a')]())+_0xd750('0x7e')](_0x87dfc3[_0xd750('0x4f')][_0xd750('0x7f')]);}return null;})[_0xd750('0x44')](handleEntityNotFound(_0x25929a,null))[_0xd750('0x44')](respondWithStatusCode(_0x25929a,null))[_0xd750('0x48')](handleError(_0x25929a,null));};exports[_0xd750('0x80')]=function(_0x28ad6c,_0x4929c1,_0x40d7e6){return db['Team']['findOne']({'where':{'id':_0x28ad6c[_0xd750('0x4a')]['id']}})[_0xd750('0x44')](function(_0x5d78a2){if(_0x5d78a2){if(!_0x28ad6c[_0xd750('0x35')][_0xd750('0x76')]||!utils[_0xd750('0x77')](_0x28ad6c[_0xd750('0x35')]['channel'])){throw new db[(_0xd750('0x5b'))][(_0xd750('0x78'))](_0xd750('0x7d'));}return _0x5d78a2['remove'+_[_0xd750('0x79')](_0x28ad6c[_0xd750('0x35')][_0xd750('0x76')][_0xd750('0x7a')]())+_0xd750('0x7e')](_0x28ad6c[_0xd750('0x35')]['ids']);}return null;})[_0xd750('0x44')](handleEntityNotFound(_0x4929c1,null))[_0xd750('0x44')](respondWithStatusCode(_0x4929c1,null))['catch'](handleError(_0x4929c1,null));};exports[_0xd750('0x81')]=function(_0xdfa5f4,_0x5063cd){var _0x5a92e6=_[_0xd750('0x82')](_0xdfa5f4[_0xd750('0x4f')][_0xd750('0x7f')])?_0xdfa5f4[_0xd750('0x4f')]['ids']:[_0xdfa5f4[_0xd750('0x4f')][_0xd750('0x7f')]];var _0x258e28=_0xdfa5f4[_0xd750('0x4a')]['id'];return db[_0xd750('0x30')][_0xd750('0x4d')]({'where':{'id':_0x258e28}})[_0xd750('0x44')](handleEntityNotFound(_0x5063cd,null))[_0xd750('0x44')](function(_0x5bb043){if(_0x5bb043){var _0x4d81b4=['Voice',_0xd750('0x83'),_0xd750('0x84'),_0xd750('0x85'),_0xd750('0x86'),_0xd750('0x87'),'Whatsapp'];return db[_0xd750('0x5a')]['transaction'](function(_0x5b55b2){var _0x46ccf7=_[_0xd750('0x34')](_0x4d81b4,function(_0x5bd053){var _0x3792bc={'attributes':['id',_0xd750('0x2e')]};if(_0x5bd053===_0xd750('0x88')){_0x3792bc[_0xd750('0x89')]={'attributes':['penalty']};}return _0x5bb043['get'+_0x5bd053+_0xd750('0x7e')](_0x3792bc)['then'](function(_0x56350e){var _0x1e35dd=_[_0xd750('0x34')](_0x56350e,function(_0x2b2992){var _0x4aef6a=_[_0xd750('0x34')](_0x5a92e6,function(_0x22e052){var _0x2dbd4e={'where':{'UserId':_0x22e052,[_0x5bd053+_0xd750('0x8a')]:_0x2b2992['id']},'transaction':_0x5b55b2};if(_0x5bd053==='Voice'){_0x2dbd4e[_0xd750('0x1c')]={'penalty':_0x2b2992[_0xd750('0x8b')][_0xd750('0x8c')]};}return db['User'+_0x5bd053+_0xd750('0x8d')][_0xd750('0x8e')](_0x2dbd4e)[_0xd750('0x44')](function(){socket[_0xd750('0x8f')]('user'+_0x5bd053+_0xd750('0x90'),{'UserId':_0x22e052,[_0x5bd053+_0xd750('0x8a')]:_0x2b2992['id']});if(_0x5bd053!==_0xd750('0x88')){return;}return db[_0xd750('0x91')][_0xd750('0x92')]({'where':{'id':_0x5a92e6,'online':0x1},'attributes':['id',_0xd750('0x2e'),_0xd750('0x93'),'voicePause',_0xd750('0x94')],'raw':!![]})[_0xd750('0x44')](function(_0xc328ea){var _0xb2bfb4=_[_0xd750('0x34')](_0xc328ea,function(_0x276e11){return db[_0xd750('0x95')][_0xd750('0x96')]({'membername':_0x276e11[_0xd750('0x2e')],'UserId':_0x276e11['id'],'queue_name':_0x2b2992[_0xd750('0x2e')],'VoiceQueueId':_0x2b2992['id'],'interface':_['isNil'](_0x276e11[_0xd750('0x94')])?util[_0xd750('0x97')](_0xd750('0x98'),_0x276e11[_0xd750('0x2e')]):_0x276e11[_0xd750('0x94')],'paused':_0x276e11[_0xd750('0x99')]||![],'penalty':_0x2b2992[_0xd750('0x8b')][_0xd750('0x8c')]},{'transaction':_0x5b55b2});});return Promise[_0xd750('0x9a')](_0xb2bfb4);});});});return Promise[_0xd750('0x9a')](_0x4aef6a);});return Promise[_0xd750('0x9a')](_0x1e35dd);})['then'](function(){return db[_0xd750('0x71')][_0xd750('0x75')]({'where':{'teamId':_0x258e28}})['then'](function(_0x1e43fd){if(_0x1e43fd){var _0x58a175=_[_0xd750('0x34')](_0x5a92e6,function(_0x3320c7){db[_0xd750('0x9b')]['upsert']({'UserId':_0x3320c7,'VoicePrefixId':_0x1e43fd['VoicePrefixId']});});return Promise[_0xd750('0x9a')](_0x58a175);}});});});return Promise[_0xd750('0x9a')](_0x46ccf7)[_0xd750('0x44')](function(){return _0x5bb043[_0xd750('0x81')](_0x5a92e6,{'transaction':_0x5b55b2})[_0xd750('0x9c')](function(_0x22837b){return _0x22837b;});});});}})[_0xd750('0x44')](respondWithResult(_0x5063cd,null))[_0xd750('0x48')](handleError(_0x5063cd,null));};exports[_0xd750('0x9d')]=function(_0xb46ba9,_0x50b3b9){var _0x48c836=_[_0xd750('0x82')](_0xb46ba9['query'][_0xd750('0x7f')])?_0xb46ba9[_0xd750('0x35')][_0xd750('0x7f')]:[_0xb46ba9[_0xd750('0x35')][_0xd750('0x7f')]];var _0x151e9c=_0xb46ba9[_0xd750('0x4a')]['id'];return db[_0xd750('0x30')][_0xd750('0x4d')]({'where':{'id':_0x151e9c}})[_0xd750('0x44')](handleEntityNotFound(_0x50b3b9,null))[_0xd750('0x44')](function(_0x536bf5){if(_0x536bf5){var _0x478812=[_0xd750('0x88'),_0xd750('0x83'),'Mail',_0xd750('0x85'),_0xd750('0x86'),'Openchannel',_0xd750('0x9e')];return db[_0xd750('0x5a')][_0xd750('0x9f')](function(_0x57dec0){var _0x521eb3=_[_0xd750('0x34')](_0x478812,function(_0x4ed18a){var _0x3922de={'attributes':['id',_0xd750('0x2e')]};return _0x536bf5['get'+_0x4ed18a+_0xd750('0x7e')](_0x3922de)[_0xd750('0x44')](function(_0x190ea1){var _0x5c7f80=_['map'](_0x190ea1,function(_0x1794df){return _0x1794df[_0xd750('0x9d')](_0x48c836,{'transaction':_0x57dec0})[_0xd750('0x44')](function(){var _0x321ef3=_[_0xd750('0x34')](_0x48c836,function(_0x4a65ab){socket[_0xd750('0x8f')](_0xd750('0x53')+_0x4ed18a+_0xd750('0xa0'),{'UserId':Number(_0x4a65ab),[_0x4ed18a+_0xd750('0x8a')]:_0x1794df['id']});if(_0x4ed18a!==_0xd750('0x88')){return;}return db[_0xd750('0x95')][_0xd750('0x58')]({'where':{'VoiceQueueId':_0x1794df['id'],'UserId':_0x4a65ab},'transaction':_0x57dec0});});return Promise['all'](_0x321ef3);});});return Promise[_0xd750('0x9a')](_0x5c7f80);});});return Promise[_0xd750('0x9a')](_0x521eb3)[_0xd750('0x44')](function(){return _0x536bf5[_0xd750('0x9d')](_0x48c836,{'transaction':_0x57dec0});})['then'](function(){return db[_0xd750('0x71')]['findOne']({'where':{'teamId':_0x151e9c}})[_0xd750('0x44')](function(_0x1c701f){if(_0x1c701f){var _0x260b84=_[_0xd750('0x34')](_0x48c836,function(_0x2c30b6){db[_0xd750('0x9b')][_0xd750('0x58')]({'where':{'UserId':_0x2c30b6,'VoicePrefixId':_0x1c701f['VoicePrefixId']}});});return Promise['all'](_0x260b84);}});});});}})[_0xd750('0x44')](respondWithStatusCode(_0x50b3b9,null))['catch'](handleError(_0x50b3b9,null));};exports['getAgents']=function(_0x2d0ce6,_0x9f1f55,_0x2e2699){var _0x5013e9={};var _0x35dd78={};var _0x5bf9e1;var _0x16a3a7;return db['Team'][_0xd750('0x75')]({'where':{'id':_0x2d0ce6['params']['id']}})['then'](handleEntityNotFound(_0x9f1f55,null))[_0xd750('0x44')](function(_0x3e811a){if(_0x3e811a){_0x5bf9e1=_0x3e811a;_0x35dd78[_0xd750('0x37')]=_['keys'](db[_0xd750('0x91')]['rawAttributes']);_0x35dd78['query']=_['keys'](_0x2d0ce6[_0xd750('0x35')]);_0x35dd78[_0xd750('0x36')]=_[_0xd750('0x39')](_0x35dd78[_0xd750('0x37')],_0x35dd78['query']);_0x5013e9[_0xd750('0x38')]=_['intersection'](_0x35dd78[_0xd750('0x37')],qs[_0xd750('0x4c')](_0x2d0ce6[_0xd750('0x35')][_0xd750('0x4c')]));_0x5013e9[_0xd750('0x38')]=_0x5013e9[_0xd750('0x38')][_0xd750('0x3a')]?_0x5013e9[_0xd750('0x38')]:_0x35dd78['model'];_0x5013e9[_0xd750('0x7b')]=qs[_0xd750('0x3c')](_0x2d0ce6[_0xd750('0x35')][_0xd750('0x3c')]);_0x5013e9['where']=qs[_0xd750('0x36')](_[_0xd750('0x3e')](_0x2d0ce6[_0xd750('0x35')],_0x35dd78[_0xd750('0x36')]));if(_0x2d0ce6['query']['filter']){_0x5013e9['where']=_['merge'](_0x5013e9[_0xd750('0x3d')],{'$or':_[_0xd750('0x34')](_0x5013e9[_0xd750('0x38')],function(_0x516d08){var _0x5cd3d7={};_0x5cd3d7[_0x516d08]={'$like':'%'+_0x2d0ce6['query']['filter']+'%'};return _0x5cd3d7;})});}_0x5013e9=_[_0xd750('0x3f')]({},_0x5013e9,_0x2d0ce6[_0xd750('0x43')]);return _0x5bf9e1['getAgents'](_0x5013e9);}})['then'](function(_0x3d7d23){if(_0x3d7d23){_0x16a3a7=_0x3d7d23['length'];if(!_0x2d0ce6[_0xd750('0x35')][_0xd750('0x3b')](_0xd750('0xa1'))){_0x5013e9['limit']=qs[_0xd750('0x26')](_0x2d0ce6[_0xd750('0x35')][_0xd750('0x26')]);_0x5013e9[_0xd750('0x23')]=qs[_0xd750('0x23')](_0x2d0ce6[_0xd750('0x35')]['offset']);}return _0x5bf9e1['getAgents'](_0x5013e9);}})['then'](function(_0x455301){if(_0x455301){return _0x455301?{'count':_0x16a3a7,'rows':_0x455301}:null;}})['then'](respondWithResult(_0x9f1f55,null))[_0xd750('0x48')](handleError(_0x9f1f55,null));}; \ No newline at end of file +var _0xc52b=['Openchannel','through','QueueId','TeamVoiceQueue','User','findOrCreate','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','VoicePrefixId','spread','removeAgents','Whatsapp','emit','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','undefined','count','offset','limit','set','json','apply','reject','save','then','error','name','send','map','Team','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','end','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','Queue','Queues','isValidChannel','toLowerCase','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax'];(function(_0x5bb7e4,_0x43ba19){var _0x399c95=function(_0xbf0f85){while(--_0xbf0f85){_0x5bb7e4['push'](_0x5bb7e4['shift']());}};_0x399c95(++_0x43ba19);}(_0xc52b,0x1d1));var _0xbc52=function(_0x5041dc,_0xa27310){_0x5041dc=_0x5041dc-0x0;var _0x1370ab=_0xc52b[_0x5041dc];return _0x1370ab;};'use strict';var emlformat=require(_0xbc52('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc52('0x1'));var jsonpatch=require(_0xbc52('0x2'));var rp=require('request-promise');var moment=require(_0xbc52('0x3'));var BPromise=require(_0xbc52('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbc52('0x5'));var sox=require(_0xbc52('0x6'));var csv=require('to-csv');var ejs=require(_0xbc52('0x7'));var fs=require('fs');var fs_extra=require(_0xbc52('0x8'));var _=require(_0xbc52('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc52('0xa'));var toCsv=require(_0xbc52('0xb'));var querystring=require(_0xbc52('0xc'));var Papa=require('papaparse');var Redis=require(_0xbc52('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbc52('0xe'));var as=require(_0xbc52('0xf'));var hardwareService=require(_0xbc52('0x10'));var logger=require(_0xbc52('0x11'))(_0xbc52('0x12'));var utils=require(_0xbc52('0x13'));var config=require(_0xbc52('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc52('0x15'))['db'];config[_0xbc52('0x16')]=_[_0xbc52('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbc52('0x18'))(new Redis(config[_0xbc52('0x16')]));require(_0xbc52('0x19'))[_0xbc52('0x1a')](socket);function respondWithStatusCode(_0x760af8,_0x488a45){_0x488a45=_0x488a45||0xcc;return function(_0x295b57){if(_0x295b57){return _0x760af8[_0xbc52('0x1b')](_0x488a45);}return _0x760af8[_0xbc52('0x1c')](_0x488a45)['end']();};}function respondWithResult(_0x2bb037,_0x22d96f){_0x22d96f=_0x22d96f||0xc8;return function(_0x44ab35){if(_0x44ab35){return _0x2bb037[_0xbc52('0x1c')](_0x22d96f)['json'](_0x44ab35);}};}function respondWithFilteredResult(_0x2addf8,_0x4a4b84){return function(_0x34c74c){if(_0x34c74c){var _0x339803=typeof _0x4a4b84['offset']===_0xbc52('0x1d')&&typeof _0x4a4b84['limit']===_0xbc52('0x1d');var _0x34508e=_0x34c74c[_0xbc52('0x1e')];var _0x121335=_0x339803?0x0:_0x4a4b84[_0xbc52('0x1f')];var _0x2ad46b=_0x339803?_0x34c74c[_0xbc52('0x1e')]:_0x4a4b84[_0xbc52('0x1f')]+_0x4a4b84[_0xbc52('0x20')];var _0x4cbaa0;if(_0x2ad46b>=_0x34508e){_0x2ad46b=_0x34508e;_0x4cbaa0=0xc8;}else{_0x4cbaa0=0xce;}_0x2addf8['status'](_0x4cbaa0);return _0x2addf8[_0xbc52('0x21')]('Content-Range',_0x121335+'-'+_0x2ad46b+'/'+_0x34508e)[_0xbc52('0x22')](_0x34c74c);}return null;};}function patchUpdates(_0x808781){return function(_0x4bb7a6){try{jsonpatch[_0xbc52('0x23')](_0x4bb7a6,_0x808781,!![]);}catch(_0x10ee1c){return BPromise[_0xbc52('0x24')](_0x10ee1c);}return _0x4bb7a6[_0xbc52('0x25')]();};}function saveUpdates(_0x4ca768,_0x15d544){return function(_0x5803b3){if(_0x5803b3){return _0x5803b3['update'](_0x4ca768)[_0xbc52('0x26')](function(_0x32ba52){return _0x32ba52;});}return null;};}function handleEntityNotFound(_0x4fc345,_0x31074f){return function(_0x4d686a){if(!_0x4d686a){_0x4fc345['sendStatus'](0x194);}return _0x4d686a;};}function handleError(_0x1196f6,_0x5746c1){_0x5746c1=_0x5746c1||0x1f4;return function(_0x54fcb5){logger[_0xbc52('0x27')](_0x54fcb5['stack']);if(_0x54fcb5[_0xbc52('0x28')]){delete _0x54fcb5[_0xbc52('0x28')];}_0x1196f6[_0xbc52('0x1c')](_0x5746c1)[_0xbc52('0x29')](_0x54fcb5);};}exports['index']=function(_0x3bc3bd,_0x33a4e6){var _0x22cbb4={},_0x3607c3={},_0x39c359={'count':0x0,'rows':[]};var _0x26e364=_[_0xbc52('0x2a')](db[_0xbc52('0x2b')]['rawAttributes'],function(_0x331987){return{'name':_0x331987[_0xbc52('0x2c')],'type':_0x331987[_0xbc52('0x2d')]['key']};});_0x3607c3[_0xbc52('0x2e')]=_['map'](_0x26e364,'name');_0x3607c3[_0xbc52('0x2f')]=_[_0xbc52('0x30')](_0x3bc3bd['query']);_0x3607c3[_0xbc52('0x31')]=_[_0xbc52('0x32')](_0x3607c3[_0xbc52('0x2e')],_0x3607c3[_0xbc52('0x2f')]);_0x22cbb4[_0xbc52('0x33')]=_[_0xbc52('0x32')](_0x3607c3['model'],qs['fields'](_0x3bc3bd[_0xbc52('0x2f')]['fields']));_0x22cbb4[_0xbc52('0x33')]=_0x22cbb4[_0xbc52('0x33')][_0xbc52('0x34')]?_0x22cbb4['attributes']:_0x3607c3[_0xbc52('0x2e')];if(!_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x35')](_0xbc52('0x36'))){_0x22cbb4[_0xbc52('0x20')]=qs['limit'](_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x20')]);_0x22cbb4[_0xbc52('0x1f')]=qs['offset'](_0x3bc3bd['query'][_0xbc52('0x1f')]);}_0x22cbb4['order']=qs[_0xbc52('0x37')](_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x37')]);_0x22cbb4[_0xbc52('0x38')]=qs[_0xbc52('0x31')](_[_0xbc52('0x39')](_0x3bc3bd[_0xbc52('0x2f')],_0x3607c3[_0xbc52('0x31')]),_0x26e364);if(_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x3a')]){_0x22cbb4[_0xbc52('0x38')]=_[_0xbc52('0x3b')](_0x22cbb4['where'],{'$or':_[_0xbc52('0x2a')](_0x26e364,function(_0x4930e6){if(_0x4930e6[_0xbc52('0x2d')]!=='VIRTUAL'){var _0x13e62f={};_0x13e62f[_0x4930e6[_0xbc52('0x28')]]={'$like':'%'+_0x3bc3bd[_0xbc52('0x2f')]['filter']+'%'};return _0x13e62f;}})});}_0x22cbb4=_[_0xbc52('0x3b')]({},_0x22cbb4,_0x3bc3bd[_0xbc52('0x3c')]);var _0x5c132e={'where':_0x22cbb4[_0xbc52('0x38')]};return db[_0xbc52('0x2b')][_0xbc52('0x1e')](_0x5c132e)[_0xbc52('0x26')](function(_0x37c9fa){_0x39c359[_0xbc52('0x1e')]=_0x37c9fa;if(_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x3d')]){_0x22cbb4[_0xbc52('0x3e')]=[{'all':!![]}];}return db['Team'][_0xbc52('0x3f')](_0x22cbb4);})['then'](function(_0x59988a){_0x39c359['rows']=_0x59988a;return _0x39c359;})[_0xbc52('0x26')](respondWithFilteredResult(_0x33a4e6,_0x22cbb4))[_0xbc52('0x40')](handleError(_0x33a4e6,null));};exports[_0xbc52('0x41')]=function(_0x3d687d,_0x3fc5b6){var _0xb1263b={'raw':![],'where':{'id':_0x3d687d[_0xbc52('0x42')]['id']}},_0x5c6677={};_0x5c6677['model']=_[_0xbc52('0x30')](db['Team'][_0xbc52('0x43')]);_0x5c6677['query']=_[_0xbc52('0x30')](_0x3d687d[_0xbc52('0x2f')]);_0x5c6677['filters']=_[_0xbc52('0x32')](_0x5c6677['model'],_0x5c6677['query']);_0xb1263b['attributes']=_['intersection'](_0x5c6677['model'],qs[_0xbc52('0x44')](_0x3d687d[_0xbc52('0x2f')]['fields']));_0xb1263b[_0xbc52('0x33')]=_0xb1263b[_0xbc52('0x33')][_0xbc52('0x34')]?_0xb1263b[_0xbc52('0x33')]:_0x5c6677['model'];if(_0x3d687d[_0xbc52('0x2f')][_0xbc52('0x3d')]){_0xb1263b[_0xbc52('0x3e')]=[{'all':!![]}];}_0xb1263b=_[_0xbc52('0x3b')]({},_0xb1263b,_0x3d687d['options']);return db[_0xbc52('0x2b')][_0xbc52('0x45')](_0xb1263b)[_0xbc52('0x26')](handleEntityNotFound(_0x3fc5b6,null))['then'](respondWithResult(_0x3fc5b6,null))[_0xbc52('0x40')](handleError(_0x3fc5b6,null));};exports[_0xbc52('0x46')]=function(_0x281ef1,_0x514ba7){return db[_0xbc52('0x2b')][_0xbc52('0x46')](_0x281ef1[_0xbc52('0x47')],{})[_0xbc52('0x26')](function(_0x18cb8b){var _0x525595=_0x281ef1[_0xbc52('0x48')][_0xbc52('0x49')]({'plain':!![]});if(!_0x525595)throw new Error(_0xbc52('0x4a'));if(_0x525595[_0xbc52('0x4b')]===_0xbc52('0x48')){var _0xc62d05=_0x18cb8b[_0xbc52('0x49')]({'plain':!![]});var _0x590372=_0xbc52('0x4c');return db[_0xbc52('0x4d')][_0xbc52('0x45')]({'where':{'name':_0x590372,'userProfileId':_0x525595[_0xbc52('0x4e')]},'raw':!![]})[_0xbc52('0x26')](function(_0x3fb400){if(_0x3fb400&&_0x3fb400[_0xbc52('0x4f')]===0x0){return db[_0xbc52('0x50')][_0xbc52('0x46')]({'name':_0xc62d05[_0xbc52('0x28')],'resourceId':_0xc62d05['id'],'type':_0x3fb400[_0xbc52('0x28')],'sectionId':_0x3fb400['id']},{})['then'](function(){return _0x18cb8b;});}else{return _0x18cb8b;}})['catch'](function(_0x455342){logger[_0xbc52('0x27')](_0xbc52('0x51'),_0x455342);throw _0x455342;});}return _0x18cb8b;})[_0xbc52('0x26')](respondWithResult(_0x514ba7,0xc9))[_0xbc52('0x40')](handleError(_0x514ba7,null));};exports[_0xbc52('0x52')]=function(_0x478a47,_0x586716){if(_0x478a47['body']['id']){delete _0x478a47[_0xbc52('0x47')]['id'];}return db[_0xbc52('0x2b')][_0xbc52('0x45')]({'where':{'id':_0x478a47[_0xbc52('0x42')]['id']}})[_0xbc52('0x26')](handleEntityNotFound(_0x586716,null))['then'](saveUpdates(_0x478a47['body'],null))[_0xbc52('0x26')](respondWithResult(_0x586716,null))['catch'](handleError(_0x586716,null));};exports[_0xbc52('0x53')]=function(_0x10ae82,_0x4a48d8){var _0x425c79=_0x10ae82[_0xbc52('0x42')]['id'];var _0x1e5b55=[];return db[_0xbc52('0x54')][_0xbc52('0x55')](function(_0x19c7a3){var _0x3d8db6='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x425c79;return db[_0xbc52('0x54')][_0xbc52('0x2f')](_0x3d8db6,{'type':db[_0xbc52('0x56')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x19c7a3})[_0xbc52('0x26')](function(_0x3bfe6c){_0x1e5b55=_[_0xbc52('0x2a')](_0x3bfe6c,function(_0x5258c8){return Number(_0x5258c8[_0xbc52('0x57')]);});})['then'](function(){var _0x1a6760=_0xbc52('0x58')+_0x425c79;return db[_0xbc52('0x54')][_0xbc52('0x2f')](_0x1a6760,{'type':db[_0xbc52('0x56')]['QueryTypes'][_0xbc52('0x59')],'raw':!![],'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(_0x2bc615){var _0xc52710=_[_0xbc52('0x2a')](_0x2bc615,function(_0x1d4931){return Number(_0x1d4931[_0xbc52('0x5a')]);});return db[_0xbc52('0x5b')][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'VoiceQueueId':{'$in':_0xc52710}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0x3580ea=_0xbc52('0x5c')+_0x425c79;return db[_0xbc52('0x54')][_0xbc52('0x2f')](_0x3580ea,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')]['SELECT'],'raw':!![],'transaction':_0x19c7a3});})['then'](function(_0x1aa5a4){var _0x23d532=_['map'](_0x1aa5a4,function(_0x52f098){return Number(_0x52f098[_0xbc52('0x5e')]);});return db['UserMailQueue'][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'MailQueueId':{'$in':_0x23d532}},'transaction':_0x19c7a3});})['then'](function(){var _0x17ec36=_0xbc52('0x5f')+_0x425c79;return db['sequelize'][_0xbc52('0x2f')](_0x17ec36,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')][_0xbc52('0x59')],'raw':!![],'transaction':_0x19c7a3});})['then'](function(_0x17ed8a){var _0x2c927f=_['map'](_0x17ed8a,function(_0x443a76){return Number(_0x443a76[_0xbc52('0x60')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x1e5b55},'SmsQueueId':{'$in':_0x2c927f}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0xf02008=_0xbc52('0x61')+_0x425c79;return db[_0xbc52('0x54')][_0xbc52('0x2f')](_0xf02008,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')]['SELECT'],'raw':!![],'transaction':_0x19c7a3});})['then'](function(_0x1a3654){var _0x4c7441=_[_0xbc52('0x2a')](_0x1a3654,function(_0x4f7e03){return Number(_0x4f7e03[_0xbc52('0x62')]);});return db[_0xbc52('0x63')][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'ChatQueueId':{'$in':_0x4c7441}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0x470094='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x425c79;return db[_0xbc52('0x54')]['query'](_0x470094,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')][_0xbc52('0x59')],'raw':!![],'transaction':_0x19c7a3});})['then'](function(_0xf09b1e){var _0x4074e5=_[_0xbc52('0x2a')](_0xf09b1e,function(_0x3a0d49){return Number(_0x3a0d49[_0xbc52('0x64')]);});return db[_0xbc52('0x65')][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'FaxQueueId':{'$in':_0x4074e5}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0x4e428d='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x425c79;return db[_0xbc52('0x54')]['query'](_0x4e428d,{'type':db['Sequelize'][_0xbc52('0x5d')]['SELECT'],'raw':!![],'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(_0x488a83){var _0x16be19=_[_0xbc52('0x2a')](_0x488a83,function(_0x2e9e82){return Number(_0x2e9e82[_0xbc52('0x66')]);});return db['UserOpenchannelQueue'][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'OpenchannelQueueId':{'$in':_0x16be19}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0x5de829=_0xbc52('0x67')+_0x425c79;return db['sequelize'][_0xbc52('0x2f')](_0x5de829,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')][_0xbc52('0x59')],'raw':!![],'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(_0x1767fa){var _0xff3b06=_[_0xbc52('0x2a')](_0x1767fa,function(_0x2e2c67){return Number(_0x2e2c67['WhatsappQueueId']);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x1e5b55},'WhatsappQueueId':{'$in':_0xff3b06}},'transaction':_0x19c7a3});})['then'](function(){return db[_0xbc52('0x68')][_0xbc52('0x45')]({'where':{'TeamId':_0x425c79}});})['then'](function(_0x52d603){if(_0x52d603===null){return;}return db[_0xbc52('0x69')][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'VoicePrefixId':_0x52d603['VoicePrefixId']},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){return db[_0xbc52('0x2b')][_0xbc52('0x53')]({'where':{'id':_0x425c79},'cascade':!![],'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(_0x20397e){if(_0x20397e===0x0){_0x4a48d8['sendStatus'](0x194);}else{return db[_0xbc52('0x50')][_0xbc52('0x53')]({'where':{'type':_0xbc52('0x4c'),'resourceId':_0x425c79},'cascade':!![],'transaction':_0x19c7a3})['then'](function(){_0x4a48d8[_0xbc52('0x1c')](0xcc)[_0xbc52('0x6a')]();});}})[_0xbc52('0x40')](function(_0x7e2607){_0x4a48d8[_0xbc52('0x1c')](0x1f4)[_0xbc52('0x29')](_0x7e2607);});});};exports[_0xbc52('0x6b')]=function(_0x38ed68,_0x151977,_0x10f12f){return db[_0xbc52('0x2b')][_0xbc52('0x6c')]({'where':{'id':_0x38ed68[_0xbc52('0x42')]['id']}})['then'](handleEntityNotFound(_0x151977,null))[_0xbc52('0x26')](function(_0x361757){if(!_0x38ed68[_0xbc52('0x2f')]['channel']||!utils['isValidChannel'](_0x38ed68[_0xbc52('0x2f')][_0xbc52('0x6d')])){throw new db['Sequelize'][(_0xbc52('0x6e'))](_0xbc52('0x6f'));}var _0x27f8b2={};var _0x48f4b3={};_0x48f4b3[_0xbc52('0x2e')]=_[_0xbc52('0x30')](db[_[_0xbc52('0x70')](_0x38ed68[_0xbc52('0x2f')][_0xbc52('0x6d')]['toLowerCase']())+_0xbc52('0x71')]['rawAttributes']);_0x48f4b3[_0xbc52('0x2f')]=_['keys'](_0x38ed68[_0xbc52('0x2f')]);_0x48f4b3[_0xbc52('0x31')]=_[_0xbc52('0x32')](_0x48f4b3[_0xbc52('0x2e')],_0x48f4b3[_0xbc52('0x2f')]);_0x27f8b2[_0xbc52('0x33')]=_[_0xbc52('0x32')](_0x48f4b3[_0xbc52('0x2e')],qs[_0xbc52('0x44')](_0x38ed68['query'][_0xbc52('0x44')]));_0x27f8b2[_0xbc52('0x33')]=_0x27f8b2[_0xbc52('0x33')][_0xbc52('0x34')]?_0x27f8b2[_0xbc52('0x33')]:_0x48f4b3[_0xbc52('0x2e')];_0x27f8b2[_0xbc52('0x20')]=qs[_0xbc52('0x20')](_0x38ed68[_0xbc52('0x2f')][_0xbc52('0x20')]);_0x27f8b2[_0xbc52('0x1f')]=qs[_0xbc52('0x1f')](_0x38ed68[_0xbc52('0x2f')][_0xbc52('0x1f')]);_0x27f8b2['order']=qs[_0xbc52('0x37')](_0x38ed68[_0xbc52('0x2f')]['sort']);_0x27f8b2[_0xbc52('0x38')]=qs[_0xbc52('0x31')](_['pick'](_0x38ed68[_0xbc52('0x2f')],_0x48f4b3[_0xbc52('0x31')]));_0x27f8b2=_[_0xbc52('0x3b')]({},_0x27f8b2,_0x38ed68['options']);return _0x361757[_0xbc52('0x49')+_[_0xbc52('0x70')](_0x38ed68['query']['channel']['toLowerCase']())+_0xbc52('0x72')](_0x27f8b2);})['then'](respondWithResult(_0x151977,null))['catch'](handleError(_0x151977,null));};exports['addQueues']=function(_0x3e206d,_0xaab06,_0x3afef4){return db[_0xbc52('0x2b')][_0xbc52('0x6c')]({'where':{'id':_0x3e206d[_0xbc52('0x42')]['id']}})[_0xbc52('0x26')](function(_0xb9813b){if(_0xb9813b){if(!_0x3e206d[_0xbc52('0x47')][_0xbc52('0x6d')]||!utils[_0xbc52('0x73')](_0x3e206d[_0xbc52('0x47')][_0xbc52('0x6d')])){throw new db[(_0xbc52('0x56'))][(_0xbc52('0x6e'))](_0xbc52('0x6f'));}return _0xb9813b['add'+_[_0xbc52('0x70')](_0x3e206d[_0xbc52('0x47')]['channel'][_0xbc52('0x74')]())+_0xbc52('0x72')](_0x3e206d[_0xbc52('0x47')][_0xbc52('0x75')]);}return null;})[_0xbc52('0x26')](handleEntityNotFound(_0xaab06,null))[_0xbc52('0x26')](respondWithStatusCode(_0xaab06,null))[_0xbc52('0x40')](handleError(_0xaab06,null));};exports[_0xbc52('0x76')]=function(_0x56aee8,_0x10aec5,_0x5b50ce){return db[_0xbc52('0x2b')][_0xbc52('0x6c')]({'where':{'id':_0x56aee8[_0xbc52('0x42')]['id']}})[_0xbc52('0x26')](function(_0x1153d6){if(_0x1153d6){if(!_0x56aee8[_0xbc52('0x2f')]['channel']||!utils[_0xbc52('0x73')](_0x56aee8['query'][_0xbc52('0x6d')])){throw new db[(_0xbc52('0x56'))][(_0xbc52('0x6e'))](_0xbc52('0x6f'));}return _0x1153d6[_0xbc52('0x77')+_[_0xbc52('0x70')](_0x56aee8[_0xbc52('0x2f')][_0xbc52('0x6d')][_0xbc52('0x74')]())+_0xbc52('0x72')](_0x56aee8[_0xbc52('0x2f')][_0xbc52('0x75')]);}return null;})[_0xbc52('0x26')](handleEntityNotFound(_0x10aec5,null))[_0xbc52('0x26')](respondWithStatusCode(_0x10aec5,null))[_0xbc52('0x40')](handleError(_0x10aec5,null));};exports[_0xbc52('0x78')]=function(_0x1e4605,_0x1356cd){var _0x17309a=_[_0xbc52('0x79')](_0x1e4605[_0xbc52('0x47')][_0xbc52('0x75')])?_0x1e4605[_0xbc52('0x47')][_0xbc52('0x75')]:[_0x1e4605[_0xbc52('0x47')][_0xbc52('0x75')]];var _0x13b103=_0x1e4605[_0xbc52('0x42')]['id'];return db[_0xbc52('0x2b')][_0xbc52('0x45')]({'where':{'id':_0x13b103}})[_0xbc52('0x26')](handleEntityNotFound(_0x1356cd,null))['then'](function(_0x5d9afd){if(_0x5d9afd){var _0x290bf4=[_0xbc52('0x7a'),_0xbc52('0x7b'),_0xbc52('0x7c'),_0xbc52('0x7d'),_0xbc52('0x7e'),_0xbc52('0x7f'),'Whatsapp'];return db[_0xbc52('0x54')][_0xbc52('0x55')](function(_0x3f0ace){var _0x47f931=_[_0xbc52('0x2a')](_0x290bf4,function(_0x49c472){var _0x515d9b={'attributes':['id',_0xbc52('0x28')]};if(_0x49c472===_0xbc52('0x7a')){_0x515d9b[_0xbc52('0x80')]={'attributes':['penalty']};}return _0x5d9afd[_0xbc52('0x49')+_0x49c472+_0xbc52('0x72')](_0x515d9b)['then'](function(_0x4c9570){var _0x3a3900=_[_0xbc52('0x2a')](_0x4c9570,function(_0x298eca){var _0x42dedc=_['map'](_0x17309a,function(_0x16a9ff){var _0x36c9b1={'where':{'UserId':_0x16a9ff,[_0x49c472+_0xbc52('0x81')]:_0x298eca['id']},'transaction':_0x3f0ace};if(_0x49c472===_0xbc52('0x7a')){_0x36c9b1['defaults']={'penalty':_0x298eca[_0xbc52('0x82')]['penalty']};}return db[_0xbc52('0x83')+_0x49c472+_0xbc52('0x71')][_0xbc52('0x84')](_0x36c9b1)[_0xbc52('0x26')](function(){socket['emit']('user'+_0x49c472+'Queue:save',{'UserId':_0x16a9ff,[_0x49c472+_0xbc52('0x81')]:_0x298eca['id']});if(_0x49c472!==_0xbc52('0x7a')){return;}return db[_0xbc52('0x83')][_0xbc52('0x3f')]({'where':{'id':_0x17309a,'online':0x1},'attributes':['id',_0xbc52('0x28'),_0xbc52('0x85'),_0xbc52('0x86'),_0xbc52('0x87')],'raw':!![]})[_0xbc52('0x26')](function(_0x1ffe6a){var _0x13a6da=_['map'](_0x1ffe6a,function(_0x3d79bb){return db[_0xbc52('0x88')][_0xbc52('0x89')]({'membername':_0x3d79bb[_0xbc52('0x28')],'UserId':_0x3d79bb['id'],'queue_name':_0x298eca['name'],'VoiceQueueId':_0x298eca['id'],'interface':_[_0xbc52('0x8a')](_0x3d79bb['interface'])?util['format'](_0xbc52('0x8b'),_0x3d79bb[_0xbc52('0x28')]):_0x3d79bb['interface'],'paused':_0x3d79bb[_0xbc52('0x86')]||![],'penalty':_0x298eca[_0xbc52('0x82')]['penalty']},{'transaction':_0x3f0ace});});return Promise[_0xbc52('0x8c')](_0x13a6da);});});});return Promise[_0xbc52('0x8c')](_0x42dedc);});return Promise[_0xbc52('0x8c')](_0x3a3900);})[_0xbc52('0x26')](function(){return db['TeamVoicePrefix'][_0xbc52('0x6c')]({'where':{'teamId':_0x13b103}})[_0xbc52('0x26')](function(_0x4f3547){if(_0x4f3547){var _0x44c1ca=_[_0xbc52('0x2a')](_0x17309a,function(_0x31e83e){db['UserVoicePrefix'][_0xbc52('0x89')]({'UserId':_0x31e83e,'VoicePrefixId':_0x4f3547[_0xbc52('0x8d')]});});return Promise['all'](_0x44c1ca);}});});});return Promise['all'](_0x47f931)[_0xbc52('0x26')](function(){return _0x5d9afd[_0xbc52('0x78')](_0x17309a,{'transaction':_0x3f0ace})[_0xbc52('0x8e')](function(_0xb3614d){return _0xb3614d;});});});}})[_0xbc52('0x26')](respondWithResult(_0x1356cd,null))[_0xbc52('0x40')](handleError(_0x1356cd,null));};exports[_0xbc52('0x8f')]=function(_0x40a3c0,_0x148a6d){var _0x2f0ec5=_['isArray'](_0x40a3c0[_0xbc52('0x2f')]['ids'])?_0x40a3c0[_0xbc52('0x2f')]['ids']:[_0x40a3c0['query'][_0xbc52('0x75')]];var _0x1fbffa=_0x40a3c0[_0xbc52('0x42')]['id'];return db[_0xbc52('0x2b')][_0xbc52('0x45')]({'where':{'id':_0x1fbffa}})['then'](handleEntityNotFound(_0x148a6d,null))[_0xbc52('0x26')](function(_0x1df7ee){if(_0x1df7ee){var _0x44b0e4=[_0xbc52('0x7a'),_0xbc52('0x7b'),_0xbc52('0x7c'),'Sms',_0xbc52('0x7e'),_0xbc52('0x7f'),_0xbc52('0x90')];return db[_0xbc52('0x54')][_0xbc52('0x55')](function(_0x55ec95){var _0x28b85f=_[_0xbc52('0x2a')](_0x44b0e4,function(_0x105a98){var _0x1b2338={'attributes':['id',_0xbc52('0x28')]};return _0x1df7ee[_0xbc52('0x49')+_0x105a98+_0xbc52('0x72')](_0x1b2338)['then'](function(_0xce2154){var _0x489fef=_['map'](_0xce2154,function(_0x3e8c0a){return _0x3e8c0a[_0xbc52('0x8f')](_0x2f0ec5,{'transaction':_0x55ec95})[_0xbc52('0x26')](function(){var _0x1d4cd6=_[_0xbc52('0x2a')](_0x2f0ec5,function(_0x1bbf76){socket[_0xbc52('0x91')]('user'+_0x105a98+_0xbc52('0x92'),{'UserId':Number(_0x1bbf76),[_0x105a98+'QueueId']:_0x3e8c0a['id']});if(_0x105a98!==_0xbc52('0x7a')){return;}return db['UserVoiceQueueRt'][_0xbc52('0x53')]({'where':{'VoiceQueueId':_0x3e8c0a['id'],'UserId':_0x1bbf76},'transaction':_0x55ec95});});return Promise['all'](_0x1d4cd6);});});return Promise[_0xbc52('0x8c')](_0x489fef);});});return Promise[_0xbc52('0x8c')](_0x28b85f)[_0xbc52('0x26')](function(){return _0x1df7ee['removeAgents'](_0x2f0ec5,{'transaction':_0x55ec95});})[_0xbc52('0x26')](function(){return db[_0xbc52('0x68')][_0xbc52('0x6c')]({'where':{'teamId':_0x1fbffa}})[_0xbc52('0x26')](function(_0x4b46f2){if(_0x4b46f2){var _0x47b3f9=_[_0xbc52('0x2a')](_0x2f0ec5,function(_0x31807b){db[_0xbc52('0x69')]['destroy']({'where':{'UserId':_0x31807b,'VoicePrefixId':_0x4b46f2[_0xbc52('0x8d')]}});});return Promise[_0xbc52('0x8c')](_0x47b3f9);}});});});}})['then'](respondWithStatusCode(_0x148a6d,null))[_0xbc52('0x40')](handleError(_0x148a6d,null));};exports[_0xbc52('0x93')]=function(_0x3bc305,_0x48487f,_0x12e650){var _0x3bbfd5={};var _0x59dbe4={};var _0x1b5504;var _0x5eb8dd;return db[_0xbc52('0x2b')][_0xbc52('0x6c')]({'where':{'id':_0x3bc305['params']['id']}})['then'](handleEntityNotFound(_0x48487f,null))[_0xbc52('0x26')](function(_0x77449c){if(_0x77449c){_0x1b5504=_0x77449c;_0x59dbe4[_0xbc52('0x2e')]=_[_0xbc52('0x30')](db[_0xbc52('0x83')]['rawAttributes']);_0x59dbe4[_0xbc52('0x2f')]=_['keys'](_0x3bc305[_0xbc52('0x2f')]);_0x59dbe4[_0xbc52('0x31')]=_['intersection'](_0x59dbe4[_0xbc52('0x2e')],_0x59dbe4[_0xbc52('0x2f')]);_0x3bbfd5['attributes']=_['intersection'](_0x59dbe4[_0xbc52('0x2e')],qs[_0xbc52('0x44')](_0x3bc305[_0xbc52('0x2f')][_0xbc52('0x44')]));_0x3bbfd5[_0xbc52('0x33')]=_0x3bbfd5[_0xbc52('0x33')][_0xbc52('0x34')]?_0x3bbfd5[_0xbc52('0x33')]:_0x59dbe4[_0xbc52('0x2e')];_0x3bbfd5['order']=qs[_0xbc52('0x37')](_0x3bc305[_0xbc52('0x2f')][_0xbc52('0x37')]);_0x3bbfd5[_0xbc52('0x38')]=qs[_0xbc52('0x31')](_[_0xbc52('0x39')](_0x3bc305['query'],_0x59dbe4[_0xbc52('0x31')]));if(_0x3bc305[_0xbc52('0x2f')][_0xbc52('0x3a')]){_0x3bbfd5['where']=_[_0xbc52('0x3b')](_0x3bbfd5[_0xbc52('0x38')],{'$or':_[_0xbc52('0x2a')](_0x3bbfd5[_0xbc52('0x33')],function(_0x38fb72){var _0xf83fb5={};_0xf83fb5[_0x38fb72]={'$like':'%'+_0x3bc305[_0xbc52('0x2f')][_0xbc52('0x3a')]+'%'};return _0xf83fb5;})});}_0x3bbfd5=_[_0xbc52('0x3b')]({},_0x3bbfd5,_0x3bc305[_0xbc52('0x3c')]);return _0x1b5504[_0xbc52('0x93')](_0x3bbfd5);}})['then'](function(_0x19d429){if(_0x19d429){_0x5eb8dd=_0x19d429[_0xbc52('0x34')];if(!_0x3bc305['query'][_0xbc52('0x35')](_0xbc52('0x36'))){_0x3bbfd5[_0xbc52('0x20')]=qs['limit'](_0x3bc305['query'][_0xbc52('0x20')]);_0x3bbfd5['offset']=qs['offset'](_0x3bc305['query'][_0xbc52('0x1f')]);}return _0x1b5504['getAgents'](_0x3bbfd5);}})[_0xbc52('0x26')](function(_0x1ca7ff){if(_0x1ca7ff){return _0x1ca7ff?{'count':_0x5eb8dd,'rows':_0x1ca7ff}:null;}})[_0xbc52('0x26')](respondWithResult(_0x48487f,null))[_0xbc52('0x40')](handleError(_0x48487f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 019b08b..f4747ad 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 _0x169c=['emit','exports','events','Team','save','remove'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x169c,0xc8));var _0xc169=function(_0x2ffa17,_0x35b3a8){_0x2ffa17=_0x2ffa17-0x0;var _0x3a783b=_0x169c[_0x2ffa17];return _0x3a783b;};'use strict';var EventEmitter=require(_0xc169('0x0'));var Team=require('../../mysqldb')['db'][_0xc169('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc169('0x2'),'afterUpdate':'update','afterDestroy':_0xc169('0x3')};function emitEvent(_0x20db05){return function(_0x128074,_0x32ffce,_0x45b47a){TeamEvents['emit'](_0x20db05+':'+_0x128074['id'],_0x128074);TeamEvents[_0xc169('0x4')](_0x20db05,_0x128074);_0x45b47a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xc169('0x5')]=TeamEvents; \ No newline at end of file +var _0xbc34=['update','remove','emit','hasOwnProperty','hook','events','Team','setMaxListeners','save'];(function(_0x4ed752,_0x1c4eee){var _0x55331d=function(_0x33b72b){while(--_0x33b72b){_0x4ed752['push'](_0x4ed752['shift']());}};_0x55331d(++_0x1c4eee);}(_0xbc34,0x1a3));var _0x4bc3=function(_0x47e20a,_0xa604f6){_0x47e20a=_0x47e20a-0x0;var _0x1bdde9=_0xbc34[_0x47e20a];return _0x1bdde9;};'use strict';var EventEmitter=require(_0x4bc3('0x0'));var Team=require('../../mysqldb')['db'][_0x4bc3('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x4bc3('0x2')](0x0);var events={'afterCreate':_0x4bc3('0x3'),'afterUpdate':_0x4bc3('0x4'),'afterDestroy':_0x4bc3('0x5')};function emitEvent(_0x1f2305){return function(_0x48293f,_0x50483d,_0x4bba0e){TeamEvents[_0x4bc3('0x6')](_0x1f2305+':'+_0x48293f['id'],_0x48293f);TeamEvents[_0x4bc3('0x6')](_0x1f2305,_0x48293f);_0x4bba0e(null);};}for(var e in events){if(events[_0x4bc3('0x7')](e)){var event=events[e];Team[_0x4bc3('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 97657bc..1491c91 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 _0xacdf=['Queues','then','map','setDataValue','channel','define','Team','teams','Mail','Openchannel','Sms','Whatsapp','resolve','all','lodash','./team.attributes','get'];(function(_0x5de056,_0x55b169){var _0x13d19e=function(_0x6e3cdf){while(--_0x6e3cdf){_0x5de056['push'](_0x5de056['shift']());}};_0x13d19e(++_0x55b169);}(_0xacdf,0x74));var _0xfacd=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xacdf[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xfacd('0x0'));var attributes=require(_0xfacd('0x1'));function getQueuesByChannel(_0x3c4157,_0x5ef6a2){var _0x48a8d8=_0xfacd('0x2')+_0x5ef6a2+_0xfacd('0x3');return _0x3c4157[_0x48a8d8]()[_0xfacd('0x4')](function(_0x4022f3){return _[_0xfacd('0x5')](_0x4022f3,function(_0x526d5c){_0x526d5c[_0xfacd('0x6')](_0xfacd('0x7'),_0x5ef6a2);return _0x526d5c;});})['catch'](function(_0x16ad95){throw _0x16ad95;});}module['exports']=function(_0x4277d8){return _0x4277d8[_0xfacd('0x8')](_0xfacd('0x9'),attributes,{'tableName':_0xfacd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x77f178=this;var _0x5b81d7=['Chat','Fax',_0xfacd('0xb'),_0xfacd('0xc'),_0xfacd('0xd'),'Voice',_0xfacd('0xe')];return Promise[_0xfacd('0xf')]()[_0xfacd('0x4')](function(){var _0x2c9130=_[_0xfacd('0x5')](_0x5b81d7,function(_0x3cab18){return getQueuesByChannel(_0x77f178,_0x3cab18);});return Promise[_0xfacd('0x10')](_0x2c9130);})['catch'](function(_0x1e5157){throw _0x1e5157;});}}});}; \ No newline at end of file +var _0xdb75=['exports','define','Team','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel'];(function(_0x3b500a,_0xbbeb08){var _0x230eda=function(_0xc6e2d){while(--_0xc6e2d){_0x3b500a['push'](_0x3b500a['shift']());}};_0x230eda(++_0xbbeb08);}(_0xdb75,0xb6));var _0x5db7=function(_0x57fcc0,_0x585004){_0x57fcc0=_0x57fcc0-0x0;var _0x5270df=_0xdb75[_0x57fcc0];return _0x5270df;};'use strict';var _=require(_0x5db7('0x0'));var attributes=require(_0x5db7('0x1'));function getQueuesByChannel(_0x4d258f,_0x33ad11){var _0x3c62f8=_0x5db7('0x2')+_0x33ad11+_0x5db7('0x3');return _0x4d258f[_0x3c62f8]()[_0x5db7('0x4')](function(_0x21d988){return _[_0x5db7('0x5')](_0x21d988,function(_0x59b9df){_0x59b9df[_0x5db7('0x6')](_0x5db7('0x7'),_0x33ad11);return _0x59b9df;});})['catch'](function(_0x47c51b){throw _0x47c51b;});}module[_0x5db7('0x8')]=function(_0x41683e){return _0x41683e[_0x5db7('0x9')](_0x5db7('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x24ff89=this;var _0x456066=[_0x5db7('0xb'),_0x5db7('0xc'),_0x5db7('0xd'),_0x5db7('0xe'),_0x5db7('0xf'),_0x5db7('0x10'),'Whatsapp'];return Promise[_0x5db7('0x11')]()[_0x5db7('0x4')](function(){var _0x337ae7=_[_0x5db7('0x5')](_0x456066,function(_0x3caf1b){return getQueuesByChannel(_0x24ff89,_0x3caf1b);});return Promise[_0x5db7('0x12')](_0x337ae7);})['catch'](function(_0x520b32){throw _0x520b32;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 920cc0d..2008e3f 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 _0x3cf6=['Team,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','defaults','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d7bb2,_0x1be16d){var _0x290b86=function(_0x5f1fb2){while(--_0x5f1fb2){_0x4d7bb2['push'](_0x4d7bb2['shift']());}};_0x290b86(++_0x1be16d);}(_0x3cf6,0x186));var _0x63cf=function(_0x3a31c3,_0x4b2e4d){_0x3a31c3=_0x3a31c3-0x0;var _0x1ec91b=_0x3cf6[_0x3a31c3];return _0x1ec91b;};'use strict';var _=require(_0x63cf('0x0'));var util=require(_0x63cf('0x1'));var moment=require('moment');var BPromise=require(_0x63cf('0x2'));var rs=require(_0x63cf('0x3'));var fs=require('fs');var Redis=require(_0x63cf('0x4'));var db=require(_0x63cf('0x5'))['db'];var utils=require(_0x63cf('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x63cf('0x7'));var jayson=require(_0x63cf('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x63cf('0x9')]=_[_0x63cf('0xa')](config[_0x63cf('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x63cf('0x9')]));require(_0x63cf('0xb'))[_0x63cf('0xc')](socket);function respondWithRpcPromise(_0x2d9466,_0x3c7e9e,_0x4efb48){return new BPromise(function(_0x1782cf,_0x526c38){return client[_0x63cf('0xd')](_0x2d9466,_0x4efb48)['then'](function(_0x3c72b8){logger[_0x63cf('0xe')](_0x63cf('0xf'),_0x3c7e9e,_0x63cf('0x10'));logger[_0x63cf('0x11')](_0x63cf('0x12'),_0x3c7e9e,'request\x20sent',JSON['stringify'](_0x3c72b8));if(_0x3c72b8['error']){if(_0x3c72b8['error'][_0x63cf('0x13')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x3c7e9e,_0x3c72b8[_0x63cf('0x14')][_0x63cf('0x15')]);return _0x526c38(_0x3c72b8[_0x63cf('0x14')][_0x63cf('0x15')]);}logger[_0x63cf('0x14')](_0x63cf('0xf'),_0x3c7e9e,_0x3c72b8[_0x63cf('0x14')][_0x63cf('0x15')]);return _0x1782cf(_0x3c72b8[_0x63cf('0x14')]['message']);}else{logger[_0x63cf('0xe')](_0x63cf('0xf'),_0x3c7e9e,_0x63cf('0x10'));_0x1782cf(_0x3c72b8[_0x63cf('0x16')][_0x63cf('0x15')]);}})[_0x63cf('0x17')](function(_0x23df25){logger[_0x63cf('0x14')](_0x63cf('0xf'),_0x3c7e9e,_0x23df25);_0x526c38(_0x23df25);});});} \ No newline at end of file +var _0x8d7c=['error','code','Team,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0x8d7c,0x17f));var _0xc8d7=function(_0x40c525,_0x57d8fc){_0x40c525=_0x40c525-0x0;var _0x1e7b68=_0x8d7c[_0x40c525];return _0x1e7b68;};'use strict';var _=require(_0xc8d7('0x0'));var util=require(_0xc8d7('0x1'));var moment=require(_0xc8d7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8d7('0x3'))['db'];var utils=require(_0xc8d7('0x4'));var logger=require('../../config/logger')(_0xc8d7('0x5'));var config=require(_0xc8d7('0x6'));var jayson=require(_0xc8d7('0x7'));var client=jayson[_0xc8d7('0x8')][_0xc8d7('0x9')]({'port':0x232a});config[_0xc8d7('0xa')]=_[_0xc8d7('0xb')](config[_0xc8d7('0xa')],{'host':_0xc8d7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc8d7('0xd'))[_0xc8d7('0xe')](socket);function respondWithRpcPromise(_0x3a73e4,_0x4256e1,_0xa99b62){return new BPromise(function(_0x52b168,_0x5959a4){return client[_0xc8d7('0xf')](_0x3a73e4,_0xa99b62)[_0xc8d7('0x10')](function(_0x3df194){logger[_0xc8d7('0x11')]('Team,\x20%s,\x20%s',_0x4256e1,_0xc8d7('0x12'));logger[_0xc8d7('0x13')](_0xc8d7('0x14'),_0x4256e1,'request\x20sent',JSON[_0xc8d7('0x15')](_0x3df194));if(_0x3df194[_0xc8d7('0x16')]){if(_0x3df194[_0xc8d7('0x16')][_0xc8d7('0x17')]===0x1f4){logger[_0xc8d7('0x16')](_0xc8d7('0x18'),_0x4256e1,_0x3df194['error'][_0xc8d7('0x19')]);return _0x5959a4(_0x3df194['error']['message']);}logger[_0xc8d7('0x16')](_0xc8d7('0x18'),_0x4256e1,_0x3df194[_0xc8d7('0x16')]['message']);return _0x52b168(_0x3df194['error'][_0xc8d7('0x19')]);}else{logger[_0xc8d7('0x11')](_0xc8d7('0x18'),_0x4256e1,_0xc8d7('0x12'));_0x52b168(_0x3df194['result'][_0xc8d7('0x19')]);}})[_0xc8d7('0x1a')](function(_0x4bd674){logger['error'](_0xc8d7('0x18'),_0x4256e1,_0x4bd674);_0x5959a4(_0x4bd674);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 72e164f..aa66e54 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 _0xdb06=['save','remove','emit','removeListener','./team.events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdb06,0x194));var _0x6db0=function(_0x5b5404,_0x1a5784){_0x5b5404=_0x5b5404-0x0;var _0x14a27f=_0xdb06[_0x5b5404];return _0x14a27f;};'use strict';var TeamEvents=require(_0x6db0('0x0'));var events=[_0x6db0('0x1'),_0x6db0('0x2'),'update'];function createListener(_0x1e037e,_0x32d489){return function(_0x368f63){_0x32d489[_0x6db0('0x3')](_0x1e037e,_0x368f63);};}function removeListener(_0x493037,_0x2bcac9){return function(){TeamEvents[_0x6db0('0x4')](_0x493037,_0x2bcac9);};}exports['register']=function(_0x461aa7){for(var _0x1db4cc=0x0,_0x53af74=events['length'];_0x1db4cc<_0x53af74;_0x1db4cc++){var _0x3f76fe=events[_0x1db4cc];var _0x397fc6=createListener('team:'+_0x3f76fe,_0x461aa7);TeamEvents['on'](_0x3f76fe,_0x397fc6);}}; \ No newline at end of file +var _0xc1cd=['register','length','team:','./team.events','save','remove','update'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xc1cd,0x1e6));var _0xdc1c=function(_0x15a84b,_0x117f12){_0x15a84b=_0x15a84b-0x0;var _0x330b3a=_0xc1cd[_0x15a84b];return _0x330b3a;};'use strict';var TeamEvents=require(_0xdc1c('0x0'));var events=[_0xdc1c('0x1'),_0xdc1c('0x2'),_0xdc1c('0x3')];function createListener(_0x4e5e1c,_0x3ba32d){return function(_0x27a796){_0x3ba32d['emit'](_0x4e5e1c,_0x27a796);};}function removeListener(_0x2e8025,_0x5cc809){return function(){TeamEvents['removeListener'](_0x2e8025,_0x5cc809);};}exports[_0xdc1c('0x4')]=function(_0x230aa){for(var _0x2b3f05=0x0,_0x2d2e67=events[_0xdc1c('0x5')];_0x2b3f05<_0x2d2e67;_0x2b3f05++){var _0x54c204=events[_0x2b3f05];var _0x459fa2=createListener(_0xdc1c('0x6')+_0x54c204,_0x230aa);TeamEvents['on'](_0x54c204,_0x459fa2);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 76405b1..06b6752 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 _0x2504=['INTEGER','sequelize','exports'];(function(_0x218da2,_0x329e35){var _0x26dbc8=function(_0x5b1bae){while(--_0x5b1bae){_0x218da2['push'](_0x218da2['shift']());}};_0x26dbc8(++_0x329e35);}(_0x2504,0xee));var _0x4250=function(_0x502262,_0x3c5d68){_0x502262=_0x502262-0x0;var _0x302121=_0x2504[_0x502262];return _0x302121;};'use strict';var Sequelize=require(_0x4250('0x0'));module[_0x4250('0x1')]={'TeamId':{'type':Sequelize[_0x4250('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4250('0x2')]}}; \ No newline at end of file +var _0xe3ed=['sequelize','exports','INTEGER'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xe3ed,0x8d));var _0xde3e=function(_0x1d99f0,_0x21d9d6){_0x1d99f0=_0x1d99f0-0x0;var _0x294825=_0xe3ed[_0x1d99f0];return _0x294825;};'use strict';var Sequelize=require(_0xde3e('0x0'));module[_0xde3e('0x1')]={'TeamId':{'type':Sequelize[_0xde3e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xde3e('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 484415f..e670b7d 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 _0xc06d=['bluebird','request-promise','../../config/environment','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x224e3a,_0x54e22a){var _0x4f70db=function(_0x476fb1){while(--_0x476fb1){_0x224e3a['push'](_0x224e3a['shift']());}};_0x4f70db(++_0x54e22a);}(_0xc06d,0x15a));var _0xdc06=function(_0x435fb1,_0x40495d){_0x435fb1=_0x435fb1-0x0;var _0x176745=_0xc06d[_0x435fb1];return _0x176745;};'use strict';var _=require(_0xdc06('0x0'));var util=require(_0xdc06('0x1'));var logger=require(_0xdc06('0x2'))(_0xdc06('0x3'));var moment=require('moment');var BPromise=require(_0xdc06('0x4'));var rp=require(_0xdc06('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdc06('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0xdc06('0x7')]=function(_0x2f7692,_0x5ce60c){return _0x2f7692['define'](_0xdc06('0x8'),attributes,{'tableName':_0xdc06('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3d4=['api','bluebird','request-promise','rimraf','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util','../../config/logger'];(function(_0x30ca74,_0x22f37b){var _0x106abe=function(_0x39c16b){while(--_0x39c16b){_0x30ca74['push'](_0x30ca74['shift']());}};_0x106abe(++_0x22f37b);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x3e8f4d,_0x2973ed){_0x3e8f4d=_0x3e8f4d-0x0;var _0x590a2e=_0xe3d4[_0x3e8f4d];return _0x590a2e;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require('moment');var BPromise=require(_0x4e3d('0x3'));var rp=require(_0x4e3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e3d('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e3d('0x6'));module[_0x4e3d('0x7')]=function(_0x4fd5ff,_0x3eaf60){return _0x4fd5ff[_0x4e3d('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x4e3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index da32152..0c96c67 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2db874,_0x404703){var _0x2ffd16=function(_0x4c8d50){while(--_0x4c8d50){_0x2db874['push'](_0x2db874['shift']());}};_0x2ffd16(++_0x404703);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0xcb91[_0x31c19c];return _0x1a87f7;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3f3ae8,_0x3f1861){var _0x12ba6=function(_0x3b90cd){while(--_0x3b90cd){_0x3f3ae8['push'](_0x3f3ae8['shift']());}};_0x12ba6(++_0x3f1861);}(_0xedd9,0xfc));var _0x9edd=function(_0x1aaf4b,_0x363c33){_0x1aaf4b=_0x1aaf4b-0x0;var _0x4d0ef1=_0xedd9[_0x1aaf4b];return _0x4d0ef1;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 2771cbb..3236451 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 _0xeccb=['exports','INTEGER'];(function(_0x2ee5ba,_0xab5c09){var _0x21e0f3=function(_0x39d0cf){while(--_0x39d0cf){_0x2ee5ba['push'](_0x2ee5ba['shift']());}};_0x21e0f3(++_0xab5c09);}(_0xeccb,0x76));var _0xbecc=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xeccb[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require('sequelize');module[_0xbecc('0x0')]={'penalty':{'type':Sequelize[_0xbecc('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5e69=['INTEGER','sequelize'];(function(_0x1b4057,_0x58212a){var _0x1d749a=function(_0x1fa30b){while(--_0x1fa30b){_0x1b4057['push'](_0x1b4057['shift']());}};_0x1d749a(++_0x58212a);}(_0x5e69,0x185));var _0x95e6=function(_0x4a363f,_0x36480a){_0x4a363f=_0x4a363f-0x0;var _0x391de0=_0x5e69[_0x4a363f];return _0x391de0;};'use strict';var Sequelize=require(_0x95e6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x95e6('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 4672fca..f80e9f3 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 _0x9ef8=['define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x2d16fe,_0x237147){var _0x40840b=function(_0x158c44){while(--_0x158c44){_0x2d16fe['push'](_0x2d16fe['shift']());}};_0x40840b(++_0x237147);}(_0x9ef8,0x17f));var _0x89ef=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0x9ef8[_0xe30e17];return _0x2342c9;};'use strict';var _=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var logger=require('../../config/logger')(_0x89ef('0x2'));var moment=require(_0x89ef('0x3'));var BPromise=require(_0x89ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89ef('0x5'));var rimraf=require(_0x89ef('0x6'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x383019,_0x2e117e){return _0x383019[_0x89ef('0x7')](_0x89ef('0x8'),attributes,{'tableName':_0x89ef('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d53=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x47b0d9,_0x41b561){var _0x599df3=function(_0x4c0c30){while(--_0x4c0c30){_0x47b0d9['push'](_0x47b0d9['shift']());}};_0x599df3(++_0x41b561);}(_0x8d53,0x1c2));var _0x38d5=function(_0x588d6c,_0x7189cf){_0x588d6c=_0x588d6c-0x0;var _0x616ba7=_0x8d53[_0x588d6c];return _0x616ba7;};'use strict';var _=require(_0x38d5('0x0'));var util=require(_0x38d5('0x1'));var logger=require('../../config/logger')(_0x38d5('0x2'));var moment=require(_0x38d5('0x3'));var BPromise=require(_0x38d5('0x4'));var rp=require(_0x38d5('0x5'));var fs=require('fs');var path=require(_0x38d5('0x6'));var rimraf=require(_0x38d5('0x7'));var config=require(_0x38d5('0x8'));var attributes=require(_0x38d5('0x9'));module['exports']=function(_0x31ccc0,_0x5c6cc6){return _0x31ccc0[_0x38d5('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x38d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index c93c3af..50f2d53 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 _0xd605=['request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3ab2d4,_0x203181){var _0x222a94=function(_0x55975e){while(--_0x55975e){_0x3ab2d4['push'](_0x3ab2d4['shift']());}};_0x222a94(++_0x203181);}(_0xd605,0x1c1));var _0x5d60=function(_0xb6c38c,_0x3fc6c4){_0xb6c38c=_0xb6c38c-0x0;var _0x661192=_0xd605[_0xb6c38c];return _0x661192;};'use strict';var _=require(_0x5d60('0x0'));var util=require('util');var moment=require(_0x5d60('0x1'));var BPromise=require(_0x5d60('0x2'));var rs=require(_0x5d60('0x3'));var fs=require('fs');var Redis=require(_0x5d60('0x4'));var db=require(_0x5d60('0x5'))['db'];var utils=require(_0x5d60('0x6'));var logger=require(_0x5d60('0x7'))(_0x5d60('0x8'));var config=require(_0x5d60('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5d60('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13c408,_0x53752f,_0x5a7df1){return new BPromise(function(_0x2f8a09,_0x357340){return client[_0x5d60('0xb')](_0x13c408,_0x5a7df1)[_0x5d60('0xc')](function(_0x2566a5){logger[_0x5d60('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x53752f,_0x5d60('0xe'));logger[_0x5d60('0xf')](_0x5d60('0x10'),_0x53752f,_0x5d60('0xe'),JSON['stringify'](_0x2566a5));if(_0x2566a5[_0x5d60('0x11')]){if(_0x2566a5[_0x5d60('0x11')][_0x5d60('0x12')]===0x1f4){logger[_0x5d60('0x11')](_0x5d60('0x13'),_0x53752f,_0x2566a5[_0x5d60('0x11')]['message']);return _0x357340(_0x2566a5[_0x5d60('0x11')][_0x5d60('0x14')]);}logger['error'](_0x5d60('0x13'),_0x53752f,_0x2566a5[_0x5d60('0x11')][_0x5d60('0x14')]);return _0x2f8a09(_0x2566a5['error'][_0x5d60('0x14')]);}else{logger[_0x5d60('0xd')](_0x5d60('0x13'),_0x53752f,'request\x20sent');_0x2f8a09(_0x2566a5[_0x5d60('0x15')][_0x5d60('0x14')]);}})[_0x5d60('0x16')](function(_0x7f68d9){logger[_0x5d60('0x11')](_0x5d60('0x13'),_0x53752f,_0x7f68d9);_0x357340(_0x7f68d9);});});} \ No newline at end of file +var _0x6ff5=['then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x580a58,_0x55cbf6){var _0x11ed0b=function(_0x5a05c3){while(--_0x5a05c3){_0x580a58['push'](_0x580a58['shift']());}};_0x11ed0b(++_0x55cbf6);}(_0x6ff5,0xab));var _0x56ff=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x6ff5[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x56ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56ff('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56ff('0x2'))['db'];var utils=require(_0x56ff('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x56ff('0x4'));var jayson=require(_0x56ff('0x5'));var client=jayson[_0x56ff('0x6')][_0x56ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f7c30,_0x308195,_0x2fbf8d){return new BPromise(function(_0x4183ab,_0x36c4e0){return client[_0x56ff('0x8')](_0x1f7c30,_0x2fbf8d)[_0x56ff('0x9')](function(_0x3dab53){logger[_0x56ff('0xa')](_0x56ff('0xb'),_0x308195,_0x56ff('0xc'));logger[_0x56ff('0xd')](_0x56ff('0xe'),_0x308195,_0x56ff('0xc'),JSON[_0x56ff('0xf')](_0x3dab53));if(_0x3dab53[_0x56ff('0x10')]){if(_0x3dab53[_0x56ff('0x10')][_0x56ff('0x11')]===0x1f4){logger[_0x56ff('0x10')](_0x56ff('0xb'),_0x308195,_0x3dab53[_0x56ff('0x10')][_0x56ff('0x12')]);return _0x36c4e0(_0x3dab53[_0x56ff('0x10')][_0x56ff('0x12')]);}logger[_0x56ff('0x10')](_0x56ff('0xb'),_0x308195,_0x3dab53[_0x56ff('0x10')][_0x56ff('0x12')]);return _0x4183ab(_0x3dab53[_0x56ff('0x10')]['message']);}else{logger[_0x56ff('0xa')](_0x56ff('0xb'),_0x308195,_0x56ff('0xc'));_0x4183ab(_0x3dab53[_0x56ff('0x13')][_0x56ff('0x12')]);}})['catch'](function(_0x59c1f5){logger[_0x56ff('0x10')](_0x56ff('0xb'),_0x308195,_0x59c1f5);_0x36c4e0(_0x59c1f5);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c894800..c71b098 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 _0x2250=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x171eb0,_0x802d36){var _0x3e82fb=function(_0x10b7f1){while(--_0x10b7f1){_0x171eb0['push'](_0x171eb0['shift']());}};_0x3e82fb(++_0x802d36);}(_0x2250,0x178));var _0x0225=function(_0x46a50c,_0x3a7f4a){_0x46a50c=_0x46a50c-0x0;var _0x4274db=_0x2250[_0x46a50c];return _0x4274db;};'use strict';var multer=require(_0x0225('0x0'));var util=require(_0x0225('0x1'));var path=require(_0x0225('0x2'));var timeout=require(_0x0225('0x3'));var express=require(_0x0225('0x4'));var router=express[_0x0225('0x5')]();var fs_extra=require(_0x0225('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0225('0x7'));var config=require(_0x0225('0x8'));var controller=require(_0x0225('0x9'));router[_0x0225('0xa')]('/',auth[_0x0225('0xb')](),controller[_0x0225('0xc')]);router[_0x0225('0xa')](_0x0225('0xd'),auth['isAuthenticated'](),controller[_0x0225('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0225('0xf')]);router[_0x0225('0x10')](_0x0225('0xd'),auth[_0x0225('0xb')](),controller[_0x0225('0x11')]);router['delete'](_0x0225('0xd'),auth[_0x0225('0xb')](),controller[_0x0225('0x12')]);module[_0x0225('0x13')]=router; \ No newline at end of file +var _0x2ef3=['show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','get','/:id','isAuthenticated'];(function(_0x1f4517,_0x282333){var _0x5915e1=function(_0x8eafd2){while(--_0x8eafd2){_0x1f4517['push'](_0x1f4517['shift']());}};_0x5915e1(++_0x282333);}(_0x2ef3,0xba));var _0x32ef=function(_0x142940,_0x4d7ee8){_0x142940=_0x142940-0x0;var _0x455ec7=_0x2ef3[_0x142940];return _0x455ec7;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0xd')]('/',auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller['update']);router['delete'](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e270971..70fa48b 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 _0xafae=['STRING','TEXT','sequelize','exports'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0xafae,0x17e));var _0xeafa=function(_0x42e675,_0x4f24ef){_0x42e675=_0x42e675-0x0;var _0x1e18b9=_0xafae[_0x42e675];return _0x1e18b9;};'use strict';var Sequelize=require(_0xeafa('0x0'));module[_0xeafa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeafa('0x2')]},'html':{'type':Sequelize[_0xeafa('0x3')]}}; \ No newline at end of file +var _0x6930=['STRING','TEXT'];(function(_0x24f999,_0x1077ba){var _0x1119f4=function(_0x37dd8b){while(--_0x37dd8b){_0x24f999['push'](_0x24f999['shift']());}};_0x1119f4(++_0x1077ba);}(_0x6930,0xda));var _0x0693=function(_0x856d37,_0x4786db){_0x856d37=_0x856d37-0x0;var _0xf90737=_0x6930[_0x856d37];return _0xf90737;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0693('0x0')]},'html':{'type':Sequelize[_0x0693('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index da9d8f6..9fa9492 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 _0xfe75=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','Templates','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Template','includeAll','include','findAll','catch','show','create','body','user'];(function(_0x63d33c,_0x49a376){var _0x198d15=function(_0x446e0e){while(--_0x446e0e){_0x63d33c['push'](_0x63d33c['shift']());}};_0x198d15(++_0x49a376);}(_0xfe75,0x10a));var _0x5fe7=function(_0x1493d4,_0x7f1431){_0x1493d4=_0x1493d4-0x0;var _0x1b3955=_0xfe75[_0x1493d4];return _0x1b3955;};'use strict';var emlformat=require(_0x5fe7('0x0'));var rimraf=require(_0x5fe7('0x1'));var zipdir=require(_0x5fe7('0x2'));var jsonpatch=require(_0x5fe7('0x3'));var rp=require(_0x5fe7('0x4'));var moment=require('moment');var BPromise=require(_0x5fe7('0x5'));var Mustache=require(_0x5fe7('0x6'));var util=require(_0x5fe7('0x7'));var path=require('path');var sox=require(_0x5fe7('0x8'));var csv=require(_0x5fe7('0x9'));var ejs=require(_0x5fe7('0xa'));var fs=require('fs');var fs_extra=require(_0x5fe7('0xb'));var _=require(_0x5fe7('0xc'));var squel=require(_0x5fe7('0xd'));var crypto=require(_0x5fe7('0xe'));var jsforce=require(_0x5fe7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5fe7('0x9'));var querystring=require(_0x5fe7('0x10'));var Papa=require(_0x5fe7('0x11'));var Redis=require(_0x5fe7('0x12'));var authService=require(_0x5fe7('0x13'));var qs=require(_0x5fe7('0x14'));var as=require(_0x5fe7('0x15'));var hardwareService=require(_0x5fe7('0x16'));var logger=require(_0x5fe7('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x5fe7('0x18'));var licenseUtil=require(_0x5fe7('0x19'));var db=require(_0x5fe7('0x1a'))['db'];function respondWithStatusCode(_0x345f2c,_0xfef9d6){_0xfef9d6=_0xfef9d6||0xcc;return function(_0x995785){if(_0x995785){return _0x345f2c[_0x5fe7('0x1b')](_0xfef9d6);}return _0x345f2c[_0x5fe7('0x1c')](_0xfef9d6)[_0x5fe7('0x1d')]();};}function respondWithResult(_0x77f39d,_0x19e716){_0x19e716=_0x19e716||0xc8;return function(_0x299d89){if(_0x299d89){return _0x77f39d['status'](_0x19e716)[_0x5fe7('0x1e')](_0x299d89);}};}function respondWithFilteredResult(_0x126b2a,_0x551ce1){return function(_0x199fb7){if(_0x199fb7){var _0x4c751e=typeof _0x551ce1[_0x5fe7('0x1f')]===_0x5fe7('0x20')&&typeof _0x551ce1[_0x5fe7('0x21')]===_0x5fe7('0x20');var _0x3192eb=_0x199fb7[_0x5fe7('0x22')];var _0x4d1950=_0x4c751e?0x0:_0x551ce1[_0x5fe7('0x1f')];var _0x38511a=_0x4c751e?_0x199fb7[_0x5fe7('0x22')]:_0x551ce1[_0x5fe7('0x1f')]+_0x551ce1[_0x5fe7('0x21')];var _0x269b1c;if(_0x38511a>=_0x3192eb){_0x38511a=_0x3192eb;_0x269b1c=0xc8;}else{_0x269b1c=0xce;}_0x126b2a[_0x5fe7('0x1c')](_0x269b1c);return _0x126b2a[_0x5fe7('0x23')](_0x5fe7('0x24'),_0x4d1950+'-'+_0x38511a+'/'+_0x3192eb)[_0x5fe7('0x1e')](_0x199fb7);}return null;};}function patchUpdates(_0x5c7ca7){return function(_0x13ed6d){try{jsonpatch['apply'](_0x13ed6d,_0x5c7ca7,!![]);}catch(_0x62e787){return BPromise[_0x5fe7('0x25')](_0x62e787);}return _0x13ed6d['save']();};}function saveUpdates(_0x1ab7f,_0x4e65c5){return function(_0x553042){if(_0x553042){return _0x553042['update'](_0x1ab7f)['then'](function(_0x372a84){return _0x372a84;});}return null;};}function removeEntity(_0x185404,_0x208342){return function(_0x2dcf40){if(_0x2dcf40){return _0x2dcf40[_0x5fe7('0x26')]()[_0x5fe7('0x27')](function(){var _0x404279=_0x2dcf40['get']({'plain':!![]});var _0x22b2b6=_0x5fe7('0x28');return db[_0x5fe7('0x29')][_0x5fe7('0x26')]({'where':{'type':_0x22b2b6,'resourceId':_0x404279['id']}})[_0x5fe7('0x27')](function(){return _0x2dcf40;});})[_0x5fe7('0x27')](function(){_0x185404[_0x5fe7('0x1c')](0xcc)[_0x5fe7('0x1d')]();});}};}function handleEntityNotFound(_0x956d66,_0x25747b){return function(_0x3de30f){if(!_0x3de30f){_0x956d66[_0x5fe7('0x1b')](0x194);}return _0x3de30f;};}function handleError(_0x48bffc,_0x5c8580){_0x5c8580=_0x5c8580||0x1f4;return function(_0x259c93){logger[_0x5fe7('0x2a')](_0x259c93[_0x5fe7('0x2b')]);if(_0x259c93['name']){delete _0x259c93[_0x5fe7('0x2c')];}_0x48bffc[_0x5fe7('0x1c')](_0x5c8580)[_0x5fe7('0x2d')](_0x259c93);};}exports[_0x5fe7('0x2e')]=function(_0x22ec2e,_0x50a7fa){var _0x482c04={},_0x1dc2c3={},_0x3a30ef={'count':0x0,'rows':[]};var _0x59bbd7=_['map'](db['Template'][_0x5fe7('0x2f')],function(_0x54567d){return{'name':_0x54567d[_0x5fe7('0x30')],'type':_0x54567d['type'][_0x5fe7('0x31')]};});_0x1dc2c3[_0x5fe7('0x32')]=_[_0x5fe7('0x33')](_0x59bbd7,_0x5fe7('0x2c'));_0x1dc2c3[_0x5fe7('0x34')]=_[_0x5fe7('0x35')](_0x22ec2e['query']);_0x1dc2c3[_0x5fe7('0x36')]=_['intersection'](_0x1dc2c3['model'],_0x1dc2c3[_0x5fe7('0x34')]);_0x482c04[_0x5fe7('0x37')]=_[_0x5fe7('0x38')](_0x1dc2c3[_0x5fe7('0x32')],qs[_0x5fe7('0x39')](_0x22ec2e['query'][_0x5fe7('0x39')]));_0x482c04[_0x5fe7('0x37')]=_0x482c04[_0x5fe7('0x37')][_0x5fe7('0x3a')]?_0x482c04[_0x5fe7('0x37')]:_0x1dc2c3[_0x5fe7('0x32')];if(!_0x22ec2e[_0x5fe7('0x34')]['hasOwnProperty'](_0x5fe7('0x3b'))){_0x482c04[_0x5fe7('0x21')]=qs[_0x5fe7('0x21')](_0x22ec2e['query'][_0x5fe7('0x21')]);_0x482c04[_0x5fe7('0x1f')]=qs['offset'](_0x22ec2e[_0x5fe7('0x34')][_0x5fe7('0x1f')]);}_0x482c04[_0x5fe7('0x3c')]=qs[_0x5fe7('0x3d')](_0x22ec2e[_0x5fe7('0x34')][_0x5fe7('0x3d')]);_0x482c04[_0x5fe7('0x3e')]=qs[_0x5fe7('0x36')](_[_0x5fe7('0x3f')](_0x22ec2e['query'],_0x1dc2c3[_0x5fe7('0x36')]),_0x59bbd7);if(_0x22ec2e[_0x5fe7('0x34')]['filter']){_0x482c04[_0x5fe7('0x3e')]=_[_0x5fe7('0x40')](_0x482c04[_0x5fe7('0x3e')],{'$or':_[_0x5fe7('0x33')](_0x59bbd7,function(_0x1fb733){if(_0x1fb733[_0x5fe7('0x41')]!==_0x5fe7('0x42')){var _0x37c352={};_0x37c352[_0x1fb733['name']]={'$like':'%'+_0x22ec2e['query'][_0x5fe7('0x43')]+'%'};return _0x37c352;}})});}_0x482c04=_[_0x5fe7('0x40')]({},_0x482c04,_0x22ec2e[_0x5fe7('0x44')]);var _0x318c06={'where':_0x482c04['where']};return db[_0x5fe7('0x45')][_0x5fe7('0x22')](_0x318c06)[_0x5fe7('0x27')](function(_0x431133){_0x3a30ef[_0x5fe7('0x22')]=_0x431133;if(_0x22ec2e[_0x5fe7('0x34')][_0x5fe7('0x46')]){_0x482c04[_0x5fe7('0x47')]=[{'all':!![]}];}return db[_0x5fe7('0x45')][_0x5fe7('0x48')](_0x482c04);})[_0x5fe7('0x27')](function(_0x11c78d){_0x3a30ef['rows']=_0x11c78d;return _0x3a30ef;})[_0x5fe7('0x27')](respondWithFilteredResult(_0x50a7fa,_0x482c04))[_0x5fe7('0x49')](handleError(_0x50a7fa,null));};exports[_0x5fe7('0x4a')]=function(_0x422d4b,_0x5d5e6d){var _0x1d52e0={'raw':!![],'where':{'id':_0x422d4b['params']['id']}},_0x5deb02={};_0x5deb02['model']=_['keys'](db[_0x5fe7('0x45')][_0x5fe7('0x2f')]);_0x5deb02[_0x5fe7('0x34')]=_['keys'](_0x422d4b[_0x5fe7('0x34')]);_0x5deb02['filters']=_[_0x5fe7('0x38')](_0x5deb02['model'],_0x5deb02[_0x5fe7('0x34')]);_0x1d52e0[_0x5fe7('0x37')]=_['intersection'](_0x5deb02[_0x5fe7('0x32')],qs['fields'](_0x422d4b[_0x5fe7('0x34')]['fields']));_0x1d52e0[_0x5fe7('0x37')]=_0x1d52e0[_0x5fe7('0x37')][_0x5fe7('0x3a')]?_0x1d52e0['attributes']:_0x5deb02['model'];if(_0x422d4b[_0x5fe7('0x34')][_0x5fe7('0x46')]){_0x1d52e0[_0x5fe7('0x47')]=[{'all':!![]}];}_0x1d52e0=_[_0x5fe7('0x40')]({},_0x1d52e0,_0x422d4b['options']);return db[_0x5fe7('0x45')]['find'](_0x1d52e0)['then'](handleEntityNotFound(_0x5d5e6d,null))[_0x5fe7('0x27')](respondWithResult(_0x5d5e6d,null))[_0x5fe7('0x49')](handleError(_0x5d5e6d,null));};exports[_0x5fe7('0x4b')]=function(_0x5033b2,_0x19be56){return db[_0x5fe7('0x45')][_0x5fe7('0x4b')](_0x5033b2[_0x5fe7('0x4c')],{})[_0x5fe7('0x27')](function(_0xa1ca33){var _0x583a81=_0x5033b2[_0x5fe7('0x4d')][_0x5fe7('0x4e')]({'plain':!![]});if(!_0x583a81)throw new Error(_0x5fe7('0x4f'));if(_0x583a81['role']===_0x5fe7('0x4d')){var _0x380b25=_0xa1ca33[_0x5fe7('0x4e')]({'plain':!![]});var _0x5e0f3c=_0x5fe7('0x28');return db[_0x5fe7('0x50')][_0x5fe7('0x51')]({'where':{'name':_0x5e0f3c,'userProfileId':_0x583a81[_0x5fe7('0x52')]},'raw':!![]})['then'](function(_0x232ae8){if(_0x232ae8&&_0x232ae8[_0x5fe7('0x53')]===0x0){return db[_0x5fe7('0x29')][_0x5fe7('0x4b')]({'name':_0x380b25[_0x5fe7('0x2c')],'resourceId':_0x380b25['id'],'type':_0x232ae8['name'],'sectionId':_0x232ae8['id']},{})['then'](function(){return _0xa1ca33;});}else{return _0xa1ca33;}})[_0x5fe7('0x49')](function(_0x381710){logger[_0x5fe7('0x2a')](_0x5fe7('0x54'),_0x381710);throw _0x381710;});}return _0xa1ca33;})[_0x5fe7('0x27')](respondWithResult(_0x19be56,0xc9))[_0x5fe7('0x49')](handleError(_0x19be56,null));};exports['update']=function(_0x11ca36,_0x275284){if(_0x11ca36[_0x5fe7('0x4c')]['id']){delete _0x11ca36[_0x5fe7('0x4c')]['id'];}return db[_0x5fe7('0x45')][_0x5fe7('0x51')]({'where':{'id':_0x11ca36[_0x5fe7('0x55')]['id']}})[_0x5fe7('0x27')](handleEntityNotFound(_0x275284,null))[_0x5fe7('0x27')](saveUpdates(_0x11ca36[_0x5fe7('0x4c')],null))[_0x5fe7('0x27')](respondWithResult(_0x275284,null))[_0x5fe7('0x49')](handleError(_0x275284,null));};exports[_0x5fe7('0x26')]=function(_0x392401,_0x4f54dc){return db[_0x5fe7('0x45')][_0x5fe7('0x51')]({'where':{'id':_0x392401[_0x5fe7('0x55')]['id']}})[_0x5fe7('0x27')](handleEntityNotFound(_0x4f54dc,null))[_0x5fe7('0x27')](removeEntity(_0x4f54dc,null))[_0x5fe7('0x49')](handleError(_0x4f54dc,null));}; \ No newline at end of file +var _0xb840=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','rows','catch','params','keys','rawAttributes','intersection','find','create','body','user','role','userProfileId'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0xb840,0x197));var _0x0b84=function(_0x1c20a9,_0x1a7ab1){_0x1c20a9=_0x1c20a9-0x0;var _0x4bfa40=_0xb840[_0x1c20a9];return _0x4bfa40;};'use strict';var emlformat=require(_0x0b84('0x0'));var rimraf=require(_0x0b84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0b84('0x2'));var moment=require(_0x0b84('0x3'));var BPromise=require(_0x0b84('0x4'));var Mustache=require(_0x0b84('0x5'));var util=require(_0x0b84('0x6'));var path=require(_0x0b84('0x7'));var sox=require(_0x0b84('0x8'));var csv=require(_0x0b84('0x9'));var ejs=require(_0x0b84('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b84('0xb'));var squel=require(_0x0b84('0xc'));var crypto=require(_0x0b84('0xd'));var jsforce=require(_0x0b84('0xe'));var deskjs=require(_0x0b84('0xf'));var toCsv=require(_0x0b84('0x9'));var querystring=require(_0x0b84('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b84('0x11'));var as=require(_0x0b84('0x12'));var hardwareService=require(_0x0b84('0x13'));var logger=require('../../config/logger')(_0x0b84('0x14'));var utils=require(_0x0b84('0x15'));var config=require(_0x0b84('0x16'));var licenseUtil=require(_0x0b84('0x17'));var db=require(_0x0b84('0x18'))['db'];function respondWithStatusCode(_0x2c0889,_0x44deca){_0x44deca=_0x44deca||0xcc;return function(_0x2f862f){if(_0x2f862f){return _0x2c0889[_0x0b84('0x19')](_0x44deca);}return _0x2c0889[_0x0b84('0x1a')](_0x44deca)[_0x0b84('0x1b')]();};}function respondWithResult(_0x245518,_0x510b9b){_0x510b9b=_0x510b9b||0xc8;return function(_0x5126c7){if(_0x5126c7){return _0x245518['status'](_0x510b9b)[_0x0b84('0x1c')](_0x5126c7);}};}function respondWithFilteredResult(_0x367785,_0x204642){return function(_0xb53505){if(_0xb53505){var _0x1eec1b=typeof _0x204642[_0x0b84('0x1d')]===_0x0b84('0x1e')&&typeof _0x204642['limit']===_0x0b84('0x1e');var _0x1f53f3=_0xb53505[_0x0b84('0x1f')];var _0x1690ed=_0x1eec1b?0x0:_0x204642[_0x0b84('0x1d')];var _0x34c52b=_0x1eec1b?_0xb53505[_0x0b84('0x1f')]:_0x204642['offset']+_0x204642['limit'];var _0x34b265;if(_0x34c52b>=_0x1f53f3){_0x34c52b=_0x1f53f3;_0x34b265=0xc8;}else{_0x34b265=0xce;}_0x367785['status'](_0x34b265);return _0x367785['set'](_0x0b84('0x20'),_0x1690ed+'-'+_0x34c52b+'/'+_0x1f53f3)[_0x0b84('0x1c')](_0xb53505);}return null;};}function patchUpdates(_0x292d29){return function(_0x1f9bfd){try{jsonpatch[_0x0b84('0x21')](_0x1f9bfd,_0x292d29,!![]);}catch(_0x2f1833){return BPromise[_0x0b84('0x22')](_0x2f1833);}return _0x1f9bfd['save']();};}function saveUpdates(_0x2bfe01,_0x301495){return function(_0x7bc4c3){if(_0x7bc4c3){return _0x7bc4c3['update'](_0x2bfe01)['then'](function(_0x3cbb49){return _0x3cbb49;});}return null;};}function removeEntity(_0xdc6d01,_0xe25ea7){return function(_0x4bb23f){if(_0x4bb23f){return _0x4bb23f[_0x0b84('0x23')]()[_0x0b84('0x24')](function(){var _0x45805b=_0x4bb23f[_0x0b84('0x25')]({'plain':!![]});var _0x1fc9d4=_0x0b84('0x26');return db[_0x0b84('0x27')][_0x0b84('0x23')]({'where':{'type':_0x1fc9d4,'resourceId':_0x45805b['id']}})[_0x0b84('0x24')](function(){return _0x4bb23f;});})[_0x0b84('0x24')](function(){_0xdc6d01['status'](0xcc)[_0x0b84('0x1b')]();});}};}function handleEntityNotFound(_0x33b804,_0x5386ce){return function(_0x26378f){if(!_0x26378f){_0x33b804[_0x0b84('0x19')](0x194);}return _0x26378f;};}function handleError(_0x1ad07f,_0x227d67){_0x227d67=_0x227d67||0x1f4;return function(_0x1066bc){logger[_0x0b84('0x28')](_0x1066bc[_0x0b84('0x29')]);if(_0x1066bc[_0x0b84('0x2a')]){delete _0x1066bc['name'];}_0x1ad07f[_0x0b84('0x1a')](_0x227d67)[_0x0b84('0x2b')](_0x1066bc);};}exports[_0x0b84('0x2c')]=function(_0x5779a0,_0x233bdb){var _0x30633c={},_0x422626={},_0x1b8fe1={'count':0x0,'rows':[]};var _0x1a88dc=_[_0x0b84('0x2d')](db[_0x0b84('0x2e')]['rawAttributes'],function(_0x478f2b){return{'name':_0x478f2b[_0x0b84('0x2f')],'type':_0x478f2b['type'][_0x0b84('0x30')]};});_0x422626[_0x0b84('0x31')]=_['map'](_0x1a88dc,'name');_0x422626['query']=_['keys'](_0x5779a0[_0x0b84('0x32')]);_0x422626[_0x0b84('0x33')]=_['intersection'](_0x422626[_0x0b84('0x31')],_0x422626[_0x0b84('0x32')]);_0x30633c[_0x0b84('0x34')]=_['intersection'](_0x422626[_0x0b84('0x31')],qs['fields'](_0x5779a0[_0x0b84('0x32')][_0x0b84('0x35')]));_0x30633c[_0x0b84('0x34')]=_0x30633c['attributes'][_0x0b84('0x36')]?_0x30633c[_0x0b84('0x34')]:_0x422626[_0x0b84('0x31')];if(!_0x5779a0[_0x0b84('0x32')][_0x0b84('0x37')](_0x0b84('0x38'))){_0x30633c[_0x0b84('0x39')]=qs['limit'](_0x5779a0[_0x0b84('0x32')][_0x0b84('0x39')]);_0x30633c[_0x0b84('0x1d')]=qs['offset'](_0x5779a0[_0x0b84('0x32')][_0x0b84('0x1d')]);}_0x30633c[_0x0b84('0x3a')]=qs[_0x0b84('0x3b')](_0x5779a0[_0x0b84('0x32')][_0x0b84('0x3b')]);_0x30633c['where']=qs['filters'](_[_0x0b84('0x3c')](_0x5779a0['query'],_0x422626[_0x0b84('0x33')]),_0x1a88dc);if(_0x5779a0[_0x0b84('0x32')][_0x0b84('0x3d')]){_0x30633c['where']=_[_0x0b84('0x3e')](_0x30633c['where'],{'$or':_['map'](_0x1a88dc,function(_0x5e2a7e){if(_0x5e2a7e['type']!==_0x0b84('0x3f')){var _0x49db18={};_0x49db18[_0x5e2a7e['name']]={'$like':'%'+_0x5779a0[_0x0b84('0x32')][_0x0b84('0x3d')]+'%'};return _0x49db18;}})});}_0x30633c=_[_0x0b84('0x3e')]({},_0x30633c,_0x5779a0[_0x0b84('0x40')]);var _0x1689b6={'where':_0x30633c[_0x0b84('0x41')]};return db[_0x0b84('0x2e')][_0x0b84('0x1f')](_0x1689b6)['then'](function(_0x55886a){_0x1b8fe1[_0x0b84('0x1f')]=_0x55886a;if(_0x5779a0[_0x0b84('0x32')][_0x0b84('0x42')]){_0x30633c['include']=[{'all':!![]}];}return db[_0x0b84('0x2e')]['findAll'](_0x30633c);})[_0x0b84('0x24')](function(_0x811186){_0x1b8fe1[_0x0b84('0x43')]=_0x811186;return _0x1b8fe1;})[_0x0b84('0x24')](respondWithFilteredResult(_0x233bdb,_0x30633c))[_0x0b84('0x44')](handleError(_0x233bdb,null));};exports['show']=function(_0x19544c,_0x2c465b){var _0x35f965={'raw':!![],'where':{'id':_0x19544c[_0x0b84('0x45')]['id']}},_0x332e88={};_0x332e88[_0x0b84('0x31')]=_[_0x0b84('0x46')](db[_0x0b84('0x2e')][_0x0b84('0x47')]);_0x332e88[_0x0b84('0x32')]=_[_0x0b84('0x46')](_0x19544c[_0x0b84('0x32')]);_0x332e88['filters']=_[_0x0b84('0x48')](_0x332e88[_0x0b84('0x31')],_0x332e88[_0x0b84('0x32')]);_0x35f965[_0x0b84('0x34')]=_[_0x0b84('0x48')](_0x332e88['model'],qs[_0x0b84('0x35')](_0x19544c[_0x0b84('0x32')]['fields']));_0x35f965[_0x0b84('0x34')]=_0x35f965[_0x0b84('0x34')][_0x0b84('0x36')]?_0x35f965[_0x0b84('0x34')]:_0x332e88['model'];if(_0x19544c[_0x0b84('0x32')][_0x0b84('0x42')]){_0x35f965['include']=[{'all':!![]}];}_0x35f965=_[_0x0b84('0x3e')]({},_0x35f965,_0x19544c['options']);return db[_0x0b84('0x2e')][_0x0b84('0x49')](_0x35f965)['then'](handleEntityNotFound(_0x2c465b,null))[_0x0b84('0x24')](respondWithResult(_0x2c465b,null))[_0x0b84('0x44')](handleError(_0x2c465b,null));};exports[_0x0b84('0x4a')]=function(_0xfffcb6,_0x4e27ec){return db[_0x0b84('0x2e')][_0x0b84('0x4a')](_0xfffcb6[_0x0b84('0x4b')],{})[_0x0b84('0x24')](function(_0x54134f){var _0x36455e=_0xfffcb6[_0x0b84('0x4c')][_0x0b84('0x25')]({'plain':!![]});if(!_0x36455e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36455e[_0x0b84('0x4d')]==='user'){var _0x4a9792=_0x54134f[_0x0b84('0x25')]({'plain':!![]});var _0x144b52=_0x0b84('0x26');return db['UserProfileSection'][_0x0b84('0x49')]({'where':{'name':_0x144b52,'userProfileId':_0x36455e[_0x0b84('0x4e')]},'raw':!![]})[_0x0b84('0x24')](function(_0x3bd798){if(_0x3bd798&&_0x3bd798[_0x0b84('0x4f')]===0x0){return db[_0x0b84('0x27')][_0x0b84('0x4a')]({'name':_0x4a9792[_0x0b84('0x2a')],'resourceId':_0x4a9792['id'],'type':_0x3bd798[_0x0b84('0x2a')],'sectionId':_0x3bd798['id']},{})[_0x0b84('0x24')](function(){return _0x54134f;});}else{return _0x54134f;}})[_0x0b84('0x44')](function(_0x20b3bf){logger[_0x0b84('0x28')](_0x0b84('0x50'),_0x20b3bf);throw _0x20b3bf;});}return _0x54134f;})[_0x0b84('0x24')](respondWithResult(_0x4e27ec,0xc9))[_0x0b84('0x44')](handleError(_0x4e27ec,null));};exports['update']=function(_0x4b87f9,_0xa01111){if(_0x4b87f9['body']['id']){delete _0x4b87f9[_0x0b84('0x4b')]['id'];}return db['Template'][_0x0b84('0x49')]({'where':{'id':_0x4b87f9[_0x0b84('0x45')]['id']}})[_0x0b84('0x24')](handleEntityNotFound(_0xa01111,null))[_0x0b84('0x24')](saveUpdates(_0x4b87f9[_0x0b84('0x4b')],null))[_0x0b84('0x24')](respondWithResult(_0xa01111,null))['catch'](handleError(_0xa01111,null));};exports[_0x0b84('0x23')]=function(_0x52a665,_0x408764){return db[_0x0b84('0x2e')][_0x0b84('0x49')]({'where':{'id':_0x52a665[_0x0b84('0x45')]['id']}})[_0x0b84('0x24')](handleEntityNotFound(_0x408764,null))[_0x0b84('0x24')](removeEntity(_0x408764,null))['catch'](handleError(_0x408764,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 2b66ec5..fa05cc9 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 _0x88a9=['Template','util','api','moment','request-promise','../../config/environment','./template.attributes','exports','define'];(function(_0x2a1cf5,_0x2619f2){var _0x5661a9=function(_0x2a9008){while(--_0x2a9008){_0x2a1cf5['push'](_0x2a1cf5['shift']());}};_0x5661a9(++_0x2619f2);}(_0x88a9,0x91));var _0x988a=function(_0x40e783,_0x41cc89){_0x40e783=_0x40e783-0x0;var _0x4a341e=_0x88a9[_0x40e783];return _0x4a341e;};'use strict';var _=require('lodash');var util=require(_0x988a('0x0'));var logger=require('../../config/logger')(_0x988a('0x1'));var moment=require(_0x988a('0x2'));var BPromise=require('bluebird');var rp=require(_0x988a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x988a('0x4'));var attributes=require(_0x988a('0x5'));module[_0x988a('0x6')]=function(_0x53ec99,_0x12f239){return _0x53ec99[_0x988a('0x7')](_0x988a('0x8'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08a7=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38d697,_0x2d0fb6){var _0x112f82=function(_0x21e908){while(--_0x21e908){_0x38d697['push'](_0x38d697['shift']());}};_0x112f82(++_0x2d0fb6);}(_0x08a7,0x180));var _0x708a=function(_0x1668b4,_0x4055ec){_0x1668b4=_0x1668b4-0x0;var _0x3e2277=_0x08a7[_0x1668b4];return _0x3e2277;};'use strict';var _=require(_0x708a('0x0'));var util=require(_0x708a('0x1'));var logger=require(_0x708a('0x2'))(_0x708a('0x3'));var moment=require(_0x708a('0x4'));var BPromise=require(_0x708a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x708a('0x6'));var rimraf=require(_0x708a('0x7'));var config=require(_0x708a('0x8'));var attributes=require(_0x708a('0x9'));module[_0x708a('0xa')]=function(_0x13c9e8,_0x4135e9){return _0x13c9e8[_0x708a('0xb')](_0x708a('0xc'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index df02a24..9373cc4 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 _0x3297=['include','map','model','GetTemplate','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','request\x20sent','stringify','error','Template,\x20%s,\x20%s','message','info','catch','Template','findAll','options','raw','attributes','limit'];(function(_0x59a07b,_0x754ac4){var _0x5ca7c3=function(_0xc951c0){while(--_0xc951c0){_0x59a07b['push'](_0x59a07b['shift']());}};_0x5ca7c3(++_0x754ac4);}(_0x3297,0xa0));var _0x7329=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x3297[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x7329('0x0'));var util=require(_0x7329('0x1'));var moment=require(_0x7329('0x2'));var BPromise=require(_0x7329('0x3'));var rs=require(_0x7329('0x4'));var fs=require('fs');var Redis=require(_0x7329('0x5'));var db=require(_0x7329('0x6'))['db'];var utils=require(_0x7329('0x7'));var logger=require(_0x7329('0x8'))('rpc');var config=require(_0x7329('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7329('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38aa1d,_0x55b4b8,_0x78f778){return new BPromise(function(_0x28f5c7,_0xf92166){return client[_0x7329('0xb')](_0x38aa1d,_0x78f778)[_0x7329('0xc')](function(_0x1ac321){logger['info']('Template,\x20%s,\x20%s',_0x55b4b8,_0x7329('0xd'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x55b4b8,_0x7329('0xd'),JSON[_0x7329('0xe')](_0x1ac321));if(_0x1ac321['error']){if(_0x1ac321[_0x7329('0xf')]['code']===0x1f4){logger[_0x7329('0xf')](_0x7329('0x10'),_0x55b4b8,_0x1ac321[_0x7329('0xf')][_0x7329('0x11')]);return _0xf92166(_0x1ac321[_0x7329('0xf')][_0x7329('0x11')]);}logger[_0x7329('0xf')](_0x7329('0x10'),_0x55b4b8,_0x1ac321[_0x7329('0xf')][_0x7329('0x11')]);return _0x28f5c7(_0x1ac321[_0x7329('0xf')][_0x7329('0x11')]);}else{logger[_0x7329('0x12')](_0x7329('0x10'),_0x55b4b8,'request\x20sent');_0x28f5c7(_0x1ac321['result'][_0x7329('0x11')]);}})[_0x7329('0x13')](function(_0x3b0bb5){logger[_0x7329('0xf')](_0x7329('0x10'),_0x55b4b8,_0x3b0bb5);_0xf92166(_0x3b0bb5);});});}exports['GetTemplate']=function(_0x361d54){var _0x4f8cff=this;return new Promise(function(_0x1d923e,_0x1f16a4){return db[_0x7329('0x14')][_0x7329('0x15')]({'raw':_0x361d54[_0x7329('0x16')]?_0x361d54[_0x7329('0x16')][_0x7329('0x17')]===undefined?!![]:![]:!![],'where':_0x361d54[_0x7329('0x16')]?_0x361d54[_0x7329('0x16')]['where']||null:null,'attributes':_0x361d54['options']?_0x361d54[_0x7329('0x16')][_0x7329('0x18')]||null:null,'limit':_0x361d54[_0x7329('0x16')]?_0x361d54['options'][_0x7329('0x19')]||null:null,'include':_0x361d54[_0x7329('0x16')]?_0x361d54['options'][_0x7329('0x1a')]?_[_0x7329('0x1b')](_0x361d54['options'][_0x7329('0x1a')],function(_0x301c3f){return{'model':db[_0x301c3f[_0x7329('0x1c')]],'as':_0x301c3f['as'],'attributes':_0x301c3f[_0x7329('0x18')],'include':_0x301c3f[_0x7329('0x1a')]?_[_0x7329('0x1b')](_0x301c3f[_0x7329('0x1a')],function(_0x5a7d3f){return{'model':db[_0x5a7d3f[_0x7329('0x1c')]],'as':_0x5a7d3f['as'],'attributes':_0x5a7d3f[_0x7329('0x18')],'include':_0x5a7d3f[_0x7329('0x1a')]?_['map'](_0x5a7d3f[_0x7329('0x1a')],function(_0x48cdab){return{'model':db[_0x48cdab[_0x7329('0x1c')]],'as':_0x48cdab['as'],'attributes':_0x48cdab[_0x7329('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7329('0xc')](function(_0x4bb082){logger[_0x7329('0x12')](_0x7329('0x1d'),_0x361d54);logger[_0x7329('0x1e')]('GetTemplate',_0x361d54,JSON[_0x7329('0xe')](_0x4bb082));_0x1d923e(_0x4bb082);})[_0x7329('0x13')](function(_0x2c7be2){logger[_0x7329('0xf')](_0x7329('0x1d'),_0x2c7be2['message'],_0x361d54);_0x1f16a4(_0x4f8cff['error'](0x1f4,_0x2c7be2['message']));});});}; \ No newline at end of file +var _0x3fc5=['raw','attributes','include','map','model','GetTemplate','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','Template','options'];(function(_0x5842c3,_0x56bd74){var _0x44bf8c=function(_0x79551f){while(--_0x79551f){_0x5842c3['push'](_0x5842c3['shift']());}};_0x44bf8c(++_0x56bd74);}(_0x3fc5,0x10c));var _0x53fc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3fc5[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x53fc('0x0'));var util=require('util');var moment=require(_0x53fc('0x1'));var BPromise=require('bluebird');var rs=require(_0x53fc('0x2'));var fs=require('fs');var Redis=require(_0x53fc('0x3'));var db=require(_0x53fc('0x4'))['db'];var utils=require(_0x53fc('0x5'));var logger=require(_0x53fc('0x6'))(_0x53fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x53fc('0x8'));var client=jayson[_0x53fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x63058e,_0x5db06e,_0x4f9a68){return new BPromise(function(_0xa64f9f,_0x31e051){return client[_0x53fc('0xa')](_0x63058e,_0x4f9a68)[_0x53fc('0xb')](function(_0x4c067f){logger[_0x53fc('0xc')](_0x53fc('0xd'),_0x5db06e,_0x53fc('0xe'));logger[_0x53fc('0xf')](_0x53fc('0x10'),_0x5db06e,_0x53fc('0xe'),JSON[_0x53fc('0x11')](_0x4c067f));if(_0x4c067f['error']){if(_0x4c067f[_0x53fc('0x12')]['code']===0x1f4){logger[_0x53fc('0x12')](_0x53fc('0xd'),_0x5db06e,_0x4c067f['error'][_0x53fc('0x13')]);return _0x31e051(_0x4c067f['error'][_0x53fc('0x13')]);}logger[_0x53fc('0x12')](_0x53fc('0xd'),_0x5db06e,_0x4c067f['error'][_0x53fc('0x13')]);return _0xa64f9f(_0x4c067f['error'][_0x53fc('0x13')]);}else{logger[_0x53fc('0xc')](_0x53fc('0xd'),_0x5db06e,_0x53fc('0xe'));_0xa64f9f(_0x4c067f['result']['message']);}})['catch'](function(_0x2ddebd){logger['error'](_0x53fc('0xd'),_0x5db06e,_0x2ddebd);_0x31e051(_0x2ddebd);});});}exports['GetTemplate']=function(_0x41c94f){var _0x2b9e51=this;return new Promise(function(_0x5e1811,_0x84e7b3){return db[_0x53fc('0x14')]['findAll']({'raw':_0x41c94f[_0x53fc('0x15')]?_0x41c94f['options'][_0x53fc('0x16')]===undefined?!![]:![]:!![],'where':_0x41c94f[_0x53fc('0x15')]?_0x41c94f[_0x53fc('0x15')]['where']||null:null,'attributes':_0x41c94f['options']?_0x41c94f[_0x53fc('0x15')][_0x53fc('0x17')]||null:null,'limit':_0x41c94f['options']?_0x41c94f[_0x53fc('0x15')]['limit']||null:null,'include':_0x41c94f[_0x53fc('0x15')]?_0x41c94f['options'][_0x53fc('0x18')]?_[_0x53fc('0x19')](_0x41c94f[_0x53fc('0x15')]['include'],function(_0x921b91){return{'model':db[_0x921b91[_0x53fc('0x1a')]],'as':_0x921b91['as'],'attributes':_0x921b91[_0x53fc('0x17')],'include':_0x921b91[_0x53fc('0x18')]?_[_0x53fc('0x19')](_0x921b91[_0x53fc('0x18')],function(_0x1c1364){return{'model':db[_0x1c1364[_0x53fc('0x1a')]],'as':_0x1c1364['as'],'attributes':_0x1c1364[_0x53fc('0x17')],'include':_0x1c1364['include']?_[_0x53fc('0x19')](_0x1c1364[_0x53fc('0x18')],function(_0x12d367){return{'model':db[_0x12d367[_0x53fc('0x1a')]],'as':_0x12d367['as'],'attributes':_0x12d367['attributes']};}):[]};}):[]};}):[]:[]})[_0x53fc('0xb')](function(_0x29af5d){logger['info'](_0x53fc('0x1b'),_0x41c94f);logger['debug'](_0x53fc('0x1b'),_0x41c94f,JSON[_0x53fc('0x11')](_0x29af5d));_0x5e1811(_0x29af5d);})[_0x53fc('0x1c')](function(_0x130c1a){logger[_0x53fc('0x12')](_0x53fc('0x1b'),_0x130c1a[_0x53fc('0x13')],_0x41c94f);_0x84e7b3(_0x2b9e51[_0x53fc('0x12')](0x1f4,_0x130c1a[_0x53fc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b420b1f..dab0ad7 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 _0x61b0=['/:id/actions','getActions','post','create','addAnyCondition','addAction','put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions'];(function(_0x51ab13,_0xbe6213){var _0x27c657=function(_0x19561b){while(--_0x19561b){_0x51ab13['push'](_0x51ab13['shift']());}};_0x27c657(++_0xbe6213);}(_0x61b0,0x18f));var _0x061b=function(_0xad606a,_0x33e585){_0xad606a=_0xad606a-0x0;var _0x115903=_0x61b0[_0xad606a];return _0x115903;};'use strict';var multer=require(_0x061b('0x0'));var util=require('util');var path=require(_0x061b('0x1'));var timeout=require(_0x061b('0x2'));var express=require(_0x061b('0x3'));var router=express['Router']();var fs_extra=require(_0x061b('0x4'));var auth=require(_0x061b('0x5'));var interaction=require(_0x061b('0x6'));var config=require(_0x061b('0x7'));var controller=require('./trigger.controller');router[_0x061b('0x8')]('/',auth[_0x061b('0x9')](),controller[_0x061b('0xa')]);router[_0x061b('0x8')](_0x061b('0xb'),auth[_0x061b('0x9')](),controller[_0x061b('0xc')]);router[_0x061b('0x8')](_0x061b('0xd'),auth[_0x061b('0x9')](),controller[_0x061b('0xe')]);router[_0x061b('0x8')](_0x061b('0xf'),auth[_0x061b('0x9')](),controller[_0x061b('0x10')]);router[_0x061b('0x8')](_0x061b('0x11'),auth[_0x061b('0x9')](),controller[_0x061b('0x12')]);router[_0x061b('0x13')]('/',auth[_0x061b('0x9')](),controller[_0x061b('0x14')]);router[_0x061b('0x13')](_0x061b('0xd'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x061b('0x13')](_0x061b('0xf'),auth[_0x061b('0x9')](),controller[_0x061b('0x15')]);router['post'](_0x061b('0x11'),auth[_0x061b('0x9')](),controller[_0x061b('0x16')]);router[_0x061b('0x17')](_0x061b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x061b('0x18')]('/:id',auth[_0x061b('0x9')](),controller['destroy']);module[_0x061b('0x19')]=router; \ No newline at end of file +var _0x0bf7=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','addAnyCondition'];(function(_0x70b942,_0x2a72cc){var _0x3b986b=function(_0x4b2363){while(--_0x4b2363){_0x70b942['push'](_0x70b942['shift']());}};_0x3b986b(++_0x2a72cc);}(_0x0bf7,0x14a));var _0x70bf=function(_0x33ba8a,_0x5a5fbe){_0x33ba8a=_0x33ba8a-0x0;var _0x399324=_0x0bf7[_0x33ba8a];return _0x399324;};'use strict';var multer=require(_0x70bf('0x0'));var util=require('util');var path=require(_0x70bf('0x1'));var timeout=require(_0x70bf('0x2'));var express=require(_0x70bf('0x3'));var router=express[_0x70bf('0x4')]();var fs_extra=require(_0x70bf('0x5'));var auth=require(_0x70bf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x70bf('0x7'));var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x70bf('0x8')]);router[_0x70bf('0x9')](_0x70bf('0xa'),auth[_0x70bf('0xb')](),controller[_0x70bf('0xc')]);router[_0x70bf('0x9')](_0x70bf('0xd'),auth[_0x70bf('0xb')](),controller[_0x70bf('0xe')]);router[_0x70bf('0x9')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x70bf('0xf')]);router['get'](_0x70bf('0x10'),auth[_0x70bf('0xb')](),controller[_0x70bf('0x11')]);router[_0x70bf('0x12')]('/',auth[_0x70bf('0xb')](),controller['create']);router[_0x70bf('0x12')](_0x70bf('0xd'),auth[_0x70bf('0xb')](),controller['addAllCondition']);router[_0x70bf('0x12')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x70bf('0x13')]);router[_0x70bf('0x12')]('/:id/actions',auth[_0x70bf('0xb')](),controller['addAction']);router[_0x70bf('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x70bf('0x15')]);router[_0x70bf('0x16')](_0x70bf('0xa'),auth[_0x70bf('0xb')](),controller[_0x70bf('0x17')]);module[_0x70bf('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 7439d39..f85abdb 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 _0x5651=['STRING','BOOLEAN'];(function(_0x2bd440,_0xfb5a9d){var _0x58f325=function(_0x19847f){while(--_0x19847f){_0x2bd440['push'](_0x2bd440['shift']());}};_0x58f325(++_0xfb5a9d);}(_0x5651,0x1e4));var _0x1565=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x5651[_0x368e09];return _0x14b7df;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1565('0x0')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1565('0x0')]},'status':{'type':Sequelize[_0x1565('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x5ab8=['exports','STRING','BOOLEAN'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5ab8,0xed));var _0x85ab=function(_0x559cd6,_0xdec496){_0x559cd6=_0x559cd6-0x0;var _0x16c3f8=_0x5ab8[_0x559cd6];return _0x16c3f8;};'use strict';var Sequelize=require('sequelize');module[_0x85ab('0x0')]={'name':{'type':Sequelize[_0x85ab('0x1')]},'channel':{'type':Sequelize[_0x85ab('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x85ab('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5672c64..b7a9fab 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 _0x1b64=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','hasOwnProperty','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1b64,0x72));var _0x41b6=function(_0xce4756,_0x51cc4a){_0xce4756=_0xce4756-0x0;var _0x4e0499=_0x1b64[_0xce4756];return _0x4e0499;};'use strict';var emlformat=require(_0x41b6('0x0'));var rimraf=require(_0x41b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x41b6('0x2'));var moment=require(_0x41b6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x41b6('0x4'));var util=require('util');var path=require(_0x41b6('0x5'));var sox=require(_0x41b6('0x6'));var csv=require('to-csv');var ejs=require(_0x41b6('0x7'));var fs=require('fs');var fs_extra=require(_0x41b6('0x8'));var _=require(_0x41b6('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x41b6('0xa'));var querystring=require(_0x41b6('0xb'));var Papa=require('papaparse');var Redis=require(_0x41b6('0xc'));var authService=require(_0x41b6('0xd'));var qs=require(_0x41b6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41b6('0xf'));var logger=require('../../config/logger')(_0x41b6('0x10'));var utils=require(_0x41b6('0x11'));var config=require(_0x41b6('0x12'));var licenseUtil=require(_0x41b6('0x13'));var db=require(_0x41b6('0x14'))['db'];function respondWithStatusCode(_0x1e87a5,_0x5de8fd){_0x5de8fd=_0x5de8fd||0xcc;return function(_0x1c9c59){if(_0x1c9c59){return _0x1e87a5[_0x41b6('0x15')](_0x5de8fd);}return _0x1e87a5['status'](_0x5de8fd)[_0x41b6('0x16')]();};}function respondWithResult(_0x4115ee,_0x1a9282){_0x1a9282=_0x1a9282||0xc8;return function(_0x5c2c16){if(_0x5c2c16){return _0x4115ee['status'](_0x1a9282)[_0x41b6('0x17')](_0x5c2c16);}};}function respondWithFilteredResult(_0x12ada9,_0x38e967){return function(_0x56a032){if(_0x56a032){var _0x5757c2=typeof _0x38e967[_0x41b6('0x18')]===_0x41b6('0x19')&&typeof _0x38e967[_0x41b6('0x1a')]===_0x41b6('0x19');var _0x4faeaf=_0x56a032[_0x41b6('0x1b')];var _0x3f6419=_0x5757c2?0x0:_0x38e967[_0x41b6('0x18')];var _0x17655f=_0x5757c2?_0x56a032[_0x41b6('0x1b')]:_0x38e967[_0x41b6('0x18')]+_0x38e967[_0x41b6('0x1a')];var _0x531df6;if(_0x17655f>=_0x4faeaf){_0x17655f=_0x4faeaf;_0x531df6=0xc8;}else{_0x531df6=0xce;}_0x12ada9[_0x41b6('0x1c')](_0x531df6);return _0x12ada9[_0x41b6('0x1d')](_0x41b6('0x1e'),_0x3f6419+'-'+_0x17655f+'/'+_0x4faeaf)[_0x41b6('0x17')](_0x56a032);}return null;};}function patchUpdates(_0x344748){return function(_0x2e2db3){try{jsonpatch[_0x41b6('0x1f')](_0x2e2db3,_0x344748,!![]);}catch(_0x409d1a){return BPromise[_0x41b6('0x20')](_0x409d1a);}return _0x2e2db3[_0x41b6('0x21')]();};}function saveUpdates(_0x1da098,_0x414624){return function(_0x13be84){if(_0x13be84){return _0x13be84[_0x41b6('0x22')](_0x1da098)[_0x41b6('0x23')](function(_0x11ba29){return _0x11ba29;});}return null;};}function removeEntity(_0x5df657,_0x305741){return function(_0x427729){if(_0x427729){return _0x427729[_0x41b6('0x24')]()[_0x41b6('0x23')](function(){var _0x355839=_0x427729['get']({'plain':!![]});var _0x340912=_0x41b6('0x25');return db['UserProfileResource'][_0x41b6('0x24')]({'where':{'type':_0x340912,'resourceId':_0x355839['id']}})[_0x41b6('0x23')](function(){return _0x427729;});})[_0x41b6('0x23')](function(){_0x5df657[_0x41b6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e03b4,_0xce4f7d){return function(_0x1dbf7b){if(!_0x1dbf7b){_0x2e03b4[_0x41b6('0x15')](0x194);}return _0x1dbf7b;};}function handleError(_0x2bebbf,_0x1670cb){_0x1670cb=_0x1670cb||0x1f4;return function(_0x244ae8){logger[_0x41b6('0x26')](_0x244ae8[_0x41b6('0x27')]);if(_0x244ae8[_0x41b6('0x28')]){delete _0x244ae8[_0x41b6('0x28')];}_0x2bebbf[_0x41b6('0x1c')](_0x1670cb)[_0x41b6('0x29')](_0x244ae8);};}exports[_0x41b6('0x2a')]=function(_0x185f48,_0x37c760){var _0x2b8651={},_0x1d8ca1={},_0x2a0b10={'count':0x0,'rows':[]};var _0x4333d1=_[_0x41b6('0x2b')](db[_0x41b6('0x2c')][_0x41b6('0x2d')],function(_0x276c22){return{'name':_0x276c22[_0x41b6('0x2e')],'type':_0x276c22[_0x41b6('0x2f')]['key']};});_0x1d8ca1[_0x41b6('0x30')]=_[_0x41b6('0x2b')](_0x4333d1,'name');_0x1d8ca1['query']=_[_0x41b6('0x31')](_0x185f48['query']);_0x1d8ca1[_0x41b6('0x32')]=_[_0x41b6('0x33')](_0x1d8ca1[_0x41b6('0x30')],_0x1d8ca1['query']);_0x2b8651[_0x41b6('0x34')]=_[_0x41b6('0x33')](_0x1d8ca1['model'],qs[_0x41b6('0x35')](_0x185f48[_0x41b6('0x36')][_0x41b6('0x35')]));_0x2b8651[_0x41b6('0x34')]=_0x2b8651[_0x41b6('0x34')][_0x41b6('0x37')]?_0x2b8651[_0x41b6('0x34')]:_0x1d8ca1[_0x41b6('0x30')];if(!_0x185f48[_0x41b6('0x36')]['hasOwnProperty'](_0x41b6('0x38'))){_0x2b8651[_0x41b6('0x1a')]=qs[_0x41b6('0x1a')](_0x185f48['query']['limit']);_0x2b8651['offset']=qs['offset'](_0x185f48[_0x41b6('0x36')][_0x41b6('0x18')]);}_0x2b8651[_0x41b6('0x39')]=qs[_0x41b6('0x3a')](_0x185f48['query'][_0x41b6('0x3a')]);_0x2b8651['where']=qs[_0x41b6('0x32')](_[_0x41b6('0x3b')](_0x185f48[_0x41b6('0x36')],_0x1d8ca1[_0x41b6('0x32')]),_0x4333d1);if(_0x185f48['query'][_0x41b6('0x3c')]){_0x2b8651['where']=_[_0x41b6('0x3d')](_0x2b8651[_0x41b6('0x3e')],{'$or':_[_0x41b6('0x2b')](_0x4333d1,function(_0x4c28ca){if(_0x4c28ca[_0x41b6('0x2f')]!==_0x41b6('0x3f')){var _0xb4f855={};_0xb4f855[_0x4c28ca[_0x41b6('0x28')]]={'$like':'%'+_0x185f48['query'][_0x41b6('0x3c')]+'%'};return _0xb4f855;}})});}_0x2b8651=_[_0x41b6('0x3d')]({},_0x2b8651,_0x185f48[_0x41b6('0x40')]);var _0x5c6c5a={'where':_0x2b8651[_0x41b6('0x3e')]};return db[_0x41b6('0x2c')]['count'](_0x5c6c5a)[_0x41b6('0x23')](function(_0x5c3112){_0x2a0b10[_0x41b6('0x1b')]=_0x5c3112;if(_0x185f48[_0x41b6('0x36')][_0x41b6('0x41')]){_0x2b8651[_0x41b6('0x42')]=[{'all':!![]}];}return db[_0x41b6('0x2c')][_0x41b6('0x43')](_0x2b8651);})[_0x41b6('0x23')](function(_0x286762){_0x2a0b10[_0x41b6('0x44')]=_0x286762;return _0x2a0b10;})[_0x41b6('0x23')](respondWithFilteredResult(_0x37c760,_0x2b8651))[_0x41b6('0x45')](handleError(_0x37c760,null));};exports[_0x41b6('0x46')]=function(_0x5da9ae,_0x12d95c){var _0x4b5fd3={'raw':![],'where':{'id':_0x5da9ae[_0x41b6('0x47')]['id']}},_0x58bfeb={};_0x58bfeb[_0x41b6('0x30')]=_[_0x41b6('0x31')](db['Trigger'][_0x41b6('0x2d')]);_0x58bfeb[_0x41b6('0x36')]=_['keys'](_0x5da9ae[_0x41b6('0x36')]);_0x58bfeb[_0x41b6('0x32')]=_[_0x41b6('0x33')](_0x58bfeb[_0x41b6('0x30')],_0x58bfeb[_0x41b6('0x36')]);_0x4b5fd3[_0x41b6('0x34')]=_[_0x41b6('0x33')](_0x58bfeb[_0x41b6('0x30')],qs[_0x41b6('0x35')](_0x5da9ae[_0x41b6('0x36')][_0x41b6('0x35')]));_0x4b5fd3[_0x41b6('0x34')]=_0x4b5fd3['attributes'][_0x41b6('0x37')]?_0x4b5fd3[_0x41b6('0x34')]:_0x58bfeb['model'];if(_0x5da9ae[_0x41b6('0x36')][_0x41b6('0x41')]){_0x4b5fd3[_0x41b6('0x42')]=[{'all':!![]}];}_0x4b5fd3=_['merge']({},_0x4b5fd3,_0x5da9ae[_0x41b6('0x40')]);return db[_0x41b6('0x2c')]['find'](_0x4b5fd3)[_0x41b6('0x23')](handleEntityNotFound(_0x12d95c,null))[_0x41b6('0x23')](respondWithResult(_0x12d95c,null))[_0x41b6('0x45')](handleError(_0x12d95c,null));};exports[_0x41b6('0x48')]=function(_0x2bd08c,_0x54e3fc){return db['Trigger']['create'](_0x2bd08c[_0x41b6('0x49')],{})[_0x41b6('0x23')](function(_0x54c095){var _0x4a372c=_0x2bd08c[_0x41b6('0x4a')][_0x41b6('0x4b')]({'plain':!![]});if(!_0x4a372c)throw new Error(_0x41b6('0x4c'));if(_0x4a372c['role']===_0x41b6('0x4a')){var _0x1ad43d=_0x54c095['get']({'plain':!![]});var _0x131a1c=_0x41b6('0x25');return db[_0x41b6('0x4d')][_0x41b6('0x4e')]({'where':{'name':_0x131a1c,'userProfileId':_0x4a372c[_0x41b6('0x4f')]},'raw':!![]})['then'](function(_0x45816d){if(_0x45816d&&_0x45816d[_0x41b6('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x1ad43d[_0x41b6('0x28')],'resourceId':_0x1ad43d['id'],'type':_0x45816d[_0x41b6('0x28')],'sectionId':_0x45816d['id']},{})['then'](function(){return _0x54c095;});}else{return _0x54c095;}})[_0x41b6('0x45')](function(_0x1d97c9){logger[_0x41b6('0x26')](_0x41b6('0x51'),_0x1d97c9);throw _0x1d97c9;});}return _0x54c095;})[_0x41b6('0x23')](respondWithResult(_0x54e3fc,0xc9))[_0x41b6('0x45')](handleError(_0x54e3fc,null));};exports[_0x41b6('0x22')]=function(_0x346d17,_0x619015){if(_0x346d17['body']['id']){delete _0x346d17['body']['id'];}return db[_0x41b6('0x2c')][_0x41b6('0x4e')]({'where':{'id':_0x346d17[_0x41b6('0x47')]['id']}})[_0x41b6('0x23')](handleEntityNotFound(_0x619015,null))[_0x41b6('0x23')](saveUpdates(_0x346d17[_0x41b6('0x49')],null))[_0x41b6('0x23')](respondWithResult(_0x619015,null))[_0x41b6('0x45')](handleError(_0x619015,null));};exports[_0x41b6('0x24')]=function(_0x258921,_0x3ef75a){return db['Trigger'][_0x41b6('0x4e')]({'where':{'id':_0x258921[_0x41b6('0x47')]['id']}})[_0x41b6('0x23')](handleEntityNotFound(_0x3ef75a,null))['then'](removeEntity(_0x3ef75a,null))[_0x41b6('0x45')](handleError(_0x3ef75a,null));};exports[_0x41b6('0x52')]=function(_0x5b7ede,_0x1dae58,_0x24e93a){if(_0x5b7ede[_0x41b6('0x49')]['id']){delete _0x5b7ede[_0x41b6('0x49')]['id'];}return db[_0x41b6('0x2c')][_0x41b6('0x4e')]({'where':{'id':_0x5b7ede[_0x41b6('0x47')]['id']}})[_0x41b6('0x23')](handleEntityNotFound(_0x1dae58,null))['then'](function(_0x3f7479){if(_0x3f7479){_0x5b7ede['body']['TriggerAllId']=_0x3f7479['id'];return db[_0x41b6('0x53')][_0x41b6('0x48')](_0x5b7ede['body']);}})[_0x41b6('0x23')](respondWithResult(_0x1dae58,null))[_0x41b6('0x45')](handleError(_0x1dae58,null));};exports[_0x41b6('0x54')]=function(_0x1a0c9b,_0x5f4c17,_0x4d8743){if(_0x1a0c9b[_0x41b6('0x49')]['id']){delete _0x1a0c9b['body']['id'];}return db[_0x41b6('0x2c')][_0x41b6('0x4e')]({'where':{'id':_0x1a0c9b['params']['id']}})[_0x41b6('0x23')](handleEntityNotFound(_0x5f4c17,null))[_0x41b6('0x23')](function(_0x11871b){if(_0x11871b){_0x1a0c9b[_0x41b6('0x49')][_0x41b6('0x55')]=_0x11871b['id'];return db['Condition']['create'](_0x1a0c9b[_0x41b6('0x49')]);}})[_0x41b6('0x23')](respondWithResult(_0x5f4c17,null))['catch'](handleError(_0x5f4c17,null));};exports['getAllConditions']=function(_0x1ecb39,_0x1da265,_0x3bb4c3){var _0x44313f={};var _0x1d6407={};var _0x5999ab;var _0x20f200;return db[_0x41b6('0x2c')][_0x41b6('0x56')]({'where':{'id':_0x1ecb39[_0x41b6('0x47')]['id']}})[_0x41b6('0x23')](handleEntityNotFound(_0x1da265,null))[_0x41b6('0x23')](function(_0x43599d){if(_0x43599d){_0x5999ab=_0x43599d;_0x1d6407[_0x41b6('0x30')]=_[_0x41b6('0x31')](db[_0x41b6('0x53')]['rawAttributes']);_0x1d6407[_0x41b6('0x36')]=_[_0x41b6('0x31')](_0x1ecb39[_0x41b6('0x36')]);_0x1d6407['filters']=_[_0x41b6('0x33')](_0x1d6407[_0x41b6('0x30')],_0x1d6407[_0x41b6('0x36')]);_0x44313f['attributes']=_['intersection'](_0x1d6407[_0x41b6('0x30')],qs[_0x41b6('0x35')](_0x1ecb39[_0x41b6('0x36')][_0x41b6('0x35')]));_0x44313f[_0x41b6('0x34')]=_0x44313f[_0x41b6('0x34')][_0x41b6('0x37')]?_0x44313f[_0x41b6('0x34')]:_0x1d6407[_0x41b6('0x30')];_0x44313f[_0x41b6('0x39')]=qs[_0x41b6('0x3a')](_0x1ecb39[_0x41b6('0x36')]['sort']);_0x44313f['where']=qs[_0x41b6('0x32')](_[_0x41b6('0x3b')](_0x1ecb39['query'],_0x1d6407['filters']));if(_0x1ecb39[_0x41b6('0x36')]['filter']){_0x44313f[_0x41b6('0x3e')]=_[_0x41b6('0x3d')](_0x44313f[_0x41b6('0x3e')],{'$or':_['map'](_0x44313f[_0x41b6('0x34')],function(_0x2c0018){var _0x30d950={};_0x30d950[_0x2c0018]={'$like':'%'+_0x1ecb39[_0x41b6('0x36')][_0x41b6('0x3c')]+'%'};return _0x30d950;})});}_0x44313f=_[_0x41b6('0x3d')]({},_0x44313f,_0x1ecb39[_0x41b6('0x40')]);return _0x5999ab['getAllConditions'](_0x44313f);}})[_0x41b6('0x23')](function(_0x5d2df6){if(_0x5d2df6){_0x20f200=_0x5d2df6[_0x41b6('0x37')];if(!_0x1ecb39[_0x41b6('0x36')][_0x41b6('0x57')]('nolimit')){_0x44313f[_0x41b6('0x1a')]=qs[_0x41b6('0x1a')](_0x1ecb39['query'][_0x41b6('0x1a')]);_0x44313f['offset']=qs[_0x41b6('0x18')](_0x1ecb39['query'][_0x41b6('0x18')]);}return _0x5999ab[_0x41b6('0x58')](_0x44313f);}})['then'](function(_0x387c65){if(_0x387c65){return _0x387c65?{'count':_0x20f200,'rows':_0x387c65}:null;}})[_0x41b6('0x23')](respondWithResult(_0x1da265,null))[_0x41b6('0x45')](handleError(_0x1da265,null));};exports['getAnyConditions']=function(_0x4e21be,_0x54d89,_0x40fbc1){var _0x51fab0={};var _0x1cedda={};var _0xfa30c9;var _0x146fc3;return db[_0x41b6('0x2c')][_0x41b6('0x56')]({'where':{'id':_0x4e21be['params']['id']}})[_0x41b6('0x23')](handleEntityNotFound(_0x54d89,null))[_0x41b6('0x23')](function(_0xfc058f){if(_0xfc058f){_0xfa30c9=_0xfc058f;_0x1cedda[_0x41b6('0x30')]=_[_0x41b6('0x31')](db[_0x41b6('0x53')]['rawAttributes']);_0x1cedda['query']=_['keys'](_0x4e21be[_0x41b6('0x36')]);_0x1cedda['filters']=_[_0x41b6('0x33')](_0x1cedda['model'],_0x1cedda[_0x41b6('0x36')]);_0x51fab0['attributes']=_[_0x41b6('0x33')](_0x1cedda[_0x41b6('0x30')],qs[_0x41b6('0x35')](_0x4e21be[_0x41b6('0x36')][_0x41b6('0x35')]));_0x51fab0[_0x41b6('0x34')]=_0x51fab0[_0x41b6('0x34')][_0x41b6('0x37')]?_0x51fab0['attributes']:_0x1cedda[_0x41b6('0x30')];_0x51fab0[_0x41b6('0x39')]=qs['sort'](_0x4e21be[_0x41b6('0x36')][_0x41b6('0x3a')]);_0x51fab0[_0x41b6('0x3e')]=qs[_0x41b6('0x32')](_[_0x41b6('0x3b')](_0x4e21be['query'],_0x1cedda[_0x41b6('0x32')]));if(_0x4e21be[_0x41b6('0x36')][_0x41b6('0x3c')]){_0x51fab0[_0x41b6('0x3e')]=_['merge'](_0x51fab0['where'],{'$or':_['map'](_0x51fab0['attributes'],function(_0x51878b){var _0x26c61d={};_0x26c61d[_0x51878b]={'$like':'%'+_0x4e21be['query'][_0x41b6('0x3c')]+'%'};return _0x26c61d;})});}_0x51fab0=_[_0x41b6('0x3d')]({},_0x51fab0,_0x4e21be[_0x41b6('0x40')]);return _0xfa30c9[_0x41b6('0x59')](_0x51fab0);}})[_0x41b6('0x23')](function(_0x3084a6){if(_0x3084a6){_0x146fc3=_0x3084a6['length'];if(!_0x4e21be[_0x41b6('0x36')][_0x41b6('0x57')]('nolimit')){_0x51fab0[_0x41b6('0x1a')]=qs['limit'](_0x4e21be[_0x41b6('0x36')][_0x41b6('0x1a')]);_0x51fab0['offset']=qs[_0x41b6('0x18')](_0x4e21be[_0x41b6('0x36')]['offset']);}return _0xfa30c9[_0x41b6('0x59')](_0x51fab0);}})[_0x41b6('0x23')](function(_0x1b3e07){if(_0x1b3e07){return _0x1b3e07?{'count':_0x146fc3,'rows':_0x1b3e07}:null;}})[_0x41b6('0x23')](respondWithResult(_0x54d89,null))['catch'](handleError(_0x54d89,null));};exports[_0x41b6('0x5a')]=function(_0x27e480,_0x51acfa,_0x4683de){if(_0x27e480['body']['id']){delete _0x27e480[_0x41b6('0x49')]['id'];}return db[_0x41b6('0x2c')][_0x41b6('0x4e')]({'where':{'id':_0x27e480['params']['id']}})[_0x41b6('0x23')](handleEntityNotFound(_0x51acfa,null))[_0x41b6('0x23')](function(_0x5e5a4d){if(_0x5e5a4d){_0x27e480[_0x41b6('0x49')][_0x41b6('0x5b')]=_0x5e5a4d['id'];return db[_0x41b6('0x5c')][_0x41b6('0x48')](_0x27e480[_0x41b6('0x49')]);}})[_0x41b6('0x23')](respondWithResult(_0x51acfa,null))[_0x41b6('0x45')](handleError(_0x51acfa,null));};exports[_0x41b6('0x5d')]=function(_0x565250,_0x52e840,_0x248817){var _0x5cfb7e={};var _0x1ac7f5={};var _0x2d85c2;var _0x30ab14;return db[_0x41b6('0x2c')][_0x41b6('0x56')]({'where':{'id':_0x565250[_0x41b6('0x47')]['id']}})[_0x41b6('0x23')](handleEntityNotFound(_0x52e840,null))[_0x41b6('0x23')](function(_0x23afe4){if(_0x23afe4){_0x2d85c2=_0x23afe4;_0x1ac7f5['model']=_[_0x41b6('0x31')](db[_0x41b6('0x5c')][_0x41b6('0x2d')]);_0x1ac7f5[_0x41b6('0x36')]=_[_0x41b6('0x31')](_0x565250[_0x41b6('0x36')]);_0x1ac7f5[_0x41b6('0x32')]=_[_0x41b6('0x33')](_0x1ac7f5[_0x41b6('0x30')],_0x1ac7f5[_0x41b6('0x36')]);_0x5cfb7e[_0x41b6('0x34')]=_[_0x41b6('0x33')](_0x1ac7f5['model'],qs[_0x41b6('0x35')](_0x565250[_0x41b6('0x36')]['fields']));_0x5cfb7e['attributes']=_0x5cfb7e[_0x41b6('0x34')][_0x41b6('0x37')]?_0x5cfb7e[_0x41b6('0x34')]:_0x1ac7f5['model'];_0x5cfb7e[_0x41b6('0x39')]=qs[_0x41b6('0x3a')](_0x565250[_0x41b6('0x36')][_0x41b6('0x3a')]);_0x5cfb7e[_0x41b6('0x3e')]=qs['filters'](_[_0x41b6('0x3b')](_0x565250[_0x41b6('0x36')],_0x1ac7f5['filters']));if(_0x565250[_0x41b6('0x36')]['filter']){_0x5cfb7e[_0x41b6('0x3e')]=_[_0x41b6('0x3d')](_0x5cfb7e[_0x41b6('0x3e')],{'$or':_[_0x41b6('0x2b')](_0x5cfb7e['attributes'],function(_0x241c2d){var _0x15221a={};_0x15221a[_0x241c2d]={'$like':'%'+_0x565250[_0x41b6('0x36')]['filter']+'%'};return _0x15221a;})});}_0x5cfb7e=_[_0x41b6('0x3d')]({},_0x5cfb7e,_0x565250[_0x41b6('0x40')]);return _0x2d85c2[_0x41b6('0x5d')](_0x5cfb7e);}})[_0x41b6('0x23')](function(_0x2a62a8){if(_0x2a62a8){_0x30ab14=_0x2a62a8[_0x41b6('0x37')];if(!_0x565250[_0x41b6('0x36')][_0x41b6('0x57')](_0x41b6('0x38'))){_0x5cfb7e['limit']=qs[_0x41b6('0x1a')](_0x565250[_0x41b6('0x36')]['limit']);_0x5cfb7e[_0x41b6('0x18')]=qs[_0x41b6('0x18')](_0x565250[_0x41b6('0x36')][_0x41b6('0x18')]);}return _0x2d85c2[_0x41b6('0x5d')](_0x5cfb7e);}})['then'](function(_0x22df96){if(_0x22df96){return _0x22df96?{'count':_0x30ab14,'rows':_0x22df96}:null;}})[_0x41b6('0x23')](respondWithResult(_0x52e840,null))['catch'](handleError(_0x52e840,null));}; \ No newline at end of file +var _0x2c95=['user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','index','Trigger','rawAttributes','type','key','model','map','query','keys','intersection','length','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x488fa5,_0x1024c5){var _0x2bb695=function(_0x3a4de3){while(--_0x3a4de3){_0x488fa5['push'](_0x488fa5['shift']());}};_0x2bb695(++_0x1024c5);}(_0x2c95,0x13f));var _0x52c9=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x2c95[_0x296897];return _0x2b44ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52c9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52c9('0x1'));var rp=require(_0x52c9('0x2'));var moment=require(_0x52c9('0x3'));var BPromise=require(_0x52c9('0x4'));var Mustache=require(_0x52c9('0x5'));var util=require(_0x52c9('0x6'));var path=require(_0x52c9('0x7'));var sox=require(_0x52c9('0x8'));var csv=require(_0x52c9('0x9'));var ejs=require(_0x52c9('0xa'));var fs=require('fs');var fs_extra=require(_0x52c9('0xb'));var _=require(_0x52c9('0xc'));var squel=require(_0x52c9('0xd'));var crypto=require(_0x52c9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x52c9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x52c9('0x10'));var Papa=require(_0x52c9('0x11'));var Redis=require(_0x52c9('0x12'));var authService=require(_0x52c9('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x52c9('0x14'));var utils=require(_0x52c9('0x15'));var config=require(_0x52c9('0x16'));var licenseUtil=require(_0x52c9('0x17'));var db=require(_0x52c9('0x18'))['db'];function respondWithStatusCode(_0x4e4061,_0x4c61ae){_0x4c61ae=_0x4c61ae||0xcc;return function(_0x53cac8){if(_0x53cac8){return _0x4e4061[_0x52c9('0x19')](_0x4c61ae);}return _0x4e4061[_0x52c9('0x1a')](_0x4c61ae)[_0x52c9('0x1b')]();};}function respondWithResult(_0x35438c,_0x425c89){_0x425c89=_0x425c89||0xc8;return function(_0x4a8ec4){if(_0x4a8ec4){return _0x35438c[_0x52c9('0x1a')](_0x425c89)[_0x52c9('0x1c')](_0x4a8ec4);}};}function respondWithFilteredResult(_0x1ecbc2,_0x17f664){return function(_0x32e81f){if(_0x32e81f){var _0x3fabd4=typeof _0x17f664['offset']===_0x52c9('0x1d')&&typeof _0x17f664['limit']===_0x52c9('0x1d');var _0x1736d6=_0x32e81f['count'];var _0x3c629a=_0x3fabd4?0x0:_0x17f664[_0x52c9('0x1e')];var _0x52d95a=_0x3fabd4?_0x32e81f[_0x52c9('0x1f')]:_0x17f664[_0x52c9('0x1e')]+_0x17f664[_0x52c9('0x20')];var _0x122724;if(_0x52d95a>=_0x1736d6){_0x52d95a=_0x1736d6;_0x122724=0xc8;}else{_0x122724=0xce;}_0x1ecbc2[_0x52c9('0x1a')](_0x122724);return _0x1ecbc2[_0x52c9('0x21')](_0x52c9('0x22'),_0x3c629a+'-'+_0x52d95a+'/'+_0x1736d6)[_0x52c9('0x1c')](_0x32e81f);}return null;};}function patchUpdates(_0x59508b){return function(_0x4d81ef){try{jsonpatch[_0x52c9('0x23')](_0x4d81ef,_0x59508b,!![]);}catch(_0x1ff62d){return BPromise[_0x52c9('0x24')](_0x1ff62d);}return _0x4d81ef[_0x52c9('0x25')]();};}function saveUpdates(_0x324590,_0x16ef01){return function(_0x288eb4){if(_0x288eb4){return _0x288eb4[_0x52c9('0x26')](_0x324590)[_0x52c9('0x27')](function(_0x3a3e3f){return _0x3a3e3f;});}return null;};}function removeEntity(_0x53b444,_0x4b8833){return function(_0x4451e3){if(_0x4451e3){return _0x4451e3[_0x52c9('0x28')]()['then'](function(){var _0x5f2c2a=_0x4451e3[_0x52c9('0x29')]({'plain':!![]});var _0x198073=_0x52c9('0x2a');return db[_0x52c9('0x2b')]['destroy']({'where':{'type':_0x198073,'resourceId':_0x5f2c2a['id']}})[_0x52c9('0x27')](function(){return _0x4451e3;});})[_0x52c9('0x27')](function(){_0x53b444[_0x52c9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4135b7,_0x1f950f){return function(_0x4c1e3b){if(!_0x4c1e3b){_0x4135b7['sendStatus'](0x194);}return _0x4c1e3b;};}function handleError(_0x2fe188,_0x378e73){_0x378e73=_0x378e73||0x1f4;return function(_0x421cec){logger[_0x52c9('0x2c')](_0x421cec['stack']);if(_0x421cec[_0x52c9('0x2d')]){delete _0x421cec[_0x52c9('0x2d')];}_0x2fe188[_0x52c9('0x1a')](_0x378e73)[_0x52c9('0x2e')](_0x421cec);};}exports[_0x52c9('0x2f')]=function(_0xbe17e9,_0x354ea0){var _0x5c0635={},_0x2a4f24={},_0x6aa0f0={'count':0x0,'rows':[]};var _0x3e187e=_['map'](db[_0x52c9('0x30')][_0x52c9('0x31')],function(_0x337089){return{'name':_0x337089['fieldName'],'type':_0x337089[_0x52c9('0x32')][_0x52c9('0x33')]};});_0x2a4f24[_0x52c9('0x34')]=_[_0x52c9('0x35')](_0x3e187e,_0x52c9('0x2d'));_0x2a4f24[_0x52c9('0x36')]=_[_0x52c9('0x37')](_0xbe17e9[_0x52c9('0x36')]);_0x2a4f24['filters']=_[_0x52c9('0x38')](_0x2a4f24[_0x52c9('0x34')],_0x2a4f24[_0x52c9('0x36')]);_0x5c0635['attributes']=_[_0x52c9('0x38')](_0x2a4f24[_0x52c9('0x34')],qs['fields'](_0xbe17e9[_0x52c9('0x36')]['fields']));_0x5c0635['attributes']=_0x5c0635['attributes'][_0x52c9('0x39')]?_0x5c0635[_0x52c9('0x3a')]:_0x2a4f24[_0x52c9('0x34')];if(!_0xbe17e9[_0x52c9('0x36')]['hasOwnProperty'](_0x52c9('0x3b'))){_0x5c0635[_0x52c9('0x20')]=qs[_0x52c9('0x20')](_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x20')]);_0x5c0635[_0x52c9('0x1e')]=qs[_0x52c9('0x1e')](_0xbe17e9[_0x52c9('0x36')]['offset']);}_0x5c0635[_0x52c9('0x3c')]=qs[_0x52c9('0x3d')](_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x3d')]);_0x5c0635[_0x52c9('0x3e')]=qs[_0x52c9('0x3f')](_[_0x52c9('0x40')](_0xbe17e9[_0x52c9('0x36')],_0x2a4f24[_0x52c9('0x3f')]),_0x3e187e);if(_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x41')]){_0x5c0635['where']=_[_0x52c9('0x42')](_0x5c0635['where'],{'$or':_[_0x52c9('0x35')](_0x3e187e,function(_0x34805e){if(_0x34805e[_0x52c9('0x32')]!==_0x52c9('0x43')){var _0x17cf60={};_0x17cf60[_0x34805e['name']]={'$like':'%'+_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x41')]+'%'};return _0x17cf60;}})});}_0x5c0635=_['merge']({},_0x5c0635,_0xbe17e9[_0x52c9('0x44')]);var _0x52f365={'where':_0x5c0635[_0x52c9('0x3e')]};return db['Trigger'][_0x52c9('0x1f')](_0x52f365)['then'](function(_0x3d2b81){_0x6aa0f0[_0x52c9('0x1f')]=_0x3d2b81;if(_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x45')]){_0x5c0635[_0x52c9('0x46')]=[{'all':!![]}];}return db[_0x52c9('0x30')][_0x52c9('0x47')](_0x5c0635);})[_0x52c9('0x27')](function(_0x19b4d6){_0x6aa0f0[_0x52c9('0x48')]=_0x19b4d6;return _0x6aa0f0;})['then'](respondWithFilteredResult(_0x354ea0,_0x5c0635))['catch'](handleError(_0x354ea0,null));};exports[_0x52c9('0x49')]=function(_0x1461cb,_0x2de3e8){var _0x491eda={'raw':![],'where':{'id':_0x1461cb[_0x52c9('0x4a')]['id']}},_0xdd1fd1={};_0xdd1fd1[_0x52c9('0x34')]=_[_0x52c9('0x37')](db['Trigger'][_0x52c9('0x31')]);_0xdd1fd1['query']=_[_0x52c9('0x37')](_0x1461cb['query']);_0xdd1fd1[_0x52c9('0x3f')]=_[_0x52c9('0x38')](_0xdd1fd1[_0x52c9('0x34')],_0xdd1fd1['query']);_0x491eda[_0x52c9('0x3a')]=_['intersection'](_0xdd1fd1[_0x52c9('0x34')],qs[_0x52c9('0x4b')](_0x1461cb[_0x52c9('0x36')]['fields']));_0x491eda['attributes']=_0x491eda[_0x52c9('0x3a')][_0x52c9('0x39')]?_0x491eda[_0x52c9('0x3a')]:_0xdd1fd1[_0x52c9('0x34')];if(_0x1461cb[_0x52c9('0x36')]['includeAll']){_0x491eda[_0x52c9('0x46')]=[{'all':!![]}];}_0x491eda=_[_0x52c9('0x42')]({},_0x491eda,_0x1461cb['options']);return db[_0x52c9('0x30')]['find'](_0x491eda)[_0x52c9('0x27')](handleEntityNotFound(_0x2de3e8,null))['then'](respondWithResult(_0x2de3e8,null))[_0x52c9('0x4c')](handleError(_0x2de3e8,null));};exports[_0x52c9('0x4d')]=function(_0x58d589,_0x49e4e2){return db['Trigger'][_0x52c9('0x4d')](_0x58d589[_0x52c9('0x4e')],{})[_0x52c9('0x27')](function(_0x3e570f){var _0x470576=_0x58d589['user'][_0x52c9('0x29')]({'plain':!![]});if(!_0x470576)throw new Error(_0x52c9('0x4f'));if(_0x470576[_0x52c9('0x50')]===_0x52c9('0x51')){var _0x4abdc6=_0x3e570f[_0x52c9('0x29')]({'plain':!![]});var _0x264925=_0x52c9('0x2a');return db[_0x52c9('0x52')][_0x52c9('0x53')]({'where':{'name':_0x264925,'userProfileId':_0x470576[_0x52c9('0x54')]},'raw':!![]})['then'](function(_0x425c11){if(_0x425c11&&_0x425c11[_0x52c9('0x55')]===0x0){return db[_0x52c9('0x2b')][_0x52c9('0x4d')]({'name':_0x4abdc6['name'],'resourceId':_0x4abdc6['id'],'type':_0x425c11[_0x52c9('0x2d')],'sectionId':_0x425c11['id']},{})[_0x52c9('0x27')](function(){return _0x3e570f;});}else{return _0x3e570f;}})[_0x52c9('0x4c')](function(_0x3d3535){logger[_0x52c9('0x2c')](_0x52c9('0x56'),_0x3d3535);throw _0x3d3535;});}return _0x3e570f;})['then'](respondWithResult(_0x49e4e2,0xc9))['catch'](handleError(_0x49e4e2,null));};exports[_0x52c9('0x26')]=function(_0x265e4e,_0x42f2b7){if(_0x265e4e[_0x52c9('0x4e')]['id']){delete _0x265e4e[_0x52c9('0x4e')]['id'];}return db[_0x52c9('0x30')][_0x52c9('0x53')]({'where':{'id':_0x265e4e[_0x52c9('0x4a')]['id']}})[_0x52c9('0x27')](handleEntityNotFound(_0x42f2b7,null))[_0x52c9('0x27')](saveUpdates(_0x265e4e[_0x52c9('0x4e')],null))[_0x52c9('0x27')](respondWithResult(_0x42f2b7,null))[_0x52c9('0x4c')](handleError(_0x42f2b7,null));};exports[_0x52c9('0x28')]=function(_0x373216,_0x4836e4){return db[_0x52c9('0x30')][_0x52c9('0x53')]({'where':{'id':_0x373216['params']['id']}})[_0x52c9('0x27')](handleEntityNotFound(_0x4836e4,null))[_0x52c9('0x27')](removeEntity(_0x4836e4,null))[_0x52c9('0x4c')](handleError(_0x4836e4,null));};exports[_0x52c9('0x57')]=function(_0x260a8f,_0x1083a9,_0x477626){if(_0x260a8f[_0x52c9('0x4e')]['id']){delete _0x260a8f[_0x52c9('0x4e')]['id'];}return db[_0x52c9('0x30')]['find']({'where':{'id':_0x260a8f[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1083a9,null))[_0x52c9('0x27')](function(_0x4b6e1c){if(_0x4b6e1c){_0x260a8f['body'][_0x52c9('0x58')]=_0x4b6e1c['id'];return db[_0x52c9('0x59')][_0x52c9('0x4d')](_0x260a8f[_0x52c9('0x4e')]);}})[_0x52c9('0x27')](respondWithResult(_0x1083a9,null))[_0x52c9('0x4c')](handleError(_0x1083a9,null));};exports[_0x52c9('0x5a')]=function(_0x6d49d4,_0xdf203,_0x538469){if(_0x6d49d4['body']['id']){delete _0x6d49d4[_0x52c9('0x4e')]['id'];}return db[_0x52c9('0x30')][_0x52c9('0x53')]({'where':{'id':_0x6d49d4[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdf203,null))['then'](function(_0x1af89e){if(_0x1af89e){_0x6d49d4[_0x52c9('0x4e')][_0x52c9('0x5b')]=_0x1af89e['id'];return db[_0x52c9('0x59')]['create'](_0x6d49d4[_0x52c9('0x4e')]);}})[_0x52c9('0x27')](respondWithResult(_0xdf203,null))['catch'](handleError(_0xdf203,null));};exports[_0x52c9('0x5c')]=function(_0x8512ef,_0x314b31,_0x165a37){var _0x2e4460={};var _0x584d3c={};var _0x1f8c15;var _0x35fab2;return db['Trigger'][_0x52c9('0x5d')]({'where':{'id':_0x8512ef[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x314b31,null))['then'](function(_0x2ffd94){if(_0x2ffd94){_0x1f8c15=_0x2ffd94;_0x584d3c[_0x52c9('0x34')]=_[_0x52c9('0x37')](db['Condition'][_0x52c9('0x31')]);_0x584d3c[_0x52c9('0x36')]=_[_0x52c9('0x37')](_0x8512ef[_0x52c9('0x36')]);_0x584d3c[_0x52c9('0x3f')]=_[_0x52c9('0x38')](_0x584d3c[_0x52c9('0x34')],_0x584d3c[_0x52c9('0x36')]);_0x2e4460[_0x52c9('0x3a')]=_[_0x52c9('0x38')](_0x584d3c['model'],qs[_0x52c9('0x4b')](_0x8512ef[_0x52c9('0x36')][_0x52c9('0x4b')]));_0x2e4460[_0x52c9('0x3a')]=_0x2e4460[_0x52c9('0x3a')][_0x52c9('0x39')]?_0x2e4460[_0x52c9('0x3a')]:_0x584d3c[_0x52c9('0x34')];_0x2e4460['order']=qs['sort'](_0x8512ef[_0x52c9('0x36')]['sort']);_0x2e4460['where']=qs['filters'](_[_0x52c9('0x40')](_0x8512ef['query'],_0x584d3c[_0x52c9('0x3f')]));if(_0x8512ef[_0x52c9('0x36')][_0x52c9('0x41')]){_0x2e4460['where']=_[_0x52c9('0x42')](_0x2e4460[_0x52c9('0x3e')],{'$or':_[_0x52c9('0x35')](_0x2e4460[_0x52c9('0x3a')],function(_0x42f949){var _0x3d3ea2={};_0x3d3ea2[_0x42f949]={'$like':'%'+_0x8512ef[_0x52c9('0x36')]['filter']+'%'};return _0x3d3ea2;})});}_0x2e4460=_[_0x52c9('0x42')]({},_0x2e4460,_0x8512ef[_0x52c9('0x44')]);return _0x1f8c15[_0x52c9('0x5c')](_0x2e4460);}})[_0x52c9('0x27')](function(_0x2b6069){if(_0x2b6069){_0x35fab2=_0x2b6069[_0x52c9('0x39')];if(!_0x8512ef[_0x52c9('0x36')][_0x52c9('0x5e')](_0x52c9('0x3b'))){_0x2e4460[_0x52c9('0x20')]=qs[_0x52c9('0x20')](_0x8512ef[_0x52c9('0x36')][_0x52c9('0x20')]);_0x2e4460[_0x52c9('0x1e')]=qs[_0x52c9('0x1e')](_0x8512ef[_0x52c9('0x36')][_0x52c9('0x1e')]);}return _0x1f8c15[_0x52c9('0x5c')](_0x2e4460);}})[_0x52c9('0x27')](function(_0x49b664){if(_0x49b664){return _0x49b664?{'count':_0x35fab2,'rows':_0x49b664}:null;}})['then'](respondWithResult(_0x314b31,null))[_0x52c9('0x4c')](handleError(_0x314b31,null));};exports['getAnyConditions']=function(_0x4dc197,_0x14d56f,_0x4ec7ff){var _0x22c823={};var _0x4fefb1={};var _0x3ad94f;var _0x12e0f8;return db[_0x52c9('0x30')][_0x52c9('0x5d')]({'where':{'id':_0x4dc197[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x14d56f,null))[_0x52c9('0x27')](function(_0x51cbc2){if(_0x51cbc2){_0x3ad94f=_0x51cbc2;_0x4fefb1[_0x52c9('0x34')]=_['keys'](db[_0x52c9('0x59')][_0x52c9('0x31')]);_0x4fefb1[_0x52c9('0x36')]=_[_0x52c9('0x37')](_0x4dc197['query']);_0x4fefb1[_0x52c9('0x3f')]=_[_0x52c9('0x38')](_0x4fefb1[_0x52c9('0x34')],_0x4fefb1['query']);_0x22c823[_0x52c9('0x3a')]=_['intersection'](_0x4fefb1[_0x52c9('0x34')],qs[_0x52c9('0x4b')](_0x4dc197[_0x52c9('0x36')][_0x52c9('0x4b')]));_0x22c823[_0x52c9('0x3a')]=_0x22c823[_0x52c9('0x3a')][_0x52c9('0x39')]?_0x22c823[_0x52c9('0x3a')]:_0x4fefb1[_0x52c9('0x34')];_0x22c823[_0x52c9('0x3c')]=qs[_0x52c9('0x3d')](_0x4dc197[_0x52c9('0x36')][_0x52c9('0x3d')]);_0x22c823[_0x52c9('0x3e')]=qs['filters'](_[_0x52c9('0x40')](_0x4dc197[_0x52c9('0x36')],_0x4fefb1[_0x52c9('0x3f')]));if(_0x4dc197[_0x52c9('0x36')][_0x52c9('0x41')]){_0x22c823[_0x52c9('0x3e')]=_[_0x52c9('0x42')](_0x22c823[_0x52c9('0x3e')],{'$or':_[_0x52c9('0x35')](_0x22c823[_0x52c9('0x3a')],function(_0x4372ac){var _0x188589={};_0x188589[_0x4372ac]={'$like':'%'+_0x4dc197[_0x52c9('0x36')][_0x52c9('0x41')]+'%'};return _0x188589;})});}_0x22c823=_[_0x52c9('0x42')]({},_0x22c823,_0x4dc197[_0x52c9('0x44')]);return _0x3ad94f[_0x52c9('0x5f')](_0x22c823);}})['then'](function(_0x41daad){if(_0x41daad){_0x12e0f8=_0x41daad['length'];if(!_0x4dc197['query'][_0x52c9('0x5e')]('nolimit')){_0x22c823[_0x52c9('0x20')]=qs[_0x52c9('0x20')](_0x4dc197[_0x52c9('0x36')][_0x52c9('0x20')]);_0x22c823['offset']=qs[_0x52c9('0x1e')](_0x4dc197[_0x52c9('0x36')][_0x52c9('0x1e')]);}return _0x3ad94f['getAnyConditions'](_0x22c823);}})[_0x52c9('0x27')](function(_0x1e7a1f){if(_0x1e7a1f){return _0x1e7a1f?{'count':_0x12e0f8,'rows':_0x1e7a1f}:null;}})[_0x52c9('0x27')](respondWithResult(_0x14d56f,null))[_0x52c9('0x4c')](handleError(_0x14d56f,null));};exports[_0x52c9('0x60')]=function(_0x1ef96b,_0x390d57,_0x5cdee4){if(_0x1ef96b[_0x52c9('0x4e')]['id']){delete _0x1ef96b[_0x52c9('0x4e')]['id'];}return db[_0x52c9('0x30')]['find']({'where':{'id':_0x1ef96b[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x390d57,null))['then'](function(_0x1cb1f6){if(_0x1cb1f6){_0x1ef96b[_0x52c9('0x4e')][_0x52c9('0x61')]=_0x1cb1f6['id'];return db[_0x52c9('0x62')]['create'](_0x1ef96b[_0x52c9('0x4e')]);}})[_0x52c9('0x27')](respondWithResult(_0x390d57,null))[_0x52c9('0x4c')](handleError(_0x390d57,null));};exports[_0x52c9('0x63')]=function(_0x469bbe,_0x3cabe2,_0x1440f1){var _0x4ef62b={};var _0x10e349={};var _0x1e6c28;var _0x189ca6;return db[_0x52c9('0x30')][_0x52c9('0x5d')]({'where':{'id':_0x469bbe['params']['id']}})[_0x52c9('0x27')](handleEntityNotFound(_0x3cabe2,null))[_0x52c9('0x27')](function(_0x2112a1){if(_0x2112a1){_0x1e6c28=_0x2112a1;_0x10e349[_0x52c9('0x34')]=_[_0x52c9('0x37')](db[_0x52c9('0x62')][_0x52c9('0x31')]);_0x10e349['query']=_[_0x52c9('0x37')](_0x469bbe[_0x52c9('0x36')]);_0x10e349[_0x52c9('0x3f')]=_[_0x52c9('0x38')](_0x10e349[_0x52c9('0x34')],_0x10e349[_0x52c9('0x36')]);_0x4ef62b['attributes']=_['intersection'](_0x10e349['model'],qs[_0x52c9('0x4b')](_0x469bbe[_0x52c9('0x36')]['fields']));_0x4ef62b[_0x52c9('0x3a')]=_0x4ef62b[_0x52c9('0x3a')]['length']?_0x4ef62b[_0x52c9('0x3a')]:_0x10e349[_0x52c9('0x34')];_0x4ef62b[_0x52c9('0x3c')]=qs['sort'](_0x469bbe[_0x52c9('0x36')][_0x52c9('0x3d')]);_0x4ef62b[_0x52c9('0x3e')]=qs[_0x52c9('0x3f')](_[_0x52c9('0x40')](_0x469bbe[_0x52c9('0x36')],_0x10e349['filters']));if(_0x469bbe[_0x52c9('0x36')][_0x52c9('0x41')]){_0x4ef62b[_0x52c9('0x3e')]=_[_0x52c9('0x42')](_0x4ef62b[_0x52c9('0x3e')],{'$or':_['map'](_0x4ef62b[_0x52c9('0x3a')],function(_0x154940){var _0x21b585={};_0x21b585[_0x154940]={'$like':'%'+_0x469bbe[_0x52c9('0x36')][_0x52c9('0x41')]+'%'};return _0x21b585;})});}_0x4ef62b=_[_0x52c9('0x42')]({},_0x4ef62b,_0x469bbe[_0x52c9('0x44')]);return _0x1e6c28[_0x52c9('0x63')](_0x4ef62b);}})['then'](function(_0x4e85bc){if(_0x4e85bc){_0x189ca6=_0x4e85bc[_0x52c9('0x39')];if(!_0x469bbe['query'][_0x52c9('0x5e')]('nolimit')){_0x4ef62b[_0x52c9('0x20')]=qs['limit'](_0x469bbe[_0x52c9('0x36')]['limit']);_0x4ef62b[_0x52c9('0x1e')]=qs[_0x52c9('0x1e')](_0x469bbe[_0x52c9('0x36')][_0x52c9('0x1e')]);}return _0x1e6c28['getActions'](_0x4ef62b);}})['then'](function(_0x3a136c){if(_0x3a136c){return _0x3a136c?{'count':_0x189ca6,'rows':_0x3a136c}:null;}})[_0x52c9('0x27')](respondWithResult(_0x3cabe2,null))[_0x52c9('0x4c')](handleError(_0x3cabe2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 1b54fa2..876677a 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1f0=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','util'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xe1f0,0x1c2));var _0x0e1f=function(_0x25ba65,_0x2613f1){_0x25ba65=_0x25ba65-0x0;var _0x129fc5=_0xe1f0[_0x25ba65];return _0x129fc5;};'use strict';var _=require('lodash');var util=require(_0x0e1f('0x0'));var logger=require(_0x0e1f('0x1'))('api');var moment=require(_0x0e1f('0x2'));var BPromise=require(_0x0e1f('0x3'));var rp=require(_0x0e1f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e1f('0x5'));var config=require(_0x0e1f('0x6'));var attributes=require(_0x0e1f('0x7'));module['exports']=function(_0x260585,_0x569a5a){return _0x260585[_0x0e1f('0x8')](_0x0e1f('0x9'),attributes,{'tableName':_0x0e1f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ee=['exports','define','Trigger','tools_triggers','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x3da267,_0x1037b0){var _0x467fdb=function(_0x2ede7a){while(--_0x2ede7a){_0x3da267['push'](_0x3da267['shift']());}};_0x467fdb(++_0x1037b0);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x548cfa,_0x55d716){_0x548cfa=_0x548cfa-0x0;var _0x7b3d22=_0xd8ee[_0x548cfa];return _0x7b3d22;};'use strict';var _=require(_0xed8e('0x0'));var util=require('util');var logger=require(_0xed8e('0x1'))(_0xed8e('0x2'));var moment=require(_0xed8e('0x3'));var BPromise=require('bluebird');var rp=require(_0xed8e('0x4'));var fs=require('fs');var path=require(_0xed8e('0x5'));var rimraf=require(_0xed8e('0x6'));var config=require(_0xed8e('0x7'));var attributes=require(_0xed8e('0x8'));module[_0xed8e('0x9')]=function(_0x576b26,_0x3a030a){return _0x576b26[_0xed8e('0xa')](_0xed8e('0xb'),attributes,{'tableName':_0xed8e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 75c1f11..07891c3 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 _0x8f99=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','model','attributes','find','map','ShowTrigger','util','moment'];(function(_0x2ec22d,_0xac91c3){var _0x39dbc3=function(_0x5aaab4){while(--_0x5aaab4){_0x2ec22d['push'](_0x2ec22d['shift']());}};_0x39dbc3(++_0xac91c3);}(_0x8f99,0x130));var _0x98f9=function(_0x474b39,_0x5d508e){_0x474b39=_0x474b39-0x0;var _0x191d94=_0x8f99[_0x474b39];return _0x191d94;};'use strict';var _=require('lodash');var util=require(_0x98f9('0x0'));var moment=require(_0x98f9('0x1'));var BPromise=require(_0x98f9('0x2'));var rs=require(_0x98f9('0x3'));var fs=require('fs');var Redis=require(_0x98f9('0x4'));var db=require(_0x98f9('0x5'))['db'];var utils=require(_0x98f9('0x6'));var logger=require('../../config/logger')(_0x98f9('0x7'));var config=require(_0x98f9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x98f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b785d,_0x57a0f3,_0x21ef94){return new BPromise(function(_0x3e414b,_0x45270f){return client['request'](_0x3b785d,_0x21ef94)[_0x98f9('0xa')](function(_0xef04ea){logger[_0x98f9('0xb')](_0x98f9('0xc'),_0x57a0f3,_0x98f9('0xd'));logger[_0x98f9('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x57a0f3,_0x98f9('0xd'),JSON[_0x98f9('0xf')](_0xef04ea));if(_0xef04ea['error']){if(_0xef04ea[_0x98f9('0x10')][_0x98f9('0x11')]===0x1f4){logger['error'](_0x98f9('0xc'),_0x57a0f3,_0xef04ea[_0x98f9('0x10')][_0x98f9('0x12')]);return _0x45270f(_0xef04ea['error'][_0x98f9('0x12')]);}logger['error'](_0x98f9('0xc'),_0x57a0f3,_0xef04ea[_0x98f9('0x10')][_0x98f9('0x12')]);return _0x3e414b(_0xef04ea['error'][_0x98f9('0x12')]);}else{logger[_0x98f9('0xb')](_0x98f9('0xc'),_0x57a0f3,_0x98f9('0xd'));_0x3e414b(_0xef04ea[_0x98f9('0x13')][_0x98f9('0x12')]);}})[_0x98f9('0x14')](function(_0x230178){logger[_0x98f9('0x10')](_0x98f9('0xc'),_0x57a0f3,_0x230178);_0x45270f(_0x230178);});});}exports[_0x98f9('0x15')]=function(_0x5c3aa2){var _0x562c5a=this;return new Promise(function(_0x3ca91a,_0x299896){return db[_0x98f9('0x16')][_0x98f9('0x17')]({'raw':_0x5c3aa2[_0x98f9('0x18')]?_0x5c3aa2['options'][_0x98f9('0x19')]===undefined?!![]:![]:!![],'where':_0x5c3aa2[_0x98f9('0x18')]?_0x5c3aa2[_0x98f9('0x18')][_0x98f9('0x1a')]||null:null,'attributes':_0x5c3aa2[_0x98f9('0x18')]?_0x5c3aa2[_0x98f9('0x18')]['attributes']||null:null,'limit':_0x5c3aa2[_0x98f9('0x18')]?_0x5c3aa2[_0x98f9('0x18')][_0x98f9('0x1b')]||null:null,'include':_0x5c3aa2[_0x98f9('0x18')]?_0x5c3aa2['options'][_0x98f9('0x1c')]?_['map'](_0x5c3aa2['options']['include'],function(_0x5d239d){return{'model':db[_0x5d239d[_0x98f9('0x1d')]],'as':_0x5d239d['as'],'attributes':_0x5d239d[_0x98f9('0x1e')],'include':_0x5d239d[_0x98f9('0x1c')]?_['map'](_0x5d239d[_0x98f9('0x1c')],function(_0x4252af){return{'model':db[_0x4252af['model']],'as':_0x4252af['as'],'attributes':_0x4252af['attributes'],'include':_0x4252af['include']?_['map'](_0x4252af[_0x98f9('0x1c')],function(_0x1b33de){return{'model':db[_0x1b33de[_0x98f9('0x1d')]],'as':_0x1b33de['as'],'attributes':_0x1b33de[_0x98f9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x98f9('0xa')](function(_0x403612){logger['info'](_0x98f9('0x15'),_0x5c3aa2);logger[_0x98f9('0xe')](_0x98f9('0x15'),_0x5c3aa2,JSON[_0x98f9('0xf')](_0x403612));_0x3ca91a(_0x403612);})[_0x98f9('0x14')](function(_0x4d0793){logger['error'](_0x98f9('0x15'),_0x4d0793['message'],_0x5c3aa2);_0x299896(_0x562c5a[_0x98f9('0x10')](0x1f4,_0x4d0793[_0x98f9('0x12')]));});});};exports['ShowTrigger']=function(_0x1a4de0){var _0x50c326=this;return new Promise(function(_0x5e624c,_0x3d4a3e){return db[_0x98f9('0x16')][_0x98f9('0x1f')]({'raw':_0x1a4de0[_0x98f9('0x18')]?_0x1a4de0[_0x98f9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1a4de0[_0x98f9('0x18')]?_0x1a4de0[_0x98f9('0x18')][_0x98f9('0x1a')]||null:null,'attributes':_0x1a4de0[_0x98f9('0x18')]?_0x1a4de0['options'][_0x98f9('0x1e')]||null:null,'include':_0x1a4de0['options']?_0x1a4de0['options'][_0x98f9('0x1c')]?_[_0x98f9('0x20')](_0x1a4de0[_0x98f9('0x18')]['include'],function(_0x4d318f){return{'model':db[_0x4d318f[_0x98f9('0x1d')]],'as':_0x4d318f['as'],'attributes':_0x4d318f[_0x98f9('0x1e')],'include':_0x4d318f[_0x98f9('0x1c')]?_['map'](_0x4d318f[_0x98f9('0x1c')],function(_0x37d278){return{'model':db[_0x37d278[_0x98f9('0x1d')]],'as':_0x37d278['as'],'attributes':_0x37d278[_0x98f9('0x1e')],'include':_0x37d278[_0x98f9('0x1c')]?_[_0x98f9('0x20')](_0x37d278[_0x98f9('0x1c')],function(_0xb54c00){return{'model':db[_0xb54c00['model']],'as':_0xb54c00['as'],'attributes':_0xb54c00[_0x98f9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x98f9('0xa')](function(_0x46d0d6){logger[_0x98f9('0xb')](_0x98f9('0x21'),_0x1a4de0);logger[_0x98f9('0xe')](_0x98f9('0x21'),_0x1a4de0,JSON[_0x98f9('0xf')](_0x46d0d6));_0x5e624c(_0x46d0d6);})[_0x98f9('0x14')](function(_0x4c4681){logger[_0x98f9('0x10')](_0x98f9('0x21'),_0x4c4681['message'],_0x1a4de0);_0x3d4a3e(_0x50c326[_0x98f9('0x10')](0x1f4,_0x4c4681[_0x98f9('0x12')]));});});}; \ No newline at end of file +var _0x46e6=['info','debug','request\x20sent','error','message','result','Trigger,\x20%s,\x20%s','GetTrigger','findAll','options','raw','attributes','limit','include','model','map','then','stringify','catch','ShowTrigger','Trigger','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3e8ba4,_0x2d1af1){var _0x5721d9=function(_0x4477b9){while(--_0x4477b9){_0x3e8ba4['push'](_0x3e8ba4['shift']());}};_0x5721d9(++_0x2d1af1);}(_0x46e6,0xe8));var _0x646e=function(_0x500684,_0x113728){_0x500684=_0x500684-0x0;var _0x4f8830=_0x46e6[_0x500684];return _0x4f8830;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x646e('0x0'));var BPromise=require(_0x646e('0x1'));var rs=require(_0x646e('0x2'));var fs=require('fs');var Redis=require(_0x646e('0x3'));var db=require(_0x646e('0x4'))['db'];var utils=require(_0x646e('0x5'));var logger=require(_0x646e('0x6'))(_0x646e('0x7'));var config=require(_0x646e('0x8'));var jayson=require(_0x646e('0x9'));var client=jayson[_0x646e('0xa')][_0x646e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x223d1d,_0xb374dc,_0x147d6c){return new BPromise(function(_0x12b4f0,_0x455394){return client[_0x646e('0xc')](_0x223d1d,_0x147d6c)['then'](function(_0x5c13c7){logger[_0x646e('0xd')]('Trigger,\x20%s,\x20%s',_0xb374dc,'request\x20sent');logger[_0x646e('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0xb374dc,_0x646e('0xf'),JSON['stringify'](_0x5c13c7));if(_0x5c13c7[_0x646e('0x10')]){if(_0x5c13c7[_0x646e('0x10')]['code']===0x1f4){logger[_0x646e('0x10')]('Trigger,\x20%s,\x20%s',_0xb374dc,_0x5c13c7[_0x646e('0x10')][_0x646e('0x11')]);return _0x455394(_0x5c13c7['error'][_0x646e('0x11')]);}logger[_0x646e('0x10')]('Trigger,\x20%s,\x20%s',_0xb374dc,_0x5c13c7[_0x646e('0x10')][_0x646e('0x11')]);return _0x12b4f0(_0x5c13c7[_0x646e('0x10')][_0x646e('0x11')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0xb374dc,'request\x20sent');_0x12b4f0(_0x5c13c7[_0x646e('0x12')][_0x646e('0x11')]);}})['catch'](function(_0x2d23b8){logger['error'](_0x646e('0x13'),_0xb374dc,_0x2d23b8);_0x455394(_0x2d23b8);});});}exports[_0x646e('0x14')]=function(_0x49274b){var _0x526994=this;return new Promise(function(_0x19e786,_0x500d02){return db['Trigger'][_0x646e('0x15')]({'raw':_0x49274b[_0x646e('0x16')]?_0x49274b['options'][_0x646e('0x17')]===undefined?!![]:![]:!![],'where':_0x49274b['options']?_0x49274b[_0x646e('0x16')]['where']||null:null,'attributes':_0x49274b[_0x646e('0x16')]?_0x49274b[_0x646e('0x16')][_0x646e('0x18')]||null:null,'limit':_0x49274b[_0x646e('0x16')]?_0x49274b['options'][_0x646e('0x19')]||null:null,'include':_0x49274b['options']?_0x49274b[_0x646e('0x16')][_0x646e('0x1a')]?_['map'](_0x49274b[_0x646e('0x16')][_0x646e('0x1a')],function(_0x3b285b){return{'model':db[_0x3b285b[_0x646e('0x1b')]],'as':_0x3b285b['as'],'attributes':_0x3b285b['attributes'],'include':_0x3b285b[_0x646e('0x1a')]?_['map'](_0x3b285b['include'],function(_0x544f1b){return{'model':db[_0x544f1b[_0x646e('0x1b')]],'as':_0x544f1b['as'],'attributes':_0x544f1b[_0x646e('0x18')],'include':_0x544f1b[_0x646e('0x1a')]?_[_0x646e('0x1c')](_0x544f1b[_0x646e('0x1a')],function(_0x5e9eb3){return{'model':db[_0x5e9eb3['model']],'as':_0x5e9eb3['as'],'attributes':_0x5e9eb3[_0x646e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x646e('0x1d')](function(_0x4ffff6){logger['info']('GetTrigger',_0x49274b);logger['debug'](_0x646e('0x14'),_0x49274b,JSON[_0x646e('0x1e')](_0x4ffff6));_0x19e786(_0x4ffff6);})[_0x646e('0x1f')](function(_0x5f3450){logger[_0x646e('0x10')](_0x646e('0x14'),_0x5f3450[_0x646e('0x11')],_0x49274b);_0x500d02(_0x526994['error'](0x1f4,_0x5f3450[_0x646e('0x11')]));});});};exports[_0x646e('0x20')]=function(_0xf29ea3){var _0x22b8b7=this;return new Promise(function(_0x591dc3,_0x584930){return db[_0x646e('0x21')][_0x646e('0x22')]({'raw':_0xf29ea3['options']?_0xf29ea3[_0x646e('0x16')][_0x646e('0x17')]===undefined?!![]:![]:!![],'where':_0xf29ea3[_0x646e('0x16')]?_0xf29ea3['options']['where']||null:null,'attributes':_0xf29ea3[_0x646e('0x16')]?_0xf29ea3[_0x646e('0x16')][_0x646e('0x18')]||null:null,'include':_0xf29ea3[_0x646e('0x16')]?_0xf29ea3[_0x646e('0x16')][_0x646e('0x1a')]?_['map'](_0xf29ea3[_0x646e('0x16')][_0x646e('0x1a')],function(_0x3fba66){return{'model':db[_0x3fba66[_0x646e('0x1b')]],'as':_0x3fba66['as'],'attributes':_0x3fba66[_0x646e('0x18')],'include':_0x3fba66[_0x646e('0x1a')]?_[_0x646e('0x1c')](_0x3fba66['include'],function(_0x26505b){return{'model':db[_0x26505b[_0x646e('0x1b')]],'as':_0x26505b['as'],'attributes':_0x26505b[_0x646e('0x18')],'include':_0x26505b[_0x646e('0x1a')]?_['map'](_0x26505b['include'],function(_0x4c1f7e){return{'model':db[_0x4c1f7e[_0x646e('0x1b')]],'as':_0x4c1f7e['as'],'attributes':_0x4c1f7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x646e('0x1d')](function(_0x5321ea){logger[_0x646e('0xd')]('ShowTrigger',_0xf29ea3);logger['debug'](_0x646e('0x20'),_0xf29ea3,JSON[_0x646e('0x1e')](_0x5321ea));_0x591dc3(_0x5321ea);})[_0x646e('0x1f')](function(_0x3e23d6){logger[_0x646e('0x10')](_0x646e('0x20'),_0x3e23d6[_0x646e('0x11')],_0xf29ea3);_0x584930(_0x22b8b7[_0x646e('0x10')](0x1f4,_0x3e23d6[_0x646e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 984fe38..192c600 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 _0xe9b4=['create','put','/:id','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','/:id/clone'];(function(_0x3c5830,_0x56afa4){var _0x1d8e3f=function(_0x5c240f){while(--_0x5c240f){_0x3c5830['push'](_0x3c5830['shift']());}};_0x1d8e3f(++_0x56afa4);}(_0xe9b4,0x8a));var _0x4e9b=function(_0x354220,_0x139406){_0x354220=_0x354220-0x0;var _0x595cf5=_0xe9b4[_0x354220];return _0x595cf5;};'use strict';var multer=require(_0x4e9b('0x0'));var util=require(_0x4e9b('0x1'));var path=require(_0x4e9b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4e9b('0x3')]();var fs_extra=require(_0x4e9b('0x4'));var auth=require(_0x4e9b('0x5'));var interaction=require(_0x4e9b('0x6'));var config=require(_0x4e9b('0x7'));var controller=require('./trunk.controller');router['get']('/',auth[_0x4e9b('0x8')](),controller[_0x4e9b('0x9')]);router[_0x4e9b('0xa')]('/:id',auth[_0x4e9b('0x8')](),controller[_0x4e9b('0xb')]);router[_0x4e9b('0xc')](_0x4e9b('0xd'),auth[_0x4e9b('0x8')](),controller['clone']);router[_0x4e9b('0xc')]('/',auth[_0x4e9b('0x8')](),controller[_0x4e9b('0xe')]);router[_0x4e9b('0xf')](_0x4e9b('0x10'),auth[_0x4e9b('0x8')](),controller[_0x4e9b('0x11')]);router[_0x4e9b('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9220=['fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','index','get','show','post','/:id/clone','isAuthenticated','clone','create','put','/:id','update','exports','util','path','connect-timeout','express','Router'];(function(_0x1b685d,_0x41d26a){var _0x550db7=function(_0x3b61b5){while(--_0x3b61b5){_0x1b685d['push'](_0x1b685d['shift']());}};_0x550db7(++_0x41d26a);}(_0x9220,0x14b));var _0x0922=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x9220[_0x35885a];return _0xe86249;};'use strict';var multer=require('multer');var util=require(_0x0922('0x0'));var path=require(_0x0922('0x1'));var timeout=require(_0x0922('0x2'));var express=require(_0x0922('0x3'));var router=express[_0x0922('0x4')]();var fs_extra=require(_0x0922('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0922('0x6'));var config=require(_0x0922('0x7'));var controller=require(_0x0922('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0922('0x9')]);router[_0x0922('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0922('0xb')]);router[_0x0922('0xc')](_0x0922('0xd'),auth[_0x0922('0xe')](),controller[_0x0922('0xf')]);router[_0x0922('0xc')]('/',auth[_0x0922('0xe')](),controller[_0x0922('0x10')]);router[_0x0922('0x11')](_0x0922('0x12'),auth[_0x0922('0xe')](),controller[_0x0922('0x13')]);router['delete'](_0x0922('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x0922('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index cb557a7..66d9591 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 _0xf4c0=['refuse','uac','uas','certificate','active','passive','actpass','dynamic','BOOLEAN','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','rfc2833','info','inband','nonat','update','yes','setDataValue','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\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','always'];(function(_0x21f964,_0xc2d1d3){var _0x1d4231=function(_0x447623){while(--_0x447623){_0x21f964['push'](_0x21f964['shift']());}};_0x1d4231(++_0xc2d1d3);}(_0xf4c0,0x181));var _0x0f4c=function(_0x13ab50,_0x4be161){_0x13ab50=_0x13ab50-0x0;var _0x53b183=_0xf4c0[_0x13ab50];return _0x53b183;};'use strict';var Sequelize=require('sequelize');module[_0x0f4c('0x0')]={'name':{'type':Sequelize[_0x0f4c('0x1')],'allowNull':![],'unique':_0x0f4c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x4'),_0x0f4c('0x5'),'peer'),'allowNull':![],'defaultValue':_0x0f4c('0x4')},'context':{'type':Sequelize[_0x0f4c('0x1')],'allowNull':![],'defaultValue':_0x0f4c('0x6')},'callingpres':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x7'),_0x0f4c('0x8'),_0x0f4c('0x9'),_0x0f4c('0xa'),'PROHIB_NOT_SCREENED',_0x0f4c('0xb'),_0x0f4c('0xc'),_0x0f4c('0xd'))},'deny':{'type':Sequelize[_0x0f4c('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x0f4c('0x1')]},'md5secret':{'type':Sequelize[_0x0f4c('0x1')]},'remotesecret':{'type':Sequelize[_0x0f4c('0x1')]},'transport':{'type':Sequelize[_0x0f4c('0x1')],'defaultValue':_0x0f4c('0xe'),'set':function(_0x464c77){this['setDataValue'](_0x0f4c('0xf'),_0x464c77?_0x464c77[_0x0f4c('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x0f4c('0xf'))?this[_0x0f4c('0x11')](_0x0f4c('0xf'))[_0x0f4c('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x13'),_0x0f4c('0x14'),'shortinfo',_0x0f4c('0x15'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x0f4c('0x3')]('yes','no',_0x0f4c('0x16'),_0x0f4c('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x0f4c('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0f4c('0x1')]},'directmediadeny':{'type':Sequelize[_0x0f4c('0x1')]},'nat':{'type':Sequelize[_0x0f4c('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x10ccb5){this[_0x0f4c('0x19')]('nat',_0x10ccb5?_0x10ccb5[_0x0f4c('0x10')](','):null);},'get':function(){return this[_0x0f4c('0x11')](_0x0f4c('0x1a'))?this[_0x0f4c('0x11')](_0x0f4c('0x1a'))['split'](','):null;},'comment':_0x0f4c('0x1b')},'callgroup':{'type':Sequelize[_0x0f4c('0x1')]},'namedcallgroup':{'type':Sequelize[_0x0f4c('0x1')]},'pickupgroup':{'type':Sequelize[_0x0f4c('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0f4c('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0f4c('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0f4c('0x1')],'defaultValue':_0x0f4c('0x1c')},'allow':{'type':Sequelize[_0x0f4c('0x1')],'allowNull':![],'defaultValue':_0x0f4c('0x1d'),'set':function(_0x218dd9){this['setDataValue'](_0x0f4c('0x1e'),_0x218dd9?_0x218dd9[_0x0f4c('0x10')](';'):_0x0f4c('0x1d'));},'get':function(){return this[_0x0f4c('0x11')](_0x0f4c('0x1e'))?this[_0x0f4c('0x11')](_0x0f4c('0x1e'))[_0x0f4c('0x12')](';'):null;},'comment':_0x0f4c('0x1f')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x0f4c('0x1')],'defaultValue':_0x0f4c('0x20'),'set':function(_0x44ffa5){this['setDataValue'](_0x0f4c('0x21'),_0x44ffa5?_0x44ffa5[_0x0f4c('0x10')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue'](_0x0f4c('0x21'))[_0x0f4c('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no',_0x0f4c('0x22'))},'promiscredir':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x0f4c('0x23')},'amaflags':{'type':Sequelize[_0x0f4c('0x1')]},'callcounter':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no'),'defaultValue':_0x0f4c('0x18')},'busylevel':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x0f4c('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0f4c('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x0f4c('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0f4c('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x0f4c('0x18'),'no',_0x0f4c('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no')},'mailbox':{'type':Sequelize[_0x0f4c('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x0f4c('0x26'),'originate')},'session_expires':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x27'),_0x0f4c('0x28')),'defaultValue':_0x0f4c('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x0f4c('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x0f4c('0x1')]},'port':{'type':Sequelize[_0x0f4c('0x24')](0x5)},'qualify':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no'),'defaultValue':_0x0f4c('0x18')},'keepalive':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x0f4c('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0f4c('0x1')]},'callbackextension':{'type':Sequelize[_0x0f4c('0x1')]},'timert1':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x0f4c('0x1')]},'contactdeny':{'type':Sequelize[_0x0f4c('0x1')]},'contactacl':{'type':Sequelize[_0x0f4c('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x0f4c('0x1')]},'maxforwards':{'type':Sequelize[_0x0f4c('0x24')](0xb)},'encryption':{'type':Sequelize[_0x0f4c('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x0f4c('0x18'),'no')},'icesupport':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x0f4c('0x3')]('yes','no','fingerprint',_0x0f4c('0x29'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x0f4c('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x0f4c('0x1')]},'dtlscipher':{'type':Sequelize[_0x0f4c('0x1')]},'dtlscafile':{'type':Sequelize[_0x0f4c('0x1')]},'dtlscapath':{'type':Sequelize[_0x0f4c('0x1')]},'dtlssetup':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x2a'),_0x0f4c('0x2b'),_0x0f4c('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0f4c('0x1')]},'usereqphone':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0f4c('0x1')]},'recordofffeature':{'type':Sequelize[_0x0f4c('0x1')]},'call_limit':{'type':Sequelize[_0x0f4c('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x0f4c('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no')},'vmexten':{'type':Sequelize[_0x0f4c('0x1')]},'mohinterpret':{'type':Sequelize[_0x0f4c('0x1')]},'mohsuggest':{'type':Sequelize[_0x0f4c('0x1')]},'parkinglot':{'type':Sequelize[_0x0f4c('0x1')]},'description':{'type':Sequelize[_0x0f4c('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x0f4c('0x2d')},'canreinvite':{'type':Sequelize[_0x0f4c('0x3')](_0x0f4c('0x18'),'no',_0x0f4c('0x16'),_0x0f4c('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0f4c('0x1')]},'otherFields':{'type':Sequelize[_0x0f4c('0x1')]},'active':{'type':Sequelize[_0x0f4c('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0f4c('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xe157=['inband','auto','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','INTEGER','refuse','originate','uac','uas','pai','certificate','passive','dynamic','nonat','update,nonat','exports','STRING','name','friend','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info'];(function(_0x4401d0,_0x284d82){var _0x380ee3=function(_0x4c1f06){while(--_0x4c1f06){_0x4401d0['push'](_0x4401d0['shift']());}};_0x380ee3(++_0x284d82);}(_0xe157,0x14f));var _0x7e15=function(_0x1dc5d2,_0xe79646){_0x1dc5d2=_0x1dc5d2-0x0;var _0x2a377e=_0xe157[_0x1dc5d2];return _0x2a377e;};'use strict';var Sequelize=require('sequelize');module[_0x7e15('0x0')]={'name':{'type':Sequelize[_0x7e15('0x1')],'allowNull':![],'unique':_0x7e15('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x7e15('0x3'),'user',_0x7e15('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7e15('0x1')],'allowNull':![],'defaultValue':_0x7e15('0x5')},'callingpres':{'type':Sequelize[_0x7e15('0x6')]('ALLOWED_NOT_SCREENED',_0x7e15('0x7'),'ALLOWED_FAILED_SCREEN',_0x7e15('0x8'),_0x7e15('0x9'),_0x7e15('0xa'),_0x7e15('0xb'),_0x7e15('0xc'))},'deny':{'type':Sequelize[_0x7e15('0x1')]},'permit':{'type':Sequelize[_0x7e15('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x7e15('0xd'),'set':function(_0x14c606){this[_0x7e15('0xe')](_0x7e15('0xf'),_0x14c606?_0x14c606[_0x7e15('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x7e15('0xf'))?this[_0x7e15('0x11')](_0x7e15('0xf'))[_0x7e15('0x12')](','):null;},'comment':_0x7e15('0x13')},'dtmfmode':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x14'),_0x7e15('0x15'),'shortinfo',_0x7e15('0x16'),_0x7e15('0x17')),'defaultValue':_0x7e15('0x14')},'directmedia':{'type':Sequelize[_0x7e15('0x6')]('yes','no','nonat',_0x7e15('0x18'),_0x7e15('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x7e15('0x1')]},'nat':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':_0x7e15('0x1b'),'set':function(_0x1d963c){this[_0x7e15('0xe')](_0x7e15('0x1c'),_0x1d963c?_0x1d963c['join'](','):null);},'get':function(){return this[_0x7e15('0x11')](_0x7e15('0x1c'))?this[_0x7e15('0x11')](_0x7e15('0x1c'))['split'](','):null;},'comment':_0x7e15('0x1d')},'callgroup':{'type':Sequelize[_0x7e15('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x7e15('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x7e15('0x1')]},'language':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7e15('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':_0x7e15('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x36f9dd){this[_0x7e15('0xe')](_0x7e15('0x1f'),_0x36f9dd?_0x36f9dd['join'](';'):_0x7e15('0x20'));},'get':function(){return this[_0x7e15('0x11')](_0x7e15('0x1f'))?this[_0x7e15('0x11')]('allow')['split'](';'):null;},'comment':_0x7e15('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x7e15('0x22'),'set':function(_0x4e8d68){this['setDataValue'](_0x7e15('0x23'),_0x4e8d68?_0x4e8d68[_0x7e15('0x10')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue']('insecure')[_0x7e15('0x12')](','):null;},'comment':_0x7e15('0x24')},'trustrpid':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no',_0x7e15('0x25'))},'promiscredir':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':_0x7e15('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x7e15('0x6')]('yes','no'),'defaultValue':_0x7e15('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no',_0x7e15('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7e15('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7e15('0x6')]('yes','no')},'mailbox':{'type':Sequelize[_0x7e15('0x1')]},'session_timers':{'type':Sequelize[_0x7e15('0x6')]('accept',_0x7e15('0x29'),_0x7e15('0x2a'))},'session_expires':{'type':Sequelize[_0x7e15('0x28')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x2b'),'uas'),'defaultValue':_0x7e15('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x7e15('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7e15('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x7e15('0x28')](0xb)},'defaultip':{'type':Sequelize[_0x7e15('0x1')]},'defaultuser':{'type':Sequelize[_0x7e15('0x1')]},'rtptimeout':{'type':Sequelize[_0x7e15('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7e15('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no',_0x7e15('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7e15('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x7e15('0x28')](0xb)},'timerb':{'type':Sequelize[_0x7e15('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7e15('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0x7e15('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7e15('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x7e15('0x1')]},'use_q850_reason':{'type':Sequelize[_0x7e15('0x1')]},'maxforwards':{'type':Sequelize[_0x7e15('0x28')](0xb)},'encryption':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no','fingerprint',_0x7e15('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x7e15('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7e15('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x7e15('0x1')]},'dtlscipher':{'type':Sequelize[_0x7e15('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7e15('0x1')]},'dtlssetup':{'type':Sequelize[_0x7e15('0x6')]('active',_0x7e15('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7e15('0x1')]},'usereqphone':{'type':Sequelize[_0x7e15('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x7e15('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x7e15('0x1')]},'mohinterpret':{'type':Sequelize[_0x7e15('0x1')]},'mohsuggest':{'type':Sequelize[_0x7e15('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7e15('0x1')]},'host':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':_0x7e15('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no',_0x7e15('0x31'),_0x7e15('0x18'),_0x7e15('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7e15('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 398d9cd..2451f39 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 _0xdace=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','get','Trunks','UserProfileResource','destroy','stack','name','send','index','Trunk','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','rows','show','params','keys','find','clone','options','omit','createdAt','updatedAt','body','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','findAll','Reload','update','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs'];(function(_0x2f43dc,_0x338c96){var _0x1c60cf=function(_0x6317c4){while(--_0x6317c4){_0x2f43dc['push'](_0x2f43dc['shift']());}};_0x1c60cf(++_0x338c96);}(_0xdace,0xc5));var _0xedac=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xdace[_0x117f4c];return _0x2b24e9;};'use strict';var emlformat=require(_0xedac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedac('0x1'));var jsonpatch=require(_0xedac('0x2'));var rp=require(_0xedac('0x3'));var moment=require('moment');var BPromise=require(_0xedac('0x4'));var Mustache=require(_0xedac('0x5'));var util=require(_0xedac('0x6'));var path=require(_0xedac('0x7'));var sox=require('sox');var csv=require(_0xedac('0x8'));var ejs=require(_0xedac('0x9'));var fs=require('fs');var fs_extra=require(_0xedac('0xa'));var _=require('lodash');var squel=require(_0xedac('0xb'));var crypto=require(_0xedac('0xc'));var jsforce=require(_0xedac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedac('0x8'));var querystring=require(_0xedac('0xe'));var Papa=require(_0xedac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedac('0x10'));var as=require(_0xedac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedac('0x12'));var utils=require(_0xedac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xedac('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xedac('0x15'));var client=jayson[_0xedac('0x16')][_0xedac('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x342186,_0x9a79a0,_0x473c3e,_0x28444a){return new BPromise(function(_0x11f0b0,_0x593030){var _0x110546=_0x28444a||client;return _0x110546[_0xedac('0x18')](_0x342186,_0x473c3e)[_0xedac('0x19')](function(_0x2676c3){logger[_0xedac('0x1a')]('Trunk,\x20%s,\x20%s',_0x9a79a0,_0xedac('0x1b'));logger['debug'](_0xedac('0x1c'),_0x9a79a0,_0xedac('0x1b'),JSON[_0xedac('0x1d')](_0x2676c3));if(_0x2676c3[_0xedac('0x1e')]){if(_0x2676c3['error']['code']===0x1f4){logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x593030(_0x2676c3['error']['message']);}logger[_0xedac('0x1e')](_0xedac('0x1f'),_0x9a79a0,_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);return _0x11f0b0(_0x2676c3[_0xedac('0x1e')][_0xedac('0x20')]);}else{logger[_0xedac('0x1a')](_0xedac('0x1f'),_0x9a79a0,'request\x20sent');_0x11f0b0(_0x2676c3[_0xedac('0x21')]['message']);}})[_0xedac('0x22')](function(_0x14fc02){logger['error'](_0xedac('0x1f'),_0x9a79a0,_0x14fc02);_0x593030(_0x14fc02);});});}function respondWithStatusCode(_0x404b8d,_0x1c87bf){_0x1c87bf=_0x1c87bf||0xcc;return function(_0x1e5e47){if(_0x1e5e47){return _0x404b8d[_0xedac('0x23')](_0x1c87bf);}return _0x404b8d[_0xedac('0x24')](_0x1c87bf)['end']();};}function respondWithResult(_0x3114a1,_0x87d343){_0x87d343=_0x87d343||0xc8;return function(_0x37563f){if(_0x37563f){return _0x3114a1[_0xedac('0x24')](_0x87d343)[_0xedac('0x25')](_0x37563f);}};}function respondWithFilteredResult(_0x453a3c,_0x40ba53){return function(_0x26c6f7){if(_0x26c6f7){var _0x409825=typeof _0x40ba53[_0xedac('0x26')]==='undefined'&&typeof _0x40ba53[_0xedac('0x27')]===_0xedac('0x28');var _0x19aed3=_0x26c6f7['count'];var _0x313e06=_0x409825?0x0:_0x40ba53['offset'];var _0x524514=_0x409825?_0x26c6f7[_0xedac('0x29')]:_0x40ba53[_0xedac('0x26')]+_0x40ba53[_0xedac('0x27')];var _0x14522a;if(_0x524514>=_0x19aed3){_0x524514=_0x19aed3;_0x14522a=0xc8;}else{_0x14522a=0xce;}_0x453a3c['status'](_0x14522a);return _0x453a3c['set'](_0xedac('0x2a'),_0x313e06+'-'+_0x524514+'/'+_0x19aed3)[_0xedac('0x25')](_0x26c6f7);}return null;};}function patchUpdates(_0x24b182){return function(_0x2ee8d7){try{jsonpatch[_0xedac('0x2b')](_0x2ee8d7,_0x24b182,!![]);}catch(_0x17fcf3){return BPromise[_0xedac('0x2c')](_0x17fcf3);}return _0x2ee8d7['save']();};}function saveUpdates(_0x3bc910,_0x26418a){return function(_0x2cbe33){if(_0x2cbe33){return _0x2cbe33['update'](_0x3bc910)[_0xedac('0x19')](function(_0x1213dc){return _0x1213dc;});}return null;};}function removeEntity(_0x5665d8,_0x3583cd){return function(_0x2c622a){if(_0x2c622a){return _0x2c622a['destroy']()[_0xedac('0x19')](function(){var _0x1e82da=_0x2c622a[_0xedac('0x2d')]({'plain':!![]});var _0x195f78=_0xedac('0x2e');return db[_0xedac('0x2f')][_0xedac('0x30')]({'where':{'type':_0x195f78,'resourceId':_0x1e82da['id']}})[_0xedac('0x19')](function(){return _0x2c622a;});})[_0xedac('0x19')](function(){_0x5665d8[_0xedac('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9ef574,_0xf5cd99){return function(_0x2a87ae){if(!_0x2a87ae){_0x9ef574[_0xedac('0x23')](0x194);}return _0x2a87ae;};}function handleError(_0x15815e,_0x1d2f45){_0x1d2f45=_0x1d2f45||0x1f4;return function(_0x107431){logger[_0xedac('0x1e')](_0x107431[_0xedac('0x31')]);if(_0x107431[_0xedac('0x32')]){delete _0x107431[_0xedac('0x32')];}_0x15815e[_0xedac('0x24')](_0x1d2f45)[_0xedac('0x33')](_0x107431);};}exports[_0xedac('0x34')]=function(_0xcf7c0c,_0x527878){var _0x1ddcc1={},_0x42c2c9={},_0x20d997={'count':0x0,'rows':[]};var _0x27481c=_['map'](db[_0xedac('0x35')][_0xedac('0x36')],function(_0x16b9d5){return{'name':_0x16b9d5['fieldName'],'type':_0x16b9d5[_0xedac('0x37')][_0xedac('0x38')]};});_0x42c2c9[_0xedac('0x39')]=_['map'](_0x27481c,_0xedac('0x32'));_0x42c2c9[_0xedac('0x3a')]=_['keys'](_0xcf7c0c[_0xedac('0x3a')]);_0x42c2c9[_0xedac('0x3b')]=_['intersection'](_0x42c2c9[_0xedac('0x39')],_0x42c2c9['query']);_0x1ddcc1[_0xedac('0x3c')]=_[_0xedac('0x3d')](_0x42c2c9[_0xedac('0x39')],qs[_0xedac('0x3e')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x3e')]));_0x1ddcc1['attributes']=_0x1ddcc1[_0xedac('0x3c')][_0xedac('0x3f')]?_0x1ddcc1[_0xedac('0x3c')]:_0x42c2c9[_0xedac('0x39')];if(!_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x40')](_0xedac('0x41'))){_0x1ddcc1[_0xedac('0x27')]=qs[_0xedac('0x27')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x27')]);_0x1ddcc1[_0xedac('0x26')]=qs[_0xedac('0x26')](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x26')]);}_0x1ddcc1[_0xedac('0x42')]=qs['sort'](_0xcf7c0c[_0xedac('0x3a')][_0xedac('0x43')]);_0x1ddcc1[_0xedac('0x44')]=qs['filters'](_['pick'](_0xcf7c0c['query'],_0x42c2c9[_0xedac('0x3b')]),_0x27481c);if(_0xcf7c0c[_0xedac('0x3a')]['filter']){_0x1ddcc1[_0xedac('0x44')]=_['merge'](_0x1ddcc1[_0xedac('0x44')],{'$or':_['map'](_0x27481c,function(_0x13d51d){if(_0x13d51d[_0xedac('0x37')]!==_0xedac('0x45')){var _0x114b2e={};_0x114b2e[_0x13d51d[_0xedac('0x32')]]={'$like':'%'+_0xcf7c0c['query']['filter']+'%'};return _0x114b2e;}})});}_0x1ddcc1=_[_0xedac('0x46')]({},_0x1ddcc1,_0xcf7c0c['options']);var _0x39b159={'where':_0x1ddcc1[_0xedac('0x44')]};return db[_0xedac('0x35')]['count'](_0x39b159)[_0xedac('0x19')](function(_0x45189f){_0x20d997[_0xedac('0x29')]=_0x45189f;if(_0xcf7c0c['query'][_0xedac('0x47')]){_0x1ddcc1[_0xedac('0x48')]=[{'all':!![]}];}return db[_0xedac('0x35')]['findAll'](_0x1ddcc1);})['then'](function(_0x2cb3ca){_0x20d997[_0xedac('0x49')]=_0x2cb3ca;return _0x20d997;})['then'](respondWithFilteredResult(_0x527878,_0x1ddcc1))['catch'](handleError(_0x527878,null));};exports[_0xedac('0x4a')]=function(_0x38425e,_0x4e81bc){var _0x16a45a={'raw':![],'where':{'id':_0x38425e[_0xedac('0x4b')]['id']}},_0x4e0638={};_0x4e0638[_0xedac('0x39')]=_[_0xedac('0x4c')](db[_0xedac('0x35')][_0xedac('0x36')]);_0x4e0638[_0xedac('0x3a')]=_['keys'](_0x38425e[_0xedac('0x3a')]);_0x4e0638[_0xedac('0x3b')]=_['intersection'](_0x4e0638[_0xedac('0x39')],_0x4e0638[_0xedac('0x3a')]);_0x16a45a[_0xedac('0x3c')]=_['intersection'](_0x4e0638['model'],qs[_0xedac('0x3e')](_0x38425e[_0xedac('0x3a')]['fields']));_0x16a45a[_0xedac('0x3c')]=_0x16a45a[_0xedac('0x3c')][_0xedac('0x3f')]?_0x16a45a[_0xedac('0x3c')]:_0x4e0638[_0xedac('0x39')];if(_0x38425e[_0xedac('0x3a')][_0xedac('0x47')]){_0x16a45a[_0xedac('0x48')]=[{'all':!![]}];}_0x16a45a=_['merge']({},_0x16a45a,_0x38425e['options']);return db[_0xedac('0x35')][_0xedac('0x4d')](_0x16a45a)[_0xedac('0x19')](handleEntityNotFound(_0x4e81bc,null))['then'](respondWithResult(_0x4e81bc,null))[_0xedac('0x22')](handleError(_0x4e81bc,null));};exports[_0xedac('0x4e')]=function(_0x5cb635,_0x4f44e){var _0x276c23={'where':{'id':_0x5cb635['params']['id']}},_0x4bc336={};_0x4bc336['model']=_[_0xedac('0x4c')](db['Trunk'][_0xedac('0x36')]);_0x276c23['attributes']=_['intersection'](_0x4bc336[_0xedac('0x39')],qs[_0xedac('0x3e')](_0x5cb635[_0xedac('0x3a')][_0xedac('0x3e')]));_0x276c23[_0xedac('0x3c')]=_0x276c23['attributes'][_0xedac('0x3f')]?_0x276c23['attributes']:_0x4bc336[_0xedac('0x39')];if(_0x5cb635[_0xedac('0x3a')][_0xedac('0x47')]){_0x276c23[_0xedac('0x48')]=[{'all':!![]}];}_0x276c23=_[_0xedac('0x46')]({},_0x276c23,_0x5cb635[_0xedac('0x4f')]);return db[_0xedac('0x35')]['find'](_0x276c23)[_0xedac('0x19')](handleEntityNotFound(_0x4f44e,null))[_0xedac('0x19')](function(_0x1e1847){if(_0x1e1847){var _0xbc0ff5=_0x1e1847[_0xedac('0x2d')]({'plain':!![]});_0xbc0ff5=qs[_0xedac('0x50')](_0xbc0ff5,['id',_0xedac('0x51'),_0xedac('0x52')]);_0x5cb635[_0xedac('0x53')]=_[_0xedac('0x50')](_0x5cb635['body'],['id','createdAt',_0xedac('0x52')]);return db[_0xedac('0x35')][_0xedac('0x54')](_[_0xedac('0x46')](_0xbc0ff5,_0x5cb635[_0xedac('0x53')]),{'include':_0x5cb635['query'][_0xedac('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x8d20e7){var _0x15b168=_0x5cb635['user']['get']({'plain':!![]});if(!_0x15b168)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15b168[_0xedac('0x55')]===_0xedac('0x56')){var _0x2523bb=_0x8d20e7[_0xedac('0x2d')]({'plain':!![]});var _0x103632=_0xedac('0x2e');return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0x103632,'userProfileId':_0x15b168[_0xedac('0x58')]},'raw':!![]})[_0xedac('0x19')](function(_0x4fdff8){if(_0x4fdff8&&_0x4fdff8[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')]['create']({'name':_0x2523bb[_0xedac('0x32')],'resourceId':_0x2523bb['id'],'type':_0x4fdff8[_0xedac('0x32')],'sectionId':_0x4fdff8['id']},{})[_0xedac('0x19')](function(){return _0x8d20e7;});}else{return _0x8d20e7;}})[_0xedac('0x22')](function(_0x32d9d8){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x32d9d8);throw _0x32d9d8;});}return _0x8d20e7;});}})[_0xedac('0x19')](respondWithResult(_0x4f44e,0xc9))[_0xedac('0x22')](handleError(_0x4f44e,null));};exports[_0xedac('0x54')]=function(_0xd34f0c,_0x207b40,_0x77fc48){var _0x3a1d68;return db[_0xedac('0x35')][_0xedac('0x54')](_0xd34f0c[_0xedac('0x53')],{'raw':!![]})[_0xedac('0x19')](function(_0x493214){_0x3a1d68=_0x493214;return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x5458c3){var _0x2380ee=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x58ad68=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x300f52=ejs['render'](_0x2380ee,{'trunks':_0x5458c3||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x300f52);if(_0x3a1d68[_0xedac('0x62')]){var _0x218670=ejs[_0xedac('0x63')](_0x58ad68,{'trunks':_0x5458c3||[]});fs['writeFileSync'](_0xedac('0x64'),_0x218670);}})['then'](function(){return respondWithRpcPromise('Reload',_0xedac('0x54'),{'module':_0xedac('0x65')});})[_0xedac('0x19')](function(){var _0x104c27=_0xd34f0c[_0xedac('0x56')]['get']({'plain':!![]});if(!_0x104c27)throw new Error(_0xedac('0x66'));if(_0x104c27['role']===_0xedac('0x56')){var _0x358032=_0x3a1d68[_0xedac('0x2d')]({'plain':!![]});return db[_0xedac('0x57')][_0xedac('0x4d')]({'where':{'name':_0xedac('0x2e'),'userProfileId':_0x104c27['userProfileId']},'raw':!![]})[_0xedac('0x19')](function(_0x1242a2){if(_0x1242a2&&_0x1242a2[_0xedac('0x59')]===0x0){return db[_0xedac('0x2f')][_0xedac('0x54')]({'name':_0x358032[_0xedac('0x32')],'resourceId':_0x358032['id'],'type':_0x1242a2[_0xedac('0x32')],'sectionId':_0x1242a2['id']},{})[_0xedac('0x19')](function(){return _0x3a1d68;});}else{return _0x3a1d68;}})[_0xedac('0x22')](function(_0x134a7a){logger[_0xedac('0x1e')](_0xedac('0x5a'),_0x134a7a);throw _0x134a7a;});}return _0x3a1d68;})['then'](respondWithResult(_0x207b40,0xc9))[_0xedac('0x22')](handleError(_0x207b40,null));};exports['update']=function(_0x5cba66,_0xdf86e8,_0x484b6b){var _0x197dad;return db[_0xedac('0x35')]['find']({'where':{'id':_0x5cba66[_0xedac('0x4b')]['id']}})['then'](handleEntityNotFound(_0xdf86e8,null))[_0xedac('0x19')](saveUpdates(_0x5cba66['body'],null))[_0xedac('0x19')](function(_0x5e512f){if(_0x5e512f){_0x197dad=_0x5e512f;return db[_0xedac('0x35')][_0xedac('0x67')]({'raw':!![]});}})['then'](function(_0x1dfc0b){if(_0x1dfc0b){var _0x4cec80=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config[_0xedac('0x5d')],_0xedac('0x5e')),_0xedac('0x5f'));var _0x4be552=fs[_0xedac('0x5b')](path['join'](config[_0xedac('0x5d')],_0xedac('0x60')),_0xedac('0x5f'));var _0x448066=ejs[_0xedac('0x63')](_0x4cec80,{'trunks':_0x1dfc0b||[]});fs[_0xedac('0x61')]('/etc/asterisk/sip_xcally_trunks.conf',_0x448066);var _0x1d8f28=ejs[_0xedac('0x63')](_0x4be552,{'trunks':_0x1dfc0b||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x1d8f28);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x69'),{'module':_0xedac('0x65')});}return null;})[_0xedac('0x19')](function(_0x5ad133){if(_0x5ad133){return _0x197dad;}})['then'](respondWithResult(_0xdf86e8,null))[_0xedac('0x22')](handleError(_0xdf86e8,null));};exports[_0xedac('0x30')]=function(_0x4dd9bd,_0x3926ed,_0x472e8a){var _0x3b25ef;return db[_0xedac('0x35')][_0xedac('0x4d')]({'where':{'id':_0x4dd9bd[_0xedac('0x4b')]['id']}})[_0xedac('0x19')](handleEntityNotFound(_0x3926ed,null))[_0xedac('0x19')](removeEntity(_0x3926ed,null))[_0xedac('0x19')](function(){return db[_0xedac('0x35')]['findAll']({'raw':!![]});})[_0xedac('0x19')](function(_0x22c47b){var _0x230d51=fs[_0xedac('0x5b')](path[_0xedac('0x5c')](config['root'],_0xedac('0x5e')),_0xedac('0x5f'));var _0x35a3c4=fs[_0xedac('0x5b')](path['join'](config['root'],_0xedac('0x60')),_0xedac('0x5f'));var _0x1f541a=ejs[_0xedac('0x63')](_0x230d51,{'trunks':_0x22c47b});var _0x20f7e6=ejs[_0xedac('0x63')](_0x35a3c4,{'trunks':_0x22c47b});fs[_0xedac('0x61')](_0xedac('0x6a'),_0x1f541a);fs[_0xedac('0x61')](_0xedac('0x64'),_0x20f7e6);return respondWithRpcPromise(_0xedac('0x68'),_0xedac('0x30'),{'module':'chan_sip.so'});})[_0xedac('0x22')](handleError(_0x3926ed,null));}; \ No newline at end of file +var _0xf2ca=['omit','createdAt','body','updatedAt','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','get','Trunks','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','Trunk','find','clone'];(function(_0x3e6af8,_0x116679){var _0x6319b1=function(_0x3f079c){while(--_0x3f079c){_0x3e6af8['push'](_0x3e6af8['shift']());}};_0x6319b1(++_0x116679);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0xf2ca[_0x3aeb36];return _0xa2ef21;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];var jayson=require(_0xaf2c('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15ccb4,_0x8eaf9b,_0x935959,_0x18a8a5){return new BPromise(function(_0x293ca6,_0x152c73){var _0x214f47=_0x18a8a5||client;return _0x214f47[_0xaf2c('0x19')](_0x15ccb4,_0x935959)[_0xaf2c('0x1a')](function(_0x1d0633){logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,_0xaf2c('0x1d'));logger[_0xaf2c('0x1e')](_0xaf2c('0x1f'),_0x8eaf9b,'request\x20sent',JSON[_0xaf2c('0x20')](_0x1d0633));if(_0x1d0633['error']){if(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x22')]===0x1f4){logger[_0xaf2c('0x21')]('Trunk,\x20%s,\x20%s',_0x8eaf9b,_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);return _0x152c73(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}logger[_0xaf2c('0x21')](_0xaf2c('0x1c'),_0x8eaf9b,_0x1d0633['error'][_0xaf2c('0x23')]);return _0x293ca6(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}else{logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,'request\x20sent');_0x293ca6(_0x1d0633[_0xaf2c('0x24')][_0xaf2c('0x23')]);}})[_0xaf2c('0x25')](function(_0x4be6ed){logger['error'](_0xaf2c('0x1c'),_0x8eaf9b,_0x4be6ed);_0x152c73(_0x4be6ed);});});}function respondWithStatusCode(_0x303546,_0x1cafad){_0x1cafad=_0x1cafad||0xcc;return function(_0x99f78d){if(_0x99f78d){return _0x303546['sendStatus'](_0x1cafad);}return _0x303546[_0xaf2c('0x26')](_0x1cafad)[_0xaf2c('0x27')]();};}function respondWithResult(_0x3a0145,_0x3c1ae6){_0x3c1ae6=_0x3c1ae6||0xc8;return function(_0xe929b5){if(_0xe929b5){return _0x3a0145[_0xaf2c('0x26')](_0x3c1ae6)[_0xaf2c('0x28')](_0xe929b5);}};}function respondWithFilteredResult(_0x4a8dd8,_0x29f8b0){return function(_0x2051be){if(_0x2051be){var _0x36f37c=typeof _0x29f8b0[_0xaf2c('0x29')]==='undefined'&&typeof _0x29f8b0[_0xaf2c('0x2a')]==='undefined';var _0x38db1b=_0x2051be[_0xaf2c('0x2b')];var _0x15466b=_0x36f37c?0x0:_0x29f8b0['offset'];var _0x2747bb=_0x36f37c?_0x2051be[_0xaf2c('0x2b')]:_0x29f8b0[_0xaf2c('0x29')]+_0x29f8b0['limit'];var _0xe18ba7;if(_0x2747bb>=_0x38db1b){_0x2747bb=_0x38db1b;_0xe18ba7=0xc8;}else{_0xe18ba7=0xce;}_0x4a8dd8[_0xaf2c('0x26')](_0xe18ba7);return _0x4a8dd8[_0xaf2c('0x2c')](_0xaf2c('0x2d'),_0x15466b+'-'+_0x2747bb+'/'+_0x38db1b)['json'](_0x2051be);}return null;};}function patchUpdates(_0x3da072){return function(_0x4072ff){try{jsonpatch[_0xaf2c('0x2e')](_0x4072ff,_0x3da072,!![]);}catch(_0x51a49c){return BPromise['reject'](_0x51a49c);}return _0x4072ff[_0xaf2c('0x2f')]();};}function saveUpdates(_0x4c9b4f,_0x39c0ed){return function(_0x5e7247){if(_0x5e7247){return _0x5e7247[_0xaf2c('0x30')](_0x4c9b4f)[_0xaf2c('0x1a')](function(_0x4ffbb9){return _0x4ffbb9;});}return null;};}function removeEntity(_0x1408e3,_0x5403f8){return function(_0x54db57){if(_0x54db57){return _0x54db57[_0xaf2c('0x31')]()[_0xaf2c('0x1a')](function(){var _0x211a69=_0x54db57[_0xaf2c('0x32')]({'plain':!![]});var _0x2d6ed7=_0xaf2c('0x33');return db['UserProfileResource'][_0xaf2c('0x31')]({'where':{'type':_0x2d6ed7,'resourceId':_0x211a69['id']}})['then'](function(){return _0x54db57;});})[_0xaf2c('0x1a')](function(){_0x1408e3['status'](0xcc)[_0xaf2c('0x27')]();});}};}function handleEntityNotFound(_0x59f686,_0x2f3d16){return function(_0x4e877e){if(!_0x4e877e){_0x59f686[_0xaf2c('0x34')](0x194);}return _0x4e877e;};}function handleError(_0x4b9c6b,_0x30fd87){_0x30fd87=_0x30fd87||0x1f4;return function(_0x356402){logger[_0xaf2c('0x21')](_0x356402[_0xaf2c('0x35')]);if(_0x356402[_0xaf2c('0x36')]){delete _0x356402['name'];}_0x4b9c6b['status'](_0x30fd87)[_0xaf2c('0x37')](_0x356402);};}exports[_0xaf2c('0x38')]=function(_0x409700,_0xa44813){var _0x4eeecf={},_0x316238={},_0x573db3={'count':0x0,'rows':[]};var _0xa1248e=_[_0xaf2c('0x39')](db['Trunk'][_0xaf2c('0x3a')],function(_0x24668d){return{'name':_0x24668d[_0xaf2c('0x3b')],'type':_0x24668d[_0xaf2c('0x3c')][_0xaf2c('0x3d')]};});_0x316238[_0xaf2c('0x3e')]=_[_0xaf2c('0x39')](_0xa1248e,_0xaf2c('0x36'));_0x316238[_0xaf2c('0x3f')]=_[_0xaf2c('0x40')](_0x409700[_0xaf2c('0x3f')]);_0x316238[_0xaf2c('0x41')]=_[_0xaf2c('0x42')](_0x316238['model'],_0x316238['query']);_0x4eeecf['attributes']=_[_0xaf2c('0x42')](_0x316238[_0xaf2c('0x3e')],qs[_0xaf2c('0x43')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x4eeecf[_0xaf2c('0x44')]=_0x4eeecf['attributes'][_0xaf2c('0x45')]?_0x4eeecf[_0xaf2c('0x44')]:_0x316238[_0xaf2c('0x3e')];if(!_0x409700['query']['hasOwnProperty'](_0xaf2c('0x46'))){_0x4eeecf['limit']=qs[_0xaf2c('0x2a')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x2a')]);_0x4eeecf[_0xaf2c('0x29')]=qs['offset'](_0x409700[_0xaf2c('0x3f')]['offset']);}_0x4eeecf[_0xaf2c('0x47')]=qs[_0xaf2c('0x48')](_0x409700['query'][_0xaf2c('0x48')]);_0x4eeecf['where']=qs[_0xaf2c('0x41')](_[_0xaf2c('0x49')](_0x409700[_0xaf2c('0x3f')],_0x316238[_0xaf2c('0x41')]),_0xa1248e);if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]){_0x4eeecf[_0xaf2c('0x4b')]=_[_0xaf2c('0x4c')](_0x4eeecf[_0xaf2c('0x4b')],{'$or':_['map'](_0xa1248e,function(_0x51d751){if(_0x51d751[_0xaf2c('0x3c')]!=='VIRTUAL'){var _0x4ad36e={};_0x4ad36e[_0x51d751['name']]={'$like':'%'+_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]+'%'};return _0x4ad36e;}})});}_0x4eeecf=_[_0xaf2c('0x4c')]({},_0x4eeecf,_0x409700[_0xaf2c('0x4d')]);var _0x599b2d={'where':_0x4eeecf[_0xaf2c('0x4b')]};return db['Trunk'][_0xaf2c('0x2b')](_0x599b2d)['then'](function(_0x166c26){_0x573db3[_0xaf2c('0x2b')]=_0x166c26;if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x4eeecf[_0xaf2c('0x4f')]=[{'all':!![]}];}return db['Trunk'][_0xaf2c('0x50')](_0x4eeecf);})[_0xaf2c('0x1a')](function(_0x4b3ca4){_0x573db3['rows']=_0x4b3ca4;return _0x573db3;})[_0xaf2c('0x1a')](respondWithFilteredResult(_0xa44813,_0x4eeecf))['catch'](handleError(_0xa44813,null));};exports[_0xaf2c('0x51')]=function(_0x23642b,_0x17b9ec){var _0x315b9f={'raw':![],'where':{'id':_0x23642b[_0xaf2c('0x52')]['id']}},_0x367112={};_0x367112[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x367112[_0xaf2c('0x3f')]=_['keys'](_0x23642b[_0xaf2c('0x3f')]);_0x367112[_0xaf2c('0x41')]=_['intersection'](_0x367112['model'],_0x367112['query']);_0x315b9f[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x367112['model'],qs[_0xaf2c('0x43')](_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x315b9f[_0xaf2c('0x44')]=_0x315b9f[_0xaf2c('0x44')][_0xaf2c('0x45')]?_0x315b9f[_0xaf2c('0x44')]:_0x367112['model'];if(_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x315b9f['include']=[{'all':!![]}];}_0x315b9f=_[_0xaf2c('0x4c')]({},_0x315b9f,_0x23642b[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x315b9f)[_0xaf2c('0x1a')](handleEntityNotFound(_0x17b9ec,null))[_0xaf2c('0x1a')](respondWithResult(_0x17b9ec,null))[_0xaf2c('0x25')](handleError(_0x17b9ec,null));};exports[_0xaf2c('0x55')]=function(_0x19b82d,_0x300254){var _0x133678={'where':{'id':_0x19b82d[_0xaf2c('0x52')]['id']}},_0x10a270={};_0x10a270[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x133678[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x10a270[_0xaf2c('0x3e')],qs['fields'](_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x133678[_0xaf2c('0x44')]=_0x133678['attributes'][_0xaf2c('0x45')]?_0x133678['attributes']:_0x10a270[_0xaf2c('0x3e')];if(_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x133678[_0xaf2c('0x4f')]=[{'all':!![]}];}_0x133678=_[_0xaf2c('0x4c')]({},_0x133678,_0x19b82d[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x133678)[_0xaf2c('0x1a')](handleEntityNotFound(_0x300254,null))['then'](function(_0x41d08b){if(_0x41d08b){var _0x400dcd=_0x41d08b[_0xaf2c('0x32')]({'plain':!![]});_0x400dcd=qs[_0xaf2c('0x56')](_0x400dcd,['id',_0xaf2c('0x57'),'updatedAt']);_0x19b82d[_0xaf2c('0x58')]=_[_0xaf2c('0x56')](_0x19b82d['body'],['id',_0xaf2c('0x57'),_0xaf2c('0x59')]);return db['Trunk']['create'](_[_0xaf2c('0x4c')](_0x400dcd,_0x19b82d[_0xaf2c('0x58')]),{'include':_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x36b6f0){var _0x3f48f1=_0x19b82d['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3f48f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f48f1[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x16e9f4=_0x36b6f0[_0xaf2c('0x32')]({'plain':!![]});var _0x1a297e=_0xaf2c('0x33');return db[_0xaf2c('0x5c')][_0xaf2c('0x54')]({'where':{'name':_0x1a297e,'userProfileId':_0x3f48f1[_0xaf2c('0x5d')]},'raw':!![]})[_0xaf2c('0x1a')](function(_0x53ba41){if(_0x53ba41&&_0x53ba41[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')][_0xaf2c('0x60')]({'name':_0x16e9f4[_0xaf2c('0x36')],'resourceId':_0x16e9f4['id'],'type':_0x53ba41[_0xaf2c('0x36')],'sectionId':_0x53ba41['id']},{})['then'](function(){return _0x36b6f0;});}else{return _0x36b6f0;}})[_0xaf2c('0x25')](function(_0x28b09f){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x28b09f);throw _0x28b09f;});}return _0x36b6f0;});}})[_0xaf2c('0x1a')](respondWithResult(_0x300254,0xc9))['catch'](handleError(_0x300254,null));};exports['create']=function(_0x1166c9,_0x1ead61,_0x5849f8){var _0xf96361;return db[_0xaf2c('0x53')][_0xaf2c('0x60')](_0x1166c9['body'],{'raw':!![]})[_0xaf2c('0x1a')](function(_0x2bd845){_0xf96361=_0x2bd845;return db[_0xaf2c('0x53')][_0xaf2c('0x50')]({'raw':!![]});})['then'](function(_0x32d552){var _0x26129c=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2767c7=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x5d965c=ejs[_0xaf2c('0x67')](_0x26129c,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5d965c);if(_0xf96361[_0xaf2c('0x69')]){var _0x5a95ac=ejs['render'](_0x2767c7,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6a'),_0x5a95ac);}})[_0xaf2c('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xaf2c('0x1a')](function(){var _0x3e972c=_0x1166c9['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3e972c)throw new Error(_0xaf2c('0x6b'));if(_0x3e972c[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x6e1837=_0xf96361[_0xaf2c('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xaf2c('0x54')]({'where':{'name':_0xaf2c('0x33'),'userProfileId':_0x3e972c[_0xaf2c('0x5d')]},'raw':!![]})['then'](function(_0xc9dd21){if(_0xc9dd21&&_0xc9dd21[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')]['create']({'name':_0x6e1837[_0xaf2c('0x36')],'resourceId':_0x6e1837['id'],'type':_0xc9dd21[_0xaf2c('0x36')],'sectionId':_0xc9dd21['id']},{})[_0xaf2c('0x1a')](function(){return _0xf96361;});}else{return _0xf96361;}})[_0xaf2c('0x25')](function(_0x491160){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x491160);throw _0x491160;});}return _0xf96361;})[_0xaf2c('0x1a')](respondWithResult(_0x1ead61,0xc9))['catch'](handleError(_0x1ead61,null));};exports['update']=function(_0x427ece,_0x1b7dc1,_0x5571eb){var _0x3675d9;return db[_0xaf2c('0x53')]['find']({'where':{'id':_0x427ece[_0xaf2c('0x52')]['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1b7dc1,null))[_0xaf2c('0x1a')](saveUpdates(_0x427ece[_0xaf2c('0x58')],null))[_0xaf2c('0x1a')](function(_0x4af252){if(_0x4af252){_0x3675d9=_0x4af252;return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});}})[_0xaf2c('0x1a')](function(_0x55b568){if(_0x55b568){var _0x4f378e=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x4b9fdc=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x6c')),_0xaf2c('0x66'));var _0x41c707=ejs['render'](_0x4f378e,{'trunks':_0x55b568||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x41c707);var _0x483774=ejs['render'](_0x4b9fdc,{'trunks':_0x55b568||[]});fs['writeFileSync'](_0xaf2c('0x6a'),_0x483774);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x30'),{'module':_0xaf2c('0x6f')});}return null;})['then'](function(_0x19fbd5){if(_0x19fbd5){return _0x3675d9;}})[_0xaf2c('0x1a')](respondWithResult(_0x1b7dc1,null))[_0xaf2c('0x25')](handleError(_0x1b7dc1,null));};exports[_0xaf2c('0x31')]=function(_0x4ddf95,_0x1e8fc0,_0x23aeac){var _0x41590;return db[_0xaf2c('0x53')][_0xaf2c('0x54')]({'where':{'id':_0x4ddf95['params']['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1e8fc0,null))[_0xaf2c('0x1a')](removeEntity(_0x1e8fc0,null))['then'](function(){return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});})[_0xaf2c('0x1a')](function(_0x5bce65){var _0x1e6a12=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2a3cb4=fs[_0xaf2c('0x62')](path['join'](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x7724cc=ejs['render'](_0x1e6a12,{'trunks':_0x5bce65});var _0x4a9ea8=ejs[_0xaf2c('0x67')](_0x2a3cb4,{'trunks':_0x5bce65});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x7724cc);fs['writeFileSync'](_0xaf2c('0x6a'),_0x4a9ea8);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x31'),{'module':'chan_sip.so'});})['catch'](handleError(_0x1e8fc0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index fa3f0d9..c9db31e 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 _0x4b4e=['tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','Trunk'];(function(_0xb92a00,_0x210172){var _0x39b437=function(_0x176675){while(--_0x176675){_0xb92a00['push'](_0xb92a00['shift']());}};_0x39b437(++_0x210172);}(_0x4b4e,0x1e2));var _0xe4b4=function(_0x21cc35,_0x4e715c){_0x21cc35=_0x21cc35-0x0;var _0x4cae2b=_0x4b4e[_0x21cc35];return _0x4cae2b;};'use strict';var _=require(_0xe4b4('0x0'));var util=require(_0xe4b4('0x1'));var logger=require(_0xe4b4('0x2'))(_0xe4b4('0x3'));var moment=require(_0xe4b4('0x4'));var BPromise=require(_0xe4b4('0x5'));var rp=require(_0xe4b4('0x6'));var fs=require('fs');var path=require(_0xe4b4('0x7'));var rimraf=require(_0xe4b4('0x8'));var config=require(_0xe4b4('0x9'));var attributes=require(_0xe4b4('0xa'));module['exports']=function(_0x276616,_0x4f1903){return _0x276616['define'](_0xe4b4('0xb'),attributes,{'tableName':_0xe4b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3503=['request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','bluebird'];(function(_0x354663,_0x24387d){var _0x4206f2=function(_0x284eb6){while(--_0x284eb6){_0x354663['push'](_0x354663['shift']());}};_0x4206f2(++_0x24387d);}(_0x3503,0x18d));var _0x3350=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3503[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x3350('0x0'));var util=require(_0x3350('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3350('0x2'));var rp=require(_0x3350('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3350('0x4'));var config=require(_0x3350('0x5'));var attributes=require(_0x3350('0x6'));module[_0x3350('0x7')]=function(_0x3ae8f0,_0x3bff30){return _0x3ae8f0[_0x3350('0x8')]('Trunk',attributes,{'tableName':_0x3350('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index fe45b72..c6f85c8 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 _0x9631=['stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','map','model','include','debug','ShowTrunk','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x9631,0x83));var _0x1963=function(_0x32b301,_0x380389){_0x32b301=_0x32b301-0x0;var _0xd0c417=_0x9631[_0x32b301];return _0xd0c417;};'use strict';var _=require(_0x1963('0x0'));var util=require(_0x1963('0x1'));var moment=require('moment');var BPromise=require(_0x1963('0x2'));var rs=require(_0x1963('0x3'));var fs=require('fs');var Redis=require(_0x1963('0x4'));var db=require(_0x1963('0x5'))['db'];var utils=require(_0x1963('0x6'));var logger=require(_0x1963('0x7'))(_0x1963('0x8'));var config=require(_0x1963('0x9'));var jayson=require(_0x1963('0xa'));var client=jayson[_0x1963('0xb')][_0x1963('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f3c70,_0x58d656,_0x43041a){return new BPromise(function(_0x3054eb,_0x5cc3a4){return client[_0x1963('0xd')](_0x1f3c70,_0x43041a)['then'](function(_0x4f3676){logger[_0x1963('0xe')](_0x1963('0xf'),_0x58d656,_0x1963('0x10'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x58d656,_0x1963('0x10'),JSON[_0x1963('0x11')](_0x4f3676));if(_0x4f3676[_0x1963('0x12')]){if(_0x4f3676[_0x1963('0x12')][_0x1963('0x13')]===0x1f4){logger['error'](_0x1963('0xf'),_0x58d656,_0x4f3676[_0x1963('0x12')][_0x1963('0x14')]);return _0x5cc3a4(_0x4f3676['error'][_0x1963('0x14')]);}logger[_0x1963('0x12')](_0x1963('0xf'),_0x58d656,_0x4f3676['error']['message']);return _0x3054eb(_0x4f3676[_0x1963('0x12')][_0x1963('0x14')]);}else{logger['info'](_0x1963('0xf'),_0x58d656,'request\x20sent');_0x3054eb(_0x4f3676[_0x1963('0x15')][_0x1963('0x14')]);}})[_0x1963('0x16')](function(_0x4fadce){logger['error'](_0x1963('0xf'),_0x58d656,_0x4fadce);_0x5cc3a4(_0x4fadce);});});}exports[_0x1963('0x17')]=function(_0x528ec1){var _0x18d5b7=this;return new Promise(function(_0x5cd4de,_0x5e3cc3){return db[_0x1963('0x18')][_0x1963('0x19')]({'raw':_0x528ec1['options']?_0x528ec1[_0x1963('0x1a')][_0x1963('0x1b')]===undefined?!![]:![]:!![],'where':_0x528ec1[_0x1963('0x1a')]?_0x528ec1[_0x1963('0x1a')][_0x1963('0x1c')]||null:null,'attributes':_0x528ec1[_0x1963('0x1a')]?_0x528ec1[_0x1963('0x1a')][_0x1963('0x1d')]||null:null,'limit':_0x528ec1['options']?_0x528ec1[_0x1963('0x1a')][_0x1963('0x1e')]||null:null,'include':_0x528ec1['options']?_0x528ec1[_0x1963('0x1a')]['include']?_[_0x1963('0x1f')](_0x528ec1[_0x1963('0x1a')]['include'],function(_0x31b6df){return{'model':db[_0x31b6df[_0x1963('0x20')]],'as':_0x31b6df['as'],'attributes':_0x31b6df[_0x1963('0x1d')],'include':_0x31b6df[_0x1963('0x21')]?_['map'](_0x31b6df[_0x1963('0x21')],function(_0x563cd9){return{'model':db[_0x563cd9[_0x1963('0x20')]],'as':_0x563cd9['as'],'attributes':_0x563cd9[_0x1963('0x1d')],'include':_0x563cd9[_0x1963('0x21')]?_[_0x1963('0x1f')](_0x563cd9['include'],function(_0x5d5b8f){return{'model':db[_0x5d5b8f[_0x1963('0x20')]],'as':_0x5d5b8f['as'],'attributes':_0x5d5b8f[_0x1963('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f4b5a){logger[_0x1963('0xe')](_0x1963('0x17'),_0x528ec1);logger[_0x1963('0x22')](_0x1963('0x17'),_0x528ec1,JSON['stringify'](_0x2f4b5a));_0x5cd4de(_0x2f4b5a);})['catch'](function(_0x45fb75){logger[_0x1963('0x12')]('GetTrunk',_0x45fb75[_0x1963('0x14')],_0x528ec1);_0x5e3cc3(_0x18d5b7['error'](0x1f4,_0x45fb75[_0x1963('0x14')]));});});};exports[_0x1963('0x23')]=function(_0x58d559){var _0x4eecc7=this;return new Promise(function(_0xfdae4a,_0x2ae80c){return db[_0x1963('0x18')]['find']({'raw':_0x58d559[_0x1963('0x1a')]?_0x58d559[_0x1963('0x1a')][_0x1963('0x1b')]===undefined?!![]:![]:!![],'where':_0x58d559[_0x1963('0x1a')]?_0x58d559[_0x1963('0x1a')][_0x1963('0x1c')]||null:null,'attributes':_0x58d559['options']?_0x58d559[_0x1963('0x1a')][_0x1963('0x1d')]||null:null,'include':_0x58d559[_0x1963('0x1a')]?_0x58d559['options'][_0x1963('0x21')]?_['map'](_0x58d559['options'][_0x1963('0x21')],function(_0x40947f){return{'model':db[_0x40947f[_0x1963('0x20')]],'as':_0x40947f['as'],'attributes':_0x40947f[_0x1963('0x1d')],'include':_0x40947f['include']?_[_0x1963('0x1f')](_0x40947f[_0x1963('0x21')],function(_0x444642){return{'model':db[_0x444642[_0x1963('0x20')]],'as':_0x444642['as'],'attributes':_0x444642['attributes'],'include':_0x444642['include']?_[_0x1963('0x1f')](_0x444642['include'],function(_0x21be7b){return{'model':db[_0x21be7b[_0x1963('0x20')]],'as':_0x21be7b['as'],'attributes':_0x21be7b['attributes']};}):[]};}):[]};}):[]:[]})[_0x1963('0x24')](function(_0x52164f){logger['info']('ShowTrunk',_0x58d559);logger[_0x1963('0x22')](_0x1963('0x23'),_0x58d559,JSON['stringify'](_0x52164f));_0xfdae4a(_0x52164f);})[_0x1963('0x16')](function(_0x725010){logger[_0x1963('0x12')]('ShowTrunk',_0x725010[_0x1963('0x14')],_0x58d559);_0x2ae80c(_0x4eecc7['error'](0x1f4,_0x725010[_0x1963('0x14')]));});});}; \ No newline at end of file +var _0x7a0b=['debug','stringify','error','code','message','catch','GetTrunk','Trunk','options','raw','limit','map','include','attributes','ShowTrunk','find','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x240f3c,_0x1d5716){var _0x5bb04e=function(_0x3b228d){while(--_0x3b228d){_0x240f3c['push'](_0x240f3c['shift']());}};_0x5bb04e(++_0x1d5716);}(_0x7a0b,0x13a));var _0xb7a0=function(_0x156e2c,_0x2a7300){_0x156e2c=_0x156e2c-0x0;var _0x136ac8=_0x7a0b[_0x156e2c];return _0x136ac8;};'use strict';var _=require('lodash');var util=require(_0xb7a0('0x0'));var moment=require(_0xb7a0('0x1'));var BPromise=require(_0xb7a0('0x2'));var rs=require(_0xb7a0('0x3'));var fs=require('fs');var Redis=require(_0xb7a0('0x4'));var db=require(_0xb7a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7a0('0x6'))(_0xb7a0('0x7'));var config=require(_0xb7a0('0x8'));var jayson=require(_0xb7a0('0x9'));var client=jayson[_0xb7a0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32926b,_0x30d6db,_0x58d628){return new BPromise(function(_0x21ac72,_0x10febd){return client[_0xb7a0('0xb')](_0x32926b,_0x58d628)[_0xb7a0('0xc')](function(_0xed781b){logger[_0xb7a0('0xd')](_0xb7a0('0xe'),_0x30d6db,_0xb7a0('0xf'));logger[_0xb7a0('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x30d6db,_0xb7a0('0xf'),JSON[_0xb7a0('0x11')](_0xed781b));if(_0xed781b['error']){if(_0xed781b[_0xb7a0('0x12')][_0xb7a0('0x13')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x30d6db,_0xed781b[_0xb7a0('0x12')][_0xb7a0('0x14')]);return _0x10febd(_0xed781b[_0xb7a0('0x12')]['message']);}logger[_0xb7a0('0x12')](_0xb7a0('0xe'),_0x30d6db,_0xed781b[_0xb7a0('0x12')][_0xb7a0('0x14')]);return _0x21ac72(_0xed781b['error']['message']);}else{logger[_0xb7a0('0xd')]('Trunk,\x20%s,\x20%s',_0x30d6db,_0xb7a0('0xf'));_0x21ac72(_0xed781b['result'][_0xb7a0('0x14')]);}})[_0xb7a0('0x15')](function(_0x30d56b){logger[_0xb7a0('0x12')]('Trunk,\x20%s,\x20%s',_0x30d6db,_0x30d56b);_0x10febd(_0x30d56b);});});}exports[_0xb7a0('0x16')]=function(_0x3f7392){var _0x32c86d=this;return new Promise(function(_0x3f6b0e,_0x4b48e0){return db[_0xb7a0('0x17')]['findAll']({'raw':_0x3f7392[_0xb7a0('0x18')]?_0x3f7392[_0xb7a0('0x18')][_0xb7a0('0x19')]===undefined?!![]:![]:!![],'where':_0x3f7392['options']?_0x3f7392[_0xb7a0('0x18')]['where']||null:null,'attributes':_0x3f7392[_0xb7a0('0x18')]?_0x3f7392[_0xb7a0('0x18')]['attributes']||null:null,'limit':_0x3f7392[_0xb7a0('0x18')]?_0x3f7392[_0xb7a0('0x18')][_0xb7a0('0x1a')]||null:null,'include':_0x3f7392[_0xb7a0('0x18')]?_0x3f7392[_0xb7a0('0x18')]['include']?_[_0xb7a0('0x1b')](_0x3f7392[_0xb7a0('0x18')][_0xb7a0('0x1c')],function(_0x38b14e){return{'model':db[_0x38b14e['model']],'as':_0x38b14e['as'],'attributes':_0x38b14e[_0xb7a0('0x1d')],'include':_0x38b14e['include']?_[_0xb7a0('0x1b')](_0x38b14e[_0xb7a0('0x1c')],function(_0x50cc0c){return{'model':db[_0x50cc0c['model']],'as':_0x50cc0c['as'],'attributes':_0x50cc0c['attributes'],'include':_0x50cc0c[_0xb7a0('0x1c')]?_[_0xb7a0('0x1b')](_0x50cc0c[_0xb7a0('0x1c')],function(_0x36c0af){return{'model':db[_0x36c0af['model']],'as':_0x36c0af['as'],'attributes':_0x36c0af[_0xb7a0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46a9f5){logger[_0xb7a0('0xd')](_0xb7a0('0x16'),_0x3f7392);logger[_0xb7a0('0x10')]('GetTrunk',_0x3f7392,JSON[_0xb7a0('0x11')](_0x46a9f5));_0x3f6b0e(_0x46a9f5);})[_0xb7a0('0x15')](function(_0x1fd249){logger[_0xb7a0('0x12')](_0xb7a0('0x16'),_0x1fd249['message'],_0x3f7392);_0x4b48e0(_0x32c86d[_0xb7a0('0x12')](0x1f4,_0x1fd249['message']));});});};exports[_0xb7a0('0x1e')]=function(_0x2525f4){var _0x380030=this;return new Promise(function(_0x5cd8e6,_0x34feee){return db[_0xb7a0('0x17')][_0xb7a0('0x1f')]({'raw':_0x2525f4['options']?_0x2525f4[_0xb7a0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2525f4[_0xb7a0('0x18')]?_0x2525f4[_0xb7a0('0x18')]['where']||null:null,'attributes':_0x2525f4['options']?_0x2525f4[_0xb7a0('0x18')][_0xb7a0('0x1d')]||null:null,'include':_0x2525f4[_0xb7a0('0x18')]?_0x2525f4[_0xb7a0('0x18')][_0xb7a0('0x1c')]?_[_0xb7a0('0x1b')](_0x2525f4[_0xb7a0('0x18')][_0xb7a0('0x1c')],function(_0x58201f){return{'model':db[_0x58201f[_0xb7a0('0x20')]],'as':_0x58201f['as'],'attributes':_0x58201f[_0xb7a0('0x1d')],'include':_0x58201f['include']?_['map'](_0x58201f['include'],function(_0x2de68d){return{'model':db[_0x2de68d['model']],'as':_0x2de68d['as'],'attributes':_0x2de68d[_0xb7a0('0x1d')],'include':_0x2de68d[_0xb7a0('0x1c')]?_[_0xb7a0('0x1b')](_0x2de68d[_0xb7a0('0x1c')],function(_0x3bc366){return{'model':db[_0x3bc366[_0xb7a0('0x20')]],'as':_0x3bc366['as'],'attributes':_0x3bc366[_0xb7a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb7a0('0xc')](function(_0x47ba9b){logger[_0xb7a0('0xd')](_0xb7a0('0x1e'),_0x2525f4);logger['debug'](_0xb7a0('0x1e'),_0x2525f4,JSON[_0xb7a0('0x11')](_0x47ba9b));_0x5cd8e6(_0x47ba9b);})[_0xb7a0('0x15')](function(_0x3165bb){logger[_0xb7a0('0x12')](_0xb7a0('0x1e'),_0x3165bb['message'],_0x2525f4);_0x34feee(_0x380030['error'](0x1f4,_0x3165bb[_0xb7a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 55492bf..7f82bf4 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 _0x6392=['express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','exports'];(function(_0x1c0eee,_0x257cd8){var _0x33aaf1=function(_0x2b644c){while(--_0x2b644c){_0x1c0eee['push'](_0x1c0eee['shift']());}};_0x33aaf1(++_0x257cd8);}(_0x6392,0x181));var _0x2639=function(_0x54d5ac,_0x31a3f8){_0x54d5ac=_0x54d5ac-0x0;var _0x28dc98=_0x6392[_0x54d5ac];return _0x28dc98;};'use strict';var express=require(_0x2639('0x0'));var router=express[_0x2639('0x1')]();var auth=require(_0x2639('0x2'));var controller=require(_0x2639('0x3'));router['put'](_0x2639('0x4'),auth[_0x2639('0x5')](),controller['update']);module[_0x2639('0x6')]=router; \ No newline at end of file +var _0x70d3=['update','exports','express','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x70d3,0x121));var _0x370d=function(_0x4272ba,_0x1519c2){_0x4272ba=_0x4272ba-0x0;var _0xd86ed2=_0x70d3[_0x4272ba];return _0xd86ed2;};'use strict';var express=require(_0x370d('0x0'));var router=express['Router']();var auth=require(_0x370d('0x1'));var controller=require(_0x370d('0x2'));router['put'](_0x370d('0x3'),auth[_0x370d('0x4')](),controller[_0x370d('0x5')]);module[_0x370d('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 7716844..b338b53 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 _0x49be=['sequelize','error','warning','debug','exports','TEXT','DATE','INTEGER'];(function(_0x39c638,_0x3753ac){var _0x5ba8c9=function(_0xfd7887){while(--_0xfd7887){_0x39c638['push'](_0x39c638['shift']());}};_0x5ba8c9(++_0x3753ac);}(_0x49be,0x170));var _0xe49b=function(_0x35b2a1,_0x4cdca8){_0x35b2a1=_0x35b2a1-0x0;var _0x6023da=_0x49be[_0x35b2a1];return _0x6023da;};'use strict';var Sequelize=require(_0xe49b('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xe49b('0x1'),_0xe49b('0x2'),'info',_0xe49b('0x3')];module[_0xe49b('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xe49b('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xe49b('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xe49b('0x7')],'unique':'UserId'}}; \ No newline at end of file +var _0xce3f=['DATE','INTEGER','UserId','sequelize','error','warning','info','debug','exports','ENUM','TEXT'];(function(_0x1e8dd5,_0x571f6d){var _0x9aa844=function(_0x21dee6){while(--_0x21dee6){_0x1e8dd5['push'](_0x1e8dd5['shift']());}};_0x9aa844(++_0x571f6d);}(_0xce3f,0xb3));var _0xfce3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xce3f[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xfce3('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfce3('0x1'),_0xfce3('0x2'),_0xfce3('0x3'),_0xfce3('0x4')];module[_0xfce3('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfce3('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfce3('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfce3('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfce3('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfce3('0x9')],'unique':_0xfce3('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 8816d28..6229863 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 _0x6108=['../../config/logger','api','../../config/environment','redis','./user-setting.socket','defaults','localhost','json','then','sendStatus','error','stack','name','send','update','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','body','lodash'];(function(_0x31d03c,_0x158cef){var _0x420e61=function(_0x1ddac1){while(--_0x1ddac1){_0x31d03c['push'](_0x31d03c['shift']());}};_0x420e61(++_0x158cef);}(_0x6108,0xbc));var _0x8610=function(_0xd7f35a,_0x202b40){_0xd7f35a=_0xd7f35a-0x0;var _0x23f895=_0x6108[_0xd7f35a];return _0x23f895;};'use strict';var _=require(_0x8610('0x0'));var Redis=require('ioredis');var logger=require(_0x8610('0x1'))(_0x8610('0x2'));var config=require(_0x8610('0x3'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x8610('0x4')]));require(_0x8610('0x5'))['register'](socket);config['redis']=_[_0x8610('0x6')](config[_0x8610('0x4')],{'host':_0x8610('0x7'),'port':0x18eb});function respondWithResult(_0x26dab3,_0x4e0fe4){_0x4e0fe4=_0x4e0fe4||0xc8;return function(_0x174f41){if(_0x174f41){return _0x26dab3['status'](_0x4e0fe4)[_0x8610('0x8')](_0x174f41);}};}function saveUpdates(_0x2255a0){return function(_0x21774e){if(_0x21774e){return _0x21774e['update'](_0x2255a0)[_0x8610('0x9')](function(_0x3682b9){return _0x3682b9;});}return null;};}function handleEntityNotFound(_0x46854f){return function(_0x1eb419){if(!_0x1eb419){_0x46854f[_0x8610('0xa')](0x194);}return _0x1eb419;};}function handleError(_0x1da432,_0x4b3af2){_0x4b3af2=_0x4b3af2||0x1f4;return function(_0x1b6c16){logger[_0x8610('0xb')](_0x1b6c16[_0x8610('0xc')]);if(_0x1b6c16['name']){delete _0x1b6c16[_0x8610('0xd')];}_0x1da432['status'](_0x4b3af2)[_0x8610('0xe')](_0x1b6c16);};}exports[_0x8610('0xf')]=function(_0x413324,_0x277942){if(_0x413324[_0x8610('0x10')]['role']!=='admin')throw new Error(_0x8610('0x11'));if(isNaN(Number(_0x413324[_0x8610('0x12')]['id'])))throw new Error(_0x8610('0x13'));return db['UserSetting']['find']({'where':{'id':_0x413324['params']['id']}})[_0x8610('0x9')](handleEntityNotFound(_0x277942,null))[_0x8610('0x9')](saveUpdates(_0x413324[_0x8610('0x14')],null))[_0x8610('0x9')](respondWithResult(_0x277942,null))['catch'](handleError(_0x277942,null));}; \ No newline at end of file +var _0xa8a8=['body','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','then','stack','name','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find'];(function(_0x56125e,_0x1abe70){var _0x2db39e=function(_0x4cec20){while(--_0x4cec20){_0x56125e['push'](_0x56125e['shift']());}};_0x2db39e(++_0x1abe70);}(_0xa8a8,0xec));var _0x8a8a=function(_0x40bdee,_0x1f1264){_0x40bdee=_0x40bdee-0x0;var _0x3a6dc5=_0xa8a8[_0x40bdee];return _0x3a6dc5;};'use strict';var _=require(_0x8a8a('0x0'));var Redis=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var config=require('../../config/environment');var db=require(_0x8a8a('0x4'))['db'];var socket=require(_0x8a8a('0x5'))(new Redis(config[_0x8a8a('0x6')]));require(_0x8a8a('0x7'))[_0x8a8a('0x8')](socket);config[_0x8a8a('0x6')]=_[_0x8a8a('0x9')](config[_0x8a8a('0x6')],{'host':_0x8a8a('0xa'),'port':0x18eb});function respondWithResult(_0x315fe9,_0x1d7121){_0x1d7121=_0x1d7121||0xc8;return function(_0x8e7aa0){if(_0x8e7aa0){return _0x315fe9[_0x8a8a('0xb')](_0x1d7121)[_0x8a8a('0xc')](_0x8e7aa0);}};}function saveUpdates(_0x3287f5){return function(_0x58a2f8){if(_0x58a2f8){return _0x58a2f8['update'](_0x3287f5)[_0x8a8a('0xd')](function(_0x497b8a){return _0x497b8a;});}return null;};}function handleEntityNotFound(_0x11788d){return function(_0x3d3a00){if(!_0x3d3a00){_0x11788d['sendStatus'](0x194);}return _0x3d3a00;};}function handleError(_0x118380,_0x76b586){_0x76b586=_0x76b586||0x1f4;return function(_0xb13fca){logger['error'](_0xb13fca[_0x8a8a('0xe')]);if(_0xb13fca[_0x8a8a('0xf')]){delete _0xb13fca[_0x8a8a('0xf')];}_0x118380[_0x8a8a('0xb')](_0x76b586)['send'](_0xb13fca);};}exports[_0x8a8a('0x10')]=function(_0x4e5d74,_0x25e1d5){if(_0x4e5d74[_0x8a8a('0x11')][_0x8a8a('0x12')]!==_0x8a8a('0x13'))throw new Error(_0x8a8a('0x14'));if(isNaN(Number(_0x4e5d74[_0x8a8a('0x15')]['id'])))throw new Error(_0x8a8a('0x16'));return db['UserSetting'][_0x8a8a('0x17')]({'where':{'id':_0x4e5d74['params']['id']}})[_0x8a8a('0xd')](handleEntityNotFound(_0x25e1d5,null))[_0x8a8a('0xd')](saveUpdates(_0x4e5d74[_0x8a8a('0x18')],null))[_0x8a8a('0xd')](respondWithResult(_0x25e1d5,null))[_0x8a8a('0x19')](handleError(_0x25e1d5,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 5ff37f2..c745806 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 _0xc696=['events','../../mysqldb','UserSetting','save','remove','emit','hasOwnProperty','exports'];(function(_0x1e204d,_0x1d1d01){var _0x45295c=function(_0x57725d){while(--_0x57725d){_0x1e204d['push'](_0x1e204d['shift']());}};_0x45295c(++_0x1d1d01);}(_0xc696,0x1d0));var _0x6c69=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xc696[_0x2283dc];return _0x16db90;};'use strict';var EventEmitter=require(_0x6c69('0x0'));var UserSetting=require(_0x6c69('0x1'))['db'][_0x6c69('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c69('0x3'),'afterUpdate':'update','afterDestroy':_0x6c69('0x4')};function emitEvent(_0x93e55b){return function(_0x2b3f74,_0x302e64,_0x41aad5){UserSettingEvents[_0x6c69('0x5')](_0x93e55b+':'+_0x2b3f74['id'],_0x2b3f74);UserSettingEvents['emit'](_0x93e55b,_0x2b3f74);_0x41aad5(null);};}for(var e in events){if(events[_0x6c69('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x6c69('0x7')]=UserSettingEvents; \ No newline at end of file +var _0xb224=['UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xb224,0x97));var _0x4b22=function(_0x57cadd,_0x49cac1){_0x57cadd=_0x57cadd-0x0;var _0x46644b=_0xb224[_0x57cadd];return _0x46644b;};'use strict';var EventEmitter=require(_0x4b22('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x4b22('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4b22('0x2')](0x0);var events={'afterCreate':_0x4b22('0x3'),'afterUpdate':_0x4b22('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3bfadf){return function(_0x573dc9,_0x5d888b,_0xc4660b){UserSettingEvents[_0x4b22('0x5')](_0x3bfadf+':'+_0x573dc9['id'],_0x573dc9);UserSettingEvents[_0x4b22('0x5')](_0x3bfadf,_0x573dc9);_0xc4660b(null);};}for(var e in events){if(events[_0x4b22('0x6')](e)){var event=events[e];UserSetting[_0x4b22('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index f3473e9..c43ef7d 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 _0xffaa=['exports','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x45a528,_0x36ed5d){var _0x5db6c5=function(_0x58296d){while(--_0x58296d){_0x45a528['push'](_0x45a528['shift']());}};_0x5db6c5(++_0x36ed5d);}(_0xffaa,0x130));var _0xaffa=function(_0x844ba1,_0x56340b){_0x844ba1=_0x844ba1-0x0;var _0x93b575=_0xffaa[_0x844ba1];return _0x93b575;};'use strict';var attributes=require(_0xaffa('0x0'));module[_0xaffa('0x1')]=function(_0x2c0e94){return _0x2c0e94['define']('UserSetting',attributes,{'tableName':_0xaffa('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2433d9){if(!_0x2433d9[_0xaffa('0x3')])_0x2433d9[_0xaffa('0x4')]=null;else if(_0x2433d9[_0xaffa('0x4')]===null)_0x2433d9[_0xaffa('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x6ae2=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x5e9c9c,_0x45a8d2){var _0x598f09=function(_0x14983a){while(--_0x14983a){_0x5e9c9c['push'](_0x5e9c9c['shift']());}};_0x598f09(++_0x45a8d2);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x43820d,_0x2cf3b3){_0x43820d=_0x43820d-0x0;var _0x70d9af=_0x6ae2[_0x43820d];return _0x70d9af;};'use strict';var attributes=require(_0x26ae('0x0'));module[_0x26ae('0x1')]=function(_0x118942){return _0x118942[_0x26ae('0x2')](_0x26ae('0x3'),attributes,{'tableName':_0x26ae('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xde8ef3){if(!_0xde8ef3[_0x26ae('0x5')])_0xde8ef3[_0x26ae('0x6')]=null;else if(_0xde8ef3['clientSideLoggingEnabledSince']===null)_0xde8ef3[_0x26ae('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 8d49257..0993d1f 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 _0x9513=['update','emit','user-setting:update','user-setting:update:user-','length','user-setting:','./user-setting.events','save','remove'];(function(_0x958fe5,_0x20dcbb){var _0x3e6d0e=function(_0xfd4947){while(--_0xfd4947){_0x958fe5['push'](_0x958fe5['shift']());}};_0x3e6d0e(++_0x20dcbb);}(_0x9513,0x102));var _0x3951=function(_0x578b28,_0x1525f8){_0x578b28=_0x578b28-0x0;var _0x105756=_0x9513[_0x578b28];return _0x105756;};'use strict';var UserSettingEvents=require(_0x3951('0x0'));var events=[_0x3951('0x1'),_0x3951('0x2'),_0x3951('0x3')];function createListener(_0xc99728,_0x3f145b){return function(_0x47af6f){_0x3f145b[_0x3951('0x4')](_0xc99728,_0x47af6f);if(_0xc99728===_0x3951('0x5')){_0x3f145b[_0x3951('0x4')](_0x3951('0x6')+_0x47af6f['UserId'],_0x47af6f);}};}exports['register']=function(_0x4f830d){for(var _0x3c3c36=0x0,_0x2c0f22=events[_0x3951('0x7')];_0x3c3c36<_0x2c0f22;_0x3c3c36++){var _0x1b5a47=events[_0x3c3c36];var _0x44c076=createListener(_0x3951('0x8')+_0x1b5a47,_0x4f830d);UserSettingEvents['on'](_0x1b5a47,_0x44c076);}}; \ No newline at end of file +var _0xdef5=['user-setting:update','emit','register','length','user-setting:','save','remove','update'];(function(_0x1903c1,_0x4b778a){var _0x31cd5b=function(_0x5366e6){while(--_0x5366e6){_0x1903c1['push'](_0x1903c1['shift']());}};_0x31cd5b(++_0x4b778a);}(_0xdef5,0x7d));var _0x5def=function(_0xd579dc,_0x492656){_0xd579dc=_0xd579dc-0x0;var _0x1ceae1=_0xdef5[_0xd579dc];return _0x1ceae1;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x5def('0x0'),_0x5def('0x1'),_0x5def('0x2')];function createListener(_0x726667,_0x50ad2f){return function(_0x32245f){_0x50ad2f['emit'](_0x726667,_0x32245f);if(_0x726667===_0x5def('0x3')){_0x50ad2f[_0x5def('0x4')]('user-setting:update:user-'+_0x32245f['UserId'],_0x32245f);}};}exports[_0x5def('0x5')]=function(_0x3a9c57){for(var _0x5aa4f5=0x0,_0x5b778e=events[_0x5def('0x6')];_0x5aa4f5<_0x5b778e;_0x5aa4f5++){var _0x200967=events[_0x5aa4f5];var _0x3b0e73=createListener(_0x5def('0x7')+_0x200967,_0x3a9c57);UserSettingEvents['on'](_0x200967,_0x3b0e73);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 53f7d7d..34316f2 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 _0xd3a9=['/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getLists','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','/:id/queues','diskStorage','join','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./user.controller','isAuthenticated','index','get','describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd3a9,0xbf));var _0x9d3a=function(_0xe9d40c,_0x1feaf1){_0xe9d40c=_0xe9d40c-0x0;var _0x1e4362=_0xd3a9[_0xe9d40c];return _0x1e4362;};'use strict';var multer=require(_0x9d3a('0x0'));var util=require(_0x9d3a('0x1'));var path=require(_0x9d3a('0x2'));var timeout=require(_0x9d3a('0x3'));var express=require(_0x9d3a('0x4'));var router=express[_0x9d3a('0x5')]();var fs_extra=require(_0x9d3a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9d3a('0x7'));var controller=require(_0x9d3a('0x8'));router['get']('/',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0xa')]);router[_0x9d3a('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x9d3a('0xc')]);router[_0x9d3a('0xb')]('/whoami',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0xd')]);router[_0x9d3a('0xb')](_0x9d3a('0xe'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0xf')]);router[_0x9d3a('0xb')](_0x9d3a('0x10'),auth['isAuthenticated'](),controller[_0x9d3a('0x11')]);router[_0x9d3a('0xb')](_0x9d3a('0x12'),controller[_0x9d3a('0x13')]);router[_0x9d3a('0xb')](_0x9d3a('0x14'),auth['isAuthenticated'](),controller[_0x9d3a('0x15')]);router[_0x9d3a('0xb')](_0x9d3a('0x16'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x17')]);router[_0x9d3a('0xb')]('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router[_0x9d3a('0xb')](_0x9d3a('0x18'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x19')]);router[_0x9d3a('0xb')](_0x9d3a('0x1a'),auth['isAuthenticated'](),controller['getGroups']);router[_0x9d3a('0xb')](_0x9d3a('0x1b'),auth['isAuthenticated'](),controller[_0x9d3a('0x1c')]);router[_0x9d3a('0xb')]('/:id/screen_recordings',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x1d')]);router[_0x9d3a('0xb')](_0x9d3a('0x1e'),auth['isAuthenticated'](),controller[_0x9d3a('0x1f')]);router[_0x9d3a('0xb')]('/:id/openchannel/interactions',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x20')]);router['get'](_0x9d3a('0x21'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x22')]);router[_0x9d3a('0xb')]('/:id/sms/interactions',auth[_0x9d3a('0x9')](),controller['getSmsInteractions']);router[_0x9d3a('0xb')](_0x9d3a('0x23'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x9d3a('0xb')](_0x9d3a('0x24'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x25')]);router[_0x9d3a('0xb')](_0x9d3a('0x26'),auth[_0x9d3a('0x9')](),controller['getTeams']);router[_0x9d3a('0xb')]('/:id/lists',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x27')]);router['get']('/:id/agents',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x28')]);router[_0x9d3a('0xb')](_0x9d3a('0x29'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x2a')]);router[_0x9d3a('0xb')]('/:id/fax_accounts',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x2b')]);router[_0x9d3a('0xb')](_0x9d3a('0x2c'),auth[_0x9d3a('0x9')](),controller['getMailAccounts']);router[_0x9d3a('0xb')](_0x9d3a('0x2d'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x2e')]);router[_0x9d3a('0xb')]('/:id/sms_accounts',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x2f')]);router['get']('/:id/chat_websites',auth[_0x9d3a('0x9')](),controller['getChatWebsites']);router[_0x9d3a('0xb')]('/:id/whatsapp_accounts',auth[_0x9d3a('0x9')](),controller['getWhatsappAccounts']);router['get'](_0x9d3a('0x30'),auth[_0x9d3a('0x9')](),controller['getScheduledCalls']);router[_0x9d3a('0xb')](_0x9d3a('0x31'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x32')]);router[_0x9d3a('0x33')]('/:id/contacts',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x34')]);router[_0x9d3a('0x33')]('/',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x35')]);router[_0x9d3a('0x33')](_0x9d3a('0x36'),auth['isAuthenticated'](),controller[_0x9d3a('0x37')]);router[_0x9d3a('0x33')](_0x9d3a('0x38'),auth[_0x9d3a('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9d3a('0x39')]({'destination':function(_0xffaf67,_0x5a769c,_0x32c7a2){_0x32c7a2(null,path[_0x9d3a('0x3a')](config['root'],'server/files/images/'));},'filename':function(_0x4c7526,_0x3779c9,_0x39e1b3){_0x39e1b3(null,util['format'](_0x9d3a('0x3b'),Date[_0x9d3a('0x3c')](),_0x3779c9[_0x9d3a('0x3d')]));}})});router[_0x9d3a('0x33')](_0x9d3a('0x12'),upload[_0x9d3a('0x3e')](_0x9d3a('0x3f')),controller[_0x9d3a('0x40')]);router[_0x9d3a('0x33')](_0x9d3a('0x41'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x42')]);router[_0x9d3a('0x33')](_0x9d3a('0x43'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x44')]);router['post'](_0x9d3a('0x45'),auth['isAuthenticated'](),controller[_0x9d3a('0x46')]);router[_0x9d3a('0x33')]('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router[_0x9d3a('0x33')](_0x9d3a('0x26'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x47')]);router[_0x9d3a('0x33')]('/:id/chat_interactions',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x48')]);router[_0x9d3a('0x33')](_0x9d3a('0x49'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x4a')]);router['post']('/:id/fax_interactions',auth[_0x9d3a('0x9')](),controller['addFaxInteractions']);router['post'](_0x9d3a('0x4b'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x4c')]);router[_0x9d3a('0x33')](_0x9d3a('0x4d'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x4e')]);router[_0x9d3a('0x33')](_0x9d3a('0x4f'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x50')]);router[_0x9d3a('0x33')](_0x9d3a('0x51'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x52')]);router[_0x9d3a('0x33')](_0x9d3a('0x2c'),auth['isAuthenticated'](),controller[_0x9d3a('0x53')]);router['post'](_0x9d3a('0x2d'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x54')]);router[_0x9d3a('0x33')](_0x9d3a('0x55'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x56')]);router['post'](_0x9d3a('0x57'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x58')]);router[_0x9d3a('0x33')]('/:id/whatsapp_accounts',auth[_0x9d3a('0x9')](),controller['addWhatsappAccounts']);router[_0x9d3a('0x33')](_0x9d3a('0x31'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x59')]);router[_0x9d3a('0x5a')]('/:id',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x5b')]);router['put']('/:id/password',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x5c')]);router[_0x9d3a('0x5d')](_0x9d3a('0x38'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x5e')]);router[_0x9d3a('0x5d')]('/:id/teams',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x5f')]);router[_0x9d3a('0x5d')]('/:id',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x60')]);router[_0x9d3a('0x5d')](_0x9d3a('0x61'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x62')]);router[_0x9d3a('0x5d')](_0x9d3a('0x49'),auth['isAuthenticated'](),controller[_0x9d3a('0x63')]);router[_0x9d3a('0x5d')](_0x9d3a('0x64'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x65')]);router['delete'](_0x9d3a('0x4b'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete']('/:id/openchannel_interactions',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x66')]);router[_0x9d3a('0x5d')](_0x9d3a('0x4f'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x67')]);router['delete']('/:id/fax_accounts',auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x68')]);router[_0x9d3a('0x5d')](_0x9d3a('0x2c'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x69')]);router[_0x9d3a('0x5d')](_0x9d3a('0x2d'),auth['isAuthenticated'](),controller[_0x9d3a('0x6a')]);router[_0x9d3a('0x5d')](_0x9d3a('0x55'),auth['isAuthenticated'](),controller[_0x9d3a('0x6b')]);router[_0x9d3a('0x5d')](_0x9d3a('0x57'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x6c')]);router['delete'](_0x9d3a('0x6d'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x6e')]);router[_0x9d3a('0x5d')](_0x9d3a('0x31'),auth[_0x9d3a('0x9')](),controller['removeApiKey']);router['post'](_0x9d3a('0x6f'),auth[_0x9d3a('0x9')](),controller[_0x9d3a('0x70')]);module['exports']=router; \ No newline at end of file +var _0x7128=['removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','path','express','Router','fs-extra','../../config/environment','./user.controller','isAuthenticated','get','describe','/whoami','whoami','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','create','post','/create_many','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','/:id/avatar','single','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','put','changePassword','delete','/:id/queues','removeQueues','removeTeams','destroy','/:id/chat_interactions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7128,0x1b9));var _0x8712=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7128[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0x8712('0x0'));var util=require('util');var path=require(_0x8712('0x1'));var timeout=require('connect-timeout');var express=require(_0x8712('0x2'));var router=express[_0x8712('0x3')]();var fs_extra=require(_0x8712('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8712('0x5'));var controller=require(_0x8712('0x6'));router['get']('/',auth[_0x8712('0x7')](),controller['index']);router[_0x8712('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8712('0x9')]);router['get'](_0x8712('0xa'),auth[_0x8712('0x7')](),controller[_0x8712('0xb')]);router[_0x8712('0x8')]('/presence',auth[_0x8712('0x7')](),controller['getPresence']);router[_0x8712('0x8')](_0x8712('0xc'),auth[_0x8712('0x7')](),controller[_0x8712('0xd')]);router['get']('/:id/avatar',controller[_0x8712('0xe')]);router[_0x8712('0x8')](_0x8712('0xf'),auth[_0x8712('0x7')](),controller[_0x8712('0x10')]);router[_0x8712('0x8')](_0x8712('0x11'),auth[_0x8712('0x7')](),controller['getContacts']);router[_0x8712('0x8')]('/:id/queues',auth[_0x8712('0x7')](),controller['getQueues']);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x8712('0x12')]);router[_0x8712('0x8')](_0x8712('0x13'),auth[_0x8712('0x7')](),controller[_0x8712('0x14')]);router[_0x8712('0x8')](_0x8712('0x15'),auth['isAuthenticated'](),controller[_0x8712('0x16')]);router['get'](_0x8712('0x17'),auth[_0x8712('0x7')](),controller[_0x8712('0x18')]);router[_0x8712('0x8')](_0x8712('0x19'),auth[_0x8712('0x7')](),controller[_0x8712('0x1a')]);router[_0x8712('0x8')](_0x8712('0x1b'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x8712('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x8712('0x1c')]);router['get']('/:id/sms/interactions',auth[_0x8712('0x7')](),controller['getSmsInteractions']);router[_0x8712('0x8')](_0x8712('0x1d'),auth[_0x8712('0x7')](),controller[_0x8712('0x1e')]);router[_0x8712('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x8712('0x1f')]);router[_0x8712('0x8')](_0x8712('0x20'),auth['isAuthenticated'](),controller[_0x8712('0x21')]);router[_0x8712('0x8')]('/:id/lists',auth[_0x8712('0x7')](),controller[_0x8712('0x22')]);router[_0x8712('0x8')](_0x8712('0x23'),auth[_0x8712('0x7')](),controller[_0x8712('0x24')]);router[_0x8712('0x8')]('/:id/prefixes',auth[_0x8712('0x7')](),controller[_0x8712('0x25')]);router['get'](_0x8712('0x26'),auth[_0x8712('0x7')](),controller[_0x8712('0x27')]);router[_0x8712('0x8')](_0x8712('0x28'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x8712('0x8')](_0x8712('0x29'),auth['isAuthenticated'](),controller[_0x8712('0x2a')]);router['get'](_0x8712('0x2b'),auth['isAuthenticated'](),controller[_0x8712('0x2c')]);router[_0x8712('0x8')]('/:id/chat_websites',auth[_0x8712('0x7')](),controller[_0x8712('0x2d')]);router[_0x8712('0x8')](_0x8712('0x2e'),auth['isAuthenticated'](),controller[_0x8712('0x2f')]);router[_0x8712('0x8')](_0x8712('0x30'),auth['isAuthenticated'](),controller[_0x8712('0x31')]);router[_0x8712('0x8')](_0x8712('0x32'),auth[_0x8712('0x7')](),controller[_0x8712('0x33')]);router['post'](_0x8712('0x11'),auth[_0x8712('0x7')](),controller[_0x8712('0x34')]);router['post']('/',auth[_0x8712('0x7')](),controller[_0x8712('0x35')]);router[_0x8712('0x36')](_0x8712('0x37'),auth[_0x8712('0x7')](),controller['bulkCreate']);router['post']('/:id/queues',auth['isAuthenticated'](),controller[_0x8712('0x38')]);var upload=multer({'storage':multer[_0x8712('0x39')]({'destination':function(_0x3c9684,_0x5def4b,_0x4c8273){_0x4c8273(null,path[_0x8712('0x3a')](config[_0x8712('0x3b')],_0x8712('0x3c')));},'filename':function(_0x4532bd,_0x46a525,_0x732597){_0x732597(null,util['format'](_0x8712('0x3d'),Date[_0x8712('0x3e')](),_0x46a525[_0x8712('0x3f')]));}})});router[_0x8712('0x36')](_0x8712('0x40'),upload[_0x8712('0x41')]('file'),controller[_0x8712('0x42')]);router[_0x8712('0x36')](_0x8712('0x43'),auth['isAuthenticated'](),controller['login']);router['post'](_0x8712('0x44'),auth[_0x8712('0x7')](),controller[_0x8712('0x45')]);router['post'](_0x8712('0x46'),auth[_0x8712('0x7')](),controller[_0x8712('0x47')]);router['post'](_0x8712('0x48'),auth[_0x8712('0x7')](),controller[_0x8712('0x49')]);router[_0x8712('0x36')](_0x8712('0x20'),auth[_0x8712('0x7')](),controller[_0x8712('0x4a')]);router['post']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x8712('0x4b')]);router['post'](_0x8712('0x4c'),auth[_0x8712('0x7')](),controller[_0x8712('0x4d')]);router[_0x8712('0x36')](_0x8712('0x4e'),auth[_0x8712('0x7')](),controller['addFaxInteractions']);router[_0x8712('0x36')]('/:id/sms_interactions',auth[_0x8712('0x7')](),controller[_0x8712('0x4f')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x8712('0x50')]);router[_0x8712('0x36')]('/:id/whatsapp_interactions',auth[_0x8712('0x7')](),controller[_0x8712('0x51')]);router['post'](_0x8712('0x26'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x8712('0x36')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x8712('0x52')]);router['post'](_0x8712('0x29'),auth[_0x8712('0x7')](),controller['addOpenchannelAccounts']);router[_0x8712('0x36')](_0x8712('0x2b'),auth[_0x8712('0x7')](),controller[_0x8712('0x53')]);router['post'](_0x8712('0x54'),auth[_0x8712('0x7')](),controller[_0x8712('0x55')]);router[_0x8712('0x36')](_0x8712('0x2e'),auth[_0x8712('0x7')](),controller['addWhatsappAccounts']);router['post'](_0x8712('0x32'),auth[_0x8712('0x7')](),controller['createApiKey']);router[_0x8712('0x56')](_0x8712('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8712('0x56')]('/:id/password',auth['isAuthenticated'](),controller[_0x8712('0x57')]);router[_0x8712('0x58')](_0x8712('0x59'),auth[_0x8712('0x7')](),controller[_0x8712('0x5a')]);router[_0x8712('0x58')](_0x8712('0x20'),auth[_0x8712('0x7')](),controller[_0x8712('0x5b')]);router['delete'](_0x8712('0xc'),auth[_0x8712('0x7')](),controller[_0x8712('0x5c')]);router['delete'](_0x8712('0x5d'),auth[_0x8712('0x7')](),controller[_0x8712('0x5e')]);router[_0x8712('0x58')](_0x8712('0x4c'),auth['isAuthenticated'](),controller['removeMailInteractions']);router['delete'](_0x8712('0x4e'),auth['isAuthenticated'](),controller[_0x8712('0x5f')]);router['delete'](_0x8712('0x60'),auth[_0x8712('0x7')](),controller['removeSmsInteractions']);router[_0x8712('0x58')](_0x8712('0x61'),auth[_0x8712('0x7')](),controller['removeOpenchannelInteractions']);router['delete'](_0x8712('0x62'),auth[_0x8712('0x7')](),controller['removeWhatsappInteractions']);router[_0x8712('0x58')](_0x8712('0x26'),auth[_0x8712('0x7')](),controller[_0x8712('0x63')]);router['delete'](_0x8712('0x28'),auth[_0x8712('0x7')](),controller['removeMailAccounts']);router[_0x8712('0x58')](_0x8712('0x29'),auth['isAuthenticated'](),controller[_0x8712('0x64')]);router[_0x8712('0x58')](_0x8712('0x2b'),auth[_0x8712('0x7')](),controller[_0x8712('0x65')]);router['delete'](_0x8712('0x54'),auth[_0x8712('0x7')](),controller[_0x8712('0x66')]);router[_0x8712('0x58')](_0x8712('0x2e'),auth[_0x8712('0x7')](),controller[_0x8712('0x67')]);router['delete'](_0x8712('0x32'),auth['isAuthenticated'](),controller[_0x8712('0x68')]);router[_0x8712('0x36')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x8712('0x69')]);module[_0x8712('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 22f75b1..a77b450 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 _0x2d83=['insecure','never','\x22\x22\x20<>','accept','refuse','originate','fingerprint','active','passive','update,nonat','TEXT','get','wss','avpf','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','encryption','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','toLowerCase','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','user','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'];(function(_0x325d4e,_0x4543a0){var _0x1a1c24=function(_0x2e0b4d){while(--_0x2e0b4d){_0x325d4e['push'](_0x325d4e['shift']());}};_0x1a1c24(++_0x4543a0);}(_0x2d83,0x122));var _0x32d8=function(_0x433c49,_0x2c44e9){_0x433c49=_0x433c49-0x0;var _0x7fd052=_0x2d83[_0x433c49];return _0x7fd052;};'use strict';var Sequelize=require(_0x32d8('0x0'));var moment=require('moment');var util=require(_0x32d8('0x1'));var _=require('lodash');module[_0x32d8('0x2')]={'name':{'type':Sequelize[_0x32d8('0x3')],'allowNull':![],'unique':_0x32d8('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x294406){this[_0x32d8('0x5')](_0x32d8('0x4'),_0x294406);this['setDataValue'](_0x32d8('0x6'),_0x294406);},'comment':_0x32d8('0x7')},'fullname':{'type':Sequelize[_0x32d8('0x3')],'allowNull':![],'set':function(_0x153155){this[_0x32d8('0x5')](_0x32d8('0x8'),_0x153155);this[_0x32d8('0x5')](_0x32d8('0x9'),util[_0x32d8('0xa')](_0x32d8('0xb'),_0x153155,this[_0x32d8('0xc')](_0x32d8('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x3b2689){if(_0x3b2689){this[_0x32d8('0x5')]('email',_0x3b2689[_0x32d8('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0x32d8('0xf'),'user',_0x32d8('0x10'),_0x32d8('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x32d8('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x32d8('0x3')],'defaultValue':_0x32d8('0x12')},'internal':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':![],'unique':_0x32d8('0xd'),'set':function(_0x40f64b){this[_0x32d8('0x5')](_0x32d8('0xd'),_0x40f64b);this[_0x32d8('0x5')](_0x32d8('0x14'),_0x40f64b);this['setDataValue'](_0x32d8('0x9'),util[_0x32d8('0xa')](_0x32d8('0xb'),this['getDataValue'](_0x32d8('0x8')),_0x40f64b));}},'salt':{'type':Sequelize[_0x32d8('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x32d8('0x3')]},'address':{'type':Sequelize[_0x32d8('0x3')]},'zipcode':{'type':Sequelize[_0x32d8('0x3')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x32d8('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x32d8('0x17')},'lastPauseAt':{'type':Sequelize[_0x32d8('0x16')]},'chatCapacity':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x32d8('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x32d8('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x32d8('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x32d8('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x32d8('0x19')]('friend',_0x32d8('0x1a'),_0x32d8('0x1b')),'allowNull':!![],'defaultValue':_0x32d8('0x1c')},'context':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![],'defaultValue':_0x32d8('0x1d')},'callingpres':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x1e'),'ALLOWED_PASSED_SCREEN',_0x32d8('0x1f'),_0x32d8('0x20'),'PROHIB_NOT_SCREENED',_0x32d8('0x21'),_0x32d8('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![],'defaultValue':_0x32d8('0x23'),'set':function(_0x173e67){this[_0x32d8('0x5')](_0x32d8('0x24'),_0x173e67?_0x173e67[_0x32d8('0x25')](','):null);},'get':function(){return this[_0x32d8('0xc')](_0x32d8('0x24'))?this[_0x32d8('0xc')](_0x32d8('0x24'))[_0x32d8('0x26')](','):null;},'comment':_0x32d8('0x27')},'dtmfmode':{'type':Sequelize[_0x32d8('0x19')]('rfc2833',_0x32d8('0x28'),_0x32d8('0x29'),'inband',_0x32d8('0x2a')),'allowNull':!![],'defaultValue':_0x32d8('0x2b')},'directmedia':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no',_0x32d8('0x2d'),_0x32d8('0x2e'),_0x32d8('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x32d8('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x32d8('0x30'),'set':function(_0x321138){this[_0x32d8('0x5')]('nat',_0x321138?_0x321138['join'](','):null);},'get':function(){return this[_0x32d8('0xc')](_0x32d8('0x31'))?this['getDataValue'](_0x32d8('0x31'))[_0x32d8('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x32d8('0x3')]},'namedcallgroup':{'type':Sequelize[_0x32d8('0x3')]},'pickupgroup':{'type':Sequelize[_0x32d8('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x32d8('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x32d8('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x32d8('0x32')},'allow':{'type':Sequelize[_0x32d8('0x3')],'allowNull':![],'defaultValue':_0x32d8('0x33'),'set':function(_0x4fb93a){this[_0x32d8('0x5')](_0x32d8('0x34'),_0x4fb93a?_0x4fb93a['join'](';'):_0x32d8('0x33'));},'get':function(){return this[_0x32d8('0xc')](_0x32d8('0x34'))?this[_0x32d8('0xc')](_0x32d8('0x34'))[_0x32d8('0x26')](';'):null;},'comment':_0x32d8('0x35')},'autoframing':{'type':Sequelize[_0x32d8('0x19')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![],'set':function(_0x4cd4cc){this[_0x32d8('0x5')](_0x32d8('0x36'),_0x4cd4cc?_0x4cd4cc[_0x32d8('0x25')](','):null);},'get':function(){return this[_0x32d8('0xc')](_0x32d8('0x36'))?this[_0x32d8('0xc')](_0x32d8('0x36'))[_0x32d8('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x32d8('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x32d8('0x2c'),'no',_0x32d8('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![],'defaultValue':_0x32d8('0x38')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x32d8('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x32d8('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x39'),_0x32d8('0x3a'),_0x32d8('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x32d8('0x19')]('uac','uas'),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x32d8('0x2c')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x32d8('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x32d8('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x32d8('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x32d8('0x19')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no',_0x32d8('0x3c'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x3d'),_0x32d8('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x32d8('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x32d8('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x32d8('0x19')](_0x32d8('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x32d8('0x19')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x32d8('0x19')]('yes','no',_0x32d8('0x2d'),_0x32d8('0x2e'),_0x32d8('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x32d8('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x32d8('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x32d8('0x40')]},'showWebBar':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0,'set':function(_0x503b65){this[_0x32d8('0x5')]('showWebBar',_0x503b65);var _0x25621e=this[_0x32d8('0x41')]({'plain':!![]});switch(_0x503b65){case 0x0:case 0x1:var _0x3e95=_0x25621e[_0x32d8('0x24')]?_['isArray'](_0x25621e[_0x32d8('0x24')])?_0x25621e[_0x32d8('0x24')]['join']():_0x25621e[_0x32d8('0x24')]:_0x32d8('0x23');if(_0x3e95===_0x32d8('0x42')){_0x3e95='udp';}this['setDataValue']('transport',_0x3e95);this[_0x32d8('0x5')]('encryption','no');this[_0x32d8('0x5')](_0x32d8('0x43'),null);this[_0x32d8('0x5')]('force_avp',null);this[_0x32d8('0x5')](_0x32d8('0x44'),null);this[_0x32d8('0x5')]('dtlsenable',null);this['setDataValue'](_0x32d8('0x45'),null);this[_0x32d8('0x5')](_0x32d8('0x46'),null);this[_0x32d8('0x5')]('dtlscertfile',null);this['setDataValue'](_0x32d8('0x47'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x32d8('0x5')]('transport',_0x32d8('0x42'));this[_0x32d8('0x5')](_0x32d8('0x48'),'yes');this[_0x32d8('0x5')](_0x32d8('0x43'),_0x32d8('0x2c'));this[_0x32d8('0x5')]('force_avp','yes');this[_0x32d8('0x5')](_0x32d8('0x44'),_0x32d8('0x2c'));this[_0x32d8('0x5')]('dtlsenable',_0x32d8('0x2c'));this[_0x32d8('0x5')](_0x32d8('0x45'),'no');this[_0x32d8('0x5')](_0x32d8('0x46'),_0x32d8('0x49'));this[_0x32d8('0x5')](_0x32d8('0x4a'),_0x25621e[_0x32d8('0x4a')]||_0x32d8('0x4b'));this['setDataValue'](_0x32d8('0x47'),_0x25621e[_0x32d8('0x47')]||'/etc/pki/tls/private/motion.key');this[_0x32d8('0x5')]('rtcp_mux',_0x32d8('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x32d8('0x40')],'set':function(_0x49ea76){this[_0x32d8('0x5')]('permissions',_0x49ea76?_0x49ea76[_0x32d8('0x25')](','):[]);},'get':function(){return this[_0x32d8('0xc')]('permissions')?_['map'](this['getDataValue'](_0x32d8('0x4c'))[_0x32d8('0x26')](','),function(_0x16680a){return parseInt(_0x16680a,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x32d8('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x32d8('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x32d8('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x32d8('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x32d8('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x32d8('0x4d')],'get':function(){return this['getDataValue'](_0x32d8('0x4e'))?this[_0x32d8('0xc')](_0x32d8('0x4e')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x32d8('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x32d8('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![],'set':function(_0x1394a1){if(typeof _0x1394a1===_0x32d8('0x4f')){var _0x34b5a0=_0x1394a1==='1'?!![]:_0x1394a1==='0'?![]:_0x1394a1===_0x32d8('0x50')?!![]:_0x1394a1===_0x32d8('0x51')?![]:![];this[_0x32d8('0x5')](_0x32d8('0x52'),_0x34b5a0);}else{this['setDataValue'](_0x32d8('0x52'),_0x1394a1);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xbdb9cd){this[_0x32d8('0x5')](_0x32d8('0x53'),_0xbdb9cd);if(_0xbdb9cd===!![]){this[_0x32d8('0x5')]('blockedAt',moment());this[_0x32d8('0x5')](_0x32d8('0x54'),0x0);}else{this[_0x32d8('0x5')](_0x32d8('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x32d8('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x32d8('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x32d8('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x8ff4=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','nonat','update','yes','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','showWebBar','isArray','join','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blocked','loginAttempts','blockedAt','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','user','agent','internal','accountcode','callerid','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','ENUM','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x28f947,_0x1f3a25){var _0x52d24c=function(_0x335aca){while(--_0x335aca){_0x28f947['push'](_0x28f947['shift']());}};_0x52d24c(++_0x1f3a25);}(_0x8ff4,0x18b));var _0x48ff=function(_0x33ddea,_0x222f65){_0x33ddea=_0x33ddea-0x0;var _0x5e2f59=_0x8ff4[_0x33ddea];return _0x5e2f59;};'use strict';var Sequelize=require(_0x48ff('0x0'));var moment=require('moment');var util=require(_0x48ff('0x1'));var _=require(_0x48ff('0x2'));module[_0x48ff('0x3')]={'name':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'unique':_0x48ff('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x53183c){this[_0x48ff('0x6')](_0x48ff('0x5'),_0x53183c);this[_0x48ff('0x6')](_0x48ff('0x7'),_0x53183c);},'comment':_0x48ff('0x8')},'fullname':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'set':function(_0x152e9a){this[_0x48ff('0x6')]('fullname',_0x152e9a);this[_0x48ff('0x6')]('callerid',util[_0x48ff('0x9')](_0x48ff('0xa'),_0x152e9a,this[_0x48ff('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'unique':_0x48ff('0xc'),'validate':{'isEmail':!![]},'set':function(_0xbb5e){if(_0xbb5e){this[_0x48ff('0x6')](_0x48ff('0xc'),_0xbb5e[_0x48ff('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x48ff('0xe'),_0x48ff('0xf'),_0x48ff('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x48ff('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x48ff('0x11'),'set':function(_0x12b30a){this[_0x48ff('0x6')](_0x48ff('0x11'),_0x12b30a);this[_0x48ff('0x6')](_0x48ff('0x12'),_0x12b30a);this[_0x48ff('0x6')](_0x48ff('0x13'),util[_0x48ff('0x9')](_0x48ff('0xa'),this['getDataValue'](_0x48ff('0x14')),_0x12b30a));}},'salt':{'type':Sequelize[_0x48ff('0x4')]},'phone':{'type':Sequelize[_0x48ff('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x48ff('0x4')]},'userpic':{'type':Sequelize[_0x48ff('0x4')]},'city':{'type':Sequelize[_0x48ff('0x4')]},'country':{'type':Sequelize[_0x48ff('0x4')]},'online':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x48ff('0x16')},'lastPauseAt':{'type':Sequelize[_0x48ff('0x17')]},'chatCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x48ff('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'defaultValue':_0x48ff('0x19')},'ipaddr':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x48ff('0x1a')]('friend',_0x48ff('0xf'),'peer'),'allowNull':!![],'defaultValue':_0x48ff('0x1b')},'context':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x48ff('0x1c'),_0x48ff('0x1d'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x48ff('0x1e'),_0x48ff('0x1f'),_0x48ff('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x36479b){this[_0x48ff('0x6')](_0x48ff('0x21'),_0x36479b?_0x36479b['join'](','):null);},'get':function(){return this[_0x48ff('0xb')](_0x48ff('0x21'))?this[_0x48ff('0xb')](_0x48ff('0x21'))['split'](','):null;},'comment':_0x48ff('0x22')},'dtmfmode':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x23'),_0x48ff('0x24'),'shortinfo','inband',_0x48ff('0x25')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x48ff('0x26'),_0x48ff('0x27'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x48ff('0x29'),'set':function(_0xff87e2){this[_0x48ff('0x6')](_0x48ff('0x2a'),_0xff87e2?_0xff87e2['join'](','):null);},'get':function(){return this[_0x48ff('0xb')]('nat')?this['getDataValue'](_0x48ff('0x2a'))[_0x48ff('0x2b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x48ff('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x48ff('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x48ff('0x4')]},'disallow':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'defaultValue':_0x48ff('0x2c')},'allow':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'defaultValue':_0x48ff('0x2d'),'set':function(_0x55584f){this['setDataValue'](_0x48ff('0x2e'),_0x55584f?_0x55584f['join'](';'):_0x48ff('0x2d'));},'get':function(){return this[_0x48ff('0xb')](_0x48ff('0x2e'))?this[_0x48ff('0xb')]('allow')[_0x48ff('0x2b')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'set':function(_0xe6833a){this[_0x48ff('0x6')](_0x48ff('0x2f'),_0xe6833a?_0xe6833a['join'](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x48ff('0xb')]('insecure')[_0x48ff('0x2b')](','):null;},'comment':_0x48ff('0x30')},'trustrpid':{'type':Sequelize[_0x48ff('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no',_0x48ff('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x48ff('0x1a')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'defaultValue':_0x48ff('0x32')},'amaflags':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':_0x48ff('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no',_0x48ff('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x48ff('0x34'),_0x48ff('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x36'),_0x48ff('0x37')),'allowNull':!![],'defaultValue':_0x48ff('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':_0x48ff('0x28')},'keepalive':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x48ff('0x1a')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no',_0x48ff('0x38'),_0x48ff('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x48ff('0x1a')]('active',_0x48ff('0x3a'),_0x48ff('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no','nonat',_0x48ff('0x27'),_0x48ff('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x48ff('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x48ff('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x48ff('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3c962d){this[_0x48ff('0x6')](_0x48ff('0x3e'),_0x3c962d);var _0x46f6e7=this['get']({'plain':!![]});switch(_0x3c962d){case 0x0:case 0x1:var _0x2fa3cd=_0x46f6e7[_0x48ff('0x21')]?_[_0x48ff('0x3f')](_0x46f6e7['transport'])?_0x46f6e7[_0x48ff('0x21')][_0x48ff('0x40')]():_0x46f6e7[_0x48ff('0x21')]:_0x48ff('0x41');if(_0x2fa3cd===_0x48ff('0x42')){_0x2fa3cd=_0x48ff('0x41');}this[_0x48ff('0x6')](_0x48ff('0x21'),_0x2fa3cd);this[_0x48ff('0x6')](_0x48ff('0x43'),'no');this[_0x48ff('0x6')](_0x48ff('0x44'),null);this[_0x48ff('0x6')](_0x48ff('0x45'),null);this[_0x48ff('0x6')](_0x48ff('0x46'),null);this[_0x48ff('0x6')](_0x48ff('0x47'),null);this['setDataValue'](_0x48ff('0x48'),null);this[_0x48ff('0x6')](_0x48ff('0x49'),null);this[_0x48ff('0x6')](_0x48ff('0x4a'),null);this[_0x48ff('0x6')](_0x48ff('0x4b'),null);this['setDataValue'](_0x48ff('0x4c'),'no');break;case 0x2:this[_0x48ff('0x6')](_0x48ff('0x21'),_0x48ff('0x42'));this[_0x48ff('0x6')]('encryption','yes');this[_0x48ff('0x6')](_0x48ff('0x44'),'yes');this[_0x48ff('0x6')](_0x48ff('0x45'),_0x48ff('0x28'));this[_0x48ff('0x6')](_0x48ff('0x46'),_0x48ff('0x28'));this['setDataValue'](_0x48ff('0x47'),_0x48ff('0x28'));this[_0x48ff('0x6')]('dtlsverify','no');this[_0x48ff('0x6')](_0x48ff('0x49'),'actpass');this[_0x48ff('0x6')](_0x48ff('0x4a'),_0x46f6e7[_0x48ff('0x4a')]||'/etc/pki/tls/certs/motion.crt');this[_0x48ff('0x6')]('dtlsprivatekey',_0x46f6e7[_0x48ff('0x4b')]||_0x48ff('0x4d'));this[_0x48ff('0x6')](_0x48ff('0x4c'),_0x48ff('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x48ff('0x3d')],'set':function(_0x34ee3b){this['setDataValue'](_0x48ff('0x4e'),_0x34ee3b?_0x34ee3b['join'](','):[]);},'get':function(){return this[_0x48ff('0xb')](_0x48ff('0x4e'))?_['map'](this[_0x48ff('0xb')](_0x48ff('0x4e'))['split'](','),function(_0x20db35){return parseInt(_0x20db35,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x48ff('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x48ff('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x48ff('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x48ff('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x48ff('0xb')](_0x48ff('0x4f'))?this[_0x48ff('0xb')](_0x48ff('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x48ff('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1c8f57){if(typeof _0x1c8f57==='string'){var _0x480565=_0x1c8f57==='1'?!![]:_0x1c8f57==='0'?![]:_0x1c8f57===_0x48ff('0x50')?!![]:_0x1c8f57==='false'?![]:![];this['setDataValue'](_0x48ff('0x51'),_0x480565);}else{this[_0x48ff('0x6')]('screenrecording',_0x1c8f57);}}},'blocked':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![],'set':function(_0x11e47e){this[_0x48ff('0x6')](_0x48ff('0x52'),_0x11e47e);if(_0x11e47e===!![]){this['setDataValue']('blockedAt',moment());this[_0x48ff('0x6')](_0x48ff('0x53'),0x0);}else{this[_0x48ff('0x6')](_0x48ff('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x48ff('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x48ff('0x18')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a2e2152..f64bf0b 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 _0x79a4=['user_has_chat_interactions:save','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notLike','$iLike','$notILike','$like','$contains','$contained','$any','firstName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','removeApiKey','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','idle','unknown','ringing','teams','inbound','desc','asc','voiceStatus','busy','slice','charAt','toUpperCase','SELECT','select','field','InteractionId','ui.createdAt','user_has_','_interactions','toString','messengerSoundNotification','moment','path','squel','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','../../mysqldb','socket.io-emitter','./user.socket','redis','defaults','localhost','client','http','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','update','role','agent','emit','get','admin','user','Telephones','telephone','ignore','map','value','includes','find','UserProfileResource','stack','name','send','User','rawAttributes','fieldName','type','password','previousPasswords','resetPasswordToken','resetPasswordExpires','index','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','openchannel','all','catch','show','params','merge','options','whatsapp','mail','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','113','110','104','105','106','107','108','109','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','Queues','spread','toLowerCase','Queue:save','voice','format','SIP/%s','voicePause','penalty','upsert','removeQueues','remove','capitalize','isArray','QueueId','Queue:remove','UserVoiceQueueRt','destroy','addAvatar','userpic','file','filename','join','server/files/images/logos/default_profile.png','download','existsSync','root','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','CmList','List','Tag','Tags','tag','model','keys','Queue','filters','intersection','order','sort','filter','Unknown\x20role','hasOwnProperty','fields','pick','getVoiceQueuesRt','nolimit','getGroups','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','isMiddleware','logout','pause','updateAttributes','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','unpause','getTeams','Team','addTeams','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','removeTeams','removeAgent','getDataValue','VoicePrefixId','getLists','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x79a4,0x1e5));var _0x479a=function(_0x1c51b5,_0xf5ac53){_0x1c51b5=_0x1c51b5-0x0;var _0x1fd620=_0x79a4[_0x1c51b5];return _0x1fd620;};'use strict';var moment=require(_0x479a('0x0'));var util=require('util');var path=require(_0x479a('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x479a('0x2'));var Redis=require('ioredis');var jayson=require(_0x479a('0x3'));var authService=require(_0x479a('0x4'));var contacts=require(_0x479a('0x5'));var qs=require(_0x479a('0x6'));var rta=require('../../components/realtime/agents');var logger=require(_0x479a('0x7'))(_0x479a('0x8'));var utils=require('../../config/utils');var config=require(_0x479a('0x9'));var licenseUtil=require(_0x479a('0xa'));var APIBadRequestError=require(_0x479a('0xb'))[_0x479a('0xc')];var APINotFoundError=require(_0x479a('0xb'))[_0x479a('0xd')];var APIForbiddenError=require(_0x479a('0xb'))[_0x479a('0xe')];var APIHandleError=require(_0x479a('0xb'))['handleError'];var db=require(_0x479a('0xf'))['db'];var socket=require(_0x479a('0x10'))(new Redis(config['redis']));require(_0x479a('0x11'))['register'](socket);config[_0x479a('0x12')]=_[_0x479a('0x13')](config['redis'],{'host':_0x479a('0x14'),'port':0x18eb});var amiClient=jayson[_0x479a('0x15')][_0x479a('0x16')]({'port':0x232a});var values;function respondWithStatusCode(_0x6d5146,_0x1a748e){_0x1a748e=_0x1a748e||0xcc;return function(_0xfd423e){if(_0xfd423e){return _0x6d5146[_0x479a('0x17')](_0x1a748e);}return _0x6d5146[_0x479a('0x18')](_0x1a748e)[_0x479a('0x19')]();};}function respondWithResult(_0x5f76b0,_0x5c2759){_0x5c2759=_0x5c2759||0xc8;return function(_0x3e74a8){if(_0x3e74a8){return _0x5f76b0['status'](_0x5c2759)['json'](_0x3e74a8);}};}function respondWithFilteredResult(_0x225729,_0x2deb1d){return function(_0x43e8c9){if(_0x43e8c9){var _0x47a65a=typeof _0x2deb1d[_0x479a('0x1a')]==='undefined'&&typeof _0x2deb1d[_0x479a('0x1b')]===_0x479a('0x1c');var _0x1a28b8=_0x43e8c9[_0x479a('0x1d')];var _0x44e596=_0x47a65a?0x0:_0x2deb1d[_0x479a('0x1a')];var _0x2e76fa=_0x47a65a?_0x43e8c9[_0x479a('0x1d')]:_0x2deb1d[_0x479a('0x1a')]+_0x2deb1d[_0x479a('0x1b')];var _0x2f3747;if(_0x2e76fa>=_0x1a28b8){_0x2e76fa=_0x1a28b8;_0x2f3747=0xc8;}else{_0x2f3747=0xce;}_0x225729[_0x479a('0x18')](_0x2f3747);return _0x225729[_0x479a('0x1e')](_0x479a('0x1f'),_0x44e596+'-'+_0x2e76fa+'/'+_0x1a28b8)[_0x479a('0x20')](_0x43e8c9);}return null;};}function respondWithRpcPromise(_0xc0dc2a,_0x37187f,_0x57c7ef,_0x1a5d71){return new Promise(function(_0x2f4133,_0x4edcfa){var _0x1ff53c=_0x1a5d71||amiClient;return _0x1ff53c[_0x479a('0x21')](_0xc0dc2a,_0x57c7ef)[_0x479a('0x22')](function(_0x5984ec){logger[_0x479a('0x23')](_0x479a('0x24'),_0x37187f,_0x479a('0x25'));logger[_0x479a('0x26')](_0x479a('0x27'),_0x37187f,'request\x20sent',JSON['stringify'](_0x5984ec));if(_0x5984ec[_0x479a('0x28')]){if(_0x5984ec[_0x479a('0x28')][_0x479a('0x29')]===0x1f4){logger[_0x479a('0x28')](_0x479a('0x24'),_0x37187f,_0x5984ec[_0x479a('0x28')][_0x479a('0x2a')]);return _0x4edcfa(_0x5984ec[_0x479a('0x28')]['message']);}logger[_0x479a('0x28')](_0x479a('0x24'),_0x37187f,_0x5984ec['error'][_0x479a('0x2a')]);return _0x2f4133(_0x5984ec[_0x479a('0x28')][_0x479a('0x2a')]);}else{logger['info'](_0x479a('0x24'),_0x37187f,'request\x20sent');_0x2f4133(_0x5984ec['result'][_0x479a('0x2a')]);}})['catch'](function(_0x5cc49){logger[_0x479a('0x28')]('User,\x20%s,\x20%s',_0x37187f,_0x5cc49);_0x4edcfa(_0x5cc49);});});}function saveUpdates(_0x1856ad){return function(_0x197d69){if(_0x197d69){return _0x197d69[_0x479a('0x2b')](_0x1856ad)[_0x479a('0x22')](function(_0x38cc17){if(_0x38cc17[_0x479a('0x2c')]===_0x479a('0x2d')){socket[_0x479a('0x2e')]('userNotification:recalc:'+_0x38cc17['id'],_0x38cc17);}return _0x38cc17;});}return null;};}function removeEntity(_0x9198a1,_0x134233){return function(_0x5140e6){if(_0x5140e6){return _0x5140e6['destroy']({'transaction':_0x134233})[_0x479a('0x22')](function(){var _0x58abc4=_0x5140e6[_0x479a('0x2f')]({'plain':!![]});if(_0x58abc4['role']===_0x479a('0x30'))return;var _0x1ab18f=[{'name':'Users','value':_0x479a('0x31'),'ignore':!![]},{'name':'Agents','value':_0x479a('0x2d'),'ignore':![]},{'name':_0x479a('0x32'),'value':_0x479a('0x33'),'ignore':![]}];var _0x5ab7fd=_(_0x1ab18f)['filter'](_0x479a('0x34'))[_0x479a('0x35')](_0x479a('0x36'))['value']();if(_[_0x479a('0x37')](_0x5ab7fd,_0x58abc4['role'])){return;}var _0x227d73=_[_0x479a('0x38')](_0x1ab18f,[_0x479a('0x36'),_0x58abc4['role']])['name'];return db[_0x479a('0x39')]['destroy']({'where':{'type':_0x227d73,'resourceId':_0x58abc4['id']},'transaction':_0x134233})[_0x479a('0x22')](function(){return _0x5140e6;});})[_0x479a('0x22')](function(){_0x9198a1[_0x479a('0x18')](0xcc)[_0x479a('0x19')]();});}};}function handleEntityNotFound(_0x9db73d){return function(_0x36fdb7){if(!_0x36fdb7){_0x9db73d[_0x479a('0x17')](0x194);}return _0x36fdb7;};}function handleError(_0x937541,_0x2e0cee){_0x2e0cee=_0x2e0cee||0x1f4;return function(_0x2a22cd){logger['error'](_0x2a22cd[_0x479a('0x3a')]);if(_0x2a22cd[_0x479a('0x3b')]){delete _0x2a22cd['name'];}_0x937541['status'](_0x2e0cee)[_0x479a('0x3c')](_0x2a22cd);};}function getUserAttributes(){return _(db[_0x479a('0x3d')][_0x479a('0x3e')])[_0x479a('0x35')](function(_0x1f80a2){return{'name':_0x1f80a2[_0x479a('0x3f')],'type':_0x1f80a2[_0x479a('0x40')]['key']};})['filter'](function(_0x14732c){return![_0x479a('0x41'),'salt',_0x479a('0x42'),_0x479a('0x43'),_0x479a('0x44'),'md5secret'][_0x479a('0x37')](_0x14732c['name']);})[_0x479a('0x36')]();}exports[_0x479a('0x45')]=function(_0x55fa6d,_0x540a87){var _0x2c263d={},_0xeebef4={'count':0x0,'rows':[]};var _0x5b71f9=getUserAttributes();_0x2c263d=qs[_0x479a('0x46')](_0x5b71f9,_0x55fa6d);var _0x2ec29={'where':_0x2c263d[_0x479a('0x47')]};return db[_0x479a('0x3d')][_0x479a('0x1d')](_0x2ec29)[_0x479a('0x22')](function(_0x4819f3){_0xeebef4['count']=_0x4819f3;if(_0x55fa6d[_0x479a('0x48')][_0x479a('0x49')]){_0x2c263d[_0x479a('0x4a')]=[{'all':!![]}];}if(_0x55fa6d['query'][_0x479a('0x4b')]===_0x479a('0x4c')){_0x2c263d[_0x479a('0x4a')]=[{'model':db[_0x479a('0x4d')],'as':'userSetting'}];}if(!_[_0x479a('0x37')](_0x2c263d[_0x479a('0x4e')],'id')){_0x2c263d[_0x479a('0x4e')][_0x479a('0x4f')]('id');}return db[_0x479a('0x3d')][_0x479a('0x50')](_0x2c263d);})[_0x479a('0x22')](function(_0x2867a1){_0xeebef4[_0x479a('0x51')]=_0x2867a1;if(_0x55fa6d['query'][_0x479a('0x52')]===_0x479a('0x4c')){var _0x5092f=[];for(var _0x36638d=0x0;_0x36638d<_0xeebef4[_0x479a('0x51')][_0x479a('0x53')];_0x36638d++){_0x5092f[_0x479a('0x4f')](get_open_tabs(_0x479a('0x54'),_0xeebef4[_0x479a('0x51')][_0x36638d][_0x479a('0x55')]));_0x5092f[_0x479a('0x4f')](get_open_tabs(_0x479a('0x56'),_0xeebef4[_0x479a('0x51')][_0x36638d][_0x479a('0x55')]));_0x5092f[_0x479a('0x4f')](get_open_tabs(_0x479a('0x57'),_0xeebef4['rows'][_0x36638d][_0x479a('0x55')]));_0x5092f['push'](get_open_tabs('mail',_0xeebef4[_0x479a('0x51')][_0x36638d][_0x479a('0x55')]));_0x5092f[_0x479a('0x4f')](get_open_tabs(_0x479a('0x58'),_0xeebef4[_0x479a('0x51')][_0x36638d][_0x479a('0x55')]));_0x5092f[_0x479a('0x4f')](get_open_tabs('whatsapp',_0xeebef4[_0x479a('0x51')][_0x36638d]['dataValues']));}return Promise[_0x479a('0x59')](_0x5092f)[_0x479a('0x22')](function(){return _0xeebef4;});}else{return _0xeebef4;}})[_0x479a('0x22')](respondWithFilteredResult(_0x540a87,_0x2c263d))[_0x479a('0x5a')](handleError(_0x540a87,null));};exports[_0x479a('0x5b')]=function(_0x4b3066,_0x159670){var _0x56b250=getUserAttributes();_0x4b3066[_0x479a('0x48')]['id']=_0x4b3066[_0x479a('0x5c')]['id'];var _0x56f6bb=qs['getOptions'](_0x56b250,_0x4b3066);if(_0x4b3066[_0x479a('0x48')][_0x479a('0x49')]){_0x56f6bb[_0x479a('0x4a')]=[{'all':!![]}];}if(_0x4b3066['query'][_0x479a('0x4b')]===_0x479a('0x4c')){_0x56f6bb['include']=[{'model':db[_0x479a('0x4d')],'as':_0x479a('0x4b')}];}_0x56f6bb=_[_0x479a('0x5d')]({},_0x56f6bb,_0x4b3066[_0x479a('0x5e')]);if(!_[_0x479a('0x37')](_0x56f6bb[_0x479a('0x4e')],'id')){_0x56f6bb[_0x479a('0x4e')]['push']('id');}return db['User']['find'](_0x56f6bb)[_0x479a('0x22')](handleEntityNotFound(_0x159670,null))[_0x479a('0x22')](function(_0x207c11){var _0x45ea5a=[];values=_0x207c11;if(_0x4b3066[_0x479a('0x48')][_0x479a('0x52')]==='true'){_0x45ea5a[_0x479a('0x4f')](get_open_tabs(_0x479a('0x54'),_0x207c11[_0x479a('0x55')]));_0x45ea5a['push'](get_open_tabs(_0x479a('0x56'),_0x207c11['dataValues']));_0x45ea5a[_0x479a('0x4f')](get_open_tabs(_0x479a('0x58'),_0x207c11['dataValues']));_0x45ea5a[_0x479a('0x4f')](get_open_tabs(_0x479a('0x5f'),_0x207c11[_0x479a('0x55')]));_0x45ea5a[_0x479a('0x4f')](get_open_tabs(_0x479a('0x57'),_0x207c11[_0x479a('0x55')]));_0x45ea5a['push'](get_open_tabs(_0x479a('0x60'),_0x207c11['dataValues']));return Promise['all'](_0x45ea5a);}else{return values;}})[_0x479a('0x22')](function(){return values;})[_0x479a('0x22')](respondWithResult(_0x159670,null))[_0x479a('0x5a')](handleError(_0x159670,null));};exports[_0x479a('0x2b')]=function(_0x3ead67,_0x6a4302){if(_0x3ead67[_0x479a('0x61')]['id']){delete _0x3ead67[_0x479a('0x61')]['id'];}delete _0x3ead67[_0x479a('0x61')][_0x479a('0x2c')];return db[_0x479a('0x3d')][_0x479a('0x38')]({'where':{'id':_0x3ead67[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x6a4302,null))[_0x479a('0x22')](saveUpdates(_0x3ead67[_0x479a('0x61')],null))[_0x479a('0x22')](respondWithResult(_0x6a4302,null))['catch'](handleError(_0x6a4302,null));};exports[_0x479a('0x62')]=function(_0x33cc4f,_0x1ef9fb){return db[_0x479a('0x3d')][_0x479a('0x62')]()[_0x479a('0x22')](respondWithResult(_0x1ef9fb,null))['catch'](handleError(_0x1ef9fb,null));};exports[_0x479a('0x63')]=function(_0x59a2ee,_0x20e2f7){return db[_0x479a('0x3d')][_0x479a('0x38')]({'where':{'id':_0x59a2ee['params']['id']}})['then'](handleEntityNotFound(_0x20e2f7,null))[_0x479a('0x22')](function(_0x4bfa6e){if(_0x4bfa6e){return _0x4bfa6e[_0x479a('0x63')](_0x59a2ee[_0x479a('0x61')][_0x479a('0x64')],_[_0x479a('0x65')](_0x59a2ee[_0x479a('0x61')],[_0x479a('0x64'),'id'])||{});}})[_0x479a('0x22')](respondWithResult(_0x20e2f7,null))[_0x479a('0x5a')](handleError(_0x20e2f7,null));};function validateUser(_0x22b1bf){return new Promise(function(_0x2fdd93,_0x797710){if(_0x22b1bf[_0x479a('0x66')])return _0x2fdd93(_0x22b1bf);return db[_0x479a('0x67')][_0x479a('0x68')](0x1)['then'](function(_0x58946f){if(_0x58946f[_0x479a('0x69')])authService[_0x479a('0x6a')](_0x22b1bf['password']);db[_0x479a('0x3d')]['max'](_0x479a('0x66'))[_0x479a('0x22')](function(_0x5e7e0f){if(_[_0x479a('0x6b')](_0x5e7e0f)){_0x22b1bf[_0x479a('0x66')]=_0x58946f[_0x479a('0x6c')]||0x1;return;}if(_[_0x479a('0x6b')](_0x58946f['min_internal'])||_0x58946f[_0x479a('0x6c')]===_0x5e7e0f){_0x22b1bf[_0x479a('0x66')]=_0x5e7e0f+0x1;return;}if(_0x58946f[_0x479a('0x6c')]>_0x5e7e0f){_0x22b1bf[_0x479a('0x66')]=_0x58946f[_0x479a('0x6c')];return;}return db[_0x479a('0x6d')]['query'](_0x479a('0x6e'),{'type':db[_0x479a('0x6d')][_0x479a('0x6f')]['SELECT']})[_0x479a('0x22')](function(_0x477fb9){if(_0x477fb9&&_0x477fb9[_0x479a('0x53')]){for(var _0x411e09=0x0,_0x17a889=_0x477fb9['length'];_0x411e09<_0x17a889&&_[_0x479a('0x6b')](_0x22b1bf[_0x479a('0x66')]);_0x411e09++){if(_0x58946f[_0x479a('0x6c')]<=_0x477fb9[_0x411e09][_0x479a('0x70')]){_0x22b1bf['internal']=_0x477fb9[_0x411e09][_0x479a('0x70')];}else if(_0x58946f[_0x479a('0x6c')]>_0x477fb9[_0x411e09][_0x479a('0x70')]&&_0x58946f['min_internal']<=_0x477fb9[_0x411e09]['to']){_0x22b1bf[_0x479a('0x66')]=_0x58946f[_0x479a('0x6c')];}}}if(_['isNil'](_0x22b1bf[_0x479a('0x66')])){_0x22b1bf[_0x479a('0x66')]=_0x5e7e0f+0x1;}return _0x2fdd93(_0x22b1bf);});});})[_0x479a('0x5a')](function(_0x13eb9a){_0x797710(_0x13eb9a);});});}function updateUser(_0x1dc0bf){return new Promise(function(_0x453294,_0x31dbbb){try{if(_0x1dc0bf[_0x479a('0x71')]){_0x1dc0bf[_0x479a('0x72')]=_0x1dc0bf[_0x479a('0x66')];_0x1dc0bf[_0x479a('0x73')]={'mailbox':_0x1dc0bf['internal'],'password':_0x1dc0bf['password'],'fullname':_0x1dc0bf[_0x479a('0x74')],'email':_0x1dc0bf[_0x479a('0x75')]};}if(_0x1dc0bf[_0x479a('0x2c')]===_0x479a('0x2d')){if(!_0x1dc0bf[_0x479a('0x76')])_0x1dc0bf[_0x479a('0x76')]=[_0x479a('0x77'),_0x479a('0x78'),'103',_0x479a('0x79'),_0x479a('0x7a'),_0x479a('0x7b'),_0x479a('0x7c'),_0x479a('0x7d'),_0x479a('0x7e'),_0x479a('0x7f'),_0x479a('0x80'),'100',_0x479a('0x81'),_0x479a('0x82'),_0x479a('0x83')];}_0x453294(_0x1dc0bf);}catch(_0x5888e8){_0x31dbbb(_0x5888e8);}});}exports[_0x479a('0x84')]=function(_0x2c237d,_0x4d494e){if(_0x2c237d[_0x479a('0x31')][_0x479a('0x2c')]===_0x479a('0x2d'))throw new Error(_0x479a('0x85'));if(_0x2c237d[_0x479a('0x61')]['role']===_0x479a('0x31')&&_0x2c237d['user']['role']!==_0x479a('0x30')){throw new Error(_0x479a('0x86'));}if(_0x2c237d[_0x479a('0x61')]['role']==='admin'&&_0x2c237d[_0x479a('0x31')][_0x479a('0x2c')]!==_0x479a('0x30')){throw new Error(_0x479a('0x87'));}return licenseUtil[_0x479a('0x88')]([_0x2c237d[_0x479a('0x61')]])[_0x479a('0x22')](function(){return validateUser(_0x2c237d[_0x479a('0x61')]);})[_0x479a('0x22')](function(_0x30cbf1){return updateUser(_0x30cbf1)[_0x479a('0x22')](function(_0x8b43ca){if(_0x8b43ca['role']===_0x479a('0x30')){_0x8b43ca[_0x479a('0x89')]=_0x2c237d['user']['settingsEnabled'];delete _0x8b43ca[_0x479a('0x8a')];}return _0x8b43ca;});})['then'](function(_0x262abe){return db[_0x479a('0x3d')]['create'](_0x262abe,{'include':[{'model':db[_0x479a('0x73')],'as':_0x479a('0x73')}]});})['then'](function(_0x587f17){if(_0x2c237d['body'][_0x479a('0x2c')]==='user')return _0x587f17;if(_0x2c237d['user'][_0x479a('0x2c')]!=='user')return _0x587f17;return db[_0x479a('0x8b')][_0x479a('0x38')]({'where':{'name':_0x587f17[_0x479a('0x2c')]===_0x479a('0x2d')?_0x479a('0x8c'):_0x479a('0x32'),'userProfileId':_0x2c237d[_0x479a('0x31')][_0x479a('0x8a')]},'raw':!![]})[_0x479a('0x22')](function(_0x480978){if(!_0x480978||_0x480978['autoAssociation']!=0x0)return _0x587f17;return db[_0x479a('0x39')]['create']({'name':_0x587f17[_0x479a('0x3b')],'resourceId':_0x587f17['id'],'type':_0x480978[_0x479a('0x3b')],'sectionId':_0x480978['id']},{})[_0x479a('0x22')](function(){return _0x587f17;});})[_0x479a('0x5a')](function(_0x533f4f){logger[_0x479a('0x28')](_0x479a('0x8d'),_0x533f4f);throw _0x533f4f;});})[_0x479a('0x22')](respondWithResult(_0x4d494e,0xc9))[_0x479a('0x5a')](handleError(_0x4d494e,null));};exports['bulkCreate']=function(_0x184449,_0x5221d4){var _0x460269=_0x184449['body'];var _0x504f13=[];if(_0x184449[_0x479a('0x31')][_0x479a('0x2c')]===_0x479a('0x2d'))throw new Error(_0x479a('0x85'));if(_[_0x479a('0x8e')](_0x460269,[_0x479a('0x2c'),_0x479a('0x31')])&&_0x184449[_0x479a('0x31')]['role']!==_0x479a('0x30')){throw new Error(_0x479a('0x86'));}if(_[_0x479a('0x8e')](_0x460269,[_0x479a('0x2c'),'admin'])&&_0x184449[_0x479a('0x31')]['role']!==_0x479a('0x30')){throw new Error(_0x479a('0x8f'));}return licenseUtil[_0x479a('0x88')](_0x460269)[_0x479a('0x22')](function(){return validateUser(_0x460269[0x0]);})[_0x479a('0x22')](function(){for(var _0x448a0f=0x1;_0x448a0f<_0x460269[_0x479a('0x53')];_0x448a0f++){var _0x20297e=_0x460269[_0x448a0f-0x1][_0x479a('0x66')];if(!_0x460269[_0x448a0f]['internal'])_0x460269[_0x448a0f][_0x479a('0x66')]=_0x20297e+0x1;_0x504f13['push'](validateUser(_0x460269[_0x448a0f]));}return Promise[_0x479a('0x59')](_0x504f13);})[_0x479a('0x22')](function(){_0x504f13=[];for(var _0x5b3b70=0x0;_0x5b3b70<_0x460269[_0x479a('0x53')];_0x5b3b70++){_0x504f13['push'](updateUser(_0x460269[_0x5b3b70]));}return Promise[_0x479a('0x59')](_0x504f13);})[_0x479a('0x22')](function(){_0x504f13=_0x460269['map'](function(_0x5f3772){return db['User'][_0x479a('0x84')](_0x5f3772,{'include':[{'model':db[_0x479a('0x73')],'as':_0x479a('0x73')}]})[_0x479a('0x22')](function(_0x99f421){_0x5f3772['id']=_0x99f421['id'];return _0x5f3772;});});return Promise['all'](_0x504f13);})[_0x479a('0x22')](function(_0x3188c2){if(_0x184449[_0x479a('0x61')][_0x479a('0x2c')]===_0x479a('0x31'))return _0x3188c2;if(_0x184449['user'][_0x479a('0x2c')]!==_0x479a('0x31'))return _0x3188c2;var _0x5e7396=_['some'](_0x3188c2,function(_0x9f0da9){return _0x9f0da9[_0x479a('0x2c')]===_0x479a('0x2d')||_0x9f0da9[_0x479a('0x2c')]===_0x479a('0x33');});if(!_0x5e7396)return _0x3188c2;return db[_0x479a('0x8b')][_0x479a('0x50')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x184449[_0x479a('0x31')][_0x479a('0x8a')]},'raw':!![]})[_0x479a('0x22')](function(_0x1c214a){if(_[_0x479a('0x90')](_0x1c214a)||!_['some'](_0x1c214a,[_0x479a('0x91'),0x0]))return _0x3188c2;_0x504f13=[];var _0x227339=_(_0x1c214a)[_0x479a('0x35')](function(_0x315e7b){if(_0x315e7b[_0x479a('0x91')]===0x1)return;return _0x315e7b[_0x479a('0x3b')]===_0x479a('0x8c')?_0x479a('0x2d'):'telephone';})[_0x479a('0x92')]()[_0x479a('0x36')]();for(var _0x1664ea=0x0;_0x1664ea<_0x3188c2['length'];_0x1664ea++){if(!_[_0x479a('0x37')](_0x227339,_0x3188c2[_0x1664ea][_0x479a('0x2c')]))return;var _0x1280fd=_0x3188c2[_0x1664ea][_0x479a('0x2c')]===_0x479a('0x2d')?'Agents':_0x479a('0x32');_0x504f13['push'](db[_0x479a('0x39')][_0x479a('0x84')]({'name':_0x3188c2[_0x1664ea][_0x479a('0x3b')],'resourceId':_0x3188c2[_0x1664ea]['id'],'type':_0x1280fd,'sectionId':_[_0x479a('0x38')](_0x1c214a,[_0x479a('0x3b'),_0x1280fd])['id']},{}));}return Promise['all'](_0x504f13);});})[_0x479a('0x22')](respondWithResult(_0x5221d4,0xc9))[_0x479a('0x5a')](handleError(_0x5221d4,null));};exports[_0x479a('0x93')]=function(_0x328f47,_0x2e9236){if(_0x328f47[_0x479a('0x61')]['id']){delete _0x328f47[_0x479a('0x61')]['id'];}return db['User'][_0x479a('0x38')]({'where':{'id':_0x328f47['params']['id']}})[_0x479a('0x22')](function(_0x2e26ac){if(!_0x2e26ac)return null;if(_0x2e26ac['id']===_0x328f47[_0x479a('0x31')]['id']){if(!_0x328f47[_0x479a('0x61')][_0x479a('0x94')]||!_0x328f47[_0x479a('0x61')][_0x479a('0x95')]){throw new db['Sequelize'][(_0x479a('0x96'))](_0x479a('0x97'));}if(!_0x2e26ac[_0x479a('0x98')](_0x328f47[_0x479a('0x61')][_0x479a('0x94')])){throw new db['Sequelize'][(_0x479a('0x96'))](_0x479a('0x99'));}if(_0x328f47[_0x479a('0x61')][_0x479a('0x94')]===_0x328f47[_0x479a('0x61')][_0x479a('0x95')]){throw new db[(_0x479a('0x9a'))][(_0x479a('0x96'))](_0x479a('0x9b'));}}else if(_0x328f47[_0x479a('0x31')][_0x479a('0x2c')]===_0x479a('0x30')){if(!_0x328f47[_0x479a('0x61')][_0x479a('0x95')]){throw new db['Sequelize'][(_0x479a('0x96'))](_0x479a('0x9c'));}}else if(_0x328f47[_0x479a('0x31')]['role']===_0x479a('0x31')){if(!_0x328f47[_0x479a('0x61')][_0x479a('0x95')]){throw new db[(_0x479a('0x9a'))][(_0x479a('0x96'))](_0x479a('0x9c'));}if(_0x2e26ac[_0x479a('0x2c')]!==_0x479a('0x2d')){throw new db[(_0x479a('0x9a'))][(_0x479a('0x96'))]('Unauthorized');}}else{throw new db[(_0x479a('0x9a'))]['ValidationError'](_0x479a('0x85'));}return _0x2e26ac;})[_0x479a('0x22')](handleEntityNotFound(_0x2e9236,null))['then'](function(_0x22e454){return db['Setting'][_0x479a('0x9d')]({'attributes':['id',_0x479a('0x69'),_0x479a('0x9e'),_0x479a('0x9f')]})[_0x479a('0x22')](function(_0x34bc29){if(_0x34bc29['securePassword'])authService[_0x479a('0x6a')](_0x328f47[_0x479a('0x61')][_0x479a('0x95')]);if(!_0x34bc29[_0x479a('0x9e')]||!_0x22e454['previousPasswords'])return _0x22e454;authService[_0x479a('0xa0')](_0x328f47['body'][_0x479a('0x95')],_0x22e454[_0x479a('0x42')],_0x34bc29[_0x479a('0x9f')]);return _0x22e454;})[_0x479a('0x22')](saveUpdates({'password':_0x328f47[_0x479a('0x61')][_0x479a('0x95')],'passwordResetAt':_0x328f47['user']['id']==_0x328f47[_0x479a('0x5c')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x328f47['body']['newPassword'],_0x22e454[_0x479a('0x42')])},null));})['then'](respondWithResult(_0x2e9236,null))['catch'](handleError(_0x2e9236,null));};exports[_0x479a('0xa1')]=function(_0x402108,_0x2182b3){var _0x4afd58=_0x402108[_0x479a('0x61')][_0x479a('0xa2')];return db[_0x479a('0x3d')][_0x479a('0x38')]({'where':{'id':_0x402108[_0x479a('0x5c')]['id']},'attributes':['id',_0x479a('0x3b'),_0x479a('0x2c'),_0x479a('0xa3'),_0x479a('0xa4'),'voicePause',_0x479a('0xa5')]})['then'](handleEntityNotFound(_0x2182b3,null))[_0x479a('0x22')](function(_0x228a51){if(_0x228a51){if(!utils[_0x479a('0xa6')](_0x4afd58)){throw new db[(_0x479a('0x9a'))][(_0x479a('0x96'))](_0x479a('0xa7'));}return _0x228a51[_0x479a('0xa8')+_['capitalize'](_0x4afd58['toLowerCase']())+_0x479a('0xa9')](_0x402108[_0x479a('0x61')][_0x479a('0x64')],{'penalty':_0x402108['body']['penalty']||0x0})[_0x479a('0xaa')](function(_0x37a1dc){for(var _0xb774fd=0x0;_0xb774fd<_0x402108['body']['ids'][_0x479a('0x53')];_0xb774fd+=0x1){var _0x4196dd={'UserId':Number(_0x402108['params']['id'])};_0x4196dd[_['capitalize'](_0x4afd58['toLowerCase']())+'QueueId']=Number(_0x402108[_0x479a('0x61')][_0x479a('0x64')][_0xb774fd]);socket[_0x479a('0x2e')](_0x479a('0x31')+_['capitalize'](_0x4afd58[_0x479a('0xab')]())+_0x479a('0xac'),_0x4196dd);}return _0x37a1dc;})[_0x479a('0x22')](function(){if(_0x4afd58===_0x479a('0xad')){return db['VoiceQueue'][_0x479a('0x50')]({'where':{'id':_0x402108['body'][_0x479a('0x64')]||[]},'raw':!![],'attributes':['id',_0x479a('0x3b')]});}})[_0x479a('0x22')](function(_0x267c95){var _0x108848=_0x228a51[_0x479a('0x2f')]({'plain':!![]});var _0x2abd8f=[];if(_0x4afd58===_0x479a('0xad')&&_0x108848[_0x479a('0x2c')]==='agent'&&_0x108848[_0x479a('0xa3')]){for(let _0x151c39=0x0;_0x151c39<_0x267c95[_0x479a('0x53')];_0x151c39+=0x1){_0x2abd8f[_0x479a('0x4f')]({'membername':_0x108848[_0x479a('0x3b')],'UserId':_0x108848['id'],'queue_name':_0x267c95[_0x151c39]['name'],'VoiceQueueId':_0x267c95[_0x151c39]['id'],'interface':_['isNil'](_0x108848[_0x479a('0xa5')])?util[_0x479a('0xae')](_0x479a('0xaf'),_0x108848[_0x479a('0x3b')]):_0x108848[_0x479a('0xa5')],'paused':_0x108848[_0x479a('0xb0')]||![],'penalty':_0x402108[_0x479a('0x61')][_0x479a('0xb1')]||0x0});}return Promise[_0x479a('0x59')](_0x2abd8f[_0x479a('0x35')](function(_0x55812f){return db['UserVoiceQueueRt'][_0x479a('0xb2')](_0x55812f);}));}return _0x228a51;});}})[_0x479a('0x22')](respondWithStatusCode(_0x2182b3,null))['catch'](handleError(_0x2182b3,null));};exports[_0x479a('0xb3')]=function(_0x2a4c3e,_0x45c1e3){var _0x4f0f1a,_0x32512e;return db[_0x479a('0x3d')][_0x479a('0x38')]({'where':{'id':_0x2a4c3e[_0x479a('0x5c')]['id']},'attributes':['id',_0x479a('0x3b'),_0x479a('0x2c')]})[_0x479a('0x22')](handleEntityNotFound(_0x45c1e3,null))[_0x479a('0x22')](function(_0x32f354){if(_0x32f354){_0x4f0f1a=_0x32f354;if(!_0x2a4c3e[_0x479a('0x48')][_0x479a('0xa2')]||!utils[_0x479a('0xa6')](_0x2a4c3e[_0x479a('0x48')][_0x479a('0xa2')])){throw new db[(_0x479a('0x9a'))][(_0x479a('0x96'))](_0x479a('0xa7'));}return _0x32f354[_0x479a('0xb4')+_[_0x479a('0xb5')](_0x2a4c3e[_0x479a('0x48')][_0x479a('0xa2')][_0x479a('0xab')]())+_0x479a('0xa9')](_0x2a4c3e[_0x479a('0x48')]['ids']);}})[_0x479a('0x22')](function(_0x1362e2){if(_[_0x479a('0xb6')](_0x2a4c3e[_0x479a('0x48')][_0x479a('0x64')])){for(var _0x2a33f8=0x0;_0x2a33f8<_0x2a4c3e[_0x479a('0x48')][_0x479a('0x64')][_0x479a('0x53')];_0x2a33f8+=0x1){_0x32512e={'UserId':Number(_0x2a4c3e['params']['id'])};_0x32512e[_[_0x479a('0xb5')](_0x2a4c3e['query'][_0x479a('0xa2')]['toLowerCase']())+_0x479a('0xb7')]=Number(_0x2a4c3e[_0x479a('0x48')][_0x479a('0x64')][_0x2a33f8]);socket['emit'](_0x479a('0x31')+_[_0x479a('0xb5')](_0x2a4c3e[_0x479a('0x48')]['channel'][_0x479a('0xab')]())+_0x479a('0xb8'),_0x32512e);}}else{_0x32512e={'UserId':Number(_0x2a4c3e['params']['id'])};_0x32512e[_['capitalize'](_0x2a4c3e[_0x479a('0x48')][_0x479a('0xa2')][_0x479a('0xab')]())+'QueueId']=Number(_0x2a4c3e[_0x479a('0x48')][_0x479a('0x64')]);socket[_0x479a('0x2e')](_0x479a('0x31')+_[_0x479a('0xb5')](_0x2a4c3e['query'][_0x479a('0xa2')]['toLowerCase']())+_0x479a('0xb8'),_0x32512e);}return _0x1362e2;})[_0x479a('0x22')](function(){if(_0x2a4c3e[_0x479a('0x48')]['channel']==='voice'){return db[_0x479a('0xb9')][_0x479a('0xba')]({'where':{'UserId':_0x2a4c3e[_0x479a('0x5c')]['id'],'VoiceQueueId':_0x2a4c3e[_0x479a('0x48')]['ids']},'individualHooks':!![]})['then'](function(){return _0x4f0f1a;});}return _0x4f0f1a;})['then'](respondWithStatusCode(_0x45c1e3,null))[_0x479a('0x5a')](handleError(_0x45c1e3,null));};exports[_0x479a('0xbb')]=function(_0x2d8dd1,_0x2663dd){_0x2d8dd1[_0x479a('0x61')][_0x479a('0xbc')]=_0x2d8dd1[_0x479a('0xbd')][_0x479a('0xbe')];return db[_0x479a('0x3d')][_0x479a('0x38')]({'where':{'id':_0x2d8dd1[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x2663dd,null))[_0x479a('0x22')](saveUpdates(_0x2d8dd1[_0x479a('0x61')],null))[_0x479a('0x22')](respondWithResult(_0x2663dd,null))['catch'](handleError(_0x2663dd,null));};exports['getAvatar']=function(_0x23d951,_0x97a21){var _0x15897a=path[_0x479a('0xbf')](config['root'],_0x479a('0xc0'));return db['User'][_0x479a('0x38')]({'where':{'id':_0x23d951[_0x479a('0x5c')]['id']},'attributes':['id',_0x479a('0xbc')],'raw':!![]})[_0x479a('0x22')](handleEntityNotFound(_0x97a21,null))[_0x479a('0x22')](function(_0x545ea3){if(_0x545ea3){if(_['isNil'](_0x545ea3[_0x479a('0xbc')])){return _0x97a21[_0x479a('0xc1')](_0x15897a);}else{if(!fs[_0x479a('0xc2')](path[_0x479a('0xbf')](config[_0x479a('0xc3')],_0x479a('0xc4'),_0x545ea3[_0x479a('0xbc')]))){return _0x97a21[_0x479a('0xc1')](_0x15897a);}return _0x97a21[_0x479a('0xc1')](path[_0x479a('0xbf')](config[_0x479a('0xc3')],_0x479a('0xc4'),_0x545ea3[_0x479a('0xbc')]));}}})[_0x479a('0x5a')](handleError(_0x97a21,null));};exports[_0x479a('0xc5')]=function(_0x435de7,_0x99f46b){return db['User'][_0x479a('0x38')]({'where':{'id':_0x435de7[_0x479a('0x5c')]['id']},'attributes':['id']})[_0x479a('0x22')](handleEntityNotFound(_0x99f46b,null))[_0x479a('0x22')](function(_0xc479d7){var _0x2fe4a7=[];values=_0xc479d7[_0x479a('0x55')];_0x2fe4a7[_0x479a('0x4f')](get_open_tabs('chat',_0xc479d7[_0x479a('0x55')]));_0x2fe4a7[_0x479a('0x4f')](get_open_tabs(_0x479a('0x56'),_0xc479d7[_0x479a('0x55')]));_0x2fe4a7[_0x479a('0x4f')](get_open_tabs(_0x479a('0x58'),_0xc479d7[_0x479a('0x55')]));_0x2fe4a7['push'](get_open_tabs(_0x479a('0x5f'),_0xc479d7[_0x479a('0x55')]));_0x2fe4a7[_0x479a('0x4f')](get_open_tabs(_0x479a('0x57'),_0xc479d7[_0x479a('0x55')]));_0x2fe4a7[_0x479a('0x4f')](get_open_tabs(_0x479a('0x60'),_0xc479d7[_0x479a('0x55')]));return Promise['all'](_0x2fe4a7);})['then'](function(_0x2a7fda){if(_0x2a7fda){var _0xcd2533=_[_0x479a('0x35')](values[_0x479a('0xc6')],function(_0x21137c){return{'channel':_0x479a('0xc7'),'id':_0x21137c['id'],'createdAt':_0x21137c[_0x479a('0xc8')]};});var _0x8395b3=_[_0x479a('0x35')](values[_0x479a('0xc9')],function(_0x5f139e){return{'channel':'FAX','id':_0x5f139e['id'],'createdAt':_0x5f139e[_0x479a('0xc8')]};});var _0x34476a=_['map'](values[_0x479a('0xca')],function(_0x50ade5){return{'channel':_0x479a('0xcb'),'id':_0x50ade5['id'],'createdAt':_0x50ade5[_0x479a('0xc8')]};});var _0xbfddec=_['map'](values[_0x479a('0xcc')],function(_0xf5ac3){return{'channel':_0x479a('0xcd'),'id':_0xf5ac3['id'],'createdAt':_0xf5ac3[_0x479a('0xc8')]};});var _0x3a62b8=_[_0x479a('0x35')](values['SmsOpenTabs'],function(_0x4fd744){return{'channel':_0x479a('0xce'),'id':_0x4fd744['id'],'createdAt':_0x4fd744['createdAt']};});var _0x5ed10b=_[_0x479a('0x35')](values[_0x479a('0xcf')],function(_0x46c3ce){return{'channel':_0x479a('0xd0'),'id':_0x46c3ce['id'],'createdAt':_0x46c3ce[_0x479a('0xc8')]};});var _0x98c4d0=_[_0x479a('0xd1')](_0xcd2533,_0x8395b3,_0x34476a,_0xbfddec,_0x3a62b8,_0x5ed10b);var _0x13f78c={'count':_0x98c4d0[_0x479a('0x53')],'rows':_0x98c4d0};return _0x13f78c;}else return null;})['then'](respondWithResult(_0x99f46b,null))[_0x479a('0x5a')](handleError(_0x99f46b,null));};exports[_0x479a('0xd2')]=function(_0x390f2f,_0x4b92b2){var _0x3f028f={};return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x390f2f[_0x479a('0x5c')]['id']}})['then'](function(_0x573dd7){if(!_0x573dd7){throw new APINotFoundError(util[_0x479a('0xae')](_0x479a('0xd3'),_0x390f2f['params']['id']));}return contacts[_0x479a('0x62')]();})[_0x479a('0x22')](function(_0x26c8ee){_0x390f2f['query'][_0x479a('0x3d')]=_0x390f2f[_0x479a('0x5c')]['id'];_0x3f028f=qs[_0x479a('0x46')](_0x26c8ee,_0x390f2f);if(_0x390f2f[_0x479a('0x48')]['hasOwnProperty'](_0x479a('0x49'))){_0x3f028f[_0x479a('0x4a')]=[{'model':db[_0x479a('0xd4')],'as':_0x479a('0xd5'),'required':![]},{'model':db[_0x479a('0xd6')],'as':_0x479a('0xd7'),'attributes':['id',_0x479a('0x3b'),'color'],'where':_0x390f2f[_0x479a('0x48')]['tag']?{'id':_0x390f2f['query'][_0x479a('0xd8')]}:undefined,'required':_0x390f2f[_0x479a('0x48')][_0x479a('0xd8')]?!![]:![]}];}return contacts[_0x479a('0x50')](_0x390f2f[_0x479a('0x48')],_0x390f2f[_0x479a('0x31')],_0x3f028f,_0x26c8ee);})[_0x479a('0x22')](respondWithFilteredResult(_0x4b92b2,_0x3f028f))[_0x479a('0x5a')](APIHandleError(_0x4b92b2));};exports['getQueues']=function(_0x29b48e,_0xbc87a2){var _0x2300e3;var _0x55709b={};var _0x2a86c5;return db['User'][_0x479a('0x9d')]({'where':{'id':_0x29b48e[_0x479a('0x5c')]['id']},'attributes':['id',_0x479a('0x3b'),_0x479a('0x2c')]})['then'](handleEntityNotFound(_0xbc87a2,null))[_0x479a('0x22')](function(_0xca087e){if(!utils[_0x479a('0xa6')](_0x29b48e[_0x479a('0x48')]['channel'])){throw new db['Sequelize'][(_0x479a('0x96'))](_0x479a('0xa7'));}_0x2300e3=_0xca087e;var _0x149515={};_0x149515[_0x479a('0xd9')]=_[_0x479a('0xda')](db[_[_0x479a('0xb5')](_0x29b48e['query'][_0x479a('0xa2')])+_0x479a('0xdb')][_0x479a('0x3e')]);_0x149515[_0x479a('0x48')]=_[_0x479a('0xda')](_0x29b48e[_0x479a('0x48')]);_0x149515[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0x149515[_0x479a('0xd9')],_0x149515[_0x479a('0x48')]);_0x55709b['attributes']=_[_0x479a('0xdd')](_0x149515[_0x479a('0xd9')],qs['fields'](_0x29b48e[_0x479a('0x48')]['fields']));_0x55709b[_0x479a('0x4e')]=_0x55709b[_0x479a('0x4e')]['length']?_0x55709b['attributes']:_0x149515['model'];_0x55709b[_0x479a('0xde')]=qs[_0x479a('0xdf')](_0x29b48e[_0x479a('0x48')][_0x479a('0xdf')]);_0x55709b[_0x479a('0x47')]=qs['filters'](_['pick'](_0x29b48e['query'],_0x149515[_0x479a('0xdc')]));if(_0x29b48e['query'][_0x479a('0xe0')]){_0x55709b[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x55709b[_0x479a('0x47')],{'$or':_[_0x479a('0x35')](_0x55709b['attributes'],function(_0x156bf1){var _0x87a496={};_0x87a496[_0x156bf1]={'$like':'%'+_0x29b48e['query'][_0x479a('0xe0')]+'%'};return _0x87a496;})});}_0x55709b=_[_0x479a('0x5d')]({},_0x55709b,_0x29b48e[_0x479a('0x5e')]);switch(_0x2300e3['role']){case _0x479a('0x30'):return db[_[_0x479a('0xb5')](_0x29b48e[_0x479a('0x48')][_0x479a('0xa2')])+'Queue'][_0x479a('0x50')](_0x55709b);case _0x479a('0x31'):case _0x479a('0x2d'):return _0x2300e3[_0x479a('0x2f')+_[_0x479a('0xb5')](_0x29b48e['query'][_0x479a('0xa2')])+'Queues'](_0x55709b);default:throw new db[(_0x479a('0x9a'))][(_0x479a('0x96'))](_0x479a('0xe1'));}})['then'](function(_0x245aa4){_0x2a86c5=_0x245aa4[_0x479a('0x53')];if(!_0x29b48e['query'][_0x479a('0xe2')]('nolimit')){_0x55709b[_0x479a('0x1b')]=qs[_0x479a('0x1b')](_0x29b48e[_0x479a('0x48')][_0x479a('0x1b')]);_0x55709b[_0x479a('0x1a')]=qs[_0x479a('0x1a')](_0x29b48e[_0x479a('0x48')][_0x479a('0x1a')]);}switch(_0x2300e3[_0x479a('0x2c')]){case _0x479a('0x30'):return db[_[_0x479a('0xb5')](_0x29b48e[_0x479a('0x48')][_0x479a('0xa2')])+'Queue']['findAll'](_0x55709b);case _0x479a('0x31'):case _0x479a('0x2d'):return _0x2300e3[_0x479a('0x2f')+_['capitalize'](_0x29b48e[_0x479a('0x48')][_0x479a('0xa2')])+_0x479a('0xa9')](_0x55709b);}})[_0x479a('0x22')](function(_0x445e1b){return{'count':_0x2a86c5,'rows':_0x445e1b};})['then'](respondWithResult(_0xbc87a2,null))[_0x479a('0x5a')](handleError(_0xbc87a2,null));};exports['getVoiceQueuesRt']=function(_0x17c546,_0x185f94){var _0x39da79={};var _0x42cf6e={};var _0x539540;var _0x5d1a9b;return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x17c546[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x185f94,null))[_0x479a('0x22')](function(_0x110396){if(_0x110396){_0x539540=_0x110396;_0x42cf6e[_0x479a('0xd9')]=_[_0x479a('0xda')](db['UserVoiceQueueRt'][_0x479a('0x3e')]);_0x42cf6e['query']=_[_0x479a('0xda')](_0x17c546[_0x479a('0x48')]);_0x42cf6e['filters']=_[_0x479a('0xdd')](_0x42cf6e['model'],_0x42cf6e[_0x479a('0x48')]);_0x39da79[_0x479a('0x4e')]=_['intersection'](_0x42cf6e[_0x479a('0xd9')],qs[_0x479a('0xe3')](_0x17c546[_0x479a('0x48')][_0x479a('0xe3')]));_0x39da79[_0x479a('0x4e')]=_0x39da79[_0x479a('0x4e')][_0x479a('0x53')]?_0x39da79[_0x479a('0x4e')]:_0x42cf6e[_0x479a('0xd9')];_0x39da79[_0x479a('0xde')]=qs[_0x479a('0xdf')](_0x17c546[_0x479a('0x48')][_0x479a('0xdf')]);_0x39da79[_0x479a('0x47')]=qs['filters'](_[_0x479a('0xe4')](_0x17c546[_0x479a('0x48')],_0x42cf6e[_0x479a('0xdc')]));if(_0x17c546[_0x479a('0x48')]['filter']){_0x39da79[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x39da79['where'],{'$or':_['map'](_0x39da79[_0x479a('0x4e')],function(_0x4ac42b){var _0x1af010={};_0x1af010[_0x4ac42b]={'$like':'%'+_0x17c546[_0x479a('0x48')]['filter']+'%'};return _0x1af010;})});}_0x39da79=_[_0x479a('0x5d')]({},_0x39da79,_0x17c546[_0x479a('0x5e')]);return _0x539540[_0x479a('0xe5')](_0x39da79);}})[_0x479a('0x22')](function(_0x44fba4){if(_0x44fba4){_0x5d1a9b=_0x44fba4[_0x479a('0x53')];if(!_0x17c546[_0x479a('0x48')]['hasOwnProperty'](_0x479a('0xe6'))){_0x39da79['limit']=qs[_0x479a('0x1b')](_0x17c546['query']['limit']);_0x39da79[_0x479a('0x1a')]=qs[_0x479a('0x1a')](_0x17c546['query'][_0x479a('0x1a')]);}return _0x539540[_0x479a('0xe5')](_0x39da79);}})[_0x479a('0x22')](function(_0x1abf9f){if(_0x1abf9f){return _0x1abf9f?{'count':_0x5d1a9b,'rows':_0x1abf9f}:null;}})[_0x479a('0x22')](respondWithResult(_0x185f94,null))[_0x479a('0x5a')](handleError(_0x185f94,null));};exports[_0x479a('0xe7')]=function(_0x5c8add,_0x372080){var _0x437312={};var _0x3b7911={};var _0x4aa803;var _0x43de17;return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x5c8add['params']['id']}})['then'](handleEntityNotFound(_0x372080,null))[_0x479a('0x22')](function(_0x50ee22){if(_0x50ee22){_0x4aa803=_0x50ee22;_0x3b7911[_0x479a('0xd9')]=_[_0x479a('0xda')](db['ChatGroup'][_0x479a('0x3e')]);_0x3b7911[_0x479a('0x48')]=_[_0x479a('0xda')](_0x5c8add[_0x479a('0x48')]);_0x3b7911[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0x3b7911['model'],_0x3b7911[_0x479a('0x48')]);_0x437312[_0x479a('0x4e')]=_[_0x479a('0xdd')](_0x3b7911['model'],qs['fields'](_0x5c8add[_0x479a('0x48')][_0x479a('0xe3')]));_0x437312[_0x479a('0x4e')]=_0x437312['attributes'][_0x479a('0x53')]?_0x437312[_0x479a('0x4e')]:_0x3b7911[_0x479a('0xd9')];_0x437312[_0x479a('0xde')]=qs[_0x479a('0xdf')](_0x5c8add[_0x479a('0x48')][_0x479a('0xdf')]);_0x437312['where']=qs['filters'](_[_0x479a('0xe4')](_0x5c8add[_0x479a('0x48')],_0x3b7911[_0x479a('0xdc')]));if(_0x5c8add[_0x479a('0x48')]['filter']){_0x437312[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x437312['where'],{'$or':_[_0x479a('0x35')](_0x437312[_0x479a('0x4e')],function(_0xa01b87){var _0x56d998={};_0x56d998[_0xa01b87]={'$like':'%'+_0x5c8add[_0x479a('0x48')][_0x479a('0xe0')]+'%'};return _0x56d998;})});}_0x437312=_[_0x479a('0x5d')]({},_0x437312,_0x5c8add[_0x479a('0x5e')]);return _0x4aa803['getGroups'](_0x437312);}})[_0x479a('0x22')](function(_0x3c0ec4){if(_0x3c0ec4){_0x43de17=_0x3c0ec4[_0x479a('0x53')];if(!_0x5c8add[_0x479a('0x48')]['hasOwnProperty'](_0x479a('0xe6'))){_0x437312['limit']=qs[_0x479a('0x1b')](_0x5c8add[_0x479a('0x48')][_0x479a('0x1b')]);_0x437312['offset']=qs[_0x479a('0x1a')](_0x5c8add[_0x479a('0x48')][_0x479a('0x1a')]);}return _0x4aa803['getGroups'](_0x437312);}})[_0x479a('0x22')](function(_0x82b3e3){if(_0x82b3e3){return _0x82b3e3?{'count':_0x43de17,'rows':_0x82b3e3}:null;}})[_0x479a('0x22')](respondWithResult(_0x372080,null))['catch'](handleError(_0x372080,null));};exports[_0x479a('0xe8')]=function(_0x2a69b6,_0x429d9f){var _0x241af5={'raw':!![],'where':{}};var _0x49ea4e={};var _0x5b0a6b={'count':0x0,'rows':[]};return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x2a69b6[_0x479a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x429d9f,null))[_0x479a('0x22')](function(_0x5a6a29){if(_0x5a6a29){_0x49ea4e[_0x479a('0xd9')]=_[_0x479a('0xda')](db[_0x479a('0xe9')][_0x479a('0x3e')]);_0x49ea4e['query']=_[_0x479a('0xda')](_0x2a69b6[_0x479a('0x48')]);_0x49ea4e[_0x479a('0xdc')]=_['intersection'](_0x49ea4e['model'],_0x49ea4e[_0x479a('0x48')]);_0x241af5[_0x479a('0x4e')]=_[_0x479a('0xdd')](_0x49ea4e[_0x479a('0xd9')],qs['fields'](_0x2a69b6[_0x479a('0x48')][_0x479a('0xe3')]));_0x241af5[_0x479a('0x4e')]=_0x241af5[_0x479a('0x4e')][_0x479a('0x53')]?_0x241af5[_0x479a('0x4e')]:_0x49ea4e[_0x479a('0xd9')];if(!_0x2a69b6[_0x479a('0x48')][_0x479a('0xe2')](_0x479a('0xe6'))){_0x241af5[_0x479a('0x1b')]=qs[_0x479a('0x1b')](_0x2a69b6['query'][_0x479a('0x1b')]);_0x241af5['offset']=qs['offset'](_0x2a69b6[_0x479a('0x48')]['offset']);}_0x241af5[_0x479a('0xde')]=qs['sort'](_0x2a69b6['query'][_0x479a('0xdf')]);_0x241af5[_0x479a('0x47')]=qs[_0x479a('0xdc')](_['pick'](_0x2a69b6['query'],_0x49ea4e[_0x479a('0xdc')]));_0x241af5[_0x479a('0x47')][_0x479a('0xea')]=_0x5a6a29['id'];if(_0x2a69b6[_0x479a('0x48')]['filter']){_0x241af5[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x241af5['where'],{'$or':_['map'](_0x241af5['attributes'],function(_0x3cc308){var _0x2188f9={};_0x2188f9[_0x3cc308]={'$like':'%'+_0x2a69b6[_0x479a('0x48')][_0x479a('0xe0')]+'%'};return _0x2188f9;})});}_0x241af5=_[_0x479a('0x5d')]({},_0x241af5,_0x2a69b6['options']);return db[_0x479a('0xe9')][_0x479a('0x1d')]({'where':_0x241af5[_0x479a('0x47')]})[_0x479a('0x22')](function(_0xf95f1a){_0x5b0a6b[_0x479a('0x1d')]=_0xf95f1a;if(_0x2a69b6['query'][_0x479a('0x49')]){_0x241af5['include']=[{'all':!![]}];}return db[_0x479a('0xe9')][_0x479a('0x50')](_0x241af5);})[_0x479a('0x22')](function(_0xcf3faf){_0x5b0a6b[_0x479a('0x51')]=_0xcf3faf;return _0x5b0a6b;});}})[_0x479a('0x22')](respondWithFilteredResult(_0x429d9f,_0x241af5))[_0x479a('0x5a')](handleError(_0x429d9f,null));};exports['getScreenRecordings']=function(_0x31bef1,_0x5f5061){var _0x1af6fa={'raw':!![],'where':{}};var _0xba5bb4={};var _0x536eff={'count':0x0,'rows':[]};return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x31bef1[_0x479a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5f5061,null))['then'](function(_0x304823){if(_0x304823){_0xba5bb4[_0x479a('0xd9')]=_[_0x479a('0xda')](db['ScreenRecording'][_0x479a('0x3e')]);_0xba5bb4[_0x479a('0x48')]=_['keys'](_0x31bef1['query']);_0xba5bb4[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0xba5bb4[_0x479a('0xd9')],_0xba5bb4[_0x479a('0x48')]);_0x1af6fa[_0x479a('0x4e')]=_[_0x479a('0xdd')](_0xba5bb4[_0x479a('0xd9')],qs[_0x479a('0xe3')](_0x31bef1['query']['fields']));_0x1af6fa[_0x479a('0x4e')]=_0x1af6fa[_0x479a('0x4e')][_0x479a('0x53')]?_0x1af6fa['attributes']:_0xba5bb4[_0x479a('0xd9')];if(!_0x31bef1[_0x479a('0x48')][_0x479a('0xe2')]('nolimit')){_0x1af6fa[_0x479a('0x1b')]=qs[_0x479a('0x1b')](_0x31bef1[_0x479a('0x48')][_0x479a('0x1b')]);_0x1af6fa[_0x479a('0x1a')]=qs['offset'](_0x31bef1['query'][_0x479a('0x1a')]);}_0x1af6fa['order']=qs[_0x479a('0xdf')](_0x31bef1[_0x479a('0x48')]['sort']);_0x1af6fa[_0x479a('0x47')]=qs['filters'](_[_0x479a('0xe4')](_0x31bef1[_0x479a('0x48')],_0xba5bb4[_0x479a('0xdc')]));_0x1af6fa[_0x479a('0x47')][_0x479a('0xea')]=_0x304823['id'];if(_0x31bef1[_0x479a('0x48')][_0x479a('0xe0')]){_0x1af6fa[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x1af6fa[_0x479a('0x47')],{'$or':_[_0x479a('0x35')](_0x1af6fa[_0x479a('0x4e')],function(_0x253742){var _0x518f22={};_0x518f22[_0x253742]={'$like':'%'+_0x31bef1[_0x479a('0x48')][_0x479a('0xe0')]+'%'};return _0x518f22;})});}_0x1af6fa=_[_0x479a('0x5d')]({},_0x1af6fa,_0x31bef1[_0x479a('0x5e')]);return db['ScreenRecording'][_0x479a('0x1d')]({'where':_0x1af6fa[_0x479a('0x47')]})['then'](function(_0x1dcf1f){_0x536eff[_0x479a('0x1d')]=_0x1dcf1f;if(_0x31bef1[_0x479a('0x48')]['includeAll']){_0x1af6fa['include']=[{'all':!![]}];}return db[_0x479a('0xeb')][_0x479a('0x50')](_0x1af6fa);})[_0x479a('0x22')](function(_0x498516){_0x536eff[_0x479a('0x51')]=_0x498516;return _0x536eff;});}})[_0x479a('0x22')](respondWithFilteredResult(_0x5f5061,_0x1af6fa))[_0x479a('0x5a')](handleError(_0x5f5061,null));};exports[_0x479a('0xec')]=function(_0xd8815b,_0x5c0f73){var _0x239a0f={};var _0x38a61b={};var _0x361212;var _0x4a3753;return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0xd8815b[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x5c0f73,null))[_0x479a('0x22')](function(_0x2e1164){if(_0x2e1164){_0x361212=_0x2e1164;_0x38a61b['model']=_['keys'](db[_0x479a('0xed')][_0x479a('0x3e')]);_0x38a61b['query']=_[_0x479a('0xda')](_0xd8815b['query']);_0x38a61b[_0x479a('0xdc')]=_['intersection'](_0x38a61b[_0x479a('0xd9')],_0x38a61b[_0x479a('0x48')]);_0x239a0f['attributes']=_[_0x479a('0xdd')](_0x38a61b['model'],qs[_0x479a('0xe3')](_0xd8815b['query'][_0x479a('0xe3')]));_0x239a0f[_0x479a('0x4e')]=_0x239a0f[_0x479a('0x4e')][_0x479a('0x53')]?_0x239a0f['attributes']:_0x38a61b[_0x479a('0xd9')];_0x239a0f[_0x479a('0xde')]=qs[_0x479a('0xdf')](_0xd8815b[_0x479a('0x48')][_0x479a('0xdf')]);_0x239a0f['where']=qs[_0x479a('0xdc')](_[_0x479a('0xe4')](_0xd8815b[_0x479a('0x48')],_0x38a61b['filters']));if(_0xd8815b['query'][_0x479a('0xe0')]){_0x239a0f[_0x479a('0x47')]=_['merge'](_0x239a0f[_0x479a('0x47')],{'$or':_[_0x479a('0x35')](_0x239a0f[_0x479a('0x4e')],function(_0x1bbd49){var _0x4e3133={};_0x4e3133[_0x1bbd49]={'$like':'%'+_0xd8815b[_0x479a('0x48')][_0x479a('0xe0')]+'%'};return _0x4e3133;})});}_0x239a0f=_[_0x479a('0x5d')]({},_0x239a0f,_0xd8815b[_0x479a('0x5e')]);return _0x361212[_0x479a('0xec')](_0x239a0f);}})[_0x479a('0x22')](function(_0x59ad01){if(_0x59ad01){_0x4a3753=_0x59ad01[_0x479a('0x53')];if(!_0xd8815b['query'][_0x479a('0xe2')](_0x479a('0xe6'))){_0x239a0f['limit']=qs[_0x479a('0x1b')](_0xd8815b[_0x479a('0x48')]['limit']);_0x239a0f[_0x479a('0x1a')]=qs['offset'](_0xd8815b[_0x479a('0x48')][_0x479a('0x1a')]);}return _0x361212[_0x479a('0xec')](_0x239a0f);}})[_0x479a('0x22')](function(_0x32a87b){if(_0x32a87b){return _0x32a87b?{'count':_0x4a3753,'rows':_0x32a87b}:null;}})[_0x479a('0x22')](respondWithResult(_0x5c0f73,null))[_0x479a('0x5a')](handleError(_0x5c0f73,null));};exports['getOpenchannelInteractions']=function(_0x573034,_0x349bf0){var _0x26c3d8={};var _0x33f3c4={};var _0x1df96f;var _0x3f9eb9;return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x573034[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x349bf0,null))[_0x479a('0x22')](function(_0x416957){if(_0x416957){_0x1df96f=_0x416957;_0x33f3c4[_0x479a('0xd9')]=_[_0x479a('0xda')](db[_0x479a('0xee')]['rawAttributes']);_0x33f3c4[_0x479a('0x48')]=_[_0x479a('0xda')](_0x573034['query']);_0x33f3c4[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0x33f3c4[_0x479a('0xd9')],_0x33f3c4[_0x479a('0x48')]);_0x26c3d8[_0x479a('0x4e')]=_[_0x479a('0xdd')](_0x33f3c4['model'],qs[_0x479a('0xe3')](_0x573034[_0x479a('0x48')]['fields']));_0x26c3d8[_0x479a('0x4e')]=_0x26c3d8[_0x479a('0x4e')][_0x479a('0x53')]?_0x26c3d8[_0x479a('0x4e')]:_0x33f3c4['model'];_0x26c3d8[_0x479a('0xde')]=qs[_0x479a('0xdf')](_0x573034['query'][_0x479a('0xdf')]);_0x26c3d8[_0x479a('0x47')]=qs[_0x479a('0xdc')](_[_0x479a('0xe4')](_0x573034[_0x479a('0x48')],_0x33f3c4['filters']));if(_0x573034[_0x479a('0x48')][_0x479a('0xe0')]){_0x26c3d8[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x26c3d8[_0x479a('0x47')],{'$or':_['map'](_0x26c3d8[_0x479a('0x4e')],function(_0x31df42){var _0x564139={};_0x564139[_0x31df42]={'$like':'%'+_0x573034[_0x479a('0x48')][_0x479a('0xe0')]+'%'};return _0x564139;})});}_0x26c3d8=_['merge']({},_0x26c3d8,_0x573034[_0x479a('0x5e')]);return _0x1df96f[_0x479a('0xef')](_0x26c3d8);}})[_0x479a('0x22')](function(_0x281486){if(_0x281486){_0x3f9eb9=_0x281486[_0x479a('0x53')];if(!_0x573034[_0x479a('0x48')][_0x479a('0xe2')]('nolimit')){_0x26c3d8['limit']=qs['limit'](_0x573034[_0x479a('0x48')][_0x479a('0x1b')]);_0x26c3d8['offset']=qs[_0x479a('0x1a')](_0x573034['query'][_0x479a('0x1a')]);}return _0x1df96f['getOpenchannelInteractions'](_0x26c3d8);}})['then'](function(_0x10a6f7){if(_0x10a6f7){return _0x10a6f7?{'count':_0x3f9eb9,'rows':_0x10a6f7}:null;}})[_0x479a('0x22')](respondWithResult(_0x349bf0,null))[_0x479a('0x5a')](handleError(_0x349bf0,null));};exports[_0x479a('0xf0')]=function(_0x5ea596,_0x5c15d8){var _0x5a922b={'raw':!![],'where':{}};var _0x186fc4={};var _0x2b1bb3={'count':0x0,'rows':[]};return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x5ea596[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x5c15d8,null))[_0x479a('0x22')](function(_0x4d26fc){if(_0x4d26fc){_0x186fc4[_0x479a('0xd9')]=_[_0x479a('0xda')](db[_0x479a('0xf1')][_0x479a('0x3e')]);_0x186fc4['query']=_[_0x479a('0xda')](_0x5ea596['query']);_0x186fc4[_0x479a('0xdc')]=_['intersection'](_0x186fc4['model'],_0x186fc4[_0x479a('0x48')]);_0x5a922b[_0x479a('0x4e')]=_[_0x479a('0xdd')](_0x186fc4['model'],qs[_0x479a('0xe3')](_0x5ea596['query'][_0x479a('0xe3')]));_0x5a922b[_0x479a('0x4e')]=_0x5a922b[_0x479a('0x4e')][_0x479a('0x53')]?_0x5a922b[_0x479a('0x4e')]:_0x186fc4['model'];if(!_0x5ea596[_0x479a('0x48')][_0x479a('0xe2')](_0x479a('0xe6'))){_0x5a922b['limit']=qs[_0x479a('0x1b')](_0x5ea596['query']['limit']);_0x5a922b[_0x479a('0x1a')]=qs['offset'](_0x5ea596[_0x479a('0x48')]['offset']);}_0x5a922b[_0x479a('0xde')]=qs[_0x479a('0xdf')](_0x5ea596['query'][_0x479a('0xdf')]);_0x5a922b[_0x479a('0x47')]=qs[_0x479a('0xdc')](_[_0x479a('0xe4')](_0x5ea596[_0x479a('0x48')],_0x186fc4[_0x479a('0xdc')]));_0x5a922b['where']['UserId']=_0x4d26fc['id'];if(_0x5ea596[_0x479a('0x48')][_0x479a('0xe0')]){_0x5a922b['where']=_[_0x479a('0x5d')](_0x5a922b[_0x479a('0x47')],{'$or':_[_0x479a('0x35')](_0x5a922b[_0x479a('0x4e')],function(_0xc1e36d){var _0x2cf8b9={};_0x2cf8b9[_0xc1e36d]={'$like':'%'+_0x5ea596[_0x479a('0x48')][_0x479a('0xe0')]+'%'};return _0x2cf8b9;})});}_0x5a922b=_[_0x479a('0x5d')]({},_0x5a922b,_0x5ea596['options']);return db['MailInteraction'][_0x479a('0x1d')]({'where':_0x5a922b[_0x479a('0x47')]})[_0x479a('0x22')](function(_0x5b5888){_0x2b1bb3[_0x479a('0x1d')]=_0x5b5888;if(_0x5ea596['query'][_0x479a('0x49')]){_0x5a922b[_0x479a('0x4a')]=[{'all':!![]}];}return db[_0x479a('0xf1')][_0x479a('0x50')](_0x5a922b);})[_0x479a('0x22')](function(_0x2b92bd){_0x2b1bb3[_0x479a('0x51')]=_0x2b92bd;return _0x2b1bb3;});}})['then'](respondWithFilteredResult(_0x5c15d8,_0x5a922b))['catch'](handleError(_0x5c15d8,null));};exports[_0x479a('0xf2')]=function(_0x184e33,_0x48462c){var _0x32b89d={};var _0x56e6f9={};var _0x38b56c;var _0xa17d7;return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x184e33[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x48462c,null))[_0x479a('0x22')](function(_0x3962bf){if(_0x3962bf){_0x38b56c=_0x3962bf;_0x56e6f9[_0x479a('0xd9')]=_[_0x479a('0xda')](db[_0x479a('0xf3')][_0x479a('0x3e')]);_0x56e6f9[_0x479a('0x48')]=_[_0x479a('0xda')](_0x184e33['query']);_0x56e6f9[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0x56e6f9['model'],_0x56e6f9[_0x479a('0x48')]);_0x32b89d[_0x479a('0x4e')]=_['intersection'](_0x56e6f9[_0x479a('0xd9')],qs[_0x479a('0xe3')](_0x184e33['query'][_0x479a('0xe3')]));_0x32b89d['attributes']=_0x32b89d[_0x479a('0x4e')]['length']?_0x32b89d['attributes']:_0x56e6f9[_0x479a('0xd9')];_0x32b89d[_0x479a('0xde')]=qs[_0x479a('0xdf')](_0x184e33[_0x479a('0x48')][_0x479a('0xdf')]);_0x32b89d[_0x479a('0x47')]=qs[_0x479a('0xdc')](_[_0x479a('0xe4')](_0x184e33[_0x479a('0x48')],_0x56e6f9[_0x479a('0xdc')]));if(_0x184e33[_0x479a('0x48')][_0x479a('0xe0')]){_0x32b89d[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x32b89d[_0x479a('0x47')],{'$or':_[_0x479a('0x35')](_0x32b89d[_0x479a('0x4e')],function(_0x4e9748){var _0x254007={};_0x254007[_0x4e9748]={'$like':'%'+_0x184e33['query'][_0x479a('0xe0')]+'%'};return _0x254007;})});}_0x32b89d=_[_0x479a('0x5d')]({},_0x32b89d,_0x184e33[_0x479a('0x5e')]);return _0x38b56c[_0x479a('0xf2')](_0x32b89d);}})['then'](function(_0x5efb49){if(_0x5efb49){_0xa17d7=_0x5efb49['length'];if(!_0x184e33[_0x479a('0x48')][_0x479a('0xe2')](_0x479a('0xe6'))){_0x32b89d['limit']=qs[_0x479a('0x1b')](_0x184e33[_0x479a('0x48')]['limit']);_0x32b89d[_0x479a('0x1a')]=qs['offset'](_0x184e33[_0x479a('0x48')][_0x479a('0x1a')]);}return _0x38b56c['getSmsInteractions'](_0x32b89d);}})[_0x479a('0x22')](function(_0x3d8614){if(_0x3d8614){return _0x3d8614?{'count':_0xa17d7,'rows':_0x3d8614}:null;}})[_0x479a('0x22')](respondWithResult(_0x48462c,null))[_0x479a('0x5a')](handleError(_0x48462c,null));};exports[_0x479a('0xf4')]=function(_0x5c93a7,_0x4239b6){var _0x22c390={};var _0x167dd1={};var _0x24c9f1;var _0x4ec67a;return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x5c93a7['params']['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x4239b6,null))[_0x479a('0x22')](function(_0x5a2d12){if(_0x5a2d12){_0x24c9f1=_0x5a2d12;_0x167dd1[_0x479a('0xd9')]=_[_0x479a('0xda')](db['FaxInteraction'][_0x479a('0x3e')]);_0x167dd1[_0x479a('0x48')]=_[_0x479a('0xda')](_0x5c93a7[_0x479a('0x48')]);_0x167dd1[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0x167dd1[_0x479a('0xd9')],_0x167dd1[_0x479a('0x48')]);_0x22c390[_0x479a('0x4e')]=_[_0x479a('0xdd')](_0x167dd1[_0x479a('0xd9')],qs['fields'](_0x5c93a7[_0x479a('0x48')][_0x479a('0xe3')]));_0x22c390[_0x479a('0x4e')]=_0x22c390[_0x479a('0x4e')][_0x479a('0x53')]?_0x22c390[_0x479a('0x4e')]:_0x167dd1['model'];_0x22c390['order']=qs[_0x479a('0xdf')](_0x5c93a7['query'][_0x479a('0xdf')]);_0x22c390[_0x479a('0x47')]=qs[_0x479a('0xdc')](_[_0x479a('0xe4')](_0x5c93a7[_0x479a('0x48')],_0x167dd1['filters']));if(_0x5c93a7[_0x479a('0x48')][_0x479a('0xe0')]){_0x22c390['where']=_[_0x479a('0x5d')](_0x22c390[_0x479a('0x47')],{'$or':_[_0x479a('0x35')](_0x22c390[_0x479a('0x4e')],function(_0x58516f){var _0xd6c233={};_0xd6c233[_0x58516f]={'$like':'%'+_0x5c93a7['query']['filter']+'%'};return _0xd6c233;})});}_0x22c390=_[_0x479a('0x5d')]({},_0x22c390,_0x5c93a7['options']);return _0x24c9f1[_0x479a('0xf4')](_0x22c390);}})[_0x479a('0x22')](function(_0x1122f0){if(_0x1122f0){_0x4ec67a=_0x1122f0[_0x479a('0x53')];if(!_0x5c93a7[_0x479a('0x48')][_0x479a('0xe2')](_0x479a('0xe6'))){_0x22c390[_0x479a('0x1b')]=qs['limit'](_0x5c93a7[_0x479a('0x48')][_0x479a('0x1b')]);_0x22c390[_0x479a('0x1a')]=qs[_0x479a('0x1a')](_0x5c93a7[_0x479a('0x48')]['offset']);}return _0x24c9f1[_0x479a('0xf4')](_0x22c390);}})[_0x479a('0x22')](function(_0x4b2618){if(_0x4b2618){return _0x4b2618?{'count':_0x4ec67a,'rows':_0x4b2618}:null;}})[_0x479a('0x22')](respondWithResult(_0x4239b6,null))[_0x479a('0x5a')](handleError(_0x4239b6,null));};exports[_0x479a('0xf5')]=function(_0x15c19f,_0x227960){var _0x5041e9={};var _0x101559={};var _0x328043;var _0x4d8baf;return db[_0x479a('0x3d')][_0x479a('0x9d')]({'where':{'id':_0x15c19f[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x227960,null))['then'](function(_0x15f238){if(_0x15f238){_0x328043=_0x15f238;_0x101559[_0x479a('0xd9')]=_[_0x479a('0xda')](db[_0x479a('0xf6')][_0x479a('0x3e')]);_0x101559[_0x479a('0x48')]=_[_0x479a('0xda')](_0x15c19f['query']);_0x101559[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0x101559[_0x479a('0xd9')],_0x101559['query']);_0x5041e9[_0x479a('0x4e')]=_[_0x479a('0xdd')](_0x101559[_0x479a('0xd9')],qs[_0x479a('0xe3')](_0x15c19f['query'][_0x479a('0xe3')]));_0x5041e9[_0x479a('0x4e')]=_0x5041e9[_0x479a('0x4e')][_0x479a('0x53')]?_0x5041e9[_0x479a('0x4e')]:_0x101559[_0x479a('0xd9')];_0x5041e9[_0x479a('0xde')]=qs['sort'](_0x15c19f['query'][_0x479a('0xdf')]);_0x5041e9[_0x479a('0x47')]=qs['filters'](_['pick'](_0x15c19f['query'],_0x101559[_0x479a('0xdc')]));if(_0x15c19f['query'][_0x479a('0xe0')]){_0x5041e9[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x5041e9[_0x479a('0x47')],{'$or':_[_0x479a('0x35')](_0x5041e9[_0x479a('0x4e')],function(_0xfb5fbb){var _0x54aae5={};_0x54aae5[_0xfb5fbb]={'$like':'%'+_0x15c19f[_0x479a('0x48')][_0x479a('0xe0')]+'%'};return _0x54aae5;})});}_0x5041e9=_[_0x479a('0x5d')]({},_0x5041e9,_0x15c19f[_0x479a('0x5e')]);return _0x328043[_0x479a('0xf5')](_0x5041e9);}})['then'](function(_0x5de24a){if(_0x5de24a){_0x4d8baf=_0x5de24a[_0x479a('0x53')];if(!_0x15c19f['query']['hasOwnProperty'](_0x479a('0xe6'))){_0x5041e9[_0x479a('0x1b')]=qs[_0x479a('0x1b')](_0x15c19f[_0x479a('0x48')][_0x479a('0x1b')]);_0x5041e9[_0x479a('0x1a')]=qs[_0x479a('0x1a')](_0x15c19f[_0x479a('0x48')][_0x479a('0x1a')]);}return _0x328043[_0x479a('0xf5')](_0x5041e9);}})[_0x479a('0x22')](function(_0x19f345){if(_0x19f345){return _0x19f345?{'count':_0x4d8baf,'rows':_0x19f345}:null;}})[_0x479a('0x22')](respondWithResult(_0x227960,null))[_0x479a('0x5a')](handleError(_0x227960,null));};exports[_0x479a('0xf7')]=function(_0x47db81,_0x3533d1,_0x4cd56c){var _0x2b131d;var _0x129760;var _0x355e49;var _0x4bf0a0=!_[_0x479a('0x6b')](_0x47db81['params']['id'])?_0x47db81[_0x479a('0x5c')]['id']:!_[_0x479a('0x6b')](_0x47db81[_0x479a('0x31')]['id'])?_0x47db81[_0x479a('0x31')]['id']:null;return db[_0x479a('0x3d')]['find']({'where':{'id':_0x4bf0a0,'role':{'$or':[_0x479a('0x30'),'user',_0x479a('0x2d')]}},'attributes':['id',_0x479a('0x3b'),_0x479a('0xf8'),_0x479a('0xf9'),'role',_0x479a('0x66'),_0x479a('0xa4')]})[_0x479a('0x22')](function(_0x22b5a4){if(_0x22b5a4){if(_0x22b5a4['role']===_0x479a('0x2d')){_0x2b131d=_0x22b5a4;if(_0x47db81[_0x479a('0x61')][_0x479a('0xa5')]){_0x355e49=util['format'](_0x479a('0xfa'),_0x2b131d[_0x47db81[_0x479a('0x61')][_0x479a('0xa5')]]);}else if(_0x47db81[_0x479a('0x61')][_0x479a('0xfb')]){_0x355e49=util['format']('SIP/%s',_0x47db81['body'][_0x479a('0xfb')]);}else{_0x355e49=util[_0x479a('0xae')]('SIP/%s',_0x2b131d[_0x479a('0x3b')]);}socket['to'](util[_0x479a('0xae')](_0x479a('0xfc'),_0x2b131d[_0x479a('0x3b')]))['emit'](_0x479a('0xfd'),{'user':{'id':_0x2b131d['id'],'name':_0x2b131d[_0x479a('0x3b')]},'ip':_0x47db81[_0x479a('0xfe')][_0x479a('0xff')]||_0x47db81[_0x479a('0x100')][_0x479a('0x101')]||_0x47db81['socket'][_0x479a('0x101')]||_0x47db81[_0x479a('0x100')][_0x479a('0x102')][_0x479a('0x101')]});return db[_0x479a('0xb9')]['destroy']({'where':{'membername':_0x2b131d[_0x479a('0x3b')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x479a('0x96'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x2b131d){return _0x2b131d['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x2fda50){if(_0x2b131d){if(_0x2fda50){_0x129760=_0x2fda50;if(_0x129760['length']){var _0x1805aa=_0x129760[_0x479a('0x35')](function(_0x187335){var _0x33ad68={'membername':_0x2b131d[_0x479a('0x3b')],'UserId':_0x2b131d['id'],'queue_name':_0x187335['name'],'VoiceQueueId':_0x187335['id'],'interface':_0x355e49,'paused':_0x2b131d['loginInPause']||![],'penalty':_0x187335[_0x479a('0x103')]||0x0};return db[_0x479a('0xb9')][_0x479a('0xb2')](_0x33ad68);});return Promise['all'](_0x1805aa);}}}})[_0x479a('0x22')](function(){if(_0x2b131d){return db[_0x479a('0x104')][_0x479a('0x50')]({'where':{'membername':_0x2b131d[_0x479a('0x3b')],'exitAt':null}});}})[_0x479a('0x22')](function(_0x8ef2dd){if(_0x2b131d){var _0x2452e8=[];_0x8ef2dd['forEach'](function(_0x1a4e15){_0x2452e8[_0x479a('0x4f')](_0x1a4e15[_0x479a('0x2b')]({'exitAt':moment()['format'](_0x479a('0x105'))}));});return Promise[_0x479a('0x59')](_0x2452e8);}})[_0x479a('0x22')](function(){if(_0x2b131d){var _0x46bbe1=[];var _0x25c9c0=[];var _0xd50f5e=utils[_0x479a('0x106')]();var _0x4e69a3={'membername':_0x2b131d['name'],'interface':_0x355e49,'enterAt':moment()[_0x479a('0xae')](_0x479a('0x105')),'role':_0x2b131d[_0x479a('0x2c')],'internal':_0x2b131d['internal']};_0xd50f5e[_0x479a('0x107')](function(_0x4a0ecc){_0x46bbe1[_0x479a('0x4f')](_[_0x479a('0x5d')]({'channel':_0x4a0ecc,'type':_0x479a('0x108'),'data1':_0x47db81[_0x479a('0x61')][_0x479a('0x109')],'data2':_0x355e49},_0x4e69a3));if(_0x2b131d[_0x479a('0xa4')]){_0x25c9c0['push'](_[_0x479a('0x5d')]({'channel':_0x4a0ecc,'type':_0x479a('0x10a'),'data1':_0x479a('0x10b')},_0x4e69a3));}});return db[_0x479a('0x104')][_0x479a('0x10c')](_0x46bbe1[_0x479a('0xd1')](_0x25c9c0),{'individualHooks':!![]});}})[_0x479a('0x22')](function(){if(_0x2b131d){return _0x2b131d[_0x479a('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x479a('0xae')](_0x479a('0x105')),'voicePause':_0x2b131d[_0x479a('0xa4')]||![],'mailPause':_0x2b131d[_0x479a('0xa4')]||![],'chatPause':_0x2b131d['loginInPause']||![],'faxPause':_0x2b131d[_0x479a('0xa4')]||![],'smsPause':_0x2b131d[_0x479a('0xa4')]||![],'openchannelPause':_0x2b131d[_0x479a('0xa4')]||![],'whatsappPause':_0x2b131d['loginInPause']||![],'pauseType':_0x2b131d[_0x479a('0xa4')]?_0x479a('0x10b'):null,'interface':_0x355e49,'lastPauseAt':moment()[_0x479a('0xae')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x479a('0x22')](function(_0x29a270){if(_0x47db81[_0x479a('0x10d')]){return _0x4cd56c();}else{return Promise['resolve'](_0x29a270)[_0x479a('0x22')](respondWithResult(_0x3533d1,null));}})['catch'](handleError(_0x3533d1,null));};exports[_0x479a('0x10e')]=function(_0x426b0a,_0x15e7ee){var _0x595f9a;return db[_0x479a('0x3d')][_0x479a('0x38')]({'where':{'id':_0x426b0a['params']['id'],'role':_0x479a('0x2d')},'attributes':['id',_0x479a('0x3b'),_0x479a('0x2c')]})[_0x479a('0x22')](handleEntityNotFound(_0x15e7ee,null))['then'](function(_0x54f0e9){if(_0x54f0e9){_0x595f9a=_0x54f0e9;return db[_0x479a('0xb9')][_0x479a('0xba')]({'where':{'membername':_0x595f9a[_0x479a('0x3b')]},'individualHooks':!![]});}})['then'](function(){return db[_0x479a('0x104')]['findAll']({'where':{'membername':_0x595f9a[_0x479a('0x3b')],'exitAt':null}});})['then'](function(_0x371e57){var _0x1ef5a1=[];_0x371e57[_0x479a('0x107')](function(_0x160595){_0x1ef5a1['push'](_0x160595[_0x479a('0x2b')]({'exitAt':moment()[_0x479a('0xae')](_0x479a('0x105'))}));});return Promise['all'](_0x1ef5a1);})[_0x479a('0x22')](function(){return _0x595f9a[_0x479a('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x479a('0x22')](respondWithResult(_0x15e7ee,null))[_0x479a('0x5a')](handleError(_0x15e7ee,null));};exports[_0x479a('0x10f')]=function(_0x8d64e5,_0x4deb3c){var _0x3c3338;return db[_0x479a('0xb9')][_0x479a('0x2b')]({'paused':0x1},{'where':{'UserId':_0x8d64e5[_0x479a('0x5c')]['id']},'individualHooks':!![]})[_0x479a('0x22')](function(){return db['User'][_0x479a('0x38')]({'where':{'id':_0x8d64e5['params']['id'],'role':'agent'},'attributes':['id','name',_0x479a('0x2c'),_0x479a('0x66'),_0x479a('0xa5'),'online']});})[_0x479a('0x22')](handleEntityNotFound(_0x4deb3c,null))[_0x479a('0x22')](function(_0x1101db){if(_0x1101db){_0x3c3338=_0x1101db;return respondWithRpcPromise('QueuePause',_0x479a('0x10f'),{'id':_0x3c3338['id'],'name':_0x3c3338[_0x479a('0x3b')],'pause':!![]});}})[_0x479a('0x22')](function(){if(_0x3c3338){return db['MemberReport'][_0x479a('0x50')]({'where':{'membername':_0x3c3338[_0x479a('0x3b')],'type':'PAUSE','exitAt':null}});}})[_0x479a('0x22')](function(_0x48a457){if(_0x48a457['length']){var _0x322f28=moment()[_0x479a('0xae')](_0x479a('0x105'));for(var _0x34b021=0x0,_0x1cd788=_0x48a457[_0x479a('0x53')];_0x34b021<_0x1cd788;_0x34b021++){_0x48a457[_0x34b021][_0x479a('0x110')]({'exitAt':_0x322f28});}}})[_0x479a('0x22')](function(){var _0x3f93dd=[];var _0xeff1b6=utils[_0x479a('0x106')]();_0xeff1b6[_0x479a('0x107')](function(_0x58b3b0){_0x3f93dd[_0x479a('0x4f')]({'channel':_0x58b3b0,'membername':_0x3c3338[_0x479a('0x3b')],'interface':_[_0x479a('0x6b')](_0x3c3338['interface'])?util[_0x479a('0xae')]('SIP/%s',_0x3c3338['name']):_0x3c3338[_0x479a('0xa5')],'type':'PAUSE','enterAt':moment()['format'](_0x479a('0x105')),'data1':_0x8d64e5[_0x479a('0x61')]['type']||_0x479a('0x111'),'role':_0x3c3338['role'],'internal':_0x3c3338[_0x479a('0x66')]});});return db[_0x479a('0x104')][_0x479a('0x10c')](_0x3f93dd,{'individualHooks':!![]});})[_0x479a('0x22')](function(){return _0x3c3338[_0x479a('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x8d64e5[_0x479a('0x61')]['type']||_0x479a('0x111'),'lastPauseAt':moment()['format'](_0x479a('0x105'))});})[_0x479a('0x22')](respondWithResult(_0x4deb3c,null))[_0x479a('0x5a')](handleError(_0x4deb3c,null));};exports['unpause']=function(_0x46ec6e,_0xcb1889){if(_0x46ec6e[_0x479a('0x61')][_0x479a('0xa2')]&&!utils['isValidChannel'](_0x46ec6e[_0x479a('0x61')][_0x479a('0xa2')])){throw new APIBadRequestError(util[_0x479a('0xae')](_0x479a('0x112'),_0x46ec6e[_0x479a('0x61')][_0x479a('0xa2')]));}return db['User'][_0x479a('0x38')]({'where':{'id':_0x46ec6e[_0x479a('0x5c')]['id']},'attributes':['id',_0x479a('0x3b'),_0x479a('0x2c'),'internal','interface',_0x479a('0xa3'),_0x479a('0xb0'),_0x479a('0x113'),_0x479a('0x114'),_0x479a('0x115'),_0x479a('0x116'),_0x479a('0x117'),'whatsappPause',_0x479a('0x118'),_0x479a('0x119')]})[_0x479a('0x22')](function(_0x5676d9){if(!_0x5676d9){throw new APINotFoundError(util[_0x479a('0xae')](_0x479a('0xd3'),_0x46ec6e[_0x479a('0x5c')]['id']));}return _0x5676d9[_0x479a('0x11a')](_0x46ec6e[_0x479a('0x61')][_0x479a('0xa2')]);})[_0x479a('0x22')](respondWithResult(_0xcb1889,null))[_0x479a('0x5a')](APIHandleError(_0xcb1889));};exports[_0x479a('0x11b')]=function(_0x38bb30,_0x493bc0){var _0x2cc8e0={};var _0x3f5d38={};var _0x3c64b9;var _0x46d452;return db['User'][_0x479a('0x9d')]({'where':{'id':_0x38bb30[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x493bc0,null))[_0x479a('0x22')](function(_0x26147f){if(_0x26147f){_0x3c64b9=_0x26147f;_0x3f5d38[_0x479a('0xd9')]=_[_0x479a('0xda')](db[_0x479a('0x11c')][_0x479a('0x3e')]);_0x3f5d38[_0x479a('0x48')]=_[_0x479a('0xda')](_0x38bb30[_0x479a('0x48')]);_0x3f5d38[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0x3f5d38[_0x479a('0xd9')],_0x3f5d38['query']);_0x2cc8e0[_0x479a('0x4e')]=_[_0x479a('0xdd')](_0x3f5d38[_0x479a('0xd9')],qs[_0x479a('0xe3')](_0x38bb30[_0x479a('0x48')][_0x479a('0xe3')]));_0x2cc8e0[_0x479a('0x4e')]=_0x2cc8e0[_0x479a('0x4e')][_0x479a('0x53')]?_0x2cc8e0[_0x479a('0x4e')]:_0x3f5d38[_0x479a('0xd9')];_0x2cc8e0['order']=qs[_0x479a('0xdf')](_0x38bb30[_0x479a('0x48')][_0x479a('0xdf')]);_0x2cc8e0['where']=qs[_0x479a('0xdc')](_[_0x479a('0xe4')](_0x38bb30[_0x479a('0x48')],_0x3f5d38['filters']));if(_0x38bb30[_0x479a('0x48')][_0x479a('0xe0')]){_0x2cc8e0[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x2cc8e0['where'],{'$or':_[_0x479a('0x35')](_0x2cc8e0[_0x479a('0x4e')],function(_0x2c3b45){var _0x3f27e3={};_0x3f27e3[_0x2c3b45]={'$like':'%'+_0x38bb30['query'][_0x479a('0xe0')]+'%'};return _0x3f27e3;})});}_0x2cc8e0=_['merge']({},_0x2cc8e0,_0x38bb30[_0x479a('0x5e')]);return _0x3c64b9[_0x479a('0x11b')](_0x2cc8e0);}})[_0x479a('0x22')](function(_0x148620){if(_0x148620){_0x46d452=_0x148620[_0x479a('0x53')];if(!_0x38bb30[_0x479a('0x48')][_0x479a('0xe2')](_0x479a('0xe6'))){_0x2cc8e0[_0x479a('0x1b')]=qs[_0x479a('0x1b')](_0x38bb30[_0x479a('0x48')][_0x479a('0x1b')]);_0x2cc8e0[_0x479a('0x1a')]=qs[_0x479a('0x1a')](_0x38bb30[_0x479a('0x48')][_0x479a('0x1a')]);}return _0x3c64b9[_0x479a('0x11b')](_0x2cc8e0);}})[_0x479a('0x22')](function(_0xa222d2){if(_0xa222d2){return _0xa222d2?{'count':_0x46d452,'rows':_0xa222d2}:null;}})[_0x479a('0x22')](respondWithResult(_0x493bc0,null))['catch'](handleError(_0x493bc0,null));};exports[_0x479a('0x11d')]=function(_0x3d6570,_0x380b98){var _0x278b27=_0x3d6570[_0x479a('0x5c')]['id'];var _0x555c1b=_0x3d6570['body']?_0x3d6570[_0x479a('0x61')][_0x479a('0x64')]:null;var _0x51c6ed=[];return Promise[_0x479a('0x11e')]()['then'](function(){if(!_0x555c1b)throw new APIBadRequestError(_0x479a('0x11f'));})['then'](function(){return db[_0x479a('0x3d')]['findOne']({'where':{'id':_0x278b27}});})[_0x479a('0x22')](function(_0x3678ad){if(!_0x3678ad)throw new APINotFoundError(util[_0x479a('0xae')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3d6570[_0x479a('0x5c')]['id']));return db[_0x479a('0x6d')][_0x479a('0x120')](function(_0x458354){return _0x3678ad[_0x479a('0x11d')](_0x555c1b,{'transaction':_0x458354})['then'](function(){return db[_0x479a('0x11c')][_0x479a('0x50')]({'where':{'id':{'$in':_0x555c1b}}});})[_0x479a('0x22')](function(_0x19415f){var _0x113376=_[_0x479a('0x35')](_0x19415f,function(_0x9df9a9){return _0x9df9a9[_0x479a('0x121')]();});return Promise['all'](_0x113376);})['then'](function(_0xc96605){_0x51c6ed=_[_0x479a('0x122')](_0xc96605);var _0x53d295=_[_0x479a('0x35')](_0x51c6ed,function(_0x280edb){return _0x280edb[_0x479a('0x123')](_0x3678ad['id'],{'transaction':_0x458354});});return Promise[_0x479a('0x59')](_0x53d295);})[_0x479a('0x22')](function(){if(!_0x3678ad['online'])return;var _0x30bd26=_[_0x479a('0xe0')](_0x51c6ed,function(_0x3749de){return _0x3749de['getDataValue'](_0x479a('0xa2'))===_0x479a('0x124');});var _0x853355=_[_0x479a('0x35')](_0x30bd26,function(_0x33f439){return db[_0x479a('0xb9')][_0x479a('0xb2')]({'membername':_0x3678ad[_0x479a('0x3b')],'UserId':_0x3678ad['id'],'queue_name':_0x33f439[_0x479a('0x3b')],'VoiceQueueId':_0x33f439['id'],'interface':_[_0x479a('0x6b')](_0x3678ad[_0x479a('0xa5')])?util[_0x479a('0xae')](_0x479a('0xaf'),_0x3678ad[_0x479a('0x3b')]):_0x3678ad['interface'],'paused':_0x3678ad[_0x479a('0xb0')]||![],'penalty':_0x3678ad[_0x479a('0xb1')]},{'transaction':_0x458354});});return Promise['all'](_0x853355);})[_0x479a('0x22')](function(){return db[_0x479a('0x125')]['findAll']({'where':{'teamId':{'$in':_0x555c1b}}});})[_0x479a('0x22')](function(_0x387642){var _0x452083=_[_0x479a('0x35')](_0x387642,function(_0x52eee1){return db[_0x479a('0x126')][_0x479a('0x84')]({'UserId':_0x3678ad['id'],'VoicePrefixId':_0x52eee1['VoicePrefixId']},{'transaction':_0x458354});});return Promise[_0x479a('0x59')](_0x452083);});});})['then'](function(){for(var _0x48c820=0x0;_0x48c820<_0x51c6ed[_0x479a('0x53')];_0x48c820++){var _0x102ab5=_0x51c6ed[_0x48c820]['getDataValue'](_0x479a('0xa2'));var _0xf0b425=_0x102ab5+_0x479a('0xb7');socket[_0x479a('0x2e')](_0x479a('0x31')+_0x102ab5+_0x479a('0xac'),{'UserId':_0x278b27,['queueField']:_0x51c6ed[_0x48c820]['id']});}})[_0x479a('0x22')](respondWithStatusCode(_0x380b98,null))[_0x479a('0x5a')](APIHandleError(_0x380b98));};exports[_0x479a('0x127')]=function(_0x51eccf,_0x35d46b){var _0x3d21b7=_0x51eccf['params']['id'];var _0x5a351a=null;if(_0x51eccf[_0x479a('0x48')][_0x479a('0x64')]){_0x5a351a=_[_0x479a('0xb6')](_0x51eccf[_0x479a('0x48')][_0x479a('0x64')])?_0x51eccf[_0x479a('0x48')][_0x479a('0x64')]:[_0x51eccf[_0x479a('0x48')][_0x479a('0x64')]];}var _0x3c50ae=[];return Promise[_0x479a('0x11e')]()[_0x479a('0x22')](function(){if(!_0x5a351a)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x479a('0x22')](function(){return db['User'][_0x479a('0x9d')]({'where':{'id':_0x3d21b7}});})[_0x479a('0x22')](function(_0x4f6373){if(!_0x4f6373)throw new APINotFoundError(util[_0x479a('0xae')](_0x479a('0xd3'),_0x51eccf['params']['id']));return db[_0x479a('0x6d')][_0x479a('0x120')](function(_0x4f4dbd){return _0x4f6373['removeTeams'](_0x5a351a,{'transaction':_0x4f4dbd})['then'](function(){return db[_0x479a('0x11c')][_0x479a('0x50')]({'where':{'id':{'$in':_0x5a351a}}});})['then'](function(_0x26078f){var _0x37716=_[_0x479a('0x35')](_0x26078f,function(_0xc87831){return _0xc87831[_0x479a('0x121')]();});return Promise[_0x479a('0x59')](_0x37716);})[_0x479a('0x22')](function(_0x49863a){_0x3c50ae=_['flattenDeep'](_0x49863a);var _0x1cdbec=_['map'](_0x3c50ae,function(_0xde660d){return _0xde660d[_0x479a('0x128')](_0x4f6373['id'],{'transaction':_0x4f4dbd});});return Promise['all'](_0x1cdbec);})[_0x479a('0x22')](function(){if(!_0x4f6373[_0x479a('0xa3')])return;var _0xe36c58=_[_0x479a('0xe0')](_0x3c50ae,function(_0x4d597b){return _0x4d597b[_0x479a('0x129')](_0x479a('0xa2'))===_0x479a('0x124');});var _0x4f56cb=_[_0x479a('0x35')](_0xe36c58,function(_0x56b8d5){return db['UserVoiceQueueRt'][_0x479a('0xba')]({'where':{'VoiceQueueId':_0x56b8d5['id'],'UserId':_0x4f6373['id']},'transaction':_0x4f4dbd});});return Promise[_0x479a('0x59')](_0x4f56cb);})[_0x479a('0x22')](function(){return db['TeamVoicePrefix'][_0x479a('0x50')]({'where':{'teamId':{'$in':_0x5a351a}}});})['then'](function(_0x211289){var _0xef602=_[_0x479a('0x35')](_0x211289,function(_0x503927){return db['UserVoicePrefix'][_0x479a('0xba')]({'where':{'UserId':_0x4f6373['id'],'VoicePrefixId':_0x503927[_0x479a('0x12a')]}},{'transaction':_0x4f4dbd});});return Promise[_0x479a('0x59')](_0xef602);});});})['then'](function(){for(var _0x17542c=0x0;_0x17542c<_0x3c50ae[_0x479a('0x53')];_0x17542c++){var _0x43ebf=_0x3c50ae[_0x17542c][_0x479a('0x129')]('channel');var _0x38b446=_0x43ebf+'QueueId';socket['emit'](_0x479a('0x31')+_0x43ebf+_0x479a('0xb8'),{'UserId':_0x3d21b7,['queueField']:_0x3c50ae[_0x17542c]['id']});}})[_0x479a('0x22')](respondWithStatusCode(_0x35d46b,null))[_0x479a('0x5a')](APIHandleError(_0x35d46b));};exports[_0x479a('0x12b')]=function(_0x339b73,_0x5eb204){var _0x2fdbe8={};var _0x3d6791={};var _0x598b3a;var _0x2140fe;return db['User']['findOne']({'where':{'id':_0x339b73[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x5eb204,null))[_0x479a('0x22')](function(_0x52dcd5){if(_0x52dcd5){_0x598b3a=_0x52dcd5;_0x3d6791[_0x479a('0xd9')]=_[_0x479a('0xda')](db[_0x479a('0xd4')][_0x479a('0x3e')]);_0x3d6791[_0x479a('0x48')]=_[_0x479a('0xda')](_0x339b73[_0x479a('0x48')]);_0x3d6791[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0x3d6791[_0x479a('0xd9')],_0x3d6791['query']);_0x2fdbe8[_0x479a('0x4e')]=_['intersection'](_0x3d6791['model'],qs[_0x479a('0xe3')](_0x339b73[_0x479a('0x48')][_0x479a('0xe3')]));_0x2fdbe8[_0x479a('0x4e')]=_0x2fdbe8[_0x479a('0x4e')][_0x479a('0x53')]?_0x2fdbe8['attributes']:_0x3d6791['model'];_0x2fdbe8[_0x479a('0xde')]=qs[_0x479a('0xdf')](_0x339b73['query']['sort']);_0x2fdbe8['where']=qs[_0x479a('0xdc')](_[_0x479a('0xe4')](_0x339b73[_0x479a('0x48')],_0x3d6791['filters']));if(_0x339b73[_0x479a('0x48')][_0x479a('0xe0')]){_0x2fdbe8[_0x479a('0x47')]=_[_0x479a('0x5d')](_0x2fdbe8[_0x479a('0x47')],{'$or':_[_0x479a('0x35')](_0x2fdbe8['attributes'],function(_0xe3b429){var _0x403284={};_0x403284[_0xe3b429]={'$like':'%'+_0x339b73[_0x479a('0x48')][_0x479a('0xe0')]+'%'};return _0x403284;})});}_0x2fdbe8=_['merge']({},_0x2fdbe8,_0x339b73[_0x479a('0x5e')]);return _0x598b3a[_0x479a('0x12b')](_0x2fdbe8);}})[_0x479a('0x22')](function(_0x2b531b){if(_0x2b531b){_0x2140fe=_0x2b531b['length'];if(!_0x339b73[_0x479a('0x48')][_0x479a('0xe2')](_0x479a('0xe6'))){_0x2fdbe8['limit']=qs[_0x479a('0x1b')](_0x339b73[_0x479a('0x48')][_0x479a('0x1b')]);_0x2fdbe8[_0x479a('0x1a')]=qs[_0x479a('0x1a')](_0x339b73[_0x479a('0x48')][_0x479a('0x1a')]);}return _0x598b3a[_0x479a('0x12b')](_0x2fdbe8);}})['then'](function(_0x185343){if(_0x185343){return _0x185343?{'count':_0x2140fe,'rows':_0x185343}:null;}})[_0x479a('0x22')](respondWithResult(_0x5eb204,null))[_0x479a('0x5a')](handleError(_0x5eb204,null));};exports['getAgents']=function(_0x1e724b,_0x51a541){var _0x381e61={};var _0x46944e={};var _0x5dd561;return db[_0x479a('0x3d')]['findOne']({'where':{'id':_0x1e724b[_0x479a('0x5c')]['id']}})[_0x479a('0x22')](handleEntityNotFound(_0x51a541,null))[_0x479a('0x22')](function(_0x545281){if(_0x545281){_0x5dd561=_0x545281;_0x46944e[_0x479a('0xd9')]=_[_0x479a('0xda')](db['User']['rawAttributes']);_0x46944e[_0x479a('0x48')]=_['keys'](_0x1e724b['query']);_0x46944e[_0x479a('0xdc')]=_[_0x479a('0xdd')](_0x46944e[_0x479a('0xd9')],_0x46944e[_0x479a('0x48')]);_0x381e61['attributes']=_[_0x479a('0xdd')](_0x46944e[_0x479a('0xd9')],qs[_0x479a('0xe3')](_0x1e724b[_0x479a('0x48')][_0x479a('0xe3')]));_0x381e61['attributes']=_0x381e61[_0x479a('0x4e')][_0x479a('0x53')]?_0x381e61[_0x479a('0x4e')]:_0x46944e['model'];_0x381e61[_0x479a('0xde')]=qs[_0x479a('0xdf')](_0x1e724b[_0x479a('0x48')]['sort']);_0x381e61[_0x479a('0x47')]=qs[_0x479a('0xdc')](_['pick'](_0x1e724b['query'],_0x46944e[_0x479a('0xdc')]));if(_0x1e724b[_0x479a('0x48')][_0x479a('0xe0')]){_0x381e61[_0x479a('0x47')]=_['merge'](_0x381e61[_0x479a('0x47')],{'$or':_[_0x479a('0x35')](_0x381e61[_0x479a('0x4e')],function(_0x5afff2){var _0x17f9dd={};_0x17f9dd[_0x5afff2]={'$like':'%'+_0x1e724b[_0x479a('0x48')][_0x479a('0xe0')]+'%'};return _0x17f9dd;})});}_0x381e61[_0x479a('0xd9')]=db['User'];_0x381e61['as']=_0x479a('0x8c');_0x381e61=_[_0x479a('0x5d')]({},_0x381e61,_0x1e724b['options']);return _0x5dd561['getVoiceQueues']({'include':[_0x381e61]});}})[_0x479a('0x22')](function(_0x3774c1){if(_0x3774c1){var _0x4a31d0={},_0x20ef23=[];for(var _0x5a3902=0x0;_0x5a3902<_0x3774c1[_0x479a('0x53')];_0x5a3902+=0x1){for(var _0x24b4fe=0x0,_0x1db282;_0x24b4fe<_0x3774c1[_0x5a3902][_0x479a('0x8c')]['length'];_0x24b4fe+=0x1){_0x1db282=_0x3774c1[_0x5a3902][_0x479a('0x8c')][_0x24b4fe][_0x479a('0x2f')]({'plain':!![]});_0x4a31d0[_0x1db282['id']]=_0x1db282;}}_0x4a31d0=_['values'](_0x4a31d0);for(var _0x202a66=qs[_0x479a('0x1a')](_0x1e724b[_0x479a('0x48')][_0x479a('0x1a')]);_0x202a66<_0x4a31d0[_0x479a('0x53')]&&_0x20ef23[_0x479a('0x53')]=_0x3a5c88){_0x543524=_0x3a5c88;_0x3f1943=0xc8;}else{_0x3f1943=0xce;}_0x6bd85e['status'](_0x3f1943);return _0x6bd85e['set'](_0xe364('0x1d'),_0x59e83e+'-'+_0x543524+'/'+_0x3a5c88)[_0xe364('0x1e')](_0x2ec017);}return null;};}function respondWithRpcPromise(_0x59ef21,_0x33a37a,_0x14db3b,_0x1fe63d){return new Promise(function(_0x5888e9,_0x5bf6a){var _0x5c30a3=_0x1fe63d||amiClient;return _0x5c30a3[_0xe364('0x1f')](_0x59ef21,_0x14db3b)[_0xe364('0x20')](function(_0x2cab3d){logger[_0xe364('0x21')](_0xe364('0x22'),_0x33a37a,_0xe364('0x23'));logger[_0xe364('0x24')]('User,\x20%s,\x20%s,\x20%s',_0x33a37a,_0xe364('0x23'),JSON['stringify'](_0x2cab3d));if(_0x2cab3d[_0xe364('0x25')]){if(_0x2cab3d[_0xe364('0x25')]['code']===0x1f4){logger[_0xe364('0x25')](_0xe364('0x22'),_0x33a37a,_0x2cab3d['error'][_0xe364('0x26')]);return _0x5bf6a(_0x2cab3d['error'][_0xe364('0x26')]);}logger[_0xe364('0x25')](_0xe364('0x22'),_0x33a37a,_0x2cab3d[_0xe364('0x25')]['message']);return _0x5888e9(_0x2cab3d['error'][_0xe364('0x26')]);}else{logger[_0xe364('0x21')]('User,\x20%s,\x20%s',_0x33a37a,'request\x20sent');_0x5888e9(_0x2cab3d[_0xe364('0x27')][_0xe364('0x26')]);}})['catch'](function(_0x2866f7){logger[_0xe364('0x25')](_0xe364('0x22'),_0x33a37a,_0x2866f7);_0x5bf6a(_0x2866f7);});});}function saveUpdates(_0x31dcd9){return function(_0x32b84a){if(_0x32b84a){return _0x32b84a['update'](_0x31dcd9)[_0xe364('0x20')](function(_0x5d7e68){if(_0x5d7e68[_0xe364('0x28')]===_0xe364('0x29')){socket[_0xe364('0x2a')](_0xe364('0x2b')+_0x5d7e68['id'],_0x5d7e68);}return _0x5d7e68;});}return null;};}function removeEntity(_0x4a6c9d,_0x232ba0){return function(_0xed326d){if(_0xed326d){return _0xed326d[_0xe364('0x2c')]({'transaction':_0x232ba0})['then'](function(){var _0x576a7c=_0xed326d['get']({'plain':!![]});if(_0x576a7c[_0xe364('0x28')]===_0xe364('0x2d'))return;var _0x27114b=[{'name':_0xe364('0x2e'),'value':_0xe364('0x2f'),'ignore':!![]},{'name':_0xe364('0x30'),'value':_0xe364('0x29'),'ignore':![]},{'name':_0xe364('0x31'),'value':'telephone','ignore':![]}];var _0x32c7a6=_(_0x27114b)[_0xe364('0x32')](_0xe364('0x33'))[_0xe364('0x34')](_0xe364('0x35'))['value']();if(_[_0xe364('0x36')](_0x32c7a6,_0x576a7c[_0xe364('0x28')])){return;}var _0x55cb84=_[_0xe364('0x37')](_0x27114b,['value',_0x576a7c[_0xe364('0x28')]])[_0xe364('0x38')];return db['UserProfileResource'][_0xe364('0x2c')]({'where':{'type':_0x55cb84,'resourceId':_0x576a7c['id']},'transaction':_0x232ba0})[_0xe364('0x20')](function(){return _0xed326d;});})['then'](function(){_0x4a6c9d[_0xe364('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11984c){return function(_0xa3f584){if(!_0xa3f584){_0x11984c['sendStatus'](0x194);}return _0xa3f584;};}function handleError(_0x27b834,_0x5e30b0){_0x5e30b0=_0x5e30b0||0x1f4;return function(_0x51d32c){logger[_0xe364('0x25')](_0x51d32c[_0xe364('0x39')]);if(_0x51d32c[_0xe364('0x38')]){delete _0x51d32c[_0xe364('0x38')];}_0x27b834['status'](_0x5e30b0)[_0xe364('0x3a')](_0x51d32c);};}function getUserAttributes(){return _(db['User'][_0xe364('0x3b')])[_0xe364('0x34')](function(_0x253a19){return{'name':_0x253a19['fieldName'],'type':_0x253a19[_0xe364('0x3c')][_0xe364('0x3d')]};})[_0xe364('0x32')](function(_0x320438){return![_0xe364('0x3e'),'salt',_0xe364('0x3f'),'resetPasswordToken',_0xe364('0x40'),_0xe364('0x41')][_0xe364('0x36')](_0x320438[_0xe364('0x38')]);})['value']();}exports[_0xe364('0x42')]=function(_0x5ee343,_0x15e8c8){var _0x3ccfd2={},_0x45dbe9={'count':0x0,'rows':[]};var _0x1f7845=getUserAttributes();_0x3ccfd2=qs[_0xe364('0x43')](_0x1f7845,_0x5ee343);var _0x1bdfab={'where':_0x3ccfd2[_0xe364('0x44')]};return db[_0xe364('0x45')][_0xe364('0x1c')](_0x1bdfab)[_0xe364('0x20')](function(_0xbb741b){_0x45dbe9[_0xe364('0x1c')]=_0xbb741b;if(_0x5ee343[_0xe364('0x46')][_0xe364('0x47')]){_0x3ccfd2[_0xe364('0x48')]=[{'all':!![]}];}if(_0x5ee343[_0xe364('0x46')][_0xe364('0x49')]===_0xe364('0x4a')){_0x3ccfd2['include']=[{'model':db[_0xe364('0x4b')],'as':_0xe364('0x49')}];}if(!_[_0xe364('0x36')](_0x3ccfd2[_0xe364('0x4c')],'id')){_0x3ccfd2[_0xe364('0x4c')][_0xe364('0x4d')]('id');}return db[_0xe364('0x45')][_0xe364('0x4e')](_0x3ccfd2);})[_0xe364('0x20')](function(_0x1d67fd){_0x45dbe9[_0xe364('0x4f')]=_0x1d67fd;if(_0x5ee343[_0xe364('0x46')][_0xe364('0x50')]==='true'){var _0x2931e5=[];for(var _0x16243d=0x0;_0x16243d<_0x45dbe9[_0xe364('0x4f')]['length'];_0x16243d++){_0x2931e5[_0xe364('0x4d')](get_open_tabs(_0xe364('0x51'),_0x45dbe9[_0xe364('0x4f')][_0x16243d][_0xe364('0x52')]));_0x2931e5['push'](get_open_tabs(_0xe364('0x53'),_0x45dbe9[_0xe364('0x4f')][_0x16243d]['dataValues']));_0x2931e5[_0xe364('0x4d')](get_open_tabs('fax',_0x45dbe9['rows'][_0x16243d][_0xe364('0x52')]));_0x2931e5[_0xe364('0x4d')](get_open_tabs(_0xe364('0x54'),_0x45dbe9[_0xe364('0x4f')][_0x16243d][_0xe364('0x52')]));_0x2931e5[_0xe364('0x4d')](get_open_tabs(_0xe364('0x55'),_0x45dbe9[_0xe364('0x4f')][_0x16243d][_0xe364('0x52')]));_0x2931e5[_0xe364('0x4d')](get_open_tabs('whatsapp',_0x45dbe9['rows'][_0x16243d][_0xe364('0x52')]));}return Promise['all'](_0x2931e5)[_0xe364('0x20')](function(){return _0x45dbe9;});}else{return _0x45dbe9;}})[_0xe364('0x20')](respondWithFilteredResult(_0x15e8c8,_0x3ccfd2))['catch'](handleError(_0x15e8c8,null));};exports[_0xe364('0x56')]=function(_0xaadae8,_0x37a6dc){var _0x395949=getUserAttributes();_0xaadae8['query']['id']=_0xaadae8[_0xe364('0x57')]['id'];var _0x40b9ec=qs[_0xe364('0x43')](_0x395949,_0xaadae8);if(_0xaadae8['query']['includeAll']){_0x40b9ec[_0xe364('0x48')]=[{'all':!![]}];}if(_0xaadae8[_0xe364('0x46')][_0xe364('0x49')]===_0xe364('0x4a')){_0x40b9ec['include']=[{'model':db[_0xe364('0x4b')],'as':'userSetting'}];}_0x40b9ec=_[_0xe364('0x58')]({},_0x40b9ec,_0xaadae8[_0xe364('0x59')]);if(!_['includes'](_0x40b9ec[_0xe364('0x4c')],'id')){_0x40b9ec[_0xe364('0x4c')][_0xe364('0x4d')]('id');}return db[_0xe364('0x45')][_0xe364('0x37')](_0x40b9ec)['then'](handleEntityNotFound(_0x37a6dc,null))['then'](function(_0x192376){var _0x95c744=[];values=_0x192376;if(_0xaadae8[_0xe364('0x46')][_0xe364('0x50')]===_0xe364('0x4a')){_0x95c744[_0xe364('0x4d')](get_open_tabs(_0xe364('0x51'),_0x192376[_0xe364('0x52')]));_0x95c744['push'](get_open_tabs(_0xe364('0x53'),_0x192376['dataValues']));_0x95c744[_0xe364('0x4d')](get_open_tabs('openchannel',_0x192376[_0xe364('0x52')]));_0x95c744[_0xe364('0x4d')](get_open_tabs(_0xe364('0x5a'),_0x192376['dataValues']));_0x95c744[_0xe364('0x4d')](get_open_tabs(_0xe364('0x5b'),_0x192376['dataValues']));_0x95c744[_0xe364('0x4d')](get_open_tabs(_0xe364('0x54'),_0x192376[_0xe364('0x52')]));return Promise['all'](_0x95c744);}else{return values;}})[_0xe364('0x20')](function(){return values;})[_0xe364('0x20')](respondWithResult(_0x37a6dc,null))['catch'](handleError(_0x37a6dc,null));};exports[_0xe364('0x5c')]=function(_0x1130fb,_0x2cd6af){if(_0x1130fb[_0xe364('0x5d')]['id']){delete _0x1130fb['body']['id'];}delete _0x1130fb[_0xe364('0x5d')][_0xe364('0x28')];return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x1130fb[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x2cd6af,null))[_0xe364('0x20')](saveUpdates(_0x1130fb[_0xe364('0x5d')],null))[_0xe364('0x20')](respondWithResult(_0x2cd6af,null))['catch'](handleError(_0x2cd6af,null));};exports[_0xe364('0x5e')]=function(_0x11f416,_0x5389d0){return db[_0xe364('0x45')][_0xe364('0x5e')]()[_0xe364('0x20')](respondWithResult(_0x5389d0,null))[_0xe364('0x5f')](handleError(_0x5389d0,null));};exports[_0xe364('0x60')]=function(_0x3442ff,_0xa9f902){return db['User'][_0xe364('0x37')]({'where':{'id':_0x3442ff[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0xa9f902,null))['then'](function(_0x1b8362){if(_0x1b8362){return _0x1b8362[_0xe364('0x60')](_0x3442ff[_0xe364('0x5d')][_0xe364('0x61')],_['omit'](_0x3442ff['body'],['ids','id'])||{});}})[_0xe364('0x20')](respondWithResult(_0xa9f902,null))[_0xe364('0x5f')](handleError(_0xa9f902,null));};function validateUser(_0x501afa){return new Promise(function(_0x5866f4,_0x34c2f4){if(_0x501afa[_0xe364('0x62')])return _0x5866f4(_0x501afa);return db[_0xe364('0x63')][_0xe364('0x64')](0x1)[_0xe364('0x20')](function(_0x104de3){if(_0x104de3['securePassword'])authService[_0xe364('0x65')](_0x501afa[_0xe364('0x3e')]);db['User'][_0xe364('0x66')](_0xe364('0x62'))['then'](function(_0x1ff92a){if(_[_0xe364('0x67')](_0x1ff92a)){_0x501afa[_0xe364('0x62')]=_0x104de3[_0xe364('0x68')]||0x1;return;}if(_[_0xe364('0x67')](_0x104de3[_0xe364('0x68')])||_0x104de3[_0xe364('0x68')]===_0x1ff92a){_0x501afa[_0xe364('0x62')]=_0x1ff92a+0x1;return;}if(_0x104de3[_0xe364('0x68')]>_0x1ff92a){_0x501afa[_0xe364('0x62')]=_0x104de3[_0xe364('0x68')];return;}return db[_0xe364('0x69')]['query'](_0xe364('0x6a'),{'type':db[_0xe364('0x69')][_0xe364('0x6b')][_0xe364('0x6c')]})[_0xe364('0x20')](function(_0x33fd0f){if(_0x33fd0f&&_0x33fd0f[_0xe364('0x6d')]){for(var _0x3a1f16=0x0,_0x28f8ba=_0x33fd0f[_0xe364('0x6d')];_0x3a1f16<_0x28f8ba&&_[_0xe364('0x67')](_0x501afa[_0xe364('0x62')]);_0x3a1f16++){if(_0x104de3[_0xe364('0x68')]<=_0x33fd0f[_0x3a1f16][_0xe364('0x6e')]){_0x501afa[_0xe364('0x62')]=_0x33fd0f[_0x3a1f16][_0xe364('0x6e')];}else if(_0x104de3['min_internal']>_0x33fd0f[_0x3a1f16][_0xe364('0x6e')]&&_0x104de3[_0xe364('0x68')]<=_0x33fd0f[_0x3a1f16]['to']){_0x501afa['internal']=_0x104de3[_0xe364('0x68')];}}}if(_[_0xe364('0x67')](_0x501afa[_0xe364('0x62')])){_0x501afa[_0xe364('0x62')]=_0x1ff92a+0x1;}return _0x5866f4(_0x501afa);});});})['catch'](function(_0x1857a6){_0x34c2f4(_0x1857a6);});});}function updateUser(_0x185f47){return new Promise(function(_0x5449d6,_0x76fc63){try{if(_0x185f47['voicemail']){_0x185f47[_0xe364('0x6f')]=_0x185f47[_0xe364('0x62')];_0x185f47['VoiceMail']={'mailbox':_0x185f47[_0xe364('0x62')],'password':_0x185f47[_0xe364('0x3e')],'fullname':_0x185f47[_0xe364('0x70')],'email':_0x185f47['email']};}if(_0x185f47[_0xe364('0x28')]===_0xe364('0x29')){if(!_0x185f47[_0xe364('0x71')])_0x185f47['permissions']=[_0xe364('0x72'),_0xe364('0x73'),_0xe364('0x74'),_0xe364('0x75'),_0xe364('0x76'),_0xe364('0x77'),_0xe364('0x78'),_0xe364('0x79'),_0xe364('0x7a'),_0xe364('0x7b'),_0xe364('0x7c'),_0xe364('0x7d'),_0xe364('0x7e'),'114',_0xe364('0x7f')];}_0x5449d6(_0x185f47);}catch(_0x3c00c0){_0x76fc63(_0x3c00c0);}});}exports[_0xe364('0x80')]=function(_0x362dd0,_0x1727f2){if(_0x362dd0[_0xe364('0x2f')][_0xe364('0x28')]===_0xe364('0x29'))throw new Error('Unauthorized');if(_0x362dd0[_0xe364('0x5d')]['role']==='user'&&_0x362dd0[_0xe364('0x2f')][_0xe364('0x28')]!==_0xe364('0x2d')){throw new Error(_0xe364('0x81'));}if(_0x362dd0[_0xe364('0x5d')]['role']===_0xe364('0x2d')&&_0x362dd0[_0xe364('0x2f')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xe364('0x82')]([_0x362dd0['body']])['then'](function(){return validateUser(_0x362dd0[_0xe364('0x5d')]);})[_0xe364('0x20')](function(_0x2ae5fd){return updateUser(_0x2ae5fd)[_0xe364('0x20')](function(_0x59404a){if(_0x59404a[_0xe364('0x28')]===_0xe364('0x2d')){_0x59404a[_0xe364('0x83')]=_0x362dd0[_0xe364('0x2f')]['settingsEnabled'];delete _0x59404a['userProfileId'];}return _0x59404a;});})['then'](function(_0x1955e5){return db[_0xe364('0x45')][_0xe364('0x80')](_0x1955e5,{'include':[{'model':db[_0xe364('0x84')],'as':_0xe364('0x84')}]});})[_0xe364('0x20')](function(_0x1c6700){if(_0x362dd0['body'][_0xe364('0x28')]==='user')return _0x1c6700;if(_0x362dd0[_0xe364('0x2f')][_0xe364('0x28')]!==_0xe364('0x2f'))return _0x1c6700;return db['UserProfileSection']['find']({'where':{'name':_0x1c6700[_0xe364('0x28')]===_0xe364('0x29')?_0xe364('0x30'):_0xe364('0x31'),'userProfileId':_0x362dd0[_0xe364('0x2f')][_0xe364('0x85')]},'raw':!![]})[_0xe364('0x20')](function(_0x300b5e){if(!_0x300b5e||_0x300b5e[_0xe364('0x86')]!=0x0)return _0x1c6700;return db[_0xe364('0x87')]['create']({'name':_0x1c6700['name'],'resourceId':_0x1c6700['id'],'type':_0x300b5e['name'],'sectionId':_0x300b5e['id']},{})[_0xe364('0x20')](function(){return _0x1c6700;});})[_0xe364('0x5f')](function(_0x2f6b01){logger[_0xe364('0x25')](_0xe364('0x88'),_0x2f6b01);throw _0x2f6b01;});})[_0xe364('0x20')](respondWithResult(_0x1727f2,0xc9))['catch'](handleError(_0x1727f2,null));};exports[_0xe364('0x89')]=function(_0x342003,_0xdaa20b){var _0x3f3ae4=_0x342003['body'];var _0x3be835=[];if(_0x342003[_0xe364('0x2f')]['role']==='agent')throw new Error(_0xe364('0x8a'));if(_[_0xe364('0x8b')](_0x3f3ae4,[_0xe364('0x28'),_0xe364('0x2f')])&&_0x342003['user'][_0xe364('0x28')]!==_0xe364('0x2d')){throw new Error(_0xe364('0x81'));}if(_[_0xe364('0x8b')](_0x3f3ae4,[_0xe364('0x28'),_0xe364('0x2d')])&&_0x342003[_0xe364('0x2f')][_0xe364('0x28')]!==_0xe364('0x2d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xe364('0x82')](_0x3f3ae4)[_0xe364('0x20')](function(){return validateUser(_0x3f3ae4[0x0]);})['then'](function(){for(var _0x2dc3d1=0x1;_0x2dc3d1<_0x3f3ae4[_0xe364('0x6d')];_0x2dc3d1++){var _0x5d48f0=_0x3f3ae4[_0x2dc3d1-0x1]['internal'];if(!_0x3f3ae4[_0x2dc3d1][_0xe364('0x62')])_0x3f3ae4[_0x2dc3d1][_0xe364('0x62')]=_0x5d48f0+0x1;_0x3be835[_0xe364('0x4d')](validateUser(_0x3f3ae4[_0x2dc3d1]));}return Promise['all'](_0x3be835);})['then'](function(){_0x3be835=[];for(var _0x4f3e0c=0x0;_0x4f3e0c<_0x3f3ae4[_0xe364('0x6d')];_0x4f3e0c++){_0x3be835[_0xe364('0x4d')](updateUser(_0x3f3ae4[_0x4f3e0c]));}return Promise['all'](_0x3be835);})['then'](function(){_0x3be835=_0x3f3ae4['map'](function(_0x295321){return db[_0xe364('0x45')][_0xe364('0x80')](_0x295321,{'include':[{'model':db[_0xe364('0x84')],'as':_0xe364('0x84')}]})[_0xe364('0x20')](function(_0x2deb41){_0x295321['id']=_0x2deb41['id'];return _0x295321;});});return Promise[_0xe364('0x8c')](_0x3be835);})[_0xe364('0x20')](function(_0x54bdb1){if(_0x342003[_0xe364('0x5d')][_0xe364('0x28')]==='user')return _0x54bdb1;if(_0x342003[_0xe364('0x2f')][_0xe364('0x28')]!=='user')return _0x54bdb1;var _0x57d1d8=_['some'](_0x54bdb1,function(_0x3d82c7){return _0x3d82c7[_0xe364('0x28')]==='agent'||_0x3d82c7[_0xe364('0x28')]===_0xe364('0x8d');});if(!_0x57d1d8)return _0x54bdb1;return db[_0xe364('0x8e')][_0xe364('0x4e')]({'where':{'name':{'$or':['Agents',_0xe364('0x31')]},'userProfileId':_0x342003[_0xe364('0x2f')][_0xe364('0x85')]},'raw':!![]})[_0xe364('0x20')](function(_0x4b9bb8){if(_['isEmpty'](_0x4b9bb8)||!_[_0xe364('0x8b')](_0x4b9bb8,[_0xe364('0x86'),0x0]))return _0x54bdb1;_0x3be835=[];var _0xe0e53b=_(_0x4b9bb8)[_0xe364('0x34')](function(_0x214a95){if(_0x214a95[_0xe364('0x86')]===0x1)return;return _0x214a95['name']==='Agents'?_0xe364('0x29'):'telephone';})[_0xe364('0x8f')]()[_0xe364('0x35')]();for(var _0x2903f9=0x0;_0x2903f9<_0x54bdb1['length'];_0x2903f9++){if(!_['includes'](_0xe0e53b,_0x54bdb1[_0x2903f9][_0xe364('0x28')]))return;var _0x27c12c=_0x54bdb1[_0x2903f9][_0xe364('0x28')]===_0xe364('0x29')?_0xe364('0x30'):_0xe364('0x31');_0x3be835[_0xe364('0x4d')](db['UserProfileResource'][_0xe364('0x80')]({'name':_0x54bdb1[_0x2903f9][_0xe364('0x38')],'resourceId':_0x54bdb1[_0x2903f9]['id'],'type':_0x27c12c,'sectionId':_['find'](_0x4b9bb8,[_0xe364('0x38'),_0x27c12c])['id']},{}));}return Promise[_0xe364('0x8c')](_0x3be835);});})[_0xe364('0x20')](respondWithResult(_0xdaa20b,0xc9))[_0xe364('0x5f')](handleError(_0xdaa20b,null));};exports[_0xe364('0x90')]=function(_0x467b78,_0x2aa885){if(_0x467b78[_0xe364('0x5d')]['id']){delete _0x467b78[_0xe364('0x5d')]['id'];}return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x467b78[_0xe364('0x57')]['id']}})[_0xe364('0x20')](function(_0x2b8739){if(!_0x2b8739)return null;if(_0x2b8739['id']===_0x467b78[_0xe364('0x2f')]['id']){if(!_0x467b78['body'][_0xe364('0x91')]||!_0x467b78[_0xe364('0x5d')][_0xe364('0x92')]){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x95'));}if(!_0x2b8739[_0xe364('0x96')](_0x467b78['body']['oldPassword'])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x467b78[_0xe364('0x5d')]['oldPassword']===_0x467b78['body'][_0xe364('0x92')]){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x97'));}}else if(_0x467b78['user'][_0xe364('0x28')]==='admin'){if(!_0x467b78[_0xe364('0x5d')][_0xe364('0x92')]){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x98'));}}else if(_0x467b78[_0xe364('0x2f')]['role']==='user'){if(!_0x467b78[_0xe364('0x5d')][_0xe364('0x92')]){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x98'));}if(_0x2b8739[_0xe364('0x28')]!==_0xe364('0x29')){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x8a'));}}else{throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x8a'));}return _0x2b8739;})['then'](handleEntityNotFound(_0x2aa885,null))[_0xe364('0x20')](function(_0x181c8e){return db['Setting'][_0xe364('0x99')]({'attributes':['id',_0xe364('0x9a'),_0xe364('0x9b'),_0xe364('0x9c')]})[_0xe364('0x20')](function(_0x37d7dd){if(_0x37d7dd[_0xe364('0x9a')])authService[_0xe364('0x65')](_0x467b78[_0xe364('0x5d')][_0xe364('0x92')]);if(!_0x37d7dd[_0xe364('0x9b')]||!_0x181c8e[_0xe364('0x3f')])return _0x181c8e;authService[_0xe364('0x9d')](_0x467b78[_0xe364('0x5d')][_0xe364('0x92')],_0x181c8e[_0xe364('0x3f')],_0x37d7dd[_0xe364('0x9c')]);return _0x181c8e;})['then'](saveUpdates({'password':_0x467b78[_0xe364('0x5d')][_0xe364('0x92')],'passwordResetAt':_0x467b78[_0xe364('0x2f')]['id']==_0x467b78[_0xe364('0x57')]['id']?moment():null,'previousPasswords':authService[_0xe364('0x9e')](_0x467b78[_0xe364('0x5d')][_0xe364('0x92')],_0x181c8e[_0xe364('0x3f')])},null));})[_0xe364('0x20')](respondWithResult(_0x2aa885,null))['catch'](handleError(_0x2aa885,null));};exports['addQueues']=function(_0x67bb6e,_0x5709d6){var _0x24c2ba=_0x67bb6e[_0xe364('0x5d')][_0xe364('0x9f')];return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x67bb6e[_0xe364('0x57')]['id']},'attributes':['id',_0xe364('0x38'),'role',_0xe364('0xa0'),'loginInPause','voicePause',_0xe364('0xa1')]})[_0xe364('0x20')](handleEntityNotFound(_0x5709d6,null))[_0xe364('0x20')](function(_0x5555b2){if(_0x5555b2){if(!utils['isValidChannel'](_0x24c2ba)){throw new db[(_0xe364('0x93'))]['ValidationError'](_0xe364('0xa2'));}return _0x5555b2[_0xe364('0xa3')+_['capitalize'](_0x24c2ba[_0xe364('0xa4')]())+_0xe364('0xa5')](_0x67bb6e[_0xe364('0x5d')]['ids'],{'penalty':_0x67bb6e['body'][_0xe364('0xa6')]||0x0})[_0xe364('0xa7')](function(_0x4d3a19){for(var _0x4233e8=0x0;_0x4233e8<_0x67bb6e[_0xe364('0x5d')]['ids'][_0xe364('0x6d')];_0x4233e8+=0x1){var _0x34a7b9={'UserId':Number(_0x67bb6e[_0xe364('0x57')]['id'])};_0x34a7b9[_['capitalize'](_0x24c2ba[_0xe364('0xa4')]())+_0xe364('0xa8')]=Number(_0x67bb6e[_0xe364('0x5d')][_0xe364('0x61')][_0x4233e8]);socket[_0xe364('0x2a')](_0xe364('0x2f')+_[_0xe364('0xa9')](_0x24c2ba['toLowerCase']())+_0xe364('0xaa'),_0x34a7b9);}return _0x4d3a19;})[_0xe364('0x20')](function(){if(_0x24c2ba===_0xe364('0xab')){return db[_0xe364('0xac')][_0xe364('0x4e')]({'where':{'id':_0x67bb6e['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0xe364('0x20')](function(_0x27bac7){var _0x917b2a=_0x5555b2[_0xe364('0xad')]({'plain':!![]});var _0x113951=[];if(_0x24c2ba===_0xe364('0xab')&&_0x917b2a[_0xe364('0x28')]==='agent'&&_0x917b2a[_0xe364('0xa0')]){for(let _0x127e67=0x0;_0x127e67<_0x27bac7[_0xe364('0x6d')];_0x127e67+=0x1){_0x113951['push']({'membername':_0x917b2a[_0xe364('0x38')],'UserId':_0x917b2a['id'],'queue_name':_0x27bac7[_0x127e67][_0xe364('0x38')],'VoiceQueueId':_0x27bac7[_0x127e67]['id'],'interface':_[_0xe364('0x67')](_0x917b2a['interface'])?util[_0xe364('0xae')](_0xe364('0xaf'),_0x917b2a['name']):_0x917b2a[_0xe364('0xa1')],'paused':_0x917b2a['voicePause']||![],'penalty':_0x67bb6e[_0xe364('0x5d')][_0xe364('0xa6')]||0x0});}return Promise['all'](_0x113951[_0xe364('0x34')](function(_0xa7f952){return db['UserVoiceQueueRt'][_0xe364('0xb0')](_0xa7f952);}));}return _0x5555b2;});}})[_0xe364('0x20')](respondWithStatusCode(_0x5709d6,null))[_0xe364('0x5f')](handleError(_0x5709d6,null));};exports['removeQueues']=function(_0x318868,_0x46d69){var _0x2c6f20,_0x772483;return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x318868['params']['id']},'attributes':['id','name',_0xe364('0x28')]})[_0xe364('0x20')](handleEntityNotFound(_0x46d69,null))[_0xe364('0x20')](function(_0x2be84f){if(_0x2be84f){_0x2c6f20=_0x2be84f;if(!_0x318868[_0xe364('0x46')][_0xe364('0x9f')]||!utils[_0xe364('0xb1')](_0x318868['query'][_0xe364('0x9f')])){throw new db['Sequelize'][(_0xe364('0x94'))](_0xe364('0xa2'));}return _0x2be84f[_0xe364('0xb2')+_[_0xe364('0xa9')](_0x318868[_0xe364('0x46')][_0xe364('0x9f')][_0xe364('0xa4')]())+_0xe364('0xa5')](_0x318868[_0xe364('0x46')][_0xe364('0x61')]);}})['then'](function(_0x3b455f){if(_['isArray'](_0x318868['query'][_0xe364('0x61')])){for(var _0x4be509=0x0;_0x4be509<_0x318868[_0xe364('0x46')][_0xe364('0x61')]['length'];_0x4be509+=0x1){_0x772483={'UserId':Number(_0x318868[_0xe364('0x57')]['id'])};_0x772483[_['capitalize'](_0x318868[_0xe364('0x46')][_0xe364('0x9f')][_0xe364('0xa4')]())+'QueueId']=Number(_0x318868[_0xe364('0x46')][_0xe364('0x61')][_0x4be509]);socket['emit'](_0xe364('0x2f')+_[_0xe364('0xa9')](_0x318868['query'][_0xe364('0x9f')][_0xe364('0xa4')]())+_0xe364('0xb3'),_0x772483);}}else{_0x772483={'UserId':Number(_0x318868[_0xe364('0x57')]['id'])};_0x772483[_[_0xe364('0xa9')](_0x318868['query'][_0xe364('0x9f')]['toLowerCase']())+_0xe364('0xa8')]=Number(_0x318868['query'][_0xe364('0x61')]);socket[_0xe364('0x2a')](_0xe364('0x2f')+_[_0xe364('0xa9')](_0x318868[_0xe364('0x46')][_0xe364('0x9f')]['toLowerCase']())+_0xe364('0xb3'),_0x772483);}return _0x3b455f;})[_0xe364('0x20')](function(){if(_0x318868[_0xe364('0x46')][_0xe364('0x9f')]===_0xe364('0xab')){return db['UserVoiceQueueRt'][_0xe364('0x2c')]({'where':{'UserId':_0x318868[_0xe364('0x57')]['id'],'VoiceQueueId':_0x318868[_0xe364('0x46')][_0xe364('0x61')]},'individualHooks':!![]})[_0xe364('0x20')](function(){return _0x2c6f20;});}return _0x2c6f20;})['then'](respondWithStatusCode(_0x46d69,null))[_0xe364('0x5f')](handleError(_0x46d69,null));};exports['addAvatar']=function(_0x29beb6,_0x5781b8){_0x29beb6[_0xe364('0x5d')][_0xe364('0xb4')]=_0x29beb6[_0xe364('0xb5')][_0xe364('0xb6')];return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x29beb6[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x5781b8,null))[_0xe364('0x20')](saveUpdates(_0x29beb6['body'],null))['then'](respondWithResult(_0x5781b8,null))[_0xe364('0x5f')](handleError(_0x5781b8,null));};exports['getAvatar']=function(_0x9dc6b0,_0x5168b6){var _0x424f2=path['join'](config[_0xe364('0xb7')],_0xe364('0xb8'));return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x9dc6b0['params']['id']},'attributes':['id',_0xe364('0xb4')],'raw':!![]})[_0xe364('0x20')](handleEntityNotFound(_0x5168b6,null))['then'](function(_0x16ac65){if(_0x16ac65){if(_['isNil'](_0x16ac65['userpic'])){return _0x5168b6[_0xe364('0xb9')](_0x424f2);}else{if(!fs[_0xe364('0xba')](path['join'](config[_0xe364('0xb7')],'server/files/images/',_0x16ac65[_0xe364('0xb4')]))){return _0x5168b6[_0xe364('0xb9')](_0x424f2);}return _0x5168b6['download'](path[_0xe364('0xbb')](config[_0xe364('0xb7')],_0xe364('0xbc'),_0x16ac65['userpic']));}}})[_0xe364('0x5f')](handleError(_0x5168b6,null));};exports['getOpenTabs']=function(_0x9900a7,_0x59d56f){return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x9900a7[_0xe364('0x57')]['id']},'attributes':['id']})[_0xe364('0x20')](handleEntityNotFound(_0x59d56f,null))[_0xe364('0x20')](function(_0x21b13e){var _0x48be17=[];values=_0x21b13e[_0xe364('0x52')];_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x51'),_0x21b13e[_0xe364('0x52')]));_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x53'),_0x21b13e[_0xe364('0x52')]));_0x48be17[_0xe364('0x4d')](get_open_tabs('openchannel',_0x21b13e[_0xe364('0x52')]));_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x5a'),_0x21b13e[_0xe364('0x52')]));_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x5b'),_0x21b13e['dataValues']));_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x54'),_0x21b13e[_0xe364('0x52')]));return Promise[_0xe364('0x8c')](_0x48be17);})[_0xe364('0x20')](function(_0x58f1da){if(_0x58f1da){var _0x5179d2=_[_0xe364('0x34')](values['ChatOpenTabs'],function(_0x3e3be5){return{'channel':_0xe364('0xbd'),'id':_0x3e3be5['id'],'createdAt':_0x3e3be5[_0xe364('0xbe')]};});var _0x53e7f5=_[_0xe364('0x34')](values['FaxOpenTabs'],function(_0x13a7a6){return{'channel':_0xe364('0xbf'),'id':_0x13a7a6['id'],'createdAt':_0x13a7a6['createdAt']};});var _0x4fcc2a=_[_0xe364('0x34')](values['OpenchannelOpenTabs'],function(_0x2827e6){return{'channel':'OPENCHANNEL','id':_0x2827e6['id'],'createdAt':_0x2827e6[_0xe364('0xbe')]};});var _0x3b1243=_[_0xe364('0x34')](values['MailOpenTabs'],function(_0xf93253){return{'channel':'MAIL','id':_0xf93253['id'],'createdAt':_0xf93253[_0xe364('0xbe')]};});var _0x35b4a0=_[_0xe364('0x34')](values['SmsOpenTabs'],function(_0x420c6f){return{'channel':_0xe364('0xc0'),'id':_0x420c6f['id'],'createdAt':_0x420c6f[_0xe364('0xbe')]};});var _0x4bfd63=_[_0xe364('0x34')](values['WhatsappOpenTabs'],function(_0x1e29b9){return{'channel':'WHATSAPP','id':_0x1e29b9['id'],'createdAt':_0x1e29b9['createdAt']};});var _0x2fa7cb=_[_0xe364('0xc1')](_0x5179d2,_0x53e7f5,_0x4fcc2a,_0x3b1243,_0x35b4a0,_0x4bfd63);var _0xed3822={'count':_0x2fa7cb[_0xe364('0x6d')],'rows':_0x2fa7cb};return _0xed3822;}else return null;})[_0xe364('0x20')](respondWithResult(_0x59d56f,null))[_0xe364('0x5f')](handleError(_0x59d56f,null));};exports[_0xe364('0xc2')]=function(_0x150c26,_0x8e260b){var _0x3a2094={};return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x150c26[_0xe364('0x57')]['id']}})[_0xe364('0x20')](function(_0x42f3c1){if(!_0x42f3c1){throw new APINotFoundError(util[_0xe364('0xae')](_0xe364('0xc3'),_0x150c26[_0xe364('0x57')]['id']));}return contacts[_0xe364('0x5e')]();})['then'](function(_0x262538){_0x150c26[_0xe364('0x46')][_0xe364('0x45')]=_0x150c26['params']['id'];_0x3a2094=qs[_0xe364('0x43')](_0x262538,_0x150c26);if(_0x150c26[_0xe364('0x46')]['hasOwnProperty'](_0xe364('0x47'))){_0x3a2094[_0xe364('0x48')]=[{'model':db[_0xe364('0xc4')],'as':_0xe364('0xc5'),'required':![]},{'model':db['Tag'],'as':_0xe364('0xc6'),'attributes':['id',_0xe364('0x38'),_0xe364('0xc7')],'where':_0x150c26[_0xe364('0x46')][_0xe364('0xc8')]?{'id':_0x150c26[_0xe364('0x46')][_0xe364('0xc8')]}:undefined,'required':_0x150c26[_0xe364('0x46')][_0xe364('0xc8')]?!![]:![]}];}return contacts[_0xe364('0x4e')](_0x150c26[_0xe364('0x46')],_0x150c26[_0xe364('0x2f')],_0x3a2094,_0x262538);})[_0xe364('0x20')](respondWithFilteredResult(_0x8e260b,_0x3a2094))[_0xe364('0x5f')](APIHandleError(_0x8e260b));};exports['getQueues']=function(_0x3d1e4d,_0x1b1aa9){var _0xb2b0f1;var _0xb84f61={};var _0xb8b80c;return db['User'][_0xe364('0x99')]({'where':{'id':_0x3d1e4d[_0xe364('0x57')]['id']},'attributes':['id',_0xe364('0x38'),'role']})[_0xe364('0x20')](handleEntityNotFound(_0x1b1aa9,null))['then'](function(_0x1aa296){if(!utils[_0xe364('0xb1')](_0x3d1e4d[_0xe364('0x46')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xe364('0xa2'));}_0xb2b0f1=_0x1aa296;var _0x30293f={};_0x30293f[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_['capitalize'](_0x3d1e4d[_0xe364('0x46')][_0xe364('0x9f')])+_0xe364('0xcb')][_0xe364('0x3b')]);_0x30293f[_0xe364('0x46')]=_[_0xe364('0xca')](_0x3d1e4d[_0xe364('0x46')]);_0x30293f[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x30293f[_0xe364('0xc9')],_0x30293f['query']);_0xb84f61[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x30293f[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x3d1e4d[_0xe364('0x46')]['fields']));_0xb84f61[_0xe364('0x4c')]=_0xb84f61[_0xe364('0x4c')][_0xe364('0x6d')]?_0xb84f61[_0xe364('0x4c')]:_0x30293f[_0xe364('0xc9')];_0xb84f61[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x3d1e4d['query']['sort']);_0xb84f61[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3d1e4d[_0xe364('0x46')],_0x30293f[_0xe364('0xcc')]));if(_0x3d1e4d['query'][_0xe364('0x32')]){_0xb84f61[_0xe364('0x44')]=_[_0xe364('0x58')](_0xb84f61[_0xe364('0x44')],{'$or':_['map'](_0xb84f61['attributes'],function(_0x3d8958){var _0xf8de00={};_0xf8de00[_0x3d8958]={'$like':'%'+_0x3d1e4d[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0xf8de00;})});}_0xb84f61=_[_0xe364('0x58')]({},_0xb84f61,_0x3d1e4d['options']);switch(_0xb2b0f1[_0xe364('0x28')]){case'admin':return db[_[_0xe364('0xa9')](_0x3d1e4d[_0xe364('0x46')][_0xe364('0x9f')])+_0xe364('0xcb')][_0xe364('0x4e')](_0xb84f61);case _0xe364('0x2f'):case _0xe364('0x29'):return _0xb2b0f1[_0xe364('0xad')+_[_0xe364('0xa9')](_0x3d1e4d['query'][_0xe364('0x9f')])+'Queues'](_0xb84f61);default:throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0xd2'));}})[_0xe364('0x20')](function(_0xb12e15){_0xb8b80c=_0xb12e15[_0xe364('0x6d')];if(!_0x3d1e4d[_0xe364('0x46')]['hasOwnProperty'](_0xe364('0xd3'))){_0xb84f61['limit']=qs['limit'](_0x3d1e4d[_0xe364('0x46')][_0xe364('0x1b')]);_0xb84f61[_0xe364('0x19')]=qs['offset'](_0x3d1e4d[_0xe364('0x46')]['offset']);}switch(_0xb2b0f1['role']){case _0xe364('0x2d'):return db[_[_0xe364('0xa9')](_0x3d1e4d[_0xe364('0x46')][_0xe364('0x9f')])+_0xe364('0xcb')][_0xe364('0x4e')](_0xb84f61);case _0xe364('0x2f'):case _0xe364('0x29'):return _0xb2b0f1[_0xe364('0xad')+_[_0xe364('0xa9')](_0x3d1e4d['query'][_0xe364('0x9f')])+'Queues'](_0xb84f61);}})[_0xe364('0x20')](function(_0x2bb921){return{'count':_0xb8b80c,'rows':_0x2bb921};})[_0xe364('0x20')](respondWithResult(_0x1b1aa9,null))[_0xe364('0x5f')](handleError(_0x1b1aa9,null));};exports[_0xe364('0xd4')]=function(_0x13372b,_0x4a2bbe){var _0x417150={};var _0x478554={};var _0x24cf8c;var _0x32d05e;return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x13372b[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x4a2bbe,null))[_0xe364('0x20')](function(_0x4cf5d9){if(_0x4cf5d9){_0x24cf8c=_0x4cf5d9;_0x478554[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xd5')][_0xe364('0x3b')]);_0x478554[_0xe364('0x46')]=_[_0xe364('0xca')](_0x13372b['query']);_0x478554[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x478554['model'],_0x478554[_0xe364('0x46')]);_0x417150[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x478554['model'],qs[_0xe364('0xce')](_0x13372b[_0xe364('0x46')][_0xe364('0xce')]));_0x417150['attributes']=_0x417150['attributes'][_0xe364('0x6d')]?_0x417150[_0xe364('0x4c')]:_0x478554['model'];_0x417150[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x13372b['query'][_0xe364('0xd0')]);_0x417150['where']=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x13372b[_0xe364('0x46')],_0x478554['filters']));if(_0x13372b[_0xe364('0x46')][_0xe364('0x32')]){_0x417150[_0xe364('0x44')]=_['merge'](_0x417150[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x417150[_0xe364('0x4c')],function(_0x823f6){var _0xedd558={};_0xedd558[_0x823f6]={'$like':'%'+_0x13372b[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0xedd558;})});}_0x417150=_[_0xe364('0x58')]({},_0x417150,_0x13372b[_0xe364('0x59')]);return _0x24cf8c[_0xe364('0xd4')](_0x417150);}})[_0xe364('0x20')](function(_0x598ba1){if(_0x598ba1){_0x32d05e=_0x598ba1[_0xe364('0x6d')];if(!_0x13372b[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x417150['limit']=qs[_0xe364('0x1b')](_0x13372b[_0xe364('0x46')][_0xe364('0x1b')]);_0x417150[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x13372b[_0xe364('0x46')][_0xe364('0x19')]);}return _0x24cf8c['getVoiceQueuesRt'](_0x417150);}})[_0xe364('0x20')](function(_0x209083){if(_0x209083){return _0x209083?{'count':_0x32d05e,'rows':_0x209083}:null;}})[_0xe364('0x20')](respondWithResult(_0x4a2bbe,null))[_0xe364('0x5f')](handleError(_0x4a2bbe,null));};exports[_0xe364('0xd7')]=function(_0x350479,_0x51c51e){var _0x27a0fb={};var _0xc4e3ef={};var _0x1feb0e;var _0x4ec0fa;return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x350479[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x51c51e,null))[_0xe364('0x20')](function(_0x421c0d){if(_0x421c0d){_0x1feb0e=_0x421c0d;_0xc4e3ef[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xd8')][_0xe364('0x3b')]);_0xc4e3ef[_0xe364('0x46')]=_[_0xe364('0xca')](_0x350479[_0xe364('0x46')]);_0xc4e3ef['filters']=_[_0xe364('0xcd')](_0xc4e3ef[_0xe364('0xc9')],_0xc4e3ef[_0xe364('0x46')]);_0x27a0fb['attributes']=_[_0xe364('0xcd')](_0xc4e3ef[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x350479[_0xe364('0x46')][_0xe364('0xce')]));_0x27a0fb[_0xe364('0x4c')]=_0x27a0fb[_0xe364('0x4c')][_0xe364('0x6d')]?_0x27a0fb['attributes']:_0xc4e3ef['model'];_0x27a0fb[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x350479[_0xe364('0x46')][_0xe364('0xd0')]);_0x27a0fb[_0xe364('0x44')]=qs['filters'](_[_0xe364('0xd1')](_0x350479[_0xe364('0x46')],_0xc4e3ef[_0xe364('0xcc')]));if(_0x350479[_0xe364('0x46')][_0xe364('0x32')]){_0x27a0fb[_0xe364('0x44')]=_[_0xe364('0x58')](_0x27a0fb[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x27a0fb[_0xe364('0x4c')],function(_0x3712c7){var _0x339bfd={};_0x339bfd[_0x3712c7]={'$like':'%'+_0x350479[_0xe364('0x46')]['filter']+'%'};return _0x339bfd;})});}_0x27a0fb=_[_0xe364('0x58')]({},_0x27a0fb,_0x350479[_0xe364('0x59')]);return _0x1feb0e[_0xe364('0xd7')](_0x27a0fb);}})[_0xe364('0x20')](function(_0x5c1048){if(_0x5c1048){_0x4ec0fa=_0x5c1048[_0xe364('0x6d')];if(!_0x350479['query'][_0xe364('0xd6')](_0xe364('0xd3'))){_0x27a0fb[_0xe364('0x1b')]=qs['limit'](_0x350479[_0xe364('0x46')][_0xe364('0x1b')]);_0x27a0fb['offset']=qs[_0xe364('0x19')](_0x350479[_0xe364('0x46')]['offset']);}return _0x1feb0e[_0xe364('0xd7')](_0x27a0fb);}})[_0xe364('0x20')](function(_0x3972e4){if(_0x3972e4){return _0x3972e4?{'count':_0x4ec0fa,'rows':_0x3972e4}:null;}})['then'](respondWithResult(_0x51c51e,null))['catch'](handleError(_0x51c51e,null));};exports[_0xe364('0xd9')]=function(_0x3eac6f,_0x5d9b63){var _0x1d657b={'raw':!![],'where':{}};var _0x63ae4e={};var _0x1ca5a2={'count':0x0,'rows':[]};return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x3eac6f[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x5d9b63,null))[_0xe364('0x20')](function(_0x3c344a){if(_0x3c344a){_0x63ae4e[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xda')][_0xe364('0x3b')]);_0x63ae4e['query']=_['keys'](_0x3eac6f['query']);_0x63ae4e['filters']=_[_0xe364('0xcd')](_0x63ae4e[_0xe364('0xc9')],_0x63ae4e[_0xe364('0x46')]);_0x1d657b[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x63ae4e[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x3eac6f[_0xe364('0x46')]['fields']));_0x1d657b[_0xe364('0x4c')]=_0x1d657b[_0xe364('0x4c')][_0xe364('0x6d')]?_0x1d657b['attributes']:_0x63ae4e['model'];if(!_0x3eac6f['query'][_0xe364('0xd6')](_0xe364('0xd3'))){_0x1d657b[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x3eac6f['query'][_0xe364('0x1b')]);_0x1d657b['offset']=qs[_0xe364('0x19')](_0x3eac6f[_0xe364('0x46')][_0xe364('0x19')]);}_0x1d657b[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x3eac6f['query'][_0xe364('0xd0')]);_0x1d657b[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3eac6f[_0xe364('0x46')],_0x63ae4e[_0xe364('0xcc')]));_0x1d657b[_0xe364('0x44')][_0xe364('0xdb')]=_0x3c344a['id'];if(_0x3eac6f[_0xe364('0x46')][_0xe364('0x32')]){_0x1d657b[_0xe364('0x44')]=_[_0xe364('0x58')](_0x1d657b[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x1d657b[_0xe364('0x4c')],function(_0x122491){var _0x24fd9c={};_0x24fd9c[_0x122491]={'$like':'%'+_0x3eac6f[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x24fd9c;})});}_0x1d657b=_['merge']({},_0x1d657b,_0x3eac6f[_0xe364('0x59')]);return db[_0xe364('0xda')][_0xe364('0x1c')]({'where':_0x1d657b[_0xe364('0x44')]})[_0xe364('0x20')](function(_0x494a9b){_0x1ca5a2[_0xe364('0x1c')]=_0x494a9b;if(_0x3eac6f[_0xe364('0x46')][_0xe364('0x47')]){_0x1d657b[_0xe364('0x48')]=[{'all':!![]}];}return db[_0xe364('0xda')]['findAll'](_0x1d657b);})['then'](function(_0x2e7f2f){_0x1ca5a2['rows']=_0x2e7f2f;return _0x1ca5a2;});}})[_0xe364('0x20')](respondWithFilteredResult(_0x5d9b63,_0x1d657b))[_0xe364('0x5f')](handleError(_0x5d9b63,null));};exports['getScreenRecordings']=function(_0x2ede06,_0x1072be){var _0x3cfd11={'raw':!![],'where':{}};var _0x293410={};var _0x332a2b={'count':0x0,'rows':[]};return db['User'][_0xe364('0x99')]({'where':{'id':_0x2ede06[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x1072be,null))['then'](function(_0x38e1b2){if(_0x38e1b2){_0x293410[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xdc')]['rawAttributes']);_0x293410[_0xe364('0x46')]=_['keys'](_0x2ede06[_0xe364('0x46')]);_0x293410[_0xe364('0xcc')]=_['intersection'](_0x293410[_0xe364('0xc9')],_0x293410['query']);_0x3cfd11['attributes']=_[_0xe364('0xcd')](_0x293410[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x2ede06[_0xe364('0x46')][_0xe364('0xce')]));_0x3cfd11[_0xe364('0x4c')]=_0x3cfd11[_0xe364('0x4c')][_0xe364('0x6d')]?_0x3cfd11[_0xe364('0x4c')]:_0x293410['model'];if(!_0x2ede06[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x3cfd11['limit']=qs['limit'](_0x2ede06['query'][_0xe364('0x1b')]);_0x3cfd11[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x2ede06[_0xe364('0x46')]['offset']);}_0x3cfd11['order']=qs[_0xe364('0xd0')](_0x2ede06['query'][_0xe364('0xd0')]);_0x3cfd11['where']=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x2ede06['query'],_0x293410[_0xe364('0xcc')]));_0x3cfd11[_0xe364('0x44')][_0xe364('0xdb')]=_0x38e1b2['id'];if(_0x2ede06[_0xe364('0x46')]['filter']){_0x3cfd11[_0xe364('0x44')]=_[_0xe364('0x58')](_0x3cfd11[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x3cfd11[_0xe364('0x4c')],function(_0x17525d){var _0x5069d5={};_0x5069d5[_0x17525d]={'$like':'%'+_0x2ede06[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x5069d5;})});}_0x3cfd11=_[_0xe364('0x58')]({},_0x3cfd11,_0x2ede06[_0xe364('0x59')]);return db[_0xe364('0xdc')][_0xe364('0x1c')]({'where':_0x3cfd11[_0xe364('0x44')]})[_0xe364('0x20')](function(_0x2cd57e){_0x332a2b[_0xe364('0x1c')]=_0x2cd57e;if(_0x2ede06[_0xe364('0x46')][_0xe364('0x47')]){_0x3cfd11[_0xe364('0x48')]=[{'all':!![]}];}return db[_0xe364('0xdc')]['findAll'](_0x3cfd11);})[_0xe364('0x20')](function(_0x362d57){_0x332a2b[_0xe364('0x4f')]=_0x362d57;return _0x332a2b;});}})['then'](respondWithFilteredResult(_0x1072be,_0x3cfd11))[_0xe364('0x5f')](handleError(_0x1072be,null));};exports[_0xe364('0xdd')]=function(_0x3b577d,_0x2cfc75){var _0x65990d={};var _0x5e2ee1={};var _0x3e6ada;var _0x2cb1fb;return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x3b577d['params']['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x2cfc75,null))[_0xe364('0x20')](function(_0x3fa073){if(_0x3fa073){_0x3e6ada=_0x3fa073;_0x5e2ee1[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xde')]['rawAttributes']);_0x5e2ee1['query']=_[_0xe364('0xca')](_0x3b577d['query']);_0x5e2ee1[_0xe364('0xcc')]=_['intersection'](_0x5e2ee1[_0xe364('0xc9')],_0x5e2ee1['query']);_0x65990d[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x5e2ee1[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x3b577d[_0xe364('0x46')][_0xe364('0xce')]));_0x65990d[_0xe364('0x4c')]=_0x65990d['attributes'][_0xe364('0x6d')]?_0x65990d[_0xe364('0x4c')]:_0x5e2ee1[_0xe364('0xc9')];_0x65990d['order']=qs[_0xe364('0xd0')](_0x3b577d[_0xe364('0x46')][_0xe364('0xd0')]);_0x65990d['where']=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3b577d[_0xe364('0x46')],_0x5e2ee1[_0xe364('0xcc')]));if(_0x3b577d['query'][_0xe364('0x32')]){_0x65990d['where']=_[_0xe364('0x58')](_0x65990d['where'],{'$or':_[_0xe364('0x34')](_0x65990d[_0xe364('0x4c')],function(_0x5eba85){var _0x56f9cc={};_0x56f9cc[_0x5eba85]={'$like':'%'+_0x3b577d[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x56f9cc;})});}_0x65990d=_[_0xe364('0x58')]({},_0x65990d,_0x3b577d[_0xe364('0x59')]);return _0x3e6ada[_0xe364('0xdd')](_0x65990d);}})['then'](function(_0x5e1b9a){if(_0x5e1b9a){_0x2cb1fb=_0x5e1b9a[_0xe364('0x6d')];if(!_0x3b577d[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x65990d[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x3b577d['query'][_0xe364('0x1b')]);_0x65990d[_0xe364('0x19')]=qs['offset'](_0x3b577d['query']['offset']);}return _0x3e6ada[_0xe364('0xdd')](_0x65990d);}})['then'](function(_0x2c0ada){if(_0x2c0ada){return _0x2c0ada?{'count':_0x2cb1fb,'rows':_0x2c0ada}:null;}})[_0xe364('0x20')](respondWithResult(_0x2cfc75,null))[_0xe364('0x5f')](handleError(_0x2cfc75,null));};exports[_0xe364('0xdf')]=function(_0x3422f5,_0x1b657e){var _0x5878fe={};var _0xa97a35={};var _0x19bd13;var _0x19dfd1;return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x3422f5[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b657e,null))[_0xe364('0x20')](function(_0x1ac5f3){if(_0x1ac5f3){_0x19bd13=_0x1ac5f3;_0xa97a35[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xe0')][_0xe364('0x3b')]);_0xa97a35['query']=_[_0xe364('0xca')](_0x3422f5[_0xe364('0x46')]);_0xa97a35[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0xa97a35['model'],_0xa97a35[_0xe364('0x46')]);_0x5878fe[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0xa97a35[_0xe364('0xc9')],qs['fields'](_0x3422f5[_0xe364('0x46')][_0xe364('0xce')]));_0x5878fe[_0xe364('0x4c')]=_0x5878fe[_0xe364('0x4c')][_0xe364('0x6d')]?_0x5878fe['attributes']:_0xa97a35[_0xe364('0xc9')];_0x5878fe[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x3422f5[_0xe364('0x46')]['sort']);_0x5878fe[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3422f5[_0xe364('0x46')],_0xa97a35[_0xe364('0xcc')]));if(_0x3422f5[_0xe364('0x46')][_0xe364('0x32')]){_0x5878fe['where']=_[_0xe364('0x58')](_0x5878fe[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x5878fe[_0xe364('0x4c')],function(_0x389ffd){var _0x37b97c={};_0x37b97c[_0x389ffd]={'$like':'%'+_0x3422f5[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x37b97c;})});}_0x5878fe=_[_0xe364('0x58')]({},_0x5878fe,_0x3422f5['options']);return _0x19bd13[_0xe364('0xdf')](_0x5878fe);}})[_0xe364('0x20')](function(_0x118b0e){if(_0x118b0e){_0x19dfd1=_0x118b0e['length'];if(!_0x3422f5[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x5878fe[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x3422f5[_0xe364('0x46')][_0xe364('0x1b')]);_0x5878fe[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x3422f5[_0xe364('0x46')][_0xe364('0x19')]);}return _0x19bd13['getOpenchannelInteractions'](_0x5878fe);}})[_0xe364('0x20')](function(_0x26d4d0){if(_0x26d4d0){return _0x26d4d0?{'count':_0x19dfd1,'rows':_0x26d4d0}:null;}})[_0xe364('0x20')](respondWithResult(_0x1b657e,null))[_0xe364('0x5f')](handleError(_0x1b657e,null));};exports['getMailInteractions']=function(_0x515d61,_0x534af1){var _0x45b790={'raw':!![],'where':{}};var _0x3542d5={};var _0x1ba4ec={'count':0x0,'rows':[]};return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x515d61[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x534af1,null))[_0xe364('0x20')](function(_0x19e130){if(_0x19e130){_0x3542d5[_0xe364('0xc9')]=_[_0xe364('0xca')](db['MailInteraction'][_0xe364('0x3b')]);_0x3542d5[_0xe364('0x46')]=_[_0xe364('0xca')](_0x515d61[_0xe364('0x46')]);_0x3542d5[_0xe364('0xcc')]=_['intersection'](_0x3542d5[_0xe364('0xc9')],_0x3542d5[_0xe364('0x46')]);_0x45b790['attributes']=_['intersection'](_0x3542d5[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x515d61['query'][_0xe364('0xce')]));_0x45b790[_0xe364('0x4c')]=_0x45b790[_0xe364('0x4c')]['length']?_0x45b790[_0xe364('0x4c')]:_0x3542d5['model'];if(!_0x515d61[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x45b790['limit']=qs[_0xe364('0x1b')](_0x515d61[_0xe364('0x46')][_0xe364('0x1b')]);_0x45b790[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x515d61[_0xe364('0x46')]['offset']);}_0x45b790['order']=qs[_0xe364('0xd0')](_0x515d61[_0xe364('0x46')]['sort']);_0x45b790[_0xe364('0x44')]=qs['filters'](_[_0xe364('0xd1')](_0x515d61[_0xe364('0x46')],_0x3542d5[_0xe364('0xcc')]));_0x45b790[_0xe364('0x44')]['UserId']=_0x19e130['id'];if(_0x515d61[_0xe364('0x46')][_0xe364('0x32')]){_0x45b790[_0xe364('0x44')]=_[_0xe364('0x58')](_0x45b790['where'],{'$or':_[_0xe364('0x34')](_0x45b790[_0xe364('0x4c')],function(_0x14e3a1){var _0x3881ef={};_0x3881ef[_0x14e3a1]={'$like':'%'+_0x515d61[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x3881ef;})});}_0x45b790=_[_0xe364('0x58')]({},_0x45b790,_0x515d61['options']);return db[_0xe364('0xe1')][_0xe364('0x1c')]({'where':_0x45b790[_0xe364('0x44')]})[_0xe364('0x20')](function(_0x5960b7){_0x1ba4ec[_0xe364('0x1c')]=_0x5960b7;if(_0x515d61[_0xe364('0x46')][_0xe364('0x47')]){_0x45b790['include']=[{'all':!![]}];}return db['MailInteraction'][_0xe364('0x4e')](_0x45b790);})['then'](function(_0x3f8331){_0x1ba4ec['rows']=_0x3f8331;return _0x1ba4ec;});}})['then'](respondWithFilteredResult(_0x534af1,_0x45b790))[_0xe364('0x5f')](handleError(_0x534af1,null));};exports['getSmsInteractions']=function(_0x3e4a86,_0x35f2fd){var _0xd46625={};var _0x33a257={};var _0x101333;var _0x41af12;return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x3e4a86[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x35f2fd,null))[_0xe364('0x20')](function(_0x5d4753){if(_0x5d4753){_0x101333=_0x5d4753;_0x33a257['model']=_[_0xe364('0xca')](db[_0xe364('0xe2')]['rawAttributes']);_0x33a257[_0xe364('0x46')]=_['keys'](_0x3e4a86[_0xe364('0x46')]);_0x33a257[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x33a257[_0xe364('0xc9')],_0x33a257[_0xe364('0x46')]);_0xd46625[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x33a257[_0xe364('0xc9')],qs['fields'](_0x3e4a86['query']['fields']));_0xd46625[_0xe364('0x4c')]=_0xd46625[_0xe364('0x4c')][_0xe364('0x6d')]?_0xd46625[_0xe364('0x4c')]:_0x33a257[_0xe364('0xc9')];_0xd46625['order']=qs['sort'](_0x3e4a86['query']['sort']);_0xd46625[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3e4a86[_0xe364('0x46')],_0x33a257[_0xe364('0xcc')]));if(_0x3e4a86[_0xe364('0x46')][_0xe364('0x32')]){_0xd46625['where']=_[_0xe364('0x58')](_0xd46625[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0xd46625[_0xe364('0x4c')],function(_0x3623e9){var _0x94f5f7={};_0x94f5f7[_0x3623e9]={'$like':'%'+_0x3e4a86[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x94f5f7;})});}_0xd46625=_[_0xe364('0x58')]({},_0xd46625,_0x3e4a86['options']);return _0x101333[_0xe364('0xe3')](_0xd46625);}})[_0xe364('0x20')](function(_0x34d6de){if(_0x34d6de){_0x41af12=_0x34d6de[_0xe364('0x6d')];if(!_0x3e4a86[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0xd46625['limit']=qs['limit'](_0x3e4a86['query'][_0xe364('0x1b')]);_0xd46625[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x3e4a86[_0xe364('0x46')][_0xe364('0x19')]);}return _0x101333['getSmsInteractions'](_0xd46625);}})[_0xe364('0x20')](function(_0x31e95b){if(_0x31e95b){return _0x31e95b?{'count':_0x41af12,'rows':_0x31e95b}:null;}})[_0xe364('0x20')](respondWithResult(_0x35f2fd,null))[_0xe364('0x5f')](handleError(_0x35f2fd,null));};exports[_0xe364('0xe4')]=function(_0x3d425e,_0x1e9fb8){var _0x515d19={};var _0x1f1821={};var _0x7affb;var _0x225837;return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x3d425e[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x1e9fb8,null))[_0xe364('0x20')](function(_0x5823ba){if(_0x5823ba){_0x7affb=_0x5823ba;_0x1f1821[_0xe364('0xc9')]=_['keys'](db[_0xe364('0xe5')][_0xe364('0x3b')]);_0x1f1821[_0xe364('0x46')]=_[_0xe364('0xca')](_0x3d425e[_0xe364('0x46')]);_0x1f1821[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x1f1821[_0xe364('0xc9')],_0x1f1821['query']);_0x515d19[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x1f1821[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x3d425e['query'][_0xe364('0xce')]));_0x515d19[_0xe364('0x4c')]=_0x515d19['attributes'][_0xe364('0x6d')]?_0x515d19[_0xe364('0x4c')]:_0x1f1821[_0xe364('0xc9')];_0x515d19['order']=qs[_0xe364('0xd0')](_0x3d425e['query'][_0xe364('0xd0')]);_0x515d19[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3d425e[_0xe364('0x46')],_0x1f1821[_0xe364('0xcc')]));if(_0x3d425e['query'][_0xe364('0x32')]){_0x515d19[_0xe364('0x44')]=_[_0xe364('0x58')](_0x515d19[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x515d19['attributes'],function(_0x31d6ad){var _0x463e8a={};_0x463e8a[_0x31d6ad]={'$like':'%'+_0x3d425e[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x463e8a;})});}_0x515d19=_[_0xe364('0x58')]({},_0x515d19,_0x3d425e['options']);return _0x7affb[_0xe364('0xe4')](_0x515d19);}})[_0xe364('0x20')](function(_0x551022){if(_0x551022){_0x225837=_0x551022[_0xe364('0x6d')];if(!_0x3d425e[_0xe364('0x46')]['hasOwnProperty']('nolimit')){_0x515d19['limit']=qs[_0xe364('0x1b')](_0x3d425e['query'][_0xe364('0x1b')]);_0x515d19[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x3d425e[_0xe364('0x46')]['offset']);}return _0x7affb[_0xe364('0xe4')](_0x515d19);}})[_0xe364('0x20')](function(_0x2dccf4){if(_0x2dccf4){return _0x2dccf4?{'count':_0x225837,'rows':_0x2dccf4}:null;}})[_0xe364('0x20')](respondWithResult(_0x1e9fb8,null))[_0xe364('0x5f')](handleError(_0x1e9fb8,null));};exports['getWhatsappInteractions']=function(_0x5cc7d0,_0x1c46fa){var _0x721b67={};var _0xb57cf6={};var _0x258f5d;var _0x318cac;return db['User'][_0xe364('0x99')]({'where':{'id':_0x5cc7d0[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x1c46fa,null))[_0xe364('0x20')](function(_0x51bb67){if(_0x51bb67){_0x258f5d=_0x51bb67;_0xb57cf6[_0xe364('0xc9')]=_['keys'](db[_0xe364('0xe6')][_0xe364('0x3b')]);_0xb57cf6['query']=_['keys'](_0x5cc7d0['query']);_0xb57cf6[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0xb57cf6['model'],_0xb57cf6[_0xe364('0x46')]);_0x721b67['attributes']=_[_0xe364('0xcd')](_0xb57cf6[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x5cc7d0[_0xe364('0x46')][_0xe364('0xce')]));_0x721b67[_0xe364('0x4c')]=_0x721b67[_0xe364('0x4c')][_0xe364('0x6d')]?_0x721b67[_0xe364('0x4c')]:_0xb57cf6['model'];_0x721b67[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x5cc7d0[_0xe364('0x46')][_0xe364('0xd0')]);_0x721b67[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x5cc7d0[_0xe364('0x46')],_0xb57cf6[_0xe364('0xcc')]));if(_0x5cc7d0[_0xe364('0x46')]['filter']){_0x721b67[_0xe364('0x44')]=_[_0xe364('0x58')](_0x721b67[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x721b67[_0xe364('0x4c')],function(_0x425edc){var _0x32db34={};_0x32db34[_0x425edc]={'$like':'%'+_0x5cc7d0[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x32db34;})});}_0x721b67=_[_0xe364('0x58')]({},_0x721b67,_0x5cc7d0['options']);return _0x258f5d[_0xe364('0xe7')](_0x721b67);}})[_0xe364('0x20')](function(_0x2f66f9){if(_0x2f66f9){_0x318cac=_0x2f66f9['length'];if(!_0x5cc7d0[_0xe364('0x46')]['hasOwnProperty'](_0xe364('0xd3'))){_0x721b67[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x5cc7d0['query'][_0xe364('0x1b')]);_0x721b67[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x5cc7d0[_0xe364('0x46')]['offset']);}return _0x258f5d['getWhatsappInteractions'](_0x721b67);}})[_0xe364('0x20')](function(_0x5196f5){if(_0x5196f5){return _0x5196f5?{'count':_0x318cac,'rows':_0x5196f5}:null;}})[_0xe364('0x20')](respondWithResult(_0x1c46fa,null))[_0xe364('0x5f')](handleError(_0x1c46fa,null));};exports['login']=function(_0x3ecbcb,_0x594dd8,_0x3e5b15){var _0x24ff88;var _0x436512;var _0x4e8877;var _0x5ad694=!_[_0xe364('0x67')](_0x3ecbcb['params']['id'])?_0x3ecbcb[_0xe364('0x57')]['id']:!_[_0xe364('0x67')](_0x3ecbcb['user']['id'])?_0x3ecbcb[_0xe364('0x2f')]['id']:null;return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x5ad694,'role':{'$or':[_0xe364('0x2d'),'user','agent']}},'attributes':['id','name',_0xe364('0xe8'),_0xe364('0xe9'),_0xe364('0x28'),_0xe364('0x62'),_0xe364('0xea')]})[_0xe364('0x20')](function(_0x369be4){if(_0x369be4){if(_0x369be4[_0xe364('0x28')]==='agent'){_0x24ff88=_0x369be4;if(_0x3ecbcb[_0xe364('0x5d')][_0xe364('0xa1')]){_0x4e8877=util[_0xe364('0xae')](_0xe364('0xeb'),_0x24ff88[_0x3ecbcb['body'][_0xe364('0xa1')]]);}else if(_0x3ecbcb['body'][_0xe364('0xec')]){_0x4e8877=util['format']('SIP/%s',_0x3ecbcb[_0xe364('0x5d')][_0xe364('0xec')]);}else{_0x4e8877=util['format'](_0xe364('0xaf'),_0x24ff88[_0xe364('0x38')]);}socket['to'](util[_0xe364('0xae')]('user:%s',_0x24ff88[_0xe364('0x38')]))['emit'](_0xe364('0xed'),{'user':{'id':_0x24ff88['id'],'name':_0x24ff88[_0xe364('0x38')]},'ip':_0x3ecbcb['headers'][_0xe364('0xee')]||_0x3ecbcb[_0xe364('0xef')][_0xe364('0xf0')]||_0x3ecbcb[_0xe364('0xf1')][_0xe364('0xf0')]||_0x3ecbcb[_0xe364('0xef')][_0xe364('0xf1')][_0xe364('0xf0')]});return db[_0xe364('0xd5')][_0xe364('0x2c')]({'where':{'membername':_0x24ff88[_0xe364('0x38')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xe364('0x94'))](_0xe364('0xf2'));}})[_0xe364('0x20')](function(){if(_0x24ff88){return _0x24ff88['getVoiceQueues']({'raw':!![]});}})['then'](function(_0xfb4469){if(_0x24ff88){if(_0xfb4469){_0x436512=_0xfb4469;if(_0x436512[_0xe364('0x6d')]){var _0x32f193=_0x436512['map'](function(_0x811402){var _0x362cad={'membername':_0x24ff88['name'],'UserId':_0x24ff88['id'],'queue_name':_0x811402['name'],'VoiceQueueId':_0x811402['id'],'interface':_0x4e8877,'paused':_0x24ff88[_0xe364('0xea')]||![],'penalty':_0x811402[_0xe364('0xf3')]||0x0};return db[_0xe364('0xd5')][_0xe364('0xb0')](_0x362cad);});return Promise['all'](_0x32f193);}}}})['then'](function(){if(_0x24ff88){return db[_0xe364('0xf4')][_0xe364('0x4e')]({'where':{'membername':_0x24ff88[_0xe364('0x38')],'exitAt':null}});}})[_0xe364('0x20')](function(_0x4aedd0){if(_0x24ff88){var _0x3c7002=[];_0x4aedd0[_0xe364('0xf5')](function(_0x5503d9){_0x3c7002['push'](_0x5503d9[_0xe364('0x5c')]({'exitAt':moment()[_0xe364('0xae')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xe364('0x8c')](_0x3c7002);}})['then'](function(){if(_0x24ff88){var _0x3347ec=[];var _0x160e92=[];var _0x332dcf=utils[_0xe364('0xf6')]();var _0x14de76={'membername':_0x24ff88[_0xe364('0x38')],'interface':_0x4e8877,'enterAt':moment()[_0xe364('0xae')](_0xe364('0xf7')),'role':_0x24ff88[_0xe364('0x28')],'internal':_0x24ff88[_0xe364('0x62')]};_0x332dcf[_0xe364('0xf5')](function(_0x31202b){_0x3347ec[_0xe364('0x4d')](_[_0xe364('0x58')]({'channel':_0x31202b,'type':_0xe364('0xf8'),'data1':_0x3ecbcb[_0xe364('0x5d')][_0xe364('0xf9')],'data2':_0x4e8877},_0x14de76));if(_0x24ff88['loginInPause']){_0x160e92[_0xe364('0x4d')](_['merge']({'channel':_0x31202b,'type':_0xe364('0xfa'),'data1':_0xe364('0xfb')},_0x14de76));}});return db[_0xe364('0xf4')][_0xe364('0x89')](_0x3347ec[_0xe364('0xc1')](_0x160e92),{'individualHooks':!![]});}})['then'](function(){if(_0x24ff88){return _0x24ff88[_0xe364('0x5c')]({'online':!![],'lastLoginAt':moment()[_0xe364('0xae')](_0xe364('0xf7')),'voicePause':_0x24ff88[_0xe364('0xea')]||![],'mailPause':_0x24ff88[_0xe364('0xea')]||![],'chatPause':_0x24ff88[_0xe364('0xea')]||![],'faxPause':_0x24ff88[_0xe364('0xea')]||![],'smsPause':_0x24ff88[_0xe364('0xea')]||![],'openchannelPause':_0x24ff88[_0xe364('0xea')]||![],'whatsappPause':_0x24ff88[_0xe364('0xea')]||![],'pauseType':_0x24ff88[_0xe364('0xea')]?_0xe364('0xfb'):null,'interface':_0x4e8877,'lastPauseAt':moment()[_0xe364('0xae')](_0xe364('0xf7'))});}})[_0xe364('0x20')](function(_0x13b807){if(_0x3ecbcb[_0xe364('0xfc')]){return _0x3e5b15();}else{return Promise[_0xe364('0xfd')](_0x13b807)[_0xe364('0x20')](respondWithResult(_0x594dd8,null));}})[_0xe364('0x5f')](handleError(_0x594dd8,null));};exports[_0xe364('0xfe')]=function(_0x372c1a,_0x409743){var _0x384c4f;return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x372c1a[_0xe364('0x57')]['id'],'role':_0xe364('0x29')},'attributes':['id',_0xe364('0x38'),_0xe364('0x28')]})[_0xe364('0x20')](handleEntityNotFound(_0x409743,null))[_0xe364('0x20')](function(_0x1c1c4f){if(_0x1c1c4f){_0x384c4f=_0x1c1c4f;return db[_0xe364('0xd5')][_0xe364('0x2c')]({'where':{'membername':_0x384c4f['name']},'individualHooks':!![]});}})[_0xe364('0x20')](function(){return db[_0xe364('0xf4')][_0xe364('0x4e')]({'where':{'membername':_0x384c4f[_0xe364('0x38')],'exitAt':null}});})[_0xe364('0x20')](function(_0x3c4b83){var _0x3644a4=[];_0x3c4b83[_0xe364('0xf5')](function(_0x5b4b61){_0x3644a4[_0xe364('0x4d')](_0x5b4b61['update']({'exitAt':moment()[_0xe364('0xae')](_0xe364('0xf7'))}));});return Promise[_0xe364('0x8c')](_0x3644a4);})[_0xe364('0x20')](function(){return _0x384c4f[_0xe364('0x5c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe364('0x20')](respondWithResult(_0x409743,null))[_0xe364('0x5f')](handleError(_0x409743,null));};exports[_0xe364('0xff')]=function(_0x25e870,_0x4edb9b){var _0x1f8384;return db['UserVoiceQueueRt'][_0xe364('0x5c')]({'paused':0x1},{'where':{'UserId':_0x25e870['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x25e870['params']['id'],'role':_0xe364('0x29')},'attributes':['id','name',_0xe364('0x28'),_0xe364('0x62'),_0xe364('0xa1'),_0xe364('0xa0')]});})[_0xe364('0x20')](handleEntityNotFound(_0x4edb9b,null))[_0xe364('0x20')](function(_0x4bcbda){if(_0x4bcbda){_0x1f8384=_0x4bcbda;return respondWithRpcPromise(_0xe364('0x100'),_0xe364('0xff'),{'id':_0x1f8384['id'],'name':_0x1f8384['name'],'pause':!![]});}})[_0xe364('0x20')](function(){if(_0x1f8384){return db[_0xe364('0xf4')][_0xe364('0x4e')]({'where':{'membername':_0x1f8384['name'],'type':'PAUSE','exitAt':null}});}})[_0xe364('0x20')](function(_0x4cb2b3){if(_0x4cb2b3[_0xe364('0x6d')]){var _0x286a20=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4c6880=0x0,_0x1deb16=_0x4cb2b3[_0xe364('0x6d')];_0x4c6880<_0x1deb16;_0x4c6880++){_0x4cb2b3[_0x4c6880][_0xe364('0x101')]({'exitAt':_0x286a20});}}})[_0xe364('0x20')](function(){var _0x558966=[];var _0x5ae94a=utils['getChannels']();_0x5ae94a[_0xe364('0xf5')](function(_0x936dab){_0x558966[_0xe364('0x4d')]({'channel':_0x936dab,'membername':_0x1f8384[_0xe364('0x38')],'interface':_[_0xe364('0x67')](_0x1f8384[_0xe364('0xa1')])?util[_0xe364('0xae')](_0xe364('0xaf'),_0x1f8384['name']):_0x1f8384[_0xe364('0xa1')],'type':_0xe364('0xfa'),'enterAt':moment()['format'](_0xe364('0xf7')),'data1':_0x25e870[_0xe364('0x5d')][_0xe364('0x3c')]||_0xe364('0x102'),'role':_0x1f8384['role'],'internal':_0x1f8384[_0xe364('0x62')]});});return db[_0xe364('0xf4')][_0xe364('0x89')](_0x558966,{'individualHooks':!![]});})[_0xe364('0x20')](function(){return _0x1f8384[_0xe364('0x5c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x25e870['body'][_0xe364('0x3c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xe364('0xae')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xe364('0x20')](respondWithResult(_0x4edb9b,null))['catch'](handleError(_0x4edb9b,null));};exports[_0xe364('0x103')]=function(_0xf2b925,_0x2178da){if(_0xf2b925[_0xe364('0x5d')][_0xe364('0x9f')]&&!utils[_0xe364('0xb1')](_0xf2b925['body']['channel'])){throw new APIBadRequestError(util[_0xe364('0xae')](_0xe364('0x104'),_0xf2b925[_0xe364('0x5d')][_0xe364('0x9f')]));}return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0xf2b925[_0xe364('0x57')]['id']},'attributes':['id',_0xe364('0x38'),_0xe364('0x28'),_0xe364('0x62'),_0xe364('0xa1'),_0xe364('0xa0'),_0xe364('0x105'),_0xe364('0x106'),_0xe364('0x107'),_0xe364('0x108'),_0xe364('0x109'),_0xe364('0x10a'),_0xe364('0x10b'),_0xe364('0x10c'),_0xe364('0x10d')]})['then'](function(_0x216bcd){if(!_0x216bcd){throw new APINotFoundError(util['format'](_0xe364('0xc3'),_0xf2b925[_0xe364('0x57')]['id']));}return _0x216bcd[_0xe364('0x103')](_0xf2b925['body']['channel']);})[_0xe364('0x20')](respondWithResult(_0x2178da,null))[_0xe364('0x5f')](APIHandleError(_0x2178da));};exports[_0xe364('0x10e')]=function(_0x3ecb23,_0x584f92){var _0x4d5089={};var _0x120736={};var _0x443ccd;var _0x97b9f3;return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x3ecb23[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x584f92,null))[_0xe364('0x20')](function(_0x284d48){if(_0x284d48){_0x443ccd=_0x284d48;_0x120736[_0xe364('0xc9')]=_['keys'](db['Team'][_0xe364('0x3b')]);_0x120736[_0xe364('0x46')]=_[_0xe364('0xca')](_0x3ecb23[_0xe364('0x46')]);_0x120736[_0xe364('0xcc')]=_['intersection'](_0x120736[_0xe364('0xc9')],_0x120736['query']);_0x4d5089[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x120736['model'],qs[_0xe364('0xce')](_0x3ecb23[_0xe364('0x46')][_0xe364('0xce')]));_0x4d5089[_0xe364('0x4c')]=_0x4d5089['attributes'][_0xe364('0x6d')]?_0x4d5089[_0xe364('0x4c')]:_0x120736[_0xe364('0xc9')];_0x4d5089['order']=qs['sort'](_0x3ecb23[_0xe364('0x46')][_0xe364('0xd0')]);_0x4d5089['where']=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3ecb23[_0xe364('0x46')],_0x120736[_0xe364('0xcc')]));if(_0x3ecb23['query'][_0xe364('0x32')]){_0x4d5089[_0xe364('0x44')]=_['merge'](_0x4d5089['where'],{'$or':_[_0xe364('0x34')](_0x4d5089[_0xe364('0x4c')],function(_0xf976b4){var _0x475be7={};_0x475be7[_0xf976b4]={'$like':'%'+_0x3ecb23[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x475be7;})});}_0x4d5089=_[_0xe364('0x58')]({},_0x4d5089,_0x3ecb23[_0xe364('0x59')]);return _0x443ccd[_0xe364('0x10e')](_0x4d5089);}})[_0xe364('0x20')](function(_0x933216){if(_0x933216){_0x97b9f3=_0x933216['length'];if(!_0x3ecb23[_0xe364('0x46')]['hasOwnProperty'](_0xe364('0xd3'))){_0x4d5089[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x3ecb23['query'][_0xe364('0x1b')]);_0x4d5089[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x3ecb23['query'][_0xe364('0x19')]);}return _0x443ccd['getTeams'](_0x4d5089);}})['then'](function(_0x28dfbe){if(_0x28dfbe){return _0x28dfbe?{'count':_0x97b9f3,'rows':_0x28dfbe}:null;}})[_0xe364('0x20')](respondWithResult(_0x584f92,null))[_0xe364('0x5f')](handleError(_0x584f92,null));};exports[_0xe364('0x10f')]=function(_0x2189ff,_0x1b91c5){var _0x48484b=_0x2189ff['params']['id'];var _0x1d0790=_0x2189ff[_0xe364('0x5d')]?_0x2189ff[_0xe364('0x5d')]['ids']:null;var _0x3c30da=[];return Promise['resolve']()['then'](function(){if(!_0x1d0790)throw new APIBadRequestError(_0xe364('0x110'));})[_0xe364('0x20')](function(){return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x48484b}});})[_0xe364('0x20')](function(_0x3a5a4a){if(!_0x3a5a4a)throw new APINotFoundError(util[_0xe364('0xae')](_0xe364('0xc3'),_0x2189ff[_0xe364('0x57')]['id']));return db['sequelize'][_0xe364('0x111')](function(_0x5ccb82){return _0x3a5a4a[_0xe364('0x10f')](_0x1d0790,{'transaction':_0x5ccb82})[_0xe364('0x20')](function(){return db[_0xe364('0x112')]['findAll']({'where':{'id':{'$in':_0x1d0790}}});})[_0xe364('0x20')](function(_0x54aa52){var _0x2f53a3=_[_0xe364('0x34')](_0x54aa52,function(_0x17bb49){return _0x17bb49[_0xe364('0x113')]();});return Promise[_0xe364('0x8c')](_0x2f53a3);})[_0xe364('0x20')](function(_0x5f1e57){_0x3c30da=_['flattenDeep'](_0x5f1e57);var _0x3dea54=_[_0xe364('0x34')](_0x3c30da,function(_0x3a1f22){return _0x3a1f22['addAgent'](_0x3a5a4a['id'],{'transaction':_0x5ccb82});});return Promise['all'](_0x3dea54);})['then'](function(){if(!_0x3a5a4a[_0xe364('0xa0')])return;var _0x4a36f6=_[_0xe364('0x32')](_0x3c30da,function(_0x263ddd){return _0x263ddd[_0xe364('0x114')](_0xe364('0x9f'))===_0xe364('0x115');});var _0x1391f9=_['map'](_0x4a36f6,function(_0xa2dd6e){return db[_0xe364('0xd5')]['upsert']({'membername':_0x3a5a4a['name'],'UserId':_0x3a5a4a['id'],'queue_name':_0xa2dd6e[_0xe364('0x38')],'VoiceQueueId':_0xa2dd6e['id'],'interface':_[_0xe364('0x67')](_0x3a5a4a[_0xe364('0xa1')])?util[_0xe364('0xae')](_0xe364('0xaf'),_0x3a5a4a['name']):_0x3a5a4a[_0xe364('0xa1')],'paused':_0x3a5a4a[_0xe364('0x105')]||![],'penalty':_0x3a5a4a[_0xe364('0xa6')]},{'transaction':_0x5ccb82});});return Promise[_0xe364('0x8c')](_0x1391f9);})[_0xe364('0x20')](function(){return db[_0xe364('0x116')][_0xe364('0x4e')]({'where':{'teamId':{'$in':_0x1d0790}}});})[_0xe364('0x20')](function(_0x4b3c5e){var _0xfe3375=_[_0xe364('0x34')](_0x4b3c5e,function(_0xbd7cb0){return db[_0xe364('0x117')][_0xe364('0x80')]({'UserId':_0x3a5a4a['id'],'VoicePrefixId':_0xbd7cb0[_0xe364('0x118')]},{'transaction':_0x5ccb82});});return Promise[_0xe364('0x8c')](_0xfe3375);});});})[_0xe364('0x20')](function(){for(var _0x2f1280=0x0;_0x2f1280<_0x3c30da['length'];_0x2f1280++){var _0x2104f5=_0x3c30da[_0x2f1280][_0xe364('0x114')](_0xe364('0x9f'));var _0x25f5d0=_0x2104f5+'QueueId';socket[_0xe364('0x2a')](_0xe364('0x2f')+_0x2104f5+_0xe364('0xaa'),{'UserId':_0x48484b,['queueField']:_0x3c30da[_0x2f1280]['id']});}})[_0xe364('0x20')](respondWithStatusCode(_0x1b91c5,null))[_0xe364('0x5f')](APIHandleError(_0x1b91c5));};exports[_0xe364('0x119')]=function(_0x3721cf,_0x1f6d29){var _0x22c763=_0x3721cf['params']['id'];var _0x11ee82=null;if(_0x3721cf[_0xe364('0x46')][_0xe364('0x61')]){_0x11ee82=_[_0xe364('0x11a')](_0x3721cf['query'][_0xe364('0x61')])?_0x3721cf['query']['ids']:[_0x3721cf[_0xe364('0x46')][_0xe364('0x61')]];}var _0x23f5aa=[];return Promise['resolve']()['then'](function(){if(!_0x11ee82)throw new APIBadRequestError(_0xe364('0x11b'));})[_0xe364('0x20')](function(){return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x22c763}});})[_0xe364('0x20')](function(_0x4a0f73){if(!_0x4a0f73)throw new APINotFoundError(util['format'](_0xe364('0xc3'),_0x3721cf['params']['id']));return db[_0xe364('0x69')]['transaction'](function(_0x246a2e){return _0x4a0f73[_0xe364('0x119')](_0x11ee82,{'transaction':_0x246a2e})[_0xe364('0x20')](function(){return db[_0xe364('0x112')][_0xe364('0x4e')]({'where':{'id':{'$in':_0x11ee82}}});})[_0xe364('0x20')](function(_0x3ed7bf){var _0xa90c31=_['map'](_0x3ed7bf,function(_0x2e35f9){return _0x2e35f9[_0xe364('0x113')]();});return Promise[_0xe364('0x8c')](_0xa90c31);})['then'](function(_0x5c08cb){_0x23f5aa=_[_0xe364('0x11c')](_0x5c08cb);var _0x22ba70=_[_0xe364('0x34')](_0x23f5aa,function(_0x33f9d7){return _0x33f9d7[_0xe364('0x11d')](_0x4a0f73['id'],{'transaction':_0x246a2e});});return Promise['all'](_0x22ba70);})['then'](function(){if(!_0x4a0f73[_0xe364('0xa0')])return;var _0x5bb17e=_[_0xe364('0x32')](_0x23f5aa,function(_0x235a6e){return _0x235a6e[_0xe364('0x114')](_0xe364('0x9f'))===_0xe364('0x115');});var _0x2626b2=_[_0xe364('0x34')](_0x5bb17e,function(_0x15690a){return db['UserVoiceQueueRt'][_0xe364('0x2c')]({'where':{'VoiceQueueId':_0x15690a['id'],'UserId':_0x4a0f73['id']},'transaction':_0x246a2e});});return Promise[_0xe364('0x8c')](_0x2626b2);})['then'](function(){return db['TeamVoicePrefix'][_0xe364('0x4e')]({'where':{'teamId':{'$in':_0x11ee82}}});})['then'](function(_0x2f4cc8){var _0x811d9b=_[_0xe364('0x34')](_0x2f4cc8,function(_0x3a0a5d){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x4a0f73['id'],'VoicePrefixId':_0x3a0a5d[_0xe364('0x118')]}},{'transaction':_0x246a2e});});return Promise['all'](_0x811d9b);});});})[_0xe364('0x20')](function(){for(var _0x10c6a4=0x0;_0x10c6a4<_0x23f5aa[_0xe364('0x6d')];_0x10c6a4++){var _0x47f60f=_0x23f5aa[_0x10c6a4][_0xe364('0x114')](_0xe364('0x9f'));var _0x3d726a=_0x47f60f+'QueueId';socket[_0xe364('0x2a')](_0xe364('0x2f')+_0x47f60f+'Queue:remove',{'UserId':_0x22c763,['queueField']:_0x23f5aa[_0x10c6a4]['id']});}})[_0xe364('0x20')](respondWithStatusCode(_0x1f6d29,null))['catch'](APIHandleError(_0x1f6d29));};exports['getLists']=function(_0x27bdd1,_0x5e90ae){var _0x3e025a={};var _0x14c44d={};var _0x529828;var _0x2e8ed8;return db['User'][_0xe364('0x99')]({'where':{'id':_0x27bdd1[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x5e90ae,null))[_0xe364('0x20')](function(_0x43fc1c){if(_0x43fc1c){_0x529828=_0x43fc1c;_0x14c44d[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xc4')][_0xe364('0x3b')]);_0x14c44d[_0xe364('0x46')]=_[_0xe364('0xca')](_0x27bdd1['query']);_0x14c44d[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x14c44d['model'],_0x14c44d[_0xe364('0x46')]);_0x3e025a[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x14c44d[_0xe364('0xc9')],qs['fields'](_0x27bdd1[_0xe364('0x46')][_0xe364('0xce')]));_0x3e025a[_0xe364('0x4c')]=_0x3e025a[_0xe364('0x4c')]['length']?_0x3e025a['attributes']:_0x14c44d[_0xe364('0xc9')];_0x3e025a[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x27bdd1[_0xe364('0x46')][_0xe364('0xd0')]);_0x3e025a[_0xe364('0x44')]=qs['filters'](_[_0xe364('0xd1')](_0x27bdd1[_0xe364('0x46')],_0x14c44d[_0xe364('0xcc')]));if(_0x27bdd1[_0xe364('0x46')][_0xe364('0x32')]){_0x3e025a[_0xe364('0x44')]=_['merge'](_0x3e025a[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x3e025a['attributes'],function(_0x563b15){var _0x5d429e={};_0x5d429e[_0x563b15]={'$like':'%'+_0x27bdd1[_0xe364('0x46')]['filter']+'%'};return _0x5d429e;})});}_0x3e025a=_[_0xe364('0x58')]({},_0x3e025a,_0x27bdd1[_0xe364('0x59')]);return _0x529828[_0xe364('0x11e')](_0x3e025a);}})['then'](function(_0x42f255){if(_0x42f255){_0x2e8ed8=_0x42f255[_0xe364('0x6d')];if(!_0x27bdd1[_0xe364('0x46')][_0xe364('0xd6')]('nolimit')){_0x3e025a['limit']=qs[_0xe364('0x1b')](_0x27bdd1[_0xe364('0x46')][_0xe364('0x1b')]);_0x3e025a['offset']=qs['offset'](_0x27bdd1['query'][_0xe364('0x19')]);}return _0x529828['getLists'](_0x3e025a);}})[_0xe364('0x20')](function(_0x4194cc){if(_0x4194cc){return _0x4194cc?{'count':_0x2e8ed8,'rows':_0x4194cc}:null;}})['then'](respondWithResult(_0x5e90ae,null))[_0xe364('0x5f')](handleError(_0x5e90ae,null));};exports[_0xe364('0x11f')]=function(_0x27867d,_0x5e9eec){var _0x2cdf2b={};var _0x3e9f9f={};var _0x1b7b27;return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x27867d[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x5e9eec,null))[_0xe364('0x20')](function(_0x5ecfaa){if(_0x5ecfaa){_0x1b7b27=_0x5ecfaa;_0x3e9f9f[_0xe364('0xc9')]=_['keys'](db[_0xe364('0x45')][_0xe364('0x3b')]);_0x3e9f9f[_0xe364('0x46')]=_[_0xe364('0xca')](_0x27867d[_0xe364('0x46')]);_0x3e9f9f[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x3e9f9f[_0xe364('0xc9')],_0x3e9f9f[_0xe364('0x46')]);_0x2cdf2b[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x3e9f9f['model'],qs[_0xe364('0xce')](_0x27867d[_0xe364('0x46')][_0xe364('0xce')]));_0x2cdf2b[_0xe364('0x4c')]=_0x2cdf2b[_0xe364('0x4c')][_0xe364('0x6d')]?_0x2cdf2b['attributes']:_0x3e9f9f['model'];_0x2cdf2b[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x27867d[_0xe364('0x46')][_0xe364('0xd0')]);_0x2cdf2b[_0xe364('0x44')]=qs['filters'](_[_0xe364('0xd1')](_0x27867d['query'],_0x3e9f9f['filters']));if(_0x27867d[_0xe364('0x46')][_0xe364('0x32')]){_0x2cdf2b[_0xe364('0x44')]=_[_0xe364('0x58')](_0x2cdf2b['where'],{'$or':_[_0xe364('0x34')](_0x2cdf2b[_0xe364('0x4c')],function(_0x1c6ec3){var _0x21221e={};_0x21221e[_0x1c6ec3]={'$like':'%'+_0x27867d[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x21221e;})});}_0x2cdf2b[_0xe364('0xc9')]=db[_0xe364('0x45')];_0x2cdf2b['as']='Agents';_0x2cdf2b=_[_0xe364('0x58')]({},_0x2cdf2b,_0x27867d['options']);return _0x1b7b27[_0xe364('0x120')]({'include':[_0x2cdf2b]});}})[_0xe364('0x20')](function(_0x4ae2d4){if(_0x4ae2d4){var _0x182b1c={},_0x5d1797=[];for(var _0xfebea7=0x0;_0xfebea7<_0x4ae2d4[_0xe364('0x6d')];_0xfebea7+=0x1){for(var _0x50a3a8=0x0,_0x45f244;_0x50a3a8<_0x4ae2d4[_0xfebea7][_0xe364('0x30')][_0xe364('0x6d')];_0x50a3a8+=0x1){_0x45f244=_0x4ae2d4[_0xfebea7][_0xe364('0x30')][_0x50a3a8][_0xe364('0xad')]({'plain':!![]});_0x182b1c[_0x45f244['id']]=_0x45f244;}}_0x182b1c=_[_0xe364('0x121')](_0x182b1c);for(var _0x18b1ba=qs[_0xe364('0x19')](_0x27867d[_0xe364('0x46')]['offset']);_0x18b1ba<_0x182b1c[_0xe364('0x6d')]&&_0x5d1797[_0xe364('0x6d')]=_0x456aad['agents']){throw new Error(_0x6115('0x4d'));}})[_0x6115('0x16')](function(){if(_0x15aa7d){return db[_0x6115('0x25')]['destroy']({'where':{'membername':_0x15aa7d['name']},'individualHooks':!![]});}})[_0x6115('0x16')](function(){if(_0x15aa7d){return _0x15aa7d[_0x6115('0x4e')]({'raw':!![]});}})[_0x6115('0x16')](function(_0x3aa805){if(_0x15aa7d){if(_0x3aa805){var _0x382d79=[];_0x5c4011=_0x3aa805;if(_0x5c4011[_0x6115('0x2a')]){for(var _0x828059=0x0;_0x828059<_0x5c4011[_0x6115('0x2a')];_0x828059++){_0x382d79['push'](db['UserVoiceQueueRt'][_0x6115('0x4f')]({'membername':_0x15aa7d[_0x6115('0x28')],'UserId':_0x15aa7d['id'],'queue_name':_0x5c4011[_0x828059][_0x6115('0x28')],'VoiceQueueId':_0x5c4011[_0x828059]['id'],'interface':_0x248a86,'paused':_0x15aa7d['loginInPause']||![],'penalty':_0x5c4011[_0x828059]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x6115('0x44')](_0x382d79);}}}})[_0x6115('0x16')](function(){if(_0x15aa7d){return db['MemberReport'][_0x6115('0xd')]({'where':{'membername':_0x15aa7d[_0x6115('0x28')],'exitAt':null}});}})[_0x6115('0x16')](function(_0x334624){if(_0x15aa7d){if(_0x334624&&_0x334624['length']){var _0x20e51=[];_0x334624[_0x6115('0x2c')](function(_0x2a64ae){_0x20e51[_0x6115('0x2d')](_0x2a64ae['update']({'exitAt':moment()[_0x6115('0x23')](_0x6115('0x43'))}));});return BPromise['all'](_0x20e51);}}})[_0x6115('0x16')](function(){if(_0x15aa7d){var _0x291049=[];var _0x14b806=[];var _0x281df6=utils[_0x6115('0x50')]();var _0x32f6c3={'membername':_0x15aa7d[_0x6115('0x28')],'interface':_0x248a86,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x15aa7d[_0x6115('0x20')],'internal':_0x15aa7d['internal']};_0x281df6[_0x6115('0x2c')](function(_0x4d2a6d){_0x291049['push'](_['merge']({'channel':_0x4d2a6d,'type':'LOGIN','data1':_0x6115('0x51'),'data2':_0x248a86},_0x32f6c3));if(_0x15aa7d[_0x6115('0x48')]){_0x14b806['push'](_[_0x6115('0x52')]({'channel':_0x4d2a6d,'type':_0x6115('0x29'),'data1':_0x6115('0x53')},_0x32f6c3));}});return db[_0x6115('0x27')][_0x6115('0x33')](_0x291049['concat'](_0x14b806),{'individualHooks':!![]});}})[_0x6115('0x16')](function(){if(_0x15aa7d){return _0x15aa7d['update']({'online':!![],'lastLoginAt':moment()[_0x6115('0x23')](_0x6115('0x43')),'voicePause':_0x15aa7d[_0x6115('0x48')]||![],'mailPause':_0x15aa7d['loginInPause']||![],'chatPause':_0x15aa7d[_0x6115('0x48')]||![],'faxPause':_0x15aa7d[_0x6115('0x48')]||![],'smsPause':_0x15aa7d[_0x6115('0x48')]||![],'openchannelPause':_0x15aa7d[_0x6115('0x48')]||![],'pauseType':_0x15aa7d['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x6115('0x43')),'interface':_0x248a86});}})[_0x6115('0x16')](function(_0x53bad0){_0x1a0d19(_0x53bad0);})['catch'](function(_0x45dbab){_0x17b865(_0x158be0[_0x6115('0x1a')](0x1f4,_0x45dbab[_0x6115('0x1b')]));});});}; \ No newline at end of file +var _0x6e6f=['getVoiceQueues','upsert','UserVoiceQueue.penalty','all','LOGIN','callysquare','merge','bulkCreate','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','redis','./user.socket','register','GetUser','User','findAll','options','raw','attributes','limit','map','include','model','then','info','debug','stringify','error','message','find','ShowUser','catch','PauseUser','where','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','MemberReport','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','SIP/%s','PAUSE','body','DEFAULT\x20PAUSE','uniqueid','type','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','params','system','LogoutUser','findOne','push','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x6e6f,0x1c2));var _0xf6e6=function(_0x325654,_0x4e6fe1){_0x325654=_0x325654-0x0;var _0x994fc7=_0x6e6f[_0x325654];return _0x994fc7;};'use strict';var _=require(_0xf6e6('0x0'));var util=require(_0xf6e6('0x1'));var moment=require(_0xf6e6('0x2'));var BPromise=require(_0xf6e6('0x3'));var Redis=require(_0xf6e6('0x4'));var db=require(_0xf6e6('0x5'))['db'];var utils=require(_0xf6e6('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');config[_0xf6e6('0x7')]=_['defaults'](config[_0xf6e6('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6e6('0x7')]));require(_0xf6e6('0x8'))[_0xf6e6('0x9')](socket);exports[_0xf6e6('0xa')]=function(_0x4c3e7e){var _0x4de841=this;return new Promise(function(_0x32155d,_0x6d1d10){return db[_0xf6e6('0xb')][_0xf6e6('0xc')]({'raw':_0x4c3e7e['options']?_0x4c3e7e[_0xf6e6('0xd')][_0xf6e6('0xe')]===undefined?!![]:![]:!![],'where':_0x4c3e7e[_0xf6e6('0xd')]?_0x4c3e7e['options']['where']||null:null,'attributes':_0x4c3e7e['options']?_0x4c3e7e[_0xf6e6('0xd')][_0xf6e6('0xf')]||null:null,'limit':_0x4c3e7e[_0xf6e6('0xd')]?_0x4c3e7e['options'][_0xf6e6('0x10')]||null:null,'include':_0x4c3e7e[_0xf6e6('0xd')]?_0x4c3e7e[_0xf6e6('0xd')]['include']?_[_0xf6e6('0x11')](_0x4c3e7e[_0xf6e6('0xd')][_0xf6e6('0x12')],function(_0x318707){return{'model':db[_0x318707['model']],'as':_0x318707['as'],'attributes':_0x318707[_0xf6e6('0xf')],'include':_0x318707[_0xf6e6('0x12')]?_[_0xf6e6('0x11')](_0x318707['include'],function(_0x24d0bb){return{'model':db[_0x24d0bb[_0xf6e6('0x13')]],'as':_0x24d0bb['as'],'attributes':_0x24d0bb['attributes'],'include':_0x24d0bb[_0xf6e6('0x12')]?_['map'](_0x24d0bb[_0xf6e6('0x12')],function(_0x499d7b){return{'model':db[_0x499d7b[_0xf6e6('0x13')]],'as':_0x499d7b['as'],'attributes':_0x499d7b[_0xf6e6('0xf')]};}):[]};}):[]};}):[]:[]})[_0xf6e6('0x14')](function(_0xdbd0ec){logger[_0xf6e6('0x15')](_0xf6e6('0xa'),_0x4c3e7e);logger[_0xf6e6('0x16')](_0xf6e6('0xa'),_0x4c3e7e,JSON[_0xf6e6('0x17')](_0xdbd0ec));_0x32155d(_0xdbd0ec);})['catch'](function(_0x1d3a60){logger[_0xf6e6('0x18')](_0xf6e6('0xa'),_0x1d3a60[_0xf6e6('0x19')],_0x4c3e7e);_0x6d1d10(_0x4de841[_0xf6e6('0x18')](0x1f4,_0x1d3a60[_0xf6e6('0x19')]));});});};exports['ShowUser']=function(_0x3d62df){var _0x39a24d=this;return new Promise(function(_0x44ff84,_0x5c4968){return db[_0xf6e6('0xb')][_0xf6e6('0x1a')]({'raw':_0x3d62df[_0xf6e6('0xd')]?_0x3d62df[_0xf6e6('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x3d62df[_0xf6e6('0xd')]?_0x3d62df['options']['where']||null:null,'attributes':_0x3d62df[_0xf6e6('0xd')]?_0x3d62df[_0xf6e6('0xd')][_0xf6e6('0xf')]||null:null,'include':_0x3d62df[_0xf6e6('0xd')]?_0x3d62df[_0xf6e6('0xd')][_0xf6e6('0x12')]?_[_0xf6e6('0x11')](_0x3d62df['options']['include'],function(_0x2ec98f){return{'model':db[_0x2ec98f['model']],'as':_0x2ec98f['as'],'attributes':_0x2ec98f[_0xf6e6('0xf')],'include':_0x2ec98f[_0xf6e6('0x12')]?_['map'](_0x2ec98f[_0xf6e6('0x12')],function(_0xfe9b58){return{'model':db[_0xfe9b58[_0xf6e6('0x13')]],'as':_0xfe9b58['as'],'attributes':_0xfe9b58[_0xf6e6('0xf')],'include':_0xfe9b58['include']?_[_0xf6e6('0x11')](_0xfe9b58[_0xf6e6('0x12')],function(_0x2b8f4b){return{'model':db[_0x2b8f4b[_0xf6e6('0x13')]],'as':_0x2b8f4b['as'],'attributes':_0x2b8f4b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x48f474){logger[_0xf6e6('0x15')]('ShowUser',_0x3d62df);logger[_0xf6e6('0x16')](_0xf6e6('0x1b'),_0x3d62df,JSON[_0xf6e6('0x17')](_0x48f474));_0x44ff84(_0x48f474);})[_0xf6e6('0x1c')](function(_0x3b2a67){logger[_0xf6e6('0x18')](_0xf6e6('0x1b'),_0x3b2a67[_0xf6e6('0x19')],_0x3d62df);_0x5c4968(_0x39a24d[_0xf6e6('0x18')](0x1f4,_0x3b2a67['message']));});});};exports[_0xf6e6('0x1d')]=function(_0x2419b4){var _0x3897bb;return db[_0xf6e6('0xb')][_0xf6e6('0x1a')]({'where':_0x2419b4[_0xf6e6('0xd')][_0xf6e6('0x1e')]||{},'attributes':['id',_0xf6e6('0x1f'),_0xf6e6('0x20'),_0xf6e6('0x21'),_0xf6e6('0x22')]})['then'](function(_0x50be5c){if(!_0x50be5c){throw new Error(util[_0xf6e6('0x23')](_0xf6e6('0x24'),_0x2419b4['params']['id']));}_0x3897bb=_0x50be5c;return db[_0xf6e6('0x25')][_0xf6e6('0x26')]({'paused':0x1},{'where':{'UserId':_0x3897bb['id']},'individualHooks':!![]});})[_0xf6e6('0x14')](function(){return db[_0xf6e6('0x27')]['findAll']({'where':{'membername':_0x3897bb[_0xf6e6('0x1f')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x169432){if(_0x169432&&_0x169432['length']){var _0x266ef=moment()['format'](_0xf6e6('0x28'));for(var _0x2bd0cd=0x0,_0x1bc6fb=_0x169432[_0xf6e6('0x29')];_0x2bd0cd<_0x1bc6fb;_0x2bd0cd++){_0x169432[_0x2bd0cd][_0xf6e6('0x2a')]({'exitAt':_0x266ef});}}})[_0xf6e6('0x14')](function(){var _0x350b2f=[];var _0x1d75e7=utils[_0xf6e6('0x2b')]();_0x1d75e7[_0xf6e6('0x2c')](function(_0x38b518){_0x350b2f['push']({'channel':_0x38b518,'membername':_0x3897bb['name'],'interface':_['isNil'](_0x3897bb[_0xf6e6('0x22')])?util[_0xf6e6('0x23')](_0xf6e6('0x2d'),_0x3897bb[_0xf6e6('0x1f')]):_0x3897bb[_0xf6e6('0x22')],'type':_0xf6e6('0x2e'),'enterAt':moment()[_0xf6e6('0x23')](_0xf6e6('0x28')),'data1':_0x2419b4[_0xf6e6('0x2f')]['type']||_0xf6e6('0x30'),'role':_0x3897bb[_0xf6e6('0x20')],'internal':_0x3897bb[_0xf6e6('0x21')],'uniqueid':_0x2419b4[_0xf6e6('0x2f')][_0xf6e6('0x31')]||null});});return db[_0xf6e6('0x27')]['bulkCreate'](_0x350b2f,{'individualHooks':!![]});})[_0xf6e6('0x14')](function(){return _0x3897bb[_0xf6e6('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2419b4[_0xf6e6('0x2f')][_0xf6e6('0x32')]||_0xf6e6('0x30'),'lastPauseAt':moment()['format'](_0xf6e6('0x28'))});})['catch'](function(_0x19e52c){throw _0x19e52c;});};exports['UnpauseUser']=function(_0x120bc1){return Promise[_0xf6e6('0x33')]()[_0xf6e6('0x14')](function(){if(_0x120bc1['body'][_0xf6e6('0x34')]&&!utils[_0xf6e6('0x35')](_0x120bc1[_0xf6e6('0x2f')][_0xf6e6('0x34')])){throw new Error(util[_0xf6e6('0x23')](_0xf6e6('0x36'),_0x120bc1['body'][_0xf6e6('0x34')]));}return db['User']['findOne']({'where':_0x120bc1[_0xf6e6('0xd')]['where']||{},'attributes':['id','name',_0xf6e6('0x20'),_0xf6e6('0x21'),_0xf6e6('0x22'),'online',_0xf6e6('0x37'),'mailPause','chatPause',_0xf6e6('0x38'),_0xf6e6('0x39'),_0xf6e6('0x3a'),_0xf6e6('0x3b'),_0xf6e6('0x3c'),_0xf6e6('0x3d')]});})[_0xf6e6('0x14')](function(_0x4e3ed4){if(!_0x4e3ed4){throw new Error(util['format'](_0xf6e6('0x24'),_0x120bc1[_0xf6e6('0x3e')]['id']));}return _0x4e3ed4['unpause'](_0x120bc1[_0xf6e6('0x2f')][_0xf6e6('0x34')],_0xf6e6('0x3f'));})[_0xf6e6('0x1c')](function(_0x4ab8fa){throw _0x4ab8fa;});};exports[_0xf6e6('0x40')]=function(_0x5f87ca){var _0x23f09c=this;return new Promise(function(_0x3a1775,_0x4224cf){var _0x52b1e7;return db[_0xf6e6('0xb')][_0xf6e6('0x41')]({'where':_0x5f87ca[_0xf6e6('0xd')][_0xf6e6('0x1e')]||{},'attributes':['id',_0xf6e6('0x1f')]})[_0xf6e6('0x14')](function(_0x3365e9){if(_0x3365e9){_0x52b1e7=_0x3365e9;return db[_0xf6e6('0x25')]['destroy']({'where':{'membername':_0x52b1e7[_0xf6e6('0x1f')]},'individualHooks':!![]});}})[_0xf6e6('0x14')](function(){if(_0x52b1e7){return db[_0xf6e6('0x27')][_0xf6e6('0xc')]({'where':{'membername':_0x52b1e7[_0xf6e6('0x1f')],'exitAt':null}});}})[_0xf6e6('0x14')](function(_0x1086ab){if(_0x52b1e7){if(_0x1086ab&&_0x1086ab[_0xf6e6('0x29')]){var _0x2e18df=[];_0x1086ab[_0xf6e6('0x2c')](function(_0x6f77f1){_0x2e18df[_0xf6e6('0x42')](_0x6f77f1[_0xf6e6('0x26')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2e18df);}}})['then'](function(){if(_0x52b1e7){return _0x52b1e7[_0xf6e6('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xf6e6('0x14')](function(_0x1483df){_0x3a1775(_0x1483df);})[_0xf6e6('0x1c')](function(_0x193e59){_0x4224cf(_0x23f09c[_0xf6e6('0x18')](0x1f4,_0x193e59[_0xf6e6('0x19')]));});});};exports[_0xf6e6('0x43')]=function(_0x4fc98b){var _0x371dca=this;return new Promise(function(_0x3e41d8,_0x3d36c0){var _0x4a5d2d;var _0x4eb827;var _0x284323;var _0x2277b2;return db[_0xf6e6('0xb')][_0xf6e6('0x41')]({'where':_0x4fc98b['options'][_0xf6e6('0x1e')]||{},'attributes':['id',_0xf6e6('0x1f'),'role',_0xf6e6('0x44'),_0xf6e6('0x45'),_0xf6e6('0x21'),_0xf6e6('0x46'),_0xf6e6('0x22')]})[_0xf6e6('0x14')](function(_0x17ab38){if(_0x17ab38){_0x4a5d2d=_0x17ab38;_0x2277b2=_0x4fc98b[_0xf6e6('0x2f')][_0xf6e6('0x22')]?_0x4fc98b[_0xf6e6('0x2f')][_0xf6e6('0x22')]:util['format']('SIP/%s',_0x4a5d2d[_0xf6e6('0x1f')]);return db[_0xf6e6('0xb')][_0xf6e6('0x47')]({'where':{'role':_0xf6e6('0x48'),'online':!![],'id':{'$ne':_0x4a5d2d['id']}}});}})[_0xf6e6('0x14')](function(_0x3d596d){if(_0x3d596d){_0x284323=_0x3d596d;return require(_0xf6e6('0x49'))[_0xf6e6('0x4a')]();}})[_0xf6e6('0x14')](function(_0x3e7d2d){if(_0x3e7d2d&&_0x3e7d2d[_0xf6e6('0x4b')]&&_0x284323>=_0x3e7d2d['agents']){throw new Error(_0xf6e6('0x4c'));}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){return db[_0xf6e6('0x25')][_0xf6e6('0x4d')]({'where':{'membername':_0x4a5d2d[_0xf6e6('0x1f')]},'individualHooks':!![]});}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){return _0x4a5d2d[_0xf6e6('0x4e')]({'raw':!![]});}})[_0xf6e6('0x14')](function(_0x202562){if(_0x4a5d2d){if(_0x202562){var _0x385cae=[];_0x4eb827=_0x202562;if(_0x4eb827[_0xf6e6('0x29')]){for(var _0x563758=0x0;_0x563758<_0x4eb827[_0xf6e6('0x29')];_0x563758++){_0x385cae[_0xf6e6('0x42')](db[_0xf6e6('0x25')][_0xf6e6('0x4f')]({'membername':_0x4a5d2d[_0xf6e6('0x1f')],'UserId':_0x4a5d2d['id'],'queue_name':_0x4eb827[_0x563758][_0xf6e6('0x1f')],'VoiceQueueId':_0x4eb827[_0x563758]['id'],'interface':_0x2277b2,'paused':_0x4a5d2d['loginInPause']||![],'penalty':_0x4eb827[_0x563758][_0xf6e6('0x50')]||0x0}));}return BPromise[_0xf6e6('0x51')](_0x385cae);}}}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){return db[_0xf6e6('0x27')][_0xf6e6('0xc')]({'where':{'membername':_0x4a5d2d[_0xf6e6('0x1f')],'exitAt':null}});}})[_0xf6e6('0x14')](function(_0x438632){if(_0x4a5d2d){if(_0x438632&&_0x438632['length']){var _0x34f9df=[];_0x438632['forEach'](function(_0x3ae0f3){_0x34f9df[_0xf6e6('0x42')](_0x3ae0f3[_0xf6e6('0x26')]({'exitAt':moment()['format'](_0xf6e6('0x28'))}));});return BPromise['all'](_0x34f9df);}}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){var _0x729d17=[];var _0x20eb0a=[];var _0x1abc12=utils['getChannels']();var _0x312a34={'membername':_0x4a5d2d[_0xf6e6('0x1f')],'interface':_0x2277b2,'enterAt':moment()['format'](_0xf6e6('0x28')),'role':_0x4a5d2d[_0xf6e6('0x20')],'internal':_0x4a5d2d[_0xf6e6('0x21')]};_0x1abc12[_0xf6e6('0x2c')](function(_0x44b5a4){_0x729d17[_0xf6e6('0x42')](_['merge']({'channel':_0x44b5a4,'type':_0xf6e6('0x52'),'data1':_0xf6e6('0x53'),'data2':_0x2277b2},_0x312a34));if(_0x4a5d2d[_0xf6e6('0x46')]){_0x20eb0a['push'](_[_0xf6e6('0x54')]({'channel':_0x44b5a4,'type':_0xf6e6('0x2e'),'data1':'LOGININPAUSE'},_0x312a34));}});return db[_0xf6e6('0x27')][_0xf6e6('0x55')](_0x729d17[_0xf6e6('0x56')](_0x20eb0a),{'individualHooks':!![]});}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){return _0x4a5d2d[_0xf6e6('0x26')]({'online':!![],'lastLoginAt':moment()[_0xf6e6('0x23')](_0xf6e6('0x28')),'voicePause':_0x4a5d2d['loginInPause']||![],'mailPause':_0x4a5d2d[_0xf6e6('0x46')]||![],'chatPause':_0x4a5d2d[_0xf6e6('0x46')]||![],'faxPause':_0x4a5d2d[_0xf6e6('0x46')]||![],'smsPause':_0x4a5d2d['loginInPause']||![],'openchannelPause':_0x4a5d2d[_0xf6e6('0x46')]||![],'pauseType':_0x4a5d2d[_0xf6e6('0x46')]?_0xf6e6('0x57'):null,'lastPauseAt':moment()[_0xf6e6('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2277b2});}})[_0xf6e6('0x14')](function(_0x559fc6){_0x3e41d8(_0x559fc6);})[_0xf6e6('0x1c')](function(_0x56e42b){_0x3d36c0(_0x371dca[_0xf6e6('0x18')](0x1f4,_0x56e42b[_0xf6e6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 9b0d8b6..a4d3dfd 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 _0xeb34=['register','length','user:','save','remove','update','emit'];(function(_0x329d86,_0x3167a7){var _0x31cf36=function(_0x59dcaf){while(--_0x59dcaf){_0x329d86['push'](_0x329d86['shift']());}};_0x31cf36(++_0x3167a7);}(_0xeb34,0x1bc));var _0x4eb3=function(_0x5c2cd5,_0x1c2fbb){_0x5c2cd5=_0x5c2cd5-0x0;var _0x5180e9=_0xeb34[_0x5c2cd5];return _0x5180e9;};'use strict';var UserEvents=require('./user.events');var events=[_0x4eb3('0x0'),_0x4eb3('0x1'),_0x4eb3('0x2')];function createListener(_0x504ca2,_0x4483be){return function(_0x2bdcaa){_0x4483be[_0x4eb3('0x3')](_0x504ca2,_0x2bdcaa);};}function removeListener(_0x4b5f06,_0x52091d){return function(){UserEvents['removeListener'](_0x4b5f06,_0x52091d);};}exports[_0x4eb3('0x4')]=function(_0x3ada8d){for(var _0x9cc2d2=0x0,_0x539be3=events[_0x4eb3('0x5')];_0x9cc2d2<_0x539be3;_0x9cc2d2++){var _0x35deda=events[_0x9cc2d2];var _0x139af1=createListener(_0x4eb3('0x6')+_0x35deda,_0x3ada8d);UserEvents['on'](_0x35deda,_0x139af1);}}; \ No newline at end of file +var _0x3cfd=['save','remove','update','emit','removeListener','length','./user.events'];(function(_0x1d8fb7,_0x2d990d){var _0x35b6ea=function(_0x550c69){while(--_0x550c69){_0x1d8fb7['push'](_0x1d8fb7['shift']());}};_0x35b6ea(++_0x2d990d);}(_0x3cfd,0xa0));var _0xd3cf=function(_0x7a7f75,_0x202c7c){_0x7a7f75=_0x7a7f75-0x0;var _0x3e3004=_0x3cfd[_0x7a7f75];return _0x3e3004;};'use strict';var UserEvents=require(_0xd3cf('0x0'));var events=[_0xd3cf('0x1'),_0xd3cf('0x2'),_0xd3cf('0x3')];function createListener(_0x101c72,_0x5a40f9){return function(_0x45a82b){_0x5a40f9[_0xd3cf('0x4')](_0x101c72,_0x45a82b);};}function removeListener(_0x231fd4,_0x3a8058){return function(){UserEvents[_0xd3cf('0x5')](_0x231fd4,_0x3a8058);};}exports['register']=function(_0x3ec6a5){for(var _0x2f8399=0x0,_0x504aa5=events[_0xd3cf('0x6')];_0x2f8399<_0x504aa5;_0x2f8399++){var _0x3bf842=events[_0x2f8399];var _0x36c199=createListener('user:'+_0x3bf842,_0x3ec6a5);UserEvents['on'](_0x3bf842,_0x36c199);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 81a8ae2..343a37a 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1a362a,_0x532d2e){var _0x1c6fc4=function(_0x57b081){while(--_0x57b081){_0x1a362a['push'](_0x1a362a['shift']());}};_0x1c6fc4(++_0x532d2e);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2d909d,_0x2e2072){var _0x40cc8d=function(_0x3733e3){while(--_0x3733e3){_0x2d909d['push'](_0x2d909d['shift']());}};_0x40cc8d(++_0x2e2072);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a6dece8..ea7cb29 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 _0xff46=['exports','INTEGER','sequelize'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xff46,0xb3));var _0x6ff4=function(_0x27bd65,_0x5407b3){_0x27bd65=_0x27bd65-0x0;var _0x5dfef=_0xff46[_0x27bd65];return _0x5dfef;};'use strict';var Sequelize=require(_0x6ff4('0x0'));module[_0x6ff4('0x1')]={'penalty':{'type':Sequelize[_0x6ff4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcaa6=['sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcaa6,0x1ad));var _0x6caa=function(_0x537d12,_0x3b0a0b){_0x537d12=_0x537d12-0x0;var _0x31bc7a=_0xcaa6[_0x537d12];return _0x31bc7a;};'use strict';var Sequelize=require(_0x6caa('0x0'));module[_0x6caa('0x1')]={'penalty':{'type':Sequelize[_0x6caa('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 21cd466..c169c5b 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 _0xfe55=['rimraf','../../config/environment','./userChatQueue.attributes','exports','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','path'];(function(_0x46afa4,_0x55f3e6){var _0x4430de=function(_0x355449){while(--_0x355449){_0x46afa4['push'](_0x46afa4['shift']());}};_0x4430de(++_0x55f3e6);}(_0xfe55,0xf7));var _0x5fe5=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0xfe55[_0x335271];return _0xa9fff8;};'use strict';var _=require('lodash');var util=require(_0x5fe5('0x0'));var logger=require(_0x5fe5('0x1'))(_0x5fe5('0x2'));var moment=require(_0x5fe5('0x3'));var BPromise=require(_0x5fe5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fe5('0x5'));var rimraf=require(_0x5fe5('0x6'));var config=require(_0x5fe5('0x7'));var attributes=require(_0x5fe5('0x8'));module[_0x5fe5('0x9')]=function(_0x5c1cbf,_0x16692e){return _0x5c1cbf['define']('UserChatQueue',attributes,{'tableName':_0x5fe5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x924e=['path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x924e,0x89));var _0xe924=function(_0xa0a64d,_0x5da164){_0xa0a64d=_0xa0a64d-0x0;var _0x5bb346=_0x924e[_0xa0a64d];return _0x5bb346;};'use strict';var _=require(_0xe924('0x0'));var util=require(_0xe924('0x1'));var logger=require(_0xe924('0x2'))(_0xe924('0x3'));var moment=require('moment');var BPromise=require(_0xe924('0x4'));var rp=require(_0xe924('0x5'));var fs=require('fs');var path=require(_0xe924('0x6'));var rimraf=require(_0xe924('0x7'));var config=require('../../config/environment');var attributes=require(_0xe924('0x8'));module[_0xe924('0x9')]=function(_0x5745a2,_0x4e1c9f){return _0x5745a2[_0xe924('0xa')](_0xe924('0xb'),attributes,{'tableName':_0xe924('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 40d484b..8e97db0 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 _0x1e49=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2a90d6,_0x4adbc0){var _0x6dba76=function(_0x18db3f){while(--_0x18db3f){_0x2a90d6['push'](_0x2a90d6['shift']());}};_0x6dba76(++_0x4adbc0);}(_0x1e49,0x71));var _0x91e4=function(_0x137453,_0x83b9d0){_0x137453=_0x137453-0x0;var _0x2f4391=_0x1e49[_0x137453];return _0x2f4391;};'use strict';var _=require(_0x91e4('0x0'));var util=require(_0x91e4('0x1'));var moment=require(_0x91e4('0x2'));var BPromise=require(_0x91e4('0x3'));var rs=require(_0x91e4('0x4'));var fs=require('fs');var Redis=require(_0x91e4('0x5'));var db=require(_0x91e4('0x6'))['db'];var utils=require(_0x91e4('0x7'));var logger=require('../../config/logger')(_0x91e4('0x8'));var config=require(_0x91e4('0x9'));var jayson=require(_0x91e4('0xa'));var client=jayson['client'][_0x91e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cf7d1,_0x544f9f,_0x1527a0){return new BPromise(function(_0x109960,_0x15e70d){return client[_0x91e4('0xc')](_0x2cf7d1,_0x1527a0)[_0x91e4('0xd')](function(_0x34b9cf){logger[_0x91e4('0xe')](_0x91e4('0xf'),_0x544f9f,_0x91e4('0x10'));logger[_0x91e4('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x544f9f,_0x91e4('0x10'),JSON[_0x91e4('0x12')](_0x34b9cf));if(_0x34b9cf[_0x91e4('0x13')]){if(_0x34b9cf['error'][_0x91e4('0x14')]===0x1f4){logger[_0x91e4('0x13')](_0x91e4('0xf'),_0x544f9f,_0x34b9cf[_0x91e4('0x13')]['message']);return _0x15e70d(_0x34b9cf[_0x91e4('0x13')][_0x91e4('0x15')]);}logger['error'](_0x91e4('0xf'),_0x544f9f,_0x34b9cf[_0x91e4('0x13')][_0x91e4('0x15')]);return _0x109960(_0x34b9cf[_0x91e4('0x13')][_0x91e4('0x15')]);}else{logger[_0x91e4('0xe')](_0x91e4('0xf'),_0x544f9f,_0x91e4('0x10'));_0x109960(_0x34b9cf[_0x91e4('0x16')][_0x91e4('0x15')]);}})[_0x91e4('0x17')](function(_0x4bbffc){logger[_0x91e4('0x13')](_0x91e4('0xf'),_0x544f9f,_0x4bbffc);_0x15e70d(_0x4bbffc);});});} \ No newline at end of file +var _0x9f57=['then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x3ac78d,_0x162f0a){var _0x5135d9=function(_0x31e741){while(--_0x31e741){_0x3ac78d['push'](_0x3ac78d['shift']());}};_0x5135d9(++_0x162f0a);}(_0x9f57,0xfc));var _0x79f5=function(_0x2162ca,_0x503cf3){_0x2162ca=_0x2162ca-0x0;var _0x116643=_0x9f57[_0x2162ca];return _0x116643;};'use strict';var _=require(_0x79f5('0x0'));var util=require(_0x79f5('0x1'));var moment=require(_0x79f5('0x2'));var BPromise=require(_0x79f5('0x3'));var rs=require(_0x79f5('0x4'));var fs=require('fs');var Redis=require(_0x79f5('0x5'));var db=require(_0x79f5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x79f5('0x7'))(_0x79f5('0x8'));var config=require('../../config/environment');var jayson=require(_0x79f5('0x9'));var client=jayson[_0x79f5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481bc4,_0x2b3563,_0x2688ac){return new BPromise(function(_0x420ee1,_0x2fc4a3){return client[_0x79f5('0xb')](_0x481bc4,_0x2688ac)[_0x79f5('0xc')](function(_0x1b7467){logger[_0x79f5('0xd')](_0x79f5('0xe'),_0x2b3563,_0x79f5('0xf'));logger[_0x79f5('0x10')](_0x79f5('0x11'),_0x2b3563,_0x79f5('0xf'),JSON[_0x79f5('0x12')](_0x1b7467));if(_0x1b7467[_0x79f5('0x13')]){if(_0x1b7467[_0x79f5('0x13')][_0x79f5('0x14')]===0x1f4){logger[_0x79f5('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x2b3563,_0x1b7467[_0x79f5('0x13')]['message']);return _0x2fc4a3(_0x1b7467[_0x79f5('0x13')][_0x79f5('0x15')]);}logger[_0x79f5('0x13')](_0x79f5('0xe'),_0x2b3563,_0x1b7467[_0x79f5('0x13')]['message']);return _0x420ee1(_0x1b7467[_0x79f5('0x13')][_0x79f5('0x15')]);}else{logger[_0x79f5('0xd')](_0x79f5('0xe'),_0x2b3563,_0x79f5('0xf'));_0x420ee1(_0x1b7467[_0x79f5('0x16')][_0x79f5('0x15')]);}})[_0x79f5('0x17')](function(_0x46e809){logger[_0x79f5('0x13')](_0x79f5('0xe'),_0x2b3563,_0x46e809);_0x2fc4a3(_0x46e809);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 523416c..d85c3a8 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4f7449,_0x407356){var _0x21e3cb=function(_0x40f623){while(--_0x40f623){_0x4f7449['push'](_0x4f7449['shift']());}};_0x21e3cb(++_0x407356);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2ee944,_0x1614aa){var _0x7e5b60=function(_0x507df7){while(--_0x507df7){_0x2ee944['push'](_0x2ee944['shift']());}};_0x7e5b60(++_0x1614aa);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 344e32f..8de31c7 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 _0x2afa=['INTEGER','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2afa,0x172));var _0xa2af=function(_0x589dfe,_0x419f19){_0x589dfe=_0x589dfe-0x0;var _0x4b208f=_0x2afa[_0x589dfe];return _0x4b208f;};'use strict';var Sequelize=require(_0xa2af('0x0'));module[_0xa2af('0x1')]={'penalty':{'type':Sequelize[_0xa2af('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0a55=['sequelize','exports','INTEGER'];(function(_0x150c1b,_0x1d683e){var _0x1fc7a7=function(_0x30d999){while(--_0x30d999){_0x150c1b['push'](_0x150c1b['shift']());}};_0x1fc7a7(++_0x1d683e);}(_0x0a55,0x1d7));var _0x50a5=function(_0xf84528,_0x1a841d){_0xf84528=_0xf84528-0x0;var _0x59f125=_0x0a55[_0xf84528];return _0x59f125;};'use strict';var Sequelize=require(_0x50a5('0x0'));module[_0x50a5('0x1')]={'penalty':{'type':Sequelize[_0x50a5('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x50a5('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4f99b73..a36b835 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 _0xdb2f=['rimraf','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','util','api','bluebird','request-promise','path'];(function(_0x2a1f57,_0xff634b){var _0x124ecd=function(_0x1ad3f9){while(--_0x1ad3f9){_0x2a1f57['push'](_0x2a1f57['shift']());}};_0x124ecd(++_0xff634b);}(_0xdb2f,0x1de));var _0xfdb2=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xdb2f[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xfdb2('0x0'));var util=require(_0xfdb2('0x1'));var logger=require('../../config/logger')(_0xfdb2('0x2'));var moment=require('moment');var BPromise=require(_0xfdb2('0x3'));var rp=require(_0xfdb2('0x4'));var fs=require('fs');var path=require(_0xfdb2('0x5'));var rimraf=require(_0xfdb2('0x6'));var config=require('../../config/environment');var attributes=require(_0xfdb2('0x7'));module[_0xfdb2('0x8')]=function(_0x367128,_0x1a7926){return _0x367128[_0xfdb2('0x9')]('UserFaxQueue',attributes,{'tableName':_0xfdb2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2435=['UserFaxQueue','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x49d21f,_0x6e7f5){var _0x1b93f2=function(_0x1cd8e7){while(--_0x1cd8e7){_0x49d21f['push'](_0x49d21f['shift']());}};_0x1b93f2(++_0x6e7f5);}(_0x2435,0x1af));var _0x5243=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x2435[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x5243('0x0'));var util=require('util');var logger=require(_0x5243('0x1'))(_0x5243('0x2'));var moment=require(_0x5243('0x3'));var BPromise=require(_0x5243('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5243('0x5'));var rimraf=require(_0x5243('0x6'));var config=require(_0x5243('0x7'));var attributes=require(_0x5243('0x8'));module['exports']=function(_0xcf966d,_0x5620a8){return _0xcf966d['define'](_0x5243('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 9eda334..d2e03ec 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 _0x7cd4=['client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1ea61e,_0x40de61){var _0x4ed8c0=function(_0x3cc3ba){while(--_0x3cc3ba){_0x1ea61e['push'](_0x1ea61e['shift']());}};_0x4ed8c0(++_0x40de61);}(_0x7cd4,0xe7));var _0x47cd=function(_0x1d4916,_0x3e3ed0){_0x1d4916=_0x1d4916-0x0;var _0x14cdf8=_0x7cd4[_0x1d4916];return _0x14cdf8;};'use strict';var _=require(_0x47cd('0x0'));var util=require(_0x47cd('0x1'));var moment=require(_0x47cd('0x2'));var BPromise=require(_0x47cd('0x3'));var rs=require(_0x47cd('0x4'));var fs=require('fs');var Redis=require(_0x47cd('0x5'));var db=require(_0x47cd('0x6'))['db'];var utils=require(_0x47cd('0x7'));var logger=require('../../config/logger')(_0x47cd('0x8'));var config=require(_0x47cd('0x9'));var jayson=require(_0x47cd('0xa'));var client=jayson[_0x47cd('0xb')][_0x47cd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcf4b5f,_0x107e7d,_0xa82896){return new BPromise(function(_0x1bb26b,_0x40feb0){return client[_0x47cd('0xd')](_0xcf4b5f,_0xa82896)['then'](function(_0x59157d){logger[_0x47cd('0xe')](_0x47cd('0xf'),_0x107e7d,_0x47cd('0x10'));logger[_0x47cd('0x11')](_0x47cd('0x12'),_0x107e7d,_0x47cd('0x10'),JSON['stringify'](_0x59157d));if(_0x59157d['error']){if(_0x59157d[_0x47cd('0x13')]['code']===0x1f4){logger['error'](_0x47cd('0xf'),_0x107e7d,_0x59157d[_0x47cd('0x13')][_0x47cd('0x14')]);return _0x40feb0(_0x59157d['error'][_0x47cd('0x14')]);}logger[_0x47cd('0x13')](_0x47cd('0xf'),_0x107e7d,_0x59157d[_0x47cd('0x13')][_0x47cd('0x14')]);return _0x1bb26b(_0x59157d[_0x47cd('0x13')][_0x47cd('0x14')]);}else{logger[_0x47cd('0xe')](_0x47cd('0xf'),_0x107e7d,_0x47cd('0x10'));_0x1bb26b(_0x59157d['result'][_0x47cd('0x14')]);}})[_0x47cd('0x15')](function(_0x1c05bc){logger['error'](_0x47cd('0xf'),_0x107e7d,_0x1c05bc);_0x40feb0(_0x1c05bc);});});} \ No newline at end of file +var _0xbb92=['debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s'];(function(_0x466bf0,_0x158b01){var _0x37b958=function(_0x6cb0e3){while(--_0x6cb0e3){_0x466bf0['push'](_0x466bf0['shift']());}};_0x37b958(++_0x158b01);}(_0xbb92,0x111));var _0x2bb9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbb92[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2bb9('0x0'));var util=require(_0x2bb9('0x1'));var moment=require(_0x2bb9('0x2'));var BPromise=require(_0x2bb9('0x3'));var rs=require(_0x2bb9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2bb9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2bb9('0x7'));var client=jayson[_0x2bb9('0x8')][_0x2bb9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e9b0b,_0x2f4294,_0x5ab1d9){return new BPromise(function(_0x18d66f,_0x224489){return client[_0x2bb9('0xa')](_0x3e9b0b,_0x5ab1d9)[_0x2bb9('0xb')](function(_0x49e438){logger['info'](_0x2bb9('0xc'),_0x2f4294,'request\x20sent');logger[_0x2bb9('0xd')](_0x2bb9('0xe'),_0x2f4294,_0x2bb9('0xf'),JSON['stringify'](_0x49e438));if(_0x49e438['error']){if(_0x49e438[_0x2bb9('0x10')][_0x2bb9('0x11')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x2f4294,_0x49e438[_0x2bb9('0x10')][_0x2bb9('0x12')]);return _0x224489(_0x49e438[_0x2bb9('0x10')]['message']);}logger[_0x2bb9('0x10')](_0x2bb9('0xc'),_0x2f4294,_0x49e438[_0x2bb9('0x10')]['message']);return _0x18d66f(_0x49e438['error'][_0x2bb9('0x12')]);}else{logger[_0x2bb9('0x13')](_0x2bb9('0xc'),_0x2f4294,_0x2bb9('0xf'));_0x18d66f(_0x49e438[_0x2bb9('0x14')][_0x2bb9('0x12')]);}})[_0x2bb9('0x15')](function(_0x109cae){logger[_0x2bb9('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x2f4294,_0x109cae);_0x224489(_0x109cae);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f76e4f4..52e4bf0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x33616f,_0x3855c6){var _0x47221f=function(_0xe32c3a){while(--_0xe32c3a){_0x33616f['push'](_0x33616f['shift']());}};_0x47221f(++_0x3855c6);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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(_0x94cd9e,_0x2b50f2){var _0x1bf136=function(_0xf97f0){while(--_0xf97f0){_0x94cd9e['push'](_0x94cd9e['shift']());}};_0x1bf136(++_0x2b50f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 721335a..5589603 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 _0x5878=['sequelize','INTEGER'];(function(_0x44257e,_0x53681f){var _0x404895=function(_0x41d569){while(--_0x41d569){_0x44257e['push'](_0x44257e['shift']());}};_0x404895(++_0x53681f);}(_0x5878,0xf0));var _0x8587=function(_0x13ed01,_0x31ad69){_0x13ed01=_0x13ed01-0x0;var _0x2adb1a=_0x5878[_0x13ed01];return _0x2adb1a;};'use strict';var Sequelize=require(_0x8587('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8587('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc83f=['sequelize','exports'];(function(_0x1e36d8,_0x41ac49){var _0x5c4ed5=function(_0x444aa8){while(--_0x444aa8){_0x1e36d8['push'](_0x1e36d8['shift']());}};_0x5c4ed5(++_0x41ac49);}(_0xc83f,0xf6));var _0xfc83=function(_0xe7d655,_0x184955){_0xe7d655=_0xe7d655-0x0;var _0x3e4804=_0xc83f[_0xe7d655];return _0x3e4804;};'use strict';var Sequelize=require(_0xfc83('0x0'));module[_0xfc83('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index c445ffe..53544d1 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 _0x632c=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','user_has_mail_queues','lodash','util'];(function(_0x3a7490,_0x265112){var _0x4209ab=function(_0x1e230c){while(--_0x1e230c){_0x3a7490['push'](_0x3a7490['shift']());}};_0x4209ab(++_0x265112);}(_0x632c,0x82));var _0xc632=function(_0x1ee8e2,_0x54b5ee){_0x1ee8e2=_0x1ee8e2-0x0;var _0x50e227=_0x632c[_0x1ee8e2];return _0x50e227;};'use strict';var _=require(_0xc632('0x0'));var util=require(_0xc632('0x1'));var logger=require(_0xc632('0x2'))(_0xc632('0x3'));var moment=require(_0xc632('0x4'));var BPromise=require(_0xc632('0x5'));var rp=require(_0xc632('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc632('0x7'));var config=require(_0xc632('0x8'));var attributes=require(_0xc632('0x9'));module['exports']=function(_0x1b34ed,_0x33dcf0){return _0x1b34ed['define']('UserMailQueue',attributes,{'tableName':_0xc632('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e9e=['request-promise','path','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x0e9e,0xa3));var _0xe0e9=function(_0x367f8c,_0x313e21){_0x367f8c=_0x367f8c-0x0;var _0x118639=_0x0e9e[_0x367f8c];return _0x118639;};'use strict';var _=require(_0xe0e9('0x0'));var util=require(_0xe0e9('0x1'));var logger=require(_0xe0e9('0x2'))(_0xe0e9('0x3'));var moment=require(_0xe0e9('0x4'));var BPromise=require('bluebird');var rp=require(_0xe0e9('0x5'));var fs=require('fs');var path=require(_0xe0e9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe0e9('0x7'));module[_0xe0e9('0x8')]=function(_0x4935d9,_0x5b3e74){return _0x4935d9[_0xe0e9('0x9')](_0xe0e9('0xa'),attributes,{'tableName':_0xe0e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 03f649b..9f3081e 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 _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(_0x1610e0,_0x12e501){var _0x2f9bf4=function(_0x48e1cb){while(--_0x48e1cb){_0x1610e0['push'](_0x1610e0['shift']());}};_0x2f9bf4(++_0x12e501);}(_0xa41a,0x6b));var _0xaa41=function(_0x2b8b9f,_0xc566c0){_0x2b8b9f=_0x2b8b9f-0x0;var _0x16bfbb=_0xa41a[_0x2b8b9f];return _0x16bfbb;};'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 +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3f3882,_0x46187b){var _0x3c9c7b=function(_0x1e802c){while(--_0x1e802c){_0x3f3882['push'](_0x3f3882['shift']());}};_0x3c9c7b(++_0x46187b);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 3288ad5..2b817df 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 _0x4aee=['../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x596a0a,_0x31f8ee){var _0x65117a=function(_0x3047f5){while(--_0x3047f5){_0x596a0a['push'](_0x596a0a['shift']());}};_0x65117a(++_0x31f8ee);}(_0x4aee,0x108));var _0xe4ae=function(_0xd060e4,_0x45a988){_0xd060e4=_0xd060e4-0x0;var _0x4f9650=_0x4aee[_0xd060e4];return _0x4f9650;};'use strict';var multer=require(_0xe4ae('0x0'));var util=require('util');var path=require(_0xe4ae('0x1'));var timeout=require(_0xe4ae('0x2'));var express=require(_0xe4ae('0x3'));var router=express['Router']();var fs_extra=require(_0xe4ae('0x4'));var auth=require(_0xe4ae('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe4ae('0x6'));var controller=require(_0xe4ae('0x7'));router['post']('/',auth[_0xe4ae('0x8')](),controller[_0xe4ae('0x9')]);module['exports']=router; \ No newline at end of file +var _0x8f83=['fs-extra','../../components/auth/service','../../components/interaction/service','post','isAuthenticated','sendUserNotification','multer','util','path','express','Router'];(function(_0x4c8805,_0x996d5e){var _0x2ff438=function(_0x22443e){while(--_0x22443e){_0x4c8805['push'](_0x4c8805['shift']());}};_0x2ff438(++_0x996d5e);}(_0x8f83,0xed));var _0x38f8=function(_0x304602,_0x32d265){_0x304602=_0x304602-0x0;var _0x586307=_0x8f83[_0x304602];return _0x586307;};'use strict';var multer=require(_0x38f8('0x0'));var util=require(_0x38f8('0x1'));var path=require(_0x38f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x38f8('0x3'));var router=express[_0x38f8('0x4')]();var fs_extra=require(_0x38f8('0x5'));var auth=require(_0x38f8('0x6'));var interaction=require(_0x38f8('0x7'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x38f8('0x8')]('/',auth[_0x38f8('0x9')](),controller[_0x38f8('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 76fc88a..d88dc02 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 _0xb35a=['STRING','BOOLEAN','TEXT'];(function(_0x3dbbcf,_0x4c77a1){var _0x59367b=function(_0x4b2460){while(--_0x4b2460){_0x3dbbcf['push'](_0x3dbbcf['shift']());}};_0x59367b(++_0x4c77a1);}(_0xb35a,0x185));var _0xab35=function(_0x2be104,_0x4bf5d0){_0x2be104=_0x2be104-0x0;var _0x31c115=_0xb35a[_0x2be104];return _0x31c115;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xab35('0x0')]},'senderName':{'type':Sequelize[_0xab35('0x1')]},'recipientsId':{'type':Sequelize[_0xab35('0x0')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xab35('0x2')]}}; \ No newline at end of file +var _0xf749=['sequelize','exports','TEXT','STRING'];(function(_0x5aee96,_0x7fe6ce){var _0x46e81e=function(_0x1e079f){while(--_0x1e079f){_0x5aee96['push'](_0x5aee96['shift']());}};_0x46e81e(++_0x7fe6ce);}(_0xf749,0x70));var _0x9f74=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf749[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x9f74('0x0'));module[_0x9f74('0x1')]={'body':{'type':Sequelize[_0x9f74('0x2')]},'senderName':{'type':Sequelize[_0x9f74('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x9f74('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index e0eca2a..7ffe39f 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 _0x332d=['sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','create','forEach','recipient','emit','userNotification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','includes','queue','replace','flatten','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./userNotification.socket','register'];(function(_0xd8d73d,_0x4ccfc1){var _0x4e9bdf=function(_0x5121e6){while(--_0x5121e6){_0xd8d73d['push'](_0xd8d73d['shift']());}};_0x4e9bdf(++_0x4ccfc1);}(_0x332d,0xa4));var _0xd332=function(_0x4c5967,_0x439ff7){_0x4c5967=_0x4c5967-0x0;var _0x5ffcc0=_0x332d[_0x4c5967];return _0x5ffcc0;};'use strict';var emlformat=require(_0xd332('0x0'));var rimraf=require(_0xd332('0x1'));var zipdir=require(_0xd332('0x2'));var jsonpatch=require(_0xd332('0x3'));var rp=require('request-promise');var moment=require(_0xd332('0x4'));var BPromise=require(_0xd332('0x5'));var Mustache=require('mustache');var util=require(_0xd332('0x6'));var path=require(_0xd332('0x7'));var sox=require(_0xd332('0x8'));var csv=require('to-csv');var ejs=require(_0xd332('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd332('0xa'));var squel=require(_0xd332('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd332('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd332('0xd'));var Redis=require(_0xd332('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd332('0xf'));var hardwareService=require(_0xd332('0x10'));var logger=require(_0xd332('0x11'))('api');var utils=require(_0xd332('0x12'));var config=require(_0xd332('0x13'));var licenseUtil=require(_0xd332('0x14'));var db=require(_0xd332('0x15'))['db'];config[_0xd332('0x16')]=_['defaults'](config['redis'],{'host':_0xd332('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd332('0x18'))[_0xd332('0x19')](socket);function respondWithStatusCode(_0x2eec98,_0x2b0e42){_0x2b0e42=_0x2b0e42||0xcc;return function(_0x486bb4){if(_0x486bb4){return _0x2eec98[_0xd332('0x1a')](_0x2b0e42);}return _0x2eec98['status'](_0x2b0e42)[_0xd332('0x1b')]();};}function respondWithResult(_0x1c71a3,_0x52f3c4){_0x52f3c4=_0x52f3c4||0xc8;return function(_0xdbf982){if(_0xdbf982){return _0x1c71a3[_0xd332('0x1c')](_0x52f3c4)[_0xd332('0x1d')](_0xdbf982);}};}function respondWithFilteredResult(_0x3e2d34,_0x3e40cb){return function(_0xe01b9e){if(_0xe01b9e){var _0x461f30=typeof _0x3e40cb[_0xd332('0x1e')]==='undefined'&&typeof _0x3e40cb[_0xd332('0x1f')]===_0xd332('0x20');var _0x25ce69=_0xe01b9e[_0xd332('0x21')];var _0x49f0e0=_0x461f30?0x0:_0x3e40cb[_0xd332('0x1e')];var _0x626ea=_0x461f30?_0xe01b9e[_0xd332('0x21')]:_0x3e40cb['offset']+_0x3e40cb[_0xd332('0x1f')];var _0x134f47;if(_0x626ea>=_0x25ce69){_0x626ea=_0x25ce69;_0x134f47=0xc8;}else{_0x134f47=0xce;}_0x3e2d34[_0xd332('0x1c')](_0x134f47);return _0x3e2d34['set'](_0xd332('0x22'),_0x49f0e0+'-'+_0x626ea+'/'+_0x25ce69)[_0xd332('0x1d')](_0xe01b9e);}return null;};}function patchUpdates(_0x250cd9){return function(_0x221925){try{jsonpatch[_0xd332('0x23')](_0x221925,_0x250cd9,!![]);}catch(_0x433ad0){return BPromise[_0xd332('0x24')](_0x433ad0);}return _0x221925[_0xd332('0x25')]();};}function saveUpdates(_0x4c850f,_0x4fab9f){return function(_0x3848e2){if(_0x3848e2){return _0x3848e2[_0xd332('0x26')](_0x4c850f)[_0xd332('0x27')](function(_0x1fd4d6){return _0x1fd4d6;});}return null;};}function removeEntity(_0x172113,_0x4fcf1b){return function(_0x5517d3){if(_0x5517d3){return _0x5517d3['destroy']()['then'](function(){_0x172113['status'](0xcc)[_0xd332('0x1b')]();});}};}function handleEntityNotFound(_0x46b740,_0x10d857){return function(_0x251e87){if(!_0x251e87){_0x46b740[_0xd332('0x1a')](0x194);}return _0x251e87;};}function handleError(_0x13df45,_0x5b445e){_0x5b445e=_0x5b445e||0x1f4;return function(_0x38ee67){logger[_0xd332('0x28')](_0x38ee67[_0xd332('0x29')]);if(_0x38ee67[_0xd332('0x2a')]){delete _0x38ee67['name'];}_0x13df45['status'](_0x5b445e)[_0xd332('0x2b')](_0x38ee67);};}exports[_0xd332('0x2c')]=function(_0x15e180,_0x467875,_0x40ec20){if(!_0x15e180[_0xd332('0x2d')]['hasOwnProperty'](_0xd332('0x2e'))&&!_0x15e180['body'][_0xd332('0x2f')](_0xd332('0x30'))){throw new db[(_0xd332('0x31'))]['ValidationError'](_0xd332('0x32'));}else{if(_0x15e180[_0xd332('0x2d')][_0xd332('0x2f')](_0xd332('0x30'))&&!_0x15e180['body'][_0xd332('0x2f')](_0xd332('0x33'))){throw new db['Sequelize'][(_0xd332('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x15e180[_0xd332('0x2d')][_0xd332('0x2f')](_0xd332('0x35'))){throw new db[(_0xd332('0x31'))][(_0xd332('0x34'))](_0xd332('0x36'));}else{try{var _0x326604=JSON[_0xd332('0x37')](_0x15e180[_0xd332('0x2d')]['recipients']);}catch(_0x2f90f4){logger[_0xd332('0x28')](_0x2f90f4);throw new db['Sequelize'][(_0xd332('0x34'))](_0xd332('0x38'));}var _0x4dfdb8=[_0xd332('0x39'),'faxqueue',_0xd332('0x3a'),'openchannelqueue',_0xd332('0x3b'),_0xd332('0x3c'),_0xd332('0x3d'),_0xd332('0x3e'),_0xd332('0x3f')];if(_[_0xd332('0x40')](_0x326604,function(_0x4156e2){return!_['includes'](_0x4dfdb8,_0x4156e2[_0xd332('0x41')][_0xd332('0x42')]());})){throw new db['Sequelize']['ValidationError'](_0xd332('0x43'));}}}var _0x5e8d6c={};_0x5e8d6c[_0xd332('0x44')]=_0x15e180[_0xd332('0x2d')]['hasOwnProperty'](_0xd332('0x44'))?_0x15e180[_0xd332('0x2d')][_0xd332('0x44')]:_0x15e180[_0xd332('0x3f')]['fullname'];_0x5e8d6c[_0xd332('0x45')]=_[_0xd332('0x46')](_0x15e180[_0xd332('0x2d')]['recipientsDescription'])?null:_0x15e180['body'][_0xd332('0x45')];_0x5e8d6c[_0xd332('0x47')]=_0x15e180[_0xd332('0x2d')]['beep']||![];_0x5e8d6c[_0xd332('0x48')]=_0x15e180[_0xd332('0x3f')]['id'];return getContent(_0x15e180[_0xd332('0x2d')])[_0xd332('0x27')](function(_0x277256){_0x5e8d6c[_0xd332('0x2d')]=_0x277256;return getRecipients(_0x326604);})[_0xd332('0x27')](function(_0x2069bb){_0x5e8d6c[_0xd332('0x49')]=_[_0xd332('0x4a')](_0x2069bb)[_0xd332('0x4b')](',');return db['sequelize'][_0xd332('0x4c')](function(_0x43c98f){return db['UserNotification'][_0xd332('0x4d')](_0x5e8d6c,{'raw':!![],'transaction':_0x43c98f})[_0xd332('0x27')](function(_0x32299e){var _0xe4f892={'sender':_0x5e8d6c['senderName'],'description':_0x5e8d6c['recipientsDescription'],'content':_0x5e8d6c[_0xd332('0x2d')],'beep':_0x5e8d6c[_0xd332('0x47')]};_0x2069bb[_0xd332('0x4e')](function(_0x591399){_0xe4f892[_0xd332('0x4f')]=_0x591399;socket[_0xd332('0x50')](_0xd332('0x51'),_0xe4f892);});return _0x32299e;});});})[_0xd332('0x27')](respondWithResult(_0x467875,0xc9))[_0xd332('0x52')](handleError(_0x467875,null));};function getContent(_0x4e0951){return new BPromise(function(_0x45883a,_0x22188f){if(_0x4e0951[_0xd332('0x2e')]){_0x45883a(_0x4e0951[_0xd332('0x2e')]);return;}return db[_0xd332('0x53')]['findOne']({'attributes':['html'],'where':{'id':_0x4e0951[_0xd332('0x30')]},'raw':!![]})['then'](function(_0x472820){if(!_0x472820)throw new db[(_0xd332('0x31'))]['ValidationError'](_0xd332('0x54'));var _0x3bae1=Mustache['render'](_0x472820['html'],_0x4e0951[_0xd332('0x33')]);_0x45883a(_0x3bae1);})['catch'](function(_0x17e8d7){_0x22188f(_0x17e8d7);});});}function getRecipients(_0x21b60f){return new BPromise(function(_0x44672f,_0x59636b){var _0x5f58db=[];var _0x28e14f=[];_0x21b60f[_0xd332('0x4e')](function(_0x595b85){var _0x22d782=_[_0xd332('0x55')](_0x595b85[_0xd332('0x41')]['toLowerCase']());if(_0x22d782===_0xd332('0x56')){_0x5f58db=_[_0xd332('0x57')](_0x5f58db,_0x595b85[_0xd332('0x58')]);}else{if(_[_0xd332('0x59')](_0x22d782,_0xd332('0x5a')))_0x22d782=_0x22d782[_0xd332('0x5b')](_0xd332('0x5a'),'Queue');_0x595b85[_0xd332('0x58')][_0xd332('0x4e')](function(_0x4b3b1b){_0x28e14f['push'](getAgents(_0x22d782,_0x4b3b1b));});}});return BPromise['all'](_0x28e14f)[_0xd332('0x27')](function(_0x281386){_0x5f58db=_[_0xd332('0x57')](_0x5f58db,_[_0xd332('0x5c')](_0x281386));_0x44672f(_0x5f58db);})[_0xd332('0x52')](function(_0x57a61b){_0x59636b(_0x57a61b);});});}function getAgents(_0x4c23dc,_0x52f691){return new BPromise(function(_0x28ba52,_0x3ca59d){return db[_0x4c23dc][_0xd332('0x5d')]({'where':{'id':_0x52f691}})['then'](function(_0x17f08d){return _0x17f08d['getAgents']({'attributes':['id'],'raw':!![]})[_0xd332('0x27')](function(_0x4fef87){var _0x2fac81=_[_0xd332('0x5e')](_0x4fef87,'id');_0x28ba52(_0x2fac81);});})[_0xd332('0x52')](function(_0x1f1641){_0x3ca59d(_0x1f1641);});});} \ No newline at end of file +var _0x3643=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','send','hasOwnProperty','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','voicequeue','whatsappqueue','team','user','includes','model','isEmpty','beep','recipientsId','sortBy','transaction','UserNotification','senderName','forEach','recipient','emit','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase','toLowerCase','User','queue','replace','Queue','ids','all','union','getAgents','map'];(function(_0x231efb,_0x3fea4f){var _0x5e045b=function(_0x54d3b1){while(--_0x54d3b1){_0x231efb['push'](_0x231efb['shift']());}};_0x5e045b(++_0x3fea4f);}(_0x3643,0xba));var _0x3364=function(_0x4cca12,_0x31da07){_0x4cca12=_0x4cca12-0x0;var _0x3ac3c7=_0x3643[_0x4cca12];return _0x3ac3c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3364('0x0'));var zipdir=require(_0x3364('0x1'));var jsonpatch=require(_0x3364('0x2'));var rp=require(_0x3364('0x3'));var moment=require(_0x3364('0x4'));var BPromise=require(_0x3364('0x5'));var Mustache=require(_0x3364('0x6'));var util=require(_0x3364('0x7'));var path=require('path');var sox=require(_0x3364('0x8'));var csv=require(_0x3364('0x9'));var ejs=require(_0x3364('0xa'));var fs=require('fs');var fs_extra=require(_0x3364('0xb'));var _=require('lodash');var squel=require(_0x3364('0xc'));var crypto=require(_0x3364('0xd'));var jsforce=require(_0x3364('0xe'));var deskjs=require(_0x3364('0xf'));var toCsv=require(_0x3364('0x9'));var querystring=require(_0x3364('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3364('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3364('0x12'));var hardwareService=require(_0x3364('0x13'));var logger=require('../../config/logger')(_0x3364('0x14'));var utils=require(_0x3364('0x15'));var config=require(_0x3364('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3364('0x17')]=_[_0x3364('0x18')](config['redis'],{'host':_0x3364('0x19'),'port':0x18eb});var socket=require(_0x3364('0x1a'))(new Redis(config[_0x3364('0x17')]));require('./userNotification.socket')[_0x3364('0x1b')](socket);function respondWithStatusCode(_0x32d6ca,_0x280d21){_0x280d21=_0x280d21||0xcc;return function(_0x545b0c){if(_0x545b0c){return _0x32d6ca[_0x3364('0x1c')](_0x280d21);}return _0x32d6ca['status'](_0x280d21)['end']();};}function respondWithResult(_0x3d04b5,_0x994aaf){_0x994aaf=_0x994aaf||0xc8;return function(_0x445881){if(_0x445881){return _0x3d04b5[_0x3364('0x1d')](_0x994aaf)[_0x3364('0x1e')](_0x445881);}};}function respondWithFilteredResult(_0x4041fa,_0x9f6380){return function(_0x13649f){if(_0x13649f){var _0x603103=typeof _0x9f6380[_0x3364('0x1f')]===_0x3364('0x20')&&typeof _0x9f6380[_0x3364('0x21')]===_0x3364('0x20');var _0x664265=_0x13649f[_0x3364('0x22')];var _0x50b9f2=_0x603103?0x0:_0x9f6380[_0x3364('0x1f')];var _0x58ebdf=_0x603103?_0x13649f[_0x3364('0x22')]:_0x9f6380['offset']+_0x9f6380[_0x3364('0x21')];var _0x1dfb7a;if(_0x58ebdf>=_0x664265){_0x58ebdf=_0x664265;_0x1dfb7a=0xc8;}else{_0x1dfb7a=0xce;}_0x4041fa[_0x3364('0x1d')](_0x1dfb7a);return _0x4041fa['set'](_0x3364('0x23'),_0x50b9f2+'-'+_0x58ebdf+'/'+_0x664265)[_0x3364('0x1e')](_0x13649f);}return null;};}function patchUpdates(_0xecd93){return function(_0x44092c){try{jsonpatch[_0x3364('0x24')](_0x44092c,_0xecd93,!![]);}catch(_0x3a20c0){return BPromise[_0x3364('0x25')](_0x3a20c0);}return _0x44092c[_0x3364('0x26')]();};}function saveUpdates(_0x108947,_0xd52fb6){return function(_0x470832){if(_0x470832){return _0x470832[_0x3364('0x27')](_0x108947)[_0x3364('0x28')](function(_0x2071db){return _0x2071db;});}return null;};}function removeEntity(_0x35e0ca,_0x4f4440){return function(_0x1e5e2f){if(_0x1e5e2f){return _0x1e5e2f['destroy']()[_0x3364('0x28')](function(){_0x35e0ca[_0x3364('0x1d')](0xcc)[_0x3364('0x29')]();});}};}function handleEntityNotFound(_0x254d04,_0x93ae52){return function(_0xeb6b0c){if(!_0xeb6b0c){_0x254d04[_0x3364('0x1c')](0x194);}return _0xeb6b0c;};}function handleError(_0x46a27f,_0x47905e){_0x47905e=_0x47905e||0x1f4;return function(_0x428445){logger['error'](_0x428445[_0x3364('0x2a')]);if(_0x428445[_0x3364('0x2b')]){delete _0x428445[_0x3364('0x2b')];}_0x46a27f[_0x3364('0x1d')](_0x47905e)[_0x3364('0x2c')](_0x428445);};}exports['sendUserNotification']=function(_0x579eff,_0x59e0a1,_0x4bb8b1){if(!_0x579eff['body'][_0x3364('0x2d')]('text')&&!_0x579eff[_0x3364('0x2e')][_0x3364('0x2d')](_0x3364('0x2f'))){throw new db[(_0x3364('0x30'))][(_0x3364('0x31'))](_0x3364('0x32'));}else{if(_0x579eff[_0x3364('0x2e')][_0x3364('0x2d')](_0x3364('0x2f'))&&!_0x579eff[_0x3364('0x2e')][_0x3364('0x2d')](_0x3364('0x33'))){throw new db[(_0x3364('0x30'))][(_0x3364('0x31'))](_0x3364('0x34'));}if(!_0x579eff['body']['hasOwnProperty'](_0x3364('0x35'))){throw new db[(_0x3364('0x30'))]['ValidationError'](_0x3364('0x36'));}else{try{var _0x4081a0=JSON['parse'](_0x579eff[_0x3364('0x2e')]['recipients']);}catch(_0x3524f7){logger[_0x3364('0x37')](_0x3524f7);throw new db[(_0x3364('0x30'))][(_0x3364('0x31'))](_0x3364('0x38'));}var _0x409b62=['chatqueue',_0x3364('0x39'),_0x3364('0x3a'),'openchannelqueue','smsqueue',_0x3364('0x3b'),_0x3364('0x3c'),_0x3364('0x3d'),_0x3364('0x3e')];if(_['some'](_0x4081a0,function(_0x379c6f){return!_[_0x3364('0x3f')](_0x409b62,_0x379c6f[_0x3364('0x40')]['toLowerCase']());})){throw new db[(_0x3364('0x30'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2589c5={};_0x2589c5['senderName']=_0x579eff[_0x3364('0x2e')][_0x3364('0x2d')]('senderName')?_0x579eff[_0x3364('0x2e')]['senderName']:_0x579eff[_0x3364('0x3e')]['fullname'];_0x2589c5['recipientsDescription']=_[_0x3364('0x41')](_0x579eff['body']['recipientsDescription'])?null:_0x579eff[_0x3364('0x2e')]['recipientsDescription'];_0x2589c5[_0x3364('0x42')]=_0x579eff[_0x3364('0x2e')][_0x3364('0x42')]||![];_0x2589c5['SenderId']=_0x579eff['user']['id'];return getContent(_0x579eff[_0x3364('0x2e')])[_0x3364('0x28')](function(_0x564234){_0x2589c5[_0x3364('0x2e')]=_0x564234;return getRecipients(_0x4081a0);})['then'](function(_0x351541){_0x2589c5[_0x3364('0x43')]=_[_0x3364('0x44')](_0x351541)['join'](',');return db['sequelize'][_0x3364('0x45')](function(_0x2039e5){return db[_0x3364('0x46')]['create'](_0x2589c5,{'raw':!![],'transaction':_0x2039e5})['then'](function(_0x3bbda7){var _0x495aca={'sender':_0x2589c5[_0x3364('0x47')],'description':_0x2589c5['recipientsDescription'],'content':_0x2589c5[_0x3364('0x2e')],'beep':_0x2589c5[_0x3364('0x42')]};_0x351541[_0x3364('0x48')](function(_0x56b17a){_0x495aca[_0x3364('0x49')]=_0x56b17a;socket[_0x3364('0x4a')](_0x3364('0x4b'),_0x495aca);});return _0x3bbda7;});});})[_0x3364('0x28')](respondWithResult(_0x59e0a1,0xc9))['catch'](handleError(_0x59e0a1,null));};function getContent(_0x371fca){return new BPromise(function(_0x4a6101,_0xd31a88){if(_0x371fca['text']){_0x4a6101(_0x371fca[_0x3364('0x4c')]);return;}return db[_0x3364('0x4d')][_0x3364('0x4e')]({'attributes':[_0x3364('0x4f')],'where':{'id':_0x371fca[_0x3364('0x2f')]},'raw':!![]})[_0x3364('0x28')](function(_0xe9ea4f){if(!_0xe9ea4f)throw new db['Sequelize'][(_0x3364('0x31'))](_0x3364('0x50'));var _0xff9d2b=Mustache['render'](_0xe9ea4f[_0x3364('0x4f')],_0x371fca[_0x3364('0x33')]);_0x4a6101(_0xff9d2b);})[_0x3364('0x51')](function(_0x4de3c1){_0xd31a88(_0x4de3c1);});});}function getRecipients(_0x32ce99){return new BPromise(function(_0x50c6af,_0x15578c){var _0x299a0c=[];var _0x1746e6=[];_0x32ce99[_0x3364('0x48')](function(_0x293803){var _0x46d4c6=_[_0x3364('0x52')](_0x293803[_0x3364('0x40')][_0x3364('0x53')]());if(_0x46d4c6===_0x3364('0x54')){_0x299a0c=_['union'](_0x299a0c,_0x293803['ids']);}else{if(_[_0x3364('0x3f')](_0x46d4c6,_0x3364('0x55')))_0x46d4c6=_0x46d4c6[_0x3364('0x56')](_0x3364('0x55'),_0x3364('0x57'));_0x293803[_0x3364('0x58')][_0x3364('0x48')](function(_0x569573){_0x1746e6['push'](getAgents(_0x46d4c6,_0x569573));});}});return BPromise[_0x3364('0x59')](_0x1746e6)[_0x3364('0x28')](function(_0x238b6e){_0x299a0c=_[_0x3364('0x5a')](_0x299a0c,_['flatten'](_0x238b6e));_0x50c6af(_0x299a0c);})[_0x3364('0x51')](function(_0x425c8f){_0x15578c(_0x425c8f);});});}function getAgents(_0x4689a4,_0x1836ef){return new BPromise(function(_0x44c6e4,_0x479b22){return db[_0x4689a4]['findOne']({'where':{'id':_0x1836ef}})['then'](function(_0x1d9bab){return _0x1d9bab[_0x3364('0x5b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x42fdc9){var _0x14ef4d=_[_0x3364('0x5c')](_0x42fdc9,'id');_0x44c6e4(_0x14ef4d);});})[_0x3364('0x51')](function(_0x45e625){_0x479b22(_0x45e625);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 44818b8..a507dc4 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 _0x7e85=['update','emit','hasOwnProperty','exports','UserNotification','setMaxListeners','save'];(function(_0x500210,_0x15bbe6){var _0x5b5da3=function(_0x29d0d8){while(--_0x29d0d8){_0x500210['push'](_0x500210['shift']());}};_0x5b5da3(++_0x15bbe6);}(_0x7e85,0x1d2));var _0x57e8=function(_0x5d1aea,_0x2a2fb8){_0x5d1aea=_0x5d1aea-0x0;var _0x1a91b6=_0x7e85[_0x5d1aea];return _0x1a91b6;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x57e8('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x57e8('0x1')](0x0);var events={'afterCreate':_0x57e8('0x2'),'afterUpdate':_0x57e8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x57a9bb){return function(_0x280f59,_0x155267,_0x2be76b){UserNotificationEvents[_0x57e8('0x4')](_0x57a9bb+':'+_0x280f59['id'],_0x280f59);UserNotificationEvents[_0x57e8('0x4')](_0x57a9bb,_0x280f59);_0x2be76b(null);};}for(var e in events){if(events[_0x57e8('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x57e8('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x8dd3=['exports','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x694143,_0x48bdd6){var _0x56a54e=function(_0x971ac6){while(--_0x971ac6){_0x694143['push'](_0x694143['shift']());}};_0x56a54e(++_0x48bdd6);}(_0x8dd3,0x100));var _0x38dd=function(_0x2c7d73,_0x17c4e9){_0x2c7d73=_0x2c7d73-0x0;var _0x2e8d18=_0x8dd3[_0x2c7d73];return _0x2e8d18;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x38dd('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x38dd('0x1'),'afterDestroy':'remove'};function emitEvent(_0x54b7e0){return function(_0x5f0ac7,_0x5cd18d,_0x4560b7){UserNotificationEvents[_0x38dd('0x2')](_0x54b7e0+':'+_0x5f0ac7['id'],_0x5f0ac7);UserNotificationEvents['emit'](_0x54b7e0,_0x5f0ac7);_0x4560b7(null);};}for(var e in events){if(events[_0x38dd('0x3')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x38dd('0x4')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index baa3450..1ca7474 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 _0xfed7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x4cd9a9,_0x568436){var _0x17894f=function(_0x26ff4f){while(--_0x26ff4f){_0x4cd9a9['push'](_0x4cd9a9['shift']());}};_0x17894f(++_0x568436);}(_0xfed7,0x190));var _0x7fed=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0xfed7[_0x318410];return _0x2898a3;};'use strict';var _=require(_0x7fed('0x0'));var util=require(_0x7fed('0x1'));var logger=require(_0x7fed('0x2'))(_0x7fed('0x3'));var moment=require(_0x7fed('0x4'));var BPromise=require(_0x7fed('0x5'));var rp=require(_0x7fed('0x6'));var fs=require('fs');var path=require(_0x7fed('0x7'));var rimraf=require(_0x7fed('0x8'));var config=require(_0x7fed('0x9'));var attributes=require('./userNotification.attributes');module[_0x7fed('0xa')]=function(_0x3be30c,_0x517ec1){return _0x3be30c['define'](_0x7fed('0xb'),attributes,{'tableName':_0x7fed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7fed('0xd'),'collate':_0x7fed('0xe')});}; \ No newline at end of file +var _0xe2ae=['api','moment','bluebird','path','rimraf','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x200c1a,_0x163f92){var _0x2222f7=function(_0xa3c969){while(--_0xa3c969){_0x200c1a['push'](_0x200c1a['shift']());}};_0x2222f7(++_0x163f92);}(_0xe2ae,0x1a2));var _0xee2a=function(_0x552061,_0x378b4a){_0x552061=_0x552061-0x0;var _0x14fb3e=_0xe2ae[_0x552061];return _0x14fb3e;};'use strict';var _=require(_0xee2a('0x0'));var util=require('util');var logger=require(_0xee2a('0x1'))(_0xee2a('0x2'));var moment=require(_0xee2a('0x3'));var BPromise=require(_0xee2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee2a('0x5'));var rimraf=require(_0xee2a('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x24b988,_0x1ca4d5){return _0x24b988[_0xee2a('0x7')](_0xee2a('0x8'),attributes,{'tableName':_0xee2a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xee2a('0xa'),'collate':_0xee2a('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e13c4bb..8fe5e64 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 _0x86e0=['randomstring','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86e0,0x134));var _0x086e=function(_0x43a35e,_0x1bde09){_0x43a35e=_0x43a35e-0x0;var _0x18bb51=_0x86e0[_0x43a35e];return _0x18bb51;};'use strict';var _=require(_0x086e('0x0'));var util=require(_0x086e('0x1'));var moment=require(_0x086e('0x2'));var BPromise=require(_0x086e('0x3'));var rs=require(_0x086e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x086e('0x5'))('rpc');var config=require(_0x086e('0x6'));var jayson=require(_0x086e('0x7'));var client=jayson['client'][_0x086e('0x8')]({'port':0x232a});config['redis']=_[_0x086e('0x9')](config[_0x086e('0xa')],{'host':_0x086e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x086e('0xc'))[_0x086e('0xd')](socket);function respondWithRpcPromise(_0x7aa033,_0x4cbced,_0x3d7941){return new BPromise(function(_0x5614e4,_0x2f9cfa){return client[_0x086e('0xe')](_0x7aa033,_0x3d7941)[_0x086e('0xf')](function(_0x3c9601){logger[_0x086e('0x10')](_0x086e('0x11'),_0x4cbced,_0x086e('0x12'));logger[_0x086e('0x13')](_0x086e('0x14'),_0x4cbced,'request\x20sent',JSON[_0x086e('0x15')](_0x3c9601));if(_0x3c9601[_0x086e('0x16')]){if(_0x3c9601[_0x086e('0x16')][_0x086e('0x17')]===0x1f4){logger[_0x086e('0x16')](_0x086e('0x11'),_0x4cbced,_0x3c9601[_0x086e('0x16')][_0x086e('0x18')]);return _0x2f9cfa(_0x3c9601[_0x086e('0x16')][_0x086e('0x18')]);}logger[_0x086e('0x16')](_0x086e('0x11'),_0x4cbced,_0x3c9601['error'][_0x086e('0x18')]);return _0x5614e4(_0x3c9601[_0x086e('0x16')][_0x086e('0x18')]);}else{logger[_0x086e('0x10')](_0x086e('0x11'),_0x4cbced,_0x086e('0x12'));_0x5614e4(_0x3c9601[_0x086e('0x19')]['message']);}})['catch'](function(_0x5a9a8d){logger[_0x086e('0x16')](_0x086e('0x11'),_0x4cbced,_0x5a9a8d);_0x2f9cfa(_0x5a9a8d);});});} \ No newline at end of file +var _0x994a=['request\x20sent','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x32fa2f,_0x517452){var _0x40256e=function(_0x269922){while(--_0x269922){_0x32fa2f['push'](_0x32fa2f['shift']());}};_0x40256e(++_0x517452);}(_0x994a,0x9f));var _0xa994=function(_0x43bb00,_0x56d787){_0x43bb00=_0x43bb00-0x0;var _0x1b9aa0=_0x994a[_0x43bb00];return _0x1b9aa0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa994('0x0'));var rs=require(_0xa994('0x1'));var fs=require('fs');var Redis=require(_0xa994('0x2'));var db=require(_0xa994('0x3'))['db'];var utils=require(_0xa994('0x4'));var logger=require(_0xa994('0x5'))(_0xa994('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa994('0x7')][_0xa994('0x8')]({'port':0x232a});config[_0xa994('0x9')]=_[_0xa994('0xa')](config['redis'],{'host':_0xa994('0xb'),'port':0x18eb});var socket=require(_0xa994('0xc'))(new Redis(config[_0xa994('0x9')]));require('./userNotification.socket')[_0xa994('0xd')](socket);function respondWithRpcPromise(_0x35f97c,_0x21cb36,_0x59227b){return new BPromise(function(_0x1a90ff,_0x555500){return client[_0xa994('0xe')](_0x35f97c,_0x59227b)[_0xa994('0xf')](function(_0xb3202d){logger[_0xa994('0x10')](_0xa994('0x11'),_0x21cb36,'request\x20sent');logger[_0xa994('0x12')](_0xa994('0x13'),_0x21cb36,'request\x20sent',JSON[_0xa994('0x14')](_0xb3202d));if(_0xb3202d['error']){if(_0xb3202d[_0xa994('0x15')]['code']===0x1f4){logger['error'](_0xa994('0x11'),_0x21cb36,_0xb3202d['error']['message']);return _0x555500(_0xb3202d['error'][_0xa994('0x16')]);}logger[_0xa994('0x15')](_0xa994('0x11'),_0x21cb36,_0xb3202d[_0xa994('0x15')][_0xa994('0x16')]);return _0x1a90ff(_0xb3202d[_0xa994('0x15')][_0xa994('0x16')]);}else{logger[_0xa994('0x10')](_0xa994('0x11'),_0x21cb36,_0xa994('0x17'));_0x1a90ff(_0xb3202d[_0xa994('0x18')][_0xa994('0x16')]);}})[_0xa994('0x19')](function(_0x2fe553){logger[_0xa994('0x15')]('UserNotification,\x20%s,\x20%s',_0x21cb36,_0x2fe553);_0x555500(_0x2fe553);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5a0c952..8d1a19a 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 _0xc5c4=['length','userNotification:','./userNotification.events','save','remove'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0xc5c4,0x18d));var _0x4c5c=function(_0x4d93d0,_0x19504a){_0x4d93d0=_0x4d93d0-0x0;var _0x2bcca4=_0xc5c4[_0x4d93d0];return _0x2bcca4;};'use strict';var UserNotificationEvents=require(_0x4c5c('0x0'));var events=[_0x4c5c('0x1'),_0x4c5c('0x2'),'update'];function createListener(_0x48c091,_0x30ed17){return function(_0x3546f6){_0x30ed17['emit'](_0x48c091,_0x3546f6);};}function removeListener(_0x4be5da,_0x7c1e75){return function(){UserNotificationEvents['removeListener'](_0x4be5da,_0x7c1e75);};}exports['register']=function(_0x217481){for(var _0x502bee=0x0,_0x1f6a56=events[_0x4c5c('0x3')];_0x502bee<_0x1f6a56;_0x502bee++){var _0x3ade77=events[_0x502bee];var _0x31f288=createListener(_0x4c5c('0x4')+_0x3ade77,_0x217481);UserNotificationEvents['on'](_0x3ade77,_0x31f288);}}; \ No newline at end of file +var _0x6611=['save','remove','emit','removeListener','register','userNotification:'];(function(_0x2759ad,_0x4d2d4e){var _0x37003e=function(_0x42a45c){while(--_0x42a45c){_0x2759ad['push'](_0x2759ad['shift']());}};_0x37003e(++_0x4d2d4e);}(_0x6611,0xde));var _0x1661=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6611[_0x3947c9];return _0x2e7871;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x1661('0x0'),_0x1661('0x1'),'update'];function createListener(_0xc6621c,_0x33e3f3){return function(_0xbfedb5){_0x33e3f3[_0x1661('0x2')](_0xc6621c,_0xbfedb5);};}function removeListener(_0x3a54a5,_0x1ab6f1){return function(){UserNotificationEvents[_0x1661('0x3')](_0x3a54a5,_0x1ab6f1);};}exports[_0x1661('0x4')]=function(_0x1fc70a){for(var _0x48162f=0x0,_0x2b0caa=events['length'];_0x48162f<_0x2b0caa;_0x48162f++){var _0x4ee3c4=events[_0x48162f];var _0xe7bbb5=createListener(_0x1661('0x5')+_0x4ee3c4,_0x1fc70a);UserNotificationEvents['on'](_0x4ee3c4,_0xe7bbb5);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4887397..1407e12 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x57f847,_0x33175b){var _0x2ebdcb=function(_0x432763){while(--_0x432763){_0x57f847['push'](_0x57f847['shift']());}};_0x2ebdcb(++_0x33175b);}(_0xedd9,0xfc));var _0x9edd=function(_0x2f1e5b,_0x136a30){_0x2f1e5b=_0x2f1e5b-0x0;var _0x4a1898=_0xedd9[_0x2f1e5b];return _0x4a1898;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x51dd2c,_0x2a2345){var _0x41c678=function(_0xa14c31){while(--_0xa14c31){_0x51dd2c['push'](_0x51dd2c['shift']());}};_0x41c678(++_0x2a2345);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0b2fac0..14e3ba6 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 _0x53ab=['INTEGER','sequelize','exports'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x53ab,0x130));var _0xb53a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53ab[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb53a('0x0'));module[_0xb53a('0x1')]={'penalty':{'type':Sequelize[_0xb53a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x59cb=['exports','sequelize'];(function(_0x4259cd,_0x32ffd6){var _0x4f5230=function(_0x24ca95){while(--_0x24ca95){_0x4259cd['push'](_0x4259cd['shift']());}};_0x4f5230(++_0x32ffd6);}(_0x59cb,0x69));var _0xb59c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x59cb[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xb59c('0x0'));module[_0xb59c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 018a1f0..63b1008 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 _0xd6bd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x199369,_0x5bcabe){var _0x5b3831=function(_0x25fa61){while(--_0x25fa61){_0x199369['push'](_0x199369['shift']());}};_0x5b3831(++_0x5bcabe);}(_0xd6bd,0x11a));var _0xdd6b=function(_0xc297bc,_0x2aed50){_0xc297bc=_0xc297bc-0x0;var _0xed03d3=_0xd6bd[_0xc297bc];return _0xed03d3;};'use strict';var _=require(_0xdd6b('0x0'));var util=require(_0xdd6b('0x1'));var logger=require(_0xdd6b('0x2'))(_0xdd6b('0x3'));var moment=require(_0xdd6b('0x4'));var BPromise=require(_0xdd6b('0x5'));var rp=require(_0xdd6b('0x6'));var fs=require('fs');var path=require(_0xdd6b('0x7'));var rimraf=require(_0xdd6b('0x8'));var config=require(_0xdd6b('0x9'));var attributes=require(_0xdd6b('0xa'));module[_0xdd6b('0xb')]=function(_0x8a1ad,_0x3b974b){return _0x8a1ad[_0xdd6b('0xc')](_0xdd6b('0xd'),attributes,{'tableName':_0xdd6b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6ae=['request-promise','rimraf','./userOpenchannelQueue.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x2509f1,_0x5c9f8c){var _0x410842=function(_0x1b1eeb){while(--_0x1b1eeb){_0x2509f1['push'](_0x2509f1['shift']());}};_0x410842(++_0x5c9f8c);}(_0xa6ae,0x12d));var _0xea6a=function(_0x487933,_0x77076d){_0x487933=_0x487933-0x0;var _0x741518=_0xa6ae[_0x487933];return _0x741518;};'use strict';var _=require(_0xea6a('0x0'));var util=require(_0xea6a('0x1'));var logger=require(_0xea6a('0x2'))(_0xea6a('0x3'));var moment=require(_0xea6a('0x4'));var BPromise=require('bluebird');var rp=require(_0xea6a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea6a('0x6'));var config=require('../../config/environment');var attributes=require(_0xea6a('0x7'));module['exports']=function(_0x42cc10,_0x32c5e9){return _0x42cc10[_0xea6a('0x8')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 1fd3d11..17862d0 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 _0x7a03=['client','http','request','then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x7a03,0x1b7));var _0x37a0=function(_0x18eca2,_0x29c2a0){_0x18eca2=_0x18eca2-0x0;var _0x54538b=_0x7a03[_0x18eca2];return _0x54538b;};'use strict';var _=require(_0x37a0('0x0'));var util=require(_0x37a0('0x1'));var moment=require(_0x37a0('0x2'));var BPromise=require(_0x37a0('0x3'));var rs=require(_0x37a0('0x4'));var fs=require('fs');var Redis=require(_0x37a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x37a0('0x6'));var logger=require(_0x37a0('0x7'))(_0x37a0('0x8'));var config=require(_0x37a0('0x9'));var jayson=require(_0x37a0('0xa'));var client=jayson[_0x37a0('0xb')][_0x37a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a2ca1,_0x526d0f,_0x45ca08){return new BPromise(function(_0xbd21be,_0x36b3a2){return client[_0x37a0('0xd')](_0x4a2ca1,_0x45ca08)[_0x37a0('0xe')](function(_0x292410){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x526d0f,_0x37a0('0xf'));logger[_0x37a0('0x10')](_0x37a0('0x11'),_0x526d0f,'request\x20sent',JSON[_0x37a0('0x12')](_0x292410));if(_0x292410[_0x37a0('0x13')]){if(_0x292410[_0x37a0('0x13')][_0x37a0('0x14')]===0x1f4){logger[_0x37a0('0x13')](_0x37a0('0x15'),_0x526d0f,_0x292410[_0x37a0('0x13')][_0x37a0('0x16')]);return _0x36b3a2(_0x292410[_0x37a0('0x13')]['message']);}logger[_0x37a0('0x13')](_0x37a0('0x15'),_0x526d0f,_0x292410[_0x37a0('0x13')]['message']);return _0xbd21be(_0x292410[_0x37a0('0x13')][_0x37a0('0x16')]);}else{logger[_0x37a0('0x17')](_0x37a0('0x15'),_0x526d0f,_0x37a0('0xf'));_0xbd21be(_0x292410['result'][_0x37a0('0x16')]);}})[_0x37a0('0x18')](function(_0x2b6cba){logger[_0x37a0('0x13')](_0x37a0('0x15'),_0x526d0f,_0x2b6cba);_0x36b3a2(_0x2b6cba);});});} \ No newline at end of file +var _0xf365=['code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4e9e2c,_0x2908b5){var _0x412df5=function(_0x1d64ce){while(--_0x1d64ce){_0x4e9e2c['push'](_0x4e9e2c['shift']());}};_0x412df5(++_0x2908b5);}(_0xf365,0x71));var _0x5f36=function(_0xce06d0,_0xe944b9){_0xce06d0=_0xce06d0-0x0;var _0x360347=_0xf365[_0xce06d0];return _0x360347;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5f36('0x0'));var BPromise=require(_0x5f36('0x1'));var rs=require(_0x5f36('0x2'));var fs=require('fs');var Redis=require(_0x5f36('0x3'));var db=require(_0x5f36('0x4'))['db'];var utils=require(_0x5f36('0x5'));var logger=require(_0x5f36('0x6'))(_0x5f36('0x7'));var config=require(_0x5f36('0x8'));var jayson=require(_0x5f36('0x9'));var client=jayson[_0x5f36('0xa')][_0x5f36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17d2c0,_0xe8b4df,_0x5c29c2){return new BPromise(function(_0x3bf39d,_0x554745){return client[_0x5f36('0xc')](_0x17d2c0,_0x5c29c2)[_0x5f36('0xd')](function(_0x124bec){logger['info'](_0x5f36('0xe'),_0xe8b4df,_0x5f36('0xf'));logger['debug'](_0x5f36('0x10'),_0xe8b4df,_0x5f36('0xf'),JSON[_0x5f36('0x11')](_0x124bec));if(_0x124bec['error']){if(_0x124bec[_0x5f36('0x12')][_0x5f36('0x13')]===0x1f4){logger[_0x5f36('0x12')](_0x5f36('0xe'),_0xe8b4df,_0x124bec[_0x5f36('0x12')]['message']);return _0x554745(_0x124bec['error'][_0x5f36('0x14')]);}logger[_0x5f36('0x12')](_0x5f36('0xe'),_0xe8b4df,_0x124bec[_0x5f36('0x12')][_0x5f36('0x14')]);return _0x3bf39d(_0x124bec['error'][_0x5f36('0x14')]);}else{logger['info'](_0x5f36('0xe'),_0xe8b4df,_0x5f36('0xf'));_0x3bf39d(_0x124bec['result'][_0x5f36('0x14')]);}})[_0x5f36('0x15')](function(_0x417cac){logger['error'](_0x5f36('0xe'),_0xe8b4df,_0x417cac);_0x554745(_0x417cac);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index eb80df1..d845f61 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 _0xcac2=['clone','addSections','/:id/resources','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','show','/:id/sections','getSections','getResources','create','post'];(function(_0x17ce0d,_0x56e494){var _0x3cfefc=function(_0x44c69b){while(--_0x44c69b){_0x17ce0d['push'](_0x17ce0d['shift']());}};_0x3cfefc(++_0x56e494);}(_0xcac2,0x12c));var _0x2cac=function(_0x15c520,_0x197d0a){_0x15c520=_0x15c520-0x0;var _0x3b91cf=_0xcac2[_0x15c520];return _0x3b91cf;};'use strict';var multer=require('multer');var util=require(_0x2cac('0x0'));var path=require(_0x2cac('0x1'));var timeout=require(_0x2cac('0x2'));var express=require(_0x2cac('0x3'));var router=express[_0x2cac('0x4')]();var fs_extra=require(_0x2cac('0x5'));var auth=require(_0x2cac('0x6'));var interaction=require(_0x2cac('0x7'));var config=require(_0x2cac('0x8'));var controller=require(_0x2cac('0x9'));router[_0x2cac('0xa')]('/',auth[_0x2cac('0xb')](),controller['index']);router['get'](_0x2cac('0xc'),auth['isAuthenticated'](),controller[_0x2cac('0xd')]);router[_0x2cac('0xa')]('/:id',auth[_0x2cac('0xb')](),controller[_0x2cac('0xe')]);router[_0x2cac('0xa')](_0x2cac('0xf'),auth[_0x2cac('0xb')](),controller[_0x2cac('0x10')]);router[_0x2cac('0xa')]('/:id/resources',auth[_0x2cac('0xb')](),controller[_0x2cac('0x11')]);router['post']('/',auth[_0x2cac('0xb')](),controller[_0x2cac('0x12')]);router[_0x2cac('0x13')]('/:id/clone',auth[_0x2cac('0xb')](),controller[_0x2cac('0x14')]);router[_0x2cac('0x13')](_0x2cac('0xf'),auth[_0x2cac('0xb')](),controller[_0x2cac('0x15')]);router['post'](_0x2cac('0x16'),auth[_0x2cac('0xb')](),controller[_0x2cac('0x17')]);router[_0x2cac('0x18')](_0x2cac('0x19'),auth[_0x2cac('0xb')](),controller[_0x2cac('0x1a')]);router[_0x2cac('0x1b')](_0x2cac('0x19'),auth[_0x2cac('0xb')](),controller[_0x2cac('0x1c')]);router['delete'](_0x2cac('0xf'),auth[_0x2cac('0xb')](),controller[_0x2cac('0x1d')]);router[_0x2cac('0x1b')]('/:id/resources',auth[_0x2cac('0xb')](),controller[_0x2cac('0x1e')]);module[_0x2cac('0x1f')]=router; \ No newline at end of file +var _0xe58b=['/:id/resources','put','update','delete','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections'];(function(_0x3feccc,_0x5534c7){var _0x2c13b5=function(_0x59a2cd){while(--_0x59a2cd){_0x3feccc['push'](_0x3feccc['shift']());}};_0x2c13b5(++_0x5534c7);}(_0xe58b,0x17b));var _0xbe58=function(_0x533b60,_0x4f121c){_0x533b60=_0x533b60-0x0;var _0x3ba02f=_0xe58b[_0x533b60];return _0x3ba02f;};'use strict';var multer=require('multer');var util=require(_0xbe58('0x0'));var path=require(_0xbe58('0x1'));var timeout=require(_0xbe58('0x2'));var express=require(_0xbe58('0x3'));var router=express[_0xbe58('0x4')]();var fs_extra=require(_0xbe58('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbe58('0x6'));var config=require(_0xbe58('0x7'));var controller=require(_0xbe58('0x8'));router[_0xbe58('0x9')]('/',auth[_0xbe58('0xa')](),controller[_0xbe58('0xb')]);router[_0xbe58('0x9')](_0xbe58('0xc'),auth[_0xbe58('0xa')](),controller[_0xbe58('0xd')]);router[_0xbe58('0x9')](_0xbe58('0xe'),auth[_0xbe58('0xa')](),controller[_0xbe58('0xf')]);router[_0xbe58('0x9')](_0xbe58('0x10'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x11')]);router[_0xbe58('0x9')]('/:id/resources',auth[_0xbe58('0xa')](),controller[_0xbe58('0x12')]);router[_0xbe58('0x13')]('/',auth[_0xbe58('0xa')](),controller[_0xbe58('0x14')]);router[_0xbe58('0x13')](_0xbe58('0x15'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x16')]);router[_0xbe58('0x13')](_0xbe58('0x10'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x17')]);router[_0xbe58('0x13')](_0xbe58('0x18'),auth['isAuthenticated'](),controller['addResources']);router[_0xbe58('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xbe58('0x1a')]);router[_0xbe58('0x1b')](_0xbe58('0xe'),auth[_0xbe58('0xa')](),controller['destroy']);router[_0xbe58('0x1b')](_0xbe58('0x10'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x1c')]);router[_0xbe58('0x1b')](_0xbe58('0x18'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x1d')]);module[_0xbe58('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index ddf4218..310c793 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 _0x5cd3=['name','setDataValue','crudPermissions','join','BOOLEAN','sequelize','STRING'];(function(_0x529d98,_0x12f54a){var _0x5a23fd=function(_0x50511d){while(--_0x50511d){_0x529d98['push'](_0x529d98['shift']());}};_0x5a23fd(++_0x12f54a);}(_0x5cd3,0xfa));var _0x35cd=function(_0x55e92d,_0x2d4e7a){_0x55e92d=_0x55e92d-0x0;var _0x21e2e5=_0x5cd3[_0x55e92d];return _0x21e2e5;};'use strict';var Sequelize=require(_0x35cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x35cd('0x1')],'allowNull':![],'unique':_0x35cd('0x2')},'crudPermissions':{'type':Sequelize[_0x35cd('0x1')],'set':function(_0x10db9b){this[_0x35cd('0x3')](_0x35cd('0x4'),_0x10db9b?_0x10db9b[_0x35cd('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x35cd('0x4'))?this['getDataValue'](_0x35cd('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x35cd('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x35cd('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x35cd('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x35cd('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x35cd('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x35cd('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x35cd('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd606=['BOOLEAN','exports','STRING','setDataValue','crudPermissions','getDataValue','split'];(function(_0x22d623,_0x34de81){var _0x2b0105=function(_0x3b5053){while(--_0x3b5053){_0x22d623['push'](_0x22d623['shift']());}};_0x2b0105(++_0x34de81);}(_0xd606,0x190));var _0x6d60=function(_0x5d09f0,_0x465f05){_0x5d09f0=_0x5d09f0-0x0;var _0x56a145=_0xd606[_0x5d09f0];return _0x56a145;};'use strict';var Sequelize=require('sequelize');module[_0x6d60('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x6d60('0x1')],'set':function(_0x3a3d8a){this[_0x6d60('0x2')](_0x6d60('0x3'),_0x3a3d8a?_0x3a3d8a['join'](''):[]);},'get':function(){return this[_0x6d60('0x4')](_0x6d60('0x3'))?this[_0x6d60('0x4')](_0x6d60('0x3'))[_0x6d60('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f33714f..95e192c 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 _0x852d=['save','update','then','error','name','send','index','map','UserProfile','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','length','includeAll','find','create','get','omit','createdAt','updatedAt','body','sequelize','transaction','each','autoAssociation','userProfileId','Resources','UserProfileSection','UserProfileResource','destroy','describe','addSections','push','removeSections','ids','getSections','enabled','includes','sectionId','isEmpty','subsections','concat','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x852d,0x190));var _0xd852=function(_0x21d833,_0x2ceace){_0x21d833=_0x21d833-0x0;var _0x3b1d3e=_0x852d[_0x21d833];return _0x3b1d3e;};'use strict';var emlformat=require(_0xd852('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd852('0x1'));var rp=require(_0xd852('0x2'));var moment=require('moment');var BPromise=require(_0xd852('0x3'));var Mustache=require(_0xd852('0x4'));var util=require('util');var path=require(_0xd852('0x5'));var sox=require('sox');var csv=require(_0xd852('0x6'));var ejs=require(_0xd852('0x7'));var fs=require('fs');var fs_extra=require(_0xd852('0x8'));var _=require(_0xd852('0x9'));var squel=require('squel');var crypto=require(_0xd852('0xa'));var jsforce=require(_0xd852('0xb'));var deskjs=require(_0xd852('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd852('0xd'));var Redis=require(_0xd852('0xe'));var authService=require(_0xd852('0xf'));var qs=require(_0xd852('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd852('0x11'));var logger=require(_0xd852('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd852('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd852('0x14'))['db'];config[_0xd852('0x15')]=_[_0xd852('0x16')](config[_0xd852('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xd852('0x17'))(new Redis(config[_0xd852('0x15')]));require(_0xd852('0x18'))[_0xd852('0x19')](socket);function respondWithStatusCode(_0x4e50b7,_0x45223a){_0x45223a=_0x45223a||0xcc;return function(_0x3f30ad){if(_0x3f30ad){return _0x4e50b7[_0xd852('0x1a')](_0x45223a);}return _0x4e50b7[_0xd852('0x1b')](_0x45223a)[_0xd852('0x1c')]();};}function respondWithResult(_0x54ec26,_0x3df65b){_0x3df65b=_0x3df65b||0xc8;return function(_0x20786f){if(_0x20786f){return _0x54ec26[_0xd852('0x1b')](_0x3df65b)['json'](_0x20786f);}};}function respondWithFilteredResult(_0x44b4ed,_0x3f1353){return function(_0x586f97){if(_0x586f97){var _0x2cb66b=typeof _0x3f1353[_0xd852('0x1d')]===_0xd852('0x1e')&&typeof _0x3f1353['limit']==='undefined';var _0x37bce5=_0x586f97[_0xd852('0x1f')];var _0xa46bc1=_0x2cb66b?0x0:_0x3f1353[_0xd852('0x1d')];var _0x7d37f4=_0x2cb66b?_0x586f97[_0xd852('0x1f')]:_0x3f1353[_0xd852('0x1d')]+_0x3f1353['limit'];var _0x1362c3;if(_0x7d37f4>=_0x37bce5){_0x7d37f4=_0x37bce5;_0x1362c3=0xc8;}else{_0x1362c3=0xce;}_0x44b4ed[_0xd852('0x1b')](_0x1362c3);return _0x44b4ed[_0xd852('0x20')](_0xd852('0x21'),_0xa46bc1+'-'+_0x7d37f4+'/'+_0x37bce5)['json'](_0x586f97);}return null;};}function patchUpdates(_0x5c55b6){return function(_0x26d667){try{jsonpatch[_0xd852('0x22')](_0x26d667,_0x5c55b6,!![]);}catch(_0x4bb2a0){return BPromise[_0xd852('0x23')](_0x4bb2a0);}return _0x26d667[_0xd852('0x24')]();};}function saveUpdates(_0x55c00c,_0x1ceb55){return function(_0x316cfd){if(_0x316cfd){return _0x316cfd[_0xd852('0x25')](_0x55c00c)[_0xd852('0x26')](function(_0x4cd1ef){return _0x4cd1ef;});}return null;};}function removeEntity(_0x294ab4,_0x296b94){return function(_0x5e5bdf){if(_0x5e5bdf){return _0x5e5bdf['destroy']()[_0xd852('0x26')](function(){_0x294ab4['status'](0xcc)[_0xd852('0x1c')]();});}};}function handleEntityNotFound(_0xd3009,_0x2c27c6){return function(_0x330b36){if(!_0x330b36){_0xd3009[_0xd852('0x1a')](0x194);}return _0x330b36;};}function handleError(_0xa2decd,_0x4b2b47){_0x4b2b47=_0x4b2b47||0x1f4;return function(_0x3500d2){logger[_0xd852('0x27')](_0x3500d2['stack']);if(_0x3500d2[_0xd852('0x28')]){delete _0x3500d2[_0xd852('0x28')];}_0xa2decd['status'](_0x4b2b47)[_0xd852('0x29')](_0x3500d2);};}exports[_0xd852('0x2a')]=function(_0x3d9952,_0x2f4bd6){var _0x26ea90={},_0x575dc6={},_0x57563b={'count':0x0,'rows':[]};var _0x471eff=_[_0xd852('0x2b')](db[_0xd852('0x2c')][_0xd852('0x2d')],function(_0x2b2fbc){return{'name':_0x2b2fbc['fieldName'],'type':_0x2b2fbc['type'][_0xd852('0x2e')]};});_0x575dc6[_0xd852('0x2f')]=_[_0xd852('0x2b')](_0x471eff,_0xd852('0x28'));_0x575dc6[_0xd852('0x30')]=_[_0xd852('0x31')](_0x3d9952[_0xd852('0x30')]);_0x575dc6[_0xd852('0x32')]=_['intersection'](_0x575dc6[_0xd852('0x2f')],_0x575dc6[_0xd852('0x30')]);_0x26ea90['attributes']=_[_0xd852('0x33')](_0x575dc6['model'],qs[_0xd852('0x34')](_0x3d9952[_0xd852('0x30')]['fields']));_0x26ea90['attributes']=_0x26ea90[_0xd852('0x35')]['length']?_0x26ea90[_0xd852('0x35')]:_0x575dc6[_0xd852('0x2f')];if(!_0x3d9952['query'][_0xd852('0x36')](_0xd852('0x37'))){_0x26ea90[_0xd852('0x38')]=qs['limit'](_0x3d9952[_0xd852('0x30')][_0xd852('0x38')]);_0x26ea90[_0xd852('0x1d')]=qs[_0xd852('0x1d')](_0x3d9952[_0xd852('0x30')][_0xd852('0x1d')]);}_0x26ea90['order']=qs['sort'](_0x3d9952['query'][_0xd852('0x39')]);_0x26ea90[_0xd852('0x3a')]=qs[_0xd852('0x32')](_[_0xd852('0x3b')](_0x3d9952[_0xd852('0x30')],_0x575dc6[_0xd852('0x32')]),_0x471eff);if(_0x3d9952['query']['filter']){_0x26ea90[_0xd852('0x3a')]=_['merge'](_0x26ea90[_0xd852('0x3a')],{'$or':_[_0xd852('0x2b')](_0x471eff,function(_0x4952e3){if(_0x4952e3['type']!=='VIRTUAL'){var _0x23bed7={};_0x23bed7[_0x4952e3[_0xd852('0x28')]]={'$like':'%'+_0x3d9952[_0xd852('0x30')][_0xd852('0x3c')]+'%'};return _0x23bed7;}})});}_0x26ea90=_[_0xd852('0x3d')]({},_0x26ea90,_0x3d9952[_0xd852('0x3e')]);var _0x3c5e84={'where':_0x26ea90[_0xd852('0x3a')]};return db[_0xd852('0x2c')][_0xd852('0x1f')](_0x3c5e84)[_0xd852('0x26')](function(_0x424151){_0x57563b[_0xd852('0x1f')]=_0x424151;if(_0x3d9952['query']['includeAll']){_0x26ea90[_0xd852('0x3f')]=[{'all':!![]}];}return db[_0xd852('0x2c')][_0xd852('0x40')](_0x26ea90);})[_0xd852('0x26')](function(_0x3f4543){_0x57563b['rows']=_0x3f4543;return _0x57563b;})[_0xd852('0x26')](respondWithFilteredResult(_0x2f4bd6,_0x26ea90))[_0xd852('0x41')](handleError(_0x2f4bd6,null));};exports[_0xd852('0x42')]=function(_0x390d05,_0x467ecb){var _0x159949={'raw':![],'where':{'id':_0x390d05[_0xd852('0x43')]['id']}},_0x117687={};_0x117687[_0xd852('0x2f')]=_[_0xd852('0x31')](db[_0xd852('0x2c')][_0xd852('0x2d')]);_0x117687[_0xd852('0x30')]=_[_0xd852('0x31')](_0x390d05['query']);_0x117687[_0xd852('0x32')]=_[_0xd852('0x33')](_0x117687[_0xd852('0x2f')],_0x117687[_0xd852('0x30')]);_0x159949[_0xd852('0x35')]=_[_0xd852('0x33')](_0x117687['model'],qs[_0xd852('0x34')](_0x390d05[_0xd852('0x30')][_0xd852('0x34')]));_0x159949[_0xd852('0x35')]=_0x159949[_0xd852('0x35')][_0xd852('0x44')]?_0x159949['attributes']:_0x117687['model'];if(_0x390d05[_0xd852('0x30')][_0xd852('0x45')]){_0x159949[_0xd852('0x3f')]=[{'all':!![]}];}_0x159949=_[_0xd852('0x3d')]({},_0x159949,_0x390d05['options']);return db[_0xd852('0x2c')][_0xd852('0x46')](_0x159949)[_0xd852('0x26')](handleEntityNotFound(_0x467ecb,null))[_0xd852('0x26')](respondWithResult(_0x467ecb,null))[_0xd852('0x41')](handleError(_0x467ecb,null));};exports['create']=function(_0x59f7ab,_0x287171){return db['UserProfile'][_0xd852('0x47')](_0x59f7ab['body'],{})[_0xd852('0x26')](respondWithResult(_0x287171,0xc9))[_0xd852('0x41')](handleError(_0x287171,null));};exports['clone']=function(_0x2416d2,_0x3a3bed){var _0x340728={'where':{'id':_0x2416d2[_0xd852('0x43')]['id']}},_0x3fda53={};_0x3fda53[_0xd852('0x2f')]=_[_0xd852('0x31')](db[_0xd852('0x2c')]['rawAttributes']);_0x340728[_0xd852('0x35')]=_[_0xd852('0x33')](_0x3fda53['model'],qs['fields'](_0x2416d2[_0xd852('0x30')]['fields']));_0x340728[_0xd852('0x35')]=_0x340728[_0xd852('0x35')][_0xd852('0x44')]?_0x340728['attributes']:_0x3fda53[_0xd852('0x2f')];if(_0x2416d2[_0xd852('0x30')][_0xd852('0x45')]){_0x340728['include']=[{'all':!![]}];}_0x340728=_['merge']({},_0x340728,_0x2416d2[_0xd852('0x3e')]);return db[_0xd852('0x2c')]['find'](_0x340728)[_0xd852('0x26')](handleEntityNotFound(_0x3a3bed,null))[_0xd852('0x26')](function(_0x18c8da){if(_0x18c8da){var _0x55862d=_0x18c8da[_0xd852('0x48')]({'plain':!![]});_0x55862d=qs[_0xd852('0x49')](_0x55862d,['id',_0xd852('0x4a'),_0xd852('0x4b'),'crudPermissions']);_0x2416d2['body']=_[_0xd852('0x49')](_0x2416d2[_0xd852('0x4c')],['id',_0xd852('0x4a'),_0xd852('0x4b')]);return db[_0xd852('0x4d')][_0xd852('0x4e')](function(_0x4710b3){return db[_0xd852('0x2c')][_0xd852('0x47')](_[_0xd852('0x3d')](_0x55862d,_0x2416d2['body']),{'include':_0x2416d2[_0xd852('0x30')][_0xd852('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x4710b3})[_0xd852('0x26')](function(_0x90074){var _0x3d186d=_0x90074[_0xd852('0x48')]({'plain':!![]});return db['UserProfileSection'][_0xd852('0x40')]({'where':{'userProfileId':_0x2416d2[_0xd852('0x43')]['id']},'raw':!![]})[_0xd852('0x26')](function(_0x37b3ea){if(_0x37b3ea){return BPromise[_0xd852('0x4f')](_0x37b3ea,function(_0x1896a6){return new BPromise(function(_0x10624e,_0x54051f){if(_0x1896a6['autoAssociation']===null||_0x1896a6[_0xd852('0x50')]===0x1)_0x10624e(null);return db['UserProfileResource'][_0xd852('0x40')]({'where':{'sectionId':_0x1896a6['id']},'raw':!![]})[_0xd852('0x26')](function(_0x1388c5){var _0x1eeae3=_[_0xd852('0x2b')](_0x1388c5,function(_0x871546){return qs[_0xd852('0x49')](_0x871546,['id',_0xd852('0x4a'),_0xd852('0x4b'),'sectionId']);});_0x10624e(_0x1eeae3);})[_0xd852('0x41')](function(_0x203fac){_0x54051f(_0x203fac);});})['then'](function(_0x1d6a2d){var _0x35c913=qs[_0xd852('0x49')](_0x1896a6,['id','createdAt',_0xd852('0x4b')]);_0x35c913[_0xd852('0x51')]=_0x3d186d['id'];if(_0x1d6a2d)_0x35c913[_0xd852('0x52')]=_0x1d6a2d;return _0x35c913;})[_0xd852('0x26')](function(_0x409fbd){return db[_0xd852('0x53')][_0xd852('0x47')](_0x409fbd,{'include':[{'model':db[_0xd852('0x54')],'as':'Resources'}],'raw':!![],'transaction':_0x4710b3});});})[_0xd852('0x26')](function(){return _0x3d186d;});}});});});}})['then'](respondWithResult(_0x3a3bed,0xc9))['catch'](handleError(_0x3a3bed,null));};exports[_0xd852('0x25')]=function(_0x58061b,_0x39c1f1){if(_0x58061b[_0xd852('0x4c')]['id']){delete _0x58061b['body']['id'];}return db[_0xd852('0x2c')]['find']({'where':{'id':_0x58061b[_0xd852('0x43')]['id']}})[_0xd852('0x26')](handleEntityNotFound(_0x39c1f1,null))[_0xd852('0x26')](saveUpdates(_0x58061b['body'],null))[_0xd852('0x26')](respondWithResult(_0x39c1f1,null))[_0xd852('0x41')](handleError(_0x39c1f1,null));};exports[_0xd852('0x55')]=function(_0x3c7c81,_0x2f3e45){return db['UserProfile'][_0xd852('0x46')]({'where':{'id':_0x3c7c81['params']['id']}})[_0xd852('0x26')](handleEntityNotFound(_0x2f3e45,null))['then'](removeEntity(_0x2f3e45,null))[_0xd852('0x41')](handleError(_0x2f3e45,null));};exports[_0xd852('0x56')]=function(_0x54f629,_0x25a99c){return db['UserProfile'][_0xd852('0x56')]()[_0xd852('0x26')](respondWithResult(_0x25a99c,null))[_0xd852('0x41')](handleError(_0x25a99c,null));};exports[_0xd852('0x57')]=function(_0x468fc9,_0x477d41){var _0x2892a8=_0x468fc9[_0xd852('0x4c')];return db[_0xd852('0x2c')][_0xd852('0x46')]({'where':{'id':_0x468fc9[_0xd852('0x43')]['id']}})['then'](handleEntityNotFound(_0x477d41,null))[_0xd852('0x26')](function(_0x2ffe55){if(_0x2ffe55){return db[_0xd852('0x4d')][_0xd852('0x4e')](function(_0x3178cc){return db[_0xd852('0x53')][_0xd852('0x55')]({'where':{'userProfileId':_0x468fc9[_0xd852('0x43')]['id'],'sectionId':_[_0xd852('0x2b')](_0x2892a8,function(_0x159733){return _0x159733['sectionId'];})},'transaction':_0x3178cc})[_0xd852('0x26')](function(){var _0x5068bc=_['map'](_0x2892a8,function(_0x4c99e4){_0x4c99e4['userProfileId']=_0x468fc9[_0xd852('0x43')]['id'];return _0x4c99e4;});var _0x1aec05=[];return BPromise[_0xd852('0x4f')](_0x5068bc,function(_0x376aea){return db[_0xd852('0x53')][_0xd852('0x47')](_0x376aea,{'include':[{'model':db['UserProfileResource'],'as':_0xd852('0x52')}],'raw':!![],'transaction':_0x3178cc})['then'](function(_0x4d0d45){_0x1aec05[_0xd852('0x58')](_0x4d0d45['get']({'plain':!![]}));});})[_0xd852('0x26')](function(){return _0x1aec05;});});});}})['then'](function(_0x3913b1){return _0x3913b1;})['then'](respondWithResult(_0x477d41,null))[_0xd852('0x41')](handleError(_0x477d41,null));};exports[_0xd852('0x59')]=function(_0x372317,_0x4bfeb6){var _0xac94be;return db[_0xd852('0x2c')][_0xd852('0x46')]({'where':{'id':_0x372317[_0xd852('0x43')]['id']},'attributes':['id',_0xd852('0x28')]})[_0xd852('0x26')](handleEntityNotFound(_0x4bfeb6,null))['then'](function(_0x3c0555){if(_0x3c0555){_0xac94be=_0x3c0555;return db[_0xd852('0x53')][_0xd852('0x55')]({'where':{'userProfileId':_0x372317[_0xd852('0x43')]['id'],'sectionId':_0x372317[_0xd852('0x30')][_0xd852('0x5a')]}});}})[_0xd852('0x26')](function(){return _0xac94be;})[_0xd852('0x26')](respondWithStatusCode(_0x4bfeb6,null))[_0xd852('0x41')](handleError(_0x4bfeb6,null));};exports[_0xd852('0x5b')]=function(_0xfaaebb,_0xb2f689){var _0x3039e9=[];var _0x7172a3=[];return db[_0xd852('0x53')][_0xd852('0x40')]({'where':{'userProfileId':_0xfaaebb[_0xd852('0x43')]['id']},'raw':!![]})[_0xd852('0x26')](function(_0x4b1903){_0x3039e9=_[_0xd852('0x3c')](_0x4b1903,function(_0x40e241){return _0x40e241[_0xd852('0x5c')]===0x1||_[_0xd852('0x5d')]([0x3eb,0x709],_0x40e241[_0xd852('0x5e')]);});if(!_[_0xd852('0x5f')](_0x3039e9)){return _[_0xd852('0x2b')](_0x3039e9,function(_0x3feaad){return _0x3feaad['sectionId'];});}else{return;}})[_0xd852('0x26')](function(_0x1d835){if(_0x1d835)_0x7172a3=_0x1d835;if(_[_0xd852('0x5d')](_0x7172a3,0x64)){var _0x2e03c7=_[_0xd852('0x46')](_0x3039e9,{'sectionId':0x64});return hasDefaultDashboard(_0x2e03c7)[_0xd852('0x26')](function(_0x63e7eb){return _[_0xd852('0x2b')](_0x3039e9,function(_0x494a70){if(_0x494a70['sectionId']===0x64){_0x494a70[_0xd852('0x60')]=_0x63e7eb;}return _0x494a70;});});}else{return;}})[_0xd852('0x26')](function(_0x1b2390){if(_0x1b2390)_0x3039e9=_0x1b2390;if(_[_0xd852('0x5d')](_0x7172a3,0x3eb)){var _0x50f9e4=_[_0xd852('0x46')](_0x3039e9,{'sectionId':0x3eb});return getCustomDashboards(_0x50f9e4)['then'](function(_0x473bb3){return _[_0xd852('0x2b')](_0x3039e9,function(_0x2a085c){if(_0x50f9e4[_0xd852('0x5c')]){if(_0x2a085c[_0xd852('0x5e')]===0x3eb){_0x2a085c[_0xd852('0x60')]=_0x473bb3;}}else{if(_0x2a085c[_0xd852('0x5e')]===0x64){if(!_0x2a085c['subsections']){_0x2a085c[_0xd852('0x60')]=[];}_0x2a085c['subsections']=_0x2a085c[_0xd852('0x60')][_0xd852('0x61')](_0x473bb3);}}return _0x2a085c;});});}else{return;}})[_0xd852('0x26')](function(_0x5757d6){if(_0x5757d6)_0x3039e9=_0x5757d6;if(_[_0xd852('0x5d')](_0x7172a3,0x709)){var _0x33a4d6=_['find'](_0x3039e9,{'sectionId':0x709});return getPlugins(_0x33a4d6)[_0xd852('0x26')](function(_0x4dcf26){if(_0x33a4d6[_0xd852('0x5c')]){return _[_0xd852('0x2b')](_0x3039e9,function(_0x2f8899){if(_0x2f8899[_0xd852('0x5e')]===0x709){_0x2f8899[_0xd852('0x60')]=_0x4dcf26;}return _0x2f8899;});}else{var _0x49a786={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4dcf26};var _0x196a93=_[_0xd852('0x2b')](_0x3039e9);_0x196a93[_0xd852('0x58')](_0x49a786);return _0x196a93;}});}else{return;}})[_0xd852('0x26')](function(_0x555851){if(_0x555851)_0x3039e9=_0x555851;return _[_0xd852('0x3c')](_0x3039e9,[_0xd852('0x5c'),0x1]);})[_0xd852('0x26')](respondWithResult(_0xb2f689,null))[_0xd852('0x41')](handleError(_0xb2f689,null));};function hasDefaultDashboard(_0x492d93){var _0x11758d=[0x65];return new BPromise(function(_0x155157,_0xd6ca42){try{if(_0x492d93['autoAssociation']){_0x155157(_0x11758d);}else{return db['UserProfileResource'][_0xd852('0x62')]({'where':{'sectionId':_0x492d93['id']},'raw':!![]})[_0xd852('0x26')](function(_0x512b12){_0x512b12?_0x155157(_0x11758d):_0x155157();});}}catch(_0x5bf1dc){_0xd6ca42(_0x5bf1dc);}});}function getCustomDashboards(_0x28e612){var _0x421899=[];return new BPromise(function(_0x37d1d3,_0x2aff9a){try{if(_0x28e612[_0xd852('0x50')]){return db['Dashboard'][_0xd852('0x40')]({'raw':!![]})[_0xd852('0x26')](function(_0x327d76){_0x327d76[_0xd852('0x63')](function(_0x4a3b63){_0x421899['push'](_0x4a3b63['id']+0x1869f);});_0x37d1d3(_0x421899);});}else{return db[_0xd852('0x54')][_0xd852('0x40')]({'where':{'sectionId':_0x28e612['id']},'raw':!![]})[_0xd852('0x26')](function(_0x19389a){_0x19389a['forEach'](function(_0x5bd8e8){_0x421899[_0xd852('0x58')](_0x5bd8e8[_0xd852('0x64')]+0x1869f);});_0x37d1d3(_0x421899);});}}catch(_0x5eeb07){_0x2aff9a(_0x5eeb07);}});}function getPlugins(_0x453040){var _0x3c4793=[];return new BPromise(function(_0x3437b9,_0x5f62af){try{if(_0x453040['autoAssociation']){return db[_0xd852('0x65')][_0xd852('0x40')]({'raw':!![]})[_0xd852('0x26')](function(_0x16be81){_0x16be81[_0xd852('0x63')](function(_0x281538){_0x3c4793['push'](_0x281538['id']+0x15b38);});_0x3437b9(_0x3c4793);});}else{return db[_0xd852('0x54')]['findAll']({'where':{'sectionId':_0x453040['id']},'raw':!![]})[_0xd852('0x26')](function(_0x440806){_0x440806['forEach'](function(_0x5067c1){_0x3c4793['push'](_0x5067c1[_0xd852('0x64')]+0x15b38);});_0x3437b9(_0x3c4793);});}}catch(_0x298087){_0x5f62af(_0x298087);}});}exports[_0xd852('0x66')]=function(_0x3e79aa,_0x26858d){return db['UserProfile'][_0xd852('0x46')]({'where':{'id':_0x3e79aa[_0xd852('0x43')]['id']}})[_0xd852('0x26')](handleEntityNotFound(_0x26858d,null))[_0xd852('0x26')](function(_0x31d095){if(_0x31d095){return db['sequelize'][_0xd852('0x4e')](function(_0x1143a5){return db[_0xd852('0x53')]['findAll']({'where':{'userProfileId':_0x3e79aa[_0xd852('0x43')]['id']},'attributes':['id'],'raw':!![]})[_0xd852('0x26')](function(_0x1043c8){if(_0x1043c8){return db[_0xd852('0x53')][_0xd852('0x55')]({'where':{'userProfileId':_0x3e79aa[_0xd852('0x43')]['id'],'id':_['map'](_0x1043c8,function(_0x1f3276){return _0x1f3276['id'];})},'transaction':_0x1143a5});}})[_0xd852('0x26')](function(_0x25de58){var _0x264dcd=_[_0xd852('0x2b')](_0x3e79aa[_0xd852('0x4c')],function(_0xc2d40e){_0xc2d40e[_0xd852('0x51')]=_0x3e79aa[_0xd852('0x43')]['id'];return _0xc2d40e;});return db[_0xd852('0x53')][_0xd852('0x67')](_0x264dcd,{'raw':!![],'transaction':_0x1143a5});})[_0xd852('0x26')](function(_0x39317b){var _0x1115af=_['filter'](_[_0xd852('0x2b')](_0x39317b,function(_0x32551d){return _0x32551d[_0xd852('0x48')]({'plain':!![]});}),{'includeAll':![]});if(_0x1115af){return db[_0xd852('0x53')][_0xd852('0x40')]({'where':{'userProfileId':_0x3e79aa[_0xd852('0x43')]['id'],'sectionId':_[_0xd852('0x2b')](_0x1115af,function(_0x4fa5fd){return _0x4fa5fd[_0xd852('0x5e')];})},'attributes':['id',_0xd852('0x5e')],'raw':!![]})[_0xd852('0x26')](function(_0x385eb0){var _0xa816dc=_[_0xd852('0x2b')](_0x3e79aa[_0xd852('0x4c')],function(_0x1fd363){_0x1fd363[_0xd852('0x51')]=_0x3e79aa['params']['id'];return _0x1fd363;});return db[_0xd852('0x54')][_0xd852('0x67')](_0xa816dc,{'raw':!![],'transaction':_0x1143a5});});}})[_0xd852('0x41')](handleError(_0x26858d,null));});}})['then'](function(_0x21a91d){var _0x315a44=_[_0xd852('0x2b')](_0x21a91d,function(_0x3868b2){return _0x3868b2[_0xd852('0x48')]({'plain':!![]});});})[_0xd852('0x26')](respondWithResult(_0x26858d,null))[_0xd852('0x41')](handleError(_0x26858d,null));};exports[_0xd852('0x68')]=function(_0x451435,_0x2e2bf2,_0x489a94){return db['UserProfile'][_0xd852('0x46')]({'where':{'id':_0x451435[_0xd852('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e2bf2,null))['then'](function(_0x1a066a){if(_0x1a066a){return _0x1a066a[_0xd852('0x68')](_0x451435[_0xd852('0x30')][_0xd852('0x5a')]);}})[_0xd852('0x26')](respondWithStatusCode(_0x2e2bf2,null))[_0xd852('0x41')](handleError(_0x2e2bf2,null));};exports['getResources']=function(_0xe25856,_0x4a5e0b){var _0x22835c={};if(!_0xe25856[_0xd852('0x30')][_0xd852('0x69')])throw new Error(_0xd852('0x6a'));if(!_0xe25856['query']['hasOwnProperty']('nolimit')){_0x22835c['limit']=qs['limit'](_0xe25856[_0xd852('0x30')][_0xd852('0x38')]);_0x22835c['offset']=qs[_0xd852('0x1d')](_0xe25856['query'][_0xd852('0x1d')]);}return db[_0xd852('0x2c')][_0xd852('0x46')]({'where':{'id':_0xe25856[_0xd852('0x43')]['id']}})[_0xd852('0x26')](function(_0x3a873b){if(!_0x3a873b)throw new Error(_0xd852('0x6b')+_0xe25856['params']['id']);return db[_0xd852('0x2c')][_0xd852('0x6c')](_0xe25856);})[_0xd852('0x26')](respondWithFilteredResult(_0x4a5e0b,_0x22835c))['catch'](handleError(_0x4a5e0b,null));}; \ No newline at end of file +var _0x7738=['omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','Resources','describe','destroy','sectionId','userProfileId','each','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','Dashboard','forEach','resourceId','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','UserProfile','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','clone','get'];(function(_0xfaaea7,_0xa69add){var _0x1280f3=function(_0x49bb16){while(--_0x49bb16){_0xfaaea7['push'](_0xfaaea7['shift']());}};_0x1280f3(++_0xa69add);}(_0x7738,0x1df));var _0x8773=function(_0x38a9cb,_0xfd8b2b){_0x38a9cb=_0x38a9cb-0x0;var _0xfa7687=_0x7738[_0x38a9cb];return _0xfa7687;};'use strict';var emlformat=require(_0x8773('0x0'));var rimraf=require(_0x8773('0x1'));var zipdir=require(_0x8773('0x2'));var jsonpatch=require(_0x8773('0x3'));var rp=require('request-promise');var moment=require(_0x8773('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8773('0x5'));var util=require(_0x8773('0x6'));var path=require(_0x8773('0x7'));var sox=require(_0x8773('0x8'));var csv=require(_0x8773('0x9'));var ejs=require(_0x8773('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8773('0xb'));var squel=require(_0x8773('0xc'));var crypto=require('crypto');var jsforce=require(_0x8773('0xd'));var deskjs=require(_0x8773('0xe'));var toCsv=require(_0x8773('0x9'));var querystring=require(_0x8773('0xf'));var Papa=require(_0x8773('0x10'));var Redis=require('ioredis');var authService=require(_0x8773('0x11'));var qs=require(_0x8773('0x12'));var as=require(_0x8773('0x13'));var hardwareService=require(_0x8773('0x14'));var logger=require(_0x8773('0x15'))(_0x8773('0x16'));var utils=require(_0x8773('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x8773('0x18')],{'host':_0x8773('0x19'),'port':0x18eb});var socket=require(_0x8773('0x1a'))(new Redis(config[_0x8773('0x18')]));require(_0x8773('0x1b'))[_0x8773('0x1c')](socket);function respondWithStatusCode(_0x2d5947,_0x4402c4){_0x4402c4=_0x4402c4||0xcc;return function(_0x5b42aa){if(_0x5b42aa){return _0x2d5947[_0x8773('0x1d')](_0x4402c4);}return _0x2d5947[_0x8773('0x1e')](_0x4402c4)[_0x8773('0x1f')]();};}function respondWithResult(_0x38af38,_0x31be31){_0x31be31=_0x31be31||0xc8;return function(_0x382418){if(_0x382418){return _0x38af38['status'](_0x31be31)[_0x8773('0x20')](_0x382418);}};}function respondWithFilteredResult(_0x168e69,_0x4613b2){return function(_0x2d7e31){if(_0x2d7e31){var _0x59994e=typeof _0x4613b2[_0x8773('0x21')]===_0x8773('0x22')&&typeof _0x4613b2[_0x8773('0x23')]===_0x8773('0x22');var _0x4a5748=_0x2d7e31[_0x8773('0x24')];var _0x24a3d8=_0x59994e?0x0:_0x4613b2[_0x8773('0x21')];var _0x14e4f0=_0x59994e?_0x2d7e31['count']:_0x4613b2[_0x8773('0x21')]+_0x4613b2[_0x8773('0x23')];var _0x1e3a6a;if(_0x14e4f0>=_0x4a5748){_0x14e4f0=_0x4a5748;_0x1e3a6a=0xc8;}else{_0x1e3a6a=0xce;}_0x168e69['status'](_0x1e3a6a);return _0x168e69[_0x8773('0x25')](_0x8773('0x26'),_0x24a3d8+'-'+_0x14e4f0+'/'+_0x4a5748)[_0x8773('0x20')](_0x2d7e31);}return null;};}function patchUpdates(_0x533f90){return function(_0x622233){try{jsonpatch[_0x8773('0x27')](_0x622233,_0x533f90,!![]);}catch(_0x27fb3c){return BPromise[_0x8773('0x28')](_0x27fb3c);}return _0x622233[_0x8773('0x29')]();};}function saveUpdates(_0x34d887,_0x2becdf){return function(_0x5cbc8b){if(_0x5cbc8b){return _0x5cbc8b[_0x8773('0x2a')](_0x34d887)[_0x8773('0x2b')](function(_0x5e2f1f){return _0x5e2f1f;});}return null;};}function removeEntity(_0x2f68e9,_0x4e75d8){return function(_0x37f939){if(_0x37f939){return _0x37f939['destroy']()['then'](function(){_0x2f68e9[_0x8773('0x1e')](0xcc)[_0x8773('0x1f')]();});}};}function handleEntityNotFound(_0x36a4cf,_0x9a5a4f){return function(_0x5285f8){if(!_0x5285f8){_0x36a4cf[_0x8773('0x1d')](0x194);}return _0x5285f8;};}function handleError(_0x210d26,_0x421dd5){_0x421dd5=_0x421dd5||0x1f4;return function(_0x4313a7){logger[_0x8773('0x2c')](_0x4313a7['stack']);if(_0x4313a7[_0x8773('0x2d')]){delete _0x4313a7[_0x8773('0x2d')];}_0x210d26['status'](_0x421dd5)['send'](_0x4313a7);};}exports[_0x8773('0x2e')]=function(_0xdcfa1d,_0x434bed){var _0x2dfe6f={},_0x2b8360={},_0x143a00={'count':0x0,'rows':[]};var _0x5d6600=_[_0x8773('0x2f')](db['UserProfile']['rawAttributes'],function(_0x45bfb4){return{'name':_0x45bfb4['fieldName'],'type':_0x45bfb4[_0x8773('0x30')][_0x8773('0x31')]};});_0x2b8360[_0x8773('0x32')]=_[_0x8773('0x2f')](_0x5d6600,_0x8773('0x2d'));_0x2b8360['query']=_[_0x8773('0x33')](_0xdcfa1d[_0x8773('0x34')]);_0x2b8360[_0x8773('0x35')]=_[_0x8773('0x36')](_0x2b8360[_0x8773('0x32')],_0x2b8360['query']);_0x2dfe6f[_0x8773('0x37')]=_[_0x8773('0x36')](_0x2b8360[_0x8773('0x32')],qs[_0x8773('0x38')](_0xdcfa1d[_0x8773('0x34')][_0x8773('0x38')]));_0x2dfe6f[_0x8773('0x37')]=_0x2dfe6f['attributes'][_0x8773('0x39')]?_0x2dfe6f[_0x8773('0x37')]:_0x2b8360['model'];if(!_0xdcfa1d[_0x8773('0x34')][_0x8773('0x3a')](_0x8773('0x3b'))){_0x2dfe6f['limit']=qs[_0x8773('0x23')](_0xdcfa1d[_0x8773('0x34')][_0x8773('0x23')]);_0x2dfe6f[_0x8773('0x21')]=qs['offset'](_0xdcfa1d['query'][_0x8773('0x21')]);}_0x2dfe6f['order']=qs[_0x8773('0x3c')](_0xdcfa1d[_0x8773('0x34')]['sort']);_0x2dfe6f[_0x8773('0x3d')]=qs['filters'](_[_0x8773('0x3e')](_0xdcfa1d['query'],_0x2b8360[_0x8773('0x35')]),_0x5d6600);if(_0xdcfa1d[_0x8773('0x34')][_0x8773('0x3f')]){_0x2dfe6f[_0x8773('0x3d')]=_[_0x8773('0x40')](_0x2dfe6f[_0x8773('0x3d')],{'$or':_['map'](_0x5d6600,function(_0x4d53d6){if(_0x4d53d6[_0x8773('0x30')]!==_0x8773('0x41')){var _0x4a84c6={};_0x4a84c6[_0x4d53d6['name']]={'$like':'%'+_0xdcfa1d['query'][_0x8773('0x3f')]+'%'};return _0x4a84c6;}})});}_0x2dfe6f=_[_0x8773('0x40')]({},_0x2dfe6f,_0xdcfa1d[_0x8773('0x42')]);var _0x42156e={'where':_0x2dfe6f[_0x8773('0x3d')]};return db[_0x8773('0x43')]['count'](_0x42156e)['then'](function(_0x5d1c22){_0x143a00[_0x8773('0x24')]=_0x5d1c22;if(_0xdcfa1d['query'][_0x8773('0x44')]){_0x2dfe6f['include']=[{'all':!![]}];}return db[_0x8773('0x43')][_0x8773('0x45')](_0x2dfe6f);})[_0x8773('0x2b')](function(_0x3e3bce){_0x143a00[_0x8773('0x46')]=_0x3e3bce;return _0x143a00;})[_0x8773('0x2b')](respondWithFilteredResult(_0x434bed,_0x2dfe6f))['catch'](handleError(_0x434bed,null));};exports[_0x8773('0x47')]=function(_0xc3c99e,_0x1c7b4c){var _0x5873d3={'raw':![],'where':{'id':_0xc3c99e[_0x8773('0x48')]['id']}},_0xab5cb9={};_0xab5cb9[_0x8773('0x32')]=_[_0x8773('0x33')](db[_0x8773('0x43')][_0x8773('0x49')]);_0xab5cb9[_0x8773('0x34')]=_[_0x8773('0x33')](_0xc3c99e['query']);_0xab5cb9[_0x8773('0x35')]=_[_0x8773('0x36')](_0xab5cb9[_0x8773('0x32')],_0xab5cb9[_0x8773('0x34')]);_0x5873d3[_0x8773('0x37')]=_['intersection'](_0xab5cb9['model'],qs[_0x8773('0x38')](_0xc3c99e[_0x8773('0x34')][_0x8773('0x38')]));_0x5873d3[_0x8773('0x37')]=_0x5873d3['attributes'][_0x8773('0x39')]?_0x5873d3['attributes']:_0xab5cb9[_0x8773('0x32')];if(_0xc3c99e[_0x8773('0x34')][_0x8773('0x44')]){_0x5873d3[_0x8773('0x4a')]=[{'all':!![]}];}_0x5873d3=_[_0x8773('0x40')]({},_0x5873d3,_0xc3c99e[_0x8773('0x42')]);return db[_0x8773('0x43')][_0x8773('0x4b')](_0x5873d3)[_0x8773('0x2b')](handleEntityNotFound(_0x1c7b4c,null))['then'](respondWithResult(_0x1c7b4c,null))[_0x8773('0x4c')](handleError(_0x1c7b4c,null));};exports['create']=function(_0xf6e8fd,_0x57eb19){return db[_0x8773('0x43')][_0x8773('0x4d')](_0xf6e8fd[_0x8773('0x4e')],{})[_0x8773('0x2b')](respondWithResult(_0x57eb19,0xc9))[_0x8773('0x4c')](handleError(_0x57eb19,null));};exports[_0x8773('0x4f')]=function(_0x4ba7c6,_0x1aef4f){var _0x189cea={'where':{'id':_0x4ba7c6[_0x8773('0x48')]['id']}},_0xce690e={};_0xce690e['model']=_[_0x8773('0x33')](db[_0x8773('0x43')][_0x8773('0x49')]);_0x189cea[_0x8773('0x37')]=_[_0x8773('0x36')](_0xce690e[_0x8773('0x32')],qs['fields'](_0x4ba7c6[_0x8773('0x34')][_0x8773('0x38')]));_0x189cea[_0x8773('0x37')]=_0x189cea[_0x8773('0x37')][_0x8773('0x39')]?_0x189cea[_0x8773('0x37')]:_0xce690e[_0x8773('0x32')];if(_0x4ba7c6[_0x8773('0x34')][_0x8773('0x44')]){_0x189cea[_0x8773('0x4a')]=[{'all':!![]}];}_0x189cea=_['merge']({},_0x189cea,_0x4ba7c6[_0x8773('0x42')]);return db[_0x8773('0x43')]['find'](_0x189cea)[_0x8773('0x2b')](handleEntityNotFound(_0x1aef4f,null))[_0x8773('0x2b')](function(_0x20966a){if(_0x20966a){var _0x2b2762=_0x20966a[_0x8773('0x50')]({'plain':!![]});_0x2b2762=qs[_0x8773('0x51')](_0x2b2762,['id',_0x8773('0x52'),'updatedAt',_0x8773('0x53')]);_0x4ba7c6[_0x8773('0x4e')]=_[_0x8773('0x51')](_0x4ba7c6[_0x8773('0x4e')],['id',_0x8773('0x52'),_0x8773('0x54')]);return db[_0x8773('0x55')][_0x8773('0x56')](function(_0x4b0d83){return db['UserProfile']['create'](_[_0x8773('0x40')](_0x2b2762,_0x4ba7c6[_0x8773('0x4e')]),{'include':_0x4ba7c6[_0x8773('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4b0d83})['then'](function(_0x170ff7){var _0x3e64d2=_0x170ff7[_0x8773('0x50')]({'plain':!![]});return db[_0x8773('0x57')][_0x8773('0x45')]({'where':{'userProfileId':_0x4ba7c6['params']['id']},'raw':!![]})[_0x8773('0x2b')](function(_0x57de6d){if(_0x57de6d){return BPromise['each'](_0x57de6d,function(_0x16baf1){return new BPromise(function(_0x4cef36,_0x1acce1){if(_0x16baf1[_0x8773('0x58')]===null||_0x16baf1['autoAssociation']===0x1)_0x4cef36(null);return db['UserProfileResource'][_0x8773('0x45')]({'where':{'sectionId':_0x16baf1['id']},'raw':!![]})[_0x8773('0x2b')](function(_0xa68e00){var _0x538d06=_[_0x8773('0x2f')](_0xa68e00,function(_0x1c7214){return qs[_0x8773('0x51')](_0x1c7214,['id','createdAt',_0x8773('0x54'),'sectionId']);});_0x4cef36(_0x538d06);})[_0x8773('0x4c')](function(_0x226656){_0x1acce1(_0x226656);});})[_0x8773('0x2b')](function(_0x1d5bde){var _0xe60c9c=qs[_0x8773('0x51')](_0x16baf1,['id','createdAt',_0x8773('0x54')]);_0xe60c9c['userProfileId']=_0x3e64d2['id'];if(_0x1d5bde)_0xe60c9c['Resources']=_0x1d5bde;return _0xe60c9c;})[_0x8773('0x2b')](function(_0x5d7bfc){return db[_0x8773('0x57')]['create'](_0x5d7bfc,{'include':[{'model':db[_0x8773('0x59')],'as':_0x8773('0x5a')}],'raw':!![],'transaction':_0x4b0d83});});})[_0x8773('0x2b')](function(){return _0x3e64d2;});}});});});}})[_0x8773('0x2b')](respondWithResult(_0x1aef4f,0xc9))[_0x8773('0x4c')](handleError(_0x1aef4f,null));};exports[_0x8773('0x2a')]=function(_0x2bb8da,_0x5d56b2){if(_0x2bb8da[_0x8773('0x4e')]['id']){delete _0x2bb8da[_0x8773('0x4e')]['id'];}return db['UserProfile'][_0x8773('0x4b')]({'where':{'id':_0x2bb8da[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x5d56b2,null))[_0x8773('0x2b')](saveUpdates(_0x2bb8da[_0x8773('0x4e')],null))[_0x8773('0x2b')](respondWithResult(_0x5d56b2,null))['catch'](handleError(_0x5d56b2,null));};exports['destroy']=function(_0x125048,_0x3ae329){return db[_0x8773('0x43')][_0x8773('0x4b')]({'where':{'id':_0x125048[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x3ae329,null))[_0x8773('0x2b')](removeEntity(_0x3ae329,null))[_0x8773('0x4c')](handleError(_0x3ae329,null));};exports[_0x8773('0x5b')]=function(_0x583d8d,_0x3610a6){return db[_0x8773('0x43')]['describe']()[_0x8773('0x2b')](respondWithResult(_0x3610a6,null))[_0x8773('0x4c')](handleError(_0x3610a6,null));};exports['addSections']=function(_0x2a4eb7,_0x256106){var _0x4931bd=_0x2a4eb7[_0x8773('0x4e')];return db[_0x8773('0x43')]['find']({'where':{'id':_0x2a4eb7[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x256106,null))[_0x8773('0x2b')](function(_0x320a89){if(_0x320a89){return db['sequelize'][_0x8773('0x56')](function(_0x3f8eea){return db[_0x8773('0x57')][_0x8773('0x5c')]({'where':{'userProfileId':_0x2a4eb7[_0x8773('0x48')]['id'],'sectionId':_[_0x8773('0x2f')](_0x4931bd,function(_0x527e71){return _0x527e71[_0x8773('0x5d')];})},'transaction':_0x3f8eea})['then'](function(){var _0x3fce40=_['map'](_0x4931bd,function(_0x5ad939){_0x5ad939[_0x8773('0x5e')]=_0x2a4eb7[_0x8773('0x48')]['id'];return _0x5ad939;});var _0x1944c6=[];return BPromise[_0x8773('0x5f')](_0x3fce40,function(_0x36d379){return db[_0x8773('0x57')][_0x8773('0x4d')](_0x36d379,{'include':[{'model':db[_0x8773('0x59')],'as':_0x8773('0x5a')}],'raw':!![],'transaction':_0x3f8eea})[_0x8773('0x2b')](function(_0x7f1e0){_0x1944c6[_0x8773('0x60')](_0x7f1e0[_0x8773('0x50')]({'plain':!![]}));});})[_0x8773('0x2b')](function(){return _0x1944c6;});});});}})['then'](function(_0x203bdb){return _0x203bdb;})[_0x8773('0x2b')](respondWithResult(_0x256106,null))[_0x8773('0x4c')](handleError(_0x256106,null));};exports[_0x8773('0x61')]=function(_0x2b740c,_0x579632){var _0x2475e9;return db[_0x8773('0x43')][_0x8773('0x4b')]({'where':{'id':_0x2b740c[_0x8773('0x48')]['id']},'attributes':['id',_0x8773('0x2d')]})[_0x8773('0x2b')](handleEntityNotFound(_0x579632,null))[_0x8773('0x2b')](function(_0x5a0e32){if(_0x5a0e32){_0x2475e9=_0x5a0e32;return db[_0x8773('0x57')][_0x8773('0x5c')]({'where':{'userProfileId':_0x2b740c[_0x8773('0x48')]['id'],'sectionId':_0x2b740c[_0x8773('0x34')][_0x8773('0x62')]}});}})['then'](function(){return _0x2475e9;})['then'](respondWithStatusCode(_0x579632,null))[_0x8773('0x4c')](handleError(_0x579632,null));};exports[_0x8773('0x63')]=function(_0x422d6b,_0x58349f){var _0x554f60=[];var _0x15e457=[];return db[_0x8773('0x57')]['findAll']({'where':{'userProfileId':_0x422d6b[_0x8773('0x48')]['id']},'raw':!![]})[_0x8773('0x2b')](function(_0x5b1279){_0x554f60=_[_0x8773('0x3f')](_0x5b1279,function(_0x5dfbe1){return _0x5dfbe1[_0x8773('0x64')]===0x1||_['includes']([0x3eb,0x709],_0x5dfbe1[_0x8773('0x5d')]);});if(!_[_0x8773('0x65')](_0x554f60)){return _['map'](_0x554f60,function(_0x577f72){return _0x577f72[_0x8773('0x5d')];});}else{return;}})[_0x8773('0x2b')](function(_0x5ad508){if(_0x5ad508)_0x15e457=_0x5ad508;if(_[_0x8773('0x66')](_0x15e457,0x64)){var _0x49fd60=_[_0x8773('0x4b')](_0x554f60,{'sectionId':0x64});return hasDefaultDashboard(_0x49fd60)['then'](function(_0x3cff7e){return _[_0x8773('0x2f')](_0x554f60,function(_0x2d7807){if(_0x2d7807[_0x8773('0x5d')]===0x64){_0x2d7807[_0x8773('0x67')]=_0x3cff7e;}return _0x2d7807;});});}else{return;}})['then'](function(_0xfac45a){if(_0xfac45a)_0x554f60=_0xfac45a;if(_['includes'](_0x15e457,0x3eb)){var _0xfbc574=_[_0x8773('0x4b')](_0x554f60,{'sectionId':0x3eb});return getCustomDashboards(_0xfbc574)[_0x8773('0x2b')](function(_0x17ee4f){return _[_0x8773('0x2f')](_0x554f60,function(_0x5177ca){if(_0xfbc574[_0x8773('0x64')]){if(_0x5177ca['sectionId']===0x3eb){_0x5177ca[_0x8773('0x67')]=_0x17ee4f;}}else{if(_0x5177ca[_0x8773('0x5d')]===0x64){if(!_0x5177ca['subsections']){_0x5177ca['subsections']=[];}_0x5177ca['subsections']=_0x5177ca[_0x8773('0x67')][_0x8773('0x68')](_0x17ee4f);}}return _0x5177ca;});});}else{return;}})[_0x8773('0x2b')](function(_0x1a2999){if(_0x1a2999)_0x554f60=_0x1a2999;if(_[_0x8773('0x66')](_0x15e457,0x709)){var _0x1f52e4=_['find'](_0x554f60,{'sectionId':0x709});return getPlugins(_0x1f52e4)[_0x8773('0x2b')](function(_0x21f5f1){if(_0x1f52e4[_0x8773('0x64')]){return _['map'](_0x554f60,function(_0x3d9d32){if(_0x3d9d32[_0x8773('0x5d')]===0x709){_0x3d9d32[_0x8773('0x67')]=_0x21f5f1;}return _0x3d9d32;});}else{var _0x4c21ff={'sectionId':0x76c,'enabled':0x1,'subsections':_0x21f5f1};var _0x3152c5=_['map'](_0x554f60);_0x3152c5[_0x8773('0x60')](_0x4c21ff);return _0x3152c5;}});}else{return;}})[_0x8773('0x2b')](function(_0x190db7){if(_0x190db7)_0x554f60=_0x190db7;return _[_0x8773('0x3f')](_0x554f60,[_0x8773('0x64'),0x1]);})[_0x8773('0x2b')](respondWithResult(_0x58349f,null))[_0x8773('0x4c')](handleError(_0x58349f,null));};function hasDefaultDashboard(_0x2342cf){var _0x215fec=[0x65];return new BPromise(function(_0x4371d7,_0x3f2cb4){try{if(_0x2342cf[_0x8773('0x58')]){_0x4371d7(_0x215fec);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x2342cf['id']},'raw':!![]})['then'](function(_0x56bca5){_0x56bca5?_0x4371d7(_0x215fec):_0x4371d7();});}}catch(_0x4c6475){_0x3f2cb4(_0x4c6475);}});}function getCustomDashboards(_0x4a991a){var _0x544117=[];return new BPromise(function(_0x18cae5,_0x4fb1e5){try{if(_0x4a991a[_0x8773('0x58')]){return db[_0x8773('0x69')][_0x8773('0x45')]({'raw':!![]})[_0x8773('0x2b')](function(_0x4881cb){_0x4881cb[_0x8773('0x6a')](function(_0x4f6e4f){_0x544117[_0x8773('0x60')](_0x4f6e4f['id']+0x1869f);});_0x18cae5(_0x544117);});}else{return db[_0x8773('0x59')][_0x8773('0x45')]({'where':{'sectionId':_0x4a991a['id']},'raw':!![]})[_0x8773('0x2b')](function(_0x12b046){_0x12b046[_0x8773('0x6a')](function(_0x2c4a7e){_0x544117[_0x8773('0x60')](_0x2c4a7e[_0x8773('0x6b')]+0x1869f);});_0x18cae5(_0x544117);});}}catch(_0x5ae6bb){_0x4fb1e5(_0x5ae6bb);}});}function getPlugins(_0x2834ab){var _0x1956b1=[];return new BPromise(function(_0x5d7292,_0x340c33){try{if(_0x2834ab['autoAssociation']){return db['Plugin']['findAll']({'raw':!![]})[_0x8773('0x2b')](function(_0xe4a6e4){_0xe4a6e4['forEach'](function(_0x4fa071){_0x1956b1[_0x8773('0x60')](_0x4fa071['id']+0x15b38);});_0x5d7292(_0x1956b1);});}else{return db[_0x8773('0x59')]['findAll']({'where':{'sectionId':_0x2834ab['id']},'raw':!![]})['then'](function(_0x4a5432){_0x4a5432['forEach'](function(_0x2e9ad9){_0x1956b1[_0x8773('0x60')](_0x2e9ad9['resourceId']+0x15b38);});_0x5d7292(_0x1956b1);});}}catch(_0x187103){_0x340c33(_0x187103);}});}exports['addResources']=function(_0x1e4bb5,_0x44d042){return db['UserProfile']['find']({'where':{'id':_0x1e4bb5[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x44d042,null))['then'](function(_0x3dc26f){if(_0x3dc26f){return db['sequelize'][_0x8773('0x56')](function(_0x40fbe5){return db[_0x8773('0x57')][_0x8773('0x45')]({'where':{'userProfileId':_0x1e4bb5['params']['id']},'attributes':['id'],'raw':!![]})[_0x8773('0x2b')](function(_0x52231b){if(_0x52231b){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x1e4bb5[_0x8773('0x48')]['id'],'id':_[_0x8773('0x2f')](_0x52231b,function(_0x5cf704){return _0x5cf704['id'];})},'transaction':_0x40fbe5});}})[_0x8773('0x2b')](function(_0x3f9369){var _0x3b04f3=_[_0x8773('0x2f')](_0x1e4bb5[_0x8773('0x4e')],function(_0x2c02ab){_0x2c02ab['userProfileId']=_0x1e4bb5[_0x8773('0x48')]['id'];return _0x2c02ab;});return db[_0x8773('0x57')][_0x8773('0x6c')](_0x3b04f3,{'raw':!![],'transaction':_0x40fbe5});})[_0x8773('0x2b')](function(_0x4b17bf){var _0x38dd57=_[_0x8773('0x3f')](_[_0x8773('0x2f')](_0x4b17bf,function(_0xd1556c){return _0xd1556c['get']({'plain':!![]});}),{'includeAll':![]});if(_0x38dd57){return db['UserProfileSection'][_0x8773('0x45')]({'where':{'userProfileId':_0x1e4bb5['params']['id'],'sectionId':_[_0x8773('0x2f')](_0x38dd57,function(_0x347532){return _0x347532['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x151f54){var _0x307bff=_[_0x8773('0x2f')](_0x1e4bb5[_0x8773('0x4e')],function(_0x5461fc){_0x5461fc['userProfileId']=_0x1e4bb5[_0x8773('0x48')]['id'];return _0x5461fc;});return db[_0x8773('0x59')][_0x8773('0x6c')](_0x307bff,{'raw':!![],'transaction':_0x40fbe5});});}})['catch'](handleError(_0x44d042,null));});}})[_0x8773('0x2b')](function(_0x2f905a){var _0x24102a=_['map'](_0x2f905a,function(_0x3a4653){return _0x3a4653['get']({'plain':!![]});});})[_0x8773('0x2b')](respondWithResult(_0x44d042,null))[_0x8773('0x4c')](handleError(_0x44d042,null));};exports[_0x8773('0x6d')]=function(_0x523d79,_0x26c314,_0x4133be){return db['UserProfile']['find']({'where':{'id':_0x523d79[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x26c314,null))[_0x8773('0x2b')](function(_0x458685){if(_0x458685){return _0x458685[_0x8773('0x6d')](_0x523d79[_0x8773('0x34')][_0x8773('0x62')]);}})[_0x8773('0x2b')](respondWithStatusCode(_0x26c314,null))['catch'](handleError(_0x26c314,null));};exports[_0x8773('0x6e')]=function(_0x429557,_0x5e5925){var _0x5953a0={};if(!_0x429557[_0x8773('0x34')]['section'])throw new Error(_0x8773('0x6f'));if(!_0x429557['query']['hasOwnProperty']('nolimit')){_0x5953a0[_0x8773('0x23')]=qs[_0x8773('0x23')](_0x429557[_0x8773('0x34')][_0x8773('0x23')]);_0x5953a0[_0x8773('0x21')]=qs[_0x8773('0x21')](_0x429557[_0x8773('0x34')]['offset']);}return db[_0x8773('0x43')]['find']({'where':{'id':_0x429557[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](function(_0x358217){if(!_0x358217)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x429557[_0x8773('0x48')]['id']);return db['UserProfile']['getResources'](_0x429557);})[_0x8773('0x2b')](respondWithFilteredResult(_0x5e5925,_0x5953a0))[_0x8773('0x4c')](handleError(_0x5e5925,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e40185d..2611d26 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 _0x2525=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xe3c007,_0x374988){var _0x4b5cc3=function(_0x4b9bfe){while(--_0x4b9bfe){_0xe3c007['push'](_0xe3c007['shift']());}};_0x4b5cc3(++_0x374988);}(_0x2525,0x1f0));var _0x5252=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x2525[_0x2763f2];return _0x3ef471;};'use strict';var EventEmitter=require(_0x5252('0x0'));var UserProfile=require(_0x5252('0x1'))['db'][_0x5252('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5252('0x3')](0x0);var events={'afterCreate':_0x5252('0x4'),'afterUpdate':_0x5252('0x5'),'afterDestroy':_0x5252('0x6')};function emitEvent(_0x1138af){return function(_0x28efdd,_0x4907eb,_0x4a73a2){UserProfileEvents[_0x5252('0x7')](_0x1138af+':'+_0x28efdd['id'],_0x28efdd);UserProfileEvents[_0x5252('0x7')](_0x1138af,_0x28efdd);_0x4a73a2(null);};}for(var e in events){if(events[_0x5252('0x8')](e)){var event=events[e];UserProfile[_0x5252('0x9')](e,emitEvent(event));}}module[_0x5252('0xa')]=UserProfileEvents; \ No newline at end of file +var _0xf970=['hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0f97('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x0f97('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0f97('0x2')](0x0);var events={'afterCreate':_0x0f97('0x3'),'afterUpdate':_0x0f97('0x4'),'afterDestroy':_0x0f97('0x5')};function emitEvent(_0x25e484){return function(_0x439149,_0x4ab74d,_0xc822e8){UserProfileEvents[_0x0f97('0x6')](_0x25e484+':'+_0x439149['id'],_0x439149);UserProfileEvents[_0x0f97('0x6')](_0x25e484,_0x439149);_0xc822e8(null);};}for(var e in events){if(events[_0x0f97('0x7')](e)){var event=events[e];UserProfile[_0x0f97('0x8')](e,emitEvent(event));}}module[_0x0f97('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 22dfc7e..b1bf801 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 _0x67f8=['OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','WhatsappAccount','queuecampaigns','VoiceQueues','users','telephones','Users','role','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Pause','scheduler','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','key','foreignKey','forEach','merge','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','Tag','Tags','color','tag','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','field','findAll','then','associatedResources','catch','value','model','name','resolve','map','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projects','contacts','CmContact','parentSections','ListId','lists','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','VoiceRecording','User','agent','Telephones','membername','telephone','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts'];(function(_0x2f42a4,_0xb82328){var _0x10fcf5=function(_0x1f6232){while(--_0x1f6232){_0x2f42a4['push'](_0x2f42a4['shift']());}};_0x10fcf5(++_0xb82328);}(_0x67f8,0x7b));var _0x867f=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x67f8[_0x4bf96c];return _0x281d09;};'use strict';var _=require(_0x867f('0x0'));var attributes=require(_0x867f('0x1'));var squel=require(_0x867f('0x2'));module[_0x867f('0x3')]=function(_0x35c7bf){var _0x43a53a=_0x35c7bf['models'];function _0x44b0f0(_0x203ec4,_0x3552fe){return new Promise(function(_0x15a0f2,_0x261a4f){if(!_0x3552fe)return _0x15a0f2(null);var _0x5120e4=_0x3552fe[_0x867f('0x4')]?{[_0x3552fe[_0x867f('0x4')][_0x867f('0x5')]]:_0x3552fe[_0x867f('0x4')]['value']}:undefined;return _0x43a53a[_0x203ec4][_0x867f('0x6')]({'where':_0x5120e4,'raw':!![]})[_0x867f('0x7')](function(_0x2e0d2a){_0x3552fe[_0x867f('0x8')]=_['map'](_0x2e0d2a,'id');_0x15a0f2(_0x3552fe);})[_0x867f('0x9')](function(_0x172b05){_0x261a4f(_0x172b05);});});}function _0x8e2479(_0x663fee,_0x3cb0f0){return new Promise(function(_0xa8eff6,_0x26047b){var _0xe83b9f=_0x663fee['filter']?{[_0x663fee[_0x867f('0x4')][_0x867f('0x5')]]:_0x663fee['filter'][_0x867f('0xa')]}:undefined;return _0x43a53a[_0x663fee[_0x867f('0xb')]]['findAll']({'where':_0xe83b9f,'raw':!![]})[_0x867f('0x7')](function(_0x5ed3ce){_0x3cb0f0['associatedResources']=_['map'](_0x5ed3ce,function(_0x1fe35a){return _0x1fe35a[_0x867f('0xc')];});_0xa8eff6(_0x3cb0f0);})['catch'](function(_0x5f505e){_0x26047b(_0x5f505e);});});}function _0x3e1444(_0x33854b,_0x36f8ac,_0x388dd0){if(!_0x36f8ac)return Promise[_0x867f('0xd')](null);return new Promise(function(_0x4be2f6,_0x2e6566){return _0x43a53a['UserProfileResource'][_0x867f('0x6')]({'where':{'sectionId':_0x36f8ac['id']},'raw':!![]})[_0x867f('0x7')](function(_0x523a31){if(_0x33854b['field']&&_0x33854b[_0x867f('0x5')]!=='id'){_0x36f8ac[_0x867f('0x8')]=_[_0x867f('0xe')](_0x523a31,function(_0x12dfcc){return _0x12dfcc[_0x33854b[_0x867f('0x5')]];});}else{if(_0x388dd0==='AnalyticExtractedReport'){_0x36f8ac[_0x867f('0x8')]=_['map'](_0x523a31,function(_0x5f3fa0){return{'id':_0x5f3fa0['resourceId'],'type':_0x5f3fa0['type']};});}else{_0x36f8ac['associatedResources']=_[_0x867f('0xe')](_0x523a31,function(_0x19bda6){return _0x19bda6[_0x867f('0xf')];});}}_0x4be2f6(_0x36f8ac);})[_0x867f('0x9')](function(_0x1e5a0a){_0x2e6566(_0x1e5a0a);});});}function _0x45aa9f(_0x5cd52a,_0x80dfcc){var _0x20a843={'parentSections':[]};switch(_0x5cd52a[_0x867f('0x10')]()){case _0x867f('0x11'):_0x20a843[_0x867f('0x12')]=_0x867f('0x13');break;case _0x867f('0x14'):_0x20a843[_0x867f('0x12')]='SquareOdbc';break;case _0x867f('0x15'):_0x20a843[_0x867f('0x12')]=_0x867f('0x16');_0x20a843['parentSections']=[{'name':_0x867f('0x17'),'field':'name','foreignKey':'projectName'}];break;case _0x867f('0x18'):_0x20a843[_0x867f('0x12')]='JscriptyProject';break;case _0x867f('0x19'):_0x20a843[_0x867f('0x12')]=_0x867f('0x1a');_0x20a843[_0x867f('0x1b')]=[{'name':'Lists','field':'id','foreignKey':_0x867f('0x1c')}];break;case _0x867f('0x1d'):_0x20a843[_0x867f('0x12')]='CmList';break;case _0x867f('0x1e'):_0x20a843[_0x867f('0x12')]=_0x867f('0x1f');break;case _0x867f('0x20'):_0x20a843[_0x867f('0x12')]='CmCustomField';break;case _0x867f('0x21'):_0x20a843['childModel']=_0x867f('0x22');break;case _0x867f('0x23'):_0x20a843[_0x867f('0x12')]=_0x867f('0x24');break;case _0x867f('0x25'):_0x20a843[_0x867f('0x12')]=_0x867f('0x26');break;case _0x867f('0x27'):_0x20a843[_0x867f('0x12')]=_0x867f('0x28');break;case _0x867f('0x29'):case _0x867f('0x2a'):case _0x867f('0x2b'):_0x20a843[_0x867f('0x12')]=_0x867f('0x2c');break;case _0x867f('0x2d'):_0x20a843[_0x867f('0x12')]='VoiceContext';break;case'voicemails':_0x20a843['childModel']=_0x867f('0x2e');break;case'voicerecordings':_0x20a843['childModel']=_0x867f('0x2f');_0x20a843[_0x867f('0x1b')]=[{'name':'Agents','field':_0x867f('0xc'),'foreignKey':'membername','model':_0x867f('0x30'),'filter':{'field':'role','value':[_0x867f('0x31')]}},{'name':_0x867f('0x32'),'field':_0x867f('0xc'),'foreignKey':_0x867f('0x33'),'model':'User','filter':{'field':'role','value':[_0x867f('0x34')]}},{'name':'VoiceQueues','field':_0x867f('0xc'),'foreignKey':'queue','model':_0x867f('0x35'),'filter':{'field':_0x867f('0x36'),'value':[_0x867f('0x37')]}},{'name':_0x867f('0x38'),'field':'name','foreignKey':'queue','model':_0x867f('0x35'),'filter':{'field':_0x867f('0x36'),'value':[_0x867f('0x39')]}}];break;case _0x867f('0x3a'):_0x20a843[_0x867f('0x12')]='VoiceMusicOnHold';break;case _0x867f('0x3b'):_0x20a843['childModel']=_0x867f('0x3c');break;case _0x867f('0x3d'):_0x20a843[_0x867f('0x12')]=_0x867f('0x3e');break;case _0x867f('0x3f'):_0x20a843[_0x867f('0x12')]='Campaign';break;case'mailqueues':_0x20a843['childModel']=_0x867f('0x40');break;case _0x867f('0x41'):_0x20a843['childModel']=_0x867f('0x42');break;case _0x867f('0x43'):_0x20a843['childModel']=_0x867f('0x44');break;case _0x867f('0x45'):_0x20a843[_0x867f('0x12')]=_0x867f('0x46');break;case _0x867f('0x47'):_0x20a843[_0x867f('0x12')]=_0x867f('0x48');break;case _0x867f('0x49'):_0x20a843['childModel']=_0x867f('0x4a');break;case'smsaccounts':_0x20a843['childModel']=_0x867f('0x4b');break;case'whatsappqueues':_0x20a843['childModel']=_0x867f('0x4c');break;case'whatsappaccounts':_0x20a843[_0x867f('0x12')]=_0x867f('0x4d');break;case'teams':_0x20a843['childModel']='Team';break;case'voicequeues':case _0x867f('0x4e'):_0x20a843[_0x867f('0x12')]=_0x867f('0x35');if(_0x80dfcc){_0x20a843[_0x867f('0x1b')]=[{'name':_0x867f('0x4f')},{'name':_0x867f('0x38')}];}break;case _0x867f('0x50'):case'agents':case _0x867f('0x51'):_0x20a843[_0x867f('0x12')]=_0x867f('0x30');if(_0x80dfcc){_0x20a843['parentSections']=[{'name':_0x867f('0x52'),'filter':{'field':_0x867f('0x53'),'value':[_0x867f('0x54'),_0x867f('0x55')]},'ignore':!![]},{'name':_0x867f('0x56')},{'name':'Telephones'}];}break;case _0x867f('0x57'):_0x20a843[_0x867f('0x12')]=_0x867f('0x58');break;case _0x867f('0x59'):_0x20a843[_0x867f('0x12')]='SalesforceAccount';break;case'freshdeskaccounts':_0x20a843['childModel']=_0x867f('0x5a');break;case _0x867f('0x5b'):_0x20a843[_0x867f('0x12')]='SugarcrmAccount';break;case'deskaccounts':_0x20a843[_0x867f('0x12')]=_0x867f('0x5c');break;case _0x867f('0x5d'):_0x20a843[_0x867f('0x12')]=_0x867f('0x5e');break;case _0x867f('0x5f'):_0x20a843['childModel']=_0x867f('0x30');break;case _0x867f('0x60'):_0x20a843[_0x867f('0x12')]=_0x867f('0x61');break;case _0x867f('0x62'):_0x20a843['childModel']=_0x867f('0x63');break;case _0x867f('0x64'):_0x20a843[_0x867f('0x12')]=_0x867f('0x65');break;case _0x867f('0x66'):_0x20a843['childModel']='Interval';break;case'pauses':_0x20a843[_0x867f('0x12')]=_0x867f('0x67');break;case _0x867f('0x68'):_0x20a843[_0x867f('0x12')]=_0x867f('0x69');break;case _0x867f('0x6a'):_0x20a843[_0x867f('0x12')]=_0x867f('0x6b');break;case _0x867f('0x6c'):_0x20a843[_0x867f('0x12')]='Tag';break;case _0x867f('0x6d'):_0x20a843[_0x867f('0x12')]=_0x867f('0x6e');break;case _0x867f('0x6f'):_0x20a843['childModel']=_0x867f('0x70');break;case _0x867f('0x71'):_0x20a843['childModel']=_0x867f('0x72');break;case _0x867f('0x73'):_0x20a843[_0x867f('0x12')]='Variable';break;case _0x867f('0x74'):_0x20a843['childModel']=_0x867f('0x75');break;case _0x867f('0x76'):_0x20a843[_0x867f('0x12')]=_0x867f('0x77');_0x20a843[_0x867f('0x1b')]=[{'name':_0x867f('0x78'),'field':'id','foreignKey':_0x867f('0x79')}];break;case'metrics':_0x20a843[_0x867f('0x12')]=_0x867f('0x7a');break;}return _0x20a843;}function _0x178f13(_0x185c22,_0x3d2e95){var _0x44bec8=_0x185c22[_0x867f('0x7b')](0x0)[_0x867f('0x7c')]()+_0x185c22[_0x867f('0x7d')](0x1);var _0x130ac4={'type':_0x43a53a[_0x867f('0x7e')]['QueryTypes'][_0x867f('0x7f')],'raw':!![]};return new Promise(function(_0x3b02db,_0x474183){var _0x90e9f=squel[_0x867f('0x80')]()[_0x867f('0x5')](_0x867f('0x81')+_0x44bec8+_0x867f('0x82'),'id')[_0x867f('0x5')]('ui.createdAt')[_0x867f('0x83')](_0x867f('0x84')+_0x185c22+_0x867f('0x85'),'ui')[_0x867f('0x86')]('ui.UserId\x20=\x20?',_0x3d2e95['id']);return _0x43a53a[_0x867f('0x87')][_0x867f('0x88')](_0x90e9f[_0x867f('0x89')](),_0x130ac4)[_0x867f('0x7')](function(_0x19ffa9){_0x3d2e95[_0x44bec8+_0x867f('0x8a')]=_0x19ffa9;_0x3b02db(_0x19ffa9);})[_0x867f('0x9')](function(_0x4cb77e){_0x474183(_0x4cb77e);});});}return _0x35c7bf[_0x867f('0x8b')]('UserProfile',attributes,{'tableName':_0x867f('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x439aa2){var _0xc8727f=require(_0x867f('0x8d'));var _0x3084da={'raw':_0x439aa2[_0x867f('0x88')][_0x867f('0x8e')],'where':{}};var _0xa0c4e0={};var _0x117a51={'count':0x0,'rows':[]};var _0x45062b=_0x439aa2[_0x867f('0x88')][_0x867f('0x8f')];var _0xc650e7=_0x439aa2[_0x867f('0x88')][_0x867f('0x90')]||![];var _0x3aa762=_0x45aa9f(_0x45062b,_0xc650e7);if(!_0x3aa762['childModel'])throw new Error(_0x867f('0x91')+_0x45062b+'\x27');var _0x579b59=[{'name':_0x45062b}];if(!_['isEmpty'](_0x3aa762[_0x867f('0x1b')]))_0x579b59=_0x3aa762[_0x867f('0x1b')];var _0x2b76be=[];for(var _0x13ccbe=0x0;_0x13ccbe<_0x579b59[_0x867f('0x92')];_0x13ccbe++){_0x2b76be[_0x867f('0x93')](_0x43a53a[_0x867f('0x94')][_0x867f('0x95')]({'where':{'userProfileId':_0x439aa2[_0x867f('0x96')]['id'],'name':_0x579b59[_0x13ccbe][_0x867f('0xc')]},'raw':!![]}));}return Promise[_0x867f('0x97')](_0x2b76be)[_0x867f('0x7')](function(_0xd257c0){var _0x4f512d=_[_0x867f('0x4')](_0xd257c0,function(_0x3070b3){return _0x3070b3?_0x3070b3:undefined;});var _0xc54bdc=_[_0x867f('0x4')](_0x579b59,[_0x867f('0x98'),!![]]);var _0x15237b=_[_0x867f('0x99')](_0x4f512d)&&_[_0x867f('0x99')](_0xc54bdc)?null:_[_0x867f('0x9a')](_0xc54bdc,_0x4f512d);if(!_0x15237b)return null;var _0x128d2a=[];for(var _0x4d2877=0x0;_0x4d2877<_0x15237b['length'];_0x4d2877++){var _0x254c50=_[_0x867f('0x95')](_0x579b59,function(_0x4e4778){return _0x15237b[_0x4d2877]?_0x4e4778[_0x867f('0xc')]===_0x15237b[_0x4d2877][_0x867f('0xc')]:null;});if(_0x254c50){if(_0x15237b[_0x4d2877][_0x867f('0x98')]){_0x128d2a[_0x867f('0x93')](_0x44b0f0(_0x3aa762[_0x867f('0x12')],_0x15237b[_0x4d2877]));}else{if(!_0x15237b[_0x4d2877][_0x867f('0x9b')]){_0x128d2a[_0x867f('0x93')](_0x3e1444(_0x254c50,_0x15237b[_0x4d2877],_0x3aa762['childModel']));}else{if(_0x254c50['model']){_0x128d2a[_0x867f('0x93')](_0x8e2479(_0x254c50,_0x15237b[_0x4d2877]));}}}}}return Promise[_0x867f('0x97')](_0x128d2a);})['then'](function(_0x365e71){var _0x37f2ea=_0x365e71;var _0x4f8d41=null;if(_0x37f2ea){_0x4f8d41=_0x37f2ea[_0x867f('0x92')]===0x1?_0x37f2ea[0x0]:null;}if(!_0x4f8d41&&!_0x37f2ea)return _0x117a51;var _0x479bf2=_0x43a53a[_0x3aa762['childModel']][_0x867f('0x9c')];_0xa0c4e0['model']=_[_0x867f('0x9d')](_0x479bf2);_0xa0c4e0[_0x867f('0x88')]=_[_0x867f('0x9d')](_0x439aa2[_0x867f('0x88')]);_0xa0c4e0[_0x867f('0x9e')]=_[_0x867f('0x9f')](_0xa0c4e0[_0x867f('0xb')],_0xa0c4e0[_0x867f('0x88')]);_0x3084da[_0x867f('0xa0')]=_['intersection'](_0xa0c4e0[_0x867f('0xb')],_0xc8727f[_0x867f('0xa1')](_0x439aa2[_0x867f('0x88')][_0x867f('0xa1')]));_0x3084da[_0x867f('0xa0')]=_0x3084da['attributes'][_0x867f('0x92')]?_0x3084da[_0x867f('0xa0')]:_0xa0c4e0[_0x867f('0xb')];if(!_0x439aa2[_0x867f('0x88')][_0x867f('0xa2')](_0x867f('0xa3'))){_0x3084da[_0x867f('0xa4')]=_0xc8727f['limit'](_0x439aa2[_0x867f('0x88')][_0x867f('0xa4')]);_0x3084da[_0x867f('0xa5')]=_0xc8727f['offset'](_0x439aa2[_0x867f('0x88')]['offset']);}_0x3084da[_0x867f('0xa6')]=_0xc8727f['sort'](_0x439aa2[_0x867f('0x88')]['sort']);_0x3084da['where']=_0xc8727f[_0x867f('0x9e')](_['pick'](_0x439aa2['query'],_0xa0c4e0[_0x867f('0x9e')]));if(_0x439aa2[_0x867f('0x88')][_0x867f('0x4')]){_0x3084da[_0x867f('0x86')]=_['merge'](_0x3084da[_0x867f('0x86')],{'$or':_[_0x867f('0xe')](_0x479bf2,function(_0x4685e5){if(_0x4685e5[_0x867f('0x36')][_0x867f('0xa7')]!=='VIRTUAL'){var _0x2b622c={};_0x2b622c[_0x4685e5[_0x867f('0x5')]]={'$like':'%'+_0x439aa2[_0x867f('0x88')]['filter']+'%'};return _0x2b622c;}})});}var _0x3f57b8=[];var _0x5c1e86=null;var _0x6054ad={};if(_0x4f8d41){_0x5c1e86=_['find'](_0x579b59,[_0x867f('0xc'),_0x4f8d41['name']]);if(_0x5c1e86[_0x867f('0x5')]){_0x6054ad={};if(_0x3aa762[_0x867f('0x12')]===_0x867f('0x77')){_0x6054ad[_0x5c1e86[_0x867f('0xa8')]]=_[_0x867f('0xe')](_0x4f8d41['associatedResources'],'id');}else{_0x6054ad[_0x5c1e86[_0x867f('0xa8')]]=_0x4f8d41[_0x867f('0x8')];}_0x3f57b8[_0x867f('0x93')](_0x6054ad);}else{_0x3084da[_0x867f('0x86')]['id']=_0x4f8d41[_0x867f('0x8')];}}else{for(var _0x58f43e=0x0;_0x58f43e<_0x37f2ea['length'];_0x58f43e++){_0x5c1e86=_['find'](_0x579b59,[_0x867f('0xc'),_0x37f2ea[_0x58f43e]['name']]);if(_0x5c1e86[_0x867f('0x5')]){_0x6054ad={};_0x6054ad[_0x5c1e86['foreignKey']]=_0x37f2ea[_0x58f43e][_0x867f('0x8')];_0x3f57b8[_0x867f('0x93')](_0x6054ad);}else{if(!_0x3084da[_0x867f('0x86')]['id'])_0x3084da['where']['id']=[];_0x37f2ea[_0x58f43e][_0x867f('0x8')][_0x867f('0xa9')](function(_0x210f59){_0x3084da[_0x867f('0x86')]['id'][_0x867f('0x93')](_0x210f59);});}}}if(!_['isEmpty'](_0x3f57b8)){_0x3084da[_0x867f('0x86')]=_['merge'](_0x3084da[_0x867f('0x86')],{'$and':{'$or':_0x3f57b8}});}_0x3084da=_[_0x867f('0xaa')]({},_0x3084da,_0x439aa2['options']);if(_0x4f8d41&&!_0x4f8d41[_0x867f('0x9b')]&&_0x3aa762['childModel']==='AnalyticExtractedReport'){if(_0x439aa2[_0x867f('0x88')]['includeAll']){_0x3084da['include']=[{'all':!![]}];}return _0x43a53a[_0x3aa762[_0x867f('0x12')]][_0x867f('0x6')](_0x3084da)['then'](function(_0x7f7874){var _0x1edd99=[];_0x7f7874['forEach'](function(_0x2b1a34){var _0x2001be;switch(_0x2b1a34[_0x867f('0xab')]){case _0x867f('0xac'):_0x2001be=_[_0x867f('0x95')](_0x4f8d41[_0x867f('0x8')],function(_0xd9b972){return _0xd9b972['id']===_0x2b1a34[_0x867f('0x79')]&&_0xd9b972[_0x867f('0x36')]===_0x867f('0xad');});break;case _0x867f('0xae'):_0x2001be=_[_0x867f('0x95')](_0x4f8d41[_0x867f('0x8')],function(_0x1fcfc2){return _0x1fcfc2['id']===_0x2b1a34[_0x867f('0x79')]&&_0x1fcfc2[_0x867f('0x36')]===_0x867f('0xaf');});break;}if(_0x2001be)_0x1edd99[_0x867f('0x93')](_0x2b1a34);});_0x117a51[_0x867f('0xb0')]=_0x1edd99[_0x867f('0x92')];_0x117a51[_0x867f('0xb1')]=_0x1edd99;return _0x117a51;});}else{if(!_[_0x867f('0x99')](_0x439aa2[_0x867f('0x88')][_0x867f('0xb2')])){_0x3084da[_0x867f('0x86')]['id']=_0x3084da['where']['id']?_[_0x867f('0x9f')](_0x3084da['where']['id'],_0x439aa2[_0x867f('0x88')][_0x867f('0xb2')]):_0x439aa2['query'][_0x867f('0xb2')];if(_0x439aa2['query'][_0x867f('0xb3')]){_0x3084da[_0x867f('0xa6')]=_0x439aa2[_0x867f('0x88')][_0x867f('0xb3')];}}if(_0x439aa2[_0x867f('0x88')][_0x867f('0xb4')]){_0x3084da[_0x867f('0x86')]=_[_0x867f('0xaa')](_0x3084da[_0x867f('0x86')],{'$and':_0x439aa2[_0x867f('0x88')][_0x867f('0xb4')]});}return _0x43a53a[_0x3aa762[_0x867f('0x12')]][_0x867f('0xb0')]({'where':_0x3084da[_0x867f('0x86')]})[_0x867f('0x7')](function(_0x3c9182){_0x117a51[_0x867f('0xb0')]=_0x3c9182;if(_0x439aa2[_0x867f('0x88')][_0x867f('0xb5')]){if(_0x3aa762[_0x867f('0x12')]==='CmContact'){_0x3084da['include']=[{'model':_0x43a53a[_0x867f('0xb6')],'as':_0x867f('0xb7'),'attributes':['id',_0x867f('0xc'),_0x867f('0xb8')],'required':_0x439aa2['query']['tag']?!![]:![]},{'model':_0x43a53a['Tag'],'as':'ThroughTags','attributes':['id',_0x867f('0xc'),_0x867f('0xb8')],'through':_0x439aa2[_0x867f('0x88')][_0x867f('0xb9')]?{'attributes':[],'where':{'TagId':_0x439aa2['query'][_0x867f('0xb9')]||undefined}}:{},'required':_0x439aa2[_0x867f('0x88')][_0x867f('0xb9')]?!![]:![]}];}else{_0x3084da['include']=[{'all':!![]}];}}return _0x43a53a[_0x3aa762['childModel']][_0x867f('0x6')](_0x3084da);})[_0x867f('0x7')](function(_0x1ee3fc){_0x117a51[_0x867f('0xb1')]=_0x1ee3fc;if(_0x45062b===_0x867f('0x56')&&_0x439aa2[_0x867f('0x88')][_0x867f('0xba')]===_0x867f('0xbb')){var _0x42a4fe=[];for(var _0x335c38=0x0;_0x335c38<_0x117a51[_0x867f('0xb1')][_0x867f('0x92')];_0x335c38++){_0x42a4fe[_0x867f('0x93')](_0x178f13(_0x867f('0xbc'),_0x117a51['rows'][_0x335c38][_0x867f('0xbd')]));_0x42a4fe[_0x867f('0x93')](_0x178f13(_0x867f('0xbe'),_0x117a51[_0x867f('0xb1')][_0x335c38][_0x867f('0xbd')]));_0x42a4fe[_0x867f('0x93')](_0x178f13(_0x867f('0xbf'),_0x117a51[_0x867f('0xb1')][_0x335c38]['dataValues']));_0x42a4fe['push'](_0x178f13(_0x867f('0xc0'),_0x117a51[_0x867f('0xb1')][_0x335c38]['dataValues']));_0x42a4fe[_0x867f('0x93')](_0x178f13(_0x867f('0xc1'),_0x117a51[_0x867f('0xb1')][_0x335c38]['dataValues']));_0x42a4fe['push'](_0x178f13(_0x867f('0xc2'),_0x117a51[_0x867f('0xb1')][_0x335c38]['dataValues']));}return Promise[_0x867f('0x97')](_0x42a4fe)[_0x867f('0x7')](function(){return _0x117a51;});}return _0x117a51;});}});}}});}; \ No newline at end of file +var _0xa52d=['ignore','isEmpty','union','length','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','include','reportType','default','DefaultReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','mail','openchannel','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','catch','map','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','CmContact','ListId','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','FaxQueue','faxaccounts','FaxAccount','inboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','parentSections','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','Dashboard','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Trunk','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','push','find','all'];(function(_0x16fe4c,_0x2421e8){var _0x9999d=function(_0x26160a){while(--_0x26160a){_0x16fe4c['push'](_0x16fe4c['shift']());}};_0x9999d(++_0x2421e8);}(_0xa52d,0xe2));var _0xda52=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0xa52d[_0x2bb3f6];return _0x62b339;};'use strict';var _=require('lodash');var attributes=require(_0xda52('0x0'));var squel=require(_0xda52('0x1'));module[_0xda52('0x2')]=function(_0x24f413){var _0x5852ce=_0x24f413[_0xda52('0x3')];function _0x5b5e3a(_0x3d3963,_0x5fb632){return new Promise(function(_0x5920f9,_0x2c18da){if(!_0x5fb632)return _0x5920f9(null);var _0x56247a=_0x5fb632[_0xda52('0x4')]?{[_0x5fb632[_0xda52('0x4')][_0xda52('0x5')]]:_0x5fb632[_0xda52('0x4')][_0xda52('0x6')]}:undefined;return _0x5852ce[_0x3d3963][_0xda52('0x7')]({'where':_0x56247a,'raw':!![]})[_0xda52('0x8')](function(_0x4ee88c){_0x5fb632[_0xda52('0x9')]=_['map'](_0x4ee88c,'id');_0x5920f9(_0x5fb632);})[_0xda52('0xa')](function(_0x36eb00){_0x2c18da(_0x36eb00);});});}function _0x41c9a5(_0x57993c,_0x4de7a2){return new Promise(function(_0x16a2b3,_0xe10c47){var _0x5855c6=_0x57993c['filter']?{[_0x57993c[_0xda52('0x4')][_0xda52('0x5')]]:_0x57993c['filter'][_0xda52('0x6')]}:undefined;return _0x5852ce[_0x57993c['model']]['findAll']({'where':_0x5855c6,'raw':!![]})['then'](function(_0x7fbba9){_0x4de7a2[_0xda52('0x9')]=_[_0xda52('0xb')](_0x7fbba9,function(_0x56ce3d){return _0x56ce3d[_0xda52('0xc')];});_0x16a2b3(_0x4de7a2);})[_0xda52('0xa')](function(_0x5a57a2){_0xe10c47(_0x5a57a2);});});}function _0x17350a(_0x16ef54,_0x2ed69a,_0x142063){if(!_0x2ed69a)return Promise['resolve'](null);return new Promise(function(_0x4fa61e,_0x5ead11){return _0x5852ce[_0xda52('0xd')][_0xda52('0x7')]({'where':{'sectionId':_0x2ed69a['id']},'raw':!![]})[_0xda52('0x8')](function(_0x357935){if(_0x16ef54[_0xda52('0x5')]&&_0x16ef54[_0xda52('0x5')]!=='id'){_0x2ed69a['associatedResources']=_['map'](_0x357935,function(_0x7d9cef){return _0x7d9cef[_0x16ef54['field']];});}else{if(_0x142063===_0xda52('0xe')){_0x2ed69a[_0xda52('0x9')]=_['map'](_0x357935,function(_0x2954a5){return{'id':_0x2954a5[_0xda52('0xf')],'type':_0x2954a5[_0xda52('0x10')]};});}else{_0x2ed69a['associatedResources']=_[_0xda52('0xb')](_0x357935,function(_0x6affba){return _0x6affba[_0xda52('0xf')];});}}_0x4fa61e(_0x2ed69a);})[_0xda52('0xa')](function(_0x4baa80){_0x5ead11(_0x4baa80);});});}function _0x293e84(_0x508ed0,_0x507481){var _0x1d9f83={'parentSections':[]};switch(_0x508ed0[_0xda52('0x11')]()){case _0xda52('0x12'):_0x1d9f83[_0xda52('0x13')]='SquareProject';break;case _0xda52('0x14'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x15');break;case'squarerecordings':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x16');_0x1d9f83['parentSections']=[{'name':_0xda52('0x17'),'field':_0xda52('0xc'),'foreignKey':_0xda52('0x18')}];break;case _0xda52('0x19'):_0x1d9f83[_0xda52('0x13')]='JscriptyProject';break;case'contacts':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x1a');_0x1d9f83['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xda52('0x1b')}];break;case'lists':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x1c');break;case _0xda52('0x1d'):_0x1d9f83['childModel']='CmCompany';break;case'globalcustomfields':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x1e');break;case _0xda52('0x1f'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x20');break;case _0xda52('0x21'):_0x1d9f83[_0xda52('0x13')]='ChatWebsite';break;case'faxqueues':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x22');break;case _0xda52('0x23'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x24');break;case _0xda52('0x25'):case'internalroutes':case'outboundroutes':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x26');break;case _0xda52('0x27'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x28');break;case _0xda52('0x29'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x2a');break;case _0xda52('0x2b'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x2c');_0x1d9f83[_0xda52('0x2d')]=[{'name':_0xda52('0x2e'),'field':_0xda52('0xc'),'foreignKey':_0xda52('0x2f'),'model':_0xda52('0x30'),'filter':{'field':_0xda52('0x31'),'value':[_0xda52('0x32')]}},{'name':_0xda52('0x33'),'field':'name','foreignKey':_0xda52('0x2f'),'model':_0xda52('0x30'),'filter':{'field':_0xda52('0x31'),'value':[_0xda52('0x34')]}},{'name':_0xda52('0x35'),'field':_0xda52('0xc'),'foreignKey':_0xda52('0x36'),'model':_0xda52('0x37'),'filter':{'field':'type','value':[_0xda52('0x38')]}},{'name':'QueueCampaigns','field':_0xda52('0xc'),'foreignKey':_0xda52('0x36'),'model':_0xda52('0x37'),'filter':{'field':_0xda52('0x10'),'value':[_0xda52('0x39')]}}];break;case _0xda52('0x3a'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x3b');break;case _0xda52('0x3c'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x3d');break;case _0xda52('0x3e'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x3f');break;case _0xda52('0x40'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x41');break;case _0xda52('0x42'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x43');break;case'mailaccounts':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x44');break;case _0xda52('0x45'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x46');break;case'openchannelqueues':_0x1d9f83['childModel']=_0xda52('0x47');break;case _0xda52('0x48'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x49');break;case _0xda52('0x4a'):_0x1d9f83[_0xda52('0x13')]='SmsQueue';break;case _0xda52('0x4b'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x4c');break;case _0xda52('0x4d'):_0x1d9f83['childModel']='WhatsappQueue';break;case'whatsappaccounts':_0x1d9f83['childModel']='WhatsappAccount';break;case _0xda52('0x4e'):_0x1d9f83['childModel']=_0xda52('0x4f');break;case _0xda52('0x50'):case _0xda52('0x51'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x37');if(_0x507481){_0x1d9f83[_0xda52('0x2d')]=[{'name':_0xda52('0x35')},{'name':_0xda52('0x52')}];}break;case _0xda52('0x53'):case _0xda52('0x54'):case _0xda52('0x55'):_0x1d9f83[_0xda52('0x13')]='User';if(_0x507481){_0x1d9f83[_0xda52('0x2d')]=[{'name':'Users','filter':{'field':_0xda52('0x31'),'value':['admin',_0xda52('0x56')]},'ignore':!![]},{'name':_0xda52('0x2e')},{'name':_0xda52('0x33')}];}break;case _0xda52('0x57'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x58');break;case _0xda52('0x59'):_0x1d9f83['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x5a');break;case'sugarcrmaccounts':_0x1d9f83['childModel']=_0xda52('0x5b');break;case _0xda52('0x5c'):_0x1d9f83['childModel']='DeskAccount';break;case'zohoaccounts':_0x1d9f83[_0xda52('0x13')]='ZohoAccount';break;case'vtigeraccounts':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x30');break;case'cannedanswers':_0x1d9f83[_0xda52('0x13')]='CannedAnswer';break;case'dispositions':_0x1d9f83[_0xda52('0x13')]='Disposition';break;case'customdashboards':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x5d');break;case'intervals':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x5e');break;case'pauses':_0x1d9f83['childModel']=_0xda52('0x5f');break;case _0xda52('0x60'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x61');break;case _0xda52('0x62'):_0x1d9f83['childModel']=_0xda52('0x63');break;case _0xda52('0x64'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x65');break;case _0xda52('0x66'):_0x1d9f83['childModel']='Template';break;case _0xda52('0x67'):_0x1d9f83['childModel']=_0xda52('0x68');break;case _0xda52('0x69'):_0x1d9f83['childModel']=_0xda52('0x6a');break;case'variables':_0x1d9f83[_0xda52('0x13')]='Variable';break;case _0xda52('0x6b'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x6c');break;case _0xda52('0x6d'):_0x1d9f83[_0xda52('0x13')]='AnalyticExtractedReport';_0x1d9f83[_0xda52('0x2d')]=[{'name':_0xda52('0x6e'),'field':'id','foreignKey':_0xda52('0x6f')}];break;case'metrics':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x70');break;}return _0x1d9f83;}function _0x160e0(_0xc1c7c1,_0x97f32d){var _0x4daa48=_0xc1c7c1[_0xda52('0x71')](0x0)[_0xda52('0x72')]()+_0xc1c7c1[_0xda52('0x73')](0x1);var _0x13a3b2={'type':_0x5852ce[_0xda52('0x74')][_0xda52('0x75')]['SELECT'],'raw':!![]};return new Promise(function(_0x49984a,_0x2b45f3){var _0x54d9d3=squel[_0xda52('0x76')]()[_0xda52('0x5')](_0xda52('0x77')+_0x4daa48+_0xda52('0x78'),'id')[_0xda52('0x5')](_0xda52('0x79'))[_0xda52('0x7a')](_0xda52('0x7b')+_0xc1c7c1+'_interactions','ui')[_0xda52('0x7c')](_0xda52('0x7d'),_0x97f32d['id']);return _0x5852ce[_0xda52('0x7e')][_0xda52('0x7f')](_0x54d9d3[_0xda52('0x80')](),_0x13a3b2)[_0xda52('0x8')](function(_0x53e02d){_0x97f32d[_0x4daa48+_0xda52('0x81')]=_0x53e02d;_0x49984a(_0x53e02d);})[_0xda52('0xa')](function(_0x1f5114){_0x2b45f3(_0x1f5114);});});}return _0x24f413['define'](_0xda52('0x82'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x303348){var _0x27f787=require(_0xda52('0x83'));var _0x332180={'raw':_0x303348[_0xda52('0x7f')]['raw'],'where':{}};var _0x1e8feb={};var _0x59471d={'count':0x0,'rows':[]};var _0x1e5bd3=_0x303348['query'][_0xda52('0x84')];var _0x5af900=_0x303348[_0xda52('0x7f')][_0xda52('0x85')]||![];var _0x3f0977=_0x293e84(_0x1e5bd3,_0x5af900);if(!_0x3f0977[_0xda52('0x13')])throw new Error(_0xda52('0x86')+_0x1e5bd3+'\x27');var _0x1194f9=[{'name':_0x1e5bd3}];if(!_['isEmpty'](_0x3f0977[_0xda52('0x2d')]))_0x1194f9=_0x3f0977[_0xda52('0x2d')];var _0x1240dd=[];for(var _0x3cd895=0x0;_0x3cd895<_0x1194f9['length'];_0x3cd895++){_0x1240dd[_0xda52('0x87')](_0x5852ce['UserProfileSection'][_0xda52('0x88')]({'where':{'userProfileId':_0x303348['params']['id'],'name':_0x1194f9[_0x3cd895][_0xda52('0xc')]},'raw':!![]}));}return Promise[_0xda52('0x89')](_0x1240dd)[_0xda52('0x8')](function(_0x5908de){var _0x8dc1a7=_['filter'](_0x5908de,function(_0x4f5f2e){return _0x4f5f2e?_0x4f5f2e:undefined;});var _0x34b00c=_[_0xda52('0x4')](_0x1194f9,[_0xda52('0x8a'),!![]]);var _0x200817=_[_0xda52('0x8b')](_0x8dc1a7)&&_[_0xda52('0x8b')](_0x34b00c)?null:_[_0xda52('0x8c')](_0x34b00c,_0x8dc1a7);if(!_0x200817)return null;var _0x74ac8=[];for(var _0x5ad4ce=0x0;_0x5ad4ce<_0x200817[_0xda52('0x8d')];_0x5ad4ce++){var _0x1706df=_[_0xda52('0x88')](_0x1194f9,function(_0x4d7f51){return _0x200817[_0x5ad4ce]?_0x4d7f51[_0xda52('0xc')]===_0x200817[_0x5ad4ce][_0xda52('0xc')]:null;});if(_0x1706df){if(_0x200817[_0x5ad4ce][_0xda52('0x8a')]){_0x74ac8[_0xda52('0x87')](_0x5b5e3a(_0x3f0977[_0xda52('0x13')],_0x200817[_0x5ad4ce]));}else{if(!_0x200817[_0x5ad4ce][_0xda52('0x8e')]){_0x74ac8['push'](_0x17350a(_0x1706df,_0x200817[_0x5ad4ce],_0x3f0977[_0xda52('0x13')]));}else{if(_0x1706df[_0xda52('0x8f')]){_0x74ac8[_0xda52('0x87')](_0x41c9a5(_0x1706df,_0x200817[_0x5ad4ce]));}}}}}return Promise[_0xda52('0x89')](_0x74ac8);})[_0xda52('0x8')](function(_0x1a2341){var _0x5f070d=_0x1a2341;var _0x84fea0=null;if(_0x5f070d){_0x84fea0=_0x5f070d[_0xda52('0x8d')]===0x1?_0x5f070d[0x0]:null;}if(!_0x84fea0&&!_0x5f070d)return _0x59471d;var _0x24e6c1=_0x5852ce[_0x3f0977[_0xda52('0x13')]][_0xda52('0x90')];_0x1e8feb[_0xda52('0x8f')]=_[_0xda52('0x91')](_0x24e6c1);_0x1e8feb['query']=_[_0xda52('0x91')](_0x303348[_0xda52('0x7f')]);_0x1e8feb[_0xda52('0x92')]=_[_0xda52('0x93')](_0x1e8feb[_0xda52('0x8f')],_0x1e8feb[_0xda52('0x7f')]);_0x332180[_0xda52('0x94')]=_[_0xda52('0x93')](_0x1e8feb['model'],_0x27f787[_0xda52('0x95')](_0x303348[_0xda52('0x7f')][_0xda52('0x95')]));_0x332180['attributes']=_0x332180[_0xda52('0x94')][_0xda52('0x8d')]?_0x332180[_0xda52('0x94')]:_0x1e8feb[_0xda52('0x8f')];if(!_0x303348[_0xda52('0x7f')][_0xda52('0x96')](_0xda52('0x97'))){_0x332180['limit']=_0x27f787[_0xda52('0x98')](_0x303348[_0xda52('0x7f')]['limit']);_0x332180[_0xda52('0x99')]=_0x27f787[_0xda52('0x99')](_0x303348[_0xda52('0x7f')][_0xda52('0x99')]);}_0x332180[_0xda52('0x9a')]=_0x27f787[_0xda52('0x9b')](_0x303348[_0xda52('0x7f')][_0xda52('0x9b')]);_0x332180[_0xda52('0x7c')]=_0x27f787[_0xda52('0x92')](_[_0xda52('0x9c')](_0x303348[_0xda52('0x7f')],_0x1e8feb[_0xda52('0x92')]));if(_0x303348['query'][_0xda52('0x4')]){_0x332180[_0xda52('0x7c')]=_['merge'](_0x332180[_0xda52('0x7c')],{'$or':_[_0xda52('0xb')](_0x24e6c1,function(_0x35114a){if(_0x35114a['type'][_0xda52('0x9d')]!==_0xda52('0x9e')){var _0x438b3a={};_0x438b3a[_0x35114a[_0xda52('0x5')]]={'$like':'%'+_0x303348[_0xda52('0x7f')][_0xda52('0x4')]+'%'};return _0x438b3a;}})});}var _0x201a8d=[];var _0x4ac2e2=null;var _0x306def={};if(_0x84fea0){_0x4ac2e2=_[_0xda52('0x88')](_0x1194f9,[_0xda52('0xc'),_0x84fea0[_0xda52('0xc')]]);if(_0x4ac2e2[_0xda52('0x5')]){_0x306def={};if(_0x3f0977[_0xda52('0x13')]===_0xda52('0xe')){_0x306def[_0x4ac2e2[_0xda52('0x9f')]]=_[_0xda52('0xb')](_0x84fea0[_0xda52('0x9')],'id');}else{_0x306def[_0x4ac2e2[_0xda52('0x9f')]]=_0x84fea0['associatedResources'];}_0x201a8d[_0xda52('0x87')](_0x306def);}else{_0x332180[_0xda52('0x7c')]['id']=_0x84fea0[_0xda52('0x9')];}}else{for(var _0x5c5cac=0x0;_0x5c5cac<_0x5f070d[_0xda52('0x8d')];_0x5c5cac++){_0x4ac2e2=_[_0xda52('0x88')](_0x1194f9,[_0xda52('0xc'),_0x5f070d[_0x5c5cac][_0xda52('0xc')]]);if(_0x4ac2e2[_0xda52('0x5')]){_0x306def={};_0x306def[_0x4ac2e2[_0xda52('0x9f')]]=_0x5f070d[_0x5c5cac]['associatedResources'];_0x201a8d[_0xda52('0x87')](_0x306def);}else{if(!_0x332180[_0xda52('0x7c')]['id'])_0x332180[_0xda52('0x7c')]['id']=[];_0x5f070d[_0x5c5cac]['associatedResources'][_0xda52('0xa0')](function(_0x20337e){_0x332180[_0xda52('0x7c')]['id'][_0xda52('0x87')](_0x20337e);});}}}if(!_[_0xda52('0x8b')](_0x201a8d)){_0x332180[_0xda52('0x7c')]=_['merge'](_0x332180[_0xda52('0x7c')],{'$and':{'$or':_0x201a8d}});}_0x332180=_[_0xda52('0xa1')]({},_0x332180,_0x303348['options']);if(_0x84fea0&&!_0x84fea0['autoAssociation']&&_0x3f0977[_0xda52('0x13')]===_0xda52('0xe')){if(_0x303348[_0xda52('0x7f')]['includeAll']){_0x332180[_0xda52('0xa2')]=[{'all':!![]}];}return _0x5852ce[_0x3f0977[_0xda52('0x13')]][_0xda52('0x7')](_0x332180)[_0xda52('0x8')](function(_0x5cb098){var _0x2d08b8=[];_0x5cb098[_0xda52('0xa0')](function(_0x457089){var _0x1a98b8;switch(_0x457089[_0xda52('0xa3')]){case _0xda52('0xa4'):_0x1a98b8=_[_0xda52('0x88')](_0x84fea0[_0xda52('0x9')],function(_0x4f7451){return _0x4f7451['id']===_0x457089[_0xda52('0x6f')]&&_0x4f7451[_0xda52('0x10')]===_0xda52('0xa5');});break;case'custom':_0x1a98b8=_['find'](_0x84fea0[_0xda52('0x9')],function(_0x296e76){return _0x296e76['id']===_0x457089[_0xda52('0x6f')]&&_0x296e76[_0xda52('0x10')]==='CustomReports';});break;}if(_0x1a98b8)_0x2d08b8['push'](_0x457089);});_0x59471d[_0xda52('0xa6')]=_0x2d08b8[_0xda52('0x8d')];_0x59471d[_0xda52('0xa7')]=_0x2d08b8;return _0x59471d;});}else{if(!_['isEmpty'](_0x303348[_0xda52('0x7f')][_0xda52('0xa8')])){_0x332180[_0xda52('0x7c')]['id']=_0x332180[_0xda52('0x7c')]['id']?_[_0xda52('0x93')](_0x332180[_0xda52('0x7c')]['id'],_0x303348[_0xda52('0x7f')][_0xda52('0xa8')]):_0x303348[_0xda52('0x7f')][_0xda52('0xa8')];if(_0x303348[_0xda52('0x7f')][_0xda52('0xa9')]){_0x332180[_0xda52('0x9a')]=_0x303348[_0xda52('0x7f')][_0xda52('0xa9')];}}if(_0x303348['query'][_0xda52('0xaa')]){_0x332180[_0xda52('0x7c')]=_[_0xda52('0xa1')](_0x332180[_0xda52('0x7c')],{'$and':_0x303348[_0xda52('0x7f')][_0xda52('0xaa')]});}return _0x5852ce[_0x3f0977['childModel']][_0xda52('0xa6')]({'where':_0x332180[_0xda52('0x7c')]})[_0xda52('0x8')](function(_0x3c4196){_0x59471d[_0xda52('0xa6')]=_0x3c4196;if(_0x303348[_0xda52('0x7f')][_0xda52('0xab')]){if(_0x3f0977[_0xda52('0x13')]===_0xda52('0x1a')){_0x332180['include']=[{'model':_0x5852ce[_0xda52('0x65')],'as':'Tags','attributes':['id',_0xda52('0xc'),_0xda52('0xac')],'required':_0x303348['query'][_0xda52('0xad')]?!![]:![]},{'model':_0x5852ce[_0xda52('0x65')],'as':_0xda52('0xae'),'attributes':['id',_0xda52('0xc'),_0xda52('0xac')],'through':_0x303348[_0xda52('0x7f')][_0xda52('0xad')]?{'attributes':[],'where':{'TagId':_0x303348[_0xda52('0x7f')][_0xda52('0xad')]||undefined}}:{},'required':_0x303348[_0xda52('0x7f')][_0xda52('0xad')]?!![]:![]}];}else{_0x332180[_0xda52('0xa2')]=[{'all':!![]}];}}return _0x5852ce[_0x3f0977['childModel']][_0xda52('0x7')](_0x332180);})[_0xda52('0x8')](function(_0xea300d){_0x59471d[_0xda52('0xa7')]=_0xea300d;if(_0x1e5bd3==='Agents'&&_0x303348[_0xda52('0x7f')][_0xda52('0xaf')]===_0xda52('0xb0')){var _0x57c4ea=[];for(var _0x24e283=0x0;_0x24e283<_0x59471d[_0xda52('0xa7')][_0xda52('0x8d')];_0x24e283++){_0x57c4ea[_0xda52('0x87')](_0x160e0(_0xda52('0xb1'),_0x59471d[_0xda52('0xa7')][_0x24e283][_0xda52('0xb2')]));_0x57c4ea[_0xda52('0x87')](_0x160e0(_0xda52('0xb3'),_0x59471d['rows'][_0x24e283][_0xda52('0xb2')]));_0x57c4ea['push'](_0x160e0('fax',_0x59471d[_0xda52('0xa7')][_0x24e283][_0xda52('0xb2')]));_0x57c4ea[_0xda52('0x87')](_0x160e0(_0xda52('0xb4'),_0x59471d[_0xda52('0xa7')][_0x24e283][_0xda52('0xb2')]));_0x57c4ea['push'](_0x160e0(_0xda52('0xb5'),_0x59471d[_0xda52('0xa7')][_0x24e283]['dataValues']));_0x57c4ea[_0xda52('0x87')](_0x160e0('whatsapp',_0x59471d['rows'][_0x24e283]['dataValues']));}return Promise[_0xda52('0x89')](_0x57c4ea)[_0xda52('0x8')](function(){return _0x59471d;});}return _0x59471d;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2599a77..0e6ce77 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 _0xef66=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0xef66,0x1db));var _0x6ef6=function(_0x1a4dd8,_0x255ecb){_0x1a4dd8=_0x1a4dd8-0x0;var _0x575ded=_0xef66[_0x1a4dd8];return _0x575ded;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ef6('0x5'));var logger=require(_0x6ef6('0x6'))(_0x6ef6('0x7'));var config=require(_0x6ef6('0x8'));var jayson=require(_0x6ef6('0x9'));var client=jayson[_0x6ef6('0xa')][_0x6ef6('0xb')]({'port':0x232a});config[_0x6ef6('0xc')]=_[_0x6ef6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6ef6('0xe'))(new Redis(config[_0x6ef6('0xc')]));require(_0x6ef6('0xf'))[_0x6ef6('0x10')](socket);function respondWithRpcPromise(_0xc0ace,_0x49fed5,_0x1c719e){return new BPromise(function(_0x4bf459,_0x53db5e){return client[_0x6ef6('0x11')](_0xc0ace,_0x1c719e)['then'](function(_0x107bb4){logger[_0x6ef6('0x12')](_0x6ef6('0x13'),_0x49fed5,_0x6ef6('0x14'));logger['debug'](_0x6ef6('0x15'),_0x49fed5,_0x6ef6('0x14'),JSON[_0x6ef6('0x16')](_0x107bb4));if(_0x107bb4[_0x6ef6('0x17')]){if(_0x107bb4['error'][_0x6ef6('0x18')]===0x1f4){logger['error'](_0x6ef6('0x13'),_0x49fed5,_0x107bb4[_0x6ef6('0x17')]['message']);return _0x53db5e(_0x107bb4[_0x6ef6('0x17')][_0x6ef6('0x19')]);}logger[_0x6ef6('0x17')](_0x6ef6('0x13'),_0x49fed5,_0x107bb4[_0x6ef6('0x17')][_0x6ef6('0x19')]);return _0x4bf459(_0x107bb4[_0x6ef6('0x17')][_0x6ef6('0x19')]);}else{logger[_0x6ef6('0x12')](_0x6ef6('0x13'),_0x49fed5,'request\x20sent');_0x4bf459(_0x107bb4[_0x6ef6('0x1a')][_0x6ef6('0x19')]);}})[_0x6ef6('0x1b')](function(_0x37d2ef){logger[_0x6ef6('0x17')](_0x6ef6('0x13'),_0x49fed5,_0x37d2ef);_0x53db5e(_0x37d2ef);});});} \ No newline at end of file +var _0x6faf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x6faf,0xf9));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var moment=require(_0xf6fa('0x1'));var BPromise=require(_0xf6fa('0x2'));var rs=require(_0xf6fa('0x3'));var fs=require('fs');var Redis=require(_0xf6fa('0x4'));var db=require(_0xf6fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6fa('0x6'))('rpc');var config=require(_0xf6fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf6fa('0x8')][_0xf6fa('0x9')]({'port':0x232a});config[_0xf6fa('0xa')]=_[_0xf6fa('0xb')](config[_0xf6fa('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6fa('0xc'))(new Redis(config[_0xf6fa('0xa')]));require(_0xf6fa('0xd'))['register'](socket);function respondWithRpcPromise(_0x4a1d49,_0x3148bd,_0x535fbc){return new BPromise(function(_0x196e0d,_0x336a07){return client['request'](_0x4a1d49,_0x535fbc)[_0xf6fa('0xe')](function(_0x4a1e5e){logger[_0xf6fa('0xf')]('UserProfile,\x20%s,\x20%s',_0x3148bd,'request\x20sent');logger['debug'](_0xf6fa('0x10'),_0x3148bd,_0xf6fa('0x11'),JSON[_0xf6fa('0x12')](_0x4a1e5e));if(_0x4a1e5e[_0xf6fa('0x13')]){if(_0x4a1e5e[_0xf6fa('0x13')][_0xf6fa('0x14')]===0x1f4){logger[_0xf6fa('0x13')](_0xf6fa('0x15'),_0x3148bd,_0x4a1e5e[_0xf6fa('0x13')][_0xf6fa('0x16')]);return _0x336a07(_0x4a1e5e[_0xf6fa('0x13')]['message']);}logger[_0xf6fa('0x13')](_0xf6fa('0x15'),_0x3148bd,_0x4a1e5e['error'][_0xf6fa('0x16')]);return _0x196e0d(_0x4a1e5e[_0xf6fa('0x13')][_0xf6fa('0x16')]);}else{logger['info'](_0xf6fa('0x15'),_0x3148bd,_0xf6fa('0x11'));_0x196e0d(_0x4a1e5e[_0xf6fa('0x17')][_0xf6fa('0x16')]);}})[_0xf6fa('0x18')](function(_0x553daa){logger[_0xf6fa('0x13')]('UserProfile,\x20%s,\x20%s',_0x3148bd,_0x553daa);_0x336a07(_0x553daa);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e30e880..d3782df 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 _0x0fec=['save','remove','update','emit','removeListener','userProfile:'];(function(_0x16e604,_0x30add6){var _0x20efca=function(_0x240da4){while(--_0x240da4){_0x16e604['push'](_0x16e604['shift']());}};_0x20efca(++_0x30add6);}(_0x0fec,0x174));var _0xc0fe=function(_0x5e9964,_0x432f56){_0x5e9964=_0x5e9964-0x0;var _0x329c2a=_0x0fec[_0x5e9964];return _0x329c2a;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xc0fe('0x0'),_0xc0fe('0x1'),_0xc0fe('0x2')];function createListener(_0x477199,_0x887f0a){return function(_0x23200a){_0x887f0a[_0xc0fe('0x3')](_0x477199,_0x23200a);};}function removeListener(_0x544c4d,_0x580e60){return function(){UserProfileEvents[_0xc0fe('0x4')](_0x544c4d,_0x580e60);};}exports['register']=function(_0x5ae5e0){for(var _0x30a530=0x0,_0x193cea=events['length'];_0x30a530<_0x193cea;_0x30a530++){var _0x29341f=events[_0x30a530];var _0x516150=createListener(_0xc0fe('0x5')+_0x29341f,_0x5ae5e0);UserProfileEvents['on'](_0x29341f,_0x516150);}}; \ No newline at end of file +var _0x0782=['./userProfile.events','save','remove','emit','register','length'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x0782,0xfc));var _0x2078=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x0782[_0x158f01];return _0x5ef74e;};'use strict';var UserProfileEvents=require(_0x2078('0x0'));var events=[_0x2078('0x1'),_0x2078('0x2'),'update'];function createListener(_0x58d3c2,_0x4e219a){return function(_0xbdd47f){_0x4e219a[_0x2078('0x3')](_0x58d3c2,_0xbdd47f);};}function removeListener(_0x279610,_0x2944d4){return function(){UserProfileEvents['removeListener'](_0x279610,_0x2944d4);};}exports[_0x2078('0x4')]=function(_0x34e8fd){for(var _0x1eac13=0x0,_0xba6bb5=events[_0x2078('0x5')];_0x1eac13<_0xba6bb5;_0x1eac13++){var _0x28c6c8=events[_0x1eac13];var _0x3848d3=createListener('userProfile:'+_0x28c6c8,_0x34e8fd);UserProfileEvents['on'](_0x28c6c8,_0x3848d3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index d7318fd..6b41ca0 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 _0xdf8d=['express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports','path'];(function(_0x355736,_0x44951a){var _0xd6a974=function(_0x10f710){while(--_0x10f710){_0x355736['push'](_0x355736['shift']());}};_0xd6a974(++_0x44951a);}(_0xdf8d,0x65));var _0xddf8=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xdf8d[_0x454018];return _0x24697d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xddf8('0x0'));var timeout=require('connect-timeout');var express=require(_0xddf8('0x1'));var router=express[_0xddf8('0x2')]();var fs_extra=require(_0xddf8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xddf8('0x4'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xddf8('0x5')]('/',auth[_0xddf8('0x6')](),controller[_0xddf8('0x7')]);router['get'](_0xddf8('0x8'),auth[_0xddf8('0x6')](),controller['describe']);router[_0xddf8('0x5')](_0xddf8('0x9'),auth[_0xddf8('0x6')](),controller[_0xddf8('0xa')]);router[_0xddf8('0xb')]('/',auth[_0xddf8('0x6')](),controller[_0xddf8('0xc')]);router[_0xddf8('0xd')]('/:id',auth[_0xddf8('0x6')](),controller['update']);router[_0xddf8('0xe')](_0xddf8('0x9'),auth[_0xddf8('0x6')](),controller[_0xddf8('0xf')]);module[_0xddf8('0x10')]=router; \ No newline at end of file +var _0x22b1=['Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/describe','describe','show','create','put','delete','/:id','util','path','express'];(function(_0x1df210,_0x3abe68){var _0x4a5027=function(_0x40efc3){while(--_0x40efc3){_0x1df210['push'](_0x1df210['shift']());}};_0x4a5027(++_0x3abe68);}(_0x22b1,0xc9));var _0x122b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x22b1[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x122b('0x0'));var path=require(_0x122b('0x1'));var timeout=require('connect-timeout');var express=require(_0x122b('0x2'));var router=express[_0x122b('0x3')]();var fs_extra=require(_0x122b('0x4'));var auth=require(_0x122b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x122b('0x6'));var controller=require(_0x122b('0x7'));router['get']('/',auth[_0x122b('0x8')](),controller['index']);router[_0x122b('0x9')](_0x122b('0xa'),auth[_0x122b('0x8')](),controller[_0x122b('0xb')]);router[_0x122b('0x9')]('/:id',auth[_0x122b('0x8')](),controller[_0x122b('0xc')]);router['post']('/',auth[_0x122b('0x8')](),controller[_0x122b('0xd')]);router[_0x122b('0xe')]('/:id',auth[_0x122b('0x8')](),controller['update']);router[_0x122b('0xf')](_0x122b('0x10'),auth[_0x122b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 6f92cd8..3af3ebf 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 _0xd1ea=['INTEGER','exports','STRING'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0xd1ea,0x88));var _0xad1e=function(_0x9823f0,_0x427cf6){_0x9823f0=_0x9823f0-0x0;var _0x415dc5=_0xd1ea[_0x9823f0];return _0x415dc5;};'use strict';var Sequelize=require('sequelize');module[_0xad1e('0x0')]={'name':{'type':Sequelize[_0xad1e('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xad1e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xad1e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x74fa=['INTEGER','sequelize','exports','STRING'];(function(_0x4f617f,_0x28248f){var _0xe56a5a=function(_0x664484){while(--_0x664484){_0x4f617f['push'](_0x4f617f['shift']());}};_0xe56a5a(++_0x28248f);}(_0x74fa,0x1bd));var _0xa74f=function(_0x275971,_0x571370){_0x275971=_0x275971-0x0;var _0x4ff609=_0x74fa[_0x275971];return _0x4ff609;};'use strict';var Sequelize=require(_0xa74f('0x0'));module[_0xa74f('0x1')]={'name':{'type':Sequelize[_0xa74f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa74f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa74f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index f038935..db70f88 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 _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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a07,0x74));var _0x72a0=function(_0x474f02,_0x44c5af){_0x474f02=_0x474f02-0x0;var _0x47321d=_0x2a07[_0x474f02];return _0x47321d;};'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 +var _0x896e=['hasOwnProperty','nolimit','order','sort','where','merge','filter','UserProfileResource','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x896e,0x1e9));var _0xe896=function(_0x162127,_0x20c333){_0x162127=_0x162127-0x0;var _0x2ae871=_0x896e[_0x162127];return _0x2ae871;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['UserProfileResource'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['UserProfileResource'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));};exports[_0xe896('0x4d')]=function(_0x57aed3,_0x343adb){return db[_0xe896('0x40')]['describe']()['then'](respondWithResult(_0x343adb,null))[_0xe896('0x45')](handleError(_0x343adb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a84b522..cf0ef33 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 _0x618f=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userProfileResource.attributes'];(function(_0x893179,_0x5b4c85){var _0x15d29c=function(_0x55b4ae){while(--_0x55b4ae){_0x893179['push'](_0x893179['shift']());}};_0x15d29c(++_0x5b4c85);}(_0x618f,0xb7));var _0xf618=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x618f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf618('0x0'));var util=require(_0xf618('0x1'));var logger=require(_0xf618('0x2'))(_0xf618('0x3'));var moment=require(_0xf618('0x4'));var BPromise=require(_0xf618('0x5'));var rp=require(_0xf618('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf618('0x7'));var attributes=require(_0xf618('0x8'));module[_0xf618('0x9')]=function(_0xccd820,_0x946e24){return _0xccd820[_0xf618('0xa')](_0xf618('0xb'),attributes,{'tableName':_0xf618('0xc'),'paranoid':![],'indexes':[{'name':_0xf618('0xd'),'fields':[_0xf618('0xe'),_0xf618('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd59c=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','UserProfileResource'];(function(_0x169d90,_0x1e8ddf){var _0x2b501e=function(_0x569e03){while(--_0x569e03){_0x169d90['push'](_0x169d90['shift']());}};_0x2b501e(++_0x1e8ddf);}(_0xd59c,0x170));var _0xcd59=function(_0x122d62,_0x28aab2){_0x122d62=_0x122d62-0x0;var _0x50b333=_0xd59c[_0x122d62];return _0x50b333;};'use strict';var _=require(_0xcd59('0x0'));var util=require('util');var logger=require(_0xcd59('0x1'))(_0xcd59('0x2'));var moment=require(_0xcd59('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd59('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd59('0x5'));var config=require(_0xcd59('0x6'));var attributes=require('./userProfileResource.attributes');module[_0xcd59('0x7')]=function(_0x3e5786,_0x2e746f){return _0x3e5786[_0xcd59('0x8')](_0xcd59('0x9'),attributes,{'tableName':_0xcd59('0xa'),'paranoid':![],'indexes':[{'name':_0xcd59('0xb'),'fields':[_0xcd59('0xc'),_0xcd59('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 2fe36d5..acd7a15 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 _0x821a=['request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','moment','ioredis','../../mysqldb','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x821a,0x9b));var _0xa821=function(_0x229262,_0x268c68){_0x229262=_0x229262-0x0;var _0x54431b=_0x821a[_0x229262];return _0x54431b;};'use strict';var _=require('lodash');var util=require(_0xa821('0x0'));var moment=require(_0xa821('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa821('0x2'));var db=require(_0xa821('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa821('0x4'));var client=jayson[_0xa821('0x5')][_0xa821('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x31f1f9,_0x485a4d,_0x35f199){return new BPromise(function(_0x1bd4a3,_0x149de9){return client[_0xa821('0x7')](_0x31f1f9,_0x35f199)[_0xa821('0x8')](function(_0x34f408){logger['info'](_0xa821('0x9'),_0x485a4d,_0xa821('0xa'));logger[_0xa821('0xb')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x485a4d,'request\x20sent',JSON[_0xa821('0xc')](_0x34f408));if(_0x34f408['error']){if(_0x34f408[_0xa821('0xd')][_0xa821('0xe')]===0x1f4){logger[_0xa821('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x485a4d,_0x34f408['error'][_0xa821('0xf')]);return _0x149de9(_0x34f408[_0xa821('0xd')]['message']);}logger[_0xa821('0xd')](_0xa821('0x9'),_0x485a4d,_0x34f408[_0xa821('0xd')]['message']);return _0x1bd4a3(_0x34f408[_0xa821('0xd')]['message']);}else{logger[_0xa821('0x10')](_0xa821('0x9'),_0x485a4d,_0xa821('0xa'));_0x1bd4a3(_0x34f408[_0xa821('0x11')][_0xa821('0xf')]);}})['catch'](function(_0x2a5e0a){logger[_0xa821('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x485a4d,_0x2a5e0a);_0x149de9(_0x2a5e0a);});});} \ No newline at end of file +var _0x9897=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x17ccac,_0x1c475c){var _0x5cae93=function(_0x2b13d1){while(--_0x2b13d1){_0x17ccac['push'](_0x17ccac['shift']());}};_0x5cae93(++_0x1c475c);}(_0x9897,0xda));var _0x7989=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x9897[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x7989('0x0'));var util=require(_0x7989('0x1'));var moment=require('moment');var BPromise=require(_0x7989('0x2'));var rs=require(_0x7989('0x3'));var fs=require('fs');var Redis=require(_0x7989('0x4'));var db=require(_0x7989('0x5'))['db'];var utils=require(_0x7989('0x6'));var logger=require('../../config/logger')(_0x7989('0x7'));var config=require(_0x7989('0x8'));var jayson=require(_0x7989('0x9'));var client=jayson[_0x7989('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5546be,_0xe8483d,_0x5ebfc7){return new BPromise(function(_0x6b6353,_0x15f295){return client[_0x7989('0xb')](_0x5546be,_0x5ebfc7)[_0x7989('0xc')](function(_0x59c480){logger[_0x7989('0xd')](_0x7989('0xe'),_0xe8483d,_0x7989('0xf'));logger[_0x7989('0x10')](_0x7989('0x11'),_0xe8483d,'request\x20sent',JSON['stringify'](_0x59c480));if(_0x59c480[_0x7989('0x12')]){if(_0x59c480[_0x7989('0x12')][_0x7989('0x13')]===0x1f4){logger[_0x7989('0x12')](_0x7989('0xe'),_0xe8483d,_0x59c480['error'][_0x7989('0x14')]);return _0x15f295(_0x59c480[_0x7989('0x12')][_0x7989('0x14')]);}logger[_0x7989('0x12')](_0x7989('0xe'),_0xe8483d,_0x59c480[_0x7989('0x12')][_0x7989('0x14')]);return _0x6b6353(_0x59c480[_0x7989('0x12')]['message']);}else{logger['info'](_0x7989('0xe'),_0xe8483d,_0x7989('0xf'));_0x6b6353(_0x59c480['result'][_0x7989('0x14')]);}})['catch'](function(_0x1684a4){logger[_0x7989('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xe8483d,_0x1684a4);_0x15f295(_0x1684a4);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b6a2446..6f41f54 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 _0x5b1b=['./userProfileSection.controller','isAuthenticated','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x5b1b,0x162));var _0xb5b1=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5b1b[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xb5b1('0x0'));var util=require(_0xb5b1('0x1'));var path=require(_0xb5b1('0x2'));var timeout=require(_0xb5b1('0x3'));var express=require(_0xb5b1('0x4'));var router=express[_0xb5b1('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb5b1('0x6'));var controller=require(_0xb5b1('0x7'));router['get']('/',auth[_0xb5b1('0x8')](),controller['index']);router[_0xb5b1('0x9')](_0xb5b1('0xa'),auth[_0xb5b1('0x8')](),controller[_0xb5b1('0xb')]);router[_0xb5b1('0x9')](_0xb5b1('0xc'),auth['isAuthenticated'](),controller[_0xb5b1('0xd')]);router[_0xb5b1('0xe')]('/',auth[_0xb5b1('0x8')](),controller['create']);router['put'](_0xb5b1('0xc'),auth[_0xb5b1('0x8')](),controller[_0xb5b1('0xf')]);router[_0xb5b1('0x10')](_0xb5b1('0xc'),auth['isAuthenticated'](),controller[_0xb5b1('0x11')]);module[_0xb5b1('0x12')]=router; \ No newline at end of file +var _0x807e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x807e,0x1a4));var _0xe807=function(_0x1ccefb,_0x240448){_0x1ccefb=_0x1ccefb-0x0;var _0x189504=_0x807e[_0x1ccefb];return _0x189504;};'use strict';var multer=require(_0xe807('0x0'));var util=require(_0xe807('0x1'));var path=require(_0xe807('0x2'));var timeout=require(_0xe807('0x3'));var express=require(_0xe807('0x4'));var router=express[_0xe807('0x5')]();var fs_extra=require(_0xe807('0x6'));var auth=require(_0xe807('0x7'));var interaction=require(_0xe807('0x8'));var config=require('../../config/environment');var controller=require(_0xe807('0x9'));router['get']('/',auth[_0xe807('0xa')](),controller[_0xe807('0xb')]);router[_0xe807('0xc')](_0xe807('0xd'),auth[_0xe807('0xa')](),controller['describe']);router[_0xe807('0xc')](_0xe807('0xe'),auth[_0xe807('0xa')](),controller[_0xe807('0xf')]);router[_0xe807('0x10')]('/',auth[_0xe807('0xa')](),controller[_0xe807('0x11')]);router['put'](_0xe807('0xe'),auth[_0xe807('0xa')](),controller[_0xe807('0x12')]);router[_0xe807('0x13')]('/:id',auth[_0xe807('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0b6147f..754f28f 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 _0x282b=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0x6efff0,_0x4f98b2){var _0x55b004=function(_0x5b59c1){while(--_0x5b59c1){_0x6efff0['push'](_0x6efff0['shift']());}};_0x55b004(++_0x4f98b2);}(_0x282b,0xec));var _0xb282=function(_0x459dfe,_0x37944c){_0x459dfe=_0x459dfe-0x0;var _0x3dd230=_0x282b[_0x459dfe];return _0x3dd230;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'name':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xb282('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb282('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb282('0x2')],'set':function(_0x5cadd7){this[_0xb282('0x4')](_0xb282('0x5'),_0x5cadd7?_0x5cadd7[_0xb282('0x6')](''):[]);},'get':function(){return this[_0xb282('0x7')](_0xb282('0x5'))?this[_0xb282('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0x5c00=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue'];(function(_0x15892f,_0x5269cc){var _0x1142d7=function(_0x4e8b8a){while(--_0x4e8b8a){_0x15892f['push'](_0x15892f['shift']());}};_0x1142d7(++_0x5269cc);}(_0x5c00,0x17e));var _0x05c0=function(_0x308944,_0x1c462e){_0x308944=_0x308944-0x0;var _0x2bf805=_0x5c00[_0x308944];return _0x2bf805;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x05c0('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x05c0('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x05c0('0x2')],'set':function(_0x37b644){this[_0x05c0('0x5')]('crudPermissions',_0x37b644?_0x37b644[_0x05c0('0x6')](''):[]);},'get':function(){return this[_0x05c0('0x7')](_0x05c0('0x8'))?this[_0x05c0('0x7')]('crudPermissions')[_0x05c0('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e3fbe5a..b400a67 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 _0xb5f5=['hasOwnProperty','nolimit','order','sort','pick','filter','where','map','merge','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','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','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x1d91c6,_0x6d90ba){var _0x29ce25=function(_0x55645c){while(--_0x55645c){_0x1d91c6['push'](_0x1d91c6['shift']());}};_0x29ce25(++_0x6d90ba);}(_0xb5f5,0xf8));var _0x5b5f=function(_0x16f4e5,_0x2de654){_0x16f4e5=_0x16f4e5-0x0;var _0x4fd22e=_0xb5f5[_0x16f4e5];return _0x4fd22e;};'use strict';var emlformat=require(_0x5b5f('0x0'));var rimraf=require(_0x5b5f('0x1'));var zipdir=require(_0x5b5f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b5f('0x3'));var moment=require(_0x5b5f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5b5f('0x5'));var util=require('util');var path=require(_0x5b5f('0x6'));var sox=require(_0x5b5f('0x7'));var csv=require('to-csv');var ejs=require(_0x5b5f('0x8'));var fs=require('fs');var fs_extra=require(_0x5b5f('0x9'));var _=require(_0x5b5f('0xa'));var squel=require(_0x5b5f('0xb'));var crypto=require(_0x5b5f('0xc'));var jsforce=require(_0x5b5f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5b5f('0xe'));var querystring=require(_0x5b5f('0xf'));var Papa=require(_0x5b5f('0x10'));var Redis=require('ioredis');var authService=require(_0x5b5f('0x11'));var qs=require(_0x5b5f('0x12'));var as=require(_0x5b5f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b5f('0x14'))(_0x5b5f('0x15'));var utils=require(_0x5b5f('0x16'));var config=require(_0x5b5f('0x17'));var licenseUtil=require(_0x5b5f('0x18'));var db=require(_0x5b5f('0x19'))['db'];function respondWithStatusCode(_0x2bdd40,_0x1602d6){_0x1602d6=_0x1602d6||0xcc;return function(_0x5b4f01){if(_0x5b4f01){return _0x2bdd40['sendStatus'](_0x1602d6);}return _0x2bdd40[_0x5b5f('0x1a')](_0x1602d6)[_0x5b5f('0x1b')]();};}function respondWithResult(_0x5a9406,_0x4f2033){_0x4f2033=_0x4f2033||0xc8;return function(_0x325aa1){if(_0x325aa1){return _0x5a9406[_0x5b5f('0x1a')](_0x4f2033)[_0x5b5f('0x1c')](_0x325aa1);}};}function respondWithFilteredResult(_0x2ab98f,_0x1b9bed){return function(_0x856707){if(_0x856707){var _0x4273cb=typeof _0x1b9bed[_0x5b5f('0x1d')]===_0x5b5f('0x1e')&&typeof _0x1b9bed[_0x5b5f('0x1f')]===_0x5b5f('0x1e');var _0x5c0776=_0x856707[_0x5b5f('0x20')];var _0x249f0e=_0x4273cb?0x0:_0x1b9bed[_0x5b5f('0x1d')];var _0x162638=_0x4273cb?_0x856707[_0x5b5f('0x20')]:_0x1b9bed[_0x5b5f('0x1d')]+_0x1b9bed['limit'];var _0x518413;if(_0x162638>=_0x5c0776){_0x162638=_0x5c0776;_0x518413=0xc8;}else{_0x518413=0xce;}_0x2ab98f[_0x5b5f('0x1a')](_0x518413);return _0x2ab98f['set'](_0x5b5f('0x21'),_0x249f0e+'-'+_0x162638+'/'+_0x5c0776)['json'](_0x856707);}return null;};}function patchUpdates(_0x2e973d){return function(_0x470b78){try{jsonpatch['apply'](_0x470b78,_0x2e973d,!![]);}catch(_0x235fb4){return BPromise['reject'](_0x235fb4);}return _0x470b78[_0x5b5f('0x22')]();};}function saveUpdates(_0x3c5bfb,_0x3188f9){return function(_0x30cbe5){if(_0x30cbe5){return _0x30cbe5[_0x5b5f('0x23')](_0x3c5bfb)['then'](function(_0x681c42){return _0x681c42;});}return null;};}function removeEntity(_0x1bb64a,_0x1cd3fe){return function(_0x228b61){if(_0x228b61){return _0x228b61[_0x5b5f('0x24')]()[_0x5b5f('0x25')](function(){_0x1bb64a['status'](0xcc)[_0x5b5f('0x1b')]();});}};}function handleEntityNotFound(_0x429e0d,_0x5dee8b){return function(_0x31a896){if(!_0x31a896){_0x429e0d['sendStatus'](0x194);}return _0x31a896;};}function handleError(_0x1b9717,_0x2c691a){_0x2c691a=_0x2c691a||0x1f4;return function(_0x3d56f6){logger[_0x5b5f('0x26')](_0x3d56f6[_0x5b5f('0x27')]);if(_0x3d56f6[_0x5b5f('0x28')]){delete _0x3d56f6[_0x5b5f('0x28')];}_0x1b9717[_0x5b5f('0x1a')](_0x2c691a)[_0x5b5f('0x29')](_0x3d56f6);};}exports[_0x5b5f('0x2a')]=function(_0x24070b,_0x21de42){var _0x46ed0e={},_0x1a4c1a={},_0x513c4d={'count':0x0,'rows':[]};var _0x58163c=_['map'](db[_0x5b5f('0x2b')][_0x5b5f('0x2c')],function(_0x53d47c){return{'name':_0x53d47c[_0x5b5f('0x2d')],'type':_0x53d47c[_0x5b5f('0x2e')][_0x5b5f('0x2f')]};});_0x1a4c1a[_0x5b5f('0x30')]=_['map'](_0x58163c,'name');_0x1a4c1a[_0x5b5f('0x31')]=_[_0x5b5f('0x32')](_0x24070b[_0x5b5f('0x31')]);_0x1a4c1a[_0x5b5f('0x33')]=_[_0x5b5f('0x34')](_0x1a4c1a[_0x5b5f('0x30')],_0x1a4c1a[_0x5b5f('0x31')]);_0x46ed0e['attributes']=_[_0x5b5f('0x34')](_0x1a4c1a[_0x5b5f('0x30')],qs[_0x5b5f('0x35')](_0x24070b[_0x5b5f('0x31')][_0x5b5f('0x35')]));_0x46ed0e[_0x5b5f('0x36')]=_0x46ed0e[_0x5b5f('0x36')][_0x5b5f('0x37')]?_0x46ed0e['attributes']:_0x1a4c1a['model'];if(!_0x24070b['query'][_0x5b5f('0x38')](_0x5b5f('0x39'))){_0x46ed0e[_0x5b5f('0x1f')]=qs[_0x5b5f('0x1f')](_0x24070b[_0x5b5f('0x31')][_0x5b5f('0x1f')]);_0x46ed0e[_0x5b5f('0x1d')]=qs['offset'](_0x24070b[_0x5b5f('0x31')]['offset']);}_0x46ed0e[_0x5b5f('0x3a')]=qs[_0x5b5f('0x3b')](_0x24070b['query']['sort']);_0x46ed0e['where']=qs['filters'](_[_0x5b5f('0x3c')](_0x24070b[_0x5b5f('0x31')],_0x1a4c1a[_0x5b5f('0x33')]),_0x58163c);if(_0x24070b['query'][_0x5b5f('0x3d')]){_0x46ed0e[_0x5b5f('0x3e')]=_['merge'](_0x46ed0e['where'],{'$or':_[_0x5b5f('0x3f')](_0x58163c,function(_0x1a6f75){if(_0x1a6f75[_0x5b5f('0x2e')]!=='VIRTUAL'){var _0x1d8d8d={};_0x1d8d8d[_0x1a6f75[_0x5b5f('0x28')]]={'$like':'%'+_0x24070b[_0x5b5f('0x31')][_0x5b5f('0x3d')]+'%'};return _0x1d8d8d;}})});}_0x46ed0e=_[_0x5b5f('0x40')]({},_0x46ed0e,_0x24070b['options']);var _0x49ee59={'where':_0x46ed0e[_0x5b5f('0x3e')]};return db[_0x5b5f('0x2b')][_0x5b5f('0x20')](_0x49ee59)[_0x5b5f('0x25')](function(_0x317df3){_0x513c4d['count']=_0x317df3;if(_0x24070b[_0x5b5f('0x31')][_0x5b5f('0x41')]){_0x46ed0e[_0x5b5f('0x42')]=[{'all':!![]}];}return db[_0x5b5f('0x2b')]['findAll'](_0x46ed0e);})[_0x5b5f('0x25')](function(_0x151f7a){_0x513c4d[_0x5b5f('0x43')]=_0x151f7a;return _0x513c4d;})[_0x5b5f('0x25')](respondWithFilteredResult(_0x21de42,_0x46ed0e))[_0x5b5f('0x44')](handleError(_0x21de42,null));};exports[_0x5b5f('0x45')]=function(_0x107ffd,_0x3770ff){var _0x37db4f={'raw':![],'where':{'id':_0x107ffd[_0x5b5f('0x46')]['id']}},_0xf08c43={};_0xf08c43[_0x5b5f('0x30')]=_['keys'](db['UserProfileSection'][_0x5b5f('0x2c')]);_0xf08c43['query']=_[_0x5b5f('0x32')](_0x107ffd[_0x5b5f('0x31')]);_0xf08c43[_0x5b5f('0x33')]=_[_0x5b5f('0x34')](_0xf08c43['model'],_0xf08c43[_0x5b5f('0x31')]);_0x37db4f[_0x5b5f('0x36')]=_[_0x5b5f('0x34')](_0xf08c43[_0x5b5f('0x30')],qs[_0x5b5f('0x35')](_0x107ffd[_0x5b5f('0x31')][_0x5b5f('0x35')]));_0x37db4f['attributes']=_0x37db4f['attributes'][_0x5b5f('0x37')]?_0x37db4f[_0x5b5f('0x36')]:_0xf08c43[_0x5b5f('0x30')];if(_0x107ffd[_0x5b5f('0x31')]['includeAll']){_0x37db4f[_0x5b5f('0x42')]=[{'all':!![]}];}_0x37db4f=_[_0x5b5f('0x40')]({},_0x37db4f,_0x107ffd[_0x5b5f('0x47')]);return db[_0x5b5f('0x2b')][_0x5b5f('0x48')](_0x37db4f)['then'](handleEntityNotFound(_0x3770ff,null))[_0x5b5f('0x25')](respondWithResult(_0x3770ff,null))[_0x5b5f('0x44')](handleError(_0x3770ff,null));};exports[_0x5b5f('0x49')]=function(_0x3701e1,_0x3147aa){return db[_0x5b5f('0x2b')][_0x5b5f('0x49')](_0x3701e1[_0x5b5f('0x4a')],{})[_0x5b5f('0x25')](respondWithResult(_0x3147aa,0xc9))[_0x5b5f('0x44')](handleError(_0x3147aa,null));};exports[_0x5b5f('0x23')]=function(_0x31656a,_0x20ffda){if(_0x31656a[_0x5b5f('0x4a')]['id']){delete _0x31656a[_0x5b5f('0x4a')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x31656a[_0x5b5f('0x46')]['id']}})['then'](handleEntityNotFound(_0x20ffda,null))[_0x5b5f('0x25')](saveUpdates(_0x31656a[_0x5b5f('0x4a')],null))[_0x5b5f('0x25')](respondWithResult(_0x20ffda,null))[_0x5b5f('0x44')](handleError(_0x20ffda,null));};exports[_0x5b5f('0x24')]=function(_0x29efd5,_0x4a9edc){return db[_0x5b5f('0x2b')][_0x5b5f('0x48')]({'where':{'id':_0x29efd5[_0x5b5f('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a9edc,null))['then'](removeEntity(_0x4a9edc,null))['catch'](handleError(_0x4a9edc,null));};exports[_0x5b5f('0x4b')]=function(_0x5b29a6,_0x124055){return db[_0x5b5f('0x2b')][_0x5b5f('0x4b')]()['then'](respondWithResult(_0x124055,null))[_0x5b5f('0x44')](handleError(_0x124055,null));}; \ No newline at end of file +var _0xba8f=['query','keys','filters','intersection','model','fields','attributes','length','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','UserProfileSection','rows','catch','show','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type'];(function(_0x2e1f1d,_0x422665){var _0xe652ea=function(_0x59218f){while(--_0x59218f){_0x2e1f1d['push'](_0x2e1f1d['shift']());}};_0xe652ea(++_0x422665);}(_0xba8f,0xb0));var _0xfba8=function(_0x3869c8,_0x2ff137){_0x3869c8=_0x3869c8-0x0;var _0x4caf60=_0xba8f[_0x3869c8];return _0x4caf60;};'use strict';var emlformat=require(_0xfba8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfba8('0x1'));var jsonpatch=require(_0xfba8('0x2'));var rp=require('request-promise');var moment=require(_0xfba8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfba8('0x4'));var util=require(_0xfba8('0x5'));var path=require(_0xfba8('0x6'));var sox=require(_0xfba8('0x7'));var csv=require(_0xfba8('0x8'));var ejs=require(_0xfba8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfba8('0xa'));var squel=require(_0xfba8('0xb'));var crypto=require(_0xfba8('0xc'));var jsforce=require(_0xfba8('0xd'));var deskjs=require(_0xfba8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfba8('0xf'));var Papa=require('papaparse');var Redis=require(_0xfba8('0x10'));var authService=require(_0xfba8('0x11'));var qs=require(_0xfba8('0x12'));var as=require(_0xfba8('0x13'));var hardwareService=require(_0xfba8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfba8('0x15'));var config=require(_0xfba8('0x16'));var licenseUtil=require(_0xfba8('0x17'));var db=require(_0xfba8('0x18'))['db'];function respondWithStatusCode(_0x4a2930,_0x40c3a1){_0x40c3a1=_0x40c3a1||0xcc;return function(_0x382f51){if(_0x382f51){return _0x4a2930[_0xfba8('0x19')](_0x40c3a1);}return _0x4a2930['status'](_0x40c3a1)[_0xfba8('0x1a')]();};}function respondWithResult(_0xc96829,_0x2091dd){_0x2091dd=_0x2091dd||0xc8;return function(_0x55b0c5){if(_0x55b0c5){return _0xc96829[_0xfba8('0x1b')](_0x2091dd)['json'](_0x55b0c5);}};}function respondWithFilteredResult(_0x2a5f9e,_0x35bbfc){return function(_0x3cf92e){if(_0x3cf92e){var _0x87a90c=typeof _0x35bbfc['offset']==='undefined'&&typeof _0x35bbfc['limit']===_0xfba8('0x1c');var _0x212aa0=_0x3cf92e[_0xfba8('0x1d')];var _0x2d31ea=_0x87a90c?0x0:_0x35bbfc[_0xfba8('0x1e')];var _0x3f1850=_0x87a90c?_0x3cf92e['count']:_0x35bbfc[_0xfba8('0x1e')]+_0x35bbfc['limit'];var _0x1fa3b5;if(_0x3f1850>=_0x212aa0){_0x3f1850=_0x212aa0;_0x1fa3b5=0xc8;}else{_0x1fa3b5=0xce;}_0x2a5f9e[_0xfba8('0x1b')](_0x1fa3b5);return _0x2a5f9e[_0xfba8('0x1f')](_0xfba8('0x20'),_0x2d31ea+'-'+_0x3f1850+'/'+_0x212aa0)[_0xfba8('0x21')](_0x3cf92e);}return null;};}function patchUpdates(_0x4bb0bc){return function(_0xb6f07f){try{jsonpatch['apply'](_0xb6f07f,_0x4bb0bc,!![]);}catch(_0x3376f3){return BPromise[_0xfba8('0x22')](_0x3376f3);}return _0xb6f07f[_0xfba8('0x23')]();};}function saveUpdates(_0x20d73e,_0x4dff1d){return function(_0x410102){if(_0x410102){return _0x410102[_0xfba8('0x24')](_0x20d73e)[_0xfba8('0x25')](function(_0x3ba13b){return _0x3ba13b;});}return null;};}function removeEntity(_0x5158b5,_0x189e4a){return function(_0x4824aa){if(_0x4824aa){return _0x4824aa[_0xfba8('0x26')]()['then'](function(){_0x5158b5['status'](0xcc)[_0xfba8('0x1a')]();});}};}function handleEntityNotFound(_0x564da3,_0x38bb02){return function(_0x34170e){if(!_0x34170e){_0x564da3[_0xfba8('0x19')](0x194);}return _0x34170e;};}function handleError(_0x58f2df,_0x191f10){_0x191f10=_0x191f10||0x1f4;return function(_0x3de395){logger[_0xfba8('0x27')](_0x3de395['stack']);if(_0x3de395[_0xfba8('0x28')]){delete _0x3de395[_0xfba8('0x28')];}_0x58f2df[_0xfba8('0x1b')](_0x191f10)[_0xfba8('0x29')](_0x3de395);};}exports[_0xfba8('0x2a')]=function(_0x24ce3b,_0x28e53a){var _0x59c3dc={},_0x330ec3={},_0x373411={'count':0x0,'rows':[]};var _0xe8e3cc=_[_0xfba8('0x2b')](db['UserProfileSection'][_0xfba8('0x2c')],function(_0x3658f9){return{'name':_0x3658f9['fieldName'],'type':_0x3658f9[_0xfba8('0x2d')]['key']};});_0x330ec3['model']=_[_0xfba8('0x2b')](_0xe8e3cc,_0xfba8('0x28'));_0x330ec3[_0xfba8('0x2e')]=_[_0xfba8('0x2f')](_0x24ce3b[_0xfba8('0x2e')]);_0x330ec3[_0xfba8('0x30')]=_[_0xfba8('0x31')](_0x330ec3[_0xfba8('0x32')],_0x330ec3[_0xfba8('0x2e')]);_0x59c3dc['attributes']=_[_0xfba8('0x31')](_0x330ec3[_0xfba8('0x32')],qs[_0xfba8('0x33')](_0x24ce3b['query'][_0xfba8('0x33')]));_0x59c3dc['attributes']=_0x59c3dc[_0xfba8('0x34')][_0xfba8('0x35')]?_0x59c3dc[_0xfba8('0x34')]:_0x330ec3[_0xfba8('0x32')];if(!_0x24ce3b[_0xfba8('0x2e')]['hasOwnProperty']('nolimit')){_0x59c3dc[_0xfba8('0x36')]=qs['limit'](_0x24ce3b[_0xfba8('0x2e')]['limit']);_0x59c3dc['offset']=qs[_0xfba8('0x1e')](_0x24ce3b[_0xfba8('0x2e')][_0xfba8('0x1e')]);}_0x59c3dc[_0xfba8('0x37')]=qs[_0xfba8('0x38')](_0x24ce3b[_0xfba8('0x2e')]['sort']);_0x59c3dc[_0xfba8('0x39')]=qs['filters'](_[_0xfba8('0x3a')](_0x24ce3b[_0xfba8('0x2e')],_0x330ec3['filters']),_0xe8e3cc);if(_0x24ce3b[_0xfba8('0x2e')][_0xfba8('0x3b')]){_0x59c3dc[_0xfba8('0x39')]=_['merge'](_0x59c3dc[_0xfba8('0x39')],{'$or':_[_0xfba8('0x2b')](_0xe8e3cc,function(_0x14edc7){if(_0x14edc7[_0xfba8('0x2d')]!==_0xfba8('0x3c')){var _0x258ed7={};_0x258ed7[_0x14edc7[_0xfba8('0x28')]]={'$like':'%'+_0x24ce3b[_0xfba8('0x2e')][_0xfba8('0x3b')]+'%'};return _0x258ed7;}})});}_0x59c3dc=_[_0xfba8('0x3d')]({},_0x59c3dc,_0x24ce3b['options']);var _0xaadb0c={'where':_0x59c3dc[_0xfba8('0x39')]};return db['UserProfileSection'][_0xfba8('0x1d')](_0xaadb0c)[_0xfba8('0x25')](function(_0x264637){_0x373411['count']=_0x264637;if(_0x24ce3b[_0xfba8('0x2e')][_0xfba8('0x3e')]){_0x59c3dc[_0xfba8('0x3f')]=[{'all':!![]}];}return db[_0xfba8('0x40')]['findAll'](_0x59c3dc);})['then'](function(_0x3ab922){_0x373411[_0xfba8('0x41')]=_0x3ab922;return _0x373411;})['then'](respondWithFilteredResult(_0x28e53a,_0x59c3dc))[_0xfba8('0x42')](handleError(_0x28e53a,null));};exports[_0xfba8('0x43')]=function(_0x42a1f0,_0x58cc10){var _0xe2fef5={'raw':![],'where':{'id':_0x42a1f0[_0xfba8('0x44')]['id']}},_0x2e70f7={};_0x2e70f7[_0xfba8('0x32')]=_['keys'](db['UserProfileSection']['rawAttributes']);_0x2e70f7['query']=_[_0xfba8('0x2f')](_0x42a1f0[_0xfba8('0x2e')]);_0x2e70f7[_0xfba8('0x30')]=_[_0xfba8('0x31')](_0x2e70f7[_0xfba8('0x32')],_0x2e70f7[_0xfba8('0x2e')]);_0xe2fef5[_0xfba8('0x34')]=_[_0xfba8('0x31')](_0x2e70f7[_0xfba8('0x32')],qs[_0xfba8('0x33')](_0x42a1f0['query'][_0xfba8('0x33')]));_0xe2fef5[_0xfba8('0x34')]=_0xe2fef5[_0xfba8('0x34')]['length']?_0xe2fef5[_0xfba8('0x34')]:_0x2e70f7['model'];if(_0x42a1f0[_0xfba8('0x2e')][_0xfba8('0x3e')]){_0xe2fef5['include']=[{'all':!![]}];}_0xe2fef5=_[_0xfba8('0x3d')]({},_0xe2fef5,_0x42a1f0[_0xfba8('0x45')]);return db[_0xfba8('0x40')]['find'](_0xe2fef5)[_0xfba8('0x25')](handleEntityNotFound(_0x58cc10,null))[_0xfba8('0x25')](respondWithResult(_0x58cc10,null))['catch'](handleError(_0x58cc10,null));};exports[_0xfba8('0x46')]=function(_0x32853b,_0x473d98){return db[_0xfba8('0x40')][_0xfba8('0x46')](_0x32853b[_0xfba8('0x47')],{})[_0xfba8('0x25')](respondWithResult(_0x473d98,0xc9))[_0xfba8('0x42')](handleError(_0x473d98,null));};exports['update']=function(_0x30da2d,_0x33acd8){if(_0x30da2d[_0xfba8('0x47')]['id']){delete _0x30da2d['body']['id'];}return db[_0xfba8('0x40')][_0xfba8('0x48')]({'where':{'id':_0x30da2d[_0xfba8('0x44')]['id']}})[_0xfba8('0x25')](handleEntityNotFound(_0x33acd8,null))[_0xfba8('0x25')](saveUpdates(_0x30da2d['body'],null))[_0xfba8('0x25')](respondWithResult(_0x33acd8,null))[_0xfba8('0x42')](handleError(_0x33acd8,null));};exports['destroy']=function(_0x3829fe,_0x5365e9){return db[_0xfba8('0x40')]['find']({'where':{'id':_0x3829fe[_0xfba8('0x44')]['id']}})[_0xfba8('0x25')](handleEntityNotFound(_0x5365e9,null))['then'](removeEntity(_0x5365e9,null))[_0xfba8('0x42')](handleError(_0x5365e9,null));};exports[_0xfba8('0x49')]=function(_0x39332b,_0x2d637a){return db['UserProfileSection']['describe']()[_0xfba8('0x25')](respondWithResult(_0x2d637a,null))[_0xfba8('0x42')](handleError(_0x2d637a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 13f741c..74c3baf 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 _0xf2bd=['api','moment','bluebird','request-promise','path','rimraf','exports','define','user_profile_has_sections','compositeIndex','lodash','util','../../config/logger'];(function(_0x3dd91f,_0x815f56){var _0x4e1ffc=function(_0x428319){while(--_0x428319){_0x3dd91f['push'](_0x3dd91f['shift']());}};_0x4e1ffc(++_0x815f56);}(_0xf2bd,0x135));var _0xdf2b=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xf2bd[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xdf2b('0x0'));var util=require(_0xdf2b('0x1'));var logger=require(_0xdf2b('0x2'))(_0xdf2b('0x3'));var moment=require(_0xdf2b('0x4'));var BPromise=require(_0xdf2b('0x5'));var rp=require(_0xdf2b('0x6'));var fs=require('fs');var path=require(_0xdf2b('0x7'));var rimraf=require(_0xdf2b('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xdf2b('0x9')]=function(_0x25cc58,_0x271967){return _0x25cc58[_0xdf2b('0xa')]('UserProfileSection',attributes,{'tableName':_0xdf2b('0xb'),'paranoid':![],'indexes':[{'name':_0xdf2b('0xc'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x545e=['lodash','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x80b13c,_0x3fe450){var _0x14260f=function(_0x227cfe){while(--_0x227cfe){_0x80b13c['push'](_0x80b13c['shift']());}};_0x14260f(++_0x3fe450);}(_0x545e,0xfc));var _0xe545=function(_0x5e5093,_0x36b082){_0x5e5093=_0x5e5093-0x0;var _0x3f525d=_0x545e[_0x5e5093];return _0x3f525d;};'use strict';var _=require(_0xe545('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe545('0x1'));var rp=require(_0xe545('0x2'));var fs=require('fs');var path=require(_0xe545('0x3'));var rimraf=require(_0xe545('0x4'));var config=require('../../config/environment');var attributes=require(_0xe545('0x5'));module[_0xe545('0x6')]=function(_0x33511a,_0x3d0518){return _0x33511a[_0xe545('0x7')]('UserProfileSection',attributes,{'tableName':_0xe545('0x8'),'paranoid':![],'indexes':[{'name':_0xe545('0x9'),'fields':[_0xe545('0xa'),_0xe545('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 1d2ab25..2805610 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 _0x028a=['message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1b16ba,_0xe1a8dc){var _0x30d703=function(_0x4b6f53){while(--_0x4b6f53){_0x1b16ba['push'](_0x1b16ba['shift']());}};_0x30d703(++_0xe1a8dc);}(_0x028a,0xfd));var _0xa028=function(_0x36da48,_0xd4f63b){_0x36da48=_0x36da48-0x0;var _0x2c0be6=_0x028a[_0x36da48];return _0x2c0be6;};'use strict';var _=require(_0xa028('0x0'));var util=require(_0xa028('0x1'));var moment=require(_0xa028('0x2'));var BPromise=require('bluebird');var rs=require(_0xa028('0x3'));var fs=require('fs');var Redis=require(_0xa028('0x4'));var db=require(_0xa028('0x5'))['db'];var utils=require(_0xa028('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa028('0x7'));var jayson=require(_0xa028('0x8'));var client=jayson[_0xa028('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x564224,_0x5e276a,_0x5224ca){return new BPromise(function(_0x200701,_0x5c3dd5){return client[_0xa028('0xa')](_0x564224,_0x5224ca)[_0xa028('0xb')](function(_0x5cfdc8){logger[_0xa028('0xc')](_0xa028('0xd'),_0x5e276a,_0xa028('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5e276a,_0xa028('0xe'),JSON[_0xa028('0xf')](_0x5cfdc8));if(_0x5cfdc8['error']){if(_0x5cfdc8['error']['code']===0x1f4){logger[_0xa028('0x10')](_0xa028('0xd'),_0x5e276a,_0x5cfdc8[_0xa028('0x10')][_0xa028('0x11')]);return _0x5c3dd5(_0x5cfdc8['error'][_0xa028('0x11')]);}logger['error'](_0xa028('0xd'),_0x5e276a,_0x5cfdc8[_0xa028('0x10')][_0xa028('0x11')]);return _0x200701(_0x5cfdc8[_0xa028('0x10')][_0xa028('0x11')]);}else{logger[_0xa028('0xc')](_0xa028('0xd'),_0x5e276a,_0xa028('0xe'));_0x200701(_0x5cfdc8['result'][_0xa028('0x11')]);}})['catch'](function(_0x267816){logger['error'](_0xa028('0xd'),_0x5e276a,_0x267816);_0x5c3dd5(_0x267816);});});} \ No newline at end of file +var _0xc3d9=['error','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x29f1b5,_0x19ac42){var _0x5bcfbd=function(_0x126629){while(--_0x126629){_0x29f1b5['push'](_0x29f1b5['shift']());}};_0x5bcfbd(++_0x19ac42);}(_0xc3d9,0x6e));var _0x9c3d=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xc3d9[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9c3d('0x0'));var BPromise=require('bluebird');var rs=require(_0x9c3d('0x1'));var fs=require('fs');var Redis=require(_0x9c3d('0x2'));var db=require(_0x9c3d('0x3'))['db'];var utils=require(_0x9c3d('0x4'));var logger=require(_0x9c3d('0x5'))('rpc');var config=require(_0x9c3d('0x6'));var jayson=require(_0x9c3d('0x7'));var client=jayson[_0x9c3d('0x8')][_0x9c3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2458e8,_0x2d4f3d,_0x4d7ddc){return new BPromise(function(_0x179ec0,_0x2647c3){return client[_0x9c3d('0xa')](_0x2458e8,_0x4d7ddc)[_0x9c3d('0xb')](function(_0x46917e){logger[_0x9c3d('0xc')](_0x9c3d('0xd'),_0x2d4f3d,_0x9c3d('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2d4f3d,_0x9c3d('0xe'),JSON[_0x9c3d('0xf')](_0x46917e));if(_0x46917e[_0x9c3d('0x10')]){if(_0x46917e[_0x9c3d('0x10')]['code']===0x1f4){logger['error'](_0x9c3d('0xd'),_0x2d4f3d,_0x46917e['error']['message']);return _0x2647c3(_0x46917e[_0x9c3d('0x10')]['message']);}logger[_0x9c3d('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2d4f3d,_0x46917e[_0x9c3d('0x10')][_0x9c3d('0x11')]);return _0x179ec0(_0x46917e['error'][_0x9c3d('0x11')]);}else{logger[_0x9c3d('0xc')](_0x9c3d('0xd'),_0x2d4f3d,_0x9c3d('0xe'));_0x179ec0(_0x46917e['result'][_0x9c3d('0x11')]);}})['catch'](function(_0x3728a5){logger[_0x9c3d('0x10')](_0x9c3d('0xd'),_0x2d4f3d,_0x3728a5);_0x2647c3(_0x3728a5);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 62a836c..df114d8 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5d83d5,_0x47bebb){var _0x103e97=function(_0x40bec0){while(--_0x40bec0){_0x5d83d5['push'](_0x5d83d5['shift']());}};_0x103e97(++_0x47bebb);}(_0xedd9,0xfc));var _0x9edd=function(_0x1f750a,_0x244a8d){_0x1f750a=_0x1f750a-0x0;var _0x4fa658=_0xedd9[_0x1f750a];return _0x4fa658;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3d71a3,_0x3a33b7){var _0x5bb3ab=function(_0x2834f2){while(--_0x2834f2){_0x3d71a3['push'](_0x3d71a3['shift']());}};_0x5bb3ab(++_0x3a33b7);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b13b52a..0710896 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 _0x1ac3=['exports','INTEGER','sequelize'];(function(_0x198abb,_0x582c52){var _0x40bf4b=function(_0x3c60f9){while(--_0x3c60f9){_0x198abb['push'](_0x198abb['shift']());}};_0x40bf4b(++_0x582c52);}(_0x1ac3,0x17c));var _0x31ac=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x1ac3[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0x31ac('0x0'));module[_0x31ac('0x1')]={'penalty':{'type':Sequelize[_0x31ac('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x963e=['exports','INTEGER'];(function(_0x302336,_0x1bfc38){var _0x59dac5=function(_0x2c1b8a){while(--_0x2c1b8a){_0x302336['push'](_0x302336['shift']());}};_0x59dac5(++_0x1bfc38);}(_0x963e,0x1e0));var _0xe963=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x963e[_0x590b61];return _0x1a14dc;};'use strict';var Sequelize=require('sequelize');module[_0xe963('0x0')]={'penalty':{'type':Sequelize[_0xe963('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index a5715b9..b6242aa 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 _0x5e0e=['../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x11a6bd,_0x526e61){var _0x120525=function(_0x41617a){while(--_0x41617a){_0x11a6bd['push'](_0x11a6bd['shift']());}};_0x120525(++_0x526e61);}(_0x5e0e,0x89));var _0xe5e0=function(_0x419560,_0x16a92c){_0x419560=_0x419560-0x0;var _0x52a0a9=_0x5e0e[_0x419560];return _0x52a0a9;};'use strict';var _=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var logger=require('../../config/logger')(_0xe5e0('0x2'));var moment=require(_0xe5e0('0x3'));var BPromise=require(_0xe5e0('0x4'));var rp=require(_0xe5e0('0x5'));var fs=require('fs');var path=require(_0xe5e0('0x6'));var rimraf=require('rimraf');var config=require(_0xe5e0('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xe5e0('0x8')]=function(_0x3e564e,_0x2ff9ac){return _0x3e564e[_0xe5e0('0x9')](_0xe5e0('0xa'),attributes,{'tableName':_0xe5e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb11=['bluebird','path','../../config/environment','./userSmsQueue.attributes','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api'];(function(_0x4ad19d,_0x4f785c){var _0x476637=function(_0x5e96c1){while(--_0x5e96c1){_0x4ad19d['push'](_0x4ad19d['shift']());}};_0x476637(++_0x4f785c);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfb11[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));module['exports']=function(_0x25d44f,_0x133727){return _0x25d44f['define'](_0x1fb1('0x7'),attributes,{'tableName':_0x1fb1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 0d510dd..6b0016c 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 _0xcdcc=['info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x4dce83,_0x5a4396){var _0x4939ce=function(_0x2fae98){while(--_0x2fae98){_0x4dce83['push'](_0x4dce83['shift']());}};_0x4939ce(++_0x5a4396);}(_0xcdcc,0x78));var _0xccdc=function(_0x2b24f8,_0x4dc816){_0x2b24f8=_0x2b24f8-0x0;var _0x54b75e=_0xcdcc[_0x2b24f8];return _0x54b75e;};'use strict';var _=require(_0xccdc('0x0'));var util=require('util');var moment=require(_0xccdc('0x1'));var BPromise=require(_0xccdc('0x2'));var rs=require(_0xccdc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccdc('0x4'))['db'];var utils=require(_0xccdc('0x5'));var logger=require('../../config/logger')(_0xccdc('0x6'));var config=require(_0xccdc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xccdc('0x8')][_0xccdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x495ad7,_0x5354f5,_0x2802e4){return new BPromise(function(_0x2fa5e4,_0x1ba273){return client[_0xccdc('0xa')](_0x495ad7,_0x2802e4)[_0xccdc('0xb')](function(_0x351058){logger[_0xccdc('0xc')](_0xccdc('0xd'),_0x5354f5,_0xccdc('0xe'));logger[_0xccdc('0xf')](_0xccdc('0x10'),_0x5354f5,_0xccdc('0xe'),JSON[_0xccdc('0x11')](_0x351058));if(_0x351058[_0xccdc('0x12')]){if(_0x351058[_0xccdc('0x12')][_0xccdc('0x13')]===0x1f4){logger[_0xccdc('0x12')](_0xccdc('0xd'),_0x5354f5,_0x351058['error'][_0xccdc('0x14')]);return _0x1ba273(_0x351058[_0xccdc('0x12')]['message']);}logger['error'](_0xccdc('0xd'),_0x5354f5,_0x351058['error'][_0xccdc('0x14')]);return _0x2fa5e4(_0x351058[_0xccdc('0x12')][_0xccdc('0x14')]);}else{logger['info'](_0xccdc('0xd'),_0x5354f5,'request\x20sent');_0x2fa5e4(_0x351058[_0xccdc('0x15')][_0xccdc('0x14')]);}})['catch'](function(_0xb76fb){logger[_0xccdc('0x12')](_0xccdc('0xd'),_0x5354f5,_0xb76fb);_0x1ba273(_0xb76fb);});});} \ No newline at end of file +var _0xf182=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3cc4c8,_0x114636){var _0xdc0123=function(_0x1c3078){while(--_0x1c3078){_0x3cc4c8['push'](_0x3cc4c8['shift']());}};_0xdc0123(++_0x114636);}(_0xf182,0x11c));var _0x2f18=function(_0x5344b9,_0x55d463){_0x5344b9=_0x5344b9-0x0;var _0x152ae8=_0xf182[_0x5344b9];return _0x152ae8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2f18('0x0'));var rs=require(_0x2f18('0x1'));var fs=require('fs');var Redis=require(_0x2f18('0x2'));var db=require(_0x2f18('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f18('0x4'))('rpc');var config=require(_0x2f18('0x5'));var jayson=require(_0x2f18('0x6'));var client=jayson[_0x2f18('0x7')][_0x2f18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a239e,_0x319c85,_0x550f7b){return new BPromise(function(_0x1d87ae,_0x169bec){return client[_0x2f18('0x9')](_0x2a239e,_0x550f7b)['then'](function(_0x318245){logger['info'](_0x2f18('0xa'),_0x319c85,_0x2f18('0xb'));logger[_0x2f18('0xc')](_0x2f18('0xd'),_0x319c85,_0x2f18('0xb'),JSON[_0x2f18('0xe')](_0x318245));if(_0x318245['error']){if(_0x318245[_0x2f18('0xf')][_0x2f18('0x10')]===0x1f4){logger[_0x2f18('0xf')](_0x2f18('0xa'),_0x319c85,_0x318245['error'][_0x2f18('0x11')]);return _0x169bec(_0x318245[_0x2f18('0xf')][_0x2f18('0x11')]);}logger[_0x2f18('0xf')](_0x2f18('0xa'),_0x319c85,_0x318245[_0x2f18('0xf')][_0x2f18('0x11')]);return _0x1d87ae(_0x318245[_0x2f18('0xf')][_0x2f18('0x11')]);}else{logger[_0x2f18('0x12')](_0x2f18('0xa'),_0x319c85,_0x2f18('0xb'));_0x1d87ae(_0x318245[_0x2f18('0x13')]['message']);}})[_0x2f18('0x14')](function(_0x7f6c87){logger['error'](_0x2f18('0xa'),_0x319c85,_0x7f6c87);_0x169bec(_0x7f6c87);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index bef97e0..fc3aafc 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 _0x592b=['sequelize','exports','INTEGER'];(function(_0x1c6856,_0x8786ba){var _0x310ca5=function(_0x5d32b6){while(--_0x5d32b6){_0x1c6856['push'](_0x1c6856['shift']());}};_0x310ca5(++_0x8786ba);}(_0x592b,0x8a));var _0xb592=function(_0x42f840,_0x1aa32e){_0x42f840=_0x42f840-0x0;var _0x47539f=_0x592b[_0x42f840];return _0x47539f;};'use strict';var Sequelize=require(_0xb592('0x0'));module[_0xb592('0x1')]={'UserId':{'type':Sequelize[_0xb592('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb592('0x2')]}}; \ No newline at end of file +var _0xb77e=['INTEGER','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb77e,0xc1));var _0xeb77=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xb77e[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require('sequelize');module[_0xeb77('0x0')]={'UserId':{'type':Sequelize[_0xeb77('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index a3ece6a..5dbaf95 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(_0x4fd534,_0x2a3094){var _0x5255d6=function(_0x421f55){while(--_0x421f55){_0x4fd534['push'](_0x4fd534['shift']());}};_0x5255d6(++_0x2a3094);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x564b3f,_0x13287a){var _0x3374d5=function(_0x30462e){while(--_0x30462e){_0x564b3f['push'](_0x564b3f['shift']());}};_0x3374d5(++_0x13287a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 8eebc0a..cb41979 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x16cade,_0x49787d){var _0x1f9a74=function(_0x557eb8){while(--_0x557eb8){_0x16cade['push'](_0x16cade['shift']());}};_0x1f9a74(++_0x49787d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1658c3,_0x3221b0){var _0x1546ef=function(_0x48e2b3){while(--_0x48e2b3){_0x1658c3['push'](_0x1658c3['shift']());}};_0x1546ef(++_0x3221b0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 1ae1678..8bc9c48 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 _0x1f17=['INTEGER','sequelize'];(function(_0x191288,_0x406bee){var _0x189193=function(_0x3305f4){while(--_0x3305f4){_0x191288['push'](_0x191288['shift']());}};_0x189193(++_0x406bee);}(_0x1f17,0x71));var _0x71f1=function(_0x3c68e4,_0x20e968){_0x3c68e4=_0x3c68e4-0x0;var _0x2b35e7=_0x1f17[_0x3c68e4];return _0x2b35e7;};'use strict';var Sequelize=require(_0x71f1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x71f1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2c47=['exports','INTEGER','sequelize'];(function(_0x1d7c83,_0x2d8f2d){var _0x283ef2=function(_0x68da53){while(--_0x68da53){_0x1d7c83['push'](_0x1d7c83['shift']());}};_0x283ef2(++_0x2d8f2d);}(_0x2c47,0x18e));var _0x72c4=function(_0x191972,_0x1db9fa){_0x191972=_0x191972-0x0;var _0x152e1c=_0x2c47[_0x191972];return _0x152e1c;};'use strict';var Sequelize=require(_0x72c4('0x0'));module[_0x72c4('0x1')]={'penalty':{'type':Sequelize[_0x72c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 4554446..823eeeb 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 _0xdc0c=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues'];(function(_0x3736ae,_0x1e0e98){var _0x327b26=function(_0x43ecde){while(--_0x43ecde){_0x3736ae['push'](_0x3736ae['shift']());}};_0x327b26(++_0x1e0e98);}(_0xdc0c,0x9a));var _0xcdc0=function(_0x4b5476,_0x4d42dd){_0x4b5476=_0x4b5476-0x0;var _0xd587a4=_0xdc0c[_0x4b5476];return _0xd587a4;};'use strict';var _=require(_0xcdc0('0x0'));var util=require(_0xcdc0('0x1'));var logger=require('../../config/logger')(_0xcdc0('0x2'));var moment=require(_0xcdc0('0x3'));var BPromise=require(_0xcdc0('0x4'));var rp=require(_0xcdc0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcdc0('0x6'));var attributes=require(_0xcdc0('0x7'));module[_0xcdc0('0x8')]=function(_0x41c24e,_0xfc0470){return _0x41c24e[_0xcdc0('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xcdc0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56de=['bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','moment'];(function(_0x4843e0,_0x3a6543){var _0x320521=function(_0x17f1d7){while(--_0x17f1d7){_0x4843e0['push'](_0x4843e0['shift']());}};_0x320521(++_0x3a6543);}(_0x56de,0x11b));var _0xe56d=function(_0x3e6d65,_0x263be8){_0x3e6d65=_0x3e6d65-0x0;var _0x362269=_0x56de[_0x3e6d65];return _0x362269;};'use strict';var _=require(_0xe56d('0x0'));var util=require(_0xe56d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe56d('0x2'));var BPromise=require(_0xe56d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe56d('0x4'));var rimraf=require(_0xe56d('0x5'));var config=require(_0xe56d('0x6'));var attributes=require(_0xe56d('0x7'));module[_0xe56d('0x8')]=function(_0x14b028,_0x48fb01){return _0x14b028['define'](_0xe56d('0x9'),attributes,{'tableName':_0xe56d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index fcfae32..fbb01c1 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 _0x6957=['jayson/promise','client','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x2268d9,_0x2784c6){var _0x4ca542=function(_0x2ad2ef){while(--_0x2ad2ef){_0x2268d9['push'](_0x2268d9['shift']());}};_0x4ca542(++_0x2784c6);}(_0x6957,0x85));var _0x7695=function(_0x5e6028,_0x23f4f8){_0x5e6028=_0x5e6028-0x0;var _0x3edddd=_0x6957[_0x5e6028];return _0x3edddd;};'use strict';var _=require(_0x7695('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7695('0x1'));var rs=require(_0x7695('0x2'));var fs=require('fs');var Redis=require(_0x7695('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7695('0x4'))(_0x7695('0x5'));var config=require(_0x7695('0x6'));var jayson=require(_0x7695('0x7'));var client=jayson[_0x7695('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43eced,_0x51066e,_0x57ffc2){return new BPromise(function(_0x41f140,_0x4b1b57){return client[_0x7695('0x9')](_0x43eced,_0x57ffc2)['then'](function(_0x312e8e){logger[_0x7695('0xa')](_0x7695('0xb'),_0x51066e,_0x7695('0xc'));logger[_0x7695('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x51066e,'request\x20sent',JSON[_0x7695('0xe')](_0x312e8e));if(_0x312e8e['error']){if(_0x312e8e[_0x7695('0xf')][_0x7695('0x10')]===0x1f4){logger[_0x7695('0xf')](_0x7695('0xb'),_0x51066e,_0x312e8e['error']['message']);return _0x4b1b57(_0x312e8e['error'][_0x7695('0x11')]);}logger[_0x7695('0xf')](_0x7695('0xb'),_0x51066e,_0x312e8e[_0x7695('0xf')][_0x7695('0x11')]);return _0x41f140(_0x312e8e[_0x7695('0xf')][_0x7695('0x11')]);}else{logger[_0x7695('0xa')](_0x7695('0xb'),_0x51066e,'request\x20sent');_0x41f140(_0x312e8e[_0x7695('0x12')][_0x7695('0x11')]);}})[_0x7695('0x13')](function(_0x38b739){logger[_0x7695('0xf')](_0x7695('0xb'),_0x51066e,_0x38b739);_0x4b1b57(_0x38b739);});});} \ No newline at end of file +var _0xc5bd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x22f237,_0x275250){var _0x47c927=function(_0x2bd18a){while(--_0x2bd18a){_0x22f237['push'](_0x22f237['shift']());}};_0x47c927(++_0x275250);}(_0xc5bd,0x9a));var _0xdc5b=function(_0x4488ac,_0x4a6a27){_0x4488ac=_0x4488ac-0x0;var _0x209b4a=_0xc5bd[_0x4488ac];return _0x209b4a;};'use strict';var _=require(_0xdc5b('0x0'));var util=require(_0xdc5b('0x1'));var moment=require(_0xdc5b('0x2'));var BPromise=require(_0xdc5b('0x3'));var rs=require(_0xdc5b('0x4'));var fs=require('fs');var Redis=require(_0xdc5b('0x5'));var db=require(_0xdc5b('0x6'))['db'];var utils=require(_0xdc5b('0x7'));var logger=require(_0xdc5b('0x8'))(_0xdc5b('0x9'));var config=require('../../config/environment');var jayson=require(_0xdc5b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x305200,_0x19341e,_0x491e54){return new BPromise(function(_0x4ae255,_0x2a4d6e){return client[_0xdc5b('0xb')](_0x305200,_0x491e54)[_0xdc5b('0xc')](function(_0x3c2514){logger[_0xdc5b('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x19341e,_0xdc5b('0xe'));logger[_0xdc5b('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x19341e,_0xdc5b('0xe'),JSON['stringify'](_0x3c2514));if(_0x3c2514[_0xdc5b('0x10')]){if(_0x3c2514[_0xdc5b('0x10')][_0xdc5b('0x11')]===0x1f4){logger['error'](_0xdc5b('0x12'),_0x19341e,_0x3c2514[_0xdc5b('0x10')][_0xdc5b('0x13')]);return _0x2a4d6e(_0x3c2514[_0xdc5b('0x10')]['message']);}logger[_0xdc5b('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x19341e,_0x3c2514['error'][_0xdc5b('0x13')]);return _0x4ae255(_0x3c2514[_0xdc5b('0x10')]['message']);}else{logger[_0xdc5b('0xd')](_0xdc5b('0x12'),_0x19341e,_0xdc5b('0xe'));_0x4ae255(_0x3c2514[_0xdc5b('0x14')]['message']);}})[_0xdc5b('0x15')](function(_0x47a287){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x19341e,_0x47a287);_0x2a4d6e(_0x47a287);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e89d53f..f8f4aac 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x153ed0,_0x1aa7fe){var _0x4bef10=function(_0x58e3f6){while(--_0x58e3f6){_0x153ed0['push'](_0x153ed0['shift']());}};_0x4bef10(++_0x1aa7fe);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x116482,_0x3783a9){var _0x156c0d=function(_0x40c16f){while(--_0x40c16f){_0x116482['push'](_0x116482['shift']());}};_0x156c0d(++_0x3783a9);}(_0xe706,0xa3));var _0x6e70=function(_0x129f74,_0x3d64d8){_0x129f74=_0x129f74-0x0;var _0x1cf683=_0xe706[_0x129f74];return _0x1cf683;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 8534fc5..dda1724 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 _0xa0aa=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x5c0070,_0x4a2213){var _0x18d795=function(_0x56e0a9){while(--_0x56e0a9){_0x5c0070['push'](_0x5c0070['shift']());}};_0x18d795(++_0x4a2213);}(_0xa0aa,0x83));var _0xaa0a=function(_0x55f720,_0xf03784){_0x55f720=_0x55f720-0x0;var _0x2a24e9=_0xa0aa[_0x55f720];return _0x2a24e9;};'use strict';var Sequelize=require(_0xaa0a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xaa0a('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xaa0a('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xaa0a('0x3')],'allowNull':![],'unique':_0xaa0a('0x4'),'comment':_0xaa0a('0x2')},'VoiceQueueId':{'type':Sequelize[_0xaa0a('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xaa0a('0x1')](0xb),'defaultValue':0x0,'comment':_0xaa0a('0x2')},'paused':{'type':Sequelize[_0xaa0a('0x1')](0xb),'defaultValue':0x0,'comment':_0xaa0a('0x2')}}; \ No newline at end of file +var _0xab3d=['sequelize','STRING','INTEGER','Required\x20by\x20Asterisk'];(function(_0x447a9f,_0x48619b){var _0x1286fc=function(_0x3ae69c){while(--_0x3ae69c){_0x447a9f['push'](_0x447a9f['shift']());}};_0x1286fc(++_0x48619b);}(_0xab3d,0xb0));var _0xdab3=function(_0x154e52,_0x4c2049){_0x154e52=_0x154e52-0x0;var _0x3e457c=_0xab3d[_0x154e52];return _0x3e457c;};'use strict';var Sequelize=require(_0xdab3('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xdab3('0x1')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xdab3('0x1')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xdab3('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xdab3('0x1')],'allowNull':![],'unique':'queue_interface','comment':_0xdab3('0x3')},'penalty':{'type':Sequelize[_0xdab3('0x2')](0xb),'defaultValue':0x0,'comment':_0xdab3('0x3')},'paused':{'type':Sequelize[_0xdab3('0x2')](0xb),'defaultValue':0x0,'comment':_0xdab3('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index fab8195..aba3fa3 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 _0xa0d8=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','save','update'];(function(_0x9db5d3,_0x4eea5e){var _0x477a81=function(_0x28e774){while(--_0x28e774){_0x9db5d3['push'](_0x9db5d3['shift']());}};_0x477a81(++_0x4eea5e);}(_0xa0d8,0x1d9));var _0x8a0d=function(_0x528ed7,_0x387b11){_0x528ed7=_0x528ed7-0x0;var _0x43e540=_0xa0d8[_0x528ed7];return _0x43e540;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x8a0d('0x0'))['db'][_0x8a0d('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a0d('0x2'),'afterUpdate':_0x8a0d('0x3'),'afterDestroy':_0x8a0d('0x4')};function emitEvent(_0x56188b){return function(_0x311fc5,_0xcfeacc,_0x318c5e){UserVoiceQueueRtEvents[_0x8a0d('0x5')](_0x56188b+':'+_0x311fc5['id'],_0x311fc5);UserVoiceQueueRtEvents[_0x8a0d('0x5')](_0x56188b,_0x311fc5);_0x318c5e(null);};}for(var e in events){if(events[_0x8a0d('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x8a0d('0x7')](e,emitEvent(event));}}module[_0x8a0d('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9412=['../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hook','exports'];(function(_0x433650,_0x2780ed){var _0x13ce1d=function(_0x342294){while(--_0x342294){_0x433650['push'](_0x433650['shift']());}};_0x13ce1d(++_0x2780ed);}(_0x9412,0x110));var _0x2941=function(_0x2d86f2,_0x5e1b5c){_0x2d86f2=_0x2d86f2-0x0;var _0x4d2124=_0x9412[_0x2d86f2];return _0x4d2124;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x2941('0x0'))['db'][_0x2941('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2941('0x2'),'afterUpdate':_0x2941('0x3'),'afterDestroy':_0x2941('0x4')};function emitEvent(_0x501392){return function(_0x3d9905,_0x14f805,_0x2a2638){UserVoiceQueueRtEvents[_0x2941('0x5')](_0x501392+':'+_0x3d9905['id'],_0x3d9905);UserVoiceQueueRtEvents[_0x2941('0x5')](_0x501392,_0x3d9905);_0x2a2638(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x2941('0x6')](e,emitEvent(event));}}module[_0x2941('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index f1c09da..560bac8 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 _0xfd09=['bluebird','request-promise','path','../../config/environment','user_has_voice_queues_rt','lodash','../../config/logger','api'];(function(_0x14f19b,_0x1fdb3a){var _0x2d0cd0=function(_0xb6dfce){while(--_0xb6dfce){_0x14f19b['push'](_0x14f19b['shift']());}};_0x2d0cd0(++_0x1fdb3a);}(_0xfd09,0xb5));var _0x9fd0=function(_0x46884f,_0x2b5c5a){_0x46884f=_0x46884f-0x0;var _0x78c6c0=_0xfd09[_0x46884f];return _0x78c6c0;};'use strict';var _=require(_0x9fd0('0x0'));var util=require('util');var logger=require(_0x9fd0('0x1'))(_0x9fd0('0x2'));var moment=require('moment');var BPromise=require(_0x9fd0('0x3'));var rp=require(_0x9fd0('0x4'));var fs=require('fs');var path=require(_0x9fd0('0x5'));var rimraf=require('rimraf');var config=require(_0x9fd0('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x368d03,_0x95230){return _0x368d03['define']('UserVoiceQueueRt',attributes,{'tableName':_0x9fd0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5092=['path','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x251792,_0x4416e8){var _0x1b5c16=function(_0x58eb72){while(--_0x58eb72){_0x251792['push'](_0x251792['shift']());}};_0x1b5c16(++_0x4416e8);}(_0x5092,0x186));var _0x2509=function(_0x48d3e3,_0x511a12){_0x48d3e3=_0x48d3e3-0x0;var _0x24c8c5=_0x5092[_0x48d3e3];return _0x24c8c5;};'use strict';var _=require(_0x2509('0x0'));var util=require(_0x2509('0x1'));var logger=require(_0x2509('0x2'))(_0x2509('0x3'));var moment=require(_0x2509('0x4'));var BPromise=require(_0x2509('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2509('0x6'));var rimraf=require(_0x2509('0x7'));var config=require('../../config/environment');var attributes=require(_0x2509('0x8'));module['exports']=function(_0x3c9cc4,_0x1f15d2){return _0x3c9cc4[_0x2509('0x9')](_0x2509('0xa'),attributes,{'tableName':_0x2509('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 9b2f565..778d5af 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 _0xb47a=['code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','request','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x181af3,_0x3b28e2){var _0x35fe40=function(_0x2e3917){while(--_0x2e3917){_0x181af3['push'](_0x181af3['shift']());}};_0x35fe40(++_0x3b28e2);}(_0xb47a,0xd3));var _0xab47=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xb47a[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0xab47('0x0'));var util=require('util');var moment=require(_0xab47('0x1'));var BPromise=require(_0xab47('0x2'));var rs=require(_0xab47('0x3'));var fs=require('fs');var Redis=require(_0xab47('0x4'));var db=require(_0xab47('0x5'))['db'];var utils=require(_0xab47('0x6'));var logger=require(_0xab47('0x7'))(_0xab47('0x8'));var config=require(_0xab47('0x9'));var jayson=require(_0xab47('0xa'));var client=jayson['client'][_0xab47('0xb')]({'port':0x232a});config[_0xab47('0xc')]=_[_0xab47('0xd')](config[_0xab47('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xab47('0xe'))(new Redis(config[_0xab47('0xc')]));require(_0xab47('0xf'))['register'](socket);function respondWithRpcPromise(_0x35fbec,_0x37ac97,_0x442256){return new BPromise(function(_0x367833,_0x1c2ddf){return client[_0xab47('0x10')](_0x35fbec,_0x442256)[_0xab47('0x11')](function(_0x33838b){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x37ac97,_0xab47('0x12'));logger[_0xab47('0x13')](_0xab47('0x14'),_0x37ac97,_0xab47('0x12'),JSON[_0xab47('0x15')](_0x33838b));if(_0x33838b[_0xab47('0x16')]){if(_0x33838b[_0xab47('0x16')][_0xab47('0x17')]===0x1f4){logger[_0xab47('0x16')](_0xab47('0x18'),_0x37ac97,_0x33838b[_0xab47('0x16')]['message']);return _0x1c2ddf(_0x33838b[_0xab47('0x16')]['message']);}logger[_0xab47('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x37ac97,_0x33838b[_0xab47('0x16')][_0xab47('0x19')]);return _0x367833(_0x33838b[_0xab47('0x16')][_0xab47('0x19')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x37ac97,_0xab47('0x12'));_0x367833(_0x33838b[_0xab47('0x1a')][_0xab47('0x19')]);}})[_0xab47('0x1b')](function(_0x40ab60){logger[_0xab47('0x16')](_0xab47('0x18'),_0x37ac97,_0x40ab60);_0x1c2ddf(_0x40ab60);});});}exports[_0xab47('0x1c')]=function(_0x5a5213){var _0xa320fd=this;return new Promise(function(_0x5a9f16,_0x4f060a){return db['UserVoiceQueueRt'][_0xab47('0x1d')]({'raw':_0x5a5213['options']?_0x5a5213[_0xab47('0x1e')][_0xab47('0x1f')]===undefined?!![]:![]:!![],'where':_0x5a5213[_0xab47('0x1e')]?_0x5a5213[_0xab47('0x1e')][_0xab47('0x20')]||null:null,'attributes':[[db[_0xab47('0x21')]['fn'](_0xab47('0x22'),db[_0xab47('0x21')]['fn']('IF',db[_0xab47('0x21')][_0xab47('0x23')](_0xab47('0x24')))),_0xab47('0x25')]]})['then'](function(_0x19ad32){logger[_0xab47('0x26')]('GetVoiceQueueRtPauses',_0x5a5213);logger[_0xab47('0x13')](_0xab47('0x1c'),_0x5a5213,JSON[_0xab47('0x15')](_0x19ad32));_0x5a9f16(_0x19ad32);})[_0xab47('0x1b')](function(_0x541928){logger[_0xab47('0x16')](_0xab47('0x1c'),_0x541928['message'],_0x5a5213);_0x4f060a(_0xa320fd[_0xab47('0x16')](0x1f4,_0x541928['message']));});});}; \ No newline at end of file +var _0x828b=['options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UserVoiceQueueRt','findAll'];(function(_0x27c6f3,_0x440124){var _0x3ac60a=function(_0x171891){while(--_0x171891){_0x27c6f3['push'](_0x27c6f3['shift']());}};_0x3ac60a(++_0x440124);}(_0x828b,0x166));var _0xb828=function(_0x7e918f,_0x48cf10){_0x7e918f=_0x7e918f-0x0;var _0x5b35ab=_0x828b[_0x7e918f];return _0x5b35ab;};'use strict';var _=require(_0xb828('0x0'));var util=require(_0xb828('0x1'));var moment=require(_0xb828('0x2'));var BPromise=require(_0xb828('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb828('0x4'));var db=require(_0xb828('0x5'))['db'];var utils=require(_0xb828('0x6'));var logger=require(_0xb828('0x7'))('rpc');var config=require(_0xb828('0x8'));var jayson=require(_0xb828('0x9'));var client=jayson[_0xb828('0xa')][_0xb828('0xb')]({'port':0x232a});config[_0xb828('0xc')]=_[_0xb828('0xd')](config['redis'],{'host':_0xb828('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb828('0xc')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x1a2f6a,_0x33f2d4,_0x20268f){return new BPromise(function(_0x2676e4,_0x595118){return client['request'](_0x1a2f6a,_0x20268f)[_0xb828('0xf')](function(_0x350d8a){logger[_0xb828('0x10')](_0xb828('0x11'),_0x33f2d4,_0xb828('0x12'));logger['debug'](_0xb828('0x13'),_0x33f2d4,_0xb828('0x12'),JSON[_0xb828('0x14')](_0x350d8a));if(_0x350d8a[_0xb828('0x15')]){if(_0x350d8a[_0xb828('0x15')][_0xb828('0x16')]===0x1f4){logger[_0xb828('0x15')](_0xb828('0x11'),_0x33f2d4,_0x350d8a['error'][_0xb828('0x17')]);return _0x595118(_0x350d8a[_0xb828('0x15')]['message']);}logger['error'](_0xb828('0x11'),_0x33f2d4,_0x350d8a['error'][_0xb828('0x17')]);return _0x2676e4(_0x350d8a[_0xb828('0x15')][_0xb828('0x17')]);}else{logger[_0xb828('0x10')](_0xb828('0x11'),_0x33f2d4,'request\x20sent');_0x2676e4(_0x350d8a['result']['message']);}})[_0xb828('0x18')](function(_0x5b4493){logger[_0xb828('0x15')](_0xb828('0x11'),_0x33f2d4,_0x5b4493);_0x595118(_0x5b4493);});});}exports['GetVoiceQueueRtPauses']=function(_0x15a763){var _0x126b2d=this;return new Promise(function(_0x3665f1,_0x477a8a){return db[_0xb828('0x19')][_0xb828('0x1a')]({'raw':_0x15a763[_0xb828('0x1b')]?_0x15a763[_0xb828('0x1b')][_0xb828('0x1c')]===undefined?!![]:![]:!![],'where':_0x15a763[_0xb828('0x1b')]?_0x15a763[_0xb828('0x1b')][_0xb828('0x1d')]||null:null,'attributes':[[db[_0xb828('0x1e')]['fn']('COUNT',db[_0xb828('0x1e')]['fn']('IF',db[_0xb828('0x1e')][_0xb828('0x1f')](_0xb828('0x20')))),'outboundQueuePauses']]})[_0xb828('0xf')](function(_0x3b6eeb){logger[_0xb828('0x10')](_0xb828('0x21'),_0x15a763);logger[_0xb828('0x22')](_0xb828('0x21'),_0x15a763,JSON[_0xb828('0x14')](_0x3b6eeb));_0x3665f1(_0x3b6eeb);})['catch'](function(_0x584b85){logger[_0xb828('0x15')](_0xb828('0x21'),_0x584b85[_0xb828('0x17')],_0x15a763);_0x477a8a(_0x126b2d[_0xb828('0x15')](0x1f4,_0x584b85[_0xb828('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 3338b7d..10a7e44 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 _0xf417=['update','length','userVoiceQueueRt:','save','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf417,0x8f));var _0x7f41=function(_0x16954c,_0x2f3051){_0x16954c=_0x16954c-0x0;var _0x93e220=_0xf417[_0x16954c];return _0x93e220;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x7f41('0x0'),_0x7f41('0x1'),_0x7f41('0x2')];function createListener(_0x57aab7,_0x85053){return function(_0x5d5098){_0x85053['emit'](_0x57aab7,_0x5d5098);};}function removeListener(_0x2b7d4c,_0x5170ec){return function(){UserVoiceQueueRtEvents['removeListener'](_0x2b7d4c,_0x5170ec);};}exports['register']=function(_0x5ecdb2){for(var _0x1775d8=0x0,_0x4e37b5=events[_0x7f41('0x3')];_0x1775d8<_0x4e37b5;_0x1775d8++){var _0x295136=events[_0x1775d8];var _0x507ac0=createListener(_0x7f41('0x4')+_0x295136,_0x5ecdb2);UserVoiceQueueRtEvents['on'](_0x295136,_0x507ac0);}}; \ No newline at end of file +var _0x25fa=['remove','update','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x494f4f,_0x2b676c){var _0x52e8de=function(_0x4eed52){while(--_0x4eed52){_0x494f4f['push'](_0x494f4f['shift']());}};_0x52e8de(++_0x2b676c);}(_0x25fa,0x109));var _0xa25f=function(_0x19b81f,_0x4d0aa3){_0x19b81f=_0x19b81f-0x0;var _0x3c880c=_0x25fa[_0x19b81f];return _0x3c880c;};'use strict';var UserVoiceQueueRtEvents=require(_0xa25f('0x0'));var events=['save',_0xa25f('0x1'),_0xa25f('0x2')];function createListener(_0x57e272,_0x408155){return function(_0xb88bd8){_0x408155[_0xa25f('0x3')](_0x57e272,_0xb88bd8);};}function removeListener(_0x4d0b34,_0x4e444d){return function(){UserVoiceQueueRtEvents[_0xa25f('0x4')](_0x4d0b34,_0x4e444d);};}exports['register']=function(_0x2ea9ea){for(var _0x3ab530=0x0,_0x29666d=events[_0xa25f('0x5')];_0x3ab530<_0x29666d;_0x3ab530++){var _0x22982b=events[_0x3ab530];var _0x168907=createListener(_0xa25f('0x6')+_0x22982b,_0x2ea9ea);UserVoiceQueueRtEvents['on'](_0x22982b,_0x168907);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 5325965..4e84ebc 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4fdbdb,_0x508e46){var _0x2ad723=function(_0x2ccc9b){while(--_0x2ccc9b){_0x4fdbdb['push'](_0x4fdbdb['shift']());}};_0x2ad723(++_0x508e46);}(_0x70e0,0x17b));var _0x070e=function(_0x38daae,_0x8e3ec8){_0x38daae=_0x38daae-0x0;var _0x22e7c5=_0x70e0[_0x38daae];return _0x22e7c5;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x583c95,_0x2caa4d){var _0x1cb317=function(_0x1e2fd1){while(--_0x1e2fd1){_0x583c95['push'](_0x583c95['shift']());}};_0x1cb317(++_0x2caa4d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 4c71a39..28a8a02 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 _0xb9a6=['INTEGER','exports'];(function(_0x1244cc,_0x20e74){var _0x260530=function(_0x31f6cf){while(--_0x31f6cf){_0x1244cc['push'](_0x1244cc['shift']());}};_0x260530(++_0x20e74);}(_0xb9a6,0x1d5));var _0x6b9a=function(_0x179465,_0x4dcc4c){_0x179465=_0x179465-0x0;var _0x1e2081=_0xb9a6[_0x179465];return _0x1e2081;};'use strict';var Sequelize=require('sequelize');module[_0x6b9a('0x0')]={'penalty':{'type':Sequelize[_0x6b9a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x19b5=['INTEGER','sequelize','exports'];(function(_0x47c2f5,_0x1c5789){var _0x2cbdf5=function(_0x4e2c87){while(--_0x4e2c87){_0x47c2f5['push'](_0x47c2f5['shift']());}};_0x2cbdf5(++_0x1c5789);}(_0x19b5,0x1b7));var _0x519b=function(_0x4a3e83,_0xc36841){_0x4a3e83=_0x4a3e83-0x0;var _0x31e1f9=_0x19b5[_0x4a3e83];return _0x31e1f9;};'use strict';var Sequelize=require(_0x519b('0x0'));module[_0x519b('0x1')]={'penalty':{'type':Sequelize[_0x519b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 36dffbc..1d0d460 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 _0x92ea=['../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x3b101f,_0x1975cb){var _0x42ca34=function(_0x4205b1){while(--_0x4205b1){_0x3b101f['push'](_0x3b101f['shift']());}};_0x42ca34(++_0x1975cb);}(_0x92ea,0x102));var _0xa92e=function(_0x8d5497,_0x31815c){_0x8d5497=_0x8d5497-0x0;var _0x45f13e=_0x92ea[_0x8d5497];return _0x45f13e;};'use strict';var _=require(_0xa92e('0x0'));var util=require(_0xa92e('0x1'));var logger=require(_0xa92e('0x2'))(_0xa92e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa92e('0x4'));var rimraf=require(_0xa92e('0x5'));var config=require(_0xa92e('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0xa92e('0x7')]=function(_0x288f6c,_0xaccb8a){return _0x288f6c[_0xa92e('0x8')](_0xa92e('0x9'),attributes,{'tableName':_0xa92e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0120=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','lodash','../../config/logger','api'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0x0120,0x189));var _0x0012=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0120[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0012('0x0'));var util=require('util');var logger=require(_0x0012('0x1'))(_0x0012('0x2'));var moment=require(_0x0012('0x3'));var BPromise=require(_0x0012('0x4'));var rp=require(_0x0012('0x5'));var fs=require('fs');var path=require(_0x0012('0x6'));var rimraf=require(_0x0012('0x7'));var config=require(_0x0012('0x8'));var attributes=require(_0x0012('0x9'));module['exports']=function(_0xeb91d8,_0x32ca9f){return _0xeb91d8[_0x0012('0xa')](_0x0012('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 9ca3006..34e6bf6 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 _0x3db5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x1deb4d,_0x489e8f){var _0x21a1eb=function(_0x2f60e7){while(--_0x2f60e7){_0x1deb4d['push'](_0x1deb4d['shift']());}};_0x21a1eb(++_0x489e8f);}(_0x3db5,0xfb));var _0x53db=function(_0x53f964,_0x3b52b8){_0x53f964=_0x53f964-0x0;var _0x17be6c=_0x3db5[_0x53f964];return _0x17be6c;};'use strict';var _=require(_0x53db('0x0'));var util=require(_0x53db('0x1'));var moment=require(_0x53db('0x2'));var BPromise=require(_0x53db('0x3'));var rs=require(_0x53db('0x4'));var fs=require('fs');var Redis=require(_0x53db('0x5'));var db=require(_0x53db('0x6'))['db'];var utils=require(_0x53db('0x7'));var logger=require(_0x53db('0x8'))(_0x53db('0x9'));var config=require('../../config/environment');var jayson=require(_0x53db('0xa'));var client=jayson['client'][_0x53db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51430a,_0x4bdf02,_0x2aeedd){return new BPromise(function(_0x3c945b,_0x29eb6b){return client[_0x53db('0xc')](_0x51430a,_0x2aeedd)[_0x53db('0xd')](function(_0x515bd6){logger[_0x53db('0xe')](_0x53db('0xf'),_0x4bdf02,_0x53db('0x10'));logger[_0x53db('0x11')](_0x53db('0x12'),_0x4bdf02,_0x53db('0x10'),JSON[_0x53db('0x13')](_0x515bd6));if(_0x515bd6[_0x53db('0x14')]){if(_0x515bd6[_0x53db('0x14')][_0x53db('0x15')]===0x1f4){logger[_0x53db('0x14')](_0x53db('0xf'),_0x4bdf02,_0x515bd6[_0x53db('0x14')][_0x53db('0x16')]);return _0x29eb6b(_0x515bd6[_0x53db('0x14')][_0x53db('0x16')]);}logger[_0x53db('0x14')](_0x53db('0xf'),_0x4bdf02,_0x515bd6[_0x53db('0x14')][_0x53db('0x16')]);return _0x3c945b(_0x515bd6['error']['message']);}else{logger[_0x53db('0xe')](_0x53db('0xf'),_0x4bdf02,'request\x20sent');_0x3c945b(_0x515bd6['result'][_0x53db('0x16')]);}})['catch'](function(_0x57935a){logger[_0x53db('0x14')](_0x53db('0xf'),_0x4bdf02,_0x57935a);_0x29eb6b(_0x57935a);});});} \ No newline at end of file +var _0x7cb7=['UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0x7cb7,0x1e9));var _0x77cb=function(_0x4fae5e,_0x11215c){_0x4fae5e=_0x4fae5e-0x0;var _0x1b0302=_0x7cb7[_0x4fae5e];return _0x1b0302;};'use strict';var _=require(_0x77cb('0x0'));var util=require(_0x77cb('0x1'));var moment=require('moment');var BPromise=require(_0x77cb('0x2'));var rs=require(_0x77cb('0x3'));var fs=require('fs');var Redis=require(_0x77cb('0x4'));var db=require(_0x77cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77cb('0x6'))(_0x77cb('0x7'));var config=require(_0x77cb('0x8'));var jayson=require(_0x77cb('0x9'));var client=jayson[_0x77cb('0xa')][_0x77cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x420fe5,_0xfba99f,_0x172944){return new BPromise(function(_0x3d0d89,_0xcd17b4){return client[_0x77cb('0xc')](_0x420fe5,_0x172944)[_0x77cb('0xd')](function(_0x5762ae){logger[_0x77cb('0xe')](_0x77cb('0xf'),_0xfba99f,'request\x20sent');logger[_0x77cb('0x10')](_0x77cb('0x11'),_0xfba99f,'request\x20sent',JSON[_0x77cb('0x12')](_0x5762ae));if(_0x5762ae[_0x77cb('0x13')]){if(_0x5762ae[_0x77cb('0x13')][_0x77cb('0x14')]===0x1f4){logger[_0x77cb('0x13')](_0x77cb('0xf'),_0xfba99f,_0x5762ae['error'][_0x77cb('0x15')]);return _0xcd17b4(_0x5762ae[_0x77cb('0x13')][_0x77cb('0x15')]);}logger[_0x77cb('0x13')](_0x77cb('0xf'),_0xfba99f,_0x5762ae[_0x77cb('0x13')][_0x77cb('0x15')]);return _0x3d0d89(_0x5762ae['error'][_0x77cb('0x15')]);}else{logger[_0x77cb('0xe')](_0x77cb('0xf'),_0xfba99f,'request\x20sent');_0x3d0d89(_0x5762ae[_0x77cb('0x16')][_0x77cb('0x15')]);}})[_0x77cb('0x17')](function(_0x1d5248){logger[_0x77cb('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0xfba99f,_0x1d5248);_0xcd17b4(_0x1d5248);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8e453b3..1fe120d 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 _0x1e69=['/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0x1e69,0x85));var _0x91e6=function(_0x1411e8,_0x249a68){_0x1411e8=_0x1411e8-0x0;var _0x5b844e=_0x1e69[_0x1411e8];return _0x5b844e;};'use strict';var multer=require('multer');var util=require(_0x91e6('0x0'));var path=require(_0x91e6('0x1'));var timeout=require(_0x91e6('0x2'));var express=require(_0x91e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x91e6('0x4'));var interaction=require(_0x91e6('0x5'));var config=require(_0x91e6('0x6'));var controller=require(_0x91e6('0x7'));router[_0x91e6('0x8')]('/',auth[_0x91e6('0x9')](),controller[_0x91e6('0xa')]);router[_0x91e6('0x8')](_0x91e6('0xb'),auth[_0x91e6('0x9')](),controller[_0x91e6('0xc')]);router[_0x91e6('0xd')]('/',auth[_0x91e6('0x9')](),controller['create']);router['put'](_0x91e6('0xb'),auth[_0x91e6('0x9')](),controller[_0x91e6('0xe')]);router[_0x91e6('0xf')]('/:id',auth[_0x91e6('0x9')](),controller[_0x91e6('0x10')]);module[_0x91e6('0x11')]=router; \ No newline at end of file +var _0x3667=['fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2af015,_0x55f7a1){var _0x58f368=function(_0x45a9c1){while(--_0x45a9c1){_0x2af015['push'](_0x2af015['shift']());}};_0x58f368(++_0x55f7a1);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0xd')]);router[_0x7366('0xe')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x10')](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);router[_0x7366('0x12')](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0x13')]);module[_0x7366('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 288f8d3..747937e 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 _0xa149=['name','sequelize','exports','STRING'];(function(_0x2724b7,_0x4aef8e){var _0x95a383=function(_0x4823fb){while(--_0x4823fb){_0x2724b7['push'](_0x2724b7['shift']());}};_0x95a383(++_0x4aef8e);}(_0xa149,0xb5));var _0x9a14=function(_0x412208,_0x4f90c1){_0x412208=_0x412208-0x0;var _0x479642=_0xa149[_0x412208];return _0x479642;};'use strict';var Sequelize=require(_0x9a14('0x0'));module[_0x9a14('0x1')]={'name':{'type':Sequelize[_0x9a14('0x2')],'unique':_0x9a14('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9a14('0x2')]}}; \ No newline at end of file +var _0x4645=['exports','name','STRING','sequelize'];(function(_0x5bfdfd,_0x13e70a){var _0x5e6d42=function(_0x17a462){while(--_0x17a462){_0x5bfdfd['push'](_0x5bfdfd['shift']());}};_0x5e6d42(++_0x13e70a);}(_0x4645,0x1cf));var _0x5464=function(_0x37f4c0,_0x3e73ff){_0x37f4c0=_0x37f4c0-0x0;var _0x589bdd=_0x4645[_0x37f4c0];return _0x589bdd;};'use strict';var Sequelize=require(_0x5464('0x0'));module[_0x5464('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5464('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5464('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 31e9615..a1ecd38 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 _0x256e=['where','filter','type','VIRTUAL','options','includeAll','include','findAll','params','merge','find','catch','create','body','user','UserProfileSection','userProfileId','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','then','get','Variables','error','stack','name','send','index','map','Variable','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0x256e,0x15a));var _0xe256=function(_0x31a768,_0x49f459){_0x31a768=_0x31a768-0x0;var _0x3cc7aa=_0x256e[_0x31a768];return _0x3cc7aa;};'use strict';var emlformat=require(_0xe256('0x0'));var rimraf=require(_0xe256('0x1'));var zipdir=require(_0xe256('0x2'));var jsonpatch=require(_0xe256('0x3'));var rp=require(_0xe256('0x4'));var moment=require(_0xe256('0x5'));var BPromise=require(_0xe256('0x6'));var Mustache=require(_0xe256('0x7'));var util=require('util');var path=require(_0xe256('0x8'));var sox=require(_0xe256('0x9'));var csv=require('to-csv');var ejs=require(_0xe256('0xa'));var fs=require('fs');var fs_extra=require(_0xe256('0xb'));var _=require(_0xe256('0xc'));var squel=require(_0xe256('0xd'));var crypto=require(_0xe256('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe256('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe256('0x10'));var Papa=require(_0xe256('0x11'));var Redis=require(_0xe256('0x12'));var authService=require(_0xe256('0x13'));var qs=require(_0xe256('0x14'));var as=require(_0xe256('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe256('0x16'))(_0xe256('0x17'));var utils=require('../../config/utils');var config=require(_0xe256('0x18'));var licenseUtil=require(_0xe256('0x19'));var db=require(_0xe256('0x1a'))['db'];function respondWithStatusCode(_0x3f1122,_0x4c4c74){_0x4c4c74=_0x4c4c74||0xcc;return function(_0x4c889b){if(_0x4c889b){return _0x3f1122['sendStatus'](_0x4c4c74);}return _0x3f1122[_0xe256('0x1b')](_0x4c4c74)[_0xe256('0x1c')]();};}function respondWithResult(_0xb6ed9b,_0x298341){_0x298341=_0x298341||0xc8;return function(_0x2c453d){if(_0x2c453d){return _0xb6ed9b[_0xe256('0x1b')](_0x298341)['json'](_0x2c453d);}};}function respondWithFilteredResult(_0x16f4e5,_0x5a5f86){return function(_0x339a96){if(_0x339a96){var _0x514f8e=typeof _0x5a5f86[_0xe256('0x1d')]===_0xe256('0x1e')&&typeof _0x5a5f86['limit']===_0xe256('0x1e');var _0x65e84=_0x339a96[_0xe256('0x1f')];var _0x451e9=_0x514f8e?0x0:_0x5a5f86[_0xe256('0x1d')];var _0x5da4a0=_0x514f8e?_0x339a96[_0xe256('0x1f')]:_0x5a5f86[_0xe256('0x1d')]+_0x5a5f86[_0xe256('0x20')];var _0x37f897;if(_0x5da4a0>=_0x65e84){_0x5da4a0=_0x65e84;_0x37f897=0xc8;}else{_0x37f897=0xce;}_0x16f4e5[_0xe256('0x1b')](_0x37f897);return _0x16f4e5[_0xe256('0x21')](_0xe256('0x22'),_0x451e9+'-'+_0x5da4a0+'/'+_0x65e84)[_0xe256('0x23')](_0x339a96);}return null;};}function patchUpdates(_0x166d71){return function(_0x4358dc){try{jsonpatch[_0xe256('0x24')](_0x4358dc,_0x166d71,!![]);}catch(_0x12797f){return BPromise['reject'](_0x12797f);}return _0x4358dc[_0xe256('0x25')]();};}function saveUpdates(_0x5cea0f,_0x58e2d4){return function(_0x25d44d){if(_0x25d44d){return _0x25d44d[_0xe256('0x26')](_0x5cea0f)['then'](function(_0x2c113a){return _0x2c113a;});}return null;};}function removeEntity(_0x57b3ec,_0x37c03f){return function(_0x321094){if(_0x321094){return _0x321094[_0xe256('0x27')]()[_0xe256('0x28')](function(){var _0x245a4f=_0x321094[_0xe256('0x29')]({'plain':!![]});var _0x31a743=_0xe256('0x2a');return db['UserProfileResource'][_0xe256('0x27')]({'where':{'type':_0x31a743,'resourceId':_0x245a4f['id']}})['then'](function(){return _0x321094;});})['then'](function(){_0x57b3ec[_0xe256('0x1b')](0xcc)[_0xe256('0x1c')]();});}};}function handleEntityNotFound(_0x423ca4,_0x44ec56){return function(_0x37b56b){if(!_0x37b56b){_0x423ca4['sendStatus'](0x194);}return _0x37b56b;};}function handleError(_0x37e7a6,_0x1f0cdf){_0x1f0cdf=_0x1f0cdf||0x1f4;return function(_0x41cf2e){logger[_0xe256('0x2b')](_0x41cf2e[_0xe256('0x2c')]);if(_0x41cf2e[_0xe256('0x2d')]){delete _0x41cf2e[_0xe256('0x2d')];}_0x37e7a6[_0xe256('0x1b')](_0x1f0cdf)[_0xe256('0x2e')](_0x41cf2e);};}exports[_0xe256('0x2f')]=function(_0x2bb449,_0x1cad9b){var _0x484743={},_0x52fa1b={},_0x495047={'count':0x0,'rows':[]};var _0x58f999=_[_0xe256('0x30')](db[_0xe256('0x31')][_0xe256('0x32')],function(_0xe39b5f){return{'name':_0xe39b5f['fieldName'],'type':_0xe39b5f['type'][_0xe256('0x33')]};});_0x52fa1b[_0xe256('0x34')]=_[_0xe256('0x30')](_0x58f999,'name');_0x52fa1b['query']=_[_0xe256('0x35')](_0x2bb449[_0xe256('0x36')]);_0x52fa1b[_0xe256('0x37')]=_[_0xe256('0x38')](_0x52fa1b[_0xe256('0x34')],_0x52fa1b[_0xe256('0x36')]);_0x484743['attributes']=_['intersection'](_0x52fa1b[_0xe256('0x34')],qs[_0xe256('0x39')](_0x2bb449[_0xe256('0x36')][_0xe256('0x39')]));_0x484743['attributes']=_0x484743[_0xe256('0x3a')][_0xe256('0x3b')]?_0x484743[_0xe256('0x3a')]:_0x52fa1b[_0xe256('0x34')];if(!_0x2bb449[_0xe256('0x36')][_0xe256('0x3c')](_0xe256('0x3d'))){_0x484743[_0xe256('0x20')]=qs[_0xe256('0x20')](_0x2bb449['query'][_0xe256('0x20')]);_0x484743[_0xe256('0x1d')]=qs[_0xe256('0x1d')](_0x2bb449[_0xe256('0x36')]['offset']);}_0x484743[_0xe256('0x3e')]=qs[_0xe256('0x3f')](_0x2bb449[_0xe256('0x36')][_0xe256('0x3f')]);_0x484743[_0xe256('0x40')]=qs[_0xe256('0x37')](_['pick'](_0x2bb449[_0xe256('0x36')],_0x52fa1b['filters']),_0x58f999);if(_0x2bb449['query'][_0xe256('0x41')]){_0x484743[_0xe256('0x40')]=_['merge'](_0x484743['where'],{'$or':_['map'](_0x58f999,function(_0x166cad){if(_0x166cad[_0xe256('0x42')]!==_0xe256('0x43')){var _0x305c3e={};_0x305c3e[_0x166cad[_0xe256('0x2d')]]={'$like':'%'+_0x2bb449['query'][_0xe256('0x41')]+'%'};return _0x305c3e;}})});}_0x484743=_['merge']({},_0x484743,_0x2bb449[_0xe256('0x44')]);var _0x42670f={'where':_0x484743['where']};return db['Variable']['count'](_0x42670f)[_0xe256('0x28')](function(_0x1211ad){_0x495047[_0xe256('0x1f')]=_0x1211ad;if(_0x2bb449[_0xe256('0x36')][_0xe256('0x45')]){_0x484743[_0xe256('0x46')]=[{'all':!![]}];}return db[_0xe256('0x31')][_0xe256('0x47')](_0x484743);})[_0xe256('0x28')](function(_0x22e717){_0x495047['rows']=_0x22e717;return _0x495047;})[_0xe256('0x28')](respondWithFilteredResult(_0x1cad9b,_0x484743))['catch'](handleError(_0x1cad9b,null));};exports['show']=function(_0x148d1d,_0xf38213){var _0x17705b={'raw':!![],'where':{'id':_0x148d1d[_0xe256('0x48')]['id']}},_0x4ca8fa={};_0x4ca8fa[_0xe256('0x34')]=_['keys'](db[_0xe256('0x31')][_0xe256('0x32')]);_0x4ca8fa[_0xe256('0x36')]=_[_0xe256('0x35')](_0x148d1d[_0xe256('0x36')]);_0x4ca8fa[_0xe256('0x37')]=_['intersection'](_0x4ca8fa[_0xe256('0x34')],_0x4ca8fa[_0xe256('0x36')]);_0x17705b[_0xe256('0x3a')]=_[_0xe256('0x38')](_0x4ca8fa[_0xe256('0x34')],qs[_0xe256('0x39')](_0x148d1d[_0xe256('0x36')][_0xe256('0x39')]));_0x17705b[_0xe256('0x3a')]=_0x17705b['attributes']['length']?_0x17705b[_0xe256('0x3a')]:_0x4ca8fa['model'];if(_0x148d1d[_0xe256('0x36')][_0xe256('0x45')]){_0x17705b[_0xe256('0x46')]=[{'all':!![]}];}_0x17705b=_[_0xe256('0x49')]({},_0x17705b,_0x148d1d[_0xe256('0x44')]);return db[_0xe256('0x31')][_0xe256('0x4a')](_0x17705b)[_0xe256('0x28')](handleEntityNotFound(_0xf38213,null))[_0xe256('0x28')](respondWithResult(_0xf38213,null))[_0xe256('0x4b')](handleError(_0xf38213,null));};exports[_0xe256('0x4c')]=function(_0x2b0679,_0x451eb5){return db[_0xe256('0x31')][_0xe256('0x4c')](_0x2b0679[_0xe256('0x4d')],{})[_0xe256('0x28')](function(_0x359226){var _0x5ca8ee=_0x2b0679[_0xe256('0x4e')][_0xe256('0x29')]({'plain':!![]});if(!_0x5ca8ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ca8ee['role']==='user'){var _0x3d7174=_0x359226[_0xe256('0x29')]({'plain':!![]});var _0x3e4269=_0xe256('0x2a');return db[_0xe256('0x4f')][_0xe256('0x4a')]({'where':{'name':_0x3e4269,'userProfileId':_0x5ca8ee[_0xe256('0x50')]},'raw':!![]})[_0xe256('0x28')](function(_0xccbf2){if(_0xccbf2&&_0xccbf2['autoAssociation']===0x0){return db[_0xe256('0x51')]['create']({'name':_0x3d7174['name'],'resourceId':_0x3d7174['id'],'type':_0xccbf2[_0xe256('0x2d')],'sectionId':_0xccbf2['id']},{})[_0xe256('0x28')](function(){return _0x359226;});}else{return _0x359226;}})['catch'](function(_0x1b76e3){logger[_0xe256('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b76e3);throw _0x1b76e3;});}return _0x359226;})[_0xe256('0x28')](respondWithResult(_0x451eb5,0xc9))[_0xe256('0x4b')](handleError(_0x451eb5,null));};exports[_0xe256('0x26')]=function(_0x54f22b,_0x4d3b1b){if(_0x54f22b[_0xe256('0x4d')]['id']){delete _0x54f22b[_0xe256('0x4d')]['id'];}return db[_0xe256('0x31')][_0xe256('0x4a')]({'where':{'id':_0x54f22b['params']['id']}})[_0xe256('0x28')](handleEntityNotFound(_0x4d3b1b,null))[_0xe256('0x28')](saveUpdates(_0x54f22b['body'],null))['then'](respondWithResult(_0x4d3b1b,null))[_0xe256('0x4b')](handleError(_0x4d3b1b,null));};exports[_0xe256('0x27')]=function(_0x3b18fa,_0x5f0641){return db[_0xe256('0x31')][_0xe256('0x4a')]({'where':{'id':_0x3b18fa[_0xe256('0x48')]['id']}})[_0xe256('0x28')](handleEntityNotFound(_0x5f0641,null))[_0xe256('0x28')](removeEntity(_0x5f0641,null))[_0xe256('0x4b')](handleError(_0x5f0641,null));}; \ No newline at end of file +var _0x794b=['autoAssociation','create','update','body','params','eml-format','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','get','Variables','UserProfileResource','error','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','Variable','findAll','rows','catch','keys','length','include','options','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId'];(function(_0x4a5bb2,_0x36ce56){var _0x38c97a=function(_0x4d1990){while(--_0x4d1990){_0x4a5bb2['push'](_0x4a5bb2['shift']());}};_0x38c97a(++_0x36ce56);}(_0x794b,0x99));var _0xb794=function(_0x3f156a,_0x4b9a0c){_0x3f156a=_0x3f156a-0x0;var _0x14f6f8=_0x794b[_0x3f156a];return _0x14f6f8;};'use strict';var emlformat=require(_0xb794('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb794('0x1'));var Mustache=require(_0xb794('0x2'));var util=require('util');var path=require('path');var sox=require(_0xb794('0x3'));var csv=require(_0xb794('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb794('0x5'));var _=require('lodash');var squel=require(_0xb794('0x6'));var crypto=require(_0xb794('0x7'));var jsforce=require(_0xb794('0x8'));var deskjs=require(_0xb794('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb794('0xa'));var Papa=require(_0xb794('0xb'));var Redis=require(_0xb794('0xc'));var authService=require(_0xb794('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb794('0xe'));var hardwareService=require(_0xb794('0xf'));var logger=require('../../config/logger')(_0xb794('0x10'));var utils=require(_0xb794('0x11'));var config=require(_0xb794('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xb794('0x13'))['db'];function respondWithStatusCode(_0x5d7368,_0x21e5ba){_0x21e5ba=_0x21e5ba||0xcc;return function(_0x2bbf02){if(_0x2bbf02){return _0x5d7368[_0xb794('0x14')](_0x21e5ba);}return _0x5d7368[_0xb794('0x15')](_0x21e5ba)[_0xb794('0x16')]();};}function respondWithResult(_0x552a29,_0x331961){_0x331961=_0x331961||0xc8;return function(_0x11e9a0){if(_0x11e9a0){return _0x552a29['status'](_0x331961)[_0xb794('0x17')](_0x11e9a0);}};}function respondWithFilteredResult(_0x3632a2,_0x2a8bf2){return function(_0x1352f7){if(_0x1352f7){var _0x57d23e=typeof _0x2a8bf2[_0xb794('0x18')]===_0xb794('0x19')&&typeof _0x2a8bf2[_0xb794('0x1a')]===_0xb794('0x19');var _0x544b98=_0x1352f7[_0xb794('0x1b')];var _0x10e969=_0x57d23e?0x0:_0x2a8bf2['offset'];var _0x2f3812=_0x57d23e?_0x1352f7[_0xb794('0x1b')]:_0x2a8bf2[_0xb794('0x18')]+_0x2a8bf2[_0xb794('0x1a')];var _0x1cfcf3;if(_0x2f3812>=_0x544b98){_0x2f3812=_0x544b98;_0x1cfcf3=0xc8;}else{_0x1cfcf3=0xce;}_0x3632a2[_0xb794('0x15')](_0x1cfcf3);return _0x3632a2['set']('Content-Range',_0x10e969+'-'+_0x2f3812+'/'+_0x544b98)[_0xb794('0x17')](_0x1352f7);}return null;};}function patchUpdates(_0x2f6818){return function(_0x58ab95){try{jsonpatch[_0xb794('0x1c')](_0x58ab95,_0x2f6818,!![]);}catch(_0xacef96){return BPromise[_0xb794('0x1d')](_0xacef96);}return _0x58ab95[_0xb794('0x1e')]();};}function saveUpdates(_0xfcf27d,_0x35c32c){return function(_0x43ed64){if(_0x43ed64){return _0x43ed64['update'](_0xfcf27d)[_0xb794('0x1f')](function(_0x5c16a9){return _0x5c16a9;});}return null;};}function removeEntity(_0x2f86a3,_0x3337d8){return function(_0x26c2e7){if(_0x26c2e7){return _0x26c2e7[_0xb794('0x20')]()['then'](function(){var _0x3bb7e7=_0x26c2e7[_0xb794('0x21')]({'plain':!![]});var _0x35d59f=_0xb794('0x22');return db[_0xb794('0x23')][_0xb794('0x20')]({'where':{'type':_0x35d59f,'resourceId':_0x3bb7e7['id']}})['then'](function(){return _0x26c2e7;});})[_0xb794('0x1f')](function(){_0x2f86a3[_0xb794('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa00ee8,_0xfd378f){return function(_0x13468d){if(!_0x13468d){_0xa00ee8[_0xb794('0x14')](0x194);}return _0x13468d;};}function handleError(_0x2e3cb2,_0x15b347){_0x15b347=_0x15b347||0x1f4;return function(_0x42b09f){logger[_0xb794('0x24')](_0x42b09f['stack']);if(_0x42b09f[_0xb794('0x25')]){delete _0x42b09f['name'];}_0x2e3cb2[_0xb794('0x15')](_0x15b347)[_0xb794('0x26')](_0x42b09f);};}exports['index']=function(_0x25bb90,_0x5b4da5){var _0x215749={},_0x588dc7={},_0x4cefce={'count':0x0,'rows':[]};var _0x10564d=_[_0xb794('0x27')](db['Variable'][_0xb794('0x28')],function(_0x5d1b35){return{'name':_0x5d1b35[_0xb794('0x29')],'type':_0x5d1b35['type'][_0xb794('0x2a')]};});_0x588dc7[_0xb794('0x2b')]=_[_0xb794('0x27')](_0x10564d,_0xb794('0x25'));_0x588dc7[_0xb794('0x2c')]=_['keys'](_0x25bb90[_0xb794('0x2c')]);_0x588dc7[_0xb794('0x2d')]=_[_0xb794('0x2e')](_0x588dc7[_0xb794('0x2b')],_0x588dc7[_0xb794('0x2c')]);_0x215749[_0xb794('0x2f')]=_[_0xb794('0x2e')](_0x588dc7[_0xb794('0x2b')],qs['fields'](_0x25bb90[_0xb794('0x2c')]['fields']));_0x215749[_0xb794('0x2f')]=_0x215749['attributes']['length']?_0x215749['attributes']:_0x588dc7['model'];if(!_0x25bb90[_0xb794('0x2c')][_0xb794('0x30')](_0xb794('0x31'))){_0x215749[_0xb794('0x1a')]=qs[_0xb794('0x1a')](_0x25bb90[_0xb794('0x2c')][_0xb794('0x1a')]);_0x215749['offset']=qs[_0xb794('0x18')](_0x25bb90['query'][_0xb794('0x18')]);}_0x215749['order']=qs[_0xb794('0x32')](_0x25bb90[_0xb794('0x2c')][_0xb794('0x32')]);_0x215749[_0xb794('0x33')]=qs[_0xb794('0x2d')](_[_0xb794('0x34')](_0x25bb90['query'],_0x588dc7[_0xb794('0x2d')]),_0x10564d);if(_0x25bb90[_0xb794('0x2c')]['filter']){_0x215749[_0xb794('0x33')]=_[_0xb794('0x35')](_0x215749[_0xb794('0x33')],{'$or':_['map'](_0x10564d,function(_0x4b8abd){if(_0x4b8abd['type']!==_0xb794('0x36')){var _0x3344f3={};_0x3344f3[_0x4b8abd['name']]={'$like':'%'+_0x25bb90[_0xb794('0x2c')]['filter']+'%'};return _0x3344f3;}})});}_0x215749=_[_0xb794('0x35')]({},_0x215749,_0x25bb90['options']);var _0x275623={'where':_0x215749[_0xb794('0x33')]};return db['Variable']['count'](_0x275623)[_0xb794('0x1f')](function(_0x554365){_0x4cefce['count']=_0x554365;if(_0x25bb90['query'][_0xb794('0x37')]){_0x215749['include']=[{'all':!![]}];}return db[_0xb794('0x38')][_0xb794('0x39')](_0x215749);})[_0xb794('0x1f')](function(_0x2cfe4a){_0x4cefce[_0xb794('0x3a')]=_0x2cfe4a;return _0x4cefce;})['then'](respondWithFilteredResult(_0x5b4da5,_0x215749))[_0xb794('0x3b')](handleError(_0x5b4da5,null));};exports['show']=function(_0x344fa5,_0x284ee9){var _0x254825={'raw':!![],'where':{'id':_0x344fa5['params']['id']}},_0x4e81b9={};_0x4e81b9[_0xb794('0x2b')]=_[_0xb794('0x3c')](db['Variable']['rawAttributes']);_0x4e81b9[_0xb794('0x2c')]=_[_0xb794('0x3c')](_0x344fa5[_0xb794('0x2c')]);_0x4e81b9[_0xb794('0x2d')]=_[_0xb794('0x2e')](_0x4e81b9['model'],_0x4e81b9[_0xb794('0x2c')]);_0x254825[_0xb794('0x2f')]=_[_0xb794('0x2e')](_0x4e81b9[_0xb794('0x2b')],qs['fields'](_0x344fa5['query']['fields']));_0x254825[_0xb794('0x2f')]=_0x254825[_0xb794('0x2f')][_0xb794('0x3d')]?_0x254825[_0xb794('0x2f')]:_0x4e81b9['model'];if(_0x344fa5[_0xb794('0x2c')][_0xb794('0x37')]){_0x254825[_0xb794('0x3e')]=[{'all':!![]}];}_0x254825=_['merge']({},_0x254825,_0x344fa5[_0xb794('0x3f')]);return db[_0xb794('0x38')]['find'](_0x254825)[_0xb794('0x1f')](handleEntityNotFound(_0x284ee9,null))['then'](respondWithResult(_0x284ee9,null))['catch'](handleError(_0x284ee9,null));};exports['create']=function(_0x3e6cb9,_0x1b4952){return db[_0xb794('0x38')]['create'](_0x3e6cb9['body'],{})[_0xb794('0x1f')](function(_0xa82ce3){var _0x4af935=_0x3e6cb9['user']['get']({'plain':!![]});if(!_0x4af935)throw new Error(_0xb794('0x40'));if(_0x4af935['role']===_0xb794('0x41')){var _0x2f5fe0=_0xa82ce3[_0xb794('0x21')]({'plain':!![]});var _0x30b447='Variables';return db[_0xb794('0x42')][_0xb794('0x43')]({'where':{'name':_0x30b447,'userProfileId':_0x4af935[_0xb794('0x44')]},'raw':!![]})[_0xb794('0x1f')](function(_0x5610f4){if(_0x5610f4&&_0x5610f4[_0xb794('0x45')]===0x0){return db[_0xb794('0x23')][_0xb794('0x46')]({'name':_0x2f5fe0[_0xb794('0x25')],'resourceId':_0x2f5fe0['id'],'type':_0x5610f4['name'],'sectionId':_0x5610f4['id']},{})[_0xb794('0x1f')](function(){return _0xa82ce3;});}else{return _0xa82ce3;}})[_0xb794('0x3b')](function(_0xdb2469){logger[_0xb794('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdb2469);throw _0xdb2469;});}return _0xa82ce3;})[_0xb794('0x1f')](respondWithResult(_0x1b4952,0xc9))[_0xb794('0x3b')](handleError(_0x1b4952,null));};exports[_0xb794('0x47')]=function(_0x3639f0,_0x9c26f4){if(_0x3639f0[_0xb794('0x48')]['id']){delete _0x3639f0[_0xb794('0x48')]['id'];}return db[_0xb794('0x38')]['find']({'where':{'id':_0x3639f0['params']['id']}})[_0xb794('0x1f')](handleEntityNotFound(_0x9c26f4,null))['then'](saveUpdates(_0x3639f0[_0xb794('0x48')],null))[_0xb794('0x1f')](respondWithResult(_0x9c26f4,null))[_0xb794('0x3b')](handleError(_0x9c26f4,null));};exports['destroy']=function(_0x3e93ab,_0xd1f387){return db[_0xb794('0x38')]['find']({'where':{'id':_0x3e93ab[_0xb794('0x49')]['id']}})[_0xb794('0x1f')](handleEntityNotFound(_0xd1f387,null))[_0xb794('0x1f')](removeEntity(_0xd1f387,null))['catch'](handleError(_0xd1f387,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 77e63c6..d291338 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 _0xba3d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba3d,0x69));var _0xdba3=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xba3d[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xdba3('0x0'));var util=require(_0xdba3('0x1'));var logger=require(_0xdba3('0x2'))('api');var moment=require(_0xdba3('0x3'));var BPromise=require(_0xdba3('0x4'));var rp=require(_0xdba3('0x5'));var fs=require('fs');var path=require(_0xdba3('0x6'));var rimraf=require(_0xdba3('0x7'));var config=require(_0xdba3('0x8'));var attributes=require(_0xdba3('0x9'));module[_0xdba3('0xa')]=function(_0x115ee2,_0x56effe){return _0x115ee2['define'](_0xdba3('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a06=['Variable','tools_variables','lodash','util','../../config/logger','api','request-promise','path','rimraf','./variable.attributes','exports','define'];(function(_0x9d27de,_0x5517e2){var _0x499bdf=function(_0x2ed520){while(--_0x2ed520){_0x9d27de['push'](_0x9d27de['shift']());}};_0x499bdf(++_0x5517e2);}(_0x2a06,0xb6));var _0x62a0=function(_0x488380,_0xfbd584){_0x488380=_0x488380-0x0;var _0x4fbf93=_0x2a06[_0x488380];return _0x4fbf93;};'use strict';var _=require(_0x62a0('0x0'));var util=require(_0x62a0('0x1'));var logger=require(_0x62a0('0x2'))(_0x62a0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x62a0('0x4'));var fs=require('fs');var path=require(_0x62a0('0x5'));var rimraf=require(_0x62a0('0x6'));var config=require('../../config/environment');var attributes=require(_0x62a0('0x7'));module[_0x62a0('0x8')]=function(_0x4ee83e,_0x2773fb){return _0x4ee83e[_0x62a0('0x9')](_0x62a0('0xa'),attributes,{'tableName':_0x62a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 3d6025e..f54b3fe 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 _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x8ef6,0xf2));var _0x68ef=function(_0x30b9d4,_0x44207c){_0x30b9d4=_0x30b9d4-0x0;var _0x374f7f=_0x8ef6[_0x30b9d4];return _0x374f7f;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x322efb,_0x539552){var _0x4245ca=function(_0x456790){while(--_0x456790){_0x322efb['push'](_0x322efb['shift']());}};_0x4245ca(++_0x539552);}(_0x5fc3,0xa8));var _0x35fc=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x5fc3[_0x22eb96];return _0x5e1adf;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index c1b5cbf..b536240 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 _0xe078=['get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','exports','express','../../components/auth/service','./version.controller'];(function(_0x3059cc,_0x32bc22){var _0x163360=function(_0x472898){while(--_0x472898){_0x3059cc['push'](_0x3059cc['shift']());}};_0x163360(++_0x32bc22);}(_0xe078,0xb8));var _0x8e07=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xe078[_0xdea41a];return _0x15d0d8;};'use strict';var express=require(_0x8e07('0x0'));var router=express['Router']();var auth=require(_0x8e07('0x1'));var controller=require(_0x8e07('0x2'));router[_0x8e07('0x3')]('/',controller[_0x8e07('0x4')]);router['get'](_0x8e07('0x5'),auth[_0x8e07('0x6')](),auth[_0x8e07('0x7')](),controller[_0x8e07('0x8')]);router['get'](_0x8e07('0x9'),auth[_0x8e07('0x6')](),auth[_0x8e07('0x7')](),controller[_0x8e07('0xa')]);router[_0x8e07('0x3')](_0x8e07('0xb'),auth[_0x8e07('0x6')](),auth['canUpdate'](),controller[_0x8e07('0xc')]);router['get'](_0x8e07('0xd'),auth[_0x8e07('0x6')](),controller[_0x8e07('0xe')]);router[_0x8e07('0x3')](_0x8e07('0xf'),controller['migrations']);module[_0x8e07('0x10')]=router; \ No newline at end of file +var _0x36f6=['pull','restart','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0x36f6,0x163));var _0x636f=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0x36f6[_0x44dba1];return _0x2fbd3f;};'use strict';var express=require(_0x636f('0x0'));var router=express[_0x636f('0x1')]();var auth=require(_0x636f('0x2'));var controller=require(_0x636f('0x3'));router[_0x636f('0x4')]('/',controller[_0x636f('0x5')]);router['get'](_0x636f('0x6'),auth['isAuthenticated'](),auth[_0x636f('0x7')](),controller[_0x636f('0x8')]);router[_0x636f('0x4')](_0x636f('0x9'),auth[_0x636f('0xa')](),auth[_0x636f('0x7')](),controller[_0x636f('0xb')]);router[_0x636f('0x4')](_0x636f('0xc'),auth[_0x636f('0xa')](),auth[_0x636f('0x7')](),controller[_0x636f('0xd')]);router[_0x636f('0x4')]('/restart',auth[_0x636f('0xa')](),controller[_0x636f('0xe')]);router[_0x636f('0x4')]('/migrations',controller['migrations']);module[_0x636f('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 1cf149e..ce2af82 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 _0x7444=['simple-git','root','index','exports','version','query','latest','tags','2.0.0','json','status','fetch','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','length','replace','.js','push','sequelize','Migration','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','child_process','exec','../../mysqldb','../../config/environment'];(function(_0x39c408,_0x57a0b8){var _0x53a32a=function(_0x4f22e3){while(--_0x4f22e3){_0x39c408['push'](_0x39c408['shift']());}};_0x53a32a(++_0x57a0b8);}(_0x7444,0xc4));var _0x4744=function(_0x4c7ec9,_0x296cae){_0x4c7ec9=_0x4c7ec9-0x0;var _0x3e4428=_0x7444[_0x4c7ec9];return _0x3e4428;};'use strict';var Umzug=require(_0x4744('0x0'));var path=require(_0x4744('0x1'));var fs=require('fs');var _=require(_0x4744('0x2'));var pkginfo=require(_0x4744('0x3'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x4744('0x4'))[_0x4744('0x5')];var db=require(_0x4744('0x6'))['db'];var config=require(_0x4744('0x7'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('update');var git=require(_0x4744('0x8'))(config[_0x4744('0x9')]);exports[_0x4744('0xa')]=function(_0xfb33b6,_0x5887b7){var _0x49e61b={'current':module[_0x4744('0xb')][_0x4744('0xc')],'phonebar':0x2};if(_0xfb33b6['query']&&_0xfb33b6[_0x4744('0xd')][_0x4744('0xe')]){return git['fetch']()[_0x4744('0xf')](function(_0x437bc1,_0x130e4a){_0x49e61b[_0x4744('0xe')]=(_0x437bc1?module[_0x4744('0xb')]['version']:_0x130e4a[_0x4744('0xe')])||_0x4744('0x10');return _0x5887b7['status'](0xc8)[_0x4744('0x11')](_0x49e61b);});}else{return _0x5887b7[_0x4744('0x12')](0xc8)[_0x4744('0x11')](_0x49e61b);}};exports[_0x4744('0x13')]=function(_0x1f302b,_0x5beb75){return git[_0x4744('0x13')]([_0x4744('0x14'),'master'],function(_0x484a4c){if(_0x484a4c){logger[_0x4744('0x15')](_0x484a4c);return _0x5beb75[_0x4744('0x12')](0x1f4)[_0x4744('0x11')](_0x484a4c);}logger['info'](_0x4744('0x16'));return _0x5beb75[_0x4744('0x12')](0xc8)[_0x4744('0x11')]({'output':_0x4744('0x17')});});};exports[_0x4744('0x18')]=function(_0x230321,_0x1b0549){return git[_0x4744('0x18')]([_0x4744('0x19'),_0x4744('0x1a')],function(_0x1fa279){if(_0x1fa279){logger[_0x4744('0x15')](_0x1fa279);return _0x1b0549[_0x4744('0x12')](0x1f4)['json'](_0x1fa279);}logger[_0x4744('0x1b')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1b0549[_0x4744('0x12')](0xc8)[_0x4744('0x11')]({'output':_0x4744('0x1c')});});};exports[_0x4744('0x1d')]=function(_0x49bc64,_0x129b59){exec(_0x4744('0x1e'),function(_0x13e28e,_0x45e151,_0x479bdc){logger[_0x4744('0x1b')](_0x45e151);logger['info'](_0x479bdc);if(_0x13e28e){logger[_0x4744('0x15')](_0x13e28e);return _0x129b59['status'](0x1f4)[_0x4744('0x11')](_0x13e28e);}return _0x129b59[_0x4744('0x12')](0xc8)[_0x4744('0x11')]({'output':_0x45e151});});};exports[_0x4744('0x1f')]=function(_0x23f5d1,_0x2b12a3){return pm2[_0x4744('0x1f')](_0x4744('0x20'))[_0x4744('0x21')](function(_0x18525f){logger['info'](_0x4744('0x22'),_0x18525f);return _0x2b12a3[_0x4744('0x12')](0xc8)[_0x4744('0x11')]({'output':_0x4744('0x23')});})['catch'](function(_0x2a4df7){logger[_0x4744('0x15')](_0x2a4df7);return _0x2b12a3[_0x4744('0x12')](0x1f4)[_0x4744('0x11')](_0x2a4df7);});};exports[_0x4744('0x24')]=function(_0x967b46,_0x24e096){var _0x305c64=fs['readdirSync'](path[_0x4744('0x25')](config[_0x4744('0x9')],_0x4744('0x26'),_0x4744('0x24')));var _0x4c64c5=[];for(var _0x24c24d=0x0;_0x24c24d<_0x305c64[_0x4744('0x27')];_0x24c24d++){var _0x16a682=_0x305c64[_0x24c24d][_0x4744('0x28')](_0x4744('0x29'),'');if(compareVersions(module[_0x4744('0xb')][_0x4744('0xc')],_0x16a682)===-0x1){_0x4c64c5[_0x4744('0x2a')](_0x16a682);}}if(_0x4c64c5[_0x4744('0x27')]){var _0x27bd05=_0x4c64c5['sort'](compareVersions);var _0x947fd6=new Umzug({'storage':_0x4744('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0x4744('0x2c'),'columnName':_0x4744('0xc')},'migrations':{'params':[db[_0x4744('0x2b')]['getQueryInterface'](),db[_0x4744('0x2b')]['constructor'],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[_0x4744('0x25')](config[_0x4744('0x9')],_0x4744('0x26'),'migrations'),'pattern':/\.js$/}});_0x947fd6['up']({'migrations':_[_0x4744('0x2d')](_0x27bd05,function(_0x5f455f){return _0x5f455f+_0x4744('0x29');})})[_0x4744('0x21')](function(){return _0x24e096[_0x4744('0x12')](0xc8)[_0x4744('0x11')]({'output':_0x4744('0x2e')+module[_0x4744('0xb')]['version']+_0x4744('0x2f')+_[_0x4744('0x30')](_0x27bd05),'migrations':_[_0x4744('0x25')](_0x27bd05)});})['catch'](function(_0x23afed){if(_0x23afed instanceof db[_0x4744('0x2b')][_0x4744('0x31')]){return _0x24e096[_0x4744('0x12')](0xc8)[_0x4744('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x24e096['status'](0x1f4)[_0x4744('0x11')](_0x23afed);}});}else{return _0x24e096[_0x4744('0x12')](0xc8)[_0x4744('0x11')]({'output':_0x4744('0x32')});}}; \ No newline at end of file +var _0x1257=['constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','map','.js','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','query','latest','tags','exports','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','server','length','replace','push','sort','Migration','sequelize'];(function(_0x450b9b,_0x1b91d2){var _0x5f5d00=function(_0x335dca){while(--_0x335dca){_0x450b9b['push'](_0x450b9b['shift']());}};_0x5f5d00(++_0x1b91d2);}(_0x1257,0xdc));var _0x7125=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1257[_0x580576];return _0x3f55a0;};'use strict';var Umzug=require(_0x7125('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x7125('0x1'));var pkginfo=require('pkginfo')(module,_0x7125('0x2'));var compareVersions=require(_0x7125('0x3'));var exec=require(_0x7125('0x4'))[_0x7125('0x5')];var db=require(_0x7125('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x7125('0x7'));var logger=require(_0x7125('0x8'))('update');var git=require(_0x7125('0x9'))(config[_0x7125('0xa')]);exports[_0x7125('0xb')]=function(_0x346de1,_0x4f6984){var _0x54fe45={'current':module['exports'][_0x7125('0x2')],'phonebar':0x2};if(_0x346de1[_0x7125('0xc')]&&_0x346de1[_0x7125('0xc')][_0x7125('0xd')]){return git['fetch']()[_0x7125('0xe')](function(_0x74c6f7,_0xad3560){_0x54fe45[_0x7125('0xd')]=(_0x74c6f7?module[_0x7125('0xf')][_0x7125('0x2')]:_0xad3560['latest'])||_0x7125('0x10');return _0x4f6984[_0x7125('0x11')](0xc8)[_0x7125('0x12')](_0x54fe45);});}else{return _0x4f6984[_0x7125('0x11')](0xc8)[_0x7125('0x12')](_0x54fe45);}};exports[_0x7125('0x13')]=function(_0x1ecdfb,_0x23b202){return git[_0x7125('0x13')]([_0x7125('0x14'),_0x7125('0x15')],function(_0xb0edc7){if(_0xb0edc7){logger[_0x7125('0x16')](_0xb0edc7);return _0x23b202[_0x7125('0x11')](0x1f4)['json'](_0xb0edc7);}logger[_0x7125('0x17')](_0x7125('0x18'));return _0x23b202['status'](0xc8)[_0x7125('0x12')]({'output':_0x7125('0x19')});});};exports[_0x7125('0x1a')]=function(_0x3f9123,_0x176d00){return git['reset']([_0x7125('0x1b'),_0x7125('0x1c')],function(_0x13e5d1){if(_0x13e5d1){logger[_0x7125('0x16')](_0x13e5d1);return _0x176d00[_0x7125('0x11')](0x1f4)[_0x7125('0x12')](_0x13e5d1);}logger[_0x7125('0x17')](_0x7125('0x1d'));return _0x176d00[_0x7125('0x11')](0xc8)[_0x7125('0x12')]({'output':_0x7125('0x1e')});});};exports[_0x7125('0x1f')]=function(_0x35ac62,_0x49c217){exec('npm\x20install\x20--production',function(_0x5a8893,_0x44eff0,_0x3f7e8e){logger['info'](_0x44eff0);logger[_0x7125('0x17')](_0x3f7e8e);if(_0x5a8893){logger[_0x7125('0x16')](_0x5a8893);return _0x49c217[_0x7125('0x11')](0x1f4)[_0x7125('0x12')](_0x5a8893);}return _0x49c217['status'](0xc8)[_0x7125('0x12')]({'output':_0x44eff0});});};exports[_0x7125('0x20')]=function(_0x1d940e,_0x2e819f){return pm2[_0x7125('0x20')]('motion2')[_0x7125('0x21')](function(_0x2d70bf){logger[_0x7125('0x17')](_0x7125('0x22'),_0x2d70bf);return _0x2e819f[_0x7125('0x11')](0xc8)[_0x7125('0x12')]({'output':_0x7125('0x23')});})[_0x7125('0x24')](function(_0x127a49){logger[_0x7125('0x16')](_0x127a49);return _0x2e819f['status'](0x1f4)[_0x7125('0x12')](_0x127a49);});};exports['migrations']=function(_0x2aec91,_0x2a7a7f){var _0xa1683d=fs['readdirSync'](path[_0x7125('0x25')](config[_0x7125('0xa')],_0x7125('0x26'),'migrations'));var _0x2010a6=[];for(var _0x28a298=0x0;_0x28a298<_0xa1683d[_0x7125('0x27')];_0x28a298++){var _0xee25c7=_0xa1683d[_0x28a298][_0x7125('0x28')]('.js','');if(compareVersions(module[_0x7125('0xf')][_0x7125('0x2')],_0xee25c7)===-0x1){_0x2010a6[_0x7125('0x29')](_0xee25c7);}}if(_0x2010a6[_0x7125('0x27')]){var _0x545899=_0x2010a6[_0x7125('0x2a')](compareVersions);var _0x48e013=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x7125('0x2b')],'modelName':'Migration','columnName':_0x7125('0x2')},'migrations':{'params':[db[_0x7125('0x2c')]['getQueryInterface'](),db[_0x7125('0x2c')][_0x7125('0x2d')],function(){throw new Error(_0x7125('0x2e'));}],'path':path[_0x7125('0x25')](config[_0x7125('0xa')],_0x7125('0x26'),_0x7125('0x2f')),'pattern':/\.js$/}});_0x48e013['up']({'migrations':_[_0x7125('0x30')](_0x545899,function(_0x136c06){return _0x136c06+_0x7125('0x31');})})['then'](function(){return _0x2a7a7f[_0x7125('0x11')](0xc8)[_0x7125('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x7125('0x2')]+_0x7125('0x32')+_['last'](_0x545899),'migrations':_[_0x7125('0x25')](_0x545899)});})[_0x7125('0x24')](function(_0x593af0){if(_0x593af0 instanceof db['sequelize'][_0x7125('0x33')]){return _0x2a7a7f[_0x7125('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x2a7a7f[_0x7125('0x11')](0x1f4)[_0x7125('0x12')](_0x593af0);}});}else{return _0x2a7a7f[_0x7125('0x11')](0xc8)['json']({'output':_0x7125('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f97de96..bb1740a 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 _0x4645=['/describe','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x205273,_0x5c37e8){var _0x3252a2=function(_0x33abe9){while(--_0x33abe9){_0x205273['push'](_0x205273['shift']());}};_0x3252a2(++_0x5c37e8);}(_0x4645,0xb9));var _0x5464=function(_0x35a5ea,_0x3eb3ec){_0x35a5ea=_0x35a5ea-0x0;var _0x22e4a3=_0x4645[_0x35a5ea];return _0x22e4a3;};'use strict';var multer=require(_0x5464('0x0'));var util=require(_0x5464('0x1'));var path=require(_0x5464('0x2'));var timeout=require(_0x5464('0x3'));var express=require(_0x5464('0x4'));var router=express[_0x5464('0x5')]();var fs_extra=require(_0x5464('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5464('0x7'));var config=require(_0x5464('0x8'));var controller=require(_0x5464('0x9'));router[_0x5464('0xa')]('/',auth[_0x5464('0xb')](),controller[_0x5464('0xc')]);router[_0x5464('0xa')](_0x5464('0xd'),auth[_0x5464('0xb')](),controller['describe']);router[_0x5464('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5464('0xe')]);router[_0x5464('0xf')]('/',auth[_0x5464('0xb')](),controller[_0x5464('0x10')]);router[_0x5464('0x11')](_0x5464('0x12'),auth[_0x5464('0xb')](),controller[_0x5464('0x13')]);router[_0x5464('0x14')](_0x5464('0x12'),auth[_0x5464('0xb')](),controller['destroy']);module[_0x5464('0x15')]=router; \ No newline at end of file +var _0x2ad7=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x335588,_0x1d4164){var _0x4740fc=function(_0x1866c5){while(--_0x1866c5){_0x335588['push'](_0x335588['shift']());}};_0x4740fc(++_0x1d4164);}(_0x2ad7,0xbd));var _0x72ad=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2ad7[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x72ad('0x0'));var util=require(_0x72ad('0x1'));var path=require(_0x72ad('0x2'));var timeout=require('connect-timeout');var express=require(_0x72ad('0x3'));var router=express[_0x72ad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x72ad('0x5'));var interaction=require(_0x72ad('0x6'));var config=require(_0x72ad('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x72ad('0x8')]('/',auth[_0x72ad('0x9')](),controller[_0x72ad('0xa')]);router[_0x72ad('0x8')]('/describe',auth[_0x72ad('0x9')](),controller[_0x72ad('0xb')]);router[_0x72ad('0x8')](_0x72ad('0xc'),auth[_0x72ad('0x9')](),controller[_0x72ad('0xd')]);router[_0x72ad('0xe')]('/',auth[_0x72ad('0x9')](),controller[_0x72ad('0xf')]);router['put'](_0x72ad('0xc'),auth[_0x72ad('0x9')](),controller[_0x72ad('0x10')]);router[_0x72ad('0x11')](_0x72ad('0xc'),auth[_0x72ad('0x9')](),controller[_0x72ad('0x12')]);module[_0x72ad('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 748aeb5..a371bb2 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 _0xd4dc=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x84a159,_0x1d2a62){var _0x596baa=function(_0x4676fd){while(--_0x4676fd){_0x84a159['push'](_0x84a159['shift']());}};_0x596baa(++_0x1d2a62);}(_0xd4dc,0xff));var _0xcd4d=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xd4dc[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0xcd4d('0x0'));module['exports']={'type':{'type':Sequelize[_0xcd4d('0x1')]},'uniqueid':{'type':Sequelize[_0xcd4d('0x1')]},'calleridnum':{'type':Sequelize[_0xcd4d('0x1')]},'calleridname':{'type':Sequelize[_0xcd4d('0x1')]},'queue':{'type':Sequelize[_0xcd4d('0x1')]},'interface':{'type':Sequelize[_0xcd4d('0x1')]},'membername':{'type':Sequelize[_0xcd4d('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xcd4d('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xcd4d('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xcd4d('0x4')]},'agentacw':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xcd4d('0x1')]},'channel':{'type':Sequelize[_0xcd4d('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xcd4d('0x1')]},'connectedlinenum':{'type':Sequelize[_0xcd4d('0x1')]},'connectedlinename':{'type':Sequelize[_0xcd4d('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xcd4d('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xcd4d('0x1')]},'priority':{'type':Sequelize[_0xcd4d('0x1')]},'destchannel':{'type':Sequelize[_0xcd4d('0x1')]},'destchannelstate':{'type':Sequelize[_0xcd4d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xcd4d('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xcd4d('0x1')]},'destlanguage':{'type':Sequelize[_0xcd4d('0x1')]},'destaccountcode':{'type':Sequelize[_0xcd4d('0x1')]},'destcontext':{'type':Sequelize[_0xcd4d('0x1')]},'destexten':{'type':Sequelize[_0xcd4d('0x1')]},'destpriority':{'type':Sequelize[_0xcd4d('0x1')]},'destuniqueid':{'type':Sequelize[_0xcd4d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xcd4d('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xcd4d('0x1')]},'transfer':{'type':Sequelize[_0xcd4d('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xcd4d('0x5')},'transferexten':{'type':Sequelize[_0xcd4d('0x1')]},'transferuniqueid':{'type':Sequelize[_0xcd4d('0x1')]},'agententerreason':{'type':Sequelize[_0xcd4d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x80e0=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','BOOLEAN'];(function(_0x1467c1,_0x2e4edb){var _0x100952=function(_0x57cf38){while(--_0x57cf38){_0x1467c1['push'](_0x1467c1['shift']());}};_0x100952(++_0x2e4edb);}(_0x80e0,0x9d));var _0x080e=function(_0x61dd04,_0xc480ee){_0x61dd04=_0x61dd04-0x0;var _0xf9eb29=_0x80e0[_0x61dd04];return _0xf9eb29;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x080e('0x0')]},'uniqueid':{'type':Sequelize[_0x080e('0x0')]},'calleridnum':{'type':Sequelize[_0x080e('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x080e('0x0')]},'interface':{'type':Sequelize[_0x080e('0x0')]},'membername':{'type':Sequelize[_0x080e('0x0')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x080e('0x1')]},'agentcompleteAt':{'type':Sequelize[_0x080e('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x080e('0x1')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x080e('0x2')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x080e('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x080e('0x3')]},'reason':{'type':Sequelize[_0x080e('0x0')]},'lastevent':{'type':Sequelize[_0x080e('0x0')]},'channel':{'type':Sequelize[_0x080e('0x0')]},'channelstate':{'type':Sequelize[_0x080e('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x080e('0x0')]},'language':{'type':Sequelize[_0x080e('0x0')]},'accountcode':{'type':Sequelize[_0x080e('0x0')]},'context':{'type':Sequelize[_0x080e('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x080e('0x0')]},'destchannelstate':{'type':Sequelize[_0x080e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x080e('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x080e('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x080e('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x080e('0x0')]},'destpriority':{'type':Sequelize[_0x080e('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x080e('0x0')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x080e('0x4')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x080e('0x0')]},'agententerreason':{'type':Sequelize[_0x080e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 9b23a7d..38880a6 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(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index ce91017..0984db9 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 _0x43fd=['path','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','util','moment','bluebird'];(function(_0x9cc3da,_0x587e07){var _0x2c3713=function(_0x10c47c){while(--_0x10c47c){_0x9cc3da['push'](_0x9cc3da['shift']());}};_0x2c3713(++_0x587e07);}(_0x43fd,0x1ec));var _0xd43f=function(_0x2c1fff,_0x320620){_0x2c1fff=_0x2c1fff-0x0;var _0x2eaf6f=_0x43fd[_0x2c1fff];return _0x2eaf6f;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd43f('0x1'));var BPromise=require(_0xd43f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd43f('0x3'));var rimraf=require('rimraf');var config=require(_0xd43f('0x4'));var attributes=require(_0xd43f('0x5'));module[_0xd43f('0x6')]=function(_0x33ddff,_0x52e75f){return _0x33ddff[_0xd43f('0x7')](_0xd43f('0x8'),attributes,{'tableName':_0xd43f('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd43f('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','lodash','../../config/logger','api'];(function(_0x5ee577,_0x1effb4){var _0x15adb2=function(_0xad666f){while(--_0xad666f){_0x5ee577['push'](_0x5ee577['shift']());}};_0x15adb2(++_0x1effb4);}(_0x8d0a,0x65));var _0xa8d0=function(_0x16ccf8,_0x4e71f2){_0x16ccf8=_0x16ccf8-0x0;var _0x19ded2=_0x8d0a[_0x16ccf8];return _0x19ded2;};'use strict';var _=require(_0xa8d0('0x0'));var util=require('util');var logger=require(_0xa8d0('0x1'))(_0xa8d0('0x2'));var moment=require(_0xa8d0('0x3'));var BPromise=require(_0xa8d0('0x4'));var rp=require(_0xa8d0('0x5'));var fs=require('fs');var path=require(_0xa8d0('0x6'));var rimraf=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var attributes=require(_0xa8d0('0x9'));module['exports']=function(_0x1cac4f,_0x212aaf){return _0x1cac4f[_0xa8d0('0xa')](_0xa8d0('0xb'),attributes,{'tableName':_0xa8d0('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index c1fddc8..d2749fd 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 _0xc1de=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','attributes','util','randomstring'];(function(_0x261616,_0x5836a1){var _0x439b18=function(_0x4478f3){while(--_0x4478f3){_0x261616['push'](_0x261616['shift']());}};_0x439b18(++_0x5836a1);}(_0xc1de,0x1b0));var _0xec1d=function(_0xc3ea9,_0x20e81a){_0xc3ea9=_0xc3ea9-0x0;var _0x25b78b=_0xc1de[_0xc3ea9];return _0x25b78b;};'use strict';var _=require('lodash');var util=require(_0xec1d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xec1d('0x1'));var fs=require('fs');var Redis=require(_0xec1d('0x2'));var db=require(_0xec1d('0x3'))['db'];var utils=require(_0xec1d('0x4'));var logger=require(_0xec1d('0x5'))(_0xec1d('0x6'));var config=require(_0xec1d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xec1d('0x8')][_0xec1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf99dd8,_0x12e5b5,_0x55f28f){return new BPromise(function(_0x2b4194,_0x5b0d93){return client[_0xec1d('0xa')](_0xf99dd8,_0x55f28f)[_0xec1d('0xb')](function(_0x1efee5){logger[_0xec1d('0xc')](_0xec1d('0xd'),_0x12e5b5,_0xec1d('0xe'));logger[_0xec1d('0xf')](_0xec1d('0x10'),_0x12e5b5,_0xec1d('0xe'),JSON[_0xec1d('0x11')](_0x1efee5));if(_0x1efee5[_0xec1d('0x12')]){if(_0x1efee5[_0xec1d('0x12')]['code']===0x1f4){logger[_0xec1d('0x12')](_0xec1d('0xd'),_0x12e5b5,_0x1efee5[_0xec1d('0x12')][_0xec1d('0x13')]);return _0x5b0d93(_0x1efee5['error'][_0xec1d('0x13')]);}logger[_0xec1d('0x12')](_0xec1d('0xd'),_0x12e5b5,_0x1efee5[_0xec1d('0x12')][_0xec1d('0x13')]);return _0x2b4194(_0x1efee5['error'][_0xec1d('0x13')]);}else{logger[_0xec1d('0xc')](_0xec1d('0xd'),_0x12e5b5,'request\x20sent');_0x2b4194(_0x1efee5[_0xec1d('0x14')][_0xec1d('0x13')]);}})[_0xec1d('0x15')](function(_0x181097){logger[_0xec1d('0x12')](_0xec1d('0xd'),_0x12e5b5,_0x181097);_0x5b0d93(_0x181097);});});}exports[_0xec1d('0x16')]=function(_0x5b51ef){var _0xe586d9=this;return new Promise(function(_0x5d9fac,_0x4b4213){return db['VoiceAgentReport'][_0xec1d('0x17')](_0x5b51ef[_0xec1d('0x18')],{'raw':_0x5b51ef['options']?_0x5b51ef[_0xec1d('0x19')][_0xec1d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2b5552){logger[_0xec1d('0xc')](_0xec1d('0x16'),_0x5b51ef);logger[_0xec1d('0xf')](_0xec1d('0x16'),_0x5b51ef,JSON[_0xec1d('0x11')](_0x2b5552));_0x5d9fac(_0x2b5552);})[_0xec1d('0x15')](function(_0x389c03){logger[_0xec1d('0x12')](_0xec1d('0x16'),_0x389c03['message'],_0x5b51ef);_0x4b4213(_0xe586d9[_0xec1d('0x12')](0x1f4,_0x389c03[_0xec1d('0x13')]));});});};exports[_0xec1d('0x1b')]=function(_0x3eef51){var _0x6032fc=this;return new Promise(function(_0x33bf07,_0x5715ac){return db['VoiceAgentReport'][_0xec1d('0x1c')](_0x3eef51[_0xec1d('0x18')],{'raw':_0x3eef51['options']?_0x3eef51[_0xec1d('0x19')][_0xec1d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3eef51[_0xec1d('0x19')]?_0x3eef51[_0xec1d('0x19')][_0xec1d('0x1d')]||null:null,'attributes':_0x3eef51[_0xec1d('0x19')]?_0x3eef51['options'][_0xec1d('0x1e')]||null:null,'limit':_0x3eef51[_0xec1d('0x19')]?_0x3eef51[_0xec1d('0x19')]['limit']||null:null})[_0xec1d('0xb')](function(_0x47f0e7){logger[_0xec1d('0xc')](_0xec1d('0x1b'),_0x3eef51);logger[_0xec1d('0xf')](_0xec1d('0x1b'),_0x3eef51,JSON[_0xec1d('0x11')](_0x47f0e7));_0x33bf07(_0x47f0e7);})['catch'](function(_0x37daf2){logger[_0xec1d('0x12')](_0xec1d('0x1b'),_0x37daf2['message'],_0x3eef51);_0x5715ac(_0x6032fc[_0xec1d('0x12')](0x1f4,_0x37daf2[_0xec1d('0x13')]));});});}; \ No newline at end of file +var _0x8e75=['result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','info','UpdateVoiceAgentReport','update','where','attributes','limit','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message'];(function(_0x1a7f6e,_0x23ce37){var _0xa934a0=function(_0x2a8603){while(--_0x2a8603){_0x1a7f6e['push'](_0x1a7f6e['shift']());}};_0xa934a0(++_0x23ce37);}(_0x8e75,0x10d));var _0x58e7=function(_0x1f4b1a,_0x5a0343){_0x1f4b1a=_0x1f4b1a-0x0;var _0x1ea9cb=_0x8e75[_0x1f4b1a];return _0x1ea9cb;};'use strict';var _=require('lodash');var util=require(_0x58e7('0x0'));var moment=require('moment');var BPromise=require(_0x58e7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58e7('0x2'));var db=require(_0x58e7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x58e7('0x4'))(_0x58e7('0x5'));var config=require(_0x58e7('0x6'));var jayson=require(_0x58e7('0x7'));var client=jayson[_0x58e7('0x8')][_0x58e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302fe7,_0xed9f9b,_0xc1a361){return new BPromise(function(_0x2c1100,_0xdf1bec){return client['request'](_0x302fe7,_0xc1a361)[_0x58e7('0xa')](function(_0x3c0c47){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0xed9f9b,_0x58e7('0xb'));logger[_0x58e7('0xc')](_0x58e7('0xd'),_0xed9f9b,'request\x20sent',JSON[_0x58e7('0xe')](_0x3c0c47));if(_0x3c0c47[_0x58e7('0xf')]){if(_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x10')]===0x1f4){logger['error'](_0x58e7('0x11'),_0xed9f9b,_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x12')]);return _0xdf1bec(_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x12')]);}logger['error'](_0x58e7('0x11'),_0xed9f9b,_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x12')]);return _0x2c1100(_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x12')]);}else{logger['info'](_0x58e7('0x11'),_0xed9f9b,_0x58e7('0xb'));_0x2c1100(_0x3c0c47[_0x58e7('0x13')]['message']);}})[_0x58e7('0x14')](function(_0x5d0151){logger['error'](_0x58e7('0x11'),_0xed9f9b,_0x5d0151);_0xdf1bec(_0x5d0151);});});}exports[_0x58e7('0x15')]=function(_0x501ab0){var _0x5ad09a=this;return new Promise(function(_0x132b10,_0x1e4829){return db[_0x58e7('0x16')]['create'](_0x501ab0[_0x58e7('0x17')],{'raw':_0x501ab0[_0x58e7('0x18')]?_0x501ab0[_0x58e7('0x18')][_0x58e7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1234ae){logger[_0x58e7('0x1a')](_0x58e7('0x15'),_0x501ab0);logger[_0x58e7('0xc')](_0x58e7('0x15'),_0x501ab0,JSON[_0x58e7('0xe')](_0x1234ae));_0x132b10(_0x1234ae);})['catch'](function(_0x3b56ef){logger['error'](_0x58e7('0x15'),_0x3b56ef[_0x58e7('0x12')],_0x501ab0);_0x1e4829(_0x5ad09a[_0x58e7('0xf')](0x1f4,_0x3b56ef[_0x58e7('0x12')]));});});};exports[_0x58e7('0x1b')]=function(_0x4c7b48){var _0x97cd26=this;return new Promise(function(_0x304f2d,_0x5738db){return db[_0x58e7('0x16')][_0x58e7('0x1c')](_0x4c7b48['body'],{'raw':_0x4c7b48[_0x58e7('0x18')]?_0x4c7b48['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c7b48[_0x58e7('0x18')]?_0x4c7b48[_0x58e7('0x18')][_0x58e7('0x1d')]||null:null,'attributes':_0x4c7b48[_0x58e7('0x18')]?_0x4c7b48['options'][_0x58e7('0x1e')]||null:null,'limit':_0x4c7b48['options']?_0x4c7b48[_0x58e7('0x18')][_0x58e7('0x1f')]||null:null})[_0x58e7('0xa')](function(_0x33a70c){logger[_0x58e7('0x1a')](_0x58e7('0x1b'),_0x4c7b48);logger['debug']('UpdateVoiceAgentReport',_0x4c7b48,JSON[_0x58e7('0xe')](_0x33a70c));_0x304f2d(_0x33a70c);})[_0x58e7('0x14')](function(_0x212505){logger['error']('UpdateVoiceAgentReport',_0x212505['message'],_0x4c7b48);_0x5738db(_0x97cd26[_0x58e7('0xf')](0x1f4,_0x212505['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d4db031..2d5b220 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 _0x6cf3=['index','describe','get','/:id','create','put','/with-retry/:id','delete','exports','express','Router','./voiceCallReport.controller','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6cf3,0x100));var _0x36cf=function(_0x167295,_0x555a81){_0x167295=_0x167295-0x0;var _0x400be6=_0x6cf3[_0x167295];return _0x400be6;};'use strict';var express=require(_0x36cf('0x0'));var router=express[_0x36cf('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x36cf('0x2'));router['get']('/',auth[_0x36cf('0x3')](),controller[_0x36cf('0x4')]);router['get']('/describe',auth[_0x36cf('0x3')](),controller[_0x36cf('0x5')]);router[_0x36cf('0x6')](_0x36cf('0x7'),auth[_0x36cf('0x3')](),controller['show']);router['post']('/',auth[_0x36cf('0x3')](),controller[_0x36cf('0x8')]);router['put'](_0x36cf('0x7'),auth[_0x36cf('0x3')](),controller['update']);router[_0x36cf('0x9')](_0x36cf('0xa'),auth['isAuthenticated'](),controller['updateWithRetry']);router[_0x36cf('0xb')](_0x36cf('0x7'),auth[_0x36cf('0x3')](),controller['destroy']);module[_0x36cf('0xc')]=router; \ No newline at end of file +var _0x62b8=['create','put','update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','index','get','describe','/:id','isAuthenticated','show','post'];(function(_0x284b03,_0x54c298){var _0x395eca=function(_0x304bd9){while(--_0x304bd9){_0x284b03['push'](_0x284b03['shift']());}};_0x395eca(++_0x54c298);}(_0x62b8,0x107));var _0x862b=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x62b8[_0x1e9424];return _0x1bd96c;};'use strict';var express=require(_0x862b('0x0'));var router=express[_0x862b('0x1')]();var auth=require('../../components/auth/service');var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x862b('0x2')]);router[_0x862b('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x862b('0x4')]);router[_0x862b('0x3')](_0x862b('0x5'),auth[_0x862b('0x6')](),controller[_0x862b('0x7')]);router[_0x862b('0x8')]('/',auth[_0x862b('0x6')](),controller[_0x862b('0x9')]);router[_0x862b('0xa')](_0x862b('0x5'),auth[_0x862b('0x6')](),controller[_0x862b('0xb')]);router['put'](_0x862b('0xc'),auth[_0x862b('0x6')](),controller[_0x862b('0xd')]);router[_0x862b('0xe')](_0x862b('0x5'),auth['isAuthenticated'](),controller[_0x862b('0xf')]);module[_0x862b('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 190eb60..163eea8 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 _0x3f7c=['outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound'];(function(_0x553e1e,_0x5bedef){var _0x3bb17b=function(_0x53ad59){while(--_0x53ad59){_0x553e1e['push'](_0x553e1e['shift']());}};_0x3bb17b(++_0x5bedef);}(_0x3f7c,0xaa));var _0xc3f7=function(_0x49888a,_0x4fc201){_0x49888a=_0x49888a-0x0;var _0x2ce799=_0x3f7c[_0x49888a];return _0x2ce799;};'use strict';var Sequelize=require(_0xc3f7('0x0'));module[_0xc3f7('0x1')]={'uniqueid':{'type':Sequelize[_0xc3f7('0x2')]},'type':{'type':Sequelize[_0xc3f7('0x3')](_0xc3f7('0x4'),'internal',_0xc3f7('0x5'),'inbound-fax',_0xc3f7('0x6'),_0xc3f7('0x7'))},'tag':{'type':Sequelize[_0xc3f7('0x2')]},'accountcode':{'type':Sequelize[_0xc3f7('0x2')]},'source':{'type':Sequelize[_0xc3f7('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc3f7('0x2')]},'callerid':{'type':Sequelize[_0xc3f7('0x2')]},'channel':{'type':Sequelize[_0xc3f7('0x2')]},'destinationchannel':{'type':Sequelize[_0xc3f7('0x2')]},'lastapplication':{'type':Sequelize[_0xc3f7('0x2')]},'lastdata':{'type':Sequelize[_0xc3f7('0x8')]},'starttime':{'type':Sequelize[_0xc3f7('0x9')]},'systemanswertime':{'type':Sequelize[_0xc3f7('0x9')]},'answertime':{'type':Sequelize[_0xc3f7('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xc3f7('0xa')]},'billableseconds':{'type':Sequelize[_0xc3f7('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc3f7('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xc3f7('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc3f7('0x2')]},'note':{'type':Sequelize[_0xc3f7('0x2')]},'prefix':{'type':Sequelize[_0xc3f7('0x2')]},'routeid':{'type':Sequelize[_0xc3f7('0xa')]},'sipcallid':{'type':Sequelize[_0xc3f7('0x2')]}}; \ No newline at end of file +var _0x7fda=['DATE','INTEGER','sequelize','exports','ENUM','inbound','internal','outbound','outbound-fax','STRING','TEXT'];(function(_0x33199e,_0x428ded){var _0x2eef3c=function(_0x41a97a){while(--_0x41a97a){_0x33199e['push'](_0x33199e['shift']());}};_0x2eef3c(++_0x428ded);}(_0x7fda,0xf4));var _0xa7fd=function(_0x4d2cb6,_0x593d26){_0x4d2cb6=_0x4d2cb6-0x0;var _0x26e1f4=_0x7fda[_0x4d2cb6];return _0x26e1f4;};'use strict';var Sequelize=require(_0xa7fd('0x0'));module[_0xa7fd('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa7fd('0x2')](_0xa7fd('0x3'),_0xa7fd('0x4'),_0xa7fd('0x5'),'inbound-fax',_0xa7fd('0x6'),'dialer')},'tag':{'type':Sequelize[_0xa7fd('0x7')]},'accountcode':{'type':Sequelize[_0xa7fd('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xa7fd('0x7')]},'destinationcontext':{'type':Sequelize[_0xa7fd('0x7')]},'callerid':{'type':Sequelize[_0xa7fd('0x7')]},'channel':{'type':Sequelize[_0xa7fd('0x7')]},'destinationchannel':{'type':Sequelize[_0xa7fd('0x7')]},'lastapplication':{'type':Sequelize[_0xa7fd('0x7')]},'lastdata':{'type':Sequelize[_0xa7fd('0x8')]},'starttime':{'type':Sequelize[_0xa7fd('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa7fd('0x9')]},'endtime':{'type':Sequelize[_0xa7fd('0x9')]},'duration':{'type':Sequelize[_0xa7fd('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa7fd('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa7fd('0x7')]},'amaflags':{'type':Sequelize[_0xa7fd('0x7')]},'userfield':{'type':Sequelize[_0xa7fd('0x7')]},'userDisposition':{'type':Sequelize[_0xa7fd('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xa7fd('0x7')]},'note':{'type':Sequelize[_0xa7fd('0x7')]},'prefix':{'type':Sequelize[_0xa7fd('0x7')]},'routeid':{'type':Sequelize[_0xa7fd('0xa')]},'sipcallid':{'type':Sequelize[_0xa7fd('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index f900fe9..375a39a 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 _0x486e=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceCallReport','include','fullname','alias','User','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','body','describe','user','uniqueid','api','../../mysqldb','promise-retry','status','offset','undefined','limit','count','json','update','then','destroy','end','name','send','map','fieldName','key','query'];(function(_0x509024,_0x5e6c3d){var _0x5c36e8=function(_0x595c7c){while(--_0x595c7c){_0x509024['push'](_0x509024['shift']());}};_0x5c36e8(++_0x5e6c3d);}(_0x486e,0x89));var _0xe486=function(_0x1aa181,_0x41210f){_0x1aa181=_0x1aa181-0x0;var _0x52d5ac=_0x486e[_0x1aa181];return _0x52d5ac;};'use strict';var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe486('0x0'));var db=require(_0xe486('0x1'))['db'];const promiseRetry=require(_0xe486('0x2'));function respondWithResult(_0x392d26,_0x4fc97d){_0x4fc97d=_0x4fc97d||0xc8;return function(_0x5621c9){if(_0x5621c9){return _0x392d26[_0xe486('0x3')](_0x4fc97d)['json'](_0x5621c9);}};}function respondWithFilteredResult(_0x22f4b5,_0x5a3480){return function(_0x1c596e){if(_0x1c596e){var _0x2138db=typeof _0x5a3480[_0xe486('0x4')]===_0xe486('0x5')&&typeof _0x5a3480[_0xe486('0x6')]===_0xe486('0x5');var _0x1a30d2=_0x1c596e[_0xe486('0x7')];var _0x52e006=_0x2138db?0x0:_0x5a3480[_0xe486('0x4')];var _0x596a63=_0x2138db?_0x1c596e[_0xe486('0x7')]:_0x5a3480['offset']+_0x5a3480[_0xe486('0x6')];var _0x3ec3b0;if(_0x596a63>=_0x1a30d2){_0x596a63=_0x1a30d2;_0x3ec3b0=0xc8;}else{_0x3ec3b0=0xce;}_0x22f4b5[_0xe486('0x3')](_0x3ec3b0);return _0x22f4b5['set']('Content-Range',_0x52e006+'-'+_0x596a63+'/'+_0x1a30d2)[_0xe486('0x8')](_0x1c596e);}return null;};}function saveUpdates(_0x3b0895){return function(_0x2ee214){if(_0x2ee214){return _0x2ee214[_0xe486('0x9')](_0x3b0895)[_0xe486('0xa')](function(_0x135a5f){return _0x135a5f;});}return null;};}function removeEntity(_0x2ff2bb){return function(_0xd1c3bb){if(_0xd1c3bb){return _0xd1c3bb[_0xe486('0xb')]()[_0xe486('0xa')](function(){_0x2ff2bb[_0xe486('0x3')](0xcc)[_0xe486('0xc')]();});}};}function handleEntityNotFound(_0x42e83f){return function(_0x3fc25b){if(!_0x3fc25b){_0x42e83f['sendStatus'](0x194);}return _0x3fc25b;};}function handleError(_0x5677ed,_0x37140e){_0x37140e=_0x37140e||0x1f4;return function(_0x1f7a31){logger['error'](_0x1f7a31['stack']);if(_0x1f7a31[_0xe486('0xd')]){delete _0x1f7a31['name'];}_0x5677ed[_0xe486('0x3')](_0x37140e)[_0xe486('0xe')](_0x1f7a31);};}exports['index']=function(_0x42ec58,_0x960c41){var _0x3f8a87={},_0x55c5d6={},_0x5a40de={'count':0x0,'rows':[]};var _0x36bb33=_[_0xe486('0xf')](db['VoiceCallReport']['rawAttributes'],function(_0x472215){return{'name':_0x472215[_0xe486('0x10')],'type':_0x472215['type'][_0xe486('0x11')]};});_0x55c5d6['model']=_[_0xe486('0xf')](_0x36bb33,_0xe486('0xd'));_0x55c5d6[_0xe486('0x12')]=_['keys'](_0x42ec58[_0xe486('0x12')]);_0x55c5d6[_0xe486('0x13')]=_[_0xe486('0x14')](_0x55c5d6[_0xe486('0x15')],_0x55c5d6[_0xe486('0x12')]);_0x3f8a87['attributes']=_[_0xe486('0x14')](_0x55c5d6[_0xe486('0x15')],qs['fields'](_0x42ec58['query'][_0xe486('0x16')]));_0x3f8a87['attributes']=_0x3f8a87[_0xe486('0x17')][_0xe486('0x18')]?_0x3f8a87['attributes']:_0x55c5d6[_0xe486('0x15')];if(!_0x42ec58[_0xe486('0x12')][_0xe486('0x19')](_0xe486('0x1a'))){_0x3f8a87['limit']=qs[_0xe486('0x6')](_0x42ec58[_0xe486('0x12')][_0xe486('0x6')]);_0x3f8a87[_0xe486('0x4')]=qs['offset'](_0x42ec58[_0xe486('0x12')]['offset']);}_0x3f8a87[_0xe486('0x1b')]=qs[_0xe486('0x1c')](_0x42ec58['query'][_0xe486('0x1c')]);_0x3f8a87[_0xe486('0x1d')]=qs['filters'](_[_0xe486('0x1e')](_0x42ec58[_0xe486('0x12')],_0x55c5d6[_0xe486('0x13')]),_0x36bb33);if(_0x42ec58[_0xe486('0x12')][_0xe486('0x1f')]){_0x3f8a87[_0xe486('0x1d')]=_[_0xe486('0x20')](_0x3f8a87[_0xe486('0x1d')],{'$or':_[_0xe486('0xf')](_0x36bb33,function(_0x4dcb37){if(_0x4dcb37['type']!=='VIRTUAL'){var _0x1de61e={};_0x1de61e[_0x4dcb37[_0xe486('0xd')]]={'$like':'%'+_0x42ec58[_0xe486('0x12')][_0xe486('0x1f')]+'%'};return _0x1de61e;}})});}_0x3f8a87=_[_0xe486('0x20')]({},_0x3f8a87,_0x42ec58[_0xe486('0x21')]);var _0xfa0aaa={'where':_0x3f8a87[_0xe486('0x1d')]};return db[_0xe486('0x22')]['count'](_0xfa0aaa)['then'](function(_0xd7e7e7){_0x5a40de[_0xe486('0x7')]=_0xd7e7e7;if(_0x42ec58['query']['includeAll']){_0x3f8a87[_0xe486('0x23')]=[{'attributes':['id','name',_0xe486('0x24'),_0xe486('0x25')],'model':db[_0xe486('0x26')],'as':_0xe486('0x26')}];}return db[_0xe486('0x22')][_0xe486('0x27')](_0x3f8a87);})[_0xe486('0xa')](function(_0x2db37c){_0x5a40de[_0xe486('0x28')]=_0x2db37c;return _0x5a40de;})[_0xe486('0xa')](respondWithFilteredResult(_0x960c41,_0x3f8a87))['catch'](handleError(_0x960c41,null));};exports[_0xe486('0x29')]=function(_0x415e2b,_0x237bc2){var _0x4f933c={'raw':!![],'where':{'id':_0x415e2b[_0xe486('0x2a')]['id']}},_0x5f4273={};_0x5f4273[_0xe486('0x15')]=_[_0xe486('0x2b')](db[_0xe486('0x22')][_0xe486('0x2c')]);_0x5f4273[_0xe486('0x12')]=_[_0xe486('0x2b')](_0x415e2b[_0xe486('0x12')]);_0x5f4273[_0xe486('0x13')]=_['intersection'](_0x5f4273['model'],_0x5f4273[_0xe486('0x12')]);_0x4f933c[_0xe486('0x17')]=_[_0xe486('0x14')](_0x5f4273[_0xe486('0x15')],qs[_0xe486('0x16')](_0x415e2b[_0xe486('0x12')][_0xe486('0x16')]));_0x4f933c[_0xe486('0x17')]=_0x4f933c[_0xe486('0x17')][_0xe486('0x18')]?_0x4f933c[_0xe486('0x17')]:_0x5f4273[_0xe486('0x15')];if(_0x415e2b['query'][_0xe486('0x2d')]){_0x4f933c[_0xe486('0x23')]=[{'all':!![]}];}_0x4f933c=_[_0xe486('0x20')]({},_0x4f933c,_0x415e2b[_0xe486('0x21')]);return db[_0xe486('0x22')][_0xe486('0x2e')](_0x4f933c)[_0xe486('0xa')](handleEntityNotFound(_0x237bc2,null))[_0xe486('0xa')](respondWithResult(_0x237bc2,null))[_0xe486('0x2f')](handleError(_0x237bc2,null));};exports['create']=function(_0x451616,_0x204a66){return db[_0xe486('0x22')]['create'](_0x451616[_0xe486('0x30')],{})[_0xe486('0xa')](respondWithResult(_0x204a66,0xc9))[_0xe486('0x2f')](handleError(_0x204a66,null));};exports['destroy']=function(_0x1efba1,_0x41d623){return db[_0xe486('0x22')][_0xe486('0x2e')]({'where':{'id':_0x1efba1[_0xe486('0x2a')]['id']}})[_0xe486('0xa')](handleEntityNotFound(_0x41d623,null))[_0xe486('0xa')](removeEntity(_0x41d623,null))[_0xe486('0x2f')](handleError(_0x41d623,null));};exports[_0xe486('0x31')]=function(_0x3a0667,_0x498496){return db[_0xe486('0x22')][_0xe486('0x31')]()[_0xe486('0xa')](respondWithResult(_0x498496,null))[_0xe486('0x2f')](handleError(_0x498496,null));};function findForUpdate(_0x53cd9a){return db['VoiceCallReport'][_0xe486('0x2e')]({'where':{'uniqueid':_0x53cd9a['params']['id'],'UserId':{'$or':[null,_0x53cd9a[_0xe486('0x32')]['id']]}}});}exports['update']=function(_0x1f3d04,_0x596762){if(_0x1f3d04[_0xe486('0x30')][_0xe486('0x33')]){delete _0x1f3d04[_0xe486('0x30')][_0xe486('0x33')];}return findForUpdate(_0x1f3d04)[_0xe486('0xa')](handleEntityNotFound(_0x596762,null))['then'](saveUpdates(_0x1f3d04[_0xe486('0x30')],null))[_0xe486('0xa')](respondWithResult(_0x596762,null))[_0xe486('0x2f')](handleError(_0x596762,null));};exports['updateWithRetry']=function(_0x3242fd,_0x2bc2df,_0x3c17f8){if(_0x3242fd['body'][_0xe486('0x33')]){delete _0x3242fd[_0xe486('0x30')]['uniqueid'];}promiseRetry(function(){return findForUpdate(_0x3242fd);},{'retries':0x6,'minTimeout':0xfa})['then'](function(_0x3cabd9){if(!_0x3cabd9){return new Promise(function(_0x5d3d46){_0x5d3d46(handleEntityNotFound(_0x2bc2df)({'message':'No\x20such\x20Voice\x20Call\x20Report'}));});}else{return _0x3cabd9[_0xe486('0x9')](_0x3242fd['body'])[_0xe486('0xa')](function(_0x1d3ae1){return respondWithResult(_0x2bc2df)(_0x1d3ae1);});}},handleEntityNotFound(_0x2bc2df,null))[_0xe486('0x2f')](handleEntityNotFound(_0x2bc2df,null));}; \ No newline at end of file +var _0x1339=['attributes','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','fullname','alias','User','findAll','rows','catch','params','rawAttributes','merge','find','create','describe','user','body','uniqueid','updateWithRetry','No\x20such\x20Voice\x20Call\x20Report','../../config/logger','api','../../mysqldb','promise-retry','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','end','error','stack','name','send','VoiceCallReport','fieldName','key','query','keys','filters','intersection','model','fields'];(function(_0x4617c5,_0x259a0e){var _0x1cdb82=function(_0xe97146){while(--_0xe97146){_0x4617c5['push'](_0x4617c5['shift']());}};_0x1cdb82(++_0x259a0e);}(_0x1339,0x1ed));var _0x9133=function(_0x586a4e,_0x37fc2a){_0x586a4e=_0x586a4e-0x0;var _0x352a2d=_0x1339[_0x586a4e];return _0x352a2d;};'use strict';var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var db=require(_0x9133('0x2'))['db'];const promiseRetry=require(_0x9133('0x3'));function respondWithResult(_0x447096,_0x192d48){_0x192d48=_0x192d48||0xc8;return function(_0x176e80){if(_0x176e80){return _0x447096[_0x9133('0x4')](_0x192d48)['json'](_0x176e80);}};}function respondWithFilteredResult(_0x578643,_0x855473){return function(_0x379915){if(_0x379915){var _0x539af6=typeof _0x855473[_0x9133('0x5')]===_0x9133('0x6')&&typeof _0x855473[_0x9133('0x7')]===_0x9133('0x6');var _0x261698=_0x379915[_0x9133('0x8')];var _0x4294b7=_0x539af6?0x0:_0x855473[_0x9133('0x5')];var _0x10a9e4=_0x539af6?_0x379915[_0x9133('0x8')]:_0x855473['offset']+_0x855473[_0x9133('0x7')];var _0x3533fa;if(_0x10a9e4>=_0x261698){_0x10a9e4=_0x261698;_0x3533fa=0xc8;}else{_0x3533fa=0xce;}_0x578643[_0x9133('0x4')](_0x3533fa);return _0x578643[_0x9133('0x9')](_0x9133('0xa'),_0x4294b7+'-'+_0x10a9e4+'/'+_0x261698)[_0x9133('0xb')](_0x379915);}return null;};}function saveUpdates(_0x5ef6b5){return function(_0xb64550){if(_0xb64550){return _0xb64550[_0x9133('0xc')](_0x5ef6b5)['then'](function(_0x5283a3){return _0x5283a3;});}return null;};}function removeEntity(_0x10475c){return function(_0x4bf947){if(_0x4bf947){return _0x4bf947[_0x9133('0xd')]()[_0x9133('0xe')](function(){_0x10475c[_0x9133('0x4')](0xcc)[_0x9133('0xf')]();});}};}function handleEntityNotFound(_0x31847a){return function(_0x4327b3){if(!_0x4327b3){_0x31847a['sendStatus'](0x194);}return _0x4327b3;};}function handleError(_0x13f8fc,_0x1e23ce){_0x1e23ce=_0x1e23ce||0x1f4;return function(_0x4f4f14){logger[_0x9133('0x10')](_0x4f4f14[_0x9133('0x11')]);if(_0x4f4f14[_0x9133('0x12')]){delete _0x4f4f14[_0x9133('0x12')];}_0x13f8fc['status'](_0x1e23ce)[_0x9133('0x13')](_0x4f4f14);};}exports['index']=function(_0x3c48ef,_0x5d4a77){var _0x115ee8={},_0x1d6d0b={},_0x5e8620={'count':0x0,'rows':[]};var _0x38dd60=_['map'](db[_0x9133('0x14')]['rawAttributes'],function(_0x5e4f0c){return{'name':_0x5e4f0c[_0x9133('0x15')],'type':_0x5e4f0c['type'][_0x9133('0x16')]};});_0x1d6d0b['model']=_['map'](_0x38dd60,'name');_0x1d6d0b[_0x9133('0x17')]=_[_0x9133('0x18')](_0x3c48ef['query']);_0x1d6d0b[_0x9133('0x19')]=_[_0x9133('0x1a')](_0x1d6d0b[_0x9133('0x1b')],_0x1d6d0b[_0x9133('0x17')]);_0x115ee8['attributes']=_[_0x9133('0x1a')](_0x1d6d0b['model'],qs[_0x9133('0x1c')](_0x3c48ef[_0x9133('0x17')][_0x9133('0x1c')]));_0x115ee8[_0x9133('0x1d')]=_0x115ee8[_0x9133('0x1d')][_0x9133('0x1e')]?_0x115ee8[_0x9133('0x1d')]:_0x1d6d0b[_0x9133('0x1b')];if(!_0x3c48ef[_0x9133('0x17')][_0x9133('0x1f')]('nolimit')){_0x115ee8['limit']=qs[_0x9133('0x7')](_0x3c48ef[_0x9133('0x17')][_0x9133('0x7')]);_0x115ee8[_0x9133('0x5')]=qs['offset'](_0x3c48ef['query'][_0x9133('0x5')]);}_0x115ee8[_0x9133('0x20')]=qs[_0x9133('0x21')](_0x3c48ef[_0x9133('0x17')][_0x9133('0x21')]);_0x115ee8[_0x9133('0x22')]=qs['filters'](_['pick'](_0x3c48ef['query'],_0x1d6d0b[_0x9133('0x19')]),_0x38dd60);if(_0x3c48ef['query'][_0x9133('0x23')]){_0x115ee8[_0x9133('0x22')]=_['merge'](_0x115ee8[_0x9133('0x22')],{'$or':_['map'](_0x38dd60,function(_0xf0aec4){if(_0xf0aec4[_0x9133('0x24')]!==_0x9133('0x25')){var _0x5f1de2={};_0x5f1de2[_0xf0aec4[_0x9133('0x12')]]={'$like':'%'+_0x3c48ef[_0x9133('0x17')][_0x9133('0x23')]+'%'};return _0x5f1de2;}})});}_0x115ee8=_['merge']({},_0x115ee8,_0x3c48ef[_0x9133('0x26')]);var _0x3393a1={'where':_0x115ee8[_0x9133('0x22')]};return db['VoiceCallReport'][_0x9133('0x8')](_0x3393a1)[_0x9133('0xe')](function(_0x1b5700){_0x5e8620[_0x9133('0x8')]=_0x1b5700;if(_0x3c48ef['query'][_0x9133('0x27')]){_0x115ee8[_0x9133('0x28')]=[{'attributes':['id','name',_0x9133('0x29'),_0x9133('0x2a')],'model':db[_0x9133('0x2b')],'as':_0x9133('0x2b')}];}return db[_0x9133('0x14')][_0x9133('0x2c')](_0x115ee8);})[_0x9133('0xe')](function(_0x167e45){_0x5e8620[_0x9133('0x2d')]=_0x167e45;return _0x5e8620;})[_0x9133('0xe')](respondWithFilteredResult(_0x5d4a77,_0x115ee8))[_0x9133('0x2e')](handleError(_0x5d4a77,null));};exports['show']=function(_0x17bb4c,_0x2c2e16){var _0x5a676b={'raw':!![],'where':{'id':_0x17bb4c[_0x9133('0x2f')]['id']}},_0x1f2f8c={};_0x1f2f8c[_0x9133('0x1b')]=_[_0x9133('0x18')](db[_0x9133('0x14')][_0x9133('0x30')]);_0x1f2f8c['query']=_['keys'](_0x17bb4c[_0x9133('0x17')]);_0x1f2f8c[_0x9133('0x19')]=_[_0x9133('0x1a')](_0x1f2f8c[_0x9133('0x1b')],_0x1f2f8c[_0x9133('0x17')]);_0x5a676b[_0x9133('0x1d')]=_[_0x9133('0x1a')](_0x1f2f8c[_0x9133('0x1b')],qs[_0x9133('0x1c')](_0x17bb4c['query'][_0x9133('0x1c')]));_0x5a676b[_0x9133('0x1d')]=_0x5a676b[_0x9133('0x1d')][_0x9133('0x1e')]?_0x5a676b[_0x9133('0x1d')]:_0x1f2f8c['model'];if(_0x17bb4c[_0x9133('0x17')][_0x9133('0x27')]){_0x5a676b[_0x9133('0x28')]=[{'all':!![]}];}_0x5a676b=_[_0x9133('0x31')]({},_0x5a676b,_0x17bb4c['options']);return db[_0x9133('0x14')][_0x9133('0x32')](_0x5a676b)[_0x9133('0xe')](handleEntityNotFound(_0x2c2e16,null))[_0x9133('0xe')](respondWithResult(_0x2c2e16,null))[_0x9133('0x2e')](handleError(_0x2c2e16,null));};exports[_0x9133('0x33')]=function(_0x3b2287,_0x4ca1a3){return db[_0x9133('0x14')]['create'](_0x3b2287['body'],{})[_0x9133('0xe')](respondWithResult(_0x4ca1a3,0xc9))[_0x9133('0x2e')](handleError(_0x4ca1a3,null));};exports[_0x9133('0xd')]=function(_0x264df4,_0xdd485f){return db[_0x9133('0x14')][_0x9133('0x32')]({'where':{'id':_0x264df4[_0x9133('0x2f')]['id']}})[_0x9133('0xe')](handleEntityNotFound(_0xdd485f,null))['then'](removeEntity(_0xdd485f,null))[_0x9133('0x2e')](handleError(_0xdd485f,null));};exports[_0x9133('0x34')]=function(_0x2928bd,_0x597434){return db['VoiceCallReport'][_0x9133('0x34')]()[_0x9133('0xe')](respondWithResult(_0x597434,null))['catch'](handleError(_0x597434,null));};function findForUpdate(_0x28d281){return db[_0x9133('0x14')][_0x9133('0x32')]({'where':{'uniqueid':_0x28d281[_0x9133('0x2f')]['id'],'UserId':{'$or':[null,_0x28d281[_0x9133('0x35')]['id']]}}});}exports['update']=function(_0x2901fa,_0x4423b4){if(_0x2901fa[_0x9133('0x36')]['uniqueid']){delete _0x2901fa[_0x9133('0x36')][_0x9133('0x37')];}return findForUpdate(_0x2901fa)['then'](handleEntityNotFound(_0x4423b4,null))['then'](saveUpdates(_0x2901fa[_0x9133('0x36')],null))[_0x9133('0xe')](respondWithResult(_0x4423b4,null))[_0x9133('0x2e')](handleError(_0x4423b4,null));};exports[_0x9133('0x38')]=function(_0x3fe9bb,_0xe31c84,_0xe065c4){if(_0x3fe9bb[_0x9133('0x36')][_0x9133('0x37')]){delete _0x3fe9bb[_0x9133('0x36')][_0x9133('0x37')];}promiseRetry(function(){return findForUpdate(_0x3fe9bb);},{'retries':0x6,'minTimeout':0xfa})[_0x9133('0xe')](function(_0x4f3092){if(!_0x4f3092){return new Promise(function(_0x4dc5ee){_0x4dc5ee(handleEntityNotFound(_0xe31c84,null)({'message':_0x9133('0x39')}));});}else{return _0x4f3092['update'](_0x3fe9bb[_0x9133('0x36')])[_0x9133('0xe')](function(_0x6fbb11){return respondWithResult(_0xe31c84)(_0x6fbb11);});}},function(){handleEntityNotFound(_0xe31c84)();})[_0x9133('0x2e')](function(){handleEntityNotFound(_0xe31c84)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 42b07b7..08b59ce 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 _0xb9fd=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x28f2da,_0x52b7d6){var _0x1c3044=function(_0x27b3c3){while(--_0x27b3c3){_0x28f2da['push'](_0x28f2da['shift']());}};_0x1c3044(++_0x52b7d6);}(_0xb9fd,0x149));var _0xdb9f=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xb9fd[_0x648163];return _0x199d4d;};'use strict';var _=require(_0xdb9f('0x0'));var util=require(_0xdb9f('0x1'));var logger=require('../../config/logger')(_0xdb9f('0x2'));var moment=require(_0xdb9f('0x3'));var BPromise=require(_0xdb9f('0x4'));var rp=require(_0xdb9f('0x5'));var fs=require('fs');var path=require(_0xdb9f('0x6'));var rimraf=require(_0xdb9f('0x7'));var config=require(_0xdb9f('0x8'));var attributes=require(_0xdb9f('0x9'));module[_0xdb9f('0xa')]=function(_0xac4ef7,_0x200e46){return _0xac4ef7[_0xdb9f('0xb')](_0xdb9f('0xc'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xdb9f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc17=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34e939,_0x26bc81){var _0xcb77df=function(_0x453d0f){while(--_0x453d0f){_0x34e939['push'](_0x34e939['shift']());}};_0xcb77df(++_0x26bc81);}(_0xcc17,0x174));var _0x7cc1=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0xcc17[_0xcd0918];return _0x250704;};'use strict';var _=require(_0x7cc1('0x0'));var util=require(_0x7cc1('0x1'));var logger=require(_0x7cc1('0x2'))(_0x7cc1('0x3'));var moment=require(_0x7cc1('0x4'));var BPromise=require(_0x7cc1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7cc1('0x6'));var config=require(_0x7cc1('0x7'));var attributes=require(_0x7cc1('0x8'));module[_0x7cc1('0x9')]=function(_0x28d630,_0x54a6cc){return _0x28d630[_0x7cc1('0xa')](_0x7cc1('0xb'),attributes,{'tableName':_0x7cc1('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7cc1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 354691f..b508d6a 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 _0x2d7b=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport'];(function(_0x2fbdf8,_0x4a91ca){var _0x3ac8b3=function(_0x4c93bb){while(--_0x4c93bb){_0x2fbdf8['push'](_0x2fbdf8['shift']());}};_0x3ac8b3(++_0x4a91ca);}(_0x2d7b,0x1b8));var _0xb2d7=function(_0x4f8661,_0x18bdf4){_0x4f8661=_0x4f8661-0x0;var _0x2484ba=_0x2d7b[_0x4f8661];return _0x2484ba;};'use strict';var _=require(_0xb2d7('0x0'));var util=require('util');var moment=require(_0xb2d7('0x1'));var BPromise=require(_0xb2d7('0x2'));var rs=require(_0xb2d7('0x3'));var fs=require('fs');var Redis=require(_0xb2d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2d7('0x5'));var logger=require(_0xb2d7('0x6'))(_0xb2d7('0x7'));var config=require(_0xb2d7('0x8'));var jayson=require(_0xb2d7('0x9'));var client=jayson[_0xb2d7('0xa')][_0xb2d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fff70,_0x4cc945,_0x1a9780){return new BPromise(function(_0x32e131,_0x3ba0f2){return client[_0xb2d7('0xc')](_0x2fff70,_0x1a9780)[_0xb2d7('0xd')](function(_0x493574){logger[_0xb2d7('0xe')](_0xb2d7('0xf'),_0x4cc945,'request\x20sent');logger[_0xb2d7('0x10')](_0xb2d7('0x11'),_0x4cc945,_0xb2d7('0x12'),JSON[_0xb2d7('0x13')](_0x493574));if(_0x493574[_0xb2d7('0x14')]){if(_0x493574[_0xb2d7('0x14')][_0xb2d7('0x15')]===0x1f4){logger['error'](_0xb2d7('0xf'),_0x4cc945,_0x493574[_0xb2d7('0x14')][_0xb2d7('0x16')]);return _0x3ba0f2(_0x493574[_0xb2d7('0x14')]['message']);}logger['error'](_0xb2d7('0xf'),_0x4cc945,_0x493574['error']['message']);return _0x32e131(_0x493574[_0xb2d7('0x14')][_0xb2d7('0x16')]);}else{logger[_0xb2d7('0xe')](_0xb2d7('0xf'),_0x4cc945,_0xb2d7('0x12'));_0x32e131(_0x493574[_0xb2d7('0x17')][_0xb2d7('0x16')]);}})[_0xb2d7('0x18')](function(_0x2b627c){logger[_0xb2d7('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x4cc945,_0x2b627c);_0x3ba0f2(_0x2b627c);});});}exports['GetVoiceCallReport']=function(_0x59dcd7){var _0x19dfdf=this;return new Promise(function(_0xf97e3d,_0x458622){return db[_0xb2d7('0x19')][_0xb2d7('0x1a')]({'raw':_0x59dcd7[_0xb2d7('0x1b')]?_0x59dcd7[_0xb2d7('0x1b')][_0xb2d7('0x1c')]===undefined?!![]:![]:!![],'where':_0x59dcd7[_0xb2d7('0x1b')]?_0x59dcd7[_0xb2d7('0x1b')][_0xb2d7('0x1d')]||null:null,'attributes':_0x59dcd7[_0xb2d7('0x1b')]?_0x59dcd7[_0xb2d7('0x1b')][_0xb2d7('0x1e')]||null:null,'limit':_0x59dcd7[_0xb2d7('0x1b')]?_0x59dcd7['options'][_0xb2d7('0x1f')]||null:null,'include':_0x59dcd7[_0xb2d7('0x1b')]?_0x59dcd7[_0xb2d7('0x1b')][_0xb2d7('0x20')]?_[_0xb2d7('0x21')](_0x59dcd7[_0xb2d7('0x1b')]['include'],function(_0x59b8d0){return{'model':db[_0x59b8d0[_0xb2d7('0x22')]],'as':_0x59b8d0['as'],'attributes':_0x59b8d0[_0xb2d7('0x1e')],'include':_0x59b8d0['include']?_['map'](_0x59b8d0[_0xb2d7('0x20')],function(_0x17656b){return{'model':db[_0x17656b[_0xb2d7('0x22')]],'as':_0x17656b['as'],'attributes':_0x17656b[_0xb2d7('0x1e')],'include':_0x17656b['include']?_[_0xb2d7('0x21')](_0x17656b['include'],function(_0x602b95){return{'model':db[_0x602b95[_0xb2d7('0x22')]],'as':_0x602b95['as'],'attributes':_0x602b95[_0xb2d7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb2d7('0xd')](function(_0xbf95ff){logger[_0xb2d7('0xe')](_0xb2d7('0x23'),_0x59dcd7);logger[_0xb2d7('0x10')]('GetVoiceCallReport',_0x59dcd7,JSON['stringify'](_0xbf95ff));_0xf97e3d(_0xbf95ff);})['catch'](function(_0x591cea){logger[_0xb2d7('0x14')](_0xb2d7('0x23'),_0x591cea[_0xb2d7('0x16')],_0x59dcd7);_0x458622(_0x19dfdf['error'](0x1f4,_0x591cea[_0xb2d7('0x16')]));});});};exports[_0xb2d7('0x24')]=function(_0x115579){var _0x366b55=this;return new Promise(function(_0x2ded48,_0x2ebe4e){return db['VoiceCallReport'][_0xb2d7('0x25')](_0x115579[_0xb2d7('0x26')],{'raw':_0x115579[_0xb2d7('0x1b')]?_0x115579['options'][_0xb2d7('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x58f110){logger[_0xb2d7('0xe')](_0xb2d7('0x24'),_0x115579);logger['debug']('CreateVoiceCallReport',_0x115579,JSON[_0xb2d7('0x13')](_0x58f110));_0x2ded48(_0x58f110);})[_0xb2d7('0x18')](function(_0x271a13){logger[_0xb2d7('0x14')](_0xb2d7('0x24'),_0x271a13['message'],_0x115579);_0x2ebe4e(_0x366b55['error'](0x1f4,_0x271a13[_0xb2d7('0x16')]));});});};exports['UpdateVoiceCallReport']=function(_0x2d62e8){var _0x35fa68=this;return new Promise(function(_0x4fd194,_0xc67525){return db[_0xb2d7('0x19')]['update'](_0x2d62e8[_0xb2d7('0x26')],{'raw':_0x2d62e8['options']?_0x2d62e8[_0xb2d7('0x1b')][_0xb2d7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d62e8[_0xb2d7('0x1b')]?_0x2d62e8['options'][_0xb2d7('0x1d')]||null:null,'attributes':_0x2d62e8[_0xb2d7('0x1b')]?_0x2d62e8[_0xb2d7('0x1b')][_0xb2d7('0x1e')]||null:null,'limit':_0x2d62e8['options']?_0x2d62e8['options'][_0xb2d7('0x1f')]||null:null})[_0xb2d7('0xd')](function(_0xdd59dd){logger[_0xb2d7('0xe')]('UpdateVoiceCallReport',_0x2d62e8);logger[_0xb2d7('0x10')](_0xb2d7('0x27'),_0x2d62e8,JSON[_0xb2d7('0x13')](_0xdd59dd));_0x4fd194(_0xdd59dd);})[_0xb2d7('0x18')](function(_0x1345b4){logger[_0xb2d7('0x14')](_0xb2d7('0x27'),_0x1345b4[_0xb2d7('0x16')],_0x2d62e8);_0xc67525(_0x35fa68['error'](0x1f4,_0x1345b4[_0xb2d7('0x16')]));});});}; \ No newline at end of file +var _0xce3e=['request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceCallReport','create','body','update','limit','UpdateVoiceCallReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x425541,_0x5dec0e){var _0x455616=function(_0x28e721){while(--_0x28e721){_0x425541['push'](_0x425541['shift']());}};_0x455616(++_0x5dec0e);}(_0xce3e,0x1be));var _0xece3=function(_0x28db62,_0xfe11c1){_0x28db62=_0x28db62-0x0;var _0xbc95be=_0xce3e[_0x28db62];return _0xbc95be;};'use strict';var _=require('lodash');var util=require(_0xece3('0x0'));var moment=require(_0xece3('0x1'));var BPromise=require(_0xece3('0x2'));var rs=require(_0xece3('0x3'));var fs=require('fs');var Redis=require(_0xece3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xece3('0x5'));var logger=require(_0xece3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xece3('0x7'));var client=jayson[_0xece3('0x8')][_0xece3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58a52e,_0x593726,_0x31fb4f){return new BPromise(function(_0x18499d,_0x141c6c){return client[_0xece3('0xa')](_0x58a52e,_0x31fb4f)[_0xece3('0xb')](function(_0x5a9fd0){logger[_0xece3('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x593726,_0xece3('0xd'));logger[_0xece3('0xe')](_0xece3('0xf'),_0x593726,_0xece3('0xd'),JSON[_0xece3('0x10')](_0x5a9fd0));if(_0x5a9fd0[_0xece3('0x11')]){if(_0x5a9fd0['error']['code']===0x1f4){logger[_0xece3('0x11')](_0xece3('0x12'),_0x593726,_0x5a9fd0[_0xece3('0x11')][_0xece3('0x13')]);return _0x141c6c(_0x5a9fd0['error'][_0xece3('0x13')]);}logger['error'](_0xece3('0x12'),_0x593726,_0x5a9fd0[_0xece3('0x11')][_0xece3('0x13')]);return _0x18499d(_0x5a9fd0[_0xece3('0x11')][_0xece3('0x13')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x593726,_0xece3('0xd'));_0x18499d(_0x5a9fd0[_0xece3('0x14')][_0xece3('0x13')]);}})[_0xece3('0x15')](function(_0x2f6ff9){logger[_0xece3('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x593726,_0x2f6ff9);_0x141c6c(_0x2f6ff9);});});}exports[_0xece3('0x16')]=function(_0x2964d9){var _0x10709c=this;return new Promise(function(_0x36133c,_0x14260e){return db[_0xece3('0x17')][_0xece3('0x18')]({'raw':_0x2964d9[_0xece3('0x19')]?_0x2964d9[_0xece3('0x19')][_0xece3('0x1a')]===undefined?!![]:![]:!![],'where':_0x2964d9[_0xece3('0x19')]?_0x2964d9[_0xece3('0x19')][_0xece3('0x1b')]||null:null,'attributes':_0x2964d9[_0xece3('0x19')]?_0x2964d9[_0xece3('0x19')][_0xece3('0x1c')]||null:null,'limit':_0x2964d9[_0xece3('0x19')]?_0x2964d9[_0xece3('0x19')]['limit']||null:null,'include':_0x2964d9[_0xece3('0x19')]?_0x2964d9['options'][_0xece3('0x1d')]?_[_0xece3('0x1e')](_0x2964d9[_0xece3('0x19')][_0xece3('0x1d')],function(_0x115e50){return{'model':db[_0x115e50[_0xece3('0x1f')]],'as':_0x115e50['as'],'attributes':_0x115e50[_0xece3('0x1c')],'include':_0x115e50[_0xece3('0x1d')]?_['map'](_0x115e50['include'],function(_0x400113){return{'model':db[_0x400113[_0xece3('0x1f')]],'as':_0x400113['as'],'attributes':_0x400113[_0xece3('0x1c')],'include':_0x400113[_0xece3('0x1d')]?_[_0xece3('0x1e')](_0x400113[_0xece3('0x1d')],function(_0x53db19){return{'model':db[_0x53db19['model']],'as':_0x53db19['as'],'attributes':_0x53db19['attributes']};}):[]};}):[]};}):[]:[]})[_0xece3('0xb')](function(_0x467c42){logger[_0xece3('0xc')](_0xece3('0x16'),_0x2964d9);logger['debug']('GetVoiceCallReport',_0x2964d9,JSON['stringify'](_0x467c42));_0x36133c(_0x467c42);})[_0xece3('0x15')](function(_0x450ea3){logger[_0xece3('0x11')](_0xece3('0x16'),_0x450ea3['message'],_0x2964d9);_0x14260e(_0x10709c[_0xece3('0x11')](0x1f4,_0x450ea3['message']));});});};exports[_0xece3('0x20')]=function(_0xa4bccb){var _0x2d61d2=this;return new Promise(function(_0x6b5604,_0x290836){return db['VoiceCallReport'][_0xece3('0x21')](_0xa4bccb[_0xece3('0x22')],{'raw':_0xa4bccb[_0xece3('0x19')]?_0xa4bccb[_0xece3('0x19')][_0xece3('0x1a')]===undefined?!![]:![]:!![]})[_0xece3('0xb')](function(_0x2b7e6d){logger['info'](_0xece3('0x20'),_0xa4bccb);logger[_0xece3('0xe')](_0xece3('0x20'),_0xa4bccb,JSON[_0xece3('0x10')](_0x2b7e6d));_0x6b5604(_0x2b7e6d);})[_0xece3('0x15')](function(_0x355dbf){logger[_0xece3('0x11')](_0xece3('0x20'),_0x355dbf[_0xece3('0x13')],_0xa4bccb);_0x290836(_0x2d61d2[_0xece3('0x11')](0x1f4,_0x355dbf[_0xece3('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0xf6e601){var _0x173aa4=this;return new Promise(function(_0x4b3ff2,_0x190c64){return db['VoiceCallReport'][_0xece3('0x23')](_0xf6e601[_0xece3('0x22')],{'raw':_0xf6e601[_0xece3('0x19')]?_0xf6e601['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf6e601['options']?_0xf6e601[_0xece3('0x19')]['where']||null:null,'attributes':_0xf6e601[_0xece3('0x19')]?_0xf6e601[_0xece3('0x19')][_0xece3('0x1c')]||null:null,'limit':_0xf6e601['options']?_0xf6e601[_0xece3('0x19')][_0xece3('0x24')]||null:null})[_0xece3('0xb')](function(_0x332fcf){logger[_0xece3('0xc')](_0xece3('0x25'),_0xf6e601);logger[_0xece3('0xe')](_0xece3('0x25'),_0xf6e601,JSON[_0xece3('0x10')](_0x332fcf));_0x4b3ff2(_0x332fcf);})[_0xece3('0x15')](function(_0x40960a){logger[_0xece3('0x11')](_0xece3('0x25'),_0x40960a[_0xece3('0x13')],_0xf6e601);_0x190c64(_0x173aa4[_0xece3('0x11')](0x1f4,_0x40960a[_0xece3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 975f423..cf1288b 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 _0xfd1a=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','update','delete'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xfd1a,0xda));var _0xafd1=function(_0x138d1d,_0x245af7){_0x138d1d=_0x138d1d-0x0;var _0x342708=_0xfd1a[_0x138d1d];return _0x342708;};'use strict';var multer=require('multer');var util=require(_0xafd1('0x0'));var path=require(_0xafd1('0x1'));var timeout=require(_0xafd1('0x2'));var express=require('express');var router=express[_0xafd1('0x3')]();var fs_extra=require(_0xafd1('0x4'));var auth=require(_0xafd1('0x5'));var interaction=require(_0xafd1('0x6'));var config=require(_0xafd1('0x7'));var controller=require('./voiceChanSpy.controller');router[_0xafd1('0x8')]('/',auth['isAuthenticated'](),controller[_0xafd1('0x9')]);router[_0xafd1('0x8')](_0xafd1('0xa'),auth[_0xafd1('0xb')](),controller[_0xafd1('0xc')]);router[_0xafd1('0xd')]('/',auth[_0xafd1('0xb')](),controller['create']);router['put'](_0xafd1('0xa'),auth[_0xafd1('0xb')](),controller[_0xafd1('0xe')]);router[_0xafd1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xafd1('0x10')]);module[_0xafd1('0x11')]=router; \ No newline at end of file +var _0x21bd=['update','delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','create'];(function(_0x33abb4,_0x24d426){var _0x2b3661=function(_0x3ec907){while(--_0x3ec907){_0x33abb4['push'](_0x33abb4['shift']());}};_0x2b3661(++_0x24d426);}(_0x21bd,0x1b4));var _0xd21b=function(_0x235215,_0x2cd57b){_0x235215=_0x235215-0x0;var _0x227dfb=_0x21bd[_0x235215];return _0x227dfb;};'use strict';var multer=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var path=require(_0xd21b('0x2'));var timeout=require(_0xd21b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd21b('0x4'));var auth=require(_0xd21b('0x5'));var interaction=require(_0xd21b('0x6'));var config=require(_0xd21b('0x7'));var controller=require(_0xd21b('0x8'));router[_0xd21b('0x9')]('/',auth[_0xd21b('0xa')](),controller[_0xd21b('0xb')]);router[_0xd21b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd21b('0xc')]);router['post']('/',auth[_0xd21b('0xa')](),controller[_0xd21b('0xd')]);router['put']('/:id',auth[_0xd21b('0xa')](),controller[_0xd21b('0xe')]);router[_0xd21b('0xf')](_0xd21b('0x10'),auth[_0xd21b('0xa')](),controller['destroy']);module[_0xd21b('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1564ece..75681c5 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 _0x2428=['BOOLEAN','STRING','sequelize','name','setDataValue','join','getDataValue','options','split'];(function(_0x365de6,_0x3f7e16){var _0xc448f4=function(_0x356078){while(--_0x356078){_0x365de6['push'](_0x365de6['shift']());}};_0xc448f4(++_0x3f7e16);}(_0x2428,0xe3));var _0x8242=function(_0x1e2600,_0x252e71){_0x1e2600=_0x1e2600-0x0;var _0x5e4423=_0x2428[_0x1e2600];return _0x5e4423;};'use strict';var Sequelize=require(_0x8242('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x8242('0x1'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x59e855){this[_0x8242('0x2')]('options',_0x59e855?_0x59e855[_0x8242('0x3')](''):[]);},'get':function(){return this[_0x8242('0x4')](_0x8242('0x5'))?this[_0x8242('0x4')](_0x8242('0x5'))[_0x8242('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x8242('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8242('0x8')]}}; \ No newline at end of file +var _0x9dbf=['exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x3ee322,_0x186ee5){var _0x188de7=function(_0x527177){while(--_0x527177){_0x3ee322['push'](_0x3ee322['shift']());}};_0x188de7(++_0x186ee5);}(_0x9dbf,0x118));var _0xf9db=function(_0x34f94d,_0x7dc959){_0x34f94d=_0x34f94d-0x0;var _0x111dd8=_0x9dbf[_0x34f94d];return _0x111dd8;};'use strict';var Sequelize=require('sequelize');module[_0xf9db('0x0')]={'name':{'type':Sequelize[_0xf9db('0x1')]},'prefix':{'type':Sequelize[_0xf9db('0x1')],'unique':_0xf9db('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x216e9e){this['setDataValue'](_0xf9db('0x3'),_0x216e9e?_0x216e9e[_0xf9db('0x4')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xf9db('0x5')](_0xf9db('0x3'))[_0xf9db('0x6')](''):[];}},'auth':{'type':Sequelize[_0xf9db('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xf9db('0x1')]},'record':{'type':Sequelize[_0xf9db('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf9db('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a61d5fb..28ce7b5 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 _0xf290=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','ChanSpies','UserProfileResource','error','stack','name','send','map','key','keys','query','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','type','VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4e82f6,_0x3a1b7d){var _0x2ec7da=function(_0x55ef91){while(--_0x55ef91){_0x4e82f6['push'](_0x4e82f6['shift']());}};_0x2ec7da(++_0x3a1b7d);}(_0xf290,0xde));var _0x0f29=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0xf290[_0x179c4a];return _0x5d1879;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f29('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f29('0x1'));var rp=require('request-promise');var moment=require(_0x0f29('0x2'));var BPromise=require(_0x0f29('0x3'));var Mustache=require(_0x0f29('0x4'));var util=require(_0x0f29('0x5'));var path=require(_0x0f29('0x6'));var sox=require('sox');var csv=require(_0x0f29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f29('0x8'));var _=require(_0x0f29('0x9'));var squel=require(_0x0f29('0xa'));var crypto=require(_0x0f29('0xb'));var jsforce=require(_0x0f29('0xc'));var deskjs=require(_0x0f29('0xd'));var toCsv=require(_0x0f29('0x7'));var querystring=require(_0x0f29('0xe'));var Papa=require(_0x0f29('0xf'));var Redis=require(_0x0f29('0x10'));var authService=require(_0x0f29('0x11'));var qs=require(_0x0f29('0x12'));var as=require(_0x0f29('0x13'));var hardwareService=require(_0x0f29('0x14'));var logger=require(_0x0f29('0x15'))('api');var utils=require(_0x0f29('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0f29('0x17'));var db=require(_0x0f29('0x18'))['db'];function respondWithStatusCode(_0x26bbec,_0x222c42){_0x222c42=_0x222c42||0xcc;return function(_0x195424){if(_0x195424){return _0x26bbec[_0x0f29('0x19')](_0x222c42);}return _0x26bbec['status'](_0x222c42)[_0x0f29('0x1a')]();};}function respondWithResult(_0x39961f,_0x2bb7b8){_0x2bb7b8=_0x2bb7b8||0xc8;return function(_0x368984){if(_0x368984){return _0x39961f[_0x0f29('0x1b')](_0x2bb7b8)[_0x0f29('0x1c')](_0x368984);}};}function respondWithFilteredResult(_0x1c518,_0x69df36){return function(_0x547404){if(_0x547404){var _0x4ac37d=typeof _0x69df36[_0x0f29('0x1d')]===_0x0f29('0x1e')&&typeof _0x69df36[_0x0f29('0x1f')]===_0x0f29('0x1e');var _0x4b3f0b=_0x547404[_0x0f29('0x20')];var _0x5d72a5=_0x4ac37d?0x0:_0x69df36[_0x0f29('0x1d')];var _0x4ca5e8=_0x4ac37d?_0x547404['count']:_0x69df36['offset']+_0x69df36[_0x0f29('0x1f')];var _0x8fc03f;if(_0x4ca5e8>=_0x4b3f0b){_0x4ca5e8=_0x4b3f0b;_0x8fc03f=0xc8;}else{_0x8fc03f=0xce;}_0x1c518[_0x0f29('0x1b')](_0x8fc03f);return _0x1c518[_0x0f29('0x21')](_0x0f29('0x22'),_0x5d72a5+'-'+_0x4ca5e8+'/'+_0x4b3f0b)[_0x0f29('0x1c')](_0x547404);}return null;};}function patchUpdates(_0x150271){return function(_0x4888b6){try{jsonpatch[_0x0f29('0x23')](_0x4888b6,_0x150271,!![]);}catch(_0x5a5a03){return BPromise['reject'](_0x5a5a03);}return _0x4888b6['save']();};}function saveUpdates(_0x5d94b9,_0x38a1ce){return function(_0x4a9dd8){if(_0x4a9dd8){return _0x4a9dd8['update'](_0x5d94b9)[_0x0f29('0x24')](function(_0x1840e0){return _0x1840e0;});}return null;};}function removeEntity(_0x346db8,_0x3402dc){return function(_0x29ca73){if(_0x29ca73){return _0x29ca73['destroy']()[_0x0f29('0x24')](function(){var _0x5a440f=_0x29ca73[_0x0f29('0x25')]({'plain':!![]});var _0x26f46f=_0x0f29('0x26');return db[_0x0f29('0x27')]['destroy']({'where':{'type':_0x26f46f,'resourceId':_0x5a440f['id']}})[_0x0f29('0x24')](function(){return _0x29ca73;});})['then'](function(){_0x346db8['status'](0xcc)[_0x0f29('0x1a')]();});}};}function handleEntityNotFound(_0x5c0202,_0x5bfcac){return function(_0x57dcc7){if(!_0x57dcc7){_0x5c0202['sendStatus'](0x194);}return _0x57dcc7;};}function handleError(_0x3c6ce9,_0x1f4ad2){_0x1f4ad2=_0x1f4ad2||0x1f4;return function(_0x4cc5a0){logger[_0x0f29('0x28')](_0x4cc5a0[_0x0f29('0x29')]);if(_0x4cc5a0[_0x0f29('0x2a')]){delete _0x4cc5a0['name'];}_0x3c6ce9['status'](_0x1f4ad2)[_0x0f29('0x2b')](_0x4cc5a0);};}exports['index']=function(_0x36b65c,_0x561c31){var _0x526364={},_0x7b10f={},_0x409b19={'count':0x0,'rows':[]};var _0xf59431=_[_0x0f29('0x2c')](db['VoiceChanSpy']['rawAttributes'],function(_0x3bb3c8){return{'name':_0x3bb3c8['fieldName'],'type':_0x3bb3c8['type'][_0x0f29('0x2d')]};});_0x7b10f['model']=_[_0x0f29('0x2c')](_0xf59431,'name');_0x7b10f['query']=_[_0x0f29('0x2e')](_0x36b65c[_0x0f29('0x2f')]);_0x7b10f[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x7b10f[_0x0f29('0x32')],_0x7b10f['query']);_0x526364[_0x0f29('0x33')]=_['intersection'](_0x7b10f[_0x0f29('0x32')],qs[_0x0f29('0x34')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x34')]));_0x526364['attributes']=_0x526364[_0x0f29('0x33')][_0x0f29('0x35')]?_0x526364['attributes']:_0x7b10f[_0x0f29('0x32')];if(!_0x36b65c[_0x0f29('0x2f')]['hasOwnProperty']('nolimit')){_0x526364[_0x0f29('0x1f')]=qs[_0x0f29('0x1f')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x1f')]);_0x526364[_0x0f29('0x1d')]=qs[_0x0f29('0x1d')](_0x36b65c['query'][_0x0f29('0x1d')]);}_0x526364['order']=qs[_0x0f29('0x36')](_0x36b65c['query'][_0x0f29('0x36')]);_0x526364[_0x0f29('0x37')]=qs[_0x0f29('0x30')](_['pick'](_0x36b65c['query'],_0x7b10f[_0x0f29('0x30')]),_0xf59431);if(_0x36b65c['query'][_0x0f29('0x38')]){_0x526364[_0x0f29('0x37')]=_[_0x0f29('0x39')](_0x526364[_0x0f29('0x37')],{'$or':_[_0x0f29('0x2c')](_0xf59431,function(_0x5afbb8){if(_0x5afbb8[_0x0f29('0x3a')]!==_0x0f29('0x3b')){var _0x42872b={};_0x42872b[_0x5afbb8[_0x0f29('0x2a')]]={'$like':'%'+_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x38')]+'%'};return _0x42872b;}})});}_0x526364=_[_0x0f29('0x39')]({},_0x526364,_0x36b65c[_0x0f29('0x3c')]);var _0x250b20={'where':_0x526364['where']};return db[_0x0f29('0x3d')][_0x0f29('0x20')](_0x250b20)[_0x0f29('0x24')](function(_0x11b1dc){_0x409b19['count']=_0x11b1dc;if(_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x526364[_0x0f29('0x3f')]=[{'all':!![]}];}return db[_0x0f29('0x3d')][_0x0f29('0x40')](_0x526364);})['then'](function(_0x410c59){_0x409b19[_0x0f29('0x41')]=_0x410c59;return _0x409b19;})[_0x0f29('0x24')](respondWithFilteredResult(_0x561c31,_0x526364))['catch'](handleError(_0x561c31,null));};exports[_0x0f29('0x42')]=function(_0x284279,_0x3a6479){var _0x338412={'raw':![],'where':{'id':_0x284279[_0x0f29('0x43')]['id']}},_0x35f753={};_0x35f753[_0x0f29('0x32')]=_[_0x0f29('0x2e')](db['VoiceChanSpy']['rawAttributes']);_0x35f753['query']=_[_0x0f29('0x2e')](_0x284279[_0x0f29('0x2f')]);_0x35f753[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x35f753[_0x0f29('0x32')],_0x35f753[_0x0f29('0x2f')]);_0x338412['attributes']=_[_0x0f29('0x31')](_0x35f753['model'],qs[_0x0f29('0x34')](_0x284279['query'][_0x0f29('0x34')]));_0x338412[_0x0f29('0x33')]=_0x338412[_0x0f29('0x33')][_0x0f29('0x35')]?_0x338412[_0x0f29('0x33')]:_0x35f753['model'];if(_0x284279[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x338412[_0x0f29('0x3f')]=[{'all':!![]}];}_0x338412=_['merge']({},_0x338412,_0x284279[_0x0f29('0x3c')]);return db['VoiceChanSpy']['find'](_0x338412)[_0x0f29('0x24')](handleEntityNotFound(_0x3a6479,null))[_0x0f29('0x24')](respondWithResult(_0x3a6479,null))[_0x0f29('0x44')](handleError(_0x3a6479,null));};exports[_0x0f29('0x45')]=function(_0x20aa53,_0x335435){return db['VoiceChanSpy'][_0x0f29('0x45')](_0x20aa53[_0x0f29('0x46')],{})[_0x0f29('0x24')](function(_0x857564){var _0x2455d2=_0x20aa53[_0x0f29('0x47')][_0x0f29('0x25')]({'plain':!![]});if(!_0x2455d2)throw new Error(_0x0f29('0x48'));if(_0x2455d2[_0x0f29('0x49')]===_0x0f29('0x47')){var _0x5cd4a9=_0x857564['get']({'plain':!![]});var _0xa6231e=_0x0f29('0x26');return db[_0x0f29('0x4a')][_0x0f29('0x4b')]({'where':{'name':_0xa6231e,'userProfileId':_0x2455d2['userProfileId']},'raw':!![]})[_0x0f29('0x24')](function(_0xd624ad){if(_0xd624ad&&_0xd624ad[_0x0f29('0x4c')]===0x0){return db[_0x0f29('0x27')][_0x0f29('0x45')]({'name':_0x5cd4a9[_0x0f29('0x2a')],'resourceId':_0x5cd4a9['id'],'type':_0xd624ad[_0x0f29('0x2a')],'sectionId':_0xd624ad['id']},{})['then'](function(){return _0x857564;});}else{return _0x857564;}})[_0x0f29('0x44')](function(_0x6c1800){logger[_0x0f29('0x28')](_0x0f29('0x4d'),_0x6c1800);throw _0x6c1800;});}return _0x857564;})[_0x0f29('0x24')](respondWithResult(_0x335435,0xc9))[_0x0f29('0x44')](handleError(_0x335435,null));};exports['update']=function(_0x8c9780,_0x45d87c){if(_0x8c9780[_0x0f29('0x46')]['id']){delete _0x8c9780['body']['id'];}return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x8c9780[_0x0f29('0x43')]['id']}})['then'](handleEntityNotFound(_0x45d87c,null))[_0x0f29('0x24')](saveUpdates(_0x8c9780[_0x0f29('0x46')],null))['then'](respondWithResult(_0x45d87c,null))[_0x0f29('0x44')](handleError(_0x45d87c,null));};exports[_0x0f29('0x4e')]=function(_0x4ae30,_0x4a2c08){return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x4ae30[_0x0f29('0x43')]['id']}})[_0x0f29('0x24')](handleEntityNotFound(_0x4a2c08,null))['then'](removeEntity(_0x4a2c08,null))[_0x0f29('0x44')](handleError(_0x4a2c08,null));}; \ No newline at end of file +var _0x0fc2=['order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','end','error','stack','send','map','VoiceChanSpy','rawAttributes','fieldName','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x55e6b5,_0x3d146e){var _0x483199=function(_0x17a601){while(--_0x17a601){_0x55e6b5['push'](_0x55e6b5['shift']());}};_0x483199(++_0x3d146e);}(_0x0fc2,0x6e));var _0x20fc=function(_0xb0576f,_0x15bcbe){_0xb0576f=_0xb0576f-0x0;var _0x497031=_0x0fc2[_0xb0576f];return _0x497031;};'use strict';var emlformat=require(_0x20fc('0x0'));var rimraf=require(_0x20fc('0x1'));var zipdir=require(_0x20fc('0x2'));var jsonpatch=require(_0x20fc('0x3'));var rp=require('request-promise');var moment=require(_0x20fc('0x4'));var BPromise=require(_0x20fc('0x5'));var Mustache=require(_0x20fc('0x6'));var util=require(_0x20fc('0x7'));var path=require(_0x20fc('0x8'));var sox=require(_0x20fc('0x9'));var csv=require(_0x20fc('0xa'));var ejs=require(_0x20fc('0xb'));var fs=require('fs');var fs_extra=require(_0x20fc('0xc'));var _=require(_0x20fc('0xd'));var squel=require(_0x20fc('0xe'));var crypto=require(_0x20fc('0xf'));var jsforce=require(_0x20fc('0x10'));var deskjs=require(_0x20fc('0x11'));var toCsv=require(_0x20fc('0xa'));var querystring=require(_0x20fc('0x12'));var Papa=require('papaparse');var Redis=require(_0x20fc('0x13'));var authService=require(_0x20fc('0x14'));var qs=require(_0x20fc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20fc('0x16'));var logger=require(_0x20fc('0x17'))(_0x20fc('0x18'));var utils=require(_0x20fc('0x19'));var config=require(_0x20fc('0x1a'));var licenseUtil=require(_0x20fc('0x1b'));var db=require(_0x20fc('0x1c'))['db'];function respondWithStatusCode(_0x395d8b,_0x552afe){_0x552afe=_0x552afe||0xcc;return function(_0xe97a3e){if(_0xe97a3e){return _0x395d8b['sendStatus'](_0x552afe);}return _0x395d8b[_0x20fc('0x1d')](_0x552afe)['end']();};}function respondWithResult(_0x2f0048,_0x4c7f0e){_0x4c7f0e=_0x4c7f0e||0xc8;return function(_0x520c02){if(_0x520c02){return _0x2f0048[_0x20fc('0x1d')](_0x4c7f0e)[_0x20fc('0x1e')](_0x520c02);}};}function respondWithFilteredResult(_0x25f620,_0x38a6da){return function(_0x511e79){if(_0x511e79){var _0x29fe77=typeof _0x38a6da[_0x20fc('0x1f')]==='undefined'&&typeof _0x38a6da['limit']===_0x20fc('0x20');var _0x3dbdc0=_0x511e79[_0x20fc('0x21')];var _0x421ff8=_0x29fe77?0x0:_0x38a6da['offset'];var _0x3f4190=_0x29fe77?_0x511e79[_0x20fc('0x21')]:_0x38a6da[_0x20fc('0x1f')]+_0x38a6da[_0x20fc('0x22')];var _0x1eaebd;if(_0x3f4190>=_0x3dbdc0){_0x3f4190=_0x3dbdc0;_0x1eaebd=0xc8;}else{_0x1eaebd=0xce;}_0x25f620[_0x20fc('0x1d')](_0x1eaebd);return _0x25f620[_0x20fc('0x23')](_0x20fc('0x24'),_0x421ff8+'-'+_0x3f4190+'/'+_0x3dbdc0)[_0x20fc('0x1e')](_0x511e79);}return null;};}function patchUpdates(_0x41be86){return function(_0x4e2b0c){try{jsonpatch[_0x20fc('0x25')](_0x4e2b0c,_0x41be86,!![]);}catch(_0x14b835){return BPromise['reject'](_0x14b835);}return _0x4e2b0c[_0x20fc('0x26')]();};}function saveUpdates(_0xd6e20e,_0x359881){return function(_0x39339a){if(_0x39339a){return _0x39339a[_0x20fc('0x27')](_0xd6e20e)[_0x20fc('0x28')](function(_0x1dcafe){return _0x1dcafe;});}return null;};}function removeEntity(_0x4bc36b,_0x37d3ad){return function(_0x25d8d9){if(_0x25d8d9){return _0x25d8d9['destroy']()[_0x20fc('0x28')](function(){var _0x2d3831=_0x25d8d9[_0x20fc('0x29')]({'plain':!![]});var _0x2ed63f='ChanSpies';return db[_0x20fc('0x2a')]['destroy']({'where':{'type':_0x2ed63f,'resourceId':_0x2d3831['id']}})['then'](function(){return _0x25d8d9;});})[_0x20fc('0x28')](function(){_0x4bc36b['status'](0xcc)[_0x20fc('0x2b')]();});}};}function handleEntityNotFound(_0x1d387f,_0x43e310){return function(_0x5eae37){if(!_0x5eae37){_0x1d387f['sendStatus'](0x194);}return _0x5eae37;};}function handleError(_0x56f147,_0x3e0655){_0x3e0655=_0x3e0655||0x1f4;return function(_0x295f9a){logger[_0x20fc('0x2c')](_0x295f9a[_0x20fc('0x2d')]);if(_0x295f9a['name']){delete _0x295f9a['name'];}_0x56f147[_0x20fc('0x1d')](_0x3e0655)[_0x20fc('0x2e')](_0x295f9a);};}exports['index']=function(_0x5923b1,_0x37fb71){var _0x539268={},_0x21929a={},_0x40fe37={'count':0x0,'rows':[]};var _0x1865db=_[_0x20fc('0x2f')](db[_0x20fc('0x30')][_0x20fc('0x31')],function(_0x4bfa23){return{'name':_0x4bfa23[_0x20fc('0x32')],'type':_0x4bfa23['type']['key']};});_0x21929a[_0x20fc('0x33')]=_['map'](_0x1865db,_0x20fc('0x34'));_0x21929a[_0x20fc('0x35')]=_[_0x20fc('0x36')](_0x5923b1[_0x20fc('0x35')]);_0x21929a[_0x20fc('0x37')]=_['intersection'](_0x21929a[_0x20fc('0x33')],_0x21929a['query']);_0x539268[_0x20fc('0x38')]=_[_0x20fc('0x39')](_0x21929a['model'],qs[_0x20fc('0x3a')](_0x5923b1['query'][_0x20fc('0x3a')]));_0x539268['attributes']=_0x539268['attributes'][_0x20fc('0x3b')]?_0x539268[_0x20fc('0x38')]:_0x21929a[_0x20fc('0x33')];if(!_0x5923b1[_0x20fc('0x35')][_0x20fc('0x3c')](_0x20fc('0x3d'))){_0x539268['limit']=qs[_0x20fc('0x22')](_0x5923b1[_0x20fc('0x35')][_0x20fc('0x22')]);_0x539268[_0x20fc('0x1f')]=qs[_0x20fc('0x1f')](_0x5923b1[_0x20fc('0x35')][_0x20fc('0x1f')]);}_0x539268[_0x20fc('0x3e')]=qs['sort'](_0x5923b1[_0x20fc('0x35')][_0x20fc('0x3f')]);_0x539268[_0x20fc('0x40')]=qs[_0x20fc('0x37')](_[_0x20fc('0x41')](_0x5923b1[_0x20fc('0x35')],_0x21929a['filters']),_0x1865db);if(_0x5923b1['query']['filter']){_0x539268[_0x20fc('0x40')]=_['merge'](_0x539268[_0x20fc('0x40')],{'$or':_[_0x20fc('0x2f')](_0x1865db,function(_0x236811){if(_0x236811['type']!==_0x20fc('0x42')){var _0x20cb18={};_0x20cb18[_0x236811[_0x20fc('0x34')]]={'$like':'%'+_0x5923b1[_0x20fc('0x35')][_0x20fc('0x43')]+'%'};return _0x20cb18;}})});}_0x539268=_[_0x20fc('0x44')]({},_0x539268,_0x5923b1[_0x20fc('0x45')]);var _0x2ced6b={'where':_0x539268[_0x20fc('0x40')]};return db[_0x20fc('0x30')][_0x20fc('0x21')](_0x2ced6b)[_0x20fc('0x28')](function(_0x5ab2c9){_0x40fe37[_0x20fc('0x21')]=_0x5ab2c9;if(_0x5923b1[_0x20fc('0x35')][_0x20fc('0x46')]){_0x539268[_0x20fc('0x47')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x539268);})[_0x20fc('0x28')](function(_0x2f8ee2){_0x40fe37[_0x20fc('0x48')]=_0x2f8ee2;return _0x40fe37;})[_0x20fc('0x28')](respondWithFilteredResult(_0x37fb71,_0x539268))['catch'](handleError(_0x37fb71,null));};exports['show']=function(_0x278308,_0x39ed13){var _0x912f65={'raw':![],'where':{'id':_0x278308['params']['id']}},_0x2feed2={};_0x2feed2['model']=_[_0x20fc('0x36')](db[_0x20fc('0x30')][_0x20fc('0x31')]);_0x2feed2[_0x20fc('0x35')]=_[_0x20fc('0x36')](_0x278308['query']);_0x2feed2[_0x20fc('0x37')]=_['intersection'](_0x2feed2[_0x20fc('0x33')],_0x2feed2[_0x20fc('0x35')]);_0x912f65[_0x20fc('0x38')]=_[_0x20fc('0x39')](_0x2feed2[_0x20fc('0x33')],qs[_0x20fc('0x3a')](_0x278308[_0x20fc('0x35')][_0x20fc('0x3a')]));_0x912f65[_0x20fc('0x38')]=_0x912f65[_0x20fc('0x38')][_0x20fc('0x3b')]?_0x912f65[_0x20fc('0x38')]:_0x2feed2[_0x20fc('0x33')];if(_0x278308[_0x20fc('0x35')][_0x20fc('0x46')]){_0x912f65[_0x20fc('0x47')]=[{'all':!![]}];}_0x912f65=_['merge']({},_0x912f65,_0x278308[_0x20fc('0x45')]);return db[_0x20fc('0x30')][_0x20fc('0x49')](_0x912f65)[_0x20fc('0x28')](handleEntityNotFound(_0x39ed13,null))[_0x20fc('0x28')](respondWithResult(_0x39ed13,null))[_0x20fc('0x4a')](handleError(_0x39ed13,null));};exports[_0x20fc('0x4b')]=function(_0x2a2897,_0x35d84c){return db[_0x20fc('0x30')][_0x20fc('0x4b')](_0x2a2897['body'],{})[_0x20fc('0x28')](function(_0x220752){var _0x17da1c=_0x2a2897[_0x20fc('0x4c')][_0x20fc('0x29')]({'plain':!![]});if(!_0x17da1c)throw new Error(_0x20fc('0x4d'));if(_0x17da1c['role']===_0x20fc('0x4c')){var _0x236628=_0x220752[_0x20fc('0x29')]({'plain':!![]});var _0x3abe75=_0x20fc('0x4e');return db[_0x20fc('0x4f')][_0x20fc('0x49')]({'where':{'name':_0x3abe75,'userProfileId':_0x17da1c[_0x20fc('0x50')]},'raw':!![]})['then'](function(_0x4bf571){if(_0x4bf571&&_0x4bf571[_0x20fc('0x51')]===0x0){return db[_0x20fc('0x2a')][_0x20fc('0x4b')]({'name':_0x236628[_0x20fc('0x34')],'resourceId':_0x236628['id'],'type':_0x4bf571['name'],'sectionId':_0x4bf571['id']},{})['then'](function(){return _0x220752;});}else{return _0x220752;}})['catch'](function(_0x1b5903){logger[_0x20fc('0x2c')](_0x20fc('0x52'),_0x1b5903);throw _0x1b5903;});}return _0x220752;})['then'](respondWithResult(_0x35d84c,0xc9))[_0x20fc('0x4a')](handleError(_0x35d84c,null));};exports[_0x20fc('0x27')]=function(_0x46bea7,_0x1159a2){if(_0x46bea7['body']['id']){delete _0x46bea7[_0x20fc('0x53')]['id'];}return db[_0x20fc('0x30')][_0x20fc('0x49')]({'where':{'id':_0x46bea7['params']['id']}})[_0x20fc('0x28')](handleEntityNotFound(_0x1159a2,null))[_0x20fc('0x28')](saveUpdates(_0x46bea7[_0x20fc('0x53')],null))[_0x20fc('0x28')](respondWithResult(_0x1159a2,null))[_0x20fc('0x4a')](handleError(_0x1159a2,null));};exports[_0x20fc('0x54')]=function(_0x3e2a1a,_0x1c7fa9){return db[_0x20fc('0x30')][_0x20fc('0x49')]({'where':{'id':_0x3e2a1a[_0x20fc('0x55')]['id']}})['then'](handleEntityNotFound(_0x1c7fa9,null))[_0x20fc('0x28')](removeEntity(_0x1c7fa9,null))[_0x20fc('0x4a')](handleError(_0x1c7fa9,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 609d3f2..a6c7b03 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 _0xc35e=['CDR(type)=%s','chanspy','merge','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','format'];(function(_0x12412b,_0x4a3583){var _0x52e0c8=function(_0x4d1b55){while(--_0x4d1b55){_0x12412b['push'](_0x12412b['shift']());}};_0x52e0c8(++_0x4a3583);}(_0xc35e,0x166));var _0xec35=function(_0x1ba865,_0x110d26){_0x1ba865=_0x1ba865-0x0;var _0x35a964=_0xc35e[_0x1ba865];return _0x35a964;};'use strict';var _=require(_0xec35('0x0'));var util=require(_0xec35('0x1'));var BPromise=require(_0xec35('0x2'));var attributes=require(_0xec35('0x3'));var getUserApplications=function(_0x5aab9a,_0xffce28,_0x308d6e){var _0x52caca=0x1;var _0x3a3b29=[];var _0x1fee46={'context':_0xffce28[_0xec35('0x4')]||_0xec35('0x5'),'exten':util['format'](_0xec35('0x6'),_0x5aab9a[_0xec35('0x7')],_0x308d6e),'type':_0xec35('0x8'),'isApp':![],'ChanSpyId':_0x5aab9a['id'],'UserId':_0xffce28['id']};_0x3a3b29[_0xec35('0x9')](_['merge']({'app':'Set','appdata':util[_0xec35('0xa')](_0xec35('0xb'),_0xec35('0xc')),'priority':_0x52caca++},_0x1fee46));if(_0x5aab9a['record']){_0x3a3b29['push'](_[_0xec35('0xd')]({'app':'MixMonitor','appdata':util[_0xec35('0xa')](_0xec35('0xe'),_0x5aab9a[_0xec35('0xf')]),'priority':_0x52caca++},_0x1fee46));}if(_0x5aab9a[_0xec35('0x10')]){_0x3a3b29[_0xec35('0x9')](_['merge']({'app':'Authenticate','appdata':_0x5aab9a[_0xec35('0x11')],'priority':_0x52caca++},_0x1fee46));}_0x3a3b29['push'](_[_0xec35('0xd')]({'app':_0xec35('0x12'),'appdata':util[_0xec35('0xa')](_0xec35('0x13'),_0xffce28[_0xec35('0x14')],_0x5aab9a[_0xec35('0x15')]?_0x5aab9a[_0xec35('0x15')][_0xec35('0x16')](''):''),'priority':_0x52caca++},_0x1fee46));if(_0x5aab9a[_0xec35('0x17')]){_0x3a3b29[_0xec35('0x9')](_[_0xec35('0xd')]({'app':_0xec35('0x18'),'priority':_0x52caca++},_0x1fee46));}return _0x3a3b29;};var getChanSpyApplications=function(_0xf490bc,_0x3fbfff){var _0x4918fd=[];for(var _0x37d7bb=0x0,_0x1713f3=0x1;_0x37d7bb<_0x3fbfff[_0xec35('0x19')];_0x37d7bb++,_0x1713f3=0x1){_0x4918fd=_0x4918fd[_0xec35('0x1a')](getUserApplications(_0xf490bc,_0x3fbfff[_0x37d7bb],_0x3fbfff[_0x37d7bb]['internal']));if(_0x3fbfff[_0x37d7bb][_0xec35('0x1b')]!=_0x3fbfff[_0x37d7bb]['name']){_0x4918fd=_0x4918fd[_0xec35('0x1a')](getUserApplications(_0xf490bc,_0x3fbfff[_0x37d7bb],_0x3fbfff[_0x37d7bb]['name']));}}return _0x4918fd;};var getChanSpyPromise=function(_0xf01cbe,_0x2d5c7d){return new BPromise(function(_0x4075f1,_0x5a5efd){return _0xf01cbe[_0xec35('0x1c')][_0xec35('0x1d')]({'attributes':['id',_0xec35('0x14'),_0xec35('0x1b')],'where':{'role':_0xec35('0x1e'),'chanspy':!![]},'raw':!![]})[_0xec35('0x1f')](function(_0x577af1){if(_0x577af1){return _0x4075f1(getChanSpyApplications(_0x2d5c7d,_0x577af1));}return _0x4075f1([]);})[_0xec35('0x20')](function(_0x5bc2db){_0x5a5efd(_0x5bc2db);});});};module[_0xec35('0x21')]=function(_0x5d8a2b,_0x591eef){var _0x385882=_0x5d8a2b[_0xec35('0x22')];return _0x5d8a2b[_0xec35('0x23')](_0xec35('0x24'),attributes,{'tableName':_0xec35('0x25'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e5fa0,_0x5c9181,_0x479563){return getChanSpyPromise(_0x385882,_0x1e5fa0)['then'](function(_0x3a8fbe){if(_0x3a8fbe&&_0x3a8fbe[_0xec35('0x19')]){return _0x385882[_0xec35('0x26')]['bulkCreate'](_0x3a8fbe);}})[_0xec35('0x1f')](function(){_0x479563();})[_0xec35('0x20')](function(_0x33ffe6){_0x479563(_0x33ffe6);});},'afterUpdate':function(_0x165d79,_0x1aee95,_0x517195){return _0x385882['VoiceExtension'][_0xec35('0x27')]({'where':{'ChanSpyId':_0x165d79['id']}})['then'](function(){return getChanSpyPromise(_0x385882,_0x165d79);})[_0xec35('0x1f')](function(_0x316b54){if(_0x316b54&&_0x316b54[_0xec35('0x19')]){return _0x385882[_0xec35('0x26')][_0xec35('0x28')](_0x316b54);}})[_0xec35('0x1f')](function(){_0x517195();})[_0xec35('0x20')](function(_0xb8f290){_0x517195(_0xb8f290);});},'afterDestroy':function(_0x41bc06,_0x3d1c03,_0x5ac9e2){return _0x385882[_0xec35('0x26')]['destroy']({'where':{'ChanSpyId':_0x41bc06['id']}})[_0xec35('0x1f')](function(){_0x5ac9e2();})[_0xec35('0x20')](function(_0x1f0184){_0x5ac9e2(_0x1f0184);});}}});}; \ No newline at end of file +var _0x6f83=['join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name'];(function(_0x41cb4b,_0x200468){var _0x1719c1=function(_0x53ad61){while(--_0x53ad61){_0x41cb4b['push'](_0x41cb4b['shift']());}};_0x1719c1(++_0x200468);}(_0x6f83,0x11b));var _0x36f8=function(_0x5bd928,_0x303efd){_0x5bd928=_0x5bd928-0x0;var _0x2be1fa=_0x6f83[_0x5bd928];return _0x2be1fa;};'use strict';var _=require(_0x36f8('0x0'));var util=require(_0x36f8('0x1'));var BPromise=require('bluebird');var attributes=require(_0x36f8('0x2'));var getUserApplications=function(_0x4f5a64,_0x54b8bc,_0xce371d){var _0x13fd49=0x1;var _0x37377a=[];var _0x3a1590={'context':_0x54b8bc['context']||_0x36f8('0x3'),'exten':util[_0x36f8('0x4')](_0x36f8('0x5'),_0x4f5a64[_0x36f8('0x6')],_0xce371d),'type':_0x36f8('0x7'),'isApp':![],'ChanSpyId':_0x4f5a64['id'],'UserId':_0x54b8bc['id']};_0x37377a[_0x36f8('0x8')](_[_0x36f8('0x9')]({'app':_0x36f8('0xa'),'appdata':util['format'](_0x36f8('0xb'),_0x36f8('0xc')),'priority':_0x13fd49++},_0x3a1590));if(_0x4f5a64[_0x36f8('0xd')]){_0x37377a[_0x36f8('0x8')](_[_0x36f8('0x9')]({'app':'MixMonitor','appdata':util[_0x36f8('0x4')](_0x36f8('0xe'),_0x4f5a64[_0x36f8('0xf')]),'priority':_0x13fd49++},_0x3a1590));}if(_0x4f5a64[_0x36f8('0x10')]){_0x37377a[_0x36f8('0x8')](_['merge']({'app':_0x36f8('0x11'),'appdata':_0x4f5a64[_0x36f8('0x12')],'priority':_0x13fd49++},_0x3a1590));}_0x37377a[_0x36f8('0x8')](_[_0x36f8('0x9')]({'app':'ChanSpy','appdata':util[_0x36f8('0x4')](_0x36f8('0x13'),_0x54b8bc[_0x36f8('0x14')],_0x4f5a64['options']?_0x4f5a64['options'][_0x36f8('0x15')](''):''),'priority':_0x13fd49++},_0x3a1590));if(_0x4f5a64['record']){_0x37377a[_0x36f8('0x8')](_[_0x36f8('0x9')]({'app':_0x36f8('0x16'),'priority':_0x13fd49++},_0x3a1590));}return _0x37377a;};var getChanSpyApplications=function(_0x39ed1b,_0x2b7693){var _0x1eaa21=[];for(var _0x281c8a=0x0,_0xdb4e09=0x1;_0x281c8a<_0x2b7693[_0x36f8('0x17')];_0x281c8a++,_0xdb4e09=0x1){_0x1eaa21=_0x1eaa21[_0x36f8('0x18')](getUserApplications(_0x39ed1b,_0x2b7693[_0x281c8a],_0x2b7693[_0x281c8a][_0x36f8('0x19')]));if(_0x2b7693[_0x281c8a][_0x36f8('0x19')]!=_0x2b7693[_0x281c8a][_0x36f8('0x14')]){_0x1eaa21=_0x1eaa21[_0x36f8('0x18')](getUserApplications(_0x39ed1b,_0x2b7693[_0x281c8a],_0x2b7693[_0x281c8a][_0x36f8('0x14')]));}}return _0x1eaa21;};var getChanSpyPromise=function(_0x543f17,_0x732641){return new BPromise(function(_0x3dee06,_0x5337b5){return _0x543f17['User'][_0x36f8('0x1a')]({'attributes':['id',_0x36f8('0x14'),_0x36f8('0x19')],'where':{'role':_0x36f8('0x1b'),'chanspy':!![]},'raw':!![]})[_0x36f8('0x1c')](function(_0x1f411b){if(_0x1f411b){return _0x3dee06(getChanSpyApplications(_0x732641,_0x1f411b));}return _0x3dee06([]);})[_0x36f8('0x1d')](function(_0xc1555c){_0x5337b5(_0xc1555c);});});};module[_0x36f8('0x1e')]=function(_0x12dfc5,_0x2e3019){var _0x2ad73b=_0x12dfc5[_0x36f8('0x1f')];return _0x12dfc5[_0x36f8('0x20')](_0x36f8('0x21'),attributes,{'tableName':_0x36f8('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x187a87,_0x52e8b7,_0x297345){return getChanSpyPromise(_0x2ad73b,_0x187a87)[_0x36f8('0x1c')](function(_0x486544){if(_0x486544&&_0x486544[_0x36f8('0x17')]){return _0x2ad73b[_0x36f8('0x23')][_0x36f8('0x24')](_0x486544);}})['then'](function(){_0x297345();})[_0x36f8('0x1d')](function(_0x182e61){_0x297345(_0x182e61);});},'afterUpdate':function(_0x3a0ae9,_0x37937a,_0x4ce17b){return _0x2ad73b[_0x36f8('0x23')][_0x36f8('0x25')]({'where':{'ChanSpyId':_0x3a0ae9['id']}})['then'](function(){return getChanSpyPromise(_0x2ad73b,_0x3a0ae9);})[_0x36f8('0x1c')](function(_0x56f9d1){if(_0x56f9d1&&_0x56f9d1[_0x36f8('0x17')]){return _0x2ad73b[_0x36f8('0x23')][_0x36f8('0x24')](_0x56f9d1);}})[_0x36f8('0x1c')](function(){_0x4ce17b();})[_0x36f8('0x1d')](function(_0x45734b){_0x4ce17b(_0x45734b);});},'afterDestroy':function(_0x41d8ae,_0x2dbe18,_0x57e289){return _0x2ad73b['VoiceExtension'][_0x36f8('0x25')]({'where':{'ChanSpyId':_0x41d8ae['id']}})[_0x36f8('0x1c')](function(){_0x57e289();})[_0x36f8('0x1d')](function(_0x477388){_0x57e289(_0x477388);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 288c159..8510908 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 _0x3eec=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','VoiceChanSpy,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x5d6ff9,_0x467555){_0x5d6ff9=_0x5d6ff9-0x0;var _0x2a43b1=_0x3eec[_0x5d6ff9];return _0x2a43b1;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var moment=require(_0xc3ee('0x2'));var BPromise=require(_0xc3ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ee('0x4'));var db=require(_0xc3ee('0x5'))['db'];var utils=require(_0xc3ee('0x6'));var logger=require(_0xc3ee('0x7'))(_0xc3ee('0x8'));var config=require(_0xc3ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3ee('0xa')][_0xc3ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea4318,_0x2cc750,_0x356374){return new BPromise(function(_0x3d74c0,_0xd88f6){return client[_0xc3ee('0xc')](_0xea4318,_0x356374)[_0xc3ee('0xd')](function(_0x23e9c0){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x2cc750,_0xc3ee('0xe'));logger[_0xc3ee('0xf')](_0xc3ee('0x10'),_0x2cc750,_0xc3ee('0xe'),JSON['stringify'](_0x23e9c0));if(_0x23e9c0[_0xc3ee('0x11')]){if(_0x23e9c0['error'][_0xc3ee('0x12')]===0x1f4){logger[_0xc3ee('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0xd88f6(_0x23e9c0['error'][_0xc3ee('0x13')]);}logger['error'](_0xc3ee('0x14'),_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0x3d74c0(_0x23e9c0[_0xc3ee('0x11')][_0xc3ee('0x13')]);}else{logger[_0xc3ee('0x15')](_0xc3ee('0x14'),_0x2cc750,_0xc3ee('0xe'));_0x3d74c0(_0x23e9c0[_0xc3ee('0x16')]['message']);}})[_0xc3ee('0x17')](function(_0x4eea89){logger[_0xc3ee('0x11')](_0xc3ee('0x14'),_0x2cc750,_0x4eea89);_0xd88f6(_0x4eea89);});});} \ No newline at end of file +var _0x6953=['catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6953,0x91));var _0x3695=function(_0x41010e,_0x25e9c5){_0x41010e=_0x41010e-0x0;var _0x59e342=_0x6953[_0x41010e];return _0x59e342;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3695('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3695('0x3'));var logger=require(_0x3695('0x4'))(_0x3695('0x5'));var config=require('../../config/environment');var jayson=require(_0x3695('0x6'));var client=jayson['client'][_0x3695('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14eb32,_0x912099,_0x1a4e75){return new BPromise(function(_0x301e46,_0x4e337b){return client[_0x3695('0x8')](_0x14eb32,_0x1a4e75)['then'](function(_0x1fcd43){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x3695('0x9'));logger['debug'](_0x3695('0xa'),_0x912099,_0x3695('0x9'),JSON[_0x3695('0xb')](_0x1fcd43));if(_0x1fcd43[_0x3695('0xc')]){if(_0x1fcd43[_0x3695('0xc')][_0x3695('0xd')]===0x1f4){logger['error'](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x4e337b(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}logger[_0x3695('0xc')](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x301e46(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}else{logger['info'](_0x3695('0xe'),_0x912099,_0x3695('0x9'));_0x301e46(_0x1fcd43[_0x3695('0x10')][_0x3695('0xf')]);}})[_0x3695('0x11')](function(_0x1973ee){logger[_0x3695('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x1973ee);_0x4e337b(_0x1973ee);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 17cdcc8..b2e74f8 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 _0xab10=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete'];(function(_0x3164d3,_0x20619b){var _0x5ad102=function(_0xa29da5){while(--_0xa29da5){_0x3164d3['push'](_0x3164d3['shift']());}};_0x5ad102(++_0x20619b);}(_0xab10,0x9a));var _0x0ab1=function(_0x5a16cd,_0x25a6f0){_0x5a16cd=_0x5a16cd-0x0;var _0x484083=_0xab10[_0x5a16cd];return _0x484083;};'use strict';var multer=require(_0x0ab1('0x0'));var util=require('util');var path=require(_0x0ab1('0x1'));var timeout=require(_0x0ab1('0x2'));var express=require('express');var router=express[_0x0ab1('0x3')]();var fs_extra=require(_0x0ab1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ab1('0x5'));var config=require(_0x0ab1('0x6'));var controller=require(_0x0ab1('0x7'));router['get']('/',auth[_0x0ab1('0x8')](),controller['index']);router[_0x0ab1('0x9')]('/:id',auth[_0x0ab1('0x8')](),controller[_0x0ab1('0xa')]);router[_0x0ab1('0xb')]('/',auth[_0x0ab1('0x8')](),controller[_0x0ab1('0xc')]);router[_0x0ab1('0xd')](_0x0ab1('0xe'),auth[_0x0ab1('0x8')](),controller[_0x0ab1('0xf')]);router[_0x0ab1('0x10')](_0x0ab1('0xe'),auth[_0x0ab1('0x8')](),controller[_0x0ab1('0x11')]);module[_0x0ab1('0x12')]=router; \ No newline at end of file +var _0x854d=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','create'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x854d,0x182));var _0xd854=function(_0x237e00,_0x53e9ab){_0x237e00=_0x237e00-0x0;var _0x5391ed=_0x854d[_0x237e00];return _0x5391ed;};'use strict';var multer=require(_0xd854('0x0'));var util=require(_0xd854('0x1'));var path=require(_0xd854('0x2'));var timeout=require(_0xd854('0x3'));var express=require(_0xd854('0x4'));var router=express[_0xd854('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd854('0x6'));var interaction=require(_0xd854('0x7'));var config=require(_0xd854('0x8'));var controller=require(_0xd854('0x9'));router[_0xd854('0xa')]('/',auth[_0xd854('0xb')](),controller['index']);router[_0xd854('0xa')]('/:id',auth[_0xd854('0xb')](),controller[_0xd854('0xc')]);router['post']('/',auth[_0xd854('0xb')](),controller[_0xd854('0xd')]);router[_0xd854('0xe')](_0xd854('0xf'),auth[_0xd854('0xb')](),controller[_0xd854('0x10')]);router[_0xd854('0x11')](_0xd854('0xf'),auth[_0xd854('0xb')](),controller[_0xd854('0x12')]);module[_0xd854('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 93803f3..6523cc5 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 _0x579c=['STRING','name','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x579c,0x1f4));var _0xc579=function(_0x3716e6,_0x1a51df){_0x3716e6=_0x3716e6-0x0;var _0xd06104=_0x579c[_0x3716e6];return _0xd06104;};'use strict';var Sequelize=require(_0xc579('0x0'));module['exports']={'name':{'type':Sequelize[_0xc579('0x1')],'unique':_0xc579('0x2')},'description':{'type':Sequelize[_0xc579('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd271=['sequelize','STRING','BOOLEAN'];(function(_0x12655d,_0x2bb430){var _0x4ea8fc=function(_0x2ea579){while(--_0x2ea579){_0x12655d['push'](_0x12655d['shift']());}};_0x4ea8fc(++_0x2bb430);}(_0xd271,0x1aa));var _0x1d27=function(_0x43f3e0,_0x351819){_0x43f3e0=_0x43f3e0-0x0;var _0x4cb544=_0xd271[_0x43f3e0];return _0x4cb544;};'use strict';var Sequelize=require(_0x1d27('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x1d27('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1d27('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 31ae981..c3810ff 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 _0x2c74=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','find','create','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','findAll','utf8','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','get','Contexts','UserProfileResource','name','send','index','VoiceContext','rawAttributes','type','map','query','keys','filters','intersection'];(function(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0x2c74,0x153));var _0x42c7=function(_0x3ff3ad,_0x405fb3){_0x3ff3ad=_0x3ff3ad-0x0;var _0x2ada24=_0x2c74[_0x3ff3ad];return _0x2ada24;};'use strict';var emlformat=require(_0x42c7('0x0'));var rimraf=require(_0x42c7('0x1'));var zipdir=require(_0x42c7('0x2'));var jsonpatch=require(_0x42c7('0x3'));var rp=require(_0x42c7('0x4'));var moment=require(_0x42c7('0x5'));var BPromise=require(_0x42c7('0x6'));var Mustache=require('mustache');var util=require(_0x42c7('0x7'));var path=require(_0x42c7('0x8'));var sox=require(_0x42c7('0x9'));var csv=require(_0x42c7('0xa'));var ejs=require(_0x42c7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x42c7('0xc'));var crypto=require('crypto');var jsforce=require(_0x42c7('0xd'));var deskjs=require(_0x42c7('0xe'));var toCsv=require(_0x42c7('0xa'));var querystring=require('querystring');var Papa=require(_0x42c7('0xf'));var Redis=require(_0x42c7('0x10'));var authService=require(_0x42c7('0x11'));var qs=require(_0x42c7('0x12'));var as=require(_0x42c7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x42c7('0x14'))(_0x42c7('0x15'));var utils=require(_0x42c7('0x16'));var config=require(_0x42c7('0x17'));var licenseUtil=require(_0x42c7('0x18'));var db=require(_0x42c7('0x19'))['db'];var jayson=require(_0x42c7('0x1a'));var client=jayson['client'][_0x42c7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5bd4a0,_0x443381,_0x3f7219,_0x3ff0d5){return new BPromise(function(_0x4d57f7,_0x51f062){var _0x18eeb1=_0x3ff0d5||client;return _0x18eeb1[_0x42c7('0x1c')](_0x5bd4a0,_0x3f7219)['then'](function(_0x45dc26){logger[_0x42c7('0x1d')](_0x42c7('0x1e'),_0x443381,_0x42c7('0x1f'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x443381,'request\x20sent',JSON['stringify'](_0x45dc26));if(_0x45dc26[_0x42c7('0x20')]){if(_0x45dc26[_0x42c7('0x20')][_0x42c7('0x21')]===0x1f4){logger[_0x42c7('0x20')](_0x42c7('0x1e'),_0x443381,_0x45dc26[_0x42c7('0x20')][_0x42c7('0x22')]);return _0x51f062(_0x45dc26[_0x42c7('0x20')][_0x42c7('0x22')]);}logger[_0x42c7('0x20')](_0x42c7('0x1e'),_0x443381,_0x45dc26[_0x42c7('0x20')][_0x42c7('0x22')]);return _0x4d57f7(_0x45dc26[_0x42c7('0x20')][_0x42c7('0x22')]);}else{logger['info'](_0x42c7('0x1e'),_0x443381,_0x42c7('0x1f'));_0x4d57f7(_0x45dc26[_0x42c7('0x23')][_0x42c7('0x22')]);}})[_0x42c7('0x24')](function(_0x37853b){logger[_0x42c7('0x20')](_0x42c7('0x1e'),_0x443381,_0x37853b);_0x51f062(_0x37853b);});});}function respondWithStatusCode(_0x5d77fd,_0x245c6e){_0x245c6e=_0x245c6e||0xcc;return function(_0xc2776d){if(_0xc2776d){return _0x5d77fd[_0x42c7('0x25')](_0x245c6e);}return _0x5d77fd[_0x42c7('0x26')](_0x245c6e)[_0x42c7('0x27')]();};}function respondWithResult(_0x4a1545,_0x1662ee){_0x1662ee=_0x1662ee||0xc8;return function(_0x3049d0){if(_0x3049d0){return _0x4a1545[_0x42c7('0x26')](_0x1662ee)[_0x42c7('0x28')](_0x3049d0);}};}function respondWithFilteredResult(_0x56eb03,_0x58a845){return function(_0x198c96){if(_0x198c96){var _0x35d52a=typeof _0x58a845[_0x42c7('0x29')]===_0x42c7('0x2a')&&typeof _0x58a845['limit']===_0x42c7('0x2a');var _0x700cc1=_0x198c96[_0x42c7('0x2b')];var _0x4f75c7=_0x35d52a?0x0:_0x58a845['offset'];var _0x26ea8e=_0x35d52a?_0x198c96['count']:_0x58a845['offset']+_0x58a845[_0x42c7('0x2c')];var _0x5c3665;if(_0x26ea8e>=_0x700cc1){_0x26ea8e=_0x700cc1;_0x5c3665=0xc8;}else{_0x5c3665=0xce;}_0x56eb03[_0x42c7('0x26')](_0x5c3665);return _0x56eb03[_0x42c7('0x2d')](_0x42c7('0x2e'),_0x4f75c7+'-'+_0x26ea8e+'/'+_0x700cc1)[_0x42c7('0x28')](_0x198c96);}return null;};}function patchUpdates(_0x3f837d){return function(_0x321486){try{jsonpatch['apply'](_0x321486,_0x3f837d,!![]);}catch(_0x378b3b){return BPromise[_0x42c7('0x2f')](_0x378b3b);}return _0x321486[_0x42c7('0x30')]();};}function saveUpdates(_0x5f2392,_0x270533){return function(_0x464103){if(_0x464103){return _0x464103['update'](_0x5f2392)[_0x42c7('0x31')](function(_0xf12af9){return _0xf12af9;});}return null;};}function removeEntity(_0x4f5e82,_0x1f9a5d){return function(_0x4760b8){if(_0x4760b8){return _0x4760b8[_0x42c7('0x32')]()[_0x42c7('0x31')](function(){var _0xe2ef94=_0x4760b8[_0x42c7('0x33')]({'plain':!![]});var _0x378e75=_0x42c7('0x34');return db[_0x42c7('0x35')][_0x42c7('0x32')]({'where':{'type':_0x378e75,'resourceId':_0xe2ef94['id']}})[_0x42c7('0x31')](function(){return _0x4760b8;});})[_0x42c7('0x31')](function(){_0x4f5e82['status'](0xcc)[_0x42c7('0x27')]();});}};}function handleEntityNotFound(_0xfefd2c,_0x4f9679){return function(_0x966eb5){if(!_0x966eb5){_0xfefd2c[_0x42c7('0x25')](0x194);}return _0x966eb5;};}function handleError(_0x1dec05,_0x3d1987){_0x3d1987=_0x3d1987||0x1f4;return function(_0x15f1b1){logger[_0x42c7('0x20')](_0x15f1b1['stack']);if(_0x15f1b1[_0x42c7('0x36')]){delete _0x15f1b1['name'];}_0x1dec05['status'](_0x3d1987)[_0x42c7('0x37')](_0x15f1b1);};}exports[_0x42c7('0x38')]=function(_0x4f7811,_0x46d84d){var _0x43b394={},_0x3d8982={},_0x38291e={'count':0x0,'rows':[]};var _0x50b6e3=_['map'](db[_0x42c7('0x39')][_0x42c7('0x3a')],function(_0x22b8fb){return{'name':_0x22b8fb['fieldName'],'type':_0x22b8fb[_0x42c7('0x3b')]['key']};});_0x3d8982['model']=_[_0x42c7('0x3c')](_0x50b6e3,_0x42c7('0x36'));_0x3d8982[_0x42c7('0x3d')]=_[_0x42c7('0x3e')](_0x4f7811[_0x42c7('0x3d')]);_0x3d8982[_0x42c7('0x3f')]=_[_0x42c7('0x40')](_0x3d8982[_0x42c7('0x41')],_0x3d8982[_0x42c7('0x3d')]);_0x43b394[_0x42c7('0x42')]=_[_0x42c7('0x40')](_0x3d8982[_0x42c7('0x41')],qs[_0x42c7('0x43')](_0x4f7811['query'][_0x42c7('0x43')]));_0x43b394['attributes']=_0x43b394[_0x42c7('0x42')][_0x42c7('0x44')]?_0x43b394[_0x42c7('0x42')]:_0x3d8982[_0x42c7('0x41')];if(!_0x4f7811['query'][_0x42c7('0x45')](_0x42c7('0x46'))){_0x43b394[_0x42c7('0x2c')]=qs[_0x42c7('0x2c')](_0x4f7811[_0x42c7('0x3d')][_0x42c7('0x2c')]);_0x43b394[_0x42c7('0x29')]=qs[_0x42c7('0x29')](_0x4f7811[_0x42c7('0x3d')][_0x42c7('0x29')]);}_0x43b394[_0x42c7('0x47')]=qs[_0x42c7('0x48')](_0x4f7811[_0x42c7('0x3d')]['sort']);_0x43b394['where']=qs[_0x42c7('0x3f')](_['pick'](_0x4f7811[_0x42c7('0x3d')],_0x3d8982['filters']),_0x50b6e3);if(_0x4f7811[_0x42c7('0x3d')][_0x42c7('0x49')]){_0x43b394[_0x42c7('0x4a')]=_[_0x42c7('0x4b')](_0x43b394[_0x42c7('0x4a')],{'$or':_['map'](_0x50b6e3,function(_0x91131e){if(_0x91131e[_0x42c7('0x3b')]!==_0x42c7('0x4c')){var _0x1f7051={};_0x1f7051[_0x91131e['name']]={'$like':'%'+_0x4f7811[_0x42c7('0x3d')][_0x42c7('0x49')]+'%'};return _0x1f7051;}})});}_0x43b394=_[_0x42c7('0x4b')]({},_0x43b394,_0x4f7811[_0x42c7('0x4d')]);var _0x92a5e={'where':_0x43b394[_0x42c7('0x4a')]};return db[_0x42c7('0x39')][_0x42c7('0x2b')](_0x92a5e)[_0x42c7('0x31')](function(_0x4680b5){_0x38291e[_0x42c7('0x2b')]=_0x4680b5;if(_0x4f7811['query'][_0x42c7('0x4e')]){_0x43b394[_0x42c7('0x4f')]=[{'all':!![]}];}return db[_0x42c7('0x39')]['findAll'](_0x43b394);})['then'](function(_0x331b65){_0x38291e[_0x42c7('0x50')]=_0x331b65;return _0x38291e;})['then'](respondWithFilteredResult(_0x46d84d,_0x43b394))[_0x42c7('0x24')](handleError(_0x46d84d,null));};exports['show']=function(_0x4bff38,_0x225d74){var _0x224bff={'raw':![],'where':{'id':_0x4bff38[_0x42c7('0x51')]['id']}},_0x4d1ff4={};_0x4d1ff4[_0x42c7('0x41')]=_[_0x42c7('0x3e')](db[_0x42c7('0x39')][_0x42c7('0x3a')]);_0x4d1ff4[_0x42c7('0x3d')]=_[_0x42c7('0x3e')](_0x4bff38[_0x42c7('0x3d')]);_0x4d1ff4[_0x42c7('0x3f')]=_[_0x42c7('0x40')](_0x4d1ff4['model'],_0x4d1ff4[_0x42c7('0x3d')]);_0x224bff[_0x42c7('0x42')]=_[_0x42c7('0x40')](_0x4d1ff4[_0x42c7('0x41')],qs['fields'](_0x4bff38[_0x42c7('0x3d')][_0x42c7('0x43')]));_0x224bff[_0x42c7('0x42')]=_0x224bff[_0x42c7('0x42')][_0x42c7('0x44')]?_0x224bff[_0x42c7('0x42')]:_0x4d1ff4[_0x42c7('0x41')];if(_0x4bff38[_0x42c7('0x3d')][_0x42c7('0x4e')]){_0x224bff[_0x42c7('0x4f')]=[{'all':!![]}];}_0x224bff=_[_0x42c7('0x4b')]({},_0x224bff,_0x4bff38['options']);return db[_0x42c7('0x39')][_0x42c7('0x52')](_0x224bff)[_0x42c7('0x31')](handleEntityNotFound(_0x225d74,null))[_0x42c7('0x31')](respondWithResult(_0x225d74,null))[_0x42c7('0x24')](handleError(_0x225d74,null));};exports['create']=function(_0x207571,_0x36317a,_0x49bfcb){var _0x18bd1f;return db['VoiceContext'][_0x42c7('0x53')](_0x207571['body'],{'raw':!![]})[_0x42c7('0x31')](function(_0x59422b){_0x18bd1f=_0x59422b;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x42c7('0x31')](function(_0x27acbe){var _0x56a9f8=fs[_0x42c7('0x54')](path[_0x42c7('0x55')](config[_0x42c7('0x56')],_0x42c7('0x57')),'utf8');var _0x3a11da=ejs[_0x42c7('0x58')](_0x56a9f8,{'contexts':_0x27acbe||[]});fs[_0x42c7('0x59')](_0x42c7('0x5a'),_0x3a11da);})[_0x42c7('0x31')](function(){return respondWithRpcPromise(_0x42c7('0x5b'),'create',{'module':_0x42c7('0x5c')});})[_0x42c7('0x31')](function(){var _0x20fa12=_0x207571[_0x42c7('0x5d')]['get']({'plain':!![]});if(!_0x20fa12)throw new Error(_0x42c7('0x5e'));if(_0x20fa12[_0x42c7('0x5f')]==='user'){var _0xa94e20=_0x18bd1f[_0x42c7('0x33')]({'plain':!![]});return db[_0x42c7('0x60')]['find']({'where':{'name':_0x42c7('0x34'),'userProfileId':_0x20fa12['userProfileId']},'raw':!![]})['then'](function(_0x4586d3){if(_0x4586d3&&_0x4586d3[_0x42c7('0x61')]===0x0){return db[_0x42c7('0x35')][_0x42c7('0x53')]({'name':_0xa94e20['name'],'resourceId':_0xa94e20['id'],'type':_0x4586d3[_0x42c7('0x36')],'sectionId':_0x4586d3['id']},{})['then'](function(){return _0x18bd1f;});}else{return _0x18bd1f;}})['catch'](function(_0xa943e){logger[_0x42c7('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa943e);throw _0xa943e;});}return _0x18bd1f;})[_0x42c7('0x31')](respondWithResult(_0x36317a,0xc9))[_0x42c7('0x24')](handleError(_0x36317a,null));};exports[_0x42c7('0x62')]=function(_0x28efbe,_0x464a9f,_0x399bed){var _0xfa5bc;return db[_0x42c7('0x39')][_0x42c7('0x52')]({'where':{'id':_0x28efbe[_0x42c7('0x51')]['id']}})[_0x42c7('0x31')](handleEntityNotFound(_0x464a9f,null))[_0x42c7('0x31')](saveUpdates(_0x28efbe['body'],null))[_0x42c7('0x31')](function(_0x597818){if(_0x597818){_0xfa5bc=_0x597818;return db['VoiceContext'][_0x42c7('0x63')]({'raw':!![]});}})['then'](function(_0x2fa3e9){var _0x1a0f27=fs[_0x42c7('0x54')](path[_0x42c7('0x55')](config[_0x42c7('0x56')],_0x42c7('0x57')),'utf8');var _0xe74995=ejs[_0x42c7('0x58')](_0x1a0f27,{'contexts':_0x2fa3e9||[]});fs[_0x42c7('0x59')](_0x42c7('0x5a'),_0xe74995);})[_0x42c7('0x31')](function(){return respondWithRpcPromise(_0x42c7('0x5b'),_0x42c7('0x62'),{'module':'chan_sip.so'});})[_0x42c7('0x31')](function(){return _0xfa5bc;})['then'](respondWithResult(_0x464a9f,null))['catch'](handleError(_0x464a9f,null));};exports['destroy']=function(_0x1b8b25,_0x4fda85,_0x5d4fde){var _0x1a18a4;return db[_0x42c7('0x39')][_0x42c7('0x52')]({'where':{'id':_0x1b8b25[_0x42c7('0x51')]['id']}})['then'](handleEntityNotFound(_0x4fda85,null))[_0x42c7('0x31')](removeEntity(_0x4fda85,null))['then'](function(){return db[_0x42c7('0x39')]['findAll']({'raw':!![]});})[_0x42c7('0x31')](function(_0x3a2d38){var _0x1998fd=fs[_0x42c7('0x54')](path[_0x42c7('0x55')](config[_0x42c7('0x56')],_0x42c7('0x57')),_0x42c7('0x64'));var _0x3b8bb0=ejs[_0x42c7('0x58')](_0x1998fd,{'contexts':_0x3a2d38});fs[_0x42c7('0x59')](_0x42c7('0x5a'),_0x3b8bb0);return respondWithRpcPromise(_0x42c7('0x5b'),_0x42c7('0x32'),{'module':_0x42c7('0x5c')});})[_0x42c7('0x24')](handleError(_0x4fda85,null));}; \ No newline at end of file +var _0x52a9=['get','role','find','userProfileId','autoAssociation','UserProfileResource','update','chan_sip.so','server/files/templates/context.ejs','utf8','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','destroy','Contexts','stack','name','index','VoiceContext','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','create','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user'];(function(_0x290470,_0x496bf5){var _0x18d68c=function(_0x31a7d2){while(--_0x31a7d2){_0x290470['push'](_0x290470['shift']());}};_0x18d68c(++_0x496bf5);}(_0x52a9,0x139));var _0x952a=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x52a9[_0x342700];return _0x53406f;};'use strict';var emlformat=require(_0x952a('0x0'));var rimraf=require(_0x952a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x952a('0x2'));var rp=require(_0x952a('0x3'));var moment=require('moment');var BPromise=require(_0x952a('0x4'));var Mustache=require(_0x952a('0x5'));var util=require(_0x952a('0x6'));var path=require(_0x952a('0x7'));var sox=require(_0x952a('0x8'));var csv=require(_0x952a('0x9'));var ejs=require(_0x952a('0xa'));var fs=require('fs');var fs_extra=require(_0x952a('0xb'));var _=require(_0x952a('0xc'));var squel=require(_0x952a('0xd'));var crypto=require(_0x952a('0xe'));var jsforce=require(_0x952a('0xf'));var deskjs=require(_0x952a('0x10'));var toCsv=require(_0x952a('0x9'));var querystring=require(_0x952a('0x11'));var Papa=require(_0x952a('0x12'));var Redis=require(_0x952a('0x13'));var authService=require(_0x952a('0x14'));var qs=require(_0x952a('0x15'));var as=require(_0x952a('0x16'));var hardwareService=require(_0x952a('0x17'));var logger=require(_0x952a('0x18'))(_0x952a('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x952a('0x1a'))['db'];var jayson=require(_0x952a('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ababb,_0x15e314,_0x523c0a,_0x519e50){return new BPromise(function(_0x103829,_0x55b770){var _0x58ec56=_0x519e50||client;return _0x58ec56[_0x952a('0x1c')](_0x5ababb,_0x523c0a)[_0x952a('0x1d')](function(_0x5edf9c){logger[_0x952a('0x1e')](_0x952a('0x1f'),_0x15e314,'request\x20sent');logger[_0x952a('0x20')](_0x952a('0x21'),_0x15e314,_0x952a('0x22'),JSON[_0x952a('0x23')](_0x5edf9c));if(_0x5edf9c[_0x952a('0x24')]){if(_0x5edf9c[_0x952a('0x24')]['code']===0x1f4){logger['error'](_0x952a('0x1f'),_0x15e314,_0x5edf9c[_0x952a('0x24')][_0x952a('0x25')]);return _0x55b770(_0x5edf9c['error'][_0x952a('0x25')]);}logger['error'](_0x952a('0x1f'),_0x15e314,_0x5edf9c[_0x952a('0x24')][_0x952a('0x25')]);return _0x103829(_0x5edf9c[_0x952a('0x24')]['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x15e314,'request\x20sent');_0x103829(_0x5edf9c['result'][_0x952a('0x25')]);}})[_0x952a('0x26')](function(_0x1e9323){logger['error'](_0x952a('0x1f'),_0x15e314,_0x1e9323);_0x55b770(_0x1e9323);});});}function respondWithStatusCode(_0x23eafc,_0x1b6afd){_0x1b6afd=_0x1b6afd||0xcc;return function(_0x35b31d){if(_0x35b31d){return _0x23eafc[_0x952a('0x27')](_0x1b6afd);}return _0x23eafc[_0x952a('0x28')](_0x1b6afd)[_0x952a('0x29')]();};}function respondWithResult(_0x540a20,_0x1f6cc3){_0x1f6cc3=_0x1f6cc3||0xc8;return function(_0x5c4d17){if(_0x5c4d17){return _0x540a20['status'](_0x1f6cc3)[_0x952a('0x2a')](_0x5c4d17);}};}function respondWithFilteredResult(_0x44e0db,_0x42a4d2){return function(_0x956b93){if(_0x956b93){var _0x1182d5=typeof _0x42a4d2['offset']===_0x952a('0x2b')&&typeof _0x42a4d2[_0x952a('0x2c')]===_0x952a('0x2b');var _0x3e786=_0x956b93[_0x952a('0x2d')];var _0x4f353d=_0x1182d5?0x0:_0x42a4d2[_0x952a('0x2e')];var _0x2b2527=_0x1182d5?_0x956b93[_0x952a('0x2d')]:_0x42a4d2[_0x952a('0x2e')]+_0x42a4d2[_0x952a('0x2c')];var _0x586a10;if(_0x2b2527>=_0x3e786){_0x2b2527=_0x3e786;_0x586a10=0xc8;}else{_0x586a10=0xce;}_0x44e0db[_0x952a('0x28')](_0x586a10);return _0x44e0db['set'](_0x952a('0x2f'),_0x4f353d+'-'+_0x2b2527+'/'+_0x3e786)[_0x952a('0x2a')](_0x956b93);}return null;};}function patchUpdates(_0x4d9430){return function(_0x195b3a){try{jsonpatch[_0x952a('0x30')](_0x195b3a,_0x4d9430,!![]);}catch(_0x4c56ef){return BPromise['reject'](_0x4c56ef);}return _0x195b3a[_0x952a('0x31')]();};}function saveUpdates(_0x14b11a,_0x26f7d9){return function(_0x17635d){if(_0x17635d){return _0x17635d['update'](_0x14b11a)['then'](function(_0x5e88de){return _0x5e88de;});}return null;};}function removeEntity(_0x1eddd5,_0x369241){return function(_0x1df0ba){if(_0x1df0ba){return _0x1df0ba[_0x952a('0x32')]()[_0x952a('0x1d')](function(){var _0x127535=_0x1df0ba['get']({'plain':!![]});var _0x3449c9=_0x952a('0x33');return db['UserProfileResource'][_0x952a('0x32')]({'where':{'type':_0x3449c9,'resourceId':_0x127535['id']}})[_0x952a('0x1d')](function(){return _0x1df0ba;});})[_0x952a('0x1d')](function(){_0x1eddd5[_0x952a('0x28')](0xcc)[_0x952a('0x29')]();});}};}function handleEntityNotFound(_0x599322,_0x76e838){return function(_0xbfef9a){if(!_0xbfef9a){_0x599322[_0x952a('0x27')](0x194);}return _0xbfef9a;};}function handleError(_0x1e912c,_0x47cc5f){_0x47cc5f=_0x47cc5f||0x1f4;return function(_0x22fd53){logger[_0x952a('0x24')](_0x22fd53[_0x952a('0x34')]);if(_0x22fd53[_0x952a('0x35')]){delete _0x22fd53['name'];}_0x1e912c['status'](_0x47cc5f)['send'](_0x22fd53);};}exports[_0x952a('0x36')]=function(_0x1da6cf,_0x32f0b0){var _0x3fa87e={},_0x5a6cfc={},_0x92413a={'count':0x0,'rows':[]};var _0x390fd6=_['map'](db[_0x952a('0x37')][_0x952a('0x38')],function(_0x33dde3){return{'name':_0x33dde3['fieldName'],'type':_0x33dde3['type'][_0x952a('0x39')]};});_0x5a6cfc[_0x952a('0x3a')]=_[_0x952a('0x3b')](_0x390fd6,_0x952a('0x35'));_0x5a6cfc[_0x952a('0x3c')]=_[_0x952a('0x3d')](_0x1da6cf[_0x952a('0x3c')]);_0x5a6cfc['filters']=_[_0x952a('0x3e')](_0x5a6cfc[_0x952a('0x3a')],_0x5a6cfc[_0x952a('0x3c')]);_0x3fa87e['attributes']=_[_0x952a('0x3e')](_0x5a6cfc[_0x952a('0x3a')],qs[_0x952a('0x3f')](_0x1da6cf[_0x952a('0x3c')][_0x952a('0x3f')]));_0x3fa87e[_0x952a('0x40')]=_0x3fa87e[_0x952a('0x40')][_0x952a('0x41')]?_0x3fa87e['attributes']:_0x5a6cfc[_0x952a('0x3a')];if(!_0x1da6cf[_0x952a('0x3c')][_0x952a('0x42')](_0x952a('0x43'))){_0x3fa87e[_0x952a('0x2c')]=qs[_0x952a('0x2c')](_0x1da6cf[_0x952a('0x3c')]['limit']);_0x3fa87e[_0x952a('0x2e')]=qs[_0x952a('0x2e')](_0x1da6cf[_0x952a('0x3c')][_0x952a('0x2e')]);}_0x3fa87e[_0x952a('0x44')]=qs['sort'](_0x1da6cf['query'][_0x952a('0x45')]);_0x3fa87e[_0x952a('0x46')]=qs['filters'](_[_0x952a('0x47')](_0x1da6cf[_0x952a('0x3c')],_0x5a6cfc['filters']),_0x390fd6);if(_0x1da6cf[_0x952a('0x3c')][_0x952a('0x48')]){_0x3fa87e[_0x952a('0x46')]=_[_0x952a('0x49')](_0x3fa87e[_0x952a('0x46')],{'$or':_[_0x952a('0x3b')](_0x390fd6,function(_0x287398){if(_0x287398[_0x952a('0x4a')]!==_0x952a('0x4b')){var _0x77e0a6={};_0x77e0a6[_0x287398[_0x952a('0x35')]]={'$like':'%'+_0x1da6cf[_0x952a('0x3c')][_0x952a('0x48')]+'%'};return _0x77e0a6;}})});}_0x3fa87e=_['merge']({},_0x3fa87e,_0x1da6cf[_0x952a('0x4c')]);var _0x3d14e8={'where':_0x3fa87e[_0x952a('0x46')]};return db[_0x952a('0x37')][_0x952a('0x2d')](_0x3d14e8)[_0x952a('0x1d')](function(_0x2b2d30){_0x92413a[_0x952a('0x2d')]=_0x2b2d30;if(_0x1da6cf[_0x952a('0x3c')][_0x952a('0x4d')]){_0x3fa87e[_0x952a('0x4e')]=[{'all':!![]}];}return db['VoiceContext'][_0x952a('0x4f')](_0x3fa87e);})['then'](function(_0x4e8a8e){_0x92413a[_0x952a('0x50')]=_0x4e8a8e;return _0x92413a;})[_0x952a('0x1d')](respondWithFilteredResult(_0x32f0b0,_0x3fa87e))['catch'](handleError(_0x32f0b0,null));};exports['show']=function(_0x4504e6,_0x8f8b9e){var _0xdb4e9e={'raw':![],'where':{'id':_0x4504e6[_0x952a('0x51')]['id']}},_0x5dbd5a={};_0x5dbd5a[_0x952a('0x3a')]=_[_0x952a('0x3d')](db['VoiceContext'][_0x952a('0x38')]);_0x5dbd5a[_0x952a('0x3c')]=_[_0x952a('0x3d')](_0x4504e6[_0x952a('0x3c')]);_0x5dbd5a['filters']=_[_0x952a('0x3e')](_0x5dbd5a['model'],_0x5dbd5a[_0x952a('0x3c')]);_0xdb4e9e['attributes']=_['intersection'](_0x5dbd5a[_0x952a('0x3a')],qs[_0x952a('0x3f')](_0x4504e6[_0x952a('0x3c')][_0x952a('0x3f')]));_0xdb4e9e[_0x952a('0x40')]=_0xdb4e9e[_0x952a('0x40')][_0x952a('0x41')]?_0xdb4e9e['attributes']:_0x5dbd5a[_0x952a('0x3a')];if(_0x4504e6[_0x952a('0x3c')][_0x952a('0x4d')]){_0xdb4e9e[_0x952a('0x4e')]=[{'all':!![]}];}_0xdb4e9e=_[_0x952a('0x49')]({},_0xdb4e9e,_0x4504e6[_0x952a('0x4c')]);return db[_0x952a('0x37')]['find'](_0xdb4e9e)['then'](handleEntityNotFound(_0x8f8b9e,null))['then'](respondWithResult(_0x8f8b9e,null))[_0x952a('0x26')](handleError(_0x8f8b9e,null));};exports[_0x952a('0x52')]=function(_0x4f1834,_0x5ba6e0,_0x636b8d){var _0x22277b;return db[_0x952a('0x37')][_0x952a('0x52')](_0x4f1834['body'],{'raw':!![]})[_0x952a('0x1d')](function(_0x5ce2ca){_0x22277b=_0x5ce2ca;return db[_0x952a('0x37')][_0x952a('0x4f')]({'raw':!![]});})['then'](function(_0x2f5004){var _0x3f176d=fs[_0x952a('0x53')](path[_0x952a('0x54')](config[_0x952a('0x55')],'server/files/templates/context.ejs'),'utf8');var _0x1b0ede=ejs[_0x952a('0x56')](_0x3f176d,{'contexts':_0x2f5004||[]});fs[_0x952a('0x57')](_0x952a('0x58'),_0x1b0ede);})['then'](function(){return respondWithRpcPromise(_0x952a('0x59'),'create',{'module':'chan_sip.so'});})[_0x952a('0x1d')](function(){var _0x691bde=_0x4f1834[_0x952a('0x5a')][_0x952a('0x5b')]({'plain':!![]});if(!_0x691bde)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x691bde[_0x952a('0x5c')]==='user'){var _0x4600d3=_0x22277b[_0x952a('0x5b')]({'plain':!![]});return db['UserProfileSection'][_0x952a('0x5d')]({'where':{'name':_0x952a('0x33'),'userProfileId':_0x691bde[_0x952a('0x5e')]},'raw':!![]})[_0x952a('0x1d')](function(_0x1e5065){if(_0x1e5065&&_0x1e5065[_0x952a('0x5f')]===0x0){return db[_0x952a('0x60')]['create']({'name':_0x4600d3['name'],'resourceId':_0x4600d3['id'],'type':_0x1e5065[_0x952a('0x35')],'sectionId':_0x1e5065['id']},{})[_0x952a('0x1d')](function(){return _0x22277b;});}else{return _0x22277b;}})[_0x952a('0x26')](function(_0x2d1c60){logger[_0x952a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d1c60);throw _0x2d1c60;});}return _0x22277b;})[_0x952a('0x1d')](respondWithResult(_0x5ba6e0,0xc9))[_0x952a('0x26')](handleError(_0x5ba6e0,null));};exports[_0x952a('0x61')]=function(_0x40d022,_0x441733,_0x5349ca){var _0x37fdcc;return db[_0x952a('0x37')][_0x952a('0x5d')]({'where':{'id':_0x40d022[_0x952a('0x51')]['id']}})['then'](handleEntityNotFound(_0x441733,null))[_0x952a('0x1d')](saveUpdates(_0x40d022['body'],null))['then'](function(_0xdee91a){if(_0xdee91a){_0x37fdcc=_0xdee91a;return db[_0x952a('0x37')]['findAll']({'raw':!![]});}})[_0x952a('0x1d')](function(_0x1ef26f){var _0x27fdcc=fs['readFileSync'](path[_0x952a('0x54')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x3e69e6=ejs[_0x952a('0x56')](_0x27fdcc,{'contexts':_0x1ef26f||[]});fs[_0x952a('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3e69e6);})[_0x952a('0x1d')](function(){return respondWithRpcPromise(_0x952a('0x59'),'update',{'module':_0x952a('0x62')});})[_0x952a('0x1d')](function(){return _0x37fdcc;})[_0x952a('0x1d')](respondWithResult(_0x441733,null))[_0x952a('0x26')](handleError(_0x441733,null));};exports['destroy']=function(_0x585a25,_0x36b0a0,_0x5a79db){var _0x267226;return db[_0x952a('0x37')][_0x952a('0x5d')]({'where':{'id':_0x585a25[_0x952a('0x51')]['id']}})[_0x952a('0x1d')](handleEntityNotFound(_0x36b0a0,null))[_0x952a('0x1d')](removeEntity(_0x36b0a0,null))[_0x952a('0x1d')](function(){return db[_0x952a('0x37')][_0x952a('0x4f')]({'raw':!![]});})[_0x952a('0x1d')](function(_0x544159){var _0x55f0e0=fs[_0x952a('0x53')](path['join'](config['root'],_0x952a('0x63')),_0x952a('0x64'));var _0x587026=ejs[_0x952a('0x56')](_0x55f0e0,{'contexts':_0x544159});fs[_0x952a('0x57')](_0x952a('0x58'),_0x587026);return respondWithRpcPromise(_0x952a('0x59'),_0x952a('0x32'),{'module':_0x952a('0x62')});})[_0x952a('0x26')](handleError(_0x36b0a0,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 445a61c..679c952 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 _0x26c8=['voice_contexts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define'];(function(_0x10553a,_0x3f5022){var _0x45868c=function(_0x53784c){while(--_0x53784c){_0x10553a['push'](_0x10553a['shift']());}};_0x45868c(++_0x3f5022);}(_0x26c8,0x91));var _0x826c=function(_0x2a7826,_0x4b6d8e){_0x2a7826=_0x2a7826-0x0;var _0x37f848=_0x26c8[_0x2a7826];return _0x37f848;};'use strict';var _=require(_0x826c('0x0'));var util=require(_0x826c('0x1'));var logger=require(_0x826c('0x2'))(_0x826c('0x3'));var moment=require('moment');var BPromise=require(_0x826c('0x4'));var rp=require(_0x826c('0x5'));var fs=require('fs');var path=require(_0x826c('0x6'));var rimraf=require(_0x826c('0x7'));var config=require('../../config/environment');var attributes=require(_0x826c('0x8'));module[_0x826c('0x9')]=function(_0x5ea858,_0x5e515f){return _0x5ea858[_0x826c('0xa')]('VoiceContext',attributes,{'tableName':_0x826c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdf6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger'];(function(_0x5d5648,_0x50498d){var _0x43337c=function(_0x4b970f){while(--_0x4b970f){_0x5d5648['push'](_0x5d5648['shift']());}};_0x43337c(++_0x50498d);}(_0xcdf6,0xb3));var _0x6cdf=function(_0x7880d7,_0x59eb91){_0x7880d7=_0x7880d7-0x0;var _0x4f05e7=_0xcdf6[_0x7880d7];return _0x4f05e7;};'use strict';var _=require(_0x6cdf('0x0'));var util=require(_0x6cdf('0x1'));var logger=require(_0x6cdf('0x2'))('api');var moment=require(_0x6cdf('0x3'));var BPromise=require(_0x6cdf('0x4'));var rp=require(_0x6cdf('0x5'));var fs=require('fs');var path=require(_0x6cdf('0x6'));var rimraf=require(_0x6cdf('0x7'));var config=require(_0x6cdf('0x8'));var attributes=require(_0x6cdf('0x9'));module[_0x6cdf('0xa')]=function(_0x52176f,_0x3599e7){return _0x52176f[_0x6cdf('0xb')](_0x6cdf('0xc'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 67f6eee..2227647 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 _0x5ed0=['VoiceContext,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x21e59d,_0x4fe94a){var _0x439dd1=function(_0x25232b){while(--_0x25232b){_0x21e59d['push'](_0x21e59d['shift']());}};_0x439dd1(++_0x4fe94a);}(_0x5ed0,0xcb));var _0x05ed=function(_0x57171b,_0xfe67c6){_0x57171b=_0x57171b-0x0;var _0x33a2c8=_0x5ed0[_0x57171b];return _0x33a2c8;};'use strict';var _=require('lodash');var util=require(_0x05ed('0x0'));var moment=require(_0x05ed('0x1'));var BPromise=require(_0x05ed('0x2'));var rs=require(_0x05ed('0x3'));var fs=require('fs');var Redis=require(_0x05ed('0x4'));var db=require(_0x05ed('0x5'))['db'];var utils=require(_0x05ed('0x6'));var logger=require(_0x05ed('0x7'))('rpc');var config=require(_0x05ed('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x05ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7d2372,_0x31bfa4,_0x3d472e){return new BPromise(function(_0x1dbd21,_0x4d50bb){return client[_0x05ed('0xa')](_0x7d2372,_0x3d472e)['then'](function(_0x37cd75){logger[_0x05ed('0xb')]('VoiceContext,\x20%s,\x20%s',_0x31bfa4,_0x05ed('0xc'));logger[_0x05ed('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x31bfa4,_0x05ed('0xc'),JSON[_0x05ed('0xe')](_0x37cd75));if(_0x37cd75[_0x05ed('0xf')]){if(_0x37cd75[_0x05ed('0xf')][_0x05ed('0x10')]===0x1f4){logger[_0x05ed('0xf')](_0x05ed('0x11'),_0x31bfa4,_0x37cd75['error']['message']);return _0x4d50bb(_0x37cd75['error'][_0x05ed('0x12')]);}logger[_0x05ed('0xf')](_0x05ed('0x11'),_0x31bfa4,_0x37cd75['error'][_0x05ed('0x12')]);return _0x1dbd21(_0x37cd75[_0x05ed('0xf')][_0x05ed('0x12')]);}else{logger[_0x05ed('0xb')]('VoiceContext,\x20%s,\x20%s',_0x31bfa4,_0x05ed('0xc'));_0x1dbd21(_0x37cd75[_0x05ed('0x13')][_0x05ed('0x12')]);}})['catch'](function(_0x18a79d){logger[_0x05ed('0xf')]('VoiceContext,\x20%s,\x20%s',_0x31bfa4,_0x18a79d);_0x4d50bb(_0x18a79d);});});} \ No newline at end of file +var _0x1794=['jayson/promise','client','http','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x548503,_0x1aa00c){var _0xf8f05f=function(_0x2014c2){while(--_0x2014c2){_0x548503['push'](_0x548503['shift']());}};_0xf8f05f(++_0x1aa00c);}(_0x1794,0x19d));var _0x4179=function(_0x391900,_0x1a74f6){_0x391900=_0x391900-0x0;var _0x127094=_0x1794[_0x391900];return _0x127094;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4179('0x0'));var BPromise=require(_0x4179('0x1'));var rs=require(_0x4179('0x2'));var fs=require('fs');var Redis=require(_0x4179('0x3'));var db=require(_0x4179('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4179('0x5'));var config=require(_0x4179('0x6'));var jayson=require(_0x4179('0x7'));var client=jayson[_0x4179('0x8')][_0x4179('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x840dda,_0xcfdd0b,_0x24f3ff){return new BPromise(function(_0x45d2c9,_0x3fdaff){return client['request'](_0x840dda,_0x24f3ff)[_0x4179('0xa')](function(_0x1e52a6){logger[_0x4179('0xb')]('VoiceContext,\x20%s,\x20%s',_0xcfdd0b,_0x4179('0xc'));logger['debug'](_0x4179('0xd'),_0xcfdd0b,'request\x20sent',JSON[_0x4179('0xe')](_0x1e52a6));if(_0x1e52a6['error']){if(_0x1e52a6[_0x4179('0xf')][_0x4179('0x10')]===0x1f4){logger[_0x4179('0xf')]('VoiceContext,\x20%s,\x20%s',_0xcfdd0b,_0x1e52a6[_0x4179('0xf')]['message']);return _0x3fdaff(_0x1e52a6[_0x4179('0xf')][_0x4179('0x11')]);}logger['error'](_0x4179('0x12'),_0xcfdd0b,_0x1e52a6[_0x4179('0xf')]['message']);return _0x45d2c9(_0x1e52a6[_0x4179('0xf')][_0x4179('0x11')]);}else{logger[_0x4179('0xb')](_0x4179('0x12'),_0xcfdd0b,_0x4179('0xc'));_0x45d2c9(_0x1e52a6[_0x4179('0x13')][_0x4179('0x11')]);}})[_0x4179('0x14')](function(_0x2b82d0){logger[_0x4179('0xf')](_0x4179('0x12'),_0xcfdd0b,_0x2b82d0);_0x3fdaff(_0x2b82d0);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 847b5f4..d316e02 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 _0x2524=['describe','/:id','show','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x1ba9f9,_0x249b1e){var _0x217b02=function(_0x4a7075){while(--_0x4a7075){_0x1ba9f9['push'](_0x1ba9f9['shift']());}};_0x217b02(++_0x249b1e);}(_0x2524,0x8c));var _0x4252=function(_0xc6dc3,_0x4541e2){_0xc6dc3=_0xc6dc3-0x0;var _0x55937d=_0x2524[_0xc6dc3];return _0x55937d;};'use strict';var multer=require(_0x4252('0x0'));var util=require(_0x4252('0x1'));var path=require('path');var timeout=require(_0x4252('0x2'));var express=require(_0x4252('0x3'));var router=express[_0x4252('0x4')]();var fs_extra=require(_0x4252('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4252('0x6'));var config=require(_0x4252('0x7'));var controller=require('./voiceDialReport.controller');router[_0x4252('0x8')]('/',auth[_0x4252('0x9')](),controller[_0x4252('0xa')]);router[_0x4252('0x8')](_0x4252('0xb'),auth[_0x4252('0x9')](),controller[_0x4252('0xc')]);router[_0x4252('0x8')](_0x4252('0xd'),auth[_0x4252('0x9')](),controller[_0x4252('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4252('0xf')]);router['put']('/:id',auth[_0x4252('0x9')](),controller[_0x4252('0x10')]);router[_0x4252('0x11')](_0x4252('0xd'),auth[_0x4252('0x9')](),controller['destroy']);module[_0x4252('0x12')]=router; \ No newline at end of file +var _0xb145=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer'];(function(_0x487f3a,_0x2cd116){var _0x2c4d7b=function(_0x3e42b4){while(--_0x3e42b4){_0x487f3a['push'](_0x487f3a['shift']());}};_0x2c4d7b(++_0x2cd116);}(_0xb145,0x15f));var _0x5b14=function(_0x18d177,_0x5eef29){_0x18d177=_0x18d177-0x0;var _0x53fb81=_0xb145[_0x18d177];return _0x53fb81;};'use strict';var multer=require(_0x5b14('0x0'));var util=require(_0x5b14('0x1'));var path=require('path');var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require(_0x5b14('0x8'));var controller=require(_0x5b14('0x9'));router[_0x5b14('0xa')]('/',auth[_0x5b14('0xb')](),controller[_0x5b14('0xc')]);router[_0x5b14('0xa')](_0x5b14('0xd'),auth[_0x5b14('0xb')](),controller[_0x5b14('0xe')]);router[_0x5b14('0xa')](_0x5b14('0xf'),auth[_0x5b14('0xb')](),controller[_0x5b14('0x10')]);router['post']('/',auth[_0x5b14('0xb')](),controller[_0x5b14('0x11')]);router[_0x5b14('0x12')](_0x5b14('0xf'),auth[_0x5b14('0xb')](),controller[_0x5b14('0x13')]);router[_0x5b14('0x14')](_0x5b14('0xf'),auth[_0x5b14('0xb')](),controller['destroy']);module[_0x5b14('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3005664..6bf996e 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 _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file +var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x48c938,_0x14ac2c){var _0x5625b2=function(_0x3edffd){while(--_0x3edffd){_0x48c938['push'](_0x48c938['shift']());}};_0x5625b2(++_0x14ac2c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2fde33,_0x1e0652){_0x2fde33=_0x2fde33-0x0;var _0x4d2075=_0xe5b3[_0x2fde33];return _0x4d2075;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 24ce925..0297802 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 _0x0f67=['count','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','VoiceDialReport','rawAttributes','type','key','map','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','then','rows','catch','show','params','includeAll','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x533deb,_0x13d177){var _0x2efe05=function(_0x390f7e){while(--_0x390f7e){_0x533deb['push'](_0x533deb['shift']());}};_0x2efe05(++_0x13d177);}(_0x0f67,0x77));var _0x70f6=function(_0x46226d,_0x289805){_0x46226d=_0x46226d-0x0;var _0x5cb476=_0x0f67[_0x46226d];return _0x5cb476;};'use strict';var emlformat=require(_0x70f6('0x0'));var rimraf=require(_0x70f6('0x1'));var zipdir=require(_0x70f6('0x2'));var jsonpatch=require(_0x70f6('0x3'));var rp=require(_0x70f6('0x4'));var moment=require(_0x70f6('0x5'));var BPromise=require(_0x70f6('0x6'));var Mustache=require(_0x70f6('0x7'));var util=require(_0x70f6('0x8'));var path=require(_0x70f6('0x9'));var sox=require(_0x70f6('0xa'));var csv=require(_0x70f6('0xb'));var ejs=require(_0x70f6('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x70f6('0xd'));var crypto=require(_0x70f6('0xe'));var jsforce=require(_0x70f6('0xf'));var deskjs=require(_0x70f6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x70f6('0x11'));var Papa=require('papaparse');var Redis=require(_0x70f6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x70f6('0x13'));var as=require(_0x70f6('0x14'));var hardwareService=require(_0x70f6('0x15'));var logger=require('../../config/logger')(_0x70f6('0x16'));var utils=require(_0x70f6('0x17'));var config=require(_0x70f6('0x18'));var licenseUtil=require(_0x70f6('0x19'));var db=require(_0x70f6('0x1a'))['db'];function respondWithStatusCode(_0x42d9b1,_0x210e82){_0x210e82=_0x210e82||0xcc;return function(_0x15ea46){if(_0x15ea46){return _0x42d9b1[_0x70f6('0x1b')](_0x210e82);}return _0x42d9b1[_0x70f6('0x1c')](_0x210e82)[_0x70f6('0x1d')]();};}function respondWithResult(_0x1b16a2,_0x27f701){_0x27f701=_0x27f701||0xc8;return function(_0x2a62d2){if(_0x2a62d2){return _0x1b16a2['status'](_0x27f701)[_0x70f6('0x1e')](_0x2a62d2);}};}function respondWithFilteredResult(_0x45234a,_0xc2c8b5){return function(_0x186aef){if(_0x186aef){var _0x5ab658=typeof _0xc2c8b5[_0x70f6('0x1f')]===_0x70f6('0x20')&&typeof _0xc2c8b5['limit']===_0x70f6('0x20');var _0x45939d=_0x186aef[_0x70f6('0x21')];var _0x4c2516=_0x5ab658?0x0:_0xc2c8b5[_0x70f6('0x1f')];var _0x48f7d1=_0x5ab658?_0x186aef['count']:_0xc2c8b5[_0x70f6('0x1f')]+_0xc2c8b5[_0x70f6('0x22')];var _0x58115c;if(_0x48f7d1>=_0x45939d){_0x48f7d1=_0x45939d;_0x58115c=0xc8;}else{_0x58115c=0xce;}_0x45234a[_0x70f6('0x1c')](_0x58115c);return _0x45234a[_0x70f6('0x23')](_0x70f6('0x24'),_0x4c2516+'-'+_0x48f7d1+'/'+_0x45939d)[_0x70f6('0x1e')](_0x186aef);}return null;};}function patchUpdates(_0x160945){return function(_0x22a702){try{jsonpatch[_0x70f6('0x25')](_0x22a702,_0x160945,!![]);}catch(_0x6148ca){return BPromise[_0x70f6('0x26')](_0x6148ca);}return _0x22a702[_0x70f6('0x27')]();};}function saveUpdates(_0x15444b,_0x199862){return function(_0x5a2a2f){if(_0x5a2a2f){return _0x5a2a2f['update'](_0x15444b)['then'](function(_0x34c821){return _0x34c821;});}return null;};}function removeEntity(_0x33bd1f,_0x19b93f){return function(_0x474e40){if(_0x474e40){return _0x474e40[_0x70f6('0x28')]()['then'](function(){_0x33bd1f[_0x70f6('0x1c')](0xcc)[_0x70f6('0x1d')]();});}};}function handleEntityNotFound(_0x4caba7,_0x429c2e){return function(_0x574b80){if(!_0x574b80){_0x4caba7[_0x70f6('0x1b')](0x194);}return _0x574b80;};}function handleError(_0x58d232,_0x28d32a){_0x28d32a=_0x28d32a||0x1f4;return function(_0xa3e71e){logger[_0x70f6('0x29')](_0xa3e71e[_0x70f6('0x2a')]);if(_0xa3e71e[_0x70f6('0x2b')]){delete _0xa3e71e[_0x70f6('0x2b')];}_0x58d232[_0x70f6('0x1c')](_0x28d32a)[_0x70f6('0x2c')](_0xa3e71e);};}exports['index']=function(_0x428a8f,_0x57d798){var _0x57f04d={},_0x2e9e65={},_0x35cac3={'count':0x0,'rows':[]};var _0x105a28=_['map'](db[_0x70f6('0x2d')][_0x70f6('0x2e')],function(_0x48014c){return{'name':_0x48014c['fieldName'],'type':_0x48014c[_0x70f6('0x2f')][_0x70f6('0x30')]};});_0x2e9e65['model']=_[_0x70f6('0x31')](_0x105a28,'name');_0x2e9e65['query']=_[_0x70f6('0x32')](_0x428a8f[_0x70f6('0x33')]);_0x2e9e65['filters']=_[_0x70f6('0x34')](_0x2e9e65[_0x70f6('0x35')],_0x2e9e65['query']);_0x57f04d['attributes']=_[_0x70f6('0x34')](_0x2e9e65['model'],qs[_0x70f6('0x36')](_0x428a8f[_0x70f6('0x33')]['fields']));_0x57f04d[_0x70f6('0x37')]=_0x57f04d[_0x70f6('0x37')]['length']?_0x57f04d[_0x70f6('0x37')]:_0x2e9e65[_0x70f6('0x35')];if(!_0x428a8f['query'][_0x70f6('0x38')](_0x70f6('0x39'))){_0x57f04d[_0x70f6('0x22')]=qs[_0x70f6('0x22')](_0x428a8f[_0x70f6('0x33')]['limit']);_0x57f04d[_0x70f6('0x1f')]=qs['offset'](_0x428a8f[_0x70f6('0x33')][_0x70f6('0x1f')]);}_0x57f04d[_0x70f6('0x3a')]=qs[_0x70f6('0x3b')](_0x428a8f['query'][_0x70f6('0x3b')]);_0x57f04d[_0x70f6('0x3c')]=qs[_0x70f6('0x3d')](_[_0x70f6('0x3e')](_0x428a8f['query'],_0x2e9e65['filters']),_0x105a28);if(_0x428a8f[_0x70f6('0x33')][_0x70f6('0x3f')]){_0x57f04d['where']=_['merge'](_0x57f04d['where'],{'$or':_[_0x70f6('0x31')](_0x105a28,function(_0x1a0a39){if(_0x1a0a39['type']!==_0x70f6('0x40')){var _0x384cbc={};_0x384cbc[_0x1a0a39[_0x70f6('0x2b')]]={'$like':'%'+_0x428a8f[_0x70f6('0x33')][_0x70f6('0x3f')]+'%'};return _0x384cbc;}})});}_0x57f04d=_[_0x70f6('0x41')]({},_0x57f04d,_0x428a8f[_0x70f6('0x42')]);var _0x2d108e={'where':_0x57f04d[_0x70f6('0x3c')]};return db[_0x70f6('0x2d')][_0x70f6('0x21')](_0x2d108e)['then'](function(_0x4e9b22){_0x35cac3['count']=_0x4e9b22;if(_0x428a8f[_0x70f6('0x33')]['includeAll']){_0x57f04d[_0x70f6('0x43')]=[{'all':!![]}];}return db[_0x70f6('0x2d')]['findAll'](_0x57f04d);})[_0x70f6('0x44')](function(_0x251406){_0x35cac3[_0x70f6('0x45')]=_0x251406;return _0x35cac3;})['then'](respondWithFilteredResult(_0x57d798,_0x57f04d))[_0x70f6('0x46')](handleError(_0x57d798,null));};exports[_0x70f6('0x47')]=function(_0x400f3a,_0x38cd33){var _0x2e75d0={'raw':!![],'where':{'id':_0x400f3a[_0x70f6('0x48')]['id']}},_0x210d4d={};_0x210d4d[_0x70f6('0x35')]=_[_0x70f6('0x32')](db['VoiceDialReport'][_0x70f6('0x2e')]);_0x210d4d[_0x70f6('0x33')]=_[_0x70f6('0x32')](_0x400f3a['query']);_0x210d4d[_0x70f6('0x3d')]=_[_0x70f6('0x34')](_0x210d4d['model'],_0x210d4d['query']);_0x2e75d0[_0x70f6('0x37')]=_[_0x70f6('0x34')](_0x210d4d[_0x70f6('0x35')],qs['fields'](_0x400f3a[_0x70f6('0x33')][_0x70f6('0x36')]));_0x2e75d0[_0x70f6('0x37')]=_0x2e75d0['attributes']['length']?_0x2e75d0[_0x70f6('0x37')]:_0x210d4d[_0x70f6('0x35')];if(_0x400f3a[_0x70f6('0x33')][_0x70f6('0x49')]){_0x2e75d0[_0x70f6('0x43')]=[{'all':!![]}];}_0x2e75d0=_[_0x70f6('0x41')]({},_0x2e75d0,_0x400f3a[_0x70f6('0x42')]);return db[_0x70f6('0x2d')][_0x70f6('0x4a')](_0x2e75d0)[_0x70f6('0x44')](handleEntityNotFound(_0x38cd33,null))[_0x70f6('0x44')](respondWithResult(_0x38cd33,null))[_0x70f6('0x46')](handleError(_0x38cd33,null));};exports['create']=function(_0x507518,_0xc9646f){return db[_0x70f6('0x2d')]['create'](_0x507518[_0x70f6('0x4b')],{})['then'](respondWithResult(_0xc9646f,0xc9))['catch'](handleError(_0xc9646f,null));};exports['update']=function(_0x226a29,_0x4a54f9){if(_0x226a29[_0x70f6('0x4b')]['id']){delete _0x226a29[_0x70f6('0x4b')]['id'];}return db[_0x70f6('0x2d')][_0x70f6('0x4a')]({'where':{'id':_0x226a29[_0x70f6('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a54f9,null))[_0x70f6('0x44')](saveUpdates(_0x226a29[_0x70f6('0x4b')],null))['then'](respondWithResult(_0x4a54f9,null))[_0x70f6('0x46')](handleError(_0x4a54f9,null));};exports[_0x70f6('0x28')]=function(_0x47e46e,_0x13658d){return db[_0x70f6('0x2d')][_0x70f6('0x4a')]({'where':{'id':_0x47e46e[_0x70f6('0x48')]['id']}})[_0x70f6('0x44')](handleEntityNotFound(_0x13658d,null))['then'](removeEntity(_0x13658d,null))[_0x70f6('0x46')](handleError(_0x13658d,null));};exports['describe']=function(_0x2b0bb5,_0x292848){return db[_0x70f6('0x2d')]['describe']()[_0x70f6('0x44')](respondWithResult(_0x292848,null))[_0x70f6('0x46')](handleError(_0x292848,null));}; \ No newline at end of file +var _0x10b7=['sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','index','VoiceDialReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','length','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','params','fields','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x10b7,0x191));var _0x710b=function(_0x1bda96,_0x176bdd){_0x1bda96=_0x1bda96-0x0;var _0x20a36e=_0x10b7[_0x1bda96];return _0x20a36e;};'use strict';var emlformat=require(_0x710b('0x0'));var rimraf=require(_0x710b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x710b('0x2'));var rp=require(_0x710b('0x3'));var moment=require('moment');var BPromise=require(_0x710b('0x4'));var Mustache=require(_0x710b('0x5'));var util=require(_0x710b('0x6'));var path=require(_0x710b('0x7'));var sox=require(_0x710b('0x8'));var csv=require(_0x710b('0x9'));var ejs=require(_0x710b('0xa'));var fs=require('fs');var fs_extra=require(_0x710b('0xb'));var _=require(_0x710b('0xc'));var squel=require(_0x710b('0xd'));var crypto=require(_0x710b('0xe'));var jsforce=require(_0x710b('0xf'));var deskjs=require(_0x710b('0x10'));var toCsv=require(_0x710b('0x9'));var querystring=require('querystring');var Papa=require(_0x710b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x710b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x710b('0x13'));var logger=require(_0x710b('0x14'))(_0x710b('0x15'));var utils=require(_0x710b('0x16'));var config=require(_0x710b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x710b('0x18'))['db'];function respondWithStatusCode(_0x84155e,_0x436a16){_0x436a16=_0x436a16||0xcc;return function(_0x3028dd){if(_0x3028dd){return _0x84155e[_0x710b('0x19')](_0x436a16);}return _0x84155e['status'](_0x436a16)['end']();};}function respondWithResult(_0x29544b,_0x415cc8){_0x415cc8=_0x415cc8||0xc8;return function(_0x30f888){if(_0x30f888){return _0x29544b[_0x710b('0x1a')](_0x415cc8)[_0x710b('0x1b')](_0x30f888);}};}function respondWithFilteredResult(_0x382a34,_0x12cb89){return function(_0x102217){if(_0x102217){var _0x847b75=typeof _0x12cb89[_0x710b('0x1c')]===_0x710b('0x1d')&&typeof _0x12cb89[_0x710b('0x1e')]===_0x710b('0x1d');var _0xa34320=_0x102217[_0x710b('0x1f')];var _0x5b45df=_0x847b75?0x0:_0x12cb89[_0x710b('0x1c')];var _0x47e716=_0x847b75?_0x102217['count']:_0x12cb89[_0x710b('0x1c')]+_0x12cb89[_0x710b('0x1e')];var _0x308cb1;if(_0x47e716>=_0xa34320){_0x47e716=_0xa34320;_0x308cb1=0xc8;}else{_0x308cb1=0xce;}_0x382a34[_0x710b('0x1a')](_0x308cb1);return _0x382a34[_0x710b('0x20')]('Content-Range',_0x5b45df+'-'+_0x47e716+'/'+_0xa34320)['json'](_0x102217);}return null;};}function patchUpdates(_0x25067b){return function(_0x3e75cb){try{jsonpatch['apply'](_0x3e75cb,_0x25067b,!![]);}catch(_0x2b7587){return BPromise[_0x710b('0x21')](_0x2b7587);}return _0x3e75cb[_0x710b('0x22')]();};}function saveUpdates(_0x86b502,_0xcea7df){return function(_0x21c58d){if(_0x21c58d){return _0x21c58d[_0x710b('0x23')](_0x86b502)[_0x710b('0x24')](function(_0x4d8c2c){return _0x4d8c2c;});}return null;};}function removeEntity(_0x297f96,_0x12bd35){return function(_0x48c1af){if(_0x48c1af){return _0x48c1af[_0x710b('0x25')]()['then'](function(){_0x297f96[_0x710b('0x1a')](0xcc)[_0x710b('0x26')]();});}};}function handleEntityNotFound(_0x1b923a,_0x3a6142){return function(_0x427e7f){if(!_0x427e7f){_0x1b923a[_0x710b('0x19')](0x194);}return _0x427e7f;};}function handleError(_0x166c1b,_0x44bbfe){_0x44bbfe=_0x44bbfe||0x1f4;return function(_0x5eecd8){logger[_0x710b('0x27')](_0x5eecd8[_0x710b('0x28')]);if(_0x5eecd8[_0x710b('0x29')]){delete _0x5eecd8[_0x710b('0x29')];}_0x166c1b['status'](_0x44bbfe)['send'](_0x5eecd8);};}exports[_0x710b('0x2a')]=function(_0x3c3f84,_0x53ba78){var _0x19d33e={},_0x341441={},_0x7bb90f={'count':0x0,'rows':[]};var _0x3b1f3e=_['map'](db[_0x710b('0x2b')][_0x710b('0x2c')],function(_0x4d42a2){return{'name':_0x4d42a2[_0x710b('0x2d')],'type':_0x4d42a2['type'][_0x710b('0x2e')]};});_0x341441[_0x710b('0x2f')]=_[_0x710b('0x30')](_0x3b1f3e,_0x710b('0x29'));_0x341441['query']=_[_0x710b('0x31')](_0x3c3f84[_0x710b('0x32')]);_0x341441[_0x710b('0x33')]=_[_0x710b('0x34')](_0x341441[_0x710b('0x2f')],_0x341441[_0x710b('0x32')]);_0x19d33e['attributes']=_[_0x710b('0x34')](_0x341441['model'],qs['fields'](_0x3c3f84['query']['fields']));_0x19d33e[_0x710b('0x35')]=_0x19d33e[_0x710b('0x35')][_0x710b('0x36')]?_0x19d33e['attributes']:_0x341441[_0x710b('0x2f')];if(!_0x3c3f84[_0x710b('0x32')]['hasOwnProperty']('nolimit')){_0x19d33e['limit']=qs[_0x710b('0x1e')](_0x3c3f84[_0x710b('0x32')][_0x710b('0x1e')]);_0x19d33e[_0x710b('0x1c')]=qs['offset'](_0x3c3f84[_0x710b('0x32')][_0x710b('0x1c')]);}_0x19d33e['order']=qs[_0x710b('0x37')](_0x3c3f84['query']['sort']);_0x19d33e[_0x710b('0x38')]=qs[_0x710b('0x33')](_[_0x710b('0x39')](_0x3c3f84[_0x710b('0x32')],_0x341441[_0x710b('0x33')]),_0x3b1f3e);if(_0x3c3f84[_0x710b('0x32')][_0x710b('0x3a')]){_0x19d33e[_0x710b('0x38')]=_[_0x710b('0x3b')](_0x19d33e['where'],{'$or':_[_0x710b('0x30')](_0x3b1f3e,function(_0x50f070){if(_0x50f070[_0x710b('0x3c')]!=='VIRTUAL'){var _0x31578b={};_0x31578b[_0x50f070['name']]={'$like':'%'+_0x3c3f84[_0x710b('0x32')]['filter']+'%'};return _0x31578b;}})});}_0x19d33e=_[_0x710b('0x3b')]({},_0x19d33e,_0x3c3f84[_0x710b('0x3d')]);var _0x1ebdc7={'where':_0x19d33e[_0x710b('0x38')]};return db[_0x710b('0x2b')]['count'](_0x1ebdc7)[_0x710b('0x24')](function(_0x17f4d8){_0x7bb90f[_0x710b('0x1f')]=_0x17f4d8;if(_0x3c3f84[_0x710b('0x32')][_0x710b('0x3e')]){_0x19d33e[_0x710b('0x3f')]=[{'all':!![]}];}return db[_0x710b('0x2b')][_0x710b('0x40')](_0x19d33e);})[_0x710b('0x24')](function(_0x44bf64){_0x7bb90f['rows']=_0x44bf64;return _0x7bb90f;})[_0x710b('0x24')](respondWithFilteredResult(_0x53ba78,_0x19d33e))[_0x710b('0x41')](handleError(_0x53ba78,null));};exports['show']=function(_0x13a505,_0x15ac1a){var _0x209744={'raw':!![],'where':{'id':_0x13a505[_0x710b('0x42')]['id']}},_0x579758={};_0x579758[_0x710b('0x2f')]=_[_0x710b('0x31')](db['VoiceDialReport'][_0x710b('0x2c')]);_0x579758[_0x710b('0x32')]=_[_0x710b('0x31')](_0x13a505[_0x710b('0x32')]);_0x579758[_0x710b('0x33')]=_[_0x710b('0x34')](_0x579758[_0x710b('0x2f')],_0x579758[_0x710b('0x32')]);_0x209744[_0x710b('0x35')]=_[_0x710b('0x34')](_0x579758[_0x710b('0x2f')],qs[_0x710b('0x43')](_0x13a505[_0x710b('0x32')][_0x710b('0x43')]));_0x209744[_0x710b('0x35')]=_0x209744[_0x710b('0x35')]['length']?_0x209744[_0x710b('0x35')]:_0x579758[_0x710b('0x2f')];if(_0x13a505[_0x710b('0x32')][_0x710b('0x3e')]){_0x209744[_0x710b('0x3f')]=[{'all':!![]}];}_0x209744=_[_0x710b('0x3b')]({},_0x209744,_0x13a505[_0x710b('0x3d')]);return db[_0x710b('0x2b')]['find'](_0x209744)['then'](handleEntityNotFound(_0x15ac1a,null))[_0x710b('0x24')](respondWithResult(_0x15ac1a,null))['catch'](handleError(_0x15ac1a,null));};exports['create']=function(_0x56bea9,_0x1416ee){return db[_0x710b('0x2b')]['create'](_0x56bea9['body'],{})[_0x710b('0x24')](respondWithResult(_0x1416ee,0xc9))[_0x710b('0x41')](handleError(_0x1416ee,null));};exports[_0x710b('0x23')]=function(_0x16e438,_0x351b56){if(_0x16e438[_0x710b('0x44')]['id']){delete _0x16e438[_0x710b('0x44')]['id'];}return db['VoiceDialReport'][_0x710b('0x45')]({'where':{'id':_0x16e438[_0x710b('0x42')]['id']}})[_0x710b('0x24')](handleEntityNotFound(_0x351b56,null))[_0x710b('0x24')](saveUpdates(_0x16e438['body'],null))[_0x710b('0x24')](respondWithResult(_0x351b56,null))['catch'](handleError(_0x351b56,null));};exports['destroy']=function(_0x4a9f68,_0x3cb073){return db[_0x710b('0x2b')][_0x710b('0x45')]({'where':{'id':_0x4a9f68['params']['id']}})[_0x710b('0x24')](handleEntityNotFound(_0x3cb073,null))['then'](removeEntity(_0x3cb073,null))['catch'](handleError(_0x3cb073,null));};exports[_0x710b('0x46')]=function(_0x314c94,_0x177fb0){return db[_0x710b('0x2b')][_0x710b('0x46')]()[_0x710b('0x24')](respondWithResult(_0x177fb0,null))[_0x710b('0x41')](handleError(_0x177fb0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5e1145a..ef5638a 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 _0xdd5d=['report_dial','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport'];(function(_0x462493,_0x514ca0){var _0xda7448=function(_0x4a22a5){while(--_0x4a22a5){_0x462493['push'](_0x462493['shift']());}};_0xda7448(++_0x514ca0);}(_0xdd5d,0x1ae));var _0xddd5=function(_0x3b3941,_0x2767b3){_0x3b3941=_0x3b3941-0x0;var _0x7ce768=_0xdd5d[_0x3b3941];return _0x7ce768;};'use strict';var _=require(_0xddd5('0x0'));var util=require(_0xddd5('0x1'));var logger=require(_0xddd5('0x2'))(_0xddd5('0x3'));var moment=require('moment');var BPromise=require(_0xddd5('0x4'));var rp=require(_0xddd5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xddd5('0x6'));var config=require(_0xddd5('0x7'));var attributes=require(_0xddd5('0x8'));module[_0xddd5('0x9')]=function(_0x5d0aab,_0x1d889f){return _0x5d0aab[_0xddd5('0xa')](_0xddd5('0xb'),attributes,{'tableName':_0xddd5('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1433=['VoiceDialReport','report_dial','uniqueid','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1433,0x121));var _0x3143=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1433[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var logger=require('../../config/logger')(_0x3143('0x2'));var moment=require(_0x3143('0x3'));var BPromise=require(_0x3143('0x4'));var rp=require(_0x3143('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3143('0x6'));var attributes=require(_0x3143('0x7'));module[_0x3143('0x8')]=function(_0x216e7a,_0xe029e4){return _0x216e7a[_0x3143('0x9')](_0x3143('0xa'),attributes,{'tableName':_0x3143('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3143('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index df257dc..c8e7616 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 _0x5a6a=['info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','attributes','limit','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x956813,_0x4c2173){var _0x3ddbe8=function(_0x731f23){while(--_0x731f23){_0x956813['push'](_0x956813['shift']());}};_0x3ddbe8(++_0x4c2173);}(_0x5a6a,0x115));var _0xa5a6=function(_0x29d41e,_0x57b33b){_0x29d41e=_0x29d41e-0x0;var _0x1dc54b=_0x5a6a[_0x29d41e];return _0x1dc54b;};'use strict';var _=require(_0xa5a6('0x0'));var util=require(_0xa5a6('0x1'));var moment=require('moment');var BPromise=require(_0xa5a6('0x2'));var rs=require(_0xa5a6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa5a6('0x4'));var logger=require(_0xa5a6('0x5'))(_0xa5a6('0x6'));var config=require(_0xa5a6('0x7'));var jayson=require(_0xa5a6('0x8'));var client=jayson['client'][_0xa5a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25409e,_0x3c6e51,_0x3bc551){return new BPromise(function(_0x549ad4,_0x1b00d2){return client[_0xa5a6('0xa')](_0x25409e,_0x3bc551)[_0xa5a6('0xb')](function(_0x544a9f){logger['info'](_0xa5a6('0xc'),_0x3c6e51,_0xa5a6('0xd'));logger[_0xa5a6('0xe')](_0xa5a6('0xf'),_0x3c6e51,_0xa5a6('0xd'),JSON[_0xa5a6('0x10')](_0x544a9f));if(_0x544a9f[_0xa5a6('0x11')]){if(_0x544a9f[_0xa5a6('0x11')][_0xa5a6('0x12')]===0x1f4){logger['error'](_0xa5a6('0xc'),_0x3c6e51,_0x544a9f[_0xa5a6('0x11')][_0xa5a6('0x13')]);return _0x1b00d2(_0x544a9f[_0xa5a6('0x11')][_0xa5a6('0x13')]);}logger['error'](_0xa5a6('0xc'),_0x3c6e51,_0x544a9f[_0xa5a6('0x11')][_0xa5a6('0x13')]);return _0x549ad4(_0x544a9f[_0xa5a6('0x11')][_0xa5a6('0x13')]);}else{logger[_0xa5a6('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x3c6e51,'request\x20sent');_0x549ad4(_0x544a9f[_0xa5a6('0x15')][_0xa5a6('0x13')]);}})[_0xa5a6('0x16')](function(_0x4e080e){logger[_0xa5a6('0x11')](_0xa5a6('0xc'),_0x3c6e51,_0x4e080e);_0x1b00d2(_0x4e080e);});});}exports[_0xa5a6('0x17')]=function(_0x3444c7){var _0x304786=this;return new Promise(function(_0x223a2a,_0x2a9dc8){return db[_0xa5a6('0x18')][_0xa5a6('0x19')](_0x3444c7[_0xa5a6('0x1a')],{'raw':_0x3444c7[_0xa5a6('0x1b')]?_0x3444c7[_0xa5a6('0x1b')][_0xa5a6('0x1c')]===undefined?!![]:![]:!![]})[_0xa5a6('0xb')](function(_0x224c9a){logger[_0xa5a6('0x14')](_0xa5a6('0x17'),_0x3444c7);logger[_0xa5a6('0xe')]('CreateVoiceDialReport',_0x3444c7,JSON[_0xa5a6('0x10')](_0x224c9a));_0x223a2a(_0x224c9a);})[_0xa5a6('0x16')](function(_0x3cca53){logger[_0xa5a6('0x11')]('CreateVoiceDialReport',_0x3cca53['message'],_0x3444c7);_0x2a9dc8(_0x304786['error'](0x1f4,_0x3cca53[_0xa5a6('0x13')]));});});};exports[_0xa5a6('0x1d')]=function(_0x12f73d){var _0x1bbb5d=this;return new Promise(function(_0x1aa312,_0x4e8f8d){return db[_0xa5a6('0x18')][_0xa5a6('0x1e')](_0x12f73d['body'],{'raw':_0x12f73d[_0xa5a6('0x1b')]?_0x12f73d[_0xa5a6('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12f73d[_0xa5a6('0x1b')]?_0x12f73d[_0xa5a6('0x1b')]['where']||null:null,'attributes':_0x12f73d[_0xa5a6('0x1b')]?_0x12f73d[_0xa5a6('0x1b')][_0xa5a6('0x1f')]||null:null,'limit':_0x12f73d[_0xa5a6('0x1b')]?_0x12f73d[_0xa5a6('0x1b')][_0xa5a6('0x20')]||null:null})[_0xa5a6('0xb')](function(_0x56a848){logger['info']('UpdateVoiceDialReport',_0x12f73d);logger[_0xa5a6('0xe')](_0xa5a6('0x1d'),_0x12f73d,JSON[_0xa5a6('0x10')](_0x56a848));_0x1aa312(_0x56a848);})[_0xa5a6('0x16')](function(_0x48eb59){logger[_0xa5a6('0x11')](_0xa5a6('0x1d'),_0x48eb59['message'],_0x12f73d);_0x4e8f8d(_0x1bbb5d[_0xa5a6('0x11')](0x1f4,_0x48eb59[_0xa5a6('0x13')]));});});}; \ No newline at end of file +var _0xc7ef=['../../config/environment','jayson/promise','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceDialReport','create','body','options','raw','info','CreateVoiceDialReport','catch','where','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e0a2c,_0x8ef4eb){var _0x5ef0d9=function(_0x96e0f7){while(--_0x96e0f7){_0x5e0a2c['push'](_0x5e0a2c['shift']());}};_0x5ef0d9(++_0x8ef4eb);}(_0xc7ef,0x181));var _0xfc7e=function(_0x29f06b,_0x41b2b0){_0x29f06b=_0x29f06b-0x0;var _0x3081d2=_0xc7ef[_0x29f06b];return _0x3081d2;};'use strict';var _=require(_0xfc7e('0x0'));var util=require('util');var moment=require(_0xfc7e('0x1'));var BPromise=require(_0xfc7e('0x2'));var rs=require(_0xfc7e('0x3'));var fs=require('fs');var Redis=require(_0xfc7e('0x4'));var db=require(_0xfc7e('0x5'))['db'];var utils=require(_0xfc7e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfc7e('0x7'));var jayson=require(_0xfc7e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16d3e5,_0x6346da,_0x1a5ec3){return new BPromise(function(_0xef4902,_0x3d405f){return client['request'](_0x16d3e5,_0x1a5ec3)[_0xfc7e('0x9')](function(_0x106fa2){logger['info'](_0xfc7e('0xa'),_0x6346da,_0xfc7e('0xb'));logger[_0xfc7e('0xc')](_0xfc7e('0xd'),_0x6346da,_0xfc7e('0xb'),JSON[_0xfc7e('0xe')](_0x106fa2));if(_0x106fa2[_0xfc7e('0xf')]){if(_0x106fa2['error']['code']===0x1f4){logger[_0xfc7e('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x6346da,_0x106fa2['error']['message']);return _0x3d405f(_0x106fa2[_0xfc7e('0xf')][_0xfc7e('0x10')]);}logger['error'](_0xfc7e('0xa'),_0x6346da,_0x106fa2[_0xfc7e('0xf')][_0xfc7e('0x10')]);return _0xef4902(_0x106fa2[_0xfc7e('0xf')][_0xfc7e('0x10')]);}else{logger['info'](_0xfc7e('0xa'),_0x6346da,_0xfc7e('0xb'));_0xef4902(_0x106fa2[_0xfc7e('0x11')][_0xfc7e('0x10')]);}})['catch'](function(_0x45653e){logger[_0xfc7e('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x6346da,_0x45653e);_0x3d405f(_0x45653e);});});}exports['CreateVoiceDialReport']=function(_0x457b63){var _0x4f7a36=this;return new Promise(function(_0x44185a,_0xa28cd3){return db[_0xfc7e('0x12')][_0xfc7e('0x13')](_0x457b63[_0xfc7e('0x14')],{'raw':_0x457b63[_0xfc7e('0x15')]?_0x457b63[_0xfc7e('0x15')][_0xfc7e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xc39e26){logger[_0xfc7e('0x17')](_0xfc7e('0x18'),_0x457b63);logger[_0xfc7e('0xc')](_0xfc7e('0x18'),_0x457b63,JSON['stringify'](_0xc39e26));_0x44185a(_0xc39e26);})[_0xfc7e('0x19')](function(_0x1e89c8){logger[_0xfc7e('0xf')](_0xfc7e('0x18'),_0x1e89c8[_0xfc7e('0x10')],_0x457b63);_0xa28cd3(_0x4f7a36[_0xfc7e('0xf')](0x1f4,_0x1e89c8[_0xfc7e('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x4fcd2d){var _0x293e92=this;return new Promise(function(_0x87aad9,_0x56a9e2){return db[_0xfc7e('0x12')]['update'](_0x4fcd2d[_0xfc7e('0x14')],{'raw':_0x4fcd2d[_0xfc7e('0x15')]?_0x4fcd2d[_0xfc7e('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fcd2d['options']?_0x4fcd2d[_0xfc7e('0x15')][_0xfc7e('0x1a')]||null:null,'attributes':_0x4fcd2d['options']?_0x4fcd2d[_0xfc7e('0x15')]['attributes']||null:null,'limit':_0x4fcd2d[_0xfc7e('0x15')]?_0x4fcd2d['options']['limit']||null:null})['then'](function(_0x22405f){logger[_0xfc7e('0x17')](_0xfc7e('0x1b'),_0x4fcd2d);logger[_0xfc7e('0xc')](_0xfc7e('0x1b'),_0x4fcd2d,JSON['stringify'](_0x22405f));_0x87aad9(_0x22405f);})[_0xfc7e('0x19')](function(_0x43efd6){logger[_0xfc7e('0xf')](_0xfc7e('0x1b'),_0x43efd6[_0xfc7e('0x10')],_0x4fcd2d);_0x56a9e2(_0x293e92[_0xfc7e('0xf')](0x1f4,_0x43efd6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f7f1265..f2a6db6 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 _0x7746=['/:id','isAuthenticated','show','post','create','/:id/applications','put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceExtension.controller','index','get'];(function(_0xa98ed2,_0x445c86){var _0x55c8d5=function(_0x26f015){while(--_0x26f015){_0xa98ed2['push'](_0xa98ed2['shift']());}};_0x55c8d5(++_0x445c86);}(_0x7746,0x173));var _0x6774=function(_0x3e9113,_0x57cdf3){_0x3e9113=_0x3e9113-0x0;var _0x100de6=_0x7746[_0x3e9113];return _0x100de6;};'use strict';var multer=require('multer');var util=require(_0x6774('0x0'));var path=require(_0x6774('0x1'));var timeout=require(_0x6774('0x2'));var express=require(_0x6774('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6774('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6774('0x5'));var controller=require(_0x6774('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6774('0x7')]);router[_0x6774('0x8')](_0x6774('0x9'),auth[_0x6774('0xa')](),controller[_0x6774('0xb')]);router[_0x6774('0xc')]('/',auth[_0x6774('0xa')](),controller[_0x6774('0xd')]);router[_0x6774('0xc')](_0x6774('0xe'),auth[_0x6774('0xa')](),controller['addApplications']);router[_0x6774('0xf')](_0x6774('0x9'),auth['isAuthenticated'](),controller[_0x6774('0x10')]);router[_0x6774('0x11')](_0x6774('0x9'),auth[_0x6774('0xa')](),controller['destroy']);module[_0x6774('0x12')]=router; \ No newline at end of file +var _0xbfae=['express','Router','./voiceExtension.controller','get','isAuthenticated','index','show','post','create','/:id/applications','addApplications','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x249f8c,_0xfb3946){var _0x5e224a=function(_0xd4c5a1){while(--_0xd4c5a1){_0x249f8c['push'](_0x249f8c['shift']());}};_0x5e224a(++_0xfb3946);}(_0xbfae,0xa4));var _0xebfa=function(_0x22e010,_0x34c175){_0x22e010=_0x22e010-0x0;var _0x4c4c8a=_0xbfae[_0x22e010];return _0x4c4c8a;};'use strict';var multer=require(_0xebfa('0x0'));var util=require(_0xebfa('0x1'));var path=require(_0xebfa('0x2'));var timeout=require(_0xebfa('0x3'));var express=require(_0xebfa('0x4'));var router=express[_0xebfa('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xebfa('0x6'));router[_0xebfa('0x7')]('/',auth[_0xebfa('0x8')](),controller[_0xebfa('0x9')]);router[_0xebfa('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xebfa('0xa')]);router[_0xebfa('0xb')]('/',auth[_0xebfa('0x8')](),controller[_0xebfa('0xc')]);router['post'](_0xebfa('0xd'),auth[_0xebfa('0x8')](),controller[_0xebfa('0xe')]);router[_0xebfa('0xf')](_0xebfa('0x10'),auth[_0xebfa('0x8')](),controller[_0xebfa('0x11')]);router[_0xebfa('0x12')](_0xebfa('0x10'),auth[_0xebfa('0x8')](),controller[_0xebfa('0x13')]);module[_0xebfa('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 70fefe2..fb2ff08 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 _0xd8b0=['VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d8b('0x2')},'priority':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x0d8b('0x2')},'tag':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0d8b('0x4')](_0x0d8b('0x5'),_0x0d8b('0x6'),'internal',_0x0d8b('0x7'),_0x0d8b('0x8'),'system',_0x0d8b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0d8b('0x3')]},'interval':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':_0x0d8b('0xa')},'IntervalId':{'type':Sequelize[_0x0d8b('0xb')]},'isApp':{'type':Sequelize[_0x0d8b('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0d8b('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0xd')},'answer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(){return this[_0x0d8b('0xf')](_0x0d8b('0x10'));}}}; \ No newline at end of file +var _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x433ced,_0x40a770){var _0x4088e7=function(_0x160c12){while(--_0x160c12){_0x433ced['push'](_0x433ced['shift']());}};_0x4088e7(++_0x40a770);}(_0xe706,0xa3));var _0x6e70=function(_0x1bf639,_0x864d54){_0x1bf639=_0x1bf639-0x0;var _0x553079=_0xe706[_0x1bf639];return _0x553079;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 1ed84a8..7e853f9 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 _0xea7f=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','exten','concat','user','internal','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','end','status','json','offset','limit','count','set','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','ignore','map','value','find','type','name','error','stack','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea7f,0xe0));var _0xfea7=function(_0x2130e3,_0xa754ef){_0x2130e3=_0x2130e3-0x0;var _0xea07ba=_0xea7f[_0x2130e3];return _0xea07ba;};'use strict';var _=require(_0xfea7('0x0'));var Redis=require(_0xfea7('0x1'));var qs=require(_0xfea7('0x2'));var logger=require(_0xfea7('0x3'))('api');var config=require('../../config/environment');var db=require(_0xfea7('0x4'))['db'];config[_0xfea7('0x5')]=_[_0xfea7('0x6')](config[_0xfea7('0x5')],{'host':_0xfea7('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfea7('0x5')]));require(_0xfea7('0x8'))[_0xfea7('0x9')](socket);function respondWithStatusCode(_0x2bd947,_0x5516c6){_0x5516c6=_0x5516c6||0xcc;return function(_0x205cf0){if(_0x205cf0){return _0x2bd947[_0xfea7('0xa')](_0x5516c6);}return _0x2bd947['status'](_0x5516c6)[_0xfea7('0xb')]();};}function respondWithResult(_0x1cd5f2,_0x345554){_0x345554=_0x345554||0xc8;return function(_0x433243){if(_0x433243){return _0x1cd5f2[_0xfea7('0xc')](_0x345554)[_0xfea7('0xd')](_0x433243);}};}function respondWithFilteredResult(_0x155be6,_0x29e1e7){return function(_0xabc298){if(_0xabc298){var _0x392f0d=typeof _0x29e1e7[_0xfea7('0xe')]==='undefined'&&typeof _0x29e1e7[_0xfea7('0xf')]==='undefined';var _0x354c81=_0xabc298[_0xfea7('0x10')];var _0x70b93b=_0x392f0d?0x0:_0x29e1e7['offset'];var _0x17bd73=_0x392f0d?_0xabc298['count']:_0x29e1e7[_0xfea7('0xe')]+_0x29e1e7[_0xfea7('0xf')];var _0x49c54e;if(_0x17bd73>=_0x354c81){_0x17bd73=_0x354c81;_0x49c54e=0xc8;}else{_0x49c54e=0xce;}_0x155be6[_0xfea7('0xc')](_0x49c54e);return _0x155be6[_0xfea7('0x11')](_0xfea7('0x12'),_0x70b93b+'-'+_0x17bd73+'/'+_0x354c81)[_0xfea7('0xd')](_0xabc298);}return null;};}function removeEntity(_0x147d0a){return function(_0x155148){if(_0x155148){return _0x155148[_0xfea7('0x13')]()[_0xfea7('0x14')](function(){var _0x278882=_0x155148[_0xfea7('0x15')]({'plain':!![]});var _0x16017e=[{'name':'InboundRoutes','value':_0xfea7('0x16'),'ignore':![]},{'name':_0xfea7('0x17'),'value':_0xfea7('0x18'),'ignore':![]},{'name':_0xfea7('0x19'),'value':'internal','ignore':![]}];var _0x2fc8ad=_(_0x16017e)['filter'](_0xfea7('0x1a'))[_0xfea7('0x1b')](_0xfea7('0x1c'))[_0xfea7('0x1c')]();if(_['includes'](_0x2fc8ad,_0x278882['type'])){return;}var _0x4d0de0=_[_0xfea7('0x1d')](_0x16017e,[_0xfea7('0x1c'),_0x278882[_0xfea7('0x1e')]])[_0xfea7('0x1f')];return db['UserProfileResource'][_0xfea7('0x13')]({'where':{'type':_0x4d0de0,'resourceId':_0x278882['id']}})[_0xfea7('0x14')](function(){return _0x155148;});})['then'](function(){_0x147d0a[_0xfea7('0xc')](0xcc)[_0xfea7('0xb')]();});}};}function handleEntityNotFound(_0x243caf){return function(_0x173a51){if(!_0x173a51){_0x243caf['sendStatus'](0x194);}return _0x173a51;};}function handleError(_0x54b028,_0xd8d780){_0xd8d780=_0xd8d780||0x1f4;return function(_0x2c7404){logger[_0xfea7('0x20')](_0x2c7404[_0xfea7('0x21')]);if(_0x2c7404['name']){delete _0x2c7404[_0xfea7('0x1f')];}_0x54b028['status'](_0xd8d780)['send'](_0x2c7404);};}exports['index']=function(_0x33946c,_0xdff81f){var _0x486193={},_0x5c23f2={},_0x49333c={'count':0x0,'rows':[]};var _0x43b72b=_[_0xfea7('0x1b')](db[_0xfea7('0x22')][_0xfea7('0x23')],function(_0x212161){return{'name':_0x212161[_0xfea7('0x24')],'type':_0x212161[_0xfea7('0x1e')][_0xfea7('0x25')]};});_0x5c23f2['model']=_[_0xfea7('0x1b')](_0x43b72b,'name');_0x5c23f2[_0xfea7('0x26')]=_[_0xfea7('0x27')](_0x33946c[_0xfea7('0x26')]);_0x5c23f2[_0xfea7('0x28')]=_['intersection'](_0x5c23f2[_0xfea7('0x29')],_0x5c23f2[_0xfea7('0x26')]);_0x486193[_0xfea7('0x2a')]=_[_0xfea7('0x2b')](_0x5c23f2[_0xfea7('0x29')],qs[_0xfea7('0x2c')](_0x33946c[_0xfea7('0x26')][_0xfea7('0x2c')]));_0x486193[_0xfea7('0x2a')]=_0x486193[_0xfea7('0x2a')][_0xfea7('0x2d')]?_0x486193[_0xfea7('0x2a')]:_0x5c23f2[_0xfea7('0x29')];if(!_0x33946c[_0xfea7('0x26')][_0xfea7('0x2e')](_0xfea7('0x2f'))){_0x486193['limit']=qs[_0xfea7('0xf')](_0x33946c[_0xfea7('0x26')]['limit']);_0x486193['offset']=qs['offset'](_0x33946c[_0xfea7('0x26')][_0xfea7('0xe')]);}_0x486193[_0xfea7('0x30')]=qs[_0xfea7('0x31')](_0x33946c['query'][_0xfea7('0x31')]);_0x486193[_0xfea7('0x32')]=qs[_0xfea7('0x28')](_[_0xfea7('0x33')](_0x33946c['query'],_0x5c23f2[_0xfea7('0x28')]),_0x43b72b);if(_0x33946c[_0xfea7('0x26')][_0xfea7('0x34')]){_0x486193[_0xfea7('0x32')]=_[_0xfea7('0x35')](_0x486193[_0xfea7('0x32')],{'$or':_[_0xfea7('0x1b')](_0x43b72b,function(_0x399e3f){if(_0x399e3f[_0xfea7('0x1e')]!==_0xfea7('0x36')){var _0x20caa9={};_0x20caa9[_0x399e3f['name']]={'$like':'%'+_0x33946c[_0xfea7('0x26')]['filter']+'%'};return _0x20caa9;}})});}_0x486193=_['merge']({},_0x486193,_0x33946c[_0xfea7('0x37')]);var _0x2d2e2f={'where':_0x486193[_0xfea7('0x32')]};return db[_0xfea7('0x22')][_0xfea7('0x10')](_0x2d2e2f)[_0xfea7('0x14')](function(_0x313b61){_0x49333c[_0xfea7('0x10')]=_0x313b61;if(_0x33946c[_0xfea7('0x26')][_0xfea7('0x38')]){_0x486193[_0xfea7('0x39')]=[{'all':!![]}];}return db[_0xfea7('0x22')][_0xfea7('0x3a')](_0x486193);})[_0xfea7('0x14')](function(_0x14bf7d){_0x49333c[_0xfea7('0x3b')]=_0x14bf7d;return _0x49333c;})[_0xfea7('0x14')](respondWithFilteredResult(_0xdff81f,_0x486193))[_0xfea7('0x3c')](handleError(_0xdff81f,null));};exports[_0xfea7('0x3d')]=function(_0x4ba717,_0xc2ef7){var _0x24a32b={'raw':![],'where':{'id':_0x4ba717[_0xfea7('0x3e')]['id']}},_0x34e6a4={};_0x34e6a4[_0xfea7('0x29')]=_['keys'](db[_0xfea7('0x22')]['rawAttributes']);_0x34e6a4['query']=_[_0xfea7('0x27')](_0x4ba717[_0xfea7('0x26')]);_0x34e6a4[_0xfea7('0x28')]=_[_0xfea7('0x2b')](_0x34e6a4[_0xfea7('0x29')],_0x34e6a4[_0xfea7('0x26')]);_0x24a32b[_0xfea7('0x2a')]=_[_0xfea7('0x2b')](_0x34e6a4[_0xfea7('0x29')],qs['fields'](_0x4ba717[_0xfea7('0x26')]['fields']));_0x24a32b['attributes']=_0x24a32b[_0xfea7('0x2a')]['length']?_0x24a32b[_0xfea7('0x2a')]:_0x34e6a4[_0xfea7('0x29')];if(_0x4ba717[_0xfea7('0x26')][_0xfea7('0x38')]){_0x24a32b[_0xfea7('0x39')]=[{'all':!![]}];}_0x24a32b=_[_0xfea7('0x35')]({},_0x24a32b,_0x4ba717[_0xfea7('0x37')]);return db['VoiceExtension'][_0xfea7('0x1d')](_0x24a32b)[_0xfea7('0x14')](handleEntityNotFound(_0xc2ef7,null))[_0xfea7('0x14')](respondWithResult(_0xc2ef7,null))['catch'](handleError(_0xc2ef7,null));};exports['destroy']=function(_0x410cae,_0x421b3f){return db[_0xfea7('0x22')][_0xfea7('0x1d')]({'where':{'id':_0x410cae[_0xfea7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x421b3f,null))[_0xfea7('0x14')](removeEntity(_0x421b3f,null))[_0xfea7('0x3c')](handleError(_0x421b3f,null));};exports[_0xfea7('0x3f')]=function(_0x62b538,_0x18b7c8){if(_0x62b538[_0xfea7('0x40')][_0xfea7('0x1e')]===_0xfea7('0x18')&&!_['startsWith'](_0x62b538[_0xfea7('0x40')]['exten'],'_')){_0x62b538[_0xfea7('0x40')][_0xfea7('0x41')]='_'[_0xfea7('0x42')](_0x62b538[_0xfea7('0x40')][_0xfea7('0x41')]);}return db['VoiceExtension'][_0xfea7('0x3f')](_0x62b538['body'],{'raw':![]})[_0xfea7('0x14')](function(_0x37835c){var _0x29acb2=_0x62b538[_0xfea7('0x43')][_0xfea7('0x15')]({'plain':!![]});if(!_0x29acb2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29acb2['role']==='user'){var _0x1a377a=_0x37835c[_0xfea7('0x15')]({'plain':!![]});var _0x442eee=[{'name':'InboundRoutes','value':_0xfea7('0x16')},{'name':'OutboundRoutes','value':_0xfea7('0x18')},{'name':_0xfea7('0x19'),'value':_0xfea7('0x44')}];var _0x2015b3=_[_0xfea7('0x1d')](_0x442eee,['value',_0x1a377a[_0xfea7('0x1e')]])['name'];return db['UserProfileSection'][_0xfea7('0x1d')]({'where':{'name':_0x2015b3,'userProfileId':_0x29acb2[_0xfea7('0x45')]},'raw':!![]})[_0xfea7('0x14')](function(_0x8a7c41){if(_0x8a7c41&&_0x8a7c41[_0xfea7('0x46')]===0x0){return db['UserProfileResource'][_0xfea7('0x3f')]({'name':_0x1a377a[_0xfea7('0x1f')],'resourceId':_0x1a377a['id'],'type':_0x8a7c41['name'],'sectionId':_0x8a7c41['id']},{})[_0xfea7('0x14')](function(){return _0x37835c;});}else{return _0x37835c;}})[_0xfea7('0x3c')](function(_0x55f502){logger['error'](_0xfea7('0x47'),_0x55f502);throw _0x55f502;});}return _0x37835c;})['then'](respondWithResult(_0x18b7c8,0xc9))[_0xfea7('0x3c')](handleError(_0x18b7c8,null));};exports[_0xfea7('0x48')]=function(_0x233801,_0xfbda90){if(_0x233801[_0xfea7('0x40')]['id']){delete _0x233801[_0xfea7('0x40')]['id'];}return db['VoiceExtension'][_0xfea7('0x1d')]({'where':{'id':_0x233801['params']['id']}})[_0xfea7('0x14')](handleEntityNotFound(_0xfbda90,null))[_0xfea7('0x14')](function(_0x427527){if(_0x427527){return db[_0xfea7('0x22')][_0xfea7('0x48')](_[_0xfea7('0x33')](_0x233801[_0xfea7('0x40')],[_0xfea7('0x41'),_0xfea7('0x49'),_0xfea7('0x4a'),_0xfea7('0x4b'),'cutdigits',_0xfea7('0x4c'),_0xfea7('0x4d')]),{'where':{'context':_0x427527[_0xfea7('0x49')],'exten':_0x427527[_0xfea7('0x41')]},'individualHooks':!![]})[_0xfea7('0x14')](function(_0x5e40e6){return _0x5e40e6;});}return null;})['then'](respondWithStatusCode(_0xfbda90,null))[_0xfea7('0x3c')](handleError(_0xfbda90,null));};exports[_0xfea7('0x4e')]=function(_0x303c62,_0x46e5ea){var _0x65c2a6=_0x303c62[_0xfea7('0x3e')]['id'];var _0x3e655c=_0x303c62[_0xfea7('0x40')];var _0x20f02b=0xc8;var _0x32c99e=null;return db['sequelize'][_0xfea7('0x4f')]({'isolationLevel':db[_0xfea7('0x50')][_0xfea7('0x51')][_0xfea7('0x52')][_0xfea7('0x53')]},function(_0x37bae7){return db[_0xfea7('0x22')][_0xfea7('0x54')]({'where':{'id':_0x65c2a6},'transaction':_0x37bae7})['then'](function(_0x5dd3c6){if(_0x5dd3c6){return db[_0xfea7('0x22')]['destroy']({'where':{'VoiceExtensionId':_0x65c2a6},'transaction':_0x37bae7})[_0xfea7('0x14')](function(){var _0x55deca=_[_0xfea7('0x1b')](_0x3e655c,function(_0x480315){_0x480315[_0xfea7('0x55')]=_0x65c2a6;_0x480315[_0xfea7('0x56')]=!![];return _0x480315;});return _0x5dd3c6[_0xfea7('0x57')](_0x55deca);})[_0xfea7('0x14')](function(_0x5bd692){return db[_0xfea7('0x22')][_0xfea7('0x58')](_0x5bd692,{'transaction':_0x37bae7});});}else{_0x20f02b=0x194;_0x32c99e=[];}});})[_0xfea7('0x14')](function(){if(_0x20f02b!==0x194){return db[_0xfea7('0x22')][_0xfea7('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x65c2a6},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x59cbb6){_0x32c99e=_0x59cbb6;});}})[_0xfea7('0x3c')](function(_0x41f793){_0x20f02b=0x1f4;logger[_0xfea7('0x20')](_0x41f793[_0xfea7('0x21')]);if(_0x41f793['name']){delete _0x41f793[_0xfea7('0x1f')];}_0x32c99e=_0x41f793;})[_0xfea7('0x5a')](function(){if(_0x32c99e===null){_0x46e5ea['sendStatus'](_0x20f02b);}else{if(_0x20f02b===0x1f4){_0x46e5ea['status'](_0x20f02b)['send'](_0x32c99e);}else{_0x46e5ea[_0xfea7('0xc')](_0x20f02b)['json'](_0x32c99e);}}});}; \ No newline at end of file +var _0xeb47=['internal','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','type','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','find','catch','params','create','startsWith','exten','concat','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x511fad,_0x26cf29){var _0x4b61bd=function(_0x543692){while(--_0x543692){_0x511fad['push'](_0x511fad['shift']());}};_0x4b61bd(++_0x26cf29);}(_0xeb47,0x6e));var _0x7eb4=function(_0x354a3b,_0x120272){_0x354a3b=_0x354a3b-0x0;var _0x442c1f=_0xeb47[_0x354a3b];return _0x442c1f;};'use strict';var _=require(_0x7eb4('0x0'));var Redis=require(_0x7eb4('0x1'));var qs=require(_0x7eb4('0x2'));var logger=require(_0x7eb4('0x3'))(_0x7eb4('0x4'));var config=require(_0x7eb4('0x5'));var db=require(_0x7eb4('0x6'))['db'];config['redis']=_['defaults'](config[_0x7eb4('0x7')],{'host':_0x7eb4('0x8'),'port':0x18eb});var socket=require(_0x7eb4('0x9'))(new Redis(config['redis']));require(_0x7eb4('0xa'))[_0x7eb4('0xb')](socket);function respondWithStatusCode(_0xd6ee84,_0x46ae1a){_0x46ae1a=_0x46ae1a||0xcc;return function(_0x1dd9f8){if(_0x1dd9f8){return _0xd6ee84[_0x7eb4('0xc')](_0x46ae1a);}return _0xd6ee84[_0x7eb4('0xd')](_0x46ae1a)[_0x7eb4('0xe')]();};}function respondWithResult(_0x4eefc6,_0x985e17){_0x985e17=_0x985e17||0xc8;return function(_0x536c9f){if(_0x536c9f){return _0x4eefc6['status'](_0x985e17)[_0x7eb4('0xf')](_0x536c9f);}};}function respondWithFilteredResult(_0x2dbc50,_0x4d0dab){return function(_0x35e1a9){if(_0x35e1a9){var _0x2e9e84=typeof _0x4d0dab[_0x7eb4('0x10')]===_0x7eb4('0x11')&&typeof _0x4d0dab[_0x7eb4('0x12')]==='undefined';var _0x501da0=_0x35e1a9[_0x7eb4('0x13')];var _0x1d38f0=_0x2e9e84?0x0:_0x4d0dab[_0x7eb4('0x10')];var _0x4fe273=_0x2e9e84?_0x35e1a9['count']:_0x4d0dab['offset']+_0x4d0dab['limit'];var _0x1d99b1;if(_0x4fe273>=_0x501da0){_0x4fe273=_0x501da0;_0x1d99b1=0xc8;}else{_0x1d99b1=0xce;}_0x2dbc50[_0x7eb4('0xd')](_0x1d99b1);return _0x2dbc50[_0x7eb4('0x14')]('Content-Range',_0x1d38f0+'-'+_0x4fe273+'/'+_0x501da0)[_0x7eb4('0xf')](_0x35e1a9);}return null;};}function removeEntity(_0x588564){return function(_0x27d74d){if(_0x27d74d){return _0x27d74d[_0x7eb4('0x15')]()[_0x7eb4('0x16')](function(){var _0x33966d=_0x27d74d[_0x7eb4('0x17')]({'plain':!![]});var _0xdf789=[{'name':_0x7eb4('0x18'),'value':'inbound','ignore':![]},{'name':_0x7eb4('0x19'),'value':_0x7eb4('0x1a'),'ignore':![]},{'name':_0x7eb4('0x1b'),'value':'internal','ignore':![]}];var _0x2d36d8=_(_0xdf789)[_0x7eb4('0x1c')](_0x7eb4('0x1d'))[_0x7eb4('0x1e')](_0x7eb4('0x1f'))[_0x7eb4('0x1f')]();if(_['includes'](_0x2d36d8,_0x33966d[_0x7eb4('0x20')])){return;}var _0x15b997=_['find'](_0xdf789,[_0x7eb4('0x1f'),_0x33966d[_0x7eb4('0x20')]])[_0x7eb4('0x21')];return db[_0x7eb4('0x22')][_0x7eb4('0x15')]({'where':{'type':_0x15b997,'resourceId':_0x33966d['id']}})['then'](function(){return _0x27d74d;});})['then'](function(){_0x588564[_0x7eb4('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe7da0b){return function(_0x251439){if(!_0x251439){_0xe7da0b[_0x7eb4('0xc')](0x194);}return _0x251439;};}function handleError(_0x5499c1,_0x19e8c3){_0x19e8c3=_0x19e8c3||0x1f4;return function(_0x4d18ec){logger['error'](_0x4d18ec[_0x7eb4('0x23')]);if(_0x4d18ec[_0x7eb4('0x21')]){delete _0x4d18ec['name'];}_0x5499c1[_0x7eb4('0xd')](_0x19e8c3)[_0x7eb4('0x24')](_0x4d18ec);};}exports[_0x7eb4('0x25')]=function(_0x263537,_0x221c47){var _0x4c8090={},_0x3668d5={},_0x407554={'count':0x0,'rows':[]};var _0x315f30=_[_0x7eb4('0x1e')](db[_0x7eb4('0x26')][_0x7eb4('0x27')],function(_0x3d2f2d){return{'name':_0x3d2f2d[_0x7eb4('0x28')],'type':_0x3d2f2d[_0x7eb4('0x20')][_0x7eb4('0x29')]};});_0x3668d5[_0x7eb4('0x2a')]=_['map'](_0x315f30,_0x7eb4('0x21'));_0x3668d5[_0x7eb4('0x2b')]=_[_0x7eb4('0x2c')](_0x263537[_0x7eb4('0x2b')]);_0x3668d5[_0x7eb4('0x2d')]=_[_0x7eb4('0x2e')](_0x3668d5[_0x7eb4('0x2a')],_0x3668d5[_0x7eb4('0x2b')]);_0x4c8090[_0x7eb4('0x2f')]=_['intersection'](_0x3668d5['model'],qs['fields'](_0x263537[_0x7eb4('0x2b')][_0x7eb4('0x30')]));_0x4c8090[_0x7eb4('0x2f')]=_0x4c8090[_0x7eb4('0x2f')][_0x7eb4('0x31')]?_0x4c8090['attributes']:_0x3668d5['model'];if(!_0x263537[_0x7eb4('0x2b')]['hasOwnProperty']('nolimit')){_0x4c8090[_0x7eb4('0x12')]=qs[_0x7eb4('0x12')](_0x263537[_0x7eb4('0x2b')][_0x7eb4('0x12')]);_0x4c8090[_0x7eb4('0x10')]=qs['offset'](_0x263537[_0x7eb4('0x2b')]['offset']);}_0x4c8090[_0x7eb4('0x32')]=qs[_0x7eb4('0x33')](_0x263537['query']['sort']);_0x4c8090[_0x7eb4('0x34')]=qs['filters'](_[_0x7eb4('0x35')](_0x263537[_0x7eb4('0x2b')],_0x3668d5[_0x7eb4('0x2d')]),_0x315f30);if(_0x263537[_0x7eb4('0x2b')]['filter']){_0x4c8090[_0x7eb4('0x34')]=_[_0x7eb4('0x36')](_0x4c8090[_0x7eb4('0x34')],{'$or':_[_0x7eb4('0x1e')](_0x315f30,function(_0x237c3f){if(_0x237c3f[_0x7eb4('0x20')]!==_0x7eb4('0x37')){var _0x1930e3={};_0x1930e3[_0x237c3f[_0x7eb4('0x21')]]={'$like':'%'+_0x263537[_0x7eb4('0x2b')][_0x7eb4('0x1c')]+'%'};return _0x1930e3;}})});}_0x4c8090=_['merge']({},_0x4c8090,_0x263537[_0x7eb4('0x38')]);var _0xee0a1e={'where':_0x4c8090['where']};return db[_0x7eb4('0x26')]['count'](_0xee0a1e)['then'](function(_0xd72fba){_0x407554['count']=_0xd72fba;if(_0x263537[_0x7eb4('0x2b')][_0x7eb4('0x39')]){_0x4c8090[_0x7eb4('0x3a')]=[{'all':!![]}];}return db['VoiceExtension'][_0x7eb4('0x3b')](_0x4c8090);})['then'](function(_0xd85742){_0x407554['rows']=_0xd85742;return _0x407554;})[_0x7eb4('0x16')](respondWithFilteredResult(_0x221c47,_0x4c8090))['catch'](handleError(_0x221c47,null));};exports[_0x7eb4('0x3c')]=function(_0x10943f,_0x109427){var _0x4df382={'raw':![],'where':{'id':_0x10943f['params']['id']}},_0x3745bf={};_0x3745bf['model']=_[_0x7eb4('0x2c')](db[_0x7eb4('0x26')][_0x7eb4('0x27')]);_0x3745bf[_0x7eb4('0x2b')]=_[_0x7eb4('0x2c')](_0x10943f[_0x7eb4('0x2b')]);_0x3745bf[_0x7eb4('0x2d')]=_[_0x7eb4('0x2e')](_0x3745bf[_0x7eb4('0x2a')],_0x3745bf[_0x7eb4('0x2b')]);_0x4df382[_0x7eb4('0x2f')]=_['intersection'](_0x3745bf[_0x7eb4('0x2a')],qs['fields'](_0x10943f[_0x7eb4('0x2b')]['fields']));_0x4df382[_0x7eb4('0x2f')]=_0x4df382[_0x7eb4('0x2f')][_0x7eb4('0x31')]?_0x4df382[_0x7eb4('0x2f')]:_0x3745bf[_0x7eb4('0x2a')];if(_0x10943f[_0x7eb4('0x2b')][_0x7eb4('0x39')]){_0x4df382[_0x7eb4('0x3a')]=[{'all':!![]}];}_0x4df382=_[_0x7eb4('0x36')]({},_0x4df382,_0x10943f['options']);return db[_0x7eb4('0x26')][_0x7eb4('0x3d')](_0x4df382)[_0x7eb4('0x16')](handleEntityNotFound(_0x109427,null))[_0x7eb4('0x16')](respondWithResult(_0x109427,null))[_0x7eb4('0x3e')](handleError(_0x109427,null));};exports[_0x7eb4('0x15')]=function(_0x38f8c9,_0x5054ad){return db[_0x7eb4('0x26')]['find']({'where':{'id':_0x38f8c9[_0x7eb4('0x3f')]['id']}})[_0x7eb4('0x16')](handleEntityNotFound(_0x5054ad,null))[_0x7eb4('0x16')](removeEntity(_0x5054ad,null))[_0x7eb4('0x3e')](handleError(_0x5054ad,null));};exports[_0x7eb4('0x40')]=function(_0x5a4553,_0x128570){if(_0x5a4553['body'][_0x7eb4('0x20')]===_0x7eb4('0x1a')&&!_[_0x7eb4('0x41')](_0x5a4553['body'][_0x7eb4('0x42')],'_')){_0x5a4553['body'][_0x7eb4('0x42')]='_'[_0x7eb4('0x43')](_0x5a4553[_0x7eb4('0x44')]['exten']);}return db[_0x7eb4('0x26')][_0x7eb4('0x40')](_0x5a4553[_0x7eb4('0x44')],{'raw':![]})[_0x7eb4('0x16')](function(_0x5224bb){var _0x5ba520=_0x5a4553[_0x7eb4('0x45')]['get']({'plain':!![]});if(!_0x5ba520)throw new Error(_0x7eb4('0x46'));if(_0x5ba520[_0x7eb4('0x47')]===_0x7eb4('0x45')){var _0x2d5100=_0x5224bb[_0x7eb4('0x17')]({'plain':!![]});var _0xf3642e=[{'name':_0x7eb4('0x18'),'value':'inbound'},{'name':_0x7eb4('0x19'),'value':_0x7eb4('0x1a')},{'name':_0x7eb4('0x1b'),'value':_0x7eb4('0x48')}];var _0x411ad4=_[_0x7eb4('0x3d')](_0xf3642e,[_0x7eb4('0x1f'),_0x2d5100['type']])[_0x7eb4('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0x411ad4,'userProfileId':_0x5ba520[_0x7eb4('0x49')]},'raw':!![]})[_0x7eb4('0x16')](function(_0x552e7d){if(_0x552e7d&&_0x552e7d['autoAssociation']===0x0){return db[_0x7eb4('0x22')][_0x7eb4('0x40')]({'name':_0x2d5100[_0x7eb4('0x21')],'resourceId':_0x2d5100['id'],'type':_0x552e7d[_0x7eb4('0x21')],'sectionId':_0x552e7d['id']},{})['then'](function(){return _0x5224bb;});}else{return _0x5224bb;}})['catch'](function(_0x4075c6){logger[_0x7eb4('0x4a')](_0x7eb4('0x4b'),_0x4075c6);throw _0x4075c6;});}return _0x5224bb;})[_0x7eb4('0x16')](respondWithResult(_0x128570,0xc9))[_0x7eb4('0x3e')](handleError(_0x128570,null));};exports['update']=function(_0x1b6a81,_0x3ab9a2){if(_0x1b6a81[_0x7eb4('0x44')]['id']){delete _0x1b6a81[_0x7eb4('0x44')]['id'];}return db[_0x7eb4('0x26')]['find']({'where':{'id':_0x1b6a81[_0x7eb4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3ab9a2,null))[_0x7eb4('0x16')](function(_0x2b36da){if(_0x2b36da){return db[_0x7eb4('0x26')]['update'](_['pick'](_0x1b6a81[_0x7eb4('0x44')],['exten',_0x7eb4('0x4c'),'description',_0x7eb4('0x4d'),_0x7eb4('0x4e'),_0x7eb4('0x4f'),_0x7eb4('0x50')]),{'where':{'context':_0x2b36da['context'],'exten':_0x2b36da['exten']},'individualHooks':!![]})[_0x7eb4('0x16')](function(_0x5c391b){return _0x5c391b;});}return null;})[_0x7eb4('0x16')](respondWithStatusCode(_0x3ab9a2,null))[_0x7eb4('0x3e')](handleError(_0x3ab9a2,null));};exports[_0x7eb4('0x51')]=function(_0x414441,_0x29261){var _0xf9abf8=_0x414441[_0x7eb4('0x3f')]['id'];var _0x5f14ad=_0x414441[_0x7eb4('0x44')];var _0x1bc35c=0xc8;var _0x55842b=null;return db[_0x7eb4('0x52')][_0x7eb4('0x53')]({'isolationLevel':db[_0x7eb4('0x52')][_0x7eb4('0x54')][_0x7eb4('0x55')][_0x7eb4('0x56')]},function(_0x19e94e){return db['VoiceExtension'][_0x7eb4('0x57')]({'where':{'id':_0xf9abf8},'transaction':_0x19e94e})[_0x7eb4('0x16')](function(_0x24708c){if(_0x24708c){return db['VoiceExtension'][_0x7eb4('0x15')]({'where':{'VoiceExtensionId':_0xf9abf8},'transaction':_0x19e94e})['then'](function(){var _0x387f12=_[_0x7eb4('0x1e')](_0x5f14ad,function(_0x4ed2d3){_0x4ed2d3['VoiceExtensionId']=_0xf9abf8;_0x4ed2d3['isApp']=!![];return _0x4ed2d3;});return _0x24708c['createRouting'](_0x387f12);})[_0x7eb4('0x16')](function(_0xbe3755){return db[_0x7eb4('0x26')]['bulkCreate'](_0xbe3755,{'transaction':_0x19e94e});});}else{_0x1bc35c=0x194;_0x55842b=[];}});})[_0x7eb4('0x16')](function(){if(_0x1bc35c!==0x194){return db[_0x7eb4('0x26')][_0x7eb4('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0xf9abf8},'order':_0x7eb4('0x59')})[_0x7eb4('0x16')](function(_0x9429d6){_0x55842b=_0x9429d6;});}})[_0x7eb4('0x3e')](function(_0x152771){_0x1bc35c=0x1f4;logger[_0x7eb4('0x4a')](_0x152771['stack']);if(_0x152771[_0x7eb4('0x21')]){delete _0x152771[_0x7eb4('0x21')];}_0x55842b=_0x152771;})[_0x7eb4('0x5a')](function(){if(_0x55842b===null){_0x29261['sendStatus'](_0x1bc35c);}else{if(_0x1bc35c===0x1f4){_0x29261['status'](_0x1bc35c)[_0x7eb4('0x24')](_0x55842b);}else{_0x29261[_0x7eb4('0xd')](_0x1bc35c)[_0x7eb4('0xf')](_0x55842b);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7049cb4..1f00ab3 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 _0xdf52=['../../mysqldb','setMaxListeners','save','update','emit','exports','events'];(function(_0x2ffa17,_0x35b3a8){var _0x3a783b=function(_0x16d13d){while(--_0x16d13d){_0x2ffa17['push'](_0x2ffa17['shift']());}};_0x3a783b(++_0x35b3a8);}(_0xdf52,0xb5));var _0x2df5=function(_0x30cac1,_0x448dfc){_0x30cac1=_0x30cac1-0x0;var _0xef9456=_0xdf52[_0x30cac1];return _0xef9456;};'use strict';var EventEmitter=require(_0x2df5('0x0'));var VoiceExtension=require(_0x2df5('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2df5('0x2')](0x0);var events={'afterCreate':_0x2df5('0x3'),'afterUpdate':_0x2df5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5eb75b){return function(_0x11471c,_0x3a952f,_0x6b1b27){VoiceExtensionEvents[_0x2df5('0x5')](_0x5eb75b+':'+_0x11471c['id'],_0x11471c);VoiceExtensionEvents['emit'](_0x5eb75b,_0x11471c);_0x6b1b27(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x2df5('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0xecbc=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','emit'];(function(_0x2d1630,_0x11df96){var _0x27fe89=function(_0x199ea3){while(--_0x199ea3){_0x2d1630['push'](_0x2d1630['shift']());}};_0x27fe89(++_0x11df96);}(_0xecbc,0xa3));var _0xcecb=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xecbc[_0x2112d4];return _0x434972;};'use strict';var EventEmitter=require(_0xcecb('0x0'));var VoiceExtension=require(_0xcecb('0x1'))['db'][_0xcecb('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xcecb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4922da){return function(_0x2fe5d1,_0x3b8362,_0x47cb36){VoiceExtensionEvents[_0xcecb('0x4')](_0x4922da+':'+_0x2fe5d1['id'],_0x2fe5d1);VoiceExtensionEvents[_0xcecb('0x4')](_0x4922da,_0x2fe5d1);_0x47cb36(null);};}for(var e in events){if(events[_0xcecb('0x5')](e)){var event=events[e];VoiceExtension[_0xcecb('0x6')](e,emitEvent(event));}}module[_0xcecb('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 17db932..e7eab53 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 _0xd2b2=['last','catch','define','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','exten','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','timeout','options','url','length','name','split','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','interval','then','*,*,*,*','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','intervals','callerID','NoOp(No\x20number\x20available)','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','priority'];(function(_0x15de7b,_0x1f9e4e){var _0x1456c4=function(_0x2132fc){while(--_0x2132fc){_0x15de7b['push'](_0x15de7b['shift']());}};_0x1456c4(++_0x1f9e4e);}(_0xd2b2,0x13e));var _0x2d2b=function(_0x1bcff9,_0x46a878){_0x1bcff9=_0x1bcff9-0x0;var _0x319860=_0xd2b2[_0x1bcff9];return _0x319860;};'use strict';var _=require(_0x2d2b('0x0'));var attributes=require(_0x2d2b('0x1'));module[_0x2d2b('0x2')]=function(_0x433735){var _0x2e01d5=_0x433735[_0x2d2b('0x3')];function _0x2ef5cd(_0x171bc8){var _0x31aff5=0x2;var _0x54dd16=[{'type':_0x171bc8[_0x2d2b('0x4')],'app':'Set','appdata':_0x2d2b('0x5')+_0x171bc8[_0x2d2b('0x4')],'context':_0x171bc8[_0x2d2b('0x6')],'exten':_0x171bc8[_0x2d2b('0x7')],'priority':_0x31aff5++,'VoiceExtensionId':_0x171bc8['id']}];if(_0x171bc8[_0x2d2b('0x4')]===_0x2d2b('0x8')){_0x54dd16[_0x2d2b('0x9')]({'type':_0x2d2b('0x8'),'app':_0x2d2b('0xa'),'appdata':_0x2d2b('0xb')+_0x171bc8['id'],'context':_0x171bc8[_0x2d2b('0x6')],'exten':_0x171bc8[_0x2d2b('0x7')],'priority':_0x31aff5++,'VoiceExtensionId':_0x171bc8['id']});}_0x54dd16[_0x2d2b('0x9')]({'type':_0x171bc8[_0x2d2b('0x4')],'app':_0x2d2b('0xa'),'appdata':_0x2d2b('0xc'),'context':_0x171bc8[_0x2d2b('0x6')],'exten':_0x171bc8[_0x2d2b('0x7')],'priority':_0x31aff5++,'VoiceExtensionId':_0x171bc8['id']},{'type':_0x171bc8[_0x2d2b('0x4')],'app':_0x2d2b('0xa'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x171bc8[_0x2d2b('0x6')],'exten':_0x171bc8['exten'],'priority':_0x31aff5++,'VoiceExtensionId':_0x171bc8['id']},{'type':_0x171bc8[_0x2d2b('0x4')],'app':_0x2d2b('0xa'),'appdata':'MONITOR_OPTIONS=ab','context':_0x171bc8[_0x2d2b('0x6')],'exten':_0x171bc8[_0x2d2b('0x7')],'priority':_0x31aff5++,'VoiceExtensionId':_0x171bc8['id']});return _0x54dd16;}function _0x5e2714(_0x2f4a5b){var _0xebcafc=0x2;var _0x57f081=[{'type':_0x2d2b('0xd'),'app':_0x2d2b('0xa'),'appdata':_0x2d2b('0xe'),'context':_0x2f4a5b[_0x2d2b('0x6')],'exten':_0x2f4a5b[_0x2d2b('0x7')],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']},{'type':_0x2d2b('0xd'),'app':'Set','appdata':_0x2d2b('0xf')+(_0x2f4a5b[_0x2d2b('0x10')]?_0x2d2b('0x11')+_0x2f4a5b[_0x2d2b('0x10')]+'}':_0x2d2b('0x12')),'context':_0x2f4a5b['context'],'exten':_0x2f4a5b[_0x2d2b('0x7')],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']},{'type':_0x2d2b('0xd'),'app':_0x2d2b('0xa'),'appdata':'CDR(routeid)='+_0x2f4a5b['id'],'context':_0x2f4a5b['context'],'exten':_0x2f4a5b['exten'],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']},{'type':'outbound','app':_0x2d2b('0x13'),'appdata':_0x2d2b('0x14')+(_0xebcafc+0x2)+'):Goto('+(_0xebcafc+0x1)+')','context':_0x2f4a5b['context'],'exten':_0x2f4a5b[_0x2d2b('0x7')],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']},{'type':'outbound','app':_0x2d2b('0xa'),'appdata':_0x2f4a5b[_0x2d2b('0x10')]?_0x2d2b('0x15')+_0x2f4a5b[_0x2d2b('0x10')]+'}':_0x2d2b('0x16'),'context':_0x2f4a5b[_0x2d2b('0x6')],'exten':_0x2f4a5b[_0x2d2b('0x7')],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']},{'type':_0x2d2b('0xd'),'app':_0x2d2b('0xa'),'appdata':_0x2d2b('0xc'),'context':_0x2f4a5b[_0x2d2b('0x6')],'exten':_0x2f4a5b[_0x2d2b('0x7')],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']},{'type':'outbound','app':_0x2d2b('0xa'),'appdata':_0x2d2b('0x17'),'context':_0x2f4a5b[_0x2d2b('0x6')],'exten':_0x2f4a5b[_0x2d2b('0x7')],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']},{'type':_0x2d2b('0xd'),'app':_0x2d2b('0xa'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2f4a5b[_0x2d2b('0x6')],'exten':_0x2f4a5b['exten'],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']},{'type':_0x2d2b('0xd'),'app':_0x2d2b('0xa'),'appdata':'outboundrouteid='+_0x2f4a5b['id'],'context':_0x2f4a5b[_0x2d2b('0x6')],'exten':_0x2f4a5b[_0x2d2b('0x7')],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']}];if(_0x2f4a5b[_0x2d2b('0x18')]('recordingFormat')&&_0x2f4a5b['recordingFormat']!==_0x2d2b('0x19')){_0x57f081[_0x2d2b('0x9')]({'type':'outbound','app':_0x2d2b('0xa'),'appdata':_0x2d2b('0x1a'),'context':_0x2f4a5b['context'],'exten':_0x2f4a5b[_0x2d2b('0x7')],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']},{'type':_0x2d2b('0xd'),'app':_0x2d2b('0xa'),'appdata':_0x2d2b('0x1b')+_0x2f4a5b[_0x2d2b('0x1c')]||_0x2d2b('0x1d'),'context':_0x2f4a5b['context'],'exten':_0x2f4a5b[_0x2d2b('0x7')],'priority':_0xebcafc++,'VoiceExtensionId':_0x2f4a5b['id']});}return _0x57f081;}function _0x5165fb(_0x15607c,_0x3f2e6d){var _0x3c46fd=[{'name':_0x2d2b('0x1e'),'param':0x0},{'name':_0x2d2b('0x1f'),'param':0x1},{'name':_0x2d2b('0x20'),'param':0x2},{'name':_0x2d2b('0x21'),'param':0x3}];var _0x3349f8={};var _0x15ff48=_0x3f2e6d['split'](',');var _0xc148bd=[];for(var _0x52ac46=0x0;_0x52ac46<_0x3c46fd[_0x2d2b('0x22')];_0x52ac46++){switch(_0x3c46fd[_0x52ac46][_0x2d2b('0x23')]){case _0x2d2b('0x1e'):_0x3349f8[_0x2d2b('0x1e')]=_0x15ff48[_0x3c46fd[_0x52ac46]['param']][_0x2d2b('0x24')]('/')[0x1];_0x3349f8['phone']=_0x15ff48[_0x3c46fd[_0x52ac46][_0x2d2b('0x25')]][_0x2d2b('0x24')]('/')[0x2];_0x3349f8['prefix']=_0x3349f8[_0x2d2b('0x26')]?_0x3349f8[_0x2d2b('0x26')]['split']('$')[0x0]:undefined;_0x3349f8[_0x2d2b('0x26')]=_0x15607c['cutdigits']?(_0x3349f8[_0x2d2b('0x27')]||'')+_0x2d2b('0x11')+_0x15607c['cutdigits']+'}':(_0x3349f8[_0x2d2b('0x27')]||'')+_0x2d2b('0x12');_0xc148bd[_0x3c46fd[_0x52ac46][_0x2d2b('0x25')]]=[_0x2d2b('0x28'),_0x3349f8[_0x2d2b('0x1e')],_0x3349f8[_0x2d2b('0x26')]][_0x2d2b('0x29')]('/');break;case _0x2d2b('0x20'):_0x3349f8[_0x2d2b('0x20')]=_0x15ff48[_0x3c46fd[_0x52ac46][_0x2d2b('0x25')]];if(_0x15607c[_0x2d2b('0x1c')]!==_0x2d2b('0x19')){if(_0x3349f8[_0x2d2b('0x20')][_0x2d2b('0x2a')](_0x2d2b('0x2b'))<0x0){_0x3349f8[_0x2d2b('0x20')]+='U(xcally-mixmonitor-context)';}}else{_0x3349f8['options']=_0x3349f8[_0x2d2b('0x20')][_0x2d2b('0x2c')](_0x2d2b('0x2b'),'');}_0xc148bd[_0x3c46fd[_0x52ac46][_0x2d2b('0x25')]]=_0x3349f8[_0x2d2b('0x20')];break;default:_0xc148bd[_0x3c46fd[_0x52ac46][_0x2d2b('0x25')]]=_0x15ff48[_0x3c46fd[_0x52ac46][_0x2d2b('0x25')]];}}return _0xc148bd[_0x2d2b('0x29')](',');}function _0x40e327(_0x4458ca,_0x1532ac,_0x53c594){return new Promise(function(_0x24ed3e,_0x4cb077){var _0xc7bf8d=[];if(_[_0x2d2b('0x2d')](_0x1532ac))return _0x24ed3e(_0xc7bf8d);_0x2e01d5['Interval']['findAll']({'attributes':['id',_0x2d2b('0x2e'),'IntervalId'],'raw':!![]})[_0x2d2b('0x2f')](function(_0x56e74b){for(var _0x3f7852=0x0,_0x55be70=0x0;_0x3f7852<_0x1532ac[_0x2d2b('0x22')];_0x3f7852++,_0x55be70=0x0){var _0x36ca63=_0x1532ac[_0x3f7852];var _0x430ef2=[];var _0xe2d8ce=[];delete _0x36ca63['id'];if(_0x36ca63[_0x2d2b('0x2e')]!==_0x2d2b('0x30')){_0x36ca63['intervals']=[_0x36ca63[_0x2d2b('0x2e')]];}else{_0x36ca63['intervals']=_0x36ca63[_0x2d2b('0x31')]?_[_0x2d2b('0x32')](_[_0x2d2b('0x33')](_0x56e74b,{'IntervalId':_0x36ca63[_0x2d2b('0x31')]}),'interval'):[];}_0x36ca63[_0x2d2b('0x6')]=_0x4458ca[_0x2d2b('0x6')];_0x36ca63['exten']=_0x4458ca[_0x2d2b('0x7')];if(_0x36ca63[_0x2d2b('0x4')])_0x36ca63['type']=_0x36ca63[_0x2d2b('0x4')][_0x2d2b('0x34')]();if(_0x4458ca[_0x2d2b('0x4')]===_0x2d2b('0xd')){if(_0x36ca63[_0x2d2b('0x18')](_0x2d2b('0x35'))&&_0x36ca63[_0x2d2b('0x35')]&&_0x36ca63[_0x2d2b('0x35')]!=='--'){_0x430ef2[_0x2d2b('0x9')]({'type':_0x36ca63[_0x2d2b('0x4')][_0x2d2b('0x34')](),'app':_0x2d2b('0xa'),'appdata':_0x2d2b('0x36')+_0x36ca63[_0x2d2b('0x35')],'context':_0x4458ca[_0x2d2b('0x6')],'exten':_0x4458ca['exten'],'priority':_0x36ca63[_0x2d2b('0x37')]['length']+_0x53c594+_0x55be70++,'VoiceExtensionId':_0x4458ca['id']});}_0x430ef2[_0x2d2b('0x9')]({'type':_0x36ca63[_0x2d2b('0x4')][_0x2d2b('0x34')](),'app':_0x2d2b('0x13'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x36ca63[_0x2d2b('0x38')]?'Set(CALLERID(all)='+_0x36ca63[_0x2d2b('0x38')]+')':_0x2d2b('0x39')),'context':_0x4458ca['context'],'exten':_0x4458ca[_0x2d2b('0x7')],'priority':_0x36ca63['intervals']['length']+_0x53c594+_0x55be70++,'VoiceExtensionId':_0x4458ca['id']});}else{if(_0x36ca63['hasOwnProperty']('answer')){if(['queue','playback']['includes'](_0x36ca63[_0x2d2b('0x3a')][_0x2d2b('0x34')]())&&_0x36ca63[_0x2d2b('0x3b')]!==_0x2d2b('0x3c')){if(_0x36ca63[_0x2d2b('0x3d')]){_0x430ef2[_0x2d2b('0x9')]({'type':_0x36ca63[_0x2d2b('0x4')][_0x2d2b('0x34')](),'app':_0x2d2b('0x13'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4458ca[_0x2d2b('0x6')],'exten':_0x4458ca[_0x2d2b('0x7')],'priority':_0x36ca63[_0x2d2b('0x37')][_0x2d2b('0x22')]+_0x53c594+_0x55be70++,'VoiceExtensionId':_0x4458ca['id']});_0x430ef2[_0x2d2b('0x9')]({'type':_0x36ca63[_0x2d2b('0x4')][_0x2d2b('0x34')](),'app':_0x2d2b('0xa'),'appdata':_0x2d2b('0x3e'),'context':_0x4458ca['context'],'exten':_0x4458ca[_0x2d2b('0x7')],'priority':_0x36ca63[_0x2d2b('0x37')][_0x2d2b('0x22')]+_0x53c594+_0x55be70++,'VoiceExtensionId':_0x4458ca['id']});}else{_0x430ef2[_0x2d2b('0x9')]({'type':_0x36ca63[_0x2d2b('0x4')]['toLowerCase'](),'app':_0x2d2b('0x13'),'appdata':_0x2d2b('0x3f'),'context':_0x4458ca[_0x2d2b('0x6')],'exten':_0x4458ca[_0x2d2b('0x7')],'priority':_0x36ca63[_0x2d2b('0x37')][_0x2d2b('0x22')]+_0x53c594+_0x55be70++,'VoiceExtensionId':_0x4458ca['id']});_0x430ef2[_0x2d2b('0x9')]({'type':_0x36ca63['type'][_0x2d2b('0x34')](),'app':_0x2d2b('0xa'),'appdata':_0x2d2b('0x40'),'context':_0x4458ca['context'],'exten':_0x4458ca[_0x2d2b('0x7')],'priority':_0x36ca63[_0x2d2b('0x37')]['length']+_0x53c594+_0x55be70++,'VoiceExtensionId':_0x4458ca['id']});}}}}for(var _0x44d5e9=0x0;_0x44d5e9<_0x36ca63['intervals'][_0x2d2b('0x22')];_0x44d5e9++){var _0x1b7e07=_0x53c594+_0x36ca63[_0x2d2b('0x37')]['length'];var _0x392232=_0x44d5e9===_0x36ca63[_0x2d2b('0x37')][_0x2d2b('0x22')]-0x1?_0x53c594+_0x430ef2[_0x2d2b('0x22')]+_0xe2d8ce[_0x2d2b('0x22')]+0x2:_0x53c594+_0x44d5e9+0x1;_0x430ef2[_0x2d2b('0x41')](_0x44d5e9,0x0,{'type':_0x4458ca[_0x2d2b('0x4')],'app':_0x2d2b('0x42'),'appdata':_0x36ca63[_0x2d2b('0x37')][_0x44d5e9]+'?'+_0x4458ca[_0x2d2b('0x6')]+',${EXTEN},'+_0x1b7e07+':'+_0x4458ca[_0x2d2b('0x6')]+_0x2d2b('0x43')+_0x392232,'exten':_0x4458ca['exten'],'context':_0x4458ca['context'],'priority':_0x53c594+_0x44d5e9,'VoiceExtensionId':_0x4458ca['id']});}if(_0x36ca63[_0x2d2b('0x3b')]===_0x2d2b('0x44')){_0x36ca63[_0x2d2b('0x45')]=_0x5165fb(_0x4458ca,_0x36ca63[_0x2d2b('0x45')]);}if(_0x36ca63[_0x2d2b('0x3b')]===_0x2d2b('0x46')){_0x430ef2[_0x2d2b('0x9')]({'type':_0x36ca63['type'][_0x2d2b('0x34')](),'app':_0x2d2b('0xa'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x4458ca['context'],'exten':_0x4458ca[_0x2d2b('0x7')],'priority':_0x36ca63[_0x2d2b('0x37')][_0x2d2b('0x22')]+_0x53c594+_0x55be70++,'VoiceExtensionId':_0x4458ca['id']});}_0x36ca63[_0x2d2b('0x47')]=_0x430ef2[_0x2d2b('0x22')]?_[_0x2d2b('0x48')](_0x430ef2)[_0x2d2b('0x47')]+0x1:_0x53c594;_0xc7bf8d=_['concat'](_0xc7bf8d,_0x430ef2,[_0x36ca63],_0xe2d8ce);_0x53c594=_['last'](_0xc7bf8d)[_0x2d2b('0x47')]+0x1;}return _0x24ed3e(_0xc7bf8d);})[_0x2d2b('0x49')](function(_0x1ff107){_0x4cb077(_0x1ff107);});});}return _0x433735[_0x2d2b('0x4a')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1b2ce5){var _0x1dc4e6=this[_0x2d2b('0x4b')]({'plain':!![]});var _0x163556=_0x1dc4e6['type']===_0x2d2b('0xd')?_0x5e2714(_0x1dc4e6):_0x2ef5cd(_0x1dc4e6);return _0x40e327(_0x1dc4e6,_0x1b2ce5,_[_0x2d2b('0x48')](_0x163556)['priority']+0x1)[_0x2d2b('0x2f')](function(_0x7932bd){var _0x476caa=_[_0x2d2b('0x4c')](_0x163556,_0x7932bd);_0x476caa[_0x2d2b('0x9')]({'type':_0x1dc4e6[_0x2d2b('0x4')],'app':_0x2d2b('0x4d'),'exten':_0x1dc4e6[_0x2d2b('0x7')],'context':_0x1dc4e6[_0x2d2b('0x6')],'priority':_[_0x2d2b('0x48')](_0x476caa)[_0x2d2b('0x47')]+0x1,'VoiceExtensionId':_0x1dc4e6['id']});return _0x476caa;});}}});}; \ No newline at end of file +var _0xb2fa=['Set','CDR(type)=','context','exten','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','timeout','options','url','split','name','trunk','param','phone','prefix','cutdigits','${EXTEN}','join','none','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','then','length','interval','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','VoiceExtension','get','concat','lodash','./voiceExtension.attributes','exports','models','type'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xb2fa,0x13b));var _0xab2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb2fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xab2f('0x0'));var attributes=require(_0xab2f('0x1'));module[_0xab2f('0x2')]=function(_0x12a684){var _0x2d261f=_0x12a684[_0xab2f('0x3')];function _0x414ab1(_0x4c9dc3){var _0x194fd9=0x2;var _0x42e28f=[{'type':_0x4c9dc3[_0xab2f('0x4')],'app':_0xab2f('0x5'),'appdata':_0xab2f('0x6')+_0x4c9dc3[_0xab2f('0x4')],'context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3[_0xab2f('0x8')],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']}];if(_0x4c9dc3[_0xab2f('0x4')]==='inbound'){_0x42e28f[_0xab2f('0x9')]({'type':_0xab2f('0xa'),'app':'Set','appdata':_0xab2f('0xb')+_0x4c9dc3['id'],'context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3[_0xab2f('0x8')],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']});}_0x42e28f[_0xab2f('0x9')]({'type':_0x4c9dc3[_0xab2f('0x4')],'app':_0xab2f('0x5'),'appdata':_0xab2f('0xc'),'context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3['exten'],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']},{'type':_0x4c9dc3[_0xab2f('0x4')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3['exten'],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']},{'type':_0x4c9dc3[_0xab2f('0x4')],'app':_0xab2f('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3[_0xab2f('0x8')],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']});return _0x42e28f;}function _0x4c182b(_0x4cd060){var _0x4967d5=0x2;var _0x20cc3c=[{'type':_0xab2f('0xd'),'app':_0xab2f('0x5'),'appdata':_0xab2f('0xe'),'context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':_0xab2f('0xd'),'app':_0xab2f('0x5'),'appdata':'CDR(destination)='+(_0x4cd060['cutdigits']?_0xab2f('0xf')+_0x4cd060['cutdigits']+'}':'${EXTEN}'),'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x5'),'appdata':'CDR(routeid)='+_0x4cd060['id'],'context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x10'),'appdata':_0xab2f('0x11')+(_0x4967d5+0x2)+'):Goto('+(_0x4967d5+0x1)+')','context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x5'),'appdata':_0x4cd060['cutdigits']?_0xab2f('0x12')+_0x4cd060['cutdigits']+'}':_0xab2f('0x13'),'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x5'),'appdata':_0xab2f('0xc'),'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x5'),'appdata':_0xab2f('0x14'),'context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':_0xab2f('0xd'),'app':_0xab2f('0x5'),'appdata':_0xab2f('0x15'),'context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060['exten'],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':_0xab2f('0xd'),'app':_0xab2f('0x5'),'appdata':'outboundrouteid='+_0x4cd060['id'],'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']}];if(_0x4cd060[_0xab2f('0x16')](_0xab2f('0x17'))&&_0x4cd060[_0xab2f('0x17')]!=='none'){_0x20cc3c[_0xab2f('0x9')]({'type':_0xab2f('0xd'),'app':'Set','appdata':_0xab2f('0x18'),'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':_0xab2f('0xd'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4cd060[_0xab2f('0x17')]||'wav','context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060['exten'],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']});}return _0x20cc3c;}function _0x2ab520(_0x9108a1,_0x4d5a98){var _0x411b50=[{'name':'trunk','param':0x0},{'name':_0xab2f('0x19'),'param':0x1},{'name':_0xab2f('0x1a'),'param':0x2},{'name':_0xab2f('0x1b'),'param':0x3}];var _0x18d000={};var _0x98b654=_0x4d5a98[_0xab2f('0x1c')](',');var _0x2ad2a8=[];for(var _0x46078a=0x0;_0x46078a<_0x411b50['length'];_0x46078a++){switch(_0x411b50[_0x46078a][_0xab2f('0x1d')]){case _0xab2f('0x1e'):_0x18d000[_0xab2f('0x1e')]=_0x98b654[_0x411b50[_0x46078a][_0xab2f('0x1f')]][_0xab2f('0x1c')]('/')[0x1];_0x18d000[_0xab2f('0x20')]=_0x98b654[_0x411b50[_0x46078a][_0xab2f('0x1f')]][_0xab2f('0x1c')]('/')[0x2];_0x18d000[_0xab2f('0x21')]=_0x18d000[_0xab2f('0x20')]?_0x18d000['phone'][_0xab2f('0x1c')]('$')[0x0]:undefined;_0x18d000[_0xab2f('0x20')]=_0x9108a1[_0xab2f('0x22')]?(_0x18d000[_0xab2f('0x21')]||'')+'${EXTEN:'+_0x9108a1['cutdigits']+'}':(_0x18d000['prefix']||'')+_0xab2f('0x23');_0x2ad2a8[_0x411b50[_0x46078a][_0xab2f('0x1f')]]=['SIP',_0x18d000[_0xab2f('0x1e')],_0x18d000[_0xab2f('0x20')]][_0xab2f('0x24')]('/');break;case _0xab2f('0x1a'):_0x18d000['options']=_0x98b654[_0x411b50[_0x46078a][_0xab2f('0x1f')]];if(_0x9108a1[_0xab2f('0x17')]!==_0xab2f('0x25')){if(_0x18d000[_0xab2f('0x1a')][_0xab2f('0x26')]('U(xcally-mixmonitor-context)')<0x0){_0x18d000[_0xab2f('0x1a')]+=_0xab2f('0x27');}}else{_0x18d000['options']=_0x18d000[_0xab2f('0x1a')]['replace'](_0xab2f('0x27'),'');}_0x2ad2a8[_0x411b50[_0x46078a][_0xab2f('0x1f')]]=_0x18d000[_0xab2f('0x1a')];break;default:_0x2ad2a8[_0x411b50[_0x46078a]['param']]=_0x98b654[_0x411b50[_0x46078a]['param']];}}return _0x2ad2a8[_0xab2f('0x24')](',');}function _0x3ab727(_0x5a18da,_0x4f8fe3,_0x1a7475){return new Promise(function(_0x1269dd,_0x3fc725){var _0x4ce5dc=[];if(_[_0xab2f('0x28')](_0x4f8fe3))return _0x1269dd(_0x4ce5dc);_0x2d261f[_0xab2f('0x29')][_0xab2f('0x2a')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xab2f('0x2b')](function(_0x284b6b){for(var _0x1a5e41=0x0,_0x4eb738=0x0;_0x1a5e41<_0x4f8fe3[_0xab2f('0x2c')];_0x1a5e41++,_0x4eb738=0x0){var _0x1e66b3=_0x4f8fe3[_0x1a5e41];var _0x4df3cd=[];var _0xf1462c=[];delete _0x1e66b3['id'];if(_0x1e66b3[_0xab2f('0x2d')]!==_0xab2f('0x2e')){_0x1e66b3[_0xab2f('0x2f')]=[_0x1e66b3['interval']];}else{_0x1e66b3['intervals']=_0x1e66b3[_0xab2f('0x30')]?_['map'](_[_0xab2f('0x31')](_0x284b6b,{'IntervalId':_0x1e66b3['IntervalId']}),_0xab2f('0x2d')):[];}_0x1e66b3[_0xab2f('0x7')]=_0x5a18da[_0xab2f('0x7')];_0x1e66b3[_0xab2f('0x8')]=_0x5a18da['exten'];if(_0x1e66b3[_0xab2f('0x4')])_0x1e66b3[_0xab2f('0x4')]=_0x1e66b3['type'][_0xab2f('0x32')]();if(_0x5a18da[_0xab2f('0x4')]==='outbound'){if(_0x1e66b3[_0xab2f('0x16')](_0xab2f('0x33'))&&_0x1e66b3[_0xab2f('0x33')]&&_0x1e66b3['tag']!=='--'){_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')][_0xab2f('0x32')](),'app':_0xab2f('0x5'),'appdata':_0xab2f('0x34')+_0x1e66b3[_0xab2f('0x33')],'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da[_0xab2f('0x8')],'priority':_0x1e66b3[_0xab2f('0x2f')]['length']+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')]['toLowerCase'](),'app':_0xab2f('0x10'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1e66b3[_0xab2f('0x35')]?'Set(CALLERID(all)='+_0x1e66b3['callerID']+')':_0xab2f('0x36')),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da['exten'],'priority':_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')]+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}else{if(_0x1e66b3[_0xab2f('0x16')](_0xab2f('0x37'))){if([_0xab2f('0x38'),_0xab2f('0x39')][_0xab2f('0x3a')](_0x1e66b3[_0xab2f('0x3b')][_0xab2f('0x32')]())&&_0x1e66b3[_0xab2f('0x3c')]!==_0xab2f('0x3d')){if(_0x1e66b3[_0xab2f('0x37')]){_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')]['toLowerCase'](),'app':_0xab2f('0x10'),'appdata':_0xab2f('0x3e'),'context':_0x5a18da['context'],'exten':_0x5a18da[_0xab2f('0x8')],'priority':_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')]+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});_0x4df3cd['push']({'type':_0x1e66b3[_0xab2f('0x4')][_0xab2f('0x32')](),'app':'Set','appdata':_0xab2f('0x3f'),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da['exten'],'priority':_0x1e66b3[_0xab2f('0x2f')]['length']+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}else{_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')][_0xab2f('0x32')](),'app':_0xab2f('0x10'),'appdata':_0xab2f('0x40'),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da['exten'],'priority':_0x1e66b3['intervals']['length']+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')][_0xab2f('0x32')](),'app':'Set','appdata':_0xab2f('0x41'),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da[_0xab2f('0x8')],'priority':_0x1e66b3['intervals']['length']+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}}}}for(var _0x3d56fe=0x0;_0x3d56fe<_0x1e66b3[_0xab2f('0x2f')]['length'];_0x3d56fe++){var _0x462a2b=_0x1a7475+_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')];var _0x1a0c58=_0x3d56fe===_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')]-0x1?_0x1a7475+_0x4df3cd['length']+_0xf1462c[_0xab2f('0x2c')]+0x2:_0x1a7475+_0x3d56fe+0x1;_0x4df3cd[_0xab2f('0x42')](_0x3d56fe,0x0,{'type':_0x5a18da[_0xab2f('0x4')],'app':_0xab2f('0x43'),'appdata':_0x1e66b3[_0xab2f('0x2f')][_0x3d56fe]+'?'+_0x5a18da[_0xab2f('0x7')]+',${EXTEN},'+_0x462a2b+':'+_0x5a18da[_0xab2f('0x7')]+_0xab2f('0x44')+_0x1a0c58,'exten':_0x5a18da[_0xab2f('0x8')],'context':_0x5a18da[_0xab2f('0x7')],'priority':_0x1a7475+_0x3d56fe,'VoiceExtensionId':_0x5a18da['id']});}if(_0x1e66b3[_0xab2f('0x3c')]===_0xab2f('0x45')){_0x1e66b3[_0xab2f('0x46')]=_0x2ab520(_0x5a18da,_0x1e66b3[_0xab2f('0x46')]);}if(_0x1e66b3[_0xab2f('0x3c')]===_0xab2f('0x47')){_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3['type']['toLowerCase'](),'app':_0xab2f('0x5'),'appdata':_0xab2f('0x48'),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da['exten'],'priority':_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')]+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}_0x1e66b3[_0xab2f('0x49')]=_0x4df3cd['length']?_[_0xab2f('0x4a')](_0x4df3cd)['priority']+0x1:_0x1a7475;_0x4ce5dc=_['concat'](_0x4ce5dc,_0x4df3cd,[_0x1e66b3],_0xf1462c);_0x1a7475=_[_0xab2f('0x4a')](_0x4ce5dc)[_0xab2f('0x49')]+0x1;}return _0x1269dd(_0x4ce5dc);})[_0xab2f('0x4b')](function(_0x599526){_0x3fc725(_0x599526);});});}return _0x12a684[_0xab2f('0x4c')](_0xab2f('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1090f1){var _0x33890d=this[_0xab2f('0x4e')]({'plain':!![]});var _0x2895c9=_0x33890d[_0xab2f('0x4')]===_0xab2f('0xd')?_0x4c182b(_0x33890d):_0x414ab1(_0x33890d);return _0x3ab727(_0x33890d,_0x1090f1,_[_0xab2f('0x4a')](_0x2895c9)['priority']+0x1)[_0xab2f('0x2b')](function(_0x8926f5){var _0x43a77d=_[_0xab2f('0x4f')](_0x2895c9,_0x8926f5);_0x43a77d[_0xab2f('0x9')]({'type':_0x33890d['type'],'app':'Hangup','exten':_0x33890d[_0xab2f('0x8')],'context':_0x33890d[_0xab2f('0x7')],'priority':_[_0xab2f('0x4a')](_0x43a77d)[_0xab2f('0x49')]+0x1,'VoiceExtensionId':_0x33890d['id']});return _0x43a77d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 9dbc3e7..7fd14d1 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 _0x48e3=['include','model','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceExtension','VoiceExtension','findAll','raw','options','where','attributes','limit','map'];(function(_0x3f1d11,_0x5e3836){var _0x38755f=function(_0x2d3dfe){while(--_0x2d3dfe){_0x3f1d11['push'](_0x3f1d11['shift']());}};_0x38755f(++_0x5e3836);}(_0x48e3,0xe9));var _0x348e=function(_0x37c284,_0x274130){_0x37c284=_0x37c284-0x0;var _0x40be18=_0x48e3[_0x37c284];return _0x40be18;};'use strict';var _=require(_0x348e('0x0'));var util=require(_0x348e('0x1'));var moment=require('moment');var BPromise=require(_0x348e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x348e('0x3'))['db'];var utils=require(_0x348e('0x4'));var logger=require(_0x348e('0x5'))(_0x348e('0x6'));var config=require('../../config/environment');var jayson=require(_0x348e('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x348e('0x8')]=_['defaults'](config['redis'],{'host':_0x348e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x348e('0x8')]));require(_0x348e('0xa'))[_0x348e('0xb')](socket);function respondWithRpcPromise(_0x9d9093,_0x2987d1,_0x69d401){return new BPromise(function(_0x2a91dd,_0x3b7f06){return client[_0x348e('0xc')](_0x9d9093,_0x69d401)[_0x348e('0xd')](function(_0x1dbfdb){logger[_0x348e('0xe')](_0x348e('0xf'),_0x2987d1,_0x348e('0x10'));logger['debug'](_0x348e('0x11'),_0x2987d1,_0x348e('0x10'),JSON[_0x348e('0x12')](_0x1dbfdb));if(_0x1dbfdb['error']){if(_0x1dbfdb[_0x348e('0x13')][_0x348e('0x14')]===0x1f4){logger[_0x348e('0x13')](_0x348e('0xf'),_0x2987d1,_0x1dbfdb[_0x348e('0x13')]['message']);return _0x3b7f06(_0x1dbfdb['error'][_0x348e('0x15')]);}logger[_0x348e('0x13')](_0x348e('0xf'),_0x2987d1,_0x1dbfdb[_0x348e('0x13')]['message']);return _0x2a91dd(_0x1dbfdb[_0x348e('0x13')]['message']);}else{logger[_0x348e('0xe')](_0x348e('0xf'),_0x2987d1,_0x348e('0x10'));_0x2a91dd(_0x1dbfdb['result'][_0x348e('0x15')]);}})['catch'](function(_0x579857){logger['error'](_0x348e('0xf'),_0x2987d1,_0x579857);_0x3b7f06(_0x579857);});});}exports[_0x348e('0x16')]=function(_0x3e27a6){var _0x33c5c0=this;return new Promise(function(_0x366bee,_0x3a5907){return db[_0x348e('0x17')][_0x348e('0x18')]({'raw':_0x3e27a6['options']?_0x3e27a6['options'][_0x348e('0x19')]===undefined?!![]:![]:!![],'where':_0x3e27a6[_0x348e('0x1a')]?_0x3e27a6[_0x348e('0x1a')][_0x348e('0x1b')]||null:null,'attributes':_0x3e27a6['options']?_0x3e27a6[_0x348e('0x1a')][_0x348e('0x1c')]||null:null,'limit':_0x3e27a6[_0x348e('0x1a')]?_0x3e27a6[_0x348e('0x1a')][_0x348e('0x1d')]||null:null,'include':_0x3e27a6[_0x348e('0x1a')]?_0x3e27a6[_0x348e('0x1a')]['include']?_[_0x348e('0x1e')](_0x3e27a6[_0x348e('0x1a')][_0x348e('0x1f')],function(_0x49ba87){return{'model':db[_0x49ba87[_0x348e('0x20')]],'as':_0x49ba87['as'],'attributes':_0x49ba87[_0x348e('0x1c')],'include':_0x49ba87[_0x348e('0x1f')]?_[_0x348e('0x1e')](_0x49ba87['include'],function(_0x1de341){return{'model':db[_0x1de341[_0x348e('0x20')]],'as':_0x1de341['as'],'attributes':_0x1de341[_0x348e('0x1c')],'include':_0x1de341[_0x348e('0x1f')]?_[_0x348e('0x1e')](_0x1de341[_0x348e('0x1f')],function(_0xcf5f40){return{'model':db[_0xcf5f40['model']],'as':_0xcf5f40['as'],'attributes':_0xcf5f40[_0x348e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x348e('0xd')](function(_0x4e7ae3){logger[_0x348e('0xe')](_0x348e('0x16'),_0x3e27a6);logger['debug'](_0x348e('0x16'),_0x3e27a6,JSON[_0x348e('0x12')](_0x4e7ae3));_0x366bee(_0x4e7ae3);})['catch'](function(_0x408641){logger[_0x348e('0x13')](_0x348e('0x16'),_0x408641[_0x348e('0x15')],_0x3e27a6);_0x3a5907(_0x33c5c0[_0x348e('0x13')](0x1f4,_0x408641[_0x348e('0x15')]));});});}; \ No newline at end of file +var _0x9505=['client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','raw','options','where','attributes','limit','include','model','map','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x2b480a,_0x50786a){var _0x15b748=function(_0xa7685c){while(--_0xa7685c){_0x2b480a['push'](_0x2b480a['shift']());}};_0x15b748(++_0x50786a);}(_0x9505,0x1e5));var _0x5950=function(_0x22eee8,_0x3ea3dd){_0x22eee8=_0x22eee8-0x0;var _0x283249=_0x9505[_0x22eee8];return _0x283249;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var moment=require('moment');var BPromise=require(_0x5950('0x2'));var rs=require(_0x5950('0x3'));var fs=require('fs');var Redis=require(_0x5950('0x4'));var db=require(_0x5950('0x5'))['db'];var utils=require(_0x5950('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5950('0x7'));var jayson=require(_0x5950('0x8'));var client=jayson[_0x5950('0x9')][_0x5950('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5950('0xb')],{'host':_0x5950('0xc'),'port':0x18eb});var socket=require(_0x5950('0xd'))(new Redis(config[_0x5950('0xb')]));require(_0x5950('0xe'))[_0x5950('0xf')](socket);function respondWithRpcPromise(_0x1148ef,_0x213e3b,_0x1c8f39){return new BPromise(function(_0x5ef4ab,_0x32f2e0){return client[_0x5950('0x10')](_0x1148ef,_0x1c8f39)['then'](function(_0x5a6098){logger[_0x5950('0x11')](_0x5950('0x12'),_0x213e3b,_0x5950('0x13'));logger[_0x5950('0x14')](_0x5950('0x15'),_0x213e3b,_0x5950('0x13'),JSON[_0x5950('0x16')](_0x5a6098));if(_0x5a6098[_0x5950('0x17')]){if(_0x5a6098[_0x5950('0x17')][_0x5950('0x18')]===0x1f4){logger[_0x5950('0x17')](_0x5950('0x12'),_0x213e3b,_0x5a6098[_0x5950('0x17')][_0x5950('0x19')]);return _0x32f2e0(_0x5a6098[_0x5950('0x17')][_0x5950('0x19')]);}logger[_0x5950('0x17')](_0x5950('0x12'),_0x213e3b,_0x5a6098[_0x5950('0x17')][_0x5950('0x19')]);return _0x5ef4ab(_0x5a6098[_0x5950('0x17')]['message']);}else{logger['info'](_0x5950('0x12'),_0x213e3b,_0x5950('0x13'));_0x5ef4ab(_0x5a6098[_0x5950('0x1a')][_0x5950('0x19')]);}})[_0x5950('0x1b')](function(_0x483aaf){logger['error'](_0x5950('0x12'),_0x213e3b,_0x483aaf);_0x32f2e0(_0x483aaf);});});}exports[_0x5950('0x1c')]=function(_0x1ad343){var _0x5bd90e=this;return new Promise(function(_0x1cf241,_0x3ea879){return db['VoiceExtension']['findAll']({'raw':_0x1ad343['options']?_0x1ad343['options'][_0x5950('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ad343[_0x5950('0x1e')]?_0x1ad343[_0x5950('0x1e')][_0x5950('0x1f')]||null:null,'attributes':_0x1ad343['options']?_0x1ad343[_0x5950('0x1e')][_0x5950('0x20')]||null:null,'limit':_0x1ad343[_0x5950('0x1e')]?_0x1ad343[_0x5950('0x1e')][_0x5950('0x21')]||null:null,'include':_0x1ad343[_0x5950('0x1e')]?_0x1ad343[_0x5950('0x1e')]['include']?_['map'](_0x1ad343[_0x5950('0x1e')][_0x5950('0x22')],function(_0x545354){return{'model':db[_0x545354[_0x5950('0x23')]],'as':_0x545354['as'],'attributes':_0x545354[_0x5950('0x20')],'include':_0x545354['include']?_['map'](_0x545354['include'],function(_0x20679e){return{'model':db[_0x20679e[_0x5950('0x23')]],'as':_0x20679e['as'],'attributes':_0x20679e[_0x5950('0x20')],'include':_0x20679e[_0x5950('0x22')]?_[_0x5950('0x24')](_0x20679e[_0x5950('0x22')],function(_0x2ff8a3){return{'model':db[_0x2ff8a3[_0x5950('0x23')]],'as':_0x2ff8a3['as'],'attributes':_0x2ff8a3[_0x5950('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5950('0x25')](function(_0x24db8b){logger[_0x5950('0x11')](_0x5950('0x1c'),_0x1ad343);logger[_0x5950('0x14')](_0x5950('0x1c'),_0x1ad343,JSON[_0x5950('0x16')](_0x24db8b));_0x1cf241(_0x24db8b);})[_0x5950('0x1b')](function(_0x18a8ca){logger[_0x5950('0x17')](_0x5950('0x1c'),_0x18a8ca[_0x5950('0x19')],_0x1ad343);_0x3ea879(_0x5bd90e[_0x5950('0x17')](0x1f4,_0x18a8ca[_0x5950('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 124b07d..86717eb 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 _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x403431,_0x4929f9){var _0xc10279=function(_0x1a6dfe){while(--_0x1a6dfe){_0x403431['push'](_0x403431['shift']());}};_0xc10279(++_0x4929f9);}(_0x326f,0xd1));var _0xf326=function(_0x41506c,_0x1bdbd5){_0x41506c=_0x41506c-0x0;var _0x2f720a=_0x326f[_0x41506c];return _0x2f720a;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3461f8,_0x18e152){_0x3461f8=_0x3461f8-0x0;var _0x14586d=_0x1cb9[_0x3461f8];return _0x14586d;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 237a02e..c2abcba 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 _0x7b84=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x39a177,_0x2a09ae){var _0x184850=function(_0x5e4801){while(--_0x5e4801){_0x39a177['push'](_0x39a177['shift']());}};_0x184850(++_0x2a09ae);}(_0x7b84,0x17c));var _0x47b8=function(_0x2aab4d,_0x346b0){_0x2aab4d=_0x2aab4d-0x0;var _0x5b37e9=_0x7b84[_0x2aab4d];return _0x5b37e9;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0x11')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x13')](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0x15')](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);module[_0x47b8('0x17')]=router; \ No newline at end of file +var _0xb091=['getMessages','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','show','/:id/messages'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0xb091,0x16e));var _0x1b09=function(_0x9620cd,_0x5a371d){_0x9620cd=_0x9620cd-0x0;var _0x3d1788=_0xb091[_0x9620cd];return _0x3d1788;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/:id',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0xd')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0xf')](_0x1b09('0x10'),auth['isAuthenticated'](),controller[_0x1b09('0x11')]);router[_0x1b09('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1b09('0x13')]);module[_0x1b09('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 31291a1..9a075c5 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 _0x9e86=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central'];(function(_0x448774,_0x45ddc7){var _0x46b2f6=function(_0x1dee94){while(--_0x1dee94){_0x448774['push'](_0x448774['shift']());}};_0x46b2f6(++_0x45ddc7);}(_0x9e86,0x14a));var _0x69e8=function(_0x518a39,_0x3b378d){_0x518a39=_0x518a39-0x0;var _0x4126de=_0x9e86[_0x518a39];return _0x4126de;};'use strict';var Sequelize=require(_0x69e8('0x0'));module[_0x69e8('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x69e8('0x2')],'defaultValue':_0x69e8('0x3'),'unique':_0x69e8('0x4')},'mailbox':{'type':Sequelize[_0x69e8('0x2')],'defaultValue':'','allowNull':![],'unique':_0x69e8('0x4')},'password':{'type':Sequelize[_0x69e8('0x2')]},'fullname':{'type':Sequelize[_0x69e8('0x2')]},'email':{'type':Sequelize[_0x69e8('0x2')],'validate':{'isEmail':!![]},'set':function(_0x50adc7){this[_0x69e8('0x5')](_0x69e8('0x6'),typeof _0x50adc7===_0x69e8('0x7')&&_0x50adc7[_0x69e8('0x8')]()?_0x50adc7[_0x69e8('0x8')]():null);}},'pager':{'type':Sequelize[_0x69e8('0x2')]},'tz':{'type':Sequelize[_0x69e8('0x2')],'defaultValue':_0x69e8('0x9')},'attach':{'type':Sequelize[_0x69e8('0xa')](_0x69e8('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x69e8('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x69e8('0x2')]},'callback':{'type':Sequelize[_0x69e8('0x2')]},'review':{'type':Sequelize[_0x69e8('0xa')](_0x69e8('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x69e8('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x69e8('0xa')](_0x69e8('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x69e8('0xa')](_0x69e8('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x69e8('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x69e8('0xa')](_0x69e8('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x69e8('0xa')](_0x69e8('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x69e8('0xa')](_0x69e8('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x69e8('0xa')](_0x69e8('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x69e8('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x69e8('0xb'),'no'),'defaultValue':_0x69e8('0xb'),'allowNull':![]},'stamp':{'type':_0x69e8('0xd')},'emailsubject':{'type':Sequelize[_0x69e8('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x69e8('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x69e8('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x69e8('0xf')],'get':function(){return this[_0x69e8('0x10')](_0x69e8('0x11'))+_0x69e8('0x12')+this['getDataValue'](_0x69e8('0x13'));}}}; \ No newline at end of file +var _0xb051=['INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x546201,_0x49ee3e){var _0x57e598=function(_0x54403f){while(--_0x54403f){_0x546201['push'](_0x546201['shift']());}};_0x57e598(++_0x49ee3e);}(_0xb051,0x191));var _0x1b05=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xb051[_0x32f9ca];return _0x52e083;};'use strict';var Sequelize=require('sequelize');module[_0x1b05('0x0')]={'customer_id':{'type':Sequelize[_0x1b05('0x1')]},'context':{'type':Sequelize[_0x1b05('0x1')],'defaultValue':_0x1b05('0x2'),'unique':_0x1b05('0x3')},'mailbox':{'type':Sequelize[_0x1b05('0x1')],'defaultValue':'','allowNull':![],'unique':_0x1b05('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x1b05('0x1')]},'email':{'type':Sequelize[_0x1b05('0x1')],'validate':{'isEmail':!![]},'set':function(_0x391235){this[_0x1b05('0x4')](_0x1b05('0x5'),typeof _0x391235===_0x1b05('0x6')&&_0x391235[_0x1b05('0x7')]()?_0x391235[_0x1b05('0x7')]():null);}},'pager':{'type':Sequelize[_0x1b05('0x1')]},'tz':{'type':Sequelize[_0x1b05('0x1')],'defaultValue':_0x1b05('0x8')},'attach':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':_0x1b05('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1b05('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x1b05('0x1')]},'callback':{'type':Sequelize[_0x1b05('0x1')]},'review':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1b05('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1b05('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x1b05('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x1b05('0xc')},'emailsubject':{'type':Sequelize[_0x1b05('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1b05('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1b05('0xe')],'get':function(){return this[_0x1b05('0xf')]('fullname')+_0x1b05('0x10')+this[_0x1b05('0xf')](_0x1b05('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index b678df4..99fe1a1 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 _0xde2c=['query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','find','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','save','update','destroy','get','Voicemails','UserProfileResource','then','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key'];(function(_0x3d46cf,_0x1d39e9){var _0x1e048e=function(_0x22de66){while(--_0x22de66){_0x3d46cf['push'](_0x3d46cf['shift']());}};_0x1e048e(++_0x1d39e9);}(_0xde2c,0x7f));var _0xcde2=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0xde2c[_0x56825b];return _0x69ce77;};'use strict';var emlformat=require(_0xcde2('0x0'));var rimraf=require(_0xcde2('0x1'));var zipdir=require(_0xcde2('0x2'));var jsonpatch=require(_0xcde2('0x3'));var rp=require(_0xcde2('0x4'));var moment=require(_0xcde2('0x5'));var BPromise=require(_0xcde2('0x6'));var Mustache=require(_0xcde2('0x7'));var util=require('util');var path=require(_0xcde2('0x8'));var sox=require(_0xcde2('0x9'));var csv=require(_0xcde2('0xa'));var ejs=require(_0xcde2('0xb'));var fs=require('fs');var fs_extra=require(_0xcde2('0xc'));var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var licenseUtil=require(_0xcde2('0x18'));var db=require(_0xcde2('0x19'))['db'];function respondWithStatusCode(_0x932b90,_0x1ea4bb){_0x1ea4bb=_0x1ea4bb||0xcc;return function(_0x599294){if(_0x599294){return _0x932b90[_0xcde2('0x1a')](_0x1ea4bb);}return _0x932b90['status'](_0x1ea4bb)[_0xcde2('0x1b')]();};}function respondWithResult(_0x4f0ac9,_0x4b0e0e){_0x4b0e0e=_0x4b0e0e||0xc8;return function(_0x34e079){if(_0x34e079){return _0x4f0ac9[_0xcde2('0x1c')](_0x4b0e0e)[_0xcde2('0x1d')](_0x34e079);}};}function respondWithFilteredResult(_0x19b54b,_0x11665c){return function(_0x5312c7){if(_0x5312c7){var _0x39b023=typeof _0x11665c['offset']===_0xcde2('0x1e')&&typeof _0x11665c[_0xcde2('0x1f')]===_0xcde2('0x1e');var _0x1f1858=_0x5312c7['count'];var _0x4fd5aa=_0x39b023?0x0:_0x11665c['offset'];var _0x2b4468=_0x39b023?_0x5312c7['count']:_0x11665c[_0xcde2('0x20')]+_0x11665c[_0xcde2('0x1f')];var _0x252372;if(_0x2b4468>=_0x1f1858){_0x2b4468=_0x1f1858;_0x252372=0xc8;}else{_0x252372=0xce;}_0x19b54b['status'](_0x252372);return _0x19b54b[_0xcde2('0x21')](_0xcde2('0x22'),_0x4fd5aa+'-'+_0x2b4468+'/'+_0x1f1858)[_0xcde2('0x1d')](_0x5312c7);}return null;};}function patchUpdates(_0x3c1d7e){return function(_0x43df7a){try{jsonpatch['apply'](_0x43df7a,_0x3c1d7e,!![]);}catch(_0x4bce90){return BPromise['reject'](_0x4bce90);}return _0x43df7a[_0xcde2('0x23')]();};}function saveUpdates(_0x3e5170,_0x2c9562){return function(_0x4063d4){if(_0x4063d4){return _0x4063d4[_0xcde2('0x24')](_0x3e5170)['then'](function(_0x1104b8){return _0x1104b8;});}return null;};}function removeEntity(_0x52368b,_0x280d8c){return function(_0xb2123c){if(_0xb2123c){return _0xb2123c[_0xcde2('0x25')]()['then'](function(){var _0x593aa4=_0xb2123c[_0xcde2('0x26')]({'plain':!![]});var _0x207a12=_0xcde2('0x27');return db[_0xcde2('0x28')][_0xcde2('0x25')]({'where':{'type':_0x207a12,'resourceId':_0x593aa4['id']}})['then'](function(){return _0xb2123c;});})[_0xcde2('0x29')](function(){_0x52368b[_0xcde2('0x1c')](0xcc)[_0xcde2('0x1b')]();});}};}function handleEntityNotFound(_0x513965,_0x2487eb){return function(_0x348ca1){if(!_0x348ca1){_0x513965[_0xcde2('0x1a')](0x194);}return _0x348ca1;};}function handleError(_0x40309d,_0xd7019){_0xd7019=_0xd7019||0x1f4;return function(_0x5b2b7){logger[_0xcde2('0x2a')](_0x5b2b7[_0xcde2('0x2b')]);if(_0x5b2b7['name']){delete _0x5b2b7[_0xcde2('0x2c')];}_0x40309d['status'](_0xd7019)[_0xcde2('0x2d')](_0x5b2b7);};}exports[_0xcde2('0x2e')]=function(_0x43706c,_0x49cb58){var _0xae46dc={},_0x28fedd={},_0x58afb1={'count':0x0,'rows':[]};var _0x26ec42=_[_0xcde2('0x2f')](db[_0xcde2('0x30')][_0xcde2('0x31')],function(_0x14f784){return{'name':_0x14f784[_0xcde2('0x32')],'type':_0x14f784[_0xcde2('0x33')][_0xcde2('0x34')]};});_0x28fedd['model']=_[_0xcde2('0x2f')](_0x26ec42,_0xcde2('0x2c'));_0x28fedd[_0xcde2('0x35')]=_[_0xcde2('0x36')](_0x43706c['query']);_0x28fedd[_0xcde2('0x37')]=_[_0xcde2('0x38')](_0x28fedd[_0xcde2('0x39')],_0x28fedd[_0xcde2('0x35')]);_0xae46dc['attributes']=_[_0xcde2('0x38')](_0x28fedd[_0xcde2('0x39')],qs[_0xcde2('0x3a')](_0x43706c[_0xcde2('0x35')]['fields']));_0xae46dc[_0xcde2('0x3b')]=_0xae46dc[_0xcde2('0x3b')][_0xcde2('0x3c')]?_0xae46dc[_0xcde2('0x3b')]:_0x28fedd[_0xcde2('0x39')];if(!_0x43706c['query'][_0xcde2('0x3d')](_0xcde2('0x3e'))){_0xae46dc[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x43706c['query']['limit']);_0xae46dc[_0xcde2('0x20')]=qs[_0xcde2('0x20')](_0x43706c[_0xcde2('0x35')][_0xcde2('0x20')]);}_0xae46dc[_0xcde2('0x3f')]=qs[_0xcde2('0x40')](_0x43706c[_0xcde2('0x35')][_0xcde2('0x40')]);_0xae46dc[_0xcde2('0x41')]=qs['filters'](_[_0xcde2('0x42')](_0x43706c[_0xcde2('0x35')],_0x28fedd[_0xcde2('0x37')]),_0x26ec42);if(_0x43706c[_0xcde2('0x35')][_0xcde2('0x43')]){_0xae46dc['where']=_['merge'](_0xae46dc[_0xcde2('0x41')],{'$or':_[_0xcde2('0x2f')](_0x26ec42,function(_0x20dfad){if(_0x20dfad[_0xcde2('0x33')]!==_0xcde2('0x44')){var _0x1939a0={};_0x1939a0[_0x20dfad['name']]={'$like':'%'+_0x43706c['query']['filter']+'%'};return _0x1939a0;}})});}_0xae46dc=_[_0xcde2('0x45')]({},_0xae46dc,_0x43706c[_0xcde2('0x46')]);var _0x1cfe20={'where':_0xae46dc[_0xcde2('0x41')]};return db[_0xcde2('0x30')][_0xcde2('0x47')](_0x1cfe20)[_0xcde2('0x29')](function(_0x49b862){_0x58afb1['count']=_0x49b862;if(_0x43706c[_0xcde2('0x35')]['includeAll']){_0xae46dc[_0xcde2('0x48')]=[{'all':!![]}];}return db['VoiceMail'][_0xcde2('0x49')](_0xae46dc);})[_0xcde2('0x29')](function(_0x2cf372){_0x58afb1['rows']=_0x2cf372;return _0x58afb1;})[_0xcde2('0x29')](respondWithFilteredResult(_0x49cb58,_0xae46dc))['catch'](handleError(_0x49cb58,null));};exports[_0xcde2('0x4a')]=function(_0x24a46a,_0x1e661f){var _0x79e073={'raw':!![],'where':{'id':_0x24a46a[_0xcde2('0x4b')]['id']}},_0xcafd7={};_0xcafd7['model']=_['keys'](db[_0xcde2('0x30')]['rawAttributes']);_0xcafd7['query']=_[_0xcde2('0x36')](_0x24a46a['query']);_0xcafd7[_0xcde2('0x37')]=_[_0xcde2('0x38')](_0xcafd7['model'],_0xcafd7[_0xcde2('0x35')]);_0x79e073['attributes']=_['intersection'](_0xcafd7[_0xcde2('0x39')],qs[_0xcde2('0x3a')](_0x24a46a['query'][_0xcde2('0x3a')]));_0x79e073['attributes']=_0x79e073[_0xcde2('0x3b')][_0xcde2('0x3c')]?_0x79e073[_0xcde2('0x3b')]:_0xcafd7[_0xcde2('0x39')];if(_0x24a46a[_0xcde2('0x35')]['includeAll']){_0x79e073[_0xcde2('0x48')]=[{'all':!![]}];}_0x79e073=_[_0xcde2('0x45')]({},_0x79e073,_0x24a46a[_0xcde2('0x46')]);return db[_0xcde2('0x30')]['find'](_0x79e073)['then'](handleEntityNotFound(_0x1e661f,null))[_0xcde2('0x29')](respondWithResult(_0x1e661f,null))['catch'](handleError(_0x1e661f,null));};exports[_0xcde2('0x4c')]=function(_0x3e9e79,_0x381bd4){return db[_0xcde2('0x30')][_0xcde2('0x4c')](_0x3e9e79[_0xcde2('0x4d')],{})['then'](function(_0x1ce5fe){var _0x5b996d=_0x3e9e79[_0xcde2('0x4e')]['get']({'plain':!![]});if(!_0x5b996d)throw new Error(_0xcde2('0x4f'));if(_0x5b996d[_0xcde2('0x50')]===_0xcde2('0x4e')){var _0x16cddb=_0x1ce5fe[_0xcde2('0x26')]({'plain':!![]});var _0x5071ce='Voicemails';return db[_0xcde2('0x51')]['find']({'where':{'name':_0x5071ce,'userProfileId':_0x5b996d[_0xcde2('0x52')]},'raw':!![]})[_0xcde2('0x29')](function(_0x3d2ce7){if(_0x3d2ce7&&_0x3d2ce7[_0xcde2('0x53')]===0x0){return db[_0xcde2('0x28')][_0xcde2('0x4c')]({'name':_0x16cddb[_0xcde2('0x2c')],'resourceId':_0x16cddb['id'],'type':_0x3d2ce7[_0xcde2('0x2c')],'sectionId':_0x3d2ce7['id']},{})[_0xcde2('0x29')](function(){return _0x1ce5fe;});}else{return _0x1ce5fe;}})[_0xcde2('0x54')](function(_0x3c5a17){logger[_0xcde2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c5a17);throw _0x3c5a17;});}return _0x1ce5fe;})['then'](respondWithResult(_0x381bd4,0xc9))['catch'](handleError(_0x381bd4,null));};exports[_0xcde2('0x24')]=function(_0x59a64d,_0x1751dd){if(_0x59a64d[_0xcde2('0x4d')]['id']){delete _0x59a64d[_0xcde2('0x4d')]['id'];}return db['VoiceMail'][_0xcde2('0x55')]({'where':{'id':_0x59a64d['params']['id']}})[_0xcde2('0x29')](handleEntityNotFound(_0x1751dd,null))['then'](saveUpdates(_0x59a64d[_0xcde2('0x4d')],null))[_0xcde2('0x29')](respondWithResult(_0x1751dd,null))['catch'](handleError(_0x1751dd,null));};exports[_0xcde2('0x25')]=function(_0x4dfabb,_0x5e6fd3){return db[_0xcde2('0x30')][_0xcde2('0x55')]({'where':{'id':_0x4dfabb[_0xcde2('0x4b')]['id']}})[_0xcde2('0x29')](handleEntityNotFound(_0x5e6fd3,null))[_0xcde2('0x29')](removeEntity(_0x5e6fd3,null))[_0xcde2('0x54')](handleError(_0x5e6fd3,null));};exports['getMessages']=function(_0x47329f,_0x44b3fb,_0x21b4e6){return db[_0xcde2('0x30')][_0xcde2('0x56')]({'where':{'id':_0x47329f[_0xcde2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x44b3fb,null))['then'](function(_0x30dee3){var _0x35c6e5;var _0x6a9fa4={},_0x109472={};_0x109472['model']=_[_0xcde2('0x36')](db[_0xcde2('0x57')][_0xcde2('0x31')]);_0x109472[_0xcde2('0x35')]=_[_0xcde2('0x36')](_0x47329f[_0xcde2('0x35')]);_0x109472['filters']=_[_0xcde2('0x38')](_0x109472[_0xcde2('0x39')],_0x109472['query']);_0x6a9fa4[_0xcde2('0x3b')]=_[_0xcde2('0x38')](_0x109472[_0xcde2('0x39')],qs[_0xcde2('0x3a')](_0x47329f[_0xcde2('0x35')][_0xcde2('0x3a')]));_0x6a9fa4[_0xcde2('0x3b')]=_0x6a9fa4[_0xcde2('0x3b')][_0xcde2('0x3c')]?_0x6a9fa4[_0xcde2('0x3b')]:_0x109472['model'];if(!_0x47329f[_0xcde2('0x35')][_0xcde2('0x3d')]('nolimit')){_0x6a9fa4[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x47329f[_0xcde2('0x35')]['limit']);_0x6a9fa4[_0xcde2('0x20')]=qs[_0xcde2('0x20')](_0x47329f[_0xcde2('0x35')][_0xcde2('0x20')]);}_0x6a9fa4[_0xcde2('0x3f')]=qs[_0xcde2('0x40')](_0x47329f[_0xcde2('0x35')][_0xcde2('0x40')]);_0x6a9fa4[_0xcde2('0x41')]=qs[_0xcde2('0x37')](_[_0xcde2('0x42')](_0x47329f['query'],_0x109472['filters']));if(_0x47329f[_0xcde2('0x35')][_0xcde2('0x43')]){_0x6a9fa4[_0xcde2('0x41')]=_['merge'](_0x6a9fa4['where'],{'$or':_['map'](_0x6a9fa4[_0xcde2('0x3b')],function(_0x367bad){var _0x161a8b={};_0x161a8b[_0x367bad]={'$like':'%'+_0x47329f[_0xcde2('0x35')][_0xcde2('0x43')]+'%'};return _0x161a8b;})});}_0x6a9fa4[_0xcde2('0x41')]=_['merge'](_0x6a9fa4['where'],{'mailboxuser':_0x30dee3[_0xcde2('0x58')]});_0x6a9fa4=_[_0xcde2('0x45')]({},_0x6a9fa4,_0x47329f[_0xcde2('0x46')]);return db[_0xcde2('0x57')][_0xcde2('0x59')](_0x6a9fa4)[_0xcde2('0x29')](respondWithFilteredResult(_0x44b3fb,_0x6a9fa4));})[_0xcde2('0x54')](handleError(_0x44b3fb,null));}; \ No newline at end of file +var _0x2547=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','map','options','includeAll','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','sort','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','error','stack','name','send','VoiceMail','rawAttributes','fieldName','type'];(function(_0x4879e0,_0x292f9b){var _0x4028c9=function(_0x32657d){while(--_0x32657d){_0x4879e0['push'](_0x4879e0['shift']());}};_0x4028c9(++_0x292f9b);}(_0x2547,0x1cd));var _0x7254=function(_0xc6a024,_0x4a3064){_0xc6a024=_0xc6a024-0x0;var _0x1f3af4=_0x2547[_0xc6a024];return _0x1f3af4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){var _0x54dace=_0x136ea3[_0x7254('0x27')]({'plain':!![]});var _0x36b5d5=_0x7254('0x28');return db['UserProfileResource'][_0x7254('0x26')]({'where':{'type':_0x36b5d5,'resourceId':_0x54dace['id']}})[_0x7254('0x25')](function(){return _0x136ea3;});})[_0x7254('0x25')](function(){_0x50c34b['status'](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x594a63,_0x1bb6a7){return function(_0x134a9e){if(!_0x134a9e){_0x594a63['sendStatus'](0x194);}return _0x134a9e;};}function handleError(_0x17bb46,_0x158356){_0x158356=_0x158356||0x1f4;return function(_0x4f684c){logger[_0x7254('0x29')](_0x4f684c[_0x7254('0x2a')]);if(_0x4f684c[_0x7254('0x2b')]){delete _0x4f684c[_0x7254('0x2b')];}_0x17bb46[_0x7254('0x18')](_0x158356)[_0x7254('0x2c')](_0x4f684c);};}exports['index']=function(_0x146028,_0x2dba3f){var _0x5569be={},_0x2f75ea={},_0x1279cd={'count':0x0,'rows':[]};var _0x2be5fc=_['map'](db[_0x7254('0x2d')][_0x7254('0x2e')],function(_0x354305){return{'name':_0x354305[_0x7254('0x2f')],'type':_0x354305[_0x7254('0x30')][_0x7254('0x31')]};});_0x2f75ea[_0x7254('0x32')]=_['map'](_0x2be5fc,_0x7254('0x2b'));_0x2f75ea['query']=_['keys'](_0x146028[_0x7254('0x33')]);_0x2f75ea[_0x7254('0x34')]=_[_0x7254('0x35')](_0x2f75ea[_0x7254('0x32')],_0x2f75ea[_0x7254('0x33')]);_0x5569be[_0x7254('0x36')]=_[_0x7254('0x35')](_0x2f75ea[_0x7254('0x32')],qs[_0x7254('0x37')](_0x146028[_0x7254('0x33')][_0x7254('0x37')]));_0x5569be[_0x7254('0x36')]=_0x5569be[_0x7254('0x36')][_0x7254('0x38')]?_0x5569be['attributes']:_0x2f75ea[_0x7254('0x32')];if(!_0x146028[_0x7254('0x33')][_0x7254('0x39')](_0x7254('0x3a'))){_0x5569be[_0x7254('0x1d')]=qs['limit'](_0x146028[_0x7254('0x33')]['limit']);_0x5569be[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x146028[_0x7254('0x33')][_0x7254('0x1b')]);}_0x5569be[_0x7254('0x3b')]=qs['sort'](_0x146028[_0x7254('0x33')]['sort']);_0x5569be[_0x7254('0x3c')]=qs[_0x7254('0x34')](_['pick'](_0x146028[_0x7254('0x33')],_0x2f75ea[_0x7254('0x34')]),_0x2be5fc);if(_0x146028[_0x7254('0x33')][_0x7254('0x3d')]){_0x5569be[_0x7254('0x3c')]=_[_0x7254('0x3e')](_0x5569be['where'],{'$or':_[_0x7254('0x3f')](_0x2be5fc,function(_0x102d87){if(_0x102d87[_0x7254('0x30')]!=='VIRTUAL'){var _0x3fbad7={};_0x3fbad7[_0x102d87[_0x7254('0x2b')]]={'$like':'%'+_0x146028[_0x7254('0x33')]['filter']+'%'};return _0x3fbad7;}})});}_0x5569be=_[_0x7254('0x3e')]({},_0x5569be,_0x146028[_0x7254('0x40')]);var _0x18a918={'where':_0x5569be[_0x7254('0x3c')]};return db[_0x7254('0x2d')]['count'](_0x18a918)['then'](function(_0x25004f){_0x1279cd[_0x7254('0x1e')]=_0x25004f;if(_0x146028[_0x7254('0x33')][_0x7254('0x41')]){_0x5569be['include']=[{'all':!![]}];}return db['VoiceMail'][_0x7254('0x42')](_0x5569be);})['then'](function(_0x2ae22e){_0x1279cd[_0x7254('0x43')]=_0x2ae22e;return _0x1279cd;})[_0x7254('0x25')](respondWithFilteredResult(_0x2dba3f,_0x5569be))[_0x7254('0x44')](handleError(_0x2dba3f,null));};exports['show']=function(_0x4adf34,_0x467f31){var _0x3f6ead={'raw':!![],'where':{'id':_0x4adf34[_0x7254('0x45')]['id']}},_0x29b90c={};_0x29b90c[_0x7254('0x32')]=_['keys'](db['VoiceMail'][_0x7254('0x2e')]);_0x29b90c[_0x7254('0x33')]=_[_0x7254('0x46')](_0x4adf34['query']);_0x29b90c[_0x7254('0x34')]=_[_0x7254('0x35')](_0x29b90c['model'],_0x29b90c[_0x7254('0x33')]);_0x3f6ead[_0x7254('0x36')]=_[_0x7254('0x35')](_0x29b90c[_0x7254('0x32')],qs['fields'](_0x4adf34[_0x7254('0x33')][_0x7254('0x37')]));_0x3f6ead['attributes']=_0x3f6ead[_0x7254('0x36')][_0x7254('0x38')]?_0x3f6ead[_0x7254('0x36')]:_0x29b90c['model'];if(_0x4adf34[_0x7254('0x33')][_0x7254('0x41')]){_0x3f6ead['include']=[{'all':!![]}];}_0x3f6ead=_['merge']({},_0x3f6ead,_0x4adf34[_0x7254('0x40')]);return db['VoiceMail'][_0x7254('0x47')](_0x3f6ead)[_0x7254('0x25')](handleEntityNotFound(_0x467f31,null))['then'](respondWithResult(_0x467f31,null))['catch'](handleError(_0x467f31,null));};exports[_0x7254('0x48')]=function(_0xc40bc5,_0x38bcd5){return db[_0x7254('0x2d')][_0x7254('0x48')](_0xc40bc5[_0x7254('0x49')],{})['then'](function(_0x245213){var _0x5ef7f9=_0xc40bc5[_0x7254('0x4a')][_0x7254('0x27')]({'plain':!![]});if(!_0x5ef7f9)throw new Error(_0x7254('0x4b'));if(_0x5ef7f9['role']===_0x7254('0x4a')){var _0x1c1a0e=_0x245213[_0x7254('0x27')]({'plain':!![]});var _0x5b3b6e=_0x7254('0x28');return db[_0x7254('0x4c')][_0x7254('0x47')]({'where':{'name':_0x5b3b6e,'userProfileId':_0x5ef7f9[_0x7254('0x4d')]},'raw':!![]})[_0x7254('0x25')](function(_0x4e1e38){if(_0x4e1e38&&_0x4e1e38['autoAssociation']===0x0){return db[_0x7254('0x4e')][_0x7254('0x48')]({'name':_0x1c1a0e[_0x7254('0x2b')],'resourceId':_0x1c1a0e['id'],'type':_0x4e1e38[_0x7254('0x2b')],'sectionId':_0x4e1e38['id']},{})[_0x7254('0x25')](function(){return _0x245213;});}else{return _0x245213;}})['catch'](function(_0x5a44fb){logger[_0x7254('0x29')](_0x7254('0x4f'),_0x5a44fb);throw _0x5a44fb;});}return _0x245213;})[_0x7254('0x25')](respondWithResult(_0x38bcd5,0xc9))[_0x7254('0x44')](handleError(_0x38bcd5,null));};exports['update']=function(_0xaf6d3d,_0x3e3d09){if(_0xaf6d3d['body']['id']){delete _0xaf6d3d[_0x7254('0x49')]['id'];}return db['VoiceMail'][_0x7254('0x47')]({'where':{'id':_0xaf6d3d['params']['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x3e3d09,null))['then'](saveUpdates(_0xaf6d3d['body'],null))[_0x7254('0x25')](respondWithResult(_0x3e3d09,null))[_0x7254('0x44')](handleError(_0x3e3d09,null));};exports[_0x7254('0x26')]=function(_0x1122e8,_0x4f6c9f){return db[_0x7254('0x2d')]['find']({'where':{'id':_0x1122e8[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x4f6c9f,null))[_0x7254('0x25')](removeEntity(_0x4f6c9f,null))[_0x7254('0x44')](handleError(_0x4f6c9f,null));};exports[_0x7254('0x50')]=function(_0x283da0,_0x48b69a,_0x1ca394){return db[_0x7254('0x2d')][_0x7254('0x51')]({'where':{'id':_0x283da0[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x48b69a,null))[_0x7254('0x25')](function(_0x556cad){var _0x2fe0b2;var _0x457f71={},_0x215304={};_0x215304[_0x7254('0x32')]=_[_0x7254('0x46')](db[_0x7254('0x52')][_0x7254('0x2e')]);_0x215304['query']=_['keys'](_0x283da0[_0x7254('0x33')]);_0x215304['filters']=_['intersection'](_0x215304[_0x7254('0x32')],_0x215304[_0x7254('0x33')]);_0x457f71[_0x7254('0x36')]=_['intersection'](_0x215304[_0x7254('0x32')],qs['fields'](_0x283da0[_0x7254('0x33')][_0x7254('0x37')]));_0x457f71[_0x7254('0x36')]=_0x457f71[_0x7254('0x36')][_0x7254('0x38')]?_0x457f71['attributes']:_0x215304[_0x7254('0x32')];if(!_0x283da0[_0x7254('0x33')][_0x7254('0x39')](_0x7254('0x3a'))){_0x457f71['limit']=qs['limit'](_0x283da0[_0x7254('0x33')][_0x7254('0x1d')]);_0x457f71[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x283da0[_0x7254('0x33')][_0x7254('0x1b')]);}_0x457f71[_0x7254('0x3b')]=qs[_0x7254('0x53')](_0x283da0[_0x7254('0x33')][_0x7254('0x53')]);_0x457f71[_0x7254('0x3c')]=qs[_0x7254('0x34')](_[_0x7254('0x54')](_0x283da0['query'],_0x215304[_0x7254('0x34')]));if(_0x283da0[_0x7254('0x33')][_0x7254('0x3d')]){_0x457f71['where']=_[_0x7254('0x3e')](_0x457f71[_0x7254('0x3c')],{'$or':_[_0x7254('0x3f')](_0x457f71[_0x7254('0x36')],function(_0x49f62d){var _0x1d9238={};_0x1d9238[_0x49f62d]={'$like':'%'+_0x283da0['query'][_0x7254('0x3d')]+'%'};return _0x1d9238;})});}_0x457f71[_0x7254('0x3c')]=_[_0x7254('0x3e')](_0x457f71[_0x7254('0x3c')],{'mailboxuser':_0x556cad['mailbox']});_0x457f71=_[_0x7254('0x3e')]({},_0x457f71,_0x283da0['options']);return db[_0x7254('0x52')]['findAndCountAll'](_0x457f71)[_0x7254('0x25')](respondWithFilteredResult(_0x48b69a,_0x457f71));})[_0x7254('0x44')](handleError(_0x48b69a,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index d11c5a2..a9de769 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 _0xf406=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf406,0xcd));var _0x6f40=function(_0x42bfb7,_0x25a3ec){_0x42bfb7=_0x42bfb7-0x0;var _0x5c497d=_0xf406[_0x42bfb7];return _0x5c497d;};'use strict';var _=require(_0x6f40('0x0'));var util=require(_0x6f40('0x1'));var logger=require(_0x6f40('0x2'))('api');var moment=require(_0x6f40('0x3'));var BPromise=require(_0x6f40('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f40('0x5'));var rimraf=require(_0x6f40('0x6'));var config=require(_0x6f40('0x7'));var attributes=require(_0x6f40('0x8'));module[_0x6f40('0x9')]=function(_0x21d28f,_0x5cd358){return _0x21d28f[_0x6f40('0xa')]('VoiceMail',attributes,{'tableName':_0x6f40('0xb'),'paranoid':![],'indexes':[{'name':_0x6f40('0xc'),'fields':[_0x6f40('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8593=['rimraf','../../config/environment','exports','define','voice_voicemail','mailbox_context','lodash','../../config/logger'];(function(_0x59376a,_0x7baa6e){var _0x4196c8=function(_0x4d7c65){while(--_0x4d7c65){_0x59376a['push'](_0x59376a['shift']());}};_0x4196c8(++_0x7baa6e);}(_0x8593,0xee));var _0x3859=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x8593[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x3859('0x0'));var util=require('util');var logger=require(_0x3859('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3859('0x2'));var config=require(_0x3859('0x3'));var attributes=require('./voiceMail.attributes');module[_0x3859('0x4')]=function(_0x30919a,_0x2b231c){return _0x30919a[_0x3859('0x5')]('VoiceMail',attributes,{'tableName':_0x3859('0x6'),'paranoid':![],'indexes':[{'name':_0x3859('0x7'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5466fee..5b5df30 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 _0xd617=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','VoiceMail,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x736213,_0xbfb2c6){var _0xaf13c7=function(_0x102c08){while(--_0x102c08){_0x736213['push'](_0x736213['shift']());}};_0xaf13c7(++_0xbfb2c6);}(_0xd617,0xb6));var _0x7d61=function(_0x503ddb,_0x29e841){_0x503ddb=_0x503ddb-0x0;var _0xe0cc10=_0xd617[_0x503ddb];return _0xe0cc10;};'use strict';var _=require('lodash');var util=require(_0x7d61('0x0'));var moment=require(_0x7d61('0x1'));var BPromise=require(_0x7d61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d61('0x3'));var db=require(_0x7d61('0x4'))['db'];var utils=require(_0x7d61('0x5'));var logger=require(_0x7d61('0x6'))(_0x7d61('0x7'));var config=require(_0x7d61('0x8'));var jayson=require(_0x7d61('0x9'));var client=jayson['client'][_0x7d61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x313ac3,_0x2e6d34,_0x9e8f19){return new BPromise(function(_0x494e0b,_0x3fdcde){return client[_0x7d61('0xb')](_0x313ac3,_0x9e8f19)[_0x7d61('0xc')](function(_0x3cc93f){logger[_0x7d61('0xd')]('VoiceMail,\x20%s,\x20%s',_0x2e6d34,_0x7d61('0xe'));logger[_0x7d61('0xf')](_0x7d61('0x10'),_0x2e6d34,_0x7d61('0xe'),JSON['stringify'](_0x3cc93f));if(_0x3cc93f[_0x7d61('0x11')]){if(_0x3cc93f[_0x7d61('0x11')]['code']===0x1f4){logger[_0x7d61('0x11')](_0x7d61('0x12'),_0x2e6d34,_0x3cc93f['error'][_0x7d61('0x13')]);return _0x3fdcde(_0x3cc93f[_0x7d61('0x11')][_0x7d61('0x13')]);}logger[_0x7d61('0x11')]('VoiceMail,\x20%s,\x20%s',_0x2e6d34,_0x3cc93f['error'][_0x7d61('0x13')]);return _0x494e0b(_0x3cc93f[_0x7d61('0x11')]['message']);}else{logger['info'](_0x7d61('0x12'),_0x2e6d34,'request\x20sent');_0x494e0b(_0x3cc93f['result'][_0x7d61('0x13')]);}})[_0x7d61('0x14')](function(_0x59000f){logger[_0x7d61('0x11')](_0x7d61('0x12'),_0x2e6d34,_0x59000f);_0x3fdcde(_0x59000f);});});} \ No newline at end of file +var _0xf7b1=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0xe695fa,_0x387982){var _0x48660b=function(_0x53cda4){while(--_0x53cda4){_0xe695fa['push'](_0xe695fa['shift']());}};_0x48660b(++_0x387982);}(_0xf7b1,0x1e9));var _0x1f7b=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xf7b1[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x1f7b('0x0'));var util=require(_0x1f7b('0x1'));var moment=require(_0x1f7b('0x2'));var BPromise=require(_0x1f7b('0x3'));var rs=require(_0x1f7b('0x4'));var fs=require('fs');var Redis=require(_0x1f7b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f7b('0x6'))(_0x1f7b('0x7'));var config=require(_0x1f7b('0x8'));var jayson=require(_0x1f7b('0x9'));var client=jayson[_0x1f7b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2acae7,_0x3768f3,_0x466230){return new BPromise(function(_0x2ffd99,_0x41ed2f){return client[_0x1f7b('0xb')](_0x2acae7,_0x466230)['then'](function(_0x237654){logger[_0x1f7b('0xc')](_0x1f7b('0xd'),_0x3768f3,_0x1f7b('0xe'));logger[_0x1f7b('0xf')](_0x1f7b('0x10'),_0x3768f3,_0x1f7b('0xe'),JSON[_0x1f7b('0x11')](_0x237654));if(_0x237654[_0x1f7b('0x12')]){if(_0x237654[_0x1f7b('0x12')][_0x1f7b('0x13')]===0x1f4){logger[_0x1f7b('0x12')](_0x1f7b('0xd'),_0x3768f3,_0x237654[_0x1f7b('0x12')][_0x1f7b('0x14')]);return _0x41ed2f(_0x237654[_0x1f7b('0x12')][_0x1f7b('0x14')]);}logger[_0x1f7b('0x12')](_0x1f7b('0xd'),_0x3768f3,_0x237654['error'][_0x1f7b('0x14')]);return _0x2ffd99(_0x237654[_0x1f7b('0x12')]['message']);}else{logger[_0x1f7b('0xc')](_0x1f7b('0xd'),_0x3768f3,_0x1f7b('0xe'));_0x2ffd99(_0x237654[_0x1f7b('0x15')][_0x1f7b('0x14')]);}})[_0x1f7b('0x16')](function(_0x62239c){logger[_0x1f7b('0x12')](_0x1f7b('0xd'),_0x3768f3,_0x62239c);_0x41ed2f(_0x62239c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 07ed24f..ef001f2 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 _0xba7a=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xba7a,0x1ca));var _0xaba7=function(_0x32642c,_0x576eb0){_0x32642c=_0x32642c-0x0;var _0x3a1d97=_0xba7a[_0x32642c];return _0x3a1d97;};'use strict';var multer=require(_0xaba7('0x0'));var util=require(_0xaba7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaba7('0x2'));var router=express[_0xaba7('0x3')]();var fs_extra=require(_0xaba7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaba7('0x5'));var config=require(_0xaba7('0x6'));var controller=require(_0xaba7('0x7'));router[_0xaba7('0x8')]('/',auth[_0xaba7('0x9')](),controller[_0xaba7('0xa')]);router['get']('/:id',auth[_0xaba7('0x9')](),controller['show']);router[_0xaba7('0x8')](_0xaba7('0xb'),auth[_0xaba7('0x9')](),controller[_0xaba7('0xc')]);router[_0xaba7('0xd')]('/',auth['isAuthenticated'](),controller[_0xaba7('0xe')]);router[_0xaba7('0xf')](_0xaba7('0x10'),auth[_0xaba7('0x9')](),controller[_0xaba7('0x11')]);router[_0xaba7('0x12')](_0xaba7('0x10'),auth['isAuthenticated'](),controller[_0xaba7('0x13')]);module[_0xaba7('0x14')]=router; \ No newline at end of file +var _0x7bde=['isAuthenticated','index','/:id','show','/:id/download','download','post','create','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x315bd5,_0x2419be){var _0x2a2207=function(_0x408742){while(--_0x408742){_0x315bd5['push'](_0x315bd5['shift']());}};_0x2a2207(++_0x2419be);}(_0x7bde,0x82));var _0xe7bd=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7bde[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0xe7bd('0x0'));var util=require(_0xe7bd('0x1'));var path=require('path');var timeout=require(_0xe7bd('0x2'));var express=require(_0xe7bd('0x3'));var router=express[_0xe7bd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7bd('0x5'));var interaction=require(_0xe7bd('0x6'));var config=require(_0xe7bd('0x7'));var controller=require(_0xe7bd('0x8'));router[_0xe7bd('0x9')]('/',auth[_0xe7bd('0xa')](),controller[_0xe7bd('0xb')]);router[_0xe7bd('0x9')](_0xe7bd('0xc'),auth[_0xe7bd('0xa')](),controller[_0xe7bd('0xd')]);router[_0xe7bd('0x9')](_0xe7bd('0xe'),auth[_0xe7bd('0xa')](),controller[_0xe7bd('0xf')]);router[_0xe7bd('0x10')]('/',auth['isAuthenticated'](),controller[_0xe7bd('0x11')]);router['put'](_0xe7bd('0xc'),auth[_0xe7bd('0xa')](),controller['update']);router['delete'](_0xe7bd('0xc'),auth[_0xe7bd('0xa')](),controller[_0xe7bd('0x12')]);module[_0xe7bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 4733d0d..839e108 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 _0xddaa=['STRING','BLOB','long','TIMESTAMP','exports','VIRTUAL','INTEGER'];(function(_0xf4d811,_0x11d532){var _0x1677f9=function(_0x55208f){while(--_0x55208f){_0xf4d811['push'](_0xf4d811['shift']());}};_0x1677f9(++_0x11d532);}(_0xddaa,0x12a));var _0xadda=function(_0x4811c1,_0x36c714){_0x4811c1=_0x4811c1-0x0;var _0x41c604=_0xddaa[_0x4811c1];return _0x41c604;};'use strict';var Sequelize=require('sequelize');module[_0xadda('0x0')]={'name':{'type':Sequelize[_0xadda('0x1')],'get':function(_0x5d8f3e){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xadda('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xadda('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xadda('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xadda('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xadda('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xadda('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xadda('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xadda('0x4')](_0xadda('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xadda('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xadda('0x6'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xacb3=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL'];(function(_0x598122,_0x5eab29){var _0x2b817f=function(_0x496e0e){while(--_0x496e0e){_0x598122['push'](_0x598122['shift']());}};_0x2b817f(++_0x5eab29);}(_0xacb3,0x1ec));var _0x3acb=function(_0x52d74f,_0x4b101e){_0x52d74f=_0x52d74f-0x0;var _0x5a59f3=_0xacb3[_0x52d74f];return _0x5a59f3;};'use strict';var Sequelize=require(_0x3acb('0x0'));module[_0x3acb('0x1')]={'name':{'type':Sequelize[_0x3acb('0x2')],'get':function(_0x12cffb){return this[_0x3acb('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x3acb('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x3acb('0x6')](_0x3acb('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'stamp':{'type':_0x3acb('0x8'),'defaultValue':Sequelize[_0x3acb('0x9')](_0x3acb('0xa'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 200e1cf..672f5ba 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 _0x64bb=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','map','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','options','create','body','find','params','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','msg_id','Content-Disposition','.wav\x22','set','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x532a48,_0x3a228e){var _0x4a3b6b=function(_0x21f0d1){while(--_0x21f0d1){_0x532a48['push'](_0x532a48['shift']());}};_0x4a3b6b(++_0x3a228e);}(_0x64bb,0x152));var _0xb64b=function(_0x1cde36,_0x3f07b6){_0x1cde36=_0x1cde36-0x0;var _0x208a2c=_0x64bb[_0x1cde36];return _0x208a2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb64b('0x0'));var zipdir=require(_0xb64b('0x1'));var jsonpatch=require(_0xb64b('0x2'));var rp=require('request-promise');var moment=require(_0xb64b('0x3'));var BPromise=require(_0xb64b('0x4'));var Mustache=require(_0xb64b('0x5'));var util=require(_0xb64b('0x6'));var path=require(_0xb64b('0x7'));var sox=require(_0xb64b('0x8'));var csv=require(_0xb64b('0x9'));var ejs=require(_0xb64b('0xa'));var fs=require('fs');var fs_extra=require(_0xb64b('0xb'));var _=require(_0xb64b('0xc'));var squel=require(_0xb64b('0xd'));var crypto=require(_0xb64b('0xe'));var jsforce=require(_0xb64b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb64b('0x10'));var Papa=require(_0xb64b('0x11'));var Redis=require(_0xb64b('0x12'));var authService=require(_0xb64b('0x13'));var qs=require(_0xb64b('0x14'));var as=require(_0xb64b('0x15'));var hardwareService=require(_0xb64b('0x16'));var logger=require(_0xb64b('0x17'))(_0xb64b('0x18'));var utils=require(_0xb64b('0x19'));var config=require(_0xb64b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb64b('0x1b'))['db'];function respondWithStatusCode(_0x5de152,_0x1be7b8){_0x1be7b8=_0x1be7b8||0xcc;return function(_0x173984){if(_0x173984){return _0x5de152[_0xb64b('0x1c')](_0x1be7b8);}return _0x5de152['status'](_0x1be7b8)[_0xb64b('0x1d')]();};}function respondWithResult(_0x4217ba,_0x1116e5){_0x1116e5=_0x1116e5||0xc8;return function(_0x8e01f7){if(_0x8e01f7){return _0x4217ba['status'](_0x1116e5)[_0xb64b('0x1e')](_0x8e01f7);}};}function respondWithFilteredResult(_0xdd71b9,_0x461b57){return function(_0xa24e32){if(_0xa24e32){var _0x427ea3=typeof _0x461b57[_0xb64b('0x1f')]===_0xb64b('0x20')&&typeof _0x461b57[_0xb64b('0x21')]===_0xb64b('0x20');var _0x1a9a53=_0xa24e32[_0xb64b('0x22')];var _0x33266d=_0x427ea3?0x0:_0x461b57[_0xb64b('0x1f')];var _0x28358a=_0x427ea3?_0xa24e32[_0xb64b('0x22')]:_0x461b57[_0xb64b('0x1f')]+_0x461b57[_0xb64b('0x21')];var _0x114005;if(_0x28358a>=_0x1a9a53){_0x28358a=_0x1a9a53;_0x114005=0xc8;}else{_0x114005=0xce;}_0xdd71b9['status'](_0x114005);return _0xdd71b9['set'](_0xb64b('0x23'),_0x33266d+'-'+_0x28358a+'/'+_0x1a9a53)[_0xb64b('0x1e')](_0xa24e32);}return null;};}function patchUpdates(_0x4b0e62){return function(_0xad3ea1){try{jsonpatch[_0xb64b('0x24')](_0xad3ea1,_0x4b0e62,!![]);}catch(_0x4bd2b2){return BPromise[_0xb64b('0x25')](_0x4bd2b2);}return _0xad3ea1[_0xb64b('0x26')]();};}function saveUpdates(_0xad3282,_0x3a0cc4){return function(_0x3a5cf3){if(_0x3a5cf3){return _0x3a5cf3[_0xb64b('0x27')](_0xad3282)[_0xb64b('0x28')](function(_0x36bb73){return _0x36bb73;});}return null;};}function removeEntity(_0x366426,_0x31f51f){return function(_0x103022){if(_0x103022){return _0x103022[_0xb64b('0x29')]()[_0xb64b('0x28')](function(){_0x366426[_0xb64b('0x2a')](0xcc)[_0xb64b('0x1d')]();});}};}function handleEntityNotFound(_0x9e3bfd,_0x5c05bb){return function(_0x1d17a1){if(!_0x1d17a1){_0x9e3bfd['sendStatus'](0x194);}return _0x1d17a1;};}function handleError(_0x26a81e,_0x101c34){_0x101c34=_0x101c34||0x1f4;return function(_0xb546c){logger[_0xb64b('0x2b')](_0xb546c[_0xb64b('0x2c')]);if(_0xb546c[_0xb64b('0x2d')]){delete _0xb546c['name'];}_0x26a81e[_0xb64b('0x2a')](_0x101c34)[_0xb64b('0x2e')](_0xb546c);};}exports[_0xb64b('0x2f')]=function(_0x43ef0d,_0x20624c){var _0x568406={},_0x295f03={},_0x5a236c={'count':0x0,'rows':[]};var _0x6ad9e7=_['map'](db[_0xb64b('0x30')][_0xb64b('0x31')],function(_0x528bbb){return{'name':_0x528bbb[_0xb64b('0x32')],'type':_0x528bbb[_0xb64b('0x33')][_0xb64b('0x34')]};});_0x295f03['model']=_[_0xb64b('0x35')](_[_0xb64b('0x36')](_0x6ad9e7,_0xb64b('0x2d')),[_0xb64b('0x2d')]);_0x295f03['query']=_['keys'](_0x43ef0d[_0xb64b('0x37')]);_0x295f03[_0xb64b('0x38')]=_[_0xb64b('0x39')](_0x295f03[_0xb64b('0x3a')],_0x295f03['query']);_0x568406[_0xb64b('0x3b')]=_[_0xb64b('0x39')](_0x295f03[_0xb64b('0x3a')],qs['fields'](_0x43ef0d[_0xb64b('0x37')]['fields']));_0x568406[_0xb64b('0x3b')]=_0x568406[_0xb64b('0x3b')][_0xb64b('0x3c')]?_0x568406[_0xb64b('0x3b')]:_0x295f03['model'];if(!_0x43ef0d[_0xb64b('0x37')][_0xb64b('0x3d')](_0xb64b('0x3e'))){_0x568406['limit']=qs[_0xb64b('0x21')](_0x43ef0d['query'][_0xb64b('0x21')]);_0x568406[_0xb64b('0x1f')]=qs[_0xb64b('0x1f')](_0x43ef0d[_0xb64b('0x37')][_0xb64b('0x1f')]);}_0x568406[_0xb64b('0x3f')]=qs[_0xb64b('0x40')](_0x43ef0d[_0xb64b('0x37')][_0xb64b('0x40')]);_0x568406[_0xb64b('0x41')]=qs['filters'](_[_0xb64b('0x42')](_0x43ef0d[_0xb64b('0x37')],_0x295f03['filters']),_0x6ad9e7);if(_0x43ef0d['query'][_0xb64b('0x43')]){_0x568406[_0xb64b('0x41')]=_[_0xb64b('0x44')](_0x568406[_0xb64b('0x41')],{'$or':_[_0xb64b('0x36')](_0x6ad9e7,function(_0x7162fb){if(_0x7162fb[_0xb64b('0x33')]!==_0xb64b('0x45')){var _0x423820={};_0x423820[_0x7162fb['name']]={'$like':'%'+_0x43ef0d[_0xb64b('0x37')][_0xb64b('0x43')]+'%'};return _0x423820;}})});}_0x568406=_[_0xb64b('0x44')]({},_0x568406,_0x43ef0d['options']);var _0x291bce={'where':_0x568406[_0xb64b('0x41')]};return db['VoiceMailMessage'][_0xb64b('0x22')](_0x291bce)[_0xb64b('0x28')](function(_0xbe0510){_0x5a236c[_0xb64b('0x22')]=_0xbe0510;if(_0x43ef0d[_0xb64b('0x37')][_0xb64b('0x46')]){_0x568406[_0xb64b('0x47')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xb64b('0x48')](_0x568406);})['then'](function(_0x47e508){_0x5a236c[_0xb64b('0x49')]=_0x47e508;return _0x5a236c;})[_0xb64b('0x28')](respondWithFilteredResult(_0x20624c,_0x568406))[_0xb64b('0x4a')](handleError(_0x20624c,null));};exports['show']=function(_0x53be88,_0x54f1fa){var _0x4c5d5a={'raw':!![],'where':{'id':_0x53be88['params']['id']}},_0x2eec40={};_0x2eec40[_0xb64b('0x3a')]=_[_0xb64b('0x4b')](db[_0xb64b('0x30')][_0xb64b('0x31')]);_0x2eec40['query']=_[_0xb64b('0x4b')](_0x53be88[_0xb64b('0x37')]);_0x2eec40[_0xb64b('0x38')]=_[_0xb64b('0x39')](_0x2eec40[_0xb64b('0x3a')],_0x2eec40[_0xb64b('0x37')]);_0x4c5d5a[_0xb64b('0x3b')]=_['intersection'](_0x2eec40[_0xb64b('0x3a')],qs['fields'](_0x53be88[_0xb64b('0x37')]['fields']));_0x4c5d5a['attributes']=_0x4c5d5a['attributes'][_0xb64b('0x3c')]?_0x4c5d5a[_0xb64b('0x3b')]:_0x2eec40[_0xb64b('0x3a')];if(_0x53be88['query'][_0xb64b('0x46')]){_0x4c5d5a[_0xb64b('0x47')]=[{'all':!![]}];}_0x4c5d5a=_['merge']({},_0x4c5d5a,_0x53be88[_0xb64b('0x4c')]);return db[_0xb64b('0x30')]['find'](_0x4c5d5a)[_0xb64b('0x28')](handleEntityNotFound(_0x54f1fa,null))[_0xb64b('0x28')](respondWithResult(_0x54f1fa,null))[_0xb64b('0x4a')](handleError(_0x54f1fa,null));};exports[_0xb64b('0x4d')]=function(_0x290af5,_0x1dfc00){return db[_0xb64b('0x30')][_0xb64b('0x4d')](_0x290af5[_0xb64b('0x4e')],{})[_0xb64b('0x28')](respondWithResult(_0x1dfc00,0xc9))[_0xb64b('0x4a')](handleError(_0x1dfc00,null));};exports['update']=function(_0x514e21,_0x56095f){if(_0x514e21[_0xb64b('0x4e')]['id']){delete _0x514e21[_0xb64b('0x4e')]['id'];}return db['VoiceMailMessage'][_0xb64b('0x4f')]({'where':{'id':_0x514e21[_0xb64b('0x50')]['id']}})['then'](handleEntityNotFound(_0x56095f,null))['then'](saveUpdates(_0x514e21[_0xb64b('0x4e')],null))[_0xb64b('0x28')](respondWithResult(_0x56095f,null))['catch'](handleError(_0x56095f,null));};exports['destroy']=function(_0x383bd8,_0x3d9b9c){return db[_0xb64b('0x30')]['find']({'where':{'id':_0x383bd8[_0xb64b('0x50')]['id']}})[_0xb64b('0x28')](handleEntityNotFound(_0x3d9b9c,null))[_0xb64b('0x28')](removeEntity(_0x3d9b9c,null))[_0xb64b('0x4a')](handleError(_0x3d9b9c,null));};exports[_0xb64b('0x51')]=function(_0x45a41f,_0x3e95ee,_0xc8ccb2){return db[_0xb64b('0x30')]['find']({'where':{'id':_0x45a41f[_0xb64b('0x50')]['id']},'attributes':['id','recording','msg_id']})[_0xb64b('0x28')](handleEntityNotFound(_0x3e95ee,null))['then'](function(_0x4a6590){if(_0x4a6590){if(!_0x4a6590[_0xb64b('0x52')]){throw new db[(_0xb64b('0x53'))][(_0xb64b('0x54'))](_0xb64b('0x55'));}var _0x46d18e={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x4a6590[_0xb64b('0x56')]){_0x46d18e[_0xb64b('0x57')]='attachment;\x20filename=\x22'+_0x4a6590[_0xb64b('0x56')]+_0xb64b('0x58');}_0x3e95ee[_0xb64b('0x59')](_0x46d18e);return _0x3e95ee[_0xb64b('0x2e')](new Buffer(_0x4a6590[_0xb64b('0x52')]));}})[_0xb64b('0x4a')](handleError(_0x3e95ee,null));}; \ No newline at end of file +var _0x4e18=['filter','merge','type','VIRTUAL','options','then','includeAll','params','include','find','catch','update','body','download','recording','Sequelize','ValidationError','msg_id','Content-Disposition','.wav\x22','send','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0xcee930,_0x198600){var _0x2d2d07=function(_0xd529b9){while(--_0xd529b9){_0xcee930['push'](_0xcee930['shift']());}};_0x2d2d07(++_0x198600);}(_0x4e18,0x105));var _0x84e1=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x4e18[_0x2d34d6];return _0x1d3d12;};'use strict';var emlformat=require(_0x84e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84e1('0x2'));var moment=require(_0x84e1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x84e1('0x4'));var util=require(_0x84e1('0x5'));var path=require(_0x84e1('0x6'));var sox=require('sox');var csv=require(_0x84e1('0x7'));var ejs=require(_0x84e1('0x8'));var fs=require('fs');var fs_extra=require(_0x84e1('0x9'));var _=require(_0x84e1('0xa'));var squel=require(_0x84e1('0xb'));var crypto=require(_0x84e1('0xc'));var jsforce=require(_0x84e1('0xd'));var deskjs=require(_0x84e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x84e1('0xf'));var Papa=require('papaparse');var Redis=require(_0x84e1('0x10'));var authService=require(_0x84e1('0x11'));var qs=require(_0x84e1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84e1('0x13'));var logger=require(_0x84e1('0x14'))(_0x84e1('0x15'));var utils=require(_0x84e1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x84e1('0x17'));var db=require(_0x84e1('0x18'))['db'];function respondWithStatusCode(_0x5cf8c6,_0x56f880){_0x56f880=_0x56f880||0xcc;return function(_0x110af1){if(_0x110af1){return _0x5cf8c6[_0x84e1('0x19')](_0x56f880);}return _0x5cf8c6['status'](_0x56f880)[_0x84e1('0x1a')]();};}function respondWithResult(_0x2cfe1c,_0x2a1b84){_0x2a1b84=_0x2a1b84||0xc8;return function(_0x240a87){if(_0x240a87){return _0x2cfe1c['status'](_0x2a1b84)[_0x84e1('0x1b')](_0x240a87);}};}function respondWithFilteredResult(_0x445404,_0x57a9a3){return function(_0x140610){if(_0x140610){var _0xffe155=typeof _0x57a9a3[_0x84e1('0x1c')]===_0x84e1('0x1d')&&typeof _0x57a9a3[_0x84e1('0x1e')]===_0x84e1('0x1d');var _0x15eb4c=_0x140610[_0x84e1('0x1f')];var _0x3edc8e=_0xffe155?0x0:_0x57a9a3['offset'];var _0x82422c=_0xffe155?_0x140610['count']:_0x57a9a3['offset']+_0x57a9a3[_0x84e1('0x1e')];var _0x49e14e;if(_0x82422c>=_0x15eb4c){_0x82422c=_0x15eb4c;_0x49e14e=0xc8;}else{_0x49e14e=0xce;}_0x445404[_0x84e1('0x20')](_0x49e14e);return _0x445404[_0x84e1('0x21')](_0x84e1('0x22'),_0x3edc8e+'-'+_0x82422c+'/'+_0x15eb4c)[_0x84e1('0x1b')](_0x140610);}return null;};}function patchUpdates(_0x365248){return function(_0x4bf169){try{jsonpatch[_0x84e1('0x23')](_0x4bf169,_0x365248,!![]);}catch(_0x5cb735){return BPromise['reject'](_0x5cb735);}return _0x4bf169[_0x84e1('0x24')]();};}function saveUpdates(_0x531d85,_0x5848ba){return function(_0x489895){if(_0x489895){return _0x489895['update'](_0x531d85)['then'](function(_0xe16ac3){return _0xe16ac3;});}return null;};}function removeEntity(_0x3de432,_0x37ac15){return function(_0x52d479){if(_0x52d479){return _0x52d479[_0x84e1('0x25')]()['then'](function(){_0x3de432['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8293,_0x1b46ff){return function(_0x232b5){if(!_0x232b5){_0x4b8293[_0x84e1('0x19')](0x194);}return _0x232b5;};}function handleError(_0x22c44a,_0x1d9e8d){_0x1d9e8d=_0x1d9e8d||0x1f4;return function(_0x46efca){logger[_0x84e1('0x26')](_0x46efca[_0x84e1('0x27')]);if(_0x46efca[_0x84e1('0x28')]){delete _0x46efca['name'];}_0x22c44a[_0x84e1('0x20')](_0x1d9e8d)['send'](_0x46efca);};}exports[_0x84e1('0x29')]=function(_0xe0260,_0x473ba7){var _0x45ea92={},_0xc0c9ca={},_0x143d63={'count':0x0,'rows':[]};var _0x526302=_[_0x84e1('0x2a')](db[_0x84e1('0x2b')][_0x84e1('0x2c')],function(_0x2cc716){return{'name':_0x2cc716[_0x84e1('0x2d')],'type':_0x2cc716['type'][_0x84e1('0x2e')]};});_0xc0c9ca[_0x84e1('0x2f')]=_['differenceBy'](_[_0x84e1('0x2a')](_0x526302,_0x84e1('0x28')),[_0x84e1('0x28')]);_0xc0c9ca[_0x84e1('0x30')]=_[_0x84e1('0x31')](_0xe0260[_0x84e1('0x30')]);_0xc0c9ca[_0x84e1('0x32')]=_[_0x84e1('0x33')](_0xc0c9ca['model'],_0xc0c9ca[_0x84e1('0x30')]);_0x45ea92[_0x84e1('0x34')]=_[_0x84e1('0x33')](_0xc0c9ca['model'],qs[_0x84e1('0x35')](_0xe0260[_0x84e1('0x30')][_0x84e1('0x35')]));_0x45ea92[_0x84e1('0x34')]=_0x45ea92[_0x84e1('0x34')][_0x84e1('0x36')]?_0x45ea92[_0x84e1('0x34')]:_0xc0c9ca['model'];if(!_0xe0260['query'][_0x84e1('0x37')](_0x84e1('0x38'))){_0x45ea92[_0x84e1('0x1e')]=qs['limit'](_0xe0260[_0x84e1('0x30')][_0x84e1('0x1e')]);_0x45ea92[_0x84e1('0x1c')]=qs[_0x84e1('0x1c')](_0xe0260['query'][_0x84e1('0x1c')]);}_0x45ea92['order']=qs['sort'](_0xe0260[_0x84e1('0x30')][_0x84e1('0x39')]);_0x45ea92[_0x84e1('0x3a')]=qs[_0x84e1('0x32')](_['pick'](_0xe0260['query'],_0xc0c9ca[_0x84e1('0x32')]),_0x526302);if(_0xe0260[_0x84e1('0x30')][_0x84e1('0x3b')]){_0x45ea92[_0x84e1('0x3a')]=_[_0x84e1('0x3c')](_0x45ea92[_0x84e1('0x3a')],{'$or':_[_0x84e1('0x2a')](_0x526302,function(_0x1c3d06){if(_0x1c3d06[_0x84e1('0x3d')]!==_0x84e1('0x3e')){var _0x39fd9f={};_0x39fd9f[_0x1c3d06[_0x84e1('0x28')]]={'$like':'%'+_0xe0260[_0x84e1('0x30')][_0x84e1('0x3b')]+'%'};return _0x39fd9f;}})});}_0x45ea92=_[_0x84e1('0x3c')]({},_0x45ea92,_0xe0260[_0x84e1('0x3f')]);var _0x116744={'where':_0x45ea92[_0x84e1('0x3a')]};return db[_0x84e1('0x2b')]['count'](_0x116744)[_0x84e1('0x40')](function(_0x56a102){_0x143d63[_0x84e1('0x1f')]=_0x56a102;if(_0xe0260[_0x84e1('0x30')][_0x84e1('0x41')]){_0x45ea92['include']=[{'all':!![]}];}return db[_0x84e1('0x2b')]['findAll'](_0x45ea92);})[_0x84e1('0x40')](function(_0x441ef8){_0x143d63['rows']=_0x441ef8;return _0x143d63;})['then'](respondWithFilteredResult(_0x473ba7,_0x45ea92))['catch'](handleError(_0x473ba7,null));};exports['show']=function(_0x2b8fdd,_0x311bdf){var _0x386726={'raw':!![],'where':{'id':_0x2b8fdd[_0x84e1('0x42')]['id']}},_0x242496={};_0x242496[_0x84e1('0x2f')]=_[_0x84e1('0x31')](db[_0x84e1('0x2b')][_0x84e1('0x2c')]);_0x242496[_0x84e1('0x30')]=_['keys'](_0x2b8fdd['query']);_0x242496[_0x84e1('0x32')]=_[_0x84e1('0x33')](_0x242496[_0x84e1('0x2f')],_0x242496[_0x84e1('0x30')]);_0x386726[_0x84e1('0x34')]=_[_0x84e1('0x33')](_0x242496[_0x84e1('0x2f')],qs['fields'](_0x2b8fdd['query'][_0x84e1('0x35')]));_0x386726[_0x84e1('0x34')]=_0x386726[_0x84e1('0x34')][_0x84e1('0x36')]?_0x386726[_0x84e1('0x34')]:_0x242496['model'];if(_0x2b8fdd[_0x84e1('0x30')][_0x84e1('0x41')]){_0x386726[_0x84e1('0x43')]=[{'all':!![]}];}_0x386726=_[_0x84e1('0x3c')]({},_0x386726,_0x2b8fdd[_0x84e1('0x3f')]);return db[_0x84e1('0x2b')][_0x84e1('0x44')](_0x386726)['then'](handleEntityNotFound(_0x311bdf,null))[_0x84e1('0x40')](respondWithResult(_0x311bdf,null))[_0x84e1('0x45')](handleError(_0x311bdf,null));};exports['create']=function(_0x4d6bd5,_0x3fa696){return db[_0x84e1('0x2b')]['create'](_0x4d6bd5['body'],{})['then'](respondWithResult(_0x3fa696,0xc9))[_0x84e1('0x45')](handleError(_0x3fa696,null));};exports[_0x84e1('0x46')]=function(_0x34510c,_0x12d5a1){if(_0x34510c['body']['id']){delete _0x34510c[_0x84e1('0x47')]['id'];}return db[_0x84e1('0x2b')][_0x84e1('0x44')]({'where':{'id':_0x34510c[_0x84e1('0x42')]['id']}})['then'](handleEntityNotFound(_0x12d5a1,null))[_0x84e1('0x40')](saveUpdates(_0x34510c['body'],null))['then'](respondWithResult(_0x12d5a1,null))['catch'](handleError(_0x12d5a1,null));};exports[_0x84e1('0x25')]=function(_0x311ce5,_0x2c4075){return db[_0x84e1('0x2b')][_0x84e1('0x44')]({'where':{'id':_0x311ce5[_0x84e1('0x42')]['id']}})[_0x84e1('0x40')](handleEntityNotFound(_0x2c4075,null))['then'](removeEntity(_0x2c4075,null))[_0x84e1('0x45')](handleError(_0x2c4075,null));};exports[_0x84e1('0x48')]=function(_0x3b2969,_0xdd9f3c,_0x4034cd){return db[_0x84e1('0x2b')][_0x84e1('0x44')]({'where':{'id':_0x3b2969[_0x84e1('0x42')]['id']},'attributes':['id',_0x84e1('0x49'),'msg_id']})[_0x84e1('0x40')](handleEntityNotFound(_0xdd9f3c,null))[_0x84e1('0x40')](function(_0x6590d3){if(_0x6590d3){if(!_0x6590d3['recording']){throw new db[(_0x84e1('0x4a'))][(_0x84e1('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x2ccb80={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x6590d3[_0x84e1('0x4c')]){_0x2ccb80[_0x84e1('0x4d')]='attachment;\x20filename=\x22'+_0x6590d3['msg_id']+_0x84e1('0x4e');}_0xdd9f3c[_0x84e1('0x21')](_0x2ccb80);return _0xdd9f3c[_0x84e1('0x4f')](new Buffer(_0x6590d3[_0x84e1('0x49')]));}})[_0x84e1('0x45')](handleError(_0xdd9f3c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 58a2ce3..602789d 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 _0xec1c=['path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','dir','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4f4bb8,_0x32e15d){var _0xf6e91f=function(_0x2d1fd6){while(--_0x2d1fd6){_0x4f4bb8['push'](_0x4f4bb8['shift']());}};_0xf6e91f(++_0x32e15d);}(_0xec1c,0xae));var _0xcec1=function(_0x27deda,_0x300d08){_0x27deda=_0x27deda-0x0;var _0x29c0eb=_0xec1c[_0x27deda];return _0x29c0eb;};'use strict';var _=require(_0xcec1('0x0'));var util=require('util');var logger=require(_0xcec1('0x1'))(_0xcec1('0x2'));var moment=require(_0xcec1('0x3'));var BPromise=require(_0xcec1('0x4'));var rp=require(_0xcec1('0x5'));var fs=require('fs');var path=require(_0xcec1('0x6'));var rimraf=require(_0xcec1('0x7'));var config=require(_0xcec1('0x8'));var attributes=require(_0xcec1('0x9'));module[_0xcec1('0xa')]=function(_0x50c052,_0x4684f0){return _0x50c052['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xcec1('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xc504=['./voiceMailMessage.attributes','exports','voice_voicemail_messages','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xc504,0x9c));var _0x4c50=function(_0xb3ac4b,_0x1cc36e){_0xb3ac4b=_0xb3ac4b-0x0;var _0x435c70=_0xc504[_0xb3ac4b];return _0x435c70;};'use strict';var _=require(_0x4c50('0x0'));var util=require('util');var logger=require(_0x4c50('0x1'))(_0x4c50('0x2'));var moment=require(_0x4c50('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c50('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c50('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c50('0x6'));module[_0x4c50('0x7')]=function(_0xa1cee,_0x37cdae){return _0xa1cee['define']('VoiceMailMessage',attributes,{'tableName':_0x4c50('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7ddf02a..f9122c2 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 _0xdc1b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','util','moment','bluebird','randomstring'];(function(_0x220d2d,_0x23d33f){var _0x57feaf=function(_0x23fbbc){while(--_0x23fbbc){_0x220d2d['push'](_0x220d2d['shift']());}};_0x57feaf(++_0x23d33f);}(_0xdc1b,0x1a0));var _0xbdc1=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xdc1b[_0x46ae5a];return _0x434986;};'use strict';var _=require('lodash');var util=require(_0xbdc1('0x0'));var moment=require(_0xbdc1('0x1'));var BPromise=require(_0xbdc1('0x2'));var rs=require(_0xbdc1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbdc1('0x4'));var logger=require(_0xbdc1('0x5'))(_0xbdc1('0x6'));var config=require(_0xbdc1('0x7'));var jayson=require(_0xbdc1('0x8'));var client=jayson[_0xbdc1('0x9')][_0xbdc1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x169240,_0x5a64b1,_0x291020){return new BPromise(function(_0x270744,_0x269bcb){return client[_0xbdc1('0xb')](_0x169240,_0x291020)['then'](function(_0x34ed6d){logger['info'](_0xbdc1('0xc'),_0x5a64b1,_0xbdc1('0xd'));logger[_0xbdc1('0xe')](_0xbdc1('0xf'),_0x5a64b1,_0xbdc1('0xd'),JSON['stringify'](_0x34ed6d));if(_0x34ed6d[_0xbdc1('0x10')]){if(_0x34ed6d[_0xbdc1('0x10')][_0xbdc1('0x11')]===0x1f4){logger[_0xbdc1('0x10')](_0xbdc1('0xc'),_0x5a64b1,_0x34ed6d[_0xbdc1('0x10')][_0xbdc1('0x12')]);return _0x269bcb(_0x34ed6d['error'][_0xbdc1('0x12')]);}logger[_0xbdc1('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x5a64b1,_0x34ed6d[_0xbdc1('0x10')][_0xbdc1('0x12')]);return _0x270744(_0x34ed6d[_0xbdc1('0x10')][_0xbdc1('0x12')]);}else{logger[_0xbdc1('0x13')](_0xbdc1('0xc'),_0x5a64b1,_0xbdc1('0xd'));_0x270744(_0x34ed6d['result'][_0xbdc1('0x12')]);}})[_0xbdc1('0x14')](function(_0x210eeb){logger['error'](_0xbdc1('0xc'),_0x5a64b1,_0x210eeb);_0x269bcb(_0x210eeb);});});} \ No newline at end of file +var _0xfdad=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xfdad,0x1c7));var _0xdfda=function(_0x1a2b4d,_0x4ba7ad){_0x1a2b4d=_0x1a2b4d-0x0;var _0x8985ba=_0xfdad[_0x1a2b4d];return _0x8985ba;};'use strict';var _=require(_0xdfda('0x0'));var util=require(_0xdfda('0x1'));var moment=require(_0xdfda('0x2'));var BPromise=require('bluebird');var rs=require(_0xdfda('0x3'));var fs=require('fs');var Redis=require(_0xdfda('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfda('0x5'));var logger=require(_0xdfda('0x6'))(_0xdfda('0x7'));var config=require(_0xdfda('0x8'));var jayson=require(_0xdfda('0x9'));var client=jayson['client'][_0xdfda('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c575c,_0x3bede8,_0xcc6ed8){return new BPromise(function(_0x1488e9,_0x59f373){return client[_0xdfda('0xb')](_0x5c575c,_0xcc6ed8)[_0xdfda('0xc')](function(_0x564d15){logger[_0xdfda('0xd')](_0xdfda('0xe'),_0x3bede8,_0xdfda('0xf'));logger[_0xdfda('0x10')](_0xdfda('0x11'),_0x3bede8,'request\x20sent',JSON['stringify'](_0x564d15));if(_0x564d15[_0xdfda('0x12')]){if(_0x564d15[_0xdfda('0x12')]['code']===0x1f4){logger[_0xdfda('0x12')](_0xdfda('0xe'),_0x3bede8,_0x564d15[_0xdfda('0x12')][_0xdfda('0x13')]);return _0x59f373(_0x564d15[_0xdfda('0x12')][_0xdfda('0x13')]);}logger[_0xdfda('0x12')](_0xdfda('0xe'),_0x3bede8,_0x564d15[_0xdfda('0x12')][_0xdfda('0x13')]);return _0x1488e9(_0x564d15['error'][_0xdfda('0x13')]);}else{logger[_0xdfda('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x3bede8,'request\x20sent');_0x1488e9(_0x564d15[_0xdfda('0x14')]['message']);}})['catch'](function(_0x1b386f){logger[_0xdfda('0x12')](_0xdfda('0xe'),_0x3bede8,_0x1b386f);_0x59f373(_0x1b386f);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1df7dc3..71fc70b 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 _0x12ed=['isAuthenticated','getSounds','post','create','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','/:id','show','/:id/sounds'];(function(_0x1cb7fc,_0x21c4ff){var _0x2b72a7=function(_0x26436c){while(--_0x26436c){_0x1cb7fc['push'](_0x1cb7fc['shift']());}};_0x2b72a7(++_0x21c4ff);}(_0x12ed,0xe5));var _0xd12e=function(_0x5d570a,_0xd351b6){_0x5d570a=_0x5d570a-0x0;var _0x1dd28b=_0x12ed[_0x5d570a];return _0x1dd28b;};'use strict';var multer=require(_0xd12e('0x0'));var util=require(_0xd12e('0x1'));var path=require(_0xd12e('0x2'));var timeout=require(_0xd12e('0x3'));var express=require(_0xd12e('0x4'));var router=express['Router']();var fs_extra=require(_0xd12e('0x5'));var auth=require(_0xd12e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd12e('0x7')](_0xd12e('0x8'),auth['isAuthenticated'](),controller[_0xd12e('0x9')]);router[_0xd12e('0x7')](_0xd12e('0xa'),auth[_0xd12e('0xb')](),controller[_0xd12e('0xc')]);router[_0xd12e('0xd')]('/',auth[_0xd12e('0xb')](),controller[_0xd12e('0xe')]);router[_0xd12e('0xd')](_0xd12e('0xa'),auth[_0xd12e('0xb')](),controller['addSound']);router['put'](_0xd12e('0x8'),auth[_0xd12e('0xb')](),controller[_0xd12e('0xf')]);router[_0xd12e('0x10')]('/:id',auth[_0xd12e('0xb')](),controller[_0xd12e('0x11')]);router[_0xd12e('0x10')](_0xd12e('0x12'),auth['isAuthenticated'](),controller[_0xd12e('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7959=['delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','show','/:id/sounds','getSounds','post','/:id'];(function(_0x94ccc0,_0x72233f){var _0x18e451=function(_0x172ee3){while(--_0x172ee3){_0x94ccc0['push'](_0x94ccc0['shift']());}};_0x18e451(++_0x72233f);}(_0x7959,0x1a9));var _0x9795=function(_0x55fbda,_0x2dda6c){_0x55fbda=_0x55fbda-0x0;var _0x2de8d4=_0x7959[_0x55fbda];return _0x2de8d4;};'use strict';var multer=require('multer');var util=require(_0x9795('0x0'));var path=require(_0x9795('0x1'));var timeout=require(_0x9795('0x2'));var express=require(_0x9795('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9795('0x4'));var interaction=require(_0x9795('0x5'));var config=require(_0x9795('0x6'));var controller=require(_0x9795('0x7'));router[_0x9795('0x8')]('/',auth[_0x9795('0x9')](),controller['index']);router[_0x9795('0x8')]('/:id',auth[_0x9795('0x9')](),controller[_0x9795('0xa')]);router[_0x9795('0x8')](_0x9795('0xb'),auth[_0x9795('0x9')](),controller[_0x9795('0xc')]);router[_0x9795('0xd')]('/',auth[_0x9795('0x9')](),controller['create']);router['post'](_0x9795('0xb'),auth['isAuthenticated'](),controller['addSound']);router['put'](_0x9795('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x9795('0xf')]('/:id',auth[_0x9795('0x9')](),controller[_0x9795('0x10')]);router['delete'](_0x9795('0x11'),auth[_0x9795('0x9')](),controller[_0x9795('0x12')]);module[_0x9795('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 6479050..3e89da2 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 _0xfe6d=['TIMESTAMP','sequelize','exports','STRING','name','ENUM','files','mp3','alpha'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0xfe6d,0xfd));var _0xdfe6=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xfe6d[_0x28d18d];return _0x470640;};'use strict';var Sequelize=require(_0xdfe6('0x0'));module[_0xdfe6('0x1')]={'name':{'type':Sequelize[_0xdfe6('0x2')],'allowNull':![],'unique':_0xdfe6('0x3')},'mode':{'type':Sequelize[_0xdfe6('0x4')]('custom',_0xdfe6('0x5'),'mp3nb','quietmp3nb','quietmp3',_0xdfe6('0x6')),'allowNull':!![],'defaultValue':_0xdfe6('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xdfe6('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xdfe6('0x2')],'allowNull':!![],'defaultValue':_0xdfe6('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xdfe6('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5472=['mp3','files','STRING','alpha','TIMESTAMP','BOOLEAN','exports','ENUM','custom','mp3nb','quietmp3nb','quietmp3'];(function(_0x3fd09a,_0x4976fe){var _0x391a24=function(_0x33bde8){while(--_0x33bde8){_0x3fd09a['push'](_0x3fd09a['shift']());}};_0x391a24(++_0x4976fe);}(_0x5472,0x14a));var _0x2547=function(_0x54d301,_0x4fa59d){_0x54d301=_0x54d301-0x0;var _0x16f50c=_0x5472[_0x54d301];return _0x16f50c;};'use strict';var Sequelize=require('sequelize');module[_0x2547('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x2547('0x1')](_0x2547('0x2'),'files',_0x2547('0x3'),_0x2547('0x4'),_0x2547('0x5'),_0x2547('0x6')),'allowNull':!![],'defaultValue':_0x2547('0x7')},'directory':{'type':Sequelize[_0x2547('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x2547('0x8')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x2547('0x8')],'allowNull':!![],'defaultValue':_0x2547('0x9')},'format':{'type':Sequelize[_0x2547('0x8')],'allowNull':!![]},'stamp':{'type':_0x2547('0xa')},'defaultEntry':{'type':Sequelize[_0x2547('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 58d6a41..511d032 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 _0x28fd=['show','params','body','create','sequelize','transaction','mode','files','directory','server/files/moh','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','converted_format','createdAt','join','root','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','removeSound','findOne','id2','order','getSounds','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x406c9e,_0x2c67c2){var _0x1b7f53=function(_0x3b6a5d){while(--_0x3b6a5d){_0x406c9e['push'](_0x406c9e['shift']());}};_0x1b7f53(++_0x2c67c2);}(_0x28fd,0x9f));var _0xd28f=function(_0x21a2b3,_0x5d6564){_0x21a2b3=_0x21a2b3-0x0;var _0x4651a7=_0x28fd[_0x21a2b3];return _0x4651a7;};'use strict';var emlformat=require(_0xd28f('0x0'));var rimraf=require(_0xd28f('0x1'));var zipdir=require(_0xd28f('0x2'));var jsonpatch=require(_0xd28f('0x3'));var rp=require(_0xd28f('0x4'));var moment=require(_0xd28f('0x5'));var BPromise=require(_0xd28f('0x6'));var Mustache=require(_0xd28f('0x7'));var util=require(_0xd28f('0x8'));var path=require(_0xd28f('0x9'));var sox=require(_0xd28f('0xa'));var csv=require(_0xd28f('0xb'));var ejs=require(_0xd28f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd28f('0xd'));var crypto=require(_0xd28f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd28f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd28f('0x10'));var Papa=require(_0xd28f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd28f('0x12'));var as=require(_0xd28f('0x13'));var hardwareService=require(_0xd28f('0x14'));var logger=require('../../config/logger')(_0xd28f('0x15'));var utils=require(_0xd28f('0x16'));var config=require(_0xd28f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd28f('0x18'))['db'];function respondWithStatusCode(_0x48db1a,_0x4cd063){_0x4cd063=_0x4cd063||0xcc;return function(_0x19dabe){if(_0x19dabe){return _0x48db1a[_0xd28f('0x19')](_0x4cd063);}return _0x48db1a[_0xd28f('0x1a')](_0x4cd063)['end']();};}function respondWithResult(_0x3068f6,_0x39a53d){_0x39a53d=_0x39a53d||0xc8;return function(_0x2c9906){if(_0x2c9906){return _0x3068f6[_0xd28f('0x1a')](_0x39a53d)[_0xd28f('0x1b')](_0x2c9906);}};}function respondWithFilteredResult(_0x453a74,_0x447391){return function(_0x5642){if(_0x5642){var _0x5a0f73=typeof _0x447391[_0xd28f('0x1c')]===_0xd28f('0x1d')&&typeof _0x447391[_0xd28f('0x1e')]===_0xd28f('0x1d');var _0x57fb08=_0x5642[_0xd28f('0x1f')];var _0x10ffbe=_0x5a0f73?0x0:_0x447391['offset'];var _0x36b4bd=_0x5a0f73?_0x5642[_0xd28f('0x1f')]:_0x447391[_0xd28f('0x1c')]+_0x447391['limit'];var _0x4ca840;if(_0x36b4bd>=_0x57fb08){_0x36b4bd=_0x57fb08;_0x4ca840=0xc8;}else{_0x4ca840=0xce;}_0x453a74[_0xd28f('0x1a')](_0x4ca840);return _0x453a74[_0xd28f('0x20')]('Content-Range',_0x10ffbe+'-'+_0x36b4bd+'/'+_0x57fb08)[_0xd28f('0x1b')](_0x5642);}return null;};}function patchUpdates(_0x18ca04){return function(_0xbc5f0){try{jsonpatch[_0xd28f('0x21')](_0xbc5f0,_0x18ca04,!![]);}catch(_0x5f0df7){return BPromise['reject'](_0x5f0df7);}return _0xbc5f0[_0xd28f('0x22')]();};}function saveUpdates(_0x15d84e,_0x127294){return function(_0x2d4552){if(_0x2d4552){return _0x2d4552[_0xd28f('0x23')](_0x15d84e)[_0xd28f('0x24')](function(_0x25f782){return _0x25f782;});}return null;};}function removeEntity(_0x3c25b1,_0x2c0b08){return function(_0x1b1fb9){if(_0x1b1fb9){return _0x1b1fb9[_0xd28f('0x25')]()['then'](function(){var _0x55d2db=_0x1b1fb9[_0xd28f('0x26')]({'plain':!![]});var _0x175ac9=_0xd28f('0x27');return db[_0xd28f('0x28')][_0xd28f('0x25')]({'where':{'type':_0x175ac9,'resourceId':_0x55d2db['id']}})[_0xd28f('0x24')](function(){return _0x1b1fb9;});})['then'](function(){_0x3c25b1[_0xd28f('0x1a')](0xcc)[_0xd28f('0x29')]();});}};}function handleEntityNotFound(_0x46a208,_0x28ae41){return function(_0x1773e5){if(!_0x1773e5){_0x46a208[_0xd28f('0x19')](0x194);}return _0x1773e5;};}function handleError(_0x2cd934,_0xcb3d5d){_0xcb3d5d=_0xcb3d5d||0x1f4;return function(_0x539b2){logger['error'](_0x539b2[_0xd28f('0x2a')]);if(_0x539b2[_0xd28f('0x2b')]){delete _0x539b2[_0xd28f('0x2b')];}_0x2cd934['status'](_0xcb3d5d)[_0xd28f('0x2c')](_0x539b2);};}exports[_0xd28f('0x2d')]=function(_0x2f8ab2,_0x2ae5c3){var _0x2dfdbb={},_0x2bb051={},_0x58fcf4={'count':0x0,'rows':[]};var _0x575564=_[_0xd28f('0x2e')](db[_0xd28f('0x2f')][_0xd28f('0x30')],function(_0x46bdf6){return{'name':_0x46bdf6[_0xd28f('0x31')],'type':_0x46bdf6[_0xd28f('0x32')][_0xd28f('0x33')]};});_0x2bb051[_0xd28f('0x34')]=_[_0xd28f('0x2e')](_0x575564,_0xd28f('0x2b'));_0x2bb051[_0xd28f('0x35')]=_[_0xd28f('0x36')](_0x2f8ab2[_0xd28f('0x35')]);_0x2bb051[_0xd28f('0x37')]=_[_0xd28f('0x38')](_0x2bb051[_0xd28f('0x34')],_0x2bb051['query']);_0x2dfdbb[_0xd28f('0x39')]=_[_0xd28f('0x38')](_0x2bb051[_0xd28f('0x34')],qs[_0xd28f('0x3a')](_0x2f8ab2[_0xd28f('0x35')][_0xd28f('0x3a')]));_0x2dfdbb[_0xd28f('0x39')]=_0x2dfdbb[_0xd28f('0x39')][_0xd28f('0x3b')]?_0x2dfdbb[_0xd28f('0x39')]:_0x2bb051[_0xd28f('0x34')];if(!_0x2f8ab2[_0xd28f('0x35')][_0xd28f('0x3c')]('nolimit')){_0x2dfdbb['limit']=qs[_0xd28f('0x1e')](_0x2f8ab2[_0xd28f('0x35')][_0xd28f('0x1e')]);_0x2dfdbb[_0xd28f('0x1c')]=qs[_0xd28f('0x1c')](_0x2f8ab2[_0xd28f('0x35')][_0xd28f('0x1c')]);}_0x2dfdbb['order']=qs[_0xd28f('0x3d')](_0x2f8ab2['query'][_0xd28f('0x3d')]);delete _0x2f8ab2[_0xd28f('0x35')]['sort'];_0x2dfdbb[_0xd28f('0x3e')]=qs[_0xd28f('0x37')](_[_0xd28f('0x3f')](_0x2f8ab2['query'],_0x2bb051[_0xd28f('0x37')]),_0x575564);if(_0x2f8ab2[_0xd28f('0x35')][_0xd28f('0x40')]){_0x2dfdbb[_0xd28f('0x3e')]=_[_0xd28f('0x41')](_0x2dfdbb[_0xd28f('0x3e')],{'$or':_[_0xd28f('0x2e')](_0x575564,function(_0x4538cc){if(_0x4538cc[_0xd28f('0x32')]!==_0xd28f('0x42')){var _0x1af236={};_0x1af236[_0x4538cc[_0xd28f('0x2b')]]={'$like':'%'+_0x2f8ab2[_0xd28f('0x35')]['filter']+'%'};return _0x1af236;}})});}_0x2dfdbb=_[_0xd28f('0x41')]({},_0x2dfdbb,_0x2f8ab2[_0xd28f('0x43')]);var _0x22ff24={'where':_0x2dfdbb[_0xd28f('0x3e')]};return db[_0xd28f('0x2f')][_0xd28f('0x1f')](_0x22ff24)['then'](function(_0x4682b4){_0x58fcf4[_0xd28f('0x1f')]=_0x4682b4;if(_0x2f8ab2['query'][_0xd28f('0x44')]){_0x2dfdbb[_0xd28f('0x45')]=[{'all':!![]}];}return db[_0xd28f('0x2f')][_0xd28f('0x46')](_0x2dfdbb);})[_0xd28f('0x24')](function(_0x3700d6){_0x58fcf4[_0xd28f('0x47')]=_0x3700d6;return _0x58fcf4;})[_0xd28f('0x24')](respondWithFilteredResult(_0x2ae5c3,_0x2dfdbb))[_0xd28f('0x48')](handleError(_0x2ae5c3,null));};exports[_0xd28f('0x49')]=function(_0x3436f0,_0x2a69d5){var _0x37a4df={'raw':![],'where':{'id':_0x3436f0[_0xd28f('0x4a')]['id']}},_0xdc1eed={};_0xdc1eed[_0xd28f('0x34')]=_['keys'](db[_0xd28f('0x2f')][_0xd28f('0x30')]);_0xdc1eed[_0xd28f('0x35')]=_['keys'](_0x3436f0[_0xd28f('0x35')]);_0xdc1eed['filters']=_[_0xd28f('0x38')](_0xdc1eed[_0xd28f('0x34')],_0xdc1eed[_0xd28f('0x35')]);_0x37a4df[_0xd28f('0x39')]=_[_0xd28f('0x38')](_0xdc1eed[_0xd28f('0x34')],qs[_0xd28f('0x3a')](_0x3436f0[_0xd28f('0x35')][_0xd28f('0x3a')]));_0x37a4df[_0xd28f('0x39')]=_0x37a4df[_0xd28f('0x39')][_0xd28f('0x3b')]?_0x37a4df[_0xd28f('0x39')]:_0xdc1eed[_0xd28f('0x34')];if(_0x3436f0[_0xd28f('0x35')]['includeAll']){_0x37a4df['include']=[{'all':!![]}];}_0x37a4df=_[_0xd28f('0x41')]({},_0x37a4df,_0x3436f0[_0xd28f('0x43')]);return db[_0xd28f('0x2f')]['find'](_0x37a4df)['then'](handleEntityNotFound(_0x2a69d5,null))[_0xd28f('0x24')](respondWithResult(_0x2a69d5,null))[_0xd28f('0x48')](handleError(_0x2a69d5,null));};exports['update']=function(_0x3fa94a,_0x18f46f){if(_0x3fa94a[_0xd28f('0x4b')]['id']){delete _0x3fa94a['body']['id'];}return db[_0xd28f('0x2f')]['find']({'where':{'id':_0x3fa94a[_0xd28f('0x4a')]['id']}})[_0xd28f('0x24')](handleEntityNotFound(_0x18f46f,null))['then'](saveUpdates(_0x3fa94a[_0xd28f('0x4b')],null))[_0xd28f('0x24')](respondWithResult(_0x18f46f,null))[_0xd28f('0x48')](handleError(_0x18f46f,null));};exports[_0xd28f('0x4c')]=function(_0x554719,_0x218a0a,_0x4efb3b){return db[_0xd28f('0x4d')][_0xd28f('0x4e')](function(_0x21e786){if(_0x554719[_0xd28f('0x4b')][_0xd28f('0x4f')]===_0xd28f('0x50')){_0x554719[_0xd28f('0x4b')][_0xd28f('0x51')]=path['join'](config['root'],_0xd28f('0x52'),_0x554719['body'][_0xd28f('0x2b')]);}return db[_0xd28f('0x2f')][_0xd28f('0x4c')](_0x554719['body'],{'transaction':_0x21e786})[_0xd28f('0x24')](function(_0x5dca3e){if(_0x554719[_0xd28f('0x4b')][_0xd28f('0x4f')]==='files'){fs['mkdirSync'](_0x5dca3e['directory'],parseInt(_0xd28f('0x53'),0x8));}var _0x1689ae=_0x554719['user'][_0xd28f('0x26')]({'plain':!![]});if(!_0x1689ae)throw new Error(_0xd28f('0x54'));if(_0x1689ae[_0xd28f('0x55')]==='user'){var _0xf02887=_0x5dca3e[_0xd28f('0x26')]({'plain':!![]});return db[_0xd28f('0x56')][_0xd28f('0x57')]({'where':{'name':_0xd28f('0x27'),'userProfileId':_0x1689ae[_0xd28f('0x58')]},'raw':!![]})[_0xd28f('0x24')](function(_0x66eba1){if(_0x66eba1&&_0x66eba1[_0xd28f('0x59')]===0x0){return db[_0xd28f('0x28')][_0xd28f('0x4c')]({'name':_0xf02887[_0xd28f('0x2b')],'resourceId':_0xf02887['id'],'type':_0x66eba1[_0xd28f('0x2b')],'sectionId':_0x66eba1['id']},{})[_0xd28f('0x24')](function(){return _0x5dca3e;});}else{return _0x5dca3e;}})[_0xd28f('0x48')](function(_0x5a46dd){logger[_0xd28f('0x5a')](_0xd28f('0x5b'),_0x5a46dd);});}return _0x5dca3e;});})[_0xd28f('0x24')](respondWithResult(_0x218a0a,0xc9))[_0xd28f('0x48')](handleError(_0x218a0a,null));};exports['destroy']=function(_0x47529d,_0x6e9830,_0x50ee7a){var _0xc5235e;return db[_0xd28f('0x2f')]['find']({'where':{'id':_0x47529d[_0xd28f('0x4a')]['id']}})[_0xd28f('0x24')](function(_0x52647d){if(_0x52647d){return db[_0xd28f('0x4d')][_0xd28f('0x4e')](function(_0x1ec504){return _0x52647d[_0xd28f('0x25')]({'transaction':_0x1ec504,'raw':!![]})['then'](function(_0x55f201){if(_0x55f201['directory']){fs['readdirSync'](_0x55f201[_0xd28f('0x51')])[_0xd28f('0x5c')](function(_0x53a42f){fs[_0xd28f('0x5d')](path['join'](_0x55f201[_0xd28f('0x51')],_0x53a42f));});fs['rmdirSync'](_0x55f201[_0xd28f('0x51')]);}return _0x55f201;});})[_0xd28f('0x48')](function(_0x5732c7){throw new db[(_0xd28f('0x5e'))][(_0xd28f('0x5f'))](_0x5732c7[_0xd28f('0x60')]);});}})['then'](handleEntityNotFound(_0x6e9830,null))[_0xd28f('0x24')](removeEntity(_0x6e9830,null))[_0xd28f('0x48')](handleError(_0x6e9830,null));};exports[_0xd28f('0x61')]=function(_0x3a8880,_0x394bef,_0x15d856){return db[_0xd28f('0x4d')][_0xd28f('0x4e')](function(_0x489712){var _0x50bc45;return db[_0xd28f('0x2f')][_0xd28f('0x57')]({'where':{'id':_0x3a8880[_0xd28f('0x4a')]['id']}})[_0xd28f('0x24')](function(_0x2510c7){if(_0x2510c7){_0x50bc45=_0x2510c7;return _0x2510c7['addSound'](_0x3a8880['body']['id'],{'transaction':_0x489712});}})[_0xd28f('0x24')](function(_0x391115){if(_0x391115){return db[_0xd28f('0x62')]['findOne']({'where':{'id':_0x3a8880[_0xd28f('0x4b')]['id']},'attributes':['id','name','save_name',_0xd28f('0x63'),_0xd28f('0x64')],'raw':!![]});}})[_0xd28f('0x24')](function(_0x4bae04){if(_0x4bae04){var _0x519879=path[_0xd28f('0x65')](config[_0xd28f('0x66')],_0xd28f('0x67'),util[_0xd28f('0x68')](_0xd28f('0x69'),path[_0xd28f('0x6a')](_0x4bae04[_0xd28f('0x6b')],path[_0xd28f('0x6c')](_0x4bae04[_0xd28f('0x6b')])),_0x4bae04[_0xd28f('0x63')]));var _0x5ecf58=path[_0xd28f('0x65')](config[_0xd28f('0x66')],_0xd28f('0x52'),_0x50bc45[_0xd28f('0x2b')],util[_0xd28f('0x68')]('%s.%s',_0x4bae04['name'],_0x4bae04['converted_format']));fs[_0xd28f('0x6d')](_0x519879,_0x5ecf58);return _0x4bae04;}})[_0xd28f('0x48')](function(_0x35f633){throw new db[(_0xd28f('0x5e'))][(_0xd28f('0x5f'))](_0x35f633['message']);});})[_0xd28f('0x24')](handleEntityNotFound(_0x394bef,null))['then'](respondWithResult(_0x394bef,0xc9))[_0xd28f('0x48')](handleError(_0x394bef,null));};exports[_0xd28f('0x6e')]=function(_0x4803e7,_0x186ebe,_0x28e9e0){return db[_0xd28f('0x4d')][_0xd28f('0x4e')](function(_0x3048f7){var _0x37a0ff;return db['VoiceMusicOnHold'][_0xd28f('0x6f')]({'where':{'id':_0x4803e7[_0xd28f('0x4a')]['id']}})[_0xd28f('0x24')](handleEntityNotFound(_0x186ebe,null))[_0xd28f('0x24')](function(_0x587586){if(_0x587586){_0x37a0ff=_0x587586;return _0x587586[_0xd28f('0x6e')](_0x4803e7[_0xd28f('0x4a')][_0xd28f('0x70')]);}})['then'](function(_0x37df5a){if(_0x37df5a){return db['Sound'][_0xd28f('0x6f')]({'where':{'id':_0x4803e7[_0xd28f('0x4a')][_0xd28f('0x70')]},'attributes':['id',_0xd28f('0x2b'),'save_name','converted_format',_0xd28f('0x64')],'raw':!![]});}})[_0xd28f('0x24')](function(_0x290891){if(_0x290891){fs['unlinkSync'](path['join'](_0x37a0ff[_0xd28f('0x51')],util[_0xd28f('0x68')](_0xd28f('0x69'),_0x290891[_0xd28f('0x2b')],_0x290891[_0xd28f('0x63')])));return _0x290891;}})[_0xd28f('0x48')](function(_0x1ba900){throw new db[(_0xd28f('0x5e'))][(_0xd28f('0x5f'))](_0x1ba900[_0xd28f('0x60')]);});})[_0xd28f('0x24')](handleEntityNotFound(_0x186ebe,null))[_0xd28f('0x24')](respondWithStatusCode(_0x186ebe,0xcc))[_0xd28f('0x48')](handleError(_0x186ebe,null));};exports['getSounds']=function(_0x9c6693,_0x21089b,_0x55eb89){var _0x4e935d={};var _0x55b0cc={};var _0x34ab31;var _0x3a222f;return db[_0xd28f('0x2f')]['findOne']({'where':{'id':_0x9c6693[_0xd28f('0x4a')]['id']}})[_0xd28f('0x24')](handleEntityNotFound(_0x21089b,null))[_0xd28f('0x24')](function(_0x2cc06e){if(_0x2cc06e){_0x34ab31=_0x2cc06e;_0x55b0cc[_0xd28f('0x34')]=_[_0xd28f('0x36')](db[_0xd28f('0x62')]['rawAttributes']);_0x55b0cc[_0xd28f('0x35')]=_[_0xd28f('0x36')](_0x9c6693[_0xd28f('0x35')]);_0x55b0cc[_0xd28f('0x37')]=_[_0xd28f('0x38')](_0x55b0cc[_0xd28f('0x34')],_0x55b0cc['query']);_0x4e935d[_0xd28f('0x39')]=_[_0xd28f('0x38')](_0x55b0cc[_0xd28f('0x34')],qs[_0xd28f('0x3a')](_0x9c6693[_0xd28f('0x35')][_0xd28f('0x3a')]));_0x4e935d['attributes']=_0x4e935d[_0xd28f('0x39')][_0xd28f('0x3b')]?_0x4e935d[_0xd28f('0x39')]:_0x55b0cc['model'];_0x4e935d[_0xd28f('0x71')]=qs['sort'](_0x9c6693[_0xd28f('0x35')]['sort']);_0x4e935d[_0xd28f('0x3e')]=qs['filters'](_[_0xd28f('0x3f')](_0x9c6693[_0xd28f('0x35')],_0x55b0cc[_0xd28f('0x37')]));if(_0x9c6693[_0xd28f('0x35')][_0xd28f('0x40')]){_0x4e935d['where']=_[_0xd28f('0x41')](_0x4e935d[_0xd28f('0x3e')],{'$or':_[_0xd28f('0x2e')](_0x4e935d[_0xd28f('0x39')],function(_0xc900fe){var _0xf88304={};_0xf88304[_0xc900fe]={'$like':'%'+_0x9c6693['query'][_0xd28f('0x40')]+'%'};return _0xf88304;})});}_0x4e935d=_[_0xd28f('0x41')]({},_0x4e935d,_0x9c6693[_0xd28f('0x43')]);return _0x34ab31[_0xd28f('0x72')](_0x4e935d);}})[_0xd28f('0x24')](function(_0x4f562a){if(_0x4f562a){_0x3a222f=_0x4f562a[_0xd28f('0x3b')];if(!_0x9c6693['query'][_0xd28f('0x3c')](_0xd28f('0x73'))){_0x4e935d['limit']=qs[_0xd28f('0x1e')](_0x9c6693['query'][_0xd28f('0x1e')]);_0x4e935d[_0xd28f('0x1c')]=qs[_0xd28f('0x1c')](_0x9c6693[_0xd28f('0x35')][_0xd28f('0x1c')]);}return _0x34ab31[_0xd28f('0x72')](_0x4e935d);}})[_0xd28f('0x24')](function(_0x1398e0){if(_0x1398e0){return _0x1398e0?{'count':_0x3a222f,'rows':_0x1398e0}:null;}})['then'](respondWithResult(_0x21089b,null))[_0xd28f('0x48')](handleError(_0x21089b,null));}; \ No newline at end of file +var _0x5613=['readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','createdAt','server/files/sounds/converted','format','%s.%s','save_name','extname','symlinkSync','removeSound','id2','converted_format','getSounds','rawAttributes','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','apply','save','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','find','catch','update','body','create','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize'];(function(_0x57a255,_0x44693f){var _0x2d6f99=function(_0xec310c){while(--_0xec310c){_0x57a255['push'](_0x57a255['shift']());}};_0x2d6f99(++_0x44693f);}(_0x5613,0x100));var _0x3561=function(_0x1efeeb,_0x258a7f){_0x1efeeb=_0x1efeeb-0x0;var _0x2fb8f1=_0x5613[_0x1efeeb];return _0x2fb8f1;};'use strict';var emlformat=require(_0x3561('0x0'));var rimraf=require(_0x3561('0x1'));var zipdir=require(_0x3561('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3561('0x3'));var moment=require(_0x3561('0x4'));var BPromise=require(_0x3561('0x5'));var Mustache=require(_0x3561('0x6'));var util=require(_0x3561('0x7'));var path=require(_0x3561('0x8'));var sox=require('sox');var csv=require(_0x3561('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3561('0xa'));var crypto=require(_0x3561('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3561('0xc'));var toCsv=require(_0x3561('0x9'));var querystring=require(_0x3561('0xd'));var Papa=require(_0x3561('0xe'));var Redis=require(_0x3561('0xf'));var authService=require(_0x3561('0x10'));var qs=require(_0x3561('0x11'));var as=require(_0x3561('0x12'));var hardwareService=require(_0x3561('0x13'));var logger=require(_0x3561('0x14'))('api');var utils=require(_0x3561('0x15'));var config=require(_0x3561('0x16'));var licenseUtil=require(_0x3561('0x17'));var db=require(_0x3561('0x18'))['db'];function respondWithStatusCode(_0x5f0b8b,_0x50f4d8){_0x50f4d8=_0x50f4d8||0xcc;return function(_0x194ded){if(_0x194ded){return _0x5f0b8b[_0x3561('0x19')](_0x50f4d8);}return _0x5f0b8b['status'](_0x50f4d8)[_0x3561('0x1a')]();};}function respondWithResult(_0xce6906,_0x109f6d){_0x109f6d=_0x109f6d||0xc8;return function(_0x34a6b9){if(_0x34a6b9){return _0xce6906[_0x3561('0x1b')](_0x109f6d)[_0x3561('0x1c')](_0x34a6b9);}};}function respondWithFilteredResult(_0x9a236c,_0x634e18){return function(_0x12e6e3){if(_0x12e6e3){var _0x3e15c3=typeof _0x634e18['offset']===_0x3561('0x1d')&&typeof _0x634e18[_0x3561('0x1e')]===_0x3561('0x1d');var _0x789962=_0x12e6e3['count'];var _0x5418ea=_0x3e15c3?0x0:_0x634e18[_0x3561('0x1f')];var _0x40fa8f=_0x3e15c3?_0x12e6e3['count']:_0x634e18[_0x3561('0x1f')]+_0x634e18['limit'];var _0x303e41;if(_0x40fa8f>=_0x789962){_0x40fa8f=_0x789962;_0x303e41=0xc8;}else{_0x303e41=0xce;}_0x9a236c[_0x3561('0x1b')](_0x303e41);return _0x9a236c[_0x3561('0x20')](_0x3561('0x21'),_0x5418ea+'-'+_0x40fa8f+'/'+_0x789962)[_0x3561('0x1c')](_0x12e6e3);}return null;};}function patchUpdates(_0x3bf62d){return function(_0x1c45b5){try{jsonpatch[_0x3561('0x22')](_0x1c45b5,_0x3bf62d,!![]);}catch(_0x1d09d1){return BPromise['reject'](_0x1d09d1);}return _0x1c45b5[_0x3561('0x23')]();};}function saveUpdates(_0x4f998f,_0x3506fc){return function(_0x2eaec1){if(_0x2eaec1){return _0x2eaec1['update'](_0x4f998f)[_0x3561('0x24')](function(_0x4465c3){return _0x4465c3;});}return null;};}function removeEntity(_0x5bed97,_0x145bc8){return function(_0xdc401b){if(_0xdc401b){return _0xdc401b[_0x3561('0x25')]()[_0x3561('0x24')](function(){var _0x32feb5=_0xdc401b[_0x3561('0x26')]({'plain':!![]});var _0x4af805=_0x3561('0x27');return db[_0x3561('0x28')][_0x3561('0x25')]({'where':{'type':_0x4af805,'resourceId':_0x32feb5['id']}})[_0x3561('0x24')](function(){return _0xdc401b;});})[_0x3561('0x24')](function(){_0x5bed97[_0x3561('0x1b')](0xcc)[_0x3561('0x1a')]();});}};}function handleEntityNotFound(_0x5179cd,_0x4cac0b){return function(_0xe07c3e){if(!_0xe07c3e){_0x5179cd['sendStatus'](0x194);}return _0xe07c3e;};}function handleError(_0x9d3b9f,_0x38b018){_0x38b018=_0x38b018||0x1f4;return function(_0x38fac8){logger[_0x3561('0x29')](_0x38fac8[_0x3561('0x2a')]);if(_0x38fac8['name']){delete _0x38fac8[_0x3561('0x2b')];}_0x9d3b9f[_0x3561('0x1b')](_0x38b018)[_0x3561('0x2c')](_0x38fac8);};}exports[_0x3561('0x2d')]=function(_0x10172a,_0x132424){var _0x174881={},_0x237ea1={},_0xd1e9f9={'count':0x0,'rows':[]};var _0x355e4f=_['map'](db[_0x3561('0x2e')]['rawAttributes'],function(_0x105be4){return{'name':_0x105be4[_0x3561('0x2f')],'type':_0x105be4[_0x3561('0x30')]['key']};});_0x237ea1[_0x3561('0x31')]=_[_0x3561('0x32')](_0x355e4f,'name');_0x237ea1[_0x3561('0x33')]=_[_0x3561('0x34')](_0x10172a[_0x3561('0x33')]);_0x237ea1[_0x3561('0x35')]=_[_0x3561('0x36')](_0x237ea1['model'],_0x237ea1[_0x3561('0x33')]);_0x174881[_0x3561('0x37')]=_[_0x3561('0x36')](_0x237ea1[_0x3561('0x31')],qs[_0x3561('0x38')](_0x10172a[_0x3561('0x33')][_0x3561('0x38')]));_0x174881['attributes']=_0x174881[_0x3561('0x37')][_0x3561('0x39')]?_0x174881['attributes']:_0x237ea1['model'];if(!_0x10172a[_0x3561('0x33')][_0x3561('0x3a')](_0x3561('0x3b'))){_0x174881[_0x3561('0x1e')]=qs[_0x3561('0x1e')](_0x10172a[_0x3561('0x33')][_0x3561('0x1e')]);_0x174881[_0x3561('0x1f')]=qs[_0x3561('0x1f')](_0x10172a['query'][_0x3561('0x1f')]);}_0x174881[_0x3561('0x3c')]=qs['sort'](_0x10172a[_0x3561('0x33')][_0x3561('0x3d')]);delete _0x10172a[_0x3561('0x33')][_0x3561('0x3d')];_0x174881[_0x3561('0x3e')]=qs[_0x3561('0x35')](_['pick'](_0x10172a['query'],_0x237ea1['filters']),_0x355e4f);if(_0x10172a[_0x3561('0x33')][_0x3561('0x3f')]){_0x174881[_0x3561('0x3e')]=_['merge'](_0x174881[_0x3561('0x3e')],{'$or':_['map'](_0x355e4f,function(_0x48502c){if(_0x48502c['type']!==_0x3561('0x40')){var _0x187833={};_0x187833[_0x48502c[_0x3561('0x2b')]]={'$like':'%'+_0x10172a[_0x3561('0x33')]['filter']+'%'};return _0x187833;}})});}_0x174881=_[_0x3561('0x41')]({},_0x174881,_0x10172a[_0x3561('0x42')]);var _0x1306b0={'where':_0x174881[_0x3561('0x3e')]};return db[_0x3561('0x2e')][_0x3561('0x43')](_0x1306b0)[_0x3561('0x24')](function(_0x19e25b){_0xd1e9f9[_0x3561('0x43')]=_0x19e25b;if(_0x10172a[_0x3561('0x33')][_0x3561('0x44')]){_0x174881[_0x3561('0x45')]=[{'all':!![]}];}return db[_0x3561('0x2e')]['findAll'](_0x174881);})[_0x3561('0x24')](function(_0x180df4){_0xd1e9f9[_0x3561('0x46')]=_0x180df4;return _0xd1e9f9;})['then'](respondWithFilteredResult(_0x132424,_0x174881))['catch'](handleError(_0x132424,null));};exports[_0x3561('0x47')]=function(_0xcabb38,_0x228fda){var _0x33b86e={'raw':![],'where':{'id':_0xcabb38[_0x3561('0x48')]['id']}},_0x2c8363={};_0x2c8363[_0x3561('0x31')]=_[_0x3561('0x34')](db[_0x3561('0x2e')]['rawAttributes']);_0x2c8363[_0x3561('0x33')]=_[_0x3561('0x34')](_0xcabb38[_0x3561('0x33')]);_0x2c8363['filters']=_[_0x3561('0x36')](_0x2c8363['model'],_0x2c8363[_0x3561('0x33')]);_0x33b86e[_0x3561('0x37')]=_[_0x3561('0x36')](_0x2c8363[_0x3561('0x31')],qs[_0x3561('0x38')](_0xcabb38[_0x3561('0x33')]['fields']));_0x33b86e[_0x3561('0x37')]=_0x33b86e['attributes'][_0x3561('0x39')]?_0x33b86e['attributes']:_0x2c8363[_0x3561('0x31')];if(_0xcabb38[_0x3561('0x33')][_0x3561('0x44')]){_0x33b86e['include']=[{'all':!![]}];}_0x33b86e=_['merge']({},_0x33b86e,_0xcabb38[_0x3561('0x42')]);return db['VoiceMusicOnHold'][_0x3561('0x49')](_0x33b86e)[_0x3561('0x24')](handleEntityNotFound(_0x228fda,null))[_0x3561('0x24')](respondWithResult(_0x228fda,null))[_0x3561('0x4a')](handleError(_0x228fda,null));};exports[_0x3561('0x4b')]=function(_0x541aff,_0x303e3d){if(_0x541aff['body']['id']){delete _0x541aff[_0x3561('0x4c')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x541aff[_0x3561('0x48')]['id']}})[_0x3561('0x24')](handleEntityNotFound(_0x303e3d,null))[_0x3561('0x24')](saveUpdates(_0x541aff[_0x3561('0x4c')],null))[_0x3561('0x24')](respondWithResult(_0x303e3d,null))['catch'](handleError(_0x303e3d,null));};exports[_0x3561('0x4d')]=function(_0x4b39ec,_0x855502,_0x1d2bc7){return db['sequelize'][_0x3561('0x4e')](function(_0xd7b2c){if(_0x4b39ec['body'][_0x3561('0x4f')]==='files'){_0x4b39ec['body'][_0x3561('0x50')]=path[_0x3561('0x51')](config[_0x3561('0x52')],_0x3561('0x53'),_0x4b39ec['body']['name']);}return db['VoiceMusicOnHold'][_0x3561('0x4d')](_0x4b39ec['body'],{'transaction':_0xd7b2c})[_0x3561('0x24')](function(_0x80a597){if(_0x4b39ec[_0x3561('0x4c')][_0x3561('0x4f')]===_0x3561('0x54')){fs[_0x3561('0x55')](_0x80a597[_0x3561('0x50')],parseInt(_0x3561('0x56'),0x8));}var _0x1d376a=_0x4b39ec[_0x3561('0x57')][_0x3561('0x26')]({'plain':!![]});if(!_0x1d376a)throw new Error(_0x3561('0x58'));if(_0x1d376a[_0x3561('0x59')]===_0x3561('0x57')){var _0x38aa8e=_0x80a597[_0x3561('0x26')]({'plain':!![]});return db[_0x3561('0x5a')][_0x3561('0x49')]({'where':{'name':_0x3561('0x27'),'userProfileId':_0x1d376a[_0x3561('0x5b')]},'raw':!![]})[_0x3561('0x24')](function(_0xac6463){if(_0xac6463&&_0xac6463[_0x3561('0x5c')]===0x0){return db[_0x3561('0x28')][_0x3561('0x4d')]({'name':_0x38aa8e['name'],'resourceId':_0x38aa8e['id'],'type':_0xac6463[_0x3561('0x2b')],'sectionId':_0xac6463['id']},{})[_0x3561('0x24')](function(){return _0x80a597;});}else{return _0x80a597;}})[_0x3561('0x4a')](function(_0x352cf2){logger[_0x3561('0x29')](_0x3561('0x5d'),_0x352cf2);});}return _0x80a597;});})[_0x3561('0x24')](respondWithResult(_0x855502,0xc9))[_0x3561('0x4a')](handleError(_0x855502,null));};exports[_0x3561('0x25')]=function(_0x134070,_0x55d5fa,_0x5ae8b5){var _0x400de1;return db[_0x3561('0x2e')][_0x3561('0x49')]({'where':{'id':_0x134070[_0x3561('0x48')]['id']}})[_0x3561('0x24')](function(_0x56a396){if(_0x56a396){return db[_0x3561('0x5e')][_0x3561('0x4e')](function(_0x13410a){return _0x56a396[_0x3561('0x25')]({'transaction':_0x13410a,'raw':!![]})[_0x3561('0x24')](function(_0x9109c8){if(_0x9109c8[_0x3561('0x50')]){fs[_0x3561('0x5f')](_0x9109c8[_0x3561('0x50')])['forEach'](function(_0x528b55){fs[_0x3561('0x60')](path[_0x3561('0x51')](_0x9109c8[_0x3561('0x50')],_0x528b55));});fs[_0x3561('0x61')](_0x9109c8[_0x3561('0x50')]);}return _0x9109c8;});})['catch'](function(_0x5e036c){throw new db[(_0x3561('0x62'))][(_0x3561('0x63'))](_0x5e036c[_0x3561('0x64')]);});}})[_0x3561('0x24')](handleEntityNotFound(_0x55d5fa,null))[_0x3561('0x24')](removeEntity(_0x55d5fa,null))[_0x3561('0x4a')](handleError(_0x55d5fa,null));};exports[_0x3561('0x65')]=function(_0xe40840,_0x4c7bb8,_0x5c309d){return db['sequelize'][_0x3561('0x4e')](function(_0x21d533){var _0x44f60d;return db[_0x3561('0x2e')][_0x3561('0x49')]({'where':{'id':_0xe40840['params']['id']}})['then'](function(_0xb580ff){if(_0xb580ff){_0x44f60d=_0xb580ff;return _0xb580ff['addSound'](_0xe40840[_0x3561('0x4c')]['id'],{'transaction':_0x21d533});}})[_0x3561('0x24')](function(_0x4b0121){if(_0x4b0121){return db[_0x3561('0x66')][_0x3561('0x67')]({'where':{'id':_0xe40840[_0x3561('0x4c')]['id']},'attributes':['id',_0x3561('0x2b'),'save_name','converted_format',_0x3561('0x68')],'raw':!![]});}})[_0x3561('0x24')](function(_0x3a15c5){if(_0x3a15c5){var _0x2455d1=path[_0x3561('0x51')](config[_0x3561('0x52')],_0x3561('0x69'),util[_0x3561('0x6a')](_0x3561('0x6b'),path['basename'](_0x3a15c5[_0x3561('0x6c')],path[_0x3561('0x6d')](_0x3a15c5[_0x3561('0x6c')])),_0x3a15c5['converted_format']));var _0x5d11d2=path[_0x3561('0x51')](config[_0x3561('0x52')],_0x3561('0x53'),_0x44f60d[_0x3561('0x2b')],util[_0x3561('0x6a')](_0x3561('0x6b'),_0x3a15c5[_0x3561('0x2b')],_0x3a15c5['converted_format']));fs[_0x3561('0x6e')](_0x2455d1,_0x5d11d2);return _0x3a15c5;}})['catch'](function(_0x12ced6){throw new db[(_0x3561('0x62'))][(_0x3561('0x63'))](_0x12ced6[_0x3561('0x64')]);});})[_0x3561('0x24')](handleEntityNotFound(_0x4c7bb8,null))[_0x3561('0x24')](respondWithResult(_0x4c7bb8,0xc9))[_0x3561('0x4a')](handleError(_0x4c7bb8,null));};exports[_0x3561('0x6f')]=function(_0x591a9f,_0xa1f601,_0x203612){return db[_0x3561('0x5e')][_0x3561('0x4e')](function(_0x5bdffa){var _0x41102c;return db[_0x3561('0x2e')]['findOne']({'where':{'id':_0x591a9f[_0x3561('0x48')]['id']}})[_0x3561('0x24')](handleEntityNotFound(_0xa1f601,null))[_0x3561('0x24')](function(_0x4d6216){if(_0x4d6216){_0x41102c=_0x4d6216;return _0x4d6216[_0x3561('0x6f')](_0x591a9f[_0x3561('0x48')][_0x3561('0x70')]);}})[_0x3561('0x24')](function(_0x14a2fb){if(_0x14a2fb){return db['Sound'][_0x3561('0x67')]({'where':{'id':_0x591a9f[_0x3561('0x48')]['id2']},'attributes':['id','name','save_name',_0x3561('0x71'),_0x3561('0x68')],'raw':!![]});}})[_0x3561('0x24')](function(_0x3432a8){if(_0x3432a8){fs['unlinkSync'](path[_0x3561('0x51')](_0x41102c[_0x3561('0x50')],util[_0x3561('0x6a')]('%s.%s',_0x3432a8[_0x3561('0x2b')],_0x3432a8['converted_format'])));return _0x3432a8;}})[_0x3561('0x4a')](function(_0x50681c){throw new db['Sequelize'][(_0x3561('0x63'))](_0x50681c[_0x3561('0x64')]);});})[_0x3561('0x24')](handleEntityNotFound(_0xa1f601,null))[_0x3561('0x24')](respondWithStatusCode(_0xa1f601,0xcc))[_0x3561('0x4a')](handleError(_0xa1f601,null));};exports[_0x3561('0x72')]=function(_0x5499c7,_0x4c01fe,_0xfe03ae){var _0x47832e={};var _0x17d29f={};var _0x2dfe06;var _0x469b06;return db['VoiceMusicOnHold'][_0x3561('0x67')]({'where':{'id':_0x5499c7[_0x3561('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c01fe,null))[_0x3561('0x24')](function(_0x1723af){if(_0x1723af){_0x2dfe06=_0x1723af;_0x17d29f[_0x3561('0x31')]=_['keys'](db['Sound'][_0x3561('0x73')]);_0x17d29f['query']=_[_0x3561('0x34')](_0x5499c7[_0x3561('0x33')]);_0x17d29f[_0x3561('0x35')]=_[_0x3561('0x36')](_0x17d29f[_0x3561('0x31')],_0x17d29f[_0x3561('0x33')]);_0x47832e['attributes']=_[_0x3561('0x36')](_0x17d29f[_0x3561('0x31')],qs[_0x3561('0x38')](_0x5499c7[_0x3561('0x33')]['fields']));_0x47832e[_0x3561('0x37')]=_0x47832e[_0x3561('0x37')][_0x3561('0x39')]?_0x47832e[_0x3561('0x37')]:_0x17d29f[_0x3561('0x31')];_0x47832e[_0x3561('0x3c')]=qs[_0x3561('0x3d')](_0x5499c7[_0x3561('0x33')]['sort']);_0x47832e[_0x3561('0x3e')]=qs['filters'](_[_0x3561('0x74')](_0x5499c7[_0x3561('0x33')],_0x17d29f[_0x3561('0x35')]));if(_0x5499c7[_0x3561('0x33')]['filter']){_0x47832e[_0x3561('0x3e')]=_['merge'](_0x47832e[_0x3561('0x3e')],{'$or':_[_0x3561('0x32')](_0x47832e[_0x3561('0x37')],function(_0x2c364b){var _0x1c0b42={};_0x1c0b42[_0x2c364b]={'$like':'%'+_0x5499c7[_0x3561('0x33')][_0x3561('0x3f')]+'%'};return _0x1c0b42;})});}_0x47832e=_[_0x3561('0x41')]({},_0x47832e,_0x5499c7[_0x3561('0x42')]);return _0x2dfe06[_0x3561('0x72')](_0x47832e);}})[_0x3561('0x24')](function(_0x29dac2){if(_0x29dac2){_0x469b06=_0x29dac2[_0x3561('0x39')];if(!_0x5499c7[_0x3561('0x33')]['hasOwnProperty'](_0x3561('0x3b'))){_0x47832e[_0x3561('0x1e')]=qs['limit'](_0x5499c7[_0x3561('0x33')]['limit']);_0x47832e[_0x3561('0x1f')]=qs[_0x3561('0x1f')](_0x5499c7[_0x3561('0x33')]['offset']);}return _0x2dfe06[_0x3561('0x72')](_0x47832e);}})['then'](function(_0x11af27){if(_0x11af27){return _0x11af27?{'count':_0x469b06,'rows':_0x11af27}:null;}})[_0x3561('0x24')](respondWithResult(_0x4c01fe,null))[_0x3561('0x4a')](handleError(_0x4c01fe,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index f7b6c75..91a7515 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 _0xf026=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x44251f,_0x5889a1){var _0xbef371=function(_0x24c25a){while(--_0x24c25a){_0x44251f['push'](_0x44251f['shift']());}};_0xbef371(++_0x5889a1);}(_0xf026,0x17d));var _0x6f02=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf026[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x6f02('0x0'));var util=require(_0x6f02('0x1'));var logger=require(_0x6f02('0x2'))(_0x6f02('0x3'));var moment=require('moment');var BPromise=require(_0x6f02('0x4'));var rp=require(_0x6f02('0x5'));var fs=require('fs');var path=require(_0x6f02('0x6'));var rimraf=require(_0x6f02('0x7'));var config=require(_0x6f02('0x8'));var attributes=require(_0x6f02('0x9'));module[_0x6f02('0xa')]=function(_0x281471,_0x193657){return _0x281471[_0x6f02('0xb')](_0x6f02('0xc'),attributes,{'tableName':_0x6f02('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd623=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xab11ff,_0x4777e4){var _0x1d43e5=function(_0x5410fa){while(--_0x5410fa){_0xab11ff['push'](_0xab11ff['shift']());}};_0x1d43e5(++_0x4777e4);}(_0xd623,0xf6));var _0x3d62=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd623[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3d62('0x0'));var util=require(_0x3d62('0x1'));var logger=require(_0x3d62('0x2'))(_0x3d62('0x3'));var moment=require(_0x3d62('0x4'));var BPromise=require('bluebird');var rp=require(_0x3d62('0x5'));var fs=require('fs');var path=require(_0x3d62('0x6'));var rimraf=require(_0x3d62('0x7'));var config=require(_0x3d62('0x8'));var attributes=require(_0x3d62('0x9'));module[_0x3d62('0xa')]=function(_0x4dfd58,_0x52a691){return _0x4dfd58['define']('VoiceMusicOnHold',attributes,{'tableName':_0x3d62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index b05184b..d4b34b7 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ff58d,_0x1a1729){var _0xa847a7=function(_0xce1bbd){while(--_0xce1bbd){_0x2ff58d['push'](_0x2ff58d['shift']());}};_0xa847a7(++_0x1a1729);}(_0xe706,0xa3));var _0x6e70=function(_0x3b562e,_0x3c47de){_0x3b562e=_0x3b562e-0x0;var _0x43664d=_0xe706[_0x3b562e];return _0x43664d;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x18053a,_0x57dd18){var _0x17c58c=function(_0x2a8f3b){while(--_0x2a8f3b){_0x18053a['push'](_0x18053a['shift']());}};_0x17c58c(++_0x57dd18);}(_0x70e0,0x17b));var _0x070e=function(_0x49b567,_0x2811f2){_0x49b567=_0x49b567-0x0;var _0x5b3a35=_0x70e0[_0x49b567];return _0x5b3a35;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 97fa585..6ab5797 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 _0x9f75=['post','addTeams','update','destroy','delete','removeAgents','removeTeams','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','create','addAgents'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x9f75,0x15a));var _0x59f7=function(_0x3883ba,_0xedf80f){_0x3883ba=_0x3883ba-0x0;var _0x430e29=_0x9f75[_0x3883ba];return _0x430e29;};'use strict';var multer=require(_0x59f7('0x0'));var util=require('util');var path=require(_0x59f7('0x1'));var timeout=require(_0x59f7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x59f7('0x3'));var auth=require(_0x59f7('0x4'));var interaction=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var controller=require('./voicePrefix.controller');router[_0x59f7('0x7')]('/',auth[_0x59f7('0x8')](),controller['index']);router['get'](_0x59f7('0x9'),auth[_0x59f7('0x8')](),controller[_0x59f7('0xa')]);router[_0x59f7('0x7')](_0x59f7('0xb'),auth[_0x59f7('0x8')](),controller['show']);router[_0x59f7('0x7')](_0x59f7('0xc'),auth[_0x59f7('0x8')](),controller[_0x59f7('0xd')]);router['get'](_0x59f7('0xe'),auth['isAuthenticated'](),controller[_0x59f7('0xf')]);router['post']('/',auth[_0x59f7('0x8')](),controller[_0x59f7('0x10')]);router['post']('/:id/users',auth[_0x59f7('0x8')](),controller[_0x59f7('0x11')]);router[_0x59f7('0x12')](_0x59f7('0xe'),auth[_0x59f7('0x8')](),controller[_0x59f7('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x59f7('0x14')]);router['delete'](_0x59f7('0xb'),auth[_0x59f7('0x8')](),controller[_0x59f7('0x15')]);router[_0x59f7('0x16')](_0x59f7('0xc'),auth[_0x59f7('0x8')](),controller[_0x59f7('0x17')]);router[_0x59f7('0x16')](_0x59f7('0xe'),auth[_0x59f7('0x8')](),controller[_0x59f7('0x18')]);module[_0x59f7('0x19')]=router; \ No newline at end of file +var _0x4989=['update','delete','destroy','removeAgents','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/users','/:id/teams','post','addAgents','addTeams'];(function(_0x1bbd58,_0x3015e6){var _0x50fd62=function(_0x376108){while(--_0x376108){_0x1bbd58['push'](_0x1bbd58['shift']());}};_0x50fd62(++_0x3015e6);}(_0x4989,0x79));var _0x9498=function(_0x2b9ac8,_0xf820cb){_0x2b9ac8=_0x2b9ac8-0x0;var _0x3ceea9=_0x4989[_0x2b9ac8];return _0x3ceea9;};'use strict';var multer=require(_0x9498('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9498('0x1'));var express=require(_0x9498('0x2'));var router=express[_0x9498('0x3')]();var fs_extra=require(_0x9498('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9498('0x5'));var controller=require('./voicePrefix.controller');router[_0x9498('0x6')]('/',auth[_0x9498('0x7')](),controller['index']);router[_0x9498('0x6')](_0x9498('0x8'),auth[_0x9498('0x7')](),controller[_0x9498('0x9')]);router[_0x9498('0x6')](_0x9498('0xa'),auth[_0x9498('0x7')](),controller[_0x9498('0xb')]);router[_0x9498('0x6')](_0x9498('0xc'),auth[_0x9498('0x7')](),controller['getAgents']);router[_0x9498('0x6')](_0x9498('0xd'),auth[_0x9498('0x7')](),controller['getTeams']);router[_0x9498('0xe')]('/',auth[_0x9498('0x7')](),controller['create']);router['post']('/:id/users',auth[_0x9498('0x7')](),controller[_0x9498('0xf')]);router[_0x9498('0xe')](_0x9498('0xd'),auth[_0x9498('0x7')](),controller[_0x9498('0x10')]);router['put'](_0x9498('0xa'),auth[_0x9498('0x7')](),controller[_0x9498('0x11')]);router[_0x9498('0x12')](_0x9498('0xa'),auth[_0x9498('0x7')](),controller[_0x9498('0x13')]);router[_0x9498('0x12')](_0x9498('0xc'),auth[_0x9498('0x7')](),controller[_0x9498('0x14')]);router[_0x9498('0x12')](_0x9498('0xd'),auth[_0x9498('0x7')](),controller[_0x9498('0x15')]);module[_0x9498('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1a3829d..471d03b 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 _0x844f=['INTEGER','sequelize','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0xe09089,_0x23bcef){var _0x40cb69=function(_0x4684db){while(--_0x4684db){_0xe09089['push'](_0xe09089['shift']());}};_0x40cb69(++_0x23bcef);}(_0x844f,0x189));var _0xf844=function(_0x5114aa,_0x4596b9){_0x5114aa=_0x5114aa-0x0;var _0x1841bc=_0x844f[_0x5114aa];return _0x1841bc;};'use strict';var Sequelize=require(_0xf844('0x0'));module['exports']={'name':{'type':Sequelize[_0xf844('0x1')],'allowNull':![],'unique':_0xf844('0x2')},'prefix':{'type':Sequelize[_0xf844('0x3')],'get':function(_0x5c1beb){return _0xf844('0x4')+this[_0xf844('0x5')](_0xf844('0x2'))+'-';}},'description':{'type':Sequelize[_0xf844('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xf844('0x6')]}}; \ No newline at end of file +var _0x8fb5=['exports','STRING','system-','getDataValue','name'];(function(_0x82b3c0,_0x32d9b6){var _0x5d1fb2=function(_0x39a842){while(--_0x39a842){_0x82b3c0['push'](_0x82b3c0['shift']());}};_0x5d1fb2(++_0x32d9b6);}(_0x8fb5,0xc8));var _0x58fb=function(_0x2ec7f2,_0xe24da3){_0x2ec7f2=_0x2ec7f2-0x0;var _0x29de00=_0x8fb5[_0x2ec7f2];return _0x29de00;};'use strict';var Sequelize=require('sequelize');module[_0x58fb('0x0')]={'name':{'type':Sequelize[_0x58fb('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x517cfa){return _0x58fb('0x2')+this[_0x58fb('0x3')](_0x58fb('0x4'))+'-';}},'description':{'type':Sequelize[_0x58fb('0x1')]},'callerIdAll':{'type':Sequelize[_0x58fb('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index faaa834..c8e02c1 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 _0xd4a2=['appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','charAt','system-','sequelize','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','nolimit','getTeams','Team','Agents','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','isEmpty','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','show','include','options','find','catch','params','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4a2,0x173));var _0x2d4a=function(_0xda5fd7,_0x4c742a){_0xda5fd7=_0xda5fd7-0x0;var _0x3585cd=_0xd4a2[_0xda5fd7];return _0x3585cd;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];config[_0x2d4a('0x17')]=_[_0x2d4a('0x18')](config[_0x2d4a('0x17')],{'host':_0x2d4a('0x19'),'port':0x18eb});var socket=require(_0x2d4a('0x1a'))(new Redis(config[_0x2d4a('0x17')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x2a1d0f,_0x5b6c4f){_0x5b6c4f=_0x5b6c4f||0xcc;return function(_0x11c64a){if(_0x11c64a){return _0x2a1d0f[_0x2d4a('0x1b')](_0x5b6c4f);}return _0x2a1d0f[_0x2d4a('0x1c')](_0x5b6c4f)[_0x2d4a('0x1d')]();};}function respondWithResult(_0x4c5287,_0x5f825d){_0x5f825d=_0x5f825d||0xc8;return function(_0x5a6378){if(_0x5a6378){return _0x4c5287[_0x2d4a('0x1c')](_0x5f825d)['json'](_0x5a6378);}};}function respondWithFilteredResult(_0x435687,_0xd1dd52){return function(_0x2188b2){if(_0x2188b2){var _0x388371=typeof _0xd1dd52['offset']==='undefined'&&typeof _0xd1dd52['limit']===_0x2d4a('0x1e');var _0x1966d1=_0x2188b2[_0x2d4a('0x1f')];var _0x419df5=_0x388371?0x0:_0xd1dd52[_0x2d4a('0x20')];var _0x2e4069=_0x388371?_0x2188b2['count']:_0xd1dd52['offset']+_0xd1dd52[_0x2d4a('0x21')];var _0x1f3e17;if(_0x2e4069>=_0x1966d1){_0x2e4069=_0x1966d1;_0x1f3e17=0xc8;}else{_0x1f3e17=0xce;}_0x435687[_0x2d4a('0x1c')](_0x1f3e17);return _0x435687[_0x2d4a('0x22')](_0x2d4a('0x23'),_0x419df5+'-'+_0x2e4069+'/'+_0x1966d1)[_0x2d4a('0x24')](_0x2188b2);}return null;};}function patchUpdates(_0x22dd0b){return function(_0xa43fb1){try{jsonpatch['apply'](_0xa43fb1,_0x22dd0b,!![]);}catch(_0x26e7b8){return BPromise[_0x2d4a('0x25')](_0x26e7b8);}return _0xa43fb1[_0x2d4a('0x26')]();};}function saveUpdates(_0x42d813,_0x2c845c){return function(_0xed2822){if(_0xed2822){return _0xed2822[_0x2d4a('0x27')](_0x42d813)[_0x2d4a('0x28')](function(_0x54c910){return _0x54c910;});}return null;};}function removeEntity(_0x544b9b,_0x5cc7d8){return function(_0x2bb9f0){if(_0x2bb9f0){return _0x2bb9f0['destroy']()[_0x2d4a('0x28')](function(){var _0x3a2fd3=_0x2bb9f0[_0x2d4a('0x29')]({'plain':!![]});var _0x1d2fa6=_0x2d4a('0x2a');return db[_0x2d4a('0x2b')][_0x2d4a('0x2c')]({'where':{'type':_0x1d2fa6,'resourceId':_0x3a2fd3['id']}})[_0x2d4a('0x28')](function(){return _0x2bb9f0;});})['then'](function(){_0x544b9b[_0x2d4a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221602,_0x9bac28){return function(_0xc497ce){if(!_0xc497ce){_0x221602[_0x2d4a('0x1b')](0x194);}return _0xc497ce;};}function handleError(_0x101382,_0x1dfc5d){_0x1dfc5d=_0x1dfc5d||0x1f4;return function(_0x25ac5c){logger[_0x2d4a('0x2d')](_0x25ac5c['stack']);if(_0x25ac5c[_0x2d4a('0x2e')]){delete _0x25ac5c[_0x2d4a('0x2e')];}_0x101382[_0x2d4a('0x1c')](_0x1dfc5d)[_0x2d4a('0x2f')](_0x25ac5c);};}exports[_0x2d4a('0x30')]=function(_0x57bf71,_0x217653){var _0x31d8ae={},_0x27015d={},_0x24bcc2={'count':0x0,'rows':[]};var _0x2bb93d=_['map'](db[_0x2d4a('0x31')][_0x2d4a('0x32')],function(_0x46b623){return{'name':_0x46b623[_0x2d4a('0x33')],'type':_0x46b623[_0x2d4a('0x34')][_0x2d4a('0x35')]};});_0x27015d['model']=_[_0x2d4a('0x36')](_0x2bb93d,_0x2d4a('0x2e'));_0x27015d[_0x2d4a('0x37')]=_[_0x2d4a('0x38')](_0x57bf71[_0x2d4a('0x37')]);_0x27015d['filters']=_[_0x2d4a('0x39')](_0x27015d[_0x2d4a('0x3a')],_0x27015d['query']);_0x31d8ae[_0x2d4a('0x3b')]=_[_0x2d4a('0x39')](_0x27015d[_0x2d4a('0x3a')],qs[_0x2d4a('0x3c')](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x3c')]));_0x31d8ae['attributes']=_0x31d8ae[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x31d8ae[_0x2d4a('0x3b')]:_0x27015d[_0x2d4a('0x3a')];if(!_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x3e')]('nolimit')){_0x31d8ae['limit']=qs[_0x2d4a('0x21')](_0x57bf71['query'][_0x2d4a('0x21')]);_0x31d8ae[_0x2d4a('0x20')]=qs['offset'](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x20')]);}_0x31d8ae[_0x2d4a('0x3f')]=qs[_0x2d4a('0x40')](_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x40')]);_0x31d8ae[_0x2d4a('0x41')]=qs[_0x2d4a('0x42')](_[_0x2d4a('0x43')](_0x57bf71[_0x2d4a('0x37')],_0x27015d[_0x2d4a('0x42')]),_0x2bb93d);if(_0x57bf71['query'][_0x2d4a('0x44')]){_0x31d8ae[_0x2d4a('0x41')]=_[_0x2d4a('0x45')](_0x31d8ae[_0x2d4a('0x41')],{'$or':_[_0x2d4a('0x36')](_0x2bb93d,function(_0x483a40){if(_0x483a40['type']!=='VIRTUAL'){var _0x5af510={};_0x5af510[_0x483a40[_0x2d4a('0x2e')]]={'$like':'%'+_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x44')]+'%'};return _0x5af510;}})});}_0x31d8ae=_[_0x2d4a('0x45')]({},_0x31d8ae,_0x57bf71['options']);var _0x155f2d={'where':_0x31d8ae[_0x2d4a('0x41')]};return db['VoicePrefix'][_0x2d4a('0x1f')](_0x155f2d)[_0x2d4a('0x28')](function(_0x8a9375){_0x24bcc2[_0x2d4a('0x1f')]=_0x8a9375;if(_0x57bf71[_0x2d4a('0x37')][_0x2d4a('0x46')]){_0x31d8ae['include']=[{'all':!![]}];}return db[_0x2d4a('0x31')][_0x2d4a('0x47')](_0x31d8ae);})[_0x2d4a('0x28')](function(_0x365399){_0x24bcc2[_0x2d4a('0x48')]=_0x365399;return _0x24bcc2;})[_0x2d4a('0x28')](respondWithFilteredResult(_0x217653,_0x31d8ae))['catch'](handleError(_0x217653,null));};exports[_0x2d4a('0x49')]=function(_0x1f08a3,_0x10b723){var _0x4e1901={'raw':![],'where':{'id':_0x1f08a3['params']['id']}},_0x2585db={};_0x2585db[_0x2d4a('0x3a')]=_[_0x2d4a('0x38')](db[_0x2d4a('0x31')][_0x2d4a('0x32')]);_0x2585db[_0x2d4a('0x37')]=_['keys'](_0x1f08a3['query']);_0x2585db[_0x2d4a('0x42')]=_[_0x2d4a('0x39')](_0x2585db['model'],_0x2585db[_0x2d4a('0x37')]);_0x4e1901['attributes']=_[_0x2d4a('0x39')](_0x2585db[_0x2d4a('0x3a')],qs[_0x2d4a('0x3c')](_0x1f08a3['query'][_0x2d4a('0x3c')]));_0x4e1901['attributes']=_0x4e1901[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x4e1901[_0x2d4a('0x3b')]:_0x2585db[_0x2d4a('0x3a')];if(_0x1f08a3[_0x2d4a('0x37')][_0x2d4a('0x46')]){_0x4e1901[_0x2d4a('0x4a')]=[{'all':!![]}];}_0x4e1901=_[_0x2d4a('0x45')]({},_0x4e1901,_0x1f08a3[_0x2d4a('0x4b')]);return db[_0x2d4a('0x31')][_0x2d4a('0x4c')](_0x4e1901)['then'](handleEntityNotFound(_0x10b723,null))[_0x2d4a('0x28')](respondWithResult(_0x10b723,null))[_0x2d4a('0x4d')](handleError(_0x10b723,null));};exports[_0x2d4a('0x2c')]=function(_0x1467ab,_0x2d2e24){return db['VoicePrefix'][_0x2d4a('0x4c')]({'where':{'id':_0x1467ab[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x2d2e24,null))[_0x2d4a('0x28')](removeEntity(_0x2d2e24,null))[_0x2d4a('0x4d')](handleError(_0x2d2e24,null));};exports['describe']=function(_0x4b9a52,_0x43e74a){return db[_0x2d4a('0x31')]['describe']()[_0x2d4a('0x28')](respondWithResult(_0x43e74a,null))[_0x2d4a('0x4d')](handleError(_0x43e74a,null));};exports[_0x2d4a('0x4f')]=function(_0x19109b,_0x52a468){var _0x31576d;return db['sequelize'][_0x2d4a('0x50')](function(_0x3fe91b){return db[_0x2d4a('0x31')][_0x2d4a('0x4f')](_0x19109b[_0x2d4a('0x51')],{'transaction':_0x3fe91b})[_0x2d4a('0x28')](function(_0x25fb59){_0x31576d=_0x25fb59[_0x2d4a('0x29')]({'plain':!![]});return db['VoiceExtension'][_0x2d4a('0x4c')]({'where':{'id':_0x31576d[_0x2d4a('0x52')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x67ddff){return createVoicePrefixExtensions(_0x31576d,_0x67ddff,_0x3fe91b);});});})[_0x2d4a('0x28')](function(){var _0x334d6a=_0x19109b[_0x2d4a('0x53')][_0x2d4a('0x29')]({'plain':!![]});if(!_0x334d6a)throw new Error(_0x2d4a('0x54'));if(_0x334d6a[_0x2d4a('0x55')]===_0x2d4a('0x53')){var _0x113bc4=_0x31576d;return db[_0x2d4a('0x56')][_0x2d4a('0x4c')]({'where':{'name':_0x2d4a('0x2a'),'userProfileId':_0x334d6a[_0x2d4a('0x57')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x4cce5e){if(_0x4cce5e&&_0x4cce5e[_0x2d4a('0x58')]===0x0){return db[_0x2d4a('0x2b')]['create']({'name':_0x113bc4[_0x2d4a('0x2e')],'resourceId':_0x113bc4['id'],'type':_0x4cce5e[_0x2d4a('0x2e')],'sectionId':_0x4cce5e['id']},{})[_0x2d4a('0x28')](function(){return _0x31576d;});}else{return _0x31576d;}})[_0x2d4a('0x4d')](function(_0x165c00){logger[_0x2d4a('0x2d')](_0x2d4a('0x59'),_0x165c00);throw _0x165c00;});}return _0x31576d;})[_0x2d4a('0x28')](respondWithResult(_0x52a468,null))[_0x2d4a('0x4d')](handleError(_0x52a468,null));};function Extension(_0x352b50,_0x346f2b,_0x302323,_0x5c7cf9){this[_0x2d4a('0x5a')]=_0x2d4a('0x5b');this['exten']=_0x352b50;this[_0x2d4a('0x5c')]=_0x302323;this[_0x2d4a('0x34')]=_0x2d4a('0x5d');this[_0x2d4a('0x5e')]=_0x2d4a('0x5f');this[_0x2d4a('0x60')]=_0x346f2b;this[_0x2d4a('0x61')]=_0x5c7cf9;}function createVoicePrefixExtensions(_0x43e6a6,_0x1034d2,_0x282df8){return new BPromise(function(_0x5bbc96,_0x2bd137){var _0x8ae6bd=new Extension(formatPrefixName(_0x43e6a6[_0x2d4a('0x62')]),0x1,'NoOp',_0x2d4a('0x63'));_0x8ae6bd[_0x2d4a('0x64')]=_0x43e6a6['id'];return db[_0x2d4a('0x65')][_0x2d4a('0x4f')](_0x8ae6bd,{'transaction':_0x282df8})[_0x2d4a('0x28')](function(_0x278bbc){var _0x7e2699=_0x278bbc[_0x2d4a('0x29')]({'plain':!![]});var _0x1ed616=_['map'](addVoicePrefixExtensions(_0x43e6a6,_0x1034d2),function(_0x21b8e9){_0x21b8e9[_0x2d4a('0x52')]=_0x7e2699['id'];_0x21b8e9[_0x2d4a('0x64')]=_0x43e6a6['id'];return _0x21b8e9;});return db[_0x2d4a('0x65')][_0x2d4a('0x66')](_0x1ed616,{'transaction':_0x282df8})[_0x2d4a('0x28')](function(_0x53f52b){if(!_0x53f52b){return _0x2bd137(_0x2d4a('0x67'));}else{return _0x5bbc96(_0x53f52b);}})[_0x2d4a('0x4d')](function(_0x22707f){return _0x2bd137(_0x22707f);});});;});};function addVoicePrefixExtensions(_0x4809af,_0x465c89){var _0x442691=[];var _0x4f4a09=formatPrefixName(_0x4809af[_0x2d4a('0x62')]);_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x2,'Set',_0x2d4a('0x69')+_0x4809af['name']));if(_0x4809af['callerIdAll']){_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x3,_0x2d4a('0x6a'),_0x2d4a('0x6b')+_0x4809af[_0x2d4a('0x6c')]));}else{_0x442691['push'](new Extension(_0x4f4a09,0x3,_0x2d4a('0x6d'),_0x2d4a('0x6e')));}_0x442691[_0x2d4a('0x68')](new Extension(_0x4f4a09,0x4,_0x2d4a('0x6f'),_0x465c89['context']+','+'${EXTEN:'+(0x8+_0x4809af[_0x2d4a('0x2e')][_0x2d4a('0x3d')])+'}'+','+0x1));return _0x442691;}function formatPrefixName(_0x2a2441){var _0x2aa9e8='_';for(var _0x9e6321=0x0;_0x9e6321<_0x2a2441[_0x2d4a('0x3d')];_0x9e6321++){if(_0x2a2441[_0x2d4a('0x70')](_0x9e6321)=='-'){_0x2aa9e8+=_0x2a2441['charAt'](_0x9e6321);}else{_0x2aa9e8+='['+_0x2a2441[_0x2d4a('0x70')](_0x9e6321)+']';}}_0x2aa9e8+='.';return _0x2aa9e8;}exports[_0x2d4a('0x27')]=function(_0xf3d514,_0x398439,_0x59810d){var _0x299bdf=_0xf3d514[_0x2d4a('0x51')];_0x299bdf[_0x2d4a('0x62')]=_0x2d4a('0x71')+_0x299bdf['name']+'-';return db[_0x2d4a('0x72')][_0x2d4a('0x50')](function(_0x55d565){return db[_0x2d4a('0x31')][_0x2d4a('0x27')](_0x299bdf,{'where':{'id':_0x299bdf['id']},'transaction':_0x55d565})[_0x2d4a('0x28')](function(){return db['VoiceExtension'][_0x2d4a('0x2c')]({'where':{'VoicePrefixId':_0x299bdf['id']},'transaction':_0x55d565})[_0x2d4a('0x28')](function(){return db[_0x2d4a('0x65')][_0x2d4a('0x4c')]({'where':{'id':_0x299bdf[_0x2d4a('0x52')]},'raw':!![]})[_0x2d4a('0x28')](function(_0x3bc965){return createVoicePrefixExtensions(_0x299bdf,_0x3bc965,_0x55d565);});});});})['then'](function(){return db[_0x2d4a('0x31')][_0x2d4a('0x73')](_0x299bdf['id']);})[_0x2d4a('0x28')](respondWithResult(_0x398439,null))[_0x2d4a('0x4d')](handleError(_0x398439,null));};exports[_0x2d4a('0x74')]=function(_0x55ebbb,_0x38e623,_0x5aead3){return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x55ebbb[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x38e623,null))[_0x2d4a('0x28')](function(_0x2ba9c2){if(_0x2ba9c2){return _0x2ba9c2[_0x2d4a('0x74')](_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')],_[_0x2d4a('0x76')](_0x55ebbb['body'],[_0x2d4a('0x75'),'id'])||{})['spread'](function(_0x3d7d7d){for(var _0x3c284d=0x0;_0x3c284d<_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')][_0x2d4a('0x3d')];_0x3c284d+=0x1){socket[_0x2d4a('0x77')](_0x2d4a('0x78'),{'UserId':Number(_0x55ebbb[_0x2d4a('0x51')][_0x2d4a('0x75')][_0x3c284d]),'VoicePrefixId':Number(_0x55ebbb['params']['id'])});}return _0x3d7d7d;});}})[_0x2d4a('0x28')](respondWithResult(_0x38e623,null))[_0x2d4a('0x4d')](handleError(_0x38e623,null));};exports[_0x2d4a('0x79')]=function(_0xcdf787,_0x574285,_0x36d253){return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0xcdf787[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x574285,null))[_0x2d4a('0x28')](function(_0x5769be){if(_0x5769be){return _0x5769be[_0x2d4a('0x79')](_0xcdf787[_0x2d4a('0x37')]['ids'])[_0x2d4a('0x28')](function(){if(_[_0x2d4a('0x7a')](_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')])){for(var _0x429579=0x0;_0x429579<_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')][_0x2d4a('0x3d')];_0x429579+=0x1){socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':Number(_0xcdf787['query'][_0x2d4a('0x75')][_0x429579]),'VoicePrefixId':Number(_0xcdf787['params']['id'])});}}else{socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':Number(_0xcdf787[_0x2d4a('0x37')][_0x2d4a('0x75')]),'VoicePrefixId':Number(_0xcdf787[_0x2d4a('0x4e')]['id'])});}});}})[_0x2d4a('0x28')](respondWithStatusCode(_0x574285,null))[_0x2d4a('0x4d')](handleError(_0x574285,null));};exports['getAgents']=function(_0x119c59,_0x2ebb9e,_0xc11b2e){var _0xfc7b53={};var _0x47377e={};var _0x5e7f23;var _0x4ebda1;return db['VoicePrefix'][_0x2d4a('0x7c')]({'where':{'id':_0x119c59[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x2ebb9e,null))['then'](function(_0x135f58){if(_0x135f58){_0x5e7f23=_0x135f58;_0x47377e[_0x2d4a('0x3a')]=_[_0x2d4a('0x38')](db[_0x2d4a('0x7d')][_0x2d4a('0x32')]);_0x47377e[_0x2d4a('0x37')]=_['keys'](_0x119c59[_0x2d4a('0x37')]);_0x47377e['filters']=_[_0x2d4a('0x39')](_0x47377e[_0x2d4a('0x3a')],_0x47377e['query']);_0xfc7b53[_0x2d4a('0x3b')]=_['intersection'](_0x47377e['model'],qs['fields'](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x3c')]));_0xfc7b53[_0x2d4a('0x3b')]=_0xfc7b53['attributes'][_0x2d4a('0x3d')]?_0xfc7b53[_0x2d4a('0x3b')]:_0x47377e[_0x2d4a('0x3a')];_0xfc7b53[_0x2d4a('0x3f')]=qs['sort'](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x40')]);_0xfc7b53['where']=qs[_0x2d4a('0x42')](_[_0x2d4a('0x43')](_0x119c59['query'],_0x47377e[_0x2d4a('0x42')]));if(_0x119c59['query']['filter']){_0xfc7b53[_0x2d4a('0x41')]=_['merge'](_0xfc7b53[_0x2d4a('0x41')],{'$or':_[_0x2d4a('0x36')](_0xfc7b53[_0x2d4a('0x3b')],function(_0x44d3b3){var _0x5e939f={};_0x5e939f[_0x44d3b3]={'$like':'%'+_0x119c59[_0x2d4a('0x37')]['filter']+'%'};return _0x5e939f;})});}_0xfc7b53=_[_0x2d4a('0x45')]({},_0xfc7b53,_0x119c59[_0x2d4a('0x4b')]);return _0x5e7f23[_0x2d4a('0x7e')](_0xfc7b53);}})[_0x2d4a('0x28')](function(_0x45f6b7){if(_0x45f6b7){_0x4ebda1=_0x45f6b7['length'];if(!_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x3e')](_0x2d4a('0x7f'))){_0xfc7b53['limit']=qs[_0x2d4a('0x21')](_0x119c59['query']['limit']);_0xfc7b53[_0x2d4a('0x20')]=qs[_0x2d4a('0x20')](_0x119c59[_0x2d4a('0x37')][_0x2d4a('0x20')]);}return _0x5e7f23[_0x2d4a('0x7e')](_0xfc7b53);}})[_0x2d4a('0x28')](function(_0x2bffb4){if(_0x2bffb4){return _0x2bffb4?{'count':_0x4ebda1,'rows':_0x2bffb4}:null;}})[_0x2d4a('0x28')](respondWithResult(_0x2ebb9e,null))[_0x2d4a('0x4d')](handleError(_0x2ebb9e,null));};exports[_0x2d4a('0x80')]=function(_0x5ecf3e,_0x16c4fd,_0x2b29b1){var _0x4647cb={};var _0x10d86c={};var _0x36b067;var _0x1cb5b3;return db[_0x2d4a('0x31')][_0x2d4a('0x7c')]({'where':{'id':_0x5ecf3e['params']['id']}})[_0x2d4a('0x28')](handleEntityNotFound(_0x16c4fd,null))[_0x2d4a('0x28')](function(_0xa4c947){if(_0xa4c947){_0x36b067=_0xa4c947;_0x10d86c['model']=_[_0x2d4a('0x38')](db['Team'][_0x2d4a('0x32')]);_0x10d86c[_0x2d4a('0x37')]=_[_0x2d4a('0x38')](_0x5ecf3e[_0x2d4a('0x37')]);_0x10d86c['filters']=_[_0x2d4a('0x39')](_0x10d86c['model'],_0x10d86c[_0x2d4a('0x37')]);_0x4647cb[_0x2d4a('0x3b')]=_[_0x2d4a('0x39')](_0x10d86c['model'],qs[_0x2d4a('0x3c')](_0x5ecf3e['query'][_0x2d4a('0x3c')]));_0x4647cb[_0x2d4a('0x3b')]=_0x4647cb[_0x2d4a('0x3b')][_0x2d4a('0x3d')]?_0x4647cb[_0x2d4a('0x3b')]:_0x10d86c[_0x2d4a('0x3a')];_0x4647cb[_0x2d4a('0x3f')]=qs[_0x2d4a('0x40')](_0x5ecf3e[_0x2d4a('0x37')]['sort']);_0x4647cb['where']=qs['filters'](_[_0x2d4a('0x43')](_0x5ecf3e['query'],_0x10d86c[_0x2d4a('0x42')]));if(_0x5ecf3e['query'][_0x2d4a('0x44')]){_0x4647cb[_0x2d4a('0x41')]=_['merge'](_0x4647cb['where'],{'$or':_[_0x2d4a('0x36')](_0x4647cb['attributes'],function(_0x279c26){var _0x643012={};_0x643012[_0x279c26]={'$like':'%'+_0x5ecf3e[_0x2d4a('0x37')]['filter']+'%'};return _0x643012;})});}_0x4647cb=_[_0x2d4a('0x45')]({},_0x4647cb,_0x5ecf3e[_0x2d4a('0x4b')]);return _0x36b067[_0x2d4a('0x80')](_0x4647cb);}})[_0x2d4a('0x28')](function(_0x1c3c0f){if(_0x1c3c0f){_0x1cb5b3=_0x1c3c0f[_0x2d4a('0x3d')];if(!_0x5ecf3e[_0x2d4a('0x37')][_0x2d4a('0x3e')](_0x2d4a('0x7f'))){_0x4647cb[_0x2d4a('0x21')]=qs[_0x2d4a('0x21')](_0x5ecf3e[_0x2d4a('0x37')]['limit']);_0x4647cb[_0x2d4a('0x20')]=qs[_0x2d4a('0x20')](_0x5ecf3e[_0x2d4a('0x37')]['offset']);}return _0x36b067[_0x2d4a('0x80')](_0x4647cb);}})[_0x2d4a('0x28')](function(_0x250a9c){if(_0x250a9c){return _0x250a9c?{'count':_0x1cb5b3,'rows':_0x250a9c}:null;}})[_0x2d4a('0x28')](respondWithResult(_0x16c4fd,null))[_0x2d4a('0x4d')](handleError(_0x16c4fd,null));};exports['addTeams']=function(_0x438769,_0x1483af,_0x5413c1){var _0x2d5122=_0x438769['body'][_0x2d4a('0x75')];var _0x1cd7fd;return db[_0x2d4a('0x81')][_0x2d4a('0x47')]({'where':{'id':_0x2d5122},'attributes':['id'],'include':[{'model':db[_0x2d4a('0x7d')],'as':_0x2d4a('0x82'),'attributes':['id',_0x2d4a('0x2e'),'online',_0x2d4a('0x83'),_0x2d4a('0x84')],'raw':!![]}]})[_0x2d4a('0x28')](function(_0x1e5be2){if(_0x1e5be2){_0x1cd7fd=_0x1e5be2;var _0x139e4e=_[_0x2d4a('0x85')](_0x1e5be2,function(_0x58b196){var _0x23577f=_0x58b196[_0x2d4a('0x29')]({'plain':!![]});return _0x23577f[_0x2d4a('0x82')];});return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x438769['params']['id']}})['then'](function(_0x3e276d){return db[_0x2d4a('0x72')][_0x2d4a('0x50')](function(_0x2fee11){return _0x3e276d[_0x2d4a('0x86')](_0x2d5122,{'transaction':_0x2fee11})[_0x2d4a('0x28')](function(){return BPromise[_0x2d4a('0x87')](_0x1cd7fd,function(_0x1adcbc){return db[_0x2d4a('0x88')]['upsert']({'TeamId':_0x1adcbc['id'],'VoicePrefixId':_0x438769['params']['id']},{'transaction':_0x2fee11});});})[_0x2d4a('0x28')](function(){return BPromise[_0x2d4a('0x87')](_0x139e4e,function(_0x3b4585){return db[_0x2d4a('0x89')][_0x2d4a('0x8a')]({'where':{'UserId':_0x3b4585['id'],'VoicePrefixId':_0x438769[_0x2d4a('0x4e')]['id']},'transaction':_0x2fee11});});})[_0x2d4a('0x28')](function(){_0x139e4e[_0x2d4a('0x8b')](function(_0x12914d){socket[_0x2d4a('0x77')](_0x2d4a('0x78'),{'UserId':_0x12914d['id'],'VoicePrefixId':_0x3e276d['id']});});});});});}})[_0x2d4a('0x28')](respondWithStatusCode(_0x1483af,null))['catch'](handleError(_0x1483af,null));};exports['removeTeams']=function(_0x51cba2,_0x448b4d,_0x4cefec){return db['Team'][_0x2d4a('0x47')]({'where':{'id':_0x51cba2[_0x2d4a('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2d4a('0x28')](handleEntityNotFound(_0x448b4d,null))[_0x2d4a('0x28')](function(_0x1e05c5){var _0x3e199a=_[_0x2d4a('0x36')](_0x1e05c5,'id');var _0x357dfc=[];var _0xd80165=[];var _0x448664=squel[_0x2d4a('0x8c')]();_0x448664[_0x2d4a('0x8d')]('tq.TeamId')[_0x2d4a('0x8e')](_0x2d4a('0x8f'),'tq')[_0x2d4a('0x90')](_0x2d4a('0x91'),'ut',_0x2d4a('0x92'))[_0x2d4a('0x41')]('VoicePrefixId\x20=\x20?',_0x51cba2[_0x2d4a('0x4e')]['id']);for(var _0x3030e1=0x0;_0x3030e1<_0x1e05c5['length'];_0x3030e1+=0x1){let _0xc5500=_0x1e05c5[_0x3030e1];for(var _0xe198b=0x0;_0xe198b<_0xc5500['Agents']['length'];_0xe198b+=0x1){let _0x497b03=_0xc5500['Agents'][_0xe198b];var _0xb81202=_0x448664['clone']();_0xb81202[_0x2d4a('0x41')](_0x2d4a('0x93'),_0x497b03['id']);_0xd80165[_0x2d4a('0x68')](db[_0x2d4a('0x72')][_0x2d4a('0x37')](_0xb81202[_0x2d4a('0x94')](),{'type':db[_0x2d4a('0x72')]['QueryTypes'][_0x2d4a('0x95')]})['then'](function(_0x2b6040){if(_0x2b6040[_0x2d4a('0x3d')]===0x1){return _0x497b03['id'];}else{var _0x137c57=_[_0x2d4a('0x96')](_[_0x2d4a('0x36')](_0x2b6040,_0x2d4a('0x97')),function(_0x29108f){return _['includes'](_0x3e199a,_0x29108f);});if(_0x137c57){return _0x497b03['id'];}}}));}}return BPromise[_0x2d4a('0x98')](_0xd80165)['then'](function(_0x1d4cc3){_0x357dfc=_(_0x357dfc)[_0x2d4a('0x99')](_0x1d4cc3)[_0x2d4a('0x9a')]()['value']();return db[_0x2d4a('0x31')][_0x2d4a('0x4c')]({'where':{'id':_0x51cba2[_0x2d4a('0x4e')]['id']}})[_0x2d4a('0x28')](function(_0x108cd1){return db[_0x2d4a('0x72')]['transaction'](function(_0x29a294){return _0x108cd1['removeTeams'](_0x51cba2[_0x2d4a('0x37')]['ids'],{'transaction':_0x29a294})['then'](function(){if(!_[_0x2d4a('0x9b')](_0x357dfc)){return _0x108cd1['removeAgents'](_0x357dfc,{'transaction':_0x29a294});}})['then'](function(){_0x357dfc[_0x2d4a('0x8b')](function(_0x206717){socket[_0x2d4a('0x77')](_0x2d4a('0x7b'),{'UserId':_0x206717,'VoicePrefixId':_0x108cd1['id']});});});});});});})[_0x2d4a('0x28')](respondWithStatusCode(_0x448b4d,null))[_0x2d4a('0x4d')](handleError(_0x448b4d,null));}; \ No newline at end of file +var _0x0972=['filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','include','find','create','sequelize','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','system','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','get','Extensions\x20creation\x20failed','prefix','push','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','length','charAt','system-','VoiceExtensionId','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','addTeams','Team','findAll','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query'];(function(_0x5e08bc,_0x3108bf){var _0x36e3a6=function(_0x57e8ba){while(--_0x57e8ba){_0x5e08bc['push'](_0x5e08bc['shift']());}};_0x36e3a6(++_0x3108bf);}(_0x0972,0x64));var _0x2097=function(_0x36762b,_0x452757){_0x36762b=_0x36762b-0x0;var _0x2795d5=_0x0972[_0x36762b];return _0x2795d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];config[_0x2097('0x1a')]=_[_0x2097('0x1b')](config[_0x2097('0x1a')],{'host':_0x2097('0x1c'),'port':0x18eb});var socket=require(_0x2097('0x1d'))(new Redis(config[_0x2097('0x1a')]));require(_0x2097('0x1e'))[_0x2097('0x1f')](socket);function respondWithStatusCode(_0x354387,_0x5d0a43){_0x5d0a43=_0x5d0a43||0xcc;return function(_0x639c14){if(_0x639c14){return _0x354387[_0x2097('0x20')](_0x5d0a43);}return _0x354387['status'](_0x5d0a43)['end']();};}function respondWithResult(_0x4fc8c5,_0x409deb){_0x409deb=_0x409deb||0xc8;return function(_0x588396){if(_0x588396){return _0x4fc8c5[_0x2097('0x21')](_0x409deb)[_0x2097('0x22')](_0x588396);}};}function respondWithFilteredResult(_0x43fec9,_0x1347e4){return function(_0x44c584){if(_0x44c584){var _0x53e2b4=typeof _0x1347e4[_0x2097('0x23')]===_0x2097('0x24')&&typeof _0x1347e4[_0x2097('0x25')]===_0x2097('0x24');var _0x1d3804=_0x44c584[_0x2097('0x26')];var _0x253f5d=_0x53e2b4?0x0:_0x1347e4[_0x2097('0x23')];var _0x5d8b9e=_0x53e2b4?_0x44c584['count']:_0x1347e4[_0x2097('0x23')]+_0x1347e4['limit'];var _0x227c00;if(_0x5d8b9e>=_0x1d3804){_0x5d8b9e=_0x1d3804;_0x227c00=0xc8;}else{_0x227c00=0xce;}_0x43fec9[_0x2097('0x21')](_0x227c00);return _0x43fec9['set'](_0x2097('0x27'),_0x253f5d+'-'+_0x5d8b9e+'/'+_0x1d3804)['json'](_0x44c584);}return null;};}function patchUpdates(_0x2e17c8){return function(_0xf32d3f){try{jsonpatch[_0x2097('0x28')](_0xf32d3f,_0x2e17c8,!![]);}catch(_0x20b93a){return BPromise[_0x2097('0x29')](_0x20b93a);}return _0xf32d3f[_0x2097('0x2a')]();};}function saveUpdates(_0x56390a,_0xae5f9){return function(_0x500234){if(_0x500234){return _0x500234[_0x2097('0x2b')](_0x56390a)[_0x2097('0x2c')](function(_0x345875){return _0x345875;});}return null;};}function removeEntity(_0x9f59bc,_0x499988){return function(_0x2d683a){if(_0x2d683a){return _0x2d683a[_0x2097('0x2d')]()['then'](function(){var _0x1229fc=_0x2d683a['get']({'plain':!![]});var _0x29b879='VoicePrefixes';return db[_0x2097('0x2e')][_0x2097('0x2d')]({'where':{'type':_0x29b879,'resourceId':_0x1229fc['id']}})[_0x2097('0x2c')](function(){return _0x2d683a;});})[_0x2097('0x2c')](function(){_0x9f59bc[_0x2097('0x21')](0xcc)[_0x2097('0x2f')]();});}};}function handleEntityNotFound(_0x450e0b,_0x4b443d){return function(_0x11242f){if(!_0x11242f){_0x450e0b[_0x2097('0x20')](0x194);}return _0x11242f;};}function handleError(_0x5cce55,_0x1398d0){_0x1398d0=_0x1398d0||0x1f4;return function(_0x41487d){logger['error'](_0x41487d['stack']);if(_0x41487d[_0x2097('0x30')]){delete _0x41487d[_0x2097('0x30')];}_0x5cce55[_0x2097('0x21')](_0x1398d0)[_0x2097('0x31')](_0x41487d);};}exports[_0x2097('0x32')]=function(_0x180654,_0x56c538){var _0xe1a381={},_0x56bb42={},_0x193160={'count':0x0,'rows':[]};var _0x3c36d3=_[_0x2097('0x33')](db[_0x2097('0x34')][_0x2097('0x35')],function(_0x395d9f){return{'name':_0x395d9f[_0x2097('0x36')],'type':_0x395d9f[_0x2097('0x37')][_0x2097('0x38')]};});_0x56bb42['model']=_[_0x2097('0x33')](_0x3c36d3,_0x2097('0x30'));_0x56bb42[_0x2097('0x39')]=_['keys'](_0x180654[_0x2097('0x39')]);_0x56bb42[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x56bb42[_0x2097('0x3c')],_0x56bb42['query']);_0xe1a381['attributes']=_['intersection'](_0x56bb42[_0x2097('0x3c')],qs[_0x2097('0x3d')](_0x180654[_0x2097('0x39')][_0x2097('0x3d')]));_0xe1a381[_0x2097('0x3e')]=_0xe1a381[_0x2097('0x3e')]['length']?_0xe1a381[_0x2097('0x3e')]:_0x56bb42[_0x2097('0x3c')];if(!_0x180654[_0x2097('0x39')][_0x2097('0x3f')](_0x2097('0x40'))){_0xe1a381[_0x2097('0x25')]=qs['limit'](_0x180654[_0x2097('0x39')][_0x2097('0x25')]);_0xe1a381[_0x2097('0x23')]=qs['offset'](_0x180654['query'][_0x2097('0x23')]);}_0xe1a381[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x180654[_0x2097('0x39')][_0x2097('0x42')]);_0xe1a381[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x180654[_0x2097('0x39')],_0x56bb42[_0x2097('0x3a')]),_0x3c36d3);if(_0x180654[_0x2097('0x39')][_0x2097('0x45')]){_0xe1a381['where']=_[_0x2097('0x46')](_0xe1a381[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x3c36d3,function(_0x483900){if(_0x483900[_0x2097('0x37')]!==_0x2097('0x47')){var _0x26d448={};_0x26d448[_0x483900[_0x2097('0x30')]]={'$like':'%'+_0x180654[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x26d448;}})});}_0xe1a381=_[_0x2097('0x46')]({},_0xe1a381,_0x180654[_0x2097('0x48')]);var _0x5ab893={'where':_0xe1a381[_0x2097('0x43')]};return db[_0x2097('0x34')][_0x2097('0x26')](_0x5ab893)[_0x2097('0x2c')](function(_0x12e0e2){_0x193160[_0x2097('0x26')]=_0x12e0e2;if(_0x180654[_0x2097('0x39')][_0x2097('0x49')]){_0xe1a381['include']=[{'all':!![]}];}return db[_0x2097('0x34')]['findAll'](_0xe1a381);})[_0x2097('0x2c')](function(_0x298e49){_0x193160[_0x2097('0x4a')]=_0x298e49;return _0x193160;})[_0x2097('0x2c')](respondWithFilteredResult(_0x56c538,_0xe1a381))[_0x2097('0x4b')](handleError(_0x56c538,null));};exports['show']=function(_0x2cf34e,_0x46ccbb){var _0x113c3b={'raw':![],'where':{'id':_0x2cf34e[_0x2097('0x4c')]['id']}},_0x39e0a4={};_0x39e0a4['model']=_[_0x2097('0x4d')](db[_0x2097('0x34')][_0x2097('0x35')]);_0x39e0a4[_0x2097('0x39')]=_[_0x2097('0x4d')](_0x2cf34e[_0x2097('0x39')]);_0x39e0a4[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x39e0a4['model'],_0x39e0a4[_0x2097('0x39')]);_0x113c3b[_0x2097('0x3e')]=_[_0x2097('0x3b')](_0x39e0a4[_0x2097('0x3c')],qs['fields'](_0x2cf34e['query']['fields']));_0x113c3b[_0x2097('0x3e')]=_0x113c3b[_0x2097('0x3e')]['length']?_0x113c3b[_0x2097('0x3e')]:_0x39e0a4[_0x2097('0x3c')];if(_0x2cf34e['query']['includeAll']){_0x113c3b[_0x2097('0x4e')]=[{'all':!![]}];}_0x113c3b=_[_0x2097('0x46')]({},_0x113c3b,_0x2cf34e[_0x2097('0x48')]);return db['VoicePrefix'][_0x2097('0x4f')](_0x113c3b)[_0x2097('0x2c')](handleEntityNotFound(_0x46ccbb,null))['then'](respondWithResult(_0x46ccbb,null))[_0x2097('0x4b')](handleError(_0x46ccbb,null));};exports[_0x2097('0x2d')]=function(_0xdfea21,_0xba6ef0){return db[_0x2097('0x34')]['find']({'where':{'id':_0xdfea21['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0xba6ef0,null))[_0x2097('0x2c')](removeEntity(_0xba6ef0,null))[_0x2097('0x4b')](handleError(_0xba6ef0,null));};exports['describe']=function(_0x5c1739,_0x144719){return db[_0x2097('0x34')]['describe']()[_0x2097('0x2c')](respondWithResult(_0x144719,null))[_0x2097('0x4b')](handleError(_0x144719,null));};exports[_0x2097('0x50')]=function(_0x33490e,_0x390a52){var _0x4a709a;return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x190859){return db['VoicePrefix'][_0x2097('0x50')](_0x33490e[_0x2097('0x53')],{'transaction':_0x190859})['then'](function(_0x12ba76){_0x4a709a=_0x12ba76['get']({'plain':!![]});return db[_0x2097('0x54')]['find']({'where':{'id':_0x4a709a['VoiceExtensionId']},'raw':!![]})['then'](function(_0x40cbe1){return createVoicePrefixExtensions(_0x4a709a,_0x40cbe1,_0x190859);});});})['then'](function(){var _0x54bea1=_0x33490e[_0x2097('0x55')]['get']({'plain':!![]});if(!_0x54bea1)throw new Error(_0x2097('0x56'));if(_0x54bea1[_0x2097('0x57')]==='user'){var _0x3e799f=_0x4a709a;return db[_0x2097('0x58')][_0x2097('0x4f')]({'where':{'name':_0x2097('0x59'),'userProfileId':_0x54bea1[_0x2097('0x5a')]},'raw':!![]})['then'](function(_0x2117e3){if(_0x2117e3&&_0x2117e3['autoAssociation']===0x0){return db[_0x2097('0x2e')][_0x2097('0x50')]({'name':_0x3e799f[_0x2097('0x30')],'resourceId':_0x3e799f['id'],'type':_0x2117e3['name'],'sectionId':_0x2117e3['id']},{})[_0x2097('0x2c')](function(){return _0x4a709a;});}else{return _0x4a709a;}})[_0x2097('0x4b')](function(_0x2f5016){logger[_0x2097('0x5b')](_0x2097('0x5c'),_0x2f5016);throw _0x2f5016;});}return _0x4a709a;})['then'](respondWithResult(_0x390a52,null))['catch'](handleError(_0x390a52,null));};function Extension(_0x265eac,_0x275578,_0x4cc782,_0x4ddb4b){this['context']='from-sip';this[_0x2097('0x5d')]=_0x265eac;this['app']=_0x4cc782;this[_0x2097('0x37')]=_0x2097('0x5e');this['description']=_0x2097('0x5f');this[_0x2097('0x60')]=_0x275578;this[_0x2097('0x61')]=_0x4ddb4b;}function createVoicePrefixExtensions(_0x103756,_0x2a2673,_0x60332a){return new BPromise(function(_0x15aa91,_0x8f7aaa){var _0x2ec365=new Extension(formatPrefixName(_0x103756['prefix']),0x1,_0x2097('0x62'),_0x2097('0x63'));_0x2ec365[_0x2097('0x64')]=_0x103756['id'];return db[_0x2097('0x54')][_0x2097('0x50')](_0x2ec365,{'transaction':_0x60332a})[_0x2097('0x2c')](function(_0x4befa9){var _0x43071d=_0x4befa9[_0x2097('0x65')]({'plain':!![]});var _0xcabda7=_[_0x2097('0x33')](addVoicePrefixExtensions(_0x103756,_0x2a2673),function(_0x1c4156){_0x1c4156['VoiceExtensionId']=_0x43071d['id'];_0x1c4156[_0x2097('0x64')]=_0x103756['id'];return _0x1c4156;});return db[_0x2097('0x54')]['bulkCreate'](_0xcabda7,{'transaction':_0x60332a})['then'](function(_0x580c1e){if(!_0x580c1e){return _0x8f7aaa(_0x2097('0x66'));}else{return _0x15aa91(_0x580c1e);}})[_0x2097('0x4b')](function(_0x319d3b){return _0x8f7aaa(_0x319d3b);});});;});};function addVoicePrefixExtensions(_0x3edb3e,_0x168703){var _0x18d90a=[];var _0x2e287b=formatPrefixName(_0x3edb3e[_0x2097('0x67')]);_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x2,'Set','CDR(prefix)='+_0x3edb3e[_0x2097('0x30')]));if(_0x3edb3e[_0x2097('0x69')]){_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x3,_0x2097('0x6a'),_0x2097('0x6b')+_0x3edb3e[_0x2097('0x69')]));}else{_0x18d90a['push'](new Extension(_0x2e287b,0x3,_0x2097('0x62'),_0x2097('0x6c')));}_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x4,_0x2097('0x6d'),_0x168703['context']+','+'${EXTEN:'+(0x8+_0x3edb3e[_0x2097('0x30')][_0x2097('0x6e')])+'}'+','+0x1));return _0x18d90a;}function formatPrefixName(_0x487f1f){var _0x3707da='_';for(var _0x426290=0x0;_0x426290<_0x487f1f[_0x2097('0x6e')];_0x426290++){if(_0x487f1f[_0x2097('0x6f')](_0x426290)=='-'){_0x3707da+=_0x487f1f[_0x2097('0x6f')](_0x426290);}else{_0x3707da+='['+_0x487f1f[_0x2097('0x6f')](_0x426290)+']';}}_0x3707da+='.';return _0x3707da;}exports[_0x2097('0x2b')]=function(_0x2c6f24,_0x54159e,_0x4533fd){var _0x283e2b=_0x2c6f24['body'];_0x283e2b[_0x2097('0x67')]=_0x2097('0x70')+_0x283e2b[_0x2097('0x30')]+'-';return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x46d6b5){return db[_0x2097('0x34')][_0x2097('0x2b')](_0x283e2b,{'where':{'id':_0x283e2b['id']},'transaction':_0x46d6b5})[_0x2097('0x2c')](function(){return db[_0x2097('0x54')][_0x2097('0x2d')]({'where':{'VoicePrefixId':_0x283e2b['id']},'transaction':_0x46d6b5})['then'](function(){return db[_0x2097('0x54')][_0x2097('0x4f')]({'where':{'id':_0x283e2b[_0x2097('0x71')]},'raw':!![]})[_0x2097('0x2c')](function(_0x3c9e03){return createVoicePrefixExtensions(_0x283e2b,_0x3c9e03,_0x46d6b5);});});});})['then'](function(){return db[_0x2097('0x34')][_0x2097('0x72')](_0x283e2b['id']);})[_0x2097('0x2c')](respondWithResult(_0x54159e,null))['catch'](handleError(_0x54159e,null));};exports[_0x2097('0x73')]=function(_0x545cd9,_0x364d3a,_0x4dcd9c){return db[_0x2097('0x34')]['find']({'where':{'id':_0x545cd9[_0x2097('0x4c')]['id']}})['then'](handleEntityNotFound(_0x364d3a,null))[_0x2097('0x2c')](function(_0x3dba80){if(_0x3dba80){return _0x3dba80[_0x2097('0x73')](_0x545cd9[_0x2097('0x53')][_0x2097('0x74')],_['omit'](_0x545cd9[_0x2097('0x53')],[_0x2097('0x74'),'id'])||{})[_0x2097('0x75')](function(_0x1f733c){for(var _0xa8416a=0x0;_0xa8416a<_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0x2097('0x6e')];_0xa8416a+=0x1){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':Number(_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0xa8416a]),'VoicePrefixId':Number(_0x545cd9[_0x2097('0x4c')]['id'])});}return _0x1f733c;});}})[_0x2097('0x2c')](respondWithResult(_0x364d3a,null))[_0x2097('0x4b')](handleError(_0x364d3a,null));};exports[_0x2097('0x78')]=function(_0x57a31e,_0x1a81de,_0x4bd44d){return db['VoicePrefix'][_0x2097('0x4f')]({'where':{'id':_0x57a31e[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x1a81de,null))['then'](function(_0x34b687){if(_0x34b687){return _0x34b687[_0x2097('0x78')](_0x57a31e[_0x2097('0x39')][_0x2097('0x74')])['then'](function(){if(_[_0x2097('0x79')](_0x57a31e['query'][_0x2097('0x74')])){for(var _0x385551=0x0;_0x385551<_0x57a31e[_0x2097('0x39')][_0x2097('0x74')]['length'];_0x385551+=0x1){socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e[_0x2097('0x39')]['ids'][_0x385551]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}}else{socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e['query'][_0x2097('0x74')]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}});}})[_0x2097('0x2c')](respondWithStatusCode(_0x1a81de,null))[_0x2097('0x4b')](handleError(_0x1a81de,null));};exports[_0x2097('0x7b')]=function(_0x5efe1e,_0x5d181f,_0x56d4c0){var _0xc7481d={};var _0x3f510d={};var _0x4213d0;var _0x16451c;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x5efe1e['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x5d181f,null))[_0x2097('0x2c')](function(_0x164ad3){if(_0x164ad3){_0x4213d0=_0x164ad3;_0x3f510d[_0x2097('0x3c')]=_[_0x2097('0x4d')](db[_0x2097('0x7d')][_0x2097('0x35')]);_0x3f510d['query']=_[_0x2097('0x4d')](_0x5efe1e[_0x2097('0x39')]);_0x3f510d[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x3f510d[_0x2097('0x3c')],_0x3f510d[_0x2097('0x39')]);_0xc7481d['attributes']=_['intersection'](_0x3f510d[_0x2097('0x3c')],qs['fields'](_0x5efe1e['query'][_0x2097('0x3d')]));_0xc7481d[_0x2097('0x3e')]=_0xc7481d[_0x2097('0x3e')][_0x2097('0x6e')]?_0xc7481d[_0x2097('0x3e')]:_0x3f510d[_0x2097('0x3c')];_0xc7481d[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x5efe1e['query'][_0x2097('0x42')]);_0xc7481d[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x5efe1e[_0x2097('0x39')],_0x3f510d['filters']));if(_0x5efe1e[_0x2097('0x39')][_0x2097('0x45')]){_0xc7481d[_0x2097('0x43')]=_[_0x2097('0x46')](_0xc7481d[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0xc7481d['attributes'],function(_0x33b0c0){var _0x79f858={};_0x79f858[_0x33b0c0]={'$like':'%'+_0x5efe1e['query']['filter']+'%'};return _0x79f858;})});}_0xc7481d=_['merge']({},_0xc7481d,_0x5efe1e['options']);return _0x4213d0[_0x2097('0x7b')](_0xc7481d);}})[_0x2097('0x2c')](function(_0x3fe29e){if(_0x3fe29e){_0x16451c=_0x3fe29e[_0x2097('0x6e')];if(!_0x5efe1e[_0x2097('0x39')]['hasOwnProperty'](_0x2097('0x40'))){_0xc7481d[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x5efe1e[_0x2097('0x39')][_0x2097('0x25')]);_0xc7481d[_0x2097('0x23')]=qs['offset'](_0x5efe1e[_0x2097('0x39')][_0x2097('0x23')]);}return _0x4213d0['getAgents'](_0xc7481d);}})[_0x2097('0x2c')](function(_0x358bc3){if(_0x358bc3){return _0x358bc3?{'count':_0x16451c,'rows':_0x358bc3}:null;}})[_0x2097('0x2c')](respondWithResult(_0x5d181f,null))[_0x2097('0x4b')](handleError(_0x5d181f,null));};exports[_0x2097('0x7e')]=function(_0x498a91,_0x3a7959,_0x35570d){var _0x86f89={};var _0x26a3e5={};var _0x25bb03;var _0x429c9e;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x498a91[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x3a7959,null))[_0x2097('0x2c')](function(_0x299a3e){if(_0x299a3e){_0x25bb03=_0x299a3e;_0x26a3e5[_0x2097('0x3c')]=_['keys'](db['Team'][_0x2097('0x35')]);_0x26a3e5['query']=_['keys'](_0x498a91[_0x2097('0x39')]);_0x26a3e5[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x26a3e5[_0x2097('0x3c')],_0x26a3e5[_0x2097('0x39')]);_0x86f89['attributes']=_['intersection'](_0x26a3e5[_0x2097('0x3c')],qs['fields'](_0x498a91[_0x2097('0x39')]['fields']));_0x86f89['attributes']=_0x86f89['attributes']['length']?_0x86f89['attributes']:_0x26a3e5[_0x2097('0x3c')];_0x86f89[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x498a91[_0x2097('0x39')][_0x2097('0x42')]);_0x86f89[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x498a91[_0x2097('0x39')],_0x26a3e5[_0x2097('0x3a')]));if(_0x498a91[_0x2097('0x39')][_0x2097('0x45')]){_0x86f89[_0x2097('0x43')]=_[_0x2097('0x46')](_0x86f89[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x86f89[_0x2097('0x3e')],function(_0x5e49bc){var _0x1e30c5={};_0x1e30c5[_0x5e49bc]={'$like':'%'+_0x498a91[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x1e30c5;})});}_0x86f89=_[_0x2097('0x46')]({},_0x86f89,_0x498a91[_0x2097('0x48')]);return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x1c5ec7){if(_0x1c5ec7){_0x429c9e=_0x1c5ec7[_0x2097('0x6e')];if(!_0x498a91[_0x2097('0x39')][_0x2097('0x3f')]('nolimit')){_0x86f89[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x498a91[_0x2097('0x39')][_0x2097('0x25')]);_0x86f89[_0x2097('0x23')]=qs[_0x2097('0x23')](_0x498a91['query']['offset']);}return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x2beb7a){if(_0x2beb7a){return _0x2beb7a?{'count':_0x429c9e,'rows':_0x2beb7a}:null;}})['then'](respondWithResult(_0x3a7959,null))[_0x2097('0x4b')](handleError(_0x3a7959,null));};exports[_0x2097('0x7f')]=function(_0x4eeac1,_0x459585,_0x436533){var _0x16405f=_0x4eeac1[_0x2097('0x53')][_0x2097('0x74')];var _0x41f718;return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x16405f},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id',_0x2097('0x30'),_0x2097('0x83'),_0x2097('0x84'),_0x2097('0x85')],'raw':!![]}]})[_0x2097('0x2c')](function(_0x44661a){if(_0x44661a){_0x41f718=_0x44661a;var _0x39e21f=_['flatMap'](_0x44661a,function(_0x2d211b){var _0x1ab39a=_0x2d211b[_0x2097('0x65')]({'plain':!![]});return _0x1ab39a[_0x2097('0x82')];});return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x4eeac1[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](function(_0xecd4fc){return db[_0x2097('0x51')]['transaction'](function(_0x2fb539){return _0xecd4fc[_0x2097('0x7f')](_0x16405f,{'transaction':_0x2fb539})[_0x2097('0x2c')](function(){return BPromise[_0x2097('0x86')](_0x41f718,function(_0x17c494){return db[_0x2097('0x87')][_0x2097('0x88')]({'TeamId':_0x17c494['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},{'transaction':_0x2fb539});});})['then'](function(){return BPromise[_0x2097('0x86')](_0x39e21f,function(_0x239570){return db[_0x2097('0x89')][_0x2097('0x8a')]({'where':{'UserId':_0x239570['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},'transaction':_0x2fb539});});})[_0x2097('0x2c')](function(){_0x39e21f[_0x2097('0x8b')](function(_0x51bb2f){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':_0x51bb2f['id'],'VoicePrefixId':_0xecd4fc['id']});});});});});}})['then'](respondWithStatusCode(_0x459585,null))[_0x2097('0x4b')](handleError(_0x459585,null));};exports[_0x2097('0x8c')]=function(_0x568de5,_0x473a54,_0x53a5ed){return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x568de5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id'],'raw':!![]}]})[_0x2097('0x2c')](handleEntityNotFound(_0x473a54,null))[_0x2097('0x2c')](function(_0x1909d8){var _0x2de4=_[_0x2097('0x33')](_0x1909d8,'id');var _0x43a1f8=[];var _0xb53629=[];var _0x516ed6=squel[_0x2097('0x8d')]();_0x516ed6[_0x2097('0x8e')]('tq.TeamId')['from'](_0x2097('0x8f'),'tq')[_0x2097('0x90')](_0x2097('0x91'),'ut',_0x2097('0x92'))[_0x2097('0x43')](_0x2097('0x93'),_0x568de5[_0x2097('0x4c')]['id']);for(var _0x5626f0=0x0;_0x5626f0<_0x1909d8[_0x2097('0x6e')];_0x5626f0+=0x1){let _0x45bbca=_0x1909d8[_0x5626f0];for(var _0x46fc92=0x0;_0x46fc92<_0x45bbca[_0x2097('0x82')][_0x2097('0x6e')];_0x46fc92+=0x1){let _0x357a5b=_0x45bbca[_0x2097('0x82')][_0x46fc92];var _0x3fcedc=_0x516ed6[_0x2097('0x94')]();_0x3fcedc[_0x2097('0x43')](_0x2097('0x95'),_0x357a5b['id']);_0xb53629['push'](db[_0x2097('0x51')][_0x2097('0x39')](_0x3fcedc['toString'](),{'type':db[_0x2097('0x51')][_0x2097('0x96')]['SELECT']})[_0x2097('0x2c')](function(_0xbe052f){if(_0xbe052f['length']===0x1){return _0x357a5b['id'];}else{var _0x32c5f1=_[_0x2097('0x97')](_[_0x2097('0x33')](_0xbe052f,_0x2097('0x98')),function(_0x456633){return _[_0x2097('0x99')](_0x2de4,_0x456633);});if(_0x32c5f1){return _0x357a5b['id'];}}}));}}return BPromise[_0x2097('0x9a')](_0xb53629)[_0x2097('0x2c')](function(_0x124d8f){_0x43a1f8=_(_0x43a1f8)[_0x2097('0x9b')](_0x124d8f)['compact']()[_0x2097('0x9c')]();return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x568de5[_0x2097('0x4c')]['id']}})['then'](function(_0x1b555e){return db['sequelize'][_0x2097('0x52')](function(_0x1ab515){return _0x1b555e[_0x2097('0x8c')](_0x568de5[_0x2097('0x39')][_0x2097('0x74')],{'transaction':_0x1ab515})[_0x2097('0x2c')](function(){if(!_[_0x2097('0x9d')](_0x43a1f8)){return _0x1b555e[_0x2097('0x78')](_0x43a1f8,{'transaction':_0x1ab515});}})[_0x2097('0x2c')](function(){_0x43a1f8['forEach'](function(_0x22fa5d){socket['emit']('userVoicePrefix:remove',{'UserId':_0x22fa5d,'VoicePrefixId':_0x1b555e['id']});});});});});});})['then'](respondWithStatusCode(_0x473a54,null))['catch'](handleError(_0x473a54,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f3561cc..5c6ff41 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 _0x2fca=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','VoicePrefix'];(function(_0x3bbc8e,_0x177f47){var _0x15e0c2=function(_0xf38d3e){while(--_0xf38d3e){_0x3bbc8e['push'](_0x3bbc8e['shift']());}};_0x15e0c2(++_0x177f47);}(_0x2fca,0x1d4));var _0xa2fc=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2fca[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0xa2fc('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xa2fc('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xa2fc('0x2')](0x0);var events={'afterCreate':_0xa2fc('0x3'),'afterUpdate':_0xa2fc('0x4'),'afterDestroy':_0xa2fc('0x5')};function emitEvent(_0x2b3aba){return function(_0x223107,_0x101134,_0x1d2a88){VoicePrefixEvents[_0xa2fc('0x6')](_0x2b3aba+':'+_0x223107['id'],_0x223107);VoicePrefixEvents['emit'](_0x2b3aba,_0x223107);_0x1d2a88(null);};}for(var e in events){if(events[_0xa2fc('0x7')](e)){var event=events[e];VoicePrefix[_0xa2fc('0x8')](e,emitEvent(event));}}module[_0xa2fc('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x20ae=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove'];(function(_0x3bc304,_0x1dd725){var _0x29124e=function(_0x568862){while(--_0x568862){_0x3bc304['push'](_0x3bc304['shift']());}};_0x29124e(++_0x1dd725);}(_0x20ae,0x147));var _0xe20a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x20ae[_0x2064e5];return _0x21a233;};'use strict';var EventEmitter=require(_0xe20a('0x0'));var VoicePrefix=require(_0xe20a('0x1'))['db'][_0xe20a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe20a('0x3')](0x0);var events={'afterCreate':_0xe20a('0x4'),'afterUpdate':'update','afterDestroy':_0xe20a('0x5')};function emitEvent(_0x5c895c){return function(_0x14c0d7,_0x31950d,_0x46529a){VoicePrefixEvents['emit'](_0x5c895c+':'+_0x14c0d7['id'],_0x14c0d7);VoicePrefixEvents[_0xe20a('0x6')](_0x5c895c,_0x14c0d7);_0x46529a(null);};}for(var e in events){if(events[_0xe20a('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xe20a('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 887c363..ac6cc2b 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 _0x47ad=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0x47ad,0x15b));var _0xd47a=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x47ad[_0x4b7e4d];return _0x38d6af;};'use strict';var _=require(_0xd47a('0x0'));var util=require(_0xd47a('0x1'));var logger=require(_0xd47a('0x2'))(_0xd47a('0x3'));var moment=require(_0xd47a('0x4'));var BPromise=require(_0xd47a('0x5'));var rp=require(_0xd47a('0x6'));var fs=require('fs');var path=require(_0xd47a('0x7'));var rimraf=require(_0xd47a('0x8'));var config=require(_0xd47a('0x9'));var attributes=require(_0xd47a('0xa'));module['exports']=function(_0x5256d4,_0x1f4d56){return _0x5256d4[_0xd47a('0xb')]('VoicePrefix',attributes,{'tableName':_0xd47a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0e7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','voice_prefixes','../../config/logger','moment'];(function(_0x10e4de,_0x4dbd0e){var _0xc5ba2f=function(_0x5a2a99){while(--_0x5a2a99){_0x10e4de['push'](_0x10e4de['shift']());}};_0xc5ba2f(++_0x4dbd0e);}(_0xf0e7,0x10c));var _0x7f0e=function(_0x23b57c,_0xdc7f98){_0x23b57c=_0x23b57c-0x0;var _0x4c3b1d=_0xf0e7[_0x23b57c];return _0x4c3b1d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f0e('0x0'))('api');var moment=require(_0x7f0e('0x1'));var BPromise=require(_0x7f0e('0x2'));var rp=require(_0x7f0e('0x3'));var fs=require('fs');var path=require(_0x7f0e('0x4'));var rimraf=require(_0x7f0e('0x5'));var config=require(_0x7f0e('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x7f0e('0x7')]=function(_0x48bb31,_0x4779ad){return _0x48bb31[_0x7f0e('0x8')]('VoicePrefix',attributes,{'tableName':_0x7f0e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 0188c92..4a3de58 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 _0xee87=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xee87,0x10d));var _0x7ee8=function(_0x40be25,_0x1df1c1){_0x40be25=_0x40be25-0x0;var _0x3adb82=_0xee87[_0x40be25];return _0x3adb82;};'use strict';var _=require('lodash');var util=require(_0x7ee8('0x0'));var moment=require(_0x7ee8('0x1'));var BPromise=require(_0x7ee8('0x2'));var rs=require(_0x7ee8('0x3'));var fs=require('fs');var Redis=require(_0x7ee8('0x4'));var db=require(_0x7ee8('0x5'))['db'];var utils=require(_0x7ee8('0x6'));var logger=require(_0x7ee8('0x7'))(_0x7ee8('0x8'));var config=require(_0x7ee8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ee8('0xa')]['http']({'port':0x232a});config[_0x7ee8('0xb')]=_[_0x7ee8('0xc')](config[_0x7ee8('0xb')],{'host':_0x7ee8('0xd'),'port':0x18eb});var socket=require(_0x7ee8('0xe'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x7ee8('0xf')](socket);function respondWithRpcPromise(_0x5f37d6,_0x511d54,_0x210095){return new BPromise(function(_0x21309c,_0x2edb4a){return client[_0x7ee8('0x10')](_0x5f37d6,_0x210095)[_0x7ee8('0x11')](function(_0x4dd890){logger['info'](_0x7ee8('0x12'),_0x511d54,_0x7ee8('0x13'));logger[_0x7ee8('0x14')](_0x7ee8('0x15'),_0x511d54,_0x7ee8('0x13'),JSON[_0x7ee8('0x16')](_0x4dd890));if(_0x4dd890[_0x7ee8('0x17')]){if(_0x4dd890[_0x7ee8('0x17')][_0x7ee8('0x18')]===0x1f4){logger[_0x7ee8('0x17')](_0x7ee8('0x12'),_0x511d54,_0x4dd890[_0x7ee8('0x17')][_0x7ee8('0x19')]);return _0x2edb4a(_0x4dd890[_0x7ee8('0x17')][_0x7ee8('0x19')]);}logger[_0x7ee8('0x17')](_0x7ee8('0x12'),_0x511d54,_0x4dd890[_0x7ee8('0x17')][_0x7ee8('0x19')]);return _0x21309c(_0x4dd890[_0x7ee8('0x17')][_0x7ee8('0x19')]);}else{logger[_0x7ee8('0x1a')](_0x7ee8('0x12'),_0x511d54,_0x7ee8('0x13'));_0x21309c(_0x4dd890[_0x7ee8('0x1b')]['message']);}})[_0x7ee8('0x1c')](function(_0x5e4ef1){logger[_0x7ee8('0x17')](_0x7ee8('0x12'),_0x511d54,_0x5e4ef1);_0x2edb4a(_0x5e4ef1);});});} \ No newline at end of file +var _0x2d72=['stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x54bd92,_0x13e8ae){var _0x331f7=function(_0x472679){while(--_0x472679){_0x54bd92['push'](_0x54bd92['shift']());}};_0x331f7(++_0x13e8ae);}(_0x2d72,0xa8));var _0x22d7=function(_0xe30f7c,_0x359ffd){_0xe30f7c=_0xe30f7c-0x0;var _0x142b6a=_0x2d72[_0xe30f7c];return _0x142b6a;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var moment=require(_0x22d7('0x2'));var BPromise=require(_0x22d7('0x3'));var rs=require(_0x22d7('0x4'));var fs=require('fs');var Redis=require(_0x22d7('0x5'));var db=require(_0x22d7('0x6'))['db'];var utils=require(_0x22d7('0x7'));var logger=require(_0x22d7('0x8'))(_0x22d7('0x9'));var config=require(_0x22d7('0xa'));var jayson=require(_0x22d7('0xb'));var client=jayson[_0x22d7('0xc')][_0x22d7('0xd')]({'port':0x232a});config['redis']=_[_0x22d7('0xe')](config[_0x22d7('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x22d7('0x10'))(new Redis(config[_0x22d7('0xf')]));require(_0x22d7('0x11'))[_0x22d7('0x12')](socket);function respondWithRpcPromise(_0x49f7e1,_0x5f56eb,_0x1810b8){return new BPromise(function(_0x257c85,_0x233c0b){return client[_0x22d7('0x13')](_0x49f7e1,_0x1810b8)[_0x22d7('0x14')](function(_0x4db5dd){logger['info'](_0x22d7('0x15'),_0x5f56eb,'request\x20sent');logger[_0x22d7('0x16')](_0x22d7('0x17'),_0x5f56eb,'request\x20sent',JSON[_0x22d7('0x18')](_0x4db5dd));if(_0x4db5dd[_0x22d7('0x19')]){if(_0x4db5dd[_0x22d7('0x19')][_0x22d7('0x1a')]===0x1f4){logger[_0x22d7('0x19')](_0x22d7('0x15'),_0x5f56eb,_0x4db5dd[_0x22d7('0x19')][_0x22d7('0x1b')]);return _0x233c0b(_0x4db5dd['error'][_0x22d7('0x1b')]);}logger[_0x22d7('0x19')](_0x22d7('0x15'),_0x5f56eb,_0x4db5dd['error']['message']);return _0x257c85(_0x4db5dd['error'][_0x22d7('0x1b')]);}else{logger[_0x22d7('0x1c')](_0x22d7('0x15'),_0x5f56eb,_0x22d7('0x1d'));_0x257c85(_0x4db5dd[_0x22d7('0x1e')]['message']);}})[_0x22d7('0x1f')](function(_0x75affd){logger[_0x22d7('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x5f56eb,_0x75affd);_0x233c0b(_0x75affd);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4330e0e..613b025 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 _0x94dc=['register','voicePrefix:','./voicePrefix.events','remove','removeListener'];(function(_0x571e16,_0x4c28bc){var _0x3cb735=function(_0x7cbfd5){while(--_0x7cbfd5){_0x571e16['push'](_0x571e16['shift']());}};_0x3cb735(++_0x4c28bc);}(_0x94dc,0xb1));var _0xc94d=function(_0xd6ce87,_0x4f0cda){_0xd6ce87=_0xd6ce87-0x0;var _0x4aed07=_0x94dc[_0xd6ce87];return _0x4aed07;};'use strict';var VoicePrefixEvents=require(_0xc94d('0x0'));var events=['save',_0xc94d('0x1'),'update'];function createListener(_0x1645b0,_0x1b2070){return function(_0x40e7d8){_0x1b2070['emit'](_0x1645b0,_0x40e7d8);};}function removeListener(_0x306706,_0x41d4ec){return function(){VoicePrefixEvents[_0xc94d('0x2')](_0x306706,_0x41d4ec);};}exports[_0xc94d('0x3')]=function(_0x3c0601){for(var _0x344188=0x0,_0xb7275c=events['length'];_0x344188<_0xb7275c;_0x344188++){var _0x2f9757=events[_0x344188];var _0xbe5904=createListener(_0xc94d('0x4')+_0x2f9757,_0x3c0601);VoicePrefixEvents['on'](_0x2f9757,_0xbe5904);}}; \ No newline at end of file +var _0x2e31=['./voicePrefix.events','save','remove','removeListener','voicePrefix:'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x2e31,0x145));var _0x12e3=function(_0x50bde3,_0x22d043){_0x50bde3=_0x50bde3-0x0;var _0x2ec486=_0x2e31[_0x50bde3];return _0x2ec486;};'use strict';var VoicePrefixEvents=require(_0x12e3('0x0'));var events=[_0x12e3('0x1'),_0x12e3('0x2'),'update'];function createListener(_0x152c5f,_0x217ada){return function(_0x503380){_0x217ada['emit'](_0x152c5f,_0x503380);};}function removeListener(_0x146b6b,_0x3d2ac0){return function(){VoicePrefixEvents[_0x12e3('0x3')](_0x146b6b,_0x3d2ac0);};}exports['register']=function(_0x3173f9){for(var _0x16ed6b=0x0,_0x5aefcf=events['length'];_0x16ed6b<_0x5aefcf;_0x16ed6b++){var _0x37f287=events[_0x16ed6b];var _0x403cc5=createListener(_0x12e3('0x4')+_0x37f287,_0x3173f9);VoicePrefixEvents['on'](_0x37f287,_0x403cc5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 32e9bd9..583768a 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x16e5d1,_0x9cf085){var _0x3f72e6=function(_0x26c06a){while(--_0x26c06a){_0x16e5d1['push'](_0x16e5d1['shift']());}};_0x3f72e6(++_0x9cf085);}(_0xb10b,0x12a));var _0xbb10=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0xb10b[_0x408de5];return _0x2015a1;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xb10b[_0x1602ef];return _0x5870ee;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index a91e3ce..c94ea4c 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 _0x166e=['all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','agentBusyFactor','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','inbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','getDataValue','type','dialMethod','strategy','outbound','preview','booked','roundrobin','INTEGER','yes'];(function(_0x4fda88,_0x1a4d19){var _0xe37511=function(_0x51f461){while(--_0x51f461){_0x4fda88['push'](_0x4fda88['shift']());}};_0xe37511(++_0x1a4d19);}(_0x166e,0x7e));var _0xe166=function(_0x1ccf17,_0x1ce7f9){_0x1ccf17=_0x1ccf17-0x0;var _0x4d939b=_0x166e[_0x1ccf17];return _0x4d939b;};'use strict';var Sequelize=require(_0xe166('0x0'));module['exports']={'name':{'type':Sequelize[_0xe166('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x3'),'outbound'),'allowNull':![],'defaultValue':_0xe166('0x3')},'musiconhold':{'type':Sequelize[_0xe166('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xe166('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xe166('0x2')]('rr',_0xe166('0x4'),_0xe166('0x5'),_0xe166('0x6'),_0xe166('0x7'),_0xe166('0x8'),_0xe166('0x9'),_0xe166('0xa'),'rrordered'),'allowNull':![],'defaultValue':_0xe166('0x4'),'set':function(_0x9ca11){this[_0xe166('0xb')]('strategy',_0x9ca11?_0x9ca11:'rrmemory');},'get':function(){var _0x513980=this[_0xe166('0xc')](_0xe166('0xd'));var _0x57b8a7=this[_0xe166('0xc')](_0xe166('0xe'));var _0x1d78ee=this[_0xe166('0xc')](_0xe166('0xf'));if(_0x513980===_0xe166('0x10')){if(_0x57b8a7===_0xe166('0x11')){return null;}if(_0x57b8a7===_0xe166('0x12')&&!['rrmemory',_0xe166('0x13')]['includes'](_0x1d78ee)){this[_0xe166('0xb')](_0xe166('0xf'),_0xe166('0x8'));}}return _0x1d78ee;}},'servicelevel':{'type':Sequelize[_0xe166('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe166('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe166('0x14')](0xb)},'timeout':{'type':Sequelize[_0xe166('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe166('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe166('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe166('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x15'),'no'),'defaultValue':_0xe166('0x15')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0xe166('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xe166('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe166('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xe166('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xe166('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe166('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe166('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe166('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe166('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe166('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x15'),'no'),'defaultValue':_0xe166('0x15')},'announce_holdtime':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x15'),'no',_0xe166('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xe166('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe166('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe166('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xe166('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe166('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe166('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe166('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xe166('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe166('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe166('0x1')]},'queue_quantity1':{'type':Sequelize[_0xe166('0x1')]},'queue_quantity2':{'type':Sequelize[_0xe166('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xe166('0x1')]},'queue_less_than':{'type':Sequelize[_0xe166('0x1')]},'periodic_announce':{'type':Sequelize[_0xe166('0x18')],'set':function(_0x2bfa50){this[_0xe166('0xb')](_0xe166('0x19'),_0x2bfa50?_0x2bfa50[_0xe166('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xe166('0x19'))?this[_0xe166('0xc')](_0xe166('0x19'))[_0xe166('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xe166('0x1')],'defaultValue':_0xe166('0x15'),'set':function(_0x336111){this[_0xe166('0xb')](_0xe166('0x1c'),_0x336111?_0x336111[_0xe166('0x1a')](','):undefined);},'get':function(){return this[_0xe166('0xc')](_0xe166('0x1c'))?this[_0xe166('0xc')](_0xe166('0x1c'))[_0xe166('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x4526cd){this['setDataValue'](_0xe166('0x1d'),_0x4526cd?_0x4526cd[_0xe166('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xe166('0x1d'))?this['getDataValue']('leavewhenempty')[_0xe166('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xe166('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe166('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe166('0x2')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe166('0x1')]},'description':{'type':Sequelize[_0xe166('0x1')]},'acw':{'type':Sequelize[_0xe166('0x1e')],'defaultValue':0x0,'set':function(_0x200f4c){this['setDataValue']('acw',_0x200f4c);if(_0x200f4c){if(this[_0xe166('0xc')]('wrapuptime')<0x2){this[_0xe166('0xb')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe166('0x1e')],'defaultValue':0x0,'comment':_0xe166('0x1f')},'dialMethod':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x11'),_0xe166('0x20'),_0xe166('0x21'),_0xe166('0x22'),_0xe166('0x12')),'defaultValue':'progressive','comment':_0xe166('0x23')},'dialLimitChannel':{'type':Sequelize[_0xe166('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe166('0x24')},'dialLimitQueue':{'type':Sequelize[_0xe166('0x14')](0x4)[_0xe166('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xe166('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xe166('0x2')](_0xe166('0x26'),_0xe166('0x27')),'defaultValue':_0xe166('0x27'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe166('0x28')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe166('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xe166('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe166('0x29')},'dialQueueOptions':{'type':Sequelize[_0xe166('0x1')],'defaultValue':'tTxX','comment':_0xe166('0x2a')},'dialQueueTimeout':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xe166('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe166('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe166('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe166('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe166('0x2e')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe166('0x14')](0x5)[_0xe166('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0x3,'comment':_0xe166('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe166('0x14')](0x5)[_0xe166('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe166('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe166('0x14')](0x3)['UNSIGNED'],'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[_0xe166('0x1')],'defaultValue':_0xe166('0x31')},'dialPrefix':{'type':Sequelize[_0xe166('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe166('0x2')]('always',_0xe166('0x32'),'onlyIfOpen'),'defaultValue':_0xe166('0x33')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe166('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0xe166('0x14')](0x9)[_0xe166('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xe166('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe166('0x14')](0x9)[_0xe166('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe166('0x35')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe166('0x14')](0x9)[_0xe166('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe166('0x36')},'dialAMDMinWordLength':{'type':Sequelize[_0xe166('0x14')](0x9)[_0xe166('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe166('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe166('0x37')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe166('0x14')](0x9)[_0xe166('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe166('0x38')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe166('0x14')](0x5)[_0xe166('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xe166('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe166('0x39')},'dialRecallMeTimeout':{'type':Sequelize[_0xe166('0x14')](0x5)[_0xe166('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe166('0x3a')},'dialRecallInQueue':{'type':Sequelize[_0xe166('0x1e')],'defaultValue':0x0,'comment':_0xe166('0x3b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe166('0x2')]('DESC','ASC'),'defaultValue':_0xe166('0x3c')},'dialQueueProject2':{'type':Sequelize[_0xe166('0x1')],'comment':_0xe166('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe166('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe166('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe166('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe166('0x3d')},'dialCutDigit':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe166('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe166('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe166('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe166('0x14')](0x5)[_0xe166('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe166('0x40')},'dialDropMaxRetry':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe166('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0xe166('0x14')](0x5)[_0xe166('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe166('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe166('0x14')](0x5)[_0xe166('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe166('0x43')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe166('0x14')](0x5)[_0xe166('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe166('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe166('0x44')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe166('0x14')](0x5)[_0xe166('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe166('0x45')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe166('0x14')],'allowNull':!![],'comment':_0xe166('0x46')},'mandatoryDisposition':{'type':Sequelize[_0xe166('0x1e')],'defaultValue':![],'comment':_0xe166('0x47'),'set':function(_0x32e7b3){if(!_0x32e7b3)this[_0xe166('0xb')](_0xe166('0x48'),null);this[_0xe166('0xb')](_0xe166('0x49'),_0x32e7b3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xe166('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xe166('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe166('0x14')](0x3)[_0xe166('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe67b=['ENUM','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','dialMethod','strategy','preview','booked','roundrobin','INTEGER','all','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name'];(function(_0x5a19fc,_0x58f9f4){var _0x34b413=function(_0x344feb){while(--_0x344feb){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x34b413(++_0x58f9f4);}(_0xe67b,0x1e2));var _0xbe67=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0xe67b[_0x5ce8b9];return _0xe34be0;};'use strict';var Sequelize=require(_0xbe67('0x0'));module[_0xbe67('0x1')]={'name':{'type':Sequelize[_0xbe67('0x2')],'allowNull':![],'unique':_0xbe67('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbe67('0x4')]('inbound',_0xbe67('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':_0xbe67('0x6')},'announce':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xbe67('0x7'),_0xbe67('0x8'),_0xbe67('0x9'),'random',_0xbe67('0xa'),_0xbe67('0xb'),_0xbe67('0xc'),_0xbe67('0xd')),'allowNull':![],'defaultValue':_0xbe67('0x7'),'set':function(_0x2f4786){this[_0xbe67('0xe')]('strategy',_0x2f4786?_0x2f4786:_0xbe67('0xa'));},'get':function(){var _0x12dec1=this['getDataValue']('type');var _0x1ba7d2=this[_0xbe67('0xf')](_0xbe67('0x10'));var _0x1d642a=this[_0xbe67('0xf')](_0xbe67('0x11'));if(_0x12dec1===_0xbe67('0x5')){if(_0x1ba7d2===_0xbe67('0x12')){return null;}if(_0x1ba7d2===_0xbe67('0x13')&&![_0xbe67('0xa'),_0xbe67('0x14')]['includes'](_0x1d642a)){this[_0xbe67('0xe')](_0xbe67('0x11'),'rrmemory');}}return _0x1d642a;}},'servicelevel':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbe67('0x15')](0xb)},'timeout':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xbe67('0x2')]},'weight':{'type':Sequelize[_0xbe67('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbe67('0x4')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no',_0xbe67('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbe67('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xbe67('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xbe67('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbe67('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xbe67('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbe67('0x4')]('yes','no'),'defaultValue':_0xbe67('0x17')},'announce_holdtime':{'type':Sequelize[_0xbe67('0x4')]('yes','no',_0xbe67('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbe67('0x2')]},'queue_youarenext':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbe67('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xbe67('0x2')]},'queue_quantity2':{'type':Sequelize[_0xbe67('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xbe67('0x2')]},'periodic_announce':{'type':Sequelize[_0xbe67('0x19')],'set':function(_0xfd2078){this[_0xbe67('0xe')](_0xbe67('0x1a'),_0xfd2078?_0xfd2078[_0xbe67('0x1b')](','):[]);},'get':function(){return this[_0xbe67('0xf')]('periodic_announce')?this[_0xbe67('0xf')](_0xbe67('0x1a'))[_0xbe67('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xbe67('0x17'),'set':function(_0x163309){this[_0xbe67('0xe')](_0xbe67('0x1d'),_0x163309?_0x163309[_0xbe67('0x1b')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue'](_0xbe67('0x1d'))[_0xbe67('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':'no','set':function(_0x109293){this['setDataValue'](_0xbe67('0x1e'),_0x109293?_0x109293[_0xbe67('0x1b')](','):undefined);},'get':function(){return this[_0xbe67('0xf')](_0xbe67('0x1e'))?this['getDataValue'](_0xbe67('0x1e'))[_0xbe67('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbe67('0x2')]},'description':{'type':Sequelize[_0xbe67('0x2')]},'acw':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':0x0,'set':function(_0x8f5f14){this['setDataValue'](_0xbe67('0x20'),_0x8f5f14);if(_0x8f5f14){if(this[_0xbe67('0xf')]('wrapuptime')<0x2){this[_0xbe67('0xe')](_0xbe67('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':0x0,'comment':_0xbe67('0x22')},'dialMethod':{'type':Sequelize[_0xbe67('0x4')]('preview',_0xbe67('0x23'),_0xbe67('0x24'),_0xbe67('0x25'),_0xbe67('0x13')),'defaultValue':'progressive','comment':_0xbe67('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xbe67('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbe67('0x28')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xbe67('0x29')](0x2)[_0xbe67('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbe67('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x2b'),_0xbe67('0x2c')),'defaultValue':_0xbe67('0x2c'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbe67('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xbe67('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbe67('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbe67('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xbe67('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x31')},'dialQueueProject':{'type':Sequelize[_0xbe67('0x2')],'comment':_0xbe67('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xbe67('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x37')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbe67('0x38')},'dialPrefix':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbe67('0x4')]('always','never',_0xbe67('0x39')),'defaultValue':_0xbe67('0x3a')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xbe67('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xbe67('0x15')](0x9)[_0xbe67('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbe67('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xbe67('0x15')](0x9)[_0xbe67('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbe67('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbe67('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xbe67('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbe67('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0xbe67('0x15')](0x9)[_0xbe67('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbe67('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xbe67('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbe67('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbe67('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbe67('0x15')](0x9)[_0xbe67('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbe67('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':0x0,'comment':_0xbe67('0x43')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xbe67('0x44')),'defaultValue':_0xbe67('0x45')},'dialQueueProject2':{'type':Sequelize[_0xbe67('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbe67('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbe67('0x46')},'dialCutDigit':{'type':Sequelize[_0xbe67('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbe67('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe67('0x15')],'allowNull':!![],'comment':_0xbe67('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':![],'comment':_0xbe67('0x4f'),'set':function(_0x295ee3){if(!_0x295ee3)this[_0xbe67('0xe')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xbe67('0x50'),_0x295ee3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xbe67('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f9eae65..04b8f3b 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 _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x2d1a9e,_0x4bc4a7){var _0x42d260=function(_0x2ee4c6){while(--_0x2ee4c6){_0x2d1a9e['push'](_0x2d1a9e['shift']());}};_0x42d260(++_0x4bc4a7);}(_0xa41a,0x6b));var _0xaa41=function(_0x15e00c,_0x48340c){_0x15e00c=_0x15e00c-0x0;var _0x5ce6b6=_0xa41a[_0x15e00c];return _0x5ce6b6;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file +var _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6aa7,0x178));var _0x76aa=function(_0x194cf3,_0x269bd6){_0x194cf3=_0x194cf3-0x0;var _0x37b8da=_0x6aa7[_0x194cf3];return _0x37b8da;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8bb9779..63052dd 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 _0x9530=['exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9530,0xa1));var _0x0953=function(_0x26f830,_0x48f9ca){_0x26f830=_0x26f830-0x0;var _0x50b0e5=_0x9530[_0x26f830];return _0x50b0e5;};'use strict';var EventEmitter=require(_0x0953('0x0'));var VoiceQueue=require(_0x0953('0x1'))['db'][_0x0953('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0953('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0953('0x4'),'afterDestroy':_0x0953('0x5')};function emitEvent(_0x37d93b){return function(_0x1ce3df,_0x37d468,_0x599f4a){VoiceQueueEvents['emit'](_0x37d93b+':'+_0x1ce3df['id'],_0x1ce3df);VoiceQueueEvents[_0x0953('0x6')](_0x37d93b,_0x1ce3df);_0x599f4a(null);};}for(var e in events){if(events[_0x0953('0x7')](e)){var event=events[e];VoiceQueue[_0x0953('0x8')](e,emitEvent(event));}}module[_0x0953('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x3071=['remove','emit','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x1787ce,_0x4cbc90){var _0x150c53=function(_0x7ffaaf){while(--_0x7ffaaf){_0x1787ce['push'](_0x1787ce['shift']());}};_0x150c53(++_0x4cbc90);}(_0x3071,0x10b));var _0x1307=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x3071[_0x1ee351];return _0x245aaf;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x1307('0x0'))['db'][_0x1307('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x1307('0x2')](0x0);var events={'afterCreate':_0x1307('0x3'),'afterUpdate':_0x1307('0x4'),'afterDestroy':_0x1307('0x5')};function emitEvent(_0x5d6b4b){return function(_0xb7ea51,_0x378de1,_0x481c3e){VoiceQueueEvents[_0x1307('0x6')](_0x5d6b4b+':'+_0xb7ea51['id'],_0xb7ea51);VoiceQueueEvents[_0x1307('0x6')](_0x5d6b4b,_0xb7ea51);_0x481c3e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x1307('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 7fd2868..4542f30 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 _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0x008c,0x188));var _0xc008=function(_0x1a61db,_0x3ad3af){_0x1a61db=_0x1a61db-0x0;var _0x5ac3bf=_0x008c[_0x1a61db];return _0x5ac3bf;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x22118c,_0x316449){var _0x1f7712=function(_0x1e237d){while(--_0x1e237d){_0x22118c['push'](_0x22118c['shift']());}};_0x1f7712(++_0x316449);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ee07632..358fb4f 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 _0x2827=['find','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','where','include','map','attributes','model','debug','stringify','ShowVoiceQueue'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x2827,0x7a));var _0x7282=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2827[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7282('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7282('0x1'));var rs=require(_0x7282('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7282('0x3'))['db'];var utils=require(_0x7282('0x4'));var logger=require(_0x7282('0x5'))(_0x7282('0x6'));var config=require(_0x7282('0x7'));var jayson=require(_0x7282('0x8'));var client=jayson[_0x7282('0x9')][_0x7282('0xa')]({'port':0x232a});config[_0x7282('0xb')]=_[_0x7282('0xc')](config[_0x7282('0xb')],{'host':_0x7282('0xd'),'port':0x18eb});var socket=require(_0x7282('0xe'))(new Redis(config[_0x7282('0xb')]));require(_0x7282('0xf'))[_0x7282('0x10')](socket);function respondWithRpcPromise(_0x12829a,_0x26786d,_0x3b1d3b){return new BPromise(function(_0x12cdf6,_0x88d5bf){return client[_0x7282('0x11')](_0x12829a,_0x3b1d3b)[_0x7282('0x12')](function(_0x3eda53){logger[_0x7282('0x13')](_0x7282('0x14'),_0x26786d,_0x7282('0x15'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x26786d,'request\x20sent',JSON['stringify'](_0x3eda53));if(_0x3eda53[_0x7282('0x16')]){if(_0x3eda53[_0x7282('0x16')][_0x7282('0x17')]===0x1f4){logger[_0x7282('0x16')](_0x7282('0x14'),_0x26786d,_0x3eda53['error'][_0x7282('0x18')]);return _0x88d5bf(_0x3eda53['error'][_0x7282('0x18')]);}logger[_0x7282('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x26786d,_0x3eda53[_0x7282('0x16')][_0x7282('0x18')]);return _0x12cdf6(_0x3eda53['error']['message']);}else{logger[_0x7282('0x13')](_0x7282('0x14'),_0x26786d,_0x7282('0x15'));_0x12cdf6(_0x3eda53[_0x7282('0x19')][_0x7282('0x18')]);}})[_0x7282('0x1a')](function(_0x1ae5b2){logger[_0x7282('0x16')](_0x7282('0x14'),_0x26786d,_0x1ae5b2);_0x88d5bf(_0x1ae5b2);});});}exports[_0x7282('0x1b')]=function(_0x28975a){var _0x100933=this;return new Promise(function(_0x487a3a,_0x9a75f0){return db[_0x7282('0x1c')]['findAll']({'raw':_0x28975a[_0x7282('0x1d')]?_0x28975a[_0x7282('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x28975a[_0x7282('0x1d')]?_0x28975a[_0x7282('0x1d')][_0x7282('0x1e')]||null:null,'attributes':_0x28975a[_0x7282('0x1d')]?_0x28975a[_0x7282('0x1d')]['attributes']||null:null,'limit':_0x28975a[_0x7282('0x1d')]?_0x28975a['options']['limit']||null:null,'include':_0x28975a[_0x7282('0x1d')]?_0x28975a[_0x7282('0x1d')][_0x7282('0x1f')]?_[_0x7282('0x20')](_0x28975a[_0x7282('0x1d')][_0x7282('0x1f')],function(_0x45a235){return{'model':db[_0x45a235['model']],'as':_0x45a235['as'],'attributes':_0x45a235[_0x7282('0x21')],'include':_0x45a235['include']?_[_0x7282('0x20')](_0x45a235['include'],function(_0x31d5b8){return{'model':db[_0x31d5b8[_0x7282('0x22')]],'as':_0x31d5b8['as'],'attributes':_0x31d5b8[_0x7282('0x21')],'include':_0x31d5b8[_0x7282('0x1f')]?_[_0x7282('0x20')](_0x31d5b8['include'],function(_0x4ef9a2){return{'model':db[_0x4ef9a2[_0x7282('0x22')]],'as':_0x4ef9a2['as'],'attributes':_0x4ef9a2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c617b){logger['info'](_0x7282('0x1b'),_0x28975a);logger[_0x7282('0x23')](_0x7282('0x1b'),_0x28975a,JSON[_0x7282('0x24')](_0x2c617b));_0x487a3a(_0x2c617b);})[_0x7282('0x1a')](function(_0x3e7832){logger[_0x7282('0x16')](_0x7282('0x1b'),_0x3e7832['message'],_0x28975a);_0x9a75f0(_0x100933[_0x7282('0x16')](0x1f4,_0x3e7832[_0x7282('0x18')]));});});};exports[_0x7282('0x25')]=function(_0x44a4d2){var _0x1c5b21=this;return new Promise(function(_0x2ea555,_0x5b576b){return db[_0x7282('0x1c')][_0x7282('0x26')]({'raw':_0x44a4d2['options']?_0x44a4d2[_0x7282('0x1d')][_0x7282('0x27')]===undefined?!![]:![]:!![],'where':_0x44a4d2['options']?_0x44a4d2[_0x7282('0x1d')][_0x7282('0x1e')]||null:null,'attributes':_0x44a4d2[_0x7282('0x1d')]?_0x44a4d2[_0x7282('0x1d')]['attributes']||null:null,'include':_0x44a4d2[_0x7282('0x1d')]?_0x44a4d2[_0x7282('0x1d')]['include']?_['map'](_0x44a4d2[_0x7282('0x1d')][_0x7282('0x1f')],function(_0x218975){return{'model':db[_0x218975[_0x7282('0x22')]],'as':_0x218975['as'],'attributes':_0x218975[_0x7282('0x21')],'include':_0x218975[_0x7282('0x1f')]?_[_0x7282('0x20')](_0x218975['include'],function(_0x4ec7f3){return{'model':db[_0x4ec7f3['model']],'as':_0x4ec7f3['as'],'attributes':_0x4ec7f3[_0x7282('0x21')],'include':_0x4ec7f3[_0x7282('0x1f')]?_[_0x7282('0x20')](_0x4ec7f3[_0x7282('0x1f')],function(_0x30db8e){return{'model':db[_0x30db8e[_0x7282('0x22')]],'as':_0x30db8e['as'],'attributes':_0x30db8e[_0x7282('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e4227){logger[_0x7282('0x13')](_0x7282('0x25'),_0x44a4d2);logger[_0x7282('0x23')](_0x7282('0x25'),_0x44a4d2,JSON[_0x7282('0x24')](_0x5e4227));_0x2ea555(_0x5e4227);})[_0x7282('0x1a')](function(_0x58d5a6){logger[_0x7282('0x16')](_0x7282('0x25'),_0x58d5a6[_0x7282('0x18')],_0x44a4d2);_0x5b576b(_0x1c5b21[_0x7282('0x16')](0x1f4,_0x58d5a6[_0x7282('0x18')]));});});}; \ No newline at end of file +var _0xb886=['redis','defaults','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','include','map','model','attributes','then','ShowVoiceQueue','find','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x9be508,_0x10c8ba){var _0x16f3c3=function(_0x35c330){while(--_0x35c330){_0x9be508['push'](_0x9be508['shift']());}};_0x16f3c3(++_0x10c8ba);}(_0xb886,0x126));var _0x6b88=function(_0x1cd0a1,_0x3c3281){_0x1cd0a1=_0x1cd0a1-0x0;var _0x18c4ec=_0xb886[_0x1cd0a1];return _0x18c4ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6b88('0x0'));var BPromise=require('bluebird');var rs=require(_0x6b88('0x1'));var fs=require('fs');var Redis=require(_0x6b88('0x2'));var db=require(_0x6b88('0x3'))['db'];var utils=require(_0x6b88('0x4'));var logger=require(_0x6b88('0x5'))(_0x6b88('0x6'));var config=require(_0x6b88('0x7'));var jayson=require(_0x6b88('0x8'));var client=jayson['client'][_0x6b88('0x9')]({'port':0x232a});config[_0x6b88('0xa')]=_[_0x6b88('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b88('0xa')]));require('./voiceQueue.socket')[_0x6b88('0xc')](socket);function respondWithRpcPromise(_0x57e3ad,_0x239072,_0x4cebdf){return new BPromise(function(_0x9b5f8e,_0xb7547c){return client[_0x6b88('0xd')](_0x57e3ad,_0x4cebdf)['then'](function(_0x1e389d){logger[_0x6b88('0xe')](_0x6b88('0xf'),_0x239072,_0x6b88('0x10'));logger[_0x6b88('0x11')](_0x6b88('0x12'),_0x239072,_0x6b88('0x10'),JSON[_0x6b88('0x13')](_0x1e389d));if(_0x1e389d[_0x6b88('0x14')]){if(_0x1e389d['error'][_0x6b88('0x15')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x239072,_0x1e389d['error']['message']);return _0xb7547c(_0x1e389d[_0x6b88('0x14')][_0x6b88('0x16')]);}logger[_0x6b88('0x14')](_0x6b88('0xf'),_0x239072,_0x1e389d[_0x6b88('0x14')]['message']);return _0x9b5f8e(_0x1e389d['error']['message']);}else{logger['info'](_0x6b88('0xf'),_0x239072,_0x6b88('0x10'));_0x9b5f8e(_0x1e389d['result'][_0x6b88('0x16')]);}})[_0x6b88('0x17')](function(_0x4e0ce4){logger[_0x6b88('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x239072,_0x4e0ce4);_0xb7547c(_0x4e0ce4);});});}exports[_0x6b88('0x18')]=function(_0x5b46b3){var _0x595244=this;return new Promise(function(_0x42d7f0,_0x282e3e){return db[_0x6b88('0x19')][_0x6b88('0x1a')]({'raw':_0x5b46b3['options']?_0x5b46b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b46b3[_0x6b88('0x1b')]?_0x5b46b3['options'][_0x6b88('0x1c')]||null:null,'attributes':_0x5b46b3[_0x6b88('0x1b')]?_0x5b46b3[_0x6b88('0x1b')]['attributes']||null:null,'limit':_0x5b46b3[_0x6b88('0x1b')]?_0x5b46b3[_0x6b88('0x1b')][_0x6b88('0x1d')]||null:null,'include':_0x5b46b3[_0x6b88('0x1b')]?_0x5b46b3[_0x6b88('0x1b')][_0x6b88('0x1e')]?_[_0x6b88('0x1f')](_0x5b46b3['options'][_0x6b88('0x1e')],function(_0x21bd8f){return{'model':db[_0x21bd8f[_0x6b88('0x20')]],'as':_0x21bd8f['as'],'attributes':_0x21bd8f[_0x6b88('0x21')],'include':_0x21bd8f[_0x6b88('0x1e')]?_['map'](_0x21bd8f['include'],function(_0x212ebc){return{'model':db[_0x212ebc[_0x6b88('0x20')]],'as':_0x212ebc['as'],'attributes':_0x212ebc[_0x6b88('0x21')],'include':_0x212ebc[_0x6b88('0x1e')]?_[_0x6b88('0x1f')](_0x212ebc[_0x6b88('0x1e')],function(_0x35042f){return{'model':db[_0x35042f[_0x6b88('0x20')]],'as':_0x35042f['as'],'attributes':_0x35042f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b88('0x22')](function(_0x15c657){logger['info'](_0x6b88('0x18'),_0x5b46b3);logger['debug'](_0x6b88('0x18'),_0x5b46b3,JSON['stringify'](_0x15c657));_0x42d7f0(_0x15c657);})[_0x6b88('0x17')](function(_0x3fc7c5){logger[_0x6b88('0x14')](_0x6b88('0x18'),_0x3fc7c5['message'],_0x5b46b3);_0x282e3e(_0x595244['error'](0x1f4,_0x3fc7c5[_0x6b88('0x16')]));});});};exports[_0x6b88('0x23')]=function(_0xed206e){var _0x551d57=this;return new Promise(function(_0x1d3c79,_0x30ab7f){return db['VoiceQueue'][_0x6b88('0x24')]({'raw':_0xed206e[_0x6b88('0x1b')]?_0xed206e[_0x6b88('0x1b')][_0x6b88('0x25')]===undefined?!![]:![]:!![],'where':_0xed206e[_0x6b88('0x1b')]?_0xed206e[_0x6b88('0x1b')][_0x6b88('0x1c')]||null:null,'attributes':_0xed206e[_0x6b88('0x1b')]?_0xed206e[_0x6b88('0x1b')][_0x6b88('0x21')]||null:null,'include':_0xed206e[_0x6b88('0x1b')]?_0xed206e['options'][_0x6b88('0x1e')]?_[_0x6b88('0x1f')](_0xed206e[_0x6b88('0x1b')][_0x6b88('0x1e')],function(_0x446d32){return{'model':db[_0x446d32[_0x6b88('0x20')]],'as':_0x446d32['as'],'attributes':_0x446d32[_0x6b88('0x21')],'include':_0x446d32[_0x6b88('0x1e')]?_[_0x6b88('0x1f')](_0x446d32[_0x6b88('0x1e')],function(_0x1c693d){return{'model':db[_0x1c693d[_0x6b88('0x20')]],'as':_0x1c693d['as'],'attributes':_0x1c693d[_0x6b88('0x21')],'include':_0x1c693d['include']?_[_0x6b88('0x1f')](_0x1c693d['include'],function(_0x3f1171){return{'model':db[_0x3f1171['model']],'as':_0x3f1171['as'],'attributes':_0x3f1171[_0x6b88('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6b88('0x22')](function(_0x597ca6){logger[_0x6b88('0xe')](_0x6b88('0x23'),_0xed206e);logger['debug'](_0x6b88('0x23'),_0xed206e,JSON[_0x6b88('0x13')](_0x597ca6));_0x1d3c79(_0x597ca6);})[_0x6b88('0x17')](function(_0x5c6247){logger[_0x6b88('0x14')](_0x6b88('0x23'),_0x5c6247[_0x6b88('0x16')],_0xed206e);_0x30ab7f(_0x551d57[_0x6b88('0x14')](0x1f4,_0x5c6247['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d620f41..9b03c3b 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 _0xc734=['register','length','voiceQueue:','save','remove','update','emit','removeListener'];(function(_0x2e3e2a,_0x55a830){var _0x29feb4=function(_0x5c90b1){while(--_0x5c90b1){_0x2e3e2a['push'](_0x2e3e2a['shift']());}};_0x29feb4(++_0x55a830);}(_0xc734,0x73));var _0x4c73=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xc734[_0x2a56ad];return _0x425175;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x4c73('0x0'),_0x4c73('0x1'),_0x4c73('0x2')];function createListener(_0xd74c6e,_0x5d4ead){return function(_0x2fb07e){_0x5d4ead[_0x4c73('0x3')](_0xd74c6e,_0x2fb07e);};}function removeListener(_0x4ff92c,_0x227ca0){return function(){VoiceQueueEvents[_0x4c73('0x4')](_0x4ff92c,_0x227ca0);};}exports[_0x4c73('0x5')]=function(_0x3f478d){for(var _0x27cfc2=0x0,_0x212daa=events[_0x4c73('0x6')];_0x27cfc2<_0x212daa;_0x27cfc2++){var _0x45285f=events[_0x27cfc2];var _0x4d7681=createListener(_0x4c73('0x7')+_0x45285f,_0x3f478d);VoiceQueueEvents['on'](_0x45285f,_0x4d7681);}}; \ No newline at end of file +var _0x0d5b=['length','./voiceQueue.events','save','remove','update','removeListener','register'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0d5b,0x189));var _0xb0d5=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x0d5b[_0x24259d];return _0x5a701;};'use strict';var VoiceQueueEvents=require(_0xb0d5('0x0'));var events=[_0xb0d5('0x1'),_0xb0d5('0x2'),_0xb0d5('0x3')];function createListener(_0x3ffca6,_0x187b99){return function(_0x3d05bf){_0x187b99['emit'](_0x3ffca6,_0x3d05bf);};}function removeListener(_0x16acff,_0x389fef){return function(){VoiceQueueEvents[_0xb0d5('0x4')](_0x16acff,_0x389fef);};}exports[_0xb0d5('0x5')]=function(_0x3c2070){for(var _0x4a2858=0x0,_0x5e2a66=events[_0xb0d5('0x6')];_0x4a2858<_0x5e2a66;_0x4a2858++){var _0x5c3ed9=events[_0x4a2858];var _0xf15c08=createListener('voiceQueue:'+_0x5c3ed9,_0x3c2070);VoiceQueueEvents['on'](_0x5c3ed9,_0xf15c08);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 1522b28..b61d3c2 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 _0x650d=['/:id','post','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','/describe','getVoiceQueuesReport'];(function(_0x244e6b,_0xf444b4){var _0x7a0bd6=function(_0x24b66c){while(--_0x24b66c){_0x244e6b['push'](_0x244e6b['shift']());}};_0x7a0bd6(++_0xf444b4);}(_0x650d,0x1af));var _0xd650=function(_0x24c086,_0x58503a){_0x24c086=_0x24c086-0x0;var _0x437816=_0x650d[_0x24c086];return _0x437816;};'use strict';var multer=require(_0xd650('0x0'));var util=require('util');var path=require(_0xd650('0x1'));var timeout=require(_0xd650('0x2'));var express=require(_0xd650('0x3'));var router=express['Router']();var fs_extra=require(_0xd650('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd650('0x5'));var config=require('../../config/environment');var controller=require(_0xd650('0x6'));router[_0xd650('0x7')]('/',auth[_0xd650('0x8')](),controller['index']);router['get'](_0xd650('0x9'),auth[_0xd650('0x8')](),controller['describe']);router[_0xd650('0x7')]('/index',auth[_0xd650('0x8')](),controller[_0xd650('0xa')]);router[_0xd650('0x7')](_0xd650('0xb'),auth[_0xd650('0x8')](),controller['show']);router[_0xd650('0xc')]('/',auth[_0xd650('0x8')](),controller['create']);router[_0xd650('0xd')](_0xd650('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xd650('0xe')](_0xd650('0xb'),auth[_0xd650('0x8')](),controller[_0xd650('0xf')]);module[_0xd650('0x10')]=router; \ No newline at end of file +var _0x7d78=['connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','put','update','destroy','exports','multer','util','path'];(function(_0x226558,_0x434119){var _0x4d177b=function(_0x1f911f){while(--_0x1f911f){_0x226558['push'](_0x226558['shift']());}};_0x4d177b(++_0x434119);}(_0x7d78,0x129));var _0x87d7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7d78[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x87d7('0x0'));var util=require(_0x87d7('0x1'));var path=require(_0x87d7('0x2'));var timeout=require(_0x87d7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x87d7('0x4'));var interaction=require(_0x87d7('0x5'));var config=require('../../config/environment');var controller=require(_0x87d7('0x6'));router[_0x87d7('0x7')]('/',auth[_0x87d7('0x8')](),controller[_0x87d7('0x9')]);router['get'](_0x87d7('0xa'),auth[_0x87d7('0x8')](),controller[_0x87d7('0xb')]);router[_0x87d7('0x7')](_0x87d7('0xc'),auth[_0x87d7('0x8')](),controller['getVoiceQueuesReport']);router[_0x87d7('0x7')](_0x87d7('0xd'),auth['isAuthenticated'](),controller[_0x87d7('0xe')]);router[_0x87d7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x87d7('0x10')]('/:id',auth[_0x87d7('0x8')](),controller[_0x87d7('0x11')]);router['delete']('/:id',auth[_0x87d7('0x8')](),controller[_0x87d7('0x12')]);module[_0x87d7('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a19b7d7..c08a3ee 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 _0x548a=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER'];(function(_0x4aaa94,_0x3005e7){var _0x29aec2=function(_0x373437){while(--_0x373437){_0x4aaa94['push'](_0x4aaa94['shift']());}};_0x29aec2(++_0x3005e7);}(_0x548a,0xbe));var _0xa548=function(_0x43f235,_0x39b271){_0x43f235=_0x43f235-0x0;var _0x29cdda=_0x548a[_0x43f235];return _0x29cdda;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa548('0x0'));module[_0xa548('0x1')]={'type':{'type':Sequelize[_0xa548('0x2')]},'uniqueid':{'type':Sequelize[_0xa548('0x2')]},'calleridnum':{'type':Sequelize[_0xa548('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa548('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xa548('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x1a1f35){var _0x107d98=moment(_0x1a1f35);var _0x45a97d=moment(this[_0xa548('0x4')](_0xa548('0x5')))[_0xa548('0x6')](_0xa548('0x7'));var _0x1fc0a7=_0x107d98[_0xa548('0x8')](_0x45a97d,_0xa548('0x9'));this['setDataValue'](_0xa548('0xa'),_0x1a1f35);this[_0xa548('0xb')](_0xa548('0xc'),_0x1fc0a7||null);}},'position':{'type':Sequelize[_0xa548('0xd')]},'count':{'type':Sequelize[_0xa548('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xa548('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa548('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xa548('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xa548('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa548('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xa548('0x2')],'comment':_0xa548('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xa548('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa548('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa548('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa548('0x2')]},'holdtime':{'type':Sequelize[_0xa548('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa548('0x2')]},'transfer':{'type':Sequelize[_0xa548('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa548('0x2')],'comment':_0xa548('0x10')},'transferexten':{'type':Sequelize[_0xa548('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa548('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xa548('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xa548('0x2')]}}; \ No newline at end of file +var _0xa289=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','holdtime'];(function(_0x1e24ed,_0x15ba65){var _0xc158c1=function(_0x4e3643){while(--_0x4e3643){_0x1e24ed['push'](_0x1e24ed['shift']());}};_0xc158c1(++_0x15ba65);}(_0xa289,0x13e));var _0x9a28=function(_0x27a87f,_0x2f33f4){_0x27a87f=_0x27a87f-0x0;var _0x3322ac=_0xa289[_0x27a87f];return _0x3322ac;};'use strict';var Sequelize=require(_0x9a28('0x0'));var moment=require(_0x9a28('0x1'));module[_0x9a28('0x2')]={'type':{'type':Sequelize[_0x9a28('0x3')]},'uniqueid':{'type':Sequelize[_0x9a28('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9a28('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x9a28('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x9a28('0x4')],'set':function(_0x21e6de){var _0x30324b=moment(_0x21e6de);var _0x2bc879=moment(this[_0x9a28('0x5')](_0x9a28('0x6')))[_0x9a28('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x450051=_0x30324b[_0x9a28('0x8')](_0x2bc879,_0x9a28('0x9'));this[_0x9a28('0xa')]('queuecallerleaveAt',_0x21e6de);this[_0x9a28('0xa')](_0x9a28('0xb'),_0x450051||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9a28('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9a28('0x4')]},'queuecallerexit':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9a28('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x9a28('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x9a28('0x3')]},'connectedlinenum':{'type':Sequelize[_0x9a28('0x3')]},'connectedlinename':{'type':Sequelize[_0x9a28('0x3')]},'accountcode':{'type':Sequelize[_0x9a28('0x3')]},'context':{'type':Sequelize[_0x9a28('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9a28('0x3')]},'holdtime':{'type':Sequelize[_0x9a28('0xd')]},'mohtime':{'type':Sequelize[_0x9a28('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9a28('0x3')]},'transfer':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9a28('0x3')],'comment':_0x9a28('0xe')},'transferexten':{'type':Sequelize[_0x9a28('0x3')]},'transferuniqueid':{'type':Sequelize[_0x9a28('0x3')]},'disposition':{'type':Sequelize[_0x9a28('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x9a28('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9a28('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index d985a04..5fe2a71 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 _0xaf2d=['describe','getVoiceQueuesReport','nolimit','includeAll','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','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','redis','defaults','localhost','./voiceQueueReport.socket','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','include','VoiceQueueReport','findAll','rows','catch','show','params','keys','create','body','find'];(function(_0x379366,_0x149a3a){var _0x131499=function(_0x2ba8c6){while(--_0x2ba8c6){_0x379366['push'](_0x379366['shift']());}};_0x131499(++_0x149a3a);}(_0xaf2d,0x154));var _0xdaf2=function(_0x4aacc,_0x5e1c1c){_0x4aacc=_0x4aacc-0x0;var _0x238a13=_0xaf2d[_0x4aacc];return _0x238a13;};'use strict';var emlformat=require(_0xdaf2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaf2('0x1'));var jsonpatch=require(_0xdaf2('0x2'));var rp=require('request-promise');var moment=require(_0xdaf2('0x3'));var BPromise=require(_0xdaf2('0x4'));var Mustache=require(_0xdaf2('0x5'));var util=require(_0xdaf2('0x6'));var path=require(_0xdaf2('0x7'));var sox=require(_0xdaf2('0x8'));var csv=require('to-csv');var ejs=require(_0xdaf2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaf2('0xa'));var squel=require('squel');var crypto=require(_0xdaf2('0xb'));var jsforce=require(_0xdaf2('0xc'));var deskjs=require(_0xdaf2('0xd'));var toCsv=require(_0xdaf2('0xe'));var querystring=require('querystring');var Papa=require(_0xdaf2('0xf'));var Redis=require('ioredis');var authService=require(_0xdaf2('0x10'));var qs=require(_0xdaf2('0x11'));var as=require(_0xdaf2('0x12'));var hardwareService=require(_0xdaf2('0x13'));var logger=require(_0xdaf2('0x14'))(_0xdaf2('0x15'));var utils=require(_0xdaf2('0x16'));var config=require(_0xdaf2('0x17'));var licenseUtil=require(_0xdaf2('0x18'));var db=require(_0xdaf2('0x19'))['db'];config[_0xdaf2('0x1a')]=_[_0xdaf2('0x1b')](config[_0xdaf2('0x1a')],{'host':_0xdaf2('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdaf2('0x1a')]));require(_0xdaf2('0x1d'))['register'](socket);function respondWithStatusCode(_0x1102bd,_0x1533f2){_0x1533f2=_0x1533f2||0xcc;return function(_0xa0c814){if(_0xa0c814){return _0x1102bd[_0xdaf2('0x1e')](_0x1533f2);}return _0x1102bd['status'](_0x1533f2)['end']();};}function respondWithResult(_0x930637,_0x45c3de){_0x45c3de=_0x45c3de||0xc8;return function(_0x2e44ed){if(_0x2e44ed){return _0x930637['status'](_0x45c3de)[_0xdaf2('0x1f')](_0x2e44ed);}};}function respondWithFilteredResult(_0x1f2882,_0x485d3b){return function(_0x5ae3d9){if(_0x5ae3d9){var _0x47c241=typeof _0x485d3b[_0xdaf2('0x20')]===_0xdaf2('0x21')&&typeof _0x485d3b['limit']==='undefined';var _0x189514=_0x5ae3d9[_0xdaf2('0x22')];var _0x34b10d=_0x47c241?0x0:_0x485d3b['offset'];var _0x333f5f=_0x47c241?_0x5ae3d9['count']:_0x485d3b[_0xdaf2('0x20')]+_0x485d3b[_0xdaf2('0x23')];var _0x114512;if(_0x333f5f>=_0x189514){_0x333f5f=_0x189514;_0x114512=0xc8;}else{_0x114512=0xce;}_0x1f2882[_0xdaf2('0x24')](_0x114512);return _0x1f2882[_0xdaf2('0x25')](_0xdaf2('0x26'),_0x34b10d+'-'+_0x333f5f+'/'+_0x189514)[_0xdaf2('0x1f')](_0x5ae3d9);}return null;};}function patchUpdates(_0x54d375){return function(_0x3e5f9d){try{jsonpatch[_0xdaf2('0x27')](_0x3e5f9d,_0x54d375,!![]);}catch(_0x3ecab2){return BPromise[_0xdaf2('0x28')](_0x3ecab2);}return _0x3e5f9d[_0xdaf2('0x29')]();};}function saveUpdates(_0x165aa3,_0x1cdd21){return function(_0x1029fc){if(_0x1029fc){return _0x1029fc[_0xdaf2('0x2a')](_0x165aa3)[_0xdaf2('0x2b')](function(_0x80186){return _0x80186;});}return null;};}function removeEntity(_0x146b0c,_0x63d6c6){return function(_0x11a745){if(_0x11a745){return _0x11a745['destroy']()[_0xdaf2('0x2b')](function(){_0x146b0c[_0xdaf2('0x24')](0xcc)[_0xdaf2('0x2c')]();});}};}function handleEntityNotFound(_0x36f439,_0x15083d){return function(_0x5c33a9){if(!_0x5c33a9){_0x36f439[_0xdaf2('0x1e')](0x194);}return _0x5c33a9;};}function handleError(_0x412c7a,_0x412f7e){_0x412f7e=_0x412f7e||0x1f4;return function(_0x2ad886){logger[_0xdaf2('0x2d')](_0x2ad886[_0xdaf2('0x2e')]);if(_0x2ad886['name']){delete _0x2ad886[_0xdaf2('0x2f')];}_0x412c7a[_0xdaf2('0x24')](_0x412f7e)[_0xdaf2('0x30')](_0x2ad886);};}exports[_0xdaf2('0x31')]=function(_0x14d32d,_0x4681e3){var _0x27e859={},_0x4b4b1e={},_0x1f8d60={'count':0x0,'rows':[]};var _0x209e6f=_['map'](db['VoiceQueueReport'][_0xdaf2('0x32')],function(_0xc47837){return{'name':_0xc47837['fieldName'],'type':_0xc47837[_0xdaf2('0x33')][_0xdaf2('0x34')]};});_0x4b4b1e[_0xdaf2('0x35')]=_[_0xdaf2('0x36')](_0x209e6f,'name');_0x4b4b1e[_0xdaf2('0x37')]=_['keys'](_0x14d32d[_0xdaf2('0x37')]);_0x4b4b1e[_0xdaf2('0x38')]=_[_0xdaf2('0x39')](_0x4b4b1e['model'],_0x4b4b1e[_0xdaf2('0x37')]);_0x27e859[_0xdaf2('0x3a')]=_[_0xdaf2('0x39')](_0x4b4b1e[_0xdaf2('0x35')],qs[_0xdaf2('0x3b')](_0x14d32d['query'][_0xdaf2('0x3b')]));_0x27e859['attributes']=_0x27e859['attributes'][_0xdaf2('0x3c')]?_0x27e859['attributes']:_0x4b4b1e[_0xdaf2('0x35')];if(!_0x14d32d[_0xdaf2('0x37')][_0xdaf2('0x3d')]('nolimit')){_0x27e859[_0xdaf2('0x23')]=qs[_0xdaf2('0x23')](_0x14d32d['query'][_0xdaf2('0x23')]);_0x27e859['offset']=qs['offset'](_0x14d32d['query'][_0xdaf2('0x20')]);}_0x27e859['order']=qs['sort'](_0x14d32d[_0xdaf2('0x37')][_0xdaf2('0x3e')]);_0x27e859['where']=qs[_0xdaf2('0x38')](_[_0xdaf2('0x3f')](_0x14d32d['query'],_0x4b4b1e[_0xdaf2('0x38')]),_0x209e6f);if(_0x14d32d[_0xdaf2('0x37')]['filter']){_0x27e859[_0xdaf2('0x40')]=_[_0xdaf2('0x41')](_0x27e859[_0xdaf2('0x40')],{'$or':_[_0xdaf2('0x36')](_0x209e6f,function(_0x43db4b){if(_0x43db4b[_0xdaf2('0x33')]!==_0xdaf2('0x42')){var _0x903104={};_0x903104[_0x43db4b[_0xdaf2('0x2f')]]={'$like':'%'+_0x14d32d[_0xdaf2('0x37')][_0xdaf2('0x43')]+'%'};return _0x903104;}})});}_0x27e859=_['merge']({},_0x27e859,_0x14d32d[_0xdaf2('0x44')]);var _0x3c69df={'where':_0x27e859[_0xdaf2('0x40')]};return db['VoiceQueueReport']['count'](_0x3c69df)[_0xdaf2('0x2b')](function(_0x3856db){_0x1f8d60['count']=_0x3856db;if(_0x14d32d[_0xdaf2('0x37')]['includeAll']){_0x27e859[_0xdaf2('0x45')]=[{'all':!![]}];}return db[_0xdaf2('0x46')][_0xdaf2('0x47')](_0x27e859);})['then'](function(_0x55bff1){_0x1f8d60[_0xdaf2('0x48')]=_0x55bff1;return _0x1f8d60;})[_0xdaf2('0x2b')](respondWithFilteredResult(_0x4681e3,_0x27e859))[_0xdaf2('0x49')](handleError(_0x4681e3,null));};exports[_0xdaf2('0x4a')]=function(_0x3048c2,_0x42556c){var _0x1449dc={'raw':![],'where':{'id':_0x3048c2[_0xdaf2('0x4b')]['id']}},_0x59ec10={};_0x59ec10[_0xdaf2('0x35')]=_[_0xdaf2('0x4c')](db[_0xdaf2('0x46')][_0xdaf2('0x32')]);_0x59ec10['query']=_['keys'](_0x3048c2['query']);_0x59ec10[_0xdaf2('0x38')]=_['intersection'](_0x59ec10[_0xdaf2('0x35')],_0x59ec10['query']);_0x1449dc[_0xdaf2('0x3a')]=_[_0xdaf2('0x39')](_0x59ec10['model'],qs[_0xdaf2('0x3b')](_0x3048c2['query'][_0xdaf2('0x3b')]));_0x1449dc[_0xdaf2('0x3a')]=_0x1449dc['attributes']['length']?_0x1449dc[_0xdaf2('0x3a')]:_0x59ec10[_0xdaf2('0x35')];if(_0x3048c2[_0xdaf2('0x37')]['includeAll']){_0x1449dc[_0xdaf2('0x45')]=[{'all':!![]}];}_0x1449dc=_[_0xdaf2('0x41')]({},_0x1449dc,_0x3048c2[_0xdaf2('0x44')]);return db[_0xdaf2('0x46')]['find'](_0x1449dc)['then'](handleEntityNotFound(_0x42556c,null))[_0xdaf2('0x2b')](respondWithResult(_0x42556c,null))[_0xdaf2('0x49')](handleError(_0x42556c,null));};exports[_0xdaf2('0x4d')]=function(_0x49c6ff,_0x423195){return db['VoiceQueueReport'][_0xdaf2('0x4d')](_0x49c6ff[_0xdaf2('0x4e')],{})[_0xdaf2('0x2b')](respondWithResult(_0x423195,0xc9))[_0xdaf2('0x49')](handleError(_0x423195,null));};exports['update']=function(_0x11c5a5,_0x296a7e){if(_0x11c5a5[_0xdaf2('0x4e')]['id']){delete _0x11c5a5[_0xdaf2('0x4e')]['id'];}return db['VoiceQueueReport'][_0xdaf2('0x4f')]({'where':{'id':_0x11c5a5[_0xdaf2('0x4b')]['id']}})[_0xdaf2('0x2b')](handleEntityNotFound(_0x296a7e,null))[_0xdaf2('0x2b')](saveUpdates(_0x11c5a5[_0xdaf2('0x4e')],null))['then'](respondWithResult(_0x296a7e,null))['catch'](handleError(_0x296a7e,null));};exports['destroy']=function(_0x49f08b,_0x5544df){return db[_0xdaf2('0x46')][_0xdaf2('0x4f')]({'where':{'id':_0x49f08b['params']['id']}})['then'](handleEntityNotFound(_0x5544df,null))[_0xdaf2('0x2b')](removeEntity(_0x5544df,null))[_0xdaf2('0x49')](handleError(_0x5544df,null));};exports[_0xdaf2('0x50')]=function(_0x580782,_0x15ef7a){return db['VoiceQueueReport'][_0xdaf2('0x50')]()[_0xdaf2('0x2b')](respondWithResult(_0x15ef7a,null))[_0xdaf2('0x49')](handleError(_0x15ef7a,null));};exports[_0xdaf2('0x51')]=function(_0x1e1cbc,_0x122e8f){var _0x223975={},_0x2a3880={},_0x1d0a4c={'count':0x0,'rows':[]};_0x2a3880['model']=_[_0xdaf2('0x4c')](db[_0xdaf2('0x46')]['rawAttributes']);_0x2a3880['query']=_[_0xdaf2('0x4c')](_0x1e1cbc['query']);_0x2a3880['filters']=_['intersection'](_0x2a3880['model'],_0x2a3880[_0xdaf2('0x37')]);_0x223975[_0xdaf2('0x3a')]=_[_0xdaf2('0x39')](_0x2a3880[_0xdaf2('0x35')],qs[_0xdaf2('0x3b')](_0x1e1cbc[_0xdaf2('0x37')][_0xdaf2('0x3b')]));_0x223975[_0xdaf2('0x3a')]=_0x223975[_0xdaf2('0x3a')][_0xdaf2('0x3c')]?_0x223975[_0xdaf2('0x3a')]:_0x2a3880[_0xdaf2('0x35')];if(!_0x1e1cbc['query']['hasOwnProperty'](_0xdaf2('0x52'))){_0x223975[_0xdaf2('0x23')]=qs[_0xdaf2('0x23')](_0x1e1cbc['query']['limit']);_0x223975['offset']=qs[_0xdaf2('0x20')](_0x1e1cbc[_0xdaf2('0x37')][_0xdaf2('0x20')]);}_0x223975['order']=qs[_0xdaf2('0x3e')](_0x1e1cbc['query'][_0xdaf2('0x3e')]);_0x223975[_0xdaf2('0x40')]=qs[_0xdaf2('0x38')](_[_0xdaf2('0x3f')](_0x1e1cbc[_0xdaf2('0x37')],_0x2a3880['filters']));if(_0x1e1cbc[_0xdaf2('0x37')][_0xdaf2('0x43')]){_0x223975[_0xdaf2('0x40')]=_[_0xdaf2('0x41')](_0x223975['where'],{'$or':_[_0xdaf2('0x36')](_0x223975['attributes'],function(_0x3d52b3){var _0x276413={};_0x276413[_0x3d52b3]={'$like':'%'+_0x1e1cbc[_0xdaf2('0x37')]['filter']+'%'};return _0x276413;})});}_0x223975=_[_0xdaf2('0x41')]({},_0x223975,_0x1e1cbc[_0xdaf2('0x44')]);var _0x540139={'where':_0x223975[_0xdaf2('0x40')]};return db['VoiceQueueReport'][_0xdaf2('0x22')](_0x540139)[_0xdaf2('0x2b')](function(_0x5f1e55){_0x1d0a4c[_0xdaf2('0x22')]=_0x5f1e55;if(_0x1e1cbc[_0xdaf2('0x37')][_0xdaf2('0x53')]){_0x223975[_0xdaf2('0x45')]=[{'all':!![]}];}return db[_0xdaf2('0x46')][_0xdaf2('0x47')](_0x223975);})[_0xdaf2('0x2b')](function(_0x44e391){_0x1d0a4c['rows']=_0x44e391;return _0x1d0a4c;})[_0xdaf2('0x2b')](respondWithFilteredResult(_0x122e8f,_0x223975,_0xdaf2('0x51')))[_0xdaf2('0x49')](handleError(_0x122e8f,null,_0xdaf2('0x51')));}; \ No newline at end of file +var _0x88d8=['querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x527fb9,_0x4620a0){var _0x12c752=function(_0x20d259){while(--_0x20d259){_0x527fb9['push'](_0x527fb9['shift']());}};_0x12c752(++_0x4620a0);}(_0x88d8,0xef));var _0x888d=function(_0x2dfea4,_0x36872d){_0x2dfea4=_0x2dfea4-0x0;var _0x583188=_0x88d8[_0x2dfea4];return _0x583188;};'use strict';var emlformat=require(_0x888d('0x0'));var rimraf=require(_0x888d('0x1'));var zipdir=require(_0x888d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x888d('0x3'));var moment=require(_0x888d('0x4'));var BPromise=require(_0x888d('0x5'));var Mustache=require(_0x888d('0x6'));var util=require(_0x888d('0x7'));var path=require(_0x888d('0x8'));var sox=require(_0x888d('0x9'));var csv=require(_0x888d('0xa'));var ejs=require(_0x888d('0xb'));var fs=require('fs');var fs_extra=require(_0x888d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x888d('0xd'));var jsforce=require(_0x888d('0xe'));var deskjs=require(_0x888d('0xf'));var toCsv=require(_0x888d('0xa'));var querystring=require(_0x888d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x888d('0x11'));var qs=require(_0x888d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x888d('0x13'))(_0x888d('0x14'));var utils=require(_0x888d('0x15'));var config=require(_0x888d('0x16'));var licenseUtil=require(_0x888d('0x17'));var db=require('../../mysqldb')['db'];config[_0x888d('0x18')]=_[_0x888d('0x19')](config[_0x888d('0x18')],{'host':_0x888d('0x1a'),'port':0x18eb});var socket=require(_0x888d('0x1b'))(new Redis(config[_0x888d('0x18')]));require(_0x888d('0x1c'))[_0x888d('0x1d')](socket);function respondWithStatusCode(_0x183921,_0xada5a0){_0xada5a0=_0xada5a0||0xcc;return function(_0x1a5d78){if(_0x1a5d78){return _0x183921['sendStatus'](_0xada5a0);}return _0x183921['status'](_0xada5a0)['end']();};}function respondWithResult(_0x3f3670,_0x4e549d){_0x4e549d=_0x4e549d||0xc8;return function(_0x35747e){if(_0x35747e){return _0x3f3670[_0x888d('0x1e')](_0x4e549d)[_0x888d('0x1f')](_0x35747e);}};}function respondWithFilteredResult(_0xb97dda,_0xfc176b){return function(_0x1a63d3){if(_0x1a63d3){var _0x51861a=typeof _0xfc176b[_0x888d('0x20')]===_0x888d('0x21')&&typeof _0xfc176b[_0x888d('0x22')]===_0x888d('0x21');var _0x2b9ac2=_0x1a63d3[_0x888d('0x23')];var _0x1faa2c=_0x51861a?0x0:_0xfc176b[_0x888d('0x20')];var _0x2be17f=_0x51861a?_0x1a63d3[_0x888d('0x23')]:_0xfc176b['offset']+_0xfc176b[_0x888d('0x22')];var _0x2496dd;if(_0x2be17f>=_0x2b9ac2){_0x2be17f=_0x2b9ac2;_0x2496dd=0xc8;}else{_0x2496dd=0xce;}_0xb97dda['status'](_0x2496dd);return _0xb97dda['set'](_0x888d('0x24'),_0x1faa2c+'-'+_0x2be17f+'/'+_0x2b9ac2)[_0x888d('0x1f')](_0x1a63d3);}return null;};}function patchUpdates(_0x6b6673){return function(_0x464be2){try{jsonpatch[_0x888d('0x25')](_0x464be2,_0x6b6673,!![]);}catch(_0xf01167){return BPromise[_0x888d('0x26')](_0xf01167);}return _0x464be2['save']();};}function saveUpdates(_0x308eba,_0x257c5c){return function(_0x24dd80){if(_0x24dd80){return _0x24dd80[_0x888d('0x27')](_0x308eba)['then'](function(_0x255e44){return _0x255e44;});}return null;};}function removeEntity(_0x391c67,_0x24f00b){return function(_0x4c64a4){if(_0x4c64a4){return _0x4c64a4[_0x888d('0x28')]()['then'](function(){_0x391c67[_0x888d('0x1e')](0xcc)[_0x888d('0x29')]();});}};}function handleEntityNotFound(_0x30d3d4,_0x315e19){return function(_0x37cfde){if(!_0x37cfde){_0x30d3d4[_0x888d('0x2a')](0x194);}return _0x37cfde;};}function handleError(_0x10feeb,_0x295725){_0x295725=_0x295725||0x1f4;return function(_0x3e583f){logger[_0x888d('0x2b')](_0x3e583f[_0x888d('0x2c')]);if(_0x3e583f[_0x888d('0x2d')]){delete _0x3e583f['name'];}_0x10feeb['status'](_0x295725)[_0x888d('0x2e')](_0x3e583f);};}exports[_0x888d('0x2f')]=function(_0x590fd4,_0x5d457a){var _0x46271b={},_0x316a7e={},_0x194997={'count':0x0,'rows':[]};var _0x5ba4f4=_[_0x888d('0x30')](db[_0x888d('0x31')][_0x888d('0x32')],function(_0x15fb70){return{'name':_0x15fb70[_0x888d('0x33')],'type':_0x15fb70[_0x888d('0x34')][_0x888d('0x35')]};});_0x316a7e[_0x888d('0x36')]=_[_0x888d('0x30')](_0x5ba4f4,_0x888d('0x2d'));_0x316a7e[_0x888d('0x37')]=_[_0x888d('0x38')](_0x590fd4[_0x888d('0x37')]);_0x316a7e[_0x888d('0x39')]=_[_0x888d('0x3a')](_0x316a7e[_0x888d('0x36')],_0x316a7e['query']);_0x46271b[_0x888d('0x3b')]=_[_0x888d('0x3a')](_0x316a7e['model'],qs[_0x888d('0x3c')](_0x590fd4[_0x888d('0x37')]['fields']));_0x46271b[_0x888d('0x3b')]=_0x46271b[_0x888d('0x3b')][_0x888d('0x3d')]?_0x46271b[_0x888d('0x3b')]:_0x316a7e['model'];if(!_0x590fd4[_0x888d('0x37')]['hasOwnProperty'](_0x888d('0x3e'))){_0x46271b[_0x888d('0x22')]=qs[_0x888d('0x22')](_0x590fd4[_0x888d('0x37')]['limit']);_0x46271b[_0x888d('0x20')]=qs[_0x888d('0x20')](_0x590fd4[_0x888d('0x37')]['offset']);}_0x46271b[_0x888d('0x3f')]=qs[_0x888d('0x40')](_0x590fd4['query'][_0x888d('0x40')]);_0x46271b[_0x888d('0x41')]=qs[_0x888d('0x39')](_[_0x888d('0x42')](_0x590fd4['query'],_0x316a7e[_0x888d('0x39')]),_0x5ba4f4);if(_0x590fd4[_0x888d('0x37')][_0x888d('0x43')]){_0x46271b['where']=_[_0x888d('0x44')](_0x46271b[_0x888d('0x41')],{'$or':_[_0x888d('0x30')](_0x5ba4f4,function(_0x5b8737){if(_0x5b8737['type']!==_0x888d('0x45')){var _0x3407c6={};_0x3407c6[_0x5b8737['name']]={'$like':'%'+_0x590fd4[_0x888d('0x37')][_0x888d('0x43')]+'%'};return _0x3407c6;}})});}_0x46271b=_[_0x888d('0x44')]({},_0x46271b,_0x590fd4[_0x888d('0x46')]);var _0x464b25={'where':_0x46271b[_0x888d('0x41')]};return db[_0x888d('0x31')][_0x888d('0x23')](_0x464b25)[_0x888d('0x47')](function(_0x251519){_0x194997[_0x888d('0x23')]=_0x251519;if(_0x590fd4[_0x888d('0x37')][_0x888d('0x48')]){_0x46271b[_0x888d('0x49')]=[{'all':!![]}];}return db[_0x888d('0x31')][_0x888d('0x4a')](_0x46271b);})['then'](function(_0x47b01d){_0x194997[_0x888d('0x4b')]=_0x47b01d;return _0x194997;})[_0x888d('0x47')](respondWithFilteredResult(_0x5d457a,_0x46271b))[_0x888d('0x4c')](handleError(_0x5d457a,null));};exports[_0x888d('0x4d')]=function(_0x1b4b40,_0x3713e7){var _0x427312={'raw':![],'where':{'id':_0x1b4b40[_0x888d('0x4e')]['id']}},_0x344aa8={};_0x344aa8[_0x888d('0x36')]=_[_0x888d('0x38')](db['VoiceQueueReport']['rawAttributes']);_0x344aa8['query']=_[_0x888d('0x38')](_0x1b4b40['query']);_0x344aa8[_0x888d('0x39')]=_[_0x888d('0x3a')](_0x344aa8['model'],_0x344aa8[_0x888d('0x37')]);_0x427312['attributes']=_[_0x888d('0x3a')](_0x344aa8[_0x888d('0x36')],qs[_0x888d('0x3c')](_0x1b4b40['query'][_0x888d('0x3c')]));_0x427312[_0x888d('0x3b')]=_0x427312['attributes'][_0x888d('0x3d')]?_0x427312[_0x888d('0x3b')]:_0x344aa8[_0x888d('0x36')];if(_0x1b4b40['query'][_0x888d('0x48')]){_0x427312[_0x888d('0x49')]=[{'all':!![]}];}_0x427312=_['merge']({},_0x427312,_0x1b4b40[_0x888d('0x46')]);return db['VoiceQueueReport'][_0x888d('0x4f')](_0x427312)[_0x888d('0x47')](handleEntityNotFound(_0x3713e7,null))['then'](respondWithResult(_0x3713e7,null))[_0x888d('0x4c')](handleError(_0x3713e7,null));};exports[_0x888d('0x50')]=function(_0x2a435d,_0x1e7877){return db[_0x888d('0x31')][_0x888d('0x50')](_0x2a435d[_0x888d('0x51')],{})[_0x888d('0x47')](respondWithResult(_0x1e7877,0xc9))[_0x888d('0x4c')](handleError(_0x1e7877,null));};exports[_0x888d('0x27')]=function(_0xc89d64,_0x2465c5){if(_0xc89d64[_0x888d('0x51')]['id']){delete _0xc89d64[_0x888d('0x51')]['id'];}return db[_0x888d('0x31')][_0x888d('0x4f')]({'where':{'id':_0xc89d64[_0x888d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2465c5,null))[_0x888d('0x47')](saveUpdates(_0xc89d64[_0x888d('0x51')],null))[_0x888d('0x47')](respondWithResult(_0x2465c5,null))[_0x888d('0x4c')](handleError(_0x2465c5,null));};exports['destroy']=function(_0xccbe82,_0x15a724){return db['VoiceQueueReport'][_0x888d('0x4f')]({'where':{'id':_0xccbe82[_0x888d('0x4e')]['id']}})[_0x888d('0x47')](handleEntityNotFound(_0x15a724,null))[_0x888d('0x47')](removeEntity(_0x15a724,null))[_0x888d('0x4c')](handleError(_0x15a724,null));};exports[_0x888d('0x52')]=function(_0x47c6cd,_0x5a52ea){return db[_0x888d('0x31')][_0x888d('0x52')]()[_0x888d('0x47')](respondWithResult(_0x5a52ea,null))[_0x888d('0x4c')](handleError(_0x5a52ea,null));};exports[_0x888d('0x53')]=function(_0x1c1e85,_0x58972e){var _0x557caf={},_0x1c573b={},_0x564d67={'count':0x0,'rows':[]};_0x1c573b[_0x888d('0x36')]=_[_0x888d('0x38')](db[_0x888d('0x31')][_0x888d('0x32')]);_0x1c573b[_0x888d('0x37')]=_[_0x888d('0x38')](_0x1c1e85[_0x888d('0x37')]);_0x1c573b[_0x888d('0x39')]=_[_0x888d('0x3a')](_0x1c573b[_0x888d('0x36')],_0x1c573b['query']);_0x557caf[_0x888d('0x3b')]=_[_0x888d('0x3a')](_0x1c573b[_0x888d('0x36')],qs['fields'](_0x1c1e85['query'][_0x888d('0x3c')]));_0x557caf['attributes']=_0x557caf[_0x888d('0x3b')][_0x888d('0x3d')]?_0x557caf['attributes']:_0x1c573b[_0x888d('0x36')];if(!_0x1c1e85['query'][_0x888d('0x54')](_0x888d('0x3e'))){_0x557caf[_0x888d('0x22')]=qs[_0x888d('0x22')](_0x1c1e85['query'][_0x888d('0x22')]);_0x557caf[_0x888d('0x20')]=qs[_0x888d('0x20')](_0x1c1e85['query'][_0x888d('0x20')]);}_0x557caf['order']=qs[_0x888d('0x40')](_0x1c1e85['query'][_0x888d('0x40')]);_0x557caf[_0x888d('0x41')]=qs[_0x888d('0x39')](_[_0x888d('0x42')](_0x1c1e85[_0x888d('0x37')],_0x1c573b['filters']));if(_0x1c1e85[_0x888d('0x37')]['filter']){_0x557caf[_0x888d('0x41')]=_['merge'](_0x557caf['where'],{'$or':_[_0x888d('0x30')](_0x557caf[_0x888d('0x3b')],function(_0x3d1911){var _0x5b7e34={};_0x5b7e34[_0x3d1911]={'$like':'%'+_0x1c1e85[_0x888d('0x37')][_0x888d('0x43')]+'%'};return _0x5b7e34;})});}_0x557caf=_[_0x888d('0x44')]({},_0x557caf,_0x1c1e85['options']);var _0x22e1fb={'where':_0x557caf[_0x888d('0x41')]};return db[_0x888d('0x31')]['count'](_0x22e1fb)[_0x888d('0x47')](function(_0x5ee3d6){_0x564d67['count']=_0x5ee3d6;if(_0x1c1e85[_0x888d('0x37')][_0x888d('0x48')]){_0x557caf['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x888d('0x4a')](_0x557caf);})[_0x888d('0x47')](function(_0x2d7bcd){_0x564d67[_0x888d('0x4b')]=_0x2d7bcd;return _0x564d67;})[_0x888d('0x47')](respondWithFilteredResult(_0x58972e,_0x557caf,'getVoiceQueuesReport'))['catch'](handleError(_0x58972e,null,_0x888d('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 96a0360..4870527 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 _0x4825=['hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','save','update','emit'];(function(_0x3364f7,_0x3ee4b0){var _0x3d2089=function(_0x56658d){while(--_0x56658d){_0x3364f7['push'](_0x3364f7['shift']());}};_0x3d2089(++_0x3ee4b0);}(_0x4825,0x1d2));var _0x5482=function(_0x4be611,_0x596afb){_0x4be611=_0x4be611-0x0;var _0x3bcb70=_0x4825[_0x4be611];return _0x3bcb70;};'use strict';var EventEmitter=require(_0x5482('0x0'));var VoiceQueueReport=require(_0x5482('0x1'))['db'][_0x5482('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5482('0x3'),'afterUpdate':_0x5482('0x4'),'afterDestroy':'remove'};function emitEvent(_0x57f9bf){return function(_0x5b89ec,_0x39a90b,_0x13a1aa){VoiceQueueReportEvents[_0x5482('0x5')](_0x57f9bf+':'+_0x5b89ec['id'],_0x5b89ec);VoiceQueueReportEvents[_0x5482('0x5')](_0x57f9bf,_0x5b89ec);_0x13a1aa(null);};}for(var e in events){if(events[_0x5482('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x5482('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x82f4=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3438fb,_0xde4967){var _0x2606b1=function(_0xc61246){while(--_0xc61246){_0x3438fb['push'](_0x3438fb['shift']());}};_0x2606b1(++_0xde4967);}(_0x82f4,0x1bf));var _0x482f=function(_0x172d0,_0x4b8d19){_0x172d0=_0x172d0-0x0;var _0xea4df7=_0x82f4[_0x172d0];return _0xea4df7;};'use strict';var EventEmitter=require(_0x482f('0x0'));var VoiceQueueReport=require(_0x482f('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x482f('0x2')](0x0);var events={'afterCreate':_0x482f('0x3'),'afterUpdate':_0x482f('0x4'),'afterDestroy':_0x482f('0x5')};function emitEvent(_0x3288fe){return function(_0x1a293d,_0x58ec4b,_0x105440){VoiceQueueReportEvents[_0x482f('0x6')](_0x3288fe+':'+_0x1a293d['id'],_0x1a293d);VoiceQueueReportEvents[_0x482f('0x6')](_0x3288fe,_0x1a293d);_0x105440(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x482f('0x7')](e,emitEvent(event));}}module[_0x482f('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 2cd7b8f..3510208 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 _0x83f3=['./voiceQueueReport.attributes','exports','report_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5183aa,_0x54277c){var _0x73ac67=function(_0x14759c){while(--_0x14759c){_0x5183aa['push'](_0x5183aa['shift']());}};_0x73ac67(++_0x54277c);}(_0x83f3,0x1d0));var _0x383f=function(_0x273a05,_0x21100b){_0x273a05=_0x273a05-0x0;var _0x4597f0=_0x83f3[_0x273a05];return _0x4597f0;};'use strict';var _=require(_0x383f('0x0'));var util=require(_0x383f('0x1'));var logger=require(_0x383f('0x2'))(_0x383f('0x3'));var moment=require(_0x383f('0x4'));var BPromise=require('bluebird');var rp=require(_0x383f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x383f('0x6'));module[_0x383f('0x7')]=function(_0xa270bd,_0x1c741e){return _0xa270bd['define']('VoiceQueueReport',attributes,{'tableName':_0x383f('0x8'),'paranoid':![],'indexes':[{'fields':[_0x383f('0x9')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f81=['VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports'];(function(_0x47e0e6,_0x3b7442){var _0x63c42e=function(_0x1f0fe9){while(--_0x1f0fe9){_0x47e0e6['push'](_0x47e0e6['shift']());}};_0x63c42e(++_0x3b7442);}(_0x5f81,0x1d8));var _0x15f8=function(_0x5b181e,_0x2a2741){_0x5b181e=_0x5b181e-0x0;var _0x10bd8a=_0x5f81[_0x5b181e];return _0x10bd8a;};'use strict';var _=require(_0x15f8('0x0'));var util=require(_0x15f8('0x1'));var logger=require(_0x15f8('0x2'))(_0x15f8('0x3'));var moment=require(_0x15f8('0x4'));var BPromise=require(_0x15f8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x15f8('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x15f8('0x7')]=function(_0x23b023,_0x4d6528){return _0x23b023['define'](_0x15f8('0x8'),attributes,{'tableName':_0x15f8('0x9'),'paranoid':![],'indexes':[{'fields':[_0x15f8('0xa')]},{'fields':[_0x15f8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 2adc672..4710bed 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 _0xe462=['update','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','localhost','socket.io-emitter','redis','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','attributes','limit','map','include','model','CreateVoiceQueueReport','body','raw','then','UpdateVoiceQueueReport'];(function(_0x4284b0,_0x1da437){var _0x322fed=function(_0x335f75){while(--_0x335f75){_0x4284b0['push'](_0x4284b0['shift']());}};_0x322fed(++_0x1da437);}(_0xe462,0x1e2));var _0x2e46=function(_0x160f99,_0x8de3ad){_0x160f99=_0x160f99-0x0;var _0x405e09=_0xe462[_0x160f99];return _0x405e09;};'use strict';var _=require(_0x2e46('0x0'));var util=require(_0x2e46('0x1'));var moment=require(_0x2e46('0x2'));var BPromise=require(_0x2e46('0x3'));var rs=require(_0x2e46('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e46('0x5'))['db'];var utils=require(_0x2e46('0x6'));var logger=require(_0x2e46('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2e46('0x8'));var client=jayson[_0x2e46('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2e46('0xa'),'port':0x18eb});var socket=require(_0x2e46('0xb'))(new Redis(config[_0x2e46('0xc')]));require('./voiceQueueReport.socket')[_0x2e46('0xd')](socket);function respondWithRpcPromise(_0x4d709c,_0x3e362b,_0x3a7dd2){return new BPromise(function(_0x4b19d1,_0x7ec601){return client[_0x2e46('0xe')](_0x4d709c,_0x3a7dd2)['then'](function(_0x1d7505){logger[_0x2e46('0xf')](_0x2e46('0x10'),_0x3e362b,'request\x20sent');logger[_0x2e46('0x11')](_0x2e46('0x12'),_0x3e362b,_0x2e46('0x13'),JSON[_0x2e46('0x14')](_0x1d7505));if(_0x1d7505[_0x2e46('0x15')]){if(_0x1d7505[_0x2e46('0x15')]['code']===0x1f4){logger[_0x2e46('0x15')](_0x2e46('0x10'),_0x3e362b,_0x1d7505[_0x2e46('0x15')][_0x2e46('0x16')]);return _0x7ec601(_0x1d7505[_0x2e46('0x15')][_0x2e46('0x16')]);}logger[_0x2e46('0x15')](_0x2e46('0x10'),_0x3e362b,_0x1d7505[_0x2e46('0x15')][_0x2e46('0x16')]);return _0x4b19d1(_0x1d7505[_0x2e46('0x15')]['message']);}else{logger[_0x2e46('0xf')](_0x2e46('0x10'),_0x3e362b,'request\x20sent');_0x4b19d1(_0x1d7505['result'][_0x2e46('0x16')]);}})[_0x2e46('0x17')](function(_0x36efc7){logger[_0x2e46('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x3e362b,_0x36efc7);_0x7ec601(_0x36efc7);});});}exports[_0x2e46('0x18')]=function(_0x355215){var _0x1ae8fe=this;return new Promise(function(_0x3ade99,_0x418886){return db[_0x2e46('0x19')][_0x2e46('0x1a')]({'raw':_0x355215[_0x2e46('0x1b')]?_0x355215[_0x2e46('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x355215['options']?_0x355215[_0x2e46('0x1b')]['where']||null:null,'attributes':_0x355215[_0x2e46('0x1b')]?_0x355215[_0x2e46('0x1b')][_0x2e46('0x1c')]||null:null,'limit':_0x355215[_0x2e46('0x1b')]?_0x355215[_0x2e46('0x1b')][_0x2e46('0x1d')]||null:null,'include':_0x355215[_0x2e46('0x1b')]?_0x355215[_0x2e46('0x1b')]['include']?_[_0x2e46('0x1e')](_0x355215[_0x2e46('0x1b')][_0x2e46('0x1f')],function(_0xb2d801){return{'model':db[_0xb2d801['model']],'as':_0xb2d801['as'],'attributes':_0xb2d801[_0x2e46('0x1c')],'include':_0xb2d801[_0x2e46('0x1f')]?_['map'](_0xb2d801['include'],function(_0x167955){return{'model':db[_0x167955[_0x2e46('0x20')]],'as':_0x167955['as'],'attributes':_0x167955[_0x2e46('0x1c')],'include':_0x167955[_0x2e46('0x1f')]?_[_0x2e46('0x1e')](_0x167955[_0x2e46('0x1f')],function(_0x3807fd){return{'model':db[_0x3807fd[_0x2e46('0x20')]],'as':_0x3807fd['as'],'attributes':_0x3807fd[_0x2e46('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bc810){logger[_0x2e46('0xf')](_0x2e46('0x18'),_0x355215);logger[_0x2e46('0x11')]('GetVoiceQueueReport',_0x355215,JSON[_0x2e46('0x14')](_0x3bc810));_0x3ade99(_0x3bc810);})[_0x2e46('0x17')](function(_0x436117){logger['error']('GetVoiceQueueReport',_0x436117[_0x2e46('0x16')],_0x355215);_0x418886(_0x1ae8fe[_0x2e46('0x15')](0x1f4,_0x436117[_0x2e46('0x16')]));});});};exports[_0x2e46('0x21')]=function(_0x182559){var _0x4dbee5=this;return new Promise(function(_0x558fcb,_0x22a2ce){return db['VoiceQueueReport']['create'](_0x182559[_0x2e46('0x22')],{'raw':_0x182559['options']?_0x182559[_0x2e46('0x1b')][_0x2e46('0x23')]===undefined?!![]:![]:!![]})[_0x2e46('0x24')](function(_0x3d8b2d){logger[_0x2e46('0xf')]('CreateVoiceQueueReport',_0x182559);logger[_0x2e46('0x11')](_0x2e46('0x21'),_0x182559,JSON[_0x2e46('0x14')](_0x3d8b2d));_0x558fcb(_0x3d8b2d);})['catch'](function(_0x5719ae){logger[_0x2e46('0x15')](_0x2e46('0x21'),_0x5719ae[_0x2e46('0x16')],_0x182559);_0x22a2ce(_0x4dbee5['error'](0x1f4,_0x5719ae['message']));});});};exports[_0x2e46('0x25')]=function(_0x2560c0){var _0x3ac396=this;return new Promise(function(_0x47c28d,_0x23ff5a){return db[_0x2e46('0x19')][_0x2e46('0x26')](_0x2560c0[_0x2e46('0x22')],{'raw':_0x2560c0['options']?_0x2560c0[_0x2e46('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2560c0['options']?_0x2560c0['options'][_0x2e46('0x27')]||null:null,'attributes':_0x2560c0[_0x2e46('0x1b')]?_0x2560c0[_0x2e46('0x1b')]['attributes']||null:null,'limit':_0x2560c0[_0x2e46('0x1b')]?_0x2560c0[_0x2e46('0x1b')]['limit']||null:null})[_0x2e46('0x24')](function(_0x211419){logger[_0x2e46('0xf')](_0x2e46('0x25'),_0x2560c0);logger[_0x2e46('0x11')]('UpdateVoiceQueueReport',_0x2560c0,JSON['stringify'](_0x211419));_0x47c28d(_0x211419);})[_0x2e46('0x17')](function(_0x104ed0){logger[_0x2e46('0x15')](_0x2e46('0x25'),_0x104ed0[_0x2e46('0x16')],_0x2560c0);_0x23ff5a(_0x3ac396[_0x2e46('0x15')](0x1f4,_0x104ed0['message']));});});}; \ No newline at end of file +var _0x546d=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./voiceQueueReport.socket','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','VoiceQueueReport,\x20%s,\x20%s','message','catch','options','raw','where','limit','include','map','model','attributes','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','update','body'];(function(_0x290b22,_0xeed456){var _0x3a8240=function(_0x219aba){while(--_0x219aba){_0x290b22['push'](_0x290b22['shift']());}};_0x3a8240(++_0xeed456);}(_0x546d,0x190));var _0xd546=function(_0x1bfef0,_0x2aac69){_0x1bfef0=_0x1bfef0-0x0;var _0x2e1218=_0x546d[_0x1bfef0];return _0x2e1218;};'use strict';var _=require(_0xd546('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd546('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd546('0x2'));var db=require(_0xd546('0x3'))['db'];var utils=require(_0xd546('0x4'));var logger=require(_0xd546('0x5'))(_0xd546('0x6'));var config=require(_0xd546('0x7'));var jayson=require(_0xd546('0x8'));var client=jayson[_0xd546('0x9')][_0xd546('0xa')]({'port':0x232a});config['redis']=_[_0xd546('0xb')](config[_0xd546('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd546('0xd'))['register'](socket);function respondWithRpcPromise(_0x50d973,_0x47235a,_0x18544f){return new BPromise(function(_0x321cb8,_0x35f26e){return client[_0xd546('0xe')](_0x50d973,_0x18544f)[_0xd546('0xf')](function(_0x53d010){logger[_0xd546('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x47235a,_0xd546('0x11'));logger[_0xd546('0x12')](_0xd546('0x13'),_0x47235a,_0xd546('0x11'),JSON['stringify'](_0x53d010));if(_0x53d010[_0xd546('0x14')]){if(_0x53d010[_0xd546('0x14')]['code']===0x1f4){logger[_0xd546('0x14')](_0xd546('0x15'),_0x47235a,_0x53d010[_0xd546('0x14')][_0xd546('0x16')]);return _0x35f26e(_0x53d010['error'][_0xd546('0x16')]);}logger[_0xd546('0x14')](_0xd546('0x15'),_0x47235a,_0x53d010['error'][_0xd546('0x16')]);return _0x321cb8(_0x53d010[_0xd546('0x14')][_0xd546('0x16')]);}else{logger['info'](_0xd546('0x15'),_0x47235a,'request\x20sent');_0x321cb8(_0x53d010['result']['message']);}})[_0xd546('0x17')](function(_0x2b1028){logger[_0xd546('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x47235a,_0x2b1028);_0x35f26e(_0x2b1028);});});}exports['GetVoiceQueueReport']=function(_0x3a8483){var _0x15316c=this;return new Promise(function(_0x594caa,_0x27cd18){return db['VoiceQueueReport']['findAll']({'raw':_0x3a8483[_0xd546('0x18')]?_0x3a8483[_0xd546('0x18')][_0xd546('0x19')]===undefined?!![]:![]:!![],'where':_0x3a8483[_0xd546('0x18')]?_0x3a8483[_0xd546('0x18')][_0xd546('0x1a')]||null:null,'attributes':_0x3a8483[_0xd546('0x18')]?_0x3a8483[_0xd546('0x18')]['attributes']||null:null,'limit':_0x3a8483['options']?_0x3a8483[_0xd546('0x18')][_0xd546('0x1b')]||null:null,'include':_0x3a8483['options']?_0x3a8483['options'][_0xd546('0x1c')]?_[_0xd546('0x1d')](_0x3a8483[_0xd546('0x18')][_0xd546('0x1c')],function(_0xf0e914){return{'model':db[_0xf0e914[_0xd546('0x1e')]],'as':_0xf0e914['as'],'attributes':_0xf0e914[_0xd546('0x1f')],'include':_0xf0e914[_0xd546('0x1c')]?_[_0xd546('0x1d')](_0xf0e914[_0xd546('0x1c')],function(_0x57e3b7){return{'model':db[_0x57e3b7[_0xd546('0x1e')]],'as':_0x57e3b7['as'],'attributes':_0x57e3b7[_0xd546('0x1f')],'include':_0x57e3b7[_0xd546('0x1c')]?_[_0xd546('0x1d')](_0x57e3b7[_0xd546('0x1c')],function(_0x58dd32){return{'model':db[_0x58dd32[_0xd546('0x1e')]],'as':_0x58dd32['as'],'attributes':_0x58dd32[_0xd546('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd546('0xf')](function(_0x150be3){logger['info']('GetVoiceQueueReport',_0x3a8483);logger[_0xd546('0x12')](_0xd546('0x20'),_0x3a8483,JSON[_0xd546('0x21')](_0x150be3));_0x594caa(_0x150be3);})[_0xd546('0x17')](function(_0x1fb0ac){logger[_0xd546('0x14')](_0xd546('0x20'),_0x1fb0ac[_0xd546('0x16')],_0x3a8483);_0x27cd18(_0x15316c[_0xd546('0x14')](0x1f4,_0x1fb0ac['message']));});});};exports[_0xd546('0x22')]=function(_0x567917){var _0x3d010f=this;return new Promise(function(_0x1a6a3f,_0x46c4d2){return db[_0xd546('0x23')][_0xd546('0x24')](_0x567917['body'],{'raw':_0x567917[_0xd546('0x18')]?_0x567917['options'][_0xd546('0x19')]===undefined?!![]:![]:!![]})[_0xd546('0xf')](function(_0x2bde19){logger[_0xd546('0x10')](_0xd546('0x22'),_0x567917);logger[_0xd546('0x12')](_0xd546('0x22'),_0x567917,JSON['stringify'](_0x2bde19));_0x1a6a3f(_0x2bde19);})['catch'](function(_0x49fed3){logger[_0xd546('0x14')]('CreateVoiceQueueReport',_0x49fed3[_0xd546('0x16')],_0x567917);_0x46c4d2(_0x3d010f[_0xd546('0x14')](0x1f4,_0x49fed3['message']));});});};exports[_0xd546('0x25')]=function(_0x337bbb){var _0x5131ad=this;return new Promise(function(_0x35d1f3,_0x3c2c67){return db['VoiceQueueReport'][_0xd546('0x26')](_0x337bbb[_0xd546('0x27')],{'raw':_0x337bbb[_0xd546('0x18')]?_0x337bbb[_0xd546('0x18')][_0xd546('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x337bbb[_0xd546('0x18')]?_0x337bbb[_0xd546('0x18')]['where']||null:null,'attributes':_0x337bbb['options']?_0x337bbb['options'][_0xd546('0x1f')]||null:null,'limit':_0x337bbb[_0xd546('0x18')]?_0x337bbb['options'][_0xd546('0x1b')]||null:null})[_0xd546('0xf')](function(_0x3e3519){logger[_0xd546('0x10')]('UpdateVoiceQueueReport',_0x337bbb);logger[_0xd546('0x12')](_0xd546('0x25'),_0x337bbb,JSON[_0xd546('0x21')](_0x3e3519));_0x35d1f3(_0x3e3519);})[_0xd546('0x17')](function(_0x5511bf){logger[_0xd546('0x14')](_0xd546('0x25'),_0x5511bf[_0xd546('0x16')],_0x337bbb);_0x3c2c67(_0x5131ad[_0xd546('0x14')](0x1f4,_0x5511bf[_0xd546('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 0c32e92..40ad3cc 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 _0xc1f1=['save','remove','removeListener','length','voiceQueueReport:'];(function(_0x24e6d3,_0x5a83be){var _0x4731f6=function(_0x41b97a){while(--_0x41b97a){_0x24e6d3['push'](_0x24e6d3['shift']());}};_0x4731f6(++_0x5a83be);}(_0xc1f1,0x122));var _0x1c1f=function(_0x2bb6dd,_0x252667){_0x2bb6dd=_0x2bb6dd-0x0;var _0x2a07dc=_0xc1f1[_0x2bb6dd];return _0x2a07dc;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x1c1f('0x0'),_0x1c1f('0x1'),'update'];function createListener(_0x293182,_0x5c0aec){return function(_0x218bc8){_0x5c0aec['emit'](_0x293182,_0x218bc8);};}function removeListener(_0x223189,_0x5f1d2e){return function(){VoiceQueueReportEvents[_0x1c1f('0x2')](_0x223189,_0x5f1d2e);};}exports['register']=function(_0x1940d7){for(var _0x2d91a5=0x0,_0x3d44be=events[_0x1c1f('0x3')];_0x2d91a5<_0x3d44be;_0x2d91a5++){var _0x2dd1e4=events[_0x2d91a5];var _0x34b9fc=createListener(_0x1c1f('0x4')+_0x2dd1e4,_0x1940d7);VoiceQueueReportEvents['on'](_0x2dd1e4,_0x34b9fc);}}; \ No newline at end of file +var _0x56a4=['removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','update','emit'];(function(_0xf099c6,_0x570f63){var _0x575964=function(_0x4646ca){while(--_0x4646ca){_0xf099c6['push'](_0xf099c6['shift']());}};_0x575964(++_0x570f63);}(_0x56a4,0x11b));var _0x456a=function(_0x2b8388,_0x246b8f){_0x2b8388=_0x2b8388-0x0;var _0x3ba12a=_0x56a4[_0x2b8388];return _0x3ba12a;};'use strict';var VoiceQueueReportEvents=require(_0x456a('0x0'));var events=[_0x456a('0x1'),'remove',_0x456a('0x2')];function createListener(_0x93d98f,_0x5f3fe1){return function(_0x478cac){_0x5f3fe1[_0x456a('0x3')](_0x93d98f,_0x478cac);};}function removeListener(_0x3a11ee,_0x143999){return function(){VoiceQueueReportEvents[_0x456a('0x4')](_0x3a11ee,_0x143999);};}exports[_0x456a('0x5')]=function(_0x4b8eec){for(var _0x3b0145=0x0,_0x52b38d=events['length'];_0x3b0145<_0x52b38d;_0x3b0145++){var _0x2b6329=events[_0x3b0145];var _0x20c8e0=createListener(_0x456a('0x6')+_0x2b6329,_0x4b8eec);VoiceQueueReportEvents['on'](_0x2b6329,_0x20c8e0);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b0aeaf9..821100e 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 _0xded4=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','show','post','create'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0xded4,0x19c));var _0x4ded=function(_0x5a60ad,_0x46c5f0){_0x5a60ad=_0x5a60ad-0x0;var _0xf49e04=_0xded4[_0x5a60ad];return _0xf49e04;};'use strict';var multer=require(_0x4ded('0x0'));var util=require(_0x4ded('0x1'));var path=require(_0x4ded('0x2'));var timeout=require(_0x4ded('0x3'));var express=require(_0x4ded('0x4'));var router=express[_0x4ded('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ded('0x6'));var config=require('../../config/environment');var controller=require(_0x4ded('0x7'));router[_0x4ded('0x8')]('/',auth[_0x4ded('0x9')](),controller['index']);router[_0x4ded('0x8')]('/:id',auth[_0x4ded('0x9')](),controller[_0x4ded('0xa')]);router[_0x4ded('0xb')]('/',auth['isAuthenticated'](),controller[_0x4ded('0xc')]);router['put']('/:id',auth[_0x4ded('0x9')](),controller['update']);router[_0x4ded('0xd')](_0x4ded('0xe'),auth[_0x4ded('0x9')](),controller[_0x4ded('0xf')]);module[_0x4ded('0x10')]=router; \ No newline at end of file +var _0x1333=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1333,0x167));var _0x3133=function(_0x4ca4f8,_0x50fd06){_0x4ca4f8=_0x4ca4f8-0x0;var _0x1a246c=_0x1333[_0x4ca4f8];return _0x1a246c;};'use strict';var multer=require(_0x3133('0x0'));var util=require(_0x3133('0x1'));var path=require(_0x3133('0x2'));var timeout=require(_0x3133('0x3'));var express=require(_0x3133('0x4'));var router=express['Router']();var fs_extra=require(_0x3133('0x5'));var auth=require(_0x3133('0x6'));var interaction=require(_0x3133('0x7'));var config=require(_0x3133('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x3133('0x9')]('/',auth['isAuthenticated'](),controller[_0x3133('0xa')]);router['get'](_0x3133('0xb'),auth['isAuthenticated'](),controller[_0x3133('0xc')]);router[_0x3133('0xd')]('/',auth[_0x3133('0xe')](),controller[_0x3133('0xf')]);router[_0x3133('0x10')](_0x3133('0xb'),auth['isAuthenticated'](),controller[_0x3133('0x11')]);router[_0x3133('0x12')](_0x3133('0xb'),auth[_0x3133('0xe')](),controller[_0x3133('0x13')]);module[_0x3133('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 93342db..7c5aa0f 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 _0xa867=['DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports','STRING'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xa867,0x1a1));var _0x7a86=function(_0x52937e,_0x4a47da){_0x52937e=_0x52937e-0x0;var _0x51be71=_0xa867[_0x52937e];return _0x51be71;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7a86('0x0'));module[_0x7a86('0x1')]={'time':{'type':Sequelize[_0x7a86('0x2')]},'callid':{'type':Sequelize[_0x7a86('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7a86('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7a86('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7a86('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7a86('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7a86('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7a86('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7a86('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7a86('0x3')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x7a86('0x4'))}}; \ No newline at end of file +var _0xc1ef=['STRING','literal','sequelize'];(function(_0x158bb8,_0x5f129b){var _0x3a643f=function(_0x2ee764){while(--_0x2ee764){_0x158bb8['push'](_0x158bb8['shift']());}};_0x3a643f(++_0x5f129b);}(_0xc1ef,0x116));var _0xfc1e=function(_0x551c7c,_0x47e998){_0x551c7c=_0x551c7c-0x0;var _0x3f044a=_0xc1ef[_0x551c7c];return _0x3f044a;};'use strict';var Sequelize=require(_0xfc1e('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xfc1e('0x1')]},'callid':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xfc1e('0x2')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index ce1d21b..39bf134 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 _0x5c80=['VoiceQueuesLog','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','options','where','include','findAll','show','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map'];(function(_0x32cab5,_0x2d689a){var _0x2d637f=function(_0x23bfa1){while(--_0x23bfa1){_0x32cab5['push'](_0x32cab5['shift']());}};_0x2d637f(++_0x2d689a);}(_0x5c80,0x136));var _0x05c8=function(_0x224745,_0x265df8){_0x224745=_0x224745-0x0;var _0x12d491=_0x5c80[_0x224745];return _0x12d491;};'use strict';var emlformat=require(_0x05c8('0x0'));var rimraf=require(_0x05c8('0x1'));var zipdir=require(_0x05c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05c8('0x3'));var moment=require(_0x05c8('0x4'));var BPromise=require(_0x05c8('0x5'));var Mustache=require('mustache');var util=require(_0x05c8('0x6'));var path=require(_0x05c8('0x7'));var sox=require('sox');var csv=require(_0x05c8('0x8'));var ejs=require(_0x05c8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x05c8('0xa'));var crypto=require(_0x05c8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x05c8('0xc'));var toCsv=require(_0x05c8('0x8'));var querystring=require('querystring');var Papa=require(_0x05c8('0xd'));var Redis=require(_0x05c8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x05c8('0xf'));var as=require(_0x05c8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05c8('0x11'))('api');var utils=require(_0x05c8('0x12'));var config=require(_0x05c8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x05c8('0x14'))['db'];function respondWithStatusCode(_0x4de8e8,_0x3a865d){_0x3a865d=_0x3a865d||0xcc;return function(_0x3af427){if(_0x3af427){return _0x4de8e8[_0x05c8('0x15')](_0x3a865d);}return _0x4de8e8[_0x05c8('0x16')](_0x3a865d)[_0x05c8('0x17')]();};}function respondWithResult(_0x16b2e2,_0x24b3c5){_0x24b3c5=_0x24b3c5||0xc8;return function(_0x1f7c60){if(_0x1f7c60){return _0x16b2e2[_0x05c8('0x16')](_0x24b3c5)['json'](_0x1f7c60);}};}function respondWithFilteredResult(_0x4b8fec,_0x73e758){return function(_0x57379b){if(_0x57379b){var _0x124ee6=typeof _0x73e758[_0x05c8('0x18')]===_0x05c8('0x19')&&typeof _0x73e758[_0x05c8('0x1a')]==='undefined';var _0x456aa5=_0x57379b[_0x05c8('0x1b')];var _0x34c843=_0x124ee6?0x0:_0x73e758[_0x05c8('0x18')];var _0x5b4f75=_0x124ee6?_0x57379b[_0x05c8('0x1b')]:_0x73e758[_0x05c8('0x18')]+_0x73e758[_0x05c8('0x1a')];var _0x4a68b9;if(_0x5b4f75>=_0x456aa5){_0x5b4f75=_0x456aa5;_0x4a68b9=0xc8;}else{_0x4a68b9=0xce;}_0x4b8fec[_0x05c8('0x16')](_0x4a68b9);return _0x4b8fec[_0x05c8('0x1c')]('Content-Range',_0x34c843+'-'+_0x5b4f75+'/'+_0x456aa5)['json'](_0x57379b);}return null;};}function patchUpdates(_0x3c9127){return function(_0x1c6a05){try{jsonpatch[_0x05c8('0x1d')](_0x1c6a05,_0x3c9127,!![]);}catch(_0x3f548b){return BPromise[_0x05c8('0x1e')](_0x3f548b);}return _0x1c6a05[_0x05c8('0x1f')]();};}function saveUpdates(_0x1af640,_0x4d36e3){return function(_0x1078cd){if(_0x1078cd){return _0x1078cd[_0x05c8('0x20')](_0x1af640)[_0x05c8('0x21')](function(_0x5e1379){return _0x5e1379;});}return null;};}function removeEntity(_0x107097,_0x43b10a){return function(_0x42f56a){if(_0x42f56a){return _0x42f56a['destroy']()[_0x05c8('0x21')](function(){_0x107097[_0x05c8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x306b29,_0x547d7b){return function(_0x1dc6ed){if(!_0x1dc6ed){_0x306b29['sendStatus'](0x194);}return _0x1dc6ed;};}function handleError(_0x121c14,_0xbc54e){_0xbc54e=_0xbc54e||0x1f4;return function(_0x56971c){logger[_0x05c8('0x22')](_0x56971c[_0x05c8('0x23')]);if(_0x56971c[_0x05c8('0x24')]){delete _0x56971c[_0x05c8('0x24')];}_0x121c14[_0x05c8('0x16')](_0xbc54e)[_0x05c8('0x25')](_0x56971c);};}exports[_0x05c8('0x26')]=function(_0x17ca28,_0x3d1261){var _0x1c7aed={},_0x25baf9={},_0x3a5c1b={'count':0x0,'rows':[]};var _0x571458=_[_0x05c8('0x27')](db[_0x05c8('0x28')][_0x05c8('0x29')],function(_0x485bdb){return{'name':_0x485bdb[_0x05c8('0x2a')],'type':_0x485bdb['type']['key']};});_0x25baf9[_0x05c8('0x2b')]=_['map'](_0x571458,_0x05c8('0x24'));_0x25baf9[_0x05c8('0x2c')]=_[_0x05c8('0x2d')](_0x17ca28[_0x05c8('0x2c')]);_0x25baf9[_0x05c8('0x2e')]=_[_0x05c8('0x2f')](_0x25baf9[_0x05c8('0x2b')],_0x25baf9['query']);_0x1c7aed[_0x05c8('0x30')]=_[_0x05c8('0x2f')](_0x25baf9[_0x05c8('0x2b')],qs[_0x05c8('0x31')](_0x17ca28[_0x05c8('0x2c')][_0x05c8('0x31')]));_0x1c7aed[_0x05c8('0x30')]=_0x1c7aed[_0x05c8('0x30')][_0x05c8('0x32')]?_0x1c7aed[_0x05c8('0x30')]:_0x25baf9[_0x05c8('0x2b')];if(!_0x17ca28['query'][_0x05c8('0x33')](_0x05c8('0x34'))){_0x1c7aed[_0x05c8('0x1a')]=qs[_0x05c8('0x1a')](_0x17ca28[_0x05c8('0x2c')]['limit']);_0x1c7aed[_0x05c8('0x18')]=qs[_0x05c8('0x18')](_0x17ca28['query'][_0x05c8('0x18')]);}_0x1c7aed['order']=qs[_0x05c8('0x35')](_0x17ca28[_0x05c8('0x2c')][_0x05c8('0x35')]);_0x1c7aed['where']=qs['filters'](_[_0x05c8('0x36')](_0x17ca28[_0x05c8('0x2c')],_0x25baf9[_0x05c8('0x2e')]),_0x571458);if(_0x17ca28[_0x05c8('0x2c')][_0x05c8('0x37')]){_0x1c7aed['where']=_[_0x05c8('0x38')](_0x1c7aed['where'],{'$or':_[_0x05c8('0x27')](_0x571458,function(_0x5ac74a){if(_0x5ac74a[_0x05c8('0x39')]!=='VIRTUAL'){var _0x18ad50={};_0x18ad50[_0x5ac74a[_0x05c8('0x24')]]={'$like':'%'+_0x17ca28[_0x05c8('0x2c')]['filter']+'%'};return _0x18ad50;}})});}_0x1c7aed=_['merge']({},_0x1c7aed,_0x17ca28[_0x05c8('0x3a')]);var _0x850f80={'where':_0x1c7aed[_0x05c8('0x3b')]};return db['VoiceQueuesLog']['count'](_0x850f80)[_0x05c8('0x21')](function(_0x3122fc){_0x3a5c1b[_0x05c8('0x1b')]=_0x3122fc;if(_0x17ca28[_0x05c8('0x2c')]['includeAll']){_0x1c7aed[_0x05c8('0x3c')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x05c8('0x3d')](_0x1c7aed);})[_0x05c8('0x21')](function(_0x54cdd4){_0x3a5c1b['rows']=_0x54cdd4;return _0x3a5c1b;})['then'](respondWithFilteredResult(_0x3d1261,_0x1c7aed))['catch'](handleError(_0x3d1261,null));};exports[_0x05c8('0x3e')]=function(_0x139b97,_0x558629){var _0x17d66a={'raw':!![],'where':{'id':_0x139b97['params']['id']}},_0x2e5ccb={};_0x2e5ccb['model']=_['keys'](db['VoiceQueuesLog'][_0x05c8('0x29')]);_0x2e5ccb[_0x05c8('0x2c')]=_[_0x05c8('0x2d')](_0x139b97[_0x05c8('0x2c')]);_0x2e5ccb['filters']=_[_0x05c8('0x2f')](_0x2e5ccb[_0x05c8('0x2b')],_0x2e5ccb[_0x05c8('0x2c')]);_0x17d66a[_0x05c8('0x30')]=_[_0x05c8('0x2f')](_0x2e5ccb[_0x05c8('0x2b')],qs[_0x05c8('0x31')](_0x139b97[_0x05c8('0x2c')][_0x05c8('0x31')]));_0x17d66a['attributes']=_0x17d66a[_0x05c8('0x30')]['length']?_0x17d66a[_0x05c8('0x30')]:_0x2e5ccb[_0x05c8('0x2b')];if(_0x139b97[_0x05c8('0x2c')][_0x05c8('0x3f')]){_0x17d66a[_0x05c8('0x3c')]=[{'all':!![]}];}_0x17d66a=_[_0x05c8('0x38')]({},_0x17d66a,_0x139b97[_0x05c8('0x3a')]);return db[_0x05c8('0x28')][_0x05c8('0x40')](_0x17d66a)['then'](handleEntityNotFound(_0x558629,null))[_0x05c8('0x21')](respondWithResult(_0x558629,null))[_0x05c8('0x41')](handleError(_0x558629,null));};exports[_0x05c8('0x42')]=function(_0x22ef87,_0x172ce2){return db[_0x05c8('0x28')][_0x05c8('0x42')](_0x22ef87[_0x05c8('0x43')],{})[_0x05c8('0x21')](respondWithResult(_0x172ce2,0xc9))[_0x05c8('0x41')](handleError(_0x172ce2,null));};exports['update']=function(_0x31d210,_0x3b886c){if(_0x31d210[_0x05c8('0x43')]['id']){delete _0x31d210[_0x05c8('0x43')]['id'];}return db[_0x05c8('0x28')][_0x05c8('0x40')]({'where':{'id':_0x31d210[_0x05c8('0x44')]['id']}})[_0x05c8('0x21')](handleEntityNotFound(_0x3b886c,null))[_0x05c8('0x21')](saveUpdates(_0x31d210[_0x05c8('0x43')],null))[_0x05c8('0x21')](respondWithResult(_0x3b886c,null))[_0x05c8('0x41')](handleError(_0x3b886c,null));};exports[_0x05c8('0x45')]=function(_0x30e009,_0x4b7e2f){return db[_0x05c8('0x28')]['find']({'where':{'id':_0x30e009[_0x05c8('0x44')]['id']}})[_0x05c8('0x21')](handleEntityNotFound(_0x4b7e2f,null))[_0x05c8('0x21')](removeEntity(_0x4b7e2f,null))['catch'](handleError(_0x4b7e2f,null));}; \ No newline at end of file +var _0x1c96=['keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','key'];(function(_0x14596a,_0x2ed823){var _0x235ea5=function(_0x996da7){while(--_0x996da7){_0x14596a['push'](_0x14596a['shift']());}};_0x235ea5(++_0x2ed823);}(_0x1c96,0x105));var _0x61c9=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x1c96[_0x519756];return _0x37047e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x61c9('0x0'));var zipdir=require(_0x61c9('0x1'));var jsonpatch=require(_0x61c9('0x2'));var rp=require(_0x61c9('0x3'));var moment=require('moment');var BPromise=require(_0x61c9('0x4'));var Mustache=require('mustache');var util=require(_0x61c9('0x5'));var path=require(_0x61c9('0x6'));var sox=require(_0x61c9('0x7'));var csv=require(_0x61c9('0x8'));var ejs=require(_0x61c9('0x9'));var fs=require('fs');var fs_extra=require(_0x61c9('0xa'));var _=require('lodash');var squel=require(_0x61c9('0xb'));var crypto=require(_0x61c9('0xc'));var jsforce=require(_0x61c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x61c9('0x8'));var querystring=require(_0x61c9('0xe'));var Papa=require(_0x61c9('0xf'));var Redis=require(_0x61c9('0x10'));var authService=require(_0x61c9('0x11'));var qs=require(_0x61c9('0x12'));var as=require(_0x61c9('0x13'));var hardwareService=require(_0x61c9('0x14'));var logger=require(_0x61c9('0x15'))(_0x61c9('0x16'));var utils=require(_0x61c9('0x17'));var config=require(_0x61c9('0x18'));var licenseUtil=require(_0x61c9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4336f9,_0x48d231){_0x48d231=_0x48d231||0xcc;return function(_0x47b76d){if(_0x47b76d){return _0x4336f9['sendStatus'](_0x48d231);}return _0x4336f9[_0x61c9('0x1a')](_0x48d231)[_0x61c9('0x1b')]();};}function respondWithResult(_0x5b2c11,_0x1be50f){_0x1be50f=_0x1be50f||0xc8;return function(_0x3a93b8){if(_0x3a93b8){return _0x5b2c11[_0x61c9('0x1a')](_0x1be50f)['json'](_0x3a93b8);}};}function respondWithFilteredResult(_0x2cb4a0,_0x1be953){return function(_0x4823df){if(_0x4823df){var _0x44b0c0=typeof _0x1be953['offset']===_0x61c9('0x1c')&&typeof _0x1be953[_0x61c9('0x1d')]===_0x61c9('0x1c');var _0x716b3e=_0x4823df[_0x61c9('0x1e')];var _0x596db5=_0x44b0c0?0x0:_0x1be953[_0x61c9('0x1f')];var _0x1efc7d=_0x44b0c0?_0x4823df[_0x61c9('0x1e')]:_0x1be953[_0x61c9('0x1f')]+_0x1be953['limit'];var _0x1a0543;if(_0x1efc7d>=_0x716b3e){_0x1efc7d=_0x716b3e;_0x1a0543=0xc8;}else{_0x1a0543=0xce;}_0x2cb4a0['status'](_0x1a0543);return _0x2cb4a0['set'](_0x61c9('0x20'),_0x596db5+'-'+_0x1efc7d+'/'+_0x716b3e)[_0x61c9('0x21')](_0x4823df);}return null;};}function patchUpdates(_0x3175f6){return function(_0x2c0bf4){try{jsonpatch[_0x61c9('0x22')](_0x2c0bf4,_0x3175f6,!![]);}catch(_0x244694){return BPromise[_0x61c9('0x23')](_0x244694);}return _0x2c0bf4[_0x61c9('0x24')]();};}function saveUpdates(_0x5a0fa4,_0x4d5e19){return function(_0x1518b6){if(_0x1518b6){return _0x1518b6[_0x61c9('0x25')](_0x5a0fa4)['then'](function(_0x4e5d88){return _0x4e5d88;});}return null;};}function removeEntity(_0x3101ee,_0x1113f0){return function(_0x485e0a){if(_0x485e0a){return _0x485e0a[_0x61c9('0x26')]()[_0x61c9('0x27')](function(){_0x3101ee[_0x61c9('0x1a')](0xcc)[_0x61c9('0x1b')]();});}};}function handleEntityNotFound(_0x3b4dfa,_0x8efc4a){return function(_0x40dc9a){if(!_0x40dc9a){_0x3b4dfa[_0x61c9('0x28')](0x194);}return _0x40dc9a;};}function handleError(_0x264085,_0x3a1408){_0x3a1408=_0x3a1408||0x1f4;return function(_0x4e46df){logger[_0x61c9('0x29')](_0x4e46df[_0x61c9('0x2a')]);if(_0x4e46df[_0x61c9('0x2b')]){delete _0x4e46df[_0x61c9('0x2b')];}_0x264085[_0x61c9('0x1a')](_0x3a1408)[_0x61c9('0x2c')](_0x4e46df);};}exports[_0x61c9('0x2d')]=function(_0x4308df,_0x41b037){var _0x8c304={},_0x5a327d={},_0x3132e8={'count':0x0,'rows':[]};var _0x44e95e=_[_0x61c9('0x2e')](db[_0x61c9('0x2f')]['rawAttributes'],function(_0x2d92d7){return{'name':_0x2d92d7[_0x61c9('0x30')],'type':_0x2d92d7[_0x61c9('0x31')][_0x61c9('0x32')]};});_0x5a327d['model']=_[_0x61c9('0x2e')](_0x44e95e,'name');_0x5a327d['query']=_[_0x61c9('0x33')](_0x4308df[_0x61c9('0x34')]);_0x5a327d[_0x61c9('0x35')]=_['intersection'](_0x5a327d[_0x61c9('0x36')],_0x5a327d[_0x61c9('0x34')]);_0x8c304[_0x61c9('0x37')]=_['intersection'](_0x5a327d['model'],qs[_0x61c9('0x38')](_0x4308df[_0x61c9('0x34')][_0x61c9('0x38')]));_0x8c304['attributes']=_0x8c304['attributes'][_0x61c9('0x39')]?_0x8c304[_0x61c9('0x37')]:_0x5a327d[_0x61c9('0x36')];if(!_0x4308df[_0x61c9('0x34')][_0x61c9('0x3a')](_0x61c9('0x3b'))){_0x8c304[_0x61c9('0x1d')]=qs['limit'](_0x4308df[_0x61c9('0x34')][_0x61c9('0x1d')]);_0x8c304[_0x61c9('0x1f')]=qs[_0x61c9('0x1f')](_0x4308df[_0x61c9('0x34')]['offset']);}_0x8c304['order']=qs[_0x61c9('0x3c')](_0x4308df[_0x61c9('0x34')][_0x61c9('0x3c')]);_0x8c304['where']=qs[_0x61c9('0x35')](_[_0x61c9('0x3d')](_0x4308df[_0x61c9('0x34')],_0x5a327d[_0x61c9('0x35')]),_0x44e95e);if(_0x4308df[_0x61c9('0x34')][_0x61c9('0x3e')]){_0x8c304[_0x61c9('0x3f')]=_[_0x61c9('0x40')](_0x8c304[_0x61c9('0x3f')],{'$or':_[_0x61c9('0x2e')](_0x44e95e,function(_0x1e94fe){if(_0x1e94fe['type']!==_0x61c9('0x41')){var _0x21fa85={};_0x21fa85[_0x1e94fe[_0x61c9('0x2b')]]={'$like':'%'+_0x4308df[_0x61c9('0x34')][_0x61c9('0x3e')]+'%'};return _0x21fa85;}})});}_0x8c304=_[_0x61c9('0x40')]({},_0x8c304,_0x4308df[_0x61c9('0x42')]);var _0x32e788={'where':_0x8c304['where']};return db[_0x61c9('0x2f')][_0x61c9('0x1e')](_0x32e788)['then'](function(_0x341861){_0x3132e8[_0x61c9('0x1e')]=_0x341861;if(_0x4308df['query']['includeAll']){_0x8c304[_0x61c9('0x43')]=[{'all':!![]}];}return db[_0x61c9('0x2f')][_0x61c9('0x44')](_0x8c304);})['then'](function(_0x1c644a){_0x3132e8['rows']=_0x1c644a;return _0x3132e8;})[_0x61c9('0x27')](respondWithFilteredResult(_0x41b037,_0x8c304))[_0x61c9('0x45')](handleError(_0x41b037,null));};exports[_0x61c9('0x46')]=function(_0x2100ae,_0x5346fc){var _0x8794fb={'raw':!![],'where':{'id':_0x2100ae[_0x61c9('0x47')]['id']}},_0x46f5cf={};_0x46f5cf[_0x61c9('0x36')]=_[_0x61c9('0x33')](db[_0x61c9('0x2f')][_0x61c9('0x48')]);_0x46f5cf[_0x61c9('0x34')]=_[_0x61c9('0x33')](_0x2100ae['query']);_0x46f5cf[_0x61c9('0x35')]=_['intersection'](_0x46f5cf['model'],_0x46f5cf[_0x61c9('0x34')]);_0x8794fb[_0x61c9('0x37')]=_[_0x61c9('0x49')](_0x46f5cf[_0x61c9('0x36')],qs[_0x61c9('0x38')](_0x2100ae[_0x61c9('0x34')][_0x61c9('0x38')]));_0x8794fb[_0x61c9('0x37')]=_0x8794fb[_0x61c9('0x37')][_0x61c9('0x39')]?_0x8794fb['attributes']:_0x46f5cf[_0x61c9('0x36')];if(_0x2100ae['query'][_0x61c9('0x4a')]){_0x8794fb[_0x61c9('0x43')]=[{'all':!![]}];}_0x8794fb=_[_0x61c9('0x40')]({},_0x8794fb,_0x2100ae[_0x61c9('0x42')]);return db['VoiceQueuesLog'][_0x61c9('0x4b')](_0x8794fb)[_0x61c9('0x27')](handleEntityNotFound(_0x5346fc,null))['then'](respondWithResult(_0x5346fc,null))['catch'](handleError(_0x5346fc,null));};exports[_0x61c9('0x4c')]=function(_0x4c7734,_0xd2a9e0){return db['VoiceQueuesLog'][_0x61c9('0x4c')](_0x4c7734[_0x61c9('0x4d')],{})[_0x61c9('0x27')](respondWithResult(_0xd2a9e0,0xc9))['catch'](handleError(_0xd2a9e0,null));};exports[_0x61c9('0x25')]=function(_0x187a92,_0x2ed6bf){if(_0x187a92[_0x61c9('0x4d')]['id']){delete _0x187a92[_0x61c9('0x4d')]['id'];}return db[_0x61c9('0x2f')][_0x61c9('0x4b')]({'where':{'id':_0x187a92[_0x61c9('0x47')]['id']}})[_0x61c9('0x27')](handleEntityNotFound(_0x2ed6bf,null))[_0x61c9('0x27')](saveUpdates(_0x187a92[_0x61c9('0x4d')],null))[_0x61c9('0x27')](respondWithResult(_0x2ed6bf,null))[_0x61c9('0x45')](handleError(_0x2ed6bf,null));};exports[_0x61c9('0x26')]=function(_0x2a3796,_0x20b69d){return db[_0x61c9('0x2f')][_0x61c9('0x4b')]({'where':{'id':_0x2a3796[_0x61c9('0x47')]['id']}})['then'](handleEntityNotFound(_0x20b69d,null))[_0x61c9('0x27')](removeEntity(_0x20b69d,null))['catch'](handleError(_0x20b69d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c795706..494fa1b 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 _0x2953=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','event','dtm'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x2953,0x1cc));var _0x3295=function(_0x3adea2,_0x329477){_0x3adea2=_0x3adea2-0x0;var _0x2cf6aa=_0x2953[_0x3adea2];return _0x2cf6aa;};'use strict';var _=require(_0x3295('0x0'));var util=require('util');var logger=require(_0x3295('0x1'))(_0x3295('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3295('0x3'));var fs=require('fs');var path=require(_0x3295('0x4'));var rimraf=require(_0x3295('0x5'));var config=require(_0x3295('0x6'));var attributes=require(_0x3295('0x7'));module['exports']=function(_0x43a7b9,_0x37063b){return _0x43a7b9['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x3295('0x8'),_0x3295('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe13e=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','../../config/logger','api','moment'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xe13e,0xde));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee13('0x0'))(_0xee13('0x1'));var moment=require(_0xee13('0x2'));var BPromise=require(_0xee13('0x3'));var rp=require(_0xee13('0x4'));var fs=require('fs');var path=require(_0xee13('0x5'));var rimraf=require(_0xee13('0x6'));var config=require(_0xee13('0x7'));var attributes=require(_0xee13('0x8'));module[_0xee13('0x9')]=function(_0x43cfb0,_0x48e7b0){return _0x43cfb0[_0xee13('0xa')](_0xee13('0xb'),attributes,{'tableName':_0xee13('0xc'),'paranoid':![],'indexes':[{'name':_0xee13('0xd'),'fields':['event',_0xee13('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ab726ce..5a2f4c0 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 _0xcdc2=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1f011c,_0x36b16a){var _0x41123e=function(_0x263f05){while(--_0x263f05){_0x1f011c['push'](_0x1f011c['shift']());}};_0x41123e(++_0x36b16a);}(_0xcdc2,0x13d));var _0x2cdc=function(_0xa3fc0d,_0x253920){_0xa3fc0d=_0xa3fc0d-0x0;var _0x2ec8ab=_0xcdc2[_0xa3fc0d];return _0x2ec8ab;};'use strict';var _=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var moment=require(_0x2cdc('0x2'));var BPromise=require(_0x2cdc('0x3'));var rs=require(_0x2cdc('0x4'));var fs=require('fs');var Redis=require(_0x2cdc('0x5'));var db=require(_0x2cdc('0x6'))['db'];var utils=require(_0x2cdc('0x7'));var logger=require('../../config/logger')(_0x2cdc('0x8'));var config=require(_0x2cdc('0x9'));var jayson=require(_0x2cdc('0xa'));var client=jayson[_0x2cdc('0xb')][_0x2cdc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb2bdfd,_0x5e438b,_0x492329){return new BPromise(function(_0xe2c158,_0x3e5b2a){return client[_0x2cdc('0xd')](_0xb2bdfd,_0x492329)[_0x2cdc('0xe')](function(_0x5e7b2a){logger[_0x2cdc('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5e438b,'request\x20sent');logger[_0x2cdc('0x10')](_0x2cdc('0x11'),_0x5e438b,_0x2cdc('0x12'),JSON[_0x2cdc('0x13')](_0x5e7b2a));if(_0x5e7b2a['error']){if(_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x15')]===0x1f4){logger['error'](_0x2cdc('0x16'),_0x5e438b,_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x17')]);return _0x3e5b2a(_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x17')]);}logger[_0x2cdc('0x14')](_0x2cdc('0x16'),_0x5e438b,_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x17')]);return _0xe2c158(_0x5e7b2a['error']['message']);}else{logger[_0x2cdc('0xf')](_0x2cdc('0x16'),_0x5e438b,_0x2cdc('0x12'));_0xe2c158(_0x5e7b2a['result'][_0x2cdc('0x17')]);}})[_0x2cdc('0x18')](function(_0x5697df){logger[_0x2cdc('0x14')](_0x2cdc('0x16'),_0x5e438b,_0x5697df);_0x3e5b2a(_0x5697df);});});} \ No newline at end of file +var _0x894f=['jayson/promise','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x564d65,_0x16321b){var _0x100f18=function(_0x549dd8){while(--_0x549dd8){_0x564d65['push'](_0x564d65['shift']());}};_0x100f18(++_0x16321b);}(_0x894f,0x14d));var _0xf894=function(_0x5a2151,_0x241ab6){_0x5a2151=_0x5a2151-0x0;var _0xa4eec1=_0x894f[_0x5a2151];return _0xa4eec1;};'use strict';var _=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var moment=require(_0xf894('0x2'));var BPromise=require(_0xf894('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf894('0x4'))['db'];var utils=require(_0xf894('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf894('0x6'));var jayson=require(_0xf894('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23a9fc,_0x371f86,_0x56d9d6){return new BPromise(function(_0x190cb1,_0x3d8f21){return client[_0xf894('0x8')](_0x23a9fc,_0x56d9d6)[_0xf894('0x9')](function(_0x10bb84){logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));logger[_0xf894('0xd')](_0xf894('0xe'),_0x371f86,_0xf894('0xc'),JSON[_0xf894('0xf')](_0x10bb84));if(_0x10bb84[_0xf894('0x10')]){if(_0x10bb84[_0xf894('0x10')][_0xf894('0x11')]===0x1f4){logger[_0xf894('0x10')](_0xf894('0xb'),_0x371f86,_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);return _0x3d8f21(_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);}logger[_0xf894('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x371f86,_0x10bb84[_0xf894('0x10')]['message']);return _0x190cb1(_0x10bb84['error'][_0xf894('0x12')]);}else{logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));_0x190cb1(_0x10bb84[_0xf894('0x13')]['message']);}})['catch'](function(_0x1865be){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x371f86,_0x1865be);_0x3d8f21(_0x1865be);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 00b8c2d..19643a9 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 _0xa7e8=['fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','/describe','isAuthenticated','describe','show','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','connect-timeout'];(function(_0x35a384,_0x1e102e){var _0x3d6e8e=function(_0xd06b9a){while(--_0xd06b9a){_0x35a384['push'](_0x35a384['shift']());}};_0x3d6e8e(++_0x1e102e);}(_0xa7e8,0xaf));var _0x8a7e=function(_0x39e146,_0x22d96e){_0x39e146=_0x39e146-0x0;var _0x4e6678=_0xa7e8[_0x39e146];return _0x4e6678;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8a7e('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8a7e('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8a7e('0x2'));var config=require(_0x8a7e('0x3'));var controller=require(_0x8a7e('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x8a7e('0x5')]);router[_0x8a7e('0x6')](_0x8a7e('0x7'),auth[_0x8a7e('0x8')](),controller[_0x8a7e('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8a7e('0xa')]);router[_0x8a7e('0x6')]('/:id/download',auth[_0x8a7e('0x8')](),controller['download']);router[_0x8a7e('0x6')](_0x8a7e('0xb'),controller[_0x8a7e('0xc')]);router[_0x8a7e('0x6')](_0x8a7e('0xd'),auth[_0x8a7e('0x8')](),controller[_0x8a7e('0xe')]);router[_0x8a7e('0xf')]('/',auth[_0x8a7e('0x8')](),controller[_0x8a7e('0x10')]);router[_0x8a7e('0xf')](_0x8a7e('0xd'),auth['isAuthenticated'](),controller[_0x8a7e('0x11')]);router[_0x8a7e('0x12')](_0x8a7e('0x13'),auth[_0x8a7e('0x8')](),controller[_0x8a7e('0x14')]);router[_0x8a7e('0x15')](_0x8a7e('0x13'),auth[_0x8a7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4c3b=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/downloads','downloads','/:id/transcribe','create','post','runTranscribe','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14a709,_0x2ea79b){var _0x3b0094=function(_0x573959){while(--_0x573959){_0x14a709['push'](_0x14a709['shift']());}};_0x3b0094(++_0x2ea79b);}(_0x4c3b,0xe8));var _0xb4c3=function(_0x4309aa,_0x2089ef){_0x4309aa=_0x4309aa-0x0;var _0x222d21=_0x4c3b[_0x4309aa];return _0x222d21;};'use strict';var multer=require(_0xb4c3('0x0'));var util=require(_0xb4c3('0x1'));var path=require(_0xb4c3('0x2'));var timeout=require(_0xb4c3('0x3'));var express=require(_0xb4c3('0x4'));var router=express[_0xb4c3('0x5')]();var fs_extra=require(_0xb4c3('0x6'));var auth=require(_0xb4c3('0x7'));var interaction=require(_0xb4c3('0x8'));var config=require(_0xb4c3('0x9'));var controller=require('./voiceRecording.controller');router[_0xb4c3('0xa')]('/',auth['isAuthenticated'](),controller[_0xb4c3('0xb')]);router[_0xb4c3('0xa')](_0xb4c3('0xc'),auth[_0xb4c3('0xd')](),controller[_0xb4c3('0xe')]);router['get'](_0xb4c3('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xb4c3('0xa')]('/:id/download',auth[_0xb4c3('0xd')](),controller['download']);router[_0xb4c3('0xa')](_0xb4c3('0x10'),controller[_0xb4c3('0x11')]);router[_0xb4c3('0xa')](_0xb4c3('0x12'),auth[_0xb4c3('0xd')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0xb4c3('0x13')]);router[_0xb4c3('0x14')](_0xb4c3('0x12'),auth[_0xb4c3('0xd')](),controller[_0xb4c3('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb4c3('0x16')]('/:id',auth[_0xb4c3('0xd')](),controller[_0xb4c3('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d7af5ac..a7d18a8 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(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_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(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index df95b9c..9b0d4e0 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 _0xef07=['VoiceRecording','fieldName','type','key','differenceBy','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','catch','show','params','rawAttributes','length','include','find','create','body','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','secrets','recording','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','downloads','sequelize','MD5','token','$and','push','decryptFile','Sequelize','ValidationError','download','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','name','send','map'];(function(_0x1b72bd,_0x61af1c){var _0x241917=function(_0x176122){while(--_0x176122){_0x1b72bd['push'](_0x1b72bd['shift']());}};_0x241917(++_0x61af1c);}(_0xef07,0xfa));var _0x7ef0=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xef07[_0x1bb58c];return _0x277586;};'use strict';var emlformat=require(_0x7ef0('0x0'));var rimraf=require(_0x7ef0('0x1'));var zipdir=require(_0x7ef0('0x2'));var jsonpatch=require(_0x7ef0('0x3'));var rp=require(_0x7ef0('0x4'));var moment=require('moment');var BPromise=require(_0x7ef0('0x5'));var Mustache=require(_0x7ef0('0x6'));var util=require(_0x7ef0('0x7'));var path=require('path');var sox=require(_0x7ef0('0x8'));var csv=require(_0x7ef0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ef0('0xa'));var _=require(_0x7ef0('0xb'));var squel=require(_0x7ef0('0xc'));var crypto=require('crypto');var jsforce=require(_0x7ef0('0xd'));var deskjs=require(_0x7ef0('0xe'));var toCsv=require(_0x7ef0('0x9'));var querystring=require(_0x7ef0('0xf'));var Papa=require(_0x7ef0('0x10'));var AWS=require(_0x7ef0('0x11'));var uuidv4=require(_0x7ef0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7ef0('0x13'));var as=require(_0x7ef0('0x14'));var hardwareService=require(_0x7ef0('0x15'));var logger=require('../../config/logger')(_0x7ef0('0x16'));var utils=require(_0x7ef0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7ef0('0x18'));var db=require(_0x7ef0('0x19'))['db'];function respondWithStatusCode(_0x16a16f,_0x4a87c3){_0x4a87c3=_0x4a87c3||0xcc;return function(_0x576507){if(_0x576507){return _0x16a16f[_0x7ef0('0x1a')](_0x4a87c3);}return _0x16a16f[_0x7ef0('0x1b')](_0x4a87c3)[_0x7ef0('0x1c')]();};}function respondWithResult(_0x53f66f,_0x31d0c7){_0x31d0c7=_0x31d0c7||0xc8;return function(_0x2215a7){if(_0x2215a7){return _0x53f66f[_0x7ef0('0x1b')](_0x31d0c7)[_0x7ef0('0x1d')](_0x2215a7);}};}function respondWithFilteredResult(_0x1847d1,_0xa5f8c4){return function(_0x31f194){if(_0x31f194){var _0x2bea21=typeof _0xa5f8c4[_0x7ef0('0x1e')]===_0x7ef0('0x1f')&&typeof _0xa5f8c4[_0x7ef0('0x20')]===_0x7ef0('0x1f');var _0x35edae=_0x31f194[_0x7ef0('0x21')];var _0x695434=_0x2bea21?0x0:_0xa5f8c4[_0x7ef0('0x1e')];var _0x2defd2=_0x2bea21?_0x31f194['count']:_0xa5f8c4[_0x7ef0('0x1e')]+_0xa5f8c4['limit'];var _0x24f6e0;if(_0x2defd2>=_0x35edae){_0x2defd2=_0x35edae;_0x24f6e0=0xc8;}else{_0x24f6e0=0xce;}_0x1847d1['status'](_0x24f6e0);return _0x1847d1[_0x7ef0('0x22')](_0x7ef0('0x23'),_0x695434+'-'+_0x2defd2+'/'+_0x35edae)['json'](_0x31f194);}return null;};}function patchUpdates(_0x28d89e){return function(_0x198d3d){try{jsonpatch['apply'](_0x198d3d,_0x28d89e,!![]);}catch(_0x112dda){return BPromise['reject'](_0x112dda);}return _0x198d3d[_0x7ef0('0x24')]();};}function saveUpdates(_0xc98523,_0x522c06){return function(_0x420488){if(_0x420488){return _0x420488[_0x7ef0('0x25')](_0xc98523)[_0x7ef0('0x26')](function(_0x309e8d){return _0x309e8d;});}return null;};}function removeEntity(_0x382860,_0x4c317a){return function(_0x27a574){if(_0x27a574){return _0x27a574[_0x7ef0('0x27')]()[_0x7ef0('0x26')](function(){_0x382860[_0x7ef0('0x1b')](0xcc)[_0x7ef0('0x1c')]();});}};}function handleEntityNotFound(_0x247112,_0x1a570c){return function(_0x1df3bd){if(!_0x1df3bd){_0x247112[_0x7ef0('0x1a')](0x194);}return _0x1df3bd;};}function handleError(_0x1ce54a,_0x4ec34b){_0x4ec34b=_0x4ec34b||0x1f4;return function(_0x5e6fdc){logger[_0x7ef0('0x28')](_0x5e6fdc['stack']);if(_0x5e6fdc['name']){delete _0x5e6fdc[_0x7ef0('0x29')];}_0x1ce54a[_0x7ef0('0x1b')](_0x4ec34b)[_0x7ef0('0x2a')](_0x5e6fdc);};}exports['index']=function(_0x4f372a,_0x33c79c){var _0x1085c2={},_0x16a1cf={},_0x2119a1={'count':0x0,'rows':[]};var _0x15885c=_[_0x7ef0('0x2b')](db[_0x7ef0('0x2c')]['rawAttributes'],function(_0x4094f0){return{'name':_0x4094f0[_0x7ef0('0x2d')],'type':_0x4094f0[_0x7ef0('0x2e')][_0x7ef0('0x2f')]};});_0x16a1cf['model']=_[_0x7ef0('0x30')](_['map'](_0x15885c,_0x7ef0('0x29')),['format']);_0x16a1cf[_0x7ef0('0x31')]=_[_0x7ef0('0x32')](_0x4f372a[_0x7ef0('0x31')]);_0x16a1cf[_0x7ef0('0x33')]=_[_0x7ef0('0x34')](_0x16a1cf['model'],_0x16a1cf[_0x7ef0('0x31')]);_0x1085c2[_0x7ef0('0x35')]=_[_0x7ef0('0x34')](_0x16a1cf['model'],qs[_0x7ef0('0x36')](_0x4f372a[_0x7ef0('0x31')][_0x7ef0('0x36')]));_0x1085c2[_0x7ef0('0x35')]=_0x1085c2[_0x7ef0('0x35')]['length']?_0x1085c2[_0x7ef0('0x35')]:_0x16a1cf[_0x7ef0('0x37')];if(!_0x4f372a[_0x7ef0('0x31')][_0x7ef0('0x38')]('nolimit')){_0x1085c2[_0x7ef0('0x20')]=qs[_0x7ef0('0x20')](_0x4f372a[_0x7ef0('0x31')][_0x7ef0('0x20')]);_0x1085c2[_0x7ef0('0x1e')]=qs['offset'](_0x4f372a[_0x7ef0('0x31')][_0x7ef0('0x1e')]);}_0x1085c2[_0x7ef0('0x39')]=qs[_0x7ef0('0x3a')](_0x4f372a[_0x7ef0('0x31')][_0x7ef0('0x3a')]);_0x1085c2[_0x7ef0('0x3b')]=qs[_0x7ef0('0x33')](_[_0x7ef0('0x3c')](_0x4f372a[_0x7ef0('0x31')],_0x16a1cf[_0x7ef0('0x33')]),_0x15885c);if(_0x4f372a['query'][_0x7ef0('0x3d')]){_0x1085c2[_0x7ef0('0x3b')]=_[_0x7ef0('0x3e')](_0x1085c2['where'],{'$or':_[_0x7ef0('0x2b')](_0x15885c,function(_0x1c22e8){if(_0x1c22e8[_0x7ef0('0x2e')]!==_0x7ef0('0x3f')){var _0x1e1c8f={};_0x1e1c8f[_0x1c22e8[_0x7ef0('0x29')]]={'$like':'%'+_0x4f372a[_0x7ef0('0x31')][_0x7ef0('0x3d')]+'%'};return _0x1e1c8f;}})});}_0x1085c2=_['merge']({},_0x1085c2,_0x4f372a[_0x7ef0('0x40')]);var _0x5aa288={'where':_0x1085c2[_0x7ef0('0x3b')]};return db['VoiceRecording']['count'](_0x5aa288)[_0x7ef0('0x26')](function(_0x548c81){_0x2119a1[_0x7ef0('0x21')]=_0x548c81;if(_0x4f372a['query']['includeAll']){_0x1085c2['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x1085c2);})[_0x7ef0('0x26')](function(_0x1f23fe){_0x2119a1['rows']=_0x1f23fe;return _0x2119a1;})[_0x7ef0('0x26')](respondWithFilteredResult(_0x33c79c,_0x1085c2))[_0x7ef0('0x41')](handleError(_0x33c79c,null));};exports[_0x7ef0('0x42')]=function(_0x485f5e,_0x54206b){var _0x420b91={'raw':![],'where':{'id':_0x485f5e[_0x7ef0('0x43')]['id']}},_0x4660e5={};_0x4660e5[_0x7ef0('0x37')]=_['keys'](db['VoiceRecording'][_0x7ef0('0x44')]);_0x4660e5['query']=_['keys'](_0x485f5e['query']);_0x4660e5[_0x7ef0('0x33')]=_[_0x7ef0('0x34')](_0x4660e5[_0x7ef0('0x37')],_0x4660e5['query']);_0x420b91[_0x7ef0('0x35')]=_['intersection'](_0x4660e5['model'],qs['fields'](_0x485f5e['query'][_0x7ef0('0x36')]));_0x420b91[_0x7ef0('0x35')]=_0x420b91[_0x7ef0('0x35')][_0x7ef0('0x45')]?_0x420b91[_0x7ef0('0x35')]:_0x4660e5[_0x7ef0('0x37')];if(_0x485f5e[_0x7ef0('0x31')]['includeAll']){_0x420b91[_0x7ef0('0x46')]=[{'all':!![]}];}_0x420b91=_['merge']({},_0x420b91,_0x485f5e[_0x7ef0('0x40')]);return db[_0x7ef0('0x2c')][_0x7ef0('0x47')](_0x420b91)[_0x7ef0('0x26')](handleEntityNotFound(_0x54206b,null))[_0x7ef0('0x26')](respondWithResult(_0x54206b,null))[_0x7ef0('0x41')](handleError(_0x54206b,null));};exports['create']=function(_0x460b36,_0x738983){return db[_0x7ef0('0x2c')][_0x7ef0('0x48')](_0x460b36['body'],{})[_0x7ef0('0x26')](respondWithResult(_0x738983,0xc9))['catch'](handleError(_0x738983,null));};exports[_0x7ef0('0x25')]=function(_0x7ebce0,_0xc92c10){if(_0x7ebce0[_0x7ef0('0x49')]['id']){delete _0x7ebce0['body']['id'];}return db[_0x7ef0('0x2c')][_0x7ef0('0x47')]({'where':{'id':_0x7ebce0['params']['id']}})['then'](handleEntityNotFound(_0xc92c10,null))[_0x7ef0('0x26')](saveUpdates(_0x7ebce0[_0x7ef0('0x49')],null))['then'](respondWithResult(_0xc92c10,null))[_0x7ef0('0x41')](handleError(_0xc92c10,null));};exports[_0x7ef0('0x4a')]=function(_0xa55d7e,_0x3ee540){return db[_0x7ef0('0x2c')]['describe']()['then'](respondWithResult(_0x3ee540,null))[_0x7ef0('0x41')](handleError(_0x3ee540,null));};exports['download']=function(_0x19fbae,_0x510d77,_0x33ab8b){var _0x2f1581=require(_0x7ef0('0x4b'));var _0x1a77c7=![];var _0x21f293={};if(_0x19fbae[_0x7ef0('0x31')][_0x7ef0('0x2e')]&&_0x19fbae[_0x7ef0('0x31')][_0x7ef0('0x2e')]===_0x7ef0('0x4c')){_0x21f293['uniqueid']=_0x19fbae[_0x7ef0('0x43')]['id'];}else{_0x21f293['id']=_0x19fbae[_0x7ef0('0x43')]['id'];}return db[_0x7ef0('0x2c')][_0x7ef0('0x47')]({'where':_0x21f293,'attributes':['id',_0x7ef0('0x4d')],'raw':!![]})[_0x7ef0('0x26')](handleEntityNotFound(_0x510d77,null))[_0x7ef0('0x26')](function(_0x449d8e){if(_0x449d8e){var _0x5006c9=_0x449d8e[_0x7ef0('0x4d')];var _0x43178e=util[_0x7ef0('0x4e')](_0x7ef0('0x4f'),_0x5006c9);if(fs[_0x7ef0('0x50')](_0x43178e)){_0x1a77c7=!![];return _0x2f1581['decryptFile'](_0x43178e,_0x5006c9,config[_0x7ef0('0x51')][_0x7ef0('0x52')])[_0x7ef0('0x26')](function(){return _0x449d8e;});}return _0x449d8e;}})['then'](function(_0x101943){if(_0x101943){var _0x51dd52=_0x101943['value'];if(!fs['existsSync'](_0x51dd52)){throw new db['Sequelize']['ValidationError'](_0x7ef0('0x53'));}if(_0x101943[_0x7ef0('0x54')]){return _0x510d77['download'](_0x51dd52,_0x101943[_0x7ef0('0x54')]+path[_0x7ef0('0x55')](_0x51dd52),function(){if(_0x1a77c7){fs[_0x7ef0('0x56')](_0x51dd52);}});}else{return _0x510d77['download'](_0x51dd52,function(_0x2926d0){if(_0x1a77c7){fs[_0x7ef0('0x56')](_0x51dd52);}});}}})[_0x7ef0('0x41')](function(_0x556814){if(_0x556814['message']===_0x7ef0('0x53')){_0x510d77[_0x7ef0('0x1b')](0x194)['send'](_0x7ef0('0x57'));}else{return handleError(_0x510d77,null);}});};exports[_0x7ef0('0x58')]=function(_0x526699,_0x59c944,_0x577a77){var _0x290f30=require(_0x7ef0('0x4b'));var _0x4295b9=![];var _0x23b0ee={'$and':[db[_0x7ef0('0x59')]['where'](db[_0x7ef0('0x59')]['fn'](_0x7ef0('0x5a'),db['sequelize']['col']('uniqueid')),_0x526699[_0x7ef0('0x31')][_0x7ef0('0x5b')])]};if(_0x526699['query']['type']&&_0x526699[_0x7ef0('0x31')]['type']==='uniqueid'){_0x23b0ee[_0x7ef0('0x5c')]['push']({'uniqueid':_0x526699[_0x7ef0('0x43')]['id']});}else{_0x23b0ee[_0x7ef0('0x5c')][_0x7ef0('0x5d')]({'id':_0x526699[_0x7ef0('0x43')]['id']});}return db[_0x7ef0('0x2c')][_0x7ef0('0x47')]({'where':_0x23b0ee,'attributes':['id',_0x7ef0('0x4d')],'raw':!![]})[_0x7ef0('0x26')](handleEntityNotFound(_0x59c944,null))[_0x7ef0('0x26')](function(_0x57e8d4){if(_0x57e8d4){var _0x10cb1c=util[_0x7ef0('0x4e')](_0x7ef0('0x4f'),_0x57e8d4[_0x7ef0('0x4d')]);if(fs[_0x7ef0('0x50')](_0x10cb1c)){_0x4295b9=!![];return _0x290f30[_0x7ef0('0x5e')](_0x10cb1c,_0x57e8d4[_0x7ef0('0x4d')],config[_0x7ef0('0x51')][_0x7ef0('0x52')])['then'](function(){return _0x57e8d4;});}return _0x57e8d4;}})[_0x7ef0('0x26')](function(_0x135892){if(_0x135892){if(!fs[_0x7ef0('0x50')](_0x135892[_0x7ef0('0x4d')])){throw new db[(_0x7ef0('0x5f'))][(_0x7ef0('0x60'))](_0x7ef0('0x53'));}if(_0x135892['filename']){return _0x59c944[_0x7ef0('0x61')](_0x135892[_0x7ef0('0x4d')],_0x135892[_0x7ef0('0x54')]+path[_0x7ef0('0x55')](_0x135892[_0x7ef0('0x4d')]),function(){if(_0x4295b9){fs['unlink'](_0x135892[_0x7ef0('0x4d')]);}});}else{return _0x59c944['download'](_0x135892[_0x7ef0('0x4d')],function(_0x45827c){if(_0x4295b9){fs[_0x7ef0('0x56')](_0x135892[_0x7ef0('0x4d')]);}});}}})[_0x7ef0('0x41')](handleError(_0x59c944,null));};exports[_0x7ef0('0x27')]=function(_0x42979f,_0x16a92b){return db[_0x7ef0('0x2c')][_0x7ef0('0x47')]({'where':{'id':_0x42979f['params']['id']}})['then'](function(_0x217dd6){if(_['isNil'](_0x217dd6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x217dd6;})[_0x7ef0('0x26')](function(_0x46e8a2){var _0x782150=_0x46e8a2['value'];logger['info'](_0x7ef0('0x62'),_0x782150);if(!_[_0x7ef0('0x63')](_0x46e8a2[_0x7ef0('0x4d')])&&fs['existsSync'](_0x782150)){logger[_0x7ef0('0x64')](_0x7ef0('0x65')+_0x782150+_0x7ef0('0x66'));fs[_0x7ef0('0x67')](_0x782150);}_0x782150=_0x782150+_0x7ef0('0x68');if(!_[_0x7ef0('0x63')](_0x46e8a2['value'])&&fs[_0x7ef0('0x50')](_0x782150)){logger['info'](_0x7ef0('0x65')+_0x782150+_0x7ef0('0x66'));fs[_0x7ef0('0x67')](_0x782150);}return _0x46e8a2;})[_0x7ef0('0x26')](function(_0x501df4){if(!_0x501df4)throw new InternalError();return _0x501df4['destroy']();})[_0x7ef0('0x26')](function(){_0x16a92b[_0x7ef0('0x1b')](0xcc)['end']();})['catch'](handleError(_0x16a92b,null));};function getBucketslist(_0x1a4100,_0x26bbf7,_0x15cab7){return new Promise(function(_0x2beb3a,_0x397650){var _0x49a944=new AWS['S3']({'accessKeyId':_0x26bbf7,'secretAccessKey':_0x1a4100,'region':_0x15cab7});_0x49a944[_0x7ef0('0x69')]({},function(_0x154ec7,_0x5b33ef){if(_0x154ec7){return _0x397650(_0x154ec7);}else{return _0x2beb3a(_0x5b33ef);}});});}function createBucket(_0x5b1141,_0x5e7312,_0xda3cc9,_0x325ae3){return new Promise(function(_0x313226,_0x111187){var _0x4193f6=new AWS['S3']({'accessKeyId':_0x5e7312,'secretAccessKey':_0x5b1141,'region':_0xda3cc9});_0x4193f6[_0x7ef0('0x6a')]({'Bucket':_0x325ae3},function(_0xf53d91,_0x1319a5){if(_0xf53d91){return _0x111187(_0xf53d91);}else{return _0x313226(_0x1319a5);}});});}function uploadFile(_0x3ad151,_0x165c1d,_0x4e91a5,_0x261a86,_0x201789,_0x490e8c){return new Promise(function(_0xf5878,_0xc8f3b2){var _0x3a12f3=new AWS['S3']({'accessKeyId':_0x165c1d,'secretAccessKey':_0x3ad151,'region':_0x4e91a5});_0x3a12f3['upload']({'Bucket':_0x261a86,'Key':_0x201789,'Body':_0x490e8c},function(_0x3ea111,_0x167d45){if(_0x3ea111){return _0xc8f3b2(_0x3ea111);}else{return _0xf5878(_0x167d45);}});});}function startTranscribe(_0x5dd34b,_0x31734e,_0x57eabe,_0x49f967,_0x13b64,_0x30f27e){return new Promise(function(_0x283fa5,_0x49cb20){var _0x2d2c77=new AWS[(_0x7ef0('0x6b'))]({'accessKeyId':_0x31734e,'secretAccessKey':_0x5dd34b,'region':_0x57eabe});_0x2d2c77['startTranscriptionJob']({'TranscriptionJobName':_0x49f967,'LanguageCode':_0x13b64,'Media':{'MediaFileUri':_0x30f27e}},function(_0x2e29be,_0x158a54){if(_0x2e29be){return _0x49cb20(_0x2e29be);}else{return _0x283fa5(_0x158a54);}});});}function transcribe(_0x3c9004,_0x529aa0,_0x56a837,_0x2eebc3,_0x325d4e,_0x5c1869,_0x9ff285){return new Promise(function(_0x2bbad0,_0x4c4277){var _0x47fffa={};logger[_0x7ef0('0x64')](util[_0x7ef0('0x4e')](_0x7ef0('0x6c'),_0x3c9004,_0x325d4e));return uploadFile(_0x529aa0,_0x56a837,_0x2eebc3,_0x325d4e,path['basename'](_0x5c1869),fs[_0x7ef0('0x6d')](_0x5c1869))[_0x7ef0('0x26')](function(_0x4b14b5){logger['info'](util[_0x7ef0('0x4e')](_0x7ef0('0x6e'),_0x3c9004,_0x325d4e,_0x4b14b5['Location']));_0x47fffa[_0x7ef0('0x6f')]=_0x4b14b5[_0x7ef0('0x70')];_0x47fffa[_0x7ef0('0x71')]=_0x4b14b5[_0x7ef0('0x72')];logger[_0x7ef0('0x64')](util[_0x7ef0('0x4e')](_0x7ef0('0x73'),_0x3c9004));return startTranscribe(_0x529aa0,_0x56a837,_0x2eebc3,uuidv4(),_0x9ff285,_0x4b14b5['Location']);})[_0x7ef0('0x26')](function(_0x20c77b){logger[_0x7ef0('0x64')](util['format'](_0x7ef0('0x74'),_0x3c9004,_0x20c77b[_0x7ef0('0x75')]['TranscriptionJobName']));_0x47fffa['transcribeName']=_0x20c77b[_0x7ef0('0x75')][_0x7ef0('0x76')];_0x47fffa[_0x7ef0('0x77')]=_0x20c77b[_0x7ef0('0x75')]['TranscriptionJobStatus'];return _0x2bbad0(_0x47fffa);})[_0x7ef0('0x41')](function(_0x3618c6){return _0x4c4277(_0x3618c6);});});}exports[_0x7ef0('0x78')]=function(_0x377a1d,_0xd52e26,_0x116c2d){var _0x3c0cb0;var _0x10588a;var _0x2f5284;var _0x5dcc7a=require(_0x7ef0('0x4b'));return db['VoiceRecording'][_0x7ef0('0x79')]({'where':{'id':_0x377a1d[_0x7ef0('0x43')]['id']}})[_0x7ef0('0x26')](function(_0x2d763e){if(_0x2d763e){var _0x4f4ee8=util[_0x7ef0('0x4e')](_0x7ef0('0x4f'),_0x2d763e[_0x7ef0('0x4d')]);if(fs[_0x7ef0('0x50')](_0x4f4ee8)){cypher=!![];return _0x5dcc7a['decryptFile'](_0x4f4ee8,_0x2d763e['value'],config[_0x7ef0('0x51')][_0x7ef0('0x52')])[_0x7ef0('0x26')](function(){return _0x2d763e;});}return _0x2d763e;}})[_0x7ef0('0x26')](function(_0x326b81){if(!_0x326b81){throw new db['Sequelize'][(_0x7ef0('0x60'))](_0x7ef0('0x7a'));}_0x10588a=_0x326b81;return db[_0x7ef0('0x7b')][_0x7ef0('0x79')]({'where':{'id':0x1}});})[_0x7ef0('0x26')](handleEntityNotFound(_0xd52e26,null))[_0x7ef0('0x26')](function(_0x4fd609){if(_0x4fd609){_0x3c0cb0=_0x4fd609;if(!_0x3c0cb0[_0x7ef0('0x7c')]||!_0x3c0cb0['transcribeAccountId']||!_0x3c0cb0[_0x7ef0('0x7d')]||!_0x3c0cb0[_0x7ef0('0x7e')]||!_0x3c0cb0[_0x7ef0('0x6f')]){throw new db[(_0x7ef0('0x5f'))][(_0x7ef0('0x60'))]('Transcribe\x20not\x20configured');}if(_0x377a1d[_0x7ef0('0x49')]['runSentiment']&&(!_0x3c0cb0['sentiment']||!_0x3c0cb0[_0x7ef0('0x7f')]||!_0x3c0cb0[_0x7ef0('0x80')]||!_0x3c0cb0[_0x7ef0('0x7e')]||!_0x3c0cb0[_0x7ef0('0x6f')])){throw new db['Sequelize'][(_0x7ef0('0x60'))](_0x7ef0('0x81'));}return db['CloudProvider'][_0x7ef0('0x79')]({'where':{'id':_0x3c0cb0[_0x7ef0('0x82')]}});}})[_0x7ef0('0x26')](function(_0x154a1a){if(!_0x154a1a){throw new db[(_0x7ef0('0x5f'))]['ValidationError'](_0x7ef0('0x83'));}if(!_0x154a1a[_0x7ef0('0x84')]||!_0x154a1a[_0x7ef0('0x85')]){throw new db[(_0x7ef0('0x5f'))]['ValidationError'](_0x7ef0('0x86'));}_0x2f5284=_0x154a1a;return getBucketslist(_0x2f5284[_0x7ef0('0x84')],_0x2f5284[_0x7ef0('0x85')],_0x3c0cb0[_0x7ef0('0x7d')]);})[_0x7ef0('0x26')](function(_0x5f5169){if(_0x5f5169&&_0x5f5169['Buckets']){var _0x2dc1ae=_['find'](_0x5f5169[_0x7ef0('0x87')],function(_0x5dbb32){return _0x5dbb32['Name']===_0x3c0cb0['bucket'];});if(!_0x2dc1ae){logger[_0x7ef0('0x64')](util[_0x7ef0('0x4e')](_0x7ef0('0x88'),_0x377a1d[_0x7ef0('0x43')]['id'],_0x3c0cb0[_0x7ef0('0x6f')]));return createBucket(_0x2f5284['data1'],_0x2f5284[_0x7ef0('0x85')],_0x3c0cb0[_0x7ef0('0x7d')],_0x3c0cb0['bucket']);}logger['info'](util[_0x7ef0('0x4e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x377a1d[_0x7ef0('0x43')]['id'],_0x3c0cb0[_0x7ef0('0x6f')]));return;}})[_0x7ef0('0x26')](function(_0x138157){if(_0x10588a['transcribeStatus']===_0x7ef0('0x89')){return transcribe(_0x377a1d['params']['id'],_0x2f5284['data1'],_0x2f5284[_0x7ef0('0x85')],_0x3c0cb0[_0x7ef0('0x7d')],_0x3c0cb0[_0x7ef0('0x6f')],_0x10588a['value'],_0x3c0cb0[_0x7ef0('0x7e')]);}else{logger[_0x7ef0('0x64')](util['format'](_0x7ef0('0x8a'),_0x377a1d[_0x7ef0('0x43')]['id']));return{'transcribeStatus':_0x7ef0('0x8b')};}})[_0x7ef0('0x26')](function(_0x3e75d6){if(_0x3e75d6){_0x3e75d6['tempSentiment']=_0x377a1d[_0x7ef0('0x49')][_0x7ef0('0x8c')];return _0x10588a[_0x7ef0('0x8d')](_0x3e75d6);}})['then'](respondWithResult(_0xd52e26,null))[_0x7ef0('0x41')](handleError(_0xd52e26,null));};function writeFile(_0x3a0f6f,_0xf79272){return new Promise(function(_0x226d35,_0x1d80be){fs['writeFile'](_0xf79272,_0x3a0f6f,function(_0x41d767,_0x4148ea){if(_0x41d767){return _0x1d80be(_0x41d767);}else{return _0x226d35(_0x4148ea);}});});}exports[_0x7ef0('0x8e')]=function(_0xad1e42,_0x11523d,_0x35ce82){return db['VoiceRecording'][_0x7ef0('0x79')]({'where':{'id':_0xad1e42[_0x7ef0('0x43')]['id']}})[_0x7ef0('0x26')](handleEntityNotFound(_0x11523d))['then'](function(_0x4af5f5){if(_0x4af5f5&&_0x4af5f5[_0x7ef0('0x8f')]){var _0x5a2063=_0x4af5f5[_0x7ef0('0x8f')];var _0x2f22ef=config[_0x7ef0('0x90')]+_0x7ef0('0x91')+_0x4af5f5['id']+'.txt';if(fs[_0x7ef0('0x50')](_0x2f22ef)){return _0x2f22ef;}return writeFile(_0x5a2063,_0x2f22ef)[_0x7ef0('0x26')](function(){return _0x2f22ef;});}else{throw new db[(_0x7ef0('0x5f'))][(_0x7ef0('0x60'))](_0x7ef0('0x92'));}})[_0x7ef0('0x26')](function(_0x56a00c){return _0x11523d[_0x7ef0('0x61')](_0x56a00c);})[_0x7ef0('0x41')](handleError(_0x11523d));}; \ No newline at end of file +var _0x08b8=['count','limit','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','model','format','query','keys','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','params','intersection','length','include','options','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','token','$and','secrets','ValidationError','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0xccc860,_0x32f954){var _0x54f922=function(_0x1de4d6){while(--_0x1de4d6){_0xccc860['push'](_0xccc860['shift']());}};_0x54f922(++_0x32f954);}(_0x08b8,0x19b));var _0x808b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x08b8[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x808b('0x0'));var rimraf=require(_0x808b('0x1'));var zipdir=require(_0x808b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x808b('0x3'));var moment=require(_0x808b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x808b('0x5'));var util=require('util');var path=require(_0x808b('0x6'));var sox=require(_0x808b('0x7'));var csv=require(_0x808b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x808b('0x9'));var _=require(_0x808b('0xa'));var squel=require(_0x808b('0xb'));var crypto=require('crypto');var jsforce=require(_0x808b('0xc'));var deskjs=require(_0x808b('0xd'));var toCsv=require(_0x808b('0x8'));var querystring=require(_0x808b('0xe'));var Papa=require(_0x808b('0xf'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x808b('0x10'));var authService=require(_0x808b('0x11'));var qs=require(_0x808b('0x12'));var as=require(_0x808b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x808b('0x14'))(_0x808b('0x15'));var utils=require(_0x808b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x808b('0x17'));var db=require(_0x808b('0x18'))['db'];function respondWithStatusCode(_0x1a5b57,_0x1ff1f6){_0x1ff1f6=_0x1ff1f6||0xcc;return function(_0xdf0d0c){if(_0xdf0d0c){return _0x1a5b57[_0x808b('0x19')](_0x1ff1f6);}return _0x1a5b57[_0x808b('0x1a')](_0x1ff1f6)[_0x808b('0x1b')]();};}function respondWithResult(_0x322ee5,_0x243033){_0x243033=_0x243033||0xc8;return function(_0x1280a8){if(_0x1280a8){return _0x322ee5['status'](_0x243033)['json'](_0x1280a8);}};}function respondWithFilteredResult(_0x201c99,_0x2b4b43){return function(_0x1cb0ff){if(_0x1cb0ff){var _0x5eab9c=typeof _0x2b4b43[_0x808b('0x1c')]===_0x808b('0x1d')&&typeof _0x2b4b43['limit']===_0x808b('0x1d');var _0x22bf76=_0x1cb0ff['count'];var _0x42d82b=_0x5eab9c?0x0:_0x2b4b43[_0x808b('0x1c')];var _0x1967e4=_0x5eab9c?_0x1cb0ff[_0x808b('0x1e')]:_0x2b4b43[_0x808b('0x1c')]+_0x2b4b43[_0x808b('0x1f')];var _0x4e0490;if(_0x1967e4>=_0x22bf76){_0x1967e4=_0x22bf76;_0x4e0490=0xc8;}else{_0x4e0490=0xce;}_0x201c99[_0x808b('0x1a')](_0x4e0490);return _0x201c99['set']('Content-Range',_0x42d82b+'-'+_0x1967e4+'/'+_0x22bf76)['json'](_0x1cb0ff);}return null;};}function patchUpdates(_0x514bbc){return function(_0x90db7a){try{jsonpatch['apply'](_0x90db7a,_0x514bbc,!![]);}catch(_0x15c215){return BPromise[_0x808b('0x20')](_0x15c215);}return _0x90db7a[_0x808b('0x21')]();};}function saveUpdates(_0x51a1e7,_0x16940d){return function(_0x16b860){if(_0x16b860){return _0x16b860[_0x808b('0x22')](_0x51a1e7)[_0x808b('0x23')](function(_0x5ba385){return _0x5ba385;});}return null;};}function removeEntity(_0x3e972b,_0x4db5be){return function(_0x59a0dd){if(_0x59a0dd){return _0x59a0dd[_0x808b('0x24')]()['then'](function(){_0x3e972b[_0x808b('0x1a')](0xcc)[_0x808b('0x1b')]();});}};}function handleEntityNotFound(_0x19d70b,_0x3ddddf){return function(_0x513988){if(!_0x513988){_0x19d70b[_0x808b('0x19')](0x194);}return _0x513988;};}function handleError(_0x263706,_0x102fb9){_0x102fb9=_0x102fb9||0x1f4;return function(_0xe6ae84){logger[_0x808b('0x25')](_0xe6ae84[_0x808b('0x26')]);if(_0xe6ae84[_0x808b('0x27')]){delete _0xe6ae84[_0x808b('0x27')];}_0x263706[_0x808b('0x1a')](_0x102fb9)[_0x808b('0x28')](_0xe6ae84);};}exports[_0x808b('0x29')]=function(_0x4d587b,_0x4f2a85){var _0x34cb17={},_0x183f03={},_0x34a2da={'count':0x0,'rows':[]};var _0x3ce5b6=_[_0x808b('0x2a')](db[_0x808b('0x2b')][_0x808b('0x2c')],function(_0x14c6a7){return{'name':_0x14c6a7[_0x808b('0x2d')],'type':_0x14c6a7['type']['key']};});_0x183f03[_0x808b('0x2e')]=_['differenceBy'](_[_0x808b('0x2a')](_0x3ce5b6,_0x808b('0x27')),[_0x808b('0x2f')]);_0x183f03[_0x808b('0x30')]=_[_0x808b('0x31')](_0x4d587b[_0x808b('0x30')]);_0x183f03[_0x808b('0x32')]=_['intersection'](_0x183f03[_0x808b('0x2e')],_0x183f03[_0x808b('0x30')]);_0x34cb17[_0x808b('0x33')]=_['intersection'](_0x183f03[_0x808b('0x2e')],qs[_0x808b('0x34')](_0x4d587b[_0x808b('0x30')][_0x808b('0x34')]));_0x34cb17['attributes']=_0x34cb17[_0x808b('0x33')]['length']?_0x34cb17[_0x808b('0x33')]:_0x183f03[_0x808b('0x2e')];if(!_0x4d587b['query']['hasOwnProperty'](_0x808b('0x35'))){_0x34cb17[_0x808b('0x1f')]=qs['limit'](_0x4d587b[_0x808b('0x30')][_0x808b('0x1f')]);_0x34cb17[_0x808b('0x1c')]=qs[_0x808b('0x1c')](_0x4d587b[_0x808b('0x30')][_0x808b('0x1c')]);}_0x34cb17['order']=qs[_0x808b('0x36')](_0x4d587b['query'][_0x808b('0x36')]);_0x34cb17[_0x808b('0x37')]=qs[_0x808b('0x32')](_[_0x808b('0x38')](_0x4d587b[_0x808b('0x30')],_0x183f03[_0x808b('0x32')]),_0x3ce5b6);if(_0x4d587b[_0x808b('0x30')][_0x808b('0x39')]){_0x34cb17[_0x808b('0x37')]=_[_0x808b('0x3a')](_0x34cb17['where'],{'$or':_[_0x808b('0x2a')](_0x3ce5b6,function(_0x41474a){if(_0x41474a[_0x808b('0x3b')]!==_0x808b('0x3c')){var _0x2eeb4e={};_0x2eeb4e[_0x41474a[_0x808b('0x27')]]={'$like':'%'+_0x4d587b[_0x808b('0x30')]['filter']+'%'};return _0x2eeb4e;}})});}_0x34cb17=_[_0x808b('0x3a')]({},_0x34cb17,_0x4d587b['options']);var _0x288ba4={'where':_0x34cb17[_0x808b('0x37')]};return db[_0x808b('0x2b')][_0x808b('0x1e')](_0x288ba4)[_0x808b('0x23')](function(_0x41e161){_0x34a2da[_0x808b('0x1e')]=_0x41e161;if(_0x4d587b['query'][_0x808b('0x3d')]){_0x34cb17['include']=[{'all':!![]}];}return db[_0x808b('0x2b')][_0x808b('0x3e')](_0x34cb17);})[_0x808b('0x23')](function(_0x2a5e5d){_0x34a2da[_0x808b('0x3f')]=_0x2a5e5d;return _0x34a2da;})['then'](respondWithFilteredResult(_0x4f2a85,_0x34cb17))['catch'](handleError(_0x4f2a85,null));};exports['show']=function(_0x44c568,_0x136f9b){var _0x308c4b={'raw':![],'where':{'id':_0x44c568[_0x808b('0x40')]['id']}},_0x4e0bc6={};_0x4e0bc6[_0x808b('0x2e')]=_[_0x808b('0x31')](db['VoiceRecording'][_0x808b('0x2c')]);_0x4e0bc6[_0x808b('0x30')]=_['keys'](_0x44c568['query']);_0x4e0bc6[_0x808b('0x32')]=_[_0x808b('0x41')](_0x4e0bc6[_0x808b('0x2e')],_0x4e0bc6[_0x808b('0x30')]);_0x308c4b[_0x808b('0x33')]=_['intersection'](_0x4e0bc6[_0x808b('0x2e')],qs[_0x808b('0x34')](_0x44c568[_0x808b('0x30')][_0x808b('0x34')]));_0x308c4b[_0x808b('0x33')]=_0x308c4b['attributes'][_0x808b('0x42')]?_0x308c4b['attributes']:_0x4e0bc6['model'];if(_0x44c568['query']['includeAll']){_0x308c4b[_0x808b('0x43')]=[{'all':!![]}];}_0x308c4b=_[_0x808b('0x3a')]({},_0x308c4b,_0x44c568[_0x808b('0x44')]);return db[_0x808b('0x2b')][_0x808b('0x45')](_0x308c4b)['then'](handleEntityNotFound(_0x136f9b,null))[_0x808b('0x23')](respondWithResult(_0x136f9b,null))[_0x808b('0x46')](handleError(_0x136f9b,null));};exports['create']=function(_0x1b1318,_0xd82de5){return db['VoiceRecording'][_0x808b('0x47')](_0x1b1318[_0x808b('0x48')],{})['then'](respondWithResult(_0xd82de5,0xc9))[_0x808b('0x46')](handleError(_0xd82de5,null));};exports[_0x808b('0x22')]=function(_0x43fad6,_0x2ea489){if(_0x43fad6['body']['id']){delete _0x43fad6[_0x808b('0x48')]['id'];}return db[_0x808b('0x2b')][_0x808b('0x45')]({'where':{'id':_0x43fad6[_0x808b('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ea489,null))[_0x808b('0x23')](saveUpdates(_0x43fad6[_0x808b('0x48')],null))['then'](respondWithResult(_0x2ea489,null))['catch'](handleError(_0x2ea489,null));};exports[_0x808b('0x49')]=function(_0x205eb6,_0x3a6694){return db[_0x808b('0x2b')][_0x808b('0x49')]()['then'](respondWithResult(_0x3a6694,null))['catch'](handleError(_0x3a6694,null));};exports[_0x808b('0x4a')]=function(_0x928da9,_0x259177,_0x407878){var _0x391b69=require(_0x808b('0x4b'));var _0x5e7fc8=![];var _0x41a1e0={};if(_0x928da9[_0x808b('0x30')][_0x808b('0x3b')]&&_0x928da9[_0x808b('0x30')][_0x808b('0x3b')]===_0x808b('0x4c')){_0x41a1e0['uniqueid']=_0x928da9[_0x808b('0x40')]['id'];}else{_0x41a1e0['id']=_0x928da9[_0x808b('0x40')]['id'];}return db[_0x808b('0x2b')]['find']({'where':_0x41a1e0,'attributes':['id',_0x808b('0x4d')],'raw':!![]})[_0x808b('0x23')](handleEntityNotFound(_0x259177,null))[_0x808b('0x23')](function(_0x4fb1f9){if(_0x4fb1f9){var _0x15df1c=_0x4fb1f9[_0x808b('0x4d')];var _0x130274=util[_0x808b('0x2f')](_0x808b('0x4e'),_0x15df1c);if(fs['existsSync'](_0x130274)){_0x5e7fc8=!![];return _0x391b69[_0x808b('0x4f')](_0x130274,_0x15df1c,config['secrets'][_0x808b('0x50')])[_0x808b('0x23')](function(){return _0x4fb1f9;});}return _0x4fb1f9;}})[_0x808b('0x23')](function(_0x169ce6){if(_0x169ce6){var _0x1f5197=_0x169ce6[_0x808b('0x4d')];if(!fs[_0x808b('0x51')](_0x1f5197)){throw new db[(_0x808b('0x52'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x169ce6[_0x808b('0x53')]){return _0x259177[_0x808b('0x4a')](_0x1f5197,_0x169ce6[_0x808b('0x53')]+path[_0x808b('0x54')](_0x1f5197),function(){if(_0x5e7fc8){fs[_0x808b('0x55')](_0x1f5197);}});}else{return _0x259177[_0x808b('0x4a')](_0x1f5197,function(_0x3803f3){if(_0x5e7fc8){fs['unlink'](_0x1f5197);}});}}})[_0x808b('0x46')](function(_0x525531){if(_0x525531[_0x808b('0x56')]===_0x808b('0x57')){_0x259177['status'](0x194)[_0x808b('0x28')](_0x808b('0x58'));}else{return handleError(_0x259177,null);}});};exports[_0x808b('0x59')]=function(_0x447001,_0x32d4ef,_0x3a0c69){var _0x1e2b49=require(_0x808b('0x4b'));var _0xf94eb6=![];var _0x4aae5f={'$and':[db['sequelize'][_0x808b('0x37')](db[_0x808b('0x5a')]['fn'](_0x808b('0x5b'),db[_0x808b('0x5a')]['col']('uniqueid')),_0x447001['query'][_0x808b('0x5c')])]};if(_0x447001[_0x808b('0x30')][_0x808b('0x3b')]&&_0x447001['query'][_0x808b('0x3b')]===_0x808b('0x4c')){_0x4aae5f['$and']['push']({'uniqueid':_0x447001[_0x808b('0x40')]['id']});}else{_0x4aae5f[_0x808b('0x5d')]['push']({'id':_0x447001['params']['id']});}return db['VoiceRecording']['find']({'where':_0x4aae5f,'attributes':['id',_0x808b('0x4d')],'raw':!![]})[_0x808b('0x23')](handleEntityNotFound(_0x32d4ef,null))[_0x808b('0x23')](function(_0x248137){if(_0x248137){var _0x4cf2d8=util[_0x808b('0x2f')]('%s.cypher',_0x248137['value']);if(fs[_0x808b('0x51')](_0x4cf2d8)){_0xf94eb6=!![];return _0x1e2b49['decryptFile'](_0x4cf2d8,_0x248137[_0x808b('0x4d')],config[_0x808b('0x5e')]['recording'])['then'](function(){return _0x248137;});}return _0x248137;}})[_0x808b('0x23')](function(_0x2b97d3){if(_0x2b97d3){if(!fs[_0x808b('0x51')](_0x2b97d3[_0x808b('0x4d')])){throw new db[(_0x808b('0x52'))][(_0x808b('0x5f'))](_0x808b('0x57'));}if(_0x2b97d3[_0x808b('0x53')]){return _0x32d4ef[_0x808b('0x4a')](_0x2b97d3[_0x808b('0x4d')],_0x2b97d3[_0x808b('0x53')]+path[_0x808b('0x54')](_0x2b97d3[_0x808b('0x4d')]),function(){if(_0xf94eb6){fs[_0x808b('0x55')](_0x2b97d3[_0x808b('0x4d')]);}});}else{return _0x32d4ef[_0x808b('0x4a')](_0x2b97d3[_0x808b('0x4d')],function(_0x2a8e1c){if(_0xf94eb6){fs['unlink'](_0x2b97d3[_0x808b('0x4d')]);}});}}})['catch'](handleError(_0x32d4ef,null));};exports['destroy']=function(_0x5dd67e,_0x1a272e){return db['VoiceRecording'][_0x808b('0x45')]({'where':{'id':_0x5dd67e[_0x808b('0x40')]['id']}})[_0x808b('0x23')](function(_0x13ed66){if(_[_0x808b('0x60')](_0x13ed66)){throw new ReferenceError(_0x808b('0x61'));}return _0x13ed66;})[_0x808b('0x23')](function(_0x57e326){var _0x5ee268=_0x57e326[_0x808b('0x4d')];logger[_0x808b('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x5ee268);if(!_[_0x808b('0x60')](_0x57e326[_0x808b('0x4d')])&&fs[_0x808b('0x51')](_0x5ee268)){logger[_0x808b('0x62')](_0x808b('0x63')+_0x5ee268+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x808b('0x64')](_0x5ee268);}_0x5ee268=_0x5ee268+'.cypher';if(!_['isNil'](_0x57e326[_0x808b('0x4d')])&&fs[_0x808b('0x51')](_0x5ee268)){logger['info'](_0x808b('0x63')+_0x5ee268+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x808b('0x64')](_0x5ee268);}return _0x57e326;})['then'](function(_0x3a4f3b){if(!_0x3a4f3b)throw new InternalError();return _0x3a4f3b['destroy']();})[_0x808b('0x23')](function(){_0x1a272e[_0x808b('0x1a')](0xcc)['end']();})[_0x808b('0x46')](handleError(_0x1a272e,null));};function getBucketslist(_0x253299,_0x38fe14,_0x4b74f0){return new Promise(function(_0x426596,_0x174de2){var _0x4bdc37=new AWS['S3']({'accessKeyId':_0x38fe14,'secretAccessKey':_0x253299,'region':_0x4b74f0});_0x4bdc37[_0x808b('0x65')]({},function(_0x4a0ddc,_0x18bd44){if(_0x4a0ddc){return _0x174de2(_0x4a0ddc);}else{return _0x426596(_0x18bd44);}});});}function createBucket(_0x5d2a59,_0x1b0cdf,_0x3a60d9,_0x316cb8){return new Promise(function(_0x28df6b,_0x177d35){var _0x2e7a27=new AWS['S3']({'accessKeyId':_0x1b0cdf,'secretAccessKey':_0x5d2a59,'region':_0x3a60d9});_0x2e7a27[_0x808b('0x66')]({'Bucket':_0x316cb8},function(_0x5f534c,_0x31dbff){if(_0x5f534c){return _0x177d35(_0x5f534c);}else{return _0x28df6b(_0x31dbff);}});});}function uploadFile(_0x19bf8c,_0x34939c,_0x45ade8,_0x3af450,_0x2018d2,_0x5ea448){return new Promise(function(_0xd5246e,_0x5d496e){var _0x2b7d85=new AWS['S3']({'accessKeyId':_0x34939c,'secretAccessKey':_0x19bf8c,'region':_0x45ade8});_0x2b7d85['upload']({'Bucket':_0x3af450,'Key':_0x2018d2,'Body':_0x5ea448},function(_0x21c8a6,_0x761d10){if(_0x21c8a6){return _0x5d496e(_0x21c8a6);}else{return _0xd5246e(_0x761d10);}});});}function startTranscribe(_0x2c883b,_0x19cd13,_0x426c87,_0x30b141,_0x48021f,_0x1da399){return new Promise(function(_0x3164bd,_0x44f47c){var _0x5c8420=new AWS[(_0x808b('0x67'))]({'accessKeyId':_0x19cd13,'secretAccessKey':_0x2c883b,'region':_0x426c87});_0x5c8420[_0x808b('0x68')]({'TranscriptionJobName':_0x30b141,'LanguageCode':_0x48021f,'Media':{'MediaFileUri':_0x1da399}},function(_0x29d870,_0x22cc8f){if(_0x29d870){return _0x44f47c(_0x29d870);}else{return _0x3164bd(_0x22cc8f);}});});}function transcribe(_0x1bdfbf,_0x364cb4,_0x1b78e2,_0x4ec8f0,_0x28533c,_0x1d540c,_0x5a024d){return new Promise(function(_0x16d236,_0x3d3361){var _0x409883={};logger[_0x808b('0x62')](util[_0x808b('0x2f')](_0x808b('0x69'),_0x1bdfbf,_0x28533c));return uploadFile(_0x364cb4,_0x1b78e2,_0x4ec8f0,_0x28533c,path[_0x808b('0x6a')](_0x1d540c),fs[_0x808b('0x6b')](_0x1d540c))[_0x808b('0x23')](function(_0x506326){logger[_0x808b('0x62')](util[_0x808b('0x2f')](_0x808b('0x6c'),_0x1bdfbf,_0x28533c,_0x506326[_0x808b('0x6d')]));_0x409883[_0x808b('0x6e')]=_0x506326['Bucket'];_0x409883['location']=_0x506326[_0x808b('0x6d')];logger[_0x808b('0x62')](util[_0x808b('0x2f')](_0x808b('0x6f'),_0x1bdfbf));return startTranscribe(_0x364cb4,_0x1b78e2,_0x4ec8f0,uuidv4(),_0x5a024d,_0x506326['Location']);})[_0x808b('0x23')](function(_0x38cee4){logger[_0x808b('0x62')](util['format'](_0x808b('0x70'),_0x1bdfbf,_0x38cee4[_0x808b('0x71')][_0x808b('0x72')]));_0x409883[_0x808b('0x73')]=_0x38cee4['TranscriptionJob'][_0x808b('0x72')];_0x409883[_0x808b('0x74')]=_0x38cee4[_0x808b('0x71')][_0x808b('0x75')];return _0x16d236(_0x409883);})[_0x808b('0x46')](function(_0x1466c0){return _0x3d3361(_0x1466c0);});});}exports['runTranscribe']=function(_0x497dd1,_0x114430,_0x152ee8){var _0x33d449;var _0x43ff0e;var _0x43aea7;var _0x58b93d=require(_0x808b('0x4b'));return db['VoiceRecording'][_0x808b('0x76')]({'where':{'id':_0x497dd1[_0x808b('0x40')]['id']}})['then'](function(_0x16d22a){if(_0x16d22a){var _0x2e8b56=util['format']('%s.cypher',_0x16d22a[_0x808b('0x4d')]);if(fs['existsSync'](_0x2e8b56)){cypher=!![];return _0x58b93d[_0x808b('0x4f')](_0x2e8b56,_0x16d22a['value'],config[_0x808b('0x5e')][_0x808b('0x50')])[_0x808b('0x23')](function(){return _0x16d22a;});}return _0x16d22a;}})[_0x808b('0x23')](function(_0x38ef9a){if(!_0x38ef9a){throw new db['Sequelize']['ValidationError'](_0x808b('0x77'));}_0x43ff0e=_0x38ef9a;return db['Setting'][_0x808b('0x76')]({'where':{'id':0x1}});})[_0x808b('0x23')](handleEntityNotFound(_0x114430,null))[_0x808b('0x23')](function(_0x62c6c8){if(_0x62c6c8){_0x33d449=_0x62c6c8;if(!_0x33d449['transcribe']||!_0x33d449[_0x808b('0x78')]||!_0x33d449[_0x808b('0x79')]||!_0x33d449[_0x808b('0x7a')]||!_0x33d449['bucket']){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x497dd1['body'][_0x808b('0x7b')]&&(!_0x33d449[_0x808b('0x7c')]||!_0x33d449[_0x808b('0x7d')]||!_0x33d449[_0x808b('0x7e')]||!_0x33d449['language']||!_0x33d449[_0x808b('0x6e')])){throw new db[(_0x808b('0x52'))][(_0x808b('0x5f'))](_0x808b('0x7f'));}return db[_0x808b('0x80')][_0x808b('0x76')]({'where':{'id':_0x33d449[_0x808b('0x78')]}});}})[_0x808b('0x23')](function(_0x5e0fa6){if(!_0x5e0fa6){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5e0fa6[_0x808b('0x81')]||!_0x5e0fa6[_0x808b('0x82')]){throw new db[(_0x808b('0x52'))][(_0x808b('0x5f'))](_0x808b('0x83'));}_0x43aea7=_0x5e0fa6;return getBucketslist(_0x43aea7[_0x808b('0x81')],_0x43aea7[_0x808b('0x82')],_0x33d449['transcribeRegion']);})[_0x808b('0x23')](function(_0x5e4d6b){if(_0x5e4d6b&&_0x5e4d6b['Buckets']){var _0x14da90=_[_0x808b('0x45')](_0x5e4d6b[_0x808b('0x84')],function(_0x3bb464){return _0x3bb464[_0x808b('0x85')]===_0x33d449['bucket'];});if(!_0x14da90){logger['info'](util[_0x808b('0x2f')](_0x808b('0x86'),_0x497dd1[_0x808b('0x40')]['id'],_0x33d449[_0x808b('0x6e')]));return createBucket(_0x43aea7[_0x808b('0x81')],_0x43aea7[_0x808b('0x82')],_0x33d449[_0x808b('0x79')],_0x33d449[_0x808b('0x6e')]);}logger[_0x808b('0x62')](util[_0x808b('0x2f')](_0x808b('0x87'),_0x497dd1[_0x808b('0x40')]['id'],_0x33d449[_0x808b('0x6e')]));return;}})[_0x808b('0x23')](function(_0x2c4396){if(_0x43ff0e[_0x808b('0x74')]===_0x808b('0x88')){return transcribe(_0x497dd1[_0x808b('0x40')]['id'],_0x43aea7[_0x808b('0x81')],_0x43aea7[_0x808b('0x82')],_0x33d449['transcribeRegion'],_0x33d449[_0x808b('0x6e')],_0x43ff0e['value'],_0x33d449[_0x808b('0x7a')]);}else{logger['info'](util['format'](_0x808b('0x89'),_0x497dd1['params']['id']));return{'transcribeStatus':_0x808b('0x8a')};}})[_0x808b('0x23')](function(_0x4ed0ef){if(_0x4ed0ef){_0x4ed0ef[_0x808b('0x8b')]=_0x497dd1[_0x808b('0x48')][_0x808b('0x7b')];return _0x43ff0e[_0x808b('0x8c')](_0x4ed0ef);}})['then'](respondWithResult(_0x114430,null))[_0x808b('0x46')](handleError(_0x114430,null));};function writeFile(_0x5d2a64,_0x3c5958){return new Promise(function(_0x5a4df6,_0x40a14e){fs[_0x808b('0x8d')](_0x3c5958,_0x5d2a64,function(_0x3d88f5,_0x489044){if(_0x3d88f5){return _0x40a14e(_0x3d88f5);}else{return _0x5a4df6(_0x489044);}});});}exports['downloadTranscribe']=function(_0x51efd8,_0x51cf8e,_0x3ebbd2){return db[_0x808b('0x2b')]['findOne']({'where':{'id':_0x51efd8[_0x808b('0x40')]['id']}})[_0x808b('0x23')](handleEntityNotFound(_0x51cf8e))[_0x808b('0x23')](function(_0x4d5880){if(_0x4d5880&&_0x4d5880['fileText']){var _0x4f021e=_0x4d5880[_0x808b('0x8e')];var _0x47c7a6=config[_0x808b('0x8f')]+_0x808b('0x90')+_0x4d5880['id']+_0x808b('0x91');if(fs[_0x808b('0x51')](_0x47c7a6)){return _0x47c7a6;}return writeFile(_0x4f021e,_0x47c7a6)[_0x808b('0x23')](function(){return _0x47c7a6;});}else{throw new db[(_0x808b('0x52'))]['ValidationError'](_0x808b('0x92'));}})['then'](function(_0x3b9871){return _0x51cf8e[_0x808b('0x4a')](_0x3b9871);})[_0x808b('0x46')](handleError(_0x51cf8e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 28e72b1..a0e35c2 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 _0xed95=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x3d66fa,_0x5ae112){var _0x5a0a7f=function(_0x52f7d7){while(--_0x52f7d7){_0x3d66fa['push'](_0x3d66fa['shift']());}};_0x5a0a7f(++_0x5ae112);}(_0xed95,0xb9));var _0x5ed9=function(_0x183c90,_0x3cd577){_0x183c90=_0x183c90-0x0;var _0x33e844=_0xed95[_0x183c90];return _0x33e844;};'use strict';var attributes=require(_0x5ed9('0x0'));module[_0x5ed9('0x1')]=function(_0xbff47,_0x1f8d72){return _0xbff47[_0x5ed9('0x2')](_0x5ed9('0x3'),attributes,{'tableName':_0x5ed9('0x4'),'paranoid':![],'indexes':[{'name':_0x5ed9('0x5'),'fields':[_0x5ed9('0x5')]},{'name':_0x5ed9('0x6'),'fields':[_0x5ed9('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d9b=['./voiceRecording.attributes','exports','define','uniqueid','transcribeStatus'];(function(_0x3d5cc8,_0x239b42){var _0x51eeaf=function(_0xef5444){while(--_0xef5444){_0x3d5cc8['push'](_0x3d5cc8['shift']());}};_0x51eeaf(++_0x239b42);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xb8d9('0x0'));module[_0xb8d9('0x1')]=function(_0x2a3616,_0x8360b6){return _0x2a3616[_0xb8d9('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xb8d9('0x3'),'fields':['uniqueid']},{'name':_0xb8d9('0x4'),'fields':[_0xb8d9('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 735f364..dad98ff 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 _0x4975=['catch','VoiceRecording','update','body','options','raw','where','limit','then','UpdateVoiceRecording','CreateVoiceRecording','create','value','format','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0x4975,0x86));var _0x5497=function(_0x56d925,_0x2bb994){_0x56d925=_0x56d925-0x0;var _0x32dac1=_0x4975[_0x56d925];return _0x32dac1;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['UpdateVoiceRecording']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')](_0x3f4d20[_0x5497('0x19')],{'raw':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1c')]||null:null,'attributes':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')]['attributes']||null:null,'limit':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20['options'][_0x5497('0x1d')]||null:null})[_0x5497('0x1e')](function(_0x44265c){logger[_0x5497('0xd')](_0x5497('0x1f'),_0x3f4d20);logger[_0x5497('0x10')]('UpdateVoiceRecording',_0x3f4d20,JSON['stringify'](_0x44265c));_0x3a47fd(_0x44265c);})[_0x5497('0x16')](function(_0x34b97f){logger[_0x5497('0x13')](_0x5497('0x1f'),_0x34b97f['message'],_0x3f4d20);_0x5d9e24(_0x1bf442[_0x5497('0x13')](0x1f4,_0x34b97f['message']));});});};exports[_0x5497('0x20')]=function(_0x16a2b4){var _0x429d36=this;return new Promise(function(_0x34a1a5,_0x163a30){var _0x31cd01=require('../../components/encryptor');var _0x4af5f4;return db['Setting']['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5497('0x1e')](function(_0x48d146){_0x4af5f4=_0x48d146;return db['VoiceRecording'][_0x5497('0x21')](_0x16a2b4[_0x5497('0x19')]);})[_0x5497('0x1e')](function(_0x4c442a){if(_0x4af5f4['callRecordingEncryption']&&fs['existsSync'](_0x4c442a[_0x5497('0x22')])){var _0x471e0b=util[_0x5497('0x23')]('%s.cypher',_0x4c442a['value']);return _0x31cd01['encryptFile'](_0x4c442a[_0x5497('0x22')],_0x471e0b,config['secrets'][_0x5497('0x24')])[_0x5497('0x1e')](function(){fs[_0x5497('0x25')](_0x4c442a['value']);logger[_0x5497('0xd')](_0x5497('0x26'));return _0x4c442a;});}return _0x4c442a;})['then'](function(_0xce7cb2){logger[_0x5497('0xd')](_0x5497('0x20'),_0x16a2b4);logger['debug'](_0x5497('0x20'),_0x16a2b4,JSON[_0x5497('0x12')](_0xce7cb2));_0x34a1a5(_0xce7cb2);})[_0x5497('0x16')](function(_0x362b96){logger[_0x5497('0x13')]('CreateVoiceRecording',_0x362b96[_0x5497('0x14')],_0x16a2b4);_0x163a30(_0x429d36[_0x5497('0x13')](0x1f4,_0x362b96['message']));});});}; \ No newline at end of file +var _0x955f=['randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','raw','where','attributes','limit','debug','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird'];(function(_0x47b7bb,_0x17e6d8){var _0x5c47a0=function(_0x35347a){while(--_0x35347a){_0x47b7bb['push'](_0x47b7bb['shift']());}};_0x5c47a0(++_0x17e6d8);}(_0x955f,0x1eb));var _0xf955=function(_0x25b64a,_0x3640a8){_0x25b64a=_0x25b64a-0x0;var _0x479b01=_0x955f[_0x25b64a];return _0x479b01;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});}exports['UpdateVoiceRecording']=function(_0x5ac6cb){var _0x1e20d1=this;return new Promise(function(_0xe6de5c,_0x3c49c0){return db['VoiceRecording'][_0xf955('0x15')](_0x5ac6cb[_0xf955('0x16')],{'raw':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x19')]||null:null,'attributes':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb['options'][_0xf955('0x1a')]||null:null,'limit':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x1b')]||null:null})[_0xf955('0xb')](function(_0xa4ebb4){logger[_0xf955('0xc')]('UpdateVoiceRecording',_0x5ac6cb);logger[_0xf955('0x1c')](_0xf955('0x1d'),_0x5ac6cb,JSON[_0xf955('0x10')](_0xa4ebb4));_0xe6de5c(_0xa4ebb4);})[_0xf955('0x14')](function(_0x17dec2){logger[_0xf955('0x11')](_0xf955('0x1d'),_0x17dec2['message'],_0x5ac6cb);_0x3c49c0(_0x1e20d1[_0xf955('0x11')](0x1f4,_0x17dec2[_0xf955('0x12')]));});});};exports[_0xf955('0x1e')]=function(_0x406632){var _0x2dcd55=this;return new Promise(function(_0x13a86d,_0x3796f7){var _0x51f3ab=require(_0xf955('0x1f'));var _0x145098;return db[_0xf955('0x20')][_0xf955('0x21')]({'attributes':['id',_0xf955('0x22')],'where':{'id':0x1},'raw':!![]})[_0xf955('0xb')](function(_0x4d4af0){_0x145098=_0x4d4af0;return db[_0xf955('0x23')][_0xf955('0x24')](_0x406632['body']);})[_0xf955('0xb')](function(_0x2c8df1){if(_0x145098[_0xf955('0x22')]&&fs[_0xf955('0x25')](_0x2c8df1['value'])){var _0x3a951c=util['format'](_0xf955('0x26'),_0x2c8df1[_0xf955('0x27')]);return _0x51f3ab[_0xf955('0x28')](_0x2c8df1[_0xf955('0x27')],_0x3a951c,config[_0xf955('0x29')][_0xf955('0x2a')])[_0xf955('0xb')](function(){fs[_0xf955('0x2b')](_0x2c8df1['value']);logger[_0xf955('0xc')](_0xf955('0x2c'));return _0x2c8df1;});}return _0x2c8df1;})[_0xf955('0xb')](function(_0x2046c8){logger['info'](_0xf955('0x1e'),_0x406632);logger[_0xf955('0x1c')](_0xf955('0x1e'),_0x406632,JSON[_0xf955('0x10')](_0x2046c8));_0x13a86d(_0x2046c8);})[_0xf955('0x14')](function(_0x4eb2c3){logger['error']('CreateVoiceRecording',_0x4eb2c3[_0xf955('0x12')],_0x406632);_0x3796f7(_0x2dcd55[_0xf955('0x11')](0x1f4,_0x4eb2c3[_0xf955('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 620c8dc..8629f16 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 _0x12ef=['exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','put','update','delete','destroy'];(function(_0x3250f3,_0x1cd63e){var _0x2c5c69=function(_0x440092){while(--_0x440092){_0x3250f3['push'](_0x3250f3['shift']());}};_0x2c5c69(++_0x1cd63e);}(_0x12ef,0xac));var _0xf12e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x12ef[_0xe66cf2];return _0x2d84e7;};'use strict';var multer=require(_0xf12e('0x0'));var util=require('util');var path=require(_0xf12e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf12e('0x2'));var router=express[_0xf12e('0x3')]();var fs_extra=require(_0xf12e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf12e('0x5'));var config=require(_0xf12e('0x6'));var controller=require(_0xf12e('0x7'));router['get']('/',auth[_0xf12e('0x8')](),controller[_0xf12e('0x9')]);router[_0xf12e('0xa')](_0xf12e('0xb'),auth[_0xf12e('0x8')](),controller['describe']);router[_0xf12e('0xa')](_0xf12e('0xc'),auth['isAuthenticated'](),controller[_0xf12e('0xd')]);router['post']('/',auth[_0xf12e('0x8')](),controller['create']);router[_0xf12e('0xe')](_0xf12e('0xc'),auth[_0xf12e('0x8')](),controller[_0xf12e('0xf')]);router[_0xf12e('0x10')](_0xf12e('0xc'),auth[_0xf12e('0x8')](),controller[_0xf12e('0x11')]);module[_0xf12e('0x12')]=router; \ No newline at end of file +var _0xb57e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0xb57e,0x94));var _0xeb57=function(_0x18871c,_0x28b8a6){_0x18871c=_0x18871c-0x0;var _0x141c8c=_0xb57e[_0x18871c];return _0x141c8c;};'use strict';var multer=require('multer');var util=require(_0xeb57('0x0'));var path=require(_0xeb57('0x1'));var timeout=require(_0xeb57('0x2'));var express=require(_0xeb57('0x3'));var router=express[_0xeb57('0x4')]();var fs_extra=require(_0xeb57('0x5'));var auth=require(_0xeb57('0x6'));var interaction=require(_0xeb57('0x7'));var config=require(_0xeb57('0x8'));var controller=require(_0xeb57('0x9'));router[_0xeb57('0xa')]('/',auth[_0xeb57('0xb')](),controller['index']);router[_0xeb57('0xa')](_0xeb57('0xc'),auth[_0xeb57('0xb')](),controller[_0xeb57('0xd')]);router[_0xeb57('0xa')](_0xeb57('0xe'),auth[_0xeb57('0xb')](),controller[_0xeb57('0xf')]);router[_0xeb57('0x10')]('/',auth[_0xeb57('0xb')](),controller[_0xeb57('0x11')]);router[_0xeb57('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xeb57('0x13')]);router[_0xeb57('0x14')]('/:id',auth[_0xeb57('0xb')](),controller[_0xeb57('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index f47d0cc..042cada 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 _0xb89a=['blind','attended','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0xb89a,0x9c));var _0xab89=function(_0x567751,_0x4287c3){_0x567751=_0x567751-0x0;var _0x21a84c=_0xb89a[_0x567751];return _0x21a84c;};'use strict';var Sequelize=require(_0xab89('0x0'));var moment=require(_0xab89('0x1'));module[_0xab89('0x2')]={'type':{'type':Sequelize[_0xab89('0x3')](_0xab89('0x4'),_0xab89('0x5'))},'result':{'type':Sequelize[_0xab89('0x6')]},'transfererchannel':{'type':Sequelize[_0xab89('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xab89('0x6')]},'transferercalleridname':{'type':Sequelize[_0xab89('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xab89('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xab89('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xab89('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xab89('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xab89('0x6')]},'transfereecontext':{'type':Sequelize[_0xab89('0x6')]},'transfereeexten':{'type':Sequelize[_0xab89('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xab89('0x6')]},'isexternal':{'type':Sequelize[_0xab89('0x3')](_0xab89('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xab89('0x6')]}}; \ No newline at end of file +var _0x3fe3=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x33a14b,_0x1de680){var _0x295c8c=function(_0x29e815){while(--_0x29e815){_0x33a14b['push'](_0x33a14b['shift']());}};_0x295c8c(++_0x1de680);}(_0x3fe3,0x135));var _0x33fe=function(_0x5b2a25,_0x5b8cab){_0x5b2a25=_0x5b2a25-0x0;var _0x522228=_0x3fe3[_0x5b2a25];return _0x522228;};'use strict';var Sequelize=require(_0x33fe('0x0'));var moment=require(_0x33fe('0x1'));module[_0x33fe('0x2')]={'type':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x4'),_0x33fe('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x33fe('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x33fe('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x33fe('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x33fe('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x33fe('0x6')]},'transferercontext':{'type':Sequelize[_0x33fe('0x6')]},'transfererexten':{'type':Sequelize[_0x33fe('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x33fe('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x33fe('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x33fe('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x33fe('0x6')]},'transfereecontext':{'type':Sequelize[_0x33fe('0x6')]},'transfereeexten':{'type':Sequelize[_0x33fe('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x33fe('0x6')]},'isexternal':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x7'),'No')},'context':{'type':Sequelize[_0x33fe('0x6')]},'extension':{'type':Sequelize[_0x33fe('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index bbc757e..3c01f8c 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 _0xec67=['error','stack','name','index','map','VoiceTransferReport','fieldName','type','key','model','query','keys','filters','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','intersection','attributes','length','includeAll','find','create','body','destroy','describe','rimraf','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0xec67,0xf4));var _0x7ec6=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xec67[_0x2aa0e7];return _0x1472c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ec6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ec6('0x1'));var moment=require(_0x7ec6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7ec6('0x3'));var util=require(_0x7ec6('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x7ec6('0x5'));var ejs=require(_0x7ec6('0x6'));var fs=require('fs');var fs_extra=require(_0x7ec6('0x7'));var _=require(_0x7ec6('0x8'));var squel=require(_0x7ec6('0x9'));var crypto=require(_0x7ec6('0xa'));var jsforce=require(_0x7ec6('0xb'));var deskjs=require(_0x7ec6('0xc'));var toCsv=require(_0x7ec6('0x5'));var querystring=require(_0x7ec6('0xd'));var Papa=require('papaparse');var Redis=require(_0x7ec6('0xe'));var authService=require(_0x7ec6('0xf'));var qs=require(_0x7ec6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ec6('0x11'));var logger=require(_0x7ec6('0x12'))(_0x7ec6('0x13'));var utils=require(_0x7ec6('0x14'));var config=require(_0x7ec6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x447360,_0x445a48){_0x445a48=_0x445a48||0xcc;return function(_0xdc5254){if(_0xdc5254){return _0x447360['sendStatus'](_0x445a48);}return _0x447360[_0x7ec6('0x16')](_0x445a48)[_0x7ec6('0x17')]();};}function respondWithResult(_0x15dd6e,_0x35ac21){_0x35ac21=_0x35ac21||0xc8;return function(_0x34d127){if(_0x34d127){return _0x15dd6e[_0x7ec6('0x16')](_0x35ac21)['json'](_0x34d127);}};}function respondWithFilteredResult(_0x371586,_0x81a4ef){return function(_0x4cc33d){if(_0x4cc33d){var _0x44a691=typeof _0x81a4ef[_0x7ec6('0x18')]==='undefined'&&typeof _0x81a4ef[_0x7ec6('0x19')]==='undefined';var _0x18da1f=_0x4cc33d[_0x7ec6('0x1a')];var _0x30167c=_0x44a691?0x0:_0x81a4ef[_0x7ec6('0x18')];var _0x5e1a44=_0x44a691?_0x4cc33d[_0x7ec6('0x1a')]:_0x81a4ef[_0x7ec6('0x18')]+_0x81a4ef[_0x7ec6('0x19')];var _0x37e46e;if(_0x5e1a44>=_0x18da1f){_0x5e1a44=_0x18da1f;_0x37e46e=0xc8;}else{_0x37e46e=0xce;}_0x371586['status'](_0x37e46e);return _0x371586[_0x7ec6('0x1b')](_0x7ec6('0x1c'),_0x30167c+'-'+_0x5e1a44+'/'+_0x18da1f)[_0x7ec6('0x1d')](_0x4cc33d);}return null;};}function patchUpdates(_0xf8f9c7){return function(_0x396780){try{jsonpatch[_0x7ec6('0x1e')](_0x396780,_0xf8f9c7,!![]);}catch(_0xe8fc0b){return BPromise[_0x7ec6('0x1f')](_0xe8fc0b);}return _0x396780[_0x7ec6('0x20')]();};}function saveUpdates(_0x3c6bb2,_0x344ef3){return function(_0x539eae){if(_0x539eae){return _0x539eae[_0x7ec6('0x21')](_0x3c6bb2)[_0x7ec6('0x22')](function(_0x3bf1a0){return _0x3bf1a0;});}return null;};}function removeEntity(_0x57cdf2,_0x30c5ec){return function(_0x2ceffb){if(_0x2ceffb){return _0x2ceffb['destroy']()[_0x7ec6('0x22')](function(){_0x57cdf2[_0x7ec6('0x16')](0xcc)[_0x7ec6('0x17')]();});}};}function handleEntityNotFound(_0x2509bb,_0x5d66a3){return function(_0x183108){if(!_0x183108){_0x2509bb[_0x7ec6('0x23')](0x194);}return _0x183108;};}function handleError(_0x36c924,_0x5a9644){_0x5a9644=_0x5a9644||0x1f4;return function(_0x31f8ad){logger[_0x7ec6('0x24')](_0x31f8ad[_0x7ec6('0x25')]);if(_0x31f8ad['name']){delete _0x31f8ad[_0x7ec6('0x26')];}_0x36c924[_0x7ec6('0x16')](_0x5a9644)['send'](_0x31f8ad);};}exports[_0x7ec6('0x27')]=function(_0x33f1c9,_0xe2ca73){var _0x2fa0de={},_0x22546c={},_0x1413ee={'count':0x0,'rows':[]};var _0x19234f=_[_0x7ec6('0x28')](db[_0x7ec6('0x29')]['rawAttributes'],function(_0x453db4){return{'name':_0x453db4[_0x7ec6('0x2a')],'type':_0x453db4[_0x7ec6('0x2b')][_0x7ec6('0x2c')]};});_0x22546c[_0x7ec6('0x2d')]=_[_0x7ec6('0x28')](_0x19234f,_0x7ec6('0x26'));_0x22546c[_0x7ec6('0x2e')]=_[_0x7ec6('0x2f')](_0x33f1c9[_0x7ec6('0x2e')]);_0x22546c[_0x7ec6('0x30')]=_['intersection'](_0x22546c[_0x7ec6('0x2d')],_0x22546c['query']);_0x2fa0de['attributes']=_['intersection'](_0x22546c[_0x7ec6('0x2d')],qs['fields'](_0x33f1c9[_0x7ec6('0x2e')][_0x7ec6('0x31')]));_0x2fa0de['attributes']=_0x2fa0de['attributes']['length']?_0x2fa0de['attributes']:_0x22546c['model'];if(!_0x33f1c9[_0x7ec6('0x2e')]['hasOwnProperty'](_0x7ec6('0x32'))){_0x2fa0de['limit']=qs[_0x7ec6('0x19')](_0x33f1c9['query'][_0x7ec6('0x19')]);_0x2fa0de[_0x7ec6('0x18')]=qs[_0x7ec6('0x18')](_0x33f1c9[_0x7ec6('0x2e')][_0x7ec6('0x18')]);}_0x2fa0de['order']=qs['sort'](_0x33f1c9[_0x7ec6('0x2e')]['sort']);_0x2fa0de[_0x7ec6('0x33')]=qs[_0x7ec6('0x30')](_[_0x7ec6('0x34')](_0x33f1c9[_0x7ec6('0x2e')],_0x22546c[_0x7ec6('0x30')]),_0x19234f);if(_0x33f1c9[_0x7ec6('0x2e')][_0x7ec6('0x35')]){_0x2fa0de[_0x7ec6('0x33')]=_[_0x7ec6('0x36')](_0x2fa0de[_0x7ec6('0x33')],{'$or':_[_0x7ec6('0x28')](_0x19234f,function(_0x25ef2f){if(_0x25ef2f['type']!==_0x7ec6('0x37')){var _0xd8934f={};_0xd8934f[_0x25ef2f[_0x7ec6('0x26')]]={'$like':'%'+_0x33f1c9['query'][_0x7ec6('0x35')]+'%'};return _0xd8934f;}})});}_0x2fa0de=_['merge']({},_0x2fa0de,_0x33f1c9[_0x7ec6('0x38')]);var _0x359d94={'where':_0x2fa0de[_0x7ec6('0x33')]};return db[_0x7ec6('0x29')][_0x7ec6('0x1a')](_0x359d94)['then'](function(_0x813437){_0x1413ee[_0x7ec6('0x1a')]=_0x813437;if(_0x33f1c9[_0x7ec6('0x2e')]['includeAll']){_0x2fa0de[_0x7ec6('0x39')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x2fa0de);})['then'](function(_0x287fef){_0x1413ee[_0x7ec6('0x3a')]=_0x287fef;return _0x1413ee;})['then'](respondWithFilteredResult(_0xe2ca73,_0x2fa0de))[_0x7ec6('0x3b')](handleError(_0xe2ca73,null));};exports['show']=function(_0x46ff9e,_0x1f0fec){var _0x40f95b={'raw':!![],'where':{'id':_0x46ff9e[_0x7ec6('0x3c')]['id']}},_0x4baabb={};_0x4baabb[_0x7ec6('0x2d')]=_[_0x7ec6('0x2f')](db[_0x7ec6('0x29')]['rawAttributes']);_0x4baabb[_0x7ec6('0x2e')]=_[_0x7ec6('0x2f')](_0x46ff9e[_0x7ec6('0x2e')]);_0x4baabb[_0x7ec6('0x30')]=_[_0x7ec6('0x3d')](_0x4baabb[_0x7ec6('0x2d')],_0x4baabb[_0x7ec6('0x2e')]);_0x40f95b[_0x7ec6('0x3e')]=_[_0x7ec6('0x3d')](_0x4baabb[_0x7ec6('0x2d')],qs[_0x7ec6('0x31')](_0x46ff9e['query'][_0x7ec6('0x31')]));_0x40f95b[_0x7ec6('0x3e')]=_0x40f95b['attributes'][_0x7ec6('0x3f')]?_0x40f95b[_0x7ec6('0x3e')]:_0x4baabb[_0x7ec6('0x2d')];if(_0x46ff9e[_0x7ec6('0x2e')][_0x7ec6('0x40')]){_0x40f95b[_0x7ec6('0x39')]=[{'all':!![]}];}_0x40f95b=_[_0x7ec6('0x36')]({},_0x40f95b,_0x46ff9e['options']);return db[_0x7ec6('0x29')][_0x7ec6('0x41')](_0x40f95b)[_0x7ec6('0x22')](handleEntityNotFound(_0x1f0fec,null))['then'](respondWithResult(_0x1f0fec,null))[_0x7ec6('0x3b')](handleError(_0x1f0fec,null));};exports[_0x7ec6('0x42')]=function(_0x3b1ffc,_0x1f3ec7){return db[_0x7ec6('0x29')][_0x7ec6('0x42')](_0x3b1ffc[_0x7ec6('0x43')],{})[_0x7ec6('0x22')](respondWithResult(_0x1f3ec7,0xc9))[_0x7ec6('0x3b')](handleError(_0x1f3ec7,null));};exports[_0x7ec6('0x21')]=function(_0x2ccc11,_0x29464b){if(_0x2ccc11[_0x7ec6('0x43')]['id']){delete _0x2ccc11[_0x7ec6('0x43')]['id'];}return db[_0x7ec6('0x29')][_0x7ec6('0x41')]({'where':{'id':_0x2ccc11[_0x7ec6('0x3c')]['id']}})[_0x7ec6('0x22')](handleEntityNotFound(_0x29464b,null))[_0x7ec6('0x22')](saveUpdates(_0x2ccc11[_0x7ec6('0x43')],null))['then'](respondWithResult(_0x29464b,null))['catch'](handleError(_0x29464b,null));};exports[_0x7ec6('0x44')]=function(_0x12d375,_0x1bec28){return db[_0x7ec6('0x29')][_0x7ec6('0x41')]({'where':{'id':_0x12d375[_0x7ec6('0x3c')]['id']}})[_0x7ec6('0x22')](handleEntityNotFound(_0x1bec28,null))[_0x7ec6('0x22')](removeEntity(_0x1bec28,null))[_0x7ec6('0x3b')](handleError(_0x1bec28,null));};exports[_0x7ec6('0x45')]=function(_0x18261e,_0x5b4174){return db[_0x7ec6('0x29')][_0x7ec6('0x45')]()['then'](respondWithResult(_0x5b4174,null))['catch'](handleError(_0x5b4174,null));}; \ No newline at end of file +var _0x0daf=['Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x30e890,_0x50ccf5){var _0x28f17a=function(_0xc8b8dd){while(--_0xc8b8dd){_0x30e890['push'](_0x30e890['shift']());}};_0x28f17a(++_0x50ccf5);}(_0x0daf,0x1a9));var _0xf0da=function(_0x131050,_0x3aa020){_0x131050=_0x131050-0x0;var _0x4e9e65=_0x0daf[_0x131050];return _0x4e9e65;};'use strict';var emlformat=require(_0xf0da('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0da('0x1'));var BPromise=require(_0xf0da('0x2'));var Mustache=require(_0xf0da('0x3'));var util=require(_0xf0da('0x4'));var path=require(_0xf0da('0x5'));var sox=require(_0xf0da('0x6'));var csv=require(_0xf0da('0x7'));var ejs=require(_0xf0da('0x8'));var fs=require('fs');var fs_extra=require(_0xf0da('0x9'));var _=require(_0xf0da('0xa'));var squel=require('squel');var crypto=require(_0xf0da('0xb'));var jsforce=require(_0xf0da('0xc'));var deskjs=require(_0xf0da('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf0da('0xe'));var Papa=require(_0xf0da('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf0da('0x10'));var as=require(_0xf0da('0x11'));var hardwareService=require(_0xf0da('0x12'));var logger=require(_0xf0da('0x13'))(_0xf0da('0x14'));var utils=require(_0xf0da('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf0da('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37984a,_0x564ccb){_0x564ccb=_0x564ccb||0xcc;return function(_0x1c6a33){if(_0x1c6a33){return _0x37984a[_0xf0da('0x17')](_0x564ccb);}return _0x37984a[_0xf0da('0x18')](_0x564ccb)['end']();};}function respondWithResult(_0x5d0901,_0x53cab2){_0x53cab2=_0x53cab2||0xc8;return function(_0x50ddff){if(_0x50ddff){return _0x5d0901[_0xf0da('0x18')](_0x53cab2)[_0xf0da('0x19')](_0x50ddff);}};}function respondWithFilteredResult(_0x46565d,_0x679f91){return function(_0x24148f){if(_0x24148f){var _0x175239=typeof _0x679f91[_0xf0da('0x1a')]===_0xf0da('0x1b')&&typeof _0x679f91[_0xf0da('0x1c')]===_0xf0da('0x1b');var _0x4a6bee=_0x24148f[_0xf0da('0x1d')];var _0x219583=_0x175239?0x0:_0x679f91[_0xf0da('0x1a')];var _0x2fbc6f=_0x175239?_0x24148f[_0xf0da('0x1d')]:_0x679f91[_0xf0da('0x1a')]+_0x679f91[_0xf0da('0x1c')];var _0x6e2db9;if(_0x2fbc6f>=_0x4a6bee){_0x2fbc6f=_0x4a6bee;_0x6e2db9=0xc8;}else{_0x6e2db9=0xce;}_0x46565d[_0xf0da('0x18')](_0x6e2db9);return _0x46565d[_0xf0da('0x1e')](_0xf0da('0x1f'),_0x219583+'-'+_0x2fbc6f+'/'+_0x4a6bee)[_0xf0da('0x19')](_0x24148f);}return null;};}function patchUpdates(_0x3f106e){return function(_0xd4da8){try{jsonpatch[_0xf0da('0x20')](_0xd4da8,_0x3f106e,!![]);}catch(_0x10209e){return BPromise[_0xf0da('0x21')](_0x10209e);}return _0xd4da8[_0xf0da('0x22')]();};}function saveUpdates(_0x31e8c3,_0x3d194f){return function(_0x5efcf3){if(_0x5efcf3){return _0x5efcf3['update'](_0x31e8c3)[_0xf0da('0x23')](function(_0x24bd52){return _0x24bd52;});}return null;};}function removeEntity(_0x28b9fd,_0x5afd1c){return function(_0x2588d8){if(_0x2588d8){return _0x2588d8[_0xf0da('0x24')]()['then'](function(){_0x28b9fd[_0xf0da('0x18')](0xcc)[_0xf0da('0x25')]();});}};}function handleEntityNotFound(_0x11e83e,_0x504355){return function(_0x48a8c1){if(!_0x48a8c1){_0x11e83e[_0xf0da('0x17')](0x194);}return _0x48a8c1;};}function handleError(_0x59bf53,_0x23305c){_0x23305c=_0x23305c||0x1f4;return function(_0x531aaa){logger[_0xf0da('0x26')](_0x531aaa['stack']);if(_0x531aaa[_0xf0da('0x27')]){delete _0x531aaa[_0xf0da('0x27')];}_0x59bf53[_0xf0da('0x18')](_0x23305c)[_0xf0da('0x28')](_0x531aaa);};}exports[_0xf0da('0x29')]=function(_0xf340a0,_0x268827){var _0x1e918d={},_0x237cdb={},_0x35d7cc={'count':0x0,'rows':[]};var _0x2d74a9=_[_0xf0da('0x2a')](db['VoiceTransferReport'][_0xf0da('0x2b')],function(_0x29d3a5){return{'name':_0x29d3a5['fieldName'],'type':_0x29d3a5[_0xf0da('0x2c')]['key']};});_0x237cdb[_0xf0da('0x2d')]=_[_0xf0da('0x2a')](_0x2d74a9,'name');_0x237cdb[_0xf0da('0x2e')]=_[_0xf0da('0x2f')](_0xf340a0[_0xf0da('0x2e')]);_0x237cdb[_0xf0da('0x30')]=_['intersection'](_0x237cdb[_0xf0da('0x2d')],_0x237cdb[_0xf0da('0x2e')]);_0x1e918d['attributes']=_[_0xf0da('0x31')](_0x237cdb[_0xf0da('0x2d')],qs[_0xf0da('0x32')](_0xf340a0['query'][_0xf0da('0x32')]));_0x1e918d[_0xf0da('0x33')]=_0x1e918d[_0xf0da('0x33')][_0xf0da('0x34')]?_0x1e918d[_0xf0da('0x33')]:_0x237cdb[_0xf0da('0x2d')];if(!_0xf340a0[_0xf0da('0x2e')][_0xf0da('0x35')](_0xf0da('0x36'))){_0x1e918d['limit']=qs[_0xf0da('0x1c')](_0xf340a0[_0xf0da('0x2e')][_0xf0da('0x1c')]);_0x1e918d[_0xf0da('0x1a')]=qs[_0xf0da('0x1a')](_0xf340a0[_0xf0da('0x2e')][_0xf0da('0x1a')]);}_0x1e918d[_0xf0da('0x37')]=qs['sort'](_0xf340a0[_0xf0da('0x2e')][_0xf0da('0x38')]);_0x1e918d[_0xf0da('0x39')]=qs[_0xf0da('0x30')](_[_0xf0da('0x3a')](_0xf340a0[_0xf0da('0x2e')],_0x237cdb['filters']),_0x2d74a9);if(_0xf340a0[_0xf0da('0x2e')]['filter']){_0x1e918d['where']=_[_0xf0da('0x3b')](_0x1e918d[_0xf0da('0x39')],{'$or':_['map'](_0x2d74a9,function(_0x2703a4){if(_0x2703a4[_0xf0da('0x2c')]!==_0xf0da('0x3c')){var _0x3e2835={};_0x3e2835[_0x2703a4[_0xf0da('0x27')]]={'$like':'%'+_0xf340a0['query'][_0xf0da('0x3d')]+'%'};return _0x3e2835;}})});}_0x1e918d=_[_0xf0da('0x3b')]({},_0x1e918d,_0xf340a0[_0xf0da('0x3e')]);var _0x21f4b0={'where':_0x1e918d[_0xf0da('0x39')]};return db[_0xf0da('0x3f')]['count'](_0x21f4b0)[_0xf0da('0x23')](function(_0x1cf3a5){_0x35d7cc[_0xf0da('0x1d')]=_0x1cf3a5;if(_0xf340a0['query'][_0xf0da('0x40')]){_0x1e918d[_0xf0da('0x41')]=[{'all':!![]}];}return db[_0xf0da('0x3f')][_0xf0da('0x42')](_0x1e918d);})[_0xf0da('0x23')](function(_0x1762c7){_0x35d7cc[_0xf0da('0x43')]=_0x1762c7;return _0x35d7cc;})['then'](respondWithFilteredResult(_0x268827,_0x1e918d))[_0xf0da('0x44')](handleError(_0x268827,null));};exports[_0xf0da('0x45')]=function(_0x871214,_0x424345){var _0x480eb2={'raw':!![],'where':{'id':_0x871214['params']['id']}},_0x418970={};_0x418970[_0xf0da('0x2d')]=_[_0xf0da('0x2f')](db[_0xf0da('0x3f')][_0xf0da('0x2b')]);_0x418970[_0xf0da('0x2e')]=_[_0xf0da('0x2f')](_0x871214['query']);_0x418970[_0xf0da('0x30')]=_['intersection'](_0x418970[_0xf0da('0x2d')],_0x418970[_0xf0da('0x2e')]);_0x480eb2[_0xf0da('0x33')]=_[_0xf0da('0x31')](_0x418970[_0xf0da('0x2d')],qs[_0xf0da('0x32')](_0x871214[_0xf0da('0x2e')][_0xf0da('0x32')]));_0x480eb2[_0xf0da('0x33')]=_0x480eb2[_0xf0da('0x33')][_0xf0da('0x34')]?_0x480eb2[_0xf0da('0x33')]:_0x418970['model'];if(_0x871214[_0xf0da('0x2e')][_0xf0da('0x40')]){_0x480eb2[_0xf0da('0x41')]=[{'all':!![]}];}_0x480eb2=_[_0xf0da('0x3b')]({},_0x480eb2,_0x871214[_0xf0da('0x3e')]);return db['VoiceTransferReport'][_0xf0da('0x46')](_0x480eb2)['then'](handleEntityNotFound(_0x424345,null))['then'](respondWithResult(_0x424345,null))[_0xf0da('0x44')](handleError(_0x424345,null));};exports[_0xf0da('0x47')]=function(_0x372e2e,_0x5db2b9){return db[_0xf0da('0x3f')]['create'](_0x372e2e[_0xf0da('0x48')],{})[_0xf0da('0x23')](respondWithResult(_0x5db2b9,0xc9))[_0xf0da('0x44')](handleError(_0x5db2b9,null));};exports[_0xf0da('0x49')]=function(_0x40b6d4,_0x1d0893){if(_0x40b6d4[_0xf0da('0x48')]['id']){delete _0x40b6d4[_0xf0da('0x48')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x40b6d4[_0xf0da('0x4a')]['id']}})[_0xf0da('0x23')](handleEntityNotFound(_0x1d0893,null))['then'](saveUpdates(_0x40b6d4[_0xf0da('0x48')],null))[_0xf0da('0x23')](respondWithResult(_0x1d0893,null))[_0xf0da('0x44')](handleError(_0x1d0893,null));};exports[_0xf0da('0x24')]=function(_0x1c8b6f,_0x18a311){return db[_0xf0da('0x3f')][_0xf0da('0x46')]({'where':{'id':_0x1c8b6f[_0xf0da('0x4a')]['id']}})['then'](handleEntityNotFound(_0x18a311,null))[_0xf0da('0x23')](removeEntity(_0x18a311,null))[_0xf0da('0x44')](handleError(_0x18a311,null));};exports[_0xf0da('0x4b')]=function(_0x8c00ac,_0x3683a1){return db[_0xf0da('0x3f')]['describe']()['then'](respondWithResult(_0x3683a1,null))[_0xf0da('0x44')](handleError(_0x3683a1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 2018206..dce2eaf 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 _0x9719=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','../../config/logger','api'];(function(_0x4aefc9,_0x27bfdc){var _0x1537a4=function(_0x3836a6){while(--_0x3836a6){_0x4aefc9['push'](_0x4aefc9['shift']());}};_0x1537a4(++_0x27bfdc);}(_0x9719,0x8e));var _0x9971=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9719[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9971('0x0'))(_0x9971('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9971('0x2'));var rimraf=require(_0x9971('0x3'));var config=require(_0x9971('0x4'));var attributes=require(_0x9971('0x5'));module[_0x9971('0x6')]=function(_0x2fb7fa,_0x2e54c9){return _0x2fb7fa['define'](_0x9971('0x7'),attributes,{'tableName':_0x9971('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f89=['util','api','moment','bluebird','rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer'];(function(_0x398c23,_0x294a30){var _0x5392c0=function(_0x4dc9b3){while(--_0x4dc9b3){_0x398c23['push'](_0x398c23['shift']());}};_0x5392c0(++_0x294a30);}(_0x8f89,0x144));var _0x98f8=function(_0x1b8b12,_0x2f8c1b){_0x1b8b12=_0x1b8b12-0x0;var _0x1e6d56=_0x8f89[_0x1b8b12];return _0x1e6d56;};'use strict';var _=require('lodash');var util=require(_0x98f8('0x0'));var logger=require('../../config/logger')(_0x98f8('0x1'));var moment=require(_0x98f8('0x2'));var BPromise=require(_0x98f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x98f8('0x4'));var config=require('../../config/environment');var attributes=require(_0x98f8('0x5'));module[_0x98f8('0x6')]=function(_0x3a05ec,_0x411a05){return _0x3a05ec['define'](_0x98f8('0x7'),attributes,{'tableName':_0x98f8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 7b0ceb0..96cfa1e 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 _0x4a38=['CreateVoiceTransferReport','VoiceTransferReport','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x4a38,0x18a));var _0x84a3=function(_0x55f6c4,_0x3434e3){_0x55f6c4=_0x55f6c4-0x0;var _0x3c90bd=_0x4a38[_0x55f6c4];return _0x3c90bd;};'use strict';var _=require(_0x84a3('0x0'));var util=require(_0x84a3('0x1'));var moment=require(_0x84a3('0x2'));var BPromise=require(_0x84a3('0x3'));var rs=require(_0x84a3('0x4'));var fs=require('fs');var Redis=require(_0x84a3('0x5'));var db=require(_0x84a3('0x6'))['db'];var utils=require(_0x84a3('0x7'));var logger=require(_0x84a3('0x8'))(_0x84a3('0x9'));var config=require(_0x84a3('0xa'));var jayson=require(_0x84a3('0xb'));var client=jayson[_0x84a3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x225c97,_0x4e239d,_0x344ab1){return new BPromise(function(_0x35989a,_0x5885a9){return client['request'](_0x225c97,_0x344ab1)['then'](function(_0x175b00){logger[_0x84a3('0xd')](_0x84a3('0xe'),_0x4e239d,_0x84a3('0xf'));logger[_0x84a3('0x10')](_0x84a3('0x11'),_0x4e239d,_0x84a3('0xf'),JSON['stringify'](_0x175b00));if(_0x175b00[_0x84a3('0x12')]){if(_0x175b00[_0x84a3('0x12')][_0x84a3('0x13')]===0x1f4){logger[_0x84a3('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4e239d,_0x175b00[_0x84a3('0x12')][_0x84a3('0x14')]);return _0x5885a9(_0x175b00['error']['message']);}logger['error'](_0x84a3('0xe'),_0x4e239d,_0x175b00[_0x84a3('0x12')][_0x84a3('0x14')]);return _0x35989a(_0x175b00['error'][_0x84a3('0x14')]);}else{logger[_0x84a3('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x4e239d,_0x84a3('0xf'));_0x35989a(_0x175b00['result'][_0x84a3('0x14')]);}})[_0x84a3('0x15')](function(_0x53e88a){logger[_0x84a3('0x12')](_0x84a3('0xe'),_0x4e239d,_0x53e88a);_0x5885a9(_0x53e88a);});});}exports[_0x84a3('0x16')]=function(_0x2b89fc){var _0x2ea54c=this;return new Promise(function(_0x22a8be,_0x50cb51){return db[_0x84a3('0x17')][_0x84a3('0x18')](_0x2b89fc['body'],{'raw':_0x2b89fc[_0x84a3('0x19')]?_0x2b89fc['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x28be5c){logger[_0x84a3('0xd')]('CreateVoiceTransferReport',_0x2b89fc);logger[_0x84a3('0x10')](_0x84a3('0x16'),_0x2b89fc,JSON['stringify'](_0x28be5c));_0x22a8be(_0x28be5c);})[_0x84a3('0x15')](function(_0xc8c310){logger[_0x84a3('0x12')](_0x84a3('0x16'),_0xc8c310[_0x84a3('0x14')],_0x2b89fc);_0x50cb51(_0x2ea54c[_0x84a3('0x12')](0x1f4,_0xc8c310[_0x84a3('0x14')]));});});}; \ No newline at end of file +var _0xf195=['VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xf195,0x156));var _0x5f19=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xf195[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0x5f19('0x0'));var moment=require(_0x5f19('0x1'));var BPromise=require(_0x5f19('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f19('0x3'));var db=require(_0x5f19('0x4'))['db'];var utils=require(_0x5f19('0x5'));var logger=require(_0x5f19('0x6'))(_0x5f19('0x7'));var config=require(_0x5f19('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5f19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x367372,_0x13e087,_0x2613cc){return new BPromise(function(_0x454450,_0x33b99a){return client[_0x5f19('0xa')](_0x367372,_0x2613cc)[_0x5f19('0xb')](function(_0x391e47){logger[_0x5f19('0xc')](_0x5f19('0xd'),_0x13e087,_0x5f19('0xe'));logger[_0x5f19('0xf')](_0x5f19('0x10'),_0x13e087,_0x5f19('0xe'),JSON[_0x5f19('0x11')](_0x391e47));if(_0x391e47['error']){if(_0x391e47[_0x5f19('0x12')][_0x5f19('0x13')]===0x1f4){logger[_0x5f19('0x12')](_0x5f19('0xd'),_0x13e087,_0x391e47[_0x5f19('0x12')][_0x5f19('0x14')]);return _0x33b99a(_0x391e47[_0x5f19('0x12')][_0x5f19('0x14')]);}logger[_0x5f19('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x13e087,_0x391e47[_0x5f19('0x12')]['message']);return _0x454450(_0x391e47[_0x5f19('0x12')][_0x5f19('0x14')]);}else{logger[_0x5f19('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x13e087,'request\x20sent');_0x454450(_0x391e47['result']['message']);}})[_0x5f19('0x15')](function(_0x3247e8){logger['error'](_0x5f19('0xd'),_0x13e087,_0x3247e8);_0x33b99a(_0x3247e8);});});}exports['CreateVoiceTransferReport']=function(_0x3fadf8){var _0x597862=this;return new Promise(function(_0x4f7a93,_0x5974a0){return db[_0x5f19('0x16')][_0x5f19('0x17')](_0x3fadf8[_0x5f19('0x18')],{'raw':_0x3fadf8[_0x5f19('0x19')]?_0x3fadf8[_0x5f19('0x19')][_0x5f19('0x1a')]===undefined?!![]:![]:!![]})[_0x5f19('0xb')](function(_0x2ebc89){logger[_0x5f19('0xc')](_0x5f19('0x1b'),_0x3fadf8);logger[_0x5f19('0xf')](_0x5f19('0x1b'),_0x3fadf8,JSON['stringify'](_0x2ebc89));_0x4f7a93(_0x2ebc89);})[_0x5f19('0x15')](function(_0x46ff20){logger['error'](_0x5f19('0x1b'),_0x46ff20[_0x5f19('0x14')],_0x3fadf8);_0x5974a0(_0x597862['error'](0x1f4,_0x46ff20[_0x5f19('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9ff5361..5a410c6 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(_0x774a25,_0x46f547){var _0x3dc2fd=function(_0x27de02){while(--_0x27de02){_0x774a25['push'](_0x774a25['shift']());}};_0x3dc2fd(++_0x46f547);}(_0x91a7,0xe7));var _0x791a=function(_0x48c2e3,_0x59c92c){_0x48c2e3=_0x48c2e3-0x0;var _0x335409=_0x91a7[_0x48c2e3];return _0x335409;};'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 _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb43b,0x1b2));var _0xbb43=function(_0x32379b,_0x225ece){_0x32379b=_0x32379b-0x0;var _0x407e7f=_0xb43b[_0x32379b];return _0x407e7f;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 36198cd..a82a47c 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 _0x5fc6=['webbar:originate','hangup','hangup\x20fired:','userId','sessionId','format','webbar:hangup','hangup\x20executed!','catch','answer','webbar:answer','answer\x20executed!','hold','unhold','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','originate','info','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s'];(function(_0x235939,_0x1437c8){var _0x10a825=function(_0x570d5b){while(--_0x570d5b){_0x235939['push'](_0x235939['shift']());}};_0x10a825(++_0x1437c8);}(_0x5fc6,0xfc));var _0x65fc=function(_0x57a612,_0x8a37fb){_0x57a612=_0x57a612-0x0;var _0x10c358=_0x5fc6[_0x57a612];return _0x10c358;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x65fc('0x0'));var db=require(_0x65fc('0x1'))['db'];var config=require(_0x65fc('0x2'));var util=require('util');var BPromise=require(_0x65fc('0x3'));var jayson=require(_0x65fc('0x4'));var amiClient=jayson[_0x65fc('0x5')][_0x65fc('0x6')]({'port':0x232a});var logger=require(_0x65fc('0x7'))('webbarapi');var Redis=require(_0x65fc('0x8'));config[_0x65fc('0x9')]=_[_0x65fc('0xa')](config[_0x65fc('0x9')],{'host':_0x65fc('0xb'),'port':0x18eb});var io=require(_0x65fc('0xc'))(new Redis(config[_0x65fc('0x9')]));var Schema=require(_0x65fc('0xd'));var originateValidation=new Schema({'userId':{'type':_0x65fc('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x65fc('0xf'),'required':[!![],_0x65fc('0x10')]},'callerId':{'type':_0x65fc('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x65fc('0xe'),'required':[!![],_0x65fc('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x65fc('0xe'),'required':[!![],_0x65fc('0x11')]},'sessionId':{'type':_0x65fc('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x65fc('0xe'),'required':[!![],_0x65fc('0x11')]},'sessionId':{'type':_0x65fc('0xf'),'required':[!![],_0x65fc('0x12')]},'transferNumber':{'type':_0x65fc('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x65fc('0xe'),'required':[!![],_0x65fc('0x11')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x65fc('0xe'),'required':[!![],_0x65fc('0x11')]},'sessionId':{'type':_0x65fc('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x65fc('0xe'),'required':[!![],_0x65fc('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0x65fc('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0xfbf80b,_0x396a51,_0x46fe01){logger['info'](_0xfbf80b,_0x396a51,JSON['stringify'](_0x46fe01));io['to'](_0xfbf80b)[_0x65fc('0x13')](_0x396a51,_0x46fe01);}function handleError(_0x40fc80){return function(_0x19ca60){console[_0x65fc('0x14')](_0x65fc('0x15'),_0x19ca60,_0x19ca60 instanceof RangeError);logger['error'](_0x19ca60[_0x65fc('0x16')]);if(_0x19ca60 instanceof RangeError){if(_0x19ca60['name']){delete _0x19ca60[_0x65fc('0x17')];}_0x40fc80['status'](0x194)['send'](_0x19ca60);}else{if(_0x19ca60[_0x65fc('0x17')]){delete _0x19ca60[_0x65fc('0x17')];}_0x40fc80[_0x65fc('0x18')](0x1f4)[_0x65fc('0x19')](_0x19ca60);}};}function checkError(){return function(_0x2d18f4){if(!_0x2d18f4){throw new RangeError(_0x65fc('0x1a'));}return _0x2d18f4;};}function respondWithRpcPromise(_0x2328aa,_0x45983a){return new BPromise(function(_0x501f98,_0x55ad22){var _0x3d209b=amiClient;return _0x3d209b[_0x65fc('0x1b')](_0x2328aa,_0x45983a)[_0x65fc('0x1c')](function(_0x414206){if(_0x414206[_0x65fc('0x1d')]){if(_0x414206[_0x65fc('0x1d')][_0x65fc('0x1e')]===0x1f4){return _0x55ad22(_0x414206[_0x65fc('0x1d')][_0x65fc('0x1f')]);}return _0x501f98(_0x414206['error']['message']);}else{_0x501f98(_0x414206[_0x65fc('0x20')]);}})['catch'](function(_0xa06883){_0x55ad22(_0xa06883);});});}function getAgent(_0x5310df){return db[_0x65fc('0x21')][_0x65fc('0x22')]({'where':{'id':_0x5310df,'role':_0x65fc('0x23')}})[_0x65fc('0x1c')](checkError());}function getAgentCheckSession(_0x3685a3,_0x59a63c){return new BPromise(function(_0x4ee52a,_0x3ef582){var _0x2b078e=respondWithRpcPromise(_0x65fc('0x24'));var _0x57b23c=getAgent(_0x3685a3);Promise[_0x65fc('0x25')]([_0x2b078e,_0x57b23c])['then'](function(_0x7ab48b){var _0x2c39eb=_0x7ab48b[0x0];var _0x4b8e6c=_0x7ab48b[0x1];var _0x587bf2=_[_0x65fc('0x26')](_0x2c39eb[_0x65fc('0x27')],function(_0x28a480){return _0x28a480[_0x65fc('0x28')]==_0x4b8e6c['id']&&_0x28a480['sessionId']==_0x59a63c;});if(_0x587bf2[_0x65fc('0x29')]==0x1){_0x4ee52a(_0x4b8e6c);}else{_0x3ef582(new RangeError(_0x65fc('0x2a')+_0x59a63c+'\x20not\x20found!'));}});});}exports[_0x65fc('0x2b')]=function(_0x3dc6de,_0x1a459e){logger[_0x65fc('0x2c')]('originate\x20fired:',_0x3dc6de[_0x65fc('0x2d')]);var _0x4d4cc9=originateValidation[_0x65fc('0xd')](_0x3dc6de[_0x65fc('0x2d')]);if(_0x4d4cc9['length']>0x0){return _0x1a459e[_0x65fc('0x18')](0x190)[_0x65fc('0x2e')](_0x4d4cc9);}var _0x21f98f=_0x3dc6de[_0x65fc('0x2d')]['userId'];var _0x45e666=_0x3dc6de[_0x65fc('0x2d')][_0x65fc('0x2f')];var _0x4365f4=_0x3dc6de['body'][_0x65fc('0x30')];var _0x4d19c4=_0x3dc6de[_0x65fc('0x2d')][_0x65fc('0x31')];return getAgent(_0x21f98f)['then'](function(_0x40ee09){logger[_0x65fc('0x2c')](_0x65fc('0x32'),_0x40ee09[_0x65fc('0x17')]);emit(util['format'](_0x65fc('0x33'),_0x40ee09[_0x65fc('0x17')]),_0x65fc('0x34'),{'callNumber':_0x45e666,'callerId':_0x4365f4,'callbackUrl':_0x4d19c4});return _0x1a459e[_0x65fc('0x18')](0xc8)[_0x65fc('0x2e')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x1a459e));};exports[_0x65fc('0x35')]=function(_0x530262,_0x33d92d){logger[_0x65fc('0x2c')](_0x65fc('0x36'),_0x530262['body']);var _0x116d8f=hangupValidation[_0x65fc('0xd')](_0x530262[_0x65fc('0x2d')]);if(_0x116d8f[_0x65fc('0x29')]>0x0){return _0x33d92d[_0x65fc('0x18')](0x190)[_0x65fc('0x2e')](_0x116d8f);}var _0x17e896=_0x530262[_0x65fc('0x2d')][_0x65fc('0x37')];var _0x450ae8=_0x530262[_0x65fc('0x2d')][_0x65fc('0x38')];return getAgent(_0x17e896)[_0x65fc('0x1c')](function(_0x27ec89){logger[_0x65fc('0x2c')](_0x65fc('0x32'),_0x27ec89['name']);emit(util[_0x65fc('0x39')](_0x65fc('0x33'),_0x27ec89['name']),_0x65fc('0x3a'),{'sessionId':_0x450ae8});return _0x33d92d[_0x65fc('0x18')](0xc8)['json']({'error':![],'message':_0x65fc('0x3b')});})[_0x65fc('0x3c')](handleError(_0x33d92d));};exports[_0x65fc('0x3d')]=function(_0x40dabc,_0x522432){logger[_0x65fc('0x2c')]('answer\x20fired:',_0x40dabc['body']);var _0x571a72=answerValidation[_0x65fc('0xd')](_0x40dabc[_0x65fc('0x2d')]);if(_0x571a72[_0x65fc('0x29')]>0x0){return _0x522432['status'](0x190)['json'](_0x571a72);}var _0x288d3f=_0x40dabc[_0x65fc('0x2d')][_0x65fc('0x37')];var _0x45f466=_0x40dabc['body'][_0x65fc('0x38')];return getAgent(_0x288d3f)['then'](function(_0x1c426){logger[_0x65fc('0x2c')]('entityFound:',_0x1c426[_0x65fc('0x17')]);emit(util[_0x65fc('0x39')]('user:%s',_0x1c426[_0x65fc('0x17')]),_0x65fc('0x3e'),{'sessionId':_0x45f466});return _0x522432[_0x65fc('0x18')](0xc8)[_0x65fc('0x2e')]({'error':![],'message':_0x65fc('0x3f')});})['catch'](handleError(_0x522432));};exports[_0x65fc('0x40')]=function(_0x15a11b,_0x51d094){logger[_0x65fc('0x2c')]('hold\x20fired:',_0x15a11b[_0x65fc('0x2d')]);var _0x39b09e=holdValidation[_0x65fc('0xd')](_0x15a11b[_0x65fc('0x2d')]);if(_0x39b09e[_0x65fc('0x29')]>0x0){return _0x51d094[_0x65fc('0x18')](0x190)[_0x65fc('0x2e')](_0x39b09e);}var _0x39bbfe=_0x15a11b['body']['userId'];var _0xe232cc=_0x15a11b[_0x65fc('0x2d')]['sessionId'];return getAgent(_0x39bbfe)[_0x65fc('0x1c')](function(_0x3e8338){logger[_0x65fc('0x2c')](_0x65fc('0x32'),_0x3e8338['name']);emit(util['format'](_0x65fc('0x33'),_0x3e8338[_0x65fc('0x17')]),'webbar:hold',{'sessionId':_0xe232cc});return _0x51d094['status'](0xc8)[_0x65fc('0x2e')]({'error':![],'message':'hold\x20executed!'});})[_0x65fc('0x3c')](handleError(_0x51d094));};exports[_0x65fc('0x41')]=function(_0x400d1e,_0x449e3e){logger[_0x65fc('0x2c')]('unhold\x20fired:',_0x400d1e[_0x65fc('0x2d')]);var _0x5a7e84=unholdValidation['validate'](_0x400d1e[_0x65fc('0x2d')]);if(_0x5a7e84[_0x65fc('0x29')]>0x0){return _0x449e3e[_0x65fc('0x18')](0x190)['json'](_0x5a7e84);}var _0x4f1a2f=_0x400d1e[_0x65fc('0x2d')][_0x65fc('0x37')];var _0x4a34fa=_0x400d1e[_0x65fc('0x2d')][_0x65fc('0x38')];return getAgent(_0x4f1a2f)[_0x65fc('0x1c')](function(_0x4b5fa2){logger['info']('entityFound:',_0x4b5fa2[_0x65fc('0x17')]);emit(util[_0x65fc('0x39')](_0x65fc('0x33'),_0x4b5fa2[_0x65fc('0x17')]),_0x65fc('0x42'),{'sessionId':_0x4a34fa});return _0x449e3e['status'](0xc8)[_0x65fc('0x2e')]({'error':![],'message':'unhold\x20executed!'});})[_0x65fc('0x3c')](handleError(_0x449e3e));};exports[_0x65fc('0x43')]=function(_0x55853e,_0x30494f){logger[_0x65fc('0x2c')](_0x65fc('0x44'),_0x30494f[_0x65fc('0x2d')]);var _0x35fb22=callsValidation[_0x65fc('0xd')](_0x55853e[_0x65fc('0x2d')]);if(_0x35fb22[_0x65fc('0x29')]>0x0){return _0x30494f[_0x65fc('0x18')](0x190)['json'](_0x35fb22);}var _0x4912c4=_0x55853e[_0x65fc('0x2d')][_0x65fc('0x37')];var _0x58d72a=respondWithRpcPromise(_0x65fc('0x24'));var _0x31a781=getAgent(_0x4912c4);return Promise[_0x65fc('0x25')]([_0x58d72a,_0x31a781])[_0x65fc('0x1c')](function(_0x2b4288){var _0x46a04a=_0x2b4288[0x0];var _0x5a7daf=_0x2b4288[0x1];var _0x58ba82=_[_0x65fc('0x26')](_0x46a04a[_0x65fc('0x27')],function(_0x90be17){return _0x90be17[_0x65fc('0x28')]==_0x5a7daf['id'];});return _0x30494f[_0x65fc('0x18')](0xc8)[_0x65fc('0x2e')]({'count':_0x58ba82['length'],'rows':_0x58ba82});})['catch'](handleError(_0x30494f));};exports[_0x65fc('0x45')]=function(_0x39a829,_0x4205fc){logger['info'](_0x65fc('0x46'),_0x39a829['body']);var _0x9c5fcb=conferenceValidation[_0x65fc('0xd')](_0x39a829[_0x65fc('0x2d')]);if(_0x9c5fcb[_0x65fc('0x29')]>0x0){return _0x4205fc[_0x65fc('0x18')](0x190)[_0x65fc('0x2e')](_0x9c5fcb);}var _0x251fe6=_0x39a829[_0x65fc('0x2d')][_0x65fc('0x37')];return getAgent(_0x251fe6)[_0x65fc('0x1c')](function(_0x7565b6){logger[_0x65fc('0x2c')](_0x65fc('0x32'),_0x7565b6['name']);emit(util[_0x65fc('0x39')]('user:%s',_0x7565b6[_0x65fc('0x17')]),_0x65fc('0x47'));return _0x4205fc[_0x65fc('0x18')](0xc8)['json']({'error':![],'message':_0x65fc('0x48')});})['catch'](handleError(_0x4205fc));};exports[_0x65fc('0x49')]=function(_0x5f38e1,_0x2ca1a0){logger[_0x65fc('0x2c')](_0x65fc('0x4a'),_0x5f38e1[_0x65fc('0x2d')]);var _0x2212ee=transferValidation['validate'](_0x5f38e1['body']);if(_0x2212ee[_0x65fc('0x29')]>0x0){return _0x2ca1a0['status'](0x190)[_0x65fc('0x2e')](_0x2212ee);}var _0x4a5be8=_0x5f38e1['body'][_0x65fc('0x37')];var _0x5e7472=_0x5f38e1[_0x65fc('0x2d')][_0x65fc('0x38')];var _0x48bc20=_0x5f38e1[_0x65fc('0x2d')]['transferNumber'];return getAgent(_0x4a5be8)['then'](function(_0x47f48a){logger[_0x65fc('0x2c')]('entityFound:',_0x47f48a[_0x65fc('0x17')]);emit(util[_0x65fc('0x39')](_0x65fc('0x33'),_0x47f48a[_0x65fc('0x17')]),_0x65fc('0x4b'),{'sessionId':_0x5e7472,'transferNumber':_0x48bc20});return _0x2ca1a0['status'](0xc8)[_0x65fc('0x2e')]({'error':![],'message':'transfer\x20executed!'});})[_0x65fc('0x3c')](handleError(_0x2ca1a0));}; \ No newline at end of file +var _0x3651=['sessionId\x20','\x20not\x20found!','originate\x20fired:','json','body','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length'];(function(_0x56598b,_0x38bdb3){var _0x172135=function(_0x49074e){while(--_0x49074e){_0x56598b['push'](_0x56598b['shift']());}};_0x172135(++_0x38bdb3);}(_0x3651,0x160));var _0x1365=function(_0x583690,_0x31bc5c){_0x583690=_0x583690-0x0;var _0x2ca9ce=_0x3651[_0x583690];return _0x2ca9ce;};'use strict';var path=require(_0x1365('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x1365('0x1'))['db'];var config=require(_0x1365('0x2'));var util=require('util');var BPromise=require(_0x1365('0x3'));var jayson=require(_0x1365('0x4'));var amiClient=jayson['client'][_0x1365('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x1365('0x6'));var Redis=require(_0x1365('0x7'));config[_0x1365('0x8')]=_['defaults'](config[_0x1365('0x8')],{'host':_0x1365('0x9'),'port':0x18eb});var io=require(_0x1365('0xa'))(new Redis(config['redis']));var Schema=require(_0x1365('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1365('0xc')]},'callNumber':{'type':_0x1365('0xd'),'required':[!![],_0x1365('0xe')]},'callerId':{'type':_0x1365('0xd')},'callbackUrl':{'type':_0x1365('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x1365('0xd'),'required':[!![],_0x1365('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]}});function emit(_0x5913b9,_0x12475f,_0x265013){logger[_0x1365('0x11')](_0x5913b9,_0x12475f,JSON[_0x1365('0x12')](_0x265013));io['to'](_0x5913b9)[_0x1365('0x13')](_0x12475f,_0x265013);}function handleError(_0x28d283){return function(_0x489385){console['log'](_0x1365('0x14'),_0x489385,_0x489385 instanceof RangeError);logger[_0x1365('0x15')](_0x489385[_0x1365('0x16')]);if(_0x489385 instanceof RangeError){if(_0x489385[_0x1365('0x17')]){delete _0x489385[_0x1365('0x17')];}_0x28d283[_0x1365('0x18')](0x194)['send'](_0x489385);}else{if(_0x489385[_0x1365('0x17')]){delete _0x489385['name'];}_0x28d283['status'](0x1f4)[_0x1365('0x19')](_0x489385);}};}function checkError(){return function(_0x56b5ee){if(!_0x56b5ee){throw new RangeError(_0x1365('0x1a'));}return _0x56b5ee;};}function respondWithRpcPromise(_0x5f2368,_0x5223e7){return new BPromise(function(_0x520990,_0x3ac0b2){var _0xa6bdc8=amiClient;return _0xa6bdc8[_0x1365('0x1b')](_0x5f2368,_0x5223e7)[_0x1365('0x1c')](function(_0x1d2f05){if(_0x1d2f05[_0x1365('0x15')]){if(_0x1d2f05[_0x1365('0x15')][_0x1365('0x1d')]===0x1f4){return _0x3ac0b2(_0x1d2f05[_0x1365('0x15')][_0x1365('0x1e')]);}return _0x520990(_0x1d2f05['error'][_0x1365('0x1e')]);}else{_0x520990(_0x1d2f05[_0x1365('0x1f')]);}})[_0x1365('0x20')](function(_0x2c0d43){_0x3ac0b2(_0x2c0d43);});});}function getAgent(_0x31c5d3){return db[_0x1365('0x21')][_0x1365('0x22')]({'where':{'id':_0x31c5d3,'role':_0x1365('0x23')}})[_0x1365('0x1c')](checkError());}function getAgentCheckSession(_0x405cac,_0x20b1da){return new BPromise(function(_0x4ce08b,_0xc611e5){var _0x1a4b7c=respondWithRpcPromise(_0x1365('0x24'));var _0x58c063=getAgent(_0x405cac);Promise[_0x1365('0x25')]([_0x1a4b7c,_0x58c063])[_0x1365('0x1c')](function(_0xe4f5fc){var _0x31310d=_0xe4f5fc[0x0];var _0x411fc=_0xe4f5fc[0x1];var _0x17a68f=_[_0x1365('0x26')](_0x31310d[_0x1365('0x27')],function(_0x2581d8){return _0x2581d8[_0x1365('0x28')]==_0x411fc['id']&&_0x2581d8[_0x1365('0x29')]==_0x20b1da;});if(_0x17a68f[_0x1365('0x2a')]==0x1){_0x4ce08b(_0x411fc);}else{_0xc611e5(new RangeError(_0x1365('0x2b')+_0x20b1da+_0x1365('0x2c')));}});});}exports['originate']=function(_0x7407d5,_0xe7b649){logger[_0x1365('0x11')](_0x1365('0x2d'),_0x7407d5['body']);var _0x9eac3b=originateValidation[_0x1365('0xb')](_0x7407d5['body']);if(_0x9eac3b['length']>0x0){return _0xe7b649[_0x1365('0x18')](0x190)[_0x1365('0x2e')](_0x9eac3b);}var _0x5173af=_0x7407d5['body']['userId'];var _0x49e04f=_0x7407d5[_0x1365('0x2f')]['callNumber'];var _0x5ea9b5=_0x7407d5[_0x1365('0x2f')][_0x1365('0x30')];var _0x5f54b4=_0x7407d5[_0x1365('0x2f')]['callbackUrl'];return getAgent(_0x5173af)['then'](function(_0x121f03){logger[_0x1365('0x11')](_0x1365('0x31'),_0x121f03[_0x1365('0x17')]);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x121f03[_0x1365('0x17')]),_0x1365('0x34'),{'callNumber':_0x49e04f,'callerId':_0x5ea9b5,'callbackUrl':_0x5f54b4});return _0xe7b649['status'](0xc8)[_0x1365('0x2e')]({'error':![],'message':_0x1365('0x35')});})[_0x1365('0x20')](handleError(_0xe7b649));};exports[_0x1365('0x36')]=function(_0x1e0960,_0x1c5768){logger[_0x1365('0x11')]('hangup\x20fired:',_0x1e0960['body']);var _0x47048d=hangupValidation[_0x1365('0xb')](_0x1e0960[_0x1365('0x2f')]);if(_0x47048d[_0x1365('0x2a')]>0x0){return _0x1c5768['status'](0x190)['json'](_0x47048d);}var _0x17255c=_0x1e0960[_0x1365('0x2f')][_0x1365('0x37')];var _0x5be80a=_0x1e0960[_0x1365('0x2f')][_0x1365('0x29')];return getAgent(_0x17255c)['then'](function(_0x1d72cb){logger[_0x1365('0x11')](_0x1365('0x31'),_0x1d72cb[_0x1365('0x17')]);emit(util[_0x1365('0x32')]('user:%s',_0x1d72cb[_0x1365('0x17')]),_0x1365('0x38'),{'sessionId':_0x5be80a});return _0x1c5768['status'](0xc8)['json']({'error':![],'message':_0x1365('0x39')});})[_0x1365('0x20')](handleError(_0x1c5768));};exports[_0x1365('0x3a')]=function(_0x40b232,_0x306fda){logger[_0x1365('0x11')](_0x1365('0x3b'),_0x40b232['body']);var _0x2e160d=answerValidation[_0x1365('0xb')](_0x40b232[_0x1365('0x2f')]);if(_0x2e160d[_0x1365('0x2a')]>0x0){return _0x306fda[_0x1365('0x18')](0x190)[_0x1365('0x2e')](_0x2e160d);}var _0x2d29c7=_0x40b232[_0x1365('0x2f')][_0x1365('0x37')];var _0x17120a=_0x40b232[_0x1365('0x2f')][_0x1365('0x29')];return getAgent(_0x2d29c7)[_0x1365('0x1c')](function(_0x34d427){logger[_0x1365('0x11')](_0x1365('0x31'),_0x34d427['name']);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x34d427[_0x1365('0x17')]),_0x1365('0x3c'),{'sessionId':_0x17120a});return _0x306fda[_0x1365('0x18')](0xc8)['json']({'error':![],'message':_0x1365('0x3d')});})[_0x1365('0x20')](handleError(_0x306fda));};exports[_0x1365('0x3e')]=function(_0x185f21,_0x4a1c1b){logger[_0x1365('0x11')](_0x1365('0x3f'),_0x185f21[_0x1365('0x2f')]);var _0x34c9a0=holdValidation['validate'](_0x185f21[_0x1365('0x2f')]);if(_0x34c9a0[_0x1365('0x2a')]>0x0){return _0x4a1c1b[_0x1365('0x18')](0x190)['json'](_0x34c9a0);}var _0x27f5f2=_0x185f21[_0x1365('0x2f')][_0x1365('0x37')];var _0x5b2ef1=_0x185f21[_0x1365('0x2f')][_0x1365('0x29')];return getAgent(_0x27f5f2)[_0x1365('0x1c')](function(_0x403dbb){logger[_0x1365('0x11')]('entityFound:',_0x403dbb[_0x1365('0x17')]);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x403dbb[_0x1365('0x17')]),'webbar:hold',{'sessionId':_0x5b2ef1});return _0x4a1c1b[_0x1365('0x18')](0xc8)[_0x1365('0x2e')]({'error':![],'message':_0x1365('0x40')});})[_0x1365('0x20')](handleError(_0x4a1c1b));};exports[_0x1365('0x41')]=function(_0x21db35,_0xdfabf5){logger['info'](_0x1365('0x42'),_0x21db35[_0x1365('0x2f')]);var _0x3c50b3=unholdValidation[_0x1365('0xb')](_0x21db35[_0x1365('0x2f')]);if(_0x3c50b3[_0x1365('0x2a')]>0x0){return _0xdfabf5['status'](0x190)[_0x1365('0x2e')](_0x3c50b3);}var _0x449b31=_0x21db35['body'][_0x1365('0x37')];var _0x162c13=_0x21db35[_0x1365('0x2f')][_0x1365('0x29')];return getAgent(_0x449b31)[_0x1365('0x1c')](function(_0x523911){logger[_0x1365('0x11')]('entityFound:',_0x523911[_0x1365('0x17')]);emit(util[_0x1365('0x32')]('user:%s',_0x523911[_0x1365('0x17')]),_0x1365('0x43'),{'sessionId':_0x162c13});return _0xdfabf5[_0x1365('0x18')](0xc8)['json']({'error':![],'message':_0x1365('0x44')});})[_0x1365('0x20')](handleError(_0xdfabf5));};exports[_0x1365('0x45')]=function(_0x2ffd1c,_0x4bbd6c){logger['info'](_0x1365('0x46'),_0x4bbd6c[_0x1365('0x2f')]);var _0x4ed176=callsValidation[_0x1365('0xb')](_0x2ffd1c[_0x1365('0x2f')]);if(_0x4ed176[_0x1365('0x2a')]>0x0){return _0x4bbd6c[_0x1365('0x18')](0x190)[_0x1365('0x2e')](_0x4ed176);}var _0x2c6897=_0x2ffd1c[_0x1365('0x2f')][_0x1365('0x37')];var _0x5e8999=respondWithRpcPromise('VoiceChannels');var _0x1d50e8=getAgent(_0x2c6897);return Promise[_0x1365('0x25')]([_0x5e8999,_0x1d50e8])[_0x1365('0x1c')](function(_0x2dd3c8){var _0x1f0259=_0x2dd3c8[0x0];var _0x25a111=_0x2dd3c8[0x1];var _0x2a72b0=_['filter'](_0x1f0259['rows'],function(_0x3adc9f){return _0x3adc9f['UserId']==_0x25a111['id'];});return _0x4bbd6c[_0x1365('0x18')](0xc8)[_0x1365('0x2e')]({'count':_0x2a72b0[_0x1365('0x2a')],'rows':_0x2a72b0});})[_0x1365('0x20')](handleError(_0x4bbd6c));};exports[_0x1365('0x47')]=function(_0x2d0f83,_0x5bab){logger[_0x1365('0x11')](_0x1365('0x48'),_0x2d0f83[_0x1365('0x2f')]);var _0x38f1ba=conferenceValidation['validate'](_0x2d0f83[_0x1365('0x2f')]);if(_0x38f1ba['length']>0x0){return _0x5bab[_0x1365('0x18')](0x190)[_0x1365('0x2e')](_0x38f1ba);}var _0x192298=_0x2d0f83[_0x1365('0x2f')][_0x1365('0x37')];return getAgent(_0x192298)[_0x1365('0x1c')](function(_0x232a1a){logger[_0x1365('0x11')]('entityFound:',_0x232a1a[_0x1365('0x17')]);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x232a1a[_0x1365('0x17')]),_0x1365('0x49'));return _0x5bab[_0x1365('0x18')](0xc8)[_0x1365('0x2e')]({'error':![],'message':_0x1365('0x4a')});})[_0x1365('0x20')](handleError(_0x5bab));};exports[_0x1365('0x4b')]=function(_0xa0bffe,_0x2dcec8){logger['info'](_0x1365('0x4c'),_0xa0bffe[_0x1365('0x2f')]);var _0xaa130e=transferValidation[_0x1365('0xb')](_0xa0bffe[_0x1365('0x2f')]);if(_0xaa130e['length']>0x0){return _0x2dcec8['status'](0x190)[_0x1365('0x2e')](_0xaa130e);}var _0x30523c=_0xa0bffe[_0x1365('0x2f')][_0x1365('0x37')];var _0x519cef=_0xa0bffe[_0x1365('0x2f')][_0x1365('0x29')];var _0x2d1e2c=_0xa0bffe['body'][_0x1365('0x4d')];return getAgent(_0x30523c)['then'](function(_0x447eb1){logger[_0x1365('0x11')](_0x1365('0x31'),_0x447eb1[_0x1365('0x17')]);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x447eb1[_0x1365('0x17')]),'webbar:transfer',{'sessionId':_0x519cef,'transferNumber':_0x2d1e2c});return _0x2dcec8[_0x1365('0x18')](0xc8)[_0x1365('0x2e')]({'error':![],'message':_0x1365('0x4e')});})['catch'](handleError(_0x2dcec8));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d69aae8..fd1d600 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 _0xa44b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','index','get','/describe','isAuthenticated','/:id','show','getDispositions','getAgents','getApplications','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xa44b,0x1dc));var _0xba44=function(_0x466b8c,_0x492ed0){_0x466b8c=_0x466b8c-0x0;var _0x3f461d=_0xa44b[_0x466b8c];return _0x3f461d;};'use strict';var multer=require(_0xba44('0x0'));var util=require(_0xba44('0x1'));var path=require(_0xba44('0x2'));var timeout=require(_0xba44('0x3'));var express=require(_0xba44('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba44('0x5'));var interaction=require(_0xba44('0x6'));var config=require(_0xba44('0x7'));var controller=require(_0xba44('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xba44('0x9')]);router[_0xba44('0xa')](_0xba44('0xb'),auth[_0xba44('0xc')](),controller['describe']);router[_0xba44('0xa')](_0xba44('0xd'),auth[_0xba44('0xc')](),controller[_0xba44('0xe')]);router[_0xba44('0xa')]('/:id/dispositions',auth[_0xba44('0xc')](),controller[_0xba44('0xf')]);router['get']('/:id/canned_answers',auth[_0xba44('0xc')](),controller['getAnswers']);router[_0xba44('0xa')]('/:id/users',auth[_0xba44('0xc')](),controller[_0xba44('0x10')]);router[_0xba44('0xa')]('/:id/applications',auth[_0xba44('0xc')](),controller[_0xba44('0x11')]);router[_0xba44('0x12')]('/',auth[_0xba44('0xc')](),controller['create']);router[_0xba44('0x12')](_0xba44('0x13'),auth[_0xba44('0xc')](),controller[_0xba44('0x14')]);router[_0xba44('0x12')](_0xba44('0x15'),auth[_0xba44('0xc')](),controller[_0xba44('0x16')]);router[_0xba44('0x12')](_0xba44('0x17'),auth[_0xba44('0xc')](),controller[_0xba44('0x18')]);router[_0xba44('0x12')](_0xba44('0x19'),auth[_0xba44('0xc')](),controller[_0xba44('0x1a')]);router['post'](_0xba44('0x1b'),controller[_0xba44('0x1c')]);router['post'](_0xba44('0x1d'),auth[_0xba44('0xc')](),controller[_0xba44('0x1e')]);router[_0xba44('0x1f')](_0xba44('0xd'),auth[_0xba44('0xc')](),controller[_0xba44('0x20')]);router[_0xba44('0x21')](_0xba44('0xd'),auth[_0xba44('0xc')](),controller[_0xba44('0x22')]);router[_0xba44('0x21')](_0xba44('0x13'),auth[_0xba44('0xc')](),controller['removeDispositions']);router[_0xba44('0x21')]('/:id/canned_answers',auth[_0xba44('0xc')](),controller[_0xba44('0x23')]);router['delete'](_0xba44('0x17'),auth['isAuthenticated'](),controller[_0xba44('0x24')]);module['exports']=router; \ No newline at end of file +var _0xf319=['/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','post','create','addDisposition','addAnswer','/:id/users','/:id/applications','addApplications','/:id/notify','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x494cdb,_0x5ede79){var _0x56364b=function(_0x4e6613){while(--_0x4e6613){_0x494cdb['push'](_0x494cdb['shift']());}};_0x56364b(++_0x5ede79);}(_0xf319,0x1c2));var _0x9f31=function(_0x19e8e9,_0x81ad6f){_0x19e8e9=_0x19e8e9-0x0;var _0x3ceac5=_0xf319[_0x19e8e9];return _0x3ceac5;};'use strict';var multer=require(_0x9f31('0x0'));var util=require(_0x9f31('0x1'));var path=require(_0x9f31('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f31('0x3'));var router=express[_0x9f31('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f31('0x5'));var interaction=require(_0x9f31('0x6'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x9f31('0x7')]('/',auth[_0x9f31('0x8')](),controller[_0x9f31('0x9')]);router[_0x9f31('0x7')](_0x9f31('0xa'),auth['isAuthenticated'](),controller[_0x9f31('0xb')]);router[_0x9f31('0x7')](_0x9f31('0xc'),auth[_0x9f31('0x8')](),controller['show']);router[_0x9f31('0x7')](_0x9f31('0xd'),auth[_0x9f31('0x8')](),controller[_0x9f31('0xe')]);router[_0x9f31('0x7')](_0x9f31('0xf'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x10')]);router[_0x9f31('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x9f31('0x11')]);router[_0x9f31('0x7')]('/:id/applications',auth[_0x9f31('0x8')](),controller['getApplications']);router[_0x9f31('0x12')]('/',auth[_0x9f31('0x8')](),controller[_0x9f31('0x13')]);router[_0x9f31('0x12')](_0x9f31('0xd'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x14')]);router[_0x9f31('0x12')](_0x9f31('0xf'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x15')]);router[_0x9f31('0x12')](_0x9f31('0x16'),auth[_0x9f31('0x8')](),controller['addAgents']);router[_0x9f31('0x12')](_0x9f31('0x17'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x18')]);router[_0x9f31('0x12')](_0x9f31('0x19'),controller['notify']);router[_0x9f31('0x12')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x9f31('0x1a')](_0x9f31('0xc'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x1b')]);router[_0x9f31('0x1c')]('/:id',auth[_0x9f31('0x8')](),controller[_0x9f31('0x1d')]);router[_0x9f31('0x1c')](_0x9f31('0xd'),auth[_0x9f31('0x8')](),controller['removeDispositions']);router[_0x9f31('0x1c')]('/:id/canned_answers',auth[_0x9f31('0x8')](),controller[_0x9f31('0x1e')]);router[_0x9f31('0x1c')](_0x9f31('0x16'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x1f')]);module[_0x9f31('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index d5cbe24..584ae87 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 _0xc44c=['name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x594cb5,_0x14dee8){var _0x3df1d5=function(_0x277fbe){while(--_0x277fbe){_0x594cb5['push'](_0x594cb5['shift']());}};_0x3df1d5(++_0x14dee8);}(_0xc44c,0xfb));var _0xcc44=function(_0x722419,_0x4bd14a){_0x722419=_0x722419-0x0;var _0x439ff1=_0xc44c[_0x722419];return _0x439ff1;};'use strict';var Sequelize=require(_0xcc44('0x0'));var rs=require(_0xcc44('0x1'));module[_0xcc44('0x2')]={'name':{'type':Sequelize[_0xcc44('0x3')],'unique':_0xcc44('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xcc44('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xcc44('0x3')],'defaultValue':function(){return rs[_0xcc44('0x5')]();}},'phone':{'type':Sequelize[_0xcc44('0x3')]},'type':{'type':Sequelize[_0xcc44('0x6')](_0xcc44('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0xcc44('0x3')]},'baseUrl':{'type':Sequelize[_0xcc44('0x3')]},'authToken':{'type':Sequelize[_0xcc44('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xcc44('0x8');}},'notificationSound':{'type':Sequelize[_0xcc44('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xcc44('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcc44('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcc44('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcc44('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcc44('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcc44('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcc44('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcc44('0xa')],'comment':_0xcc44('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcc44('0xc'),'set':function(_0x5cd8d2){if(!_0x5cd8d2){this['setDataValue'](_0xcc44('0xd'),null);}this['setDataValue'](_0xcc44('0xe'),_0x5cd8d2);}},'description':{'type':Sequelize[_0xcc44('0x3')]}}; \ No newline at end of file +var _0x35e5=['sequelize','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x386574,_0x4f92e9){var _0x1f8da8=function(_0x35bd24){while(--_0x35bd24){_0x386574['push'](_0x386574['shift']());}};_0x1f8da8(++_0x4f92e9);}(_0x35e5,0xc4));var _0x535e=function(_0x5a2ff1,_0x3136b1){_0x5a2ff1=_0x5a2ff1-0x0;var _0x4ad3a7=_0x35e5[_0x5a2ff1];return _0x4ad3a7;};'use strict';var Sequelize=require(_0x535e('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x535e('0x1')],'unique':_0x535e('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x535e('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x535e('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x535e('0x1')],'defaultValue':function(){return rs[_0x535e('0x3')]();}},'phone':{'type':Sequelize[_0x535e('0x1')]},'type':{'type':Sequelize[_0x535e('0x4')](_0x535e('0x5'),_0x535e('0x6'))},'accountSid':{'type':Sequelize[_0x535e('0x1')]},'baseUrl':{'type':Sequelize[_0x535e('0x1')]},'authToken':{'type':Sequelize[_0x535e('0x1')]},'notificationTemplate':{'type':Sequelize[_0x535e('0x7')],'defaultValue':function(){return _0x535e('0x8');}},'notificationSound':{'type':Sequelize[_0x535e('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x535e('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x535e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x535e('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x535e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x535e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x535e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x535e('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x535e('0xb'),'set':function(_0xdee563){if(!_0xdee563){this['setDataValue'](_0x535e('0xc'),null);}this[_0x535e('0xd')]('mandatoryDisposition',_0xdee563);}},'description':{'type':Sequelize[_0x535e('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index be0d25c..68b0845 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 _0xba3c=['options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','create','getDispositions','findOne','order','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','json','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','replace','Body','MessageSid','notifications','messageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','DESC','omit','WhatsappInteraction','interaction','created','autoclose','push','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','WhatsappQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','\x0a','CmList','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','save','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','VIRTUAL'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xba3c,0x1f2));var _0xcba3=function(_0x13c25f,_0x24938b){_0x13c25f=_0x13c25f-0x0;var _0x249f30=_0xba3c[_0x13c25f];return _0x249f30;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcba3('0x0'));var zipdir=require(_0xcba3('0x1'));var jsonpatch=require(_0xcba3('0x2'));var rp=require(_0xcba3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcba3('0x4'));var util=require(_0xcba3('0x5'));var path=require(_0xcba3('0x6'));var sox=require(_0xcba3('0x7'));var csv=require(_0xcba3('0x8'));var ejs=require(_0xcba3('0x9'));var fs=require('fs');var fs_extra=require(_0xcba3('0xa'));var _=require(_0xcba3('0xb'));var squel=require(_0xcba3('0xc'));var crypto=require('crypto');var jsforce=require(_0xcba3('0xd'));var deskjs=require(_0xcba3('0xe'));var toCsv=require(_0xcba3('0x8'));var querystring=require(_0xcba3('0xf'));var Papa=require(_0xcba3('0x10'));var Redis=require(_0xcba3('0x11'));var authService=require(_0xcba3('0x12'));var qs=require(_0xcba3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcba3('0x14'));var logger=require(_0xcba3('0x15'))('api');var utils=require(_0xcba3('0x16'));var config=require(_0xcba3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcba3('0x18'))['db'];config[_0xcba3('0x19')]=_[_0xcba3('0x1a')](config[_0xcba3('0x19')],{'host':_0xcba3('0x1b'),'port':0x18eb});var socket=require(_0xcba3('0x1c'))(new Redis(config[_0xcba3('0x19')]));require('./whatsappAccount.socket')[_0xcba3('0x1d')](socket);var jayson=require(_0xcba3('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x43ce39,_0x4c6140,_0x504cb0,_0xabc4c3){return new BPromise(function(_0x5f007d,_0x2e1a85){var _0x305848=_0xabc4c3||client;return _0x305848[_0xcba3('0x1f')](_0x43ce39,_0x504cb0)[_0xcba3('0x20')](function(_0x577066){logger[_0xcba3('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x4c6140,_0xcba3('0x22'));logger[_0xcba3('0x23')](_0xcba3('0x24'),_0x4c6140,_0xcba3('0x22'),JSON[_0xcba3('0x25')](_0x577066));if(_0x577066[_0xcba3('0x26')]){if(_0x577066[_0xcba3('0x26')][_0xcba3('0x27')]===0x1f4){logger[_0xcba3('0x26')](_0xcba3('0x28'),_0x4c6140,_0x577066[_0xcba3('0x26')]['message']);return _0x2e1a85(_0x577066[_0xcba3('0x26')][_0xcba3('0x29')]);}logger[_0xcba3('0x26')](_0xcba3('0x28'),_0x4c6140,_0x577066[_0xcba3('0x26')][_0xcba3('0x29')]);return _0x5f007d(_0x577066[_0xcba3('0x26')][_0xcba3('0x29')]);}else{logger['info'](_0xcba3('0x28'),_0x4c6140,_0xcba3('0x22'));_0x5f007d(_0x577066['result']['message']);}})[_0xcba3('0x2a')](function(_0xc51bf0){logger[_0xcba3('0x26')](_0xcba3('0x28'),_0x4c6140,_0xc51bf0);_0x2e1a85(_0xc51bf0);});});}function respondWithStatusCode(_0x21f5b8,_0x20faf4){_0x20faf4=_0x20faf4||0xcc;return function(_0x11140e){if(_0x11140e){return _0x21f5b8[_0xcba3('0x2b')](_0x20faf4);}return _0x21f5b8['status'](_0x20faf4)[_0xcba3('0x2c')]();};}function respondWithResult(_0x5ac09d,_0x2b3c24){_0x2b3c24=_0x2b3c24||0xc8;return function(_0x16bed9){if(_0x16bed9){return _0x5ac09d['status'](_0x2b3c24)['json'](_0x16bed9);}};}function respondWithFilteredResult(_0x136028,_0x3da2ea){return function(_0x12c38b){if(_0x12c38b){var _0xa61b4d=typeof _0x3da2ea[_0xcba3('0x2d')]==='undefined'&&typeof _0x3da2ea[_0xcba3('0x2e')]===_0xcba3('0x2f');var _0x383462=_0x12c38b[_0xcba3('0x30')];var _0xdf65fd=_0xa61b4d?0x0:_0x3da2ea[_0xcba3('0x2d')];var _0xaffce3=_0xa61b4d?_0x12c38b[_0xcba3('0x30')]:_0x3da2ea['offset']+_0x3da2ea[_0xcba3('0x2e')];var _0x1502f8;if(_0xaffce3>=_0x383462){_0xaffce3=_0x383462;_0x1502f8=0xc8;}else{_0x1502f8=0xce;}_0x136028[_0xcba3('0x31')](_0x1502f8);return _0x136028[_0xcba3('0x32')](_0xcba3('0x33'),_0xdf65fd+'-'+_0xaffce3+'/'+_0x383462)['json'](_0x12c38b);}return null;};}function patchUpdates(_0x5193e4){return function(_0x1c8abf){try{jsonpatch['apply'](_0x1c8abf,_0x5193e4,!![]);}catch(_0x4554e2){return BPromise['reject'](_0x4554e2);}return _0x1c8abf[_0xcba3('0x34')]();};}function saveUpdates(_0x395259,_0x2564db){return function(_0x4dc3b9){if(_0x4dc3b9){return _0x4dc3b9[_0xcba3('0x35')](_0x395259)['then'](function(_0x1898c6){return _0x1898c6;});}return null;};}function removeEntity(_0xef9d97,_0x56086f){return function(_0x5b2ae8){if(_0x5b2ae8){return _0x5b2ae8['destroy']()[_0xcba3('0x20')](function(){var _0x34e430=_0x5b2ae8[_0xcba3('0x36')]({'plain':!![]});var _0x1892cf=_0xcba3('0x37');return db[_0xcba3('0x38')][_0xcba3('0x39')]({'where':{'type':_0x1892cf,'resourceId':_0x34e430['id']}})[_0xcba3('0x20')](function(){return _0x5b2ae8;});})['then'](function(){_0xef9d97[_0xcba3('0x31')](0xcc)[_0xcba3('0x2c')]();});}};}function handleEntityNotFound(_0x4223de,_0x5f5c9c){return function(_0x399ce3){if(!_0x399ce3){_0x4223de[_0xcba3('0x2b')](0x194);}return _0x399ce3;};}function handleError(_0x376d31,_0x44eefd){_0x44eefd=_0x44eefd||0x1f4;return function(_0x427696){logger[_0xcba3('0x26')](_0x427696[_0xcba3('0x3a')]);if(_0x427696[_0xcba3('0x3b')]){delete _0x427696[_0xcba3('0x3b')];}_0x376d31[_0xcba3('0x31')](_0x44eefd)[_0xcba3('0x3c')](_0x427696);};}exports[_0xcba3('0x3d')]=function(_0x43f613,_0x19a1de){var _0x5cb2b4={'include':[{'model':db[_0xcba3('0x3e')],'as':_0xcba3('0x3f')}]},_0x59376={},_0x1d9b55={'count':0x0,'rows':[]};var _0x5874e0=_[_0xcba3('0x40')](db[_0xcba3('0x41')]['rawAttributes'],function(_0xd975b9){return{'name':_0xd975b9[_0xcba3('0x42')],'type':_0xd975b9[_0xcba3('0x43')]['key']};});_0x59376['model']=_[_0xcba3('0x40')](_0x5874e0,'name');_0x59376[_0xcba3('0x44')]=_[_0xcba3('0x45')](_0x43f613[_0xcba3('0x44')]);_0x59376['filters']=_[_0xcba3('0x46')](_0x59376[_0xcba3('0x47')],_0x59376[_0xcba3('0x44')]);_0x5cb2b4[_0xcba3('0x48')]=_[_0xcba3('0x46')](_0x59376[_0xcba3('0x47')],qs[_0xcba3('0x49')](_0x43f613[_0xcba3('0x44')][_0xcba3('0x49')]));_0x5cb2b4[_0xcba3('0x48')]=_0x5cb2b4[_0xcba3('0x48')][_0xcba3('0x4a')]?_0x5cb2b4['attributes']:_0x59376[_0xcba3('0x47')];if(!_0x43f613[_0xcba3('0x44')][_0xcba3('0x4b')](_0xcba3('0x4c'))){_0x5cb2b4[_0xcba3('0x2e')]=qs[_0xcba3('0x2e')](_0x43f613[_0xcba3('0x44')]['limit']);_0x5cb2b4['offset']=qs[_0xcba3('0x2d')](_0x43f613['query'][_0xcba3('0x2d')]);}_0x5cb2b4['order']=qs[_0xcba3('0x4d')](_0x43f613['query'][_0xcba3('0x4d')]);_0x5cb2b4['where']=qs['filters'](_[_0xcba3('0x4e')](_0x43f613[_0xcba3('0x44')],_0x59376[_0xcba3('0x4f')]),_0x5874e0);if(_0x43f613['query'][_0xcba3('0x50')]){_0x5cb2b4['where']=_[_0xcba3('0x51')](_0x5cb2b4[_0xcba3('0x52')],{'$or':_[_0xcba3('0x40')](_0x5874e0,function(_0x4d7654){if(_0x4d7654['type']!==_0xcba3('0x53')){var _0x433c21={};_0x433c21[_0x4d7654[_0xcba3('0x3b')]]={'$like':'%'+_0x43f613['query'][_0xcba3('0x50')]+'%'};return _0x433c21;}})});}_0x5cb2b4=_[_0xcba3('0x51')]({},_0x5cb2b4,_0x43f613[_0xcba3('0x54')]);var _0x44282c={'where':_0x5cb2b4[_0xcba3('0x52')]};return db[_0xcba3('0x41')][_0xcba3('0x30')](_0x44282c)[_0xcba3('0x20')](function(_0x137aa0){_0x1d9b55['count']=_0x137aa0;if(_0x43f613['query'][_0xcba3('0x55')]){_0x5cb2b4[_0xcba3('0x56')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xcba3('0x57')](_0x5cb2b4);})[_0xcba3('0x20')](function(_0x1b51b0){_0x1d9b55[_0xcba3('0x58')]=_0x1b51b0;return _0x1d9b55;})[_0xcba3('0x20')](respondWithFilteredResult(_0x19a1de,_0x5cb2b4))[_0xcba3('0x2a')](handleError(_0x19a1de,null));};exports[_0xcba3('0x59')]=function(_0x58f33a,_0x262b1c){var _0xd55669={'raw':![],'where':{'id':_0x58f33a[_0xcba3('0x5a')]['id']},'include':[{'model':db[_0xcba3('0x3e')],'as':_0xcba3('0x3f')}]},_0x147580={};_0x147580['model']=_['keys'](db[_0xcba3('0x41')][_0xcba3('0x5b')]);_0x147580[_0xcba3('0x44')]=_['keys'](_0x58f33a['query']);_0x147580[_0xcba3('0x4f')]=_[_0xcba3('0x46')](_0x147580[_0xcba3('0x47')],_0x147580[_0xcba3('0x44')]);_0xd55669['attributes']=_[_0xcba3('0x46')](_0x147580[_0xcba3('0x47')],qs['fields'](_0x58f33a['query'][_0xcba3('0x49')]));_0xd55669[_0xcba3('0x48')]=_0xd55669[_0xcba3('0x48')][_0xcba3('0x4a')]?_0xd55669[_0xcba3('0x48')]:_0x147580[_0xcba3('0x47')];if(_0x58f33a[_0xcba3('0x44')][_0xcba3('0x55')]){_0xd55669[_0xcba3('0x56')]=[{'all':!![]}];}_0xd55669=_[_0xcba3('0x51')]({},_0xd55669,_0x58f33a['options']);return db['WhatsappAccount'][_0xcba3('0x5c')](_0xd55669)['then'](handleEntityNotFound(_0x262b1c,null))[_0xcba3('0x20')](respondWithResult(_0x262b1c,null))[_0xcba3('0x2a')](handleError(_0x262b1c,null));};exports['create']=function(_0x5df362,_0x2cee87){return db['WhatsappAccount']['create'](_0x5df362[_0xcba3('0x5d')],{})[_0xcba3('0x20')](function(_0x108730){var _0x2b6781=_0x5df362[_0xcba3('0x5e')][_0xcba3('0x36')]({'plain':!![]});if(!_0x2b6781)throw new Error(_0xcba3('0x5f'));if(_0x2b6781[_0xcba3('0x60')]===_0xcba3('0x5e')){var _0x46d0cc=_0x108730[_0xcba3('0x36')]({'plain':!![]});var _0x5d3fdc=_0xcba3('0x37');return db[_0xcba3('0x61')][_0xcba3('0x5c')]({'where':{'name':_0x5d3fdc,'userProfileId':_0x2b6781['userProfileId']},'raw':!![]})[_0xcba3('0x20')](function(_0x3a1060){if(_0x3a1060&&_0x3a1060['autoAssociation']===0x0){return db[_0xcba3('0x38')]['create']({'name':_0x46d0cc[_0xcba3('0x3b')],'resourceId':_0x46d0cc['id'],'type':_0x3a1060[_0xcba3('0x3b')],'sectionId':_0x3a1060['id']},{})[_0xcba3('0x20')](function(){return _0x108730;});}else{return _0x108730;}})[_0xcba3('0x2a')](function(_0xc8e6f2){logger[_0xcba3('0x26')](_0xcba3('0x62'),_0xc8e6f2);throw _0xc8e6f2;});}return _0x108730;})[_0xcba3('0x20')](respondWithResult(_0x2cee87,0xc9))[_0xcba3('0x2a')](handleError(_0x2cee87,null));};exports[_0xcba3('0x35')]=function(_0x30a1bc,_0x41a34d){if(_0x30a1bc['body']['id']){delete _0x30a1bc[_0xcba3('0x5d')]['id'];}return db['WhatsappAccount'][_0xcba3('0x5c')]({'where':{'id':_0x30a1bc[_0xcba3('0x5a')]['id']},'include':[{'model':db[_0xcba3('0x3e')],'as':_0xcba3('0x3f')}]})[_0xcba3('0x20')](handleEntityNotFound(_0x41a34d,null))[_0xcba3('0x20')](saveUpdates(_0x30a1bc['body'],null))[_0xcba3('0x20')](respondWithResult(_0x41a34d,null))['catch'](handleError(_0x41a34d,null));};exports[_0xcba3('0x39')]=function(_0x3a1590,_0x5b9b5d){return db[_0xcba3('0x41')][_0xcba3('0x5c')]({'where':{'id':_0x3a1590['params']['id']}})[_0xcba3('0x20')](handleEntityNotFound(_0x5b9b5d,null))[_0xcba3('0x20')](removeEntity(_0x5b9b5d,null))['catch'](handleError(_0x5b9b5d,null));};exports[_0xcba3('0x63')]=function(_0xf5a97e,_0x1b74f6){return db['WhatsappAccount'][_0xcba3('0x63')]()[_0xcba3('0x20')](respondWithResult(_0x1b74f6,null))[_0xcba3('0x2a')](handleError(_0x1b74f6,null));};exports[_0xcba3('0x64')]=function(_0x296fb9,_0x5cd788,_0x25ff90){if(_0x296fb9[_0xcba3('0x5d')]['id']){delete _0x296fb9[_0xcba3('0x5d')]['id'];}return db[_0xcba3('0x41')][_0xcba3('0x5c')]({'where':{'id':_0x296fb9[_0xcba3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5cd788,null))[_0xcba3('0x20')](function(_0x579a88){if(_0x579a88){_0x296fb9[_0xcba3('0x5d')][_0xcba3('0x65')]=_0x579a88['id'];return db[_0xcba3('0x66')][_0xcba3('0x67')](_0x296fb9['body']);}})[_0xcba3('0x20')](respondWithResult(_0x5cd788,null))[_0xcba3('0x2a')](handleError(_0x5cd788,null));};exports[_0xcba3('0x68')]=function(_0x24ecd3,_0x2a6e32,_0xfa4841){var _0x421567={'raw':![],'where':{}};var _0x3e3b3a={};var _0xc79b0b={'count':0x0,'rows':[]};return db[_0xcba3('0x41')][_0xcba3('0x69')]({'where':{'id':_0x24ecd3[_0xcba3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2a6e32,null))[_0xcba3('0x20')](function(_0x46059b){if(_0x46059b){_0x3e3b3a[_0xcba3('0x47')]=_[_0xcba3('0x45')](db[_0xcba3('0x66')][_0xcba3('0x5b')]);_0x3e3b3a[_0xcba3('0x44')]=_[_0xcba3('0x45')](_0x24ecd3[_0xcba3('0x44')]);_0x3e3b3a[_0xcba3('0x4f')]=_['intersection'](_0x3e3b3a[_0xcba3('0x47')],_0x3e3b3a[_0xcba3('0x44')]);_0x421567[_0xcba3('0x48')]=_[_0xcba3('0x46')](_0x3e3b3a[_0xcba3('0x47')],qs['fields'](_0x24ecd3['query'][_0xcba3('0x49')]));_0x421567[_0xcba3('0x48')]=_0x421567[_0xcba3('0x48')][_0xcba3('0x4a')]?_0x421567[_0xcba3('0x48')]:_0x3e3b3a[_0xcba3('0x47')];if(!_0x24ecd3[_0xcba3('0x44')]['hasOwnProperty']('nolimit')){_0x421567[_0xcba3('0x2e')]=qs[_0xcba3('0x2e')](_0x24ecd3[_0xcba3('0x44')]['limit']);_0x421567[_0xcba3('0x2d')]=qs[_0xcba3('0x2d')](_0x24ecd3[_0xcba3('0x44')][_0xcba3('0x2d')]);}_0x421567[_0xcba3('0x6a')]=qs[_0xcba3('0x4d')](_0x24ecd3[_0xcba3('0x44')][_0xcba3('0x4d')]);_0x421567[_0xcba3('0x52')]=qs[_0xcba3('0x4f')](_['pick'](_0x24ecd3['query'],_0x3e3b3a[_0xcba3('0x4f')]));_0x421567[_0xcba3('0x52')]['WhatsappAccountId']=_0x46059b['id'];if(_0x24ecd3['query'][_0xcba3('0x50')]){_0x421567[_0xcba3('0x52')]=_[_0xcba3('0x51')](_0x421567['where'],{'$or':_[_0xcba3('0x40')](_0x421567[_0xcba3('0x48')],function(_0x253f6e){var _0x3078c3={};_0x3078c3[_0x253f6e]={'$like':'%'+_0x24ecd3[_0xcba3('0x44')]['filter']+'%'};return _0x3078c3;})});}_0x421567=_[_0xcba3('0x51')]({},_0x421567,_0x24ecd3[_0xcba3('0x54')]);return db[_0xcba3('0x66')][_0xcba3('0x30')]({'where':_0x421567[_0xcba3('0x52')]})[_0xcba3('0x20')](function(_0x537c62){_0xc79b0b['count']=_0x537c62;if(_0x24ecd3[_0xcba3('0x44')][_0xcba3('0x55')]){_0x421567[_0xcba3('0x56')]=[{'all':!![]}];}return db[_0xcba3('0x66')][_0xcba3('0x57')](_0x421567);})[_0xcba3('0x20')](function(_0x1558a5){_0xc79b0b[_0xcba3('0x58')]=_0x1558a5;return _0xc79b0b;});}})[_0xcba3('0x20')](respondWithFilteredResult(_0x2a6e32,_0x421567))[_0xcba3('0x2a')](handleError(_0x2a6e32,null));};exports[_0xcba3('0x6b')]=function(_0x323c0a,_0x5a507c,_0xad15e9){return db[_0xcba3('0x41')][_0xcba3('0x5c')]({'where':{'id':_0x323c0a['params']['id']}})[_0xcba3('0x20')](handleEntityNotFound(_0x5a507c,null))['then'](function(_0x330b95){if(_0x330b95){return _0x330b95[_0xcba3('0x6b')](_0x323c0a[_0xcba3('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x5a507c,null))[_0xcba3('0x2a')](handleError(_0x5a507c,null));};exports['addAnswer']=function(_0x30552b,_0x53e6a6,_0x17237a){if(_0x30552b[_0xcba3('0x5d')]['id']){delete _0x30552b['body']['id'];}return db['WhatsappAccount'][_0xcba3('0x5c')]({'where':{'id':_0x30552b[_0xcba3('0x5a')]['id']}})[_0xcba3('0x20')](handleEntityNotFound(_0x53e6a6,null))[_0xcba3('0x20')](function(_0x3a273c){if(_0x3a273c){_0x30552b[_0xcba3('0x5d')][_0xcba3('0x65')]=_0x3a273c['id'];return db[_0xcba3('0x6c')][_0xcba3('0x67')](_0x30552b['body']);}})[_0xcba3('0x20')](respondWithResult(_0x53e6a6,null))[_0xcba3('0x2a')](handleError(_0x53e6a6,null));};exports[_0xcba3('0x6d')]=function(_0x256bbd,_0xe20965,_0x3d20f7){var _0xd37ab4={'raw':![],'where':{}};var _0x1b3602={};var _0x5ed396={'count':0x0,'rows':[]};return db[_0xcba3('0x41')]['findOne']({'where':{'id':_0x256bbd[_0xcba3('0x5a')]['id']}})[_0xcba3('0x20')](handleEntityNotFound(_0xe20965,null))[_0xcba3('0x20')](function(_0x1eef55){if(_0x1eef55){_0x1b3602[_0xcba3('0x47')]=_[_0xcba3('0x45')](db[_0xcba3('0x6c')][_0xcba3('0x5b')]);_0x1b3602[_0xcba3('0x44')]=_[_0xcba3('0x45')](_0x256bbd[_0xcba3('0x44')]);_0x1b3602[_0xcba3('0x4f')]=_[_0xcba3('0x46')](_0x1b3602[_0xcba3('0x47')],_0x1b3602['query']);_0xd37ab4[_0xcba3('0x48')]=_['intersection'](_0x1b3602[_0xcba3('0x47')],qs[_0xcba3('0x49')](_0x256bbd['query'][_0xcba3('0x49')]));_0xd37ab4[_0xcba3('0x48')]=_0xd37ab4['attributes']['length']?_0xd37ab4[_0xcba3('0x48')]:_0x1b3602['model'];if(!_0x256bbd[_0xcba3('0x44')][_0xcba3('0x4b')]('nolimit')){_0xd37ab4['limit']=qs[_0xcba3('0x2e')](_0x256bbd[_0xcba3('0x44')][_0xcba3('0x2e')]);_0xd37ab4[_0xcba3('0x2d')]=qs['offset'](_0x256bbd[_0xcba3('0x44')]['offset']);}_0xd37ab4[_0xcba3('0x6a')]=qs[_0xcba3('0x4d')](_0x256bbd['query'][_0xcba3('0x4d')]);_0xd37ab4[_0xcba3('0x52')]=qs[_0xcba3('0x4f')](_[_0xcba3('0x4e')](_0x256bbd[_0xcba3('0x44')],_0x1b3602['filters']));_0xd37ab4['where']['WhatsappAccountId']=_0x1eef55['id'];if(_0x256bbd[_0xcba3('0x44')][_0xcba3('0x50')]){_0xd37ab4[_0xcba3('0x52')]=_[_0xcba3('0x51')](_0xd37ab4[_0xcba3('0x52')],{'$or':_[_0xcba3('0x40')](_0xd37ab4[_0xcba3('0x48')],function(_0x368037){var _0x3d2eca={};_0x3d2eca[_0x368037]={'$like':'%'+_0x256bbd[_0xcba3('0x44')]['filter']+'%'};return _0x3d2eca;})});}_0xd37ab4=_['merge']({},_0xd37ab4,_0x256bbd[_0xcba3('0x54')]);return db[_0xcba3('0x6c')]['count']({'where':_0xd37ab4['where']})[_0xcba3('0x20')](function(_0x5e96c1){_0x5ed396[_0xcba3('0x30')]=_0x5e96c1;if(_0x256bbd['query'][_0xcba3('0x55')]){_0xd37ab4[_0xcba3('0x56')]=[{'all':!![]}];}return db[_0xcba3('0x6c')][_0xcba3('0x57')](_0xd37ab4);})[_0xcba3('0x20')](function(_0xf3398d){_0x5ed396[_0xcba3('0x58')]=_0xf3398d;return _0x5ed396;});}})['then'](respondWithFilteredResult(_0xe20965,_0xd37ab4))[_0xcba3('0x2a')](handleError(_0xe20965,null));};exports[_0xcba3('0x6e')]=function(_0x26da34,_0x11172b,_0x4ae981){return db[_0xcba3('0x41')][_0xcba3('0x5c')]({'where':{'id':_0x26da34['params']['id']}})['then'](handleEntityNotFound(_0x11172b,null))[_0xcba3('0x20')](function(_0x2f391b){if(_0x2f391b){return _0x2f391b[_0xcba3('0x6e')](_0x26da34[_0xcba3('0x44')][_0xcba3('0x6f')]);}})['then'](respondWithStatusCode(_0x11172b,null))[_0xcba3('0x2a')](handleError(_0x11172b,null));};exports['addAgents']=function(_0x39c0e0,_0x1b8617,_0x2f663e){return db[_0xcba3('0x41')][_0xcba3('0x5c')]({'where':{'id':_0x39c0e0[_0xcba3('0x5a')]['id']}})[_0xcba3('0x20')](handleEntityNotFound(_0x1b8617,null))[_0xcba3('0x20')](function(_0x1ff63a){if(_0x1ff63a){return _0x1ff63a[_0xcba3('0x70')](_0x39c0e0[_0xcba3('0x5d')]['ids'],_['omit'](_0x39c0e0['body'],[_0xcba3('0x6f'),'id'])||{})[_0xcba3('0x71')](function(_0x5de21e){for(var _0x9ae77=0x0;_0x9ae77<_0x39c0e0[_0xcba3('0x5d')][_0xcba3('0x6f')][_0xcba3('0x4a')];_0x9ae77+=0x1){socket[_0xcba3('0x72')](_0xcba3('0x73'),{'UserId':Number(_0x39c0e0[_0xcba3('0x5d')][_0xcba3('0x6f')][_0x9ae77]),'WhatsappAccountId':Number(_0x39c0e0[_0xcba3('0x5a')]['id'])});}return _0x5de21e;});}})[_0xcba3('0x20')](respondWithResult(_0x1b8617,null))[_0xcba3('0x2a')](handleError(_0x1b8617,null));};exports[_0xcba3('0x74')]=function(_0x4ce114,_0x636216,_0x53497d){return db[_0xcba3('0x41')][_0xcba3('0x5c')]({'where':{'id':_0x4ce114[_0xcba3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x636216,null))[_0xcba3('0x20')](function(_0x137879){if(_0x137879){return _0x137879[_0xcba3('0x74')](_0x4ce114['query'][_0xcba3('0x6f')])[_0xcba3('0x20')](function(){if(_[_0xcba3('0x75')](_0x4ce114[_0xcba3('0x44')][_0xcba3('0x6f')])){for(var _0xfaa008=0x0;_0xfaa008<_0x4ce114['query']['ids'][_0xcba3('0x4a')];_0xfaa008+=0x1){socket['emit'](_0xcba3('0x76'),{'UserId':Number(_0x4ce114['query'][_0xcba3('0x6f')][_0xfaa008]),'WhatsappAccountId':Number(_0x4ce114[_0xcba3('0x5a')]['id'])});}}else{socket[_0xcba3('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x4ce114[_0xcba3('0x44')][_0xcba3('0x6f')]),'WhatsappAccountId':Number(_0x4ce114[_0xcba3('0x5a')]['id'])});}});}})[_0xcba3('0x20')](respondWithStatusCode(_0x636216,null))[_0xcba3('0x2a')](handleError(_0x636216,null));};exports[_0xcba3('0x77')]=function(_0x312383,_0x140b56,_0x3a13fe){var _0x56b159={};var _0x38b810={};var _0x5bfd3f;var _0x438f9a;return db[_0xcba3('0x41')][_0xcba3('0x69')]({'where':{'id':_0x312383['params']['id']}})['then'](handleEntityNotFound(_0x140b56,null))[_0xcba3('0x20')](function(_0x56d3b8){if(_0x56d3b8){_0x5bfd3f=_0x56d3b8;_0x38b810[_0xcba3('0x47')]=_[_0xcba3('0x45')](db['User'][_0xcba3('0x5b')]);_0x38b810['query']=_[_0xcba3('0x45')](_0x312383['query']);_0x38b810[_0xcba3('0x4f')]=_[_0xcba3('0x46')](_0x38b810['model'],_0x38b810[_0xcba3('0x44')]);_0x56b159[_0xcba3('0x48')]=_['intersection'](_0x38b810[_0xcba3('0x47')],qs['fields'](_0x312383[_0xcba3('0x44')][_0xcba3('0x49')]));_0x56b159[_0xcba3('0x48')]=_0x56b159['attributes'][_0xcba3('0x4a')]?_0x56b159[_0xcba3('0x48')]:_0x38b810['model'];_0x56b159[_0xcba3('0x6a')]=qs[_0xcba3('0x4d')](_0x312383[_0xcba3('0x44')][_0xcba3('0x4d')]);_0x56b159[_0xcba3('0x52')]=qs[_0xcba3('0x4f')](_['pick'](_0x312383['query'],_0x38b810['filters']));if(_0x312383['query'][_0xcba3('0x50')]){_0x56b159[_0xcba3('0x52')]=_[_0xcba3('0x51')](_0x56b159[_0xcba3('0x52')],{'$or':_[_0xcba3('0x40')](_0x56b159[_0xcba3('0x48')],function(_0x358382){var _0x3cb70a={};_0x3cb70a[_0x358382]={'$like':'%'+_0x312383[_0xcba3('0x44')][_0xcba3('0x50')]+'%'};return _0x3cb70a;})});}_0x56b159=_['merge']({},_0x56b159,_0x312383[_0xcba3('0x54')]);return _0x5bfd3f['getAgents'](_0x56b159);}})['then'](function(_0x5a8850){if(_0x5a8850){_0x438f9a=_0x5a8850[_0xcba3('0x4a')];if(!_0x312383['query'][_0xcba3('0x4b')]('nolimit')){_0x56b159[_0xcba3('0x2e')]=qs[_0xcba3('0x2e')](_0x312383[_0xcba3('0x44')][_0xcba3('0x2e')]);_0x56b159['offset']=qs[_0xcba3('0x2d')](_0x312383[_0xcba3('0x44')][_0xcba3('0x2d')]);}return _0x5bfd3f[_0xcba3('0x77')](_0x56b159);}})[_0xcba3('0x20')](function(_0x1bbbfc){if(_0x1bbbfc){return _0x1bbbfc?{'count':_0x438f9a,'rows':_0x1bbbfc}:null;}})['then'](respondWithResult(_0x140b56,null))[_0xcba3('0x2a')](handleError(_0x140b56,null));};exports[_0xcba3('0x78')]=function(_0x4e0302,_0x2a32b0){var _0xb28548=_0x4e0302[_0xcba3('0x5a')]['id'];var _0x3d9fbc=_0x4e0302[_0xcba3('0x5d')];var _0x301ba8=0xc8;var _0x523ecf=null;return db[_0xcba3('0x79')][_0xcba3('0x7a')]({'isolationLevel':db[_0xcba3('0x79')][_0xcba3('0x7b')]['ISOLATION_LEVELS'][_0xcba3('0x7c')]},function(_0x42595e){return db[_0xcba3('0x41')][_0xcba3('0x69')]({'where':{'id':_0xb28548},'transaction':_0x42595e})[_0xcba3('0x20')](function(_0xb1606a){if(_0xb1606a){return db[_0xcba3('0x7d')][_0xcba3('0x39')]({'where':{'WhatsappAccountId':_0xb28548},'transaction':_0x42595e})['then'](function(){var _0x2598be=_[_0xcba3('0x40')](_0x3d9fbc,function(_0x40d149){_0x40d149['WhatsappAccountId']=_0xb28548;return _0x40d149;});return db[_0xcba3('0x7d')][_0xcba3('0x7e')](_0x2598be,{'transaction':_0x42595e});});}else{_0x301ba8=0x194;_0x523ecf=[];}});})[_0xcba3('0x20')](function(){if(_0x301ba8!==0x194){return db[_0xcba3('0x7d')][_0xcba3('0x7f')]({'where':{'WhatsappAccountId':_0xb28548},'order':_0xcba3('0x80')})['then'](function(_0x2f3789){_0x523ecf=_0x2f3789;});}})['catch'](function(_0x12613c){_0x301ba8=0x1f4;logger[_0xcba3('0x26')](_0x12613c['stack']);if(_0x12613c[_0xcba3('0x3b')]){delete _0x12613c[_0xcba3('0x3b')];}_0x523ecf=_0x12613c;})['finally'](function(){if(_0x523ecf===null){_0x2a32b0[_0xcba3('0x2b')](_0x301ba8);}else{if(_0x301ba8===0x1f4){_0x2a32b0['status'](_0x301ba8)[_0xcba3('0x3c')](_0x523ecf);}else{_0x2a32b0[_0xcba3('0x31')](_0x301ba8)[_0xcba3('0x81')](_0x523ecf);}}});};exports[_0xcba3('0x82')]=function(_0x3c64a4,_0x36911a,_0x1f2734){var _0x263236={};var _0x550723={};var _0x2ac168;var _0x520f8a;return db[_0xcba3('0x41')][_0xcba3('0x69')]({'where':{'id':_0x3c64a4['params']['id']}})[_0xcba3('0x20')](handleEntityNotFound(_0x36911a,null))[_0xcba3('0x20')](function(_0xa6b51e){if(_0xa6b51e){_0x2ac168=_0xa6b51e;_0x550723[_0xcba3('0x47')]=_['keys'](db[_0xcba3('0x7d')][_0xcba3('0x5b')]);_0x550723[_0xcba3('0x44')]=_['keys'](_0x3c64a4[_0xcba3('0x44')]);_0x550723['filters']=_[_0xcba3('0x46')](_0x550723['model'],_0x550723[_0xcba3('0x44')]);_0x263236[_0xcba3('0x48')]=_[_0xcba3('0x46')](_0x550723[_0xcba3('0x47')],qs[_0xcba3('0x49')](_0x3c64a4[_0xcba3('0x44')][_0xcba3('0x49')]));_0x263236[_0xcba3('0x48')]=_0x263236[_0xcba3('0x48')][_0xcba3('0x4a')]?_0x263236[_0xcba3('0x48')]:_0x550723[_0xcba3('0x47')];_0x263236[_0xcba3('0x6a')]=qs[_0xcba3('0x4d')](_0x3c64a4['query'][_0xcba3('0x4d')]);_0x263236[_0xcba3('0x52')]=qs[_0xcba3('0x4f')](_[_0xcba3('0x4e')](_0x3c64a4[_0xcba3('0x44')],_0x550723['filters']));if(_0x3c64a4[_0xcba3('0x44')][_0xcba3('0x50')]){_0x263236['where']=_['merge'](_0x263236[_0xcba3('0x52')],{'$or':_[_0xcba3('0x40')](_0x263236[_0xcba3('0x48')],function(_0x30f5ce){var _0x4216db={};_0x4216db[_0x30f5ce]={'$like':'%'+_0x3c64a4[_0xcba3('0x44')][_0xcba3('0x50')]+'%'};return _0x4216db;})});}_0x263236=_['merge']({},_0x263236,_0x3c64a4[_0xcba3('0x54')]);return _0x2ac168['getApplications'](_0x263236);}})['then'](function(_0x1c14e6){if(_0x1c14e6){_0x520f8a=_0x1c14e6[_0xcba3('0x4a')];if(!_0x3c64a4[_0xcba3('0x44')]['hasOwnProperty']('nolimit')){_0x263236[_0xcba3('0x2e')]=qs['limit'](_0x3c64a4[_0xcba3('0x44')]['limit']);_0x263236[_0xcba3('0x2d')]=qs[_0xcba3('0x2d')](_0x3c64a4[_0xcba3('0x44')]['offset']);}return _0x2ac168[_0xcba3('0x82')](_0x263236);}})[_0xcba3('0x20')](function(_0x491cf3){if(_0x491cf3){return _0x491cf3?{'count':_0x520f8a,'rows':_0x491cf3}:null;}})[_0xcba3('0x20')](respondWithResult(_0x36911a,null))['catch'](handleError(_0x36911a,null));};exports[_0xcba3('0x83')]=function(_0x4b53f8,_0x36228a,_0x2cb66d){var _0x133808={'channel':_0xcba3('0x84')};var _0x98a8f9=[];var _0x3f995e=[];var _0x1e15b8={};return db[_0xcba3('0x41')][_0xcba3('0x5c')]({'where':{'id':_0x4b53f8['params']['id']},'include':[{'model':db[_0xcba3('0x7d')],'as':_0xcba3('0x85')}]})['then'](handleEntityNotFound(_0x36228a,null))[_0xcba3('0x20')](function(_0x2a6ddf){_0x133808['account']=_0x2a6ddf;if(_0x133808[_0xcba3('0x86')]&&_0x133808[_0xcba3('0x86')][_0xcba3('0x43')]===_0xcba3('0x87')&&_0x4b53f8[_0xcba3('0x5d')][_0xcba3('0x88')]){if(_0x4b53f8[_0xcba3('0x5d')][_0xcba3('0x88')][_0xcba3('0x4a')]===0x0)return;if(_0x4b53f8[_0xcba3('0x5d')][_0xcba3('0x88')][0x0][_0xcba3('0x89')]!==_0xcba3('0x8a'))return;return db[_0xcba3('0x8b')][_0xcba3('0x35')]({'read':!![],'readAt':_0x4b53f8[_0xcba3('0x5d')]['statuses'][0x0][_0xcba3('0x8c')]},{'where':{'messageId':_0x4b53f8[_0xcba3('0x5d')][_0xcba3('0x88')][0x0][_0xcba3('0x8d')]},'individualHooks':!![]})[_0xcba3('0x20')](function(_0x2805cb){return _0x36228a[_0xcba3('0x31')](0xc8)[_0xcba3('0x81')](_0x2805cb);});}_0x133808[_0xcba3('0x8e')]=_['orderBy'](_0x2a6ddf['Applications'],[_0xcba3('0x80')],[_0xcba3('0x8f')]);if(_0x133808['account'][_0xcba3('0x85')]){delete _0x133808[_0xcba3('0x86')][_0xcba3('0x85')];}return db[_0xcba3('0x90')][_0xcba3('0x63')]()['then'](function(_0x4192b7){if(!_0x4192b7){throw new db[(_0xcba3('0x91'))][(_0xcba3('0x92'))](_0xcba3('0x93'));}_0x98a8f9=_[_0xcba3('0x94')](_[_0xcba3('0x45')](_0x4192b7),[_0xcba3('0x95'),_0xcba3('0x96')]);_0x3f995e=_['difference'](_[_0xcba3('0x45')](_0x4192b7),[_0xcba3('0x95'),_0xcba3('0x96'),_0xcba3('0x97'),'ListId']);_0x133808[_0xcba3('0x5d')]={'mapKey':_0xcba3('0x98')};if(_0x133808[_0xcba3('0x86')]&&_0x133808[_0xcba3('0x86')]['type']===_0xcba3('0x99')){_0x133808[_0xcba3('0x5d')][_0xcba3('0x9a')]=_0x4b53f8[_0xcba3('0x5d')]['From'][_0xcba3('0x9b')]('whatsapp:','');_0x133808[_0xcba3('0x5d')]['body']=_0x4b53f8[_0xcba3('0x5d')][_0xcba3('0x9c')];_0x133808[_0xcba3('0x5d')]['messageId']=_0x4b53f8['body'][_0xcba3('0x9d')];}if(_0x133808[_0xcba3('0x86')]&&_0x133808[_0xcba3('0x86')]['type']==='sinch'){_0x133808[_0xcba3('0x5d')][_0xcba3('0x9a')]=_0x4b53f8[_0xcba3('0x5d')]['notifications'][0x0][_0xcba3('0x9a')];_0x133808[_0xcba3('0x5d')][_0xcba3('0x5d')]=_0x4b53f8[_0xcba3('0x5d')][_0xcba3('0x9e')][0x0][_0xcba3('0x29')]['body'];_0x133808[_0xcba3('0x5d')][_0xcba3('0x9f')]=_0x4b53f8[_0xcba3('0x5d')][_0xcba3('0x9e')][0x0][_0xcba3('0x8d')];}if(_0x133808['body']['id']){delete _0x133808[_0xcba3('0x5d')]['id'];}if(_['isNil'](_0x133808[_0xcba3('0x5d')][_0xcba3('0x9a')])){throw new db['Sequelize'][(_0xcba3('0x92'))]('from\x20is\x20mandatory');}if(_[_0xcba3('0xa0')](_0x133808[_0xcba3('0x5d')][_0xcba3('0x5d')])||_0x133808['body'][_0xcba3('0x5d')]===''){throw new db[(_0xcba3('0x91'))][(_0xcba3('0x92'))](_0xcba3('0xa1'));}if(_[_0xcba3('0xa0')](_0x133808[_0xcba3('0x5d')][_0xcba3('0xa2')])){throw new db['Sequelize'][(_0xcba3('0x92'))](_0xcba3('0xa3')+_0x3f995e);}if(!_[_0xcba3('0xa4')](_0x3f995e,_0x133808[_0xcba3('0x5d')][_0xcba3('0xa2')])){throw new db[(_0xcba3('0x91'))][(_0xcba3('0x92'))](_0xcba3('0xa5')+_0x3f995e);}_0x1e15b8[_0x133808[_0xcba3('0x5d')][_0xcba3('0xa2')]]=_0x133808['body'][_0xcba3('0x9a')];return db['CmList']['find']({'where':{'id':_0x133808[_0xcba3('0x86')][_0xcba3('0xa6')]},'include':[{'model':db[_0xcba3('0x90')],'as':_0xcba3('0xa7'),'where':_0x1e15b8,'limit':0x1,'order':[[_0xcba3('0x96'),_0xcba3('0xa8')]]}]});})[_0xcba3('0x20')](handleEntityNotFound(_0x36228a,null))[_0xcba3('0x20')](function(_0x26908d){if(_0x26908d){_0x133808['list']=_[_0xcba3('0xa9')](_0x26908d,[_0xcba3('0xa7')]);if(_0x26908d[_0xcba3('0xa7')][_0xcba3('0x4a')]){return _0x26908d['Contacts'][0x0];}var _0x58e670=_[_0xcba3('0x1a')](_0x133808[_0xcba3('0x5d')],{'firstName':_0x133808[_0xcba3('0x5d')][_0xcba3('0x9a')],'ListId':_0x26908d['id']});_0x58e670[_0x133808[_0xcba3('0x5d')][_0xcba3('0xa2')]]=_0x133808[_0xcba3('0x5d')]['from'];return db[_0xcba3('0x90')][_0xcba3('0x67')](_0x58e670,{'fields':_0x98a8f9,'raw':!![]});}})[_0xcba3('0x20')](handleEntityNotFound(_0x36228a,null))['then'](function(_0x4800da){if(_0x4800da){_0x133808['contact']=_0x4800da;var _0x201f8f={'ContactId':_0x4800da['id'],'phone':_0x133808[_0xcba3('0x5d')]['from'],'WhatsappAccountId':_0x4b53f8[_0xcba3('0x5a')]['id']};var _0x5e6b52={'ContactId':_0x4800da['id'],'WhatsappAccountId':_0x4b53f8[_0xcba3('0x5a')]['id'],'closed':![]};return db[_0xcba3('0xaa')][_0xcba3('0x5c')]({'where':_0x5e6b52})[_0xcba3('0x20')](function(_0x519cf2){if(_0x519cf2){return[_0x519cf2,![]];}return db[_0xcba3('0xaa')][_0xcba3('0x67')](_0x201f8f)[_0xcba3('0x20')](function(_0x514f34){return[_0x514f34,!![]];});});}})['spread'](function(_0x578606,_0x46ab64){_0x133808[_0xcba3('0xab')]=_0x578606['get']({'plain':!![]});_0x133808[_0xcba3('0xab')][_0xcba3('0xac')]=![];if(_0x46ab64){if(_0x133808[_0xcba3('0x86')][_0xcba3('0xad')]){_0x133808[_0xcba3('0x8e')][_0xcba3('0xae')]({'id':0x0,'priority':_0x133808[_0xcba3('0x8e')][_0xcba3('0x4a')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xcba3('0xaf')});}_0x133808[_0xcba3('0xab')][_0xcba3('0xac')]=!![];}return db[_0xcba3('0x8b')][_0xcba3('0x67')]({'phone':_0x133808[_0xcba3('0x5d')]['from'],'messageId':_0x133808[_0xcba3('0x5d')][_0xcba3('0x9f')],'body':_0x133808[_0xcba3('0x5d')][_0xcba3('0x5d')],'WhatsappAccountId':_0x4b53f8['params']['id'],'WhatsappInteractionId':_0x578606['id'],'direction':'in','ContactId':_0x578606[_0xcba3('0xb0')],'AttachmentId':_0x133808[_0xcba3('0x5d')][_0xcba3('0xb1')]});})['then'](function(_0x35ab72){_0x133808['message']=_0x35ab72;if(!_0x133808[_0xcba3('0xab')]['UserId'])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x133808['interaction'][_0xcba3('0xb2')]}});})[_0xcba3('0x20')](function(_0x2e4bf4){if(_0x2e4bf4){_0x133808['applications'][_0xcba3('0xb3')]({'id':0x0,'priority':0x0,'app':_0xcba3('0xb4'),'appdata':_0x2e4bf4[_0xcba3('0x3b')]+','+(_0x133808['account']['waitForTheAssignedAgent']||0xa),'interval':_0xcba3('0xaf')});}if(!_0x133808['interaction']['queueId'])return;return db[_0xcba3('0xb5')]['find']({'attributes':['id',_0xcba3('0x3b')],'where':{'id':_0x133808[_0xcba3('0xab')]['queueId']}});})[_0xcba3('0x20')](function(_0x23de53){if(_0x23de53){_0x133808[_0xcba3('0x8e')][_0xcba3('0xb3')]({'id':0x0,'priority':0x1,'app':_0xcba3('0xb6'),'appdata':_0x23de53[_0xcba3('0x3b')]+','+(_0x133808[_0xcba3('0x86')][_0xcba3('0xb7')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcba3('0xb8'),'startRouting',_0x133808);})[_0xcba3('0x20')](function(_0x55eccb){if(_0x55eccb){var _0x53360f=0xc8;var _0x1e1421=_0xcba3('0xb9');logger[_0xcba3('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1e1421,_0x53360f,'entity\x20found');logger[_0xcba3('0x23')](_0xcba3('0xba'),_0x1e1421,_0x53360f,_0xcba3('0xbb'),JSON['stringify'](_0x55eccb));if(_0x133808['account'][_0xcba3('0x43')]==='twilio'){return _0x36228a[_0xcba3('0x31')](_0x53360f)['set']('Content-Type','text/xml')[_0xcba3('0x3c')](_0xcba3('0xbc'));}else{return _0x36228a[_0xcba3('0x31')](_0x53360f)[_0xcba3('0x81')](_0x55eccb);}}});})[_0xcba3('0x2a')](handleError(_0x36228a,null));};exports[_0xcba3('0x3c')]=function(_0x56b097,_0x50b992,_0x9755db){var _0x3da9cb,_0x1e998f,_0x42cce4;if(_[_0xcba3('0xa0')](_0x56b097['body'][_0xcba3('0x5d')])||_0x56b097[_0xcba3('0x5d')][_0xcba3('0x5d')]===''){throw new db[(_0xcba3('0x91'))][(_0xcba3('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcba3('0xa0')](_0x56b097['body']['to'])){throw new db[(_0xcba3('0x91'))]['ValidationError']('to\x20is\x20mandatory');}_0x3da9cb=_0x56b097[_0xcba3('0x5d')]['to'];return db[_0xcba3('0x41')]['find']({'where':{'id':_0x56b097['params']['id']},'include':[{'model':db[_0xcba3('0xbd')],'as':_0xcba3('0xbe'),'include':[{'model':db[_0xcba3('0x90')],'as':_0xcba3('0xa7'),'where':{'mobile':_0x3da9cb},'limit':0x1,'order':[[_0xcba3('0x96'),_0xcba3('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x50b992,null))[_0xcba3('0x20')](function(_0x331648){if(_0x331648&&_0x331648[_0xcba3('0xbe')]){_0x1e998f=_0x331648[_0xcba3('0x36')]({'plain':!![]});if(_0x1e998f['List']&&_0x1e998f[_0xcba3('0xbe')][_0xcba3('0xa7')][_0xcba3('0x4a')]){return _0x1e998f['List'][_0xcba3('0xa7')][0x0];}return db[_0xcba3('0x90')][_0xcba3('0x67')](_[_0xcba3('0x1a')](_0x56b097[_0xcba3('0x5d')],{'firstName':_0x3da9cb,'mobile':_0x3da9cb,'phone':_0x3da9cb,'ListId':_0x1e998f['ListId']}));}})[_0xcba3('0x20')](handleEntityNotFound(_0x50b992,null))[_0xcba3('0x20')](function(_0x2cd2a3){if(_0x2cd2a3){_0x42cce4=_0x2cd2a3;return db[_0xcba3('0xaa')][_0xcba3('0x5c')]({'where':{'ContactId':_0x42cce4['id'],'closed':![],'WhatsappAccountId':_0x1e998f['id']}})[_0xcba3('0x20')](function(_0x37fe43){if(_0x37fe43){return[_0x37fe43,![]];}return db['WhatsappInteraction'][_0xcba3('0x67')]({'UserId':_0x56b097[_0xcba3('0x5e')]['id'],'ContactId':_0x42cce4['id'],'WhatsappAccountId':_0x1e998f['id'],'phone':_0x3da9cb,'firstMsgDirection':_0xcba3('0xbf'),'Messages':[_[_0xcba3('0x51')](_0x56b097[_0xcba3('0x5d')],{'read':![],'body':_0x56b097[_0xcba3('0x5d')][_0xcba3('0x5d')],'phone':_0x3da9cb,'WhatsappAccountId':_0x1e998f['id'],'UserId':_0x56b097[_0xcba3('0x5e')]['id'],'ContactId':_0x42cce4['id']})]},{'include':[{'model':db[_0xcba3('0x8b')],'as':_0xcba3('0xc0')}]})[_0xcba3('0x20')](function(_0x30d36a){return[_0x30d36a,!![]];});});}})[_0xcba3('0x71')](function(_0x32a763,_0x4e13dc){if(_0x4e13dc){return _0x32a763;}return db['WhatsappMessage']['create'](_['merge'](_0x56b097['body'],{'read':![],'body':_0x56b097[_0xcba3('0x5d')][_0xcba3('0x5d')],'phone':_0x3da9cb,'WhatsappAccountId':_0x1e998f['id'],'WhatsappInteractionId':_0x32a763['id'],'UserId':_0x56b097[_0xcba3('0x5e')]['id'],'ContactId':_0x42cce4['id']}))[_0xcba3('0x20')](function(_0x25e40f){_0x32a763[_0xcba3('0xc1')][_0xcba3('0xc0')]=[];_0x32a763[_0xcba3('0xc1')]['Messages'][_0xcba3('0xae')](_0x25e40f[_0xcba3('0xc1')]);return _0x32a763;});})[_0xcba3('0x20')](respondWithResult(_0x50b992,null))['catch'](handleError(_0x50b992,null));}; \ No newline at end of file +var _0xabc1=['filter','merge','options','WhatsappAccount','include','catch','params','mandatoryDispositionPause','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','describe','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','Contacts','list','defaults','contact','WhatsappInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','created','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','\x0a','to\x20is\x20mandatory','CmList','List','DESC','out','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','get','UserProfileResource','name','index','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL'];(function(_0x15526e,_0x223176){var _0x2c2005=function(_0x236bb2){while(--_0x236bb2){_0x15526e['push'](_0x15526e['shift']());}};_0x2c2005(++_0x223176);}(_0xabc1,0x13e));var _0x1abc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabc1[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x1abc('0x0'));var rimraf=require(_0x1abc('0x1'));var zipdir=require(_0x1abc('0x2'));var jsonpatch=require(_0x1abc('0x3'));var rp=require(_0x1abc('0x4'));var moment=require(_0x1abc('0x5'));var BPromise=require(_0x1abc('0x6'));var Mustache=require(_0x1abc('0x7'));var util=require(_0x1abc('0x8'));var path=require('path');var sox=require(_0x1abc('0x9'));var csv=require(_0x1abc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1abc('0xb'));var _=require(_0x1abc('0xc'));var squel=require('squel');var crypto=require(_0x1abc('0xd'));var jsforce=require(_0x1abc('0xe'));var deskjs=require(_0x1abc('0xf'));var toCsv=require(_0x1abc('0xa'));var querystring=require(_0x1abc('0x10'));var Papa=require(_0x1abc('0x11'));var Redis=require('ioredis');var authService=require(_0x1abc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1abc('0x13'));var hardwareService=require(_0x1abc('0x14'));var logger=require(_0x1abc('0x15'))(_0x1abc('0x16'));var utils=require(_0x1abc('0x17'));var config=require(_0x1abc('0x18'));var licenseUtil=require(_0x1abc('0x19'));var db=require(_0x1abc('0x1a'))['db'];config[_0x1abc('0x1b')]=_['defaults'](config[_0x1abc('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x1abc('0x1c'))(new Redis(config['redis']));require(_0x1abc('0x1d'))[_0x1abc('0x1e')](socket);var jayson=require(_0x1abc('0x1f'));var client=jayson[_0x1abc('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x200679,_0x1da77e,_0x3cf25d,_0x25ef18){return new BPromise(function(_0x2de5f3,_0x1fe950){var _0xd6736c=_0x25ef18||client;return _0xd6736c['request'](_0x200679,_0x3cf25d)['then'](function(_0xdc1ed7){logger[_0x1abc('0x21')](_0x1abc('0x22'),_0x1da77e,_0x1abc('0x23'));logger[_0x1abc('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1da77e,_0x1abc('0x23'),JSON[_0x1abc('0x25')](_0xdc1ed7));if(_0xdc1ed7[_0x1abc('0x26')]){if(_0xdc1ed7[_0x1abc('0x26')][_0x1abc('0x27')]===0x1f4){logger[_0x1abc('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1da77e,_0xdc1ed7[_0x1abc('0x26')][_0x1abc('0x28')]);return _0x1fe950(_0xdc1ed7[_0x1abc('0x26')]['message']);}logger[_0x1abc('0x26')](_0x1abc('0x22'),_0x1da77e,_0xdc1ed7['error']['message']);return _0x2de5f3(_0xdc1ed7[_0x1abc('0x26')][_0x1abc('0x28')]);}else{logger[_0x1abc('0x21')](_0x1abc('0x22'),_0x1da77e,_0x1abc('0x23'));_0x2de5f3(_0xdc1ed7[_0x1abc('0x29')][_0x1abc('0x28')]);}})['catch'](function(_0x3088e7){logger[_0x1abc('0x26')](_0x1abc('0x22'),_0x1da77e,_0x3088e7);_0x1fe950(_0x3088e7);});});}function respondWithStatusCode(_0x2ab40b,_0x4fe01e){_0x4fe01e=_0x4fe01e||0xcc;return function(_0x323d83){if(_0x323d83){return _0x2ab40b[_0x1abc('0x2a')](_0x4fe01e);}return _0x2ab40b['status'](_0x4fe01e)[_0x1abc('0x2b')]();};}function respondWithResult(_0x40b588,_0x3fb129){_0x3fb129=_0x3fb129||0xc8;return function(_0x4dc297){if(_0x4dc297){return _0x40b588[_0x1abc('0x2c')](_0x3fb129)[_0x1abc('0x2d')](_0x4dc297);}};}function respondWithFilteredResult(_0x179585,_0x1b5ea5){return function(_0x2c0bdd){if(_0x2c0bdd){var _0x1a105b=typeof _0x1b5ea5['offset']===_0x1abc('0x2e')&&typeof _0x1b5ea5[_0x1abc('0x2f')]===_0x1abc('0x2e');var _0x57f0a7=_0x2c0bdd[_0x1abc('0x30')];var _0x29328a=_0x1a105b?0x0:_0x1b5ea5[_0x1abc('0x31')];var _0x3d63ea=_0x1a105b?_0x2c0bdd[_0x1abc('0x30')]:_0x1b5ea5[_0x1abc('0x31')]+_0x1b5ea5[_0x1abc('0x2f')];var _0xcf3107;if(_0x3d63ea>=_0x57f0a7){_0x3d63ea=_0x57f0a7;_0xcf3107=0xc8;}else{_0xcf3107=0xce;}_0x179585['status'](_0xcf3107);return _0x179585[_0x1abc('0x32')](_0x1abc('0x33'),_0x29328a+'-'+_0x3d63ea+'/'+_0x57f0a7)[_0x1abc('0x2d')](_0x2c0bdd);}return null;};}function patchUpdates(_0x4b08be){return function(_0x562fa0){try{jsonpatch['apply'](_0x562fa0,_0x4b08be,!![]);}catch(_0x1af8fd){return BPromise['reject'](_0x1af8fd);}return _0x562fa0['save']();};}function saveUpdates(_0x464837,_0x415a25){return function(_0x252ce9){if(_0x252ce9){return _0x252ce9['update'](_0x464837)['then'](function(_0x6d32c8){return _0x6d32c8;});}return null;};}function removeEntity(_0x55c7ca,_0x318c40){return function(_0x514e9f){if(_0x514e9f){return _0x514e9f[_0x1abc('0x34')]()[_0x1abc('0x35')](function(){var _0x26ffc5=_0x514e9f[_0x1abc('0x36')]({'plain':!![]});var _0x4cf725='WhatsappAccounts';return db[_0x1abc('0x37')]['destroy']({'where':{'type':_0x4cf725,'resourceId':_0x26ffc5['id']}})[_0x1abc('0x35')](function(){return _0x514e9f;});})[_0x1abc('0x35')](function(){_0x55c7ca[_0x1abc('0x2c')](0xcc)[_0x1abc('0x2b')]();});}};}function handleEntityNotFound(_0x2c6ffa,_0x219ea3){return function(_0x13b32c){if(!_0x13b32c){_0x2c6ffa['sendStatus'](0x194);}return _0x13b32c;};}function handleError(_0x14dc41,_0x271f46){_0x271f46=_0x271f46||0x1f4;return function(_0x44062a){logger[_0x1abc('0x26')](_0x44062a['stack']);if(_0x44062a[_0x1abc('0x38')]){delete _0x44062a[_0x1abc('0x38')];}_0x14dc41[_0x1abc('0x2c')](_0x271f46)['send'](_0x44062a);};}exports[_0x1abc('0x39')]=function(_0x3e3398,_0x433cfb){var _0x597486={'include':[{'model':db[_0x1abc('0x3a')],'as':'mandatoryDispositionPause'}]},_0x5edc9e={},_0x187083={'count':0x0,'rows':[]};var _0x130884=_[_0x1abc('0x3b')](db['WhatsappAccount'][_0x1abc('0x3c')],function(_0x31a816){return{'name':_0x31a816[_0x1abc('0x3d')],'type':_0x31a816[_0x1abc('0x3e')][_0x1abc('0x3f')]};});_0x5edc9e[_0x1abc('0x40')]=_[_0x1abc('0x3b')](_0x130884,_0x1abc('0x38'));_0x5edc9e[_0x1abc('0x41')]=_[_0x1abc('0x42')](_0x3e3398[_0x1abc('0x41')]);_0x5edc9e[_0x1abc('0x43')]=_[_0x1abc('0x44')](_0x5edc9e['model'],_0x5edc9e[_0x1abc('0x41')]);_0x597486[_0x1abc('0x45')]=_[_0x1abc('0x44')](_0x5edc9e[_0x1abc('0x40')],qs['fields'](_0x3e3398[_0x1abc('0x41')][_0x1abc('0x46')]));_0x597486['attributes']=_0x597486[_0x1abc('0x45')]['length']?_0x597486[_0x1abc('0x45')]:_0x5edc9e[_0x1abc('0x40')];if(!_0x3e3398[_0x1abc('0x41')]['hasOwnProperty'](_0x1abc('0x47'))){_0x597486[_0x1abc('0x2f')]=qs[_0x1abc('0x2f')](_0x3e3398['query'][_0x1abc('0x2f')]);_0x597486[_0x1abc('0x31')]=qs[_0x1abc('0x31')](_0x3e3398[_0x1abc('0x41')]['offset']);}_0x597486[_0x1abc('0x48')]=qs[_0x1abc('0x49')](_0x3e3398[_0x1abc('0x41')]['sort']);_0x597486[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_['pick'](_0x3e3398['query'],_0x5edc9e[_0x1abc('0x43')]),_0x130884);if(_0x3e3398[_0x1abc('0x41')]['filter']){_0x597486[_0x1abc('0x4a')]=_['merge'](_0x597486[_0x1abc('0x4a')],{'$or':_['map'](_0x130884,function(_0xd96136){if(_0xd96136[_0x1abc('0x3e')]!==_0x1abc('0x4b')){var _0x223a26={};_0x223a26[_0xd96136[_0x1abc('0x38')]]={'$like':'%'+_0x3e3398[_0x1abc('0x41')][_0x1abc('0x4c')]+'%'};return _0x223a26;}})});}_0x597486=_[_0x1abc('0x4d')]({},_0x597486,_0x3e3398[_0x1abc('0x4e')]);var _0x39054d={'where':_0x597486[_0x1abc('0x4a')]};return db[_0x1abc('0x4f')][_0x1abc('0x30')](_0x39054d)[_0x1abc('0x35')](function(_0x41ea01){_0x187083[_0x1abc('0x30')]=_0x41ea01;if(_0x3e3398[_0x1abc('0x41')]['includeAll']){_0x597486[_0x1abc('0x50')]=[{'all':!![]}];}return db[_0x1abc('0x4f')]['findAll'](_0x597486);})['then'](function(_0xcfbccd){_0x187083['rows']=_0xcfbccd;return _0x187083;})[_0x1abc('0x35')](respondWithFilteredResult(_0x433cfb,_0x597486))[_0x1abc('0x51')](handleError(_0x433cfb,null));};exports['show']=function(_0x23e319,_0xff237d){var _0x5394ea={'raw':![],'where':{'id':_0x23e319[_0x1abc('0x52')]['id']},'include':[{'model':db[_0x1abc('0x3a')],'as':_0x1abc('0x53')}]},_0xf14738={};_0xf14738['model']=_[_0x1abc('0x42')](db[_0x1abc('0x4f')][_0x1abc('0x3c')]);_0xf14738['query']=_[_0x1abc('0x42')](_0x23e319[_0x1abc('0x41')]);_0xf14738[_0x1abc('0x43')]=_[_0x1abc('0x44')](_0xf14738[_0x1abc('0x40')],_0xf14738[_0x1abc('0x41')]);_0x5394ea[_0x1abc('0x45')]=_[_0x1abc('0x44')](_0xf14738[_0x1abc('0x40')],qs[_0x1abc('0x46')](_0x23e319[_0x1abc('0x41')][_0x1abc('0x46')]));_0x5394ea[_0x1abc('0x45')]=_0x5394ea[_0x1abc('0x45')][_0x1abc('0x54')]?_0x5394ea[_0x1abc('0x45')]:_0xf14738[_0x1abc('0x40')];if(_0x23e319[_0x1abc('0x41')][_0x1abc('0x55')]){_0x5394ea['include']=[{'all':!![]}];}_0x5394ea=_[_0x1abc('0x4d')]({},_0x5394ea,_0x23e319[_0x1abc('0x4e')]);return db['WhatsappAccount'][_0x1abc('0x56')](_0x5394ea)['then'](handleEntityNotFound(_0xff237d,null))[_0x1abc('0x35')](respondWithResult(_0xff237d,null))[_0x1abc('0x51')](handleError(_0xff237d,null));};exports[_0x1abc('0x57')]=function(_0x23c21e,_0x38108f){return db[_0x1abc('0x4f')][_0x1abc('0x57')](_0x23c21e[_0x1abc('0x58')],{})[_0x1abc('0x35')](function(_0x19cbae){var _0xd7b01a=_0x23c21e['user'][_0x1abc('0x36')]({'plain':!![]});if(!_0xd7b01a)throw new Error(_0x1abc('0x59'));if(_0xd7b01a[_0x1abc('0x5a')]===_0x1abc('0x5b')){var _0x43b17f=_0x19cbae['get']({'plain':!![]});var _0x2da371='WhatsappAccounts';return db[_0x1abc('0x5c')]['find']({'where':{'name':_0x2da371,'userProfileId':_0xd7b01a[_0x1abc('0x5d')]},'raw':!![]})[_0x1abc('0x35')](function(_0x4266b9){if(_0x4266b9&&_0x4266b9[_0x1abc('0x5e')]===0x0){return db[_0x1abc('0x37')][_0x1abc('0x57')]({'name':_0x43b17f[_0x1abc('0x38')],'resourceId':_0x43b17f['id'],'type':_0x4266b9[_0x1abc('0x38')],'sectionId':_0x4266b9['id']},{})[_0x1abc('0x35')](function(){return _0x19cbae;});}else{return _0x19cbae;}})[_0x1abc('0x51')](function(_0x357499){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x357499);throw _0x357499;});}return _0x19cbae;})[_0x1abc('0x35')](respondWithResult(_0x38108f,0xc9))[_0x1abc('0x51')](handleError(_0x38108f,null));};exports[_0x1abc('0x5f')]=function(_0x435840,_0x395aeb){if(_0x435840[_0x1abc('0x58')]['id']){delete _0x435840[_0x1abc('0x58')]['id'];}return db[_0x1abc('0x4f')]['find']({'where':{'id':_0x435840[_0x1abc('0x52')]['id']},'include':[{'model':db[_0x1abc('0x3a')],'as':_0x1abc('0x53')}]})[_0x1abc('0x35')](handleEntityNotFound(_0x395aeb,null))[_0x1abc('0x35')](saveUpdates(_0x435840['body'],null))['then'](respondWithResult(_0x395aeb,null))[_0x1abc('0x51')](handleError(_0x395aeb,null));};exports[_0x1abc('0x34')]=function(_0x55dce9,_0xa31bcc){return db['WhatsappAccount'][_0x1abc('0x56')]({'where':{'id':_0x55dce9[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0xa31bcc,null))[_0x1abc('0x35')](removeEntity(_0xa31bcc,null))[_0x1abc('0x51')](handleError(_0xa31bcc,null));};exports[_0x1abc('0x60')]=function(_0x4706c2,_0x127562){return db['WhatsappAccount'][_0x1abc('0x60')]()[_0x1abc('0x35')](respondWithResult(_0x127562,null))[_0x1abc('0x51')](handleError(_0x127562,null));};exports['addDisposition']=function(_0x5bf521,_0x22c951,_0x152491){if(_0x5bf521[_0x1abc('0x58')]['id']){delete _0x5bf521[_0x1abc('0x58')]['id'];}return db['WhatsappAccount'][_0x1abc('0x56')]({'where':{'id':_0x5bf521[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x22c951,null))[_0x1abc('0x35')](function(_0x16861e){if(_0x16861e){_0x5bf521['body'][_0x1abc('0x61')]=_0x16861e['id'];return db[_0x1abc('0x62')][_0x1abc('0x57')](_0x5bf521['body']);}})['then'](respondWithResult(_0x22c951,null))[_0x1abc('0x51')](handleError(_0x22c951,null));};exports[_0x1abc('0x63')]=function(_0x3477f1,_0x171e4a,_0x20808b){var _0x2c1011={'raw':![],'where':{}};var _0x4c0256={};var _0x42b466={'count':0x0,'rows':[]};return db[_0x1abc('0x4f')][_0x1abc('0x64')]({'where':{'id':_0x3477f1[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x171e4a,null))['then'](function(_0x421505){if(_0x421505){_0x4c0256[_0x1abc('0x40')]=_[_0x1abc('0x42')](db[_0x1abc('0x62')][_0x1abc('0x3c')]);_0x4c0256[_0x1abc('0x41')]=_[_0x1abc('0x42')](_0x3477f1['query']);_0x4c0256[_0x1abc('0x43')]=_['intersection'](_0x4c0256['model'],_0x4c0256[_0x1abc('0x41')]);_0x2c1011[_0x1abc('0x45')]=_[_0x1abc('0x44')](_0x4c0256[_0x1abc('0x40')],qs[_0x1abc('0x46')](_0x3477f1[_0x1abc('0x41')][_0x1abc('0x46')]));_0x2c1011[_0x1abc('0x45')]=_0x2c1011[_0x1abc('0x45')][_0x1abc('0x54')]?_0x2c1011[_0x1abc('0x45')]:_0x4c0256[_0x1abc('0x40')];if(!_0x3477f1[_0x1abc('0x41')][_0x1abc('0x65')](_0x1abc('0x47'))){_0x2c1011[_0x1abc('0x2f')]=qs['limit'](_0x3477f1[_0x1abc('0x41')][_0x1abc('0x2f')]);_0x2c1011[_0x1abc('0x31')]=qs[_0x1abc('0x31')](_0x3477f1['query'][_0x1abc('0x31')]);}_0x2c1011[_0x1abc('0x48')]=qs[_0x1abc('0x49')](_0x3477f1[_0x1abc('0x41')]['sort']);_0x2c1011[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_[_0x1abc('0x66')](_0x3477f1['query'],_0x4c0256[_0x1abc('0x43')]));_0x2c1011[_0x1abc('0x4a')][_0x1abc('0x61')]=_0x421505['id'];if(_0x3477f1[_0x1abc('0x41')][_0x1abc('0x4c')]){_0x2c1011[_0x1abc('0x4a')]=_[_0x1abc('0x4d')](_0x2c1011[_0x1abc('0x4a')],{'$or':_[_0x1abc('0x3b')](_0x2c1011[_0x1abc('0x45')],function(_0x4a3a4e){var _0x44fe09={};_0x44fe09[_0x4a3a4e]={'$like':'%'+_0x3477f1[_0x1abc('0x41')][_0x1abc('0x4c')]+'%'};return _0x44fe09;})});}_0x2c1011=_[_0x1abc('0x4d')]({},_0x2c1011,_0x3477f1[_0x1abc('0x4e')]);return db[_0x1abc('0x62')][_0x1abc('0x30')]({'where':_0x2c1011[_0x1abc('0x4a')]})[_0x1abc('0x35')](function(_0x2ddfb6){_0x42b466[_0x1abc('0x30')]=_0x2ddfb6;if(_0x3477f1[_0x1abc('0x41')][_0x1abc('0x55')]){_0x2c1011[_0x1abc('0x50')]=[{'all':!![]}];}return db[_0x1abc('0x62')][_0x1abc('0x67')](_0x2c1011);})[_0x1abc('0x35')](function(_0x4f36aa){_0x42b466['rows']=_0x4f36aa;return _0x42b466;});}})[_0x1abc('0x35')](respondWithFilteredResult(_0x171e4a,_0x2c1011))['catch'](handleError(_0x171e4a,null));};exports[_0x1abc('0x68')]=function(_0x59ce35,_0x3d9dd2,_0x43c883){return db[_0x1abc('0x4f')][_0x1abc('0x56')]({'where':{'id':_0x59ce35[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x3d9dd2,null))[_0x1abc('0x35')](function(_0x556c4a){if(_0x556c4a){return _0x556c4a[_0x1abc('0x68')](_0x59ce35[_0x1abc('0x41')][_0x1abc('0x69')]);}})[_0x1abc('0x35')](respondWithStatusCode(_0x3d9dd2,null))[_0x1abc('0x51')](handleError(_0x3d9dd2,null));};exports[_0x1abc('0x6a')]=function(_0x58bd14,_0x5a2e97,_0x22b046){if(_0x58bd14[_0x1abc('0x58')]['id']){delete _0x58bd14[_0x1abc('0x58')]['id'];}return db[_0x1abc('0x4f')][_0x1abc('0x56')]({'where':{'id':_0x58bd14[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a2e97,null))[_0x1abc('0x35')](function(_0x51e525){if(_0x51e525){_0x58bd14[_0x1abc('0x58')]['WhatsappAccountId']=_0x51e525['id'];return db[_0x1abc('0x6b')][_0x1abc('0x57')](_0x58bd14[_0x1abc('0x58')]);}})[_0x1abc('0x35')](respondWithResult(_0x5a2e97,null))[_0x1abc('0x51')](handleError(_0x5a2e97,null));};exports[_0x1abc('0x6c')]=function(_0x16719f,_0x1dbc8b,_0x5cd536){var _0x4f079b={'raw':![],'where':{}};var _0x411f0a={};var _0x499086={'count':0x0,'rows':[]};return db[_0x1abc('0x4f')][_0x1abc('0x64')]({'where':{'id':_0x16719f[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x1dbc8b,null))[_0x1abc('0x35')](function(_0x55b5a9){if(_0x55b5a9){_0x411f0a['model']=_['keys'](db[_0x1abc('0x6b')][_0x1abc('0x3c')]);_0x411f0a['query']=_[_0x1abc('0x42')](_0x16719f['query']);_0x411f0a['filters']=_[_0x1abc('0x44')](_0x411f0a[_0x1abc('0x40')],_0x411f0a[_0x1abc('0x41')]);_0x4f079b['attributes']=_[_0x1abc('0x44')](_0x411f0a[_0x1abc('0x40')],qs[_0x1abc('0x46')](_0x16719f[_0x1abc('0x41')][_0x1abc('0x46')]));_0x4f079b[_0x1abc('0x45')]=_0x4f079b[_0x1abc('0x45')][_0x1abc('0x54')]?_0x4f079b[_0x1abc('0x45')]:_0x411f0a[_0x1abc('0x40')];if(!_0x16719f[_0x1abc('0x41')]['hasOwnProperty'](_0x1abc('0x47'))){_0x4f079b[_0x1abc('0x2f')]=qs[_0x1abc('0x2f')](_0x16719f[_0x1abc('0x41')][_0x1abc('0x2f')]);_0x4f079b[_0x1abc('0x31')]=qs['offset'](_0x16719f[_0x1abc('0x41')][_0x1abc('0x31')]);}_0x4f079b[_0x1abc('0x48')]=qs['sort'](_0x16719f['query'][_0x1abc('0x49')]);_0x4f079b[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_[_0x1abc('0x66')](_0x16719f[_0x1abc('0x41')],_0x411f0a[_0x1abc('0x43')]));_0x4f079b['where']['WhatsappAccountId']=_0x55b5a9['id'];if(_0x16719f['query']['filter']){_0x4f079b[_0x1abc('0x4a')]=_[_0x1abc('0x4d')](_0x4f079b[_0x1abc('0x4a')],{'$or':_['map'](_0x4f079b[_0x1abc('0x45')],function(_0x592961){var _0x1f8572={};_0x1f8572[_0x592961]={'$like':'%'+_0x16719f[_0x1abc('0x41')][_0x1abc('0x4c')]+'%'};return _0x1f8572;})});}_0x4f079b=_[_0x1abc('0x4d')]({},_0x4f079b,_0x16719f[_0x1abc('0x4e')]);return db[_0x1abc('0x6b')][_0x1abc('0x30')]({'where':_0x4f079b[_0x1abc('0x4a')]})[_0x1abc('0x35')](function(_0x304892){_0x499086['count']=_0x304892;if(_0x16719f[_0x1abc('0x41')][_0x1abc('0x55')]){_0x4f079b['include']=[{'all':!![]}];}return db[_0x1abc('0x6b')][_0x1abc('0x67')](_0x4f079b);})[_0x1abc('0x35')](function(_0x3b4c47){_0x499086[_0x1abc('0x6d')]=_0x3b4c47;return _0x499086;});}})[_0x1abc('0x35')](respondWithFilteredResult(_0x1dbc8b,_0x4f079b))[_0x1abc('0x51')](handleError(_0x1dbc8b,null));};exports[_0x1abc('0x6e')]=function(_0x54f60f,_0x5cb7d3,_0x78094a){return db[_0x1abc('0x4f')][_0x1abc('0x56')]({'where':{'id':_0x54f60f[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0x5cb7d3,null))[_0x1abc('0x35')](function(_0x4d4b96){if(_0x4d4b96){return _0x4d4b96[_0x1abc('0x6e')](_0x54f60f[_0x1abc('0x41')][_0x1abc('0x69')]);}})['then'](respondWithStatusCode(_0x5cb7d3,null))[_0x1abc('0x51')](handleError(_0x5cb7d3,null));};exports[_0x1abc('0x6f')]=function(_0x303fa2,_0x29f2d7,_0x12bc16){return db[_0x1abc('0x4f')]['find']({'where':{'id':_0x303fa2['params']['id']}})['then'](handleEntityNotFound(_0x29f2d7,null))[_0x1abc('0x35')](function(_0x489c0f){if(_0x489c0f){return _0x489c0f[_0x1abc('0x6f')](_0x303fa2['body'][_0x1abc('0x69')],_[_0x1abc('0x70')](_0x303fa2[_0x1abc('0x58')],[_0x1abc('0x69'),'id'])||{})['spread'](function(_0x2bdfd6){for(var _0x4dbbed=0x0;_0x4dbbed<_0x303fa2[_0x1abc('0x58')][_0x1abc('0x69')][_0x1abc('0x54')];_0x4dbbed+=0x1){socket[_0x1abc('0x71')](_0x1abc('0x72'),{'UserId':Number(_0x303fa2[_0x1abc('0x58')]['ids'][_0x4dbbed]),'WhatsappAccountId':Number(_0x303fa2['params']['id'])});}return _0x2bdfd6;});}})['then'](respondWithResult(_0x29f2d7,null))[_0x1abc('0x51')](handleError(_0x29f2d7,null));};exports[_0x1abc('0x73')]=function(_0x24aa40,_0x1977aa,_0x2a7122){return db[_0x1abc('0x4f')][_0x1abc('0x56')]({'where':{'id':_0x24aa40[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0x1977aa,null))['then'](function(_0x4c8bfa){if(_0x4c8bfa){return _0x4c8bfa[_0x1abc('0x73')](_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')])[_0x1abc('0x35')](function(){if(_['isArray'](_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')])){for(var _0x1a2c1f=0x0;_0x1a2c1f<_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')]['length'];_0x1a2c1f+=0x1){socket[_0x1abc('0x71')](_0x1abc('0x74'),{'UserId':Number(_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')][_0x1a2c1f]),'WhatsappAccountId':Number(_0x24aa40[_0x1abc('0x52')]['id'])});}}else{socket[_0x1abc('0x71')](_0x1abc('0x74'),{'UserId':Number(_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')]),'WhatsappAccountId':Number(_0x24aa40['params']['id'])});}});}})[_0x1abc('0x35')](respondWithStatusCode(_0x1977aa,null))['catch'](handleError(_0x1977aa,null));};exports[_0x1abc('0x75')]=function(_0x19751e,_0x3f3288,_0x8041d8){var _0x183e7e={};var _0x2b6916={};var _0x596e99;var _0x48685f;return db[_0x1abc('0x4f')]['findOne']({'where':{'id':_0x19751e[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0x3f3288,null))['then'](function(_0x4446eb){if(_0x4446eb){_0x596e99=_0x4446eb;_0x2b6916[_0x1abc('0x40')]=_[_0x1abc('0x42')](db[_0x1abc('0x76')][_0x1abc('0x3c')]);_0x2b6916[_0x1abc('0x41')]=_['keys'](_0x19751e['query']);_0x2b6916['filters']=_['intersection'](_0x2b6916[_0x1abc('0x40')],_0x2b6916[_0x1abc('0x41')]);_0x183e7e['attributes']=_['intersection'](_0x2b6916['model'],qs[_0x1abc('0x46')](_0x19751e['query'][_0x1abc('0x46')]));_0x183e7e[_0x1abc('0x45')]=_0x183e7e['attributes'][_0x1abc('0x54')]?_0x183e7e[_0x1abc('0x45')]:_0x2b6916['model'];_0x183e7e[_0x1abc('0x48')]=qs[_0x1abc('0x49')](_0x19751e[_0x1abc('0x41')][_0x1abc('0x49')]);_0x183e7e[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_[_0x1abc('0x66')](_0x19751e['query'],_0x2b6916[_0x1abc('0x43')]));if(_0x19751e[_0x1abc('0x41')][_0x1abc('0x4c')]){_0x183e7e['where']=_[_0x1abc('0x4d')](_0x183e7e[_0x1abc('0x4a')],{'$or':_[_0x1abc('0x3b')](_0x183e7e[_0x1abc('0x45')],function(_0x32b4db){var _0x258556={};_0x258556[_0x32b4db]={'$like':'%'+_0x19751e[_0x1abc('0x41')][_0x1abc('0x4c')]+'%'};return _0x258556;})});}_0x183e7e=_[_0x1abc('0x4d')]({},_0x183e7e,_0x19751e['options']);return _0x596e99[_0x1abc('0x75')](_0x183e7e);}})['then'](function(_0x28b5a8){if(_0x28b5a8){_0x48685f=_0x28b5a8[_0x1abc('0x54')];if(!_0x19751e['query'][_0x1abc('0x65')]('nolimit')){_0x183e7e[_0x1abc('0x2f')]=qs[_0x1abc('0x2f')](_0x19751e[_0x1abc('0x41')]['limit']);_0x183e7e[_0x1abc('0x31')]=qs[_0x1abc('0x31')](_0x19751e[_0x1abc('0x41')][_0x1abc('0x31')]);}return _0x596e99[_0x1abc('0x75')](_0x183e7e);}})[_0x1abc('0x35')](function(_0x4ba44b){if(_0x4ba44b){return _0x4ba44b?{'count':_0x48685f,'rows':_0x4ba44b}:null;}})['then'](respondWithResult(_0x3f3288,null))[_0x1abc('0x51')](handleError(_0x3f3288,null));};exports[_0x1abc('0x77')]=function(_0x223407,_0x378a2e){var _0x1abe88=_0x223407[_0x1abc('0x52')]['id'];var _0x2d8a5f=_0x223407[_0x1abc('0x58')];var _0x1c6448=0xc8;var _0x41588d=null;return db['sequelize'][_0x1abc('0x78')]({'isolationLevel':db[_0x1abc('0x79')]['Transaction'][_0x1abc('0x7a')][_0x1abc('0x7b')]},function(_0xe6df2){return db[_0x1abc('0x4f')]['findOne']({'where':{'id':_0x1abe88},'transaction':_0xe6df2})[_0x1abc('0x35')](function(_0x3ae8ef){if(_0x3ae8ef){return db[_0x1abc('0x7c')][_0x1abc('0x34')]({'where':{'WhatsappAccountId':_0x1abe88},'transaction':_0xe6df2})[_0x1abc('0x35')](function(){var _0x3707e0=_[_0x1abc('0x3b')](_0x2d8a5f,function(_0x45a633){_0x45a633[_0x1abc('0x61')]=_0x1abe88;return _0x45a633;});return db[_0x1abc('0x7c')]['bulkCreate'](_0x3707e0,{'transaction':_0xe6df2});});}else{_0x1c6448=0x194;_0x41588d=[];}});})[_0x1abc('0x35')](function(){if(_0x1c6448!==0x194){return db[_0x1abc('0x7c')][_0x1abc('0x7d')]({'where':{'WhatsappAccountId':_0x1abe88},'order':_0x1abc('0x7e')})[_0x1abc('0x35')](function(_0x1596d8){_0x41588d=_0x1596d8;});}})[_0x1abc('0x51')](function(_0x4c0417){_0x1c6448=0x1f4;logger[_0x1abc('0x26')](_0x4c0417['stack']);if(_0x4c0417['name']){delete _0x4c0417[_0x1abc('0x38')];}_0x41588d=_0x4c0417;})[_0x1abc('0x7f')](function(){if(_0x41588d===null){_0x378a2e['sendStatus'](_0x1c6448);}else{if(_0x1c6448===0x1f4){_0x378a2e['status'](_0x1c6448)[_0x1abc('0x80')](_0x41588d);}else{_0x378a2e['status'](_0x1c6448)['json'](_0x41588d);}}});};exports[_0x1abc('0x81')]=function(_0x60726e,_0x50e39d,_0x23d033){var _0x2e9543={};var _0x258b14={};var _0x3f3435;var _0x165e41;return db[_0x1abc('0x4f')]['findOne']({'where':{'id':_0x60726e[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0x50e39d,null))[_0x1abc('0x35')](function(_0xd421fd){if(_0xd421fd){_0x3f3435=_0xd421fd;_0x258b14[_0x1abc('0x40')]=_[_0x1abc('0x42')](db[_0x1abc('0x7c')][_0x1abc('0x3c')]);_0x258b14[_0x1abc('0x41')]=_[_0x1abc('0x42')](_0x60726e[_0x1abc('0x41')]);_0x258b14[_0x1abc('0x43')]=_[_0x1abc('0x44')](_0x258b14[_0x1abc('0x40')],_0x258b14[_0x1abc('0x41')]);_0x2e9543[_0x1abc('0x45')]=_['intersection'](_0x258b14[_0x1abc('0x40')],qs[_0x1abc('0x46')](_0x60726e[_0x1abc('0x41')][_0x1abc('0x46')]));_0x2e9543[_0x1abc('0x45')]=_0x2e9543['attributes'][_0x1abc('0x54')]?_0x2e9543[_0x1abc('0x45')]:_0x258b14[_0x1abc('0x40')];_0x2e9543[_0x1abc('0x48')]=qs[_0x1abc('0x49')](_0x60726e[_0x1abc('0x41')][_0x1abc('0x49')]);_0x2e9543[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_['pick'](_0x60726e['query'],_0x258b14[_0x1abc('0x43')]));if(_0x60726e['query'][_0x1abc('0x4c')]){_0x2e9543[_0x1abc('0x4a')]=_[_0x1abc('0x4d')](_0x2e9543[_0x1abc('0x4a')],{'$or':_[_0x1abc('0x3b')](_0x2e9543[_0x1abc('0x45')],function(_0x11cddc){var _0x1d39c9={};_0x1d39c9[_0x11cddc]={'$like':'%'+_0x60726e['query'][_0x1abc('0x4c')]+'%'};return _0x1d39c9;})});}_0x2e9543=_[_0x1abc('0x4d')]({},_0x2e9543,_0x60726e[_0x1abc('0x4e')]);return _0x3f3435[_0x1abc('0x81')](_0x2e9543);}})[_0x1abc('0x35')](function(_0x134540){if(_0x134540){_0x165e41=_0x134540['length'];if(!_0x60726e[_0x1abc('0x41')][_0x1abc('0x65')]('nolimit')){_0x2e9543[_0x1abc('0x2f')]=qs[_0x1abc('0x2f')](_0x60726e[_0x1abc('0x41')][_0x1abc('0x2f')]);_0x2e9543[_0x1abc('0x31')]=qs[_0x1abc('0x31')](_0x60726e['query'][_0x1abc('0x31')]);}return _0x3f3435[_0x1abc('0x81')](_0x2e9543);}})[_0x1abc('0x35')](function(_0x3312bf){if(_0x3312bf){return _0x3312bf?{'count':_0x165e41,'rows':_0x3312bf}:null;}})['then'](respondWithResult(_0x50e39d,null))[_0x1abc('0x51')](handleError(_0x50e39d,null));};exports[_0x1abc('0x82')]=function(_0x2ffe48,_0x46f956,_0x27865d){var _0x165610={'channel':_0x1abc('0x83')};var _0xe9db25=[];var _0x32789b=[];var _0x15f11b={};return db['WhatsappAccount'][_0x1abc('0x56')]({'where':{'id':_0x2ffe48['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x1abc('0x84')}]})['then'](handleEntityNotFound(_0x46f956,null))['then'](function(_0x511236){_0x165610['account']=_0x511236;if(_0x165610[_0x1abc('0x85')]&&_0x165610[_0x1abc('0x85')]['type']===_0x1abc('0x86')&&_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x87')]){if(_0x2ffe48['body']['statuses'][_0x1abc('0x54')]===0x0)return;if(_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x87')][0x0][_0x1abc('0x88')]!==_0x1abc('0x89'))return;return db[_0x1abc('0x8a')][_0x1abc('0x5f')]({'read':!![],'readAt':_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x87')][0x0][_0x1abc('0x8b')]},{'where':{'messageId':_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x87')][0x0]['message_id']},'individualHooks':!![]})[_0x1abc('0x35')](function(_0x1e689b){return _0x46f956[_0x1abc('0x2c')](0xc8)['json'](_0x1e689b);});}_0x165610[_0x1abc('0x8c')]=_[_0x1abc('0x8d')](_0x511236[_0x1abc('0x84')],['priority'],[_0x1abc('0x8e')]);if(_0x165610[_0x1abc('0x85')]['Applications']){delete _0x165610['account'][_0x1abc('0x84')];}return db[_0x1abc('0x8f')][_0x1abc('0x60')]()[_0x1abc('0x35')](function(_0xdf621b){if(!_0xdf621b){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))]('no\x20available\x20attributes');}_0xe9db25=_[_0x1abc('0x92')](_['keys'](_0xdf621b),[_0x1abc('0x93'),_0x1abc('0x94')]);_0x32789b=_[_0x1abc('0x92')](_[_0x1abc('0x42')](_0xdf621b),[_0x1abc('0x93'),_0x1abc('0x94'),_0x1abc('0x95'),_0x1abc('0x96')]);_0x165610[_0x1abc('0x58')]={'mapKey':_0x1abc('0x97')};if(_0x165610[_0x1abc('0x85')]&&_0x165610[_0x1abc('0x85')][_0x1abc('0x3e')]==='twilio'){_0x165610[_0x1abc('0x58')][_0x1abc('0x98')]=_0x2ffe48[_0x1abc('0x58')]['From']['replace'](_0x1abc('0x99'),'');_0x165610[_0x1abc('0x58')][_0x1abc('0x58')]=_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x9a')];_0x165610[_0x1abc('0x58')][_0x1abc('0x9b')]=_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x9c')];}if(_0x165610['account']&&_0x165610['account'][_0x1abc('0x3e')]===_0x1abc('0x86')){_0x165610[_0x1abc('0x58')][_0x1abc('0x98')]=_0x2ffe48['body'][_0x1abc('0x9d')][0x0][_0x1abc('0x98')];_0x165610[_0x1abc('0x58')][_0x1abc('0x58')]=_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x9d')][0x0][_0x1abc('0x28')][_0x1abc('0x58')];_0x165610[_0x1abc('0x58')]['messageId']=_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x9d')][0x0][_0x1abc('0x9e')];}if(_0x165610[_0x1abc('0x58')]['id']){delete _0x165610['body']['id'];}if(_[_0x1abc('0x9f')](_0x165610[_0x1abc('0x58')][_0x1abc('0x98')])){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))](_0x1abc('0xa0'));}if(_[_0x1abc('0x9f')](_0x165610[_0x1abc('0x58')][_0x1abc('0x58')])||_0x165610[_0x1abc('0x58')][_0x1abc('0x58')]===''){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))](_0x1abc('0xa1'));}if(_[_0x1abc('0x9f')](_0x165610[_0x1abc('0x58')][_0x1abc('0xa2')])){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32789b);}if(!_[_0x1abc('0xa3')](_0x32789b,_0x165610[_0x1abc('0x58')][_0x1abc('0xa2')])){throw new db['Sequelize'][(_0x1abc('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32789b);}_0x15f11b[_0x165610[_0x1abc('0x58')]['mapKey']]=_0x165610[_0x1abc('0x58')]['from'];return db['CmList'][_0x1abc('0x56')]({'where':{'id':_0x165610[_0x1abc('0x85')]['ListId']},'include':[{'model':db[_0x1abc('0x8f')],'as':_0x1abc('0xa4'),'where':_0x15f11b,'limit':0x1,'order':[[_0x1abc('0x94'),'DESC']]}]});})['then'](handleEntityNotFound(_0x46f956,null))[_0x1abc('0x35')](function(_0xe5233){if(_0xe5233){_0x165610[_0x1abc('0xa5')]=_[_0x1abc('0x70')](_0xe5233,[_0x1abc('0xa4')]);if(_0xe5233[_0x1abc('0xa4')][_0x1abc('0x54')]){return _0xe5233['Contacts'][0x0];}var _0x3e2bcc=_[_0x1abc('0xa6')](_0x165610[_0x1abc('0x58')],{'firstName':_0x165610[_0x1abc('0x58')][_0x1abc('0x98')],'ListId':_0xe5233['id']});_0x3e2bcc[_0x165610[_0x1abc('0x58')][_0x1abc('0xa2')]]=_0x165610['body'][_0x1abc('0x98')];return db[_0x1abc('0x8f')][_0x1abc('0x57')](_0x3e2bcc,{'fields':_0xe9db25,'raw':!![]});}})[_0x1abc('0x35')](handleEntityNotFound(_0x46f956,null))[_0x1abc('0x35')](function(_0x537ece){if(_0x537ece){_0x165610[_0x1abc('0xa7')]=_0x537ece;var _0x574950={'ContactId':_0x537ece['id'],'phone':_0x165610['body'][_0x1abc('0x98')],'WhatsappAccountId':_0x2ffe48['params']['id']};var _0x448072={'ContactId':_0x537ece['id'],'WhatsappAccountId':_0x2ffe48[_0x1abc('0x52')]['id'],'closed':![]};return db[_0x1abc('0xa8')][_0x1abc('0x56')]({'where':_0x448072})[_0x1abc('0x35')](function(_0x5c0fe5){if(_0x5c0fe5){return[_0x5c0fe5,![]];}return db[_0x1abc('0xa8')][_0x1abc('0x57')](_0x574950)['then'](function(_0x5ae193){return[_0x5ae193,!![]];});});}})['spread'](function(_0x4ca5b8,_0x255908){_0x165610[_0x1abc('0xa9')]=_0x4ca5b8[_0x1abc('0x36')]({'plain':!![]});_0x165610['interaction']['created']=![];if(_0x255908){if(_0x165610[_0x1abc('0x85')][_0x1abc('0xaa')]){_0x165610[_0x1abc('0x8c')]['push']({'id':0x0,'priority':_0x165610[_0x1abc('0x8c')]['length']+0x1,'app':_0x1abc('0xab'),'appdata':_0x1abc('0xac'),'interval':_0x1abc('0xad')});}_0x165610['interaction'][_0x1abc('0xae')]=!![];}return db[_0x1abc('0x8a')][_0x1abc('0x57')]({'phone':_0x165610[_0x1abc('0x58')][_0x1abc('0x98')],'messageId':_0x165610[_0x1abc('0x58')][_0x1abc('0x9b')],'body':_0x165610[_0x1abc('0x58')][_0x1abc('0x58')],'WhatsappAccountId':_0x2ffe48[_0x1abc('0x52')]['id'],'WhatsappInteractionId':_0x4ca5b8['id'],'direction':'in','ContactId':_0x4ca5b8[_0x1abc('0xaf')],'AttachmentId':_0x165610[_0x1abc('0x58')]['AttachmentId']});})['then'](function(_0x315088){_0x165610['message']=_0x315088;if(!_0x165610[_0x1abc('0xa9')][_0x1abc('0xb0')])return;return db['User'][_0x1abc('0x56')]({'attributes':['id',_0x1abc('0x38')],'where':{'id':_0x165610[_0x1abc('0xa9')][_0x1abc('0xb0')]}});})[_0x1abc('0x35')](function(_0x2ecfc7){if(_0x2ecfc7){_0x165610[_0x1abc('0x8c')][_0x1abc('0xb1')]({'id':0x0,'priority':0x0,'app':_0x1abc('0xb2'),'appdata':_0x2ecfc7['name']+','+(_0x165610[_0x1abc('0x85')][_0x1abc('0xb3')]||0xa),'interval':_0x1abc('0xad')});}if(!_0x165610['interaction'][_0x1abc('0xb4')])return;return db[_0x1abc('0xb5')][_0x1abc('0x56')]({'attributes':['id','name'],'where':{'id':_0x165610['interaction']['queueId']}});})[_0x1abc('0x35')](function(_0x14034f){if(_0x14034f){_0x165610[_0x1abc('0x8c')][_0x1abc('0xb1')]({'id':0x0,'priority':0x1,'app':_0x1abc('0xb6'),'appdata':_0x14034f['name']+','+(_0x165610[_0x1abc('0x85')]['waitForTheAssignedQueue']||0x12c),'interval':_0x1abc('0xad')});}return respondWithRpcPromise('Start',_0x1abc('0xb7'),_0x165610);})[_0x1abc('0x35')](function(_0x3a0f27){if(_0x3a0f27){var _0x469d33=0xc8;var _0x2a2ab0='receiveMessage';logger['info'](_0x1abc('0xb8'),_0x2a2ab0,_0x469d33,_0x1abc('0xb9'));logger[_0x1abc('0x24')](_0x1abc('0xba'),_0x2a2ab0,_0x469d33,_0x1abc('0xb9'),JSON[_0x1abc('0x25')](_0x3a0f27));if(_0x165610[_0x1abc('0x85')][_0x1abc('0x3e')]===_0x1abc('0xbb')){return _0x46f956[_0x1abc('0x2c')](_0x469d33)[_0x1abc('0x32')]('Content-Type','text/xml')['send'](_0x1abc('0xbc'));}else{return _0x46f956[_0x1abc('0x2c')](_0x469d33)[_0x1abc('0x2d')](_0x3a0f27);}}});})[_0x1abc('0x51')](handleError(_0x46f956,null));};exports['send']=function(_0x4e9fe7,_0x1b94b2,_0xa4077){var _0x5b4534,_0x9dffc8,_0x5eb4ba;if(_[_0x1abc('0x9f')](_0x4e9fe7[_0x1abc('0x58')]['body'])||_0x4e9fe7[_0x1abc('0x58')][_0x1abc('0x58')]===''){throw new db['Sequelize'][(_0x1abc('0x91'))](_0x1abc('0xa1'));}if(_['isNil'](_0x4e9fe7[_0x1abc('0x58')]['to'])){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))](_0x1abc('0xbd'));}_0x5b4534=_0x4e9fe7[_0x1abc('0x58')]['to'];return db['WhatsappAccount'][_0x1abc('0x56')]({'where':{'id':_0x4e9fe7[_0x1abc('0x52')]['id']},'include':[{'model':db[_0x1abc('0xbe')],'as':_0x1abc('0xbf'),'include':[{'model':db[_0x1abc('0x8f')],'as':'Contacts','where':{'mobile':_0x5b4534},'limit':0x1,'order':[[_0x1abc('0x94'),_0x1abc('0xc0')]]}]}]})[_0x1abc('0x35')](handleEntityNotFound(_0x1b94b2,null))[_0x1abc('0x35')](function(_0x59f75d){if(_0x59f75d&&_0x59f75d[_0x1abc('0xbf')]){_0x9dffc8=_0x59f75d[_0x1abc('0x36')]({'plain':!![]});if(_0x9dffc8['List']&&_0x9dffc8[_0x1abc('0xbf')][_0x1abc('0xa4')]['length']){return _0x9dffc8[_0x1abc('0xbf')][_0x1abc('0xa4')][0x0];}return db[_0x1abc('0x8f')]['create'](_[_0x1abc('0xa6')](_0x4e9fe7['body'],{'firstName':_0x5b4534,'mobile':_0x5b4534,'phone':_0x5b4534,'ListId':_0x9dffc8[_0x1abc('0x96')]}));}})['then'](handleEntityNotFound(_0x1b94b2,null))[_0x1abc('0x35')](function(_0x567a8a){if(_0x567a8a){_0x5eb4ba=_0x567a8a;return db[_0x1abc('0xa8')][_0x1abc('0x56')]({'where':{'ContactId':_0x5eb4ba['id'],'closed':![],'WhatsappAccountId':_0x9dffc8['id']}})[_0x1abc('0x35')](function(_0x3cfec0){if(_0x3cfec0){return[_0x3cfec0,![]];}return db[_0x1abc('0xa8')][_0x1abc('0x57')]({'UserId':_0x4e9fe7['user']['id'],'ContactId':_0x5eb4ba['id'],'WhatsappAccountId':_0x9dffc8['id'],'phone':_0x5b4534,'firstMsgDirection':_0x1abc('0xc1'),'Messages':[_['merge'](_0x4e9fe7['body'],{'read':![],'body':_0x4e9fe7[_0x1abc('0x58')][_0x1abc('0x58')],'phone':_0x5b4534,'WhatsappAccountId':_0x9dffc8['id'],'UserId':_0x4e9fe7[_0x1abc('0x5b')]['id'],'ContactId':_0x5eb4ba['id']})]},{'include':[{'model':db[_0x1abc('0x8a')],'as':'Messages'}]})[_0x1abc('0x35')](function(_0x41b545){return[_0x41b545,!![]];});});}})['spread'](function(_0x167e4c,_0x316b60){if(_0x316b60){return _0x167e4c;}return db[_0x1abc('0x8a')][_0x1abc('0x57')](_[_0x1abc('0x4d')](_0x4e9fe7[_0x1abc('0x58')],{'read':![],'body':_0x4e9fe7[_0x1abc('0x58')]['body'],'phone':_0x5b4534,'WhatsappAccountId':_0x9dffc8['id'],'WhatsappInteractionId':_0x167e4c['id'],'UserId':_0x4e9fe7[_0x1abc('0x5b')]['id'],'ContactId':_0x5eb4ba['id']}))[_0x1abc('0x35')](function(_0x527852){_0x167e4c[_0x1abc('0xc2')][_0x1abc('0xc3')]=[];_0x167e4c[_0x1abc('0xc2')][_0x1abc('0xc3')][_0x1abc('0xc4')](_0x527852[_0x1abc('0xc2')]);return _0x167e4c;});})[_0x1abc('0x35')](respondWithResult(_0x1b94b2,null))[_0x1abc('0x51')](handleError(_0x1b94b2,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e8fc5ad..ebb2fc6 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 _0x82aa=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x17b5bb,_0x1ec2dd){var _0x452f90=function(_0x42f5c0){while(--_0x42f5c0){_0x17b5bb['push'](_0x17b5bb['shift']());}};_0x452f90(++_0x1ec2dd);}(_0x82aa,0x7f));var _0xa82a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x82aa[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xa82a('0x0'));var WhatsappAccount=require(_0xa82a('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa82a('0x2')](0x0);var events={'afterCreate':_0xa82a('0x3'),'afterUpdate':_0xa82a('0x4'),'afterDestroy':_0xa82a('0x5')};function emitEvent(_0x1e4f95){return function(_0x31fc58,_0x3fefcd,_0x5b17a3){WhatsappAccountEvents[_0xa82a('0x6')](_0x1e4f95+':'+_0x31fc58['id'],_0x31fc58);WhatsappAccountEvents[_0xa82a('0x6')](_0x1e4f95,_0x31fc58);_0x5b17a3(null);};}for(var e in events){if(events[_0xa82a('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xa82a('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x39bb=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x39bb,0x1d9));var _0xb39b=function(_0x9db5d3,_0x4eea5e){_0x9db5d3=_0x9db5d3-0x0;var _0x477a81=_0x39bb[_0x9db5d3];return _0x477a81;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xb39b('0x0'))['db'][_0xb39b('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb39b('0x2')](0x0);var events={'afterCreate':_0xb39b('0x3'),'afterUpdate':_0xb39b('0x4'),'afterDestroy':_0xb39b('0x5')};function emitEvent(_0x5baa54){return function(_0x1166b7,_0x48b09a,_0x2e1488){WhatsappAccountEvents[_0xb39b('0x6')](_0x5baa54+':'+_0x1166b7['id'],_0x1166b7);WhatsappAccountEvents[_0xb39b('0x6')](_0x5baa54,_0x1166b7);_0x2e1488(null);};}for(var e in events){if(events[_0xb39b('0x7')](e)){var event=events[e];WhatsappAccount[_0xb39b('0x8')](e,emitEvent(event));}}module[_0xb39b('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 88eb689..81af61d 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 _0xec4b=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x60cce0,_0x1cfc18){var _0xbd2b=function(_0x2b3673){while(--_0x2b3673){_0x60cce0['push'](_0x60cce0['shift']());}};_0xbd2b(++_0x1cfc18);}(_0xec4b,0x9a));var _0xbec4=function(_0x2a0b50,_0x179f09){_0x2a0b50=_0x2a0b50-0x0;var _0x5dc5a5=_0xec4b[_0x2a0b50];return _0x5dc5a5;};'use strict';var _=require(_0xbec4('0x0'));var util=require(_0xbec4('0x1'));var logger=require(_0xbec4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbec4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbec4('0x4'));var rimraf=require(_0xbec4('0x5'));var config=require(_0xbec4('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xbec4('0x7')]=function(_0x5290a1,_0x449b72){return _0x5290a1[_0xbec4('0x8')](_0xbec4('0x9'),attributes,{'tableName':_0xbec4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf15=['exports','define','whatsapp_accounts','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes'];(function(_0x54b8dd,_0x300e08){var _0x2448b5=function(_0x52f62f){while(--_0x52f62f){_0x54b8dd['push'](_0x54b8dd['shift']());}};_0x2448b5(++_0x300e08);}(_0xcf15,0x193));var _0x5cf1=function(_0x13d778,_0x18efe8){_0x13d778=_0x13d778-0x0;var _0x1bed63=_0xcf15[_0x13d778];return _0x1bed63;};'use strict';var _=require('lodash');var util=require(_0x5cf1('0x0'));var logger=require(_0x5cf1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5cf1('0x2'));var rp=require(_0x5cf1('0x3'));var fs=require('fs');var path=require(_0x5cf1('0x4'));var rimraf=require('rimraf');var config=require(_0x5cf1('0x5'));var attributes=require(_0x5cf1('0x6'));module[_0x5cf1('0x7')]=function(_0xeb93,_0x73b36){return _0xeb93[_0x5cf1('0x8')]('WhatsappAccount',attributes,{'tableName':_0x5cf1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index d998a55..5c6e74e 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 _0x8001=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappAccount','options','raw','attributes','include','model','map','ShowWhatsappAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5c92fb,_0x4a657f){var _0x47289c=function(_0x57e5ba){while(--_0x57e5ba){_0x5c92fb['push'](_0x5c92fb['shift']());}};_0x47289c(++_0x4a657f);}(_0x8001,0xac));var _0x1800=function(_0x26706f,_0x38ab5e){_0x26706f=_0x26706f-0x0;var _0x3bf23c=_0x8001[_0x26706f];return _0x3bf23c;};'use strict';var _=require(_0x1800('0x0'));var util=require(_0x1800('0x1'));var moment=require(_0x1800('0x2'));var BPromise=require(_0x1800('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1800('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1800('0x5'));var logger=require(_0x1800('0x6'))(_0x1800('0x7'));var config=require(_0x1800('0x8'));var jayson=require(_0x1800('0x9'));var client=jayson[_0x1800('0xa')][_0x1800('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1800('0xc')],{'host':_0x1800('0xd'),'port':0x18eb});var socket=require(_0x1800('0xe'))(new Redis(config[_0x1800('0xc')]));require('./whatsappAccount.socket')[_0x1800('0xf')](socket);function respondWithRpcPromise(_0x3b0ac3,_0x453aa5,_0x3adb78){return new BPromise(function(_0x201b01,_0x4f6c05){return client['request'](_0x3b0ac3,_0x3adb78)[_0x1800('0x10')](function(_0x2f9c68){logger[_0x1800('0x11')](_0x1800('0x12'),_0x453aa5,'request\x20sent');logger[_0x1800('0x13')](_0x1800('0x14'),_0x453aa5,_0x1800('0x15'),JSON[_0x1800('0x16')](_0x2f9c68));if(_0x2f9c68[_0x1800('0x17')]){if(_0x2f9c68[_0x1800('0x17')][_0x1800('0x18')]===0x1f4){logger[_0x1800('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x453aa5,_0x2f9c68[_0x1800('0x17')][_0x1800('0x19')]);return _0x4f6c05(_0x2f9c68['error'][_0x1800('0x19')]);}logger[_0x1800('0x17')](_0x1800('0x12'),_0x453aa5,_0x2f9c68['error'][_0x1800('0x19')]);return _0x201b01(_0x2f9c68['error'][_0x1800('0x19')]);}else{logger[_0x1800('0x11')](_0x1800('0x12'),_0x453aa5,'request\x20sent');_0x201b01(_0x2f9c68[_0x1800('0x1a')][_0x1800('0x19')]);}})[_0x1800('0x1b')](function(_0x21a586){logger['error'](_0x1800('0x12'),_0x453aa5,_0x21a586);_0x4f6c05(_0x21a586);});});}exports['ShowWhatsappAccount']=function(_0xc59744){var _0x599379=this;return new Promise(function(_0x3a0f24,_0x524ce0){return db[_0x1800('0x1c')]['find']({'raw':_0xc59744[_0x1800('0x1d')]?_0xc59744['options'][_0x1800('0x1e')]===undefined?!![]:![]:!![],'where':_0xc59744[_0x1800('0x1d')]?_0xc59744[_0x1800('0x1d')]['where']||null:null,'attributes':_0xc59744[_0x1800('0x1d')]?_0xc59744[_0x1800('0x1d')][_0x1800('0x1f')]||null:null,'include':_0xc59744['options']?_0xc59744[_0x1800('0x1d')][_0x1800('0x20')]?_['map'](_0xc59744[_0x1800('0x1d')][_0x1800('0x20')],function(_0x85b6b5){return{'model':db[_0x85b6b5[_0x1800('0x21')]],'as':_0x85b6b5['as'],'attributes':_0x85b6b5[_0x1800('0x1f')],'include':_0x85b6b5[_0x1800('0x20')]?_[_0x1800('0x22')](_0x85b6b5[_0x1800('0x20')],function(_0x486e99){return{'model':db[_0x486e99[_0x1800('0x21')]],'as':_0x486e99['as'],'attributes':_0x486e99['attributes'],'include':_0x486e99[_0x1800('0x20')]?_[_0x1800('0x22')](_0x486e99['include'],function(_0x54e998){return{'model':db[_0x54e998[_0x1800('0x21')]],'as':_0x54e998['as'],'attributes':_0x54e998[_0x1800('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1800('0x10')](function(_0xdf700a){logger[_0x1800('0x11')]('ShowWhatsappAccount',_0xc59744);logger[_0x1800('0x13')](_0x1800('0x23'),_0xc59744,JSON['stringify'](_0xdf700a));_0x3a0f24(_0xdf700a);})[_0x1800('0x1b')](function(_0xf8702d){logger[_0x1800('0x17')](_0x1800('0x23'),_0xf8702d['message'],_0xc59744);_0x524ce0(_0x599379['error'](0x1f4,_0xf8702d['message']));});});}; \ No newline at end of file +var _0xb98b=['ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x1006d4,_0x158a87){var _0x24b3c7=function(_0x1d4c96){while(--_0x1d4c96){_0x1006d4['push'](_0x1006d4['shift']());}};_0x24b3c7(++_0x158a87);}(_0xb98b,0x13b));var _0xbb98=function(_0x365515,_0x176d70){_0x365515=_0x365515-0x0;var _0x3c37fd=_0xb98b[_0x365515];return _0x3c37fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbb98('0x0'));var rs=require(_0xbb98('0x1'));var fs=require('fs');var Redis=require(_0xbb98('0x2'));var db=require(_0xbb98('0x3'))['db'];var utils=require(_0xbb98('0x4'));var logger=require(_0xbb98('0x5'))(_0xbb98('0x6'));var config=require(_0xbb98('0x7'));var jayson=require(_0xbb98('0x8'));var client=jayson['client'][_0xbb98('0x9')]({'port':0x232a});config[_0xbb98('0xa')]=_[_0xbb98('0xb')](config[_0xbb98('0xa')],{'host':_0xbb98('0xc'),'port':0x18eb});var socket=require(_0xbb98('0xd'))(new Redis(config[_0xbb98('0xa')]));require(_0xbb98('0xe'))[_0xbb98('0xf')](socket);function respondWithRpcPromise(_0x2d7216,_0x547327,_0x160193){return new BPromise(function(_0x909310,_0x18ab85){return client[_0xbb98('0x10')](_0x2d7216,_0x160193)[_0xbb98('0x11')](function(_0x12e3d3){logger[_0xbb98('0x12')](_0xbb98('0x13'),_0x547327,_0xbb98('0x14'));logger[_0xbb98('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x547327,_0xbb98('0x14'),JSON[_0xbb98('0x16')](_0x12e3d3));if(_0x12e3d3[_0xbb98('0x17')]){if(_0x12e3d3['error'][_0xbb98('0x18')]===0x1f4){logger[_0xbb98('0x17')](_0xbb98('0x13'),_0x547327,_0x12e3d3['error'][_0xbb98('0x19')]);return _0x18ab85(_0x12e3d3['error'][_0xbb98('0x19')]);}logger[_0xbb98('0x17')](_0xbb98('0x13'),_0x547327,_0x12e3d3[_0xbb98('0x17')][_0xbb98('0x19')]);return _0x909310(_0x12e3d3[_0xbb98('0x17')][_0xbb98('0x19')]);}else{logger[_0xbb98('0x12')](_0xbb98('0x13'),_0x547327,_0xbb98('0x14'));_0x909310(_0x12e3d3[_0xbb98('0x1a')][_0xbb98('0x19')]);}})['catch'](function(_0x149455){logger['error'](_0xbb98('0x13'),_0x547327,_0x149455);_0x18ab85(_0x149455);});});}exports[_0xbb98('0x1b')]=function(_0x475d84){var _0x219f24=this;return new Promise(function(_0x42e69d,_0xe3d597){return db[_0xbb98('0x1c')][_0xbb98('0x1d')]({'raw':_0x475d84[_0xbb98('0x1e')]?_0x475d84['options'][_0xbb98('0x1f')]===undefined?!![]:![]:!![],'where':_0x475d84['options']?_0x475d84[_0xbb98('0x1e')][_0xbb98('0x20')]||null:null,'attributes':_0x475d84['options']?_0x475d84[_0xbb98('0x1e')][_0xbb98('0x21')]||null:null,'include':_0x475d84[_0xbb98('0x1e')]?_0x475d84[_0xbb98('0x1e')][_0xbb98('0x22')]?_['map'](_0x475d84['options']['include'],function(_0x2a7a3e){return{'model':db[_0x2a7a3e[_0xbb98('0x23')]],'as':_0x2a7a3e['as'],'attributes':_0x2a7a3e[_0xbb98('0x21')],'include':_0x2a7a3e[_0xbb98('0x22')]?_[_0xbb98('0x24')](_0x2a7a3e['include'],function(_0x5db6f3){return{'model':db[_0x5db6f3[_0xbb98('0x23')]],'as':_0x5db6f3['as'],'attributes':_0x5db6f3[_0xbb98('0x21')],'include':_0x5db6f3[_0xbb98('0x22')]?_[_0xbb98('0x24')](_0x5db6f3[_0xbb98('0x22')],function(_0x949c22){return{'model':db[_0x949c22['model']],'as':_0x949c22['as'],'attributes':_0x949c22[_0xbb98('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b6e37){logger[_0xbb98('0x12')]('ShowWhatsappAccount',_0x475d84);logger[_0xbb98('0x15')](_0xbb98('0x1b'),_0x475d84,JSON['stringify'](_0x2b6e37));_0x42e69d(_0x2b6e37);})[_0xbb98('0x25')](function(_0xe9f905){logger['error'](_0xbb98('0x1b'),_0xe9f905[_0xbb98('0x19')],_0x475d84);_0xe3d597(_0x219f24[_0xbb98('0x17')](0x1f4,_0xe9f905[_0xbb98('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index a3cdbd3..72b3d98 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 _0x05c5=['length','whatsappAccount:','remove','update','emit','removeListener','register'];(function(_0x3ffcae,_0x250b6a){var _0x4c79e3=function(_0x14f7ee){while(--_0x14f7ee){_0x3ffcae['push'](_0x3ffcae['shift']());}};_0x4c79e3(++_0x250b6a);}(_0x05c5,0x16e));var _0x505c=function(_0x2822b3,_0x49842b){_0x2822b3=_0x2822b3-0x0;var _0x4b9178=_0x05c5[_0x2822b3];return _0x4b9178;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x505c('0x0'),_0x505c('0x1')];function createListener(_0x17f301,_0x155dae){return function(_0x139f17){_0x155dae[_0x505c('0x2')](_0x17f301,_0x139f17);};}function removeListener(_0x4e5994,_0x1e8abc){return function(){WhatsappAccountEvents[_0x505c('0x3')](_0x4e5994,_0x1e8abc);};}exports[_0x505c('0x4')]=function(_0x558924){for(var _0x416510=0x0,_0x5291b1=events[_0x505c('0x5')];_0x416510<_0x5291b1;_0x416510++){var _0xf8b130=events[_0x416510];var _0x277f4a=createListener(_0x505c('0x6')+_0xf8b130,_0x558924);WhatsappAccountEvents['on'](_0xf8b130,_0x277f4a);}}; \ No newline at end of file +var _0x975a=['update','emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x17adff,_0x1e2b1c){var _0x384dde=function(_0x213a45){while(--_0x213a45){_0x17adff['push'](_0x17adff['shift']());}};_0x384dde(++_0x1e2b1c);}(_0x975a,0x17f));var _0xa975=function(_0x435c01,_0x2d8d13){_0x435c01=_0x435c01-0x0;var _0x1c9031=_0x975a[_0x435c01];return _0x1c9031;};'use strict';var WhatsappAccountEvents=require(_0xa975('0x0'));var events=[_0xa975('0x1'),'remove',_0xa975('0x2')];function createListener(_0x466fe6,_0x3507b0){return function(_0x3f130e){_0x3507b0[_0xa975('0x3')](_0x466fe6,_0x3f130e);};}function removeListener(_0x3c87ca,_0x5a07b3){return function(){WhatsappAccountEvents[_0xa975('0x4')](_0x3c87ca,_0x5a07b3);};}exports[_0xa975('0x5')]=function(_0x387f2b){for(var _0x5202cc=0x0,_0x241224=events['length'];_0x5202cc<_0x241224;_0x5202cc++){var _0x427b07=events[_0x5202cc];var _0x59fe35=createListener(_0xa975('0x6')+_0x427b07,_0x387f2b);WhatsappAccountEvents['on'](_0x427b07,_0x59fe35);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e155d08..943217d 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 _0x3afb=['post','create','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show'];(function(_0x2973eb,_0x116234){var _0x2b704a=function(_0x4e3d83){while(--_0x4e3d83){_0x2973eb['push'](_0x2973eb['shift']());}};_0x2b704a(++_0x116234);}(_0x3afb,0x1eb));var _0xb3af=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x3afb[_0x41b0a8];return _0x3a83d4;};'use strict';var multer=require(_0xb3af('0x0'));var util=require('util');var path=require(_0xb3af('0x1'));var timeout=require(_0xb3af('0x2'));var express=require('express');var router=express[_0xb3af('0x3')]();var fs_extra=require(_0xb3af('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb3af('0x5'));var config=require(_0xb3af('0x6'));var controller=require(_0xb3af('0x7'));router[_0xb3af('0x8')]('/',auth['isAuthenticated'](),controller[_0xb3af('0x9')]);router[_0xb3af('0x8')](_0xb3af('0xa'),auth[_0xb3af('0xb')](),controller[_0xb3af('0xc')]);router[_0xb3af('0xd')]('/',auth[_0xb3af('0xb')](),controller[_0xb3af('0xe')]);router[_0xb3af('0xf')](_0xb3af('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xb3af('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb3af('0x11')]=router; \ No newline at end of file +var _0x6bd2=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x3c39be,_0x270302){var _0x4fe58f=function(_0x3f7dbe){while(--_0x3f7dbe){_0x3c39be['push'](_0x3c39be['shift']());}};_0x4fe58f(++_0x270302);}(_0x6bd2,0xf5));var _0x26bd=function(_0x17a743,_0x108a32){_0x17a743=_0x17a743-0x0;var _0x2a27a9=_0x6bd2[_0x17a743];return _0x2a27a9;};'use strict';var multer=require(_0x26bd('0x0'));var util=require(_0x26bd('0x1'));var path=require(_0x26bd('0x2'));var timeout=require(_0x26bd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x26bd('0x4'));var interaction=require(_0x26bd('0x5'));var config=require(_0x26bd('0x6'));var controller=require(_0x26bd('0x7'));router[_0x26bd('0x8')]('/',auth[_0x26bd('0x9')](),controller[_0x26bd('0xa')]);router[_0x26bd('0x8')](_0x26bd('0xb'),auth['isAuthenticated'](),controller[_0x26bd('0xc')]);router[_0x26bd('0xd')]('/',auth['isAuthenticated'](),controller[_0x26bd('0xe')]);router['put'](_0x26bd('0xb'),auth['isAuthenticated'](),controller[_0x26bd('0xf')]);router[_0x26bd('0x10')](_0x26bd('0xb'),auth[_0x26bd('0x9')](),controller[_0x26bd('0x11')]);module[_0x26bd('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 2d1d6d1..f5d9ce3 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 _0xb0a9=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xb0a9,0x16a));var _0x9b0a=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0xb0a9[_0x53f402];return _0x45a76d;};'use strict';var Sequelize=require(_0x9b0a('0x0'));module[_0x9b0a('0x1')]={'priority':{'type':Sequelize[_0x9b0a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9b0a('0x3')],'allowNull':![],'defaultValue':_0x9b0a('0x4')},'appdata':{'type':Sequelize[_0x9b0a('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9b0a('0x6')}}; \ No newline at end of file +var _0x26ac=['*,*,*,*','exports','INTEGER','noop','TEXT','STRING'];(function(_0x2ab14d,_0x2fc77e){var _0x5e2744=function(_0x241415){while(--_0x241415){_0x2ab14d['push'](_0x2ab14d['shift']());}};_0x5e2744(++_0x2fc77e);}(_0x26ac,0xeb));var _0xc26a=function(_0x3824f0,_0x168078){_0x3824f0=_0x3824f0-0x0;var _0x6cfd0e=_0x26ac[_0x3824f0];return _0x6cfd0e;};'use strict';var Sequelize=require('sequelize');module[_0xc26a('0x0')]={'priority':{'type':Sequelize[_0xc26a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc26a('0x2')},'appdata':{'type':Sequelize[_0xc26a('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc26a('0x4')],'defaultValue':_0xc26a('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index c54d721..610d844 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 _0xb91a=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x35c9a2,_0x43765b){var _0x2e2376=function(_0x5b3439){while(--_0x5b3439){_0x35c9a2['push'](_0x35c9a2['shift']());}};_0x2e2376(++_0x43765b);}(_0xb91a,0xe5));var _0xab91=function(_0x44424e,_0x49ee3e){_0x44424e=_0x44424e-0x0;var _0x2c7f1a=_0xb91a[_0x44424e];return _0x2c7f1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab91('0x0'));var zipdir=require(_0xab91('0x1'));var jsonpatch=require(_0xab91('0x2'));var rp=require(_0xab91('0x3'));var moment=require('moment');var BPromise=require(_0xab91('0x4'));var Mustache=require(_0xab91('0x5'));var util=require('util');var path=require(_0xab91('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab91('0x7'));var fs=require('fs');var fs_extra=require(_0xab91('0x8'));var _=require('lodash');var squel=require(_0xab91('0x9'));var crypto=require(_0xab91('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xab91('0xb'));var toCsv=require(_0xab91('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xab91('0xd'));var qs=require(_0xab91('0xe'));var as=require(_0xab91('0xf'));var hardwareService=require(_0xab91('0x10'));var logger=require('../../config/logger')(_0xab91('0x11'));var utils=require(_0xab91('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xab91('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x381007,_0x56295c){_0x56295c=_0x56295c||0xcc;return function(_0x4c74ad){if(_0x4c74ad){return _0x381007[_0xab91('0x14')](_0x56295c);}return _0x381007['status'](_0x56295c)[_0xab91('0x15')]();};}function respondWithResult(_0x3d7004,_0x2f22d6){_0x2f22d6=_0x2f22d6||0xc8;return function(_0x29fadc){if(_0x29fadc){return _0x3d7004[_0xab91('0x16')](_0x2f22d6)[_0xab91('0x17')](_0x29fadc);}};}function respondWithFilteredResult(_0x490325,_0x20896){return function(_0x52614f){if(_0x52614f){var _0x23c3d8=typeof _0x20896[_0xab91('0x18')]===_0xab91('0x19')&&typeof _0x20896[_0xab91('0x1a')]==='undefined';var _0x434dcd=_0x52614f[_0xab91('0x1b')];var _0x1ece47=_0x23c3d8?0x0:_0x20896['offset'];var _0x489ef5=_0x23c3d8?_0x52614f[_0xab91('0x1b')]:_0x20896[_0xab91('0x18')]+_0x20896[_0xab91('0x1a')];var _0x1f9fa9;if(_0x489ef5>=_0x434dcd){_0x489ef5=_0x434dcd;_0x1f9fa9=0xc8;}else{_0x1f9fa9=0xce;}_0x490325[_0xab91('0x16')](_0x1f9fa9);return _0x490325[_0xab91('0x1c')](_0xab91('0x1d'),_0x1ece47+'-'+_0x489ef5+'/'+_0x434dcd)[_0xab91('0x17')](_0x52614f);}return null;};}function patchUpdates(_0x3ed266){return function(_0x32f85e){try{jsonpatch['apply'](_0x32f85e,_0x3ed266,!![]);}catch(_0x25f2d3){return BPromise[_0xab91('0x1e')](_0x25f2d3);}return _0x32f85e[_0xab91('0x1f')]();};}function saveUpdates(_0x5006ce,_0x580d67){return function(_0xad9571){if(_0xad9571){return _0xad9571[_0xab91('0x20')](_0x5006ce)[_0xab91('0x21')](function(_0x5995de){return _0x5995de;});}return null;};}function removeEntity(_0x5ef7d3,_0x2d7a9f){return function(_0x5b0c6a){if(_0x5b0c6a){return _0x5b0c6a[_0xab91('0x22')]()['then'](function(){_0x5ef7d3['status'](0xcc)[_0xab91('0x15')]();});}};}function handleEntityNotFound(_0x43f334,_0x1a57e2){return function(_0x2a1e5e){if(!_0x2a1e5e){_0x43f334[_0xab91('0x14')](0x194);}return _0x2a1e5e;};}function handleError(_0x70e00e,_0x26c96f){_0x26c96f=_0x26c96f||0x1f4;return function(_0x17a1f3){logger['error'](_0x17a1f3[_0xab91('0x23')]);if(_0x17a1f3[_0xab91('0x24')]){delete _0x17a1f3[_0xab91('0x24')];}_0x70e00e[_0xab91('0x16')](_0x26c96f)['send'](_0x17a1f3);};}exports[_0xab91('0x25')]=function(_0x284270,_0x5ec525){var _0x59e66a={},_0x3e3a94={},_0x2d45c8={'count':0x0,'rows':[]};var _0x223df1=_[_0xab91('0x26')](db[_0xab91('0x27')][_0xab91('0x28')],function(_0x11cdd8){return{'name':_0x11cdd8[_0xab91('0x29')],'type':_0x11cdd8[_0xab91('0x2a')][_0xab91('0x2b')]};});_0x3e3a94[_0xab91('0x2c')]=_['map'](_0x223df1,_0xab91('0x24'));_0x3e3a94[_0xab91('0x2d')]=_['keys'](_0x284270[_0xab91('0x2d')]);_0x3e3a94[_0xab91('0x2e')]=_[_0xab91('0x2f')](_0x3e3a94['model'],_0x3e3a94[_0xab91('0x2d')]);_0x59e66a['attributes']=_[_0xab91('0x2f')](_0x3e3a94[_0xab91('0x2c')],qs['fields'](_0x284270[_0xab91('0x2d')][_0xab91('0x30')]));_0x59e66a['attributes']=_0x59e66a[_0xab91('0x31')][_0xab91('0x32')]?_0x59e66a[_0xab91('0x31')]:_0x3e3a94['model'];if(!_0x284270[_0xab91('0x2d')][_0xab91('0x33')]('nolimit')){_0x59e66a[_0xab91('0x1a')]=qs[_0xab91('0x1a')](_0x284270[_0xab91('0x2d')]['limit']);_0x59e66a['offset']=qs[_0xab91('0x18')](_0x284270['query']['offset']);}_0x59e66a[_0xab91('0x34')]=qs[_0xab91('0x35')](_0x284270['query'][_0xab91('0x35')]);_0x59e66a[_0xab91('0x36')]=qs[_0xab91('0x2e')](_[_0xab91('0x37')](_0x284270[_0xab91('0x2d')],_0x3e3a94[_0xab91('0x2e')]),_0x223df1);if(_0x284270['query'][_0xab91('0x38')]){_0x59e66a[_0xab91('0x36')]=_[_0xab91('0x39')](_0x59e66a[_0xab91('0x36')],{'$or':_[_0xab91('0x26')](_0x223df1,function(_0x2bcfb0){if(_0x2bcfb0[_0xab91('0x2a')]!=='VIRTUAL'){var _0x4fd11c={};_0x4fd11c[_0x2bcfb0[_0xab91('0x24')]]={'$like':'%'+_0x284270[_0xab91('0x2d')]['filter']+'%'};return _0x4fd11c;}})});}_0x59e66a=_['merge']({},_0x59e66a,_0x284270[_0xab91('0x3a')]);var _0x4e32cf={'where':_0x59e66a[_0xab91('0x36')]};return db['WhatsappApplication'][_0xab91('0x1b')](_0x4e32cf)[_0xab91('0x21')](function(_0x591192){_0x2d45c8['count']=_0x591192;if(_0x284270[_0xab91('0x2d')][_0xab91('0x3b')]){_0x59e66a['include']=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x59e66a);})[_0xab91('0x21')](function(_0x2a2024){_0x2d45c8[_0xab91('0x3c')]=_0x2a2024;return _0x2d45c8;})['then'](respondWithFilteredResult(_0x5ec525,_0x59e66a))[_0xab91('0x3d')](handleError(_0x5ec525,null));};exports[_0xab91('0x3e')]=function(_0x4714cc,_0x20354d){var _0x1a2fdf={'raw':!![],'where':{'id':_0x4714cc[_0xab91('0x3f')]['id']}},_0x1a3bdf={};_0x1a3bdf[_0xab91('0x2c')]=_[_0xab91('0x40')](db[_0xab91('0x27')][_0xab91('0x28')]);_0x1a3bdf['query']=_[_0xab91('0x40')](_0x4714cc[_0xab91('0x2d')]);_0x1a3bdf[_0xab91('0x2e')]=_[_0xab91('0x2f')](_0x1a3bdf[_0xab91('0x2c')],_0x1a3bdf[_0xab91('0x2d')]);_0x1a2fdf[_0xab91('0x31')]=_[_0xab91('0x2f')](_0x1a3bdf[_0xab91('0x2c')],qs[_0xab91('0x30')](_0x4714cc[_0xab91('0x2d')][_0xab91('0x30')]));_0x1a2fdf[_0xab91('0x31')]=_0x1a2fdf['attributes'][_0xab91('0x32')]?_0x1a2fdf['attributes']:_0x1a3bdf['model'];if(_0x4714cc[_0xab91('0x2d')]['includeAll']){_0x1a2fdf[_0xab91('0x41')]=[{'all':!![]}];}_0x1a2fdf=_[_0xab91('0x39')]({},_0x1a2fdf,_0x4714cc[_0xab91('0x3a')]);return db[_0xab91('0x27')][_0xab91('0x42')](_0x1a2fdf)[_0xab91('0x21')](handleEntityNotFound(_0x20354d,null))['then'](respondWithResult(_0x20354d,null))[_0xab91('0x3d')](handleError(_0x20354d,null));};exports[_0xab91('0x43')]=function(_0x5dfbf9,_0x3bb98e){return db[_0xab91('0x27')][_0xab91('0x43')](_0x5dfbf9[_0xab91('0x44')],{})[_0xab91('0x21')](respondWithResult(_0x3bb98e,0xc9))[_0xab91('0x3d')](handleError(_0x3bb98e,null));};exports['update']=function(_0x5648ad,_0xb02842){if(_0x5648ad[_0xab91('0x44')]['id']){delete _0x5648ad['body']['id'];}return db[_0xab91('0x27')]['find']({'where':{'id':_0x5648ad[_0xab91('0x3f')]['id']}})['then'](handleEntityNotFound(_0xb02842,null))[_0xab91('0x21')](saveUpdates(_0x5648ad[_0xab91('0x44')],null))[_0xab91('0x21')](respondWithResult(_0xb02842,null))[_0xab91('0x3d')](handleError(_0xb02842,null));};exports[_0xab91('0x22')]=function(_0xecec47,_0x279fbf){return db[_0xab91('0x27')]['find']({'where':{'id':_0xecec47[_0xab91('0x3f')]['id']}})[_0xab91('0x21')](handleEntityNotFound(_0x279fbf,null))[_0xab91('0x21')](removeEntity(_0x279fbf,null))['catch'](handleError(_0x279fbf,null));}; \ No newline at end of file +var _0x7d37=['set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','WhatsappApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit'];(function(_0x3671e1,_0x2384cd){var _0x40eda6=function(_0xbba00f){while(--_0xbba00f){_0x3671e1['push'](_0x3671e1['shift']());}};_0x40eda6(++_0x2384cd);}(_0x7d37,0x1db));var _0x77d3=function(_0x4c1d61,_0x3d1cc0){_0x4c1d61=_0x4c1d61-0x0;var _0x3b470f=_0x7d37[_0x4c1d61];return _0x3b470f;};'use strict';var emlformat=require(_0x77d3('0x0'));var rimraf=require(_0x77d3('0x1'));var zipdir=require(_0x77d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77d3('0x3'));var moment=require(_0x77d3('0x4'));var BPromise=require(_0x77d3('0x5'));var Mustache=require('mustache');var util=require(_0x77d3('0x6'));var path=require(_0x77d3('0x7'));var sox=require('sox');var csv=require(_0x77d3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77d3('0x9'));var _=require('lodash');var squel=require(_0x77d3('0xa'));var crypto=require(_0x77d3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x77d3('0x8'));var querystring=require(_0x77d3('0xc'));var Papa=require('papaparse');var Redis=require(_0x77d3('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x77d3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77d3('0xf'));var logger=require('../../config/logger')(_0x77d3('0x10'));var utils=require(_0x77d3('0x11'));var config=require(_0x77d3('0x12'));var licenseUtil=require(_0x77d3('0x13'));var db=require(_0x77d3('0x14'))['db'];function respondWithStatusCode(_0xe69786,_0x34446e){_0x34446e=_0x34446e||0xcc;return function(_0x136304){if(_0x136304){return _0xe69786[_0x77d3('0x15')](_0x34446e);}return _0xe69786['status'](_0x34446e)[_0x77d3('0x16')]();};}function respondWithResult(_0x4a621e,_0x4f40fb){_0x4f40fb=_0x4f40fb||0xc8;return function(_0x5a9cdb){if(_0x5a9cdb){return _0x4a621e[_0x77d3('0x17')](_0x4f40fb)[_0x77d3('0x18')](_0x5a9cdb);}};}function respondWithFilteredResult(_0x2c722b,_0xb17484){return function(_0x891f26){if(_0x891f26){var _0x4d98a4=typeof _0xb17484[_0x77d3('0x19')]===_0x77d3('0x1a')&&typeof _0xb17484['limit']==='undefined';var _0xfe320e=_0x891f26[_0x77d3('0x1b')];var _0x60173f=_0x4d98a4?0x0:_0xb17484[_0x77d3('0x19')];var _0x144656=_0x4d98a4?_0x891f26[_0x77d3('0x1b')]:_0xb17484[_0x77d3('0x19')]+_0xb17484[_0x77d3('0x1c')];var _0x3e7203;if(_0x144656>=_0xfe320e){_0x144656=_0xfe320e;_0x3e7203=0xc8;}else{_0x3e7203=0xce;}_0x2c722b[_0x77d3('0x17')](_0x3e7203);return _0x2c722b[_0x77d3('0x1d')](_0x77d3('0x1e'),_0x60173f+'-'+_0x144656+'/'+_0xfe320e)[_0x77d3('0x18')](_0x891f26);}return null;};}function patchUpdates(_0x1af8a4){return function(_0x4366b6){try{jsonpatch[_0x77d3('0x1f')](_0x4366b6,_0x1af8a4,!![]);}catch(_0xc9008d){return BPromise[_0x77d3('0x20')](_0xc9008d);}return _0x4366b6['save']();};}function saveUpdates(_0x2acc21,_0x17d3a3){return function(_0x1504c7){if(_0x1504c7){return _0x1504c7[_0x77d3('0x21')](_0x2acc21)[_0x77d3('0x22')](function(_0x1541c1){return _0x1541c1;});}return null;};}function removeEntity(_0x12c085,_0x17e9f9){return function(_0x2c0861){if(_0x2c0861){return _0x2c0861['destroy']()[_0x77d3('0x22')](function(){_0x12c085['status'](0xcc)[_0x77d3('0x16')]();});}};}function handleEntityNotFound(_0x443aa6,_0x1f03a3){return function(_0x2a02c8){if(!_0x2a02c8){_0x443aa6[_0x77d3('0x15')](0x194);}return _0x2a02c8;};}function handleError(_0x18eb30,_0x5481cd){_0x5481cd=_0x5481cd||0x1f4;return function(_0x17c6c6){logger[_0x77d3('0x23')](_0x17c6c6[_0x77d3('0x24')]);if(_0x17c6c6[_0x77d3('0x25')]){delete _0x17c6c6[_0x77d3('0x25')];}_0x18eb30[_0x77d3('0x17')](_0x5481cd)[_0x77d3('0x26')](_0x17c6c6);};}exports[_0x77d3('0x27')]=function(_0x275eb5,_0x41b79d){var _0x59c650={},_0x3add49={},_0x35d7d6={'count':0x0,'rows':[]};var _0x5809d2=_[_0x77d3('0x28')](db[_0x77d3('0x29')]['rawAttributes'],function(_0x524f89){return{'name':_0x524f89[_0x77d3('0x2a')],'type':_0x524f89['type'][_0x77d3('0x2b')]};});_0x3add49[_0x77d3('0x2c')]=_[_0x77d3('0x28')](_0x5809d2,'name');_0x3add49['query']=_['keys'](_0x275eb5[_0x77d3('0x2d')]);_0x3add49[_0x77d3('0x2e')]=_[_0x77d3('0x2f')](_0x3add49[_0x77d3('0x2c')],_0x3add49[_0x77d3('0x2d')]);_0x59c650[_0x77d3('0x30')]=_[_0x77d3('0x2f')](_0x3add49[_0x77d3('0x2c')],qs['fields'](_0x275eb5['query'][_0x77d3('0x31')]));_0x59c650[_0x77d3('0x30')]=_0x59c650['attributes'][_0x77d3('0x32')]?_0x59c650['attributes']:_0x3add49[_0x77d3('0x2c')];if(!_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x33')](_0x77d3('0x34'))){_0x59c650[_0x77d3('0x1c')]=qs['limit'](_0x275eb5['query'][_0x77d3('0x1c')]);_0x59c650[_0x77d3('0x19')]=qs[_0x77d3('0x19')](_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x19')]);}_0x59c650[_0x77d3('0x35')]=qs[_0x77d3('0x36')](_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x36')]);_0x59c650[_0x77d3('0x37')]=qs['filters'](_['pick'](_0x275eb5[_0x77d3('0x2d')],_0x3add49['filters']),_0x5809d2);if(_0x275eb5[_0x77d3('0x2d')]['filter']){_0x59c650[_0x77d3('0x37')]=_['merge'](_0x59c650[_0x77d3('0x37')],{'$or':_[_0x77d3('0x28')](_0x5809d2,function(_0x578ddb){if(_0x578ddb[_0x77d3('0x38')]!==_0x77d3('0x39')){var _0x519e80={};_0x519e80[_0x578ddb[_0x77d3('0x25')]]={'$like':'%'+_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x3a')]+'%'};return _0x519e80;}})});}_0x59c650=_[_0x77d3('0x3b')]({},_0x59c650,_0x275eb5[_0x77d3('0x3c')]);var _0x412cb5={'where':_0x59c650[_0x77d3('0x37')]};return db[_0x77d3('0x29')]['count'](_0x412cb5)[_0x77d3('0x22')](function(_0x2ca4eb){_0x35d7d6[_0x77d3('0x1b')]=_0x2ca4eb;if(_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x3d')]){_0x59c650[_0x77d3('0x3e')]=[{'all':!![]}];}return db[_0x77d3('0x29')][_0x77d3('0x3f')](_0x59c650);})[_0x77d3('0x22')](function(_0x28223f){_0x35d7d6[_0x77d3('0x40')]=_0x28223f;return _0x35d7d6;})[_0x77d3('0x22')](respondWithFilteredResult(_0x41b79d,_0x59c650))[_0x77d3('0x41')](handleError(_0x41b79d,null));};exports[_0x77d3('0x42')]=function(_0x553215,_0x316441){var _0x37ea08={'raw':!![],'where':{'id':_0x553215['params']['id']}},_0x17fd69={};_0x17fd69['model']=_['keys'](db[_0x77d3('0x29')][_0x77d3('0x43')]);_0x17fd69[_0x77d3('0x2d')]=_[_0x77d3('0x44')](_0x553215[_0x77d3('0x2d')]);_0x17fd69[_0x77d3('0x2e')]=_['intersection'](_0x17fd69['model'],_0x17fd69[_0x77d3('0x2d')]);_0x37ea08[_0x77d3('0x30')]=_[_0x77d3('0x2f')](_0x17fd69['model'],qs['fields'](_0x553215[_0x77d3('0x2d')][_0x77d3('0x31')]));_0x37ea08['attributes']=_0x37ea08[_0x77d3('0x30')]['length']?_0x37ea08['attributes']:_0x17fd69[_0x77d3('0x2c')];if(_0x553215[_0x77d3('0x2d')][_0x77d3('0x3d')]){_0x37ea08[_0x77d3('0x3e')]=[{'all':!![]}];}_0x37ea08=_[_0x77d3('0x3b')]({},_0x37ea08,_0x553215[_0x77d3('0x3c')]);return db[_0x77d3('0x29')][_0x77d3('0x45')](_0x37ea08)['then'](handleEntityNotFound(_0x316441,null))[_0x77d3('0x22')](respondWithResult(_0x316441,null))[_0x77d3('0x41')](handleError(_0x316441,null));};exports[_0x77d3('0x46')]=function(_0x1e2d39,_0x42b113){return db[_0x77d3('0x29')][_0x77d3('0x46')](_0x1e2d39[_0x77d3('0x47')],{})[_0x77d3('0x22')](respondWithResult(_0x42b113,0xc9))[_0x77d3('0x41')](handleError(_0x42b113,null));};exports['update']=function(_0x1ff0d5,_0x37e2f7){if(_0x1ff0d5['body']['id']){delete _0x1ff0d5['body']['id'];}return db['WhatsappApplication'][_0x77d3('0x45')]({'where':{'id':_0x1ff0d5['params']['id']}})[_0x77d3('0x22')](handleEntityNotFound(_0x37e2f7,null))[_0x77d3('0x22')](saveUpdates(_0x1ff0d5[_0x77d3('0x47')],null))[_0x77d3('0x22')](respondWithResult(_0x37e2f7,null))[_0x77d3('0x41')](handleError(_0x37e2f7,null));};exports['destroy']=function(_0x1b8917,_0x514688){return db[_0x77d3('0x29')]['find']({'where':{'id':_0x1b8917['params']['id']}})[_0x77d3('0x22')](handleEntityNotFound(_0x514688,null))['then'](removeEntity(_0x514688,null))[_0x77d3('0x41')](handleError(_0x514688,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ab6b045..115e038 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 _0xeb5d=['../../config/logger','api','moment','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x27ec84,_0x5c44b9){var _0x3cea02=function(_0x1ecb24){while(--_0x1ecb24){_0x27ec84['push'](_0x27ec84['shift']());}};_0x3cea02(++_0x5c44b9);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xeb5d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdeb5('0xb'),'collate':_0xdeb5('0xc')});}; \ No newline at end of file +var _0xca9e=['WhatsappApplication','whatsapp_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0xca9e,0x136));var _0xeca9=function(_0xa55c47,_0x41fd11){_0xa55c47=_0xa55c47-0x0;var _0xbf49b5=_0xca9e[_0xa55c47];return _0xbf49b5;};'use strict';var _=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var logger=require(_0xeca9('0x2'))(_0xeca9('0x3'));var moment=require(_0xeca9('0x4'));var BPromise=require(_0xeca9('0x5'));var rp=require(_0xeca9('0x6'));var fs=require('fs');var path=require(_0xeca9('0x7'));var rimraf=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var attributes=require(_0xeca9('0xa'));module[_0xeca9('0xb')]=function(_0x186a47,_0x305dc5){return _0x186a47['define'](_0xeca9('0xc'),attributes,{'tableName':_0xeca9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 710e661..91da43f 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x8ebc5a,_0x3b01c2){var _0x20d39f=function(_0x520b19){while(--_0x520b19){_0x8ebc5a['push'](_0x8ebc5a['shift']());}};_0x20d39f(++_0x3b01c2);}(_0x00bb,0x1d8));var _0xb00b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x00bb[_0xbb091];return _0x467a04;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdace,0xc5));var _0xedac=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xdace[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 1a4c3cf..81a857e 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9505=['describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index'];(function(_0x4be178,_0x364f41){var _0x31f7b0=function(_0x28d669){while(--_0x28d669){_0x4be178['push'](_0x4be178['shift']());}};_0x31f7b0(++_0x364f41);}(_0x9505,0x1e5));var _0x5950=function(_0xa4d52,_0x507edb){_0xa4d52=_0xa4d52-0x0;var _0x2096dd=_0x9505[_0xa4d52];return _0x2096dd;};'use strict';var multer=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var path=require('path');var timeout=require(_0x5950('0x2'));var express=require(_0x5950('0x3'));var router=express[_0x5950('0x4')]();var fs_extra=require(_0x5950('0x5'));var auth=require(_0x5950('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5950('0x7'));router[_0x5950('0x8')]('/',auth[_0x5950('0x9')](),controller[_0x5950('0xa')]);router['get']('/describe',auth[_0x5950('0x9')](),controller[_0x5950('0xb')]);router[_0x5950('0x8')](_0x5950('0xc'),auth[_0x5950('0x9')](),controller[_0x5950('0xd')]);router[_0x5950('0x8')](_0x5950('0xe'),auth[_0x5950('0x9')](),controller['getMessages']);router[_0x5950('0x8')](_0x5950('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x5950('0x10')]('/',auth[_0x5950('0x9')](),controller[_0x5950('0x11')]);router[_0x5950('0x10')](_0x5950('0xe'),auth[_0x5950('0x9')](),controller[_0x5950('0x12')]);router[_0x5950('0x10')](_0x5950('0x13'),auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x16')),controller[_0x5950('0x17')]);router[_0x5950('0x18')](_0x5950('0xc'),auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x19')),controller[_0x5950('0x1a')]);router['delete']('/:id',auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x1b')),controller[_0x5950('0x1c')]);router['delete']('/:id/tags',auth[_0x5950('0x9')](),controller[_0x5950('0x1d')]);module[_0x5950('0x1e')]=router; \ No newline at end of file +var _0x9505=['describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index'];(function(_0x17e143,_0x5e21d2){var _0x5b8c89=function(_0x51df2d){while(--_0x51df2d){_0x17e143['push'](_0x17e143['shift']());}};_0x5b8c89(++_0x5e21d2);}(_0x9505,0x1e5));var _0x5950=function(_0x68b1e,_0x5d8768){_0x68b1e=_0x68b1e-0x0;var _0x25361b=_0x9505[_0x68b1e];return _0x25361b;};'use strict';var multer=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var path=require('path');var timeout=require(_0x5950('0x2'));var express=require(_0x5950('0x3'));var router=express[_0x5950('0x4')]();var fs_extra=require(_0x5950('0x5'));var auth=require(_0x5950('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5950('0x7'));router[_0x5950('0x8')]('/',auth[_0x5950('0x9')](),controller[_0x5950('0xa')]);router['get']('/describe',auth[_0x5950('0x9')](),controller[_0x5950('0xb')]);router[_0x5950('0x8')](_0x5950('0xc'),auth[_0x5950('0x9')](),controller[_0x5950('0xd')]);router[_0x5950('0x8')](_0x5950('0xe'),auth[_0x5950('0x9')](),controller['getMessages']);router[_0x5950('0x8')](_0x5950('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x5950('0x10')]('/',auth[_0x5950('0x9')](),controller[_0x5950('0x11')]);router[_0x5950('0x10')](_0x5950('0xe'),auth[_0x5950('0x9')](),controller[_0x5950('0x12')]);router[_0x5950('0x10')](_0x5950('0x13'),auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x16')),controller[_0x5950('0x17')]);router[_0x5950('0x18')](_0x5950('0xc'),auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x19')),controller[_0x5950('0x1a')]);router['delete']('/:id',auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x1b')),controller[_0x5950('0x1c')]);router['delete']('/:id/tags',auth[_0x5950('0x9')](),controller[_0x5950('0x1d')]);module[_0x5950('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 8088bb8..65f2154 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 _0xd0da=['INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x4e1217,_0x45a98a){var _0x1ecdce=function(_0x554f04){while(--_0x554f04){_0x4e1217['push'](_0x4e1217['shift']());}};_0x1ecdce(++_0x45a98a);}(_0xd0da,0x1b1));var _0xad0d=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0xd0da[_0x548627];return _0x844a84;};'use strict';var Sequelize=require(_0xad0d('0x0'));var moment=require(_0xad0d('0x1'));module[_0xad0d('0x2')]={'closed':{'type':Sequelize[_0xad0d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xad0d('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xad0d('0x5')]},'thirdDisposition':{'type':Sequelize[_0xad0d('0x5')]},'note':{'type':Sequelize[_0xad0d('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xad0d('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xad0d('0x6')]('in',_0xad0d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xad0d('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xad0d('0x8')]}}; \ No newline at end of file +var _0x9582=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x406518,_0x1df24f){var _0x1e17e9=function(_0x1d8819){while(--_0x1d8819){_0x406518['push'](_0x406518['shift']());}};_0x1e17e9(++_0x1df24f);}(_0x9582,0x95));var _0x2958=function(_0x4ae99e,_0x1a3cf9){_0x4ae99e=_0x4ae99e-0x0;var _0x2ab569=_0x9582[_0x4ae99e];return _0x2ab569;};'use strict';var Sequelize=require(_0x2958('0x0'));var moment=require(_0x2958('0x1'));module[_0x2958('0x2')]={'closed':{'type':Sequelize[_0x2958('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2958('0x4')]},'disposition':{'type':Sequelize[_0x2958('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2958('0x5')]},'note':{'type':Sequelize[_0x2958('0x5')]},'phone':{'type':Sequelize[_0x2958('0x5')]},'read1stAt':{'type':Sequelize[_0x2958('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2958('0x6')]('in',_0x2958('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2958('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2958('0x6')]('in',_0x2958('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2958('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c340b47..4169553 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 _0x4444=['User','Owner','get','mkdirSync','N.A.','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','direction','out','value','renderFile','views','.pdf','download','log','err','unlinkSync','rimraf','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','stack','name','send','map','WhatsappInteraction','rawAttributes','fieldName','type','findAll','whatsapp','then','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','Contact','lastName','push','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Account'];(function(_0xb1285f,_0x243cea){var _0x125a12=function(_0x32a76b){while(--_0x32a76b){_0xb1285f['push'](_0xb1285f['shift']());}};_0x125a12(++_0x243cea);}(_0x4444,0x17e));var _0x4444=function(_0xe8fa1f,_0x12bba1){_0xe8fa1f=_0xe8fa1f-0x0;var _0x4b3a65=_0x4444[_0xe8fa1f];return _0x4b3a65;};'use strict';var rimraf=require(_0x4444('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x4444('0x1'));var path=require(_0x4444('0x2'));var ejs=require(_0x4444('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4444('0x4'));var interaction=require(_0x4444('0x5'));var qs=require(_0x4444('0x6'));var pdf=require(_0x4444('0x7'));var logger=require(_0x4444('0x8'))('api');var config=require(_0x4444('0x9'));var db=require('../../mysqldb')['db'];config[_0x4444('0xa')]=_['defaults'](config[_0x4444('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4444('0xa')]));require('./whatsappInteraction.socket')[_0x4444('0xb')](socket);function respondWithStatusCode(_0x2b9a77,_0x11c668){_0x11c668=_0x11c668||0xcc;return function(_0x5c5e5a){if(_0x5c5e5a){return _0x2b9a77[_0x4444('0xc')](_0x11c668);}return _0x2b9a77[_0x4444('0xd')](_0x11c668)[_0x4444('0xe')]();};}function respondWithResult(_0x37f69c,_0x4f8d18){_0x4f8d18=_0x4f8d18||0xc8;return function(_0x29b342){if(_0x29b342){return _0x37f69c['status'](_0x4f8d18)[_0x4444('0xf')](_0x29b342);}};}function respondWithFilteredResult(_0x178a72,_0x41acf7){return function(_0xa04a68){if(_0xa04a68){var _0x5b25d7=typeof _0x41acf7['offset']===_0x4444('0x10')&&typeof _0x41acf7[_0x4444('0x11')]==='undefined';var _0x52b82c=_0xa04a68[_0x4444('0x12')];var _0x113fb5=_0x5b25d7?0x0:_0x41acf7[_0x4444('0x13')];var _0x168525=_0x5b25d7?_0xa04a68['count']:_0x41acf7[_0x4444('0x13')]+_0x41acf7[_0x4444('0x11')];var _0x5cda30;if(_0x168525>=_0x52b82c){_0x168525=_0x52b82c;_0x5cda30=0xc8;}else{_0x5cda30=0xce;}_0x178a72['status'](_0x5cda30);return _0x178a72[_0x4444('0x14')](_0x4444('0x15'),_0x113fb5+'-'+_0x168525+'/'+_0x52b82c)['json'](_0xa04a68);}return null;};}function saveUpdates(_0x597a44){return function(_0x3a8ecd){if(_0x3a8ecd){return _0x3a8ecd[_0x4444('0x16')](_0x597a44)['then'](function(_0x3de324){return _0x3de324;});}return null;};}function removeEntity(_0x490e3d){return function(_0x7b1c62){if(_0x7b1c62){return _0x7b1c62[_0x4444('0x17')]()['then'](function(){_0x490e3d['status'](0xcc)[_0x4444('0xe')]();});}};}function handleEntityNotFound(_0x4b263f){return function(_0x4a6ad0){if(!_0x4a6ad0){_0x4b263f['sendStatus'](0x194);}return _0x4a6ad0;};}function handleError(_0x315aac,_0x40489a){_0x40489a=_0x40489a||0x1f4;return function(_0x8ccc03){logger['error'](_0x8ccc03[_0x4444('0x18')]);if(_0x8ccc03[_0x4444('0x19')]){delete _0x8ccc03[_0x4444('0x19')];}_0x315aac[_0x4444('0xd')](_0x40489a)[_0x4444('0x1a')](_0x8ccc03);};}exports['index']=function(_0x53d4cd,_0x474532){var _0x264a81={};var _0x36afba=_[_0x4444('0x1b')](db[_0x4444('0x1c')][_0x4444('0x1d')],function(_0x3c6263){return{'name':_0x3c6263[_0x4444('0x1e')],'type':_0x3c6263[_0x4444('0x1f')]['key']};});_0x264a81=qs['getOptions'](_0x36afba,_0x53d4cd);return interaction[_0x4444('0x20')](_0x4444('0x21'),_0x53d4cd['query'],_0x53d4cd['user'],_0x264a81,_0x36afba)[_0x4444('0x22')](respondWithFilteredResult(_0x474532,_0x264a81))[_0x4444('0x23')](handleError(_0x474532,null));};exports[_0x4444('0x24')]=function(_0x2ccc84,_0x2b189f){var _0x2bb1f6={'raw':![],'where':{'id':_0x2ccc84[_0x4444('0x25')]['id']}},_0x188723={};_0x188723[_0x4444('0x26')]=_[_0x4444('0x27')](db[_0x4444('0x1c')][_0x4444('0x1d')]);_0x188723[_0x4444('0x28')]=_[_0x4444('0x27')](_0x2ccc84[_0x4444('0x28')]);_0x188723[_0x4444('0x29')]=_[_0x4444('0x2a')](_0x188723[_0x4444('0x26')],_0x188723[_0x4444('0x28')]);_0x2bb1f6[_0x4444('0x2b')]=_[_0x4444('0x2a')](_0x188723[_0x4444('0x26')],qs[_0x4444('0x2c')](_0x2ccc84[_0x4444('0x28')][_0x4444('0x2c')]));_0x2bb1f6[_0x4444('0x2b')]=_0x2bb1f6[_0x4444('0x2b')][_0x4444('0x2d')]?_0x2bb1f6[_0x4444('0x2b')]:_0x188723['model'];if(_0x2ccc84['query'][_0x4444('0x2e')]){_0x2bb1f6[_0x4444('0x2f')]=[{'all':!![]}];}_0x2bb1f6=_[_0x4444('0x30')]({},_0x2bb1f6,_0x2ccc84[_0x4444('0x31')]);return db[_0x4444('0x1c')]['find'](_0x2bb1f6)[_0x4444('0x22')](handleEntityNotFound(_0x2b189f,null))[_0x4444('0x22')](respondWithResult(_0x2b189f,null))['catch'](handleError(_0x2b189f,null));};exports['create']=function(_0x252941,_0x664d51){return db[_0x4444('0x1c')][_0x4444('0x32')](_0x252941[_0x4444('0x33')],{})[_0x4444('0x22')](respondWithResult(_0x664d51,0xc9))[_0x4444('0x23')](handleError(_0x664d51,null));};exports[_0x4444('0x16')]=function(_0x5d562b,_0x476c18){if(_0x5d562b['body']['id']){delete _0x5d562b[_0x4444('0x33')]['id'];}return db[_0x4444('0x1c')]['find']({'where':{'id':_0x5d562b['params']['id']}})[_0x4444('0x22')](handleEntityNotFound(_0x476c18,null))['then'](saveUpdates(_0x5d562b[_0x4444('0x33')],null))[_0x4444('0x22')](respondWithResult(_0x476c18,null))[_0x4444('0x23')](handleError(_0x476c18,null));};exports['destroy']=function(_0x137dfe,_0xb38fec){return db[_0x4444('0x1c')][_0x4444('0x34')]({'where':{'id':_0x137dfe[_0x4444('0x25')]['id']}})[_0x4444('0x22')](handleEntityNotFound(_0xb38fec,null))[_0x4444('0x22')](removeEntity(_0xb38fec,null))[_0x4444('0x23')](handleError(_0xb38fec,null));};exports[_0x4444('0x35')]=function(_0x1c21a2,_0x231745){return db[_0x4444('0x1c')]['describe']()[_0x4444('0x22')](respondWithResult(_0x231745,null))[_0x4444('0x23')](handleError(_0x231745,null));};exports[_0x4444('0x36')]=function(_0x19211d,_0xbb5a3e){return db[_0x4444('0x37')][_0x4444('0x34')]({'where':{'id':_0x19211d['params']['id']}})[_0x4444('0x22')](handleEntityNotFound(_0xbb5a3e,null))[_0x4444('0x22')](function(_0x9030d2){if(_0x9030d2){return _0x9030d2[_0x4444('0x36')](_0x19211d[_0x4444('0x33')]['ids'],_[_0x4444('0x38')](_0x19211d['body'],[_0x4444('0x39'),'id'])||{});}})['then'](respondWithResult(_0xbb5a3e,null))[_0x4444('0x23')](handleError(_0xbb5a3e,null));};exports[_0x4444('0x3a')]=function(_0xf99b36,_0x4c06ac){var _0x5324ab={'raw':![],'where':{}};var _0x127628={};var _0x59c0b1={'count':0x0,'rows':[]};return db[_0x4444('0x1c')][_0x4444('0x3b')]({'where':{'id':_0xf99b36[_0x4444('0x25')]['id']}})[_0x4444('0x22')](handleEntityNotFound(_0x4c06ac,null))[_0x4444('0x22')](function(_0x49ff6a){if(_0x49ff6a){_0x127628[_0x4444('0x26')]=_[_0x4444('0x27')](db[_0x4444('0x37')][_0x4444('0x1d')]);_0x127628[_0x4444('0x28')]=_['keys'](_0xf99b36['query']);_0x127628[_0x4444('0x29')]=_[_0x4444('0x2a')](_0x127628[_0x4444('0x26')],_0x127628[_0x4444('0x28')]);_0x5324ab[_0x4444('0x2b')]=_[_0x4444('0x2a')](_0x127628[_0x4444('0x26')],qs['fields'](_0xf99b36[_0x4444('0x28')][_0x4444('0x2c')]));_0x5324ab[_0x4444('0x2b')]=_0x5324ab['attributes'][_0x4444('0x2d')]?_0x5324ab[_0x4444('0x2b')]:_0x127628['model'];if(!_0xf99b36['query'][_0x4444('0x3c')](_0x4444('0x3d'))){_0x5324ab[_0x4444('0x11')]=qs[_0x4444('0x11')](_0xf99b36[_0x4444('0x28')][_0x4444('0x11')]);_0x5324ab[_0x4444('0x13')]=qs['offset'](_0xf99b36['query'][_0x4444('0x13')]);}_0x5324ab[_0x4444('0x3e')]=qs[_0x4444('0x3f')](_0xf99b36['query']['sort']);_0x5324ab['where']=qs[_0x4444('0x29')](_['pick'](_0xf99b36[_0x4444('0x28')],_0x127628[_0x4444('0x29')]));_0x5324ab[_0x4444('0x40')][_0x4444('0x41')]=_0x49ff6a['id'];if(_0xf99b36['query']['filter']){_0x5324ab[_0x4444('0x40')]=_[_0x4444('0x30')](_0x5324ab[_0x4444('0x40')],{'$or':_['map'](_0x5324ab['attributes'],function(_0xf4643){var _0x4a4fc3={};_0x4a4fc3[_0xf4643]={'$like':'%'+_0xf99b36['query'][_0x4444('0x42')]+'%'};return _0x4a4fc3;})});}if(_0xf99b36['query'][_0x4444('0x43')]){var _0x20414d=_0xf99b36[_0x4444('0x28')][_0x4444('0x43')][_0x4444('0x44')](',');var _0x4caf21={};_0x4caf21[_0x20414d[0x0]]={'$gte':moment(_0x20414d[0x1])[_0x4444('0x45')](_0x4444('0x46'))};_0x5324ab[_0x4444('0x40')]=_[_0x4444('0x30')](_0x5324ab[_0x4444('0x40')],_0x4caf21);}_0x5324ab=_[_0x4444('0x30')]({},_0x5324ab,_0xf99b36['options']);return db['WhatsappMessage']['count']({'where':_0x5324ab[_0x4444('0x40')]})[_0x4444('0x22')](function(_0x56dff5){_0x59c0b1[_0x4444('0x12')]=_0x56dff5;if(_0xf99b36['query'][_0x4444('0x2e')]){_0x5324ab[_0x4444('0x2f')]=[{'all':!![]}];}return db[_0x4444('0x37')][_0x4444('0x20')](_0x5324ab);})[_0x4444('0x22')](function(_0x17d75d){_0x59c0b1[_0x4444('0x47')]=_0x17d75d;return _0x59c0b1;});}})[_0x4444('0x22')](respondWithFilteredResult(_0x4c06ac,_0x5324ab))[_0x4444('0x23')](handleError(_0x4c06ac,null));};exports[_0x4444('0x48')]=function(_0x37c5af,_0x1b4585){return db['WhatsappInteraction'][_0x4444('0x34')]({'where':{'id':_0x37c5af[_0x4444('0x25')]['id']}})[_0x4444('0x22')](handleEntityNotFound(_0x1b4585,null))[_0x4444('0x22')](function(_0x11f613){if(_0x11f613){return _0x11f613[_0x4444('0x49')](_0x37c5af[_0x4444('0x33')]['ids'],_[_0x4444('0x38')](_0x37c5af['body'],[_0x4444('0x39'),'id'])||{})['spread'](function(){return db[_0x4444('0x4a')]['findAll']({'attributes':['id',_0x4444('0x19'),_0x4444('0x4b')],'where':{'id':_0x37c5af['body'][_0x4444('0x39')]}});})[_0x4444('0x22')](function(_0x2f0669){socket[_0x4444('0x4c')](_0x4444('0x4d'),{'id':Number(_0x37c5af[_0x4444('0x25')]['id']),'tags':_0x2f0669||[]});return{'id':Number(_0x37c5af['params']['id']),'tags':_0x2f0669||[]};});}})[_0x4444('0x22')](respondWithResult(_0x1b4585,null))[_0x4444('0x23')](handleError(_0x1b4585,null));};exports[_0x4444('0x4e')]=function(_0x2b42ed,_0x36404d){return db[_0x4444('0x1c')][_0x4444('0x34')]({'where':{'id':_0x2b42ed['params']['id']}})[_0x4444('0x22')](handleEntityNotFound(_0x36404d,null))['then'](function(_0x20c12c){if(_0x20c12c){return _0x20c12c[_0x4444('0x4e')](_0x2b42ed['query'][_0x4444('0x39')]);}})[_0x4444('0x22')](respondWithStatusCode(_0x36404d,null))[_0x4444('0x23')](handleError(_0x36404d,null));};exports['download']=function(_0x8951ab,_0x5a4ee6){var _0xde1cf9=moment()['unix']()[_0x4444('0x4f')]();var _0x1b8029=path[_0x4444('0x50')](config[_0x4444('0x51')],_0x4444('0x52'),_0x4444('0x53'),_0x4444('0x54'));var _0x2e3065=path[_0x4444('0x50')](config[_0x4444('0x51')],'server','files',_0x4444('0x55'));var _0x28f979=path[_0x4444('0x50')](_0x1b8029,_0xde1cf9);var _0x54574d=util[_0x4444('0x45')](_0x4444('0x56'),_0x8951ab[_0x4444('0x25')]['id'],_0xde1cf9);var _0x236806=path[_0x4444('0x50')](_0x1b8029,_0x54574d);var _0x4516b0=[];_0x4516b0['push']({'model':db['User'],'as':'User','attributes':['id',_0x4444('0x57')],'raw':!![]});_0x4516b0['push']({'model':db['CmContact'],'as':_0x4444('0x58'),'attributes':['id','firstName',_0x4444('0x59')],'raw':!![]});if(_0x8951ab[_0x4444('0x28')][_0x4444('0x55')]){_0x4516b0[_0x4444('0x5a')]({'model':db['Attachment'],'as':_0x4444('0x5b'),'raw':!![]});}var _0x5461d5=[{'model':db[_0x4444('0x37')],'as':_0x4444('0x5c'),'attributes':['id',_0x4444('0x33'),_0x4444('0x5d'),'direction',_0x4444('0x5e'),_0x4444('0x5f')],'include':_0x4516b0}];_0x5461d5['push']({'model':db[_0x4444('0x60')],'as':_0x4444('0x61'),'attributes':['id','name']});_0x5461d5[_0x4444('0x5a')]({'model':db[_0x4444('0x62')],'as':_0x4444('0x63'),'attributes':['id',_0x4444('0x57')]});return db[_0x4444('0x1c')][_0x4444('0x34')]({'where':{'id':_0x8951ab[_0x4444('0x25')]['id']},'include':_0x5461d5})[_0x4444('0x22')](handleEntityNotFound(_0x5a4ee6,null))['then'](function(_0xafd98c){if(_0xafd98c){var _0x1a8596=_0xafd98c[_0x4444('0x64')]({'plain':!![]});fs[_0x4444('0x65')](_0x28f979);var _0x4bc37e={'channel':'Whatsapp','account':_0x1a8596[_0x4444('0x61')]['name'],'agent':_0x1a8596[_0x4444('0x63')]?_0x1a8596[_0x4444('0x63')][_0x4444('0x57')]:_0x4444('0x66'),'createdAt':moment(_0x1a8596[_0x4444('0x5d')])['format'](_0x4444('0x46'))[_0x4444('0x4f')](),'closedAt':_0x1a8596[_0x4444('0x67')]?moment(_0x1a8596[_0x4444('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4444('0x4f')]():'','disposition':_0x1a8596[_0x4444('0x69')],'messages':_(_0x1a8596[_0x4444('0x5c')])['filter']({'secret':![]})[_0x4444('0x1b')](function(_0x53f8cd){if(_0x53f8cd[_0x4444('0x5b')]){var _0x262494=path[_0x4444('0x50')](_0x2e3065,_0x53f8cd[_0x4444('0x5b')][_0x4444('0x6a')]);if(fs[_0x4444('0x6b')](_0x262494)){fs['createReadStream'](_0x262494)[_0x4444('0x6c')](fs[_0x4444('0x6d')](path['join'](_0x28f979,_0x53f8cd[_0x4444('0x5b')][_0x4444('0x6a')])));}}return{'date':moment(_0x53f8cd[_0x4444('0x5d')])['format'](_0x4444('0x46'))[_0x4444('0x4f')](),'sender':_0x53f8cd[_0x4444('0x6e')]===_0x4444('0x6f')?_0x53f8cd[_0x4444('0x62')]?_0x53f8cd[_0x4444('0x62')][_0x4444('0x57')]:'System':_0x53f8cd['Contact']['firstName']+(_0x53f8cd[_0x4444('0x58')]['lastName']?'\x20'+_0x53f8cd[_0x4444('0x58')][_0x4444('0x59')]:''),'body':_0x53f8cd[_0x4444('0x5b')]?_0x53f8cd[_0x4444('0x5b')][_0x4444('0x6a')]:_0x53f8cd['body'],'direction':_0x53f8cd[_0x4444('0x6e')]===_0x4444('0x6f')?'A':'C','secret':_0x53f8cd[_0x4444('0x5e')],'read':_0x53f8cd[_0x4444('0x5f')],'attachment':_0x53f8cd[_0x4444('0x5b')]};})[_0x4444('0x70')]()};return ejs[_0x4444('0x71')](path[_0x4444('0x50')](config[_0x4444('0x51')],'server',_0x4444('0x72'),'downloadInteraction.ejs'),{'interaction':_0x4bc37e})[_0x4444('0x22')](function(_0x96664c){var _0x288897=path['join'](_0x28f979,'transcript-'+_0x1a8596['id']+'-'+_0xde1cf9+_0x4444('0x73'));var _0x9eb1bf={'path':_0x288897,'channel':'Whatsapp','interactionId':_0x1a8596['id']};return pdf['createPdfFromHTML'](_0x96664c,_0x9eb1bf);})[_0x4444('0x22')](function(){return new BPromise(function(_0x175795,_0x40d261){zipdir(_0x28f979,{'saveTo':_0x236806},function(_0x5e21ea,_0x623b97){if(_0x5e21ea)return _0x40d261(_0x5e21ea);return _0x175795(_0x623b97);});})['then'](function(){return new BPromise(function(_0xc881ea,_0x79371d){rimraf(_0x28f979,function(_0xd209d0){if(_0xd209d0)_0x79371d(_0xd209d0);return _0xc881ea();});});})[_0x4444('0x22')](function(){return _0x5a4ee6[_0x4444('0x74')](_0x236806,_0x54574d,function(_0x4facad){if(_0x4facad){console[_0x4444('0x75')](_0x4444('0x76'),_0x4facad);}else{fs[_0x4444('0x77')](_0x236806);}});});});}else{return _0x5a4ee6['sendStatus'](0xc8);}})['catch'](handleError(_0x5a4ee6,null));}; \ No newline at end of file +var _0xfcb9=['whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','options','find','body','describe','addMessage','WhatsappMessage','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','includeAll','include','rows','Tag','color','ids','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','toString','disposition','basename','existsSync','createReadStream','pipe','out','System','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','findAll'];(function(_0x1a931c,_0x33016c){var _0x257e3e=function(_0x2f94af){while(--_0x2f94af){_0x1a931c['push'](_0x1a931c['shift']());}};_0x257e3e(++_0x33016c);}(_0xfcb9,0x14e));var _0x9fcb=function(_0x34b50f,_0x13863e){_0x34b50f=_0x34b50f-0x0;var _0x112b6f=_0xfcb9[_0x34b50f];return _0x112b6f;};'use strict';var rimraf=require(_0x9fcb('0x0'));var zipdir=require(_0x9fcb('0x1'));var moment=require(_0x9fcb('0x2'));var BPromise=require(_0x9fcb('0x3'));var util=require(_0x9fcb('0x4'));var path=require(_0x9fcb('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9fcb('0x6'));var Redis=require(_0x9fcb('0x7'));var interaction=require(_0x9fcb('0x8'));var qs=require(_0x9fcb('0x9'));var pdf=require(_0x9fcb('0xa'));var logger=require(_0x9fcb('0xb'))(_0x9fcb('0xc'));var config=require('../../config/environment');var db=require(_0x9fcb('0xd'))['db'];config['redis']=_['defaults'](config[_0x9fcb('0xe')],{'host':_0x9fcb('0xf'),'port':0x18eb});var socket=require(_0x9fcb('0x10'))(new Redis(config['redis']));require(_0x9fcb('0x11'))['register'](socket);function respondWithStatusCode(_0x223ae2,_0x3d2205){_0x3d2205=_0x3d2205||0xcc;return function(_0x5f30a7){if(_0x5f30a7){return _0x223ae2[_0x9fcb('0x12')](_0x3d2205);}return _0x223ae2[_0x9fcb('0x13')](_0x3d2205)[_0x9fcb('0x14')]();};}function respondWithResult(_0x5b9d9f,_0xc20283){_0xc20283=_0xc20283||0xc8;return function(_0x151d1b){if(_0x151d1b){return _0x5b9d9f[_0x9fcb('0x13')](_0xc20283)[_0x9fcb('0x15')](_0x151d1b);}};}function respondWithFilteredResult(_0x11700f,_0x3b4975){return function(_0x241d22){if(_0x241d22){var _0x41b296=typeof _0x3b4975[_0x9fcb('0x16')]===_0x9fcb('0x17')&&typeof _0x3b4975[_0x9fcb('0x18')]===_0x9fcb('0x17');var _0x29cce9=_0x241d22[_0x9fcb('0x19')];var _0x91e0b4=_0x41b296?0x0:_0x3b4975[_0x9fcb('0x16')];var _0x28a764=_0x41b296?_0x241d22[_0x9fcb('0x19')]:_0x3b4975[_0x9fcb('0x16')]+_0x3b4975['limit'];var _0x3e3e78;if(_0x28a764>=_0x29cce9){_0x28a764=_0x29cce9;_0x3e3e78=0xc8;}else{_0x3e3e78=0xce;}_0x11700f['status'](_0x3e3e78);return _0x11700f[_0x9fcb('0x1a')](_0x9fcb('0x1b'),_0x91e0b4+'-'+_0x28a764+'/'+_0x29cce9)['json'](_0x241d22);}return null;};}function saveUpdates(_0xdb05de){return function(_0xf2af1f){if(_0xf2af1f){return _0xf2af1f[_0x9fcb('0x1c')](_0xdb05de)[_0x9fcb('0x1d')](function(_0x20fe65){return _0x20fe65;});}return null;};}function removeEntity(_0x1c24a2){return function(_0x426757){if(_0x426757){return _0x426757[_0x9fcb('0x1e')]()[_0x9fcb('0x1d')](function(){_0x1c24a2['status'](0xcc)[_0x9fcb('0x14')]();});}};}function handleEntityNotFound(_0x56833f){return function(_0xd0a7b7){if(!_0xd0a7b7){_0x56833f[_0x9fcb('0x12')](0x194);}return _0xd0a7b7;};}function handleError(_0x54d216,_0x2d43a7){_0x2d43a7=_0x2d43a7||0x1f4;return function(_0x5ba168){logger[_0x9fcb('0x1f')](_0x5ba168[_0x9fcb('0x20')]);if(_0x5ba168[_0x9fcb('0x21')]){delete _0x5ba168[_0x9fcb('0x21')];}_0x54d216[_0x9fcb('0x13')](_0x2d43a7)['send'](_0x5ba168);};}exports[_0x9fcb('0x22')]=function(_0x182d66,_0x3cb677){var _0x2189df={};var _0x5d8386=_[_0x9fcb('0x23')](db[_0x9fcb('0x24')][_0x9fcb('0x25')],function(_0x38418a){return{'name':_0x38418a[_0x9fcb('0x26')],'type':_0x38418a[_0x9fcb('0x27')]['key']};});_0x2189df=qs['getOptions'](_0x5d8386,_0x182d66);return interaction[_0x9fcb('0x28')](_0x9fcb('0x29'),_0x182d66[_0x9fcb('0x2a')],_0x182d66[_0x9fcb('0x2b')],_0x2189df,_0x5d8386)[_0x9fcb('0x1d')](respondWithFilteredResult(_0x3cb677,_0x2189df))[_0x9fcb('0x2c')](handleError(_0x3cb677,null));};exports[_0x9fcb('0x2d')]=function(_0x57fb7b,_0x18447a){var _0x127f0e={'raw':![],'where':{'id':_0x57fb7b[_0x9fcb('0x2e')]['id']}},_0x321d0c={};_0x321d0c[_0x9fcb('0x2f')]=_[_0x9fcb('0x30')](db[_0x9fcb('0x24')][_0x9fcb('0x25')]);_0x321d0c['query']=_[_0x9fcb('0x30')](_0x57fb7b[_0x9fcb('0x2a')]);_0x321d0c[_0x9fcb('0x31')]=_[_0x9fcb('0x32')](_0x321d0c[_0x9fcb('0x2f')],_0x321d0c[_0x9fcb('0x2a')]);_0x127f0e[_0x9fcb('0x33')]=_[_0x9fcb('0x32')](_0x321d0c[_0x9fcb('0x2f')],qs[_0x9fcb('0x34')](_0x57fb7b[_0x9fcb('0x2a')][_0x9fcb('0x34')]));_0x127f0e[_0x9fcb('0x33')]=_0x127f0e[_0x9fcb('0x33')][_0x9fcb('0x35')]?_0x127f0e[_0x9fcb('0x33')]:_0x321d0c[_0x9fcb('0x2f')];if(_0x57fb7b[_0x9fcb('0x2a')]['includeAll']){_0x127f0e['include']=[{'all':!![]}];}_0x127f0e=_['merge']({},_0x127f0e,_0x57fb7b[_0x9fcb('0x36')]);return db[_0x9fcb('0x24')][_0x9fcb('0x37')](_0x127f0e)[_0x9fcb('0x1d')](handleEntityNotFound(_0x18447a,null))[_0x9fcb('0x1d')](respondWithResult(_0x18447a,null))[_0x9fcb('0x2c')](handleError(_0x18447a,null));};exports['create']=function(_0x446eda,_0x1647b4){return db[_0x9fcb('0x24')]['create'](_0x446eda[_0x9fcb('0x38')],{})['then'](respondWithResult(_0x1647b4,0xc9))['catch'](handleError(_0x1647b4,null));};exports['update']=function(_0x2b58ef,_0x27be16){if(_0x2b58ef[_0x9fcb('0x38')]['id']){delete _0x2b58ef[_0x9fcb('0x38')]['id'];}return db[_0x9fcb('0x24')][_0x9fcb('0x37')]({'where':{'id':_0x2b58ef[_0x9fcb('0x2e')]['id']}})[_0x9fcb('0x1d')](handleEntityNotFound(_0x27be16,null))[_0x9fcb('0x1d')](saveUpdates(_0x2b58ef['body'],null))[_0x9fcb('0x1d')](respondWithResult(_0x27be16,null))[_0x9fcb('0x2c')](handleError(_0x27be16,null));};exports[_0x9fcb('0x1e')]=function(_0x30053e,_0x2619db){return db[_0x9fcb('0x24')]['find']({'where':{'id':_0x30053e[_0x9fcb('0x2e')]['id']}})[_0x9fcb('0x1d')](handleEntityNotFound(_0x2619db,null))[_0x9fcb('0x1d')](removeEntity(_0x2619db,null))[_0x9fcb('0x2c')](handleError(_0x2619db,null));};exports[_0x9fcb('0x39')]=function(_0x5a2872,_0x153104){return db['WhatsappInteraction'][_0x9fcb('0x39')]()['then'](respondWithResult(_0x153104,null))[_0x9fcb('0x2c')](handleError(_0x153104,null));};exports[_0x9fcb('0x3a')]=function(_0x73365c,_0x35ead2){return db[_0x9fcb('0x3b')][_0x9fcb('0x37')]({'where':{'id':_0x73365c[_0x9fcb('0x2e')]['id']}})['then'](handleEntityNotFound(_0x35ead2,null))[_0x9fcb('0x1d')](function(_0x585da7){if(_0x585da7){return _0x585da7[_0x9fcb('0x3a')](_0x73365c[_0x9fcb('0x38')]['ids'],_[_0x9fcb('0x3c')](_0x73365c[_0x9fcb('0x38')],['ids','id'])||{});}})[_0x9fcb('0x1d')](respondWithResult(_0x35ead2,null))[_0x9fcb('0x2c')](handleError(_0x35ead2,null));};exports[_0x9fcb('0x3d')]=function(_0x21c3d7,_0x381c9e){var _0x38405e={'raw':![],'where':{}};var _0x4f3262={};var _0x2d7cdc={'count':0x0,'rows':[]};return db[_0x9fcb('0x24')]['findOne']({'where':{'id':_0x21c3d7[_0x9fcb('0x2e')]['id']}})[_0x9fcb('0x1d')](handleEntityNotFound(_0x381c9e,null))[_0x9fcb('0x1d')](function(_0x190b9a){if(_0x190b9a){_0x4f3262[_0x9fcb('0x2f')]=_[_0x9fcb('0x30')](db[_0x9fcb('0x3b')][_0x9fcb('0x25')]);_0x4f3262[_0x9fcb('0x2a')]=_['keys'](_0x21c3d7[_0x9fcb('0x2a')]);_0x4f3262[_0x9fcb('0x31')]=_[_0x9fcb('0x32')](_0x4f3262[_0x9fcb('0x2f')],_0x4f3262[_0x9fcb('0x2a')]);_0x38405e[_0x9fcb('0x33')]=_[_0x9fcb('0x32')](_0x4f3262[_0x9fcb('0x2f')],qs['fields'](_0x21c3d7['query'][_0x9fcb('0x34')]));_0x38405e[_0x9fcb('0x33')]=_0x38405e[_0x9fcb('0x33')][_0x9fcb('0x35')]?_0x38405e[_0x9fcb('0x33')]:_0x4f3262[_0x9fcb('0x2f')];if(!_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x3e')](_0x9fcb('0x3f'))){_0x38405e[_0x9fcb('0x18')]=qs[_0x9fcb('0x18')](_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x18')]);_0x38405e[_0x9fcb('0x16')]=qs[_0x9fcb('0x16')](_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x16')]);}_0x38405e[_0x9fcb('0x40')]=qs[_0x9fcb('0x41')](_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x41')]);_0x38405e[_0x9fcb('0x42')]=qs[_0x9fcb('0x31')](_['pick'](_0x21c3d7[_0x9fcb('0x2a')],_0x4f3262[_0x9fcb('0x31')]));_0x38405e[_0x9fcb('0x42')][_0x9fcb('0x43')]=_0x190b9a['id'];if(_0x21c3d7['query'][_0x9fcb('0x44')]){_0x38405e['where']=_['merge'](_0x38405e[_0x9fcb('0x42')],{'$or':_[_0x9fcb('0x23')](_0x38405e[_0x9fcb('0x33')],function(_0x3a34dc){var _0xcab9a1={};_0xcab9a1[_0x3a34dc]={'$like':'%'+_0x21c3d7['query'][_0x9fcb('0x44')]+'%'};return _0xcab9a1;})});}if(_0x21c3d7['query'][_0x9fcb('0x45')]){var _0x468a95=_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x45')][_0x9fcb('0x46')](',');var _0x5d0b79={};_0x5d0b79[_0x468a95[0x0]]={'$gte':moment(_0x468a95[0x1])[_0x9fcb('0x47')](_0x9fcb('0x48'))};_0x38405e[_0x9fcb('0x42')]=_[_0x9fcb('0x49')](_0x38405e[_0x9fcb('0x42')],_0x5d0b79);}_0x38405e=_['merge']({},_0x38405e,_0x21c3d7[_0x9fcb('0x36')]);return db[_0x9fcb('0x3b')][_0x9fcb('0x19')]({'where':_0x38405e[_0x9fcb('0x42')]})[_0x9fcb('0x1d')](function(_0x428209){_0x2d7cdc[_0x9fcb('0x19')]=_0x428209;if(_0x21c3d7['query'][_0x9fcb('0x4a')]){_0x38405e[_0x9fcb('0x4b')]=[{'all':!![]}];}return db[_0x9fcb('0x3b')]['findAll'](_0x38405e);})[_0x9fcb('0x1d')](function(_0x3fb6a1){_0x2d7cdc[_0x9fcb('0x4c')]=_0x3fb6a1;return _0x2d7cdc;});}})[_0x9fcb('0x1d')](respondWithFilteredResult(_0x381c9e,_0x38405e))[_0x9fcb('0x2c')](handleError(_0x381c9e,null));};exports['addTags']=function(_0x17fc91,_0x598413){return db[_0x9fcb('0x24')][_0x9fcb('0x37')]({'where':{'id':_0x17fc91[_0x9fcb('0x2e')]['id']}})[_0x9fcb('0x1d')](handleEntityNotFound(_0x598413,null))[_0x9fcb('0x1d')](function(_0x47cb49){if(_0x47cb49){return _0x47cb49['setTags'](_0x17fc91[_0x9fcb('0x38')]['ids'],_[_0x9fcb('0x3c')](_0x17fc91[_0x9fcb('0x38')],['ids','id'])||{})['spread'](function(){return db[_0x9fcb('0x4d')][_0x9fcb('0x28')]({'attributes':['id','name',_0x9fcb('0x4e')],'where':{'id':_0x17fc91[_0x9fcb('0x38')][_0x9fcb('0x4f')]}});})['then'](function(_0x5876cd){socket[_0x9fcb('0x50')](_0x9fcb('0x51'),{'id':Number(_0x17fc91['params']['id']),'tags':_0x5876cd||[]});return{'id':Number(_0x17fc91['params']['id']),'tags':_0x5876cd||[]};});}})[_0x9fcb('0x1d')](respondWithResult(_0x598413,null))[_0x9fcb('0x2c')](handleError(_0x598413,null));};exports[_0x9fcb('0x52')]=function(_0x2e14db,_0x39f386){return db[_0x9fcb('0x24')]['find']({'where':{'id':_0x2e14db[_0x9fcb('0x2e')]['id']}})['then'](handleEntityNotFound(_0x39f386,null))['then'](function(_0x28e714){if(_0x28e714){return _0x28e714[_0x9fcb('0x52')](_0x2e14db[_0x9fcb('0x2a')]['ids']);}})[_0x9fcb('0x1d')](respondWithStatusCode(_0x39f386,null))['catch'](handleError(_0x39f386,null));};exports[_0x9fcb('0x53')]=function(_0xdae167,_0x3a48b4){var _0x1e402d=moment()[_0x9fcb('0x54')]()['toString']();var _0x1cfcb8=path[_0x9fcb('0x55')](config[_0x9fcb('0x56')],_0x9fcb('0x57'),'files',_0x9fcb('0x58'));var _0x457492=path['join'](config['root'],_0x9fcb('0x57'),_0x9fcb('0x59'),'attachments');var _0x3069f8=path[_0x9fcb('0x55')](_0x1cfcb8,_0x1e402d);var _0x7467a=util['format']('transcript-%d-%s.zip',_0xdae167[_0x9fcb('0x2e')]['id'],_0x1e402d);var _0x1ed393=path[_0x9fcb('0x55')](_0x1cfcb8,_0x7467a);var _0x404bfe=[];_0x404bfe[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x5b')],'as':_0x9fcb('0x5b'),'attributes':['id',_0x9fcb('0x5c')],'raw':!![]});_0x404bfe[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x5d')],'as':_0x9fcb('0x5e'),'attributes':['id',_0x9fcb('0x5f'),_0x9fcb('0x60')],'raw':!![]});if(_0xdae167['query'][_0x9fcb('0x61')]){_0x404bfe[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x62')],'as':_0x9fcb('0x62'),'raw':!![]});}var _0xd09bf3=[{'model':db[_0x9fcb('0x3b')],'as':_0x9fcb('0x63'),'attributes':['id',_0x9fcb('0x38'),'createdAt',_0x9fcb('0x64'),_0x9fcb('0x65'),_0x9fcb('0x66')],'include':_0x404bfe}];_0xd09bf3[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x67')],'as':_0x9fcb('0x68'),'attributes':['id',_0x9fcb('0x21')]});_0xd09bf3[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x5b')],'as':'Owner','attributes':['id',_0x9fcb('0x5c')]});return db['WhatsappInteraction'][_0x9fcb('0x37')]({'where':{'id':_0xdae167[_0x9fcb('0x2e')]['id']},'include':_0xd09bf3})[_0x9fcb('0x1d')](handleEntityNotFound(_0x3a48b4,null))[_0x9fcb('0x1d')](function(_0x506ba1){if(_0x506ba1){var _0x287a45=_0x506ba1[_0x9fcb('0x69')]({'plain':!![]});fs[_0x9fcb('0x6a')](_0x3069f8);var _0x1af7ef={'channel':_0x9fcb('0x6b'),'account':_0x287a45[_0x9fcb('0x68')][_0x9fcb('0x21')],'agent':_0x287a45[_0x9fcb('0x6c')]?_0x287a45[_0x9fcb('0x6c')][_0x9fcb('0x5c')]:'N.A.','createdAt':moment(_0x287a45['createdAt'])['format'](_0x9fcb('0x48'))[_0x9fcb('0x6d')](),'closedAt':_0x287a45['closed']?moment(_0x287a45['closedAt'])['format'](_0x9fcb('0x48'))['toString']():'','disposition':_0x287a45[_0x9fcb('0x6e')],'messages':_(_0x287a45['Messages'])[_0x9fcb('0x44')]({'secret':![]})[_0x9fcb('0x23')](function(_0x5d4c8d){if(_0x5d4c8d[_0x9fcb('0x62')]){var _0x324098=path[_0x9fcb('0x55')](_0x457492,_0x5d4c8d[_0x9fcb('0x62')][_0x9fcb('0x6f')]);if(fs[_0x9fcb('0x70')](_0x324098)){fs[_0x9fcb('0x71')](_0x324098)[_0x9fcb('0x72')](fs['createWriteStream'](path[_0x9fcb('0x55')](_0x3069f8,_0x5d4c8d[_0x9fcb('0x62')][_0x9fcb('0x6f')])));}}return{'date':moment(_0x5d4c8d['createdAt'])[_0x9fcb('0x47')](_0x9fcb('0x48'))[_0x9fcb('0x6d')](),'sender':_0x5d4c8d[_0x9fcb('0x64')]===_0x9fcb('0x73')?_0x5d4c8d[_0x9fcb('0x5b')]?_0x5d4c8d['User'][_0x9fcb('0x5c')]:_0x9fcb('0x74'):_0x5d4c8d['Contact'][_0x9fcb('0x5f')]+(_0x5d4c8d[_0x9fcb('0x5e')][_0x9fcb('0x60')]?'\x20'+_0x5d4c8d[_0x9fcb('0x5e')][_0x9fcb('0x60')]:''),'body':_0x5d4c8d[_0x9fcb('0x62')]?_0x5d4c8d['Attachment'][_0x9fcb('0x6f')]:_0x5d4c8d[_0x9fcb('0x38')],'direction':_0x5d4c8d[_0x9fcb('0x64')]==='out'?'A':'C','secret':_0x5d4c8d['secret'],'read':_0x5d4c8d[_0x9fcb('0x66')],'attachment':_0x5d4c8d['Attachment']};})[_0x9fcb('0x75')]()};return ejs['renderFile'](path[_0x9fcb('0x55')](config[_0x9fcb('0x56')],_0x9fcb('0x57'),_0x9fcb('0x76'),_0x9fcb('0x77')),{'interaction':_0x1af7ef})['then'](function(_0x1389ba){var _0x763db0=path[_0x9fcb('0x55')](_0x3069f8,_0x9fcb('0x78')+_0x287a45['id']+'-'+_0x1e402d+'.pdf');var _0x47a932={'path':_0x763db0,'channel':_0x9fcb('0x6b'),'interactionId':_0x287a45['id']};return pdf[_0x9fcb('0x79')](_0x1389ba,_0x47a932);})['then'](function(){return new BPromise(function(_0x285c96,_0x90059d){zipdir(_0x3069f8,{'saveTo':_0x1ed393},function(_0x41fc9e,_0x5bf21d){if(_0x41fc9e)return _0x90059d(_0x41fc9e);return _0x285c96(_0x5bf21d);});})[_0x9fcb('0x1d')](function(){return new BPromise(function(_0x3ec629,_0x468fba){rimraf(_0x3069f8,function(_0x401efe){if(_0x401efe)_0x468fba(_0x401efe);return _0x3ec629();});});})[_0x9fcb('0x1d')](function(){return _0x3a48b4[_0x9fcb('0x53')](_0x1ed393,_0x7467a,function(_0x2bea8b){if(_0x2bea8b){console[_0x9fcb('0x7a')](_0x9fcb('0x7b'),_0x2bea8b);}else{fs[_0x9fcb('0x7c')](_0x1ed393);}});});});}else{return _0x3a48b4['sendStatus'](0xc8);}})[_0x9fcb('0x2c')](handleError(_0x3a48b4,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 9834ec0..84aac76 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 _0xbf83=['../../mysqldb','WhatsappMessage','setMaxListeners','save','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','WhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf83,0x11e));var _0x3bf8=function(_0x1fabf2,_0x335418){_0x1fabf2=_0x1fabf2-0x0;var _0x3acb8f=_0xbf83[_0x1fabf2];return _0x3acb8f;};'use strict';var EventEmitter=require(_0x3bf8('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x3bf8('0x1')];var WhatsappMessage=require(_0x3bf8('0x2'))['db'][_0x3bf8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3bf8('0x4')](0x0);var events={'afterCreate':_0x3bf8('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x459aef){return function(_0x2f9c37,_0x18a698,_0x251445){_0x2f9c37['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x168a20){_0x2f9c37[_0x3bf8('0x6')]('Users',_0x168a20[_0x3bf8('0x7')](function(_0x538bec){return{'id':_0x538bec['id']};}));return WhatsappMessage[_0x3bf8('0x8')]({'where':{'WhatsappInteractionId':_0x2f9c37['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3bf8('0x9')](function(_0x1e36df){_0x2f9c37[_0x3bf8('0x6')](_0x3bf8('0xa'),_0x1e36df[_0x3bf8('0xb')]);WhatsappInteractionEvents[_0x3bf8('0xc')](_0x459aef+':'+_0x2f9c37['id'],_0x2f9c37);WhatsappInteractionEvents['emit'](_0x459aef,_0x2f9c37);_0x251445(null);})[_0x3bf8('0xd')](_0x251445(null));};}for(var e in events){if(events[_0x3bf8('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x3bf8('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xefe3=['unreadMessages','length','emit','hook','exports','events','WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x3aa5f5,_0x55d7d7){var _0x399bc9=function(_0x233dd1){while(--_0x233dd1){_0x3aa5f5['push'](_0x3aa5f5['shift']());}};_0x399bc9(++_0x55d7d7);}(_0xefe3,0xf5));var _0x3efe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xefe3[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x3efe('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x3efe('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3efe('0x2')](0x0);var events={'afterCreate':_0x3efe('0x3'),'afterUpdate':_0x3efe('0x4'),'afterDestroy':'remove'};function emitEvent(_0x11125f){return function(_0x58e1bb,_0x89aaa1,_0x4b5006){_0x58e1bb[_0x3efe('0x5')]({'attributes':['id'],'raw':!![]})[_0x3efe('0x6')](function(_0x1f697b){_0x58e1bb[_0x3efe('0x7')](_0x3efe('0x8'),_0x1f697b[_0x3efe('0x9')](function(_0x4b9766){return{'id':_0x4b9766['id']};}));return WhatsappMessage[_0x3efe('0xa')]({'where':{'WhatsappInteractionId':_0x58e1bb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1edce8){_0x58e1bb[_0x3efe('0x7')](_0x3efe('0xb'),_0x1edce8[_0x3efe('0xc')]);WhatsappInteractionEvents[_0x3efe('0xd')](_0x11125f+':'+_0x58e1bb['id'],_0x58e1bb);WhatsappInteractionEvents[_0x3efe('0xd')](_0x11125f,_0x58e1bb);_0x4b5006(null);})['catch'](_0x4b5006(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x3efe('0xe')](e,emitEvent(event));}}module[_0x3efe('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 158fd47..b6b9259 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 _0x4105=['request-promise','path','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','bluebird'];(function(_0xc75d2f,_0x183b3b){var _0x65af36=function(_0x219d13){while(--_0x219d13){_0xc75d2f['push'](_0xc75d2f['shift']());}};_0x65af36(++_0x183b3b);}(_0x4105,0xda));var _0x5410=function(_0x7213b4,_0x391106){_0x7213b4=_0x7213b4-0x0;var _0x54dc97=_0x4105[_0x7213b4];return _0x54dc97;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5410('0x0'))(_0x5410('0x1'));var moment=require('moment');var BPromise=require(_0x5410('0x2'));var rp=require(_0x5410('0x3'));var fs=require('fs');var path=require(_0x5410('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5410('0x5'));module['exports']=function(_0xc3b333,_0x386d52){return _0xc3b333[_0x5410('0x6')]('WhatsappInteraction',attributes,{'tableName':_0x5410('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x411541,_0x125489,_0x1402af){if(_0x411541[_0x5410('0x8')](_0x5410('0x9'))){_0x411541[_0x5410('0xa')]=moment()[_0x5410('0xb')](_0x5410('0xc'));}_0x1402af(null,_0x411541);}}});}; \ No newline at end of file +var _0xa92a=['lodash','api','moment','bluebird','path','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa92a,0x1c7));var _0xaa92=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0xa92a[_0xe8129c];return _0x709fc5;};'use strict';var _=require(_0xaa92('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa92('0x1'));var moment=require(_0xaa92('0x2'));var BPromise=require(_0xaa92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa92('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x18bbf3,_0x321a7e){return _0x18bbf3[_0xaa92('0x5')](_0xaa92('0x6'),attributes,{'tableName':_0xaa92('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fa9df,_0x5a930e,_0x1fc54b){if(_0x2fa9df[_0xaa92('0x8')](_0xaa92('0x9'))){_0x2fa9df[_0xaa92('0xa')]=moment()[_0xaa92('0xb')](_0xaa92('0xc'));}_0x1fc54b(null,_0x2fa9df);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 6ddff27..024f5fe 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 _0x0d03=['WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','limit','AddTagsToWhatsappInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','debug','request\x20sent','stringify','error'];(function(_0x1dce05,_0x3d43f7){var _0x3dabb1=function(_0x415a5b){while(--_0x415a5b){_0x1dce05['push'](_0x1dce05['shift']());}};_0x3dabb1(++_0x3d43f7);}(_0x0d03,0x1c8));var _0x30d0=function(_0x17e546,_0x5b000b){_0x17e546=_0x17e546-0x0;var _0x5ec43c=_0x0d03[_0x17e546];return _0x5ec43c;};'use strict';var _=require(_0x30d0('0x0'));var util=require(_0x30d0('0x1'));var moment=require(_0x30d0('0x2'));var BPromise=require(_0x30d0('0x3'));var rs=require(_0x30d0('0x4'));var fs=require('fs');var Redis=require(_0x30d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x30d0('0x6'))(_0x30d0('0x7'));var config=require(_0x30d0('0x8'));var jayson=require(_0x30d0('0x9'));var client=jayson['client'][_0x30d0('0xa')]({'port':0x232a});config[_0x30d0('0xb')]=_[_0x30d0('0xc')](config['redis'],{'host':_0x30d0('0xd'),'port':0x18eb});var socket=require(_0x30d0('0xe'))(new Redis(config[_0x30d0('0xb')]));require(_0x30d0('0xf'))[_0x30d0('0x10')](socket);function respondWithRpcPromise(_0x1d3dfd,_0x5de6ca,_0x503b78){return new BPromise(function(_0xfebf84,_0x2d81c7){return client[_0x30d0('0x11')](_0x1d3dfd,_0x503b78)[_0x30d0('0x12')](function(_0x49da0c){logger[_0x30d0('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x5de6ca,'request\x20sent');logger[_0x30d0('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5de6ca,_0x30d0('0x15'),JSON[_0x30d0('0x16')](_0x49da0c));if(_0x49da0c[_0x30d0('0x17')]){if(_0x49da0c[_0x30d0('0x17')]['code']===0x1f4){logger[_0x30d0('0x17')](_0x30d0('0x18'),_0x5de6ca,_0x49da0c['error'][_0x30d0('0x19')]);return _0x2d81c7(_0x49da0c[_0x30d0('0x17')]['message']);}logger[_0x30d0('0x17')](_0x30d0('0x18'),_0x5de6ca,_0x49da0c[_0x30d0('0x17')][_0x30d0('0x19')]);return _0xfebf84(_0x49da0c[_0x30d0('0x17')][_0x30d0('0x19')]);}else{logger[_0x30d0('0x13')](_0x30d0('0x18'),_0x5de6ca,'request\x20sent');_0xfebf84(_0x49da0c['result']['message']);}})[_0x30d0('0x1a')](function(_0x458a66){logger[_0x30d0('0x17')](_0x30d0('0x18'),_0x5de6ca,_0x458a66);_0x2d81c7(_0x458a66);});});}exports[_0x30d0('0x1b')]=function(_0x53bd6a){var _0x387bb9=this;return new Promise(function(_0x1df62d,_0x4ad146){return db[_0x30d0('0x1c')]['update'](_0x53bd6a[_0x30d0('0x1d')],{'raw':_0x53bd6a[_0x30d0('0x1e')]?_0x53bd6a[_0x30d0('0x1e')][_0x30d0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53bd6a[_0x30d0('0x1e')]?_0x53bd6a[_0x30d0('0x1e')]['where']||null:null,'attributes':_0x53bd6a['options']?_0x53bd6a['options']['attributes']||null:null,'limit':_0x53bd6a[_0x30d0('0x1e')]?_0x53bd6a[_0x30d0('0x1e')][_0x30d0('0x20')]||null:null})[_0x30d0('0x12')](function(_0x51df4f){logger[_0x30d0('0x13')](_0x30d0('0x1b'),_0x53bd6a);logger[_0x30d0('0x14')](_0x30d0('0x1b'),_0x53bd6a,JSON[_0x30d0('0x16')](_0x51df4f));_0x1df62d(_0x51df4f);})[_0x30d0('0x1a')](function(_0x16f44d){logger[_0x30d0('0x17')]('UpdateWhatsappInteraction',_0x16f44d[_0x30d0('0x19')],_0x53bd6a);_0x4ad146(_0x387bb9['error'](0x1f4,_0x16f44d['message']));});});};exports[_0x30d0('0x21')]=function(_0x405b2a){return new Promise(function(_0x1f0885,_0x57c4ff){return db['WhatsappInteraction']['find']({'where':_0x405b2a[_0x30d0('0x1e')]?_0x405b2a['options'][_0x30d0('0x22')]||null:null})['then'](function(_0x1b939a){if(_0x1b939a){return _0x1b939a[_0x30d0('0x23')](_0x405b2a['body'][_0x30d0('0x24')],_[_0x30d0('0x25')](_0x405b2a[_0x30d0('0x1d')],[_0x30d0('0x24'),'id'])||{});}})[_0x30d0('0x26')](function(_0x163824){logger[_0x30d0('0x13')](_0x30d0('0x27'),_0x405b2a);logger[_0x30d0('0x14')]('AddTags',_0x405b2a,JSON[_0x30d0('0x16')](_0x163824));_0x1f0885(_0x163824);})['catch'](function(_0xf88653){logger[_0x30d0('0x17')]('AddTags',_0xf88653['message'],_0x405b2a);_0x57c4ff(_this[_0x30d0('0x17')](0x1f4,_0xf88653[_0x30d0('0x19')]));});});}; \ No newline at end of file +var _0xc281=['WhatsappInteraction','update','body','options','raw','where','attributes','debug','catch','find','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateWhatsappInteraction'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0xc281,0x17f));var _0x1c28=function(_0x12e747,_0x33ab29){_0x12e747=_0x12e747-0x0;var _0x54adb6=_0xc281[_0x12e747];return _0x54adb6;};'use strict';var _=require(_0x1c28('0x0'));var util=require(_0x1c28('0x1'));var moment=require(_0x1c28('0x2'));var BPromise=require(_0x1c28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c28('0x4'));var db=require(_0x1c28('0x5'))['db'];var utils=require(_0x1c28('0x6'));var logger=require(_0x1c28('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1c28('0x8'));var client=jayson[_0x1c28('0x9')][_0x1c28('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1c28('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c28('0xc'))(new Redis(config[_0x1c28('0xb')]));require(_0x1c28('0xd'))[_0x1c28('0xe')](socket);function respondWithRpcPromise(_0x11ebbd,_0x42c0a9,_0x202cf9){return new BPromise(function(_0x1d8ad4,_0x57d2de){return client[_0x1c28('0xf')](_0x11ebbd,_0x202cf9)[_0x1c28('0x10')](function(_0x5b1f8c){logger[_0x1c28('0x11')](_0x1c28('0x12'),_0x42c0a9,'request\x20sent');logger['debug'](_0x1c28('0x13'),_0x42c0a9,'request\x20sent',JSON[_0x1c28('0x14')](_0x5b1f8c));if(_0x5b1f8c[_0x1c28('0x15')]){if(_0x5b1f8c[_0x1c28('0x15')][_0x1c28('0x16')]===0x1f4){logger[_0x1c28('0x15')](_0x1c28('0x12'),_0x42c0a9,_0x5b1f8c[_0x1c28('0x15')][_0x1c28('0x17')]);return _0x57d2de(_0x5b1f8c[_0x1c28('0x15')][_0x1c28('0x17')]);}logger[_0x1c28('0x15')](_0x1c28('0x12'),_0x42c0a9,_0x5b1f8c[_0x1c28('0x15')][_0x1c28('0x17')]);return _0x1d8ad4(_0x5b1f8c[_0x1c28('0x15')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x42c0a9,_0x1c28('0x18'));_0x1d8ad4(_0x5b1f8c[_0x1c28('0x19')][_0x1c28('0x17')]);}})['catch'](function(_0x2b4ee1){logger[_0x1c28('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x42c0a9,_0x2b4ee1);_0x57d2de(_0x2b4ee1);});});}exports[_0x1c28('0x1a')]=function(_0x194d03){var _0x5bb6a6=this;return new Promise(function(_0x174c07,_0x1b9204){return db[_0x1c28('0x1b')][_0x1c28('0x1c')](_0x194d03[_0x1c28('0x1d')],{'raw':_0x194d03[_0x1c28('0x1e')]?_0x194d03[_0x1c28('0x1e')][_0x1c28('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x194d03[_0x1c28('0x1e')]?_0x194d03[_0x1c28('0x1e')][_0x1c28('0x20')]||null:null,'attributes':_0x194d03['options']?_0x194d03[_0x1c28('0x1e')][_0x1c28('0x21')]||null:null,'limit':_0x194d03[_0x1c28('0x1e')]?_0x194d03['options']['limit']||null:null})[_0x1c28('0x10')](function(_0x53105c){logger[_0x1c28('0x11')](_0x1c28('0x1a'),_0x194d03);logger[_0x1c28('0x22')](_0x1c28('0x1a'),_0x194d03,JSON[_0x1c28('0x14')](_0x53105c));_0x174c07(_0x53105c);})[_0x1c28('0x23')](function(_0x44b68d){logger[_0x1c28('0x15')](_0x1c28('0x1a'),_0x44b68d[_0x1c28('0x17')],_0x194d03);_0x1b9204(_0x5bb6a6[_0x1c28('0x15')](0x1f4,_0x44b68d[_0x1c28('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x5a4bb3){return new Promise(function(_0x1888e1,_0x5b99a3){return db[_0x1c28('0x1b')][_0x1c28('0x24')]({'where':_0x5a4bb3[_0x1c28('0x1e')]?_0x5a4bb3['options'][_0x1c28('0x20')]||null:null})[_0x1c28('0x10')](function(_0x2f76ae){if(_0x2f76ae){return _0x2f76ae[_0x1c28('0x25')](_0x5a4bb3[_0x1c28('0x1d')]['ids'],_[_0x1c28('0x26')](_0x5a4bb3['body'],['ids','id'])||{});}})[_0x1c28('0x27')](function(_0x2e9a19){logger['info'](_0x1c28('0x28'),_0x5a4bb3);logger[_0x1c28('0x22')]('AddTags',_0x5a4bb3,JSON[_0x1c28('0x14')](_0x2e9a19));_0x1888e1(_0x2e9a19);})['catch'](function(_0x326691){logger['error'](_0x1c28('0x28'),_0x326691[_0x1c28('0x17')],_0x5a4bb3);_0x5b99a3(_this['error'](0x1f4,_0x326691[_0x1c28('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 76b15e5..1e9e447 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 _0xdcd3=['length','whatsappInteraction:','./whatsappInteraction.events','save','update','removeListener','register'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xdcd3,0xa3));var _0x3dcd=function(_0xc073d4,_0x1ecb13){_0xc073d4=_0xc073d4-0x0;var _0x24850a=_0xdcd3[_0xc073d4];return _0x24850a;};'use strict';var WhatsappInteractionEvents=require(_0x3dcd('0x0'));var events=[_0x3dcd('0x1'),'remove',_0x3dcd('0x2')];function createListener(_0x261f6e,_0x28a9d8){return function(_0x5de46d){_0x28a9d8['emit'](_0x261f6e,_0x5de46d);};}function removeListener(_0x476ec2,_0x696f9d){return function(){WhatsappInteractionEvents[_0x3dcd('0x3')](_0x476ec2,_0x696f9d);};}exports[_0x3dcd('0x4')]=function(_0x36b623){for(var _0x35a1e8=0x0,_0x3aee8e=events[_0x3dcd('0x5')];_0x35a1e8<_0x3aee8e;_0x35a1e8++){var _0x25a6ca=events[_0x35a1e8];var _0x2ca700=createListener(_0x3dcd('0x6')+_0x25a6ca,_0x36b623);WhatsappInteractionEvents['on'](_0x25a6ca,_0x2ca700);}}; \ No newline at end of file +var _0x2fba=['./whatsappInteraction.events','save','remove','removeListener','register','length','whatsappInteraction:'];(function(_0x2641cb,_0x290c82){var _0x5bd87c=function(_0x38149f){while(--_0x38149f){_0x2641cb['push'](_0x2641cb['shift']());}};_0x5bd87c(++_0x290c82);}(_0x2fba,0xa1));var _0xa2fb=function(_0x4d4298,_0xa728df){_0x4d4298=_0x4d4298-0x0;var _0x2f8aa2=_0x2fba[_0x4d4298];return _0x2f8aa2;};'use strict';var WhatsappInteractionEvents=require(_0xa2fb('0x0'));var events=[_0xa2fb('0x1'),_0xa2fb('0x2'),'update'];function createListener(_0x4f546f,_0x3c4518){return function(_0x8cf074){_0x3c4518['emit'](_0x4f546f,_0x8cf074);};}function removeListener(_0x426ee4,_0x4610a2){return function(){WhatsappInteractionEvents[_0xa2fb('0x3')](_0x426ee4,_0x4610a2);};}exports[_0xa2fb('0x4')]=function(_0x14f5cf){for(var _0x31218c=0x0,_0x1a8de7=events[_0xa2fb('0x5')];_0x31218c<_0x1a8de7;_0x31218c++){var _0x21fd83=events[_0x31218c];var _0x1194fa=createListener(_0xa2fb('0x6')+_0x21fd83,_0x14f5cf);WhatsappInteractionEvents['on'](_0x21fd83,_0x1194fa);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 6a619ee..9d0e3ac 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 _0x6518=['./whatsappMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x573815,_0x1428a7){var _0x5ec4d2=function(_0x1f99e4){while(--_0x1f99e4){_0x573815['push'](_0x573815['shift']());}};_0x5ec4d2(++_0x1428a7);}(_0x6518,0x154));var _0x8651=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x6518[_0x2c0dc0];return _0x4c0990;};'use strict';var multer=require(_0x8651('0x0'));var util=require(_0x8651('0x1'));var path=require(_0x8651('0x2'));var timeout=require('connect-timeout');var express=require(_0x8651('0x3'));var router=express[_0x8651('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8651('0x5'));var interaction=require(_0x8651('0x6'));var config=require(_0x8651('0x7'));var controller=require(_0x8651('0x8'));router['get']('/',auth[_0x8651('0x9')](),controller[_0x8651('0xa')]);router['get'](_0x8651('0xb'),auth[_0x8651('0x9')](),controller[_0x8651('0xc')]);router[_0x8651('0xd')](_0x8651('0xe'),auth['isAuthenticated'](),controller[_0x8651('0xf')]);router[_0x8651('0x10')]('/',auth['isAuthenticated'](),interaction[_0x8651('0x11')](_0x8651('0x12'),_0x8651('0x13')),controller[_0x8651('0x14')]);router[_0x8651('0x10')]('/:id/status',controller[_0x8651('0x15')]);router[_0x8651('0x16')](_0x8651('0xe'),auth[_0x8651('0x9')](),controller[_0x8651('0x17')]);router[_0x8651('0x16')](_0x8651('0x18'),auth[_0x8651('0x9')](),controller[_0x8651('0x19')]);router[_0x8651('0x16')](_0x8651('0x1a'),auth[_0x8651('0x9')](),controller[_0x8651('0x1b')]);router[_0x8651('0x1c')](_0x8651('0xe'),auth[_0x8651('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8d1b=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','post','whatsapp','/:id/status','put','update'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x8d1b,0x18f));var _0xb8d1=function(_0x1f529b,_0x53d52c){_0x1f529b=_0x1f529b-0x0;var _0x34e01f=_0x8d1b[_0x1f529b];return _0x34e01f;};'use strict';var multer=require(_0xb8d1('0x0'));var util=require(_0xb8d1('0x1'));var path=require(_0xb8d1('0x2'));var timeout=require(_0xb8d1('0x3'));var express=require('express');var router=express[_0xb8d1('0x4')]();var fs_extra=require(_0xb8d1('0x5'));var auth=require(_0xb8d1('0x6'));var interaction=require(_0xb8d1('0x7'));var config=require(_0xb8d1('0x8'));var controller=require(_0xb8d1('0x9'));router['get']('/',auth[_0xb8d1('0xa')](),controller['index']);router[_0xb8d1('0xb')](_0xb8d1('0xc'),auth['isAuthenticated'](),controller[_0xb8d1('0xd')]);router[_0xb8d1('0xb')](_0xb8d1('0xe'),auth[_0xb8d1('0xa')](),controller[_0xb8d1('0xf')]);router[_0xb8d1('0x10')]('/',auth[_0xb8d1('0xa')](),interaction['tracked'](_0xb8d1('0x11'),'whatsappmessage:create'),controller['create']);router[_0xb8d1('0x10')](_0xb8d1('0x12'),controller['status']);router[_0xb8d1('0x13')](_0xb8d1('0xe'),auth[_0xb8d1('0xa')](),controller[_0xb8d1('0x14')]);router[_0xb8d1('0x13')](_0xb8d1('0x15'),auth[_0xb8d1('0xa')](),controller[_0xb8d1('0x16')]);router[_0xb8d1('0x13')](_0xb8d1('0x17'),auth[_0xb8d1('0xa')](),controller[_0xb8d1('0x18')]);router[_0xb8d1('0x19')]('/:id',auth[_0xb8d1('0xa')](),controller[_0xb8d1('0x1a')]);module[_0xb8d1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b86f18f..f6c4ce1 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 _0x951c=['BOOLEAN','ENUM','out','STRING','DATE','exports','TEXT','medium'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0x951c,0x13d));var _0xc951=function(_0x5eb12d,_0x1ce90f){_0x5eb12d=_0x5eb12d-0x0;var _0x295852=_0x951c[_0x5eb12d];return _0x295852;};'use strict';var Sequelize=require('sequelize');module[_0xc951('0x0')]={'body':{'type':Sequelize[_0xc951('0x1')](_0xc951('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc951('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc951('0x4')]('in','out'),'defaultValue':_0xc951('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc951('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc951('0x6')]},'readAt':{'type':Sequelize[_0xc951('0x7')]},'secret':{'type':Sequelize[_0xc951('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc951('0x6')]},'providerResponse':{'type':Sequelize[_0xc951('0x1')]}}; \ No newline at end of file +var _0x7dfd=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x25b5c1,_0x15f706){var _0x15cb0d=function(_0x269d4e){while(--_0x269d4e){_0x25b5c1['push'](_0x25b5c1['shift']());}};_0x15cb0d(++_0x15f706);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'body':{'type':Sequelize[_0xd7df('0x2')](_0xd7df('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd7df('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd7df('0x5')]('in',_0xd7df('0x6')),'defaultValue':_0xd7df('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd7df('0x7')](0xbe)},'phone':{'type':Sequelize[_0xd7df('0x7')]},'readAt':{'type':Sequelize[_0xd7df('0x8')]},'secret':{'type':Sequelize[_0xd7df('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd7df('0x7')]},'providerResponse':{'type':Sequelize[_0xd7df('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index abf2cc5..784ee72 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 _0x3b39=['received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','http','client','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','pick','merge','VIRTUAL','filter','options','WhatsappMessage','findAll','rows','show','params','length','includeAll','include','create','body','find','describe','../../config/logger','whatsapp-interactions','whatsapp','read','readAt','format','UserId','user','agent','WhatsappInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','event','accept','EventManager','acceptmessage','info','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','interface','motionChannel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5253c2,_0xbc3136){var _0xfbd13f=function(_0x1da932){while(--_0x1da932){_0x5253c2['push'](_0x5253c2['shift']());}};_0xfbd13f(++_0xbc3136);}(_0x3b39,0x121));var _0x93b3=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0x3b39[_0x1d211b];return _0x47c88b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93b3('0x0'));var zipdir=require(_0x93b3('0x1'));var jsonpatch=require(_0x93b3('0x2'));var rp=require('request-promise');var moment=require(_0x93b3('0x3'));var BPromise=require(_0x93b3('0x4'));var Mustache=require(_0x93b3('0x5'));var util=require(_0x93b3('0x6'));var path=require(_0x93b3('0x7'));var sox=require('sox');var csv=require(_0x93b3('0x8'));var ejs=require(_0x93b3('0x9'));var fs=require('fs');var fs_extra=require(_0x93b3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x93b3('0xb'));var jsforce=require(_0x93b3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x93b3('0xd'));var Papa=require(_0x93b3('0xe'));var Redis=require(_0x93b3('0xf'));var authService=require(_0x93b3('0x10'));var qs=require(_0x93b3('0x11'));var as=require(_0x93b3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x93b3('0x13'));var utils=require(_0x93b3('0x14'));var config=require(_0x93b3('0x15'));var licenseUtil=require(_0x93b3('0x16'));var db=require(_0x93b3('0x17'))['db'];config[_0x93b3('0x18')]=_[_0x93b3('0x19')](config[_0x93b3('0x18')],{'host':_0x93b3('0x1a'),'port':0x18eb});var socket=require(_0x93b3('0x1b'))(new Redis(config[_0x93b3('0x18')]));require(_0x93b3('0x1c'))['register'](socket);var jayson=require(_0x93b3('0x1d'));var client=jayson['client'][_0x93b3('0x1e')]({'port':0x232c});var client9002=jayson[_0x93b3('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd0f495,_0x43e94b,_0x455fe9,_0x4dd91f){return new BPromise(function(_0x4c3a9a,_0x17cf7e){var _0x44cf8a=_0x4dd91f||client;return _0x44cf8a[_0x93b3('0x20')](_0xd0f495,_0x455fe9)[_0x93b3('0x21')](function(_0x47c36d){logger['info'](_0x93b3('0x22'),_0x43e94b,_0x93b3('0x23'));logger[_0x93b3('0x24')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x43e94b,_0x93b3('0x23'),JSON[_0x93b3('0x25')](_0x47c36d));if(_0x47c36d[_0x93b3('0x26')]){if(_0x47c36d[_0x93b3('0x26')][_0x93b3('0x27')]===0x1f4){logger[_0x93b3('0x26')](_0x93b3('0x22'),_0x43e94b,_0x47c36d[_0x93b3('0x26')][_0x93b3('0x28')]);return _0x17cf7e(_0x47c36d[_0x93b3('0x26')][_0x93b3('0x28')]);}logger[_0x93b3('0x26')](_0x93b3('0x22'),_0x43e94b,_0x47c36d[_0x93b3('0x26')]['message']);return _0x4c3a9a(_0x47c36d[_0x93b3('0x26')][_0x93b3('0x28')]);}else{logger['info'](_0x93b3('0x22'),_0x43e94b,_0x93b3('0x23'));_0x4c3a9a(_0x47c36d[_0x93b3('0x29')]['message']);}})[_0x93b3('0x2a')](function(_0x5230c1){logger[_0x93b3('0x26')](_0x93b3('0x22'),_0x43e94b,_0x5230c1);_0x17cf7e(_0x5230c1);});});}function respondWithStatusCode(_0x4720cf,_0x3ce14e){_0x3ce14e=_0x3ce14e||0xcc;return function(_0xc88e1d){if(_0xc88e1d){return _0x4720cf[_0x93b3('0x2b')](_0x3ce14e);}return _0x4720cf[_0x93b3('0x2c')](_0x3ce14e)[_0x93b3('0x2d')]();};}function respondWithResult(_0x17d2e8,_0x4876a6){_0x4876a6=_0x4876a6||0xc8;return function(_0x30b4b0){if(_0x30b4b0){return _0x17d2e8[_0x93b3('0x2c')](_0x4876a6)[_0x93b3('0x2e')](_0x30b4b0);}};}function respondWithFilteredResult(_0x2562ba,_0x7f5d8d){return function(_0x57ccb1){if(_0x57ccb1){var _0x3738e1=typeof _0x7f5d8d[_0x93b3('0x2f')]===_0x93b3('0x30')&&typeof _0x7f5d8d[_0x93b3('0x31')]===_0x93b3('0x30');var _0xf8afa3=_0x57ccb1[_0x93b3('0x32')];var _0x67d61f=_0x3738e1?0x0:_0x7f5d8d['offset'];var _0x1c0a10=_0x3738e1?_0x57ccb1[_0x93b3('0x32')]:_0x7f5d8d[_0x93b3('0x2f')]+_0x7f5d8d[_0x93b3('0x31')];var _0x59a898;if(_0x1c0a10>=_0xf8afa3){_0x1c0a10=_0xf8afa3;_0x59a898=0xc8;}else{_0x59a898=0xce;}_0x2562ba[_0x93b3('0x2c')](_0x59a898);return _0x2562ba['set'](_0x93b3('0x33'),_0x67d61f+'-'+_0x1c0a10+'/'+_0xf8afa3)[_0x93b3('0x2e')](_0x57ccb1);}return null;};}function patchUpdates(_0x28dede){return function(_0x5e41b7){try{jsonpatch[_0x93b3('0x34')](_0x5e41b7,_0x28dede,!![]);}catch(_0x18d9ed){return BPromise[_0x93b3('0x35')](_0x18d9ed);}return _0x5e41b7[_0x93b3('0x36')]();};}function saveUpdates(_0x176c5a,_0x211217){return function(_0x202fbf){if(_0x202fbf){return _0x202fbf[_0x93b3('0x37')](_0x176c5a)['then'](function(_0x2e88c3){return _0x2e88c3;});}return null;};}function removeEntity(_0x2be725,_0x220e4f){return function(_0x4000e6){if(_0x4000e6){return _0x4000e6[_0x93b3('0x38')]()[_0x93b3('0x21')](function(){_0x2be725[_0x93b3('0x2c')](0xcc)[_0x93b3('0x2d')]();});}};}function handleEntityNotFound(_0xbc3361,_0x6b1328){return function(_0x3becc8){if(!_0x3becc8){_0xbc3361[_0x93b3('0x2b')](0x194);}return _0x3becc8;};}function handleError(_0x3c0f6d,_0x57ea87){_0x57ea87=_0x57ea87||0x1f4;return function(_0x2f5b37){logger[_0x93b3('0x26')](_0x2f5b37[_0x93b3('0x39')]);if(_0x2f5b37[_0x93b3('0x3a')]){delete _0x2f5b37[_0x93b3('0x3a')];}_0x3c0f6d[_0x93b3('0x2c')](_0x57ea87)[_0x93b3('0x3b')](_0x2f5b37);};}exports['index']=function(_0x1967a1,_0x1c1f7a){var _0x4b9b18={},_0xd289c0={},_0x224650={'count':0x0,'rows':[]};var _0x554496=_[_0x93b3('0x3c')](db['WhatsappMessage'][_0x93b3('0x3d')],function(_0x1d3249){return{'name':_0x1d3249[_0x93b3('0x3e')],'type':_0x1d3249[_0x93b3('0x3f')][_0x93b3('0x40')]};});_0xd289c0[_0x93b3('0x41')]=_['map'](_0x554496,_0x93b3('0x3a'));_0xd289c0[_0x93b3('0x42')]=_[_0x93b3('0x43')](_0x1967a1['query']);_0xd289c0[_0x93b3('0x44')]=_[_0x93b3('0x45')](_0xd289c0['model'],_0xd289c0[_0x93b3('0x42')]);_0x4b9b18[_0x93b3('0x46')]=_['intersection'](_0xd289c0[_0x93b3('0x41')],qs[_0x93b3('0x47')](_0x1967a1[_0x93b3('0x42')]['fields']));_0x4b9b18[_0x93b3('0x46')]=_0x4b9b18[_0x93b3('0x46')]['length']?_0x4b9b18[_0x93b3('0x46')]:_0xd289c0[_0x93b3('0x41')];if(!_0x1967a1[_0x93b3('0x42')]['hasOwnProperty']('nolimit')){_0x4b9b18[_0x93b3('0x31')]=qs[_0x93b3('0x31')](_0x1967a1[_0x93b3('0x42')]['limit']);_0x4b9b18[_0x93b3('0x2f')]=qs[_0x93b3('0x2f')](_0x1967a1['query']['offset']);}_0x4b9b18[_0x93b3('0x48')]=qs['sort'](_0x1967a1[_0x93b3('0x42')]['sort']);_0x4b9b18['where']=qs[_0x93b3('0x44')](_[_0x93b3('0x49')](_0x1967a1[_0x93b3('0x42')],_0xd289c0[_0x93b3('0x44')]),_0x554496);if(_0x1967a1[_0x93b3('0x42')]['filter']){_0x4b9b18['where']=_[_0x93b3('0x4a')](_0x4b9b18['where'],{'$or':_[_0x93b3('0x3c')](_0x554496,function(_0x3562ce){if(_0x3562ce[_0x93b3('0x3f')]!==_0x93b3('0x4b')){var _0x2e3f0a={};_0x2e3f0a[_0x3562ce[_0x93b3('0x3a')]]={'$like':'%'+_0x1967a1[_0x93b3('0x42')][_0x93b3('0x4c')]+'%'};return _0x2e3f0a;}})});}_0x4b9b18=_[_0x93b3('0x4a')]({},_0x4b9b18,_0x1967a1[_0x93b3('0x4d')]);var _0x342d6a={'where':_0x4b9b18['where']};return db[_0x93b3('0x4e')][_0x93b3('0x32')](_0x342d6a)[_0x93b3('0x21')](function(_0x4e3f60){_0x224650[_0x93b3('0x32')]=_0x4e3f60;if(_0x1967a1[_0x93b3('0x42')]['includeAll']){_0x4b9b18['include']=[{'all':!![]}];}return db[_0x93b3('0x4e')][_0x93b3('0x4f')](_0x4b9b18);})[_0x93b3('0x21')](function(_0x260874){_0x224650[_0x93b3('0x50')]=_0x260874;return _0x224650;})[_0x93b3('0x21')](respondWithFilteredResult(_0x1c1f7a,_0x4b9b18))['catch'](handleError(_0x1c1f7a,null));};exports[_0x93b3('0x51')]=function(_0x51d56c,_0x12269a){var _0x531bd9={'raw':!![],'where':{'id':_0x51d56c[_0x93b3('0x52')]['id']}},_0xafd9cd={};_0xafd9cd[_0x93b3('0x41')]=_[_0x93b3('0x43')](db[_0x93b3('0x4e')]['rawAttributes']);_0xafd9cd[_0x93b3('0x42')]=_[_0x93b3('0x43')](_0x51d56c['query']);_0xafd9cd[_0x93b3('0x44')]=_[_0x93b3('0x45')](_0xafd9cd[_0x93b3('0x41')],_0xafd9cd['query']);_0x531bd9[_0x93b3('0x46')]=_[_0x93b3('0x45')](_0xafd9cd[_0x93b3('0x41')],qs[_0x93b3('0x47')](_0x51d56c['query'][_0x93b3('0x47')]));_0x531bd9[_0x93b3('0x46')]=_0x531bd9[_0x93b3('0x46')][_0x93b3('0x53')]?_0x531bd9[_0x93b3('0x46')]:_0xafd9cd['model'];if(_0x51d56c[_0x93b3('0x42')][_0x93b3('0x54')]){_0x531bd9[_0x93b3('0x55')]=[{'all':!![]}];}_0x531bd9=_[_0x93b3('0x4a')]({},_0x531bd9,_0x51d56c[_0x93b3('0x4d')]);return db[_0x93b3('0x4e')]['find'](_0x531bd9)[_0x93b3('0x21')](handleEntityNotFound(_0x12269a,null))[_0x93b3('0x21')](respondWithResult(_0x12269a,null))[_0x93b3('0x2a')](handleError(_0x12269a,null));};exports[_0x93b3('0x56')]=function(_0x50d7e9,_0x2b3936){return db[_0x93b3('0x4e')]['create'](_0x50d7e9[_0x93b3('0x57')],{})[_0x93b3('0x21')](respondWithResult(_0x2b3936,0xc9))[_0x93b3('0x2a')](handleError(_0x2b3936,null));};exports[_0x93b3('0x37')]=function(_0x1763b3,_0x240d56){if(_0x1763b3[_0x93b3('0x57')]['id']){delete _0x1763b3['body']['id'];}return db[_0x93b3('0x4e')][_0x93b3('0x58')]({'where':{'id':_0x1763b3[_0x93b3('0x52')]['id']}})[_0x93b3('0x21')](handleEntityNotFound(_0x240d56,null))[_0x93b3('0x21')](saveUpdates(_0x1763b3[_0x93b3('0x57')],null))[_0x93b3('0x21')](respondWithResult(_0x240d56,null))['catch'](handleError(_0x240d56,null));};exports[_0x93b3('0x38')]=function(_0x5c93ae,_0x4e02c5){return db['WhatsappMessage'][_0x93b3('0x58')]({'where':{'id':_0x5c93ae['params']['id']}})[_0x93b3('0x21')](handleEntityNotFound(_0x4e02c5,null))[_0x93b3('0x21')](removeEntity(_0x4e02c5,null))[_0x93b3('0x2a')](handleError(_0x4e02c5,null));};exports[_0x93b3('0x59')]=function(_0xe7e73b,_0x5dde91){return db[_0x93b3('0x4e')][_0x93b3('0x59')]()['then'](respondWithResult(_0x5dde91,null))[_0x93b3('0x2a')](handleError(_0x5dde91,null));};var interaction_log=require(_0x93b3('0x5a'))(_0x93b3('0x5b'));exports['accept']=function(_0x47fbd4,_0xb911a9,_0x5281e4){var _0x9a17f4={'agent':{},'channel':_0x93b3('0x5c')};if(_0x47fbd4[_0x93b3('0x57')]['id']){delete _0x47fbd4['body']['id'];}_0x47fbd4['body'][_0x93b3('0x5d')]=!![];_0x47fbd4[_0x93b3('0x57')][_0x93b3('0x5e')]=moment()[_0x93b3('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x47fbd4['body']['UserId']=_0x47fbd4[_0x93b3('0x57')][_0x93b3('0x60')]||_0x47fbd4[_0x93b3('0x61')]['id'];_0x9a17f4[_0x93b3('0x62')]['id']=_0x47fbd4[_0x93b3('0x57')][_0x93b3('0x60')];return db['WhatsappMessage'][_0x93b3('0x58')]({'where':{'id':_0x47fbd4[_0x93b3('0x52')]['id'],'UserId':null}})[_0x93b3('0x21')](handleEntityNotFound(_0xb911a9,null))[_0x93b3('0x21')](saveUpdates(_0x47fbd4['body'],null))[_0x93b3('0x21')](function(_0x3b8cee){if(_0x3b8cee){_0x9a17f4[_0x93b3('0x28')]=_0x3b8cee['get']({'plain':!![]});return db[_0x93b3('0x63')][_0x93b3('0x58')]({'where':{'id':_0x3b8cee['WhatsappInteractionId']}});}return null;})[_0x93b3('0x21')](handleEntityNotFound(_0xb911a9,null))[_0x93b3('0x21')](function(_0x20a788){if(_0x20a788){return _0x20a788[_0x93b3('0x37')]({'UserId':_0x47fbd4[_0x93b3('0x57')][_0x93b3('0x60')],'read1stAt':_['isNil'](_0x20a788[_0x93b3('0x64')])?moment()[_0x93b3('0x5f')](_0x93b3('0x65')):undefined});}return null;})[_0x93b3('0x21')](function(_0x4b1b02){if(_0x4b1b02){_0x9a17f4['interaction']=_0x4b1b02[_0x93b3('0x66')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47fbd4[_0x93b3('0x61')]['id'],_0x47fbd4[_0x93b3('0x61')][_0x93b3('0x3a')],_0x47fbd4[_0x93b3('0x61')]['role'],_0x9a17f4[_0x93b3('0x67')]['id'],_0x47fbd4['body']?JSON['stringify'](_0x47fbd4[_0x93b3('0x57')]):_0x93b3('0x68'));return respondWithRpcPromise(_0x93b3('0x69'),_0x93b3('0x6a'),_0x9a17f4);}return null;})[_0x93b3('0x21')](function(_0x50f3ac){var _0x503eef='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x50f3ac[_0x93b3('0x28')][_0x93b3('0x6b')];return db[_0x93b3('0x6c')][_0x93b3('0x42')](_0x503eef,{'type':db[_0x93b3('0x6d')][_0x93b3('0x6e')][_0x93b3('0x6f')],'raw':!![]})[_0x93b3('0x21')](function(_0x1f4590){return _0x1f4590;});})['then'](function(_0x404758){if(_0x404758){_0x9a17f4[_0x93b3('0x28')][_0x93b3('0x70')]=_0x404758[0x0];if(!_0x47fbd4[_0x93b3('0x57')][_0x93b3('0x60')])return;return db[_0x93b3('0x71')][_0x93b3('0x58')]({'where':{'id':_0x47fbd4[_0x93b3('0x57')][_0x93b3('0x60')],'role':_0x93b3('0x62')},'attributes':['id',_0x93b3('0x3a'),_0x93b3('0x72'),_0x93b3('0x73'),_0x93b3('0x74')],'raw':!![]});}return null;})[_0x93b3('0x21')](function(_0x389b07){if(!_0x389b07)return null;_0x9a17f4[_0x93b3('0x28')][_0x93b3('0x62')]=_0x389b07;return _0x9a17f4;})[_0x93b3('0x21')](function(_0x5bacc2){if(_0x5bacc2){if(_0x47fbd4[_0x93b3('0x57')]['manual']){_0x9a17f4[_0x93b3('0x28')]['interface']=util[_0x93b3('0x5f')](_0x93b3('0x75'),_0x47fbd4[_0x93b3('0x61')][_0x93b3('0x3a')]);_0x9a17f4['message']['channel']=_0x9a17f4[_0x93b3('0x76')];_0x9a17f4[_0x93b3('0x28')]['motionChannel']=_0x9a17f4['channel'];_0x9a17f4[_0x93b3('0x28')][_0x93b3('0x77')]=_0x93b3('0x78');return respondWithRpcPromise(_0x93b3('0x79'),_0x93b3('0x79'),{'event':_0x93b3('0x7a'),'message':_0x9a17f4['message']},client9002)['then'](function(){return _0x9a17f4;});}return _0x9a17f4;}return null;})['then'](respondWithResult(_0xb911a9,null))['catch'](handleError(_0xb911a9,null));};var interaction_log=require(_0x93b3('0x5a'))(_0x93b3('0x5b'));exports[_0x93b3('0x35')]=function(_0x32a9fe,_0x24878a,_0x7505be){var _0x2bf06c={'agent':{},'channel':_0x93b3('0x5c')};if(_0x32a9fe[_0x93b3('0x57')]['id']){delete _0x32a9fe['body']['id'];}_0x32a9fe['body'][_0x93b3('0x60')]=_0x32a9fe[_0x93b3('0x57')][_0x93b3('0x60')]||_0x32a9fe['user']['id'];_0x2bf06c[_0x93b3('0x62')]['id']=_0x32a9fe['body']['UserId'];return db[_0x93b3('0x4e')]['find']({'where':{'id':_0x32a9fe[_0x93b3('0x52')]['id'],'UserId':null}})[_0x93b3('0x21')](handleEntityNotFound(_0x24878a,null))[_0x93b3('0x21')](function(_0x304b6e){if(_0x304b6e){_0x2bf06c[_0x93b3('0x28')]=_0x304b6e[_0x93b3('0x66')]({'plain':!![]});return db['WhatsappInteraction'][_0x93b3('0x58')]({'where':{'id':_0x304b6e['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x24878a,null))[_0x93b3('0x21')](function(_0x471bc5){if(_0x471bc5){_0x2bf06c[_0x93b3('0x67')]=_0x471bc5[_0x93b3('0x66')]({'plain':!![]});interaction_log[_0x93b3('0x7b')](_0x93b3('0x7c'),_0x32a9fe[_0x93b3('0x61')]['id'],_0x32a9fe[_0x93b3('0x61')][_0x93b3('0x3a')],_0x32a9fe[_0x93b3('0x61')][_0x93b3('0x7d')],_0x2bf06c[_0x93b3('0x67')]['id'],_0x32a9fe[_0x93b3('0x57')]?JSON[_0x93b3('0x25')](_0x32a9fe['body']):_0x93b3('0x68'));return respondWithRpcPromise(_0x93b3('0x7e'),_0x93b3('0x7f'),_0x2bf06c);}return null;})[_0x93b3('0x21')](function(_0x5dec85){var _0x2845b9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5dec85[_0x93b3('0x28')][_0x93b3('0x6b')];return db[_0x93b3('0x6c')][_0x93b3('0x42')](_0x2845b9,{'type':db[_0x93b3('0x6d')][_0x93b3('0x6e')][_0x93b3('0x6f')],'raw':!![]})['then'](function(_0x5ddb1d){return _0x5ddb1d;});})['then'](function(_0x22dd46){if(_0x22dd46){_0x2bf06c['message'][_0x93b3('0x70')]=_0x22dd46[0x0];if(!_0x32a9fe[_0x93b3('0x57')][_0x93b3('0x60')])return;return db[_0x93b3('0x71')][_0x93b3('0x58')]({'where':{'id':_0x32a9fe[_0x93b3('0x57')][_0x93b3('0x60')],'role':'agent'},'attributes':['id',_0x93b3('0x3a'),_0x93b3('0x72'),'email',_0x93b3('0x74')],'raw':!![]});}return null;})['then'](function(_0x235dc5){if(!_0x235dc5)return null;_0x2bf06c[_0x93b3('0x28')][_0x93b3('0x62')]=_0x235dc5;return _0x2bf06c;})[_0x93b3('0x21')](function(_0x287a07){if(_0x287a07){_0x287a07[_0x93b3('0x28')][_0x93b3('0x80')]=util['format'](_0x93b3('0x75'),_0x32a9fe['user'][_0x93b3('0x3a')]);_0x287a07[_0x93b3('0x28')]['channel']=_0x2bf06c[_0x93b3('0x76')];_0x287a07[_0x93b3('0x28')][_0x93b3('0x81')]=_0x2bf06c[_0x93b3('0x76')];_0x287a07[_0x93b3('0x28')][_0x93b3('0x77')]=_0x93b3('0x35');respondWithRpcPromise(_0x93b3('0x79'),'EventManager',{'event':_0x93b3('0x82'),'message':_0x287a07[_0x93b3('0x28')]},client9002);return _0x2bf06c;}return null;})[_0x93b3('0x21')](respondWithResult(_0x24878a,null))[_0x93b3('0x2a')](handleError(_0x24878a,null));};exports['status']=function(_0x1b26b0,_0x1312f3,_0x5b7e57){if(_0x1b26b0[_0x93b3('0x57')]['id']){delete _0x1b26b0[_0x93b3('0x57')]['id'];}var _0x11e0cf;return db[_0x93b3('0x4e')][_0x93b3('0x58')]({'where':{'id':_0x1b26b0['params']['id']}})['then'](handleEntityNotFound(_0x1312f3,null))[_0x93b3('0x21')](function(_0x34db8a){if(_0x34db8a){_0x11e0cf=_0x34db8a;return db[_0x93b3('0x83')][_0x93b3('0x58')]({'where':{'id':_0x34db8a[_0x93b3('0x84')]}});}})[_0x93b3('0x21')](handleEntityNotFound(_0x1312f3,null))[_0x93b3('0x21')](function(_0x222c4b){if(_0x222c4b){logger[_0x93b3('0x24')](_0x93b3('0x85'),_0x93b3('0x2c'),_0x93b3('0x86'),_0x222c4b[_0x93b3('0x3f')],util[_0x93b3('0x87')](_0x1b26b0[_0x93b3('0x57')],{'showHidden':![],'depth':null}));switch(_0x222c4b[_0x93b3('0x3f')]){case'twilio':if(_0x1b26b0[_0x93b3('0x57')]['MessageSid']&&_0x1b26b0[_0x93b3('0x57')][_0x93b3('0x88')]===_0x11e0cf[_0x93b3('0x89')]&&_0x1b26b0[_0x93b3('0x57')][_0x93b3('0x8a')]&&_0x1b26b0[_0x93b3('0x57')][_0x93b3('0x8a')]===_0x93b3('0x5d')){return _0x11e0cf[_0x93b3('0x37')]({'read':!![]});}else{logger['error'](_0x93b3('0x8b'),_0x93b3('0x2c'),_0x93b3('0x8c'),util[_0x93b3('0x87')](_0x1b26b0['body'],{'showHidden':![],'depth':null}));}break;}return _0x11e0cf;}})[_0x93b3('0x21')](respondWithResult(_0x1312f3,null))[_0x93b3('0x2a')](handleError(_0x1312f3,null));}; \ No newline at end of file +var _0x2313=['model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','../../config/logger','whatsapp-interactions','accept','whatsapp','readAt','format','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./whatsappMessage.socket','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','undefined','limit','offset','count','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','index','WhatsappMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection'];(function(_0x2ec333,_0x17a07e){var _0x4cd294=function(_0x2cba8e){while(--_0x2cba8e){_0x2ec333['push'](_0x2ec333['shift']());}};_0x4cd294(++_0x17a07e);}(_0x2313,0x1e6));var _0x3231=function(_0x32d16b,_0x54bacb){_0x32d16b=_0x32d16b-0x0;var _0x5b4441=_0x2313[_0x32d16b];return _0x5b4441;};'use strict';var emlformat=require(_0x3231('0x0'));var rimraf=require(_0x3231('0x1'));var zipdir=require(_0x3231('0x2'));var jsonpatch=require(_0x3231('0x3'));var rp=require(_0x3231('0x4'));var moment=require('moment');var BPromise=require(_0x3231('0x5'));var Mustache=require(_0x3231('0x6'));var util=require(_0x3231('0x7'));var path=require(_0x3231('0x8'));var sox=require(_0x3231('0x9'));var csv=require('to-csv');var ejs=require(_0x3231('0xa'));var fs=require('fs');var fs_extra=require(_0x3231('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3231('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3231('0xd'));var Papa=require(_0x3231('0xe'));var Redis=require(_0x3231('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3231('0x10'));var as=require(_0x3231('0x11'));var hardwareService=require(_0x3231('0x12'));var logger=require('../../config/logger')(_0x3231('0x13'));var utils=require(_0x3231('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3231('0x15'));var db=require(_0x3231('0x16'))['db'];config[_0x3231('0x17')]=_[_0x3231('0x18')](config[_0x3231('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3231('0x19'))[_0x3231('0x1a')](socket);var jayson=require(_0x3231('0x1b'));var client=jayson[_0x3231('0x1c')][_0x3231('0x1d')]({'port':0x232c});var client9002=jayson[_0x3231('0x1c')][_0x3231('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x27a31f,_0x583dd7,_0x46fed6,_0x16029d){return new BPromise(function(_0x42c8d8,_0x4f58a0){var _0x2b3213=_0x16029d||client;return _0x2b3213['request'](_0x27a31f,_0x46fed6)['then'](function(_0x17ac51){logger[_0x3231('0x1e')](_0x3231('0x1f'),_0x583dd7,_0x3231('0x20'));logger[_0x3231('0x21')](_0x3231('0x22'),_0x583dd7,_0x3231('0x20'),JSON[_0x3231('0x23')](_0x17ac51));if(_0x17ac51[_0x3231('0x24')]){if(_0x17ac51[_0x3231('0x24')]['code']===0x1f4){logger[_0x3231('0x24')](_0x3231('0x1f'),_0x583dd7,_0x17ac51[_0x3231('0x24')][_0x3231('0x25')]);return _0x4f58a0(_0x17ac51[_0x3231('0x24')][_0x3231('0x25')]);}logger[_0x3231('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x583dd7,_0x17ac51['error']['message']);return _0x42c8d8(_0x17ac51[_0x3231('0x24')][_0x3231('0x25')]);}else{logger[_0x3231('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x583dd7,_0x3231('0x20'));_0x42c8d8(_0x17ac51[_0x3231('0x26')][_0x3231('0x25')]);}})['catch'](function(_0x298121){logger[_0x3231('0x24')](_0x3231('0x1f'),_0x583dd7,_0x298121);_0x4f58a0(_0x298121);});});}function respondWithStatusCode(_0x56ae9c,_0x4c35cf){_0x4c35cf=_0x4c35cf||0xcc;return function(_0x23b819){if(_0x23b819){return _0x56ae9c['sendStatus'](_0x4c35cf);}return _0x56ae9c[_0x3231('0x27')](_0x4c35cf)['end']();};}function respondWithResult(_0x4505f6,_0x5b0b9a){_0x5b0b9a=_0x5b0b9a||0xc8;return function(_0x38c80f){if(_0x38c80f){return _0x4505f6[_0x3231('0x27')](_0x5b0b9a)[_0x3231('0x28')](_0x38c80f);}};}function respondWithFilteredResult(_0x11c1fc,_0x228db8){return function(_0x5889eb){if(_0x5889eb){var _0x51ec1b=typeof _0x228db8['offset']===_0x3231('0x29')&&typeof _0x228db8[_0x3231('0x2a')]===_0x3231('0x29');var _0x49b02e=_0x5889eb['count'];var _0x5a86c2=_0x51ec1b?0x0:_0x228db8[_0x3231('0x2b')];var _0x598a16=_0x51ec1b?_0x5889eb[_0x3231('0x2c')]:_0x228db8[_0x3231('0x2b')]+_0x228db8['limit'];var _0xb90939;if(_0x598a16>=_0x49b02e){_0x598a16=_0x49b02e;_0xb90939=0xc8;}else{_0xb90939=0xce;}_0x11c1fc[_0x3231('0x27')](_0xb90939);return _0x11c1fc['set']('Content-Range',_0x5a86c2+'-'+_0x598a16+'/'+_0x49b02e)['json'](_0x5889eb);}return null;};}function patchUpdates(_0x39e888){return function(_0x5de050){try{jsonpatch[_0x3231('0x2d')](_0x5de050,_0x39e888,!![]);}catch(_0x503e74){return BPromise[_0x3231('0x2e')](_0x503e74);}return _0x5de050[_0x3231('0x2f')]();};}function saveUpdates(_0x377ba3,_0x562a61){return function(_0x16095e){if(_0x16095e){return _0x16095e[_0x3231('0x30')](_0x377ba3)[_0x3231('0x31')](function(_0x2c2763){return _0x2c2763;});}return null;};}function removeEntity(_0x936de0,_0x46cd27){return function(_0x2097d9){if(_0x2097d9){return _0x2097d9[_0x3231('0x32')]()[_0x3231('0x31')](function(){_0x936de0['status'](0xcc)[_0x3231('0x33')]();});}};}function handleEntityNotFound(_0x158e53,_0x23bf25){return function(_0x11b8a4){if(!_0x11b8a4){_0x158e53[_0x3231('0x34')](0x194);}return _0x11b8a4;};}function handleError(_0x582281,_0x3b3b06){_0x3b3b06=_0x3b3b06||0x1f4;return function(_0x13a7c1){logger['error'](_0x13a7c1[_0x3231('0x35')]);if(_0x13a7c1[_0x3231('0x36')]){delete _0x13a7c1[_0x3231('0x36')];}_0x582281[_0x3231('0x27')](_0x3b3b06)['send'](_0x13a7c1);};}exports[_0x3231('0x37')]=function(_0x95df20,_0x22b08){var _0x356111={},_0xa97838={},_0x2fca59={'count':0x0,'rows':[]};var _0x4ea02a=_['map'](db[_0x3231('0x38')][_0x3231('0x39')],function(_0x3e04d8){return{'name':_0x3e04d8[_0x3231('0x3a')],'type':_0x3e04d8[_0x3231('0x3b')][_0x3231('0x3c')]};});_0xa97838['model']=_[_0x3231('0x3d')](_0x4ea02a,'name');_0xa97838[_0x3231('0x3e')]=_[_0x3231('0x3f')](_0x95df20[_0x3231('0x3e')]);_0xa97838[_0x3231('0x40')]=_[_0x3231('0x41')](_0xa97838[_0x3231('0x42')],_0xa97838[_0x3231('0x3e')]);_0x356111[_0x3231('0x43')]=_['intersection'](_0xa97838[_0x3231('0x42')],qs[_0x3231('0x44')](_0x95df20[_0x3231('0x3e')][_0x3231('0x44')]));_0x356111[_0x3231('0x43')]=_0x356111['attributes'][_0x3231('0x45')]?_0x356111[_0x3231('0x43')]:_0xa97838[_0x3231('0x42')];if(!_0x95df20['query'][_0x3231('0x46')]('nolimit')){_0x356111[_0x3231('0x2a')]=qs[_0x3231('0x2a')](_0x95df20['query'][_0x3231('0x2a')]);_0x356111[_0x3231('0x2b')]=qs[_0x3231('0x2b')](_0x95df20[_0x3231('0x3e')]['offset']);}_0x356111[_0x3231('0x47')]=qs['sort'](_0x95df20[_0x3231('0x3e')][_0x3231('0x48')]);_0x356111[_0x3231('0x49')]=qs[_0x3231('0x40')](_[_0x3231('0x4a')](_0x95df20['query'],_0xa97838[_0x3231('0x40')]),_0x4ea02a);if(_0x95df20['query'][_0x3231('0x4b')]){_0x356111[_0x3231('0x49')]=_[_0x3231('0x4c')](_0x356111[_0x3231('0x49')],{'$or':_[_0x3231('0x3d')](_0x4ea02a,function(_0xcb7188){if(_0xcb7188['type']!=='VIRTUAL'){var _0x20af1d={};_0x20af1d[_0xcb7188[_0x3231('0x36')]]={'$like':'%'+_0x95df20[_0x3231('0x3e')][_0x3231('0x4b')]+'%'};return _0x20af1d;}})});}_0x356111=_[_0x3231('0x4c')]({},_0x356111,_0x95df20['options']);var _0x1c4e0b={'where':_0x356111['where']};return db[_0x3231('0x38')][_0x3231('0x2c')](_0x1c4e0b)['then'](function(_0x2739ab){_0x2fca59[_0x3231('0x2c')]=_0x2739ab;if(_0x95df20[_0x3231('0x3e')][_0x3231('0x4d')]){_0x356111[_0x3231('0x4e')]=[{'all':!![]}];}return db[_0x3231('0x38')]['findAll'](_0x356111);})['then'](function(_0x4d6903){_0x2fca59[_0x3231('0x4f')]=_0x4d6903;return _0x2fca59;})['then'](respondWithFilteredResult(_0x22b08,_0x356111))[_0x3231('0x50')](handleError(_0x22b08,null));};exports[_0x3231('0x51')]=function(_0x1bd665,_0x38d4af){var _0x58e751={'raw':!![],'where':{'id':_0x1bd665[_0x3231('0x52')]['id']}},_0x532f3f={};_0x532f3f[_0x3231('0x42')]=_[_0x3231('0x3f')](db['WhatsappMessage'][_0x3231('0x39')]);_0x532f3f[_0x3231('0x3e')]=_[_0x3231('0x3f')](_0x1bd665[_0x3231('0x3e')]);_0x532f3f[_0x3231('0x40')]=_[_0x3231('0x41')](_0x532f3f['model'],_0x532f3f[_0x3231('0x3e')]);_0x58e751['attributes']=_['intersection'](_0x532f3f[_0x3231('0x42')],qs[_0x3231('0x44')](_0x1bd665[_0x3231('0x3e')][_0x3231('0x44')]));_0x58e751[_0x3231('0x43')]=_0x58e751['attributes']['length']?_0x58e751[_0x3231('0x43')]:_0x532f3f[_0x3231('0x42')];if(_0x1bd665[_0x3231('0x3e')][_0x3231('0x4d')]){_0x58e751['include']=[{'all':!![]}];}_0x58e751=_[_0x3231('0x4c')]({},_0x58e751,_0x1bd665[_0x3231('0x53')]);return db['WhatsappMessage'][_0x3231('0x54')](_0x58e751)[_0x3231('0x31')](handleEntityNotFound(_0x38d4af,null))[_0x3231('0x31')](respondWithResult(_0x38d4af,null))[_0x3231('0x50')](handleError(_0x38d4af,null));};exports[_0x3231('0x55')]=function(_0x5542e2,_0x5d5687){return db[_0x3231('0x38')][_0x3231('0x55')](_0x5542e2[_0x3231('0x56')],{})[_0x3231('0x31')](respondWithResult(_0x5d5687,0xc9))[_0x3231('0x50')](handleError(_0x5d5687,null));};exports[_0x3231('0x30')]=function(_0x1c2ca7,_0x4a9c78){if(_0x1c2ca7[_0x3231('0x56')]['id']){delete _0x1c2ca7[_0x3231('0x56')]['id'];}return db[_0x3231('0x38')]['find']({'where':{'id':_0x1c2ca7['params']['id']}})[_0x3231('0x31')](handleEntityNotFound(_0x4a9c78,null))[_0x3231('0x31')](saveUpdates(_0x1c2ca7[_0x3231('0x56')],null))[_0x3231('0x31')](respondWithResult(_0x4a9c78,null))[_0x3231('0x50')](handleError(_0x4a9c78,null));};exports['destroy']=function(_0x1280ad,_0x56280e){return db['WhatsappMessage'][_0x3231('0x54')]({'where':{'id':_0x1280ad[_0x3231('0x52')]['id']}})['then'](handleEntityNotFound(_0x56280e,null))[_0x3231('0x31')](removeEntity(_0x56280e,null))[_0x3231('0x50')](handleError(_0x56280e,null));};exports['describe']=function(_0x678743,_0x5c9c14){return db[_0x3231('0x38')]['describe']()[_0x3231('0x31')](respondWithResult(_0x5c9c14,null))['catch'](handleError(_0x5c9c14,null));};var interaction_log=require(_0x3231('0x57'))(_0x3231('0x58'));exports[_0x3231('0x59')]=function(_0x371f73,_0x30c65d,_0x34f27e){var _0x3e50b7={'agent':{},'channel':_0x3231('0x5a')};if(_0x371f73[_0x3231('0x56')]['id']){delete _0x371f73['body']['id'];}_0x371f73['body']['read']=!![];_0x371f73['body'][_0x3231('0x5b')]=moment()[_0x3231('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x371f73['body'][_0x3231('0x5d')]=_0x371f73[_0x3231('0x56')][_0x3231('0x5d')]||_0x371f73['user']['id'];_0x3e50b7[_0x3231('0x5e')]['id']=_0x371f73['body'][_0x3231('0x5d')];return db[_0x3231('0x38')]['find']({'where':{'id':_0x371f73[_0x3231('0x52')]['id'],'UserId':null}})[_0x3231('0x31')](handleEntityNotFound(_0x30c65d,null))['then'](saveUpdates(_0x371f73['body'],null))[_0x3231('0x31')](function(_0x3af29e){if(_0x3af29e){_0x3e50b7[_0x3231('0x25')]=_0x3af29e[_0x3231('0x5f')]({'plain':!![]});return db[_0x3231('0x60')][_0x3231('0x54')]({'where':{'id':_0x3af29e[_0x3231('0x61')]}});}return null;})[_0x3231('0x31')](handleEntityNotFound(_0x30c65d,null))['then'](function(_0x48138a){if(_0x48138a){return _0x48138a[_0x3231('0x30')]({'UserId':_0x371f73['body']['UserId'],'read1stAt':_[_0x3231('0x62')](_0x48138a[_0x3231('0x63')])?moment()[_0x3231('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3231('0x31')](function(_0x1624af){if(_0x1624af){_0x3e50b7[_0x3231('0x64')]=_0x1624af['get']({'plain':!![]});interaction_log[_0x3231('0x1e')](_0x3231('0x65'),_0x371f73[_0x3231('0x66')]['id'],_0x371f73['user'][_0x3231('0x36')],_0x371f73[_0x3231('0x66')][_0x3231('0x67')],_0x3e50b7[_0x3231('0x64')]['id'],_0x371f73[_0x3231('0x56')]?JSON[_0x3231('0x23')](_0x371f73[_0x3231('0x56')]):_0x3231('0x68'));return respondWithRpcPromise(_0x3231('0x69'),_0x3231('0x6a'),_0x3e50b7);}return null;})['then'](function(_0x38c288){var _0x2831f0=_0x3231('0x6b')+_0x38c288[_0x3231('0x25')][_0x3231('0x6c')];return db[_0x3231('0x6d')][_0x3231('0x3e')](_0x2831f0,{'type':db[_0x3231('0x6e')][_0x3231('0x6f')][_0x3231('0x70')],'raw':!![]})['then'](function(_0x153a82){return _0x153a82;});})[_0x3231('0x31')](function(_0x2b876d){if(_0x2b876d){_0x3e50b7[_0x3231('0x25')][_0x3231('0x71')]=_0x2b876d[0x0];if(!_0x371f73[_0x3231('0x56')][_0x3231('0x5d')])return;return db[_0x3231('0x72')][_0x3231('0x54')]({'where':{'id':_0x371f73[_0x3231('0x56')][_0x3231('0x5d')],'role':_0x3231('0x5e')},'attributes':['id',_0x3231('0x36'),_0x3231('0x73'),_0x3231('0x74'),_0x3231('0x75')],'raw':!![]});}return null;})['then'](function(_0x355c0d){if(!_0x355c0d)return null;_0x3e50b7[_0x3231('0x25')]['agent']=_0x355c0d;return _0x3e50b7;})[_0x3231('0x31')](function(_0x4ffbdf){if(_0x4ffbdf){if(_0x371f73['body']['manual']){_0x3e50b7[_0x3231('0x25')]['interface']=util['format']('SIP/%s',_0x371f73[_0x3231('0x66')][_0x3231('0x36')]);_0x3e50b7[_0x3231('0x25')][_0x3231('0x76')]=_0x3e50b7[_0x3231('0x76')];_0x3e50b7['message'][_0x3231('0x77')]=_0x3e50b7[_0x3231('0x76')];_0x3e50b7[_0x3231('0x25')]['event']=_0x3231('0x59');return respondWithRpcPromise('EventManager',_0x3231('0x78'),{'event':_0x3231('0x79'),'message':_0x3e50b7[_0x3231('0x25')]},client9002)[_0x3231('0x31')](function(){return _0x3e50b7;});}return _0x3e50b7;}return null;})[_0x3231('0x31')](respondWithResult(_0x30c65d,null))['catch'](handleError(_0x30c65d,null));};var interaction_log=require('../../config/logger')(_0x3231('0x58'));exports[_0x3231('0x2e')]=function(_0x5c2d09,_0x293d72,_0x4f6713){var _0x32c5bd={'agent':{},'channel':_0x3231('0x5a')};if(_0x5c2d09[_0x3231('0x56')]['id']){delete _0x5c2d09[_0x3231('0x56')]['id'];}_0x5c2d09[_0x3231('0x56')]['UserId']=_0x5c2d09[_0x3231('0x56')][_0x3231('0x5d')]||_0x5c2d09[_0x3231('0x66')]['id'];_0x32c5bd['agent']['id']=_0x5c2d09[_0x3231('0x56')][_0x3231('0x5d')];return db['WhatsappMessage'][_0x3231('0x54')]({'where':{'id':_0x5c2d09[_0x3231('0x52')]['id'],'UserId':null}})[_0x3231('0x31')](handleEntityNotFound(_0x293d72,null))['then'](function(_0x1282f2){if(_0x1282f2){_0x32c5bd[_0x3231('0x25')]=_0x1282f2[_0x3231('0x5f')]({'plain':!![]});return db[_0x3231('0x60')]['find']({'where':{'id':_0x1282f2[_0x3231('0x61')]}});}return null;})[_0x3231('0x31')](handleEntityNotFound(_0x293d72,null))[_0x3231('0x31')](function(_0x14d554){if(_0x14d554){_0x32c5bd[_0x3231('0x64')]=_0x14d554[_0x3231('0x5f')]({'plain':!![]});interaction_log[_0x3231('0x1e')](_0x3231('0x7a'),_0x5c2d09[_0x3231('0x66')]['id'],_0x5c2d09[_0x3231('0x66')][_0x3231('0x36')],_0x5c2d09[_0x3231('0x66')][_0x3231('0x67')],_0x32c5bd[_0x3231('0x64')]['id'],_0x5c2d09[_0x3231('0x56')]?JSON[_0x3231('0x23')](_0x5c2d09[_0x3231('0x56')]):_0x3231('0x68'));return respondWithRpcPromise(_0x3231('0x7b'),_0x3231('0x7c'),_0x32c5bd);}return null;})[_0x3231('0x31')](function(_0xd23975){var _0x2a8ee5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd23975[_0x3231('0x25')]['ContactId'];return db[_0x3231('0x6d')]['query'](_0x2a8ee5,{'type':db['Sequelize'][_0x3231('0x6f')][_0x3231('0x70')],'raw':!![]})['then'](function(_0x33f120){return _0x33f120;});})[_0x3231('0x31')](function(_0x3d0330){if(_0x3d0330){_0x32c5bd[_0x3231('0x25')][_0x3231('0x71')]=_0x3d0330[0x0];if(!_0x5c2d09[_0x3231('0x56')][_0x3231('0x5d')])return;return db[_0x3231('0x72')][_0x3231('0x54')]({'where':{'id':_0x5c2d09['body']['UserId'],'role':'agent'},'attributes':['id','name',_0x3231('0x73'),_0x3231('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x12fe54){if(!_0x12fe54)return null;_0x32c5bd[_0x3231('0x25')]['agent']=_0x12fe54;return _0x32c5bd;})[_0x3231('0x31')](function(_0x34c33b){if(_0x34c33b){_0x34c33b[_0x3231('0x25')][_0x3231('0x7d')]=util[_0x3231('0x5c')](_0x3231('0x7e'),_0x5c2d09[_0x3231('0x66')][_0x3231('0x36')]);_0x34c33b[_0x3231('0x25')][_0x3231('0x76')]=_0x32c5bd[_0x3231('0x76')];_0x34c33b[_0x3231('0x25')][_0x3231('0x77')]=_0x32c5bd[_0x3231('0x76')];_0x34c33b['message'][_0x3231('0x7f')]='reject';respondWithRpcPromise('EventManager',_0x3231('0x78'),{'event':_0x3231('0x80'),'message':_0x34c33b['message']},client9002);return _0x32c5bd;}return null;})[_0x3231('0x31')](respondWithResult(_0x293d72,null))['catch'](handleError(_0x293d72,null));};exports[_0x3231('0x27')]=function(_0x383c5f,_0x49859d,_0x30e0b0){if(_0x383c5f['body']['id']){delete _0x383c5f[_0x3231('0x56')]['id'];}var _0x3b2417;return db['WhatsappMessage'][_0x3231('0x54')]({'where':{'id':_0x383c5f['params']['id']}})[_0x3231('0x31')](handleEntityNotFound(_0x49859d,null))['then'](function(_0x5dcc1d){if(_0x5dcc1d){_0x3b2417=_0x5dcc1d;return db[_0x3231('0x81')]['find']({'where':{'id':_0x5dcc1d[_0x3231('0x82')]}});}})['then'](handleEntityNotFound(_0x49859d,null))[_0x3231('0x31')](function(_0x49089e){if(_0x49089e){logger['debug'](_0x3231('0x83'),_0x3231('0x27'),_0x3231('0x84'),_0x49089e[_0x3231('0x3b')],util[_0x3231('0x85')](_0x383c5f[_0x3231('0x56')],{'showHidden':![],'depth':null}));switch(_0x49089e[_0x3231('0x3b')]){case _0x3231('0x86'):if(_0x383c5f[_0x3231('0x56')]['MessageSid']&&_0x383c5f['body'][_0x3231('0x87')]===_0x3b2417['messageId']&&_0x383c5f[_0x3231('0x56')][_0x3231('0x88')]&&_0x383c5f['body']['MessageStatus']===_0x3231('0x89')){return _0x3b2417['update']({'read':!![]});}else{logger[_0x3231('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x3231('0x86'),util[_0x3231('0x85')](_0x383c5f[_0x3231('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x3b2417;}})[_0x3231('0x31')](respondWithResult(_0x49859d,null))['catch'](handleError(_0x49859d,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9b5b03b..cbe9ed8 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 _0x5ec6=['../../mysqldb','WhatsappMessage','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x3202ab,_0x291b88){var _0x33b443=function(_0x52824a){while(--_0x52824a){_0x3202ab['push'](_0x3202ab['shift']());}};_0x33b443(++_0x291b88);}(_0x5ec6,0x7f));var _0x65ec=function(_0x53c93c,_0x2d5fd9){_0x53c93c=_0x53c93c-0x0;var _0xf4e605=_0x5ec6[_0x53c93c];return _0xf4e605;};'use strict';var EventEmitter=require(_0x65ec('0x0'));var WhatsappMessage=require(_0x65ec('0x1'))['db'][_0x65ec('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x65ec('0x3'),'afterUpdate':'update','afterDestroy':_0x65ec('0x4')};function emitEvent(_0x4c659e){return function(_0x33751d,_0x4c1772,_0xf2c7b7){WhatsappMessageEvents['emit'](_0x4c659e+':'+_0x33751d['id'],_0x33751d);WhatsappMessageEvents[_0x65ec('0x5')](_0x4c659e,_0x33751d);_0xf2c7b7(null);};}for(var e in events){if(events[_0x65ec('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x65ec('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x44a3=['emit','hasOwnProperty','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x1a0724,_0x122b92){var _0x470a96=function(_0x5894fd){while(--_0x5894fd){_0x1a0724['push'](_0x1a0724['shift']());}};_0x470a96(++_0x122b92);}(_0x44a3,0x1a9));var _0x344a=function(_0x49d7c8,_0x52d9a3){_0x49d7c8=_0x49d7c8-0x0;var _0x450089=_0x44a3[_0x49d7c8];return _0x450089;};'use strict';var EventEmitter=require(_0x344a('0x0'));var WhatsappMessage=require(_0x344a('0x1'))['db'][_0x344a('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x344a('0x3')](0x0);var events={'afterCreate':_0x344a('0x4'),'afterUpdate':_0x344a('0x5'),'afterDestroy':_0x344a('0x6')};function emitEvent(_0x212a39){return function(_0x528a13,_0x23004c,_0x1bc716){WhatsappMessageEvents[_0x344a('0x7')](_0x212a39+':'+_0x528a13['id'],_0x528a13);WhatsappMessageEvents[_0x344a('0x7')](_0x212a39,_0x528a13);_0x1bc716(null);};}for(var e in events){if(events[_0x344a('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 397a6f6..062913f 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 _0xbb53=['text','POST','Bearer\x20','application/json','message_id','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','out','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/'];(function(_0x38cef3,_0x3bcd63){var _0x4b79b4=function(_0x4cbf4a){while(--_0x4cbf4a){_0x38cef3['push'](_0x38cef3['shift']());}};_0x4b79b4(++_0x3bcd63);}(_0xbb53,0x1ea));var _0x3bb5=function(_0xb5556b,_0x3cb6e7){_0xb5556b=_0xb5556b-0x0;var _0x39c106=_0xbb53[_0xb5556b];return _0x39c106;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3bb5('0x0'))(_0x3bb5('0x1'));var moment=require('moment');var BPromise=require(_0x3bb5('0x2'));var rp=require('request-promise');var fetch=require(_0x3bb5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3bb5('0x4'));var config=require(_0x3bb5('0x5'));var attributes=require(_0x3bb5('0x6'));module[_0x3bb5('0x7')]=function(_0x5aefb5,_0xab315d){return _0x5aefb5['define'](_0x3bb5('0x8'),attributes,{'tableName':_0x3bb5('0x9'),'paranoid':![],'indexes':[{'name':_0x3bb5('0xa'),'fields':['messageId']},{'name':_0x3bb5('0xb'),'fields':[_0x3bb5('0xc')],'type':_0x3bb5('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1577f9,_0x32793e,_0x2d58ea){var _0x3727d7=_0x5aefb5[_0x3bb5('0xe')];var _0x209bf7=_0x1577f9[_0x3bb5('0xf')]({'plain':!![]});if(_0x209bf7['direction'][_0x3bb5('0x10')]()==='in'||_0x209bf7[_0x3bb5('0x11')][_0x3bb5('0x10')]()==='out'&&!_0x209bf7[_0x3bb5('0x12')]&&!_[_0x3bb5('0x13')](_0x209bf7[_0x3bb5('0x14')])){_0x3727d7[_0x3bb5('0x15')][_0x3bb5('0x16')]({'where':{'id':_0x209bf7[_0x3bb5('0x17')]}})[_0x3bb5('0x18')](function(_0x5f4713){if(_0x5f4713){_0x5f4713[_0x3bb5('0x19')]({'lastMsgAt':_0x209bf7['createdAt'],'lastMsgDirection':_0x209bf7[_0x3bb5('0x11')][_0x3bb5('0x10')]()});}})[_0x3bb5('0x1a')](function(_0x308bcd){console['error'](_0x308bcd);});}if(_0x209bf7['direction']===_0x3bb5('0x1b')&&!_0x209bf7[_0x3bb5('0x12')]){var _0x18e51a;_0x3727d7['WhatsappAccount'][_0x3bb5('0x1c')]({'where':{'id':_0x209bf7[_0x3bb5('0x1d')]},'raw':!![]})[_0x3bb5('0x18')](function(_0x31eda6){_0x18e51a=_0x31eda6;if(_0x18e51a&&_0x18e51a[_0x3bb5('0x1e')]){switch(_0x18e51a[_0x3bb5('0x1e')]){case _0x3bb5('0x1f'):var _0x2d4e64=require(_0x3bb5('0x1f'));if(_0x18e51a['accountSid']&&_0x18e51a[_0x3bb5('0x20')]&&_0x18e51a[_0x3bb5('0x21')]){var _0x94e948=new _0x2d4e64(_0x18e51a[_0x3bb5('0x22')],_0x18e51a['authToken']);_0x94e948[_0x3bb5('0x23')]['create']({'body':_0x209bf7[_0x3bb5('0xc')],'to':_0x3bb5('0x24')+_0x209bf7[_0x3bb5('0x21')],'from':'whatsapp:'+_0x18e51a[_0x3bb5('0x21')],'statusCallback':_0x18e51a['remote']+_0x3bb5('0x25')+_0x209bf7['id']+_0x3bb5('0x26')+_0x18e51a[_0x3bb5('0x27')]})[_0x3bb5('0x18')](function(_0xf7b53b){if(_0xf7b53b[_0x3bb5('0x28')]){return _0x1577f9[_0x3bb5('0x19')]({'messageId':_0xf7b53b[_0x3bb5('0x28')]});}})[_0x3bb5('0x1a')](function(_0x20fc44){logger['error'](_0x3bb5('0x29'),_0x3bb5('0x2a'),_0x3bb5('0x1f'),util[_0x3bb5('0x2b')](_0x20fc44,{'showHidden':![],'depth':null}));});}else{logger[_0x3bb5('0x2c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3bb5('0x1f'),_0x3bb5('0x2d'));}break;case _0x3bb5('0x2e'):var _0x5979ee=_0x18e51a[_0x3bb5('0x22')];var _0x250fc6=_0x18e51a['authToken'];var _0x30a6f5=_0x18e51a[_0x3bb5('0x2f')]+_0x3bb5('0x30')+_0x5979ee+_0x3bb5('0x31');var _0x5d2554={'to':[_0x209bf7[_0x3bb5('0x21')]],'message':{'type':_0x3bb5('0x32'),'text':_0x209bf7[_0x3bb5('0xc')]}};var _0x2110de={'method':_0x3bb5('0x33'),'uri':_0x30a6f5,'headers':{'Authorization':_0x3bb5('0x34')+_0x250fc6,'Content-Type':_0x3bb5('0x35')},'body':_0x5d2554,'json':!![]};rp(_0x2110de)[_0x3bb5('0x18')](function(_0x3ab886){if(_0x3ab886['statuses'][0x0][_0x3bb5('0x36')]){return _0x1577f9[_0x3bb5('0x19')]({'messageId':_0x3ab886[_0x3bb5('0x37')][0x0]['message_id']});}})[_0x3bb5('0x1a')](function(_0x280223){logger[_0x3bb5('0x38')]('WhatsappMessage,\x20%s',_0x280223);});break;}}})[_0x3bb5('0x39')](function(){_0x2d58ea();});}else{_0x2d58ea();}}},'charset':_0x3bb5('0x3a'),'collate':_0x3bb5('0x3b')});}; \ No newline at end of file +var _0x2516=['catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt'];(function(_0x43e6a5,_0x2b55d3){var _0x4c79e5=function(_0x435f9d){while(--_0x435f9d){_0x43e6a5['push'](_0x43e6a5['shift']());}};_0x4c79e5(++_0x2b55d3);}(_0x2516,0x9d));var _0x6251=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2516[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var logger=require(_0x6251('0x2'))(_0x6251('0x3'));var moment=require(_0x6251('0x4'));var BPromise=require('bluebird');var rp=require(_0x6251('0x5'));var fetch=require(_0x6251('0x6'));var fs=require('fs');var path=require(_0x6251('0x7'));var rimraf=require(_0x6251('0x8'));var config=require(_0x6251('0x9'));var attributes=require(_0x6251('0xa'));module[_0x6251('0xb')]=function(_0x3be691,_0x279080){return _0x3be691[_0x6251('0xc')](_0x6251('0xd'),attributes,{'tableName':_0x6251('0xe'),'paranoid':![],'indexes':[{'name':_0x6251('0xf'),'fields':[_0x6251('0xf')]},{'name':_0x6251('0x10'),'fields':[_0x6251('0x11')],'type':_0x6251('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cd925,_0x2e981b,_0x41694c){var _0x424c73=_0x3be691[_0x6251('0x13')];var _0x2ae66c=_0x4cd925[_0x6251('0x14')]({'plain':!![]});if(_0x2ae66c[_0x6251('0x15')]['toLowerCase']()==='in'||_0x2ae66c[_0x6251('0x15')][_0x6251('0x16')]()===_0x6251('0x17')&&!_0x2ae66c[_0x6251('0x18')]&&!_[_0x6251('0x19')](_0x2ae66c[_0x6251('0x1a')])){_0x424c73[_0x6251('0x1b')][_0x6251('0x1c')]({'where':{'id':_0x2ae66c['WhatsappInteractionId']}})[_0x6251('0x1d')](function(_0x34e438){if(_0x34e438){_0x34e438[_0x6251('0x1e')]({'lastMsgAt':_0x2ae66c[_0x6251('0x1f')],'lastMsgDirection':_0x2ae66c[_0x6251('0x15')]['toLowerCase']()});}})[_0x6251('0x20')](function(_0x3d8231){console['error'](_0x3d8231);});}if(_0x2ae66c[_0x6251('0x15')]===_0x6251('0x17')&&!_0x2ae66c[_0x6251('0x18')]){var _0xff6a9f;_0x424c73[_0x6251('0x21')][_0x6251('0x22')]({'where':{'id':_0x2ae66c[_0x6251('0x23')]},'raw':!![]})['then'](function(_0x18a395){_0xff6a9f=_0x18a395;if(_0xff6a9f&&_0xff6a9f[_0x6251('0x24')]){switch(_0xff6a9f[_0x6251('0x24')]){case _0x6251('0x25'):var _0x1e92ee=require('twilio');if(_0xff6a9f['accountSid']&&_0xff6a9f[_0x6251('0x26')]&&_0xff6a9f[_0x6251('0x27')]){var _0x11a64f=new _0x1e92ee(_0xff6a9f[_0x6251('0x28')],_0xff6a9f[_0x6251('0x26')]);_0x11a64f[_0x6251('0x29')]['create']({'body':_0x2ae66c[_0x6251('0x11')],'to':_0x6251('0x2a')+_0x2ae66c[_0x6251('0x27')],'from':'whatsapp:'+_0xff6a9f[_0x6251('0x27')],'statusCallback':_0xff6a9f[_0x6251('0x2b')]+'/api/whatsapp/messages/'+_0x2ae66c['id']+_0x6251('0x2c')+_0xff6a9f[_0x6251('0x2d')]})[_0x6251('0x1d')](function(_0x1a6043){if(_0x1a6043[_0x6251('0x2e')]){return _0x4cd925[_0x6251('0x1e')]({'messageId':_0x1a6043[_0x6251('0x2e')]});}})[_0x6251('0x20')](function(_0x40fdd9){logger['error'](_0x6251('0x2f'),'afterCreate',_0x6251('0x25'),util[_0x6251('0x30')](_0x40fdd9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6251('0x2f'),_0x6251('0x31'),_0x6251('0x25'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x6251('0x32'):var _0x10b85f=_0xff6a9f['accountSid'];var _0x1799f0=_0xff6a9f[_0x6251('0x26')];var _0x317a01=_0xff6a9f['baseUrl']+_0x6251('0x33')+_0x10b85f+_0x6251('0x34');var _0x2e0ac9={'to':[_0x2ae66c[_0x6251('0x27')]],'message':{'type':_0x6251('0x35'),'text':_0x2ae66c[_0x6251('0x11')]}};var _0x17f8dd={'method':_0x6251('0x36'),'uri':_0x317a01,'headers':{'Authorization':_0x6251('0x37')+_0x1799f0,'Content-Type':_0x6251('0x38')},'body':_0x2e0ac9,'json':!![]};rp(_0x17f8dd)['then'](function(_0x1d685a){if(_0x1d685a[_0x6251('0x39')][0x0][_0x6251('0x3a')]){return _0x4cd925[_0x6251('0x1e')]({'messageId':_0x1d685a[_0x6251('0x39')][0x0][_0x6251('0x3a')]});}})[_0x6251('0x20')](function(_0x5c4497){logger[_0x6251('0x3b')](_0x6251('0x3c'),_0x5c4497);});break;}}})['finally'](function(){_0x41694c();});}else{_0x41694c();}}},'charset':_0x6251('0x3d'),'collate':_0x6251('0x3e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 3b57d66..119f941 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 _0x2900=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappMessage','options','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','client','http','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request'];(function(_0x1aefae,_0x45a7fa){var _0x292f09=function(_0x57526a){while(--_0x57526a){_0x1aefae['push'](_0x1aefae['shift']());}};_0x292f09(++_0x45a7fa);}(_0x2900,0x94));var _0x0290=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0x2900[_0x22868f];return _0x97bc75;};'use strict';var _=require(_0x0290('0x0'));var util=require('util');var moment=require(_0x0290('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0290('0x2'));var db=require(_0x0290('0x3'))['db'];var utils=require(_0x0290('0x4'));var logger=require('../../config/logger')(_0x0290('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0290('0x6')][_0x0290('0x7')]({'port':0x232a});config['redis']=_[_0x0290('0x8')](config['redis'],{'host':_0x0290('0x9'),'port':0x18eb});var socket=require(_0x0290('0xa'))(new Redis(config['redis']));require(_0x0290('0xb'))[_0x0290('0xc')](socket);function respondWithRpcPromise(_0xd1e37f,_0x21fb1d,_0x16c0f9){return new BPromise(function(_0x57413d,_0x1c2a48){return client[_0x0290('0xd')](_0xd1e37f,_0x16c0f9)[_0x0290('0xe')](function(_0x398d99){logger[_0x0290('0xf')](_0x0290('0x10'),_0x21fb1d,_0x0290('0x11'));logger[_0x0290('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x21fb1d,_0x0290('0x11'),JSON[_0x0290('0x13')](_0x398d99));if(_0x398d99[_0x0290('0x14')]){if(_0x398d99[_0x0290('0x14')][_0x0290('0x15')]===0x1f4){logger['error'](_0x0290('0x10'),_0x21fb1d,_0x398d99[_0x0290('0x14')][_0x0290('0x16')]);return _0x1c2a48(_0x398d99[_0x0290('0x14')][_0x0290('0x16')]);}logger[_0x0290('0x14')](_0x0290('0x10'),_0x21fb1d,_0x398d99['error'][_0x0290('0x16')]);return _0x57413d(_0x398d99[_0x0290('0x14')][_0x0290('0x16')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x21fb1d,_0x0290('0x11'));_0x57413d(_0x398d99[_0x0290('0x17')][_0x0290('0x16')]);}})[_0x0290('0x18')](function(_0x8890bc){logger[_0x0290('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x21fb1d,_0x8890bc);_0x1c2a48(_0x8890bc);});});}exports[_0x0290('0x19')]=function(_0x3ac9c0){var _0x1cf9dd=this;return new Promise(function(_0x3158df,_0x531c88){return db['WhatsappMessage']['create'](_0x3ac9c0['body'],{'raw':_0x3ac9c0[_0x0290('0x1a')]?_0x3ac9c0[_0x0290('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x0290('0xe')](function(_0x2f09e2){logger[_0x0290('0xf')](_0x0290('0x19'),_0x3ac9c0);logger[_0x0290('0x12')](_0x0290('0x19'),_0x3ac9c0,JSON[_0x0290('0x13')](_0x2f09e2));_0x3158df(_0x2f09e2);})[_0x0290('0x18')](function(_0x473f62){logger[_0x0290('0x14')](_0x0290('0x19'),_0x473f62[_0x0290('0x16')],_0x3ac9c0);_0x531c88(_0x1cf9dd[_0x0290('0x14')](0x1f4,_0x473f62[_0x0290('0x16')]));});});}; \ No newline at end of file +var _0x6833=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','options','raw','lodash','util','moment','bluebird'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x6833,0x13c));var _0x3683=function(_0x5e0710,_0x554f39){_0x5e0710=_0x5e0710-0x0;var _0x3dbb1c=_0x6833[_0x5e0710];return _0x3dbb1c;};'use strict';var _=require(_0x3683('0x0'));var util=require(_0x3683('0x1'));var moment=require(_0x3683('0x2'));var BPromise=require(_0x3683('0x3'));var rs=require(_0x3683('0x4'));var fs=require('fs');var Redis=require(_0x3683('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3683('0x6'));var logger=require(_0x3683('0x7'))('rpc');var config=require(_0x3683('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3683('0x9')][_0x3683('0xa')]({'port':0x232a});config[_0x3683('0xb')]=_['defaults'](config[_0x3683('0xb')],{'host':_0x3683('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3683('0xd'))[_0x3683('0xe')](socket);function respondWithRpcPromise(_0x5b8c26,_0x5c2f81,_0x552ee5){return new BPromise(function(_0x1a7980,_0x5aea4f){return client[_0x3683('0xf')](_0x5b8c26,_0x552ee5)[_0x3683('0x10')](function(_0x5b9139){logger[_0x3683('0x11')](_0x3683('0x12'),_0x5c2f81,_0x3683('0x13'));logger[_0x3683('0x14')](_0x3683('0x15'),_0x5c2f81,_0x3683('0x13'),JSON[_0x3683('0x16')](_0x5b9139));if(_0x5b9139[_0x3683('0x17')]){if(_0x5b9139['error'][_0x3683('0x18')]===0x1f4){logger['error'](_0x3683('0x12'),_0x5c2f81,_0x5b9139['error']['message']);return _0x5aea4f(_0x5b9139[_0x3683('0x17')][_0x3683('0x19')]);}logger[_0x3683('0x17')](_0x3683('0x12'),_0x5c2f81,_0x5b9139['error'][_0x3683('0x19')]);return _0x1a7980(_0x5b9139[_0x3683('0x17')][_0x3683('0x19')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5c2f81,_0x3683('0x13'));_0x1a7980(_0x5b9139[_0x3683('0x1a')][_0x3683('0x19')]);}})[_0x3683('0x1b')](function(_0x3d50e6){logger['error'](_0x3683('0x12'),_0x5c2f81,_0x3d50e6);_0x5aea4f(_0x3d50e6);});});}exports[_0x3683('0x1c')]=function(_0x29076a){var _0x1ec4cb=this;return new Promise(function(_0x5922c9,_0x9c0b2b){return db[_0x3683('0x1d')]['create'](_0x29076a['body'],{'raw':_0x29076a[_0x3683('0x1e')]?_0x29076a[_0x3683('0x1e')][_0x3683('0x1f')]===undefined?!![]:![]:!![]})[_0x3683('0x10')](function(_0x18d6de){logger[_0x3683('0x11')](_0x3683('0x1c'),_0x29076a);logger['debug']('CreateWhatsappMessage',_0x29076a,JSON[_0x3683('0x16')](_0x18d6de));_0x5922c9(_0x18d6de);})[_0x3683('0x1b')](function(_0x5db061){logger[_0x3683('0x17')](_0x3683('0x1c'),_0x5db061[_0x3683('0x19')],_0x29076a);_0x9c0b2b(_0x1ec4cb[_0x3683('0x17')](0x1f4,_0x5db061[_0x3683('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index cef6ad3..5e27ced 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 _0x626d=['length','whatsappMessage:','save','remove','emit','removeListener'];(function(_0x4a8cd2,_0xc0f6f3){var _0x1022ba=function(_0x3082bc){while(--_0x3082bc){_0x4a8cd2['push'](_0x4a8cd2['shift']());}};_0x1022ba(++_0xc0f6f3);}(_0x626d,0x1d0));var _0xd626=function(_0x176189,_0x28d57b){_0x176189=_0x176189-0x0;var _0x475624=_0x626d[_0x176189];return _0x475624;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xd626('0x0'),_0xd626('0x1'),'update'];function createListener(_0x56f229,_0x5d0ae1){return function(_0x4a018e){_0x5d0ae1[_0xd626('0x2')](_0x56f229,_0x4a018e);};}function removeListener(_0x110c03,_0x2e51be){return function(){WhatsappMessageEvents[_0xd626('0x3')](_0x110c03,_0x2e51be);};}exports['register']=function(_0x1b217d){for(var _0x1b624d=0x0,_0x5716a0=events[_0xd626('0x4')];_0x1b624d<_0x5716a0;_0x1b624d++){var _0x350e9f=events[_0x1b624d];var _0x2e82d3=createListener(_0xd626('0x5')+_0x350e9f,_0x1b217d);WhatsappMessageEvents['on'](_0x350e9f,_0x2e82d3);}}; \ No newline at end of file +var _0x96f9=['whatsappMessage:','./whatsappMessage.events','remove','update','removeListener','register','length'];(function(_0x22e2f8,_0x18b284){var _0x2fbb76=function(_0x396c4a){while(--_0x396c4a){_0x22e2f8['push'](_0x22e2f8['shift']());}};_0x2fbb76(++_0x18b284);}(_0x96f9,0x120));var _0x996f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x96f9[_0x4565bf];return _0x5610ba;};'use strict';var WhatsappMessageEvents=require(_0x996f('0x0'));var events=['save',_0x996f('0x1'),_0x996f('0x2')];function createListener(_0xe8e7f6,_0x4bc981){return function(_0x4d9315){_0x4bc981['emit'](_0xe8e7f6,_0x4d9315);};}function removeListener(_0x1fbd89,_0x225097){return function(){WhatsappMessageEvents[_0x996f('0x3')](_0x1fbd89,_0x225097);};}exports[_0x996f('0x4')]=function(_0xe3a626){for(var _0x1ad511=0x0,_0x4babb2=events[_0x996f('0x5')];_0x1ad511<_0x4babb2;_0x1ad511++){var _0x3728b6=events[_0x1ad511];var _0x3b1131=createListener(_0x996f('0x6')+_0x3728b6,_0xe3a626);WhatsappMessageEvents['on'](_0x3728b6,_0x3b1131);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index fae7264..7fc5d79 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 _0x08ca=['update','delete','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x08ca,0xf5));var _0xa08c=function(_0x1edf2a,_0x55c423){_0x1edf2a=_0x1edf2a-0x0;var _0x5698f0=_0x08ca[_0x1edf2a];return _0x5698f0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa08c('0x0')]();var fs_extra=require(_0xa08c('0x1'));var auth=require(_0xa08c('0x2'));var interaction=require(_0xa08c('0x3'));var config=require('../../config/environment');var controller=require(_0xa08c('0x4'));router[_0xa08c('0x5')]('/',auth[_0xa08c('0x6')](),controller[_0xa08c('0x7')]);router[_0xa08c('0x5')]('/describe',auth[_0xa08c('0x6')](),controller['describe']);router[_0xa08c('0x5')](_0xa08c('0x8'),auth[_0xa08c('0x6')](),controller[_0xa08c('0x9')]);router[_0xa08c('0x5')](_0xa08c('0xa'),auth['isAuthenticated'](),controller[_0xa08c('0xb')]);router[_0xa08c('0x5')](_0xa08c('0xc'),auth['isAuthenticated'](),controller[_0xa08c('0xd')]);router['get'](_0xa08c('0xe'),auth[_0xa08c('0x6')](),controller[_0xa08c('0xf')]);router[_0xa08c('0x10')]('/',auth[_0xa08c('0x6')](),controller['create']);router[_0xa08c('0x10')](_0xa08c('0xc'),auth[_0xa08c('0x6')](),controller[_0xa08c('0x11')]);router[_0xa08c('0x10')]('/:id/users',auth[_0xa08c('0x6')](),controller[_0xa08c('0x12')]);router['put'](_0xa08c('0x8'),auth[_0xa08c('0x6')](),controller[_0xa08c('0x13')]);router[_0xa08c('0x14')]('/:id',auth[_0xa08c('0x6')](),controller['destroy']);router[_0xa08c('0x14')](_0xa08c('0xc'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xa08c('0x14')]('/:id/users',auth[_0xa08c('0x6')](),controller['removeAgents']);module[_0xa08c('0x15')]=router; \ No newline at end of file +var _0x2fd0=['/describe','describe','/:id','show','getMembers','/:id/users','create','post','/:id/teams','addAgents','put','delete','destroy','removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2fd0,0x13b));var _0x02fd=function(_0x3e1415,_0x2ad5ee){_0x3e1415=_0x3e1415-0x0;var _0x2e1ec7=_0x2fd0[_0x3e1415];return _0x2e1ec7;};'use strict';var multer=require('multer');var util=require(_0x02fd('0x0'));var path=require('path');var timeout=require(_0x02fd('0x1'));var express=require(_0x02fd('0x2'));var router=express[_0x02fd('0x3')]();var fs_extra=require(_0x02fd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x02fd('0x5'));var controller=require(_0x02fd('0x6'));router['get']('/',auth[_0x02fd('0x7')](),controller[_0x02fd('0x8')]);router[_0x02fd('0x9')](_0x02fd('0xa'),auth[_0x02fd('0x7')](),controller[_0x02fd('0xb')]);router[_0x02fd('0x9')](_0x02fd('0xc'),auth[_0x02fd('0x7')](),controller[_0x02fd('0xd')]);router['get']('/:id/members',auth[_0x02fd('0x7')](),controller[_0x02fd('0xe')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x02fd('0x9')](_0x02fd('0xf'),auth[_0x02fd('0x7')](),controller['getAgents']);router['post']('/',auth[_0x02fd('0x7')](),controller[_0x02fd('0x10')]);router[_0x02fd('0x11')](_0x02fd('0x12'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0x02fd('0x7')](),controller[_0x02fd('0x13')]);router[_0x02fd('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x02fd('0x15')]('/:id',auth[_0x02fd('0x7')](),controller[_0x02fd('0x16')]);router[_0x02fd('0x15')]('/:id/teams',auth[_0x02fd('0x7')](),controller[_0x02fd('0x17')]);router[_0x02fd('0x15')](_0x02fd('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x02fd('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 60dd3ce..212b302 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 _0xa25c=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x3ca4ad,_0x198733){var _0x2ad230=function(_0xbc0c39){while(--_0xbc0c39){_0x3ca4ad['push'](_0x3ca4ad['shift']());}};_0x2ad230(++_0x198733);}(_0xa25c,0x13f));var _0xca25=function(_0x10b95c,_0x134f5a){_0x10b95c=_0x10b95c-0x0;var _0x53fbf8=_0xa25c[_0x10b95c];return _0x53fbf8;};'use strict';var Sequelize=require('sequelize');module[_0xca25('0x0')]={'name':{'type':Sequelize[_0xca25('0x1')],'unique':_0xca25('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xca25('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xca25('0x4')](_0xca25('0x5'),_0xca25('0x6'),_0xca25('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc831=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x1e3bd3,_0x380bf2){var _0x110df1=function(_0x3bac27){while(--_0x3bac27){_0x1e3bd3['push'](_0x1e3bd3['shift']());}};_0x110df1(++_0x380bf2);}(_0xc831,0x103));var _0x1c83=function(_0x449679,_0x5080f9){_0x449679=_0x449679-0x0;var _0x2b48b7=_0xc831[_0x449679];return _0x2b48b7;};'use strict';var Sequelize=require('sequelize');module[_0x1c83('0x0')]={'name':{'type':Sequelize[_0x1c83('0x1')],'unique':_0x1c83('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1c83('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1c83('0x4')](_0x1c83('0x5'),_0x1c83('0x6'),_0x1c83('0x7'))},'description':{'type':Sequelize[_0x1c83('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 5a6347e..47a792c 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 _0xd8b9=['isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','nolimit','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','describe','getMembers','findOne','UserWhatsappQueue','sort','pick','filter','User','findAndCountAll','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','order','hasOwnProperty','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b9,0x84));var _0x9d8b=function(_0x432903,_0x4b8388){_0x432903=_0x432903-0x0;var _0x250f81=_0xd8b9[_0x432903];return _0x250f81;};'use strict';var BPromise=require(_0x9d8b('0x0'));var util=require(_0x9d8b('0x1'));var _=require(_0x9d8b('0x2'));var squel=require(_0x9d8b('0x3'));var Redis=require(_0x9d8b('0x4'));var qs=require(_0x9d8b('0x5'));var logger=require('../../config/logger')(_0x9d8b('0x6'));var config=require(_0x9d8b('0x7'));var db=require(_0x9d8b('0x8'))['db'];config[_0x9d8b('0x9')]=_[_0x9d8b('0xa')](config['redis'],{'host':_0x9d8b('0xb'),'port':0x18eb});var socket=require(_0x9d8b('0xc'))(new Redis(config[_0x9d8b('0x9')]));require('./whatsappQueue.socket')[_0x9d8b('0xd')](socket);function respondWithStatusCode(_0xefdafd,_0x2da382){_0x2da382=_0x2da382||0xcc;return function(_0x3d288c){if(_0x3d288c){return _0xefdafd[_0x9d8b('0xe')](_0x2da382);}return _0xefdafd[_0x9d8b('0xf')](_0x2da382)[_0x9d8b('0x10')]();};}function respondWithResult(_0x4eb57a,_0x111752){_0x111752=_0x111752||0xc8;return function(_0x4ac08d){if(_0x4ac08d){return _0x4eb57a[_0x9d8b('0xf')](_0x111752)[_0x9d8b('0x11')](_0x4ac08d);}};}function respondWithFilteredResult(_0x29f091,_0x394208){return function(_0x581e14){if(_0x581e14){var _0x3a60f1=typeof _0x394208[_0x9d8b('0x12')]===_0x9d8b('0x13')&&typeof _0x394208[_0x9d8b('0x14')]===_0x9d8b('0x13');var _0x1ab606=_0x581e14[_0x9d8b('0x15')];var _0x48a421=_0x3a60f1?0x0:_0x394208[_0x9d8b('0x12')];var _0x12da87=_0x3a60f1?_0x581e14['count']:_0x394208[_0x9d8b('0x12')]+_0x394208['limit'];var _0x154df9;if(_0x12da87>=_0x1ab606){_0x12da87=_0x1ab606;_0x154df9=0xc8;}else{_0x154df9=0xce;}_0x29f091[_0x9d8b('0xf')](_0x154df9);return _0x29f091[_0x9d8b('0x16')]('Content-Range',_0x48a421+'-'+_0x12da87+'/'+_0x1ab606)[_0x9d8b('0x11')](_0x581e14);}return null;};}function saveUpdates(_0x858687){return function(_0x5d6a74){if(_0x5d6a74){return _0x5d6a74[_0x9d8b('0x17')](_0x858687)[_0x9d8b('0x18')](function(_0x17c5f6){return _0x17c5f6;});}return null;};}function removeEntity(_0x524a68){return function(_0x2b7652){if(_0x2b7652){return _0x2b7652[_0x9d8b('0x19')]()[_0x9d8b('0x18')](function(){var _0x323fe0=_0x2b7652[_0x9d8b('0x1a')]({'plain':!![]});var _0x220291=_0x9d8b('0x1b');return db[_0x9d8b('0x1c')]['destroy']({'where':{'type':_0x220291,'resourceId':_0x323fe0['id']}})[_0x9d8b('0x18')](function(){return _0x2b7652;});})[_0x9d8b('0x18')](function(){_0x524a68[_0x9d8b('0xf')](0xcc)[_0x9d8b('0x10')]();});}};}function handleEntityNotFound(_0x35bd7c){return function(_0x127b49){if(!_0x127b49){_0x35bd7c['sendStatus'](0x194);}return _0x127b49;};}function handleError(_0x1ae88c,_0x21df87){_0x21df87=_0x21df87||0x1f4;return function(_0x832458){logger[_0x9d8b('0x1d')](_0x832458[_0x9d8b('0x1e')]);if(_0x832458['name']){delete _0x832458[_0x9d8b('0x1f')];}_0x1ae88c[_0x9d8b('0xf')](_0x21df87)[_0x9d8b('0x20')](_0x832458);};}exports['index']=function(_0x3d0a78,_0x4777a2){var _0x3c22d8={};var _0x4f6453={'count':0x0,'rows':[]};var _0x5f4df7=_[_0x9d8b('0x21')](db[_0x9d8b('0x22')][_0x9d8b('0x23')],function(_0x8ca9f5){return{'name':_0x8ca9f5[_0x9d8b('0x24')],'type':_0x8ca9f5[_0x9d8b('0x25')][_0x9d8b('0x26')]};});_0x3c22d8=qs[_0x9d8b('0x27')](_0x5f4df7,_0x3d0a78);var _0x53b6c8={'where':_0x3c22d8[_0x9d8b('0x28')]};return db[_0x9d8b('0x22')][_0x9d8b('0x15')](_0x53b6c8)[_0x9d8b('0x18')](function(_0x30c304){_0x4f6453['count']=_0x30c304;_0x3c22d8['include']=qs[_0x9d8b('0x29')](_0x3d0a78[_0x9d8b('0x2a')]);return db['WhatsappQueue'][_0x9d8b('0x2b')](_0x3c22d8);})[_0x9d8b('0x18')](function(_0x55d3f2){_0x4f6453[_0x9d8b('0x2c')]=_0x55d3f2;return _0x4f6453;})[_0x9d8b('0x18')](respondWithFilteredResult(_0x4777a2,_0x3c22d8))[_0x9d8b('0x2d')](handleError(_0x4777a2,null));};exports['show']=function(_0x52afca,_0x5496bf){var _0x32105b={'raw':!![],'where':{'id':_0x52afca[_0x9d8b('0x2e')]['id']}},_0x2ea5bd={};_0x2ea5bd[_0x9d8b('0x2f')]=_[_0x9d8b('0x30')](db[_0x9d8b('0x22')][_0x9d8b('0x23')]);_0x2ea5bd[_0x9d8b('0x2a')]=_[_0x9d8b('0x30')](_0x52afca[_0x9d8b('0x2a')]);_0x2ea5bd[_0x9d8b('0x31')]=_[_0x9d8b('0x32')](_0x2ea5bd[_0x9d8b('0x2f')],_0x2ea5bd['query']);_0x32105b[_0x9d8b('0x33')]=_[_0x9d8b('0x32')](_0x2ea5bd[_0x9d8b('0x2f')],qs[_0x9d8b('0x34')](_0x52afca[_0x9d8b('0x2a')][_0x9d8b('0x34')]));_0x32105b[_0x9d8b('0x33')]=_0x32105b[_0x9d8b('0x33')][_0x9d8b('0x35')]?_0x32105b[_0x9d8b('0x33')]:_0x2ea5bd[_0x9d8b('0x2f')];if(_0x52afca[_0x9d8b('0x2a')][_0x9d8b('0x36')]){_0x32105b[_0x9d8b('0x29')]=[{'all':!![]}];}_0x32105b=_[_0x9d8b('0x37')]({},_0x32105b,_0x52afca[_0x9d8b('0x38')]);return db[_0x9d8b('0x22')][_0x9d8b('0x39')](_0x32105b)[_0x9d8b('0x18')](handleEntityNotFound(_0x5496bf,null))[_0x9d8b('0x18')](respondWithResult(_0x5496bf,null))[_0x9d8b('0x2d')](handleError(_0x5496bf,null));};exports[_0x9d8b('0x3a')]=function(_0x150788,_0x3e1243){return db[_0x9d8b('0x22')]['create'](_0x150788['body'],{})[_0x9d8b('0x18')](function(_0x50cc31){var _0x551648=_0x150788[_0x9d8b('0x3b')][_0x9d8b('0x1a')]({'plain':!![]});if(!_0x551648)throw new Error(_0x9d8b('0x3c'));if(_0x551648[_0x9d8b('0x3d')]===_0x9d8b('0x3b')){var _0x5d02bf=_0x50cc31['get']({'plain':!![]});var _0x3a8a04='WhatsappQueues';return db[_0x9d8b('0x3e')][_0x9d8b('0x39')]({'where':{'name':_0x3a8a04,'userProfileId':_0x551648[_0x9d8b('0x3f')]},'raw':!![]})[_0x9d8b('0x18')](function(_0x45f42b){if(_0x45f42b&&_0x45f42b['autoAssociation']===0x0){return db[_0x9d8b('0x1c')]['create']({'name':_0x5d02bf[_0x9d8b('0x1f')],'resourceId':_0x5d02bf['id'],'type':_0x45f42b[_0x9d8b('0x1f')],'sectionId':_0x45f42b['id']},{})['then'](function(){return _0x50cc31;});}else{return _0x50cc31;}})['catch'](function(_0x4a387c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a387c);throw _0x4a387c;});}return _0x50cc31;})[_0x9d8b('0x18')](respondWithResult(_0x3e1243,0xc9))[_0x9d8b('0x2d')](handleError(_0x3e1243,null));};exports['update']=function(_0x3786f2,_0x21f8a5){if(_0x3786f2['body']['id']){delete _0x3786f2['body']['id'];}return db[_0x9d8b('0x22')][_0x9d8b('0x39')]({'where':{'id':_0x3786f2['params']['id']}})[_0x9d8b('0x18')](handleEntityNotFound(_0x21f8a5,null))[_0x9d8b('0x18')](saveUpdates(_0x3786f2[_0x9d8b('0x40')],null))['then'](respondWithResult(_0x21f8a5,null))['catch'](handleError(_0x21f8a5,null));};exports['destroy']=function(_0x2ae754,_0x3588eb){return db[_0x9d8b('0x22')]['find']({'where':{'id':_0x2ae754[_0x9d8b('0x2e')]['id']}})[_0x9d8b('0x18')](handleEntityNotFound(_0x3588eb,null))[_0x9d8b('0x18')](removeEntity(_0x3588eb,null))[_0x9d8b('0x2d')](handleError(_0x3588eb,null));};exports[_0x9d8b('0x41')]=function(_0x482f08,_0x1f26be){return db[_0x9d8b('0x22')][_0x9d8b('0x41')]()[_0x9d8b('0x18')](respondWithResult(_0x1f26be,null))[_0x9d8b('0x2d')](handleError(_0x1f26be,null));};exports[_0x9d8b('0x42')]=function(_0x202481,_0x232b99){var _0x5ad79e={'raw':!![],'where':{}},_0x5159df={},_0x2707b7;return db[_0x9d8b('0x22')][_0x9d8b('0x43')]({'where':{'id':_0x202481[_0x9d8b('0x2e')]['id']}})['then'](handleEntityNotFound(_0x232b99,null))['then'](function(_0x5ef456){if(_0x5ef456){_0x2707b7=_0x5ef456[_0x9d8b('0x1a')]({'plain':!![]});_0x5159df[_0x9d8b('0x2f')]=_[_0x9d8b('0x30')](db[_0x9d8b('0x44')][_0x9d8b('0x23')]);_0x5159df['query']=_[_0x9d8b('0x30')](_0x202481['query']);_0x5159df[_0x9d8b('0x31')]=_[_0x9d8b('0x32')](_0x5159df['model'],_0x5159df[_0x9d8b('0x2a')]);_0x5ad79e[_0x9d8b('0x33')]=_['intersection'](_0x5159df['model'],qs[_0x9d8b('0x34')](_0x202481[_0x9d8b('0x2a')][_0x9d8b('0x34')]));_0x5ad79e['attributes']=_0x5ad79e[_0x9d8b('0x33')][_0x9d8b('0x35')]?_0x5ad79e[_0x9d8b('0x33')]:_0x5159df[_0x9d8b('0x2f')];if(!_0x202481[_0x9d8b('0x2a')]['hasOwnProperty']('nolimit')){_0x5ad79e[_0x9d8b('0x14')]=qs[_0x9d8b('0x14')](_0x202481[_0x9d8b('0x2a')][_0x9d8b('0x14')]);_0x5ad79e[_0x9d8b('0x12')]=qs[_0x9d8b('0x12')](_0x202481['query'][_0x9d8b('0x12')]);}_0x5ad79e['order']=qs[_0x9d8b('0x45')](_0x202481[_0x9d8b('0x2a')][_0x9d8b('0x45')]);_0x5ad79e['where']=qs[_0x9d8b('0x31')](_[_0x9d8b('0x46')](_0x202481[_0x9d8b('0x2a')],_0x5159df[_0x9d8b('0x31')]));_0x5ad79e['where']['WhatsappQueueId']=_0x5ef456['id'];if(_0x202481[_0x9d8b('0x2a')][_0x9d8b('0x47')]){_0x5ad79e[_0x9d8b('0x28')]=_[_0x9d8b('0x37')](_0x5ad79e[_0x9d8b('0x28')],{'$or':_['map'](_0x5ad79e[_0x9d8b('0x33')],function(_0x4b0217){var _0x4b0fda={};_0x4b0fda[_0x4b0217]={'$like':'%'+_0x202481[_0x9d8b('0x2a')][_0x9d8b('0x47')]+'%'};return _0x4b0fda;})});}_0x5ad79e=_['merge']({},_0x5ad79e,_0x202481[_0x9d8b('0x38')]);return db[_0x9d8b('0x44')]['findAll'](_0x5ad79e);}})[_0x9d8b('0x18')](function(_0x170a82){if(_0x170a82){return db[_0x9d8b('0x48')][_0x9d8b('0x49')]({'where':{'id':_['map'](_0x170a82,'UserId'),'role':'agent'},'attributes':['id',_0x9d8b('0x1f'),_0x9d8b('0x4a'),'updatedAt',_0x9d8b('0x4b')]});}})['then'](function(_0x19575c){if(_0x19575c){return{'count':_0x19575c[_0x9d8b('0x15')],'rows':_[_0x9d8b('0x21')](_0x19575c[_0x9d8b('0x2c')],function(_0x56ff95){return{'membername':_0x56ff95[_0x9d8b('0x1f')],'UserId':_0x56ff95['id'],'queue_name':_0x2707b7['name'],'WhatsappQueueId':_0x2707b7['id'],'interface':util[_0x9d8b('0x4c')](_0x9d8b('0x4d'),_0x9d8b('0x4e'),_0x56ff95[_0x9d8b('0x1f')]),'penalty':0x0,'paused':_0x56ff95[_0x9d8b('0x4a')],'createdAt':_0x56ff95[_0x9d8b('0x4b')],'updatedAt':_0x56ff95[_0x9d8b('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9d8b('0x18')](respondWithFilteredResult(_0x232b99,_0x5ad79e))[_0x9d8b('0x2d')](handleError(_0x232b99,null));};exports[_0x9d8b('0x50')]=function(_0x5d07cc,_0x4064d3){var _0x2d9f35={};var _0x61e771={};var _0x35f959;var _0x2fd62a;return db[_0x9d8b('0x22')][_0x9d8b('0x43')]({'where':{'id':_0x5d07cc[_0x9d8b('0x2e')]['id']}})[_0x9d8b('0x18')](handleEntityNotFound(_0x4064d3,null))[_0x9d8b('0x18')](function(_0x5b824b){if(_0x5b824b){_0x35f959=_0x5b824b;_0x61e771['model']=_[_0x9d8b('0x30')](db[_0x9d8b('0x51')][_0x9d8b('0x23')]);_0x61e771['query']=_['keys'](_0x5d07cc['query']);_0x61e771[_0x9d8b('0x31')]=_[_0x9d8b('0x32')](_0x61e771[_0x9d8b('0x2f')],_0x61e771[_0x9d8b('0x2a')]);_0x2d9f35[_0x9d8b('0x33')]=_[_0x9d8b('0x32')](_0x61e771[_0x9d8b('0x2f')],qs[_0x9d8b('0x34')](_0x5d07cc[_0x9d8b('0x2a')][_0x9d8b('0x34')]));_0x2d9f35['attributes']=_0x2d9f35[_0x9d8b('0x33')]['length']?_0x2d9f35[_0x9d8b('0x33')]:_0x61e771[_0x9d8b('0x2f')];_0x2d9f35[_0x9d8b('0x52')]=qs[_0x9d8b('0x45')](_0x5d07cc[_0x9d8b('0x2a')][_0x9d8b('0x45')]);_0x2d9f35['where']=qs[_0x9d8b('0x31')](_[_0x9d8b('0x46')](_0x5d07cc[_0x9d8b('0x2a')],_0x61e771['filters']));if(_0x5d07cc[_0x9d8b('0x2a')][_0x9d8b('0x47')]){_0x2d9f35[_0x9d8b('0x28')]=_['merge'](_0x2d9f35['where'],{'$or':_[_0x9d8b('0x21')](_0x2d9f35[_0x9d8b('0x33')],function(_0x250caf){var _0xab61a4={};_0xab61a4[_0x250caf]={'$like':'%'+_0x5d07cc[_0x9d8b('0x2a')][_0x9d8b('0x47')]+'%'};return _0xab61a4;})});}_0x2d9f35=_[_0x9d8b('0x37')]({},_0x2d9f35,_0x5d07cc[_0x9d8b('0x38')]);return _0x35f959[_0x9d8b('0x50')](_0x2d9f35);}})['then'](function(_0x356103){if(_0x356103){_0x2fd62a=_0x356103['length'];if(!_0x5d07cc['query'][_0x9d8b('0x53')]('nolimit')){_0x2d9f35[_0x9d8b('0x14')]=qs['limit'](_0x5d07cc['query']['limit']);_0x2d9f35[_0x9d8b('0x12')]=qs['offset'](_0x5d07cc[_0x9d8b('0x2a')][_0x9d8b('0x12')]);}return _0x35f959[_0x9d8b('0x50')](_0x2d9f35);}})[_0x9d8b('0x18')](function(_0x40d77f){if(_0x40d77f){return _0x40d77f?{'count':_0x2fd62a,'rows':_0x40d77f}:null;}})[_0x9d8b('0x18')](respondWithResult(_0x4064d3,null))[_0x9d8b('0x2d')](handleError(_0x4064d3,null));};exports['addTeams']=function(_0x2512b1,_0x55201d){var _0x177b0e=_0x2512b1[_0x9d8b('0x40')][_0x9d8b('0x54')];return db[_0x9d8b('0x51')]['findAll']({'where':{'id':_0x177b0e},'attributes':['id'],'include':[{'model':db[_0x9d8b('0x48')],'as':_0x9d8b('0x55'),'attributes':['id',_0x9d8b('0x1f'),_0x9d8b('0x56'),_0x9d8b('0x57'),'interface'],'raw':!![]}]})['then'](function(_0x3d3a14){if(_0x3d3a14){var _0x12b980=_[_0x9d8b('0x58')](_0x3d3a14,function(_0x5b589a){var _0x578909=_0x5b589a['get']({'plain':!![]});return _0x578909[_0x9d8b('0x55')];});return db[_0x9d8b('0x22')][_0x9d8b('0x39')]({'where':{'id':_0x2512b1['params']['id']}})['then'](function(_0x21c9e7){return db[_0x9d8b('0x59')][_0x9d8b('0x5a')](function(_0x1777d9){return _0x21c9e7[_0x9d8b('0x5b')](_0x177b0e,{'transaction':_0x1777d9})[_0x9d8b('0x18')](function(){return BPromise[_0x9d8b('0x5c')](_0x12b980,function(_0x4b43bf){return db[_0x9d8b('0x44')][_0x9d8b('0x5d')]({'where':{'UserId':_0x4b43bf['id'],'WhatsappQueueId':_0x2512b1[_0x9d8b('0x2e')]['id']},'transaction':_0x1777d9});});})[_0x9d8b('0x18')](function(){_0x12b980[_0x9d8b('0x5e')](function(_0x10b736){socket[_0x9d8b('0x5f')](_0x9d8b('0x60'),{'UserId':_0x10b736['id'],'WhatsappQueueId':_0x21c9e7['id']});});});});});}})[_0x9d8b('0x18')](respondWithStatusCode(_0x55201d,null))[_0x9d8b('0x2d')](handleError(_0x55201d,null));};exports[_0x9d8b('0x61')]=function(_0x5d0581,_0x242d50){return db['Team'][_0x9d8b('0x2b')]({'where':{'id':_0x5d0581[_0x9d8b('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9d8b('0x48')],'as':_0x9d8b('0x55'),'attributes':['id'],'raw':!![]}]})[_0x9d8b('0x18')](handleEntityNotFound(_0x242d50,null))['then'](function(_0x3b7bc){var _0x16663d=_['map'](_0x3b7bc,'id');var _0x283c25=[];var _0x1db4c2=[];var _0x366087=squel['select']();_0x366087['field'](_0x9d8b('0x62'))[_0x9d8b('0x63')]('team_has_whatsapp_queues','tq')[_0x9d8b('0x64')](_0x9d8b('0x65'),'ut',_0x9d8b('0x66'))[_0x9d8b('0x28')]('WhatsappQueueId\x20=\x20?',_0x5d0581[_0x9d8b('0x2e')]['id']);for(var _0x2a3ede=0x0;_0x2a3ede<_0x3b7bc[_0x9d8b('0x35')];_0x2a3ede+=0x1){let _0x3ded6d=_0x3b7bc[_0x2a3ede];for(var _0x248c62=0x0;_0x248c62<_0x3ded6d[_0x9d8b('0x55')][_0x9d8b('0x35')];_0x248c62+=0x1){let _0x1a2efe=_0x3ded6d['Agents'][_0x248c62];var _0x569ad0=_0x366087['clone']();_0x569ad0[_0x9d8b('0x28')](_0x9d8b('0x67'),_0x1a2efe['id']);_0x1db4c2[_0x9d8b('0x68')](db[_0x9d8b('0x59')][_0x9d8b('0x2a')](_0x569ad0[_0x9d8b('0x69')](),{'type':db[_0x9d8b('0x59')][_0x9d8b('0x6a')][_0x9d8b('0x6b')]})[_0x9d8b('0x18')](function(_0x57d50c){if(_0x57d50c[_0x9d8b('0x35')]===0x1){return _0x1a2efe['id'];}else{var _0x238a38=_[_0x9d8b('0x6c')](_[_0x9d8b('0x21')](_0x57d50c,_0x9d8b('0x6d')),function(_0x4d8033){return _[_0x9d8b('0x6e')](_0x16663d,_0x4d8033);});if(_0x238a38){return _0x1a2efe['id'];}}}));}}return BPromise[_0x9d8b('0x6f')](_0x1db4c2)[_0x9d8b('0x18')](function(_0x570f49){_0x283c25=_(_0x283c25)[_0x9d8b('0x70')](_0x570f49)[_0x9d8b('0x71')]()['value']();return db[_0x9d8b('0x22')]['find']({'where':{'id':_0x5d0581['params']['id']}})['then'](function(_0x193e90){return db['sequelize'][_0x9d8b('0x5a')](function(_0x48c695){return _0x193e90[_0x9d8b('0x61')](_0x5d0581[_0x9d8b('0x2a')]['ids'],{'transaction':_0x48c695})[_0x9d8b('0x18')](function(){if(!_[_0x9d8b('0x72')](_0x283c25)){return _0x193e90[_0x9d8b('0x73')](_0x283c25,{'transaction':_0x48c695});}})[_0x9d8b('0x18')](function(){_0x283c25['forEach'](function(_0x18a339){socket['emit'](_0x9d8b('0x74'),{'UserId':_0x18a339,'WhatsappQueueId':_0x193e90['id']});});});});});});})[_0x9d8b('0x18')](respondWithStatusCode(_0x242d50,null))['catch'](handleError(_0x242d50,null));};exports[_0x9d8b('0x75')]=function(_0x6deda8,_0x3931b3){return db['WhatsappQueue'][_0x9d8b('0x39')]({'where':{'id':_0x6deda8[_0x9d8b('0x2e')]['id']}})[_0x9d8b('0x18')](handleEntityNotFound(_0x3931b3,null))[_0x9d8b('0x18')](function(_0x98a40c){if(_0x98a40c){return _0x98a40c['addAgents'](_0x6deda8['body'][_0x9d8b('0x54')],_[_0x9d8b('0x76')](_0x6deda8[_0x9d8b('0x40')],[_0x9d8b('0x54'),'id'])||{})[_0x9d8b('0x77')](function(_0x48aa4b){for(var _0x31e97c=0x0;_0x31e97c<_0x6deda8[_0x9d8b('0x40')][_0x9d8b('0x54')]['length'];_0x31e97c+=0x1){socket['emit'](_0x9d8b('0x60'),{'UserId':Number(_0x6deda8[_0x9d8b('0x40')][_0x9d8b('0x54')][_0x31e97c]),'WhatsappQueueId':Number(_0x6deda8[_0x9d8b('0x2e')]['id'])});}return _0x48aa4b;});}})[_0x9d8b('0x18')](respondWithResult(_0x3931b3,null))[_0x9d8b('0x2d')](handleError(_0x3931b3,null));};exports[_0x9d8b('0x73')]=function(_0x2192f7,_0x309077){return db[_0x9d8b('0x22')][_0x9d8b('0x39')]({'where':{'id':_0x2192f7['params']['id']}})[_0x9d8b('0x18')](handleEntityNotFound(_0x309077,null))[_0x9d8b('0x18')](function(_0x1ce0c7){if(_0x1ce0c7){return _0x1ce0c7[_0x9d8b('0x73')](_0x2192f7[_0x9d8b('0x2a')][_0x9d8b('0x54')])[_0x9d8b('0x18')](function(){if(_[_0x9d8b('0x78')](_0x2192f7[_0x9d8b('0x2a')][_0x9d8b('0x54')])){for(var _0x1f06c1=0x0;_0x1f06c1<_0x2192f7[_0x9d8b('0x2a')][_0x9d8b('0x54')][_0x9d8b('0x35')];_0x1f06c1+=0x1){socket[_0x9d8b('0x5f')](_0x9d8b('0x74'),{'UserId':Number(_0x2192f7[_0x9d8b('0x2a')][_0x9d8b('0x54')][_0x1f06c1]),'WhatsappQueueId':Number(_0x2192f7[_0x9d8b('0x2e')]['id'])});}}else{socket[_0x9d8b('0x5f')](_0x9d8b('0x74'),{'UserId':Number(_0x2192f7['query'][_0x9d8b('0x54')]),'WhatsappQueueId':Number(_0x2192f7['params']['id'])});}});}})[_0x9d8b('0x18')](respondWithStatusCode(_0x309077,null))[_0x9d8b('0x2d')](handleError(_0x309077,null));};exports[_0x9d8b('0x79')]=function(_0x162988,_0x460d4c){var _0x1f8437={};var _0x23aa4b={};var _0x336086;var _0x2c1876;return db['WhatsappQueue']['findOne']({'where':{'id':_0x162988[_0x9d8b('0x2e')]['id']}})[_0x9d8b('0x18')](handleEntityNotFound(_0x460d4c,null))[_0x9d8b('0x18')](function(_0x36dd8b){if(_0x36dd8b){_0x336086=_0x36dd8b;_0x23aa4b[_0x9d8b('0x2f')]=_[_0x9d8b('0x30')](db['User'][_0x9d8b('0x23')]);_0x23aa4b['query']=_[_0x9d8b('0x30')](_0x162988['query']);_0x23aa4b[_0x9d8b('0x31')]=_[_0x9d8b('0x32')](_0x23aa4b[_0x9d8b('0x2f')],_0x23aa4b['query']);_0x1f8437[_0x9d8b('0x33')]=_[_0x9d8b('0x32')](_0x23aa4b['model'],qs['fields'](_0x162988['query']['fields']));_0x1f8437['attributes']=_0x1f8437[_0x9d8b('0x33')][_0x9d8b('0x35')]?_0x1f8437['attributes']:_0x23aa4b[_0x9d8b('0x2f')];_0x1f8437['order']=qs[_0x9d8b('0x45')](_0x162988['query'][_0x9d8b('0x45')]);_0x1f8437[_0x9d8b('0x28')]=qs[_0x9d8b('0x31')](_[_0x9d8b('0x46')](_0x162988[_0x9d8b('0x2a')],_0x23aa4b['filters']));if(_0x162988[_0x9d8b('0x2a')][_0x9d8b('0x47')]){_0x1f8437[_0x9d8b('0x28')]=_[_0x9d8b('0x37')](_0x1f8437[_0x9d8b('0x28')],{'$or':_[_0x9d8b('0x21')](_0x1f8437[_0x9d8b('0x33')],function(_0x3ab3f2){var _0xbad850={};_0xbad850[_0x3ab3f2]={'$like':'%'+_0x162988[_0x9d8b('0x2a')][_0x9d8b('0x47')]+'%'};return _0xbad850;})});}_0x1f8437=_[_0x9d8b('0x37')]({},_0x1f8437,_0x162988[_0x9d8b('0x38')]);return _0x336086[_0x9d8b('0x79')](_0x1f8437);}})[_0x9d8b('0x18')](function(_0x549fd6){if(_0x549fd6){_0x2c1876=_0x549fd6[_0x9d8b('0x35')];if(!_0x162988[_0x9d8b('0x2a')]['hasOwnProperty'](_0x9d8b('0x7a'))){_0x1f8437[_0x9d8b('0x14')]=qs['limit'](_0x162988['query'][_0x9d8b('0x14')]);_0x1f8437['offset']=qs[_0x9d8b('0x12')](_0x162988['query'][_0x9d8b('0x12')]);}return _0x336086[_0x9d8b('0x79')](_0x1f8437);}})[_0x9d8b('0x18')](function(_0x33fa6b){if(_0x33fa6b){return _0x33fa6b?{'count':_0x2c1876,'rows':_0x33fa6b}:null;}})['then'](respondWithResult(_0x460d4c,null))['catch'](handleError(_0x460d4c,null));}; \ No newline at end of file +var _0x368c=['all','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','key','getOptions','include','findAll','rows','catch','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','includeAll','merge','find','create','body','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappQueueId','filter','options','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','User','Agents','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x368c,0x105));var _0xc368=function(_0x45044d,_0x3c82e5){_0x45044d=_0x45044d-0x0;var _0x23833a=_0x368c[_0x45044d];return _0x23833a;};'use strict';var BPromise=require(_0xc368('0x0'));var util=require(_0xc368('0x1'));var _=require(_0xc368('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0xc368('0x3'));var logger=require(_0xc368('0x4'))(_0xc368('0x5'));var config=require('../../config/environment');var db=require(_0xc368('0x6'))['db'];config[_0xc368('0x7')]=_[_0xc368('0x8')](config['redis'],{'host':_0xc368('0x9'),'port':0x18eb});var socket=require(_0xc368('0xa'))(new Redis(config[_0xc368('0x7')]));require(_0xc368('0xb'))[_0xc368('0xc')](socket);function respondWithStatusCode(_0x46ea75,_0x455d5f){_0x455d5f=_0x455d5f||0xcc;return function(_0x15fea9){if(_0x15fea9){return _0x46ea75[_0xc368('0xd')](_0x455d5f);}return _0x46ea75[_0xc368('0xe')](_0x455d5f)['end']();};}function respondWithResult(_0x8ba142,_0x35c692){_0x35c692=_0x35c692||0xc8;return function(_0x29bdc1){if(_0x29bdc1){return _0x8ba142[_0xc368('0xe')](_0x35c692)[_0xc368('0xf')](_0x29bdc1);}};}function respondWithFilteredResult(_0x55a1f6,_0x3a9305){return function(_0x367c95){if(_0x367c95){var _0x2c4f2b=typeof _0x3a9305[_0xc368('0x10')]===_0xc368('0x11')&&typeof _0x3a9305['limit']===_0xc368('0x11');var _0x3ab202=_0x367c95[_0xc368('0x12')];var _0x5bd84b=_0x2c4f2b?0x0:_0x3a9305[_0xc368('0x10')];var _0x224e41=_0x2c4f2b?_0x367c95['count']:_0x3a9305[_0xc368('0x10')]+_0x3a9305[_0xc368('0x13')];var _0x5e66ac;if(_0x224e41>=_0x3ab202){_0x224e41=_0x3ab202;_0x5e66ac=0xc8;}else{_0x5e66ac=0xce;}_0x55a1f6[_0xc368('0xe')](_0x5e66ac);return _0x55a1f6[_0xc368('0x14')](_0xc368('0x15'),_0x5bd84b+'-'+_0x224e41+'/'+_0x3ab202)[_0xc368('0xf')](_0x367c95);}return null;};}function saveUpdates(_0x38fce8){return function(_0x5080c6){if(_0x5080c6){return _0x5080c6['update'](_0x38fce8)[_0xc368('0x16')](function(_0x1882ed){return _0x1882ed;});}return null;};}function removeEntity(_0x12fc5b){return function(_0x5e2665){if(_0x5e2665){return _0x5e2665['destroy']()[_0xc368('0x16')](function(){var _0x1ef20e=_0x5e2665[_0xc368('0x17')]({'plain':!![]});var _0x59b286='WhatsappQueues';return db[_0xc368('0x18')][_0xc368('0x19')]({'where':{'type':_0x59b286,'resourceId':_0x1ef20e['id']}})[_0xc368('0x16')](function(){return _0x5e2665;});})[_0xc368('0x16')](function(){_0x12fc5b[_0xc368('0xe')](0xcc)[_0xc368('0x1a')]();});}};}function handleEntityNotFound(_0xe6b272){return function(_0x33b686){if(!_0x33b686){_0xe6b272['sendStatus'](0x194);}return _0x33b686;};}function handleError(_0x507f12,_0x40634f){_0x40634f=_0x40634f||0x1f4;return function(_0x1b398c){logger[_0xc368('0x1b')](_0x1b398c[_0xc368('0x1c')]);if(_0x1b398c['name']){delete _0x1b398c[_0xc368('0x1d')];}_0x507f12[_0xc368('0xe')](_0x40634f)[_0xc368('0x1e')](_0x1b398c);};}exports[_0xc368('0x1f')]=function(_0xce9a2,_0x30389b){var _0x4b3581={};var _0x27ec75={'count':0x0,'rows':[]};var _0x4a86aa=_[_0xc368('0x20')](db[_0xc368('0x21')]['rawAttributes'],function(_0x3968c4){return{'name':_0x3968c4[_0xc368('0x22')],'type':_0x3968c4[_0xc368('0x23')][_0xc368('0x24')]};});_0x4b3581=qs[_0xc368('0x25')](_0x4a86aa,_0xce9a2);var _0x3e3deb={'where':_0x4b3581['where']};return db[_0xc368('0x21')][_0xc368('0x12')](_0x3e3deb)['then'](function(_0x3dd01a){_0x27ec75['count']=_0x3dd01a;_0x4b3581[_0xc368('0x26')]=qs['include'](_0xce9a2['query']);return db['WhatsappQueue'][_0xc368('0x27')](_0x4b3581);})[_0xc368('0x16')](function(_0x1184a9){_0x27ec75[_0xc368('0x28')]=_0x1184a9;return _0x27ec75;})['then'](respondWithFilteredResult(_0x30389b,_0x4b3581))[_0xc368('0x29')](handleError(_0x30389b,null));};exports[_0xc368('0x2a')]=function(_0x272eb5,_0x5620a2){var _0x2fe7ad={'raw':!![],'where':{'id':_0x272eb5[_0xc368('0x2b')]['id']}},_0x258f11={};_0x258f11[_0xc368('0x2c')]=_[_0xc368('0x2d')](db[_0xc368('0x21')][_0xc368('0x2e')]);_0x258f11['query']=_['keys'](_0x272eb5[_0xc368('0x2f')]);_0x258f11[_0xc368('0x30')]=_[_0xc368('0x31')](_0x258f11[_0xc368('0x2c')],_0x258f11[_0xc368('0x2f')]);_0x2fe7ad['attributes']=_[_0xc368('0x31')](_0x258f11[_0xc368('0x2c')],qs[_0xc368('0x32')](_0x272eb5[_0xc368('0x2f')][_0xc368('0x32')]));_0x2fe7ad[_0xc368('0x33')]=_0x2fe7ad['attributes']['length']?_0x2fe7ad[_0xc368('0x33')]:_0x258f11['model'];if(_0x272eb5[_0xc368('0x2f')][_0xc368('0x34')]){_0x2fe7ad['include']=[{'all':!![]}];}_0x2fe7ad=_[_0xc368('0x35')]({},_0x2fe7ad,_0x272eb5['options']);return db[_0xc368('0x21')][_0xc368('0x36')](_0x2fe7ad)[_0xc368('0x16')](handleEntityNotFound(_0x5620a2,null))[_0xc368('0x16')](respondWithResult(_0x5620a2,null))[_0xc368('0x29')](handleError(_0x5620a2,null));};exports[_0xc368('0x37')]=function(_0x332b97,_0x5e99ba){return db[_0xc368('0x21')][_0xc368('0x37')](_0x332b97[_0xc368('0x38')],{})[_0xc368('0x16')](function(_0x2badb8){var _0x22e6f2=_0x332b97['user'][_0xc368('0x17')]({'plain':!![]});if(!_0x22e6f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22e6f2[_0xc368('0x39')]==='user'){var _0x3bd007=_0x2badb8[_0xc368('0x17')]({'plain':!![]});var _0x7197da=_0xc368('0x3a');return db[_0xc368('0x3b')][_0xc368('0x36')]({'where':{'name':_0x7197da,'userProfileId':_0x22e6f2[_0xc368('0x3c')]},'raw':!![]})[_0xc368('0x16')](function(_0x30143c){if(_0x30143c&&_0x30143c[_0xc368('0x3d')]===0x0){return db[_0xc368('0x18')][_0xc368('0x37')]({'name':_0x3bd007[_0xc368('0x1d')],'resourceId':_0x3bd007['id'],'type':_0x30143c[_0xc368('0x1d')],'sectionId':_0x30143c['id']},{})[_0xc368('0x16')](function(){return _0x2badb8;});}else{return _0x2badb8;}})[_0xc368('0x29')](function(_0x4563aa){logger[_0xc368('0x1b')](_0xc368('0x3e'),_0x4563aa);throw _0x4563aa;});}return _0x2badb8;})['then'](respondWithResult(_0x5e99ba,0xc9))[_0xc368('0x29')](handleError(_0x5e99ba,null));};exports[_0xc368('0x3f')]=function(_0x6f660b,_0x35ce0b){if(_0x6f660b[_0xc368('0x38')]['id']){delete _0x6f660b[_0xc368('0x38')]['id'];}return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x6f660b['params']['id']}})[_0xc368('0x16')](handleEntityNotFound(_0x35ce0b,null))[_0xc368('0x16')](saveUpdates(_0x6f660b[_0xc368('0x38')],null))['then'](respondWithResult(_0x35ce0b,null))[_0xc368('0x29')](handleError(_0x35ce0b,null));};exports['destroy']=function(_0x55e5b6,_0xb4e382){return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x55e5b6['params']['id']}})[_0xc368('0x16')](handleEntityNotFound(_0xb4e382,null))[_0xc368('0x16')](removeEntity(_0xb4e382,null))['catch'](handleError(_0xb4e382,null));};exports[_0xc368('0x40')]=function(_0x5917f4,_0x1af038){return db[_0xc368('0x21')][_0xc368('0x40')]()[_0xc368('0x16')](respondWithResult(_0x1af038,null))[_0xc368('0x29')](handleError(_0x1af038,null));};exports[_0xc368('0x41')]=function(_0x19b689,_0x382a49){var _0x25bef4={'raw':!![],'where':{}},_0x5bc7fb={},_0x184409;return db['WhatsappQueue'][_0xc368('0x42')]({'where':{'id':_0x19b689[_0xc368('0x2b')]['id']}})[_0xc368('0x16')](handleEntityNotFound(_0x382a49,null))['then'](function(_0x41a512){if(_0x41a512){_0x184409=_0x41a512['get']({'plain':!![]});_0x5bc7fb[_0xc368('0x2c')]=_[_0xc368('0x2d')](db[_0xc368('0x43')][_0xc368('0x2e')]);_0x5bc7fb[_0xc368('0x2f')]=_[_0xc368('0x2d')](_0x19b689[_0xc368('0x2f')]);_0x5bc7fb[_0xc368('0x30')]=_[_0xc368('0x31')](_0x5bc7fb['model'],_0x5bc7fb[_0xc368('0x2f')]);_0x25bef4[_0xc368('0x33')]=_[_0xc368('0x31')](_0x5bc7fb[_0xc368('0x2c')],qs[_0xc368('0x32')](_0x19b689[_0xc368('0x2f')]['fields']));_0x25bef4['attributes']=_0x25bef4[_0xc368('0x33')][_0xc368('0x44')]?_0x25bef4[_0xc368('0x33')]:_0x5bc7fb[_0xc368('0x2c')];if(!_0x19b689[_0xc368('0x2f')][_0xc368('0x45')](_0xc368('0x46'))){_0x25bef4[_0xc368('0x13')]=qs[_0xc368('0x13')](_0x19b689['query'][_0xc368('0x13')]);_0x25bef4[_0xc368('0x10')]=qs[_0xc368('0x10')](_0x19b689[_0xc368('0x2f')][_0xc368('0x10')]);}_0x25bef4[_0xc368('0x47')]=qs[_0xc368('0x48')](_0x19b689[_0xc368('0x2f')][_0xc368('0x48')]);_0x25bef4[_0xc368('0x49')]=qs['filters'](_[_0xc368('0x4a')](_0x19b689[_0xc368('0x2f')],_0x5bc7fb['filters']));_0x25bef4[_0xc368('0x49')][_0xc368('0x4b')]=_0x41a512['id'];if(_0x19b689[_0xc368('0x2f')][_0xc368('0x4c')]){_0x25bef4[_0xc368('0x49')]=_['merge'](_0x25bef4['where'],{'$or':_['map'](_0x25bef4[_0xc368('0x33')],function(_0x4b7742){var _0x385be2={};_0x385be2[_0x4b7742]={'$like':'%'+_0x19b689['query']['filter']+'%'};return _0x385be2;})});}_0x25bef4=_['merge']({},_0x25bef4,_0x19b689[_0xc368('0x4d')]);return db[_0xc368('0x43')]['findAll'](_0x25bef4);}})[_0xc368('0x16')](function(_0x1af076){if(_0x1af076){return db['User'][_0xc368('0x4e')]({'where':{'id':_['map'](_0x1af076,_0xc368('0x4f')),'role':_0xc368('0x50')},'attributes':['id',_0xc368('0x1d'),_0xc368('0x51'),_0xc368('0x52'),_0xc368('0x53')]});}})[_0xc368('0x16')](function(_0x5e2e6a){if(_0x5e2e6a){return{'count':_0x5e2e6a[_0xc368('0x12')],'rows':_[_0xc368('0x20')](_0x5e2e6a['rows'],function(_0x68ae50){return{'membername':_0x68ae50[_0xc368('0x1d')],'UserId':_0x68ae50['id'],'queue_name':_0x184409['name'],'WhatsappQueueId':_0x184409['id'],'interface':util[_0xc368('0x54')](_0xc368('0x55'),'SIP',_0x68ae50[_0xc368('0x1d')]),'penalty':0x0,'paused':_0x68ae50['whatsappPause'],'createdAt':_0x68ae50['createdAt'],'updatedAt':_0x68ae50['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x382a49,_0x25bef4))[_0xc368('0x29')](handleError(_0x382a49,null));};exports[_0xc368('0x56')]=function(_0x2dbfb9,_0x1f57ca){var _0x269496={};var _0x3907b3={};var _0x4e6ce1;var _0x35791d;return db[_0xc368('0x21')][_0xc368('0x42')]({'where':{'id':_0x2dbfb9['params']['id']}})[_0xc368('0x16')](handleEntityNotFound(_0x1f57ca,null))[_0xc368('0x16')](function(_0x4daaaa){if(_0x4daaaa){_0x4e6ce1=_0x4daaaa;_0x3907b3[_0xc368('0x2c')]=_['keys'](db[_0xc368('0x57')][_0xc368('0x2e')]);_0x3907b3['query']=_[_0xc368('0x2d')](_0x2dbfb9['query']);_0x3907b3[_0xc368('0x30')]=_[_0xc368('0x31')](_0x3907b3[_0xc368('0x2c')],_0x3907b3[_0xc368('0x2f')]);_0x269496[_0xc368('0x33')]=_[_0xc368('0x31')](_0x3907b3['model'],qs['fields'](_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x32')]));_0x269496[_0xc368('0x33')]=_0x269496[_0xc368('0x33')][_0xc368('0x44')]?_0x269496[_0xc368('0x33')]:_0x3907b3['model'];_0x269496[_0xc368('0x47')]=qs[_0xc368('0x48')](_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x48')]);_0x269496['where']=qs[_0xc368('0x30')](_[_0xc368('0x4a')](_0x2dbfb9['query'],_0x3907b3[_0xc368('0x30')]));if(_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x4c')]){_0x269496[_0xc368('0x49')]=_[_0xc368('0x35')](_0x269496[_0xc368('0x49')],{'$or':_[_0xc368('0x20')](_0x269496['attributes'],function(_0x51e6ac){var _0x185dbb={};_0x185dbb[_0x51e6ac]={'$like':'%'+_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x4c')]+'%'};return _0x185dbb;})});}_0x269496=_[_0xc368('0x35')]({},_0x269496,_0x2dbfb9[_0xc368('0x4d')]);return _0x4e6ce1[_0xc368('0x56')](_0x269496);}})[_0xc368('0x16')](function(_0x3c4e9a){if(_0x3c4e9a){_0x35791d=_0x3c4e9a[_0xc368('0x44')];if(!_0x2dbfb9['query'][_0xc368('0x45')](_0xc368('0x46'))){_0x269496[_0xc368('0x13')]=qs[_0xc368('0x13')](_0x2dbfb9[_0xc368('0x2f')]['limit']);_0x269496['offset']=qs['offset'](_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x10')]);}return _0x4e6ce1[_0xc368('0x56')](_0x269496);}})[_0xc368('0x16')](function(_0x466b7e){if(_0x466b7e){return _0x466b7e?{'count':_0x35791d,'rows':_0x466b7e}:null;}})['then'](respondWithResult(_0x1f57ca,null))[_0xc368('0x29')](handleError(_0x1f57ca,null));};exports[_0xc368('0x58')]=function(_0x90c192,_0xbb0d6d){var _0xa1aff0=_0x90c192[_0xc368('0x38')][_0xc368('0x59')];return db['Team'][_0xc368('0x27')]({'where':{'id':_0xa1aff0},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xc368('0x1d'),_0xc368('0x5a'),_0xc368('0x5b'),_0xc368('0x5c')],'raw':!![]}]})['then'](function(_0x53deff){if(_0x53deff){var _0x5c997e=_[_0xc368('0x5d')](_0x53deff,function(_0x4c5ac4){var _0x575b4b=_0x4c5ac4[_0xc368('0x17')]({'plain':!![]});return _0x575b4b['Agents'];});return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x90c192[_0xc368('0x2b')]['id']}})['then'](function(_0x2ec6e7){return db['sequelize'][_0xc368('0x5e')](function(_0x448c02){return _0x2ec6e7[_0xc368('0x58')](_0xa1aff0,{'transaction':_0x448c02})[_0xc368('0x16')](function(){return BPromise[_0xc368('0x5f')](_0x5c997e,function(_0x261d37){return db[_0xc368('0x43')][_0xc368('0x60')]({'where':{'UserId':_0x261d37['id'],'WhatsappQueueId':_0x90c192[_0xc368('0x2b')]['id']},'transaction':_0x448c02});});})[_0xc368('0x16')](function(){_0x5c997e[_0xc368('0x61')](function(_0x280add){socket[_0xc368('0x62')](_0xc368('0x63'),{'UserId':_0x280add['id'],'WhatsappQueueId':_0x2ec6e7['id']});});});});});}})[_0xc368('0x16')](respondWithStatusCode(_0xbb0d6d,null))[_0xc368('0x29')](handleError(_0xbb0d6d,null));};exports[_0xc368('0x64')]=function(_0x50cca4,_0x3ca749){return db[_0xc368('0x57')]['findAll']({'where':{'id':_0x50cca4[_0xc368('0x2f')][_0xc368('0x59')]},'attributes':['id'],'include':[{'model':db[_0xc368('0x65')],'as':_0xc368('0x66'),'attributes':['id'],'raw':!![]}]})[_0xc368('0x16')](handleEntityNotFound(_0x3ca749,null))[_0xc368('0x16')](function(_0x223fe5){var _0x135963=_[_0xc368('0x20')](_0x223fe5,'id');var _0x3ed3db=[];var _0x41585d=[];var _0x200b81=squel['select']();_0x200b81['field'](_0xc368('0x67'))['from'](_0xc368('0x68'),'tq')[_0xc368('0x69')]('user_has_teams','ut',_0xc368('0x6a'))[_0xc368('0x49')]('WhatsappQueueId\x20=\x20?',_0x50cca4['params']['id']);for(var _0x325beb=0x0;_0x325beb<_0x223fe5[_0xc368('0x44')];_0x325beb+=0x1){let _0x2b1619=_0x223fe5[_0x325beb];for(var _0x45eae1=0x0;_0x45eae1<_0x2b1619['Agents']['length'];_0x45eae1+=0x1){let _0x46cad7=_0x2b1619['Agents'][_0x45eae1];var _0x24842c=_0x200b81[_0xc368('0x6b')]();_0x24842c[_0xc368('0x49')](_0xc368('0x6c'),_0x46cad7['id']);_0x41585d[_0xc368('0x6d')](db[_0xc368('0x6e')][_0xc368('0x2f')](_0x24842c[_0xc368('0x6f')](),{'type':db[_0xc368('0x6e')][_0xc368('0x70')][_0xc368('0x71')]})['then'](function(_0x231dd3){if(_0x231dd3[_0xc368('0x44')]===0x1){return _0x46cad7['id'];}else{var _0x5f3aa5=_[_0xc368('0x72')](_[_0xc368('0x20')](_0x231dd3,_0xc368('0x73')),function(_0x40721c){return _[_0xc368('0x74')](_0x135963,_0x40721c);});if(_0x5f3aa5){return _0x46cad7['id'];}}}));}}return BPromise[_0xc368('0x75')](_0x41585d)[_0xc368('0x16')](function(_0x5338ea){_0x3ed3db=_(_0x3ed3db)['union'](_0x5338ea)['compact']()[_0xc368('0x76')]();return db[_0xc368('0x21')]['find']({'where':{'id':_0x50cca4['params']['id']}})[_0xc368('0x16')](function(_0xa3cc81){return db[_0xc368('0x6e')][_0xc368('0x5e')](function(_0x104fcf){return _0xa3cc81[_0xc368('0x64')](_0x50cca4['query'][_0xc368('0x59')],{'transaction':_0x104fcf})[_0xc368('0x16')](function(){if(!_[_0xc368('0x77')](_0x3ed3db)){return _0xa3cc81[_0xc368('0x78')](_0x3ed3db,{'transaction':_0x104fcf});}})['then'](function(){_0x3ed3db['forEach'](function(_0x2dff67){socket[_0xc368('0x62')](_0xc368('0x79'),{'UserId':_0x2dff67,'WhatsappQueueId':_0xa3cc81['id']});});});});});});})['then'](respondWithStatusCode(_0x3ca749,null))[_0xc368('0x29')](handleError(_0x3ca749,null));};exports[_0xc368('0x7a')]=function(_0x25324d,_0x1e9745){return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x25324d[_0xc368('0x2b')]['id']}})[_0xc368('0x16')](handleEntityNotFound(_0x1e9745,null))[_0xc368('0x16')](function(_0x23cddb){if(_0x23cddb){return _0x23cddb[_0xc368('0x7a')](_0x25324d[_0xc368('0x38')][_0xc368('0x59')],_['omit'](_0x25324d['body'],['ids','id'])||{})[_0xc368('0x7b')](function(_0x82e6e2){for(var _0xb5cafa=0x0;_0xb5cafa<_0x25324d[_0xc368('0x38')][_0xc368('0x59')]['length'];_0xb5cafa+=0x1){socket[_0xc368('0x62')]('userWhatsappQueue:save',{'UserId':Number(_0x25324d['body'][_0xc368('0x59')][_0xb5cafa]),'WhatsappQueueId':Number(_0x25324d[_0xc368('0x2b')]['id'])});}return _0x82e6e2;});}})['then'](respondWithResult(_0x1e9745,null))['catch'](handleError(_0x1e9745,null));};exports[_0xc368('0x78')]=function(_0x1e7450,_0x36df2c){return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x1e7450[_0xc368('0x2b')]['id']}})['then'](handleEntityNotFound(_0x36df2c,null))[_0xc368('0x16')](function(_0x429dcd){if(_0x429dcd){return _0x429dcd['removeAgents'](_0x1e7450[_0xc368('0x2f')][_0xc368('0x59')])[_0xc368('0x16')](function(){if(_[_0xc368('0x7c')](_0x1e7450[_0xc368('0x2f')][_0xc368('0x59')])){for(var _0x217752=0x0;_0x217752<_0x1e7450[_0xc368('0x2f')][_0xc368('0x59')][_0xc368('0x44')];_0x217752+=0x1){socket[_0xc368('0x62')](_0xc368('0x79'),{'UserId':Number(_0x1e7450[_0xc368('0x2f')][_0xc368('0x59')][_0x217752]),'WhatsappQueueId':Number(_0x1e7450[_0xc368('0x2b')]['id'])});}}else{socket[_0xc368('0x62')](_0xc368('0x79'),{'UserId':Number(_0x1e7450['query'][_0xc368('0x59')]),'WhatsappQueueId':Number(_0x1e7450[_0xc368('0x2b')]['id'])});}});}})[_0xc368('0x16')](respondWithStatusCode(_0x36df2c,null))[_0xc368('0x29')](handleError(_0x36df2c,null));};exports[_0xc368('0x7d')]=function(_0x211779,_0x41a60e){var _0xad78dd={};var _0x237f7e={};var _0x1788d9;var _0x1da77d;return db[_0xc368('0x21')][_0xc368('0x42')]({'where':{'id':_0x211779[_0xc368('0x2b')]['id']}})['then'](handleEntityNotFound(_0x41a60e,null))[_0xc368('0x16')](function(_0x1f8ef5){if(_0x1f8ef5){_0x1788d9=_0x1f8ef5;_0x237f7e[_0xc368('0x2c')]=_[_0xc368('0x2d')](db[_0xc368('0x65')][_0xc368('0x2e')]);_0x237f7e[_0xc368('0x2f')]=_[_0xc368('0x2d')](_0x211779['query']);_0x237f7e[_0xc368('0x30')]=_['intersection'](_0x237f7e[_0xc368('0x2c')],_0x237f7e['query']);_0xad78dd['attributes']=_['intersection'](_0x237f7e['model'],qs[_0xc368('0x32')](_0x211779[_0xc368('0x2f')]['fields']));_0xad78dd['attributes']=_0xad78dd['attributes'][_0xc368('0x44')]?_0xad78dd[_0xc368('0x33')]:_0x237f7e[_0xc368('0x2c')];_0xad78dd[_0xc368('0x47')]=qs[_0xc368('0x48')](_0x211779[_0xc368('0x2f')][_0xc368('0x48')]);_0xad78dd[_0xc368('0x49')]=qs[_0xc368('0x30')](_[_0xc368('0x4a')](_0x211779['query'],_0x237f7e[_0xc368('0x30')]));if(_0x211779['query'][_0xc368('0x4c')]){_0xad78dd[_0xc368('0x49')]=_[_0xc368('0x35')](_0xad78dd['where'],{'$or':_['map'](_0xad78dd[_0xc368('0x33')],function(_0x419225){var _0x4a6b6f={};_0x4a6b6f[_0x419225]={'$like':'%'+_0x211779[_0xc368('0x2f')]['filter']+'%'};return _0x4a6b6f;})});}_0xad78dd=_[_0xc368('0x35')]({},_0xad78dd,_0x211779['options']);return _0x1788d9[_0xc368('0x7d')](_0xad78dd);}})[_0xc368('0x16')](function(_0x993390){if(_0x993390){_0x1da77d=_0x993390['length'];if(!_0x211779['query'][_0xc368('0x45')]('nolimit')){_0xad78dd[_0xc368('0x13')]=qs[_0xc368('0x13')](_0x211779[_0xc368('0x2f')][_0xc368('0x13')]);_0xad78dd[_0xc368('0x10')]=qs[_0xc368('0x10')](_0x211779[_0xc368('0x2f')]['offset']);}return _0x1788d9[_0xc368('0x7d')](_0xad78dd);}})['then'](function(_0x2833d8){if(_0x2833d8){return _0x2833d8?{'count':_0x1da77d,'rows':_0x2833d8}:null;}})[_0xc368('0x16')](respondWithResult(_0x41a60e,null))[_0xc368('0x29')](handleError(_0x41a60e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 3f643e6..d84dceb 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 _0x7e42=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x155731,_0x3366d5){var _0xe2ffd0=function(_0x3f3925){while(--_0x3f3925){_0x155731['push'](_0x155731['shift']());}};_0xe2ffd0(++_0x3366d5);}(_0x7e42,0x1ca));var _0x27e4=function(_0x542bbf,_0x1f5a5b){_0x542bbf=_0x542bbf-0x0;var _0x167d36=_0x7e42[_0x542bbf];return _0x167d36;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x27e4('0x0'))['db'][_0x27e4('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x27e4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x27e4('0x3'),'afterDestroy':_0x27e4('0x4')};function emitEvent(_0x1ba3fa){return function(_0x5d6fc2,_0x27e343,_0x1f6903){WhatsappQueueEvents[_0x27e4('0x5')](_0x1ba3fa+':'+_0x5d6fc2['id'],_0x5d6fc2);WhatsappQueueEvents[_0x27e4('0x5')](_0x1ba3fa,_0x5d6fc2);_0x1f6903(null);};}for(var e in events){if(events[_0x27e4('0x6')](e)){var event=events[e];WhatsappQueue[_0x27e4('0x7')](e,emitEvent(event));}}module[_0x27e4('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x22b6=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','save','update','remove'];(function(_0x1280ce,_0x3c779a){var _0x13d2e7=function(_0x40ee0a){while(--_0x40ee0a){_0x1280ce['push'](_0x1280ce['shift']());}};_0x13d2e7(++_0x3c779a);}(_0x22b6,0x180));var _0x622b=function(_0x5aafe4,_0x6b5bd3){_0x5aafe4=_0x5aafe4-0x0;var _0x84f41b=_0x22b6[_0x5aafe4];return _0x84f41b;};'use strict';var EventEmitter=require(_0x622b('0x0'));var WhatsappQueue=require(_0x622b('0x1'))['db'][_0x622b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x622b('0x3'),'afterUpdate':_0x622b('0x4'),'afterDestroy':_0x622b('0x5')};function emitEvent(_0x5c0307){return function(_0x68f54e,_0x25a5d9,_0x2794bc){WhatsappQueueEvents[_0x622b('0x6')](_0x5c0307+':'+_0x68f54e['id'],_0x68f54e);WhatsappQueueEvents[_0x622b('0x6')](_0x5c0307,_0x68f54e);_0x2794bc(null);};}for(var e in events){if(events[_0x622b('0x7')](e)){var event=events[e];WhatsappQueue[_0x622b('0x8')](e,emitEvent(event));}}module[_0x622b('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 547a183..6b909c7 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 _0x4700=['request-promise','./whatsappQueue.attributes','exports','whatsapp_queues','lodash','util','api'];(function(_0x25d494,_0xad99ef){var _0x56b739=function(_0x435345){while(--_0x435345){_0x25d494['push'](_0x25d494['shift']());}};_0x56b739(++_0xad99ef);}(_0x4700,0x1a1));var _0x0470=function(_0x3eff9c,_0x3ffe0c){_0x3eff9c=_0x3eff9c-0x0;var _0x102fca=_0x4700[_0x3eff9c];return _0x102fca;};'use strict';var _=require(_0x0470('0x0'));var util=require(_0x0470('0x1'));var logger=require('../../config/logger')(_0x0470('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0470('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0470('0x4'));module[_0x0470('0x5')]=function(_0x227c7b,_0x5c6389){return _0x227c7b['define']('WhatsappQueue',attributes,{'tableName':_0x0470('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x973b=['path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x51864f,_0x14f917){var _0x22dda3=function(_0x2c060e){while(--_0x2c060e){_0x51864f['push'](_0x51864f['shift']());}};_0x22dda3(++_0x14f917);}(_0x973b,0x93));var _0xb973=function(_0x285bb8,_0x4d2705){_0x285bb8=_0x285bb8-0x0;var _0x32138d=_0x973b[_0x285bb8];return _0x32138d;};'use strict';var _=require(_0xb973('0x0'));var util=require(_0xb973('0x1'));var logger=require(_0xb973('0x2'))(_0xb973('0x3'));var moment=require(_0xb973('0x4'));var BPromise=require(_0xb973('0x5'));var rp=require(_0xb973('0x6'));var fs=require('fs');var path=require(_0xb973('0x7'));var rimraf=require('rimraf');var config=require(_0xb973('0x8'));var attributes=require(_0xb973('0x9'));module[_0xb973('0xa')]=function(_0x30250d,_0x18a45a){return _0x30250d[_0xb973('0xb')](_0xb973('0xc'),attributes,{'tableName':_0xb973('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index e8baac9..70c3476 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 _0x0721=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include','map','model','debug','find','raw','where','ShowWhatsappQueue','lodash','moment','bluebird'];(function(_0x3b7738,_0x5e8a15){var _0x311dc9=function(_0x2340fc){while(--_0x2340fc){_0x3b7738['push'](_0x3b7738['shift']());}};_0x311dc9(++_0x5e8a15);}(_0x0721,0x1d1));var _0x1072=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0x0721[_0x57a50d];return _0x1b25b3;};'use strict';var _=require(_0x1072('0x0'));var util=require('util');var moment=require(_0x1072('0x1'));var BPromise=require(_0x1072('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1072('0x3'))['db'];var utils=require(_0x1072('0x4'));var logger=require(_0x1072('0x5'))(_0x1072('0x6'));var config=require(_0x1072('0x7'));var jayson=require(_0x1072('0x8'));var client=jayson[_0x1072('0x9')]['http']({'port':0x232a});config[_0x1072('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1072('0xb'))(new Redis(config[_0x1072('0xa')]));require(_0x1072('0xc'))[_0x1072('0xd')](socket);function respondWithRpcPromise(_0x561f43,_0x113771,_0x584f69){return new BPromise(function(_0x3eefe9,_0x30a17b){return client[_0x1072('0xe')](_0x561f43,_0x584f69)[_0x1072('0xf')](function(_0x376a91){logger[_0x1072('0x10')](_0x1072('0x11'),_0x113771,_0x1072('0x12'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x113771,_0x1072('0x12'),JSON[_0x1072('0x13')](_0x376a91));if(_0x376a91[_0x1072('0x14')]){if(_0x376a91['error'][_0x1072('0x15')]===0x1f4){logger['error'](_0x1072('0x11'),_0x113771,_0x376a91[_0x1072('0x14')][_0x1072('0x16')]);return _0x30a17b(_0x376a91['error'][_0x1072('0x16')]);}logger['error'](_0x1072('0x11'),_0x113771,_0x376a91[_0x1072('0x14')][_0x1072('0x16')]);return _0x3eefe9(_0x376a91['error']['message']);}else{logger[_0x1072('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x113771,'request\x20sent');_0x3eefe9(_0x376a91[_0x1072('0x17')]['message']);}})[_0x1072('0x18')](function(_0x561bcd){logger[_0x1072('0x14')](_0x1072('0x11'),_0x113771,_0x561bcd);_0x30a17b(_0x561bcd);});});}exports[_0x1072('0x19')]=function(_0x4fb1a5){var _0x3bf439=this;return new Promise(function(_0x3af584,_0x1bdba9){return db[_0x1072('0x1a')][_0x1072('0x1b')]({'raw':_0x4fb1a5[_0x1072('0x1c')]?_0x4fb1a5[_0x1072('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4fb1a5[_0x1072('0x1c')]?_0x4fb1a5[_0x1072('0x1c')]['where']||null:null,'attributes':_0x4fb1a5[_0x1072('0x1c')]?_0x4fb1a5[_0x1072('0x1c')][_0x1072('0x1d')]||null:null,'limit':_0x4fb1a5['options']?_0x4fb1a5['options'][_0x1072('0x1e')]||null:null,'include':_0x4fb1a5['options']?_0x4fb1a5[_0x1072('0x1c')][_0x1072('0x1f')]?_[_0x1072('0x20')](_0x4fb1a5[_0x1072('0x1c')][_0x1072('0x1f')],function(_0x4e14f4){return{'model':db[_0x4e14f4[_0x1072('0x21')]],'as':_0x4e14f4['as'],'attributes':_0x4e14f4[_0x1072('0x1d')],'include':_0x4e14f4['include']?_['map'](_0x4e14f4[_0x1072('0x1f')],function(_0x4c1da3){return{'model':db[_0x4c1da3[_0x1072('0x21')]],'as':_0x4c1da3['as'],'attributes':_0x4c1da3['attributes'],'include':_0x4c1da3[_0x1072('0x1f')]?_[_0x1072('0x20')](_0x4c1da3[_0x1072('0x1f')],function(_0x5152df){return{'model':db[_0x5152df[_0x1072('0x21')]],'as':_0x5152df['as'],'attributes':_0x5152df[_0x1072('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1072('0xf')](function(_0xe3e854){logger[_0x1072('0x10')](_0x1072('0x19'),_0x4fb1a5);logger[_0x1072('0x22')]('GetWhatsappQueue',_0x4fb1a5,JSON[_0x1072('0x13')](_0xe3e854));_0x3af584(_0xe3e854);})[_0x1072('0x18')](function(_0x1dc9d4){logger[_0x1072('0x14')](_0x1072('0x19'),_0x1dc9d4[_0x1072('0x16')],_0x4fb1a5);_0x1bdba9(_0x3bf439['error'](0x1f4,_0x1dc9d4[_0x1072('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x24f8fe){var _0x5a0ed4=this;return new Promise(function(_0x56bbd5,_0x2bb002){return db['WhatsappQueue'][_0x1072('0x23')]({'raw':_0x24f8fe[_0x1072('0x1c')]?_0x24f8fe[_0x1072('0x1c')][_0x1072('0x24')]===undefined?!![]:![]:!![],'where':_0x24f8fe[_0x1072('0x1c')]?_0x24f8fe[_0x1072('0x1c')][_0x1072('0x25')]||null:null,'attributes':_0x24f8fe[_0x1072('0x1c')]?_0x24f8fe[_0x1072('0x1c')][_0x1072('0x1d')]||null:null,'include':_0x24f8fe[_0x1072('0x1c')]?_0x24f8fe[_0x1072('0x1c')]['include']?_[_0x1072('0x20')](_0x24f8fe[_0x1072('0x1c')][_0x1072('0x1f')],function(_0x8efeb7){return{'model':db[_0x8efeb7[_0x1072('0x21')]],'as':_0x8efeb7['as'],'attributes':_0x8efeb7[_0x1072('0x1d')],'include':_0x8efeb7[_0x1072('0x1f')]?_['map'](_0x8efeb7['include'],function(_0x234f6b){return{'model':db[_0x234f6b[_0x1072('0x21')]],'as':_0x234f6b['as'],'attributes':_0x234f6b[_0x1072('0x1d')],'include':_0x234f6b['include']?_['map'](_0x234f6b[_0x1072('0x1f')],function(_0x53f180){return{'model':db[_0x53f180[_0x1072('0x21')]],'as':_0x53f180['as'],'attributes':_0x53f180[_0x1072('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1072('0xf')](function(_0x3e22aa){logger[_0x1072('0x10')](_0x1072('0x26'),_0x24f8fe);logger[_0x1072('0x22')](_0x1072('0x26'),_0x24f8fe,JSON[_0x1072('0x13')](_0x3e22aa));_0x56bbd5(_0x3e22aa);})[_0x1072('0x18')](function(_0x31fde3){logger[_0x1072('0x14')](_0x1072('0x26'),_0x31fde3[_0x1072('0x16')],_0x24f8fe);_0x2bb002(_0x5a0ed4[_0x1072('0x14')](0x1f4,_0x31fde3[_0x1072('0x16')]));});});}; \ No newline at end of file +var _0x6fbb=['include','model','map','GetWhatsappQueue','find','ShowWhatsappQueue','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','WhatsappQueue','findAll','options','raw','where','attributes'];(function(_0x1c7743,_0x7e59f9){var _0x168347=function(_0x886a9b){while(--_0x886a9b){_0x1c7743['push'](_0x1c7743['shift']());}};_0x168347(++_0x7e59f9);}(_0x6fbb,0x1be));var _0xb6fb=function(_0x530a71,_0xeca2c2){_0x530a71=_0x530a71-0x0;var _0x16d1f8=_0x6fbb[_0x530a71];return _0x16d1f8;};'use strict';var _=require('lodash');var util=require(_0xb6fb('0x0'));var moment=require(_0xb6fb('0x1'));var BPromise=require(_0xb6fb('0x2'));var rs=require(_0xb6fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb6fb('0x4'));var logger=require(_0xb6fb('0x5'))(_0xb6fb('0x6'));var config=require(_0xb6fb('0x7'));var jayson=require(_0xb6fb('0x8'));var client=jayson[_0xb6fb('0x9')][_0xb6fb('0xa')]({'port':0x232a});config[_0xb6fb('0xb')]=_[_0xb6fb('0xc')](config[_0xb6fb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb6fb('0xd'))(new Redis(config[_0xb6fb('0xb')]));require(_0xb6fb('0xe'))[_0xb6fb('0xf')](socket);function respondWithRpcPromise(_0x2827b6,_0x32a447,_0x5cc6e0){return new BPromise(function(_0x42e91b,_0xeba902){return client[_0xb6fb('0x10')](_0x2827b6,_0x5cc6e0)[_0xb6fb('0x11')](function(_0x2860df){logger[_0xb6fb('0x12')](_0xb6fb('0x13'),_0x32a447,'request\x20sent');logger[_0xb6fb('0x14')](_0xb6fb('0x15'),_0x32a447,_0xb6fb('0x16'),JSON[_0xb6fb('0x17')](_0x2860df));if(_0x2860df['error']){if(_0x2860df['error'][_0xb6fb('0x18')]===0x1f4){logger[_0xb6fb('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x32a447,_0x2860df['error'][_0xb6fb('0x1a')]);return _0xeba902(_0x2860df[_0xb6fb('0x19')]['message']);}logger[_0xb6fb('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x32a447,_0x2860df[_0xb6fb('0x19')][_0xb6fb('0x1a')]);return _0x42e91b(_0x2860df[_0xb6fb('0x19')][_0xb6fb('0x1a')]);}else{logger[_0xb6fb('0x12')](_0xb6fb('0x13'),_0x32a447,'request\x20sent');_0x42e91b(_0x2860df['result'][_0xb6fb('0x1a')]);}})[_0xb6fb('0x1b')](function(_0x51da0e){logger[_0xb6fb('0x19')](_0xb6fb('0x13'),_0x32a447,_0x51da0e);_0xeba902(_0x51da0e);});});}exports['GetWhatsappQueue']=function(_0x3ee67e){var _0x76399b=this;return new Promise(function(_0x3be8c4,_0x553e5c){return db[_0xb6fb('0x1c')][_0xb6fb('0x1d')]({'raw':_0x3ee67e['options']?_0x3ee67e[_0xb6fb('0x1e')][_0xb6fb('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ee67e['options']?_0x3ee67e[_0xb6fb('0x1e')][_0xb6fb('0x20')]||null:null,'attributes':_0x3ee67e[_0xb6fb('0x1e')]?_0x3ee67e[_0xb6fb('0x1e')][_0xb6fb('0x21')]||null:null,'limit':_0x3ee67e[_0xb6fb('0x1e')]?_0x3ee67e[_0xb6fb('0x1e')]['limit']||null:null,'include':_0x3ee67e['options']?_0x3ee67e[_0xb6fb('0x1e')]['include']?_['map'](_0x3ee67e[_0xb6fb('0x1e')][_0xb6fb('0x22')],function(_0x540644){return{'model':db[_0x540644[_0xb6fb('0x23')]],'as':_0x540644['as'],'attributes':_0x540644[_0xb6fb('0x21')],'include':_0x540644['include']?_['map'](_0x540644['include'],function(_0x1f0ff7){return{'model':db[_0x1f0ff7[_0xb6fb('0x23')]],'as':_0x1f0ff7['as'],'attributes':_0x1f0ff7[_0xb6fb('0x21')],'include':_0x1f0ff7['include']?_[_0xb6fb('0x24')](_0x1f0ff7[_0xb6fb('0x22')],function(_0x157f60){return{'model':db[_0x157f60[_0xb6fb('0x23')]],'as':_0x157f60['as'],'attributes':_0x157f60[_0xb6fb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb6fb('0x11')](function(_0x1c54e4){logger[_0xb6fb('0x12')](_0xb6fb('0x25'),_0x3ee67e);logger[_0xb6fb('0x14')](_0xb6fb('0x25'),_0x3ee67e,JSON['stringify'](_0x1c54e4));_0x3be8c4(_0x1c54e4);})[_0xb6fb('0x1b')](function(_0x4e2fca){logger[_0xb6fb('0x19')](_0xb6fb('0x25'),_0x4e2fca[_0xb6fb('0x1a')],_0x3ee67e);_0x553e5c(_0x76399b['error'](0x1f4,_0x4e2fca[_0xb6fb('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x3128b6){var _0x10477c=this;return new Promise(function(_0x2b09eb,_0x1c974e){return db[_0xb6fb('0x1c')][_0xb6fb('0x26')]({'raw':_0x3128b6[_0xb6fb('0x1e')]?_0x3128b6['options'][_0xb6fb('0x1f')]===undefined?!![]:![]:!![],'where':_0x3128b6[_0xb6fb('0x1e')]?_0x3128b6['options'][_0xb6fb('0x20')]||null:null,'attributes':_0x3128b6[_0xb6fb('0x1e')]?_0x3128b6[_0xb6fb('0x1e')]['attributes']||null:null,'include':_0x3128b6[_0xb6fb('0x1e')]?_0x3128b6[_0xb6fb('0x1e')]['include']?_[_0xb6fb('0x24')](_0x3128b6['options']['include'],function(_0x56e924){return{'model':db[_0x56e924['model']],'as':_0x56e924['as'],'attributes':_0x56e924[_0xb6fb('0x21')],'include':_0x56e924[_0xb6fb('0x22')]?_[_0xb6fb('0x24')](_0x56e924[_0xb6fb('0x22')],function(_0x31f691){return{'model':db[_0x31f691[_0xb6fb('0x23')]],'as':_0x31f691['as'],'attributes':_0x31f691['attributes'],'include':_0x31f691[_0xb6fb('0x22')]?_[_0xb6fb('0x24')](_0x31f691[_0xb6fb('0x22')],function(_0x3a95ba){return{'model':db[_0x3a95ba[_0xb6fb('0x23')]],'as':_0x3a95ba['as'],'attributes':_0x3a95ba['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x220460){logger[_0xb6fb('0x12')](_0xb6fb('0x27'),_0x3128b6);logger[_0xb6fb('0x14')](_0xb6fb('0x27'),_0x3128b6,JSON[_0xb6fb('0x17')](_0x220460));_0x2b09eb(_0x220460);})[_0xb6fb('0x1b')](function(_0x576044){logger['error'](_0xb6fb('0x27'),_0x576044[_0xb6fb('0x1a')],_0x3128b6);_0x1c974e(_0x10477c[_0xb6fb('0x19')](0x1f4,_0x576044[_0xb6fb('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 87ab325..be45fff 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 _0x4945=['remove','update','emit','register','length'];(function(_0x771076,_0x404e0a){var _0x3f9fa7=function(_0x3881f4){while(--_0x3881f4){_0x771076['push'](_0x771076['shift']());}};_0x3f9fa7(++_0x404e0a);}(_0x4945,0x172));var _0x5494=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4945[_0x413feb];return _0x40ee88;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x5494('0x0'),_0x5494('0x1')];function createListener(_0x29c9f1,_0x3d4780){return function(_0x274770){_0x3d4780[_0x5494('0x2')](_0x29c9f1,_0x274770);};}function removeListener(_0x19d7cf,_0x3321c8){return function(){WhatsappQueueEvents['removeListener'](_0x19d7cf,_0x3321c8);};}exports[_0x5494('0x3')]=function(_0x43953b){for(var _0x55eba6=0x0,_0x2f892c=events[_0x5494('0x4')];_0x55eba6<_0x2f892c;_0x55eba6++){var _0x481876=events[_0x55eba6];var _0x239079=createListener('whatsappQueue:'+_0x481876,_0x43953b);WhatsappQueueEvents['on'](_0x481876,_0x239079);}}; \ No newline at end of file +var _0x2ea3=['./whatsappQueue.events','save','emit','length','whatsappQueue:'];(function(_0x561473,_0x2de58){var _0xce5446=function(_0x155270){while(--_0x155270){_0x561473['push'](_0x561473['shift']());}};_0xce5446(++_0x2de58);}(_0x2ea3,0x1d1));var _0x32ea=function(_0x5d6fa8,_0x5612d6){_0x5d6fa8=_0x5d6fa8-0x0;var _0x465f7d=_0x2ea3[_0x5d6fa8];return _0x465f7d;};'use strict';var WhatsappQueueEvents=require(_0x32ea('0x0'));var events=[_0x32ea('0x1'),'remove','update'];function createListener(_0x3d6642,_0x3a1c67){return function(_0x181f90){_0x3a1c67[_0x32ea('0x2')](_0x3d6642,_0x181f90);};}function removeListener(_0x222f05,_0x5b581e){return function(){WhatsappQueueEvents['removeListener'](_0x222f05,_0x5b581e);};}exports['register']=function(_0x7698ed){for(var _0xda4157=0x0,_0x874dc1=events[_0x32ea('0x3')];_0xda4157<_0x874dc1;_0xda4157++){var _0x15c74e=events[_0xda4157];var _0x4bba51=createListener(_0x32ea('0x4')+_0x15c74e,_0x7698ed);WhatsappQueueEvents['on'](_0x15c74e,_0x4bba51);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 854ef18..4b5ca8a 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 _0xb65a=['post','create','put','update','delete','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','describe','get','/:id','show'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb65a,0x114));var _0xab65=function(_0x237c43,_0x1ea492){_0x237c43=_0x237c43-0x0;var _0x2624ee=_0xb65a[_0x237c43];return _0x2624ee;};'use strict';var multer=require(_0xab65('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xab65('0x1'));var express=require(_0xab65('0x2'));var router=express[_0xab65('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab65('0x4'));var config=require(_0xab65('0x5'));var controller=require(_0xab65('0x6'));router['get']('/',auth[_0xab65('0x7')](),controller['index']);router['get']('/describe',auth[_0xab65('0x7')](),controller[_0xab65('0x8')]);router[_0xab65('0x9')](_0xab65('0xa'),auth['isAuthenticated'](),controller[_0xab65('0xb')]);router[_0xab65('0xc')]('/',auth[_0xab65('0x7')](),controller[_0xab65('0xd')]);router[_0xab65('0xe')](_0xab65('0xa'),auth[_0xab65('0x7')](),controller[_0xab65('0xf')]);router[_0xab65('0x10')]('/:id',auth[_0xab65('0x7')](),controller['destroy']);module[_0xab65('0x11')]=router; \ No newline at end of file +var _0xb237=['../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf35fd1,_0x2d3ca8){var _0x2dba2d=function(_0x5af2a8){while(--_0x5af2a8){_0xf35fd1['push'](_0xf35fd1['shift']());}};_0x2dba2d(++_0x2d3ca8);}(_0xb237,0x1d5));var _0x7b23=function(_0x17d870,_0x2b8a18){_0x17d870=_0x17d870-0x0;var _0x4dcb4d=_0xb237[_0x17d870];return _0x4dcb4d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b23('0x0'));var timeout=require(_0x7b23('0x1'));var express=require(_0x7b23('0x2'));var router=express[_0x7b23('0x3')]();var fs_extra=require(_0x7b23('0x4'));var auth=require(_0x7b23('0x5'));var interaction=require(_0x7b23('0x6'));var config=require(_0x7b23('0x7'));var controller=require(_0x7b23('0x8'));router[_0x7b23('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b23('0xa')]);router[_0x7b23('0x9')](_0x7b23('0xb'),auth[_0x7b23('0xc')](),controller[_0x7b23('0xd')]);router[_0x7b23('0x9')](_0x7b23('0xe'),auth[_0x7b23('0xc')](),controller[_0x7b23('0xf')]);router[_0x7b23('0x10')]('/',auth[_0x7b23('0xc')](),controller['create']);router['put']('/:id',auth[_0x7b23('0xc')](),controller['update']);router['delete'](_0x7b23('0xe'),auth[_0x7b23('0xc')](),controller[_0x7b23('0x11')]);module[_0x7b23('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index c492d6a..1c28d8b 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(_0x5913ab,_0x496137){var _0x13a89a=function(_0x2a8517){while(--_0x2a8517){_0x5913ab['push'](_0x5913ab['shift']());}};_0x13a89a(++_0x496137);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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(_0x25a227,_0x31b7ea){var _0x530206=function(_0x322ea3){while(--_0x322ea3){_0x25a227['push'](_0x25a227['shift']());}};_0x530206(++_0x31b7ea);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index e28a012..00b4c29 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 _0x3de3=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','end','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','keys','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','destroy','describe'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x3de3,0x1ce));var _0x33de=function(_0x1741d0,_0x1e93d5){_0x1741d0=_0x1741d0-0x0;var _0x211b9e=_0x3de3[_0x1741d0];return _0x211b9e;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];function respondWithStatusCode(_0x27d1d8,_0x5170ad){_0x5170ad=_0x5170ad||0xcc;return function(_0x6b1a4c){if(_0x6b1a4c){return _0x27d1d8[_0x33de('0x19')](_0x5170ad);}return _0x27d1d8['status'](_0x5170ad)['end']();};}function respondWithResult(_0x4164ab,_0x22bda8){_0x22bda8=_0x22bda8||0xc8;return function(_0x2b3748){if(_0x2b3748){return _0x4164ab[_0x33de('0x1a')](_0x22bda8)['json'](_0x2b3748);}};}function respondWithFilteredResult(_0x11e6b5,_0x1b1166){return function(_0x522ba0){if(_0x522ba0){var _0x4ff69f=typeof _0x1b1166[_0x33de('0x1b')]===_0x33de('0x1c')&&typeof _0x1b1166[_0x33de('0x1d')]==='undefined';var _0x2db887=_0x522ba0[_0x33de('0x1e')];var _0x52cfa0=_0x4ff69f?0x0:_0x1b1166[_0x33de('0x1b')];var _0x201ff3=_0x4ff69f?_0x522ba0['count']:_0x1b1166['offset']+_0x1b1166[_0x33de('0x1d')];var _0x52d718;if(_0x201ff3>=_0x2db887){_0x201ff3=_0x2db887;_0x52d718=0xc8;}else{_0x52d718=0xce;}_0x11e6b5[_0x33de('0x1a')](_0x52d718);return _0x11e6b5[_0x33de('0x1f')](_0x33de('0x20'),_0x52cfa0+'-'+_0x201ff3+'/'+_0x2db887)[_0x33de('0x21')](_0x522ba0);}return null;};}function patchUpdates(_0xc4f1a4){return function(_0x40a8e6){try{jsonpatch[_0x33de('0x22')](_0x40a8e6,_0xc4f1a4,!![]);}catch(_0x493263){return BPromise['reject'](_0x493263);}return _0x40a8e6[_0x33de('0x23')]();};}function saveUpdates(_0x5af3fa,_0x8acd8d){return function(_0x4cd8db){if(_0x4cd8db){return _0x4cd8db[_0x33de('0x24')](_0x5af3fa)[_0x33de('0x25')](function(_0x575e88){return _0x575e88;});}return null;};}function removeEntity(_0x2dbcf2,_0x5cd77e){return function(_0x67d040){if(_0x67d040){return _0x67d040['destroy']()[_0x33de('0x25')](function(){_0x2dbcf2[_0x33de('0x1a')](0xcc)[_0x33de('0x26')]();});}};}function handleEntityNotFound(_0x5b79d7,_0x3bdba4){return function(_0x2d206b){if(!_0x2d206b){_0x5b79d7[_0x33de('0x19')](0x194);}return _0x2d206b;};}function handleError(_0x5cd31e,_0x34fba3){_0x34fba3=_0x34fba3||0x1f4;return function(_0x5585a2){logger['error'](_0x5585a2[_0x33de('0x27')]);if(_0x5585a2[_0x33de('0x28')]){delete _0x5585a2[_0x33de('0x28')];}_0x5cd31e[_0x33de('0x1a')](_0x34fba3)[_0x33de('0x29')](_0x5585a2);};}exports[_0x33de('0x2a')]=function(_0x3f22fb,_0x1b4703){var _0x59bc3b={},_0x5ae0e8={},_0x2755e6={'count':0x0,'rows':[]};var _0x1420d2=_[_0x33de('0x2b')](db[_0x33de('0x2c')][_0x33de('0x2d')],function(_0x20f393){return{'name':_0x20f393[_0x33de('0x2e')],'type':_0x20f393['type'][_0x33de('0x2f')]};});_0x5ae0e8[_0x33de('0x30')]=_[_0x33de('0x2b')](_0x1420d2,_0x33de('0x28'));_0x5ae0e8['query']=_[_0x33de('0x31')](_0x3f22fb[_0x33de('0x32')]);_0x5ae0e8['filters']=_['intersection'](_0x5ae0e8['model'],_0x5ae0e8[_0x33de('0x32')]);_0x59bc3b[_0x33de('0x33')]=_['intersection'](_0x5ae0e8[_0x33de('0x30')],qs['fields'](_0x3f22fb['query'][_0x33de('0x34')]));_0x59bc3b[_0x33de('0x33')]=_0x59bc3b[_0x33de('0x33')][_0x33de('0x35')]?_0x59bc3b[_0x33de('0x33')]:_0x5ae0e8[_0x33de('0x30')];if(!_0x3f22fb[_0x33de('0x32')][_0x33de('0x36')]('nolimit')){_0x59bc3b[_0x33de('0x1d')]=qs['limit'](_0x3f22fb[_0x33de('0x32')]['limit']);_0x59bc3b['offset']=qs[_0x33de('0x1b')](_0x3f22fb[_0x33de('0x32')][_0x33de('0x1b')]);}_0x59bc3b[_0x33de('0x37')]=qs[_0x33de('0x38')](_0x3f22fb[_0x33de('0x32')]['sort']);_0x59bc3b[_0x33de('0x39')]=qs[_0x33de('0x3a')](_[_0x33de('0x3b')](_0x3f22fb[_0x33de('0x32')],_0x5ae0e8[_0x33de('0x3a')]),_0x1420d2);if(_0x3f22fb[_0x33de('0x32')][_0x33de('0x3c')]){_0x59bc3b['where']=_[_0x33de('0x3d')](_0x59bc3b[_0x33de('0x39')],{'$or':_[_0x33de('0x2b')](_0x1420d2,function(_0x3e11eb){if(_0x3e11eb[_0x33de('0x3e')]!==_0x33de('0x3f')){var _0x1126b6={};_0x1126b6[_0x3e11eb['name']]={'$like':'%'+_0x3f22fb[_0x33de('0x32')][_0x33de('0x3c')]+'%'};return _0x1126b6;}})});}_0x59bc3b=_[_0x33de('0x3d')]({},_0x59bc3b,_0x3f22fb[_0x33de('0x40')]);var _0x23c2c4={'where':_0x59bc3b[_0x33de('0x39')]};return db['WhatsappQueueReport'][_0x33de('0x1e')](_0x23c2c4)['then'](function(_0x13dedd){_0x2755e6[_0x33de('0x1e')]=_0x13dedd;if(_0x3f22fb['query'][_0x33de('0x41')]){_0x59bc3b[_0x33de('0x42')]=[{'all':!![]}];}return db[_0x33de('0x2c')][_0x33de('0x43')](_0x59bc3b);})[_0x33de('0x25')](function(_0x4251e3){_0x2755e6[_0x33de('0x44')]=_0x4251e3;return _0x2755e6;})[_0x33de('0x25')](respondWithFilteredResult(_0x1b4703,_0x59bc3b))[_0x33de('0x45')](handleError(_0x1b4703,null));};exports['show']=function(_0x5101b9,_0x417d9b){var _0x1f75f7={'raw':!![],'where':{'id':_0x5101b9[_0x33de('0x46')]['id']}},_0x20d04f={};_0x20d04f['model']=_[_0x33de('0x31')](db['WhatsappQueueReport']['rawAttributes']);_0x20d04f[_0x33de('0x32')]=_[_0x33de('0x31')](_0x5101b9[_0x33de('0x32')]);_0x20d04f[_0x33de('0x3a')]=_[_0x33de('0x47')](_0x20d04f[_0x33de('0x30')],_0x20d04f[_0x33de('0x32')]);_0x1f75f7['attributes']=_[_0x33de('0x47')](_0x20d04f['model'],qs[_0x33de('0x34')](_0x5101b9['query'][_0x33de('0x34')]));_0x1f75f7[_0x33de('0x33')]=_0x1f75f7['attributes'][_0x33de('0x35')]?_0x1f75f7[_0x33de('0x33')]:_0x20d04f[_0x33de('0x30')];if(_0x5101b9['query']['includeAll']){_0x1f75f7[_0x33de('0x42')]=[{'all':!![]}];}_0x1f75f7=_[_0x33de('0x3d')]({},_0x1f75f7,_0x5101b9['options']);return db['WhatsappQueueReport'][_0x33de('0x48')](_0x1f75f7)['then'](handleEntityNotFound(_0x417d9b,null))['then'](respondWithResult(_0x417d9b,null))['catch'](handleError(_0x417d9b,null));};exports[_0x33de('0x49')]=function(_0x2d6001,_0x9a816c){return db[_0x33de('0x2c')]['create'](_0x2d6001['body'],{})[_0x33de('0x25')](respondWithResult(_0x9a816c,0xc9))[_0x33de('0x45')](handleError(_0x9a816c,null));};exports['update']=function(_0x1d016b,_0xc23633){if(_0x1d016b[_0x33de('0x4a')]['id']){delete _0x1d016b[_0x33de('0x4a')]['id'];}return db[_0x33de('0x2c')]['find']({'where':{'id':_0x1d016b[_0x33de('0x46')]['id']}})[_0x33de('0x25')](handleEntityNotFound(_0xc23633,null))['then'](saveUpdates(_0x1d016b[_0x33de('0x4a')],null))[_0x33de('0x25')](respondWithResult(_0xc23633,null))[_0x33de('0x45')](handleError(_0xc23633,null));};exports[_0x33de('0x4b')]=function(_0xbbb376,_0x40f1b7){return db[_0x33de('0x2c')][_0x33de('0x48')]({'where':{'id':_0xbbb376[_0x33de('0x46')]['id']}})[_0x33de('0x25')](handleEntityNotFound(_0x40f1b7,null))['then'](removeEntity(_0x40f1b7,null))[_0x33de('0x45')](handleError(_0x40f1b7,null));};exports[_0x33de('0x4c')]=function(_0x2e2cd7,_0x464502){return db[_0x33de('0x2c')][_0x33de('0x4c')]()[_0x33de('0x25')](respondWithResult(_0x464502,null))['catch'](handleError(_0x464502,null));}; \ No newline at end of file +var _0xfff0=['length','include','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','WhatsappQueueReport','includeAll','findAll','catch','params'];(function(_0xa1de8d,_0x1399a8){var _0x478b44=function(_0x3c8db7){while(--_0x3c8db7){_0xa1de8d['push'](_0xa1de8d['shift']());}};_0x478b44(++_0x1399a8);}(_0xfff0,0x139));var _0x0fff=function(_0x13bd63,_0x33a84a){_0x13bd63=_0x13bd63-0x0;var _0x11c5e8=_0xfff0[_0x13bd63];return _0x11c5e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x23d9f8,_0x482e1e){return function(_0x2c9725){if(!_0x2c9725){_0x23d9f8[_0x0fff('0x28')](0x194);}return _0x2c9725;};}function handleError(_0x2d1610,_0x440f56){_0x440f56=_0x440f56||0x1f4;return function(_0x36d268){logger[_0x0fff('0x29')](_0x36d268[_0x0fff('0x2a')]);if(_0x36d268[_0x0fff('0x2b')]){delete _0x36d268[_0x0fff('0x2b')];}_0x2d1610[_0x0fff('0x19')](_0x440f56)[_0x0fff('0x2c')](_0x36d268);};}exports[_0x0fff('0x2d')]=function(_0x495734,_0x7046a3){var _0x2d1800={},_0x17ab6f={},_0x42441e={'count':0x0,'rows':[]};var _0x1f643d=_[_0x0fff('0x2e')](db['WhatsappQueueReport'][_0x0fff('0x2f')],function(_0xa16c29){return{'name':_0xa16c29[_0x0fff('0x30')],'type':_0xa16c29['type'][_0x0fff('0x31')]};});_0x17ab6f[_0x0fff('0x32')]=_['map'](_0x1f643d,_0x0fff('0x2b'));_0x17ab6f[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0x495734[_0x0fff('0x33')]);_0x17ab6f[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x17ab6f[_0x0fff('0x32')],_0x17ab6f[_0x0fff('0x33')]);_0x2d1800[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x17ab6f['model'],qs[_0x0fff('0x38')](_0x495734[_0x0fff('0x33')][_0x0fff('0x38')]));_0x2d1800[_0x0fff('0x37')]=_0x2d1800[_0x0fff('0x37')]['length']?_0x2d1800['attributes']:_0x17ab6f[_0x0fff('0x32')];if(!_0x495734[_0x0fff('0x33')][_0x0fff('0x39')](_0x0fff('0x3a'))){_0x2d1800['limit']=qs[_0x0fff('0x1d')](_0x495734[_0x0fff('0x33')][_0x0fff('0x1d')]);_0x2d1800[_0x0fff('0x1c')]=qs['offset'](_0x495734[_0x0fff('0x33')][_0x0fff('0x1c')]);}_0x2d1800[_0x0fff('0x3b')]=qs[_0x0fff('0x3c')](_0x495734[_0x0fff('0x33')][_0x0fff('0x3c')]);_0x2d1800[_0x0fff('0x3d')]=qs[_0x0fff('0x35')](_[_0x0fff('0x3e')](_0x495734[_0x0fff('0x33')],_0x17ab6f[_0x0fff('0x35')]),_0x1f643d);if(_0x495734[_0x0fff('0x33')]['filter']){_0x2d1800[_0x0fff('0x3d')]=_[_0x0fff('0x3f')](_0x2d1800[_0x0fff('0x3d')],{'$or':_[_0x0fff('0x2e')](_0x1f643d,function(_0xd65638){if(_0xd65638[_0x0fff('0x40')]!=='VIRTUAL'){var _0x10ff9d={};_0x10ff9d[_0xd65638[_0x0fff('0x2b')]]={'$like':'%'+_0x495734[_0x0fff('0x33')][_0x0fff('0x41')]+'%'};return _0x10ff9d;}})});}_0x2d1800=_[_0x0fff('0x3f')]({},_0x2d1800,_0x495734[_0x0fff('0x42')]);var _0x3dc0b8={'where':_0x2d1800[_0x0fff('0x3d')]};return db[_0x0fff('0x43')]['count'](_0x3dc0b8)[_0x0fff('0x26')](function(_0x4d89c0){_0x42441e[_0x0fff('0x1f')]=_0x4d89c0;if(_0x495734[_0x0fff('0x33')][_0x0fff('0x44')]){_0x2d1800['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x0fff('0x45')](_0x2d1800);})[_0x0fff('0x26')](function(_0x311348){_0x42441e['rows']=_0x311348;return _0x42441e;})['then'](respondWithFilteredResult(_0x7046a3,_0x2d1800))[_0x0fff('0x46')](handleError(_0x7046a3,null));};exports['show']=function(_0xd6ebeb,_0x957265){var _0x8352c1={'raw':!![],'where':{'id':_0xd6ebeb[_0x0fff('0x47')]['id']}},_0x309d75={};_0x309d75[_0x0fff('0x32')]=_['keys'](db[_0x0fff('0x43')][_0x0fff('0x2f')]);_0x309d75[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0xd6ebeb[_0x0fff('0x33')]);_0x309d75[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x309d75['model'],_0x309d75[_0x0fff('0x33')]);_0x8352c1[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x309d75['model'],qs[_0x0fff('0x38')](_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x38')]));_0x8352c1[_0x0fff('0x37')]=_0x8352c1[_0x0fff('0x37')][_0x0fff('0x48')]?_0x8352c1[_0x0fff('0x37')]:_0x309d75[_0x0fff('0x32')];if(_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x44')]){_0x8352c1[_0x0fff('0x49')]=[{'all':!![]}];}_0x8352c1=_['merge']({},_0x8352c1,_0xd6ebeb[_0x0fff('0x42')]);return db[_0x0fff('0x43')]['find'](_0x8352c1)[_0x0fff('0x26')](handleEntityNotFound(_0x957265,null))[_0x0fff('0x26')](respondWithResult(_0x957265,null))[_0x0fff('0x46')](handleError(_0x957265,null));};exports['create']=function(_0x502037,_0x2a0b10){return db['WhatsappQueueReport']['create'](_0x502037[_0x0fff('0x4a')],{})[_0x0fff('0x26')](respondWithResult(_0x2a0b10,0xc9))[_0x0fff('0x46')](handleError(_0x2a0b10,null));};exports[_0x0fff('0x25')]=function(_0x3b4b8e,_0x1a7677){if(_0x3b4b8e['body']['id']){delete _0x3b4b8e[_0x0fff('0x4a')]['id'];}return db[_0x0fff('0x43')][_0x0fff('0x4b')]({'where':{'id':_0x3b4b8e[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x1a7677,null))[_0x0fff('0x26')](saveUpdates(_0x3b4b8e['body'],null))[_0x0fff('0x26')](respondWithResult(_0x1a7677,null))[_0x0fff('0x46')](handleError(_0x1a7677,null));};exports['destroy']=function(_0x1fc872,_0x4bae35){return db['WhatsappQueueReport']['find']({'where':{'id':_0x1fc872[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x4bae35,null))[_0x0fff('0x26')](removeEntity(_0x4bae35,null))[_0x0fff('0x46')](handleError(_0x4bae35,null));};exports[_0x0fff('0x4c')]=function(_0x4bf98d,_0x2524ad){return db[_0x0fff('0x43')][_0x0fff('0x4c')]()[_0x0fff('0x26')](respondWithResult(_0x2524ad,null))[_0x0fff('0x46')](handleError(_0x2524ad,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index eae423b..c2851c7 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 _0x023c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x1fff6a,_0x38f96b){var _0x3a957c=function(_0x12ebf7){while(--_0x12ebf7){_0x1fff6a['push'](_0x1fff6a['shift']());}};_0x3a957c(++_0x38f96b);}(_0x023c,0xb4));var _0xc023=function(_0xc427e5,_0x59926e){_0xc427e5=_0xc427e5-0x0;var _0x2549fc=_0x023c[_0xc427e5];return _0x2549fc;};'use strict';var _=require(_0xc023('0x0'));var util=require(_0xc023('0x1'));var logger=require(_0xc023('0x2'))(_0xc023('0x3'));var moment=require(_0xc023('0x4'));var BPromise=require(_0xc023('0x5'));var rp=require(_0xc023('0x6'));var fs=require('fs');var path=require(_0xc023('0x7'));var rimraf=require(_0xc023('0x8'));var config=require(_0xc023('0x9'));var attributes=require('./whatsappQueueReport.attributes');module[_0xc023('0xa')]=function(_0x5dfab5,_0x4ac26d){return _0x5dfab5['define'](_0xc023('0xb'),attributes,{'tableName':_0xc023('0xc'),'paranoid':![],'indexes':[{'name':_0xc023('0xd'),'fields':[_0xc023('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x692a=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','report_whatsapp_queue','lodash','util','api','bluebird'];(function(_0x5b216b,_0x17fd85){var _0x591848=function(_0x1152ba){while(--_0x1152ba){_0x5b216b['push'](_0x5b216b['shift']());}};_0x591848(++_0x17fd85);}(_0x692a,0x11e));var _0xa692=function(_0x3f57d6,_0x45b6ee){_0x3f57d6=_0x3f57d6-0x0;var _0x3b2054=_0x692a[_0x3f57d6];return _0x3b2054;};'use strict';var _=require(_0xa692('0x0'));var util=require(_0xa692('0x1'));var logger=require('../../config/logger')(_0xa692('0x2'));var moment=require('moment');var BPromise=require(_0xa692('0x3'));var rp=require(_0xa692('0x4'));var fs=require('fs');var path=require(_0xa692('0x5'));var rimraf=require(_0xa692('0x6'));var config=require(_0xa692('0x7'));var attributes=require(_0xa692('0x8'));module['exports']=function(_0x2c7440,_0x13bc51){return _0x2c7440['define']('WhatsappQueueReport',attributes,{'tableName':_0xa692('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 82a7c78..16650cf 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 _0xfdcb=['request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','catch','UpdateWhatsappQueueReport','update','where','attributes','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5207d3,_0x1b67d4){var _0x36785c=function(_0x11a1d3){while(--_0x11a1d3){_0x5207d3['push'](_0x5207d3['shift']());}};_0x36785c(++_0x1b67d4);}(_0xfdcb,0x10f));var _0xbfdc=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xfdcb[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbfdc('0x0'));var BPromise=require('bluebird');var rs=require(_0xbfdc('0x1'));var fs=require('fs');var Redis=require(_0xbfdc('0x2'));var db=require(_0xbfdc('0x3'))['db'];var utils=require(_0xbfdc('0x4'));var logger=require(_0xbfdc('0x5'))(_0xbfdc('0x6'));var config=require(_0xbfdc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbfdc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39f350,_0x5276b0,_0x37fd4c){return new BPromise(function(_0x2a6ba5,_0x4a0d6d){return client[_0xbfdc('0x9')](_0x39f350,_0x37fd4c)[_0xbfdc('0xa')](function(_0x32f63f){logger['info'](_0xbfdc('0xb'),_0x5276b0,_0xbfdc('0xc'));logger[_0xbfdc('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5276b0,_0xbfdc('0xc'),JSON[_0xbfdc('0xe')](_0x32f63f));if(_0x32f63f[_0xbfdc('0xf')]){if(_0x32f63f['error']['code']===0x1f4){logger[_0xbfdc('0xf')](_0xbfdc('0xb'),_0x5276b0,_0x32f63f[_0xbfdc('0xf')][_0xbfdc('0x10')]);return _0x4a0d6d(_0x32f63f[_0xbfdc('0xf')]['message']);}logger['error'](_0xbfdc('0xb'),_0x5276b0,_0x32f63f['error'][_0xbfdc('0x10')]);return _0x2a6ba5(_0x32f63f[_0xbfdc('0xf')][_0xbfdc('0x10')]);}else{logger[_0xbfdc('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5276b0,_0xbfdc('0xc'));_0x2a6ba5(_0x32f63f['result'][_0xbfdc('0x10')]);}})['catch'](function(_0xfaf522){logger[_0xbfdc('0xf')](_0xbfdc('0xb'),_0x5276b0,_0xfaf522);_0x4a0d6d(_0xfaf522);});});}exports[_0xbfdc('0x12')]=function(_0x4439be){var _0x46df0f=this;return new Promise(function(_0xb4e11,_0x3258e9){return db[_0xbfdc('0x13')]['create'](_0x4439be[_0xbfdc('0x14')],{'raw':_0x4439be[_0xbfdc('0x15')]?_0x4439be['options'][_0xbfdc('0x16')]===undefined?!![]:![]:!![]})[_0xbfdc('0xa')](function(_0x5c53cc){logger['info'](_0xbfdc('0x12'),_0x4439be);logger['debug'](_0xbfdc('0x12'),_0x4439be,JSON['stringify'](_0x5c53cc));_0xb4e11(_0x5c53cc);})[_0xbfdc('0x17')](function(_0xf3a828){logger[_0xbfdc('0xf')]('CreateWhatsappQueueReport',_0xf3a828[_0xbfdc('0x10')],_0x4439be);_0x3258e9(_0x46df0f[_0xbfdc('0xf')](0x1f4,_0xf3a828[_0xbfdc('0x10')]));});});};exports[_0xbfdc('0x18')]=function(_0xf74498){var _0x2e2223=this;return new Promise(function(_0x11057a,_0x495e40){return db[_0xbfdc('0x13')][_0xbfdc('0x19')](_0xf74498['body'],{'raw':_0xf74498['options']?_0xf74498[_0xbfdc('0x15')][_0xbfdc('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf74498[_0xbfdc('0x15')]?_0xf74498[_0xbfdc('0x15')][_0xbfdc('0x1a')]||null:null,'attributes':_0xf74498[_0xbfdc('0x15')]?_0xf74498[_0xbfdc('0x15')][_0xbfdc('0x1b')]||null:null,'limit':_0xf74498['options']?_0xf74498[_0xbfdc('0x15')]['limit']||null:null})[_0xbfdc('0xa')](function(_0x19b283){logger[_0xbfdc('0x11')](_0xbfdc('0x18'),_0xf74498);logger[_0xbfdc('0xd')]('UpdateWhatsappQueueReport',_0xf74498,JSON[_0xbfdc('0xe')](_0x19b283));_0x11057a(_0x19b283);})[_0xbfdc('0x17')](function(_0x3232cf){logger[_0xbfdc('0xf')](_0xbfdc('0x18'),_0x3232cf[_0xbfdc('0x10')],_0xf74498);_0x495e40(_0x2e2223[_0xbfdc('0xf')](0x1f4,_0x3232cf[_0xbfdc('0x10')]));});});}; \ No newline at end of file +var _0xebfc=['rpc','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x55af95,_0x4c0dd6){var _0x397e00=function(_0x31ce84){while(--_0x31ce84){_0x55af95['push'](_0x55af95['shift']());}};_0x397e00(++_0x4c0dd6);}(_0xebfc,0xbf));var _0xcebf=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xebfc[_0x57d13b];return _0x467696;};'use strict';var _=require(_0xcebf('0x0'));var util=require(_0xcebf('0x1'));var moment=require('moment');var BPromise=require(_0xcebf('0x2'));var rs=require(_0xcebf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcebf('0x4'))['db'];var utils=require(_0xcebf('0x5'));var logger=require(_0xcebf('0x6'))(_0xcebf('0x7'));var config=require('../../config/environment');var jayson=require(_0xcebf('0x8'));var client=jayson[_0xcebf('0x9')][_0xcebf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d0e1,_0x1c6434,_0x4774d8){return new BPromise(function(_0x4fe9f7,_0x8d5697){return client[_0xcebf('0xb')](_0x10d0e1,_0x4774d8)['then'](function(_0x35fe9a){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x1c6434,_0xcebf('0xc'));logger[_0xcebf('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x1c6434,_0xcebf('0xc'),JSON[_0xcebf('0xe')](_0x35fe9a));if(_0x35fe9a[_0xcebf('0xf')]){if(_0x35fe9a[_0xcebf('0xf')][_0xcebf('0x10')]===0x1f4){logger[_0xcebf('0xf')](_0xcebf('0x11'),_0x1c6434,_0x35fe9a['error'][_0xcebf('0x12')]);return _0x8d5697(_0x35fe9a['error']['message']);}logger[_0xcebf('0xf')](_0xcebf('0x11'),_0x1c6434,_0x35fe9a[_0xcebf('0xf')][_0xcebf('0x12')]);return _0x4fe9f7(_0x35fe9a[_0xcebf('0xf')][_0xcebf('0x12')]);}else{logger[_0xcebf('0x13')](_0xcebf('0x11'),_0x1c6434,_0xcebf('0xc'));_0x4fe9f7(_0x35fe9a[_0xcebf('0x14')][_0xcebf('0x12')]);}})[_0xcebf('0x15')](function(_0x25ecd1){logger[_0xcebf('0xf')](_0xcebf('0x11'),_0x1c6434,_0x25ecd1);_0x8d5697(_0x25ecd1);});});}exports[_0xcebf('0x16')]=function(_0x2cd9a9){var _0x509aa1=this;return new Promise(function(_0x4d6936,_0x2b743a){return db[_0xcebf('0x17')][_0xcebf('0x18')](_0x2cd9a9[_0xcebf('0x19')],{'raw':_0x2cd9a9[_0xcebf('0x1a')]?_0x2cd9a9[_0xcebf('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xcebf('0x1b')](function(_0x44295b){logger[_0xcebf('0x13')](_0xcebf('0x16'),_0x2cd9a9);logger['debug'](_0xcebf('0x16'),_0x2cd9a9,JSON[_0xcebf('0xe')](_0x44295b));_0x4d6936(_0x44295b);})['catch'](function(_0x22c294){logger[_0xcebf('0xf')](_0xcebf('0x16'),_0x22c294[_0xcebf('0x12')],_0x2cd9a9);_0x2b743a(_0x509aa1[_0xcebf('0xf')](0x1f4,_0x22c294[_0xcebf('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x71aede){var _0x52c6f7=this;return new Promise(function(_0x27c5bc,_0x82be68){return db[_0xcebf('0x17')][_0xcebf('0x1c')](_0x71aede[_0xcebf('0x19')],{'raw':_0x71aede[_0xcebf('0x1a')]?_0x71aede[_0xcebf('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x71aede[_0xcebf('0x1a')]?_0x71aede[_0xcebf('0x1a')][_0xcebf('0x1d')]||null:null,'attributes':_0x71aede[_0xcebf('0x1a')]?_0x71aede['options'][_0xcebf('0x1e')]||null:null,'limit':_0x71aede['options']?_0x71aede[_0xcebf('0x1a')][_0xcebf('0x1f')]||null:null})[_0xcebf('0x1b')](function(_0x5ae503){logger[_0xcebf('0x13')]('UpdateWhatsappQueueReport',_0x71aede);logger[_0xcebf('0xd')](_0xcebf('0x20'),_0x71aede,JSON[_0xcebf('0xe')](_0x5ae503));_0x27c5bc(_0x5ae503);})['catch'](function(_0x2e1fd5){logger[_0xcebf('0xf')](_0xcebf('0x20'),_0x2e1fd5[_0xcebf('0x12')],_0x71aede);_0x82be68(_0x52c6f7[_0xcebf('0xf')](0x1f4,_0x2e1fd5['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 71452ac..9a6fae8 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 _0xee82=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express'];(function(_0x206b05,_0x459d9f){var _0x3b81d0=function(_0x260937){while(--_0x260937){_0x206b05['push'](_0x206b05['shift']());}};_0x3b81d0(++_0x459d9f);}(_0xee82,0x1b5));var _0x2ee8=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0xee82[_0x5d88c0];return _0x1b40f0;};'use strict';var multer=require(_0x2ee8('0x0'));var util=require(_0x2ee8('0x1'));var path=require(_0x2ee8('0x2'));var timeout=require('connect-timeout');var express=require(_0x2ee8('0x3'));var router=express[_0x2ee8('0x4')]();var fs_extra=require(_0x2ee8('0x5'));var auth=require(_0x2ee8('0x6'));var interaction=require(_0x2ee8('0x7'));var config=require(_0x2ee8('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x2ee8('0x9')]('/',auth[_0x2ee8('0xa')](),controller[_0x2ee8('0xb')]);router[_0x2ee8('0x9')]('/describe',auth[_0x2ee8('0xa')](),controller[_0x2ee8('0xc')]);router['get'](_0x2ee8('0xd'),auth[_0x2ee8('0xa')](),controller[_0x2ee8('0xe')]);router[_0x2ee8('0xf')]('/',auth[_0x2ee8('0xa')](),controller[_0x2ee8('0x10')]);router[_0x2ee8('0x11')](_0x2ee8('0xd'),auth[_0x2ee8('0xa')](),controller[_0x2ee8('0x12')]);router['delete'](_0x2ee8('0xd'),auth[_0x2ee8('0xa')](),controller[_0x2ee8('0x13')]);module[_0x2ee8('0x14')]=router; \ No newline at end of file +var _0xd343=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','post','/:id','update','delete','exports'];(function(_0x25dc76,_0xfae587){var _0x478c85=function(_0x263ae8){while(--_0x263ae8){_0x25dc76['push'](_0x25dc76['shift']());}};_0x478c85(++_0xfae587);}(_0xd343,0x1cc));var _0x3d34=function(_0x2736e1,_0x15f462){_0x2736e1=_0x2736e1-0x0;var _0x458828=_0xd343[_0x2736e1];return _0x458828;};'use strict';var multer=require(_0x3d34('0x0'));var util=require('util');var path=require(_0x3d34('0x1'));var timeout=require('connect-timeout');var express=require(_0x3d34('0x2'));var router=express[_0x3d34('0x3')]();var fs_extra=require(_0x3d34('0x4'));var auth=require(_0x3d34('0x5'));var interaction=require(_0x3d34('0x6'));var config=require(_0x3d34('0x7'));var controller=require(_0x3d34('0x8'));router[_0x3d34('0x9')]('/',auth['isAuthenticated'](),controller[_0x3d34('0xa')]);router[_0x3d34('0x9')](_0x3d34('0xb'),auth[_0x3d34('0xc')](),controller[_0x3d34('0xd')]);router[_0x3d34('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3d34('0xe')]);router[_0x3d34('0xf')]('/',auth[_0x3d34('0xc')](),controller['create']);router['put'](_0x3d34('0x10'),auth['isAuthenticated'](),controller[_0x3d34('0x11')]);router[_0x3d34('0x12')](_0x3d34('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x3d34('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index c624bcf..69f37c8 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 _0xaa2d=['exports','agent','queue','DATE'];(function(_0x48f791,_0x57dbd7){var _0x5ec5ea=function(_0x1b8718){while(--_0x1b8718){_0x48f791['push'](_0x48f791['shift']());}};_0x5ec5ea(++_0x57dbd7);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xdaa2('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xdaa2('0x1'),_0xdaa2('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xdaa2('0x3')]}}; \ No newline at end of file +var _0x29b1=['DATE','sequelize','exports','STRING','ENUM','account','queue'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x29b1,0x16d));var _0x129b=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x29b1[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0x129b('0x0'));module[_0x129b('0x1')]={'uniqueid':{'type':Sequelize[_0x129b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x129b('0x3')](_0x129b('0x4'),'agent',_0x129b('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x129b('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 5db7e6b..83ace9e 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 _0xae7e=['filters','intersection','model','attributes','fields','query','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','catch','keys','create','body','find','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','index','map','WhatsappTransferReport','rawAttributes','type'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xae7e,0xf2));var _0xeae7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xae7e[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xeae7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeae7('0x1'));var rp=require(_0xeae7('0x2'));var moment=require(_0xeae7('0x3'));var BPromise=require(_0xeae7('0x4'));var Mustache=require(_0xeae7('0x5'));var util=require('util');var path=require(_0xeae7('0x6'));var sox=require(_0xeae7('0x7'));var csv=require(_0xeae7('0x8'));var ejs=require(_0xeae7('0x9'));var fs=require('fs');var fs_extra=require(_0xeae7('0xa'));var _=require(_0xeae7('0xb'));var squel=require(_0xeae7('0xc'));var crypto=require(_0xeae7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeae7('0xe'));var toCsv=require(_0xeae7('0x8'));var querystring=require('querystring');var Papa=require(_0xeae7('0xf'));var Redis=require(_0xeae7('0x10'));var authService=require(_0xeae7('0x11'));var qs=require(_0xeae7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeae7('0x13'));var logger=require('../../config/logger')(_0xeae7('0x14'));var utils=require(_0xeae7('0x15'));var config=require(_0xeae7('0x16'));var licenseUtil=require(_0xeae7('0x17'));var db=require(_0xeae7('0x18'))['db'];function respondWithStatusCode(_0x2f1886,_0x5469e0){_0x5469e0=_0x5469e0||0xcc;return function(_0x3d2734){if(_0x3d2734){return _0x2f1886[_0xeae7('0x19')](_0x5469e0);}return _0x2f1886[_0xeae7('0x1a')](_0x5469e0)[_0xeae7('0x1b')]();};}function respondWithResult(_0x5b8568,_0x59abb0){_0x59abb0=_0x59abb0||0xc8;return function(_0x3ceb2b){if(_0x3ceb2b){return _0x5b8568[_0xeae7('0x1a')](_0x59abb0)[_0xeae7('0x1c')](_0x3ceb2b);}};}function respondWithFilteredResult(_0x131cd5,_0x50dcb9){return function(_0x2b20e8){if(_0x2b20e8){var _0x50e202=typeof _0x50dcb9[_0xeae7('0x1d')]===_0xeae7('0x1e')&&typeof _0x50dcb9[_0xeae7('0x1f')]===_0xeae7('0x1e');var _0x131fe1=_0x2b20e8[_0xeae7('0x20')];var _0x151eef=_0x50e202?0x0:_0x50dcb9[_0xeae7('0x1d')];var _0x1ab9a2=_0x50e202?_0x2b20e8[_0xeae7('0x20')]:_0x50dcb9[_0xeae7('0x1d')]+_0x50dcb9['limit'];var _0x4c7bc1;if(_0x1ab9a2>=_0x131fe1){_0x1ab9a2=_0x131fe1;_0x4c7bc1=0xc8;}else{_0x4c7bc1=0xce;}_0x131cd5[_0xeae7('0x1a')](_0x4c7bc1);return _0x131cd5[_0xeae7('0x21')](_0xeae7('0x22'),_0x151eef+'-'+_0x1ab9a2+'/'+_0x131fe1)[_0xeae7('0x1c')](_0x2b20e8);}return null;};}function patchUpdates(_0x19ee7d){return function(_0x9508f3){try{jsonpatch['apply'](_0x9508f3,_0x19ee7d,!![]);}catch(_0x29dd14){return BPromise[_0xeae7('0x23')](_0x29dd14);}return _0x9508f3[_0xeae7('0x24')]();};}function saveUpdates(_0x589046,_0x57714d){return function(_0x2dcc56){if(_0x2dcc56){return _0x2dcc56['update'](_0x589046)[_0xeae7('0x25')](function(_0x42b64e){return _0x42b64e;});}return null;};}function removeEntity(_0x2af073,_0x4a34ce){return function(_0xc9fbcc){if(_0xc9fbcc){return _0xc9fbcc[_0xeae7('0x26')]()[_0xeae7('0x25')](function(){_0x2af073['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc400c9,_0xa175f5){return function(_0x50bc89){if(!_0x50bc89){_0xc400c9[_0xeae7('0x19')](0x194);}return _0x50bc89;};}function handleError(_0xd6af54,_0x53809f){_0x53809f=_0x53809f||0x1f4;return function(_0xbff6bf){logger[_0xeae7('0x27')](_0xbff6bf[_0xeae7('0x28')]);if(_0xbff6bf['name']){delete _0xbff6bf['name'];}_0xd6af54[_0xeae7('0x1a')](_0x53809f)['send'](_0xbff6bf);};}exports[_0xeae7('0x29')]=function(_0x1ae906,_0x56a5de){var _0x57461d={},_0x235c44={},_0x10536c={'count':0x0,'rows':[]};var _0x2d2269=_[_0xeae7('0x2a')](db[_0xeae7('0x2b')][_0xeae7('0x2c')],function(_0x24f0a0){return{'name':_0x24f0a0['fieldName'],'type':_0x24f0a0[_0xeae7('0x2d')]['key']};});_0x235c44['model']=_[_0xeae7('0x2a')](_0x2d2269,'name');_0x235c44['query']=_['keys'](_0x1ae906['query']);_0x235c44[_0xeae7('0x2e')]=_[_0xeae7('0x2f')](_0x235c44[_0xeae7('0x30')],_0x235c44['query']);_0x57461d[_0xeae7('0x31')]=_[_0xeae7('0x2f')](_0x235c44[_0xeae7('0x30')],qs[_0xeae7('0x32')](_0x1ae906[_0xeae7('0x33')][_0xeae7('0x32')]));_0x57461d[_0xeae7('0x31')]=_0x57461d[_0xeae7('0x31')][_0xeae7('0x34')]?_0x57461d[_0xeae7('0x31')]:_0x235c44[_0xeae7('0x30')];if(!_0x1ae906['query']['hasOwnProperty'](_0xeae7('0x35'))){_0x57461d[_0xeae7('0x1f')]=qs[_0xeae7('0x1f')](_0x1ae906[_0xeae7('0x33')][_0xeae7('0x1f')]);_0x57461d[_0xeae7('0x1d')]=qs[_0xeae7('0x1d')](_0x1ae906[_0xeae7('0x33')]['offset']);}_0x57461d[_0xeae7('0x36')]=qs[_0xeae7('0x37')](_0x1ae906[_0xeae7('0x33')][_0xeae7('0x37')]);_0x57461d[_0xeae7('0x38')]=qs[_0xeae7('0x2e')](_[_0xeae7('0x39')](_0x1ae906['query'],_0x235c44[_0xeae7('0x2e')]),_0x2d2269);if(_0x1ae906['query'][_0xeae7('0x3a')]){_0x57461d[_0xeae7('0x38')]=_[_0xeae7('0x3b')](_0x57461d[_0xeae7('0x38')],{'$or':_[_0xeae7('0x2a')](_0x2d2269,function(_0x5b735d){if(_0x5b735d[_0xeae7('0x2d')]!==_0xeae7('0x3c')){var _0xd271ff={};_0xd271ff[_0x5b735d[_0xeae7('0x3d')]]={'$like':'%'+_0x1ae906['query']['filter']+'%'};return _0xd271ff;}})});}_0x57461d=_[_0xeae7('0x3b')]({},_0x57461d,_0x1ae906[_0xeae7('0x3e')]);var _0x5b6cf4={'where':_0x57461d[_0xeae7('0x38')]};return db[_0xeae7('0x2b')]['count'](_0x5b6cf4)[_0xeae7('0x25')](function(_0x39288a){_0x10536c['count']=_0x39288a;if(_0x1ae906[_0xeae7('0x33')][_0xeae7('0x3f')]){_0x57461d['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xeae7('0x40')](_0x57461d);})[_0xeae7('0x25')](function(_0x3e71e2){_0x10536c['rows']=_0x3e71e2;return _0x10536c;})[_0xeae7('0x25')](respondWithFilteredResult(_0x56a5de,_0x57461d))[_0xeae7('0x41')](handleError(_0x56a5de,null));};exports['show']=function(_0x5ae32a,_0x64252b){var _0x3dcd85={'raw':!![],'where':{'id':_0x5ae32a['params']['id']}},_0x2789a3={};_0x2789a3[_0xeae7('0x30')]=_[_0xeae7('0x42')](db[_0xeae7('0x2b')][_0xeae7('0x2c')]);_0x2789a3[_0xeae7('0x33')]=_['keys'](_0x5ae32a[_0xeae7('0x33')]);_0x2789a3[_0xeae7('0x2e')]=_[_0xeae7('0x2f')](_0x2789a3['model'],_0x2789a3['query']);_0x3dcd85[_0xeae7('0x31')]=_[_0xeae7('0x2f')](_0x2789a3[_0xeae7('0x30')],qs[_0xeae7('0x32')](_0x5ae32a[_0xeae7('0x33')][_0xeae7('0x32')]));_0x3dcd85['attributes']=_0x3dcd85['attributes'][_0xeae7('0x34')]?_0x3dcd85['attributes']:_0x2789a3[_0xeae7('0x30')];if(_0x5ae32a[_0xeae7('0x33')]['includeAll']){_0x3dcd85['include']=[{'all':!![]}];}_0x3dcd85=_[_0xeae7('0x3b')]({},_0x3dcd85,_0x5ae32a[_0xeae7('0x3e')]);return db[_0xeae7('0x2b')]['find'](_0x3dcd85)['then'](handleEntityNotFound(_0x64252b,null))[_0xeae7('0x25')](respondWithResult(_0x64252b,null))[_0xeae7('0x41')](handleError(_0x64252b,null));};exports['create']=function(_0x293fac,_0x549130){return db[_0xeae7('0x2b')][_0xeae7('0x43')](_0x293fac[_0xeae7('0x44')],{})[_0xeae7('0x25')](respondWithResult(_0x549130,0xc9))[_0xeae7('0x41')](handleError(_0x549130,null));};exports['update']=function(_0x280a20,_0x1580ed){if(_0x280a20['body']['id']){delete _0x280a20[_0xeae7('0x44')]['id'];}return db['WhatsappTransferReport'][_0xeae7('0x45')]({'where':{'id':_0x280a20[_0xeae7('0x46')]['id']}})[_0xeae7('0x25')](handleEntityNotFound(_0x1580ed,null))[_0xeae7('0x25')](saveUpdates(_0x280a20[_0xeae7('0x44')],null))[_0xeae7('0x25')](respondWithResult(_0x1580ed,null))[_0xeae7('0x41')](handleError(_0x1580ed,null));};exports[_0xeae7('0x26')]=function(_0x4c6892,_0x5f7f57){return db[_0xeae7('0x2b')][_0xeae7('0x45')]({'where':{'id':_0x4c6892[_0xeae7('0x46')]['id']}})[_0xeae7('0x25')](handleEntityNotFound(_0x5f7f57,null))[_0xeae7('0x25')](removeEntity(_0x5f7f57,null))[_0xeae7('0x41')](handleError(_0x5f7f57,null));};exports[_0xeae7('0x47')]=function(_0x4cba34,_0xb38f0e){return db[_0xeae7('0x2b')][_0xeae7('0x47')]()[_0xeae7('0x25')](respondWithResult(_0xb38f0e,null))[_0xeae7('0x41')](handleError(_0xb38f0e,null));}; \ No newline at end of file +var _0x84c4=['send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name'];(function(_0x5b860b,_0x2b96d9){var _0x5d0d2a=function(_0x47c179){while(--_0x47c179){_0x5b860b['push'](_0x5b860b['shift']());}};_0x5d0d2a(++_0x2b96d9);}(_0x84c4,0x157));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x484c('0x0'));var rimraf=require(_0x484c('0x1'));var zipdir=require(_0x484c('0x2'));var jsonpatch=require(_0x484c('0x3'));var rp=require(_0x484c('0x4'));var moment=require(_0x484c('0x5'));var BPromise=require(_0x484c('0x6'));var Mustache=require(_0x484c('0x7'));var util=require(_0x484c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x484c('0x9'));var ejs=require(_0x484c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x484c('0xb'));var squel=require('squel');var crypto=require(_0x484c('0xc'));var jsforce=require(_0x484c('0xd'));var deskjs=require(_0x484c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x484c('0xf'));var Papa=require(_0x484c('0x10'));var Redis=require(_0x484c('0x11'));var authService=require(_0x484c('0x12'));var qs=require(_0x484c('0x13'));var as=require(_0x484c('0x14'));var hardwareService=require(_0x484c('0x15'));var logger=require('../../config/logger')(_0x484c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x484c('0x17'));var db=require(_0x484c('0x18'))['db'];function respondWithStatusCode(_0x1a0247,_0x1e9683){_0x1e9683=_0x1e9683||0xcc;return function(_0x193af8){if(_0x193af8){return _0x1a0247['sendStatus'](_0x1e9683);}return _0x1a0247['status'](_0x1e9683)['end']();};}function respondWithResult(_0xf3d82f,_0x42d179){_0x42d179=_0x42d179||0xc8;return function(_0x5105ee){if(_0x5105ee){return _0xf3d82f[_0x484c('0x19')](_0x42d179)['json'](_0x5105ee);}};}function respondWithFilteredResult(_0x1874af,_0x401263){return function(_0x487dc6){if(_0x487dc6){var _0x579464=typeof _0x401263['offset']==='undefined'&&typeof _0x401263[_0x484c('0x1a')]===_0x484c('0x1b');var _0x489221=_0x487dc6[_0x484c('0x1c')];var _0x4567f8=_0x579464?0x0:_0x401263[_0x484c('0x1d')];var _0x2fccc3=_0x579464?_0x487dc6[_0x484c('0x1c')]:_0x401263[_0x484c('0x1d')]+_0x401263['limit'];var _0x1105ca;if(_0x2fccc3>=_0x489221){_0x2fccc3=_0x489221;_0x1105ca=0xc8;}else{_0x1105ca=0xce;}_0x1874af[_0x484c('0x19')](_0x1105ca);return _0x1874af[_0x484c('0x1e')](_0x484c('0x1f'),_0x4567f8+'-'+_0x2fccc3+'/'+_0x489221)[_0x484c('0x20')](_0x487dc6);}return null;};}function patchUpdates(_0x1dddc8){return function(_0x17e013){try{jsonpatch[_0x484c('0x21')](_0x17e013,_0x1dddc8,!![]);}catch(_0x3dc482){return BPromise['reject'](_0x3dc482);}return _0x17e013[_0x484c('0x22')]();};}function saveUpdates(_0x5c4fb4,_0x38564b){return function(_0xca8eee){if(_0xca8eee){return _0xca8eee[_0x484c('0x23')](_0x5c4fb4)['then'](function(_0x284ea5){return _0x284ea5;});}return null;};}function removeEntity(_0xaa0f22,_0x103a32){return function(_0x571f76){if(_0x571f76){return _0x571f76[_0x484c('0x24')]()[_0x484c('0x25')](function(){_0xaa0f22['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a3ce,_0x4dc2f6){return function(_0x5335ff){if(!_0x5335ff){_0x23a3ce[_0x484c('0x26')](0x194);}return _0x5335ff;};}function handleError(_0x8ee389,_0x5dd200){_0x5dd200=_0x5dd200||0x1f4;return function(_0x2e2fd9){logger[_0x484c('0x27')](_0x2e2fd9[_0x484c('0x28')]);if(_0x2e2fd9[_0x484c('0x29')]){delete _0x2e2fd9[_0x484c('0x29')];}_0x8ee389['status'](_0x5dd200)[_0x484c('0x2a')](_0x2e2fd9);};}exports[_0x484c('0x2b')]=function(_0x1ac937,_0x2157d9){var _0x31af1f={},_0x413e91={},_0x438b1a={'count':0x0,'rows':[]};var _0xf6c409=_[_0x484c('0x2c')](db[_0x484c('0x2d')][_0x484c('0x2e')],function(_0x3c98af){return{'name':_0x3c98af[_0x484c('0x2f')],'type':_0x3c98af[_0x484c('0x30')][_0x484c('0x31')]};});_0x413e91[_0x484c('0x32')]=_[_0x484c('0x2c')](_0xf6c409,_0x484c('0x29'));_0x413e91[_0x484c('0x33')]=_[_0x484c('0x34')](_0x1ac937[_0x484c('0x33')]);_0x413e91[_0x484c('0x35')]=_[_0x484c('0x36')](_0x413e91[_0x484c('0x32')],_0x413e91['query']);_0x31af1f[_0x484c('0x37')]=_[_0x484c('0x36')](_0x413e91[_0x484c('0x32')],qs[_0x484c('0x38')](_0x1ac937[_0x484c('0x33')]['fields']));_0x31af1f[_0x484c('0x37')]=_0x31af1f[_0x484c('0x37')]['length']?_0x31af1f[_0x484c('0x37')]:_0x413e91[_0x484c('0x32')];if(!_0x1ac937[_0x484c('0x33')][_0x484c('0x39')]('nolimit')){_0x31af1f[_0x484c('0x1a')]=qs['limit'](_0x1ac937[_0x484c('0x33')][_0x484c('0x1a')]);_0x31af1f[_0x484c('0x1d')]=qs[_0x484c('0x1d')](_0x1ac937[_0x484c('0x33')]['offset']);}_0x31af1f[_0x484c('0x3a')]=qs[_0x484c('0x3b')](_0x1ac937[_0x484c('0x33')]['sort']);_0x31af1f[_0x484c('0x3c')]=qs[_0x484c('0x35')](_[_0x484c('0x3d')](_0x1ac937[_0x484c('0x33')],_0x413e91['filters']),_0xf6c409);if(_0x1ac937[_0x484c('0x33')][_0x484c('0x3e')]){_0x31af1f[_0x484c('0x3c')]=_[_0x484c('0x3f')](_0x31af1f['where'],{'$or':_[_0x484c('0x2c')](_0xf6c409,function(_0x1f002b){if(_0x1f002b[_0x484c('0x30')]!==_0x484c('0x40')){var _0x512442={};_0x512442[_0x1f002b[_0x484c('0x29')]]={'$like':'%'+_0x1ac937[_0x484c('0x33')][_0x484c('0x3e')]+'%'};return _0x512442;}})});}_0x31af1f=_[_0x484c('0x3f')]({},_0x31af1f,_0x1ac937[_0x484c('0x41')]);var _0x2395fe={'where':_0x31af1f[_0x484c('0x3c')]};return db['WhatsappTransferReport'][_0x484c('0x1c')](_0x2395fe)[_0x484c('0x25')](function(_0x2fef62){_0x438b1a['count']=_0x2fef62;if(_0x1ac937['query'][_0x484c('0x42')]){_0x31af1f[_0x484c('0x43')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x484c('0x44')](_0x31af1f);})[_0x484c('0x25')](function(_0x311dd8){_0x438b1a[_0x484c('0x45')]=_0x311dd8;return _0x438b1a;})['then'](respondWithFilteredResult(_0x2157d9,_0x31af1f))[_0x484c('0x46')](handleError(_0x2157d9,null));};exports['show']=function(_0x271eb9,_0x4ff111){var _0x5b9dd3={'raw':!![],'where':{'id':_0x271eb9[_0x484c('0x47')]['id']}},_0x38adf1={};_0x38adf1[_0x484c('0x32')]=_[_0x484c('0x34')](db[_0x484c('0x2d')]['rawAttributes']);_0x38adf1[_0x484c('0x33')]=_['keys'](_0x271eb9[_0x484c('0x33')]);_0x38adf1[_0x484c('0x35')]=_[_0x484c('0x36')](_0x38adf1['model'],_0x38adf1['query']);_0x5b9dd3['attributes']=_[_0x484c('0x36')](_0x38adf1[_0x484c('0x32')],qs[_0x484c('0x38')](_0x271eb9[_0x484c('0x33')][_0x484c('0x38')]));_0x5b9dd3[_0x484c('0x37')]=_0x5b9dd3[_0x484c('0x37')][_0x484c('0x48')]?_0x5b9dd3[_0x484c('0x37')]:_0x38adf1[_0x484c('0x32')];if(_0x271eb9['query'][_0x484c('0x42')]){_0x5b9dd3[_0x484c('0x43')]=[{'all':!![]}];}_0x5b9dd3=_[_0x484c('0x3f')]({},_0x5b9dd3,_0x271eb9[_0x484c('0x41')]);return db[_0x484c('0x2d')][_0x484c('0x49')](_0x5b9dd3)[_0x484c('0x25')](handleEntityNotFound(_0x4ff111,null))[_0x484c('0x25')](respondWithResult(_0x4ff111,null))[_0x484c('0x46')](handleError(_0x4ff111,null));};exports[_0x484c('0x4a')]=function(_0x56a1af,_0x461dbe){return db[_0x484c('0x2d')][_0x484c('0x4a')](_0x56a1af[_0x484c('0x4b')],{})[_0x484c('0x25')](respondWithResult(_0x461dbe,0xc9))[_0x484c('0x46')](handleError(_0x461dbe,null));};exports[_0x484c('0x23')]=function(_0x38cedc,_0x5784d1){if(_0x38cedc[_0x484c('0x4b')]['id']){delete _0x38cedc[_0x484c('0x4b')]['id'];}return db['WhatsappTransferReport'][_0x484c('0x49')]({'where':{'id':_0x38cedc[_0x484c('0x47')]['id']}})['then'](handleEntityNotFound(_0x5784d1,null))[_0x484c('0x25')](saveUpdates(_0x38cedc[_0x484c('0x4b')],null))[_0x484c('0x25')](respondWithResult(_0x5784d1,null))['catch'](handleError(_0x5784d1,null));};exports[_0x484c('0x24')]=function(_0x518492,_0xeac332){return db[_0x484c('0x2d')]['find']({'where':{'id':_0x518492[_0x484c('0x47')]['id']}})[_0x484c('0x25')](handleEntityNotFound(_0xeac332,null))[_0x484c('0x25')](removeEntity(_0xeac332,null))[_0x484c('0x46')](handleError(_0xeac332,null));};exports[_0x484c('0x4c')]=function(_0x46fc10,_0x4e737b){return db['WhatsappTransferReport'][_0x484c('0x4c')]()['then'](respondWithResult(_0x4e737b,null))['catch'](handleError(_0x4e737b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index edfad64..a93cba7 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 _0x176e=['api','moment','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x176e,0x111));var _0xe176=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x176e[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xe176('0x0'));var util=require(_0xe176('0x1'));var logger=require(_0xe176('0x2'))(_0xe176('0x3'));var moment=require(_0xe176('0x4'));var BPromise=require(_0xe176('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe176('0x6'));var rimraf=require('rimraf');var config=require(_0xe176('0x7'));var attributes=require(_0xe176('0x8'));module['exports']=function(_0x366c7e,_0x4363f4){return _0x366c7e[_0xe176('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0xe176('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe176('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf368=['../../config/logger','api','bluebird','request-promise','path','rimraf','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x4febd5,_0x4be25a){var _0x31199e=function(_0x13fbab){while(--_0x13fbab){_0x4febd5['push'](_0x4febd5['shift']());}};_0x31199e(++_0x4be25a);}(_0xf368,0xbe));var _0x8f36=function(_0x3510f1,_0x491d6a){_0x3510f1=_0x3510f1-0x0;var _0x7ddb81=_0xf368[_0x3510f1];return _0x7ddb81;};'use strict';var _=require(_0x8f36('0x0'));var util=require(_0x8f36('0x1'));var logger=require(_0x8f36('0x2'))(_0x8f36('0x3'));var moment=require('moment');var BPromise=require(_0x8f36('0x4'));var rp=require(_0x8f36('0x5'));var fs=require('fs');var path=require(_0x8f36('0x6'));var rimraf=require(_0x8f36('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x2b33e3,_0x53ab90){return _0x2b33e3[_0x8f36('0x8')](_0x8f36('0x9'),attributes,{'tableName':_0x8f36('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8f36('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 2830d26..8eff63d 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 _0xf4d9=['error','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0xf4d9,0xae));var _0x9f4d=function(_0x581aa0,_0x35a8e3){_0x581aa0=_0x581aa0-0x0;var _0x159d2c=_0xf4d9[_0x581aa0];return _0x159d2c;};'use strict';var _=require(_0x9f4d('0x0'));var util=require(_0x9f4d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f4d('0x2'));var fs=require('fs');var Redis=require(_0x9f4d('0x3'));var db=require(_0x9f4d('0x4'))['db'];var utils=require(_0x9f4d('0x5'));var logger=require('../../config/logger')(_0x9f4d('0x6'));var config=require(_0x9f4d('0x7'));var jayson=require(_0x9f4d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51ca55,_0x504e32,_0x52731b){return new BPromise(function(_0x1a57ba,_0x1e5a36){return client['request'](_0x51ca55,_0x52731b)[_0x9f4d('0x9')](function(_0x494c5b){logger[_0x9f4d('0xa')](_0x9f4d('0xb'),_0x504e32,_0x9f4d('0xc'));logger[_0x9f4d('0xd')](_0x9f4d('0xe'),_0x504e32,_0x9f4d('0xc'),JSON[_0x9f4d('0xf')](_0x494c5b));if(_0x494c5b[_0x9f4d('0x10')]){if(_0x494c5b[_0x9f4d('0x10')]['code']===0x1f4){logger[_0x9f4d('0x10')](_0x9f4d('0xb'),_0x504e32,_0x494c5b[_0x9f4d('0x10')]['message']);return _0x1e5a36(_0x494c5b[_0x9f4d('0x10')][_0x9f4d('0x11')]);}logger[_0x9f4d('0x10')](_0x9f4d('0xb'),_0x504e32,_0x494c5b[_0x9f4d('0x10')]['message']);return _0x1a57ba(_0x494c5b[_0x9f4d('0x10')][_0x9f4d('0x11')]);}else{logger[_0x9f4d('0xa')]('WhatsappTransferReport,\x20%s,\x20%s',_0x504e32,_0x9f4d('0xc'));_0x1a57ba(_0x494c5b[_0x9f4d('0x12')][_0x9f4d('0x11')]);}})['catch'](function(_0x8b67ad){logger[_0x9f4d('0x10')](_0x9f4d('0xb'),_0x504e32,_0x8b67ad);_0x1e5a36(_0x8b67ad);});});} \ No newline at end of file +var _0x0e13=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x53824f,_0x244804){var _0x5643c2=function(_0x6af996){while(--_0x6af996){_0x53824f['push'](_0x53824f['shift']());}};_0x5643c2(++_0x244804);}(_0x0e13,0x159));var _0x30e1=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x0e13[_0x44039a];return _0x525de5;};'use strict';var _=require(_0x30e1('0x0'));var util=require(_0x30e1('0x1'));var moment=require('moment');var BPromise=require(_0x30e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30e1('0x3'));var db=require(_0x30e1('0x4'))['db'];var utils=require(_0x30e1('0x5'));var logger=require(_0x30e1('0x6'))(_0x30e1('0x7'));var config=require('../../config/environment');var jayson=require(_0x30e1('0x8'));var client=jayson[_0x30e1('0x9')][_0x30e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa0e8eb,_0x2a5328,_0x295ed2){return new BPromise(function(_0x4e58e7,_0x2b492e){return client[_0x30e1('0xb')](_0xa0e8eb,_0x295ed2)[_0x30e1('0xc')](function(_0x3f2f8e){logger[_0x30e1('0xd')](_0x30e1('0xe'),_0x2a5328,'request\x20sent');logger['debug'](_0x30e1('0xf'),_0x2a5328,'request\x20sent',JSON['stringify'](_0x3f2f8e));if(_0x3f2f8e['error']){if(_0x3f2f8e[_0x30e1('0x10')][_0x30e1('0x11')]===0x1f4){logger[_0x30e1('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2a5328,_0x3f2f8e['error']['message']);return _0x2b492e(_0x3f2f8e['error']['message']);}logger['error'](_0x30e1('0xe'),_0x2a5328,_0x3f2f8e[_0x30e1('0x10')][_0x30e1('0x12')]);return _0x4e58e7(_0x3f2f8e[_0x30e1('0x10')][_0x30e1('0x12')]);}else{logger[_0x30e1('0xd')](_0x30e1('0xe'),_0x2a5328,'request\x20sent');_0x4e58e7(_0x3f2f8e['result'][_0x30e1('0x12')]);}})[_0x30e1('0x13')](function(_0x374d1a){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x2a5328,_0x374d1a);_0x2b492e(_0x374d1a);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a7a05d4..7f17981 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0a1=['filter','exitCode','number','length','map','name','Online\x20apps:','join','status','online','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','info','start'];(function(_0x5d5cd0,_0x13c45e){var _0x22d189=function(_0x1642f2){while(--_0x1642f2){_0x5d5cd0['push'](_0x5d5cd0['shift']());}};_0x22d189(++_0x13c45e);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x584adb,_0x5f3218){_0x584adb=_0x584adb-0x0;var _0x36b606=_0xa0a1[_0x584adb];return _0x36b606;};'use strict';var _=require(_0x1a0a('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0x1a0a('0x1'));var checkLicense=require(_0x1a0a('0x2'));var rpc=require(_0x1a0a('0x3'));var config=require('./config/environment');var logger=require('./config/logger')(_0x1a0a('0x4'));var pm2=require(_0x1a0a('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x1a0a('0x6'));var chat=require(_0x1a0a('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x1a0a('0x8'));var provider=require(_0x1a0a('0x9'));function main(){return db[_0x1a0a('0xa')][_0x1a0a('0xb')]()[_0x1a0a('0xc')](function(){if(config['seedDB']){return seedDb[_0x1a0a('0xd')]();}})[_0x1a0a('0xc')](function(){return checkLicense[_0x1a0a('0xd')]();})['then'](function(){return rpc['listen']();})['then'](function(_0x42277a){logger[_0x1a0a('0xe')](_0x42277a);return chat[_0x1a0a('0xf')]();})['then'](function(){return whatsapp[_0x1a0a('0xf')]();})['then'](function(){return schedule[_0x1a0a('0xf')]();})[_0x1a0a('0xc')](function(){return transcribe[_0x1a0a('0xf')]();})[_0x1a0a('0xc')](function(){return provider[_0x1a0a('0xf')]();})[_0x1a0a('0xc')](function(_0x3f34d2){logger['info'](_0x3f34d2);return pm2[_0x1a0a('0xf')](pm2Config);})[_0x1a0a('0xc')](function(_0x3c531c){var _0x26c1df=_0x3c531c[_0x1a0a('0x10')](function(_0x4c8080){return typeof _0x4c8080[_0x1a0a('0x11')]===_0x1a0a('0x12')&&_0x4c8080[_0x1a0a('0x11')]>=0x0;});if(_0x26c1df['length']>0x0){throw new Error(_0x26c1df[_0x1a0a('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x1a0a('0x14')](_0x26c1df,function(_0x57f65d){return'\x22'+_0x57f65d['pm2_env'][_0x1a0a('0x15')]+'\x22';}));}logger[_0x1a0a('0xe')](_0x1a0a('0x16'),_[_0x1a0a('0x14')](_['filter'](_0x3c531c,{'status':'online'}),_0x1a0a('0x15'))[_0x1a0a('0x17')]());logger[_0x1a0a('0xe')]('Offline\x20apps:',_[_0x1a0a('0x14')](_[_0x1a0a('0x10')](_0x3c531c,function(_0x5bb4bd){return _0x5bb4bd[_0x1a0a('0x18')]!==_0x1a0a('0x19');}),_0x1a0a('0x15'))['join']()||_0x1a0a('0x1a'));console[_0x1a0a('0x1b')](_0x1a0a('0x1c'));})['catch'](function(_0x33fcf4){console['log'](_0x1a0a('0x1d'),_0x33fcf4);logger[_0x1a0a('0x1e')](_0x1a0a('0x1f'),_0x33fcf4);process[_0x1a0a('0x20')](0x1);});}main(); \ No newline at end of file +var _0xb7a7=['./mysqldb','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','name','join','Offline\x20apps:','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash'];(function(_0x3f9ac2,_0x1b670b){var _0xe6a436=function(_0x1f3ea5){while(--_0x1f3ea5){_0x3f9ac2['push'](_0x3f9ac2['shift']());}};_0xe6a436(++_0x1b670b);}(_0xb7a7,0x6e));var _0x7b7a=function(_0xb1fed1,_0x1259fb){_0xb1fed1=_0xb1fed1-0x0;var _0x4e15ed=_0xb7a7[_0xb1fed1];return _0x4e15ed;};'use strict';var _=require(_0x7b7a('0x0'));var db=require(_0x7b7a('0x1'))['db'];var seedDb=require(_0x7b7a('0x2'));var checkLicense=require(_0x7b7a('0x3'));var rpc=require(_0x7b7a('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x7b7a('0x5'));var pm2=require(_0x7b7a('0x6'));var pm2Config=require(_0x7b7a('0x7'));var schedule=require('./config/schedule');var chat=require(_0x7b7a('0x8'));var whatsapp=require(_0x7b7a('0x9'));var transcribe=require(_0x7b7a('0xa'));var provider=require(_0x7b7a('0xb'));function main(){return db[_0x7b7a('0xc')][_0x7b7a('0xd')]()[_0x7b7a('0xe')](function(){if(config[_0x7b7a('0xf')]){return seedDb[_0x7b7a('0x10')]();}})['then'](function(){return checkLicense[_0x7b7a('0x10')]();})['then'](function(){return rpc[_0x7b7a('0x11')]();})[_0x7b7a('0xe')](function(_0x3f563e){logger[_0x7b7a('0x12')](_0x3f563e);return chat[_0x7b7a('0x13')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x7b7a('0xe')](function(){return transcribe[_0x7b7a('0x13')]();})['then'](function(){return provider[_0x7b7a('0x13')]();})[_0x7b7a('0xe')](function(_0x318b50){logger[_0x7b7a('0x12')](_0x318b50);return pm2[_0x7b7a('0x13')](pm2Config);})[_0x7b7a('0xe')](function(_0x2a8585){var _0x2e36dd=_0x2a8585[_0x7b7a('0x14')](function(_0x3b1998){return typeof _0x3b1998['exitCode']==='number'&&_0x3b1998[_0x7b7a('0x15')]>=0x0;});if(_0x2e36dd[_0x7b7a('0x16')]>0x0){throw new Error(_0x2e36dd[_0x7b7a('0x16')]+_0x7b7a('0x17')+_[_0x7b7a('0x18')](_0x2e36dd,function(_0x5bc717){return'\x22'+_0x5bc717[_0x7b7a('0x19')]['name']+'\x22';}));}logger[_0x7b7a('0x12')](_0x7b7a('0x1a'),_[_0x7b7a('0x18')](_[_0x7b7a('0x14')](_0x2a8585,{'status':_0x7b7a('0x1b')}),_0x7b7a('0x1c'))[_0x7b7a('0x1d')]());logger[_0x7b7a('0x12')](_0x7b7a('0x1e'),_[_0x7b7a('0x18')](_[_0x7b7a('0x14')](_0x2a8585,function(_0x402794){return _0x402794['status']!=='online';}),_0x7b7a('0x1c'))[_0x7b7a('0x1d')]()||_0x7b7a('0x1f'));console['log'](_0x7b7a('0x20'));})[_0x7b7a('0x21')](function(_0x558198){console[_0x7b7a('0x22')](_0x7b7a('0x23'),_0x558198);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x558198);process[_0x7b7a('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 30c9214..56e66c8 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 _0xcf41=['Wrong\x20credentials.','Bearer','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','Unknown\x20authorization\x20format','User\x20not\x20found.','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','Sequelize','updatePasswordsHistory','length','splice','encryptString','join','promisify','sign','secret','session','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','secrets','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','showWebBar','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','query','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','then','pass'];(function(_0x45560d,_0x4499fe){var _0x28a6b1=function(_0x3abe55){while(--_0x3abe55){_0x45560d['push'](_0x45560d['shift']());}};_0x28a6b1(++_0x4499fe);}(_0xcf41,0x155));var _0x1cf4=function(_0x340d34,_0x40228e){_0x340d34=_0x340d34-0x0;var _0x55d597=_0xcf41[_0x340d34];return _0x55d597;};'use strict';var db=require(_0x1cf4('0x0'))['db'];var config=require(_0x1cf4('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x1cf4('0x2'));var encryptor=require(_0x1cf4('0x3'));var _=require(_0x1cf4('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x1cf4('0x5'));var compose=require(_0x1cf4('0x6'));var basicAuth=require(_0x1cf4('0x7'));var crypto=require(_0x1cf4('0x8'));var BPromise=require(_0x1cf4('0x9'));var util=require(_0x1cf4('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x1cf4('0xb')]['session']});var userAttributes=['id',_0x1cf4('0xc'),_0x1cf4('0xd'),_0x1cf4('0xe'),_0x1cf4('0xf'),_0x1cf4('0x10'),_0x1cf4('0x11'),_0x1cf4('0x12'),_0x1cf4('0x13'),_0x1cf4('0x14'),_0x1cf4('0x15'),_0x1cf4('0x16'),_0x1cf4('0x17'),'smsPause','openchannelPause','pauseType',_0x1cf4('0x18'),'lastLoginAt',_0x1cf4('0x19'),'crudPermissions','allowmessenger',_0x1cf4('0x1a'),_0x1cf4('0x1b'),_0x1cf4('0x1c'),_0x1cf4('0x1d'),_0x1cf4('0x1e'),_0x1cf4('0x1f'),_0x1cf4('0x20'),_0x1cf4('0x21'),_0x1cf4('0x22'),_0x1cf4('0x23'),_0x1cf4('0x24'),_0x1cf4('0x25'),_0x1cf4('0x26'),'interface',_0x1cf4('0x27'),_0x1cf4('0x28'),_0x1cf4('0x29'),_0x1cf4('0x2a'),'downloadVoiceRecordings',_0x1cf4('0x2b'),_0x1cf4('0x2c'),_0x1cf4('0x2d'),'selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay',_0x1cf4('0x2e'),_0x1cf4('0x2f'),'smsAutoanswer',_0x1cf4('0x30'),_0x1cf4('0x31'),_0x1cf4('0x32'),_0x1cf4('0x33'),'faxAutoanswerDelay',_0x1cf4('0x34'),_0x1cf4('0x35'),_0x1cf4('0x36')];exports[_0x1cf4('0x37')]=function(){return this[_0x1cf4('0x38')](!![])[_0x1cf4('0x39')](function(_0x517143,_0x28e73f,_0x1f7e1c){if(_0x517143[_0x1cf4('0x3a')]){_0x1f7e1c();}else{return db[_0x1cf4('0x3b')][_0x1cf4('0x3c')]({'where':{'id':_0x517143[_0x1cf4('0x3d')]['id']},'attributes':['id',_0x1cf4('0x3e'),'disposition'],'raw':!![]})['then'](function(_0x762542){if(_0x762542&&_0x762542[_0x1cf4('0x3e')]&&!_0x517143[_0x1cf4('0x3f')]['forceDownload']){return _0x28e73f[_0x1cf4('0x40')](_0x762542[_0x1cf4('0x41')]===_0x1cf4('0x42')?0x195:0x193)[_0x1cf4('0x43')]({'message':_0x762542[_0x1cf4('0x41')]==='unmanaged'?_0x1cf4('0x44'):_0x1cf4('0x45')});}else{_0x1f7e1c();}})[_0x1cf4('0x46')](function(_0x100096){_0x1f7e1c(_0x100096);});}});};exports[_0x1cf4('0x38')]=function isAuthenticated(_0x524fdf){return compose()['use'](function(_0x230c2a,_0x217f88,_0x2c1de5){var _0x46bb36;if(_0x230c2a[_0x1cf4('0x47')][_0x1cf4('0x48')]){if(_[_0x1cf4('0x49')](_0x230c2a[_0x1cf4('0x47')][_0x1cf4('0x48')],_0x1cf4('0x4a'))){var _0x339f65=basicAuth(_0x230c2a);db[_0x1cf4('0x4b')][_0x1cf4('0x4c')]({'where':{'name':_0x339f65[_0x1cf4('0xe')]}})[_0x1cf4('0x4d')](function(_0x1e60ab){if(!_0x1e60ab||!_0x1e60ab['authenticate'](_0x339f65[_0x1cf4('0x4e')])){return _0x217f88[_0x1cf4('0x40')](0x191)[_0x1cf4('0x43')]({'message':_0x1cf4('0x4f')});}_0x230c2a[_0x1cf4('0x3a')]={'id':_0x1e60ab['id']};_0x2c1de5();})[_0x1cf4('0x46')](function(_0x294f50){_0x2c1de5(_0x294f50);});}else if(_['startsWith'](_0x230c2a[_0x1cf4('0x47')][_0x1cf4('0x48')],_0x1cf4('0x50'))){validateJwt(_0x230c2a,_0x217f88,_0x2c1de5);}else{if(_0x524fdf){_0x2c1de5();}else{return _0x217f88[_0x1cf4('0x40')](0x193)[_0x1cf4('0x43')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x230c2a[_0x1cf4('0x3f')][_0x1cf4('0x51')]){try{var _0x1357c6={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x1cf4('0x52')]()};verifyJwt(_0x230c2a['query'][_0x1cf4('0x51')],_0x1357c6)[_0x1cf4('0x4d')](function(_0xec153a){return db[_0x1cf4('0x4b')][_0x1cf4('0x4c')]({'where':{'id':_0xec153a[_0x1cf4('0x53')]}})[_0x1cf4('0x4d')](function(_0x482e8d){_0x46bb36=_0x482e8d;return db[_0x1cf4('0x54')][_0x1cf4('0x3c')]({'where':{'id':0x1},'attributes':[_0x1cf4('0x55'),_0x1cf4('0x56')],'raw':!![]});})[_0x1cf4('0x4d')](function(_0x299eb1){if(!_0x46bb36||!_[_0x1cf4('0x57')](_0x46bb36[_0x1cf4('0x58')],_0xec153a[_0x1cf4('0x59')])){return _0x217f88['status'](0x191)[_0x1cf4('0x43')]({'message':_0x1cf4('0x5a')});}if(_0x46bb36[_0x1cf4('0x5b')]){return _0x217f88[_0x1cf4('0x40')](0x191)[_0x1cf4('0x43')]({'message':_0x1cf4('0x5c')});}if(_0x46bb36['blocked']){if(_0x299eb1[_0x1cf4('0x56')]>0x0){if(moment(_0x46bb36[_0x1cf4('0x5d')])[_0x1cf4('0x5e')](_0x299eb1[_0x1cf4('0x56')],'minutes')>moment()){return _0x217f88[_0x1cf4('0x40')](0x191)[_0x1cf4('0x43')]({'message':_0x1cf4('0x5c')});}}else{return _0x217f88[_0x1cf4('0x40')](0x191)[_0x1cf4('0x43')]({'message':_0x1cf4('0x5c')});}}_0x230c2a['user']={'id':_0x46bb36['id']};_0x2c1de5();});})[_0x1cf4('0x46')](function(){return _0x217f88[_0x1cf4('0x40')](0x191)['json']({'message':_0x1cf4('0x5c')});});}catch(_0x557578){_0x2c1de5(_0x557578);}}else if(_0x524fdf){_0x2c1de5();}else{return _0x217f88[_0x1cf4('0x40')](0x193)[_0x1cf4('0x43')]({'message':_0x1cf4('0x5f')});}})[_0x1cf4('0x39')](function(_0x38450f,_0x5d8a84,_0x423acb){if(_0x38450f[_0x1cf4('0x3a')]){db['User'][_0x1cf4('0x4c')]({'where':{'id':_0x38450f[_0x1cf4('0x3a')]['id']},'attributes':userAttributes})[_0x1cf4('0x4d')](function(_0x33c1ba){if(!_0x33c1ba){return _0x5d8a84['status'](0x194)[_0x1cf4('0x43')]({'message':_0x1cf4('0x60')});}_0x38450f['user']=_0x33c1ba;_0x423acb();})[_0x1cf4('0x46')](function(_0x422110){_0x423acb(_0x422110);});}else if(_0x524fdf){_0x423acb();}else{return _0x5d8a84['status'](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x1cf4('0x39')](function(_0x1113c5,_0x4c1dd9,_0x2f3dbe){return licenseUtil['getLicense']()[_0x1cf4('0x4d')](function(_0x4c8c75){if(_0x4c8c75[_0x1cf4('0x61')]){_0x2f3dbe();}else{return _0x4c1dd9[_0x1cf4('0x40')](0x193)['json']({'message':_0x1cf4('0x62')});}})[_0x1cf4('0x46')](function(_0x12f104){_0x2f3dbe(_0x12f104);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x1cf4('0x39')](function(_0x5482c9,_0x336776,_0x42ce8f){return licenseUtil['getLicense']()['then'](function(_0x21443f){if(_0x21443f[_0x1cf4('0x63')]){_0x42ce8f();}else{return _0x336776['status'](0x193)[_0x1cf4('0x43')]({'message':_0x1cf4('0x62')});}})[_0x1cf4('0x46')](function(_0x6d77c3){_0x42ce8f(_0x6d77c3);});});};exports[_0x1cf4('0x64')]=function(_0x89f804,_0x34d695,_0x15ea48){_0x89f804[_0x1cf4('0x64')]=!![];return _0x15ea48();};exports[_0x1cf4('0x65')]=function signToken(_0x3b59d9){return signJwt(_0x3b59d9);};exports[_0x1cf4('0x66')]=function(_0x5358ec,_0x500609){if(!_0x5358ec[_0x1cf4('0x3a')]){return _0x500609['status'](0x194)['json']({'message':_0x1cf4('0x67')});}var _0x52e12e={'payload':{'id':_0x5358ec[_0x1cf4('0x3a')]['id'],'role':_0x5358ec['user'][_0x1cf4('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x52e12e)[_0x1cf4('0x4d')](function(_0x13f023){_0x500609['cookie'](_0x1cf4('0x68'),_0x13f023);_0x500609['redirect'](_0x1cf4('0x69'));})[_0x1cf4('0x46')](function(_0x1bc249){return _0x500609['status'](0x1f4)[_0x1cf4('0x6a')](_0x1bc249);});};exports[_0x1cf4('0x6b')]=function(_0x5b327e){if(_[_0x1cf4('0x6c')](_0x5b327e[_0x1cf4('0x58')])||_[_0x1cf4('0x6c')](_0x5b327e[_0x1cf4('0x6d')])){return null;}else{return createJwt(_0x5b327e);}};exports[_0x1cf4('0x6e')]=function(_0xbddab3){_0xbddab3[_0x1cf4('0x58')]=generateNonce();_0xbddab3[_0x1cf4('0x6d')]=generateIssuedAt();return createJwt(_0xbddab3);};exports[_0x1cf4('0x6f')]=function(_0x2a913c,_0x2c9a92){var _0x376ff8=_0x2a913c['query']['apikey'];if(_0x376ff8){var _0x2e442d={'nonce':_0x2c9a92[_0x1cf4('0x58')],'iat':_0x2c9a92[_0x1cf4('0x6d')],'audience':hardwareConf[_0x1cf4('0x52')](),'issuer':hardwareConf[_0x1cf4('0x52')]()};return verifyJwt(_0x376ff8,_0x2e442d)[_0x1cf4('0x4d')](function(){return generateApiKey(_0x2c9a92);});}else{throw{'message':_0x1cf4('0x70')};}};exports[_0x1cf4('0x71')]=function(_0x1d6c0b){var _0x3bbaaf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3bbaaf[_0x1cf4('0x72')](_0x1d6c0b))throw new db['Sequelize'][(_0x1cf4('0x73'))](_0x1cf4('0x74'));return;};exports[_0x1cf4('0x75')]=function(_0x28e940,_0x2b0c33,_0x180061){var _0x254bc0=encryptor[_0x1cf4('0x76')](_0x2b0c33)[_0x1cf4('0x77')](',');for(var _0x435a3c=0x0;_0x435a3c<_0x180061;_0x435a3c++){if(!_0x254bc0[_0x435a3c])break;if(_0x28e940[_0x1cf4('0x78')]()===_0x254bc0[_0x435a3c]['toLowerCase']()){var _0x559583=util[_0x1cf4('0x79')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x180061);if(_0x180061===0x1){_0x559583='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x1cf4('0x7a'))][(_0x1cf4('0x73'))](_0x559583);}}return;};exports[_0x1cf4('0x7b')]=function(_0x43b6da,_0x5f27f9){var _0x4ea573=_0x5f27f9?encryptor['decryptString'](_0x5f27f9)['split'](','):[];if(_0x4ea573[_0x1cf4('0x7c')]===0x5){_0x4ea573[_0x1cf4('0x7d')](-0x1,0x1);}_0x4ea573['unshift'](_0x43b6da);return encryptor[_0x1cf4('0x7e')](_0x4ea573[_0x1cf4('0x7f')](','));};function signJwt(_0x45cbe2){var _0x4432e7=BPromise[_0x1cf4('0x80')](jwt[_0x1cf4('0x81')],{'context':jwt});var _0x33b348=_0x45cbe2[_0x1cf4('0x82')]||config['secrets'][_0x1cf4('0x83')];return new BPromise(function(_0x32f36f,_0x38acf4){_0x4432e7(_0x45cbe2['payload'],_0x33b348,_0x45cbe2[_0x1cf4('0x84')])['then'](function(_0x164205){_0x32f36f(_0x164205);})[_0x1cf4('0x46')](function(_0x13c114){_0x38acf4(_0x13c114);});});}function verifyJwt(_0x365372,_0x9ba1cd,_0x2f1b40){var _0x28e225=BPromise['promisify'](jwt[_0x1cf4('0x85')],{'context':jwt});var _0xdc6272=_0x2f1b40||config[_0x1cf4('0xb')][_0x1cf4('0x83')];return new BPromise(function(_0x4ebece,_0x4b57e5){_0x28e225(_0x365372,_0xdc6272,_0x9ba1cd)['then'](function(_0x1ec8df){_0x4ebece(_0x1ec8df);})[_0x1cf4('0x46')](function(_0x54648f){_0x4b57e5(_0x54648f);});});}function generateNonce(){return crypto[_0x1cf4('0x86')](0x10)[_0x1cf4('0x87')](_0x1cf4('0x88'));}function generateIssuedAt(){return Math[_0x1cf4('0x89')](Date[_0x1cf4('0x8a')]()/0x3e8)[_0x1cf4('0x87')]();}function createJwt(_0x9bb6c4){var _0x111842={'payload':{'iat':_0x9bb6c4[_0x1cf4('0x6d')],'nonce':_0x9bb6c4[_0x1cf4('0x58')]},'options':{'algorithm':_0x1cf4('0x8b'),'subject':_0x9bb6c4['id']['toString'](),'issuer':hardwareConf[_0x1cf4('0x52')](),'audience':hardwareConf[_0x1cf4('0x52')]()}};return signJwt(_0x111842)[_0x1cf4('0x4d')](function(_0x47aeae){return{'iat':_0x9bb6c4[_0x1cf4('0x6d')],'nonce':_0x9bb6c4[_0x1cf4('0x58')],'token':_0x47aeae};});} \ No newline at end of file +var _0x4fbd=['use','user','ChatInteraction','findOne','params','closed','disposition','query','status','unmanaged','json','Unmanaged.','Forbidden.','catch','startsWith','headers','authorization','Basic','User','then','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','sign','secret','options','promisify','verify','randomBytes','hex','floor','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','util','moment','secrets','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated'];(function(_0x54e196,_0x36d442){var _0x4832ff=function(_0x350fe2){while(--_0x350fe2){_0x54e196['push'](_0x54e196['shift']());}};_0x4832ff(++_0x36d442);}(_0x4fbd,0x163));var _0xd4fb=function(_0x44d65d,_0x5d35aa){_0x44d65d=_0x44d65d-0x0;var _0x539405=_0x4fbd[_0x44d65d];return _0x539405;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xd4fb('0x0'));var hardwareConf=require(_0xd4fb('0x1'));var licenseUtil=require(_0xd4fb('0x2'));var encryptor=require(_0xd4fb('0x3'));var _=require(_0xd4fb('0x4'));var jwt=require(_0xd4fb('0x5'));var expressJwt=require(_0xd4fb('0x6'));var compose=require(_0xd4fb('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0xd4fb('0x8'));var BPromise=require('bluebird');var util=require(_0xd4fb('0x9'));var moment=require(_0xd4fb('0xa'));var validateJwt=expressJwt({'secret':config[_0xd4fb('0xb')]['session']});var userAttributes=['id','role',_0xd4fb('0xc'),_0xd4fb('0xd'),_0xd4fb('0xe'),_0xd4fb('0xf'),'userpic',_0xd4fb('0x10'),_0xd4fb('0x11'),_0xd4fb('0x12'),_0xd4fb('0x13'),_0xd4fb('0x14'),_0xd4fb('0x15'),_0xd4fb('0x16'),'openchannelPause',_0xd4fb('0x17'),_0xd4fb('0x18'),_0xd4fb('0x19'),'lastPauseAt',_0xd4fb('0x1a'),_0xd4fb('0x1b'),_0xd4fb('0x1c'),_0xd4fb('0x1d'),'phoneBarAutoAnswer',_0xd4fb('0x1e'),'phoneBarDnd',_0xd4fb('0x1f'),_0xd4fb('0x20'),_0xd4fb('0x21'),_0xd4fb('0x22'),_0xd4fb('0x23'),_0xd4fb('0x24'),_0xd4fb('0x25'),'hotdesk',_0xd4fb('0x26'),_0xd4fb('0x27'),'privacyEnabled',_0xd4fb('0x28'),_0xd4fb('0x29'),_0xd4fb('0x2a'),'downloadOmnichannelInteractions',_0xd4fb('0x2b'),_0xd4fb('0x2c'),_0xd4fb('0x2d'),_0xd4fb('0x2e'),_0xd4fb('0x2f'),_0xd4fb('0x30'),_0xd4fb('0x31'),_0xd4fb('0x32'),'smsAutoanswerDelay','openchannelAutoanswer',_0xd4fb('0x33'),_0xd4fb('0x34'),_0xd4fb('0x35'),_0xd4fb('0x36'),_0xd4fb('0x37'),_0xd4fb('0x38')];exports[_0xd4fb('0x39')]=function(){return this[_0xd4fb('0x3a')](!![])[_0xd4fb('0x3b')](function(_0x1cb5a1,_0x24be56,_0x1da447){if(_0x1cb5a1[_0xd4fb('0x3c')]){_0x1da447();}else{return db[_0xd4fb('0x3d')][_0xd4fb('0x3e')]({'where':{'id':_0x1cb5a1[_0xd4fb('0x3f')]['id']},'attributes':['id',_0xd4fb('0x40'),_0xd4fb('0x41')],'raw':!![]})['then'](function(_0x35facb){if(_0x35facb&&_0x35facb[_0xd4fb('0x40')]&&!_0x1cb5a1[_0xd4fb('0x42')]['forceDownload']){return _0x24be56[_0xd4fb('0x43')](_0x35facb[_0xd4fb('0x41')]===_0xd4fb('0x44')?0x195:0x193)[_0xd4fb('0x45')]({'message':_0x35facb[_0xd4fb('0x41')]==='unmanaged'?_0xd4fb('0x46'):_0xd4fb('0x47')});}else{_0x1da447();}})[_0xd4fb('0x48')](function(_0x179fdd){_0x1da447(_0x179fdd);});}});};exports['isAuthenticated']=function isAuthenticated(_0x52872c){return compose()[_0xd4fb('0x3b')](function(_0x315262,_0x1e7c37,_0x11c6ad){var _0xe3fd88;if(_0x315262['headers']['authorization']){if(_[_0xd4fb('0x49')](_0x315262[_0xd4fb('0x4a')][_0xd4fb('0x4b')],_0xd4fb('0x4c'))){var _0x590907=basicAuth(_0x315262);db[_0xd4fb('0x4d')]['find']({'where':{'name':_0x590907[_0xd4fb('0xd')]}})[_0xd4fb('0x4e')](function(_0x2ebcaf){if(!_0x2ebcaf||!_0x2ebcaf[_0xd4fb('0x4f')](_0x590907[_0xd4fb('0x50')])){return _0x1e7c37[_0xd4fb('0x43')](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x51')});}_0x315262[_0xd4fb('0x3c')]={'id':_0x2ebcaf['id']};_0x11c6ad();})['catch'](function(_0x46224e){_0x11c6ad(_0x46224e);});}else if(_[_0xd4fb('0x49')](_0x315262['headers'][_0xd4fb('0x4b')],_0xd4fb('0x52'))){validateJwt(_0x315262,_0x1e7c37,_0x11c6ad);}else{if(_0x52872c){_0x11c6ad();}else{return _0x1e7c37[_0xd4fb('0x43')](0x193)[_0xd4fb('0x45')]({'message':_0xd4fb('0x53')});}}}else if(_0x315262[_0xd4fb('0x42')][_0xd4fb('0x54')]){try{var _0x3c9cfb={'audience':hardwareConf[_0xd4fb('0x55')](),'issuer':hardwareConf[_0xd4fb('0x55')]()};verifyJwt(_0x315262['query']['apikey'],_0x3c9cfb)[_0xd4fb('0x4e')](function(_0x41cf14){return db[_0xd4fb('0x4d')][_0xd4fb('0x56')]({'where':{'id':_0x41cf14['sub']}})['then'](function(_0x1cd117){_0xe3fd88=_0x1cd117;return db[_0xd4fb('0x57')][_0xd4fb('0x3e')]({'where':{'id':0x1},'attributes':[_0xd4fb('0x58'),_0xd4fb('0x59')],'raw':!![]});})[_0xd4fb('0x4e')](function(_0x2168a6){if(!_0xe3fd88||!_[_0xd4fb('0x5a')](_0xe3fd88[_0xd4fb('0x5b')],_0x41cf14['nonce'])){return _0x1e7c37[_0xd4fb('0x43')](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5c')});}if(_0xe3fd88['disabled']){return _0x1e7c37[_0xd4fb('0x43')](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5d')});}if(_0xe3fd88[_0xd4fb('0x5e')]){if(_0x2168a6[_0xd4fb('0x59')]>0x0){if(moment(_0xe3fd88['blockedAt'])[_0xd4fb('0x5f')](_0x2168a6['blockDuration'],_0xd4fb('0x60'))>moment()){return _0x1e7c37['status'](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5d')});}}else{return _0x1e7c37[_0xd4fb('0x43')](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5d')});}}_0x315262[_0xd4fb('0x3c')]={'id':_0xe3fd88['id']};_0x11c6ad();});})[_0xd4fb('0x48')](function(){return _0x1e7c37['status'](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5d')});});}catch(_0x568647){_0x11c6ad(_0x568647);}}else if(_0x52872c){_0x11c6ad();}else{return _0x1e7c37['status'](0x193)[_0xd4fb('0x45')]({'message':_0xd4fb('0x53')});}})[_0xd4fb('0x3b')](function(_0x4c81f6,_0x9650ca,_0xa112c7){if(_0x4c81f6[_0xd4fb('0x3c')]){db[_0xd4fb('0x4d')][_0xd4fb('0x56')]({'where':{'id':_0x4c81f6[_0xd4fb('0x3c')]['id']},'attributes':userAttributes})[_0xd4fb('0x4e')](function(_0x4e3aac){if(!_0x4e3aac){return _0x9650ca[_0xd4fb('0x43')](0x194)[_0xd4fb('0x45')]({'message':_0xd4fb('0x61')});}_0x4c81f6[_0xd4fb('0x3c')]=_0x4e3aac;_0xa112c7();})[_0xd4fb('0x48')](function(_0x40cdf3){_0xa112c7(_0x40cdf3);});}else if(_0x52872c){_0xa112c7();}else{return _0x9650ca[_0xd4fb('0x43')](0x194)[_0xd4fb('0x45')]({'message':_0xd4fb('0x62')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xd4fb('0x3b')](function(_0x4bfde8,_0x4e1695,_0x3e41f0){return licenseUtil[_0xd4fb('0x63')]()[_0xd4fb('0x4e')](function(_0x48f946){if(_0x48f946[_0xd4fb('0x64')]){_0x3e41f0();}else{return _0x4e1695[_0xd4fb('0x43')](0x193)[_0xd4fb('0x45')]({'message':_0xd4fb('0x65')});}})[_0xd4fb('0x48')](function(_0x4d2aff){_0x3e41f0(_0x4d2aff);});});};exports[_0xd4fb('0x66')]=function isWebrtcLicence(){return compose()[_0xd4fb('0x3b')](function(_0x530e1d,_0x5b7707,_0x206eb7){return licenseUtil[_0xd4fb('0x63')]()['then'](function(_0x3678fb){if(_0x3678fb[_0xd4fb('0x67')]){_0x206eb7();}else{return _0x5b7707[_0xd4fb('0x43')](0x193)['json']({'message':_0xd4fb('0x65')});}})[_0xd4fb('0x48')](function(_0x1893e1){_0x206eb7(_0x1893e1);});});};exports[_0xd4fb('0x68')]=function(_0x440596,_0x398365,_0x3ec84b){_0x440596[_0xd4fb('0x68')]=!![];return _0x3ec84b();};exports[_0xd4fb('0x69')]=function signToken(_0x43a294){return signJwt(_0x43a294);};exports['setTokenCookie']=function(_0x5d9b25,_0x2ca6e9){if(!_0x5d9b25[_0xd4fb('0x3c')]){return _0x2ca6e9[_0xd4fb('0x43')](0x194)[_0xd4fb('0x45')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x63dc0e={'payload':{'id':_0x5d9b25[_0xd4fb('0x3c')]['id'],'role':_0x5d9b25[_0xd4fb('0x3c')][_0xd4fb('0x6a')]},'options':{'expiresIn':0x15180}};return signJwt(_0x63dc0e)[_0xd4fb('0x4e')](function(_0x5bd4d4){_0x2ca6e9[_0xd4fb('0x6b')](_0xd4fb('0x6c'),_0x5bd4d4);_0x2ca6e9[_0xd4fb('0x6d')]('/dashboards/general');})[_0xd4fb('0x48')](function(_0x55fa08){return _0x2ca6e9[_0xd4fb('0x43')](0x1f4)[_0xd4fb('0x6e')](_0x55fa08);});};exports['retrieveApiKey']=function(_0x46b942){if(_[_0xd4fb('0x6f')](_0x46b942['apiKeyNonce'])||_['isNil'](_0x46b942[_0xd4fb('0x70')])){return null;}else{return createJwt(_0x46b942);}};exports[_0xd4fb('0x71')]=function(_0x24fde3){_0x24fde3[_0xd4fb('0x5b')]=generateNonce();_0x24fde3[_0xd4fb('0x70')]=generateIssuedAt();return createJwt(_0x24fde3);};exports['regenerateApiKey']=function(_0x3a971c,_0x2465d7){var _0x3a1856=_0x3a971c[_0xd4fb('0x42')][_0xd4fb('0x54')];if(_0x3a1856){var _0x12bb9c={'nonce':_0x2465d7['apiKeyNonce'],'iat':_0x2465d7[_0xd4fb('0x70')],'audience':hardwareConf[_0xd4fb('0x55')](),'issuer':hardwareConf[_0xd4fb('0x55')]()};return verifyJwt(_0x3a1856,_0x12bb9c)[_0xd4fb('0x4e')](function(){return generateApiKey(_0x2465d7);});}else{throw{'message':_0xd4fb('0x72')};}};exports[_0xd4fb('0x73')]=function(_0x5a8a60){var _0x5ac99e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac99e[_0xd4fb('0x74')](_0x5a8a60))throw new db[(_0xd4fb('0x75'))][(_0xd4fb('0x76'))](_0xd4fb('0x77'));return;};exports[_0xd4fb('0x78')]=function(_0x56e092,_0x545ed0,_0x3d4f61){var _0x206afa=encryptor[_0xd4fb('0x79')](_0x545ed0)['split'](',');for(var _0x1064d6=0x0;_0x1064d6<_0x3d4f61;_0x1064d6++){if(!_0x206afa[_0x1064d6])break;if(_0x56e092[_0xd4fb('0x7a')]()===_0x206afa[_0x1064d6]['toLowerCase']()){var _0x567cd2=util['format'](_0xd4fb('0x7b'),_0x3d4f61);if(_0x3d4f61===0x1){_0x567cd2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xd4fb('0x75'))][(_0xd4fb('0x76'))](_0x567cd2);}}return;};exports[_0xd4fb('0x7c')]=function(_0x45f263,_0x2d0dde){var _0x1f94f2=_0x2d0dde?encryptor[_0xd4fb('0x79')](_0x2d0dde)['split'](','):[];if(_0x1f94f2['length']===0x5){_0x1f94f2['splice'](-0x1,0x1);}_0x1f94f2[_0xd4fb('0x7d')](_0x45f263);return encryptor[_0xd4fb('0x7e')](_0x1f94f2[_0xd4fb('0x7f')](','));};function signJwt(_0xbd25a8){var _0x52030b=BPromise['promisify'](jwt[_0xd4fb('0x80')],{'context':jwt});var _0x232610=_0xbd25a8[_0xd4fb('0x81')]||config['secrets']['session'];return new BPromise(function(_0x3acfb6,_0x55e018){_0x52030b(_0xbd25a8['payload'],_0x232610,_0xbd25a8[_0xd4fb('0x82')])['then'](function(_0x173030){_0x3acfb6(_0x173030);})['catch'](function(_0x36f4b8){_0x55e018(_0x36f4b8);});});}function verifyJwt(_0x4e46c9,_0x3ba167,_0x54c64b){var _0x207edb=BPromise[_0xd4fb('0x83')](jwt[_0xd4fb('0x84')],{'context':jwt});var _0x8733a3=_0x54c64b||config[_0xd4fb('0xb')]['session'];return new BPromise(function(_0x49cc41,_0x15598b){_0x207edb(_0x4e46c9,_0x8733a3,_0x3ba167)['then'](function(_0x366c5a){_0x49cc41(_0x366c5a);})['catch'](function(_0x183f8b){_0x15598b(_0x183f8b);});});}function generateNonce(){return crypto[_0xd4fb('0x85')](0x10)['toString'](_0xd4fb('0x86'));}function generateIssuedAt(){return Math[_0xd4fb('0x87')](Date['now']()/0x3e8)[_0xd4fb('0x88')]();}function createJwt(_0x577fd5){var _0x1146c7={'payload':{'iat':_0x577fd5[_0xd4fb('0x70')],'nonce':_0x577fd5[_0xd4fb('0x5b')]},'options':{'algorithm':_0xd4fb('0x89'),'subject':_0x577fd5['id'][_0xd4fb('0x88')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xd4fb('0x55')]()}};return signJwt(_0x1146c7)[_0xd4fb('0x4e')](function(_0x496fb9){return{'iat':_0x577fd5[_0xd4fb('0x70')],'nonce':_0x577fd5['apiKeyNonce'],'token':_0x496fb9};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 3e5f2f9..4de949b 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 _0x8b38=['startsWith','cf_','CmCustomField','findOne','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','user','clause','checkListsRestrictions','tag','count','buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','keys'];(function(_0x56dda4,_0x3cb025){var _0x210c67=function(_0xbb20ba){while(--_0xbb20ba){_0x56dda4['push'](_0x56dda4['shift']());}};_0x210c67(++_0x3cb025);}(_0x8b38,0x147));var _0x88b3=function(_0x3aa0ac,_0x5f5da6){_0x3aa0ac=_0x3aa0ac-0x0;var _0x568a11=_0x8b38[_0x3aa0ac];return _0x568a11;};'use strict';var _=require(_0x88b3('0x0'));var sqlUtils=require(_0x88b3('0x1'));var db=require(_0x88b3('0x2'))['db'];exports[_0x88b3('0x3')]=function(_0x58f0d3,_0x12b67b,_0xacdd9b,_0x5dbca6){var _0xa1f98e={'count':0x0,'rows':[]};var _0xefcb36=sqlUtils['skipContactsQuery'](_0x12b67b,_0x58f0d3);if(_0xefcb36){return Promise[_0x88b3('0x4')](_0xa1f98e);}var _0x9d82d=sqlUtils[_0x88b3('0x5')]();var _0xbb9ac8={};var _0x4be89f=![];var _0x59aa08=![];return Promise[_0x88b3('0x4')]()[_0x88b3('0x6')](function(){if(_0x58f0d3[_0x88b3('0x7')]){return sqlUtils[_0x88b3('0x8')](_0x58f0d3[_0x88b3('0x7')],_0x5dbca6);}else{return sqlUtils[_0x88b3('0x9')](_0x58f0d3,_0x5dbca6);}})[_0x88b3('0x6')](function(_0xb7f5f4){_0x9d82d[_0x88b3('0xa')](_0xb7f5f4[_0x88b3('0xb')]);_0x9d82d[_0x88b3('0xa')](_0xb7f5f4['fields']);_0x9d82d['where'](_0xb7f5f4[_0x88b3('0xc')]);_0x9d82d[_0x88b3('0xa')](_0xb7f5f4[_0x88b3('0xd')][_0x88b3('0xe')]);_0xbb9ac8=_0xb7f5f4['tags'];_0x59aa08=_0xb7f5f4['user']['skip'];return sqlUtils[_0x88b3('0xf')](_0x12b67b,_0x58f0d3,_0x59aa08);})[_0x88b3('0x6')](function(_0x179268){_0x9d82d[_0x88b3('0xa')](_0x179268);var _0x1e15d8=_0x58f0d3['search']?_0xbb9ac8['ids']:_0x58f0d3[_0x88b3('0x10')];_0x4be89f=_0x1e15d8?!![]:![];return sqlUtils['countFilteredContacts'](_0x9d82d,_0x1e15d8);})[_0x88b3('0x6')](function(_0x303e8a){_0xa1f98e[_0x88b3('0x11')]=_0x303e8a;if(_0xa1f98e[_0x88b3('0x11')]===0x0){return;}if(_0x58f0d3['User']){_0x59aa08=!![];}return sqlUtils[_0x88b3('0x12')](_0x9d82d,_0x58f0d3[_0x88b3('0x13')],_0xacdd9b,_0x4be89f,_0xbb9ac8['clause'],_0x59aa08);})[_0x88b3('0x6')](function(_0x26530a){if(!_0x26530a){return[];}return sqlUtils[_0x88b3('0x14')](_0x26530a,_0x58f0d3,_0xacdd9b);})[_0x88b3('0x6')](function(_0x3519c9){_0xa1f98e[_0x88b3('0x15')]=_0x3519c9;return _0xa1f98e;})[_0x88b3('0x16')](function(_0xe5920d){throw _0xe5920d;});};exports['describe']=function(){var _0x1ae080={};var _0x39c875=[];return db['CmContact'][_0x88b3('0x17')]()['then'](function(_0x1b12ee){_0x1ae080=_0x1b12ee;var _0x4733bc=Object[_0x88b3('0x18')](_0x1ae080)[_0x88b3('0xc')](function(_0xd1f6f0){return _[_0x88b3('0x19')](_0xd1f6f0,_0x88b3('0x1a'))?_0xd1f6f0:undefined;});var _0xe52122=_0x4733bc['map'](function(_0x1dc2ba){return db[_0x88b3('0x1b')][_0x88b3('0x1c')]({'where':{'id':_0x1dc2ba['slice'](0x3)},'raw':!![]});});return Promise['all'](_0xe52122);})[_0x88b3('0x6')](function(_0x2278c0){for(var _0x42a110=0x0;_0x42a110<_0x2278c0[_0x88b3('0x1d')];_0x42a110++){if(_0x2278c0[_0x42a110]){var _0x122a35=_0x88b3('0x1a')+_0x2278c0[_0x42a110]['id'];_0x1ae080[_0x122a35][_0x88b3('0x1e')]=_0x2278c0[_0x42a110][_0x88b3('0x1f')];}}_0x39c875=_['map'](Object['keys'](_0x1ae080),function(_0x24c191){return{'name':_0x24c191,'type':_0x1ae080[_0x24c191][_0x88b3('0x1f')]};});return _0x39c875;})[_0x88b3('0x16')](function(_0x4b20ef){throw _0x4b20ef;});}; \ No newline at end of file +var _0x60e3=['search','tag','countFilteredContacts','count','User','buildContactsQuery','clause','getFilteredContacts','rows','catch','describe','CmContact','keys','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','resolve','then','parseAdvancedSearchFilter','where','default','fields','filter','user','tags','checkListsRestrictions'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x60e3,0x1ad));var _0x360e=function(_0xed90b5,_0x43f4e4){_0xed90b5=_0xed90b5-0x0;var _0x3a2ef0=_0x60e3[_0xed90b5];return _0x3a2ef0;};'use strict';var _=require('lodash');var sqlUtils=require(_0x360e('0x0'));var db=require(_0x360e('0x1'))['db'];exports[_0x360e('0x2')]=function(_0x2d7813,_0x269968,_0x490c0c,_0x176262){var _0x16f2df={'count':0x0,'rows':[]};var _0x2b6f57=sqlUtils[_0x360e('0x3')](_0x269968,_0x2d7813);if(_0x2b6f57){return Promise['resolve'](_0x16f2df);}var _0x3238fd=sqlUtils[_0x360e('0x4')]();var _0x1bfb0c={};var _0x2415ad=![];var _0x5b5b76=![];return Promise[_0x360e('0x5')]()[_0x360e('0x6')](function(){if(_0x2d7813['search']){return sqlUtils[_0x360e('0x7')](_0x2d7813['search'],_0x176262);}else{return sqlUtils['parseQueryParameters'](_0x2d7813,_0x176262);}})[_0x360e('0x6')](function(_0x4c8ef3){_0x3238fd[_0x360e('0x8')](_0x4c8ef3[_0x360e('0x9')]);_0x3238fd['where'](_0x4c8ef3[_0x360e('0xa')]);_0x3238fd['where'](_0x4c8ef3[_0x360e('0xb')]);_0x3238fd[_0x360e('0x8')](_0x4c8ef3[_0x360e('0xc')]['clause']);_0x1bfb0c=_0x4c8ef3[_0x360e('0xd')];_0x5b5b76=_0x4c8ef3[_0x360e('0xc')]['skip'];return sqlUtils[_0x360e('0xe')](_0x269968,_0x2d7813,_0x5b5b76);})['then'](function(_0x382b50){_0x3238fd['where'](_0x382b50);var _0x439723=_0x2d7813[_0x360e('0xf')]?_0x1bfb0c['ids']:_0x2d7813[_0x360e('0x10')];_0x2415ad=_0x439723?!![]:![];return sqlUtils[_0x360e('0x11')](_0x3238fd,_0x439723);})[_0x360e('0x6')](function(_0x44c4fa){_0x16f2df[_0x360e('0x12')]=_0x44c4fa;if(_0x16f2df[_0x360e('0x12')]===0x0){return;}if(_0x2d7813[_0x360e('0x13')]){_0x5b5b76=!![];}return sqlUtils[_0x360e('0x14')](_0x3238fd,_0x2d7813[_0x360e('0xa')],_0x490c0c,_0x2415ad,_0x1bfb0c[_0x360e('0x15')],_0x5b5b76);})[_0x360e('0x6')](function(_0x428e54){if(!_0x428e54){return[];}return sqlUtils[_0x360e('0x16')](_0x428e54,_0x2d7813,_0x490c0c);})[_0x360e('0x6')](function(_0x2cfa6b){_0x16f2df[_0x360e('0x17')]=_0x2cfa6b;return _0x16f2df;})[_0x360e('0x18')](function(_0x3a27ff){throw _0x3a27ff;});};exports[_0x360e('0x19')]=function(){var _0x2e14fe={};var _0x316728=[];return db[_0x360e('0x1a')][_0x360e('0x19')]()['then'](function(_0x2a03ff){_0x2e14fe=_0x2a03ff;var _0xededdb=Object[_0x360e('0x1b')](_0x2e14fe)[_0x360e('0xb')](function(_0x5d94fb){return _['startsWith'](_0x5d94fb,_0x360e('0x1c'))?_0x5d94fb:undefined;});var _0x4283e0=_0xededdb[_0x360e('0x1d')](function(_0x3ae346){return db[_0x360e('0x1e')][_0x360e('0x1f')]({'where':{'id':_0x3ae346[_0x360e('0x20')](0x3)},'raw':!![]});});return Promise[_0x360e('0x21')](_0x4283e0);})['then'](function(_0x3683bd){for(var _0x1737d=0x0;_0x1737d<_0x3683bd[_0x360e('0x22')];_0x1737d++){if(_0x3683bd[_0x1737d]){var _0xd5aaf2=_0x360e('0x1c')+_0x3683bd[_0x1737d]['id'];_0x2e14fe[_0xd5aaf2][_0x360e('0x23')]=_0x3683bd[_0x1737d][_0x360e('0x24')];}}_0x316728=_[_0x360e('0x1d')](Object[_0x360e('0x1b')](_0x2e14fe),function(_0x1ef8ec){return{'name':_0x1ef8ec,'type':_0x2e14fe[_0x1ef8ec][_0x360e('0x24')]};});return _0x316728;})[_0x360e('0x18')](function(_0x58faa4){throw _0x58faa4;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 11d637c..e27fc5a 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 _0xe768=['value','start','Tag','map','tags','and','ids','User','user','clause','uc.UserId\x20=\x20?','keys','name','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','c.ListId\x20IS\x20NULL','attributes','select','c.id','limit','offset','group','having','order','DESC','subqry.','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','Sequelize','exports','lodash','squel','../parsers/qs','../../mysqldb','role','agent','search','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','ListId','createdAt','updatedAt','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','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.fax\x20LIKE\x20?','isEmail','parseSearch','sqlOperator','conditions','find','fieldType','castTo','buildExpression','default','text'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xe768,0x164));var _0x8e76=function(_0x5ddc66,_0x1961b0){_0x5ddc66=_0x5ddc66-0x0;var _0x422030=_0xe768[_0x5ddc66];return _0x422030;};'use strict';var _=require(_0x8e76('0x0'));var squel=require(_0x8e76('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x8e76('0x2'));var utils=require('../interaction/utils');var db=require(_0x8e76('0x3'))['db'];function skipContactsQuery(_0x49dbe5,_0x5e335f){var _0x3991d2=![];if(_0x49dbe5[_0x8e76('0x4')]===_0x8e76('0x5')&&!_0x5e335f[_0x8e76('0x6')]&&!_0x5e335f['ListId']&&_0x5e335f[_0x8e76('0x7')]!==_0x8e76('0x8')){_0x3991d2=!![];}return _0x3991d2;}function getContactsSubquery(){return squel['select']()[_0x8e76('0x9')](_0x8e76('0xa'),'c')[_0x8e76('0xb')](_0x8e76('0xc'));}function applyJoinClauses(_0x24366c,_0x36e940){var _0x27a7f5=_0x36e940?'c':_0x8e76('0xd');_0x24366c[_0x8e76('0xe')](_0x8e76('0xf'),'uc',_0x8e76('0x10')+_0x27a7f5+_0x8e76('0x11'))[_0x8e76('0xe')](_0x8e76('0x12'),'ct','ct.CmContactId\x20=\x20'+_0x27a7f5+_0x8e76('0x11'))['left_join'](_0x8e76('0x13'),'t',_0x8e76('0x14'));return _0x24366c;}function addFieldsToQuery(_0x28f4f8,_0x2f7b41,_0x189447,_0x33f424,_0x88a99){var _0x2c1d49=_0x88a99?'c':_0x8e76('0xd');if(!_0x2f7b41){_0x2f7b41=['id',_0x8e76('0x15'),_0x8e76('0x16'),_0x8e76('0x17'),_0x8e76('0x18'),_0x8e76('0x19'),_0x8e76('0x1a'),_0x8e76('0x1b'),'CompanyId',_0x8e76('0x1c'),_0x8e76('0x1d'),_0x8e76('0x1e'),_0x8e76('0x1f')];}else if(!_0x2f7b41['includes']('id')){_0x2f7b41['push']('id');}var _0x512f4c=_0x189447&&_0x88a99||!_0x189447&&!_0x88a99;if(_0x33f424){_0x512f4c=_0x33f424&&_0x88a99||!_0x33f424&&!_0x88a99;}_0x2f7b41[_0x8e76('0x20')](function(_0x16b939){if(_0x16b939===_0x8e76('0x1f')){if(_0x512f4c){_0x28f4f8[_0x8e76('0x21')](_0x8e76('0x22'),_0x16b939);}else if(_0x189447||_0x33f424){_0x28f4f8[_0x8e76('0x21')](_0x2c1d49+'.'+_0x16b939);}}else{_0x28f4f8[_0x8e76('0x21')](_0x2c1d49+'.'+_0x16b939);}});return _0x28f4f8;}function getSqlClauses(){var _0x29eae6={'default':squel[_0x8e76('0x23')](),'fields':squel['expr'](),'filter':squel[_0x8e76('0x23')](),'tags':{'clause':squel[_0x8e76('0x23')](),'ids':null},'user':{'clause':squel[_0x8e76('0x23')](),'skip':![]}};return _0x29eae6;}function parseTagParameter(_0x1e22e9){var _0x2f025a=squel[_0x8e76('0x23')]();if(_0x1e22e9){var _0x14b90c=utils[_0x8e76('0x24')](_0x1e22e9);_0x14b90c[_0x8e76('0x20')](function(_0x226ef9){_0x2f025a['or'](_0x8e76('0x25'),'%,'+_0x226ef9+',%');});}return _0x2f025a;}function parseSearchFilter(_0x31e9d5){var _0x3d68a3=squel[_0x8e76('0x23')]();if(_0x31e9d5){var _0x590329=_0x31e9d5[_0x8e76('0x26')]('\x5c','\x5c\x5c')[_0x8e76('0x26')](/'/g,'\x27\x27');if(_0x590329[_0x8e76('0x27')]('\x20')[_0x8e76('0x28')]>0x1){_0x3d68a3['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8e76('0x29')](_0x590329,!![]),null);}else{if(qs[_0x8e76('0x2a')](_0x590329)){_0x3d68a3['or'](_0x8e76('0x2b'),_0x590329+'%');_0x3d68a3['or'](_0x8e76('0x2c'),_0x590329+'%');_0x3d68a3['or']('c.mobile\x20LIKE\x20?',_0x590329+'%');_0x3d68a3['or'](_0x8e76('0x2d'),_0x590329+'%');}else if(qs[_0x8e76('0x2e')](_0x590329)){_0x3d68a3['or']('c.email\x20LIKE\x20?',_0x590329+'%');}else{_0x3d68a3['or']('c.firstName\x20LIKE\x20?','%'+_0x590329+'%');_0x3d68a3['or']('c.lastName\x20LIKE\x20?','%'+_0x590329+'%');_0x3d68a3['or']('c.email\x20LIKE\x20?','%'+_0x590329+'%');}}}return _0x3d68a3;}function parseAdvancedSearchFilter(_0x5cec38,_0x4893be){var _0x587c8f=getSqlClauses();var _0xe79bce=as[_0x8e76('0x2f')](_0x5cec38);var _0x1a8225=_0xe79bce[_0x8e76('0x30')];for(var _0x41fd60=0x0;_0x41fd60<_0xe79bce[_0x8e76('0x31')][_0x8e76('0x28')];_0x41fd60++){var _0x151521=_0xe79bce['conditions'][_0x41fd60];var _0x253c28='c';var _0x1b5320=_[_0x8e76('0x32')](_0x4893be,['name',_0x151521[_0x8e76('0x21')]]);if(_0x1b5320){if(_0x151521[_0x8e76('0x21')]==='dateOfBirth'||_0x1b5320[_0x8e76('0x33')]==='datetime'){_0x151521[_0x8e76('0x34')]='DATE';}var _0x503b65=as[_0x8e76('0x35')](_0x253c28,_0x1b5320['type'],_0x151521);_0x587c8f[_0x8e76('0x36')][_0x1a8225](_0x503b65[_0x8e76('0x37')],_0x503b65[_0x8e76('0x38')][_0x8e76('0x39')],_0x503b65[_0x8e76('0x38')]['end']);}else{if(_0x151521[_0x8e76('0x21')]===_0x8e76('0x3a')){var _0x1a8e3a=_0x151521[_0x8e76('0x38')]['split'](',')[_0x8e76('0x3b')](function(_0x12cf70){return Number(_0x12cf70);});var _0x58bf70=parseTagParameter(_0x1a8e3a);_0x587c8f[_0x8e76('0x3c')]['clause'][_0x8e76('0x3d')](_0x58bf70);_0x587c8f[_0x8e76('0x3c')][_0x8e76('0x3e')]=_0x1a8e3a;}else if(_0x151521[_0x8e76('0x21')]===_0x8e76('0x3f')){_0x587c8f[_0x8e76('0x40')][_0x8e76('0x41')]['and'](_0x8e76('0x42'),_0x151521[_0x8e76('0x38')]);_0x587c8f[_0x8e76('0x40')]['skip']=!![];}}}return _0x587c8f;}function parseModelFields(_0x2a0a3a,_0x4aa1ee){var _0xf0bf6a=squel[_0x8e76('0x23')]();var _0x29c0a8=_(_0x2a0a3a)[_0x8e76('0x43')]()[_0x8e76('0x3b')](function(_0x2f1410){return _['some'](_0x4aa1ee,[_0x8e76('0x44'),_0x2f1410])?_0x2f1410:undefined;})['compact']()[_0x8e76('0x38')]();if(_0x2a0a3a[_0x8e76('0x45')]){_0x29c0a8['push'](_0x8e76('0x45'));}if(_0x2a0a3a[_0x8e76('0x3f')]){_0x29c0a8['push'](_0x8e76('0x3f'));}if(_0x29c0a8[_0x8e76('0x28')]>0x0){_0x29c0a8[_0x8e76('0x20')](function(_0x3cdd0a){if(_0x3cdd0a==='ListId'){_0xf0bf6a['and'](_0x8e76('0x46'),[][_0x8e76('0x47')](_0x2a0a3a[_0x3cdd0a]));}else if(_0x3cdd0a===_0x8e76('0x45')){var _0x3ac654='%'+_0x2a0a3a[_0x3cdd0a]+'%';_0xf0bf6a['and'](_0x8e76('0x48'),_0x3ac654);}else if(_0x3cdd0a===_0x8e76('0x3f')){_0xf0bf6a[_0x8e76('0x3d')](_0x8e76('0x42'),_0x2a0a3a[_0x3cdd0a]);}else{_0xf0bf6a[_0x8e76('0x3d')]('c.'+_0x3cdd0a+_0x8e76('0x49'),_0x2a0a3a[_0x3cdd0a]);}});}return _0xf0bf6a;}function parseQueryParameters(_0x3d1cfb,_0x56c5a5){var _0x40d0fa=getSqlClauses();return Promise[_0x8e76('0x4a')]()['then'](function(){return parseModelFields(_0x3d1cfb,_0x56c5a5);})[_0x8e76('0x4b')](function(_0x11d2c6){_0x40d0fa[_0x8e76('0x4c')][_0x8e76('0x3d')](_0x11d2c6);return parseTagParameter(_0x3d1cfb['tag']);})[_0x8e76('0x4b')](function(_0xdd063a){_0x40d0fa[_0x8e76('0x3c')]['clause'][_0x8e76('0x3d')](_0xdd063a);return parseSearchFilter(_0x3d1cfb[_0x8e76('0x4d')]);})['then'](function(_0x26dc0b){_0x40d0fa[_0x8e76('0x4d')]=_0x26dc0b;return _0x40d0fa;});}function checkListsRestrictions(_0x357d73,_0x501b29,_0x9645b6){var _0x4c0ec6=squel[_0x8e76('0x23')]();return Promise[_0x8e76('0x4a')]()[_0x8e76('0x4b')](function(){if(_0x501b29[_0x8e76('0x6')]&&_0x357d73[_0x8e76('0x4')]===_0x8e76('0x5')&&!_0x9645b6){return _0x357d73['getLists']({'attributes':['id'],'raw':!![]});}})[_0x8e76('0x4b')](function(_0xb4fe96){if(_0xb4fe96){if(_0xb4fe96[_0x8e76('0x28')]===0x0){_0x4c0ec6['and'](_0x8e76('0x4e'));}else{_0x4c0ec6[_0x8e76('0x3d')](_0x8e76('0x46'),_[_0x8e76('0x3b')](_0xb4fe96,'id'));}}})[_0x8e76('0x4b')](function(){return _0x4c0ec6;});}function buildContactsQuery(_0x4357f8,_0x41d39b,_0xc70f4e,_0x48bf08,_0x43fca0,_0x1419d3){if(_0x41d39b){_0x41d39b=_0xc70f4e[_0x8e76('0x4f')];}_0x4357f8=addFieldsToQuery(_0x4357f8,_0x41d39b,_0x48bf08,_0x1419d3,!![]);var _0x52e546=squel[_0x8e76('0x50')]();_0x52e546=addFieldsToQuery(_0x52e546,_0x41d39b,_0x48bf08,_0x1419d3,![]);if(_0x48bf08||_0x1419d3){_0x4357f8=applyJoinClauses(_0x4357f8,!![]);_0x4357f8['group'](_0x8e76('0x51'));if(_0xc70f4e[_0x8e76('0x52')]){_0x52e546[_0x8e76('0x52')](_0xc70f4e[_0x8e76('0x52')]);}if(_0xc70f4e['offset']){_0x52e546['offset'](_0xc70f4e[_0x8e76('0x53')]);}}else{_0x52e546=applyJoinClauses(_0x52e546,![]);_0x52e546[_0x8e76('0x54')]('subqry.id');if(_0xc70f4e[_0x8e76('0x52')]){_0x4357f8[_0x8e76('0x52')](_0xc70f4e[_0x8e76('0x52')]);}if(_0xc70f4e[_0x8e76('0x53')]){_0x4357f8[_0x8e76('0x53')](_0xc70f4e[_0x8e76('0x53')]);}}_0x52e546[_0x8e76('0x55')](_0x43fca0);if(_0xc70f4e['order']){_0xc70f4e[_0x8e76('0x56')][_0x8e76('0x20')](function(_0x5b1d77){_0x4357f8[_0x8e76('0x56')]('c.'+_0x5b1d77[0x0],_0x5b1d77[0x1]===_0x8e76('0x57')?![]:!![]);_0x52e546[_0x8e76('0x56')](_0x8e76('0x58')+_0x5b1d77[0x0],_0x5b1d77[0x1]===_0x8e76('0x57')?![]:!![]);});}_0x52e546[_0x8e76('0x9')](_0x4357f8,'subqry');return _0x52e546;}function getFilteredContacts(_0x17663b){var _0x5cc7a6=[];return db[_0x8e76('0x3a')]['findAll']({'attributes':['id','name',_0x8e76('0x59')],'raw':!![]})[_0x8e76('0x4b')](function(_0x3e05c6){_0x5cc7a6=_[_0x8e76('0x5a')](_0x3e05c6,'id');var _0x174f42={'type':db['Sequelize'][_0x8e76('0x5b')][_0x8e76('0x5c')],'model':db[_0x8e76('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x8e76('0x5e')][_0x8e76('0x5f')](_0x17663b[_0x8e76('0x60')](),_0x174f42);})[_0x8e76('0x4b')](function(_0x4db850){_0x4db850[_0x8e76('0x20')](function(_0x16e769){if(_0x16e769[_0x8e76('0x1f')]){_0x16e769[_0x8e76('0x61')]=[];_0x16e769[_0x8e76('0x1f')]['split'](',')['forEach'](function(_0x8073cc){_0x16e769[_0x8e76('0x61')]['push'](_0x5cc7a6[_0x8073cc]);});}delete _0x16e769[_0x8e76('0x1f')];});return _0x4db850;});}function countFilteredContacts(_0x3cac4e,_0x40c12f){var _0x1882fc=_0x3cac4e[_0x8e76('0x62')]();_0x1882fc[_0x8e76('0x21')](_0x8e76('0x63'));_0x1882fc=applyJoinClauses(_0x1882fc,!![]);_0x3cac4e[_0x8e76('0x54')](_0x8e76('0x51'));var _0x1b3736=utils['getSelectedTags'](_0x40c12f);if(!_[_0x8e76('0x64')](_0x1b3736)){_0x1882fc[_0x8e76('0xb')]('t.id\x20IN\x20?',_0x1b3736);}var _0x59fc09={'type':db[_0x8e76('0x65')]['QueryTypes'][_0x8e76('0x5c')],'raw':!![]};return db[_0x8e76('0x5e')][_0x8e76('0x5f')](_0x1882fc[_0x8e76('0x60')](),_0x59fc09)[_0x8e76('0x4b')](function(_0x2ccb8f){return _0x2ccb8f[0x0][_0x8e76('0x63')];});}module[_0x8e76('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x5d05=['../interaction/utils','agent','autocomplete','true','select','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','lastName','mobile','fax','ListId','CompanyId','updatedAt','deletedAt','TagIds','includes','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','value','start','end','Tag','map','tags','clause','ids','User','user','and','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','SELECT','sequelize','exports','lodash','../parsers/advancedSearch','../parsers/qs'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x5d05,0xd3));var _0x55d0=function(_0x3fc31d,_0x432bc9){_0x3fc31d=_0x3fc31d-0x0;var _0x31bb91=_0x5d05[_0x3fc31d];return _0x31bb91;};'use strict';var _=require(_0x55d0('0x0'));var squel=require('squel');var as=require(_0x55d0('0x1'));var qs=require(_0x55d0('0x2'));var utils=require(_0x55d0('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x388a95,_0x1d8634){var _0x18ba43=![];if(_0x388a95['role']===_0x55d0('0x4')&&!_0x1d8634['search']&&!_0x1d8634['ListId']&&_0x1d8634[_0x55d0('0x5')]!==_0x55d0('0x6')){_0x18ba43=!![];}return _0x18ba43;}function getContactsSubquery(){return squel[_0x55d0('0x7')]()['from']('cm_contacts','c')[_0x55d0('0x8')](_0x55d0('0x9'));}function applyJoinClauses(_0x1481b6,_0x2f23cf){var _0x437dcb=_0x2f23cf?'c':_0x55d0('0xa');_0x1481b6[_0x55d0('0xb')](_0x55d0('0xc'),'uc',_0x55d0('0xd')+_0x437dcb+_0x55d0('0xe'))['left_join']('cm_contact_has_tags','ct',_0x55d0('0xf')+_0x437dcb+_0x55d0('0xe'))[_0x55d0('0xb')](_0x55d0('0x10'),'t','t.id\x20=\x20ct.TagId');return _0x1481b6;}function addFieldsToQuery(_0x43c676,_0x1cd871,_0x54596f,_0x32ec5b,_0x30f1ee){var _0x15e062=_0x30f1ee?'c':_0x55d0('0xa');if(!_0x1cd871){_0x1cd871=['id','firstName',_0x55d0('0x11'),'phone',_0x55d0('0x12'),_0x55d0('0x13'),'email',_0x55d0('0x14'),_0x55d0('0x15'),'createdAt',_0x55d0('0x16'),_0x55d0('0x17'),_0x55d0('0x18')];}else if(!_0x1cd871[_0x55d0('0x19')]('id')){_0x1cd871['push']('id');}var _0x4f3570=_0x54596f&&_0x30f1ee||!_0x54596f&&!_0x30f1ee;if(_0x32ec5b){_0x4f3570=_0x32ec5b&&_0x30f1ee||!_0x32ec5b&&!_0x30f1ee;}_0x1cd871[_0x55d0('0x1a')](function(_0x1cf3af){if(_0x1cf3af===_0x55d0('0x18')){if(_0x4f3570){_0x43c676['field'](_0x55d0('0x1b'),_0x1cf3af);}else if(_0x54596f||_0x32ec5b){_0x43c676['field'](_0x15e062+'.'+_0x1cf3af);}}else{_0x43c676[_0x55d0('0x1c')](_0x15e062+'.'+_0x1cf3af);}});return _0x43c676;}function getSqlClauses(){var _0x4cfa08={'default':squel[_0x55d0('0x1d')](),'fields':squel[_0x55d0('0x1d')](),'filter':squel[_0x55d0('0x1d')](),'tags':{'clause':squel[_0x55d0('0x1d')](),'ids':null},'user':{'clause':squel[_0x55d0('0x1d')](),'skip':![]}};return _0x4cfa08;}function parseTagParameter(_0x157dda){var _0x3ea409=squel['expr']();if(_0x157dda){var _0x3e92de=utils[_0x55d0('0x1e')](_0x157dda);_0x3e92de['forEach'](function(_0xcc2cd2){_0x3ea409['or'](_0x55d0('0x1f'),'%,'+_0xcc2cd2+',%');});}return _0x3ea409;}function parseSearchFilter(_0x3b01c0){var _0x583260=squel[_0x55d0('0x1d')]();if(_0x3b01c0){var _0x8d0066=_0x3b01c0[_0x55d0('0x20')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x8d0066[_0x55d0('0x21')]('\x20')[_0x55d0('0x22')]>0x1){_0x583260['or'](_0x55d0('0x23'),qs['getFullTextValue'](_0x8d0066,!![]),null);}else{if(qs[_0x55d0('0x24')](_0x8d0066)){_0x583260['or'](_0x55d0('0x25'),_0x8d0066+'%');_0x583260['or'](_0x55d0('0x26'),_0x8d0066+'%');_0x583260['or'](_0x55d0('0x27'),_0x8d0066+'%');_0x583260['or']('c.fax\x20LIKE\x20?',_0x8d0066+'%');}else if(qs[_0x55d0('0x28')](_0x8d0066)){_0x583260['or'](_0x55d0('0x29'),_0x8d0066+'%');}else{_0x583260['or']('c.firstName\x20LIKE\x20?','%'+_0x8d0066+'%');_0x583260['or']('c.lastName\x20LIKE\x20?','%'+_0x8d0066+'%');_0x583260['or'](_0x55d0('0x29'),'%'+_0x8d0066+'%');}}}return _0x583260;}function parseAdvancedSearchFilter(_0x1b2ed0,_0x4c2bea){var _0x311305=getSqlClauses();var _0x53543e=as[_0x55d0('0x2a')](_0x1b2ed0);var _0x3ee0cc=_0x53543e[_0x55d0('0x2b')];for(var _0x16ab13=0x0;_0x16ab13<_0x53543e[_0x55d0('0x2c')][_0x55d0('0x22')];_0x16ab13++){var _0x332367=_0x53543e[_0x55d0('0x2c')][_0x16ab13];var _0x21fe86='c';var _0x24646a=_[_0x55d0('0x2d')](_0x4c2bea,[_0x55d0('0x2e'),_0x332367[_0x55d0('0x1c')]]);if(_0x24646a){if(_0x332367[_0x55d0('0x1c')]===_0x55d0('0x2f')||_0x24646a[_0x55d0('0x30')]===_0x55d0('0x31')){_0x332367[_0x55d0('0x32')]='DATE';}var _0x4e579f=as[_0x55d0('0x33')](_0x21fe86,_0x24646a[_0x55d0('0x34')],_0x332367);_0x311305[_0x55d0('0x35')][_0x3ee0cc](_0x4e579f['text'],_0x4e579f[_0x55d0('0x36')][_0x55d0('0x37')],_0x4e579f[_0x55d0('0x36')][_0x55d0('0x38')]);}else{if(_0x332367['field']===_0x55d0('0x39')){var _0x19aa51=_0x332367[_0x55d0('0x36')][_0x55d0('0x21')](',')[_0x55d0('0x3a')](function(_0x1664e0){return Number(_0x1664e0);});var _0x18af3d=parseTagParameter(_0x19aa51);_0x311305[_0x55d0('0x3b')][_0x55d0('0x3c')]['and'](_0x18af3d);_0x311305[_0x55d0('0x3b')][_0x55d0('0x3d')]=_0x19aa51;}else if(_0x332367['field']===_0x55d0('0x3e')){_0x311305[_0x55d0('0x3f')][_0x55d0('0x3c')][_0x55d0('0x40')]('uc.UserId\x20=\x20?',_0x332367[_0x55d0('0x36')]);_0x311305['user']['skip']=!![];}}}return _0x311305;}function parseModelFields(_0x336f35,_0xbc3efa){var _0x3f8299=squel[_0x55d0('0x1d')]();var _0x3d1893=_(_0x336f35)[_0x55d0('0x41')]()[_0x55d0('0x3a')](function(_0x144e6a){return _[_0x55d0('0x42')](_0xbc3efa,['name',_0x144e6a])?_0x144e6a:undefined;})[_0x55d0('0x43')]()[_0x55d0('0x36')]();if(_0x336f35[_0x55d0('0x44')]){_0x3d1893['push'](_0x55d0('0x44'));}if(_0x336f35[_0x55d0('0x3e')]){_0x3d1893['push'](_0x55d0('0x3e'));}if(_0x3d1893[_0x55d0('0x22')]>0x0){_0x3d1893[_0x55d0('0x1a')](function(_0x3ffc06){if(_0x3ffc06===_0x55d0('0x14')){_0x3f8299[_0x55d0('0x40')](_0x55d0('0x45'),[][_0x55d0('0x46')](_0x336f35[_0x3ffc06]));}else if(_0x3ffc06===_0x55d0('0x44')){var _0x380a59='%'+_0x336f35[_0x3ffc06]+'%';_0x3f8299[_0x55d0('0x40')](_0x55d0('0x47'),_0x380a59);}else if(_0x3ffc06===_0x55d0('0x3e')){_0x3f8299[_0x55d0('0x40')](_0x55d0('0x48'),_0x336f35[_0x3ffc06]);}else{_0x3f8299[_0x55d0('0x40')]('c.'+_0x3ffc06+_0x55d0('0x49'),_0x336f35[_0x3ffc06]);}});}return _0x3f8299;}function parseQueryParameters(_0x1c9ae9,_0x45da8a){var _0x24889f=getSqlClauses();return Promise[_0x55d0('0x4a')]()[_0x55d0('0x4b')](function(){return parseModelFields(_0x1c9ae9,_0x45da8a);})[_0x55d0('0x4b')](function(_0x28c50c){_0x24889f[_0x55d0('0x4c')][_0x55d0('0x40')](_0x28c50c);return parseTagParameter(_0x1c9ae9[_0x55d0('0x4d')]);})[_0x55d0('0x4b')](function(_0x2b0597){_0x24889f[_0x55d0('0x3b')]['clause']['and'](_0x2b0597);return parseSearchFilter(_0x1c9ae9[_0x55d0('0x4e')]);})[_0x55d0('0x4b')](function(_0x39427b){_0x24889f[_0x55d0('0x4e')]=_0x39427b;return _0x24889f;});}function checkListsRestrictions(_0x5aa4df,_0x105d38,_0x44a06c){var _0x3aab25=squel[_0x55d0('0x1d')]();return Promise['resolve']()[_0x55d0('0x4b')](function(){if(_0x105d38['search']&&_0x5aa4df['role']==='agent'&&!_0x44a06c){return _0x5aa4df[_0x55d0('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0x55d0('0x4b')](function(_0x308bac){if(_0x308bac){if(_0x308bac[_0x55d0('0x22')]===0x0){_0x3aab25[_0x55d0('0x40')](_0x55d0('0x50'));}else{_0x3aab25[_0x55d0('0x40')](_0x55d0('0x45'),_[_0x55d0('0x3a')](_0x308bac,'id'));}}})[_0x55d0('0x4b')](function(){return _0x3aab25;});}function buildContactsQuery(_0x41ee72,_0x5b9de2,_0x111c25,_0x48269d,_0x5ec98f,_0x58ea00){if(_0x5b9de2){_0x5b9de2=_0x111c25[_0x55d0('0x51')];}_0x41ee72=addFieldsToQuery(_0x41ee72,_0x5b9de2,_0x48269d,_0x58ea00,!![]);var _0x313f49=squel[_0x55d0('0x7')]();_0x313f49=addFieldsToQuery(_0x313f49,_0x5b9de2,_0x48269d,_0x58ea00,![]);if(_0x48269d||_0x58ea00){_0x41ee72=applyJoinClauses(_0x41ee72,!![]);_0x41ee72[_0x55d0('0x52')](_0x55d0('0x53'));if(_0x111c25[_0x55d0('0x54')]){_0x313f49[_0x55d0('0x54')](_0x111c25[_0x55d0('0x54')]);}if(_0x111c25[_0x55d0('0x55')]){_0x313f49[_0x55d0('0x55')](_0x111c25[_0x55d0('0x55')]);}}else{_0x313f49=applyJoinClauses(_0x313f49,![]);_0x313f49[_0x55d0('0x52')](_0x55d0('0x56'));if(_0x111c25[_0x55d0('0x54')]){_0x41ee72['limit'](_0x111c25[_0x55d0('0x54')]);}if(_0x111c25['offset']){_0x41ee72[_0x55d0('0x55')](_0x111c25[_0x55d0('0x55')]);}}_0x313f49[_0x55d0('0x57')](_0x5ec98f);if(_0x111c25[_0x55d0('0x58')]){_0x111c25[_0x55d0('0x58')][_0x55d0('0x1a')](function(_0x28a3e1){_0x41ee72['order']('c.'+_0x28a3e1[0x0],_0x28a3e1[0x1]===_0x55d0('0x59')?![]:!![]);_0x313f49[_0x55d0('0x58')](_0x55d0('0x5a')+_0x28a3e1[0x0],_0x28a3e1[0x1]==='DESC'?![]:!![]);});}_0x313f49[_0x55d0('0x5b')](_0x41ee72,'subqry');return _0x313f49;}function getFilteredContacts(_0x2cd7ef){var _0x3e3d79=[];return db['Tag'][_0x55d0('0x5c')]({'attributes':['id',_0x55d0('0x2e'),_0x55d0('0x5d')],'raw':!![]})[_0x55d0('0x4b')](function(_0x16917f){_0x3e3d79=_[_0x55d0('0x5e')](_0x16917f,'id');var _0x3b4e99={'type':db[_0x55d0('0x5f')]['QueryTypes']['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x55d0('0x60')](_0x2cd7ef[_0x55d0('0x61')](),_0x3b4e99);})['then'](function(_0x4a417b){_0x4a417b[_0x55d0('0x1a')](function(_0x26454e){if(_0x26454e['TagIds']){_0x26454e[_0x55d0('0x62')]=[];_0x26454e[_0x55d0('0x18')][_0x55d0('0x21')](',')['forEach'](function(_0x5b2e9c){_0x26454e[_0x55d0('0x62')]['push'](_0x3e3d79[_0x5b2e9c]);});}delete _0x26454e[_0x55d0('0x18')];});return _0x4a417b;});}function countFilteredContacts(_0x50b942,_0x281dde){var _0x263bad=_0x50b942[_0x55d0('0x63')]();_0x263bad[_0x55d0('0x1c')](_0x55d0('0x64'));_0x263bad=applyJoinClauses(_0x263bad,!![]);_0x50b942[_0x55d0('0x52')]('c.id');var _0x2d4b25=utils['getSelectedTags'](_0x281dde);if(!_[_0x55d0('0x65')](_0x2d4b25)){_0x263bad[_0x55d0('0x8')](_0x55d0('0x66'),_0x2d4b25);}var _0x2c5f95={'type':db[_0x55d0('0x5f')][_0x55d0('0x67')][_0x55d0('0x68')],'raw':!![]};return db[_0x55d0('0x69')][_0x55d0('0x60')](_0x263bad['toString'](),_0x2c5f95)[_0x55d0('0x4b')](function(_0x31b444){return _0x31b444[0x0][_0x55d0('0x64')];});}module[_0x55d0('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 956823a..511a8c3 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 _0xefa8=['unlink','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','final','write','end','close'];(function(_0x2b8bbe,_0x37eb6a){var _0x1bb210=function(_0x116173){while(--_0x116173){_0x2b8bbe['push'](_0x2b8bbe['shift']());}};_0x1bb210(++_0x37eb6a);}(_0xefa8,0x14b));var _0x8efa=function(_0xcbb92a,_0x56dcfc){_0xcbb92a=_0xcbb92a-0x0;var _0x37ae52=_0xefa8[_0xcbb92a];return _0x37ae52;};'use strict';var crypto=require(_0x8efa('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x8efa('0x1'));var config=require(_0x8efa('0x2'));var logger=require(_0x8efa('0x3'))(_0x8efa('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8efa('0x5')][_0x8efa('0x6')],'algorithm':_0x8efa('0x7')};const fileOptions={'algorithm':_0x8efa('0x8')};if(config[_0x8efa('0x9')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x8efa('0x9')]['algorithm']);if(isSupported){fileOptions[_0x8efa('0xa')]=config[_0x8efa('0x9')][_0x8efa('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8efa('0xb')](',\x20');logger[_0x8efa('0xc')](config[_0x8efa('0x9')][_0x8efa('0xa')],_0x8efa('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x53a796){return AES_SUPPORTED_RX[_0x8efa('0xe')](_0x53a796);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x8efa('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x33cbd8){return getSupportedCiphers()[_0x8efa('0x10')](_0x33cbd8)>-0x1;}function combineOptions(_0x48ac4b){var _0x3207f9={};for(var _0x332e1a in fileOptions){if(fileOptions[_0x8efa('0x11')](_0x332e1a)){_0x3207f9[_0x332e1a]=fileOptions[_0x332e1a];}}if(_0x48ac4b){for(var _0x37c423 in _0x48ac4b){if(_0x48ac4b[_0x8efa('0x11')](_0x37c423)){_0x3207f9[_0x37c423]=_0x48ac4b[_0x37c423];}}}return _0x3207f9;}exports[_0x8efa('0x12')]=function(_0x1fa669,_0x4cdca1,_0x1c1bc9,_0x570b13){return new BPromise(function(_0x147cb1,_0x2c1e66){_0x570b13=combineOptions(_0x570b13);var _0x4fda1c=new Buffer(_0x1c1bc9);var _0x528c05=fs[_0x8efa('0x13')](_0x1fa669);var _0xfce50c=fs[_0x8efa('0x14')](_0x4cdca1);var _0x4d48c6=crypto[_0x8efa('0x15')](_0x570b13[_0x8efa('0xa')],_0x4fda1c);_0x528c05['on'](_0x8efa('0x16'),function(_0x3fcf02){var _0x217de4=new Buffer(_0x4d48c6[_0x8efa('0x17')](_0x3fcf02),_0x8efa('0x18'));_0xfce50c['write'](_0x217de4);});_0x528c05['on']('end',function(){try{var _0x451736=new Buffer(_0x4d48c6[_0x8efa('0x19')]('binary'),_0x8efa('0x18'));_0xfce50c[_0x8efa('0x1a')](_0x451736);_0xfce50c[_0x8efa('0x1b')]();_0xfce50c['on'](_0x8efa('0x1c'),function(){return _0x147cb1(_0x4cdca1);});}catch(_0x3f3873){fs[_0x8efa('0x1d')](_0x4cdca1);return _0x2c1e66(_0x3f3873);}});});};exports['decryptFile']=function(_0x5d9be5,_0x29e554,_0x13a601,_0xa85fd9){return new BPromise(function(_0x5cded6,_0x1382d4){_0xa85fd9=combineOptions(_0xa85fd9);var _0x55cc29=new Buffer(_0x13a601);var _0x53506d=fs[_0x8efa('0x13')](_0x5d9be5);var _0x31d0be=fs[_0x8efa('0x14')](_0x29e554);var _0x443505=crypto[_0x8efa('0x1e')](_0xa85fd9[_0x8efa('0xa')],_0x55cc29);_0x53506d['on'](_0x8efa('0x16'),function(_0x52dd59){var _0x770d2f=new Buffer(_0x443505[_0x8efa('0x17')](_0x52dd59),'binary');_0x31d0be['write'](_0x770d2f);});_0x53506d['on'](_0x8efa('0x1b'),function(){try{var _0x348c9f=new Buffer(_0x443505['final']('binary'),'binary');_0x31d0be[_0x8efa('0x1a')](_0x348c9f);_0x31d0be[_0x8efa('0x1b')]();_0x31d0be['on']('close',function(){return _0x5cded6(_0x29e554);});}catch(_0x3bb18c){fs[_0x8efa('0x1d')](_0x29e554);return _0x1382d4(_0x3bb18c);}});});};exports[_0x8efa('0x1f')]=function(_0x303aa7,_0x39adcf,_0x9a019){var _0x99866e=_0x9a019||stringOptions[_0x8efa('0xa')];var _0x56471e=_0x39adcf||stringOptions[_0x8efa('0x20')];var _0x34ece5=crypto[_0x8efa('0x15')](_0x99866e,_0x56471e);var _0x1b8671=_0x34ece5[_0x8efa('0x17')](_0x303aa7,_0x8efa('0x21'),'base64');_0x1b8671+=_0x34ece5[_0x8efa('0x19')](_0x8efa('0x22'));return _0x1b8671;};exports[_0x8efa('0x23')]=function(_0x5da35c,_0x16e138,_0x3a37ec){var _0x49924d=_0x3a37ec||stringOptions[_0x8efa('0xa')];var _0x53c1f6=_0x16e138||stringOptions['secret'];var _0x229b7b=crypto[_0x8efa('0x1e')](_0x49924d,_0x53c1f6);var _0x52a232=_0x229b7b[_0x8efa('0x17')](_0x5da35c,'base64',_0x8efa('0x21'));_0x52a232+=_0x229b7b['final']('utf8');return _0x52a232;}; \ No newline at end of file +var _0x1384=['encryptFile','createWriteStream','createCipher','data','update','binary','write','end','unlink','decryptFile','final','close','encryptString','secret','base64','decryptString','createDecipher','crypto','lodash','../../config/environment','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1384,0x1df));var _0x4138=function(_0x8a1b95,_0x713451){_0x8a1b95=_0x8a1b95-0x0;var _0x3ec530=_0x1384[_0x8a1b95];return _0x3ec530;};'use strict';var crypto=require(_0x4138('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x4138('0x1'));var config=require(_0x4138('0x2'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4138('0x3')][_0x4138('0x4')],'algorithm':_0x4138('0x5')};const fileOptions={'algorithm':_0x4138('0x6')};if(config[_0x4138('0x7')]&&config['encrypt'][_0x4138('0x8')]){var isSupported=isAlgorithmSupported(config[_0x4138('0x7')][_0x4138('0x8')]);if(isSupported){fileOptions[_0x4138('0x8')]=config[_0x4138('0x7')][_0x4138('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4138('0x9')](',\x20');logger['error'](config[_0x4138('0x7')][_0x4138('0x8')],_0x4138('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x142a7e){return AES_SUPPORTED_RX[_0x4138('0xb')](_0x142a7e);}function getSupportedCiphers(){return crypto[_0x4138('0xc')]()[_0x4138('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4a7e51){return getSupportedCiphers()[_0x4138('0xe')](_0x4a7e51)>-0x1;}function combineOptions(_0x54fe92){var _0x533856={};for(var _0x47abdf in fileOptions){if(fileOptions[_0x4138('0xf')](_0x47abdf)){_0x533856[_0x47abdf]=fileOptions[_0x47abdf];}}if(_0x54fe92){for(var _0x13f8b7 in _0x54fe92){if(_0x54fe92[_0x4138('0xf')](_0x13f8b7)){_0x533856[_0x13f8b7]=_0x54fe92[_0x13f8b7];}}}return _0x533856;}exports[_0x4138('0x10')]=function(_0xc9d229,_0x59e088,_0x811c69,_0x240459){return new BPromise(function(_0x24bae6,_0x42892d){_0x240459=combineOptions(_0x240459);var _0x3783cf=new Buffer(_0x811c69);var _0x5994f6=fs['createReadStream'](_0xc9d229);var _0x25a4ac=fs[_0x4138('0x11')](_0x59e088);var _0x209c2b=crypto[_0x4138('0x12')](_0x240459['algorithm'],_0x3783cf);_0x5994f6['on'](_0x4138('0x13'),function(_0x47d6c4){var _0x383a94=new Buffer(_0x209c2b[_0x4138('0x14')](_0x47d6c4),_0x4138('0x15'));_0x25a4ac[_0x4138('0x16')](_0x383a94);});_0x5994f6['on'](_0x4138('0x17'),function(){try{var _0x1961e7=new Buffer(_0x209c2b['final']('binary'),_0x4138('0x15'));_0x25a4ac[_0x4138('0x16')](_0x1961e7);_0x25a4ac[_0x4138('0x17')]();_0x25a4ac['on']('close',function(){return _0x24bae6(_0x59e088);});}catch(_0x51ca4a){fs[_0x4138('0x18')](_0x59e088);return _0x42892d(_0x51ca4a);}});});};exports[_0x4138('0x19')]=function(_0x25d3eb,_0x4a2da9,_0x1d6608,_0x2882cf){return new BPromise(function(_0x134232,_0x5da8da){_0x2882cf=combineOptions(_0x2882cf);var _0x3ecc93=new Buffer(_0x1d6608);var _0x19d756=fs['createReadStream'](_0x25d3eb);var _0xad64d1=fs['createWriteStream'](_0x4a2da9);var _0x1bbdb3=crypto['createDecipher'](_0x2882cf[_0x4138('0x8')],_0x3ecc93);_0x19d756['on'](_0x4138('0x13'),function(_0x4878a9){var _0x40e932=new Buffer(_0x1bbdb3[_0x4138('0x14')](_0x4878a9),_0x4138('0x15'));_0xad64d1['write'](_0x40e932);});_0x19d756['on'](_0x4138('0x17'),function(){try{var _0x5db07c=new Buffer(_0x1bbdb3[_0x4138('0x1a')](_0x4138('0x15')),'binary');_0xad64d1[_0x4138('0x16')](_0x5db07c);_0xad64d1[_0x4138('0x17')]();_0xad64d1['on'](_0x4138('0x1b'),function(){return _0x134232(_0x4a2da9);});}catch(_0x4084e3){fs[_0x4138('0x18')](_0x4a2da9);return _0x5da8da(_0x4084e3);}});});};exports[_0x4138('0x1c')]=function(_0x421db7,_0x171128,_0x50a29f){var _0x4ca4e7=_0x50a29f||stringOptions[_0x4138('0x8')];var _0x15f9ee=_0x171128||stringOptions[_0x4138('0x1d')];var _0x1da0be=crypto[_0x4138('0x12')](_0x4ca4e7,_0x15f9ee);var _0x4e1d88=_0x1da0be[_0x4138('0x14')](_0x421db7,'utf8',_0x4138('0x1e'));_0x4e1d88+=_0x1da0be[_0x4138('0x1a')](_0x4138('0x1e'));return _0x4e1d88;};exports[_0x4138('0x1f')]=function(_0x3beb5f,_0x338e8e,_0x211a29){var _0x385350=_0x211a29||stringOptions[_0x4138('0x8')];var _0x35918e=_0x338e8e||stringOptions[_0x4138('0x1d')];var _0x220a61=crypto[_0x4138('0x20')](_0x385350,_0x35918e);var _0x55a75a=_0x220a61[_0x4138('0x14')](_0x3beb5f,'base64','utf8');_0x55a75a+=_0x220a61[_0x4138('0x1a')]('utf8');return _0x55a75a;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 9ca9e14..88ef0a2 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 _0xa526=['update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','sequelize','QueryTypes','num','Empty','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','query','basename','.csv','length','existsSync','join','%s%d.%s','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport'];(function(_0x4c43c1,_0x240778){var _0x5e344c=function(_0x439289){while(--_0x439289){_0x4c43c1['push'](_0x4c43c1['shift']());}};_0x5e344c(++_0x240778);}(_0xa526,0x165));var _0x6a52=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xa526[_0x82129b];return _0x2ae5dc;};'use strict';var util=require(_0x6a52('0x0'));var path=require(_0x6a52('0x1'));var _=require(_0x6a52('0x2'));var csv=require(_0x6a52('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x6a52('0x4'));var rimraf=require(_0x6a52('0x5'));var db=require(_0x6a52('0x6'))['db'];var dbH=require(_0x6a52('0x6'))[_0x6a52('0x7')];var logger=require(_0x6a52('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6a52('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xbfa0ea,_0x3631b8){var _0x1191d5={'status':_0xbfa0ea};var _0x9c3f9e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3631b8){_0x1191d5['savename']=_0x3631b8;}return db[_0x6a52('0xa')][_0x6a52('0xb')](_0x1191d5,_0x9c3f9e);}function main(){var _0x1ff1f8=0x1388;var _0xe30a67;logger[_0x6a52('0xc')](util[_0x6a52('0xd')](_0x6a52('0xe'),EXTRACTED_REPORT_ID,_0x6a52('0xf')));return db[_0x6a52('0x10')][_0x6a52('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6a52('0x12'),'splitSizeCsv']})[_0x6a52('0x13')](function(_0x5a461d){if(_0x5a461d){_0xe30a67=_0x5a461d;_0x1ff1f8=_0xe30a67['splitSizeCsv']||0x1388;}})[_0x6a52('0x13')](function(){return dbH[_0x6a52('0x14')]['query'](util[_0x6a52('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x6a52('0x15')]['SELECT']});})[_0x6a52('0x13')](function(_0x9fae0b){if(!_0x9fae0b[0x0][_0x6a52('0x16')]){return analyticExtractedReport(_0x6a52('0x17'));}var _0x39d658=[];var _0x7f233f=0x0;if(_0xe30a67[_0x6a52('0x12')]){if(_0x9fae0b&&_0x9fae0b['length']){var _0x4503b7=_[_0x6a52('0x18')](_0x9fae0b[0x0][_0x6a52('0x16')]/_0x1ff1f8);var _0x8e0041=Number[_0x6a52('0x19')](_0x9fae0b[0x0][_0x6a52('0x16')]/_0x1ff1f8)?_0x9fae0b[0x0][_0x6a52('0x16')]%_0x1ff1f8:0x0;_0x4503b7['forEach'](function(_0x4d9c20){if(_0x4d9c20>0x0){_0x7f233f+=_0x1ff1f8;}_0x39d658[_0x6a52('0x1a')](dbH[_0x6a52('0x14')]['query'](util[_0x6a52('0xd')](_0x6a52('0x1b'),QUERY,_0x1ff1f8,_0x7f233f),{'type':dbH[_0x6a52('0x14')][_0x6a52('0x15')][_0x6a52('0x1c')]}));});if(_0x8e0041>0x0){_0x7f233f+=_0x1ff1f8;_0x39d658['push'](dbH[_0x6a52('0x14')][_0x6a52('0x1d')](util[_0x6a52('0xd')](_0x6a52('0x1b'),QUERY,_0x8e0041,_0x7f233f),{'type':dbH[_0x6a52('0x14')]['QueryTypes'][_0x6a52('0x1c')]}));}}}else{_0x39d658[_0x6a52('0x1a')](dbH[_0x6a52('0x14')][_0x6a52('0x1d')](QUERY,{'type':dbH[_0x6a52('0x14')]['QueryTypes']['SELECT']}));}var _0x43905a=path['dirname'](PATH);var _0x562ed2=path[_0x6a52('0x1e')](PATH,_0x6a52('0x1f'));var _0x5e5fe6=_0xe30a67[_0x6a52('0x12')]&&_0x39d658[_0x6a52('0x20')]>0x1;var _0x4dc470=[];if(!fs[_0x6a52('0x21')](path[_0x6a52('0x22')](_0x43905a,_0x562ed2))&&_0x5e5fe6){fs['mkdirSync'](path[_0x6a52('0x22')](_0x43905a,_0x562ed2));}return BPromise['each'](_0x39d658,function(_0x18d338){_0x4dc470[_0x6a52('0x1a')](_0x18d338);})['then'](function(){for(var _0x2a675f=0x0;_0x2a675f<_0x4dc470[_0x6a52('0x20')];_0x2a675f+=0x1){var _0x563863;var _0x117b25=_0x4dc470[_0x2a675f];if(_0x5e5fe6){_0x563863=path[_0x6a52('0x22')](_0x43905a,_0x562ed2,util['format'](_0x6a52('0x23'),_0x562ed2,_0x2a675f,'csv'));}else{_0x563863=path[_0x6a52('0x22')](_0x43905a,util[_0x6a52('0xd')](_0x6a52('0x24'),_0x562ed2,'csv'));}fs[_0x6a52('0x25')](_0x563863,csv(_0x117b25));}})['then'](function(){if(_0x5e5fe6){return new Promise(function(_0x3220f8){zipdir(path[_0x6a52('0x22')](_0x43905a,_0x562ed2),{'saveTo':path[_0x6a52('0x22')](_0x43905a,util[_0x6a52('0xd')](_0x6a52('0x24'),_0x562ed2,'zip'))},function(_0x258528,_0x2303a5){rimraf(path[_0x6a52('0x22')](_0x43905a,_0x562ed2),function(){});_0x3220f8(_0x6a52('0x26'));});});}})[_0x6a52('0x13')](function(){logger[_0x6a52('0xc')](util[_0x6a52('0xd')](_0x6a52('0x27'),EXTRACTED_REPORT_ID,_0x6a52('0xf')));return analyticExtractedReport(_0x6a52('0x28'),_0x5e5fe6?util[_0x6a52('0xd')](_0x6a52('0x24'),_0x562ed2,_0x5e5fe6?'zip':'csv'):null);});})[_0x6a52('0x29')](function(_0x4d3f70){logger['info'](util['format'](_0x6a52('0x2a'),EXTRACTED_REPORT_ID,_0x6a52('0xf')),util['inspect'](_0x4d3f70,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6a52('0x2b'));})[_0x6a52('0x2c')](function(){process[_0x6a52('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4f1c=['sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','to-csv','zip-dir','rimraf','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then'];(function(_0x52dbe6,_0x29f5c8){var _0x3d7c62=function(_0x262298){while(--_0x262298){_0x52dbe6['push'](_0x52dbe6['shift']());}};_0x3d7c62(++_0x29f5c8);}(_0x4f1c,0xe3));var _0xc4f1=function(_0x4cc136,_0x186d2f){_0x4cc136=_0x4cc136-0x0;var _0x1488a6=_0x4f1c[_0x4cc136];return _0x1488a6;};'use strict';var util=require(_0xc4f1('0x0'));var path=require(_0xc4f1('0x1'));var _=require('lodash');var csv=require(_0xc4f1('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xc4f1('0x3'));var rimraf=require(_0xc4f1('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xc4f1('0x5'))(_0xc4f1('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xc4f1('0x7')][0x2]);var QUERY=process[_0xc4f1('0x7')][0x3];var PATH=process[_0xc4f1('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x39cadf,_0xf8bcad){var _0x435b98={'status':_0x39cadf};var _0x219453={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xf8bcad){_0x435b98[_0xc4f1('0x8')]=_0xf8bcad;}return db[_0xc4f1('0x9')][_0xc4f1('0xa')](_0x435b98,_0x219453);}function main(){var _0x541cbf=0x1388;var _0x29968c;logger['info'](util[_0xc4f1('0xb')](_0xc4f1('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xc4f1('0xd')][_0xc4f1('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc4f1('0xf'),_0xc4f1('0x10')]})[_0xc4f1('0x11')](function(_0x5c04f5){if(_0x5c04f5){_0x29968c=_0x5c04f5;_0x541cbf=_0x29968c[_0xc4f1('0x10')]||0x1388;}})[_0xc4f1('0x11')](function(){return dbH[_0xc4f1('0x12')][_0xc4f1('0x13')](util[_0xc4f1('0xb')](_0xc4f1('0x14'),QUERY),{'type':dbH[_0xc4f1('0x12')][_0xc4f1('0x15')][_0xc4f1('0x16')]});})[_0xc4f1('0x11')](function(_0x2c8d10){if(!_0x2c8d10[0x0][_0xc4f1('0x17')]){return analyticExtractedReport(_0xc4f1('0x18'));}var _0x127b03=[];var _0x147009=0x0;if(_0x29968c[_0xc4f1('0xf')]){if(_0x2c8d10&&_0x2c8d10[_0xc4f1('0x19')]){var _0x27b86f=_[_0xc4f1('0x1a')](_0x2c8d10[0x0][_0xc4f1('0x17')]/_0x541cbf);var _0x55ceea=Number[_0xc4f1('0x1b')](_0x2c8d10[0x0][_0xc4f1('0x17')]/_0x541cbf)?_0x2c8d10[0x0]['num']%_0x541cbf:0x0;_0x27b86f['forEach'](function(_0x275847){if(_0x275847>0x0){_0x147009+=_0x541cbf;}_0x127b03[_0xc4f1('0x1c')](dbH[_0xc4f1('0x12')][_0xc4f1('0x13')](util[_0xc4f1('0xb')](_0xc4f1('0x1d'),QUERY,_0x541cbf,_0x147009),{'type':dbH[_0xc4f1('0x12')][_0xc4f1('0x15')][_0xc4f1('0x16')]}));});if(_0x55ceea>0x0){_0x147009+=_0x541cbf;_0x127b03[_0xc4f1('0x1c')](dbH[_0xc4f1('0x12')][_0xc4f1('0x13')](util[_0xc4f1('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x55ceea,_0x147009),{'type':dbH[_0xc4f1('0x12')][_0xc4f1('0x15')][_0xc4f1('0x16')]}));}}}else{_0x127b03[_0xc4f1('0x1c')](dbH['sequelize'][_0xc4f1('0x13')](QUERY,{'type':dbH[_0xc4f1('0x12')][_0xc4f1('0x15')][_0xc4f1('0x16')]}));}var _0x1e6e0=path[_0xc4f1('0x1e')](PATH);var _0x4e34d5=path[_0xc4f1('0x1f')](PATH,_0xc4f1('0x20'));var _0x514ab9=_0x29968c['split']&&_0x127b03['length']>0x1;var _0x46b46f=[];if(!fs[_0xc4f1('0x21')](path[_0xc4f1('0x22')](_0x1e6e0,_0x4e34d5))&&_0x514ab9){fs['mkdirSync'](path['join'](_0x1e6e0,_0x4e34d5));}return BPromise[_0xc4f1('0x23')](_0x127b03,function(_0x26eb4b){_0x46b46f[_0xc4f1('0x1c')](_0x26eb4b);})[_0xc4f1('0x11')](function(){for(var _0x1a9282=0x0;_0x1a9282<_0x46b46f[_0xc4f1('0x19')];_0x1a9282+=0x1){var _0x1169e4;var _0x3bac8a=_0x46b46f[_0x1a9282];if(_0x514ab9){_0x1169e4=path[_0xc4f1('0x22')](_0x1e6e0,_0x4e34d5,util[_0xc4f1('0xb')](_0xc4f1('0x24'),_0x4e34d5,_0x1a9282,_0xc4f1('0x25')));}else{_0x1169e4=path[_0xc4f1('0x22')](_0x1e6e0,util[_0xc4f1('0xb')](_0xc4f1('0x26'),_0x4e34d5,_0xc4f1('0x25')));}fs[_0xc4f1('0x27')](_0x1169e4,csv(_0x3bac8a));}})[_0xc4f1('0x11')](function(){if(_0x514ab9){return new Promise(function(_0x140cb7){zipdir(path[_0xc4f1('0x22')](_0x1e6e0,_0x4e34d5),{'saveTo':path[_0xc4f1('0x22')](_0x1e6e0,util[_0xc4f1('0xb')](_0xc4f1('0x26'),_0x4e34d5,_0xc4f1('0x28')))},function(_0x204e2d,_0x36715d){rimraf(path['join'](_0x1e6e0,_0x4e34d5),function(){});_0x140cb7('zip\x20finished');});});}})[_0xc4f1('0x11')](function(){logger[_0xc4f1('0x29')](util[_0xc4f1('0xb')](_0xc4f1('0x2a'),EXTRACTED_REPORT_ID,_0xc4f1('0x2b')));return analyticExtractedReport('Completed',_0x514ab9?util[_0xc4f1('0xb')](_0xc4f1('0x26'),_0x4e34d5,_0x514ab9?_0xc4f1('0x28'):'csv'):null);});})[_0xc4f1('0x2c')](function(_0x14b4bd){logger[_0xc4f1('0x29')](util[_0xc4f1('0xb')](_0xc4f1('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x14b4bd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc4f1('0x2e'));})[_0xc4f1('0x2f')](function(){process[_0xc4f1('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 08ecfb6..a1cb96b 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 _0xcbaa=['map','value','fill','length','auto','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','before','margin','footer','right','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','sequelize','query','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','existsSync','join','mkdirSync','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','toString','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','util','moment','pdfmake/src/printer','JSDOM','window','bluebird','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x32ee3b,_0x13bae3){var _0x275c0c=function(_0x13d14e){while(--_0x13d14e){_0x32ee3b['push'](_0x32ee3b['shift']());}};_0x275c0c(++_0x13bae3);}(_0xcbaa,0x1e4));var _0xacba=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xcbaa[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xacba('0x0'));var fs=require('fs');var util=require(_0xacba('0x1'));var path=require('path');var moment=require(_0xacba('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xacba('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0xacba('0x4')];var window=new JSDOM('')[_0xacba('0x5')];var BPromise=require(_0xacba('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xacba('0x7')];var logger=require(_0xacba('0x8'))(_0xacba('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xacba('0xa')][0x2]);var QUERY=process[_0xacba('0xa')][0x3];var PATH=process[_0xacba('0xa')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xacba('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d03bd,_0x388779){var _0x73a25e={'status':_0x5d03bd};var _0x4ac414={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x388779){_0x73a25e[_0xacba('0xc')]=_0x388779;}return db[_0xacba('0xd')]['update'](_0x73a25e,_0x4ac414);}function getHeaders(_0x1a99bb){return _['map'](_0x1a99bb,function(_0x52d573){return{'text':_0x52d573,'style':'tableHeader'};});}function getRows(_0x241991,_0x5df0f2){return _[_0xacba('0xe')](_0x5df0f2,function(_0x31ac6a){return _(_0x31ac6a)['pick'](_0x241991)['map'](function(_0x18b956){return _0x18b956?_['toString'](_0x18b956):'';})[_0xacba('0xf')]();});}function createTable(_0x1de23e,_0x5eeeef){var _0x173c65={'widths':_[_0xacba('0x10')](Array(_0x1de23e[_0xacba('0x11')]),0x91),'heights':function(_0x37e1ab){return _0x37e1ab===0x0?_0xacba('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x18f109=getHeaders(_0x1de23e);_0x173c65[_0xacba('0x13')][_0xacba('0x14')](_0x18f109);var _0x394ac7=getRows(_0x1de23e,_0x5eeeef);_0x173c65[_0xacba('0x13')]=_0x173c65['body']['concat'](_0x394ac7);return _0x173c65;}function createTables(_0x5a19ae){var _0x5468cf=[];var _0x227a4d=_[_0xacba('0x15')](Object[_0xacba('0x16')](_0x5a19ae[0x0]),0x5);_0x227a4d[_0xacba('0x17')](function(_0x5b0587){_0x5468cf[_0xacba('0x14')](createTable(_0x5b0587,_0x5a19ae));});return _0x5468cf;}function getPDFDocDefinition(_0x509031){var _0x572cfb=util[_0xacba('0x18')](_0xacba('0x19'),NAME,EXTRACTED_REPORT[_0xacba('0x1a')],moment(EXTRACTED_REPORT[_0xacba('0x1b')])[_0xacba('0x18')](FORMAT),moment(EXTRACTED_REPORT[_0xacba('0x1c')])[_0xacba('0x18')](FORMAT));var _0x4be284=[];for(var _0xfbec4d=0x0;_0xfbec4d<_0x509031[_0xacba('0x11')];_0xfbec4d++){var _0x136b65=[];if(_0xfbec4d===0x0){_0x136b65['push']({'text':_0x572cfb,'style':_0xacba('0x1d')});}var _0x1d2a44={'table':_0x509031[_0xfbec4d]};if(_0xfbec4d>0x0){_0x1d2a44['pageBreak']=_0xacba('0x1e');_0x1d2a44[_0xacba('0x1f')]=[0x0,0x46,0x0,0x0];}_0x136b65[_0xacba('0x14')](_0x1d2a44);_0x4be284['push'](_0x136b65);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x4be284,'footer':function(_0x155c66,_0x119d48){return{'text':_0x155c66['toString']()+'\x20/\x20'+_0x119d48,'style':_0xacba('0x20')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xacba('0x21'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x54ec02){var _0x9a5262=0x1388;var _0x48cca2;if(!_0x54ec02[0x0][_0xacba('0x22')]){return analyticExtractedReport(_0xacba('0x23'));}return db[_0xacba('0x24')][_0xacba('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xacba('0x26')]})[_0xacba('0x27')](function(_0x1f01ab){if(_0x1f01ab){_0x48cca2=_0x1f01ab;_0x9a5262=_0x48cca2[_0xacba('0x26')]||0x3e8;}})[_0xacba('0x27')](function(){var _0x5b4aa4=[];var _0x50c10a=0x0;if(_0x48cca2[_0xacba('0x28')]){if(_0x54ec02&&_0x54ec02[_0xacba('0x11')]){var _0x81d77e=_[_0xacba('0x29')](_0x54ec02[0x0][_0xacba('0x22')]/_0x9a5262);var _0xe8c0e1=Number[_0xacba('0x2a')](_0x54ec02[0x0][_0xacba('0x22')]/_0x9a5262)?_0x54ec02[0x0][_0xacba('0x22')]%_0x9a5262:0x0;_0x81d77e['forEach'](function(_0x59cc6e){if(_0x59cc6e>0x0){_0x50c10a+=_0x9a5262;}_0x5b4aa4[_0xacba('0x14')](dbH[_0xacba('0x2b')][_0xacba('0x2c')](util[_0xacba('0x18')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x9a5262,_0x50c10a),{'type':dbH['sequelize']['QueryTypes'][_0xacba('0x2d')]}));});if(_0xe8c0e1>0x0){_0x50c10a+=_0x9a5262;_0x5b4aa4['push'](dbH[_0xacba('0x2b')][_0xacba('0x2c')](util[_0xacba('0x18')](_0xacba('0x2e'),QUERY,_0xe8c0e1,_0x50c10a),{'type':dbH[_0xacba('0x2b')][_0xacba('0x2f')]['SELECT']}));}}}else{_0x5b4aa4[_0xacba('0x14')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xacba('0x2b')][_0xacba('0x2f')]['SELECT']}));}var _0x228f1f=path['dirname'](PATH);var _0x1bcbcb=path['basename'](PATH,'.pdf');var _0xe21e8f=_0x48cca2[_0xacba('0x28')]&&_0x5b4aa4[_0xacba('0x11')]>0x1;var _0x29eed2=[];if(!fs[_0xacba('0x30')](path[_0xacba('0x31')](_0x228f1f,_0x1bcbcb))&&_0xe21e8f){fs[_0xacba('0x32')](path[_0xacba('0x31')](_0x228f1f,_0x1bcbcb));}return BPromise['each'](_0x5b4aa4,function(_0x38ff85){_0x29eed2[_0xacba('0x14')](_0x38ff85);})[_0xacba('0x27')](function(){var _0x49c5f0=[];for(var _0x2e7e61=0x0;_0x2e7e61<_0x29eed2['length'];_0x2e7e61+=0x1){var _0x13780b=_0x29eed2[_0x2e7e61];var _0x5c42f3=createTables(_['flatten'](_0x13780b));var _0x6f40a4;var _0x271e33=getPDFDocDefinition(_0x5c42f3);var _0x30a9d3=getPDFPrinter();var _0x22bc80=_0x30a9d3[_0xacba('0x33')](_0x271e33);if(_0xe21e8f){_0x6f40a4=path['join'](_0x228f1f,_0x1bcbcb,util[_0xacba('0x18')](_0xacba('0x34'),_0x1bcbcb,_0x2e7e61,_0xacba('0x35')));}else{_0x6f40a4=path[_0xacba('0x31')](_0x228f1f,util['format'](_0xacba('0x36'),_0x1bcbcb,_0xacba('0x35')));}_0x49c5f0[_0xacba('0x14')](writePDFDocument(_0x22bc80,_0x6f40a4));}return Promise[_0xacba('0x37')](_0x49c5f0);})[_0xacba('0x27')](function(){if(_0xe21e8f){return new Promise(function(_0xa37061){zipdir(path[_0xacba('0x31')](_0x228f1f,_0x1bcbcb),{'saveTo':path[_0xacba('0x31')](_0x228f1f,util[_0xacba('0x18')](_0xacba('0x36'),_0x1bcbcb,_0xacba('0x38')))},function(){rimraf(path[_0xacba('0x31')](_0x228f1f,_0x1bcbcb),function(){});_0xa37061('zip\x20finished');});});}})['then'](function(){if(!_0xe21e8f)return;rimraf(path['join'](_0x228f1f,_0x1bcbcb),function(){});})[_0xacba('0x27')](function(){logger[_0xacba('0x39')](util['format'](_0xacba('0x3a'),EXTRACTED_REPORT_ID,_0xacba('0x3b')));return analyticExtractedReport('Completed',_0xe21e8f?util[_0xacba('0x18')](_0xacba('0x36'),_0x1bcbcb,_0xe21e8f?_0xacba('0x38'):_0xacba('0x35')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xacba('0x39')](util[_0xacba('0x18')](_0xacba('0x3c'),EXTRACTED_REPORT_ID,_0xacba('0x3b')));return db[_0xacba('0xd')][_0xacba('0x3d')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xacba('0x27')](function(_0x3cd10b){EXTRACTED_REPORT=_0x3cd10b;return dbH[_0xacba('0x2b')][_0xacba('0x2c')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xacba('0x2f')]['SELECT']});})[_0xacba('0x27')](extractReport)[_0xacba('0x3e')](function(_0x29b9ac){logger[_0xacba('0x39')](util['format'](_0xacba('0x3f'),EXTRACTED_REPORT_ID,_0xacba('0x3b')),util[_0xacba('0x40')](_0x29b9ac,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xacba('0x41')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3ae2ef=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xacba('0x42'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xacba('0x43')}});return _0x3ae2ef;}function getPDFDocDefinitionFromHTML(_0x5df0b4,_0x5c9c7d){var _0x59b644=util[_0xacba('0x18')](_0xacba('0x44'),_0x5c9c7d[_0xacba('0x45')],_0x5c9c7d['interactionId']);var _0x1d4f66=moment()[_0xacba('0x18')](_0xacba('0x46'))[_0xacba('0x47')]();var _0x42cfb6=htmlToPdfmake(_0x5df0b4,{'window':window,'tableAutoSize':!![]});return{'content':[_0x42cfb6],'defaultStyle':{'font':_0xacba('0x48')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xacba('0x49'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xacba('0x49'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xacba('0x49')}},'header':function(){return[{'text':_0xacba('0x4a'),'style':_0xacba('0x1d')}];},'footer':function(_0x2526f8,_0x2ed610){return[{'text':util['format'](_0xacba('0x4b'),_0x59b644,_0x2526f8,_0x2ed610,_0x1d4f66),'style':_0xacba('0x20')}];}};}function writePDFDocument(_0x339ff2,_0x25925e){return new Promise(function(_0x493739,_0x144105){var _0x512a8c=_0x339ff2[_0xacba('0x4c')](fs[_0xacba('0x4d')](_0x25925e));_0x512a8c['on']('finish',function(){_0x493739(_0xacba('0x4e'));});_0x512a8c['on'](_0xacba('0x4f'),function(_0x3668ff){_0x144105(_0x3668ff);});_0x339ff2[_0xacba('0x50')]();});}exports[_0xacba('0x51')]=function(_0x133e7e,_0x7de9a5){var _0x5d8900=getPDFPrinter();var _0x61048=getPDFDocDefinitionFromHTML(_0x133e7e,_0x7de9a5);var _0x5cd130=_0x5d8900[_0xacba('0x33')](_0x61048);return writePDFDocument(_0x5cd130,_0x7de9a5[_0xacba('0x52')])[_0xacba('0x3e')](function(_0x267a1a){throw _0x267a1a;});}; \ No newline at end of file +var _0x7a86=['exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','error','createPdfFromHTML','path','catch','lodash','util','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','map','pick','toString','value','fill','length','auto','body','push','concat','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','landscape','Arial','black','right','num','find','then','split','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','basename','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','info','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed'];(function(_0x2afd3e,_0x6d310a){var _0x184f97=function(_0x5b0c4c){while(--_0x5b0c4c){_0x2afd3e['push'](_0x2afd3e['shift']());}};_0x184f97(++_0x6d310a);}(_0x7a86,0x64));var _0x67a8=function(_0x3918c8,_0xde688c){_0x3918c8=_0x3918c8-0x0;var _0x5a1a72=_0x7a86[_0x3918c8];return _0x5a1a72;};'use strict';var _=require(_0x67a8('0x0'));var fs=require('fs');var util=require(_0x67a8('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x67a8('0x2'));var zipdir=require(_0x67a8('0x3'));var rimraf=require(_0x67a8('0x4'));var JSDOM=require(_0x67a8('0x5'))['JSDOM'];var window=new JSDOM('')[_0x67a8('0x6')];var BPromise=require(_0x67a8('0x7'));var db=require(_0x67a8('0x8'))['db'];var dbH=require(_0x67a8('0x8'))['dbH'];var logger=require(_0x67a8('0x9'))(_0x67a8('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x67a8('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x67a8('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x48abf2,_0x4b13b3){var _0x4d563e={'status':_0x48abf2};var _0x5c3bff={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b13b3){_0x4d563e[_0x67a8('0xc')]=_0x4b13b3;}return db['AnalyticExtractedReport']['update'](_0x4d563e,_0x5c3bff);}function getHeaders(_0x2aa07f){return _[_0x67a8('0xd')](_0x2aa07f,function(_0x51dfb9){return{'text':_0x51dfb9,'style':'tableHeader'};});}function getRows(_0x178b88,_0x1e7cd2){return _[_0x67a8('0xd')](_0x1e7cd2,function(_0x53d685){return _(_0x53d685)[_0x67a8('0xe')](_0x178b88)['map'](function(_0x356f7d){return _0x356f7d?_[_0x67a8('0xf')](_0x356f7d):'';})[_0x67a8('0x10')]();});}function createTable(_0x529327,_0x95c2e6){var _0x25e978={'widths':_[_0x67a8('0x11')](Array(_0x529327[_0x67a8('0x12')]),0x91),'heights':function(_0x509669){return _0x509669===0x0?_0x67a8('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3f05ba=getHeaders(_0x529327);_0x25e978[_0x67a8('0x14')][_0x67a8('0x15')](_0x3f05ba);var _0x2559be=getRows(_0x529327,_0x95c2e6);_0x25e978['body']=_0x25e978[_0x67a8('0x14')][_0x67a8('0x16')](_0x2559be);return _0x25e978;}function createTables(_0x177590){var _0x13e1c0=[];var _0x369442=_['chunk'](Object[_0x67a8('0x17')](_0x177590[0x0]),0x5);_0x369442['forEach'](function(_0x281178){_0x13e1c0[_0x67a8('0x15')](createTable(_0x281178,_0x177590));});return _0x13e1c0;}function getPDFDocDefinition(_0x58cacf){var _0x2b2e69=util[_0x67a8('0x18')](_0x67a8('0x19'),NAME,EXTRACTED_REPORT[_0x67a8('0x1a')],moment(EXTRACTED_REPORT[_0x67a8('0x1b')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x67a8('0x18')](FORMAT));var _0x5e0ae3=[];for(var _0x1b9aa8=0x0;_0x1b9aa8<_0x58cacf[_0x67a8('0x12')];_0x1b9aa8++){var _0x279eda=[];if(_0x1b9aa8===0x0){_0x279eda[_0x67a8('0x15')]({'text':_0x2b2e69,'style':_0x67a8('0x1c')});}var _0x45635e={'table':_0x58cacf[_0x1b9aa8]};if(_0x1b9aa8>0x0){_0x45635e[_0x67a8('0x1d')]=_0x67a8('0x1e');_0x45635e[_0x67a8('0x1f')]=[0x0,0x46,0x0,0x0];}_0x279eda[_0x67a8('0x15')](_0x45635e);_0x5e0ae3[_0x67a8('0x15')](_0x279eda);}return{'pageSize':'A4','pageOrientation':_0x67a8('0x20'),'content':_0x5e0ae3,'footer':function(_0x283873,_0x4d662f){return{'text':_0x283873[_0x67a8('0xf')]()+'\x20/\x20'+_0x4d662f,'style':'footer'};},'defaultStyle':{'font':_0x67a8('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x67a8('0x22')},'footer':{'alignment':_0x67a8('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x32a5fc){var _0x310fe8=0x1388;var _0x1a3be2;if(!_0x32a5fc[0x0][_0x67a8('0x24')]){return analyticExtractedReport('Empty');}return db['Setting'][_0x67a8('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})['then'](function(_0x140479){if(_0x140479){_0x1a3be2=_0x140479;_0x310fe8=_0x1a3be2['splitSizePdf']||0x3e8;}})[_0x67a8('0x26')](function(){var _0x54b88a=[];var _0x135374=0x0;if(_0x1a3be2[_0x67a8('0x27')]){if(_0x32a5fc&&_0x32a5fc['length']){var _0x44a756=_['range'](_0x32a5fc[0x0][_0x67a8('0x24')]/_0x310fe8);var _0x105043=Number[_0x67a8('0x28')](_0x32a5fc[0x0][_0x67a8('0x24')]/_0x310fe8)?_0x32a5fc[0x0]['num']%_0x310fe8:0x0;_0x44a756[_0x67a8('0x29')](function(_0xd2216f){if(_0xd2216f>0x0){_0x135374+=_0x310fe8;}_0x54b88a[_0x67a8('0x15')](dbH['sequelize'][_0x67a8('0x2a')](util[_0x67a8('0x18')](_0x67a8('0x2b'),QUERY,_0x310fe8,_0x135374),{'type':dbH['sequelize'][_0x67a8('0x2c')][_0x67a8('0x2d')]}));});if(_0x105043>0x0){_0x135374+=_0x310fe8;_0x54b88a[_0x67a8('0x15')](dbH[_0x67a8('0x2e')][_0x67a8('0x2a')](util[_0x67a8('0x18')](_0x67a8('0x2b'),QUERY,_0x105043,_0x135374),{'type':dbH[_0x67a8('0x2e')][_0x67a8('0x2c')][_0x67a8('0x2d')]}));}}}else{_0x54b88a[_0x67a8('0x15')](dbH[_0x67a8('0x2e')][_0x67a8('0x2a')](QUERY,{'type':dbH[_0x67a8('0x2e')][_0x67a8('0x2c')][_0x67a8('0x2d')]}));}var _0x2d5fa7=path[_0x67a8('0x2f')](PATH);var _0x1b3a39=path[_0x67a8('0x30')](PATH,'.pdf');var _0x30b3c3=_0x1a3be2[_0x67a8('0x27')]&&_0x54b88a[_0x67a8('0x12')]>0x1;var _0x422123=[];if(!fs[_0x67a8('0x31')](path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39))&&_0x30b3c3){fs[_0x67a8('0x33')](path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39));}return BPromise['each'](_0x54b88a,function(_0x575667){_0x422123[_0x67a8('0x15')](_0x575667);})['then'](function(){var _0x3bf5f6=[];for(var _0x59e693=0x0;_0x59e693<_0x422123[_0x67a8('0x12')];_0x59e693+=0x1){var _0x3f59b1=_0x422123[_0x59e693];var _0x1a8d96=createTables(_[_0x67a8('0x34')](_0x3f59b1));var _0x13a0e7;var _0x485cc4=getPDFDocDefinition(_0x1a8d96);var _0x4a8a73=getPDFPrinter();var _0x1e5b35=_0x4a8a73[_0x67a8('0x35')](_0x485cc4);if(_0x30b3c3){_0x13a0e7=path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39,util[_0x67a8('0x18')](_0x67a8('0x36'),_0x1b3a39,_0x59e693,_0x67a8('0x37')));}else{_0x13a0e7=path['join'](_0x2d5fa7,util[_0x67a8('0x18')]('%s.%s',_0x1b3a39,_0x67a8('0x37')));}_0x3bf5f6['push'](writePDFDocument(_0x1e5b35,_0x13a0e7));}return Promise[_0x67a8('0x38')](_0x3bf5f6);})[_0x67a8('0x26')](function(){if(_0x30b3c3){return new Promise(function(_0x1cd050){zipdir(path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39),{'saveTo':path[_0x67a8('0x32')](_0x2d5fa7,util['format'](_0x67a8('0x39'),_0x1b3a39,_0x67a8('0x3a')))},function(){rimraf(path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39),function(){});_0x1cd050('zip\x20finished');});});}})['then'](function(){if(!_0x30b3c3)return;rimraf(path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39),function(){});})[_0x67a8('0x26')](function(){logger[_0x67a8('0x3b')](util[_0x67a8('0x18')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x67a8('0x3c'),_0x30b3c3?util[_0x67a8('0x18')](_0x67a8('0x39'),_0x1b3a39,_0x30b3c3?_0x67a8('0x3a'):_0x67a8('0x37')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x67a8('0x3b')](util['format'](_0x67a8('0x3d'),EXTRACTED_REPORT_ID,_0x67a8('0x3e')));return db[_0x67a8('0x3f')][_0x67a8('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x67a8('0x26')](function(_0x36030e){EXTRACTED_REPORT=_0x36030e;return dbH[_0x67a8('0x2e')][_0x67a8('0x2a')](util[_0x67a8('0x18')](_0x67a8('0x41'),QUERY),{'type':dbH[_0x67a8('0x2e')]['QueryTypes']['SELECT']});})['then'](extractReport)['catch'](function(_0x51b8eb){logger[_0x67a8('0x3b')](util[_0x67a8('0x18')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x67a8('0x3e')),util[_0x67a8('0x42')](_0x51b8eb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x67a8('0x43'));})['finally'](function(){process[_0x67a8('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x363d3b=new PdfPrinter({'Arial':{'normal':__dirname+_0x67a8('0x45'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x67a8('0x46'),'bolditalics':__dirname+_0x67a8('0x47')}});return _0x363d3b;}function getPDFDocDefinitionFromHTML(_0x4aa6c6,_0x381d0e){var _0x98277f=util[_0x67a8('0x18')]('%s\x20#%d',_0x381d0e[_0x67a8('0x48')],_0x381d0e[_0x67a8('0x49')]);var _0x30dbf2=moment()[_0x67a8('0x18')]('YYYY-MM-DD')[_0x67a8('0xf')]();var _0x44bd50=htmlToPdfmake(_0x4aa6c6,{'window':window,'tableAutoSize':!![]});return{'content':[_0x44bd50],'defaultStyle':{'font':_0x67a8('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x67a8('0x4a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x67a8('0x4a'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x67a8('0x4a')}},'header':function(){return[{'text':_0x67a8('0x4b'),'style':_0x67a8('0x1c')}];},'footer':function(_0x5f3374,_0xdf6c25){return[{'text':util['format'](_0x67a8('0x4c'),_0x98277f,_0x5f3374,_0xdf6c25,_0x30dbf2),'style':_0x67a8('0x4d')}];}};}function writePDFDocument(_0x540da8,_0x49685a){return new Promise(function(_0x40db0c,_0x480d4e){var _0xd2a216=_0x540da8[_0x67a8('0x4e')](fs['createWriteStream'](_0x49685a));_0xd2a216['on'](_0x67a8('0x4f'),function(){_0x40db0c(_0x67a8('0x4f'));});_0xd2a216['on'](_0x67a8('0x50'),function(_0x4015bb){_0x480d4e(_0x4015bb);});_0x540da8['end']();});}exports[_0x67a8('0x51')]=function(_0x3376b8,_0x3f0af5){var _0x13cde0=getPDFPrinter();var _0x1115e1=getPDFDocDefinitionFromHTML(_0x3376b8,_0x3f0af5);var _0x189d18=_0x13cde0['createPdfKitDocument'](_0x1115e1);return writePDFDocument(_0x189d18,_0x3f0af5[_0x67a8('0x52')])[_0x67a8('0x53')](function(_0x44bc04){throw _0x44bc04;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5593e0a..ff28de8 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 _0x75a6=['basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname'];(function(_0x3e6d7c,_0x4ce27c){var _0x2e0e1a=function(_0x1c08cf){while(--_0x1c08cf){_0x3e6d7c['push'](_0x3e6d7c['shift']());}};_0x2e0e1a(++_0x4ce27c);}(_0x75a6,0x11d));var _0x675a=function(_0x4e845c,_0x183036){_0x4e845c=_0x4e845c-0x0;var _0x7a81bf=_0x75a6[_0x4e845c];return _0x7a81bf;};'use strict';var util=require(_0x675a('0x0'));var path=require(_0x675a('0x1'));var _=require(_0x675a('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x675a('0x3'));var zipdir=require(_0x675a('0x4'));var rimraf=require(_0x675a('0x5'));var db=require(_0x675a('0x6'))['db'];var dbH=require(_0x675a('0x6'))[_0x675a('0x7')];var logger=require(_0x675a('0x8'))(_0x675a('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x675a('0xa')][0x3];var PATH=process[_0x675a('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x339f61,_0x12a618){var _0xdc63e1={'status':_0x339f61};var _0x368d22={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12a618){_0xdc63e1['savename']=_0x12a618;}return db[_0x675a('0xb')]['update'](_0xdc63e1,_0x368d22);}function main(){var _0x5c8599=0x1388;var _0x2b255b;logger['info'](util[_0x675a('0xc')](_0x675a('0xd'),EXTRACTED_REPORT_ID,_0x675a('0xe')));return db[_0x675a('0xf')][_0x675a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x675a('0x11'),_0x675a('0x12')]})[_0x675a('0x13')](function(_0x1c5da3){if(_0x1c5da3){_0x2b255b=_0x1c5da3;_0x5c8599=_0x2b255b['splitSizeXlsx']||0x1388;}})[_0x675a('0x13')](function(){return dbH[_0x675a('0x14')]['query'](util['format'](_0x675a('0x15'),QUERY),{'type':dbH[_0x675a('0x14')][_0x675a('0x16')][_0x675a('0x17')]});})['then'](function(_0x2a473f){if(!_0x2a473f[0x0][_0x675a('0x18')]){return analyticExtractedReport(_0x675a('0x19'));}var _0x2b6d12=[];var _0x1bd2f0=0x0;if(_0x2b255b['split']){if(_0x2a473f&&_0x2a473f[_0x675a('0x1a')]){var _0x3ed759=_['range'](_0x2a473f[0x0]['num']/_0x5c8599);var _0x5592ed=Number[_0x675a('0x1b')](_0x2a473f[0x0][_0x675a('0x18')]/_0x5c8599)?_0x2a473f[0x0][_0x675a('0x18')]%_0x5c8599:0x0;_0x3ed759[_0x675a('0x1c')](function(_0xfafe90){if(_0xfafe90>0x0){_0x1bd2f0+=_0x5c8599;}_0x2b6d12[_0x675a('0x1d')](dbH[_0x675a('0x14')]['query'](util[_0x675a('0xc')](_0x675a('0x1e'),QUERY,_0x5c8599,_0x1bd2f0),{'type':dbH['sequelize'][_0x675a('0x16')]['SELECT']}));});if(_0x5592ed>0x0){_0x1bd2f0+=_0x5c8599;_0x2b6d12['push'](dbH[_0x675a('0x14')]['query'](util[_0x675a('0xc')](_0x675a('0x1e'),QUERY,_0x5592ed,_0x1bd2f0),{'type':dbH[_0x675a('0x14')][_0x675a('0x16')][_0x675a('0x17')]}));}}}else{_0x2b6d12[_0x675a('0x1d')](dbH[_0x675a('0x14')][_0x675a('0x1f')](QUERY,{'type':dbH[_0x675a('0x14')][_0x675a('0x16')][_0x675a('0x17')]}));}var _0x3c9a1a=path[_0x675a('0x20')](PATH);var _0x1b6258=path[_0x675a('0x21')](PATH,_0x675a('0x22'));var _0x59f3ce=_0x2b255b[_0x675a('0x11')]&&_0x2b6d12[_0x675a('0x1a')]>0x1;var _0x3b4fc9=[];if(!fs[_0x675a('0x23')](path['join'](_0x3c9a1a,_0x1b6258))&&_0x59f3ce){fs['mkdirSync'](path[_0x675a('0x24')](_0x3c9a1a,_0x1b6258));}return BPromise[_0x675a('0x25')](_0x2b6d12,function(_0x1ab954){_0x3b4fc9[_0x675a('0x1d')](_0x1ab954);})[_0x675a('0x13')](function(){for(var _0x4053ad=0x0;_0x4053ad<_0x3b4fc9[_0x675a('0x1a')];_0x4053ad+=0x1){var _0x4edf6d;var _0x98c4a6=_0x3b4fc9[_0x4053ad];if(_0x59f3ce){_0x4edf6d=path['join'](_0x3c9a1a,_0x1b6258,util[_0x675a('0xc')](_0x675a('0x26'),_0x1b6258,_0x4053ad,_0x675a('0x27')));}else{_0x4edf6d=path['join'](_0x3c9a1a,util[_0x675a('0xc')](_0x675a('0x28'),_0x1b6258,_0x675a('0x27')));}fs[_0x675a('0x29')](_0x4edf6d,json2xls(_0x98c4a6),_0x675a('0x2a'));}})[_0x675a('0x13')](function(){if(_0x59f3ce){return new Promise(function(_0xe8b083){zipdir(path[_0x675a('0x24')](_0x3c9a1a,_0x1b6258),{'saveTo':path[_0x675a('0x24')](_0x3c9a1a,util[_0x675a('0xc')](_0x675a('0x28'),_0x1b6258,'zip'))},function(_0x4689ae,_0x4e03f1){rimraf(path[_0x675a('0x24')](_0x3c9a1a,_0x1b6258),function(){});_0xe8b083(_0x675a('0x2b'));});});}})[_0x675a('0x13')](function(){logger[_0x675a('0x2c')](util['format'](_0x675a('0x2d'),EXTRACTED_REPORT_ID,_0x675a('0xe')));return analyticExtractedReport(_0x675a('0x2e'),_0x59f3ce?util['format'](_0x675a('0x28'),_0x1b6258,_0x59f3ce?_0x675a('0x2f'):'xlsx'):null);});})[_0x675a('0x30')](function(_0x2d605d){logger[_0x675a('0x2c')](util[_0x675a('0xc')](_0x675a('0x31'),EXTRACTED_REPORT_ID,_0x675a('0xe')),util[_0x675a('0x32')](_0x2d605d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x675a('0x33')](function(){process[_0x675a('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2d12=['../../config/logger','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0x55c09e,_0x395bfa){var _0xa1d143=function(_0x218e80){while(--_0x218e80){_0x55c09e['push'](_0x55c09e['shift']());}};_0xa1d143(++_0x395bfa);}(_0x2d12,0x198));var _0x22d1=function(_0x29bca4,_0x5f5512){_0x29bca4=_0x29bca4-0x0;var _0xe8cc31=_0x2d12[_0x29bca4];return _0xe8cc31;};'use strict';var util=require('util');var path=require(_0x22d1('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x22d1('0x1'));var zipdir=require(_0x22d1('0x2'));var rimraf=require(_0x22d1('0x3'));var db=require(_0x22d1('0x4'))['db'];var dbH=require(_0x22d1('0x4'))[_0x22d1('0x5')];var logger=require(_0x22d1('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x22d1('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x18511a,_0x50a020){var _0x54a4a4={'status':_0x18511a};var _0x437599={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50a020){_0x54a4a4['savename']=_0x50a020;}return db[_0x22d1('0x8')]['update'](_0x54a4a4,_0x437599);}function main(){var _0x585e96=0x1388;var _0x4a1a7c;logger[_0x22d1('0x9')](util[_0x22d1('0xa')](_0x22d1('0xb'),EXTRACTED_REPORT_ID,_0x22d1('0xc')));return db['Setting'][_0x22d1('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x22d1('0xe'),_0x22d1('0xf')]})['then'](function(_0xbb8b2b){if(_0xbb8b2b){_0x4a1a7c=_0xbb8b2b;_0x585e96=_0x4a1a7c['splitSizeXlsx']||0x1388;}})[_0x22d1('0x10')](function(){return dbH[_0x22d1('0x11')][_0x22d1('0x12')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x22d1('0x11')][_0x22d1('0x13')][_0x22d1('0x14')]});})[_0x22d1('0x10')](function(_0x1ea202){if(!_0x1ea202[0x0][_0x22d1('0x15')]){return analyticExtractedReport('Empty');}var _0x372094=[];var _0x2563d7=0x0;if(_0x4a1a7c[_0x22d1('0xe')]){if(_0x1ea202&&_0x1ea202[_0x22d1('0x16')]){var _0x2f5b0d=_[_0x22d1('0x17')](_0x1ea202[0x0][_0x22d1('0x15')]/_0x585e96);var _0x13dcf8=Number[_0x22d1('0x18')](_0x1ea202[0x0]['num']/_0x585e96)?_0x1ea202[0x0]['num']%_0x585e96:0x0;_0x2f5b0d[_0x22d1('0x19')](function(_0x3536ee){if(_0x3536ee>0x0){_0x2563d7+=_0x585e96;}_0x372094[_0x22d1('0x1a')](dbH[_0x22d1('0x11')]['query'](util[_0x22d1('0xa')](_0x22d1('0x1b'),QUERY,_0x585e96,_0x2563d7),{'type':dbH[_0x22d1('0x11')]['QueryTypes'][_0x22d1('0x14')]}));});if(_0x13dcf8>0x0){_0x2563d7+=_0x585e96;_0x372094[_0x22d1('0x1a')](dbH[_0x22d1('0x11')][_0x22d1('0x12')](util['format'](_0x22d1('0x1b'),QUERY,_0x13dcf8,_0x2563d7),{'type':dbH[_0x22d1('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x372094['push'](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x22d1('0x13')]['SELECT']}));}var _0x425b29=path['dirname'](PATH);var _0x39ce77=path[_0x22d1('0x1c')](PATH,_0x22d1('0x1d'));var _0x37d1fa=_0x4a1a7c[_0x22d1('0xe')]&&_0x372094['length']>0x1;var _0x30eb14=[];if(!fs[_0x22d1('0x1e')](path[_0x22d1('0x1f')](_0x425b29,_0x39ce77))&&_0x37d1fa){fs['mkdirSync'](path[_0x22d1('0x1f')](_0x425b29,_0x39ce77));}return BPromise[_0x22d1('0x20')](_0x372094,function(_0x963bf1){_0x30eb14[_0x22d1('0x1a')](_0x963bf1);})[_0x22d1('0x10')](function(){for(var _0x35353c=0x0;_0x35353c<_0x30eb14['length'];_0x35353c+=0x1){var _0x1c0e2e;var _0x4dcc5a=_0x30eb14[_0x35353c];if(_0x37d1fa){_0x1c0e2e=path['join'](_0x425b29,_0x39ce77,util[_0x22d1('0xa')](_0x22d1('0x21'),_0x39ce77,_0x35353c,_0x22d1('0x22')));}else{_0x1c0e2e=path[_0x22d1('0x1f')](_0x425b29,util[_0x22d1('0xa')](_0x22d1('0x23'),_0x39ce77,_0x22d1('0x22')));}fs[_0x22d1('0x24')](_0x1c0e2e,json2xls(_0x4dcc5a),_0x22d1('0x25'));}})['then'](function(){if(_0x37d1fa){return new Promise(function(_0x26b9cf){zipdir(path[_0x22d1('0x1f')](_0x425b29,_0x39ce77),{'saveTo':path['join'](_0x425b29,util['format'](_0x22d1('0x23'),_0x39ce77,'zip'))},function(_0x58fe17,_0x1af44d){rimraf(path[_0x22d1('0x1f')](_0x425b29,_0x39ce77),function(){});_0x26b9cf('zip\x20finished');});});}})[_0x22d1('0x10')](function(){logger['info'](util[_0x22d1('0xa')](_0x22d1('0x26'),EXTRACTED_REPORT_ID,_0x22d1('0xc')));return analyticExtractedReport(_0x22d1('0x27'),_0x37d1fa?util[_0x22d1('0xa')](_0x22d1('0x23'),_0x39ce77,_0x37d1fa?_0x22d1('0x28'):_0x22d1('0x22')):null);});})[_0x22d1('0x29')](function(_0x34dffc){logger[_0x22d1('0x9')](util[_0x22d1('0xa')](_0x22d1('0x2a'),EXTRACTED_REPORT_ID,_0x22d1('0xc')),util['inspect'](_0x34dffc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x22d1('0x2b'));})[_0x22d1('0x2c')](function(){process[_0x22d1('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 10480a3..4aaaf7a 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 _0x9b76=['$[${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-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','util','Interval','then','intervals','models','VoiceExtension','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='];(function(_0x2f8707,_0x4328a8){var _0x21f664=function(_0x1f1c1d){while(--_0x1f1c1d){_0x2f8707['push'](_0x2f8707['shift']());}};_0x21f664(++_0x4328a8);}(_0x9b76,0xa5));var _0x69b7=function(_0x5280fc,_0x4f0916){_0x5280fc=_0x5280fc-0x0;var _0x373384=_0x9b76[_0x5280fc];return _0x373384;};'use strict';var _=require('lodash');var util=require(_0x69b7('0x0'));function rewrite(_0x307f0d,_0x2ee1fe){var _0x5bb928=this;return _0x307f0d['models'][_0x69b7('0x1')]['findAll']({'raw':!![]})[_0x69b7('0x2')](function(_0x40e54f){_0x5bb928[_0x69b7('0x3')]=_0x40e54f;return _0x307f0d[_0x69b7('0x4')][_0x69b7('0x5')][_0x69b7('0x6')]({'where':{'IntervalId':_0x2ee1fe['IntervalId']},'raw':!![]});})[_0x69b7('0x2')](function(_0x2aa901){return _0x307f0d[_0x69b7('0x4')][_0x69b7('0x5')][_0x69b7('0x6')]({'where':{'exten':{'$in':_[_0x69b7('0x7')](_[_0x69b7('0x8')](_0x2aa901,_0x69b7('0x9')))}},'order':[{'raw':_0x69b7('0xa')}],'raw':!![]});})[_0x69b7('0x2')](function(_0xfffc9){var _0x56702a=_[_0x69b7('0xb')](_0xfffc9,{'priority':'1'});var _0x42bdcb=_[_0x69b7('0xb')](_0xfffc9,{'isApp':0x1});var _0x57e6bc=_[_0x69b7('0xc')](_0x42bdcb,_0x69b7('0x9'));var _0x9e11ab=[_0x69b7('0xd'),_0x69b7('0xe')];var _0xce7120=[];var _0x214b91=[];for(var _0xdd1278 in _0x57e6bc){if(_0x57e6bc[_0x69b7('0xf')](_0xdd1278)){_0x5bb928[_0x69b7('0x10')]=0x2;_0x5bb928[_0x69b7('0x11')]=[];_0x5bb928[_0x69b7('0x12')]=_[_0x69b7('0x13')](_0x56702a,{'exten':_0x57e6bc[_0xdd1278][0x0]['exten']});_0x5bb928[_0x69b7('0x11')]['push']({'type':_0x57e6bc[_0xdd1278][0x0]['type'],'app':_0x69b7('0x14'),'appdata':util[_0x69b7('0x15')](_0x69b7('0x16'),_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')]),'context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928[_0x69b7('0x10')]++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')]});if(_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')]===_0x69b7('0x1a')){_0x5bb928[_0x69b7('0x11')]['push']({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':'Set','appdata':_0x69b7('0x1b')+_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')],'context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928[_0x69b7('0x10')]++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0]['VoiceExtensionId']});}else if(_0x57e6bc[_0xdd1278][0x0]['type']===_0x69b7('0x1c')){if(_0x5bb928[_0x69b7('0x12')]){_0x5bb928[_0x69b7('0x11')][_0x69b7('0x1d')]({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':_0x69b7('0x14'),'appdata':_0x69b7('0x1e')+(_0x5bb928[_0x69b7('0x12')][_0x69b7('0x1f')]?_0x69b7('0x20')+_0x5bb928[_0x69b7('0x12')]['cutdigits']+'}':_0x69b7('0x21')),'context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928[_0x69b7('0x10')]++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0]['VoiceExtensionId']});}_0x5bb928[_0x69b7('0x11')][_0x69b7('0x1d')]({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':'Set','appdata':_0x69b7('0x1b')+_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')],'context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928[_0x69b7('0x10')]++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')]});var _0x90dc20=_0x5bb928[_0x69b7('0x10')]++;_0x5bb928[_0x69b7('0x11')][_0x69b7('0x1d')]({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':_0x69b7('0x22'),'appdata':_0x69b7('0x23')+(_0x90dc20+0x2)+_0x69b7('0x24')+(_0x90dc20+0x1)+')','context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0]['exten'],'priority':_0x90dc20,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0]['VoiceExtensionId']});if(_0x5bb928[_0x69b7('0x12')]){_0x5bb928[_0x69b7('0x11')][_0x69b7('0x1d')]({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':'Set','appdata':_0x5bb928[_0x69b7('0x12')][_0x69b7('0x1f')]?'CDR(prefix)=${EXTEN:0:'+_0x5bb928[_0x69b7('0x12')][_0x69b7('0x1f')]+'}':_0x69b7('0x25'),'context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928[_0x69b7('0x10')]++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')]});}_0x5bb928['extensions'][_0x69b7('0x1d')]({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':_0x69b7('0x14'),'appdata':_0x69b7('0x26')+_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')],'context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928[_0x69b7('0x10')]++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')]});if(_0x5bb928[_0x69b7('0x12')]&&_0x5bb928[_0x69b7('0x12')][_0x69b7('0xf')](_0x69b7('0x27'))&&_0x5bb928['extension'][_0x69b7('0x27')]!=='none'){_0x5bb928[_0x69b7('0x11')][_0x69b7('0x1d')]({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x57e6bc[_0xdd1278][0x0]['context'],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928[_0x69b7('0x10')]++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')]});_0x5bb928[_0x69b7('0x11')][_0x69b7('0x1d')]({'type':_0x57e6bc[_0xdd1278][0x0]['type'],'app':'Set','appdata':_0x69b7('0x28')+_0x5bb928[_0x69b7('0x12')]['recordingFormat']||_0x69b7('0x29'),'context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0]['exten'],'priority':_0x5bb928['priority']++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0]['VoiceExtensionId']});}}_0x5bb928['extensions'][_0x69b7('0x1d')]({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':_0x69b7('0x14'),'appdata':_0x69b7('0x2a'),'context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928[_0x69b7('0x10')]++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')]});_0x5bb928[_0x69b7('0x11')][_0x69b7('0x1d')]({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':_0x69b7('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928['priority']++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0]['VoiceExtensionId']});_0x5bb928[_0x69b7('0x11')]['push']({'type':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x17')],'app':'Set','appdata':_0x69b7('0x2b'),'context':_0x57e6bc[_0xdd1278][0x0]['context'],'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'priority':_0x5bb928[_0x69b7('0x10')]++,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')]});for(var _0x272e12=0x0,_0x5f1d0c=0x0;_0x272e12<_0x57e6bc[_0xdd1278][_0x69b7('0x2c')];_0x272e12+=0x1,_0x5f1d0c=0x0){var _0x509043=_0x57e6bc[_0xdd1278][_0x272e12];if(_0x509043[_0x69b7('0x17')]){_0x509043[_0x69b7('0x17')]=_0x509043[_0x69b7('0x17')][_0x69b7('0x2d')]();}var _0x363a39=[];var _0x154f89=[];delete _0x509043['id'];delete _0x509043[_0x69b7('0x2e')];delete _0x509043[_0x69b7('0x2f')];var _0x53d39e=_0x509043[_0x69b7('0x30')]!==_0x69b7('0x31')?[_0x509043[_0x69b7('0x30')]]:_0x509043[_0x69b7('0x32')]?_['map'](_['filter'](_0x5bb928[_0x69b7('0x3')],{'IntervalId':_0x509043[_0x69b7('0x32')]}),_0x69b7('0x30')):[];if(_0x509043['hasOwnProperty'](_0x69b7('0x33'))){if(_0x509043[_0x69b7('0x33')]&&_0x509043[_0x69b7('0x33')]!=='--'){_0x363a39[_0x69b7('0x1d')]({'type':_0x509043[_0x69b7('0x17')],'app':_0x69b7('0x14'),'appdata':'CDR(tag)='+_0x509043['tag'],'context':_0x509043[_0x69b7('0x18')],'exten':_0x509043[_0x69b7('0x9')],'priority':_0x53d39e[_0x69b7('0x2c')]+_0x5bb928[_0x69b7('0x10')]+_0x5f1d0c++,'VoiceExtensionId':_0x509043['VoiceExtensionId']});}}if(_0x509043['type']===_0x69b7('0x1c')&&_0x509043[_0x69b7('0xf')](_0x69b7('0x34'))){if(_0x509043[_0x69b7('0x34')]){_0x363a39[_0x69b7('0x1d')]({'type':_0x509043['type'],'app':_0x69b7('0x22'),'appdata':_0x69b7('0x35')+_0x509043['callerID']+')','context':_0x509043['context'],'exten':_0x509043['exten'],'priority':_0x53d39e[_0x69b7('0x2c')]+_0x5bb928[_0x69b7('0x10')]+_0x5f1d0c++,'VoiceExtensionId':_0x509043[_0x69b7('0x19')]});}else{_0x363a39[_0x69b7('0x1d')]({'type':_0x509043[_0x69b7('0x17')],'app':_0x69b7('0x22'),'appdata':_0x69b7('0x36'),'context':_0x509043[_0x69b7('0x18')],'exten':_0x509043['exten'],'priority':_0x53d39e[_0x69b7('0x2c')]+_0x5bb928[_0x69b7('0x10')]+_0x5f1d0c++,'VoiceExtensionId':_0x509043[_0x69b7('0x19')]});}}if(_0x509043[_0x69b7('0xf')](_0x69b7('0x37'))){if(_0x9e11ab['indexOf'](_0x509043[_0x69b7('0x38')][_0x69b7('0x2d')]())>=0x0&&_0x509043[_0x69b7('0x39')]!==_0x69b7('0x3a')){if(_0x509043['answer']){_0x363a39[_0x69b7('0x1d')]({'type':_0x509043[_0x69b7('0x17')],'app':_0x69b7('0x22'),'appdata':_0x69b7('0x3b'),'context':_0x509043[_0x69b7('0x18')],'exten':_0x509043['exten'],'priority':_0x53d39e[_0x69b7('0x2c')]+_0x5bb928[_0x69b7('0x10')]+_0x5f1d0c++,'VoiceExtensionId':_0x509043['VoiceExtensionId']});_0x363a39[_0x69b7('0x1d')]({'type':_0x509043[_0x69b7('0x17')],'app':_0x69b7('0x14'),'appdata':_0x69b7('0x3c'),'context':_0x509043['context'],'exten':_0x509043[_0x69b7('0x9')],'priority':_0x53d39e['length']+_0x5bb928[_0x69b7('0x10')]+_0x5f1d0c++,'VoiceExtensionId':_0x509043[_0x69b7('0x19')]});}else{_0x363a39[_0x69b7('0x1d')]({'type':_0x509043['type'],'app':_0x69b7('0x22'),'appdata':_0x69b7('0x3d'),'context':_0x509043['context'],'exten':_0x509043[_0x69b7('0x9')],'priority':_0x53d39e[_0x69b7('0x2c')]+_0x5bb928['priority']+_0x5f1d0c++,'VoiceExtensionId':_0x509043[_0x69b7('0x19')]});_0x363a39[_0x69b7('0x1d')]({'type':_0x509043['type'],'app':'Set','appdata':_0x69b7('0x3e'),'context':_0x509043['context'],'exten':_0x509043[_0x69b7('0x9')],'priority':_0x53d39e['length']+_0x5bb928[_0x69b7('0x10')]+_0x5f1d0c++,'VoiceExtensionId':_0x509043[_0x69b7('0x19')]});}}}for(var _0x20464f=0x0;_0x20464f<_0x53d39e[_0x69b7('0x2c')];_0x20464f+=0x1){var _0x10de5=_0x5bb928[_0x69b7('0x10')]+_0x53d39e[_0x69b7('0x2c')];var _0x30af44=_0x20464f===_0x53d39e['length']-0x1?_0x5bb928[_0x69b7('0x10')]+_0x363a39[_0x69b7('0x2c')]+_0x154f89['length']+0x2:_0x5bb928[_0x69b7('0x10')]+_0x20464f+0x1;_0x363a39[_0x69b7('0x3f')](_0x20464f,0x0,{'type':_0x509043[_0x69b7('0x17')],'app':'GotoIfTime','appdata':_0x53d39e[_0x20464f]+'?'+_0x509043[_0x69b7('0x18')]+_0x69b7('0x40')+_0x10de5+':'+_0x509043['context']+_0x69b7('0x40')+_0x30af44,'exten':_0x509043[_0x69b7('0x9')],'context':_0x509043[_0x69b7('0x18')],'priority':_0x5bb928[_0x69b7('0x10')]+_0x20464f,'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0]['VoiceExtensionId']});}_0x509043[_0x69b7('0x10')]=_0x363a39['length']?_[_0x69b7('0x41')](_0x363a39)[_0x69b7('0x10')]+0x1:_0x5bb928['priority'];_0x5bb928['priority']=(_0x154f89[_0x69b7('0x2c')]?_[_0x69b7('0x41')](_0x154f89)['priority']:_0x509043[_0x69b7('0x10')])+0x1;_0x5bb928['extensions']=_['concat'](_0x5bb928[_0x69b7('0x11')],_0x363a39,[_0x509043],_0x154f89);}_0x5bb928[_0x69b7('0x11')]['push']({'type':_0x57e6bc[_0xdd1278][0x0]['type'],'app':_0x69b7('0x42'),'exten':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x9')],'context':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x18')],'priority':_0x5bb928[_0x69b7('0x10')],'VoiceExtensionId':_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')]});_0xce7120[_0x69b7('0x1d')](_0x57e6bc[_0xdd1278][0x0][_0x69b7('0x19')]);_0x214b91=_['concat'](_0x214b91,_0x5bb928['extensions']);}}return _0x307f0d[_0x69b7('0x43')](function(_0xfb6cf3){return _0x307f0d[_0x69b7('0x4')][_0x69b7('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0xce7120}},'transaction':_0xfb6cf3})['then'](function(_0x44c363){return _0x307f0d[_0x69b7('0x4')][_0x69b7('0x5')][_0x69b7('0x44')](_[_0x69b7('0x45')](_0x214b91,_0x69b7('0x10')),{'transaction':_0xfb6cf3});});});})[_0x69b7('0x46')](function(_0x13c608){console[_0x69b7('0x47')](_0x13c608);});}exports[_0x69b7('0x48')]=rewrite; \ No newline at end of file +var _0x9231=['filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','Set','format','type','VoiceExtensionId','inbound','push','CDR(routeid)=','context','CDR(destination)=','extension','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','VoiceExtension','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','then','intervals','map','exten','CAST(priority\x20AS\x20UNSIGNED)'];(function(_0x134248,_0x2946f6){var _0x3a4a05=function(_0x3b773e){while(--_0x3b773e){_0x134248['push'](_0x134248['shift']());}};_0x3a4a05(++_0x2946f6);}(_0x9231,0x195));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1923('0x0'));var util=require('util');function rewrite(_0x5c8789,_0x1522bb){var _0xd289d6=this;return _0x5c8789[_0x1923('0x1')][_0x1923('0x2')][_0x1923('0x3')]({'raw':!![]})[_0x1923('0x4')](function(_0x2cf8e5){_0xd289d6[_0x1923('0x5')]=_0x2cf8e5;return _0x5c8789[_0x1923('0x1')]['VoiceExtension'][_0x1923('0x3')]({'where':{'IntervalId':_0x1522bb['IntervalId']},'raw':!![]});})[_0x1923('0x4')](function(_0x56ea53){return _0x5c8789['models']['VoiceExtension'][_0x1923('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x1923('0x6')](_0x56ea53,_0x1923('0x7')))}},'order':[{'raw':_0x1923('0x8')}],'raw':!![]});})[_0x1923('0x4')](function(_0x1fa3a4){var _0x489d82=_['filter'](_0x1fa3a4,{'priority':'1'});var _0x37a370=_[_0x1923('0x9')](_0x1fa3a4,{'isApp':0x1});var _0x3fdb41=_[_0x1923('0xa')](_0x37a370,_0x1923('0x7'));var _0x47f245=[_0x1923('0xb'),_0x1923('0xc')];var _0xe42e23=[];var _0x60b578=[];for(var _0x39be7c in _0x3fdb41){if(_0x3fdb41[_0x1923('0xd')](_0x39be7c)){_0xd289d6[_0x1923('0xe')]=0x2;_0xd289d6[_0x1923('0xf')]=[];_0xd289d6['extension']=_['find'](_0x489d82,{'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')]});_0xd289d6['extensions']['push']({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':util[_0x1923('0x11')]('CDR(type)=%s',_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')]),'context':_0x3fdb41[_0x39be7c][0x0]['context'],'exten':_0x3fdb41[_0x39be7c][0x0]['exten'],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});if(_0x3fdb41[_0x39be7c][0x0]['type']===_0x1923('0x14')){_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':_0x1923('0x16')+_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId'],'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});}else if(_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')]==='outbound'){if(_0xd289d6['extension']){_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x18')+(_0xd289d6[_0x1923('0x19')][_0x1923('0x1a')]?'${EXTEN:'+_0xd289d6[_0x1923('0x19')][_0x1923('0x1a')]+'}':_0x1923('0x1b')),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});}_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':'Set','appdata':_0x1923('0x16')+_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId'],'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6['priority']++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});var _0x49834c=_0xd289d6[_0x1923('0xe')]++;_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x1c'),'appdata':_0x1923('0x1d')+(_0x49834c+0x2)+'):Goto('+(_0x49834c+0x1)+')','context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0x49834c,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});if(_0xd289d6[_0x1923('0x19')]){_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':_0xd289d6['extension'][_0x1923('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0xd289d6[_0x1923('0x19')][_0x1923('0x1a')]+'}':_0x1923('0x1e'),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});}_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':'outboundrouteid='+_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')],'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});if(_0xd289d6[_0x1923('0x19')]&&_0xd289d6[_0x1923('0x19')][_0x1923('0xd')]('recordingFormat')&&_0xd289d6[_0x1923('0x19')][_0x1923('0x1f')]!=='none'){_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});_0xd289d6['extensions'][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xd289d6['extension'][_0x1923('0x1f')]||_0x1923('0x20'),'context':_0x3fdb41[_0x39be7c][0x0]['context'],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});}}_0xd289d6['extensions']['push']({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x21'),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0]['exten'],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});_0xd289d6[_0x1923('0xf')]['push']({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x22'),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':'Set','appdata':_0x1923('0x23'),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});for(var _0x1842ec=0x0,_0x197538=0x0;_0x1842ec<_0x3fdb41[_0x39be7c][_0x1923('0x24')];_0x1842ec+=0x1,_0x197538=0x0){var _0x5a1d96=_0x3fdb41[_0x39be7c][_0x1842ec];if(_0x5a1d96['type']){_0x5a1d96[_0x1923('0x12')]=_0x5a1d96[_0x1923('0x12')][_0x1923('0x25')]();}var _0x15363e=[];var _0x20371f=[];delete _0x5a1d96['id'];delete _0x5a1d96['createdAt'];delete _0x5a1d96[_0x1923('0x26')];var _0x3ca541=_0x5a1d96['interval']!==_0x1923('0x27')?[_0x5a1d96[_0x1923('0x28')]]:_0x5a1d96['IntervalId']?_[_0x1923('0x6')](_['filter'](_0xd289d6['intervals'],{'IntervalId':_0x5a1d96['IntervalId']}),_0x1923('0x28')):[];if(_0x5a1d96[_0x1923('0xd')](_0x1923('0x29'))){if(_0x5a1d96[_0x1923('0x29')]&&_0x5a1d96['tag']!=='--'){_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x2a')+_0x5a1d96['tag'],'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96[_0x1923('0x7')],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96['VoiceExtensionId']});}}if(_0x5a1d96['type']==='outbound'&&_0x5a1d96[_0x1923('0xd')](_0x1923('0x2b'))){if(_0x5a1d96[_0x1923('0x2b')]){_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96['type'],'app':_0x1923('0x1c'),'appdata':_0x1923('0x2c')+_0x5a1d96[_0x1923('0x2b')]+')','context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96[_0x1923('0x7')],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6['priority']+_0x197538++,'VoiceExtensionId':_0x5a1d96[_0x1923('0x13')]});}else{_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96[_0x1923('0x12')],'app':'ExecIf','appdata':_0x1923('0x2d'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96['exten'],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96['VoiceExtensionId']});}}if(_0x5a1d96[_0x1923('0xd')](_0x1923('0x2e'))){if(_0x47f245[_0x1923('0x2f')](_0x5a1d96[_0x1923('0x30')][_0x1923('0x25')]())>=0x0&&_0x5a1d96[_0x1923('0x31')]!==_0x1923('0x32')){if(_0x5a1d96['answer']){_0x15363e['push']({'type':_0x5a1d96[_0x1923('0x12')],'app':'ExecIf','appdata':_0x1923('0x33'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96[_0x1923('0x7')],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96[_0x1923('0x13')]});_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x34'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96['exten'],'priority':_0x3ca541['length']+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96[_0x1923('0x13')]});}else{_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96['type'],'app':_0x1923('0x1c'),'appdata':_0x1923('0x35'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96[_0x1923('0x7')],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96[_0x1923('0x13')]});_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96[_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':_0x1923('0x36'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96['exten'],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96['VoiceExtensionId']});}}}for(var _0x512127=0x0;_0x512127<_0x3ca541[_0x1923('0x24')];_0x512127+=0x1){var _0x5fa95a=_0xd289d6['priority']+_0x3ca541['length'];var _0x582f87=_0x512127===_0x3ca541['length']-0x1?_0xd289d6['priority']+_0x15363e[_0x1923('0x24')]+_0x20371f[_0x1923('0x24')]+0x2:_0xd289d6['priority']+_0x512127+0x1;_0x15363e[_0x1923('0x37')](_0x512127,0x0,{'type':_0x5a1d96['type'],'app':_0x1923('0x38'),'appdata':_0x3ca541[_0x512127]+'?'+_0x5a1d96[_0x1923('0x17')]+',${EXTEN},'+_0x5fa95a+':'+_0x5a1d96[_0x1923('0x17')]+_0x1923('0x39')+_0x582f87,'exten':_0x5a1d96[_0x1923('0x7')],'context':_0x5a1d96[_0x1923('0x17')],'priority':_0xd289d6['priority']+_0x512127,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});}_0x5a1d96['priority']=_0x15363e[_0x1923('0x24')]?_[_0x1923('0x3a')](_0x15363e)[_0x1923('0xe')]+0x1:_0xd289d6[_0x1923('0xe')];_0xd289d6['priority']=(_0x20371f[_0x1923('0x24')]?_['last'](_0x20371f)[_0x1923('0xe')]:_0x5a1d96[_0x1923('0xe')])+0x1;_0xd289d6[_0x1923('0xf')]=_[_0x1923('0x3b')](_0xd289d6[_0x1923('0xf')],_0x15363e,[_0x5a1d96],_0x20371f);}_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x3c'),'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'priority':_0xd289d6[_0x1923('0xe')],'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});_0xe42e23[_0x1923('0x15')](_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]);_0x60b578=_['concat'](_0x60b578,_0xd289d6[_0x1923('0xf')]);}}return _0x5c8789[_0x1923('0x3d')](function(_0x1be5d4){return _0x5c8789[_0x1923('0x1')][_0x1923('0x3e')][_0x1923('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0xe42e23}},'transaction':_0x1be5d4})[_0x1923('0x4')](function(_0x36a516){return _0x5c8789['models'][_0x1923('0x3e')][_0x1923('0x40')](_[_0x1923('0x41')](_0x60b578,_0x1923('0xe')),{'transaction':_0x1be5d4});});});})[_0x1923('0x42')](function(_0x16f87c){console[_0x1923('0x43')](_0x16f87c);});}exports[_0x1923('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9035189..5f9b5e8 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 _0x2bc8=['CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','ioredis','../../../config/environment','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','join','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','phone','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','createdAt','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','id\x20IN\x20?','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','VoiceQueue','BlackLists','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','pause'];(function(_0x1d178f,_0x512e41){var _0x282b5d=function(_0x11d9bb){while(--_0x11d9bb){_0x1d178f['push'](_0x1d178f['shift']());}};_0x282b5d(++_0x512e41);}(_0x2bc8,0xd7));var _0x82bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc8[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x82bc('0x0'));var util=require('util');var _=require(_0x82bc('0x1'));var fs=require('fs');var squel=require(_0x82bc('0x2'));var Papa=require('papaparse');var Redis=require(_0x82bc('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x82bc('0x4'));var logger=require('../../../config/logger')(_0x82bc('0x5'));config[_0x82bc('0x6')]=_['defaults'](config[_0x82bc('0x6')],{'host':_0x82bc('0x7'),'port':0x18eb});var socket=require(_0x82bc('0x8'))(new Redis(config[_0x82bc('0x6')]));require(_0x82bc('0x9'))[_0x82bc('0xa')](socket);try{if(!process[_0x82bc('0xb')][0x2]||process[_0x82bc('0xb')][0x2]===_0x82bc('0xc')||process['argv'][0x2]===_0x82bc('0xd')){throw new Error(_0x82bc('0xe'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x82bc('0xb')][0x3]==='undefined'||process['argv'][0x3]===_0x82bc('0xd')||!process[_0x82bc('0xb')][0x4]||process[_0x82bc('0xb')][0x4]==='undefined'||process[_0x82bc('0xb')][0x4]==='null'){throw new Error(_0x82bc('0xf'));}var FIELDS=_[_0x82bc('0x10')](process[_0x82bc('0xb')][0x3][_0x82bc('0x11')](','),process[_0x82bc('0xb')][0x4][_0x82bc('0x11')](','));if(!process[_0x82bc('0xb')][0x5]||process[_0x82bc('0xb')][0x5]==='undefined'||process[_0x82bc('0xb')][0x5]===_0x82bc('0xd')){throw new Error(_0x82bc('0x12'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x82bc('0xb')][0x6]&&process[_0x82bc('0xb')][0x6]!==_0x82bc('0xc')&&process[_0x82bc('0xb')][0x6]!==_0x82bc('0xd')?process[_0x82bc('0xb')][0x6]:null;var DUPLICATES=process[_0x82bc('0xb')][0x7]&&process[_0x82bc('0xb')][0x7]!==_0x82bc('0xc')&&process[_0x82bc('0xb')][0x7]!=='null'?process[_0x82bc('0xb')][0x7]:null;if(!process[_0x82bc('0xb')][0x8]||process[_0x82bc('0xb')][0x8]==='undefined'||process[_0x82bc('0xb')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x3c0150){logger[_0x82bc('0x13')](_0x3c0150);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(_0x44e34c,_0x289641,_0xc5223b,_0x49fe08){var _0x41985f={'message':_0x289641};_0x41985f[_0x44e34c]=!![];if(_0xc5223b){_0x41985f[_0x82bc('0x14')]=_0xc5223b;}if(_0x49fe08){_0x41985f[_0x82bc('0x15')]=_0x49fe08;}return _0x41985f;}function isEmail(_0x297a02){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))*$/[_0x82bc('0x16')](_0x297a02);}function checkRow(_0xd10f67,_0x35c266,_0x341b84){return new BPromise(function(_0x3135f9,_0x4cddb8){if(_[_0x82bc('0x17')](_0xd10f67)){return _0x4cddb8(handleCheckRowError('error',_0x82bc('0x18'),null,_0x341b84));}if(_0xd10f67['errors']&&_0xd10f67['errors'][_0x82bc('0x19')]){var _0x16bc6a=_[_0x82bc('0x1a')](_0xd10f67['errors'],'message')[_0x82bc('0x1b')](';');return _0x4cddb8(handleCheckRowError('error',_0x16bc6a,null,_0x341b84));}var _0x372715={};for(var _0x58c6c5 in FIELDS){if(FIELDS['hasOwnProperty'](_0x58c6c5)&&FIELDS[_0x58c6c5]){_0x372715[_0x58c6c5]=_0xd10f67[_0x82bc('0x1c')][0x0][FIELDS[_0x58c6c5]]||_0xd10f67[_0x82bc('0x1c')][0x0]['\ufeff'+FIELDS[_0x58c6c5]];}}if(!_0x372715[_0x82bc('0x1d')]){return _0x4cddb8(handleCheckRowError(_0x82bc('0x13'),_0x82bc('0x1e'),null,_0x341b84));}if(!_0x372715['phone']){return _0x4cddb8(handleCheckRowError(_0x82bc('0x13'),'phone\x20not\x20specified!',null,_0x341b84));}if(_0x372715[_0x82bc('0x1f')]){var _0x3f00b5=moment(_0x372715[_0x82bc('0x1f')],_0x82bc('0x20'));if(!_0x3f00b5[_0x82bc('0x21')]()){return _0x4cddb8(handleCheckRowError('error',_0x82bc('0x22'),null,_0x341b84));}}if(_0x372715[_0x82bc('0x23')]){if(!isEmail(_0x372715[_0x82bc('0x23')])){return _0x4cddb8(handleCheckRowError(_0x82bc('0x13'),_0x82bc('0x24'),null,_0x341b84));}}_0x372715['ListId']=LISTID;_0x372715[_0x82bc('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x82bc('0x19')]&&_0x35c266){var _0x87ab73={};for(var _0x41c44c=0x0,_0x5d94f9=DUPLICATES['length'];_0x41c44c<_0x5d94f9;_0x41c44c+=0x1){_0x87ab73[DUPLICATES[_0x41c44c]]=_0x372715[DUPLICATES[_0x41c44c]];}var _0x31e4d8=_['find'](_0x35c266,_0x87ab73);if(_0x31e4d8){return _0x4cddb8(handleCheckRowError(_0x82bc('0x26'),'Duplicate\x20Contact',_0x31e4d8,_0x341b84));}}return db[_0x82bc('0x27')]['create'](_0x372715,{'raw':!![],'hooks':![],'fields':_[_0x82bc('0x28')](_0x372715)})[_0x82bc('0x29')](function(_0x4dff28){if(DUPLICATES&&DUPLICATES[_0x82bc('0x19')]&&_0x35c266){_0x35c266[_0x82bc('0x2a')](_[_0x82bc('0x2b')](_0x372715,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4dff28['id'];return _0x3135f9();})[_0x82bc('0x2c')](function(_0x335bd8){return _0x4cddb8(handleCheckRowError(_0x82bc('0x13'),_0x82bc('0x2d')+(_0x335bd8[_0x82bc('0x2e')]||JSON['stringify'](_0x335bd8)),null,_0x341b84));});});}function checkHopper(){function _0x17e079(){return function(_0x24eac0){logger[_0x82bc('0x13')](_0x82bc('0x2f'),_0x82bc('0x30'),util['inspect'](_0x24eac0,{'showHidden':![],'depth':null}));};}var _0x22f0f7=function(_0x1c950a,_0xe5d9fd){var _0x21d742=squel[_0x82bc('0x31')]()[_0x82bc('0x32')](_0x82bc('0x33'))[_0x82bc('0x34')](['phone',_0x82bc('0x35'),_0x82bc('0x36'),_0x82bc('0x37'),_0xe5d9fd,'createdAt',_0x82bc('0x38')],squel[_0x82bc('0x39')]()[_0x82bc('0x3a')](_0x82bc('0x3b'),_0x82bc('0x3b'))[_0x82bc('0x3a')](_0x82bc('0x3c'),_0x82bc('0x35'))['field']('id',_0x82bc('0x36'))['field'](LISTID[_0x82bc('0x3d')](),'ListId')[_0x82bc('0x3a')](_0x1c950a['id'][_0x82bc('0x3d')](),_0xe5d9fd)['field'](_0x82bc('0x3c'),'createdAt')[_0x82bc('0x3a')](_0x82bc('0x3c'),_0x82bc('0x38'))[_0x82bc('0x3e')](_0x82bc('0x3f'))[_0x82bc('0x40')](_0x82bc('0x41'))[_0x82bc('0x40')](_0x82bc('0x42'),LISTID['toString']())['where'](_0x82bc('0x43'))[_0x82bc('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x82bc('0x39')]()[_0x82bc('0x3a')]('phone')[_0x82bc('0x3e')](_0x82bc('0x33'))[_0x82bc('0x40')](_0xe5d9fd+_0x82bc('0x44'),_0x1c950a['id'][_0x82bc('0x3d')]())))['toString']();return _0x21d742;};var _0x41ed9b=function(_0x1d2a73,_0x1fc431){var _0x33d7be=squel[_0x82bc('0x31')]()[_0x82bc('0x32')](_0x82bc('0x33'))['fromQuery']([_0x82bc('0x3b'),_0x82bc('0x35'),_0x82bc('0x36'),_0x82bc('0x37'),_0x1fc431,_0x82bc('0x45'),_0x82bc('0x38')],squel[_0x82bc('0x39')]()[_0x82bc('0x3a')](_0x82bc('0x3b'),'phone')['field'](_0x82bc('0x3c'),'scheduledAt')[_0x82bc('0x3a')]('id','ContactId')[_0x82bc('0x3a')](LISTID['toString'](),_0x82bc('0x37'))[_0x82bc('0x3a')](_0x1d2a73['id'][_0x82bc('0x3d')](),_0x1fc431)['field']('NOW()','createdAt')[_0x82bc('0x3a')]('NOW()','updatedAt')[_0x82bc('0x3e')]('cm_contacts')[_0x82bc('0x40')](_0x82bc('0x41'))[_0x82bc('0x40')]('ListId\x20=\x20?',LISTID[_0x82bc('0x3d')]())[_0x82bc('0x40')]('id\x20IN\x20?',squel[_0x82bc('0x46')](hopperContacts))[_0x82bc('0x40')](_0x82bc('0x43'))[_0x82bc('0x40')](_0x82bc('0x47'),squel[_0x82bc('0x39')]()['field'](_0x82bc('0x48'))['from'](_0x82bc('0x49'))[_0x82bc('0x40')](_0x1fc431+_0x82bc('0x44'),_0x1d2a73['id'][_0x82bc('0x3d')]()))[_0x82bc('0x40')](_0x82bc('0x47'),squel[_0x82bc('0x39')]()['field'](_0x82bc('0x3b'))[_0x82bc('0x3e')](_0x82bc('0x33'))['where'](_0x1fc431+'\x20=\x20?',_0x1d2a73['id'][_0x82bc('0x3d')]())))[_0x82bc('0x3d')]();return _0x33d7be;};function _0xae6ba7(_0x13415f,_0x34d294){var _0x13e8e0=squel['insert']()[_0x82bc('0x32')](_0x82bc('0x33'))[_0x82bc('0x34')]([_0x82bc('0x3b'),_0x82bc('0x35'),_0x82bc('0x36'),_0x82bc('0x37'),_0x34d294,_0x82bc('0x45'),'updatedAt'],squel['select']()[_0x82bc('0x3a')](_0x82bc('0x3b'),_0x82bc('0x3b'))['field']('NOW()',_0x82bc('0x35'))[_0x82bc('0x3a')]('id',_0x82bc('0x36'))[_0x82bc('0x3a')](LISTID['toString'](),_0x82bc('0x37'))['field'](_0x13415f['id']['toString'](),_0x34d294)[_0x82bc('0x3a')](_0x82bc('0x3c'),_0x82bc('0x45'))[_0x82bc('0x3a')](_0x82bc('0x3c'),'updatedAt')[_0x82bc('0x3e')]('cm_contacts')[_0x82bc('0x40')](_0x82bc('0x41'))[_0x82bc('0x40')]('ListId\x20=\x20?',LISTID[_0x82bc('0x3d')]())[_0x82bc('0x40')](_0x82bc('0x4a'),squel[_0x82bc('0x46')](hopperContacts))[_0x82bc('0x40')](_0x82bc('0x43')))[_0x82bc('0x3d')]();return _0x13e8e0;}function _0x114efb(_0x406a1e,_0x4d54af){var _0x130fb1=squel[_0x82bc('0x31')]()[_0x82bc('0x32')]('cm_hopper_black')['fromQuery'](['phone',_0x82bc('0x36'),'ListId',_0x4d54af,'createdAt',_0x82bc('0x38')],squel[_0x82bc('0x39')]()[_0x82bc('0x3a')](_0x82bc('0x3b'),_0x82bc('0x3b'))[_0x82bc('0x3a')]('id','ContactId')[_0x82bc('0x3a')](LISTID['toString'](),_0x82bc('0x37'))['field'](_0x406a1e['id'][_0x82bc('0x3d')](),_0x4d54af)[_0x82bc('0x3a')](_0x82bc('0x3c'),'createdAt')['field'](_0x82bc('0x3c'),_0x82bc('0x38'))[_0x82bc('0x3e')](_0x82bc('0x3f'))[_0x82bc('0x40')](_0x82bc('0x41'))[_0x82bc('0x40')](_0x82bc('0x42'),LISTID[_0x82bc('0x3d')]())[_0x82bc('0x40')](_0x82bc('0x4a'),squel[_0x82bc('0x46')](hopperContacts))[_0x82bc('0x40')](_0x82bc('0x43')))['toString']();return _0x130fb1;}return db['VoiceQueue'][_0x82bc('0x4b')]({'where':{'type':_0x82bc('0x4c')},'attributes':['id',_0x82bc('0x4d')],'include':[{'model':db[_0x82bc('0x4e')],'as':_0x82bc('0x4f'),'where':{'id':LISTID}}]})[_0x82bc('0x29')](function(_0x401c4e){var _0x54790e=[];if(_0x401c4e){var _0x391d8e;for(var _0x18983f=0x0,_0x5e7307;_0x18983f<_0x401c4e[_0x82bc('0x19')];_0x18983f+=0x1){_0x5e7307=_0x401c4e[_0x18983f][_0x82bc('0x50')]({'plain':!![]});switch(_0x5e7307[_0x82bc('0x4d')]){case _0x82bc('0x51'):_0x54790e[_0x82bc('0x2a')](db['sequelize'][_0x82bc('0x52')](_0x41ed9b(_0x5e7307,_0x82bc('0x53')))[_0x82bc('0x29')](function(){})['catch'](_0x17e079()));break;case _0x82bc('0x54'):_0x54790e[_0x82bc('0x2a')](db['sequelize'][_0x82bc('0x52')](_0x22f0f7(_0x5e7307,_0x82bc('0x53')))[_0x82bc('0x29')](function(){})['catch'](_0x17e079()));break;default:_0x54790e[_0x82bc('0x2a')](db[_0x82bc('0x55')][_0x82bc('0x52')](_0xae6ba7(_0x5e7307,'VoiceQueueId'))[_0x82bc('0x29')](function(){})[_0x82bc('0x2c')](_0x17e079()));}}}return _0x54790e;})[_0x82bc('0x56')]()[_0x82bc('0x29')](function(){return db[_0x82bc('0x57')][_0x82bc('0x4b')]({'where':{'type':_0x82bc('0x4c')},'attributes':['id'],'include':[{'model':db[_0x82bc('0x4e')],'as':_0x82bc('0x58'),'where':{'id':LISTID}}]})[_0x82bc('0x29')](function(_0x4ace50){var _0x1aa478=[];if(_0x4ace50){var _0x31ed90;for(var _0x4fd539=0x0,_0x14b08b;_0x4fd539<_0x4ace50[_0x82bc('0x19')];_0x4fd539+=0x1){_0x14b08b=_0x4ace50[_0x4fd539][_0x82bc('0x50')]({'plain':!![]});_0x1aa478[_0x82bc('0x2a')](db[_0x82bc('0x55')][_0x82bc('0x52')](_0x114efb(_0x14b08b,_0x82bc('0x53')))[_0x82bc('0x29')](function(){})[_0x82bc('0x2c')](_0x17e079()));}}return _0x1aa478;})[_0x82bc('0x56')]();})['then'](function(){return db[_0x82bc('0x59')][_0x82bc('0x4b')]({'attributes':['id',_0x82bc('0x4d')],'include':[{'model':db['CmList'],'as':_0x82bc('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x37858f){var _0x56bf0c=[];if(_0x37858f){for(var _0x59a288=0x0,_0xeaef74;_0x59a288<_0x37858f[_0x82bc('0x19')];_0x59a288+=0x1){_0xeaef74=_0x37858f[_0x59a288][_0x82bc('0x50')]({'plain':!![]});switch(_0xeaef74[_0x82bc('0x4d')]){case _0x82bc('0x51'):_0x56bf0c[_0x82bc('0x2a')](db[_0x82bc('0x55')][_0x82bc('0x52')](_0x41ed9b(_0xeaef74,_0x82bc('0x5a')))['then'](function(){})[_0x82bc('0x2c')](_0x17e079()));break;case _0x82bc('0x54'):_0x56bf0c[_0x82bc('0x2a')](db['sequelize']['query'](_0x22f0f7(_0xeaef74,_0x82bc('0x5a')))['then'](function(){})[_0x82bc('0x2c')](_0x17e079()));break;default:_0x56bf0c[_0x82bc('0x2a')](db[_0x82bc('0x55')][_0x82bc('0x52')](_0xae6ba7(_0xeaef74,_0x82bc('0x5a')))[_0x82bc('0x29')](function(){})[_0x82bc('0x2c')](_0x17e079()));}}}return _0x56bf0c;})[_0x82bc('0x56')]();})[_0x82bc('0x29')](function(){return db[_0x82bc('0x59')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x82bc('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x6e4506){var _0x419257=[];if(_0x6e4506){for(var _0x295cb9=0x0,_0x3b578e;_0x295cb9<_0x6e4506[_0x82bc('0x19')];_0x295cb9+=0x1){_0x3b578e=_0x6e4506[_0x295cb9]['get']({'plain':!![]});_0x419257['push'](db[_0x82bc('0x55')][_0x82bc('0x52')](_0x114efb(_0x3b578e,_0x82bc('0x5a')))[_0x82bc('0x29')](function(){})['catch'](_0x17e079()));}}return _0x419257;})[_0x82bc('0x56')]();})['catch'](function(_0x47d94a){logger['error']('cmContact,\x20%s,\x20%s',_0x82bc('0x5b'),_0x47d94a[_0x82bc('0x2e')]);});}var processPromises=function(_0x4a266a){return BPromise[_0x82bc('0x56')](promises)[_0x82bc('0x29')](function(_0x1ee527){})[_0x82bc('0x2c')](function(_0x2b0be1){logger[_0x82bc('0x13')](_0x82bc('0x5c'),JSON[_0x82bc('0x5d')](_0x2b0be1));})[_0x82bc('0x5e')](function(){socket[_0x82bc('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4a266a){return _0x4a266a['resume']();}});};var endCsv=function(){return BPromise[_0x82bc('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x82bc('0x29')](function(){socket[_0x82bc('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x82bc('0x61')](FILEPATH);}catch(_0x119b5f){logger[_0x82bc('0x13')](_0x82bc('0x62'),JSON[_0x82bc('0x5d')](_0x119b5f));}finally{process[_0x82bc('0x63')](0x0);}});};process['on'](_0x82bc('0x64'),function(){logger[_0x82bc('0x65')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x82bc('0x60')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x82bc('0x11')](',');return db[_0x82bc('0x27')][_0x82bc('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x82bc('0x29')](function(_0x3b83b1){var _0x3e82ac=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3e82ac,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3cdeb5,_0x36b2fc){total+=0x1;var _0x1385a9=total;promises[_0x82bc('0x2a')](checkRow(_0x3cdeb5,_0x3b83b1,_0x1385a9)[_0x82bc('0x29')](function(){success+=0x1;})[_0x82bc('0x2c')](function(_0x21d174){if(_0x21d174['error']){errors+=0x1;delete _0x21d174['error'];}else if(_0x21d174[_0x82bc('0x26')]){duplicates+=0x1;delete _0x21d174[_0x82bc('0x26')];}rows[_0x82bc('0x2a')](_0x21d174);}));if(total%0xc8===0x0){_0x36b2fc[_0x82bc('0x66')]();return processPromises(_0x36b2fc);}},'complete':function(){return processPromises()[_0x82bc('0x29')](function(){logger[_0x82bc('0x65')](_0x82bc('0x67'));endCsv();});},'error':function(_0x23472c,_0x11b639){logger[_0x82bc('0x65')](_0x82bc('0x68'),JSON[_0x82bc('0x5d')](_0x23472c));endCsv();}});})[_0x82bc('0x2c')](function(_0x2a719f){logger[_0x82bc('0x13')](_0x82bc('0x69'),JSON[_0x82bc('0x5d')](_0x2a719f));});}main(); \ No newline at end of file +var _0x8164=['squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','keys','push','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','insert','into','cm_hopper','phone','scheduledAt','ContactId','updatedAt','select','field','NOW()','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','toString','fromQuery','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','get','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash'];(function(_0x235152,_0x2c9454){var _0x21d93c=function(_0x5e4860){while(--_0x5e4860){_0x235152['push'](_0x235152['shift']());}};_0x21d93c(++_0x2c9454);}(_0x8164,0x14a));var _0x4816=function(_0x46aebd,_0x488973){_0x46aebd=_0x46aebd-0x0;var _0x549577=_0x8164[_0x46aebd];return _0x549577;};'use strict';var BPromise=require(_0x4816('0x0'));var util=require(_0x4816('0x1'));var _=require(_0x4816('0x2'));var fs=require('fs');var squel=require(_0x4816('0x3'));var Papa=require(_0x4816('0x4'));var Redis=require(_0x4816('0x5'));var db=require(_0x4816('0x6'))['db'];var config=require(_0x4816('0x7'));var logger=require(_0x4816('0x8'))(_0x4816('0x9'));config[_0x4816('0xa')]=_['defaults'](config['redis'],{'host':_0x4816('0xb'),'port':0x18eb});var socket=require(_0x4816('0xc'))(new Redis(config[_0x4816('0xa')]));require(_0x4816('0xd'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x4816('0xe')][0x2]===_0x4816('0xf')||process[_0x4816('0xe')][0x2]==='null'){throw new Error(_0x4816('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x4816('0xe')][0x3]||process[_0x4816('0xe')][0x3]===_0x4816('0xf')||process[_0x4816('0xe')][0x3]==='null'||!process[_0x4816('0xe')][0x4]||process['argv'][0x4]===_0x4816('0xf')||process[_0x4816('0xe')][0x4]===_0x4816('0x11')){throw new Error(_0x4816('0x12'));}var FIELDS=_[_0x4816('0x13')](process[_0x4816('0xe')][0x3][_0x4816('0x14')](','),process[_0x4816('0xe')][0x4]['split'](','));if(!process[_0x4816('0xe')][0x5]||process[_0x4816('0xe')][0x5]===_0x4816('0xf')||process[_0x4816('0xe')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x4816('0xe')][0x6]&&process[_0x4816('0xe')][0x6]!==_0x4816('0xf')&&process[_0x4816('0xe')][0x6]!=='null'?process[_0x4816('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x4816('0xf')&&process['argv'][0x7]!==_0x4816('0x11')?process[_0x4816('0xe')][0x7]:null;if(!process[_0x4816('0xe')][0x8]||process['argv'][0x8]===_0x4816('0xf')||process['argv'][0x8]===_0x4816('0x11')){throw new Error(_0x4816('0x15'));}var SOCKET_TIMESTAMP=process[_0x4816('0xe')][0x8];}catch(_0x2e3062){logger['error'](_0x2e3062);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2e7d8f,_0x20b2b1,_0x2a1118,_0x23e06c){var _0x5c5e05={'message':_0x20b2b1};_0x5c5e05[_0x2e7d8f]=!![];if(_0x2a1118){_0x5c5e05[_0x4816('0x16')]=_0x2a1118;}if(_0x23e06c){_0x5c5e05[_0x4816('0x17')]=_0x23e06c;}return _0x5c5e05;}function isEmail(_0x1fe2de){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x4816('0x18')](_0x1fe2de);}function checkRow(_0x523d69,_0x338415,_0x5db8e5){return new BPromise(function(_0x37fa37,_0x247a19){if(_['isNil'](_0x523d69)){return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x4816('0x1a'),null,_0x5db8e5));}if(_0x523d69[_0x4816('0x1b')]&&_0x523d69[_0x4816('0x1b')]['length']){var _0x3f60b1=_[_0x4816('0x1c')](_0x523d69[_0x4816('0x1b')],_0x4816('0x1d'))[_0x4816('0x1e')](';');return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x3f60b1,null,_0x5db8e5));}var _0x25a4b4={};for(var _0x31973a in FIELDS){if(FIELDS[_0x4816('0x1f')](_0x31973a)&&FIELDS[_0x31973a]){_0x25a4b4[_0x31973a]=_0x523d69['data'][0x0][FIELDS[_0x31973a]]||_0x523d69[_0x4816('0x20')][0x0]['\ufeff'+FIELDS[_0x31973a]];}}if(!_0x25a4b4['firstName']){return _0x247a19(handleCheckRowError('error',_0x4816('0x21'),null,_0x5db8e5));}if(!_0x25a4b4['phone']){return _0x247a19(handleCheckRowError(_0x4816('0x19'),'phone\x20not\x20specified!',null,_0x5db8e5));}if(_0x25a4b4[_0x4816('0x22')]){var _0x236e7c=moment(_0x25a4b4[_0x4816('0x22')],_0x4816('0x23'));if(!_0x236e7c[_0x4816('0x24')]()){return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x4816('0x25'),null,_0x5db8e5));}}if(_0x25a4b4[_0x4816('0x26')]){if(!isEmail(_0x25a4b4[_0x4816('0x26')])){return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x4816('0x27'),null,_0x5db8e5));}}_0x25a4b4[_0x4816('0x28')]=LISTID;_0x25a4b4[_0x4816('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x338415){var _0x44c34d={};for(var _0x5ab71f=0x0,_0x3c5e5a=DUPLICATES[_0x4816('0x2a')];_0x5ab71f<_0x3c5e5a;_0x5ab71f+=0x1){_0x44c34d[DUPLICATES[_0x5ab71f]]=_0x25a4b4[DUPLICATES[_0x5ab71f]];}var _0x454f8a=_[_0x4816('0x2b')](_0x338415,_0x44c34d);if(_0x454f8a){return _0x247a19(handleCheckRowError(_0x4816('0x2c'),_0x4816('0x2d'),_0x454f8a,_0x5db8e5));}}return db[_0x4816('0x2e')]['create'](_0x25a4b4,{'raw':!![],'hooks':![],'fields':_[_0x4816('0x2f')](_0x25a4b4)})['then'](function(_0x1ad97a){if(DUPLICATES&&DUPLICATES[_0x4816('0x2a')]&&_0x338415){_0x338415[_0x4816('0x30')](_['pick'](_0x25a4b4,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1ad97a['id'];return _0x37fa37();})[_0x4816('0x31')](function(_0x38202d){return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x4816('0x32')+(_0x38202d[_0x4816('0x1d')]||JSON['stringify'](_0x38202d)),null,_0x5db8e5));});});}function checkHopper(){function _0x2a3669(){return function(_0x36233d){logger['error'](_0x4816('0x33'),_0x4816('0x34'),util['inspect'](_0x36233d,{'showHidden':![],'depth':null}));};}var _0x26f4bc=function(_0x10056f,_0x2573fc){var _0x1a3f64=squel[_0x4816('0x35')]()[_0x4816('0x36')](_0x4816('0x37'))['fromQuery']([_0x4816('0x38'),_0x4816('0x39'),_0x4816('0x3a'),'ListId',_0x2573fc,'createdAt',_0x4816('0x3b')],squel[_0x4816('0x3c')]()[_0x4816('0x3d')](_0x4816('0x38'),_0x4816('0x38'))['field'](_0x4816('0x3e'),_0x4816('0x39'))[_0x4816('0x3d')]('id',_0x4816('0x3a'))['field'](LISTID['toString'](),_0x4816('0x28'))['field'](_0x10056f['id']['toString'](),_0x2573fc)[_0x4816('0x3d')]('NOW()',_0x4816('0x3f'))[_0x4816('0x3d')]('NOW()',_0x4816('0x3b'))[_0x4816('0x40')](_0x4816('0x41'))[_0x4816('0x42')](_0x4816('0x43'))[_0x4816('0x42')]('ListId\x20=\x20?',LISTID['toString']())[_0x4816('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x4816('0x42')](_0x4816('0x44'),squel['select']()[_0x4816('0x3d')](_0x4816('0x38'))[_0x4816('0x40')](_0x4816('0x37'))[_0x4816('0x42')](_0x2573fc+'\x20=\x20?',_0x10056f['id'][_0x4816('0x45')]())))[_0x4816('0x45')]();return _0x1a3f64;};var _0xe9839d=function(_0x2166a8,_0x228b17){var _0x24de5c=squel[_0x4816('0x35')]()[_0x4816('0x36')](_0x4816('0x37'))[_0x4816('0x46')](['phone',_0x4816('0x39'),'ContactId','ListId',_0x228b17,_0x4816('0x3f'),_0x4816('0x3b')],squel['select']()[_0x4816('0x3d')](_0x4816('0x38'),_0x4816('0x38'))['field'](_0x4816('0x3e'),_0x4816('0x39'))[_0x4816('0x3d')]('id',_0x4816('0x3a'))[_0x4816('0x3d')](LISTID[_0x4816('0x45')](),'ListId')[_0x4816('0x3d')](_0x2166a8['id'][_0x4816('0x45')](),_0x228b17)['field'](_0x4816('0x3e'),_0x4816('0x3f'))['field'](_0x4816('0x3e'),_0x4816('0x3b'))[_0x4816('0x40')]('cm_contacts')[_0x4816('0x42')](_0x4816('0x43'))['where'](_0x4816('0x47'),LISTID[_0x4816('0x45')]())[_0x4816('0x42')](_0x4816('0x48'),squel[_0x4816('0x49')](hopperContacts))['where'](_0x4816('0x4a'))['where'](_0x4816('0x44'),squel[_0x4816('0x3c')]()[_0x4816('0x3d')](_0x4816('0x4b'))[_0x4816('0x40')](_0x4816('0x4c'))['where'](_0x228b17+_0x4816('0x4d'),_0x2166a8['id'][_0x4816('0x45')]()))[_0x4816('0x42')](_0x4816('0x44'),squel[_0x4816('0x3c')]()['field'](_0x4816('0x38'))[_0x4816('0x40')](_0x4816('0x37'))['where'](_0x228b17+_0x4816('0x4d'),_0x2166a8['id']['toString']())))['toString']();return _0x24de5c;};function _0x7f6716(_0x11b092,_0x2fa180){var _0x2fc050=squel[_0x4816('0x35')]()[_0x4816('0x36')](_0x4816('0x37'))[_0x4816('0x46')]([_0x4816('0x38'),'scheduledAt',_0x4816('0x3a'),_0x4816('0x28'),_0x2fa180,_0x4816('0x3f'),'updatedAt'],squel[_0x4816('0x3c')]()[_0x4816('0x3d')](_0x4816('0x38'),_0x4816('0x38'))[_0x4816('0x3d')](_0x4816('0x3e'),'scheduledAt')[_0x4816('0x3d')]('id','ContactId')['field'](LISTID[_0x4816('0x45')](),'ListId')['field'](_0x11b092['id'][_0x4816('0x45')](),_0x2fa180)[_0x4816('0x3d')](_0x4816('0x3e'),_0x4816('0x3f'))[_0x4816('0x3d')](_0x4816('0x3e'),'updatedAt')[_0x4816('0x40')](_0x4816('0x41'))[_0x4816('0x42')](_0x4816('0x43'))[_0x4816('0x42')](_0x4816('0x47'),LISTID[_0x4816('0x45')]())[_0x4816('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x4816('0x42')](_0x4816('0x4a')))[_0x4816('0x45')]();return _0x2fc050;}function _0x5e00f2(_0x615905,_0x3eb8f7){var _0x2567f6=squel[_0x4816('0x35')]()[_0x4816('0x36')](_0x4816('0x4e'))[_0x4816('0x46')]([_0x4816('0x38'),'ContactId',_0x4816('0x28'),_0x3eb8f7,_0x4816('0x3f'),_0x4816('0x3b')],squel['select']()[_0x4816('0x3d')]('phone',_0x4816('0x38'))[_0x4816('0x3d')]('id','ContactId')[_0x4816('0x3d')](LISTID['toString'](),_0x4816('0x28'))[_0x4816('0x3d')](_0x615905['id'][_0x4816('0x45')](),_0x3eb8f7)[_0x4816('0x3d')](_0x4816('0x3e'),_0x4816('0x3f'))[_0x4816('0x3d')]('NOW()',_0x4816('0x3b'))[_0x4816('0x40')](_0x4816('0x41'))[_0x4816('0x42')](_0x4816('0x43'))[_0x4816('0x42')](_0x4816('0x47'),LISTID[_0x4816('0x45')]())[_0x4816('0x42')]('id\x20IN\x20?',squel[_0x4816('0x49')](hopperContacts))[_0x4816('0x42')](_0x4816('0x4a')))[_0x4816('0x45')]();return _0x2567f6;}return db[_0x4816('0x4f')][_0x4816('0x50')]({'where':{'type':_0x4816('0x51')},'attributes':['id',_0x4816('0x52')],'include':[{'model':db[_0x4816('0x53')],'as':_0x4816('0x54'),'where':{'id':LISTID}}]})[_0x4816('0x55')](function(_0x258c43){var _0x38e02b=[];if(_0x258c43){var _0x393788;for(var _0x503a20=0x0,_0x2b89a4;_0x503a20<_0x258c43[_0x4816('0x2a')];_0x503a20+=0x1){_0x2b89a4=_0x258c43[_0x503a20]['get']({'plain':!![]});switch(_0x2b89a4['dialCheckDuplicateType']){case _0x4816('0x56'):_0x38e02b[_0x4816('0x30')](db[_0x4816('0x57')][_0x4816('0x58')](_0xe9839d(_0x2b89a4,_0x4816('0x59')))[_0x4816('0x55')](function(){})['catch'](_0x2a3669()));break;case _0x4816('0x5a'):_0x38e02b['push'](db[_0x4816('0x57')][_0x4816('0x58')](_0x26f4bc(_0x2b89a4,_0x4816('0x59')))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));break;default:_0x38e02b[_0x4816('0x30')](db['sequelize'][_0x4816('0x58')](_0x7f6716(_0x2b89a4,'VoiceQueueId'))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));}}}return _0x38e02b;})[_0x4816('0x5b')]()[_0x4816('0x55')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x4816('0x53')],'as':_0x4816('0x5c'),'where':{'id':LISTID}}]})[_0x4816('0x55')](function(_0x485a17){var _0xf5343a=[];if(_0x485a17){var _0x226796;for(var _0x467160=0x0,_0x554a2f;_0x467160<_0x485a17['length'];_0x467160+=0x1){_0x554a2f=_0x485a17[_0x467160][_0x4816('0x5d')]({'plain':!![]});_0xf5343a['push'](db[_0x4816('0x57')][_0x4816('0x58')](_0x5e00f2(_0x554a2f,_0x4816('0x59')))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));}}return _0xf5343a;})[_0x4816('0x5b')]();})[_0x4816('0x55')](function(){return db[_0x4816('0x5e')][_0x4816('0x50')]({'attributes':['id',_0x4816('0x52')],'include':[{'model':db['CmList'],'as':_0x4816('0x54'),'where':{'id':LISTID}}]})[_0x4816('0x55')](function(_0xcaaebd){var _0x55ed8c=[];if(_0xcaaebd){for(var _0x406261=0x0,_0xe1e404;_0x406261<_0xcaaebd[_0x4816('0x2a')];_0x406261+=0x1){_0xe1e404=_0xcaaebd[_0x406261][_0x4816('0x5d')]({'plain':!![]});switch(_0xe1e404['dialCheckDuplicateType']){case'always':_0x55ed8c['push'](db[_0x4816('0x57')][_0x4816('0x58')](_0xe9839d(_0xe1e404,'CampaignId'))['then'](function(){})[_0x4816('0x31')](_0x2a3669()));break;case _0x4816('0x5a'):_0x55ed8c[_0x4816('0x30')](db['sequelize'][_0x4816('0x58')](_0x26f4bc(_0xe1e404,_0x4816('0x5f')))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));break;default:_0x55ed8c['push'](db['sequelize']['query'](_0x7f6716(_0xe1e404,_0x4816('0x5f')))[_0x4816('0x55')](function(){})['catch'](_0x2a3669()));}}}return _0x55ed8c;})[_0x4816('0x5b')]();})[_0x4816('0x55')](function(){return db[_0x4816('0x5e')][_0x4816('0x50')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x14ae85){var _0x5a1c80=[];if(_0x14ae85){for(var _0x6a6a04=0x0,_0x434a64;_0x6a6a04<_0x14ae85[_0x4816('0x2a')];_0x6a6a04+=0x1){_0x434a64=_0x14ae85[_0x6a6a04][_0x4816('0x5d')]({'plain':!![]});_0x5a1c80['push'](db[_0x4816('0x57')][_0x4816('0x58')](_0x5e00f2(_0x434a64,'CampaignId'))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));}}return _0x5a1c80;})['all']();})[_0x4816('0x31')](function(_0x355c72){logger['error']('cmContact,\x20%s,\x20%s',_0x4816('0x60'),_0x355c72['message']);});}var processPromises=function(_0x3cf681){return BPromise[_0x4816('0x5b')](promises)[_0x4816('0x55')](function(_0xf004c4){})[_0x4816('0x31')](function(_0x10b977){logger[_0x4816('0x19')](_0x4816('0x61'),JSON[_0x4816('0x62')](_0x10b977));})[_0x4816('0x63')](function(){socket['emit'](_0x4816('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3cf681){return _0x3cf681['resume']();}});};var endCsv=function(){return BPromise[_0x4816('0x65')]()[_0x4816('0x55')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4816('0x66')](FILEPATH);}catch(_0x2e6ec4){logger[_0x4816('0x19')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x4816('0x62')](_0x2e6ec4));}finally{process[_0x4816('0x67')](0x0);}});};process['on'](_0x4816('0x68'),function(){logger[_0x4816('0x69')](_0x4816('0x6a'));endCsv();});function main(){return BPromise[_0x4816('0x65')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4816('0x14')](',');return db[_0x4816('0x2e')][_0x4816('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4816('0x55')](function(_0x2063fb){var _0x4bc15e=fs[_0x4816('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x4bc15e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2997b9,_0x1264d2){total+=0x1;var _0x2453f5=total;promises[_0x4816('0x30')](checkRow(_0x2997b9,_0x2063fb,_0x2453f5)[_0x4816('0x55')](function(){success+=0x1;})[_0x4816('0x31')](function(_0x49599b){if(_0x49599b[_0x4816('0x19')]){errors+=0x1;delete _0x49599b[_0x4816('0x19')];}else if(_0x49599b[_0x4816('0x2c')]){duplicates+=0x1;delete _0x49599b[_0x4816('0x2c')];}rows[_0x4816('0x30')](_0x49599b);}));if(total%0xc8===0x0){_0x1264d2[_0x4816('0x6c')]();return processPromises(_0x1264d2);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x4816('0x6d'));endCsv();});},'error':function(_0x368f8c,_0x2c1eba){logger[_0x4816('0x69')](_0x4816('0x6e'),JSON[_0x4816('0x62')](_0x368f8c));endCsv();}});})['catch'](function(_0x2b6d33){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x4816('0x62')](_0x2b6d33));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index c727826..248c3a5 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 _0x1c09=['offset','dialTimezone','main','send','start','binding','clone','socket_timestamp','server/files/tmp','ContactItemType','name','_description','header','writeFileSync','parse','data','rows','find','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','\x20not\x20specified','trim','itemTypeId','SystemRow','emit','contact:import:','SystemError','step','duplicates','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns_has_cm_lists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','all','split','push','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','from','.CmListId\x20=\x20?','recallme','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','code','query','spread','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','catch','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','isNil','set'];(function(_0x3cb004,_0x25d5d1){var _0x343ec2=function(_0xb9ac0e){while(--_0xb9ac0e){_0x3cb004['push'](_0x3cb004['shift']());}};_0x343ec2(++_0x25d5d1);}(_0x1c09,0x101));var _0x91c0=function(_0x1e0146,_0xe7f3e9){_0x1e0146=_0x1e0146-0x0;var _0x38338d=_0x1c09[_0x1e0146];return _0x38338d;};'use strict';var fs=require('fs');var path=require(_0x91c0('0x0'));var _=require('lodash');var Papa=require(_0x91c0('0x1'));var util=require(_0x91c0('0x2'));var BPromise=require(_0x91c0('0x3'));var moment=require(_0x91c0('0x4'));var squel=require(_0x91c0('0x5'));var Redis=require(_0x91c0('0x6'));var db=require(_0x91c0('0x7'))['db'];var config=require(_0x91c0('0x8'));var shared=require(_0x91c0('0x9'));var logger=require('../../../config/logger')(_0x91c0('0xa'));config[_0x91c0('0xb')]=_[_0x91c0('0xc')](config['redis'],{'host':_0x91c0('0xd'),'port':0x18eb});var socket=require(_0x91c0('0xe'))(new Redis(config[_0x91c0('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x91c0('0xf')](_0x91c0('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x58463d){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'](_0x58463d);}function selectNotIn(_0x147553,_0x285ee2,_0x156c6a,_0xb60f92,_0x11b9e3){return squel['select']()[_0x91c0('0x11')](_0x91c0('0x12'))['from'](_0xb60f92)[_0x91c0('0x13')](_0x285ee2,null,_0x285ee2+_0x91c0('0x14')+_0xb60f92+'.'+_0x156c6a)[_0x91c0('0x15')](_0xb60f92+'.'+_0x156c6a+_0x91c0('0x16')+_0x147553+'.'+_0x156c6a)[_0x91c0('0x15')](_0x285ee2+_0x91c0('0x17')+_0x11b9e3[_0x91c0('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x28cc4e,_0x3e0ccd){promisesAdditionalPhones=[];return db['CmContact'][_0x91c0('0x18')]({'raw':!![],'attributes':['id',_0x91c0('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x91c0('0x1a')](function(_0x178416){if(_0x178416!==null){var _0x385080=[];for(var _0x40fd17=0x0;_0x40fd17<_0x178416[_0x91c0('0x1b')];_0x40fd17++){var _0x559a89=_0x178416[_0x40fd17];_0x385080['push'](insertAdditionalPhones(_0x559a89));}}Promise[_0x91c0('0x1c')](_0x385080)[_0x91c0('0x1a')](function(){_0x28cc4e({'val':0x1});});});});}function insertAdditionalPhones(_0x2b98a2){return new Promise(function(_0x1df7e7,_0x5f590b){var _0x152138=_0x2b98a2[_0x91c0('0x19')];var _0x2c41a2=_0x152138[_0x91c0('0x1d')](';');var _0x1583a7=[];orderBy=0x0;for(var _0x25111c=0x0;_0x25111c<_0x2c41a2[_0x91c0('0x1b')];_0x25111c++){_0x1583a7[_0x91c0('0x1e')](splitAdditionalPhone(_0x2b98a2['id'],_0x2c41a2[_0x25111c]));}Promise[_0x91c0('0x1c')](_0x1583a7)[_0x91c0('0x1a')](function(){_0x1df7e7({'val':_0x2c41a2[_0x91c0('0x1b')]});});});}function splitAdditionalPhone(_0x44caa8,_0x578e3f){return new Promise(function(_0xd07f8d,_0x1ca4d0){var _0x597c79=_0x578e3f['split'](':');var _0x4c0a15=_0x597c79[0x0];var _0x4cc1f3=_0x597c79[0x1];if(!_['isNil'](_0x4cc1f3)){var _0x26173f=_0x4cc1f3[_0x91c0('0x1d')]('|');var _0x314a85=[];for(var _0x195b7a=0x0;_0x195b7a<_0x26173f[_0x91c0('0x1b')];_0x195b7a++){if(_0x26173f[_0x195b7a]!==''){var _0x4e3430=_[_0x91c0('0x1f')](promisesAdditionalPhones,{'contactId':_0x44caa8,'phone':_0x26173f[_0x195b7a]});if(_0x4e3430[_0x91c0('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x91c0('0x1e')]({'contactId':_0x44caa8,'contactTypeId':_0x4c0a15,'phone':_0x26173f[_0x195b7a],'orderBy':orderBy});}}}_0xd07f8d({'ok':0x1});}else _0xd07f8d({'res':0x0});});}function createAdditionalPhone(_0x2e770d,_0x2a2662,_0x4b1ef7,_0x140bbe){var _0x3c3ddb='';var _0x3b7337='';var _0x136ea1=_0x4b1ef7[_0x91c0('0x1d')]('§');_0x3c3ddb=_0x136ea1[0x0];if(_0x136ea1[_0x91c0('0x1b')]==0x2)_0x3b7337=_0x136ea1[0x1];return new Promise(function(_0x2f95f3,_0x2defcc){return db[_0x91c0('0x20')][_0x91c0('0x21')]({'where':{'CmContactId':_0x2e770d,'item':_0x3c3ddb}})[_0x91c0('0x1a')](function(_0x36fbce){if(_0x36fbce){return db[_0x91c0('0x20')][_0x91c0('0x22')]({'ItemTypeId':_0x2a2662,'description':_0x3b7337,'OrderBy':_0x140bbe},{'where':{'CmContactId':_0x2e770d,'item':_0x3c3ddb}})[_0x91c0('0x1a')](function(_0x147292){_0x2f95f3({'res':'updated'});});}else{return db[_0x91c0('0x20')][_0x91c0('0x23')]({'CmContactId':_0x2e770d,'item':_0x3c3ddb,'description':_0x3b7337,'ItemTypeId':_0x2a2662,'OrderBy':_0x140bbe,'ItemClass':_0x91c0('0x24')})[_0x91c0('0x1a')](function(_0x52bc2f){_0x2f95f3({'res':_0x91c0('0x25')});});}});});}function insertCmHopper(_0x2ee8a2,_0xb28636,_0x12318f,_0x3af055,_0x396357){var _0x58f00e=['cm_contacts.phone','cm_contacts.scheduledat',_0x91c0('0x26'),_0x91c0('0x27'),_0xb28636+'.'+_0x3af055,_0x91c0('0x28'),_0x91c0('0x29'),'cm_contacts.priority',_0x91c0('0x2a'),'\x22'+_0x396357+'\x22'];return squel[_0x91c0('0x2b')]()[_0x91c0('0x2c')](_0x91c0('0x2d'))[_0x91c0('0x2e')](['phone',_0x91c0('0x2f'),_0x91c0('0x30'),_0x91c0('0x31'),_0x3af055,_0x91c0('0x32'),_0x91c0('0x33'),_0x91c0('0x34'),_0x91c0('0x35'),'recallme'],squel[_0x91c0('0x36')]()[_0x91c0('0x37')](_0x58f00e)['from'](_0xb28636)[_0x91c0('0x13')](_0x91c0('0x38'),null,_0x91c0('0x39')+_0xb28636+_0x91c0('0x3a'))[_0x91c0('0x13')](_0x12318f,null,_0x12318f+'.id\x20=\x20'+_0xb28636+'.'+_0x3af055)['where'](_0xb28636+'.CmListId\x20=\x20?',_0x2ee8a2)[_0x91c0('0x15')](_0x91c0('0x3b'),NOW)[_0x91c0('0x15')](_0x91c0('0x3c'),selectNotIn(_0xb28636,_0x12318f,_0x3af055,_0x91c0('0x2d'),[_0x91c0('0x3d'),_0x91c0('0x3e')]))[_0x91c0('0x15')](_0x91c0('0x3c'),selectNotIn(_0xb28636,_0x12318f,_0x3af055,_0x91c0('0x2d'),[_0x91c0('0x3d')])))[_0x91c0('0x3f')]();}function insertCmHopperBlack(_0x2e24b6,_0x28b8d9,_0x1a903c,_0x2830c4){var _0x5081d8=[_0x91c0('0x40'),_0x91c0('0x26'),_0x91c0('0x27'),_0x28b8d9+'.'+_0x2830c4,_0x91c0('0x28'),_0x91c0('0x29')];return squel[_0x91c0('0x2b')]()[_0x91c0('0x2c')]('cm_hopper_black')[_0x91c0('0x2e')]([_0x91c0('0x12'),_0x91c0('0x30'),_0x91c0('0x31'),_0x2830c4,_0x91c0('0x32'),_0x91c0('0x33')],squel[_0x91c0('0x36')]()['fields'](_0x5081d8)[_0x91c0('0x41')](_0x28b8d9)[_0x91c0('0x13')](_0x91c0('0x38'),null,_0x91c0('0x39')+_0x28b8d9+'.CmListId')['join'](_0x1a903c,null,_0x1a903c+_0x91c0('0x14')+_0x28b8d9+'.'+_0x2830c4)[_0x91c0('0x15')](_0x28b8d9+_0x91c0('0x42'),_0x2e24b6)[_0x91c0('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x91c0('0x3c'),squel['select']()['field'](_0x91c0('0x12'))[_0x91c0('0x41')]('cm_hopper_black')[_0x91c0('0x15')]('ListId\x20=\x20?',_0x2e24b6)[_0x91c0('0x15')](_0x2830c4+_0x91c0('0x16')+_0x28b8d9+'.'+_0x2830c4)))['toString']();}function insertTzCmHopper(_0x258de0,_0x32ebe1,_0x50b6f2,_0x1bbeb9,_0x1d2c7d,_0x2e5b84){var _0x56118e=[_0x91c0('0x40'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x2e5b84+'.offset-cm_contacts.utcOffset\x20minute)',_0x91c0('0x26'),_0x91c0('0x27'),_0x32ebe1+'.'+_0x1bbeb9,_0x91c0('0x28'),_0x91c0('0x29'),'cm_contacts.priority',_0x91c0('0x2a'),'\x22'+_0x1d2c7d+'\x22'];var _0x5ff5ad=squel['insert']()[_0x91c0('0x2c')](_0x91c0('0x2d'))[_0x91c0('0x2e')]([_0x91c0('0x12'),_0x91c0('0x2f'),_0x91c0('0x30'),'ListId',_0x1bbeb9,'createdAt',_0x91c0('0x33'),'priority',_0x91c0('0x35'),_0x91c0('0x43')],squel[_0x91c0('0x36')]()['fields'](_0x56118e)[_0x91c0('0x41')](_0x32ebe1)[_0x91c0('0x13')](_0x91c0('0x38'),null,_0x91c0('0x39')+_0x32ebe1+'.CmListId')[_0x91c0('0x13')](_0x50b6f2,null,_0x50b6f2+_0x91c0('0x14')+_0x32ebe1+'.'+_0x1bbeb9)[_0x91c0('0x13')](_0x2e5b84,null,_0x2e5b84+_0x91c0('0x14')+_0x32ebe1+'.'+_0x1bbeb9)[_0x91c0('0x15')](_0x32ebe1+_0x91c0('0x42'),_0x258de0)[_0x91c0('0x15')](_0x91c0('0x3b'),NOW)[_0x91c0('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x32ebe1,_0x50b6f2,_0x1bbeb9,_0x91c0('0x2d'),[_0x91c0('0x3d'),_0x91c0('0x3e')]))[_0x91c0('0x15')](_0x91c0('0x3c'),selectNotIn(_0x32ebe1,_0x50b6f2,_0x1bbeb9,_0x91c0('0x2d'),[_0x91c0('0x3d')])))[_0x91c0('0x3f')]();return _0x5ff5ad;}function insertTzCmHopperBlack(_0x26d641,_0x54f0c4,_0x21ab4d,_0x57582d){var _0x292408=['cm_contacts.phone','cm_contacts.id',_0x91c0('0x27'),_0x54f0c4+'.'+_0x57582d,_0x91c0('0x28'),_0x91c0('0x29')];return squel[_0x91c0('0x2b')]()[_0x91c0('0x2c')](_0x91c0('0x44'))[_0x91c0('0x2e')]([_0x91c0('0x12'),'ContactId',_0x91c0('0x31'),_0x57582d,_0x91c0('0x32'),'updatedAt'],squel['select']()['fields'](_0x292408)['from'](_0x54f0c4)[_0x91c0('0x13')](_0x91c0('0x38'),null,_0x91c0('0x39')+_0x54f0c4+'.CmListId')[_0x91c0('0x13')](_0x21ab4d,null,_0x21ab4d+'.id\x20=\x20'+_0x54f0c4+'.'+_0x57582d)[_0x91c0('0x15')](_0x54f0c4+_0x91c0('0x42'),_0x26d641)[_0x91c0('0x15')](_0x91c0('0x3b'),NOW)[_0x91c0('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x91c0('0x36')]()[_0x91c0('0x11')](_0x91c0('0x12'))[_0x91c0('0x41')](_0x91c0('0x44'))[_0x91c0('0x15')](_0x91c0('0x45'),_0x26d641)[_0x91c0('0x15')](_0x57582d+_0x91c0('0x16')+_0x54f0c4+'.'+_0x57582d)))[_0x91c0('0x3f')]();}function insertCmHopperAdditionalPhones(_0x3acb1f){var _0x501c9b=[_0x91c0('0x46'),_0x91c0('0x47'),_0x91c0('0x48'),_0x91c0('0x49'),'cm_contact_has_items.updatedAt'];return squel[_0x91c0('0x2b')]()[_0x91c0('0x2c')](_0x91c0('0x4a'))[_0x91c0('0x2e')](['CmHopperId',_0x91c0('0x12'),_0x91c0('0x4b'),_0x91c0('0x32'),_0x91c0('0x33')],squel[_0x91c0('0x36')]()['fields'](_0x501c9b)['from'](_0x91c0('0x2d'))[_0x91c0('0x13')](_0x91c0('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x91c0('0x13')](_0x91c0('0x4c'),null,_0x91c0('0x4d'))[_0x91c0('0x15')]('cm_hopper.ListId\x20=\x20?',_0x3acb1f)[_0x91c0('0x15')](_0x91c0('0x3b'),NOW))['toString']();}function insertCmContact(_0x965145,_0x2151ff,_0x3d1576,_0x4b7656){var _0x29e532=_[_0x91c0('0x4e')](_[_0x91c0('0x4f')](_0x4b7656),['ListId',_0x91c0('0x50'),_0x91c0('0x32'),_0x91c0('0x33'),_0x91c0('0x51')]);return squel[_0x91c0('0x2b')]()['into']('cm_contacts')[_0x91c0('0x2e')](_0x29e532,squel['select']()[_0x91c0('0x37')](_0x29e532)[_0x91c0('0x41')](_0x2151ff)['where']('('+_0x3d1576['join'](',')+_0x91c0('0x52'),squel['select']()[_0x91c0('0x37')](_0x3d1576)[_0x91c0('0x41')](_0x91c0('0x38'))[_0x91c0('0x15')](_0x91c0('0x45'),_0x965145)[_0x91c0('0x15')]('deletedAt\x20IS\x20NULL'))[_0x91c0('0x15')]('id\x20IN\x20?',squel[_0x91c0('0x36')]()['field'](_0x91c0('0x53'),_0x91c0('0x54'))[_0x91c0('0x41')](_0x2151ff)[_0x91c0('0x55')](_0x3d1576['join'](','))))[_0x91c0('0x3f')]();}function handleStop(){logger[_0x91c0('0x56')](_0x91c0('0x57'));stopped=!![];}function handleUncaughtException(_0x40bcce){logger[_0x91c0('0x58')](_0x40bcce[_0x91c0('0x59')]);process['exit'](0x1);}function handleError(_0x3a89d1,_0x528ddb){stats[_0x91c0('0x5a')]['push']({'name':_0x528ddb[_0x91c0('0x5b')],'message':_0x528ddb[_0x91c0('0x59')],'row':_0x3a89d1});}function handleQuery(_0x564b64){logger['info'](_0x564b64);return db['sequelize'][_0x91c0('0x5c')](_0x564b64)[_0x91c0('0x5d')](function(_0x1cd0a2){results[_0x91c0('0x1e')](_0x1cd0a2);})['catch'](function(_0x5c1b47){logger[_0x91c0('0x58')](_0x5c1b47[_0x91c0('0x59')]);});}function updateTzCampaigns(_0x44d73f){return new Promise(function(_0x56a1b9,_0x2edfc5){var _0x33d0b1=squel['select']()[_0x91c0('0x37')]([_0x91c0('0x5e'),_0x91c0('0x5f')])[_0x91c0('0x41')](_0x91c0('0x60'))['join']('campaigns_has_cm_lists',null,_0x91c0('0x61'))[_0x91c0('0x15')](_0x91c0('0x62')+_0x44d73f);db[_0x91c0('0x63')][_0x91c0('0x5c')](_0x33d0b1[_0x91c0('0x3f')]())[_0x91c0('0x5d')](function(_0x519db2){var _0x10098f=[];for(var _0x5a484e=0x0;_0x5a484e<_0x519db2[_0x91c0('0x1b')];_0x5a484e++){_0x10098f[_0x91c0('0x1e')](getTimezoneData(_0x519db2[_0x5a484e],tmp_campaigns));}BPromise['all'](_0x10098f)['then'](function(){_0x56a1b9({'val':0x1});});})[_0x91c0('0x64')](function(_0x31c4b9){logger[_0x91c0('0x58')](_0x31c4b9[_0x91c0('0x59')]);_0x56a1b9({'val':0x0});});});}function updateTzVoiceQueues(_0x1cd130){return new Promise(function(_0x185b64,_0x7b44c0){var _0x63210b=squel[_0x91c0('0x36')]()[_0x91c0('0x37')](['voice_queues.id','voice_queues.dialTimezone'])[_0x91c0('0x41')](_0x91c0('0x65'))[_0x91c0('0x13')]('voice_queues_has_cm_lists',null,_0x91c0('0x66'))[_0x91c0('0x15')](_0x91c0('0x67')+_0x1cd130);db['sequelize'][_0x91c0('0x5c')](_0x63210b[_0x91c0('0x3f')]())['spread'](function(_0x22c9b1){var _0x536c84=[];for(var _0x32834c=0x0;_0x32834c<_0x22c9b1['length'];_0x32834c++){_0x536c84[_0x91c0('0x1e')](getTimezoneData(_0x22c9b1[_0x32834c],tmp_voice_queues));}BPromise['all'](_0x536c84)[_0x91c0('0x1a')](function(){_0x185b64({'val':0x1});});})['catch'](function(_0x2d5f56){logger[_0x91c0('0x58')](_0x2d5f56[_0x91c0('0x59')]);_0x185b64({'val':0x0});});});}function getTimezoneData(_0x38ce24,_0x12086d){return new Promise(function(_0x2a0790,_0x2013e0){var _0x216977=shared[_0x91c0('0x68')];var _0x11a73b=_0x216977[_0x38ce24['dialTimezone']];if(_[_0x91c0('0x69')](_0x11a73b)){_0x2a0790({'ret':0x1});}else{var _0x35bb75=_0x11a73b['utcOffset'];var _0x2c3819=squel['insert']()[_0x91c0('0x2c')](_0x12086d)[_0x91c0('0x6a')]('id',_0x38ce24['id'])[_0x91c0('0x6a')](_0x91c0('0x6b'),_0x35bb75)[_0x91c0('0x6a')]('dialTimezone',_0x38ce24[_0x91c0('0x6c')])[_0x91c0('0x3f')]();return db[_0x91c0('0x63')][_0x91c0('0x5c')](_0x2c3819)[_0x91c0('0x5d')](function(_0xfc6a9c){_0x2a0790({'ret':0x1});})['catch'](function(_0x5e23f1){logger[_0x91c0('0x58')](_0x5e23f1[_0x91c0('0x59')]);_0x2013e0({'ret':0x1});});}});}function handleTZQuery(_0xedb372){logger['info'](_0xedb372);return db['sequelize'][_0x91c0('0x5c')](_0xedb372)[_0x91c0('0x5d')](function(_0x308fc4){})['catch'](function(_0x3ff4b9){logger[_0x91c0('0x58')](_0x3ff4b9[_0x91c0('0x59')]);});}function main(_0x3fd747,_0x70635b,_0x226862,_0xc035fb){logger[_0x91c0('0x56')](_0x91c0('0x6d'),_0x3fd747,JSON['stringify'](_0x70635b));process[_0x91c0('0x6e')](_0x91c0('0x6f'));var _0x525f61=_0x70635b[_0x91c0('0x70')];var _0x4a5ae6=_[_0x91c0('0x71')](_0x525f61);var _0x230ce6=_0x70635b[_0x91c0('0x72')];var _0x4bc607=path[_0x91c0('0x13')](config['root'],_0x91c0('0x73'),_0x230ce6+'.csv');hasTZ=_[_0x91c0('0x4f')](_0x525f61)['includes']('dialTimezone');var _0x4eb992=_[_0x91c0('0x4f')](_0x525f61)[_0x91c0('0x13')]();logger[_0x91c0('0x56')]('header',_0x4eb992);db[_0x91c0('0x74')][_0x91c0('0x18')]({'raw':!![],'attributes':['id','name']})[_0x91c0('0x1a')](function(_0x71d9ed){for(var _0x1a226e=0x0;_0x1a226e<_0x71d9ed[_0x91c0('0x1b')];_0x1a226e++){if(_0x71d9ed[_0x1a226e][_0x91c0('0x75')]in _0x525f61){contactItemTypes[_0x91c0('0x1e')](_0x71d9ed[_0x1a226e]);delete _0x4a5ae6[_0x71d9ed[_0x1a226e][_0x91c0('0x75')]];hasAdditionalPhones=!![];}for(var _0x10cacb in _0x525f61){if(_0x71d9ed[_0x1a226e][_0x91c0('0x75')]+_0x91c0('0x76')===_0x10cacb){phoneDescriptions['push']({'itemTypeId':_0x71d9ed[_0x1a226e]['id'],'description':_0x10cacb});delete _0x4a5ae6[_0x10cacb];}}}if(hasAdditionalPhones)_0x4a5ae6[_0x91c0('0x19')]='';var _0x3a7c4b=_[_0x91c0('0x4f')](_0x4a5ae6)[_0x91c0('0x13')]();logger[_0x91c0('0x56')](_0x91c0('0x77'),_0x3a7c4b);fs[_0x91c0('0x78')](_0x4bc607,_0x3a7c4b+'\x0a');Papa[_0x91c0('0x79')](fs['createReadStream'](_0x3fd747),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4a08f3,_0x27317c){try{for(var _0xc11273=0x0,_0x837551=[];_0xc11273<_0x4a08f3[_0x91c0('0x7a')][_0x91c0('0x1b')];_0xc11273++){stats[_0x91c0('0x7b')]+=0x1;if(_0x4a08f3['errors'][_0xc11273]){handleError(_0x4a08f3[_0x91c0('0x7a')][_0xc11273],_0x4a08f3['errors'][_0xc11273]);}else{var _0x2e2b45=[];var _0x199aa1=[];var _0x347feb={};for(var _0x5b2f08 in _0x525f61){let _0x1f72f8=contactItemTypes[_0x91c0('0x7c')](_0x572d90=>_0x572d90[_0x91c0('0x75')]===_0x5b2f08);let _0x13e213=contactItemTypes[_0x91c0('0x7c')](_0xc7bf1f=>_0xc7bf1f[_0x91c0('0x75')]+_0x91c0('0x76')===_0x5b2f08);if(_[_0x91c0('0x69')](_0x1f72f8)&&_[_0x91c0('0x69')](_0x13e213)){if(_0x525f61['hasOwnProperty'](_0x5b2f08)){if(_0x4a08f3[_0x91c0('0x7a')][_0xc11273][_0x525f61[_0x5b2f08]]){var _0x7aa7b3=_['trim'](_0x4a08f3[_0x91c0('0x7a')][_0xc11273][_0x525f61[_0x5b2f08]][_0x91c0('0x7d')](/"/g,'\x27'));switch(_0x5b2f08){case _0x91c0('0x2f'):var _0x5875c0=moment(_0x7aa7b3,_0x91c0('0x10'),!![]);if(_0x5875c0[_0x91c0('0x7e')]()){_0x837551[_0x91c0('0x1e')]('\x22'+_0x7aa7b3+'\x22');}else{_0x2e2b45[_0x91c0('0x1e')](_0x91c0('0x7f'));}break;case _0x91c0('0x34'):var _0xa8ddcf=parseInt(_0x7aa7b3);_0x7aa7b3=_[_0x91c0('0x80')](_0xa8ddcf)||_0xa8ddcf<0x0||_0xa8ddcf>0x4?_0xc035fb?0x3:0x2:_0xa8ddcf;_0x837551[_0x91c0('0x1e')]('\x22'+_0x7aa7b3+'\x22');break;case _0x91c0('0x35'):var _0x27b5f0=parseInt(_0x7aa7b3);if(_[_0x91c0('0x81')](_0x27b5f0)&&_[_0x91c0('0x82')](_0x226862,_0x27b5f0)){_0x837551[_0x91c0('0x1e')]('\x22'+_0x27b5f0+'\x22');}else{_0x2e2b45[_0x91c0('0x1e')](_0x91c0('0x83'));}break;case _0x91c0('0x84'):if(isEmail(_0x7aa7b3)){_0x837551[_0x91c0('0x1e')]('\x22'+_0x7aa7b3+'\x22');}else{_0x2e2b45[_0x91c0('0x1e')](_0x91c0('0x85'));}break;case _0x91c0('0x86'):var _0x12be6a=moment(_0x7aa7b3,_0x91c0('0x87'),!![]);if(_0x12be6a[_0x91c0('0x7e')]()){_0x837551['push']('\x22'+_0x7aa7b3+'\x22');}else{_0x2e2b45[_0x91c0('0x1e')](_0x91c0('0x88'));}break;case _0x91c0('0x6c'):var _0x4eb578=shared[_0x91c0('0x68')];var _0x21c2d1=_0x4eb578[_0x7aa7b3];if(!_[_0x91c0('0x69')](_0x21c2d1)){var _0x333ac5=_0x21c2d1[_0x91c0('0x89')];_0x837551[_0x91c0('0x1e')]('\x22'+_0x7aa7b3+'\x22');_0x837551['push']('\x22'+_0x333ac5+'\x22');}break;default:_0x837551[_0x91c0('0x1e')]('\x22'+_0x7aa7b3+'\x22');}}else{switch(_0x5b2f08){case'firstName':case _0x91c0('0x12'):_0x2e2b45[_0x91c0('0x1e')](_0x5b2f08+_0x91c0('0x8a'));break;default:_0x837551[_0x91c0('0x1e')]('\x22\x22');}}}}else{var _0x114f66='';if(!_[_0x91c0('0x69')](_0x1f72f8)){if(!_0x347feb['hasOwnProperty'](_0x1f72f8['id'])){if(!_['isNil'](_0x4a08f3[_0x91c0('0x7a')][_0xc11273][_0x525f61[_0x5b2f08]])){var _0x7aa7b3=_[_0x91c0('0x8b')](_0x4a08f3[_0x91c0('0x7a')][_0xc11273][_0x525f61[_0x5b2f08]][_0x91c0('0x7d')](/"/g,'\x27'));var _0x4d965c=phoneDescriptions[_0x91c0('0x7c')](_0x508378=>_0x508378[_0x91c0('0x8c')]===_0x1f72f8['id']);if(!_[_0x91c0('0x69')](_0x4d965c)){var _0x5d7582=_['trim'](_0x4a08f3[_0x91c0('0x7a')][_0xc11273][_0x525f61[_0x4d965c['description']]][_0x91c0('0x7d')](/"/g,'\x27'));if(!_[_0x91c0('0x69')](_0x5d7582))_0x7aa7b3=_0x7aa7b3+'§'+_0x5d7582;}if(_0x114f66=='')_0x114f66=_0x7aa7b3;else _0x114f66+='|'+_0x7aa7b3;}_0x199aa1[_0x91c0('0x1e')](_0x1f72f8['id']+':'+_0x114f66);_0x347feb[_0x1f72f8['id']]=0x1;}}}}if(hasAdditionalPhones){_0x837551[_0x91c0('0x1e')]('\x22'+_0x199aa1[_0x91c0('0x13')](';')+'\x22');}if(_0x2e2b45[_0x91c0('0x1b')]){handleError(_0x4a08f3['data'][_0xc11273],{'code':_0x91c0('0x8d'),'message':_0x2e2b45[_0x91c0('0x13')]()});}else{fs['appendFileSync'](_0x4bc607,_0x837551[_0x91c0('0x13')]()+'\x0a');}_0x837551=[];}if(!(stats[_0x91c0('0x7b')]%0xc8)){socket[_0x91c0('0x8e')](_0x91c0('0x8f')+_0x230ce6,stats);stats[_0x91c0('0x5a')]=[];}}if(stopped){logger[_0x91c0('0x56')]('Abort\x20parser');_0x27317c['abort']();}}catch(_0xa1dfca){handleError(_0x4a08f3[_0x91c0('0x7a')][_0xc11273],{'code':_0x91c0('0x90'),'message':_0xa1dfca[_0x91c0('0x59')]});logger['error'](_0x91c0('0x91'),_0xa1dfca[_0x91c0('0x59')]);}},'complete':function(){try{var _0xde31e0=[];var _0x20591c=[];var _0x3bea54=_0x91c0('0x38');if(_0x70635b['duplicates']&&_0x70635b[_0x91c0('0x92')][_0x91c0('0x1b')]){_0x3bea54='cm_contacts_'+_0x230ce6;_0xde31e0[_0x91c0('0x1e')](_0x91c0('0x93')+_0x3bea54+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x91c0('0x94')+_0x230ce6;tmp_voice_queues=_0x91c0('0x95')+_0x230ce6;_0x20591c[_0x91c0('0x1e')](_0x91c0('0x93')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x20591c['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x91c0('0x96'));BPromise[_0x91c0('0x97')](_0x20591c,handleTZQuery)[_0x91c0('0x1a')](function(_0x2c001d){updateTzCampaigns(_0x70635b[_0x91c0('0x31')])[_0x91c0('0x1a')](function(_0x1b5933){updateTzVoiceQueues(_0x70635b['ListId'])[_0x91c0('0x1a')](function(_0x4573f9){if(hasTZ)_0x3a7c4b=_0x3a7c4b[_0x91c0('0x7d')](_0x91c0('0x6c'),'dialTimezone,utcOffset');var _0x127b29=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4bc607,_0x3bea54,_0x3a7c4b,_0x70635b[_0x91c0('0x31')],_0x70635b[_0x91c0('0x50')]||null,NOW,NOW);if(_[_0x91c0('0x69')](_0x525f61[_0x91c0('0x2f')])){_0x127b29+=_0x91c0('0x98');}_0xde31e0[_0x91c0('0x1e')](_0x127b29);if(_0x70635b[_0x91c0('0x92')]&&_0x70635b[_0x91c0('0x92')][_0x91c0('0x1b')]){_0xde31e0[_0x91c0('0x1e')](insertCmContact(_0x70635b[_0x91c0('0x31')],_0x3bea54,_0x70635b[_0x91c0('0x92')],_0x525f61));_0xde31e0[_0x91c0('0x1e')](_0x91c0('0x99')+_0x3bea54+';');}BPromise[_0x91c0('0x97')](_0xde31e0,handleQuery)[_0x91c0('0x1a')](function(_0x2b46eb){BPromise[_0x91c0('0x1c')]([handleAdditionalPhones()])[_0x91c0('0x1a')](function(){_0xde31e0=[];for(var _0x365a6c=0x0;_0x365a6c\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','length','push','then','split','all','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x67a2,0x134));var _0x267a=function(_0x4c5bf2,_0x49b334){_0x4c5bf2=_0x4c5bf2-0x0;var _0x84df47=_0x67a2[_0x4c5bf2];return _0x84df47;};'use strict';var fs=require('fs');var path=require(_0x267a('0x0'));var _=require(_0x267a('0x1'));var Papa=require(_0x267a('0x2'));var util=require(_0x267a('0x3'));var BPromise=require(_0x267a('0x4'));var moment=require(_0x267a('0x5'));var squel=require('squel');var Redis=require(_0x267a('0x6'));var db=require(_0x267a('0x7'))['db'];var config=require(_0x267a('0x8'));var shared=require(_0x267a('0x9'));var logger=require(_0x267a('0xa'))(_0x267a('0xb'));config['redis']=_[_0x267a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x267a('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x267a('0xe')](_0x267a('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x267a('0xe')](_0x267a('0xf'));function isEmail(_0x538bd4){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x267a('0x10')](_0x538bd4);}function selectNotIn(_0x1145a1,_0x2c2317,_0x4042af,_0x34261b,_0x4fd763){return squel[_0x267a('0x11')]()[_0x267a('0x12')](_0x267a('0x13'))[_0x267a('0x14')](_0x34261b)[_0x267a('0x15')](_0x2c2317,null,_0x2c2317+_0x267a('0x16')+_0x34261b+'.'+_0x4042af)['where'](_0x34261b+'.'+_0x4042af+_0x267a('0x17')+_0x1145a1+'.'+_0x4042af)[_0x267a('0x18')](_0x2c2317+_0x267a('0x19')+_0x4fd763[_0x267a('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x241fb6,_0x4a5514){promisesAdditionalPhones=[];return db['CmContact'][_0x267a('0x1a')]({'raw':!![],'attributes':['id',_0x267a('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x5093d1){if(_0x5093d1!==null){var _0x1cbfe1=[];for(var _0x189dc6=0x0;_0x189dc6<_0x5093d1[_0x267a('0x1c')];_0x189dc6++){var _0x352cdf=_0x5093d1[_0x189dc6];_0x1cbfe1[_0x267a('0x1d')](insertAdditionalPhones(_0x352cdf));}}Promise['all'](_0x1cbfe1)[_0x267a('0x1e')](function(){_0x241fb6({'val':0x1});});});});}function insertAdditionalPhones(_0x5d87a3){return new Promise(function(_0x49cfa2,_0x82ee7){var _0x4530e8=_0x5d87a3[_0x267a('0x1b')];var _0x2d889d=_0x4530e8[_0x267a('0x1f')](';');var _0x1f5003=[];orderBy=0x0;for(var _0x475993=0x0;_0x475993<_0x2d889d[_0x267a('0x1c')];_0x475993++){_0x1f5003[_0x267a('0x1d')](splitAdditionalPhone(_0x5d87a3['id'],_0x2d889d[_0x475993]));}Promise[_0x267a('0x20')](_0x1f5003)['then'](function(){_0x49cfa2({'val':_0x2d889d[_0x267a('0x1c')]});});});}function splitAdditionalPhone(_0x21efda,_0x487d42){return new Promise(function(_0x5ec818,_0x1ebd70){var _0x3d0943=_0x487d42[_0x267a('0x1f')](':');var _0x478523=_0x3d0943[0x0];var _0x3622fd=_0x3d0943[0x1];if(!_[_0x267a('0x21')](_0x3622fd)){var _0x205487=_0x3622fd[_0x267a('0x1f')]('|');var _0x1da75a=[];for(var _0x26dac2=0x0;_0x26dac2<_0x205487[_0x267a('0x1c')];_0x26dac2++){if(_0x205487[_0x26dac2]!==''){var _0x9d9121=_[_0x267a('0x22')](promisesAdditionalPhones,{'contactId':_0x21efda,'phone':_0x205487[_0x26dac2]});if(_0x9d9121[_0x267a('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x267a('0x1d')]({'contactId':_0x21efda,'contactTypeId':_0x478523,'phone':_0x205487[_0x26dac2],'orderBy':orderBy});}}}_0x5ec818({'ok':0x1});}else _0x5ec818({'res':0x0});});}function createAdditionalPhone(_0x5ee87d,_0x191972,_0x35d8d5,_0x5aebbd){var _0x4d2304='';var _0x5d8a05='';var _0x2a4039=_0x35d8d5[_0x267a('0x1f')]('§');_0x4d2304=_0x2a4039[0x0];if(_0x2a4039[_0x267a('0x1c')]==0x2)_0x5d8a05=_0x2a4039[0x1];return new Promise(function(_0x3e1ddd,_0x3ff671){return db[_0x267a('0x23')][_0x267a('0x24')]({'where':{'CmContactId':_0x5ee87d,'item':_0x4d2304}})[_0x267a('0x1e')](function(_0x2d3cf1){if(_0x2d3cf1){return db['CmContactHasItem'][_0x267a('0x25')]({'ItemTypeId':_0x191972,'description':_0x5d8a05,'OrderBy':_0x5aebbd},{'where':{'CmContactId':_0x5ee87d,'item':_0x4d2304}})[_0x267a('0x1e')](function(_0x180d37){_0x3e1ddd({'res':_0x267a('0x26')});});}else{return db['CmContactHasItem'][_0x267a('0x27')]({'CmContactId':_0x5ee87d,'item':_0x4d2304,'description':_0x5d8a05,'ItemTypeId':_0x191972,'OrderBy':_0x5aebbd,'ItemClass':_0x267a('0x28')})['then'](function(_0x2f4fcd){_0x3e1ddd({'res':_0x267a('0x29')});});}});});}function insertCmHopper(_0x5bf1cf,_0x369e3f,_0x57eda1,_0x495696,_0x44db13){var _0x167a22=[_0x267a('0x2a'),_0x267a('0x2b'),_0x267a('0x2c'),_0x267a('0x2d'),_0x369e3f+'.'+_0x495696,'cm_contacts.createdAt',_0x267a('0x2e'),'cm_contacts.priority',_0x267a('0x2f'),'\x22'+_0x44db13+'\x22'];return squel[_0x267a('0x30')]()[_0x267a('0x31')](_0x267a('0x32'))[_0x267a('0x33')]([_0x267a('0x13'),'scheduledat',_0x267a('0x34'),_0x267a('0x35'),_0x495696,_0x267a('0x36'),_0x267a('0x37'),'priority',_0x267a('0x38'),'recallme'],squel['select']()[_0x267a('0x39')](_0x167a22)[_0x267a('0x14')](_0x369e3f)[_0x267a('0x15')]('cm_contacts',null,_0x267a('0x3a')+_0x369e3f+_0x267a('0x3b'))[_0x267a('0x15')](_0x57eda1,null,_0x57eda1+_0x267a('0x16')+_0x369e3f+'.'+_0x495696)[_0x267a('0x18')](_0x369e3f+_0x267a('0x3c'),_0x5bf1cf)[_0x267a('0x18')](_0x267a('0x3d'),NOW)[_0x267a('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x369e3f,_0x57eda1,_0x495696,_0x267a('0x32'),[_0x267a('0x3e'),_0x267a('0x3f')]))[_0x267a('0x18')](_0x267a('0x40'),selectNotIn(_0x369e3f,_0x57eda1,_0x495696,_0x267a('0x32'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x177459,_0x11536a,_0x32bc13,_0x55ad0a){var _0x4a160c=[_0x267a('0x2a'),_0x267a('0x2c'),_0x267a('0x2d'),_0x11536a+'.'+_0x55ad0a,_0x267a('0x41'),_0x267a('0x2e')];return squel[_0x267a('0x30')]()['into']('cm_hopper_black')['fromQuery'](['phone',_0x267a('0x34'),_0x267a('0x35'),_0x55ad0a,'createdAt',_0x267a('0x37')],squel[_0x267a('0x11')]()['fields'](_0x4a160c)[_0x267a('0x14')](_0x11536a)[_0x267a('0x15')](_0x267a('0x42'),null,_0x267a('0x3a')+_0x11536a+'.CmListId')[_0x267a('0x15')](_0x32bc13,null,_0x32bc13+_0x267a('0x16')+_0x11536a+'.'+_0x55ad0a)[_0x267a('0x18')](_0x11536a+_0x267a('0x3c'),_0x177459)[_0x267a('0x18')](_0x267a('0x3d'),NOW)[_0x267a('0x18')](_0x267a('0x40'),squel[_0x267a('0x11')]()['field'](_0x267a('0x13'))['from'](_0x267a('0x43'))[_0x267a('0x18')]('ListId\x20=\x20?',_0x177459)[_0x267a('0x18')](_0x55ad0a+'\x20=\x20'+_0x11536a+'.'+_0x55ad0a)))[_0x267a('0x44')]();}function insertTzCmHopper(_0x1fc4ec,_0x1a51ac,_0x5705e8,_0x3550fc,_0x4c8b74,_0x52afe5){var _0x21c737=[_0x267a('0x2a'),_0x267a('0x45')+_0x52afe5+_0x267a('0x46'),_0x267a('0x2c'),_0x267a('0x2d'),_0x1a51ac+'.'+_0x3550fc,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0x267a('0x2f'),'\x22'+_0x4c8b74+'\x22'];var _0x303b54=squel['insert']()[_0x267a('0x31')](_0x267a('0x32'))[_0x267a('0x33')]([_0x267a('0x13'),_0x267a('0x47'),_0x267a('0x34'),'ListId',_0x3550fc,_0x267a('0x36'),_0x267a('0x37'),_0x267a('0x48'),_0x267a('0x38'),_0x267a('0x49')],squel[_0x267a('0x11')]()[_0x267a('0x39')](_0x21c737)[_0x267a('0x14')](_0x1a51ac)[_0x267a('0x15')](_0x267a('0x42'),null,_0x267a('0x3a')+_0x1a51ac+_0x267a('0x3b'))[_0x267a('0x15')](_0x5705e8,null,_0x5705e8+_0x267a('0x16')+_0x1a51ac+'.'+_0x3550fc)[_0x267a('0x15')](_0x52afe5,null,_0x52afe5+_0x267a('0x16')+_0x1a51ac+'.'+_0x3550fc)[_0x267a('0x18')](_0x1a51ac+_0x267a('0x3c'),_0x1fc4ec)[_0x267a('0x18')](_0x267a('0x3d'),NOW)['where'](_0x267a('0x40'),selectNotIn(_0x1a51ac,_0x5705e8,_0x3550fc,_0x267a('0x32'),[_0x267a('0x3e'),_0x267a('0x3f')]))[_0x267a('0x18')](_0x267a('0x40'),selectNotIn(_0x1a51ac,_0x5705e8,_0x3550fc,_0x267a('0x32'),[_0x267a('0x3e')])))['toString']();return _0x303b54;}function insertTzCmHopperBlack(_0x1d74d7,_0x73491,_0x44555d,_0x46237e){var _0x2fd997=[_0x267a('0x2a'),_0x267a('0x2c'),'cm_contacts.ListId',_0x73491+'.'+_0x46237e,'cm_contacts.createdAt',_0x267a('0x2e')];return squel[_0x267a('0x30')]()[_0x267a('0x31')]('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x267a('0x35'),_0x46237e,_0x267a('0x36'),_0x267a('0x37')],squel[_0x267a('0x11')]()['fields'](_0x2fd997)[_0x267a('0x14')](_0x73491)['join'](_0x267a('0x42'),null,_0x267a('0x3a')+_0x73491+'.CmListId')['join'](_0x44555d,null,_0x44555d+'.id\x20=\x20'+_0x73491+'.'+_0x46237e)[_0x267a('0x18')](_0x73491+_0x267a('0x3c'),_0x1d74d7)[_0x267a('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x267a('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x267a('0x11')]()[_0x267a('0x12')](_0x267a('0x13'))['from']('cm_hopper_black')[_0x267a('0x18')](_0x267a('0x4a'),_0x1d74d7)[_0x267a('0x18')](_0x46237e+_0x267a('0x17')+_0x73491+'.'+_0x46237e)))['toString']();}function insertCmHopperAdditionalPhones(_0x2cf10c){var _0x2d055d=['cm_hopper.id',_0x267a('0x4b'),_0x267a('0x4c'),_0x267a('0x4d'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into']('cm_hopper_additional_phones')[_0x267a('0x33')]([_0x267a('0x4e'),'phone',_0x267a('0x4f'),_0x267a('0x36'),'updatedAt'],squel[_0x267a('0x11')]()[_0x267a('0x39')](_0x2d055d)[_0x267a('0x14')](_0x267a('0x32'))[_0x267a('0x15')]('cm_contacts',null,_0x267a('0x50'))['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x267a('0x18')](_0x267a('0x51'),_0x2cf10c)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x267a('0x44')]();}function insertCmContact(_0xc6c2e,_0x34d792,_0x34a740,_0x372714){var _0x5cbc51=_[_0x267a('0x52')](_[_0x267a('0x53')](_0x372714),[_0x267a('0x35'),'CompanyId',_0x267a('0x36'),_0x267a('0x37'),'scheduledAt']);return squel[_0x267a('0x30')]()[_0x267a('0x31')](_0x267a('0x42'))['fromQuery'](_0x5cbc51,squel[_0x267a('0x11')]()[_0x267a('0x39')](_0x5cbc51)['from'](_0x34d792)[_0x267a('0x18')]('('+_0x34a740[_0x267a('0x15')](',')+_0x267a('0x54'),squel[_0x267a('0x11')]()['fields'](_0x34a740)[_0x267a('0x14')](_0x267a('0x42'))['where']('ListId\x20=\x20?',_0xc6c2e)[_0x267a('0x18')](_0x267a('0x55')))[_0x267a('0x18')]('id\x20IN\x20?',squel[_0x267a('0x11')]()[_0x267a('0x12')](_0x267a('0x56'),_0x267a('0x57'))[_0x267a('0x14')](_0x34d792)['group'](_0x34a740['join'](','))))[_0x267a('0x44')]();}function handleStop(){logger['info'](_0x267a('0x58'));stopped=!![];}function handleUncaughtException(_0x1d073c){logger[_0x267a('0x59')](_0x1d073c[_0x267a('0x5a')]);process[_0x267a('0x5b')](0x1);}function handleError(_0xacb8cb,_0x5b5616){stats['errors'][_0x267a('0x1d')]({'name':_0x5b5616[_0x267a('0x5c')],'message':_0x5b5616[_0x267a('0x5a')],'row':_0xacb8cb});}function handleQuery(_0x5465cf){logger[_0x267a('0x5d')](_0x5465cf);return db[_0x267a('0x5e')]['query'](_0x5465cf)['spread'](function(_0x3ef698){results['push'](_0x3ef698);})['catch'](function(_0x3f5ddc){logger[_0x267a('0x59')](_0x3f5ddc[_0x267a('0x5a')]);});}function updateTzCampaigns(_0x2210c3){return new Promise(function(_0x59aa1a,_0x305be9){var _0x566dfd=squel[_0x267a('0x11')]()[_0x267a('0x39')]([_0x267a('0x5f'),_0x267a('0x60')])[_0x267a('0x14')]('campaigns')[_0x267a('0x15')](_0x267a('0x61'),null,_0x267a('0x62'))['where']('campaigns_has_cm_lists.CmListId='+_0x2210c3);db[_0x267a('0x5e')]['query'](_0x566dfd[_0x267a('0x44')]())['spread'](function(_0x2a6d3f){var _0x4950f3=[];for(var _0x353179=0x0;_0x353179<_0x2a6d3f['length'];_0x353179++){_0x4950f3[_0x267a('0x1d')](getTimezoneData(_0x2a6d3f[_0x353179],tmp_campaigns));}BPromise[_0x267a('0x20')](_0x4950f3)[_0x267a('0x1e')](function(){_0x59aa1a({'val':0x1});});})[_0x267a('0x63')](function(_0x1a2e80){logger['error'](_0x1a2e80[_0x267a('0x5a')]);_0x59aa1a({'val':0x0});});});}function updateTzVoiceQueues(_0x2af63b){return new Promise(function(_0x19cc31,_0x4f146c){var _0x52e554=squel[_0x267a('0x11')]()[_0x267a('0x39')]([_0x267a('0x64'),_0x267a('0x65')])['from'](_0x267a('0x66'))[_0x267a('0x15')](_0x267a('0x67'),null,_0x267a('0x68'))[_0x267a('0x18')](_0x267a('0x69')+_0x2af63b);db[_0x267a('0x5e')][_0x267a('0x6a')](_0x52e554['toString']())[_0x267a('0x6b')](function(_0x163eb5){var _0x4cf1a4=[];for(var _0xe44ed4=0x0;_0xe44ed4<_0x163eb5[_0x267a('0x1c')];_0xe44ed4++){_0x4cf1a4[_0x267a('0x1d')](getTimezoneData(_0x163eb5[_0xe44ed4],tmp_voice_queues));}BPromise[_0x267a('0x20')](_0x4cf1a4)[_0x267a('0x1e')](function(){_0x19cc31({'val':0x1});});})['catch'](function(_0x43df34){logger[_0x267a('0x59')](_0x43df34[_0x267a('0x5a')]);_0x19cc31({'val':0x0});});});}function getTimezoneData(_0xf3b8c4,_0x3f7f64){return new Promise(function(_0x22dae0,_0x2f27d7){var _0x36e4c9=shared['timezones'];var _0x164b00=_0x36e4c9[_0xf3b8c4['dialTimezone']];if(_[_0x267a('0x21')](_0x164b00)){_0x22dae0({'ret':0x1});}else{var _0x204395=_0x164b00[_0x267a('0x6c')];var _0x4fd8f8=squel['insert']()[_0x267a('0x31')](_0x3f7f64)['set']('id',_0xf3b8c4['id'])[_0x267a('0x6d')]('offset',_0x204395)[_0x267a('0x6d')](_0x267a('0x6e'),_0xf3b8c4['dialTimezone'])[_0x267a('0x44')]();return db[_0x267a('0x5e')][_0x267a('0x6a')](_0x4fd8f8)['spread'](function(_0x3577db){_0x22dae0({'ret':0x1});})[_0x267a('0x63')](function(_0x273d8c){logger[_0x267a('0x59')](_0x273d8c['message']);_0x2f27d7({'ret':0x1});});}});}function handleTZQuery(_0x38061c){logger['info'](_0x38061c);return db['sequelize'][_0x267a('0x6a')](_0x38061c)[_0x267a('0x6b')](function(_0x2fb287){})['catch'](function(_0x26d955){logger[_0x267a('0x59')](_0x26d955[_0x267a('0x5a')]);});}function main(_0x40e725,_0x16990f,_0xd5e04f,_0x592633){logger[_0x267a('0x5d')](_0x267a('0x6f'),_0x40e725,JSON[_0x267a('0x70')](_0x16990f));process[_0x267a('0x71')]('start');var _0xd8d149=_0x16990f[_0x267a('0x72')];var _0x13769d=_[_0x267a('0x73')](_0xd8d149);var _0x48bc95=_0x16990f['socket_timestamp'];var _0x58b451=path[_0x267a('0x15')](config[_0x267a('0x74')],_0x267a('0x75'),_0x48bc95+_0x267a('0x76'));hasTZ=_[_0x267a('0x53')](_0xd8d149)[_0x267a('0x77')](_0x267a('0x6e'));var _0x26cd6a=_[_0x267a('0x53')](_0xd8d149)['join']();logger[_0x267a('0x5d')](_0x267a('0x78'),_0x26cd6a);db[_0x267a('0x79')][_0x267a('0x1a')]({'raw':!![],'attributes':['id',_0x267a('0x7a')]})[_0x267a('0x1e')](function(_0x2c8251){for(var _0x24a05e=0x0;_0x24a05e<_0x2c8251[_0x267a('0x1c')];_0x24a05e++){if(_0x2c8251[_0x24a05e][_0x267a('0x7a')]in _0xd8d149){contactItemTypes[_0x267a('0x1d')](_0x2c8251[_0x24a05e]);delete _0x13769d[_0x2c8251[_0x24a05e][_0x267a('0x7a')]];hasAdditionalPhones=!![];}for(var _0x57ce71 in _0xd8d149){if(_0x2c8251[_0x24a05e]['name']+_0x267a('0x7b')===_0x57ce71){phoneDescriptions[_0x267a('0x1d')]({'itemTypeId':_0x2c8251[_0x24a05e]['id'],'description':_0x57ce71});delete _0x13769d[_0x57ce71];}}}if(hasAdditionalPhones)_0x13769d['AdditionalPhones']='';var _0x159c38=_['keys'](_0x13769d)[_0x267a('0x15')]();logger[_0x267a('0x5d')](_0x267a('0x78'),_0x159c38);fs[_0x267a('0x7c')](_0x58b451,_0x159c38+'\x0a');Papa[_0x267a('0x7d')](fs[_0x267a('0x7e')](_0x40e725),{'header':!![],'skipEmptyLines':!![],'step':function(_0x46813a,_0x32b358){try{for(var _0x2ece70=0x0,_0x264339=[];_0x2ece70<_0x46813a[_0x267a('0x7f')][_0x267a('0x1c')];_0x2ece70++){stats['rows']+=0x1;if(_0x46813a['errors'][_0x2ece70]){handleError(_0x46813a[_0x267a('0x7f')][_0x2ece70],_0x46813a[_0x267a('0x80')][_0x2ece70]);}else{var _0x179656=[];var _0x2bf601=[];var _0x460816={};for(var _0xb8e522 in _0xd8d149){let _0x3dff16=contactItemTypes[_0x267a('0x81')](_0x4c7e79=>_0x4c7e79['name']===_0xb8e522);let _0x26bfc8=contactItemTypes[_0x267a('0x81')](_0x23143b=>_0x23143b[_0x267a('0x7a')]+_0x267a('0x7b')===_0xb8e522);if(_[_0x267a('0x21')](_0x3dff16)&&_[_0x267a('0x21')](_0x26bfc8)){if(_0xd8d149[_0x267a('0x82')](_0xb8e522)){if(_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0xb8e522]]){var _0x344a21=_[_0x267a('0x83')](_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0xb8e522]][_0x267a('0x84')](/"/g,'\x27'));switch(_0xb8e522){case _0x267a('0x47'):var _0x17a79f=moment(_0x344a21,_0x267a('0xf'),!![]);if(_0x17a79f[_0x267a('0x85')]()){_0x264339['push']('\x22'+_0x344a21+'\x22');}else{_0x179656['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x267a('0x48'):var _0x1feeb1=parseInt(_0x344a21);_0x344a21=_[_0x267a('0x86')](_0x1feeb1)||_0x1feeb1<0x0||_0x1feeb1>0x4?_0x592633?0x3:0x2:_0x1feeb1;_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');break;case _0x267a('0x38'):var _0x2870fe=parseInt(_0x344a21);if(_[_0x267a('0x87')](_0x2870fe)&&_[_0x267a('0x77')](_0xd5e04f,_0x2870fe)){_0x264339[_0x267a('0x1d')]('\x22'+_0x2870fe+'\x22');}else{_0x179656[_0x267a('0x1d')]('agent\x20not\x20exists');}break;case _0x267a('0x88'):if(isEmail(_0x344a21)){_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');}else{_0x179656[_0x267a('0x1d')](_0x267a('0x89'));}break;case _0x267a('0x8a'):var _0x60ac5c=moment(_0x344a21,_0x267a('0x8b'),!![]);if(_0x60ac5c['isValid']()){_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');}else{_0x179656['push'](_0x267a('0x8c'));}break;case _0x267a('0x6e'):var _0x5118de=shared[_0x267a('0x8d')];var _0x40935a=_0x5118de[_0x344a21];if(!_[_0x267a('0x21')](_0x40935a)){var _0x428c72=_0x40935a[_0x267a('0x6c')];_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');_0x264339['push']('\x22'+_0x428c72+'\x22');}break;default:_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');}}else{switch(_0xb8e522){case _0x267a('0x8e'):case _0x267a('0x13'):_0x179656['push'](_0xb8e522+_0x267a('0x8f'));break;default:_0x264339[_0x267a('0x1d')]('\x22\x22');}}}}else{var _0x9648c1='';if(!_[_0x267a('0x21')](_0x3dff16)){if(!_0x460816['hasOwnProperty'](_0x3dff16['id'])){if(!_['isNil'](_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0xb8e522]])){var _0x344a21=_['trim'](_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0xb8e522]]['replace'](/"/g,'\x27'));var _0x554750=phoneDescriptions['find'](_0x532e81=>_0x532e81[_0x267a('0x90')]===_0x3dff16['id']);if(!_['isNil'](_0x554750)){var _0x7efd57=_[_0x267a('0x83')](_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0x554750[_0x267a('0x91')]]]['replace'](/"/g,'\x27'));if(!_[_0x267a('0x21')](_0x7efd57))_0x344a21=_0x344a21+'§'+_0x7efd57;}if(_0x9648c1=='')_0x9648c1=_0x344a21;else _0x9648c1+='|'+_0x344a21;}_0x2bf601[_0x267a('0x1d')](_0x3dff16['id']+':'+_0x9648c1);_0x460816[_0x3dff16['id']]=0x1;}}}}if(hasAdditionalPhones){_0x264339[_0x267a('0x1d')]('\x22'+_0x2bf601[_0x267a('0x15')](';')+'\x22');}if(_0x179656[_0x267a('0x1c')]){handleError(_0x46813a[_0x267a('0x7f')][_0x2ece70],{'code':'SystemRow','message':_0x179656[_0x267a('0x15')]()});}else{fs['appendFileSync'](_0x58b451,_0x264339[_0x267a('0x15')]()+'\x0a');}_0x264339=[];}if(!(stats[_0x267a('0x92')]%0xc8)){socket['emit'](_0x267a('0x93')+_0x48bc95,stats);stats['errors']=[];}}if(stopped){logger[_0x267a('0x5d')]('Abort\x20parser');_0x32b358[_0x267a('0x94')]();}}catch(_0x5a6718){handleError(_0x46813a[_0x267a('0x7f')][_0x2ece70],{'code':_0x267a('0x95'),'message':_0x5a6718[_0x267a('0x5a')]});logger[_0x267a('0x59')](_0x267a('0x96'),_0x5a6718[_0x267a('0x5a')]);}},'complete':function(){try{var _0x26796f=[];var _0x5b47d4=[];var _0x50253a=_0x267a('0x42');if(_0x16990f[_0x267a('0x97')]&&_0x16990f[_0x267a('0x97')][_0x267a('0x1c')]){_0x50253a=_0x267a('0x98')+_0x48bc95;_0x26796f[_0x267a('0x1d')]('CREATE\x20TABLE\x20'+_0x50253a+_0x267a('0x99'));}tmp_campaigns=_0x267a('0x9a')+_0x48bc95;tmp_voice_queues='voice_queues_'+_0x48bc95;_0x5b47d4[_0x267a('0x1d')](_0x267a('0x9b')+tmp_campaigns+_0x267a('0x9c'));_0x5b47d4[_0x267a('0x1d')](_0x267a('0x9b')+tmp_voice_queues+_0x267a('0x9c'));BPromise[_0x267a('0x9d')](_0x5b47d4,handleTZQuery)[_0x267a('0x1e')](function(_0x227a8f){updateTzCampaigns(_0x16990f[_0x267a('0x35')])[_0x267a('0x1e')](function(_0x1a6c01){updateTzVoiceQueues(_0x16990f['ListId'])[_0x267a('0x1e')](function(_0x48b063){if(hasTZ)_0x159c38=_0x159c38[_0x267a('0x84')](_0x267a('0x6e'),'dialTimezone,utcOffset');var _0x5cb7c2=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x58b451,_0x50253a,_0x159c38,_0x16990f['ListId'],_0x16990f['CompanyId']||null,NOW,NOW);if(_[_0x267a('0x21')](_0xd8d149[_0x267a('0x47')])){_0x5cb7c2+=_0x267a('0x9e');}_0x26796f['push'](_0x5cb7c2);if(_0x16990f['duplicates']&&_0x16990f[_0x267a('0x97')][_0x267a('0x1c')]){_0x26796f[_0x267a('0x1d')](insertCmContact(_0x16990f[_0x267a('0x35')],_0x50253a,_0x16990f['duplicates'],_0xd8d149));_0x26796f[_0x267a('0x1d')](_0x267a('0x9f')+_0x50253a+';');}BPromise['each'](_0x26796f,handleQuery)['then'](function(_0x8d8e8c){BPromise[_0x267a('0x20')]([handleAdditionalPhones()])[_0x267a('0x1e')](function(){_0x26796f=[];for(var _0x4bbdf6=0x0;_0x4bbdf6_0x57eeb7[_0x2658('0x68')]===_0x4383fa);let _0x3f62c9=contactItemTypes[_0x2658('0x6d')](_0x10848a=>_0x10848a[_0x2658('0x68')]+_0x2658('0x69')===_0x4383fa);if(_[_0x2658('0x1d')](_0x50db6b)&&_[_0x2658('0x1d')](_0x3f62c9)){if(_0x517b2e[_0x2658('0x6e')](_0x4383fa)){if(_0xf1665b['data'][_0x550509][_0x517b2e[_0x4383fa]]){var _0x13e029=_[_0x2658('0x6f')](_0xf1665b[_0x2658('0x6c')][_0x550509][_0x517b2e[_0x4383fa]][_0x2658('0x70')](/"/g,'\x27'));switch(_0x4383fa){case'scheduledat':var _0x335650=moment(_0x13e029,_0x2658('0xc'),!![]);if(_0x335650[_0x2658('0x71')]()){_0x59d09c[_0x2658('0x1e')]('\x22'+_0x13e029+'\x22');}else{_0x107a9e[_0x2658('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2658('0x37'):var _0x405ff4=parseInt(_0x13e029);_0x13e029=_[_0x2658('0x72')](_0x405ff4)||_0x405ff4<0x0||_0x405ff4>0x4?_0x2405e3?0x3:0x2:_0x405ff4;_0x59d09c['push']('\x22'+_0x13e029+'\x22');break;case _0x2658('0x38'):var _0x2f5445=parseInt(_0x13e029);if(_[_0x2658('0x73')](_0x2f5445)&&_[_0x2658('0x74')](_0x55b1ec,_0x2f5445)){_0x59d09c['push']('\x22'+_0x2f5445+'\x22');}else{_0x107a9e['push']('agent\x20not\x20exists');}break;case _0x2658('0x75'):if(isEmail(_0x13e029)){_0x59d09c[_0x2658('0x1e')]('\x22'+_0x13e029+'\x22');}else{_0x107a9e[_0x2658('0x1e')](_0x2658('0x76'));}break;case _0x2658('0x77'):var _0x169817=moment(_0x13e029,_0x2658('0x78'),!![]);if(_0x169817['isValid']()){_0x59d09c['push']('\x22'+_0x13e029+'\x22');}else{_0x107a9e[_0x2658('0x1e')](_0x2658('0x79'));}break;default:_0x59d09c['push']('\x22'+_0x13e029+'\x22');}}else{switch(_0x4383fa){case'firstName':case _0x2658('0x12'):_0x107a9e[_0x2658('0x1e')](_0x4383fa+_0x2658('0x7a'));break;default:_0x59d09c[_0x2658('0x1e')]('\x22\x22');}}}}else{var _0x41b4ee='';if(!_[_0x2658('0x1d')](_0x50db6b)){if(!_0x4267c1[_0x2658('0x6e')](_0x50db6b['id'])){for(var _0x4c526c=0x0;_0x4c526c<_0x517b2e[_0x4383fa]['length'];_0x4c526c++){var _0x13e029=_['trim'](_0xf1665b[_0x2658('0x6c')][_0x550509][_0x517b2e[_0x4383fa][_0x4c526c]][_0x2658('0x70')](/"/g,'\x27'));var _0x152bd0=phoneDescriptions[_0x2658('0x6d')](_0x358ea1=>_0x358ea1['itemTypeId']===_0x50db6b['id']);if(!_[_0x2658('0x1d')](_0x152bd0)){var _0x4318b7=_[_0x2658('0x6f')](_0xf1665b[_0x2658('0x6c')][_0x550509][_0x517b2e[_0x152bd0[_0x2658('0x7b')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x2658('0x1d')](_0x4318b7))_0x13e029=_0x13e029+'§'+_0x4318b7;}if(_0x41b4ee=='')_0x41b4ee=_0x13e029;else _0x41b4ee+='|'+_0x13e029;}_0x4e26f2['push'](_0x50db6b['id']+':'+_0x41b4ee);_0x4267c1[_0x50db6b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x59d09c[_0x2658('0x1e')]('\x22'+_0x4e26f2[_0x2658('0x14')](';')+'\x22');}if(_0x107a9e['length']){handleError(_0xf1665b[_0x2658('0x6c')][_0x550509],{'code':'SystemRow','message':_0x107a9e[_0x2658('0x14')]()});}else{fs[_0x2658('0x7c')](_0x308db5,_0x59d09c[_0x2658('0x14')]()+'\x0a');}_0x59d09c=[];}if(!(stats['rows']%0xc8)){socket[_0x2658('0x7d')]('contact:import:'+_0x1bf0cf,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x2658('0x7e'));_0x3950e8[_0x2658('0x7f')]();}}catch(_0x2711cd){handleError(_0xf1665b[_0x2658('0x6c')][_0x550509],{'code':_0x2658('0x80'),'message':_0x2711cd['message']});logger[_0x2658('0x21')](_0x2658('0x81'),_0x2711cd[_0x2658('0x22')]);}},'complete':function(){try{var _0x15ba41=[];var _0x368696=tempTableName;_0x15ba41[_0x2658('0x1e')](_0x2658('0x82')+_0x368696+'\x20LIKE\x20cm_contacts;');logger['info'](_0x2658('0x83'),contactItemTypes[_0x2658('0x1c')]);var _0x2fa9ce=util['format'](_0x2658('0x84'),_0x308db5,_0x368696,_0x1cc0ed,_0x20a7bb[_0x2658('0x57')],_0x20a7bb[_0x2658('0x58')]||null,NOW,NOW);if(_[_0x2658('0x1d')](_0x517b2e['scheduledat'])){_0x2fa9ce+=_0x2658('0x85');}_0x15ba41[_0x2658('0x1e')](_0x2fa9ce);BPromise[_0x2658('0x86')](_0x15ba41,handleQuery)['then'](function(_0x1a3d83){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x15ba41=[];for(var _0x2a131f=0x0;_0x2a131f\x20\x20');}var _0x40e652=path[_0x2658('0x14')](config[_0x2658('0x92')],_0x2658('0x64'),process['argv'][0x2]);if(!fs[_0x2658('0x93')](_0x40e652)){throw new Error(_0x2658('0x94'));}var _0x19c57f={};try{_0x19c57f=JSON[_0x2658('0x95')](process[_0x2658('0x91')][0x3]);if(!_0x19c57f[_0x2658('0x96')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x3aea50=0x0;if(_0x19c57f[_0x2658('0x96')]['UserId']){_0x3aea50=0x1;}if(!_0x19c57f[_0x2658('0x57')]){throw new Error(_0x2658('0x97'));}}catch(_0x1b0fcb){throw new Error(_0x2658('0x98'));}var _0x5b2fd4=[];try{_0x5b2fd4=_[_0x2658('0x99')](JSON[_0x2658('0x95')](process[_0x2658('0x91')][0x4]),'id');}catch(_0x38c519){logger[_0x2658('0x5d')](_0x2658('0x9a'));}main(_0x40e652,_0x19c57f,_0x5b2fd4,_0x3aea50);}validate();process['on'](_0x2658('0x9b'),handleStop);process['on'](_0x2658('0x9c'),handleUncaughtException); \ No newline at end of file +var _0x94c9=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.updatedAt','cm_hopper_black','createdAt','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','MIN(id)','min_id','group','Received\x20SIGINT','exit','errors','code','message','info','sequelize','catch','send','binding','clone','root','.csv','body','ContactItemType','findAll','name','_description','keys','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','format','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','error','split','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','CmContact','CmHopper'];(function(_0x573f88,_0x1e0023){var _0x12acc0=function(_0x485b0f){while(--_0x485b0f){_0x573f88['push'](_0x573f88['shift']());}};_0x12acc0(++_0x1e0023);}(_0x94c9,0x1b5));var _0x994c=function(_0x2d865e,_0x1f0e3e){_0x2d865e=_0x2d865e-0x0;var _0x48f8f5=_0x94c9[_0x2d865e];return _0x48f8f5;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x994c('0x0'));var moment=require('moment');var squel=require(_0x994c('0x1'));var Redis=require(_0x994c('0x2'));var db=require(_0x994c('0x3'))['db'];var config=require(_0x994c('0x4'));var logger=require(_0x994c('0x5'))(_0x994c('0x6'));config['redis']=_['defaults'](config[_0x994c('0x7')],{'host':_0x994c('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x994c('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x994c('0x9')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x994c('0xa')+moment()[_0x994c('0x9')](_0x994c('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1f7ff0){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x1f7ff0);}function selectNotIn(_0x3a57be,_0x26fddf,_0x2980ce,_0x4828b5,_0x484e01){return squel[_0x994c('0xc')]()[_0x994c('0xd')](_0x994c('0xe'))[_0x994c('0xf')](_0x4828b5)[_0x994c('0x10')](_0x26fddf,null,_0x26fddf+_0x994c('0x11')+_0x4828b5+'.'+_0x2980ce)['where'](_0x4828b5+'.'+_0x2980ce+_0x994c('0x12')+_0x3a57be+'.'+_0x2980ce)['where'](_0x26fddf+_0x994c('0x13')+_0x484e01[_0x994c('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x127091,_0x4c46f0){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x994c('0x14')](_0x994c('0x15')+tempTableName)[_0x994c('0x16')](function(_0x44db3e){if(_0x44db3e!==null){var _0xa1e966=[];for(var _0x4a8ec3=0x0;_0x4a8ec3<_0x44db3e[_0x994c('0x17')];_0x4a8ec3++){var _0x22b2b1=_0x44db3e[_0x4a8ec3];if(!_[_0x994c('0x18')](_0x22b2b1[_0x994c('0xe')])){if(!_[_0x994c('0x18')](_0x22b2b1[_0x994c('0x19')]))_0xa1e966['push'](insertAdditionalPhones(_0x22b2b1));promisesContact[_0x994c('0x1a')]({'contact':_0x22b2b1});}}}Promise[_0x994c('0x1b')](_0xa1e966)[_0x994c('0x1c')](function(){_0x127091({'val':0x1});});})['catch'](function(_0x20c1d7){logger[_0x994c('0x1d')](_0x20c1d7['message']);});});}function insertAdditionalPhones(_0x49fa50){return new Promise(function(_0x508886,_0x334a23){var _0xf57211=_0x49fa50[_0x994c('0x19')];if(_['isNil'](_0xf57211))_0x334a23({'val':0x0});else{var _0x4ea555=_0xf57211[_0x994c('0x1e')](';');var _0x2403d2=[];orderBy=0x0;for(var _0x34e5bf=0x0;_0x34e5bf<_0x4ea555['length'];_0x34e5bf++){_0x2403d2[_0x994c('0x1a')](splitAdditionalPhone(_0x49fa50['id'],_0x4ea555[_0x34e5bf]));}Promise[_0x994c('0x1b')](_0x2403d2)['then'](function(){_0x508886({'val':_0x4ea555['length']});});}});}function splitAdditionalPhone(_0x3118fa,_0x128589){return new Promise(function(_0x2bee37,_0x4d341f){var _0x37ca8f=_0x128589['split'](':');var _0xc13f11=_0x37ca8f[0x0];var _0x311f81=_0x37ca8f[0x1];if(_0x311f81!==''){var _0x4fa616=_0x311f81[_0x994c('0x1e')]('|');var _0x11c1a8=[];for(var _0x23613f=0x0;_0x23613f<_0x4fa616[_0x994c('0x17')];_0x23613f++){if(_0x4fa616[_0x23613f]!==''){var _0x8ff02e=_[_0x994c('0x1f')](promisesAdditionalPhones,{'contactId':_0x3118fa,'phone':_0x4fa616[_0x23613f]});if(_0x8ff02e[_0x994c('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x994c('0x1a')]({'contactId':_0x3118fa,'contactTypeId':_0xc13f11,'phone':_0x4fa616[_0x23613f],'orderBy':orderBy});}}}_0x2bee37({'ok':0x1});}else _0x2bee37({'res':0x0});});}function createAdditionalPhone(_0x3d52f4,_0x3931e8,_0x10de08,_0x18014b){var _0x58c71b='';var _0x41533b='';var _0x3cffb9=_0x10de08[_0x994c('0x1e')]('§');_0x58c71b=_0x3cffb9[0x0];if(_0x3cffb9[_0x994c('0x17')]==0x2)_0x41533b=_0x3cffb9[0x1];return new Promise(function(_0x2865d2,_0x327b94){return db[_0x994c('0x20')][_0x994c('0x21')]({'where':{'CmContactId':_0x3d52f4,'item':_0x58c71b}})[_0x994c('0x1c')](function(_0xdfab08){if(_0xdfab08){return db[_0x994c('0x20')][_0x994c('0x22')]({'ItemTypeId':_0x3931e8,'description':_0x41533b,'OrderBy':_0x18014b},{'where':{'CmContactId':_0x3d52f4,'item':_0x58c71b}})[_0x994c('0x1c')](function(_0x4a3e9a){_0x2865d2({'res':'updated'});});}else{return db[_0x994c('0x20')][_0x994c('0x23')]({'CmContactId':_0x3d52f4,'item':_0x58c71b,'ItemTypeId':_0x3931e8,'description':_0x41533b,'OrderBy':_0x18014b,'ItemClass':_0x994c('0x24')})[_0x994c('0x1c')](function(_0x5c76e5){_0x2865d2({'res':_0x994c('0x25')});});}});});}function updateContact(_0x32c502){return new Promise(function(_0x1be4c8,_0x2d314e){var _0x1230da=_0x32c502['id'];delete _0x32c502['id'];return db[_0x994c('0x26')]['update'](_0x32c502,{'where':{'id':_0x1230da}})[_0x994c('0x1c')](function(_0x392847){updatedRows+=0x1;return db[_0x994c('0x27')][_0x994c('0x22')]({'phone':_0x32c502[_0x994c('0xe')]},{'where':{'ContactId':_0x1230da}})[_0x994c('0x1c')](function(_0x508152){_0x1be4c8({'ret':'OK'});});});});}function insertCmHopper(_0x147ccc,_0x2e621b,_0x3c7229,_0x2b9b08,_0x5385fb){var _0x621b70=[_0x994c('0x28'),'cm_contacts.scheduledat',_0x994c('0x29'),_0x994c('0x2a'),_0x2e621b+'.'+_0x2b9b08,_0x994c('0x2b'),'cm_contacts.updatedAt',_0x994c('0x2c'),_0x994c('0x2d'),'\x22'+_0x5385fb+'\x22'];return squel[_0x994c('0x2e')]()[_0x994c('0x2f')]('cm_hopper')[_0x994c('0x30')]([_0x994c('0xe'),_0x994c('0x31'),_0x994c('0x32'),_0x994c('0x33'),_0x2b9b08,'createdAt',_0x994c('0x34'),_0x994c('0x35'),_0x994c('0x36'),_0x994c('0x37')],squel[_0x994c('0xc')]()[_0x994c('0x38')](_0x621b70)[_0x994c('0xf')](_0x2e621b)['join']('cm_contacts',null,_0x994c('0x39')+_0x2e621b+_0x994c('0x3a'))[_0x994c('0x10')](_0x3c7229,null,_0x3c7229+_0x994c('0x11')+_0x2e621b+'.'+_0x2b9b08)[_0x994c('0x3b')](_0x2e621b+_0x994c('0x3c'),_0x147ccc)[_0x994c('0x3b')](_0x994c('0x3d'),NOW)[_0x994c('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2e621b,_0x3c7229,_0x2b9b08,_0x994c('0x3e'),[_0x994c('0x3f'),_0x994c('0x40')]))['where'](_0x994c('0x41'),selectNotIn(_0x2e621b,_0x3c7229,_0x2b9b08,'cm_hopper',[_0x994c('0x3f')])))[_0x994c('0x42')]();}function insertCmHopperBlack(_0x14f35d,_0x440e8b,_0x2e3a2d,_0x347b2d){var _0xe6407a=[_0x994c('0x28'),'cm_contacts.id',_0x994c('0x2a'),_0x440e8b+'.'+_0x347b2d,_0x994c('0x2b'),_0x994c('0x43')];return squel['insert']()[_0x994c('0x2f')](_0x994c('0x44'))['fromQuery']([_0x994c('0xe'),'ContactId',_0x994c('0x33'),_0x347b2d,_0x994c('0x45'),'updatedAt'],squel[_0x994c('0xc')]()[_0x994c('0x38')](_0xe6407a)[_0x994c('0xf')](_0x440e8b)[_0x994c('0x10')]('cm_contacts',null,_0x994c('0x39')+_0x440e8b+_0x994c('0x3a'))[_0x994c('0x10')](_0x2e3a2d,null,_0x2e3a2d+_0x994c('0x11')+_0x440e8b+'.'+_0x347b2d)[_0x994c('0x3b')](_0x440e8b+_0x994c('0x3c'),_0x14f35d)[_0x994c('0x3b')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x994c('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x994c('0xc')]()[_0x994c('0xd')](_0x994c('0xe'))[_0x994c('0xf')]('cm_hopper_black')[_0x994c('0x3b')](_0x994c('0x46'),_0x14f35d)[_0x994c('0x3b')](_0x347b2d+_0x994c('0x47'),_0x440e8b+'.'+_0x347b2d)))['toString']();}function insertCmHopperAdditionalPhones(_0x33bc10){var _0x224ba1=[_0x994c('0x48'),_0x994c('0x49'),_0x994c('0x4a'),_0x994c('0x4b'),_0x994c('0x4c')];return squel[_0x994c('0x2e')]()['into'](_0x994c('0x4d'))[_0x994c('0x30')](['CmHopperId',_0x994c('0xe'),_0x994c('0x4e'),_0x994c('0x45'),_0x994c('0x34')],squel[_0x994c('0xc')]()[_0x994c('0x38')](_0x224ba1)[_0x994c('0xf')]('cm_hopper')[_0x994c('0x10')](_0x994c('0x4f'),null,_0x994c('0x50'))['join'](_0x994c('0x51'),null,_0x994c('0x52'))[_0x994c('0x3b')](_0x994c('0x53'),_0x33bc10)[_0x994c('0x3b')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x994c('0x42')]();}function insertCmContact(_0x5766b2,_0x15fb3b,_0x17ba6f,_0x33265f){var _0x4d672f=_[_0x994c('0x54')](_['keys'](_0x33265f),[_0x994c('0x33'),_0x994c('0x55'),_0x994c('0x45'),_0x994c('0x34')]);return squel[_0x994c('0x2e')]()[_0x994c('0x2f')](_0x994c('0x4f'))['fromQuery'](_0x4d672f,squel[_0x994c('0xc')]()[_0x994c('0x38')](_0x4d672f)['from'](_0x15fb3b)[_0x994c('0x3b')]('('+_0x17ba6f[_0x994c('0x10')](',')+')\x20NOT\x20IN\x20?',squel[_0x994c('0xc')]()[_0x994c('0x38')](_0x17ba6f)['from'](_0x994c('0x4f'))[_0x994c('0x3b')](_0x994c('0x46'),_0x5766b2))[_0x994c('0x3b')]('id\x20IN\x20?',squel['select']()[_0x994c('0xd')](_0x994c('0x56'),_0x994c('0x57'))[_0x994c('0xf')](_0x15fb3b)[_0x994c('0x58')](_0x17ba6f[_0x994c('0x10')](','))))['toString']();}function handleStop(){logger['info'](_0x994c('0x59'));stopped=!![];}function handleUncaughtException(_0x4c12bb){logger['error'](_0x4c12bb['message']);process[_0x994c('0x5a')](0x1);}function handleError(_0x5b12a3,_0x452609){stats[_0x994c('0x5b')][_0x994c('0x1a')]({'name':_0x452609[_0x994c('0x5c')],'message':_0x452609[_0x994c('0x5d')],'row':_0x5b12a3});}function handleQuery(_0x4e9a0b){logger[_0x994c('0x5e')](_0x4e9a0b);return db[_0x994c('0x5f')][_0x994c('0x14')](_0x4e9a0b)[_0x994c('0x16')](function(_0x419c9d){results[_0x994c('0x1a')](_0x419c9d);})[_0x994c('0x60')](function(_0x252df1){logger[_0x994c('0x1d')](_0x252df1[_0x994c('0x5d')]);});}function main(_0x4753c7,_0x84bd69,_0x264cd6,_0x204ced){logger[_0x994c('0x5e')]('main',_0x4753c7,JSON['stringify'](_0x84bd69));process[_0x994c('0x61')]('start');var _0x48988a=_0x84bd69[_0x994c('0x62')];var _0x596b9b=_[_0x994c('0x63')](_0x48988a);var _0x2c9d69=_0x84bd69['socket_timestamp'];var _0x22d1e1=path[_0x994c('0x10')](config[_0x994c('0x64')],'server/files/tmp',_0x2c9d69+_0x994c('0x65'));logger[_0x994c('0x5e')](_0x994c('0x66'),_0x84bd69);db[_0x994c('0x67')][_0x994c('0x68')]({'raw':!![],'attributes':['id',_0x994c('0x69')]})[_0x994c('0x1c')](function(_0x5569e5){for(var _0x57dd4a=0x0;_0x57dd4a<_0x5569e5['length'];_0x57dd4a++){if(_0x5569e5[_0x57dd4a][_0x994c('0x69')]in _0x48988a){contactItemTypes[_0x994c('0x1a')](_0x5569e5[_0x57dd4a]);delete _0x596b9b[_0x5569e5[_0x57dd4a][_0x994c('0x69')]];hasAdditionalPhones=!![];}for(var _0x4a8f79 in _0x48988a){if(_0x5569e5[_0x57dd4a][_0x994c('0x69')]+_0x994c('0x6a')===_0x4a8f79){phoneDescriptions['push']({'itemTypeId':_0x5569e5[_0x57dd4a]['id'],'description':_0x4a8f79});delete _0x596b9b[_0x4a8f79];}}}if(hasAdditionalPhones)_0x596b9b['AdditionalPhones']='';var _0x131e0f=_[_0x994c('0x6b')](_0x596b9b)[_0x994c('0x10')]();logger[_0x994c('0x5e')](_0x994c('0x6c'),_0x131e0f);fs[_0x994c('0x6d')](_0x22d1e1,_0x131e0f+'\x0a');Papa[_0x994c('0x6e')](fs[_0x994c('0x6f')](_0x4753c7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x31e6d5,_0x54c6f3){try{for(var _0x3c33a8=0x0,_0x45274a=[];_0x3c33a8<_0x31e6d5[_0x994c('0x70')][_0x994c('0x17')];_0x3c33a8++){stats[_0x994c('0x71')]+=0x1;if(_0x31e6d5[_0x994c('0x5b')][_0x3c33a8]){handleError(_0x31e6d5[_0x994c('0x70')][_0x3c33a8],_0x31e6d5[_0x994c('0x5b')][_0x3c33a8]);}else{var _0x379218=[];var _0x13789e=[];var _0x3c6207={};for(var _0x225762 in _0x48988a){let _0x32657c=contactItemTypes[_0x994c('0x72')](_0xe7e40c=>_0xe7e40c[_0x994c('0x69')]===_0x225762);let _0x1c4b8e=contactItemTypes[_0x994c('0x72')](_0x3eea61=>_0x3eea61[_0x994c('0x69')]+_0x994c('0x6a')===_0x225762);if(_[_0x994c('0x18')](_0x32657c)&&_[_0x994c('0x18')](_0x1c4b8e)){if(_0x48988a[_0x994c('0x73')](_0x225762)){if(_0x31e6d5[_0x994c('0x70')][_0x3c33a8][_0x48988a[_0x225762]]){var _0x23e30f=_[_0x994c('0x74')](_0x31e6d5[_0x994c('0x70')][_0x3c33a8][_0x48988a[_0x225762]][_0x994c('0x75')](/"/g,'\x27'));switch(_0x225762){case _0x994c('0x31'):var _0x200c75=moment(_0x23e30f,_0x994c('0x76'),!![]);if(_0x200c75[_0x994c('0x77')]()){_0x45274a['push']('\x22'+_0x23e30f+'\x22');}else{_0x379218[_0x994c('0x1a')](_0x994c('0x78'));}break;case _0x994c('0x35'):var _0x1b8abe=parseInt(_0x23e30f);_0x23e30f=_[_0x994c('0x79')](_0x1b8abe)||_0x1b8abe<0x0||_0x1b8abe>0x4?_0x204ced?0x3:0x2:_0x1b8abe;_0x45274a[_0x994c('0x1a')]('\x22'+_0x23e30f+'\x22');break;case _0x994c('0x36'):var _0x776873=parseInt(_0x23e30f);if(_[_0x994c('0x7a')](_0x776873)&&_['includes'](_0x264cd6,_0x776873)){_0x45274a[_0x994c('0x1a')]('\x22'+_0x776873+'\x22');}else{_0x379218[_0x994c('0x1a')]('agent\x20not\x20exists');}break;case _0x994c('0x7b'):if(isEmail(_0x23e30f)){_0x45274a[_0x994c('0x1a')]('\x22'+_0x23e30f+'\x22');}else{_0x379218[_0x994c('0x1a')](_0x994c('0x7c'));}break;case _0x994c('0x7d'):var _0x14d4cb=moment(_0x23e30f,_0x994c('0x7e'),!![]);if(_0x14d4cb[_0x994c('0x77')]()){_0x45274a['push']('\x22'+_0x23e30f+'\x22');}else{_0x379218['push'](_0x994c('0x7f'));}break;default:_0x45274a[_0x994c('0x1a')]('\x22'+_0x23e30f+'\x22');}}else{switch(_0x225762){case _0x994c('0x80'):case _0x994c('0xe'):_0x379218[_0x994c('0x1a')](_0x225762+_0x994c('0x81'));break;default:_0x45274a[_0x994c('0x1a')]('\x22\x22');}}}}else{var _0x6fcd52='';if(!_[_0x994c('0x18')](_0x32657c)){if(!_0x3c6207[_0x994c('0x73')](_0x32657c['id'])){for(var _0x5c7555=0x0;_0x5c7555<_0x48988a[_0x225762][_0x994c('0x17')];_0x5c7555++){var _0x23e30f=_[_0x994c('0x74')](_0x31e6d5[_0x994c('0x70')][_0x3c33a8][_0x48988a[_0x225762][_0x5c7555]]['replace'](/"/g,'\x27'));var _0x79e895=phoneDescriptions['find'](_0x2825ae=>_0x2825ae[_0x994c('0x82')]===_0x32657c['id']);if(!_[_0x994c('0x18')](_0x79e895)){var _0x1bb164=_[_0x994c('0x74')](_0x31e6d5['data'][_0x3c33a8][_0x48988a[_0x79e895[_0x994c('0x83')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x994c('0x18')](_0x1bb164))_0x23e30f=_0x23e30f+'§'+_0x1bb164;}if(_0x6fcd52=='')_0x6fcd52=_0x23e30f;else _0x6fcd52+='|'+_0x23e30f;}_0x13789e[_0x994c('0x1a')](_0x32657c['id']+':'+_0x6fcd52);_0x3c6207[_0x32657c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45274a[_0x994c('0x1a')]('\x22'+_0x13789e[_0x994c('0x10')](';')+'\x22');}if(_0x379218[_0x994c('0x17')]){handleError(_0x31e6d5[_0x994c('0x70')][_0x3c33a8],{'code':_0x994c('0x84'),'message':_0x379218[_0x994c('0x10')]()});}else{fs[_0x994c('0x85')](_0x22d1e1,_0x45274a['join']()+'\x0a');}_0x45274a=[];}if(!(stats['rows']%0xc8)){socket[_0x994c('0x86')](_0x994c('0x87')+_0x2c9d69,stats);stats[_0x994c('0x5b')]=[];}}if(stopped){logger[_0x994c('0x5e')]('Abort\x20parser');_0x54c6f3[_0x994c('0x88')]();}}catch(_0x3f6494){handleError(_0x31e6d5['data'][_0x3c33a8],{'code':_0x994c('0x89'),'message':_0x3f6494[_0x994c('0x5d')]});logger['error']('step',_0x3f6494[_0x994c('0x5d')]);}},'complete':function(){try{var _0x280bd8=[];var _0x2827db=tempTableName;_0x280bd8[_0x994c('0x1a')](_0x994c('0x8a')+_0x2827db+_0x994c('0x8b'));logger['info'](_0x994c('0x8c'),contactItemTypes[_0x994c('0x17')]);var _0xf533eb=util['format'](_0x994c('0x8d'),_0x22d1e1,_0x2827db,_0x131e0f,_0x84bd69['ListId'],_0x84bd69[_0x994c('0x55')]||null,NOW,NOW);if(_[_0x994c('0x18')](_0x48988a['scheduledat'])){_0xf533eb+=_0x994c('0x8e');}_0x280bd8['push'](_0xf533eb);BPromise[_0x994c('0x8f')](_0x280bd8,handleQuery)['then'](function(_0x580dd8){BPromise[_0x994c('0x1b')]([handleAdditionalPhones()])[_0x994c('0x1c')](function(){_0x280bd8=[];for(var _0x205893=0x0;_0x205893\x20\x20');}var _0x4e06ea=path[_0x994c('0x10')](config[_0x994c('0x64')],_0x994c('0x98'),process['argv'][0x2]);if(!fs[_0x994c('0x99')](_0x4e06ea)){throw new Error(_0x994c('0x9a'));}var _0x1a23cf={};try{_0x1a23cf=JSON[_0x994c('0x6e')](process['argv'][0x3]);if(!_0x1a23cf['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x1ee1e5=0x0;if(_0x1a23cf['binding'][_0x994c('0x36')]){_0x1ee1e5=0x1;}if(!_0x1a23cf['ListId']){throw new Error(_0x994c('0x9b'));}}catch(_0x3f404f){throw new Error(_0x994c('0x9c'));}var _0x32fa0b=[];try{_0x32fa0b=_[_0x994c('0x9d')](JSON['parse'](process[_0x994c('0x97')][0x4]),'id');}catch(_0x43fe40){logger[_0x994c('0x5e')]('No\x20agent\x20available');}main(_0x4e06ea,_0x1a23cf,_0x32fa0b,_0x1ee1e5);}validate();process['on'](_0x994c('0x9e'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 287844c..2e76eaa 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6715=['push','queue','calleridnum','outbound','Outbound\x20Call','variable','destcalleridnum','getDescriptions','voice','inbound','Caller\x20Number','Caller\x20Name','calleridname','keyValue','Queue','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','membername','UniqueId','uniqueid','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase'];(function(_0x1fff7d,_0x1146c0){var _0x2ce994=function(_0x16ee3e){while(--_0x16ee3e){_0x1fff7d['push'](_0x1fff7d['shift']());}};_0x2ce994(++_0x1146c0);}(_0x6715,0x104));var _0x5671=function(_0x374088,_0x235870){_0x374088=_0x374088-0x0;var _0x3f4de1=_0x6715[_0x374088];return _0x3f4de1;};'use strict';exports[_0x5671('0x0')]=function(_0x40bd89,_0x42d649){var _0x4ab322=[{'type':_0x5671('0x1'),'content':_0x5671('0x2'),'variableName':null}];switch(_0x40bd89[_0x5671('0x3')]()){case'voice':switch(_0x42d649[_0x5671('0x3')]()){case'inbound':_0x4ab322[_0x5671('0x4')]({'type':'variable','content':'','variableName':_0x5671('0x5')});_0x4ab322[_0x5671('0x4')]({'type':'variable','content':'','variableName':_0x5671('0x6')});break;case _0x5671('0x7'):_0x4ab322[_0x5671('0x4')]({'type':_0x5671('0x1'),'content':_0x5671('0x8'),'variableName':null});_0x4ab322['push']({'type':_0x5671('0x9'),'content':'','variableName':_0x5671('0xa')});break;}}return _0x4ab322;};exports[_0x5671('0xb')]=function(_0x5a9ae5,_0x140b9e){var _0x4cb9af=[];switch(_0x5a9ae5[_0x5671('0x3')]()){case _0x5671('0xc'):switch(_0x140b9e[_0x5671('0x3')]()){case _0x5671('0xd'):_0x4cb9af=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x5671('0xe'),'keyType':_0x5671('0x9'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0x5671('0xf'),'keyType':_0x5671('0x9'),'variableName':_0x5671('0x10')},{'type':_0x5671('0x11'),'content':'','key':'Call\x20To','keyType':_0x5671('0x9'),'variableName':'destexten'},{'type':_0x5671('0x11'),'content':'','key':_0x5671('0x12'),'keyType':_0x5671('0x9'),'variableName':_0x5671('0x5')},{'type':_0x5671('0x11'),'content':'','key':'UniqueId','keyType':_0x5671('0x9'),'variableName':'uniqueid'},{'type':_0x5671('0x11'),'content':'','key':_0x5671('0x13'),'keyType':_0x5671('0x9'),'variableName':_0x5671('0x14')},{'type':_0x5671('0x1'),'content':_0x5671('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x5671('0x16'),'keyType':'variable','variableName':_0x5671('0x17')},{'type':'keyValue','content':'','key':_0x5671('0x18'),'keyType':_0x5671('0x9'),'variableName':'destcalleridnum'},{'type':_0x5671('0x1'),'content':_0x5671('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x5671('0x11'),'content':'','key':_0x5671('0x1a'),'keyType':_0x5671('0x9'),'variableName':_0x5671('0x14')},{'type':'keyValue','content':'','key':_0x5671('0x1b'),'keyType':_0x5671('0x9'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0x5671('0x1c'),'keyType':_0x5671('0x9'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':'Hold\x20Time','keyType':_0x5671('0x9'),'variableName':_0x5671('0x1d')},{'type':_0x5671('0x11'),'content':'','key':_0x5671('0x1e'),'keyType':_0x5671('0x9'),'variableName':_0x5671('0x1f')}];break;case'outbound':_0x4cb9af=[{'type':_0x5671('0x1'),'content':_0x5671('0x20'),'variableName':null},{'type':_0x5671('0x11'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0x5671('0x11'),'content':'','key':'Member\x20Name','keyType':_0x5671('0x9'),'keyContent':'','variableName':_0x5671('0x21')},{'type':_0x5671('0x11'),'content':'','key':_0x5671('0x22'),'keyType':'variable','keyContent':'','variableName':_0x5671('0x23')},{'type':_0x5671('0x11'),'content':'','key':'Date','keyType':_0x5671('0x9'),'keyContent':'','variableName':_0x5671('0x24')},{'type':_0x5671('0x1'),'content':_0x5671('0x19')},{'type':_0x5671('0x11'),'content':'','key':_0x5671('0x25'),'keyType':_0x5671('0x9'),'keyContent':'','variableName':'answertime'},{'type':_0x5671('0x11'),'content':'','key':_0x5671('0x26'),'keyType':_0x5671('0x9'),'keyContent':'','variableName':_0x5671('0x27')},{'type':_0x5671('0x11'),'content':'','key':_0x5671('0x28'),'keyType':_0x5671('0x9'),'keyContent':'','variableName':_0x5671('0x29')},{'type':_0x5671('0x11'),'content':'','key':_0x5671('0x2a'),'keyType':_0x5671('0x9'),'keyContent':'','variableName':_0x5671('0x2b')}];break;}}return _0x4cb9af;}; \ No newline at end of file +var _0xd98e=['***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','UniqueId','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','calleridname','Call\x20To','Queue','Date','agentcalledAt'];(function(_0x592ef0,_0x4f7cc0){var _0x105767=function(_0x1768f8){while(--_0x1768f8){_0x592ef0['push'](_0x592ef0['shift']());}};_0x105767(++_0x4f7cc0);}(_0xd98e,0x15a));var _0xed98=function(_0x56aea0,_0x9871b0){_0x56aea0=_0x56aea0-0x0;var _0x48d19c=_0xd98e[_0x56aea0];return _0x48d19c;};'use strict';exports[_0xed98('0x0')]=function(_0x347c4e,_0x5c0e7b){var _0x2055b7=[{'type':_0xed98('0x1'),'content':_0xed98('0x2'),'variableName':null}];switch(_0x347c4e['toLowerCase']()){case _0xed98('0x3'):switch(_0x5c0e7b[_0xed98('0x4')]()){case _0xed98('0x5'):_0x2055b7[_0xed98('0x6')]({'type':_0xed98('0x7'),'content':'','variableName':_0xed98('0x8')});_0x2055b7[_0xed98('0x6')]({'type':_0xed98('0x7'),'content':'','variableName':_0xed98('0x9')});break;case _0xed98('0xa'):_0x2055b7[_0xed98('0x6')]({'type':'string','content':_0xed98('0xb'),'variableName':null});_0x2055b7['push']({'type':_0xed98('0x7'),'content':'','variableName':_0xed98('0xc')});break;}}return _0x2055b7;};exports[_0xed98('0xd')]=function(_0x58a316,_0x1aac87){var _0x1233f9=[];switch(_0x58a316['toLowerCase']()){case _0xed98('0x3'):switch(_0x1aac87[_0xed98('0x4')]()){case _0xed98('0x5'):_0x1233f9=[{'type':'string','content':_0xed98('0xe'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xed98('0xf'),'keyType':_0xed98('0x7'),'variableName':_0xed98('0x9')},{'type':_0xed98('0x10'),'content':'','key':'Caller\x20Name','keyType':_0xed98('0x7'),'variableName':_0xed98('0x11')},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x12'),'keyType':_0xed98('0x7'),'variableName':'destexten'},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x13'),'keyType':_0xed98('0x7'),'variableName':_0xed98('0x8')},{'type':_0xed98('0x10'),'content':'','key':'UniqueId','keyType':_0xed98('0x7'),'variableName':'uniqueid'},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x14'),'keyType':_0xed98('0x7'),'variableName':_0xed98('0x15')},{'type':'string','content':_0xed98('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x17'),'keyType':_0xed98('0x7'),'variableName':'destcalleridname'},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x18'),'keyType':_0xed98('0x7'),'variableName':_0xed98('0xc')},{'type':_0xed98('0x1'),'content':_0xed98('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xed98('0x10'),'content':'','key':'Agent\x20Ring','keyType':_0xed98('0x7'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0xed98('0x1a'),'keyType':_0xed98('0x7'),'variableName':_0xed98('0x1b')},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x1c'),'keyType':_0xed98('0x7'),'variableName':_0xed98('0x1d')},{'type':'keyValue','content':'','key':_0xed98('0x1e'),'keyType':'variable','variableName':_0xed98('0x1f')},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x20'),'keyType':_0xed98('0x7'),'variableName':_0xed98('0x21')}];break;case _0xed98('0xa'):_0x1233f9=[{'type':_0xed98('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xed98('0x10'),'content':'','key':'Called\x20Number','keyType':_0xed98('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0xed98('0x22'),'keyType':_0xed98('0x7'),'keyContent':'','variableName':'membername'},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x23'),'keyType':_0xed98('0x7'),'keyContent':'','variableName':_0xed98('0x24')},{'type':'keyValue','content':'','key':_0xed98('0x14'),'keyType':_0xed98('0x7'),'keyContent':'','variableName':_0xed98('0x25')},{'type':_0xed98('0x1'),'content':_0xed98('0x19')},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x26'),'keyType':_0xed98('0x7'),'keyContent':'','variableName':_0xed98('0x27')},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x28'),'keyType':'variable','keyContent':'','variableName':_0xed98('0x29')},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x2a'),'keyType':_0xed98('0x7'),'keyContent':'','variableName':_0xed98('0x2b')},{'type':_0xed98('0x10'),'content':'','key':_0xed98('0x2c'),'keyType':'variable','keyContent':'','variableName':_0xed98('0x2d')}];break;}}return _0x1233f9;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index f2268c8..abb98fc 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84a7=['body','contact','fields','filter','user','having','read','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count','length','clause','order','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','tracked','clone','omit','html','phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseQueryParameters','where'];(function(_0x5688f0,_0x3fce94){var _0x15121b=function(_0x1ab36f){while(--_0x1ab36f){_0x5688f0['push'](_0x5688f0['shift']());}};_0x15121b(++_0x3fce94);}(_0x84a7,0x178));var _0x784a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x84a7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x784a('0x0'));var sqlUtils=require(_0x784a('0x1'));var utils=require(_0x784a('0x2'));exports[_0x784a('0x3')]=function(_0x1bcf5c,_0x5dfdc1,_0x795aaa,_0x5f99d,_0x1e0d70){var _0x1ae253={'count':0x0,'rows':[]};var _0x6d7a34=sqlUtils[_0x784a('0x4')](_0x1bcf5c,_0x795aaa,_0x5dfdc1);if(_0x6d7a34){return Promise[_0x784a('0x5')](_0x1ae253);}var _0x13cb51=sqlUtils[_0x784a('0x6')](_0x1bcf5c);var _0x3c6e8={};return Promise[_0x784a('0x5')]()[_0x784a('0x7')](function(){if(_0x5dfdc1[_0x784a('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x5dfdc1['search'],_0x1e0d70);}else{return sqlUtils[_0x784a('0x9')](_0x1bcf5c,_0x5dfdc1,_0x1e0d70);}})['then'](function(_0x257d8b){_0x13cb51[_0x784a('0xa')](_0x257d8b[_0x784a('0xb')]);_0x13cb51[_0x784a('0xa')](_0x257d8b[_0x784a('0xc')]);_0x13cb51[_0x784a('0xa')](_0x257d8b['default']);_0x13cb51['where'](_0x257d8b[_0x784a('0xd')]);_0x13cb51[_0x784a('0xa')](_0x257d8b[_0x784a('0xe')]);_0x13cb51[_0x784a('0xa')](_0x257d8b[_0x784a('0xf')]);_0x13cb51[_0x784a('0x10')](_0x257d8b[_0x784a('0x11')]);_0x3c6e8=_0x257d8b[_0x784a('0x12')];return sqlUtils[_0x784a('0x13')](_0x1bcf5c,_0x795aaa,_0x5dfdc1);})[_0x784a('0x7')](function(_0x13c6f1){_0x13cb51['where'](_0x13c6f1);_0x13cb51[_0x784a('0x14')](_0x784a('0x15'));var _0x4ba18a=_0x5dfdc1[_0x784a('0x8')]?_0x3c6e8[_0x784a('0x16')]:_0x5dfdc1[_0x784a('0x17')];return sqlUtils[_0x784a('0x18')](_0x13cb51,_0x4ba18a);})[_0x784a('0x7')](function(_0xa8599c){_0x1ae253[_0x784a('0x19')]=_0xa8599c[_0x784a('0x1a')];if(_0x1ae253[_0x784a('0x19')]===0x0){return[];}_0x13cb51[_0x784a('0x10')](_0x3c6e8[_0x784a('0x1b')]);if(_0x5f99d[_0x784a('0x1c')]){_0x5f99d[_0x784a('0x1c')]['forEach'](function(_0x27bcc4){var _0x1c1843=_0x27bcc4[0x0]==='contactName'?_0x27bcc4[0x0]:'i.'+_0x27bcc4[0x0];_0x13cb51[_0x784a('0x1c')](_0x1c1843,_0x27bcc4[0x1]===_0x784a('0x1d')?![]:!![]);if(_0x27bcc4[0x0]===_0x784a('0x1e')){var _0x29fffe=sqlUtils[_0x784a('0x1f')](_0x1bcf5c,_0x5dfdc1);_0x13cb51[_0x784a('0x1c')](_0x29fffe,_0x27bcc4[0x1]===_0x784a('0x1d')?![]:!![]);}});}return sqlUtils[_0x784a('0x20')](_0x1bcf5c,_0x13cb51,_0x5dfdc1,_0x5f99d);})['then'](function(_0x98cbad){_0x1ae253[_0x784a('0x21')]=_0x98cbad;return _0x1ae253;})[_0x784a('0x22')](function(_0x3403eb){throw _0x3403eb;});};exports[_0x784a('0x23')]=function(_0x458ba7,_0xe43764){return function(_0x413a4e,_0xa3349f,_0x460750){var _0x17c6dc=_0x413a4e[_0x784a('0xf')];var _0xfc0e0d={};var _0x9e0cd7=_0x413a4e['query'];if(_0xfc0e0d){_0xfc0e0d=_[_0x784a('0x24')](_0x413a4e[_0x784a('0xb')]);_0xfc0e0d=_[_0x784a('0x25')](_0xfc0e0d,['body',_0x784a('0x26'),_0x784a('0x27'),_0x784a('0x28'),_0x784a('0x29')]);}utils[_0x784a('0x2a')](_0x17c6dc,_0xfc0e0d,_0x9e0cd7,_0x458ba7,_0xe43764);_0x460750(null);};}; \ No newline at end of file +var _0xed10=['having','tags','checkAccountsRestrictions','group','i.id','tag','count','length','clause','order','forEach','contactName','DESC','closed','getFilteredInteractions','rows','catch','tracked','query','clone','body','omit','phone','fax','mobile','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','contact','default','fields','filter','user'];(function(_0x3328b4,_0x403a24){var _0x530143=function(_0x53db2a){while(--_0x53db2a){_0x3328b4['push'](_0x3328b4['shift']());}};_0x530143(++_0x403a24);}(_0xed10,0x6d));var _0x0ed1=function(_0x21b037,_0x1f310a){_0x21b037=_0x21b037-0x0;var _0x20556c=_0xed10[_0x21b037];return _0x20556c;};'use strict';var _=require(_0x0ed1('0x0'));var sqlUtils=require(_0x0ed1('0x1'));var utils=require(_0x0ed1('0x2'));exports[_0x0ed1('0x3')]=function(_0x83f23e,_0x49d66a,_0x29fd10,_0xc65f26,_0x545ac5){var _0x397847={'count':0x0,'rows':[]};var _0x2941b6=sqlUtils[_0x0ed1('0x4')](_0x83f23e,_0x29fd10,_0x49d66a);if(_0x2941b6){return Promise[_0x0ed1('0x5')](_0x397847);}var _0x1c1751=sqlUtils[_0x0ed1('0x6')](_0x83f23e);var _0x5ef2d9={};return Promise[_0x0ed1('0x5')]()[_0x0ed1('0x7')](function(){if(_0x49d66a[_0x0ed1('0x8')]){return sqlUtils[_0x0ed1('0x9')](_0x49d66a[_0x0ed1('0x8')],_0x545ac5);}else{return sqlUtils[_0x0ed1('0xa')](_0x83f23e,_0x49d66a,_0x545ac5);}})['then'](function(_0x2e97a2){_0x1c1751[_0x0ed1('0xb')](_0x2e97a2['body']);_0x1c1751[_0x0ed1('0xb')](_0x2e97a2[_0x0ed1('0xc')]);_0x1c1751['where'](_0x2e97a2[_0x0ed1('0xd')]);_0x1c1751[_0x0ed1('0xb')](_0x2e97a2[_0x0ed1('0xe')]);_0x1c1751[_0x0ed1('0xb')](_0x2e97a2[_0x0ed1('0xf')]);_0x1c1751[_0x0ed1('0xb')](_0x2e97a2[_0x0ed1('0x10')]);_0x1c1751[_0x0ed1('0x11')](_0x2e97a2['read']);_0x5ef2d9=_0x2e97a2[_0x0ed1('0x12')];return sqlUtils[_0x0ed1('0x13')](_0x83f23e,_0x29fd10,_0x49d66a);})[_0x0ed1('0x7')](function(_0x42a051){_0x1c1751['where'](_0x42a051);_0x1c1751[_0x0ed1('0x14')](_0x0ed1('0x15'));var _0x2aba64=_0x49d66a[_0x0ed1('0x8')]?_0x5ef2d9['ids']:_0x49d66a[_0x0ed1('0x16')];return sqlUtils['countFilteredInteractions'](_0x1c1751,_0x2aba64);})['then'](function(_0xf23a48){_0x397847[_0x0ed1('0x17')]=_0xf23a48[_0x0ed1('0x18')];if(_0x397847[_0x0ed1('0x17')]===0x0){return[];}_0x1c1751[_0x0ed1('0x11')](_0x5ef2d9[_0x0ed1('0x19')]);if(_0xc65f26[_0x0ed1('0x1a')]){_0xc65f26[_0x0ed1('0x1a')][_0x0ed1('0x1b')](function(_0x2742a6){var _0x56a73e=_0x2742a6[0x0]===_0x0ed1('0x1c')?_0x2742a6[0x0]:'i.'+_0x2742a6[0x0];_0x1c1751[_0x0ed1('0x1a')](_0x56a73e,_0x2742a6[0x1]===_0x0ed1('0x1d')?![]:!![]);if(_0x2742a6[0x0]===_0x0ed1('0x1e')){var _0xa77139=sqlUtils['getClosedOrderClause'](_0x83f23e,_0x49d66a);_0x1c1751[_0x0ed1('0x1a')](_0xa77139,_0x2742a6[0x1]===_0x0ed1('0x1d')?![]:!![]);}});}return sqlUtils[_0x0ed1('0x1f')](_0x83f23e,_0x1c1751,_0x49d66a,_0xc65f26);})[_0x0ed1('0x7')](function(_0x2b015d){_0x397847[_0x0ed1('0x20')]=_0x2b015d;return _0x397847;})[_0x0ed1('0x21')](function(_0x458150){throw _0x458150;});};exports[_0x0ed1('0x22')]=function(_0x1b0df1,_0x386567){return function(_0x13afcd,_0x386628,_0x1463d5){var _0x263a82=_0x13afcd['user'];var _0x46a44d={};var _0x50e350=_0x13afcd[_0x0ed1('0x23')];if(_0x46a44d){_0x46a44d=_[_0x0ed1('0x24')](_0x13afcd[_0x0ed1('0x25')]);_0x46a44d=_[_0x0ed1('0x26')](_0x46a44d,[_0x0ed1('0x25'),'html',_0x0ed1('0x27'),_0x0ed1('0x28'),_0x0ed1('0x29')]);}utils['updateUser'](_0x263a82,_0x46a44d,_0x50e350,_0x1b0df1,_0x386567);_0x1463d5(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 3acb048..04c37a6 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb876=['{OPERATOR}','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','fax','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','length','conditions','find','default','text','value','start','end','unreadMessages','Contact','operator','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','contact','Tag','map','tags','clause','and','ids','user','UserId','body','plainBody','forEach','\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','then','tag','filter','get','capitalize','chat','Websites','resolve','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Sequelize','SELECT','sequelize','query','toString','keyBy','fields','attributes','a.key','Account.key','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','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','Contact.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','offset','groupBy','Setting','findOne','enableEmailPreview','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','updateInteraction','../../mysqldb','getAccountFK','role','search','select','field','name','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','where','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','unreadMessages\x20{OPERATOR}\x200','replace'];(function(_0x1b5812,_0x5c31e3){var _0x3099b4=function(_0x179696){while(--_0x179696){_0x1b5812['push'](_0x1b5812['shift']());}};_0x3099b4(++_0x5c31e3);}(_0xb876,0x119));var _0x6b87=function(_0x349694,_0x5643e8){_0x349694=_0x349694-0x0;var _0x2e99bd=_0xb876[_0x349694];return _0x2e99bd;};'use strict';var _=require(_0x6b87('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x6b87('0x1')];var utils=require('./utils');var db=require(_0x6b87('0x2'))['db'];function skipInteractionsQuery(_0xe8c4b4,_0x2eef84,_0x2333c3){var _0x40ee25=![];var _0x1cb092=utils[_0x6b87('0x3')](_0xe8c4b4);if(_0x2eef84[_0x6b87('0x4')]==='agent'&&!_0x2333c3[_0x6b87('0x5')]&&!_0x2333c3[_0x1cb092]){_0x40ee25=!![];}return _0x40ee25;}function getTagsQuery(){return squel[_0x6b87('0x6')]()[_0x6b87('0x7')]('id')[_0x6b87('0x7')](_0x6b87('0x8'))[_0x6b87('0x7')]('color')['from']('tools_tags');}function getUsersQuery(_0x1dddbb,_0x24fd97){var _0x3c8bc8=utils[_0x6b87('0x9')](_0x1dddbb);var _0x487de3=_0x6b87('0xa')+_0x1dddbb+_0x6b87('0xb');var _0x22a7ea=squel[_0x6b87('0x6')]()[_0x6b87('0x7')](_0x6b87('0xc'))[_0x6b87('0x7')](_0x6b87('0xd'))[_0x6b87('0x7')](_0x6b87('0xe')+_0x3c8bc8)[_0x6b87('0xf')](_0x487de3,'ui')[_0x6b87('0x10')](_0x6b87('0x11'),'u',_0x6b87('0x12'));if(_0x24fd97['length']>0x0){_0x22a7ea[_0x6b87('0x13')](_0x6b87('0xe')+_0x3c8bc8+'\x20IN\x20?',_['map'](_0x24fd97,'id'));}return _0x22a7ea;}function getInteractionsQuery(_0x349830){var _0x52f044=utils[_0x6b87('0x14')](_0x349830);var _0x1182cd=utils[_0x6b87('0x3')](_0x349830);var _0x1e8f35=utils[_0x6b87('0x9')](_0x349830);return squel[_0x6b87('0x6')]()[_0x6b87('0xf')](_0x52f044[_0x6b87('0x15')],'i')[_0x6b87('0x10')](_0x6b87('0x16'),'c',_0x6b87('0x17'))[_0x6b87('0x10')](_0x6b87('0x11'),'o',_0x6b87('0x18'))[_0x6b87('0x10')](_0x52f044[_0x6b87('0x19')],'a','a.id\x20=\x20i.'+_0x1182cd)['left_join'](_0x52f044[_0x6b87('0x1a')],'me',_0x6b87('0x1b')+_0x1e8f35+_0x6b87('0x1c'))[_0x6b87('0x10')](_0x52f044[_0x6b87('0x1d')],'it',_0x6b87('0x1e')+_0x1e8f35+'\x20=\x20i.id')[_0x6b87('0x10')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x2bae9d={'body':squel[_0x6b87('0x1f')](),'contact':squel[_0x6b87('0x1f')](),'default':squel[_0x6b87('0x1f')](),'fields':squel[_0x6b87('0x1f')](),'filter':squel[_0x6b87('0x1f')](),'read':squel[_0x6b87('0x1f')](),'tags':{'clause':squel[_0x6b87('0x1f')](),'ids':null},'user':squel[_0x6b87('0x1f')]()};return _0x2bae9d;}function parseTagParameter(_0x4c5d3e){var _0x401a30=squel[_0x6b87('0x1f')]();if(_0x4c5d3e){var _0x24c55d=utils[_0x6b87('0x20')](_0x4c5d3e);_0x24c55d['forEach'](function(_0x2e2a9b){_0x401a30['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2e2a9b+',%');});}return _0x401a30;}function parseReadParameter(_0x1e3ed2){var _0xa031='';if(_0x1e3ed2){_0xa031=_0x6b87('0x21');if(_0x1e3ed2==='1'){_0xa031=_0xa031[_0x6b87('0x22')](_0x6b87('0x23'),'=');}else{_0xa031=_0xa031[_0x6b87('0x22')]('{OPERATOR}','>');}}return _0xa031;}function parseSearchFilter(_0x47ef47,_0x1f75af){var _0x46f5ee=squel['expr']();if(_0x1f75af){var _0x648eae=_0x1f75af[_0x6b87('0x22')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6b87('0x24')](_0x648eae)){_0x46f5ee['or']('i.id\x20LIKE\x20?',_0x648eae+'%');if([_0x6b87('0x25'),_0x6b87('0x26')][_0x6b87('0x27')](_0x47ef47)){_0x46f5ee['or'](_0x6b87('0x28'),_0x648eae+'%');}else if(_0x47ef47==='fax'){_0x46f5ee['or'](_0x6b87('0x29'),_0x648eae+'%');}else if(_0x47ef47===_0x6b87('0x2a')){_0x46f5ee['or'](_0x6b87('0x2b'),_0x648eae+'%');}}else if(_0x47ef47==='mail'&&qs['isEmail'](_0x648eae)){_0x46f5ee['or'](_0x6b87('0x2c'),_0x648eae+'%');}else{if(_0x47ef47===_0x6b87('0x2d')){_0x46f5ee['or'](_0x6b87('0x2e'),qs[_0x6b87('0x2f')](_0x648eae,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6b87('0x2f')](_0x648eae));}else if(_0x47ef47!==_0x6b87('0x30')){_0x46f5ee['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x648eae));}_0x46f5ee['or'](_0x6b87('0x31'),qs[_0x6b87('0x2f')](_0x648eae,!![]),null);}}return _0x46f5ee;}function parseAdvancedSearchFilter(_0xca13fb,_0x4b6732){var _0x5e008c=getSqlClauses();var _0x389bca=as[_0x6b87('0x32')](_0xca13fb);var _0x4edab0=_0x389bca['sqlOperator'];for(var _0x3d848e=0x0;_0x3d848e<_0x389bca['conditions'][_0x6b87('0x33')];_0x3d848e++){var _0x4394d2=_0x389bca[_0x6b87('0x34')][_0x3d848e];var _0x1d11f9='i';var _0x5f2594=_[_0x6b87('0x35')](_0x4b6732,[_0x6b87('0x8'),_0x4394d2[_0x6b87('0x7')]]);if(_0x5f2594){var _0x317513=as['buildExpression'](_0x1d11f9,_0x5f2594['type'],_0x4394d2);_0x5e008c[_0x6b87('0x36')][_0x4edab0](_0x317513[_0x6b87('0x37')],_0x317513[_0x6b87('0x38')][_0x6b87('0x39')],_0x317513['value'][_0x6b87('0x3a')]);}else{switch(_0x4394d2[_0x6b87('0x7')]){case _0x6b87('0x3b'):var _0x390b34=parseReadParameter(_0x4394d2[_0x6b87('0x38')]);_0x5e008c['read']['and'](_0x390b34);break;case _0x6b87('0x3c'):if(_0x4394d2[_0x6b87('0x3d')]==='$substring'){if(_0x4394d2[_0x6b87('0x38')][_0x6b87('0x3e')]('\x20')[_0x6b87('0x33')]>0x1){_0x5e008c['contact'][_0x4edab0](_0x6b87('0x31'),qs[_0x6b87('0x2f')](_0x4394d2['value'],!![]),null);}else{var _0x4a2ff1='%'+_0x4394d2[_0x6b87('0x38')]+'%';_0x5e008c['contact'][_0x4edab0](_0x6b87('0x3f'),_0x4a2ff1,_0x4a2ff1,_0x4a2ff1);}}else{_0x5f2594=_[_0x6b87('0x35')](_0x4b6732,[_0x6b87('0x8'),_0x6b87('0x40')]);_0x4394d2['field']=_0x6b87('0x40');_0x317513=as[_0x6b87('0x41')](_0x1d11f9,_0x5f2594[_0x6b87('0x42')],_0x4394d2);_0x5e008c[_0x6b87('0x43')][_0x4edab0](_0x317513['text'],_0x317513['value']['start'],_0x317513[_0x6b87('0x38')][_0x6b87('0x3a')]);}break;case _0x6b87('0x44'):var _0x242cef=_0x4394d2['value'][_0x6b87('0x3e')](',')[_0x6b87('0x45')](function(_0x1ad472){return Number(_0x1ad472);});var _0x1f6703=parseTagParameter(_0x242cef);_0x5e008c[_0x6b87('0x46')][_0x6b87('0x47')][_0x6b87('0x48')](_0x1f6703);_0x5e008c['tags'][_0x6b87('0x49')]=_0x242cef;break;case'User':if(_0x4394d2[_0x6b87('0x3d')]==='$substring'){_0x5e008c[_0x6b87('0x4a')][_0x4edab0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4394d2['value']+'%',null);}else{_0x5f2594=_[_0x6b87('0x35')](_0x4b6732,[_0x6b87('0x8'),_0x6b87('0x4b')]);_0x4394d2[_0x6b87('0x7')]='UserId';_0x317513=as['buildExpression'](_0x1d11f9,_0x5f2594['type'],_0x4394d2);_0x5e008c[_0x6b87('0x4a')][_0x4edab0](_0x317513['text'],_0x317513['value'][_0x6b87('0x39')],_0x317513[_0x6b87('0x38')]['end']);}break;case _0x6b87('0x4c'):case _0x6b87('0x4d'):_0x317513=as['buildExpression']('me',null,_0x4394d2);_0x5e008c[_0x6b87('0x4c')][_0x4edab0](_0x317513[_0x6b87('0x37')],_0x317513[_0x6b87('0x38')][_0x6b87('0x39')],_0x317513[_0x6b87('0x38')][_0x6b87('0x3a')]);break;}}}return _0x5e008c;}function parseModelFields(_0x5ba470,_0x3a1137,_0x2d50b7){var _0x3bcc67=utils['getAccountFK'](_0x5ba470);var _0x2cd55a=squel[_0x6b87('0x1f')]();var _0x11e756=_(_0x3a1137)['keys']()[_0x6b87('0x45')](function(_0x14257f){return _['some'](_0x2d50b7,[_0x6b87('0x8'),_0x14257f])?_0x14257f:undefined;})['compact']()[_0x6b87('0x38')]();if(_0x11e756['length']>0x0){_0x11e756[_0x6b87('0x4e')](function(_0x320bd7){if(_0x320bd7===_0x3bcc67){_0x2cd55a[_0x6b87('0x48')]('i.'+_0x3bcc67+_0x6b87('0x4f'),[][_0x6b87('0x50')](_0x3a1137[_0x320bd7]));}else if(_0x320bd7===_0x6b87('0x51')){var _0x74f0ad=JSON[_0x6b87('0x52')](_0x3a1137[_0x320bd7])[_0x6b87('0x53')];var _0x216b5c=JSON[_0x6b87('0x52')](_0x3a1137[_0x320bd7])[_0x6b87('0x54')];_0x2cd55a['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x74f0ad,_0x216b5c);}else{if(_0x3a1137[_0x320bd7]===_0x6b87('0x55')){_0x2cd55a[_0x6b87('0x48')]('i.'+_0x320bd7+_0x6b87('0x56'));}else{_0x2cd55a[_0x6b87('0x48')]('i.'+_0x320bd7+_0x6b87('0x57'),_0x3a1137[_0x320bd7]);}}});}return _0x2cd55a;}function parseQueryParameters(_0xde979d,_0x188f41,_0x55f658){var _0x2afc1e=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0xde979d,_0x188f41,_0x55f658);})['then'](function(_0x302e65){_0x2afc1e['fields'][_0x6b87('0x48')](_0x302e65);return parseReadParameter(_0x188f41[_0x6b87('0x58')]);})[_0x6b87('0x59')](function(_0x556e43){_0x2afc1e[_0x6b87('0x58')][_0x6b87('0x48')](_0x556e43);return parseTagParameter(_0x188f41[_0x6b87('0x5a')]);})[_0x6b87('0x59')](function(_0x5a305e){_0x2afc1e['tags'][_0x6b87('0x47')][_0x6b87('0x48')](_0x5a305e);return parseSearchFilter(_0xde979d,_0x188f41[_0x6b87('0x5b')]);})[_0x6b87('0x59')](function(_0x36fde7){_0x2afc1e[_0x6b87('0x5b')]=_0x36fde7;return _0x2afc1e;});}function checkAccountsRestrictions(_0x17fd06,_0x51e6df,_0x1d0756){var _0x19ea9a=utils[_0x6b87('0x3')](_0x17fd06);var _0x26da65=_0x6b87('0x5c')+_[_0x6b87('0x5d')](_0x17fd06)+(_0x17fd06===_0x6b87('0x5e')?_0x6b87('0x5f'):'Accounts');var _0x321e8b=squel[_0x6b87('0x1f')]();return Promise[_0x6b87('0x60')]()[_0x6b87('0x59')](function(){if(_0x1d0756[_0x6b87('0x5')]&&_0x51e6df[_0x6b87('0x4')]===_0x6b87('0x61')){return _0x51e6df[_0x26da65]({'attributes':['id'],'raw':!![]});}})[_0x6b87('0x59')](function(_0x345485){if(_0x345485){if(_0x345485[_0x6b87('0x33')]===0x0){_0x321e8b['and']('i.'+_0x19ea9a+'\x20IS\x20NULL');}else{_0x321e8b['and']('i.'+_0x19ea9a+_0x6b87('0x4f'),_[_0x6b87('0x45')](_0x345485,'id'));}}else if(!_0x1d0756[_0x19ea9a]){_0x321e8b['and']('i.'+_0x19ea9a+_0x6b87('0x62'));}})['then'](function(){return _0x321e8b;});}function getClosedOrderClause(_0x237678,_0x64d24b){var _0x4eeb1a='';var _0x54417f=[_0x6b87('0x63'),_0x6b87('0x64'),_0x6b87('0x65')];if(_0x237678===_0x6b87('0x2d')){_0x54417f[_0x6b87('0x66')](_0x6b87('0x67'));}if(_0x64d24b[_0x6b87('0x68')]==='0'&&_0x237678==='mail'){_0x4eeb1a=_0x6b87('0x67');}else{if(_0x64d24b[_0x6b87('0x68')]==='1'){_0x54417f[_0x6b87('0x69')]();}_0x4eeb1a=_0x6b87('0x6a')+_0x54417f[_0x6b87('0x6b')](',\x20')+')';}return _0x4eeb1a;}function getFilteredInteractions(_0x372fb5,_0x4a7e53,_0x3408f8,_0x30bd9d){var _0x41cb9e=utils[_0x6b87('0x9')](_0x372fb5);var _0x2f5577=_[_0x6b87('0x5d')](_0x372fb5)+'Interaction';var _0x58835f=[];var _0x11ac8e=getTagsQuery();var _0x3dfda8={'type':db[_0x6b87('0x6c')]['QueryTypes'][_0x6b87('0x6d')],'raw':!![]};var _0x80e431=[];var _0x1e34ef=[];return db[_0x6b87('0x6e')][_0x6b87('0x6f')](_0x11ac8e[_0x6b87('0x70')](),_0x3dfda8)[_0x6b87('0x59')](function(_0x40fafe){_0x58835f=_[_0x6b87('0x71')](_0x40fafe,'id');_0x3dfda8=_['merge'](_0x3dfda8,{'model':db[_0x2f5577],'mapToModel':!![],'nest':!![]});if(_0x3408f8[_0x6b87('0x72')]){_0x30bd9d[_0x6b87('0x73')][_0x6b87('0x4e')](function(_0x486484){_0x4a7e53[_0x6b87('0x7')]('i.'+_0x486484);});}else{_0x4a7e53[_0x6b87('0x7')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x74'),_0x6b87('0x75'));_0x4a7e53[_0x6b87('0x7')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x372fb5===_0x6b87('0x2d')){_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x76'),_0x6b87('0x77'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x78'),_0x6b87('0x79'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x7a'));_0x4a7e53['field'](_0x6b87('0x7b'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x7c'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x7d'));_0x4a7e53['field'](_0x6b87('0x7e'));_0x4a7e53[_0x6b87('0x7')]('i.attach');_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x7f'));_0x4a7e53['field'](_0x6b87('0x80'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x81'));_0x4a7e53['field'](_0x6b87('0x65'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x64'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x63'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x67'));_0x4a7e53['field'](_0x6b87('0x82'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x83'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x84'));_0x4a7e53[_0x6b87('0x7')]('i.UserId');}else if(_0x372fb5===_0x6b87('0x2a')){_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x85'),_0x6b87('0x79'));}else{_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x86'),_0x6b87('0x79'));}if(_0x372fb5!==_0x6b87('0x2d')){_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x87'));}_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x88'),_0x6b87('0x89'));_0x4a7e53[_0x6b87('0x7')]('c.lastName','Contact.lastName');_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x8a'),_0x6b87('0x8b'));_0x4a7e53['field']('c.phone',_0x6b87('0x8c'));_0x4a7e53[_0x6b87('0x7')]('c.mobile',_0x6b87('0x8d'));_0x4a7e53[_0x6b87('0x7')]('c.fax',_0x6b87('0x8e'));_0x4a7e53['field'](_0x6b87('0x8f'),'Owner.fullname');_0x4a7e53['field'](_0x6b87('0x90'),_0x6b87('0x91'));_0x4a7e53[_0x6b87('0x7')](_0x6b87('0x92'),'TagIds');}if(_0x30bd9d['limit']){_0x4a7e53['limit'](_0x30bd9d['limit']);}if(_0x30bd9d[_0x6b87('0x93')]){_0x4a7e53['offset'](_0x30bd9d[_0x6b87('0x93')]);}return db[_0x6b87('0x6e')][_0x6b87('0x6f')](_0x4a7e53[_0x6b87('0x70')](),_0x3dfda8);})[_0x6b87('0x59')](function(_0x44722b){_0x80e431=_0x44722b;var _0x30d254=getUsersQuery(_0x372fb5,_0x80e431);return db[_0x6b87('0x6e')][_0x6b87('0x6f')](_0x30d254[_0x6b87('0x70')](),_0x3dfda8);})[_0x6b87('0x59')](function(_0x2dc714){_0x1e34ef=_[_0x6b87('0x94')](_0x2dc714,_0x41cb9e);if(_0x372fb5===_0x6b87('0x2d')){return db[_0x6b87('0x95')][_0x6b87('0x96')]({'attributes':[_0x6b87('0x97')],'raw':!![]});}})[_0x6b87('0x59')](function(_0x5ace90){var _0x11346b=_0x5ace90?_0x5ace90[_0x6b87('0x97')]:undefined;var _0x2e7875=_0x80e431[_0x6b87('0x45')](function(_0x1c7d70){return updateInteraction(_0x1c7d70,_0x58835f,_0x1e34ef,_0x11346b);});return Promise['all'](_0x2e7875);});}function countFilteredInteractions(_0x21f67f,_0x548f68){var _0x3b0b65=_0x21f67f['clone']();_0x3b0b65['field'](_0x6b87('0x98'));_0x3b0b65[_0x6b87('0x7')](_0x6b87('0x99'),'unreadMessages');var _0xfa3658=utils[_0x6b87('0x20')](_0x548f68);if(!_[_0x6b87('0x9a')](_0xfa3658)){_0x3b0b65[_0x6b87('0x13')](_0x6b87('0x9b'),_0xfa3658);}var _0x54c8e7={'type':db[_0x6b87('0x6c')][_0x6b87('0x9c')][_0x6b87('0x6d')],'raw':!![]};return db[_0x6b87('0x6e')][_0x6b87('0x6f')](_0x3b0b65[_0x6b87('0x70')](),_0x54c8e7);}module[_0x6b87('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xe38e=['groupBy','findOne','enableEmailPreview','all','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','getAccountFK','role','agent','search','field','name','color','from','getInteractionFK','user_has_','select','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','me.','\x20=\x20i.id','it.','tools_tags','t.id\x20=\x20it.TagId','expr','forEach','{OPERATOR}','replace','isNumeric','sms','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','find','buildExpression','type','default','value','start','end','unreadMessages','read','Contact','operator','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','tags','clause','and','ids','User','$substring','user','UserId','body','plainBody','some','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','capitalize','chat','Websites','Accounts','i.disposition','unshift','closed','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','QueryTypes','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset'];(function(_0x20469,_0x3282b7){var _0x3f4e53=function(_0x354bf0){while(--_0x354bf0){_0x20469['push'](_0x20469['shift']());}};_0x3f4e53(++_0x3282b7);}(_0xe38e,0xa4));var _0xee38=function(_0x11ab70,_0x5b931f){_0x11ab70=_0x11ab70-0x0;var _0x5da3e6=_0xe38e[_0x11ab70];return _0x5da3e6;};'use strict';var _=require(_0xee38('0x0'));var squel=require('squel');var as=require(_0xee38('0x1'));var qs=require(_0xee38('0x2'));var updateInteraction=require(_0xee38('0x3'))[_0xee38('0x4')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x234ed1,_0x1d6056,_0x34ff53){var _0x36a1ba=![];var _0x1a37be=utils[_0xee38('0x5')](_0x234ed1);if(_0x1d6056[_0xee38('0x6')]===_0xee38('0x7')&&!_0x34ff53[_0xee38('0x8')]&&!_0x34ff53[_0x1a37be]){_0x36a1ba=!![];}return _0x36a1ba;}function getTagsQuery(){return squel['select']()[_0xee38('0x9')]('id')[_0xee38('0x9')](_0xee38('0xa'))['field'](_0xee38('0xb'))[_0xee38('0xc')]('tools_tags');}function getUsersQuery(_0x20603a,_0xec306f){var _0x2347fc=utils[_0xee38('0xd')](_0x20603a);var _0xc485bd=_0xee38('0xe')+_0x20603a+'_interactions';var _0x553494=squel[_0xee38('0xf')]()[_0xee38('0x9')](_0xee38('0x10'))[_0xee38('0x9')]('u.fullname')['field'](_0xee38('0x11')+_0x2347fc)[_0xee38('0xc')](_0xc485bd,'ui')[_0xee38('0x12')](_0xee38('0x13'),'u',_0xee38('0x14'));if(_0xec306f[_0xee38('0x15')]>0x0){_0x553494[_0xee38('0x16')](_0xee38('0x11')+_0x2347fc+_0xee38('0x17'),_[_0xee38('0x18')](_0xec306f,'id'));}return _0x553494;}function getInteractionsQuery(_0x4aeb20){var _0x438cd8=utils[_0xee38('0x19')](_0x4aeb20);var _0x4f32bb=utils['getAccountFK'](_0x4aeb20);var _0x5b57f1=utils[_0xee38('0xd')](_0x4aeb20);return squel[_0xee38('0xf')]()[_0xee38('0xc')](_0x438cd8[_0xee38('0x1a')],'i')[_0xee38('0x12')]('cm_contacts','c',_0xee38('0x1b'))[_0xee38('0x12')](_0xee38('0x13'),'o',_0xee38('0x1c'))[_0xee38('0x12')](_0x438cd8['accounts'],'a',_0xee38('0x1d')+_0x4f32bb)[_0xee38('0x12')](_0x438cd8['messages'],'me',_0xee38('0x1e')+_0x5b57f1+_0xee38('0x1f'))[_0xee38('0x12')](_0x438cd8['interactionsTags'],'it',_0xee38('0x20')+_0x5b57f1+_0xee38('0x1f'))['left_join'](_0xee38('0x21'),'t',_0xee38('0x22'));}function getSqlClauses(){var _0x33fbe4={'body':squel[_0xee38('0x23')](),'contact':squel[_0xee38('0x23')](),'default':squel[_0xee38('0x23')](),'fields':squel[_0xee38('0x23')](),'filter':squel[_0xee38('0x23')](),'read':squel['expr'](),'tags':{'clause':squel[_0xee38('0x23')](),'ids':null},'user':squel[_0xee38('0x23')]()};return _0x33fbe4;}function parseTagParameter(_0x2b6f56){var _0x271057=squel[_0xee38('0x23')]();if(_0x2b6f56){var _0x251273=utils['getSelectedTags'](_0x2b6f56);_0x251273[_0xee38('0x24')](function(_0x4f4878){_0x271057['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f4878+',%');});}return _0x271057;}function parseReadParameter(_0xcc81b3){var _0x7aae41='';if(_0xcc81b3){_0x7aae41='unreadMessages\x20{OPERATOR}\x200';if(_0xcc81b3==='1'){_0x7aae41=_0x7aae41['replace'](_0xee38('0x25'),'=');}else{_0x7aae41=_0x7aae41[_0xee38('0x26')]('{OPERATOR}','>');}}return _0x7aae41;}function parseSearchFilter(_0x462524,_0x1e4153){var _0x320fec=squel[_0xee38('0x23')]();if(_0x1e4153){var _0x43c55c=_0x1e4153[_0xee38('0x26')]('\x5c','\x5c\x5c')[_0xee38('0x26')](/'/g,'\x27\x27');if(qs[_0xee38('0x27')](_0x43c55c)){_0x320fec['or']('i.id\x20LIKE\x20?',_0x43c55c+'%');if([_0xee38('0x28'),'whatsapp'][_0xee38('0x29')](_0x462524)){_0x320fec['or'](_0xee38('0x2a'),_0x43c55c+'%');}else if(_0x462524===_0xee38('0x2b')){_0x320fec['or'](_0xee38('0x2c'),_0x43c55c+'%');}else if(_0x462524===_0xee38('0x2d')){_0x320fec['or']('i.from\x20LIKE\x20?',_0x43c55c+'%');}}else if(_0x462524===_0xee38('0x2e')&&qs['isEmail'](_0x43c55c)){_0x320fec['or'](_0xee38('0x2f'),_0x43c55c+'%');}else{if(_0x462524===_0xee38('0x2e')){_0x320fec['or'](_0xee38('0x30'),qs[_0xee38('0x31')](_0x43c55c,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee38('0x31')](_0x43c55c));}else if(_0x462524!==_0xee38('0x2b')){_0x320fec['or'](_0xee38('0x32'),qs[_0xee38('0x31')](_0x43c55c));}_0x320fec['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee38('0x31')](_0x43c55c,!![]),null);}}return _0x320fec;}function parseAdvancedSearchFilter(_0x532fba,_0x397436){var _0x2f4064=getSqlClauses();var _0x100430=as['parseSearch'](_0x532fba);var _0xc4d39b=_0x100430[_0xee38('0x33')];for(var _0x51c107=0x0;_0x51c107<_0x100430['conditions'][_0xee38('0x15')];_0x51c107++){var _0x4466bc=_0x100430['conditions'][_0x51c107];var _0x91aad6='i';var _0x36c2dc=_[_0xee38('0x34')](_0x397436,[_0xee38('0xa'),_0x4466bc[_0xee38('0x9')]]);if(_0x36c2dc){var _0x22e2c5=as[_0xee38('0x35')](_0x91aad6,_0x36c2dc[_0xee38('0x36')],_0x4466bc);_0x2f4064[_0xee38('0x37')][_0xc4d39b](_0x22e2c5['text'],_0x22e2c5[_0xee38('0x38')][_0xee38('0x39')],_0x22e2c5['value'][_0xee38('0x3a')]);}else{switch(_0x4466bc['field']){case _0xee38('0x3b'):var _0x4ad8b2=parseReadParameter(_0x4466bc['value']);_0x2f4064[_0xee38('0x3c')]['and'](_0x4ad8b2);break;case _0xee38('0x3d'):if(_0x4466bc[_0xee38('0x3e')]==='$substring'){if(_0x4466bc[_0xee38('0x38')][_0xee38('0x3f')]('\x20')[_0xee38('0x15')]>0x1){_0x2f4064[_0xee38('0x40')][_0xc4d39b](_0xee38('0x41'),qs[_0xee38('0x31')](_0x4466bc['value'],!![]),null);}else{var _0x4a55cf='%'+_0x4466bc[_0xee38('0x38')]+'%';_0x2f4064[_0xee38('0x40')][_0xc4d39b](_0xee38('0x42'),_0x4a55cf,_0x4a55cf,_0x4a55cf);}}else{_0x36c2dc=_[_0xee38('0x34')](_0x397436,[_0xee38('0xa'),_0xee38('0x43')]);_0x4466bc[_0xee38('0x9')]=_0xee38('0x43');_0x22e2c5=as[_0xee38('0x35')](_0x91aad6,_0x36c2dc[_0xee38('0x36')],_0x4466bc);_0x2f4064[_0xee38('0x40')][_0xc4d39b](_0x22e2c5[_0xee38('0x44')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x39')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x3a')]);}break;case'Tag':var _0x4db0e2=_0x4466bc['value']['split'](',')['map'](function(_0x5423e6){return Number(_0x5423e6);});var _0x100284=parseTagParameter(_0x4db0e2);_0x2f4064[_0xee38('0x45')][_0xee38('0x46')][_0xee38('0x47')](_0x100284);_0x2f4064['tags'][_0xee38('0x48')]=_0x4db0e2;break;case _0xee38('0x49'):if(_0x4466bc[_0xee38('0x3e')]===_0xee38('0x4a')){_0x2f4064[_0xee38('0x4b')][_0xc4d39b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4466bc[_0xee38('0x38')]+'%',null);}else{_0x36c2dc=_['find'](_0x397436,[_0xee38('0xa'),_0xee38('0x4c')]);_0x4466bc[_0xee38('0x9')]=_0xee38('0x4c');_0x22e2c5=as[_0xee38('0x35')](_0x91aad6,_0x36c2dc[_0xee38('0x36')],_0x4466bc);_0x2f4064['user'][_0xc4d39b](_0x22e2c5[_0xee38('0x44')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x39')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x3a')]);}break;case _0xee38('0x4d'):case _0xee38('0x4e'):_0x22e2c5=as[_0xee38('0x35')]('me',null,_0x4466bc);_0x2f4064[_0xee38('0x4d')][_0xc4d39b](_0x22e2c5['text'],_0x22e2c5[_0xee38('0x38')][_0xee38('0x39')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x3a')]);break;}}}return _0x2f4064;}function parseModelFields(_0x589212,_0xc0d64,_0x2cf1e6){var _0x5c8e7b=utils[_0xee38('0x5')](_0x589212);var _0x38b9d0=squel['expr']();var _0x52c20f=_(_0xc0d64)['keys']()[_0xee38('0x18')](function(_0x46077b){return _[_0xee38('0x4f')](_0x2cf1e6,[_0xee38('0xa'),_0x46077b])?_0x46077b:undefined;})[_0xee38('0x50')]()[_0xee38('0x38')]();if(_0x52c20f[_0xee38('0x15')]>0x0){_0x52c20f[_0xee38('0x24')](function(_0x5a0478){if(_0x5a0478===_0x5c8e7b){_0x38b9d0['and']('i.'+_0x5c8e7b+_0xee38('0x17'),[][_0xee38('0x51')](_0xc0d64[_0x5a0478]));}else if(_0x5a0478===_0xee38('0x52')){var _0x54929e=JSON[_0xee38('0x53')](_0xc0d64[_0x5a0478])[_0xee38('0x54')];var _0x16aa83=JSON[_0xee38('0x53')](_0xc0d64[_0x5a0478])[_0xee38('0x55')];_0x38b9d0[_0xee38('0x47')](_0xee38('0x56'),_0x54929e,_0x16aa83);}else{if(_0xc0d64[_0x5a0478]===_0xee38('0x57')){_0x38b9d0[_0xee38('0x47')]('i.'+_0x5a0478+_0xee38('0x58'));}else{_0x38b9d0[_0xee38('0x47')]('i.'+_0x5a0478+_0xee38('0x59'),_0xc0d64[_0x5a0478]);}}});}return _0x38b9d0;}function parseQueryParameters(_0x32cc24,_0x39f042,_0xc9c93f){var _0x525b1f=getSqlClauses();return Promise[_0xee38('0x5a')]()[_0xee38('0x5b')](function(){return parseModelFields(_0x32cc24,_0x39f042,_0xc9c93f);})[_0xee38('0x5b')](function(_0x72b12e){_0x525b1f[_0xee38('0x5c')][_0xee38('0x47')](_0x72b12e);return parseReadParameter(_0x39f042[_0xee38('0x3c')]);})[_0xee38('0x5b')](function(_0x481976){_0x525b1f[_0xee38('0x3c')][_0xee38('0x47')](_0x481976);return parseTagParameter(_0x39f042[_0xee38('0x5d')]);})[_0xee38('0x5b')](function(_0x5915eb){_0x525b1f[_0xee38('0x45')][_0xee38('0x46')]['and'](_0x5915eb);return parseSearchFilter(_0x32cc24,_0x39f042['filter']);})['then'](function(_0xbab433){_0x525b1f['filter']=_0xbab433;return _0x525b1f;});}function checkAccountsRestrictions(_0x8e98bb,_0xc34191,_0x54aac0){var _0x222e68=utils[_0xee38('0x5')](_0x8e98bb);var _0x103f01='get'+_[_0xee38('0x5e')](_0x8e98bb)+(_0x8e98bb===_0xee38('0x5f')?_0xee38('0x60'):_0xee38('0x61'));var _0x2638d9=squel[_0xee38('0x23')]();return Promise[_0xee38('0x5a')]()['then'](function(){if(_0x54aac0[_0xee38('0x8')]&&_0xc34191[_0xee38('0x6')]===_0xee38('0x7')){return _0xc34191[_0x103f01]({'attributes':['id'],'raw':!![]});}})[_0xee38('0x5b')](function(_0x1a9a29){if(_0x1a9a29){if(_0x1a9a29[_0xee38('0x15')]===0x0){_0x2638d9[_0xee38('0x47')]('i.'+_0x222e68+_0xee38('0x58'));}else{_0x2638d9[_0xee38('0x47')]('i.'+_0x222e68+_0xee38('0x17'),_[_0xee38('0x18')](_0x1a9a29,'id'));}}else if(!_0x54aac0[_0x222e68]){_0x2638d9[_0xee38('0x47')]('i.'+_0x222e68+'\x20IS\x20NOT\x20NULL');}})[_0xee38('0x5b')](function(){return _0x2638d9;});}function getClosedOrderClause(_0x1468bb,_0x2bcfab){var _0x318eac='';var _0x428c69=['i.thirdDisposition','i.secondDisposition',_0xee38('0x62')];if(_0x1468bb===_0xee38('0x2e')){_0x428c69[_0xee38('0x63')]('i.substatus');}if(_0x2bcfab[_0xee38('0x64')]==='0'&&_0x1468bb===_0xee38('0x2e')){_0x318eac=_0xee38('0x65');}else{if(_0x2bcfab[_0xee38('0x64')]==='1'){_0x428c69[_0xee38('0x66')]();}_0x318eac=_0xee38('0x67')+_0x428c69[_0xee38('0x68')](',\x20')+')';}return _0x318eac;}function getFilteredInteractions(_0xadf310,_0x224539,_0x3da887,_0x4579af){var _0x38fecc=utils[_0xee38('0xd')](_0xadf310);var _0x1a299b=_[_0xee38('0x5e')](_0xadf310)+'Interaction';var _0x3a8cd9=[];var _0x2a679a=getTagsQuery();var _0x4f2bb4={'type':db['Sequelize'][_0xee38('0x69')]['SELECT'],'raw':!![]};var _0x272c52=[];var _0x72d212=[];return db[_0xee38('0x6a')][_0xee38('0x6b')](_0x2a679a[_0xee38('0x6c')](),_0x4f2bb4)['then'](function(_0x4c87b2){_0x3a8cd9=_[_0xee38('0x6d')](_0x4c87b2,'id');_0x4f2bb4=_[_0xee38('0x6e')](_0x4f2bb4,{'model':db[_0x1a299b],'mapToModel':!![],'nest':!![]});if(_0x3da887[_0xee38('0x5c')]){_0x4579af[_0xee38('0x6f')][_0xee38('0x24')](function(_0x40bf72){_0x224539[_0xee38('0x9')]('i.'+_0x40bf72);});}else{_0x224539['field'](_0xee38('0x70'),_0xee38('0x3b'));_0x224539['field'](_0xee38('0x71'),_0xee38('0x72'));_0x224539[_0xee38('0x9')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0xadf310===_0xee38('0x2e')){_0x224539[_0xee38('0x9')](_0xee38('0x73'),_0xee38('0x74'));_0x224539['field'](_0xee38('0x75'),_0xee38('0x76'));_0x224539[_0xee38('0x9')](_0xee38('0x77'));_0x224539[_0xee38('0x9')](_0xee38('0x78'));_0x224539[_0xee38('0x9')]('i.updatedAt');_0x224539[_0xee38('0x9')](_0xee38('0x79'));_0x224539[_0xee38('0x9')](_0xee38('0x7a'));_0x224539[_0xee38('0x9')]('i.attach');_0x224539[_0xee38('0x9')]('i.lastMsgAt');_0x224539[_0xee38('0x9')](_0xee38('0x7b'));_0x224539[_0xee38('0x9')](_0xee38('0x7c'));_0x224539[_0xee38('0x9')](_0xee38('0x62'));_0x224539[_0xee38('0x9')]('i.secondDisposition');_0x224539[_0xee38('0x9')](_0xee38('0x7d'));_0x224539[_0xee38('0x9')](_0xee38('0x65'));_0x224539[_0xee38('0x9')](_0xee38('0x7e'));_0x224539[_0xee38('0x9')](_0xee38('0x7f'));_0x224539[_0xee38('0x9')]('i.MailAccountId');_0x224539[_0xee38('0x9')]('i.UserId');}else if(_0xadf310==='openchannel'){_0x224539[_0xee38('0x9')](_0xee38('0x80'),_0xee38('0x76'));}else{_0x224539[_0xee38('0x9')](_0xee38('0x81'),'contactName');}if(_0xadf310!==_0xee38('0x2e')){_0x224539['field'](_0xee38('0x82'));}_0x224539[_0xee38('0x9')](_0xee38('0x83'),_0xee38('0x84'));_0x224539[_0xee38('0x9')](_0xee38('0x85'),'Contact.lastName');_0x224539[_0xee38('0x9')](_0xee38('0x86'),'Contact.email');_0x224539['field'](_0xee38('0x87'),_0xee38('0x88'));_0x224539[_0xee38('0x9')](_0xee38('0x89'),_0xee38('0x8a'));_0x224539[_0xee38('0x9')](_0xee38('0x8b'),'Contact.fax');_0x224539['field'](_0xee38('0x8c'),_0xee38('0x8d'));_0x224539[_0xee38('0x9')](_0xee38('0x8e'),_0xee38('0x8f'));_0x224539['field'](_0xee38('0x90'),_0xee38('0x91'));}if(_0x4579af['limit']){_0x224539[_0xee38('0x92')](_0x4579af[_0xee38('0x92')]);}if(_0x4579af[_0xee38('0x93')]){_0x224539['offset'](_0x4579af[_0xee38('0x93')]);}return db['sequelize'][_0xee38('0x6b')](_0x224539[_0xee38('0x6c')](),_0x4f2bb4);})[_0xee38('0x5b')](function(_0x4f9513){_0x272c52=_0x4f9513;var _0x50d402=getUsersQuery(_0xadf310,_0x272c52);return db[_0xee38('0x6a')][_0xee38('0x6b')](_0x50d402[_0xee38('0x6c')](),_0x4f2bb4);})[_0xee38('0x5b')](function(_0x19dff4){_0x72d212=_[_0xee38('0x94')](_0x19dff4,_0x38fecc);if(_0xadf310===_0xee38('0x2e')){return db['Setting'][_0xee38('0x95')]({'attributes':[_0xee38('0x96')],'raw':!![]});}})[_0xee38('0x5b')](function(_0x5c2fd1){var _0x4d0ace=_0x5c2fd1?_0x5c2fd1[_0xee38('0x96')]:undefined;var _0x4d1fa2=_0x272c52['map'](function(_0x29d175){return updateInteraction(_0x29d175,_0x3a8cd9,_0x72d212,_0x4d0ace);});return Promise[_0xee38('0x97')](_0x4d1fa2);});}function countFilteredInteractions(_0x2ee475,_0x5cfb5e){var _0x88c396=_0x2ee475['clone']();_0x88c396['field']('COUNT(*)');_0x88c396['field'](_0xee38('0x70'),_0xee38('0x3b'));var _0x548b89=utils[_0xee38('0x98')](_0x5cfb5e);if(!_[_0xee38('0x99')](_0x548b89)){_0x88c396[_0xee38('0x16')](_0xee38('0x9a'),_0x548b89);}var _0x32b5e6={'type':db[_0xee38('0x9b')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0xee38('0x6a')][_0xee38('0x6b')](_0x88c396['toString'](),_0x32b5e6);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 7d7ba68..132c0ca 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 _0x6819=['unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','out','plainBody','-id','catch','updateInteraction','TagIds','Tags','then','lodash','../../mysqldb','map','fullname','split','push','waiting','talking'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6819,0x6b));var _0x9681=function(_0x3daefd,_0x5ed99c){_0x3daefd=_0x3daefd-0x0;var _0x2c1315=_0x6819[_0x3daefd];return _0x2c1315;};'use strict';var _=require(_0x9681('0x0'));var db=require(_0x9681('0x1'))['db'];function getInteractionUsers(_0x134446,_0x103ad1){return new Promise(function(_0x5ccb24,_0x3f08e4){try{var _0x3bcf47=[];if(_0x103ad1[_0x134446]){_0x3bcf47=_0x103ad1[_0x134446][_0x9681('0x2')](function(_0x2a5c61){return{'id':_0x2a5c61['id'],'fullname':_0x2a5c61[_0x9681('0x3')]};});}return _0x5ccb24(_0x3bcf47);}catch(_0x8b2d65){_0x3f08e4(_0x8b2d65);}});}function getInteractionTags(_0x3cd5e8,_0x5ba314){var _0x11a53a=[];if(_0x3cd5e8){_0x3cd5e8[_0x9681('0x4')](',')['forEach'](function(_0x5c8fae){_0x11a53a[_0x9681('0x5')](_0x5ba314[_0x5c8fae]);});}return _0x11a53a;}function updateWaitingCounter(_0x525de8){if(_0x525de8[_0x9681('0x6')]){_0x525de8['waiting']-=0x1;}}function updateInteractionCounters(_0x5ddaae){_0x5ddaae[_0x9681('0x6')]=0x0;_0x5ddaae[_0x9681('0x7')]=0x0;_0x5ddaae['answered']=0x0;_0x5ddaae[_0x9681('0x8')]=0x0;_0x5ddaae[_0x9681('0x9')]=0x0;_0x5ddaae[_0x9681('0xa')]=0x0;if(_0x5ddaae[_0x9681('0xb')]){if(_0x5ddaae[_0x9681('0xc')]===_0x9681('0x9')){_0x5ddaae[_0x9681('0x9')]+=0x1;updateWaitingCounter(_0x5ddaae);}if(_0x5ddaae[_0x9681('0xd')]){_0x5ddaae['answered']+=0x1;if(_0x5ddaae[_0x9681('0x7')]){_0x5ddaae[_0x9681('0x7')]-=0x1;}}else{if(_0x5ddaae['disposition']){_0x5ddaae[_0x9681('0x8')]+=0x1;updateWaitingCounter(_0x5ddaae);}}}else{if(!_0x5ddaae[_0x9681('0xd')]){_0x5ddaae[_0x9681('0x6')]+=0x1;}if(_0x5ddaae[_0x9681('0xd')]){_0x5ddaae[_0x9681('0x7')]+=0x1;updateWaitingCounter(_0x5ddaae);}}_0x5ddaae[_0x9681('0xa')]+=0x1;return _0x5ddaae;}function getLastMessageText(_0x3d948a){return db[_0x9681('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x3d948a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x9681('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x9681('0x10')],'order':_0x9681('0x11'),'raw':!![]})['then'](function(_0x48ac7c){if(_0x48ac7c&&_0x48ac7c[_0x9681('0x10')]){_0x3d948a['lastMsgText']=_['trimStart'](_0x48ac7c[_0x9681('0x10')]);}return _0x3d948a;})[_0x9681('0x12')](function(_0xd915f4){throw _0xd915f4;});}exports[_0x9681('0x13')]=function(_0x2d46f4,_0x2da5b3,_0x12b6a1,_0x478d3f){return new Promise(function(_0x331797,_0x13a7c6){return getInteractionUsers(_0x2d46f4['id'],_0x12b6a1)['then'](function(_0x38466e){_0x2d46f4['Users']=_0x38466e;return getInteractionTags(_0x2d46f4[_0x9681('0x14')],_0x2da5b3);})['then'](function(_0x3abeb0){_0x2d46f4[_0x9681('0x15')]=_0x3abeb0;delete _0x2d46f4['TagIds'];return updateInteractionCounters(_0x2d46f4);})[_0x9681('0x16')](function(_0x409404){if(_0x478d3f){return getLastMessageText(_0x409404);}else{return _0x409404;}})[_0x9681('0x16')](function(_0x50966e){_0x331797(_0x50966e);})[_0x9681('0x12')](function(_0x17d135){_0x13a7c6(_0x17d135);});});}; \ No newline at end of file +var _0x0702=['Tags','../../mysqldb','map','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','out','-id','then','lastMsgText','plainBody','catch','updateInteraction','Users','TagIds'];(function(_0x1bc2bd,_0xbe98b6){var _0x55f818=function(_0xdc642){while(--_0xdc642){_0x1bc2bd['push'](_0x1bc2bd['shift']());}};_0x55f818(++_0xbe98b6);}(_0x0702,0x199));var _0x2070=function(_0xc8c728,_0x34a614){_0xc8c728=_0xc8c728-0x0;var _0x221646=_0x0702[_0xc8c728];return _0x221646;};'use strict';var _=require('lodash');var db=require(_0x2070('0x0'))['db'];function getInteractionUsers(_0x450a96,_0x205958){return new Promise(function(_0x1dea24,_0xf1247c){try{var _0x3f0540=[];if(_0x205958[_0x450a96]){_0x3f0540=_0x205958[_0x450a96][_0x2070('0x1')](function(_0x4e078e){return{'id':_0x4e078e['id'],'fullname':_0x4e078e['fullname']};});}return _0x1dea24(_0x3f0540);}catch(_0x2efb41){_0xf1247c(_0x2efb41);}});}function getInteractionTags(_0x59ca9b,_0x26ad08){var _0x767475=[];if(_0x59ca9b){_0x59ca9b[_0x2070('0x2')](',')[_0x2070('0x3')](function(_0x343488){_0x767475[_0x2070('0x4')](_0x26ad08[_0x343488]);});}return _0x767475;}function updateWaitingCounter(_0x2c550b){if(_0x2c550b[_0x2070('0x5')]){_0x2c550b[_0x2070('0x5')]-=0x1;}}function updateInteractionCounters(_0x10668d){_0x10668d[_0x2070('0x5')]=0x0;_0x10668d[_0x2070('0x6')]=0x0;_0x10668d[_0x2070('0x7')]=0x0;_0x10668d[_0x2070('0x8')]=0x0;_0x10668d[_0x2070('0x9')]=0x0;_0x10668d[_0x2070('0xa')]=0x0;if(_0x10668d[_0x2070('0xb')]){if(_0x10668d[_0x2070('0xc')]===_0x2070('0x9')){_0x10668d['abandoned']+=0x1;updateWaitingCounter(_0x10668d);}if(_0x10668d['UserId']){_0x10668d[_0x2070('0x7')]+=0x1;if(_0x10668d[_0x2070('0x6')]){_0x10668d['talking']-=0x1;}}else{if(_0x10668d[_0x2070('0xc')]){_0x10668d[_0x2070('0x8')]+=0x1;updateWaitingCounter(_0x10668d);}}}else{if(!_0x10668d[_0x2070('0xd')]){_0x10668d[_0x2070('0x5')]+=0x1;}if(_0x10668d[_0x2070('0xd')]){_0x10668d[_0x2070('0x6')]+=0x1;updateWaitingCounter(_0x10668d);}}_0x10668d['total']+=0x1;return _0x10668d;}function getLastMessageText(_0x52fd17){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x52fd17['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2070('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x2070('0xf'),'raw':!![]})[_0x2070('0x10')](function(_0x15522f){if(_0x15522f&&_0x15522f['plainBody']){_0x52fd17[_0x2070('0x11')]=_['trimStart'](_0x15522f[_0x2070('0x12')]);}return _0x52fd17;})[_0x2070('0x13')](function(_0x1838f5){throw _0x1838f5;});}exports[_0x2070('0x14')]=function(_0x49fe93,_0x345453,_0x1ec732,_0x54811a){return new Promise(function(_0x92e71e,_0x447d25){return getInteractionUsers(_0x49fe93['id'],_0x1ec732)[_0x2070('0x10')](function(_0x2647f5){_0x49fe93[_0x2070('0x15')]=_0x2647f5;return getInteractionTags(_0x49fe93[_0x2070('0x16')],_0x345453);})['then'](function(_0x357761){_0x49fe93[_0x2070('0x17')]=_0x357761;delete _0x49fe93['TagIds'];return updateInteractionCounters(_0x49fe93);})[_0x2070('0x10')](function(_0x412aa2){if(_0x54811a){return getLastMessageText(_0x412aa2);}else{return _0x412aa2;}})['then'](function(_0x198a4f){_0x92e71e(_0x198a4f);})['catch'](function(_0x3f58a8){_0x447d25(_0x3f58a8);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index e8c160e..32c3f4e 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 _0x83e5=['_interaction_has_tags','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','then','update','info','catch','error','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','unknown','websites','accounts'];(function(_0x3655e5,_0x469eae){var _0x37dfac=function(_0x4378d2){while(--_0x4378d2){_0x3655e5['push'](_0x3655e5['shift']());}};_0x37dfac(++_0x469eae);}(_0x83e5,0xc9));var _0x583e=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x83e5[_0x3042c5];return _0x7cd140;};'use strict';var _=require(_0x583e('0x0'));var db=require(_0x583e('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x583e('0x2')),'mail':require(_0x583e('0x3'))(_0x583e('0x4')),'fax':require(_0x583e('0x3'))(_0x583e('0x5')),'sms':require(_0x583e('0x3'))(_0x583e('0x6')),'chat':require(_0x583e('0x3'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0x583e('0x7'))};function getAccountFK(_0x5a3c8e){return _[_0x583e('0x8')](_0x5a3c8e)+(_0x5a3c8e===_0x583e('0x9')?_0x583e('0xa'):_0x583e('0xb'))+'Id';}function getInteractionFK(_0x539f46){return _[_0x583e('0x8')](_0x539f46)+'InteractionId';}function getInteractionId(_0x571308,_0x316588,_0xa9da7e){if(_0x571308&&_0x571308[_['upperFirst'](_0xa9da7e)+_0x583e('0xc')]){return _0x571308[_['upperFirst'](_0xa9da7e)+_0x583e('0xc')];}else if(_0x571308&&_0x571308['id']){return _0x571308['id'];}else if(_0x316588&&_0x316588['id']){return _0x316588['id'];}else{return _0x583e('0xd');}}function getInteractionsTables(_0x11d445){return{'accounts':_0x11d445+'_'+(_0x11d445===_0x583e('0x9')?_0x583e('0xe'):_0x583e('0xf')),'interactions':_0x11d445+'_interactions','interactionsTags':_0x11d445+_0x583e('0x10'),'messages':_0x11d445+'_messages','userInteractions':'user_has_'+_0x11d445+_0x583e('0x11')};}function getSelectedTags(_0x519c9b){var _0x4c6553=[];if(_0x519c9b){_0x4c6553=Array[_0x583e('0x12')](_0x519c9b)?_0x519c9b:[_0x519c9b];}return _0x4c6553;}function log(_0x57a4ec,_0x261f1a,_0x14b516,_0x4f7054,_0x4d5162,_0x4af5a6){loggers[_0x4d5162[_0x583e('0x13')]()][_0x57a4ec](_0x583e('0x14'),_0x4af5a6['toUpperCase'](),_0x261f1a?_0x261f1a['id']:null,_0x261f1a?_0x261f1a[_0x583e('0x15')]:null,_0x261f1a?_0x261f1a[_0x583e('0x16')]:null,getInteractionId(_0x14b516,_0x4f7054,_0x4d5162),_0x14b516?JSON[_0x583e('0x17')](_0x14b516):_0x583e('0x18'));}function updateUser(_0x181ad0,_0x591193,_0x21b086,_0x265f22,_0x34ccc0){db[_['upperFirst'](_0x265f22)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x591193,_0x21b086,_0x265f22)}})[_0x583e('0x19')](function(_0x1151ee){if(_0x1151ee){return _0x1151ee[_0x583e('0x1a')]({'UserId':_0x181ad0?_0x181ad0['id']:null});}})['then'](function(_0x3c90fb){if(_0x3c90fb){log(_0x583e('0x1b'),_0x181ad0,_0x591193,_0x21b086,_0x265f22,_0x34ccc0);}})[_0x583e('0x1c')](function(){log(_0x583e('0x1d'),_0x181ad0,_0x591193,_0x21b086,_0x265f22,_0x34ccc0);});}module[_0x583e('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x5a32=['chat','accounts','_interaction_has_tags','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','error','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','Website','InteractionId','upperFirst','unknown'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a32,0xec));var _0x25a3=function(_0x15de82,_0x355f97){_0x15de82=_0x15de82-0x0;var _0x527132=_0x5a32[_0x15de82];return _0x527132;};'use strict';var _=require(_0x25a3('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x25a3('0x1'))(_0x25a3('0x2')),'mail':require(_0x25a3('0x1'))(_0x25a3('0x3')),'fax':require('../../config/logger')(_0x25a3('0x4')),'sms':require(_0x25a3('0x1'))(_0x25a3('0x5')),'chat':require(_0x25a3('0x1'))(_0x25a3('0x6')),'whatsapp':require(_0x25a3('0x1'))('whatsapp-interactions')};function getAccountFK(_0x30f630){return _[_0x25a3('0x7')](_0x30f630)+(_0x30f630==='chat'?_0x25a3('0x8'):'Account')+'Id';}function getInteractionFK(_0x3e1ad3){return _['capitalize'](_0x3e1ad3)+_0x25a3('0x9');}function getInteractionId(_0x9c2336,_0x2feb70,_0x260fb7){if(_0x9c2336&&_0x9c2336[_[_0x25a3('0xa')](_0x260fb7)+_0x25a3('0x9')]){return _0x9c2336[_[_0x25a3('0xa')](_0x260fb7)+_0x25a3('0x9')];}else if(_0x9c2336&&_0x9c2336['id']){return _0x9c2336['id'];}else if(_0x2feb70&&_0x2feb70['id']){return _0x2feb70['id'];}else{return _0x25a3('0xb');}}function getInteractionsTables(_0x66886){return{'accounts':_0x66886+'_'+(_0x66886===_0x25a3('0xc')?'websites':_0x25a3('0xd')),'interactions':_0x66886+'_interactions','interactionsTags':_0x66886+_0x25a3('0xe'),'messages':_0x66886+'_messages','userInteractions':_0x25a3('0xf')+_0x66886+_0x25a3('0x10')};}function getSelectedTags(_0x267ee2){var _0x446038=[];if(_0x267ee2){_0x446038=Array[_0x25a3('0x11')](_0x267ee2)?_0x267ee2:[_0x267ee2];}return _0x446038;}function log(_0x209f8b,_0x529e0e,_0x9c9aa2,_0x25dd4a,_0xd1b033,_0x35d5e1){loggers[_0xd1b033[_0x25a3('0x12')]()][_0x209f8b](_0x25a3('0x13'),_0x35d5e1[_0x25a3('0x14')](),_0x529e0e?_0x529e0e['id']:null,_0x529e0e?_0x529e0e[_0x25a3('0x15')]:null,_0x529e0e?_0x529e0e[_0x25a3('0x16')]:null,getInteractionId(_0x9c9aa2,_0x25dd4a,_0xd1b033),_0x9c9aa2?JSON[_0x25a3('0x17')](_0x9c9aa2):_0x25a3('0x18'));}function updateUser(_0x99a2c7,_0x1af681,_0x7616d6,_0x98c688,_0x4343dc){db[_[_0x25a3('0xa')](_0x98c688)+_0x25a3('0x19')][_0x25a3('0x1a')]({'where':{'id':getInteractionId(_0x1af681,_0x7616d6,_0x98c688)}})[_0x25a3('0x1b')](function(_0x10be94){if(_0x10be94){return _0x10be94['update']({'UserId':_0x99a2c7?_0x99a2c7['id']:null});}})[_0x25a3('0x1b')](function(_0x6f0edf){if(_0x6f0edf){log(_0x25a3('0x1c'),_0x99a2c7,_0x1af681,_0x7616d6,_0x98c688,_0x4343dc);}})['catch'](function(){log(_0x25a3('0x1d'),_0x99a2c7,_0x1af681,_0x7616d6,_0x98c688,_0x4343dc);});}module[_0x25a3('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index f77004b..58254bd 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 _0x3abe=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','data1','license','split','createDecipher','update','base64','utf8','final','parse','License','then','format'];(function(_0x15011,_0x5553f5){var _0x4fe3ec=function(_0x35e426){while(--_0x35e426){_0x15011['push'](_0x15011['shift']());}};_0x4fe3ec(++_0x5553f5);}(_0x3abe,0xcd));var _0xe3ab=function(_0xd46e4,_0x44fe54){_0xd46e4=_0xd46e4-0x0;var _0x37a7c1=_0x3abe[_0xd46e4];return _0x37a7c1;};'use strict';var crypto=require(_0xe3ab('0x0'));var util=require('util');var compose=require(_0xe3ab('0x1'));var db=require(_0xe3ab('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x53d3b5,_0x55f3fd){if(_0x53d3b5&&_0x55f3fd){if(_0x55f3fd[_0xe3ab('0x3')]&&_0x55f3fd[_0xe3ab('0x4')]){var _0x147837=_0x55f3fd['data1'];var _0x435110=_0x55f3fd[_0xe3ab('0x4')];var _0xcc4452=_0x147837[_0xe3ab('0x5')]('-')[0x4];var _0x38b700=_0x147837['split']('-')[0x0];var _0x2cca40=crypto[_0xe3ab('0x6')]('aes-256-ctr',util['format']('%s:%s:%s',_0xcc4452,_0x147837,_0x38b700));var _0x3f996b=_0x2cca40[_0xe3ab('0x7')](_0x435110,_0xe3ab('0x8'),_0xe3ab('0x9'));_0x3f996b+=_0x2cca40[_0xe3ab('0xa')](_0xe3ab('0x9'));var _0x516de1=JSON[_0xe3ab('0xb')](_0x3f996b);return _0x516de1['hasOwnProperty'](_0x53d3b5)?_0x516de1[_0x53d3b5]:null;}}return null;}function isLimit(_0x3da4de,_0x4995b0,_0xa236d2,_0x3ecc3d){var _0x4b5bfc=_0x4995b0;return compose()['use'](function(_0x5b6a48,_0x110720,_0x1c2f39){return db[_0xe3ab('0xc')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xe3ab('0xd')](function(_0x1b5a71){var _0x3ca92d=getValueFromLicense(_0x3da4de,_0x1b5a71);return _0x3ca92d?_0x3ca92d:_0x4b5bfc;})[_0xe3ab('0xd')](function(_0x3a59c6){_0x4b5bfc=_0x3a59c6;return _0xa236d2['count'](_0x3ecc3d);})[_0xe3ab('0xd')](function(_0xfd8820){if(_0xfd8820>=_0x4b5bfc){return _0x110720['status'](0x193)['json']({'message':util[_0xe3ab('0xe')](_0xe3ab('0xf'),_0x3da4de)});}_0x1c2f39();})[_0xe3ab('0x10')](function(_0x598ae7){_0x1c2f39(_0x598ae7);});});}function isUserLimit(){return isLimit(_0xe3ab('0x11'),0x1,db[_0xe3ab('0x12')],{'where':{'$or':[{'role':_0xe3ab('0x13')},{'role':_0xe3ab('0x14')}]}});}exports[_0xe3ab('0x15')]=isUserLimit; \ No newline at end of file +var _0x097e=['../../mysqldb','../../config/environment','data1','license','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','composable-middleware'];(function(_0x4cd90c,_0x4bb9f3){var _0x3ce429=function(_0x32c213){while(--_0x32c213){_0x4cd90c['push'](_0x4cd90c['shift']());}};_0x3ce429(++_0x4bb9f3);}(_0x097e,0x1dd));var _0xe097=function(_0x2dc6d1,_0x5dcfa3){_0x2dc6d1=_0x2dc6d1-0x0;var _0x1811f9=_0x097e[_0x2dc6d1];return _0x1811f9;};'use strict';var crypto=require(_0xe097('0x0'));var util=require(_0xe097('0x1'));var compose=require(_0xe097('0x2'));var db=require(_0xe097('0x3'))['db'];var config=require(_0xe097('0x4'));function getValueFromLicense(_0x5429ee,_0x32f0bd){if(_0x5429ee&&_0x32f0bd){if(_0x32f0bd[_0xe097('0x5')]&&_0x32f0bd['license']){var _0x41afd8=_0x32f0bd['data1'];var _0x8bae32=_0x32f0bd[_0xe097('0x6')];var _0x2b04ce=_0x41afd8['split']('-')[0x4];var _0x260925=_0x41afd8['split']('-')[0x0];var _0x9526bc=crypto[_0xe097('0x7')](_0xe097('0x8'),util[_0xe097('0x9')](_0xe097('0xa'),_0x2b04ce,_0x41afd8,_0x260925));var _0x2b13ec=_0x9526bc[_0xe097('0xb')](_0x8bae32,_0xe097('0xc'),_0xe097('0xd'));_0x2b13ec+=_0x9526bc[_0xe097('0xe')](_0xe097('0xd'));var _0x47d5cd=JSON[_0xe097('0xf')](_0x2b13ec);return _0x47d5cd[_0xe097('0x10')](_0x5429ee)?_0x47d5cd[_0x5429ee]:null;}}return null;}function isLimit(_0x3382ff,_0x291622,_0x223c57,_0x2867f0){var _0x38d9c8=_0x291622;return compose()[_0xe097('0x11')](function(_0x4ded9f,_0x4e1a8a,_0x2f77d3){return db[_0xe097('0x12')][_0xe097('0x13')]({'where':{'id':0x1},'raw':!![]})[_0xe097('0x14')](function(_0x540f00){var _0x392c14=getValueFromLicense(_0x3382ff,_0x540f00);return _0x392c14?_0x392c14:_0x38d9c8;})[_0xe097('0x14')](function(_0x22fe5b){_0x38d9c8=_0x22fe5b;return _0x223c57[_0xe097('0x15')](_0x2867f0);})['then'](function(_0x3e2121){if(_0x3e2121>=_0x38d9c8){return _0x4e1a8a[_0xe097('0x16')](0x193)[_0xe097('0x17')]({'message':util['format'](_0xe097('0x18'),_0x3382ff)});}_0x2f77d3();})[_0xe097('0x19')](function(_0x520000){_0x2f77d3(_0x520000);});});}function isUserLimit(){return isLimit(_0xe097('0x1a'),0x1,db['User'],{'where':{'$or':[{'role':_0xe097('0x1b')},{'role':_0xe097('0x1c')}]}});}exports[_0xe097('0x1d')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 285cedc..111c600 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 _0xfa78=['NOT\x20IN\x20?','$ne','<>\x20?','$substring','$startsWith','$lt','$gt','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','$between','shift','pop','utcOffset','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','split','length','forEach','match','filter','indexOf','buildExpression','DATE','operator','$eq','value','includes','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?'];(function(_0x3ed054,_0x4d4f16){var _0x16dd95=function(_0xc0c19c){while(--_0xc0c19c){_0x3ed054['push'](_0x3ed054['shift']());}};_0x16dd95(++_0x4d4f16);}(_0xfa78,0x1d4));var _0x8fa7=function(_0xd0c6b5,_0x5c7ce8){_0xd0c6b5=_0xd0c6b5-0x0;var _0x4b4d90=_0xfa78[_0xd0c6b5];return _0x4b4d90;};'use strict';var _=require('lodash');var moment=require(_0x8fa7('0x0'));exports[_0x8fa7('0x1')]=function(_0x56b866){var _0x5d7507={'conditions':[]};_0x5d7507[_0x8fa7('0x2')]=_[_0x8fa7('0x3')](_0x56b866,_0x8fa7('0x4'))?'or':'and';var _0x3a1d92=_0x56b866[_0x8fa7('0x5')]('[$and]','')[_0x8fa7('0x5')](_0x8fa7('0x4'),'')[_0x8fa7('0x6')]('||');for(var _0x4091c4=0x0;_0x4091c4<_0x3a1d92[_0x8fa7('0x7')];_0x4091c4++){var _0x406213=_0x3a1d92[_0x4091c4]['split'](':=');var _0x1d0d93=_0x406213[0x0];var _0x5558fc=_0x406213['slice'](0x1);_0x5558fc[_0x8fa7('0x8')](function(_0x3fbc41){var _0x14836e=_0x3fbc41[_0x8fa7('0x6')]('[')['shift']();var _0x255c77=_0x3fbc41[_0x8fa7('0x9')](/\[(.*?)\]/g);_0x255c77[_0x8fa7('0x8')](function(_0x4dedaa){var _0x129f17=_0x4dedaa[_0x8fa7('0x6')]('[')[_0x8fa7('0xa')](function(_0x46038a){return _0x46038a[_0x8fa7('0xb')](']')>-0x1;})['map'](function(_0x12550d){return _0x12550d[_0x8fa7('0x6')](']')[0x0];})[0x0];_0x5d7507['conditions']['push']({'field':_0x1d0d93,'operator':_0x14836e,'value':_0x129f17});});});}return _0x5d7507;};exports[_0x8fa7('0xc')]=function(_0xb82681,_0x2c57b4,_0x38d437){var _0x373670={};if(_0x2c57b4===_0x8fa7('0xd')){if(_0x38d437[_0x8fa7('0xe')]===_0x8fa7('0xf')){_0x38d437[_0x8fa7('0xe')]='$between';_0x38d437[_0x8fa7('0x10')]+=','+_0x38d437[_0x8fa7('0x10')];}else if(_[_0x8fa7('0x11')](['$gt',_0x8fa7('0x12')],_0x38d437[_0x8fa7('0xe')])){_0x38d437[_0x8fa7('0x10')]=moment(_0x38d437['value'])[_0x8fa7('0x13')](0x1,_0x8fa7('0x14'))[_0x8fa7('0x15')](_0x8fa7('0x16'));}}if(_0x38d437[_0x8fa7('0x17')]){_0x2c57b4=_0x38d437['castTo'];_0x373670[_0x8fa7('0x18')]=_0x8fa7('0x19')+_0xb82681+'.'+_0x38d437[_0x8fa7('0x1a')]+_0x8fa7('0x1b')+_0x38d437[_0x8fa7('0x17')]+')\x20'+parseOperator(_0x38d437[_0x8fa7('0xe')]);}else{_0x373670[_0x8fa7('0x18')]=_0xb82681+'.'+_0x38d437[_0x8fa7('0x1a')]+'\x20'+parseOperator(_0x38d437[_0x8fa7('0xe')]);}if(_[_0x8fa7('0x11')](['$ne',_0x8fa7('0x1c')],_0x38d437[_0x8fa7('0xe')]))_0x373670[_0x8fa7('0x18')]='('+_0x373670[_0x8fa7('0x18')]+_0x8fa7('0x1d')+_0xb82681+'.'+_0x38d437[_0x8fa7('0x1a')]+_0x8fa7('0x1e');_0x373670[_0x8fa7('0x10')]=parseValue(_0x2c57b4,_0x38d437[_0x8fa7('0xe')],_0x38d437[_0x8fa7('0x10')]);return _0x373670;};function parseOperator(_0x4412ef){var _0x318e93;switch(_0x4412ef){case'$in':_0x318e93=_0x8fa7('0x1f');break;case'$notIn':_0x318e93=_0x8fa7('0x20');break;case _0x8fa7('0xf'):_0x318e93='=\x20?';break;case _0x8fa7('0x21'):_0x318e93=_0x8fa7('0x22');break;case _0x8fa7('0x23'):case _0x8fa7('0x24'):case'$endsWith':_0x318e93='LIKE\x20?';break;case _0x8fa7('0x25'):_0x318e93='<\x20?';break;case _0x8fa7('0x26'):_0x318e93=_0x8fa7('0x27');break;case _0x8fa7('0x12'):_0x318e93=_0x8fa7('0x28');break;case _0x8fa7('0x29'):_0x318e93='>=\x20?';break;case'$between':_0x318e93=_0x8fa7('0x2a');break;}return _0x318e93;}function parseValue(_0x60abb6,_0x253e2e,_0x1def76){var _0x487d51={'start':undefined,'end':undefined};switch(_0x253e2e){case _0x8fa7('0x2b'):case _0x8fa7('0x1c'):_0x487d51[_0x8fa7('0x2c')]=_0x1def76[_0x8fa7('0x6')](',');break;case _0x8fa7('0x23'):_0x487d51[_0x8fa7('0x2c')]='%'+_0x1def76+'%';break;case _0x8fa7('0x24'):_0x487d51[_0x8fa7('0x2c')]=_0x1def76+'%';break;case'$endsWith':_0x487d51[_0x8fa7('0x2c')]='%'+_0x1def76;break;case _0x8fa7('0x2d'):var _0x2adac2=_0x1def76['split'](',');var _0x1def76=_0x2adac2[_0x8fa7('0x2e')]();var _0x301b71=_0x2adac2[_0x8fa7('0x2f')]();if(_0x60abb6==='DATE'){_0x1def76=moment(_0x1def76)[_0x8fa7('0x30')](0x0,!![])[_0x8fa7('0x15')]();_0x301b71=moment(_0x301b71)[_0x8fa7('0x30')](0x0,!![])[_0x8fa7('0x13')](0x17,'hours')['add'](0x3b,'minutes')[_0x8fa7('0x13')](0x3b,_0x8fa7('0x31'))[_0x8fa7('0x15')]();}_0x487d51={'start':_0x1def76,'end':_0x301b71};break;default:_0x487d51['start']=_0x1def76;break;}return _0x487d51;} \ No newline at end of file +var _0x4d6d=['filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','days','format','YYYY-MM-DD','CAST(','field','\x20AS\x20','text','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','add','hours','minutes','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4d6d,0x1a6));var _0xd4d6=function(_0x87883d,_0x5aaa87){_0x87883d=_0x87883d-0x0;var _0x271f1b=_0x4d6d[_0x87883d];return _0x271f1b;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x2fec9c){var _0x199f95={'conditions':[]};_0x199f95['sqlOperator']=_[_0xd4d6('0x0')](_0x2fec9c,_0xd4d6('0x1'))?'or':_0xd4d6('0x2');var _0x4c8040=_0x2fec9c[_0xd4d6('0x3')](_0xd4d6('0x4'),'')[_0xd4d6('0x3')]('[$or]','')[_0xd4d6('0x5')]('||');for(var _0x16eb8d=0x0;_0x16eb8d<_0x4c8040[_0xd4d6('0x6')];_0x16eb8d++){var _0x1bb337=_0x4c8040[_0x16eb8d][_0xd4d6('0x5')](':=');var _0x9fd7b1=_0x1bb337[0x0];var _0x1a7d2f=_0x1bb337['slice'](0x1);_0x1a7d2f[_0xd4d6('0x7')](function(_0x5f4040){var _0x363411=_0x5f4040[_0xd4d6('0x5')]('[')[_0xd4d6('0x8')]();var _0x3f20d8=_0x5f4040[_0xd4d6('0x9')](/\[(.*?)\]/g);_0x3f20d8[_0xd4d6('0x7')](function(_0x24e49f){var _0x4b8b26=_0x24e49f['split']('[')[_0xd4d6('0xa')](function(_0x46c4e0){return _0x46c4e0[_0xd4d6('0xb')](']')>-0x1;})[_0xd4d6('0xc')](function(_0x8fcee3){return _0x8fcee3['split'](']')[0x0];})[0x0];_0x199f95[_0xd4d6('0xd')][_0xd4d6('0xe')]({'field':_0x9fd7b1,'operator':_0x363411,'value':_0x4b8b26});});});}return _0x199f95;};exports[_0xd4d6('0xf')]=function(_0x2f3da4,_0x5c8eba,_0x5ec3e3){var _0x55f1aa={};if(_0x5c8eba===_0xd4d6('0x10')){if(_0x5ec3e3[_0xd4d6('0x11')]==='$eq'){_0x5ec3e3['operator']=_0xd4d6('0x12');_0x5ec3e3[_0xd4d6('0x13')]+=','+_0x5ec3e3[_0xd4d6('0x13')];}else if(_[_0xd4d6('0x14')](['$gt','$lte'],_0x5ec3e3[_0xd4d6('0x11')])){_0x5ec3e3[_0xd4d6('0x13')]=moment(_0x5ec3e3[_0xd4d6('0x13')])['add'](0x1,_0xd4d6('0x15'))[_0xd4d6('0x16')](_0xd4d6('0x17'));}}if(_0x5ec3e3['castTo']){_0x5c8eba=_0x5ec3e3['castTo'];_0x55f1aa['text']=_0xd4d6('0x18')+_0x2f3da4+'.'+_0x5ec3e3[_0xd4d6('0x19')]+_0xd4d6('0x1a')+_0x5ec3e3['castTo']+')\x20'+parseOperator(_0x5ec3e3[_0xd4d6('0x11')]);}else{_0x55f1aa[_0xd4d6('0x1b')]=_0x2f3da4+'.'+_0x5ec3e3[_0xd4d6('0x19')]+'\x20'+parseOperator(_0x5ec3e3[_0xd4d6('0x11')]);}if(_[_0xd4d6('0x14')]([_0xd4d6('0x1c'),'$notIn'],_0x5ec3e3['operator']))_0x55f1aa[_0xd4d6('0x1b')]='('+_0x55f1aa[_0xd4d6('0x1b')]+_0xd4d6('0x1d')+_0x2f3da4+'.'+_0x5ec3e3['field']+_0xd4d6('0x1e');_0x55f1aa[_0xd4d6('0x13')]=parseValue(_0x5c8eba,_0x5ec3e3[_0xd4d6('0x11')],_0x5ec3e3['value']);return _0x55f1aa;};function parseOperator(_0x2c0c0d){var _0x3e26ab;switch(_0x2c0c0d){case _0xd4d6('0x1f'):_0x3e26ab=_0xd4d6('0x20');break;case _0xd4d6('0x21'):_0x3e26ab=_0xd4d6('0x22');break;case _0xd4d6('0x23'):_0x3e26ab='=\x20?';break;case'$ne':_0x3e26ab=_0xd4d6('0x24');break;case _0xd4d6('0x25'):case _0xd4d6('0x26'):case'$endsWith':_0x3e26ab=_0xd4d6('0x27');break;case _0xd4d6('0x28'):_0x3e26ab=_0xd4d6('0x29');break;case'$gt':_0x3e26ab=_0xd4d6('0x2a');break;case _0xd4d6('0x2b'):_0x3e26ab=_0xd4d6('0x2c');break;case'$gte':_0x3e26ab=_0xd4d6('0x2d');break;case _0xd4d6('0x12'):_0x3e26ab=_0xd4d6('0x2e');break;}return _0x3e26ab;}function parseValue(_0x355156,_0x9f28fd,_0x1adf5a){var _0x483c7a={'start':undefined,'end':undefined};switch(_0x9f28fd){case'$in':case _0xd4d6('0x21'):_0x483c7a[_0xd4d6('0x2f')]=_0x1adf5a[_0xd4d6('0x5')](',');break;case _0xd4d6('0x25'):_0x483c7a['start']='%'+_0x1adf5a+'%';break;case _0xd4d6('0x26'):_0x483c7a['start']=_0x1adf5a+'%';break;case _0xd4d6('0x30'):_0x483c7a[_0xd4d6('0x2f')]='%'+_0x1adf5a;break;case'$between':var _0x353e82=_0x1adf5a[_0xd4d6('0x5')](',');var _0x1adf5a=_0x353e82[_0xd4d6('0x8')]();var _0x3b266c=_0x353e82[_0xd4d6('0x31')]();if(_0x355156===_0xd4d6('0x10')){_0x1adf5a=moment(_0x1adf5a)[_0xd4d6('0x32')](0x0,!![])[_0xd4d6('0x16')]();_0x3b266c=moment(_0x3b266c)[_0xd4d6('0x32')](0x0,!![])[_0xd4d6('0x33')](0x17,_0xd4d6('0x34'))[_0xd4d6('0x33')](0x3b,_0xd4d6('0x35'))[_0xd4d6('0x33')](0x3b,'seconds')[_0xd4d6('0x16')]();}_0x483c7a={'start':_0x1adf5a,'end':_0x3b266c};break;default:_0x483c7a[_0xd4d6('0x2f')]=_0x1adf5a;break;}return _0x483c7a;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index fb5ebbb..30fe2c0 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 _0x58f4=['isEmail','getFullTextValue','\x22{EXPR}\x22','replace','push','{EXPR}','join','getOptions','query','$id','name','intersection','attributes','nolimit','offset','order','sort','where','pick','filter','object','value','VIRTUAL','lower','merge','include','sequelize','moment','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$'];(function(_0xd46054,_0xfced24){var _0x1200d2=function(_0x5d7c28){while(--_0x5d7c28){_0xd46054['push'](_0xd46054['shift']());}};_0x1200d2(++_0xfced24);}(_0x58f4,0x1b2));var _0x458f=function(_0x3d9327,_0x57463e){_0x3d9327=_0x3d9327-0x0;var _0x5eef27=_0x58f4[_0x3d9327];return _0x5eef27;};'use strict';var _=require('lodash');var sequelize=require(_0x458f('0x0'));var moment=require(_0x458f('0x1'));var db=require(_0x458f('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x7f727c){var _0x467122=['ne'];try{var _0x1ea809=JSON[_0x458f('0x3')](_0x7f727c);var _0x1a7469=Object[_0x458f('0x4')](_0x1ea809)[0x0];return _0x467122[_0x458f('0x5')](_0x1a7469);}catch(_0x19fac1){return![];}}function getOperatorValue(_0x103d54){var _0x5a1908=JSON['parse'](_0x103d54);var _0x5ad8b4=Object['keys'](_0x5a1908)[0x0];var _0x2a5c36=_0x5a1908[_0x5ad8b4];return{['$'+_0x5ad8b4]:_0x2a5c36};}function parseIncludeModel(_0x38f16c){var _0x4fdba0=JSON[_0x458f('0x3')](_0x38f16c);return{'model':db[_0x4fdba0[_0x458f('0x6')]],'as':_0x4fdba0[_0x458f('0x7')],'attributes':_0x4fdba0[_0x458f('0x8')],'raw':_0x4fdba0[_0x458f('0x9')]};}exports[_0x458f('0x8')]=function(_0x71289e){var _0x52cf4e=null;if(_0x71289e){_0x52cf4e=_0x71289e[_0x458f('0xa')](',');}return _0x52cf4e;};exports[_0x458f('0xb')]=function(_0x3c7d85,_0xc17327){var _0x15dfdb={};if(!_[_0x458f('0xc')](_0x3c7d85)){_[_0x458f('0xd')](_0x3c7d85,function(_0x15614f,_0x217cd7){try{if(_0xc17327){var _0x515ea4=_[_0x458f('0xe')](_0xc17327,{'name':_0x217cd7})||{};if(hasSequelizeOperator(_0x15614f)){_0x15dfdb[_0x217cd7]=getOperatorValue(_0x15614f);}else if(_0x515ea4[_0x458f('0xf')]===_0x458f('0x10')&&_['isPlainObject'](_0x15614f)){var _0xa6fd16=JSON['parse'](_0x15614f);var _0x17972e={'$gte':moment(moment(_0xa6fd16[_0x458f('0x11')])[_0x458f('0x12')](_0x458f('0x13')))[_0x458f('0x14')]()['format'](),'$lte':moment(moment(_0xa6fd16[_0x458f('0x15')])[_0x458f('0x12')](_0x458f('0x13')))[_0x458f('0x14')]()[_0x458f('0x16')](0x1,'s')[_0x458f('0x12')]()};_0x15dfdb[_0x217cd7]=_0x17972e;}else if(_0x515ea4['name']===_0x458f('0x17')){_0x15dfdb[_0x217cd7]=_0x15614f;}else{_0x15dfdb[_0x217cd7]=_[_0x458f('0x18')](_0x15614f)?_0x15614f:JSON[_0x458f('0x3')](_0x15614f);}}else{_0x15dfdb[_0x217cd7]=_[_0x458f('0x18')](_0x15614f)?_0x15614f:JSON[_0x458f('0x3')](_0x15614f);}}catch(_0x4008d3){_0x15dfdb[_0x217cd7]=_0x15614f['split'](',');}});}return _0x15dfdb;};exports[_0x458f('0x19')]=function(_0x3ec921){_0x3ec921=parseInt(_0x3ec921,0xa);if(!_0x3ec921||_0x3ec921<0x0){_0x3ec921=LIMIT_VALUE;}return _0x3ec921;};exports['offset']=function(_0x43303a){_0x43303a=parseInt(_0x43303a,0xa);if(!_0x43303a||_0x43303a<0x0){_0x43303a=0x0;}return _0x43303a;};exports['sort']=function(_0x51dc6c){var _0x34167b,_0x1a225f=null;if(_0x51dc6c){_0x34167b=_0x51dc6c['split'](',');_0x1a225f=_[_0x458f('0x1a')](_0x34167b,function(_0x252dc6){if(_0x252dc6[_0x458f('0x1b')]('-')===0x0){return[_0x252dc6===_0x458f('0x1c')?sequelize[_0x458f('0x1d')](sequelize[_0x458f('0x1e')](_0x458f('0x1c')),_0x458f('0x1f')):_0x252dc6['substr'](0x1),_0x458f('0x20')];}else{return[_0x252dc6===_0x458f('0x1c')?sequelize[_0x458f('0x1d')](sequelize[_0x458f('0x1e')]('priority'),_0x458f('0x1f')):_0x252dc6,_0x458f('0x21')];}});}return _0x1a225f;};exports[_0x458f('0x22')]=function(_0x1360d6,_0x5e4ffd){if(_[_0x458f('0xc')](_0x1360d6)){return _0x1360d6;}if(_[_0x458f('0x18')](_0x1360d6)){for(var _0x4f5573=0x0;_0x4f5573<_0x1360d6[_0x458f('0x23')];_0x4f5573+=0x1){_0x1360d6[_0x4f5573]=this[_0x458f('0x22')](_0x1360d6[_0x4f5573],_0x5e4ffd);}return _0x1360d6;}if(!_[_0x458f('0x24')](_0x1360d6)){return _0x1360d6;}if(_[_0x458f('0x25')](_0x5e4ffd)){_0x5e4ffd=[_0x5e4ffd];}if(!_[_0x458f('0x18')](_0x5e4ffd)){return _0x1360d6;}for(var _0x5e9f04=0x0;_0x5e9f04<_0x5e4ffd[_0x458f('0x23')];_0x5e9f04+=0x1){_['unset'](_0x1360d6,_0x5e4ffd[_0x5e9f04]);}for(var _0x4ddc44 in _0x1360d6){if(_0x1360d6[_0x458f('0x26')](_0x4ddc44)){_0x1360d6[_0x4ddc44]=this[_0x458f('0x22')](_0x1360d6[_0x4ddc44],_0x5e4ffd);}}return _0x1360d6;};exports[_0x458f('0x27')]=function(_0x4be211){return _0x4be211[_0x458f('0x28')](RegExp(_0x458f('0x29')))?!![]:![];};exports[_0x458f('0x2a')]=function(_0x3e6903){return _0x3e6903[_0x458f('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x458f('0x2b')]=function(_0x2c2b0e,_0x26fa0d){var _0x23eaa8=[];var _0x42b33b=/[ `!@#$%^&*()_\-?~]/;var _0x3773ca=_0x26fa0d?_0x458f('0x2c'):'{EXPR}';_0x2c2b0e[_0x458f('0xa')](/[ ,]+/)['forEach'](function(_0x2b090b){_0x2b090b=_0x2b090b[_0x458f('0x2d')](/([^:]")"+/g,'$1');_0x2b090b='+'+_0x2b090b+'*';var _0x5a1fb1=_0x2b090b[_0x458f('0x28')](_0x42b33b);if(_0x5a1fb1){_0x2b090b='\x22'+_0x2b090b+'\x22';}_0x23eaa8[_0x458f('0x2e')](_0x2b090b);});_0x3773ca=_0x3773ca[_0x458f('0x2d')](_0x458f('0x2f'),_0x23eaa8[_0x458f('0x30')]('\x20'));return _0x3773ca;};exports[_0x458f('0x31')]=function(_0xc63af,_0x5ab5c2,_0x22bb03){var _0x481c96={},_0x5c0a88={};if(_0x5ab5c2['query']['$id']){_0x5ab5c2[_0x458f('0x32')]['id']=_0x5ab5c2[_0x458f('0x32')]['$id'];delete _0x5ab5c2[_0x458f('0x32')][_0x458f('0x33')];}_0x481c96['model']=_['map'](_0xc63af,_0x458f('0x34'));_0x481c96[_0x458f('0x32')]=_['keys'](_0x5ab5c2['query']);_0x481c96[_0x458f('0xb')]=_[_0x458f('0x35')](_0x481c96[_0x458f('0x6')],_0x481c96['query']);_0x5c0a88[_0x458f('0x36')]=_[_0x458f('0x35')](_0x481c96[_0x458f('0x6')],this[_0x458f('0x8')](_0x5ab5c2[_0x458f('0x32')][_0x458f('0x8')]));_0x5c0a88[_0x458f('0x36')]=_0x5c0a88[_0x458f('0x36')][_0x458f('0x23')]?_0x5c0a88['attributes']:_0x481c96[_0x458f('0x6')];if(!_0x5ab5c2['query'][_0x458f('0x26')](_0x458f('0x37'))){_0x5c0a88[_0x458f('0x19')]=this[_0x458f('0x19')](_0x5ab5c2[_0x458f('0x32')]['limit']);_0x5c0a88['offset']=this[_0x458f('0x38')](_0x5ab5c2[_0x458f('0x32')][_0x458f('0x38')]);}_0x5c0a88[_0x458f('0x39')]=this[_0x458f('0x3a')](_0x5ab5c2[_0x458f('0x32')][_0x458f('0x3a')]);_0x5c0a88[_0x458f('0x3b')]=this[_0x458f('0xb')](_[_0x458f('0x3c')](_0x5ab5c2[_0x458f('0x32')],_0x481c96[_0x458f('0xb')]),_0xc63af);if(_0x5ab5c2[_0x458f('0x32')]['filter']){var _0x36fa8c=_0xc63af;var _0x20be52=_0x5ab5c2[_0x458f('0x32')][_0x458f('0x3d')];if(typeof _0x20be52===_0x458f('0x3e')){_0x36fa8c=_[_0x458f('0x3d')](_0xc63af,function(_0x32ed3a){return _[_0x458f('0x5')](_0x20be52['columns'],_0x32ed3a[_0x458f('0x34')]);});_0x20be52=_0x20be52[_0x458f('0x3f')];}_0x5c0a88[_0x458f('0x3b')]=_['merge'](_0x5c0a88[_0x458f('0x3b')],{'$or':_[_0x458f('0x1a')](_0x36fa8c,function(_0xb435d7){if(_0xb435d7[_0x458f('0xf')]!==_0x458f('0x40')){if(_0x22bb03){return sequelize['where'](sequelize['fn']('lower',sequelize['col'](_0xb435d7[_0x458f('0x34')])),{'$like':sequelize['fn'](_0x458f('0x41'),'%'+_0x5ab5c2[_0x458f('0x32')][_0x458f('0x3d')]+'%')});}else{var _0x58a574={};_0x58a574[_0xb435d7[_0x458f('0x34')]]={'$like':'%'+_0x5ab5c2[_0x458f('0x32')]['filter']+'%'};return _0x58a574;}}})});}_0x5c0a88=_[_0x458f('0x42')]({},_0x5c0a88,_0x5ab5c2['options']);return _0x5c0a88;};exports[_0x458f('0x43')]=function(_0x11e511){var _0x2ef86b=[];if(_0x11e511['includeAll']){_0x2ef86b['push']({'all':!![]});}else if(_0x11e511[_0x458f('0x43')]){if(Array[_0x458f('0x18')](_0x11e511[_0x458f('0x43')])){_0x2ef86b=Object[_0x458f('0x4')](_0x11e511[_0x458f('0x43')])[_0x458f('0x1a')](function(_0x5bccb1){return parseIncludeModel(_0x11e511[_0x458f('0x43')][_0x5bccb1]);});}else{var _0xa4236e=parseIncludeModel(_0x11e511[_0x458f('0x43')]);_0x2ef86b['push'](_0xa4236e);}}return _0x2ef86b;}; \ No newline at end of file +var _0xb66c=['unsigned','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','push','getOptions','query','$id','name','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','object','columns','value','merge','VIRTUAL','col','lower','options','include','lodash','moment','keys','includes','parse','model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','utc','format','$lte','subtract','uniqueid','isArray','offset','map','indexOf','priority','cast','DESC'];(function(_0x318fe8,_0x503fd1){var _0x453aee=function(_0x4f3862){while(--_0x4f3862){_0x318fe8['push'](_0x318fe8['shift']());}};_0x453aee(++_0x503fd1);}(_0xb66c,0x175));var _0xcb66=function(_0x1ba341,_0x54f621){_0x1ba341=_0x1ba341-0x0;var _0x56ad90=_0xb66c[_0x1ba341];return _0x56ad90;};'use strict';var _=require(_0xcb66('0x0'));var sequelize=require('sequelize');var moment=require(_0xcb66('0x1'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2afcb8){var _0x24ea13=['ne'];try{var _0xf7ccc5=JSON['parse'](_0x2afcb8);var _0x35d439=Object[_0xcb66('0x2')](_0xf7ccc5)[0x0];return _0x24ea13[_0xcb66('0x3')](_0x35d439);}catch(_0x21be55){return![];}}function getOperatorValue(_0x5d766d){var _0x518163=JSON[_0xcb66('0x4')](_0x5d766d);var _0x1b6852=Object[_0xcb66('0x2')](_0x518163)[0x0];var _0x439f3d=_0x518163[_0x1b6852];return{['$'+_0x1b6852]:_0x439f3d};}function parseIncludeModel(_0xf7bc39){var _0x58582b=JSON[_0xcb66('0x4')](_0xf7bc39);return{'model':db[_0x58582b[_0xcb66('0x5')]],'as':_0x58582b[_0xcb66('0x6')],'attributes':_0x58582b[_0xcb66('0x7')],'raw':_0x58582b[_0xcb66('0x8')]};}exports['fields']=function(_0x393bde){var _0x2b32ec=null;if(_0x393bde){_0x2b32ec=_0x393bde[_0xcb66('0x9')](',');}return _0x2b32ec;};exports[_0xcb66('0xa')]=function(_0x4841e4,_0x9eda68){var _0x3471f3={};if(!_[_0xcb66('0xb')](_0x4841e4)){_[_0xcb66('0xc')](_0x4841e4,function(_0x582523,_0x4079ae){try{if(_0x9eda68){var _0x40c810=_[_0xcb66('0xd')](_0x9eda68,{'name':_0x4079ae})||{};if(hasSequelizeOperator(_0x582523)){_0x3471f3[_0x4079ae]=getOperatorValue(_0x582523);}else if(_0x40c810[_0xcb66('0xe')]==='DATE'&&_[_0xcb66('0xf')](_0x582523)){var _0x540e7e=JSON[_0xcb66('0x4')](_0x582523);var _0x52b058={'$gte':moment(moment(_0x540e7e[_0xcb66('0x10')])['format']('YYYY-MM-DD'))[_0xcb66('0x11')]()[_0xcb66('0x12')](),'$lte':moment(moment(_0x540e7e[_0xcb66('0x13')])[_0xcb66('0x12')]('YYYY-MM-DD'))[_0xcb66('0x11')]()[_0xcb66('0x14')](0x1,'s')[_0xcb66('0x12')]()};_0x3471f3[_0x4079ae]=_0x52b058;}else if(_0x40c810['name']===_0xcb66('0x15')){_0x3471f3[_0x4079ae]=_0x582523;}else{_0x3471f3[_0x4079ae]=_['isArray'](_0x582523)?_0x582523:JSON[_0xcb66('0x4')](_0x582523);}}else{_0x3471f3[_0x4079ae]=_[_0xcb66('0x16')](_0x582523)?_0x582523:JSON[_0xcb66('0x4')](_0x582523);}}catch(_0x1ccb71){_0x3471f3[_0x4079ae]=_0x582523['split'](',');}});}return _0x3471f3;};exports['limit']=function(_0x4d9690){_0x4d9690=parseInt(_0x4d9690,0xa);if(!_0x4d9690||_0x4d9690<0x0){_0x4d9690=LIMIT_VALUE;}return _0x4d9690;};exports[_0xcb66('0x17')]=function(_0x4b13d4){_0x4b13d4=parseInt(_0x4b13d4,0xa);if(!_0x4b13d4||_0x4b13d4<0x0){_0x4b13d4=0x0;}return _0x4b13d4;};exports['sort']=function(_0x419540){var _0x507d5a,_0x1c1219=null;if(_0x419540){_0x507d5a=_0x419540[_0xcb66('0x9')](',');_0x1c1219=_[_0xcb66('0x18')](_0x507d5a,function(_0x433909){if(_0x433909[_0xcb66('0x19')]('-')===0x0){return[_0x433909===_0xcb66('0x1a')?sequelize[_0xcb66('0x1b')](sequelize['col'](_0xcb66('0x1a')),'unsigned'):_0x433909['substr'](0x1),_0xcb66('0x1c')];}else{return[_0x433909===_0xcb66('0x1a')?sequelize[_0xcb66('0x1b')](sequelize['col'](_0xcb66('0x1a')),_0xcb66('0x1d')):_0x433909,_0xcb66('0x1e')];}});}return _0x1c1219;};exports[_0xcb66('0x1f')]=function(_0x5affdb,_0x6661c4){if(_[_0xcb66('0xb')](_0x5affdb)){return _0x5affdb;}if(_[_0xcb66('0x16')](_0x5affdb)){for(var _0x293711=0x0;_0x293711<_0x5affdb[_0xcb66('0x20')];_0x293711+=0x1){_0x5affdb[_0x293711]=this[_0xcb66('0x1f')](_0x5affdb[_0x293711],_0x6661c4);}return _0x5affdb;}if(!_[_0xcb66('0x21')](_0x5affdb)){return _0x5affdb;}if(_[_0xcb66('0x22')](_0x6661c4)){_0x6661c4=[_0x6661c4];}if(!_[_0xcb66('0x16')](_0x6661c4)){return _0x5affdb;}for(var _0x178a06=0x0;_0x178a06<_0x6661c4['length'];_0x178a06+=0x1){_[_0xcb66('0x23')](_0x5affdb,_0x6661c4[_0x178a06]);}for(var _0x5b7cf2 in _0x5affdb){if(_0x5affdb['hasOwnProperty'](_0x5b7cf2)){_0x5affdb[_0x5b7cf2]=this['omit'](_0x5affdb[_0x5b7cf2],_0x6661c4);}}return _0x5affdb;};exports[_0xcb66('0x24')]=function(_0x4ca8b4){return _0x4ca8b4[_0xcb66('0x25')](RegExp(_0xcb66('0x26')))?!![]:![];};exports[_0xcb66('0x27')]=function(_0x5d3fb5){return _0x5d3fb5[_0xcb66('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xcb66('0x28')]=function(_0x266862,_0x311ede){var _0xa411e3=[];var _0x375636=/[ `!@#$%^&*()_\-?~]/;var _0x2a5e56=_0x311ede?_0xcb66('0x29'):_0xcb66('0x2a');_0x266862[_0xcb66('0x9')](/[ ,]+/)['forEach'](function(_0x4529e8){_0x4529e8=_0x4529e8[_0xcb66('0x2b')](/([^:]")"+/g,'$1');_0x4529e8='+'+_0x4529e8+'*';var _0xeba0d1=_0x4529e8[_0xcb66('0x25')](_0x375636);if(_0xeba0d1){_0x4529e8='\x22'+_0x4529e8+'\x22';}_0xa411e3[_0xcb66('0x2c')](_0x4529e8);});_0x2a5e56=_0x2a5e56[_0xcb66('0x2b')](_0xcb66('0x2a'),_0xa411e3['join']('\x20'));return _0x2a5e56;};exports[_0xcb66('0x2d')]=function(_0x331305,_0x216072,_0x37f522){var _0x4c97b4={},_0x1a9545={};if(_0x216072[_0xcb66('0x2e')][_0xcb66('0x2f')]){_0x216072[_0xcb66('0x2e')]['id']=_0x216072[_0xcb66('0x2e')][_0xcb66('0x2f')];delete _0x216072[_0xcb66('0x2e')][_0xcb66('0x2f')];}_0x4c97b4[_0xcb66('0x5')]=_[_0xcb66('0x18')](_0x331305,_0xcb66('0x30'));_0x4c97b4[_0xcb66('0x2e')]=_['keys'](_0x216072['query']);_0x4c97b4['filters']=_[_0xcb66('0x31')](_0x4c97b4[_0xcb66('0x5')],_0x4c97b4[_0xcb66('0x2e')]);_0x1a9545[_0xcb66('0x32')]=_[_0xcb66('0x31')](_0x4c97b4[_0xcb66('0x5')],this['fields'](_0x216072[_0xcb66('0x2e')]['fields']));_0x1a9545['attributes']=_0x1a9545['attributes'][_0xcb66('0x20')]?_0x1a9545[_0xcb66('0x32')]:_0x4c97b4[_0xcb66('0x5')];if(!_0x216072[_0xcb66('0x2e')][_0xcb66('0x33')](_0xcb66('0x34'))){_0x1a9545[_0xcb66('0x35')]=this[_0xcb66('0x35')](_0x216072[_0xcb66('0x2e')]['limit']);_0x1a9545[_0xcb66('0x17')]=this[_0xcb66('0x17')](_0x216072[_0xcb66('0x2e')]['offset']);}_0x1a9545[_0xcb66('0x36')]=this[_0xcb66('0x37')](_0x216072['query']['sort']);_0x1a9545[_0xcb66('0x38')]=this['filters'](_['pick'](_0x216072[_0xcb66('0x2e')],_0x4c97b4[_0xcb66('0xa')]),_0x331305);if(_0x216072[_0xcb66('0x2e')][_0xcb66('0x39')]){var _0x99229=_0x331305;var _0x235862=_0x216072[_0xcb66('0x2e')][_0xcb66('0x39')];if(typeof _0x235862===_0xcb66('0x3a')){_0x99229=_['filter'](_0x331305,function(_0x5ac7a6){return _['includes'](_0x235862[_0xcb66('0x3b')],_0x5ac7a6['name']);});_0x235862=_0x235862[_0xcb66('0x3c')];}_0x1a9545['where']=_[_0xcb66('0x3d')](_0x1a9545[_0xcb66('0x38')],{'$or':_[_0xcb66('0x18')](_0x99229,function(_0x11c2f3){if(_0x11c2f3[_0xcb66('0xe')]!==_0xcb66('0x3e')){if(_0x37f522){return sequelize['where'](sequelize['fn']('lower',sequelize[_0xcb66('0x3f')](_0x11c2f3[_0xcb66('0x30')])),{'$like':sequelize['fn'](_0xcb66('0x40'),'%'+_0x216072[_0xcb66('0x2e')][_0xcb66('0x39')]+'%')});}else{var _0x1c149b={};_0x1c149b[_0x11c2f3[_0xcb66('0x30')]]={'$like':'%'+_0x216072[_0xcb66('0x2e')][_0xcb66('0x39')]+'%'};return _0x1c149b;}}})});}_0x1a9545=_['merge']({},_0x1a9545,_0x216072[_0xcb66('0x41')]);return _0x1a9545;};exports[_0xcb66('0x42')]=function(_0x4370ff){var _0x346379=[];if(_0x4370ff['includeAll']){_0x346379[_0xcb66('0x2c')]({'all':!![]});}else if(_0x4370ff[_0xcb66('0x42')]){if(Array[_0xcb66('0x16')](_0x4370ff['include'])){_0x346379=Object[_0xcb66('0x2')](_0x4370ff[_0xcb66('0x42')])[_0xcb66('0x18')](function(_0x3a8192){return parseIncludeModel(_0x4370ff['include'][_0x3a8192]);});}else{var _0x43e0e0=parseIncludeModel(_0x4370ff[_0xcb66('0x42')]);_0x346379[_0xcb66('0x2c')](_0x43e0e0);}}return _0x346379;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 07e741d..b5fdef8 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 _0xad9f=['whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','name','role','lastLoginAt','chatStatusTime','voiceStatusTime','whatsappStatusTime','chatCapacity','smsCapacity','whatsappCapacity','faxCurrentCapacity','smsCurrentCapacity','phoneBarEnableScreenRecordingByAgent','destconnectedlinenum','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','client','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','every','chatStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','includes','getAgentIdsByStatus','resolve','User','fullname','pauseType','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','substring','indexOf','internal','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','chatPause','openchannelCapacity','mailCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0xad9f,0x1be));var _0xfad9=function(_0x5bed93,_0x3df8a8){_0x5bed93=_0x5bed93-0x0;var _0x158df2=_0xad9f[_0x5bed93];return _0x158df2;};'use strict';var _=require(_0xfad9('0x0'));var jayson=require(_0xfad9('0x1'));var db=require(_0xfad9('0x2'))['db'];var amiClient=jayson['client'][_0xfad9('0x3')]({'port':0x232a});var routingClient=jayson[_0xfad9('0x4')][_0xfad9('0x3')]({'port':0x232c});function isAgentPaused(_0x1a9d9b,_0x596189){var _0x39910f=[_0x1a9d9b['chatPause'],_0x1a9d9b[_0xfad9('0x5')],_0x1a9d9b[_0xfad9('0x6')],_0x1a9d9b[_0xfad9('0x7')],_0x1a9d9b[_0xfad9('0x8')],_0x1a9d9b[_0xfad9('0x9')],_0x1a9d9b[_0xfad9('0xa')]];if(!_0x596189)return _['every'](_0x39910f);var _0x5580be=_[_0xfad9('0xb')](_0x39910f);return _0x5580be[_0xfad9('0xc')]>0x0&&_0x5580be[_0xfad9('0xc')]<_0x39910f[_0xfad9('0xc')]?!![]:![];}function isIdle(_0x22dca1){return _0x22dca1===_0xfad9('0xd')||_0x22dca1===_0xfad9('0xe')||_0x22dca1===_0xfad9('0xf')||_0x22dca1==='ringing'||_[_0xfad9('0x10')](_0x22dca1);}function isAgentIdle(_0x2da607){if(_0x2da607[_0xfad9('0x11')]!==_0xfad9('0xd')&&_0x2da607[_0xfad9('0x9')]){_0x2da607[_0xfad9('0x11')]=_0xfad9('0x12');return![];}return _[_0xfad9('0x13')]([_0x2da607[_0xfad9('0x14')],_0x2da607[_0xfad9('0x15')],_0x2da607[_0xfad9('0x16')],_0x2da607['openchannelStatus'],_0x2da607[_0xfad9('0x17')],_0x2da607[_0xfad9('0x11')],_0x2da607[_0xfad9('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xfad9('0x19')](_0xfad9('0x1a'),{})[_0xfad9('0x1b')](function(_0x567e45){if(_0x567e45[_0xfad9('0x1c')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x1f6808=_0x567e45[_0xfad9('0x1d')];return routingClient['request']('Agents',{})[_0xfad9('0x1b')](function(_0x18e48a){if(_0x18e48a[_0xfad9('0x1c')]){throw new Error(_0xfad9('0x1e'));}var _0x2843ce=_0x18e48a[_0xfad9('0x1d')];return _[_0xfad9('0x1f')]({},_0x1f6808,_0x2843ce);});})[_0xfad9('0x20')](function(_0x97cc3a){throw _0x97cc3a;});}exports[_0xfad9('0x21')]=getRealtimeAgents;function getAgentStatus(_0x55b775){var _0x5e73fd='unknown';if(isAgentPaused(_0x55b775))_0x5e73fd=_0xfad9('0x12');else if(isAgentPaused(_0x55b775,!![]))_0x5e73fd=_0xfad9('0x22');else if(isAgentIdle(_0x55b775))_0x5e73fd=_0xfad9('0xd');else _0x5e73fd=_0xfad9('0x23');return _0x5e73fd;}exports[_0xfad9('0x24')]=getAgentStatus;function getAgentIdsByQueues(_0x25c53c,_0x5c157f){var _0x46e091=_[_0xfad9('0x25')](_0x25c53c)?_0x25c53c:[_0x25c53c];var _0x63d6c7=_[_0xfad9('0x26')](_0x5c157f)+_0xfad9('0x27');var _0x1371dc=_[_0xfad9('0x28')](_0x46e091,function(_0x120f2d){return db[_0x63d6c7][_0xfad9('0x29')]({'where':{'id':_0x120f2d}})['then'](function(_0x179c9d){if(!_0x179c9d)return[];return _0x179c9d[_0xfad9('0x2a')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xfad9('0x2b')](_0x1371dc)[_0xfad9('0x1b')](function(_0x39f094){var _0x51ee01=_(_0x39f094)[_0xfad9('0x2c')]()['map']('id')[_0xfad9('0x2d')]()[_0xfad9('0x2e')]();return _0x51ee01;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x57e717,_0x3d5f4b,_0xa2449e){try{if(_0x3d5f4b['length']>0x0){_0x57e717=_0x57e717[_0xfad9('0xb')](function(_0x5e61c9){return _0x3d5f4b[_0xfad9('0x2f')](_0x5e61c9['id']);});}var _0x5a3ecb=_0x57e717[_0xfad9('0xb')](function(_0x4957eb){var _0x3dda71=_0xfad9('0x23');if(isAgentIdle(_0x4957eb)){_0x3dda71='idle';}return _0x3dda71===_0xa2449e;});return _[_0xfad9('0x28')](_0x5a3ecb,'id');}catch(_0x44c125){throw _0x44c125;}}exports[_0xfad9('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5dbb54,_0x2893a2,_0x276856){return Promise[_0xfad9('0x31')]()[_0xfad9('0x1b')](function(){if(_0x2893a2[_0xfad9('0xc')]>0x0){_0x5dbb54=_0x5dbb54['filter'](function(_0x3fbdbd){return _0x2893a2[_0xfad9('0x2f')](_0x3fbdbd['id']);});}return _0x5dbb54;})[_0xfad9('0x1b')](function(){return db[_0xfad9('0x32')]['findAll']({'attributes':['id','name',_0xfad9('0x33'),'chatPause',_0xfad9('0x5'),_0xfad9('0x6'),_0xfad9('0x7'),_0xfad9('0x8'),_0xfad9('0x9'),_0xfad9('0xa'),_0xfad9('0x34')],'where':{'id':{'$in':_[_0xfad9('0x28')](_0x5dbb54,'id')}},'raw':!![]});})['then'](function(_0x3ead13){return _0x3ead13[_0xfad9('0x28')](function(_0x29af3a){var _0x21898a=_['find'](_0x5dbb54,['id',_0x29af3a['id']]);var _0x262255=filterAgentAttributes(_0x21898a);_[_0xfad9('0x1f')](_0x29af3a,_0x262255);_0x29af3a['globalStatus']=getAgentStatus(_0x29af3a);return _0x29af3a;});})['then'](function(_0xe8cba8){var _0x4bdf5a=sortAgentsByStatus(_0xe8cba8,_0x276856);return _[_0xfad9('0x28')](_0x4bdf5a,'id');})[_0xfad9('0x20')](function(_0x4d84c4){throw _0x4d84c4;});}exports[_0xfad9('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x57c77f){var _0x5f4105={'fields':[],'order':null};var _0x35199b=_0x57c77f[_0xfad9('0x36')](',');_0x5f4105[_0xfad9('0x37')]=_[_0xfad9('0xb')](_0x35199b,function(_0x6869af){if(!_0x6869af[_0xfad9('0x2f')](_0xfad9('0x38'))){return!![];}_0x5f4105[_0xfad9('0x39')]=_[_0xfad9('0x3a')](_0x6869af,'-')?'DESC':_0xfad9('0x3b');return![];});return _0x5f4105;}exports[_0xfad9('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0xfd3896){if(!_0xfd3896){_0xfd3896=_0xfad9('0x3d');}if(_0xfd3896[_0xfad9('0x2f')](_0xfad9('0x33'))&&!_0xfd3896[_0xfad9('0x2f')]('internal')){var _0x4e2abe=_0xfd3896[_0xfad9('0x3e')](0x0,_0xfd3896[_0xfad9('0x3f')](_0xfad9('0x33')));_0xfd3896+=','+_0x4e2abe+_0xfad9('0x40');}return _0xfd3896;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x1c6925,_0x86994){var _0x202979=_0x1c6925[_0xfad9('0x41')](function(_0x7274f3,_0x3a89e8){if(_0x7274f3[_0xfad9('0x38')]===_0x3a89e8['globalStatus']){if(_0x7274f3[_0xfad9('0x38')]===_0xfad9('0x12')){if(_0x86994===_0xfad9('0x42')){return(_0x7274f3[_0xfad9('0x34')]||'')<(_0x3a89e8[_0xfad9('0x34')]||'')||_0x7274f3[_0xfad9('0x33')]['toLowerCase']()>_0x3a89e8[_0xfad9('0x33')][_0xfad9('0x43')]()?0x1:-0x1;}else{return(_0x7274f3['pauseType']||'')<(_0x3a89e8[_0xfad9('0x34')]||'')||_0x7274f3[_0xfad9('0x33')]['toLowerCase']()>_0x3a89e8['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x86994===_0xfad9('0x42')){return _0x7274f3['fullname']['toLowerCase']()<_0x3a89e8[_0xfad9('0x33')][_0xfad9('0x43')]()?0x1:-0x1;}else{return _0x7274f3[_0xfad9('0x33')]['toLowerCase']()<_0x3a89e8[_0xfad9('0x33')][_0xfad9('0x43')]()?-0x1:0x1;}}}else{if(_0x86994===_0xfad9('0x42')){return _0x7274f3[_0xfad9('0x38')]<_0x3a89e8[_0xfad9('0x38')]?0x1:-0x1;}else{return _0x7274f3[_0xfad9('0x38')]<_0x3a89e8['globalStatus']?-0x1:0x1;}}});return _0x202979;}exports[_0xfad9('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x1c5673){var _0xe651c2=[_0xfad9('0x45'),_0xfad9('0x46'),'lastLoginAt',_0xfad9('0x47'),'pauseType','lastPauseAt',_0xfad9('0x40'),_0xfad9('0x48'),_0xfad9('0x49'),_0xfad9('0x7'),'mailPause',_0xfad9('0x8'),_0xfad9('0xa'),'faxPause',_0xfad9('0x9'),'chatCapacity',_0xfad9('0x4a'),_0xfad9('0x4b'),'smsCapacity','whatsappCapacity',_0xfad9('0x4c'),'chatCurrentCapacity',_0xfad9('0x4d'),_0xfad9('0x4e'),'smsCurrentCapacity',_0xfad9('0x4f'),'faxCurrentCapacity',_0xfad9('0x14'),_0xfad9('0x50'),_0xfad9('0x16'),'smsStatus',_0xfad9('0x18'),_0xfad9('0x15'),_0xfad9('0x11'),'chatStatusTime',_0xfad9('0x51'),_0xfad9('0x52'),_0xfad9('0x53'),'whatsappStatusTime',_0xfad9('0x54'),'voiceStatusTime',_0xfad9('0x55'),'destconnectedlinenum',_0xfad9('0x56'),'phoneBarEnableScreenRecordingByAgent',_0xfad9('0x57')];var _0x5620af=[_0xfad9('0x49'),_0xfad9('0x7'),_0xfad9('0x6'),_0xfad9('0x8'),_0xfad9('0xa'),_0xfad9('0x5'),_0xfad9('0x9'),_0xfad9('0x46')];var _0x175d8f=_(_0x1c5673)[_0xfad9('0x58')](_0x5620af)[_0xfad9('0x59')](_0xe651c2)[_0xfad9('0x2e')]();return _0x175d8f;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xfad9('0x5a'),_0xfad9('0x33'),_0xfad9('0x5b'),_0xfad9('0x40'),'online',_0xfad9('0x38'),'userpic',_0xfad9('0x5c'),_0xfad9('0x34'),_0xfad9('0x47'),'faxPause',_0xfad9('0x49'),_0xfad9('0x6'),_0xfad9('0x7'),_0xfad9('0x8'),'voicePause',_0xfad9('0xa'),_0xfad9('0x14'),_0xfad9('0x15'),'mailStatus',_0xfad9('0x50'),'smsStatus','voiceStatus',_0xfad9('0x18'),_0xfad9('0x5d'),_0xfad9('0x54'),_0xfad9('0x52'),_0xfad9('0x51'),'smsStatusTime',_0xfad9('0x5e'),_0xfad9('0x5f'),_0xfad9('0x60'),_0xfad9('0x4c'),'mailCapacity',_0xfad9('0x4a'),_0xfad9('0x61'),_0xfad9('0x62'),'chatCurrentCapacity',_0xfad9('0x63'),_0xfad9('0x4e'),_0xfad9('0x4d'),_0xfad9('0x64'),_0xfad9('0x4f'),_0xfad9('0x65'),_0xfad9('0x57'),_0xfad9('0x66'),_0xfad9('0x67'),_0xfad9('0x55'),'screenrecording'];}exports[_0xfad9('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xaa64=['ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatus','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','filterAgentAttributes','name','role','voiceStatusTime','chatCurrentCapacity','faxCurrentCapacity','openchannelCurrentCapacity','onhold','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','every','chatStatus','faxStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','findOne','getAgents','all','map','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','fullname','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','order','DESC'];(function(_0x3bc7bd,_0x1e7bbc){var _0x2f3d89=function(_0x516f01){while(--_0x516f01){_0x3bc7bd['push'](_0x3bc7bd['shift']());}};_0x2f3d89(++_0x1e7bbc);}(_0xaa64,0xf7));var _0x4aa6=function(_0x46bdee,_0x3c3738){_0x46bdee=_0x46bdee-0x0;var _0x5a3fae=_0xaa64[_0x46bdee];return _0x5a3fae;};'use strict';var _=require(_0x4aa6('0x0'));var jayson=require(_0x4aa6('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x4aa6('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x4aa6('0x2')][_0x4aa6('0x3')]({'port':0x232c});function isAgentPaused(_0x5277d1,_0x5797c8){var _0x17dfbb=[_0x5277d1[_0x4aa6('0x4')],_0x5277d1[_0x4aa6('0x5')],_0x5277d1[_0x4aa6('0x6')],_0x5277d1[_0x4aa6('0x7')],_0x5277d1[_0x4aa6('0x8')],_0x5277d1[_0x4aa6('0x9')],_0x5277d1['whatsappPause']];if(!_0x5797c8)return _['every'](_0x17dfbb);var _0xee21ba=_[_0x4aa6('0xa')](_0x17dfbb);return _0xee21ba['length']>0x0&&_0xee21ba[_0x4aa6('0xb')]<_0x17dfbb['length']?!![]:![];}function isIdle(_0x1df231){return _0x1df231===_0x4aa6('0xc')||_0x1df231===_0x4aa6('0xd')||_0x1df231===_0x4aa6('0xe')||_0x1df231==='ringing'||_[_0x4aa6('0xf')](_0x1df231);}function isAgentIdle(_0x1d23d2){if(_0x1d23d2[_0x4aa6('0x10')]!==_0x4aa6('0xc')&&_0x1d23d2[_0x4aa6('0x9')]){_0x1d23d2[_0x4aa6('0x10')]=_0x4aa6('0x11');return![];}return _[_0x4aa6('0x12')]([_0x1d23d2[_0x4aa6('0x13')],_0x1d23d2[_0x4aa6('0x14')],_0x1d23d2['mailStatus'],_0x1d23d2[_0x4aa6('0x15')],_0x1d23d2['smsStatus'],_0x1d23d2['voiceStatus'],_0x1d23d2[_0x4aa6('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x4aa6('0x17')](_0x4aa6('0x18'),{})[_0x4aa6('0x19')](function(_0x375c09){if(_0x375c09[_0x4aa6('0x1a')]){throw new Error(_0x4aa6('0x1b'));}var _0x2c5c66=_0x375c09['result'];return routingClient[_0x4aa6('0x17')]('Agents',{})[_0x4aa6('0x19')](function(_0x5c6d3c){if(_0x5c6d3c['error']){throw new Error(_0x4aa6('0x1c'));}var _0x15f5e6=_0x5c6d3c[_0x4aa6('0x1d')];return _[_0x4aa6('0x1e')]({},_0x2c5c66,_0x15f5e6);});})[_0x4aa6('0x1f')](function(_0x1dfd4e){throw _0x1dfd4e;});}exports[_0x4aa6('0x20')]=getRealtimeAgents;function getAgentStatus(_0x10a2e7){var _0x15365e='unknown';if(isAgentPaused(_0x10a2e7))_0x15365e=_0x4aa6('0x11');else if(isAgentPaused(_0x10a2e7,!![]))_0x15365e=_0x4aa6('0x21');else if(isAgentIdle(_0x10a2e7))_0x15365e=_0x4aa6('0xc');else _0x15365e=_0x4aa6('0x22');return _0x15365e;}exports[_0x4aa6('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x1e121f,_0x594665){var _0xa0f5be=_[_0x4aa6('0x24')](_0x1e121f)?_0x1e121f:[_0x1e121f];var _0x3802d8=_[_0x4aa6('0x25')](_0x594665)+_0x4aa6('0x26');var _0x44d151=_['map'](_0xa0f5be,function(_0x2f4943){return db[_0x3802d8][_0x4aa6('0x27')]({'where':{'id':_0x2f4943}})['then'](function(_0x5947c4){if(!_0x5947c4)return[];return _0x5947c4[_0x4aa6('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x4aa6('0x29')](_0x44d151)[_0x4aa6('0x19')](function(_0x3425df){var _0x2001ce=_(_0x3425df)['flatten']()[_0x4aa6('0x2a')]('id')[_0x4aa6('0x2b')]()[_0x4aa6('0x2c')]();return _0x2001ce;});}exports[_0x4aa6('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x45a9e3,_0x256342,_0x57a3cc){try{if(_0x256342[_0x4aa6('0xb')]>0x0){_0x45a9e3=_0x45a9e3[_0x4aa6('0xa')](function(_0x5bc756){return _0x256342[_0x4aa6('0x2e')](_0x5bc756['id']);});}var _0x121b97=_0x45a9e3[_0x4aa6('0xa')](function(_0x1fe9cb){var _0x4d4b60=_0x4aa6('0x22');if(isAgentIdle(_0x1fe9cb)){_0x4d4b60=_0x4aa6('0xc');}return _0x4d4b60===_0x57a3cc;});return _[_0x4aa6('0x2a')](_0x121b97,'id');}catch(_0x52b038){throw _0x52b038;}}exports[_0x4aa6('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x29f31a,_0x27da7e,_0x58d768){return Promise[_0x4aa6('0x30')]()[_0x4aa6('0x19')](function(){if(_0x27da7e['length']>0x0){_0x29f31a=_0x29f31a[_0x4aa6('0xa')](function(_0x426f15){return _0x27da7e[_0x4aa6('0x2e')](_0x426f15['id']);});}return _0x29f31a;})[_0x4aa6('0x19')](function(){return db[_0x4aa6('0x31')]['findAll']({'attributes':['id','name',_0x4aa6('0x32'),_0x4aa6('0x4'),_0x4aa6('0x5'),'mailPause','openchannelPause',_0x4aa6('0x8'),_0x4aa6('0x9'),_0x4aa6('0x33'),_0x4aa6('0x34')],'where':{'id':{'$in':_[_0x4aa6('0x2a')](_0x29f31a,'id')}},'raw':!![]});})[_0x4aa6('0x19')](function(_0xcbcf3a){return _0xcbcf3a[_0x4aa6('0x2a')](function(_0x546ea1){var _0x892482=_[_0x4aa6('0x35')](_0x29f31a,['id',_0x546ea1['id']]);var _0x2ae741=filterAgentAttributes(_0x892482);_[_0x4aa6('0x1e')](_0x546ea1,_0x2ae741);_0x546ea1[_0x4aa6('0x36')]=getAgentStatus(_0x546ea1);return _0x546ea1;});})[_0x4aa6('0x19')](function(_0x4ab55d){var _0x223616=sortAgentsByStatus(_0x4ab55d,_0x58d768);return _[_0x4aa6('0x2a')](_0x223616,'id');})['catch'](function(_0x20e396){throw _0x20e396;});}exports[_0x4aa6('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x381c2b){var _0x3b2a65={'fields':[],'order':null};var _0x49d445=_0x381c2b['split'](',');_0x3b2a65[_0x4aa6('0x38')]=_[_0x4aa6('0xa')](_0x49d445,function(_0x306bc1){if(!_0x306bc1['includes'](_0x4aa6('0x36'))){return!![];}_0x3b2a65[_0x4aa6('0x39')]=_['startsWith'](_0x306bc1,'-')?_0x4aa6('0x3a'):_0x4aa6('0x3b');return![];});return _0x3b2a65;}exports[_0x4aa6('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x365329){if(!_0x365329){_0x365329=_0x4aa6('0x3d');}if(_0x365329[_0x4aa6('0x2e')]('fullname')&&!_0x365329['includes'](_0x4aa6('0x3e'))){var _0x356d75=_0x365329[_0x4aa6('0x3f')](0x0,_0x365329[_0x4aa6('0x40')](_0x4aa6('0x32')));_0x365329+=','+_0x356d75+'internal';}return _0x365329;}exports[_0x4aa6('0x41')]=validateSortParameter;function sortAgentsByStatus(_0xed3b87,_0x5d349f){var _0x13fcc8=_0xed3b87[_0x4aa6('0x42')](function(_0x269146,_0x47787d){if(_0x269146[_0x4aa6('0x36')]===_0x47787d['globalStatus']){if(_0x269146[_0x4aa6('0x36')]===_0x4aa6('0x11')){if(_0x5d349f==='DESC'){return(_0x269146[_0x4aa6('0x34')]||'')<(_0x47787d[_0x4aa6('0x34')]||'')||_0x269146['fullname'][_0x4aa6('0x43')]()>_0x47787d[_0x4aa6('0x32')]['toLowerCase']()?0x1:-0x1;}else{return(_0x269146[_0x4aa6('0x34')]||'')<(_0x47787d[_0x4aa6('0x34')]||'')||_0x269146[_0x4aa6('0x32')][_0x4aa6('0x43')]()>_0x47787d[_0x4aa6('0x32')][_0x4aa6('0x43')]()?-0x1:0x1;}}else{if(_0x5d349f===_0x4aa6('0x3a')){return _0x269146['fullname'][_0x4aa6('0x43')]()<_0x47787d[_0x4aa6('0x32')][_0x4aa6('0x43')]()?0x1:-0x1;}else{return _0x269146[_0x4aa6('0x32')][_0x4aa6('0x43')]()<_0x47787d[_0x4aa6('0x32')][_0x4aa6('0x43')]()?-0x1:0x1;}}}else{if(_0x5d349f===_0x4aa6('0x3a')){return _0x269146['globalStatus']<_0x47787d[_0x4aa6('0x36')]?0x1:-0x1;}else{return _0x269146['globalStatus']<_0x47787d[_0x4aa6('0x36')]?-0x1:0x1;}}});return _0x13fcc8;}exports[_0x4aa6('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x1a988f){var _0x523fa5=[_0x4aa6('0x45'),'online','lastLoginAt',_0x4aa6('0x46'),_0x4aa6('0x34'),'lastPauseAt',_0x4aa6('0x3e'),_0x4aa6('0x47'),'chatPause',_0x4aa6('0x7'),'mailPause','smsPause',_0x4aa6('0x33'),'faxPause',_0x4aa6('0x9'),_0x4aa6('0x48'),_0x4aa6('0x49'),_0x4aa6('0x4a'),_0x4aa6('0x4b'),_0x4aa6('0x4c'),_0x4aa6('0x4d'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x4aa6('0x4e'),_0x4aa6('0x4f'),_0x4aa6('0x50'),'faxCurrentCapacity',_0x4aa6('0x13'),_0x4aa6('0x15'),_0x4aa6('0x51'),_0x4aa6('0x52'),'whatsappStatus','faxStatus',_0x4aa6('0x10'),_0x4aa6('0x53'),_0x4aa6('0x54'),_0x4aa6('0x55'),'smsStatusTime',_0x4aa6('0x56'),_0x4aa6('0x57'),'voiceStatusTime',_0x4aa6('0x58'),'destconnectedlinenum',_0x4aa6('0x59'),_0x4aa6('0x5a'),_0x4aa6('0x5b')];var _0x1a0860=['chatPause',_0x4aa6('0x7'),_0x4aa6('0x6'),_0x4aa6('0x8'),'whatsappPause','faxPause',_0x4aa6('0x9'),_0x4aa6('0x5c')];var _0x38c442=_(_0x1a988f)[_0x4aa6('0x5d')](_0x1a0860)['pick'](_0x523fa5)[_0x4aa6('0x2c')]();return _0x38c442;}exports[_0x4aa6('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x4aa6('0x5f'),_0x4aa6('0x32'),_0x4aa6('0x60'),_0x4aa6('0x3e'),_0x4aa6('0x5c'),'globalStatus',_0x4aa6('0x45'),'lastLoginAt','pauseType','lastPauseAt',_0x4aa6('0x5'),_0x4aa6('0x4'),_0x4aa6('0x6'),'openchannelPause',_0x4aa6('0x8'),_0x4aa6('0x9'),_0x4aa6('0x33'),'chatStatus',_0x4aa6('0x14'),_0x4aa6('0x51'),_0x4aa6('0x15'),_0x4aa6('0x52'),_0x4aa6('0x10'),_0x4aa6('0x16'),_0x4aa6('0x53'),_0x4aa6('0x57'),_0x4aa6('0x55'),_0x4aa6('0x54'),'smsStatusTime',_0x4aa6('0x61'),_0x4aa6('0x56'),'chatCapacity',_0x4aa6('0x4d'),'mailCapacity',_0x4aa6('0x49'),_0x4aa6('0x4b'),_0x4aa6('0x4c'),_0x4aa6('0x62'),_0x4aa6('0x63'),'mailCurrentCapacity',_0x4aa6('0x64'),_0x4aa6('0x4f'),_0x4aa6('0x50'),_0x4aa6('0x5a'),_0x4aa6('0x5b'),'destconnectedlinenum',_0x4aa6('0x65'),_0x4aa6('0x58'),_0x4aa6('0x59')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 83450a3..7e39102 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 _0x91b4=['erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','then','error','format','result','catch','getRealtimeQueues','voice','inbound','concat','map','get','paused','loggedInDb','outbound','pTalking','originated','find','merge','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','waiting','busy','inUse','invalid','notInUse','onHold','unavailable','unknown','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x91b4,0xbb));var _0x491b=function(_0x235cbb,_0x3639fa){_0x235cbb=_0x235cbb-0x0;var _0x59886d=_0x91b4[_0x235cbb];return _0x59886d;};'use strict';var _=require(_0x491b('0x0'));var jayson=require(_0x491b('0x1'));var util=require(_0x491b('0x2'));var amiClient=jayson[_0x491b('0x3')][_0x491b('0x4')]({'port':0x232a});var routingClient=jayson['client'][_0x491b('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x491b('0x5'),_0x491b('0x6'),'paused',_0x491b('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x491b('0x8'),_0x491b('0x9'),_0x491b('0xa'),'loggedInDb',_0x491b('0xb'),_0x491b('0xc'),'ringing','ringInUse','talking',_0x491b('0xd'),_0x491b('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0x491b('0xf'),_0x491b('0x10'),_0x491b('0x11'),_0x491b('0x12'),'Trunk',_0x491b('0x13'),_0x491b('0x14'),_0x491b('0x15'),_0x491b('0x16'),_0x491b('0x17'),_0x491b('0x18'),_0x491b('0x19'),_0x491b('0x1a'),_0x491b('0x1b'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x491b('0x1c'),_0x491b('0x1d')];function getRealtimeQueues(_0x62c98,_0x216d91){var _0x1b3c50=_0x216d91==='voice'?amiClient:routingClient;return _0x1b3c50[_0x491b('0x1e')](_[_0x491b('0x1f')](_0x216d91)+_0x491b('0x20'),_0x62c98)[_0x491b('0x21')](function(_0x3f1f43){if(_0x3f1f43[_0x491b('0x22')])throw new Error(util[_0x491b('0x23')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x216d91));return _0x3f1f43[_0x491b('0x24')];})[_0x491b('0x25')](function(_0x157fc8){throw _0x157fc8;});}exports[_0x491b('0x26')]=getRealtimeQueues;function initializeQueues(_0x2bb2e2,_0x4c553d,_0x24e828,_0x1384eb){var _0x53e5a1=DEFAULT_QUEUE_ATTRIBUTES;if(_0x24e828===_0x491b('0x27')){if(_0x1384eb===_0x491b('0x28')){_0x53e5a1=_0x53e5a1[_0x491b('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1384eb==='outbound'){_0x53e5a1=_0x53e5a1[_0x491b('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2bb2e2[_0x491b('0x2a')](function(_0x7fcbee){var _0x22df5a=_0x7fcbee[_0x491b('0x2b')]({'plain':!![]});_0x22df5a[_0x491b('0x2c')]=0x0;_0x22df5a[_0x491b('0x2d')]=0x0;_0x22df5a['loggedIn']=0x0;_0x22df5a['available']=0x0;_0x22df5a[_0x491b('0x7')]=0x0;if(_0x24e828===_0x491b('0x27')){_0x22df5a['talking']=0x0;_0x22df5a[_0x491b('0x8')]=0x0;if(_0x1384eb===_0x491b('0x2e')){_0x22df5a[_0x491b('0x2f')]=0x0;_0x22df5a[_0x491b('0x30')]=0x0;}}var _0xc46317=_[_0x491b('0x31')](_0x4c553d,['id',_0x22df5a['id']]);if(_0xc46317){_[_0x491b('0x32')](_0x22df5a,_['pick'](_0xc46317,_0x53e5a1));}return _0x22df5a;});}exports[_0x491b('0x33')]=initializeQueues; \ No newline at end of file +var _0x8363=['notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','dialActive','dialMethod','startProgressive','erlangCalls','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedIn','waiting','originated','find','merge','pick','initializeQueues','lodash','jayson/promise','client','http','available','paused','invalid','loggedInDb'];(function(_0x460ed1,_0x9819f5){var _0x36c9b1=function(_0x19a58a){while(--_0x19a58a){_0x460ed1['push'](_0x460ed1['shift']());}};_0x36c9b1(++_0x9819f5);}(_0x8363,0x180));var _0x3836=function(_0x1cdfff,_0x480413){_0x1cdfff=_0x1cdfff-0x0;var _0x1de48f=_0x8363[_0x1cdfff];return _0x1de48f;};'use strict';var _=require(_0x3836('0x0'));var jayson=require(_0x3836('0x1'));var util=require('util');var amiClient=jayson[_0x3836('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x3836('0x2')][_0x3836('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x3836('0x4'),'loggedIn',_0x3836('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x3836('0x6'),_0x3836('0x7'),_0x3836('0x8'),_0x3836('0x9'),_0x3836('0xa'),_0x3836('0xb'),_0x3836('0xc'),_0x3836('0xd'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x3836('0xe'),'originated','message','statusMessage',_0x3836('0xf'),_0x3836('0x10'),'Trunk','startPredictive',_0x3836('0x11'),_0x3836('0x12'),'erlangCallToSecond','erlangAbandonmentRate',_0x3836('0x13'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x3836('0x14'),_0x3836('0x15'),_0x3836('0x16'),_0x3836('0x17'),_0x3836('0x18'),_0x3836('0x19'),'predictiveIntervalAvgHoldtime',_0x3836('0x1a')];function getRealtimeQueues(_0x10a67f,_0x21a651){var _0x219078=_0x21a651===_0x3836('0x1b')?amiClient:routingClient;return _0x219078[_0x3836('0x1c')](_[_0x3836('0x1d')](_0x21a651)+_0x3836('0x1e'),_0x10a67f)[_0x3836('0x1f')](function(_0x3fdcb9){if(_0x3fdcb9['error'])throw new Error(util[_0x3836('0x20')](_0x3836('0x21'),_0x21a651));return _0x3fdcb9[_0x3836('0x22')];})[_0x3836('0x23')](function(_0x113199){throw _0x113199;});}exports[_0x3836('0x24')]=getRealtimeQueues;function initializeQueues(_0x571c89,_0x73eee7,_0x478fa2,_0x254d97){var _0x19c7a1=DEFAULT_QUEUE_ATTRIBUTES;if(_0x478fa2===_0x3836('0x1b')){if(_0x254d97===_0x3836('0x25')){_0x19c7a1=_0x19c7a1[_0x3836('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x254d97===_0x3836('0x27')){_0x19c7a1=_0x19c7a1[_0x3836('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x571c89[_0x3836('0x28')](function(_0x12b220){var _0x1c9505=_0x12b220[_0x3836('0x29')]({'plain':!![]});_0x1c9505[_0x3836('0x5')]=0x0;_0x1c9505[_0x3836('0x7')]=0x0;_0x1c9505[_0x3836('0x2a')]=0x0;_0x1c9505['available']=0x0;_0x1c9505[_0x3836('0x2b')]=0x0;if(_0x478fa2===_0x3836('0x1b')){_0x1c9505[_0x3836('0xc')]=0x0;_0x1c9505['busy']=0x0;if(_0x254d97==='outbound'){_0x1c9505[_0x3836('0xe')]=0x0;_0x1c9505[_0x3836('0x2c')]=0x0;}}var _0x28c10a=_[_0x3836('0x2d')](_0x73eee7,['id',_0x1c9505['id']]);if(_0x28c10a){_[_0x3836('0x2e')](_0x1c9505,_[_0x3836('0x2f')](_0x28c10a,_0x19c7a1));}return _0x1c9505;});}exports[_0x3836('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index d692986..40284db 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(_0x24fe45,_0x2d4a63){var _0xd02f17=function(_0x261008){while(--_0x261008){_0x24fe45['push'](_0x24fe45['shift']());}};_0xd02f17(++_0x2d4a63);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index bf8e088..a0f57ff 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 _0xda76=['getFirstInterface','cpus','map','join','createHash','md5','update','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','family','IPv4','internal','mac','address','127.0.0.1'];(function(_0x5da063,_0x4d3ac9){var _0x1b0c58=function(_0x871c09){while(--_0x871c09){_0x5da063['push'](_0x5da063['shift']());}};_0x1b0c58(++_0x4d3ac9);}(_0xda76,0xea));var _0x6da7=function(_0x4be5a5,_0x2889fa){_0x4be5a5=_0x4be5a5-0x0;var _0x3b8a21=_0xda76[_0x4be5a5];return _0x3b8a21;};'use strict';var _=require(_0x6da7('0x0'));var os=require('os');var crypto=require(_0x6da7('0x1'));var machine=require(_0x6da7('0x2'));var exec=require(_0x6da7('0x3'))[_0x6da7('0x4')];var config=require('../environment');function getInterfaces(){var _0x54fe76=[];var _0x59da20=os['networkInterfaces']();var _0x17b560=_[_0x6da7('0x5')](_[_0x6da7('0x6')](_0x59da20));for(var _0x309223=0x0;_0x309223<_0x17b560[_0x6da7('0x7')];_0x309223++){var _0x1e4c00=_0x59da20[_0x17b560[_0x309223]]['filter'](function(_0xc49d2b){return _0xc49d2b[_0x6da7('0x8')]===_0x6da7('0x9')&&_0xc49d2b[_0x6da7('0xa')]===![];});_0x54fe76=_0x54fe76['concat'](_0x1e4c00);}return _0x54fe76;}function getFirstInterface(){var _0x3603e=_['head'](getInterfaces());return{'macAddress':_0x3603e&&_0x3603e[_0x6da7('0xb')]?_0x3603e['mac']:'00:00:00:00:00:00','ipAddress':_0x3603e&&_0x3603e[_0x6da7('0xc')]?_0x3603e[_0x6da7('0xc')]:_0x6da7('0xd')};}exports[_0x6da7('0xe')]=getFirstInterface;function getCPUhash(){var _0x570d51=_[_0x6da7('0x5')](os[_0x6da7('0xf')]()[_0x6da7('0x10')](function(_0x2fac7e){return _0x2fac7e['model'];}))[_0x6da7('0x11')](':');return crypto[_0x6da7('0x12')](_0x6da7('0x13'))[_0x6da7('0x14')](_0x570d51)['digest'](_0x6da7('0x15'));}exports['getUuid']=function(){var _0xf9b6c2=os[_0x6da7('0x16')]();var _0xb25b11=/[0-9a-f-]{36}/;if(config[_0x6da7('0x17')]&&_0xb25b11[_0x6da7('0x18')](config[_0x6da7('0x17')])){return config[_0x6da7('0x17')];}else if(_0xf9b6c2===_0x6da7('0x19')){return exec(_0x6da7('0x1a'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x44da94=getFirstInterface();var _0x16d8a8=getCPUhash();var _0x5b03c3=_0x16d8a8+'|'+os[_0x6da7('0x1b')]()+'|'+_0x44da94[_0x6da7('0x1c')]+'|'+_0x44da94[_0x6da7('0x1d')];var _0x162bbc=crypto[_0x6da7('0x12')](_0x6da7('0x13'))[_0x6da7('0x14')](_0x5b03c3)['digest']('hex');return _0x162bbc[_0x6da7('0x1e')](0x0,0x8)+'-'+_0x162bbc[_0x6da7('0x1e')](0x8,0xc)+'-'+_0x162bbc[_0x6da7('0x1e')](0xc,0x10)+'-'+_0x162bbc[_0x6da7('0x1e')](0x10,0x14)+'-'+_0x162bbc['substring'](0x14);}}; \ No newline at end of file +var _0xd762=['filter','family','IPv4','head','mac','00:00:00:00:00:00','address','getFirstInterface','model','join','createHash','md5','update','digest','hex','getUuid','test','licenseToken','win32','utf8','replace','hostname','macAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length'];(function(_0x5ce268,_0x1835b6){var _0x28c96a=function(_0x18c1d6){while(--_0x18c1d6){_0x5ce268['push'](_0x5ce268['shift']());}};_0x28c96a(++_0x1835b6);}(_0xd762,0x158));var _0x2d76=function(_0x38c6f4,_0x1463ed){_0x38c6f4=_0x38c6f4-0x0;var _0x4919e9=_0xd762[_0x38c6f4];return _0x4919e9;};'use strict';var _=require(_0x2d76('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x2d76('0x1'));var exec=require(_0x2d76('0x2'))[_0x2d76('0x3')];var config=require(_0x2d76('0x4'));function getInterfaces(){var _0x10f8ba=[];var _0x584da2=os[_0x2d76('0x5')]();var _0x5b530c=_[_0x2d76('0x6')](_['keys'](_0x584da2));for(var _0x1ebb6b=0x0;_0x1ebb6b<_0x5b530c[_0x2d76('0x7')];_0x1ebb6b++){var _0x2414ce=_0x584da2[_0x5b530c[_0x1ebb6b]][_0x2d76('0x8')](function(_0xa89f05){return _0xa89f05[_0x2d76('0x9')]===_0x2d76('0xa')&&_0xa89f05['internal']===![];});_0x10f8ba=_0x10f8ba['concat'](_0x2414ce);}return _0x10f8ba;}function getFirstInterface(){var _0x5b0adb=_[_0x2d76('0xb')](getInterfaces());return{'macAddress':_0x5b0adb&&_0x5b0adb[_0x2d76('0xc')]?_0x5b0adb[_0x2d76('0xc')]:_0x2d76('0xd'),'ipAddress':_0x5b0adb&&_0x5b0adb[_0x2d76('0xe')]?_0x5b0adb[_0x2d76('0xe')]:'127.0.0.1'};}exports[_0x2d76('0xf')]=getFirstInterface;function getCPUhash(){var _0x13bc41=_[_0x2d76('0x6')](os['cpus']()['map'](function(_0x212d2e){return _0x212d2e[_0x2d76('0x10')];}))[_0x2d76('0x11')](':');return crypto[_0x2d76('0x12')](_0x2d76('0x13'))[_0x2d76('0x14')](_0x13bc41)[_0x2d76('0x15')](_0x2d76('0x16'));}exports[_0x2d76('0x17')]=function(){var _0x2a5afe=os['platform']();var _0x255e39=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x255e39[_0x2d76('0x18')](config[_0x2d76('0x19')])){return config[_0x2d76('0x19')];}else if(_0x2a5afe===_0x2d76('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x2d76('0x1b')})[_0x2d76('0x1c')]('\x0d\x0a','');}else{var _0x1c4fba=getFirstInterface();var _0x24a3ef=getCPUhash();var _0x45cd3f=_0x24a3ef+'|'+os[_0x2d76('0x1d')]()+'|'+_0x1c4fba[_0x2d76('0x1e')]+'|'+_0x1c4fba['ipAddress'];var _0x1e57a5=crypto[_0x2d76('0x12')](_0x2d76('0x13'))[_0x2d76('0x14')](_0x45cd3f)[_0x2d76('0x15')](_0x2d76('0x16'));return _0x1e57a5['substring'](0x0,0x8)+'-'+_0x1e57a5['substring'](0x8,0xc)+'-'+_0x1e57a5['substring'](0xc,0x10)+'-'+_0x1e57a5[_0x2d76('0x1f')](0x10,0x14)+'-'+_0x1e57a5[_0x2d76('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0e95341..59685ec 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 _0x0ab7=['license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','util','request-promise','bluebird','pkginfo','version','../../components/encryptor','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then'];(function(_0x3937c4,_0x208957){var _0x3fb9f1=function(_0x4f0958){while(--_0x4f0958){_0x3937c4['push'](_0x3937c4['shift']());}};_0x3fb9f1(++_0x208957);}(_0x0ab7,0x1aa));var _0x70ab=function(_0x2fdb06,_0x10145b){_0x2fdb06=_0x2fdb06-0x0;var _0x47a340=_0x0ab7[_0x2fdb06];return _0x47a340;};'use strict';var util=require(_0x70ab('0x0'));var moment=require('moment');var rp=require(_0x70ab('0x1'));var BPromise=require(_0x70ab('0x2'));var pkginfo=require(_0x70ab('0x3'))(module,_0x70ab('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x70ab('0x5'));var hardware=require('./hardware');var logger=require(_0x70ab('0x6'))('license');var HOST=_0x70ab('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5a92d3){return new BPromise(function(_0x2b678d,_0x3ea6c0){var _0x53a8d4=util[_0x70ab('0x8')](_0x70ab('0x9'),HOST,_0x5a92d3,module[_0x70ab('0xa')][_0x70ab('0x4')]);if(oldToken){_0x53a8d4=util[_0x70ab('0x8')](_0x70ab('0xb'),HOST,_0x5a92d3,module[_0x70ab('0xa')][_0x70ab('0x4')],oldToken);}var _0x3e7cea={'uri':_0x53a8d4,'method':_0x70ab('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3e7cea)['then'](function(_0x4b9480){_0x2b678d(_0x4b9480);})[_0x70ab('0xd')](function(_0x63f13e){_0x3ea6c0(_0x63f13e);});});}function manageLicense(_0x4cb981,_0x4b5942){var _0x1e490d=_0x4b5942[_0x70ab('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x1e490d[_0x70ab('0xf')]!==_0x4cb981&&!_0x1e490d[_0x70ab('0x10')]){oldToken=_0x1e490d[_0x70ab('0xf')];}httpRequest(_0x4cb981)[_0x70ab('0x11')](function(_0x1dcaa7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1dcaa7['active']){isOldTokenSent=![];if(!_0x1e490d[_0x70ab('0x12')]&&_0x1e490d[_0x70ab('0x12')]!=_0x1dcaa7[_0x70ab('0x12')]||_0x1e490d[_0x70ab('0x12')]&&_0x1e490d[_0x70ab('0x10')]){logger[_0x70ab('0x13')](_0x70ab('0x14'));}if(_0x1e490d['license']&&!_0x1e490d['data2']&&_0x1e490d[_0x70ab('0x12')]!=_0x1dcaa7[_0x70ab('0x12')]){logger['info'](_0x70ab('0x15'));}if(_0x1e490d[_0x70ab('0x12')]&&!_0x1e490d[_0x70ab('0x10')]&&_0x1e490d[_0x70ab('0x12')]==_0x1dcaa7['license']){return _0x4b5942;}return _0x4b5942[_0x70ab('0x16')]({'data1':_0x4cb981,'data2':null,'license':_0x1dcaa7[_0x70ab('0x12')]});}else{if(_0x1dcaa7[_0x70ab('0x12')]||_0x1e490d[_0x70ab('0x12')]){if(!_0x1e490d[_0x70ab('0x10')]){if(_0x1e490d[_0x70ab('0xf')]==_0x4cb981){GRAY_PERIOD_REASON=_0x70ab('0x17');logger[_0x70ab('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x70ab('0x18');logger[_0x70ab('0x13')](_0x70ab('0x19'),_0x1e490d[_0x70ab('0xf')],_0x4cb981);}logger['info'](_0x70ab('0x1a'),GRAY_PERIOD_REASON[_0x70ab('0x1b')](),moment()[_0x70ab('0x8')](_0x70ab('0x1c')));return _0x4b5942['update']({'data2':encryptor['encryptString'](moment()[_0x70ab('0x8')](_0x70ab('0x1c')))});}else{if(moment()['diff'](encryptor[_0x70ab('0x1d')](_0x1e490d[_0x70ab('0x10')]),'days')>DAYS){logger[_0x70ab('0x13')](_0x70ab('0x1e'),moment()[_0x70ab('0x8')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x4b5942[_0x70ab('0x16')]({'data1':_0x4cb981,'data2':null,'license':null});}}}else{if(_0x1e490d['data1']!=_0x4cb981){logger[_0x70ab('0x13')](_0x70ab('0x19'),_0x1e490d[_0x70ab('0xf')],_0x4cb981);return _0x4b5942[_0x70ab('0x16')]({'data1':_0x4cb981,'data2':null,'license':null});}}}return _0x4b5942;})[_0x70ab('0x11')](function(_0x4b7353){_0x4b5942=_0x4b7353;})[_0x70ab('0xd')](function(_0x552f7d){logger[_0x70ab('0x1f')](_0x552f7d[_0x70ab('0x20')]);})[_0x70ab('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x70ab('0x22')](),_0x4b5942);},TIME);});}function defaultLicense(){var _0x504783=hardware[_0x70ab('0x22')]();if(_0x504783){return db[_0x70ab('0x23')][_0x70ab('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x504783}})['spread'](function(_0x2628be,_0x46b0ed){logger[_0x70ab('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x504783);manageLicense(_0x504783,_0x2628be);})[_0x70ab('0xd')](function(_0x39e5c6){logger[_0x70ab('0x1f')](_0x39e5c6[_0x70ab('0x20')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x12fc=['request-promise','pkginfo','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment'];(function(_0x32b56b,_0x2ff149){var _0x856a25=function(_0x23991e){while(--_0x23991e){_0x32b56b['push'](_0x32b56b['shift']());}};_0x856a25(++_0x2ff149);}(_0x12fc,0x1b7));var _0xc12f=function(_0x31d052,_0x6ff1a3){_0x31d052=_0x31d052-0x0;var _0x21e3f7=_0x12fc[_0x31d052];return _0x21e3f7;};'use strict';var util=require('util');var moment=require(_0xc12f('0x0'));var rp=require(_0xc12f('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xc12f('0x2'))(module,'version');var db=require(_0xc12f('0x3'))['db'];var encryptor=require(_0xc12f('0x4'));var hardware=require('./hardware');var logger=require(_0xc12f('0x5'))(_0xc12f('0x6'));var HOST=_0xc12f('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2de66b){return new BPromise(function(_0x91ea5a,_0x302365){var _0x21fa24=util[_0xc12f('0x8')](_0xc12f('0x9'),HOST,_0x2de66b,module['exports']['version']);if(oldToken){_0x21fa24=util[_0xc12f('0x8')](_0xc12f('0xa'),HOST,_0x2de66b,module['exports'][_0xc12f('0xb')],oldToken);}var _0x27ebdb={'uri':_0x21fa24,'method':_0xc12f('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x27ebdb)[_0xc12f('0xd')](function(_0x3d420a){_0x91ea5a(_0x3d420a);})[_0xc12f('0xe')](function(_0x10feaa){_0x302365(_0x10feaa);});});}function manageLicense(_0x177848,_0x6663e4){var _0x1c9fba=_0x6663e4['get']({'plain':!![]});if(!isOldTokenSent&&_0x1c9fba[_0xc12f('0xf')]!==_0x177848&&!_0x1c9fba[_0xc12f('0x10')]){oldToken=_0x1c9fba[_0xc12f('0xf')];}httpRequest(_0x177848)[_0xc12f('0xd')](function(_0x42f05b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x42f05b[_0xc12f('0x11')]){isOldTokenSent=![];if(!_0x1c9fba['license']&&_0x1c9fba[_0xc12f('0x6')]!=_0x42f05b[_0xc12f('0x6')]||_0x1c9fba['license']&&_0x1c9fba[_0xc12f('0x10')]){logger[_0xc12f('0x12')](_0xc12f('0x13'));}if(_0x1c9fba[_0xc12f('0x6')]&&!_0x1c9fba[_0xc12f('0x10')]&&_0x1c9fba[_0xc12f('0x6')]!=_0x42f05b['license']){logger['info'](_0xc12f('0x14'));}if(_0x1c9fba[_0xc12f('0x6')]&&!_0x1c9fba[_0xc12f('0x10')]&&_0x1c9fba[_0xc12f('0x6')]==_0x42f05b[_0xc12f('0x6')]){return _0x6663e4;}return _0x6663e4[_0xc12f('0x15')]({'data1':_0x177848,'data2':null,'license':_0x42f05b[_0xc12f('0x6')]});}else{if(_0x42f05b[_0xc12f('0x6')]||_0x1c9fba[_0xc12f('0x6')]){if(!_0x1c9fba['data2']){if(_0x1c9fba[_0xc12f('0xf')]==_0x177848){GRAY_PERIOD_REASON=_0xc12f('0x16');logger[_0xc12f('0x12')](_0xc12f('0x17'));}else{GRAY_PERIOD_REASON=_0xc12f('0x18');logger[_0xc12f('0x12')](_0xc12f('0x19'),_0x1c9fba[_0xc12f('0xf')],_0x177848);}logger[_0xc12f('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xc12f('0x1a')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x6663e4[_0xc12f('0x15')]({'data2':encryptor[_0xc12f('0x1b')](moment()[_0xc12f('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xc12f('0x1c')](encryptor[_0xc12f('0x1d')](_0x1c9fba[_0xc12f('0x10')]),'days')>DAYS){logger['info'](_0xc12f('0x1e'),moment()[_0xc12f('0x8')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x6663e4[_0xc12f('0x15')]({'data1':_0x177848,'data2':null,'license':null});}}}else{if(_0x1c9fba[_0xc12f('0xf')]!=_0x177848){logger[_0xc12f('0x12')](_0xc12f('0x19'),_0x1c9fba[_0xc12f('0xf')],_0x177848);return _0x6663e4[_0xc12f('0x15')]({'data1':_0x177848,'data2':null,'license':null});}}}return _0x6663e4;})['then'](function(_0x3e5228){_0x6663e4=_0x3e5228;})[_0xc12f('0xe')](function(_0x3b7100){logger[_0xc12f('0x1f')](_0x3b7100[_0xc12f('0x20')]);})[_0xc12f('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xc12f('0x22')](),_0x6663e4);},TIME);});}function defaultLicense(){var _0xd5c5f0=hardware[_0xc12f('0x22')]();if(_0xd5c5f0){return db[_0xc12f('0x23')][_0xc12f('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xd5c5f0}})[_0xc12f('0x25')](function(_0x2f869b,_0x31ccfa){logger['info'](_0xc12f('0x26'),_0xd5c5f0);manageLicense(_0xd5c5f0,_0x2f869b);})[_0xc12f('0xe')](function(_0x3020c3){logger['error'](_0x3020c3[_0xc12f('0x20')]);});}}exports[_0xc12f('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2ce8408..58a046d 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 _0xa31e=['Demo\x20license','getUuid','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','user','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa31e,0x187));var _0xea31=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0xa31e[_0x2de020];return _0x182b7c;};'use strict';var util=require('util');var _=require(_0xea31('0x0'));var moment=require(_0xea31('0x1'));var BPromise=require(_0xea31('0x2'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0xea31('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xea31('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xea31('0x5'),'machineUuid':hardware[_0xea31('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xea31('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xea31('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4081f4){return new BPromise(function(_0x4dbe4f,_0x575851){return db['License'][_0xea31('0x7')](_[_0xea31('0x8')](_0x4081f4,{'raw':!![],'where':{'id':0x1}}))[_0xea31('0x9')](function(_0x9a4f5){return checkLicense(_0x9a4f5,null);})['then'](function(_0x2e3e5c){_0x4dbe4f(_0x2e3e5c);return;})[_0xea31('0xa')](function(_0x22b1ec){_0x575851(_0x22b1ec);});});}function checkLicense(_0x403a0a,_0x3558cf){if(!_0x403a0a){demoLicense[_0xea31('0xb')]=_0x403a0a[_0xea31('0xc')];return demoLicense;}try{var _0x3f176d=_0x3558cf||_0x403a0a['license'];if(_[_0xea31('0xd')](_0x3f176d)){throw new Error(_0xea31('0xe'));}var _0x573efa=_0x403a0a[_0xea31('0xc')];var _0xed6adb=_0x403a0a[_0xea31('0xf')];var _0xbb2718=_0x573efa[_0xea31('0x10')]('-')[0x4];var _0x11c683=_0x573efa[_0xea31('0x10')]('-')[0x0];var _0x343814=encryptor[_0xea31('0x11')](_0x3f176d,util[_0xea31('0x12')](_0xea31('0x13'),_0xbb2718,_0x573efa,_0x11c683));var _0x2391f9=JSON[_0xea31('0x14')](_0x343814);_0x2391f9[_0xea31('0x15')]=![];_0x2391f9[_0xea31('0xb')]=_0x573efa;_0x2391f9[_0xea31('0x16')]=hardware[_0xea31('0x6')]();if(_0xed6adb){var _0x5c23be=encryptor[_0xea31('0x11')](_0xed6adb);_0x2391f9[_0xea31('0x17')]=_0x5c23be;_0x2391f9[_0xea31('0x18')]=moment(_0x5c23be)[_0xea31('0x19')](0x7,'days')[_0xea31('0x12')]();_0x2391f9['grayReason']=_0x2391f9['uuid']!=_0x2391f9['machineUuid']?'changed':'disabled';}return _0x2391f9;}catch(_0x4f52a7){breakingLicense['uuid']=_0x403a0a[_0xea31('0xc')];breakingLicense['message']=_0x4f52a7[_0xea31('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x235483,_0x5d3fd0){getLicense()[_0xea31('0x9')](function(_0x2d2525){return db[_0xea31('0x1b')][_0xea31('0x1c')]({'attributes':[_0xea31('0x1d'),[db[_0xea31('0x1e')]['fn'](_0xea31('0x1f'),db['sequelize'][_0xea31('0x20')]('role')),_0xea31('0x21')]],'group':_0xea31('0x1d'),'where':{'role':{'$or':[_0xea31('0x22'),'user',_0xea31('0x23')]}},'raw':!![]})[_0xea31('0x9')](function(_0x4fd635){var _0xf440ec={'user':_0x2d2525[_0xea31('0x24')]||0x0,'telephone':_0x2d2525[_0xea31('0x25')]||0x0};_0x4fd635[_0xea31('0x26')](function(_0x418934){var _0x19f7a7=_0x418934[_0xea31('0x1d')]===_0xea31('0x22')?_0xea31('0x27'):_0x418934[_0xea31('0x1d')];_0xf440ec[_0x19f7a7]-=_0x418934[_0xea31('0x21')];if(_0xf440ec[_0x19f7a7]<0x0)_0xf440ec[_0x19f7a7]=0x0;});_0x235483(_0xf440ec);return;});})[_0xea31('0xa')](function(_0x3f9529){_0x5d3fd0(_0x3f9529);});});}function checkUserLimits(_0x3426c4){return new BPromise(function(_0x426fe2,_0x5c3bb6){getLimits()[_0xea31('0x9')](function(_0x4313c7){var _0x16bd77=_[_0xea31('0x28')](_['countBy'](_0x3426c4,'role'),[_0xea31('0x22'),_0xea31('0x27'),_0xea31('0x23')]);var _0x3ddff0=(_0x16bd77[_0xea31('0x22')]||0x0)+(_0x16bd77['user']||0x0);var _0x18f964=_0x16bd77[_0xea31('0x23')]||0x0;if(_0x3ddff0>_0x4313c7['user'])return _0x5c3bb6(_0xea31('0x29'));if(_0x18f964>_0x4313c7[_0xea31('0x23')])return _0x5c3bb6(_0xea31('0x2a'));return _0x426fe2();})[_0xea31('0xa')](function(_0x3e6825){_0x5c3bb6(_0x3e6825);});});}module[_0xea31('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0659=['isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','demo','uuid','machineUuid','decryptString','gray','deadline','add','days','grayReason','changed','disabled','message','User','sequelize','COUNT','role','count','admin','telephone','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','catch','data1','license'];(function(_0x1a4e80,_0x2b65e7){var _0x1f3ee0=function(_0x94bb0f){while(--_0x94bb0f){_0x1a4e80['push'](_0x1a4e80['shift']());}};_0x1f3ee0(++_0x2b65e7);}(_0x0659,0x11e));var _0x9065=function(_0x456e47,_0x1bfc8f){_0x456e47=_0x456e47-0x0;var _0x45cdc7=_0x0659[_0x456e47];return _0x45cdc7;};'use strict';var util=require(_0x9065('0x0'));var _=require('lodash');var moment=require(_0x9065('0x1'));var BPromise=require(_0x9065('0x2'));var hardware=require(_0x9065('0x3'));var encryptor=require(_0x9065('0x4'));var db=require(_0x9065('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9065('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9065('0x7'),'machineUuid':hardware[_0x9065('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9065('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x9065('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x58db55){return new BPromise(function(_0x3a8a42,_0x4b0ffc){return db['License'][_0x9065('0x9')](_[_0x9065('0xa')](_0x58db55,{'raw':!![],'where':{'id':0x1}}))[_0x9065('0xb')](function(_0x4e0ceb){return checkLicense(_0x4e0ceb,null);})[_0x9065('0xb')](function(_0x307dfc){_0x3a8a42(_0x307dfc);return;})[_0x9065('0xc')](function(_0x37f143){_0x4b0ffc(_0x37f143);});});}function checkLicense(_0x596607,_0x19133e){if(!_0x596607){demoLicense['uuid']=_0x596607[_0x9065('0xd')];return demoLicense;}try{var _0x33214c=_0x19133e||_0x596607[_0x9065('0xe')];if(_[_0x9065('0xf')](_0x33214c)){throw new Error(_0x9065('0x10'));}var _0x3bbd9d=_0x596607[_0x9065('0xd')];var _0x7804f0=_0x596607[_0x9065('0x11')];var _0x4e1e9e=_0x3bbd9d[_0x9065('0x12')]('-')[0x4];var _0x288cc6=_0x3bbd9d[_0x9065('0x12')]('-')[0x0];var _0x1c9eef=encryptor['decryptString'](_0x33214c,util[_0x9065('0x13')]('%s:%s:%s',_0x4e1e9e,_0x3bbd9d,_0x288cc6));var _0x3b9389=JSON['parse'](_0x1c9eef);_0x3b9389[_0x9065('0x14')]=![];_0x3b9389[_0x9065('0x15')]=_0x3bbd9d;_0x3b9389[_0x9065('0x16')]=hardware['getUuid']();if(_0x7804f0){var _0x3ece19=encryptor[_0x9065('0x17')](_0x7804f0);_0x3b9389[_0x9065('0x18')]=_0x3ece19;_0x3b9389[_0x9065('0x19')]=moment(_0x3ece19)[_0x9065('0x1a')](0x7,_0x9065('0x1b'))[_0x9065('0x13')]();_0x3b9389[_0x9065('0x1c')]=_0x3b9389[_0x9065('0x15')]!=_0x3b9389[_0x9065('0x16')]?_0x9065('0x1d'):_0x9065('0x1e');}return _0x3b9389;}catch(_0x249e37){breakingLicense[_0x9065('0x15')]=_0x596607[_0x9065('0xd')];breakingLicense['message']=_0x249e37[_0x9065('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x244d4b,_0x13b3b7){getLicense()['then'](function(_0x27baa2){return db[_0x9065('0x20')]['findAll']({'attributes':['role',[db[_0x9065('0x21')]['fn'](_0x9065('0x22'),db[_0x9065('0x21')]['col'](_0x9065('0x23'))),_0x9065('0x24')]],'group':_0x9065('0x23'),'where':{'role':{'$or':[_0x9065('0x25'),'user',_0x9065('0x26')]}},'raw':!![]})[_0x9065('0xb')](function(_0x27ba72){var _0x8c75ed={'user':_0x27baa2['users']||0x0,'telephone':_0x27baa2['telephones']||0x0};_0x27ba72['forEach'](function(_0x59eed4){var _0x5195db=_0x59eed4[_0x9065('0x23')]==='admin'?_0x9065('0x27'):_0x59eed4[_0x9065('0x23')];_0x8c75ed[_0x5195db]-=_0x59eed4['count'];if(_0x8c75ed[_0x5195db]<0x0)_0x8c75ed[_0x5195db]=0x0;});_0x244d4b(_0x8c75ed);return;});})[_0x9065('0xc')](function(_0x4b9bf6){_0x13b3b7(_0x4b9bf6);});});}function checkUserLimits(_0x11f39c){return new BPromise(function(_0x18fddc,_0x13829f){getLimits()[_0x9065('0xb')](function(_0x17af3f){var _0x4f7954=_[_0x9065('0x28')](_[_0x9065('0x29')](_0x11f39c,'role'),[_0x9065('0x25'),_0x9065('0x27'),'telephone']);var _0x2eefa0=(_0x4f7954[_0x9065('0x25')]||0x0)+(_0x4f7954[_0x9065('0x27')]||0x0);var _0xcb5e0a=_0x4f7954[_0x9065('0x26')]||0x0;if(_0x2eefa0>_0x17af3f[_0x9065('0x27')])return _0x13829f(_0x9065('0x2a'));if(_0xcb5e0a>_0x17af3f[_0x9065('0x26')])return _0x13829f('License\x20limit\x20reached\x20for\x20telephones');return _0x18fddc();})['catch'](function(_0x5c144e){_0x13829f(_0x5c144e);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 4674209..a8a639f 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 _0x5204=['http://localhost:9000','app-id','secret','exports'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x5204,0xdf));var _0x4520=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x5204[_0x1c8c28];return _0x1f59b4;};'use strict';module[_0x4520('0x0')]={'DOMAIN':_0x4520('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4520('0x2'),'GOOGLE_SECRET':_0x4520('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x8f4c=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x2d85c6,_0x542a2b){var _0xa232f8=function(_0x5caf87){while(--_0x5caf87){_0x2d85c6['push'](_0x2d85c6['shift']());}};_0xa232f8(++_0x542a2b);}(_0x8f4c,0x113));var _0xc8f4=function(_0x206de1,_0x42247b){_0x206de1=_0x206de1-0x0;var _0x5bd6a8=_0x8f4c[_0x206de1];return _0x5bd6a8;};'use strict';module[_0xc8f4('0x0')]={'DOMAIN':_0xc8f4('0x1'),'SESSION_SECRET':_0xc8f4('0x2'),'GOOGLE_ID':_0xc8f4('0x3'),'GOOGLE_SECRET':_0xc8f4('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index c2c2146..0bc60c5 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26fa=['fileLogger','exports','../utils/loggers'];(function(_0x22bd20,_0x4802d5){var _0x590d41=function(_0x1934bc){while(--_0x1934bc){_0x22bd20['push'](_0x22bd20['shift']());}};_0x590d41(++_0x4802d5);}(_0x26fa,0x86));var _0xa26f=function(_0x5b1ae3,_0x2ceced){_0x5b1ae3=_0x5b1ae3-0x0;var _0x1af885=_0x26fa[_0x5b1ae3];return _0x1af885;};'use strict';var fileLogger=require(_0xa26f('0x0'))[_0xa26f('0x1')];module[_0xa26f('0x2')]=fileLogger; \ No newline at end of file +var _0x2997=['exports','../utils/loggers'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2997,0x17b));var _0x7299=function(_0x3c1099,_0x4cd808){_0x3c1099=_0x3c1099-0x0;var _0x1ae4bf=_0x2997[_0x3c1099];return _0x1ae4bf;};'use strict';var fileLogger=require(_0x7299('0x0'))['fileLogger'];module[_0x7299('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2f36a4d..279c07e 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 _0xfce5=['resolve','join','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment'];(function(_0x35f214,_0x3451c3){var _0x50b58e=function(_0x6be7e3){while(--_0x6be7e3){_0x35f214['push'](_0x35f214['shift']());}};_0x50b58e(++_0x3451c3);}(_0xfce5,0x11e));var _0x5fce=function(_0xd19f1f,_0x4e9015){_0xd19f1f=_0xd19f1f-0x0;var _0x409c77=_0xfce5[_0xd19f1f];return _0x409c77;};'use strict';var path=require(_0x5fce('0x0'));var cfg=require(_0x5fce('0x1'));var env={'NODE_PATH':path[_0x5fce('0x2')](path[_0x5fce('0x3')](cfg['root'],_0x5fce('0x4')))};var pm2config={'apps':[{'name':_0x5fce('0x5'),'script':path['join'](__dirname,_0x5fce('0x6')),'env':env},{'name':'ami','script':path[_0x5fce('0x3')](__dirname,_0x5fce('0x7')),'env':env},{'name':_0x5fce('0x8'),'script':path[_0x5fce('0x3')](__dirname,_0x5fce('0x9')),'env':env},{'name':'email','script':path['join'](__dirname,_0x5fce('0xa')),'env':env},{'name':_0x5fce('0xb'),'script':path[_0x5fce('0x3')](__dirname,_0x5fce('0xc')),'env':env},{'name':_0x5fce('0xd'),'script':path[_0x5fce('0x3')](__dirname,_0x5fce('0xe')),'env':env}]};module[_0x5fce('0xf')]=pm2config; \ No newline at end of file +var _0x1310=['path','../../config/environment','resolve','join','root','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1310,0x1ed));var _0x0131=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1310[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x0131('0x0'));var cfg=require(_0x0131('0x1'));var env={'NODE_PATH':path[_0x0131('0x2')](path[_0x0131('0x3')](cfg[_0x0131('0x4')],_0x0131('0x5')))};var pm2config={'apps':[{'name':'express','script':path[_0x0131('0x3')](__dirname,_0x0131('0x6')),'env':env},{'name':_0x0131('0x7'),'script':path['join'](__dirname,_0x0131('0x8')),'env':env},{'name':_0x0131('0x9'),'script':path[_0x0131('0x3')](__dirname,_0x0131('0xa')),'env':env},{'name':_0x0131('0xb'),'script':path[_0x0131('0x3')](__dirname,_0x0131('0xc')),'env':env},{'name':'routing','script':path[_0x0131('0x3')](__dirname,_0x0131('0xd')),'env':env},{'name':_0x0131('0xe'),'script':path[_0x0131('0x3')](__dirname,_0x0131('0xf')),'env':env}]};module[_0x0131('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6d5b6ca..3ca59f0 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 _0xdf86=['stop','then','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start'];(function(_0xdaa895,_0x2557ae){var _0x4d173d=function(_0xbc428d){while(--_0xbc428d){_0xdaa895['push'](_0xdaa895['shift']());}};_0x4d173d(++_0x2557ae);}(_0xdf86,0xbd));var _0x6df8=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0xdf86[_0x2e3545];return _0xcf18f;};'use strict';var pm2=require(_0x6df8('0x0'));var BPromise=require(_0x6df8('0x1'));var config=require(_0x6df8('0x2'));function connect(){return new BPromise(function(_0x1d6b88,_0x10fac0){return pm2[_0x6df8('0x3')](function(_0x455e7e){if(_0x455e7e){return _0x10fac0(_0x455e7e);}return _0x1d6b88(_0x6df8('0x4'));});});};exports[_0x6df8('0x5')]=function(_0x15788f){return connect()['then'](function(){return new BPromise(function(_0x11a64b,_0x54d94f){return pm2[_0x6df8('0x5')](_0x15788f,function(_0x563fc2,_0xfc8335){if(_0x563fc2){return _0x54d94f(_0x563fc2);}pm2['disconnect']();return _0x11a64b(_0xfc8335);});});});};exports[_0x6df8('0x6')]=function(_0x368612){return connect()[_0x6df8('0x7')](function(){return new BPromise(function(_0x157a95,_0x31fec0){return pm2[_0x6df8('0x6')](_0x368612,function(_0x417a6b,_0x44ca4b){if(_0x417a6b){return _0x31fec0(_0x417a6b);}pm2[_0x6df8('0x8')]();return _0x157a95(_0x44ca4b);});});});};exports['restart']=function(_0x4da73a){return connect()[_0x6df8('0x7')](function(){return new BPromise(function(_0x454bbf,_0x334a67){return pm2[_0x6df8('0x9')](_0x4da73a,function(_0x2ad21b,_0x16a5ff){if(_0x2ad21b){return _0x334a67(_0x2ad21b);}pm2[_0x6df8('0x8')]();return _0x454bbf(_0x16a5ff);});});});};exports[_0x6df8('0xa')]=function(){return connect()[_0x6df8('0x7')](function(){return new BPromise(function(_0x379763,_0xced69a){return pm2[_0x6df8('0xa')](function(_0x22213d,_0x25a748){if(_0x22213d){return _0xced69a(_0x22213d);}pm2[_0x6df8('0x8')]();return _0x379763(_0x25a748);});});});};exports[_0x6df8('0xb')]=function(_0x49e61b){return connect()['then'](function(){return new BPromise(function(_0x2adf84,_0x1d768b){return pm2['describe'](_0x49e61b,function(_0x3d2a8a,_0x1c6cfe){if(_0x3d2a8a){return _0x1d768b(_0x3d2a8a);}pm2['disconnect']();return _0x2adf84(_0x1c6cfe);});});});};exports['delete']=function(_0xb50d2b){return connect()[_0x6df8('0x7')](function(){return new BPromise(function(_0x54a9fc,_0xbd08af){return pm2[_0x6df8('0xc')](_0xb50d2b,function(_0x15f6b0,_0x2c3bb9){if(_0x15f6b0){return _0xbd08af(_0x15f6b0);}pm2[_0x6df8('0x8')]();return _0x54a9fc(_0x2c3bb9);});});});};exports[_0x6df8('0xd')]=function(){return connect()[_0x6df8('0x7')](function(){return new BPromise(function(_0xc365ac,_0x22cbd7){return pm2['dump'](function(_0x3629a4){if(_0x3629a4){return _0x22cbd7(_0x3629a4);}return _0xc365ac(_0x6df8('0xe'));});});});}; \ No newline at end of file +var _0x4d62=['disconnect','then','restart','list','delete','dump','saved','pm2','bluebird','./config','connect','connected','start'];(function(_0x2ae408,_0x3f70b6){var _0x4fc988=function(_0x4d7f01){while(--_0x4d7f01){_0x2ae408['push'](_0x2ae408['shift']());}};_0x4fc988(++_0x3f70b6);}(_0x4d62,0x10b));var _0x24d6=function(_0x3fe613,_0x6f7d4d){_0x3fe613=_0x3fe613-0x0;var _0x14d091=_0x4d62[_0x3fe613];return _0x14d091;};'use strict';var pm2=require(_0x24d6('0x0'));var BPromise=require(_0x24d6('0x1'));var config=require(_0x24d6('0x2'));function connect(){return new BPromise(function(_0x536ddd,_0x5c17e9){return pm2[_0x24d6('0x3')](function(_0x843a28){if(_0x843a28){return _0x5c17e9(_0x843a28);}return _0x536ddd(_0x24d6('0x4'));});});};exports['start']=function(_0x53253a){return connect()['then'](function(){return new BPromise(function(_0x3a5350,_0x20171e){return pm2[_0x24d6('0x5')](_0x53253a,function(_0x11dcaa,_0xdb1c10){if(_0x11dcaa){return _0x20171e(_0x11dcaa);}pm2[_0x24d6('0x6')]();return _0x3a5350(_0xdb1c10);});});});};exports['stop']=function(_0x50e336){return connect()[_0x24d6('0x7')](function(){return new BPromise(function(_0x1747c2,_0x29a5af){return pm2['stop'](_0x50e336,function(_0x2ce371,_0x24ede0){if(_0x2ce371){return _0x29a5af(_0x2ce371);}pm2['disconnect']();return _0x1747c2(_0x24ede0);});});});};exports[_0x24d6('0x8')]=function(_0x420b74){return connect()['then'](function(){return new BPromise(function(_0x306477,_0x5c231d){return pm2[_0x24d6('0x8')](_0x420b74,function(_0x568a93,_0x373952){if(_0x568a93){return _0x5c231d(_0x568a93);}pm2[_0x24d6('0x6')]();return _0x306477(_0x373952);});});});};exports[_0x24d6('0x9')]=function(){return connect()[_0x24d6('0x7')](function(){return new BPromise(function(_0x3477bf,_0x5c95df){return pm2[_0x24d6('0x9')](function(_0x3db6d2,_0x3e8c5a){if(_0x3db6d2){return _0x5c95df(_0x3db6d2);}pm2[_0x24d6('0x6')]();return _0x3477bf(_0x3e8c5a);});});});};exports['describe']=function(_0x2a731d){return connect()[_0x24d6('0x7')](function(){return new BPromise(function(_0x14079e,_0x1c59c5){return pm2['describe'](_0x2a731d,function(_0x2f3b8b,_0x17d22e){if(_0x2f3b8b){return _0x1c59c5(_0x2f3b8b);}pm2[_0x24d6('0x6')]();return _0x14079e(_0x17d22e);});});});};exports[_0x24d6('0xa')]=function(_0x50d641){return connect()[_0x24d6('0x7')](function(){return new BPromise(function(_0x191b58,_0x188796){return pm2[_0x24d6('0xa')](_0x50d641,function(_0x34746a,_0x541dfc){if(_0x34746a){return _0x188796(_0x34746a);}pm2['disconnect']();return _0x191b58(_0x541dfc);});});});};exports[_0x24d6('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3a6236,_0x196fcc){return pm2[_0x24d6('0xb')](function(_0x5178c3){if(_0x5178c3){return _0x196fcc(_0x5178c3);}return _0x3a6236(_0x24d6('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7c3c271..64e38ca 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 _0xd53d=['emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd53d,0x10d));var _0xdd53=function(_0x5c33b7,_0xdfd18e){_0x5c33b7=_0x5c33b7-0x0;var _0x4dc885=_0xd53d[_0x5c33b7];return _0x4dc885;};'use strict';var _=require(_0xdd53('0x0'));var moment=require(_0xdd53('0x1'));var Redis=require(_0xdd53('0x2'));var util=require(_0xdd53('0x3'));var config=require(_0xdd53('0x4'));var db=require(_0xdd53('0x5'))['db'];var logger=require(_0xdd53('0x6'))(_0xdd53('0x7'));config[_0xdd53('0x8')]=_[_0xdd53('0x9')](config[_0xdd53('0x8')],{'host':_0xdd53('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdd53('0x8')]));function closeInteractions(){var _0xa74290=0x0;var _0x38c9b7=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0xdd53('0xb')],'where':{'id':0x1}})[_0xdd53('0xc')](function(_0x5b89aa){_0xa74290=_0x5b89aa[_0xdd53('0xb')];if(_0xa74290){return db['ChatInteraction'][_0xdd53('0xd')]({'raw':!![],'attributes':['id',_0xdd53('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xdd53('0xf')](_0x5b89aa[_0xdd53('0xb')],_0xdd53('0x10'))}}});}else{return[];}})[_0xdd53('0xc')](function(_0x588e53){if(_0x588e53&&_0x588e53[_0xdd53('0x11')]){_0x38c9b7=_[_0xdd53('0x12')](_0x588e53||[],'id');logger[_0xdd53('0x13')](_0xdd53('0x14'),_0x38c9b7[_0xdd53('0x15')]());return db[_0xdd53('0x16')][_0xdd53('0x17')]({'closeReason':_0xdd53('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xdd53('0x19')](_0xdd53('0x1a'))},{'where':{'id':_0x38c9b7}});}})[_0xdd53('0xc')](function(){if(_0x38c9b7&&_0x38c9b7[_0xdd53('0x11')]){logger[_0xdd53('0x13')](_0xdd53('0x1b'),_0x38c9b7[_0xdd53('0x15')]());for(var _0x87527b=0x0;_0x87527b<_0x38c9b7['length'];_0x87527b++){io[_0xdd53('0x1c')]('chatInteraction:update',{'id':_0x38c9b7[_0x87527b],'closed':!![]});}}})[_0xdd53('0x1d')](function(_0x1a72d2){logger[_0xdd53('0x1e')](_0xdd53('0x1f'),_0x1a72d2?util['inspect'](_0x1a72d2,{'showHidden':![],'depth':null}):'');});}exports[_0xdd53('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xecb3=['../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','catch','error','inspect','start','lodash','moment','ioredis'];(function(_0x2fa78e,_0x1c8d34){var _0x3e6353=function(_0x1469c1){while(--_0x1469c1){_0x2fa78e['push'](_0x2fa78e['shift']());}};_0x3e6353(++_0x1c8d34);}(_0xecb3,0x1b0));var _0x3ecb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xecb3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3ecb('0x0'));var moment=require(_0x3ecb('0x1'));var Redis=require(_0x3ecb('0x2'));var util=require('util');var config=require(_0x3ecb('0x3'));var db=require(_0x3ecb('0x4'))['db'];var logger=require(_0x3ecb('0x5'))('schedule');config[_0x3ecb('0x6')]=_[_0x3ecb('0x7')](config['redis'],{'host':_0x3ecb('0x8'),'port':0x18eb});var io=require(_0x3ecb('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x1ff94c=0x0;var _0x3fe21d=[];return db['Setting'][_0x3ecb('0xa')]({'raw':!![],'attributes':['id',_0x3ecb('0xb')],'where':{'id':0x1}})[_0x3ecb('0xc')](function(_0x4debd5){_0x1ff94c=_0x4debd5[_0x3ecb('0xb')];if(_0x1ff94c){return db[_0x3ecb('0xd')][_0x3ecb('0xe')]({'raw':!![],'attributes':['id',_0x3ecb('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3ecb('0x10')](_0x4debd5['chatTimeout'],'minutes')}}});}else{return[];}})[_0x3ecb('0xc')](function(_0x52b0f6){if(_0x52b0f6&&_0x52b0f6[_0x3ecb('0x11')]){_0x3fe21d=_['map'](_0x52b0f6||[],'id');logger[_0x3ecb('0x12')](_0x3ecb('0x13'),_0x3fe21d[_0x3ecb('0x14')]());return db['ChatInteraction'][_0x3ecb('0x15')]({'closeReason':_0x3ecb('0x16'),'disposition':_0x3ecb('0x17'),'closed':!![],'closedAt':moment()[_0x3ecb('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3fe21d}});}})[_0x3ecb('0xc')](function(){if(_0x3fe21d&&_0x3fe21d[_0x3ecb('0x11')]){logger[_0x3ecb('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3fe21d[_0x3ecb('0x14')]());for(var _0x944d0d=0x0;_0x944d0d<_0x3fe21d[_0x3ecb('0x11')];_0x944d0d++){io['emit']('chatInteraction:update',{'id':_0x3fe21d[_0x944d0d],'closed':!![]});}}})[_0x3ecb('0x19')](function(_0x2bf6dc){logger[_0x3ecb('0x1a')]('[CHAT]\x20Error\x20closing\x20interactions',_0x2bf6dc?util[_0x3ecb('0x1b')](_0x2bf6dc,{'showHidden':![],'depth':null}):'');});}exports[_0x3ecb('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index ece99a1..fcbeee3 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 _0x8f44=['exports'];(function(_0x47adc7,_0x1fae6f){var _0x9beb15=function(_0x7a791f){while(--_0x7a791f){_0x47adc7['push'](_0x47adc7['shift']());}};_0x9beb15(++_0x1fae6f);}(_0x8f44,0xc8));var _0x48f4=function(_0x2121f1,_0x1804fc){_0x2121f1=_0x2121f1-0x0;var _0x4f9864=_0x8f44[_0x2121f1];return _0x4f9864;};'use strict';function start(){var _0x365519=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x365519['startAllRefreshIntervals']();}module[_0x48f4('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x3f31=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0x3f31,0xa1));var _0x13f3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3f31[_0xa464c9];return _0x3d73c4;};'use strict';function start(){var _0x3a91e9=require(_0x13f3('0x0'));return _0x3a91e9[_0x13f3('0x1')]();}module[_0x13f3('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index ddd11b1..07b689c 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 _0xb477=['exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','map','difference','intersection','deleteJob','delete\x20cron','length','toString','resolve','run\x20job','cron','isBetween','startAt','endAt','add\x20cron','exists','stop\x20cron','active','update','update\x20cron','run','util','path','lodash','cron-job-manager','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','AnalyticExtractedReport','findOne','error','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','user','email','bcc','name','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','join','existsSync','Sent','message','attachments','text','stringify','status','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','then','error\x20mail','email\x20sent','catch','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','still\x20loading','case\x20completed','stop','case\x20empty','case\x20failed','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','Smtp','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output'];(function(_0x5ddb0c,_0x1b10db){var _0x4b3b0c=function(_0x4dc7c4){while(--_0x4dc7c4){_0x5ddb0c['push'](_0x5ddb0c['shift']());}};_0x4b3b0c(++_0x1b10db);}(_0xb477,0x84));var _0x7b47=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb477[_0x4b055c];return _0x4b62bb;};'use strict';var fs=require('fs');var util=require(_0x7b47('0x0'));var path=require(_0x7b47('0x1'));var _=require(_0x7b47('0x2'));var moment=require('moment');var CronJobManager=require(_0x7b47('0x3'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../logger')(_0x7b47('0x4'));var db=require(_0x7b47('0x5'))['db'];const retry=require(_0x7b47('0x6'));var analyticCustomReportController=require(_0x7b47('0x7'));var analyticDefaultReportController=require(_0x7b47('0x8'));var client=jayson[_0x7b47('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x12a0a6){const _0x4eb89c={};if(typeof _0x12a0a6==='number'){_0x4eb89c['id']=_0x12a0a6;}return db[_0x7b47('0xa')][_0x7b47('0xb')]({'where':_0x4eb89c})['then'](function(_0x4b02b0){return _0x4b02b0;})['catch'](function(_0xd10a3e){logger[_0x7b47('0xc')](_0xd10a3e);});}function handleSendEmail(_0xc43613,_0x141593){logger[_0x7b47('0xd')](_0x7b47('0xe'),_0xc43613['email']);var _0x12622d=!![];var _0xb76b8d=_0xc43613['MailAccount'][_0x7b47('0xf')]();var _0x39e68c={'account':_0xb76b8d,'message':{'from':util[_0x7b47('0x10')](_0x7b47('0x11'),_0xc43613['MailAccount']['name'],_0xc43613[_0x7b47('0x12')]['email']||_0xc43613['MailAccount']['Smtp'][_0x7b47('0x13')]),'to':_0xc43613[_0x7b47('0x14')],'cc':_0xc43613['cc'],'bcc':_0xc43613[_0x7b47('0x15')],'subject':util[_0x7b47('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x141593[_0x7b47('0x16')],_0xc43613[_0x7b47('0x17')],_0xc43613[_0x7b47('0x18')])}};var _0x48f5f4=path['join'](__dirname,_0x7b47('0x19'));var _0xc56aba=_0x141593[_0x7b47('0x1a')];var _0x4d3ff3=util[_0x7b47('0x10')](_0x7b47('0x1b'),path[_0x7b47('0x1c')](_0x141593[_0x7b47('0x1a')],path['extname'](_0x141593[_0x7b47('0x1a')])),'zip');var _0x40893c=path['join'](_0x48f5f4,_0xc56aba);var _0x2ee9cb=path[_0x7b47('0x1d')](_0x48f5f4,_0x4d3ff3);if(fs[_0x7b47('0x1e')](_0x40893c)){_0x141593['status']=_0x7b47('0x1f');_0x39e68c[_0x7b47('0x20')][_0x7b47('0x21')]=[{'filename':_0xc56aba,'path':_0x40893c}];_0x39e68c[_0x7b47('0x20')][_0x7b47('0x22')]=util[_0x7b47('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[_0x7b47('0x23')](_0x141593,null,0x2));}else if(fs[_0x7b47('0x1e')](_0x2ee9cb)){_0x141593['status']=_0x7b47('0x1f');_0x39e68c[_0x7b47('0x20')]['attachments']=[{'filename':_0x4d3ff3,'path':_0x2ee9cb}];}else{if(_0x141593[_0x7b47('0x24')]===_0x7b47('0x25')){_0x39e68c['message'][_0x7b47('0x22')]=_0x7b47('0x26');if(!_0xc43613['sendIfEmpty']){_0x12622d=![];logger[_0x7b47('0xd')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x141593[_0x7b47('0x24')]===_0x7b47('0x27')){_0x39e68c[_0x7b47('0x20')][_0x7b47('0x22')]=_0x7b47('0x28');}else if(_0x141593[_0x7b47('0x24')]===_0x7b47('0x29')){_0x39e68c[_0x7b47('0x20')]['text']='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x141593['status']==='Failed'){_0x39e68c[_0x7b47('0x20')][_0x7b47('0x22')]=_0x7b47('0x2a');}else{logger[_0x7b47('0xc')](_0x7b47('0x2b'),_0x141593[_0x7b47('0x24')]);}}if(_0x12622d){return client[_0x7b47('0x2c')]('SendMail',_0x39e68c)[_0x7b47('0x2d')](function(_0x5b861e){if(_0x5b861e[_0x7b47('0xc')]){return logger[_0x7b47('0xc')](_0x7b47('0x2e'),JSON[_0x7b47('0x23')](_0x5b861e));}return logger[_0x7b47('0xd')](_0x7b47('0x2f'));})[_0x7b47('0x30')](function(_0x4a95e9){return logger[_0x7b47('0xc')](_0x7b47('0x2e'),JSON[_0x7b47('0x23')](_0x4a95e9));});}}function handleError(){return function(_0x30c5c2){return logger['error'](JSON[_0x7b47('0x23')](_0x30c5c2));};}function loading(_0x5578c3){logger[_0x7b47('0xd')](_0x7b47('0x31'));if(_0x5578c3[_0x7b47('0x32')]===_0x5578c3[_0x7b47('0x33')][_0x7b47('0x34')]){handleSendEmail(_0x5578c3[_0x7b47('0x35')],_0x5578c3[_0x7b47('0x36')]);_0x5578c3[_0x7b47('0x37')]['stop']();}else{_0x5578c3[_0x7b47('0x37')][_0x7b47('0x6')](_0x7b47('0x38'));}}function completed(_0xba1e0b){logger[_0x7b47('0xd')](_0x7b47('0x39'));handleSendEmail(_0xba1e0b['job'],_0xba1e0b[_0x7b47('0x36')]);_0xba1e0b[_0x7b47('0x37')][_0x7b47('0x3a')]();}function empty(_0x1d81f7){logger['info'](_0x7b47('0x3b'));handleSendEmail(_0x1d81f7[_0x7b47('0x35')],_0x1d81f7['data']);_0x1d81f7[_0x7b47('0x37')][_0x7b47('0x3a')]();}function failed(_0x38ebce){logger[_0x7b47('0xd')](_0x7b47('0x3c'));handleSendEmail(_0x38ebce[_0x7b47('0x35')],_0x38ebce[_0x7b47('0x36')]);_0x38ebce['operation'][_0x7b47('0x3a')]();}function urecognized(_0x278f3e){logger[_0x7b47('0xc')]('Unrecognized\x20status:',_0x278f3e[_0x7b47('0x3d')][_0x7b47('0x3e')][_0x7b47('0x24')]);_0x278f3e['operation'][_0x7b47('0x3a')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2ff8d4,_0x28238d){const _0x38ed3c={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0xee2706=retry['operation'](_0x38ed3c);_0xee2706['attempt'](_0x4c9a9b=>{logger['info'](_0x7b47('0x3f')+_0x2ff8d4['id']+_0x7b47('0x40')+_0x4c9a9b);try{getReportData(_0x28238d['id'])[_0x7b47('0x2d')](function(_0x173206){_0x28238d=_0x173206;logger[_0x7b47('0xd')](_0x7b47('0x41'),_0x173206[_0x7b47('0x3e')]['status']);if(!reportStatusStrategies[_0x173206[_0x7b47('0x3e')][_0x7b47('0x24')]]){logger[_0x7b47('0xc')]('report\x20status:',_0x173206[_0x7b47('0x3e')][_0x7b47('0x24')]);_0xee2706[_0x7b47('0x6')]();}reportStatusStrategies[_0x173206[_0x7b47('0x3e')]['status']]({'operation':_0xee2706,'currentAttempt':_0x4c9a9b,'retryOptions':_0x38ed3c,'job':_0x2ff8d4,'data':_0x28238d,'entity':_0x173206});});}catch(_0x2151d8){_0xee2706['retry'](_0x2151d8);}});}function handleResult(_0x61514e){return function(_0x325932){if(_0x61514e['sendMail']&&_0x61514e['MailAccount']&&_0x61514e[_0x7b47('0x12')][_0x7b47('0x42')]&&!_[_0x7b47('0x43')](_0x61514e[_0x7b47('0x14')])){retryer(_0x61514e,_0x325932);}};}function handleJob(_0x56c43a){return function(){try{if(_[_0x7b47('0x43')](_0x56c43a[_0x7b47('0x17')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x7b47('0x43')](_0x56c43a[_0x7b47('0x18')])){return logger[_0x7b47('0xd')](_0x7b47('0x44'));}var _0x1ab2bf={'startDate':moment()[_0x7b47('0x45')](_0x56c43a[_0x7b47('0x17')],_0x56c43a[_0x7b47('0x18')])[_0x7b47('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x7b47('0x46')),'type':'scheduled','output':_0x56c43a[_0x7b47('0x47')],'name':_0x56c43a[_0x7b47('0x16')]};if(!_[_0x7b47('0x43')](_0x56c43a['DefaultReportId'])){logger[_0x7b47('0xd')](_0x7b47('0x48'),_0x56c43a[_0x7b47('0x49')]);return analyticDefaultReportController['runReport']({'id':_0x56c43a[_0x7b47('0x49')]},_0x1ab2bf)[_0x7b47('0x2d')](handleResult(_0x56c43a))[_0x7b47('0x30')](handleError());}if(!_['isNil'](_0x56c43a[_0x7b47('0x4a')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x56c43a['CustomReportId']);return analyticCustomReportController[_0x7b47('0x4b')]({'id':_0x56c43a[_0x7b47('0x4a')]},_0x1ab2bf)['then'](handleResult(_0x56c43a))[_0x7b47('0x30')](handleError());}}catch(_0x2eb0e0){logger[_0x7b47('0xc')](JSON[_0x7b47('0x23')](_0x2eb0e0));}return logger[_0x7b47('0xd')](_0x7b47('0x4c'));};}function getJobs(_0xa398ae){var _0x833e={};if(_0xa398ae){_0x833e['id']=_0xa398ae;}return db['Schedule'][_0x7b47('0x4d')]({'where':_0x833e,'include':[{'model':db[_0x7b47('0x12')],'attributes':['id',_0x7b47('0x16'),_0x7b47('0x14')],'include':[{'model':db[_0x7b47('0x4e')],'as':_0x7b47('0x42'),'include':[{'model':db['CloudProvider'],'as':_0x7b47('0x4f')}]}]}]})[_0x7b47('0x2d')](function(_0x47af5f){var _0x30a619=_[_0x7b47('0x50')](manager[_0x7b47('0x51')]);var _0x5da04e=_[_0x7b47('0x52')](_0x47af5f,function(_0x1dedaf){return _0x1dedaf['id']['toString']();});var _0x283d75=_['keyBy'](_0x47af5f,function(_0x31556b){return _0x31556b['id']['toString']();});var _0x96dd0d=_0xa398ae?_0x5da04e:_[_0x7b47('0x53')](_0x5da04e,_0x30a619);var _0x180730=_[_0x7b47('0x54')](_0x5da04e,_0x30a619);var _0x1a8600=_['difference'](_0x30a619,_0x5da04e);var _0x389c75;var _0x240899;for(_0x389c75=0x0;_0x389c75<_0x1a8600['length']&&!_0xa398ae;_0x389c75+=0x1){_0x240899=_0x1a8600[_0x389c75]['toString']();if(manager['exists'](_0x240899)){manager['stop'](_0x240899);manager[_0x7b47('0x55')](_0x240899);logger[_0x7b47('0xd')](_0x7b47('0x56'),_0x240899);}}logger[_0x7b47('0xd')]('toRun',JSON[_0x7b47('0x23')](_0x96dd0d));for(_0x389c75=0x0;_0x389c75<_0x96dd0d[_0x7b47('0x57')];_0x389c75+=0x1){_0x240899=_0x96dd0d[_0x389c75][_0x7b47('0x58')]();if(_0xa398ae){logger[_0x7b47('0xd')](JSON[_0x7b47('0x23')](_0x283d75[_0x240899]));BPromise[_0x7b47('0x59')]()[_0x7b47('0x2d')](handleJob(_0x283d75[_0x240899]));logger['info'](_0x7b47('0x5a'),_0x283d75[_0x240899][_0x7b47('0x16')],_0x283d75[_0x240899][_0x7b47('0x5b')]);}else if(_0x283d75[_0x240899][_0x7b47('0x5b')]&&_0x283d75[_0x240899]['active']&&moment()[_0x7b47('0x5c')](_0x283d75[_0x240899][_0x7b47('0x5d')],_0x283d75[_0x240899][_0x7b47('0x5e')])){manager['add'](_0x240899,_0x283d75[_0x240899]['cron'],handleJob(_0x283d75[_0x240899]));manager['start'](_0x240899);logger[_0x7b47('0xd')](_0x7b47('0x5f'),_0x283d75[_0x240899]['name'],_0x283d75[_0x240899]['cron']);}else if(manager[_0x7b47('0x60')](_0x240899)){manager['stop'](_0x240899);manager['deleteJob'](_0x240899);logger['info'](_0x7b47('0x61'),_0x283d75[_0x240899][_0x7b47('0x16')],_0x283d75[_0x240899][_0x7b47('0x5b')]);}}for(_0x389c75=0x0,_0x240899;_0x389c75<_0x180730[_0x7b47('0x57')]&&!_0xa398ae;_0x389c75+=0x1){_0x240899=_0x180730[_0x389c75][_0x7b47('0x58')]();if(manager[_0x7b47('0x60')](_0x240899)){if(_0x283d75[_0x240899][_0x7b47('0x5b')]&&_0x283d75[_0x240899][_0x7b47('0x62')]&&moment()[_0x7b47('0x5c')](_0x283d75[_0x240899][_0x7b47('0x5d')],_0x283d75[_0x240899][_0x7b47('0x5e')])){manager[_0x7b47('0x63')](_0x240899,_0x283d75[_0x240899]['cron'],handleJob(_0x283d75[_0x240899]));logger[_0x7b47('0xd')](_0x7b47('0x64'),_0x283d75[_0x240899]['name'],_0x283d75[_0x240899]['cron']);}else{manager['stop'](_0x240899);manager[_0x7b47('0x55')](_0x240899);logger[_0x7b47('0xd')](_0x7b47('0x61'),_0x283d75[_0x240899][_0x7b47('0x16')],_0x283d75[_0x240899][_0x7b47('0x5b')]);}}}})[_0x7b47('0x30')](function(_0x1cbc32){logger[_0x7b47('0xc')](JSON[_0x7b47('0x23')](_0x1cbc32));});}exports[_0x7b47('0x65')]=function(_0x57a3ce){return getJobs(_0x57a3ce);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe75e=['../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','basename','extname','existsSync','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','error\x20mail','email\x20sent','stringify','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','case\x20failed','entity','attempt','\x20Attempt\x20#:','report\x20status:','dataValues','sendMail','isNil','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference','intersection','exists','deleteJob','delete\x20cron','toRun','resolve','active','endAt','add','start','add\x20cron','stop\x20cron','cron','isBetween','update','update\x20cron','path','lodash','cron-job-manager','jayson/promise','bluebird'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe75e,0x65));var _0xee75=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xe75e[_0x45c48f];return _0xaf5037;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xee75('0x0'));var _=require(_0xee75('0x1'));var moment=require('moment');var CronJobManager=require(_0xee75('0x2'));var jayson=require(_0xee75('0x3'));var BPromise=require(_0xee75('0x4'));var logger=require(_0xee75('0x5'))(_0xee75('0x6'));var db=require(_0xee75('0x7'))['db'];const retry=require(_0xee75('0x8'));var analyticCustomReportController=require(_0xee75('0x9'));var analyticDefaultReportController=require(_0xee75('0xa'));var client=jayson[_0xee75('0xb')][_0xee75('0xc')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x44fdd7){const _0x3b8f82={};if(typeof _0x44fdd7===_0xee75('0xd')){_0x3b8f82['id']=_0x44fdd7;}return db[_0xee75('0xe')][_0xee75('0xf')]({'where':_0x3b8f82})[_0xee75('0x10')](function(_0x286461){return _0x286461;})[_0xee75('0x11')](function(_0x1c0dcd){logger[_0xee75('0x12')](_0x1c0dcd);});}function handleSendEmail(_0x45d0b0,_0x34f12d){logger[_0xee75('0x13')](_0xee75('0x14'),_0x45d0b0[_0xee75('0x15')]);var _0x573667=!![];var _0x3da81e=_0x45d0b0[_0xee75('0x16')][_0xee75('0x17')]();var _0x376774={'account':_0x3da81e,'message':{'from':util[_0xee75('0x18')](_0xee75('0x19'),_0x45d0b0['MailAccount'][_0xee75('0x1a')],_0x45d0b0['MailAccount']['email']||_0x45d0b0[_0xee75('0x16')][_0xee75('0x1b')]['user']),'to':_0x45d0b0['email'],'cc':_0x45d0b0['cc'],'bcc':_0x45d0b0[_0xee75('0x1c')],'subject':util[_0xee75('0x18')](_0xee75('0x1d'),_0x34f12d[_0xee75('0x1a')],_0x45d0b0[_0xee75('0x1e')],_0x45d0b0[_0xee75('0x1f')])}};var _0xc7f1aa=path[_0xee75('0x20')](__dirname,'../../files/reports');var _0x210040=_0x34f12d[_0xee75('0x21')];var _0x23903f=util[_0xee75('0x18')]('%s.%s',path[_0xee75('0x22')](_0x34f12d[_0xee75('0x21')],path[_0xee75('0x23')](_0x34f12d[_0xee75('0x21')])),'zip');var _0x1f52b0=path[_0xee75('0x20')](_0xc7f1aa,_0x210040);var _0x3991f1=path['join'](_0xc7f1aa,_0x23903f);if(fs[_0xee75('0x24')](_0x1f52b0)){_0x34f12d['status']='Sent';_0x376774[_0xee75('0x25')][_0xee75('0x26')]=[{'filename':_0x210040,'path':_0x1f52b0}];_0x376774[_0xee75('0x25')][_0xee75('0x27')]=util[_0xee75('0x18')](_0xee75('0x28'),JSON['stringify'](_0x34f12d,null,0x2));}else if(fs['existsSync'](_0x3991f1)){_0x34f12d[_0xee75('0x29')]=_0xee75('0x2a');_0x376774[_0xee75('0x25')]['attachments']=[{'filename':_0x23903f,'path':_0x3991f1}];}else{if(_0x34f12d[_0xee75('0x29')]===_0xee75('0x2b')){_0x376774[_0xee75('0x25')][_0xee75('0x27')]=_0xee75('0x2c');if(!_0x45d0b0[_0xee75('0x2d')]){_0x573667=![];logger['info'](_0xee75('0x2e'));}}else if(_0x34f12d[_0xee75('0x29')]===_0xee75('0x2f')){_0x376774[_0xee75('0x25')]['text']=_0xee75('0x30');}else if(_0x34f12d[_0xee75('0x29')]===_0xee75('0x31')){_0x376774[_0xee75('0x25')][_0xee75('0x27')]=_0xee75('0x32');}else if(_0x34f12d['status']==='Failed'){_0x376774['message'][_0xee75('0x27')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger['error'](_0xee75('0x33'),_0x34f12d[_0xee75('0x29')]);}}if(_0x573667){return client[_0xee75('0x34')]('SendMail',_0x376774)[_0xee75('0x10')](function(_0x5d5d0b){if(_0x5d5d0b[_0xee75('0x12')]){return logger['error'](_0xee75('0x35'),JSON['stringify'](_0x5d5d0b));}return logger[_0xee75('0x13')](_0xee75('0x36'));})[_0xee75('0x11')](function(_0x59b6eb){return logger[_0xee75('0x12')](_0xee75('0x35'),JSON[_0xee75('0x37')](_0x59b6eb));});}}function handleError(){return function(_0x26c763){return logger['error'](JSON['stringify'](_0x26c763));};}function loading(_0x34e146){logger[_0xee75('0x13')]('case\x20loading');if(_0x34e146[_0xee75('0x38')]===_0x34e146[_0xee75('0x39')][_0xee75('0x3a')]){handleSendEmail(_0x34e146[_0xee75('0x3b')],_0x34e146[_0xee75('0x3c')]);_0x34e146[_0xee75('0x3d')][_0xee75('0x3e')]();}else{_0x34e146['operation'][_0xee75('0x8')](_0xee75('0x3f'));}}function completed(_0x17c17e){logger[_0xee75('0x13')](_0xee75('0x40'));handleSendEmail(_0x17c17e[_0xee75('0x3b')],_0x17c17e['data']);_0x17c17e['operation'][_0xee75('0x3e')]();}function empty(_0x470083){logger[_0xee75('0x13')](_0xee75('0x41'));handleSendEmail(_0x470083[_0xee75('0x3b')],_0x470083['data']);_0x470083[_0xee75('0x3d')][_0xee75('0x3e')]();}function failed(_0x115554){logger['info'](_0xee75('0x42'));handleSendEmail(_0x115554['job'],_0x115554[_0xee75('0x3c')]);_0x115554[_0xee75('0x3d')][_0xee75('0x3e')]();}function urecognized(_0x483c72){logger[_0xee75('0x12')]('Unrecognized\x20status:',_0x483c72[_0xee75('0x43')]['dataValues'][_0xee75('0x29')]);_0x483c72['operation'][_0xee75('0x3e')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x572540,_0x3eb394){const _0x4b0ba7={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x5c5f50=retry[_0xee75('0x3d')](_0x4b0ba7);_0x5c5f50[_0xee75('0x44')](_0x21712d=>{logger[_0xee75('0x13')]('Job\x20ID\x20'+_0x572540['id']+_0xee75('0x45')+_0x21712d);try{getReportData(_0x3eb394['id'])[_0xee75('0x10')](function(_0x559da0){_0x3eb394=_0x559da0;logger[_0xee75('0x13')](_0xee75('0x46'),_0x559da0[_0xee75('0x47')][_0xee75('0x29')]);if(!reportStatusStrategies[_0x559da0[_0xee75('0x47')][_0xee75('0x29')]]){logger[_0xee75('0x12')]('report\x20status:',_0x559da0[_0xee75('0x47')][_0xee75('0x29')]);_0x5c5f50[_0xee75('0x8')]();}reportStatusStrategies[_0x559da0[_0xee75('0x47')][_0xee75('0x29')]]({'operation':_0x5c5f50,'currentAttempt':_0x21712d,'retryOptions':_0x4b0ba7,'job':_0x572540,'data':_0x3eb394,'entity':_0x559da0});});}catch(_0x379241){_0x5c5f50[_0xee75('0x8')](_0x379241);}});}function handleResult(_0x549468){return function(_0x335f65){if(_0x549468[_0xee75('0x48')]&&_0x549468[_0xee75('0x16')]&&_0x549468['MailAccount']['Smtp']&&!_[_0xee75('0x49')](_0x549468['email'])){retryer(_0x549468,_0x335f65);}};}function handleJob(_0x1fdcab){return function(){try{if(_[_0xee75('0x49')](_0x1fdcab[_0xee75('0x1e')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xee75('0x49')](_0x1fdcab[_0xee75('0x1f')])){return logger[_0xee75('0x13')]('subtractUnit\x20null\x20or\x20undefined');}var _0x15b38c={'startDate':moment()['subtract'](_0x1fdcab[_0xee75('0x1e')],_0x1fdcab[_0xee75('0x1f')])['format'](_0xee75('0x4a')),'endDate':moment()[_0xee75('0x18')](_0xee75('0x4a')),'type':_0xee75('0x4b'),'output':_0x1fdcab[_0xee75('0x4c')],'name':_0x1fdcab[_0xee75('0x1a')]};if(!_[_0xee75('0x49')](_0x1fdcab['DefaultReportId'])){logger[_0xee75('0x13')](_0xee75('0x4d'),_0x1fdcab['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x1fdcab[_0xee75('0x4e')]},_0x15b38c)[_0xee75('0x10')](handleResult(_0x1fdcab))[_0xee75('0x11')](handleError());}if(!_['isNil'](_0x1fdcab[_0xee75('0x4f')])){logger[_0xee75('0x13')](_0xee75('0x50'),_0x1fdcab[_0xee75('0x4f')]);return analyticCustomReportController['runReport']({'id':_0x1fdcab[_0xee75('0x4f')]},_0x15b38c)[_0xee75('0x10')](handleResult(_0x1fdcab))[_0xee75('0x11')](handleError());}}catch(_0x5503c9){logger[_0xee75('0x12')](JSON['stringify'](_0x5503c9));}return logger[_0xee75('0x13')](_0xee75('0x51'));};}function getJobs(_0x456088){var _0x182bdc={};if(_0x456088){_0x182bdc['id']=_0x456088;}return db['Schedule'][_0xee75('0x52')]({'where':_0x182bdc,'include':[{'model':db[_0xee75('0x16')],'attributes':['id',_0xee75('0x1a'),_0xee75('0x15')],'include':[{'model':db[_0xee75('0x53')],'as':_0xee75('0x1b'),'include':[{'model':db[_0xee75('0x54')],'as':_0xee75('0x54')}]}]}]})[_0xee75('0x10')](function(_0xa6fb92){var _0x378894=_[_0xee75('0x55')](manager['jobs']);var _0x5ccd11=_[_0xee75('0x56')](_0xa6fb92,function(_0x219dbc){return _0x219dbc['id'][_0xee75('0x57')]();});var _0x5db9a0=_[_0xee75('0x58')](_0xa6fb92,function(_0xa4473e){return _0xa4473e['id'][_0xee75('0x57')]();});var _0x16b1bd=_0x456088?_0x5ccd11:_[_0xee75('0x59')](_0x5ccd11,_0x378894);var _0x3f58c9=_[_0xee75('0x5a')](_0x5ccd11,_0x378894);var _0x4e9295=_['difference'](_0x378894,_0x5ccd11);var _0x5b16c7;var _0x4e5295;for(_0x5b16c7=0x0;_0x5b16c7<_0x4e9295['length']&&!_0x456088;_0x5b16c7+=0x1){_0x4e5295=_0x4e9295[_0x5b16c7][_0xee75('0x57')]();if(manager[_0xee75('0x5b')](_0x4e5295)){manager['stop'](_0x4e5295);manager[_0xee75('0x5c')](_0x4e5295);logger[_0xee75('0x13')](_0xee75('0x5d'),_0x4e5295);}}logger[_0xee75('0x13')](_0xee75('0x5e'),JSON[_0xee75('0x37')](_0x16b1bd));for(_0x5b16c7=0x0;_0x5b16c7<_0x16b1bd['length'];_0x5b16c7+=0x1){_0x4e5295=_0x16b1bd[_0x5b16c7][_0xee75('0x57')]();if(_0x456088){logger[_0xee75('0x13')](JSON[_0xee75('0x37')](_0x5db9a0[_0x4e5295]));BPromise[_0xee75('0x5f')]()[_0xee75('0x10')](handleJob(_0x5db9a0[_0x4e5295]));logger[_0xee75('0x13')]('run\x20job',_0x5db9a0[_0x4e5295][_0xee75('0x1a')],_0x5db9a0[_0x4e5295]['cron']);}else if(_0x5db9a0[_0x4e5295]['cron']&&_0x5db9a0[_0x4e5295][_0xee75('0x60')]&&moment()['isBetween'](_0x5db9a0[_0x4e5295]['startAt'],_0x5db9a0[_0x4e5295][_0xee75('0x61')])){manager[_0xee75('0x62')](_0x4e5295,_0x5db9a0[_0x4e5295]['cron'],handleJob(_0x5db9a0[_0x4e5295]));manager[_0xee75('0x63')](_0x4e5295);logger[_0xee75('0x13')](_0xee75('0x64'),_0x5db9a0[_0x4e5295][_0xee75('0x1a')],_0x5db9a0[_0x4e5295]['cron']);}else if(manager[_0xee75('0x5b')](_0x4e5295)){manager['stop'](_0x4e5295);manager[_0xee75('0x5c')](_0x4e5295);logger[_0xee75('0x13')](_0xee75('0x65'),_0x5db9a0[_0x4e5295][_0xee75('0x1a')],_0x5db9a0[_0x4e5295][_0xee75('0x66')]);}}for(_0x5b16c7=0x0,_0x4e5295;_0x5b16c7<_0x3f58c9['length']&&!_0x456088;_0x5b16c7+=0x1){_0x4e5295=_0x3f58c9[_0x5b16c7][_0xee75('0x57')]();if(manager[_0xee75('0x5b')](_0x4e5295)){if(_0x5db9a0[_0x4e5295]['cron']&&_0x5db9a0[_0x4e5295]['active']&&moment()[_0xee75('0x67')](_0x5db9a0[_0x4e5295]['startAt'],_0x5db9a0[_0x4e5295][_0xee75('0x61')])){manager[_0xee75('0x68')](_0x4e5295,_0x5db9a0[_0x4e5295][_0xee75('0x66')],handleJob(_0x5db9a0[_0x4e5295]));logger['info'](_0xee75('0x69'),_0x5db9a0[_0x4e5295]['name'],_0x5db9a0[_0x4e5295][_0xee75('0x66')]);}else{manager[_0xee75('0x3e')](_0x4e5295);manager[_0xee75('0x5c')](_0x4e5295);logger[_0xee75('0x13')]('stop\x20cron',_0x5db9a0[_0x4e5295][_0xee75('0x1a')],_0x5db9a0[_0x4e5295][_0xee75('0x66')]);}}}})[_0xee75('0x11')](function(_0x1cb154){logger[_0xee75('0x12')](JSON[_0xee75('0x37')](_0x1cb154));});}exports['run']=function(_0x4b2f61){return getJobs(_0x4b2f61);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 3dcf040..b33d7c4 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 _0xeffd=['data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','bucket','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','Positive','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','inspect','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','info','TranscriptionJob','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','findOne'];(function(_0x624b39,_0x30b01e){var _0x450f82=function(_0x496c70){while(--_0x496c70){_0x624b39['push'](_0x624b39['shift']());}};_0x450f82(++_0x30b01e);}(_0xeffd,0x6b));var _0xdeff=function(_0x3a75c3,_0x2257b1){_0x3a75c3=_0x3a75c3-0x0;var _0x14695a=_0xeffd[_0x3a75c3];return _0x14695a;};var _=require(_0xdeff('0x0'));var AWS=require('aws-sdk');var rp=require(_0xdeff('0x1'));var util=require(_0xdeff('0x2'));var BPromise=require(_0xdeff('0x3'));var db=require(_0xdeff('0x4'))['db'];var logger=require(_0xdeff('0x5'))(_0xdeff('0x6'));function getTranscriptionJob(_0x298274,_0x2881fd,_0x8315d4,_0x1c4628){return new Promise(function(_0x1ed641,_0x132631){var _0x281ad7=new AWS[(_0xdeff('0x7'))]({'accessKeyId':_0x2881fd,'secretAccessKey':_0x298274,'region':_0x8315d4});_0x281ad7[_0xdeff('0x8')]({'TranscriptionJobName':_0x1c4628},function(_0x12e953,_0x24897a){if(_0x12e953){return _0x132631(_0x12e953);}else{return _0x1ed641(_0x24897a);}});});}function sentiment(_0x540ae6,_0x3ae201,_0x45a8a6,_0xf6d58d,_0x51fcb7){return new Promise(function(_0x1ff265,_0x4423e9){var _0x3c1482=new AWS[(_0xdeff('0x9'))]({'accessKeyId':_0x3ae201,'secretAccessKey':_0x540ae6,'region':_0x45a8a6});_0x3c1482[_0xdeff('0xa')]({'Text':_0xf6d58d,'LanguageCode':_0x51fcb7[_0xdeff('0xb')](0x0,0x2)},function(_0x2e9783,_0x402075){if(_0x2e9783){return _0x4423e9(_0x2e9783);}else{return _0x1ff265(_0x402075);}});});}function checkTranscribeJob(_0x505d0c,_0x461699,_0x116bf9){var _0x4952f2;return new BPromise(function(_0x2e614c,_0x4e7526){logger['info'](util[_0xdeff('0xc')](_0xdeff('0xd'),_0x505d0c['id'],_0x505d0c[_0xdeff('0xe')]));return getTranscriptionJob(_0x116bf9[_0xdeff('0xf')],_0x116bf9['data2'],_0x461699[_0xdeff('0x10')],_0x505d0c[_0xdeff('0xe')])[_0xdeff('0x11')](function(_0x391633){logger[_0xdeff('0x12')](util[_0xdeff('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x505d0c['id'],_0x505d0c['transcribeName'],_0x391633[_0xdeff('0x13')]['TranscriptionJobStatus']));if(!_0x505d0c['fileText']){switch(_0x391633[_0xdeff('0x13')][_0xdeff('0x14')]){case'COMPLETED':var _0x2de203={'transcribeStatus':_0x391633[_0xdeff('0x13')][_0xdeff('0x14')],'fileUri':_0x391633[_0xdeff('0x13')][_0xdeff('0x15')][_0xdeff('0x16')]};logger[_0xdeff('0x12')](util[_0xdeff('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x505d0c['id']));return rp({'uri':_0x391633['TranscriptionJob']['Transcript'][_0xdeff('0x16')],'json':!![]})['then'](function(_0x189627){logger[_0xdeff('0x12')](util['format'](_0xdeff('0x17'),_0x505d0c['id']));if(_0x189627&&_0x189627[_0xdeff('0x18')]&&_0x189627['results']['transcripts']&&_0x189627[_0xdeff('0x18')][_0xdeff('0x19')][_0xdeff('0x1a')]){_0x2de203[_0xdeff('0x1b')]='';for(var _0x32add9=0x0;_0x32add9<_0x189627['results'][_0xdeff('0x19')][_0xdeff('0x1a')];_0x32add9++){_0x2de203[_0xdeff('0x1b')]+=_0x189627[_0xdeff('0x18')][_0xdeff('0x19')][_0x32add9][_0xdeff('0x1c')]+'';}}return _0x505d0c[_0xdeff('0x1d')](_0x2de203);})['then'](function(){logger[_0xdeff('0x12')](util[_0xdeff('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x505d0c['id']));if(!_0x505d0c['tempSentiment']){throw new db[(_0xdeff('0x1e'))][(_0xdeff('0x1f'))](_0xdeff('0x20'));}if(!_0x461699[_0xdeff('0x21')]||!_0x461699[_0xdeff('0x22')]||!_0x461699[_0xdeff('0x23')]||!_0x461699[_0xdeff('0x24')]||!_0x461699['bucket']){throw new db[(_0xdeff('0x1e'))][(_0xdeff('0x1f'))](_0xdeff('0x25'));}if(!_0x2de203['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x461699[_0xdeff('0x22')]===_0x116bf9['id']){return _0x116bf9;}else{return db['CloudProvider'][_0xdeff('0x26')]({'where':{'id':_settings[_0xdeff('0x22')]}});}})[_0xdeff('0x11')](function(_0x5af6b2){if(!_0x5af6b2){throw new db[(_0xdeff('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5af6b2[_0xdeff('0xf')]||!_0x5af6b2[_0xdeff('0x27')]){throw new db[(_0xdeff('0x1e'))][(_0xdeff('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x4952f2=_0x5af6b2;logger[_0xdeff('0x12')](util[_0xdeff('0xc')](_0xdeff('0x28'),_0x505d0c['id']));return sentiment(_0x4952f2[_0xdeff('0xf')],_0x4952f2[_0xdeff('0x27')],_0x461699[_0xdeff('0x23')],_0x2de203[_0xdeff('0x1b')],_0x461699['language']);})[_0xdeff('0x11')](function(_0x5cef77){logger[_0xdeff('0x12')](util[_0xdeff('0xc')](_0xdeff('0x29'),_0x505d0c['id']));return _0x505d0c[_0xdeff('0x1d')]({'sentiment':_0x5cef77[_0xdeff('0x2a')],'sPositive':_0x5cef77[_0xdeff('0x2b')]['Positive'],'sNegative':_0x5cef77[_0xdeff('0x2b')][_0xdeff('0x2c')],'sMixed':_0x5cef77['SentimentScore'][_0xdeff('0x2d')],'sNeutral':_0x5cef77[_0xdeff('0x2b')][_0xdeff('0x2e')]});})[_0xdeff('0x11')](function(){logger[_0xdeff('0x12')](util[_0xdeff('0xc')](_0xdeff('0x2f'),_0x505d0c['id']));_0x2e614c();});case _0xdeff('0x30'):return _0x505d0c['update']({'transcribeStatus':_0xdeff('0x30'),'failureReason':_0x391633['TranscriptionJob'][_0xdeff('0x31')]})[_0xdeff('0x11')](function(){logger[_0xdeff('0x12')](util['format'](_0xdeff('0x2f'),_0x505d0c['id']));_0x2e614c();});default:logger[_0xdeff('0x12')](util[_0xdeff('0xc')](_0xdeff('0x32'),_0x505d0c['id']));break;}}else{return BPromise[_0xdeff('0x33')]()['then'](function(){if(!_0x505d0c[_0xdeff('0x34')]){throw new db['Sequelize'][(_0xdeff('0x1f'))](_0xdeff('0x20'));}if(!_0x461699['sentiment']||!_0x461699[_0xdeff('0x22')]||!_0x461699[_0xdeff('0x23')]||!_0x461699[_0xdeff('0x24')]||!_0x461699[_0xdeff('0x35')]){throw new db[(_0xdeff('0x1e'))]['ValidationError'](_0xdeff('0x25'));}if(!_0x505d0c[_0xdeff('0x1b')]){throw new Error(_0xdeff('0x36'));}if(_0x461699[_0xdeff('0x22')]===_0x116bf9['id']){return _0x116bf9;}else{return db[_0xdeff('0x37')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xdeff('0x11')](function(_0x1f5411){if(!_0x1f5411){throw new db[(_0xdeff('0x1e'))][(_0xdeff('0x1f'))](_0xdeff('0x38'));}if(!_0x1f5411[_0xdeff('0xf')]||!_0x1f5411[_0xdeff('0x27')]){throw new db['Sequelize'][(_0xdeff('0x1f'))](_0xdeff('0x39'));}_0x4952f2=_0x1f5411;logger[_0xdeff('0x12')](util['format'](_0xdeff('0x28'),_0x505d0c['id']));return sentiment(_0x4952f2[_0xdeff('0xf')],_0x4952f2[_0xdeff('0x27')],_0x461699[_0xdeff('0x23')],_0x505d0c['fileText'],_0x461699[_0xdeff('0x24')]);})[_0xdeff('0x11')](function(_0x8fe480){logger[_0xdeff('0x12')](util[_0xdeff('0xc')](_0xdeff('0x29'),_0x505d0c['id']));return _0x505d0c[_0xdeff('0x1d')]({'sentiment':_0x8fe480[_0xdeff('0x2a')],'sPositive':_0x8fe480['SentimentScore'][_0xdeff('0x3a')],'sNegative':_0x8fe480[_0xdeff('0x2b')][_0xdeff('0x2c')],'sMixed':_0x8fe480[_0xdeff('0x2b')][_0xdeff('0x2d')],'sNeutral':_0x8fe480['SentimentScore'][_0xdeff('0x2e')],'transcribeStatus':_0xdeff('0x3b')});})[_0xdeff('0x11')](function(){logger[_0xdeff('0x12')](util[_0xdeff('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x505d0c['id']));_0x2e614c();});}})[_0xdeff('0x3c')](function(_0x4e7316){if(_0x4e7316){if(!_0x4e7316[_0xdeff('0x3d')]||_0x4e7316[_0xdeff('0x3d')]!==_0xdeff('0x3e')){logger[_0xdeff('0x3f')](util[_0xdeff('0xc')](_0xdeff('0x40'),_0x505d0c['id']),util['inspect'](_0x4e7316,{'showHidden':![],'depth':null}));}}_0x2e614c();});});}function checkTranscribe(){var _0x49bc0b;var _0x71b5a5;var _0xf91a72;return db[_0xdeff('0x41')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xdeff('0x11')](function(_0x344218){if(!_0x344218||!_0x344218['length']){throw new db[(_0xdeff('0x1e'))][(_0xdeff('0x1f'))](_0xdeff('0x42'));}_0x49bc0b=_0x344218;return db['Setting'][_0xdeff('0x26')]({'where':{'id':0x1}});})[_0xdeff('0x11')](function(_0x1ca376){if(!_0x1ca376){throw new db['Sequelize'][(_0xdeff('0x1f'))](_0xdeff('0x43'));}_0x71b5a5=_0x1ca376;if(!_0x71b5a5[_0xdeff('0x6')]||!_0x71b5a5[_0xdeff('0x44')]||!_0x71b5a5[_0xdeff('0x10')]||!_0x71b5a5[_0xdeff('0x24')]||!_0x71b5a5[_0xdeff('0x35')]){throw new db['Sequelize'][(_0xdeff('0x1f'))](_0xdeff('0x45'));}return db['CloudProvider'][_0xdeff('0x26')]({'where':{'id':_0x71b5a5[_0xdeff('0x44')]}});})[_0xdeff('0x11')](function(_0x33482b){if(!_0x33482b){throw new db[(_0xdeff('0x1e'))][(_0xdeff('0x1f'))](_0xdeff('0x38'));}if(!_0x33482b[_0xdeff('0xf')]||!_0x33482b['data2']){throw new db[(_0xdeff('0x1e'))][(_0xdeff('0x1f'))](_0xdeff('0x39'));}_0xf91a72=_0x33482b;var _0x552749=[];_0x49bc0b['forEach'](function(_0x1e43a6){_0x552749[_0xdeff('0x46')](checkTranscribeJob(_0x1e43a6,_0x71b5a5,_0xf91a72));});return BPromise[_0xdeff('0x47')](_0x552749);})[_0xdeff('0x3c')](function(_0x440053){if(_0x440053){if(!_0x440053[_0xdeff('0x3d')]||_0x440053['name']!=='SequelizeValidationError'){logger[_0xdeff('0x3f')](util[_0xdeff('0x48')](_0x440053,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd7ab=['transcribe','forEach','push','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','Setting'];(function(_0x3cd078,_0x2921f4){var _0x10b5ff=function(_0xccaf91){while(--_0xccaf91){_0x3cd078['push'](_0x3cd078['shift']());}};_0x10b5ff(++_0x2921f4);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd7ab[_0x14add3];return _0x4a174f;};var _=require(_0xbd7a('0x0'));var AWS=require(_0xbd7a('0x1'));var rp=require(_0xbd7a('0x2'));var util=require(_0xbd7a('0x3'));var BPromise=require(_0xbd7a('0x4'));var db=require(_0xbd7a('0x5'))['db'];var logger=require(_0xbd7a('0x6'))('transcribe');function getTranscriptionJob(_0x5104f2,_0x5a7dc8,_0x2b1d52,_0x599057){return new Promise(function(_0x480cb0,_0x458cda){var _0x331bcb=new AWS[(_0xbd7a('0x7'))]({'accessKeyId':_0x5a7dc8,'secretAccessKey':_0x5104f2,'region':_0x2b1d52});_0x331bcb['getTranscriptionJob']({'TranscriptionJobName':_0x599057},function(_0x3eb09d,_0x2aa782){if(_0x3eb09d){return _0x458cda(_0x3eb09d);}else{return _0x480cb0(_0x2aa782);}});});}function sentiment(_0x50e9ce,_0x186c88,_0x5c8abe,_0x220d97,_0x4dfbd9){return new Promise(function(_0x4c4d89,_0x2b6a14){var _0x4a4006=new AWS['Comprehend']({'accessKeyId':_0x186c88,'secretAccessKey':_0x50e9ce,'region':_0x5c8abe});_0x4a4006[_0xbd7a('0x8')]({'Text':_0x220d97,'LanguageCode':_0x4dfbd9[_0xbd7a('0x9')](0x0,0x2)},function(_0x21544b,_0x275d16){if(_0x21544b){return _0x2b6a14(_0x21544b);}else{return _0x4c4d89(_0x275d16);}});});}function checkTranscribeJob(_0x3294cd,_0x5aaa2d,_0x2133eb){var _0x5393ee;return new BPromise(function(_0xdfa6e6,_0x194935){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0xc'),_0x3294cd['id'],_0x3294cd[_0xbd7a('0xd')]));return getTranscriptionJob(_0x2133eb['data1'],_0x2133eb[_0xbd7a('0xe')],_0x5aaa2d['transcribeRegion'],_0x3294cd[_0xbd7a('0xd')])['then'](function(_0x3fb8f4){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0xf'),_0x3294cd['id'],_0x3294cd[_0xbd7a('0xd')],_0x3fb8f4[_0xbd7a('0x10')][_0xbd7a('0x11')]));if(!_0x3294cd['fileText']){switch(_0x3fb8f4['TranscriptionJob']['TranscriptionJobStatus']){case _0xbd7a('0x12'):var _0x1699ca={'transcribeStatus':_0x3fb8f4['TranscriptionJob'][_0xbd7a('0x11')],'fileUri':_0x3fb8f4[_0xbd7a('0x10')][_0xbd7a('0x13')][_0xbd7a('0x14')]};logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0x15'),_0x3294cd['id']));return rp({'uri':_0x3fb8f4[_0xbd7a('0x10')][_0xbd7a('0x13')]['TranscriptFileUri'],'json':!![]})[_0xbd7a('0x16')](function(_0x5ad9c6){logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3294cd['id']));if(_0x5ad9c6&&_0x5ad9c6[_0xbd7a('0x17')]&&_0x5ad9c6[_0xbd7a('0x17')][_0xbd7a('0x18')]&&_0x5ad9c6[_0xbd7a('0x17')][_0xbd7a('0x18')][_0xbd7a('0x19')]){_0x1699ca['fileText']='';for(var _0x1e5ad6=0x0;_0x1e5ad6<_0x5ad9c6[_0xbd7a('0x17')][_0xbd7a('0x18')]['length'];_0x1e5ad6++){_0x1699ca[_0xbd7a('0x1a')]+=_0x5ad9c6['results'][_0xbd7a('0x18')][_0x1e5ad6]['transcript']+'';}}return _0x3294cd[_0xbd7a('0x1b')](_0x1699ca);})[_0xbd7a('0x16')](function(){logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x1c'),_0x3294cd['id']));if(!_0x3294cd[_0xbd7a('0x1d')]){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x20'));}if(!_0x5aaa2d[_0xbd7a('0x21')]||!_0x5aaa2d['sentimentAccountId']||!_0x5aaa2d[_0xbd7a('0x22')]||!_0x5aaa2d[_0xbd7a('0x23')]||!_0x5aaa2d['bucket']){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x24'));}if(!_0x1699ca[_0xbd7a('0x1a')]){throw new Error(_0xbd7a('0x25'));}if(_0x5aaa2d[_0xbd7a('0x26')]===_0x2133eb['id']){return _0x2133eb;}else{return db[_0xbd7a('0x27')][_0xbd7a('0x28')]({'where':{'id':_settings[_0xbd7a('0x26')]}});}})[_0xbd7a('0x16')](function(_0x32b095){if(!_0x32b095){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x29'));}if(!_0x32b095[_0xbd7a('0x2a')]||!_0x32b095[_0xbd7a('0xe')]){throw new db[(_0xbd7a('0x1e'))]['ValidationError'](_0xbd7a('0x2b'));}_0x5393ee=_0x32b095;logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0x2c'),_0x3294cd['id']));return sentiment(_0x5393ee[_0xbd7a('0x2a')],_0x5393ee['data2'],_0x5aaa2d[_0xbd7a('0x22')],_0x1699ca[_0xbd7a('0x1a')],_0x5aaa2d[_0xbd7a('0x23')]);})['then'](function(_0x2bc18c){logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x2d'),_0x3294cd['id']));return _0x3294cd[_0xbd7a('0x1b')]({'sentiment':_0x2bc18c['Sentiment'],'sPositive':_0x2bc18c['SentimentScore'][_0xbd7a('0x2e')],'sNegative':_0x2bc18c[_0xbd7a('0x2f')][_0xbd7a('0x30')],'sMixed':_0x2bc18c[_0xbd7a('0x2f')][_0xbd7a('0x31')],'sNeutral':_0x2bc18c[_0xbd7a('0x2f')][_0xbd7a('0x32')]});})[_0xbd7a('0x16')](function(){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0x1c'),_0x3294cd['id']));_0xdfa6e6();});case _0xbd7a('0x33'):return _0x3294cd[_0xbd7a('0x1b')]({'transcribeStatus':_0xbd7a('0x33'),'failureReason':_0x3fb8f4[_0xbd7a('0x10')][_0xbd7a('0x34')]})['then'](function(){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0x1c'),_0x3294cd['id']));_0xdfa6e6();});default:logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x35'),_0x3294cd['id']));break;}}else{return BPromise['resolve']()[_0xbd7a('0x16')](function(){if(!_0x3294cd[_0xbd7a('0x1d')]){throw new db[(_0xbd7a('0x1e'))]['ValidationError'](_0xbd7a('0x20'));}if(!_0x5aaa2d['sentiment']||!_0x5aaa2d[_0xbd7a('0x26')]||!_0x5aaa2d[_0xbd7a('0x22')]||!_0x5aaa2d[_0xbd7a('0x23')]||!_0x5aaa2d[_0xbd7a('0x36')]){throw new db[(_0xbd7a('0x1e'))]['ValidationError'](_0xbd7a('0x24'));}if(!_0x3294cd[_0xbd7a('0x1a')]){throw new Error(_0xbd7a('0x25'));}if(_0x5aaa2d['sentimentAccountId']===_0x2133eb['id']){return _0x2133eb;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xbd7a('0x26')]}});}})[_0xbd7a('0x16')](function(_0x5b86cd){if(!_0x5b86cd){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x29'));}if(!_0x5b86cd[_0xbd7a('0x2a')]||!_0x5b86cd[_0xbd7a('0xe')]){throw new db['Sequelize'][(_0xbd7a('0x1f'))](_0xbd7a('0x2b'));}_0x5393ee=_0x5b86cd;logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x2c'),_0x3294cd['id']));return sentiment(_0x5393ee[_0xbd7a('0x2a')],_0x5393ee[_0xbd7a('0xe')],_0x5aaa2d['sentimentRegion'],_0x3294cd[_0xbd7a('0x1a')],_0x5aaa2d['language']);})['then'](function(_0x5346d6){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3294cd['id']));return _0x3294cd[_0xbd7a('0x1b')]({'sentiment':_0x5346d6['Sentiment'],'sPositive':_0x5346d6[_0xbd7a('0x2f')][_0xbd7a('0x2e')],'sNegative':_0x5346d6[_0xbd7a('0x2f')][_0xbd7a('0x30')],'sMixed':_0x5346d6[_0xbd7a('0x2f')][_0xbd7a('0x31')],'sNeutral':_0x5346d6[_0xbd7a('0x2f')][_0xbd7a('0x32')],'transcribeStatus':_0xbd7a('0x12')});})[_0xbd7a('0x16')](function(){logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x1c'),_0x3294cd['id']));_0xdfa6e6();});}})['catch'](function(_0x5d5d48){if(_0x5d5d48){if(!_0x5d5d48[_0xbd7a('0x37')]||_0x5d5d48[_0xbd7a('0x37')]!==_0xbd7a('0x38')){logger[_0xbd7a('0x39')](util[_0xbd7a('0xb')](_0xbd7a('0x3a'),_0x3294cd['id']),util[_0xbd7a('0x3b')](_0x5d5d48,{'showHidden':![],'depth':null}));}}_0xdfa6e6();});});}function checkTranscribe(){var _0x2e3672;var _0x2ba9e7;var _0x526ce5;return db[_0xbd7a('0x3c')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3bd3c2){if(!_0x3bd3c2||!_0x3bd3c2['length']){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2e3672=_0x3bd3c2;return db[_0xbd7a('0x3d')][_0xbd7a('0x28')]({'where':{'id':0x1}});})['then'](function(_0x455acc){if(!_0x455acc){throw new db[(_0xbd7a('0x1e'))]['ValidationError']('Settings\x20not\x20available');}_0x2ba9e7=_0x455acc;if(!_0x2ba9e7[_0xbd7a('0x3e')]||!_0x2ba9e7['transcribeAccountId']||!_0x2ba9e7['transcribeRegion']||!_0x2ba9e7[_0xbd7a('0x23')]||!_0x2ba9e7[_0xbd7a('0x36')]){throw new db[(_0xbd7a('0x1e'))]['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xbd7a('0x28')]({'where':{'id':_0x2ba9e7['transcribeAccountId']}});})[_0xbd7a('0x16')](function(_0x2af4cd){if(!_0x2af4cd){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x29'));}if(!_0x2af4cd[_0xbd7a('0x2a')]||!_0x2af4cd[_0xbd7a('0xe')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x526ce5=_0x2af4cd;var _0x301c56=[];_0x2e3672[_0xbd7a('0x3f')](function(_0x54bd38){_0x301c56[_0xbd7a('0x40')](checkTranscribeJob(_0x54bd38,_0x2ba9e7,_0x526ce5));});return BPromise['all'](_0x301c56);})['catch'](function(_0x55d960){if(_0x55d960){if(!_0x55d960['name']||_0x55d960[_0xbd7a('0x37')]!==_0xbd7a('0x38')){logger[_0xbd7a('0x39')](util[_0xbd7a('0x3b')](_0x55d960,{'showHidden':![],'depth':null}));}}});}exports[_0xbd7a('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 44efe5f..128cb55 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 _0xb450=['[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','socket.io-emitter','WhatsappInteraction','hours','length','map','info'];(function(_0x4a3d6b,_0x1d293f){var _0x1fb408=function(_0x5f5d84){while(--_0x5f5d84){_0x4a3d6b['push'](_0x4a3d6b['shift']());}};_0x1fb408(++_0x1d293f);}(_0xb450,0x19b));var _0x0b45=function(_0x362fce,_0xd44c62){_0x362fce=_0x362fce-0x0;var _0x12c2b3=_0xb450[_0x362fce];return _0x12c2b3;};'use strict';var _=require('lodash');var moment=require(_0x0b45('0x0'));var Redis=require(_0x0b45('0x1'));var util=require(_0x0b45('0x2'));var config=require(_0x0b45('0x3'));var db=require(_0x0b45('0x4'))['db'];var logger=require(_0x0b45('0x5'))('schedule');config[_0x0b45('0x6')]=_[_0x0b45('0x7')](config[_0x0b45('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0b45('0x8'))(new Redis(config[_0x0b45('0x6')]));function closeInteractions(){var _0x4791e2=[];return db[_0x0b45('0x9')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x0b45('0xa'))}}})['then'](function(_0x18ca73){if(_0x18ca73&&_0x18ca73[_0x0b45('0xb')]){_0x4791e2=_[_0x0b45('0xc')](_0x18ca73||[],'id');logger[_0x0b45('0xd')](_0x0b45('0xe'),_0x4791e2[_0x0b45('0xf')]());return db['WhatsappInteraction'][_0x0b45('0x10')]({'closeReason':_0x0b45('0x11'),'disposition':_0x0b45('0x12'),'closed':!![],'closedAt':moment()[_0x0b45('0x13')](_0x0b45('0x14'))},{'where':{'id':_0x4791e2}});}})['then'](function(){if(_0x4791e2&&_0x4791e2[_0x0b45('0xb')]){logger[_0x0b45('0xd')](_0x0b45('0x15'),_0x4791e2[_0x0b45('0xf')]());for(var _0x7d955f=0x0;_0x7d955f<_0x4791e2[_0x0b45('0xb')];_0x7d955f++){io[_0x0b45('0x16')]('whatsappInteraction:update',{'id':_0x4791e2[_0x7d955f],'closed':!![]});}}})[_0x0b45('0x17')](function(_0x3dcc2a){logger['error'](_0x0b45('0x18'),_0x3dcc2a?util['inspect'](_0x3dcc2a,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x052e=['info','update','system','format','YYYY-MM-DD\x20HH:mm:ss','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','hours','then','length','map'];(function(_0x20484c,_0x1abbe6){var _0x3e5356=function(_0x13a45a){while(--_0x13a45a){_0x20484c['push'](_0x20484c['shift']());}};_0x3e5356(++_0x1abbe6);}(_0x052e,0x6e));var _0xe052=function(_0x315bd7,_0x36a963){_0x315bd7=_0x315bd7-0x0;var _0x378931=_0x052e[_0x315bd7];return _0x378931;};'use strict';var _=require(_0xe052('0x0'));var moment=require(_0xe052('0x1'));var Redis=require(_0xe052('0x2'));var util=require('util');var config=require(_0xe052('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xe052('0x4'));config[_0xe052('0x5')]=_[_0xe052('0x6')](config[_0xe052('0x5')],{'host':_0xe052('0x7'),'port':0x18eb});var io=require(_0xe052('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x140a74=[];return db[_0xe052('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xe052('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xe052('0xb'))}}})[_0xe052('0xc')](function(_0x30fcf6){if(_0x30fcf6&&_0x30fcf6[_0xe052('0xd')]){_0x140a74=_[_0xe052('0xe')](_0x30fcf6||[],'id');logger[_0xe052('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x140a74['join']());return db[_0xe052('0x9')][_0xe052('0x10')]({'closeReason':_0xe052('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xe052('0x12')](_0xe052('0x13'))},{'where':{'id':_0x140a74}});}})[_0xe052('0xc')](function(){if(_0x140a74&&_0x140a74['length']){logger[_0xe052('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x140a74['join']());for(var _0x10ce21=0x0;_0x10ce21<_0x140a74[_0xe052('0xd')];_0x10ce21++){io['emit']('whatsappInteraction:update',{'id':_0x140a74[_0x10ce21],'closed':!![]});}}})[_0xe052('0x14')](function(_0x47ed1f){logger[_0xe052('0x15')](_0xe052('0x16'),_0x47ed1f?util[_0xe052('0x17')](_0x47ed1f,{'showHidden':![],'depth':null}):'');});}exports[_0xe052('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index cddd574..ccce6d3 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf63a=['CmHopper','destroy','hopper1','hopper2','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','then','log','finished\x20populating','contacts1'];(function(_0x41dfc4,_0x22590f){var _0x2db6df=function(_0x1ed39d){while(--_0x1ed39d){_0x41dfc4['push'](_0x41dfc4['shift']());}};_0x2db6df(++_0x22590f);}(_0xf63a,0x164));var _0xaf63=function(_0x4c335d,_0x419504){_0x4c335d=_0x4c335d-0x0;var _0x947bcd=_0xf63a[_0x4c335d];return _0x947bcd;};'use strict';var util=require('util');var db=require(_0xaf63('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xaf63('0x1')]({'id':i,'firstName':_0xaf63('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xaf63('0x3')+i+_0xaf63('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xaf63('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaf63('0x5')](),'updatedAt':Date[_0xaf63('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xaf63('0x1')]({'id':i,'firstName':_0xaf63('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xaf63('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xaf63('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaf63('0x5')](),'updatedAt':Date[_0xaf63('0x5')]()});}db['CmContact']['destroy']({'where':{}})['then'](function(){return db[_0xaf63('0x6')][_0xaf63('0x7')](contacts);})[_0xaf63('0x8')](function(){console[_0xaf63('0x9')](_0xaf63('0xa'),_0xaf63('0xb'));return db[_0xaf63('0xc')][_0xaf63('0xd')]({'where':{}});})[_0xaf63('0x8')](function(){return db['CmHopper'][_0xaf63('0x7')](hopper);})[_0xaf63('0x8')](function(){console[_0xaf63('0x9')](_0xaf63('0xa'),_0xaf63('0xe'));return db[_0xaf63('0x6')]['bulkCreate'](contacts2);})['then'](function(){console[_0xaf63('0x9')](_0xaf63('0xa'),'contacts2');return db[_0xaf63('0xc')][_0xaf63('0x7')](hopper2);})[_0xaf63('0x8')](function(){console[_0xaf63('0x9')](_0xaf63('0xa'),_0xaf63('0xf'));})['catch'](function(_0x143840){console[_0xaf63('0x9')](_0x143840);}); \ No newline at end of file +var _0x8f9b=['@xcally.com','push','now','Biondo','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','hopper2','util','../mysqldb','Innocenzo','innocenzo.biondo'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x8f9b,0xcd));var _0xb8f9=function(_0x565b68,_0x2500e6){_0x565b68=_0x565b68-0x0;var _0x40f4aa=_0x8f9b[_0x565b68];return _0x40f4aa;};'use strict';var util=require(_0xb8f9('0x0'));var db=require(_0xb8f9('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xb8f9('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xb8f9('0x3')+i+_0xb8f9('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb8f9('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xb8f9('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb8f9('0x6')](),'updatedAt':Date[_0xb8f9('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb8f9('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xb8f9('0x7')+i,'phone':0xf879fb460+i,'email':_0xb8f9('0x3')+i+_0xb8f9('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb8f9('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xb8f9('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb8f9('0x6')](),'updatedAt':Date[_0xb8f9('0x6')]()});}db[_0xb8f9('0x8')]['destroy']({'where':{}})[_0xb8f9('0x9')](function(){return db[_0xb8f9('0x8')][_0xb8f9('0xa')](contacts);})[_0xb8f9('0x9')](function(){console[_0xb8f9('0xb')](_0xb8f9('0xc'),_0xb8f9('0xd'));return db[_0xb8f9('0xe')][_0xb8f9('0xf')]({'where':{}});})[_0xb8f9('0x9')](function(){return db[_0xb8f9('0xe')][_0xb8f9('0xa')](hopper);})['then'](function(){console[_0xb8f9('0xb')](_0xb8f9('0xc'),_0xb8f9('0x10'));return db[_0xb8f9('0x8')][_0xb8f9('0xa')](contacts2);})[_0xb8f9('0x9')](function(){console[_0xb8f9('0xb')](_0xb8f9('0xc'),_0xb8f9('0x11'));return db[_0xb8f9('0xe')][_0xb8f9('0xa')](hopper2);})['then'](function(){console[_0xb8f9('0xb')](_0xb8f9('0xc'),_0xb8f9('0x12'));})['catch'](function(_0x231c6d){console[_0xb8f9('0xb')](_0x231c6d);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 4268e11..2aaa021 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeae=['then','add\x20user','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate'];(function(_0x5ac550,_0x25e1dd){var _0x58629c=function(_0x304cd5){while(--_0x304cd5){_0x5ac550['push'](_0x5ac550['shift']());}};_0x58629c(++_0x25e1dd);}(_0xdeae,0x17c));var _0xedea=function(_0x1da9f9,_0x3b96e3){_0x1da9f9=_0x1da9f9-0x0;var _0x3d0bde=_0xdeae[_0x1da9f9];return _0x3d0bde;};'use strict';var util=require(_0xedea('0x0'));var db=require(_0xedea('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xedea('0x2')](_0xedea('0x3'),'agent',i),'fullname':util[_0xedea('0x2')](_0xedea('0x3'),_0xedea('0x4'),i),'email':util['format'](_0xedea('0x5'),_0xedea('0x4'),i),'role':_0xedea('0x4'),'password':'password','internal':0xfa0+i,'type':_0xedea('0x6'),'transport':[_0xedea('0x7'),'ws',_0xedea('0x8')],'disallow':[_0xedea('0x9')],'allow':['ulaw'],'defaultuser':util['format'](_0xedea('0x3'),_0xedea('0x4'),i),'encryption':_0xedea('0xa'),'avpf':_0xedea('0xa'),'force_avp':_0xedea('0xa'),'icesupport':_0xedea('0xa'),'dtlsenable':_0xedea('0xa'),'dtlsverify':'no','dtlscertfile':_0xedea('0xb'),'dtlsprivatekey':_0xedea('0xc'),'dtlssetup':_0xedea('0xd'),'callerid':util[_0xedea('0x2')]('\x22%s\x22\x20<%s>',util[_0xedea('0x2')](_0xedea('0x3'),'agent',i),0xfa0+i)});}db[_0xedea('0xe')][_0xedea('0xf')](users)[_0xedea('0x10')](function(){console['log'](_0xedea('0x11'));})['catch'](function(_0x1c9f7e){console['log'](_0x1c9f7e);}); \ No newline at end of file +var _0xb751=['friend','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','push','format','agent'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xb751,0x1d8));var _0x1b75=function(_0x97a9bb,_0x33fd06){_0x97a9bb=_0x97a9bb-0x0;var _0x4be3ae=_0xb751[_0x97a9bb];return _0x4be3ae;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1b75('0x0')]({'name':util[_0x1b75('0x1')]('%s%s',_0x1b75('0x2'),i),'fullname':util[_0x1b75('0x1')]('%s%s','agent',i),'email':util[_0x1b75('0x1')]('%s%s@xcally.com',_0x1b75('0x2'),i),'role':_0x1b75('0x2'),'password':'password','internal':0xfa0+i,'type':_0x1b75('0x3'),'transport':[_0x1b75('0x4'),'ws',_0x1b75('0x5')],'disallow':[_0x1b75('0x6')],'allow':[_0x1b75('0x7')],'defaultuser':util[_0x1b75('0x1')](_0x1b75('0x8'),_0x1b75('0x2'),i),'encryption':_0x1b75('0x9'),'avpf':_0x1b75('0x9'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x1b75('0x9'),'dtlsverify':'no','dtlscertfile':_0x1b75('0xa'),'dtlsprivatekey':_0x1b75('0xb'),'dtlssetup':_0x1b75('0xc'),'callerid':util[_0x1b75('0x1')](_0x1b75('0xd'),util[_0x1b75('0x1')](_0x1b75('0x8'),_0x1b75('0x2'),i),0xfa0+i)});}db[_0x1b75('0xe')]['bulkCreate'](users)[_0x1b75('0xf')](function(){console[_0x1b75('0x10')](_0x1b75('0x11'));})[_0x1b75('0x12')](function(_0x4de001){console['log'](_0x4de001);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index fae25c9..903f70c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0427=['remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','then','map','resourceId','Campaign','format','%s:queue:%s','length','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','user:%s','voice:inbound','include','push','ChatQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:outbound','VoiceQueue','FaxQueues','FaxQueue','SmsQueue','MailQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','connection','setMaxListeners','address','request'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x0427,0x6c));var _0x7042=function(_0x51d851,_0x3db37a){_0x51d851=_0x51d851-0x0;var _0x13d3ff=_0x0427[_0x51d851];return _0x13d3ff;};'use strict';var _=require(_0x7042('0x0'));var util=require(_0x7042('0x1'));var BPromise=require('bluebird');var db=require(_0x7042('0x2'))['db'];var config=require(_0x7042('0x3'));var queryQueues={'attributes':['id',_0x7042('0x4')],'include':[{'as':_0x7042('0x5'),'model':db[_0x7042('0x6')],'attributes':['id','name',_0x7042('0x7')],'raw':!![],'where':{'role':_0x7042('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7042('0x4')],'where':{'role':_0x7042('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7042('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x7042('0x4')],'where':{'role':_0x7042('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x7042('0xa')],'where':{'type':_0x7042('0xb')}};function getAssociatedResources(_0x1d34ae,_0x4464f1,_0x57fde3){return db[_0x7042('0xc')][_0x7042('0xd')]({'where':{'name':_0x1d34ae,'userProfileId':_0x4464f1},'raw':!![]})['then'](function(_0x5bf9a1){if(_0x5bf9a1){if(_0x5bf9a1[_0x7042('0xe')]){switch(_0x1d34ae){case _0x7042('0xf'):case _0x7042('0x10'):case'FaxQueues':case _0x7042('0x11'):case _0x7042('0x12'):case _0x7042('0x13'):case _0x7042('0x14'):return db[_0x57fde3][_0x7042('0x15')](queryQueues);case _0x7042('0x16'):return db[_0x57fde3][_0x7042('0x15')](queryTelephones);case _0x7042('0x17'):return db[_0x57fde3][_0x7042('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x57fde3][_0x7042('0x15')](queryCampaigns);}}else{return db[_0x7042('0x18')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x5bf9a1['id']},'raw':!![]})[_0x7042('0x19')](function(_0x183358){if(_0x183358){var _0x5be5e4={'where':{'id':_[_0x7042('0x1a')](_0x183358,_0x7042('0x1b'))},'raw':!![]};switch(_0x57fde3){case _0x7042('0x6'):_0x5be5e4['where'][_0x7042('0x7')]=_0x7042('0x9');break;case _0x7042('0x1c'):_0x5be5e4['where'][_0x7042('0xa')]=_0x7042('0xb');break;}return db[_0x57fde3][_0x7042('0x15')](_0x5be5e4);}else{return[];}});}}else{return[];}})[_0x7042('0x19')](function(_0x2eecab){return _0x2eecab;});}function joinOrLeaveQueues(_0x1a7df9,_0x4a4ffa,_0x4c6c9c,_0x50b7fa){_0x1a7df9[_0x4a4ffa](util[_0x7042('0x1d')](_0x7042('0x1e'),_0x4c6c9c,_0x50b7fa[_0x7042('0x4')]));if(_0x50b7fa[_0x7042('0x5')]){for(var _0x30dcae=0x0;_0x30dcae<_0x50b7fa[_0x7042('0x5')][_0x7042('0x1f')];_0x30dcae+=0x1){_0x1a7df9[_0x4a4ffa](util['format']('user:%s',_0x50b7fa['Agents'][_0x30dcae][_0x7042('0x4')]));}}}function joinOrLeave(_0x13bbcf,_0x2d30f3,_0x265850){var _0x529d5a;if(_0x13bbcf[_0x7042('0x20')][_0x7042('0x21')]['id']){db[_0x7042('0x6')]['find']({'attributes':['id','name',_0x7042('0x7'),_0x7042('0x22')],'where':{'id':_0x13bbcf['handshake'][_0x7042('0x21')]['id']},'include':[{'model':db[_0x7042('0x23')],'as':_0x7042('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7042('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7042('0x26')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7042('0x27')],'as':_0x7042('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x7042('0x29')],'as':_0x7042('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x7042('0x2b')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x7042('0x19')](function(_0x3a6704){if(_0x3a6704){_0x529d5a=_0x3a6704;_0x13bbcf[_0x2d30f3](util[_0x7042('0x1d')](_0x7042('0x2c'),_0x3a6704[_0x7042('0x4')]));var _0x5d2136=[];switch(_0x3a6704[_0x7042('0x7')]){case'admin':_0x13bbcf[_0x2d30f3](_0x7042('0x2d'));_0x13bbcf[_0x2d30f3]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x7042('0x2e'))){delete queryQueues[_0x7042('0x2e')];}_0x5d2136[_0x7042('0x2f')](db['VoiceQueue'][_0x7042('0x15')](queryQueues));_0x5d2136[_0x7042('0x2f')](db[_0x7042('0x30')][_0x7042('0x15')](queryQueues));_0x5d2136[_0x7042('0x2f')](db['FaxQueue'][_0x7042('0x15')](queryQueues));_0x5d2136[_0x7042('0x2f')](db['SmsQueue'][_0x7042('0x15')](queryQueues));_0x5d2136[_0x7042('0x2f')](db['MailQueue'][_0x7042('0x15')](queryQueues));_0x5d2136[_0x7042('0x2f')](db[_0x7042('0x31')][_0x7042('0x15')](queryQueues));_0x5d2136[_0x7042('0x2f')](db[_0x7042('0x32')]['findAll'](queryQueues));_0x5d2136[_0x7042('0x2f')](db[_0x7042('0x6')]['findAll'](queryTelephones));_0x5d2136['push'](db[_0x7042('0x33')][_0x7042('0x15')](queryTrunks));_0x5d2136['push'](db['Campaign']['findAll'](queryCampaigns));_0x5d2136[_0x7042('0x2f')](db[_0x7042('0x6')]['findAll'](queryAgents));break;case _0x7042('0x34'):_0x13bbcf[_0x2d30f3](_0x7042('0x2d'));_0x13bbcf[_0x2d30f3](_0x7042('0x35'));_0x5d2136[_0x7042('0x2f')](getAssociatedResources(_0x7042('0xf'),_0x3a6704[_0x7042('0x22')],_0x7042('0x36')));_0x5d2136['push'](getAssociatedResources(_0x7042('0x10'),_0x3a6704['userProfileId'],_0x7042('0x30')));_0x5d2136[_0x7042('0x2f')](getAssociatedResources(_0x7042('0x37'),_0x3a6704['userProfileId'],_0x7042('0x38')));_0x5d2136[_0x7042('0x2f')](getAssociatedResources('SmsQueues',_0x3a6704['userProfileId'],_0x7042('0x39')));_0x5d2136[_0x7042('0x2f')](getAssociatedResources(_0x7042('0x12'),_0x3a6704[_0x7042('0x22')],_0x7042('0x3a')));_0x5d2136[_0x7042('0x2f')](getAssociatedResources(_0x7042('0x13'),_0x3a6704[_0x7042('0x22')],_0x7042('0x31')));_0x5d2136[_0x7042('0x2f')](getAssociatedResources(_0x7042('0x14'),_0x3a6704['userProfileId'],_0x7042('0x32')));_0x5d2136['push'](getAssociatedResources('Telephones',_0x3a6704[_0x7042('0x22')],'User'));_0x5d2136[_0x7042('0x2f')](getAssociatedResources(_0x7042('0x17'),_0x3a6704[_0x7042('0x22')],_0x7042('0x33')));_0x5d2136[_0x7042('0x2f')](getAssociatedResources('IvrCampaigns',_0x3a6704[_0x7042('0x22')],_0x7042('0x1c')));_0x5d2136[_0x7042('0x2f')](db['User'][_0x7042('0x15')](queryAgents));break;case'agent':_0x13bbcf[_0x2d30f3](_0x7042('0x2d'));_0x13bbcf[_0x2d30f3](_0x7042('0x35'));_0x5d2136[_0x7042('0x2f')](_0x3a6704[_0x7042('0x3b')]({'attributes':['id',_0x7042('0x4')]}));_0x5d2136['push'](_0x3a6704['getChatQueues']({'attributes':['id',_0x7042('0x4')]}));_0x5d2136[_0x7042('0x2f')](_0x3a6704[_0x7042('0x3c')]({'attributes':['id',_0x7042('0x4')]}));_0x5d2136[_0x7042('0x2f')](_0x3a6704[_0x7042('0x3d')]({'attributes':['id',_0x7042('0x4')]}));_0x5d2136['push'](_0x3a6704[_0x7042('0x3e')]({'attributes':['id',_0x7042('0x4')]}));_0x5d2136['push'](_0x3a6704['getOpenchannelQueues']({'attributes':['id',_0x7042('0x4')]}));_0x5d2136[_0x7042('0x2f')](_0x3a6704[_0x7042('0x3f')]({'attributes':['id',_0x7042('0x4')]}));break;}return BPromise[_0x7042('0x40')](_0x5d2136);}})[_0x7042('0x19')](function(_0x5f1fb1){if(_0x5f1fb1&&_0x5f1fb1[_0x7042('0x1f')]){for(var _0x4dedfb=0x0;_0x4dedfb<_0x5f1fb1[_0x7042('0x1f')];_0x4dedfb+=0x1){for(var _0xef9be9=0x0;_0xef9be9<_0x5f1fb1[_0x4dedfb][_0x7042('0x1f')];_0xef9be9+=0x1){switch(_0x4dedfb){case 0x0:joinOrLeaveQueues(_0x13bbcf,_0x2d30f3,_0x7042('0x41'),_0x5f1fb1[_0x4dedfb][_0xef9be9]);break;case 0x1:joinOrLeaveQueues(_0x13bbcf,_0x2d30f3,_0x7042('0x42'),_0x5f1fb1[_0x4dedfb][_0xef9be9]);break;case 0x2:joinOrLeaveQueues(_0x13bbcf,_0x2d30f3,_0x7042('0x43'),_0x5f1fb1[_0x4dedfb][_0xef9be9]);break;case 0x3:joinOrLeaveQueues(_0x13bbcf,_0x2d30f3,_0x7042('0x44'),_0x5f1fb1[_0x4dedfb][_0xef9be9]);break;case 0x4:joinOrLeaveQueues(_0x13bbcf,_0x2d30f3,_0x7042('0x45'),_0x5f1fb1[_0x4dedfb][_0xef9be9]);break;case 0x5:joinOrLeaveQueues(_0x13bbcf,_0x2d30f3,_0x7042('0x46'),_0x5f1fb1[_0x4dedfb][_0xef9be9]);break;case 0x6:joinOrLeaveQueues(_0x13bbcf,_0x2d30f3,_0x7042('0x47'),_0x5f1fb1[_0x4dedfb][_0xef9be9]);break;case 0x7:if(_0x529d5a[_0x7042('0x7')]!==_0x7042('0x8'))_0x13bbcf[_0x2d30f3](util[_0x7042('0x1d')]('telephone:%s',_0x5f1fb1[_0x4dedfb][_0xef9be9][_0x7042('0x4')]));break;case 0x8:if(_0x529d5a['role']!=='agent')_0x13bbcf[_0x2d30f3](util[_0x7042('0x1d')](_0x7042('0x48'),_0x5f1fb1[_0x4dedfb][_0xef9be9][_0x7042('0x4')]));break;case 0x9:if(_0x529d5a[_0x7042('0x7')]!=='agent')_0x13bbcf[_0x2d30f3](util[_0x7042('0x1d')]('campaign:%s:%s',_0x5f1fb1[_0x4dedfb][_0xef9be9][_0x7042('0xa')],_0x5f1fb1[_0x4dedfb][_0xef9be9][_0x7042('0x4')]));break;case 0xa:_0x13bbcf[_0x2d30f3](util[_0x7042('0x1d')]('user:%s',_0x5f1fb1[_0x4dedfb][_0xef9be9][_0x7042('0x4')]));break;}}}}})['then'](function(){if(_0x2d30f3===_0x7042('0x49')){var _0x54d67c=_['map'](_0x529d5a[_0x7042('0x24')],'id');return _0x529d5a[_0x7042('0x4a')](_0x54d67c)[_0x7042('0x19')](function(){for(var _0x234018=0x0;_0x234018<_0x54d67c['length'];_0x234018+=0x1){_0x265850[_0x7042('0x4b')](_0x7042('0x4c'),{'ChatInteractionId':Number(_0x54d67c[_0x234018]),'UserId':Number(_0x529d5a['id'])});}});}})[_0x7042('0x19')](function(){if(_0x2d30f3===_0x7042('0x49')){var _0x5afd36=_[_0x7042('0x1a')](_0x529d5a[_0x7042('0x4d')],'id');return _0x529d5a[_0x7042('0x4e')](_0x5afd36)[_0x7042('0x19')](function(){for(var _0x8bca56=0x0;_0x8bca56<_0x5afd36[_0x7042('0x1f')];_0x8bca56+=0x1){_0x265850[_0x7042('0x4b')](_0x7042('0x4f'),{'MailInteractionId':Number(_0x5afd36[_0x8bca56]),'UserId':Number(_0x529d5a['id'])});}});}})['then'](function(){if(_0x2d30f3===_0x7042('0x49')){var _0xe1c6ee=_[_0x7042('0x1a')](_0x529d5a[_0x7042('0x50')],'id');return _0x529d5a['removeFaxInteractions'](_0xe1c6ee)[_0x7042('0x19')](function(){for(var _0x12824a=0x0;_0x12824a<_0xe1c6ee[_0x7042('0x1f')];_0x12824a+=0x1){_0x265850['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xe1c6ee[_0x12824a]),'UserId':Number(_0x529d5a['id'])});}});}})[_0x7042('0x19')](function(){if(_0x2d30f3===_0x7042('0x49')){var _0x33ba46=_['map'](_0x529d5a[_0x7042('0x28')],'id');return _0x529d5a['removeSmsInteractions'](_0x33ba46)['then'](function(){for(var _0xdd7d78=0x0;_0xdd7d78<_0x33ba46[_0x7042('0x1f')];_0xdd7d78+=0x1){_0x265850[_0x7042('0x4b')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x33ba46[_0xdd7d78]),'UserId':Number(_0x529d5a['id'])});}});}})[_0x7042('0x19')](function(){if(_0x2d30f3===_0x7042('0x49')){var _0x2c6c07=_[_0x7042('0x1a')](_0x529d5a[_0x7042('0x2a')],'id');return _0x529d5a[_0x7042('0x51')](_0x2c6c07)[_0x7042('0x19')](function(){for(var _0x24f150=0x0;_0x24f150<_0x2c6c07['length'];_0x24f150+=0x1){_0x265850['emit'](_0x7042('0x52'),{'OpenchannelInteractionId':Number(_0x2c6c07[_0x24f150]),'UserId':Number(_0x529d5a['id'])});}});}})['then'](function(){if(_0x2d30f3===_0x7042('0x49')){var _0x531007=_[_0x7042('0x1a')](_0x529d5a[_0x7042('0x53')],'id');return _0x529d5a[_0x7042('0x54')](_0x531007)[_0x7042('0x19')](function(){for(var _0x2f7f7b=0x0;_0x2f7f7b<_0x531007[_0x7042('0x1f')];_0x2f7f7b+=0x1){_0x265850[_0x7042('0x4b')](_0x7042('0x55'),{'WhatsappInteractionId':Number(_0x531007[_0x2f7f7b]),'UserId':Number(_0x529d5a['id'])});}});}})['catch'](function(_0x1ea494){_0x13bbcf['log'](_0x1ea494);});}}function onDisconnect(_0x35d0f6,_0x19bdd8){joinOrLeave(_0x35d0f6,_0x7042('0x49'),_0x19bdd8);}function onConnect(_0x40d34b){joinOrLeave(_0x40d34b,_0x7042('0x56'));}exports[_0x7042('0x57')]=function(_0x5c5825){_0x5c5825['on'](_0x7042('0x58'),function(_0x2245b5){_0x2245b5[_0x7042('0x59')](0x0);_0x2245b5[_0x7042('0x5a')]=_0x2245b5[_0x7042('0x5b')]['connection'][_0x7042('0x5c')]+':'+_0x2245b5[_0x7042('0x5b')]['connection'][_0x7042('0x5d')];_0x2245b5[_0x7042('0x5e')]=new Date();_0x2245b5[_0x7042('0x5f')]=function(_0x145fdc){console['log'](_0x7042('0x60')+_0x2245b5[_0x7042('0x61')][_0x7042('0x4')]+'['+_0x2245b5[_0x7042('0x5a')]+']',_0x145fdc);};_0x2245b5['on']('disconnect',function(){onDisconnect(_0x2245b5,_0x5c5825);_0x2245b5[_0x7042('0x5f')](_0x7042('0x62'));});onConnect(_0x2245b5);_0x2245b5[_0x7042('0x5f')](_0x7042('0x63'));});}; \ No newline at end of file +var _0x8caf=['findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','where','Campaign','format','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','role','admin','voice:inbound','voice:outbound','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','Trunk','user','ChatQueue','OpenchannelQueue','WhatsappQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','map','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','agent','type','ivr','UserProfileSection','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues'];(function(_0x3e4c7d,_0x45261f){var _0x551ea6=function(_0x37e5b5){while(--_0x37e5b5){_0x3e4c7d['push'](_0x3e4c7d['shift']());}};_0x551ea6(++_0x45261f);}(_0x8caf,0x16f));var _0xf8ca=function(_0xee4c5f,_0x1bf72d){_0xee4c5f=_0xee4c5f-0x0;var _0x5accbc=_0x8caf[_0xee4c5f];return _0x5accbc;};'use strict';var _=require(_0xf8ca('0x0'));var util=require(_0xf8ca('0x1'));var BPromise=require('bluebird');var db=require(_0xf8ca('0x2'))['db'];var config=require(_0xf8ca('0x3'));var queryQueues={'attributes':['id',_0xf8ca('0x4')],'include':[{'as':_0xf8ca('0x5'),'model':db[_0xf8ca('0x6')],'attributes':['id',_0xf8ca('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xf8ca('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf8ca('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf8ca('0x4'),_0xf8ca('0x8')],'where':{'type':_0xf8ca('0x9')}};function getAssociatedResources(_0x565270,_0x13c556,_0x288464){return db[_0xf8ca('0xa')]['findOne']({'where':{'name':_0x565270,'userProfileId':_0x13c556},'raw':!![]})['then'](function(_0x46465e){if(_0x46465e){if(_0x46465e['autoAssociation']){switch(_0x565270){case _0xf8ca('0xb'):case _0xf8ca('0xc'):case _0xf8ca('0xd'):case _0xf8ca('0xe'):case'MailQueues':case _0xf8ca('0xf'):case _0xf8ca('0x10'):return db[_0x288464][_0xf8ca('0x11')](queryQueues);case _0xf8ca('0x12'):return db[_0x288464]['findAll'](queryTelephones);case _0xf8ca('0x13'):return db[_0x288464][_0xf8ca('0x11')](queryTrunks);case _0xf8ca('0x14'):return db[_0x288464][_0xf8ca('0x11')](queryCampaigns);}}else{return db[_0xf8ca('0x15')]['findAll']({'attributes':[_0xf8ca('0x16')],'where':{'sectionId':_0x46465e['id']},'raw':!![]})[_0xf8ca('0x17')](function(_0x5ab64a){if(_0x5ab64a){var _0x5891ac={'where':{'id':_['map'](_0x5ab64a,'resourceId')},'raw':!![]};switch(_0x288464){case _0xf8ca('0x6'):_0x5891ac[_0xf8ca('0x18')]['role']='telephone';break;case _0xf8ca('0x19'):_0x5891ac['where'][_0xf8ca('0x8')]=_0xf8ca('0x9');break;}return db[_0x288464]['findAll'](_0x5891ac);}else{return[];}});}}else{return[];}})[_0xf8ca('0x17')](function(_0x33ed5a){return _0x33ed5a;});}function joinOrLeaveQueues(_0x2f6a1e,_0x58968c,_0x5aa261,_0x2ed7be){_0x2f6a1e[_0x58968c](util[_0xf8ca('0x1a')]('%s:queue:%s',_0x5aa261,_0x2ed7be[_0xf8ca('0x4')]));if(_0x2ed7be[_0xf8ca('0x5')]){for(var _0x6ba561=0x0;_0x6ba561<_0x2ed7be[_0xf8ca('0x5')][_0xf8ca('0x1b')];_0x6ba561+=0x1){_0x2f6a1e[_0x58968c](util[_0xf8ca('0x1a')](_0xf8ca('0x1c'),_0x2ed7be[_0xf8ca('0x5')][_0x6ba561][_0xf8ca('0x4')]));}}}function joinOrLeave(_0x28f410,_0xe83772,_0x303ecd){var _0x148f1d;if(_0x28f410[_0xf8ca('0x1d')][_0xf8ca('0x1e')]['id']){db[_0xf8ca('0x6')][_0xf8ca('0x1f')]({'attributes':['id',_0xf8ca('0x4'),'role',_0xf8ca('0x20')],'where':{'id':_0x28f410[_0xf8ca('0x1d')][_0xf8ca('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xf8ca('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xf8ca('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8ca('0x23')],'as':_0xf8ca('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8ca('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf8ca('0x26')],'as':_0xf8ca('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8ca('0x28')],'as':_0xf8ca('0x29'),'attributes':['id'],'raw':!![]}]})[_0xf8ca('0x17')](function(_0x462f13){if(_0x462f13){_0x148f1d=_0x462f13;_0x28f410[_0xe83772](util[_0xf8ca('0x1a')](_0xf8ca('0x1c'),_0x462f13['name']));var _0x4106c8=[];switch(_0x462f13[_0xf8ca('0x2a')]){case _0xf8ca('0x2b'):_0x28f410[_0xe83772](_0xf8ca('0x2c'));_0x28f410[_0xe83772](_0xf8ca('0x2d'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x2f')][_0xf8ca('0x11')](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db['ChatQueue'][_0xf8ca('0x11')](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x30')]['findAll'](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x31')][_0xf8ca('0x11')](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x32')]['findAll'](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db['OpenchannelQueue'][_0xf8ca('0x11')](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db['WhatsappQueue']['findAll'](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x6')]['findAll'](queryTelephones));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x33')]['findAll'](queryTrunks));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x19')]['findAll'](queryCampaigns));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x6')]['findAll'](queryAgents));break;case _0xf8ca('0x34'):_0x28f410[_0xe83772](_0xf8ca('0x2c'));_0x28f410[_0xe83772](_0xf8ca('0x2d'));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0xb'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x2f')));_0x4106c8['push'](getAssociatedResources('ChatQueues',_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x35')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0xd'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x30')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0xe'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x31')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources('MailQueues',_0x462f13['userProfileId'],'MailQueue'));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0xf'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x36')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0x10'),_0x462f13['userProfileId'],_0xf8ca('0x37')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0x12'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x6')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0x13'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x33')));_0x4106c8['push'](getAssociatedResources('IvrCampaigns',_0x462f13['userProfileId'],_0xf8ca('0x19')));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x6')][_0xf8ca('0x11')](queryAgents));break;case _0xf8ca('0x7'):_0x28f410[_0xe83772](_0xf8ca('0x2c'));_0x28f410[_0xe83772](_0xf8ca('0x2d'));_0x4106c8[_0xf8ca('0x2e')](_0x462f13[_0xf8ca('0x38')]({'attributes':['id','name']}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13['getChatQueues']({'attributes':['id',_0xf8ca('0x4')]}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13[_0xf8ca('0x39')]({'attributes':['id',_0xf8ca('0x4')]}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13[_0xf8ca('0x3a')]({'attributes':['id','name']}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13['getMailQueues']({'attributes':['id','name']}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13[_0xf8ca('0x3b')]({'attributes':['id',_0xf8ca('0x4')]}));_0x4106c8['push'](_0x462f13[_0xf8ca('0x3c')]({'attributes':['id',_0xf8ca('0x4')]}));break;}return BPromise[_0xf8ca('0x3d')](_0x4106c8);}})[_0xf8ca('0x17')](function(_0x1bcbea){if(_0x1bcbea&&_0x1bcbea[_0xf8ca('0x1b')]){for(var _0x5af505=0x0;_0x5af505<_0x1bcbea[_0xf8ca('0x1b')];_0x5af505+=0x1){for(var _0x3fa4ee=0x0;_0x3fa4ee<_0x1bcbea[_0x5af505][_0xf8ca('0x1b')];_0x3fa4ee+=0x1){switch(_0x5af505){case 0x0:joinOrLeaveQueues(_0x28f410,_0xe83772,'voice',_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x1:joinOrLeaveQueues(_0x28f410,_0xe83772,_0xf8ca('0x3e'),_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x2:joinOrLeaveQueues(_0x28f410,_0xe83772,_0xf8ca('0x3f'),_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x3:joinOrLeaveQueues(_0x28f410,_0xe83772,'sms',_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x4:joinOrLeaveQueues(_0x28f410,_0xe83772,_0xf8ca('0x40'),_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x5:joinOrLeaveQueues(_0x28f410,_0xe83772,_0xf8ca('0x41'),_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x6:joinOrLeaveQueues(_0x28f410,_0xe83772,'whatsapp',_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x7:if(_0x148f1d['role']!==_0xf8ca('0x7'))_0x28f410[_0xe83772](util[_0xf8ca('0x1a')](_0xf8ca('0x42'),_0x1bcbea[_0x5af505][_0x3fa4ee][_0xf8ca('0x4')]));break;case 0x8:if(_0x148f1d[_0xf8ca('0x2a')]!=='agent')_0x28f410[_0xe83772](util[_0xf8ca('0x1a')](_0xf8ca('0x43'),_0x1bcbea[_0x5af505][_0x3fa4ee][_0xf8ca('0x4')]));break;case 0x9:if(_0x148f1d['role']!==_0xf8ca('0x7'))_0x28f410[_0xe83772](util[_0xf8ca('0x1a')](_0xf8ca('0x44'),_0x1bcbea[_0x5af505][_0x3fa4ee]['type'],_0x1bcbea[_0x5af505][_0x3fa4ee][_0xf8ca('0x4')]));break;case 0xa:_0x28f410[_0xe83772](util[_0xf8ca('0x1a')]('user:%s',_0x1bcbea[_0x5af505][_0x3fa4ee][_0xf8ca('0x4')]));break;}}}}})[_0xf8ca('0x17')](function(){if(_0xe83772===_0xf8ca('0x45')){var _0x4cc8d5=_['map'](_0x148f1d[_0xf8ca('0x21')],'id');return _0x148f1d[_0xf8ca('0x46')](_0x4cc8d5)['then'](function(){for(var _0x29a1ca=0x0;_0x29a1ca<_0x4cc8d5[_0xf8ca('0x1b')];_0x29a1ca+=0x1){_0x303ecd[_0xf8ca('0x47')](_0xf8ca('0x48'),{'ChatInteractionId':Number(_0x4cc8d5[_0x29a1ca]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x17')](function(){if(_0xe83772==='leave'){var _0x25f273=_[_0xf8ca('0x49')](_0x148f1d[_0xf8ca('0x22')],'id');return _0x148f1d[_0xf8ca('0x4a')](_0x25f273)['then'](function(){for(var _0x4502dc=0x0;_0x4502dc<_0x25f273[_0xf8ca('0x1b')];_0x4502dc+=0x1){_0x303ecd[_0xf8ca('0x47')](_0xf8ca('0x4b'),{'MailInteractionId':Number(_0x25f273[_0x4502dc]),'UserId':Number(_0x148f1d['id'])});}});}})['then'](function(){if(_0xe83772===_0xf8ca('0x45')){var _0x325546=_[_0xf8ca('0x49')](_0x148f1d[_0xf8ca('0x24')],'id');return _0x148f1d[_0xf8ca('0x4c')](_0x325546)['then'](function(){for(var _0x104533=0x0;_0x104533<_0x325546[_0xf8ca('0x1b')];_0x104533+=0x1){_0x303ecd['emit'](_0xf8ca('0x4d'),{'FaxInteractionId':Number(_0x325546[_0x104533]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x17')](function(){if(_0xe83772==='leave'){var _0x1fdb2d=_['map'](_0x148f1d['SmsInteractions'],'id');return _0x148f1d[_0xf8ca('0x4e')](_0x1fdb2d)['then'](function(){for(var _0x2a45f3=0x0;_0x2a45f3<_0x1fdb2d[_0xf8ca('0x1b')];_0x2a45f3+=0x1){_0x303ecd['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1fdb2d[_0x2a45f3]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x17')](function(){if(_0xe83772===_0xf8ca('0x45')){var _0x5db214=_[_0xf8ca('0x49')](_0x148f1d[_0xf8ca('0x27')],'id');return _0x148f1d[_0xf8ca('0x4f')](_0x5db214)[_0xf8ca('0x17')](function(){for(var _0x442f3b=0x0;_0x442f3b<_0x5db214[_0xf8ca('0x1b')];_0x442f3b+=0x1){_0x303ecd[_0xf8ca('0x47')](_0xf8ca('0x50'),{'OpenchannelInteractionId':Number(_0x5db214[_0x442f3b]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x17')](function(){if(_0xe83772==='leave'){var _0xa37d07=_[_0xf8ca('0x49')](_0x148f1d[_0xf8ca('0x29')],'id');return _0x148f1d[_0xf8ca('0x51')](_0xa37d07)['then'](function(){for(var _0x4648fb=0x0;_0x4648fb<_0xa37d07[_0xf8ca('0x1b')];_0x4648fb+=0x1){_0x303ecd[_0xf8ca('0x47')](_0xf8ca('0x52'),{'WhatsappInteractionId':Number(_0xa37d07[_0x4648fb]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x53')](function(_0x4640a4){_0x28f410[_0xf8ca('0x54')](_0x4640a4);});}}function onDisconnect(_0x38c1b1,_0x1f29e9){joinOrLeave(_0x38c1b1,_0xf8ca('0x45'),_0x1f29e9);}function onConnect(_0x5759ca){joinOrLeave(_0x5759ca,'join');}exports[_0xf8ca('0x55')]=function(_0x9eec49){_0x9eec49['on'](_0xf8ca('0x56'),function(_0x3992b6){_0x3992b6['setMaxListeners'](0x0);_0x3992b6[_0xf8ca('0x57')]=_0x3992b6[_0xf8ca('0x58')][_0xf8ca('0x56')][_0xf8ca('0x59')]+':'+_0x3992b6['request'][_0xf8ca('0x56')][_0xf8ca('0x5a')];_0x3992b6['connectedAt']=new Date();_0x3992b6[_0xf8ca('0x54')]=function(_0x3a12c2){console[_0xf8ca('0x54')](_0xf8ca('0x5b')+_0x3992b6[_0xf8ca('0x5c')][_0xf8ca('0x4')]+'['+_0x3992b6['address']+']',_0x3a12c2);};_0x3992b6['on'](_0xf8ca('0x5d'),function(){onDisconnect(_0x3992b6,_0x9eec49);_0x3992b6['log'](_0xf8ca('0x5e'));});onConnect(_0x3992b6);_0x3992b6[_0xf8ca('0x54')](_0xf8ca('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 485830c..b292d02 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 _0xae7c=['changed','closed','substatus','interface','AfterUpdate','User','find','internal','default','hasOwnProperty','model','hook','callback','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','afterCreate','ChatInteraction','afterUpdate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','closedinteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','catch','get','motionChannel','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','format','SIP/%s','name','channel','outgoingmessage','AfterCreateMessage','event','resolve','ContactId','contact','agent','AfterCreate'];(function(_0x578f28,_0x250e1f){var _0x177931=function(_0x49a162){while(--_0x49a162){_0x578f28['push'](_0x578f28['shift']());}};_0x177931(++_0x250e1f);}(_0xae7c,0x9a));var _0xcae7=function(_0x55fc9b,_0x501f18){_0x55fc9b=_0x55fc9b-0x0;var _0x36b0e1=_0xae7c[_0x55fc9b];return _0x36b0e1;};'use strict';var util=require(_0xcae7('0x0'));var db=require(_0xcae7('0x1'))['db'];var jayson=require(_0xcae7('0x2'));var logger=require(_0xcae7('0x3'))(_0xcae7('0x4'));var client=jayson[_0xcae7('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0xcae7('0x6'),'model':'ChatInteraction','event':_0xcae7('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xcae7('0x6'),'model':_0xcae7('0x8'),'event':_0xcae7('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xcae7('0x6'),'model':'ChatMessage','event':_0xcae7('0x7'),'condition':_0xcae7('0xa'),'callback':afterCreateMessage},{'channel':_0xcae7('0x6'),'model':_0xcae7('0xb'),'event':_0xcae7('0x7'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xcae7('0xc'),'model':_0xcae7('0xd'),'event':_0xcae7('0x7'),'condition':_0xcae7('0xe'),'callback':afterCreate},{'channel':_0xcae7('0xc'),'model':_0xcae7('0xd'),'event':_0xcae7('0x9'),'condition':_0xcae7('0xf'),'callback':afterUpdate},{'channel':'Sms','model':_0xcae7('0x10'),'event':_0xcae7('0x7'),'condition':_0xcae7('0xa'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xcae7('0x11'),'event':_0xcae7('0x7'),'condition':_0xcae7('0xe'),'callback':afterCreate},{'channel':_0xcae7('0x12'),'model':'WhatsappInteraction','event':_0xcae7('0x9'),'condition':_0xcae7('0xf'),'callback':afterUpdate},{'channel':_0xcae7('0x12'),'model':_0xcae7('0x13'),'event':_0xcae7('0x7'),'condition':_0xcae7('0xa'),'callback':afterCreateMessage},{'channel':_0xcae7('0x14'),'model':'FaxInteraction','event':_0xcae7('0x7'),'condition':_0xcae7('0xe'),'callback':afterCreate},{'channel':_0xcae7('0x14'),'model':_0xcae7('0x15'),'event':_0xcae7('0x9'),'condition':_0xcae7('0xf'),'callback':afterUpdate},{'channel':_0xcae7('0x14'),'model':_0xcae7('0x16'),'event':_0xcae7('0x7'),'condition':_0xcae7('0xa'),'callback':afterCreateMessage},{'channel':_0xcae7('0x17'),'model':_0xcae7('0x18'),'event':_0xcae7('0x7'),'condition':_0xcae7('0xe'),'callback':afterCreate},{'channel':'Mail','model':_0xcae7('0x18'),'event':_0xcae7('0x9'),'condition':_0xcae7('0xf'),'callback':afterUpdate},{'channel':_0xcae7('0x17'),'model':'MailMessage','event':'afterCreate','condition':_0xcae7('0xa'),'callback':afterCreateMessage},{'channel':_0xcae7('0x19'),'model':_0xcae7('0x1a'),'event':_0xcae7('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xcae7('0x19'),'model':_0xcae7('0x1a'),'event':_0xcae7('0x9'),'condition':_0xcae7('0xf'),'callback':afterUpdate},{'channel':_0xcae7('0x19'),'model':_0xcae7('0x1b'),'event':'afterCreate','condition':_0xcae7('0xa'),'callback':afterCreateMessage}];function request(_0x1f4d52){return client[_0xcae7('0x1c')](_0xcae7('0x1d'),_0x1f4d52)[_0xcae7('0x1e')](function(_0x1e9200){logger['info'](_0xcae7('0x1f'),_0xcae7('0x1d'),_0x1e9200);if(_0x1e9200[_0xcae7('0x20')]){if(_0x1e9200[_0xcae7('0x20')]['code']===0x1f4){logger[_0xcae7('0x20')](_0xcae7('0x1f'),'EventManager',_0x1e9200[_0xcae7('0x20')]);}}})[_0xcae7('0x21')](function(_0x57ae26){logger[_0xcae7('0x20')](_0xcae7('0x1f'),_0xcae7('0x1d'),_0x57ae26);});}function afterCreateMessage(_0x24c5a4){return function(_0x1d531f){_0x1d531f=_0x1d531f[_0xcae7('0x22')]({'plain':!![]});_0x1d531f['channel']=_0x24c5a4;_0x1d531f[_0xcae7('0x23')]=_0x24c5a4;_0x1d531f['event']=_0x1d531f['direction'];Promise['resolve']()[_0xcae7('0x1e')](function(){if(typeof _0x1d531f['ContactId']===_0xcae7('0x24'))return null;var _0x5ac6d4=_0xcae7('0x25')+_0x1d531f['ContactId'];return db[_0xcae7('0x26')][_0xcae7('0x27')](_0x5ac6d4,{'type':db[_0xcae7('0x28')][_0xcae7('0x29')][_0xcae7('0x2a')],'raw':!![]});})[_0xcae7('0x1e')](function(_0x513b79){if(_0x513b79){_0x1d531f['contact']=_0x513b79[0x0];}if(typeof _0x1d531f[_0xcae7('0x2b')]==='undefined')return;return getAgent(_0x1d531f['UserId']);})[_0xcae7('0x1e')](function(_0x4877d9){if(_0x4877d9){_0x1d531f['interface']=util[_0xcae7('0x2c')](_0xcae7('0x2d'),_0x4877d9[_0xcae7('0x2e')]);_0x1d531f['agent']=_0x4877d9;_0x1d531f[_0xcae7('0x2f')]=_0x24c5a4;return request({'event':'incomingmessage','message':_0x1d531f});}else{return request({'event':_0xcae7('0x30'),'message':_0x1d531f});}})[_0xcae7('0x21')](function(_0x40c0c8){logger[_0xcae7('0x20')]('Trigger,\x20%s',_0xcae7('0x31'),_0x40c0c8);});};}function afterCreateOfflineMessage(_0x166d43){return function(_0x19bdf2){_0x19bdf2=_0x19bdf2['get']({'plain':!![]});_0x19bdf2[_0xcae7('0x2f')]=_0x166d43;_0x19bdf2['motionChannel']=_0x166d43;_0x19bdf2[_0xcae7('0x32')]='offlineMessage';return request({'event':_0x19bdf2[_0xcae7('0x32')],'message':_0x19bdf2});};}function afterCreate(_0x2334ae,_0x1dce7c){return function(_0x47b66c){_0x47b66c=_0x47b66c[_0xcae7('0x22')]({'plain':!![]});_0x47b66c[_0xcae7('0x2f')]=_0x2334ae;_0x47b66c['motionChannel']=_0x2334ae;_0x47b66c[_0xcae7('0x32')]='opened';Promise[_0xcae7('0x33')]()[_0xcae7('0x1e')](function(){var _0x192bc4=_0xcae7('0x25')+_0x47b66c[_0xcae7('0x34')];return db['sequelize']['query'](_0x192bc4,{'type':db['Sequelize']['QueryTypes'][_0xcae7('0x2a')],'raw':!![]});})['then'](function(_0xb5304e){if(_0xb5304e){_0x47b66c[_0xcae7('0x35')]=_0xb5304e[0x0];}if(typeof _0x47b66c[_0xcae7('0x2b')]===_0xcae7('0x24'))return;return getAgent(_0x47b66c['UserId']);})[_0xcae7('0x1e')](function(_0x4747e8){if(_0x4747e8){_0x47b66c['interface']=util[_0xcae7('0x2c')](_0xcae7('0x2d'),_0x4747e8[_0xcae7('0x2e')]);_0x47b66c[_0xcae7('0x36')]=_0x4747e8;}return request({'event':_0x1dce7c,'message':_0x47b66c});})[_0xcae7('0x21')](function(_0x27996d){logger[_0xcae7('0x20')](_0xcae7('0x1f'),_0xcae7('0x37'),_0x27996d);});};}function afterUpdate(_0x533f75){return function(_0xfdc090){var _0x28f705=_0xfdc090[_0xcae7('0x38')](_0xcae7('0x39'))&&_0xfdc090[_0xcae7('0x39')];var _0xdd26fb=_0xfdc090[_0xcae7('0x38')](_0xcae7('0x3a'));if(_0x28f705||_0xdd26fb){var _0x3922ec=_0x28f705?_0xcae7('0xf'):_0xcae7('0x3a');var _0x58eb61=_0xfdc090['get']({'plain':!![]});_0x58eb61[_0xcae7('0x2f')]=_0x533f75;_0x58eb61['motionChannel']=_0x533f75;_0x58eb61['event']=_0x28f705?_0xcae7('0x39'):'substatus';var _0xda66dd=_0xcae7('0x25')+_0x58eb61[_0xcae7('0x34')];return db[_0xcae7('0x26')][_0xcae7('0x27')](_0xda66dd,{'type':db[_0xcae7('0x28')][_0xcae7('0x29')]['SELECT'],'raw':!![]})[_0xcae7('0x1e')](function(_0x3ffcc4){if(_0x3ffcc4){_0x58eb61[_0xcae7('0x35')]=_0x3ffcc4[0x0];}if(typeof _0x58eb61[_0xcae7('0x2b')]==='undefined')return;return getAgent(_0x58eb61['UserId']);})[_0xcae7('0x1e')](function(_0x2ce699){if(_0x2ce699){_0x58eb61[_0xcae7('0x3b')]=util[_0xcae7('0x2c')](_0xcae7('0x2d'),_0x2ce699['name']);_0x58eb61['agent']=_0x2ce699;}return request({'event':_0x3922ec,'message':_0x58eb61});})[_0xcae7('0x21')](function(_0x5deeb6){logger[_0xcae7('0x20')](_0xcae7('0x1f'),_0xcae7('0x3c'),_0x5deeb6);});}};}function getAgent(_0x54f59b){return db[_0xcae7('0x3d')][_0xcae7('0x3e')]({'where':{'id':_0x54f59b},'attributes':['id',_0xcae7('0x2e'),'fullname','email',_0xcae7('0x3f')],'raw':!![]})['then'](function(_0x95ba15){return _0x95ba15;});}exports[_0xcae7('0x40')]=function(){for(var _0x22ed37=0x0;_0x22ed37=_0x6ff8af[_0x3a6c('0x14')]){throw Error(_0x3a6c('0x15'));}_0xadf484(_0x1e713b);})['catch'](function(_0x263fb1){_0x4f2f92(_0x263fb1);});});}; \ No newline at end of file +var _0xa024=['toLowerCase','includes','blockedAt','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','getChannels'];(function(_0x237a14,_0x475566){var _0x327a1e=function(_0x40c24b){while(--_0x40c24b){_0x237a14['push'](_0x237a14['shift']());}};_0x327a1e(++_0x475566);}(_0xa024,0x1ae));var _0x4a02=function(_0x12e315,_0x2301c9){_0x12e315=_0x12e315-0x0;var _0x2ddba4=_0xa024[_0x12e315];return _0x2ddba4;};'use strict';var _=require('lodash');var BPromise=require(_0x4a02('0x0'));var db=require(_0x4a02('0x1'))['db'];var util=require(_0x4a02('0x2'));var channels=[_0x4a02('0x3'),_0x4a02('0x4'),_0x4a02('0x5'),_0x4a02('0x6'),_0x4a02('0x7'),_0x4a02('0x8'),'openchannel'];exports[_0x4a02('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x50cf63){_0x50cf63=_0x50cf63[_0x4a02('0xa')]();return _[_0x4a02('0xb')](channels,_0x50cf63);};exports['clearBlockUser']=function(_0x1fe018,_0x40a741,_0x16d7a8,_0x4a48f0){var _0x190697={'loginAttempts':_0x40a741,'blocked':_0x16d7a8};if(!_['isUndefined'](_0x4a48f0)){_0x190697[_0x4a02('0xc')]=_0x4a48f0;}return _0x1fe018['updateAttributes'](_0x190697);};exports[_0x4a02('0xd')]=function(_0x576380){return new BPromise(function(_0x4c7ff0,_0x4ab9f1){var _0x226844=0x0;if(_0x576380[_0x4a02('0xe')]!==_0x4a02('0xf')){_0x4c7ff0(_0x576380);}db[_0x4a02('0x10')][_0x4a02('0x11')]({'where':{'role':_0x4a02('0xf'),'online':!![],'id':{'$ne':_0x576380['id']}}})[_0x4a02('0x12')](function(_0x4f4964){_0x226844=_0x4f4964;return util['getLicense']();})[_0x4a02('0x12')](function(_0x27884c){if(_0x27884c&&_0x27884c[_0x4a02('0x13')]&&_0x226844>=_0x27884c[_0x4a02('0x13')]){throw Error(_0x4a02('0x14'));}_0x4c7ff0(_0x576380);})[_0x4a02('0x15')](function(_0x2482ce){_0x4ab9f1(_0x2482ce);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 63ebf38..1512622 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x244b=['code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','stack','send','exports','util','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval'];(function(_0x224ded,_0x1b2757){var _0x3f2c61=function(_0xb06dea){while(--_0xb06dea){_0x224ded['push'](_0x224ded['shift']());}};_0x3f2c61(++_0x1b2757);}(_0x244b,0x169));var _0xb244=function(_0x219ac7,_0x548dec){_0x219ac7=_0x219ac7-0x0;var _0x5964da=_0x244b[_0x219ac7];return _0x5964da;};'use strict';var util=require(_0xb244('0x0'));var logger=require('../config/logger')(_0xb244('0x1'));var APIError=function(_0x442993,_0x3f9db9){this[_0xb244('0x2')]=_0x442993||_0xb244('0x3');this[_0xb244('0x4')]=_0x3f9db9||_0xb244('0x5');util[_0xb244('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3fdb25){this[_0xb244('0x2')]=_0x3fdb25||_0xb244('0x7');this[_0xb244('0x4')]=_0xb244('0x7');util[_0xb244('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x46b17d){this[_0xb244('0x2')]=_0x46b17d||_0xb244('0x8');this[_0xb244('0x4')]=_0xb244('0x8');util[_0xb244('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x3bed5d){this[_0xb244('0x2')]=_0x3bed5d||_0xb244('0x9');this[_0xb244('0x4')]=_0xb244('0xa');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x5f09ca){this[_0xb244('0x2')]=_0x5f09ca||_0xb244('0xb');this[_0xb244('0x4')]=_0xb244('0xc');this[_0xb244('0xd')]=0x193;this[_0xb244('0xe')]={'type':_0xb244('0xf')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x5a54fa){this[_0xb244('0x2')]=_0x5a54fa||_0xb244('0x10');this[_0xb244('0x4')]=_0xb244('0x11');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x3c9276){switch(_0x3c9276){case _0xb244('0x7'):return 0x190;case'Forbidden',_0xb244('0xc'):return 0x193;case _0xb244('0xa'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3548f3){if(_0x3548f3===_0xb244('0xc'))return _0x3548f3;return null;}function handleError(_0x3a5c89){return function(_0x16d8fe){logger[_0xb244('0x12')](_0x16d8fe[_0xb244('0x13')]);var _0xb15c1f=getStatusCode(_0x16d8fe['name']);var _0x359412=getCustomStatusMessage(_0x16d8fe[_0xb244('0x4')]);if(_0x16d8fe[_0xb244('0x4')]){delete _0x16d8fe[_0xb244('0x4')];}if(_0x359412){_0x3a5c89['statusMessage']=_0x359412;}return _0x3a5c89['status'](_0xb15c1f)[_0xb244('0x14')](_0x16d8fe);};}module[_0xb244('0x15')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xd9b4=['Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Conflict','error','stack','status','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd9b4,0x88));var _0x4d9b=function(_0x5dd721,_0x12d33c){_0x5dd721=_0x5dd721-0x0;var _0x592748=_0xd9b4[_0x5dd721];return _0x592748;};'use strict';var util=require(_0x4d9b('0x0'));var logger=require(_0x4d9b('0x1'))(_0x4d9b('0x2'));var APIError=function(_0x3b6509,_0x2fcbe7){this[_0x4d9b('0x3')]=_0x3b6509||'Internal\x20Server\x20Error';this[_0x4d9b('0x4')]=_0x2fcbe7||_0x4d9b('0x5');util[_0x4d9b('0x6')](APIError,Error);};var APIBadRequestError=function(_0x99405a){this[_0x4d9b('0x3')]=_0x99405a||'Bad\x20Request';this[_0x4d9b('0x4')]=_0x4d9b('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x175f12){this[_0x4d9b('0x3')]=_0x175f12||_0x4d9b('0x8');this[_0x4d9b('0x4')]=_0x4d9b('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x1b92a5){this[_0x4d9b('0x3')]=_0x1b92a5||_0x4d9b('0x9');this[_0x4d9b('0x4')]=_0x4d9b('0xa');util[_0x4d9b('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x315144){this['message']=_0x315144||_0x4d9b('0xb');this[_0x4d9b('0x4')]=_0x4d9b('0xc');this[_0x4d9b('0xd')]=0x193;this[_0x4d9b('0xe')]={'type':_0x4d9b('0xf')};util[_0x4d9b('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x193a65){this[_0x4d9b('0x3')]=_0x193a65||'Resource\x20Conflict';this[_0x4d9b('0x4')]=_0x4d9b('0x10');util[_0x4d9b('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0xc9a5bd){switch(_0xc9a5bd){case _0x4d9b('0x7'):return 0x190;case _0x4d9b('0x8'),_0x4d9b('0xc'):return 0x193;case _0x4d9b('0xa'):return 0x194;case _0x4d9b('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x81eef3){if(_0x81eef3==='Out\x20Of\x20Interval')return _0x81eef3;return null;}function handleError(_0x12d2da){return function(_0xb91d22){logger[_0x4d9b('0x11')](_0xb91d22[_0x4d9b('0x12')]);var _0x344680=getStatusCode(_0xb91d22[_0x4d9b('0x4')]);var _0x33d89=getCustomStatusMessage(_0xb91d22[_0x4d9b('0x4')]);if(_0xb91d22[_0x4d9b('0x4')]){delete _0xb91d22[_0x4d9b('0x4')];}if(_0x33d89){_0x12d2da['statusMessage']=_0x33d89;}return _0x12d2da[_0x4d9b('0x13')](_0x344680)['send'](_0xb91d22);};}module[_0x4d9b('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 59fcb2e..e2bdca5 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5201=['render','exports','404','status'];(function(_0x3b891d,_0x2154c3){var _0xcbaf13=function(_0x318121){while(--_0x318121){_0x3b891d['push'](_0x3b891d['shift']());}};_0xcbaf13(++_0x2154c3);}(_0x5201,0xf5));var _0x1520=function(_0x512473,_0x1ab86a){_0x512473=_0x512473-0x0;var _0x5dc405=_0x5201[_0x512473];return _0x5dc405;};'use strict';module[_0x1520('0x0')][0x194]=function pageNotFound(_0x14a22a,_0x2fb783){var _0x5b2aed=_0x1520('0x1');var _0x5a0614=0x194;var _0x5e4de1={'status':_0x5a0614};_0x2fb783[_0x1520('0x2')](_0x5e4de1[_0x1520('0x2')]);_0x2fb783[_0x1520('0x3')](_0x5b2aed,{},function(_0x2e133d,_0x4234f0){if(_0x2e133d){return _0x2fb783['status'](_0x5e4de1[_0x1520('0x2')])['json'](_0x5e4de1);}_0x2fb783['send'](_0x4234f0);});}; \ No newline at end of file +var _0x82ee=['404','status','render','json','send'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x82ee,0xeb));var _0xe82e=function(_0x517996,_0xb4336d){_0x517996=_0x517996-0x0;var _0x47eac5=_0x82ee[_0x517996];return _0x47eac5;};'use strict';module['exports'][0x194]=function pageNotFound(_0x39c062,_0x455578){var _0x4ef2f5=_0xe82e('0x0');var _0xa424e8=0x194;var _0x1dcd9c={'status':_0xa424e8};_0x455578[_0xe82e('0x1')](_0x1dcd9c[_0xe82e('0x1')]);_0x455578[_0xe82e('0x2')](_0x4ef2f5,{},function(_0x6ba557,_0x10d486){if(_0x6ba557){return _0x455578[_0xe82e('0x1')](_0x1dcd9c['status'])[_0xe82e('0x3')](_0x1dcd9c);}_0x455578[_0xe82e('0x4')](_0x10d486);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5105c76..1ae2e77 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e3b=['mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Disposition','CannedAnswer','Answers','List','ListId','TemplateId','Pause','team_has_mail_queues','Teams','Tag','mail_interaction_has_tags','Tags','ThroughTags','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','Dashboard','Dispositions','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','Users','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','ChatProactiveAction','ChatApplication','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','Website','CmCompany','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OneAll','AutomationAllId','Any','AutomationAnyId','Action','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','Actions','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Field','DeskAccount','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','Description','VariableId','ZendeskField','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowField','Dynamics365Configuration','SessionId','ProjectId','team_has_openchannel_queues','WhatsappQueue','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','motion2','name','options','database','username','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','User','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceExtension','Extensions','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','MailInteractions','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','ChatGroup','Groups','Contacts','belongsToMany','CmList','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteraction','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefix','VoicePrefixes','MailQueue','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','VoiceQueueId','CmHopper','CmHopperHistory','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','TrunkBackupId','IntervalId'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0x8e3b,0xaa));var _0xb8e3=function(_0x198247,_0x491c12){_0x198247=_0x198247-0x0;var _0x2b18bc=_0x8e3b[_0x198247];return _0x2b18bc;};'use strict';var config=require(_0xb8e3('0x0'));var Sequelize=require(_0xb8e3('0x1'));var _=require(_0xb8e3('0x2'));var jstz=require(_0xb8e3('0x3'));var timezone=jstz[_0xb8e3('0x4')]();config[_0xb8e3('0x1')]=_[_0xb8e3('0x5')](config[_0xb8e3('0x1')],{'database':'motion2','username':_0xb8e3('0x6'),'password':_0xb8e3('0x7'),'options':{'host':_0xb8e3('0x8'),'port':0xcea,'dialect':_0xb8e3('0x9'),'dialectOptions':{'charset':_0xb8e3('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xb8e3('0xb'),'collate':_0xb8e3('0xc')}}});config[_0xb8e3('0xd')]=_['defaultsDeep'](config[_0xb8e3('0xd')],{'database':_0xb8e3('0xe'),'username':_0xb8e3('0x6'),'password':'xC@LL1234','options':{'host':_0xb8e3('0x8'),'port':0xcea,'dialect':_0xb8e3('0x9'),'dialectOptions':{'charset':_0xb8e3('0xa')},'logging':![],'timezone':timezone[_0xb8e3('0xf')](),'define':{'charset':'utf8','collate':_0xb8e3('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0xb8e3('0x1')]['username'],config[_0xb8e3('0x1')]['password'],config[_0xb8e3('0x1')][_0xb8e3('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb8e3('0xd')][_0xb8e3('0x11')],config['sequelizeHistory'][_0xb8e3('0x12')],config[_0xb8e3('0xd')]['password'],config['sequelizeHistory']['options'])};db['User']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x14'));db[_0xb8e3('0x15')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x16'));db['VoiceContext']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x17'));db['VoiceExtension']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x18'));db[_0xb8e3('0x19')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xb8e3('0x1a')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x1b'));db[_0xb8e3('0x1c')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x1d'));db[_0xb8e3('0x1e')]=db['sequelize']['import']('../api/screenRecording/screenRecording.model');db[_0xb8e3('0x1f')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x20'));db[_0xb8e3('0x21')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x22'));db[_0xb8e3('0x23')]=db[_0xb8e3('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0xb8e3('0x24')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x25'));db[_0xb8e3('0x26')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x27'));db[_0xb8e3('0x28')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x29'));db['MemberReport']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x2a'));db['Trunk']=db['sequelize'][_0xb8e3('0x13')]('../api/trunk/trunk.model');db[_0xb8e3('0x2b')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x2c'));db[_0xb8e3('0x2d')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x2e'));db['UserVoiceQueue']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x2f'));db[_0xb8e3('0x30')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x31'));db[_0xb8e3('0x32')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x33'));db[_0xb8e3('0x34')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x35'));db[_0xb8e3('0x36')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x37'));db[_0xb8e3('0x38')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x39'));db[_0xb8e3('0x3a')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x3b'));db[_0xb8e3('0x3c')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x3d'));db[_0xb8e3('0x3e')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x3f'));db[_0xb8e3('0x40')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x41'));db['MailQueue']=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x42'));db[_0xb8e3('0x43')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x44'));db[_0xb8e3('0x45')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0xb8e3('0x46')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x47'));db[_0xb8e3('0x48')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x49'));db[_0xb8e3('0x4a')]=db[_0xb8e3('0x1')]['import']('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x4b'));db[_0xb8e3('0x4c')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x4d'));db[_0xb8e3('0x4e')]=db['sequelize'][_0xb8e3('0x13')]('../api/faxAccount/faxAccount.model');db[_0xb8e3('0x4f')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x50'));db[_0xb8e3('0x51')]=db[_0xb8e3('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db['sequelize'][_0xb8e3('0x13')]('../api/faxMessage/faxMessage.model');db[_0xb8e3('0x52')]=db[_0xb8e3('0x1')]['import']('../api/faxQueue/faxQueue.model');db[_0xb8e3('0x53')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x54'));db[_0xb8e3('0x55')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x56'));db[_0xb8e3('0x57')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x58'));db['SmsInteraction']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x59'));db[_0xb8e3('0x5a')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x5b'));db[_0xb8e3('0x5c')]=db['sequelize']['import'](_0xb8e3('0x5d'));db['OpenchannelAccount']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x5e'));db[_0xb8e3('0x5f')]=db['sequelize'][_0xb8e3('0x13')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0xb8e3('0x1')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0xb8e3('0x60')]=db['sequelize']['import'](_0xb8e3('0x61'));db[_0xb8e3('0x62')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x63'));db[_0xb8e3('0x64')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x65'));db[_0xb8e3('0x66')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x67'));db['ChatApplication']=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x68'));db[_0xb8e3('0x69')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x6a'));db[_0xb8e3('0x6b')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x6c'));db[_0xb8e3('0x6d')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x6e'));db['ChatQueue']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x6f'));db['ChatGroup']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x70'));db['ChatProactiveAction']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x71'));db['CmCompany']=db[_0xb8e3('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0xb8e3('0x72')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x73'));db[_0xb8e3('0x74')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x75'));db['CmHopperHistory']=db['sequelize']['import'](_0xb8e3('0x76'));db[_0xb8e3('0x77')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x78'));db[_0xb8e3('0x79')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x7a'));db['Action']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x7b'));db[_0xb8e3('0x7c')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x7d'));db['CannedAnswer']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x7e'));db['Disposition']=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x7f'));db[_0xb8e3('0x80')]=db['sequelize'][_0xb8e3('0x13')]('../api/condition/condition.model');db[_0xb8e3('0x81')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x82'));db['Pause']=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x83'));db['Cdr']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x84'));db[_0xb8e3('0x85')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x86'));db[_0xb8e3('0x87')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x88'));db[_0xb8e3('0x89')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x8a'));db['Tag']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x8b'));db[_0xb8e3('0x8c')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x8d'));db[_0xb8e3('0x8e')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x8f'));db[_0xb8e3('0x90')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xb8e3('0x91')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x92'));db[_0xb8e3('0x93')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x94'));db[_0xb8e3('0x95')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/variable/variable.model');db[_0xb8e3('0x96')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x97'));db[_0xb8e3('0x98')]=db['sequelize'][_0xb8e3('0x13')]('../api/integrationReport/integrationReport.model');db[_0xb8e3('0x99')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x9a'));db['AnalyticDefaultReport']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x9b'));db['AnalyticExtractedReport']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x9c'));db[_0xb8e3('0x9d')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xb8e3('0x9e')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x9f'));db['AnalyticTreeReport']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xa0'));db[_0xb8e3('0xa1')]=db['sequelize'][_0xb8e3('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xb8e3('0xa2')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xb8e3('0xa3')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xa4'));db[_0xb8e3('0xa5')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0xa6'));db[_0xb8e3('0xa7')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0xa8'));db[_0xb8e3('0xa9')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xaa'));db['DeskConfiguration']=db[_0xb8e3('0x1')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/intDeskField/intDeskField.model');db[_0xb8e3('0xab')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xac'));db['ZohoConfiguration']=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xad'));db[_0xb8e3('0xae')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xaf'));db['ZendeskAccount']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xb0'));db[_0xb8e3('0xb1')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xb2'));db['ZendeskField']=db['sequelize'][_0xb8e3('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0xb8e3('0xb3')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xb4'));db[_0xb8e3('0xb5')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xb6'));db[_0xb8e3('0xb7')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xb8e3('0xb8')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xb9'));db[_0xb8e3('0xba')]=db['sequelize'][_0xb8e3('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xb8e3('0xbb')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xbc'));db[_0xb8e3('0xbd')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xbe'));db[_0xb8e3('0xbf')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xc0'));db['ServicenowField']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xc1'));db[_0xb8e3('0xc2')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0xc3'));db['Dynamics365Configuration']=db[_0xb8e3('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xb8e3('0xc4')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xc5'));db[_0xb8e3('0xc6')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xc7'));db[_0xb8e3('0xc8')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xb8e3('0xc9')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x97'));db[_0xb8e3('0xca')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xcb'));db[_0xb8e3('0xcc')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0xcd'));db[_0xb8e3('0xce')]=db[_0xb8e3('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0xb8e3('0xcf')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xd0'));db[_0xb8e3('0xd1')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xd2'));db[_0xb8e3('0xd3')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xd4'));db[_0xb8e3('0xd5')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/smsQueueReport/smsQueueReport.model');db[_0xb8e3('0xd6')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xd7'));db[_0xb8e3('0xd8')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xd9'));db[_0xb8e3('0xda')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xdb'));db[_0xb8e3('0xdc')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xdd'));db['SquareOdbc']=db[_0xb8e3('0x1')]['import']('../api/squareOdbc/squareOdbc.model');db[_0xb8e3('0xde')]=db['sequelize']['import'](_0xb8e3('0xdf'));db[_0xb8e3('0xe0')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xe1'));db[_0xb8e3('0xe2')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xe3'));db[_0xb8e3('0xe4')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xe5'));db[_0xb8e3('0xe6')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xe7'));db[_0xb8e3('0xe8')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xe9'));db[_0xb8e3('0xea')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xeb'));db[_0xb8e3('0xec')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xed'));db[_0xb8e3('0xee')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/plugin/plugin.model');db[_0xb8e3('0xef')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xf0'));db['ChatTransferReport']=db['sequelize']['import'](_0xb8e3('0xf1'));db[_0xb8e3('0xf2')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0xb8e3('0xf3')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0xf4'));db[_0xb8e3('0xf5')]=db[_0xb8e3('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xf6'));db['VoicePrefix']=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0xb8e3('0xf7')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xf8'));db[_0xb8e3('0xf9')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xfa'));db[_0xb8e3('0xfb')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0xfc'));db[_0xb8e3('0xfd')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/userNotification/userNotification.model');db[_0xb8e3('0xfe')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0xff'));db[_0xb8e3('0x100')]=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x101'));db[_0xb8e3('0x102')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x103'));db['WhatsappMessage']=db[_0xb8e3('0x1')]['import'](_0xb8e3('0x104'));db['WhatsappQueueReport']=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x105'));db[_0xb8e3('0x106')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x107'));db['WhatsappQueue']=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0xb8e3('0x108')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x109'));db[_0xb8e3('0x10a')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x10b'));db[_0xb8e3('0x10c')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0xb8e3('0x10d')]=db['sequelize'][_0xb8e3('0x13')](_0xb8e3('0x10e'));db[_0xb8e3('0x10f')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')](_0xb8e3('0x110'));db[_0xb8e3('0x111')]=db[_0xb8e3('0x1')][_0xb8e3('0x13')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0xb8e3('0x112')][_0xb8e3('0x113')](db[_0xb8e3('0x1f')],{'as':'VoiceMail','onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x112')][_0xb8e3('0x113')](db['UserSetting'],{'as':_0xb8e3('0x116'),'onDelete':'cascade','foreignKey':'UserId'});db[_0xb8e3('0x112')][_0xb8e3('0x117')](db[_0xb8e3('0x1c')],{'as':_0xb8e3('0x118'),'foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x112')][_0xb8e3('0x117')](db[_0xb8e3('0x2d')],{'as':'VoiceQueuesRt','foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x112')]['hasMany'](db[_0xb8e3('0x119')],{'as':_0xb8e3('0x11a'),'onDelete':_0xb8e3('0x114'),'hooks':!![]});db['User'][_0xb8e3('0x117')](db[_0xb8e3('0x74')],{'as':_0xb8e3('0x11b'),'foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x112')][_0xb8e3('0x117')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xb8e3('0x115')});db['User']['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x112')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xb8e3('0x11c'),'foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x112')]['hasMany'](db[_0xb8e3('0x69')],{'as':_0xb8e3('0x11d'),'foreignKey':_0xb8e3('0x115')});db['User'][_0xb8e3('0x117')](db[_0xb8e3('0x11e')],{'as':'SmsInteractions','foreignKey':_0xb8e3('0x115')});db['User'][_0xb8e3('0x117')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x112')][_0xb8e3('0x117')](db[_0xb8e3('0x45')],{'as':_0xb8e3('0x11f'),'foreignKey':'UserId'});db[_0xb8e3('0x112')][_0xb8e3('0x117')](db[_0xb8e3('0x102')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xb8e3('0x112')][_0xb8e3('0x117')](db[_0xb8e3('0xfd')],{'as':'UserNotifications','foreignKey':_0xb8e3('0x120')});db[_0xb8e3('0x112')][_0xb8e3('0x117')](db['CmHopper'],{'as':_0xb8e3('0x121'),'foreignKey':_0xb8e3('0x115'),'onDelete':_0xb8e3('0x122')});db[_0xb8e3('0x112')][_0xb8e3('0x123')](db[_0xb8e3('0xf7')],{'as':_0xb8e3('0xf7'),'foreignKey':_0xb8e3('0x124')});db[_0xb8e3('0x112')]['belongsToMany'](db[_0xb8e3('0x125')],{'as':_0xb8e3('0x126'),'through':'chat_group_has_users'});db[_0xb8e3('0x112')]['belongsToMany'](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x127'),'through':'cm_user_has_contacts'});db['User'][_0xb8e3('0x128')](db[_0xb8e3('0x129')],{'as':'Lists','through':'cm_user_has_lists'});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0xe4')],{'through':'user_has_teams'});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0x45')],{'as':'MailInteractions','through':_0xb8e3('0x12a')});db[_0xb8e3('0x112')]['belongsToMany'](db['ChatInteraction'],{'as':_0xb8e3('0x11d'),'through':_0xb8e3('0x12b')});db['User']['belongsToMany'](db['FaxInteraction'],{'as':_0xb8e3('0x12c'),'through':_0xb8e3('0x12d')});db[_0xb8e3('0x112')]['belongsToMany'](db['SmsInteraction'],{'as':_0xb8e3('0x12e'),'through':_0xb8e3('0x12f')});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0x130')],{'as':_0xb8e3('0x11c'),'through':'user_has_openchannel_interactions'});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0x102')],{'as':_0xb8e3('0x131'),'through':_0xb8e3('0x132')});db[_0xb8e3('0x112')]['belongsToMany'](db[_0xb8e3('0x1a')],{'as':_0xb8e3('0x133'),'through':_0xb8e3('0x134'),'required':![]});db[_0xb8e3('0x112')]['belongsToMany'](db[_0xb8e3('0x135')],{'as':_0xb8e3('0x136'),'through':'UserVoicePrefix','required':![]});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0x137')],{'as':_0xb8e3('0x138'),'through':'UserMailQueue','required':![]});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0x139')],{'as':_0xb8e3('0x13a'),'through':_0xb8e3('0x30'),'required':![],'hooks':!![]});db['User'][_0xb8e3('0x128')](db[_0xb8e3('0x52')],{'as':_0xb8e3('0x13b'),'through':_0xb8e3('0x34'),'required':![]});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0x5c')],{'as':_0xb8e3('0x13c'),'through':'UserSmsQueue','required':![]});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0x62')],{'as':_0xb8e3('0x13d'),'through':'UserOpenchannelQueue','required':![]});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0xb8e3('0x3a'),'required':![]});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0x129')],{'through':_0xb8e3('0x13e')});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db['ChatWebsite'],{'as':_0xb8e3('0x13f'),'through':_0xb8e3('0x140')});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db['FaxAccount'],{'as':_0xb8e3('0x141'),'through':_0xb8e3('0x142')});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db['MailAccount'],{'as':_0xb8e3('0x143'),'through':_0xb8e3('0x144')});db['User'][_0xb8e3('0x128')](db[_0xb8e3('0x145')],{'as':'OpenchannelAccounts','through':_0xb8e3('0x146')});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db[_0xb8e3('0x55')],{'as':'SmsAccounts','through':_0xb8e3('0x147')});db[_0xb8e3('0x112')][_0xb8e3('0x128')](db['WhatsappAccount'],{'as':_0xb8e3('0x148'),'through':_0xb8e3('0x149')});db['VoiceChanSpy'][_0xb8e3('0x117')](db[_0xb8e3('0x119')],{'as':_0xb8e3('0x14a'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x14b')});db[_0xb8e3('0x14c')]['hasMany'](db[_0xb8e3('0x119')],{'onDelete':'cascade'});db[_0xb8e3('0x119')][_0xb8e3('0x117')](db[_0xb8e3('0x119')],{'as':_0xb8e3('0x14d'),'onDelete':_0xb8e3('0x114')});db['VoiceMusicOnHold'][_0xb8e3('0x128')](db['Sound'],{'as':_0xb8e3('0x14e'),'through':_0xb8e3('0x14f')});db['VoiceQueue'][_0xb8e3('0x117')](db[_0xb8e3('0x2d')],{'as':'Members','foreignKey':_0xb8e3('0x150')});db[_0xb8e3('0x1a')][_0xb8e3('0x117')](db[_0xb8e3('0x151')],{'as':_0xb8e3('0x121'),'foreignKey':'VoiceQueueId'});db[_0xb8e3('0x1a')]['hasMany'](db[_0xb8e3('0x74')],{'as':_0xb8e3('0x11b'),'foreignKey':_0xb8e3('0x150')});db[_0xb8e3('0x1a')]['hasMany'](db[_0xb8e3('0x152')],{'as':_0xb8e3('0x153'),'foreignKey':_0xb8e3('0x150')});db['VoiceQueue']['hasMany'](db[_0xb8e3('0x77')],{'as':_0xb8e3('0x77'),'foreignKey':_0xb8e3('0x150')});db[_0xb8e3('0x1a')][_0xb8e3('0x117')](db[_0xb8e3('0x154')],{'as':_0xb8e3('0x155'),'foreignKey':_0xb8e3('0x150')});db[_0xb8e3('0x1a')][_0xb8e3('0x117')](db[_0xb8e3('0xd3')],{'as':_0xb8e3('0x156'),'foreignKey':_0xb8e3('0x150')});db[_0xb8e3('0x1a')][_0xb8e3('0x123')](db[_0xb8e3('0x157')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xb8e3('0x1a')]['belongsTo'](db[_0xb8e3('0x157')],{'as':_0xb8e3('0x158'),'foreignKey':_0xb8e3('0x159')});db[_0xb8e3('0x1a')][_0xb8e3('0x123')](db['Interval'],{'as':_0xb8e3('0x81'),'foreignKey':_0xb8e3('0x15a')});db[_0xb8e3('0x1a')][_0xb8e3('0x123')](db['Pause'],{'as':_0xb8e3('0x15b'),'foreignKey':_0xb8e3('0x15c')});db['VoiceQueue']['belongsToMany'](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x15d'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue']['belongsToMany'](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':_0xb8e3('0x134')});db[_0xb8e3('0x1a')][_0xb8e3('0x128')](db[_0xb8e3('0xe4')],{'as':'Teams','through':'TeamVoiceQueue'});db['VoiceQueue'][_0xb8e3('0x128')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x15f'),'through':_0xb8e3('0x160')});db['VoiceRecording'][_0xb8e3('0x123')](db['User'],{'as':_0xb8e3('0x112'),'foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x1e')][_0xb8e3('0x123')](db['User'],{'as':'User','foreignKey':'UserId'});db[_0xb8e3('0x1f')][_0xb8e3('0x117')](db[_0xb8e3('0x21')],{'as':_0xb8e3('0x161'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x162'),'sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db[_0xb8e3('0x1f')],{'foreignKey':_0xb8e3('0x162'),'targetKey':'mailbox'});db['VoiceCallReport'][_0xb8e3('0x117')](db[_0xb8e3('0x28')],{'as':_0xb8e3('0x163'),'foreignKey':_0xb8e3('0x164'),'constraints':![]});db['VoiceCallReport'][_0xb8e3('0x117')](db[_0xb8e3('0x26')],{'as':_0xb8e3('0x165'),'foreignKey':_0xb8e3('0x164'),'constraints':![]});db['VoiceCallReport'][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x112'),'foreignKey':'UserId'});db[_0xb8e3('0x23')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x3c')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xb8e3('0x168')});db[_0xb8e3('0x3c')][_0xb8e3('0x123')](db[_0xb8e3('0x108')],{'as':'CloudProvider','foreignKey':_0xb8e3('0x169'),'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x3e')][_0xb8e3('0x123')](db['MailAccount'],{'as':_0xb8e3('0x40'),'foreignKey':_0xb8e3('0x168')});db[_0xb8e3('0x3e')][_0xb8e3('0x123')](db[_0xb8e3('0x108')],{'as':_0xb8e3('0x108'),'foreignKey':_0xb8e3('0x169'),'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x40')][_0xb8e3('0x113')](db['MailServerIn'],{'as':_0xb8e3('0x16b'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x40')][_0xb8e3('0x113')](db[_0xb8e3('0x3e')],{'as':_0xb8e3('0x16c'),'onDelete':_0xb8e3('0x114')});db['MailAccount']['hasMany'](db[_0xb8e3('0x16d')],{'as':'Dispositions','foreignKey':_0xb8e3('0x168'),'onDelete':'cascade'});db[_0xb8e3('0x40')][_0xb8e3('0x117')](db[_0xb8e3('0x16e')],{'as':_0xb8e3('0x16f'),'foreignKey':_0xb8e3('0x168')});db[_0xb8e3('0x40')]['hasMany'](db[_0xb8e3('0x46')],{'as':_0xb8e3('0x161'),'foreignKey':_0xb8e3('0x168')});db['MailAccount']['hasMany'](db[_0xb8e3('0x45')],{'as':'Interactions'});db['MailAccount'][_0xb8e3('0x117')](db['MailApplication'],{'as':_0xb8e3('0x14d'),'foreignKey':_0xb8e3('0x168'),'onDelete':_0xb8e3('0x114')});db['MailAccount'][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x170'),'foreignKey':_0xb8e3('0x171')});db['MailAccount']['belongsTo'](db[_0xb8e3('0x91')],{'as':_0xb8e3('0x91'),'foreignKey':_0xb8e3('0x172')});db[_0xb8e3('0x40')][_0xb8e3('0x123')](db[_0xb8e3('0x173')],{'as':_0xb8e3('0x15b'),'foreignKey':_0xb8e3('0x15c')});db[_0xb8e3('0x40')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xb8e3('0x137')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':_0xb8e3('0x32')});db[_0xb8e3('0x137')][_0xb8e3('0x128')](db[_0xb8e3('0xe4')],{'through':_0xb8e3('0x174'),'as':_0xb8e3('0x175')});db[_0xb8e3('0x45')][_0xb8e3('0x117')](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xb8e3('0x45')][_0xb8e3('0x123')](db[_0xb8e3('0x40')],{'as':'Account','foreignKey':_0xb8e3('0x168')});db[_0xb8e3('0x45')]['belongsTo'](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x45')][_0xb8e3('0x123')](db['User'],{'as':'Owner','foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x45')][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x177'),'as':_0xb8e3('0x178')});db[_0xb8e3('0x45')][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':'mail_interaction_has_tags','as':_0xb8e3('0x179')});db[_0xb8e3('0x45')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0xb8e3('0x17a')});db['MailMessage']['hasMany'](db[_0xb8e3('0xec')],{'as':_0xb8e3('0x17b'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x46')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x112')});db[_0xb8e3('0x46')][_0xb8e3('0x123')](db['CmContact'],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x166')});db[_0xb8e3('0x46')][_0xb8e3('0x123')](db['MailInteraction'],{'as':_0xb8e3('0x17c'),'foreignKey':_0xb8e3('0x17a')});db[_0xb8e3('0x46')]['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':_0xb8e3('0x168')});db[_0xb8e3('0x46')][_0xb8e3('0x123')](db[_0xb8e3('0x64')],{'as':'ChatWebsite','foreignKey':_0xb8e3('0x17d')});db['MailMessage'][_0xb8e3('0x123')](db[_0xb8e3('0x6d')],{'as':_0xb8e3('0x6d'),'foreignKey':_0xb8e3('0x17e')});db[_0xb8e3('0x48')]['belongsTo'](db[_0xb8e3('0x112')],{'onDelete':'restrict'});db[_0xb8e3('0x48')][_0xb8e3('0x123')](db[_0xb8e3('0x137')],{'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x48')]['belongsTo'](db[_0xb8e3('0x40')],{'onDelete':_0xb8e3('0x16a')});db['MailApplication']['belongsTo'](db[_0xb8e3('0x81')],{'onDelete':_0xb8e3('0x16a'),'foreignKey':_0xb8e3('0x15a')});db['MailApplication']['belongsTo'](db[_0xb8e3('0x176')],{'onDelete':_0xb8e3('0x16a'),'foreignKey':_0xb8e3('0x17f')});db[_0xb8e3('0x4a')]['belongsTo'](db[_0xb8e3('0x40')],{});db[_0xb8e3('0x4a')][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x170'),'foreignKey':'ListId'});db[_0xb8e3('0x4a')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x4a')][_0xb8e3('0x123')](db[_0xb8e3('0x45')],{});db['MailQueueReport'][_0xb8e3('0x123')](db['MailMessage'],{});db['MailQueueReport'][_0xb8e3('0x123')](db['User'],{});db[_0xb8e3('0x4a')]['belongsTo'](db[_0xb8e3('0x137')],{});db[_0xb8e3('0x180')][_0xb8e3('0x117')](db['DashboardItem'],{'as':'Items','onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x4e')][_0xb8e3('0x117')](db[_0xb8e3('0x16d')],{'as':_0xb8e3('0x181'),'foreignKey':_0xb8e3('0x182'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x4e')][_0xb8e3('0x117')](db[_0xb8e3('0x16e')],{'as':_0xb8e3('0x16f'),'foreignKey':_0xb8e3('0x182')});db[_0xb8e3('0x4e')][_0xb8e3('0x117')](db[_0xb8e3('0x51')],{'as':_0xb8e3('0x183')});db[_0xb8e3('0x4e')][_0xb8e3('0x117')](db[_0xb8e3('0x4f')],{'as':'Applications','foreignKey':_0xb8e3('0x182'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x4e')][_0xb8e3('0x117')](db[_0xb8e3('0x119')],{'as':_0xb8e3('0x184'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x4e')]['hasMany'](db[_0xb8e3('0x185')],{'as':_0xb8e3('0x161')});db['FaxAccount'][_0xb8e3('0x123')](db[_0xb8e3('0x157')],{'as':'Trunk'});db['FaxAccount'][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x170'),'foreignKey':_0xb8e3('0x171')});db[_0xb8e3('0x4e')][_0xb8e3('0x123')](db['Pause'],{'as':_0xb8e3('0x15b'),'foreignKey':_0xb8e3('0x15c')});db[_0xb8e3('0x4e')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x4f')]['belongsTo'](db['FaxQueue'],{'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x4f')]['belongsTo'](db[_0xb8e3('0x4e')],{'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x4f')][_0xb8e3('0x123')](db['Tag'],{'onDelete':_0xb8e3('0x16a'),'foreignKey':_0xb8e3('0x17f')});db[_0xb8e3('0x51')][_0xb8e3('0x117')](db[_0xb8e3('0x185')],{'as':'Messages','onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x186')});db[_0xb8e3('0x51')][_0xb8e3('0x123')](db[_0xb8e3('0x4e')],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x182')});db[_0xb8e3('0x51')]['belongsTo'](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x51')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x188'),'foreignKey':_0xb8e3('0x115')});db['FaxInteraction'][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x189'),'as':_0xb8e3('0x178')});db[_0xb8e3('0x51')][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':'fax_interaction_has_tags','as':_0xb8e3('0x179')});db[_0xb8e3('0x51')]['belongsToMany'](db[_0xb8e3('0x112')],{'as':'Users','through':_0xb8e3('0x12d'),'foreignKey':_0xb8e3('0x186')});db[_0xb8e3('0x185')][_0xb8e3('0x123')](db['User'],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x112')});db[_0xb8e3('0x185')][_0xb8e3('0x123')](db[_0xb8e3('0x51')],{'as':_0xb8e3('0x17c'),'foreignKey':_0xb8e3('0x186')});db[_0xb8e3('0x185')]['belongsTo'](db[_0xb8e3('0x72')],{'onDelete':_0xb8e3('0x114'),'as':'Contact'});db[_0xb8e3('0x185')]['belongsTo'](db[_0xb8e3('0xec')],{'as':'Attachment','foreignKey':_0xb8e3('0x18a')});db[_0xb8e3('0x185')][_0xb8e3('0x123')](db[_0xb8e3('0x4e')],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x182')});db[_0xb8e3('0x52')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':_0xb8e3('0x34')});db[_0xb8e3('0x52')][_0xb8e3('0x128')](db[_0xb8e3('0xe4')],{'through':_0xb8e3('0x18b'),'as':'Teams'});db[_0xb8e3('0x53')]['belongsTo'](db[_0xb8e3('0x4e')],{});db[_0xb8e3('0x53')][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':'List','foreignKey':_0xb8e3('0x171')});db[_0xb8e3('0x53')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x53')][_0xb8e3('0x123')](db[_0xb8e3('0x51')],{});db['FaxQueueReport'][_0xb8e3('0x123')](db[_0xb8e3('0x185')],{});db[_0xb8e3('0x53')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{});db[_0xb8e3('0x53')][_0xb8e3('0x123')](db[_0xb8e3('0x52')],{});db[_0xb8e3('0x55')]['hasMany'](db[_0xb8e3('0x16d')],{'as':'Dispositions','foreignKey':_0xb8e3('0x18c'),'onDelete':'cascade'});db['SmsAccount']['hasMany'](db[_0xb8e3('0x16e')],{'as':_0xb8e3('0x16f'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xb8e3('0x117')](db[_0xb8e3('0x5a')],{'as':'Messages','foreignKey':_0xb8e3('0x18c')});db[_0xb8e3('0x55')][_0xb8e3('0x117')](db['SmsInteraction'],{'as':_0xb8e3('0x183')});db['SmsAccount']['hasMany'](db[_0xb8e3('0x57')],{'as':'Applications','foreignKey':_0xb8e3('0x18c'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x55')][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x170'),'foreignKey':_0xb8e3('0x171')});db['SmsAccount'][_0xb8e3('0x123')](db['Pause'],{'as':_0xb8e3('0x15b'),'foreignKey':_0xb8e3('0x15c')});db[_0xb8e3('0x55')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':'Agents','through':_0xb8e3('0x147')});db[_0xb8e3('0x57')]['belongsTo'](db[_0xb8e3('0x112')],{'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x57')][_0xb8e3('0x123')](db[_0xb8e3('0x5c')],{'onDelete':_0xb8e3('0x16a')});db['SmsApplication'][_0xb8e3('0x123')](db[_0xb8e3('0x55')],{'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x57')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xb8e3('0x15a')});db[_0xb8e3('0x57')]['belongsTo'](db[_0xb8e3('0x176')],{'onDelete':'restrict','foreignKey':_0xb8e3('0x17f')});db['SmsInteraction'][_0xb8e3('0x117')](db[_0xb8e3('0x5a')],{'as':_0xb8e3('0x161'),'onDelete':_0xb8e3('0x114'),'foreignKey':'SmsInteractionId'});db[_0xb8e3('0x11e')][_0xb8e3('0x123')](db[_0xb8e3('0x55')],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x18c')});db[_0xb8e3('0x11e')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db['SmsInteraction'][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x188'),'foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x11e')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xb8e3('0x178')});db['SmsInteraction'][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x18d'),'as':_0xb8e3('0x179')});db[_0xb8e3('0x11e')]['belongsToMany'](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x18e'),'through':_0xb8e3('0x12f'),'foreignKey':'SmsInteractionId'});db[_0xb8e3('0x5a')][_0xb8e3('0x123')](db['User'],{'as':_0xb8e3('0x112')});db[_0xb8e3('0x5a')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x166')});db['SmsMessage']['belongsTo'](db[_0xb8e3('0x11e')],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x17c'),'foreignKey':_0xb8e3('0x18f')});db[_0xb8e3('0x5a')][_0xb8e3('0x123')](db[_0xb8e3('0x55')],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x18c')});db[_0xb8e3('0x5c')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':_0xb8e3('0x36'),'foreignKey':_0xb8e3('0x190')});db['SmsQueue']['belongsToMany'](db[_0xb8e3('0xe4')],{'through':_0xb8e3('0x191'),'as':_0xb8e3('0x175')});db[_0xb8e3('0x145')][_0xb8e3('0x117')](db[_0xb8e3('0x16d')],{'as':_0xb8e3('0x181'),'foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0xb8e3('0x145')][_0xb8e3('0x117')](db[_0xb8e3('0x16e')],{'as':_0xb8e3('0x16f'),'foreignKey':'OpenchannelAccountId'});db[_0xb8e3('0x145')][_0xb8e3('0x117')](db[_0xb8e3('0x130')],{'as':_0xb8e3('0x183'),'foreignKey':_0xb8e3('0x192')});db[_0xb8e3('0x145')][_0xb8e3('0x117')](db['OpenchannelMessage'],{'as':_0xb8e3('0x161'),'foreignKey':_0xb8e3('0x192')});db[_0xb8e3('0x145')][_0xb8e3('0x117')](db[_0xb8e3('0x5f')],{'as':_0xb8e3('0x14d'),'foreignKey':'OpenchannelAccountId','onDelete':_0xb8e3('0x114')});db['OpenchannelAccount'][_0xb8e3('0x123')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xb8e3('0x145')]['belongsTo'](db[_0xb8e3('0x173')],{'as':_0xb8e3('0x15b'),'foreignKey':_0xb8e3('0x15c')});db['OpenchannelAccount']['belongsToMany'](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':_0xb8e3('0x146')});db[_0xb8e3('0x5f')]['belongsTo'](db['User'],{'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x5f')][_0xb8e3('0x123')](db[_0xb8e3('0x62')],{'onDelete':_0xb8e3('0x16a'),'foreignKey':'OpenchannelQueueId'});db[_0xb8e3('0x5f')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0xb8e3('0x192')});db['OpenchannelApplication'][_0xb8e3('0x123')](db['Interval'],{'onDelete':_0xb8e3('0x16a'),'foreignKey':_0xb8e3('0x15a')});db[_0xb8e3('0x5f')][_0xb8e3('0x123')](db[_0xb8e3('0x176')],{'onDelete':_0xb8e3('0x16a'),'foreignKey':_0xb8e3('0x17f')});db[_0xb8e3('0x130')][_0xb8e3('0x117')](db[_0xb8e3('0x60')],{'as':_0xb8e3('0x161'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x193')});db[_0xb8e3('0x130')][_0xb8e3('0x123')](db[_0xb8e3('0x145')],{'as':'Account','foreignKey':_0xb8e3('0x192')});db[_0xb8e3('0x130')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db['OpenchannelInteraction'][_0xb8e3('0x123')](db['User'],{'as':_0xb8e3('0x188'),'foreignKey':_0xb8e3('0x115')});db['OpenchannelInteraction'][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x194'),'as':'Tags'});db['OpenchannelInteraction'][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x194'),'as':_0xb8e3('0x179')});db['OpenchannelInteraction'][_0xb8e3('0x128')](db['User'],{'as':_0xb8e3('0x18e'),'through':_0xb8e3('0x195'),'foreignKey':_0xb8e3('0x193')});db['OpenchannelMessage']['belongsTo'](db[_0xb8e3('0x112')],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x112')});db[_0xb8e3('0x60')]['belongsTo'](db[_0xb8e3('0x72')],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x166')});db[_0xb8e3('0x60')]['belongsTo'](db[_0xb8e3('0x130')],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x17c'),'foreignKey':_0xb8e3('0x193')});db[_0xb8e3('0x60')]['belongsTo'](db[_0xb8e3('0xec')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xb8e3('0x60')][_0xb8e3('0x123')](db[_0xb8e3('0x145')],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x192')});db[_0xb8e3('0x62')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':_0xb8e3('0x38'),'foreignKey':_0xb8e3('0x196')});db[_0xb8e3('0x62')]['belongsToMany'](db[_0xb8e3('0xe4')],{'through':'team_has_openchannel_queues','as':'Teams'});db['ChatWebsite']['hasMany'](db['Disposition'],{'as':_0xb8e3('0x181'),'foreignKey':_0xb8e3('0x17d'),'onDelete':_0xb8e3('0x114')});db['ChatWebsite']['hasMany'](db['CannedAnswer'],{'as':_0xb8e3('0x16f'),'foreignKey':_0xb8e3('0x17d')});db[_0xb8e3('0x64')][_0xb8e3('0x117')](db[_0xb8e3('0x197')],{'as':'ProactiveActions'});db[_0xb8e3('0x64')][_0xb8e3('0x117')](db['ChatInteraction'],{'as':_0xb8e3('0x183')});db[_0xb8e3('0x64')]['hasMany'](db['ChatApplication'],{'as':_0xb8e3('0x14d'),'foreignKey':_0xb8e3('0x17d'),'onDelete':'cascade'});db[_0xb8e3('0x64')]['hasMany'](db[_0xb8e3('0x6b')],{'as':_0xb8e3('0x161')});db[_0xb8e3('0x64')][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':'List','foreignKey':_0xb8e3('0x171')});db[_0xb8e3('0x64')]['belongsTo'](db[_0xb8e3('0x81')],{'as':_0xb8e3('0x81'),'foreignKey':_0xb8e3('0x15a')});db[_0xb8e3('0x64')][_0xb8e3('0x123')](db[_0xb8e3('0x40')],{'as':_0xb8e3('0x40'),'foreignKey':_0xb8e3('0x168')});db[_0xb8e3('0x64')]['belongsTo'](db[_0xb8e3('0x173')],{'as':_0xb8e3('0x15b'),'foreignKey':_0xb8e3('0x15c')});db[_0xb8e3('0x64')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xb8e3('0x123')](db[_0xb8e3('0x145')],{});db['OpenchannelQueueReport']['belongsTo'](db['CmList'],{'as':_0xb8e3('0x170'),'foreignKey':_0xb8e3('0x171')});db[_0xb8e3('0x66')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x66')][_0xb8e3('0x123')](db['OpenchannelInteraction'],{});db[_0xb8e3('0x66')][_0xb8e3('0x123')](db['OpenchannelMessage'],{});db[_0xb8e3('0x66')]['belongsTo'](db[_0xb8e3('0x112')],{});db[_0xb8e3('0x66')]['belongsTo'](db[_0xb8e3('0x62')],{});db[_0xb8e3('0x198')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'as':'Agent','foreignKey':'UserId','onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x198')][_0xb8e3('0x123')](db[_0xb8e3('0x139')],{'as':_0xb8e3('0x199'),'foreignKey':_0xb8e3('0x19a'),'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x198')][_0xb8e3('0x123')](db[_0xb8e3('0x64')],{'as':'Website','foreignKey':_0xb8e3('0x17d'),'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x198')]['belongsTo'](db[_0xb8e3('0x176')],{'onDelete':_0xb8e3('0x16a'),'foreignKey':_0xb8e3('0x17f')});db['ChatInteraction']['hasMany'](db[_0xb8e3('0x6b')],{'as':_0xb8e3('0x161'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x19b')});db[_0xb8e3('0x69')][_0xb8e3('0x123')](db[_0xb8e3('0x64')],{'as':'Account','foreignKey':_0xb8e3('0x17d')});db[_0xb8e3('0x69')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x69')][_0xb8e3('0x123')](db['User'],{'as':_0xb8e3('0x188'),'foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x69')][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x19c'),'as':_0xb8e3('0x178')});db[_0xb8e3('0x69')]['belongsToMany'](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x19c'),'as':_0xb8e3('0x179')});db[_0xb8e3('0x69')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x18e'),'through':_0xb8e3('0x12b'),'foreignKey':_0xb8e3('0x19b')});db['ChatMessage'][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x112')});db[_0xb8e3('0x6b')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'onDelete':_0xb8e3('0x114'),'as':'Contact','foreignKey':'ContactId'});db[_0xb8e3('0x6b')][_0xb8e3('0x123')](db['ChatInteraction'],{'onDelete':_0xb8e3('0x114'),'as':'Interaction','foreignKey':_0xb8e3('0x19b')});db[_0xb8e3('0x6b')][_0xb8e3('0x123')](db[_0xb8e3('0xec')],{'as':_0xb8e3('0xec'),'foreignKey':_0xb8e3('0x18a')});db[_0xb8e3('0x6b')][_0xb8e3('0x123')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xb8e3('0x17d')});db[_0xb8e3('0x6d')][_0xb8e3('0x117')](db[_0xb8e3('0xec')],{'as':_0xb8e3('0x17b'),'foreignKey':_0xb8e3('0x17e'),'onDelete':_0xb8e3('0x114'),'hooks':!![]});db[_0xb8e3('0x6d')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db['ChatOfflineMessage']['belongsTo'](db['ChatWebsite'],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x17d')});db[_0xb8e3('0x139')]['belongsToMany'](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':_0xb8e3('0x30'),'hooks':!![]});db[_0xb8e3('0x139')][_0xb8e3('0x128')](db[_0xb8e3('0xe4')],{'through':_0xb8e3('0x19d'),'as':'Teams'});db[_0xb8e3('0x125')]['hasMany'](db['ChatInternalMessage'],{'as':_0xb8e3('0x161'),'foreignKey':_0xb8e3('0x19e'),'onDelete':_0xb8e3('0x114')});db['ChatGroup'][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x19f'),'through':_0xb8e3('0x1a0')});db[_0xb8e3('0x197')]['belongsTo'](db['ChatWebsite'],{'as':_0xb8e3('0x1a1'),'foreignKey':_0xb8e3('0x17d')});db[_0xb8e3('0x1a2')][_0xb8e3('0x117')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x127'),'foreignKey':_0xb8e3('0x1a3')});db[_0xb8e3('0x72')]['hasMany'](db[_0xb8e3('0x8e')],{'as':_0xb8e3('0x1a4'),'foreignKey':_0xb8e3('0x1a5')});db[_0xb8e3('0x72')][_0xb8e3('0x117')](db[_0xb8e3('0x151')],{'as':_0xb8e3('0x121'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x72')][_0xb8e3('0x117')](db[_0xb8e3('0x74')],{'as':'HopperFinals','foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x72')]['hasMany'](db[_0xb8e3('0x152')],{'as':_0xb8e3('0x153'),'foreignKey':'ContactId'});db['CmContact'][_0xb8e3('0x117')](db[_0xb8e3('0x77')],{'as':_0xb8e3('0x77'),'foreignKey':_0xb8e3('0x167')});db['CmContact']['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'ContactId'});db['CmContact'][_0xb8e3('0x117')](db[_0xb8e3('0x130')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x72')][_0xb8e3('0x117')](db[_0xb8e3('0x69')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0xb8e3('0x117')](db[_0xb8e3('0x11e')],{'as':'SmsInteractions','foreignKey':_0xb8e3('0x167'),'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x72')][_0xb8e3('0x117')](db[_0xb8e3('0x51')],{'as':_0xb8e3('0x12c'),'foreignKey':_0xb8e3('0x167'),'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x72')][_0xb8e3('0x117')](db[_0xb8e3('0x45')],{'as':_0xb8e3('0x11f'),'foreignKey':_0xb8e3('0x167'),'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x72')][_0xb8e3('0x123')](db[_0xb8e3('0x1a2')],{'as':_0xb8e3('0x1a6'),'foreignKey':_0xb8e3('0x1a3')});db[_0xb8e3('0x72')][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x170'),'foreignKey':_0xb8e3('0x171'),'onDelete':_0xb8e3('0x114')});db['CmContact'][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x18e'),'through':'cm_user_has_contacts'});db[_0xb8e3('0x72')][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'as':_0xb8e3('0x178'),'through':_0xb8e3('0x1a7')});db['CmContact'][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x1a7'),'as':_0xb8e3('0x179')});db[_0xb8e3('0x151')]['hasMany'](db[_0xb8e3('0x90')],{'as':_0xb8e3('0x1a8'),'foreignKey':_0xb8e3('0x1a9')});db[_0xb8e3('0x151')][_0xb8e3('0x123')](db['CmContact'],{'as':_0xb8e3('0x166'),'foreignKey':'ContactId','onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x151')][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x170'),'foreignKey':'ListId','onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x151')]['belongsTo'](db[_0xb8e3('0x112')],{'as':'Agent','foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x151')][_0xb8e3('0x123')](db['VoiceQueue'],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x151')]['belongsTo'](db[_0xb8e3('0xe8')],{'as':_0xb8e3('0xe8'),'foreignKey':_0xb8e3('0x1aa'),'onDelete':'cascade'});db[_0xb8e3('0x151')]['belongsTo'](db['User'],{'as':_0xb8e3('0x188'),'foreignKey':'OwnerId'});db[_0xb8e3('0x154')][_0xb8e3('0x123')](db['CmContact'],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x154')][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x170'),'foreignKey':_0xb8e3('0x171'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x154')][_0xb8e3('0x123')](db[_0xb8e3('0x1a')],{'as':_0xb8e3('0x199'),'foreignKey':_0xb8e3('0x150'),'onDelete':_0xb8e3('0x114')});db['CmHopperBlack']['belongsTo'](db[_0xb8e3('0xe8')],{'as':'Campaign','foreignKey':_0xb8e3('0x1aa'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x7c')]['hasMany'](db[_0xb8e3('0x80')],{'as':{'plural':'All','singular':_0xb8e3('0x1ab')},'foreignKey':_0xb8e3('0x1ac'),'onDelete':_0xb8e3('0x114'),'hooks':!![]});db['Automation'][_0xb8e3('0x117')](db[_0xb8e3('0x80')],{'as':{'plural':_0xb8e3('0x1ad'),'singular':'OneAny'},'foreignKey':_0xb8e3('0x1ae'),'onDelete':_0xb8e3('0x114'),'hooks':!![]});db[_0xb8e3('0x7c')]['hasMany'](db[_0xb8e3('0x1af')],{'as':'Actions','foreignKey':_0xb8e3('0x1b0'),'onDelete':'cascade','hooks':!![]});db['Disposition']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x81')]['hasMany'](db[_0xb8e3('0x81')],{'as':_0xb8e3('0x1b1'),'foreignKey':_0xb8e3('0x15a'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0xb8e3('0x117')](db[_0xb8e3('0x119')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x81')]['hasMany'](db[_0xb8e3('0x48')],{'as':_0xb8e3('0x1b2'),'foreignKey':_0xb8e3('0x15a')});db[_0xb8e3('0x81')][_0xb8e3('0x117')](db['ChatApplication'],{'as':_0xb8e3('0x1b3'),'foreignKey':_0xb8e3('0x15a')});db['Interval']['hasMany'](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0xb8e3('0x15a')});db[_0xb8e3('0x81')][_0xb8e3('0x117')](db[_0xb8e3('0x57')],{'as':_0xb8e3('0x1b4'),'foreignKey':_0xb8e3('0x15a')});db['Schedule'][_0xb8e3('0x123')](db[_0xb8e3('0x40')],{});db[_0xb8e3('0x87')][_0xb8e3('0x123')](db[_0xb8e3('0x1b5')],{'foreignKey':_0xb8e3('0x1b6')});db[_0xb8e3('0x87')][_0xb8e3('0x123')](db['AnalyticCustomReport'],{'foreignKey':_0xb8e3('0x1b7')});db['Sound']['belongsToMany'](db[_0xb8e3('0x19')],{'as':_0xb8e3('0x1b8'),'through':_0xb8e3('0x14f'),'onDelete':_0xb8e3('0x16a')});db['Tag']['belongsToMany'](db[_0xb8e3('0x72')],{'through':'cm_contact_has_tags'});db[_0xb8e3('0x176')]['belongsToMany'](db[_0xb8e3('0x69')],{'through':_0xb8e3('0x19c')});db[_0xb8e3('0x176')][_0xb8e3('0x128')](db[_0xb8e3('0x45')],{'through':_0xb8e3('0x177')});db[_0xb8e3('0x176')]['belongsToMany'](db[_0xb8e3('0x11e')],{'through':_0xb8e3('0x18d')});db['Tag'][_0xb8e3('0x128')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0xb8e3('0x176')][_0xb8e3('0x128')](db['OpenchannelInteraction'],{'through':_0xb8e3('0x194')});db['Tag'][_0xb8e3('0x128')](db[_0xb8e3('0x102')],{'through':'whatsapp_interaction_has_tags'});db['CmContactHasItem'][_0xb8e3('0x123')](db[_0xb8e3('0x8c')],{'as':'ItemType','foreignKey':_0xb8e3('0x1b9')});db['CmHopperAdditionalPhone'][_0xb8e3('0x123')](db['CmHopper'],{'as':_0xb8e3('0x1ba'),'foreignKey':_0xb8e3('0x1a9')});db[_0xb8e3('0x8e')][_0xb8e3('0x123')](db['CmContact'],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x1a5')});db[_0xb8e3('0x93')][_0xb8e3('0x117')](db[_0xb8e3('0x80')],{'as':{'plural':_0xb8e3('0x1bb'),'singular':_0xb8e3('0x1bc')},'foreignKey':_0xb8e3('0x1bd'),'onDelete':_0xb8e3('0x114'),'hooks':!![]});db[_0xb8e3('0x93')][_0xb8e3('0x117')](db[_0xb8e3('0x80')],{'as':{'plural':_0xb8e3('0x1be'),'singular':'AnyCondition'},'foreignKey':_0xb8e3('0x1bf'),'onDelete':_0xb8e3('0x114'),'hooks':!![]});db[_0xb8e3('0x93')][_0xb8e3('0x117')](db[_0xb8e3('0x1af')],{'as':_0xb8e3('0x1c0'),'foreignKey':'TriggerId','onDelete':_0xb8e3('0x114'),'hooks':!![]});db[_0xb8e3('0x99')][_0xb8e3('0x117')](db[_0xb8e3('0x9e')],{'as':_0xb8e3('0x1c1'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1b7'),'hooks':!![]});db[_0xb8e3('0x1b5')][_0xb8e3('0x117')](db[_0xb8e3('0x9e')],{'as':_0xb8e3('0x1c1'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1b6')});db[_0xb8e3('0x9d')][_0xb8e3('0x117')](db[_0xb8e3('0x9e')],{'as':_0xb8e3('0x1c1'),'onDelete':_0xb8e3('0x114'),'foreignKey':'MetricId'});db[_0xb8e3('0x9e')][_0xb8e3('0x123')](db[_0xb8e3('0x9d')],{'foreignKey':_0xb8e3('0x1c2')});db[_0xb8e3('0xa1')][_0xb8e3('0x117')](db['SalesforceConfiguration'],{'as':_0xb8e3('0x1c3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xb8e3('0xa2')][_0xb8e3('0x117')](db[_0xb8e3('0xa3')],{'as':_0xb8e3('0x1c4'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c5')});db[_0xb8e3('0xa2')][_0xb8e3('0x117')](db[_0xb8e3('0xa3')],{'as':_0xb8e3('0x1c6'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0xa2')][_0xb8e3('0x117')](db['SalesforceField'],{'as':_0xb8e3('0x1c1'),'onDelete':'cascade','foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0xa2')][_0xb8e3('0x123')](db[_0xb8e3('0xa1')],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x1c9')});db[_0xb8e3('0xa3')]['hasMany'](db['SalesforceField'],{'as':_0xb8e3('0x1ca'),'foreignKey':_0xb8e3('0x1c5')});db[_0xb8e3('0xa3')][_0xb8e3('0x117')](db[_0xb8e3('0xa3')],{'as':'Description','foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0xa3')]['hasMany'](db[_0xb8e3('0xa3')],{'as':'Field','foreignKey':'FieldId'});db['SalesforceField']['belongsTo'](db[_0xb8e3('0x95')],{'as':_0xb8e3('0x95'),'foreignKey':'VariableId'});db[_0xb8e3('0xa5')][_0xb8e3('0x117')](db[_0xb8e3('0xa7')],{'as':_0xb8e3('0x1c3'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c9')});db[_0xb8e3('0xa7')][_0xb8e3('0x117')](db[_0xb8e3('0xa9')],{'as':_0xb8e3('0x1c4'),'onDelete':_0xb8e3('0x114'),'foreignKey':'SubjectId'});db[_0xb8e3('0xa7')][_0xb8e3('0x117')](db[_0xb8e3('0xa9')],{'as':_0xb8e3('0x1c6'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0xa7')]['hasMany'](db[_0xb8e3('0xa9')],{'as':_0xb8e3('0x1c1'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c8')});db['SugarcrmConfiguration'][_0xb8e3('0x123')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xb8e3('0x1c9')});db[_0xb8e3('0xa9')][_0xb8e3('0x117')](db[_0xb8e3('0xa9')],{'as':_0xb8e3('0x1ca'),'foreignKey':_0xb8e3('0x1c5')});db['SugarcrmField'][_0xb8e3('0x117')](db[_0xb8e3('0xa9')],{'as':'Description','foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0xa9')][_0xb8e3('0x117')](db[_0xb8e3('0xa9')],{'as':_0xb8e3('0x1cb'),'foreignKey':'FieldId'});db[_0xb8e3('0xa9')][_0xb8e3('0x123')](db[_0xb8e3('0x95')],{'as':_0xb8e3('0x95'),'foreignKey':'VariableId'});db[_0xb8e3('0x1cc')][_0xb8e3('0x117')](db['DeskConfiguration'],{'as':_0xb8e3('0x1c3'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c9')});db[_0xb8e3('0x1cd')][_0xb8e3('0x117')](db['DeskField'],{'as':_0xb8e3('0x1c4'),'onDelete':'cascade','foreignKey':_0xb8e3('0x1c5')});db[_0xb8e3('0x1cd')][_0xb8e3('0x117')](db['DeskField'],{'as':_0xb8e3('0x1c6'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0x1cd')][_0xb8e3('0x117')](db[_0xb8e3('0x1ce')],{'as':_0xb8e3('0x1c1'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c8')});db['DeskConfiguration'][_0xb8e3('0x123')](db[_0xb8e3('0x1cc')],{'as':_0xb8e3('0x187'),'foreignKey':'AccountId'});db['DeskConfiguration']['belongsToMany'](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x1cf')});db[_0xb8e3('0x1ce')][_0xb8e3('0x117')](db['DeskField'],{'as':_0xb8e3('0x1ca'),'foreignKey':'SubjectId'});db[_0xb8e3('0x1ce')][_0xb8e3('0x117')](db['DeskField'],{'as':'Description','foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0x1ce')][_0xb8e3('0x117')](db[_0xb8e3('0x1ce')],{'as':'Field','foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0x1ce')]['belongsTo'](db[_0xb8e3('0x95')],{'as':'Variable','foreignKey':'VariableId'});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0xb8e3('0x1c3'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c9')});db['ZohoConfiguration'][_0xb8e3('0x117')](db[_0xb8e3('0xae')],{'as':_0xb8e3('0x1c4'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c5')});db[_0xb8e3('0x1d0')][_0xb8e3('0x117')](db[_0xb8e3('0xae')],{'as':_0xb8e3('0x1c6'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0x1d0')][_0xb8e3('0x117')](db[_0xb8e3('0xae')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db[_0xb8e3('0xab')],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x1c9')});db[_0xb8e3('0xae')][_0xb8e3('0x117')](db[_0xb8e3('0xae')],{'as':_0xb8e3('0x1ca'),'foreignKey':_0xb8e3('0x1c5')});db[_0xb8e3('0xae')][_0xb8e3('0x117')](db['ZohoField'],{'as':_0xb8e3('0x1d1'),'foreignKey':'DescriptionId'});db['ZohoField']['hasMany'](db[_0xb8e3('0xae')],{'as':'Field','foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0xae')][_0xb8e3('0x123')](db['Variable'],{'as':_0xb8e3('0x95'),'foreignKey':_0xb8e3('0x1d2')});db['ZendeskAccount']['hasMany'](db[_0xb8e3('0xb1')],{'as':'Configurations','onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c9')});db[_0xb8e3('0xb1')][_0xb8e3('0x117')](db[_0xb8e3('0x1d3')],{'as':_0xb8e3('0x1c4'),'foreignKey':_0xb8e3('0x1c5')});db['ZendeskConfiguration']['hasMany'](db[_0xb8e3('0x1d3')],{'as':_0xb8e3('0x1c6'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0xb1')][_0xb8e3('0x117')](db[_0xb8e3('0x1d3')],{'as':_0xb8e3('0x1c1'),'foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0xb1')][_0xb8e3('0x123')](db[_0xb8e3('0x1d4')],{'as':_0xb8e3('0x187'),'foreignKey':'AccountId'});db[_0xb8e3('0xb1')][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x1d5')});db[_0xb8e3('0x1d3')][_0xb8e3('0x117')](db[_0xb8e3('0x1d3')],{'as':_0xb8e3('0x1ca'),'foreignKey':_0xb8e3('0x1c5')});db[_0xb8e3('0x1d3')][_0xb8e3('0x117')](db[_0xb8e3('0x1d3')],{'as':_0xb8e3('0x1d1'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0x1d3')][_0xb8e3('0x117')](db[_0xb8e3('0x1d3')],{'as':_0xb8e3('0x1cb'),'foreignKey':'FieldId'});db[_0xb8e3('0x1d3')][_0xb8e3('0x123')](db[_0xb8e3('0x95')],{'as':_0xb8e3('0x95'),'foreignKey':_0xb8e3('0x1d2')});db['FreshdeskAccount']['hasMany'](db['FreshdeskConfiguration'],{'as':_0xb8e3('0x1c3'),'onDelete':_0xb8e3('0x114'),'foreignKey':'AccountId'});db[_0xb8e3('0xb5')][_0xb8e3('0x117')](db[_0xb8e3('0xb7')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0xb8e3('0x117')](db[_0xb8e3('0xb7')],{'as':_0xb8e3('0x1c6'),'onDelete':_0xb8e3('0x114'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0xb8e3('0x117')](db[_0xb8e3('0xb7')],{'as':'Fields','onDelete':_0xb8e3('0x114'),'foreignKey':'FieldId'});db[_0xb8e3('0xb5')]['belongsTo'](db['FreshdeskAccount'],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x1c9')});db[_0xb8e3('0xb5')][_0xb8e3('0x128')](db['Tag'],{'through':_0xb8e3('0x1d6')});db[_0xb8e3('0xb7')][_0xb8e3('0x117')](db[_0xb8e3('0xb7')],{'as':_0xb8e3('0x1ca'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db[_0xb8e3('0xb7')],{'as':_0xb8e3('0x1d1'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0xb7')][_0xb8e3('0x117')](db['FreshdeskField'],{'as':_0xb8e3('0x1cb'),'foreignKey':'FieldId'});db['FreshdeskField']['belongsTo'](db[_0xb8e3('0x95')],{'as':_0xb8e3('0x95'),'foreignKey':_0xb8e3('0x1d2')});db[_0xb8e3('0xb8')][_0xb8e3('0x117')](db[_0xb8e3('0xba')],{'as':_0xb8e3('0x1c3'),'onDelete':_0xb8e3('0x114'),'foreignKey':'AccountId'});db['VtigerConfiguration'][_0xb8e3('0x117')](db[_0xb8e3('0xbb')],{'as':_0xb8e3('0x1c4'),'foreignKey':_0xb8e3('0x1c5')});db[_0xb8e3('0xba')][_0xb8e3('0x117')](db[_0xb8e3('0xbb')],{'as':'Descriptions','foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0xba')][_0xb8e3('0x117')](db[_0xb8e3('0xbb')],{'as':'Fields','foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0xba')][_0xb8e3('0x123')](db[_0xb8e3('0xb8')],{'as':'Account','foreignKey':_0xb8e3('0x1c9')});db[_0xb8e3('0xbb')]['hasMany'](db['VtigerField'],{'as':_0xb8e3('0x1ca'),'foreignKey':_0xb8e3('0x1c5')});db['VtigerField']['hasMany'](db[_0xb8e3('0xbb')],{'as':_0xb8e3('0x1d1'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0xbb')][_0xb8e3('0x117')](db['VtigerField'],{'as':_0xb8e3('0x1cb'),'foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0xbb')][_0xb8e3('0x123')](db[_0xb8e3('0x95')],{'as':_0xb8e3('0x95'),'foreignKey':'VariableId'});db[_0xb8e3('0xbd')][_0xb8e3('0x117')](db[_0xb8e3('0xbf')],{'as':_0xb8e3('0x1c3'),'onDelete':'cascade','foreignKey':'AccountId'});db['ServicenowConfiguration'][_0xb8e3('0x117')](db[_0xb8e3('0x1d7')],{'as':'Subjects','foreignKey':_0xb8e3('0x1c5')});db[_0xb8e3('0xbf')]['hasMany'](db[_0xb8e3('0x1d7')],{'as':_0xb8e3('0x1c6'),'foreignKey':_0xb8e3('0x1c7')});db['ServicenowConfiguration'][_0xb8e3('0x117')](db['ServicenowField'],{'as':_0xb8e3('0x1c1'),'foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0xbf')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xb8e3('0x1c9')});db['ServicenowField'][_0xb8e3('0x117')](db[_0xb8e3('0x1d7')],{'as':_0xb8e3('0x1ca'),'foreignKey':_0xb8e3('0x1c5')});db['ServicenowField'][_0xb8e3('0x117')](db[_0xb8e3('0x1d7')],{'as':_0xb8e3('0x1d1'),'foreignKey':'DescriptionId'});db[_0xb8e3('0x1d7')]['hasMany'](db[_0xb8e3('0x1d7')],{'as':_0xb8e3('0x1cb'),'foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0x1d7')][_0xb8e3('0x123')](db[_0xb8e3('0x95')],{'as':_0xb8e3('0x95'),'foreignKey':_0xb8e3('0x1d2')});db[_0xb8e3('0xc2')]['hasMany'](db[_0xb8e3('0x1d8')],{'as':_0xb8e3('0x1c3'),'onDelete':_0xb8e3('0x114'),'foreignKey':'AccountId'});db[_0xb8e3('0xc2')][_0xb8e3('0x123')](db[_0xb8e3('0x108')],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db[_0xb8e3('0x1d8')][_0xb8e3('0x117')](db[_0xb8e3('0xc4')],{'as':_0xb8e3('0x1c4'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c5')});db[_0xb8e3('0x1d8')][_0xb8e3('0x117')](db[_0xb8e3('0xc4')],{'as':_0xb8e3('0x1c6'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0x1d8')][_0xb8e3('0x117')](db['Dynamics365Field'],{'as':_0xb8e3('0x1c1'),'onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0x1d8')][_0xb8e3('0x123')](db[_0xb8e3('0xc2')],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x1c9')});db[_0xb8e3('0xc4')][_0xb8e3('0x117')](db[_0xb8e3('0xc4')],{'as':_0xb8e3('0x1ca'),'foreignKey':_0xb8e3('0x1c5')});db['Dynamics365Field'][_0xb8e3('0x117')](db['Dynamics365Field'],{'as':_0xb8e3('0x1d1'),'foreignKey':_0xb8e3('0x1c7')});db['Dynamics365Field'][_0xb8e3('0x117')](db[_0xb8e3('0xc4')],{'as':_0xb8e3('0x1cb'),'foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0xc4')][_0xb8e3('0x123')](db['Variable'],{'as':_0xb8e3('0x95'),'foreignKey':'VariableId'});db[_0xb8e3('0xc6')][_0xb8e3('0x117')](db[_0xb8e3('0xc8')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xb8e3('0xc8')][_0xb8e3('0x117')](db[_0xb8e3('0xc9')],{'as':_0xb8e3('0x1c4'),'foreignKey':'SubjectId'});db[_0xb8e3('0xc8')]['hasMany'](db['FreshsalesField'],{'as':_0xb8e3('0x1c6'),'foreignKey':_0xb8e3('0x1c7')});db[_0xb8e3('0xc8')][_0xb8e3('0x117')](db['FreshsalesField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xb8e3('0xc8')][_0xb8e3('0x123')](db[_0xb8e3('0xc6')],{'as':_0xb8e3('0x187'),'foreignKey':'AccountId'});db['FreshsalesField'][_0xb8e3('0x117')](db['FreshsalesField'],{'as':_0xb8e3('0x1ca'),'foreignKey':_0xb8e3('0x1c5')});db['FreshsalesField'][_0xb8e3('0x117')](db[_0xb8e3('0xc9')],{'as':_0xb8e3('0x1d1'),'foreignKey':'DescriptionId'});db[_0xb8e3('0xc9')]['hasMany'](db[_0xb8e3('0xc9')],{'as':_0xb8e3('0x1cb'),'foreignKey':_0xb8e3('0x1c8')});db[_0xb8e3('0xc9')][_0xb8e3('0x123')](db[_0xb8e3('0x95')],{'as':_0xb8e3('0x95'),'foreignKey':_0xb8e3('0x1d2')});db[_0xb8e3('0xcc')][_0xb8e3('0x123')](db[_0xb8e3('0x64')],{});db[_0xb8e3('0xcc')][_0xb8e3('0x123')](db['CmList'],{'as':_0xb8e3('0x170'),'foreignKey':'ListId'});db[_0xb8e3('0xcc')][_0xb8e3('0x123')](db['CmContact'],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0xcc')][_0xb8e3('0x123')](db[_0xb8e3('0x69')],{});db[_0xb8e3('0xcc')]['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport']['belongsTo'](db[_0xb8e3('0x112')],{});db[_0xb8e3('0xcc')][_0xb8e3('0x123')](db[_0xb8e3('0x139')],{});db[_0xb8e3('0xce')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'onDelete':_0xb8e3('0x114'),'foreignKey':'FromId'});db['ChatInternalMessage']['belongsTo'](db[_0xb8e3('0x112')],{'onDelete':_0xb8e3('0x114'),'foreignKey':'ToId'});db[_0xb8e3('0xd3')][_0xb8e3('0x117')](db[_0xb8e3('0xd1')],{'foreignKey':_0xb8e3('0x1d9'),'onDelete':_0xb8e3('0x114')});db['JscriptySessionReport'][_0xb8e3('0x117')](db[_0xb8e3('0xcf')],{'foreignKey':_0xb8e3('0x1d9'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0xd5')]['belongsTo'](db[_0xb8e3('0x55')],{});db[_0xb8e3('0xd5')]['belongsTo'](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x170'),'foreignKey':'ListId'});db[_0xb8e3('0xd5')][_0xb8e3('0x123')](db['CmContact'],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0xd5')][_0xb8e3('0x123')](db[_0xb8e3('0x11e')],{});db[_0xb8e3('0xd5')]['belongsTo'](db[_0xb8e3('0x5a')],{});db[_0xb8e3('0xd5')][_0xb8e3('0x123')](db['User'],{});db[_0xb8e3('0xd5')][_0xb8e3('0x123')](db['SmsQueue'],{});db['JscriptyProject'][_0xb8e3('0x117')](db[_0xb8e3('0xd3')],{'foreignKey':_0xb8e3('0x1da')});db[_0xb8e3('0xda')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xb8e3('0xda')][_0xb8e3('0x117')](db[_0xb8e3('0xcf')],{'foreignKey':_0xb8e3('0x1da')});db[_0xb8e3('0xe4')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':'user_has_teams'});db[_0xb8e3('0xe4')]['belongsToMany'](db['VoiceQueue'],{'through':_0xb8e3('0x10a'),'as':_0xb8e3('0x133')});db[_0xb8e3('0xe4')]['belongsToMany'](db[_0xb8e3('0x137')],{'through':_0xb8e3('0x174'),'as':_0xb8e3('0x138')});db[_0xb8e3('0xe4')]['belongsToMany'](db[_0xb8e3('0x139')],{'through':_0xb8e3('0x19d'),'as':'ChatQueues'});db[_0xb8e3('0xe4')][_0xb8e3('0x128')](db['FaxQueue'],{'through':_0xb8e3('0x18b'),'as':_0xb8e3('0x13b')});db[_0xb8e3('0xe4')]['belongsToMany'](db[_0xb8e3('0x5c')],{'through':'team_has_sms_queues','as':_0xb8e3('0x13c')});db['Team'][_0xb8e3('0x128')](db[_0xb8e3('0x62')],{'through':_0xb8e3('0x1db'),'as':'OpenchannelQueues'});db[_0xb8e3('0xe4')][_0xb8e3('0x128')](db[_0xb8e3('0x1dc')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0xb8e3('0xe4')][_0xb8e3('0x128')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0xb8e3('0x136')});db[_0xb8e3('0xe8')][_0xb8e3('0x117')](db[_0xb8e3('0x151')],{'as':_0xb8e3('0x121'),'foreignKey':_0xb8e3('0x1aa')});db[_0xb8e3('0xe8')][_0xb8e3('0x117')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'CampaignId'});db['Campaign'][_0xb8e3('0x117')](db[_0xb8e3('0x152')],{'as':_0xb8e3('0x153'),'foreignKey':_0xb8e3('0x1aa')});db['Campaign'][_0xb8e3('0x117')](db[_0xb8e3('0x154')],{'as':_0xb8e3('0x155'),'foreignKey':_0xb8e3('0x1aa')});db[_0xb8e3('0xe8')][_0xb8e3('0x123')](db[_0xb8e3('0x157')],{'as':'Trunk','foreignKey':_0xb8e3('0x1dd')});db[_0xb8e3('0xe8')]['belongsTo'](db['Trunk'],{'as':_0xb8e3('0x158'),'foreignKey':_0xb8e3('0x159')});db[_0xb8e3('0xe8')][_0xb8e3('0x123')](db[_0xb8e3('0x81')],{'as':'Interval','foreignKey':_0xb8e3('0x15a')});db[_0xb8e3('0xe8')]['belongsTo'](db[_0xb8e3('0xde')],{'as':'SquareProject','foreignKey':_0xb8e3('0x1de')});db['Campaign'][_0xb8e3('0x128')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x15d'),'through':_0xb8e3('0x1df')});db[_0xb8e3('0xe8')]['belongsToMany'](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x15f'),'through':_0xb8e3('0x1e0')});db[_0xb8e3('0xec')]['belongsTo'](db[_0xb8e3('0x6d')],{'as':_0xb8e3('0x6d'),'foreignKey':_0xb8e3('0x17e')});db[_0xb8e3('0xef')][_0xb8e3('0x123')](db[_0xb8e3('0x46')],{});db[_0xb8e3('0xef')]['belongsTo'](db['MailInteraction'],{});db['MailTransferReport'][_0xb8e3('0x123')](db[_0xb8e3('0x40')],{'foreignKey':_0xb8e3('0x1e1'),'as':_0xb8e3('0x1e2')});db['MailTransferReport'][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'foreignKey':_0xb8e3('0x1e3'),'as':_0xb8e3('0x1e4')});db[_0xb8e3('0xef')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'foreignKey':'ToUserId','as':_0xb8e3('0x1e5')});db[_0xb8e3('0xef')][_0xb8e3('0x123')](db[_0xb8e3('0x137')],{'foreignKey':_0xb8e3('0x1e6'),'as':_0xb8e3('0x1e7')});db[_0xb8e3('0xef')][_0xb8e3('0x123')](db['MailAccount'],{'foreignKey':_0xb8e3('0x1e8'),'as':_0xb8e3('0x1e9')});db[_0xb8e3('0x1ea')]['belongsTo'](db[_0xb8e3('0x6b')],{});db[_0xb8e3('0x1ea')][_0xb8e3('0x123')](db[_0xb8e3('0x69')],{});db[_0xb8e3('0x1ea')][_0xb8e3('0x123')](db[_0xb8e3('0x64')],{'foreignKey':_0xb8e3('0x1eb'),'as':'FromAccount'});db[_0xb8e3('0x1ea')][_0xb8e3('0x123')](db['User'],{'foreignKey':'FromUserId','as':_0xb8e3('0x1e4')});db[_0xb8e3('0x1ea')]['belongsTo'](db[_0xb8e3('0x112')],{'foreignKey':_0xb8e3('0x1ec'),'as':_0xb8e3('0x1e5')});db[_0xb8e3('0x1ea')]['belongsTo'](db[_0xb8e3('0x139')],{'foreignKey':_0xb8e3('0x1ed'),'as':'ToQueue'});db['ChatTransferReport'][_0xb8e3('0x123')](db[_0xb8e3('0x64')],{'foreignKey':_0xb8e3('0x1ee'),'as':_0xb8e3('0x1e9')});db['FaxTransferReport']['belongsTo'](db[_0xb8e3('0x185')],{});db[_0xb8e3('0xf2')][_0xb8e3('0x123')](db[_0xb8e3('0x51')],{});db[_0xb8e3('0xf2')]['belongsTo'](db[_0xb8e3('0x4e')],{'foreignKey':_0xb8e3('0x1ef'),'as':_0xb8e3('0x1e2')});db[_0xb8e3('0xf2')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'foreignKey':_0xb8e3('0x1e3'),'as':_0xb8e3('0x1e4')});db[_0xb8e3('0xf2')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'foreignKey':_0xb8e3('0x1ec'),'as':_0xb8e3('0x1e5')});db[_0xb8e3('0xf2')]['belongsTo'](db[_0xb8e3('0x52')],{'foreignKey':_0xb8e3('0x1f0'),'as':'ToQueue'});db[_0xb8e3('0xf2')][_0xb8e3('0x123')](db[_0xb8e3('0x4e')],{'foreignKey':_0xb8e3('0x1f1'),'as':'ToAccount'});db[_0xb8e3('0xf3')][_0xb8e3('0x123')](db[_0xb8e3('0x60')],{});db['OpenchannelTransferReport'][_0xb8e3('0x123')](db[_0xb8e3('0x130')],{});db[_0xb8e3('0xf3')]['belongsTo'](db[_0xb8e3('0x145')],{'foreignKey':'FromOpenchannelAccountId','as':_0xb8e3('0x1e2')});db[_0xb8e3('0xf3')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'foreignKey':_0xb8e3('0x1e3'),'as':_0xb8e3('0x1e4')});db[_0xb8e3('0xf3')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'foreignKey':_0xb8e3('0x1ec'),'as':'ToAgent'});db[_0xb8e3('0xf3')]['belongsTo'](db[_0xb8e3('0x62')],{'foreignKey':_0xb8e3('0x1f2'),'as':'ToQueue'});db[_0xb8e3('0xf3')][_0xb8e3('0x123')](db[_0xb8e3('0x145')],{'foreignKey':_0xb8e3('0x1f3'),'as':_0xb8e3('0x1e9')});db[_0xb8e3('0xf5')][_0xb8e3('0x123')](db[_0xb8e3('0x5a')],{});db[_0xb8e3('0xf5')][_0xb8e3('0x123')](db[_0xb8e3('0x11e')],{});db['SmsTransferReport'][_0xb8e3('0x123')](db[_0xb8e3('0x55')],{'foreignKey':_0xb8e3('0x1f4'),'as':_0xb8e3('0x1e2')});db[_0xb8e3('0xf5')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'foreignKey':_0xb8e3('0x1e3'),'as':'FromAgent'});db[_0xb8e3('0xf5')]['belongsTo'](db[_0xb8e3('0x112')],{'foreignKey':'ToUserId','as':_0xb8e3('0x1e5')});db[_0xb8e3('0xf5')][_0xb8e3('0x123')](db[_0xb8e3('0x5c')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport']['belongsTo'](db[_0xb8e3('0x55')],{'foreignKey':_0xb8e3('0x1f5'),'as':_0xb8e3('0x1e9')});db[_0xb8e3('0x129')][_0xb8e3('0x117')](db[_0xb8e3('0x16d')],{'as':'Dispositions','foreignKey':_0xb8e3('0x171'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x129')]['hasMany'](db[_0xb8e3('0x79')],{'as':_0xb8e3('0x1f6'),'foreignKey':'ListId'});db['CmList'][_0xb8e3('0x117')](db['CmContact'],{'as':'Contacts','onDelete':_0xb8e3('0x114'),'foreignKey':_0xb8e3('0x171')});db[_0xb8e3('0x129')][_0xb8e3('0x117')](db[_0xb8e3('0x74')],{'as':_0xb8e3('0x11b'),'foreignKey':'ListId'});db[_0xb8e3('0x129')][_0xb8e3('0x117')](db[_0xb8e3('0x152')],{'as':_0xb8e3('0x1f7'),'foreignKey':_0xb8e3('0x171')});db[_0xb8e3('0x129')][_0xb8e3('0x117')](db[_0xb8e3('0x77')],{'as':_0xb8e3('0x77'),'foreignKey':'ListId'});db[_0xb8e3('0x129')][_0xb8e3('0x128')](db[_0xb8e3('0x1a')],{'as':'Queues','through':_0xb8e3('0x1f8')});db[_0xb8e3('0x129')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':_0xb8e3('0x13e')});db[_0xb8e3('0x135')][_0xb8e3('0x117')](db[_0xb8e3('0x119')],{'as':_0xb8e3('0x11a'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0x135')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':'UserVoicePrefix'});db['VoicePrefix']['belongsToMany'](db[_0xb8e3('0xe4')],{'through':_0xb8e3('0x10c'),'as':_0xb8e3('0x175')});db[_0xb8e3('0xf7')]['hasMany'](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x18e'),'foreignKey':_0xb8e3('0x124')});db[_0xb8e3('0xf7')]['hasMany'](db['UserProfileSection'],{'as':_0xb8e3('0x1f9'),'foreignKey':_0xb8e3('0x124'),'onDelete':_0xb8e3('0x114')});db[_0xb8e3('0xf9')][_0xb8e3('0x117')](db[_0xb8e3('0xfb')],{'as':_0xb8e3('0x1fa'),'foreignKey':_0xb8e3('0x1fb'),'onDelete':'cascade'});db[_0xb8e3('0xfe')][_0xb8e3('0x117')](db[_0xb8e3('0x16d')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0xb8e3('0x114')});db[_0xb8e3('0xfe')]['hasMany'](db[_0xb8e3('0x16e')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xb8e3('0x117')](db['WhatsappMessage'],{'as':_0xb8e3('0x161'),'foreignKey':_0xb8e3('0x1fc')});db[_0xb8e3('0xfe')][_0xb8e3('0x117')](db[_0xb8e3('0x102')],{'as':_0xb8e3('0x183')});db['WhatsappAccount']['hasMany'](db[_0xb8e3('0x100')],{'as':_0xb8e3('0x14d'),'foreignKey':_0xb8e3('0x1fc'),'onDelete':_0xb8e3('0x114')});db['WhatsappAccount'][_0xb8e3('0x123')](db['CmList'],{'as':_0xb8e3('0x170'),'foreignKey':'ListId'});db[_0xb8e3('0xfe')][_0xb8e3('0x123')](db[_0xb8e3('0x173')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xb8e3('0xfe')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x15e'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0xb8e3('0x123')](db['User'],{'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x100')][_0xb8e3('0x123')](db[_0xb8e3('0x1dc')],{'onDelete':_0xb8e3('0x16a')});db[_0xb8e3('0x100')][_0xb8e3('0x123')](db[_0xb8e3('0xfe')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xb8e3('0x15a')});db[_0xb8e3('0x100')][_0xb8e3('0x123')](db['Tag'],{'onDelete':_0xb8e3('0x16a'),'foreignKey':'TagId'});db[_0xb8e3('0x102')][_0xb8e3('0x117')](db[_0xb8e3('0x1fd')],{'as':_0xb8e3('0x161'),'onDelete':_0xb8e3('0x114'),'foreignKey':'WhatsappInteractionId'});db[_0xb8e3('0x102')][_0xb8e3('0x123')](db['WhatsappAccount'],{'as':_0xb8e3('0x187'),'foreignKey':'WhatsappAccountId'});db[_0xb8e3('0x102')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x102')][_0xb8e3('0x123')](db['User'],{'as':_0xb8e3('0x188'),'foreignKey':_0xb8e3('0x115')});db[_0xb8e3('0x102')]['belongsToMany'](db[_0xb8e3('0x176')],{'through':_0xb8e3('0x1fe'),'as':'Tags'});db[_0xb8e3('0x102')][_0xb8e3('0x128')](db[_0xb8e3('0x176')],{'through':'whatsapp_interaction_has_tags','as':_0xb8e3('0x179')});db['WhatsappInteraction']['belongsToMany'](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x18e'),'through':'user_has_whatsapp_interactions','foreignKey':_0xb8e3('0x1ff')});db[_0xb8e3('0x1fd')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x112')});db[_0xb8e3('0x1fd')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x166')});db['WhatsappMessage'][_0xb8e3('0x123')](db[_0xb8e3('0x102')],{'onDelete':_0xb8e3('0x114'),'as':_0xb8e3('0x17c'),'foreignKey':_0xb8e3('0x1ff')});db[_0xb8e3('0x1fd')][_0xb8e3('0x123')](db[_0xb8e3('0xfe')],{'as':_0xb8e3('0x187'),'foreignKey':_0xb8e3('0x1fc')});db['WhatsappQueueReport'][_0xb8e3('0x123')](db['WhatsappAccount'],{});db[_0xb8e3('0x200')][_0xb8e3('0x123')](db[_0xb8e3('0x129')],{'as':_0xb8e3('0x170'),'foreignKey':_0xb8e3('0x171')});db[_0xb8e3('0x200')][_0xb8e3('0x123')](db[_0xb8e3('0x72')],{'as':_0xb8e3('0x166'),'foreignKey':_0xb8e3('0x167')});db[_0xb8e3('0x200')]['belongsTo'](db[_0xb8e3('0x102')],{});db['WhatsappQueueReport'][_0xb8e3('0x123')](db[_0xb8e3('0x1dc')],{});db[_0xb8e3('0x200')][_0xb8e3('0x123')](db[_0xb8e3('0x1fd')],{});db[_0xb8e3('0x200')]['belongsTo'](db[_0xb8e3('0x112')],{});db[_0xb8e3('0x106')]['belongsTo'](db[_0xb8e3('0x1fd')],{});db[_0xb8e3('0x106')][_0xb8e3('0x123')](db['WhatsappInteraction'],{});db[_0xb8e3('0x106')][_0xb8e3('0x123')](db['WhatsappAccount'],{'foreignKey':_0xb8e3('0x201'),'as':_0xb8e3('0x1e2')});db['WhatsappTransferReport'][_0xb8e3('0x123')](db[_0xb8e3('0xfe')],{'foreignKey':_0xb8e3('0x202'),'as':_0xb8e3('0x1e9')});db['WhatsappTransferReport'][_0xb8e3('0x123')](db[_0xb8e3('0x1dc')],{'foreignKey':_0xb8e3('0x203'),'as':_0xb8e3('0x1e7')});db['WhatsappTransferReport'][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'foreignKey':_0xb8e3('0x1e3'),'as':_0xb8e3('0x1e4')});db[_0xb8e3('0x106')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'foreignKey':_0xb8e3('0x1ec'),'as':_0xb8e3('0x1e5')});db[_0xb8e3('0x1dc')][_0xb8e3('0x128')](db[_0xb8e3('0x112')],{'as':'Agents','through':_0xb8e3('0x3a'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0xb8e3('0x128')](db[_0xb8e3('0xe4')],{'through':'team_has_whatsapp_queues','as':_0xb8e3('0x175')});db[_0xb8e3('0x10f')][_0xb8e3('0x123')](db[_0xb8e3('0x112')],{'as':_0xb8e3('0x204'),'foreignKey':_0xb8e3('0x115'),'onDelete':_0xb8e3('0x114'),'hooks':!![]});db[_0xb8e3('0x108')][_0xb8e3('0x113')](db[_0xb8e3('0xc2')],{'as':_0xb8e3('0xc2'),'onDelete':'restrict'});db[_0xb8e3('0x108')][_0xb8e3('0x113')](db[_0xb8e3('0x3c')],{'as':_0xb8e3('0x16b'),'onDelete':_0xb8e3('0x16a')});db['CloudProvider']['hasOne'](db[_0xb8e3('0x3e')],{'as':_0xb8e3('0x16c'),'onDelete':_0xb8e3('0x16a')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x281d=['../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','UserId','hasOne','UserSetting','cascade','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','ChatInteraction','FaxInteraction','FaxInteractions','MailInteractions','UserNotifications','SenderId','SET\x20NULL','Groups','chat_group_has_users','belongsToMany','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','UserWhatsappQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_whatsapp_accounts','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperBlacks','JscriptySessions','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','Pause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','ListId','mandatoryDispositionPause','user_has_mail_accounts','Account','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','MailQueueReport','List','FaxAccountId','Exntensions','mandatoryDispositionPauseId','TagId','fax_interaction_has_tags','ThroughTags','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CompanyId','Phones','HopperHistories','ChatInteractions','SmsInteractions','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','ParentId','Intervals','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SubjectId','Subject','Description','DescriptionId','Field','VariableId','Subjects','Descriptions','FieldId','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','SessionId','ProjectId','team_has_mail_queues','FaxQueues','team_has_sms_queues','team_has_openchannel_queues','team_has_whatsapp_queues','VoicePrefix','SquareProject','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToQueue','ToMailAccountId','ChatTransferReport','ToUserId','ToChatQueueId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','CustomFields','Queues','userProfileId','Resources','sectionId','WhatsappMessage','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','motion2','xcall','utf8_general_ci','database','password','username','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack'];(function(_0x4050e4,_0x22cea8){var _0x3ffeac=function(_0x1d7e36){while(--_0x1d7e36){_0x4050e4['push'](_0x4050e4['shift']());}};_0x3ffeac(++_0x22cea8);}(_0x281d,0x195));var _0xd281=function(_0xfff6f6,_0x54e118){_0xfff6f6=_0xfff6f6-0x0;var _0x28766e=_0x281d[_0xfff6f6];return _0x28766e;};'use strict';var config=require(_0xd281('0x0'));var Sequelize=require(_0xd281('0x1'));var _=require('lodash');var jstz=require(_0xd281('0x2'));var timezone=jstz[_0xd281('0x3')]();config[_0xd281('0x1')]=_[_0xd281('0x4')](config[_0xd281('0x1')],{'database':'motion2','username':'xcall','password':_0xd281('0x5'),'options':{'host':_0xd281('0x6'),'port':0xcea,'dialect':_0xd281('0x7'),'dialectOptions':{'charset':_0xd281('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xd281('0x9'),'collate':'utf8_general_ci'}}});config[_0xd281('0xa')]=_[_0xd281('0x4')](config[_0xd281('0xa')],{'database':_0xd281('0xb'),'username':_0xd281('0xc'),'password':_0xd281('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd281('0x7'),'dialectOptions':{'charset':_0xd281('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xd281('0x9'),'collate':_0xd281('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd281('0x1')][_0xd281('0xe')],config[_0xd281('0x1')]['username'],config[_0xd281('0x1')][_0xd281('0xf')],config[_0xd281('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd281('0xa')][_0xd281('0xe')],config[_0xd281('0xa')][_0xd281('0x10')],config['sequelizeHistory'][_0xd281('0xf')],config[_0xd281('0xa')][_0xd281('0x11')])};db[_0xd281('0x12')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x14'));db[_0xd281('0x15')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xd281('0x16')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x17'));db['VoiceExtension']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x18'));db[_0xd281('0x19')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xd281('0x1a')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x1b'));db[_0xd281('0x1c')]=db['sequelize'][_0xd281('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0xd281('0x1d')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x1e'));db[_0xd281('0x1f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x20'));db[_0xd281('0x21')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xd281('0x22')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x23'));db['VoiceDialReport']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x24'));db[_0xd281('0x25')]=db[_0xd281('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0xd281('0x26')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x27'));db['MemberReport']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x28'));db[_0xd281('0x29')]=db[_0xd281('0x1')]['import'](_0xd281('0x2a'));db['VoiceTransferReport']=db['sequelize'][_0xd281('0x13')](_0xd281('0x2b'));db[_0xd281('0x2c')]=db[_0xd281('0x1')]['import'](_0xd281('0x2d'));db['UserVoiceQueue']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xd281('0x2e')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xd281('0x2f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x30'));db[_0xd281('0x31')]=db[_0xd281('0x1')]['import'](_0xd281('0x32'));db[_0xd281('0x33')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x34'));db[_0xd281('0x35')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x36'));db['UserWhatsappQueue']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xd281('0x37')]=db[_0xd281('0x1')]['import'](_0xd281('0x38'));db[_0xd281('0x39')]=db[_0xd281('0x1')]['import'](_0xd281('0x3a'));db['MailAccount']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/mailAccount/mailAccount.model');db[_0xd281('0x3b')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x3c'));db[_0xd281('0x3d')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x3e'));db[_0xd281('0x3f')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0xd281('0x40')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x41'));db['MailApplication']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x42'));db['MailQueueReport']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x43'));db[_0xd281('0x44')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/dashboard/dashboard.model');db[_0xd281('0x45')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x46'));db[_0xd281('0x47')]=db[_0xd281('0x1')]['import'](_0xd281('0x48'));db[_0xd281('0x49')]=db[_0xd281('0x1')]['import']('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db['sequelize'][_0xd281('0x13')](_0xd281('0x4a'));db[_0xd281('0x4b')]=db[_0xd281('0x1')]['import'](_0xd281('0x4c'));db[_0xd281('0x4d')]=db[_0xd281('0x1')]['import'](_0xd281('0x4e'));db[_0xd281('0x4f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x50'));db[_0xd281('0x51')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x52'));db['SmsApplication']=db[_0xd281('0x1')]['import'](_0xd281('0x53'));db[_0xd281('0x54')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x55'));db[_0xd281('0x56')]=db['sequelize']['import'](_0xd281('0x57'));db[_0xd281('0x58')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x59'));db['OpenchannelAccount']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x5a'));db[_0xd281('0x5b')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x5c'));db[_0xd281('0x5d')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize']['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xd281('0x5e')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0xd281('0x5f')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x60'));db[_0xd281('0x61')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x62'));db[_0xd281('0x63')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x64'));db['ChatInteraction']=db[_0xd281('0x1')]['import'](_0xd281('0x65'));db[_0xd281('0x66')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x67'));db['ChatOfflineMessage']=db['sequelize']['import'](_0xd281('0x68'));db[_0xd281('0x69')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x6a'));db[_0xd281('0x6b')]=db[_0xd281('0x1')]['import'](_0xd281('0x6c'));db[_0xd281('0x6d')]=db[_0xd281('0x1')]['import'](_0xd281('0x6e'));db[_0xd281('0x6f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x70'));db[_0xd281('0x71')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x72'));db[_0xd281('0x73')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x74'));db[_0xd281('0x75')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x76'));db[_0xd281('0x77')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xd281('0x78')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x79'));db[_0xd281('0x7a')]=db[_0xd281('0x1')]['import'](_0xd281('0x7b'));db['CmCustomField']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x7c'));db[_0xd281('0x7d')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x7e'));db[_0xd281('0x7f')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x80'));db[_0xd281('0x81')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x82'));db[_0xd281('0x83')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/disposition/disposition.model');db[_0xd281('0x84')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x85'));db[_0xd281('0x86')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x87'));db['Pause']=db[_0xd281('0x1')]['import'](_0xd281('0x88'));db[_0xd281('0x89')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x8a'));db[_0xd281('0x8b')]=db[_0xd281('0x1')]['import'](_0xd281('0x8c'));db['Schedule']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/schedule/schedule.model');db[_0xd281('0x8d')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x8e'));db[_0xd281('0x8f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x90'));db[_0xd281('0x91')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x92'));db[_0xd281('0x93')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x94'));db['CmHopperAdditionalPhone']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xd281('0x95')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x96'));db[_0xd281('0x97')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x98'));db[_0xd281('0x99')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x9a'));db[_0xd281('0x9b')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x9c'));db[_0xd281('0x9d')]=db[_0xd281('0x1')]['import'](_0xd281('0x9e'));db[_0xd281('0x9f')]=db['sequelize']['import'](_0xd281('0xa0'));db[_0xd281('0xa1')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xa2'));db[_0xd281('0xa3')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xa4'));db[_0xd281('0xa5')]=db['sequelize'][_0xd281('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xd281('0xa6')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xa7'));db[_0xd281('0xa8')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xa9'));db['SalesforceAccount']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xaa'));db[_0xd281('0xab')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xac'));db[_0xd281('0xad')]=db[_0xd281('0x1')]['import'](_0xd281('0xae'));db[_0xd281('0xaf')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xb0'));db[_0xd281('0xb1')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xb2'));db[_0xd281('0xb3')]=db['sequelize'][_0xd281('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xd281('0xb4')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xb5'));db['DeskConfiguration']=db['sequelize'][_0xd281('0x13')](_0xd281('0xb6'));db['DeskField']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/intDeskField/intDeskField.model');db[_0xd281('0xb7')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xb8'));db['ZohoConfiguration']=db['sequelize']['import'](_0xd281('0xb9'));db[_0xd281('0xba')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xbb'));db['ZendeskAccount']=db[_0xd281('0x1')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xd281('0xbc')]=db[_0xd281('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xd281('0xbd')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xbe'));db[_0xd281('0xbf')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xc0'));db['FreshdeskField']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xc1'));db[_0xd281('0xc2')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xc3'));db[_0xd281('0xc4')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xc5'));db[_0xd281('0xc6')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xc7'));db[_0xd281('0xc8')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xc9'));db['ServicenowConfiguration']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xca'));db[_0xd281('0xcb')]=db[_0xd281('0x1')]['import'](_0xd281('0xcc'));db[_0xd281('0xcd')]=db['sequelize']['import'](_0xd281('0xce'));db[_0xd281('0xcf')]=db['sequelize'][_0xd281('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xd281('0xd0')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xd281('0xd1')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xd2'));db['FreshsalesConfiguration']=db[_0xd281('0x1')]['import'](_0xd281('0xd3'));db[_0xd281('0xd4')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xd5'));db[_0xd281('0x9b')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/integration/integration.model');db[_0xd281('0xd6')]=db[_0xd281('0x1')]['import'](_0xd281('0xd7'));db['ChatQueueReport']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0xd281('0xd8')]=db[_0xd281('0x1')]['import'](_0xd281('0xd9'));db[_0xd281('0xda')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xdb'));db[_0xd281('0xdc')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xd281('0xdd')]=db['sequelize'][_0xd281('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xd281('0xde')]=db[_0xd281('0x1')]['import'](_0xd281('0xdf'));db['SquareReport']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xe0'));db[_0xd281('0xe1')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0xd281('0xe2')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xe3'));db[_0xd281('0xe4')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xe5'));db[_0xd281('0xe6')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xe7'));db['SquareProject']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xe8'));db[_0xd281('0xe9')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xea'));db[_0xd281('0xeb')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xec'));db[_0xd281('0xed')]=db[_0xd281('0x1')]['import'](_0xd281('0xee'));db[_0xd281('0xef')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xf0'));db[_0xd281('0xf1')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xf2'));db[_0xd281('0xf3')]=db[_0xd281('0x1')]['import'](_0xd281('0xf4'));db[_0xd281('0xf5')]=db['sequelize'][_0xd281('0x13')]('../api/attachment/attachment.model');db[_0xd281('0xf6')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xf7'));db[_0xd281('0xf8')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xf9'));db['ChatTransferReport']=db[_0xd281('0x1')]['import'](_0xd281('0xfa'));db['FaxTransferReport']=db['sequelize'][_0xd281('0x13')](_0xd281('0xfb'));db[_0xd281('0xfc')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xfd'));db[_0xd281('0xfe')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xff'));db[_0xd281('0x100')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x101'));db['VoicePrefix']=db['sequelize']['import'](_0xd281('0x102'));db[_0xd281('0x103')]=db[_0xd281('0x1')]['import'](_0xd281('0x104'));db[_0xd281('0x105')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x106'));db[_0xd281('0x107')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x108'));db[_0xd281('0x109')]=db['sequelize'][_0xd281('0x13')]('../api/userNotification/userNotification.model');db[_0xd281('0x10a')]=db['sequelize']['import'](_0xd281('0x10b'));db[_0xd281('0x10c')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x10d'));db[_0xd281('0x10e')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x10f'));db['WhatsappMessage']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x110'));db[_0xd281('0x111')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x112'));db[_0xd281('0x113')]=db['sequelize']['import'](_0xd281('0x114'));db['WhatsappQueue']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x115'));db[_0xd281('0x116')]=db[_0xd281('0x1')]['import'](_0xd281('0x117'));db[_0xd281('0x118')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xd281('0x119')]=db[_0xd281('0x1')]['import'](_0xd281('0x11a'));db[_0xd281('0x11b')]=db['sequelize'][_0xd281('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x11c'));db[_0xd281('0x11d')]=db[_0xd281('0x1')]['import'](_0xd281('0x11e'));db[_0xd281('0x12')]['hasOne'](db[_0xd281('0x1f')],{'as':_0xd281('0x1f'),'onDelete':'cascade','foreignKey':_0xd281('0x11f')});db['User'][_0xd281('0x120')](db[_0xd281('0x121')],{'as':'userSetting','onDelete':_0xd281('0x122'),'foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db['VoiceRecording'],{'as':_0xd281('0x124'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')][_0xd281('0x123')](db['UserVoiceQueueRt'],{'as':_0xd281('0x125'),'foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db[_0xd281('0x126')],{'as':_0xd281('0x127'),'onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x12')][_0xd281('0x123')](db['CmHopperFinal'],{'as':_0xd281('0x128'),'foreignKey':'UserId'});db['User']['hasMany'](db['CmHopperHistory'],{'as':_0xd281('0x129'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')]['hasMany'](db[_0xd281('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db[_0xd281('0x12a')],{'as':'ChatInteractions','foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')][_0xd281('0x123')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db[_0xd281('0x12b')],{'as':_0xd281('0x12c'),'foreignKey':_0xd281('0x11f')});db['User'][_0xd281('0x123')](db['MailInteraction'],{'as':_0xd281('0x12d'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')]['hasMany'](db[_0xd281('0x10e')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db[_0xd281('0x109')],{'as':_0xd281('0x12e'),'foreignKey':_0xd281('0x12f')});db[_0xd281('0x12')]['hasMany'](db[_0xd281('0x73')],{'as':'Hoppers','foreignKey':_0xd281('0x11f'),'onDelete':_0xd281('0x130')});db[_0xd281('0x12')]['belongsTo'](db[_0xd281('0x103')],{'as':_0xd281('0x103'),'foreignKey':'userProfileId'});db['User']['belongsToMany'](db[_0xd281('0x6b')],{'as':_0xd281('0x131'),'through':_0xd281('0x132')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x71')],{'as':_0xd281('0x134'),'through':'cm_user_has_contacts'});db[_0xd281('0x12')]['belongsToMany'](db['CmList'],{'as':_0xd281('0x135'),'through':_0xd281('0x136')});db['User'][_0xd281('0x133')](db['Team'],{'through':_0xd281('0x137')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x3f')],{'as':_0xd281('0x12d'),'through':_0xd281('0x138')});db['User'][_0xd281('0x133')](db[_0xd281('0x12a')],{'as':'ChatInteractions','through':_0xd281('0x139')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x12b')],{'as':_0xd281('0x12c'),'through':_0xd281('0x13a')});db['User']['belongsToMany'](db[_0xd281('0x54')],{'as':'SmsInteractions','through':_0xd281('0x13b')});db[_0xd281('0x12')]['belongsToMany'](db[_0xd281('0x5d')],{'as':_0xd281('0x13c'),'through':'user_has_openchannel_interactions'});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x10e')],{'as':_0xd281('0x13d'),'through':_0xd281('0x13e')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x1a')],{'as':_0xd281('0x13f'),'through':_0xd281('0x140'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db['VoicePrefix'],{'as':_0xd281('0x141'),'through':'UserVoicePrefix','required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x3b')],{'as':_0xd281('0x142'),'through':_0xd281('0x2f'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db['ChatQueue'],{'as':_0xd281('0x143'),'through':_0xd281('0x2e'),'required':![],'hooks':!![]});db[_0xd281('0x12')][_0xd281('0x133')](db['FaxQueue'],{'as':'FaxQueues','through':_0xd281('0x31'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x58')],{'as':_0xd281('0x144'),'through':_0xd281('0x33'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x5e')],{'as':_0xd281('0x145'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xd281('0x133')](db[_0xd281('0x146')],{'as':_0xd281('0x147'),'through':_0xd281('0x148'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x100')],{'through':_0xd281('0x136')});db['User']['belongsToMany'](db[_0xd281('0x5f')],{'as':_0xd281('0x149'),'through':_0xd281('0x14a')});db['User'][_0xd281('0x133')](db['FaxAccount'],{'as':_0xd281('0x14b'),'through':_0xd281('0x14c')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x14d')],{'as':_0xd281('0x14e'),'through':'user_has_mail_accounts'});db['User']['belongsToMany'](db[_0xd281('0x14f')],{'as':_0xd281('0x150'),'through':_0xd281('0x151')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x51')],{'as':_0xd281('0x152'),'through':'user_has_sms_accounts'});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x10a')],{'as':'WhatsappAccounts','through':_0xd281('0x153')});db['VoiceChanSpy'][_0xd281('0x123')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x154')});db[_0xd281('0x16')][_0xd281('0x123')](db[_0xd281('0x126')],{'onDelete':_0xd281('0x122')});db[_0xd281('0x126')][_0xd281('0x123')](db[_0xd281('0x126')],{'as':_0xd281('0x155'),'onDelete':_0xd281('0x122')});db['VoiceMusicOnHold'][_0xd281('0x133')](db[_0xd281('0x8d')],{'as':_0xd281('0x156'),'through':_0xd281('0x157')});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x2c')],{'as':_0xd281('0x158'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xd281('0x73')],{'as':_0xd281('0x159'),'foreignKey':_0xd281('0x15a')});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x77')],{'as':_0xd281('0x128'),'foreignKey':'VoiceQueueId'});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x78')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x7a')],{'as':_0xd281('0x7a'),'foreignKey':_0xd281('0x15a')});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x75')],{'as':_0xd281('0x15b'),'foreignKey':'VoiceQueueId'});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0xdd')],{'as':_0xd281('0x15c'),'foreignKey':_0xd281('0x15a')});db['VoiceQueue'][_0xd281('0x15d')](db[_0xd281('0x29')],{'as':_0xd281('0x29'),'foreignKey':'TrunkId'});db[_0xd281('0x1a')][_0xd281('0x15d')](db[_0xd281('0x29')],{'as':_0xd281('0x15e'),'foreignKey':_0xd281('0x15f')});db[_0xd281('0x1a')][_0xd281('0x15d')](db[_0xd281('0x86')],{'as':'Interval','foreignKey':_0xd281('0x160')});db[_0xd281('0x1a')]['belongsTo'](db[_0xd281('0x161')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xd281('0x133')](db[_0xd281('0x100')],{'as':_0xd281('0x135'),'through':_0xd281('0x162')});db[_0xd281('0x1a')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x140')});db['VoiceQueue'][_0xd281('0x133')](db[_0xd281('0xed')],{'as':_0xd281('0x164'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0xd281('0x133')](db['CmList'],{'as':_0xd281('0x165'),'through':_0xd281('0x166')});db[_0xd281('0x1c')][_0xd281('0x15d')](db['User'],{'as':_0xd281('0x12'),'foreignKey':_0xd281('0x11f')});db['ScreenRecording']['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x12'),'foreignKey':'UserId'});db['VoiceMail']['hasMany'](db[_0xd281('0x21')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x168'),'sourceKey':'mailbox'});db[_0xd281('0x21')][_0xd281('0x15d')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0xd281('0x22')][_0xd281('0x123')](db[_0xd281('0x26')],{'as':_0xd281('0x169'),'foreignKey':_0xd281('0x16a'),'constraints':![]});db[_0xd281('0x22')][_0xd281('0x123')](db[_0xd281('0x25')],{'as':_0xd281('0x16b'),'foreignKey':'uniqueid','constraints':![]});db[_0xd281('0x22')][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x12'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x22')]['belongsTo'](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x37')][_0xd281('0x15d')](db['MailAccount'],{'as':_0xd281('0x14d'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x37')]['belongsTo'](db['CloudProvider'],{'as':_0xd281('0x116'),'foreignKey':_0xd281('0x16f'),'onDelete':_0xd281('0x170')});db['MailServerOut'][_0xd281('0x15d')](db[_0xd281('0x14d')],{'as':_0xd281('0x14d'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x39')][_0xd281('0x15d')](db[_0xd281('0x116')],{'as':'CloudProvider','foreignKey':_0xd281('0x16f'),'onDelete':_0xd281('0x170')});db['MailAccount'][_0xd281('0x120')](db['MailServerIn'],{'as':_0xd281('0x171'),'onDelete':_0xd281('0x122')});db[_0xd281('0x14d')][_0xd281('0x120')](db[_0xd281('0x39')],{'as':_0xd281('0x172'),'onDelete':_0xd281('0x122')});db[_0xd281('0x14d')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':'MailAccountId','onDelete':'cascade'});db['MailAccount'][_0xd281('0x123')](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':'MailAccountId'});db[_0xd281('0x14d')][_0xd281('0x123')](db[_0xd281('0x40')],{'as':_0xd281('0x167'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x14d')][_0xd281('0x123')](db['MailInteraction'],{'as':_0xd281('0x175')});db['MailAccount'][_0xd281('0x123')](db[_0xd281('0x176')],{'as':_0xd281('0x155'),'foreignKey':_0xd281('0x16e'),'onDelete':'cascade'});db['MailAccount'][_0xd281('0x15d')](db['CmList'],{'as':'List','foreignKey':_0xd281('0x177')});db[_0xd281('0x14d')][_0xd281('0x15d')](db[_0xd281('0x95')],{'as':_0xd281('0x95'),'foreignKey':'TemplateId'});db[_0xd281('0x14d')][_0xd281('0x15d')](db['Pause'],{'as':_0xd281('0x178'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd281('0x14d')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Agents','through':_0xd281('0x179')});db['MailQueue'][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Agents','through':_0xd281('0x2f')});db['MailQueue'][_0xd281('0x133')](db[_0xd281('0xed')],{'through':'team_has_mail_queues','as':_0xd281('0x164')});db[_0xd281('0x3f')][_0xd281('0x123')](db[_0xd281('0x40')],{'as':'Messages','onDelete':_0xd281('0x122'),'foreignKey':'MailInteractionId'});db[_0xd281('0x3f')][_0xd281('0x15d')](db[_0xd281('0x14d')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x3f')][_0xd281('0x15d')](db['CmContact'],{'as':'Contact','foreignKey':_0xd281('0x16d')});db[_0xd281('0x3f')][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x17b'),'foreignKey':_0xd281('0x11f')});db['MailInteraction'][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x17c'),'as':_0xd281('0x17d')});db[_0xd281('0x3f')]['belongsToMany'](db[_0xd281('0x8f')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0xd281('0x3f')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x138'),'foreignKey':_0xd281('0x17f')});db['MailMessage']['hasMany'](db[_0xd281('0xf5')],{'as':_0xd281('0x180'),'onDelete':_0xd281('0x122')});db[_0xd281('0x40')][_0xd281('0x15d')](db['User'],{'as':_0xd281('0x12')});db[_0xd281('0x40')]['belongsTo'](db['CmContact'],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c')});db[_0xd281('0x40')]['belongsTo'](db[_0xd281('0x3f')],{'as':_0xd281('0x181'),'foreignKey':_0xd281('0x17f')});db[_0xd281('0x40')][_0xd281('0x15d')](db['MailAccount'],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x40')][_0xd281('0x15d')](db[_0xd281('0x5f')],{'as':'ChatWebsite','foreignKey':_0xd281('0x182')});db['MailMessage'][_0xd281('0x15d')](db['ChatOfflineMessage'],{'as':_0xd281('0x183'),'foreignKey':'ChatOfflineMessageId'});db[_0xd281('0x176')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x176')][_0xd281('0x15d')](db[_0xd281('0x3b')],{'onDelete':'restrict'});db[_0xd281('0x176')]['belongsTo'](db[_0xd281('0x14d')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x176')][_0xd281('0x15d')](db[_0xd281('0x86')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x160')});db[_0xd281('0x176')][_0xd281('0x15d')](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':'TagId'});db[_0xd281('0x184')]['belongsTo'](db[_0xd281('0x14d')],{});db[_0xd281('0x184')]['belongsTo'](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x184')]['belongsTo'](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':'ContactId'});db[_0xd281('0x184')]['belongsTo'](db[_0xd281('0x3f')],{});db[_0xd281('0x184')][_0xd281('0x15d')](db['MailMessage'],{});db['MailQueueReport'][_0xd281('0x15d')](db['User'],{});db['MailQueueReport'][_0xd281('0x15d')](db[_0xd281('0x3b')],{});db['Dashboard'][_0xd281('0x123')](db['DashboardItem'],{'as':'Items','onDelete':_0xd281('0x122')});db[_0xd281('0x47')][_0xd281('0x123')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xd281('0x186'),'onDelete':'cascade'});db[_0xd281('0x47')]['hasMany'](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':_0xd281('0x186')});db[_0xd281('0x47')][_0xd281('0x123')](db[_0xd281('0x12b')],{'as':_0xd281('0x175')});db[_0xd281('0x47')][_0xd281('0x123')](db[_0xd281('0x49')],{'as':_0xd281('0x155'),'foreignKey':_0xd281('0x186'),'onDelete':_0xd281('0x122')});db[_0xd281('0x47')][_0xd281('0x123')](db[_0xd281('0x126')],{'as':_0xd281('0x187'),'onDelete':_0xd281('0x122')});db[_0xd281('0x47')][_0xd281('0x123')](db[_0xd281('0x4b')],{'as':'Messages'});db[_0xd281('0x47')][_0xd281('0x15d')](db['Trunk'],{'as':'Trunk'});db[_0xd281('0x47')][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x47')][_0xd281('0x15d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xd281('0x188')});db[_0xd281('0x47')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Agents','through':_0xd281('0x14c')});db[_0xd281('0x49')][_0xd281('0x15d')](db['User'],{'onDelete':_0xd281('0x170')});db['FaxApplication'][_0xd281('0x15d')](db['FaxQueue'],{'onDelete':'restrict'});db[_0xd281('0x49')][_0xd281('0x15d')](db[_0xd281('0x47')],{'onDelete':_0xd281('0x170')});db['FaxApplication']['belongsTo'](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x189')});db['FaxInteraction']['hasMany'](db[_0xd281('0x4b')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':'FaxInteractionId'});db[_0xd281('0x12b')][_0xd281('0x15d')](db[_0xd281('0x47')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x186')});db[_0xd281('0x12b')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x12b')]['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x17b'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x12b')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':'fax_interaction_has_tags','as':_0xd281('0x17d')});db[_0xd281('0x12b')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x18a'),'as':_0xd281('0x18b')});db[_0xd281('0x12b')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x13a'),'foreignKey':'FaxInteractionId'});db[_0xd281('0x4b')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x12')});db['FaxMessage'][_0xd281('0x15d')](db[_0xd281('0x12b')],{'as':_0xd281('0x181'),'foreignKey':_0xd281('0x18c')});db[_0xd281('0x4b')]['belongsTo'](db[_0xd281('0x71')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c')});db[_0xd281('0x4b')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xd281('0x4b')]['belongsTo'](db[_0xd281('0x47')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x186')});db[_0xd281('0x4d')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x31')});db[_0xd281('0x4d')]['belongsToMany'](db[_0xd281('0xed')],{'through':_0xd281('0x18d'),'as':_0xd281('0x164')});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x47')],{});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':'ListId'});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x12b')],{});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x4b')],{});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x12')],{});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x4d')],{});db['SmsAccount'][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':_0xd281('0x18e'),'onDelete':_0xd281('0x122')});db[_0xd281('0x51')]['hasMany'](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xd281('0x123')](db[_0xd281('0x56')],{'as':_0xd281('0x167'),'foreignKey':'SmsAccountId'});db[_0xd281('0x51')]['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount'][_0xd281('0x123')](db[_0xd281('0x18f')],{'as':'Applications','foreignKey':_0xd281('0x18e'),'onDelete':_0xd281('0x122')});db[_0xd281('0x51')][_0xd281('0x15d')](db['CmList'],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db['SmsAccount'][_0xd281('0x15d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xd281('0x188')});db[_0xd281('0x51')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':'user_has_sms_accounts'});db[_0xd281('0x18f')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x18f')][_0xd281('0x15d')](db[_0xd281('0x58')],{'onDelete':'restrict'});db[_0xd281('0x18f')]['belongsTo'](db['SmsAccount'],{'onDelete':_0xd281('0x170')});db[_0xd281('0x18f')]['belongsTo'](db[_0xd281('0x86')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x160')});db[_0xd281('0x18f')][_0xd281('0x15d')](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x189')});db['SmsInteraction'][_0xd281('0x123')](db[_0xd281('0x56')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':'SmsInteractionId'});db[_0xd281('0x54')][_0xd281('0x15d')](db[_0xd281('0x51')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x18e')});db[_0xd281('0x54')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':'ContactId'});db['SmsInteraction'][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':'Owner','foreignKey':_0xd281('0x11f')});db[_0xd281('0x54')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x190'),'as':_0xd281('0x17d')});db[_0xd281('0x54')]['belongsToMany'](db['Tag'],{'through':_0xd281('0x190'),'as':_0xd281('0x18b')});db[_0xd281('0x54')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x13b'),'foreignKey':_0xd281('0x191')});db[_0xd281('0x56')][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x12')});db['SmsMessage']['belongsTo'](db[_0xd281('0x71')],{'onDelete':_0xd281('0x122'),'as':'Contact'});db[_0xd281('0x56')]['belongsTo'](db[_0xd281('0x54')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x181'),'foreignKey':_0xd281('0x191')});db['SmsMessage'][_0xd281('0x15d')](db[_0xd281('0x51')],{'as':'Account','foreignKey':_0xd281('0x18e')});db['SmsQueue'][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x33'),'foreignKey':_0xd281('0x192')});db[_0xd281('0x58')][_0xd281('0x133')](db[_0xd281('0xed')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xd281('0x14f')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0xd281('0x14f')]['hasMany'](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':_0xd281('0x193')});db['OpenchannelAccount'][_0xd281('0x123')](db[_0xd281('0x5d')],{'as':_0xd281('0x175'),'foreignKey':_0xd281('0x193')});db[_0xd281('0x14f')][_0xd281('0x123')](db[_0xd281('0x194')],{'as':_0xd281('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0xd281('0x14f')]['hasMany'](db[_0xd281('0x5b')],{'as':_0xd281('0x155'),'foreignKey':'OpenchannelAccountId','onDelete':_0xd281('0x122')});db['OpenchannelAccount']['belongsTo'](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x14f')]['belongsTo'](db[_0xd281('0x161')],{'as':_0xd281('0x178'),'foreignKey':_0xd281('0x188')});db[_0xd281('0x14f')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x151')});db[_0xd281('0x5b')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x5b')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x195')});db[_0xd281('0x5b')][_0xd281('0x15d')](db[_0xd281('0x14f')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x193')});db[_0xd281('0x5b')][_0xd281('0x15d')](db[_0xd281('0x86')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x160')});db['OpenchannelApplication']['belongsTo'](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':'TagId'});db[_0xd281('0x5d')][_0xd281('0x123')](db[_0xd281('0x194')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x196')});db[_0xd281('0x5d')][_0xd281('0x15d')](db[_0xd281('0x14f')],{'as':_0xd281('0x17a'),'foreignKey':'OpenchannelAccountId'});db[_0xd281('0x5d')]['belongsTo'](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x5d')][_0xd281('0x15d')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xd281('0x5d')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x197'),'as':_0xd281('0x17d')});db[_0xd281('0x5d')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x197'),'as':_0xd281('0x18b')});db[_0xd281('0x5d')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x198'),'foreignKey':'OpenchannelInteractionId'});db[_0xd281('0x194')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x12')});db[_0xd281('0x194')]['belongsTo'](db[_0xd281('0x71')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c')});db['OpenchannelMessage']['belongsTo'](db[_0xd281('0x5d')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x181'),'foreignKey':_0xd281('0x196')});db[_0xd281('0x194')]['belongsTo'](db['Attachment'],{'as':_0xd281('0xf5'),'foreignKey':_0xd281('0x199')});db['OpenchannelMessage']['belongsTo'](db[_0xd281('0x14f')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x193')});db['OpenchannelQueue'][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':'UserOpenchannelQueue','foreignKey':_0xd281('0x195')});db[_0xd281('0x5e')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0xd281('0x164')});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':_0xd281('0x182'),'onDelete':'cascade'});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':_0xd281('0x182')});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x6d')],{'as':_0xd281('0x19a')});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x12a')],{'as':_0xd281('0x175')});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x63')],{'as':'Applications','foreignKey':'ChatWebsiteId','onDelete':_0xd281('0x122')});db['ChatWebsite']['hasMany'](db[_0xd281('0x66')],{'as':_0xd281('0x167')});db[_0xd281('0x5f')][_0xd281('0x15d')](db['CmList'],{'as':'List','foreignKey':_0xd281('0x177')});db['ChatWebsite'][_0xd281('0x15d')](db[_0xd281('0x86')],{'as':_0xd281('0x86'),'foreignKey':_0xd281('0x160')});db[_0xd281('0x5f')][_0xd281('0x15d')](db[_0xd281('0x14d')],{'as':_0xd281('0x14d'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x5f')]['belongsTo'](db[_0xd281('0x161')],{'as':_0xd281('0x178'),'foreignKey':_0xd281('0x188')});db[_0xd281('0x5f')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x14a')});db[_0xd281('0x61')]['belongsTo'](db['OpenchannelAccount'],{});db[_0xd281('0x61')][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':'List','foreignKey':'ListId'});db['OpenchannelQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xd281('0x16d')});db['OpenchannelQueueReport'][_0xd281('0x15d')](db[_0xd281('0x5d')],{});db[_0xd281('0x61')]['belongsTo'](db[_0xd281('0x194')],{});db[_0xd281('0x61')][_0xd281('0x15d')](db['User'],{});db[_0xd281('0x61')][_0xd281('0x15d')](db['OpenchannelQueue'],{});db['ChatApplication']['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x19b'),'foreignKey':_0xd281('0x11f'),'onDelete':_0xd281('0x170')});db[_0xd281('0x63')][_0xd281('0x15d')](db[_0xd281('0x69')],{'as':_0xd281('0x19c'),'foreignKey':_0xd281('0x19d'),'onDelete':'restrict'});db[_0xd281('0x63')]['belongsTo'](db[_0xd281('0x5f')],{'as':_0xd281('0x19e'),'foreignKey':_0xd281('0x182'),'onDelete':_0xd281('0x170')});db['ChatApplication'][_0xd281('0x15d')](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x189')});db['ChatInteraction'][_0xd281('0x123')](db[_0xd281('0x66')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x19f')});db[_0xd281('0x12a')]['belongsTo'](db[_0xd281('0x5f')],{'as':'Account','foreignKey':_0xd281('0x182')});db[_0xd281('0x12a')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':'Contact','foreignKey':_0xd281('0x16d')});db[_0xd281('0x12a')]['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x17b'),'foreignKey':_0xd281('0x11f')});db['ChatInteraction']['belongsToMany'](db[_0xd281('0x8f')],{'through':_0xd281('0x1a0'),'as':_0xd281('0x17d')});db[_0xd281('0x12a')]['belongsToMany'](db[_0xd281('0x8f')],{'through':'chat_interaction_has_tags','as':_0xd281('0x18b')});db[_0xd281('0x12a')][_0xd281('0x133')](db['User'],{'as':'Users','through':_0xd281('0x139'),'foreignKey':_0xd281('0x19f')});db[_0xd281('0x66')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x12')});db[_0xd281('0x66')][_0xd281('0x15d')](db[_0xd281('0x71')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0xd281('0x66')][_0xd281('0x15d')](db[_0xd281('0x12a')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x181'),'foreignKey':_0xd281('0x19f')});db[_0xd281('0x66')][_0xd281('0x15d')](db['Attachment'],{'as':'Attachment','foreignKey':_0xd281('0x199')});db[_0xd281('0x66')]['belongsTo'](db[_0xd281('0x5f')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x182')});db['ChatOfflineMessage'][_0xd281('0x123')](db[_0xd281('0xf5')],{'as':_0xd281('0x180'),'foreignKey':_0xd281('0x1a1'),'onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x183')]['belongsTo'](db[_0xd281('0x71')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x183')][_0xd281('0x15d')](db[_0xd281('0x5f')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x182')});db[_0xd281('0x69')][_0xd281('0x133')](db['User'],{'as':_0xd281('0x163'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xd281('0x133')](db[_0xd281('0xed')],{'through':_0xd281('0x1a2'),'as':'Teams'});db['ChatGroup'][_0xd281('0x123')](db[_0xd281('0xd8')],{'as':_0xd281('0x167'),'foreignKey':_0xd281('0x1a3'),'onDelete':_0xd281('0x122')});db[_0xd281('0x6b')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Members','through':'chat_group_has_users'});db[_0xd281('0x6d')]['belongsTo'](db[_0xd281('0x5f')],{'as':_0xd281('0x19e'),'foreignKey':_0xd281('0x182')});db[_0xd281('0x6f')]['hasMany'](db[_0xd281('0x71')],{'as':_0xd281('0x134'),'foreignKey':_0xd281('0x1a4')});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x93')],{'as':_0xd281('0x1a5'),'foreignKey':'CmContactId'});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x73')],{'as':'Hoppers','foreignKey':_0xd281('0x16d')});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x77')],{'as':'HopperFinals','foreignKey':_0xd281('0x16d')});db['CmContact']['hasMany'](db['CmHopperHistory'],{'as':_0xd281('0x1a6'),'foreignKey':_0xd281('0x16d')});db['CmContact'][_0xd281('0x123')](db[_0xd281('0x7a')],{'as':_0xd281('0x7a'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x71')][_0xd281('0x123')](db['JscriptySessionReport'],{'as':_0xd281('0x15c'),'foreignKey':'ContactId'});db['CmContact'][_0xd281('0x123')](db[_0xd281('0x5d')],{'as':_0xd281('0x13c'),'foreignKey':'ContactId','onDelete':_0xd281('0x170')});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x12a')],{'as':_0xd281('0x1a7'),'foreignKey':_0xd281('0x16d'),'onDelete':_0xd281('0x170')});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x54')],{'as':_0xd281('0x1a8'),'foreignKey':_0xd281('0x16d'),'onDelete':'restrict'});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x12b')],{'as':'FaxInteractions','foreignKey':_0xd281('0x16d'),'onDelete':_0xd281('0x170')});db['CmContact'][_0xd281('0x123')](db[_0xd281('0x3f')],{'as':_0xd281('0x12d'),'foreignKey':_0xd281('0x16d'),'onDelete':_0xd281('0x170')});db[_0xd281('0x71')][_0xd281('0x15d')](db['CmCompany'],{'as':_0xd281('0x1a9'),'foreignKey':'CompanyId'});db[_0xd281('0x71')]['belongsTo'](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177'),'onDelete':'cascade'});db[_0xd281('0x71')][_0xd281('0x133')](db['User'],{'as':'Users','through':_0xd281('0x1aa')});db[_0xd281('0x71')]['belongsToMany'](db['Tag'],{'as':_0xd281('0x17d'),'through':_0xd281('0x1ab')});db['CmContact'][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':'cm_contact_has_tags','as':_0xd281('0x18b')});db[_0xd281('0x73')][_0xd281('0x123')](db[_0xd281('0x1ac')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0xd281('0x73')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d'),'onDelete':_0xd281('0x122')});db[_0xd281('0x73')][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177'),'onDelete':_0xd281('0x122')});db[_0xd281('0x73')]['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x19b'),'foreignKey':_0xd281('0x11f')});db['CmHopper'][_0xd281('0x15d')](db[_0xd281('0x1a')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xd281('0x122')});db['CmHopper']['belongsTo'](db[_0xd281('0xf1')],{'as':'Campaign','foreignKey':_0xd281('0x1ad'),'onDelete':'cascade'});db[_0xd281('0x73')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack'][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d'),'onDelete':'cascade'});db[_0xd281('0x75')]['belongsTo'](db[_0xd281('0x100')],{'as':'List','foreignKey':_0xd281('0x177'),'onDelete':_0xd281('0x122')});db[_0xd281('0x75')]['belongsTo'](db[_0xd281('0x1a')],{'as':_0xd281('0x19c'),'foreignKey':_0xd281('0x15a'),'onDelete':_0xd281('0x122')});db['CmHopperBlack'][_0xd281('0x15d')](db[_0xd281('0xf1')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xd281('0x122')});db[_0xd281('0x7f')]['hasMany'](db[_0xd281('0x84')],{'as':{'plural':_0xd281('0x1ae'),'singular':_0xd281('0x1af')},'foreignKey':_0xd281('0x1b0'),'onDelete':_0xd281('0x122'),'hooks':!![]});db['Automation'][_0xd281('0x123')](db['Condition'],{'as':{'plural':_0xd281('0x1b1'),'singular':_0xd281('0x1b2')},'foreignKey':'AutomationAnyId','onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x7f')]['hasMany'](db[_0xd281('0x7d')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x83')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':'Dispositions','foreignKey':_0xd281('0x1b3'),'onDelete':_0xd281('0x122')});db[_0xd281('0x86')][_0xd281('0x123')](db[_0xd281('0x86')],{'as':_0xd281('0x1b4'),'foreignKey':_0xd281('0x160'),'onDelete':_0xd281('0x122'),'hooks':!![],'required':![]});db['Interval'][_0xd281('0x123')](db['VoiceExtension'],{'as':_0xd281('0x127'),'foreignKey':_0xd281('0x160'),'onDelete':_0xd281('0x170')});db[_0xd281('0x86')][_0xd281('0x123')](db[_0xd281('0x176')],{'as':'MailApplications','foreignKey':_0xd281('0x160')});db['Interval'][_0xd281('0x123')](db[_0xd281('0x63')],{'as':'ChatApplications','foreignKey':_0xd281('0x160')});db[_0xd281('0x86')][_0xd281('0x123')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0xd281('0x160')});db[_0xd281('0x86')][_0xd281('0x123')](db['SmsApplication'],{'as':_0xd281('0x1b5'),'foreignKey':_0xd281('0x160')});db[_0xd281('0x1b6')][_0xd281('0x15d')](db[_0xd281('0x14d')],{});db['Schedule'][_0xd281('0x15d')](db['AnalyticDefaultReport'],{'foreignKey':_0xd281('0x1b7')});db['Schedule'][_0xd281('0x15d')](db[_0xd281('0x9f')],{'foreignKey':_0xd281('0x1b8')});db[_0xd281('0x8d')][_0xd281('0x133')](db[_0xd281('0x19')],{'as':_0xd281('0x1b9'),'through':_0xd281('0x157'),'onDelete':_0xd281('0x170')});db[_0xd281('0x8f')][_0xd281('0x133')](db['CmContact'],{'through':_0xd281('0x1ab')});db[_0xd281('0x8f')]['belongsToMany'](db[_0xd281('0x12a')],{'through':_0xd281('0x1a0')});db[_0xd281('0x8f')][_0xd281('0x133')](db[_0xd281('0x3f')],{'through':_0xd281('0x17c')});db[_0xd281('0x8f')]['belongsToMany'](db[_0xd281('0x54')],{'through':_0xd281('0x190')});db[_0xd281('0x8f')][_0xd281('0x133')](db[_0xd281('0x12b')],{'through':_0xd281('0x18a')});db[_0xd281('0x8f')][_0xd281('0x133')](db['OpenchannelInteraction'],{'through':_0xd281('0x197')});db[_0xd281('0x8f')][_0xd281('0x133')](db['WhatsappInteraction'],{'through':_0xd281('0x1ba')});db['CmContactHasItem'][_0xd281('0x15d')](db[_0xd281('0x91')],{'as':_0xd281('0x1bb'),'foreignKey':_0xd281('0x1bc')});db['CmHopperAdditionalPhone'][_0xd281('0x15d')](db['CmHopper'],{'as':'Hopper','foreignKey':_0xd281('0x1bd')});db['CmContactHasItem']['belongsTo'](db[_0xd281('0x71')],{'as':'Contact','foreignKey':'CmContactId'});db[_0xd281('0x97')][_0xd281('0x123')](db[_0xd281('0x84')],{'as':{'plural':_0xd281('0x1be'),'singular':_0xd281('0x1bf')},'foreignKey':_0xd281('0x1c0'),'onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x97')][_0xd281('0x123')](db[_0xd281('0x84')],{'as':{'plural':_0xd281('0x1c1'),'singular':_0xd281('0x1c2')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0xd281('0x7d')],{'as':_0xd281('0x1c3'),'foreignKey':_0xd281('0x1c4'),'onDelete':_0xd281('0x122'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xd281('0xa6')],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1b8'),'hooks':!![]});db['AnalyticDefaultReport'][_0xd281('0x123')](db[_0xd281('0xa6')],{'as':_0xd281('0x1c5'),'onDelete':'cascade','foreignKey':_0xd281('0x1b7')});db[_0xd281('0xa5')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c6')});db[_0xd281('0xa6')][_0xd281('0x15d')](db['AnalyticMetric'],{'foreignKey':_0xd281('0x1c6')});db[_0xd281('0x1c7')]['hasMany'](db['SalesforceConfiguration'],{'as':_0xd281('0x1c8'),'onDelete':'cascade','foreignKey':_0xd281('0x1c9')});db[_0xd281('0xab')][_0xd281('0x123')](db[_0xd281('0xad')],{'as':'Subjects','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xab')][_0xd281('0x123')](db[_0xd281('0xad')],{'as':'Descriptions','onDelete':_0xd281('0x122'),'foreignKey':'DescriptionId'});db[_0xd281('0xab')][_0xd281('0x123')](db[_0xd281('0xad')],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db['SalesforceField'][_0xd281('0x123')](db['SalesforceField'],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xad')][_0xd281('0x123')](db['SalesforceField'],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xad')][_0xd281('0x123')](db[_0xd281('0xad')],{'as':_0xd281('0x1ce'),'foreignKey':'FieldId'});db[_0xd281('0xad')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xaf')][_0xd281('0x123')](db[_0xd281('0xb1')],{'as':'Configurations','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xb1')][_0xd281('0x123')](db['SugarcrmField'],{'as':_0xd281('0x1d0'),'onDelete':_0xd281('0x122'),'foreignKey':'SubjectId'});db[_0xd281('0xb1')][_0xd281('0x123')](db[_0xd281('0xb3')],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xb1')]['hasMany'](db[_0xd281('0xb3')],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1d2')});db['SugarcrmConfiguration']['belongsTo'](db[_0xd281('0xaf')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xb3')][_0xd281('0x123')](db[_0xd281('0xb3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xd281('0xb3')]['hasMany'](db[_0xd281('0xb3')],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xb3')]['hasMany'](db['SugarcrmField'],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db['SugarcrmField'][_0xd281('0x15d')](db['Variable'],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db['DeskAccount'][_0xd281('0x123')](db[_0xd281('0x1d3')],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0x1d3')][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':_0xd281('0x1d0'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0x1d3')][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db['DeskConfiguration'][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':'Fields','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0x1d3')]['belongsTo'](db[_0xd281('0xb4')],{'as':_0xd281('0x17a'),'foreignKey':'AccountId'});db[_0xd281('0x1d3')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x1d5')});db['DeskField'][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0x1d4')][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db['DeskField'][_0xd281('0x123')](db['DeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xd281('0x1d4')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xb7')][_0xd281('0x123')](db['ZohoConfiguration'],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':_0xd281('0x1d0'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0x1d6')]['hasMany'](db['ZohoField'],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0x1d6')][_0xd281('0x123')](db[_0xd281('0xba')],{'as':'Fields','onDelete':_0xd281('0x122'),'foreignKey':'FieldId'});db[_0xd281('0x1d6')]['belongsTo'](db['ZohoAccount'],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xba')][_0xd281('0x123')](db[_0xd281('0xba')],{'as':_0xd281('0x1cb'),'foreignKey':'SubjectId'});db[_0xd281('0xba')][_0xd281('0x123')](db['ZohoField'],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xba')][_0xd281('0x123')](db[_0xd281('0xba')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xba')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0x1d7')][_0xd281('0x123')](db[_0xd281('0xbc')],{'as':'Configurations','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xbc')][_0xd281('0x123')](db[_0xd281('0xbd')],{'as':_0xd281('0x1d0'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xbc')][_0xd281('0x123')](db[_0xd281('0xbd')],{'as':_0xd281('0x1d1'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xbc')]['hasMany'](db[_0xd281('0xbd')],{'as':_0xd281('0x1c5'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xbc')][_0xd281('0x15d')](db[_0xd281('0x1d7')],{'as':'Account','foreignKey':_0xd281('0x1c9')});db[_0xd281('0xbc')]['belongsToMany'](db[_0xd281('0x8f')],{'through':_0xd281('0x1d8')});db['ZendeskField'][_0xd281('0x123')](db[_0xd281('0xbd')],{'as':_0xd281('0x1cb'),'foreignKey':'SubjectId'});db['ZendeskField']['hasMany'](db[_0xd281('0xbd')],{'as':'Description','foreignKey':_0xd281('0x1cd')});db[_0xd281('0xbd')][_0xd281('0x123')](db[_0xd281('0xbd')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xbd')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db['FreshdeskAccount'][_0xd281('0x123')](db[_0xd281('0xbf')],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db['FreshdeskConfiguration']['hasMany'](db[_0xd281('0x1d9')],{'as':_0xd281('0x1d0'),'onDelete':'cascade','foreignKey':_0xd281('0x1ca')});db[_0xd281('0xbf')][_0xd281('0x123')](db[_0xd281('0x1d9')],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xbf')]['hasMany'](db[_0xd281('0x1d9')],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xd281('0x15d')](db[_0xd281('0x1da')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db['FreshdeskConfiguration']['belongsToMany'](db[_0xd281('0x8f')],{'through':_0xd281('0x1db')});db[_0xd281('0x1d9')]['hasMany'](db[_0xd281('0x1d9')],{'as':_0xd281('0x1cb'),'foreignKey':'SubjectId'});db[_0xd281('0x1d9')][_0xd281('0x123')](db[_0xd281('0x1d9')],{'as':_0xd281('0x1cc'),'foreignKey':'DescriptionId'});db[_0xd281('0x1d9')][_0xd281('0x123')](db[_0xd281('0x1d9')],{'as':_0xd281('0x1ce'),'foreignKey':'FieldId'});db[_0xd281('0x1d9')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xc2')][_0xd281('0x123')](db[_0xd281('0xc4')],{'as':'Configurations','onDelete':_0xd281('0x122'),'foreignKey':'AccountId'});db[_0xd281('0xc4')][_0xd281('0x123')](db[_0xd281('0xc6')],{'as':_0xd281('0x1d0'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xc4')]['hasMany'](db[_0xd281('0xc6')],{'as':_0xd281('0x1d1'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xc4')][_0xd281('0x123')](db['VtigerField'],{'as':'Fields','foreignKey':_0xd281('0x1d2')});db[_0xd281('0xc4')][_0xd281('0x15d')](db[_0xd281('0xc2')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xc6')][_0xd281('0x123')](db[_0xd281('0xc6')],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xc6')][_0xd281('0x123')](db[_0xd281('0xc6')],{'as':_0xd281('0x1cc'),'foreignKey':'DescriptionId'});db[_0xd281('0xc6')][_0xd281('0x123')](db[_0xd281('0xc6')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xc6')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xc8')]['hasMany'](db[_0xd281('0x1dc')],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0x1dc')][_0xd281('0x123')](db[_0xd281('0xcb')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xd281('0x123')](db['ServicenowField'],{'as':_0xd281('0x1d1'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0x1dc')]['hasMany'](db['ServicenowField'],{'as':_0xd281('0x1c5'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0x1dc')][_0xd281('0x15d')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xd281('0x1c9')});db['ServicenowField']['hasMany'](db[_0xd281('0xcb')],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db['ServicenowField'][_0xd281('0x123')](db[_0xd281('0xcb')],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xcb')]['hasMany'](db[_0xd281('0xcb')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xcb')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xcd')]['hasMany'](db[_0xd281('0xcf')],{'as':'Configurations','onDelete':_0xd281('0x122'),'foreignKey':'AccountId'});db[_0xd281('0xcd')][_0xd281('0x15d')](db['CloudProvider'],{'as':_0xd281('0x116'),'foreignKey':_0xd281('0x16f')});db[_0xd281('0xcf')][_0xd281('0x123')](db[_0xd281('0xd0')],{'as':_0xd281('0x1d0'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1ca')});db['Dynamics365Configuration']['hasMany'](db[_0xd281('0xd0')],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xcf')][_0xd281('0x123')](db[_0xd281('0xd0')],{'as':'Fields','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xcf')][_0xd281('0x15d')](db[_0xd281('0xcd')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xd0')][_0xd281('0x123')](db[_0xd281('0xd0')],{'as':'Subject','foreignKey':_0xd281('0x1ca')});db['Dynamics365Field'][_0xd281('0x123')](db[_0xd281('0xd0')],{'as':_0xd281('0x1cc'),'foreignKey':'DescriptionId'});db['Dynamics365Field'][_0xd281('0x123')](db['Dynamics365Field'],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xd0')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':'VariableId'});db[_0xd281('0xd1')][_0xd281('0x123')](db[_0xd281('0x1dd')],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0x1dd')]['hasMany'](db[_0xd281('0xd4')],{'as':_0xd281('0x1d0'),'foreignKey':_0xd281('0x1ca')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xd281('0x1cd')});db[_0xd281('0x1dd')][_0xd281('0x123')](db[_0xd281('0xd4')],{'as':_0xd281('0x1c5'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0xd281('0x15d')](db[_0xd281('0xd1')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db['FreshsalesField'][_0xd281('0x123')](db['FreshsalesField'],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db['FreshsalesField']['hasMany'](db[_0xd281('0xd4')],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xd4')][_0xd281('0x123')](db[_0xd281('0xd4')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xd4')]['belongsTo'](db['Variable'],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0x1de')][_0xd281('0x15d')](db[_0xd281('0x5f')],{});db[_0xd281('0x1de')][_0xd281('0x15d')](db['CmList'],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x1de')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x1de')][_0xd281('0x15d')](db[_0xd281('0x12a')],{});db['ChatQueueReport'][_0xd281('0x15d')](db['ChatMessage'],{});db[_0xd281('0x1de')][_0xd281('0x15d')](db['User'],{});db[_0xd281('0x1de')]['belongsTo'](db[_0xd281('0x69')],{});db[_0xd281('0xd8')]['belongsTo'](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1df')});db[_0xd281('0xd8')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1e0')});db['JscriptySessionReport'][_0xd281('0x123')](db[_0xd281('0xdc')],{'foreignKey':_0xd281('0x1e1'),'onDelete':_0xd281('0x122')});db['JscriptySessionReport'][_0xd281('0x123')](db[_0xd281('0xda')],{'foreignKey':_0xd281('0x1e1'),'onDelete':_0xd281('0x122')});db['SmsQueueReport'][_0xd281('0x15d')](db[_0xd281('0x51')],{});db['SmsQueueReport'][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':'List','foreignKey':'ListId'});db[_0xd281('0xde')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0xde')][_0xd281('0x15d')](db['SmsInteraction'],{});db[_0xd281('0xde')]['belongsTo'](db[_0xd281('0x56')],{});db['SmsQueueReport']['belongsTo'](db[_0xd281('0x12')],{});db[_0xd281('0xde')][_0xd281('0x15d')](db['SmsQueue'],{});db[_0xd281('0xe2')][_0xd281('0x123')](db[_0xd281('0xdd')],{'foreignKey':_0xd281('0x1e2')});db[_0xd281('0xe2')]['hasMany'](db[_0xd281('0xdc')],{'foreignKey':_0xd281('0x1e2')});db[_0xd281('0xe2')][_0xd281('0x123')](db[_0xd281('0xda')],{'foreignKey':_0xd281('0x1e2')});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':'user_has_teams'});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x1a')],{'through':_0xd281('0x118'),'as':_0xd281('0x13f')});db['Team']['belongsToMany'](db[_0xd281('0x3b')],{'through':_0xd281('0x1e3'),'as':'MailQueues'});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x69')],{'through':'team_has_chat_queues','as':_0xd281('0x143')});db['Team']['belongsToMany'](db[_0xd281('0x4d')],{'through':'team_has_fax_queues','as':_0xd281('0x1e4')});db[_0xd281('0xed')]['belongsToMany'](db['SmsQueue'],{'through':_0xd281('0x1e5'),'as':'SmsQueues'});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x5e')],{'through':_0xd281('0x1e6'),'as':_0xd281('0x145')});db[_0xd281('0xed')][_0xd281('0x133')](db['WhatsappQueue'],{'through':_0xd281('0x1e7'),'as':_0xd281('0x147')});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x1e8')],{'through':_0xd281('0x119'),'as':_0xd281('0x141')});db[_0xd281('0xf1')]['hasMany'](db[_0xd281('0x73')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xd281('0xf1')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd281('0x1ad')});db[_0xd281('0xf1')][_0xd281('0x123')](db[_0xd281('0x78')],{'as':_0xd281('0x1a6'),'foreignKey':_0xd281('0x1ad')});db[_0xd281('0xf1')][_0xd281('0x123')](db[_0xd281('0x75')],{'as':_0xd281('0x15b'),'foreignKey':_0xd281('0x1ad')});db[_0xd281('0xf1')][_0xd281('0x15d')](db[_0xd281('0x29')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xd281('0xf1')][_0xd281('0x15d')](db[_0xd281('0x29')],{'as':_0xd281('0x15e'),'foreignKey':_0xd281('0x15f')});db[_0xd281('0xf1')][_0xd281('0x15d')](db[_0xd281('0x86')],{'as':_0xd281('0x86'),'foreignKey':_0xd281('0x160')});db[_0xd281('0xf1')]['belongsTo'](db[_0xd281('0x1e9')],{'as':_0xd281('0x1e9'),'foreignKey':_0xd281('0x1ea')});db['Campaign'][_0xd281('0x133')](db['CmList'],{'as':_0xd281('0x135'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0xd281('0x133')](db[_0xd281('0x100')],{'as':_0xd281('0x165'),'through':'campaigns_has_cm_blacklists'});db[_0xd281('0xf5')][_0xd281('0x15d')](db[_0xd281('0x183')],{'as':_0xd281('0x183'),'foreignKey':_0xd281('0x1a1')});db[_0xd281('0xf8')][_0xd281('0x15d')](db[_0xd281('0x40')],{});db[_0xd281('0xf8')]['belongsTo'](db[_0xd281('0x3f')],{});db[_0xd281('0xf8')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xd281('0x1eb'),'as':_0xd281('0x1ec')});db[_0xd281('0xf8')]['belongsTo'](db['User'],{'foreignKey':_0xd281('0x1ed'),'as':_0xd281('0x1ee')});db['MailTransferReport'][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':'ToUserId','as':_0xd281('0x1ef')});db[_0xd281('0xf8')][_0xd281('0x15d')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0xd281('0x1f0')});db['MailTransferReport'][_0xd281('0x15d')](db[_0xd281('0x14d')],{'foreignKey':_0xd281('0x1f1'),'as':'ToAccount'});db[_0xd281('0x1f2')][_0xd281('0x15d')](db[_0xd281('0x66')],{});db['ChatTransferReport'][_0xd281('0x15d')](db['ChatInteraction'],{});db['ChatTransferReport'][_0xd281('0x15d')](db[_0xd281('0x5f')],{'foreignKey':'FromChatWebsiteId','as':_0xd281('0x1ec')});db[_0xd281('0x1f2')][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':_0xd281('0x1ee')});db[_0xd281('0x1f2')]['belongsTo'](db['User'],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db[_0xd281('0x1f2')][_0xd281('0x15d')](db[_0xd281('0x69')],{'foreignKey':_0xd281('0x1f4'),'as':'ToQueue'});db['ChatTransferReport'][_0xd281('0x15d')](db[_0xd281('0x5f')],{'foreignKey':_0xd281('0x1f5'),'as':_0xd281('0x1f6')});db[_0xd281('0x1f7')]['belongsTo'](db[_0xd281('0x4b')],{});db['FaxTransferReport'][_0xd281('0x15d')](db['FaxInteraction'],{});db[_0xd281('0x1f7')][_0xd281('0x15d')](db[_0xd281('0x47')],{'foreignKey':_0xd281('0x1f8'),'as':'FromAccount'});db[_0xd281('0x1f7')][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':'FromAgent'});db['FaxTransferReport'][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db['FaxTransferReport'][_0xd281('0x15d')](db[_0xd281('0x4d')],{'foreignKey':'ToFaxQueueId','as':_0xd281('0x1f0')});db['FaxTransferReport']['belongsTo'](db[_0xd281('0x47')],{'foreignKey':_0xd281('0x1f9'),'as':_0xd281('0x1f6')});db[_0xd281('0xfc')]['belongsTo'](db[_0xd281('0x194')],{});db['OpenchannelTransferReport'][_0xd281('0x15d')](db[_0xd281('0x5d')],{});db[_0xd281('0xfc')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xd281('0x1fa'),'as':_0xd281('0x1ec')});db['OpenchannelTransferReport'][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':_0xd281('0x1ee')});db[_0xd281('0xfc')][_0xd281('0x15d')](db['User'],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db[_0xd281('0xfc')]['belongsTo'](db[_0xd281('0x5e')],{'foreignKey':_0xd281('0x1fb'),'as':_0xd281('0x1f0')});db[_0xd281('0xfc')][_0xd281('0x15d')](db[_0xd281('0x14f')],{'foreignKey':_0xd281('0x1fc'),'as':'ToAccount'});db['SmsTransferReport'][_0xd281('0x15d')](db[_0xd281('0x56')],{});db[_0xd281('0xfe')][_0xd281('0x15d')](db['SmsInteraction'],{});db[_0xd281('0xfe')][_0xd281('0x15d')](db[_0xd281('0x51')],{'foreignKey':_0xd281('0x1fd'),'as':_0xd281('0x1ec')});db[_0xd281('0xfe')]['belongsTo'](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':'FromAgent'});db[_0xd281('0xfe')]['belongsTo'](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db['SmsTransferReport']['belongsTo'](db[_0xd281('0x58')],{'foreignKey':'ToSmsQueueId','as':_0xd281('0x1f0')});db[_0xd281('0xfe')][_0xd281('0x15d')](db[_0xd281('0x51')],{'foreignKey':'ToSmsAccountId','as':_0xd281('0x1f6')});db[_0xd281('0x100')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':_0xd281('0x177'),'onDelete':_0xd281('0x122')});db[_0xd281('0x100')][_0xd281('0x123')](db['CmCustomField'],{'as':_0xd281('0x1fe'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x100')]['hasMany'](db[_0xd281('0x71')],{'as':_0xd281('0x134'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x100')]['hasMany'](db[_0xd281('0x77')],{'as':_0xd281('0x128'),'foreignKey':'ListId'});db['CmList'][_0xd281('0x123')](db[_0xd281('0x78')],{'as':_0xd281('0x129'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x100')][_0xd281('0x123')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xd281('0x100')][_0xd281('0x133')](db[_0xd281('0x1a')],{'as':_0xd281('0x1ff'),'through':_0xd281('0x162')});db['CmList']['belongsToMany'](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x136')});db[_0xd281('0x1e8')][_0xd281('0x123')](db['VoiceExtension'],{'as':_0xd281('0x127'),'onDelete':_0xd281('0x122')});db['VoicePrefix'][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x11b')});db[_0xd281('0x1e8')][_0xd281('0x133')](db[_0xd281('0xed')],{'through':_0xd281('0x119'),'as':_0xd281('0x164')});db[_0xd281('0x103')]['hasMany'](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'foreignKey':_0xd281('0x200')});db[_0xd281('0x103')][_0xd281('0x123')](db[_0xd281('0x105')],{'as':'UserProfileSections','foreignKey':_0xd281('0x200'),'onDelete':_0xd281('0x122')});db[_0xd281('0x105')][_0xd281('0x123')](db[_0xd281('0x107')],{'as':_0xd281('0x201'),'foreignKey':_0xd281('0x202'),'onDelete':_0xd281('0x122')});db[_0xd281('0x10a')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':'WhatsappAccountId','onDelete':_0xd281('0x122')});db[_0xd281('0x10a')][_0xd281('0x123')](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':'WhatsappAccountId'});db[_0xd281('0x10a')][_0xd281('0x123')](db[_0xd281('0x203')],{'as':'Messages','foreignKey':_0xd281('0x204')});db[_0xd281('0x10a')][_0xd281('0x123')](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount'][_0xd281('0x123')](db[_0xd281('0x10c')],{'as':_0xd281('0x155'),'foreignKey':_0xd281('0x204'),'onDelete':_0xd281('0x122')});db['WhatsappAccount']['belongsTo'](db['CmList'],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db['WhatsappAccount'][_0xd281('0x15d')](db[_0xd281('0x161')],{'as':_0xd281('0x178'),'foreignKey':_0xd281('0x188')});db[_0xd281('0x10a')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Agents','through':_0xd281('0x153')});db[_0xd281('0x10c')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':'restrict'});db[_0xd281('0x10c')][_0xd281('0x15d')](db[_0xd281('0x146')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x10c')][_0xd281('0x15d')](db[_0xd281('0x10a')],{'onDelete':_0xd281('0x170')});db['WhatsappApplication'][_0xd281('0x15d')](db[_0xd281('0x86')],{'onDelete':'restrict','foreignKey':_0xd281('0x160')});db[_0xd281('0x10c')][_0xd281('0x15d')](db['Tag'],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x189')});db[_0xd281('0x10e')][_0xd281('0x123')](db[_0xd281('0x203')],{'as':'Messages','onDelete':_0xd281('0x122'),'foreignKey':'WhatsappInteractionId'});db[_0xd281('0x10e')][_0xd281('0x15d')](db['WhatsappAccount'],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x204')});db[_0xd281('0x10e')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db['WhatsappInteraction'][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x17b'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x10e')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':'whatsapp_interaction_has_tags','as':_0xd281('0x17d')});db[_0xd281('0x10e')]['belongsToMany'](db[_0xd281('0x8f')],{'through':_0xd281('0x1ba'),'as':'ThroughTags'});db[_0xd281('0x10e')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x13e'),'foreignKey':_0xd281('0x205')});db[_0xd281('0x203')][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x12')});db[_0xd281('0x203')]['belongsTo'](db['CmContact'],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c')});db[_0xd281('0x203')]['belongsTo'](db[_0xd281('0x10e')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x181'),'foreignKey':_0xd281('0x205')});db[_0xd281('0x203')][_0xd281('0x15d')](db[_0xd281('0x10a')],{'as':'Account','foreignKey':_0xd281('0x204')});db['WhatsappQueueReport'][_0xd281('0x15d')](db[_0xd281('0x10a')],{});db[_0xd281('0x111')][_0xd281('0x15d')](db['CmList'],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x111')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x111')][_0xd281('0x15d')](db[_0xd281('0x10e')],{});db[_0xd281('0x111')][_0xd281('0x15d')](db['WhatsappQueue'],{});db[_0xd281('0x111')][_0xd281('0x15d')](db[_0xd281('0x203')],{});db[_0xd281('0x111')][_0xd281('0x15d')](db[_0xd281('0x12')],{});db[_0xd281('0x113')][_0xd281('0x15d')](db['WhatsappMessage'],{});db[_0xd281('0x113')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0xd281('0x15d')](db['WhatsappAccount'],{'foreignKey':_0xd281('0x206'),'as':_0xd281('0x1ec')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xd281('0x207'),'as':_0xd281('0x1f6')});db[_0xd281('0x113')][_0xd281('0x15d')](db[_0xd281('0x146')],{'foreignKey':_0xd281('0x208'),'as':'ToQueue'});db[_0xd281('0x113')][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':_0xd281('0x1ee')});db[_0xd281('0x113')]['belongsTo'](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db[_0xd281('0x146')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xd281('0x146')][_0xd281('0x133')](db[_0xd281('0xed')],{'through':_0xd281('0x1e7'),'as':'Teams'});db[_0xd281('0x121')]['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x209'),'foreignKey':_0xd281('0x11f'),'onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x116')][_0xd281('0x120')](db[_0xd281('0xcd')],{'as':_0xd281('0xcd'),'onDelete':_0xd281('0x170')});db[_0xd281('0x116')]['hasOne'](db[_0xd281('0x37')],{'as':_0xd281('0x171'),'onDelete':_0xd281('0x170')});db['CloudProvider'][_0xd281('0x120')](db['MailServerOut'],{'as':_0xd281('0x172'),'onDelete':_0xd281('0x170')});module[_0xd281('0x20a')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index cbde315..87a430a 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda8a=['/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','/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/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/schedules','/api/sounds','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./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/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/network','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/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/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/mail_interaction_has_tags','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','/api/webbar','./api/webbar','join','root','/www','static','/demo','/snippet','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','/api/users','/api/voice/chanspy','use','/api/voice/contexts','./api/voiceContext','/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/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','/api/sms/queues','./api/smsQueue'];(function(_0x4f993a,_0x273fff){var _0x260b3e=function(_0x29b5ce){while(--_0x29b5ce){_0x4f993a['push'](_0x4f993a['shift']());}};_0x260b3e(++_0x273fff);}(_0xda8a,0x1e4));var _0xada8=function(_0x4b53b4,_0x1d6c64){_0x4b53b4=_0x4b53b4-0x0;var _0x26b6c3=_0xda8a[_0x4b53b4];return _0x26b6c3;};'use strict';var path=require(_0xada8('0x0'));var express=require(_0xada8('0x1'));var errors=require(_0xada8('0x2'));var config=require(_0xada8('0x3'));var setupLoggers=require(_0xada8('0x4'))[_0xada8('0x5')];var clientSideLogs=require(_0xada8('0x6'));exports[_0xada8('0x7')]=function(_0x3c2a38){return setupLoggers(_0x3c2a38)['then'](function(){_0x3c2a38['use'](_0xada8('0x8'),require('./api/user'));_0x3c2a38['use'](_0xada8('0x9'),require('./api/voiceChanSpy'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xb'),require(_0xada8('0xc')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xd'),require(_0xada8('0xe')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xf'),require(_0xada8('0x10')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x11'),require(_0xada8('0x12')));_0x3c2a38['use'](_0xada8('0x13'),require('./api/voiceRecording'));_0x3c2a38[_0xada8('0xa')]('/api/screen/recordings',require(_0xada8('0x14')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x15'),require(_0xada8('0x16')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x17'),require(_0xada8('0x18')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x19'),require(_0xada8('0x1a')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x1b'),require('./api/voiceDialReport'));_0x3c2a38[_0xada8('0xa')]('/api/voice/agents/reports',require(_0xada8('0x1c')));_0x3c2a38['use'](_0xada8('0x1d'),require(_0xada8('0x1e')));_0x3c2a38[_0xada8('0xa')]('/api/members/reports',require(_0xada8('0x1f')));_0x3c2a38['use'](_0xada8('0x20'),require('./api/trunk'));_0x3c2a38[_0xada8('0xa')]('/api/voice/transfers/reports',require(_0xada8('0x21')));_0x3c2a38['use'](_0xada8('0x22'),require(_0xada8('0x23')));_0x3c2a38['use']('/api/mail/accounts',require('./api/mailAccount'));_0x3c2a38[_0xada8('0xa')]('/api/mail/queues',require('./api/mailQueue'));_0x3c2a38[_0xada8('0xa')](_0xada8('0x24'),require(_0xada8('0x25')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x26'),require(_0xada8('0x27')));_0x3c2a38[_0xada8('0xa')]('/api/mail/messages',require('./api/mailMessage'));_0x3c2a38[_0xada8('0xa')](_0xada8('0x28'),require('./api/mailApplication'));_0x3c2a38[_0xada8('0xa')]('/api/mail/reports/queue',require(_0xada8('0x29')));_0x3c2a38['use']('/api/dashboards',require(_0xada8('0x2a')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x2b'),require(_0xada8('0x2c')));_0x3c2a38['use']('/api/fax/accounts',require('./api/faxAccount'));_0x3c2a38['use'](_0xada8('0x2d'),require(_0xada8('0x2e')));_0x3c2a38['use']('/api/fax/interactions',require(_0xada8('0x2f')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x30'),require('./api/faxMessage'));_0x3c2a38['use'](_0xada8('0x31'),require(_0xada8('0x32')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x33'),require(_0xada8('0x34')));_0x3c2a38[_0xada8('0xa')]('/api/sms/accounts',require(_0xada8('0x35')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x36'),require(_0xada8('0x37')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x38'),require('./api/smsInteraction'));_0x3c2a38['use']('/api/sms/messages',require(_0xada8('0x39')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x3a'),require(_0xada8('0x3b')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x3c'),require(_0xada8('0x3d')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x3e'),require('./api/openchannelApplication'));_0x3c2a38['use'](_0xada8('0x3f'),require(_0xada8('0x40')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x41'),require(_0xada8('0x42')));_0x3c2a38['use'](_0xada8('0x43'),require(_0xada8('0x44')));_0x3c2a38['use']('/api/chat/websites',require(_0xada8('0x45')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x46'),require(_0xada8('0x47')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x48'),require(_0xada8('0x49')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x4a'),require(_0xada8('0x4b')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x4c'),require(_0xada8('0x4d')));_0x3c2a38['use'](_0xada8('0x4e'),require(_0xada8('0x4f')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x50'),require(_0xada8('0x51')));_0x3c2a38['use'](_0xada8('0x52'),require('./api/chatGroup'));_0x3c2a38[_0xada8('0xa')](_0xada8('0x53'),require('./api/chatProactiveAction'));_0x3c2a38[_0xada8('0xa')](_0xada8('0x54'),require(_0xada8('0x55')));_0x3c2a38['use']('/api/cm/contacts',require(_0xada8('0x56')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x57'),require('./api/cmHopper'));_0x3c2a38[_0xada8('0xa')](_0xada8('0x58'),require(_0xada8('0x59')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x5a'),require(_0xada8('0x5b')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x5c'),require(_0xada8('0x5d')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x5e'),require(_0xada8('0x5f')));_0x3c2a38[_0xada8('0xa')]('/api/actions',require(_0xada8('0x60')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x61'),require(_0xada8('0x62')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x63'),require(_0xada8('0x64')));_0x3c2a38[_0xada8('0xa')]('/api/dispositions',require('./api/disposition'));_0x3c2a38[_0xada8('0xa')]('/api/conditions',require('./api/condition'));_0x3c2a38['use'](_0xada8('0x65'),require(_0xada8('0x66')));_0x3c2a38[_0xada8('0xa')]('/api/pauses',require(_0xada8('0x67')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x68'),require(_0xada8('0x69')));_0x3c2a38[_0xada8('0xa')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x3c2a38[_0xada8('0xa')](_0xada8('0x6a'),require('./api/schedule'));_0x3c2a38[_0xada8('0xa')](_0xada8('0x6b'),require('./api/sound'));_0x3c2a38[_0xada8('0xa')]('/api/tags',require(_0xada8('0x6c')));_0x3c2a38['use'](_0xada8('0x6d'),require(_0xada8('0x6e')));_0x3c2a38['use'](_0xada8('0x6f'),require(_0xada8('0x70')));_0x3c2a38[_0xada8('0xa')]('/api/cm_hopper_additional_phones',require(_0xada8('0x71')));_0x3c2a38['use'](_0xada8('0x72'),require(_0xada8('0x73')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x74'),require(_0xada8('0x75')));_0x3c2a38['use'](_0xada8('0x76'),require(_0xada8('0x77')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x78'),require(_0xada8('0x79')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x7a'),require(_0xada8('0x7b')));_0x3c2a38['use'](_0xada8('0x7c'),require('./api/analyticCustomReport'));_0x3c2a38[_0xada8('0xa')](_0xada8('0x7d'),require(_0xada8('0x7e')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x7f'),require('./api/analyticExtractedReport'));_0x3c2a38[_0xada8('0xa')]('/api/analytics/metrics',require(_0xada8('0x80')));_0x3c2a38['use']('/api/analytics/field_reports',require(_0xada8('0x81')));_0x3c2a38[_0xada8('0xa')]('/api/analytics/tree_reports',require(_0xada8('0x82')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x83'),require(_0xada8('0x84')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x85'),require(_0xada8('0x86')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x87'),require(_0xada8('0x88')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x89'),require(_0xada8('0x8a')));_0x3c2a38['use'](_0xada8('0x8b'),require(_0xada8('0x8c')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x8d'),require(_0xada8('0x8e')));_0x3c2a38['use'](_0xada8('0x8f'),require(_0xada8('0x90')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x91'),require('./api/intDeskConfiguration'));_0x3c2a38['use'](_0xada8('0x92'),require(_0xada8('0x93')));_0x3c2a38['use']('/api/integrations/zoho/accounts',require(_0xada8('0x94')));_0x3c2a38['use'](_0xada8('0x95'),require(_0xada8('0x96')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x97'),require(_0xada8('0x98')));_0x3c2a38['use'](_0xada8('0x99'),require(_0xada8('0x9a')));_0x3c2a38['use'](_0xada8('0x9b'),require(_0xada8('0x9c')));_0x3c2a38['use'](_0xada8('0x9d'),require(_0xada8('0x9e')));_0x3c2a38['use'](_0xada8('0x9f'),require('./api/intFreshdeskAccount'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xa0'),require('./api/intFreshdeskConfiguration'));_0x3c2a38[_0xada8('0xa')]('/api/integrations/freshdesk/fields',require(_0xada8('0xa1')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xa2'),require(_0xada8('0xa3')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xa4'),require(_0xada8('0xa5')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xa6'),require(_0xada8('0xa7')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xa8'),require('./api/intServicenowAccount'));_0x3c2a38['use'](_0xada8('0xa9'),require(_0xada8('0xaa')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xab'),require(_0xada8('0xac')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xad'),require(_0xada8('0xae')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xaf'),require(_0xada8('0xb0')));_0x3c2a38[_0xada8('0xa')]('/api/integrations/dynamics365/fields',require(_0xada8('0xb1')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xb2'),require(_0xada8('0xb3')));_0x3c2a38['use'](_0xada8('0xb4'),require('./api/intFreshsalesConfiguration'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xb5'),require('./api/intFreshsalesField'));_0x3c2a38[_0xada8('0xa')]('/api/networks',require(_0xada8('0xb6')));_0x3c2a38[_0xada8('0xa')]('/api/chat/reports/queue',require(_0xada8('0xb7')));_0x3c2a38[_0xada8('0xa')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x3c2a38['use'](_0xada8('0xb8'),require(_0xada8('0xb9')));_0x3c2a38['use'](_0xada8('0xba'),require(_0xada8('0xbb')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xbc'),require('./api/jscriptySessionReport'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xbd'),require(_0xada8('0xbe')));_0x3c2a38[_0xada8('0xa')]('/api/square/reports',require('./api/squareReport'));_0x3c2a38['use'](_0xada8('0xbf'),require(_0xada8('0xc0')));_0x3c2a38[_0xada8('0xa')]('/api/jscripty/projects',require(_0xada8('0xc1')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xc2'),require('./api/setting'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xc3'),require(_0xada8('0xc4')));_0x3c2a38[_0xada8('0xa')]('/api/square/projects',require(_0xada8('0xc5')));_0x3c2a38[_0xada8('0xa')]('/api/square/recordings',require(_0xada8('0xc6')));_0x3c2a38['use'](_0xada8('0xc7'),require(_0xada8('0xc8')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xc9'),require(_0xada8('0xca')));_0x3c2a38[_0xada8('0xa')]('/api/license',require('./api/license'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xcb'),require(_0xada8('0xcc')));_0x3c2a38['use'](_0xada8('0xcd'),require(_0xada8('0xce')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xcf'),require(_0xada8('0xd0')));_0x3c2a38['use'](_0xada8('0xd1'),require(_0xada8('0xd2')));_0x3c2a38[_0xada8('0xa')]('/api/mail/reports/transfer',require(_0xada8('0xd3')));_0x3c2a38['use'](_0xada8('0xd4'),require(_0xada8('0xd5')));_0x3c2a38['use'](_0xada8('0xd6'),require('./api/faxTransferReport'));_0x3c2a38['use'](_0xada8('0xd7'),require('./api/openchannelTransferReport'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xd8'),require(_0xada8('0xd9')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xda'),require('./api/cmList'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xdb'),require('./api/voicePrefix'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xdc'),require(_0xada8('0xdd')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xde'),require(_0xada8('0xdf')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xe0'),require(_0xada8('0xe1')));_0x3c2a38[_0xada8('0xa')]('/api/userNotifications',require(_0xada8('0xe2')));_0x3c2a38['use'](_0xada8('0xe3'),require(_0xada8('0xe4')));_0x3c2a38[_0xada8('0xa')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x3c2a38[_0xada8('0xa')]('/api/whatsapp/interactions',require(_0xada8('0xe5')));_0x3c2a38['use'](_0xada8('0xe6'),require(_0xada8('0xe7')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xe8'),require(_0xada8('0xe9')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xea'),require('./api/whatsappTransferReport'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xeb'),require(_0xada8('0xec')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xed'),require(_0xada8('0xee')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xef'),require(_0xada8('0xf0')));_0x3c2a38['use'](_0xada8('0xf1'),require('./api/user-setting'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xf2'),require('./api/mailInteractionHasTag'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xf3'),require(_0xada8('0xf4')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xf5'),require(_0xada8('0xf6')));_0x3c2a38['use'](_0xada8('0xf7'),require(_0xada8('0xf8')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xf9'),require('./api/jira'));_0x3c2a38['use'](_0xada8('0xfa'),require(_0xada8('0xfb')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xfc'),require(_0xada8('0xfd')));_0x3c2a38[_0xada8('0xa')](_0xada8('0xfe'),require('./api/system'));_0x3c2a38[_0xada8('0xa')](_0xada8('0xff'),require('./api/pm2'));_0x3c2a38[_0xada8('0xa')](_0xada8('0x100'),require(_0xada8('0x101')));_0x3c2a38[_0xada8('0xa')]('/api/logs',clientSideLogs);_0x3c2a38['use']('/apidoc',express['static'](path[_0xada8('0x102')](config[_0xada8('0x103')],'/apidoc')));_0x3c2a38[_0xada8('0xa')](_0xada8('0x104'),express[_0xada8('0x105')](path['join'](config[_0xada8('0x103')],_0xada8('0x104'))));_0x3c2a38[_0xada8('0xa')](_0xada8('0x106'),express[_0xada8('0x105')](path['join'](config['root'],_0xada8('0x106'))));_0x3c2a38['use'](_0xada8('0x107'),express[_0xada8('0x105')](path[_0xada8('0x102')](config[_0xada8('0x103')],_0xada8('0x108'),'3.9.0')));_0x3c2a38['use'](_0xada8('0x109'),express[_0xada8('0x105')](path[_0xada8('0x102')](config['root'],'/server/files/plugins')));_0x3c2a38[_0xada8('0x10a')](_0xada8('0x10b'))[_0xada8('0x10c')](errors[0x194]);_0x3c2a38[_0xada8('0x10a')]('/*')[_0xada8('0x10c')](function(_0x55a1f9,_0x36718e){_0x36718e[_0xada8('0x10d')](path['resolve'](_0x3c2a38['get'](_0xada8('0x10e'))+_0xada8('0x10f')));});return _0x3c2a38;});}; \ No newline at end of file +var _0x48f0=['/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','./api/squareReportDetail','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','root','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','path','express','./errors','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable'];(function(_0x287ba7,_0x369db8){var _0x5dbf5f=function(_0x2c8310){while(--_0x2c8310){_0x287ba7['push'](_0x287ba7['shift']());}};_0x5dbf5f(++_0x369db8);}(_0x48f0,0x1ab));var _0x048f=function(_0x32efc1,_0xa4152f){_0x32efc1=_0x32efc1-0x0;var _0x245da7=_0x48f0[_0x32efc1];return _0x245da7;};'use strict';var path=require(_0x048f('0x0'));var express=require(_0x048f('0x1'));var errors=require(_0x048f('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x048f('0x3'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x048f('0x4')]=function(_0x33c097){return setupLoggers(_0x33c097)[_0x048f('0x5')](function(){_0x33c097[_0x048f('0x6')](_0x048f('0x7'),require(_0x048f('0x8')));_0x33c097[_0x048f('0x6')](_0x048f('0x9'),require(_0x048f('0xa')));_0x33c097['use'](_0x048f('0xb'),require(_0x048f('0xc')));_0x33c097[_0x048f('0x6')](_0x048f('0xd'),require(_0x048f('0xe')));_0x33c097[_0x048f('0x6')]('/api/voice/mohs',require(_0x048f('0xf')));_0x33c097[_0x048f('0x6')](_0x048f('0x10'),require(_0x048f('0x11')));_0x33c097[_0x048f('0x6')](_0x048f('0x12'),require(_0x048f('0x13')));_0x33c097[_0x048f('0x6')](_0x048f('0x14'),require(_0x048f('0x15')));_0x33c097[_0x048f('0x6')]('/api/voice/mails',require(_0x048f('0x16')));_0x33c097[_0x048f('0x6')](_0x048f('0x17'),require(_0x048f('0x18')));_0x33c097[_0x048f('0x6')](_0x048f('0x19'),require('./api/voiceCallReport'));_0x33c097[_0x048f('0x6')](_0x048f('0x1a'),require('./api/voiceDialReport'));_0x33c097['use']('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x33c097['use'](_0x048f('0x1b'),require(_0x048f('0x1c')));_0x33c097[_0x048f('0x6')](_0x048f('0x1d'),require('./api/memberReport'));_0x33c097[_0x048f('0x6')](_0x048f('0x1e'),require(_0x048f('0x1f')));_0x33c097[_0x048f('0x6')](_0x048f('0x20'),require('./api/voiceTransferReport'));_0x33c097[_0x048f('0x6')](_0x048f('0x21'),require('./api/mailServerOut'));_0x33c097[_0x048f('0x6')](_0x048f('0x22'),require(_0x048f('0x23')));_0x33c097['use'](_0x048f('0x24'),require(_0x048f('0x25')));_0x33c097[_0x048f('0x6')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x33c097[_0x048f('0x6')](_0x048f('0x26'),require(_0x048f('0x27')));_0x33c097[_0x048f('0x6')]('/api/mail/messages',require(_0x048f('0x28')));_0x33c097[_0x048f('0x6')](_0x048f('0x29'),require('./api/mailApplication'));_0x33c097['use'](_0x048f('0x2a'),require(_0x048f('0x2b')));_0x33c097[_0x048f('0x6')](_0x048f('0x2c'),require(_0x048f('0x2d')));_0x33c097[_0x048f('0x6')](_0x048f('0x2e'),require(_0x048f('0x2f')));_0x33c097[_0x048f('0x6')](_0x048f('0x30'),require(_0x048f('0x31')));_0x33c097[_0x048f('0x6')]('/api/fax/applications',require(_0x048f('0x32')));_0x33c097[_0x048f('0x6')](_0x048f('0x33'),require(_0x048f('0x34')));_0x33c097[_0x048f('0x6')]('/api/fax/messages',require(_0x048f('0x35')));_0x33c097[_0x048f('0x6')](_0x048f('0x36'),require(_0x048f('0x37')));_0x33c097[_0x048f('0x6')]('/api/fax/reports/queue',require(_0x048f('0x38')));_0x33c097[_0x048f('0x6')](_0x048f('0x39'),require(_0x048f('0x3a')));_0x33c097[_0x048f('0x6')]('/api/sms/applications',require(_0x048f('0x3b')));_0x33c097[_0x048f('0x6')]('/api/sms/interactions',require(_0x048f('0x3c')));_0x33c097[_0x048f('0x6')](_0x048f('0x3d'),require(_0x048f('0x3e')));_0x33c097[_0x048f('0x6')](_0x048f('0x3f'),require(_0x048f('0x40')));_0x33c097[_0x048f('0x6')](_0x048f('0x41'),require(_0x048f('0x42')));_0x33c097[_0x048f('0x6')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x33c097[_0x048f('0x6')]('/api/openchannel/interactions',require(_0x048f('0x43')));_0x33c097[_0x048f('0x6')](_0x048f('0x44'),require('./api/openchannelMessage'));_0x33c097['use'](_0x048f('0x45'),require('./api/openchannelQueue'));_0x33c097[_0x048f('0x6')]('/api/chat/websites',require(_0x048f('0x46')));_0x33c097[_0x048f('0x6')]('/api/openchannel/reports/queue',require(_0x048f('0x47')));_0x33c097['use'](_0x048f('0x48'),require(_0x048f('0x49')));_0x33c097[_0x048f('0x6')]('/api/chat/interactions',require('./api/chatInteraction'));_0x33c097[_0x048f('0x6')](_0x048f('0x4a'),require('./api/chatMessage'));_0x33c097[_0x048f('0x6')](_0x048f('0x4b'),require(_0x048f('0x4c')));_0x33c097[_0x048f('0x6')](_0x048f('0x4d'),require('./api/chatQueue'));_0x33c097['use'](_0x048f('0x4e'),require(_0x048f('0x4f')));_0x33c097[_0x048f('0x6')](_0x048f('0x50'),require(_0x048f('0x51')));_0x33c097[_0x048f('0x6')](_0x048f('0x52'),require(_0x048f('0x53')));_0x33c097[_0x048f('0x6')](_0x048f('0x54'),require('./api/cmContact'));_0x33c097['use'](_0x048f('0x55'),require(_0x048f('0x56')));_0x33c097[_0x048f('0x6')](_0x048f('0x57'),require(_0x048f('0x58')));_0x33c097[_0x048f('0x6')](_0x048f('0x59'),require('./api/cmHopperFinal'));_0x33c097[_0x048f('0x6')](_0x048f('0x5a'),require(_0x048f('0x5b')));_0x33c097[_0x048f('0x6')](_0x048f('0x5c'),require(_0x048f('0x5d')));_0x33c097[_0x048f('0x6')](_0x048f('0x5e'),require(_0x048f('0x5f')));_0x33c097['use'](_0x048f('0x60'),require(_0x048f('0x61')));_0x33c097['use']('/api/canned_answers',require(_0x048f('0x62')));_0x33c097[_0x048f('0x6')](_0x048f('0x63'),require(_0x048f('0x64')));_0x33c097['use'](_0x048f('0x65'),require(_0x048f('0x66')));_0x33c097[_0x048f('0x6')](_0x048f('0x67'),require(_0x048f('0x68')));_0x33c097[_0x048f('0x6')](_0x048f('0x69'),require('./api/pause'));_0x33c097[_0x048f('0x6')](_0x048f('0x6a'),require(_0x048f('0x6b')));_0x33c097[_0x048f('0x6')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x33c097[_0x048f('0x6')](_0x048f('0x6c'),require(_0x048f('0x6d')));_0x33c097[_0x048f('0x6')]('/api/sounds',require(_0x048f('0x6e')));_0x33c097[_0x048f('0x6')](_0x048f('0x6f'),require('./api/tag'));_0x33c097['use'](_0x048f('0x70'),require(_0x048f('0x71')));_0x33c097['use']('/api/cm_contact_has_items',require(_0x048f('0x72')));_0x33c097[_0x048f('0x6')](_0x048f('0x73'),require(_0x048f('0x74')));_0x33c097[_0x048f('0x6')](_0x048f('0x75'),require(_0x048f('0x76')));_0x33c097[_0x048f('0x6')](_0x048f('0x77'),require(_0x048f('0x78')));_0x33c097[_0x048f('0x6')](_0x048f('0x79'),require(_0x048f('0x7a')));_0x33c097['use'](_0x048f('0x7b'),require(_0x048f('0x7c')));_0x33c097[_0x048f('0x6')]('/api/integrations/reports',require(_0x048f('0x7d')));_0x33c097['use'](_0x048f('0x7e'),require(_0x048f('0x7f')));_0x33c097[_0x048f('0x6')](_0x048f('0x80'),require('./api/analyticDefaultReport'));_0x33c097[_0x048f('0x6')](_0x048f('0x81'),require('./api/analyticExtractedReport'));_0x33c097['use'](_0x048f('0x82'),require('./api/analyticMetric'));_0x33c097[_0x048f('0x6')](_0x048f('0x83'),require(_0x048f('0x84')));_0x33c097['use'](_0x048f('0x85'),require(_0x048f('0x86')));_0x33c097[_0x048f('0x6')](_0x048f('0x87'),require(_0x048f('0x88')));_0x33c097[_0x048f('0x6')](_0x048f('0x89'),require(_0x048f('0x8a')));_0x33c097['use']('/api/integrations/salesforce/fields',require(_0x048f('0x8b')));_0x33c097[_0x048f('0x6')]('/api/integrations/sugarcrm/accounts',require(_0x048f('0x8c')));_0x33c097[_0x048f('0x6')](_0x048f('0x8d'),require(_0x048f('0x8e')));_0x33c097[_0x048f('0x6')](_0x048f('0x8f'),require(_0x048f('0x90')));_0x33c097['use'](_0x048f('0x91'),require(_0x048f('0x92')));_0x33c097['use'](_0x048f('0x93'),require(_0x048f('0x94')));_0x33c097[_0x048f('0x6')](_0x048f('0x95'),require(_0x048f('0x96')));_0x33c097[_0x048f('0x6')](_0x048f('0x97'),require(_0x048f('0x98')));_0x33c097[_0x048f('0x6')](_0x048f('0x99'),require(_0x048f('0x9a')));_0x33c097[_0x048f('0x6')](_0x048f('0x9b'),require(_0x048f('0x9c')));_0x33c097['use'](_0x048f('0x9d'),require(_0x048f('0x9e')));_0x33c097[_0x048f('0x6')](_0x048f('0x9f'),require('./api/intZendeskConfiguration'));_0x33c097[_0x048f('0x6')]('/api/integrations/zendesk/fields',require(_0x048f('0xa0')));_0x33c097['use'](_0x048f('0xa1'),require('./api/intFreshdeskAccount'));_0x33c097[_0x048f('0x6')](_0x048f('0xa2'),require(_0x048f('0xa3')));_0x33c097[_0x048f('0x6')](_0x048f('0xa4'),require('./api/intFreshdeskField'));_0x33c097['use'](_0x048f('0xa5'),require(_0x048f('0xa6')));_0x33c097[_0x048f('0x6')](_0x048f('0xa7'),require(_0x048f('0xa8')));_0x33c097[_0x048f('0x6')](_0x048f('0xa9'),require('./api/intVtigerField'));_0x33c097[_0x048f('0x6')](_0x048f('0xaa'),require(_0x048f('0xab')));_0x33c097[_0x048f('0x6')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x33c097[_0x048f('0x6')](_0x048f('0xac'),require(_0x048f('0xad')));_0x33c097[_0x048f('0x6')](_0x048f('0xae'),require(_0x048f('0xaf')));_0x33c097['use'](_0x048f('0xb0'),require('./api/intDynamics365Configuration'));_0x33c097[_0x048f('0x6')](_0x048f('0xb1'),require('./api/intDynamics365Field'));_0x33c097['use'](_0x048f('0xb2'),require('./api/intFreshsalesAccount'));_0x33c097['use']('/api/integrations/freshsales/configurations',require(_0x048f('0xb3')));_0x33c097['use'](_0x048f('0xb4'),require(_0x048f('0xb5')));_0x33c097[_0x048f('0x6')](_0x048f('0xb6'),require('./api/network'));_0x33c097['use']('/api/chat/reports/queue',require(_0x048f('0xb7')));_0x33c097[_0x048f('0x6')](_0x048f('0xb8'),require(_0x048f('0xb9')));_0x33c097['use'](_0x048f('0xba'),require('./api/jscriptyAnswerReport'));_0x33c097[_0x048f('0x6')](_0x048f('0xbb'),require(_0x048f('0xbc')));_0x33c097[_0x048f('0x6')](_0x048f('0xbd'),require(_0x048f('0xbe')));_0x33c097[_0x048f('0x6')](_0x048f('0xbf'),require('./api/smsQueueReport'));_0x33c097[_0x048f('0x6')](_0x048f('0xc0'),require(_0x048f('0xc1')));_0x33c097[_0x048f('0x6')]('/api/square/details/reports',require(_0x048f('0xc2')));_0x33c097['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x33c097['use']('/api/settings',require(_0x048f('0xc3')));_0x33c097[_0x048f('0x6')](_0x048f('0xc4'),require(_0x048f('0xc5')));_0x33c097['use'](_0x048f('0xc6'),require(_0x048f('0xc7')));_0x33c097[_0x048f('0x6')](_0x048f('0xc8'),require(_0x048f('0xc9')));_0x33c097[_0x048f('0x6')](_0x048f('0xca'),require(_0x048f('0xcb')));_0x33c097[_0x048f('0x6')]('/api/teams',require('./api/team'));_0x33c097[_0x048f('0x6')]('/api/license',require(_0x048f('0xcc')));_0x33c097[_0x048f('0x6')](_0x048f('0xcd'),require(_0x048f('0xce')));_0x33c097[_0x048f('0x6')](_0x048f('0xcf'),require('./api/migration'));_0x33c097[_0x048f('0x6')]('/api/attachments',require('./api/attachment'));_0x33c097[_0x048f('0x6')](_0x048f('0xd0'),require(_0x048f('0xd1')));_0x33c097[_0x048f('0x6')](_0x048f('0xd2'),require('./api/mailTransferReport'));_0x33c097['use']('/api/chat/reports/transfer',require(_0x048f('0xd3')));_0x33c097[_0x048f('0x6')](_0x048f('0xd4'),require(_0x048f('0xd5')));_0x33c097['use'](_0x048f('0xd6'),require(_0x048f('0xd7')));_0x33c097['use'](_0x048f('0xd8'),require(_0x048f('0xd9')));_0x33c097[_0x048f('0x6')](_0x048f('0xda'),require('./api/cmList'));_0x33c097[_0x048f('0x6')]('/api/voice/prefixes',require(_0x048f('0xdb')));_0x33c097[_0x048f('0x6')](_0x048f('0xdc'),require(_0x048f('0xdd')));_0x33c097[_0x048f('0x6')](_0x048f('0xde'),require(_0x048f('0xdf')));_0x33c097[_0x048f('0x6')](_0x048f('0xe0'),require(_0x048f('0xe1')));_0x33c097[_0x048f('0x6')](_0x048f('0xe2'),require(_0x048f('0xe3')));_0x33c097[_0x048f('0x6')](_0x048f('0xe4'),require(_0x048f('0xe5')));_0x33c097[_0x048f('0x6')]('/api/whatsapp/applications',require(_0x048f('0xe6')));_0x33c097[_0x048f('0x6')]('/api/whatsapp/interactions',require(_0x048f('0xe7')));_0x33c097['use'](_0x048f('0xe8'),require(_0x048f('0xe9')));_0x33c097[_0x048f('0x6')](_0x048f('0xea'),require(_0x048f('0xeb')));_0x33c097['use'](_0x048f('0xec'),require('./api/whatsappTransferReport'));_0x33c097[_0x048f('0x6')](_0x048f('0xed'),require('./api/whatsappQueue'));_0x33c097['use'](_0x048f('0xee'),require(_0x048f('0xef')));_0x33c097[_0x048f('0x6')](_0x048f('0xf0'),require(_0x048f('0xf1')));_0x33c097[_0x048f('0x6')]('/api/user-settings',require(_0x048f('0xf2')));_0x33c097[_0x048f('0x6')]('/api/mail_interaction_has_tags',require(_0x048f('0xf3')));_0x33c097[_0x048f('0x6')](_0x048f('0xf4'),require(_0x048f('0xf5')));_0x33c097[_0x048f('0x6')](_0x048f('0xf6'),require('./api/authGoogle'));_0x33c097[_0x048f('0x6')](_0x048f('0xf7'),require('./api/authActiveDirectory'));_0x33c097[_0x048f('0x6')]('/api/jira',require(_0x048f('0xf8')));_0x33c097[_0x048f('0x6')](_0x048f('0xf9'),require(_0x048f('0xfa')));_0x33c097['use'](_0x048f('0xfb'),require(_0x048f('0xfc')));_0x33c097[_0x048f('0x6')](_0x048f('0xfd'),require(_0x048f('0xfe')));_0x33c097[_0x048f('0x6')](_0x048f('0xff'),require(_0x048f('0x100')));_0x33c097['use'](_0x048f('0x101'),require(_0x048f('0x102')));_0x33c097[_0x048f('0x6')](_0x048f('0x103'),clientSideLogs);_0x33c097[_0x048f('0x6')]('/apidoc',express[_0x048f('0x104')](path[_0x048f('0x105')](config['root'],_0x048f('0x106'))));_0x33c097[_0x048f('0x6')](_0x048f('0x107'),express['static'](path[_0x048f('0x105')](config[_0x048f('0x108')],_0x048f('0x107'))));_0x33c097[_0x048f('0x6')](_0x048f('0x109'),express[_0x048f('0x104')](path[_0x048f('0x105')](config[_0x048f('0x108')],_0x048f('0x109'))));_0x33c097[_0x048f('0x6')](_0x048f('0x10a'),express[_0x048f('0x104')](path[_0x048f('0x105')](config['root'],_0x048f('0x10b'),_0x048f('0x10c'))));_0x33c097['use'](_0x048f('0x10d'),express[_0x048f('0x104')](path[_0x048f('0x105')](config[_0x048f('0x108')],_0x048f('0x10e'))));_0x33c097[_0x048f('0x10f')](_0x048f('0x110'))[_0x048f('0x111')](errors[0x194]);_0x33c097['route']('/*')[_0x048f('0x111')](function(_0x4fd7d2,_0x53fc6c){_0x53fc6c['sendFile'](path['resolve'](_0x33c097[_0x048f('0x111')](_0x048f('0x112'))+'/index.html'));});return _0x33c097;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a64206d..697ab5c 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3eea=['../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.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/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.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/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc'];(function(_0x5f3f60,_0x5623b3){var _0x3f0e96=function(_0x2cd826){while(--_0x2cd826){_0x5f3f60['push'](_0x5f3f60['shift']());}};_0x3f0e96(++_0x5623b3);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x238774,_0x49bce6){_0x238774=_0x238774-0x0;var _0x5c7b9a=_0x3eea[_0x238774];return _0x5c7b9a;};'use strict';var jayson=require(_0xa3ee('0x0'));var _=require('lodash');var config=require(_0xa3ee('0x1'));exports[_0xa3ee('0x2')]=function(){return new Promise(function(_0x16512c,_0x1c6a49){var _0x46acfa={};_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x4')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x5')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x6')));_0x46acfa=_['merge'](_0x46acfa,require('../api/voiceRecording/voiceRecording.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x7')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/trunk/trunk.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x8')));_0x46acfa=_['merge'](_0x46acfa,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x9')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0xa')));_0x46acfa=_['merge'](_0x46acfa,require(_0xa3ee('0xb')));_0x46acfa=_['merge'](_0x46acfa,require(_0xa3ee('0xc')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0xd')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/mailApplication/mailApplication.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0xe')));_0x46acfa=_['merge'](_0x46acfa,require('../api/faxAccount/faxAccount.rpc'));_0x46acfa=_['merge'](_0x46acfa,require(_0xa3ee('0xf')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x10')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/faxMessage/faxMessage.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x11')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x12')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/smsAccount/smsAccount.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x13')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x14')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x15')));_0x46acfa=_['merge'](_0x46acfa,require(_0xa3ee('0x16')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x17')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x18')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x19')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x1a')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x1b')));_0x46acfa=_['merge'](_0x46acfa,require(_0xa3ee('0x1c')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x1d')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x1e')));_0x46acfa=_['merge'](_0x46acfa,require(_0xa3ee('0x1f')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x20')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x21')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x22')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x23')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/sound/sound.rpc'));_0x46acfa=_['merge'](_0x46acfa,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/template/template.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x24')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x25')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x26')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x27')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x28')));_0x46acfa=_['merge'](_0x46acfa,require(_0xa3ee('0x29')));_0x46acfa=_['merge'](_0x46acfa,require(_0xa3ee('0x2a')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x2b')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x2c')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x2d')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/squareReport/squareReport.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/setting/setting.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/squareOdbc/squareOdbc.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x2e')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x2f')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x30')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x31')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x32')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x33')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x34')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x35')));_0x46acfa=_['merge'](_0x46acfa,require(_0xa3ee('0x36')));_0x46acfa=_[_0xa3ee('0x3')](_0x46acfa,require(_0xa3ee('0x37')));var _0x5b95e3=jayson[_0xa3ee('0x38')](_0x46acfa)[_0xa3ee('0x39')]();var _0x5f4d6f=config[_0xa3ee('0x3a')][_0xa3ee('0x3b')]||config['port']+0x1;var _0x2a8e02=config[_0xa3ee('0x3a')]['ip']||_0xa3ee('0x3c');_0x5b95e3['on'](_0xa3ee('0x3d'),function(_0x1f0023){return _0x1c6a49(_0x1f0023);});_0x5b95e3[_0xa3ee('0x2')](_0x5f4d6f,_0x2a8e02,function(){console[_0xa3ee('0x3e')](_0xa3ee('0x3f'),_0x2a8e02,_0x5f4d6f);require(_0xa3ee('0x40'))[_0xa3ee('0x41')]();return _0x16512c(_0xa3ee('0x42')+_0x2a8e02+':'+_0x5f4d6f);});});}; \ No newline at end of file +var _0xbb27=['../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb27,0x1cd));var _0x7bb2=function(_0x30b631,_0x2603ac){_0x30b631=_0x30b631-0x0;var _0x5d4397=_0xbb27[_0x30b631];return _0x5d4397;};'use strict';var jayson=require(_0x7bb2('0x0'));var _=require(_0x7bb2('0x1'));var config=require('../config/environment');exports[_0x7bb2('0x2')]=function(){return new Promise(function(_0x4255ae,_0x4c2226){var _0xddd883={};_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/user/user.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x4')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/voiceQueue/voiceQueue.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x5')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x6')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x7')));_0xddd883=_['merge'](_0xddd883,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x8')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/memberReport/memberReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/trunk/trunk.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x9')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0xa')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0xb')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0xc')));_0xddd883=_['merge'](_0xddd883,require('../api/mailQueue/mailQueue.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0xd')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0xe')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0xf')));_0xddd883=_['merge'](_0xddd883,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x10')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/faxApplication/faxApplication.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x11')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x12')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x13')));_0xddd883=_['merge'](_0xddd883,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x14')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/smsInteraction/smsInteraction.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x15')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/smsQueue/smsQueue.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x16')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x17')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x18')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x19')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1a')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1b')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/cmContact/cmContact.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1c')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1d')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1e')));_0xddd883=_['merge'](_0xddd883,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1f')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x20')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x21')));_0xddd883=_['merge'](_0xddd883,require('../api/sound/sound.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x22')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x23')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x24')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/variable/variable.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x25')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x26')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x27')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x28')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x29')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2a')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2b')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2c')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2d')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2e')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2f')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x30')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x31')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/setting/setting.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x32')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x33')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/squareRecording/squareRecording.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x34')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/campaign/campaign.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x35')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x36')));_0xddd883=_['merge'](_0xddd883,require('../api/whatsappAccount/whatsappAccount.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x37')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x38')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x39')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x3a')));var _0x315886=jayson[_0x7bb2('0x3b')](_0xddd883)['http']();var _0x260d42=config[_0x7bb2('0x3c')]['port']||config[_0x7bb2('0x3d')]+0x1;var _0x5c8323=config[_0x7bb2('0x3c')]['ip']||_0x7bb2('0x3e');_0x315886['on'](_0x7bb2('0x3f'),function(_0x4a00bf){return _0x4c2226(_0x4a00bf);});_0x315886[_0x7bb2('0x2')](_0x260d42,_0x5c8323,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5c8323,_0x260d42);require(_0x7bb2('0x40'))[_0x7bb2('0x41')]();return _0x4255ae(_0x7bb2('0x42')+_0x5c8323+':'+_0x260d42);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 1d352dd..97bfa5a 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 _0x12c2=['./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','toLowerCase','hangup','substring','520-Invalid','search','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','inherits','prototype','sendRequest','sync','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','format','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','EventEmitter'];(function(_0x367a3d,_0x452717){var _0x460539=function(_0x1e8beb){while(--_0x1e8beb){_0x367a3d['push'](_0x367a3d['shift']());}};_0x460539(++_0x452717);}(_0x12c2,0xdc));var _0x212c=function(_0x5a97b8,_0x5a7945){_0x5a97b8=_0x5a97b8-0x0;var _0x54b165=_0x12c2[_0x5a97b8];return _0x54b165;};'use strict';var util=require('util');var _=require(_0x212c('0x0'));var EventEmitter=require('events')[_0x212c('0x1')];var AGIReply=require(_0x212c('0x2'));var AGIError=require(_0x212c('0x3'));function AGIChannel(_0x3741a8){var _0x371c5f=this,_0x29c99e=new AGIReply(),_0x183fcc=![],_0x15a9eb={};EventEmitter[_0x212c('0x4')](_0x371c5f);_0x3741a8[_0x212c('0x5')](_0x212c('0x6'));_0x3741a8[_0x212c('0x7')](0x8*0x3c*0x3c*0x3e8);_0x29c99e['setEncoding'](_0x212c('0x6'));_0x29c99e['on'](_0x212c('0x8'),function(_0x57c432){for(var _0x25f9cd in _0x57c432){_0x371c5f[_0x25f9cd]=_0x57c432[_0x25f9cd];}_0x371c5f[_0x212c('0x9')]('ready');});_0x29c99e['on']('line',function(_0x26cb81){if(_0x26cb81[_0x212c('0xa')]()==_0x212c('0xb')){_0x371c5f[_0x212c('0x9')](_0x212c('0xb'));return;}if(_0x26cb81[_0x212c('0xc')](0x0,0xb)==_0x212c('0xd')){_0x183fcc=!![];}if(_0x183fcc){_0x15a9eb['rx']+=_0x26cb81+'\x0a';if(_0x26cb81[_0x212c('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x183fcc=![];}}else{_0x15a9eb['rx']=_0x26cb81;}if(_0x183fcc){return;}if(typeof _0x15a9eb['cb']=='function'){var _0xe9c21c=_0x15a9eb['rx'][_0x212c('0xc')](0x0,0x3),_0x1ff515=null,_0x6f2902=null;_0xe9c21c=parseInt(_0xe9c21c);if(isNaN(_0xe9c21c)){_0x15a9eb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x212c('0xf')});return;}if(_0xe9c21c!=0xc8){_0x15a9eb['cb'](null,{'code':_0xe9c21c,'result':-0x1,'extra':'KO'});return;}_0x1ff515=_0x15a9eb['rx'][_0x212c('0xc')](0x4)[_0x212c('0x10')]('result=','');if(_0x1ff515[_0x212c('0x11')]('\x20')!=-0x1){_0x1ff515=_0x1ff515[_0x212c('0x12')](0x0,_0x1ff515[_0x212c('0x11')]('\x20'));}if(_[_0x212c('0x13')](_0x1ff515,'-1')){_0x1ff515=parseInt(_0x1ff515);}_0x6f2902=_0x15a9eb['rx'][_0x212c('0x14')]('\x20');if(_0x6f2902[_0x212c('0x15')]==0x3){_0x6f2902=_0x6f2902[0x2][_0x212c('0xc')](0x1,_0x6f2902[0x2][_0x212c('0x15')]-0x1);}else if(_0x6f2902[_0x212c('0x15')]>0x3){var _0x15e38f=/\((.+)\)/;var _0xf60d67=_0x15a9eb['rx'][_0x212c('0x16')](_0x15e38f);if(_0xf60d67){_0x6f2902=_0xf60d67[0x1];}else{_0x6f2902=null;}}else{_0x6f2902=null;}_0x15a9eb['cb'](null,{'code':_0xe9c21c,'result':_0x1ff515,'extra':_0x6f2902});}});_0x3741a8['on'](_0x212c('0x17'),function(_0x14ef56){_0x371c5f[_0x212c('0x9')](_0x212c('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x14ef56[_0x212c('0x18')]));});_0x3741a8['on']('close',function(){_0x371c5f[_0x212c('0x9')](_0x212c('0x19'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x3741a8['on'](_0x212c('0x1a'),function(){_0x371c5f[_0x212c('0x9')]('timeout',new AGIError(_0x212c('0x1b')));_0x3741a8[_0x212c('0x1c')]();});_0x3741a8['pipe'](_0x29c99e);this[_0x212c('0x1d')]=function(_0x1cdb9e,_0x20f77a){var _0x1cdb9e=_0x1cdb9e||'',_0x20f77a=typeof _0x20f77a==_0x212c('0x1e')?_0x20f77a:new Function();_0x15a9eb={'tx':_0x1cdb9e,'rx':'','cb':_0x20f77a};_0x3741a8[_0x212c('0x1f')](_0x1cdb9e+'\x0a');},this[_0x212c('0x19')]=function(){_0x3741a8[_0x212c('0x1c')]();};}util[_0x212c('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x212c('0x21')][_0x212c('0x22')]=function(_0x2ff09b){return this[_0x212c('0x1d')][_0x212c('0x23')](this,_0x2ff09b);};AGIChannel[_0x212c('0x21')]['answer']=function(){return this[_0x212c('0x22')]('ANSWER');};AGIChannel['prototype'][_0x212c('0x24')]=function(_0x58a800,_0x5417d6,_0x1590a8){_0x58a800=_0x58a800===undefined?'beep':_0x58a800;_0x5417d6=_0x5417d6===undefined?'5':_0x5417d6;_0x1590a8=_0x1590a8===undefined?'1':_0x1590a8;return this[_0x212c('0x22')](util['format'](_0x212c('0x25'),_0x58a800,_0x5417d6*0x3e8,_0x1590a8));};AGIChannel[_0x212c('0x21')][_0x212c('0x26')]=function(_0x576892){_0x576892=_0x576892||_0x212c('0x27');return this[_0x212c('0x22')](util['format']('VERBOSE\x20\x22%s\x22',_0x576892));};AGIChannel[_0x212c('0x21')][_0x212c('0x28')]=function(_0x49f841,_0x4cb1ed){if(_[_0x212c('0x29')](_0x4cb1ed)){return this[_0x212c('0x22')](util[_0x212c('0x2a')](_0x212c('0x2b'),_0x49f841,_0x4cb1ed['join'](',')));}return this[_0x212c('0x22')](util['format'](_0x212c('0x2b'),_0x49f841,_0x4cb1ed));};AGIChannel[_0x212c('0x21')]['setContext']=function(_0x4266c5){return this[_0x212c('0x22')](util[_0x212c('0x2a')](_0x212c('0x2c'),_0x4266c5));};AGIChannel[_0x212c('0x21')]['setExtension']=function(_0x437e10){return this[_0x212c('0x22')](util[_0x212c('0x2a')](_0x212c('0x2d'),_0x437e10));};AGIChannel[_0x212c('0x21')][_0x212c('0x2e')]=function(_0x1e7b18){return this[_0x212c('0x22')](util[_0x212c('0x2a')](_0x212c('0x2f'),_0x1e7b18));};AGIChannel[_0x212c('0x21')][_0x212c('0xb')]=function(){return this[_0x212c('0x22')](_0x212c('0x30'));};AGIChannel[_0x212c('0x21')][_0x212c('0x31')]=function(_0x5e68b3,_0x446438){var _0x51de92=_[_0x212c('0x32')](_0x446438)||_[_0x212c('0x33')](_0x446438)?_0x446438[_0x212c('0x34')]():_0x446438;return this['sendRequest'](util[_0x212c('0x2a')](_0x212c('0x35'),_0x5e68b3,_0x51de92?_0x51de92['toString']()[_0x212c('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x212c('0x36')]=function(_0x2e5ee9,_0x165286){return this[_0x212c('0x22')](util['format'](_0x212c('0x37'),_0x2e5ee9,_0x165286));};AGIChannel[_0x212c('0x21')]['sayDigits']=function(_0x51d14c,_0x2a1ef3){return this[_0x212c('0x22')](util[_0x212c('0x2a')](_0x212c('0x38'),_0x51d14c,_0x2a1ef3));};AGIChannel['prototype'][_0x212c('0x39')]=function(_0x1e4179,_0x350928){return this[_0x212c('0x22')](util[_0x212c('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1e4179,_0x350928));};AGIChannel[_0x212c('0x21')][_0x212c('0x3a')]=function(_0x3ae538,_0x3001cd,_0x15ca82){_0x3001cd=_0x3001cd||this[_0x212c('0x3b')];_0x15ca82=_0x15ca82||0x1;this[_0x212c('0x3c')](_0x3ae538);this['setExtension'](_0x3001cd);this[_0x212c('0x2e')](_0x15ca82);return this[_0x212c('0x26')](util['format'](_0x212c('0x3d'),_0x3ae538,_0x3001cd,_0x15ca82));};AGIChannel[_0x212c('0x21')][_0x212c('0x3e')]=function(_0x1affd0){return this[_0x212c('0x22')](util[_0x212c('0x2a')](_0x212c('0x3f'),_0x1affd0));};AGIChannel[_0x212c('0x21')][_0x212c('0x40')]=function(_0x2aee7d,_0x2ba412,_0xd8e890,_0x2fb0b7,_0x5981e5,_0xcacf7e){_0x2ba412=_0x2ba412||_0x212c('0x41');_0xd8e890=_0xd8e890||'';_0x2fb0b7=_0x2fb0b7===undefined?-0x1:_0x2fb0b7==='-1'?-0x1:_0x2fb0b7*0x3e8;_0x5981e5=_0x5981e5===undefined?'':'s='+_0x5981e5;_0xcacf7e=_0xcacf7e?_0x212c('0x42'):'';return this[_0x212c('0x22')](util[_0x212c('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x2aee7d,_0x2ba412,_0xd8e890,_0x2fb0b7,_0xcacf7e,_0x5981e5));};AGIChannel['prototype'][_0x212c('0x43')]=function(_0x4fcc43,_0x1d18a1){_0x1d18a1=_0x1d18a1||'';return this['sendRequest'](util[_0x212c('0x2a')](_0x212c('0x44'),_0x4fcc43,_0x1d18a1));};AGIChannel[_0x212c('0x21')]['agi']=function(_0x93a1b3){return this[_0x212c('0x28')](_0x212c('0x45'),_0x93a1b3);};AGIChannel[_0x212c('0x21')][_0x212c('0x46')]=function(_0x3c8ed7){return this[_0x212c('0x28')]('WAIT',_0x3c8ed7);};AGIChannel[_0x212c('0x21')][_0x212c('0x17')]=function(_0x51055c,_0x4ff81e){this[_0x212c('0x26')](util[_0x212c('0x2a')](_0x212c('0x47'),_0x51055c['id'],_0x51055c[_0x212c('0x48')],_0x4ff81e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x212c('0x49')]=AGIChannel; \ No newline at end of file +var _0xecb2=['SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','EventEmitter','call','setEncoding','utf8','headers','ready','line','hangup','emit','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','setExtension'];(function(_0x416305,_0x4af117){var _0x2279ee=function(_0x3ca419){while(--_0x3ca419){_0x416305['push'](_0x416305['shift']());}};_0x2279ee(++_0x4af117);}(_0xecb2,0xf6));var _0x2ecb=function(_0x5bf03b,_0x5dea4b){_0x5bf03b=_0x5bf03b-0x0;var _0x58d957=_0xecb2[_0x5bf03b];return _0x58d957;};'use strict';var util=require(_0x2ecb('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0x2ecb('0x1')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x1bb230){var _0x2f3639=this,_0x393e7c=new AGIReply(),_0x2a4fe5=![],_0x1d007c={};EventEmitter[_0x2ecb('0x2')](_0x2f3639);_0x1bb230['setEncoding']('utf8');_0x1bb230['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x393e7c[_0x2ecb('0x3')](_0x2ecb('0x4'));_0x393e7c['on'](_0x2ecb('0x5'),function(_0x3bd683){for(var _0x40d20a in _0x3bd683){_0x2f3639[_0x40d20a]=_0x3bd683[_0x40d20a];}_0x2f3639['emit'](_0x2ecb('0x6'));});_0x393e7c['on'](_0x2ecb('0x7'),function(_0x35755){if(_0x35755['toLowerCase']()==_0x2ecb('0x8')){_0x2f3639[_0x2ecb('0x9')](_0x2ecb('0x8'));return;}if(_0x35755[_0x2ecb('0xa')](0x0,0xb)==_0x2ecb('0xb')){_0x2a4fe5=!![];}if(_0x2a4fe5){_0x1d007c['rx']+=_0x35755+'\x0a';if(_0x35755['search'](_0x2ecb('0xc'))!=-0x1){_0x2a4fe5=![];}}else{_0x1d007c['rx']=_0x35755;}if(_0x2a4fe5){return;}if(typeof _0x1d007c['cb']==_0x2ecb('0xd')){var _0x3d74b3=_0x1d007c['rx'][_0x2ecb('0xa')](0x0,0x3),_0x29cb3d=null,_0x59568c=null;_0x3d74b3=parseInt(_0x3d74b3);if(isNaN(_0x3d74b3)){_0x1d007c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2ecb('0xe')});return;}if(_0x3d74b3!=0xc8){_0x1d007c['cb'](null,{'code':_0x3d74b3,'result':-0x1,'extra':'KO'});return;}_0x29cb3d=_0x1d007c['rx']['substring'](0x4)[_0x2ecb('0xf')](_0x2ecb('0x10'),'');if(_0x29cb3d['indexOf']('\x20')!=-0x1){_0x29cb3d=_0x29cb3d[_0x2ecb('0x11')](0x0,_0x29cb3d[_0x2ecb('0x12')]('\x20'));}if(_[_0x2ecb('0x13')](_0x29cb3d,'-1')){_0x29cb3d=parseInt(_0x29cb3d);}_0x59568c=_0x1d007c['rx'][_0x2ecb('0x14')]('\x20');if(_0x59568c[_0x2ecb('0x15')]==0x3){_0x59568c=_0x59568c[0x2][_0x2ecb('0xa')](0x1,_0x59568c[0x2][_0x2ecb('0x15')]-0x1);}else if(_0x59568c[_0x2ecb('0x15')]>0x3){var _0x662ef2=/\((.+)\)/;var _0x5ade76=_0x1d007c['rx'][_0x2ecb('0x16')](_0x662ef2);if(_0x5ade76){_0x59568c=_0x5ade76[0x1];}else{_0x59568c=null;}}else{_0x59568c=null;}_0x1d007c['cb'](null,{'code':_0x3d74b3,'result':_0x29cb3d,'extra':_0x59568c});}});_0x1bb230['on'](_0x2ecb('0x17'),function(_0x5a1d41){_0x2f3639[_0x2ecb('0x9')]('error',new AGIError(_0x2ecb('0x18'),_0x5a1d41[_0x2ecb('0x19')]));});_0x1bb230['on'](_0x2ecb('0x1a'),function(){_0x2f3639[_0x2ecb('0x9')](_0x2ecb('0x1a'),new AGIError(_0x2ecb('0x1b')));});_0x1bb230['on'](_0x2ecb('0x1c'),function(){_0x2f3639['emit'](_0x2ecb('0x1c'),new AGIError(_0x2ecb('0x1d')));_0x1bb230[_0x2ecb('0x1e')]();});_0x1bb230['pipe'](_0x393e7c);this[_0x2ecb('0x1f')]=function(_0x2b7aae,_0x4e3d3c){var _0x2b7aae=_0x2b7aae||'',_0x4e3d3c=typeof _0x4e3d3c=='function'?_0x4e3d3c:new Function();_0x1d007c={'tx':_0x2b7aae,'rx':'','cb':_0x4e3d3c};_0x1bb230[_0x2ecb('0x20')](_0x2b7aae+'\x0a');},this[_0x2ecb('0x1a')]=function(){_0x1bb230[_0x2ecb('0x1e')]();};}util[_0x2ecb('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x2ecb('0x22')]['sendRequest']=function(_0x5208f2){return this[_0x2ecb('0x1f')]['sync'](this,_0x5208f2);};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x23')]=function(){return this[_0x2ecb('0x24')](_0x2ecb('0x25'));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x26')]=function(_0x171259,_0x33695a,_0x28ee7a){_0x171259=_0x171259===undefined?_0x2ecb('0x27'):_0x171259;_0x33695a=_0x33695a===undefined?'5':_0x33695a;_0x28ee7a=_0x28ee7a===undefined?'1':_0x28ee7a;return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x29'),_0x171259,_0x33695a*0x3e8,_0x28ee7a));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x2a')]=function(_0x45059a){_0x45059a=_0x45059a||_0x2ecb('0x2b');return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x2c'),_0x45059a));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x2d')]=function(_0x4cfa56,_0x52f9f4){if(_[_0x2ecb('0x2e')](_0x52f9f4)){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x2f'),_0x4cfa56,_0x52f9f4['join'](',')));}return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x2f'),_0x4cfa56,_0x52f9f4));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x30')]=function(_0x1d6b16){return this['sendRequest'](util[_0x2ecb('0x28')]('SET\x20CONTEXT\x20%s',_0x1d6b16));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x31')]=function(_0x1db70c){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x32'),_0x1db70c));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x33')]=function(_0x2132ec){return this['sendRequest'](util[_0x2ecb('0x28')](_0x2ecb('0x34'),_0x2132ec));};AGIChannel[_0x2ecb('0x22')]['hangup']=function(){return this[_0x2ecb('0x24')](_0x2ecb('0x35'));};AGIChannel[_0x2ecb('0x22')]['setVariable']=function(_0x1f75b7,_0x527e16){var _0x2a98b3=_[_0x2ecb('0x36')](_0x527e16)||_[_0x2ecb('0x37')](_0x527e16)?_0x527e16[_0x2ecb('0x38')]():_0x527e16;return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x39'),_0x1f75b7,_0x2a98b3?_0x2a98b3[_0x2ecb('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2ecb('0x22')]['sayNumber']=function(_0x119049,_0xb51d2c){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x3a'),_0x119049,_0xb51d2c));};AGIChannel[_0x2ecb('0x22')]['sayDigits']=function(_0x259c6b,_0x2f8f8c){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x3b'),_0x259c6b,_0x2f8f8c));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x3c')]=function(_0x361bde,_0x45e208){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x3d'),_0x361bde,_0x45e208));};AGIChannel[_0x2ecb('0x22')]['continueAt']=function(_0x466e71,_0x5944a0,_0x4a8899){_0x5944a0=_0x5944a0||this[_0x2ecb('0x3e')];_0x4a8899=_0x4a8899||0x1;this[_0x2ecb('0x30')](_0x466e71);this[_0x2ecb('0x31')](_0x5944a0);this[_0x2ecb('0x33')](_0x4a8899);return this['noop'](util['format']('GOTO\x20%s\x20%s\x20%s',_0x466e71,_0x5944a0,_0x4a8899));};AGIChannel[_0x2ecb('0x22')]['getVariable']=function(_0x5d566e){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x3f'),_0x5d566e));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x40')]=function(_0x2298c9,_0xfcdbbb,_0x35001f,_0x227c25,_0xaa3890,_0x2060f3){_0xfcdbbb=_0xfcdbbb||'wav';_0x35001f=_0x35001f||'';_0x227c25=_0x227c25===undefined?-0x1:_0x227c25==='-1'?-0x1:_0x227c25*0x3e8;_0xaa3890=_0xaa3890===undefined?'':'s='+_0xaa3890;_0x2060f3=_0x2060f3?_0x2ecb('0x41'):'';return this[_0x2ecb('0x24')](util['format'](_0x2ecb('0x42'),_0x2298c9,_0xfcdbbb,_0x35001f,_0x227c25,_0x2060f3,_0xaa3890));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x43')]=function(_0x4cf017,_0x504a32){_0x504a32=_0x504a32||'';return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x44'),_0x4cf017,_0x504a32));};AGIChannel[_0x2ecb('0x22')]['agi']=function(_0x18f322){return this[_0x2ecb('0x2d')](_0x2ecb('0x45'),_0x18f322);};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x46')]=function(_0x4f15dc){return this[_0x2ecb('0x2d')](_0x2ecb('0x47'),_0x4f15dc);};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x17')]=function(_0x58a788,_0x6cb307){this['noop'](util[_0x2ecb('0x28')](_0x2ecb('0x48'),_0x58a788['id'],_0x58a788[_0x2ecb('0x49')],_0x6cb307));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e0c0021..6ce8ede 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 _0x2385=['format','apply','message','name','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED'];(function(_0x193c13,_0x2fc1ee){var _0x24eb7e=function(_0x3a2b5d){while(--_0x3a2b5d){_0x193c13['push'](_0x193c13['shift']());}};_0x24eb7e(++_0x2fc1ee);}(_0x2385,0xa0));var _0x5238=function(_0xdd5b2f,_0x4bd07a){_0xdd5b2f=_0xdd5b2f-0x0;var _0xcebecd=_0x2385[_0xdd5b2f];return _0xcebecd;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x5238('0x0'),'E_AGI_SERVER_ERROR':_0x5238('0x1'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x5238('0x2'),'E_AGI_SOCKET_ERROR':_0x5238('0x3'),'E_AGI_SOCKET_CLOSE':_0x5238('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x5238('0x5'),'E_AGI_COMMAND_EMPTY':_0x5238('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5238('0x7'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x4187fe){var _0x4187fe=_0x4187fe||null,_0x520fb3=_0x520fb3||[],_0x2e764f=0x1,_0x4665fe='';if(!error[_0x4187fe]){_0x4187fe=_0x5238('0x8');}_0x520fb3['push'](error[_0x4187fe]);while(arguments[_0x2e764f]){_0x520fb3['push'](arguments[_0x2e764f]);_0x2e764f++;}_0x4665fe=util[_0x5238('0x9')][_0x5238('0xa')](util,_0x520fb3);this[_0x5238('0xb')]=_0x4665fe;this[_0x5238('0xc')]=_0x4187fe;}module['exports']=AGIError; \ No newline at end of file +var _0xc866=['Missing\x20\x27ivr.agi_network_script\x27.','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xc866,0x1a5));var _0x6c86=function(_0x15a130,_0x9fc057){_0x15a130=_0x15a130-0x0;var _0xd8f37c=_0xc866[_0x15a130];return _0xd8f37c;};'use strict';var util=require(_0x6c86('0x0'));var error={'E_AGI_UNDEFINED':_0x6c86('0x1'),'E_AGI_ARGUMENT_PORT':_0x6c86('0x2'),'E_AGI_SERVER_ERROR':_0x6c86('0x3'),'E_AGI_SERVER_CLOSE':_0x6c86('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x6c86('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x6c86('0x6'),'E_AGI_SOCKET_ERROR':_0x6c86('0x7'),'E_AGI_SOCKET_CLOSE':_0x6c86('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x6c86('0x9'),'E_AGI_COMMAND_EMPTY':_0x6c86('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6c86('0xb'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x14ffd0){var _0x14ffd0=_0x14ffd0||null,_0x277314=_0x277314||[],_0x5d8cff=0x1,_0x506bf3='';if(!error[_0x14ffd0]){_0x14ffd0='E_AGI_UNDEFINED';}_0x277314[_0x6c86('0xc')](error[_0x14ffd0]);while(arguments[_0x5d8cff]){_0x277314[_0x6c86('0xc')](arguments[_0x5d8cff]);_0x5d8cff++;}_0x506bf3=util[_0x6c86('0xd')][_0x6c86('0xe')](util,_0x277314);this[_0x6c86('0xf')]=_0x506bf3;this[_0x6c86('0x10')]=_0x14ffd0;}module[_0x6c86('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 2800591..2ea8ae9 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 _0x07c0=['localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','exports','lodash','EventEmitter','ioredis','./error','../../config/environment','redis','defaults'];(function(_0x2997fc,_0x47c18a){var _0x227fda=function(_0x57cea4){while(--_0x57cea4){_0x2997fc['push'](_0x2997fc['shift']());}};_0x227fda(++_0x47c18a);}(_0x07c0,0xb4));var _0x007c=function(_0x1846e2,_0xe66a3a){_0x1846e2=_0x1846e2-0x0;var _0x626282=_0x07c0[_0x1846e2];return _0x626282;};'use strict';var _=require(_0x007c('0x0'));var EventEmitter=require('events')[_0x007c('0x1')];var Redis=require(_0x007c('0x2'));var AGIError=require(_0x007c('0x3'));var config=require(_0x007c('0x4'));config[_0x007c('0x5')]=_[_0x007c('0x6')](config[_0x007c('0x5')],{'host':_0x007c('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x007c('0x8')]('agi',function(_0x405711){if(_0x405711)return eventEmitter[_0x007c('0x9')](_0x007c('0xa'),new AGIError(_0x007c('0xb'),_0x405711));});sub['on'](_0x007c('0xc'),function(_0x1a28bd,_0x33cf85){if(_0x1a28bd!==_0x007c('0xd'))return;try{var _0x3174c2=JSON[_0x007c('0xe')](_0x33cf85);eventEmitter['emit'](_0x007c('0xf'),_0x3174c2);}catch(_0x1b7c20){eventEmitter[_0x007c('0x9')](_0x007c('0xa'),new AGIError(_0x007c('0xb'),_0x1b7c20));}});module[_0x007c('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7b00=['projectUpdate','exports','events','../../config/environment','redis','subscribe','agi','E_AGI_SERVER_ERROR','parse','emit'];(function(_0x5b7c48,_0x51cc75){var _0x281824=function(_0x394f64){while(--_0x394f64){_0x5b7c48['push'](_0x5b7c48['shift']());}};_0x281824(++_0x51cc75);}(_0x7b00,0x160));var _0x07b0=function(_0x2c8e83,_0x272b88){_0x2c8e83=_0x2c8e83-0x0;var _0x28696e=_0x7b00[_0x2c8e83];return _0x28696e;};'use strict';var _=require('lodash');var EventEmitter=require(_0x07b0('0x0'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x07b0('0x1'));config[_0x07b0('0x2')]=_['defaults'](config[_0x07b0('0x2')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x07b0('0x2')]);sub[_0x07b0('0x3')](_0x07b0('0x4'),function(_0xabf1c2){if(_0xabf1c2)return eventEmitter['emit']('error',new AGIError(_0x07b0('0x5'),_0xabf1c2));});sub['on']('message',function(_0x1853f3,_0x3ec50d){if(_0x1853f3!=='agi')return;try{var _0x906741=JSON[_0x07b0('0x6')](_0x3ec50d);eventEmitter[_0x07b0('0x7')](_0x07b0('0x8'),_0x906741);}catch(_0x93aab3){eventEmitter['emit']('error',new AGIError(_0x07b0('0x5'),_0x93aab3));}});module[_0x07b0('0x9')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 50ee807..5ccdb4c 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 _0x7781=['agicommand','vswitch','target','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','info','length','no\x20edge/s\x20available','split'];(function(_0xa64da9,_0x549be6){var _0x2e5f3a=function(_0x39a178){while(--_0x39a178){_0xa64da9['push'](_0xa64da9['shift']());}};_0x2e5f3a(++_0x549be6);}(_0x7781,0x8b));var _0x1778=function(_0x1bc8bd,_0x4dc278){_0x1bc8bd=_0x1bc8bd-0x0;var _0x4ba40e=_0x7781[_0x1bc8bd];return _0x4ba40e;};'use strict';var _=require(_0x1778('0x0'));var logger=require('../../../config/logger')(_0x1778('0x1'));var verticesWithRetry=[_0x1778('0x2'),_0x1778('0x3'),_0x1778('0x4')];var Graph=function(){this[_0x1778('0x5')]={};this[_0x1778('0x6')]={};this[_0x1778('0x7')]=0x0;};Graph[_0x1778('0x8')][_0x1778('0x9')]=function(_0xcc0427){this[_0x1778('0x5')][_0xcc0427['id']]=_0xcc0427;this[_0x1778('0x6')][_0xcc0427['id']]=[];};Graph[_0x1778('0x8')][_0x1778('0xa')]=function(_0x3a99e1,_0xa51935,_0x248020){this[_0x1778('0x6')][_0x3a99e1][_0x1778('0xb')]({'target':_0xa51935,'condition':_0x248020});this[_0x1778('0x7')]+=0x1;};Graph[_0x1778('0x8')][_0x1778('0xc')]=function(){return _[_0x1778('0xc')](this[_0x1778('0x5')]);};Graph[_0x1778('0x8')]['relations']=function(){return this['numberOfEdges'];};Graph[_0x1778('0x8')]['getVertex']=function(_0x5e482d){return this['vertices'][_0x5e482d];};Graph['prototype']['traverseBFS']=function(_0x2d85b,_0x10406c){if(!this[_0x1778('0x5')][_0x2d85b]){return logger[_0x1778('0xd')]('no\x20vertex\x20found');}var _0x212ece=_0x10406c(this[_0x1778('0x5')][_0x2d85b]);if(!_0x212ece){return logger[_0x1778('0xd')]('stop\x20traverse');}if(this[_0x1778('0x6')][_0x2d85b][_0x1778('0xe')]===0x0){return logger[_0x1778('0xd')](_0x1778('0xf'));}for(var _0x3008e9=0x0,_0x1cdb47=[],_0x49818b=![];_0x3008e9\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','hasOwnProperty','indexOf','agi_','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','./server','listening','connection'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0x5534,0xa5));var _0x4553=function(_0x1b5d93,_0x4f20c8){_0x1b5d93=_0x1b5d93-0x0;var _0x4f54ed=_0x5534[_0x1b5d93];return _0x4f54ed;};'use strict';var _=require(_0x4553('0x0'));var syncho=require(_0x4553('0x1'));var util=require(_0x4553('0x2'));var config=require(_0x4553('0x3'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0x4553('0x4'));var AGIEmitter=require('./events')[_0x4553('0x5')];var projects=[];config[_0x4553('0x6')]=_[_0x4553('0x7')](config[_0x4553('0x6')],{'ip':_0x4553('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x23fcc0){process[_0x4553('0x9')](function(){syncho(function(){try{setChannelVariables(_0x23fcc0);agiHandler(_0x23fcc0);}catch(_0xd41113){logger['error'](_0xd41113[_0x4553('0xa')]);}});});}function projectUpdateHandler(_0xa69384){try{var _0x26d4ce=_[_0x4553('0xb')](projects,['id',_0xa69384['id']]);if(_0x26d4ce>-0x1){if(_0xa69384['deleted']===!![]){projects['splice'](_0x26d4ce,0x1);}else{projects[_0x26d4ce]=_0xa69384;}}else{projects[_0x4553('0xc')](_0xa69384);}}catch(_0x3c649f){logger['error'](_0x3c649f[_0x4553('0xa')]);}}function listeningHandler(){console[_0x4553('0xd')](_0x4553('0xe'),config['agi'][_0x4553('0xf')]);logger['info'](util[_0x4553('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x4553('0x6')]['ip'],config[_0x4553('0x6')][_0x4553('0xf')]));}function errorHandler(_0x4bd39e){if(_0x4bd39e&&_0x4bd39e[_0x4553('0x11')]&&_0x4bd39e[_0x4553('0x12')]){logger[_0x4553('0x13')](util['format'](_0x4553('0x14'),_0x4bd39e[_0x4553('0x11')],_0x4bd39e[_0x4553('0x12')]));}else{logger[_0x4553('0x13')](util['format'](_0x4553('0x15'),_0x4bd39e[_0x4553('0xa')]));}}function closeHandler(){logger['info'](util[_0x4553('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x4553('0x16')],this[_0x4553('0x17')],this[_0x4553('0x18')],this[_0x4553('0x19')]));try{createSquareReport(this);}catch(_0x567bc9){logger[_0x4553('0x13')](_0x567bc9[_0x4553('0xa')]);}}function timeoutHandler(){logger[_0x4553('0x1a')](util[_0x4553('0x10')](_0x4553('0x1b'),this[_0x4553('0x1c')],this['calleridname'],this['callerid'],this[_0x4553('0x18')],this[_0x4553('0x19')]));}function hangupHandler(){logger[_0x4553('0x1a')](util['format'](_0x4553('0x1d'),this['arg_1'],this[_0x4553('0x16')],this['callerid'],this[_0x4553('0x18')],this['uniqueid']));this[_0x4553('0x1e')]=!![];}function createSquareReport(_0x98976f,_0x5ecda3){rpc[_0x4553('0x1f')](_0x98976f)[_0x4553('0x20')](function(_0x443b74){if(_0x5ecda3){_0x5ecda3(null,_0x443b74);}})[_0x4553('0x21')](function(_0xef7bb3){if(_0x5ecda3){_0x5ecda3(null,_0xef7bb3);}});}function setChannelVariables(_0x28fafd){for(var _0x2faaf0 in _0x28fafd){if(_0x28fafd[_0x4553('0x22')](_0x2faaf0)){if(_0x2faaf0[_0x4553('0x23')](_0x4553('0x24'))===0x0){_0x28fafd[_0x2faaf0['substring'](0x4)]=_0x28fafd[_0x2faaf0];delete _0x28fafd[_0x2faaf0];}}}}function agiHandler(_0x5f3ef6){logger[_0x4553('0x25')]('variables',JSON[_0x4553('0x26')](_0x5f3ef6,null,0x2));logger[_0x4553('0x1a')](util[_0x4553('0x10')](_0x4553('0x27'),_0x5f3ef6[_0x4553('0x1c')],_0x5f3ef6[_0x4553('0x16')],_0x5f3ef6[_0x4553('0x17')],_0x5f3ef6['dnid'],_0x5f3ef6[_0x4553('0x19')]));_0x5f3ef6['on']('error',errorHandler);_0x5f3ef6['on'](_0x4553('0x28'),closeHandler);_0x5f3ef6['on'](_0x4553('0x29'),timeoutHandler);_0x5f3ef6['evtHangup']=![];_0x5f3ef6['on']('hangup',hangupHandler);var _0xf86490=_[_0x4553('0x2a')](projects,[_0x4553('0x11'),_0x5f3ef6[_0x4553('0x1c')]]);if(!_0xf86490)return Project['handleNotFound'](_0x5f3ef6);if(!_0xf86490[_0x4553('0x2b')])return Project['handleUnpublished'](_0x5f3ef6);return Project[_0x4553('0x2c')](_0xf86490,_0x5f3ef6);}function main(){var _0x35e808;return utilLicense[_0x4553('0x2d')]()[_0x4553('0x20')](function(_0x2ae595){if(!_0x2ae595)return;if(_0x2ae595[_0x4553('0x2e')]){if(_0x2ae595[_0x4553('0x2f')]&&_0x2ae595[_0x4553('0x2f')]>0x0){logger[_0x4553('0x1a')](util[_0x4553('0x10')](_0x4553('0x30'),_0x2ae595[_0x4553('0x2f')]));_0x35e808=_0x2ae595[_0x4553('0x2f')];}else{logger[_0x4553('0x1a')](_0x4553('0x31'));}}else{logger[_0x4553('0x1a')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x35e808=-0x1;}})[_0x4553('0x20')](function(){return Project[_0x4553('0x32')]();})[_0x4553('0x20')](function(_0x279948){projects=_0x279948;return;})[_0x4553('0x21')](function(_0x124c61){logger[_0x4553('0x13')](_0x4553('0x33'),_0x124c61[_0x4553('0xa')]);})['finally'](function(){var _0x5475e9=require(_0x4553('0x34'))(config[_0x4553('0x6')][_0x4553('0xf')],config[_0x4553('0x6')]['ip'],_0x35e808);_0x5475e9['on'](_0x4553('0x13'),errorHandler);_0x5475e9['on'](_0x4553('0x35'),listeningHandler);_0x5475e9['on'](_0x4553('0x36'),connectionHandler);_0x5475e9['on'](_0x4553('0x28'),closeHandler);});}main(); \ No newline at end of file +var _0xe695=['log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','info','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','defaults','127.0.0.1','projectUpdate','nextTick','error','findIndex','deleted','splice','push'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe695,0x1e0));var _0x5e69=function(_0x24a2a3,_0x2add7d){_0x24a2a3=_0x24a2a3-0x0;var _0x42be31=_0xe695[_0x24a2a3];return _0x42be31;};'use strict';var _=require('lodash');var syncho=require(_0x5e69('0x0'));var util=require(_0x5e69('0x1'));var config=require('../../config/environment');var logger=require(_0x5e69('0x2'))(_0x5e69('0x3'));var utilLicense=require(_0x5e69('0x4'));var rpc=require(_0x5e69('0x5'));var Project=require(_0x5e69('0x6'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0x5e69('0x3')]=_[_0x5e69('0x7')](config['agi'],{'ip':_0x5e69('0x8'),'port':0x11dd});AGIEmitter['on'](_0x5e69('0x9'),projectUpdateHandler);function connectionHandler(_0x291b0e){process[_0x5e69('0xa')](function(){syncho(function(){try{setChannelVariables(_0x291b0e);agiHandler(_0x291b0e);}catch(_0x2b067f){logger[_0x5e69('0xb')](_0x2b067f['stack']);}});});}function projectUpdateHandler(_0x2a2897){try{var _0x51651c=_[_0x5e69('0xc')](projects,['id',_0x2a2897['id']]);if(_0x51651c>-0x1){if(_0x2a2897[_0x5e69('0xd')]===!![]){projects[_0x5e69('0xe')](_0x51651c,0x1);}else{projects[_0x51651c]=_0x2a2897;}}else{projects[_0x5e69('0xf')](_0x2a2897);}}catch(_0x308aa3){logger[_0x5e69('0xb')](_0x308aa3['stack']);}}function listeningHandler(){console[_0x5e69('0x10')](_0x5e69('0x11'),config[_0x5e69('0x3')][_0x5e69('0x12')]);logger['info'](util['format'](_0x5e69('0x13'),config[_0x5e69('0x3')]['ip'],config[_0x5e69('0x3')][_0x5e69('0x12')]));}function errorHandler(_0x58b500){if(_0x58b500&&_0x58b500[_0x5e69('0x14')]&&_0x58b500['message']){logger[_0x5e69('0xb')](util[_0x5e69('0x15')](_0x5e69('0x16'),_0x58b500['name'],_0x58b500['message']));}else{logger['error'](util[_0x5e69('0x15')](_0x5e69('0x17'),_0x58b500[_0x5e69('0x18')]));}}function closeHandler(){logger['info'](util[_0x5e69('0x15')](_0x5e69('0x19'),this[_0x5e69('0x1a')],this[_0x5e69('0x1b')],this[_0x5e69('0x1c')],this['dnid'],this[_0x5e69('0x1d')]));try{createSquareReport(this);}catch(_0x561796){logger[_0x5e69('0xb')](_0x561796[_0x5e69('0x18')]);}}function timeoutHandler(){logger[_0x5e69('0x1e')](util[_0x5e69('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5e69('0x1a')],this[_0x5e69('0x1b')],this['callerid'],this[_0x5e69('0x1f')],this[_0x5e69('0x1d')]));}function hangupHandler(){logger['info'](util[_0x5e69('0x15')](_0x5e69('0x20'),this[_0x5e69('0x1a')],this['calleridname'],this[_0x5e69('0x1c')],this[_0x5e69('0x1f')],this[_0x5e69('0x1d')]));this['evtHangup']=!![];}function createSquareReport(_0x21ea0b,_0x510411){rpc[_0x5e69('0x21')](_0x21ea0b)[_0x5e69('0x22')](function(_0x1924f4){if(_0x510411){_0x510411(null,_0x1924f4);}})[_0x5e69('0x23')](function(_0x1730ac){if(_0x510411){_0x510411(null,_0x1730ac);}});}function setChannelVariables(_0x111f8d){for(var _0x5ba2ad in _0x111f8d){if(_0x111f8d[_0x5e69('0x24')](_0x5ba2ad)){if(_0x5ba2ad[_0x5e69('0x25')](_0x5e69('0x26'))===0x0){_0x111f8d[_0x5ba2ad[_0x5e69('0x27')](0x4)]=_0x111f8d[_0x5ba2ad];delete _0x111f8d[_0x5ba2ad];}}}}function agiHandler(_0x150ca5){logger['debug'](_0x5e69('0x28'),JSON[_0x5e69('0x29')](_0x150ca5,null,0x2));logger[_0x5e69('0x1e')](util['format'](_0x5e69('0x2a'),_0x150ca5['arg_1'],_0x150ca5[_0x5e69('0x1b')],_0x150ca5[_0x5e69('0x1c')],_0x150ca5['dnid'],_0x150ca5['uniqueid']));_0x150ca5['on']('error',errorHandler);_0x150ca5['on'](_0x5e69('0x2b'),closeHandler);_0x150ca5['on'](_0x5e69('0x2c'),timeoutHandler);_0x150ca5['evtHangup']=![];_0x150ca5['on'](_0x5e69('0x2d'),hangupHandler);var _0x168ddb=_[_0x5e69('0x2e')](projects,['name',_0x150ca5[_0x5e69('0x1a')]]);if(!_0x168ddb)return Project[_0x5e69('0x2f')](_0x150ca5);if(!_0x168ddb[_0x5e69('0x30')])return Project[_0x5e69('0x31')](_0x150ca5);return Project[_0x5e69('0x32')](_0x168ddb,_0x150ca5);}function main(){var _0x100f7a;return utilLicense[_0x5e69('0x33')]()[_0x5e69('0x22')](function(_0x12d386){if(!_0x12d386)return;if(_0x12d386[_0x5e69('0x34')]){if(_0x12d386[_0x5e69('0x35')]&&_0x12d386[_0x5e69('0x35')]>0x0){logger[_0x5e69('0x1e')](util['format'](_0x5e69('0x36'),_0x12d386[_0x5e69('0x35')]));_0x100f7a=_0x12d386[_0x5e69('0x35')];}else{logger[_0x5e69('0x1e')](_0x5e69('0x37'));}}else{logger[_0x5e69('0x1e')](_0x5e69('0x38'));_0x100f7a=-0x1;}})[_0x5e69('0x22')](function(){return Project[_0x5e69('0x39')]();})[_0x5e69('0x22')](function(_0x326abf){projects=_0x326abf;return;})[_0x5e69('0x23')](function(_0x447c2e){logger[_0x5e69('0xb')]('[LICENSE]',_0x447c2e['stack']);})[_0x5e69('0x3a')](function(){var _0x55ce3b=require(_0x5e69('0x3b'))(config[_0x5e69('0x3')][_0x5e69('0x12')],config[_0x5e69('0x3')]['ip'],_0x100f7a);_0x55ce3b['on'](_0x5e69('0xb'),errorHandler);_0x55ce3b['on'](_0x5e69('0x3c'),listeningHandler);_0x55ce3b['on'](_0x5e69('0x3d'),connectionHandler);_0x55ce3b['on'](_0x5e69('0x2b'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 78cea7d..49034c6 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 _0x8bfb=['result','catch','sendMailMessage','SendMail','bluebird','client','request','error'];(function(_0x46809b,_0xf62788){var _0x14d974=function(_0x357258){while(--_0x357258){_0x46809b['push'](_0x46809b['shift']());}};_0x14d974(++_0xf62788);}(_0x8bfb,0x1f4));var _0xb8bf=function(_0x32e820,_0x1f9a44){_0x32e820=_0x32e820-0x0;var _0x43bc7a=_0x8bfb[_0x32e820];return _0x43bc7a;};'use strict';var BPromise=require(_0xb8bf('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xb8bf('0x1')]['http']({'port':0x232b});function request(_0x7ee6f2,_0x4a2887){return new BPromise(function(_0x430a54,_0x3ff36b){return client[_0xb8bf('0x2')](_0x7ee6f2,_0x4a2887)['then'](function(_0x33ceb0){if(_0x33ceb0[_0xb8bf('0x3')]){return _0x3ff36b(_0x33ceb0[_0xb8bf('0x3')]['message']);}else{return _0x430a54(_0x33ceb0[_0xb8bf('0x4')]);}})[_0xb8bf('0x5')](function(_0x539a94){return _0x3ff36b(_0x539a94);});});}exports[_0xb8bf('0x6')]=function(_0x4349b7,_0x8e5490){return request(_0xb8bf('0x7'),{'account':_0x4349b7,'message':_0x8e5490});}; \ No newline at end of file +var _0xd0e3=['then','message','result','catch','bluebird','client','request'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0xd0e3,0x138));var _0x3d0e=function(_0x7ceb4d,_0x3ead06){_0x7ceb4d=_0x7ceb4d-0x0;var _0x259b55=_0xd0e3[_0x7ceb4d];return _0x259b55;};'use strict';var BPromise=require(_0x3d0e('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x3d0e('0x1')]['http']({'port':0x232b});function request(_0x17a002,_0x580511){return new BPromise(function(_0xf3bb01,_0x2a74f4){return client[_0x3d0e('0x2')](_0x17a002,_0x580511)[_0x3d0e('0x3')](function(_0x2e59ab){if(_0x2e59ab['error']){return _0x2a74f4(_0x2e59ab['error'][_0x3d0e('0x4')]);}else{return _0xf3bb01(_0x2e59ab[_0x3d0e('0x5')]);}})[_0x3d0e('0x6')](function(_0x50bdf8){return _0x2a74f4(_0x50bdf8);});});}exports['sendMailMessage']=function(_0x355440,_0x1c4eca){return request('SendMail',{'account':_0x355440,'message':_0x1c4eca});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 4de67f3..71abbda 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 _0xda3e=['addVertex','mxCell','length','target','source','value','toJson','mxGraphModel','root','production','start','stringify','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','traverseBFS','clear','debug','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','stack','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','context','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','./rpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry'];(function(_0x4573f2,_0x51000f){var _0x49f692=function(_0x3488c3){while(--_0x3488c3){_0x4573f2['push'](_0x4573f2['shift']());}};_0x49f692(++_0x51000f);}(_0xda3e,0xa4));var _0xeda3=function(_0x10f746,_0x180311){_0x10f746=_0x10f746-0x0;var _0xcaf5f8=_0xda3e[_0x10f746];return _0xcaf5f8;};'use strict';var _=require(_0xeda3('0x0'));var moment=require(_0xeda3('0x1'));var parser=require(_0xeda3('0x2'));var util=require(_0xeda3('0x3'));var logger=require('../../config/logger')('agi');var rpc=require(_0xeda3('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0xeda3('0x5'));var Vertices=require(_0xeda3('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xeda3('0x7')](function(_0x190564){logger[_0xeda3('0x8')](_0xeda3('0x9'),_0x190564['stack']);return[];});}function addVertex(_0x4eb031,_0x590909,_0x13011f){_0x590909[_0xeda3('0xa')]=_0x13011f;if(_0x590909[_0xeda3('0xb')]('retry')){_0x590909['maxRetry']=parseInt(_0x590909[_0xeda3('0xc')],0xa);}_0x4eb031[_0xeda3('0xd')](_['omit'](_0x590909,_0xeda3('0xe')));}function initGraph(_0x304f36,_0xdbe2f9){var _0x5513dd=new Graph();for(var _0x5b3652 in _0x304f36){if(_0x304f36[_0xeda3('0xb')](_0x5b3652)){if(_['isArray'](_0x304f36[_0x5b3652])){for(var _0x53984d=0x0;_0x53984d<_0x304f36[_0x5b3652][_0xeda3('0xf')];_0x53984d+=0x1){addVertex(_0x5513dd,_0x304f36[_0x5b3652][_0x53984d],_0x5b3652);}}else{addVertex(_0x5513dd,_0x304f36[_0x5b3652],_0x5b3652);}}}for(var _0x21dde2=0x0;_0x21dde2<_0xdbe2f9[_0xeda3('0xf')];_0x21dde2+=0x1){if(_0xdbe2f9[_0x21dde2]['source']&&_0xdbe2f9[_0x21dde2][_0xeda3('0x10')]){_0x5513dd['addEdge'](_0xdbe2f9[_0x21dde2][_0xeda3('0x11')],_0xdbe2f9[_0x21dde2][_0xeda3('0x10')],_0xdbe2f9[_0x21dde2][_0xeda3('0x12')]);}}return _0x5513dd;}function getRoot(_0x3f4cb4){return parser[_0xeda3('0x13')](_0x3f4cb4,{'object':!![]})[_0xeda3('0x14')][_0xeda3('0x15')];}function inspect(_0x1a1eb6){return util['inspect'](_0x1a1eb6,{'showHidden':![],'depth':null});}function initialize(_0x562002,_0xefff8b){var _0x404a2a=getRoot(_0x562002[_0xeda3('0x16')]);if(!_0x404a2a||!_0x404a2a[_0xeda3('0x17')])return;var _0x26a9c4,_0x4d167d,_0x3f99aa;logger['debug'](_0xeda3('0x15'),JSON[_0xeda3('0x18')](_0x404a2a,null,0x2));_0xefff8b['joinAt']=moment()[_0xeda3('0x19')](_0xeda3('0x1a'));_0x26a9c4=initGraph(_['omit'](_0x404a2a,_0xeda3('0xe')),_0x404a2a[_0xeda3('0xe')]);_0x4d167d=new Vertices(_0xefff8b,rpc,mailRpc);logger['info'](util[_0xeda3('0x19')](_0xeda3('0x1b'),_0xefff8b[_0xeda3('0x1c')],_0xefff8b[_0xeda3('0x1d')],_0xefff8b[_0xeda3('0x1e')],_0xefff8b['dnid'],_0xefff8b['uniqueid']));_0x26a9c4[_0xeda3('0x1f')](_0x404a2a[_0xeda3('0x17')]['id'],function(_0x5daf66){try{_0x5daf66=_0x4d167d[_0xeda3('0x20')](_0x5daf66);logger[_0xeda3('0x21')](_0xeda3('0x22'),JSON[_0xeda3('0x18')](_0x5daf66,null,0x2));if(_0x5daf66[_0xeda3('0xa')]===_0xeda3('0x23')){logger[_0xeda3('0x24')](_0xeda3('0x25'));_0xefff8b['context']=_0x5daf66['context']||_0xefff8b['context'];_0xefff8b[_0xeda3('0x26')]=_0x5daf66[_0xeda3('0x26')];_0xefff8b[_0xeda3('0x27')]=_0x5daf66[_0xeda3('0x27')]?_0x5daf66[_0xeda3('0x27')]-0x1:0x1;return null;}else if(_0x5daf66&&_0x4d167d[_0x5daf66['agicommand']]){_0x3f99aa=_0x4d167d[_0x5daf66[_0xeda3('0xa')]](_0x5daf66);logger[_0xeda3('0x24')](_0xeda3('0x28'),JSON[_0xeda3('0x18')](_0x3f99aa,null,0x2));if(_0x3f99aa&&_0x3f99aa[_0xeda3('0x29')]===AGI_CODE_SUCCESS&&_0x3f99aa[_0xeda3('0x2a')]!==AGI_RESULT_ERROR&&!_0xefff8b[_0xeda3('0x2b')]){logger[_0xeda3('0x21')](_0xeda3('0x28'),inspect(_0x3f99aa));return _[_0xeda3('0x2c')](_0x3f99aa['result'])?null:_0x3f99aa[_0xeda3('0x2a')][_0xeda3('0x2d')]();}else{logger['error'](_0xeda3('0x28'),inspect(_0x3f99aa));return null;}}else{logger[_0xeda3('0x8')](_0xeda3('0x2e'));return null;}}catch(_0x478ff0){logger[_0xeda3('0x8')](_0x478ff0[_0xeda3('0x2f')]);return null;}});if(_0x404a2a['finally']){logger[_0xeda3('0x24')](util['format'](_0xeda3('0x30'),_0xefff8b[_0xeda3('0x1c')],_0xefff8b[_0xeda3('0x1d')],_0xefff8b[_0xeda3('0x1e')],_0xefff8b[_0xeda3('0x31')],_0xefff8b[_0xeda3('0x32')]));_0x26a9c4[_0xeda3('0x1f')](_0x404a2a[_0xeda3('0x33')]['id'],function(_0x5a42e5){try{_0x5a42e5=_0x4d167d['clear'](_0x5a42e5);logger[_0xeda3('0x21')](_0xeda3('0x22'),JSON[_0xeda3('0x18')](_0x5a42e5,null,0x2));if(_0x5a42e5&&_0x4d167d[_0x5a42e5[_0xeda3('0xa')]]){_0x3f99aa=_0x4d167d[_0x5a42e5['agicommand']](_0x5a42e5);if(_0x3f99aa){logger[_0xeda3('0x21')](_0xeda3('0x28'),inspect(_0x3f99aa));return _[_0xeda3('0x2c')](_0x3f99aa[_0xeda3('0x2a')])?null:_0x3f99aa[_0xeda3('0x2a')][_0xeda3('0x2d')]();}else{logger[_0xeda3('0x8')](_0xeda3('0x28'),inspect(_0x3f99aa));return null;}}else{logger[_0xeda3('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x132a0a){logger[_0xeda3('0x8')](_0x132a0a[_0xeda3('0x2f')]);return null;}});}logger['info'](util[_0xeda3('0x19')](_0xeda3('0x34'),_0xefff8b[_0xeda3('0x1c')],_0xefff8b[_0xeda3('0x1d')],_0xefff8b[_0xeda3('0x1e')],_0xefff8b[_0xeda3('0x31')],_0xefff8b['uniqueid']));logger[_0xeda3('0x24')](util[_0xeda3('0x19')](_0xeda3('0x35'),_0xefff8b[_0xeda3('0x36')],_0xefff8b['extension'],parseInt(_0xefff8b[_0xeda3('0x27')],0xa)+0x1));_0xefff8b[_0xeda3('0x37')](_0xefff8b[_0xeda3('0x36')],_0xefff8b[_0xeda3('0x26')],parseInt(_0xefff8b['priority'],0xa)+0x1);_0xefff8b[_0xeda3('0x38')]();}function handleNotFound(_0x46262c){logger[_0xeda3('0x8')](util['format']('Project\x20%s\x20not\x20found',_0x46262c[_0xeda3('0x1c')]));_0x46262c['continueAt'](_0x46262c['context'],_0x46262c['extension'],parseInt(_0x46262c['priority'],0xa)+0x1);_0x46262c['close']();}function handleUnpublished(_0x66dbf2){logger[_0xeda3('0x8')](util['format'](_0xeda3('0x39'),_0x66dbf2[_0xeda3('0x1c')]));_0x66dbf2[_0xeda3('0x37')](_0x66dbf2[_0xeda3('0x36')],_0x66dbf2[_0xeda3('0x26')],parseInt(_0x66dbf2[_0xeda3('0x27')],0xa)+0x1);_0x66dbf2[_0xeda3('0x38')]();}module[_0xeda3('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x6ed5=['joinAt','YYYY-MM-DD\x20HH:mm:ss','format','arg_1','clear','stringify','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','stack','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','traverseBFS','finally','vertex','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','value','root','inspect','debug'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x6ed5,0x158));var _0x56ed=function(_0x5e4952,_0x5a8f35){_0x5e4952=_0x5e4952-0x0;var _0xdd0cf7=_0x6ed5[_0x5e4952];return _0xdd0cf7;};'use strict';var _=require(_0x56ed('0x0'));var moment=require('moment');var parser=require(_0x56ed('0x1'));var util=require(_0x56ed('0x2'));var logger=require(_0x56ed('0x3'))(_0x56ed('0x4'));var rpc=require(_0x56ed('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x56ed('0x6'));var Vertices=require(_0x56ed('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x56ed('0x8')]()[_0x56ed('0x9')](function(_0x13a22b){logger[_0x56ed('0xa')](_0x56ed('0xb'),_0x13a22b['stack']);return[];});}function addVertex(_0x319b12,_0x4f11fc,_0xe4bed){_0x4f11fc[_0x56ed('0xc')]=_0xe4bed;if(_0x4f11fc['hasOwnProperty'](_0x56ed('0xd'))){_0x4f11fc[_0x56ed('0xe')]=parseInt(_0x4f11fc[_0x56ed('0xd')],0xa);}_0x319b12[_0x56ed('0xf')](_[_0x56ed('0x10')](_0x4f11fc,_0x56ed('0x11')));}function initGraph(_0x287fda,_0x2f561a){var _0x14d058=new Graph();for(var _0x1a8f27 in _0x287fda){if(_0x287fda[_0x56ed('0x12')](_0x1a8f27)){if(_[_0x56ed('0x13')](_0x287fda[_0x1a8f27])){for(var _0x4dd581=0x0;_0x4dd581<_0x287fda[_0x1a8f27][_0x56ed('0x14')];_0x4dd581+=0x1){addVertex(_0x14d058,_0x287fda[_0x1a8f27][_0x4dd581],_0x1a8f27);}}else{addVertex(_0x14d058,_0x287fda[_0x1a8f27],_0x1a8f27);}}}for(var _0x5805d3=0x0;_0x5805d3<_0x2f561a[_0x56ed('0x14')];_0x5805d3+=0x1){if(_0x2f561a[_0x5805d3][_0x56ed('0x15')]&&_0x2f561a[_0x5805d3]['target']){_0x14d058[_0x56ed('0x16')](_0x2f561a[_0x5805d3][_0x56ed('0x15')],_0x2f561a[_0x5805d3][_0x56ed('0x17')],_0x2f561a[_0x5805d3][_0x56ed('0x18')]);}}return _0x14d058;}function getRoot(_0x50a97a){return parser['toJson'](_0x50a97a,{'object':!![]})['mxGraphModel'][_0x56ed('0x19')];}function inspect(_0x2de447){return util[_0x56ed('0x1a')](_0x2de447,{'showHidden':![],'depth':null});}function initialize(_0x437d48,_0x4485c9){var _0x30df55=getRoot(_0x437d48['production']);if(!_0x30df55||!_0x30df55['start'])return;var _0x3e03c7,_0x50e8c1,_0x2a5872;logger[_0x56ed('0x1b')](_0x56ed('0x19'),JSON['stringify'](_0x30df55,null,0x2));_0x4485c9[_0x56ed('0x1c')]=moment()['format'](_0x56ed('0x1d'));_0x3e03c7=initGraph(_[_0x56ed('0x10')](_0x30df55,_0x56ed('0x11')),_0x30df55[_0x56ed('0x11')]);_0x50e8c1=new Vertices(_0x4485c9,rpc,mailRpc);logger['info'](util[_0x56ed('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4485c9[_0x56ed('0x1f')],_0x4485c9['calleridname'],_0x4485c9['callerid'],_0x4485c9['dnid'],_0x4485c9['uniqueid']));_0x3e03c7['traverseBFS'](_0x30df55['start']['id'],function(_0x511e9b){try{_0x511e9b=_0x50e8c1[_0x56ed('0x20')](_0x511e9b);logger[_0x56ed('0x1b')]('vertex',JSON[_0x56ed('0x21')](_0x511e9b,null,0x2));if(_0x511e9b[_0x56ed('0xc')]===_0x56ed('0x22')){logger[_0x56ed('0x23')](_0x56ed('0x24'));_0x4485c9['context']=_0x511e9b[_0x56ed('0x25')]||_0x4485c9['context'];_0x4485c9['extension']=_0x511e9b[_0x56ed('0x26')];_0x4485c9['priority']=_0x511e9b['priority']?_0x511e9b[_0x56ed('0x27')]-0x1:0x1;return null;}else if(_0x511e9b&&_0x50e8c1[_0x511e9b['agicommand']]){_0x2a5872=_0x50e8c1[_0x511e9b[_0x56ed('0xc')]](_0x511e9b);logger['info'](_0x56ed('0x28'),JSON[_0x56ed('0x21')](_0x2a5872,null,0x2));if(_0x2a5872&&_0x2a5872[_0x56ed('0x29')]===AGI_CODE_SUCCESS&&_0x2a5872[_0x56ed('0x2a')]!==AGI_RESULT_ERROR&&!_0x4485c9[_0x56ed('0x2b')]){logger['debug'](_0x56ed('0x28'),inspect(_0x2a5872));return _[_0x56ed('0x2c')](_0x2a5872[_0x56ed('0x2a')])?null:_0x2a5872[_0x56ed('0x2a')]['toString']();}else{logger[_0x56ed('0xa')](_0x56ed('0x28'),inspect(_0x2a5872));return null;}}else{logger[_0x56ed('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0xcd7a9){logger[_0x56ed('0xa')](_0xcd7a9[_0x56ed('0x2d')]);return null;}});if(_0x30df55['finally']){logger['info'](util[_0x56ed('0x1e')](_0x56ed('0x2e'),_0x4485c9['arg_1'],_0x4485c9['calleridname'],_0x4485c9[_0x56ed('0x2f')],_0x4485c9[_0x56ed('0x30')],_0x4485c9[_0x56ed('0x31')]));_0x3e03c7[_0x56ed('0x32')](_0x30df55[_0x56ed('0x33')]['id'],function(_0x2d6990){try{_0x2d6990=_0x50e8c1[_0x56ed('0x20')](_0x2d6990);logger[_0x56ed('0x1b')](_0x56ed('0x34'),JSON['stringify'](_0x2d6990,null,0x2));if(_0x2d6990&&_0x50e8c1[_0x2d6990[_0x56ed('0xc')]]){_0x2a5872=_0x50e8c1[_0x2d6990[_0x56ed('0xc')]](_0x2d6990);if(_0x2a5872){logger[_0x56ed('0x1b')]('response',inspect(_0x2a5872));return _[_0x56ed('0x2c')](_0x2a5872[_0x56ed('0x2a')])?null:_0x2a5872['result'][_0x56ed('0x35')]();}else{logger[_0x56ed('0xa')]('response',inspect(_0x2a5872));return null;}}else{logger[_0x56ed('0xa')](_0x56ed('0x36'));return null;}}catch(_0x2a7a89){logger[_0x56ed('0xa')](_0x2a7a89[_0x56ed('0x2d')]);return null;}});}logger[_0x56ed('0x23')](util['format'](_0x56ed('0x37'),_0x4485c9[_0x56ed('0x1f')],_0x4485c9[_0x56ed('0x38')],_0x4485c9[_0x56ed('0x2f')],_0x4485c9[_0x56ed('0x30')],_0x4485c9[_0x56ed('0x31')]));logger[_0x56ed('0x23')](util['format'](_0x56ed('0x39'),_0x4485c9[_0x56ed('0x25')],_0x4485c9['extension'],parseInt(_0x4485c9[_0x56ed('0x27')],0xa)+0x1));_0x4485c9[_0x56ed('0x3a')](_0x4485c9['context'],_0x4485c9['extension'],parseInt(_0x4485c9['priority'],0xa)+0x1);_0x4485c9[_0x56ed('0x3b')]();}function handleNotFound(_0x419e87){logger['error'](util[_0x56ed('0x1e')]('Project\x20%s\x20not\x20found',_0x419e87[_0x56ed('0x1f')]));_0x419e87[_0x56ed('0x3a')](_0x419e87[_0x56ed('0x25')],_0x419e87['extension'],parseInt(_0x419e87['priority'],0xa)+0x1);_0x419e87['close']();}function handleUnpublished(_0x121517){logger[_0x56ed('0xa')](util[_0x56ed('0x1e')](_0x56ed('0x3c'),_0x121517['arg_1']));_0x121517['continueAt'](_0x121517[_0x56ed('0x25')],_0x121517[_0x56ed('0x26')],parseInt(_0x121517[_0x56ed('0x27')],0xa)+0x1);_0x121517['close']();}module[_0x56ed('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6867b4b..33c94c3 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 _0x76c1=['_inBody','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','exports','util','stream','Transform','call','_localBuffer'];(function(_0x5b080b,_0xe34631){var _0x3d724c=function(_0x3175ac){while(--_0x3175ac){_0x5b080b['push'](_0x5b080b['shift']());}};_0x3d724c(++_0xe34631);}(_0x76c1,0x1b5));var _0x176c=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x76c1[_0x2db12b];return _0x20990b;};'use strict';var util=require(_0x176c('0x0'));var Transform=require(_0x176c('0x1'))[_0x176c('0x2')];function AGIReply(_0x1eac65){Transform[_0x176c('0x3')](this,_0x1eac65);this[_0x176c('0x4')]='';this[_0x176c('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x176c('0x6')]['_transform']=function(_0x5a2f77,_0x4c7aae,_0x4b15ba){var _0xf5f1fa='\x0a',_0x146f8e=['\x0a\x0a',_0x176c('0x7')],_0x52e5c2=-0x1,_0x1ac8a2=-0x1,_0x160ab1='',_0x57990a=0x0,_0xf5c5c5='',_0x39f0c9='';this['_localBuffer']+=_0x5a2f77[_0x176c('0x8')]();_0xf5c5c5=this['_localBuffer'];if(!this[_0x176c('0x5')]){_0x57990a=0x0;while(_0x146f8e[_0x57990a]){while((_0x1ac8a2=_0xf5c5c5[_0x176c('0x9')](_0x146f8e[_0x57990a]))!=-0x1){_0x160ab1=_0x146f8e[_0x57990a];_0x39f0c9=_0xf5c5c5[_0x176c('0xa')](0x0,_0x1ac8a2);_0xf5c5c5=_0xf5c5c5[_0x176c('0xa')](_0x1ac8a2+_0x160ab1[_0x176c('0xb')]);var _0x792a=_0x39f0c9[_0x176c('0xc')](_0xf5f1fa),_0x31e6b4=0x0,_0x5b0b49={},_0x13b3f6='',_0x4436b8='',_0x830623=-0x1;while(_0x792a[_0x31e6b4]){_0x830623=_0x792a[_0x31e6b4][_0x176c('0x9')](':');if(_0x830623!=-0x1){_0x13b3f6=_0x792a[_0x31e6b4][_0x176c('0xd')](0x0,_0x830623)[_0x176c('0xe')]();_0x4436b8=_0x792a[_0x31e6b4][_0x176c('0xd')](_0x830623+0x1)[_0x176c('0xe')]();if(_0x13b3f6[_0x176c('0xb')]>0x0){_0x5b0b49[_0x13b3f6]=_0x4436b8;}}else{}_0x31e6b4++;}this[_0x176c('0xf')]('headers',_0x5b0b49);this[_0x176c('0x5')]=!![];}_0x57990a++;}this[_0x176c('0x4')]=_0xf5c5c5;}else{while((_0x52e5c2=_0xf5c5c5[_0x176c('0x9')](_0xf5f1fa))!=-0x1){_0x39f0c9=_0xf5c5c5[_0x176c('0xa')](0x0,_0x52e5c2);this[_0x176c('0xf')]('line',_0x39f0c9);_0xf5c5c5=_0xf5c5c5[_0x176c('0xa')](_0x52e5c2+_0xf5f1fa[_0x176c('0xb')]);}this['_localBuffer']=_0xf5c5c5;}_0x4b15ba();};module[_0x176c('0x10')]=AGIReply; \ No newline at end of file +var _0x8b69=['substring','split','indexOf','trim','length','emit','headers','_inBody','line','exports','util','Transform','_localBuffer','inherits','_transform'];(function(_0x2bee30,_0x1bff03){var _0x60eb16=function(_0x2c9a93){while(--_0x2c9a93){_0x2bee30['push'](_0x2bee30['shift']());}};_0x60eb16(++_0x1bff03);}(_0x8b69,0x145));var _0x98b6=function(_0x9c445a,_0x36ccb1){_0x9c445a=_0x9c445a-0x0;var _0x48b216=_0x8b69[_0x9c445a];return _0x48b216;};'use strict';var util=require(_0x98b6('0x0'));var Transform=require('stream')[_0x98b6('0x1')];function AGIReply(_0x44ca81){Transform['call'](this,_0x44ca81);this[_0x98b6('0x2')]='';this['_inBody']=![];}util[_0x98b6('0x3')](AGIReply,Transform);AGIReply['prototype'][_0x98b6('0x4')]=function(_0x5e7e6e,_0x1a7190,_0x378d8b){var _0x312f14='\x0a',_0x344a33=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xd35f38=-0x1,_0x4d9ca9=-0x1,_0x160e3b='',_0x1e104b=0x0,_0x37c20a='',_0x352c16='';this[_0x98b6('0x2')]+=_0x5e7e6e['toString']();_0x37c20a=this[_0x98b6('0x2')];if(!this['_inBody']){_0x1e104b=0x0;while(_0x344a33[_0x1e104b]){while((_0x4d9ca9=_0x37c20a['indexOf'](_0x344a33[_0x1e104b]))!=-0x1){_0x160e3b=_0x344a33[_0x1e104b];_0x352c16=_0x37c20a[_0x98b6('0x5')](0x0,_0x4d9ca9);_0x37c20a=_0x37c20a[_0x98b6('0x5')](_0x4d9ca9+_0x160e3b['length']);var _0x3914a3=_0x352c16[_0x98b6('0x6')](_0x312f14),_0x287714=0x0,_0x3e70a7={},_0x528fe6='',_0x11395b='',_0x28c473=-0x1;while(_0x3914a3[_0x287714]){_0x28c473=_0x3914a3[_0x287714][_0x98b6('0x7')](':');if(_0x28c473!=-0x1){_0x528fe6=_0x3914a3[_0x287714]['slice'](0x0,_0x28c473)[_0x98b6('0x8')]();_0x11395b=_0x3914a3[_0x287714]['slice'](_0x28c473+0x1)[_0x98b6('0x8')]();if(_0x528fe6[_0x98b6('0x9')]>0x0){_0x3e70a7[_0x528fe6]=_0x11395b;}}else{}_0x287714++;}this[_0x98b6('0xa')](_0x98b6('0xb'),_0x3e70a7);this[_0x98b6('0xc')]=!![];}_0x1e104b++;}this[_0x98b6('0x2')]=_0x37c20a;}else{while((_0xd35f38=_0x37c20a[_0x98b6('0x7')](_0x312f14))!=-0x1){_0x352c16=_0x37c20a['substring'](0x0,_0xd35f38);this[_0x98b6('0xa')](_0x98b6('0xd'),_0x352c16);_0x37c20a=_0x37c20a['substring'](_0xd35f38+_0x312f14['length']);}this[_0x98b6('0x2')]=_0x37c20a;}_0x378d8b();};module[_0x98b6('0xe')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index dbef111..afc279b 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 _0x0faf=['production','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','name','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','lodash','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject'];(function(_0xb7a519,_0x5e2a9e){var _0x294b55=function(_0x50ff79){while(--_0x50ff79){_0xb7a519['push'](_0xb7a519['shift']());}};_0x294b55(++_0x5e2a9e);}(_0x0faf,0x132));var _0xf0fa=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x0faf[_0x24392f];return _0x591e33;};'use strict';var _=require(_0xf0fa('0x0'));var moment=require('moment');var jayson=require(_0xf0fa('0x1'));var client=jayson[_0xf0fa('0x2')][_0xf0fa('0x3')]({'port':0x2329});function request(_0x35a260,_0xccb93e){return new Promise(function(_0xdc9ce3,_0x515b12){return client[_0xf0fa('0x4')](_0x35a260,_0xccb93e)[_0xf0fa('0x5')](function(_0x5d9b58){if(_0x5d9b58[_0xf0fa('0x6')]){return _0x515b12(_0x5d9b58[_0xf0fa('0x6')][_0xf0fa('0x7')]);}else{return _0xdc9ce3(_0x5d9b58[_0xf0fa('0x8')]);}})[_0xf0fa('0x9')](function(_0x587865){return _0x515b12(_0x587865);});});}exports[_0xf0fa('0xa')]=function(){return request(_0xf0fa('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0xf0fa('0xc')]=function(_0x1e8cc0){return request(_0xf0fa('0xd'),{'options':{'raw':![],'where':{'name':_0x1e8cc0},'attributes':[_0xf0fa('0xe')]}});};exports[_0xf0fa('0xf')]=function(_0x1151ea){return request(_0xf0fa('0x10'),{'options':{'raw':![],'where':{'id':_0x1151ea},'include':[{'model':_0xf0fa('0x11'),'as':'Smtp','include':[{'model':_0xf0fa('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0xf0fa('0x13'),'email'],'smtp':!![]}});};exports[_0xf0fa('0x14')]=function(_0x17326f){return request(_0xf0fa('0xd'),{'options':{'where':{'id':_0x17326f},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x42591b){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x42591b},'attributes':[_0xf0fa('0x13')]}});};exports[_0xf0fa('0x15')]=function(_0x10ce43){return request(_0xf0fa('0x16'),{'options':{'where':{'id':_0x10ce43},'attributes':[_0xf0fa('0x13')]}});};exports[_0xf0fa('0x17')]=function(_0x28bab8){return request(_0xf0fa('0x18'),{'options':{'where':{'id':_0x28bab8},'attributes':['dsn']}});};exports[_0xf0fa('0x19')]=function(_0x477914){return request(_0xf0fa('0x1a'),{'options':{'where':{'id':_0x477914},'attributes':[_0xf0fa('0x13')]}});};exports[_0xf0fa('0x1b')]=function(_0x386e5f){return request('GetContactByPhone',{'options':{'where':{'phone':_0x386e5f['phone']},'attributes':['id']}});};exports[_0xf0fa('0x1c')]=function(_0x2751cc){return request(_0xf0fa('0x1d'),{'options':{'where':{'id':_0x2751cc},'attributes':[_0xf0fa('0x13')]}});};exports[_0xf0fa('0x1e')]=function(_0x403e7d){return request(_0xf0fa('0x1f'),{'options':{'where':{'id':_0x403e7d},'attributes':[_0xf0fa('0x20')]}});};exports[_0xf0fa('0x21')]=function(_0x15942b){return request(_0xf0fa('0x22'),{'options':{'raw':![],'where':{'id':_0x15942b},'include':[{'model':'Interval','as':_0xf0fa('0x23')}]}});};exports[_0xf0fa('0x24')]=function(_0x39e82d){return request(_0xf0fa('0x25'),{'options':{'where':{'id':_0x39e82d},'attributes':['id',_0xf0fa('0x13')]}});};exports[_0xf0fa('0x26')]=function(_0x3901aa){return request(_0xf0fa('0x27'),{'body':_0x3901aa});};exports[_0xf0fa('0x28')]=function(_0x4a897f){return request(_0xf0fa('0x29'),{'body':_0x4a897f});};exports[_0xf0fa('0x2a')]=function(_0x56134e){return request(_0xf0fa('0x2b'),{'body':_[_0xf0fa('0x2c')](_0x56134e,{'project_name':_0x56134e[_0xf0fa('0x2d')],'prev_project_name':_0x56134e['arg_2']||'','is_subproject':_0x56134e[_0xf0fa('0x2e')]?!![]:![],'leaveAt':moment()[_0xf0fa('0x2f')](_0xf0fa('0x30'))})});};exports[_0xf0fa('0x31')]=function(_0x4e6eef){return request('CreateSquareRecording',{'body':_0x4e6eef});};exports[_0xf0fa('0x32')]=function(_0x1c5eaf){return request(_0xf0fa('0x33'),{'body':_0x1c5eaf});};exports[_0xf0fa('0x34')]=function(_0x57b8e9){return request(_0xf0fa('0x35'),{'options':{'raw':![],'where':{'phone':_0x57b8e9[_0xf0fa('0x36')],'ListId':_0x57b8e9[_0xf0fa('0x37')]}}})['then'](function(_0x9ad0e3){if(_0x9ad0e3){return _0x9ad0e3;}return request('CreateCmContact',{'body':_0x57b8e9});});};exports[_0xf0fa('0x38')]=function(_0x1e3875){return request(_0xf0fa('0x39'),{'options':{'where':{'id':_0x1e3875},'attributes':['name']}});};exports[_0xf0fa('0x3a')]=function(_0x33cc64,_0x574ba7){return request(_0xf0fa('0x3b'),{'body':{'interface':_0x574ba7},'options':{'where':_0x33cc64}});};exports[_0xf0fa('0x3c')]=function(_0x9436e3,_0x490613,_0x534c10){return request(_0xf0fa('0x3d'),{'body':{'type':_0x490613,'uniqueid':_0x534c10},'options':{'where':_0x9436e3}});};exports[_0xf0fa('0x3e')]=function(_0x485fe2){return request(_0xf0fa('0x3f'),{'body':{},'options':{'where':_0x485fe2}});};exports['agentLogout']=function(_0x5ca1b2){return request('LogoutUser',{'body':{},'options':{'where':_0x5ca1b2}});}; \ No newline at end of file +var _0xc368=['agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','moment','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','ShowCmHopper','ListId','ShowPause'];(function(_0x5e424e,_0x4268f9){var _0x47e0c1=function(_0x1fdd87){while(--_0x1fdd87){_0x5e424e['push'](_0x5e424e['shift']());}};_0x47e0c1(++_0x4268f9);}(_0xc368,0x7b));var _0x8c36=function(_0x375103,_0x296882){_0x375103=_0x375103-0x0;var _0x1c8dea=_0xc368[_0x375103];return _0x1c8dea;};'use strict';var _=require('lodash');var moment=require(_0x8c36('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x8c36('0x1')][_0x8c36('0x2')]({'port':0x2329});function request(_0x20e697,_0x2640c5){return new Promise(function(_0x288b85,_0x5d3b27){return client[_0x8c36('0x3')](_0x20e697,_0x2640c5)[_0x8c36('0x4')](function(_0x912acb){if(_0x912acb[_0x8c36('0x5')]){return _0x5d3b27(_0x912acb['error']['message']);}else{return _0x288b85(_0x912acb[_0x8c36('0x6')]);}})[_0x8c36('0x7')](function(_0x3e76be){return _0x5d3b27(_0x3e76be);});});}exports[_0x8c36('0x8')]=function(){return request(_0x8c36('0x9'),{'options':{'raw':![],'attributes':['id',_0x8c36('0xa'),'production']}});};exports['getSquareProject']=function(_0x49f227){return request(_0x8c36('0xb'),{'options':{'raw':![],'where':{'name':_0x49f227},'attributes':[_0x8c36('0xc')]}});};exports['getMailAccountById']=function(_0x36cb13){return request(_0x8c36('0xd'),{'options':{'raw':![],'where':{'id':_0x36cb13},'include':[{'model':_0x8c36('0xe'),'as':_0x8c36('0xf'),'include':[{'model':_0x8c36('0x10'),'as':_0x8c36('0x10')}]}],'attributes':['id',_0x8c36('0xa'),_0x8c36('0x11')],'smtp':!![]}});};exports[_0x8c36('0x12')]=function(_0x11f8fa){return request(_0x8c36('0xb'),{'options':{'where':{'id':_0x11f8fa},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x13')]=function(_0x220f18){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x220f18},'attributes':[_0x8c36('0xa')]}});};exports['getVariableById']=function(_0xea7509){return request(_0x8c36('0x14'),{'options':{'where':{'id':_0xea7509},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x15')]=function(_0xcfdbf7){return request(_0x8c36('0x16'),{'options':{'where':{'id':_0xcfdbf7},'attributes':[_0x8c36('0x17')]}});};exports[_0x8c36('0x18')]=function(_0x30229e){return request('ShowUser',{'options':{'where':{'id':_0x30229e},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x19')]=function(_0x47832a){return request(_0x8c36('0x1a'),{'options':{'where':{'phone':_0x47832a[_0x8c36('0x1b')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x15100f){return request(_0x8c36('0x1c'),{'options':{'where':{'id':_0x15100f},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x1d')]=function(_0xc30310){return request(_0x8c36('0x1e'),{'options':{'where':{'id':_0xc30310},'attributes':[_0x8c36('0x1f')]}});};exports[_0x8c36('0x20')]=function(_0x153735){return request(_0x8c36('0x21'),{'options':{'raw':![],'where':{'id':_0x153735},'include':[{'model':_0x8c36('0x22'),'as':_0x8c36('0x23')}]}});};exports[_0x8c36('0x24')]=function(_0x51fd6c){return request('ShowSmsAccount',{'options':{'where':{'id':_0x51fd6c},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x2269f5){return request(_0x8c36('0x25'),{'body':_0x2269f5});};exports[_0x8c36('0x26')]=function(_0x2c9e9a){return request(_0x8c36('0x27'),{'body':_0x2c9e9a});};exports[_0x8c36('0x28')]=function(_0x4bf4c2){return request(_0x8c36('0x29'),{'body':_['merge'](_0x4bf4c2,{'project_name':_0x4bf4c2[_0x8c36('0x2a')],'prev_project_name':_0x4bf4c2['arg_2']||'','is_subproject':_0x4bf4c2[_0x8c36('0x2b')]?!![]:![],'leaveAt':moment()[_0x8c36('0x2c')](_0x8c36('0x2d'))})});};exports[_0x8c36('0x2e')]=function(_0x50aa48){return request('CreateSquareRecording',{'body':_0x50aa48});};exports[_0x8c36('0x2f')]=function(_0x28fa76){return request('CreateSquareMessage',{'body':_0x28fa76});};exports['createCmContact']=function(_0x418663){return request(_0x8c36('0x30'),{'options':{'raw':![],'where':{'phone':_0x418663['phone'],'ListId':_0x418663[_0x8c36('0x31')]}}})[_0x8c36('0x4')](function(_0x3ca98e){if(_0x3ca98e){return _0x3ca98e;}return request('CreateCmContact',{'body':_0x418663});});};exports['getPauseById']=function(_0x46b72f){return request(_0x8c36('0x32'),{'options':{'where':{'id':_0x46b72f},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x33')]=function(_0x3ae970,_0x2e8855){return request(_0x8c36('0x34'),{'body':{'interface':_0x2e8855},'options':{'where':_0x3ae970}});};exports[_0x8c36('0x35')]=function(_0xda4e74,_0x2d6476,_0x35a349){return request(_0x8c36('0x36'),{'body':{'type':_0x2d6476,'uniqueid':_0x35a349},'options':{'where':_0xda4e74}});};exports[_0x8c36('0x37')]=function(_0x178fe5){return request(_0x8c36('0x38'),{'body':{},'options':{'where':_0x178fe5}});};exports[_0x8c36('0x39')]=function(_0x2e6b95){return request('LogoutUser',{'body':{},'options':{'where':_0x2e6b95}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index ac1b7e6..bd0a528 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 _0x770d=['./lex','exports','./polly'];(function(_0x256c40,_0x36b434){var _0x35b78d=function(_0x33e3d6){while(--_0x33e3d6){_0x256c40['push'](_0x256c40['shift']());}};_0x35b78d(++_0x36b434);}(_0x770d,0x122));var _0xd770=function(_0x1ba9fe,_0x905f0d){_0x1ba9fe=_0x1ba9fe-0x0;var _0x35734f=_0x770d[_0x1ba9fe];return _0x35734f;};var polly=require(_0xd770('0x0'));var lex=require(_0xd770('0x1'));module[_0xd770('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xd9a8=['./polly','./lex','exports'];(function(_0x327015,_0x49075e){var _0xf1fe39=function(_0x41b2b3){while(--_0x41b2b3){_0x327015['push'](_0x327015['shift']());}};_0xf1fe39(++_0x49075e);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x12bff1,_0x44144d){_0x12bff1=_0x12bff1-0x0;var _0x4790bb=_0xd9a8[_0x12bff1];return _0x4790bb;};var polly=require(_0x8d9a('0x0'));var lex=require(_0x8d9a('0x1'));module[_0x8d9a('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 3f2f30a..6c6d4a1 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 _0xd8b0=['exports','./lib/api'];(function(_0x546e8d,_0x340638){var _0x546bdb=function(_0x1299e6){while(--_0x1299e6){_0x546e8d['push'](_0x546e8d['shift']());}};_0x546bdb(++_0x340638);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var lex=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]=function(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1){return lex(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48){return lex(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index dfd5adf..dd91616 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(_0x219ece,_0x4965b5){var _0x34bf11=function(_0x41b5f1){while(--_0x41b5f1){_0x219ece['push'](_0x219ece['shift']());}};_0x34bf11(++_0x4965b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x301747,_0x290dbe){var _0x2bed99=function(_0x34715c){while(--_0x34715c){_0x301747['push'](_0x301747['shift']());}};_0x2bed99(++_0x290dbe);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index f89f2ac..744c09e 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8166=['exports','./lib/api'];(function(_0x292285,_0x43e3cd){var _0x3cc006=function(_0x438ad5){while(--_0x438ad5){_0x292285['push'](_0x292285['shift']());}};_0x3cc006(++_0x43e3cd);}(_0x8166,0x119));var _0x6816=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x8166[_0x263f9d];return _0x4c4efa;};'use strict';var polly=require(_0x6816('0x0'));module[_0x6816('0x1')]=function(_0x22f592,_0x4e075a,_0x4d996a,_0x264fe1,_0x291fb2,_0x43c4b6,_0xc131da){return polly(_0x22f592,_0x4e075a,_0x4d996a,_0x264fe1,_0x291fb2,_0x43c4b6,_0xc131da);}; \ No newline at end of file +var _0x77ef=['./lib/api','exports'];(function(_0x24a37f,_0x54d074){var _0x2374b2=function(_0x5148e8){while(--_0x5148e8){_0x24a37f['push'](_0x24a37f['shift']());}};_0x2374b2(++_0x54d074);}(_0x77ef,0x1c8));var _0xf77e=function(_0x2c00d1,_0x5425fc){_0x2c00d1=_0x2c00d1-0x0;var _0x5a7f2f=_0x77ef[_0x2c00d1];return _0x5a7f2f;};'use strict';var polly=require(_0xf77e('0x0'));module[_0xf77e('0x1')]=function(_0x4612ef,_0x2c1d08,_0x54e857,_0x3ac3af,_0x241ffd,_0x100c3b,_0x88219e){return polly(_0x4612ef,_0x2c1d08,_0x54e857,_0x3ac3af,_0x241ffd,_0x100c3b,_0x88219e);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index b99776b..a92f45f 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 _0x86b1=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x1fcfe1,_0x5c0093){var _0x544c27=function(_0x4e3a3b){while(--_0x4e3a3b){_0x1fcfe1['push'](_0x1fcfe1['shift']());}};_0x544c27(++_0x5c0093);}(_0x86b1,0xc6));var _0x186b=function(_0x164697,_0x20473f){_0x164697=_0x164697-0x0;var _0x270ec4=_0x86b1[_0x164697];return _0x270ec4;};'use strict';var fs=require('fs');var path=require(_0x186b('0x0'));var BPromise=require(_0x186b('0x1'));var rs=require(_0x186b('0x2'));var AWS=require(_0x186b('0x3'));function pollyResult(_0x4bd32f,_0x19596b,_0x26e2af){return new BPromise(function(_0x4a8bfc,_0x26432c){_0x4bd32f[_0x186b('0x4')](_0x19596b,function(_0x5bf47a,_0xca384f){if(_0x5bf47a){_0x26432c(_0x5bf47a);}else if(_0xca384f){if(_0xca384f[_0x186b('0x5')]instanceof Buffer){fs[_0x186b('0x6')](_0x26e2af,_0xca384f[_0x186b('0x5')],function(_0xea3bde){if(_0xea3bde){_0x26432c(_0xea3bde);}else{_0x4a8bfc();}});}else{_0x26432c(new Error(_0x186b('0x7')));}}else{_0x26432c(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x186b('0x8')]=function(_0x5d516d,_0x356c98,_0x41b0e7,_0x5574bf,_0x7939aa,_0x29775a,_0x1c589a){var _0x17c062=new AWS[(_0x186b('0x9'))]({'accessKeyId':_0x5d516d,'secretAccessKey':_0x356c98,'region':_0x41b0e7});var _0x8db5a6={'Text':_0x7939aa,'TextType':_0x29775a||_0x186b('0xa'),'OutputFormat':'mp3','VoiceId':_0x5574bf};return pollyResult(_0x17c062,_0x8db5a6,_0x1c589a);}; \ No newline at end of file +var _0x8761=['exports','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile'];(function(_0x369bb1,_0x4bc373){var _0x3d9dd9=function(_0x2d1168){while(--_0x2d1168){_0x369bb1['push'](_0x369bb1['shift']());}};_0x3d9dd9(++_0x4bc373);}(_0x8761,0x68));var _0x1876=function(_0x1a937a,_0x227d6c){_0x1a937a=_0x1a937a-0x0;var _0x5443eb=_0x8761[_0x1a937a];return _0x5443eb;};'use strict';var fs=require('fs');var path=require(_0x1876('0x0'));var BPromise=require(_0x1876('0x1'));var rs=require(_0x1876('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x520d54,_0x5dc6fc,_0x50bc0b){return new BPromise(function(_0x492fd1,_0x3b044e){_0x520d54[_0x1876('0x3')](_0x5dc6fc,function(_0x313cf1,_0x1aecd5){if(_0x313cf1){_0x3b044e(_0x313cf1);}else if(_0x1aecd5){if(_0x1aecd5[_0x1876('0x4')]instanceof Buffer){fs[_0x1876('0x5')](_0x50bc0b,_0x1aecd5[_0x1876('0x4')],function(_0x4868bd){if(_0x4868bd){_0x3b044e(_0x4868bd);}else{_0x492fd1();}});}else{_0x3b044e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3b044e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x1876('0x6')]=function(_0x5c8686,_0x145ffa,_0xdcdf66,_0xcf1139,_0x304d90,_0x165c26,_0xdcc2d5){var _0x2f2fa4=new AWS[(_0x1876('0x7'))]({'accessKeyId':_0x5c8686,'secretAccessKey':_0x145ffa,'region':_0xdcdf66});var _0xb3da05={'Text':_0x304d90,'TextType':_0x165c26||_0x1876('0x8'),'OutputFormat':_0x1876('0x9'),'VoiceId':_0xcf1139};return pollyResult(_0x2f2fa4,_0xb3da05,_0xdcc2d5);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 74ff122..29aee94 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 _0x1d10=['./lib/api','exports'];(function(_0x43634a,_0x2a7f51){var _0x2aa5b4=function(_0x6f7a10){while(--_0x6f7a10){_0x43634a['push'](_0x43634a['shift']());}};_0x2aa5b4(++_0x2a7f51);}(_0x1d10,0x188));var _0x01d1=function(_0x206c5a,_0x435bbc){_0x206c5a=_0x206c5a-0x0;var _0x575836=_0x1d10[_0x206c5a];return _0x575836;};'use strict';var asr=require(_0x01d1('0x0'));module[_0x01d1('0x1')]=function(_0x58eefa,_0x14a547,_0x6e2575,_0x1f63be){return asr(_0x58eefa,_0x14a547,_0x6e2575);}; \ No newline at end of file +var _0xdf2c=['exports'];(function(_0x531682,_0x22c0c1){var _0x16bbe4=function(_0x1fbbd7){while(--_0x1fbbd7){_0x531682['push'](_0x531682['shift']());}};_0x16bbe4(++_0x22c0c1);}(_0xdf2c,0xaf));var _0xcdf2=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xdf2c[_0x2be8c2];return _0x97f531;};'use strict';var asr=require('./lib/api');module[_0xcdf2('0x0')]=function(_0x52906a,_0x2227a1,_0x337bbb,_0x171e03){return asr(_0x52906a,_0x2227a1,_0x337bbb);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 9e24b01..f925977 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 _0xd52a=['LINEAR16','8000','bluebird','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','toString','/v1/speech:recognize?key='];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd52a,0xca));var _0xad52=function(_0x3b8040,_0x77de75){_0x3b8040=_0x3b8040-0x0;var _0xf73bc6=_0xd52a[_0x3b8040];return _0xf73bc6;};'use strict';var url=require('url');var BPromise=require(_0xad52('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xad52('0x1')]=function(_0x7b9789,_0x30b335,_0x572592){return new BPromise(function(_0x3f4207,_0x383c44){var _0x130d6d;if(typeof _0x7b9789!==_0xad52('0x2')||_0x7b9789['length']===0x0){return _0x383c44('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x30b335!=='string'||_0x30b335[_0xad52('0x3')]===0x0){return _0x383c44('key\x20should\x20be\x20a\x20string');}if(typeof _0x572592!==_0xad52('0x4')&&(typeof _0x572592!=='string'||_0x572592[_0xad52('0x3')]===0x0)){return _0x383c44(_0xad52('0x5'));}try{_0x130d6d=fs['readFileSync'](_0x7b9789)[_0xad52('0x6')]('base64');}catch(_0x46fbc5){return _0x383c44(_0x46fbc5);}return _0x3f4207({'method':'POST','uri':host+_0xad52('0x7')+_0x30b335,'body':{'config':{'encoding':_0xad52('0x8'),'sampleRateHertz':_0xad52('0x9'),'languageCode':_0x572592},'audio':{'content':_0x130d6d}},'json':!![]});});}; \ No newline at end of file +var _0xb28a=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','8000','bluebird','https://speech.googleapis.com'];(function(_0x3801fc,_0x386ced){var _0x44eab7=function(_0x4331d2){while(--_0x4331d2){_0x3801fc['push'](_0x3801fc['shift']());}};_0x44eab7(++_0x386ced);}(_0xb28a,0x166));var _0xab28=function(_0x17736b,_0x58c164){_0x17736b=_0x17736b-0x0;var _0x484ec4=_0xb28a[_0x17736b];return _0x484ec4;};'use strict';var url=require('url');var BPromise=require(_0xab28('0x0'));var fs=require('fs');var host=_0xab28('0x1');module['exports']=function(_0x45d26d,_0x4cb73b,_0x5ae2aa){return new BPromise(function(_0x4b013a,_0x451fc9){var _0x1cdc41;if(typeof _0x45d26d!==_0xab28('0x2')||_0x45d26d[_0xab28('0x3')]===0x0){return _0x451fc9(_0xab28('0x4'));}if(typeof _0x4cb73b!==_0xab28('0x2')||_0x4cb73b[_0xab28('0x3')]===0x0){return _0x451fc9(_0xab28('0x5'));}if(typeof _0x5ae2aa!=='undefined'&&(typeof _0x5ae2aa!=='string'||_0x5ae2aa[_0xab28('0x3')]===0x0)){return _0x451fc9(_0xab28('0x6'));}try{_0x1cdc41=fs[_0xab28('0x7')](_0x45d26d)[_0xab28('0x8')](_0xab28('0x9'));}catch(_0x2ac052){return _0x451fc9(_0x2ac052);}return _0x4b013a({'method':'POST','uri':host+_0xab28('0xa')+_0x4cb73b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xab28('0xb'),'languageCode':_0x5ae2aa},'audio':{'content':_0x1cdc41}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 58b2d11..1166580 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 _0x7858=['./asr'];(function(_0x302ab3,_0x21ab7b){var _0x12c0ca=function(_0x91ebf6){while(--_0x91ebf6){_0x302ab3['push'](_0x302ab3['shift']());}};_0x12c0ca(++_0x21ab7b);}(_0x7858,0xbe));var _0x8785=function(_0x26fdde,_0x58f5cc){_0x26fdde=_0x26fdde-0x0;var _0x17f97a=_0x7858[_0x26fdde];return _0x17f97a;};var asr=require(_0x8785('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x7b8e=['exports','./asr'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7b8e,0x129));var _0xe7b8=function(_0x31163b,_0x520919){_0x31163b=_0x31163b-0x0;var _0x5f2597=_0x7b8e[_0x31163b];return _0x5f2597;};var asr=require(_0xe7b8('0x0'));module[_0xe7b8('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 7e3e9ea..679293e 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 _0x3dd6=['end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','stringify','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomAction','audiofile','dirName','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','POST','resolve','.mp3','from','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','null','slice','length','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3dd6,0x130));var _0x63dd=function(_0x290c31,_0x534b8a){_0x290c31=_0x290c31-0x0;var _0x2eb0ac=_0x3dd6[_0x290c31];return _0x2eb0ac;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x63dd('0x0'));var dialogflow=require(_0x63dd('0x1'));var fs=require('fs');var http=require(_0x63dd('0x2'));var https=require(_0x63dd('0x3'));var md5=require(_0x63dd('0x4'));var path=require(_0x63dd('0x5'));var querystring=require('querystring');var rp=require(_0x63dd('0x6'));var rs=require(_0x63dd('0x7'));var sox=require(_0x63dd('0x8'));var tts=require(_0x63dd('0x9'));var urlParse=require(_0x63dd('0xa'))[_0x63dd('0xb')];var util=require(_0x63dd('0xc'));var aws=require('./aws');var google=require(_0x63dd('0xd'));var sestek=require(_0x63dd('0xe'));var tilde=require(_0x63dd('0xf'));var logger=require(_0x63dd('0x10'))(_0x63dd('0x11'));var ISPEECH_API=_0x63dd('0x12');function downloadFile(_0x38be48,_0x39c836){return new BPromise(function(_0x52dd6c,_0xeaa86){var _0x474951=urlParse(_0x38be48);var _0x24c550=_0x474951[_0x63dd('0x13')]===_0x63dd('0x14')?https:http;var _0x2ad406={'host':_0x474951[_0x63dd('0x15')],'path':_0x474951[_0x63dd('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x24c550[_0x63dd('0x16')](_0x2ad406,function(_0x35075e){if(_0x35075e[_0x63dd('0x17')]!==0xc8){logger[_0x63dd('0x18')](_0x63dd('0x19')+_0x38be48+_0x63dd('0x1a')+_0x35075e['statusCode']+'\x20('+_0x35075e[_0x63dd('0x1b')]+')');_0xeaa86(new Error(_0x63dd('0x19')+_0x38be48+_0x63dd('0x1a')+_0x35075e[_0x63dd('0x17')]+'\x20('+_0x35075e[_0x63dd('0x1b')]+')'));return;}var _0x14ac94=fs[_0x63dd('0x1c')](_0x39c836);_0x14ac94['on'](_0x63dd('0x1d'),function(){logger[_0x63dd('0x1e')](_0x63dd('0x1f'));_0x14ac94[_0x63dd('0x20')](_0x52dd6c);});_0x14ac94['on']('error',function(_0x41315d){fs[_0x63dd('0x21')](_0x39c836);logger[_0x63dd('0x18')](_0x63dd('0x22'),_0x41315d);_0xeaa86(_0x41315d);});_0x35075e[_0x63dd('0x23')](_0x14ac94);})['on'](_0x63dd('0x18'),function(_0x17c3ff){logger['error'](_0x17c3ff);_0xeaa86(_0x17c3ff);})[_0x63dd('0x24')]();});}function uploadFile(_0x5579c3){return new BPromise(function(_0x5cc753,_0x495c3a){var _0x1e8d17=urlParse(_0x5579c3);var _0x4c0c1a=_0x1e8d17[_0x63dd('0x13')]===_0x63dd('0x14')?https:http;var _0x4e909a={'host':_0x1e8d17[_0x63dd('0x15')],'path':_0x1e8d17[_0x63dd('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x4c0c1a[_0x63dd('0x16')](_0x4e909a,function(_0x82a2ac){if(_0x82a2ac[_0x63dd('0x17')]!==0xc8){_0x495c3a(new Error(_0x63dd('0x19')+_0x5579c3+_0x63dd('0x1a')+_0x82a2ac['statusCode']+'\x20('+_0x82a2ac['statusMessage']+')'));return;}var _0x4d38ac='';_0x82a2ac['on'](_0x63dd('0x25'),function(_0x455657){_0x4d38ac+=_0x455657;});_0x82a2ac['on'](_0x63dd('0x24'),function(){_0x5cc753(_0x4d38ac);});})['on']('error',function(_0x3d7def){_0x495c3a(_0x3d7def);})[_0x63dd('0x24')]();});}function convertFile(_0x49f598,_0xe07393){return new BPromise(function(_0x361f6d,_0x10c8f8){var _0x178a6c=sox[_0x63dd('0x26')](_0x49f598,_0xe07393,{'sampleRate':0x1f40,'format':_0x63dd('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x178a6c['on'](_0x63dd('0x18'),function(_0x256180){logger[_0x63dd('0x18')](_0x63dd('0x28'),_0x256180);_0x10c8f8(_0x256180);});_0x178a6c['on'](_0x63dd('0x24'),function(){logger['info'](_0x63dd('0x29'));_0x361f6d();});_0x178a6c[_0x63dd('0x2a')]();});}function base64Decode(_0x5e7881,_0x33fc50){var _0x3746e0=path['resolve'](__dirname,_0x63dd('0x2b'),rs[_0x63dd('0x2c')](0x4)+_0x63dd('0x2d'));fs[_0x63dd('0x2e')](_0x3746e0,_0x5e7881,_0x63dd('0x2f'));return convertFile(_0x3746e0,_0x33fc50)[_0x63dd('0x30')](function(){try{fs[_0x63dd('0x21')](_0x3746e0);fs[_0x63dd('0x31')](_0x33fc50,_0x63dd('0x32'));}catch(_0x3c0c10){logger[_0x63dd('0x18')](_0x3c0c10);}return _0x33fc50[_0x63dd('0x33')]('.')[0x0];});}function base64Encode(_0x586458){var _0x37da04=fs[_0x63dd('0x34')](_0x586458);return new Buffer(_0x37da04)[_0x63dd('0x35')]('base64');}exports[_0x63dd('0x36')]=function(_0x41e72b,_0x1d2900,_0x58e740,_0x5deb20,_0x23f872,_0x3f76fe){var _0xde57f4,_0x11dfb7;var _0x56f46d=_0x63dd('0x37');var _0x2ef57f=_0x63dd('0x38')+_0x41e72b;var _0x3bdf75={};if(_0x1d2900===_0x63dd('0x39')){_0x3bdf75[_0x63dd('0x3a')]={'ssml':_0x58e740};}else{_0x3bdf75[_0x63dd('0x3a')]={'text':_0x58e740};};_0x3bdf75['voice']={'languageCode':_0x5deb20,'ssmlGender':_0x23f872};_0x3bdf75['audioConfig']={'audioEncoding':_0x63dd('0x3b'),'sampleRateHertz':0x1f40};var _0x5b3f0c={'url':_0x56f46d+_0x63dd('0x3c')+_0x2ef57f,'method':_0x63dd('0x3d'),'json':!![],'body':_0x3bdf75};return rp(_0x5b3f0c)['then'](function(_0x4bae9b){return new BPromise(function(_0x28b191,_0x291638){_0xde57f4=path[_0x63dd('0x3e')](__dirname,'tmp',rs[_0x63dd('0x2c')](0x4)+_0x63dd('0x3f'));var _0x1802b9=Buffer[_0x63dd('0x40')](_0x4bae9b['audioContent'],_0x63dd('0x2f'));return fs[_0x63dd('0x41')](_0xde57f4,_0x1802b9,function(_0x5004e0){_0x291638(_0x5004e0);},function(_0x4dce71){fs[_0x63dd('0x31')](_0xde57f4,_0x63dd('0x32'));_0x28b191(_0x4dce71);});});})[_0x63dd('0x30')](function(_0xe9ba9){_0x11dfb7=path[_0x63dd('0x3e')](__dirname,_0x63dd('0x2b'),rs[_0x63dd('0x2c')](0x4)+'.wav');return convertFile(_0xde57f4,_0x11dfb7);})['then'](function(){try{fs[_0x63dd('0x21')](_0xde57f4);fs[_0x63dd('0x31')](_0x11dfb7,_0x63dd('0x32'));}catch(_0x4e83e7){logger[_0x63dd('0x18')](_0x4e83e7);}logger['info'](_0x63dd('0x42'),_0x11dfb7[_0x63dd('0x33')]('.')[0x0]);return _0x11dfb7[_0x63dd('0x33')]('.')[0x0];});};exports[_0x63dd('0x43')]=function(_0x4b16c7,_0x69ac47){var _0x5474f5=_0x63dd('0x44');var _0xdc83ab,_0x509542;var _0x5c0571;var _0x244d92={'encoding':_0x63dd('0x45'),'method':'POST','timeout':0x2710,'url':_0x5474f5,'headers':{'Content-Type':_0x63dd('0x46')},'body':_0x63dd('0x47')+encodeURIComponent(JSON['stringify']([[[_0x63dd('0x48'),JSON['stringify']([_0x4b16c7,_0x69ac47||'en',![],_0x63dd('0x49')]),null,'generic']]]))};return rp(_0x244d92)[_0x63dd('0x30')](function(_0x3b31f3){try{_0x5c0571=eval(_0x3b31f3[_0x63dd('0x4a')](0x5))[0x0][0x2];}catch(_0x3092d4){throw new Error('parse\x20response\x20failed:\x0a'+_0x3b31f3['data']);}if(!_0x5c0571){if(_0x4b16c7[_0x63dd('0x4b')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x69ac47+_0x63dd('0x4c'));}}try{_0x5c0571=eval(_0x5c0571)[0x0];}catch(_0x4d1dec){throw new Error(_0x63dd('0x4d')+res[_0x63dd('0x25')]);}const _0x46fb77=_0x5c0571;_0xdc83ab=path[_0x63dd('0x3e')](__dirname,'tmp',rs[_0x63dd('0x2c')](0x4)+_0x63dd('0x3f'));fs['writeFileSync'](_0xdc83ab,_0x5c0571,{'encoding':_0x63dd('0x2f')});_0x509542=path[_0x63dd('0x3e')](__dirname,_0x63dd('0x2b'),rs[_0x63dd('0x2c')](0x4)+_0x63dd('0x2d'));return convertFile(_0xdc83ab,_0x509542);})[_0x63dd('0x30')](function(){try{fs['unlink'](_0xdc83ab);fs['chmodSync'](_0x509542,_0x63dd('0x32'));}catch(_0x1ebdde){logger[_0x63dd('0x18')](_0x1ebdde);}logger[_0x63dd('0x1e')](_0x63dd('0x4e'),_0x509542['split']('.')[0x0]);return _0x509542[_0x63dd('0x33')]('.')[0x0];});};exports[_0x63dd('0x4f')]=function(_0x518801,_0x109f83,_0x521726){return google[_0x63dd('0x50')](_0x518801,_0x109f83,_0x521726)['then'](function(_0x3d0248){logger['info'](_0x3d0248['uri']);return rp(_0x3d0248);})[_0x63dd('0x30')](function(_0x51ece6){var _0x1b23e0='';var _0x173146=0x0;try{fs[_0x63dd('0x21')](_0x518801);}catch(_0x1f1725){logger['error'](_0x1f1725);}if(_0x51ece6&&_0x51ece6['results']){_0x1b23e0=_0x51ece6['results'][_0x63dd('0x51')](function(_0x4960de){return _0x4960de&&_0x4960de[_0x63dd('0x52')][0x0]&&_0x4960de[_0x63dd('0x52')][0x0][_0x63dd('0x53')]?_0x4960de[_0x63dd('0x52')][0x0][_0x63dd('0x53')]:'';})[_0x63dd('0x54')]('\x0a');_0x173146=_0x51ece6['results'][_0x63dd('0x51')](function(_0x34493e){return _0x34493e&&_0x34493e[_0x63dd('0x52')][0x0]&&_0x34493e['alternatives'][0x0][_0x63dd('0x55')]?_0x34493e[_0x63dd('0x52')][0x0][_0x63dd('0x55')]:0x0;})[_0x63dd('0x54')]('\x0a');}logger[_0x63dd('0x1e')](_0x63dd('0x56'),_0x1b23e0);logger['info'](_0x63dd('0x57'),_0x173146);return{'transcript':_0x1b23e0,'confidence':_0x173146};})['catch'](function(_0x3f80e3){logger[_0x63dd('0x18')](_0x63dd('0x58'),_0x3f80e3[_0x63dd('0x17')],_0x3f80e3[_0x63dd('0x59')],_0x3f80e3[_0x63dd('0x5a')]);});};exports[_0x63dd('0x5b')]=function(_0x286316,_0x36ddaa,_0x147027,_0x451910){var _0xf46626=apiai(_0x36ddaa,{'language':_0x451910||'en'});return _0xf46626[_0x63dd('0x5c')](_0x147027,{'sessionId':md5(_0x286316)})['then'](function(_0x2e96cf){logger[_0x63dd('0x1e')](JSON['stringify'](_0x2e96cf));return{'source':_0x2e96cf[_0x63dd('0x5d')]['source'],'resolvedQuery':_0x2e96cf['result'][_0x63dd('0x5e')],'action':_0x2e96cf[_0x63dd('0x5d')][_0x63dd('0x5f')],'actionIncomplete':_0x2e96cf[_0x63dd('0x5d')][_0x63dd('0x60')],'speech':_0x2e96cf[_0x63dd('0x5d')][_0x63dd('0x61')][_0x63dd('0x62')],'score':_0x2e96cf[_0x63dd('0x5d')][_0x63dd('0x63')],'statusCode':_0x2e96cf['status'][_0x63dd('0x64')],'endConversation':_0x2e96cf[_0x63dd('0x5d')][_0x63dd('0x65')][_0x63dd('0x66')]||![],'isFallbackIntent':_0x2e96cf[_0x63dd('0x5d')]['metadata'][_0x63dd('0x67')]};});};exports[_0x63dd('0x68')]=function(_0x1bb853,_0x5416b4,_0x596ed2,_0xbd0f64,_0x22a856,_0x2c8805){var _0x33e59f=_0xbd0f64['replace'](/\\n/g,'\x0a');var _0x3a59ab={'credentials':{'private_key':_0x33e59f,'client_email':_0x596ed2}};var _0x19eb9c=new dialogflow[(_0x63dd('0x69'))](_0x3a59ab);var _0x209cec=_0x19eb9c[_0x63dd('0x6a')](_0x5416b4,md5(_0x1bb853));var _0x4d3c09={'session':_0x209cec,'queryInput':{'text':{'text':_0x22a856,'languageCode':_0x2c8805}}};return _0x19eb9c[_0x63dd('0x6b')](_0x4d3c09)[_0x63dd('0x30')](function(_0x173622){if(_0x173622&&_0x173622[_0x63dd('0x4b')]){logger[_0x63dd('0x1e')](_0x63dd('0x6c'),JSON['stringify'](_0x173622));var _0x5c2fbb=_0x173622[0x0];if(_0x5c2fbb){var _0x1d08e1={'action':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x5f')],'allRequiredParamsPresent':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x6e')],'endConversation':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x6f')]&&_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x6f')][_0x63dd('0x70')]?_0x5c2fbb['queryResult'][_0x63dd('0x6f')][_0x63dd('0x70')][_0x63dd('0x71')][_0x63dd('0x72')]:![],'fulfillmentText':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x73')],'intentName':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x74')][_0x63dd('0x59')],'intentDisplayName':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x74')][_0x63dd('0x75')],'isFallbackIntent':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x74')][_0x63dd('0x76')],'languageCode':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x77')],'queryText':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x78')],'responseId':_0x5c2fbb[_0x63dd('0x79')],'score':_0x5c2fbb[_0x63dd('0x6d')][_0x63dd('0x7a')],'speech':_0x5c2fbb['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x63dd('0x7b')](_0x173622)};return _0x1d08e1;}}});};exports[_0x63dd('0x7c')]=function(_0x49f342,_0x2082f3,_0x342010,_0x6fa8e0){return tilde[_0x63dd('0x50')](_0x49f342,_0x2082f3,_0x342010,_0x6fa8e0)[_0x63dd('0x30')](function(_0x179878){try{fs[_0x63dd('0x21')](_0x49f342);}catch(_0xbd8677){logger[_0x63dd('0x18')](_0xbd8677);}logger[_0x63dd('0x1e')](_0x63dd('0x7d'),_0x179878[_0x63dd('0x53')]);logger[_0x63dd('0x1e')](_0x63dd('0x7e'),_0x179878[_0x63dd('0x55')]);return _0x179878;});};exports['awsPolly']=function(_0x3ac9a1,_0x1131e5,_0x225817,_0x9e29e2,_0x381968,_0x5fa250){var _0x1dc375=path[_0x63dd('0x3e')](__dirname,'tmp',rs[_0x63dd('0x2c')](0x4)+_0x63dd('0x3f'));var _0x5e8d55;return aws[_0x63dd('0x7f')](_0x3ac9a1,_0x1131e5,_0x225817,_0x9e29e2,_0x381968,_0x5fa250,_0x1dc375)[_0x63dd('0x30')](function(){_0x5e8d55=path[_0x63dd('0x3e')](__dirname,_0x63dd('0x2b'),rs['generate'](0x4)+_0x63dd('0x2d'));return convertFile(_0x1dc375,_0x5e8d55);})[_0x63dd('0x30')](function(){try{fs[_0x63dd('0x21')](_0x1dc375);fs['chmodSync'](_0x5e8d55,_0x63dd('0x32'));}catch(_0x58c8ce){logger[_0x63dd('0x18')](_0x58c8ce);}return _0x5e8d55[_0x63dd('0x33')]('.')[0x0];});};exports['awsLex']=function(_0x21f071,_0x10d5bc,_0x17b06b,_0x121c2c,_0xcca081,_0x2889e0){return aws['lex'](_0x21f071,_0x10d5bc,_0x17b06b,_0x121c2c,_0xcca081,_0x2889e0)[_0x63dd('0x30')](function(_0x680d7e){logger['info'](JSON[_0x63dd('0x7b')](_0x680d7e));return _0x680d7e;});};exports[_0x63dd('0x80')]=function(_0x177786,_0x38f9b7,_0xb93478,_0x122aac){var _0x27e885=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x177786,encodeURIComponent(_0x38f9b7),_0xb93478,_0x122aac);var _0x2c91b1=path[_0x63dd('0x3e')](__dirname,_0x63dd('0x2b'),rs[_0x63dd('0x2c')](0x4)+_0x63dd('0x3f'));var _0x2885e0;return downloadFile(_0x27e885,_0x2c91b1)[_0x63dd('0x30')](function(){_0x2885e0=path[_0x63dd('0x3e')](__dirname,_0x63dd('0x2b'),rs['generate'](0x4)+'.wav');return convertFile(_0x2c91b1,_0x2885e0);})['then'](function(){try{fs[_0x63dd('0x21')](_0x2c91b1);fs[_0x63dd('0x31')](_0x2885e0,'777');}catch(_0x3679ad){logger[_0x63dd('0x18')](_0x3679ad);}return _0x2885e0[_0x63dd('0x33')]('.')[0x0];});};exports['ispeechASR']=function(_0x3402b9,_0xdf5f87,_0x48afd5,_0xb7e5d0){var _0x37edd7=util[_0x63dd('0x81')](_0x63dd('0x82'),ISPEECH_API,_0xdf5f87,_0x48afd5,base64Encode(_0x3402b9),_0xb7e5d0?util[_0x63dd('0x81')](_0x63dd('0x83'),encodeURIComponent(_0xb7e5d0)):_0x63dd('0x84'));return uploadFile(_0x37edd7)['then'](function(_0x2c05d7){return querystring[_0x63dd('0xb')](_0x2c05d7);});};exports['sestekNDA']=function(_0x3d0ea5,_0x43f79b){return sestek[_0x63dd('0x85')](_0x3d0ea5,_0x43f79b)[_0x63dd('0x30')](function(_0x1a1649){logger[_0x63dd('0x1e')](JSON[_0x63dd('0x7b')](_0x1a1649));var _0x35c482={'speech':_0x1a1649[_0x63dd('0x86')],'action':_0x1a1649[_0x63dd('0x87')]?_0x1a1649[_0x63dd('0x87')][_0x63dd('0x88')]:undefined,'actiondata':_0x1a1649[_0x63dd('0x87')]?_0x1a1649[_0x63dd('0x87')]['CustomActionData']:undefined};if(_0x1a1649['channelData']&&_0x1a1649[_0x63dd('0x87')]['AudioFromTts']){return base64Decode(_0x1a1649['channelData']['AudioFromTts']['Data'],path[_0x63dd('0x3e')](__dirname,_0x63dd('0x2b'),rs[_0x63dd('0x2c')](0x4)+_0x63dd('0x2d')))[_0x63dd('0x30')](function(_0xc0daf8){_0x35c482[_0x63dd('0x89')]=_0xc0daf8;return _0x35c482;});}return _0x35c482;});};exports[_0x63dd('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x116c=['length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','languageCode','responseId','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','get','data','end','transcode','wav','start','tmp','.wav','base64','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','writeFile','generate','then','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','writeFileSync','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent'];(function(_0x493e36,_0x3aad0e){var _0x20f72c=function(_0x5029d4){while(--_0x5029d4){_0x493e36['push'](_0x493e36['shift']());}};_0x20f72c(++_0x3aad0e);}(_0x116c,0xa9));var _0xc116=function(_0x2b3757,_0x432e14){_0x2b3757=_0x2b3757-0x0;var _0x1fc53b=_0x116c[_0x2b3757];return _0x1fc53b;};'use strict';var apiai=require(_0xc116('0x0'));var BPromise=require(_0xc116('0x1'));var dialogflow=require(_0xc116('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xc116('0x3'));var md5=require(_0xc116('0x4'));var path=require(_0xc116('0x5'));var querystring=require(_0xc116('0x6'));var rp=require(_0xc116('0x7'));var rs=require('randomstring');var sox=require(_0xc116('0x8'));var tts=require(_0xc116('0x9'));var urlParse=require(_0xc116('0xa'))[_0xc116('0xb')];var util=require(_0xc116('0xc'));var aws=require(_0xc116('0xd'));var google=require(_0xc116('0xe'));var sestek=require(_0xc116('0xf'));var tilde=require(_0xc116('0x10'));var logger=require(_0xc116('0x11'))(_0xc116('0x12'));var ISPEECH_API=_0xc116('0x13');function downloadFile(_0xcdf9ed,_0x5d392f){return new BPromise(function(_0xea1d60,_0x459426){var _0x18bb0f=urlParse(_0xcdf9ed);var _0xc162a=_0x18bb0f[_0xc116('0x14')]===_0xc116('0x15')?https:http;var _0x171b43={'host':_0x18bb0f[_0xc116('0x16')],'path':_0x18bb0f[_0xc116('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0xc162a['get'](_0x171b43,function(_0x504c46){if(_0x504c46['statusCode']!==0xc8){logger['error'](_0xc116('0x17')+_0xcdf9ed+_0xc116('0x18')+_0x504c46[_0xc116('0x19')]+'\x20('+_0x504c46[_0xc116('0x1a')]+')');_0x459426(new Error(_0xc116('0x17')+_0xcdf9ed+_0xc116('0x18')+_0x504c46['statusCode']+'\x20('+_0x504c46[_0xc116('0x1a')]+')'));return;}var _0x579e59=fs[_0xc116('0x1b')](_0x5d392f);_0x579e59['on']('finish',function(){logger[_0xc116('0x1c')](_0xc116('0x1d'));_0x579e59[_0xc116('0x1e')](_0xea1d60);});_0x579e59['on'](_0xc116('0x1f'),function(_0x48efd0){fs[_0xc116('0x20')](_0x5d392f);logger[_0xc116('0x1f')](_0xc116('0x21'),_0x48efd0);_0x459426(_0x48efd0);});_0x504c46[_0xc116('0x22')](_0x579e59);})['on'](_0xc116('0x1f'),function(_0x33a2fd){logger[_0xc116('0x1f')](_0x33a2fd);_0x459426(_0x33a2fd);})['end']();});}function uploadFile(_0x2157fb){return new BPromise(function(_0x3299d8,_0x136815){var _0x2a7974=urlParse(_0x2157fb);var _0x148912=_0x2a7974[_0xc116('0x14')]===_0xc116('0x15')?https:http;var _0x2c1a7b={'host':_0x2a7974[_0xc116('0x16')],'path':_0x2a7974['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x148912[_0xc116('0x23')](_0x2c1a7b,function(_0x2cc997){if(_0x2cc997['statusCode']!==0xc8){_0x136815(new Error(_0xc116('0x17')+_0x2157fb+_0xc116('0x18')+_0x2cc997[_0xc116('0x19')]+'\x20('+_0x2cc997[_0xc116('0x1a')]+')'));return;}var _0x1b1255='';_0x2cc997['on'](_0xc116('0x24'),function(_0x4a88ca){_0x1b1255+=_0x4a88ca;});_0x2cc997['on'](_0xc116('0x25'),function(){_0x3299d8(_0x1b1255);});})['on']('error',function(_0x292be5){_0x136815(_0x292be5);})[_0xc116('0x25')]();});}function convertFile(_0x48bc4d,_0x111856){return new BPromise(function(_0x3a2bf7,_0x504411){var _0x2acd47=sox[_0xc116('0x26')](_0x48bc4d,_0x111856,{'sampleRate':0x1f40,'format':_0xc116('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2acd47['on'](_0xc116('0x1f'),function(_0x43c245){logger[_0xc116('0x1f')]('error\x20convert',_0x43c245);_0x504411(_0x43c245);});_0x2acd47['on']('end',function(){logger[_0xc116('0x1c')]('finish\x20to\x20convert');_0x3a2bf7();});_0x2acd47[_0xc116('0x28')]();});}function base64Decode(_0x316c9e,_0x5ad6e9){var _0x53134b=path['resolve'](__dirname,_0xc116('0x29'),rs['generate'](0x4)+_0xc116('0x2a'));fs['writeFileSync'](_0x53134b,_0x316c9e,_0xc116('0x2b'));return convertFile(_0x53134b,_0x5ad6e9)['then'](function(){try{fs[_0xc116('0x20')](_0x53134b);fs[_0xc116('0x2c')](_0x5ad6e9,_0xc116('0x2d'));}catch(_0x2777ee){logger[_0xc116('0x1f')](_0x2777ee);}return _0x5ad6e9[_0xc116('0x2e')]('.')[0x0];});}function base64Encode(_0x3f0d2b){var _0x585c61=fs['readFileSync'](_0x3f0d2b);return new Buffer(_0x585c61)[_0xc116('0x2f')]('base64');}exports['googleCloudTTS']=function(_0x1020a3,_0x52074e,_0x2a7e7c,_0x46c55b,_0x11b0ad,_0x87a175){var _0x129e77,_0x18f5ed;var _0x16f739=_0xc116('0x30');var _0x5baa65=_0xc116('0x31')+_0x1020a3;var _0x1612ae={};if(_0x52074e==='ssml'){_0x1612ae['input']={'ssml':_0x2a7e7c};}else{_0x1612ae[_0xc116('0x32')]={'text':_0x2a7e7c};};_0x1612ae[_0xc116('0x33')]={'languageCode':_0x46c55b,'ssmlGender':_0x11b0ad};_0x1612ae[_0xc116('0x34')]={'audioEncoding':_0xc116('0x35'),'sampleRateHertz':0x1f40};var _0x593a5a={'url':_0x16f739+_0xc116('0x36')+_0x5baa65,'method':_0xc116('0x37'),'json':!![],'body':_0x1612ae};return rp(_0x593a5a)['then'](function(_0x53f478){return new BPromise(function(_0x321562,_0x4baf41){_0x129e77=path[_0xc116('0x38')](__dirname,'tmp',rs['generate'](0x4)+_0xc116('0x39'));var _0xf0cf2a=Buffer[_0xc116('0x3a')](_0x53f478[_0xc116('0x3b')],_0xc116('0x2b'));return fs[_0xc116('0x3c')](_0x129e77,_0xf0cf2a,function(_0x14b9e3){_0x4baf41(_0x14b9e3);},function(_0x3a4e98){fs[_0xc116('0x2c')](_0x129e77,'777');_0x321562(_0x3a4e98);});});})['then'](function(_0x1a8f0d){_0x18f5ed=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x2a'));return convertFile(_0x129e77,_0x18f5ed);})[_0xc116('0x3e')](function(){try{fs[_0xc116('0x20')](_0x129e77);fs['chmodSync'](_0x18f5ed,_0xc116('0x2d'));}catch(_0x5c4ab8){logger[_0xc116('0x1f')](_0x5c4ab8);}logger[_0xc116('0x1c')](_0xc116('0x3f'),_0x18f5ed[_0xc116('0x2e')]('.')[0x0]);return _0x18f5ed['split']('.')[0x0];});};exports[_0xc116('0x40')]=function(_0x5cd296,_0x47ebea){var _0x24de37=_0xc116('0x41');var _0x420540,_0x254bcd;var _0xa7d779;var _0x5e71e1={'encoding':_0xc116('0x42'),'method':_0xc116('0x37'),'timeout':0x2710,'url':_0x24de37,'headers':{'Content-Type':_0xc116('0x43')},'body':_0xc116('0x44')+encodeURIComponent(JSON[_0xc116('0x45')]([[['jQ1olc',JSON[_0xc116('0x45')]([_0x5cd296,_0x47ebea||'en',![],_0xc116('0x46')]),null,'generic']]]))};return rp(_0x5e71e1)[_0xc116('0x3e')](function(_0xdded50){try{_0xa7d779=eval(_0xdded50[_0xc116('0x47')](0x5))[0x0][0x2];}catch(_0x4b2cce){throw new Error(_0xc116('0x48')+_0xdded50[_0xc116('0x24')]);}if(!_0xa7d779){if(_0x5cd296['length']>0xc8){throw new Error(_0xc116('0x49'));}else{throw new Error('lang\x20\x22'+_0x47ebea+'\x22\x20might\x20not\x20exist');}}try{_0xa7d779=eval(_0xa7d779)[0x0];}catch(_0x229ef3){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x17ae11=_0xa7d779;_0x420540=path['resolve'](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x39'));fs[_0xc116('0x4a')](_0x420540,_0xa7d779,{'encoding':_0xc116('0x2b')});_0x254bcd=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x2a'));return convertFile(_0x420540,_0x254bcd);})[_0xc116('0x3e')](function(){try{fs[_0xc116('0x20')](_0x420540);fs[_0xc116('0x2c')](_0x254bcd,_0xc116('0x2d'));}catch(_0x565566){logger[_0xc116('0x1f')](_0x565566);}logger[_0xc116('0x1c')](_0xc116('0x4b'),_0x254bcd[_0xc116('0x2e')]('.')[0x0]);return _0x254bcd[_0xc116('0x2e')]('.')[0x0];});};exports[_0xc116('0x4c')]=function(_0x4bfba5,_0x4aa55b,_0x489918){return google['asr'](_0x4bfba5,_0x4aa55b,_0x489918)[_0xc116('0x3e')](function(_0x16c7b2){logger[_0xc116('0x1c')](_0x16c7b2[_0xc116('0x4d')]);return rp(_0x16c7b2);})['then'](function(_0x41eb94){var _0x2416e5='';var _0x26157e=0x0;try{fs[_0xc116('0x20')](_0x4bfba5);}catch(_0x521019){logger['error'](_0x521019);}if(_0x41eb94&&_0x41eb94[_0xc116('0x4e')]){_0x2416e5=_0x41eb94[_0xc116('0x4e')]['map'](function(_0x521971){return _0x521971&&_0x521971[_0xc116('0x4f')][0x0]&&_0x521971['alternatives'][0x0][_0xc116('0x50')]?_0x521971[_0xc116('0x4f')][0x0][_0xc116('0x50')]:'';})[_0xc116('0x51')]('\x0a');_0x26157e=_0x41eb94[_0xc116('0x4e')][_0xc116('0x52')](function(_0x30ba34){return _0x30ba34&&_0x30ba34['alternatives'][0x0]&&_0x30ba34[_0xc116('0x4f')][0x0][_0xc116('0x53')]?_0x30ba34[_0xc116('0x4f')][0x0][_0xc116('0x53')]:0x0;})[_0xc116('0x51')]('\x0a');}logger[_0xc116('0x1c')](_0xc116('0x54'),_0x2416e5);logger[_0xc116('0x1c')](_0xc116('0x55'),_0x26157e);return{'transcript':_0x2416e5,'confidence':_0x26157e};})[_0xc116('0x56')](function(_0x5c6c7){logger[_0xc116('0x1f')](_0xc116('0x57'),_0x5c6c7[_0xc116('0x19')],_0x5c6c7[_0xc116('0x58')],_0x5c6c7['message']);});};exports[_0xc116('0x59')]=function(_0x38e432,_0x2132a2,_0x180ba0,_0x10fcc3){var _0x534470=apiai(_0x2132a2,{'language':_0x10fcc3||'en'});return _0x534470[_0xc116('0x5a')](_0x180ba0,{'sessionId':md5(_0x38e432)})[_0xc116('0x3e')](function(_0x5c7a23){logger[_0xc116('0x1c')](JSON[_0xc116('0x45')](_0x5c7a23));return{'source':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x5c')],'resolvedQuery':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x5d')],'action':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x5e')],'actionIncomplete':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x5f')],'speech':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x60')][_0xc116('0x61')],'score':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x62')],'statusCode':_0x5c7a23[_0xc116('0x63')][_0xc116('0x64')],'endConversation':_0x5c7a23['result'][_0xc116('0x65')]['endConversation']||![],'isFallbackIntent':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x65')][_0xc116('0x66')]};});};exports[_0xc116('0x67')]=function(_0x73b9cb,_0x5093bf,_0x4e0198,_0x110553,_0x29cc10,_0x3615b8){var _0x5c2927=_0x110553['replace'](/\\n/g,'\x0a');var _0x3cf616={'credentials':{'private_key':_0x5c2927,'client_email':_0x4e0198}};var _0x9ef50e=new dialogflow[(_0xc116('0x68'))](_0x3cf616);var _0x1594f3=_0x9ef50e[_0xc116('0x69')](_0x5093bf,md5(_0x73b9cb));var _0x4440d8={'session':_0x1594f3,'queryInput':{'text':{'text':_0x29cc10,'languageCode':_0x3615b8}}};return _0x9ef50e[_0xc116('0x6a')](_0x4440d8)['then'](function(_0x5f1d40){if(_0x5f1d40&&_0x5f1d40[_0xc116('0x6b')]){logger[_0xc116('0x1c')]('Dialogflow\x20V2\x20response:',JSON[_0xc116('0x45')](_0x5f1d40));var _0x36b862=_0x5f1d40[0x0];if(_0x36b862){var _0x5f441b={'action':_0x36b862[_0xc116('0x6c')]['action'],'allRequiredParamsPresent':_0x36b862[_0xc116('0x6c')][_0xc116('0x6d')],'endConversation':_0x36b862[_0xc116('0x6c')]['diagnosticInfo']&&_0x36b862['queryResult']['diagnosticInfo']['fields']?_0x36b862[_0xc116('0x6c')][_0xc116('0x6e')][_0xc116('0x6f')][_0xc116('0x70')][_0xc116('0x71')]:![],'fulfillmentText':_0x36b862[_0xc116('0x6c')]['fulfillmentText'],'intentName':_0x36b862[_0xc116('0x6c')][_0xc116('0x72')][_0xc116('0x58')],'intentDisplayName':_0x36b862[_0xc116('0x6c')][_0xc116('0x72')][_0xc116('0x73')],'isFallbackIntent':_0x36b862[_0xc116('0x6c')][_0xc116('0x72')]['isFallback'],'languageCode':_0x36b862[_0xc116('0x6c')][_0xc116('0x74')],'queryText':_0x36b862['queryResult']['queryText'],'responseId':_0x36b862[_0xc116('0x75')],'score':_0x36b862[_0xc116('0x6c')]['intentDetectionConfidence'],'speech':_0x36b862[_0xc116('0x6c')][_0xc116('0x76')],'providerResponse':JSON[_0xc116('0x45')](_0x5f1d40)};return _0x5f441b;}}});};exports[_0xc116('0x77')]=function(_0x3ae1ed,_0x3c8116,_0xeb21ce,_0x116281){return tilde[_0xc116('0x78')](_0x3ae1ed,_0x3c8116,_0xeb21ce,_0x116281)[_0xc116('0x3e')](function(_0x1ca3cf){try{fs[_0xc116('0x20')](_0x3ae1ed);}catch(_0x74c67d){logger[_0xc116('0x1f')](_0x74c67d);}logger[_0xc116('0x1c')]('Tilde\x20ASR\x20transcription',_0x1ca3cf[_0xc116('0x50')]);logger[_0xc116('0x1c')](_0xc116('0x79'),_0x1ca3cf[_0xc116('0x53')]);return _0x1ca3cf;});};exports[_0xc116('0x7a')]=function(_0x490cca,_0x17f7c6,_0x18b375,_0x4ee145,_0x5a271a,_0x112e83){var _0x162df0=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x39'));var _0x551ee9;return aws[_0xc116('0x7b')](_0x490cca,_0x17f7c6,_0x18b375,_0x4ee145,_0x5a271a,_0x112e83,_0x162df0)[_0xc116('0x3e')](function(){_0x551ee9=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x2a'));return convertFile(_0x162df0,_0x551ee9);})['then'](function(){try{fs['unlink'](_0x162df0);fs[_0xc116('0x2c')](_0x551ee9,'777');}catch(_0x4c65b9){logger['error'](_0x4c65b9);}return _0x551ee9['split']('.')[0x0];});};exports['awsLex']=function(_0x17638f,_0xbdc0a,_0x220e69,_0x1c765f,_0x13396d,_0x392ae3){return aws[_0xc116('0x7c')](_0x17638f,_0xbdc0a,_0x220e69,_0x1c765f,_0x13396d,_0x392ae3)['then'](function(_0x44081b){logger[_0xc116('0x1c')](JSON['stringify'](_0x44081b));return _0x44081b;});};exports[_0xc116('0x7d')]=function(_0x4501cc,_0x36239a,_0x30409e,_0x34597e){var _0x587536=util[_0xc116('0x7e')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4501cc,encodeURIComponent(_0x36239a),_0x30409e,_0x34597e);var _0x4fe640=path[_0xc116('0x38')](__dirname,'tmp',rs[_0xc116('0x3d')](0x4)+_0xc116('0x39'));var _0x4a9fa5;return downloadFile(_0x587536,_0x4fe640)[_0xc116('0x3e')](function(){_0x4a9fa5=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+'.wav');return convertFile(_0x4fe640,_0x4a9fa5);})[_0xc116('0x3e')](function(){try{fs[_0xc116('0x20')](_0x4fe640);fs[_0xc116('0x2c')](_0x4a9fa5,_0xc116('0x2d'));}catch(_0x1088c9){logger[_0xc116('0x1f')](_0x1088c9);}return _0x4a9fa5[_0xc116('0x2e')]('.')[0x0];});};exports[_0xc116('0x7f')]=function(_0xcc92ae,_0x15d051,_0x1cd225,_0x5177d5){var _0x542204=util[_0xc116('0x7e')](_0xc116('0x80'),ISPEECH_API,_0x15d051,_0x1cd225,base64Encode(_0xcc92ae),_0x5177d5?util['format'](_0xc116('0x81'),encodeURIComponent(_0x5177d5)):'freeform=3');return uploadFile(_0x542204)[_0xc116('0x3e')](function(_0x572107){return querystring[_0xc116('0xb')](_0x572107);});};exports['sestekNDA']=function(_0xad469,_0x2d0a78){return sestek[_0xc116('0x82')](_0xad469,_0x2d0a78)['then'](function(_0x5d23c0){logger[_0xc116('0x1c')](JSON[_0xc116('0x45')](_0x5d23c0));var _0x5a5898={'speech':_0x5d23c0[_0xc116('0x83')],'action':_0x5d23c0[_0xc116('0x84')]?_0x5d23c0[_0xc116('0x84')][_0xc116('0x85')]:undefined,'actiondata':_0x5d23c0['channelData']?_0x5d23c0['channelData'][_0xc116('0x86')]:undefined};if(_0x5d23c0[_0xc116('0x84')]&&_0x5d23c0[_0xc116('0x84')][_0xc116('0x87')]){return base64Decode(_0x5d23c0[_0xc116('0x84')][_0xc116('0x87')]['Data'],path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs['generate'](0x4)+_0xc116('0x2a')))[_0xc116('0x3e')](function(_0x378147){_0x5a5898[_0xc116('0x88')]=_0x378147;return _0x5a5898;});}return _0x5a5898;});};exports[_0xc116('0x89')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 5f3349e..7e21e9a 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 _0x9184=['exports','./nda'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x9184,0x12f));var _0x4918=function(_0x4dd943,_0x5f379e){_0x4dd943=_0x4dd943-0x0;var _0x4e06ee=_0x9184[_0x4dd943];return _0x4e06ee;};var nda=require(_0x4918('0x0'));module[_0x4918('0x1')]={'nda':nda}; \ No newline at end of file +var _0x10ca=['./nda','exports'];(function(_0x3a9690,_0x5e06e8){var _0x146bef=function(_0x28f514){while(--_0x28f514){_0x3a9690['push'](_0x3a9690['shift']());}};_0x146bef(++_0x5e06e8);}(_0x10ca,0x146));var _0xa10c=function(_0x133673,_0x3b50c9){_0x133673=_0x133673-0x0;var _0x6ac4cc=_0x10ca[_0x133673];return _0x6ac4cc;};var nda=require(_0xa10c('0x0'));module[_0xa10c('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index e927ad4..5565e54 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 _0xd49c=['then','resolve','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','url','agi','exports','POST','ndauth_url','/token','password','username'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xd49c,0x1d8));var _0xcd49=function(_0x2a938c,_0x3c0bcf){_0x2a938c=_0x2a938c-0x0;var _0x175e87=_0xd49c[_0x2a938c];return _0x175e87;};'use strict';var rp=require('request-promise');var url=require(_0xcd49('0x0'));var logger=require('../../../../../config/logger')(_0xcd49('0x1'));module[_0xcd49('0x2')]=function(_0x5bda72,_0x1181d4){var _0x52362d={'method':_0xcd49('0x3'),'uri':url['resolve'](_0x1181d4[_0xcd49('0x4')],_0xcd49('0x5')),'form':{'grant_type':_0xcd49('0x6'),'username':_0x1181d4[_0xcd49('0x7')],'password':_0x1181d4[_0xcd49('0x6')]},'json':!![]};return rp(_0x52362d)[_0xcd49('0x8')](function(_0x321013){var _0x17f26f={'method':_0xcd49('0x3'),'uri':url[_0xcd49('0x9')](_0x1181d4[_0xcd49('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1181d4[_0xcd49('0xb')]||_0xcd49('0xc'),'channelId':_0xcd49('0xd'),'conversation':{'id':_0x5bda72[_0xcd49('0xe')]},'from':{'id':_0x5bda72[_0xcd49('0xf')],'name':_0x5bda72[_0xcd49('0x10')]},'recipient':{'id':_0x5bda72[_0xcd49('0x11')],'name':_0x5bda72[_0xcd49('0x12')]},'text':_0x1181d4[_0xcd49('0x13')],'channelData':{}},'headers':{'Authorization':_0xcd49('0x14')+_0x321013['access_token']},'json':!![]};if(_0x1181d4['project']){_0x17f26f[_0xcd49('0x15')][_0xcd49('0x16')][_0xcd49('0x17')]=_0x1181d4['project'];}if(_0x1181d4[_0xcd49('0x18')]=='1'){_0x17f26f[_0xcd49('0x15')]['channelData'][_0xcd49('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xcd49('0x1a')};}if(_0x1181d4[_0xcd49('0x1b')]){_0x17f26f[_0xcd49('0x15')][_0xcd49('0x16')][_0xcd49('0x1c')]=_0x1181d4['custom_action'];if(_0x1181d4['custom_action_data']){_0x17f26f['body']['channelData'][_0xcd49('0x1d')]=_0x1181d4[_0xcd49('0x1e')];}}logger[_0xcd49('0x1f')](JSON['stringify'](_0x17f26f));return rp(_0x17f26f);});}; \ No newline at end of file +var _0x1752=['custom_action_data','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','calleridname','access_token','body','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x1752,0xa5));var _0x2175=function(_0x4ad7bb,_0x5cfbf2){_0x4ad7bb=_0x4ad7bb-0x0;var _0x48b3a5=_0x1752[_0x4ad7bb];return _0x48b3a5;};'use strict';var rp=require('request-promise');var url=require(_0x2175('0x0'));var logger=require(_0x2175('0x1'))(_0x2175('0x2'));module[_0x2175('0x3')]=function(_0x1b2344,_0xe2453c){var _0x56c315={'method':_0x2175('0x4'),'uri':url[_0x2175('0x5')](_0xe2453c[_0x2175('0x6')],_0x2175('0x7')),'form':{'grant_type':_0x2175('0x8'),'username':_0xe2453c[_0x2175('0x9')],'password':_0xe2453c[_0x2175('0x8')]},'json':!![]};return rp(_0x56c315)[_0x2175('0xa')](function(_0x339e4d){var _0x672ff1={'method':'POST','uri':url[_0x2175('0x5')](_0xe2453c[_0x2175('0xb')],_0x2175('0xc')),'body':{'type':_0xe2453c[_0x2175('0xd')]||_0x2175('0xe'),'channelId':'Nda','conversation':{'id':_0x1b2344['uniqueid']},'from':{'id':_0x1b2344['callerid'],'name':_0x1b2344[_0x2175('0xf')]},'recipient':{'id':_0x1b2344['dnid'],'name':_0x1b2344['extension']},'text':_0xe2453c['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x339e4d[_0x2175('0x10')]},'json':!![]};if(_0xe2453c['project']){_0x672ff1[_0x2175('0x11')][_0x2175('0x12')]['ProjectName']=_0xe2453c[_0x2175('0x13')];}if(_0xe2453c[_0x2175('0x14')]=='1'){_0x672ff1[_0x2175('0x11')][_0x2175('0x12')][_0x2175('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2175('0x16')};}if(_0xe2453c[_0x2175('0x17')]){_0x672ff1[_0x2175('0x11')]['channelData']['CustomAction']=_0xe2453c[_0x2175('0x17')];if(_0xe2453c[_0x2175('0x18')]){_0x672ff1[_0x2175('0x11')]['channelData']['CustomActionData']=_0xe2453c['custom_action_data'];}}logger[_0x2175('0x19')](JSON[_0x2175('0x1a')](_0x672ff1));return rp(_0x672ff1);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 6018533..8d6489a 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd29=['exports','./lib/api'];(function(_0x57932a,_0x4c8aa8){var _0x2e3c29=function(_0x594f8f){while(--_0x594f8f){_0x57932a['push'](_0x57932a['shift']());}};_0x2e3c29(++_0x4c8aa8);}(_0xcd29,0xcb));var _0x9cd2=function(_0x1696f1,_0x903e1a){_0x1696f1=_0x1696f1-0x0;var _0x26aefb=_0xcd29[_0x1696f1];return _0x26aefb;};'use strict';var asr=require(_0x9cd2('0x0'));module[_0x9cd2('0x1')]=function(_0x56f28b,_0x97b522,_0x1009d9,_0x48c554){return asr(_0x56f28b,_0x97b522,_0x1009d9,_0x48c554);}; \ No newline at end of file +var _0x04f4=['./lib/api','exports'];(function(_0x5df760,_0x1fa2d6){var _0x3b9406=function(_0x56f060){while(--_0x56f060){_0x5df760['push'](_0x5df760['shift']());}};_0x3b9406(++_0x1fa2d6);}(_0x04f4,0x9c));var _0x404f=function(_0x3ccd99,_0x337b62){_0x3ccd99=_0x3ccd99-0x0;var _0x153cb3=_0x04f4[_0x3ccd99];return _0x153cb3;};'use strict';var asr=require(_0x404f('0x0'));module[_0x404f('0x1')]=function(_0x6f7be2,_0x114286,_0x1dd53b,_0xab0e34){return asr(_0x6f7be2,_0x114286,_0x1dd53b,_0xab0e34);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 7b552f0..edb3947 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 _0x4509=['result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','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','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status'];(function(_0x58b2ca,_0x27e9cd){var _0x46ed6c=function(_0x3b159d){while(--_0x3b159d){_0x58b2ca['push'](_0x58b2ca['shift']());}};_0x46ed6c(++_0x27e9cd);}(_0x4509,0x8b));var _0x9450=function(_0x3e6f35,_0xd4121f){_0x3e6f35=_0x3e6f35-0x0;var _0x4dd6f7=_0x4509[_0x3e6f35];return _0x4dd6f7;};'use strict';var BPromise=require(_0x9450('0x0'));var _=require(_0x9450('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9450('0x2'));var crypto=require(_0x9450('0x3'));var logger=require(_0x9450('0x4'))('agi');module[_0x9450('0x5')]=function(_0xc6d337,_0xa0bb13,_0x154f57,_0x1049bd){return new BPromise(function(_0x47547a,_0x339357){logger[_0x9450('0x6')](_0x9450('0x7'),_0x1049bd||_0x9450('0x8'));var _0x30b43e=new WebSocket(_0x1049bd||_0x9450('0x8'),{'perMessageDeflate':![]});var _0x14c2f0='';var _0x55ab1f='0';var _0x380cbe='1';var _0x2fc793=_0x9450('0x9');function _0x115186(_0x18ee0c){var _0x5e7e15=crypto['createHash'](_0x9450('0xa'));_0x5e7e15[_0x9450('0xb')](_0x18ee0c);return _0x5e7e15['digest'](_0x9450('0xc'));}function _0x1d072d(){try{logger['info'](_0x9450('0xd'));var _0x13cfd2=moment()[_0x9450('0xe')]();var _0x3b5cfd=_0x115186(_0x13cfd2+_0xa0bb13+_0x154f57);_0x30b43e[_0x9450('0xf')](JSON['stringify']({'appID':_0xa0bb13,'timestamp':_0x13cfd2,'appKey':_0x3b5cfd}));var _0x19ad46=fs[_0x9450('0x10')](_0xc6d337);_0x19ad46['on'](_0x9450('0x11'),function(_0x5014a7){_0x30b43e[_0x9450('0xf')](_0x5014a7);});_0x19ad46['on']('close',function(){_0x30b43e[_0x9450('0xf')](_0x9450('0x12'));});}catch(_0x102ebb){logger[_0x9450('0x13')](_0x9450('0x14'),JSON[_0x9450('0x15')](_0x102ebb));_0x30b43e[_0x9450('0x16')]();}}function _0x292361(_0x125372){try{if(_0x125372){var _0x5709aa=JSON[_0x9450('0x17')](_0x125372);switch(_0x5709aa[_0x9450('0x18')]){case 0x0:if(_0x5709aa[_0x9450('0x19')]){if(_0x5709aa['result'][_0x9450('0x1a')]){logger[_0x9450('0x6')](_0x9450('0x1b'),JSON[_0x9450('0x15')](_0x5709aa['result'][_0x9450('0x1c')]));_0x14c2f0=_0x5709aa['result'][_0x9450('0x1c')][0x0][_0x9450('0x1d')];_0x55ab1f=_0x5709aa[_0x9450('0x19')][_0x9450('0x1c')][0x0][_0x9450('0x1e')];_0x380cbe='0';_0x2fc793='Success.';_0x30b43e['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x380cbe='1';_0x2fc793=_0x9450('0x9');break;case 0x2:logger[_0x9450('0x6')](_0x9450('0x1f'));_0x380cbe='2';_0x2fc793=_0x9450('0x1f');break;case 0x9:logger[_0x9450('0x6')](_0x9450('0x20'));_0x380cbe='9';_0x2fc793=_0x9450('0x20');break;case 0xa:logger[_0x9450('0x6')](_0x9450('0x21'));_0x380cbe='10';_0x2fc793=_0x9450('0x21');break;case 0xb:logger[_0x9450('0x6')](_0x9450('0x22'));_0x380cbe='11';_0x2fc793=_0x9450('0x22');}}}catch(_0x57c766){logger['error'](_0x9450('0x23'),JSON['stringify'](_0x57c766));_0x30b43e['terminate']();}}function _0xc00840(){logger[_0x9450('0x6')](_0x9450('0x24'));_0x47547a({'transcript':_0x14c2f0,'confidence':_0x55ab1f,'status':_0x380cbe,'status_message':_0x2fc793});}function _0x1293c9(_0x507ae2){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x9450('0x25')](_0x507ae2)){logger[_0x9450('0x13')](_[_0x9450('0x26')](_0x507ae2)?JSON[_0x9450('0x15')](_0x507ae2):_0x507ae2);}}_0x30b43e['on'](_0x9450('0x27'),_0x1d072d);_0x30b43e['on'](_0x9450('0x28'),_0x292361);_0x30b43e['on']('close',_0xc00840);_0x30b43e['on'](_0x9450('0x13'),_0x1293c9);});}; \ No newline at end of file +var _0x722a=['agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','unix','send','createReadStream','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger'];(function(_0x7280e8,_0x5ab5f2){var _0x446442=function(_0x272b74){while(--_0x272b74){_0x7280e8['push'](_0x7280e8['shift']());}};_0x446442(++_0x5ab5f2);}(_0x722a,0xc8));var _0xa722=function(_0x5efd5c,_0x1b2130){_0x5efd5c=_0x5efd5c-0x0;var _0x527cbc=_0x722a[_0x5efd5c];return _0x527cbc;};'use strict';var BPromise=require(_0xa722('0x0'));var _=require(_0xa722('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa722('0x2'));var crypto=require(_0xa722('0x3'));var logger=require(_0xa722('0x4'))(_0xa722('0x5'));module[_0xa722('0x6')]=function(_0x3909fc,_0x48836a,_0x22902c,_0x87dc1a){return new BPromise(function(_0x218e7f,_0x352a16){logger[_0xa722('0x7')](_0xa722('0x8'),_0x87dc1a||_0xa722('0x9'));var _0x5b7ecb=new WebSocket(_0x87dc1a||_0xa722('0x9'),{'perMessageDeflate':![]});var _0x309d97='';var _0x1c20c1='0';var _0x2220e2='1';var _0x586dca='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x520cbb(_0x5cd3a8){var _0xde16d4=crypto[_0xa722('0xa')](_0xa722('0xb'));_0xde16d4[_0xa722('0xc')](_0x5cd3a8);return _0xde16d4[_0xa722('0xd')](_0xa722('0xe'));}function _0x1a0d69(){try{logger[_0xa722('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x28702e=moment()[_0xa722('0xf')]();var _0x4dccad=_0x520cbb(_0x28702e+_0x48836a+_0x22902c);_0x5b7ecb[_0xa722('0x10')](JSON['stringify']({'appID':_0x48836a,'timestamp':_0x28702e,'appKey':_0x4dccad}));var _0x29b08a=fs[_0xa722('0x11')](_0x3909fc);_0x29b08a['on']('data',function(_0x4be54f){_0x5b7ecb[_0xa722('0x10')](_0x4be54f);});_0x29b08a['on']('close',function(){_0x5b7ecb[_0xa722('0x10')](_0xa722('0x12'));});}catch(_0x31a78d){logger[_0xa722('0x13')](_0xa722('0x14'),JSON[_0xa722('0x15')](_0x31a78d));_0x5b7ecb[_0xa722('0x16')]();}}function _0x1ee74b(_0x28a9f5){try{if(_0x28a9f5){var _0x5c4de4=JSON[_0xa722('0x17')](_0x28a9f5);switch(_0x5c4de4[_0xa722('0x18')]){case 0x0:if(_0x5c4de4['result']){if(_0x5c4de4[_0xa722('0x19')][_0xa722('0x1a')]){logger[_0xa722('0x7')](_0xa722('0x1b'),JSON[_0xa722('0x15')](_0x5c4de4[_0xa722('0x19')]['hypotheses']));_0x309d97=_0x5c4de4[_0xa722('0x19')][_0xa722('0x1c')][0x0]['transcript'];_0x1c20c1=_0x5c4de4[_0xa722('0x19')]['hypotheses'][0x0][_0xa722('0x1d')];_0x2220e2='0';_0x586dca=_0xa722('0x1e');_0x5b7ecb[_0xa722('0x16')]();}}break;case 0x1:logger[_0xa722('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2220e2='1';_0x586dca=_0xa722('0x1f');break;case 0x2:logger[_0xa722('0x7')](_0xa722('0x20'));_0x2220e2='2';_0x586dca='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2220e2='9';_0x586dca=_0xa722('0x21');break;case 0xa:logger['info'](_0xa722('0x22'));_0x2220e2='10';_0x586dca='Authentication\x20failed.';break;case 0xb:logger['info'](_0xa722('0x23'));_0x2220e2='11';_0x586dca=_0xa722('0x23');}}}catch(_0x6f124e){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0xa722('0x15')](_0x6f124e));_0x5b7ecb[_0xa722('0x16')]();}}function _0x1fc8db(){logger[_0xa722('0x7')](_0xa722('0x24'));_0x218e7f({'transcript':_0x309d97,'confidence':_0x1c20c1,'status':_0x2220e2,'status_message':_0x586dca});}function _0x17d505(_0x3b643f){logger[_0xa722('0x13')](_0xa722('0x25'));if(!_['isNil'](_0x3b643f)){logger[_0xa722('0x13')](_[_0xa722('0x26')](_0x3b643f)?JSON[_0xa722('0x15')](_0x3b643f):_0x3b643f);}}_0x5b7ecb['on']('open',_0x1a0d69);_0x5b7ecb['on'](_0xa722('0x27'),_0x1ee74b);_0x5b7ecb['on'](_0xa722('0x28'),_0x1fc8db);_0x5b7ecb['on'](_0xa722('0x13'),_0x17d505);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 4eddac4..afcc405 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 _0x2d6b=['./asr'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2d6b,0x7e));var _0xb2d6=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x2d6b[_0x29d94e];return _0x106237;};var asr=require(_0xb2d6('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xde55=['./asr'];(function(_0x275f26,_0x49f050){var _0x326d04=function(_0x46209e){while(--_0x46209e){_0x275f26['push'](_0x275f26['shift']());}};_0x326d04(++_0x49f050);}(_0xde55,0xc1));var _0x5de5=function(_0x3c7e8f,_0x2c5c57){_0x3c7e8f=_0x3c7e8f-0x0;var _0xd095c6=_0xde55[_0x3c7e8f];return _0xd095c6;};var asr=require(_0x5de5('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e445fda..e0200af 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b114e0c..dd64305 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 _0xe14b=['aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','%s/recordings/%s','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','randomstring','moment','request-promise','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','interval','map','Intervals','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','callerid','createSquareRecording','calleridname','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isArray','length','replaceAllVariables','saveRestApiResult','isPlainObject','%s.%s','split','replaceAll','extra','getAndSetVariable','getVariable','result','setVariable','isConfigured','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','args','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','sync','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','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','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe14b,0x93));var _0xbe14=function(_0x199e95,_0x5404f3){_0x199e95=_0x199e95-0x0;var _0x2a250a=_0xe14b[_0x199e95];return _0x2a250a;};'use strict';var fs=require('fs');var util=require(_0xbe14('0x0'));var _=require(_0xbe14('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var Mustache=require('mustache');var rp=require(_0xbe14('0x4'));var logger=require('../../config/logger')('agi');var config=require(_0xbe14('0x5'));var scripts=require(_0xbe14('0x6'));var FILES_PATH=_0xbe14('0x7');var recursiveMapAttributes=[_0xbe14('0x8'),_0xbe14('0x9')];var verticesWithRetry=[_0xbe14('0xa'),_0xbe14('0xb'),'getsecretdigits'];var AGIVertices=function(_0x50f909,_0x496063,_0x30c355){this[_0xbe14('0xc')]=_0x50f909;this[_0xbe14('0xd')]=_0x496063;this[_0xbe14('0xe')]=_0x30c355;};AGIVertices['prototype']['getVariable']=function(_0x113243,_0x3f70cb){this['rpc'][_0xbe14('0xf')](_0x113243)[_0xbe14('0x10')](function(_0x886a5e){_0x3f70cb(null,_0x886a5e?_0x886a5e[_0xbe14('0x11')]:![]);})[_0xbe14('0x12')](function(_0x3b898d){_0x3f70cb(_0x3b898d);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x14')]=function(_0x16893f,_0xa2cf72){this[_0xbe14('0xd')][_0xbe14('0x15')](_0x16893f)[_0xbe14('0x10')](function(_0x530538){_0xa2cf72(null,_0x530538?_0x530538['name']:![]);})[_0xbe14('0x12')](function(_0x3dc4a9){_0xa2cf72(_0x3dc4a9);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x16')]=function(_0x4e8f34,_0x21c789){this[_0xbe14('0xd')][_0xbe14('0x17')](_0x4e8f34)[_0xbe14('0x10')](function(_0x38f1ea){_0x21c789(null,_0x38f1ea?_0x38f1ea[_0xbe14('0x11')]:![]);})[_0xbe14('0x12')](function(_0x5ea1f8){_0x21c789(_0x5ea1f8);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x18')]=function(_0x329588,_0x433459){this[_0xbe14('0xd')][_0xbe14('0x19')](_0x329588)['then'](function(_0x24f820){_0x433459(null,_0x24f820?_0x24f820[_0xbe14('0x1a')]:![]);})[_0xbe14('0x12')](function(_0xc12977){_0x433459(_0xc12977);});};AGIVertices[_0xbe14('0x13')]['getUser']=function(_0xe60f42,_0x56d845){this[_0xbe14('0xd')]['getUserById'](_0xe60f42)[_0xbe14('0x10')](function(_0x4a25fa){_0x56d845(null,_0x4a25fa?_0x4a25fa[_0xbe14('0x11')]:![]);})[_0xbe14('0x12')](function(_0x505dbd){_0x56d845(_0x505dbd);});};AGIVertices[_0xbe14('0x13')]['getTrunk']=function(_0x4587a8,_0x4851f8){this[_0xbe14('0xd')][_0xbe14('0x1b')](_0x4587a8)[_0xbe14('0x10')](function(_0x39cc81){_0x4851f8(null,_0x39cc81?_0x39cc81[_0xbe14('0x11')]:![]);})[_0xbe14('0x12')](function(_0x55d001){_0x4851f8(_0x55d001);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x1c')]=function(_0x391556,_0x169369){var _0x5dd475=this;this[_0xbe14('0xd')][_0xbe14('0x1d')](_0x391556)['then'](function(_0x3c3613){_0x169369(null,_0x3c3613?_0x5dd475[_0xbe14('0x1e')](_0x3c3613[_0xbe14('0x1f')]):![]);})[_0xbe14('0x12')](function(_0x34d648){_0x169369(_0x34d648);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x20')]=function(_0x2b05cb,_0x4168c8){this[_0xbe14('0xd')][_0xbe14('0x21')](_0x2b05cb)[_0xbe14('0x10')](function(_0x39dc0a){_0x4168c8(null,_0x39dc0a?_0x39dc0a:![]);})[_0xbe14('0x12')](function(_0x223f7a){_0x4168c8(_0x223f7a);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x22')]=function(_0x2ff48e,_0x29e76a,_0x14e7c4){this['mailRpc'][_0xbe14('0x22')](_0x2ff48e,_0x29e76a)['then'](function(){_0x14e7c4(null);})['catch'](function(_0x46c2d1){_0x14e7c4(_0x46c2d1);});};AGIVertices['prototype'][_0xbe14('0x23')]=function(_0x345b0,_0x52a25c){this['rpc']['getIntervalById'](_0x345b0)[_0xbe14('0x10')](function(_0xa3d24){if(_0xa3d24){if(_0xa3d24['IntervalId']){_0x52a25c(null,[_0xa3d24[_0xbe14('0x24')]]);}else{_0x52a25c(null,_[_0xbe14('0x25')](_0xa3d24[_0xbe14('0x26')],_0xbe14('0x24')));}}else{_0x52a25c(null,![]);}})[_0xbe14('0x12')](function(_0x5ef1e5){_0x52a25c(_0x5ef1e5);});};AGIVertices['prototype'][_0xbe14('0x1e')]=function(_0x52b24c){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x52b24c);};AGIVertices[_0xbe14('0x13')][_0xbe14('0x27')]=function(_0x2bb45,_0x3dbacb,_0x172e79){odbc[_0xbe14('0x28')](_0x2bb45,function(_0xcdc50){if(_0xcdc50){logger[_0xbe14('0x29')](_0xbe14('0x2a'),_0xcdc50);_0x172e79(_0xcdc50);}else{logger[_0xbe14('0x2b')](_0xbe14('0x2c'));odbc[_0xbe14('0x2d')](_0x3dbacb,function(_0x539c41,_0x4f51f8){if(_0x539c41){logger[_0xbe14('0x2b')](_0xbe14('0x2e'),_0x3dbacb);_0x172e79(_0x539c41);}else{logger[_0xbe14('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x3dbacb);odbc[_0xbe14('0x2f')](function(_0x2aa453){if(_0x2aa453){logger[_0xbe14('0x29')](_0xbe14('0x30'),_0x2aa453);}_0x172e79(null,_0x4f51f8);});}});}});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x31')]=function(_0x19fa30,_0x128843){this[_0xbe14('0xd')]['getSmsAccountById'](_0x19fa30)[_0xbe14('0x10')](function(_0x841b71){_0x128843(null,_0x841b71?_0x841b71:![]);})[_0xbe14('0x12')](function(_0x1b3118){_0x128843(_0x1b3118);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x32')]=function(_0x548d17,_0xb0f143){this[_0xbe14('0xd')][_0xbe14('0x32')](_0x548d17)[_0xbe14('0x10')](function(_0x5cf713){_0xb0f143(null,_0x5cf713);})['catch'](function(_0x38611d){_0xb0f143(_0x38611d);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x33')]=function(_0x51c859,_0x5d5318,_0x6b6aa8){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xbe14('0xc')][_0xbe14('0x34')],'node':_0x51c859[_0xbe14('0x35')],'application':_0x51c859['agicommand'],'data':_0x5d5318||null,'project_name':this['channel']['arg_1'],'callerid':this[_0xbe14('0xc')][_0xbe14('0x36')]})[_0xbe14('0x10')](function(_0x562325){if(_0x6b6aa8){_0x6b6aa8(null,_0x562325);}})[_0xbe14('0x12')](function(_0xcb0680){if(_0x6b6aa8){_0x6b6aa8(_0xcb0680);}});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x37')]=function(_0x58351f,_0x4a1a4b,_0x3e2fd3,_0x34ffa0){this[_0xbe14('0xd')][_0xbe14('0x37')]({'uniqueid':this[_0xbe14('0xc')]['uniqueid'],'callerid':this['channel'][_0xbe14('0x36')],'calleridname':this[_0xbe14('0xc')][_0xbe14('0x38')],'context':this[_0xbe14('0xc')]['context'],'extension':this[_0xbe14('0xc')][_0xbe14('0x39')],'priority':this['channel'][_0xbe14('0x3a')],'accountcode':this[_0xbe14('0xc')][_0xbe14('0x3b')],'dnid':this[_0xbe14('0xc')]['dnid'],'projectName':this['channel'][_0xbe14('0x3c')],'saveName':_0x4a1a4b,'filename':_0x58351f[_0xbe14('0x3d')]||_0x4a1a4b,'savePath':_0x3e2fd3})['then'](function(_0x5acf90){_0x34ffa0(null,_0x5acf90);})[_0xbe14('0x12')](function(_0x5d3726){_0x34ffa0(_0x5d3726);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x3e')]=function(_0xdbc6e1,_0xd04fd5,_0x10cd86,_0x5a4068,_0xf32e93){this[_0xbe14('0xd')][_0xbe14('0x3e')]({'uniqueid':this[_0xbe14('0xc')][_0xbe14('0x34')],'body':_0xdbc6e1,'direction':_0xd04fd5,'providerName':_0x10cd86,'providerResponse':_0x5a4068})['then'](function(_0x3a221b){if(_0xf32e93){_0xf32e93(null,_0x3a221b);}})[_0xbe14('0x12')](function(_0x35126f){if(_0xf32e93){_0xf32e93(_0x35126f);}});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x3f')]=function(_0x2dbeb1,_0x505829){this['rpc'][_0xbe14('0x3f')]({'firstName':_[_0xbe14('0x40')](_0x2dbeb1[_0xbe14('0x11')])||_['isNil'](_0x2dbeb1['name'])?_0xbe14('0x41')+Math[_0xbe14('0x42')]():_0x2dbeb1['name'],'lastName':_[_0xbe14('0x40')](_0x2dbeb1[_0xbe14('0x43')])||_['isNil'](_0x2dbeb1[_0xbe14('0x43')])?null:_0x2dbeb1['lastName'],'phone':_0x2dbeb1[_0xbe14('0x44')],'ListId':_0x2dbeb1[_0xbe14('0x45')],'scheduledat':_0x2dbeb1[_0xbe14('0x46')],'callbackUniqueid':this['channel'][_0xbe14('0x34')],'tags':_0xbe14('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0x2dbeb1[_0xbe14('0x46')][_0xbe14('0x48')](),'priority':_0x2dbeb1[_0xbe14('0x49')]})[_0xbe14('0x10')](function(_0x49322f){_0x505829(null,_0x49322f);})['catch'](function(_0x42a346){_0x505829(_0x42a346);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x4a')]=function(_0x243b9e,_0x32968f){this[_0xbe14('0xd')][_0xbe14('0x4b')](_0x243b9e)['then'](function(_0x72c875){_0x32968f(null,_0x72c875?_0x72c875[_0xbe14('0x11')]:![]);})[_0xbe14('0x12')](function(_0x1201e2){_0x32968f(_0x1201e2);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x4c')]=function(_0xd8f78f,_0x32df3c,_0x285b6e){var _0xc61103={'role':_0xbe14('0x4d')};_0xc61103[_0xd8f78f]=this['channel']['callerid'];this['rpc'][_0xbe14('0x4c')](_0xc61103,_0x32df3c,this[_0xbe14('0xc')][_0xbe14('0x34')])[_0xbe14('0x10')](function(_0x1cf828){_0x285b6e(null,_[_0xbe14('0x4e')](_0x1cf828)?![]:!![]);})[_0xbe14('0x12')](function(_0x22bf69){logger[_0xbe14('0x29')](_0x22bf69);_0x285b6e(null,![]);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x4f')]=function(_0x4346e8,_0x2088e4){var _0xeb915b={'role':_0xbe14('0x4d')};_0xeb915b[_0x4346e8]=this[_0xbe14('0xc')][_0xbe14('0x36')];this[_0xbe14('0xd')][_0xbe14('0x4f')](_0xeb915b)[_0xbe14('0x10')](function(_0x5f394c){_0x2088e4(null,_[_0xbe14('0x4e')](_0x5f394c)?![]:!![]);})[_0xbe14('0x12')](function(_0x2c426d){logger[_0xbe14('0x29')](_0x2c426d);_0x2088e4(null,![]);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x50')]=function(_0x198b55,_0x310311){var _0x23cb36={'role':_0xbe14('0x4d')};_0x23cb36[_0x198b55]=this['channel'][_0xbe14('0x36')];this[_0xbe14('0xd')][_0xbe14('0x50')](_0x23cb36)[_0xbe14('0x10')](function(_0x3ac6d8){_0x310311(null,_['isNil'](_0x3ac6d8)?![]:!![]);})[_0xbe14('0x12')](function(_0x120077){logger[_0xbe14('0x29')](_0x120077);_0x310311(null,![]);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x51')]=function(_0x5ed9b3,_0x48da19){var _0x14f064={'role':_0xbe14('0x4d')};_0x14f064[_0x5ed9b3]=this[_0xbe14('0xc')][_0xbe14('0x36')];var _0x289c4d=_0x5ed9b3!=_0xbe14('0x52')?util[_0xbe14('0x53')]('%s/%s@from-sip/n',_0xbe14('0x54'),this[_0xbe14('0xc')][_0xbe14('0x36')]):undefined;this[_0xbe14('0xd')][_0xbe14('0x51')](_0x14f064,_0x289c4d)[_0xbe14('0x10')](function(_0x445302){_0x48da19(null,_['isNil'](_0x445302)?![]:!![]);})['catch'](function(_0x12941d){logger[_0xbe14('0x29')](_0x12941d);_0x48da19(null,![]);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x55')]=function(_0x312504,_0x28cade){sh[_0xbe14('0x56')](_[_0xbe14('0x57')](_0x312504),function(_0x50e644,_0x5ca835){var _0x1007e3=_0x5ca835[_0xbe14('0x58')](/(\r\n|\n|\r)/gm,'');_0x28cade(null,_0x1007e3);});};AGIVertices[_0xbe14('0x13')]['googleCloudTTS']=function(_0x76e91e,_0x16bca1){scripts[_0xbe14('0x59')](_0x76e91e[_0xbe14('0x5a')],_0x76e91e[_0xbe14('0x5b')]||_0xbe14('0x5c'),_0x76e91e[_0xbe14('0x5c')],_0x76e91e['languageCode']||_0xbe14('0x5d'),_0x76e91e[_0xbe14('0x5e')]||_0xbe14('0x5f'),_0x76e91e[_0xbe14('0x60')]||_0xbe14('0x61'))[_0xbe14('0x10')](function(_0xeccc28){_0x16bca1(null,_0xeccc28);})['catch'](function(_0x3952c7){_0x16bca1(_0x3952c7);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x62')]=function(_0x1c0932,_0x28da4a){scripts[_0xbe14('0x62')](_0x1c0932[_0xbe14('0x5c')],_0x1c0932[_0xbe14('0x63')]||'en',0x1)['then'](function(_0x1e5ce1){_0x28da4a(null,_0x1e5ce1);})[_0xbe14('0x12')](function(_0x362999){_0x28da4a(_0x362999);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x64')]=function(_0x17576b,_0x4d59ce){var _0x176099={'uri':_0x17576b[_0xbe14('0x65')],'method':_0x17576b[_0xbe14('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x17576b[_0xbe14('0x67')])==='number'&&parseInt(_0x17576b[_0xbe14('0x67')])>=0x1?parseInt(_0x17576b[_0xbe14('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xbe14('0x68')]([_0xbe14('0x69'),_0xbe14('0x6a')],_0x176099[_0xbe14('0x66')][_0xbe14('0x6b')]())){try{_0x176099['body']=_0x17576b[_0xbe14('0x9')]?JSON['parse'](_0x17576b[_0xbe14('0x9')]):{};}catch(_0x5d85d3){logger[_0xbe14('0x29')](_0xbe14('0x6c'),_0x5d85d3);}}try{_0x176099[_0xbe14('0x6d')]=_0x17576b['rawHeaders']?JSON[_0xbe14('0x6e')](_0x17576b[_0xbe14('0x8')]):{};}catch(_0x18f6b7){logger['error'](_0xbe14('0x6f'),_0x18f6b7);}if(_0x17576b[_0xbe14('0x70')]){try{var _0x1737a8=require(_0x17576b[_0xbe14('0x70')])['sync'](this,_0x176099);_0x176099[_0xbe14('0x71')]=Mustache[_0xbe14('0x72')](_0x17576b[_0xbe14('0x65')],_0x1737a8,{},['$$','$$']);if(_0x176099[_0xbe14('0x6d')]){_0x176099[_0xbe14('0x6d')]=JSON[_0xbe14('0x6e')](Mustache[_0xbe14('0x72')](JSON['stringify'](_0x176099[_0xbe14('0x6d')]),_0x1737a8,{},['$$','$$']));}if(_0x176099[_0xbe14('0x73')]){_0x176099[_0xbe14('0x73')]=JSON['parse'](Mustache[_0xbe14('0x72')](JSON[_0xbe14('0x74')](_0x176099[_0xbe14('0x73')]),_0x1737a8,{},['$$','$$']));}}catch(_0x5bc52b){logger[_0xbe14('0x29')](_0xbe14('0x75'),_0x5bc52b);}}rp(_0x176099)['then'](function(_0x2be969){var _0x49990b={'statusCode':_0x2be969[_0xbe14('0x76')]||0xc8,'statusMessage':_0x2be969[_0xbe14('0x77')]||'OK','headers':_0x2be969['headers']||{},'body':_0x2be969['body']||{}};_0x4d59ce(null,_0x49990b);})[_0xbe14('0x12')](function(_0x3db955){var _0x29287a={'statusCode':_0x3db955['statusCode']||0x1f4,'statusMessage':_0x3db955[_0xbe14('0x78')]||_0xbe14('0x79'),'headers':_0x3db955[_0xbe14('0x7a')][_0xbe14('0x6d')]||{},'body':_0x3db955['options']['body']||{}};_0x4d59ce(null,_0x29287a);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x7b')]=function(_0xc8d0f6,_0x215d5b){scripts[_0xbe14('0x7b')](this[_0xbe14('0xc')][_0xbe14('0x34')],_0xc8d0f6['key'],_0xc8d0f6[_0xbe14('0x5c')],_0xc8d0f6['dialogflow_language']||'en')[_0xbe14('0x10')](function(_0x3a01bb){_0x215d5b(null,_0x3a01bb);})[_0xbe14('0x12')](function(_0x2382c4){_0x215d5b(_0x2382c4);});};AGIVertices['prototype'][_0xbe14('0x7c')]=function(_0xa8dd0c,_0xdfbd5b){scripts['googleDialogflowV2'](this[_0xbe14('0xc')][_0xbe14('0x34')],_0xa8dd0c[_0xbe14('0x7d')],_0xa8dd0c[_0xbe14('0x7e')],_0xa8dd0c[_0xbe14('0x7f')],_0xa8dd0c[_0xbe14('0x5c')],_0xa8dd0c[_0xbe14('0x80')]||'en')[_0xbe14('0x10')](function(_0xd2fef4){_0xdfbd5b(null,_0xd2fef4);})[_0xbe14('0x12')](function(_0x2bf94c){_0xdfbd5b(_0x2bf94c);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x81')]=function(_0x2a4946,_0x2fc475){scripts[_0xbe14('0x81')](this[_0xbe14('0xc')],_0x2a4946)[_0xbe14('0x10')](function(_0x1679bd){_0x2fc475(null,_0x1679bd);})[_0xbe14('0x12')](function(_0x52afc9){_0x2fc475(_0x52afc9);});};AGIVertices[_0xbe14('0x13')]['ispeechTTS']=function(_0x8d4c96,_0x1b8733){scripts[_0xbe14('0x82')](_0x8d4c96[_0xbe14('0x83')],_0x8d4c96[_0xbe14('0x5c')],_0x8d4c96['ispeech_tts_language']||'en-US',_0x8d4c96[_0xbe14('0x84')])[_0xbe14('0x10')](function(_0x13a732){_0x1b8733(null,_0x13a732);})[_0xbe14('0x12')](function(_0x4c1ad2){_0x1b8733(_0x4c1ad2);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x85')]=function(_0x4d6a75,_0x186225,_0x3b8b45){scripts[_0xbe14('0x85')](_0x186225,_0x4d6a75[_0xbe14('0x83')],_0x4d6a75['ispeech_asr_language']||_0xbe14('0x5d'),this['isConfigured'](_0x4d6a75['model'])?_0x4d6a75[_0xbe14('0x86')]:undefined)[_0xbe14('0x10')](function(_0x110603){_0x3b8b45(null,_0x110603);})[_0xbe14('0x12')](function(_0x3e8655){_0x3b8b45(_0x3e8655);});};AGIVertices['prototype'][_0xbe14('0x87')]=function(_0x1584f6,_0x5dc793){scripts['awsPolly'](_0x1584f6[_0xbe14('0x88')],_0x1584f6[_0xbe14('0x89')],_0x1584f6['aws_polly_region'],_0x1584f6[_0xbe14('0x8a')]||'Amy',_0x1584f6[_0xbe14('0x5c')],_0x1584f6['aws_text_type']||_0xbe14('0x5c'))['then'](function(_0x371ddd){_0x5dc793(null,_0x371ddd);})['catch'](function(_0x20a085){_0x5dc793(_0x20a085);});};AGIVertices[_0xbe14('0x13')]['awsLex']=function(_0x519ffc,_0x143f18){scripts['awsLex'](this['channel'][_0xbe14('0x34')],_0x519ffc[_0xbe14('0x88')],_0x519ffc[_0xbe14('0x89')],_0x519ffc[_0xbe14('0x8b')],_0x519ffc[_0xbe14('0x5c')],_0x519ffc[_0xbe14('0x8c')])[_0xbe14('0x10')](function(_0x57ad22){_0x143f18(null,_0x57ad22);})[_0xbe14('0x12')](function(_0x3aa921){_0x143f18(_0x3aa921);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x8d')]=function(_0x59779a,_0x26372a,_0x3c5097){scripts[_0xbe14('0x8d')](_0x26372a,_0x59779a['key'],_0x59779a[_0xbe14('0x8e')]||_0xbe14('0x5d'))['then'](function(_0x360cee){_0x3c5097(null,_0x360cee);})['catch'](function(_0x82cbcf){_0x3c5097(_0x82cbcf);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x8f')]=function(_0x50007a,_0x4b71ec,_0x5e2106){scripts[_0xbe14('0x8f')](_0x4b71ec,_0x50007a['appid'],_0x50007a['appsecret'],_0x50007a[_0xbe14('0x71')])['then'](function(_0xab74eb){_0x5e2106(null,_0xab74eb);})['catch'](function(_0x34e288){_0x5e2106(_0x34e288);});};AGIVertices[_0xbe14('0x13')][_0xbe14('0x90')]=function(_0x275e0f){var _0x463667=_[_0xbe14('0x68')](verticesWithRetry,_0x275e0f[_0xbe14('0x91')])?_0x275e0f:_[_0xbe14('0x92')](_0x275e0f);for(var _0x466f7f in _0x463667){if(_0x463667[_0xbe14('0x93')](_0x466f7f)){if(_0x463667[_0x466f7f]&&_[_0xbe14('0x94')](_0x463667[_0x466f7f])){if(_[_0xbe14('0x68')](recursiveMapAttributes,_0x466f7f)){_0x463667[_0x466f7f]=this[_0xbe14('0x95')](_0x463667[_0x466f7f]);}else{_0x463667[_0x466f7f]=this['replaceAllVariables'](_0x463667[_0x466f7f]);}}}}return _0x463667;};AGIVertices[_0xbe14('0x13')][_0xbe14('0x96')]=function(_0x342992){for(var _0x17b44a in _0x342992){if(_0x342992[_0xbe14('0x93')](_0x17b44a)){if(_['isPlainObject'](_0x342992[_0x17b44a])){this['recursiveNodeIndex'](_0x342992[_0x17b44a]);}else if(_[_0xbe14('0x97')](_0x342992[_0x17b44a])){for(var _0x1a9cdc=0x0;_0x1a9cdc<_0x342992[_0x17b44a][_0xbe14('0x98')];_0x1a9cdc++){this[_0xbe14('0x96')](_0x342992[_0x17b44a][_0x1a9cdc]);}}else if(_[_0xbe14('0x94')](_0x342992[_0x17b44a])){_0x342992[_0x17b44a]=this[_0xbe14('0x99')](_0x342992[_0x17b44a]);}}}};AGIVertices[_0xbe14('0x13')][_0xbe14('0x9a')]=function(_0x1a3e87,_0x26e7a7){for(var _0x761b3d in _0x1a3e87){if(_0x1a3e87[_0xbe14('0x93')](_0x761b3d)){if(_[_0xbe14('0x9b')](_0x1a3e87[_0x761b3d])){if(!_[_0xbe14('0x40')](_0x1a3e87[_0x761b3d])){this[_0xbe14('0x9a')](_0x1a3e87[_0x761b3d],util[_0xbe14('0x53')](_0xbe14('0x9c'),_0x26e7a7,_0x761b3d));}}else if(_[_0xbe14('0x97')](_0x1a3e87[_0x761b3d])){for(var _0x44c62f=0x0;_0x44c62f<_0x1a3e87[_0x761b3d][_0xbe14('0x98')];_0x44c62f++){this[_0xbe14('0x9a')](_0x1a3e87[_0x761b3d][_0x44c62f],util[_0xbe14('0x53')](_0xbe14('0x9c'),_0x26e7a7,_0x761b3d+'['+_0x44c62f+']'));}}else{if(!_[_0xbe14('0x4e')](_0x1a3e87[_0x761b3d])){this[_0xbe14('0xc')]['setVariable'](util[_0xbe14('0x53')](_0xbe14('0x9c'),_0x26e7a7,_0x761b3d),_0x1a3e87[_0x761b3d]);}}}}};AGIVertices[_0xbe14('0x13')][_0xbe14('0x95')]=function(_0x40727d){try{var _0x1d2c37=JSON['parse'](_0x40727d);this['recursiveNodeIndex'](_0x1d2c37);return JSON[_0xbe14('0x74')](_0x1d2c37);}catch(_0x4a44e0){return this[_0xbe14('0x99')](_0x40727d);}};AGIVertices['prototype'][_0xbe14('0x99')]=function(_0x59000b){var _0x11aa49=_0x59000b[_0xbe14('0x9d')]('{');for(var _0x278184=0x1;_0x278184<_0x11aa49[_0xbe14('0x98')];_0x278184+=0x1){var _0x3781ec=_0x11aa49[_0x278184][_0xbe14('0x9d')]('}');if(_0x3781ec[_0xbe14('0x98')]>0x1){_0x59000b=_0x59000b[_0xbe14('0x9e')]('{'+_0x3781ec[0x0]+'}',this[_0xbe14('0xc')]['getVariable'](_0x3781ec[0x0])[_0xbe14('0x9f')]||_0x3781ec[0x0]);}}if(_0x11aa49[_0xbe14('0x98')]===0x1){return _0x59000b[_0xbe14('0x48')]();}return this[_0xbe14('0x99')](_0x59000b);};AGIVertices['prototype'][_0xbe14('0xa0')]=function(_0x4c3090,_0x2481fe){var _0x4eb6c2=this[_0xbe14('0xc')][_0xbe14('0xa1')](_0x4c3090);if(_0x4eb6c2[_0xbe14('0xa2')]===-0x1){return _0x4eb6c2;}logger['info'](util[_0xbe14('0x53')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2481fe,_0x4eb6c2[_0xbe14('0x9f')]));return this[_0xbe14('0xc')][_0xbe14('0xa3')](_0x2481fe,_0x4eb6c2[_0xbe14('0x9f')]);};AGIVertices[_0xbe14('0x13')][_0xbe14('0xa4')]=function(_0x1f3a86){return _0x1f3a86&&_0x1f3a86!=='0'&&_0x1f3a86!=='-1'&&_0x1f3a86!=='';};AGIVertices[_0xbe14('0x13')][_0xbe14('0xa5')]=function(_0x5a7724){this[_0xbe14('0x33')]['sync'](this,_0x5a7724,'-');_0x5a7724[_0xbe14('0xa6')]=_0x5a7724[_0xbe14('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xbe14('0x13')]['mrcpsynth']=function(_0x275df5){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0xa7'),_0x275df5[_0xbe14('0x35')]));if(!this['isConfigured'](_0x275df5['text'])){return this[_0xbe14('0xc')]['noop'](_0xbe14('0xa8'));}var _0x36d6a6='\x22'+_0x275df5[_0xbe14('0x5c')]+'\x22';if(this[_0xbe14('0xa4')](_0x275df5['options'])){_0x36d6a6+=','+_0x275df5[_0xbe14('0x7a')];}var _0x34af71=this['channel'][_0xbe14('0x56')](_0xbe14('0xa9'),_0x36d6a6);if(_0x34af71[_0xbe14('0xa2')]===-0x1){return _0x34af71;}return this[_0xbe14('0xc')]['noop'](util[_0xbe14('0x53')](_0xbe14('0xaa'),_0x36d6a6));};AGIVertices[_0xbe14('0x13')][_0xbe14('0xab')]=function(_0x3b7920){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0xac'),_0x3b7920[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x3b7920['grammar'])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xae'));}var _0x678716=_0x3b7920['grammar'];if(this[_0xbe14('0xa4')](_0x3b7920[_0xbe14('0x7a')])){_0x678716+=','+_0x3b7920[_0xbe14('0x7a')];}var _0x4b00ae=this[_0xbe14('0xc')][_0xbe14('0x56')](_0xbe14('0xaf'),_0x678716);if(_0x4b00ae[_0xbe14('0xa2')]===-0x1){return _0x4b00ae;}var _0x3d328c=this[_0xbe14('0xa0')](_0xbe14('0xb0'),'MRCP_RECOG_CONFIDENCE');if(_0x3d328c[_0xbe14('0xa2')]===-0x1){return _0x3d328c;}var _0x4844b4=this[_0xbe14('0xa0')](_0xbe14('0xb1'),_0xbe14('0xb2'));if(_0x4844b4[_0xbe14('0xa2')]===-0x1){return _0x4844b4;}var _0x415f16=this['getAndSetVariable']('RECOG_INSTANCE()',_0xbe14('0xb3'));if(_0x415f16[_0xbe14('0xa2')]===-0x1){return _0x415f16;}return this[_0xbe14('0xc')][_0xbe14('0xad')](util['format'](_0xbe14('0xb4'),_0x678716));};AGIVertices[_0xbe14('0x13')][_0xbe14('0xb5')]=function(_0x54e986){logger[_0xbe14('0x2b')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x54e986[_0xbe14('0x35')]));return this[_0xbe14('0xc')][_0xbe14('0xb5')]([_0x54e986['command'],_0x54e986[_0xbe14('0xb6')]]);};AGIVertices[_0xbe14('0x13')]['answer']=function(_0x4443a7){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x4443a7[_0xbe14('0x35')]));if(this[_0xbe14('0xa4')](_0x4443a7[_0xbe14('0x67')])){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x4443a7[_0xbe14('0x67')]));var _0x2dc3a6=this[_0xbe14('0xc')]['wait'](_0x4443a7[_0xbe14('0x67')]);if(_0x2dc3a6[_0xbe14('0xa2')]===-0x1){return _0x2dc3a6;}}return this[_0xbe14('0xc')][_0xbe14('0xb7')]();};AGIVertices[_0xbe14('0x13')][_0xbe14('0x47')]=function(_0x1b22a0){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0xb8'),_0x1b22a0[_0xbe14('0x35')]));if(!this['isConfigured'](_0x1b22a0[_0xbe14('0x45')])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x1b22a0,'no\x20list\x20selected');}_0x1b22a0[_0xbe14('0x46')]=moment();if(this[_0xbe14('0xa4')](_0x1b22a0[_0xbe14('0xb9')])){_0x1b22a0['scheduledAt']=moment()[_0xbe14('0xba')](_0x1b22a0['delay'],_0xbe14('0xbb'));}if(!this[_0xbe14('0xa4')](_0x1b22a0['callback_priority'])){_0x1b22a0[_0xbe14('0x49')]=0x2;}this[_0xbe14('0x3f')]['sync'](this,_0x1b22a0);return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0xbc'),_0x1b22a0[_0xbe14('0x44')],_0x1b22a0[_0xbe14('0x45')],_0x1b22a0['scheduledAt']));};AGIVertices['prototype'][_0xbe14('0xbd')]=function(_0x339504){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x339504[_0xbe14('0x35')]));var _0x4cb29c=this[_0xbe14('0xc')][_0xbe14('0x56')](_0x339504['application'],_0x339504[_0xbe14('0x7a')]);if(_0x4cb29c[_0xbe14('0xa2')]===-0x1){return _0x4cb29c;}return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0xbe'),_0x339504[_0xbe14('0xbf')],_0x339504[_0xbe14('0x7a')]));};AGIVertices[_0xbe14('0x13')][_0xbe14('0xc0')]=function(_0x337dab){logger[_0xbe14('0x2b')](util['format'](_0xbe14('0xc1'),_0x337dab[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x337dab[_0xbe14('0x5c')])){return this['channel'][_0xbe14('0xad')](_0xbe14('0xa8'));}var _0x4a3d11='\x22'+_0x337dab[_0xbe14('0x5c')]+'\x22';if(this[_0xbe14('0xa4')](_0x337dab[_0xbe14('0x7a')])){_0x4a3d11+=','+_0x337dab['options'];}var _0x22822f=this[_0xbe14('0xc')][_0xbe14('0x56')](_0xbe14('0xa9'),_0x4a3d11);if(_0x22822f[_0xbe14('0xa2')]===-0x1){return _0x22822f;}return this['channel'][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0xaa'),_0x4a3d11));};AGIVertices[_0xbe14('0x13')][_0xbe14('0xc2')]=function(_0x5370c5){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0xc3'),_0x5370c5[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x5370c5[_0xbe14('0x5c')])){return this[_0xbe14('0xc')][_0xbe14('0xad')]('no\x20text\x20configured');}var _0x5c25dc='\x22'+_0x5370c5[_0xbe14('0x5c')]+'\x22';if(this[_0xbe14('0xa4')](_0x5370c5[_0xbe14('0x7a')])){_0x5c25dc+=','+_0x5370c5[_0xbe14('0x7a')];}var _0x4c83af=this['channel'][_0xbe14('0x56')](_0xbe14('0xa9'),_0x5c25dc);if(_0x4c83af[_0xbe14('0xa2')]===-0x1){return _0x4c83af;}return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0xaa'),_0x5c25dc));};AGIVertices[_0xbe14('0x13')]['lumenvoxasr']=function(_0xf6da38){logger[_0xbe14('0x2b')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0xf6da38[_0xbe14('0x35')]));if(!this['isConfigured'](_0xf6da38[_0xbe14('0xc4')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xae'));}var _0x7499d0=_0xf6da38['grammar'];if(this[_0xbe14('0xa4')](_0xf6da38[_0xbe14('0x7a')])){_0x7499d0+=','+_0xf6da38[_0xbe14('0x7a')];}var _0x1ad663=this[_0xbe14('0xc')][_0xbe14('0x56')]('MRCPRecog',_0x7499d0);if(_0x1ad663['result']===-0x1){return _0x1ad663;}var _0x2e681e=this['getAndSetVariable'](_0xbe14('0xb0'),_0xbe14('0xc5'));if(_0x2e681e[_0xbe14('0xa2')]===-0x1){return _0x2e681e;}var _0x5edd44=this[_0xbe14('0xa0')](_0xbe14('0xb1'),_0xbe14('0xc6'));if(_0x5edd44[_0xbe14('0xa2')]===-0x1){return _0x5edd44;}var _0x41a064=this[_0xbe14('0xa0')](_0xbe14('0xc7'),'LUMENVOX_ASR_INSTANCE');if(_0x41a064[_0xbe14('0xa2')]===-0x1){return _0x41a064;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x7499d0));};AGIVertices[_0xbe14('0x13')][_0xbe14('0xc8')]=function(_0x579f45){logger[_0xbe14('0x2b')](util['format'](_0xbe14('0xc9'),_0x579f45['label']));if(!this[_0xbe14('0xa4')](_0x579f45[_0xbe14('0xc4')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xae'));}var _0x5b3cfc=_0x579f45[_0xbe14('0xc4')];if(this[_0xbe14('0xa4')](_0x579f45[_0xbe14('0x7a')])){_0x5b3cfc+=','+_0x579f45[_0xbe14('0x7a')];}var _0x4de9eb=this['channel']['exec'](_0xbe14('0xaf'),_0x5b3cfc);if(_0x4de9eb[_0xbe14('0xa2')]===-0x1){return _0x4de9eb;}var _0x3826cf=this[_0xbe14('0xa0')](_0xbe14('0xb0'),'SESTEK_ASR_CONFIDENCE');if(_0x3826cf['result']===-0x1){return _0x3826cf;}var _0x295c4f=this[_0xbe14('0xa0')](_0xbe14('0xb1'),_0xbe14('0xca'));if(_0x295c4f[_0xbe14('0xa2')]===-0x1){return _0x295c4f;}var _0x53c194=this[_0xbe14('0xa0')]('RECOG_INSTANCE()',_0xbe14('0xcb'));if(_0x53c194[_0xbe14('0xa2')]===-0x1){return _0x53c194;}return this[_0xbe14('0xc')][_0xbe14('0xad')](util['format'](_0xbe14('0xb4'),_0x5b3cfc));};AGIVertices[_0xbe14('0x13')][_0xbe14('0xcc')]=function(_0x242f07){logger['info'](util[_0xbe14('0x53')](_0xbe14('0xcd'),_0x242f07[_0xbe14('0x35')]));if(!this['isConfigured'](_0x242f07['odbc_id'])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x242f07,_0xbe14('0xce'));}var _0x5cbe18=this[_0xbe14('0x18')][_0xbe14('0xcf')](this,_0x242f07[_0xbe14('0xd0')]);if(!_0x5cbe18){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x242f07,_0xbe14('0xd1'));}if(!this['isConfigured'](_0x242f07[_0xbe14('0x2d')])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x242f07,_0xbe14('0xd2'));}var _0x38ea63=_0x242f07['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xbe14('0xc')]['noop'](util[_0xbe14('0x53')]('query:\x20%s',_0x38ea63));var _0x20c7e6=this[_0xbe14('0x27')][_0xbe14('0xcf')](this,_0x5cbe18,_0x38ea63);this['createSquareDetailsReport'][_0xbe14('0xcf')](this,_0x242f07,_0x38ea63);if(!this[_0xbe14('0xa4')](_0x242f07[_0xbe14('0xd3')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xd4'));}var _0x303d01=this[_0xbe14('0xa1')][_0xbe14('0xcf')](this,_0x242f07[_0xbe14('0xd3')]);if(!_0x303d01){return this['channel'][_0xbe14('0x29')](_0x242f07,_0xbe14('0xd5'));}var _0x44e08b=this;_0x20c7e6[_0xbe14('0xd6')](function(_0x106d94,_0x267497){Object[_0xbe14('0xd7')](_0x106d94)[_0xbe14('0xd6')](function(_0x557ff1){_0x44e08b[_0xbe14('0xc')][_0xbe14('0xa3')](util[_0xbe14('0x53')](_0xbe14('0xd8'),_0x303d01,_0x267497,_0x557ff1),_0x106d94[_0x557ff1]);});});this[_0xbe14('0xc')][_0xbe14('0xa3')](util['format']('%s_ROWS_COUNT',_0x303d01),_0x20c7e6['length']);return this['channel'][_0xbe14('0xad')](util[_0xbe14('0x53')]('variable\x20%s\x20set',_0x303d01));};AGIVertices[_0xbe14('0x13')]['dial']=function(_0x22da6c){logger[_0xbe14('0xd9')](util[_0xbe14('0x53')](_0xbe14('0xda'),_0x22da6c[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x22da6c['sip_id'])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x22da6c,_0xbe14('0xdb'));}var _0x2778f9=this[_0xbe14('0xdc')][_0xbe14('0xcf')](this,_0x22da6c[_0xbe14('0xdd')]);if(!_0x2778f9){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x22da6c,'no\x20user\x20found');}var _0x2eb5e6=this['channel'][_0xbe14('0x56')]('DIAL',[util['format'](_0xbe14('0xde'),_0x2778f9),_0x22da6c[_0xbe14('0x67')],_0x22da6c[_0xbe14('0xdf')],_0x22da6c['url']]);if(_0x2eb5e6[_0xbe14('0xa2')]===-0x1){return _0x2eb5e6;}return this['channel'][_0xbe14('0xad')](util['format'](_0xbe14('0xe0'),_0xbe14('0xe1')));};AGIVertices[_0xbe14('0x13')][_0xbe14('0xe2')]=function(_0x331b17){logger[_0xbe14('0x2b')](util['format'](_0xbe14('0xe3'),_0x331b17[_0xbe14('0x35')]));if(!this['isConfigured'](_0x331b17['key'])){return this['channel'][_0xbe14('0xad')](_0xbe14('0xe4'));}if(!this[_0xbe14('0xa4')](_0x331b17[_0xbe14('0x5c')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xa8'));}this['channel'][_0xbe14('0xe5')]=!![];this[_0xbe14('0x33')](_0x331b17);this[_0xbe14('0x3e')](_0x331b17['text'],'in','','');this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')]('Trying\x20Dialogflow:\x20%s',_0x331b17['text']));var _0x1f446b=this['googleDialogflow'][_0xbe14('0xcf')](this,_0x331b17);if(_0x1f446b){for(var _0x3ba691 in _0x1f446b){if(_0x1f446b[_0xbe14('0x93')](_0x3ba691)){this[_0xbe14('0xc')][_0xbe14('0xa3')](util[_0xbe14('0x53')]('DIALOGFLOW_%s',_0x3ba691[_0xbe14('0x6b')]()),_0x1f446b[_0x3ba691]);}}this['createSquareMessage'](_0x1f446b[_0xbe14('0xe6')],_0xbe14('0xe7'),_0xbe14('0xe2'),'');return this['channel'][_0xbe14('0xad')](util[_0xbe14('0x53')]('Dialogflow\x20Result\x20%s',_0x1f446b['speech']));}return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x331b17,_0xbe14('0xe8'));};AGIVertices['prototype'][_0xbe14('0xe9')]=function(_0x34126e){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x34126e['label']));if(!this[_0xbe14('0xa4')](_0x34126e[_0xbe14('0x7d')])){return this['channel']['noop'](_0xbe14('0xea'));}if(!this[_0xbe14('0xa4')](_0x34126e[_0xbe14('0x7e')])){return this['channel'][_0xbe14('0xad')](_0xbe14('0xeb'));}if(!this[_0xbe14('0xa4')](_0x34126e[_0xbe14('0x7f')])){return this['channel'][_0xbe14('0xad')](_0xbe14('0xec'));}if(!this['isConfigured'](_0x34126e[_0xbe14('0x80')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xed'));}if(!this[_0xbe14('0xa4')](_0x34126e['text'])){return this['channel'][_0xbe14('0xad')](_0xbe14('0xa8'));}this[_0xbe14('0xc')][_0xbe14('0xe5')]=!![];this['createSquareDetailsReport'](_0x34126e);this[_0xbe14('0x3e')](_0x34126e[_0xbe14('0x5c')],'in','','');this['channel'][_0xbe14('0xad')](util['format'](_0xbe14('0xee'),_0x34126e[_0xbe14('0x5c')]));var _0x55a5f1=this[_0xbe14('0x7c')][_0xbe14('0xcf')](this,_0x34126e);if(_0x55a5f1){for(var _0x3c900a in _0x55a5f1){if(_0x55a5f1[_0xbe14('0x93')](_0x3c900a)){if(_0x3c900a!==_0xbe14('0xef')){this[_0xbe14('0xc')][_0xbe14('0xa3')](util[_0xbe14('0x53')]('DIALOGFLOW_%s',_0x3c900a[_0xbe14('0x6b')]()),_0x55a5f1[_0x3c900a]);}}}this[_0xbe14('0x3e')](_0x55a5f1[_0xbe14('0xe6')],'out','dialogflowV2',_0x55a5f1['providerResponse']);return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')]('DialogflowV2\x20Result\x20%s',_0x55a5f1['speech']));}return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x34126e,_0xbe14('0xf0'));};AGIVertices[_0xbe14('0x13')][_0xbe14('0xf1')]=function(_0x3d381e){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0xf2'),_0x3d381e['label']));if(!this[_0xbe14('0xa4')](_0x3d381e[_0xbe14('0xf3')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xf4'));}if(!this['isConfigured'](_0x3d381e[_0xbe14('0xf5')])){return this['channel']['noop'](_0xbe14('0xf6'));}if(!this[_0xbe14('0xa4')](_0x3d381e['password'])){return this['channel'][_0xbe14('0xad')](_0xbe14('0xf7'));}if(!this[_0xbe14('0xa4')](_0x3d381e[_0xbe14('0xf8')])){return this[_0xbe14('0xc')]['noop']('no\x20text\x20configured');}this[_0xbe14('0xc')]['bot']=!![];this[_0xbe14('0x33')](_0x3d381e);this[_0xbe14('0x3e')](_0x3d381e['text'],'in','','');this['channel']['noop'](util[_0xbe14('0x53')]('Trying\x20SestekNDA:\x20%s',_0x3d381e[_0xbe14('0x5c')]));var _0x418e8c=this['sestekNDA'][_0xbe14('0xcf')](this,_0x3d381e);if(_0x418e8c){for(var _0x30657c in _0x418e8c){if(_0x418e8c[_0xbe14('0x93')](_0x30657c)){this[_0xbe14('0xc')][_0xbe14('0xa3')](util['format'](_0xbe14('0xf9'),_0x30657c[_0xbe14('0x6b')]()),_0x418e8c[_0x30657c]);}}this[_0xbe14('0x3e')](_0x418e8c[_0xbe14('0xe6')],_0xbe14('0xe7'),'sesteknda','');if(_0x418e8c[_0xbe14('0xfa')]){this[_0xbe14('0xc')]['noop'](util[_0xbe14('0x53')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x418e8c[_0xbe14('0xfa')]));var _0x4370be=this[_0xbe14('0xc')][_0xbe14('0xfb')](_0x418e8c[_0xbe14('0xfa')]);try{fs[_0xbe14('0xfc')](_0x418e8c['audiofile']+_0xbe14('0xfd'));}catch(_0x2632aa){logger[_0xbe14('0x29')](_0x2632aa);}return _0x4370be;}else{return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0xfe'),_0x418e8c[_0xbe14('0xe6')]));}}return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x3d381e,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xbe14('0x13')][_0xbe14('0xff')]=function(_0x5869dd){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x100'),_0x5869dd[_0xbe14('0x35')]));return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xff'));};AGIVertices[_0xbe14('0x13')]['ext_dial']=function(_0x4514b2){logger['info'](util[_0xbe14('0x53')](_0xbe14('0x101'),_0x4514b2[_0xbe14('0x35')]));var _0x4069a4='';if(_0x4514b2[_0xbe14('0x102')]){if(!this[_0xbe14('0xa4')](_0x4514b2[_0xbe14('0x102')])){return this['channel']['error'](_0x4514b2,'no\x20trunk\x20selected');}else{var _0xd97eb5=parseInt(_0x4514b2[_0xbe14('0x102')],0xa);if(isNaN(_0xd97eb5)){_0x4069a4=_0x4514b2['trunk_id'];}else{_0x4069a4=this[_0xbe14('0x103')][_0xbe14('0xcf')](this,_0x4514b2[_0xbe14('0x102')]);if(!_0x4069a4){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x4514b2,_0xbe14('0x104'));}}}}else if(_0x4514b2[_0xbe14('0x105')]){_0x4069a4=_0x4514b2[_0xbe14('0x105')];}else{return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x4514b2,_0xbe14('0x106'));}var _0x4de631=this[_0xbe14('0xc')]['exec'](_0xbe14('0xe1'),[util[_0xbe14('0x53')](_0xbe14('0x107'),_0x4069a4,_0x4514b2['phone']),_0x4514b2[_0xbe14('0x67')],_0x4514b2[_0xbe14('0xdf')],_0x4514b2['url']]);if(_0x4de631[_0xbe14('0xa2')]===-0x1){return _0x4de631;}return this[_0xbe14('0xc')][_0xbe14('0xad')](util['format'](_0xbe14('0xe0'),_0xbe14('0xe1')));};AGIVertices['prototype'][_0xbe14('0x108')]=function(_0x514cf6){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x109'),_0x514cf6[_0xbe14('0x35')]));return this['channel']['noop'](_0xbe14('0x108'));};AGIVertices[_0xbe14('0x13')]['getdigits']=function(_0x5138e2){logger[_0xbe14('0x2b')](util['format'](_0xbe14('0x10a'),_0x5138e2[_0xbe14('0x35')]));if(_0x5138e2[_0xbe14('0xa6')]===0x0){return this[_0xbe14('0xa5')](_0x5138e2);}_0x5138e2[_0xbe14('0xa6')]-=0x1;if(!this[_0xbe14('0xa4')](_0x5138e2[_0xbe14('0x10b')])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x5138e2,_0xbe14('0x10c'));}var _0x4958a4=this['getSound']['sync'](this,_0x5138e2[_0xbe14('0x10b')]);if(!_0x4958a4){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x5138e2,_0xbe14('0x10d'));}if(!this[_0xbe14('0xa4')](_0x5138e2[_0xbe14('0xd3')])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0xbe14('0xd4'));}var _0x553ad2=this[_0xbe14('0xc')][_0xbe14('0x10e')](_0x4958a4,_0x5138e2[_0xbe14('0x10f')],_0x5138e2['maxdigit']);var _0x474eb4=_0x553ad2[_0xbe14('0xa2')]?_0x553ad2[_0xbe14('0xa2')][_0xbe14('0x48')]():'';logger[_0xbe14('0x2b')](_0xbe14('0x110'),JSON[_0xbe14('0x74')](_0x553ad2));if(_0x553ad2['result']===-0x1){this[_0xbe14('0x33')][_0xbe14('0xcf')](this,_0x5138e2,_0x474eb4);return _0x553ad2;}else if(_0x553ad2['extra']==='timeout'){_0x553ad2[_0xbe14('0xa2')]=_0x474eb4[_0xbe14('0x98')]>=parseInt(_0x5138e2[_0xbe14('0x111')])?'x':'i';}else{_0x553ad2['result']=_0x474eb4[_0xbe14('0x98')]>=parseInt(_0x5138e2[_0xbe14('0x111')])&&_0x474eb4[_0xbe14('0x98')]<=parseInt(_0x5138e2[_0xbe14('0x112')])?'x':'i';}var _0x2f05cb=this[_0xbe14('0xa1')]['sync'](this,_0x5138e2[_0xbe14('0xd3')]);if(!_0x2f05cb){return this['channel'][_0xbe14('0x29')](_0x5138e2,_0xbe14('0xd5'));}this[_0xbe14('0xc')]['setVariable'](_0x2f05cb,_0x474eb4);if(this[_0xbe14('0xa4')](_0x5138e2[_0xbe14('0x113')])){var _0x5c69aa=parseInt(_0x5138e2[_0xbe14('0x113')],0xa);var _0x5ec2da=rs[_0xbe14('0x114')]({'charset':'*','length':_0x5c69aa});var _0x4afd57=_0x474eb4[_0xbe14('0x98')];if(_0x4afd57>0x0){if(_0x4afd57>_0x5c69aa){this['createSquareDetailsReport'][_0xbe14('0xcf')](this,_0x5138e2,_0x5138e2[_0xbe14('0x115')]===_0xbe14('0x116')?_0x5ec2da+_0x474eb4[_0xbe14('0x117')](_0x5c69aa):_0x474eb4[_0xbe14('0x117')](0x0,_0x4afd57-_0x5c69aa)+_0x5ec2da);}else{this['createSquareDetailsReport'][_0xbe14('0xcf')](this,_0x5138e2,rs[_0xbe14('0x114')]({'charset':'*','length':_0x4afd57}));}}else{this['createSquareDetailsReport'][_0xbe14('0xcf')](this,_0x5138e2,'');}}else{this[_0xbe14('0x33')]['sync'](this,_0x5138e2,_0x474eb4);}return _0x553ad2;};AGIVertices[_0xbe14('0x13')][_0xbe14('0x118')]=function(_0x14803b){logger['info'](util[_0xbe14('0x53')](_0xbe14('0x119'),_0x14803b[_0xbe14('0x35')]));return this[_0xbe14('0xb')](_0x14803b);};AGIVertices['prototype'][_0xbe14('0x11a')]=function(_0x4072de){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x11b'),_0x4072de[_0xbe14('0x35')]));this[_0xbe14('0x33')][_0xbe14('0xcf')](this,_0x4072de,_0x4072de[_0xbe14('0x11c')]);return this['channel'][_0xbe14('0xad')](util['format']('GOAL\x20%s',_0x4072de[_0xbe14('0x11c')]));};AGIVertices[_0xbe14('0x13')]['awspolly']=function(_0x35abdc){logger[_0xbe14('0x2b')](util['format'](_0xbe14('0x11d'),_0x35abdc[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x35abdc[_0xbe14('0x88')])||!this[_0xbe14('0xa4')](_0x35abdc[_0xbe14('0x89')])){return this['channel']['noop'](_0xbe14('0x11e'));}if(!this['isConfigured'](_0x35abdc[_0xbe14('0x5c')])){return this[_0xbe14('0xc')]['noop'](_0xbe14('0xa8'));}this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x11f'),_0x35abdc[_0xbe14('0x5c')]));var _0x54bcf4=this['awsPolly']['sync'](this,_0x35abdc);if(_0x54bcf4){this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x120'),_0x54bcf4));var _0x25bd48=this[_0xbe14('0xc')][_0xbe14('0xfb')](_0x54bcf4);try{fs[_0xbe14('0xfc')](_0x54bcf4+'.wav');}catch(_0x9249c9){logger[_0xbe14('0x29')](_0x9249c9);}return _0x25bd48;}return this[_0xbe14('0xc')]['error'](_0x35abdc,_0xbe14('0x121'));};AGIVertices[_0xbe14('0x13')][_0xbe14('0x122')]=function(_0x41fc99){logger[_0xbe14('0x2b')](util['format'](_0xbe14('0x123'),_0x41fc99[_0xbe14('0x35')]));if(!this['isConfigured'](_0x41fc99[_0xbe14('0x88')])||!this[_0xbe14('0xa4')](_0x41fc99[_0xbe14('0x89')])){return this['channel'][_0xbe14('0xad')](_0xbe14('0x11e'));}if(!this[_0xbe14('0xa4')](_0x41fc99['aws_bot_name'])){return this[_0xbe14('0xc')][_0xbe14('0xad')]('no\x20bot\x20name\x20configured');}if(!this[_0xbe14('0xa4')](_0x41fc99[_0xbe14('0x5c')])){return this[_0xbe14('0xc')]['noop'](_0xbe14('0xa8'));}this[_0xbe14('0xc')][_0xbe14('0xe5')]=!![];this[_0xbe14('0x33')](_0x41fc99);this[_0xbe14('0x3e')](_0x41fc99[_0xbe14('0x5c')],'in','','');this[_0xbe14('0xc')][_0xbe14('0xad')](util['format'](_0xbe14('0x124'),_0x41fc99[_0xbe14('0x5c')]));var _0xa30e04=this[_0xbe14('0x125')][_0xbe14('0xcf')](this,_0x41fc99);if(_0xa30e04){for(var _0x4cb28e in _0xa30e04){if(_0xa30e04[_0xbe14('0x93')](_0x4cb28e)&&_[_0xbe14('0x94')](_0xa30e04[_0x4cb28e])){this[_0xbe14('0xc')][_0xbe14('0xa3')](util[_0xbe14('0x53')](_0xbe14('0x126'),_0x4cb28e['toUpperCase']()),_0xa30e04[_0x4cb28e]);}}if(_['isNil'](_0xa30e04['message'])){return this[_0xbe14('0xc')][_0xbe14('0xad')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xbe14('0x3e')](_0xa30e04[_0xbe14('0x78')],_0xbe14('0xe7'),_0xbe14('0x127'),'');return this['channel'][_0xbe14('0xad')](util[_0xbe14('0x53')]('Amazon\x20Lex\x20Result\x20%s',_0xa30e04[_0xbe14('0x78')]));}}return this['channel']['error'](_0x41fc99,_0xbe14('0x128'));};AGIVertices[_0xbe14('0x13')][_0xbe14('0x129')]=function(_0x4e82ee){logger['info'](util[_0xbe14('0x53')](_0xbe14('0x12a'),_0x4e82ee[_0xbe14('0x35')],_0x4e82ee[_0xbe14('0x67')]));if(!this['isConfigured'](_0x4e82ee[_0xbe14('0x83')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xe4'));}var _0x398ead=_0xbe14('0x12b');var _0x610c2a=util[_0xbe14('0x53')]('%s/recordings/%s',FILES_PATH,rs[_0xbe14('0x114')](0x4));var _0x25206c=util['format']('%s.%s',_0x610c2a,_0x398ead);var _0x6a0f29=!![];if(_0x4e82ee[_0xbe14('0x12c')]===_0xbe14('0x12d')){_0x6a0f29=![];}var _0x1c4d28=this[_0xbe14('0xc')][_0xbe14('0x12e')](_0x610c2a,_0x398ead,_0x4e82ee['intKey'],_0x4e82ee[_0xbe14('0x67')],undefined,_0x6a0f29);if(_0x1c4d28[_0xbe14('0xa2')]!==-0x1){this['channel'][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x12f'),_0x25206c));var _0x404327=this[_0xbe14('0x8d')][_0xbe14('0xcf')](this,_0x4e82ee,_0x25206c);if(_0x404327){for(var _0x14cec7 in _0x404327){if(_0x404327['hasOwnProperty'](_0x14cec7)){this[_0xbe14('0xc')][_0xbe14('0xa3')](util[_0xbe14('0x53')](_0xbe14('0x130'),_0x14cec7[_0xbe14('0x6b')]()),_0x404327[_0x14cec7]);}}return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')]('GoogleASR\x20Result\x20%s',JSON[_0xbe14('0x74')](_0x404327)));}}return _0x1c4d28;};AGIVertices[_0xbe14('0x13')][_0xbe14('0x131')]=function(_0x4c7833){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x132'),_0x4c7833['label']));if(!this[_0xbe14('0xa4')](_0x4c7833['appid'])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0x133'));}if(!this[_0xbe14('0xa4')](_0x4c7833[_0xbe14('0x134')])){return this[_0xbe14('0xc')][_0xbe14('0xad')]('no\x20appsecret\x20configured');}var _0x1cedec=_0xbe14('0x12b');var _0x1457f0=util[_0xbe14('0x53')](_0xbe14('0x135'),FILES_PATH,rs[_0xbe14('0x114')](0x4));var _0x2dac86=util['format'](_0xbe14('0x9c'),_0x1457f0,_0x1cedec);var _0x447653=!![];if(_0x4c7833[_0xbe14('0x12c')]===_0xbe14('0x12d')){_0x447653=![];}var _0x37a538=this[_0xbe14('0xc')][_0xbe14('0x12e')](_0x1457f0,_0x1cedec,_0x4c7833[_0xbe14('0x136')],_0x4c7833[_0xbe14('0x67')],undefined,_0x447653);if(_0x37a538[_0xbe14('0xa2')]!==-0x1){this[_0xbe14('0xc')][_0xbe14('0xad')](util['format'](_0xbe14('0x137'),_0x2dac86));var _0x2c1fcc=this['tildeASR']['sync'](this,_0x4c7833,_0x2dac86);if(_0x2c1fcc){for(var _0x276bac in _0x2c1fcc){if(_0x2c1fcc[_0xbe14('0x93')](_0x276bac)){this[_0xbe14('0xc')][_0xbe14('0xa3')](util[_0xbe14('0x53')](_0xbe14('0x138'),_0x276bac[_0xbe14('0x6b')]()),_0x2c1fcc[_0x276bac]);}}return this[_0xbe14('0xc')]['noop'](util[_0xbe14('0x53')]('TildeASR\x20Result\x20%s',JSON[_0xbe14('0x74')](_0x2c1fcc)));}}return _0x37a538;};AGIVertices[_0xbe14('0x13')][_0xbe14('0x139')]=function(_0x1d343a){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1d343a['label']));return this['channel']['continueAt'](_0x1d343a['context'],_0x1d343a[_0xbe14('0x39')],_0x1d343a[_0xbe14('0x3a')]);};AGIVertices['prototype']['gotoif']=function(_0x40aec8){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x13a'),_0x40aec8[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x40aec8[_0xbe14('0x13b')])){return this[_0xbe14('0xc')]['error'](_0x40aec8,_0xbe14('0x13c'));}try{var _0x4b249c=eval(_0x40aec8[_0xbe14('0x13b')])?_0xbe14('0x13d'):_0xbe14('0x13e');this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x13f'),_0x40aec8[_0xbe14('0x13b')],_0x4b249c));return{'code':0xc8,'result':_0x4b249c};}catch(_0x38368c){return{'code':0xc8,'result':_0xbe14('0x13e')};}};AGIVertices[_0xbe14('0x13')]['gotoiftime']=function(_0x14e7b9){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x140'),_0x14e7b9[_0xbe14('0x35')]));if(!this['isConfigured'](_0x14e7b9['interval_id'])){return this[_0xbe14('0xc')]['error'](_0x14e7b9,'no\x20interval\x20configured');}var _0x11e166=this['getIntervals'][_0xbe14('0xcf')](this,_0x14e7b9[_0xbe14('0x141')]);if(!_0x11e166){return this['channel'][_0xbe14('0x29')](_0x14e7b9,'no\x20intervals\x20found');}for(var _0x28d646=0x0;_0x28d646<_0x11e166['length'];_0x28d646+=0x1){var _0x1f11dd=this[_0xbe14('0xc')][_0xbe14('0xa1')](util[_0xbe14('0x53')](_0xbe14('0x142'),_0x11e166[_0x28d646]));if(_0x1f11dd[_0xbe14('0xa2')]===-0x1){return _0x1f11dd;}logger['info'](util['format'](_0xbe14('0x143'),_0x11e166[_0x28d646],_0x1f11dd[_0xbe14('0x9f')]));if(_0x1f11dd[_0xbe14('0x9f')]===_0xbe14('0x13d')){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x143'),_0x11e166[_0x28d646],_0xbe14('0x13d')));this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')]('IFTIME\x20%s\x20%s',_0x11e166[_0x28d646],_0xbe14('0x13d')));return{'code':0xc8,'result':_0xbe14('0x13d')};}else{logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x143'),_0x11e166[_0x28d646],_0xbe14('0x13e')));this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x143'),_0x11e166[_0x28d646],_0xbe14('0x13e')));}}return{'code':0xc8,'result':_0xbe14('0x13e')};};AGIVertices['prototype']['hangup']=function(_0x5ddefd){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5ddefd[_0xbe14('0x35')]));return this[_0xbe14('0xc')][_0xbe14('0x144')]();};AGIVertices['prototype']['ispeechasr']=function(_0x42aa9f){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x145'),_0x42aa9f[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x42aa9f[_0xbe14('0x83')])){return this[_0xbe14('0xc')][_0xbe14('0xad')]('no\x20key\x20configured');}var _0x1013d7='wav';var _0x1f354a=util[_0xbe14('0x53')]('%s/recordings/%s',FILES_PATH,rs[_0xbe14('0x114')](0x4));var _0x41c648=util[_0xbe14('0x53')](_0xbe14('0x9c'),_0x1f354a,_0x1013d7);var _0x1d8912=!![];if(_0x42aa9f[_0xbe14('0x12c')]===_0xbe14('0x12d')){_0x1d8912=![];}var _0x2b53f8=this['channel'][_0xbe14('0x12e')](_0x1f354a,_0x1013d7,_0x42aa9f[_0xbe14('0x136')],_0x42aa9f[_0xbe14('0x67')],undefined,_0x1d8912);if(_0x2b53f8[_0xbe14('0xa2')]!==-0x1){this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x146'),_0x41c648));var _0x2c0438=this[_0xbe14('0x85')][_0xbe14('0xcf')](this,_0x42aa9f,_0x41c648);if(_0x2c0438){for(var _0x55ce2c in _0x2c0438){if(_0x2c0438[_0xbe14('0x93')](_0x55ce2c)){this['channel'][_0xbe14('0xa3')](util['format'](_0xbe14('0x147'),_0x55ce2c['toUpperCase']()),_0x2c0438[_0x55ce2c]);}}return this['channel'][_0xbe14('0xad')](util['format'](_0xbe14('0x148'),JSON['stringify'](_0x2c0438)));}}return _0x2b53f8;};AGIVertices[_0xbe14('0x13')]['ispeechtts']=function(_0x4743c2){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x149'),_0x4743c2[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x4743c2[_0xbe14('0x83')])){return this[_0xbe14('0xc')]['noop'](_0xbe14('0xe4'));}if(!this[_0xbe14('0xa4')](_0x4743c2[_0xbe14('0x5c')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xa8'));}this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')]('Trying\x20ispeech\x20TTS\x20%s',_0x4743c2[_0xbe14('0x5c')]));var _0x4252ea=this[_0xbe14('0x82')][_0xbe14('0xcf')](this,_0x4743c2);if(_0x4252ea){this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x146'),_0x4252ea));var _0x41df90=this[_0xbe14('0xc')][_0xbe14('0xfb')](_0x4252ea,_0x4743c2[_0xbe14('0x136')]);try{fs[_0xbe14('0xfc')](_0x4252ea+_0xbe14('0xfd'));}catch(_0x15832c){logger[_0xbe14('0x29')](_0x15832c);}return _0x41df90;}return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x4743c2,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbe14('0x13')][_0xbe14('0x14a')]=function(_0x180f0c){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x14b'),_0x180f0c['label']));if(!this[_0xbe14('0xa4')](_0x180f0c[_0xbe14('0x14c')])){return this[_0xbe14('0xc')]['error'](_0x180f0c,'no\x20find\x20by\x20configured');}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbe14('0xc')]['callerid'],_0x180f0c[_0xbe14('0x14c')]));var _0x2b4270=this[_0xbe14('0x51')][_0xbe14('0xcf')](this,_0x180f0c['findBy']);if(_0x2b4270){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbe14('0xc')][_0xbe14('0x36')],_0x180f0c[_0xbe14('0x14c')]));this['channel'][_0xbe14('0xad')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xbe14('0xc')]['callerid'],_0x180f0c[_0xbe14('0x14c')]));return{'code':0xc8,'result':_0xbe14('0x14d')};}else{logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x14e'),this[_0xbe14('0xc')][_0xbe14('0x36')],_0x180f0c[_0xbe14('0x14c')]));this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x14e'),this['channel'][_0xbe14('0x36')],_0x180f0c[_0xbe14('0x14c')]));return{'code':0xc8,'result':_0xbe14('0x14f')};}};AGIVertices[_0xbe14('0x13')][_0xbe14('0x150')]=function(_0x537ec3){logger[_0xbe14('0x2b')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x537ec3[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x537ec3[_0xbe14('0x14c')])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x537ec3,'no\x20find\x20by\x20configured');}logger['info'](util[_0xbe14('0x53')](_0xbe14('0x151'),this['channel'][_0xbe14('0x36')],_0x537ec3[_0xbe14('0x14c')]));var _0x30903d=this['agentLogout']['sync'](this,_0x537ec3[_0xbe14('0x14c')]);if(_0x30903d){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xbe14('0xc')][_0xbe14('0x36')],_0x537ec3['findBy']));this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x152'),this[_0xbe14('0xc')][_0xbe14('0x36')],_0x537ec3['findBy']));return{'code':0xc8,'result':_0xbe14('0x14d')};}else{logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x14e'),this[_0xbe14('0xc')]['callerid'],_0x537ec3[_0xbe14('0x14c')]));this[_0xbe14('0xc')][_0xbe14('0xad')](util['format'](_0xbe14('0x14e'),this[_0xbe14('0xc')]['callerid'],_0x537ec3[_0xbe14('0x14c')]));return{'code':0xc8,'result':_0xbe14('0x14f')};}};AGIVertices['prototype']['math']=function(_0x4251f9){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x153'),_0x4251f9[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x4251f9['operation'])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x4251f9,_0xbe14('0x154'));}this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0x155'),_0x4251f9[_0xbe14('0x156')]));var _0x3d4966=eval(_0x4251f9[_0xbe14('0x156')]);if(!this[_0xbe14('0xa4')](_0x4251f9[_0xbe14('0xd3')])){return this['channel'][_0xbe14('0xad')](_0xbe14('0xd4'));}var _0x39806e=this['getVariable'][_0xbe14('0xcf')](this,_0x4251f9['variable_id']);if(!_0x39806e){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x4251f9,'no\x20variable\x20found');}if(_[_0xbe14('0x97')](_0x3d4966)){var _0x5f2767=this;_0x3d4966[_0xbe14('0xd6')](function(_0x5ca292,_0x578551){_0x5f2767['channel'][_0xbe14('0xa3')](util[_0xbe14('0x53')](_0xbe14('0x157'),_0x39806e,_0x578551),_0x5ca292);});return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')]('variable\x20%s[key]\x20set',_0x39806e));}else{return this[_0xbe14('0xc')][_0xbe14('0xa3')](_0x39806e,_0x3d4966);}};AGIVertices[_0xbe14('0x13')][_0xbe14('0xa')]=function(_0x424422){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x158'),_0x424422['label']));if(_0x424422[_0xbe14('0xa6')]===0x0){return this[_0xbe14('0xa5')](_0x424422);}_0x424422[_0xbe14('0xa6')]-=0x1;if(!this[_0xbe14('0xa4')](_0x424422[_0xbe14('0x10b')])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x424422,_0xbe14('0x10c'));}var _0x1a84a9=this['getSound'][_0xbe14('0xcf')](this,_0x424422['file_id']);if(!_0x1a84a9){return this['channel'][_0xbe14('0x29')](_0x424422,_0xbe14('0x10d'));}var _0x56df7f=this[_0xbe14('0xc')][_0xbe14('0x10e')](_0x1a84a9,_0x424422[_0xbe14('0x10f')],_0x424422[_0xbe14('0x159')]);var _0xfc3180=_0x56df7f[_0xbe14('0xa2')];if(_0x56df7f[_0xbe14('0xa2')]===-0x1){this[_0xbe14('0x33')][_0xbe14('0xcf')](this,_0x424422,'-1');return _0x56df7f;}else if(_0x56df7f[_0xbe14('0x9f')]===_0xbe14('0x67')){_0x56df7f[_0xbe14('0xa2')]=_0x56df7f['result'][_0xbe14('0x98')]>0x0?_0x56df7f['result']:'t';}else if(_[_0xbe14('0x40')](_0x56df7f[_0xbe14('0xa2')])){_0x56df7f[_0xbe14('0xa2')]='#';_0xfc3180='#';}if(!this[_0xbe14('0xa4')](_0x424422['variable_id'])){this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0xd4'));}else{var _0x32f6d6=this[_0xbe14('0xa1')][_0xbe14('0xcf')](this,_0x424422[_0xbe14('0xd3')]);if(!_0x32f6d6){return this['channel'][_0xbe14('0x29')](_0x424422,_0xbe14('0xd5'));}this[_0xbe14('0xc')][_0xbe14('0xa3')](_0x32f6d6,_0xfc3180);}this[_0xbe14('0x33')][_0xbe14('0xcf')](this,_0x424422,_0xfc3180);return _0x56df7f;};AGIVertices[_0xbe14('0x13')][_0xbe14('0xad')]=function(_0x4062d2){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x15a'),_0x4062d2[_0xbe14('0x35')]));return this[_0xbe14('0xc')]['noop'](_0x4062d2[_0xbe14('0x15b')]||_0x4062d2[_0xbe14('0x35')]);};AGIVertices[_0xbe14('0x13')]['pause']=function(_0x17fa4b){logger[_0xbe14('0x2b')](util['format'](_0xbe14('0x15c'),_0x17fa4b[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x17fa4b[_0xbe14('0x14c')])){return this['channel'][_0xbe14('0x29')](_0x17fa4b,_0xbe14('0x15d'));}logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x151'),this[_0xbe14('0xc')][_0xbe14('0x36')],_0x17fa4b[_0xbe14('0x14c')]));var _0x1ea046=this[_0xbe14('0x4a')][_0xbe14('0xcf')](this,_0x17fa4b['pause_id']);var _0x2b2a2b=this['agentPause'][_0xbe14('0xcf')](this,_0x17fa4b[_0xbe14('0x14c')],_0x1ea046);if(_0x2b2a2b){logger['info'](util['format'](_0xbe14('0x152'),this[_0xbe14('0xc')][_0xbe14('0x36')],_0x17fa4b[_0xbe14('0x14c')]));this[_0xbe14('0xc')][_0xbe14('0xad')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xbe14('0xc')][_0xbe14('0x36')],_0x17fa4b['findBy']));return{'code':0xc8,'result':_0xbe14('0x14d')};}else{logger['info'](util[_0xbe14('0x53')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbe14('0xc')][_0xbe14('0x36')],_0x17fa4b['findBy']));this[_0xbe14('0xc')][_0xbe14('0xad')](util['format'](_0xbe14('0x152'),this[_0xbe14('0xc')][_0xbe14('0x36')],_0x17fa4b['findBy']));return{'code':0xc8,'result':_0xbe14('0x14f')};}};AGIVertices[_0xbe14('0x13')]['playback']=function(_0x52232d){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x15e'),_0x52232d['label']));if(!this[_0xbe14('0xa4')](_0x52232d[_0xbe14('0x10b')])){return this[_0xbe14('0xc')]['error'](_0x52232d,_0xbe14('0x10c'));}var _0x5acfca=this[_0xbe14('0x1c')][_0xbe14('0xcf')](this,_0x52232d[_0xbe14('0x10b')]);if(!_0x5acfca){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x52232d,_0xbe14('0x10d'));}var _0x5b8223=this[_0xbe14('0xc')][_0xbe14('0x56')]('PLAYBACK',[_0x5acfca,_0x52232d[_0xbe14('0xdf')]]);if(_0x5b8223['result']===-0x1){return _0x5b8223;}return this['channel'][_0xbe14('0xad')](util[_0xbe14('0x53')]('Executed\x20command\x20%s\x20%s',_0xbe14('0x15f'),_0x5acfca));};AGIVertices[_0xbe14('0x13')][_0xbe14('0x160')]=function(_0x301d43){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x161'),_0x301d43[_0xbe14('0x35')]));if(!this['isConfigured'](_0x301d43['queue_id'])){return this['channel'][_0xbe14('0x29')](_0x301d43,'no\x20queue\x20selected');}var _0x5cc749='';var _0x6ddb17=parseInt(_0x301d43[_0xbe14('0x162')],0xa);if(isNaN(_0x6ddb17)){_0x5cc749=_0x301d43[_0xbe14('0x162')];}else{_0x5cc749=this['getVoiceQueue']['sync'](this,_0x301d43[_0xbe14('0x162')]);if(!_0x5cc749){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x301d43,_0xbe14('0x163'));}}var _0x35b93a='';if(this[_0xbe14('0xa4')](_0x301d43[_0xbe14('0x10b')])){var _0x59d566=this[_0xbe14('0x1c')][_0xbe14('0xcf')](this,_0x301d43[_0xbe14('0x10b')]);if(_0x59d566){_0x35b93a=_0x59d566;}}this[_0xbe14('0x33')][_0xbe14('0xcf')](this,_0x301d43,_0x5cc749);if(_0x301d43[_0xbe14('0xdf')]['indexOf']('x')<0x0){_0x301d43[_0xbe14('0xdf')]+='x';}if(_0x301d43[_0xbe14('0xdf')]['indexOf']('X')<0x0){_0x301d43[_0xbe14('0xdf')]+='X';}this[_0xbe14('0xc')][_0xbe14('0xa3')](_0xbe14('0x164'),_0x5cc749?_0x5cc749[_0xbe14('0x165')]():'');var _0x4a1e5a=this[_0xbe14('0xc')][_0xbe14('0x56')](_0xbe14('0x166'),[_0x5cc749,_0x301d43[_0xbe14('0xdf')],_0x301d43[_0xbe14('0x65')],_0x35b93a,_0x301d43['timeout'],_0x301d43[_0xbe14('0xb5')],_0x301d43['macro'],_0x301d43[_0xbe14('0x167')],'',_0x301d43[_0xbe14('0x168')]]);if(_0x4a1e5a['result']===-0x1){return _0x4a1e5a;}return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0xbe'),_0xbe14('0x166'),_0x5cc749));};AGIVertices[_0xbe14('0x13')]['record']=function(_0x180362){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x169'),_0x180362[_0xbe14('0x35')]));var _0x14f5f6=_0x180362[_0xbe14('0x16a')]||_0xbe14('0x12b');var _0xe6a6ee=util[_0xbe14('0x53')]('%s_%s',this[_0xbe14('0xc')][_0xbe14('0x34')],rs[_0xbe14('0x114')](0x5));var _0x12a598=util[_0xbe14('0x53')]('%s/recordings/%s.%s',FILES_PATH,_0xe6a6ee,_0x14f5f6);var _0x41ed52=util['format'](_0xbe14('0x135'),FILES_PATH,_0xe6a6ee);this[_0xbe14('0x37')]['sync'](this,_0x180362,_0xe6a6ee,_0x12a598);this[_0xbe14('0xc')][_0xbe14('0xa3')](_0xbe14('0x16b'),_0xe6a6ee);logger[_0xbe14('0x2b')](_0xbe14('0x16c'),_0x41ed52,_0x14f5f6,_0x180362[_0xbe14('0x16d')],_0x180362[_0xbe14('0x67')]);return this[_0xbe14('0xc')][_0xbe14('0x12e')](_0x41ed52,_0x14f5f6,_0x180362[_0xbe14('0x16d')],_0x180362[_0xbe14('0x67')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x11dfb2){logger['info'](util[_0xbe14('0x53')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x11dfb2[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x11dfb2[_0xbe14('0x65')])){return this['channel'][_0xbe14('0xad')](_0xbe14('0x16e'));}var _0x338729=this[_0xbe14('0x64')][_0xbe14('0xcf')](this,_0x11dfb2);logger['info'](util[_0xbe14('0x53')](_0xbe14('0x16f'),util['inspect'](_0x338729,{'showHidden':![],'depth':null})));if(!this[_0xbe14('0xa4')](_0x11dfb2[_0xbe14('0xd3')])){return this['channel'][_0xbe14('0xad')](_0xbe14('0x170'));}var _0x166b13=this['getVariable']['sync'](this,_0x11dfb2[_0xbe14('0xd3')]);if(!_0x166b13){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x11dfb2,_0xbe14('0xd5'));}this[_0xbe14('0xc')][_0xbe14('0xa3')](util[_0xbe14('0x53')](_0xbe14('0x171'),_0x166b13),_0x338729[_0xbe14('0x76')]?_0x338729[_0xbe14('0x76')]:'200');this[_0xbe14('0xc')][_0xbe14('0xa3')](util[_0xbe14('0x53')](_0xbe14('0x172'),_0x166b13),_0x338729[_0xbe14('0x77')]?_0x338729[_0xbe14('0x77')]:'OK');if(_0x338729[_0xbe14('0x73')]){try{this[_0xbe14('0x9a')](_0x338729[_0xbe14('0x73')],_0x166b13);}catch(_0x35d02a){logger[_0xbe14('0x29')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x166b13));}}return this['channel']['noop'](util[_0xbe14('0x53')](_0xbe14('0x173'),_0x166b13));};AGIVertices['prototype'][_0xbe14('0x174')]=function(_0x28bd09){logger['info'](util[_0xbe14('0x53')](_0xbe14('0x175'),_0x28bd09[_0xbe14('0x35')]));return this[_0xbe14('0xc')][_0xbe14('0x176')](_0x28bd09[_0xbe14('0x177')][_0xbe14('0x58')](/\s+/g,''),_0x28bd09['escape_digits']);};AGIVertices[_0xbe14('0x13')][_0xbe14('0x178')]=function(_0x148d0d){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x179'),_0x148d0d[_0xbe14('0x35')]));return this[_0xbe14('0xc')][_0xbe14('0x17a')](_0x148d0d[_0xbe14('0x17b')][_0xbe14('0x58')](/\s+/g,''),_0x148d0d[_0xbe14('0x16d')]);};AGIVertices[_0xbe14('0x13')][_0xbe14('0x17c')]=function(_0x16aade){logger[_0xbe14('0x2b')](util['format'](_0xbe14('0x17d'),_0x16aade[_0xbe14('0x35')]));return this['channel'][_0xbe14('0x17e')](_0x16aade[_0xbe14('0x5c')],_0x16aade[_0xbe14('0x16d')]);};AGIVertices[_0xbe14('0x13')]['sendMail']=function(_0x3b35f4){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x17f'),_0x3b35f4[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x3b35f4[_0xbe14('0x180')])){return this[_0xbe14('0xc')]['noop']('no\x20mail\x20account\x20configured');}var _0x292b46=this['getMailAccount']['sync'](this,_0x3b35f4[_0xbe14('0x180')]);if(!_0x292b46||!_0x292b46[_0xbe14('0x181')]){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x3b35f4,_0xbe14('0x182'));}var _0x550dc2={'from':util[_0xbe14('0x53')](_0xbe14('0x183'),_0x292b46[_0xbe14('0x11')],_0x292b46[_0xbe14('0x184')]||_0x292b46[_0xbe14('0x181')][_0xbe14('0x185')]),'to':_0x3b35f4['to']||'','cc':_0x3b35f4['cc']||'','bcc':_0x3b35f4[_0xbe14('0x186')]||'','subject':_0x3b35f4['subject'],'html':_0x3b35f4[_0xbe14('0x5c')],'text':_0x3b35f4[_0xbe14('0x5c')]};if(this[_0xbe14('0xa4')](_0x3b35f4['template_id'])){}logger[_0xbe14('0xd9')]('sendMail\x20message',JSON[_0xbe14('0x74')](_0x550dc2));this[_0xbe14('0x33')][_0xbe14('0xcf')](this,_0x3b35f4,_0x3b35f4['account_id']);this[_0xbe14('0xc')][_0xbe14('0xad')](util['format'](_0xbe14('0x187'),_0x292b46['name']));this['sendMailMessage'][_0xbe14('0xcf')](this,_0x292b46[_0xbe14('0x188')],_0x550dc2);return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0x189'));};AGIVertices[_0xbe14('0x13')][_0xbe14('0x18a')]=function(_0x9cf913){logger['info'](util[_0xbe14('0x53')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x9cf913[_0xbe14('0x35')]));return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0x18b'));};AGIVertices[_0xbe14('0x13')][_0xbe14('0x18c')]=function(_0x84680){logger['info'](util[_0xbe14('0x53')](_0xbe14('0x18d'),_0x84680[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x84680[_0xbe14('0x18e')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0x18f'));}var _0x31ba8f=this[_0xbe14('0x31')]['sync'](this,_0x84680[_0xbe14('0x18e')]);if(!_0x31ba8f){return this['channel']['error'](_0x84680,_0xbe14('0x190'));}var _0x4fc628={'body':_0x84680['sms_text'],'phone':_0x84680['to']||'','SmsAccountId':_0x31ba8f['id']};logger[_0xbe14('0xd9')](_0xbe14('0x191'),JSON[_0xbe14('0x74')](_0x4fc628));this['createSquareDetailsReport'][_0xbe14('0xcf')](this,_0x84680,_0x84680[_0xbe14('0x18e')]);this[_0xbe14('0xc')]['noop'](util[_0xbe14('0x53')](_0xbe14('0x192'),_0x31ba8f[_0xbe14('0x11')]));this[_0xbe14('0x32')][_0xbe14('0xcf')](this,_0x4fc628);return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0x193'));};AGIVertices[_0xbe14('0x13')][_0xbe14('0x194')]=function(_0x4389e0){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4389e0[_0xbe14('0x35')]));if(!this['isConfigured'](_0x4389e0[_0xbe14('0xd3')])){return this[_0xbe14('0xc')]['error'](_0x4389e0,_0xbe14('0x195'));}var _0x248f6e=this[_0xbe14('0xa1')][_0xbe14('0xcf')](this,_0x4389e0[_0xbe14('0xd3')]);if(!_0x248f6e){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x4389e0,_0xbe14('0xd5'));}return this['channel'][_0xbe14('0xa3')](_0x248f6e,_0x4389e0[_0xbe14('0x196')]);};AGIVertices['prototype'][_0xbe14('0x197')]=function(_0x11cc51){logger[_0xbe14('0x2b')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x11cc51[_0xbe14('0x35')]));this['channel'][_0xbe14('0xad')](_0xbe14('0x198'));var _0x1b35b7=this[_0xbe14('0xc')]['getVariable']('XMCS-UNIQUEID');if(!_['isEmpty'](_0x1b35b7['extra'])){this['channel'][_0xbe14('0x34')]=_0x1b35b7['extra'];}if(_0x11cc51[_0xbe14('0xb7')]===_0xbe14('0x199')){this[_0xbe14('0xc')][_0xbe14('0xad')]('Answer');return this['channel'][_0xbe14('0xb7')]();}return this['channel']['noop'](_0xbe14('0x19a'));};AGIVertices[_0xbe14('0x13')][_0xbe14('0x19b')]=function(_0x535de5){logger['info'](util[_0xbe14('0x53')](_0xbe14('0x19c'),_0x535de5[_0xbe14('0x35')]));if(!this['isConfigured'](_0x535de5[_0xbe14('0x19d')])){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x535de5,_0xbe14('0x19e'));}var _0xe1af62=this['getSquareProject'][_0xbe14('0xcf')](this,_0x535de5['project_id']);if(!this[_0xbe14('0xa4')](_0xe1af62)){return this['channel']['error'](_0x535de5,util['format'](_0xbe14('0x19f'),_0x535de5[_0xbe14('0x19d')]));}if(_0xe1af62===this[_0xbe14('0xc')]['arg_1']){return this[_0xbe14('0xc')]['error'](_0x535de5,_0xbe14('0x1a0'));}this['createSquareDetailsReport'][_0xbe14('0xcf')](this,_0x535de5,_0xe1af62);var _0x301db4=this[_0xbe14('0xc')][_0xbe14('0x56')](_0xbe14('0x1a1'),util[_0xbe14('0x53')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||_0xbe14('0x1a2'),_0xe1af62,this['channel']['arg_1']));if(_0x301db4[_0xbe14('0xa2')]===-0x1){return _0x301db4;}return this['channel'][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0xbe'),_0xbe14('0x1a1'),_0xe1af62));};AGIVertices[_0xbe14('0x13')]['system']=function(_0x296ced){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x296ced[_0xbe14('0x35')]));var _0x1ee2c2=this[_0xbe14('0x55')][_0xbe14('0xcf')](this,_0x296ced[_0xbe14('0x1a3')]);this[_0xbe14('0x33')][_0xbe14('0xcf')](this,_0x296ced,_0x296ced[_0xbe14('0x1a3')]);if(this['isConfigured'](_0x296ced[_0xbe14('0xd3')])){var _0x897ee1=this['getVariable']['sync'](this,_0x296ced[_0xbe14('0xd3')]);if(_0x897ee1){this[_0xbe14('0xc')][_0xbe14('0xa3')](_0x897ee1,_0x1ee2c2);return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x296ced['command'],_0x897ee1));}}return this[_0xbe14('0xc')]['noop'](util[_0xbe14('0x53')](_0xbe14('0x1a4'),_0x296ced[_0xbe14('0x1a3')]));};AGIVertices[_0xbe14('0x13')][_0xbe14('0x1a5')]=function(_0x1a057b){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x1a6'),_0x1a057b['label']));_0x1a057b[_0xbe14('0x5c')]=_0x1a057b[_0xbe14('0x5c')][_0xbe14('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbe14('0xa4')](_0x1a057b[_0xbe14('0x5a')])){return this[_0xbe14('0xc')][_0xbe14('0xad')](_0xbe14('0x1a7'));}if(!this['isConfigured'](_0x1a057b[_0xbe14('0x5c')])){return this[_0xbe14('0xc')]['noop'](_0xbe14('0xa8'));}this['channel'][_0xbe14('0xad')](util[_0xbe14('0x53')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1a057b[_0xbe14('0x5c')]));var _0x54debf=this['googleCloudTTS'][_0xbe14('0xcf')](this,_0x1a057b);if(_0x54debf){this[_0xbe14('0xc')]['noop'](util[_0xbe14('0x53')](_0xbe14('0x1a8'),_0x54debf));var _0x52e21f=this[_0xbe14('0xc')][_0xbe14('0xfb')](_0x54debf);try{fs[_0xbe14('0xfc')](_0x54debf+_0xbe14('0xfd'));}catch(_0x22d382){logger['error'](_0x22d382);}return _0x52e21f;}return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x1a057b,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbe14('0x13')]['tts']=function(_0x375ad6){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x375ad6[_0xbe14('0x35')]));_0x375ad6[_0xbe14('0x5c')]=_0x375ad6['text'][_0xbe14('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x375ad6[_0xbe14('0x5c')])){return this[_0xbe14('0xc')]['noop'](_0xbe14('0xa8'));}this[_0xbe14('0xc')][_0xbe14('0xad')](util['format'](_0xbe14('0x1a9'),_0x375ad6[_0xbe14('0x5c')]));var _0x1baa53=this['googleTTS']['sync'](this,_0x375ad6);if(_0x1baa53){this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')]('Google\x20TTS\x20%s\x20file\x20created',_0x1baa53));var _0x27c20e=this[_0xbe14('0xc')]['streamFile'](_0x1baa53);try{fs[_0xbe14('0xfc')](_0x1baa53+'.wav');}catch(_0x5af6c7){logger[_0xbe14('0x29')](_0x5af6c7);}return _0x27c20e;}return this['channel'][_0xbe14('0x29')](_0x375ad6,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xbe14('0x13')][_0xbe14('0x1aa')]=function(_0x204a86){logger['info'](util[_0xbe14('0x53')](_0xbe14('0x1ab'),_0x204a86[_0xbe14('0x35')]));if(!this['isConfigured'](_0x204a86[_0xbe14('0x14c')])){return this['channel'][_0xbe14('0x29')](_0x204a86,_0xbe14('0x15d'));}logger['info'](util[_0xbe14('0x53')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbe14('0xc')]['callerid'],_0x204a86['findBy']));var _0x184963=this['agentUnpause'][_0xbe14('0xcf')](this,_0x204a86['findBy']);if(_0x184963){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbe14('0xc')][_0xbe14('0x36')],_0x204a86[_0xbe14('0x14c')]));this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbe14('0xc')][_0xbe14('0x36')],_0x204a86[_0xbe14('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xbe14('0x2b')](util['format'](_0xbe14('0x14e'),this[_0xbe14('0xc')][_0xbe14('0x36')],_0x204a86[_0xbe14('0x14c')]));this[_0xbe14('0xc')]['noop'](util[_0xbe14('0x53')](_0xbe14('0x14e'),this[_0xbe14('0xc')][_0xbe14('0x36')],_0x204a86[_0xbe14('0x14c')]));return{'code':0xc8,'result':_0xbe14('0x14f')};}};AGIVertices[_0xbe14('0x13')]['voicemail']=function(_0x5ee130){logger['info'](util[_0xbe14('0x53')](_0xbe14('0x1ac'),_0x5ee130[_0xbe14('0x35')]));var _0x214a80=this[_0xbe14('0xc')][_0xbe14('0x56')](_0xbe14('0x1ad'),[_0x5ee130[_0xbe14('0x1ae')],_0x5ee130['options']]);if(_0x214a80[_0xbe14('0xa2')]===-0x1){return _0x214a80;}return this[_0xbe14('0xc')][_0xbe14('0xad')](util[_0xbe14('0x53')](_0xbe14('0xbe'),_0xbe14('0x1ad'),_0x5ee130['mailbox']));};AGIVertices[_0xbe14('0x13')][_0xbe14('0x1af')]=function(_0x564b31){logger[_0xbe14('0x2b')](util[_0xbe14('0x53')](_0xbe14('0x1b0'),_0x564b31[_0xbe14('0x35')]));if(!this[_0xbe14('0xa4')](_0x564b31[_0xbe14('0xd3')])){return this['channel']['error'](_0x564b31,_0xbe14('0x195'));}var _0x43bf1c=this[_0xbe14('0xa1')][_0xbe14('0xcf')](this,_0x564b31[_0xbe14('0xd3')]);if(!_0x43bf1c){return this[_0xbe14('0xc')][_0xbe14('0x29')](_0x564b31,_0xbe14('0xd5'));}var _0x262655=this[_0xbe14('0xc')][_0xbe14('0xa1')](_0x43bf1c);return{'code':0xc8,'result':_0x262655[_0xbe14('0x9f')]?_0x262655[_0xbe14('0x9f')]:'-'};};String['prototype'][_0xbe14('0x9e')]=function(_0x598fb2,_0x4c9caf){return this[_0xbe14('0x9d')](_0x598fb2)[_0xbe14('0x1b1')](_0x4c9caf);};module[_0xbe14('0x1b2')]=AGIVertices; \ No newline at end of file +var _0xb647=['providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','hiddendigitsnum','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','subject','template_id','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariableById','then','name','catch','prototype','getVoiceQueueById','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','googleCloudTTS','google_cloud_tts_text_type','text','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','headers','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','clone','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','getVariable','result','extra','maxRetry','createSquareDetailsReport','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s'];(function(_0x547fe3,_0x5bbc1a){var _0x5391b7=function(_0x2b0612){while(--_0x2b0612){_0x547fe3['push'](_0x547fe3['shift']());}};_0x5391b7(++_0x5bbc1a);}(_0xb647,0xdb));var _0x7b64=function(_0x4217dd,_0x2767d1){_0x4217dd=_0x4217dd-0x0;var _0x5a3ee7=_0xb647[_0x4217dd];return _0x5a3ee7;};'use strict';var fs=require('fs');var util=require(_0x7b64('0x0'));var _=require(_0x7b64('0x1'));var sh=require(_0x7b64('0x2'));var odbc=require(_0x7b64('0x3'))();var rs=require(_0x7b64('0x4'));var moment=require(_0x7b64('0x5'));var Mustache=require(_0x7b64('0x6'));var rp=require(_0x7b64('0x7'));var logger=require('../../config/logger')(_0x7b64('0x8'));var config=require('../../config/environment');var scripts=require(_0x7b64('0x9'));var FILES_PATH=_0x7b64('0xa');var recursiveMapAttributes=[_0x7b64('0xb'),_0x7b64('0xc')];var verticesWithRetry=[_0x7b64('0xd'),_0x7b64('0xe'),_0x7b64('0xf')];var AGIVertices=function(_0x2ff650,_0x432ced,_0x5784fb){this[_0x7b64('0x10')]=_0x2ff650;this['rpc']=_0x432ced;this[_0x7b64('0x11')]=_0x5784fb;};AGIVertices['prototype']['getVariable']=function(_0x35ed61,_0xa72761){this['rpc'][_0x7b64('0x12')](_0x35ed61)[_0x7b64('0x13')](function(_0xd9e5ca){_0xa72761(null,_0xd9e5ca?_0xd9e5ca[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x432626){_0xa72761(_0x432626);});};AGIVertices[_0x7b64('0x16')]['getVoiceQueue']=function(_0x212438,_0x56899c){this['rpc'][_0x7b64('0x17')](_0x212438)[_0x7b64('0x13')](function(_0x1d256d){_0x56899c(null,_0x1d256d?_0x1d256d[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x437ddc){_0x56899c(_0x437ddc);});};AGIVertices[_0x7b64('0x16')]['getSquareProject']=function(_0xca026a,_0x40066b){this[_0x7b64('0x18')][_0x7b64('0x19')](_0xca026a)[_0x7b64('0x13')](function(_0x4aa38d){_0x40066b(null,_0x4aa38d?_0x4aa38d[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x58517e){_0x40066b(_0x58517e);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1a')]=function(_0x5ef53f,_0x23845e){this[_0x7b64('0x18')][_0x7b64('0x1b')](_0x5ef53f)[_0x7b64('0x13')](function(_0x47cef5){_0x23845e(null,_0x47cef5?_0x47cef5[_0x7b64('0x1c')]:![]);})[_0x7b64('0x15')](function(_0x4a7549){_0x23845e(_0x4a7549);});};AGIVertices[_0x7b64('0x16')]['getUser']=function(_0x2d2d9a,_0x587da6){this[_0x7b64('0x18')][_0x7b64('0x1d')](_0x2d2d9a)[_0x7b64('0x13')](function(_0x379e90){_0x587da6(null,_0x379e90?_0x379e90[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x215ea9){_0x587da6(_0x215ea9);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1e')]=function(_0x78a6d1,_0xec557c){this[_0x7b64('0x18')][_0x7b64('0x1f')](_0x78a6d1)[_0x7b64('0x13')](function(_0x50d06c){_0xec557c(null,_0x50d06c?_0x50d06c[_0x7b64('0x14')]:![]);})['catch'](function(_0x1580d0){_0xec557c(_0x1580d0);});};AGIVertices[_0x7b64('0x16')]['getSound']=function(_0x5acdb3,_0x38738c){var _0x1e1ba7=this;this[_0x7b64('0x18')][_0x7b64('0x20')](_0x5acdb3)[_0x7b64('0x13')](function(_0x3c9fad){_0x38738c(null,_0x3c9fad?_0x1e1ba7[_0x7b64('0x21')](_0x3c9fad[_0x7b64('0x22')]):![]);})['catch'](function(_0x1616c9){_0x38738c(_0x1616c9);});};AGIVertices[_0x7b64('0x16')]['getMailAccount']=function(_0x6b1d0,_0x2bcefa){this[_0x7b64('0x18')][_0x7b64('0x23')](_0x6b1d0)[_0x7b64('0x13')](function(_0x38a059){_0x2bcefa(null,_0x38a059?_0x38a059:![]);})['catch'](function(_0x5bf639){_0x2bcefa(_0x5bf639);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x24')]=function(_0x49e402,_0x508c6d,_0x345664){this['mailRpc'][_0x7b64('0x24')](_0x49e402,_0x508c6d)['then'](function(){_0x345664(null);})['catch'](function(_0x5a80b2){_0x345664(_0x5a80b2);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x25')]=function(_0x120a84,_0x58ffdb){this[_0x7b64('0x18')]['getIntervalById'](_0x120a84)[_0x7b64('0x13')](function(_0x7e1083){if(_0x7e1083){if(_0x7e1083[_0x7b64('0x26')]){_0x58ffdb(null,[_0x7e1083[_0x7b64('0x27')]]);}else{_0x58ffdb(null,_[_0x7b64('0x28')](_0x7e1083['Intervals'],_0x7b64('0x27')));}}else{_0x58ffdb(null,![]);}})[_0x7b64('0x15')](function(_0x2d0e9){_0x58ffdb(_0x2d0e9);});};AGIVertices[_0x7b64('0x16')]['getSoundPath']=function(_0x1855c5){return util[_0x7b64('0x29')](_0x7b64('0x2a'),FILES_PATH,_0x1855c5);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x2b')]=function(_0x27e008,_0x1c0be6,_0x526389){odbc['open'](_0x27e008,function(_0xe9eac){if(_0xe9eac){logger[_0x7b64('0x2c')](_0x7b64('0x2d'),_0xe9eac);_0x526389(_0xe9eac);}else{logger[_0x7b64('0x2e')](_0x7b64('0x2f'));odbc[_0x7b64('0x30')](_0x1c0be6,function(_0x36c606,_0x3c3d77){if(_0x36c606){logger[_0x7b64('0x2e')]('Error\x20executing\x20query\x20%s',_0x1c0be6);_0x526389(_0x36c606);}else{logger[_0x7b64('0x2e')](_0x7b64('0x31'),_0x1c0be6);odbc[_0x7b64('0x32')](function(_0x40787f){if(_0x40787f){logger[_0x7b64('0x2c')](_0x7b64('0x33'),_0x40787f);}_0x526389(null,_0x3c3d77);});}});}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x34')]=function(_0x3c4467,_0x47012c){this[_0x7b64('0x18')][_0x7b64('0x35')](_0x3c4467)[_0x7b64('0x13')](function(_0x36cfce){_0x47012c(null,_0x36cfce?_0x36cfce:![]);})[_0x7b64('0x15')](function(_0x42cc06){_0x47012c(_0x42cc06);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x36')]=function(_0x8739ec,_0x355e8a){this['rpc'][_0x7b64('0x36')](_0x8739ec)[_0x7b64('0x13')](function(_0x163580){_0x355e8a(null,_0x163580);})['catch'](function(_0x11abbc){_0x355e8a(_0x11abbc);});};AGIVertices[_0x7b64('0x16')]['createSquareDetailsReport']=function(_0x216c58,_0xf0d4a1,_0x54d7d2){this[_0x7b64('0x18')]['createSquareDetailsReport']({'uniqueid':this[_0x7b64('0x10')][_0x7b64('0x37')],'node':_0x216c58[_0x7b64('0x38')],'application':_0x216c58['agicommand'],'data':_0xf0d4a1||null,'project_name':this[_0x7b64('0x10')][_0x7b64('0x39')],'callerid':this[_0x7b64('0x10')][_0x7b64('0x3a')]})[_0x7b64('0x13')](function(_0x284e1a){if(_0x54d7d2){_0x54d7d2(null,_0x284e1a);}})['catch'](function(_0x20accc){if(_0x54d7d2){_0x54d7d2(_0x20accc);}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x3b')]=function(_0x1dd7a9,_0xdcca4e,_0x54e89a,_0x531354){this['rpc']['createSquareRecording']({'uniqueid':this[_0x7b64('0x10')][_0x7b64('0x37')],'callerid':this[_0x7b64('0x10')][_0x7b64('0x3a')],'calleridname':this[_0x7b64('0x10')][_0x7b64('0x3c')],'context':this[_0x7b64('0x10')][_0x7b64('0x3d')],'extension':this[_0x7b64('0x10')][_0x7b64('0x3e')],'priority':this[_0x7b64('0x10')][_0x7b64('0x3f')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x7b64('0x10')][_0x7b64('0x40')],'projectName':this[_0x7b64('0x10')][_0x7b64('0x39')],'saveName':_0xdcca4e,'filename':_0x1dd7a9[_0x7b64('0x41')]||_0xdcca4e,'savePath':_0x54e89a})['then'](function(_0x3e5321){_0x531354(null,_0x3e5321);})[_0x7b64('0x15')](function(_0x476890){_0x531354(_0x476890);});};AGIVertices['prototype'][_0x7b64('0x42')]=function(_0x214a45,_0x27c9f9,_0x64b24a,_0x18c5b0,_0x572713){this[_0x7b64('0x18')][_0x7b64('0x42')]({'uniqueid':this['channel'][_0x7b64('0x37')],'body':_0x214a45,'direction':_0x27c9f9,'providerName':_0x64b24a,'providerResponse':_0x18c5b0})[_0x7b64('0x13')](function(_0x5ed33c){if(_0x572713){_0x572713(null,_0x5ed33c);}})[_0x7b64('0x15')](function(_0x2c6d00){if(_0x572713){_0x572713(_0x2c6d00);}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x43')]=function(_0x383190,_0x79cbc9){this[_0x7b64('0x18')][_0x7b64('0x43')]({'firstName':_[_0x7b64('0x44')](_0x383190[_0x7b64('0x14')])||_[_0x7b64('0x45')](_0x383190[_0x7b64('0x14')])?_0x7b64('0x46')+Math[_0x7b64('0x47')]():_0x383190[_0x7b64('0x14')],'lastName':_[_0x7b64('0x44')](_0x383190[_0x7b64('0x48')])||_[_0x7b64('0x45')](_0x383190['lastName'])?null:_0x383190[_0x7b64('0x48')],'phone':_0x383190['phone'],'ListId':_0x383190[_0x7b64('0x49')],'scheduledat':_0x383190[_0x7b64('0x4a')],'callbackUniqueid':this[_0x7b64('0x10')]['uniqueid'],'tags':'callback','description':_0x7b64('0x4b')+_0x383190['scheduledAt']['toString'](),'priority':_0x383190[_0x7b64('0x4c')]})[_0x7b64('0x13')](function(_0x1e1cd3){_0x79cbc9(null,_0x1e1cd3);})['catch'](function(_0x1fd98a){_0x79cbc9(_0x1fd98a);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4d')]=function(_0x32ba5d,_0x3724a7){this['rpc']['getPauseById'](_0x32ba5d)[_0x7b64('0x13')](function(_0xe47998){_0x3724a7(null,_0xe47998?_0xe47998[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x59df96){_0x3724a7(_0x59df96);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4e')]=function(_0x18ef41,_0x1049da,_0x4999c3){var _0x463433={'role':'agent'};_0x463433[_0x18ef41]=this[_0x7b64('0x10')]['callerid'];this['rpc']['agentPause'](_0x463433,_0x1049da,this['channel'][_0x7b64('0x37')])[_0x7b64('0x13')](function(_0x5c9a7e){_0x4999c3(null,_[_0x7b64('0x45')](_0x5c9a7e)?![]:!![]);})[_0x7b64('0x15')](function(_0x3dd757){logger['error'](_0x3dd757);_0x4999c3(null,![]);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4f')]=function(_0x5e6f02,_0x51b944){var _0x1c2bdf={'role':'agent'};_0x1c2bdf[_0x5e6f02]=this['channel'][_0x7b64('0x3a')];this[_0x7b64('0x18')]['agentUnpause'](_0x1c2bdf)['then'](function(_0x28002e){_0x51b944(null,_[_0x7b64('0x45')](_0x28002e)?![]:!![]);})['catch'](function(_0x86ddde){logger['error'](_0x86ddde);_0x51b944(null,![]);});};AGIVertices[_0x7b64('0x16')]['agentLogout']=function(_0x117d52,_0x293e73){var _0x2ad554={'role':_0x7b64('0x50')};_0x2ad554[_0x117d52]=this[_0x7b64('0x10')]['callerid'];this[_0x7b64('0x18')][_0x7b64('0x51')](_0x2ad554)[_0x7b64('0x13')](function(_0x201d1b){_0x293e73(null,_['isNil'](_0x201d1b)?![]:!![]);})[_0x7b64('0x15')](function(_0x323c06){logger[_0x7b64('0x2c')](_0x323c06);_0x293e73(null,![]);});};AGIVertices['prototype'][_0x7b64('0x52')]=function(_0x4e7764,_0x1996f9){var _0x2dc0ea={'role':'agent'};_0x2dc0ea[_0x4e7764]=this['channel'][_0x7b64('0x3a')];var _0x5f1706=_0x4e7764!=_0x7b64('0x53')?util[_0x7b64('0x29')](_0x7b64('0x54'),_0x7b64('0x55'),this[_0x7b64('0x10')][_0x7b64('0x3a')]):undefined;this[_0x7b64('0x18')][_0x7b64('0x52')](_0x2dc0ea,_0x5f1706)['then'](function(_0x37239c){_0x1996f9(null,_[_0x7b64('0x45')](_0x37239c)?![]:!![]);})['catch'](function(_0x5f127c){logger[_0x7b64('0x2c')](_0x5f127c);_0x1996f9(null,![]);});};AGIVertices[_0x7b64('0x16')]['shellCommand']=function(_0x17f511,_0x2a7d8a){sh['exec'](_[_0x7b64('0x56')](_0x17f511),function(_0xb02c35,_0x4962bf){var _0x47c76e=_0x4962bf['replace'](/(\r\n|\n|\r)/gm,'');_0x2a7d8a(null,_0x47c76e);});};AGIVertices[_0x7b64('0x16')]['googleCloudTTS']=function(_0x1c170e,_0x12bf8a){scripts[_0x7b64('0x57')](_0x1c170e['apiKey'],_0x1c170e[_0x7b64('0x58')]||_0x7b64('0x59'),_0x1c170e[_0x7b64('0x59')],_0x1c170e['languageCode']||'en-US',_0x1c170e[_0x7b64('0x5a')]||_0x7b64('0x5b'),_0x1c170e['audioEncoding']||_0x7b64('0x5c'))[_0x7b64('0x13')](function(_0x47b3bc){_0x12bf8a(null,_0x47b3bc);})[_0x7b64('0x15')](function(_0x2e92a5){_0x12bf8a(_0x2e92a5);});};AGIVertices['prototype'][_0x7b64('0x5d')]=function(_0x8941d9,_0x2e7053){scripts[_0x7b64('0x5d')](_0x8941d9[_0x7b64('0x59')],_0x8941d9[_0x7b64('0x5e')]||'en',0x1)['then'](function(_0x4ac9b9){_0x2e7053(null,_0x4ac9b9);})[_0x7b64('0x15')](function(_0x622a7f){_0x2e7053(_0x622a7f);});};AGIVertices['prototype'][_0x7b64('0x5f')]=function(_0x13e09a,_0x26d94d){var _0x511816={'uri':_0x13e09a[_0x7b64('0x60')],'method':_0x13e09a[_0x7b64('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x13e09a['timeout'])===_0x7b64('0x62')&&parseInt(_0x13e09a['timeout'])>=0x1?parseInt(_0x13e09a[_0x7b64('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x7b64('0x64'),_0x7b64('0x65')],_0x511816['method'][_0x7b64('0x66')]())){try{_0x511816['body']=_0x13e09a[_0x7b64('0xc')]?JSON[_0x7b64('0x67')](_0x13e09a['rawBody']):{};}catch(_0x433ec0){logger[_0x7b64('0x2c')](_0x7b64('0x68'),_0x433ec0);}}try{_0x511816['headers']=_0x13e09a[_0x7b64('0xb')]?JSON['parse'](_0x13e09a['rawHeaders']):{};}catch(_0x4c9a99){logger[_0x7b64('0x2c')](_0x7b64('0x69'),_0x4c9a99);}if(_0x13e09a[_0x7b64('0x6a')]){try{var _0x648cbc=require(_0x13e09a[_0x7b64('0x6a')])['sync'](this,_0x511816);_0x511816['uri']=Mustache[_0x7b64('0x6b')](_0x13e09a[_0x7b64('0x60')],_0x648cbc,{},['$$','$$']);if(_0x511816[_0x7b64('0x6c')]){_0x511816[_0x7b64('0x6c')]=JSON[_0x7b64('0x67')](Mustache['render'](JSON[_0x7b64('0x6d')](_0x511816['headers']),_0x648cbc,{},['$$','$$']));}if(_0x511816[_0x7b64('0x6e')]){_0x511816[_0x7b64('0x6e')]=JSON[_0x7b64('0x67')](Mustache['render'](JSON[_0x7b64('0x6d')](_0x511816['body']),_0x648cbc,{},['$$','$$']));}}catch(_0x36e460){logger[_0x7b64('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x36e460);}}rp(_0x511816)[_0x7b64('0x13')](function(_0x2d0dbd){var _0x360a6b={'statusCode':_0x2d0dbd[_0x7b64('0x6f')]||0xc8,'statusMessage':_0x2d0dbd[_0x7b64('0x70')]||'OK','headers':_0x2d0dbd[_0x7b64('0x6c')]||{},'body':_0x2d0dbd[_0x7b64('0x6e')]||{}};_0x26d94d(null,_0x360a6b);})['catch'](function(_0x41819b){var _0x5d75ae={'statusCode':_0x41819b[_0x7b64('0x6f')]||0x1f4,'statusMessage':_0x41819b[_0x7b64('0x71')]||_0x7b64('0x72'),'headers':_0x41819b[_0x7b64('0x73')][_0x7b64('0x6c')]||{},'body':_0x41819b[_0x7b64('0x73')][_0x7b64('0x6e')]||{}};_0x26d94d(null,_0x5d75ae);});};AGIVertices['prototype']['googleDialogflow']=function(_0x1cadbf,_0x1aeeec){scripts[_0x7b64('0x74')](this[_0x7b64('0x10')][_0x7b64('0x37')],_0x1cadbf[_0x7b64('0x75')],_0x1cadbf[_0x7b64('0x59')],_0x1cadbf[_0x7b64('0x76')]||'en')[_0x7b64('0x13')](function(_0x502b8a){_0x1aeeec(null,_0x502b8a);})[_0x7b64('0x15')](function(_0x1b4cf8){_0x1aeeec(_0x1b4cf8);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x77')]=function(_0x5c1e4f,_0x212723){scripts[_0x7b64('0x77')](this[_0x7b64('0x10')]['uniqueid'],_0x5c1e4f[_0x7b64('0x78')],_0x5c1e4f[_0x7b64('0x79')],_0x5c1e4f['private_key'],_0x5c1e4f[_0x7b64('0x59')],_0x5c1e4f[_0x7b64('0x7a')]||'en')[_0x7b64('0x13')](function(_0x3cf3e4){_0x212723(null,_0x3cf3e4);})[_0x7b64('0x15')](function(_0x4dbb60){_0x212723(_0x4dbb60);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x7b')]=function(_0x58fb41,_0x4627e4){scripts[_0x7b64('0x7b')](this[_0x7b64('0x10')],_0x58fb41)[_0x7b64('0x13')](function(_0x5e2e1b){_0x4627e4(null,_0x5e2e1b);})[_0x7b64('0x15')](function(_0x14dfc1){_0x4627e4(_0x14dfc1);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x7c')]=function(_0x1180b2,_0x217a13){scripts[_0x7b64('0x7c')](_0x1180b2[_0x7b64('0x75')],_0x1180b2['text'],_0x1180b2[_0x7b64('0x7d')]||_0x7b64('0x7e'),_0x1180b2[_0x7b64('0x7f')])[_0x7b64('0x13')](function(_0x533ce1){_0x217a13(null,_0x533ce1);})[_0x7b64('0x15')](function(_0x4efbc2){_0x217a13(_0x4efbc2);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x80')]=function(_0x35fbce,_0x556031,_0x59d017){scripts[_0x7b64('0x80')](_0x556031,_0x35fbce[_0x7b64('0x75')],_0x35fbce[_0x7b64('0x81')]||_0x7b64('0x7e'),this[_0x7b64('0x82')](_0x35fbce[_0x7b64('0x83')])?_0x35fbce['model']:undefined)[_0x7b64('0x13')](function(_0x503a65){_0x59d017(null,_0x503a65);})[_0x7b64('0x15')](function(_0x5d8cea){_0x59d017(_0x5d8cea);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x84')]=function(_0xb5cae6,_0xb3d6e9){scripts['awsPolly'](_0xb5cae6[_0x7b64('0x85')],_0xb5cae6[_0x7b64('0x86')],_0xb5cae6[_0x7b64('0x87')],_0xb5cae6[_0x7b64('0x88')]||_0x7b64('0x89'),_0xb5cae6[_0x7b64('0x59')],_0xb5cae6[_0x7b64('0x8a')]||_0x7b64('0x59'))[_0x7b64('0x13')](function(_0x40d118){_0xb3d6e9(null,_0x40d118);})[_0x7b64('0x15')](function(_0x4d089c){_0xb3d6e9(_0x4d089c);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x8b')]=function(_0x411eb1,_0x41269d){scripts[_0x7b64('0x8b')](this[_0x7b64('0x10')][_0x7b64('0x37')],_0x411eb1['aws_access_key_id'],_0x411eb1[_0x7b64('0x86')],_0x411eb1[_0x7b64('0x8c')],_0x411eb1[_0x7b64('0x59')],_0x411eb1[_0x7b64('0x8d')])[_0x7b64('0x13')](function(_0x3e06da){_0x41269d(null,_0x3e06da);})['catch'](function(_0x453ca8){_0x41269d(_0x453ca8);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x8e')]=function(_0x268c57,_0x3c96c9,_0x170321){scripts[_0x7b64('0x8e')](_0x3c96c9,_0x268c57['key'],_0x268c57[_0x7b64('0x8f')]||_0x7b64('0x7e'))[_0x7b64('0x13')](function(_0x4e8350){_0x170321(null,_0x4e8350);})[_0x7b64('0x15')](function(_0x1c0861){_0x170321(_0x1c0861);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x90')]=function(_0x32533b,_0x1363c2,_0x369d6d){scripts['tildeASR'](_0x1363c2,_0x32533b[_0x7b64('0x91')],_0x32533b['appsecret'],_0x32533b[_0x7b64('0x92')])[_0x7b64('0x13')](function(_0x1012d7){_0x369d6d(null,_0x1012d7);})[_0x7b64('0x15')](function(_0xa66a6a){_0x369d6d(_0xa66a6a);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x93')]=function(_0x54790a){var _0x385691=_['includes'](verticesWithRetry,_0x54790a['agicommand'])?_0x54790a:_[_0x7b64('0x94')](_0x54790a);for(var _0x119cf2 in _0x385691){if(_0x385691['hasOwnProperty'](_0x119cf2)){if(_0x385691[_0x119cf2]&&_[_0x7b64('0x95')](_0x385691[_0x119cf2])){if(_[_0x7b64('0x96')](recursiveMapAttributes,_0x119cf2)){_0x385691[_0x119cf2]=this[_0x7b64('0x97')](_0x385691[_0x119cf2]);}else{_0x385691[_0x119cf2]=this[_0x7b64('0x98')](_0x385691[_0x119cf2]);}}}}return _0x385691;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x99')]=function(_0x46c88c){for(var _0x2b8547 in _0x46c88c){if(_0x46c88c[_0x7b64('0x9a')](_0x2b8547)){if(_['isPlainObject'](_0x46c88c[_0x2b8547])){this[_0x7b64('0x99')](_0x46c88c[_0x2b8547]);}else if(_[_0x7b64('0x9b')](_0x46c88c[_0x2b8547])){for(var _0x563e09=0x0;_0x563e09<_0x46c88c[_0x2b8547][_0x7b64('0x9c')];_0x563e09++){this['recursiveNodeIndex'](_0x46c88c[_0x2b8547][_0x563e09]);}}else if(_[_0x7b64('0x95')](_0x46c88c[_0x2b8547])){_0x46c88c[_0x2b8547]=this['replaceAllVariables'](_0x46c88c[_0x2b8547]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0xabb851,_0x1d6d27){for(var _0x370cda in _0xabb851){if(_0xabb851[_0x7b64('0x9a')](_0x370cda)){if(_[_0x7b64('0x9d')](_0xabb851[_0x370cda])){if(!_['isEmpty'](_0xabb851[_0x370cda])){this[_0x7b64('0x9e')](_0xabb851[_0x370cda],util['format'](_0x7b64('0x9f'),_0x1d6d27,_0x370cda));}}else if(_[_0x7b64('0x9b')](_0xabb851[_0x370cda])){for(var _0x1480b0=0x0;_0x1480b0<_0xabb851[_0x370cda]['length'];_0x1480b0++){this[_0x7b64('0x9e')](_0xabb851[_0x370cda][_0x1480b0],util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x1d6d27,_0x370cda+'['+_0x1480b0+']'));}}else{if(!_[_0x7b64('0x45')](_0xabb851[_0x370cda])){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x1d6d27,_0x370cda),_0xabb851[_0x370cda]);}}}}};AGIVertices[_0x7b64('0x16')]['replaceObjectAllVariables']=function(_0x41e506){try{var _0x1761a9=JSON[_0x7b64('0x67')](_0x41e506);this['recursiveNodeIndex'](_0x1761a9);return JSON['stringify'](_0x1761a9);}catch(_0x40c378){return this[_0x7b64('0x98')](_0x41e506);}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x98')]=function(_0x8bc40f){var _0x5d06ce=_0x8bc40f[_0x7b64('0xa1')]('{');for(var _0x21c02e=0x1;_0x21c02e<_0x5d06ce[_0x7b64('0x9c')];_0x21c02e+=0x1){var _0x5c2b0f=_0x5d06ce[_0x21c02e][_0x7b64('0xa1')]('}');if(_0x5c2b0f[_0x7b64('0x9c')]>0x1){_0x8bc40f=_0x8bc40f[_0x7b64('0xa2')]('{'+_0x5c2b0f[0x0]+'}',this[_0x7b64('0x10')]['getVariable'](_0x5c2b0f[0x0])['extra']||_0x5c2b0f[0x0]);}}if(_0x5d06ce[_0x7b64('0x9c')]===0x1){return _0x8bc40f[_0x7b64('0xa3')]();}return this[_0x7b64('0x98')](_0x8bc40f);};AGIVertices['prototype']['getAndSetVariable']=function(_0x160708,_0x4d1a8b){var _0x5a0575=this[_0x7b64('0x10')][_0x7b64('0xa4')](_0x160708);if(_0x5a0575[_0x7b64('0xa5')]===-0x1){return _0x5a0575;}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4d1a8b,_0x5a0575[_0x7b64('0xa6')]));return this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x4d1a8b,_0x5a0575[_0x7b64('0xa6')]);};AGIVertices[_0x7b64('0x16')]['isConfigured']=function(_0x381c1a){return _0x381c1a&&_0x381c1a!=='0'&&_0x381c1a!=='-1'&&_0x381c1a!=='';};AGIVertices[_0x7b64('0x16')][_0x7b64('0xa7')]=function(_0x71f120){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x71f120,'-');_0x71f120[_0x7b64('0xaa')]=_0x71f120[_0x7b64('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7b64('0x16')][_0x7b64('0xab')]=function(_0x39bc65){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xac'),_0x39bc65['label']));if(!this[_0x7b64('0x82')](_0x39bc65[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}var _0x108d1a='\x22'+_0x39bc65[_0x7b64('0x59')]+'\x22';if(this[_0x7b64('0x82')](_0x39bc65[_0x7b64('0x73')])){_0x108d1a+=','+_0x39bc65[_0x7b64('0x73')];}var _0x1a4e3b=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb0'),_0x108d1a);if(_0x1a4e3b[_0x7b64('0xa5')]===-0x1){return _0x1a4e3b;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xb1'),_0x108d1a));};AGIVertices[_0x7b64('0x16')]['mrcprecog']=function(_0x57153f){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xb2'),_0x57153f[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x57153f['grammar'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0x548847=_0x57153f[_0x7b64('0xb4')];if(this[_0x7b64('0x82')](_0x57153f[_0x7b64('0x73')])){_0x548847+=','+_0x57153f[_0x7b64('0x73')];}var _0x4f4fe8=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb5'),_0x548847);if(_0x4f4fe8[_0x7b64('0xa5')]===-0x1){return _0x4f4fe8;}var _0x438ea3=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xb8'));if(_0x438ea3[_0x7b64('0xa5')]===-0x1){return _0x438ea3;}var _0x1e1568=this[_0x7b64('0xb6')](_0x7b64('0xb9'),'MRCP_RECOG_TRANSCRIPT');if(_0x1e1568[_0x7b64('0xa5')]===-0x1){return _0x1e1568;}var _0x4c0c6c=this[_0x7b64('0xb6')](_0x7b64('0xba'),'MRCP_RECOG_INSTANCE');if(_0x4c0c6c[_0x7b64('0xa5')]===-0x1){return _0x4c0c6c;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x548847));};AGIVertices[_0x7b64('0x16')]['agi']=function(_0x49f84e){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x49f84e[_0x7b64('0x38')]));return this[_0x7b64('0x10')]['agi']([_0x49f84e['command'],_0x49f84e['args']]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0xbb')]=function(_0x23b248){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0xbc'),_0x23b248['label']));if(this[_0x7b64('0x82')](_0x23b248['timeout'])){logger['info'](util['format'](_0x7b64('0xbd'),_0x23b248[_0x7b64('0x63')]));var _0x9a093=this[_0x7b64('0x10')][_0x7b64('0xbe')](_0x23b248[_0x7b64('0x63')]);if(_0x9a093[_0x7b64('0xa5')]===-0x1){return _0x9a093;}}return this['channel'][_0x7b64('0xbb')]();};AGIVertices[_0x7b64('0x16')][_0x7b64('0xbf')]=function(_0x4a5159){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xc0'),_0x4a5159[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0x49')])){return this[_0x7b64('0x10')]['error'](_0x4a5159,'no\x20list\x20selected');}_0x4a5159[_0x7b64('0x4a')]=moment();if(this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0xc1')])){_0x4a5159[_0x7b64('0x4a')]=moment()[_0x7b64('0xc2')](_0x4a5159['delay'],_0x7b64('0xc3'));}if(!this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0x4c')])){_0x4a5159['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x4a5159);return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xc4'),_0x4a5159['phone'],_0x4a5159['list_id'],_0x4a5159[_0x7b64('0x4a')]));};AGIVertices['prototype']['custom_app']=function(_0x33f819){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xc5'),_0x33f819[_0x7b64('0x38')]));var _0x2bcdb8=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x33f819[_0x7b64('0xc6')],_0x33f819[_0x7b64('0x73')]);if(_0x2bcdb8['result']===-0x1){return _0x2bcdb8;}return this['channel'][_0x7b64('0xad')](util['format'](_0x7b64('0xc7'),_0x33f819['application'],_0x33f819['options']));};AGIVertices[_0x7b64('0x16')]['lumenvoxtts']=function(_0x14f871){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xc8'),_0x14f871[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x14f871['text'])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xae'));}var _0x5e4226='\x22'+_0x14f871['text']+'\x22';if(this[_0x7b64('0x82')](_0x14f871['options'])){_0x5e4226+=','+_0x14f871['options'];}var _0x3b7409=this['channel']['exec'](_0x7b64('0xb0'),_0x5e4226);if(_0x3b7409[_0x7b64('0xa5')]===-0x1){return _0x3b7409;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xb1'),_0x5e4226));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xc9')]=function(_0x1e9710){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xca'),_0x1e9710[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x1e9710['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}var _0xdf5026='\x22'+_0x1e9710['text']+'\x22';if(this[_0x7b64('0x82')](_0x1e9710[_0x7b64('0x73')])){_0xdf5026+=','+_0x1e9710[_0x7b64('0x73')];}var _0x44c450=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb0'),_0xdf5026);if(_0x44c450[_0x7b64('0xa5')]===-0x1){return _0x44c450;}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0xdf5026));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xcb')]=function(_0x539aec){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x539aec[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x539aec[_0x7b64('0xb4')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0xbc6155=_0x539aec['grammar'];if(this[_0x7b64('0x82')](_0x539aec['options'])){_0xbc6155+=','+_0x539aec['options'];}var _0xb94da1=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb5'),_0xbc6155);if(_0xb94da1[_0x7b64('0xa5')]===-0x1){return _0xb94da1;}var _0x7fc3e4=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xcc'));if(_0x7fc3e4[_0x7b64('0xa5')]===-0x1){return _0x7fc3e4;}var _0x48efbc=this['getAndSetVariable'](_0x7b64('0xb9'),_0x7b64('0xcd'));if(_0x48efbc[_0x7b64('0xa5')]===-0x1){return _0x48efbc;}var _0x5633bf=this[_0x7b64('0xb6')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x5633bf[_0x7b64('0xa5')]===-0x1){return _0x5633bf;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xce'),_0xbc6155));};AGIVertices['prototype'][_0x7b64('0xcf')]=function(_0x3f8728){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xd0'),_0x3f8728[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x3f8728[_0x7b64('0xb4')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0x5e1aa9=_0x3f8728['grammar'];if(this['isConfigured'](_0x3f8728[_0x7b64('0x73')])){_0x5e1aa9+=','+_0x3f8728[_0x7b64('0x73')];}var _0x1fa92a=this[_0x7b64('0x10')][_0x7b64('0xaf')]('MRCPRecog',_0x5e1aa9);if(_0x1fa92a[_0x7b64('0xa5')]===-0x1){return _0x1fa92a;}var _0x5948fa=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xd1'));if(_0x5948fa['result']===-0x1){return _0x5948fa;}var _0x2ab919=this[_0x7b64('0xb6')](_0x7b64('0xb9'),_0x7b64('0xd2'));if(_0x2ab919[_0x7b64('0xa5')]===-0x1){return _0x2ab919;}var _0x41a860=this['getAndSetVariable'](_0x7b64('0xba'),'SESTEK_ASR_INSTANCE');if(_0x41a860[_0x7b64('0xa5')]===-0x1){return _0x41a860;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xce'),_0x5e1aa9));};AGIVertices['prototype'][_0x7b64('0xd3')]=function(_0x5648f4){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xd4'),_0x5648f4[_0x7b64('0x38')]));if(!this['isConfigured'](_0x5648f4[_0x7b64('0xd5')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xd6'));}var _0x2b4570=this['getSquareOdbc'][_0x7b64('0xa9')](this,_0x5648f4[_0x7b64('0xd5')]);if(!_0x2b4570){return this[_0x7b64('0x10')]['error'](_0x5648f4,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x5648f4[_0x7b64('0x30')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xd7'));}var _0x5eddd8=_0x5648f4['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0xd8'),_0x5eddd8));var _0x3455e2=this[_0x7b64('0x2b')][_0x7b64('0xa9')](this,_0x2b4570,_0x5eddd8);this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x5648f4,_0x5eddd8);if(!this[_0x7b64('0x82')](_0x5648f4[_0x7b64('0xd9')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xda'));}var _0x48c575=this['getVariable'][_0x7b64('0xa9')](this,_0x5648f4['variable_id']);if(!_0x48c575){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xdb'));}var _0x16b023=this;_0x3455e2[_0x7b64('0xdc')](function(_0x5b7091,_0x5c2235){Object[_0x7b64('0xdd')](_0x5b7091)[_0x7b64('0xdc')](function(_0x53fd8c){_0x16b023[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0xde'),_0x48c575,_0x5c2235,_0x53fd8c),_0x5b7091[_0x53fd8c]);});});this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('%s_ROWS_COUNT',_0x48c575),_0x3455e2[_0x7b64('0x9c')]);return this['channel']['noop'](util[_0x7b64('0x29')](_0x7b64('0xdf'),_0x48c575));};AGIVertices['prototype']['dial']=function(_0xc9fe3f){logger[_0x7b64('0xe0')](util[_0x7b64('0x29')](_0x7b64('0xe1'),_0xc9fe3f[_0x7b64('0x38')]));if(!this['isConfigured'](_0xc9fe3f[_0x7b64('0xe2')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0xc9fe3f,_0x7b64('0xe3'));}var _0x32d040=this[_0x7b64('0xe4')][_0x7b64('0xa9')](this,_0xc9fe3f[_0x7b64('0xe2')]);if(!_0x32d040){return this[_0x7b64('0x10')]['error'](_0xc9fe3f,'no\x20user\x20found');}var _0x52c8b8=this[_0x7b64('0x10')]['exec'](_0x7b64('0xe5'),[util[_0x7b64('0x29')](_0x7b64('0xe6'),_0x32d040),_0xc9fe3f[_0x7b64('0x63')],_0xc9fe3f[_0x7b64('0xe7')],_0xc9fe3f['url']]);if(_0x52c8b8[_0x7b64('0xa5')]===-0x1){return _0x52c8b8;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xe8'),'DIAL'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xe9')]=function(_0x8fc78a){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xea'),_0x8fc78a[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x8fc78a[_0x7b64('0x75')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xeb'));}if(!this[_0x7b64('0x82')](_0x8fc78a[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this['createSquareDetailsReport'](_0x8fc78a);this[_0x7b64('0x42')](_0x8fc78a[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0xed'),_0x8fc78a['text']));var _0x4a7a44=this['googleDialogflow']['sync'](this,_0x8fc78a);if(_0x4a7a44){for(var _0x2e46a3 in _0x4a7a44){if(_0x4a7a44['hasOwnProperty'](_0x2e46a3)){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0xee'),_0x2e46a3[_0x7b64('0x66')]()),_0x4a7a44[_0x2e46a3]);}}this[_0x7b64('0x42')](_0x4a7a44[_0x7b64('0xef')],'out',_0x7b64('0xe9'),'');return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xf0'),_0x4a7a44['speech']));}return this['channel']['error'](_0x8fc78a,_0x7b64('0xf1'));};AGIVertices['prototype'][_0x7b64('0xf2')]=function(_0x4f76d7){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xf3'),_0x4f76d7[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4f76d7['dialogflowV2_project_id'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf4'));}if(!this[_0x7b64('0x82')](_0x4f76d7[_0x7b64('0x79')])){return this['channel']['noop'](_0x7b64('0xf5'));}if(!this['isConfigured'](_0x4f76d7[_0x7b64('0xf6')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf7'));}if(!this[_0x7b64('0x82')](_0x4f76d7[_0x7b64('0x7a')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf8'));}if(!this[_0x7b64('0x82')](_0x4f76d7['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this[_0x7b64('0xa8')](_0x4f76d7);this[_0x7b64('0x42')](_0x4f76d7['text'],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xf9'),_0x4f76d7[_0x7b64('0x59')]));var _0x165312=this['googleDialogflowV2'][_0x7b64('0xa9')](this,_0x4f76d7);if(_0x165312){for(var _0x148356 in _0x165312){if(_0x165312[_0x7b64('0x9a')](_0x148356)){if(_0x148356!==_0x7b64('0xfa')){this['channel']['setVariable'](util[_0x7b64('0x29')]('DIALOGFLOW_%s',_0x148356['toUpperCase']()),_0x165312[_0x148356]);}}}this[_0x7b64('0x42')](_0x165312['speech'],_0x7b64('0xfb'),'dialogflowV2',_0x165312[_0x7b64('0xfa')]);return this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0xfc'),_0x165312[_0x7b64('0xef')]));}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4f76d7,_0x7b64('0xfd'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xfe')]=function(_0x2ae65){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x2ae65['label']));if(!this[_0x7b64('0x82')](_0x2ae65['ndauth_url'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xff'));}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x100')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x101'));}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x102')])){return this['channel'][_0x7b64('0xad')]('no\x20password\x20configured');}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x103')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this['createSquareDetailsReport'](_0x2ae65);this[_0x7b64('0x42')](_0x2ae65[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Trying\x20SestekNDA:\x20%s',_0x2ae65[_0x7b64('0x59')]));var _0x4383c7=this['sestekNDA'][_0x7b64('0xa9')](this,_0x2ae65);if(_0x4383c7){for(var _0x308483 in _0x4383c7){if(_0x4383c7[_0x7b64('0x9a')](_0x308483)){this[_0x7b64('0x10')][_0x7b64('0xa0')](util['format']('SESTEK_NDA_%s',_0x308483[_0x7b64('0x66')]()),_0x4383c7[_0x308483]);}}this[_0x7b64('0x42')](_0x4383c7[_0x7b64('0xef')],'out',_0x7b64('0xfe'),'');if(_0x4383c7['audiofile']){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x104'),_0x4383c7[_0x7b64('0x105')]));var _0x59b911=this[_0x7b64('0x10')]['streamFile'](_0x4383c7[_0x7b64('0x105')]);try{fs[_0x7b64('0x106')](_0x4383c7[_0x7b64('0x105')]+_0x7b64('0x107'));}catch(_0xecfee2){logger[_0x7b64('0x2c')](_0xecfee2);}return _0x59b911;}else{return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x108'),_0x4383c7['speech']));}}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x2ae65,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x7b64('0x16')]['end']=function(_0x5089c1){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x109'),_0x5089c1[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x10a'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x10b')]=function(_0x4a2250){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4a2250['label']));var _0x54d2a2='';if(_0x4a2250['trunk_id']){if(!this['isConfigured'](_0x4a2250[_0x7b64('0x10c')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10d'));}else{var _0x166b40=parseInt(_0x4a2250[_0x7b64('0x10c')],0xa);if(isNaN(_0x166b40)){_0x54d2a2=_0x4a2250['trunk_id'];}else{_0x54d2a2=this[_0x7b64('0x1e')]['sync'](this,_0x4a2250[_0x7b64('0x10c')]);if(!_0x54d2a2){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10e'));}}}}else if(_0x4a2250['trunk_name']){_0x54d2a2=_0x4a2250[_0x7b64('0x10f')];}else{return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10d'));}var _0x155146=this[_0x7b64('0x10')][_0x7b64('0xaf')]('DIAL',[util[_0x7b64('0x29')](_0x7b64('0x110'),_0x54d2a2,_0x4a2250['phone']),_0x4a2250[_0x7b64('0x63')],_0x4a2250[_0x7b64('0xe7')],_0x4a2250[_0x7b64('0x60')]]);if(_0x155146[_0x7b64('0xa5')]===-0x1){return _0x155146;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xe8'),_0x7b64('0xe5')));};AGIVertices[_0x7b64('0x16')]['finally']=function(_0x491c5a){logger[_0x7b64('0x2e')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x491c5a[_0x7b64('0x38')]));return this['channel'][_0x7b64('0xad')](_0x7b64('0x111'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xe')]=function(_0x12274f){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x112'),_0x12274f['label']));if(_0x12274f[_0x7b64('0xaa')]===0x0){return this[_0x7b64('0xa7')](_0x12274f);}_0x12274f[_0x7b64('0xaa')]-=0x1;if(!this[_0x7b64('0x82')](_0x12274f[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x12274f,_0x7b64('0x114'));}var _0x3a1911=this['getSound']['sync'](this,_0x12274f[_0x7b64('0x113')]);if(!_0x3a1911){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x12274f,_0x7b64('0x115'));}if(!this[_0x7b64('0x82')](_0x12274f[_0x7b64('0xd9')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7b64('0xda'));}var _0x104b5e=this[_0x7b64('0x10')][_0x7b64('0x116')](_0x3a1911,_0x12274f[_0x7b64('0x117')],_0x12274f['maxdigit']);var _0x132d2a=_0x104b5e[_0x7b64('0xa5')]?_0x104b5e[_0x7b64('0xa5')][_0x7b64('0xa3')]():'';logger[_0x7b64('0x2e')](_0x7b64('0x118'),JSON[_0x7b64('0x6d')](_0x104b5e));if(_0x104b5e['result']===-0x1){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,_0x132d2a);return _0x104b5e;}else if(_0x104b5e[_0x7b64('0xa6')]===_0x7b64('0x63')){_0x104b5e[_0x7b64('0xa5')]=_0x132d2a['length']>=parseInt(_0x12274f[_0x7b64('0x119')])?'x':'i';}else{_0x104b5e['result']=_0x132d2a[_0x7b64('0x9c')]>=parseInt(_0x12274f[_0x7b64('0x119')])&&_0x132d2a['length']<=parseInt(_0x12274f['maxdigit'])?'x':'i';}var _0x5c92dd=this['getVariable'][_0x7b64('0xa9')](this,_0x12274f[_0x7b64('0xd9')]);if(!_0x5c92dd){return this['channel'][_0x7b64('0x2c')](_0x12274f,_0x7b64('0xdb'));}this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x5c92dd,_0x132d2a);if(this[_0x7b64('0x82')](_0x12274f[_0x7b64('0x11a')])){var _0x14690d=parseInt(_0x12274f[_0x7b64('0x11a')],0xa);var _0xebdeda=rs['generate']({'charset':'*','length':_0x14690d});var _0x29cab3=_0x132d2a[_0x7b64('0x9c')];if(_0x29cab3>0x0){if(_0x29cab3>_0x14690d){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,_0x12274f['hiddendigitspos']==='first'?_0xebdeda+_0x132d2a[_0x7b64('0x11b')](_0x14690d):_0x132d2a['substr'](0x0,_0x29cab3-_0x14690d)+_0xebdeda);}else{this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x12274f,rs[_0x7b64('0x11c')]({'charset':'*','length':_0x29cab3}));}}else{this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,'');}}else{this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x12274f,_0x132d2a);}return _0x104b5e;};AGIVertices[_0x7b64('0x16')]['getsecretdigits']=function(_0x535aba){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x11d'),_0x535aba[_0x7b64('0x38')]));return this[_0x7b64('0xe')](_0x535aba);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x11e')]=function(_0x4e5824){logger[_0x7b64('0x2e')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4e5824[_0x7b64('0x38')]));this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x4e5824,_0x4e5824[_0x7b64('0x11f')]);return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x120'),_0x4e5824[_0x7b64('0x11f')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x121')]=function(_0x19cb0d){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x122'),_0x19cb0d['label']));if(!this[_0x7b64('0x82')](_0x19cb0d[_0x7b64('0x85')])||!this['isConfigured'](_0x19cb0d[_0x7b64('0x86')])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7b64('0x82')](_0x19cb0d[_0x7b64('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x123'),_0x19cb0d['text']));var _0x5eb4b2=this[_0x7b64('0x84')][_0x7b64('0xa9')](this,_0x19cb0d);if(_0x5eb4b2){this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x5eb4b2));var _0x4a6a20=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x5eb4b2);try{fs[_0x7b64('0x106')](_0x5eb4b2+_0x7b64('0x107'));}catch(_0x479ffb){logger['error'](_0x479ffb);}return _0x4a6a20;}return this['channel'][_0x7b64('0x2c')](_0x19cb0d,_0x7b64('0x125'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x126')]=function(_0x6bd02f){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x127'),_0x6bd02f[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x6bd02f['aws_access_key_id'])||!this['isConfigured'](_0x6bd02f[_0x7b64('0x86')])){return this['channel']['noop'](_0x7b64('0x128'));}if(!this['isConfigured'](_0x6bd02f[_0x7b64('0x8d')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x129'));}if(!this['isConfigured'](_0x6bd02f[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this[_0x7b64('0xa8')](_0x6bd02f);this['createSquareMessage'](_0x6bd02f[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x12a'),_0x6bd02f['text']));var _0x533940=this[_0x7b64('0x8b')][_0x7b64('0xa9')](this,_0x6bd02f);if(_0x533940){for(var _0x40e194 in _0x533940){if(_0x533940['hasOwnProperty'](_0x40e194)&&_[_0x7b64('0x95')](_0x533940[_0x40e194])){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x12b'),_0x40e194['toUpperCase']()),_0x533940[_0x40e194]);}}if(_['isNil'](_0x533940[_0x7b64('0x71')])){return this[_0x7b64('0x10')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x7b64('0x42')](_0x533940[_0x7b64('0x71')],_0x7b64('0xfb'),'amazonlex','');return this[_0x7b64('0x10')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x533940[_0x7b64('0x71')]));}}return this[_0x7b64('0x10')]['error'](_0x6bd02f,_0x7b64('0x12c'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x12d')]=function(_0x134981){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x134981[_0x7b64('0x38')],_0x134981[_0x7b64('0x63')]));if(!this['isConfigured'](_0x134981['key'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20key\x20configured');}var _0x4d8d69=_0x7b64('0x12e');var _0x2ce963=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1eed06=util['format'](_0x7b64('0x9f'),_0x2ce963,_0x4d8d69);var _0x32b3b6=!![];if(_0x134981[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x32b3b6=![];}var _0x33dfe3=this['channel'][_0x7b64('0x131')](_0x2ce963,_0x4d8d69,_0x134981[_0x7b64('0x132')],_0x134981[_0x7b64('0x63')],undefined,_0x32b3b6);if(_0x33dfe3[_0x7b64('0xa5')]!==-0x1){this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x133'),_0x1eed06));var _0x2e6d30=this[_0x7b64('0x8e')]['sync'](this,_0x134981,_0x1eed06);if(_0x2e6d30){for(var _0x5a3e3b in _0x2e6d30){if(_0x2e6d30[_0x7b64('0x9a')](_0x5a3e3b)){this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('GOOGLE_ASR_%s',_0x5a3e3b[_0x7b64('0x66')]()),_0x2e6d30[_0x5a3e3b]);}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x134'),JSON[_0x7b64('0x6d')](_0x2e6d30)));}}return _0x33dfe3;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x135')]=function(_0x1b0a69){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x136'),_0x1b0a69['label']));if(!this[_0x7b64('0x82')](_0x1b0a69[_0x7b64('0x91')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x137'));}if(!this[_0x7b64('0x82')](_0x1b0a69[_0x7b64('0x138')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x139'));}var _0x342a12=_0x7b64('0x12e');var _0x4916dc=util[_0x7b64('0x29')](_0x7b64('0x13a'),FILES_PATH,rs[_0x7b64('0x11c')](0x4));var _0x36ab58=util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x4916dc,_0x342a12);var _0x4f9da6=!![];if(_0x1b0a69[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x4f9da6=![];}var _0x120a65=this[_0x7b64('0x10')][_0x7b64('0x131')](_0x4916dc,_0x342a12,_0x1b0a69[_0x7b64('0x132')],_0x1b0a69[_0x7b64('0x63')],undefined,_0x4f9da6);if(_0x120a65[_0x7b64('0xa5')]!==-0x1){this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x13b'),_0x36ab58));var _0x2e8f75=this[_0x7b64('0x90')][_0x7b64('0xa9')](this,_0x1b0a69,_0x36ab58);if(_0x2e8f75){for(var _0x21b575 in _0x2e8f75){if(_0x2e8f75['hasOwnProperty'](_0x21b575)){this['channel'][_0x7b64('0xa0')](util['format'](_0x7b64('0x13c'),_0x21b575[_0x7b64('0x66')]()),_0x2e8f75[_0x21b575]);}}return this['channel']['noop'](util[_0x7b64('0x29')](_0x7b64('0x13d'),JSON[_0x7b64('0x6d')](_0x2e8f75)));}}return _0x120a65;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x13e')]=function(_0x1d65da){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x13f'),_0x1d65da[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0x140')](_0x1d65da[_0x7b64('0x3d')],_0x1d65da[_0x7b64('0x3e')],_0x1d65da[_0x7b64('0x3f')]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x141')]=function(_0x4341ed){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x142'),_0x4341ed[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4341ed[_0x7b64('0x143')])){return this[_0x7b64('0x10')]['error'](_0x4341ed,_0x7b64('0x144'));}try{var _0x5181f0=eval(_0x4341ed['condition'])?'true':'false';this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4341ed['condition'],_0x5181f0));return{'code':0xc8,'result':_0x5181f0};}catch(_0x5d22fd){return{'code':0xc8,'result':_0x7b64('0x145')};}};AGIVertices[_0x7b64('0x16')]['gotoiftime']=function(_0x4ad1a8){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x146'),_0x4ad1a8[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4ad1a8[_0x7b64('0x147')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4ad1a8,_0x7b64('0x148'));}var _0x137900=this[_0x7b64('0x25')][_0x7b64('0xa9')](this,_0x4ad1a8[_0x7b64('0x147')]);if(!_0x137900){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4ad1a8,'no\x20intervals\x20found');}for(var _0x45516b=0x0;_0x45516b<_0x137900[_0x7b64('0x9c')];_0x45516b+=0x1){var _0x2331a4=this[_0x7b64('0x10')][_0x7b64('0xa4')](util['format'](_0x7b64('0x149'),_0x137900[_0x45516b]));if(_0x2331a4[_0x7b64('0xa5')]===-0x1){return _0x2331a4;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x137900[_0x45516b],_0x2331a4[_0x7b64('0xa6')]));if(_0x2331a4[_0x7b64('0xa6')]===_0x7b64('0x14a')){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x14a')));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x14a')));return{'code':0xc8,'result':_0x7b64('0x14a')};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],'false'));this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x145')));}}return{'code':0xc8,'result':_0x7b64('0x145')};};AGIVertices[_0x7b64('0x16')][_0x7b64('0x14c')]=function(_0x58aa62){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14d'),_0x58aa62['label']));return this['channel']['hangup']();};AGIVertices[_0x7b64('0x16')][_0x7b64('0x14e')]=function(_0x4ee634){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14f'),_0x4ee634[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4ee634[_0x7b64('0x75')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xeb'));}var _0x2a13f9=_0x7b64('0x12e');var _0x21752f=util[_0x7b64('0x29')](_0x7b64('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x31dcd2=util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x21752f,_0x2a13f9);var _0x44e0ae=!![];if(_0x4ee634[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x44e0ae=![];}var _0x28ab50=this[_0x7b64('0x10')][_0x7b64('0x131')](_0x21752f,_0x2a13f9,_0x4ee634[_0x7b64('0x132')],_0x4ee634[_0x7b64('0x63')],undefined,_0x44e0ae);if(_0x28ab50[_0x7b64('0xa5')]!==-0x1){this['channel']['noop'](util['format'](_0x7b64('0x150'),_0x31dcd2));var _0x1340e6=this[_0x7b64('0x80')][_0x7b64('0xa9')](this,_0x4ee634,_0x31dcd2);if(_0x1340e6){for(var _0x5134f3 in _0x1340e6){if(_0x1340e6[_0x7b64('0x9a')](_0x5134f3)){this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('ISPEECH_ASR_%s',_0x5134f3[_0x7b64('0x66')]()),_0x1340e6[_0x5134f3]);}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x7b64('0x6d')](_0x1340e6)));}}return _0x28ab50;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x151')]=function(_0x19c83a){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x152'),_0x19c83a[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x19c83a[_0x7b64('0x75')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xeb'));}if(!this['isConfigured'](_0x19c83a[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x153'),_0x19c83a[_0x7b64('0x59')]));var _0x1f7e21=this[_0x7b64('0x7c')][_0x7b64('0xa9')](this,_0x19c83a);if(_0x1f7e21){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('ispeech\x20%s\x20file\x20created',_0x1f7e21));var _0x36ec06=this['channel'][_0x7b64('0x124')](_0x1f7e21,_0x19c83a['intKey']);try{fs[_0x7b64('0x106')](_0x1f7e21+'.wav');}catch(_0x1fb44b){logger['error'](_0x1fb44b);}return _0x36ec06;}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x19c83a,_0x7b64('0x154'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x155')]=function(_0x32cb74){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x156'),_0x32cb74[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x32cb74['findBy'])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x32cb74,'no\x20find\x20by\x20configured');}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')]['callerid'],_0x32cb74[_0x7b64('0x158')]));var _0xa3c52=this[_0x7b64('0x52')][_0x7b64('0xa9')](this,_0x32cb74['findBy']);if(_0xa3c52){logger['info'](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74['findBy']));this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x15d')]=function(_0x44146d){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15e'),_0x44146d[_0x7b64('0x38')]));if(!this['isConfigured'](_0x44146d[_0x7b64('0x158')])){return this[_0x7b64('0x10')]['error'](_0x44146d,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d[_0x7b64('0x158')]));var _0x237891=this[_0x7b64('0x51')][_0x7b64('0xa9')](this,_0x44146d['findBy']);if(_0x237891){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')]['callerid'],_0x44146d[_0x7b64('0x158')]));this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d['findBy']));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger['info'](util[_0x7b64('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7b64('0x10')]['callerid'],_0x44146d['findBy']));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x160')]=function(_0x560152){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x560152['label']));if(!this[_0x7b64('0x82')](_0x560152[_0x7b64('0x161')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x560152,'no\x20operation\x20configured');}this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x162'),_0x560152[_0x7b64('0x161')]));var _0x517a79=eval(_0x560152[_0x7b64('0x161')]);if(!this[_0x7b64('0x82')](_0x560152[_0x7b64('0xd9')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xda'));}var _0xdb98f3=this['getVariable'][_0x7b64('0xa9')](this,_0x560152[_0x7b64('0xd9')]);if(!_0xdb98f3){return this['channel'][_0x7b64('0x2c')](_0x560152,_0x7b64('0xdb'));}if(_[_0x7b64('0x9b')](_0x517a79)){var _0x54ff27=this;_0x517a79[_0x7b64('0xdc')](function(_0x4dfed7,_0x325235){_0x54ff27['channel'][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x163'),_0xdb98f3,_0x325235),_0x4dfed7);});return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x164'),_0xdb98f3));}else{return this[_0x7b64('0x10')][_0x7b64('0xa0')](_0xdb98f3,_0x517a79);}};AGIVertices[_0x7b64('0x16')][_0x7b64('0xd')]=function(_0x40d0cc){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x165'),_0x40d0cc[_0x7b64('0x38')]));if(_0x40d0cc[_0x7b64('0xaa')]===0x0){return this[_0x7b64('0xa7')](_0x40d0cc);}_0x40d0cc[_0x7b64('0xaa')]-=0x1;if(!this['isConfigured'](_0x40d0cc[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x40d0cc,_0x7b64('0x114'));}var _0x35aa14=this[_0x7b64('0x166')][_0x7b64('0xa9')](this,_0x40d0cc[_0x7b64('0x113')]);if(!_0x35aa14){return this['channel'][_0x7b64('0x2c')](_0x40d0cc,'no\x20file\x20audio\x20found');}var _0x82915b=this[_0x7b64('0x10')][_0x7b64('0x116')](_0x35aa14,_0x40d0cc[_0x7b64('0x117')],_0x40d0cc[_0x7b64('0x167')]);var _0xe51ed8=_0x82915b['result'];if(_0x82915b[_0x7b64('0xa5')]===-0x1){this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x40d0cc,'-1');return _0x82915b;}else if(_0x82915b['extra']===_0x7b64('0x63')){_0x82915b[_0x7b64('0xa5')]=_0x82915b[_0x7b64('0xa5')][_0x7b64('0x9c')]>0x0?_0x82915b[_0x7b64('0xa5')]:'t';}else if(_[_0x7b64('0x44')](_0x82915b[_0x7b64('0xa5')])){_0x82915b[_0x7b64('0xa5')]='#';_0xe51ed8='#';}if(!this[_0x7b64('0x82')](_0x40d0cc['variable_id'])){this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x43a841=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x40d0cc[_0x7b64('0xd9')]);if(!_0x43a841){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x40d0cc,_0x7b64('0xdb'));}this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x43a841,_0xe51ed8);}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x40d0cc,_0xe51ed8);return _0x82915b;};AGIVertices[_0x7b64('0x16')]['noop']=function(_0x360e5e){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x360e5e[_0x7b64('0x38')]));return this[_0x7b64('0x10')]['noop'](_0x360e5e[_0x7b64('0x168')]||_0x360e5e[_0x7b64('0x38')]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x169')]=function(_0x3b0d67){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x16a'),_0x3b0d67[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x3b0d67['findBy'])){return this[_0x7b64('0x10')]['error'](_0x3b0d67,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')]['callerid'],_0x3b0d67['findBy']));var _0x453cc6=this[_0x7b64('0x4d')]['sync'](this,_0x3b0d67[_0x7b64('0x16b')]);var _0x406309=this[_0x7b64('0x4e')][_0x7b64('0xa9')](this,_0x3b0d67[_0x7b64('0x158')],_0x453cc6);if(_0x406309){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this['channel'][_0x7b64('0x3a')],_0x3b0d67['findBy']));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x16c')]=function(_0x3f32ff){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3f32ff['label']));if(!this[_0x7b64('0x82')](_0x3f32ff[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3f32ff,_0x7b64('0x114'));}var _0x2031b7=this[_0x7b64('0x166')][_0x7b64('0xa9')](this,_0x3f32ff[_0x7b64('0x113')]);if(!_0x2031b7){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3f32ff,_0x7b64('0x115'));}var _0x521030=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0x16d'),[_0x2031b7,_0x3f32ff[_0x7b64('0xe7')]]);if(_0x521030['result']===-0x1){return _0x521030;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x2031b7));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x16e')]=function(_0x845e8d){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x16f'),_0x845e8d[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x845e8d[_0x7b64('0x170')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x845e8d,_0x7b64('0x171'));}var _0x3f18dd='';var _0x393591=parseInt(_0x845e8d['queue_id'],0xa);if(isNaN(_0x393591)){_0x3f18dd=_0x845e8d[_0x7b64('0x170')];}else{_0x3f18dd=this[_0x7b64('0x172')]['sync'](this,_0x845e8d[_0x7b64('0x170')]);if(!_0x3f18dd){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x845e8d,_0x7b64('0x173'));}}var _0x1437a7='';if(this[_0x7b64('0x82')](_0x845e8d[_0x7b64('0x113')])){var _0x376a55=this[_0x7b64('0x166')]['sync'](this,_0x845e8d[_0x7b64('0x113')]);if(_0x376a55){_0x1437a7=_0x376a55;}}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x845e8d,_0x3f18dd);if(_0x845e8d[_0x7b64('0xe7')][_0x7b64('0x174')]('x')<0x0){_0x845e8d[_0x7b64('0xe7')]+='x';}if(_0x845e8d[_0x7b64('0xe7')][_0x7b64('0x174')]('X')<0x0){_0x845e8d[_0x7b64('0xe7')]+='X';}this[_0x7b64('0x10')][_0x7b64('0xa0')]('XMCS-QUEUE',_0x3f18dd?_0x3f18dd[_0x7b64('0x175')]():'');var _0x1b7471=this[_0x7b64('0x10')]['exec'](_0x7b64('0x176'),[_0x3f18dd,_0x845e8d[_0x7b64('0xe7')],_0x845e8d[_0x7b64('0x60')],_0x1437a7,_0x845e8d[_0x7b64('0x63')],_0x845e8d[_0x7b64('0x8')],_0x845e8d[_0x7b64('0x177')],_0x845e8d[_0x7b64('0x178')],'',_0x845e8d[_0x7b64('0x179')]]);if(_0x1b7471[_0x7b64('0xa5')]===-0x1){return _0x1b7471;}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s',_0x7b64('0x176'),_0x3f18dd));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x17a')]=function(_0x4943e1){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4943e1['label']));var _0x408f5c=_0x4943e1[_0x7b64('0x17b')]||_0x7b64('0x12e');var _0x5d17e8=util[_0x7b64('0x29')](_0x7b64('0x17c'),this[_0x7b64('0x10')][_0x7b64('0x37')],rs[_0x7b64('0x11c')](0x5));var _0xfab296=util[_0x7b64('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x5d17e8,_0x408f5c);var _0x698637=util[_0x7b64('0x29')]('%s/recordings/%s',FILES_PATH,_0x5d17e8);this[_0x7b64('0x3b')]['sync'](this,_0x4943e1,_0x5d17e8,_0xfab296);this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x7b64('0x17d'),_0x5d17e8);logger[_0x7b64('0x2e')](_0x7b64('0x17e'),_0x698637,_0x408f5c,_0x4943e1[_0x7b64('0x17f')],_0x4943e1['timeout']);return this[_0x7b64('0x10')][_0x7b64('0x131')](_0x698637,_0x408f5c,_0x4943e1['escape_digits'],_0x4943e1[_0x7b64('0x63')],undefined,!![]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x180')]=function(_0x1e9b5b){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x181'),_0x1e9b5b[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x1e9b5b['url'])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x182'));}var _0x3cd531=this['restAPI'][_0x7b64('0xa9')](this,_0x1e9b5b);logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x183'),util[_0x7b64('0x184')](_0x3cd531,{'showHidden':![],'depth':null})));if(!this[_0x7b64('0x82')](_0x1e9b5b[_0x7b64('0xd9')])){return this['channel'][_0x7b64('0xad')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5a7fcb=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x1e9b5b['variable_id']);if(!_0x5a7fcb){return this[_0x7b64('0x10')]['error'](_0x1e9b5b,_0x7b64('0xdb'));}this['channel']['setVariable'](util[_0x7b64('0x29')](_0x7b64('0x185'),_0x5a7fcb),_0x3cd531['statusCode']?_0x3cd531['statusCode']:_0x7b64('0x186'));this[_0x7b64('0x10')][_0x7b64('0xa0')](util['format'](_0x7b64('0x187'),_0x5a7fcb),_0x3cd531[_0x7b64('0x70')]?_0x3cd531[_0x7b64('0x70')]:'OK');if(_0x3cd531[_0x7b64('0x6e')]){try{this[_0x7b64('0x9e')](_0x3cd531[_0x7b64('0x6e')],_0x5a7fcb);}catch(_0x4f0f42){logger[_0x7b64('0x2c')](util[_0x7b64('0x29')](_0x7b64('0x188'),_0x5a7fcb));}}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xdf'),_0x5a7fcb));};AGIVertices[_0x7b64('0x16')]['saydigits']=function(_0x48db34){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x189'),_0x48db34[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0x18a')](_0x48db34[_0x7b64('0x18b')][_0x7b64('0x18c')](/\s+/g,''),_0x48db34['escape_digits']);};AGIVertices[_0x7b64('0x16')]['saynumber']=function(_0x3b8844){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x18d'),_0x3b8844['label']));return this[_0x7b64('0x10')][_0x7b64('0x18e')](_0x3b8844[_0x7b64('0x62')][_0x7b64('0x18c')](/\s+/g,''),_0x3b8844['escape_digits']);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x18f')]=function(_0x1ad60b){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x190'),_0x1ad60b['label']));return this[_0x7b64('0x10')][_0x7b64('0x191')](_0x1ad60b['text'],_0x1ad60b[_0x7b64('0x17f')]);};AGIVertices['prototype']['sendMail']=function(_0x380903){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x192'),_0x380903[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x380903[_0x7b64('0x193')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x194'));}var _0x971ca9=this[_0x7b64('0x195')]['sync'](this,_0x380903[_0x7b64('0x193')]);if(!_0x971ca9||!_0x971ca9[_0x7b64('0x196')]){return this['channel'][_0x7b64('0x2c')](_0x380903,_0x7b64('0x197'));}var _0x22aa57={'from':util[_0x7b64('0x29')](_0x7b64('0x198'),_0x971ca9[_0x7b64('0x14')],_0x971ca9['email']||_0x971ca9[_0x7b64('0x196')][_0x7b64('0x199')]),'to':_0x380903['to']||'','cc':_0x380903['cc']||'','bcc':_0x380903['bcc']||'','subject':_0x380903[_0x7b64('0x19a')],'html':_0x380903[_0x7b64('0x59')],'text':_0x380903[_0x7b64('0x59')]};if(this[_0x7b64('0x82')](_0x380903[_0x7b64('0x19b')])){}logger['debug'](_0x7b64('0x19c'),JSON[_0x7b64('0x6d')](_0x22aa57));this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x380903,_0x380903[_0x7b64('0x193')]);this[_0x7b64('0x10')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x971ca9[_0x7b64('0x14')]));this['sendMailMessage'][_0x7b64('0xa9')](this,_0x971ca9[_0x7b64('0x19d')],_0x22aa57);return this[_0x7b64('0x10')]['noop'](_0x7b64('0x19e'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x19f')]=function(_0x5b9df1){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1a0'),_0x5b9df1[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0xad')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1a1')]=function(_0xc953c2){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1a2'),_0xc953c2['label']));if(!this[_0x7b64('0x82')](_0xc953c2[_0x7b64('0x1a3')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x1a4'));}var _0xf3729f=this[_0x7b64('0x34')][_0x7b64('0xa9')](this,_0xc953c2['sms_account_id']);if(!_0xf3729f){return this['channel'][_0x7b64('0x2c')](_0xc953c2,_0x7b64('0x1a5'));}var _0xb68e0b={'body':_0xc953c2[_0x7b64('0x1a6')],'phone':_0xc953c2['to']||'','SmsAccountId':_0xf3729f['id']};logger['debug'](_0x7b64('0x1a7'),JSON[_0x7b64('0x6d')](_0xb68e0b));this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0xc953c2,_0xc953c2[_0x7b64('0x1a3')]);this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1a8'),_0xf3729f[_0x7b64('0x14')]));this[_0x7b64('0x36')][_0x7b64('0xa9')](this,_0xb68e0b);return this[_0x7b64('0x10')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x7b64('0x1a9')]=function(_0xb1e261){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1aa'),_0xb1e261['label']));if(!this['isConfigured'](_0xb1e261[_0x7b64('0xd9')])){return this['channel']['error'](_0xb1e261,_0x7b64('0x1ab'));}var _0x316ecd=this['getVariable'][_0x7b64('0xa9')](this,_0xb1e261[_0x7b64('0xd9')]);if(!_0x316ecd){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0xb1e261,_0x7b64('0xdb'));}return this[_0x7b64('0x10')]['setVariable'](_0x316ecd,_0xb1e261['variable_value']);};AGIVertices[_0x7b64('0x16')]['start']=function(_0x2441d7){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1ac'),_0x2441d7[_0x7b64('0x38')]));this['channel'][_0x7b64('0xad')](_0x7b64('0x1ad'));var _0x5d4e46=this['channel'][_0x7b64('0xa4')](_0x7b64('0x1ae'));if(!_[_0x7b64('0x44')](_0x5d4e46[_0x7b64('0xa6')])){this['channel'][_0x7b64('0x37')]=_0x5d4e46[_0x7b64('0xa6')];}if(_0x2441d7['answer']==='yes'){this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x1af'));return this[_0x7b64('0x10')]['answer']();}return this['channel'][_0x7b64('0xad')](_0x7b64('0x1b0'));};AGIVertices[_0x7b64('0x16')]['subproject']=function(_0x7d47c8){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x1b1'),_0x7d47c8[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x7d47c8[_0x7b64('0x1b2')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7d47c8,_0x7b64('0x1b3'));}var _0x3dce90=this[_0x7b64('0x1b4')][_0x7b64('0xa9')](this,_0x7d47c8['project_id']);if(!this['isConfigured'](_0x3dce90)){return this['channel'][_0x7b64('0x2c')](_0x7d47c8,util[_0x7b64('0x29')](_0x7b64('0x1b5'),_0x7d47c8['project_id']));}if(_0x3dce90===this['channel'][_0x7b64('0x39')]){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7d47c8,_0x7b64('0x1b6'));}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x7d47c8,_0x3dce90);var _0x15a1e2=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0x1b7'),util[_0x7b64('0x29')](_0x7b64('0x1b8'),config['agi'][_0x7b64('0x1b9')]||_0x7b64('0x1ba'),_0x3dce90,this[_0x7b64('0x10')]['arg_1']));if(_0x15a1e2[_0x7b64('0xa5')]===-0x1){return _0x15a1e2;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s',_0x7b64('0x1b7'),_0x3dce90));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1bb')]=function(_0x9ab405){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1bc'),_0x9ab405['label']));var _0x4d7d11=this[_0x7b64('0x1bd')][_0x7b64('0xa9')](this,_0x9ab405[_0x7b64('0x1be')]);this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x9ab405,_0x9ab405[_0x7b64('0x1be')]);if(this[_0x7b64('0x82')](_0x9ab405[_0x7b64('0xd9')])){var _0x2ce64f=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x9ab405['variable_id']);if(_0x2ce64f){this['channel'][_0x7b64('0xa0')](_0x2ce64f,_0x4d7d11);return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1bf'),_0x9ab405[_0x7b64('0x1be')],_0x2ce64f));}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x9ab405[_0x7b64('0x1be')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1c0')]=function(_0x3d7cd0){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3d7cd0[_0x7b64('0x38')]));_0x3d7cd0['text']=_0x3d7cd0[_0x7b64('0x59')][_0x7b64('0x18c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3d7cd0[_0x7b64('0x1c1')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x1c2'));}if(!this['isConfigured'](_0x3d7cd0['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1c3'),_0x3d7cd0[_0x7b64('0x59')]));var _0x490e67=this['googleCloudTTS']['sync'](this,_0x3d7cd0);if(_0x490e67){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1c4'),_0x490e67));var _0x308d80=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x490e67);try{fs['unlink'](_0x490e67+'.wav');}catch(_0x31d4f8){logger[_0x7b64('0x2c')](_0x31d4f8);}return _0x308d80;}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3d7cd0,_0x7b64('0x1c5'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1c6')]=function(_0x5abe72){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1c7'),_0x5abe72[_0x7b64('0x38')]));_0x5abe72[_0x7b64('0x59')]=_0x5abe72[_0x7b64('0x59')][_0x7b64('0x18c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5abe72[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this['channel'][_0x7b64('0xad')](util['format'](_0x7b64('0x1c8'),_0x5abe72['text']));var _0x5e3627=this[_0x7b64('0x5d')][_0x7b64('0xa9')](this,_0x5abe72);if(_0x5e3627){this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x1c9'),_0x5e3627));var _0x31ab17=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x5e3627);try{fs[_0x7b64('0x106')](_0x5e3627+'.wav');}catch(_0x2562df){logger['error'](_0x2562df);}return _0x31ab17;}return this[_0x7b64('0x10')]['error'](_0x5abe72,_0x7b64('0x1ca'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1cb')]=function(_0x5c7ca4){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x1cc'),_0x5c7ca4['label']));if(!this[_0x7b64('0x82')](_0x5c7ca4['findBy'])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5c7ca4,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));var _0x374ad3=this[_0x7b64('0x4f')]['sync'](this,_0x5c7ca4[_0x7b64('0x158')]);if(_0x374ad3){logger[_0x7b64('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1cd')]=function(_0x1029a5){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1ce'),_0x1029a5[_0x7b64('0x38')]));var _0x1cf004=this[_0x7b64('0x10')]['exec'](_0x7b64('0x1cf'),[_0x1029a5[_0x7b64('0x1d0')],_0x1029a5['options']]);if(_0x1cf004['result']===-0x1){return _0x1cf004;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xc7'),_0x7b64('0x1cf'),_0x1029a5[_0x7b64('0x1d0')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1d1')]=function(_0x5e6351){logger['info'](util['format'](_0x7b64('0x1d2'),_0x5e6351[_0x7b64('0x38')]));if(!this['isConfigured'](_0x5e6351[_0x7b64('0xd9')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5e6351,'no\x20variable\x20selected');}var _0x4c6b93=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x5e6351[_0x7b64('0xd9')]);if(!_0x4c6b93){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5e6351,_0x7b64('0xdb'));}var _0x1e2749=this[_0x7b64('0x10')][_0x7b64('0xa4')](_0x4c6b93);return{'code':0xc8,'result':_0x1e2749[_0x7b64('0xa6')]?_0x1e2749['extra']:'-'};};String[_0x7b64('0x16')][_0x7b64('0xa2')]=function(_0x2f5db3,_0x54d4d2){return this['split'](_0x2f5db3)[_0x7b64('0x1d3')](_0x54d4d2);};module[_0x7b64('0x1d4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index a539787..c86492b 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 _0x563d=['lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','prototype','interface','ACW','mandatoryDisposition','name','Action','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','format','queue','error','acwTimeout','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','message','attended','[%s][HANGUP:UNIQUEID]','startAcw','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x563d,0xaa));var _0xd563=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0x563d[_0x347471];return _0x422b6a;};'use strict';var _=require(_0xd563('0x0'));var moment=require(_0xd563('0x1'));var ami=require(_0xd563('0x2'));var logger=require('../../../config/logger')(_0xd563('0x3'));var RpcUser=require(_0xd563('0x4'));var RpcVoiceAgentReport=require(_0xd563('0x5'));function Acw(_0x4d933c){this['voiceQueues']=_0x4d933c[_0xd563('0x6')];this[_0xd563('0x7')]=_0x4d933c[_0xd563('0x7')];this[_0xd563('0x8')]=_0x4d933c['timers'];this[_0xd563('0x9')]={};ami['on'](_0xd563('0xa'),this['syncAgentConnect'][_0xd563('0xb')](this));ami['on'](_0xd563('0xc'),this[_0xd563('0xd')][_0xd563('0xb')](this));ami['on'](_0xd563('0xe'),this['syncHangup'][_0xd563('0xb')](this));ami['on'](_0xd563('0xf'),this[_0xd563('0x10')][_0xd563('0xb')](this));ami['on'](_0xd563('0x11'),this[_0xd563('0x12')]['bind'](this));ami['on'](_0xd563('0x13'),this[_0xd563('0x14')][_0xd563('0xb')](this));ami['on'](_0xd563('0x15'),this[_0xd563('0x16')]['bind'](this));}function getDiff(_0x483bf0){var _0x54a862=moment()['milliseconds'](0x0);var _0x3a06f8=moment(_0x483bf0)[_0xd563('0x17')](0x0);return _0x54a862[_0xd563('0x18')](_0x3a06f8,_0xd563('0x19'));}Acw['prototype'][_0xd563('0x1a')]=function(_0x254cc3,_0x36e8e2){var _0x4b202e=this;var _0x1020fd=getDiff(_0x4b202e[_0xd563('0x8')][_0x254cc3][_0xd563('0x1b')]);clearTimeout(_0x4b202e[_0xd563('0x8')][_0x254cc3]['timer']);_0x4b202e[_0xd563('0x8')][_0x254cc3][_0xd563('0x1c')]=![];return RpcVoiceAgentReport[_0xd563('0x1d')]({'acwtime':_0x1020fd},_0x4b202e[_0xd563('0x8')][_0x254cc3][_0xd563('0x1e')],_0x254cc3)[_0xd563('0x1f')](function(_0x27959c){logger[_0xd563('0x20')](_0xd563('0x21'),_0x36e8e2,_0x1020fd,_0x27959c);})[_0xd563('0x22')](function(_0x5b80bf){logger['error'](_0xd563('0x23'),_0x36e8e2,_0x5b80bf);})[_0xd563('0x24')](function(){delete _0x4b202e['timers'][_0x254cc3];});};Acw[_0xd563('0x25')]['startAcw']=function(_0x288de8){try{var _0x41e3ba=this;var _0xd65494=this[_0xd563('0x9')][_0x288de8][_0xd563('0x26')];var _0xea5590=this[_0xd563('0x9')][_0x288de8]['queue'];var _0x4bfdc0=this[_0xd563('0x6')][_0xea5590];var _0x59c741=![];var _0x4246c6=_0xd563('0x27');if(_0x4bfdc0[_0xd563('0x28')]&&_0x4bfdc0['mandatoryDispositionPause'][_0xd563('0x29')]){_0x59c741=!![];_0x4246c6=_0x4bfdc0['mandatoryDispositionPause'][_0xd563('0x29')];}return ami[_0xd563('0x2a')]({'action':'QueuePause','interface':_0xd65494,'paused':!![],'reason':_0x4246c6})[_0xd563('0x1f')](function(){if(_0x41e3ba[_0xd563('0x7')][_0xd65494]){return RpcUser[_0xd563('0x2b')](_0x41e3ba[_0xd563('0x7')][_0xd65494]['id'])[_0xd563('0x1f')](function(_0x7ea3f7){if(!_0x7ea3f7||_0x7ea3f7['voicePause']){logger[_0xd563('0x20')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x288de8,_0xd65494,_0xea5590);return;}logger['info'](_0xd563('0x2c'),_0x288de8,_0xd65494,_0xea5590);var _0x6e9064=_0x41e3ba[_0xd563('0x9')][_0x288de8]['attended']&&_0x41e3ba[_0xd563('0x9')][_0x288de8][_0xd563('0x2d')]?_0x41e3ba[_0xd563('0x9')][_0x288de8][_0xd563('0x2d')]:_0x288de8;return RpcUser[_0xd563('0x2e')](_0x41e3ba[_0xd563('0x7')][_0xd65494],_0x4246c6,_0x6e9064)[_0xd563('0x1f')](function(_0x2957f9){_0x41e3ba[_0xd563('0x6')][_0xea5590][_0xd563('0x2f')]-=0x1;_0x41e3ba[_0xd563('0x6')][_0xea5590][_0xd563('0x30')]+=0x1;return _0x2957f9;});})['then'](function(_0x2889f1){if(_0x59c741||!_0x2889f1){return;}_0x41e3ba['timers'][_0xd65494]={};logger[_0xd563('0x20')](_0xd563('0x31'),_0x288de8,_0x41e3ba['voiceQueues'][_0xea5590]['acwTimeout'],_0xd65494,_0xea5590);_0x41e3ba[_0xd563('0x8')][_0xd65494]['timer']=setTimeout(_0x41e3ba[_0xd563('0x32')][_0xd563('0xb')](_0x41e3ba,_0xd65494),_0x41e3ba['voiceQueues'][_0xea5590]['acwTimeout']*0x3e8);_0x41e3ba['timers'][_0xd65494][_0xd563('0x1b')]=moment()[_0xd563('0x33')]('YYYY-MM-DD\x20HH:mm:ss');_0x41e3ba[_0xd563('0x8')][_0xd65494][_0xd563('0x1e')]=_0x288de8;_0x41e3ba[_0xd563('0x8')][_0xd65494][_0xd563('0x34')]=_0xea5590;_0x41e3ba[_0xd563('0x8')][_0xd65494][_0xd563('0x1a')]=_0x41e3ba[_0xd563('0x1a')][_0xd563('0xb')](_0x41e3ba,_0xd65494,_0x288de8);});}})[_0xd563('0x22')](function(){logger[_0xd563('0x35')](_0xd563('0x31'),_0x288de8,_0x41e3ba['voiceQueues'][_0xea5590][_0xd563('0x36')],_0xd65494,_0xea5590);})[_0xd563('0x24')](function(){delete _0x41e3ba[_0xd563('0x9')][_0x288de8];});}catch(_0x2f220f){logger['error']('[ACW][START]\x20%s',_0x2f220f['message']);}};Acw[_0xd563('0x25')][_0xd563('0x32')]=function(_0x1fea85){try{var _0x227257=this;if(_0x227257[_0xd563('0x8')][_0x1fea85]){_0x227257['timers'][_0x1fea85][_0xd563('0x1c')]=![];var _0x5c87a4=_0x227257[_0xd563('0x8')][_0x1fea85][_0xd563('0x1e')];var _0x5affb0=_0x227257[_0xd563('0x8')][_0x1fea85][_0xd563('0x34')];var _0x5250bc=_0x227257['voiceQueues'][_0x5affb0][_0xd563('0x36')];logger[_0xd563('0x20')](_0xd563('0x37'),_0x5c87a4,_0x1fea85);RpcUser[_0xd563('0x2b')](this[_0xd563('0x7')][_0x1fea85]['id'])[_0xd563('0x1f')](function(_0x150e2a){if(_0x150e2a[_0xd563('0x38')]===_0xd563('0x27')){return RpcUser[_0xd563('0x39')](_0x227257[_0xd563('0x7')][_0x1fea85]);}});RpcVoiceAgentReport[_0xd563('0x1d')]({'acwtime':_0x5250bc,'agentacw':!![]},_0x5c87a4,_0x1fea85)[_0xd563('0x1f')](function(_0x2ab878){logger[_0xd563('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0x5c87a4,_0x5250bc,_0x2ab878);})['catch'](function(_0x228764){logger[_0xd563('0x35')](_0xd563('0x23'),_0x5c87a4,_0x228764);});}else{logger[_0xd563('0x35')](_0xd563('0x3a'),_0x1fea85);if(_0x227257[_0xd563('0x8')]){logger[_0xd563('0x20')](_0xd563('0x3b'),JSON[_0xd563('0x3c')](_0x227257[_0xd563('0x8')]));}}}catch(_0x2dadcb){logger[_0xd563('0x35')](_0xd563('0x3d'),_0x2dadcb['message']);}};Acw[_0xd563('0x25')]['syncAgentConnect']=function(_0x37291c){try{if(this['voiceQueues'][_0x37291c[_0xd563('0x34')]]&&(this[_0xd563('0x6')][_0x37291c[_0xd563('0x34')]][_0xd563('0x3')]||this[_0xd563('0x6')][_0x37291c['queue']][_0xd563('0x28')])){if(this[_0xd563('0x7')][_0x37291c[_0xd563('0x26')]]){this[_0xd563('0x9')][_0x37291c['uniqueid']]={'queue':_0x37291c[_0xd563('0x34')],'interface':_0x37291c[_0xd563('0x26')],'destlinkedid':_0x37291c[_0xd563('0x2d')]};}}}catch(_0x49e62b){logger[_0xd563('0x35')](_0xd563('0x3e'),_0x49e62b['message']);}};Acw[_0xd563('0x25')][_0xd563('0x16')]=function(_0x1724d9){try{if(this[_0xd563('0x6')][_0x1724d9[_0xd563('0x34')]]&&(this['voiceQueues'][_0x1724d9[_0xd563('0x34')]][_0xd563('0x3')]||this[_0xd563('0x6')][_0x1724d9[_0xd563('0x34')]][_0xd563('0x28')])){if(this['agents'][_0x1724d9['interface']]){this[_0xd563('0x9')][_0x1724d9[_0xd563('0x1e')]]={'queue':_0x1724d9[_0xd563('0x34')],'interface':_0x1724d9[_0xd563('0x26')]};}}}catch(_0x321498){logger[_0xd563('0x35')]('[ACW][syncAgentConnectPreview]\x20%s',_0x321498[_0xd563('0x3f')]);}};Acw[_0xd563('0x25')][_0xd563('0xd')]=function(_0x44b639){try{if(this[_0xd563('0x9')][_0x44b639[_0xd563('0x1e')]]&&_['isUndefined'](this[_0xd563('0x9')][_0x44b639[_0xd563('0x1e')]][_0xd563('0x40')])){logger['info'](_0xd563('0x41'),_0x44b639[_0xd563('0x1e')]);this[_0xd563('0x42')](_0x44b639[_0xd563('0x1e')]);}else if(this[_0xd563('0x9')][_0x44b639['linkedid']]&&_[_0xd563('0x43')](this[_0xd563('0x9')][_0x44b639['linkedid']]['attended'])){logger[_0xd563('0x20')](_0xd563('0x44'),_0x44b639['linkedid']);this['startAcw'](_0x44b639[_0xd563('0x45')]);}}catch(_0x41766a){logger[_0xd563('0x35')](_0xd563('0x46'),_0x41766a[_0xd563('0x3f')]);}};Acw[_0xd563('0x25')]['syncHangup']=function(_0x1c1f50){try{if(this[_0xd563('0x9')][_0x1c1f50[_0xd563('0x1e')]]&&this['channels'][_0x1c1f50[_0xd563('0x1e')]]['attended']){logger[_0xd563('0x20')](_0xd563('0x47'),_0x1c1f50['uniqueid']);this[_0xd563('0x42')](_0x1c1f50[_0xd563('0x1e')]);}else if(this[_0xd563('0x9')][_0x1c1f50[_0xd563('0x45')]]&&this[_0xd563('0x9')][_0x1c1f50['linkedid']]['attended']){logger[_0xd563('0x20')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1c1f50[_0xd563('0x45')]);this['startAcw'](_0x1c1f50[_0xd563('0x45')]);}}catch(_0x117c7d){logger[_0xd563('0x35')]('[ACW][syncHangup]\x20%s',_0x117c7d[_0xd563('0x3f')]);}};Acw[_0xd563('0x25')][_0xd563('0x12')]=function(_0x4f2c0c){try{if(!_[_0xd563('0x48')](this['channels'][_0x4f2c0c[_0xd563('0x49')]])){this[_0xd563('0x42')](_0x4f2c0c['transfereeuniqueid']);if(this[_0xd563('0x9')][_0x4f2c0c[_0xd563('0x4a')]]){this[_0xd563('0x9')][_0x4f2c0c[_0xd563('0x4a')]]['attended']=!![];this['channels'][_0x4f2c0c[_0xd563('0x4b')]]=this[_0xd563('0x9')][_0x4f2c0c[_0xd563('0x4a')]];delete this[_0xd563('0x9')][_0x4f2c0c[_0xd563('0x4a')]];}}else if(!_[_0xd563('0x48')](this['channels'][_0x4f2c0c[_0xd563('0x4b')]])){this['startAcw'](_0x4f2c0c[_0xd563('0x4b')]);if(this[_0xd563('0x9')][_0x4f2c0c[_0xd563('0x4c')]]){this[_0xd563('0x9')][_0x4f2c0c[_0xd563('0x4c')]]['attended']=!![];this['channels'][_0x4f2c0c[_0xd563('0x49')]]=this[_0xd563('0x9')][_0x4f2c0c['origtransfereruniqueid']];delete this[_0xd563('0x9')][_0x4f2c0c[_0xd563('0x4c')]];}}}catch(_0x3b3e7f){logger[_0xd563('0x35')](_0xd563('0x4d'),_0x3b3e7f[_0xd563('0x3f')]);}};Acw[_0xd563('0x25')][_0xd563('0x14')]=function(_0x38cc9d){try{if(this['channels'][_0x38cc9d[_0xd563('0x4e')]]){logger[_0xd563('0x20')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xd563('0x3c')](_0x38cc9d[_0xd563('0x4e')]));this[_0xd563('0x42')](_0x38cc9d[_0xd563('0x4e')]);}else if(this[_0xd563('0x9')][_0x38cc9d[_0xd563('0x4f')]]){logger[_0xd563('0x20')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xd563('0x3c')](_0x38cc9d[_0xd563('0x4f')]));this[_0xd563('0x42')](_0x38cc9d[_0xd563('0x4f')]);}}catch(_0x337ad7){logger[_0xd563('0x35')](_0xd563('0x50'),_0x337ad7['message']);}};Acw[_0xd563('0x25')][_0xd563('0x10')]=function(_0x5ee82a){try{if(this[_0xd563('0x6')][_0x5ee82a[_0xd563('0x34')]]&&this['voiceQueues'][_0x5ee82a[_0xd563('0x34')]][_0xd563('0x51')]==='all'){if(this['agents'][_0x5ee82a[_0xd563('0x26')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x5ee82a['uniqueid'],_0x5ee82a['interface'],_0x5ee82a[_0xd563('0x34')]);return RpcUser[_0xd563('0x2e')](this[_0xd563('0x7')][_0x5ee82a['interface']],_0xd563('0x52'),_0x5ee82a[_0xd563('0x1e')]);}}}catch(_0x2a1b57){logger[_0xd563('0x35')](_0xd563('0x53'),_0x2a1b57[_0xd563('0x3f')]);}};module[_0xd563('0x54')]=Acw; \ No newline at end of file +var _0x1a8a=['getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','paused','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause'];(function(_0x3da8ae,_0x1dcc08){var _0x2ad8e5=function(_0x63cc39){while(--_0x63cc39){_0x3da8ae['push'](_0x3da8ae['shift']());}};_0x2ad8e5(++_0x1dcc08);}(_0x1a8a,0x191));var _0xa1a8=function(_0x26658e,_0x1bb1a9){_0x26658e=_0x26658e-0x0;var _0x572802=_0x1a8a[_0x26658e];return _0x572802;};'use strict';var _=require(_0xa1a8('0x0'));var moment=require(_0xa1a8('0x1'));var ami=require('../ami');var logger=require(_0xa1a8('0x2'))('acw');var RpcUser=require(_0xa1a8('0x3'));var RpcVoiceAgentReport=require(_0xa1a8('0x4'));function Acw(_0x21cb50){this[_0xa1a8('0x5')]=_0x21cb50[_0xa1a8('0x5')];this[_0xa1a8('0x6')]=_0x21cb50[_0xa1a8('0x6')];this[_0xa1a8('0x7')]=_0x21cb50['timers'];this['channels']={};ami['on']('agentconnect',this[_0xa1a8('0x8')][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0xa'),this['syncHangupRequest'][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0xb'),this[_0xa1a8('0xc')][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0xd'),this['syncAgentRingNoAnswer'][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0xe'),this[_0xa1a8('0xf')][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0x10'),this[_0xa1a8('0x11')][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0x12'),this['syncAgentConnectPreview'][_0xa1a8('0x9')](this));}function getDiff(_0x3c3c7a){var _0xc77051=moment()[_0xa1a8('0x13')](0x0);var _0x1b5991=moment(_0x3c3c7a)[_0xa1a8('0x13')](0x0);return _0xc77051[_0xa1a8('0x14')](_0x1b5991,_0xa1a8('0x15'));}Acw[_0xa1a8('0x16')][_0xa1a8('0x17')]=function(_0x131691,_0x12be5a){var _0x29bf64=this;var _0x2e0f12=getDiff(_0x29bf64[_0xa1a8('0x7')][_0x131691][_0xa1a8('0x18')]);clearTimeout(_0x29bf64[_0xa1a8('0x7')][_0x131691][_0xa1a8('0x19')]);_0x29bf64[_0xa1a8('0x7')][_0x131691]['timer']=![];return RpcVoiceAgentReport[_0xa1a8('0x1a')]({'acwtime':_0x2e0f12},_0x29bf64['timers'][_0x131691][_0xa1a8('0x1b')],_0x131691)[_0xa1a8('0x1c')](function(_0x2e1e78){logger[_0xa1a8('0x1d')](_0xa1a8('0x1e'),_0x12be5a,_0x2e0f12,_0x2e1e78);})[_0xa1a8('0x1f')](function(_0xb5d490){logger['error'](_0xa1a8('0x20'),_0x12be5a,_0xb5d490);})[_0xa1a8('0x21')](function(){delete _0x29bf64[_0xa1a8('0x7')][_0x131691];});};Acw['prototype'][_0xa1a8('0x22')]=function(_0x408f16){try{var _0x4e983a=this;var _0x1eb753=this['channels'][_0x408f16][_0xa1a8('0x23')];var _0x287cae=this[_0xa1a8('0x24')][_0x408f16][_0xa1a8('0x25')];var _0x25bd69=this[_0xa1a8('0x5')][_0x287cae];var _0x2b2243=![];var _0x13a6b3=_0xa1a8('0x26');if(_0x25bd69[_0xa1a8('0x27')]&&_0x25bd69[_0xa1a8('0x28')][_0xa1a8('0x29')]){_0x2b2243=!![];_0x13a6b3=_0x25bd69[_0xa1a8('0x28')]['name'];}return ami[_0xa1a8('0x2a')]({'action':_0xa1a8('0x2b'),'interface':_0x1eb753,'paused':!![],'reason':_0x13a6b3})[_0xa1a8('0x1c')](function(){if(_0x4e983a['agents'][_0x1eb753]){return RpcUser[_0xa1a8('0x2c')](_0x4e983a[_0xa1a8('0x6')][_0x1eb753]['id'])[_0xa1a8('0x1c')](function(_0x34b192){if(!_0x34b192||_0x34b192[_0xa1a8('0x2d')]){logger[_0xa1a8('0x1d')](_0xa1a8('0x2e'),_0x408f16,_0x1eb753,_0x287cae);return;}logger[_0xa1a8('0x1d')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x408f16,_0x1eb753,_0x287cae);var _0x5ccdf6=_0x4e983a[_0xa1a8('0x24')][_0x408f16][_0xa1a8('0x2f')]&&_0x4e983a[_0xa1a8('0x24')][_0x408f16][_0xa1a8('0x30')]?_0x4e983a[_0xa1a8('0x24')][_0x408f16]['destlinkedid']:_0x408f16;return RpcUser[_0xa1a8('0x31')](_0x4e983a[_0xa1a8('0x6')][_0x1eb753],_0x13a6b3,_0x5ccdf6)[_0xa1a8('0x1c')](function(_0x46ac45){_0x4e983a[_0xa1a8('0x5')][_0x287cae]['available']-=0x1;_0x4e983a[_0xa1a8('0x5')][_0x287cae][_0xa1a8('0x32')]+=0x1;return _0x46ac45;});})[_0xa1a8('0x1c')](function(_0x35ef5c){if(_0x2b2243||!_0x35ef5c){return;}_0x4e983a[_0xa1a8('0x7')][_0x1eb753]={};logger[_0xa1a8('0x1d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x408f16,_0x4e983a[_0xa1a8('0x5')][_0x287cae][_0xa1a8('0x33')],_0x1eb753,_0x287cae);_0x4e983a[_0xa1a8('0x7')][_0x1eb753][_0xa1a8('0x19')]=setTimeout(_0x4e983a[_0xa1a8('0x34')][_0xa1a8('0x9')](_0x4e983a,_0x1eb753),_0x4e983a[_0xa1a8('0x5')][_0x287cae][_0xa1a8('0x33')]*0x3e8);_0x4e983a[_0xa1a8('0x7')][_0x1eb753][_0xa1a8('0x18')]=moment()['format'](_0xa1a8('0x35'));_0x4e983a['timers'][_0x1eb753]['uniqueid']=_0x408f16;_0x4e983a[_0xa1a8('0x7')][_0x1eb753][_0xa1a8('0x25')]=_0x287cae;_0x4e983a[_0xa1a8('0x7')][_0x1eb753][_0xa1a8('0x17')]=_0x4e983a['updateAcw']['bind'](_0x4e983a,_0x1eb753,_0x408f16);});}})[_0xa1a8('0x1f')](function(){logger[_0xa1a8('0x36')](_0xa1a8('0x37'),_0x408f16,_0x4e983a[_0xa1a8('0x5')][_0x287cae][_0xa1a8('0x33')],_0x1eb753,_0x287cae);})[_0xa1a8('0x21')](function(){delete _0x4e983a[_0xa1a8('0x24')][_0x408f16];});}catch(_0x5ea0eb){logger[_0xa1a8('0x36')](_0xa1a8('0x38'),_0x5ea0eb[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0x34')]=function(_0x1934a7){try{var _0x3eff68=this;if(_0x3eff68[_0xa1a8('0x7')][_0x1934a7]){_0x3eff68['timers'][_0x1934a7][_0xa1a8('0x19')]=![];var _0x488b80=_0x3eff68['timers'][_0x1934a7][_0xa1a8('0x1b')];var _0xf6cd0a=_0x3eff68[_0xa1a8('0x7')][_0x1934a7]['queue'];var _0x5a5a6b=_0x3eff68['voiceQueues'][_0xf6cd0a]['acwTimeout'];logger['info'](_0xa1a8('0x3a'),_0x488b80,_0x1934a7);RpcUser[_0xa1a8('0x2c')](this['agents'][_0x1934a7]['id'])['then'](function(_0x189f3c){if(_0x189f3c[_0xa1a8('0x3b')]===_0xa1a8('0x26')){return RpcUser['saveUnpause'](_0x3eff68[_0xa1a8('0x6')][_0x1934a7]);}});RpcVoiceAgentReport[_0xa1a8('0x1a')]({'acwtime':_0x5a5a6b,'agentacw':!![]},_0x488b80,_0x1934a7)[_0xa1a8('0x1c')](function(_0x11f7cb){logger[_0xa1a8('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x488b80,_0x5a5a6b,_0x11f7cb);})['catch'](function(_0x5741a6){logger[_0xa1a8('0x36')](_0xa1a8('0x20'),_0x488b80,_0x5741a6);});}else{logger[_0xa1a8('0x36')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1934a7);if(_0x3eff68[_0xa1a8('0x7')]){logger[_0xa1a8('0x1d')](_0xa1a8('0x3c'),JSON[_0xa1a8('0x3d')](_0x3eff68[_0xa1a8('0x7')]));}}}catch(_0x99afc5){logger[_0xa1a8('0x36')](_0xa1a8('0x3e'),_0x99afc5['message']);}};Acw[_0xa1a8('0x16')]['syncAgentConnect']=function(_0x3bd77d){try{if(this[_0xa1a8('0x5')][_0x3bd77d['queue']]&&(this[_0xa1a8('0x5')][_0x3bd77d[_0xa1a8('0x25')]][_0xa1a8('0x3f')]||this['voiceQueues'][_0x3bd77d[_0xa1a8('0x25')]][_0xa1a8('0x27')])){if(this[_0xa1a8('0x6')][_0x3bd77d['interface']]){this[_0xa1a8('0x24')][_0x3bd77d['uniqueid']]={'queue':_0x3bd77d[_0xa1a8('0x25')],'interface':_0x3bd77d[_0xa1a8('0x23')],'destlinkedid':_0x3bd77d[_0xa1a8('0x30')]};}}}catch(_0x4e8266){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x4e8266[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0x40')]=function(_0x37d182){try{if(this[_0xa1a8('0x5')][_0x37d182[_0xa1a8('0x25')]]&&(this[_0xa1a8('0x5')][_0x37d182[_0xa1a8('0x25')]][_0xa1a8('0x3f')]||this[_0xa1a8('0x5')][_0x37d182[_0xa1a8('0x25')]]['mandatoryDisposition'])){if(this[_0xa1a8('0x6')][_0x37d182[_0xa1a8('0x23')]]){this['channels'][_0x37d182[_0xa1a8('0x1b')]]={'queue':_0x37d182[_0xa1a8('0x25')],'interface':_0x37d182[_0xa1a8('0x23')]};}}}catch(_0xb39a7e){logger[_0xa1a8('0x36')](_0xa1a8('0x41'),_0xb39a7e[_0xa1a8('0x39')]);}};Acw['prototype']['syncHangupRequest']=function(_0x401c60){try{if(this['channels'][_0x401c60[_0xa1a8('0x1b')]]&&_[_0xa1a8('0x42')](this[_0xa1a8('0x24')][_0x401c60[_0xa1a8('0x1b')]][_0xa1a8('0x2f')])){logger[_0xa1a8('0x1d')](_0xa1a8('0x43'),_0x401c60['uniqueid']);this['startAcw'](_0x401c60[_0xa1a8('0x1b')]);}else if(this[_0xa1a8('0x24')][_0x401c60[_0xa1a8('0x44')]]&&_[_0xa1a8('0x42')](this[_0xa1a8('0x24')][_0x401c60['linkedid']][_0xa1a8('0x2f')])){logger[_0xa1a8('0x1d')](_0xa1a8('0x45'),_0x401c60['linkedid']);this[_0xa1a8('0x22')](_0x401c60['linkedid']);}}catch(_0x3b8c22){logger['error'](_0xa1a8('0x46'),_0x3b8c22[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0xc')]=function(_0x31ff80){try{if(this[_0xa1a8('0x24')][_0x31ff80[_0xa1a8('0x1b')]]&&this[_0xa1a8('0x24')][_0x31ff80[_0xa1a8('0x1b')]][_0xa1a8('0x2f')]){logger[_0xa1a8('0x1d')](_0xa1a8('0x47'),_0x31ff80['uniqueid']);this[_0xa1a8('0x22')](_0x31ff80[_0xa1a8('0x1b')]);}else if(this[_0xa1a8('0x24')][_0x31ff80[_0xa1a8('0x44')]]&&this[_0xa1a8('0x24')][_0x31ff80[_0xa1a8('0x44')]]['attended']){logger[_0xa1a8('0x1d')](_0xa1a8('0x48'),_0x31ff80['linkedid']);this[_0xa1a8('0x22')](_0x31ff80['linkedid']);}}catch(_0x4768c3){logger[_0xa1a8('0x36')]('[ACW][syncHangup]\x20%s',_0x4768c3[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0xf')]=function(_0x3f333f){try{if(!_[_0xa1a8('0x49')](this[_0xa1a8('0x24')][_0x3f333f['transfereeuniqueid']])){this[_0xa1a8('0x22')](_0x3f333f['transfereeuniqueid']);if(this[_0xa1a8('0x24')][_0x3f333f['secondtransfereruniqueid']]){this[_0xa1a8('0x24')][_0x3f333f['secondtransfereruniqueid']][_0xa1a8('0x2f')]=!![];this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4a')]]=this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4b')]];delete this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4b')]];}}else if(!_[_0xa1a8('0x49')](this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4a')]])){this['startAcw'](_0x3f333f[_0xa1a8('0x4a')]);if(this['channels'][_0x3f333f[_0xa1a8('0x4c')]]){this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4c')]][_0xa1a8('0x2f')]=!![];this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4d')]]=this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4c')]];delete this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4c')]];}}}catch(_0x14e9ea){logger[_0xa1a8('0x36')](_0xa1a8('0x4e'),_0x14e9ea[_0xa1a8('0x39')]);}};Acw['prototype'][_0xa1a8('0x11')]=function(_0x2b3bfc){try{if(this[_0xa1a8('0x24')][_0x2b3bfc['transfereruniqueid']]){logger[_0xa1a8('0x1d')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xa1a8('0x3d')](_0x2b3bfc[_0xa1a8('0x4f')]));this['startAcw'](_0x2b3bfc[_0xa1a8('0x4f')]);}else if(this['channels'][_0x2b3bfc[_0xa1a8('0x50')]]){logger[_0xa1a8('0x1d')](_0xa1a8('0x51'),JSON['stringify'](_0x2b3bfc['transfererlinkedid']));this[_0xa1a8('0x22')](_0x2b3bfc['transfererlinkedid']);}}catch(_0x4db156){logger[_0xa1a8('0x36')](_0xa1a8('0x52'),_0x4db156[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0x53')]=function(_0x1cd35e){try{if(this[_0xa1a8('0x5')][_0x1cd35e['queue']]&&this[_0xa1a8('0x5')][_0x1cd35e[_0xa1a8('0x25')]][_0xa1a8('0x54')]==='all'){if(this[_0xa1a8('0x6')][_0x1cd35e[_0xa1a8('0x23')]]){logger[_0xa1a8('0x1d')](_0xa1a8('0x55'),_0x1cd35e['uniqueid'],_0x1cd35e['interface'],_0x1cd35e[_0xa1a8('0x25')]);return RpcUser[_0xa1a8('0x31')](this[_0xa1a8('0x6')][_0x1cd35e['interface']],_0xa1a8('0x56'),_0x1cd35e[_0xa1a8('0x1b')]);}}}catch(_0x4af960){logger[_0xa1a8('0x36')](_0xa1a8('0x57'),_0x4af960[_0xa1a8('0x39')]);}};module[_0xa1a8('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index b93ab11..844159a 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 _0xe910=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action'];(function(_0xcf6d6b,_0x2b15b7){var _0x337966=function(_0x1aba20){while(--_0x1aba20){_0xcf6d6b['push'](_0xcf6d6b['shift']());}};_0x337966(++_0x2b15b7);}(_0xe910,0x1ed));var _0x0e91=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0xe910[_0x3a07c1];return _0x2bbe15;};'use strict';var Manager=require(_0x0e91('0x0'));var BPromise=require(_0x0e91('0x1'));var util=require(_0x0e91('0x2'));var logger=require(_0x0e91('0x3'))(_0x0e91('0x4'));var config=require(_0x0e91('0x5'));var ami=new Manager(config[_0x0e91('0x6')][_0x0e91('0x7')],config[_0x0e91('0x6')]['ip'],config[_0x0e91('0x6')][_0x0e91('0x8')],config[_0x0e91('0x6')][_0x0e91('0x9')],!![]);ami[_0x0e91('0xa')]();ami[_0x0e91('0xb')]=BPromise[_0x0e91('0xc')](ami[_0x0e91('0xd')]);function error(_0x3a4866){logger[_0x0e91('0xe')](util[_0x0e91('0xf')](_0x0e91('0x10'),config['asterisk'][_0x0e91('0x8')],config[_0x0e91('0x6')]['ip'],config[_0x0e91('0x6')][_0x0e91('0x7')],util[_0x0e91('0x11')](_0x3a4866,![],null)));}function close(){logger['error'](util[_0x0e91('0xf')](_0x0e91('0x12'),config[_0x0e91('0x6')][_0x0e91('0x8')],config[_0x0e91('0x6')]['ip'],config['asterisk'][_0x0e91('0x7')]));}ami[_0x0e91('0x13')]=function(){return function(){return ami[_0x0e91('0xb')]({'action':_0x0e91('0x14')});};};ami[_0x0e91('0x15')]=function(){return function(){return ami[_0x0e91('0xb')]({'action':'devicestatelist'});};};ami[_0x0e91('0x16')]=function(){return function(){return ami[_0x0e91('0xb')]({'action':_0x0e91('0x17')});};};ami[_0x0e91('0x18')]=function(){return function(){return ami[_0x0e91('0xb')]({'action':_0x0e91('0x19')});};};ami[_0x0e91('0x1a')]=function(){return function(){return ami[_0x0e91('0xb')]({'action':'coreshowchannels'});};};function connect(){logger[_0x0e91('0x1b')](util['format'](_0x0e91('0x1c'),config[_0x0e91('0x6')][_0x0e91('0x8')],config[_0x0e91('0x6')]['ip'],config[_0x0e91('0x6')][_0x0e91('0x7')]));ami[_0x0e91('0x1d')]('error',error);ami[_0x0e91('0x1d')](_0x0e91('0x1e'),close);}ami['on'](_0x0e91('0x1f'),connect);ami['on'](_0x0e91('0x20'),function(_0x45127a){logger['info'](util[_0x0e91('0xf')](_0x0e91('0x21'),config[_0x0e91('0x6')][_0x0e91('0x8')],config['asterisk']['ip'],config[_0x0e91('0x6')][_0x0e91('0x7')],util[_0x0e91('0x11')](_0x45127a,![],null)));});ami['on'](_0x0e91('0x22'),function(){logger[_0x0e91('0x1b')](util['format'](_0x0e91('0x23'),config[_0x0e91('0x6')][_0x0e91('0x8')],config['asterisk']['ip'],config[_0x0e91('0x6')]['port']));return Promise['resolve']()[_0x0e91('0x24')](ami[_0x0e91('0x13')]())[_0x0e91('0x24')](ami[_0x0e91('0x15')]())[_0x0e91('0x24')](ami[_0x0e91('0x16')]())[_0x0e91('0x24')](ami[_0x0e91('0x18')]())[_0x0e91('0x24')](ami[_0x0e91('0x1a')]())['catch'](function(_0x2d5575){logger[_0x0e91('0xe')](_0x0e91('0x25'),util['inspect'](_0x2d5575,{'showHidden':![],'depth':null}));});});ami[_0x0e91('0x1d')](_0x0e91('0xe'),error);ami[_0x0e91('0x1d')](_0x0e91('0x1e'),close);module[_0x0e91('0x26')]=ami; \ No newline at end of file +var _0x1731=['actionQueueSummary','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','util','../../config/logger','../../config/environment','port','asterisk','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x567663,_0xe92da3){var _0x31b567=function(_0x5326a8){while(--_0x5326a8){_0x567663['push'](_0x567663['shift']());}};_0x31b567(++_0xe92da3);}(_0x1731,0xa1));var _0x1173=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1731[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require(_0x1173('0x0'));var BPromise=require('bluebird');var util=require(_0x1173('0x1'));var logger=require(_0x1173('0x2'))('ami');var config=require(_0x1173('0x3'));var ami=new Manager(config['asterisk'][_0x1173('0x4')],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')][_0x1173('0x7')],!![]);ami[_0x1173('0x8')]();ami['Action']=BPromise[_0x1173('0x9')](ami[_0x1173('0xa')]);function error(_0x488881){logger[_0x1173('0xb')](util[_0x1173('0xc')](_0x1173('0xd'),config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')]['port'],util[_0x1173('0xe')](_0x488881,![],null)));}function close(){logger[_0x1173('0xb')](util['format'](_0x1173('0xf'),config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')][_0x1173('0x4')]));}ami[_0x1173('0x10')]=function(){return function(){return ami[_0x1173('0x11')]({'action':_0x1173('0x12')});};};ami[_0x1173('0x13')]=function(){return function(){return ami['Action']({'action':_0x1173('0x14')});};};ami[_0x1173('0x15')]=function(){return function(){return ami['Action']({'action':_0x1173('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x1173('0x11')]({'action':_0x1173('0x17')});};};ami[_0x1173('0x18')]=function(){return function(){return ami['Action']({'action':_0x1173('0x19')});};};function connect(){logger[_0x1173('0x1a')](util[_0x1173('0xc')](_0x1173('0x1b'),config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')]['ip'],config['asterisk'][_0x1173('0x4')]));ami[_0x1173('0x1c')](_0x1173('0xb'),error);ami[_0x1173('0x1c')]('close',close);}ami['on']('connect',connect);ami['on'](_0x1173('0x1d'),function(_0x1b7e65){logger[_0x1173('0x1a')](util[_0x1173('0xc')](_0x1173('0x1e'),config[_0x1173('0x5')]['username'],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')][_0x1173('0x4')],util[_0x1173('0xe')](_0x1b7e65,![],null)));});ami['on']('fullybooted',function(){logger[_0x1173('0x1a')](util[_0x1173('0xc')](_0x1173('0x1f'),config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')][_0x1173('0x4')]));return Promise[_0x1173('0x20')]()[_0x1173('0x21')](ami[_0x1173('0x10')]())[_0x1173('0x21')](ami[_0x1173('0x13')]())[_0x1173('0x21')](ami[_0x1173('0x15')]())['then'](ami[_0x1173('0x22')]())[_0x1173('0x21')](ami[_0x1173('0x18')]())[_0x1173('0x23')](function(_0x48ec58){logger[_0x1173('0xb')](_0x1173('0x24'),util[_0x1173('0xe')](_0x48ec58,{'showHidden':![],'depth':null}));});});ami[_0x1173('0x1c')](_0x1173('0xb'),error);ami['once'](_0x1173('0x25'),close);module[_0x1173('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 609391f..22a3a67 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 _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x287c49,_0x1b4ef2){var _0x51cddb=function(_0x277b61){while(--_0x277b61){_0x287c49['push'](_0x287c49['shift']());}};_0x51cddb(++_0x1b4ef2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0xcb91[_0x591a90];return _0x551587;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5fdeef7..af292b1 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 _0xf15b=['queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','---------------------------','getSeconds','startProgressive','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','isIVRCampaign','originated','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','Error','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','isTrunkReachable','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Intervals','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','length','command','iftime\x20%s,%s','interval','content','true','catch','push','Action','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','campaigns','resolve','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','ivr','updateOriginated','queue','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','dialAbandonedMaxRetry','CampaignId','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','syncNewExten','channel','actionid','strategy','rrmemory','roundrobin','isNil','stateinterface','locked','agents','merge','idHopper','paused','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[callProgressDetecting]\x20','variable','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','Machine','membername','emit','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','stateGlobal','reason19\x20machine....','countmachineretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','dialMachineRetryFrequency','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','AGI','dialQueueProject','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','saveInDb','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Trunk','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countagentrejectretry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','floor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','maxNumberOriginate','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','dialLimitQueue','undefined','not_inuse','getContactDialer','[countReScheduled]\x20','Contact','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[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','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','trunks','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked'];(function(_0x3f5330,_0x362afa){var _0x17c626=function(_0x1274a8){while(--_0x1274a8){_0x3f5330['push'](_0x3f5330['shift']());}};_0x17c626(++_0x362afa);}(_0xf15b,0x1f1));var _0xbf15=function(_0x307df8,_0x5c687c){_0x307df8=_0x307df8-0x0;var _0x2c5855=_0xf15b[_0x307df8];return _0x2c5855;};'use strict';var util=require(_0xbf15('0x0'));var _=require(_0xbf15('0x1'));var uuid=require(_0xbf15('0x2'));var moment=require(_0xbf15('0x3'));var rr=require('rr');var Redis=require(_0xbf15('0x4'));var utils=require(_0xbf15('0x5'));var hopperUtils=require(_0xbf15('0x6'));var ut=require(_0xbf15('0x7'));var config=require(_0xbf15('0x8'));var logger=require(_0xbf15('0x9'))('dialer');var loggerBooked=require(_0xbf15('0x9'))(_0xbf15('0xa'));var loggerPredictive=require(_0xbf15('0x9'))(_0xbf15('0xb'));var loggerPredictiveCalls=require(_0xbf15('0x9'))(_0xbf15('0xc'));var loggerSyncQueueSummary=require(_0xbf15('0x9'))(_0xbf15('0xd'));var ami=require(_0xbf15('0xe'));config[_0xbf15('0xf')]=_['defaults'](config[_0xbf15('0xf')],{'host':'localhost','port':0x18eb});var io=require(_0xbf15('0x10'))(new Redis(config[_0xbf15('0xf')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0xbf15('0x11'));var RpcSetting=require(_0xbf15('0x12'));var Interval=require(_0xbf15('0x13'));var Action=require(_0xbf15('0x14'));var History=require(_0xbf15('0x15'));var Final=require(_0xbf15('0x16'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xbf15('0x17'));var ipAgi=process['env'][_0xbf15('0x18')]||_0xbf15('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xbf15('0x1a')][_0xbf15('0x1b')]=function(_0x577e44){this[_0xbf15('0x1c')]=this[_0xbf15('0x1c')]?this[_0xbf15('0x1c')][_0xbf15('0x1d')](_0x577e44):_0x577e44();};function Dialer(_0x29e191,_0x324bb3){this[_0xbf15('0x1e')]=new Sequence();this[_0xbf15('0x1f')]=_0x324bb3;this[_0xbf15('0x20')]=_0x29e191[_0xbf15('0x20')];this['campaigns']=_0x29e191['campaigns'];this['agents']=_0x29e191['agents'];this[_0xbf15('0x21')]=_0x29e191[_0xbf15('0x21')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0xbf15('0x22')]={};this[_0xbf15('0x23')]={};this[_0xbf15('0x24')]={};this[_0xbf15('0x25')]={};this[_0xbf15('0x26')]={};this[_0xbf15('0x27')]={};this['startProgressive']={};this[_0xbf15('0x28')]={};this[_0xbf15('0x29')]={};this[_0xbf15('0x2a')]={};this[_0xbf15('0x2b')]={};ami['on'](_0xbf15('0x2c'),this[_0xbf15('0x2d')][_0xbf15('0x2e')](this));ami['on'](_0xbf15('0x2f'),this['syncQueueCallerAbandon'][_0xbf15('0x2e')](this));ami['on'](_0xbf15('0x30'),this[_0xbf15('0x31')][_0xbf15('0x2e')](this));ami['on']('agentcomplete',this[_0xbf15('0x32')][_0xbf15('0x2e')](this));ami['on'](_0xbf15('0x33'),this[_0xbf15('0xd')][_0xbf15('0x2e')](this));ami['on'](_0xbf15('0x34'),this['syncQueueSummaryComplete'][_0xbf15('0x2e')](this));ami['on'](_0xbf15('0x35'),this['syncHangup'][_0xbf15('0x2e')](this));ami['on'](_0xbf15('0x36'),this['syncNewExten'][_0xbf15('0x2e')](this));ami['on'](_0xbf15('0x37'),this[_0xbf15('0x38')]['bind'](this));ami['on'](_0xbf15('0x39'),this[_0xbf15('0x3a')][_0xbf15('0x2e')](this));ami['on'](_0xbf15('0x3b'),this['syncQueueStatusComplete'][_0xbf15('0x2e')](this));this[_0xbf15('0x3c')]();this[_0xbf15('0x3d')]();RpcSetting['getSettings']()[_0xbf15('0x3e')](function(_0x44e8b1){previewRecallmeReminderInterval=_0x44e8b1[_0xbf15('0x3f')];});}function isNotNull(_0x540957){return _0x540957!==null&&!_[_0xbf15('0x40')](_0x540957);}function msgResponse(_0x21e6a1,_0x30b54d,_0x3860d9){return{'action':_0x21e6a1,'response':_0x30b54d,'message':_0x3860d9,'stack':_0x3860d9};}function emit(_0x25b701,_0x20aeea,_0x449aab){io['to'](_0x25b701)['emit'](_0x20aeea,_0x449aab);}function emitOutboundVoiceQueueSummary(_0x183029){if(_0x183029[_0xbf15('0x41')]==='outbound'){logger[_0xbf15('0x42')](_0xbf15('0x43'),util[_0xbf15('0x44')](_0x183029,{'showHidden':![],'depth':null}));emit(util[_0xbf15('0x45')]('voice:queue:%s',_0x183029['name']),_0xbf15('0x46'),_0x183029);}}function checkGetDataPredictive(_0x53fbe4){if(isNotNull(_0x53fbe4)&&!_[_0xbf15('0x47')](_0x53fbe4)){loggerPredictive[_0xbf15('0x48')](_0xbf15('0x49'));loggerPredictive[_0xbf15('0x48')](_0xbf15('0x4a'),_0x53fbe4[_0xbf15('0x4b')]);loggerPredictive[_0xbf15('0x48')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53fbe4[_0xbf15('0x4c')]);loggerPredictive[_0xbf15('0x48')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53fbe4[_0xbf15('0x4d')]);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x4e'),_0x53fbe4[_0xbf15('0x4f')]);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x50'),_0x53fbe4[_0xbf15('0x51')]);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x52'),_0x53fbe4[_0xbf15('0x53')]);loggerPredictive[_0xbf15('0x48')]('---------------------------');if(_0x53fbe4[_0xbf15('0x4b')]>0x0){if(!_[_0xbf15('0x40')](_0x53fbe4[_0xbf15('0x53')])&&_0x53fbe4['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xbf15('0x48')](_0xbf15('0x54'));if(!_[_0xbf15('0x40')](_0x53fbe4['predictiveIntervalAvgHoldtime'])&&_0x53fbe4[_0xbf15('0x51')]>0x0){return!![];}loggerPredictive[_0xbf15('0x48')](_0xbf15('0x55'));}else{loggerPredictive[_0xbf15('0x48')](_0xbf15('0x56'));}}else{loggerPredictive[_0xbf15('0x48')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2a077f){return function(_0x23c1a5){loggerPredictive[_0xbf15('0x48')](_0xbf15('0x57'));loggerPredictive[_0xbf15('0x48')](_0xbf15('0x58'),_0x23c1a5['erlangCalls']);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x59'),_0x23c1a5[_0xbf15('0x5a')]);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x5b'),_0x23c1a5['erlangAbandonmentRate']);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x5c'),_0x23c1a5[_0xbf15('0x5d')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23c1a5[_0xbf15('0x5e')]);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x5f'));_['merge'](_0x2a077f,_0x23c1a5);};}function ifInterval(_0x2a023e,_0x2bb26b){if(_[_0xbf15('0x40')](_0x2bb26b)){return![];}return utils[_0xbf15('0x60')](undefined,_0x2bb26b)<_0x2a023e*0x3c;}function clearPredictiveAttributes(_0x3f8057){if(_0x3f8057['startProgressive']){_0x3f8057[_0xbf15('0x61')]=undefined;loggerPredictive[_0xbf15('0x42')](_0x3f8057[_0xbf15('0x62')],_0xbf15('0x63'));}if(_0x3f8057[_0xbf15('0x27')]){_0x3f8057['startPredictive']=undefined;loggerPredictive[_0xbf15('0x42')](_0x3f8057['name'],_0xbf15('0x64'));}if(_0x3f8057[_0xbf15('0x65')]){clearInterval(_0x3f8057['handlePredictive']);_0x3f8057['handlePredictive']=undefined;loggerPredictive[_0xbf15('0x42')](_0x3f8057[_0xbf15('0x62')],_0xbf15('0x66'));}}function loggerCatchPredictive(_0x3f7839,_0x37195d){return function(_0x13d229){loggerPredictive[_0xbf15('0x67')](_0x37195d[_0xbf15('0x62')],_0x3f7839);loggerPredictive[_0xbf15('0x67')](_0x13d229[_0xbf15('0x68')]);clearPredictiveAttributes(_0x37195d);};}function loggerCatch(_0x1a6eda){return function(_0x1300b5){logger['error'](_0x1a6eda,util[_0xbf15('0x44')](_0x1300b5,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x8b6a61,_0x3da51d,_0x400472){return function(_0x356184){utils[_0xbf15('0x69')](_0x3da51d,_0x400472,0x0);_0x3da51d[_0xbf15('0x6a')]=0x0;logger[_0xbf15('0x67')](_0x8b6a61,util['inspect'](_0x356184,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3feb3b){return function(_0x458198){if(isNotNull(_0x458198)&&isNotNull(_0x458198[0x0])){if(_0x458198[0x0][_0xbf15('0x6b')]>0x0){_0x3feb3b['message']=utils[_0xbf15('0x6c')][_0xbf15('0x6d')];logger[_0xbf15('0x48')](_0xbf15('0x6e')+_0x3feb3b[_0xbf15('0x62')],_0x458198[0x0][_0xbf15('0x6b')],_0xbf15('0x6f'));}else{_0x3feb3b[_0xbf15('0x70')]=utils[_0xbf15('0x6c')][_0xbf15('0x71')];logger[_0xbf15('0x48')](_0xbf15('0x72')+_0x3feb3b['name']);}}};}function createObjHistory(_0x175cc5,_0x14b547,_0x175ef4,_0x1bbfd5,_0x355f56){_0x175cc5['message']=_0x175ef4;var _0x4790fb=new Action(_0x175cc5,_0x14b547);var _0x514cd5=new History(_0x4790fb);_0x514cd5[_0xbf15('0x73')]=_0x1bbfd5;_0x514cd5['statedesc']=_0x355f56;_0x514cd5[_0xbf15('0x74')]=_0x4790fb['starttime'];return _0x514cd5;}function unlockQueueStatus(_0x467911,_0x4666dc){setTimeout(function(){if(_['isUndefined'](_0x467911[_0xbf15('0x75')])){loggerBooked[_0xbf15('0x67')]('[unlockQueueStatus][undefined]',_0x4666dc);}_0x467911[_0xbf15('0x75')]=!![];loggerBooked['info'](_0xbf15('0x76'),_0x4666dc,JSON[_0xbf15('0x77')](_[_0xbf15('0x78')](_0x467911,[_0xbf15('0x62'),_0xbf15('0x75')])));},0x1f3);}function checkInterval(_0x3dd497){return function(){if(!isNotNull(_0x3dd497[_0xbf15('0x79')])){_0x3dd497[_0xbf15('0x70')]=utils[_0xbf15('0x6c')][_0xbf15('0x7a')];throw _0x3dd497[_0xbf15('0x62')]+_0xbf15('0x7b');}if(!isNotNull(_0x3dd497[_0xbf15('0x79')]['Intervals'])){_0x3dd497[_0xbf15('0x70')]=utils[_0xbf15('0x6c')][_0xbf15('0x7a')];throw _0x3dd497['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xbf15('0x47')](_0x3dd497['Interval']['Intervals']))){_0x3dd497[_0xbf15('0x70')]=utils[_0xbf15('0x6c')][_0xbf15('0x7a')];throw _0x3dd497[_0xbf15('0x62')]+_0xbf15('0x7b');}};}function checkIsIVRCampaignActive(_0x5c3e01){return function(){if(!utils[_0xbf15('0x7c')](_0x5c3e01)){_0x5c3e01[_0xbf15('0x70')]=utils[_0xbf15('0x6c')][_0xbf15('0x7d')];throw _0x5c3e01[_0xbf15('0x62')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x2f5d06){if(utils[_0xbf15('0x7e')](_0x2f5d06)){emit(util[_0xbf15('0x45')]('campaign:ivr:%s',_0x2f5d06[_0xbf15('0x62')]),'campaign:save',_0x2f5d06);}}function loggerCatchQueueSummary(_0x29adca,_0x5eeaab){return function(_0x53bc90){clearPredictiveAttributes(_0x5eeaab);emitCampaignSummary(_0x5eeaab);loggerSyncQueueSummary[_0xbf15('0x42')](_0x29adca,util[_0xbf15('0x44')](_0x53bc90,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x494c03){if(_0x494c03['sendMessageOneNotActive']){if(_0x494c03[_0xbf15('0x7f')]===0x0){_0x494c03[_0xbf15('0x80')]=![];_0x494c03[_0xbf15('0x70')]=utils[_0xbf15('0x6c')][_0xbf15('0x7d')];loggerSyncQueueSummary[_0xbf15('0x42')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x494c03[_0xbf15('0x62')],_0xbf15('0x81'));}else{_0x494c03['message']=utils[_0xbf15('0x6c')][_0xbf15('0x82')];loggerSyncQueueSummary['debug'](_0xbf15('0x83'),_0x494c03[_0xbf15('0x62')],'is\x20disactive');}emitCampaignSummary(_0x494c03);}}function myreject(_0xf832be){return function(_0x5f20f8){return _0xf832be(msgResponse(_0xbf15('0x84'),_0xbf15('0x85'),JSON[_0xbf15('0x77')](_0x5f20f8)));};}Dialer[_0xbf15('0x1a')]['isTrunkReachable']=function(_0x382f35){return!_[_0xbf15('0x40')](_0x382f35)&&_0x382f35&&!_['isUndefined'](_0x382f35[_0xbf15('0x62')])&&!_[_0xbf15('0x40')](_0x382f35[_0xbf15('0x86')])&&_0x382f35[_0xbf15('0x86')]&&(this[_0xbf15('0x21')][util[_0xbf15('0x45')]('SIP/%s',_0x382f35['name'])][_0xbf15('0x87')]===_0xbf15('0x88')||this[_0xbf15('0x21')][util['format'](_0xbf15('0x89'),_0x382f35[_0xbf15('0x62')])][_0xbf15('0x87')]===_0xbf15('0x8a'));};Dialer[_0xbf15('0x1a')][_0xbf15('0x8b')]=function(_0x3bda9c){var _0x3fbf0c=this;return function(){if(!_0x3fbf0c[_0xbf15('0x8c')](_0x3bda9c['Trunk'])){if(!_0x3fbf0c['isTrunkReachable'](_0x3bda9c['TrunkBackup'])){_0x3bda9c[_0xbf15('0x70')]=utils['CAMPAIGN_STATUS'][_0xbf15('0x8d')];throw _0x3bda9c[_0xbf15('0x62')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0xbf15('0x8e')]=function(_0x57f695,_0x15b784,_0x42a555,_0x33329e){var _0x1dcf11=this;return function(){var _0x31eb4d=!![];return _0x1dcf11[_0xbf15('0x8f')](_0x57f695,_0x15b784,_0x42a555,_0x33329e,_0x31eb4d);};};Dialer[_0xbf15('0x1a')][_0xbf15('0x90')]=function(_0x26720f,_0x549153,_0x1566da,_0x52def7){var _0x1c9151=this;return function(){var _0xcbf75=![];return _0x1c9151[_0xbf15('0x8f')](_0x26720f[_0xbf15('0x91')],_0x549153,_0x1566da,_0x52def7,_0xcbf75);};};Dialer['prototype']['ifTimeIvr']=function(_0x576263,_0x2c0df1,_0x1f3b56,_0x34e757,_0x1ffd8a){var _0x44e7e5=[];return new Promise(function(_0x1703ae,_0xf7ab6){if(!isNotNull(_0x576263)){_0x34e757[_0xbf15('0x70')]=utils['CAMPAIGN_STATUS'][_0xbf15('0x7a')];return _0xf7ab6(msgResponse(_0xbf15('0x92'),_0xbf15('0x93'),_0x1f3b56+'\x20Intervals\x20is\x20null\x20'));}if(_[_0xbf15('0x47')](_0x576263)){_0x34e757[_0xbf15('0x70')]=utils[_0xbf15('0x6c')]['EMPTY_INTERVAL'];return _0xf7ab6(msgResponse('ifTime',_0xbf15('0x93'),_0x1f3b56+_0xbf15('0x94')));}if(_0x2c0df1&&_[_0xbf15('0x40')](config[_0xbf15('0x95')][_0x2c0df1])){_0x34e757['message']=utils[_0xbf15('0x6c')][_0xbf15('0x96')];return _0xf7ab6(msgResponse(_0xbf15('0x92'),_0xbf15('0x93'),_0x1f3b56+'\x20Timezone\x20unknow\x20'+_0x2c0df1));}if(_['isArray'](_0x576263)){for(var _0x5c2fb1=0x0;_0x5c2fb1<_0x576263[_0xbf15('0x97')];_0x5c2fb1+=0x1){_0x44e7e5['push'](ami['Action']({'action':_0xbf15('0x98'),'command':util[_0xbf15('0x45')](_0xbf15('0x99'),_0x576263[_0x5c2fb1][_0xbf15('0x9a')],!_[_0xbf15('0x40')](config[_0xbf15('0x95')][_0x2c0df1])?_0x2c0df1:'')})[_0xbf15('0x3e')](function(_0x497103){return _0x497103[_0xbf15('0x9b')]['indexOf'](_0xbf15('0x9c'))>=0x0;})[_0xbf15('0x9d')](myreject(_0xf7ab6)));}}else{_0x44e7e5[_0xbf15('0x9e')](ami[_0xbf15('0x9f')]({'action':_0xbf15('0x98'),'command':util['format'](_0xbf15('0x99'),_0x576263,!_[_0xbf15('0x40')](config['timezones'][_0x2c0df1])?_0x2c0df1:'')})['then'](function(_0x16de96){return _0x16de96['content']['indexOf'](_0xbf15('0x9c'))>=0x0;})[_0xbf15('0x9d')](myreject(_0xf7ab6)));}Promise[_0xbf15('0xa0')](_0x44e7e5)[_0xbf15('0x3e')](function(_0x3cecf2){var _0x37ae06=_[_0xbf15('0xa1')](_0x3cecf2);if(_0x37ae06){return _0x1703ae(_0x37ae06);}else{_0x34e757['message']=_0x1ffd8a?utils[_0xbf15('0x6c')][_0xbf15('0xa2')]:utils[_0xbf15('0x6c')][_0xbf15('0xa3')];return _0xf7ab6(msgResponse('[ifTime][promiseAll]',_0xbf15('0x93'),_0xbf15('0xa4')+_0x1ffd8a+'\x20'+_0x1f3b56+_0xbf15('0xa5')+util[_0xbf15('0x44')](_0x576263,{'showHidden':![],'depth':null})+_0xbf15('0xa6')+_0x2c0df1));}})[_0xbf15('0x9d')](function(_0x229944){return _0xf7ab6(msgResponse('ifTime','Failure',JSON['stringify'](_0x229944)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x31aee2=this;return cmHopper[_0xbf15('0xa7')]({'active':![]},{'where':{'active':!![]}})[_0xbf15('0x3e')](function(){setInterval(function(){_0x31aee2['syncCampaigns']();},0x3e8);});};Dialer[_0xbf15('0x1a')][_0xbf15('0xa8')]=function(){var _0x2dca7a=this;var _0xb53ffa;for(var _0x133e43 in this['campaigns']){if(typeof this[_0xbf15('0xa9')][_0x133e43]!=='undefined'){_0xb53ffa=this[_0xbf15('0xa9')][_0x133e43];if(utils['isIVRCampaign'](_0xb53ffa)&&utils[_0xbf15('0x7c')](_0xb53ffa)){_0xb53ffa[_0xbf15('0x80')]=!![];Promise[_0xbf15('0xaa')]()[_0xbf15('0x3e')](checkIsIVRCampaignActive(_0xb53ffa))['then'](checkInterval(_0xb53ffa))[_0xbf15('0x3e')](_0x2dca7a['checkIsTrunkReachable'](_0xb53ffa))[_0xbf15('0x3e')](_0x2dca7a[_0xbf15('0x8e')](_0xb53ffa[_0xbf15('0xab')],_0xb53ffa[_0xbf15('0xac')],_0xb53ffa[_0xbf15('0x62')],_0xb53ffa))[_0xbf15('0x3e')](_0x2dca7a[_0xbf15('0x90')](_0xb53ffa['Interval'],_0xb53ffa[_0xbf15('0xac')],_0xb53ffa[_0xbf15('0x62')],_0xb53ffa))[_0xbf15('0x3e')](_0x2dca7a['launchHandleIvr'](_0xb53ffa))[_0xbf15('0x9d')](loggerCatchQueueSummary(_0xbf15('0xad'),_0xb53ffa));}else{notSendMessagesCampaign(_0xb53ffa);}}}};Dialer[_0xbf15('0x1a')][_0xbf15('0xae')]=function(_0xee19ae){if(_0xee19ae[_0xbf15('0xaf')]!=='predictive'){clearPredictiveAttributes(_0xee19ae);}switch(_0xee19ae[_0xbf15('0xaf')]){case _0xbf15('0xb0'):this[_0xbf15('0xb1')](_0xee19ae,0x1);break;case _0xbf15('0xb2'):this['handlePower'](_0xee19ae,_0xee19ae['dialPowerLevel']);break;case'predictive':this[_0xbf15('0xb')](_0xee19ae);break;case _0xbf15('0xa'):this['handlePower'](_0xee19ae,0x1);break;default:logger['error'](_0xbf15('0xb3'),_0xee19ae[_0xbf15('0x62')],_0xbf15('0xb4'));}};Dialer[_0xbf15('0x1a')]['ifTime']=function(_0x21e4b4,_0x114525){var _0x42e114=_0x21e4b4['dialTimezone'];var _0x5817b6=_0x114525?_0x21e4b4[_0xbf15('0xab')]:_0x21e4b4[_0xbf15('0x79')]['Intervals'];logger[_0xbf15('0xb5')](_0xbf15('0xb6'),_0x5817b6,_0x42e114,_0x21e4b4[_0xbf15('0x62')],util['format'](_0xbf15('0xb7'),_0x21e4b4[_0xbf15('0x62')],_0x21e4b4['id']));var _0x584505=null;return Interval[_0xbf15('0xb8')](_0x5817b6,_0x42e114)[_0xbf15('0x3e')](function(_0x1fc8df){if(_0x1fc8df===!![]){return _0x1fc8df;}else{_0x21e4b4['message']=_0x114525?utils[_0xbf15('0x6c')][_0xbf15('0xa2')]:utils['CAMPAIGN_STATUS'][_0xbf15('0xa3')];_0x584505=msgResponse(_0xbf15('0xb9'),'Failure',_0xbf15('0xa4')+_0x114525+'\x20'+_0x21e4b4[_0xbf15('0x62')]+_0xbf15('0xa5')+util[_0xbf15('0x44')](_0x5817b6,{'showHidden':![],'depth':null})+_0xbf15('0xa6')+_0x42e114);}if(_0x584505!==null){logger['silly'](_0xbf15('0xba'),_0x584505);_0x584505[_0xbf15('0xbb')]=_0x114525;throw _0x584505;}})[_0xbf15('0x9d')](function(_0x36500c){logger[_0xbf15('0x67')](_0xbf15('0xbc'),_0x36500c);throw msgResponse(_0xbf15('0x84'),'Error',util['inspect'](_0x36500c,{'showHidden':![],'depth':null}));});};Dialer[_0xbf15('0x1a')][_0xbf15('0x2d')]=function(_0x296dc1){if(this['voiceQueues'][_0x296dc1['queue']]){if(this[_0xbf15('0x25')][_0x296dc1[_0xbf15('0xbd')]]&&this['uniqueId'][_0x296dc1[_0xbf15('0xbd')]][_0xbf15('0x41')]!==_0xbf15('0xbe')){this[_0xbf15('0xbf')](this['voiceQueues'][_0x296dc1[_0xbf15('0xc0')]]);this['uniqueId'][_0x296dc1[_0xbf15('0xbd')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xbf15('0x1a')][_0xbf15('0x32')]=function(_0x1921f6){var _0x4b411e=this['uniqueId'][_0x1921f6[_0xbf15('0xbd')]];if(this[_0xbf15('0x20')][_0x1921f6[_0xbf15('0xc0')]]){if(_0x4b411e&&_0x4b411e[_0xbf15('0x41')]!=='ivr'){delete this['uniqueId'][_0x1921f6['uniqueid']];this[_0xbf15('0x20')][_0x1921f6[_0xbf15('0xc0')]][_0xbf15('0xc1')]+=0x1;var _0x3f3e0b=new AgentComplete(_0x4b411e,_0x1921f6);if(_0x1921f6[_0xbf15('0xc2')]===_0xbf15('0xc3')){_0x3f3e0b[_0xbf15('0xc4')]=this['voiceQueues'][_0x1921f6[_0xbf15('0xc0')]][_0xbf15('0xc5')]&&this[_0xbf15('0x20')][_0x1921f6['queue']][_0xbf15('0xc6')]?moment()[_0xbf15('0x45')](_0xbf15('0xc7')):undefined;}hopperUtils[_0xbf15('0xc8')](_0x3f3e0b)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0xc9')));hopperUtils['moveContactManagedDialer'](_0x3f3e0b)['catch'](loggerCatch(_0xbf15('0xca')));}}};Dialer[_0xbf15('0x1a')][_0xbf15('0xcb')]=function(_0x26b693){var _0x488a5f=this[_0xbf15('0x25')][_0x26b693['uniqueid']];var _0x3172e5=this;var _0x1c3cea=![];var _0x5649c0;var _0x206b1d;if(this[_0xbf15('0x20')][_0x26b693['queue']]){if(_0x488a5f&&_0x488a5f[_0xbf15('0x41')]!==_0xbf15('0xbe')){delete this[_0xbf15('0x25')][_0x26b693['uniqueid']];this[_0xbf15('0xbf')](this[_0xbf15('0x20')][_0x26b693[_0xbf15('0xc0')]]);_0x488a5f[_0xbf15('0xcc')]=moment()[_0xbf15('0x45')](_0xbf15('0xc7'));var _0x1803fc=new QueueCallerAbandon(_0x488a5f,_0x26b693);if(utils['getSeconds'](_0x488a5f[_0xbf15('0xcc')],_0x488a5f[_0xbf15('0xcd')])>=_0x488a5f[_0xbf15('0xce')]){this['voiceQueues'][_0x26b693[_0xbf15('0xc0')]][_0xbf15('0x4d')]+=0x1;this[_0xbf15('0x20')][_0x26b693['queue']][_0xbf15('0xcf')]+=0x1;this['voiceQueues'][_0x26b693[_0xbf15('0xc0')]][_0xbf15('0xd0')]+=0x1;_0x1803fc['state']=0xa;_0x1803fc[_0xbf15('0xd1')]=_0xbf15('0xd2');_0x1803fc[_0xbf15('0xd3')]=_0xbf15('0xd4');_0x1803fc[_0xbf15('0xc4')]=this[_0xbf15('0x20')][_0x26b693[_0xbf15('0xc0')]]['dialQueueProject2']?moment()[_0xbf15('0x45')](_0xbf15('0xc7')):undefined;_0x1803fc[_0xbf15('0xd5')]+=0x1;_0x1803fc[_0xbf15('0xd6')]+=0x1;_0x5649c0=this[_0xbf15('0x20')][_0x26b693['queue']][_0xbf15('0xd7')];_0x206b1d=this[_0xbf15('0x20')][_0x26b693[_0xbf15('0xc0')]][_0xbf15('0xd8')];hopperUtils[_0xbf15('0xd9')](_0x1803fc,_0x1803fc[_0xbf15('0x73')],_0x488a5f[_0xbf15('0xda')])[_0xbf15('0x3e')](function(_0x56428e){_0x1c3cea=_0x56428e[_0xbf15('0xdb')]==0x1;if(_0x1803fc[_0xbf15('0xd5')]>=_0x3172e5[_0xbf15('0x20')][_0x26b693[_0xbf15('0xc0')]]['dialDropMaxRetry']){_0x3172e5[_0xbf15('0xdc')](_0x1803fc,_0x56428e[_0xbf15('0xdb')]);}else{hopperUtils[_0xbf15('0xdd')]({'active':![],'countdropretry':_0x1803fc[_0xbf15('0xd5')],'scheduledat':moment()[_0xbf15('0xde')](_0x3172e5[_0xbf15('0x20')][_0x26b693[_0xbf15('0xc0')]][_0xbf15('0xd7')],_0xbf15('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x488a5f[_0xbf15('0xe0')],'ListId':_0x488a5f[_0xbf15('0xe1')],'VoiceQueueId':_0x488a5f[_0xbf15('0xe2')]||undefined,'CampaignId':_0x488a5f['CampaignId']||undefined})[_0xbf15('0x9d')](loggerCatch(_0xbf15('0xe3')));var _0x521479=new History(_0x1803fc);_0x521479[_0xbf15('0x73')]=0xa;_0x521479[_0xbf15('0xd1')]=_0xbf15('0xd2');_0x521479[_0xbf15('0xe4')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x521479['endtime']=_0x521479[_0xbf15('0xe4')];_0x521479[_0xbf15('0xe5')]=_0x1803fc['calleridname'];_0x521479[_0xbf15('0xe6')]=_0x1803fc[_0xbf15('0xe6')];hopperUtils[_0xbf15('0xc8')](_0x521479)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0xe7')));}})[_0xbf15('0x3e')](function(){if(_0x1c3cea)hopperUtils['swapAdditionalPhones'](_0x1803fc,_0x5649c0,_0x206b1d)[_0xbf15('0x3e')](function(){return 0x1;});});}else{this[_0xbf15('0x20')][_0x26b693[_0xbf15('0xc0')]][_0xbf15('0x4f')]+=0x1;this[_0xbf15('0x20')][_0x26b693['queue']][_0xbf15('0xe8')]+=0x1;_0x1803fc[_0xbf15('0x73')]=0xb;_0x1803fc[_0xbf15('0xd1')]=_0xbf15('0xe9');_0x1803fc[_0xbf15('0xd3')]=_0xbf15('0xea');_0x1803fc['countabandonedretry']+=0x1;_0x1803fc[_0xbf15('0xd6')]+=0x1;_0x5649c0=this[_0xbf15('0x20')][_0x26b693[_0xbf15('0xc0')]][_0xbf15('0xeb')];_0x206b1d=this['voiceQueues'][_0x26b693[_0xbf15('0xc0')]][_0xbf15('0xd8')];hopperUtils['verifyAdditionalPhones'](_0x1803fc,_0x1803fc['state'],_0x488a5f[_0xbf15('0xda')])[_0xbf15('0x3e')](function(_0x4e7198){if(_0x1803fc[_0xbf15('0xec')]>=_0x3172e5[_0xbf15('0x20')][_0x26b693[_0xbf15('0xc0')]][_0xbf15('0xed')]){_0x3172e5['queueCallerAbandonCreateState'](_0x1803fc,_0x4e7198['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1803fc['countabandonedretry'],'scheduledat':moment()[_0xbf15('0xde')](_0x3172e5['voiceQueues'][_0x26b693[_0xbf15('0xc0')]][_0xbf15('0xeb')],_0xbf15('0xdf'))[_0xbf15('0x45')](_0xbf15('0xc7')),'ContactId':_0x488a5f[_0xbf15('0xe0')],'ListId':_0x488a5f[_0xbf15('0xe1')],'VoiceQueueId':_0x488a5f[_0xbf15('0xe2')]||undefined,'CampaignId':_0x488a5f[_0xbf15('0xee')]||undefined})[_0xbf15('0x9d')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x23964b=new History(_0x1803fc);_0x23964b['state']=0xb;_0x23964b['statedesc']='Abandoned';_0x23964b[_0xbf15('0xe4')]=moment()[_0xbf15('0x45')](_0xbf15('0xc7'));_0x23964b[_0xbf15('0x74')]=_0x23964b[_0xbf15('0xe4')];_0x23964b[_0xbf15('0xe5')]=_0x1803fc['calleridname'];_0x23964b[_0xbf15('0xe6')]=_0x1803fc[_0xbf15('0xe6')];hopperUtils['createHistory'](_0x23964b)['catch'](loggerCatch(_0xbf15('0xef')));}})[_0xbf15('0x3e')](function(){if(_0x1c3cea)hopperUtils[_0xbf15('0xf0')](_0x1803fc,_0x5649c0,_0x206b1d)[_0xbf15('0x3e')](function(){return 0x1;});});}}}};Dialer[_0xbf15('0x1a')][_0xbf15('0xf1')]=function(_0x47db6f){if(this['actions'][_0x47db6f[_0xbf15('0xbd')]]){this['actions'][_0x47db6f['uniqueid']][_0xbf15('0xf2')]=_0x47db6f[_0xbf15('0xf2')];}if(this[_0xbf15('0x25')][_0x47db6f[_0xbf15('0xbd')]]){this[_0xbf15('0x25')][_0x47db6f[_0xbf15('0xbd')]][_0xbf15('0xf2')]=_0x47db6f[_0xbf15('0xf2')];}};Dialer[_0xbf15('0x1a')]['syncQueueMember']=function(_0x5359be){if(!this[_0xbf15('0x23')][_0x5359be['actionid']]){return;}var _0xbd1f89=this[_0xbf15('0x20')][this[_0xbf15('0x23')][_0x5359be[_0xbf15('0xf3')]][_0xbf15('0xc0')]][_0xbf15('0xf4')]||_0xbf15('0xf5');if(_0xbd1f89===_0xbf15('0xf6')){if(this[_0xbf15('0x23')][_0x5359be[_0xbf15('0xf3')]]&&_[_0xbf15('0xf7')](this[_0xbf15('0x23')][_0x5359be[_0xbf15('0xf3')]]['locked'])&&_0x5359be[_0xbf15('0x87')]==='1'&&_0x5359be['paused']==='0'){if(this['agents'][_0x5359be[_0xbf15('0xf8')]]){if(!this['agents'][_0x5359be['stateinterface']]['locked']){this['agents'][_0x5359be[_0xbf15('0xf8')]][_0xbf15('0xf9')]=!![];this[_0xbf15('0x23')][_0x5359be['actionid']][_0xbf15('0xf9')]=!![];this['actions'][_0x5359be[_0xbf15('0xf3')]][_0xbf15('0xf8')]=_0x5359be['stateinterface'];}}}}else if(_0xbd1f89===_0xbf15('0xf5')){if(this[_0xbf15('0x23')][_0x5359be[_0xbf15('0xf3')]]){if(this[_0xbf15('0xfa')][_0x5359be[_0xbf15('0xf8')]]){this['actions'][_0x5359be[_0xbf15('0xf3')]][_0xbf15('0xf8')]=_0x5359be['stateinterface'];if(_[_0xbf15('0xf7')](this['queueBooked'][this[_0xbf15('0x23')][_0x5359be[_0xbf15('0xf3')]][_0xbf15('0xc0')]])){this[_0xbf15('0x29')][this[_0xbf15('0x23')][_0x5359be[_0xbf15('0xf3')]]['queue']]=[];}this['queueBooked'][this[_0xbf15('0x23')][_0x5359be[_0xbf15('0xf3')]][_0xbf15('0xc0')]][_0xbf15('0x9e')](_[_0xbf15('0xfb')](_[_0xbf15('0x78')](this[_0xbf15('0x23')][_0x5359be['actionid']],[_0xbf15('0xfc'),_0xbf15('0xf8')]),{'status':_0x5359be['status'],'paused':_0x5359be[_0xbf15('0xfd')]}));}}}};Dialer[_0xbf15('0x1a')]['syncQueueStatusComplete']=function(_0x5a7f87){if(!this[_0xbf15('0x23')][_0x5a7f87['actionid']]){return;}var _0x502354=this;var _0x51a5a9=this[_0xbf15('0x20')][this['actions'][_0x5a7f87[_0xbf15('0xf3')]]['queue']];var _0x5b59d0=_0x51a5a9[_0xbf15('0xf4')]||_0xbf15('0xf5');if(_0x5b59d0===_0xbf15('0xf6')){if(this[_0xbf15('0x23')][_0x5a7f87['actionid']]&&this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xf8')]){this['preview'][_0xbf15('0xfe')](this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xfc')],this['actions'][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xf8')])[_0xbf15('0x9d')](function(_0xdd905a){logger[_0xbf15('0x67')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0xdd905a,{'showHidden':![],'depth':null}));})['finally'](function(){_0x502354[_0xbf15('0xbf')](_0x502354[_0xbf15('0x20')][_0x502354['actions'][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xc0')]]);_0x502354[_0xbf15('0xfa')][_0x502354[_0xbf15('0x23')][_0x5a7f87['actionid']][_0xbf15('0xf8')]]['locked']=![];delete _0x502354['actions'][_0x5a7f87['actionid']];unlockQueueStatus(_0x51a5a9);});}else{this[_0xbf15('0xbf')](this['voiceQueues'][this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xc0')]]);hopperUtils[_0xbf15('0xdd')]({'active':![],'ContactId':this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xe0')],'ListId':this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xe1')],'VoiceQueueId':this[_0xbf15('0x23')][_0x5a7f87['actionid']][_0xbf15('0xe2')]||undefined,'CampaignId':this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xee')]||undefined})['catch'](loggerCatch(_0xbf15('0xff')));delete this['actions'][_0x5a7f87[_0xbf15('0xf3')]];unlockQueueStatus(_0x51a5a9);}}else if(_0x5b59d0===_0xbf15('0xf5')){var _0x195d4c;if(this[_0xbf15('0x23')][_0x5a7f87['actionid']]&&!_[_0xbf15('0x47')](this[_0xbf15('0x29')][this['actions'][_0x5a7f87['actionid']][_0xbf15('0xc0')]])){if(this['queueBookedRR'][_0x502354[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xc0')]]){this[_0xbf15('0x2a')][_0x502354[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xc0')]]=this[_0xbf15('0x2a')][this[_0xbf15('0x23')][_0x5a7f87['actionid']][_0xbf15('0xc0')]]?this[_0xbf15('0x2a')][this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xc0')]]:this[_0xbf15('0x29')][this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xc0')]]?this[_0xbf15('0x29')][this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]]['queue']]['_rr']||0x0:0x0;}this[_0xbf15('0x29')][this[_0xbf15('0x23')][_0x5a7f87['actionid']][_0xbf15('0xc0')]][_0xbf15('0x100')]=this[_0xbf15('0x2a')][this[_0xbf15('0x23')][_0x5a7f87[_0xbf15('0xf3')]][_0xbf15('0xc0')]];for(var _0x41b840=0x0;_0x41b840=_0x4e84ac['dialGlobalMaxRetry']){_0x1bbf10[_0xbf15('0x11f')](_0x5dbe62,_0x5d63ba,_0x2f08b7,_0xbf15('0x120'));}else{if(_0x5dbe62[_0xbf15('0x121')]>=_0x4e84ac[_0xbf15('0x122')]){_0x1bbf10[_0xbf15('0x123')](_0x5dbe62,_0x5d63ba,_0x2f08b7,_0xbf15('0x124'));}else{hopperUtils[_0xbf15('0xdd')]({'active':![],'countmachineretry':_0x5dbe62['countmachineretry'],'scheduledat':moment()[_0xbf15('0xde')](_0x4e84ac['dialMachineRetryFrequency'],_0xbf15('0xdf'))[_0xbf15('0x45')](_0xbf15('0xc7')),'ContactId':_0x5dbe62[_0xbf15('0xe0')],'ListId':_0x5dbe62[_0xbf15('0xe1')],'VoiceQueueId':_0x5dbe62[_0xbf15('0xe2')]||undefined,'CampaignId':_0x5dbe62[_0xbf15('0xee')]||undefined})['catch'](loggerCatch(_0xbf15('0x125')));_0x5d63ba({'reschedule':0x1});}}});}if(_0x3758ef[_0xbf15('0x41')]===_0xbf15('0xbe')&&this[_0xbf15('0xa9')][_0x3758ef[_0xbf15('0xc0')]][_0xbf15('0x10c')]&&_0x19eff3['value']===_0xbf15('0x10e')){delete this[_0xbf15('0x25')][_0x19eff3['uniqueid']];this[_0xbf15('0xbf')](this[_0xbf15('0xa9')][_0x3758ef[_0xbf15('0xc0')]]);_0x70110c=new Hangup(_0x3758ef,_0x19eff3);_0x70110c[_0xbf15('0x73')]=0x12;_0x70110c[_0xbf15('0xd1')]=_0xbf15('0x110');_0x70110c[_0xbf15('0x118')]='AMD';ami[_0xbf15('0x119')](_0xbf15('0x112'),ut[_0xbf15('0x113')](_0x70110c,_0xbf15('0x114')));this['saveInDb'](_0x70110c,'[syncHangupInAMDIvr][createHistory]',_0xbf15('0x126'));}if(_0x3758ef[_0xbf15('0x41')]===_0xbf15('0xbe')&&this[_0xbf15('0xa9')][_0x3758ef[_0xbf15('0xc0')]][_0xbf15('0x10c')]&&_0x19eff3[_0xbf15('0x10d')]==='MACHINE'){return new Promise(function(_0xb8caa6,_0x2d1d85){delete _0x1bbf10[_0xbf15('0x25')][_0x19eff3[_0xbf15('0xbd')]];_0x1bbf10['updateOriginated'](_0x1bbf10[_0xbf15('0xa9')][_0x3758ef[_0xbf15('0xc0')]]);_0x1bbf10[_0xbf15('0xa9')][_0x3758ef[_0xbf15('0xc0')]][_0xbf15('0xc1')]+=0x1;_0x1bbf10['campaigns'][_0x3758ef[_0xbf15('0xc0')]][_0xbf15('0x10f')]+=0x1;var _0x4cb4c3=_0x1bbf10['campaigns'][_0x3758ef[_0xbf15('0xc0')]];var _0x36a90b=new Hangup(_0x3758ef,_0x19eff3);_0x36a90b[_0xbf15('0x73')]=0x13;_0x36a90b[_0xbf15('0xd1')]=_0xbf15('0x117');_0x36a90b[_0xbf15('0x118')]=_0xbf15('0x111');_0x36a90b[_0xbf15('0x121')]+=0x1;_0x36a90b[_0xbf15('0xd6')]+=0x1;_0x36a90b[_0xbf15('0x114')]=!![];ami['emit'](_0xbf15('0x112'),ut[_0xbf15('0x113')](_0x36a90b,_0xbf15('0x114')));hopperUtils[_0xbf15('0xc8')](_0x36a90b)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x11a')));if(_0x36a90b[_0xbf15('0x11b')]+_0x36a90b[_0xbf15('0x11c')]+_0x36a90b[_0xbf15('0x11d')]+_0x36a90b['countnosuchnumberretry']+_0x36a90b['countdropretry']+_0x36a90b[_0xbf15('0xec')]+_0x36a90b[_0xbf15('0x121')]+_0x36a90b['countagentrejectretry']>=_0x4cb4c3[_0xbf15('0x127')]){_0x1bbf10[_0xbf15('0x11f')](_0x36a90b,_0xb8caa6,_0x2d1d85,_0xbf15('0x120'));}else{if(_0x36a90b[_0xbf15('0x121')]>=_0x4cb4c3[_0xbf15('0x122')]){_0x1bbf10['createStateFinal'](_0x36a90b,_0xb8caa6,_0x2d1d85,'reason\x2019\x20machine....');}else{hopperUtils[_0xbf15('0xdd')]({'active':![],'countmachineretry':_0x36a90b[_0xbf15('0x121')],'scheduledat':moment()[_0xbf15('0xde')](_0x4cb4c3[_0xbf15('0x128')],'minutes')[_0xbf15('0x45')](_0xbf15('0xc7')),'ContactId':_0x36a90b[_0xbf15('0xe0')],'ListId':_0x36a90b[_0xbf15('0xe1')],'VoiceQueueId':_0x36a90b[_0xbf15('0xe2')]||undefined,'CampaignId':_0x36a90b[_0xbf15('0xee')]||undefined})['catch'](loggerCatch(_0xbf15('0x125')));_0xb8caa6({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xbf15('0x129')]=function(_0x5ae782){var _0x34f88b=this[_0xbf15('0x25')][_0x5ae782[_0xbf15('0xbd')]];var _0x50db2b;if(_0x34f88b&&_0x34f88b[_0xbf15('0x41')]===_0xbf15('0xbe')){delete this['uniqueId'][_0x5ae782['uniqueid']];this[_0xbf15('0xbf')](this['campaigns'][_0x34f88b[_0xbf15('0xc0')]]);this[_0xbf15('0xa9')][_0x34f88b['queue']][_0xbf15('0x12a')]+=0x1;_0x50db2b=new Hangup(_0x34f88b,_0x5ae782);hopperUtils[_0xbf15('0xc8')](_0x50db2b)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x12b')));hopperUtils[_0xbf15('0x12c')](_0x50db2b)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x12d')));}if(_0x34f88b&&_0x34f88b['type']!==_0xbf15('0xbe')&&isNotNull(this[_0xbf15('0x20')][_0x34f88b[_0xbf15('0xc0')]]['dialQueueProject'])){delete this[_0xbf15('0x25')][_0x5ae782[_0xbf15('0xbd')]];this[_0xbf15('0xbf')](this[_0xbf15('0x20')][_0x34f88b[_0xbf15('0xc0')]]);this[_0xbf15('0x20')][_0x34f88b[_0xbf15('0xc0')]]['outboundAnswerCallsDay']+=0x1;this[_0xbf15('0x20')][_0x34f88b[_0xbf15('0xc0')]][_0xbf15('0x10f')]+=0x1;_0x50db2b=new Hangup(_0x34f88b,_0x5ae782);_0x50db2b[_0xbf15('0x73')]=0x10;_0x50db2b[_0xbf15('0xd1')]='AnswerAGI';_0x50db2b[_0xbf15('0x118')]=_0xbf15('0x12e');hopperUtils[_0xbf15('0xc8')](_0x50db2b)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x12b')));hopperUtils[_0xbf15('0x12c')](_0x50db2b)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x12d')));}if(_0x34f88b&&_0x34f88b[_0xbf15('0x41')]!=='ivr'&&!isNotNull(this[_0xbf15('0x20')][_0x34f88b[_0xbf15('0xc0')]][_0xbf15('0x12f')])){if(_0x5ae782[_0xbf15('0x130')]===_0xbf15('0x131')){delete this[_0xbf15('0x25')][_0x5ae782['uniqueid']];this['voiceQueues'][_0x34f88b[_0xbf15('0xc0')]]['outboundAnswerCallsDay']+=0x1;const _0x59c415=new AgentComplete(_0x34f88b,_0x5ae782);_0x59c415[_0xbf15('0xee')]=this[_0xbf15('0x20')][_0x34f88b[_0xbf15('0xc0')]]['id'];hopperUtils[_0xbf15('0xc8')](_0x59c415)[_0xbf15('0x9d')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xbf15('0x12c')](_0x59c415)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0xca')));}else{delete this[_0xbf15('0x25')][_0x5ae782[_0xbf15('0xbd')]];this[_0xbf15('0xbf')](this[_0xbf15('0x20')][_0x34f88b[_0xbf15('0xc0')]]);this[_0xbf15('0x20')][_0x34f88b[_0xbf15('0xc0')]][_0xbf15('0x132')]+=0x1;_0x50db2b=new Hangup(_0x34f88b,_0x5ae782);_0x50db2b[_0xbf15('0x73')]=0xc;_0x50db2b[_0xbf15('0xd1')]=_0x5ae782[_0xbf15('0x130')];_0x50db2b[_0xbf15('0x118')]='Unknow';hopperUtils[_0xbf15('0xc8')](_0x50db2b)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x12b')));hopperUtils[_0xbf15('0x12c')](_0x50db2b)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x12d')));}}};Dialer[_0xbf15('0x1a')][_0xbf15('0xd')]=function(_0x1f3f64){var _0x1623e1=this;if(!_0x1623e1[_0xbf15('0x2b')][_0x1f3f64[_0xbf15('0x62')]]){_0x1623e1['queuesSummary'][_0x1f3f64[_0xbf15('0x62')]]={'running':![]};}else if(_0x1623e1[_0xbf15('0x2b')][_0x1f3f64[_0xbf15('0x62')]][_0xbf15('0x133')]===!![]){return;}else if(_0x1623e1[_0xbf15('0x2b')][_0x1f3f64[_0xbf15('0x62')]]['running']===![]){_0x1623e1[_0xbf15('0x2b')][_0x1f3f64['name']][_0xbf15('0x133')]=!![];}var _0x18b25e=_0x1623e1['voiceQueues'][_0x1f3f64[_0xbf15('0x62')]];var _0x44cb3d=_0x18b25e[_0xbf15('0x70')]!==utils[_0xbf15('0x6c')][_0xbf15('0x7d')];var _0x9fb56=utils[_0xbf15('0x134')](_0x18b25e);_0x18b25e[_0xbf15('0x135')]=utils[_0xbf15('0x136')](_0x18b25e,_0x1623e1['trunks']);Promise[_0xbf15('0xaa')]()['then'](function(){if(_0x18b25e[_0xbf15('0x135')]===utils[_0xbf15('0x6c')][_0xbf15('0x7d')]){if(_0x44cb3d){clearPredictiveAttributes(_0x18b25e);_0x1f3f64[_0xbf15('0x27')]=undefined;_0x1f3f64[_0xbf15('0x61')]=undefined;}if(_0x18b25e[_0xbf15('0x135')]===utils[_0xbf15('0x6c')][_0xbf15('0x7d')]){_0x1f3f64['available']=0x0;_0x1f3f64[_0xbf15('0xfd')]=0x0;_0x1f3f64[_0xbf15('0x137')]=0x0;_0x1f3f64[_0xbf15('0x138')]=0x0;_0x1f3f64[_0xbf15('0x139')]=0x0;}}else if(_0x18b25e[_0xbf15('0x135')]===utils[_0xbf15('0x6c')][_0xbf15('0x13a')]&&!_0x9fb56){return _0x1623e1[_0xbf15('0x92')](_0x18b25e,!![])[_0xbf15('0x3e')](function(){return _0x1623e1[_0xbf15('0x92')](_0x18b25e,![]);})['then'](function(){return _0x1623e1[_0xbf15('0xae')](_0x18b25e);})[_0xbf15('0x9d')](function(_0x37e894){loggerSyncQueueSummary['debug'](_0xbf15('0x13b'),util[_0xbf15('0x44')](_0x37e894,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x18b25e);});}else{clearPredictiveAttributes(_0x18b25e);}})[_0xbf15('0x3e')](function(){var _0xc7dc8f=_0x1f3f64[_0xbf15('0x13c')](_0x18b25e);if(_0xc7dc8f||_0x18b25e[_0xbf15('0x13d')]){_0x18b25e[_0xbf15('0x13d')]=![];_0x1f3f64['updateReportFromOutboundQueue'](_0x18b25e);Object[_0xbf15('0x13e')](_0x18b25e,_0x1f3f64);emitOutboundVoiceQueueSummary(_0x1f3f64);}_0x1623e1[_0xbf15('0x2b')][_0x18b25e[_0xbf15('0x62')]][_0xbf15('0x133')]=![];})[_0xbf15('0x9d')](function(_0x10c686){logger[_0xbf15('0x67')](_0xbf15('0x13b'),util[_0xbf15('0x44')](_0x10c686,{'showHidden':![],'depth':null}));_0x1623e1[_0xbf15('0x2b')][_0x18b25e['name']][_0xbf15('0x133')]=![];});};Dialer['prototype']['syncQueueSummaryComplete']=_[_0xbf15('0x13f')](function(){var _0x1436fb=_[_0xbf15('0x140')](this['voiceQueues'],function(_0x26c452){return _0x26c452[_0xbf15('0x141')];});var _0x5528a6=_[_0xbf15('0x140')](this[_0xbf15('0xfa')],function(_0x3a1d9d){return _0x3a1d9d['online']&&_0x3a1d9d[_0xbf15('0x87')]===_0xbf15('0x88');});if(_0x1436fb[_0xbf15('0x97')]>0x0&&_0x5528a6[_0xbf15('0x97')]>0x0){return Promise[_0xbf15('0xaa')]()['then'](cmHopper[_0xbf15('0x142')](_[_0xbf15('0x143')](_0x1436fb,'id'),previewRecallmeReminderInterval,_[_0xbf15('0x143')](_0x5528a6,'id')))[_0xbf15('0x3e')](function(_0x1fe040){for(var _0x51ecf5=0x0;_0x51ecf5<_0x1fe040['length'];_0x51ecf5++){var _0x50a0bb=_0x1fe040[_0x51ecf5][_0xbf15('0x144')][_0xbf15('0x62')];if(_0x50a0bb)io['to'](util[_0xbf15('0x45')](_0xbf15('0x145'),_0x50a0bb))[_0xbf15('0x119')](_0xbf15('0x146'),{'hopper':_0x1fe040[_0x51ecf5]});}})[_0xbf15('0x9d')](function(_0x3e443b){logger[_0xbf15('0x67')]('checkPreviewRecallReminder',_0x3e443b);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xbf15('0x3d')]=function(){var _0x202fa=this;setInterval(function(){_0x202fa[_0xbf15('0x147')](_0x202fa[_0xbf15('0x25')],'[uniqueid]');_0x202fa['clearZombieChannels'](_0x202fa['actions'],'[actions]');},0x32c8);};Dialer[_0xbf15('0x1a')][_0xbf15('0x147')]=function(_0x3f04e8,_0x314500){var _0x3ed802=this;for(var _0x3f8a6b in _0x3f04e8){if(typeof _0x3f04e8[_0x3f8a6b]!=='undefined'){this['sequence'][_0xbf15('0x1b')](function(){if(!_[_0xbf15('0xf7')](_0x3f04e8[_0x3f8a6b])){return ami[_0xbf15('0x9f')]({'action':'status','channel':_0x3f04e8[_0x3f8a6b][_0xbf15('0xf2')]})[_0xbf15('0x9d')](function(_0x88f68d){if(_0x88f68d['message']===_0xbf15('0x148')){setTimeout(function(){if(_0x3f04e8[_0x3f8a6b]&&_0x3f04e8[_0x3f8a6b][_0xbf15('0x41')]!==_0xbf15('0xbe')){_0x3ed802[_0xbf15('0xbf')](_0x3ed802[_0xbf15('0x20')][_0x3f04e8[_0x3f8a6b][_0xbf15('0xc0')]]);logger[_0xbf15('0x67')](_0xbf15('0x149'),_0x314500,_0x3f8a6b,_0x3f04e8[_0x3f8a6b][_0xbf15('0xc0')]);delete _0x3f04e8[_0x3f8a6b];}if(_0x3f04e8[_0x3f8a6b]&&_0x3f04e8[_0x3f8a6b][_0xbf15('0x41')]===_0xbf15('0xbe')){_0x3ed802[_0xbf15('0xbf')](_0x3ed802[_0xbf15('0xa9')][_0x3f04e8[_0x3f8a6b][_0xbf15('0xc0')]]);logger['error'](_0xbf15('0x14a'),_0x314500,_0x3f8a6b,_0x3f04e8[_0x3f8a6b][_0xbf15('0xc0')]);delete _0x3f04e8[_0x3f8a6b];}},0x2328);}});}});}}};Dialer['prototype'][_0xbf15('0x14b')]=function(_0x5a6661){return Promise[_0xbf15('0xaa')]()[_0xbf15('0x3e')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5a6661))[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x14c')));};Dialer[_0xbf15('0x1a')][_0xbf15('0xbf')]=function(_0x59f413){if(!_[_0xbf15('0x40')](_0x59f413)&&_0x59f413!==null){if(typeof _0x59f413[_0xbf15('0x7f')]!=='undefined'){if(_0x59f413[_0xbf15('0x7f')]>0x0){_0x59f413['originated']-=0x1;}else{logger[_0xbf15('0x67')](_0xbf15('0x14d'));}}}else{logger[_0xbf15('0x67')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype']['loggerHandler']=function(_0x21ab90,_0x52826f){var _0x2ca746=this;return function(_0x307be7){_0x2ca746[_0xbf15('0xbf')](_0x52826f);logger[_0xbf15('0x67')](_0x21ab90,util[_0xbf15('0x44')](_0x307be7,{'showHidden':![],'depth':null}));};};Dialer[_0xbf15('0x1a')][_0xbf15('0x14e')]=function(_0x97f14c,_0x1b7342,_0x3f8a6e){var _0x2f14c7={'state':0x19,'statedesc':_0xbf15('0x14f')};this[_0xbf15('0xbf')](_0x1b7342);this[_0xbf15('0x150')](_['merge'](_0x2f14c7,_[_0xbf15('0x78')](_0x3f8a6e,[_0xbf15('0xe0'),_0xbf15('0xe1'),_0xbf15('0x151'),_0xbf15('0xe2'),_0xbf15('0xee')])),_0xbf15('0x152'),_0xbf15('0x153'));logger[_0xbf15('0x67')](_0x97f14c);};Dialer[_0xbf15('0x1a')]['saveInDb']=function(_0x4870ce,_0x369e61,_0x581c52){hopperUtils['createHistory'](_0x4870ce)['catch'](loggerCatch(_0x369e61));hopperUtils[_0xbf15('0x12c')](_0x4870ce)[_0xbf15('0x9d')](loggerCatch(_0x581c52));};Dialer[_0xbf15('0x1a')][_0xbf15('0xdc')]=function(_0x54f3d7,_0x41d4d5){hopperUtils[_0xbf15('0xc8')](_0x54f3d7)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0xc9')));if(_0x41d4d5==0x0){hopperUtils[_0xbf15('0x12c')](_0x54f3d7)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x154')));}};Dialer[_0xbf15('0x1a')][_0xbf15('0x155')]=function(_0x349409){return Promise[_0xbf15('0xaa')]()[_0xbf15('0x3e')](cmHopper['handlePreviewRecallNotifications'](_0x349409['id'],previewRecallmeReminderInterval))[_0xbf15('0x3e')](function(_0x5ac41a){for(var _0x4a4562=0x0;_0x4a4562<_0x5ac41a[_0xbf15('0x97')];_0x4a4562++){var _0x17753a=_0x5ac41a[_0x4a4562][_0xbf15('0x144')][_0xbf15('0x62')];if(_0x17753a)io['to'](util[_0xbf15('0x45')]('user:%s',_0x17753a))[_0xbf15('0x119')]('user:dialPreviewRecallReminder',{'hopper':_0x5ac41a[_0x4a4562]});}})['catch'](function(){});};Dialer[_0xbf15('0x1a')]['launchHandleIvr']=function(_0x124d9e){var _0x571f59=this;return function(){_0x571f59['handleIvr'](_0x124d9e);};};Dialer['prototype'][_0xbf15('0x156')]=function(_0x520140,_0x23e5a4){var _0x43a9ed=this;var _0xeb9248=uuid['v4']();this['actions'][_0xeb9248]=new Action(_0x520140,_0x23e5a4,_0xeb9248);return new Promise(function(_0x5da216,_0x34b071){if(_[_0xbf15('0x40')](_0x520140)&&typeof _0x520140!==_0xbf15('0x157')){return _0x34b071(msgResponse(_0xbf15('0x158'),_0xbf15('0x93'),_0xbf15('0x159')));}if(_[_0xbf15('0x40')](_0x23e5a4[_0xbf15('0x15a')])||_0x23e5a4[_0xbf15('0x15a')]===null){return _0x34b071(msgResponse(_0xbf15('0x158'),_0xbf15('0x93'),_0xbf15('0x15b')));}var _0x39bb64={'XMD-CALLERID':_0x43a9ed['actions'][_0xeb9248][_0xbf15('0x15c')](),'XMD-AGI':_0x520140[_0xbf15('0x12f')]?util['format'](_0xbf15('0x15d'),ipAgi,_0x520140['dialQueueProject']):_0xbf15('0x15e'),'XMD-AGIAFTER':_0x520140[_0xbf15('0xc5')]?util['format'](_0xbf15('0x15d'),ipAgi,_0x520140['dialQueueProject2']):_0xbf15('0x15e'),'XMD-QUEUE':utils[_0xbf15('0x15f')](_0x520140)?util[_0xbf15('0x45')](_0xbf15('0x160'),_0x520140[_0xbf15('0x62')],_0x520140[_0xbf15('0x161')]||'',_0x520140[_0xbf15('0xc6')]?'c':'',_0x520140[_0xbf15('0xce')]||0x3):_0xbf15('0x15e'),'XMD-CONTACTID':_0x23e5a4[_0xbf15('0xe0')],'XMD-CDRTYPE':_0xbf15('0x162'),'CALLERID(all)':_0x43a9ed[_0xbf15('0x23')][_0xeb9248][_0xbf15('0x15c')](),'XMD-AMD':_0x520140[_0xbf15('0x10c')]?'ACTIVE':_0xbf15('0x15e'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x520140[_0xbf15('0x10c')]){_0x39bb64['XMD-AMDINITIALSILENCE']=_0x520140[_0xbf15('0x163')]||0x9c4;_0x39bb64[_0xbf15('0x164')]=_0x520140[_0xbf15('0x165')]||0x5dc;_0x39bb64[_0xbf15('0x166')]=_0x520140['dialAMDAfterGreetingSilence']||0x320;_0x39bb64[_0xbf15('0x167')]=_0x520140[_0xbf15('0x168')]||0x1388;_0x39bb64[_0xbf15('0x169')]=_0x520140[_0xbf15('0x16a')]||0x64;_0x39bb64['XMD-AMDBETWEENWORDSSILENCE']=_0x520140[_0xbf15('0x16b')]||0x32;_0x39bb64[_0xbf15('0x16c')]=_0x520140['dialAMDMaximumNumberOfWords']||0x3;_0x39bb64['XMD-AMDSILENCETHRESHOLD']=_0x520140[_0xbf15('0x16d')]||0x100;_0x39bb64['XMD-AMDMAXIMUMWORDLENGTH']=_0x520140[_0xbf15('0x16e')]||0x1388;}if(utils[_0xbf15('0x15f')](_0x520140)){_0x39bb64[_0xbf15('0x16f')]=_0x23e5a4[_0xbf15('0xe2')];}else{_0x39bb64[_0xbf15('0x170')]=_0x23e5a4[_0xbf15('0xee')];}var _0xe0d348=utils[_0xbf15('0x171')](_0x23e5a4['Contact']);Object[_0xbf15('0x13e')](_0x39bb64,_0xe0d348);var _0x492256=_0x43a9ed[_0xbf15('0x8c')](_0x520140[_0xbf15('0x172')])?utils['getCallerId'](_0x520140['Trunk'][_0xbf15('0x173')],_0x520140[_0xbf15('0x174')],_0x520140[_0xbf15('0x175')]>0x0?utils[_0xbf15('0x176')](_0x520140[_0xbf15('0x177')],_0x520140[_0xbf15('0x175')]):_0x520140[_0xbf15('0x177')]):utils[_0xbf15('0x178')](_['isNil'](_0x520140[_0xbf15('0x179')])?_0x520140[_0xbf15('0x172')][_0xbf15('0x173')]:_0x520140[_0xbf15('0x179')]['callerid'],_0x520140['dialOriginateCallerIdName'],_0x520140[_0xbf15('0x175')]>0x0?utils[_0xbf15('0x176')](_0x520140[_0xbf15('0x177')],_0x520140['dialRandomLastDigitCallerIdNumber']):_0x520140[_0xbf15('0x177')]);if(_0x492256){_0x39bb64[_0xbf15('0x17a')]=_0x43a9ed[_0xbf15('0x23')][_0xeb9248]['originatecalleridname']=utils['extractCalleridName'](_0x492256);_0x39bb64[_0xbf15('0x17b')]=_0x23e5a4[_0xbf15('0x15a')];}_0x520140[_0xbf15('0x17c')]=_0x39bb64;return ami[_0xbf15('0x9f')]({'actionid':_0xeb9248,'action':_0xbf15('0x158'),'channel':_0x43a9ed['isTrunkReachable'](_0x520140['Trunk'])?util['format'](_0xbf15('0x17d'),_0x520140['Trunk'][_0xbf15('0x62')],isNotNull(_0x520140[_0xbf15('0x17e')])?_0x520140[_0xbf15('0x17e')][_0xbf15('0x17f')]()||'':'',_0x520140[_0xbf15('0x180')]>0x0?_0x23e5a4[_0xbf15('0x15a')][_0xbf15('0x181')](_0x520140[_0xbf15('0x180')]):_0x23e5a4[_0xbf15('0x15a')]):util[_0xbf15('0x45')](_0xbf15('0x17d'),_[_0xbf15('0xf7')](_0x520140['TrunkBackup'])?_0x520140[_0xbf15('0x172')][_0xbf15('0x62')]:_0x520140[_0xbf15('0x179')][_0xbf15('0x62')],isNotNull(_0x520140[_0xbf15('0x17e')])?_0x520140[_0xbf15('0x17e')][_0xbf15('0x17f')]()||'':'',_0x520140[_0xbf15('0x180')]>0x0?_0x23e5a4['phone'][_0xbf15('0x181')](_0x520140[_0xbf15('0x180')]):_0x23e5a4[_0xbf15('0x15a')]),'callerid':_0x492256,'Exten':'xcally-motion-dialer','Context':_0xbf15('0x182'),'Priority':'1','variable':_0x39bb64,'timeout':(_0x520140[_0xbf15('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0xeb9248})[_0xbf15('0x3e')](function(_0x4741a3){return _0x5da216(_0x4741a3);})[_0xbf15('0x9d')](function(_0x34087f){_0x520140[_0xbf15('0x184')]+=0x1;var _0x587d72=new History(_0x43a9ed['actions'][_0xeb9248]);logger[_0xbf15('0x67')](util['format'](_0xbf15('0x185'),JSON[_0xbf15('0x77')](_0x34087f)));_0x587d72[_0xbf15('0x73')]=0xe;_0x587d72[_0xbf15('0xd1')]=_0xbf15('0x186');_0x587d72[_0xbf15('0xe4')]=moment()['format'](_0xbf15('0xc7'));_0x587d72[_0xbf15('0x74')]=_0x587d72[_0xbf15('0xe4')];hopperUtils[_0xbf15('0xc8')](_0x587d72)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x187')));_0x43a9ed[_0xbf15('0x12c')](_0x587d72)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x187')))['finally'](function(){delete _0x43a9ed[_0xbf15('0x23')][_0xeb9248];return _0x34b071(msgResponse(_0xbf15('0x158'),'Error',_0xbf15('0x188')));});});});};Dialer[_0xbf15('0x1a')][_0xbf15('0x189')]=function(_0x3199ba,_0x1f085d,_0x305d9e){var _0x561ee3=new History(_0x1f085d);if(_0x561ee3[_0xbf15('0x11b')]+_0x561ee3[_0xbf15('0x11c')]+_0x561ee3[_0xbf15('0x11d')]+_0x561ee3['countnosuchnumberretry']+_0x561ee3[_0xbf15('0xd5')]+_0x561ee3[_0xbf15('0xec')]+_0x561ee3['countmachineretry']+_0x561ee3[_0xbf15('0x18a')]>=_0x305d9e['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3199ba){case 0x3:if(_0x561ee3[_0xbf15('0x11d')]>=_0x305d9e['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xbf15('0xdd')]({'active':![],'countnoanswerretry':_0x561ee3[_0xbf15('0x11d')]+=0x1,'scheduledat':moment()[_0xbf15('0xde')](_0x305d9e[_0xbf15('0x18b')],'minutes')[_0xbf15('0x45')](_0xbf15('0xc7')),'ContactId':_0x561ee3[_0xbf15('0xe0')],'ListId':_0x561ee3['ListId'],'VoiceQueueId':_0x561ee3[_0xbf15('0xe2')]||undefined,'CampaignId':_0x561ee3['CampaignId']||undefined})[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x18c')));break;case 0x5:if(_0x561ee3['countbusyretry']>=_0x305d9e[_0xbf15('0x18d')]-0x1){return!![];}hopperUtils[_0xbf15('0xdd')]({'active':![],'countbusyretry':_0x561ee3[_0xbf15('0x11b')]+=0x1,'scheduledat':moment()['add'](_0x305d9e[_0xbf15('0x18e')],_0xbf15('0xdf'))[_0xbf15('0x45')](_0xbf15('0xc7')),'ContactId':_0x561ee3[_0xbf15('0xe0')],'ListId':_0x561ee3[_0xbf15('0xe1')],'VoiceQueueId':_0x561ee3[_0xbf15('0xe2')]||undefined,'CampaignId':_0x561ee3[_0xbf15('0xee')]||undefined})['catch'](loggerCatch(_0xbf15('0x18f')));break;case 0x8:if(_0x561ee3[_0xbf15('0x11c')]>=_0x305d9e[_0xbf15('0x190')]-0x1){return!![];}hopperUtils[_0xbf15('0xdd')]({'active':![],'countcongestionretry':_0x561ee3[_0xbf15('0x11c')]+=0x1,'scheduledat':moment()[_0xbf15('0xde')](_0x305d9e[_0xbf15('0x191')],_0xbf15('0xdf'))[_0xbf15('0x45')](_0xbf15('0xc7')),'ContactId':_0x561ee3['ContactId'],'ListId':_0x561ee3[_0xbf15('0xe1')],'VoiceQueueId':_0x561ee3[_0xbf15('0xe2')]||undefined,'CampaignId':_0x561ee3[_0xbf15('0xee')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x561ee3[_0xbf15('0x11e')]>=_0x305d9e[_0xbf15('0x192')]-0x1){return!![];}else{hopperUtils[_0xbf15('0xdd')]({'active':![],'countnosuchnumberretry':_0x561ee3[_0xbf15('0x11e')]+=0x1,'scheduledat':moment()[_0xbf15('0xde')](_0x305d9e['dialNoSuchNumberRetryFrequency'],_0xbf15('0xdf'))[_0xbf15('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x561ee3[_0xbf15('0xe0')],'ListId':_0x561ee3[_0xbf15('0xe1')],'VoiceQueueId':_0x561ee3[_0xbf15('0xe2')]||undefined,'CampaignId':_0x561ee3[_0xbf15('0xee')]||undefined})[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x193')));}break;case 0xa:if(_0x561ee3[_0xbf15('0xd5')]>=_0x305d9e['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xbf15('0xdd')]({'active':![],'countdropretry':_0x561ee3['countdropretry']+=0x1,'scheduledat':moment()[_0xbf15('0xde')](_0x305d9e['dialDropRetryFrequency'],_0xbf15('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x561ee3['ContactId'],'ListId':_0x561ee3[_0xbf15('0xe1')],'VoiceQueueId':_0x561ee3[_0xbf15('0xe2')]||undefined,'CampaignId':_0x561ee3[_0xbf15('0xee')]||undefined})[_0xbf15('0x9d')](loggerCatch(_0xbf15('0xe3')));break;case 0xb:if(_0x561ee3['countabandonedretry']>=_0x305d9e['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x561ee3['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x305d9e[_0xbf15('0xeb')],_0xbf15('0xdf'))[_0xbf15('0x45')](_0xbf15('0xc7')),'ContactId':_0x561ee3[_0xbf15('0xe0')],'ListId':_0x561ee3['ListId'],'VoiceQueueId':_0x561ee3[_0xbf15('0xe2')]||undefined,'CampaignId':_0x561ee3[_0xbf15('0xee')]||undefined})[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x194')));break;case 0x13:if(_0x561ee3['countmachineretry']>=_0x305d9e[_0xbf15('0x122')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x561ee3['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x305d9e[_0xbf15('0x128')],_0xbf15('0xdf'))[_0xbf15('0x45')](_0xbf15('0xc7')),'ContactId':_0x561ee3[_0xbf15('0xe0')],'ListId':_0x561ee3['ListId'],'VoiceQueueId':_0x561ee3[_0xbf15('0xe2')]||undefined,'CampaignId':_0x561ee3[_0xbf15('0xee')]||undefined})[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x125')));break;case 0x14:if(_0x561ee3[_0xbf15('0x18a')]>=_0x305d9e[_0xbf15('0x195')]-0x1){return!![];}hopperUtils[_0xbf15('0xdd')]({'active':![],'countagentrejectretry':_0x561ee3['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xbf15('0xde')](_0x305d9e['dialAgentRejectRetryFrequency'],'minutes')[_0xbf15('0x45')](_0xbf15('0xc7')),'ContactId':_0x561ee3[_0xbf15('0xe0')],'ListId':_0x561ee3[_0xbf15('0xe1')],'VoiceQueueId':_0x561ee3['VoiceQueueId']||undefined,'CampaignId':_0x561ee3[_0xbf15('0xee')]||undefined})[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x196')));break;default:return!![];}};Dialer[_0xbf15('0x1a')][_0xbf15('0x197')]=function(_0x37d635,_0x481ca0,_0x8af4c3){var _0x439981=this;var _0x417436=new History(_0x37d635);var _0x26d49e=![];var _0x490c15;var _0x53c504;return new Promise(function(_0x59b003,_0x310777){if(_[_0xbf15('0x40')](_0x481ca0)&&typeof _0x481ca0!=='object'){return _0x310777(msgResponse(_0xbf15('0x198'),_0xbf15('0x93'),_0xbf15('0x199')));}if(_[_0xbf15('0x40')](_0x8af4c3)&&typeof _0x8af4c3!==_0xbf15('0x157')){return _0x310777(msgResponse(_0xbf15('0x198'),_0xbf15('0x93'),_0xbf15('0x19a')));}hopperUtils[_0xbf15('0xd9')](_0x417436,_0x8af4c3[_0xbf15('0xc2')],_0x481ca0)[_0xbf15('0x3e')](function(_0x1434b3){if(_0x1434b3[_0xbf15('0xdb')]==0x1)_0x26d49e=!![];switch(_0x8af4c3[_0xbf15('0xc2')]){case'0':_0x481ca0[_0xbf15('0x19b')]+=0x1;_0x417436[_0xbf15('0x73')]=0x0;_0x417436[_0xbf15('0xd1')]=_0xbf15('0x19c');_0x417436[_0xbf15('0x11e')]+=0x1;_0x417436['countglobal']+=0x1;ami[_0xbf15('0x119')](_0xbf15('0x19d'),ut[_0xbf15('0x113')](_0x37d635,_0xbf15('0x19e')));_0x490c15=_0x481ca0[_0xbf15('0x19f')];_0x53c504=_0x481ca0['callAdditionalPhoneAfterMin'];hopperUtils[_0xbf15('0xc8')](_0x417436)['catch'](loggerCatch(_0xbf15('0x11a')));if(_0x439981[_0xbf15('0x189')](0x0,_0x37d635,_0x481ca0)&&!_0x26d49e){if(_0x417436[_0xbf15('0x11e')]>=_0x481ca0[_0xbf15('0x192')]){_0x439981[_0xbf15('0x123')](_0x417436,_0x59b003,_0x310777,_0xbf15('0x1a0'));}else{_0x439981[_0xbf15('0x11f')](_0x417436,_0x59b003,_0x310777,_0xbf15('0x1a0'));}}break;case'3':_0x481ca0['outboundNoAnswerCallsDay']+=0x1;_0x417436['state']=0x3;_0x417436[_0xbf15('0xd1')]=_0xbf15('0x1a1');_0x417436[_0xbf15('0x11d')]+=0x1;_0x417436[_0xbf15('0xd6')]+=0x1;var _0x13a92b=ut[_0xbf15('0x1a2')](_0x37d635,_0x481ca0);ami[_0xbf15('0x119')](_0xbf15('0x1a3'),_0x13a92b);_0x490c15=_0x481ca0['dialNoAnswerRetryFrequency'];_0x53c504=_0x481ca0['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x417436)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x1a4')));if(_0x439981['checkRetriveMax'](0x3,_0x37d635,_0x481ca0)&&!_0x26d49e){if(_0x417436[_0xbf15('0x11d')]>=_0x481ca0['dialNoAnswerMaxRetry']){_0x439981[_0xbf15('0x123')](_0x417436,_0x59b003,_0x310777,'reason\x203\x20ringing\x20no\x20answer');}else{_0x439981[_0xbf15('0x11f')](_0x417436,_0x59b003,_0x310777,_0xbf15('0x1a5'));}}break;case'5':_0x481ca0['outboundBusyCallsDay']+=0x1;_0x417436['state']=0x5;_0x417436['statedesc']=_0xbf15('0x1a6');_0x417436['countbusyretry']+=0x1;_0x417436['countglobal']+=0x1;ami['emit'](_0xbf15('0x1a7'),ut[_0xbf15('0x113')](_0x37d635,'busy'));_0x490c15=_0x481ca0[_0xbf15('0x18e')];_0x53c504=_0x481ca0[_0xbf15('0xd8')];hopperUtils[_0xbf15('0xc8')](_0x417436)[_0xbf15('0x9d')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x439981[_0xbf15('0x189')](0x5,_0x37d635,_0x481ca0)&&!_0x26d49e){if(_0x417436[_0xbf15('0x11b')]>=_0x481ca0[_0xbf15('0x18d')]){_0x439981['createStateFinal'](_0x417436,_0x59b003,_0x310777,_0xbf15('0x1a8'));}else{_0x439981[_0xbf15('0x11f')](_0x417436,_0x59b003,_0x310777,_0xbf15('0x1a8'));}}break;case'8':_0x481ca0[_0xbf15('0x1a9')]+=0x1;_0x417436[_0xbf15('0x73')]=0x8;_0x417436[_0xbf15('0xd1')]=_0xbf15('0x1aa');_0x417436[_0xbf15('0x11c')]+=0x1;_0x417436[_0xbf15('0xd6')]+=0x1;_0x490c15=_0x481ca0[_0xbf15('0x191')];_0x53c504=_0x481ca0[_0xbf15('0xd8')];ami['emit']('custom:agentcongestion',ut[_0xbf15('0x113')](_0x37d635,'congestion'));hopperUtils['createHistory'](_0x417436)['catch'](loggerCatch(_0xbf15('0x1ab')));if(_0x439981[_0xbf15('0x189')](0x8,_0x37d635,_0x481ca0)&&!_0x26d49e){if(_0x417436['countcongestionretry']>=_0x481ca0[_0xbf15('0x190')]){_0x439981[_0xbf15('0x123')](_0x417436,_0x59b003,_0x310777,_0xbf15('0x1ac'));}else{_0x439981['stateGlobal'](_0x417436,_0x59b003,_0x310777,_0xbf15('0x1ac'));}}break;case'11':_0x481ca0['outboundAbandonedCallsDay']+=0x1;_0x417436[_0xbf15('0x73')]=0xb;_0x417436[_0xbf15('0xd1')]='Abandoned';_0x417436[_0xbf15('0xec')]+=0x1;_0x417436[_0xbf15('0xd6')]+=0x1;_0x490c15=_0x481ca0[_0xbf15('0xeb')];_0x53c504=_0x481ca0['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x417436)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0xef')));if(_0x439981[_0xbf15('0x189')](0xb,_0x37d635,_0x481ca0)&&!_0x26d49e){if(_0x417436[_0xbf15('0xec')]>=_0x481ca0[_0xbf15('0xed')]){_0x439981[_0xbf15('0x123')](_0x417436,_0x59b003,_0x310777,_0xbf15('0x1ad'));}else{_0x439981[_0xbf15('0x11f')](_0x417436,_0x59b003,_0x310777,'reason\x2011\x20abandoned');}}break;case'20':_0x481ca0[_0xbf15('0x1ae')]+=0x1;_0x417436[_0xbf15('0x73')]=0x14;_0x417436[_0xbf15('0xd1')]='AgentReject';_0x417436[_0xbf15('0x18a')]+=0x1;_0x417436[_0xbf15('0xd6')]+=0x1;_0x490c15=_0x481ca0[_0xbf15('0x1af')];_0x53c504=_0x481ca0[_0xbf15('0xd8')];ami[_0xbf15('0x119')](_0xbf15('0x1b0'),ut['buildObj'](_0x37d635,_0xbf15('0x1b1')));hopperUtils['createHistory'](_0x417436)['catch'](loggerCatch(_0xbf15('0x1b2')));if(_0x439981[_0xbf15('0x189')](0x14,_0x37d635,_0x481ca0)&&!_0x26d49e){if(_0x417436[_0xbf15('0x18a')]>=_0x481ca0[_0xbf15('0x195')]){_0x439981[_0xbf15('0x123')](_0x417436,_0x59b003,_0x310777,'reason\x2020\x20agentreject');}else{_0x439981[_0xbf15('0x11f')](_0x417436,_0x59b003,_0x310777,_0xbf15('0x1b3'));}}break;default:_0x481ca0[_0xbf15('0x132')]+=0x1;_0x417436['state']=0xc;_0x417436[_0xbf15('0xd1')]=_0x8af4c3[_0xbf15('0xc2')];_0x490c15=_0x481ca0[_0xbf15('0x1af')];_0x53c504=_0x481ca0['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x417436)[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x1b4')));if(_0x439981['checkRetriveMax'](_0x8af4c3[_0xbf15('0xc2')],_0x37d635,_0x481ca0)&&!_0x26d49e){if(_0x417436['countbusyretry']+_0x417436['countcongestionretry']+_0x417436[_0xbf15('0x11d')]+_0x417436['countnosuchnumberretry']+_0x417436['countdropretry']+_0x417436[_0xbf15('0xec')]+_0x417436['countmachineretry']+_0x417436[_0xbf15('0x18a')]>=_0x481ca0['dialGlobalMaxRetry']){_0x439981[_0xbf15('0x11f')](_0x417436,_0x59b003,_0x310777,_0x8af4c3[_0xbf15('0xc2')]);}else{_0x439981[_0xbf15('0x123')](_0x417436,_0x59b003,_0x310777,_0x8af4c3[_0xbf15('0xc2')]);}}}})[_0xbf15('0x3e')](function(){if(_0x26d49e){hopperUtils[_0xbf15('0xf0')](_0x417436,_0x490c15,_0x53c504)['then'](function(){return _0x59b003(0x1);});}});});};Dialer[_0xbf15('0x1a')]['stateGlobal']=function(_0x451050,_0x3ec474,_0x9220b4,_0xc8350d){var _0x4a59d7=new Final(_0x451050);_0x4a59d7['state']=0xf;_0x4a59d7[_0xbf15('0xd1')]='Global';this['createStateFinal'](_0x4a59d7,_0x3ec474,_0x9220b4,_0xc8350d);};Dialer['prototype'][_0xbf15('0x123')]=function(_0x5e0c8f,_0x1f2d36,_0x5adce9,_0x50ce0f){hopperUtils[_0xbf15('0x12c')](_0x5e0c8f)[_0xbf15('0x3e')](function(){return _0x1f2d36(msgResponse(_0xbf15('0x198'),_0xbf15('0x109'),_0x50ce0f));})['catch'](function(){return _0x5adce9(msgResponse(_0xbf15('0x1b5'),_0xbf15('0x93'),_0xbf15('0x1b6')));});};Dialer[_0xbf15('0x1a')][_0xbf15('0xb')]=function(_0x5e3c4){var _0x1b881c=_0x5e3c4[_0xbf15('0x1b7')]/0x64;var _0x39fe0b=_0x5e3c4[_0xbf15('0xcf')]/(_0x5e3c4['outboundDropCallsDayTimeout']+_0x5e3c4['outboundAnswerCallsDay']);var _0x2e19eb=Math[_0xbf15('0x1b8')](_0x5e3c4[_0xbf15('0x1b9')]*(_0x5e3c4[_0xbf15('0x1ba')]/0x64));var _0x48bdb2=Math[_0xbf15('0x1b8')](_0x5e3c4[_0xbf15('0x1b9')]*(_0x5e3c4[_0xbf15('0x1bb')]/0x64));var _0x850238=_0x5e3c4[_0xbf15('0x1bc')]+_0x5e3c4[_0xbf15('0x138')];var _0x538f09=Math['floor'](_0x5e3c4[_0xbf15('0x1bd')]*_0x5e3c4[_0xbf15('0x5e')]*_0x5e3c4[_0xbf15('0x1be')]*_0x5e3c4[_0xbf15('0x1bf')]);if(_[_0xbf15('0x40')](_0x5e3c4[_0xbf15('0x61')])){if(!_['isUndefined'](_0x5e3c4[_0xbf15('0x27')])){_0x5e3c4[_0xbf15('0x27')]=undefined;loggerPredictive[_0xbf15('0x67')](_0xbf15('0x1c0'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x5e3c4[_0xbf15('0x65')])){loggerPredictive[_0xbf15('0x67')](_0xbf15('0x1c0'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5e3c4[_0xbf15('0x65')]);_0x5e3c4[_0xbf15('0x65')]=undefined;}_0x5e3c4['startProgressive']=moment()[_0xbf15('0x45')](_0xbf15('0xc7'));loggerPredictive['info'](_0x5e3c4[_0xbf15('0x62')],_0xbf15('0x1c1'),_0x5e3c4[_0xbf15('0x61')]);this['handlePower'](_0x5e3c4,0x1);}else if(ifInterval(_0x5e3c4[_0xbf15('0x1c2')],_0x5e3c4[_0xbf15('0x61')])){this[_0xbf15('0xb1')](_0x5e3c4,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x5e3c4[_0xbf15('0x61')],_0x5e3c4['name']);_0x5e3c4[_0xbf15('0x1bd')]=0x0;_0x5e3c4[_0xbf15('0xd0')]=0x0;}else if(_0x1b881c<_0x39fe0b&&_0x5e3c4[_0xbf15('0x1c3')]===_0xbf15('0x1c4')){clearPredictiveAttributes(_0x5e3c4);loggerPredictive[_0xbf15('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xbf15('0x1c5'),_0x39fe0b,_0xbf15('0x61'),_0x5e3c4[_0xbf15('0x62')]);}else if(_0x538f09<_0x5e3c4[_0xbf15('0xd0')]&&_0x5e3c4[_0xbf15('0x1c3')]===_0xbf15('0x1c4')){clearPredictiveAttributes(_0x5e3c4);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x1c6'),'Max\x20Drop\x20',_0x538f09,_0xbf15('0x1c7'),_0x5e3c4[_0xbf15('0xd0')],_0xbf15('0x61'),_0x5e3c4[_0xbf15('0x62')]);}else if(!ifInterval(_0x5e3c4['dialPredictiveInterval'],_0x5e3c4[_0xbf15('0x61')])&&_['isUndefined'](_0x5e3c4[_0xbf15('0x27')])&&!_[_0xbf15('0x40')](_0x5e3c4[_0xbf15('0x61')])){_0x5e3c4[_0xbf15('0x27')]=moment()[_0xbf15('0x45')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xbf15('0x48')](_0x5e3c4[_0xbf15('0x62')],'started\x20in\x20predictive\x20at',_0x5e3c4[_0xbf15('0x27')]);hopperUtils[_0xbf15('0x1c8')](_0x5e3c4['dialPredictiveInterval'])[_0xbf15('0x3e')](this[_0xbf15('0x1c9')](_0x5e3c4))[_0xbf15('0x3e')](mergeDataErlangB(_0x5e3c4))['then'](this[_0xbf15('0x1ca')](_0x5e3c4))[_0xbf15('0x9d')](loggerCatchPredictive(_0xbf15('0x1cb'),_0x5e3c4));}else if(!ifInterval(_0x5e3c4[_0xbf15('0x1c2')],_0x5e3c4[_0xbf15('0x27')])){_0x5e3c4[_0xbf15('0xd0')]=0x0;_0x5e3c4['startPredictive']=moment()[_0xbf15('0x45')](_0xbf15('0xc7'));loggerPredictive['info'](_0x5e3c4[_0xbf15('0x62')],_0xbf15('0x1cc'),_0x5e3c4['startPredictive']);clearInterval(_0x5e3c4[_0xbf15('0x65')]);_0x5e3c4['handlePredictive']=undefined;hopperUtils[_0xbf15('0x1c8')](_0x5e3c4[_0xbf15('0x1c2')])[_0xbf15('0x3e')](this['getDataPredictive'](_0x5e3c4))[_0xbf15('0x3e')](mergeDataErlangB(_0x5e3c4))['then'](this['startMethodPredictive'](_0x5e3c4))[_0xbf15('0x9d')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5e3c4));}else if(_0x5e3c4[_0xbf15('0x1b9')]&&_0x850238<_0x5e3c4[_0xbf15('0x1b9')]-_0x48bdb2){clearPredictiveAttributes(_0x5e3c4);loggerPredictive[_0xbf15('0x48')](_0x5e3c4[_0xbf15('0x62')],_0xbf15('0x1cd'),_0x850238,')\x20are\x20less\x20than\x20threshold\x20(',_0x5e3c4[_0xbf15('0x1b9')],'-',_0x48bdb2,'=',_0x5e3c4[_0xbf15('0x1b9')]-_0x48bdb2,')');}else if(_0x5e3c4[_0xbf15('0x1b9')]&&_0x850238>_0x5e3c4['predictiveIntervalAvailable']+_0x2e19eb){clearPredictiveAttributes(_0x5e3c4);loggerPredictive['info'](_0x5e3c4[_0xbf15('0x62')],_0xbf15('0x1cd'),_0x850238,_0xbf15('0x1ce'),_0x5e3c4[_0xbf15('0x1b9')],'+',_0x2e19eb,'=',_0x5e3c4[_0xbf15('0x1b9')]+_0x2e19eb,')');}};Dialer[_0xbf15('0x1a')]['getDataPredictive']=function(_0x42132d){var _0x2b0988=this;return function(_0x27b571){return new Promise(function(_0x6f0c80,_0xe5f9b5){_[_0xbf15('0xfb')](_0x42132d,_0x27b571[0x0]);if(checkGetDataPredictive(_0x27b571[0x0])){var _0x445ce7=_0x42132d['predictiveIntervalAvailable']=_0x42132d['talking']+_0x42132d['available'];var _0x3e28b8=_0x42132d['dialPredictiveInterval']*0x3c;var _0x2e46b0=_0x27b571[0x0][_0xbf15('0x53')]+_0x27b571[0x0][_0xbf15('0x51')];var _0xaafafd=(_0x27b571[0x0][_0xbf15('0x4c')]+_0x27b571[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x27b571[0x0][_0xbf15('0x4f')])/_0x27b571[0x0][_0xbf15('0x4b')];_0x42132d[_0xbf15('0x1be')]=_0xaafafd>0x0?_0xaafafd:0x1;switch(_0x42132d[_0xbf15('0x1c3')]){case _0xbf15('0x1c4'):var _0x5f4aa4=_0x42132d['dialPredictiveOptimizationPercentage']/0x64;return _0x2b0988['abandonmentRate'](_0x445ce7,_0x3e28b8,_0x2e46b0,_0xaafafd,_0x5f4aa4)[_0xbf15('0x3e')](function(_0x5674e0){return _0x6f0c80(_0x5674e0);});case _0xbf15('0x1cf'):var _0x3a6e85=_0x42132d[_0xbf15('0x1b7')]/0x64;return _0x2b0988[_0xbf15('0x1d0')](_0x445ce7,_0x3e28b8,_0x2e46b0,_0xaafafd,_0x3a6e85)[_0xbf15('0x3e')](function(_0x5d1100){return _0x6f0c80(_0x5d1100);});default:return _0xe5f9b5(msgResponse('[getDataPredictive]','Failure',_0xbf15('0x1d1')));}}else{return _0xe5f9b5(msgResponse(_0xbf15('0x1d2'),_0xbf15('0x93'),_0xbf15('0x1d3')));}});};};Dialer[_0xbf15('0x1a')]['getDataPredictiveOld']=function(_0x23b9a5){var _0x1aed9d=this;return function(_0x340616){return new Promise(function(_0x44aaff,_0x281c02){_['merge'](_0x23b9a5,_0x340616[0x0]);if(checkGetDataPredictive(_0x340616[0x0])){loggerPredictive[_0xbf15('0x48')](JSON[_0xbf15('0x77')](_0x340616[0x0]));if(_0x23b9a5['dialPredictiveOptimization']==='dropRate'){return _0x1aed9d[_0xbf15('0x14b')](_0x23b9a5['id'])['then'](function(_0x209041){var _0x52b0cb=_0x23b9a5[_0xbf15('0x1d4')]-_0x209041[0x0][_0xbf15('0x1d5')];var _0x2ae053=_0x23b9a5[_0xbf15('0x1c2')]*0x3c;var _0x1604a9=_0x340616[0x0][_0xbf15('0x53')]+_0x340616[0x0]['predictiveIntervalAvgHoldtime'];var _0x4ac9aa=(_0x340616[0x0][_0xbf15('0x4c')]+_0x340616[0x0][_0xbf15('0x4d')]+_0x340616[0x0][_0xbf15('0x4f')])/_0x340616[0x0][_0xbf15('0x4b')];var _0x276459=_0x23b9a5[_0xbf15('0x1b7')]/0x64;_0x23b9a5[_0xbf15('0x1d6')]=_0x209041[0x0]['outboundQueuePauses']||0x0;_0x23b9a5['predictiveIntervalHitRate']=_0x4ac9aa>0x0?_0x4ac9aa:0x1;return _0x1aed9d[_0xbf15('0x1d7')](_0x52b0cb,_0x2ae053,_0x1604a9,_0x4ac9aa,_0x276459);})[_0xbf15('0x3e')](function(_0x487e15){return _0x44aaff(_0x487e15);})[_0xbf15('0x9d')](function(_0x2919e5){return _0x281c02(msgResponse(_0xbf15('0x1d8'),_0xbf15('0x93'),JSON[_0xbf15('0x77')](_0x2919e5)));});}if(_0x23b9a5[_0xbf15('0x1c3')]==='agentBusyFactor'){return _0x1aed9d[_0xbf15('0x14b')](_0x23b9a5['id'])[_0xbf15('0x3e')](function(_0x2f22b7){var _0x44b54a=_0x23b9a5[_0xbf15('0x1d4')]-_0x2f22b7[0x0][_0xbf15('0x1d5')];var _0x156882=_0x23b9a5[_0xbf15('0x1c2')]*0x3c;var _0x1ac894=_0x340616[0x0]['predictiveIntervalAvgTalktime']+_0x340616[0x0]['predictiveIntervalAvgHoldtime'];var _0x8534c9=(_0x340616[0x0]['predictiveIntervalAnsweredCalls']+_0x340616[0x0][_0xbf15('0x4d')]+_0x340616[0x0][_0xbf15('0x4f')])/_0x340616[0x0][_0xbf15('0x4b')];var _0xf30f62=_0x23b9a5['dialPredictiveOptimizationPercentage']/0x64;_0x23b9a5[_0xbf15('0x1d6')]=_0x2f22b7[0x0][_0xbf15('0x1d5')]||0x0;_0x23b9a5[_0xbf15('0x1be')]=_0x8534c9>0x0?_0x8534c9:0x1;return _0x1aed9d['busyFactor'](_0x44b54a,_0x156882,_0x1ac894,_0x8534c9,_0xf30f62);})[_0xbf15('0x3e')](function(_0x47650d){return _0x44aaff(_0x47650d);})[_0xbf15('0x9d')](function(_0x5e6a5e){return _0x281c02(msgResponse(_0xbf15('0x1d8'),'Failure',JSON['stringify'](_0x5e6a5e)));});}}else{return _0x281c02(msgResponse(_0xbf15('0x1d2'),_0xbf15('0x93'),'check\x20failure'));}});};};Dialer['prototype'][_0xbf15('0x1ca')]=function(_0x3763e1){var _0x23783e=this;return function(){var _0x62e0b4=0x0;var _0x316b7d=Math[_0xbf15('0x1d9')](_0x3763e1[_0xbf15('0x5a')]*0x3e8);if(_0x316b7d>0x0){_0x316b7d=_0x316b7d<0x64?0x64:_0x316b7d;loggerPredictive['info'](_0x3763e1[_0xbf15('0x62')],_0xbf15('0x1da'),_0x316b7d,'milliseconds');_0x3763e1[_0xbf15('0x65')]=setInterval(function(){_0x23783e[_0xbf15('0x65')](_0x3763e1);loggerPredictiveCalls[_0xbf15('0x48')]('[handlePredictive]',_0x62e0b4+=0x1);},_0x316b7d);}else{loggerPredictive[_0xbf15('0x48')](_0x3763e1[_0xbf15('0x62')],_0xbf15('0x1db'));}};};Dialer[_0xbf15('0x1a')][_0xbf15('0x1dc')]=function(_0x4291e4,_0x535515){var _0x59f1e0=this;return function(_0x4101fc){if(_[_0xbf15('0x47')](_0x4101fc)){if(_[_0xbf15('0xf7')](_0x535515[_0xbf15('0x151')])||!_0x535515[_0xbf15('0x1dd')]){if(_0x4291e4[_0xbf15('0xaf')]===_0xbf15('0xa')){_0x4291e4[_0xbf15('0x75')]=_[_0xbf15('0x40')](_0x4291e4[_0xbf15('0x75')])?!![]:_0x4291e4[_0xbf15('0x75')];var _0x595139=uuid['v4']();_0x59f1e0[_0xbf15('0x23')][_0x595139]=new Action(_0x4291e4,_0x535515,_0x595139);loggerBooked[_0xbf15('0x48')]('[booked][checkContactBlack]',_0x595139,_0xbf15('0x1de'),JSON[_0xbf15('0x77')](_0x4291e4[_0xbf15('0x75')]),_0xbf15('0x1df'),_0x4291e4[_0xbf15('0x62')]);if(_0x4291e4[_0xbf15('0x75')]){_0x4291e4[_0xbf15('0x75')]=![];_0x59f1e0[_0xbf15('0x29')][_0x59f1e0[_0xbf15('0x23')][_0x595139][_0xbf15('0xc0')]]=[];ami['Action']({'actionid':_0x595139,'action':_0xbf15('0x1e0'),'queue':_0x4291e4[_0xbf15('0x62')]})[_0xbf15('0x9d')](function(){_0x59f1e0[_0xbf15('0xbf')](_0x4291e4);hopperUtils[_0xbf15('0xdd')]({'active':![],'ContactId':_0x59f1e0[_0xbf15('0x23')][_0x595139]['ContactId'],'ListId':_0x59f1e0['actions'][_0x595139][_0xbf15('0xe1')],'VoiceQueueId':_0x59f1e0[_0xbf15('0x23')][_0x595139][_0xbf15('0xe2')]||undefined,'CampaignId':_0x59f1e0['actions'][_0x595139][_0xbf15('0xee')]||undefined})[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x1e1')));delete _0x59f1e0['actions'][_0x595139];});}else{loggerBooked[_0xbf15('0x48')](_0xbf15('0x1e2'),JSON[_0xbf15('0x77')](_0x4291e4[_0xbf15('0x75')]),_0xbf15('0x1df'),_0x4291e4[_0xbf15('0x62')]);_0x59f1e0[_0xbf15('0xbf')](_0x4291e4);hopperUtils[_0xbf15('0xdd')]({'active':![],'ContactId':_0x59f1e0[_0xbf15('0x23')][_0x595139][_0xbf15('0xe0')],'ListId':_0x59f1e0[_0xbf15('0x23')][_0x595139]['ListId'],'VoiceQueueId':_0x59f1e0['actions'][_0x595139][_0xbf15('0xe2')]||undefined,'CampaignId':_0x59f1e0[_0xbf15('0x23')][_0x595139][_0xbf15('0xee')]||undefined})[_0xbf15('0x9d')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x59f1e0['actions'][_0x595139];}}else{return _0x59f1e0[_0xbf15('0x156')](_0x4291e4,_0x535515);}}else{if(utils[_0xbf15('0x60')](undefined,_0x535515[_0xbf15('0x1e3')])<_0x4291e4[_0xbf15('0x1e4')]*0x3c){if(_0x535515[_0xbf15('0x144')]&&!_0x535515[_0xbf15('0x144')][_0xbf15('0x1e5')]){_0x59f1e0['preview'][_0xbf15('0xfe')](_0x535515['id'])['finally'](function(){_0x59f1e0[_0xbf15('0xbf')](_0x4291e4);});}else{hopperUtils['unlockContact']({'active':![]},_0x535515['id'],0x1)[_0xbf15('0x1d')](function(){_0x59f1e0[_0xbf15('0xbf')](_0x4291e4);});}}else{_0x4291e4['outboundReCallsDay']+=0x1;_0x59f1e0[_0xbf15('0xbf')](_0x4291e4);if(_0x4291e4[_0xbf15('0x1e6')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x535515['ContactId'],'ListId':_0x535515['ListId'],'VoiceQueueId':_0x535515[_0xbf15('0xe2')]||undefined,'CampaignId':_0x535515[_0xbf15('0xee')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xbf15('0xc8')](createObjHistory(_0x4291e4,_0x535515,utils[_0xbf15('0x6c')][_0xbf15('0x1e7')],0x17,_0xbf15('0x1e8')))['catch'](loggerCatch(_0xbf15('0x1e9')));}else{_0x59f1e0['saveInDb'](createObjHistory(_0x4291e4,_0x535515,utils[_0xbf15('0x6c')][_0xbf15('0x1ea')],0x16,'RecallFailedTimeout'),_0xbf15('0x1eb'),'[Originate][HistoryRecallClose]');}}}}else{_0x4291e4[_0xbf15('0x1ec')]+=0x1;_0x59f1e0[_0xbf15('0x150')](createObjHistory(_0x4291e4,_0x535515,utils[_0xbf15('0x6c')][_0xbf15('0x1ed')],0xd,_0xbf15('0x1ee')),'[Originate][historyBlacklist]',_0xbf15('0x1ef'));throw _0xbf15('0x1f0');}};};Dialer['prototype'][_0xbf15('0x1f1')]=function(_0x126dfb){var _0x5eeb6d=this;var _0x234990=_0x126dfb[_0xbf15('0x1f2')]-_0x126dfb[_0xbf15('0x7f')];emitCampaignSummary(_0x126dfb);if(_0x234990>0x0&&_0x126dfb[_0xbf15('0x6a')]==0x0){if(_0x234990>this[_0xbf15('0x1f3')]){_0x234990=this[_0xbf15('0x1f3')];}_0x126dfb[_0xbf15('0x6a')]=0x1;hopperUtils['getContactDialerIvr'](_0x126dfb,_0x234990)['then'](function(_0x33bce0){_0x126dfb[_0xbf15('0x6a')]=0x0;if(_0x33bce0){if(!utils[_0xbf15('0x1f4')](_0x33bce0)){_0x126dfb[_0xbf15('0x70')]=utils[_0xbf15('0x6c')][_0xbf15('0x71')];logger[_0xbf15('0x48')](_0xbf15('0x1f5')+_0x126dfb['name']);}else{_0x126dfb[_0xbf15('0x7f')]+=_0x33bce0['length'];_0x126dfb[_0xbf15('0x70')]=utils[_0xbf15('0x6c')][_0xbf15('0x1f6')];for(var _0x5dde1e=0x0;_0x5dde1e<_0x33bce0['length'];_0x5dde1e+=0x1){_0x126dfb['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x33bce0[_0x5dde1e])||_[_0xbf15('0xf7')](_0x33bce0[_0x5dde1e]['Contact'])||_['isNil'](_0x33bce0[_0x5dde1e][_0xbf15('0x15a')])){_0x5eeb6d[_0xbf15('0x14e')](_0xbf15('0x1f7'),_0x126dfb,_0x33bce0[_0x5dde1e]);}else{hopperUtils[_0xbf15('0x1f8')](_[_0xbf15('0x78')](_0x33bce0[_0x5dde1e],[_0xbf15('0xee'),_0xbf15('0x15a')]))[_0xbf15('0x3e')](_0x5eeb6d[_0xbf15('0x1dc')](_0x126dfb,_0x33bce0[_0x5dde1e]))[_0xbf15('0x9d')](_0x5eeb6d[_0xbf15('0x1f9')](_0xbf15('0x1fa'),_0x126dfb));}}}}})[_0xbf15('0x9d')](loggerGetContactDialer('[getContactCampaign2]',_0x126dfb,_0x234990));}};Dialer[_0xbf15('0x1a')][_0xbf15('0xb1')]=function(_0x25c05c,_0xdc6d38){var _0x248482=this;var _0x1644b5=[];if(_0xdc6d38<0x1||_0x25c05c['dialMethod']===_0xbf15('0xa')){_0xdc6d38=0x1;}var _0x26bbce=Math[_0xbf15('0x1d9')](_0x25c05c[_0xbf15('0x1bc')]*_0xdc6d38)-_0x25c05c['originated'];if(_0x25c05c[_0xbf15('0x1fb')]>0x0){var _0x2ca917=_0x25c05c[_0xbf15('0x1fb')]-_0x25c05c['originated']-_0x25c05c['talking']-_0x25c05c['pTalking'];if(_0x26bbce>_0x2ca917){_0x26bbce=_0x2ca917;}}if(_0x26bbce>0x0&&_0x25c05c[_0xbf15('0x6a')]==0x0){if(_0x25c05c[_0xbf15('0xaf')]===_0xbf15('0xa')){_0x26bbce=0x1;}if(_0x26bbce>this['maxNumberOriginate']){_0x26bbce=this['maxNumberOriginate'];}for(var _0x4a00e9 in this[_0xbf15('0xfa')]){if(typeof this[_0xbf15('0xfa')][_0x4a00e9]!==_0xbf15('0x1fc')){if(this[_0xbf15('0xfa')][_0x4a00e9]['state']===_0xbf15('0x1fd')&&this[_0xbf15('0xfa')][_0x4a00e9][_0xbf15('0x87')]===_0xbf15('0x88')){_0x1644b5[_0xbf15('0x9e')](this[_0xbf15('0xfa')][_0x4a00e9]['id']);}}}_0x25c05c['temp']=0x1;hopperUtils[_0xbf15('0x1fe')](_0x25c05c,_0x1644b5,_0x26bbce)[_0xbf15('0x3e')](function(_0x4226d2){_0x25c05c[_0xbf15('0x6a')]=0x0;if(_0x4226d2){if(!utils[_0xbf15('0x1f4')](_0x4226d2)){hopperUtils['countReScheduled'](_0x25c05c)[_0xbf15('0x3e')](sendMessageReschedule(_0x25c05c))[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x1ff')));}else{_0x25c05c[_0xbf15('0x7f')]+=_0x4226d2[_0xbf15('0x97')];_0x25c05c['message']=_0x25c05c[_0xbf15('0xaf')]===_0xbf15('0xa')?utils[_0xbf15('0x6c')][_0xbf15('0x13a')]:utils['CAMPAIGN_STATUS'][_0xbf15('0x1f6')];for(var _0x43d712=0x0;_0x43d712<_0x4226d2[_0xbf15('0x97')];_0x43d712+=0x1){if(_['isNil'](_0x4226d2[_0x43d712])||_[_0xbf15('0xf7')](_0x4226d2[_0x43d712][_0xbf15('0x200')])||_[_0xbf15('0xf7')](_0x4226d2[_0x43d712][_0xbf15('0x15a')])){_0x248482['emptyContact'](_0xbf15('0x1f7'),_0x25c05c,_0x4226d2[_0x43d712]);}else{hopperUtils[_0xbf15('0x201')](_[_0xbf15('0x78')](_0x4226d2[_0x43d712],[_0xbf15('0xe2'),_0xbf15('0x15a')]))[_0xbf15('0x3e')](_0x248482[_0xbf15('0x1dc')](_0x25c05c,_0x4226d2[_0x43d712]))[_0xbf15('0x9d')](_0x248482['loggerHandler'](_0xbf15('0x1f7'),_0x25c05c));}}}}})['catch'](loggerGetContactDialer(_0xbf15('0x202'),_0x25c05c,_0x26bbce));}};Dialer[_0xbf15('0x1a')]['handlePredictive']=function(_0x3b73f5){if(_0x3b73f5[_0xbf15('0x1fb')]>0x0){var _0x46a0f5=_0x3b73f5[_0xbf15('0x1fb')]-_0x3b73f5['originated']-_0x3b73f5[_0xbf15('0x138')];if(_0x46a0f5>0x0&&_0x3b73f5['temp']==0x0){this[_0xbf15('0x203')](_0x3b73f5);}else{loggerPredictiveCalls['info'](_0xbf15('0x204'));}}else{this['tryOriginatePredictive'](_0x3b73f5);}};Dialer[_0xbf15('0x1a')][_0xbf15('0x203')]=function(_0x128674){var _0x11d8d1=this;var _0x3126e7=[];_0x128674[_0xbf15('0x7f')]+=0x1;for(var _0x57f8ac in this['agents']){if(typeof this['agents'][_0x57f8ac]!==_0xbf15('0x1fc')){if(this[_0xbf15('0xfa')][_0x57f8ac][_0xbf15('0x73')]===_0xbf15('0x1fd')&&this['agents'][_0x57f8ac]['status']===_0xbf15('0x88')){_0x3126e7['push'](this[_0xbf15('0xfa')][_0x57f8ac]['id']);}}}_0x128674[_0xbf15('0x6a')]=0x1;return this['getContactDialer'](_0x128674['id'],_0x3126e7,0x1,_0x128674[_0xbf15('0x205')],_0x128674)[_0xbf15('0x3e')](function(_0x48bfa3){_0x128674[_0xbf15('0x6a')]=0x1;if(_0x48bfa3){if(!utils['checkContactEmpty'](_0x48bfa3)){utils[_0xbf15('0x69')](_0x128674,0x1,0x0);return hopperUtils[_0xbf15('0x206')](_0x128674)[_0xbf15('0x3e')](sendMessageReschedule(_0x128674))[_0xbf15('0x9d')](loggerCatch(_0xbf15('0x1ff')));}else{_0x128674[_0xbf15('0x70')]=utils[_0xbf15('0x6c')][_0xbf15('0x1f6')];if(_[_0xbf15('0xf7')](_0x48bfa3[0x0])||_[_0xbf15('0xf7')](_0x48bfa3[0x0]['Contact'])||_[_0xbf15('0xf7')](_0x48bfa3[0x0][_0xbf15('0x15a')])){_0x11d8d1['emptyContact'](_0xbf15('0x1f7'),_0x128674,_0x48bfa3[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x48bfa3[0x0],[_0xbf15('0xe2'),_0xbf15('0x15a')]))[_0xbf15('0x3e')](_0x11d8d1[_0xbf15('0x1dc')](_0x128674,_0x48bfa3[0x0]))[_0xbf15('0x9d')](_0x11d8d1[_0xbf15('0x1f9')](_0xbf15('0x207'),_0x128674));}}}})[_0xbf15('0x9d')](loggerGetContactDialer(_0xbf15('0x208'),_0x128674,0x1));};Dialer['prototype'][_0xbf15('0x1d7')]=function(_0xb1eda,_0x24203c,_0x10f708,_0x25054c,_0x5e86e3,_0x1ce2b0){loggerPredictive[_0xbf15('0x48')](_0xbf15('0x209'));loggerPredictive[_0xbf15('0x48')](_0xbf15('0x20a'),_0xb1eda);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x20b'),_0x24203c);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x20c'),_0x10f708);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x20d'),_0x25054c);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x20e'),_0x5e86e3);loggerPredictive['info']('---------------------------');return new Promise(function(_0x275448,_0x1fcafe){if(_0xb1eda<=0x0||isNaN(_0xb1eda)){return _0x1fcafe(msgResponse(_0xbf15('0x20f'),_0xbf15('0x85'),_0xbf15('0x210')+_0xb1eda));}if(_0x10f708<=0x0||isNaN(_0x10f708)){return _0x1fcafe(msgResponse(_0xbf15('0x20f'),'Error',_0xbf15('0x211')+_0x10f708));}if(_0x25054c<=0x0||isNaN(_0x25054c)){return _0x1fcafe(msgResponse(_0xbf15('0x20f'),_0xbf15('0x85'),_0xbf15('0x212')+_0x25054c));}if(_0x24203c<=0x0||isNaN(_0x24203c)){return _0x1fcafe(msgResponse(_0xbf15('0x20f'),_0xbf15('0x85'),_0xbf15('0x213')+_0x24203c));}if(_0x5e86e3<=0x0||isNaN(_0x5e86e3)){return _0x1fcafe(msgResponse(_0xbf15('0x20f'),_0xbf15('0x85'),_0xbf15('0x214')+_0x5e86e3));}_0x1ce2b0=_0x1ce2b0||0x0;var _0x524dd8=0x1/_0x10f708;var _0x59e64f=0x0;var _0x34cc39=0x0;var _0x490864=0x0;var _0x385e6e=0x0;for(var _0x279385=0x0;_0x490864<_0x5e86e3;_0x279385+=0x1){_0x34cc39=_0x279385/_0x24203c;_0x59e64f=(_0x25054c*_0x34cc39+_0x1ce2b0)/_0x524dd8;_0x490864=utils[_0xbf15('0x215')](_0x59e64f,_0xb1eda);_0x385e6e=_0x59e64f/_0xb1eda*(0x1-utils[_0xbf15('0x215')](_0x59e64f,_0xb1eda));}return _0x275448({'erlangCalls':_0x279385,'erlangCallToSecond':_0x24203c/_0x279385,'erlangAbandonmentRate':_0x490864,'erlangBusyFactor':_0x385e6e});});};Dialer['prototype'][_0xbf15('0x1d0')]=function(_0x13ca69,_0x12c8c7,_0x213d6c,_0x43e946,_0x5c7c3d,_0x1e70aa){loggerPredictive[_0xbf15('0x48')](_0xbf15('0x216'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13ca69);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x20b'),_0x12c8c7);loggerPredictive['info'](_0xbf15('0x20c'),_0x213d6c);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x20d'),_0x43e946);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x217'),_0x5c7c3d);loggerPredictive[_0xbf15('0x48')](_0xbf15('0x5f'));return new Promise(function(_0x4c2760,_0x2c0b0d){if(_0x13ca69<=0x0||isNaN(_0x13ca69)){return _0x2c0b0d(msgResponse('[busyFactor]',_0xbf15('0x85'),_0xbf15('0x210')+_0x13ca69));}if(_0x213d6c<=0x0||isNaN(_0x213d6c)){return _0x2c0b0d(msgResponse(_0xbf15('0x218'),_0xbf15('0x85'),_0xbf15('0x211')+_0x213d6c));}if(_0x43e946<=0x0||isNaN(_0x43e946)){return _0x2c0b0d(msgResponse('[busyFactor]',_0xbf15('0x85'),_0xbf15('0x212')+_0x43e946));}if(_0x12c8c7<=0x0||isNaN(_0x12c8c7)){return _0x2c0b0d(msgResponse(_0xbf15('0x218'),'Error',_0xbf15('0x213')+_0x12c8c7));}if(_0x5c7c3d<=0x0||isNaN(_0x5c7c3d)){return _0x2c0b0d(msgResponse('[busyFactor]','Error',_0xbf15('0x219')+_0x5c7c3d));}_0x1e70aa=_0x1e70aa||0x0;var _0x42be92=0x1/_0x213d6c;var _0x357795=0x0;var _0x3bec63=0x0;var _0x5b99fc=0x0;var _0xe3d94a=0x0;for(var _0xc7d1e=0x0;_0xe3d94a<_0x5c7c3d;_0xc7d1e+=0x1){_0x3bec63=_0xc7d1e/_0x12c8c7;_0x357795=(_0x43e946*_0x3bec63+_0x1e70aa)/_0x42be92;_0x5b99fc=utils['erlangb'](_0x357795,_0x13ca69);_0xe3d94a=_0x357795/_0x13ca69*(0x1-utils[_0xbf15('0x215')](_0x357795,_0x13ca69));}return _0x4c2760({'erlangCalls':_0xc7d1e,'erlangCallToSecond':_0x12c8c7/_0xc7d1e,'erlangAbandonmentRate':_0x5b99fc,'erlangBusyFactor':_0xe3d94a});});};module[_0xbf15('0x21a')]=Dialer; \ No newline at end of file +var _0x9de6=['[originate][error]','originate\x20action\x20Error','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','checkRetriveMax','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','talking','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','loggedIn','predictiveIntervalPauses','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','getContactDialer','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[busyFactor]','Umin\x20=\x20','util','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','startProgressive','ivrOriginated','queueBooked','queuesSummary','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','info','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','debug','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','queueStatusComplete','[booked][unlockQueueStatus]','stringify','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','SIP/%s','status','prototype','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','isArray','length','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','push','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','dialTimezone','checkDialMethod','dialMethod','progressive','power','handlePower','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','Error','queue','uniqueId','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','dropreason','CALLEREXIT','countabandonedretry','rescheduleContact','dialAbandonedRetryFrequency','Abandoned','actions','channel','actionid','rrmemory','roundrobin','paused','stateinterface','locked','pick','idHopper','strategy','run','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','isNil','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','Machine','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','Action','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','setXMDContactVariables','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError'];(function(_0x40e7ed,_0x49b65a){var _0x34828a=function(_0x119a85){while(--_0x119a85){_0x40e7ed['push'](_0x40e7ed['shift']());}};_0x34828a(++_0x49b65a);}(_0x9de6,0x92));var _0x69de=function(_0x2b3baa,_0x4e06c6){_0x2b3baa=_0x2b3baa-0x0;var _0x238a4a=_0x9de6[_0x2b3baa];return _0x238a4a;};'use strict';var util=require(_0x69de('0x0'));var _=require('lodash');var uuid=require(_0x69de('0x1'));var moment=require(_0x69de('0x2'));var rr=require('rr');var Redis=require(_0x69de('0x3'));var utils=require(_0x69de('0x4'));var hopperUtils=require(_0x69de('0x5'));var ut=require(_0x69de('0x6'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x69de('0x7'));var loggerBooked=require(_0x69de('0x8'))(_0x69de('0x9'));var loggerPredictive=require('../../../config/logger')(_0x69de('0xa'));var loggerPredictiveCalls=require(_0x69de('0x8'))(_0x69de('0xb'));var loggerSyncQueueSummary=require(_0x69de('0x8'))(_0x69de('0xc'));var ami=require(_0x69de('0xd'));config[_0x69de('0xe')]=_[_0x69de('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x69de('0x10'))(new Redis(config[_0x69de('0xe')]));var cmHopper=require(_0x69de('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x69de('0x12'));var Interval=require(_0x69de('0x13'));var Action=require(_0x69de('0x14'));var History=require(_0x69de('0x15'));var Final=require('./models/final');var AgentComplete=require(_0x69de('0x16'));var QueueCallerAbandon=require(_0x69de('0x17'));var Hangup=require('./models/hangup');var ipAgi=process[_0x69de('0x18')][_0x69de('0x19')]||_0x69de('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x69de('0x1b')]=function(_0x205edf){this[_0x69de('0x1c')]=this[_0x69de('0x1c')]?this['tail'][_0x69de('0x1d')](_0x205edf):_0x205edf();};function Dialer(_0x37faea,_0x151c18){this[_0x69de('0x1e')]=new Sequence();this[_0x69de('0x1f')]=_0x151c18;this['voiceQueues']=_0x37faea[_0x69de('0x20')];this[_0x69de('0x21')]=_0x37faea[_0x69de('0x21')];this['agents']=_0x37faea[_0x69de('0x22')];this[_0x69de('0x23')]=_0x37faea[_0x69de('0x23')];this['maxNumberOriginate']=config[_0x69de('0x24')]||0x2;this[_0x69de('0x25')]={};this['actions']={};this[_0x69de('0x26')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x69de('0x27')]={};this[_0x69de('0x28')]={};this[_0x69de('0x29')]={};this['queueBookedRR']={};this[_0x69de('0x2a')]={};ami['on']('agentconnect',this[_0x69de('0x2b')][_0x69de('0x2c')](this));ami['on'](_0x69de('0x2d'),this['syncQueueCallerAbandon'][_0x69de('0x2c')](this));ami['on'](_0x69de('0x2e'),this[_0x69de('0x2f')][_0x69de('0x2c')](this));ami['on'](_0x69de('0x30'),this[_0x69de('0x31')][_0x69de('0x2c')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x69de('0x2c')](this));ami['on'](_0x69de('0x32'),this[_0x69de('0x33')][_0x69de('0x2c')](this));ami['on'](_0x69de('0x34'),this[_0x69de('0x35')][_0x69de('0x2c')](this));ami['on']('newexten',this[_0x69de('0x36')][_0x69de('0x2c')](this));ami['on']('varset',this[_0x69de('0x37')]['bind'](this));ami['on'](_0x69de('0x38'),this[_0x69de('0x39')]['bind'](this));ami['on'](_0x69de('0x3a'),this[_0x69de('0x3b')]['bind'](this));this[_0x69de('0x3c')]();this[_0x69de('0x3d')]();RpcSetting[_0x69de('0x3e')]()[_0x69de('0x3f')](function(_0x1e0a1a){previewRecallmeReminderInterval=_0x1e0a1a[_0x69de('0x40')];});}function isNotNull(_0x117598){return _0x117598!==null&&!_[_0x69de('0x41')](_0x117598);}function msgResponse(_0x477444,_0x38ab2e,_0x34c3e9){return{'action':_0x477444,'response':_0x38ab2e,'message':_0x34c3e9,'stack':_0x34c3e9};}function emit(_0x47d19b,_0xefc9a5,_0x4c29c2){io['to'](_0x47d19b)[_0x69de('0x42')](_0xefc9a5,_0x4c29c2);}function emitOutboundVoiceQueueSummary(_0x1602d7){if(_0x1602d7[_0x69de('0x43')]===_0x69de('0x44')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x69de('0x45')](_0x1602d7,{'showHidden':![],'depth':null}));emit(util['format'](_0x69de('0x46'),_0x1602d7[_0x69de('0x47')]),_0x69de('0x48'),_0x1602d7);}}function checkGetDataPredictive(_0x32807c){if(isNotNull(_0x32807c)&&!_[_0x69de('0x49')](_0x32807c)){loggerPredictive['info'](_0x69de('0x4a'));loggerPredictive['info'](_0x69de('0x4b'),_0x32807c[_0x69de('0x4c')]);loggerPredictive[_0x69de('0x4d')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x32807c[_0x69de('0x4e')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x4f'),_0x32807c[_0x69de('0x50')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x51'),_0x32807c[_0x69de('0x52')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x53'),_0x32807c[_0x69de('0x54')]);loggerPredictive[_0x69de('0x4d')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x32807c['predictiveIntervalAvgTalktime']);loggerPredictive[_0x69de('0x4d')](_0x69de('0x55'));if(_0x32807c['predictiveIntervalTotalCalls']>0x0){if(!_[_0x69de('0x41')](_0x32807c[_0x69de('0x56')])&&_0x32807c[_0x69de('0x56')]>0x0){return!![];}loggerPredictive['info'](_0x69de('0x57'));if(!_[_0x69de('0x41')](_0x32807c[_0x69de('0x54')])&&_0x32807c[_0x69de('0x54')]>0x0){return!![];}loggerPredictive[_0x69de('0x4d')](_0x69de('0x58'));}else{loggerPredictive[_0x69de('0x4d')](_0x69de('0x59'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x4531ff){return function(_0x163694){loggerPredictive[_0x69de('0x4d')](_0x69de('0x5a'));loggerPredictive[_0x69de('0x4d')](_0x69de('0x5b'),_0x163694[_0x69de('0x5c')]);loggerPredictive[_0x69de('0x4d')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x163694[_0x69de('0x5d')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x5e'),_0x163694[_0x69de('0x5f')]);loggerPredictive['info'](_0x69de('0x60'),_0x163694[_0x69de('0x61')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x5e'),_0x163694[_0x69de('0x5f')]);loggerPredictive[_0x69de('0x4d')]('---------------------------');_[_0x69de('0x62')](_0x4531ff,_0x163694);};}function ifInterval(_0x5b0bba,_0x29026a){if(_['isUndefined'](_0x29026a)){return![];}return utils[_0x69de('0x63')](undefined,_0x29026a)<_0x5b0bba*0x3c;}function clearPredictiveAttributes(_0x5d347b){if(_0x5d347b[_0x69de('0x27')]){_0x5d347b[_0x69de('0x27')]=undefined;loggerPredictive[_0x69de('0x64')](_0x5d347b['name'],'startProgressive\x20value\x20cleared');}if(_0x5d347b[_0x69de('0x65')]){_0x5d347b[_0x69de('0x65')]=undefined;loggerPredictive['debug'](_0x5d347b[_0x69de('0x47')],_0x69de('0x66'));}if(_0x5d347b[_0x69de('0x67')]){clearInterval(_0x5d347b[_0x69de('0x67')]);_0x5d347b[_0x69de('0x67')]=undefined;loggerPredictive[_0x69de('0x64')](_0x5d347b['name'],_0x69de('0x68'));}}function loggerCatchPredictive(_0xc09c92,_0xed613d){return function(_0x4cb69c){loggerPredictive[_0x69de('0x69')](_0xed613d['name'],_0xc09c92);loggerPredictive[_0x69de('0x69')](_0x4cb69c[_0x69de('0x6a')]);clearPredictiveAttributes(_0xed613d);};}function loggerCatch(_0x227047){return function(_0x53ea85){logger[_0x69de('0x69')](_0x227047,util['inspect'](_0x53ea85,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4d3b86,_0x180560,_0x35bbad){return function(_0x4deb9b){utils[_0x69de('0x6b')](_0x180560,_0x35bbad,0x0);_0x180560[_0x69de('0x6c')]=0x0;logger[_0x69de('0x69')](_0x4d3b86,util[_0x69de('0x45')](_0x4deb9b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x40845a){return function(_0x1b98bb){if(isNotNull(_0x1b98bb)&&isNotNull(_0x1b98bb[0x0])){if(_0x1b98bb[0x0]['contactsRescheduled']>0x0){_0x40845a[_0x69de('0x6d')]=utils[_0x69de('0x6e')]['CONTACTS_RESCHEDULED'];logger[_0x69de('0x4d')](_0x69de('0x6f')+_0x40845a[_0x69de('0x47')],_0x1b98bb[0x0]['contactsRescheduled'],_0x69de('0x70'));}else{_0x40845a[_0x69de('0x6d')]=utils['CAMPAIGN_STATUS'][_0x69de('0x71')];logger[_0x69de('0x4d')](_0x69de('0x72')+_0x40845a[_0x69de('0x47')]);}}};}function createObjHistory(_0x3925b,_0x4477bc,_0x5e243c,_0x103af9,_0x11df46){_0x3925b['message']=_0x5e243c;var _0x3becfa=new Action(_0x3925b,_0x4477bc);var _0x23b0d0=new History(_0x3becfa);_0x23b0d0[_0x69de('0x73')]=_0x103af9;_0x23b0d0[_0x69de('0x74')]=_0x11df46;_0x23b0d0['endtime']=_0x3becfa['starttime'];return _0x23b0d0;}function unlockQueueStatus(_0xde52b9,_0x910187){setTimeout(function(){if(_[_0x69de('0x41')](_0xde52b9[_0x69de('0x75')])){loggerBooked[_0x69de('0x69')]('[unlockQueueStatus][undefined]',_0x910187);}_0xde52b9[_0x69de('0x75')]=!![];loggerBooked['info'](_0x69de('0x76'),_0x910187,JSON[_0x69de('0x77')](_['pick'](_0xde52b9,[_0x69de('0x47'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x3cea85){return function(){if(!isNotNull(_0x3cea85['Interval'])){_0x3cea85[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x78')];throw _0x3cea85[_0x69de('0x47')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x3cea85[_0x69de('0x79')][_0x69de('0x7a')])){_0x3cea85[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x78')];throw _0x3cea85['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x69de('0x49')](_0x3cea85[_0x69de('0x79')][_0x69de('0x7a')]))){_0x3cea85[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x78')];throw _0x3cea85[_0x69de('0x47')]+_0x69de('0x7b');}};}function checkIsIVRCampaignActive(_0xcf065){return function(){if(!utils[_0x69de('0x7c')](_0xcf065)){_0xcf065['message']=utils[_0x69de('0x6e')][_0x69de('0x7d')];throw _0xcf065[_0x69de('0x47')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x571731){if(utils['isIVRCampaign'](_0x571731)){emit(util[_0x69de('0x7e')](_0x69de('0x7f'),_0x571731[_0x69de('0x47')]),_0x69de('0x80'),_0x571731);}}function loggerCatchQueueSummary(_0x3391f5,_0x31d663){return function(_0x17696e){clearPredictiveAttributes(_0x31d663);emitCampaignSummary(_0x31d663);loggerSyncQueueSummary[_0x69de('0x64')](_0x3391f5,util['inspect'](_0x17696e,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x263ca0){if(_0x263ca0[_0x69de('0x81')]){if(_0x263ca0[_0x69de('0x82')]===0x0){_0x263ca0[_0x69de('0x81')]=![];_0x263ca0['message']=utils[_0x69de('0x6e')]['INACTIVE'];loggerSyncQueueSummary[_0x69de('0x64')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x263ca0['name'],_0x69de('0x83'));}else{_0x263ca0[_0x69de('0x6d')]=utils['CAMPAIGN_STATUS'][_0x69de('0x84')];loggerSyncQueueSummary[_0x69de('0x64')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x263ca0[_0x69de('0x47')],_0x69de('0x85'));}emitCampaignSummary(_0x263ca0);}}function myreject(_0x1b75f7){return function(_0x56cfcb){return _0x1b75f7(msgResponse(_0x69de('0x86'),'Error',JSON[_0x69de('0x77')](_0x56cfcb)));};}Dialer['prototype'][_0x69de('0x87')]=function(_0xd40aef){return!_[_0x69de('0x41')](_0xd40aef)&&_0xd40aef&&!_[_0x69de('0x41')](_0xd40aef[_0x69de('0x47')])&&!_[_0x69de('0x41')](_0xd40aef['active'])&&_0xd40aef[_0x69de('0x88')]&&(this['trunks'][util[_0x69de('0x7e')](_0x69de('0x89'),_0xd40aef['name'])][_0x69de('0x8a')]==='reachable'||this[_0x69de('0x23')][util[_0x69de('0x7e')](_0x69de('0x89'),_0xd40aef[_0x69de('0x47')])][_0x69de('0x8a')]==='unmonitored');};Dialer[_0x69de('0x8b')][_0x69de('0x8c')]=function(_0x2469e6){var _0x10f7c8=this;return function(){if(!_0x10f7c8['isTrunkReachable'](_0x2469e6[_0x69de('0x8d')])){if(!_0x10f7c8[_0x69de('0x87')](_0x2469e6['TrunkBackup'])){_0x2469e6['message']=utils[_0x69de('0x6e')][_0x69de('0x8e')];throw _0x2469e6[_0x69de('0x47')]+_0x69de('0x8f');}}};};Dialer[_0x69de('0x8b')][_0x69de('0x90')]=function(_0x3921fb,_0x425706,_0x5bac43,_0x3d70e4){var _0x11d8ae=this;return function(){var _0x368c30=!![];return _0x11d8ae[_0x69de('0x91')](_0x3921fb,_0x425706,_0x5bac43,_0x3d70e4,_0x368c30);};};Dialer[_0x69de('0x8b')][_0x69de('0x92')]=function(_0x5d2172,_0x3f6fc6,_0x79d504,_0x310a6e){var _0x522ffa=this;return function(){var _0x322342=![];return _0x522ffa[_0x69de('0x91')](_0x5d2172[_0x69de('0x7a')],_0x3f6fc6,_0x79d504,_0x310a6e,_0x322342);};};Dialer['prototype'][_0x69de('0x91')]=function(_0x510e36,_0x219eb4,_0x41e29a,_0x487126,_0x27ea8f){var _0x180315=[];return new Promise(function(_0x4168c2,_0x54cf9b){if(!isNotNull(_0x510e36)){_0x487126[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x78')];return _0x54cf9b(msgResponse(_0x69de('0x93'),_0x69de('0x94'),_0x41e29a+_0x69de('0x95')));}if(_[_0x69de('0x49')](_0x510e36)){_0x487126[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x96')];return _0x54cf9b(msgResponse(_0x69de('0x93'),'Failure',_0x41e29a+'\x20Intervals\x20is\x20empty\x20'));}if(_0x219eb4&&_[_0x69de('0x41')](config[_0x69de('0x97')][_0x219eb4])){_0x487126[_0x69de('0x6d')]=utils['CAMPAIGN_STATUS'][_0x69de('0x98')];return _0x54cf9b(msgResponse(_0x69de('0x93'),_0x69de('0x94'),_0x41e29a+'\x20Timezone\x20unknow\x20'+_0x219eb4));}if(_[_0x69de('0x99')](_0x510e36)){for(var _0x3c958d=0x0;_0x3c958d<_0x510e36[_0x69de('0x9a')];_0x3c958d+=0x1){_0x180315['push'](ami['Action']({'action':_0x69de('0x9b'),'command':util['format'](_0x69de('0x9c'),_0x510e36[_0x3c958d][_0x69de('0x9d')],!_[_0x69de('0x41')](config['timezones'][_0x219eb4])?_0x219eb4:'')})[_0x69de('0x3f')](function(_0x2a9b27){return _0x2a9b27[_0x69de('0x9e')][_0x69de('0x9f')](_0x69de('0xa0'))>=0x0;})[_0x69de('0xa1')](myreject(_0x54cf9b)));}}else{_0x180315[_0x69de('0xa2')](ami['Action']({'action':'command','command':util[_0x69de('0x7e')]('iftime\x20%s,%s',_0x510e36,!_[_0x69de('0x41')](config[_0x69de('0x97')][_0x219eb4])?_0x219eb4:'')})['then'](function(_0x494109){return _0x494109['content'][_0x69de('0x9f')]('true')>=0x0;})[_0x69de('0xa1')](myreject(_0x54cf9b)));}Promise[_0x69de('0xa3')](_0x180315)['then'](function(_0x51b6aa){var _0xffffe7=_['some'](_0x51b6aa);if(_0xffffe7){return _0x4168c2(_0xffffe7);}else{_0x487126[_0x69de('0x6d')]=_0x27ea8f?utils[_0x69de('0x6e')][_0x69de('0xa4')]:utils[_0x69de('0x6e')][_0x69de('0xa5')];return _0x54cf9b(msgResponse(_0x69de('0xa6'),_0x69de('0x94'),_0x69de('0xa7')+_0x27ea8f+'\x20'+_0x41e29a+_0x69de('0xa8')+util[_0x69de('0x45')](_0x510e36,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x219eb4));}})['catch'](function(_0x282342){return _0x54cf9b(msgResponse(_0x69de('0x93'),'Failure',JSON['stringify'](_0x282342)));});});};Dialer[_0x69de('0x8b')][_0x69de('0x3c')]=function(){var _0x253ee4=this;return cmHopper[_0x69de('0xa9')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x253ee4['syncCampaigns']();},0x3e8);});};Dialer[_0x69de('0x8b')][_0x69de('0xaa')]=function(){var _0x279588=this;var _0x40fbfa;for(var _0x3bb883 in this[_0x69de('0x21')]){if(typeof this[_0x69de('0x21')][_0x3bb883]!==_0x69de('0xab')){_0x40fbfa=this[_0x69de('0x21')][_0x3bb883];if(utils[_0x69de('0xac')](_0x40fbfa)&&utils[_0x69de('0x7c')](_0x40fbfa)){_0x40fbfa[_0x69de('0x81')]=!![];Promise[_0x69de('0xad')]()['then'](checkIsIVRCampaignActive(_0x40fbfa))[_0x69de('0x3f')](checkInterval(_0x40fbfa))['then'](_0x279588[_0x69de('0x8c')](_0x40fbfa))[_0x69de('0x3f')](_0x279588['checkIfTime'](_0x40fbfa['dialGlobalInterval'],_0x40fbfa[_0x69de('0xae')],_0x40fbfa[_0x69de('0x47')],_0x40fbfa))['then'](_0x279588[_0x69de('0x92')](_0x40fbfa[_0x69de('0x79')],_0x40fbfa[_0x69de('0xae')],_0x40fbfa[_0x69de('0x47')],_0x40fbfa))['then'](_0x279588['launchHandleIvr'](_0x40fbfa))[_0x69de('0xa1')](loggerCatchQueueSummary('[syncCampaigns]',_0x40fbfa));}else{notSendMessagesCampaign(_0x40fbfa);}}}};Dialer[_0x69de('0x8b')][_0x69de('0xaf')]=function(_0x46fb89){if(_0x46fb89[_0x69de('0xb0')]!=='predictive'){clearPredictiveAttributes(_0x46fb89);}switch(_0x46fb89[_0x69de('0xb0')]){case _0x69de('0xb1'):this['handlePower'](_0x46fb89,0x1);break;case _0x69de('0xb2'):this[_0x69de('0xb3')](_0x46fb89,_0x46fb89['dialPowerLevel']);break;case'predictive':this[_0x69de('0xa')](_0x46fb89);break;case _0x69de('0x9'):this['handlePower'](_0x46fb89,0x1);break;default:logger['error'](_0x69de('0xb4'),_0x46fb89[_0x69de('0x47')],_0x69de('0xb5'));}};Dialer['prototype'][_0x69de('0x93')]=function(_0x49745b,_0x22d3ad){var _0x4fb46=_0x49745b[_0x69de('0xae')];var _0x20500e=_0x22d3ad?_0x49745b[_0x69de('0xb6')]:_0x49745b[_0x69de('0x79')][_0x69de('0x7a')];logger['silly'](_0x69de('0xb7'),_0x20500e,_0x4fb46,_0x49745b[_0x69de('0x47')],util[_0x69de('0x7e')](_0x69de('0xb8'),_0x49745b[_0x69de('0x47')],_0x49745b['id']));var _0x4bac6c=null;return Interval[_0x69de('0xb9')](_0x20500e,_0x4fb46)[_0x69de('0x3f')](function(_0x4efdc5){if(_0x4efdc5===!![]){return _0x4efdc5;}else{_0x49745b[_0x69de('0x6d')]=_0x22d3ad?utils[_0x69de('0x6e')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x69de('0x6e')][_0x69de('0xa5')];_0x4bac6c=msgResponse(_0x69de('0xa6'),_0x69de('0x94'),_0x69de('0xa7')+_0x22d3ad+'\x20'+_0x49745b[_0x69de('0x47')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x69de('0x45')](_0x20500e,{'showHidden':![],'depth':null})+_0x69de('0xba')+_0x4fb46);}if(_0x4bac6c!==null){logger[_0x69de('0xbb')](_0x69de('0xbc'),_0x4bac6c);_0x4bac6c['isGlobal']=_0x22d3ad;throw _0x4bac6c;}})[_0x69de('0xa1')](function(_0x575e51){logger['error'](_0x69de('0xbd'),_0x575e51);throw msgResponse(_0x69de('0x86'),_0x69de('0xbe'),util['inspect'](_0x575e51,{'showHidden':![],'depth':null}));});};Dialer[_0x69de('0x8b')][_0x69de('0x2b')]=function(_0x566d89){if(this['voiceQueues'][_0x566d89[_0x69de('0xbf')]]){if(this[_0x69de('0xc0')][_0x566d89[_0x69de('0xc1')]]&&this['uniqueId'][_0x566d89[_0x69de('0xc1')]][_0x69de('0x43')]!==_0x69de('0xc2')){this[_0x69de('0xc3')](this[_0x69de('0x20')][_0x566d89[_0x69de('0xbf')]]);this['uniqueId'][_0x566d89[_0x69de('0xc1')]][_0x69de('0xc4')]=moment()[_0x69de('0x7e')](_0x69de('0xc5'));}}};Dialer[_0x69de('0x8b')]['syncAgentComplete']=function(_0x5b6497){var _0x17124d=this[_0x69de('0xc0')][_0x5b6497['uniqueid']];if(this['voiceQueues'][_0x5b6497[_0x69de('0xbf')]]){if(_0x17124d&&_0x17124d[_0x69de('0x43')]!==_0x69de('0xc2')){delete this[_0x69de('0xc0')][_0x5b6497[_0x69de('0xc1')]];this[_0x69de('0x20')][_0x5b6497[_0x69de('0xbf')]][_0x69de('0xc6')]+=0x1;var _0x3c7397=new AgentComplete(_0x17124d,_0x5b6497);if(_0x5b6497[_0x69de('0xc7')]===_0x69de('0xc8')){_0x3c7397[_0x69de('0xc9')]=this['voiceQueues'][_0x5b6497['queue']][_0x69de('0xca')]&&this[_0x69de('0x20')][_0x5b6497[_0x69de('0xbf')]][_0x69de('0xcb')]?moment()[_0x69de('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x3c7397)[_0x69de('0xa1')](loggerCatch(_0x69de('0xcc')));hopperUtils[_0x69de('0xcd')](_0x3c7397)[_0x69de('0xa1')](loggerCatch(_0x69de('0xce')));}}};Dialer[_0x69de('0x8b')][_0x69de('0xcf')]=function(_0x4a7841){var _0x8693ec=this['uniqueId'][_0x4a7841[_0x69de('0xc1')]];var _0x5c4aa0=this;var _0x48df44=![];var _0x50f693;var _0x37a723;if(this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]]){if(_0x8693ec&&_0x8693ec[_0x69de('0x43')]!==_0x69de('0xc2')){delete this['uniqueId'][_0x4a7841[_0x69de('0xc1')]];this[_0x69de('0xc3')](this['voiceQueues'][_0x4a7841[_0x69de('0xbf')]]);_0x8693ec['droptime']=moment()['format'](_0x69de('0xc5'));var _0x4f5c4f=new QueueCallerAbandon(_0x8693ec,_0x4a7841);if(utils['getSeconds'](_0x8693ec[_0x69de('0xd0')],_0x8693ec[_0x69de('0xd1')])>=_0x8693ec['dialQueueTimeout']){this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0x50')]+=0x1;this[_0x69de('0x20')][_0x4a7841['queue']][_0x69de('0xd2')]+=0x1;this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd3')]+=0x1;_0x4f5c4f[_0x69de('0x73')]=0xa;_0x4f5c4f[_0x69de('0x74')]=_0x69de('0xd4');_0x4f5c4f['dropreason']=_0x69de('0xd5');_0x4f5c4f['agiafterat']=this[_0x69de('0x20')][_0x4a7841['queue']][_0x69de('0xca')]?moment()[_0x69de('0x7e')](_0x69de('0xc5')):undefined;_0x4f5c4f[_0x69de('0xd6')]+=0x1;_0x4f5c4f[_0x69de('0xd7')]+=0x1;_0x50f693=this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd8')];_0x37a723=this['voiceQueues'][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd9')];hopperUtils[_0x69de('0xda')](_0x4f5c4f,_0x4f5c4f[_0x69de('0x73')],_0x8693ec['voiceQueue'])[_0x69de('0x3f')](function(_0x135489){_0x48df44=_0x135489[_0x69de('0xdb')]==0x1;if(_0x4f5c4f[_0x69de('0xd6')]>=_0x5c4aa0['voiceQueues'][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xdc')]){_0x5c4aa0[_0x69de('0xdd')](_0x4f5c4f,_0x135489[_0x69de('0xdb')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4f5c4f['countdropretry'],'scheduledat':moment()[_0x69de('0xde')](_0x5c4aa0['voiceQueues'][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd8')],_0x69de('0xdf'))['format'](_0x69de('0xc5')),'ContactId':_0x8693ec[_0x69de('0xe0')],'ListId':_0x8693ec[_0x69de('0xe1')],'VoiceQueueId':_0x8693ec[_0x69de('0xe2')]||undefined,'CampaignId':_0x8693ec[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0xe4')));var _0x4490c0=new History(_0x4f5c4f);_0x4490c0[_0x69de('0x73')]=0xa;_0x4490c0['statedesc']=_0x69de('0xd4');_0x4490c0[_0x69de('0xe5')]=moment()[_0x69de('0x7e')](_0x69de('0xc5'));_0x4490c0[_0x69de('0xe6')]=_0x4490c0[_0x69de('0xe5')];_0x4490c0['calleridname']=_0x4f5c4f[_0x69de('0xe7')];_0x4490c0['calleridnum']=_0x4f5c4f[_0x69de('0xe8')];hopperUtils[_0x69de('0xe9')](_0x4490c0)[_0x69de('0xa1')](loggerCatch(_0x69de('0xea')));}})['then'](function(){if(_0x48df44)hopperUtils[_0x69de('0xeb')](_0x4f5c4f,_0x50f693,_0x37a723)[_0x69de('0x3f')](function(){return 0x1;});});}else{this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0x52')]+=0x1;this[_0x69de('0x20')][_0x4a7841['queue']][_0x69de('0xec')]+=0x1;_0x4f5c4f[_0x69de('0x73')]=0xb;_0x4f5c4f['statedesc']='Abandoned';_0x4f5c4f[_0x69de('0xed')]=_0x69de('0xee');_0x4f5c4f['countabandonedretry']+=0x1;_0x4f5c4f[_0x69de('0xd7')]+=0x1;_0x50f693=this['voiceQueues'][_0x4a7841[_0x69de('0xbf')]]['dialAbandonedRetryFrequency'];_0x37a723=this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd9')];hopperUtils['verifyAdditionalPhones'](_0x4f5c4f,_0x4f5c4f[_0x69de('0x73')],_0x8693ec['voiceQueue'])['then'](function(_0x10caa5){if(_0x4f5c4f[_0x69de('0xef')]>=_0x5c4aa0[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]]['dialAbandonedMaxRetry']){_0x5c4aa0[_0x69de('0xdd')](_0x4f5c4f,_0x10caa5[_0x69de('0xdb')]);}else{hopperUtils[_0x69de('0xf0')]({'active':![],'countabandonedretry':_0x4f5c4f[_0x69de('0xef')],'scheduledat':moment()[_0x69de('0xde')](_0x5c4aa0['voiceQueues'][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xf1')],_0x69de('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8693ec['ContactId'],'ListId':_0x8693ec[_0x69de('0xe1')],'VoiceQueueId':_0x8693ec[_0x69de('0xe2')]||undefined,'CampaignId':_0x8693ec[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4a11e3=new History(_0x4f5c4f);_0x4a11e3['state']=0xb;_0x4a11e3[_0x69de('0x74')]=_0x69de('0xf2');_0x4a11e3[_0x69de('0xe5')]=moment()[_0x69de('0x7e')](_0x69de('0xc5'));_0x4a11e3[_0x69de('0xe6')]=_0x4a11e3[_0x69de('0xe5')];_0x4a11e3[_0x69de('0xe7')]=_0x4f5c4f[_0x69de('0xe7')];_0x4a11e3[_0x69de('0xe8')]=_0x4f5c4f[_0x69de('0xe8')];hopperUtils['createHistory'](_0x4a11e3)[_0x69de('0xa1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x69de('0x3f')](function(){if(_0x48df44)hopperUtils[_0x69de('0xeb')](_0x4f5c4f,_0x50f693,_0x37a723)[_0x69de('0x3f')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x69de('0x36')]=function(_0x2f11ed){if(this[_0x69de('0xf3')][_0x2f11ed[_0x69de('0xc1')]]){this[_0x69de('0xf3')][_0x2f11ed['uniqueid']][_0x69de('0xf4')]=_0x2f11ed['channel'];}if(this[_0x69de('0xc0')][_0x2f11ed[_0x69de('0xc1')]]){this['uniqueId'][_0x2f11ed[_0x69de('0xc1')]][_0x69de('0xf4')]=_0x2f11ed[_0x69de('0xf4')];}};Dialer['prototype'][_0x69de('0x39')]=function(_0x5cf8e3){if(!this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]]){return;}var _0x58b763=this[_0x69de('0x20')][this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xbf')]]['strategy']||_0x69de('0xf6');if(_0x58b763===_0x69de('0xf7')){if(this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]]&&_['isNil'](this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]]['locked'])&&_0x5cf8e3['status']==='1'&&_0x5cf8e3[_0x69de('0xf8')]==='0'){if(this[_0x69de('0x22')][_0x5cf8e3[_0x69de('0xf9')]]){if(!this[_0x69de('0x22')][_0x5cf8e3[_0x69de('0xf9')]][_0x69de('0xfa')]){this[_0x69de('0x22')][_0x5cf8e3[_0x69de('0xf9')]]['locked']=!![];this['actions'][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xfa')]=!![];this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xf9')]=_0x5cf8e3['stateinterface'];}}}}else if(_0x58b763===_0x69de('0xf6')){if(this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]]){if(this[_0x69de('0x22')][_0x5cf8e3[_0x69de('0xf9')]]){this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xf9')]=_0x5cf8e3[_0x69de('0xf9')];if(_['isNil'](this[_0x69de('0x29')][this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xbf')]])){this[_0x69de('0x29')][this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xbf')]]=[];}this['queueBooked'][this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xbf')]][_0x69de('0xa2')](_[_0x69de('0x62')](_[_0x69de('0xfb')](this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]],[_0x69de('0xfc'),_0x69de('0xf9')]),{'status':_0x5cf8e3[_0x69de('0x8a')],'paused':_0x5cf8e3[_0x69de('0xf8')]}));}}}};Dialer[_0x69de('0x8b')][_0x69de('0x3b')]=function(_0xa25c99){if(!this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]]){return;}var _0x47f01c=this;var _0xe6bf71=this['voiceQueues'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]];var _0xe6646b=_0xe6bf71[_0x69de('0xfd')]||_0x69de('0xf6');if(_0xe6646b===_0x69de('0xf7')){if(this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]]&&this['actions'][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xf9')]){this[_0x69de('0x1f')][_0x69de('0xfe')](this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xfc')],this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xf9')])[_0x69de('0xa1')](function(_0x2acfa0){logger['error'](_0x69de('0xff'),util[_0x69de('0x45')](_0x2acfa0,{'showHidden':![],'depth':null}));})['finally'](function(){_0x47f01c[_0x69de('0xc3')](_0x47f01c['voiceQueues'][_0x47f01c[_0x69de('0xf3')][_0xa25c99['actionid']][_0x69de('0xbf')]]);_0x47f01c[_0x69de('0x22')][_0x47f01c[_0x69de('0xf3')][_0xa25c99['actionid']][_0x69de('0xf9')]][_0x69de('0xfa')]=![];delete _0x47f01c[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]];unlockQueueStatus(_0xe6bf71);});}else{this[_0x69de('0xc3')](this[_0x69de('0x20')][this['actions'][_0xa25c99['actionid']][_0x69de('0xbf')]]);hopperUtils[_0x69de('0xf0')]({'active':![],'ContactId':this['actions'][_0xa25c99['actionid']][_0x69de('0xe0')],'ListId':this[_0x69de('0xf3')][_0xa25c99['actionid']]['ListId'],'VoiceQueueId':this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xe2')]||undefined,'CampaignId':this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]];unlockQueueStatus(_0xe6bf71);}}else if(_0xe6646b===_0x69de('0xf6')){var _0x3b189c;if(this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]]&&!_[_0x69de('0x49')](this['queueBooked'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]])){if(this['queueBookedRR'][_0x47f01c['actions'][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]]){this[_0x69de('0x100')][_0x47f01c[_0x69de('0xf3')][_0xa25c99['actionid']][_0x69de('0xbf')]]=this['queueBookedRR'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]]?this['queueBookedRR'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]]:this[_0x69de('0x29')][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]]?this['queueBooked'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]][_0x69de('0x101')]||0x0:0x0;}this[_0x69de('0x29')][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]][_0x69de('0x101')]=this[_0x69de('0x100')][this[_0x69de('0xf3')][_0xa25c99['actionid']][_0x69de('0xbf')]];for(var _0x430399=0x0;_0x430399=_0x26d60a[_0x69de('0x129')]){_0x514112[_0x69de('0x12a')](_0x6610f6,_0x50c3cc,_0x1f3808,'reason19\x20machine....');}else{if(_0x6610f6[_0x69de('0x127')]>=_0x26d60a['dialMachineMaxRetry']){_0x514112[_0x69de('0x12b')](_0x6610f6,_0x50c3cc,_0x1f3808,'reason\x2019\x20machine....');}else{hopperUtils[_0x69de('0xf0')]({'active':![],'countmachineretry':_0x6610f6[_0x69de('0x127')],'scheduledat':moment()[_0x69de('0xde')](_0x26d60a[_0x69de('0x12c')],_0x69de('0xdf'))[_0x69de('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6610f6['ContactId'],'ListId':_0x6610f6['ListId'],'VoiceQueueId':_0x6610f6[_0x69de('0xe2')]||undefined,'CampaignId':_0x6610f6[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x12d')));_0x50c3cc({'reschedule':0x1});}}});}if(_0x450ca2[_0x69de('0x43')]==='ivr'&&this[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]]['dialAMDActive']&&_0x2a5659[_0x69de('0x117')]===_0x69de('0x118')){delete this['uniqueId'][_0x2a5659[_0x69de('0xc1')]];this['updateOriginated'](this[_0x69de('0x21')][_0x450ca2['queue']]);_0x5b7c28=new Hangup(_0x450ca2,_0x2a5659);_0x5b7c28[_0x69de('0x73')]=0x12;_0x5b7c28[_0x69de('0x74')]=_0x69de('0x11a');_0x5b7c28[_0x69de('0x11b')]=_0x69de('0x11c');ami['emit'](_0x69de('0x122'),ut[_0x69de('0x11d')](_0x5b7c28,'amd'));this['saveInDb'](_0x5b7c28,'[syncHangupInAMDIvr][createHistory]',_0x69de('0x12e'));}if(_0x450ca2[_0x69de('0x43')]===_0x69de('0xc2')&&this[_0x69de('0x21')][_0x450ca2['queue']][_0x69de('0x116')]&&_0x2a5659[_0x69de('0x117')]===_0x69de('0x120')){return new Promise(function(_0xb2c378,_0x387800){delete _0x514112[_0x69de('0xc0')][_0x2a5659[_0x69de('0xc1')]];_0x514112['updateOriginated'](_0x514112[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]]);_0x514112[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]]['outboundAnswerCallsDay']+=0x1;_0x514112[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]][_0x69de('0x119')]+=0x1;var _0x2da017=_0x514112[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]];var _0x2c9047=new Hangup(_0x450ca2,_0x2a5659);_0x2c9047[_0x69de('0x73')]=0x13;_0x2c9047['statedesc']=_0x69de('0x121');_0x2c9047[_0x69de('0x11b')]=_0x69de('0x11c');_0x2c9047[_0x69de('0x127')]+=0x1;_0x2c9047['countglobal']+=0x1;_0x2c9047[_0x69de('0x11e')]=!![];ami['emit'](_0x69de('0x122'),ut[_0x69de('0x11d')](_0x2c9047,'amd'));hopperUtils['createHistory'](_0x2c9047)[_0x69de('0xa1')](loggerCatch(_0x69de('0x123')));if(_0x2c9047[_0x69de('0x124')]+_0x2c9047['countcongestionretry']+_0x2c9047[_0x69de('0x125')]+_0x2c9047['countnosuchnumberretry']+_0x2c9047['countdropretry']+_0x2c9047[_0x69de('0xef')]+_0x2c9047[_0x69de('0x127')]+_0x2c9047[_0x69de('0x128')]>=_0x2da017['dialGlobalMaxRetry']){_0x514112[_0x69de('0x12a')](_0x2c9047,_0xb2c378,_0x387800,_0x69de('0x12f'));}else{if(_0x2c9047[_0x69de('0x127')]>=_0x2da017[_0x69de('0x130')]){_0x514112[_0x69de('0x12b')](_0x2c9047,_0xb2c378,_0x387800,_0x69de('0x131'));}else{hopperUtils[_0x69de('0xf0')]({'active':![],'countmachineretry':_0x2c9047[_0x69de('0x127')],'scheduledat':moment()['add'](_0x2da017[_0x69de('0x12c')],_0x69de('0xdf'))[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x2c9047[_0x69de('0xe0')],'ListId':_0x2c9047['ListId'],'VoiceQueueId':_0x2c9047['VoiceQueueId']||undefined,'CampaignId':_0x2c9047[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x12d')));_0xb2c378({'reschedule':0x1});}}});}}};Dialer[_0x69de('0x8b')]['syncHangup']=function(_0x12335d){var _0xf1c149=this[_0x69de('0xc0')][_0x12335d[_0x69de('0xc1')]];var _0x362344;if(_0xf1c149&&_0xf1c149[_0x69de('0x43')]===_0x69de('0xc2')){delete this[_0x69de('0xc0')][_0x12335d[_0x69de('0xc1')]];this[_0x69de('0xc3')](this[_0x69de('0x21')][_0xf1c149[_0x69de('0xbf')]]);this[_0x69de('0x21')][_0xf1c149[_0x69de('0xbf')]]['ivrAnswerCallsDay']+=0x1;_0x362344=new Hangup(_0xf1c149,_0x12335d);hopperUtils[_0x69de('0xe9')](_0x362344)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x69de('0xcd')](_0x362344)[_0x69de('0xa1')](loggerCatch(_0x69de('0x132')));}if(_0xf1c149&&_0xf1c149[_0x69de('0x43')]!==_0x69de('0xc2')&&isNotNull(this['voiceQueues'][_0xf1c149[_0x69de('0xbf')]][_0x69de('0x133')])){delete this[_0x69de('0xc0')][_0x12335d['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0xf1c149[_0x69de('0xbf')]]);this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]][_0x69de('0xc6')]+=0x1;this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]][_0x69de('0x119')]+=0x1;_0x362344=new Hangup(_0xf1c149,_0x12335d);_0x362344['state']=0x10;_0x362344[_0x69de('0x74')]=_0x69de('0x134');_0x362344[_0x69de('0x11b')]=_0x69de('0x135');hopperUtils[_0x69de('0xe9')](_0x362344)[_0x69de('0xa1')](loggerCatch(_0x69de('0x136')));hopperUtils['moveContactManagedDialer'](_0x362344)[_0x69de('0xa1')](loggerCatch('[syncHangupIvr]'));}if(_0xf1c149&&_0xf1c149[_0x69de('0x43')]!==_0x69de('0xc2')&&!isNotNull(this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]][_0x69de('0x133')])){if(_0x12335d[_0x69de('0x137')]===_0x69de('0x138')){delete this[_0x69de('0xc0')][_0x12335d['uniqueid']];this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]]['outboundAnswerCallsDay']+=0x1;const _0x3ba5fd=new AgentComplete(_0xf1c149,_0x12335d);_0x3ba5fd[_0x69de('0xe3')]=this['voiceQueues'][_0xf1c149[_0x69de('0xbf')]]['id'];hopperUtils['createHistory'](_0x3ba5fd)[_0x69de('0xa1')](loggerCatch(_0x69de('0xcc')));hopperUtils[_0x69de('0xcd')](_0x3ba5fd)[_0x69de('0xa1')](loggerCatch(_0x69de('0xce')));}else{delete this[_0x69de('0xc0')][_0x12335d[_0x69de('0xc1')]];this[_0x69de('0xc3')](this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]]);this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]][_0x69de('0x139')]+=0x1;_0x362344=new Hangup(_0xf1c149,_0x12335d);_0x362344[_0x69de('0x73')]=0xc;_0x362344[_0x69de('0x74')]=_0x12335d[_0x69de('0x137')];_0x362344['membername']='Unknow';hopperUtils['createHistory'](_0x362344)['catch'](loggerCatch(_0x69de('0x136')));hopperUtils['moveContactManagedDialer'](_0x362344)[_0x69de('0xa1')](loggerCatch(_0x69de('0x132')));}}};Dialer[_0x69de('0x8b')]['syncQueueSummary']=function(_0x3cd28b){var _0x1b614d=this;if(!_0x1b614d[_0x69de('0x2a')][_0x3cd28b['name']]){_0x1b614d['queuesSummary'][_0x3cd28b[_0x69de('0x47')]]={'running':![]};}else if(_0x1b614d['queuesSummary'][_0x3cd28b[_0x69de('0x47')]][_0x69de('0x13a')]===!![]){return;}else if(_0x1b614d[_0x69de('0x2a')][_0x3cd28b['name']][_0x69de('0x13a')]===![]){_0x1b614d[_0x69de('0x2a')][_0x3cd28b[_0x69de('0x47')]]['running']=!![];}var _0x434df7=_0x1b614d[_0x69de('0x20')][_0x3cd28b['name']];var _0x58cdd3=_0x434df7[_0x69de('0x6d')]!==utils[_0x69de('0x6e')][_0x69de('0x7d')];var _0x62c8ac=utils[_0x69de('0x13b')](_0x434df7);_0x434df7[_0x69de('0x13c')]=utils[_0x69de('0x13d')](_0x434df7,_0x1b614d[_0x69de('0x23')]);Promise[_0x69de('0xad')]()[_0x69de('0x3f')](function(){if(_0x434df7[_0x69de('0x13c')]===utils[_0x69de('0x6e')]['INACTIVE']){if(_0x58cdd3){clearPredictiveAttributes(_0x434df7);_0x3cd28b['startPredictive']=undefined;_0x3cd28b['startProgressive']=undefined;}if(_0x434df7['statusMessage']===utils['CAMPAIGN_STATUS'][_0x69de('0x7d')]){_0x3cd28b[_0x69de('0x13e')]=0x0;_0x3cd28b['paused']=0x0;_0x3cd28b[_0x69de('0x13f')]=0x0;_0x3cd28b['talking']=0x0;_0x3cd28b[_0x69de('0x140')]=0x0;}}else if(_0x434df7[_0x69de('0x13c')]===utils[_0x69de('0x6e')][_0x69de('0x141')]&&!_0x62c8ac){return _0x1b614d['ifTime'](_0x434df7,!![])[_0x69de('0x3f')](function(){return _0x1b614d[_0x69de('0x93')](_0x434df7,![]);})[_0x69de('0x3f')](function(){return _0x1b614d['checkDialMethod'](_0x434df7);})[_0x69de('0xa1')](function(_0x5e7e3e){loggerSyncQueueSummary[_0x69de('0x64')]('[syncQueueSummary]',util[_0x69de('0x45')](_0x5e7e3e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x434df7);});}else{clearPredictiveAttributes(_0x434df7);}})['then'](function(){var _0x53aaea=_0x3cd28b[_0x69de('0x142')](_0x434df7);if(_0x53aaea||_0x434df7['queueSummaryCountersUpdated']){_0x434df7[_0x69de('0x143')]=![];_0x3cd28b[_0x69de('0x144')](_0x434df7);Object[_0x69de('0x145')](_0x434df7,_0x3cd28b);emitOutboundVoiceQueueSummary(_0x3cd28b);}_0x1b614d[_0x69de('0x2a')][_0x434df7[_0x69de('0x47')]][_0x69de('0x13a')]=![];})['catch'](function(_0x2b0fe3){logger[_0x69de('0x69')](_0x69de('0x146'),util['inspect'](_0x2b0fe3,{'showHidden':![],'depth':null}));_0x1b614d[_0x69de('0x2a')][_0x434df7['name']][_0x69de('0x13a')]=![];});};Dialer[_0x69de('0x8b')][_0x69de('0x33')]=_['throttle'](function(){var _0x29dead=_[_0x69de('0x147')](this[_0x69de('0x20')],function(_0x3fbb55){return _0x3fbb55['dialPreviewRecallmeReminder'];});var _0xfa2d03=_['filter'](this['agents'],function(_0x19fa73){return _0x19fa73[_0x69de('0x148')]&&_0x19fa73[_0x69de('0x8a')]==='reachable';});if(_0x29dead['length']>0x0&&_0xfa2d03['length']>0x0){return Promise[_0x69de('0xad')]()[_0x69de('0x3f')](cmHopper[_0x69de('0x149')](_[_0x69de('0x14a')](_0x29dead,'id'),previewRecallmeReminderInterval,_[_0x69de('0x14a')](_0xfa2d03,'id')))['then'](function(_0x2f2d04){for(var _0x99e4e3=0x0;_0x99e4e3<_0x2f2d04['length'];_0x99e4e3++){var _0x4fd396=_0x2f2d04[_0x99e4e3][_0x69de('0x14b')]['name'];if(_0x4fd396)io['to'](util['format'](_0x69de('0x14c'),_0x4fd396))[_0x69de('0x42')](_0x69de('0x14d'),{'hopper':_0x2f2d04[_0x99e4e3]});}})[_0x69de('0xa1')](function(_0x3519e1){logger[_0x69de('0x69')](_0x69de('0x14e'),_0x3519e1);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x3568ae=this;setInterval(function(){_0x3568ae[_0x69de('0x14f')](_0x3568ae[_0x69de('0xc0')],_0x69de('0x150'));_0x3568ae[_0x69de('0x14f')](_0x3568ae[_0x69de('0xf3')],_0x69de('0x151'));},0x32c8);};Dialer[_0x69de('0x8b')]['clearZombieChannels']=function(_0x57dd0a,_0x2cbe44){var _0x51c7e6=this;for(var _0x2b068e in _0x57dd0a){if(typeof _0x57dd0a[_0x2b068e]!=='undefined'){this[_0x69de('0x1e')][_0x69de('0x1b')](function(){if(!_[_0x69de('0x102')](_0x57dd0a[_0x2b068e])){return ami[_0x69de('0x152')]({'action':_0x69de('0x8a'),'channel':_0x57dd0a[_0x2b068e][_0x69de('0xf4')]})[_0x69de('0xa1')](function(_0x127abc){if(_0x127abc[_0x69de('0x6d')]===_0x69de('0x153')){setTimeout(function(){if(_0x57dd0a[_0x2b068e]&&_0x57dd0a[_0x2b068e][_0x69de('0x43')]!=='ivr'){_0x51c7e6[_0x69de('0xc3')](_0x51c7e6[_0x69de('0x20')][_0x57dd0a[_0x2b068e][_0x69de('0xbf')]]);logger[_0x69de('0x69')](_0x69de('0x154'),_0x2cbe44,_0x2b068e,_0x57dd0a[_0x2b068e][_0x69de('0xbf')]);delete _0x57dd0a[_0x2b068e];}if(_0x57dd0a[_0x2b068e]&&_0x57dd0a[_0x2b068e][_0x69de('0x43')]===_0x69de('0xc2')){_0x51c7e6[_0x69de('0xc3')](_0x51c7e6[_0x69de('0x21')][_0x57dd0a[_0x2b068e][_0x69de('0xbf')]]);logger[_0x69de('0x69')](_0x69de('0x155'),_0x2cbe44,_0x2b068e,_0x57dd0a[_0x2b068e][_0x69de('0xbf')]);delete _0x57dd0a[_0x2b068e];}},0x2328);}});}});}}};Dialer[_0x69de('0x8b')][_0x69de('0x156')]=function(_0x1b0a70){return Promise[_0x69de('0xad')]()[_0x69de('0x3f')](voiceQueueRt[_0x69de('0x156')](_0x1b0a70))[_0x69de('0xa1')](loggerCatch(_0x69de('0x157')));};Dialer[_0x69de('0x8b')][_0x69de('0xc3')]=function(_0x4d9e88){if(!_['isUndefined'](_0x4d9e88)&&_0x4d9e88!==null){if(typeof _0x4d9e88[_0x69de('0x82')]!==_0x69de('0xab')){if(_0x4d9e88['originated']>0x0){_0x4d9e88[_0x69de('0x82')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x69de('0x69')](_0x69de('0x158'));}};Dialer[_0x69de('0x8b')][_0x69de('0x159')]=function(_0x1a628a,_0x47b0aa){var _0x4af061=this;return function(_0x1a5c6e){_0x4af061['updateOriginated'](_0x47b0aa);logger[_0x69de('0x69')](_0x1a628a,util[_0x69de('0x45')](_0x1a5c6e,{'showHidden':![],'depth':null}));};};Dialer[_0x69de('0x8b')]['emptyContact']=function(_0x1d43ba,_0x40f86c,_0x1dfdd4){var _0xa728c={'state':0x19,'statedesc':_0x69de('0x15a')};this[_0x69de('0xc3')](_0x40f86c);this[_0x69de('0x15b')](_[_0x69de('0x62')](_0xa728c,_[_0x69de('0xfb')](_0x1dfdd4,[_0x69de('0xe0'),_0x69de('0xe1'),_0x69de('0x15c'),_0x69de('0xe2'),'CampaignId'])),_0x69de('0x15d'),_0x69de('0x15e'));logger['error'](_0x1d43ba);};Dialer[_0x69de('0x8b')][_0x69de('0x15b')]=function(_0x3f0205,_0x481444,_0x6574ca){hopperUtils['createHistory'](_0x3f0205)['catch'](loggerCatch(_0x481444));hopperUtils[_0x69de('0xcd')](_0x3f0205)['catch'](loggerCatch(_0x6574ca));};Dialer[_0x69de('0x8b')][_0x69de('0xdd')]=function(_0x388331,_0x5cc122){hopperUtils[_0x69de('0xe9')](_0x388331)[_0x69de('0xa1')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x5cc122==0x0){hopperUtils[_0x69de('0xcd')](_0x388331)[_0x69de('0xa1')](loggerCatch(_0x69de('0x15f')));}};Dialer[_0x69de('0x8b')][_0x69de('0x14e')]=function(_0xcaccf6){return Promise[_0x69de('0xad')]()[_0x69de('0x3f')](cmHopper['handlePreviewRecallNotifications'](_0xcaccf6['id'],previewRecallmeReminderInterval))[_0x69de('0x3f')](function(_0x37cb12){for(var _0x4e401a=0x0;_0x4e401a<_0x37cb12[_0x69de('0x9a')];_0x4e401a++){var _0x1316b6=_0x37cb12[_0x4e401a][_0x69de('0x14b')][_0x69de('0x47')];if(_0x1316b6)io['to'](util[_0x69de('0x7e')]('user:%s',_0x1316b6))[_0x69de('0x42')](_0x69de('0x14d'),{'hopper':_0x37cb12[_0x4e401a]});}})[_0x69de('0xa1')](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x48d4c9){var _0x4045b9=this;return function(){_0x4045b9['handleIvr'](_0x48d4c9);};};Dialer[_0x69de('0x8b')][_0x69de('0x160')]=function(_0x2863ea,_0x39504d){var _0xd31b61=this;var _0xc45c53=uuid['v4']();this['actions'][_0xc45c53]=new Action(_0x2863ea,_0x39504d,_0xc45c53);return new Promise(function(_0x1409a8,_0x152fcc){if(_[_0x69de('0x41')](_0x2863ea)&&typeof _0x2863ea!==_0x69de('0x161')){return _0x152fcc(msgResponse(_0x69de('0x162'),'Failure',_0x69de('0x163')));}if(_[_0x69de('0x41')](_0x39504d['phone'])||_0x39504d[_0x69de('0x164')]===null){return _0x152fcc(msgResponse(_0x69de('0x162'),_0x69de('0x94'),_0x69de('0x165')));}var _0x5eb6fe={'XMD-CALLERID':_0xd31b61[_0x69de('0xf3')][_0xc45c53][_0x69de('0x166')](),'XMD-AGI':_0x2863ea[_0x69de('0x133')]?util[_0x69de('0x7e')](_0x69de('0x167'),ipAgi,_0x2863ea[_0x69de('0x133')]):'NONE','XMD-AGIAFTER':_0x2863ea[_0x69de('0xca')]?util[_0x69de('0x7e')](_0x69de('0x167'),ipAgi,_0x2863ea['dialQueueProject2']):_0x69de('0x168'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2863ea)?util[_0x69de('0x7e')](_0x69de('0x169'),_0x2863ea['name'],_0x2863ea[_0x69de('0x16a')]||'',_0x2863ea[_0x69de('0xcb')]?'c':'',_0x2863ea[_0x69de('0x16b')]||0x3):_0x69de('0x168'),'XMD-CONTACTID':_0x39504d[_0x69de('0xe0')],'XMD-CDRTYPE':_0x69de('0x7'),'CALLERID(all)':_0xd31b61[_0x69de('0xf3')][_0xc45c53][_0x69de('0x166')](),'XMD-AMD':_0x2863ea[_0x69de('0x116')]?_0x69de('0x141'):_0x69de('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2863ea['dialAMDActive']){_0x5eb6fe[_0x69de('0x16c')]=_0x2863ea[_0x69de('0x16d')]||0x9c4;_0x5eb6fe[_0x69de('0x16e')]=_0x2863ea[_0x69de('0x16f')]||0x5dc;_0x5eb6fe['XMD-AMDAFTERGREETINGSILENCE']=_0x2863ea[_0x69de('0x170')]||0x320;_0x5eb6fe[_0x69de('0x171')]=_0x2863ea[_0x69de('0x172')]||0x1388;_0x5eb6fe[_0x69de('0x173')]=_0x2863ea['dialAMDMinWordLength']||0x64;_0x5eb6fe[_0x69de('0x174')]=_0x2863ea[_0x69de('0x175')]||0x32;_0x5eb6fe['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2863ea[_0x69de('0x176')]||0x3;_0x5eb6fe[_0x69de('0x177')]=_0x2863ea[_0x69de('0x178')]||0x100;_0x5eb6fe[_0x69de('0x179')]=_0x2863ea[_0x69de('0x17a')]||0x1388;}if(utils[_0x69de('0x17b')](_0x2863ea)){_0x5eb6fe[_0x69de('0x17c')]=_0x39504d[_0x69de('0xe2')];}else{_0x5eb6fe['XMD-CAMPAIGNID']=_0x39504d[_0x69de('0xe3')];}var _0x2fd52f=utils[_0x69de('0x17d')](_0x39504d['Contact']);Object[_0x69de('0x145')](_0x5eb6fe,_0x2fd52f);var _0x116872=_0xd31b61['isTrunkReachable'](_0x2863ea[_0x69de('0x8d')])?utils[_0x69de('0x17e')](_0x2863ea[_0x69de('0x8d')][_0x69de('0x17f')],_0x2863ea[_0x69de('0x180')],_0x2863ea['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x69de('0x181')](_0x2863ea[_0x69de('0x182')],_0x2863ea[_0x69de('0x183')]):_0x2863ea['dialOriginateCallerIdNumber']):utils[_0x69de('0x17e')](_[_0x69de('0x102')](_0x2863ea[_0x69de('0x184')])?_0x2863ea[_0x69de('0x8d')][_0x69de('0x17f')]:_0x2863ea[_0x69de('0x184')][_0x69de('0x17f')],_0x2863ea[_0x69de('0x180')],_0x2863ea[_0x69de('0x183')]>0x0?utils[_0x69de('0x181')](_0x2863ea[_0x69de('0x182')],_0x2863ea[_0x69de('0x183')]):_0x2863ea['dialOriginateCallerIdNumber']);if(_0x116872){_0x5eb6fe[_0x69de('0x185')]=_0xd31b61[_0x69de('0xf3')][_0xc45c53][_0x69de('0x186')]=utils[_0x69de('0x187')](_0x116872);_0x5eb6fe[_0x69de('0x188')]=_0x39504d[_0x69de('0x164')];}_0x2863ea['variables']=_0x5eb6fe;return ami[_0x69de('0x152')]({'actionid':_0xc45c53,'action':'originate','channel':_0xd31b61['isTrunkReachable'](_0x2863ea[_0x69de('0x8d')])?util['format'](_0x69de('0x189'),_0x2863ea[_0x69de('0x8d')][_0x69de('0x47')],isNotNull(_0x2863ea[_0x69de('0x18a')])?_0x2863ea[_0x69de('0x18a')][_0x69de('0x18b')]()||'':'',_0x2863ea['dialCutDigit']>0x0?_0x39504d['phone']['substring'](_0x2863ea[_0x69de('0x18c')]):_0x39504d[_0x69de('0x164')]):util[_0x69de('0x7e')](_0x69de('0x189'),_[_0x69de('0x102')](_0x2863ea[_0x69de('0x184')])?_0x2863ea[_0x69de('0x8d')][_0x69de('0x47')]:_0x2863ea[_0x69de('0x184')][_0x69de('0x47')],isNotNull(_0x2863ea[_0x69de('0x18a')])?_0x2863ea[_0x69de('0x18a')][_0x69de('0x18b')]()||'':'',_0x2863ea[_0x69de('0x18c')]>0x0?_0x39504d[_0x69de('0x164')][_0x69de('0x18d')](_0x2863ea[_0x69de('0x18c')]):_0x39504d[_0x69de('0x164')]),'callerid':_0x116872,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x5eb6fe,'timeout':(_0x2863ea[_0x69de('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0xc45c53})[_0x69de('0x3f')](function(_0x15ef27){return _0x1409a8(_0x15ef27);})[_0x69de('0xa1')](function(_0x3ce7e1){_0x2863ea[_0x69de('0x18f')]+=0x1;var _0x37b705=new History(_0xd31b61[_0x69de('0xf3')][_0xc45c53]);logger[_0x69de('0x69')](util[_0x69de('0x7e')](_0x69de('0x190'),JSON['stringify'](_0x3ce7e1)));_0x37b705[_0x69de('0x73')]=0xe;_0x37b705[_0x69de('0x74')]=_0x69de('0x191');_0x37b705['starttime']=moment()[_0x69de('0x7e')](_0x69de('0xc5'));_0x37b705[_0x69de('0xe6')]=_0x37b705[_0x69de('0xe5')];hopperUtils['createHistory'](_0x37b705)[_0x69de('0xa1')](loggerCatch(_0x69de('0x192')));_0xd31b61[_0x69de('0xcd')](_0x37b705)[_0x69de('0xa1')](loggerCatch('[originate][error]'))['finally'](function(){delete _0xd31b61[_0x69de('0xf3')][_0xc45c53];return _0x152fcc(msgResponse(_0x69de('0x162'),_0x69de('0xbe'),_0x69de('0x193')));});});});};Dialer[_0x69de('0x8b')]['checkRetriveMax']=function(_0x471b52,_0xe350c3,_0x3d388f){var _0x53dfa5=new History(_0xe350c3);if(_0x53dfa5[_0x69de('0x124')]+_0x53dfa5[_0x69de('0x194')]+_0x53dfa5[_0x69de('0x125')]+_0x53dfa5[_0x69de('0x126')]+_0x53dfa5['countdropretry']+_0x53dfa5[_0x69de('0xef')]+_0x53dfa5[_0x69de('0x127')]+_0x53dfa5[_0x69de('0x128')]>=_0x3d388f[_0x69de('0x129')]-0x1){return!![];}switch(_0x471b52){case 0x3:if(_0x53dfa5[_0x69de('0x125')]>=_0x3d388f[_0x69de('0x195')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countnoanswerretry':_0x53dfa5[_0x69de('0x125')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0x196')],_0x69de('0xdf'))[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x53dfa5[_0x69de('0x124')]>=_0x3d388f[_0x69de('0x197')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countbusyretry':_0x53dfa5[_0x69de('0x124')]+=0x1,'scheduledat':moment()['add'](_0x3d388f[_0x69de('0x198')],'minutes')[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5['ListId'],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5['CampaignId']||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x199')));break;case 0x8:if(_0x53dfa5[_0x69de('0x194')]>=_0x3d388f[_0x69de('0x19a')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countcongestionretry':_0x53dfa5[_0x69de('0x194')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0x19b')],_0x69de('0xdf'))['format'](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5['VoiceQueueId']||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x19c')));break;case 0x0:if(_0x53dfa5[_0x69de('0x126')]>=_0x3d388f[_0x69de('0x19d')]-0x1){return!![];}else{hopperUtils[_0x69de('0xf0')]({'active':![],'countnosuchnumberretry':_0x53dfa5[_0x69de('0x126')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f['dialNoSuchNumberRetryFrequency'],'minutes')[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})['catch'](loggerCatch(_0x69de('0x19e')));}break;case 0xa:if(_0x53dfa5[_0x69de('0xd6')]>=_0x3d388f[_0x69de('0xdc')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countdropretry':_0x53dfa5[_0x69de('0xd6')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0xd8')],_0x69de('0xdf'))[_0x69de('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x53dfa5['countabandonedretry']>=_0x3d388f[_0x69de('0x19f')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countabandonedretry':_0x53dfa5[_0x69de('0xef')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0xf1')],_0x69de('0xdf'))['format'](_0x69de('0xc5')),'ContactId':_0x53dfa5['ContactId'],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x1a0')));break;case 0x13:if(_0x53dfa5[_0x69de('0x127')]>=_0x3d388f[_0x69de('0x130')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countmachineretry':_0x53dfa5[_0x69de('0x127')]+=0x1,'scheduledat':moment()['add'](_0x3d388f[_0x69de('0x12c')],_0x69de('0xdf'))[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x12d')));break;case 0x14:if(_0x53dfa5[_0x69de('0x128')]>=_0x3d388f[_0x69de('0x1a1')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countagentrejectretry':_0x53dfa5['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0x1a2')],_0x69de('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5['VoiceQueueId']||undefined,'CampaignId':_0x53dfa5['CampaignId']||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x1a3')));break;default:return!![];}};Dialer[_0x69de('0x8b')]['callProgressDetecting']=function(_0x10d586,_0x4503e9,_0x571e57){var _0x2eeebe=this;var _0x337818=new History(_0x10d586);var _0x2ddf64=![];var _0xd12fc9;var _0x41abf1;return new Promise(function(_0x108b2e,_0x244e6b){if(_[_0x69de('0x41')](_0x4503e9)&&typeof _0x4503e9!==_0x69de('0x161')){return _0x244e6b(msgResponse(_0x69de('0x1a4'),'Failure','entity\x20is\x20undefine'));}if(_[_0x69de('0x41')](_0x571e57)&&typeof _0x571e57!==_0x69de('0x161')){return _0x244e6b(msgResponse(_0x69de('0x1a4'),_0x69de('0x94'),_0x69de('0x1a5')));}hopperUtils['verifyAdditionalPhones'](_0x337818,_0x571e57['reason'],_0x4503e9)[_0x69de('0x3f')](function(_0x5055b9){if(_0x5055b9[_0x69de('0xdb')]==0x1)_0x2ddf64=!![];switch(_0x571e57[_0x69de('0xc7')]){case'0':_0x4503e9[_0x69de('0x1a6')]+=0x1;_0x337818[_0x69de('0x73')]=0x0;_0x337818[_0x69de('0x74')]=_0x69de('0x1a7');_0x337818[_0x69de('0x126')]+=0x1;_0x337818[_0x69de('0xd7')]+=0x1;ami[_0x69de('0x42')](_0x69de('0x1a8'),ut[_0x69de('0x11d')](_0x10d586,_0x69de('0x1a9')));_0xd12fc9=_0x4503e9[_0x69de('0x1aa')];_0x41abf1=_0x4503e9[_0x69de('0xd9')];hopperUtils[_0x69de('0xe9')](_0x337818)['catch'](loggerCatch(_0x69de('0x123')));if(_0x2eeebe[_0x69de('0x1ab')](0x0,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818['countnosuchnumberretry']>=_0x4503e9[_0x69de('0x19d')]){_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ac'));}else{_0x2eeebe['stateGlobal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ac'));}}break;case'3':_0x4503e9['outboundNoAnswerCallsDay']+=0x1;_0x337818[_0x69de('0x73')]=0x3;_0x337818[_0x69de('0x74')]='NoAnswer';_0x337818[_0x69de('0x125')]+=0x1;_0x337818['countglobal']+=0x1;var _0x5a1a64=ut[_0x69de('0x1ad')](_0x10d586,_0x4503e9);ami[_0x69de('0x42')]('custom:agentnoanswer',_0x5a1a64);_0xd12fc9=_0x4503e9[_0x69de('0x196')];_0x41abf1=_0x4503e9[_0x69de('0xd9')];hopperUtils['createHistory'](_0x337818)[_0x69de('0xa1')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2eeebe[_0x69de('0x1ab')](0x3,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818['countnoanswerretry']>=_0x4503e9[_0x69de('0x195')]){_0x2eeebe['createStateFinal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ae'));}else{_0x2eeebe[_0x69de('0x12a')](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ae'));}}break;case'5':_0x4503e9[_0x69de('0x1af')]+=0x1;_0x337818[_0x69de('0x73')]=0x5;_0x337818[_0x69de('0x74')]=_0x69de('0x1b0');_0x337818[_0x69de('0x124')]+=0x1;_0x337818['countglobal']+=0x1;ami[_0x69de('0x42')](_0x69de('0x1b1'),ut[_0x69de('0x11d')](_0x10d586,_0x69de('0x1b2')));_0xd12fc9=_0x4503e9['dialBusyRetryFrequency'];_0x41abf1=_0x4503e9[_0x69de('0xd9')];hopperUtils['createHistory'](_0x337818)[_0x69de('0xa1')](loggerCatch(_0x69de('0x1b3')));if(_0x2eeebe['checkRetriveMax'](0x5,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818[_0x69de('0x124')]>=_0x4503e9[_0x69de('0x197')]){_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1b4'));}else{_0x2eeebe[_0x69de('0x12a')](_0x337818,_0x108b2e,_0x244e6b,'reason\x205\x20busy');}}break;case'8':_0x4503e9[_0x69de('0x1b5')]+=0x1;_0x337818['state']=0x8;_0x337818['statedesc']=_0x69de('0x1b6');_0x337818['countcongestionretry']+=0x1;_0x337818[_0x69de('0xd7')]+=0x1;_0xd12fc9=_0x4503e9[_0x69de('0x19b')];_0x41abf1=_0x4503e9[_0x69de('0xd9')];ami[_0x69de('0x42')](_0x69de('0x1b7'),ut['buildObj'](_0x10d586,_0x69de('0x1b8')));hopperUtils[_0x69de('0xe9')](_0x337818)[_0x69de('0xa1')](loggerCatch(_0x69de('0x1b9')));if(_0x2eeebe[_0x69de('0x1ab')](0x8,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818[_0x69de('0x194')]>=_0x4503e9[_0x69de('0x19a')]){_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ba'));}else{_0x2eeebe['stateGlobal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ba'));}}break;case'11':_0x4503e9[_0x69de('0x1bb')]+=0x1;_0x337818['state']=0xb;_0x337818[_0x69de('0x74')]=_0x69de('0xf2');_0x337818['countabandonedretry']+=0x1;_0x337818[_0x69de('0xd7')]+=0x1;_0xd12fc9=_0x4503e9['dialAbandonedRetryFrequency'];_0x41abf1=_0x4503e9['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x337818)[_0x69de('0xa1')](loggerCatch(_0x69de('0x1bc')));if(_0x2eeebe[_0x69de('0x1ab')](0xb,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818['countabandonedretry']>=_0x4503e9[_0x69de('0x19f')]){_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,'reason\x2011\x20abandoned');}else{_0x2eeebe['stateGlobal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1bd'));}}break;case'20':_0x4503e9[_0x69de('0x1be')]+=0x1;_0x337818[_0x69de('0x73')]=0x14;_0x337818[_0x69de('0x74')]=_0x69de('0x1bf');_0x337818[_0x69de('0x128')]+=0x1;_0x337818[_0x69de('0xd7')]+=0x1;_0xd12fc9=_0x4503e9[_0x69de('0x1a2')];_0x41abf1=_0x4503e9[_0x69de('0xd9')];ami['emit']('custom:agentreject',ut['buildObj'](_0x10d586,_0x69de('0x1c0')));hopperUtils[_0x69de('0xe9')](_0x337818)[_0x69de('0xa1')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2eeebe[_0x69de('0x1ab')](0x14,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818['countagentrejectretry']>=_0x4503e9[_0x69de('0x1a1')]){_0x2eeebe['createStateFinal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1c1'));}else{_0x2eeebe['stateGlobal'](_0x337818,_0x108b2e,_0x244e6b,'reason\x2020\x20agentreject');}}break;default:_0x4503e9[_0x69de('0x139')]+=0x1;_0x337818[_0x69de('0x73')]=0xc;_0x337818[_0x69de('0x74')]=_0x571e57[_0x69de('0xc7')];_0xd12fc9=_0x4503e9[_0x69de('0x1a2')];_0x41abf1=_0x4503e9['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x337818)['catch'](loggerCatch(_0x69de('0x1c2')));if(_0x2eeebe[_0x69de('0x1ab')](_0x571e57[_0x69de('0xc7')],_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818[_0x69de('0x124')]+_0x337818[_0x69de('0x194')]+_0x337818['countnoanswerretry']+_0x337818[_0x69de('0x126')]+_0x337818[_0x69de('0xd6')]+_0x337818[_0x69de('0xef')]+_0x337818['countmachineretry']+_0x337818['countagentrejectretry']>=_0x4503e9['dialGlobalMaxRetry']){_0x2eeebe[_0x69de('0x12a')](_0x337818,_0x108b2e,_0x244e6b,_0x571e57[_0x69de('0xc7')]);}else{_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,_0x571e57['reason']);}}}})[_0x69de('0x3f')](function(){if(_0x2ddf64){hopperUtils[_0x69de('0xeb')](_0x337818,_0xd12fc9,_0x41abf1)[_0x69de('0x3f')](function(){return _0x108b2e(0x1);});}});});};Dialer[_0x69de('0x8b')][_0x69de('0x12a')]=function(_0x56b3ee,_0x1efe0f,_0x452fe3,_0x2e0474){var _0x334589=new Final(_0x56b3ee);_0x334589['state']=0xf;_0x334589[_0x69de('0x74')]=_0x69de('0x1c3');this[_0x69de('0x12b')](_0x334589,_0x1efe0f,_0x452fe3,_0x2e0474);};Dialer[_0x69de('0x8b')][_0x69de('0x12b')]=function(_0x343227,_0x4b2962,_0x1c240f,_0x224df3){hopperUtils[_0x69de('0xcd')](_0x343227)[_0x69de('0x3f')](function(){return _0x4b2962(msgResponse(_0x69de('0x1a4'),'Success',_0x224df3));})[_0x69de('0xa1')](function(){return _0x1c240f(msgResponse(_0x69de('0x1c4'),_0x69de('0x94'),_0x69de('0x1c5')));});};Dialer[_0x69de('0x8b')]['predictive']=function(_0xbff8de){var _0x12d6af=_0xbff8de['dialPredictiveOptimizationPercentage']/0x64;var _0x48cdc7=_0xbff8de[_0x69de('0xd2')]/(_0xbff8de[_0x69de('0xd2')]+_0xbff8de[_0x69de('0xc6')]);var _0x319af5=Math[_0x69de('0x1c6')](_0xbff8de['predictiveIntervalAvailable']*(_0xbff8de[_0x69de('0x1c7')]/0x64));var _0x27c5ec=Math[_0x69de('0x1c6')](_0xbff8de[_0x69de('0x1c8')]*(_0xbff8de['predictiveIntervalMinThreshold']/0x64));var _0x3fc72b=_0xbff8de[_0x69de('0x13e')]+_0xbff8de[_0x69de('0x1c9')];var _0x3ebe77=Math[_0x69de('0x1ca')](_0xbff8de[_0x69de('0x5c')]*_0xbff8de['erlangAbandonmentRate']*_0xbff8de[_0x69de('0x1cb')]*_0xbff8de['predictiveIntervalMultiplicativeFactor']);if(_[_0x69de('0x41')](_0xbff8de['startProgressive'])){if(!_['isUndefined'](_0xbff8de[_0x69de('0x65')])){_0xbff8de[_0x69de('0x65')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x69de('0x41')](_0xbff8de[_0x69de('0x67')])){loggerPredictive[_0x69de('0x69')](_0x69de('0x1cc'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xbff8de[_0x69de('0x67')]);_0xbff8de[_0x69de('0x67')]=undefined;}_0xbff8de['startProgressive']=moment()[_0x69de('0x7e')](_0x69de('0xc5'));loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1cd'),_0xbff8de[_0x69de('0x27')]);this[_0x69de('0xb3')](_0xbff8de,0x1);}else if(ifInterval(_0xbff8de[_0x69de('0x1ce')],_0xbff8de[_0x69de('0x27')])){this[_0x69de('0xb3')](_0xbff8de,0x1);loggerPredictiveCalls[_0x69de('0x4d')](_0x69de('0x1cf'),_0xbff8de[_0x69de('0x27')],_0xbff8de[_0x69de('0x47')]);_0xbff8de['erlangCalls']=0x0;_0xbff8de['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x12d6af<_0x48cdc7&&_0xbff8de[_0x69de('0x1d0')]==='dropRate'){clearPredictiveAttributes(_0xbff8de);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x48cdc7,'startProgressive',_0xbff8de[_0x69de('0x47')]);}else if(_0x3ebe77<_0xbff8de[_0x69de('0xd3')]&&_0xbff8de['dialPredictiveOptimization']===_0x69de('0x1d1')){clearPredictiveAttributes(_0xbff8de);loggerPredictive['info'](_0x69de('0x1d2'),_0x69de('0x1d3'),_0x3ebe77,'Drop\x20in\x20this\x20interval',_0xbff8de[_0x69de('0xd3')],_0x69de('0x27'),_0xbff8de[_0x69de('0x47')]);}else if(!ifInterval(_0xbff8de[_0x69de('0x1ce')],_0xbff8de[_0x69de('0x27')])&&_[_0x69de('0x41')](_0xbff8de['startPredictive'])&&!_[_0x69de('0x41')](_0xbff8de['startProgressive'])){_0xbff8de['startPredictive']=moment()[_0x69de('0x7e')](_0x69de('0xc5'));loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1d4'),_0xbff8de[_0x69de('0x65')]);hopperUtils['avgHandleTime'](_0xbff8de[_0x69de('0x1ce')])[_0x69de('0x3f')](this[_0x69de('0x1d5')](_0xbff8de))['then'](mergeDataErlangB(_0xbff8de))[_0x69de('0x3f')](this[_0x69de('0x1d6')](_0xbff8de))[_0x69de('0xa1')](loggerCatchPredictive(_0x69de('0x1d7'),_0xbff8de));}else if(!ifInterval(_0xbff8de[_0x69de('0x1ce')],_0xbff8de[_0x69de('0x65')])){_0xbff8de[_0x69de('0xd3')]=0x0;_0xbff8de['startPredictive']=moment()[_0x69de('0x7e')](_0x69de('0xc5'));loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1d8'),_0xbff8de[_0x69de('0x65')]);clearInterval(_0xbff8de[_0x69de('0x67')]);_0xbff8de[_0x69de('0x67')]=undefined;hopperUtils['avgHandleTime'](_0xbff8de[_0x69de('0x1ce')])[_0x69de('0x3f')](this[_0x69de('0x1d5')](_0xbff8de))[_0x69de('0x3f')](mergeDataErlangB(_0xbff8de))['then'](this['startMethodPredictive'](_0xbff8de))[_0x69de('0xa1')](loggerCatchPredictive(_0x69de('0x1d9'),_0xbff8de));}else if(_0xbff8de['predictiveIntervalAvailable']&&_0x3fc72b<_0xbff8de[_0x69de('0x1c8')]-_0x27c5ec){clearPredictiveAttributes(_0xbff8de);loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1da'),_0x3fc72b,')\x20are\x20less\x20than\x20threshold\x20(',_0xbff8de[_0x69de('0x1c8')],'-',_0x27c5ec,'=',_0xbff8de['predictiveIntervalAvailable']-_0x27c5ec,')');}else if(_0xbff8de[_0x69de('0x1c8')]&&_0x3fc72b>_0xbff8de[_0x69de('0x1c8')]+_0x319af5){clearPredictiveAttributes(_0xbff8de);loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1da'),_0x3fc72b,_0x69de('0x1db'),_0xbff8de[_0x69de('0x1c8')],'+',_0x319af5,'=',_0xbff8de[_0x69de('0x1c8')]+_0x319af5,')');}};Dialer['prototype'][_0x69de('0x1d5')]=function(_0x533d84){var _0x81c0fb=this;return function(_0x19e29a){return new Promise(function(_0x3848ea,_0x20546e){_[_0x69de('0x62')](_0x533d84,_0x19e29a[0x0]);if(checkGetDataPredictive(_0x19e29a[0x0])){var _0x1196fa=_0x533d84[_0x69de('0x1c8')]=_0x533d84[_0x69de('0x1c9')]+_0x533d84[_0x69de('0x13e')];var _0x3c80a6=_0x533d84[_0x69de('0x1ce')]*0x3c;var _0x31b348=_0x19e29a[0x0][_0x69de('0x56')]+_0x19e29a[0x0][_0x69de('0x54')];var _0x529bff=(_0x19e29a[0x0][_0x69de('0x4e')]+_0x19e29a[0x0][_0x69de('0x50')]+_0x19e29a[0x0][_0x69de('0x52')])/_0x19e29a[0x0][_0x69de('0x4c')];_0x533d84[_0x69de('0x1cb')]=_0x529bff>0x0?_0x529bff:0x1;switch(_0x533d84[_0x69de('0x1d0')]){case _0x69de('0x1d1'):var _0x2ad32a=_0x533d84[_0x69de('0x1dc')]/0x64;return _0x81c0fb['abandonmentRate'](_0x1196fa,_0x3c80a6,_0x31b348,_0x529bff,_0x2ad32a)[_0x69de('0x3f')](function(_0x24a369){return _0x3848ea(_0x24a369);});case'agentBusyFactor':var _0x539437=_0x533d84[_0x69de('0x1dc')]/0x64;return _0x81c0fb[_0x69de('0x1dd')](_0x1196fa,_0x3c80a6,_0x31b348,_0x529bff,_0x539437)[_0x69de('0x3f')](function(_0x19afc2){return _0x3848ea(_0x19afc2);});default:return _0x20546e(msgResponse(_0x69de('0x1de'),_0x69de('0x94'),_0x69de('0x1df')));}}else{return _0x20546e(msgResponse(_0x69de('0x1de'),'Failure',_0x69de('0x1e0')));}});};};Dialer[_0x69de('0x8b')][_0x69de('0x1e1')]=function(_0x443bfa){var _0x329131=this;return function(_0x245a22){return new Promise(function(_0x5042e3,_0x4fa255){_[_0x69de('0x62')](_0x443bfa,_0x245a22[0x0]);if(checkGetDataPredictive(_0x245a22[0x0])){loggerPredictive[_0x69de('0x4d')](JSON[_0x69de('0x77')](_0x245a22[0x0]));if(_0x443bfa['dialPredictiveOptimization']===_0x69de('0x1d1')){return _0x329131[_0x69de('0x156')](_0x443bfa['id'])['then'](function(_0x52c013){var _0x214f5f=_0x443bfa['loggedIn']-_0x52c013[0x0][_0x69de('0x1e2')];var _0x766f6=_0x443bfa[_0x69de('0x1ce')]*0x3c;var _0x3ddac2=_0x245a22[0x0]['predictiveIntervalAvgTalktime']+_0x245a22[0x0][_0x69de('0x54')];var _0x588783=(_0x245a22[0x0][_0x69de('0x4e')]+_0x245a22[0x0][_0x69de('0x50')]+_0x245a22[0x0][_0x69de('0x52')])/_0x245a22[0x0][_0x69de('0x4c')];var _0x2f84ff=_0x443bfa[_0x69de('0x1dc')]/0x64;_0x443bfa['predictiveIntervalPauses']=_0x52c013[0x0][_0x69de('0x1e2')]||0x0;_0x443bfa[_0x69de('0x1cb')]=_0x588783>0x0?_0x588783:0x1;return _0x329131['abandonmentRate'](_0x214f5f,_0x766f6,_0x3ddac2,_0x588783,_0x2f84ff);})[_0x69de('0x3f')](function(_0x725a12){return _0x5042e3(_0x725a12);})[_0x69de('0xa1')](function(_0x41e0ba){return _0x4fa255(msgResponse(_0x69de('0x1e3'),_0x69de('0x94'),JSON['stringify'](_0x41e0ba)));});}if(_0x443bfa[_0x69de('0x1d0')]===_0x69de('0x1e4')){return _0x329131[_0x69de('0x156')](_0x443bfa['id'])['then'](function(_0x16cfb2){var _0x3e23af=_0x443bfa[_0x69de('0x1e5')]-_0x16cfb2[0x0][_0x69de('0x1e2')];var _0x5ca7d0=_0x443bfa[_0x69de('0x1ce')]*0x3c;var _0x1b13e1=_0x245a22[0x0][_0x69de('0x56')]+_0x245a22[0x0][_0x69de('0x54')];var _0x1d2495=(_0x245a22[0x0][_0x69de('0x4e')]+_0x245a22[0x0][_0x69de('0x50')]+_0x245a22[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x245a22[0x0][_0x69de('0x4c')];var _0x4186e9=_0x443bfa['dialPredictiveOptimizationPercentage']/0x64;_0x443bfa[_0x69de('0x1e6')]=_0x16cfb2[0x0][_0x69de('0x1e2')]||0x0;_0x443bfa[_0x69de('0x1cb')]=_0x1d2495>0x0?_0x1d2495:0x1;return _0x329131[_0x69de('0x1dd')](_0x3e23af,_0x5ca7d0,_0x1b13e1,_0x1d2495,_0x4186e9);})[_0x69de('0x3f')](function(_0x295d95){return _0x5042e3(_0x295d95);})[_0x69de('0xa1')](function(_0x966c8d){return _0x4fa255(msgResponse(_0x69de('0x1e3'),'Failure',JSON[_0x69de('0x77')](_0x966c8d)));});}}else{return _0x4fa255(msgResponse('[getDataPredictive]','Failure',_0x69de('0x1e0')));}});};};Dialer[_0x69de('0x8b')][_0x69de('0x1d6')]=function(_0x3fc3f9){var _0x220e71=this;return function(){var _0x2aee1a=0x0;var _0x49ffd4=Math[_0x69de('0x1ca')](_0x3fc3f9[_0x69de('0x5d')]*0x3e8);if(_0x49ffd4>0x0){_0x49ffd4=_0x49ffd4<0x64?0x64:_0x49ffd4;loggerPredictive[_0x69de('0x4d')](_0x3fc3f9[_0x69de('0x47')],_0x69de('0x1e7'),_0x49ffd4,_0x69de('0x1e8'));_0x3fc3f9[_0x69de('0x67')]=setInterval(function(){_0x220e71[_0x69de('0x67')](_0x3fc3f9);loggerPredictiveCalls[_0x69de('0x4d')](_0x69de('0x1e9'),_0x2aee1a+=0x1);},_0x49ffd4);}else{loggerPredictive[_0x69de('0x4d')](_0x3fc3f9[_0x69de('0x47')],_0x69de('0x1ea'));}};};Dialer['prototype'][_0x69de('0x1eb')]=function(_0x28ba1e,_0x30c522){var _0x438e69=this;return function(_0x455ece){if(_[_0x69de('0x49')](_0x455ece)){if(_[_0x69de('0x102')](_0x30c522[_0x69de('0x15c')])||!_0x30c522[_0x69de('0x1ec')]){if(_0x28ba1e['dialMethod']===_0x69de('0x9')){_0x28ba1e[_0x69de('0x75')]=_['isUndefined'](_0x28ba1e['queueStatusComplete'])?!![]:_0x28ba1e[_0x69de('0x75')];var _0x1d6115=uuid['v4']();_0x438e69['actions'][_0x1d6115]=new Action(_0x28ba1e,_0x30c522,_0x1d6115);loggerBooked[_0x69de('0x4d')](_0x69de('0x1ed'),_0x1d6115,_0x69de('0x1ee'),JSON['stringify'](_0x28ba1e[_0x69de('0x75')]),_0x69de('0x1ef'),_0x28ba1e[_0x69de('0x47')]);if(_0x28ba1e[_0x69de('0x75')]){_0x28ba1e[_0x69de('0x75')]=![];_0x438e69[_0x69de('0x29')][_0x438e69[_0x69de('0xf3')][_0x1d6115][_0x69de('0xbf')]]=[];ami[_0x69de('0x152')]({'actionid':_0x1d6115,'action':_0x69de('0x1f0'),'queue':_0x28ba1e[_0x69de('0x47')]})[_0x69de('0xa1')](function(){_0x438e69[_0x69de('0xc3')](_0x28ba1e);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x438e69['actions'][_0x1d6115][_0x69de('0xe0')],'ListId':_0x438e69['actions'][_0x1d6115][_0x69de('0xe1')],'VoiceQueueId':_0x438e69[_0x69de('0xf3')][_0x1d6115]['VoiceQueueId']||undefined,'CampaignId':_0x438e69[_0x69de('0xf3')][_0x1d6115][_0x69de('0xe3')]||undefined})['catch'](loggerCatch(_0x69de('0x1f1')));delete _0x438e69[_0x69de('0xf3')][_0x1d6115];});}else{loggerBooked['info'](_0x69de('0x1f2'),JSON[_0x69de('0x77')](_0x28ba1e['queueStatusComplete']),_0x69de('0x1ef'),_0x28ba1e[_0x69de('0x47')]);_0x438e69[_0x69de('0xc3')](_0x28ba1e);hopperUtils[_0x69de('0xf0')]({'active':![],'ContactId':_0x438e69['actions'][_0x1d6115]['ContactId'],'ListId':_0x438e69['actions'][_0x1d6115]['ListId'],'VoiceQueueId':_0x438e69[_0x69de('0xf3')][_0x1d6115][_0x69de('0xe2')]||undefined,'CampaignId':_0x438e69[_0x69de('0xf3')][_0x1d6115]['CampaignId']||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x1f1')));delete _0x438e69['actions'][_0x1d6115];}}else{return _0x438e69[_0x69de('0x160')](_0x28ba1e,_0x30c522);}}else{if(utils['getSeconds'](undefined,_0x30c522[_0x69de('0x1f3')])<_0x28ba1e[_0x69de('0x1f4')]*0x3c){if(_0x30c522[_0x69de('0x14b')]&&!_0x30c522[_0x69de('0x14b')][_0x69de('0x1f5')]){_0x438e69[_0x69de('0x1f')][_0x69de('0xfe')](_0x30c522['id'])[_0x69de('0x1d')](function(){_0x438e69[_0x69de('0xc3')](_0x28ba1e);});}else{hopperUtils['unlockContact']({'active':![]},_0x30c522['id'],0x1)['finally'](function(){_0x438e69[_0x69de('0xc3')](_0x28ba1e);});}}else{_0x28ba1e['outboundReCallsDay']+=0x1;_0x438e69[_0x69de('0xc3')](_0x28ba1e);if(_0x28ba1e['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x30c522[_0x69de('0xe0')],'ListId':_0x30c522[_0x69de('0xe1')],'VoiceQueueId':_0x30c522[_0x69de('0xe2')]||undefined,'CampaignId':_0x30c522[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x1f6')));hopperUtils['createHistory'](createObjHistory(_0x28ba1e,_0x30c522,utils[_0x69de('0x6e')][_0x69de('0x1f7')],0x17,_0x69de('0x1f8')))[_0x69de('0xa1')](loggerCatch(_0x69de('0x1f9')));}else{_0x438e69[_0x69de('0x15b')](createObjHistory(_0x28ba1e,_0x30c522,utils[_0x69de('0x6e')][_0x69de('0x1fa')],0x16,_0x69de('0x1fb')),_0x69de('0x1fc'),_0x69de('0x1fd'));}}}}else{_0x28ba1e['outboundBlacklistCallsDay']+=0x1;_0x438e69[_0x69de('0x15b')](createObjHistory(_0x28ba1e,_0x30c522,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,'Blacklist'),_0x69de('0x1fe'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x30ba68){var _0xf3d4ac=this;var _0x275c7f=_0x30ba68[_0x69de('0x1ff')]-_0x30ba68[_0x69de('0x82')];emitCampaignSummary(_0x30ba68);if(_0x275c7f>0x0&&_0x30ba68['temp']==0x0){if(_0x275c7f>this[_0x69de('0x24')]){_0x275c7f=this[_0x69de('0x24')];}_0x30ba68['temp']=0x1;hopperUtils[_0x69de('0x200')](_0x30ba68,_0x275c7f)[_0x69de('0x3f')](function(_0x29c3dd){_0x30ba68[_0x69de('0x6c')]=0x0;if(_0x29c3dd){if(!utils[_0x69de('0x201')](_0x29c3dd)){_0x30ba68[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x71')];logger[_0x69de('0x4d')](_0x69de('0x202')+_0x30ba68[_0x69de('0x47')]);}else{_0x30ba68['originated']+=_0x29c3dd[_0x69de('0x9a')];_0x30ba68[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x203')];for(var _0x3e6392=0x0;_0x3e6392<_0x29c3dd['length'];_0x3e6392+=0x1){_0x30ba68[_0x69de('0x204')]+=0x1;if(_['isNil'](_0x29c3dd[_0x3e6392])||_[_0x69de('0x102')](_0x29c3dd[_0x3e6392][_0x69de('0x205')])||_[_0x69de('0x102')](_0x29c3dd[_0x3e6392]['phone'])){_0xf3d4ac[_0x69de('0x206')](_0x69de('0x207'),_0x30ba68,_0x29c3dd[_0x3e6392]);}else{hopperUtils[_0x69de('0x208')](_['pick'](_0x29c3dd[_0x3e6392],[_0x69de('0xe3'),'phone']))[_0x69de('0x3f')](_0xf3d4ac[_0x69de('0x1eb')](_0x30ba68,_0x29c3dd[_0x3e6392]))['catch'](_0xf3d4ac['loggerHandler']('[actionOriginateIvr]\x20',_0x30ba68));}}}}})[_0x69de('0xa1')](loggerGetContactDialer(_0x69de('0x209'),_0x30ba68,_0x275c7f));}};Dialer[_0x69de('0x8b')][_0x69de('0xb3')]=function(_0x486fb3,_0x584d84){var _0x349fb2=this;var _0x4bfc19=[];if(_0x584d84<0x1||_0x486fb3[_0x69de('0xb0')]===_0x69de('0x9')){_0x584d84=0x1;}var _0x3d1954=Math[_0x69de('0x1ca')](_0x486fb3[_0x69de('0x13e')]*_0x584d84)-_0x486fb3['originated'];if(_0x486fb3[_0x69de('0x20a')]>0x0){var _0x304aa1=_0x486fb3[_0x69de('0x20a')]-_0x486fb3[_0x69de('0x82')]-_0x486fb3[_0x69de('0x1c9')]-_0x486fb3[_0x69de('0x140')];if(_0x3d1954>_0x304aa1){_0x3d1954=_0x304aa1;}}if(_0x3d1954>0x0&&_0x486fb3['temp']==0x0){if(_0x486fb3[_0x69de('0xb0')]==='booked'){_0x3d1954=0x1;}if(_0x3d1954>this[_0x69de('0x24')]){_0x3d1954=this['maxNumberOriginate'];}for(var _0x25218f in this[_0x69de('0x22')]){if(typeof this[_0x69de('0x22')][_0x25218f]!==_0x69de('0xab')){if(this[_0x69de('0x22')][_0x25218f][_0x69de('0x73')]===_0x69de('0x20b')&&this['agents'][_0x25218f]['status']===_0x69de('0x20c')){_0x4bfc19['push'](this[_0x69de('0x22')][_0x25218f]['id']);}}}_0x486fb3[_0x69de('0x6c')]=0x1;hopperUtils[_0x69de('0x20d')](_0x486fb3,_0x4bfc19,_0x3d1954)[_0x69de('0x3f')](function(_0x874c06){_0x486fb3['temp']=0x0;if(_0x874c06){if(!utils[_0x69de('0x201')](_0x874c06)){hopperUtils['countReScheduled'](_0x486fb3)[_0x69de('0x3f')](sendMessageReschedule(_0x486fb3))['catch'](loggerCatch(_0x69de('0x20e')));}else{_0x486fb3[_0x69de('0x82')]+=_0x874c06[_0x69de('0x9a')];_0x486fb3[_0x69de('0x6d')]=_0x486fb3[_0x69de('0xb0')]===_0x69de('0x9')?utils[_0x69de('0x6e')]['ACTIVE']:utils[_0x69de('0x6e')][_0x69de('0x203')];for(var _0x54a943=0x0;_0x54a943<_0x874c06[_0x69de('0x9a')];_0x54a943+=0x1){if(_['isNil'](_0x874c06[_0x54a943])||_[_0x69de('0x102')](_0x874c06[_0x54a943][_0x69de('0x205')])||_[_0x69de('0x102')](_0x874c06[_0x54a943][_0x69de('0x164')])){_0x349fb2['emptyContact'](_0x69de('0x207'),_0x486fb3,_0x874c06[_0x54a943]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x874c06[_0x54a943],[_0x69de('0xe2'),_0x69de('0x164')]))[_0x69de('0x3f')](_0x349fb2['checkContactBlack'](_0x486fb3,_0x874c06[_0x54a943]))[_0x69de('0xa1')](_0x349fb2['loggerHandler']('[actionOriginate]\x20',_0x486fb3));}}}}})[_0x69de('0xa1')](loggerGetContactDialer(_0x69de('0x20f'),_0x486fb3,_0x3d1954));}};Dialer[_0x69de('0x8b')][_0x69de('0x67')]=function(_0x2b4bcb){if(_0x2b4bcb[_0x69de('0x20a')]>0x0){var _0x57be90=_0x2b4bcb[_0x69de('0x20a')]-_0x2b4bcb[_0x69de('0x82')]-_0x2b4bcb[_0x69de('0x1c9')];if(_0x57be90>0x0&&_0x2b4bcb['temp']==0x0){this[_0x69de('0x210')](_0x2b4bcb);}else{loggerPredictiveCalls[_0x69de('0x4d')](_0x69de('0x211'));}}else{this['tryOriginatePredictive'](_0x2b4bcb);}};Dialer[_0x69de('0x8b')][_0x69de('0x210')]=function(_0x2dbd06){var _0x46a150=this;var _0x3d1166=[];_0x2dbd06['originated']+=0x1;for(var _0x4db2d5 in this[_0x69de('0x22')]){if(typeof this[_0x69de('0x22')][_0x4db2d5]!==_0x69de('0xab')){if(this[_0x69de('0x22')][_0x4db2d5]['state']===_0x69de('0x20b')&&this[_0x69de('0x22')][_0x4db2d5][_0x69de('0x8a')]===_0x69de('0x20c')){_0x3d1166[_0x69de('0xa2')](this[_0x69de('0x22')][_0x4db2d5]['id']);}}}_0x2dbd06[_0x69de('0x6c')]=0x1;return this[_0x69de('0x20d')](_0x2dbd06['id'],_0x3d1166,0x1,_0x2dbd06[_0x69de('0x212')],_0x2dbd06)[_0x69de('0x3f')](function(_0x219c2b){_0x2dbd06[_0x69de('0x6c')]=0x1;if(_0x219c2b){if(!utils[_0x69de('0x201')](_0x219c2b)){utils['checkContactLowerLimitOriginate'](_0x2dbd06,0x1,0x0);return hopperUtils['countReScheduled'](_0x2dbd06)[_0x69de('0x3f')](sendMessageReschedule(_0x2dbd06))['catch'](loggerCatch(_0x69de('0x20e')));}else{_0x2dbd06[_0x69de('0x6d')]=utils[_0x69de('0x6e')]['RUNNING'];if(_['isNil'](_0x219c2b[0x0])||_['isNil'](_0x219c2b[0x0]['Contact'])||_[_0x69de('0x102')](_0x219c2b[0x0][_0x69de('0x164')])){_0x46a150['emptyContact'](_0x69de('0x207'),_0x2dbd06,_0x219c2b[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x69de('0xfb')](_0x219c2b[0x0],['VoiceQueueId',_0x69de('0x164')]))[_0x69de('0x3f')](_0x46a150[_0x69de('0x1eb')](_0x2dbd06,_0x219c2b[0x0]))['catch'](_0x46a150[_0x69de('0x159')]('[actionOriginatePredictive]\x20',_0x2dbd06));}}}})[_0x69de('0xa1')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2dbd06,0x1));};Dialer[_0x69de('0x8b')][_0x69de('0x213')]=function(_0x6b974b,_0xe5e9c9,_0xe7801f,_0x497ce5,_0xe131e0,_0x2a7a64){loggerPredictive[_0x69de('0x4d')](_0x69de('0x214'));loggerPredictive['info'](_0x69de('0x215'),_0x6b974b);loggerPredictive[_0x69de('0x4d')](_0x69de('0x216'),_0xe5e9c9);loggerPredictive[_0x69de('0x4d')](_0x69de('0x217'),_0xe7801f);loggerPredictive[_0x69de('0x4d')](_0x69de('0x218'),_0x497ce5);loggerPredictive[_0x69de('0x4d')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe131e0);loggerPredictive[_0x69de('0x4d')](_0x69de('0x55'));return new Promise(function(_0x448fd5,_0x44f7a3){if(_0x6b974b<=0x0||isNaN(_0x6b974b)){return _0x44f7a3(msgResponse(_0x69de('0x219'),_0x69de('0xbe'),'m\x20=\x20'+_0x6b974b));}if(_0xe7801f<=0x0||isNaN(_0xe7801f)){return _0x44f7a3(msgResponse(_0x69de('0x219'),_0x69de('0xbe'),'Ts\x20=\x20'+_0xe7801f));}if(_0x497ce5<=0x0||isNaN(_0x497ce5)){return _0x44f7a3(msgResponse(_0x69de('0x219'),'Error',_0x69de('0x21a')+_0x497ce5));}if(_0xe5e9c9<=0x0||isNaN(_0xe5e9c9)){return _0x44f7a3(msgResponse('[abandonmentRate]',_0x69de('0xbe'),_0x69de('0x21b')+_0xe5e9c9));}if(_0xe131e0<=0x0||isNaN(_0xe131e0)){return _0x44f7a3(msgResponse('[abandonmentRate]',_0x69de('0xbe'),_0x69de('0x21c')+_0xe131e0));}_0x2a7a64=_0x2a7a64||0x0;var _0x3cbe2a=0x1/_0xe7801f;var _0x57388a=0x0;var _0x3b3e11=0x0;var _0x3856a9=0x0;var _0x23d953=0x0;for(var _0x2c7de9=0x0;_0x3856a9<_0xe131e0;_0x2c7de9+=0x1){_0x3b3e11=_0x2c7de9/_0xe5e9c9;_0x57388a=(_0x497ce5*_0x3b3e11+_0x2a7a64)/_0x3cbe2a;_0x3856a9=utils[_0x69de('0x21d')](_0x57388a,_0x6b974b);_0x23d953=_0x57388a/_0x6b974b*(0x1-utils[_0x69de('0x21d')](_0x57388a,_0x6b974b));}return _0x448fd5({'erlangCalls':_0x2c7de9,'erlangCallToSecond':_0xe5e9c9/_0x2c7de9,'erlangAbandonmentRate':_0x3856a9,'erlangBusyFactor':_0x23d953});});};Dialer['prototype']['busyFactor']=function(_0x58b521,_0x17dedd,_0x518f3f,_0x3fa84a,_0x40c482,_0x622a5d){loggerPredictive[_0x69de('0x4d')](_0x69de('0x21e'));loggerPredictive[_0x69de('0x4d')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58b521);loggerPredictive['info'](_0x69de('0x216'),_0x17dedd);loggerPredictive[_0x69de('0x4d')](_0x69de('0x217'),_0x518f3f);loggerPredictive[_0x69de('0x4d')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3fa84a);loggerPredictive[_0x69de('0x4d')](_0x69de('0x21f'),_0x40c482);loggerPredictive['info']('---------------------------');return new Promise(function(_0x401d1c,_0x32b3b5){if(_0x58b521<=0x0||isNaN(_0x58b521)){return _0x32b3b5(msgResponse('[busyFactor]','Error',_0x69de('0x220')+_0x58b521));}if(_0x518f3f<=0x0||isNaN(_0x518f3f)){return _0x32b3b5(msgResponse('[busyFactor]',_0x69de('0xbe'),_0x69de('0x221')+_0x518f3f));}if(_0x3fa84a<=0x0||isNaN(_0x3fa84a)){return _0x32b3b5(msgResponse(_0x69de('0x222'),'Error',_0x69de('0x21a')+_0x3fa84a));}if(_0x17dedd<=0x0||isNaN(_0x17dedd)){return _0x32b3b5(msgResponse(_0x69de('0x222'),_0x69de('0xbe'),_0x69de('0x21b')+_0x17dedd));}if(_0x40c482<=0x0||isNaN(_0x40c482)){return _0x32b3b5(msgResponse(_0x69de('0x222'),_0x69de('0xbe'),_0x69de('0x223')+_0x40c482));}_0x622a5d=_0x622a5d||0x0;var _0x170f9d=0x1/_0x518f3f;var _0x4292d7=0x0;var _0x34c29b=0x0;var _0x41c950=0x0;var _0x344105=0x0;for(var _0x4b9d07=0x0;_0x344105<_0x40c482;_0x4b9d07+=0x1){_0x34c29b=_0x4b9d07/_0x17dedd;_0x4292d7=(_0x3fa84a*_0x34c29b+_0x622a5d)/_0x170f9d;_0x41c950=utils[_0x69de('0x21d')](_0x4292d7,_0x58b521);_0x344105=_0x4292d7/_0x58b521*(0x1-utils['erlangb'](_0x4292d7,_0x58b521));}return _0x401d1c({'erlangCalls':_0x4b9d07,'erlangCallToSecond':_0x17dedd/_0x4b9d07,'erlangAbandonmentRate':_0x41c950,'erlangBusyFactor':_0x344105});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index c0e0fa5..5128109 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 _0x10b9=['exports','util','lodash','isNil','uniqueid','name','phone','firstName','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','callback','callbackuniqueid','callbackat','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring'];(function(_0x4fbf33,_0x318fbc){var _0x1997d2=function(_0xe41ffc){while(--_0xe41ffc){_0x4fbf33['push'](_0x4fbf33['shift']());}};_0x1997d2(++_0x318fbc);}(_0x10b9,0xc4));var _0x910b=function(_0x7dee36,_0x2dd3f0){_0x7dee36=_0x7dee36-0x0;var _0x2d6ce3=_0x10b9[_0x7dee36];return _0x2d6ce3;};'use strict';var util=require(_0x910b('0x0'));var _=require(_0x910b('0x1'));var moment=require('moment');function checkNameSurname(_0x39a19f,_0xe3b100,_0x2b1681){var _0x52a62e='';if(!_['isNil'](_0xe3b100)&&'string'===typeof _0xe3b100){_0x52a62e+=_0xe3b100;}if(!_[_0x910b('0x2')](_0x2b1681)&&'string'===typeof _0x2b1681){_0x52a62e+='\x20'+_0x2b1681;}if(_0x52a62e!==''){return _0x52a62e;}return _0x39a19f;}function Action(_0x6d365b,_0x2a4454,_0xcb6ed8){this['voiceQueue']=_0x6d365b;this[_0x910b('0x3')]=_0xcb6ed8||undefined;this[_0x910b('0x4')]=checkNameSurname(_0x2a4454['Contact'][_0x910b('0x5')],_0x2a4454['Contact'][_0x910b('0x6')],_0x2a4454[_0x910b('0x7')][_0x910b('0x8')]);this[_0x910b('0x9')]=_0x2a4454[_0x910b('0x5')];this[_0x910b('0xa')]=_0x6d365b[_0x910b('0x4')];this[_0x910b('0xb')]=_0x2a4454[_0x910b('0xb')]||![];this[_0x910b('0xc')]=_0x6d365b[_0x910b('0xc')];this[_0x910b('0xd')]=_0x6d365b[_0x910b('0xd')]||0x3;this['scheduledat']=_0x2a4454[_0x910b('0xe')];this[_0x910b('0xf')]=_0x2a4454[_0x910b('0xf')];this[_0x910b('0x10')]=_0x2a4454[_0x910b('0x10')];this['countnoanswerretry']=_0x2a4454['countnoanswerretry'];this[_0x910b('0x11')]=_0x2a4454[_0x910b('0x11')];this['countdropretry']=_0x2a4454[_0x910b('0x12')];this[_0x910b('0x13')]=_0x2a4454[_0x910b('0x13')];this[_0x910b('0x14')]=_0x2a4454[_0x910b('0x14')];this[_0x910b('0x15')]=_0x2a4454['countagentrejectretry'];this[_0x910b('0x16')]=_0x2a4454[_0x910b('0x16')];this['ListId']=_0x2a4454[_0x910b('0x17')];this[_0x910b('0x18')]=_0x2a4454['UserId'];this[_0x910b('0x19')]=_0x2a4454[_0x910b('0x19')];this[_0x910b('0x1a')]=_0x2a4454[_0x910b('0x1a')];this[_0x910b('0x1b')]=_0x2a4454['id'];this['ContactFirstName']=_0x2a4454[_0x910b('0x7')][_0x910b('0x6')]||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x910b('0x1c')]=_0x2a4454[_0x910b('0x1c')];this[_0x910b('0x1d')]=_0x2a4454[_0x910b('0x1d')];this[_0x910b('0x1e')]=_0x2a4454[_0x910b('0x1e')];this['recallme']=_0x2a4454['recallme'];this['originatecalleridnum']='';this[_0x910b('0x1f')]='';}Action[_0x910b('0x20')][_0x910b('0x21')]=function(){return util['format'](_0x910b('0x22'),this[_0x910b('0x4')],this[_0x910b('0x23')][_0x910b('0x24')]>0x0?this[_0x910b('0x9')][_0x910b('0x25')](this[_0x910b('0x23')][_0x910b('0x24')]):this['number']);};Action['prototype']['getQueue']=function(){return this[_0x910b('0xa')];};module[_0x910b('0x26')]=Action; \ No newline at end of file +var _0xdfdf=['exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','queue'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0xdfdf,0x161));var _0xfdfd=function(_0x11b750,_0x12f3fc){_0x11b750=_0x11b750-0x0;var _0x440be3=_0xdfdf[_0x11b750];return _0x440be3;};'use strict';var util=require(_0xfdfd('0x0'));var _=require('lodash');var moment=require(_0xfdfd('0x1'));function checkNameSurname(_0x179b53,_0x55860f,_0x286ec6){var _0x79046c='';if(!_[_0xfdfd('0x2')](_0x55860f)&&_0xfdfd('0x3')===typeof _0x55860f){_0x79046c+=_0x55860f;}if(!_[_0xfdfd('0x2')](_0x286ec6)&&'string'===typeof _0x286ec6){_0x79046c+='\x20'+_0x286ec6;}if(_0x79046c!==''){return _0x79046c;}return _0x179b53;}function Action(_0x4e40b0,_0x20a074,_0x15e141){this[_0xfdfd('0x4')]=_0x4e40b0;this[_0xfdfd('0x5')]=_0x15e141||undefined;this[_0xfdfd('0x6')]=checkNameSurname(_0x20a074[_0xfdfd('0x7')][_0xfdfd('0x8')],_0x20a074[_0xfdfd('0x7')]['firstName'],_0x20a074[_0xfdfd('0x7')][_0xfdfd('0x9')]);this[_0xfdfd('0xa')]=_0x20a074[_0xfdfd('0x8')];this['queue']=_0x4e40b0['name'];this[_0xfdfd('0xb')]=_0x20a074[_0xfdfd('0xb')]||![];this['type']=_0x4e40b0[_0xfdfd('0xc')];this[_0xfdfd('0xd')]=_0x4e40b0[_0xfdfd('0xd')]||0x3;this[_0xfdfd('0xe')]=_0x20a074[_0xfdfd('0xe')];this['countbusyretry']=_0x20a074[_0xfdfd('0xf')];this[_0xfdfd('0x10')]=_0x20a074[_0xfdfd('0x10')];this['countnoanswerretry']=_0x20a074['countnoanswerretry'];this['countnosuchnumberretry']=_0x20a074[_0xfdfd('0x11')];this['countdropretry']=_0x20a074['countdropretry'];this[_0xfdfd('0x12')]=_0x20a074[_0xfdfd('0x12')];this[_0xfdfd('0x13')]=_0x20a074[_0xfdfd('0x13')];this[_0xfdfd('0x14')]=_0x20a074[_0xfdfd('0x14')];this[_0xfdfd('0x15')]=_0x20a074[_0xfdfd('0x15')];this[_0xfdfd('0x16')]=_0x20a074[_0xfdfd('0x16')];this[_0xfdfd('0x17')]=_0x20a074[_0xfdfd('0x17')];this[_0xfdfd('0x18')]=_0x20a074[_0xfdfd('0x18')];this[_0xfdfd('0x19')]=_0x20a074[_0xfdfd('0x19')];this['idHopper']=_0x20a074['id'];this[_0xfdfd('0x1a')]=_0x20a074['Contact'][_0xfdfd('0x1b')]||'';this[_0xfdfd('0x1c')]=moment()[_0xfdfd('0x1d')](_0xfdfd('0x1e'));this['callback']=_0x20a074[_0xfdfd('0x1f')];this['callbackuniqueid']=_0x20a074['callbackuniqueid'];this[_0xfdfd('0x20')]=_0x20a074[_0xfdfd('0x20')];this[_0xfdfd('0x21')]=_0x20a074[_0xfdfd('0x21')];this[_0xfdfd('0x22')]='';this[_0xfdfd('0x23')]='';}Action['prototype'][_0xfdfd('0x24')]=function(){return util[_0xfdfd('0x1d')](_0xfdfd('0x25'),this[_0xfdfd('0x6')],this[_0xfdfd('0x4')][_0xfdfd('0x26')]>0x0?this[_0xfdfd('0xa')][_0xfdfd('0x27')](this[_0xfdfd('0x4')][_0xfdfd('0x26')]):this[_0xfdfd('0xa')]);};Action[_0xfdfd('0x28')][_0xfdfd('0x29')]=function(){return this[_0xfdfd('0x2a')];};module[_0xfdfd('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 41f5c80..8a439cc 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 _0xe3f3=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','callback'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0xe3f3,0xb8));var _0x3e3f=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe3f3[_0x11005e];return _0x29338f;};'use strict';var moment=require(_0x3e3f('0x0'));var utils=require(_0x3e3f('0x1'));function AgentComplete(_0x124d1a,_0x521c6b){this[_0x3e3f('0x2')]=0x4;this['statedesc']=_0x3e3f('0x3');this[_0x3e3f('0x4')]=_0x124d1a['scheduledat'];this[_0x3e3f('0x5')]=_0x124d1a['type'];this['campaigntype']=_0x124d1a[_0x3e3f('0x5')]===_0x3e3f('0x6')?_0x3e3f('0x7'):_0x124d1a[_0x3e3f('0x5')];this[_0x3e3f('0x8')]=_0x124d1a[_0x3e3f('0x8')];this[_0x3e3f('0x9')]=_0x124d1a[_0x3e3f('0x9')];this[_0x3e3f('0xa')]=_0x124d1a[_0x3e3f('0xa')];this[_0x3e3f('0xb')]=_0x124d1a[_0x3e3f('0x8')]+_0x124d1a[_0x3e3f('0x9')]+_0x124d1a[_0x3e3f('0xa')]+_0x124d1a['countnosuchnumberretry']+_0x124d1a[_0x3e3f('0xc')]+_0x124d1a[_0x3e3f('0xd')]+_0x124d1a['countmachineretry']+_0x124d1a[_0x3e3f('0xe')];this['countnosuchnumberretry']=_0x124d1a['countnosuchnumberretry'];this[_0x3e3f('0xc')]=_0x124d1a[_0x3e3f('0xc')];this['countabandonedretry']=_0x124d1a[_0x3e3f('0xd')];this[_0x3e3f('0xf')]=_0x124d1a[_0x3e3f('0xf')];this[_0x3e3f('0xe')]=_0x124d1a['countagentrejectretry'];this[_0x3e3f('0x10')]=_0x521c6b[_0x3e3f('0x10')];this[_0x3e3f('0x11')]=_0x124d1a[_0x3e3f('0x12')];this[_0x3e3f('0x13')]=_0x124d1a['number'];this['starttime']=_0x124d1a[_0x3e3f('0x14')];this['responsetime']=_0x124d1a[_0x3e3f('0x15')];this[_0x3e3f('0x16')]=_0x124d1a[_0x3e3f('0x16')];this[_0x3e3f('0x17')]=moment()[_0x3e3f('0x18')](_0x3e3f('0x19'));this['ringtime']=utils[_0x3e3f('0x1a')](_0x124d1a[_0x3e3f('0x15')],_0x124d1a[_0x3e3f('0x14')]);this[_0x3e3f('0x1b')]=utils['getSeconds'](_0x124d1a[_0x3e3f('0x16')],_0x124d1a['responsetime']);this[_0x3e3f('0x1c')]=utils[_0x3e3f('0x1a')](this['endtime'],_0x124d1a[_0x3e3f('0x16')]);this[_0x3e3f('0x7')]=_0x521c6b['queue'];this[_0x3e3f('0x1d')]=_0x521c6b['membername'];this['reason']=_0x521c6b['reason'];this[_0x3e3f('0x1e')]=_0x124d1a['callback'];this[_0x3e3f('0x1f')]=_0x124d1a[_0x3e3f('0x1f')];this['callbackat']=_0x124d1a[_0x3e3f('0x20')];this[_0x3e3f('0x21')]=_0x124d1a[_0x3e3f('0x21')];this[_0x3e3f('0x22')]=_0x124d1a[_0x3e3f('0x22')];this[_0x3e3f('0x23')]=_0x124d1a[_0x3e3f('0x23')];this[_0x3e3f('0x24')]=_0x124d1a[_0x3e3f('0x24')];this[_0x3e3f('0x25')]=_0x124d1a[_0x3e3f('0x25')];this['CampaignId']=_0x124d1a[_0x3e3f('0x26')];this[_0x3e3f('0x27')]=_0x124d1a[_0x3e3f('0x27')]||'';this[_0x3e3f('0x28')]=_0x124d1a[_0x3e3f('0x28')]||'';this[_0x3e3f('0x29')]=_0x124d1a[_0x3e3f('0x29')];}module[_0x3e3f('0x2a')]=AgentComplete; \ No newline at end of file +var _0x7351=['starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x28c39c,_0x3cc0c8){var _0x145b6b=function(_0x2ae04d){while(--_0x2ae04d){_0x28c39c['push'](_0x28c39c['shift']());}};_0x145b6b(++_0x3cc0c8);}(_0x7351,0xe3));var _0x1735=function(_0x32f495,_0x7f5c11){_0x32f495=_0x32f495-0x0;var _0x42272f=_0x7351[_0x32f495];return _0x42272f;};'use strict';var moment=require(_0x1735('0x0'));var utils=require(_0x1735('0x1'));function AgentComplete(_0x1fb635,_0x3de02d){this['state']=0x4;this['statedesc']='Answer';this[_0x1735('0x2')]=_0x1fb635[_0x1735('0x2')];this[_0x1735('0x3')]=_0x1fb635['type'];this['campaigntype']=_0x1fb635[_0x1735('0x3')]===_0x1735('0x4')?_0x1735('0x5'):_0x1fb635['type'];this[_0x1735('0x6')]=_0x1fb635[_0x1735('0x6')];this['countcongestionretry']=_0x1fb635[_0x1735('0x7')];this[_0x1735('0x8')]=_0x1fb635[_0x1735('0x8')];this['countglobal']=_0x1fb635['countbusyretry']+_0x1fb635[_0x1735('0x7')]+_0x1fb635[_0x1735('0x8')]+_0x1fb635[_0x1735('0x9')]+_0x1fb635[_0x1735('0xa')]+_0x1fb635['countabandonedretry']+_0x1fb635[_0x1735('0xb')]+_0x1fb635['countagentrejectretry'];this['countnosuchnumberretry']=_0x1fb635[_0x1735('0x9')];this[_0x1735('0xa')]=_0x1fb635[_0x1735('0xa')];this[_0x1735('0xc')]=_0x1fb635[_0x1735('0xc')];this[_0x1735('0xb')]=_0x1fb635[_0x1735('0xb')];this[_0x1735('0xd')]=_0x1fb635['countagentrejectretry'];this[_0x1735('0xe')]=_0x3de02d['uniqueid'];this[_0x1735('0xf')]=_0x1fb635[_0x1735('0x10')];this[_0x1735('0x11')]=_0x1fb635[_0x1735('0x12')];this['starttime']=_0x1fb635[_0x1735('0x13')];this[_0x1735('0x14')]=_0x1fb635[_0x1735('0x14')];this[_0x1735('0x15')]=_0x1fb635[_0x1735('0x15')];this[_0x1735('0x16')]=moment()['format'](_0x1735('0x17'));this[_0x1735('0x18')]=utils[_0x1735('0x19')](_0x1fb635[_0x1735('0x14')],_0x1fb635['starttime']);this[_0x1735('0x1a')]=utils['getSeconds'](_0x1fb635[_0x1735('0x15')],_0x1fb635[_0x1735('0x14')]);this['talktime']=utils[_0x1735('0x19')](this['endtime'],_0x1fb635[_0x1735('0x15')]);this['queue']=_0x3de02d[_0x1735('0x5')];this[_0x1735('0x1b')]=_0x3de02d[_0x1735('0x1b')];this[_0x1735('0x1c')]=_0x3de02d[_0x1735('0x1c')];this['callback']=_0x1fb635['callback'];this[_0x1735('0x1d')]=_0x1fb635['callbackuniqueid'];this[_0x1735('0x1e')]=_0x1fb635[_0x1735('0x1e')];this[_0x1735('0x1f')]=_0x1fb635[_0x1735('0x1f')];this[_0x1735('0x20')]=_0x1fb635['ContactId'];this[_0x1735('0x21')]=_0x1fb635[_0x1735('0x21')];this['UserId']=_0x1fb635[_0x1735('0x22')];this[_0x1735('0x23')]=_0x1fb635[_0x1735('0x23')];this[_0x1735('0x24')]=_0x1fb635['CampaignId'];this[_0x1735('0x25')]=_0x1fb635[_0x1735('0x25')]||'';this['originatecalleridname']=_0x1fb635[_0x1735('0x26')]||'';this[_0x1735('0x27')]=_0x1fb635['agiafterat'];}module[_0x1735('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 6b46550..64f4ca4 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 _0x68be=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','calleridnum','starttime'];(function(_0x44f6f9,_0x584246){var _0x368d5c=function(_0x4af861){while(--_0x4af861){_0x44f6f9['push'](_0x44f6f9['shift']());}};_0x368d5c(++_0x584246);}(_0x68be,0xff));var _0xe68b=function(_0x46d962,_0x23ef3f){_0x46d962=_0x46d962-0x0;var _0x107945=_0x68be[_0x46d962];return _0x107945;};'use strict';function Final(_0x33e246){this[_0xe68b('0x0')]=_0x33e246[_0xe68b('0x0')];this[_0xe68b('0x1')]=_0x33e246[_0xe68b('0x1')];this[_0xe68b('0x2')]=_0x33e246[_0xe68b('0x2')];this[_0xe68b('0x3')]=_0x33e246[_0xe68b('0x2')]===_0xe68b('0x4')?_0xe68b('0x5'):_0x33e246[_0xe68b('0x2')];this['countbusyretry']=_0x33e246['countbusyretry'];this[_0xe68b('0x6')]=_0x33e246[_0xe68b('0x6')];this[_0xe68b('0x7')]=_0x33e246['countnoanswerretry'];this[_0xe68b('0x8')]=_0x33e246['countbusyretry']+_0x33e246[_0xe68b('0x6')]+_0x33e246[_0xe68b('0x7')]+_0x33e246['countnosuchnumberretry']+_0x33e246[_0xe68b('0x9')]+_0x33e246[_0xe68b('0xa')]+_0x33e246[_0xe68b('0xb')]+_0x33e246['countagentrejectretry'];this['countnosuchnumberretry']=_0x33e246[_0xe68b('0xc')];this['countdropretry']=_0x33e246[_0xe68b('0x9')];this[_0xe68b('0xa')]=_0x33e246['countabandonedretry'];this[_0xe68b('0xb')]=_0x33e246['countmachineretry'];this[_0xe68b('0xd')]=_0x33e246[_0xe68b('0xd')];this[_0xe68b('0x5')]=_0x33e246[_0xe68b('0x5')];this['calleridname']=_0x33e246[_0xe68b('0xe')];this[_0xe68b('0xf')]=_0x33e246[_0xe68b('0xf')];this[_0xe68b('0x10')]=_0x33e246[_0xe68b('0x10')];this[_0xe68b('0x11')]=_0x33e246[_0xe68b('0x11')];this[_0xe68b('0x12')]=_0x33e246['responsetime'];this[_0xe68b('0x13')]=_0x33e246[_0xe68b('0x13')]||0x0;this[_0xe68b('0x14')]=_0x33e246['holdtime']||0x0;this['talktime']=_0x33e246[_0xe68b('0x15')]||0x0;this[_0xe68b('0x16')]=_0x33e246[_0xe68b('0x16')];this[_0xe68b('0x17')]=_0x33e246[_0xe68b('0x17')];this['callbackat']=_0x33e246[_0xe68b('0x18')];this[_0xe68b('0x19')]=_0x33e246[_0xe68b('0x19')];this[_0xe68b('0x1a')]=_0x33e246[_0xe68b('0x1a')];this[_0xe68b('0x1b')]=_0x33e246[_0xe68b('0x1b')];this[_0xe68b('0x1c')]=_0x33e246['UserId'];this['VoiceQueueId']=_0x33e246[_0xe68b('0x1d')];this['CampaignId']=_0x33e246['CampaignId'];this[_0xe68b('0x1e')]=_0x33e246[_0xe68b('0x1e')]||'';this['originatecalleridname']=_0x33e246[_0xe68b('0x1f')]||'';this['state']=_0x33e246['state'];this['statedesc']=_0x33e246[_0xe68b('0x20')];}module[_0xe68b('0x21')]=Final; \ No newline at end of file +var _0xdcfa=['campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','uniqueid','scheduledat','type'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0xdcfa,0x126));var _0xadcf=function(_0x115d1f,_0xc8262){_0x115d1f=_0x115d1f-0x0;var _0x357a9e=_0xdcfa[_0x115d1f];return _0x357a9e;};'use strict';function Final(_0x19b7a9){this[_0xadcf('0x0')]=_0x19b7a9[_0xadcf('0x0')];this[_0xadcf('0x1')]=_0x19b7a9[_0xadcf('0x1')];this['type']=_0x19b7a9[_0xadcf('0x2')];this[_0xadcf('0x3')]=_0x19b7a9['type']===_0xadcf('0x4')?_0xadcf('0x5'):_0x19b7a9[_0xadcf('0x2')];this[_0xadcf('0x6')]=_0x19b7a9[_0xadcf('0x6')];this['countcongestionretry']=_0x19b7a9['countcongestionretry'];this[_0xadcf('0x7')]=_0x19b7a9['countnoanswerretry'];this[_0xadcf('0x8')]=_0x19b7a9[_0xadcf('0x6')]+_0x19b7a9[_0xadcf('0x9')]+_0x19b7a9[_0xadcf('0x7')]+_0x19b7a9[_0xadcf('0xa')]+_0x19b7a9[_0xadcf('0xb')]+_0x19b7a9['countabandonedretry']+_0x19b7a9[_0xadcf('0xc')]+_0x19b7a9['countagentrejectretry'];this[_0xadcf('0xa')]=_0x19b7a9[_0xadcf('0xa')];this['countdropretry']=_0x19b7a9[_0xadcf('0xb')];this[_0xadcf('0xd')]=_0x19b7a9[_0xadcf('0xd')];this[_0xadcf('0xc')]=_0x19b7a9['countmachineretry'];this[_0xadcf('0xe')]=_0x19b7a9['countagentrejectretry'];this[_0xadcf('0x5')]=_0x19b7a9[_0xadcf('0x5')];this[_0xadcf('0xf')]=_0x19b7a9[_0xadcf('0xf')];this[_0xadcf('0x10')]=_0x19b7a9['calleridnum'];this[_0xadcf('0x11')]=_0x19b7a9[_0xadcf('0x11')];this[_0xadcf('0x12')]=_0x19b7a9[_0xadcf('0x12')];this[_0xadcf('0x13')]=_0x19b7a9['responsetime'];this[_0xadcf('0x14')]=_0x19b7a9[_0xadcf('0x14')]||0x0;this['holdtime']=_0x19b7a9[_0xadcf('0x15')]||0x0;this[_0xadcf('0x16')]=_0x19b7a9[_0xadcf('0x16')]||0x0;this['callback']=_0x19b7a9[_0xadcf('0x17')];this[_0xadcf('0x18')]=_0x19b7a9[_0xadcf('0x18')];this['callbackat']=_0x19b7a9[_0xadcf('0x19')];this[_0xadcf('0x1a')]=_0x19b7a9[_0xadcf('0x1a')];this['ContactId']=_0x19b7a9[_0xadcf('0x1b')];this['ListId']=_0x19b7a9['ListId'];this['UserId']=_0x19b7a9['UserId'];this[_0xadcf('0x1c')]=_0x19b7a9[_0xadcf('0x1c')];this[_0xadcf('0x1d')]=_0x19b7a9[_0xadcf('0x1d')];this[_0xadcf('0x1e')]=_0x19b7a9['originatecalleridnum']||'';this['originatecalleridname']=_0x19b7a9['originatecalleridname']||'';this[_0xadcf('0x1f')]=_0x19b7a9[_0xadcf('0x1f')];this['statedesc']=_0x19b7a9[_0xadcf('0x20')];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 3f4202e..f513353 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 _0xdcc1=['countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry'];(function(_0x359a29,_0x35a736){var _0x2cdfea=function(_0x3f6d29){while(--_0x3f6d29){_0x359a29['push'](_0x359a29['shift']());}};_0x2cdfea(++_0x35a736);}(_0xdcc1,0xe3));var _0x1dcc=function(_0x4d86dc,_0x1b8520){_0x4d86dc=_0x4d86dc-0x0;var _0x19b295=_0xdcc1[_0x4d86dc];return _0x19b295;};'use strict';var moment=require(_0x1dcc('0x0'));var utils=require('../utils');function Hangup(_0x2e3ad9,_0x362615){this['state']=0x4;this['statedesc']=_0x1dcc('0x1');this[_0x1dcc('0x2')]=_0x2e3ad9[_0x1dcc('0x2')];this['type']=_0x2e3ad9[_0x1dcc('0x3')];this[_0x1dcc('0x4')]=_0x2e3ad9[_0x1dcc('0x3')]==='outbound'?_0x1dcc('0x5'):_0x2e3ad9['type'];this['amd']=_0x2e3ad9[_0x1dcc('0x6')]||![];this[_0x1dcc('0x7')]=_0x2e3ad9['countbusyretry'];this[_0x1dcc('0x8')]=_0x2e3ad9[_0x1dcc('0x8')];this[_0x1dcc('0x9')]=_0x2e3ad9[_0x1dcc('0x9')];this[_0x1dcc('0xa')]=_0x2e3ad9[_0x1dcc('0x7')]+_0x2e3ad9[_0x1dcc('0x8')]+_0x2e3ad9[_0x1dcc('0x9')]+_0x2e3ad9['countnosuchnumberretry']+_0x2e3ad9[_0x1dcc('0xb')]+_0x2e3ad9[_0x1dcc('0xc')]+_0x2e3ad9[_0x1dcc('0xd')]+_0x2e3ad9[_0x1dcc('0xe')];this[_0x1dcc('0xf')]=_0x2e3ad9['countnosuchnumberretry'];this[_0x1dcc('0xb')]=_0x2e3ad9[_0x1dcc('0xb')];this[_0x1dcc('0xc')]=_0x2e3ad9[_0x1dcc('0xc')];this['countmachineretry']=_0x2e3ad9['countmachineretry'];this[_0x1dcc('0xe')]=_0x2e3ad9[_0x1dcc('0xe')];this['uniqueid']=_0x362615[_0x1dcc('0x10')];this[_0x1dcc('0x11')]=_0x2e3ad9[_0x1dcc('0x12')];this[_0x1dcc('0x13')]=_0x2e3ad9['number'];this[_0x1dcc('0x14')]=_0x2e3ad9[_0x1dcc('0x14')];this['responsetime']=_0x2e3ad9[_0x1dcc('0x15')];this[_0x1dcc('0x16')]=moment()[_0x1dcc('0x17')](_0x1dcc('0x18'));this[_0x1dcc('0x19')]=utils['getSeconds'](_0x2e3ad9[_0x1dcc('0x15')],_0x2e3ad9['starttime']);this[_0x1dcc('0x1a')]=0x0;this['talktime']=utils[_0x1dcc('0x1b')](this[_0x1dcc('0x16')],_0x2e3ad9['responsetime']);this[_0x1dcc('0x5')]=_0x2e3ad9[_0x1dcc('0x5')];this['membername']=_0x1dcc('0x1c');this[_0x1dcc('0x1d')]=_0x362615[_0x1dcc('0x1e')];this[_0x1dcc('0x1f')]=_0x2e3ad9[_0x1dcc('0x1f')];this[_0x1dcc('0x20')]=_0x2e3ad9[_0x1dcc('0x20')];this[_0x1dcc('0x21')]=_0x2e3ad9['callbackat'];this['recallme']=_0x2e3ad9[_0x1dcc('0x22')];this['ContactId']=_0x2e3ad9[_0x1dcc('0x23')];this[_0x1dcc('0x24')]=_0x2e3ad9[_0x1dcc('0x24')];this[_0x1dcc('0x25')]=_0x2e3ad9[_0x1dcc('0x25')];this['VoiceQueueId']=_0x2e3ad9[_0x1dcc('0x26')];this[_0x1dcc('0x27')]=_0x2e3ad9[_0x1dcc('0x27')];}module['exports']=Hangup; \ No newline at end of file +var _0xbc69=['callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','IVR','reason','cause-txt','callback','callbackuniqueid'];(function(_0x236209,_0x51b840){var _0x2afd5b=function(_0x15b5d6){while(--_0x15b5d6){_0x236209['push'](_0x236209['shift']());}};_0x2afd5b(++_0x51b840);}(_0xbc69,0x88));var _0x9bc6=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xbc69[_0x5416db];return _0x243e35;};'use strict';var moment=require(_0x9bc6('0x0'));var utils=require(_0x9bc6('0x1'));function Hangup(_0x10cf38,_0x4dd8cd){this[_0x9bc6('0x2')]=0x4;this[_0x9bc6('0x3')]=_0x9bc6('0x4');this['scheduledat']=_0x10cf38[_0x9bc6('0x5')];this['type']=_0x10cf38[_0x9bc6('0x6')];this[_0x9bc6('0x7')]=_0x10cf38['type']===_0x9bc6('0x8')?_0x9bc6('0x9'):_0x10cf38[_0x9bc6('0x6')];this['amd']=_0x10cf38[_0x9bc6('0xa')]||![];this[_0x9bc6('0xb')]=_0x10cf38[_0x9bc6('0xb')];this['countcongestionretry']=_0x10cf38['countcongestionretry'];this[_0x9bc6('0xc')]=_0x10cf38['countnoanswerretry'];this[_0x9bc6('0xd')]=_0x10cf38[_0x9bc6('0xb')]+_0x10cf38[_0x9bc6('0xe')]+_0x10cf38[_0x9bc6('0xc')]+_0x10cf38['countnosuchnumberretry']+_0x10cf38[_0x9bc6('0xf')]+_0x10cf38['countabandonedretry']+_0x10cf38[_0x9bc6('0x10')]+_0x10cf38[_0x9bc6('0x11')];this['countnosuchnumberretry']=_0x10cf38[_0x9bc6('0x12')];this[_0x9bc6('0xf')]=_0x10cf38[_0x9bc6('0xf')];this[_0x9bc6('0x13')]=_0x10cf38[_0x9bc6('0x13')];this['countmachineretry']=_0x10cf38['countmachineretry'];this['countagentrejectretry']=_0x10cf38[_0x9bc6('0x11')];this[_0x9bc6('0x14')]=_0x4dd8cd['uniqueid'];this[_0x9bc6('0x15')]=_0x10cf38[_0x9bc6('0x16')];this[_0x9bc6('0x17')]=_0x10cf38['number'];this[_0x9bc6('0x18')]=_0x10cf38['starttime'];this[_0x9bc6('0x19')]=_0x10cf38[_0x9bc6('0x19')];this[_0x9bc6('0x1a')]=moment()[_0x9bc6('0x1b')](_0x9bc6('0x1c'));this[_0x9bc6('0x1d')]=utils[_0x9bc6('0x1e')](_0x10cf38[_0x9bc6('0x19')],_0x10cf38[_0x9bc6('0x18')]);this['holdtime']=0x0;this['talktime']=utils[_0x9bc6('0x1e')](this[_0x9bc6('0x1a')],_0x10cf38['responsetime']);this[_0x9bc6('0x9')]=_0x10cf38[_0x9bc6('0x9')];this['membername']=_0x9bc6('0x1f');this[_0x9bc6('0x20')]=_0x4dd8cd[_0x9bc6('0x21')];this[_0x9bc6('0x22')]=_0x10cf38[_0x9bc6('0x22')];this['callbackuniqueid']=_0x10cf38[_0x9bc6('0x23')];this[_0x9bc6('0x24')]=_0x10cf38[_0x9bc6('0x24')];this[_0x9bc6('0x25')]=_0x10cf38[_0x9bc6('0x25')];this[_0x9bc6('0x26')]=_0x10cf38[_0x9bc6('0x26')];this[_0x9bc6('0x27')]=_0x10cf38[_0x9bc6('0x27')];this[_0x9bc6('0x28')]=_0x10cf38[_0x9bc6('0x28')];this['VoiceQueueId']=_0x10cf38['VoiceQueueId'];this[_0x9bc6('0x29')]=_0x10cf38[_0x9bc6('0x29')];}module[_0x9bc6('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 8f03ac0..d6957b3 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 _0x9b49=['countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9b49,0xb5));var _0x99b4=function(_0x2a94cf,_0x2b970d){_0x2a94cf=_0x2a94cf-0x0;var _0x22147f=_0x9b49[_0x2a94cf];return _0x22147f;};'use strict';var utils=require(_0x99b4('0x0'));function History(_0x106212){this[_0x99b4('0x1')]=_0x106212['uniqueid'];this[_0x99b4('0x2')]=_0x106212['scheduledat']||undefined;this[_0x99b4('0x3')]=_0x106212[_0x99b4('0x3')];this[_0x99b4('0x4')]=_0x106212[_0x99b4('0x3')]===_0x99b4('0x5')?_0x99b4('0x6'):_0x106212[_0x99b4('0x3')];this['countbusyretry']=_0x106212[_0x99b4('0x7')];this[_0x99b4('0x8')]=_0x106212[_0x99b4('0x8')];this[_0x99b4('0x9')]=_0x106212['countnoanswerretry'];this['countglobal']=_0x106212[_0x99b4('0x7')]+_0x106212['countcongestionretry']+_0x106212[_0x99b4('0x9')]+_0x106212['countnosuchnumberretry']+_0x106212['countdropretry']+_0x106212[_0x99b4('0xa')]+_0x106212[_0x99b4('0xb')]+_0x106212['countagentrejectretry'];this[_0x99b4('0xc')]=_0x106212['countnosuchnumberretry'];this[_0x99b4('0xd')]=_0x106212[_0x99b4('0xd')];this[_0x99b4('0xa')]=_0x106212[_0x99b4('0xa')];this['countmachineretry']=_0x106212[_0x99b4('0xb')];this[_0x99b4('0xe')]=_0x106212[_0x99b4('0xe')];this[_0x99b4('0x6')]=_0x106212['queue'];this['calleridname']=_0x106212['name'];this[_0x99b4('0xf')]=_0x106212['number'];this[_0x99b4('0x10')]=_0x106212[_0x99b4('0x10')];this[_0x99b4('0x11')]=_0x106212[_0x99b4('0x11')];this['endtime']=_0x106212[_0x99b4('0x11')];this[_0x99b4('0x12')]=utils['getSeconds'](_0x106212[_0x99b4('0x11')],_0x106212[_0x99b4('0x10')]);this[_0x99b4('0x13')]=0x0;this['talktime']=0x0;this['callback']=_0x106212[_0x99b4('0x14')];this[_0x99b4('0x15')]=_0x106212['callbackuniqueid'];this[_0x99b4('0x16')]=_0x106212[_0x99b4('0x16')];this[_0x99b4('0x17')]=_0x106212[_0x99b4('0x17')];this['ContactId']=_0x106212['ContactId'];this[_0x99b4('0x18')]=_0x106212['ListId'];this[_0x99b4('0x19')]=_0x106212[_0x99b4('0x19')];this[_0x99b4('0x1a')]=_0x106212[_0x99b4('0x1a')];this['CampaignId']=_0x106212['CampaignId'];this[_0x99b4('0x1b')]=_0x106212[_0x99b4('0x1b')]||'';this[_0x99b4('0x1c')]=_0x106212[_0x99b4('0x1c')]||'';this[_0x99b4('0x1d')]=_0x106212[_0x99b4('0x1d')];this[_0x99b4('0x1e')]=_0x106212[_0x99b4('0x1e')];}module[_0x99b4('0x1f')]=History; \ No newline at end of file +var _0x2ded=['campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat'];(function(_0x11cb92,_0x534825){var _0x50e2e6=function(_0x347dce){while(--_0x347dce){_0x11cb92['push'](_0x11cb92['shift']());}};_0x50e2e6(++_0x534825);}(_0x2ded,0x1eb));var _0xd2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ded[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xd2de('0x0'));function History(_0x1a1883){this[_0xd2de('0x1')]=_0x1a1883[_0xd2de('0x1')];this['scheduledat']=_0x1a1883[_0xd2de('0x2')]||undefined;this['type']=_0x1a1883['type'];this[_0xd2de('0x3')]=_0x1a1883['type']===_0xd2de('0x4')?_0xd2de('0x5'):_0x1a1883[_0xd2de('0x6')];this[_0xd2de('0x7')]=_0x1a1883[_0xd2de('0x7')];this[_0xd2de('0x8')]=_0x1a1883['countcongestionretry'];this[_0xd2de('0x9')]=_0x1a1883[_0xd2de('0x9')];this[_0xd2de('0xa')]=_0x1a1883[_0xd2de('0x7')]+_0x1a1883[_0xd2de('0x8')]+_0x1a1883[_0xd2de('0x9')]+_0x1a1883[_0xd2de('0xb')]+_0x1a1883[_0xd2de('0xc')]+_0x1a1883[_0xd2de('0xd')]+_0x1a1883[_0xd2de('0xe')]+_0x1a1883[_0xd2de('0xf')];this[_0xd2de('0xb')]=_0x1a1883[_0xd2de('0xb')];this[_0xd2de('0xc')]=_0x1a1883[_0xd2de('0xc')];this[_0xd2de('0xd')]=_0x1a1883[_0xd2de('0xd')];this['countmachineretry']=_0x1a1883[_0xd2de('0xe')];this[_0xd2de('0xf')]=_0x1a1883[_0xd2de('0xf')];this[_0xd2de('0x5')]=_0x1a1883[_0xd2de('0x5')];this[_0xd2de('0x10')]=_0x1a1883[_0xd2de('0x11')];this['calleridnum']=_0x1a1883[_0xd2de('0x12')];this[_0xd2de('0x13')]=_0x1a1883[_0xd2de('0x13')];this['responsetime']=_0x1a1883[_0xd2de('0x14')];this[_0xd2de('0x15')]=_0x1a1883['responsetime'];this['ringtime']=utils['getSeconds'](_0x1a1883['responsetime'],_0x1a1883[_0xd2de('0x13')]);this[_0xd2de('0x16')]=0x0;this[_0xd2de('0x17')]=0x0;this[_0xd2de('0x18')]=_0x1a1883[_0xd2de('0x18')];this[_0xd2de('0x19')]=_0x1a1883[_0xd2de('0x19')];this[_0xd2de('0x1a')]=_0x1a1883[_0xd2de('0x1a')];this[_0xd2de('0x1b')]=_0x1a1883['recallme'];this['ContactId']=_0x1a1883[_0xd2de('0x1c')];this[_0xd2de('0x1d')]=_0x1a1883[_0xd2de('0x1d')];this[_0xd2de('0x1e')]=_0x1a1883[_0xd2de('0x1e')];this[_0xd2de('0x1f')]=_0x1a1883[_0xd2de('0x1f')];this[_0xd2de('0x20')]=_0x1a1883[_0xd2de('0x20')];this[_0xd2de('0x21')]=_0x1a1883['originatecalleridnum']||'';this[_0xd2de('0x22')]=_0x1a1883['originatecalleridname']||'';this['state']=_0x1a1883[_0xd2de('0x23')];this[_0xd2de('0x24')]=_0x1a1883[_0xd2de('0x24')];}module[_0xd2de('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 41832ec..383d0c7 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 _0xe5c8=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x410b6d,_0x200838){var _0x40951d=function(_0x5688a2){while(--_0x5688a2){_0x410b6d['push'](_0x410b6d['shift']());}};_0x40951d(++_0x200838);}(_0xe5c8,0x135));var _0x8e5c=function(_0x1d51b2,_0x2b450a){_0x1d51b2=_0x1d51b2-0x0;var _0x4d3c8a=_0xe5c8[_0x1d51b2];return _0x4d3c8a;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x409b0a,_0x240544){this['scheduledat']=_0x409b0a[_0x8e5c('0x0')];this[_0x8e5c('0x1')]=_0x409b0a[_0x8e5c('0x1')];this['campaigntype']=_0x409b0a[_0x8e5c('0x1')]===_0x8e5c('0x2')?_0x8e5c('0x3'):_0x409b0a[_0x8e5c('0x1')];this[_0x8e5c('0x4')]=_0x409b0a[_0x8e5c('0x4')];this[_0x8e5c('0x5')]=_0x409b0a[_0x8e5c('0x5')];this['countnoanswerretry']=_0x409b0a[_0x8e5c('0x6')];this[_0x8e5c('0x7')]=_0x409b0a[_0x8e5c('0x4')]+_0x409b0a[_0x8e5c('0x5')]+_0x409b0a[_0x8e5c('0x6')]+_0x409b0a[_0x8e5c('0x8')]+_0x409b0a[_0x8e5c('0x9')]+_0x409b0a['countabandonedretry']+_0x409b0a[_0x8e5c('0xa')]+_0x409b0a[_0x8e5c('0xb')];this[_0x8e5c('0x8')]=_0x409b0a[_0x8e5c('0x8')];this[_0x8e5c('0x9')]=_0x409b0a[_0x8e5c('0x9')];this[_0x8e5c('0xc')]=_0x409b0a['countabandonedretry'];this[_0x8e5c('0xa')]=_0x409b0a[_0x8e5c('0xa')];this[_0x8e5c('0xb')]=_0x409b0a[_0x8e5c('0xb')];this[_0x8e5c('0xd')]=_0x240544['uniqueid'];this[_0x8e5c('0xe')]=_0x409b0a[_0x8e5c('0xf')];this[_0x8e5c('0x10')]=_0x409b0a[_0x8e5c('0x11')];this[_0x8e5c('0x12')]=_0x409b0a[_0x8e5c('0x12')];this[_0x8e5c('0x13')]=_0x409b0a['responsetime'];this[_0x8e5c('0x14')]=_0x409b0a[_0x8e5c('0x14')];this['dropreason']=_0x409b0a[_0x8e5c('0x15')];this[_0x8e5c('0x16')]=this[_0x8e5c('0x14')];this[_0x8e5c('0x17')]=utils['getSeconds'](_0x409b0a[_0x8e5c('0x13')],_0x409b0a[_0x8e5c('0x12')]);this[_0x8e5c('0x18')]=utils[_0x8e5c('0x19')](this[_0x8e5c('0x14')],_0x409b0a[_0x8e5c('0x13')]);this[_0x8e5c('0x1a')]=0x0;this['queue']=_0x240544[_0x8e5c('0x3')];this[_0x8e5c('0x1b')]=_0x240544[_0x8e5c('0x1c')];this[_0x8e5c('0x1d')]=_0x240544[_0x8e5c('0x1d')];this['callback']=_0x409b0a[_0x8e5c('0x1e')];this[_0x8e5c('0x1f')]=_0x409b0a[_0x8e5c('0x1f')];this[_0x8e5c('0x20')]=_0x409b0a['callbackat'];this[_0x8e5c('0x21')]=_0x409b0a['recallme'];this['ContactId']=_0x409b0a[_0x8e5c('0x22')];this[_0x8e5c('0x23')]=_0x409b0a[_0x8e5c('0x23')];this[_0x8e5c('0x24')]=_0x409b0a[_0x8e5c('0x24')];this['VoiceQueueId']=_0x409b0a[_0x8e5c('0x25')];this[_0x8e5c('0x26')]=_0x409b0a[_0x8e5c('0x26')];this[_0x8e5c('0x27')]=_0x409b0a[_0x8e5c('0x27')]||'';this[_0x8e5c('0x28')]=_0x409b0a['originatecalleridname']||'';this[_0x8e5c('0x29')]=_0x409b0a[_0x8e5c('0x29')];this[_0x8e5c('0x2a')]=_0x409b0a['state'];this[_0x8e5c('0x2b')]=_0x409b0a['statedesc'];}module[_0x8e5c('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0x5a28=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x13eea8,_0x5ed8b2){var _0x255a29=function(_0x2fa27e){while(--_0x2fa27e){_0x13eea8['push'](_0x13eea8['shift']());}};_0x255a29(++_0x5ed8b2);}(_0x5a28,0x1c7));var _0x85a2=function(_0x423e4b,_0x1bb75b){_0x423e4b=_0x423e4b-0x0;var _0x626fd4=_0x5a28[_0x423e4b];return _0x626fd4;};'use strict';var utils=require(_0x85a2('0x0'));function QueueCallerAbandon(_0xdc9adc,_0x1d99cf){this[_0x85a2('0x1')]=_0xdc9adc[_0x85a2('0x1')];this['type']=_0xdc9adc[_0x85a2('0x2')];this[_0x85a2('0x3')]=_0xdc9adc[_0x85a2('0x2')]===_0x85a2('0x4')?_0x85a2('0x5'):_0xdc9adc['type'];this[_0x85a2('0x6')]=_0xdc9adc[_0x85a2('0x6')];this[_0x85a2('0x7')]=_0xdc9adc[_0x85a2('0x7')];this[_0x85a2('0x8')]=_0xdc9adc['countnoanswerretry'];this[_0x85a2('0x9')]=_0xdc9adc['countbusyretry']+_0xdc9adc[_0x85a2('0x7')]+_0xdc9adc['countnoanswerretry']+_0xdc9adc[_0x85a2('0xa')]+_0xdc9adc['countdropretry']+_0xdc9adc['countabandonedretry']+_0xdc9adc['countmachineretry']+_0xdc9adc['countagentrejectretry'];this[_0x85a2('0xa')]=_0xdc9adc[_0x85a2('0xa')];this['countdropretry']=_0xdc9adc[_0x85a2('0xb')];this[_0x85a2('0xc')]=_0xdc9adc[_0x85a2('0xc')];this[_0x85a2('0xd')]=_0xdc9adc['countmachineretry'];this['countagentrejectretry']=_0xdc9adc[_0x85a2('0xe')];this[_0x85a2('0xf')]=_0x1d99cf[_0x85a2('0xf')];this[_0x85a2('0x10')]=_0xdc9adc[_0x85a2('0x11')];this[_0x85a2('0x12')]=_0xdc9adc[_0x85a2('0x13')];this['starttime']=_0xdc9adc[_0x85a2('0x14')];this[_0x85a2('0x15')]=_0xdc9adc[_0x85a2('0x15')];this[_0x85a2('0x16')]=_0xdc9adc[_0x85a2('0x16')];this[_0x85a2('0x17')]=_0xdc9adc['dropreason'];this[_0x85a2('0x18')]=this[_0x85a2('0x16')];this[_0x85a2('0x19')]=utils[_0x85a2('0x1a')](_0xdc9adc['responsetime'],_0xdc9adc[_0x85a2('0x14')]);this[_0x85a2('0x1b')]=utils[_0x85a2('0x1a')](this['droptime'],_0xdc9adc[_0x85a2('0x15')]);this[_0x85a2('0x1c')]=0x0;this[_0x85a2('0x5')]=_0x1d99cf['queue'];this[_0x85a2('0x1d')]=_0x1d99cf[_0x85a2('0x1e')];this[_0x85a2('0x1f')]=_0x1d99cf[_0x85a2('0x1f')];this[_0x85a2('0x20')]=_0xdc9adc['callback'];this['callbackuniqueid']=_0xdc9adc[_0x85a2('0x21')];this[_0x85a2('0x22')]=_0xdc9adc['callbackat'];this['recallme']=_0xdc9adc[_0x85a2('0x23')];this[_0x85a2('0x24')]=_0xdc9adc[_0x85a2('0x24')];this[_0x85a2('0x25')]=_0xdc9adc[_0x85a2('0x25')];this['UserId']=_0xdc9adc[_0x85a2('0x26')];this[_0x85a2('0x27')]=_0xdc9adc[_0x85a2('0x27')];this[_0x85a2('0x28')]=_0xdc9adc[_0x85a2('0x28')];this[_0x85a2('0x29')]=_0xdc9adc['originatecalleridnum']||'';this[_0x85a2('0x2a')]=_0xdc9adc[_0x85a2('0x2a')]||'';this[_0x85a2('0x2b')]=_0xdc9adc[_0x85a2('0x2b')];this[_0x85a2('0x2c')]=_0xdc9adc[_0x85a2('0x2c')];this[_0x85a2('0x2d')]=_0xdc9adc[_0x85a2('0x2d')];}module[_0x85a2('0x2e')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index d9fac5f..91b3462 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','catch','temp','error','[getContactDialer]','getContactDialer','getContactDialerIvr','dialOrderByScheduledAt','[getContactDialerIvr]','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x2ef3,0xba));var _0x32ef=function(_0x41bc56,_0x151bb0){_0x41bc56=_0x41bc56-0x0;var _0x184910=_0x2ef3[_0x41bc56];return _0x184910;};'use strict';var util=require(_0x32ef('0x0'));var logger=require(_0x32ef('0x1'))(_0x32ef('0x2'));var cmHopper=require(_0x32ef('0x3'));var cmHopperAdditionalPhone=require(_0x32ef('0x4'));var cmHopperBlack=require(_0x32ef('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x38f865){return util[_0x32ef('0x6')](_0x38f865,{'showHidden':![],'depth':null});}function getContactDialer(_0x524ab6,_0x402857,_0x37dd1d){return cmHopper['getContactDialer'](_0x524ab6['id'],_0x402857,_0x37dd1d,_0x524ab6['dialOrderByScheduledAt'])[_0x32ef('0x7')](function(_0x4bfcf8){_0x524ab6[_0x32ef('0x8')]=0x0;logger[_0x32ef('0x9')](_0x32ef('0xa'),inspectError(_0x4bfcf8));});}exports[_0x32ef('0xb')]=getContactDialer;function getContactDialerIvr(_0x2484a0,_0x2bbb50){return cmHopper[_0x32ef('0xc')](_0x2484a0['id'],_0x2bbb50,_0x2484a0[_0x32ef('0xd')])['catch'](function(_0x5780e9){_0x2484a0[_0x32ef('0x8')]=0x0;logger[_0x32ef('0x9')](_0x32ef('0xe'),inspectError(_0x5780e9));});}exports[_0x32ef('0xc')]=getContactDialerIvr;function countReScheduled(_0x5af651){return cmHopper[_0x32ef('0xf')](_0x5af651)['catch'](function(_0x1a5106){logger['error'](_0x32ef('0x10'),inspectError(_0x1a5106));});}exports[_0x32ef('0xf')]=countReScheduled;function rescheduleContact(_0x5c3eb9){return cmHopper['rescheduleContact'](_0x5c3eb9)[_0x32ef('0x7')](function(_0x4d8009){logger[_0x32ef('0x9')](_0x32ef('0x11'),inspectError(_0x4d8009));});}exports[_0x32ef('0x12')]=rescheduleContact;function unlockContact(_0x54c7f5,_0x57aff1,_0x55bf0b){return cmHopper['unlockContact'](_0x54c7f5,_0x57aff1,_0x55bf0b)[_0x32ef('0x7')](function(_0x3950e6){logger[_0x32ef('0x9')]('[unlockContact]',inspectError(_0x3950e6));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x1eb468){return cmHopper[_0x32ef('0x13')](_0x1eb468)[_0x32ef('0x7')](function(_0x57863c){logger[_0x32ef('0x9')](_0x32ef('0x14'),inspectError(_0x57863c));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x304505){return cmHopperBlack[_0x32ef('0x15')](_0x304505)[_0x32ef('0x7')](function(_0x251084){logger[_0x32ef('0x9')](_0x32ef('0x16'),inspectError(_0x251084));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x3c5b78){return cmHopperBlack['checkIsBlackListIvr'](_0x3c5b78)[_0x32ef('0x7')](function(_0x3a20ca){logger['error'](_0x32ef('0x17'),inspectError(_0x3a20ca));});}exports[_0x32ef('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5e8898,_0x55f7f2,_0x57f5e5){return cmHopperAdditionalPhone[_0x32ef('0x19')](_0x5e8898,_0x55f7f2,_0x57f5e5)[_0x32ef('0x7')](function(_0x225feb){logger['error']('[verifyAdditionalPhone]',inspectError(_0x225feb));});}exports[_0x32ef('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x4d584b,_0x51a412,_0x278495){return cmHopperAdditionalPhone[_0x32ef('0x1a')](_0x4d584b,_0x51a412,_0x278495)[_0x32ef('0x7')](function(_0x1dbe98){logger[_0x32ef('0x9')](_0x32ef('0x1b'),inspectError(_0x1dbe98));});}exports[_0x32ef('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x38aed5){return cmHopperHistory[_0x32ef('0x1c')](_0x38aed5)[_0x32ef('0x7')](function(_0x1335e2){logger[_0x32ef('0x9')]('[avgHandleTime]',inspectError(_0x1335e2));});}exports[_0x32ef('0x1c')]=avgHandleTime;function createHistory(_0x2f5d06){return cmHopperHistory['createHistory'](_0x2f5d06)[_0x32ef('0x7')](function(_0x3c569d){logger[_0x32ef('0x9')](_0x32ef('0x1d'),inspectError(_0x3c569d));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xf61e=['dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xf61e,0x191));var _0xef61=function(_0x337044,_0x55a11a){_0x337044=_0x337044-0x0;var _0x299321=_0xf61e[_0x337044];return _0x299321;};'use strict';var util=require(_0xef61('0x0'));var logger=require(_0xef61('0x1'))(_0xef61('0x2'));var cmHopper=require(_0xef61('0x3'));var cmHopperAdditionalPhone=require(_0xef61('0x4'));var cmHopperBlack=require(_0xef61('0x5'));var cmHopperHistory=require(_0xef61('0x6'));function inspectError(_0x40509e){return util[_0xef61('0x7')](_0x40509e,{'showHidden':![],'depth':null});}function getContactDialer(_0x14122a,_0x239fa9,_0x45a18d){return cmHopper['getContactDialer'](_0x14122a['id'],_0x239fa9,_0x45a18d,_0x14122a[_0xef61('0x8')])[_0xef61('0x9')](function(_0x4f0cc5){_0x14122a[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xc'),inspectError(_0x4f0cc5));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x47d0a7,_0x188894){return cmHopper[_0xef61('0xd')](_0x47d0a7['id'],_0x188894,_0x47d0a7[_0xef61('0x8')])[_0xef61('0x9')](function(_0x2af74c){_0x47d0a7[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xe'),inspectError(_0x2af74c));});}exports[_0xef61('0xd')]=getContactDialerIvr;function countReScheduled(_0x66e7b2){return cmHopper[_0xef61('0xf')](_0x66e7b2)[_0xef61('0x9')](function(_0x114e1f){logger[_0xef61('0xb')]('[countReScheduled]',inspectError(_0x114e1f));});}exports[_0xef61('0xf')]=countReScheduled;function rescheduleContact(_0x58d9a0){return cmHopper[_0xef61('0x10')](_0x58d9a0)[_0xef61('0x9')](function(_0x370ee0){logger[_0xef61('0xb')]('[rescheduleContact]',inspectError(_0x370ee0));});}exports[_0xef61('0x10')]=rescheduleContact;function unlockContact(_0x435beb,_0x1224c2,_0x78ff22){return cmHopper['unlockContact'](_0x435beb,_0x1224c2,_0x78ff22)[_0xef61('0x9')](function(_0xbe23a7){logger['error'](_0xef61('0x11'),inspectError(_0xbe23a7));});}exports[_0xef61('0x12')]=unlockContact;function moveContactManagedDialer(_0x36f558){return cmHopper[_0xef61('0x13')](_0x36f558)[_0xef61('0x9')](function(_0x28315a){logger[_0xef61('0xb')]('[moveContactManagedDialer]',inspectError(_0x28315a));});}exports[_0xef61('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x2c8dad){return cmHopperBlack['checkIsBlackList'](_0x2c8dad)[_0xef61('0x9')](function(_0x36966a){logger[_0xef61('0xb')](_0xef61('0x14'),inspectError(_0x36966a));});}exports[_0xef61('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x2ed61e){return cmHopperBlack[_0xef61('0x16')](_0x2ed61e)['catch'](function(_0x536e9e){logger[_0xef61('0xb')]('[checkIsBlackListIvr]',inspectError(_0x536e9e));});}exports[_0xef61('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5ae7a2,_0x488b47,_0x2f0569){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5ae7a2,_0x488b47,_0x2f0569)['catch'](function(_0xfbee94){logger[_0xef61('0xb')](_0xef61('0x17'),inspectError(_0xfbee94));});}exports[_0xef61('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5e56da,_0x16b144,_0x4e738f){return cmHopperAdditionalPhone[_0xef61('0x19')](_0x5e56da,_0x16b144,_0x4e738f)[_0xef61('0x9')](function(_0x2419a9){logger[_0xef61('0xb')](_0xef61('0x1a'),inspectError(_0x2419a9));});}exports[_0xef61('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x258b5a){return cmHopperHistory[_0xef61('0x1b')](_0x258b5a)[_0xef61('0x9')](function(_0x1ee27b){logger[_0xef61('0xb')](_0xef61('0x1c'),inspectError(_0x1ee27b));});}exports[_0xef61('0x1b')]=avgHandleTime;function createHistory(_0x63edd4){return cmHopperHistory[_0xef61('0x1d')](_0x63edd4)[_0xef61('0x9')](function(_0x39c15e){logger[_0xef61('0xb')](_0xef61('0x1e'),inspectError(_0x39c15e));});}exports[_0xef61('0x1d')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 0c0b936..e62c0ae 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 _0x8f73=['Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','erlangb','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','XMD-','substring','toUpperCase','setXMDContactVariables','lodash','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated'];(function(_0x3e81df,_0xb0f7e3){var _0x1c7c79=function(_0x2db358){while(--_0x2db358){_0x3e81df['push'](_0x3e81df['shift']());}};_0x1c7c79(++_0xb0f7e3);}(_0x8f73,0x82));var _0x38f7=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x8f73[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x38f7('0x0'));var moment=require('moment');var util=require('util');var logger=require(_0x38f7('0x1'))(_0x38f7('0x2'));var timezones=require('../../../../config/environment/shared')[_0x38f7('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0x38f7('0x4'),'BLACKLIST':_0x38f7('0x5'),'CONTACTS_RESCHEDULED':_0x38f7('0x6'),'DEACTIVATED':_0x38f7('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x38f7('0x8'),'INACTIVE':_0x38f7('0x9'),'NO_AGENTS_LOGGED':_0x38f7('0xa'),'NO_AVAILABLE_CONTACTS':_0x38f7('0xb'),'NULL_INTERVAL':_0x38f7('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x38f7('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x38f7('0xe'),'RUNNING':_0x38f7('0xf'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x38f7('0x10')};exports[_0x38f7('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x553fc9){return _0x553fc9['dialMethod']===_0x38f7('0x12');}exports[_0x38f7('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x54380e){return _0x54380e[_0x38f7('0x14')]===_0x38f7('0x15');}exports[_0x38f7('0x16')]=isIVRCampaign;function isOutboundQueue(_0xb6f8){return _0xb6f8[_0x38f7('0x14')]===_0x38f7('0x17');}exports[_0x38f7('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x7653a4){return _0x7653a4[_0x38f7('0x19')];}exports[_0x38f7('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x10ffa5){return _0x10ffa5[_0x38f7('0x1b')];}exports[_0x38f7('0x1c')]=isIVRCampaignActive;function getSeconds(_0x599b84,_0x3b1f7f){var _0x10f508=moment(_0x599b84)['milliseconds'](0x0);var _0x19faf8=moment(_0x3b1f7f)[_0x38f7('0x1d')](0x0);return _0x10f508['diff'](_0x19faf8,'seconds');}exports[_0x38f7('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x20b46d,_0x10f554){var _0x505843=![];var _0x120ad9=_0x20b46d[_0x38f7('0x1f')]!==_0x10f554['dialMethod']||_0x20b46d[_0x38f7('0x19')]!==_0x10f554[_0x38f7('0x19')]||_0x20b46d[_0x38f7('0x20')]!==_0x10f554[_0x38f7('0x20')];var _0x4f3197=_0x20b46d['available']!==_0x10f554[_0x38f7('0x21')]||_0x20b46d[_0x38f7('0x22')]!==_0x10f554[_0x38f7('0x22')]||_0x20b46d[_0x38f7('0x23')]!==_0x10f554[_0x38f7('0x23')]||_0x20b46d[_0x38f7('0x24')]!==_0x10f554[_0x38f7('0x24')]||_0x20b46d['talking']!==_0x10f554[_0x38f7('0x25')]||_0x20b46d['pTalking']!==_0x10f554[_0x38f7('0x26')]||_0x20b46d[_0x38f7('0x27')]!==_0x10f554[_0x38f7('0x27')]||_0x20b46d[_0x38f7('0x28')]!==_0x10f554['inUse']||_0x20b46d[_0x38f7('0x29')]!==_0x10f554[_0x38f7('0x29')];if(_0x20b46d[_0x38f7('0x2a')]&&_0x10f554[_0x38f7('0x2a')]){_0x505843=_0x20b46d[_0x38f7('0x2a')][_0x38f7('0x2b')]!==_0x10f554['Trunk'][_0x38f7('0x2b')]||_0x20b46d[_0x38f7('0x2a')][_0x38f7('0x1b')]!==_0x10f554[_0x38f7('0x2a')][_0x38f7('0x1b')];}return _0x120ad9||_0x4f3197||_0x505843;}exports[_0x38f7('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1f94d4){var _0x207255=null;var _0x1cad60=_0x1f94d4['dialTimezone'];if(_[_0x38f7('0x2d')](_0x1f94d4[_0x38f7('0x2e')])||_[_0x38f7('0x2d')](_0x1f94d4[_0x38f7('0x2f')])||_[_0x38f7('0x2d')](_0x1f94d4[_0x38f7('0x2f')][_0x38f7('0x30')])){_0x207255=CAMPAIGN_STATUS[_0x38f7('0x31')];}else if(_[_0x38f7('0x32')](_0x1f94d4[_0x38f7('0x2e')])||_[_0x38f7('0x32')](_0x1f94d4['Interval'][_0x38f7('0x30')])){_0x207255=CAMPAIGN_STATUS[_0x38f7('0x33')];}else if(_0x1cad60&&!timezones[_0x1cad60]){_0x207255=CAMPAIGN_STATUS[_0x38f7('0x34')];}return _0x207255;}function checkAnyValidTrunk(_0x3d332c,_0x479f1a){var _0x234297=null;var _0x10c944=_0x38f7('0x35');var _0x166ce4=[_0x38f7('0x36'),'unmonitored'];var _0x530cd1=!![];if(_0x3d332c[_0x38f7('0x2a')]&&_0x3d332c[_0x38f7('0x2a')][_0x38f7('0x1b')]){_0x10c944+=_0x3d332c[_0x38f7('0x2a')]['name'];_0x234297=_0x479f1a[_0x10c944];_0x530cd1=_0x166ce4[_0x38f7('0x37')](_0x234297[_0x38f7('0x38')]);}else if(_0x3d332c[_0x38f7('0x39')]&&_0x3d332c[_0x38f7('0x39')][_0x38f7('0x1b')]){_0x10c944+=_0x3d332c[_0x38f7('0x39')][_0x38f7('0x2b')];_0x234297=_0x479f1a[_0x10c944];_0x530cd1=_0x166ce4[_0x38f7('0x37')](_0x234297[_0x38f7('0x38')]);}return _0x530cd1;}function getQueueCampaignStatusMessage(_0x4f5b2d,_0x47fa15){var _0x528af7=CAMPAIGN_STATUS[_0x38f7('0x4')];var _0x51772=isPreviewCampaign(_0x4f5b2d);if(!isQueueCampaignActive(_0x4f5b2d)){if(_0x51772){_0x528af7=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x4f5b2d[_0x38f7('0x29')]===0x0&&_0x4f5b2d[_0x38f7('0x25')]===0x0&&_0x4f5b2d[_0x38f7('0x27')]===0x0&&(_0x4f5b2d[_0x38f7('0x26')]||0x0)===0x0){_0x528af7=CAMPAIGN_STATUS[_0x38f7('0x3a')];}else{_0x528af7=CAMPAIGN_STATUS[_0x38f7('0x3b')];}}}else if(_0x4f5b2d[_0x38f7('0x22')]===0x0){_0x528af7=CAMPAIGN_STATUS[_0x38f7('0x3c')];}else if(!checkAnyValidTrunk(_0x4f5b2d,_0x47fa15)){_0x528af7=CAMPAIGN_STATUS[_0x38f7('0x3d')];}else if(!isPreviewCampaign(_0x4f5b2d)){var _0x9688bb=checkAnyValidQueueCampaignInterval(_0x4f5b2d);if(_0x9688bb){_0x528af7=_0x9688bb;}}return _0x528af7;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x49335d){var _0x53edff=CAMPAIGN_STATUS[_0x38f7('0x3b')];if(_0x49335d[_0x38f7('0x29')]===0x0&&_0x49335d[_0x38f7('0x25')]===0x0&&_0x49335d[_0x38f7('0x27')]===0x0&&(_0x49335d[_0x38f7('0x26')]||0x0)===0x0){_0x53edff=CAMPAIGN_STATUS[_0x38f7('0x3a')];}return _0x53edff;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x80a36c){var _0x37727e=_0x80a36c[_0x38f7('0x3e')](/"(.*?)"/);return _0x37727e?_0x37727e[0x1]:_0x80a36c;}exports[_0x38f7('0x3f')]=extractCalleridName;function getCallerId(_0x17806b,_0x290118,_0x3d02d2){if(!_[_0x38f7('0x40')](_0x3d02d2)&&typeof _0x3d02d2===_0x38f7('0x41')&&!_[_0x38f7('0x32')](_0x3d02d2)){if(!_[_0x38f7('0x40')](_0x290118)&&typeof _0x290118===_0x38f7('0x41')&&!_[_0x38f7('0x32')](_0x290118)){return util[_0x38f7('0x42')]('\x22%s\x22\x20<%s>',_0x290118,_0x3d02d2);}return util[_0x38f7('0x42')](_0x38f7('0x43'),_0x3d02d2,_0x3d02d2);}if(!_[_0x38f7('0x40')](_0x17806b)&&typeof _0x17806b===_0x38f7('0x41')&&!_[_0x38f7('0x32')](_0x17806b)){return _0x17806b;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x116da8,_0x42de6d){var _0x2a241d;var _0x1525c8;var _0x34f6c4;if(_0x42de6d<=0x0){_0x42de6d=0x1;}_0x2a241d=new RegExp(_0x38f7('0x44')+_0x42de6d+'}$');_0x1525c8=Math[_0x38f7('0x45')](0xa,_0x42de6d-0x1);_0x34f6c4=Math[_0x38f7('0x45')](0xa,_0x42de6d)-0x1;return util['format']('%s',_['replace'](_0x116da8,_0x2a241d,_[_0x38f7('0x46')](_0x1525c8,_0x34f6c4)[_0x38f7('0x47')]()));}exports[_0x38f7('0x48')]=getCallerIdRandom;function decrementOriginate(_0x5f2768){if(_0x5f2768[_0x38f7('0x29')]&&_0x5f2768[_0x38f7('0x29')]>0x0){_0x5f2768[_0x38f7('0x29')]-=0x1;}else{logger[_0x38f7('0x49')](_0x38f7('0x4a'));}}exports[_0x38f7('0x4b')]=decrementOriginate;function checkContactEmpty(_0x4fbc3d){return _0x4fbc3d&&_0x4fbc3d['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x4de22d,_0x56fda2){if(_0x56fda2===0x0){return 0x0;}var _0x1c2633=0x1;for(var _0x47faf0=0x1;_0x47faf0<=_0x56fda2;_0x47faf0+=0x1){_0x1c2633=0x1+_0x1c2633*_0x47faf0/_0x4de22d;}return 0x1/_0x1c2633;}exports[_0x38f7('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x17caa3,_0x4cdd66,_0x3d769f){if(_0x4cdd66>_0x3d769f){for(var _0x49cc15=0x0;_0x49cc15<_0x4cdd66-_0x3d769f;_0x49cc15+=0x1){decrementOriginate(_0x17caa3);}}}exports[_0x38f7('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x167e7b){var _0x412220={};var _0x2e45cb=['id',_0x38f7('0x4e'),'tags',_0x38f7('0x4f')];const _0x2738cb=0xfa;if(_0x167e7b){for(var _0x50f37d in _0x167e7b){if(typeof _0x167e7b[_0x50f37d]!==_0x38f7('0x50')){if(!_[_0x38f7('0x2d')](_0x167e7b[_0x50f37d])&&!_0x2e45cb['includes'](_0x50f37d)){if(_0x50f37d===_0x38f7('0x51')&&_0x167e7b[_0x50f37d]['length']>_0x2738cb){_0x412220[_0x38f7('0x52')+_0x50f37d['toUpperCase']()]=_0x167e7b[_0x50f37d][_0x38f7('0x47')]()[_0x38f7('0x53')](0x0,_0x2738cb);}else{_0x412220['XMD-'+_0x50f37d[_0x38f7('0x54')]()]=_0x167e7b[_0x50f37d];}}}}}return _0x412220;}exports[_0x38f7('0x55')]=setXMDContactVariables; \ No newline at end of file +var _0xdca6=['timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isIVRCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','replace','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','tags','undefined','XMD-','toUpperCase','substring','lodash','util','dialer','../../../../config/environment/shared'];(function(_0x39a7b3,_0x9c5210){var _0x1e25e2=function(_0x530d86){while(--_0x530d86){_0x39a7b3['push'](_0x39a7b3['shift']());}};_0x1e25e2(++_0x9c5210);}(_0xdca6,0x1e8));var _0x6dca=function(_0x505a5c,_0x2dd55b){_0x505a5c=_0x505a5c-0x0;var _0x520802=_0xdca6[_0x505a5c];return _0x520802;};'use strict';var _=require(_0x6dca('0x0'));var moment=require('moment');var util=require(_0x6dca('0x1'));var logger=require('../../../../config/logger')(_0x6dca('0x2'));var timezones=require(_0x6dca('0x3'))[_0x6dca('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x6dca('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x6dca('0x6'),'DEACTIVATED':_0x6dca('0x7'),'DISACTIVED':_0x6dca('0x8'),'EMPTY_INTERVAL':_0x6dca('0x9'),'INACTIVE':_0x6dca('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x6dca('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x6dca('0xc'),'RUNNING':_0x6dca('0xd'),'UNKNOWN_TIMEZONE':_0x6dca('0xe'),'UNREACHABLE_TRUNK':_0x6dca('0xf')};exports[_0x6dca('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3554cf){return _0x3554cf[_0x6dca('0x11')]===_0x6dca('0x12');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x3b7e78){return _0x3b7e78['type']==='ivr';}exports[_0x6dca('0x13')]=isIVRCampaign;function isOutboundQueue(_0x145ab2){return _0x145ab2[_0x6dca('0x14')]==='outbound';}exports[_0x6dca('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x387fa1){return _0x387fa1[_0x6dca('0x16')];}exports[_0x6dca('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x108964){return _0x108964[_0x6dca('0x18')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x4ba434,_0xa384ae){var _0x14d77b=moment(_0x4ba434)[_0x6dca('0x19')](0x0);var _0x4a5faa=moment(_0xa384ae)[_0x6dca('0x19')](0x0);return _0x14d77b[_0x6dca('0x1a')](_0x4a5faa,_0x6dca('0x1b'));}exports[_0x6dca('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x27d13f,_0xcb3d89){var _0x226176=![];var _0x5850d9=_0x27d13f['dialMethod']!==_0xcb3d89[_0x6dca('0x11')]||_0x27d13f[_0x6dca('0x16')]!==_0xcb3d89[_0x6dca('0x16')]||_0x27d13f[_0x6dca('0x1d')]!==_0xcb3d89[_0x6dca('0x1d')];var _0x30e7dc=_0x27d13f['available']!==_0xcb3d89[_0x6dca('0x1e')]||_0x27d13f[_0x6dca('0x1f')]!==_0xcb3d89[_0x6dca('0x1f')]||_0x27d13f[_0x6dca('0x20')]!==_0xcb3d89[_0x6dca('0x20')]||_0x27d13f['paused']!==_0xcb3d89['paused']||_0x27d13f[_0x6dca('0x21')]!==_0xcb3d89[_0x6dca('0x21')]||_0x27d13f[_0x6dca('0x22')]!==_0xcb3d89[_0x6dca('0x22')]||_0x27d13f[_0x6dca('0x23')]!==_0xcb3d89[_0x6dca('0x23')]||_0x27d13f[_0x6dca('0x24')]!==_0xcb3d89[_0x6dca('0x24')]||_0x27d13f[_0x6dca('0x25')]!==_0xcb3d89[_0x6dca('0x25')];if(_0x27d13f[_0x6dca('0x26')]&&_0xcb3d89[_0x6dca('0x26')]){_0x226176=_0x27d13f[_0x6dca('0x26')][_0x6dca('0x27')]!==_0xcb3d89[_0x6dca('0x26')][_0x6dca('0x27')]||_0x27d13f[_0x6dca('0x26')][_0x6dca('0x18')]!==_0xcb3d89['Trunk'][_0x6dca('0x18')];}return _0x5850d9||_0x30e7dc||_0x226176;}exports[_0x6dca('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2acb75){var _0x59eda2=null;var _0x10b516=_0x2acb75[_0x6dca('0x29')];if(_['isNil'](_0x2acb75[_0x6dca('0x2a')])||_[_0x6dca('0x2b')](_0x2acb75[_0x6dca('0x2c')])||_[_0x6dca('0x2b')](_0x2acb75['Interval'][_0x6dca('0x2d')])){_0x59eda2=CAMPAIGN_STATUS[_0x6dca('0x2e')];}else if(_[_0x6dca('0x2f')](_0x2acb75[_0x6dca('0x2a')])||_[_0x6dca('0x2f')](_0x2acb75['Interval'][_0x6dca('0x2d')])){_0x59eda2=CAMPAIGN_STATUS[_0x6dca('0x30')];}else if(_0x10b516&&!timezones[_0x10b516]){_0x59eda2=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x59eda2;}function checkAnyValidTrunk(_0x5b8d62,_0x1bc091){var _0x3722d8=null;var _0x31c7e6=_0x6dca('0x31');var _0x351cf2=[_0x6dca('0x32'),_0x6dca('0x33')];var _0x29ff6d=!![];if(_0x5b8d62[_0x6dca('0x26')]&&_0x5b8d62[_0x6dca('0x26')][_0x6dca('0x18')]){_0x31c7e6+=_0x5b8d62[_0x6dca('0x26')]['name'];_0x3722d8=_0x1bc091[_0x31c7e6];_0x29ff6d=_0x351cf2['includes'](_0x3722d8[_0x6dca('0x34')]);}else if(_0x5b8d62[_0x6dca('0x35')]&&_0x5b8d62[_0x6dca('0x35')][_0x6dca('0x18')]){_0x31c7e6+=_0x5b8d62['TrunkBackup'][_0x6dca('0x27')];_0x3722d8=_0x1bc091[_0x31c7e6];_0x29ff6d=_0x351cf2[_0x6dca('0x36')](_0x3722d8[_0x6dca('0x34')]);}return _0x29ff6d;}function getQueueCampaignStatusMessage(_0x2b7b20,_0x377d37){var _0x58d988=CAMPAIGN_STATUS[_0x6dca('0x5')];var _0x321d0e=isPreviewCampaign(_0x2b7b20);if(!isQueueCampaignActive(_0x2b7b20)){if(_0x321d0e){_0x58d988=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2b7b20[_0x6dca('0x25')]===0x0&&_0x2b7b20[_0x6dca('0x21')]===0x0&&_0x2b7b20[_0x6dca('0x23')]===0x0&&(_0x2b7b20[_0x6dca('0x22')]||0x0)===0x0){_0x58d988=CAMPAIGN_STATUS[_0x6dca('0x37')];}else{_0x58d988=CAMPAIGN_STATUS[_0x6dca('0x38')];}}}else if(_0x2b7b20['loggedIn']===0x0){_0x58d988=CAMPAIGN_STATUS[_0x6dca('0x39')];}else if(!checkAnyValidTrunk(_0x2b7b20,_0x377d37)){_0x58d988=CAMPAIGN_STATUS[_0x6dca('0x3a')];}else if(!isPreviewCampaign(_0x2b7b20)){var _0x414020=checkAnyValidQueueCampaignInterval(_0x2b7b20);if(_0x414020){_0x58d988=_0x414020;}}return _0x58d988;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x238d3c){var _0x4b3bcb=CAMPAIGN_STATUS['DISACTIVED'];if(_0x238d3c[_0x6dca('0x25')]===0x0&&_0x238d3c[_0x6dca('0x21')]===0x0&&_0x238d3c[_0x6dca('0x23')]===0x0&&(_0x238d3c[_0x6dca('0x22')]||0x0)===0x0){_0x4b3bcb=CAMPAIGN_STATUS[_0x6dca('0x37')];}return _0x4b3bcb;}exports[_0x6dca('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1aa269){var _0x5093e7=_0x1aa269[_0x6dca('0x3c')](/"(.*?)"/);return _0x5093e7?_0x5093e7[0x1]:_0x1aa269;}exports[_0x6dca('0x3d')]=extractCalleridName;function getCallerId(_0x4d4bef,_0x3d38a4,_0x1b6818){if(!_[_0x6dca('0x3e')](_0x1b6818)&&typeof _0x1b6818===_0x6dca('0x3f')&&!_[_0x6dca('0x2f')](_0x1b6818)){if(!_[_0x6dca('0x3e')](_0x3d38a4)&&typeof _0x3d38a4===_0x6dca('0x3f')&&!_[_0x6dca('0x2f')](_0x3d38a4)){return util[_0x6dca('0x40')]('\x22%s\x22\x20<%s>',_0x3d38a4,_0x1b6818);}return util[_0x6dca('0x40')](_0x6dca('0x41'),_0x1b6818,_0x1b6818);}if(!_['isUndefined'](_0x4d4bef)&&typeof _0x4d4bef===_0x6dca('0x3f')&&!_[_0x6dca('0x2f')](_0x4d4bef)){return _0x4d4bef;}return _0x6dca('0x42');}exports[_0x6dca('0x43')]=getCallerId;function getCallerIdRandom(_0x2effa5,_0x3821d5){var _0x3d8ce9;var _0x1c64b2;var _0x28f264;if(_0x3821d5<=0x0){_0x3821d5=0x1;}_0x3d8ce9=new RegExp(_0x6dca('0x44')+_0x3821d5+'}$');_0x1c64b2=Math['pow'](0xa,_0x3821d5-0x1);_0x28f264=Math['pow'](0xa,_0x3821d5)-0x1;return util['format']('%s',_[_0x6dca('0x45')](_0x2effa5,_0x3d8ce9,_['random'](_0x1c64b2,_0x28f264)[_0x6dca('0x46')]()));}exports[_0x6dca('0x47')]=getCallerIdRandom;function decrementOriginate(_0x3525b5){if(_0x3525b5[_0x6dca('0x25')]&&_0x3525b5[_0x6dca('0x25')]>0x0){_0x3525b5['originated']-=0x1;}else{logger['error'](_0x6dca('0x48'));}}exports[_0x6dca('0x49')]=decrementOriginate;function checkContactEmpty(_0x287708){return _0x287708&&_0x287708[_0x6dca('0x4a')]>0x0;}exports[_0x6dca('0x4b')]=checkContactEmpty;function erlangb(_0x2f1794,_0x30ae3b){if(_0x30ae3b===0x0){return 0x0;}var _0x6854f0=0x1;for(var _0x2fa4ce=0x1;_0x2fa4ce<=_0x30ae3b;_0x2fa4ce+=0x1){_0x6854f0=0x1+_0x6854f0*_0x2fa4ce/_0x2f1794;}return 0x1/_0x6854f0;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x1ee03d,_0x4d9946,_0x547603){if(_0x4d9946>_0x547603){for(var _0x1ac223=0x0;_0x1ac223<_0x4d9946-_0x547603;_0x1ac223+=0x1){decrementOriginate(_0x1ee03d);}}}exports[_0x6dca('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2188e5){var _0x18ef31={};var _0x1ac5c1=['id','createdAt',_0x6dca('0x4d'),'updatedAt'];const _0x3c0e67=0xfa;if(_0x2188e5){for(var _0x456154 in _0x2188e5){if(typeof _0x2188e5[_0x456154]!==_0x6dca('0x4e')){if(!_[_0x6dca('0x2b')](_0x2188e5[_0x456154])&&!_0x1ac5c1[_0x6dca('0x36')](_0x456154)){if(_0x456154==='description'&&_0x2188e5[_0x456154][_0x6dca('0x4a')]>_0x3c0e67){_0x18ef31[_0x6dca('0x4f')+_0x456154[_0x6dca('0x50')]()]=_0x2188e5[_0x456154][_0x6dca('0x46')]()[_0x6dca('0x51')](0x0,_0x3c0e67);}else{_0x18ef31[_0x6dca('0x4f')+_0x456154['toUpperCase']()]=_0x2188e5[_0x456154];}}}}}return _0x18ef31;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index cef6335..e63214a 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(_0x3c53b5,_0x4cc9c0){var _0x59a507=function(_0x857f88){while(--_0x857f88){_0x3c53b5['push'](_0x3c53b5['shift']());}};_0x59a507(++_0x4cc9c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x2fff34,_0x5c4ebd){var _0xb4edb=function(_0x464f92){while(--_0x464f92){_0x2fff34['push'](_0x2fff34['shift']());}};_0xb4edb(++_0x5c4ebd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 25c1b8b..14fb2d1 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 _0x6df5=['dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','then','notify','error','catch','\x20receiveFax\x20','stringify','syncOriginateResponse','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','path','%s/%s.tif'];(function(_0x3e22ec,_0x59e837){var _0x21669d=function(_0x46bd06){while(--_0x46bd06){_0x3e22ec['push'](_0x3e22ec['shift']());}};_0x21669d(++_0x59e837);}(_0x6df5,0x1e9));var _0x56df=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x6df5[_0xd158dc];return _0x12d25f;};'use strict';var util=require(_0x56df('0x0'));var _=require(_0x56df('0x1'));var BPromise=require(_0x56df('0x2'));var uuid=require(_0x56df('0x3'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x56df('0x4'));var gs=require(_0x56df('0x5'));var logger=require(_0x56df('0x6'))(_0x56df('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x56df('0x8'));var Action=require(_0x56df('0x9'));var faxAccount=require(_0x56df('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x56df('0xb'));function Fax(_0x364669){this[_0x56df('0xc')]={};this[_0x56df('0xd')]=_0x364669[_0x56df('0xd')];this['trunks']=_0x364669[_0x56df('0xe')];this[_0x56df('0xf')]={};ami['on']('newchannel',this[_0x56df('0x10')][_0x56df('0x11')](this));ami['on'](_0x56df('0x12'),this[_0x56df('0x13')][_0x56df('0x11')](this));ami['on'](_0x56df('0x14'),this[_0x56df('0x15')][_0x56df('0x11')](this));ami['on'](_0x56df('0x16'),this[_0x56df('0x17')][_0x56df('0x11')](this));ami['on'](_0x56df('0x18'),this['syncFaxStatus'][_0x56df('0x11')](this));ami['on']('receivefax',this[_0x56df('0x19')][_0x56df('0x11')](this));ami['on'](_0x56df('0x1a'),this[_0x56df('0x1b')]['bind'](this));ami['on'](_0x56df('0x1c'),this['syncOriginateResponse'][_0x56df('0x11')](this));}Fax[_0x56df('0x1d')]['syncNewchannel']=function(_0x20e396){if(_0x20e396[_0x56df('0x1e')]===_0x56df('0x1f')){for(var _0x17c43d in this[_0x56df('0xd')]){if(this['faxAccounts'][_0x56df('0x20')](_0x17c43d)){if(_0x20e396['exten']===this[_0x56df('0xd')][_0x17c43d][_0x56df('0x21')]){this[_0x56df('0xc')][_0x20e396[_0x56df('0x22')]]={};this[_0x56df('0xc')][_0x20e396['uniqueid']]['channel']=_0x20e396[_0x56df('0x23')];this['channels'][_0x20e396['uniqueid']]['id']=this[_0x56df('0xd')][_0x17c43d]['id'];this[_0x56df('0xc')][_0x20e396[_0x56df('0x22')]][_0x56df('0x24')]=this[_0x56df('0xd')][_0x17c43d][_0x56df('0x24')];logger[_0x56df('0x25')](_0x20e396[_0x56df('0x22')],_0x56df('0x26'));}}}}if(this[_0x56df('0xf')][_0x20e396[_0x56df('0x22')]]){this[_0x56df('0xc')][_0x20e396['uniqueid']]={};this[_0x56df('0xc')][_0x20e396[_0x56df('0x22')]][_0x56df('0x23')]=_0x20e396[_0x56df('0x23')];logger['info'](_0x20e396[_0x56df('0x22')],_0x56df('0x26'));}};Fax[_0x56df('0x1d')][_0x56df('0x13')]=function(_0x58dcf6){if(this[_0x56df('0xc')][_0x58dcf6[_0x56df('0x22')]]){for(var _0x337878 in _0x58dcf6[_0x56df('0x27')]){if(_0x58dcf6[_0x56df('0x27')][_0x56df('0x20')](_0x337878)){this[_0x56df('0xc')][_0x58dcf6[_0x56df('0x22')]][_0x337878]=_0x58dcf6[_0x56df('0x28')];}}}};Fax[_0x56df('0x1d')][_0x56df('0x15')]=function(_0x280a5b){if(this['channels'][_0x280a5b[_0x56df('0x22')]]){this['channels'][_0x280a5b[_0x56df('0x22')]][_0x56df('0x29')]=_0x280a5b[_0x56df('0x29')];this[_0x56df('0xc')][_0x280a5b['uniqueid']][_0x56df('0x2a')]=_0x280a5b[_0x56df('0x2a')];}};Fax[_0x56df('0x1d')][_0x56df('0x17')]=function(_0x52c421){if(this[_0x56df('0xc')][_0x52c421[_0x56df('0x22')]]){for(var _0x1e2622 in _0x52c421[_0x56df('0x27')]){if(_0x52c421[_0x56df('0x27')][_0x56df('0x20')](_0x1e2622)){this[_0x56df('0xc')][_0x52c421[_0x56df('0x22')]][_0x1e2622]=_0x52c421[_0x56df('0x28')];}}}};Fax['prototype'][_0x56df('0x2b')]=function(_0x310c60){if(this[_0x56df('0xc')][_0x310c60[_0x56df('0x22')]]){this[_0x56df('0xc')][_0x310c60[_0x56df('0x22')]][_0x56df('0x2c')]=_0x310c60[_0x56df('0x2c')];this[_0x56df('0xc')][_0x310c60[_0x56df('0x22')]][_0x56df('0x2d')]=_0x310c60['status'];this[_0x56df('0xc')][_0x310c60[_0x56df('0x22')]][_0x56df('0x21')]=_0x310c60['localstationid'];this[_0x56df('0xc')][_0x310c60[_0x56df('0x22')]][_0x56df('0x2e')]=_0x310c60[_0x56df('0x2e')];logger[_0x56df('0x25')](_0x310c60[_0x56df('0x22')],_0x56df('0x2f'));}};Fax[_0x56df('0x1d')][_0x56df('0x19')]=function(_0x5e160f){var _0x2a612c=this;if(this['channels'][_0x5e160f[_0x56df('0x22')]]){var _0x2cc8c1=this[_0x56df('0xc')][_0x5e160f[_0x56df('0x22')]]['id'];this[_0x56df('0xc')][_0x5e160f[_0x56df('0x22')]][_0x56df('0x30')]=_0x5e160f['remotestationid'];this[_0x56df('0xc')][_0x5e160f['uniqueid']][_0x56df('0x31')]=_0x5e160f[_0x56df('0x31')];this[_0x56df('0xc')][_0x5e160f[_0x56df('0x22')]][_0x56df('0x21')]=_0x5e160f[_0x56df('0x21')];this[_0x56df('0xc')][_0x5e160f['uniqueid']][_0x56df('0x32')]=_0x5e160f[_0x56df('0x32')];this[_0x56df('0xc')][_0x5e160f[_0x56df('0x22')]][_0x56df('0x33')]=_0x5e160f['transferrate'];this[_0x56df('0xc')][_0x5e160f[_0x56df('0x22')]][_0x56df('0x2e')]=_0x5e160f[_0x56df('0x2e')];this[_0x56df('0xc')][_0x5e160f[_0x56df('0x22')]]['calleridnum']=_0x5e160f[_0x56df('0x34')];if(this['channels'][_0x5e160f['uniqueid']][_0x56df('0x31')]>0x0){tiff2pdf(_0x5e160f[_0x56df('0x2e')],_0x56df('0x35'),function(_0x3034c4){logger[_0x56df('0x25')](_0x5e160f['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x3034c4[_0x56df('0x36')]);attachment[_0x56df('0x37')]({'name':path[_0x56df('0x38')](_0x5e160f[_0x56df('0x2e')])['name'],'basename':path['parse'](_0x5e160f['filename'])[_0x56df('0x24')]+_0x56df('0x39'),'type':'application/pdf'})[_0x56df('0x3a')](function(_0x1ad608){faxAccount[_0x56df('0x3b')](_0x2cc8c1,{'from':_0x5e160f['calleridnum'],'mapKey':'fax','body':path[_0x56df('0x38')](_0x5e160f[_0x56df('0x2e')])[_0x56df('0x24')]+_0x56df('0x39'),'AttachmentId':_0x1ad608['id']})['catch'](function(_0x350d34){logger[_0x56df('0x3c')](_0x5e160f[_0x56df('0x22')],'\x20notify\x20',JSON['stringify'](_0x350d34));});})[_0x56df('0x3d')](function(_0x21a3c8){logger[_0x56df('0x3c')](_0x5e160f['uniqueid'],_0x56df('0x3e'),JSON[_0x56df('0x3f')](_0x21a3c8));});});}logger[_0x56df('0x25')](_0x5e160f[_0x56df('0x22')],_0x56df('0x3e'));}};Fax[_0x56df('0x1d')][_0x56df('0x40')]=function(_0x33c5bd){if(this[_0x56df('0xf')][_0x33c5bd[_0x56df('0x22')]]){_[_0x56df('0x41')](this[_0x56df('0xc')][_0x33c5bd[_0x56df('0x22')]],_[_0x56df('0x42')](_0x33c5bd,['response',_0x56df('0x43')]));}};function updateStatus(_0x1af62e){if(_0x1af62e[_0x56df('0x44')]){faxMessage[_0x56df('0x45')](_0x1af62e[_0x56df('0x44')],{'failMessage':_0x56df('0x46')})[_0x56df('0x3a')](function(_0xd65645){ut[_0x56df('0x47')](_0x56df('0x48'),_0xd65645);})[_0x56df('0x3d')](function(_0xe7040b){ut[_0x56df('0x47')]('[Fax][Message][Error][NoUpdate1]',_0xe7040b);});}else{ut[_0x56df('0x47')](_0x56df('0x49'));}}Fax['prototype'][_0x56df('0x4a')]=function(_0x30935f,_0x475af5,_0x3aee6a){var _0x4a365d=this;var _0x534b9a={};if(_0x475af5){_0x534b9a={'read':_0x475af5};}else{_0x534b9a={'failMessage':_0x3aee6a};}if(this[_0x56df('0xf')][_0x30935f]['AttachmentId']){faxMessage['update'](this['actions'][_0x30935f][_0x56df('0x44')],_0x534b9a)['then'](function(_0x1f9e27){ut[_0x56df('0x47')](_0x56df('0x4b'),_0x1f9e27);})[_0x56df('0x3d')](function(_0x389157){ut[_0x56df('0x47')]('[Fax][Message][NoUpdate1]',_0x389157);})['finally'](function(){delete _0x4a365d[_0x56df('0xc')][_0x30935f];delete _0x4a365d[_0x56df('0xf')][_0x30935f];});}else{ut[_0x56df('0x47')](_0x56df('0x4c'));delete this[_0x56df('0xc')][_0x30935f];delete this['actions'][_0x30935f];}};Fax[_0x56df('0x1d')]['syncHangup']=function(_0x103b9a){var _0x1a7bcc=this;if(this[_0x56df('0xc')][_0x103b9a['uniqueid']]){if(this[_0x56df('0xf')][_0x103b9a[_0x56df('0x22')]]){this[_0x56df('0xc')][_0x103b9a['uniqueid']]['id']=this[_0x56df('0xf')][_0x103b9a[_0x56df('0x22')]]['id'];this[_0x56df('0xc')][_0x103b9a[_0x56df('0x22')]][_0x56df('0x24')]=this[_0x56df('0xf')][_0x103b9a[_0x56df('0x22')]][_0x56df('0x24')];}logger['info'](_0x103b9a[_0x56df('0x22')],this[_0x56df('0xf')][_0x103b9a[_0x56df('0x22')]]?_0x56df('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this['channels'][_0x103b9a[_0x56df('0x22')]]));if(this[_0x56df('0xf')][_0x103b9a['uniqueid']]){if(this[_0x56df('0xc')][_0x103b9a[_0x56df('0x22')]][_0x56df('0x4e')]>0x0&&this['channels'][_0x103b9a[_0x56df('0x22')]][_0x56df('0x18')]===_0x56df('0x4f')){this['updateStatus'](_0x103b9a[_0x56df('0x22')],!![]);}else{this[_0x56df('0x4a')](_0x103b9a['uniqueid'],![],this[_0x56df('0xc')][_0x103b9a['uniqueid']][_0x56df('0x50')]?_0x56df('0x51')+this['channels'][_0x103b9a[_0x56df('0x22')]][_0x56df('0x50')]:_0x56df('0x52'));}}}};Fax[_0x56df('0x1d')][_0x56df('0x53')]=function(_0x13019d){var _0x241990=this;return new BPromise(function(_0x170e24,_0x10fe39){_0x241990['execOriginate'](_0x13019d,_0x241990[_0x56df('0xd')][_0x13019d[_0x56df('0x54')]])[_0x56df('0x3a')](function(_0x355b4b){ut[_0x56df('0x47')]('[Fax][execOriginate][success]',_0x355b4b);_0x170e24(ut[_0x56df('0x36')](_0x56df('0x55')));})[_0x56df('0x3d')](function(_0x2a8d7a){ut[_0x56df('0x47')](_0x56df('0x56'),_0x2a8d7a);updateStatus(_0x13019d);_0x10fe39(ut[_0x56df('0x36')](_0x56df('0x57')));});});};Fax['prototype'][_0x56df('0x58')]=function(_0x5ef020){var _0x481bdc=this;return new BPromise(function(_0x5e7861,_0x5766b8){var _0x23ff3c=_0x481bdc[_0x56df('0x59')](_0x481bdc[_0x56df('0xd')][_0x5ef020[_0x56df('0x54')]][_0x56df('0x5a')],_0x5ef020);if(_0x23ff3c[_0x56df('0x5b')]){_0x5e7861(ut['message'](_0x56df('0x5c')));}else{_0x5766b8(ut['message'](_0x23ff3c[_0x56df('0x36')]));}});};function originate(_0x195ca2,_0x131293,_0x16df76){return new BPromise(function(_0x1fe7b6,_0x30645d){if(_0x16df76){var _0x5e0c23=util[_0x56df('0x5d')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x56df('0x38')](_0x195ca2[_0x56df('0x5e')])[_0x56df('0x24')],_0x195ca2['path']);gs['execute'](_0x5e0c23)[_0x56df('0x3a')](function(){_0x195ca2[_0x56df('0x5e')]=util[_0x56df('0x5d')](_0x56df('0x5f'),path[_0x56df('0x38')](_0x195ca2['path'])[_0x56df('0x60')],path['parse'](_0x195ca2['path'])[_0x56df('0x24')]);_0x131293[_0x56df('0x61')]=_0x195ca2['path'];ut[_0x56df('0x47')](_0x56df('0x62'),'');ami[_0x56df('0x63')](ut['variablesAction'](_0x195ca2,_0x131293))[_0x56df('0x3a')](function(_0x14882c){_0x1fe7b6(_0x14882c);})[_0x56df('0x3d')](function(_0x5e39cf){_0x30645d(_0x5e39cf);});})[_0x56df('0x3d')](function(_0x2af76d){_0x30645d(_0x2af76d);});}else{ami['Action'](ut[_0x56df('0x64')](_0x195ca2,_0x131293))['then'](function(_0xdc6800){_0x1fe7b6(_0xdc6800);})[_0x56df('0x3d')](function(_0x3c349b){_0x30645d(_0x3c349b);});}});}Fax[_0x56df('0x1d')][_0x56df('0x65')]=function(_0x471091,_0x5df8e0){var _0xfd1420=this;return new BPromise(function(_0x586047,_0x2cc02b){var _0x562f3a=uuid['v4']();var _0x223f7c=ut[_0x56df('0x66')](_0x471091,_0x5df8e0);_0xfd1420[_0x56df('0xf')][_0x562f3a]=new Action(_0x562f3a,_0x5df8e0,_0x471091);var _0x111b45=_0xfd1420['actions'][_0x562f3a];if(path[_0x56df('0x38')](_0x471091[_0x56df('0x5e')])['ext']==='.pdf'){originate(_0x111b45,_0x223f7c,!![])[_0x56df('0x3a')](function(_0x204fe3){_0x586047(_0x204fe3);})[_0x56df('0x3d')](function(_0x1636ae){_0x2cc02b(_0x1636ae);});}else{originate(_0x111b45,_0x223f7c,![])[_0x56df('0x3a')](function(_0x1095f3){_0x586047(_0x1095f3);})['catch'](function(_0x2f7fda){_0x2cc02b(_0x2f7fda);});}});};Fax[_0x56df('0x1d')]['isTrunkReachable']=function(_0x3d10c5){return!_[_0x56df('0x67')](_0x3d10c5)&&!_[_0x56df('0x67')](_0x3d10c5[_0x56df('0x24')])&&!_[_0x56df('0x67')](_0x3d10c5[_0x56df('0x68')])&&_0x3d10c5[_0x56df('0x68')]&&!_[_0x56df('0x67')](this[_0x56df('0xe')][util[_0x56df('0x5d')](_0x56df('0x69'),_0x3d10c5[_0x56df('0x24')])])&&!_[_0x56df('0x67')](this['trunks'][util[_0x56df('0x5d')](_0x56df('0x69'),_0x3d10c5[_0x56df('0x24')])][_0x56df('0x2d')])&&(this[_0x56df('0xe')][util[_0x56df('0x5d')]('SIP/%s',_0x3d10c5[_0x56df('0x24')])]['status']===_0x56df('0x6a')||this[_0x56df('0xe')][util[_0x56df('0x5d')](_0x56df('0x69'),_0x3d10c5[_0x56df('0x24')])][_0x56df('0x2d')]===_0x56df('0x6b'));};Fax['prototype']['checkTrunk']=function(_0x30f9cd,_0x2f3f15){if(!this[_0x56df('0x6c')](_0x30f9cd)){ut[_0x56df('0x47')](_0x56df('0x6d'),_['isNil'](_0x30f9cd)?'':_0x30f9cd[_0x56df('0x24')]+_0x56df('0x6e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x56df('0x67')](_0x2f3f15['fax'])){ut['logger'](_0x56df('0x6f'),JSON[_0x56df('0x3f')](_0x2f3f15));return{'isValid':![],'message':_0x56df('0x70')};}if(_[_0x56df('0x67')](_0x2f3f15[_0x56df('0x5e')])){ut[_0x56df('0x47')](_0x56df('0x71'),JSON[_0x56df('0x3f')](_0x2f3f15));return{'isValid':![],'message':_0x56df('0x72')};}return{'isValid':!![],'message':_0x56df('0x73')};};module[_0x56df('0x74')]=Fax; \ No newline at end of file +var _0x4b62=['dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','SIP/%s','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','actions','merge','pick','response','AttachmentId','update','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif'];(function(_0x5e7b49,_0x12e924){var _0x1af593=function(_0x435cea){while(--_0x435cea){_0x5e7b49['push'](_0x5e7b49['shift']());}};_0x1af593(++_0x12e924);}(_0x4b62,0x86));var _0x24b6=function(_0x2318ec,_0x3d0924){_0x2318ec=_0x2318ec-0x0;var _0x144336=_0x4b62[_0x2318ec];return _0x144336;};'use strict';var util=require(_0x24b6('0x0'));var _=require('lodash');var BPromise=require(_0x24b6('0x1'));var uuid=require(_0x24b6('0x2'));var moment=require(_0x24b6('0x3'));var path=require('path');var tiff2pdf=require(_0x24b6('0x4'));var gs=require(_0x24b6('0x5'));var logger=require(_0x24b6('0x6'))(_0x24b6('0x7'));var ami=require(_0x24b6('0x8'));var rpcDb=require(_0x24b6('0x9'));var Channel=require(_0x24b6('0xa'));var ut=require('./util/util');var Action=require(_0x24b6('0xb'));var faxAccount=require(_0x24b6('0xc'));var attachment=require(_0x24b6('0xd'));var faxMessage=require(_0x24b6('0xe'));function Fax(_0x6cc155){this[_0x24b6('0xf')]={};this[_0x24b6('0x10')]=_0x6cc155['faxAccounts'];this[_0x24b6('0x11')]=_0x6cc155[_0x24b6('0x11')];this['actions']={};ami['on']('newchannel',this[_0x24b6('0x12')][_0x24b6('0x13')](this));ami['on']('varset',this[_0x24b6('0x14')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x15'),this['syncNewState'][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x16'),this[_0x24b6('0x17')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x18'),this[_0x24b6('0x19')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x1a'),this[_0x24b6('0x1b')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x1c'),this[_0x24b6('0x1d')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x1e'),this['syncOriginateResponse'][_0x24b6('0x13')](this));}Fax[_0x24b6('0x1f')]['syncNewchannel']=function(_0x160826){if(_0x160826[_0x24b6('0x20')]===_0x24b6('0x21')){for(var _0x78739a in this['faxAccounts']){if(this[_0x24b6('0x10')][_0x24b6('0x22')](_0x78739a)){if(_0x160826[_0x24b6('0x23')]===this[_0x24b6('0x10')][_0x78739a][_0x24b6('0x24')]){this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]]={};this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]][_0x24b6('0x26')]=_0x160826[_0x24b6('0x26')];this['channels'][_0x160826['uniqueid']]['id']=this[_0x24b6('0x10')][_0x78739a]['id'];this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]][_0x24b6('0x27')]=this[_0x24b6('0x10')][_0x78739a][_0x24b6('0x27')];logger[_0x24b6('0x28')](_0x160826['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x160826[_0x24b6('0x25')]]){this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]]={};this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]]['channel']=_0x160826['channel'];logger[_0x24b6('0x28')](_0x160826[_0x24b6('0x25')],'\x20syncNewchannel\x20');}};Fax[_0x24b6('0x1f')]['syncVarSet']=function(_0x8ccb84){if(this[_0x24b6('0xf')][_0x8ccb84[_0x24b6('0x25')]]){for(var _0x350f69 in _0x8ccb84['variable']){if(_0x8ccb84[_0x24b6('0x29')][_0x24b6('0x22')](_0x350f69)){this[_0x24b6('0xf')][_0x8ccb84[_0x24b6('0x25')]][_0x350f69]=_0x8ccb84[_0x24b6('0x2a')];}}}};Fax['prototype'][_0x24b6('0x2b')]=function(_0x22b055){if(this[_0x24b6('0xf')][_0x22b055[_0x24b6('0x25')]]){this['channels'][_0x22b055[_0x24b6('0x25')]][_0x24b6('0x2c')]=_0x22b055[_0x24b6('0x2c')];this[_0x24b6('0xf')][_0x22b055[_0x24b6('0x25')]][_0x24b6('0x2d')]=_0x22b055[_0x24b6('0x2d')];}};Fax['prototype'][_0x24b6('0x17')]=function(_0x3f4e24){if(this[_0x24b6('0xf')][_0x3f4e24[_0x24b6('0x25')]]){for(var _0x287143 in _0x3f4e24[_0x24b6('0x29')]){if(_0x3f4e24[_0x24b6('0x29')][_0x24b6('0x22')](_0x287143)){this[_0x24b6('0xf')][_0x3f4e24[_0x24b6('0x25')]][_0x287143]=_0x3f4e24['value'];}}}};Fax[_0x24b6('0x1f')][_0x24b6('0x19')]=function(_0x103636){if(this[_0x24b6('0xf')][_0x103636[_0x24b6('0x25')]]){this['channels'][_0x103636['uniqueid']][_0x24b6('0x2e')]=_0x103636['operation'];this[_0x24b6('0xf')][_0x103636[_0x24b6('0x25')]][_0x24b6('0x2f')]=_0x103636[_0x24b6('0x2f')];this[_0x24b6('0xf')][_0x103636[_0x24b6('0x25')]]['localstationid']=_0x103636['localstationid'];this[_0x24b6('0xf')][_0x103636[_0x24b6('0x25')]][_0x24b6('0x30')]=_0x103636[_0x24b6('0x30')];logger[_0x24b6('0x28')](_0x103636[_0x24b6('0x25')],_0x24b6('0x31'));}};Fax[_0x24b6('0x1f')]['syncReceiveFax']=function(_0x40dd94){var _0x42ebfb=this;if(this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]]){var _0x296fe3=this['channels'][_0x40dd94[_0x24b6('0x25')]]['id'];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x32')]=_0x40dd94[_0x24b6('0x32')];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x33')]=_0x40dd94[_0x24b6('0x33')];this['channels'][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x24')]=_0x40dd94[_0x24b6('0x24')];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]]['resolution']=_0x40dd94[_0x24b6('0x34')];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]]['transferrate']=_0x40dd94['transferrate'];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x30')]=_0x40dd94[_0x24b6('0x30')];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x35')]=_0x40dd94[_0x24b6('0x35')];if(this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x40dd94[_0x24b6('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x4e4273){logger[_0x24b6('0x28')](_0x40dd94[_0x24b6('0x25')],_0x24b6('0x36'),_0x4e4273['message']);attachment['create']({'name':path[_0x24b6('0x37')](_0x40dd94['filename'])[_0x24b6('0x27')],'basename':path[_0x24b6('0x37')](_0x40dd94[_0x24b6('0x30')])['name']+_0x24b6('0x38'),'type':_0x24b6('0x39')})[_0x24b6('0x3a')](function(_0xcd1029){faxAccount[_0x24b6('0x3b')](_0x296fe3,{'from':_0x40dd94[_0x24b6('0x35')],'mapKey':_0x24b6('0x7'),'body':path['parse'](_0x40dd94['filename'])[_0x24b6('0x27')]+_0x24b6('0x38'),'AttachmentId':_0xcd1029['id']})['catch'](function(_0x401850){logger[_0x24b6('0x3c')](_0x40dd94['uniqueid'],_0x24b6('0x3d'),JSON[_0x24b6('0x3e')](_0x401850));});})[_0x24b6('0x3f')](function(_0x37f5fc){logger[_0x24b6('0x3c')](_0x40dd94['uniqueid'],_0x24b6('0x40'),JSON['stringify'](_0x37f5fc));});});}logger[_0x24b6('0x28')](_0x40dd94[_0x24b6('0x25')],_0x24b6('0x40'));}};Fax['prototype']['syncOriginateResponse']=function(_0x750b79){if(this[_0x24b6('0x41')][_0x750b79[_0x24b6('0x25')]]){_[_0x24b6('0x42')](this['channels'][_0x750b79[_0x24b6('0x25')]],_[_0x24b6('0x43')](_0x750b79,[_0x24b6('0x44'),'reason']));}};function updateStatus(_0x13e959){if(_0x13e959[_0x24b6('0x45')]){faxMessage[_0x24b6('0x46')](_0x13e959[_0x24b6('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x24b6('0x3a')](function(_0x40ce36){ut['logger'](_0x24b6('0x47'),_0x40ce36);})[_0x24b6('0x3f')](function(_0x7b8d9a){ut[_0x24b6('0x48')](_0x24b6('0x49'),_0x7b8d9a);});}else{ut[_0x24b6('0x48')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x24b6('0x1f')][_0x24b6('0x4a')]=function(_0x28d562,_0x40989f,_0x2c09f3){var _0x56fc44=this;var _0x21219d={};if(_0x40989f){_0x21219d={'read':_0x40989f};}else{_0x21219d={'failMessage':_0x2c09f3};}if(this[_0x24b6('0x41')][_0x28d562][_0x24b6('0x45')]){faxMessage[_0x24b6('0x46')](this[_0x24b6('0x41')][_0x28d562][_0x24b6('0x45')],_0x21219d)[_0x24b6('0x3a')](function(_0x1af47e){ut[_0x24b6('0x48')]('[Fax][Message][Updated]',_0x1af47e);})[_0x24b6('0x3f')](function(_0x261bb0){ut['logger'](_0x24b6('0x4b'),_0x261bb0);})[_0x24b6('0x4c')](function(){delete _0x56fc44['channels'][_0x28d562];delete _0x56fc44['actions'][_0x28d562];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x24b6('0xf')][_0x28d562];delete this[_0x24b6('0x41')][_0x28d562];}};Fax[_0x24b6('0x1f')][_0x24b6('0x1d')]=function(_0x2bb635){var _0x25f015=this;if(this[_0x24b6('0xf')][_0x2bb635[_0x24b6('0x25')]]){if(this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]]){this['channels'][_0x2bb635[_0x24b6('0x25')]]['id']=this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]]['id'];this[_0x24b6('0xf')][_0x2bb635['uniqueid']][_0x24b6('0x27')]=this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]][_0x24b6('0x27')];}logger['info'](_0x2bb635['uniqueid'],this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]]?_0x24b6('0x4d'):_0x24b6('0x4e'),JSON[_0x24b6('0x3e')](this[_0x24b6('0xf')][_0x2bb635[_0x24b6('0x25')]]));if(this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]]){if(this[_0x24b6('0xf')][_0x2bb635['uniqueid']]['faxpages']>0x0&&this['channels'][_0x2bb635[_0x24b6('0x25')]][_0x24b6('0x18')]==='SUCCESS'){this[_0x24b6('0x4a')](_0x2bb635['uniqueid'],!![]);}else{this[_0x24b6('0x4a')](_0x2bb635['uniqueid'],![],this[_0x24b6('0xf')][_0x2bb635[_0x24b6('0x25')]]['faxstatusstring']?_0x24b6('0x4f')+this[_0x24b6('0xf')][_0x2bb635[_0x24b6('0x25')]][_0x24b6('0x50')]:'SENDING\x20FAILED');}}}};Fax[_0x24b6('0x1f')][_0x24b6('0x51')]=function(_0x38f8d0){var _0x552904=this;return new BPromise(function(_0xef4b8,_0x4e2000){_0x552904[_0x24b6('0x52')](_0x38f8d0,_0x552904[_0x24b6('0x10')][_0x38f8d0[_0x24b6('0x53')]])[_0x24b6('0x3a')](function(_0x3cfef6){ut[_0x24b6('0x48')](_0x24b6('0x54'),_0x3cfef6);_0xef4b8(ut['message'](_0x24b6('0x55')));})['catch'](function(_0x4ac84f){ut[_0x24b6('0x48')](_0x24b6('0x56'),_0x4ac84f);updateStatus(_0x38f8d0);_0x4e2000(ut[_0x24b6('0x57')](_0x24b6('0x58')));});});};Fax['prototype'][_0x24b6('0x59')]=function(_0x52b547){var _0x359d24=this;return new BPromise(function(_0x3db358,_0x51da5b){var _0x805c11=_0x359d24[_0x24b6('0x5a')](_0x359d24['faxAccounts'][_0x52b547[_0x24b6('0x53')]]['Trunk'],_0x52b547);if(_0x805c11[_0x24b6('0x5b')]){_0x3db358(ut['message'](_0x24b6('0x5c')));}else{_0x51da5b(ut['message'](_0x805c11[_0x24b6('0x57')]));}});};function originate(_0x45e6e0,_0x3491fc,_0x4d7ad8){return new BPromise(function(_0x3b04d8,_0x2d1efe){if(_0x4d7ad8){var _0xde104a=util[_0x24b6('0x5d')](_0x24b6('0x5e'),path[_0x24b6('0x37')](_0x45e6e0['path'])[_0x24b6('0x27')],_0x45e6e0[_0x24b6('0x5f')]);gs[_0x24b6('0x60')](_0xde104a)[_0x24b6('0x3a')](function(){_0x45e6e0[_0x24b6('0x5f')]=util[_0x24b6('0x5d')](_0x24b6('0x61'),path['parse'](_0x45e6e0[_0x24b6('0x5f')])[_0x24b6('0x62')],path['parse'](_0x45e6e0[_0x24b6('0x5f')])[_0x24b6('0x27')]);_0x3491fc[_0x24b6('0x63')]=_0x45e6e0[_0x24b6('0x5f')];ut[_0x24b6('0x48')](_0x24b6('0x64'),'');ami[_0x24b6('0x65')](ut[_0x24b6('0x66')](_0x45e6e0,_0x3491fc))['then'](function(_0x2530cb){_0x3b04d8(_0x2530cb);})[_0x24b6('0x3f')](function(_0x2727fa){_0x2d1efe(_0x2727fa);});})[_0x24b6('0x3f')](function(_0x3e9349){_0x2d1efe(_0x3e9349);});}else{ami[_0x24b6('0x65')](ut[_0x24b6('0x66')](_0x45e6e0,_0x3491fc))[_0x24b6('0x3a')](function(_0x3b66fb){_0x3b04d8(_0x3b66fb);})[_0x24b6('0x3f')](function(_0x5f2b9c){_0x2d1efe(_0x5f2b9c);});}});}Fax[_0x24b6('0x1f')][_0x24b6('0x52')]=function(_0xdae4d,_0x26a28b){var _0x18202e=this;return new BPromise(function(_0x4ac7aa,_0x398141){var _0x378d10=uuid['v4']();var _0x25818f=ut['addVariables'](_0xdae4d,_0x26a28b);_0x18202e['actions'][_0x378d10]=new Action(_0x378d10,_0x26a28b,_0xdae4d);var _0x1790a6=_0x18202e[_0x24b6('0x41')][_0x378d10];if(path[_0x24b6('0x37')](_0xdae4d[_0x24b6('0x5f')])[_0x24b6('0x67')]===_0x24b6('0x38')){originate(_0x1790a6,_0x25818f,!![])['then'](function(_0x4eeb06){_0x4ac7aa(_0x4eeb06);})[_0x24b6('0x3f')](function(_0x48c78a){_0x398141(_0x48c78a);});}else{originate(_0x1790a6,_0x25818f,![])[_0x24b6('0x3a')](function(_0x54b79e){_0x4ac7aa(_0x54b79e);})[_0x24b6('0x3f')](function(_0x17c653){_0x398141(_0x17c653);});}});};Fax['prototype']['isTrunkReachable']=function(_0x2a5682){return!_[_0x24b6('0x68')](_0x2a5682)&&!_['isNil'](_0x2a5682[_0x24b6('0x27')])&&!_[_0x24b6('0x68')](_0x2a5682[_0x24b6('0x69')])&&_0x2a5682[_0x24b6('0x69')]&&!_[_0x24b6('0x68')](this['trunks'][util['format'](_0x24b6('0x6a'),_0x2a5682['name'])])&&!_['isNil'](this[_0x24b6('0x11')][util['format'](_0x24b6('0x6a'),_0x2a5682['name'])]['status'])&&(this[_0x24b6('0x11')][util[_0x24b6('0x5d')](_0x24b6('0x6a'),_0x2a5682[_0x24b6('0x27')])]['status']==='reachable'||this[_0x24b6('0x11')][util['format'](_0x24b6('0x6a'),_0x2a5682['name'])][_0x24b6('0x2f')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x5a578b,_0x2e448a){if(!this[_0x24b6('0x6b')](_0x5a578b)){ut['logger'](_0x24b6('0x6c'),_['isNil'](_0x5a578b)?'':_0x5a578b['name']+_0x24b6('0x6d'));return{'isValid':![],'message':_0x24b6('0x6e')};}if(_[_0x24b6('0x68')](_0x2e448a[_0x24b6('0x7')])){ut[_0x24b6('0x48')](_0x24b6('0x6f'),JSON[_0x24b6('0x3e')](_0x2e448a));return{'isValid':![],'message':_0x24b6('0x70')};}if(_[_0x24b6('0x68')](_0x2e448a['path'])){ut[_0x24b6('0x48')](_0x24b6('0x71'),JSON[_0x24b6('0x3e')](_0x2e448a));return{'isValid':![],'message':_0x24b6('0x72')};}return{'isValid':!![],'message':_0x24b6('0x73')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index ec39032..81d03cd 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 _0xfe1e=['resolve','catch','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x444990,_0x44196a){var _0x4b99de=function(_0x93733b){while(--_0x93733b){_0x444990['push'](_0x444990['shift']());}};_0x4b99de(++_0x44196a);}(_0xfe1e,0x84));var _0xefe1=function(_0x168ca4,_0x3e41be){_0x168ca4=_0x168ca4-0x0;var _0x312090=_0xfe1e[_0x168ca4];return _0x312090;};'use strict';var util=require(_0xefe1('0x0'));var BPromise=require(_0xefe1('0x1'));var logger=require(_0xefe1('0x2'))('preview');var _=require(_0xefe1('0x3'));var faxAccount=require(_0xefe1('0x4'));function loggerCatch(_0x4836be){return function(_0x4e28a3){logger[_0xefe1('0x5')](_0x4836be,util[_0xefe1('0x6')](_0x4e28a3,{'showHidden':![],'depth':null}));};}exports[_0xefe1('0x7')]=function(_0x2ea11b,_0x101e93){return BPromise[_0xefe1('0x8')]()['then'](faxAccount[_0xefe1('0x7')](_0x2ea11b,_0x101e93))[_0xefe1('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x2427=['../rpc/faxAccount','error','inspect','resolve','then','notify','catch','util','bluebird','preview'];(function(_0x14c92b,_0x3b01db){var _0x5cb970=function(_0x2ff560){while(--_0x2ff560){_0x14c92b['push'](_0x14c92b['shift']());}};_0x5cb970(++_0x3b01db);}(_0x2427,0x165));var _0x7242=function(_0x4ba2c8,_0x3095a7){_0x4ba2c8=_0x4ba2c8-0x0;var _0x13b7ce=_0x2427[_0x4ba2c8];return _0x13b7ce;};'use strict';var util=require(_0x7242('0x0'));var BPromise=require(_0x7242('0x1'));var logger=require('../../../config/logger')(_0x7242('0x2'));var _=require('lodash');var faxAccount=require(_0x7242('0x3'));function loggerCatch(_0x4b0c46){return function(_0x66fd49){logger[_0x7242('0x4')](_0x4b0c46,util[_0x7242('0x5')](_0x66fd49,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x6ecd49,_0x4b0575){return BPromise[_0x7242('0x6')]()[_0x7242('0x7')](faxAccount[_0x7242('0x8')](_0x6ecd49,_0x4b0575))[_0x7242('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 5cbe0dd..a2e5401 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 _0x71bd=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','child_process'];(function(_0x70d596,_0x305add){var _0x1e68ab=function(_0x301339){while(--_0x301339){_0x70d596['push'](_0x70d596['shift']());}};_0x1e68ab(++_0x305add);}(_0x71bd,0x192));var _0xd71b=function(_0xbeceb,_0x3e71f3){_0xbeceb=_0xbeceb-0x0;var _0x170da3=_0x71bd[_0xbeceb];return _0x170da3;};'use strict';var util=require('util');var logger=require(_0xd71b('0x0'))(_0xd71b('0x1'));var BPromise=require('bluebird');var exec=require(_0xd71b('0x2'))[_0xd71b('0x3')];exports[_0xd71b('0x4')]=function(_0x554090){return new BPromise(function(_0x1cd0e8,_0x46f5f7){exec(_0x554090,function(_0x4c6031,_0x7283aa,_0x53c4b1){logger[_0xd71b('0x5')]('Exec\x20gs',_0x7283aa);if(_0x4c6031){logger[_0xd71b('0x5')](_0xd71b('0x6'),_0xd71b('0x7'),util[_0xd71b('0x8')](_0x4c6031,{'showHidden':![],'depth':null}),_0x7283aa,_0x53c4b1);_0x46f5f7(_0x4c6031);}_0x1cd0e8(_0x7283aa);});});}; \ No newline at end of file +var _0x042b=['execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','exec'];(function(_0x45cbc9,_0x31fbd8){var _0x5b2b70=function(_0x669758){while(--_0x669758){_0x45cbc9['push'](_0x45cbc9['shift']());}};_0x5b2b70(++_0x31fbd8);}(_0x042b,0x136));var _0xb042=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x042b[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0xb042('0x0'));var logger=require(_0xb042('0x1'))(_0xb042('0x2'));var BPromise=require(_0xb042('0x3'));var exec=require('child_process')[_0xb042('0x4')];exports[_0xb042('0x5')]=function(_0x8033bf){return new BPromise(function(_0x5a8370,_0xca09b3){exec(_0x8033bf,function(_0x468944,_0x408e09,_0x5f2563){logger[_0xb042('0x6')](_0xb042('0x7'),_0x408e09);if(_0x468944){logger[_0xb042('0x6')](_0xb042('0x7'),_0xb042('0x8'),util['inspect'](_0x468944,{'showHidden':![],'depth':null}),_0x408e09,_0x5f2563);_0xca09b3(_0x468944);}_0x5a8370(_0x408e09);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index bb538eb..c40224e 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 _0x6be9=['../../../../config/logger','fax','message','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','localstationid','path','variablesAction','uniqueid','xcally-motion-fax','util','lodash','moment'];(function(_0x52c1f6,_0x4eda0b){var _0x4df981=function(_0x71aa7){while(--_0x71aa7){_0x52c1f6['push'](_0x52c1f6['shift']());}};_0x4df981(++_0x4eda0b);}(_0x6be9,0x123));var _0x96be=function(_0x4cc511,_0xe5bcd1){_0x4cc511=_0x4cc511-0x0;var _0x3e71c1=_0x6be9[_0x4cc511];return _0x3e71c1;};'use strict';var util=require(_0x96be('0x0'));var _=require(_0x96be('0x1'));var moment=require(_0x96be('0x2'));var logger=require(_0x96be('0x3'))(_0x96be('0x4'));exports[_0x96be('0x5')]=function(_0x3fc273){return{'message':_0x3fc273};};exports['logger']=function(_0x500463,_0x235691){logger['info'](_0x500463,util[_0x96be('0x6')](_0x235691,{'showHidden':![],'depth':null}));};exports[_0x96be('0x7')]=function(_0x1d1542,_0x107ba1){var _0x58364b={'XMF-ECM':_0x107ba1[_0x96be('0x8')],'XMF-HEADERINFO':_0x107ba1[_0x96be('0x9')],'XMF-MINRATE':_0x107ba1[_0x96be('0xa')],'XMF-MAXRATE':_0x107ba1[_0x96be('0xb')],'XMF-MODEM':util[_0x96be('0xc')](_0x96be('0xd'),_0x107ba1[_0x96be('0xe')]),'XMF-GATEWAY':_0x107ba1['gateway'],'XMF-FAXDETECT':_0x107ba1['faxdetect'],'XMF-T38TIMEOUT':_0x107ba1[_0x96be('0xf')],'XMF-LOCALSTATIONID':_0x107ba1[_0x96be('0x10')],'XMF-PATH':_0x1d1542[_0x96be('0x11')]};return _0x58364b;};exports[_0x96be('0x12')]=function(_0x302e98,_0x5dd051){return{'actionid':_0x302e98[_0x96be('0x13')],'action':'originate','channel':_0x302e98['channel'],'Exten':_0x96be('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x96be('0xc')]('\x22%s\x22\x20<%s>',_0x302e98[_0x96be('0x9')]?_0x302e98['headerinfo']:'',_0x302e98[_0x96be('0x10')]),'variable':_0x5dd051,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x302e98[_0x96be('0x13')]};}; \ No newline at end of file +var _0xa3a9=['localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','message','logger','inspect','addVariables','format','\x22%s\x22','modem','gateway','faxdetect'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0xa3a9,0xfc));var _0x9a3a=function(_0x1280e5,_0xddca64){_0x1280e5=_0x1280e5-0x0;var _0x42b776=_0xa3a9[_0x1280e5];return _0x42b776;};'use strict';var util=require(_0x9a3a('0x0'));var _=require(_0x9a3a('0x1'));var moment=require(_0x9a3a('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0x9a3a('0x3')]=function(_0x37fb01){return{'message':_0x37fb01};};exports[_0x9a3a('0x4')]=function(_0x12662b,_0x39d280){logger['info'](_0x12662b,util[_0x9a3a('0x5')](_0x39d280,{'showHidden':![],'depth':null}));};exports[_0x9a3a('0x6')]=function(_0x2544b0,_0x3ebe34){var _0x159f4f={'XMF-ECM':_0x3ebe34['ecm'],'XMF-HEADERINFO':_0x3ebe34['headerinfo'],'XMF-MINRATE':_0x3ebe34['minrate'],'XMF-MAXRATE':_0x3ebe34['maxrate'],'XMF-MODEM':util[_0x9a3a('0x7')](_0x9a3a('0x8'),_0x3ebe34[_0x9a3a('0x9')]),'XMF-GATEWAY':_0x3ebe34[_0x9a3a('0xa')],'XMF-FAXDETECT':_0x3ebe34[_0x9a3a('0xb')],'XMF-T38TIMEOUT':_0x3ebe34['t38timeout'],'XMF-LOCALSTATIONID':_0x3ebe34[_0x9a3a('0xc')],'XMF-PATH':_0x2544b0[_0x9a3a('0xd')]};return _0x159f4f;};exports[_0x9a3a('0xe')]=function(_0x2ca335,_0x7b7e9c){return{'actionid':_0x2ca335[_0x9a3a('0xf')],'action':_0x9a3a('0x10'),'channel':_0x2ca335[_0x9a3a('0x11')],'Exten':_0x9a3a('0x12'),'Context':_0x9a3a('0x13'),'Priority':'1','callerid':util['format'](_0x9a3a('0x14'),_0x2ca335['headerinfo']?_0x2ca335[_0x9a3a('0x15')]:'',_0x2ca335[_0x9a3a('0xc')]),'variable':_0x7b7e9c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2ca335[_0x9a3a('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 283c7bb..3cb978c 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 _0x4856=['./trigger','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','listen','sync','[index.js][main]','inspect','util','./server','./report','./acw'];(function(_0x5d67be,_0x4c78cf){var _0x2e2a0a=function(_0x58c886){while(--_0x58c886){_0x5d67be['push'](_0x5d67be['shift']());}};_0x2e2a0a(++_0x4c78cf);}(_0x4856,0xc2));var _0x6485=function(_0x30806e,_0x41bb0d){_0x30806e=_0x30806e-0x0;var _0x2777c6=_0x4856[_0x30806e];return _0x2777c6;};'use strict';var util=require(_0x6485('0x0'));var moment=require('moment');var server=require(_0x6485('0x1'));var Realtime=require('./realtime');var Report=require(_0x6485('0x2'));var Acw=require(_0x6485('0x3'));var Trigger=require(_0x6485('0x4'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x6485('0x5'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x6485('0x6'));var voiceCallReport=require(_0x6485('0x7'));var trunk=require(_0x6485('0x8'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x6485('0x9'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x6485('0xa'));var zendesk=require(_0x6485('0xb'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x6485('0xc'));var freshdesk=require(_0x6485('0xd'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x6485('0xe'));var vtiger=require(_0x6485('0xf'));var freshsales=require(_0x6485('0x10'));var servicenow=require(_0x6485('0x11'));var dynamics365=require(_0x6485('0x12'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x6485('0x13'))(_0x6485('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6485('0x15')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x6485('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x6485('0x17')]()[_0x6485('0x18')](user[_0x6485('0x19')]())['then'](realtime[_0x6485('0x1a')]())[_0x6485('0x18')](user[_0x6485('0x1b')]())[_0x6485('0x18')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x6485('0x18')](realtime[_0x6485('0x1c')]())[_0x6485('0x18')](voiceQueue['getVoiceQueues']())[_0x6485('0x18')](realtime[_0x6485('0x1d')]())[_0x6485('0x18')](trigger[_0x6485('0x1e')]())['then'](realtime[_0x6485('0x1f')]())[_0x6485('0x18')](template[_0x6485('0x20')]())[_0x6485('0x18')](realtime[_0x6485('0x21')]())[_0x6485('0x18')](zendesk['getZendeskAccounts']())['then'](realtime[_0x6485('0x22')]())['then'](salesforce[_0x6485('0x23')]())[_0x6485('0x18')](realtime[_0x6485('0x24')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x6485('0x18')](realtime[_0x6485('0x25')]())[_0x6485('0x18')](freshdesk[_0x6485('0x26')]())[_0x6485('0x18')](realtime[_0x6485('0x27')]())[_0x6485('0x18')](desk['getDeskAccounts']())[_0x6485('0x18')](realtime[_0x6485('0x28')]())[_0x6485('0x18')](zoho[_0x6485('0x29')]())[_0x6485('0x18')](realtime['initZohoAccounts']())[_0x6485('0x18')](vtiger[_0x6485('0x2a')]())[_0x6485('0x18')](realtime['initVtigerAccounts']())[_0x6485('0x18')](freshsales['getFreshsalesAccounts']())[_0x6485('0x18')](realtime[_0x6485('0x2b')]())[_0x6485('0x18')](servicenow[_0x6485('0x2c')]())[_0x6485('0x18')](realtime[_0x6485('0x2d')]())[_0x6485('0x18')](dynamics365['getDynamics365Accounts']())[_0x6485('0x18')](realtime[_0x6485('0x2e')]())[_0x6485('0x18')](campaign[_0x6485('0x2f')]())[_0x6485('0x18')](realtime[_0x6485('0x30')]())['then'](voiceExtension[_0x6485('0x31')]())[_0x6485('0x18')](realtime['initVoiceExtensions']())[_0x6485('0x18')](faxAccount[_0x6485('0x32')]())['then'](realtime[_0x6485('0x33')]())[_0x6485('0x18')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x6485('0x18')](voiceQueueReport[_0x6485('0x34')]())[_0x6485('0x18')](realtime[_0x6485('0x35')]())[_0x6485('0x18')](cmHopperHistory[_0x6485('0x36')]())[_0x6485('0x18')](realtime[_0x6485('0x37')]())['then'](cmHopperHistory[_0x6485('0x38')]())[_0x6485('0x18')](realtime[_0x6485('0x39')]())[_0x6485('0x18')](voiceCallReport[_0x6485('0x3a')]())['then'](realtime[_0x6485('0x3b')]())[_0x6485('0x3c')](function(_0xd93468){logger[_0x6485('0x3d')]('[index.js][initParams]',util['inspect'](_0xd93468,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6485('0x3e')](realtime,preview,fax)[_0x6485('0x18')](function(){return initRealtime();})[_0x6485('0x18')](function(){return initParams();})[_0x6485('0x18')](function(){report[_0x6485('0x3f')]();setInterval(initRealtime,0x1388);})[_0x6485('0x3c')](function(_0x1747c9){logger[_0x6485('0x3d')](_0x6485('0x40'),util[_0x6485('0x41')](_0x1747c9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xdc87=['./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','listen','sync','[index.js][main]','inspect','util','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount'];(function(_0x5eb4c2,_0x958b19){var _0x504308=function(_0x83b924){while(--_0x83b924){_0x5eb4c2['push'](_0x5eb4c2['shift']());}};_0x504308(++_0x958b19);}(_0xdc87,0xd0));var _0x7dc8=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xdc87[_0x555b2f];return _0x81c0a6;};'use strict';var util=require(_0x7dc8('0x0'));var moment=require(_0x7dc8('0x1'));var server=require('./server');var Realtime=require(_0x7dc8('0x2'));var Report=require(_0x7dc8('0x3'));var Acw=require(_0x7dc8('0x4'));var Trigger=require(_0x7dc8('0x5'));var Dialer=require('./dialer');var Preview=require(_0x7dc8('0x6'));var Fax=require(_0x7dc8('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x7dc8('0x8'));var voiceQueueReport=require(_0x7dc8('0x9'));var voiceCallReport=require(_0x7dc8('0xa'));var trunk=require(_0x7dc8('0xb'));var trigger=require(_0x7dc8('0xc'));var template=require(_0x7dc8('0xd'));var cmHopperHistory=require(_0x7dc8('0xe'));var campaign=require(_0x7dc8('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7dc8('0x10'));var zendesk=require(_0x7dc8('0x11'));var salesforce=require(_0x7dc8('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x7dc8('0x13'));var zoho=require(_0x7dc8('0x14'));var vtiger=require(_0x7dc8('0x15'));var freshsales=require(_0x7dc8('0x16'));var servicenow=require(_0x7dc8('0x17'));var dynamics365=require(_0x7dc8('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x7dc8('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7dc8('0x1a')](_0x7dc8('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7dc8('0x1a')](_0x7dc8('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7dc8('0x1c')]()[_0x7dc8('0x1d')](user[_0x7dc8('0x1e')]())['then'](realtime[_0x7dc8('0x1f')]())[_0x7dc8('0x1d')](user[_0x7dc8('0x20')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x21')]())[_0x7dc8('0x1d')](trunk[_0x7dc8('0x22')]())[_0x7dc8('0x1d')](realtime['initTrunks']())[_0x7dc8('0x1d')](voiceQueue[_0x7dc8('0x23')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x24')]())[_0x7dc8('0x1d')](trigger[_0x7dc8('0x25')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x26')]())[_0x7dc8('0x1d')](template[_0x7dc8('0x27')]())['then'](realtime[_0x7dc8('0x28')]())['then'](zendesk['getZendeskAccounts']())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x29')]())[_0x7dc8('0x1d')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x7dc8('0x2a')]())[_0x7dc8('0x1d')](sugarcrm[_0x7dc8('0x2b')]())['then'](realtime[_0x7dc8('0x2c')]())['then'](freshdesk[_0x7dc8('0x2d')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x2e')]())[_0x7dc8('0x1d')](desk[_0x7dc8('0x2f')]())['then'](realtime[_0x7dc8('0x30')]())[_0x7dc8('0x1d')](zoho[_0x7dc8('0x31')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x32')]())[_0x7dc8('0x1d')](vtiger[_0x7dc8('0x33')]())['then'](realtime[_0x7dc8('0x34')]())['then'](freshsales[_0x7dc8('0x35')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x36')]())['then'](servicenow[_0x7dc8('0x37')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x38')]())[_0x7dc8('0x1d')](dynamics365[_0x7dc8('0x39')]())['then'](realtime[_0x7dc8('0x3a')]())[_0x7dc8('0x1d')](campaign[_0x7dc8('0x3b')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x3c')]())[_0x7dc8('0x1d')](voiceExtension['getVoiceExtensions']())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x3d')]())[_0x7dc8('0x1d')](faxAccount['getFaxAccounts']())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x3e')]())[_0x7dc8('0x1d')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x7dc8('0x1d')](voiceQueueReport[_0x7dc8('0x3f')]())[_0x7dc8('0x1d')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x40')]())[_0x7dc8('0x1d')](cmHopperHistory[_0x7dc8('0x41')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x42')]())[_0x7dc8('0x1d')](voiceCallReport[_0x7dc8('0x43')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x44')]())[_0x7dc8('0x45')](function(_0x496c07){logger[_0x7dc8('0x46')]('[index.js][initParams]',util['inspect'](_0x496c07,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7dc8('0x47')](realtime,preview,fax)[_0x7dc8('0x1d')](function(){return initRealtime();})[_0x7dc8('0x1d')](function(){return initParams();})[_0x7dc8('0x1d')](function(){report[_0x7dc8('0x48')]();setInterval(initRealtime,0x1388);})[_0x7dc8('0x45')](function(_0x14c6ac){logger[_0x7dc8('0x46')](_0x7dc8('0x49'),util[_0x7dc8('0x4a')](_0x14c6ac,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index b997b49..f44db49 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 _0x9d7a=['md5','prototype','updateStatusRealtime','toLowerCase','idle','inuse','statePause','voiceStatusQueue','stringify','format','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local'];(function(_0x2215dc,_0x324ffa){var _0x171300=function(_0x4838ea){while(--_0x4838ea){_0x2215dc['push'](_0x2215dc['shift']());}};_0x171300(++_0x324ffa);}(_0x9d7a,0x18a));var _0xa9d7=function(_0x4ed96c,_0x273123){_0x4ed96c=_0x4ed96c-0x0;var _0x3e7abc=_0x9d7a[_0x4ed96c];return _0x3e7abc;};'use strict';var _=require(_0xa9d7('0x0'));var util=require(_0xa9d7('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xa9d7('0x2'));var config=require(_0xa9d7('0x3'));config[_0xa9d7('0x4')]=_[_0xa9d7('0x5')](config[_0xa9d7('0x4')],{'host':_0xa9d7('0x6'),'port':0x18eb});var io=require(_0xa9d7('0x7'))(new Redis(config['redis']));function Agent(_0x443a52){this['id']=_0x443a52['id']||0x0;this[_0xa9d7('0x8')]=_0x443a52[_0xa9d7('0x8')]||'';this[_0xa9d7('0x9')]=_0x443a52[_0xa9d7('0x9')]||'';this[_0xa9d7('0xa')]=_0x443a52['accountcode']||'';this[_0xa9d7('0xb')]=_0x443a52[_0xa9d7('0xb')]||'';this[_0xa9d7('0xc')]=_0xa9d7('0xd');this[_0xa9d7('0xe')]=0x0;this[_0xa9d7('0xf')]='unknown';this[_0xa9d7('0x10')]='';this[_0xa9d7('0x11')]='';this[_0xa9d7('0x12')]='';this[_0xa9d7('0x13')]='';this['online']=_0x443a52[_0xa9d7('0x14')]||![];this[_0xa9d7('0x15')]='unknown';this[_0xa9d7('0x16')]=0x0;this[_0xa9d7('0x17')]='';this['voiceStatusQueue']='';this[_0xa9d7('0x18')]=![];this[_0xa9d7('0x19')]=![];this[_0xa9d7('0x1a')]='';}Agent[_0xa9d7('0x1b')][_0xa9d7('0x1c')]=function(_0x1e1863){var _0x4b54d9;if(_0x1e1863&&_0x1e1863[_0xa9d7('0xc')]){_0x4b54d9=_0x1e1863[_0xa9d7('0xc')][_0xa9d7('0x1d')]();switch(_0x4b54d9){case'not_inuse':_0x4b54d9=_0xa9d7('0x1e');break;case _0xa9d7('0x1f'):_0x4b54d9='talking';break;}}if(_0x4b54d9&&this[_0xa9d7('0x15')]!==_0x4b54d9||_0x1e1863[_0xa9d7('0x20')]){this[_0xa9d7('0x16')]=_['toNumber'](moment()['format']('x'));}if(_0x4b54d9){this[_0xa9d7('0x15')]=_0x4b54d9;}var _0x123907={'id':this['id'],'name':this[_0xa9d7('0x8')],'email':this['email'],'accountcode':this[_0xa9d7('0xa')],'fullname':this[_0xa9d7('0xb')],'state':this[_0xa9d7('0xc')],'stateTime':this[_0xa9d7('0xe')],'status':this[_0xa9d7('0xf')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0xa9d7('0x15')],'voiceStatusTime':this[_0xa9d7('0x16')],'voiceStatusCallerIdNumber':this[_0xa9d7('0x17')],'voiceStatusQueue':this[_0xa9d7('0x21')],'interface':this[_0xa9d7('0x13')],'onhold':this['onhold']};var _0x5d22c7=md5(JSON[_0xa9d7('0x22')](_0x123907));if(this[_0xa9d7('0x1a')]!==_0x5d22c7){this['md5']=_0x5d22c7;io['to'](util[_0xa9d7('0x23')](_0xa9d7('0x24'),_0x123907[_0xa9d7('0x8')]))[_0xa9d7('0x25')](_0xa9d7('0x26'),_[_0xa9d7('0x27')](_0x123907,['online']));io[_0xa9d7('0x25')](_0xa9d7('0x28'),_0x123907);}};module[_0xa9d7('0x29')]=Agent; \ No newline at end of file +var _0xb164=['idle','inuse','talking','voiceStatus','statePause','format','email','online','stringify','user:%s','emit','user:ami:update','exports','lodash','moment','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','accountcode','fullname','stateTime','status','unknown','address','phone','mobile','interface','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','updateStatusRealtime','state','toLowerCase','not_inuse'];(function(_0xd36819,_0x3f700b){var _0x11f270=function(_0x2db3e1){while(--_0x2db3e1){_0xd36819['push'](_0xd36819['shift']());}};_0x11f270(++_0x3f700b);}(_0xb164,0xad));var _0x4b16=function(_0x4591ba,_0x5dfe67){_0x4591ba=_0x4591ba-0x0;var _0x3867f0=_0xb164[_0x4591ba];return _0x3867f0;};'use strict';var _=require(_0x4b16('0x0'));var util=require('util');var moment=require(_0x4b16('0x1'));var md5=require('md5');var Redis=require(_0x4b16('0x2'));var config=require(_0x4b16('0x3'));config[_0x4b16('0x4')]=_['defaults'](config[_0x4b16('0x4')],{'host':_0x4b16('0x5'),'port':0x18eb});var io=require(_0x4b16('0x6'))(new Redis(config[_0x4b16('0x4')]));function Agent(_0x14256b){this['id']=_0x14256b['id']||0x0;this[_0x4b16('0x7')]=_0x14256b[_0x4b16('0x7')]||'';this['email']=_0x14256b['email']||'';this[_0x4b16('0x8')]=_0x14256b[_0x4b16('0x8')]||'';this['fullname']=_0x14256b[_0x4b16('0x9')]||'';this['state']='unknown';this[_0x4b16('0xa')]=0x0;this[_0x4b16('0xb')]=_0x4b16('0xc');this[_0x4b16('0xd')]='';this[_0x4b16('0xe')]='';this[_0x4b16('0xf')]='';this[_0x4b16('0x10')]='';this['online']=_0x14256b['online']||![];this['voiceStatus']='unknown';this[_0x4b16('0x11')]=0x0;this[_0x4b16('0x12')]='';this[_0x4b16('0x13')]='';this[_0x4b16('0x14')]=![];this[_0x4b16('0x15')]=![];this[_0x4b16('0x16')]='';}Agent['prototype'][_0x4b16('0x17')]=function(_0x42e3e1){var _0x289c50;if(_0x42e3e1&&_0x42e3e1[_0x4b16('0x18')]){_0x289c50=_0x42e3e1[_0x4b16('0x18')][_0x4b16('0x19')]();switch(_0x289c50){case _0x4b16('0x1a'):_0x289c50=_0x4b16('0x1b');break;case _0x4b16('0x1c'):_0x289c50=_0x4b16('0x1d');break;}}if(_0x289c50&&this[_0x4b16('0x1e')]!==_0x289c50||_0x42e3e1[_0x4b16('0x1f')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x4b16('0x20')]('x'));}if(_0x289c50){this[_0x4b16('0x1e')]=_0x289c50;}var _0x15bbb0={'id':this['id'],'name':this[_0x4b16('0x7')],'email':this[_0x4b16('0x21')],'accountcode':this[_0x4b16('0x8')],'fullname':this[_0x4b16('0x9')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x4b16('0x22')],'voiceStatus':this[_0x4b16('0x1e')],'voiceStatusTime':this[_0x4b16('0x11')],'voiceStatusCallerIdNumber':this[_0x4b16('0x12')],'voiceStatusQueue':this[_0x4b16('0x13')],'interface':this[_0x4b16('0x10')],'onhold':this[_0x4b16('0x14')]};var _0x45d1e7=md5(JSON[_0x4b16('0x23')](_0x15bbb0));if(this[_0x4b16('0x16')]!==_0x45d1e7){this[_0x4b16('0x16')]=_0x45d1e7;io['to'](util[_0x4b16('0x20')](_0x4b16('0x24'),_0x15bbb0[_0x4b16('0x7')]))[_0x4b16('0x25')](_0x4b16('0x26'),_['omit'](_0x15bbb0,[_0x4b16('0x22')]));io[_0x4b16('0x25')]('user:presence',_0x15bbb0);}};module[_0x4b16('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6d7e13a..ca5e755 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 _0x5bbe=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x5bbe,0x1a4));var _0xe5bb=function(_0x5bf61f,_0x12cafd){_0x5bf61f=_0x5bf61f-0x0;var _0x608e58=_0x5bbe[_0x5bf61f];return _0x608e58;};'use strict';function Campaign(_0x4464e1){this['id']=_0x4464e1['id']||0x0;this['name']=_0x4464e1[_0xe5bb('0x0')]||'';this['type']=_0x4464e1[_0xe5bb('0x1')]||'campaign';this[_0xe5bb('0x2')]=0x0;this[_0xe5bb('0x3')]=0x0;this[_0xe5bb('0x4')]=0x0;this[_0xe5bb('0x5')]=0x0;this['message']='';this[_0xe5bb('0x6')]=!![];this['active']=_0x4464e1[_0xe5bb('0x7')];this[_0xe5bb('0x8')]=_0x4464e1[_0xe5bb('0x8')];this['dialTimezone']=_0x4464e1[_0xe5bb('0x9')]||null;this[_0xe5bb('0xa')]=_0x4464e1['dialGlobalInterval']?_0x4464e1[_0xe5bb('0xa')]:null;this[_0xe5bb('0xb')]=_0x4464e1['dialOriginateCallerIdName'];this[_0xe5bb('0xc')]=_0x4464e1[_0xe5bb('0xc')];this['dialOriginateTimeout']=_0x4464e1[_0xe5bb('0xd')]||0x1e;this[_0xe5bb('0xe')]=_0x4464e1[_0xe5bb('0xe')];this[_0xe5bb('0xf')]=_0x4464e1['dialCongestionRetryFrequency'];this[_0xe5bb('0x10')]=_0x4464e1[_0xe5bb('0x10')];this[_0xe5bb('0x11')]=_0x4464e1[_0xe5bb('0x11')];this[_0xe5bb('0x12')]=_0x4464e1[_0xe5bb('0x12')];this[_0xe5bb('0x13')]=_0x4464e1[_0xe5bb('0x13')];this['dialGlobalMaxRetry']=_0x4464e1['dialGlobalMaxRetry'];this[_0xe5bb('0x14')]=_0x4464e1['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4464e1['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x4464e1['dialDropMaxRetry']||0x3;this[_0xe5bb('0x15')]=_0x4464e1[_0xe5bb('0x15')]||0x96;this[_0xe5bb('0x16')]=_0x4464e1[_0xe5bb('0x16')]||0x3;this[_0xe5bb('0x17')]=_0x4464e1['dialAbandonedRetryFrequency']||0x96;this[_0xe5bb('0x18')]=_0x4464e1['dialMachineMaxRetry']||0x3;this[_0xe5bb('0x19')]=_0x4464e1[_0xe5bb('0x19')]||0x96;this[_0xe5bb('0x1a')]=_0x4464e1[_0xe5bb('0x1a')]||0x3;this[_0xe5bb('0x1b')]=_0x4464e1[_0xe5bb('0x1b')]||0x96;this[_0xe5bb('0x1c')]=_0x4464e1['dialOrderByScheduledAt']||_0xe5bb('0x1d');this['dialPrefix']=_0x4464e1[_0xe5bb('0x1e')]||undefined;this[_0xe5bb('0x1f')]=_0x4464e1[_0xe5bb('0x1f')]||undefined;this[_0xe5bb('0x20')]=_0x4464e1['dialCutDigit']||undefined;this['TrunkBackup']=_0x4464e1['TrunkBackup']?_0x4464e1[_0xe5bb('0x21')]:undefined;this[_0xe5bb('0x22')]=_0x4464e1[_0xe5bb('0x22')]?_0x4464e1['Trunk']:undefined;this['Interval']=_0x4464e1[_0xe5bb('0x23')]?_0x4464e1['Interval']:undefined;this[_0xe5bb('0x24')]=_0x4464e1[_0xe5bb('0x24')]?_0x4464e1['SquareProject']:undefined;this[_0xe5bb('0x25')]=_0x4464e1[_0xe5bb('0x24')]?_0x4464e1[_0xe5bb('0x24')][_0xe5bb('0x0')]:undefined;this[_0xe5bb('0x26')]=_0x4464e1[_0xe5bb('0x26')]||![];this['dialAMDInitialSilence']=_0x4464e1[_0xe5bb('0x27')];this[_0xe5bb('0x28')]=_0x4464e1['dialAMDGreeting'];this[_0xe5bb('0x29')]=_0x4464e1[_0xe5bb('0x29')];this['dialAMDTotalAnalysisTime']=_0x4464e1[_0xe5bb('0x2a')];this[_0xe5bb('0x2b')]=_0x4464e1[_0xe5bb('0x2b')];this['dialAMDBetweenWordsSilence']=_0x4464e1[_0xe5bb('0x2c')];this[_0xe5bb('0x2d')]=_0x4464e1[_0xe5bb('0x2d')];this[_0xe5bb('0x2e')]=_0x4464e1['dialAMDSilenceThreshold'];this[_0xe5bb('0x2f')]=_0x4464e1[_0xe5bb('0x2f')];}module[_0xe5bb('0x30')]=Campaign; \ No newline at end of file +var _0x2e38=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x2d5887,_0xace828){var _0x257084=function(_0x457e3a){while(--_0x457e3a){_0x2d5887['push'](_0x2d5887['shift']());}};_0x257084(++_0xace828);}(_0x2e38,0x1d4));var _0x82e3=function(_0xfb25a,_0x154e47){_0xfb25a=_0xfb25a-0x0;var _0x3392dc=_0x2e38[_0xfb25a];return _0x3392dc;};'use strict';function Campaign(_0x4b7279){this['id']=_0x4b7279['id']||0x0;this[_0x82e3('0x0')]=_0x4b7279[_0x82e3('0x0')]||'';this[_0x82e3('0x1')]=_0x4b7279[_0x82e3('0x1')]||_0x82e3('0x2');this['originated']=0x0;this[_0x82e3('0x3')]=0x0;this[_0x82e3('0x4')]=0x0;this[_0x82e3('0x5')]=0x0;this[_0x82e3('0x6')]='';this[_0x82e3('0x7')]=!![];this['active']=_0x4b7279[_0x82e3('0x8')];this[_0x82e3('0x9')]=_0x4b7279[_0x82e3('0x9')];this[_0x82e3('0xa')]=_0x4b7279[_0x82e3('0xa')]||null;this[_0x82e3('0xb')]=_0x4b7279['dialGlobalInterval']?_0x4b7279[_0x82e3('0xb')]:null;this[_0x82e3('0xc')]=_0x4b7279['dialOriginateCallerIdName'];this[_0x82e3('0xd')]=_0x4b7279[_0x82e3('0xd')];this[_0x82e3('0xe')]=_0x4b7279[_0x82e3('0xe')]||0x1e;this[_0x82e3('0xf')]=_0x4b7279['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x4b7279[_0x82e3('0x10')];this[_0x82e3('0x11')]=_0x4b7279[_0x82e3('0x11')];this[_0x82e3('0x12')]=_0x4b7279[_0x82e3('0x12')];this[_0x82e3('0x13')]=_0x4b7279[_0x82e3('0x13')];this['dialNoAnswerRetryFrequency']=_0x4b7279[_0x82e3('0x14')];this['dialGlobalMaxRetry']=_0x4b7279[_0x82e3('0x15')];this[_0x82e3('0x16')]=_0x4b7279[_0x82e3('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4b7279[_0x82e3('0x17')]||0x96;this['dialDropMaxRetry']=_0x4b7279['dialDropMaxRetry']||0x3;this[_0x82e3('0x18')]=_0x4b7279[_0x82e3('0x18')]||0x96;this[_0x82e3('0x19')]=_0x4b7279['dialAbandonedMaxRetry']||0x3;this[_0x82e3('0x1a')]=_0x4b7279[_0x82e3('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x4b7279[_0x82e3('0x1b')]||0x3;this[_0x82e3('0x1c')]=_0x4b7279[_0x82e3('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x4b7279[_0x82e3('0x1d')]||0x3;this[_0x82e3('0x1e')]=_0x4b7279['dialAgentRejectRetryFrequency']||0x96;this[_0x82e3('0x1f')]=_0x4b7279[_0x82e3('0x1f')]||_0x82e3('0x20');this['dialPrefix']=_0x4b7279['dialPrefix']||undefined;this[_0x82e3('0x21')]=_0x4b7279[_0x82e3('0x21')]||undefined;this[_0x82e3('0x22')]=_0x4b7279['dialCutDigit']||undefined;this[_0x82e3('0x23')]=_0x4b7279[_0x82e3('0x23')]?_0x4b7279[_0x82e3('0x23')]:undefined;this[_0x82e3('0x24')]=_0x4b7279[_0x82e3('0x24')]?_0x4b7279[_0x82e3('0x24')]:undefined;this[_0x82e3('0x25')]=_0x4b7279['Interval']?_0x4b7279[_0x82e3('0x25')]:undefined;this[_0x82e3('0x26')]=_0x4b7279[_0x82e3('0x26')]?_0x4b7279[_0x82e3('0x26')]:undefined;this['dialQueueProject']=_0x4b7279['SquareProject']?_0x4b7279[_0x82e3('0x26')][_0x82e3('0x0')]:undefined;this[_0x82e3('0x27')]=_0x4b7279[_0x82e3('0x27')]||![];this[_0x82e3('0x28')]=_0x4b7279[_0x82e3('0x28')];this[_0x82e3('0x29')]=_0x4b7279[_0x82e3('0x29')];this[_0x82e3('0x2a')]=_0x4b7279[_0x82e3('0x2a')];this[_0x82e3('0x2b')]=_0x4b7279[_0x82e3('0x2b')];this[_0x82e3('0x2c')]=_0x4b7279[_0x82e3('0x2c')];this[_0x82e3('0x2d')]=_0x4b7279[_0x82e3('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x4b7279['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x4b7279[_0x82e3('0x2e')];this['dialAMDMaximumWordLength']=_0x4b7279[_0x82e3('0x2f')];}module[_0x82e3('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8733a23..74df499 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 _0x8ff4=['answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type','disposition','monitor','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','calleridnum','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered'];(function(_0x23188a,_0x3da191){var _0x4e22dc=function(_0x27e405){while(--_0x27e405){_0x23188a['push'](_0x23188a['shift']());}};_0x4e22dc(++_0x3da191);}(_0x8ff4,0x11f));var _0x48ff=function(_0x722d30,_0x1633a3){_0x722d30=_0x722d30-0x0;var _0x22b826=_0x8ff4[_0x722d30];return _0x22b826;};'use strict';function Channel(){this[_0x48ff('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x48ff('0x1')]=0x0;this[_0x48ff('0x2')]='';this['connectedlinenum']=undefined;this[_0x48ff('0x3')]=undefined;this[_0x48ff('0x4')]=0x0;this[_0x48ff('0x5')]='';this[_0x48ff('0x6')]=0x0;this[_0x48ff('0x7')]=0x0;this[_0x48ff('0x8')]=0x0;this[_0x48ff('0x9')]=![];this[_0x48ff('0xa')]=null;this[_0x48ff('0xb')]=null;this[_0x48ff('0xc')]=![];this[_0x48ff('0xd')]=![];this[_0x48ff('0xe')]='';this[_0x48ff('0xf')]='';this[_0x48ff('0x10')]=0x0;this['billableseconds']=0x0;this[_0x48ff('0x11')]=0x0;this[_0x48ff('0x12')]=null;this['tag']=null;this[_0x48ff('0x13')]=null;this[_0x48ff('0x14')]=![];this['monitorFilename']=null;this[_0x48ff('0x15')]=null;this[_0x48ff('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x48ff('0x17')]=undefined;this[_0x48ff('0x18')]=undefined;this[_0x48ff('0x19')]=0x0;}module[_0x48ff('0x1a')]=Channel; \ No newline at end of file +var _0x236c=['monitorFilename','monitors','transfercalleridnum','transferType','mohtime','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','billableseconds','type','tag','disposition','monitor'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x236c,0x155));var _0xc236=function(_0xbe55c8,_0x465b8e){_0xbe55c8=_0xbe55c8-0x0;var _0x3c6a21=_0x236c[_0xbe55c8];return _0x3c6a21;};'use strict';function Channel(){this[_0xc236('0x0')]=null;this['channel']='';this[_0xc236('0x1')]='';this[_0xc236('0x2')]=0x0;this[_0xc236('0x3')]='';this[_0xc236('0x4')]=undefined;this[_0xc236('0x5')]=undefined;this['accountcode']=0x0;this[_0xc236('0x6')]='';this[_0xc236('0x7')]=0x0;this[_0xc236('0x8')]=0x0;this[_0xc236('0x9')]=0x0;this[_0xc236('0xa')]=![];this[_0xc236('0xb')]=null;this['endtime']=null;this[_0xc236('0xc')]=![];this[_0xc236('0xd')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0xc236('0xe')]=0x0;this['holdtime']=0x0;this[_0xc236('0xf')]=null;this[_0xc236('0x10')]=null;this[_0xc236('0x11')]=null;this[_0xc236('0x12')]=![];this[_0xc236('0x13')]=null;this['queue']=null;this[_0xc236('0x14')]=[];this[_0xc236('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc236('0x16')]=undefined;this[_0xc236('0x17')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0f7e8e3..411c754 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 _0xbf4d=['authType','password','consumerKey','consumerSecret','token','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x124da3,_0x52707f){var _0x4588bc=function(_0x3f34e4){while(--_0x3f34e4){_0x124da3['push'](_0x124da3['shift']());}};_0x4588bc(++_0x52707f);}(_0xbf4d,0x152));var _0xdbf4=function(_0x156e99,_0x2bf27e){_0x156e99=_0x156e99-0x0;var _0x18870e=_0xbf4d[_0x156e99];return _0x18870e;};'use strict';function DeskAccount(_0x3f3c5c){this['id']=_0x3f3c5c['id']||0x0;this[_0xdbf4('0x0')]=_0x3f3c5c[_0xdbf4('0x0')]||'';this[_0xdbf4('0x1')]=_0x3f3c5c[_0xdbf4('0x1')]||'';this[_0xdbf4('0x2')]=_0x3f3c5c['remoteUri']||'';this[_0xdbf4('0x3')]=_0x3f3c5c[_0xdbf4('0x3')]||'';this[_0xdbf4('0x4')]=_0x3f3c5c[_0xdbf4('0x4')]||'';this[_0xdbf4('0x5')]=_0x3f3c5c[_0xdbf4('0x5')]||'';this[_0xdbf4('0x6')]=_0x3f3c5c[_0xdbf4('0x6')]||'';this[_0xdbf4('0x7')]=_0x3f3c5c['token']||'';this['tokenSecret']=_0x3f3c5c['tokenSecret']||'';this['type']=_0x3f3c5c[_0xdbf4('0x8')]||'';this[_0xdbf4('0x9')]=_0x3f3c5c['serverUrl']||'';this[_0xdbf4('0xa')]=_0x3f3c5c['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x0e2f=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e2f,0xb0));var _0xf0e2=function(_0x5e12f8,_0x4eb457){_0x5e12f8=_0x5e12f8-0x0;var _0x16468e=_0x0e2f[_0x5e12f8];return _0x16468e;};'use strict';function DeskAccount(_0x59fca6){this['id']=_0x59fca6['id']||0x0;this[_0xf0e2('0x0')]=_0x59fca6[_0xf0e2('0x0')]||'';this[_0xf0e2('0x1')]=_0x59fca6[_0xf0e2('0x1')]||'';this['remoteUri']=_0x59fca6[_0xf0e2('0x2')]||'';this[_0xf0e2('0x3')]=_0x59fca6[_0xf0e2('0x3')]||'';this[_0xf0e2('0x4')]=_0x59fca6[_0xf0e2('0x4')]||'';this[_0xf0e2('0x5')]=_0x59fca6[_0xf0e2('0x5')]||'';this['consumerSecret']=_0x59fca6[_0xf0e2('0x6')]||'';this[_0xf0e2('0x7')]=_0x59fca6[_0xf0e2('0x7')]||'';this[_0xf0e2('0x8')]=_0x59fca6[_0xf0e2('0x8')]||'';this[_0xf0e2('0x9')]=_0x59fca6[_0xf0e2('0x9')]||'';this[_0xf0e2('0xa')]=_0x59fca6['serverUrl']||'';this[_0xf0e2('0xb')]=_0x59fca6[_0xf0e2('0xb')]||{};}module[_0xf0e2('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 827d2e8..6c36f58 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 _0x57b3=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username'];(function(_0x4ab576,_0x198f34){var _0x458ae5=function(_0x2bcc12){while(--_0x2bcc12){_0x4ab576['push'](_0x4ab576['shift']());}};_0x458ae5(++_0x198f34);}(_0x57b3,0x195));var _0x357b=function(_0xd61039,_0x4c1371){_0xd61039=_0xd61039-0x0;var _0x2e9d81=_0x57b3[_0xd61039];return _0x2e9d81;};'use strict';function Dynamics365Account(_0x25e5d3){this['id']=_0x25e5d3['id']||0x0;this[_0x357b('0x0')]=_0x25e5d3[_0x357b('0x0')]||'';this[_0x357b('0x1')]=_0x25e5d3[_0x357b('0x1')]||'';this[_0x357b('0x2')]=_0x25e5d3[_0x357b('0x2')]||'';this[_0x357b('0x3')]=_0x25e5d3[_0x357b('0x3')]||'';this[_0x357b('0x4')]=_0x25e5d3[_0x357b('0x4')]||'';this['clientId']=_0x25e5d3[_0x357b('0x5')]||'';this[_0x357b('0x6')]=_0x25e5d3['clientSecret']||{};this['serverUrl']=_0x25e5d3[_0x357b('0x7')]||'';this['modernAuthentication']=_0x25e5d3[_0x357b('0x8')]||![];this[_0x357b('0x9')]=_0x25e5d3[_0x357b('0x9')]||{};this['CloudProvider']=_0x25e5d3[_0x357b('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xbcaf=['password','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x43406e,_0x42f6ab){var _0x4dccde=function(_0xd4fb7e){while(--_0xd4fb7e){_0x43406e['push'](_0x43406e['shift']());}};_0x4dccde(++_0x42f6ab);}(_0xbcaf,0x1ab));var _0xfbca=function(_0x3c4923,_0x1b95b9){_0x3c4923=_0x3c4923-0x0;var _0x1879d3=_0xbcaf[_0x3c4923];return _0x1879d3;};'use strict';function Dynamics365Account(_0x38377c){this['id']=_0x38377c['id']||0x0;this[_0xfbca('0x0')]=_0x38377c['name']||'';this[_0xfbca('0x1')]=_0x38377c[_0xfbca('0x1')]||'';this[_0xfbca('0x2')]=_0x38377c[_0xfbca('0x2')]||'';this[_0xfbca('0x3')]=_0x38377c[_0xfbca('0x3')]||'';this['tenantId']=_0x38377c['tenantId']||'';this[_0xfbca('0x4')]=_0x38377c[_0xfbca('0x4')]||'';this['clientSecret']=_0x38377c[_0xfbca('0x5')]||{};this[_0xfbca('0x6')]=_0x38377c[_0xfbca('0x6')]||'';this[_0xfbca('0x7')]=_0x38377c['modernAuthentication']||![];this[_0xfbca('0x8')]=_0x38377c['Configurations']||{};this[_0xfbca('0x9')]=_0x38377c[_0xfbca('0x9')]||{};}module[_0xfbca('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 14437c7..0e5ae97 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 _0xa04a=['description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name'];(function(_0x4ac7a4,_0x28825d){var _0x33d05b=function(_0x34d03f){while(--_0x34d03f){_0x4ac7a4['push'](_0x4ac7a4['shift']());}};_0x33d05b(++_0x28825d);}(_0xa04a,0x77));var _0xaa04=function(_0x479691,_0x1002be){_0x479691=_0x479691-0x0;var _0x32a5c1=_0xa04a[_0x479691];return _0x32a5c1;};'use strict';function FaxAccount(_0x4009c6){this['id']=_0x4009c6['id']||0x0;this[_0xaa04('0x0')]=_0x4009c6[_0xaa04('0x0')]||'';this[_0xaa04('0x1')]=_0x4009c6[_0xaa04('0x1')];this['ecm']=_0x4009c6[_0xaa04('0x2')];this['headerinfo']=_0x4009c6['headerinfo'];this[_0xaa04('0x3')]=_0x4009c6[_0xaa04('0x3')];this['minrate']=_0x4009c6[_0xaa04('0x4')]||0x960;this[_0xaa04('0x5')]=_0x4009c6[_0xaa04('0x5')]||0x3840;this[_0xaa04('0x6')]=_0x4009c6[_0xaa04('0x6')]||_0xaa04('0x7');this['gateway']=_0x4009c6['gateway']||'no';this[_0xaa04('0x8')]=_0x4009c6[_0xaa04('0x8')]||'no';this[_0xaa04('0x9')]=_0x4009c6[_0xaa04('0x9')]||0x1388;this[_0xaa04('0xa')]=_0x4009c6[_0xaa04('0xa')]||'SIP';this[_0xaa04('0xb')]=_0x4009c6[_0xaa04('0xb')]?_0x4009c6[_0xaa04('0xb')]:undefined;this[_0xaa04('0xc')]=_0x4009c6[_0xaa04('0xc')];this['key']=_0x4009c6[_0xaa04('0xd')];}module[_0xaa04('0xe')]=FaxAccount; \ No newline at end of file +var _0x232f=['ListId','key','name','description','ecm','headerinfo','localstationid','minrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x25ce10,_0x3f8369){var _0x4b65b4=function(_0x4ce5df){while(--_0x4ce5df){_0x25ce10['push'](_0x25ce10['shift']());}};_0x4b65b4(++_0x3f8369);}(_0x232f,0x7a));var _0xf232=function(_0x3b970b,_0x2ff4aa){_0x3b970b=_0x3b970b-0x0;var _0x202d50=_0x232f[_0x3b970b];return _0x202d50;};'use strict';function FaxAccount(_0x56d63a){this['id']=_0x56d63a['id']||0x0;this[_0xf232('0x0')]=_0x56d63a[_0xf232('0x0')]||'';this['description']=_0x56d63a[_0xf232('0x1')];this[_0xf232('0x2')]=_0x56d63a['ecm'];this['headerinfo']=_0x56d63a[_0xf232('0x3')];this[_0xf232('0x4')]=_0x56d63a[_0xf232('0x4')];this[_0xf232('0x5')]=_0x56d63a[_0xf232('0x5')]||0x960;this['maxrate']=_0x56d63a['maxrate']||0x3840;this['modem']=_0x56d63a['modem']||_0xf232('0x6');this[_0xf232('0x7')]=_0x56d63a[_0xf232('0x7')]||'no';this['faxdetect']=_0x56d63a[_0xf232('0x8')]||'no';this[_0xf232('0x9')]=_0x56d63a[_0xf232('0x9')]||0x1388;this['tech']=_0x56d63a[_0xf232('0xa')]||_0xf232('0xb');this['Trunk']=_0x56d63a[_0xf232('0xc')]?_0x56d63a['Trunk']:undefined;this[_0xf232('0xd')]=_0x56d63a['ListId'];this[_0xf232('0xe')]=_0x56d63a['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 9601671..cb13cfc 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 _0x6983=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x4579cd,_0x3ab780){var _0x42667a=function(_0x543940){while(--_0x543940){_0x4579cd['push'](_0x4579cd['shift']());}};_0x42667a(++_0x3ab780);}(_0x6983,0x10b));var _0x3698=function(_0x415df2,_0x11ef3d){_0x415df2=_0x415df2-0x0;var _0x210d6a=_0x6983[_0x415df2];return _0x210d6a;};'use strict';function FreshdeskAccount(_0x34ec9b){this['id']=_0x34ec9b['id']||0x0;this[_0x3698('0x0')]=_0x34ec9b[_0x3698('0x0')]||'';this[_0x3698('0x1')]=_0x34ec9b['username']||'';this['apiKey']=_0x34ec9b[_0x3698('0x2')]||'';this[_0x3698('0x3')]=_0x34ec9b[_0x3698('0x3')]||'';this['serverUrl']=_0x34ec9b[_0x3698('0x4')]||'';this['Configurations']=_0x34ec9b[_0x3698('0x5')]||{};}module[_0x3698('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x2005=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x668670,_0x557968){var _0x24c71e=function(_0x233057){while(--_0x233057){_0x668670['push'](_0x668670['shift']());}};_0x24c71e(++_0x557968);}(_0x2005,0x1ac));var _0x5200=function(_0x31bdee,_0x5d888e){_0x31bdee=_0x31bdee-0x0;var _0x187af1=_0x2005[_0x31bdee];return _0x187af1;};'use strict';function FreshdeskAccount(_0x245e89){this['id']=_0x245e89['id']||0x0;this['name']=_0x245e89[_0x5200('0x0')]||'';this[_0x5200('0x1')]=_0x245e89[_0x5200('0x1')]||'';this[_0x5200('0x2')]=_0x245e89[_0x5200('0x3')]||'';this[_0x5200('0x4')]=_0x245e89[_0x5200('0x4')]||'';this['serverUrl']=_0x245e89[_0x5200('0x5')]||'';this[_0x5200('0x6')]=_0x245e89['Configurations']||{};}module[_0x5200('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7dd8468..7123d02 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 _0x3f27=['Configurations','exports','name','username','token','remoteUri'];(function(_0xaddb5e,_0x372a9a){var _0x15ad8c=function(_0x39dfd3){while(--_0x39dfd3){_0xaddb5e['push'](_0xaddb5e['shift']());}};_0x15ad8c(++_0x372a9a);}(_0x3f27,0x1f4));var _0x73f2=function(_0x1fcbb9,_0x51e611){_0x1fcbb9=_0x1fcbb9-0x0;var _0x77bc9=_0x3f27[_0x1fcbb9];return _0x77bc9;};'use strict';function FreshsalesAccount(_0x1e2168){this['id']=_0x1e2168['id']||0x0;this[_0x73f2('0x0')]=_0x1e2168[_0x73f2('0x0')]||'';this[_0x73f2('0x1')]=_0x1e2168[_0x73f2('0x1')]||'';this['apiKey']=_0x1e2168[_0x73f2('0x2')]||'';this[_0x73f2('0x3')]=_0x1e2168['remoteUri']||'';this['serverUrl']=_0x1e2168['serverUrl']||'';this[_0x73f2('0x4')]=_0x1e2168[_0x73f2('0x4')]||{};}module[_0x73f2('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x0f9f=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0x0f9f,0xae));var _0xf0f9=function(_0x50f008,_0x5abe67){_0x50f008=_0x50f008-0x0;var _0x5d5483=_0x0f9f[_0x50f008];return _0x5d5483;};'use strict';function FreshsalesAccount(_0xbbc735){this['id']=_0xbbc735['id']||0x0;this[_0xf0f9('0x0')]=_0xbbc735[_0xf0f9('0x0')]||'';this[_0xf0f9('0x1')]=_0xbbc735[_0xf0f9('0x1')]||'';this[_0xf0f9('0x2')]=_0xbbc735[_0xf0f9('0x3')]||'';this[_0xf0f9('0x4')]=_0xbbc735[_0xf0f9('0x4')]||'';this[_0xf0f9('0x5')]=_0xbbc735[_0xf0f9('0x5')]||'';this['Configurations']=_0xbbc735[_0xf0f9('0x6')]||{};}module[_0xf0f9('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index a019c3a..55b77b3 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 _0xa217=['context','priority','holdtime','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','channel','connectedlinenum','connectedlinename','accountcode'];(function(_0x94f760,_0x4f1b70){var _0x3aec01=function(_0x15c485){while(--_0x15c485){_0x94f760['push'](_0x94f760['shift']());}};_0x3aec01(++_0x4f1b70);}(_0xa217,0x188));var _0x7a21=function(_0x25949d,_0x49889d){_0x25949d=_0x25949d-0x0;var _0x321fac=_0xa217[_0x25949d];return _0x321fac;};'use strict';function QueueReport(){this[_0x7a21('0x0')]=_0x7a21('0x1');this['uniqueid']='';this[_0x7a21('0x2')]='';this[_0x7a21('0x3')]='';this[_0x7a21('0x4')]='';this['queuecallerjoinAt']=null;this[_0x7a21('0x5')]=null;this['position']=0x1;this[_0x7a21('0x6')]=0x1;this[_0x7a21('0x7')]=![];this[_0x7a21('0x8')]=null;this[_0x7a21('0x9')]=![];this[_0x7a21('0xa')]=null;this[_0x7a21('0xb')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0x7a21('0xc')]='';this[_0x7a21('0xd')]='';this[_0x7a21('0xe')]='';this[_0x7a21('0xf')]='';this[_0x7a21('0x10')]='';this['exten']='';this[_0x7a21('0x11')]='';this[_0x7a21('0x12')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x7a21('0x13')]=_0x7a21('0x14');this[_0x7a21('0x15')]=0x0;this[_0x7a21('0x16')]={};}module[_0x7a21('0x17')]=QueueReport; \ No newline at end of file +var _0x5e55=['channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','motionChannel','voice','mohtime','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition'];(function(_0x5a05b8,_0x290752){var _0x2a0914=function(_0x563667){while(--_0x563667){_0x5a05b8['push'](_0x5a05b8['shift']());}};_0x2a0914(++_0x290752);}(_0x5e55,0x73));var _0x55e5=function(_0x216c45,_0x40692b){_0x216c45=_0x216c45-0x0;var _0x3b96ce=_0x5e55[_0x216c45];return _0x3b96ce;};'use strict';function QueueReport(){this[_0x55e5('0x0')]='inbound';this[_0x55e5('0x1')]='';this[_0x55e5('0x2')]='';this[_0x55e5('0x3')]='';this[_0x55e5('0x4')]='';this[_0x55e5('0x5')]=null;this[_0x55e5('0x6')]=null;this[_0x55e5('0x7')]=0x1;this[_0x55e5('0x8')]=0x1;this['queuecallerabandon']=![];this[_0x55e5('0x9')]=null;this[_0x55e5('0xa')]=![];this[_0x55e5('0xb')]=null;this[_0x55e5('0xc')]=![];this[_0x55e5('0xd')]=null;this[_0x55e5('0xe')]=0x1;this[_0x55e5('0xf')]='';this[_0x55e5('0x10')]='';this[_0x55e5('0x11')]='';this[_0x55e5('0x12')]='';this['context']='';this[_0x55e5('0x13')]='';this[_0x55e5('0x14')]='';this[_0x55e5('0x15')]=0x0;this[_0x55e5('0x16')]=![];this['lastAssignedTo']='';this[_0x55e5('0x17')]=_0x55e5('0x18');this[_0x55e5('0x19')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 656089a..c660630 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 _0x874d=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x181048,_0xb3a60e){var _0x3e0ce3=function(_0x4c3b52){while(--_0x4c3b52){_0x181048['push'](_0x181048['shift']());}};_0x3e0ce3(++_0xb3a60e);}(_0x874d,0x1e8));var _0xd874=function(_0xc36d01,_0x3bf1a6){_0xc36d01=_0xc36d01-0x0;var _0xecb231=_0x874d[_0xc36d01];return _0xecb231;};'use strict';function SalesforceAccount(_0x3843a5){this['id']=_0x3843a5['id']||0x0;this[_0xd874('0x0')]=_0x3843a5[_0xd874('0x0')]||'';this[_0xd874('0x1')]=_0x3843a5['username']||'';this[_0xd874('0x2')]=_0x3843a5[_0xd874('0x2')]||'';this[_0xd874('0x3')]=_0x3843a5[_0xd874('0x3')]||'';this['clientId']=_0x3843a5[_0xd874('0x4')]||'';this[_0xd874('0x5')]=_0x3843a5[_0xd874('0x5')]||'';this[_0xd874('0x6')]=_0x3843a5[_0xd874('0x6')]||'';this['type']=_0x3843a5[_0xd874('0x7')]||_0xd874('0x8');this[_0xd874('0x9')]=_0x3843a5['serverUrl']||'';this['Configurations']=_0x3843a5[_0xd874('0xa')]||{};}module[_0xd874('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xc273=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0xc273,0x197));var _0x3c27=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0xc273[_0x35387d];return _0x3aba56;};'use strict';function SalesforceAccount(_0x21460e){this['id']=_0x21460e['id']||0x0;this[_0x3c27('0x0')]=_0x21460e[_0x3c27('0x0')]||'';this[_0x3c27('0x1')]=_0x21460e[_0x3c27('0x1')]||'';this[_0x3c27('0x2')]=_0x21460e['remoteUri']||'';this[_0x3c27('0x3')]=_0x21460e[_0x3c27('0x3')]||'';this[_0x3c27('0x4')]=_0x21460e['clientId']||'';this[_0x3c27('0x5')]=_0x21460e['clientSecret']||'';this[_0x3c27('0x6')]=_0x21460e[_0x3c27('0x6')]||'';this[_0x3c27('0x7')]=_0x21460e[_0x3c27('0x7')]||_0x3c27('0x8');this['serverUrl']=_0x21460e[_0x3c27('0x9')]||'';this[_0x3c27('0xa')]=_0x21460e['Configurations']||{};}module[_0x3c27('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 28a4923..890708c 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 _0x734e=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x2a0a8d,_0x4d47a5){var _0x3f41a8=function(_0x3b754a){while(--_0x3b754a){_0x2a0a8d['push'](_0x2a0a8d['shift']());}};_0x3f41a8(++_0x4d47a5);}(_0x734e,0x1c0));var _0xe734=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x734e[_0x3ec122];return _0x4ecf41;};'use strict';function ServicenowAccount(_0x3f772a){this['id']=_0x3f772a['id']||0x0;this[_0xe734('0x0')]=_0x3f772a['name']||'';this['username']=_0x3f772a[_0xe734('0x1')]||'';this[_0xe734('0x2')]=_0x3f772a[_0xe734('0x2')]||'';this[_0xe734('0x3')]=_0x3f772a[_0xe734('0x3')]||'';this['serverUrl']=_0x3f772a[_0xe734('0x4')]||'';this[_0xe734('0x5')]=_0x3f772a[_0xe734('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xdc02=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x49d224,_0x54bfb8){var _0x3ce423=function(_0x358fba){while(--_0x358fba){_0x49d224['push'](_0x49d224['shift']());}};_0x3ce423(++_0x54bfb8);}(_0xdc02,0x78));var _0x2dc0=function(_0x206de1,_0x42247b){_0x206de1=_0x206de1-0x0;var _0x5bd6a8=_0xdc02[_0x206de1];return _0x5bd6a8;};'use strict';function ServicenowAccount(_0x43b0ca){this['id']=_0x43b0ca['id']||0x0;this[_0x2dc0('0x0')]=_0x43b0ca[_0x2dc0('0x0')]||'';this[_0x2dc0('0x1')]=_0x43b0ca[_0x2dc0('0x1')]||'';this[_0x2dc0('0x2')]=_0x43b0ca[_0x2dc0('0x2')]||'';this[_0x2dc0('0x3')]=_0x43b0ca[_0x2dc0('0x3')]||'';this['serverUrl']=_0x43b0ca[_0x2dc0('0x4')]||'';this[_0x2dc0('0x5')]=_0x43b0ca[_0x2dc0('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 8743d5b..3bf3e1d 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 _0x3ae7=['password','remoteUri','serverUrl','exports','name','username'];(function(_0x217e94,_0x4ae301){var _0x18bd2f=function(_0x40c93c){while(--_0x40c93c){_0x217e94['push'](_0x217e94['shift']());}};_0x18bd2f(++_0x4ae301);}(_0x3ae7,0x1e4));var _0x73ae=function(_0x3807dd,_0x4eae4b){_0x3807dd=_0x3807dd-0x0;var _0xd808a9=_0x3ae7[_0x3807dd];return _0xd808a9;};'use strict';function SugarcrmAccount(_0x36f290){this['id']=_0x36f290['id']||0x0;this[_0x73ae('0x0')]=_0x36f290[_0x73ae('0x0')]||'';this[_0x73ae('0x1')]=_0x36f290['username']||'';this[_0x73ae('0x2')]=_0x36f290['password']||'';this[_0x73ae('0x3')]=_0x36f290['remoteUri']||'';this[_0x73ae('0x4')]=_0x36f290[_0x73ae('0x4')]||'';this['Configurations']=_0x36f290['Configurations']||{};}module[_0x73ae('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x8230=['username','password','remoteUri','Configurations','exports','name'];(function(_0x404bff,_0x3e0578){var _0x4c63b3=function(_0x4fefa9){while(--_0x4fefa9){_0x404bff['push'](_0x404bff['shift']());}};_0x4c63b3(++_0x3e0578);}(_0x8230,0x143));var _0x0823=function(_0x5d3b11,_0x5afc6b){_0x5d3b11=_0x5d3b11-0x0;var _0xbc278d=_0x8230[_0x5d3b11];return _0xbc278d;};'use strict';function SugarcrmAccount(_0x28586f){this['id']=_0x28586f['id']||0x0;this['name']=_0x28586f[_0x0823('0x0')]||'';this[_0x0823('0x1')]=_0x28586f[_0x0823('0x1')]||'';this[_0x0823('0x2')]=_0x28586f[_0x0823('0x2')]||'';this[_0x0823('0x3')]=_0x28586f[_0x0823('0x3')]||'';this['serverUrl']=_0x28586f['serverUrl']||'';this['Configurations']=_0x28586f[_0x0823('0x4')]||{};}module[_0x0823('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 20a867c..c4651fe 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 _0xa724=['address','accountcode','state','stateTime','status','unknown'];(function(_0x32b715,_0x8f0a4d){var _0x198fdd=function(_0x498aff){while(--_0x498aff){_0x32b715['push'](_0x32b715['shift']());}};_0x198fdd(++_0x8f0a4d);}(_0xa724,0xf1));var _0x4a72=function(_0x49fa8a,_0x37a488){_0x49fa8a=_0x49fa8a-0x0;var _0x24170b=_0xa724[_0x49fa8a];return _0x24170b;};'use strict';function Telephone(_0x4a91a1){this['id']=_0x4a91a1['id']||0x0;this['name']=_0x4a91a1['name']||'';this[_0x4a72('0x0')]=_0x4a91a1['accountcode']||'';this[_0x4a72('0x1')]='unknown';this[_0x4a72('0x2')]=0x0;this[_0x4a72('0x3')]=_0x4a72('0x4');this[_0x4a72('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xc139=['accountcode','state','unknown','stateTime','address','name'];(function(_0x20eaf3,_0x37dde5){var _0x69467c=function(_0x5f4ae2){while(--_0x5f4ae2){_0x20eaf3['push'](_0x20eaf3['shift']());}};_0x69467c(++_0x37dde5);}(_0xc139,0x10d));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x1e8850){this['id']=_0x1e8850['id']||0x0;this['name']=_0x1e8850[_0x9c13('0x0')]||'';this[_0x9c13('0x1')]=_0x1e8850[_0x9c13('0x1')]||'';this[_0x9c13('0x2')]=_0x9c13('0x3');this[_0x9c13('0x4')]=0x0;this['status']='unknown';this[_0x9c13('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 731884c..365617b 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x36840b,_0x28131b){var _0x3713bd=function(_0x2d8479){while(--_0x2d8479){_0x36840b['push'](_0x36840b['shift']());}};_0x3713bd(++_0x28131b);}(_0xb10b,0x12a));var _0xbb10=function(_0x33a89d,_0xed52ed){_0x33a89d=_0x33a89d-0x0;var _0x175025=_0xb10b[_0x33a89d];return _0x175025;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1672a2,_0x1084df){var _0x2d90ed=function(_0x3b6c65){while(--_0x3b6c65){_0x1672a2['push'](_0x1672a2['shift']());}};_0x2d90ed(++_0x1084df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 3d426e6..4e9c58a 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x23a88c,_0x37b4d9){var _0x8bfbf2=function(_0x43d8d4){while(--_0x43d8d4){_0x23a88c['push'](_0x23a88c['shift']());}};_0x8bfbf2(++_0x37b4d9);}(_0x8603,0x190));var _0x3860=function(_0x399d76,_0xdc4493){_0x399d76=_0x399d76-0x0;var _0x3b19a1=_0x8603[_0x399d76];return _0x3b19a1;};'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 +var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x4af1ac,_0x266993){var _0x22f781=function(_0x20bcdc){while(--_0x20bcdc){_0x4af1ac['push'](_0x4af1ac['shift']());}};_0x22f781(++_0x266993);}(_0xda3f,0xec));var _0xfda3=function(_0x234741,_0x5aa867){_0x234741=_0x234741-0x0;var _0x1b7f4a=_0xda3f[_0x234741];return _0x1b7f4a;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index c10929b..c0e8d91 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 _0xf11f=['indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','stateTime','status','unknown','registry'];(function(_0x399fba,_0x2d00ec){var _0x2a033b=function(_0x58ab41){while(--_0x58ab41){_0x399fba['push'](_0x399fba['shift']());}};_0x2a033b(++_0x2d00ec);}(_0xf11f,0x1d5));var _0xff11=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0xf11f[_0x996bc8];return _0x20b0ea;};'use strict';function Trunk(_0x42fb2f){this['id']=_0x42fb2f['id']||0x0;this[_0xff11('0x0')]=_0x42fb2f[_0xff11('0x0')]||![];this['name']=_0x42fb2f[_0xff11('0x1')]||'';this[_0xff11('0x2')]='unknown';this[_0xff11('0x3')]=0x0;this[_0xff11('0x4')]=_0xff11('0x5');this[_0xff11('0x6')]=_0x42fb2f[_0xff11('0x6')]&&_0x42fb2f[_0xff11('0x6')][_0xff11('0x7')](':')?_0x42fb2f[_0xff11('0x6')][_0xff11('0x8')](':')[0x0]:'';this['host']='';this[_0xff11('0x9')]='';this[_0xff11('0xa')]='';this[_0xff11('0xb')]='';this[_0xff11('0xc')]='';this[_0xff11('0xd')]=_0xff11('0x5');this[_0xff11('0xe')]='';this[_0xff11('0xf')]='';this[_0xff11('0x10')]=_0x42fb2f[_0xff11('0x10')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x1c0a=['port','domain','domainport','refresh','registrationtime','address','defaultuser','exports','active','name','state','unknown','status','registry','indexOf','split'];(function(_0x3f9110,_0x39ee5f){var _0x2ee247=function(_0x44880a){while(--_0x44880a){_0x3f9110['push'](_0x3f9110['shift']());}};_0x2ee247(++_0x39ee5f);}(_0x1c0a,0x78));var _0xa1c0=function(_0x5dbe35,_0xb2541b){_0x5dbe35=_0x5dbe35-0x0;var _0x23d416=_0x1c0a[_0x5dbe35];return _0x23d416;};'use strict';function Trunk(_0x3249f7){this['id']=_0x3249f7['id']||0x0;this[_0xa1c0('0x0')]=_0x3249f7['active']||![];this[_0xa1c0('0x1')]=_0x3249f7[_0xa1c0('0x1')]||'';this[_0xa1c0('0x2')]=_0xa1c0('0x3');this['stateTime']=0x0;this[_0xa1c0('0x4')]='unknown';this['registry']=_0x3249f7[_0xa1c0('0x5')]&&_0x3249f7['registry'][_0xa1c0('0x6')](':')?_0x3249f7[_0xa1c0('0x5')][_0xa1c0('0x7')](':')[0x0]:'';this['host']='';this[_0xa1c0('0x8')]='';this[_0xa1c0('0x9')]='';this[_0xa1c0('0xa')]='';this[_0xa1c0('0xb')]='';this['stateRegistry']=_0xa1c0('0x3');this[_0xa1c0('0xc')]='';this[_0xa1c0('0xd')]='';this[_0xa1c0('0xe')]=_0x3249f7['defaultuser']||'';}module[_0xa1c0('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 604a8f8..d291915 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 _0x15d0=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x3c2366,_0x5de3bb){var _0x1af935=function(_0x3abc2f){while(--_0x3abc2f){_0x3c2366['push'](_0x3c2366['shift']());}};_0x1af935(++_0x5de3bb);}(_0x15d0,0xd4));var _0x015d=function(_0x4f7cdf,_0x375a8c){_0x4f7cdf=_0x4f7cdf-0x0;var _0x9382f4=_0x15d0[_0x4f7cdf];return _0x9382f4;};'use strict';function voiceExtension(_0x5e7423){this['id']=_0x5e7423['id']||0x0;this[_0x015d('0x0')]=_0x5e7423[_0x015d('0x0')]||'';this[_0x015d('0x1')]=_0x5e7423[_0x015d('0x1')]||'none';this[_0x015d('0x2')]=_0x5e7423['mandatoryDisposition']||![];}module[_0x015d('0x3')]=voiceExtension; \ No newline at end of file +var _0x50e4=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x50e4,0x1c4));var _0x450e=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x50e4[_0x256b72];return _0x2183e3;};'use strict';function voiceExtension(_0x444fdd){this['id']=_0x444fdd['id']||0x0;this[_0x450e('0x0')]=_0x444fdd[_0x450e('0x0')]||'';this[_0x450e('0x1')]=_0x444fdd[_0x450e('0x1')]||_0x450e('0x2');this[_0x450e('0x3')]=_0x444fdd[_0x450e('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index a4540b8..1383307 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 _0x867e=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','random','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','unknown','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x587a00,_0x57ec6d){var _0x1e78b6=function(_0x3855e4){while(--_0x3855e4){_0x587a00['push'](_0x587a00['shift']());}};_0x1e78b6(++_0x57ec6d);}(_0x867e,0x1c5));var _0xe867=function(_0x377d7f,_0x2681e3){_0x377d7f=_0x377d7f-0x0;var _0x118579=_0x867e[_0x377d7f];return _0x118579;};'use strict';var monitorFormat={'wav':_0xe867('0x0'),'wav49':_0xe867('0x1'),'gsm':_0xe867('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xe867('0x3'),'linear':'linear','random':_0xe867('0x4'),'ringall':'ringall','rr':_0xe867('0x5'),'rrmemory':_0xe867('0x6'),'rrordered':_0xe867('0x7'),'wrandom':_0xe867('0x8')};function VoiceQueue(_0x3a184f){this['id']=_0x3a184f['id']||0x0;this[_0xe867('0x9')]=_0x3a184f[_0xe867('0x9')]||'';this[_0xe867('0xa')]=_0x3a184f[_0xe867('0xa')]||'';this[_0xe867('0xb')]=_0x3a184f[_0xe867('0xb')]||_0xe867('0xc');this[_0xe867('0xd')]=0x0;this['total']=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xe867('0xe')]=0x0;this[_0xe867('0xf')]=0x0;this[_0xe867('0x10')]=0x0;this[_0xe867('0x11')]=0x0;this[_0xe867('0x12')]=0x0;this[_0xe867('0x13')]=0x0;this[_0xe867('0x14')]=0x0;this[_0xe867('0x15')]=0x0;this[_0xe867('0x16')]=0x0;this[_0xe867('0x17')]=0x0;this[_0xe867('0x18')]=0x0;this[_0xe867('0x19')]=0x0;this[_0xe867('0x1a')]=0x0;this[_0xe867('0x1b')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this[_0xe867('0x1c')]=0x0;this[_0xe867('0x1d')]=_0x3a184f['acw']||![];this[_0xe867('0x1e')]=_0x3a184f[_0xe867('0x1e')]||0xa;this['autopause']=_0x3a184f[_0xe867('0x1f')]||'no';this['sendMessageOneNotActive']=!![];this[_0xe867('0x20')]='';this['statusMessage']='';this[_0xe867('0x21')]=0x0;this[_0xe867('0x22')]=0x0;this[_0xe867('0x23')]=_0x3a184f[_0xe867('0x23')]||null;this[_0xe867('0x24')]=_0x3a184f['dialGlobalInterval']?_0x3a184f['dialGlobalInterval']:null;this['dialActive']=_0x3a184f[_0xe867('0x25')];this['dialMethod']=_0x3a184f[_0xe867('0x26')]||_0xe867('0x27');this[_0xe867('0x28')]=_0x3a184f[_0xe867('0x28')]||0x0;this[_0xe867('0x29')]=_0x3a184f[_0xe867('0x29')]||0x0;this[_0xe867('0x2a')]=_0x3a184f[_0xe867('0x2a')]||0x1;this['dialPredictiveOptimization']=_0x3a184f[_0xe867('0x2b')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x3a184f[_0xe867('0x2c')]||0.03;this[_0xe867('0x2d')]=_0x3a184f[_0xe867('0x2d')]||0x258;this['dialOriginateCallerIdName']=_0x3a184f['dialOriginateCallerIdName']||'anonymous';this[_0xe867('0x2e')]=_0x3a184f[_0xe867('0x2e')]||_0xe867('0x2f');this[_0xe867('0x30')]=_0x3a184f[_0xe867('0x30')]||0x1e;this[_0xe867('0x31')]=_0x3a184f['dialQueueOptions']||_0xe867('0x32');this[_0xe867('0x33')]=_0x3a184f[_0xe867('0x33')]||0x3;this[_0xe867('0x34')]=_0x3a184f['dialQueueProject']||undefined;this[_0xe867('0x35')]=_0x3a184f[_0xe867('0x35')]||0x3;this[_0xe867('0x36')]=_0x3a184f[_0xe867('0x36')]||0x96;this[_0xe867('0x37')]=_0x3a184f[_0xe867('0x37')]||0x3;this[_0xe867('0x38')]=_0x3a184f['dialBusyRetryFrequency']||0x96;this[_0xe867('0x39')]=_0x3a184f[_0xe867('0x39')]||0x3;this[_0xe867('0x3a')]=_0x3a184f[_0xe867('0x3a')]||0x96;this[_0xe867('0x3b')]=_0x3a184f[_0xe867('0x3b')]||0x3;this[_0xe867('0x3c')]=_0x3a184f[_0xe867('0x3c')]||0x96;this['dialDropMaxRetry']=_0x3a184f[_0xe867('0x3d')]||0x3;this[_0xe867('0x3e')]=_0x3a184f[_0xe867('0x3e')]||0x96;this['dialAbandonedMaxRetry']=_0x3a184f[_0xe867('0x3f')]||0x3;this[_0xe867('0x40')]=_0x3a184f['dialAbandonedRetryFrequency']||0x96;this[_0xe867('0x41')]=_0x3a184f['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x3a184f[_0xe867('0x42')]||0x96;this['dialAgentRejectMaxRetry']=_0x3a184f[_0xe867('0x43')]||0x3;this[_0xe867('0x44')]=_0x3a184f['dialAgentRejectRetryFrequency']||0x96;this[_0xe867('0x45')]=_0x3a184f[_0xe867('0x45')]||0x3;this['dialGlobalMaxRetry']=_0x3a184f[_0xe867('0x46')]||0x4;this[_0xe867('0x47')]=_0x3a184f[_0xe867('0x47')]?_0x3a184f[_0xe867('0x47')]:undefined;this['TrunkBackup']=_0x3a184f[_0xe867('0x48')]?_0x3a184f['TrunkBackup']:undefined;this['dialPrefix']=_0x3a184f[_0xe867('0x49')]||undefined;this[_0xe867('0x4a')]=_0x3a184f['Interval']?_0x3a184f[_0xe867('0x4a')]:undefined;this[_0xe867('0x4b')]=_0x3a184f['dialOrderByScheduledAt']||_0xe867('0x4c');this[_0xe867('0x4d')]=_0x3a184f[_0xe867('0x4d')]||undefined;this[_0xe867('0x4e')]=_0x3a184f['dialCutDigit']||undefined;this[_0xe867('0x4f')]=strategy[_0x3a184f[_0xe867('0x4f')]];this[_0xe867('0x50')]=!![];this[_0xe867('0x51')]=_0x3a184f[_0xe867('0x51')]||![];this[_0xe867('0x52')]=_0x3a184f[_0xe867('0x52')];this[_0xe867('0x53')]=_0x3a184f['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x3a184f[_0xe867('0x54')];this[_0xe867('0x55')]=_0x3a184f[_0xe867('0x55')];this['dialAMDMinWordLength']=_0x3a184f[_0xe867('0x56')];this[_0xe867('0x57')]=_0x3a184f[_0xe867('0x57')];this[_0xe867('0x58')]=_0x3a184f[_0xe867('0x58')];this[_0xe867('0x59')]=_0x3a184f['dialAMDSilenceThreshold'];this[_0xe867('0x5a')]=_0x3a184f['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xe867('0x5b')]=0x0;this[_0xe867('0x5c')]=_0x3a184f[_0xe867('0x5c')];this[_0xe867('0x5d')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xe867('0x5e')]=0x0;this[_0xe867('0x5f')]=0x0;this[_0xe867('0x60')]=0x0;this[_0xe867('0x61')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xe867('0x62')]=0x0;this[_0xe867('0x63')]=0x0;this[_0xe867('0x64')]=0x0;this['outboundReCallsDay']=0x0;this[_0xe867('0x65')]=0x0;this[_0xe867('0x66')]=undefined;this[_0xe867('0x67')]=undefined;this[_0xe867('0x68')]=undefined;this[_0xe867('0x69')]=1.05;this[_0xe867('0x6a')]=0x0;this[_0xe867('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xe867('0x6c')]=0x0;this[_0xe867('0x6d')]=0x0;this[_0xe867('0x6e')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xe867('0x6f')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3a184f['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x3a184f[_0xe867('0x70')]||0xa;this[_0xe867('0x71')]=0x0;this[_0xe867('0x72')]=0x0;this[_0xe867('0x73')]=0x1;this[_0xe867('0x74')]=0x0;this[_0xe867('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xe867('0x76')]=0x0;this[_0xe867('0x77')]=_0x3a184f[_0xe867('0x77')]||0x1e;this[_0xe867('0x78')]=_0x3a184f['dialRecallInQueue']||![];this[_0xe867('0x79')]=!!_0x3a184f[_0xe867('0x79')]||![];this[_0xe867('0x7a')]=!!_0x3a184f['dialPreviewRecallmeReminder']||![];this[_0xe867('0x7b')]=_0x3a184f['dialQueueProject2']||undefined;this[_0xe867('0x7c')]=_0x3a184f[_0xe867('0x7c')]||![];this['dialAgiAfterHangupAgent']=_0x3a184f['dialAgiAfterHangupAgent']||![];this[_0xe867('0xa')]=monitorFormat[_0x3a184f[_0xe867('0xa')]]?monitorFormat[_0x3a184f[_0xe867('0xa')]]:undefined;this['mandatoryDisposition']=_0x3a184f['mandatoryDisposition']||![];this[_0xe867('0x7d')]=_0x3a184f[_0xe867('0x7d')]?_0x3a184f[_0xe867('0x7d')]:undefined;this[_0xe867('0x7e')]=![];}module[_0xe867('0x7f')]=VoiceQueue; \ No newline at end of file +var _0x4c7b=['outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','leastrecent','linear','ringall','rrmemory','rrordered','wrandom','name','monitor_format','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','paused','ringing','talking','unavailable','unknown','acw','acwTimeout','autopause','message','statusMessage','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay'];(function(_0x564f39,_0x25d121){var _0x263425=function(_0xfb23fc){while(--_0xfb23fc){_0x564f39['push'](_0x564f39['shift']());}};_0x263425(++_0x25d121);}(_0x4c7b,0x128));var _0xb4c7=function(_0xeba5fc,_0xf5814c){_0xeba5fc=_0xeba5fc-0x0;var _0x18e023=_0x4c7b[_0xeba5fc];return _0x18e023;};'use strict';var monitorFormat={'wav':_0xb4c7('0x0'),'wav49':'wav49','gsm':_0xb4c7('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xb4c7('0x2'),'linear':_0xb4c7('0x3'),'random':'random','ringall':_0xb4c7('0x4'),'rr':'roundrobin','rrmemory':_0xb4c7('0x5'),'rrordered':_0xb4c7('0x6'),'wrandom':_0xb4c7('0x7')};function VoiceQueue(_0x898b7){this['id']=_0x898b7['id']||0x0;this[_0xb4c7('0x8')]=_0x898b7[_0xb4c7('0x8')]||'';this[_0xb4c7('0x9')]=_0x898b7['monitor_format']||'';this['type']=_0x898b7['type']||'inbound';this['waiting']=0x0;this[_0xb4c7('0xa')]=0x0;this[_0xb4c7('0xb')]=0x0;this[_0xb4c7('0xc')]=0x0;this[_0xb4c7('0xd')]=0x0;this[_0xb4c7('0xe')]=0x0;this[_0xb4c7('0xf')]=0x0;this[_0xb4c7('0x10')]=0x0;this[_0xb4c7('0x11')]=0x0;this[_0xb4c7('0x12')]=0x0;this[_0xb4c7('0x13')]=0x0;this[_0xb4c7('0x14')]=0x0;this[_0xb4c7('0x15')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0xb4c7('0x16')]=0x0;this[_0xb4c7('0x17')]=0x0;this['ringInUse']=0x0;this[_0xb4c7('0x18')]=0x0;this[_0xb4c7('0x19')]=0x0;this[_0xb4c7('0x1a')]=0x0;this[_0xb4c7('0x1b')]=_0x898b7[_0xb4c7('0x1b')]||![];this[_0xb4c7('0x1c')]=_0x898b7[_0xb4c7('0x1c')]||0xa;this[_0xb4c7('0x1d')]=_0x898b7[_0xb4c7('0x1d')]||'no';this['sendMessageOneNotActive']=!![];this[_0xb4c7('0x1e')]='';this[_0xb4c7('0x1f')]='';this[_0xb4c7('0x20')]=0x0;this[_0xb4c7('0x21')]=0x0;this['dialTimezone']=_0x898b7['dialTimezone']||null;this[_0xb4c7('0x22')]=_0x898b7[_0xb4c7('0x22')]?_0x898b7[_0xb4c7('0x22')]:null;this[_0xb4c7('0x23')]=_0x898b7[_0xb4c7('0x23')];this[_0xb4c7('0x24')]=_0x898b7['dialMethod']||'progressive';this['dialLimitChannel']=_0x898b7[_0xb4c7('0x25')]||0x0;this[_0xb4c7('0x26')]=_0x898b7[_0xb4c7('0x26')]||0x0;this['dialPowerLevel']=_0x898b7[_0xb4c7('0x27')]||0x1;this[_0xb4c7('0x28')]=_0x898b7[_0xb4c7('0x28')]||_0xb4c7('0x29');this[_0xb4c7('0x2a')]=_0x898b7['dialPredictiveOptimizationPercentage']||0.03;this[_0xb4c7('0x2b')]=_0x898b7['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x898b7[_0xb4c7('0x2c')]||_0xb4c7('0x2d');this[_0xb4c7('0x2e')]=_0x898b7[_0xb4c7('0x2e')]||_0xb4c7('0x2d');this[_0xb4c7('0x2f')]=_0x898b7[_0xb4c7('0x2f')]||0x1e;this[_0xb4c7('0x30')]=_0x898b7['dialQueueOptions']||_0xb4c7('0x31');this[_0xb4c7('0x32')]=_0x898b7[_0xb4c7('0x32')]||0x3;this[_0xb4c7('0x33')]=_0x898b7[_0xb4c7('0x33')]||undefined;this['dialCongestionMaxRetry']=_0x898b7[_0xb4c7('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x898b7[_0xb4c7('0x35')]||0x96;this[_0xb4c7('0x36')]=_0x898b7[_0xb4c7('0x36')]||0x3;this['dialBusyRetryFrequency']=_0x898b7['dialBusyRetryFrequency']||0x96;this[_0xb4c7('0x37')]=_0x898b7[_0xb4c7('0x37')]||0x3;this[_0xb4c7('0x38')]=_0x898b7[_0xb4c7('0x38')]||0x96;this[_0xb4c7('0x39')]=_0x898b7[_0xb4c7('0x39')]||0x3;this[_0xb4c7('0x3a')]=_0x898b7[_0xb4c7('0x3a')]||0x96;this[_0xb4c7('0x3b')]=_0x898b7[_0xb4c7('0x3b')]||0x3;this[_0xb4c7('0x3c')]=_0x898b7[_0xb4c7('0x3c')]||0x96;this[_0xb4c7('0x3d')]=_0x898b7['dialAbandonedMaxRetry']||0x3;this[_0xb4c7('0x3e')]=_0x898b7[_0xb4c7('0x3e')]||0x96;this[_0xb4c7('0x3f')]=_0x898b7['dialMachineMaxRetry']||0x3;this[_0xb4c7('0x40')]=_0x898b7['dialMachineRetryFrequency']||0x96;this[_0xb4c7('0x41')]=_0x898b7[_0xb4c7('0x41')]||0x3;this[_0xb4c7('0x42')]=_0x898b7[_0xb4c7('0x42')]||0x96;this[_0xb4c7('0x43')]=_0x898b7['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x898b7[_0xb4c7('0x44')]||0x4;this[_0xb4c7('0x45')]=_0x898b7['Trunk']?_0x898b7[_0xb4c7('0x45')]:undefined;this[_0xb4c7('0x46')]=_0x898b7['TrunkBackup']?_0x898b7['TrunkBackup']:undefined;this[_0xb4c7('0x47')]=_0x898b7[_0xb4c7('0x47')]||undefined;this['Interval']=_0x898b7[_0xb4c7('0x48')]?_0x898b7[_0xb4c7('0x48')]:undefined;this['dialOrderByScheduledAt']=_0x898b7[_0xb4c7('0x49')]||_0xb4c7('0x4a');this[_0xb4c7('0x4b')]=_0x898b7[_0xb4c7('0x4b')]||undefined;this[_0xb4c7('0x4c')]=_0x898b7[_0xb4c7('0x4c')]||undefined;this['strategy']=strategy[_0x898b7[_0xb4c7('0x4d')]];this['queueStatusComplete']=!![];this[_0xb4c7('0x4e')]=_0x898b7['dialAMDActive']||![];this[_0xb4c7('0x4f')]=_0x898b7[_0xb4c7('0x4f')];this[_0xb4c7('0x50')]=_0x898b7[_0xb4c7('0x50')];this[_0xb4c7('0x51')]=_0x898b7[_0xb4c7('0x51')];this[_0xb4c7('0x52')]=_0x898b7[_0xb4c7('0x52')];this[_0xb4c7('0x53')]=_0x898b7[_0xb4c7('0x53')];this[_0xb4c7('0x54')]=_0x898b7[_0xb4c7('0x54')];this['dialAMDMaximumNumberOfWords']=_0x898b7[_0xb4c7('0x55')];this[_0xb4c7('0x56')]=_0x898b7[_0xb4c7('0x56')];this['dialAMDMaximumWordLength']=_0x898b7['dialAMDMaximumWordLength'];this[_0xb4c7('0x57')]=0x0;this[_0xb4c7('0x58')]=0x0;this[_0xb4c7('0x59')]=_0x898b7['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xb4c7('0x5a')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xb4c7('0x5b')]=0x0;this[_0xb4c7('0x5c')]=0x0;this[_0xb4c7('0x5d')]=0x0;this[_0xb4c7('0x5e')]=0x0;this[_0xb4c7('0x5f')]=0x0;this[_0xb4c7('0x60')]=0x0;this[_0xb4c7('0x61')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xb4c7('0x62')]=0x0;this['outboundReCallsDay']=0x0;this[_0xb4c7('0x63')]=0x0;this[_0xb4c7('0x64')]=undefined;this[_0xb4c7('0x65')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xb4c7('0x66')]=0x0;this[_0xb4c7('0x67')]=0x0;this[_0xb4c7('0x68')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xb4c7('0x69')]=0x0;this[_0xb4c7('0x6a')]=0x0;this[_0xb4c7('0x6b')]=0x0;this[_0xb4c7('0x6c')]=0x0;this[_0xb4c7('0x6d')]=_0x898b7[_0xb4c7('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x898b7['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xb4c7('0x6f')]=0x0;this[_0xb4c7('0x70')]=0x0;this[_0xb4c7('0x71')]=0x1;this[_0xb4c7('0x72')]=0x0;this[_0xb4c7('0x73')]=0x0;this[_0xb4c7('0x74')]=0x0;this[_0xb4c7('0x75')]=0x0;this[_0xb4c7('0x76')]=_0x898b7['dialRecallMeTimeout']||0x1e;this[_0xb4c7('0x77')]=_0x898b7[_0xb4c7('0x77')]||![];this[_0xb4c7('0x78')]=!!_0x898b7['dialPreviewAutoRecallMe']||![];this[_0xb4c7('0x79')]=!!_0x898b7[_0xb4c7('0x79')]||![];this[_0xb4c7('0x7a')]=_0x898b7[_0xb4c7('0x7a')]||undefined;this[_0xb4c7('0x7b')]=_0x898b7[_0xb4c7('0x7b')]||![];this[_0xb4c7('0x7c')]=_0x898b7[_0xb4c7('0x7c')]||![];this[_0xb4c7('0x9')]=monitorFormat[_0x898b7['monitor_format']]?monitorFormat[_0x898b7['monitor_format']]:undefined;this[_0xb4c7('0x7d')]=_0x898b7[_0xb4c7('0x7d')]||![];this[_0xb4c7('0x7e')]=_0x898b7[_0xb4c7('0x7e')]?_0x898b7[_0xb4c7('0x7e')]:undefined;this[_0xb4c7('0x7f')]=![];}module[_0xb4c7('0x80')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 788b4bd..3c8e52e 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 _0x19da=['total','name','abandoned','available','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','loggedIn','paused','talking','waiting','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration'];(function(_0x1a632b,_0x485673){var _0x44c1df=function(_0xd4db2a){while(--_0xd4db2a){_0x1a632b['push'](_0x1a632b['shift']());}};_0x44c1df(++_0x485673);}(_0x19da,0x9f));var _0xa19d=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0x19da[_0x3dea7d];return _0x53919a;};'use strict';var INBOUND_COUNTERS=['available',_0xa19d('0x0'),'loggedInDb',_0xa19d('0x1'),'ringing',_0xa19d('0x2'),_0xa19d('0x3')];var OUTBOUND_COUNTERS=['available',_0xa19d('0x4'),_0xa19d('0x5'),'loggedIn',_0xa19d('0x6'),_0xa19d('0x7'),_0xa19d('0x8'),_0xa19d('0x9'),_0xa19d('0xa'),_0xa19d('0xb'),_0xa19d('0xc'),'outboundNoAnswerCallsDay',_0xa19d('0xd'),_0xa19d('0xe'),_0xa19d('0xf'),'outboundUnknownCallsDay',_0xa19d('0x1'),_0xa19d('0x10'),_0xa19d('0x2'),_0xa19d('0x11'),_0xa19d('0x12'),_0xa19d('0x13'),'waiting'];function VoiceQueueSummary(_0x547799){this['id']=_0x547799['id'];this[_0xa19d('0x14')]=_0x547799[_0xa19d('0x14')];this['strategy']=_0x547799['strategy'];this[_0xa19d('0x15')]=_0x547799[_0xa19d('0x15')]||0x0;this['answered']=_0x547799[_0xa19d('0x4')]||0x0;this[_0xa19d('0x16')]=_0x547799[_0xa19d('0x16')]||0x0;this['busy']=_0x547799[_0xa19d('0x17')]||0x0;this['inUse']=_0x547799[_0xa19d('0x5')]||0x0;this[_0xa19d('0x18')]=_0x547799[_0xa19d('0x18')]||0x0;this[_0xa19d('0x0')]=_0x547799[_0xa19d('0x0')]||0x0;this[_0xa19d('0x6')]=_0x547799[_0xa19d('0x6')]||0x0;this[_0xa19d('0x19')]=_0x547799['onHold']||0x0;this[_0xa19d('0x1a')]=_0x547799['notInUse']||0x0;this[_0xa19d('0x1')]=_0x547799[_0xa19d('0x1')]||0x0;this[_0xa19d('0x1b')]=_0x547799[_0xa19d('0x1b')]||0x0;this[_0xa19d('0x1c')]=_0x547799[_0xa19d('0x1c')];this[_0xa19d('0x11')]=_0x547799['sumBillable'];this[_0xa19d('0x12')]=_0x547799[_0xa19d('0x12')];this[_0xa19d('0x1d')]=_0x547799[_0xa19d('0x1d')]||0x0;this[_0xa19d('0x2')]=_0x547799[_0xa19d('0x2')]||0x0;this[_0xa19d('0x13')]=_0x547799[_0xa19d('0x13')]||0x0;this[_0xa19d('0x1e')]=_0x547799['type'];this[_0xa19d('0x1f')]=_0x547799['unavailable']||0x0;this[_0xa19d('0x20')]=_0x547799[_0xa19d('0x20')]||0x0;this[_0xa19d('0x21')]=_0x547799[_0xa19d('0x21')]||0x0;this[_0xa19d('0x3')]=_0x547799[_0xa19d('0x3')]||0x0;if(_0x547799[_0xa19d('0x1e')]===_0xa19d('0x22')){this[_0xa19d('0x10')]=_0x547799[_0xa19d('0x10')]||0x0;this[_0xa19d('0x23')]=_0x547799[_0xa19d('0x23')];this[_0xa19d('0x24')]=_0x547799[_0xa19d('0x24')];this[_0xa19d('0x25')]=_0x547799[_0xa19d('0x25')];this[_0xa19d('0x26')]=_0x547799[_0xa19d('0x26')];this[_0xa19d('0x27')]=_0x547799[_0xa19d('0x27')];this[_0xa19d('0x28')]=_0x547799['dialPrefix'];this['temp']=_0x547799['temp'];this[_0xa19d('0x29')]=_0x547799[_0xa19d('0x29')];this[_0xa19d('0x9')]=_0x547799[_0xa19d('0x9')];this[_0xa19d('0xa')]=_0x547799['outboundBlacklistCallsDay'];this[_0xa19d('0xb')]=_0x547799[_0xa19d('0xb')];this[_0xa19d('0xc')]=_0x547799[_0xa19d('0xc')];this['outboundDropCallsDayACS']=_0x547799[_0xa19d('0x2a')];this[_0xa19d('0x2b')]=_0x547799[_0xa19d('0x2b')];this['outboundDropCallsDayTimeout']=_0x547799['outboundDropCallsDayTimeout'];this[_0xa19d('0x2c')]=_0x547799[_0xa19d('0x2c')];this['outboundNoSuchCallsDay']=_0x547799[_0xa19d('0xd')];this[_0xa19d('0x2d')]=_0x547799['outboundOriginateFailureCallsDay'];this[_0xa19d('0xe')]=_0x547799[_0xa19d('0xe')];this[_0xa19d('0xf')]=_0x547799[_0xa19d('0xf')];this[_0xa19d('0x2e')]=_0x547799['outboundUnknownCallsDay'];this[_0xa19d('0x2f')]=_0x547799[_0xa19d('0x2f')];this[_0xa19d('0x30')]=_0x547799[_0xa19d('0x30')];this[_0xa19d('0x31')]=_0x547799['predictiveIntervalAvgTalktime'];this[_0xa19d('0x32')]=_0x547799[_0xa19d('0x32')];this[_0xa19d('0x33')]=_0x547799[_0xa19d('0x33')];this[_0xa19d('0x34')]=_0x547799[_0xa19d('0x34')];this[_0xa19d('0x35')]=_0x547799[_0xa19d('0x35')];this['predictiveIntervalHitRate']=_0x547799['predictiveIntervalHitRate'];this[_0xa19d('0x36')]=_0x547799['predictiveIntervalMultiplicativeFactor'];this[_0xa19d('0x37')]=_0x547799[_0xa19d('0x37')];this['predictiveIntervalAvailable']=_0x547799[_0xa19d('0x38')];this[_0xa19d('0x39')]=_0x547799[_0xa19d('0x39')];this['originated']=_0x547799[_0xa19d('0x7')];this[_0xa19d('0x3a')]=_0x547799[_0xa19d('0x3a')];this['erlangCallToSecond']=_0x547799[_0xa19d('0x3b')];this[_0xa19d('0x3c')]=_0x547799[_0xa19d('0x3c')];this[_0xa19d('0x3d')]=_0x547799[_0xa19d('0x3d')];this[_0xa19d('0x3e')]=_0x547799[_0xa19d('0x3e')];this[_0xa19d('0x3f')]=_0x547799[_0xa19d('0x3f')];this[_0xa19d('0x40')]=_0x547799[_0xa19d('0x40')];this['statusMessage']=_0x547799[_0xa19d('0x41')];}if(_0x547799[_0xa19d('0x42')]){this['Trunk']={'id':_0x547799[_0xa19d('0x42')]['id'],'name':_0x547799[_0xa19d('0x42')][_0xa19d('0x14')],'active':_0x547799[_0xa19d('0x42')][_0xa19d('0x43')],'callerid':_0x547799[_0xa19d('0x42')][_0xa19d('0x44')]};}}VoiceQueueSummary[_0xa19d('0x45')][_0xa19d('0x46')]=function(_0x23d917,_0x5157e6,_0x32711c,_0xf561b1){this[_0xa19d('0x6')]=0x0;this[_0xa19d('0x2')]=0x0;this[_0xa19d('0x1')]=0x0;this[_0xa19d('0x20')]=0x0;this[_0xa19d('0x1a')]=0x0;this['inUse']=0x0;this['busy']=0x0;this['invalid']=0x0;this['unavailable']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0xa19d('0x19')]=0x0;if(_0x32711c){if(_0x32711c['available']){this[_0xa19d('0x16')]=Number(_0x32711c[_0xa19d('0x16')]);}if(_0x32711c['loggedin']){this[_0xa19d('0x0')]=Number(_0x32711c[_0xa19d('0x47')]);}if(_0x32711c['callers']){this[_0xa19d('0x3')]=Number(_0x32711c[_0xa19d('0x48')]);}}for(var _0x2c3d44=0x0;_0x2c3d44<_0x23d917[_0xa19d('0x49')];_0x2c3d44++){var _0x484491=_0x5157e6[_0xa19d('0x4a')+_0x23d917[_0x2c3d44]['name']];if(_0x484491&&_0x484491[_0xa19d('0x4b')]){this['loggedInDb']+=0x1;}if(_0x23d917[_0x2c3d44][_0xa19d('0x4c')]==='1'){this[_0xa19d('0x2')]+=0x1;}if(_0x23d917[_0x2c3d44][_0xa19d('0x1')]==='1'&&!['2','7','8'][_0xa19d('0x4d')](_0x23d917[_0x2c3d44][_0xa19d('0x4e')])){this['paused']+=0x1;}switch(_0x23d917[_0x2c3d44][_0xa19d('0x4e')]){case'0':this[_0xa19d('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xa19d('0x5')]+=0x1;break;case'3':this[_0xa19d('0x17')]+=0x1;break;case'4':this[_0xa19d('0x18')]+=0x1;break;case'5':this[_0xa19d('0x1f')]+=0x1;break;case'6':this[_0xa19d('0x1b')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xa19d('0x19')]+=0x1;break;}}if(this[_0xa19d('0x24')]===_0xa19d('0x4f')){var _0x391d7c=Object[_0xa19d('0x50')](_0xf561b1);for(var _0x15904f=0x0;_0x15904f<_0x391d7c[_0xa19d('0x49')];_0x15904f++){var _0x1430cd=_0x391d7c[_0x15904f];var _0x1a95a8=_0xf561b1[_0x1430cd];if(_0x1a95a8[_0xa19d('0x51')]===this[_0xa19d('0x14')]&&_0x1a95a8['type']==='dialer'&&_0x1a95a8[_0xa19d('0x52')]==='xcally-motion-preview'){this[_0xa19d('0x2')]+=0x1;}}if(this[_0xa19d('0x2')]>this['inUse']){this[_0xa19d('0x2')]=this[_0xa19d('0x5')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xa19d('0x45')][_0xa19d('0x53')]=function(_0x491896){var _0x2f5c2b=![];if(_0x491896){_0x2f5c2b=INBOUND_COUNTERS[_0xa19d('0x54')](function(_0x5c646e){return this[_0x5c646e]!==_0x491896[_0x5c646e];},this);}return _0x2f5c2b;};VoiceQueueSummary[_0xa19d('0x45')][_0xa19d('0x55')]=function(_0x13a2b5){var _0x6d2418=![];var _0xdbd087=![];var _0x28e948=![];if(_0x13a2b5){_0x6d2418=this[_0xa19d('0x24')]!==_0x13a2b5['dialMethod']||this[_0xa19d('0x23')]!==_0x13a2b5[_0xa19d('0x23')]||this[_0xa19d('0x40')]!==_0x13a2b5[_0xa19d('0x40')]||this[_0xa19d('0x41')]!==_0x13a2b5[_0xa19d('0x41')];_0xdbd087=OUTBOUND_COUNTERS[_0xa19d('0x54')](function(_0x14ef63){return this[_0x14ef63]!==_0x13a2b5[_0x14ef63];},this);if(this[_0xa19d('0x42')]&&_0x13a2b5[_0xa19d('0x42')]){_0x28e948=this[_0xa19d('0x42')][_0xa19d('0x14')]!==_0x13a2b5['Trunk'][_0xa19d('0x14')]||this['Trunk'][_0xa19d('0x43')]!==_0x13a2b5[_0xa19d('0x42')][_0xa19d('0x43')];}}return _0x6d2418||_0xdbd087||_0x28e948;};VoiceQueueSummary[_0xa19d('0x45')][_0xa19d('0x56')]=function(_0xe6d631){this[_0xa19d('0x4')]=_0xe6d631[_0xa19d('0x4')];this['message']=_0xe6d631[_0xa19d('0x40')];this[_0xa19d('0x41')]=_0xe6d631[_0xa19d('0x41')];this[_0xa19d('0x7')]=_0xe6d631[_0xa19d('0x7')];this[_0xa19d('0x8')]=_0xe6d631[_0xa19d('0x8')];this[_0xa19d('0x9')]=_0xe6d631[_0xa19d('0x9')];this[_0xa19d('0xa')]=_0xe6d631[_0xa19d('0xa')];this[_0xa19d('0xb')]=_0xe6d631[_0xa19d('0xb')];this['outboundCongestionCallsDay']=_0xe6d631[_0xa19d('0xc')];this[_0xa19d('0x2c')]=_0xe6d631[_0xa19d('0x2c')];this[_0xa19d('0xd')]=_0xe6d631[_0xa19d('0xd')];this[_0xa19d('0xe')]=_0xe6d631['outboundReCallsDay'];this[_0xa19d('0xf')]=_0xe6d631[_0xa19d('0xf')];this[_0xa19d('0x2e')]=_0xe6d631[_0xa19d('0x2e')];this[_0xa19d('0x11')]=_0xe6d631[_0xa19d('0x11')];this[_0xa19d('0x12')]=_0xe6d631[_0xa19d('0x12')];this['total']=_0xe6d631[_0xa19d('0x13')];if(this[_0xa19d('0x24')]===_0xa19d('0x57')){this['pTalking']=_0xe6d631[_0xa19d('0x10')];}};module[_0xa19d('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x1a61=['statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','length','SIP/','online','incall','includes','status','unknown','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','message','updateReportFromOutboundQueue','preview','exports','available','loggedInDb','ringing','talking','waiting','loggedIn','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','sumBillable','total','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','paused','ringInUse','sumDuration','sumHoldTime','type','unavailable','unmanaged','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive'];(function(_0x4e5504,_0x2be6a6){var _0x424a9e=function(_0x245b10){while(--_0x245b10){_0x4e5504['push'](_0x4e5504['shift']());}};_0x424a9e(++_0x2be6a6);}(_0x1a61,0x1e6));var _0x11a6=function(_0x4a09fd,_0x158bc8){_0x4a09fd=_0x4a09fd-0x0;var _0x178c79=_0x1a61[_0x4a09fd];return _0x178c79;};'use strict';var INBOUND_COUNTERS=[_0x11a6('0x0'),'loggedIn',_0x11a6('0x1'),'paused',_0x11a6('0x2'),_0x11a6('0x3'),_0x11a6('0x4')];var OUTBOUND_COUNTERS=[_0x11a6('0x0'),'answered','inUse',_0x11a6('0x5'),_0x11a6('0x1'),'originated',_0x11a6('0x6'),_0x11a6('0x7'),_0x11a6('0x8'),_0x11a6('0x9'),_0x11a6('0xa'),_0x11a6('0xb'),_0x11a6('0xc'),_0x11a6('0xd'),_0x11a6('0xe'),'outboundUnknownCallsDay','paused','pTalking',_0x11a6('0x3'),_0x11a6('0xf'),'sumDuration',_0x11a6('0x10'),_0x11a6('0x4')];function VoiceQueueSummary(_0x172908){this['id']=_0x172908['id'];this[_0x11a6('0x11')]=_0x172908[_0x11a6('0x11')];this[_0x11a6('0x12')]=_0x172908['strategy'];this['abandoned']=_0x172908[_0x11a6('0x13')]||0x0;this[_0x11a6('0x14')]=_0x172908['answered']||0x0;this[_0x11a6('0x0')]=_0x172908[_0x11a6('0x0')]||0x0;this['busy']=_0x172908[_0x11a6('0x15')]||0x0;this[_0x11a6('0x16')]=_0x172908['inUse']||0x0;this[_0x11a6('0x17')]=_0x172908[_0x11a6('0x17')]||0x0;this[_0x11a6('0x5')]=_0x172908[_0x11a6('0x5')]||0x0;this['loggedInDb']=_0x172908[_0x11a6('0x1')]||0x0;this[_0x11a6('0x18')]=_0x172908[_0x11a6('0x18')]||0x0;this[_0x11a6('0x19')]=_0x172908[_0x11a6('0x19')]||0x0;this[_0x11a6('0x1a')]=_0x172908[_0x11a6('0x1a')]||0x0;this[_0x11a6('0x2')]=_0x172908[_0x11a6('0x2')]||0x0;this[_0x11a6('0x1b')]=_0x172908[_0x11a6('0x1b')];this[_0x11a6('0xf')]=_0x172908[_0x11a6('0xf')];this[_0x11a6('0x1c')]=_0x172908['sumDuration'];this[_0x11a6('0x1d')]=_0x172908[_0x11a6('0x1d')]||0x0;this[_0x11a6('0x3')]=_0x172908[_0x11a6('0x3')]||0x0;this['total']=_0x172908['total']||0x0;this[_0x11a6('0x1e')]=_0x172908['type'];this[_0x11a6('0x1f')]=_0x172908['unavailable']||0x0;this['unknown']=_0x172908['unknown']||0x0;this['unmanaged']=_0x172908[_0x11a6('0x20')]||0x0;this['waiting']=_0x172908[_0x11a6('0x4')]||0x0;if(_0x172908[_0x11a6('0x1e')]==='outbound'){this['pTalking']=_0x172908[_0x11a6('0x21')]||0x0;this[_0x11a6('0x22')]=_0x172908[_0x11a6('0x22')];this[_0x11a6('0x23')]=_0x172908[_0x11a6('0x23')];this[_0x11a6('0x24')]=_0x172908[_0x11a6('0x24')];this[_0x11a6('0x25')]=_0x172908[_0x11a6('0x25')];this[_0x11a6('0x26')]=_0x172908[_0x11a6('0x26')];this[_0x11a6('0x27')]=_0x172908[_0x11a6('0x27')];this[_0x11a6('0x28')]=_0x172908[_0x11a6('0x28')];this[_0x11a6('0x29')]=_0x172908[_0x11a6('0x29')];this[_0x11a6('0x7')]=_0x172908[_0x11a6('0x7')];this[_0x11a6('0x8')]=_0x172908[_0x11a6('0x8')];this[_0x11a6('0x9')]=_0x172908[_0x11a6('0x9')];this[_0x11a6('0xa')]=_0x172908[_0x11a6('0xa')];this['outboundDropCallsDayACS']=_0x172908[_0x11a6('0x2a')];this['outboundDropCallsDayCallersExit']=_0x172908[_0x11a6('0x2b')];this[_0x11a6('0x2c')]=_0x172908[_0x11a6('0x2c')];this[_0x11a6('0xb')]=_0x172908[_0x11a6('0xb')];this['outboundNoSuchCallsDay']=_0x172908[_0x11a6('0xc')];this[_0x11a6('0x2d')]=_0x172908['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x172908['outboundReCallsDay'];this[_0x11a6('0xe')]=_0x172908[_0x11a6('0xe')];this['outboundUnknownCallsDay']=_0x172908[_0x11a6('0x2e')];this[_0x11a6('0x2f')]=_0x172908[_0x11a6('0x2f')];this[_0x11a6('0x30')]=_0x172908[_0x11a6('0x30')];this['predictiveIntervalAvgTalktime']=_0x172908[_0x11a6('0x31')];this[_0x11a6('0x32')]=_0x172908[_0x11a6('0x32')];this[_0x11a6('0x33')]=_0x172908[_0x11a6('0x33')];this[_0x11a6('0x34')]=_0x172908[_0x11a6('0x34')];this[_0x11a6('0x35')]=_0x172908[_0x11a6('0x35')];this[_0x11a6('0x36')]=_0x172908[_0x11a6('0x36')];this[_0x11a6('0x37')]=_0x172908[_0x11a6('0x37')];this['predictiveIntervalPauses']=_0x172908[_0x11a6('0x38')];this[_0x11a6('0x39')]=_0x172908[_0x11a6('0x39')];this[_0x11a6('0x3a')]=_0x172908[_0x11a6('0x3a')];this[_0x11a6('0x3b')]=_0x172908[_0x11a6('0x3b')];this[_0x11a6('0x3c')]=_0x172908[_0x11a6('0x3c')];this['erlangCallToSecond']=_0x172908[_0x11a6('0x3d')];this[_0x11a6('0x3e')]=_0x172908['erlangAbandonmentRate'];this[_0x11a6('0x3f')]=_0x172908[_0x11a6('0x3f')];this[_0x11a6('0x40')]=_0x172908['startPredictive'];this[_0x11a6('0x41')]=_0x172908[_0x11a6('0x41')];this['message']=_0x172908['message'];this[_0x11a6('0x42')]=_0x172908['statusMessage'];}if(_0x172908[_0x11a6('0x43')]){this[_0x11a6('0x43')]={'id':_0x172908['Trunk']['id'],'name':_0x172908[_0x11a6('0x43')]['name'],'active':_0x172908[_0x11a6('0x43')][_0x11a6('0x44')],'callerid':_0x172908['Trunk'][_0x11a6('0x45')]};}}VoiceQueueSummary[_0x11a6('0x46')][_0x11a6('0x47')]=function(_0xd769e4,_0x4289ea,_0x33effb,_0x2a841c){this['loggedInDb']=0x0;this[_0x11a6('0x3')]=0x0;this[_0x11a6('0x1a')]=0x0;this['unknown']=0x0;this[_0x11a6('0x19')]=0x0;this[_0x11a6('0x16')]=0x0;this['busy']=0x0;this[_0x11a6('0x17')]=0x0;this[_0x11a6('0x1f')]=0x0;this[_0x11a6('0x2')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x33effb){if(_0x33effb['available']){this['available']=Number(_0x33effb[_0x11a6('0x0')]);}if(_0x33effb['loggedin']){this[_0x11a6('0x5')]=Number(_0x33effb[_0x11a6('0x48')]);}if(_0x33effb['callers']){this['waiting']=Number(_0x33effb['callers']);}}for(var _0x197fcf=0x0;_0x197fcf<_0xd769e4[_0x11a6('0x49')];_0x197fcf++){var _0x5c1f9e=_0x4289ea[_0x11a6('0x4a')+_0xd769e4[_0x197fcf]['name']];if(_0x5c1f9e&&_0x5c1f9e[_0x11a6('0x4b')]){this['loggedInDb']+=0x1;}if(_0xd769e4[_0x197fcf][_0x11a6('0x4c')]==='1'){this[_0x11a6('0x3')]+=0x1;}if(_0xd769e4[_0x197fcf]['paused']==='1'&&!['2','7','8'][_0x11a6('0x4d')](_0xd769e4[_0x197fcf]['status'])){this[_0x11a6('0x1a')]+=0x1;}switch(_0xd769e4[_0x197fcf][_0x11a6('0x4e')]){case'0':this[_0x11a6('0x4f')]+=0x1;break;case'1':this[_0x11a6('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x11a6('0x15')]+=0x1;break;case'4':this[_0x11a6('0x17')]+=0x1;break;case'5':this[_0x11a6('0x1f')]+=0x1;break;case'6':this[_0x11a6('0x2')]+=0x1;break;case'7':this[_0x11a6('0x1b')]+=0x1;break;case'8':this[_0x11a6('0x18')]+=0x1;break;}}if(this['dialMethod']===_0x11a6('0x50')){var _0xc150aa=Object[_0x11a6('0x51')](_0x2a841c);for(var _0x5b8bbf=0x0;_0x5b8bbf<_0xc150aa[_0x11a6('0x49')];_0x5b8bbf++){var _0x1cb625=_0xc150aa[_0x5b8bbf];var _0x367e5c=_0x2a841c[_0x1cb625];if(_0x367e5c[_0x11a6('0x52')]===this[_0x11a6('0x11')]&&_0x367e5c[_0x11a6('0x1e')]===_0x11a6('0x53')&&_0x367e5c[_0x11a6('0x54')]===_0x11a6('0x55')){this[_0x11a6('0x3')]+=0x1;}}if(this[_0x11a6('0x3')]>this[_0x11a6('0x16')]){this[_0x11a6('0x3')]=this[_0x11a6('0x16')];}this[_0x11a6('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x11a6('0x46')][_0x11a6('0x56')]=function(_0x37912e){var _0x51b7d8=![];if(_0x37912e){_0x51b7d8=INBOUND_COUNTERS[_0x11a6('0x57')](function(_0x5e7235){return this[_0x5e7235]!==_0x37912e[_0x5e7235];},this);}return _0x51b7d8;};VoiceQueueSummary[_0x11a6('0x46')]['compareToOutboundQueue']=function(_0x3db196){var _0x3ecc9c=![];var _0x360d27=![];var _0x324560=![];if(_0x3db196){_0x3ecc9c=this['dialMethod']!==_0x3db196[_0x11a6('0x23')]||this[_0x11a6('0x22')]!==_0x3db196['dialActive']||this[_0x11a6('0x58')]!==_0x3db196[_0x11a6('0x58')]||this[_0x11a6('0x42')]!==_0x3db196[_0x11a6('0x42')];_0x360d27=OUTBOUND_COUNTERS[_0x11a6('0x57')](function(_0x5a0927){return this[_0x5a0927]!==_0x3db196[_0x5a0927];},this);if(this[_0x11a6('0x43')]&&_0x3db196[_0x11a6('0x43')]){_0x324560=this[_0x11a6('0x43')][_0x11a6('0x11')]!==_0x3db196[_0x11a6('0x43')]['name']||this[_0x11a6('0x43')][_0x11a6('0x44')]!==_0x3db196[_0x11a6('0x43')][_0x11a6('0x44')];}}return _0x3ecc9c||_0x360d27||_0x324560;};VoiceQueueSummary[_0x11a6('0x46')][_0x11a6('0x59')]=function(_0x53f92c){this[_0x11a6('0x14')]=_0x53f92c[_0x11a6('0x14')];this[_0x11a6('0x58')]=_0x53f92c[_0x11a6('0x58')];this[_0x11a6('0x42')]=_0x53f92c[_0x11a6('0x42')];this[_0x11a6('0x3b')]=_0x53f92c[_0x11a6('0x3b')];this['outboundAbandonedCallsDay']=_0x53f92c[_0x11a6('0x6')];this[_0x11a6('0x7')]=_0x53f92c[_0x11a6('0x7')];this['outboundBlacklistCallsDay']=_0x53f92c[_0x11a6('0x8')];this[_0x11a6('0x9')]=_0x53f92c[_0x11a6('0x9')];this['outboundCongestionCallsDay']=_0x53f92c[_0x11a6('0xa')];this[_0x11a6('0xb')]=_0x53f92c[_0x11a6('0xb')];this[_0x11a6('0xc')]=_0x53f92c[_0x11a6('0xc')];this[_0x11a6('0xd')]=_0x53f92c['outboundReCallsDay'];this[_0x11a6('0xe')]=_0x53f92c[_0x11a6('0xe')];this[_0x11a6('0x2e')]=_0x53f92c['outboundUnknownCallsDay'];this[_0x11a6('0xf')]=_0x53f92c[_0x11a6('0xf')];this[_0x11a6('0x1c')]=_0x53f92c[_0x11a6('0x1c')];this[_0x11a6('0x10')]=_0x53f92c['total'];if(this[_0x11a6('0x23')]===_0x11a6('0x5a')){this[_0x11a6('0x21')]=_0x53f92c[_0x11a6('0x21')];}};module[_0x11a6('0x5b')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index c9c81b1..a30d44f 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 _0xb415=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x597070,_0x3f577b){var _0xea6b05=function(_0x2e86b6){while(--_0x2e86b6){_0x597070['push'](_0x597070['shift']());}};_0xea6b05(++_0x3f577b);}(_0xb415,0x131));var _0x5b41=function(_0x4c929a,_0x5e6cc7){_0x4c929a=_0x4c929a-0x0;var _0x25dec1=_0xb415[_0x4c929a];return _0x25dec1;};'use strict';function VtigerAccount(_0x5d7645){this['id']=_0x5d7645['id']||0x0;this[_0x5b41('0x0')]=_0x5d7645[_0x5b41('0x0')]||'';this[_0x5b41('0x1')]=_0x5d7645['username']||'';this[_0x5b41('0x2')]=_0x5d7645[_0x5b41('0x2')]||'';this[_0x5b41('0x3')]=_0x5d7645[_0x5b41('0x3')]||'';this['serverUrl']=_0x5d7645[_0x5b41('0x4')]||'';this[_0x5b41('0x5')]=_0x5d7645[_0x5b41('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xa729=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x505f46,_0x4830ad){var _0x369e94=function(_0x204423){while(--_0x204423){_0x505f46['push'](_0x505f46['shift']());}};_0x369e94(++_0x4830ad);}(_0xa729,0x160));var _0x9a72=function(_0x552c03,_0x247fab){_0x552c03=_0x552c03-0x0;var _0x25e104=_0xa729[_0x552c03];return _0x25e104;};'use strict';function VtigerAccount(_0x3c8adc){this['id']=_0x3c8adc['id']||0x0;this[_0x9a72('0x0')]=_0x3c8adc[_0x9a72('0x0')]||'';this['username']=_0x3c8adc[_0x9a72('0x1')]||'';this['accessKey']=_0x3c8adc['accessKey']||'';this[_0x9a72('0x2')]=_0x3c8adc[_0x9a72('0x2')]||'';this[_0x9a72('0x3')]=_0x3c8adc[_0x9a72('0x3')]||'';this[_0x9a72('0x4')]=_0x3c8adc[_0x9a72('0x4')]||{};}module[_0x9a72('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index f3700c9..087f565 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 _0x91e7=['token','remoteUri','authType','type','integrationTab','serverUrl','exports','name','username','password'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x91e7,0x15b));var _0x791e=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0x91e7[_0x1486e5];return _0x29d89b;};'use strict';function ZendeskAccount(_0x2f3ef8){this['id']=_0x2f3ef8['id']||0x0;this['name']=_0x2f3ef8[_0x791e('0x0')]||'';this[_0x791e('0x1')]=_0x2f3ef8[_0x791e('0x1')]||'';this[_0x791e('0x2')]=_0x2f3ef8[_0x791e('0x2')]||'';this[_0x791e('0x3')]=_0x2f3ef8['token']||'';this[_0x791e('0x4')]=_0x2f3ef8[_0x791e('0x4')]||'';this[_0x791e('0x5')]=_0x2f3ef8[_0x791e('0x5')]||'';this[_0x791e('0x6')]=_0x2f3ef8['type']||_0x791e('0x7');this[_0x791e('0x8')]=_0x2f3ef8['serverUrl']||'';this['Configurations']=_0x2f3ef8['Configurations']||{};}module[_0x791e('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xb83e=['token','remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x54b8e9,_0x55a1e3){var _0x26fbbf=function(_0x15a75d){while(--_0x15a75d){_0x54b8e9['push'](_0x54b8e9['shift']());}};_0x26fbbf(++_0x55a1e3);}(_0xb83e,0x93));var _0xeb83=function(_0x321246,_0x487944){_0x321246=_0x321246-0x0;var _0x3ab4d8=_0xb83e[_0x321246];return _0x3ab4d8;};'use strict';function ZendeskAccount(_0x15d9ed){this['id']=_0x15d9ed['id']||0x0;this[_0xeb83('0x0')]=_0x15d9ed[_0xeb83('0x0')]||'';this[_0xeb83('0x1')]=_0x15d9ed[_0xeb83('0x1')]||'';this[_0xeb83('0x2')]=_0x15d9ed[_0xeb83('0x2')]||'';this[_0xeb83('0x3')]=_0x15d9ed['token']||'';this[_0xeb83('0x4')]=_0x15d9ed[_0xeb83('0x4')]||'';this[_0xeb83('0x5')]=_0x15d9ed[_0xeb83('0x5')]||'';this['type']=_0x15d9ed['type']||_0xeb83('0x6');this[_0xeb83('0x7')]=_0x15d9ed['serverUrl']||'';this['Configurations']=_0x15d9ed[_0xeb83('0x8')]||{};}module[_0xeb83('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 518d9dc..5e6fa76 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 _0xded3=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x3f88ba,_0x1cc8f2){var _0xd26dc4=function(_0x2e7339){while(--_0x2e7339){_0x3f88ba['push'](_0x3f88ba['shift']());}};_0xd26dc4(++_0x1cc8f2);}(_0xded3,0x127));var _0x3ded=function(_0x5dd1f6,_0x45a64e){_0x5dd1f6=_0x5dd1f6-0x0;var _0x57381b=_0xded3[_0x5dd1f6];return _0x57381b;};'use strict';function ZohoAccount(_0x4d2e33){this['id']=_0x4d2e33['id']||0x0;this[_0x3ded('0x0')]=_0x4d2e33[_0x3ded('0x0')]||'';this[_0x3ded('0x1')]=_0x4d2e33['description']||'';this[_0x3ded('0x2')]=_0x4d2e33[_0x3ded('0x2')]||'';this[_0x3ded('0x3')]=_0x4d2e33[_0x3ded('0x3')]||'';this[_0x3ded('0x4')]=_0x4d2e33['clientId']||'';this[_0x3ded('0x5')]=_0x4d2e33[_0x3ded('0x5')]||'';this[_0x3ded('0x6')]=_0x4d2e33['serverUrl']||'';this['code']=_0x4d2e33[_0x3ded('0x7')]||'';this[_0x3ded('0x8')]=_0x4d2e33[_0x3ded('0x8')]||'';this[_0x3ded('0x9')]=_0x4d2e33[_0x3ded('0x9')]||{};}module[_0x3ded('0xa')]=ZohoAccount; \ No newline at end of file +var _0xbeeb=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x46b1f8,_0x4ab4f5){var _0x26ee58=function(_0x45a283){while(--_0x45a283){_0x46b1f8['push'](_0x46b1f8['shift']());}};_0x26ee58(++_0x4ab4f5);}(_0xbeeb,0x12b));var _0xbbee=function(_0x5c4444,_0x119726){_0x5c4444=_0x5c4444-0x0;var _0x20d93d=_0xbeeb[_0x5c4444];return _0x20d93d;};'use strict';function ZohoAccount(_0x5a5d5a){this['id']=_0x5a5d5a['id']||0x0;this[_0xbbee('0x0')]=_0x5a5d5a['name']||'';this[_0xbbee('0x1')]=_0x5a5d5a[_0xbbee('0x1')]||'';this['host']=_0x5a5d5a[_0xbbee('0x2')]||'';this['zone']=_0x5a5d5a[_0xbbee('0x3')]||'';this[_0xbbee('0x4')]=_0x5a5d5a[_0xbbee('0x4')]||'';this[_0xbbee('0x5')]=_0x5a5d5a[_0xbbee('0x5')]||'';this[_0xbbee('0x6')]=_0x5a5d5a[_0xbbee('0x6')]||'';this['code']=_0x5a5d5a['code']||'';this[_0xbbee('0x7')]=_0x5a5d5a[_0xbbee('0x7')]||'';this[_0xbbee('0x8')]=_0x5a5d5a[_0xbbee('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index e1f104e..da4bb6f 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 _0xbbbc=['idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','string','isNil','uniqueid'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x55c3d3,_0x3a9f5a){_0x55c3d3=_0x55c3d3-0x0;var _0x67f880=_0xbbbc[_0x55c3d3];return _0x67f880;};'use strict';var util=require(_0xcbbb('0x0'));var _=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));function checkNameSurname(_0x4538f9,_0x3ec75b,_0x3e91a2){var _0x464b75='';if(!_['isNil'](_0x3ec75b)&&_0xcbbb('0x3')===typeof _0x3ec75b){_0x464b75+=_0x3ec75b;}if(!_[_0xcbbb('0x4')](_0x3e91a2)&&_0xcbbb('0x3')===typeof _0x3e91a2){_0x464b75+='\x20'+_0x3e91a2;}if(_0x464b75!==''){return _0x464b75;}return _0x4538f9;}function Action(_0x3ccbf6,_0x43ff05,_0x4978a9,_0x388197,_0x1796b4){this[_0xcbbb('0x5')]=_0x4978a9||undefined;this[_0xcbbb('0x6')]=_0x3ccbf6['id'];this[_0xcbbb('0x7')]=_0x43ff05[_0xcbbb('0x8')];this[_0xcbbb('0x9')]=_0x43ff05['type'];this[_0xcbbb('0xa')]='queue';this['dialAnswer']=![];this[_0xcbbb('0xb')]=_['isNil'](_0x3ccbf6[_0xcbbb('0xc')])?undefined:_0x3ccbf6['Agent'][_0xcbbb('0x8')];this[_0xcbbb('0xd')]=this['membername']?util[_0xcbbb('0xe')]('SIP/%s',this[_0xcbbb('0xb')]):_0x388197||undefined;this['calleridname']=checkNameSurname(_0x3ccbf6[_0xcbbb('0xf')][_0xcbbb('0x10')],_0x3ccbf6[_0xcbbb('0xf')]['firstName'],_0x3ccbf6[_0xcbbb('0xf')][_0xcbbb('0x11')]);this[_0xcbbb('0x12')]=_0x3ccbf6[_0xcbbb('0x12')]||![];this['calleridnum']=_0x3ccbf6['phone'];this[_0xcbbb('0x13')]=_0x3ccbf6[_0xcbbb('0x13')];this[_0xcbbb('0x14')]=_0x3ccbf6[_0xcbbb('0x14')]||0x0;this['countcongestionretry']=_0x3ccbf6[_0xcbbb('0x15')]||0x0;this['countnoanswerretry']=_0x3ccbf6[_0xcbbb('0x16')]||0x0;this[_0xcbbb('0x17')]=(_0x3ccbf6[_0xcbbb('0x14')]||0x0)+(_0x3ccbf6['countcongestionretry']||0x0)+(_0x3ccbf6['countnoanswerretry']||0x0)+(_0x3ccbf6['countnosuchnumberretry']||0x0)+(_0x3ccbf6[_0xcbbb('0x18')]||0x0)+(_0x3ccbf6[_0xcbbb('0x19')]||0x0)+(_0x3ccbf6[_0xcbbb('0x1a')]||0x0)+(_0x3ccbf6[_0xcbbb('0x1b')]||0x0);this[_0xcbbb('0x1c')]=_0x3ccbf6[_0xcbbb('0x1c')]||0x0;this[_0xcbbb('0x18')]=_0x3ccbf6[_0xcbbb('0x18')]||0x0;this[_0xcbbb('0x19')]=_0x3ccbf6[_0xcbbb('0x19')]||0x0;this['countmachineretry']=_0x3ccbf6[_0xcbbb('0x1a')]||0x0;this[_0xcbbb('0x1b')]=_0x3ccbf6[_0xcbbb('0x1b')]||0x0;this[_0xcbbb('0x1d')]=_0x3ccbf6[_0xcbbb('0x1d')];this[_0xcbbb('0x1e')]=_0x3ccbf6[_0xcbbb('0x1e')];this[_0xcbbb('0x1f')]=_0x3ccbf6[_0xcbbb('0x1f')];this['recallme']=_0x3ccbf6[_0xcbbb('0x20')];this[_0xcbbb('0x21')]=_0x3ccbf6['ContactId'];this[_0xcbbb('0x22')]=_0x3ccbf6['ListId'];this['UserId']=_[_0xcbbb('0x4')](_0x3ccbf6[_0xcbbb('0xc')])?_0x3ccbf6['UserId']:_0x3ccbf6['Agent']['id'];this['VoiceQueueId']=_0x3ccbf6[_0xcbbb('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xcbbb('0x24')][_0xcbbb('0x25')]=function(){return util[_0xcbbb('0xe')](_0xcbbb('0x26'),this[_0xcbbb('0x27')],this[_0xcbbb('0x28')]);};module[_0xcbbb('0x29')]=Action; \ No newline at end of file +var _0x7334=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone'];(function(_0x461467,_0x81d0dd){var _0x5c47da=function(_0x5a10a8){while(--_0x5a10a8){_0x461467['push'](_0x461467['shift']());}};_0x5c47da(++_0x81d0dd);}(_0x7334,0x184));var _0x4733=function(_0x14cba4,_0x18e68b){_0x14cba4=_0x14cba4-0x0;var _0x144f3f=_0x7334[_0x14cba4];return _0x144f3f;};'use strict';var util=require(_0x4733('0x0'));var _=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));function checkNameSurname(_0x5016ad,_0x59882e,_0x26b8f3){var _0x4b8b5a='';if(!_[_0x4733('0x3')](_0x59882e)&&_0x4733('0x4')===typeof _0x59882e){_0x4b8b5a+=_0x59882e;}if(!_[_0x4733('0x3')](_0x26b8f3)&&_0x4733('0x4')===typeof _0x26b8f3){_0x4b8b5a+='\x20'+_0x26b8f3;}if(_0x4b8b5a!==''){return _0x4b8b5a;}return _0x5016ad;}function Action(_0x2b146d,_0x449ead,_0x16d7cc,_0x283754,_0x12cafa){this[_0x4733('0x5')]=_0x16d7cc||undefined;this[_0x4733('0x6')]=_0x2b146d['id'];this[_0x4733('0x7')]=_0x449ead[_0x4733('0x8')];this[_0x4733('0x9')]=_0x449ead[_0x4733('0x9')];this[_0x4733('0xa')]=_0x4733('0x7');this['dialAnswer']=![];this[_0x4733('0xb')]=_[_0x4733('0x3')](_0x2b146d['Agent'])?undefined:_0x2b146d[_0x4733('0xc')]['name'];this[_0x4733('0xd')]=this[_0x4733('0xb')]?util[_0x4733('0xe')](_0x4733('0xf'),this[_0x4733('0xb')]):_0x283754||undefined;this[_0x4733('0x10')]=checkNameSurname(_0x2b146d[_0x4733('0x11')]['phone'],_0x2b146d[_0x4733('0x11')]['firstName'],_0x2b146d[_0x4733('0x11')][_0x4733('0x12')]);this[_0x4733('0x13')]=_0x2b146d[_0x4733('0x13')]||![];this[_0x4733('0x14')]=_0x2b146d[_0x4733('0x15')];this[_0x4733('0x16')]=_0x2b146d[_0x4733('0x16')];this[_0x4733('0x17')]=_0x2b146d['countbusyretry']||0x0;this[_0x4733('0x18')]=_0x2b146d[_0x4733('0x18')]||0x0;this['countnoanswerretry']=_0x2b146d[_0x4733('0x19')]||0x0;this[_0x4733('0x1a')]=(_0x2b146d[_0x4733('0x17')]||0x0)+(_0x2b146d[_0x4733('0x18')]||0x0)+(_0x2b146d['countnoanswerretry']||0x0)+(_0x2b146d['countnosuchnumberretry']||0x0)+(_0x2b146d[_0x4733('0x1b')]||0x0)+(_0x2b146d[_0x4733('0x1c')]||0x0)+(_0x2b146d['countmachineretry']||0x0)+(_0x2b146d[_0x4733('0x1d')]||0x0);this[_0x4733('0x1e')]=_0x2b146d[_0x4733('0x1e')]||0x0;this[_0x4733('0x1b')]=_0x2b146d['countdropretry']||0x0;this[_0x4733('0x1c')]=_0x2b146d[_0x4733('0x1c')]||0x0;this['countmachineretry']=_0x2b146d[_0x4733('0x1f')]||0x0;this[_0x4733('0x1d')]=_0x2b146d['countagentrejectretry']||0x0;this[_0x4733('0x20')]=_0x2b146d[_0x4733('0x20')];this[_0x4733('0x21')]=_0x2b146d[_0x4733('0x21')];this[_0x4733('0x22')]=_0x2b146d[_0x4733('0x22')];this[_0x4733('0x23')]=_0x2b146d[_0x4733('0x23')];this['ContactId']=_0x2b146d[_0x4733('0x24')];this[_0x4733('0x25')]=_0x2b146d[_0x4733('0x25')];this[_0x4733('0x26')]=_[_0x4733('0x3')](_0x2b146d[_0x4733('0xc')])?_0x2b146d[_0x4733('0x26')]:_0x2b146d[_0x4733('0xc')]['id'];this[_0x4733('0x27')]=_0x2b146d[_0x4733('0x27')];this['originatecalleridnum']='';this[_0x4733('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x4733('0xe')]('\x22%s\x22\x20<%s>',this[_0x4733('0x10')],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1ce3e35..6a2186f 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x4ed6c0,_0x1d0214){var _0x5ce369=function(_0x529ad1){while(--_0x529ad1){_0x4ed6c0['push'](_0x4ed6c0['shift']());}};_0x5ce369(++_0x1d0214);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0xcdc44a,_0x302eef){var _0x3dec77=function(_0x4afa9f){while(--_0x4afa9f){_0xcdc44a['push'](_0xcdc44a['shift']());}};_0x3dec77(++_0x302eef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index dfc55fb..38c811e 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 _0x4638=['checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','moveContactManagedDialer','catch'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x4638,0x1b8));var _0x8463=function(_0x284d7d,_0x2773a4){_0x284d7d=_0x284d7d-0x0;var _0x558628=_0x4638[_0x284d7d];return _0x558628;};'use strict';var util=require(_0x8463('0x0'));var BPromise=require(_0x8463('0x1'));var logger=require(_0x8463('0x2'))(_0x8463('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x8463('0x4'));var cmHopperBlack=require(_0x8463('0x5'));var agentReportPreview=require(_0x8463('0x6'));var voiceQueueReport=require(_0x8463('0x7'));function loggerCatch(_0x2028ed){return function(_0xa46cda){logger[_0x8463('0x8')](_0x2028ed,util[_0x8463('0x9')](_0xa46cda,{'showHidden':![],'depth':null}));};}function create(_0x398802){return cmHopperHistory[_0x8463('0xa')](_0x398802)['catch'](loggerCatch(_0x8463('0xb')));}function createAgent(_0x17f8e9){return BPromise[_0x8463('0xc')]()[_0x8463('0xd')](agentReportPreview[_0x8463('0xa')](_0x17f8e9))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2e2750){return cmHopper[_0x8463('0xe')](_0x2e2750,!![])[_0x8463('0xf')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x8463('0x10')]=function(_0x109dff){return cmHopperBlack[_0x8463('0x10')](_0x109dff)['catch'](loggerCatch(_0x8463('0x11')));};exports['getContactPreview']=function(_0x30b033){return BPromise[_0x8463('0xc')]()['then'](cmHopper[_0x8463('0x12')](_0x30b033))[_0x8463('0xf')](loggerCatch(_0x8463('0x13')));};exports[_0x8463('0xa')]=function(_0x207fea,_0x4cd2cf){create(_0x207fea)['catch'](loggerCatch(_0x4cd2cf));moveContact(_0x207fea)['catch'](loggerCatch(_0x4cd2cf));};exports[_0x8463('0x14')]=function(_0x48ae42,_0x23bbe5){createAgent(_0x48ae42)[_0x8463('0xf')](loggerCatch(_0x23bbe5));};exports[_0x8463('0x15')]=function(_0x10d01b,_0x421171){create(_0x10d01b)[_0x8463('0xf')](loggerCatch(_0x421171));};exports[_0x8463('0x16')]=function(_0x4a1d29,_0xf94b44){moveContact(_0x4a1d29)[_0x8463('0xf')](loggerCatch(_0xf94b44));};exports[_0x8463('0x17')]=function(_0x2c495a,_0xd5141c,_0x7ca404){if(_0xd5141c){_0x2c495a[_0x8463('0x18')]=null;}if(_0x7ca404){_0x2c495a['active']=![];}return cmHopper['rescheduleContact'](_0x2c495a)[_0x8463('0xf')](loggerCatch(_0x8463('0x19')));};exports[_0x8463('0x1a')]=function(_0x907abe){return cmHopper[_0x8463('0x1a')](_0x907abe)[_0x8463('0xf')](loggerCatch('[countReScheduled]\x20'));};exports[_0x8463('0x1b')]=function(_0x206198){return cmHopper[_0x8463('0x1b')]({'UserId':null},_0x206198,0x1)[_0x8463('0xf')](loggerCatch(_0x8463('0x1c')));};exports[_0x8463('0x1d')]=function(_0x279c06){return cmHopper[_0x8463('0x1b')]({'active':![]},_0x279c06,0x1)[_0x8463('0xf')](loggerCatch(_0x8463('0x1e')));};exports[_0x8463('0x1f')]=function(_0x33437b){var _0x583a76={};_0x583a76[_0x8463('0x20')]=_0x33437b[_0x8463('0x20')];_0x583a76[_0x8463('0x21')]=_0x33437b[_0x8463('0x21')];_0x583a76[_0x8463('0x22')]=_0x33437b[_0x8463('0x22')];_0x583a76[_0x8463('0x23')]=_0x33437b[_0x8463('0x23')];_0x583a76[_0x8463('0x24')]=_0x33437b['queue'];_0x583a76[_0x8463('0x25')]=_0x33437b[_0x8463('0x26')];_0x583a76[_0x8463('0x27')]=_0x33437b[_0x8463('0x26')];_0x583a76[_0x8463('0x28')]=0x1;_0x583a76[_0x8463('0x29')]=_0x33437b['endtime'];_0x583a76[_0x8463('0x2a')]=_0x33437b[_0x8463('0x2b')];_0x583a76[_0x8463('0x2c')]=_0x8463('0x2d');_0x583a76[_0x8463('0x2e')]=_0x8463('0x2f');_0x583a76['holdtime']=0x0;_0x583a76[_0x8463('0x30')]=0x1;_0x583a76[_0x8463('0x31')]=_0x33437b[_0x8463('0x2b')];_0x583a76[_0x8463('0x32')]=_0x8463('0x33');return BPromise[_0x8463('0xc')]()['then'](voiceQueueReport[_0x8463('0x34')](_0x583a76))[_0x8463('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x8463('0x35')]=function(_0xe32ddc,_0x520238){return BPromise[_0x8463('0xc')]()[_0x8463('0xd')](cmHopper[_0x8463('0x35')](_0xe32ddc,_0x520238))[_0x8463('0xf')](loggerCatch(_0x8463('0x36')));};exports[_0x8463('0x37')]=function(_0x13f015){return cmHopper[_0x8463('0x17')](_0x13f015,!![],!![])['catch'](loggerCatch(_0x8463('0x38')));}; \ No newline at end of file +var _0xbaae=['error','inspect','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','then','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','context','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport'];(function(_0xa016f6,_0x3a8863){var _0x313949=function(_0x570eeb){while(--_0x570eeb){_0xa016f6['push'](_0xa016f6['shift']());}};_0x313949(++_0x3a8863);}(_0xbaae,0x1b1));var _0xebaa=function(_0x39f3a5,_0x4e8688){_0x39f3a5=_0x39f3a5-0x0;var _0x1a9b56=_0xbaae[_0x39f3a5];return _0x1a9b56;};'use strict';var util=require(_0xebaa('0x0'));var BPromise=require(_0xebaa('0x1'));var logger=require('../../../config/logger')(_0xebaa('0x2'));var cmHopper=require(_0xebaa('0x3'));var cmHopperHistory=require(_0xebaa('0x4'));var cmHopperBlack=require(_0xebaa('0x5'));var agentReportPreview=require(_0xebaa('0x6'));var voiceQueueReport=require(_0xebaa('0x7'));function loggerCatch(_0x133c43){return function(_0x2d9732){logger[_0xebaa('0x8')](_0x133c43,util[_0xebaa('0x9')](_0x2d9732,{'showHidden':![],'depth':null}));};}function create(_0x13c685){return cmHopperHistory['createHistory'](_0x13c685)[_0xebaa('0xa')](loggerCatch(_0xebaa('0xb')));}function createAgent(_0x2050c1){return BPromise['resolve']()['then'](agentReportPreview[_0xebaa('0xc')](_0x2050c1))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x120a26){return cmHopper[_0xebaa('0xd')](_0x120a26,!![])[_0xebaa('0xa')](loggerCatch(_0xebaa('0xe')));}exports[_0xebaa('0xf')]=function(_0x3fe2ed){return cmHopperBlack[_0xebaa('0xf')](_0x3fe2ed)['catch'](loggerCatch(_0xebaa('0x10')));};exports[_0xebaa('0x11')]=function(_0x5181c5){return BPromise[_0xebaa('0x12')]()[_0xebaa('0x13')](cmHopper[_0xebaa('0x11')](_0x5181c5))[_0xebaa('0xa')](loggerCatch(_0xebaa('0x14')));};exports['createHistory']=function(_0x7df88f,_0x42dbe8){create(_0x7df88f)[_0xebaa('0xa')](loggerCatch(_0x42dbe8));moveContact(_0x7df88f)['catch'](loggerCatch(_0x42dbe8));};exports['createAgentHistory']=function(_0x8bb6a4,_0x4dc96c){createAgent(_0x8bb6a4)[_0xebaa('0xa')](loggerCatch(_0x4dc96c));};exports[_0xebaa('0x15')]=function(_0xf06fa6,_0x43b1a1){create(_0xf06fa6)[_0xebaa('0xa')](loggerCatch(_0x43b1a1));};exports['createCustomerFinal']=function(_0x56079f,_0x17aed1){moveContact(_0x56079f)[_0xebaa('0xa')](loggerCatch(_0x17aed1));};exports[_0xebaa('0x16')]=function(_0x1ab535,_0x4428,_0x5a877d){if(_0x4428){_0x1ab535['UserId']=null;}if(_0x5a877d){_0x1ab535[_0xebaa('0x17')]=![];}return cmHopper[_0xebaa('0x16')](_0x1ab535)['catch'](loggerCatch(_0xebaa('0x18')));};exports[_0xebaa('0x19')]=function(_0x482080){return cmHopper[_0xebaa('0x19')](_0x482080)[_0xebaa('0xa')](loggerCatch(_0xebaa('0x1a')));};exports[_0xebaa('0x1b')]=function(_0x39452f){return cmHopper[_0xebaa('0x1b')]({'UserId':null},_0x39452f,0x1)[_0xebaa('0xa')](loggerCatch('[unlockContact]\x20'));};exports[_0xebaa('0x1c')]=function(_0x1219cd){return cmHopper[_0xebaa('0x1b')]({'active':![]},_0x1219cd,0x1)['catch'](loggerCatch(_0xebaa('0x1d')));};exports['crateCustomerReportQueue']=function(_0x4c70bf){var _0x49af44={};_0x49af44[_0xebaa('0x1e')]=_0x4c70bf[_0xebaa('0x1e')];_0x49af44[_0xebaa('0x1f')]=_0x4c70bf[_0xebaa('0x1f')];_0x49af44[_0xebaa('0x20')]=_0x4c70bf['calleridnum'];_0x49af44['calleridname']=_0x4c70bf[_0xebaa('0x21')];_0x49af44[_0xebaa('0x22')]=_0x4c70bf[_0xebaa('0x22')];_0x49af44[_0xebaa('0x23')]=_0x4c70bf[_0xebaa('0x24')];_0x49af44[_0xebaa('0x25')]=_0x4c70bf['answertime'];_0x49af44[_0xebaa('0x26')]=0x1;_0x49af44['queuecallercompleteAt']=_0x4c70bf['endtime'];_0x49af44[_0xebaa('0x27')]=_0x4c70bf[_0xebaa('0x28')];_0x49af44[_0xebaa('0x29')]='from-sip';_0x49af44['exten']='xcally-motion-preview';_0x49af44['holdtime']=0x0;_0x49af44[_0xebaa('0x2a')]=0x1;_0x49af44[_0xebaa('0x2b')]=_0x4c70bf['membername'];_0x49af44['queuecallerexitreason']=_0xebaa('0x2c');return BPromise[_0xebaa('0x12')]()[_0xebaa('0x13')](voiceQueueReport[_0xebaa('0x2d')](_0x49af44))[_0xebaa('0xa')](loggerCatch(_0xebaa('0x2e')));};exports[_0xebaa('0x2f')]=function(_0x1d1434,_0x3687da){return BPromise[_0xebaa('0x12')]()[_0xebaa('0x13')](cmHopper[_0xebaa('0x2f')](_0x1d1434,_0x3687da))[_0xebaa('0xa')](loggerCatch(_0xebaa('0x30')));};exports['rescheduleContactInQueue']=function(_0x1fb19f){return cmHopper[_0xebaa('0x16')](_0x1fb19f,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 410f285..3d64425 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 _0x2d9d=['\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','endtime','logAgent','responsetime','ringtime','getSeconds','UserId','starttime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','name','queue','interface','motionChannel','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','milliseconds','diff','seconds','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject'];(function(_0x16e248,_0x3acc80){var _0x107821=function(_0x4e9cdc){while(--_0x4e9cdc){_0x16e248['push'](_0x16e248['shift']());}};_0x107821(++_0x3acc80);}(_0x2d9d,0x6f));var _0xd2d9=function(_0x2b9c17,_0xc8ac81){_0x2b9c17=_0x2b9c17-0x0;var _0x28711d=_0x2d9d[_0x2b9c17];return _0x28711d;};'use strict';var util=require('util');var _=require(_0xd2d9('0x0'));var moment=require(_0xd2d9('0x1'));var logger=require(_0xd2d9('0x2'))(_0xd2d9('0x3'));var ipAgi=process[_0xd2d9('0x4')][_0xd2d9('0x5')]||_0xd2d9('0x6');var utils=require('../../dialer/utils');exports[_0xd2d9('0x7')]=function(_0x436ea7){return function(_0x2d00b1){logger[_0xd2d9('0x8')](_0x436ea7,util[_0xd2d9('0x9')](_0x2d00b1,{'showHidden':![],'depth':null}));};};exports[_0xd2d9('0xa')]=function(_0x55f4a3,_0x5506ae){logger[_0xd2d9('0xb')](_0x55f4a3,util[_0xd2d9('0x9')](_0x5506ae,{'showHidden':![],'depth':null}));};exports[_0xd2d9('0xc')]=function(_0x2990a0,_0x2d3ff8){logger['error'](_0x2990a0,util[_0xd2d9('0x9')](_0x2d3ff8,{'showHidden':![],'depth':null}));};exports[_0xd2d9('0xd')]=function(_0x42a72b){return function(_0x966b28){logger['info'](_0x42a72b,util[_0xd2d9('0x9')](_0x966b28,{'showHidden':![],'depth':null}));};};exports[_0xd2d9('0xe')]=function(_0x2548fc,_0x2b6485,_0x4186d5){return{'message':_0x2548fc,'unlock':_0x2b6485,'active':_0x4186d5};};exports['getCallerId']=function(_0x36a4f6,_0x58d6f0,_0x309cc5){if(!_[_0xd2d9('0xf')](_0x309cc5)&&_0xd2d9('0x10')===typeof _0x309cc5&&!_['isEmpty'](_0x309cc5)){if(!_[_0xd2d9('0xf')](_0x58d6f0)&&_0xd2d9('0x10')===typeof _0x58d6f0&&!_[_0xd2d9('0x11')](_0x58d6f0)){return util['format'](_0xd2d9('0x12'),_0x58d6f0,_0x309cc5);}return util[_0xd2d9('0x13')]('\x22%s\x22\x20<%s>',_0x309cc5,_0x309cc5);}if(!_['isUndefined'](_0x36a4f6)&&'string'===typeof _0x36a4f6&&!_[_0xd2d9('0x11')](_0x36a4f6)){return _0x36a4f6;}return'\x22\x22\x20<>';};exports[_0xd2d9('0x14')]=function(_0x58b205){if(_['isNil'](_0x58b205)){return![];}return _0x58b205;};exports[_0xd2d9('0x15')]=function(_0x2b33cb,_0x4f5a14,_0x36de86,_0x26afce,_0x1f1083,_0xba144b){var _0x3af26c={'XMD-QUEUE':_0x4f5a14[_0xd2d9('0x16')]?_0x4f5a14[_0xd2d9('0x16')]['name']:'','XMD-CALLERID':_0x26afce,'XMD-CALLERID-PREVIEW':_0xba144b?util['format'](_0xd2d9('0x12'),_0xba144b[_0xd2d9('0x17')],_0xba144b[_0xd2d9('0x18')]):_0x26afce,'XMD-DIALID':_0x1f1083,'XMD-CONTACTID':_0x4f5a14[_0xd2d9('0x19')],'XMD-CDRTYPE':_0xd2d9('0x1a'),'CALLERID(all)':_0x26afce,'XMD-VOICEQUEUEID':_0x4f5a14['VoiceQueueId'],'XMD-DIALCHANNEL':_0x36de86,'XMD-DIALTIMEOUT':_0x2b33cb['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xd2d9('0x13')](_0xd2d9('0x1b'),_0x2b33cb['dialQueueProject2']?'g':'',_[_0xd2d9('0x11')](_0x2b33cb[_0xd2d9('0x1c')])?'':_0xd2d9('0x1d')),'XMD-DIALURL':_0x2b33cb[_0xd2d9('0x1e')]||'','XMD-AGI':_0x2b33cb[_0xd2d9('0x1f')]?util[_0xd2d9('0x13')](_0xd2d9('0x20'),ipAgi,_0x2b33cb[_0xd2d9('0x1f')]):_0xd2d9('0x21'),'XMD-AGIAFTER':_0x2b33cb[_0xd2d9('0x22')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2b33cb['dialQueueProject2']):_0xd2d9('0x21'),'XMD-ORIGINATECALLERIDNUM':_0xba144b?_0xba144b[_0xd2d9('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0xba144b?_0xba144b[_0xd2d9('0x24')]:'','XMD-DESTINATION':_0xd2d9('0x25'),'SIPADDHEADER':_0xd2d9('0x26')};if(!_[_0xd2d9('0x11')](_0x2b33cb['monitor_format'])){_0x3af26c[util[_0xd2d9('0x13')]('%s',_0xd2d9('0x27'))]=_0x2b33cb[_0xd2d9('0x1c')];_0x3af26c[util['format']('%s',_0xd2d9('0x28'))]=_0x1f1083;}return _0x3af26c;};exports[_0xd2d9('0x29')]=function(_0x5401a1){var _0x362d66={};for(var _0x22ec15 in _0x5401a1){if(_0x5401a1[_0xd2d9('0x2a')](_0x22ec15)){_0x362d66[util['format']('%s',_[_0xd2d9('0x2b')](_0x22ec15))]=_0x5401a1[_0x22ec15];}}return{'variables':_0x362d66};};exports[_0xd2d9('0x2c')]=function(_0x5c44ab,_0x5a4d79){if(!_[_0xd2d9('0x2d')](_0x5c44ab)){if(_0x5c44ab[_0xd2d9('0x2a')]('originated')){if(_0x5c44ab[_0xd2d9('0x2e')]>0x0){_0x5c44ab[_0xd2d9('0x2e')]-=0x1;}else{logger['error'](_0xd2d9('0x2f'),_0x5a4d79);}}}else{logger[_0xd2d9('0x8')](_0xd2d9('0x30'),_0x5a4d79);}};exports[_0xd2d9('0x31')]=function(_0x3291d6){var _0x443cb9=moment()[_0xd2d9('0x13')](_0xd2d9('0x32'));_0x3291d6[_0xd2d9('0x33')]=0xd;_0x3291d6[_0xd2d9('0x34')]='Blacklist';_0x3291d6['starttime']=_0x443cb9;_0x3291d6['responsetime']=_0x443cb9;_0x3291d6[_0xd2d9('0x35')]=_0x443cb9;};exports[_0xd2d9('0x36')]=function(_0x23ca9f,_0x43dc57,_0x108db0){var _0x3e6460=moment()[_0xd2d9('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x23ca9f['state']=_0x43dc57;_0x23ca9f[_0xd2d9('0x34')]=_0x108db0;_0x23ca9f[_0xd2d9('0x37')]=_0x3e6460;_0x23ca9f[_0xd2d9('0x38')]=utils[_0xd2d9('0x39')](_0x23ca9f[_0xd2d9('0x37')],_0x23ca9f['starttime']);};exports['logLookAgent']=function(_0xd7d938,_0x3557f2,_0x29d874){_0xd7d938['membername']=_0x3557f2;_0xd7d938[_0xd2d9('0x3a')]=_0x29d874;};exports['logCustomer']=function(_0x1b5950,_0x4fdf2c,_0x42e381){var _0x54e52c=moment()[_0xd2d9('0x13')](_0xd2d9('0x32'));_0x1b5950['state']=_0x4fdf2c;_0x1b5950['statedesc']=_0x42e381;_0x1b5950['responsetime']=_0x1b5950[_0xd2d9('0x37')]?_0x1b5950[_0xd2d9('0x37')]:_0x54e52c;_0x1b5950['endtime']=_0x1b5950[_0xd2d9('0x35')]?_0x1b5950[_0xd2d9('0x35')]:_0x54e52c;_0x1b5950[_0xd2d9('0x38')]=utils[_0xd2d9('0x39')](_0x1b5950[_0xd2d9('0x37')]||0x0,_0x1b5950[_0xd2d9('0x3b')]||0x0);_0x1b5950[_0xd2d9('0x3c')]=_0x1b5950[_0xd2d9('0x3d')]?utils[_0xd2d9('0x39')](_0x1b5950[_0xd2d9('0x35')],_0x1b5950[_0xd2d9('0x3d')]):0x0;};exports['isFailure']=function(_0x413cd1){return _0x413cd1===_0xd2d9('0x3e');};exports[_0xd2d9('0x3f')]=function(_0x257b2c,_0x6bb963,_0x4241fd,_0x4d3687,_0x295185){var _0x4f9ad7=_0x4d3687?_0xd2d9('0x40'):_0x257b2c['calleridname'];_0x4f9ad7=_0x295185?_0xd2d9('0x41'):_0x4f9ad7;return{'actionid':_0x257b2c[_0xd2d9('0x42')],'action':_0xd2d9('0x43'),'channel':_0x257b2c[_0xd2d9('0x44')],'callerid':util['format'](_0xd2d9('0x12'),_0x4f9ad7,_0x257b2c[_0xd2d9('0x18')]),'Exten':_0xd2d9('0x25'),'Context':'from-sip','Priority':'1','variable':_0x4241fd,'timeout':(_0x6bb963[_0xd2d9('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x257b2c['uniqueid']};};exports[_0xd2d9('0x46')]=function(_0x11d13c){return _0x11d13c[_0xd2d9('0x47')]+_0x11d13c[_0xd2d9('0x48')]+_0x11d13c['countnoanswerretry']+_0x11d13c[_0xd2d9('0x49')]+_0x11d13c[_0xd2d9('0x4a')];};exports[_0xd2d9('0x4b')]=function(_0x5e4ea7){var _0x2dfcc9=_[_0xd2d9('0x4c')](_0x5e4ea7);_0x2dfcc9[_0xd2d9('0x33')]=0xf;_0x2dfcc9[_0xd2d9('0x34')]='Global';return _0x2dfcc9;};exports[_0xd2d9('0x4d')]=function(_0x3e9893,_0x91c909,_0x860b1d){var _0x2f3bcc={};_0x2f3bcc[_0x91c909]=_0x3e9893[_0x91c909];_0x2f3bcc[_0xd2d9('0x4e')]=![];_0x2f3bcc[_0xd2d9('0x4f')]=moment()['add'](_0x860b1d,_0xd2d9('0x50'))['format'](_0xd2d9('0x32'));_0x2f3bcc[_0xd2d9('0x19')]=_0x3e9893[_0xd2d9('0x19')];_0x2f3bcc[_0xd2d9('0x51')]=_0x3e9893[_0xd2d9('0x51')];_0x2f3bcc[_0xd2d9('0x52')]=_0x3e9893[_0xd2d9('0x52')]||undefined;return _0x2f3bcc;};exports['decrementTalkink']=function(_0x19fe53,_0x215963){if(!_[_0xd2d9('0x2d')](_0x19fe53)){if(_0x19fe53['pTalking']>0x0){_0x19fe53[_0xd2d9('0x53')]-=0x1;}else{logger['error'](_0x215963,_0xd2d9('0x54'));}}else{logger[_0xd2d9('0x8')](_0x215963,_0xd2d9('0x55'));}};exports['IsNotLoggedIn']=function(_0x3d8673){if(_0x3d8673<=0x0){return!![];}return![];};function buildObj(_0x35fdcf,_0x186141,_0x426353){_0x35fdcf['lastevent']=_0x186141;_0x35fdcf[_0xd2d9('0x56')]=_0x35fdcf[_0xd2d9('0x57')];_0x35fdcf[_0xd2d9('0x58')]=_0x35fdcf['channelAgent'];_0x35fdcf[_0xd2d9('0x59')]='voice';if(_0x426353){_0x35fdcf[_0xd2d9('0x5a')]=_0x426353[_0xd2d9('0x5a')];}return _0x35fdcf;}exports[_0xd2d9('0x5b')]=buildObj;exports[_0xd2d9('0x5c')]=function(_0x116c68){var _0xa79499=[];for(var _0x5760f4 in _0x116c68){if(_0x116c68[_0xd2d9('0x2a')](_0x5760f4)){if(!_[_0xd2d9('0x2d')](_0x116c68[_0x5760f4])&&_0x116c68[_0x5760f4][_0xd2d9('0x33')]==='not_inuse'&&_0x116c68[_0x5760f4][_0xd2d9('0x5d')]===_0xd2d9('0x5e')){_0xa79499[_0xd2d9('0x5f')](_0x116c68[_0x5760f4]['id']);}}}return _0xa79499;};exports['getDiff']=function(_0x39b504){var _0x2cf69b=moment()[_0xd2d9('0x60')](0x0);var _0x1f5584=moment(_0x39b504)[_0xd2d9('0x60')](0x0);return _0x2cf69b[_0xd2d9('0x61')](_0x1f5584,_0xd2d9('0x62'));};exports['createBody']=function(_0x25e4fb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x25e4fb[_0xd2d9('0x19')],'ListId':_0x25e4fb[_0xd2d9('0x51')],'VoiceQueueId':_0x25e4fb['VoiceQueueId']||undefined,'CampaignId':_0x25e4fb['CampaignId']||undefined};};exports['filterKey']=function(_0x2cfe37){if(_0x2cfe37==='uniqueid'||_0x2cfe37===_0xd2d9('0x63')||_0x2cfe37===_0xd2d9('0x57')||_0x2cfe37===_0xd2d9('0x64')||_0x2cfe37===_0xd2d9('0x65')||_0x2cfe37===_0xd2d9('0x66')||_0x2cfe37==='membername'||_0x2cfe37===_0xd2d9('0x44')||_0x2cfe37===_0xd2d9('0x17')||_0x2cfe37===_0xd2d9('0x4e')||_0x2cfe37===_0xd2d9('0x18')||_0x2cfe37===_0xd2d9('0x4f')||_0x2cfe37==='countbusyretry'||_0x2cfe37===_0xd2d9('0x48')||_0x2cfe37===_0xd2d9('0x67')||_0x2cfe37===_0xd2d9('0x68')||_0x2cfe37===_0xd2d9('0x69')||_0x2cfe37===_0xd2d9('0x6a')||_0x2cfe37===_0xd2d9('0x6b')||_0x2cfe37==='recallme'||_0x2cfe37===_0xd2d9('0x19')||_0x2cfe37===_0xd2d9('0x51')||_0x2cfe37===_0xd2d9('0x3a')||_0x2cfe37==='VoiceQueueId'||_0x2cfe37==='sipcallid'||_0x2cfe37===_0xd2d9('0x6c')||_0x2cfe37===_0xd2d9('0x6d')||_0x2cfe37===_0xd2d9('0x6e')||_0x2cfe37===_0xd2d9('0x6f')||_0x2cfe37===_0xd2d9('0x70')||_0x2cfe37===_0xd2d9('0x71')||_0x2cfe37===_0xd2d9('0x72')||_0x2cfe37===_0xd2d9('0x73')||_0x2cfe37===_0xd2d9('0x74')||_0x2cfe37===_0xd2d9('0x75')||_0x2cfe37===_0xd2d9('0x76')||_0x2cfe37===_0xd2d9('0x77')||_0x2cfe37===_0xd2d9('0x78')||_0x2cfe37==='xmd-agi'||_0x2cfe37===_0xd2d9('0x79')||_0x2cfe37===_0xd2d9('0x7a')||_0x2cfe37==='rtpaudioqosjitter'||_0x2cfe37===_0xd2d9('0x7b')||_0x2cfe37===_0xd2d9('0x7c')||_0x2cfe37===_0xd2d9('0x7d')||_0x2cfe37===_0xd2d9('0x7e')||_0x2cfe37===_0xd2d9('0x7f')||_0x2cfe37==='rtpaudioqos'||_0x2cfe37===_0xd2d9('0x7a')||_0x2cfe37===_0xd2d9('0x80')||_0x2cfe37===_0xd2d9('0x7b')||_0x2cfe37===_0xd2d9('0x7c')||_0x2cfe37==='rtpaudioqoslossbridged'||_0x2cfe37===_0xd2d9('0x7e')||_0x2cfe37==='rtpaudioqosrttbridged'||_0x2cfe37===_0xd2d9('0x81')||_0x2cfe37===_0xd2d9('0x82')||_0x2cfe37===_0xd2d9('0x33')||_0x2cfe37===_0xd2d9('0x34')){return![];}return!![];};exports[_0xd2d9('0x83')]=function(_0x565a7c,_0x3245b6){var _0x2ed541,_0x1468d1,_0xb19e56;if(_0x3245b6<=0x0){_0x3245b6=0x1;}_0x2ed541=new RegExp(_0xd2d9('0x84')+_0x3245b6+'}$');_0x1468d1=Math[_0xd2d9('0x85')](0xa,_0x3245b6-0x1);_0xb19e56=Math[_0xd2d9('0x85')](0xa,_0x3245b6)-0x1;return util[_0xd2d9('0x13')]('%s',_[_0xd2d9('0x86')](_0x565a7c,_0x2ed541,_[_0xd2d9('0x87')](_0x1468d1,_0xb19e56)));};exports[_0xd2d9('0x88')]=function(_0xe50f20){var _0x5c2d7c=_0xe50f20[_0xd2d9('0x89')](/"(.*?)"/);return _0x5c2d7c?_0x5c2d7c[0x1]:_0xe50f20;};exports[_0xd2d9('0x8a')]=function(_0x2662b6){var _0x2385fb=_0x2662b6[_0xd2d9('0x89')](/<(.*?)>/);return _0x2385fb?_0x2385fb[0x1]:_0x2662b6;};function buildNoAnswerEventPayload(_0x30670f,_0x5a3c6c){var _0x350fda=buildObj(_0x30670f,_0xd2d9('0x8b'));if(!_['isEmpty'](_0x5a3c6c[_0xd2d9('0x8c')])){Object['keys'](_0x5a3c6c[_0xd2d9('0x8c')])['forEach'](function(_0x5b1107){_0x350fda[_0x5b1107[_0xd2d9('0x8d')]()]=_0x5a3c6c['variables'][_0x5b1107];});}return _0x350fda;}exports[_0xd2d9('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x7cf3=['../../dialer/utils','error','inspect','info','loggerError','logger2','message','getCallerId','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','answertime','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countbusyretry','countglobal','callbackat','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','noanswer','keys','variables','toLowerCase','buildNoAnswerEventPayload','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7cf3,0x114));var _0x37cf=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0x7cf3[_0x4cd690];return _0x4a74a9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x37cf('0x0'));var logger=require(_0x37cf('0x1'))(_0x37cf('0x2'));var ipAgi=process[_0x37cf('0x3')][_0x37cf('0x4')]||_0x37cf('0x5');var utils=require(_0x37cf('0x6'));exports['loggerCatch']=function(_0x56a692){return function(_0x4c2793){logger[_0x37cf('0x7')](_0x56a692,util[_0x37cf('0x8')](_0x4c2793,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x419e43,_0x1d633e){logger[_0x37cf('0x9')](_0x419e43,util[_0x37cf('0x8')](_0x1d633e,{'showHidden':![],'depth':null}));};exports[_0x37cf('0xa')]=function(_0x94a504,_0x530e05){logger[_0x37cf('0x7')](_0x94a504,util[_0x37cf('0x8')](_0x530e05,{'showHidden':![],'depth':null}));};exports[_0x37cf('0xb')]=function(_0x57fd22){return function(_0x2c4231){logger['info'](_0x57fd22,util[_0x37cf('0x8')](_0x2c4231,{'showHidden':![],'depth':null}));};};exports[_0x37cf('0xc')]=function(_0xaa5f1e,_0x24d8c2,_0x583c9a){return{'message':_0xaa5f1e,'unlock':_0x24d8c2,'active':_0x583c9a};};exports[_0x37cf('0xd')]=function(_0x5f68b7,_0x3f4d28,_0x2cb8ae){if(!_['isUndefined'](_0x2cb8ae)&&'string'===typeof _0x2cb8ae&&!_['isEmpty'](_0x2cb8ae)){if(!_['isUndefined'](_0x3f4d28)&&'string'===typeof _0x3f4d28&&!_[_0x37cf('0xe')](_0x3f4d28)){return util[_0x37cf('0xf')](_0x37cf('0x10'),_0x3f4d28,_0x2cb8ae);}return util[_0x37cf('0xf')](_0x37cf('0x10'),_0x2cb8ae,_0x2cb8ae);}if(!_[_0x37cf('0x11')](_0x5f68b7)&&'string'===typeof _0x5f68b7&&!_[_0x37cf('0xe')](_0x5f68b7)){return _0x5f68b7;}return'\x22\x22\x20<>';};exports[_0x37cf('0x12')]=function(_0x2eaaf4){if(_[_0x37cf('0x13')](_0x2eaaf4)){return![];}return _0x2eaaf4;};exports[_0x37cf('0x14')]=function(_0x2bf890,_0x7f2a40,_0x5d5a75,_0x175b8a,_0x3a709e,_0x48e792){var _0xc5f11b={'XMD-QUEUE':_0x7f2a40[_0x37cf('0x15')]?_0x7f2a40['Queue']['name']:'','XMD-CALLERID':_0x175b8a,'XMD-CALLERID-PREVIEW':_0x48e792?util[_0x37cf('0xf')]('\x22%s\x22\x20<%s>',_0x48e792[_0x37cf('0x16')],_0x48e792[_0x37cf('0x17')]):_0x175b8a,'XMD-DIALID':_0x3a709e,'XMD-CONTACTID':_0x7f2a40[_0x37cf('0x18')],'XMD-CDRTYPE':_0x37cf('0x19'),'CALLERID(all)':_0x175b8a,'XMD-VOICEQUEUEID':_0x7f2a40['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5d5a75,'XMD-DIALTIMEOUT':_0x2bf890[_0x37cf('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x37cf('0xf')](_0x37cf('0x1b'),_0x2bf890[_0x37cf('0x1c')]?'g':'',_['isEmpty'](_0x2bf890['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2bf890[_0x37cf('0x1d')]||'','XMD-AGI':_0x2bf890[_0x37cf('0x1e')]?util['format'](_0x37cf('0x1f'),ipAgi,_0x2bf890['dialQueueProject']):_0x37cf('0x20'),'XMD-AGIAFTER':_0x2bf890['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2bf890[_0x37cf('0x1c')]):_0x37cf('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x48e792?_0x48e792[_0x37cf('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x48e792?_0x48e792[_0x37cf('0x22')]:'','XMD-DESTINATION':_0x37cf('0x23'),'SIPADDHEADER':_0x37cf('0x24')};if(!_[_0x37cf('0xe')](_0x2bf890[_0x37cf('0x25')])){_0xc5f11b[util[_0x37cf('0xf')]('%s',_0x37cf('0x26'))]=_0x2bf890[_0x37cf('0x25')];_0xc5f11b[util[_0x37cf('0xf')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x3a709e;}return _0xc5f11b;};exports['toLowerVariables']=function(_0x482edb){var _0x1f1a3e={};for(var _0x1579b4 in _0x482edb){if(_0x482edb[_0x37cf('0x27')](_0x1579b4)){_0x1f1a3e[util['format']('%s',_[_0x37cf('0x28')](_0x1579b4))]=_0x482edb[_0x1579b4];}}return{'variables':_0x1f1a3e};};exports[_0x37cf('0x29')]=function(_0x186f81,_0x2ce9e4){if(!_[_0x37cf('0x13')](_0x186f81)){if(_0x186f81[_0x37cf('0x27')]('originated')){if(_0x186f81['originated']>0x0){_0x186f81[_0x37cf('0x2a')]-=0x1;}else{logger[_0x37cf('0x7')](_0x37cf('0x2b'),_0x2ce9e4);}}}else{logger[_0x37cf('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2ce9e4);}};exports[_0x37cf('0x2c')]=function(_0x989d51){var _0x883548=moment()[_0x37cf('0xf')](_0x37cf('0x2d'));_0x989d51[_0x37cf('0x2e')]=0xd;_0x989d51[_0x37cf('0x2f')]=_0x37cf('0x30');_0x989d51['starttime']=_0x883548;_0x989d51[_0x37cf('0x31')]=_0x883548;_0x989d51[_0x37cf('0x32')]=_0x883548;};exports[_0x37cf('0x33')]=function(_0x5b1b19,_0x253be9,_0x284cd1){var _0x20f222=moment()[_0x37cf('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b1b19[_0x37cf('0x2e')]=_0x253be9;_0x5b1b19[_0x37cf('0x2f')]=_0x284cd1;_0x5b1b19[_0x37cf('0x31')]=_0x20f222;_0x5b1b19[_0x37cf('0x34')]=utils[_0x37cf('0x35')](_0x5b1b19[_0x37cf('0x31')],_0x5b1b19[_0x37cf('0x36')]);};exports[_0x37cf('0x37')]=function(_0x5d5105,_0x519df4,_0x4c59db){_0x5d5105[_0x37cf('0x38')]=_0x519df4;_0x5d5105[_0x37cf('0x39')]=_0x4c59db;};exports[_0x37cf('0x3a')]=function(_0x12c261,_0x101301,_0x19ce4e){var _0x4b64a2=moment()[_0x37cf('0xf')](_0x37cf('0x2d'));_0x12c261['state']=_0x101301;_0x12c261[_0x37cf('0x2f')]=_0x19ce4e;_0x12c261['responsetime']=_0x12c261[_0x37cf('0x31')]?_0x12c261[_0x37cf('0x31')]:_0x4b64a2;_0x12c261[_0x37cf('0x32')]=_0x12c261[_0x37cf('0x32')]?_0x12c261[_0x37cf('0x32')]:_0x4b64a2;_0x12c261[_0x37cf('0x34')]=utils[_0x37cf('0x35')](_0x12c261[_0x37cf('0x31')]||0x0,_0x12c261[_0x37cf('0x36')]||0x0);_0x12c261['talktime']=_0x12c261[_0x37cf('0x3b')]?utils[_0x37cf('0x35')](_0x12c261['endtime'],_0x12c261[_0x37cf('0x3b')]):0x0;};exports['isFailure']=function(_0x3c3103){return _0x3c3103==='Failure';};exports[_0x37cf('0x3c')]=function(_0x55006e,_0x29bf4b,_0x528685,_0x10f853,_0x4ac21b){var _0x4973ec=_0x10f853?_0x37cf('0x3d'):_0x55006e['calleridname'];_0x4973ec=_0x4ac21b?_0x37cf('0x3e'):_0x4973ec;return{'actionid':_0x55006e[_0x37cf('0x3f')],'action':_0x37cf('0x40'),'channel':_0x55006e[_0x37cf('0x41')],'callerid':util[_0x37cf('0xf')](_0x37cf('0x10'),_0x4973ec,_0x55006e[_0x37cf('0x17')]),'Exten':_0x37cf('0x23'),'Context':'from-sip','Priority':'1','variable':_0x528685,'timeout':(_0x29bf4b[_0x37cf('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55006e[_0x37cf('0x3f')]};};exports[_0x37cf('0x43')]=function(_0x185861){return _0x185861['countbusyretry']+_0x185861[_0x37cf('0x44')]+_0x185861[_0x37cf('0x45')]+_0x185861['countagentrejectretry']+_0x185861['countnosuchnumberretry'];};exports[_0x37cf('0x46')]=function(_0x544d07){var _0x510a94=_[_0x37cf('0x47')](_0x544d07);_0x510a94['state']=0xf;_0x510a94[_0x37cf('0x2f')]=_0x37cf('0x48');return _0x510a94;};exports[_0x37cf('0x49')]=function(_0xf76c71,_0x349dcc,_0x32896b){var _0x153be2={};_0x153be2[_0x349dcc]=_0xf76c71[_0x349dcc];_0x153be2[_0x37cf('0x4a')]=![];_0x153be2[_0x37cf('0x4b')]=moment()['add'](_0x32896b,_0x37cf('0x4c'))[_0x37cf('0xf')](_0x37cf('0x2d'));_0x153be2[_0x37cf('0x18')]=_0xf76c71[_0x37cf('0x18')];_0x153be2[_0x37cf('0x4d')]=_0xf76c71[_0x37cf('0x4d')];_0x153be2[_0x37cf('0x4e')]=_0xf76c71['VoiceQueueId']||undefined;return _0x153be2;};exports[_0x37cf('0x4f')]=function(_0x4f26b4,_0x2cb475){if(!_[_0x37cf('0x13')](_0x4f26b4)){if(_0x4f26b4[_0x37cf('0x50')]>0x0){_0x4f26b4[_0x37cf('0x50')]-=0x1;}else{logger[_0x37cf('0x7')](_0x2cb475,_0x37cf('0x51'));}}else{logger[_0x37cf('0x7')](_0x2cb475,_0x37cf('0x52'));}};exports[_0x37cf('0x53')]=function(_0x3de3a9){if(_0x3de3a9<=0x0){return!![];}return![];};function buildObj(_0x344bac,_0x44b97d,_0x4f861d){_0x344bac[_0x37cf('0x54')]=_0x44b97d;_0x344bac[_0x37cf('0x55')]=_0x344bac[_0x37cf('0x56')];_0x344bac[_0x37cf('0x57')]=_0x344bac[_0x37cf('0x41')];_0x344bac[_0x37cf('0x58')]='voice';if(_0x4f861d){_0x344bac[_0x37cf('0x59')]=_0x4f861d[_0x37cf('0x59')];}return _0x344bac;}exports[_0x37cf('0x5a')]=buildObj;exports[_0x37cf('0x5b')]=function(_0x40deab){var _0x45401d=[];for(var _0x94eaa4 in _0x40deab){if(_0x40deab['hasOwnProperty'](_0x94eaa4)){if(!_['isNil'](_0x40deab[_0x94eaa4])&&_0x40deab[_0x94eaa4]['state']===_0x37cf('0x5c')&&_0x40deab[_0x94eaa4][_0x37cf('0x5d')]===_0x37cf('0x5e')){_0x45401d[_0x37cf('0x5f')](_0x40deab[_0x94eaa4]['id']);}}}return _0x45401d;};exports[_0x37cf('0x60')]=function(_0x233d67){var _0x235875=moment()[_0x37cf('0x61')](0x0);var _0xe1475b=moment(_0x233d67)['milliseconds'](0x0);return _0x235875['diff'](_0xe1475b,'seconds');};exports[_0x37cf('0x62')]=function(_0x28e777){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x28e777[_0x37cf('0x18')],'ListId':_0x28e777[_0x37cf('0x4d')],'VoiceQueueId':_0x28e777[_0x37cf('0x4e')]||undefined,'CampaignId':_0x28e777[_0x37cf('0x63')]||undefined};};exports[_0x37cf('0x64')]=function(_0x50458e){if(_0x50458e===_0x37cf('0x3f')||_0x50458e===_0x37cf('0x65')||_0x50458e===_0x37cf('0x56')||_0x50458e==='type'||_0x50458e===_0x37cf('0x66')||_0x50458e===_0x37cf('0x67')||_0x50458e===_0x37cf('0x38')||_0x50458e===_0x37cf('0x41')||_0x50458e==='calleridname'||_0x50458e===_0x37cf('0x4a')||_0x50458e===_0x37cf('0x17')||_0x50458e==='scheduledat'||_0x50458e===_0x37cf('0x68')||_0x50458e===_0x37cf('0x44')||_0x50458e===_0x37cf('0x45')||_0x50458e===_0x37cf('0x69')||_0x50458e==='callback'||_0x50458e==='callbackuniqueid'||_0x50458e===_0x37cf('0x6a')||_0x50458e==='recallme'||_0x50458e===_0x37cf('0x18')||_0x50458e==='ListId'||_0x50458e==='UserId'||_0x50458e===_0x37cf('0x4e')||_0x50458e===_0x37cf('0x6b')||_0x50458e==='xmd-voicequeueid'||_0x50458e==='xmd-queue'||_0x50458e===_0x37cf('0x6c')||_0x50458e===_0x37cf('0x6d')||_0x50458e===_0x37cf('0x6e')||_0x50458e===_0x37cf('0x6f')||_0x50458e===_0x37cf('0x70')||_0x50458e===_0x37cf('0x71')||_0x50458e===_0x37cf('0x72')||_0x50458e===_0x37cf('0x73')||_0x50458e===_0x37cf('0x74')||_0x50458e===_0x37cf('0x75')||_0x50458e===_0x37cf('0x76')||_0x50458e===_0x37cf('0x77')||_0x50458e===_0x37cf('0x78')||_0x50458e===_0x37cf('0x79')||_0x50458e===_0x37cf('0x7a')||_0x50458e===_0x37cf('0x7b')||_0x50458e===_0x37cf('0x7c')||_0x50458e===_0x37cf('0x7d')||_0x50458e===_0x37cf('0x7e')||_0x50458e==='rtpaudioqosrttbridged'||_0x50458e===_0x37cf('0x78')||_0x50458e===_0x37cf('0x79')||_0x50458e===_0x37cf('0x7a')||_0x50458e===_0x37cf('0x7b')||_0x50458e===_0x37cf('0x7c')||_0x50458e===_0x37cf('0x7d')||_0x50458e===_0x37cf('0x7e')||_0x50458e===_0x37cf('0x7f')||_0x50458e===_0x37cf('0x80')||_0x50458e===_0x37cf('0x81')||_0x50458e===_0x37cf('0x2e')||_0x50458e===_0x37cf('0x2f')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x465b36,_0x135df9){var _0x10c5d3,_0x220104,_0x5f4ae7;if(_0x135df9<=0x0){_0x135df9=0x1;}_0x10c5d3=new RegExp(_0x37cf('0x82')+_0x135df9+'}$');_0x220104=Math['pow'](0xa,_0x135df9-0x1);_0x5f4ae7=Math[_0x37cf('0x83')](0xa,_0x135df9)-0x1;return util['format']('%s',_[_0x37cf('0x84')](_0x465b36,_0x10c5d3,_[_0x37cf('0x85')](_0x220104,_0x5f4ae7)));};exports['extractCalleridName']=function(_0x592ba9){var _0x4b157b=_0x592ba9['match'](/"(.*?)"/);return _0x4b157b?_0x4b157b[0x1]:_0x592ba9;};exports[_0x37cf('0x86')]=function(_0x1b46fd){var _0x1f9698=_0x1b46fd[_0x37cf('0x87')](/<(.*?)>/);return _0x1f9698?_0x1f9698[0x1]:_0x1b46fd;};function buildNoAnswerEventPayload(_0x1772b7,_0x204fce){var _0x216b01=buildObj(_0x1772b7,_0x37cf('0x88'));if(!_['isEmpty'](_0x204fce['variables'])){Object[_0x37cf('0x89')](_0x204fce[_0x37cf('0x8a')])['forEach'](function(_0x1a8b82){_0x216b01[_0x1a8b82[_0x37cf('0x8b')]()]=_0x204fce[_0x37cf('0x8a')][_0x1a8b82];});}return _0x216b01;}exports[_0x37cf('0x8c')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4680c77..3f1108f 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 _0xf551=['string','number','boolean','queueremove','reload','voicequeuechannel','voicequeuechannelredirect','queueadd'];(function(_0x4bd809,_0x4ea384){var _0x33a8aa=function(_0x2d48c3){while(--_0x2d48c3){_0x4bd809['push'](_0x4bd809['shift']());}};_0x33a8aa(++_0x4ea384);}(_0xf551,0xe7));var _0x1f55=function(_0x374eb7,_0x3e9edd){_0x374eb7=_0x374eb7-0x0;var _0x51b1ae=_0xf551[_0x374eb7];return _0x51b1ae;};'use strict';exports[_0x1f55('0x0')]={'queue':{'type':_0x1f55('0x1'),'required':!![]},'interface':{'type':_0x1f55('0x1'),'required':!![]},'membername':{'type':_0x1f55('0x1'),'required':!![]},'penalty':{'type':_0x1f55('0x2'),'required':![]},'paused':{'type':_0x1f55('0x3'),'required':![]}};exports[_0x1f55('0x4')]={'queue':{'type':_0x1f55('0x1'),'required':!![]},'interface':{'type':_0x1f55('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x1f55('0x3')},'reason':{'type':'string','required':![]}};exports[_0x1f55('0x5')]={'module':{'type':_0x1f55('0x1'),'required':![]}};exports[_0x1f55('0x6')]={'uniqueid':{'type':_0x1f55('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x1f55('0x1'),'required':!![]},'filename':{'type':_0x1f55('0x1')},'format':{'type':_0x1f55('0x1')},'mixmonitorid':{'type':_0x1f55('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x1f55('0x1'),'required':!![]}};exports[_0x1f55('0x7')]={'uniqueid':{'type':_0x1f55('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x1f55('0x1')}}; \ No newline at end of file +var _0x858d=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0x29a84f,_0xf6e497){var _0x2b92f2=function(_0x3cf794){while(--_0x3cf794){_0x29a84f['push'](_0x29a84f['shift']());}};_0x2b92f2(++_0xf6e497);}(_0x858d,0x8a));var _0xd858=function(_0x36dd01,_0xd09fb){_0x36dd01=_0x36dd01-0x0;var _0x5cbcf3=_0x858d[_0x36dd01];return _0x5cbcf3;};'use strict';exports[_0xd858('0x0')]={'queue':{'type':_0xd858('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xd858('0x1'),'required':!![]},'penalty':{'type':_0xd858('0x2'),'required':![]},'paused':{'type':_0xd858('0x3'),'required':![]}};exports[_0xd858('0x4')]={'queue':{'type':_0xd858('0x1'),'required':!![]},'interface':{'type':_0xd858('0x1'),'required':!![]}};exports[_0xd858('0x5')]={'interface':{'type':_0xd858('0x1'),'required':!![]},'paused':{'type':_0xd858('0x3')},'reason':{'type':_0xd858('0x1'),'required':![]}};exports[_0xd858('0x6')]={'module':{'type':'string','required':![]}};exports[_0xd858('0x7')]={'uniqueid':{'type':_0xd858('0x1'),'required':!![]}};exports[_0xd858('0x8')]={'uniqueid':{'type':_0xd858('0x1'),'required':!![]},'filename':{'type':_0xd858('0x1')},'format':{'type':_0xd858('0x1')},'mixmonitorid':{'type':_0xd858('0x1')}};exports[_0xd858('0x9')]={'uniqueid':{'type':_0xd858('0x1'),'required':!![]}};exports[_0xd858('0xa')]={'uniqueid':{'type':_0xd858('0x1'),'required':!![]},'exten':{'type':_0xd858('0x1'),'required':!![]},'context':{'type':_0xd858('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 823fb40..becb6aa 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 _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x2378d7,_0xd46258){var _0x58dc15=function(_0x1bf0ba){while(--_0x1bf0ba){_0x2378d7['push'](_0x2378d7['shift']());}};_0x58dc15(++_0xd46258);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c52e6,_0x2a98fa){_0x5c52e6=_0x5c52e6-0x0;var _0x48c5ef=_0x5f2f[_0x5c52e6];return _0x48c5ef;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x12087f,_0x237c3f){var _0x2077bc=function(_0x5ba6c3){while(--_0x5ba6c3){_0x12087f['push'](_0x12087f['shift']());}};_0x2077bc(++_0x237c3f);}(_0xdb28,0x106));var _0x8db2=function(_0x3907e3,_0x368f4b){_0x3907e3=_0x3907e3-0x0;var _0x6a8704=_0xdb28[_0x3907e3];return _0x6a8704;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 5755ea7..31d3ba5 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 _0xe1fd=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x324f55,_0x2e6ca4){var _0x284952=function(_0x36ceae){while(--_0x36ceae){_0x324f55['push'](_0x324f55['shift']());}};_0x284952(++_0x2e6ca4);}(_0xe1fd,0x17e));var _0xde1f=function(_0x15afea,_0x22eb67){_0x15afea=_0x15afea-0x0;var _0x54005f=_0xe1fd[_0x15afea];return _0x54005f;};'use strict';function mergeDBDataToRealtime(_0x165f16,_0x5b79b7){var _0x42dc1b=Object['assign']({},_0x165f16);for(var _0x49c1f7 in _0x5b79b7){if(_0x42dc1b[_0xde1f('0x0')](_0x49c1f7)){_0x42dc1b[_0x49c1f7]=_0x5b79b7[_0x49c1f7];}}return _0x42dc1b;}exports[_0xde1f('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xbf92=['mergeDBDataToRealtime','assign'];(function(_0x26616b,_0x53dd60){var _0x338d18=function(_0xab49df){while(--_0xab49df){_0x26616b['push'](_0x26616b['shift']());}};_0x338d18(++_0x53dd60);}(_0xbf92,0x127));var _0x2bf9=function(_0x294c6f,_0x142372){_0x294c6f=_0x294c6f-0x0;var _0x5560ff=_0xbf92[_0x294c6f];return _0x5560ff;};'use strict';function mergeDBDataToRealtime(_0x2d65e6,_0x4718ce){var _0x476ebe=Object[_0x2bf9('0x0')]({},_0x2d65e6);for(var _0x35c830 in _0x4718ce){if(_0x476ebe['hasOwnProperty'](_0x35c830)){_0x476ebe[_0x35c830]=_0x4718ce[_0x35c830];}}return _0x476ebe;}exports[_0x2bf9('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 012a476..375a829 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 _0x717b=['./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','accountcode','name','isNil','find','interface','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','format','match','getAgentByInternal','keys','length','getCallType','channel','split','calleridnum','internal','destination','type','dialer','lastdata','queue','context','from-voip-provider','callerid','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','create','isArray','forEach','startsWith','indexOf','phone','substring','transfererlinkedid','attendedTransfer','exports','moment','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport'];(function(_0x2436d0,_0x354b64){var _0x47562b=function(_0x16e99d){while(--_0x16e99d){_0x2436d0['push'](_0x2436d0['shift']());}};_0x47562b(++_0x354b64);}(_0x717b,0xa6));var _0xb717=function(_0x5abfc0,_0x770944){_0x5abfc0=_0x5abfc0-0x0;var _0x11dc30=_0x717b[_0x5abfc0];return _0x11dc30;};'use strict';var _=require('lodash');var moment=require(_0xb717('0x0'));var util=require('util');var config=require(_0xb717('0x1'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xb717('0x2'));var RpcVoiceCallReport=require(_0xb717('0x3'));var RpcVoiceDialReport=require(_0xb717('0x4'));var RpcMemberReport=require(_0xb717('0x5'));var RpcVoiceQueueReport=require(_0xb717('0x6'));var RpcVoiceRecording=require(_0xb717('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xb717('0x8'));var VoiceCallReport=require(_0xb717('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xb717('0xa'));var UserReport=require(_0xb717('0xb'));function Report(_0x123448){this[_0xb717('0xc')]=_0x123448;this[_0xb717('0xd')]=_0x123448[_0xb717('0xd')];this[_0xb717('0xe')]=_0x123448[_0xb717('0xe')];}Report[_0xb717('0xf')]['sync']=function(_0x4f39d1){var _0x1e50db=new VoiceQueueReport(this[_0xb717('0xc')]);var _0x8e3538=new VoiceAgentReport(this['realtime']);var _0x1fb77a=new VoiceDialReport(this[_0xb717('0xc')]);var _0x253a9f=new VoiceCallReport(this['realtime']);var _0x27ae71=new UserReport(this[_0xb717('0xc')]);if(config[_0xb717('0x10')]&&config[_0xb717('0x10')][_0xb717('0x11')]){ami['on'](_0xb717('0x12'),this[_0xb717('0x13')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0xb717('0x14')][_0xb717('0x15')](this));ami['on'](_0xb717('0x16'),this[_0xb717('0x17')][_0xb717('0x15')](this));ami['on']('custom:voiceDialReport',this[_0xb717('0x18')][_0xb717('0x15')](this));ami['on'](_0xb717('0x19'),this[_0xb717('0x1a')][_0xb717('0x15')](this));ami['on'](_0xb717('0x1b'),this['attendedTransfer'][_0xb717('0x15')](this));}};Report[_0xb717('0xf')][_0xb717('0x1c')]=function(_0x521f90){var _0x1742b2;_0x1742b2=_['find'](this[_0xb717('0xd')],function(_0xcb0564){return _0xcb0564[_0xb717('0x1d')]==_0x521f90||_0xcb0564[_0xb717('0x1e')]==_0x521f90;});if(_[_0xb717('0x1f')](_0x1742b2)){var _0x4ec0ce=_[_0xb717('0x20')](this[_0xb717('0xe')],function(_0x34c0fe){return _0x34c0fe[_0xb717('0x1d')]==_0x521f90||_0x34c0fe['name']==_0x521f90;});if(_0x4ec0ce){_0x1742b2=_[_0xb717('0x20')](this['agents'],function(_0x2ce2ca){return _0x2ce2ca[_0xb717('0x21')]==util['format'](_0xb717('0x22'),_0x4ec0ce[_0xb717('0x1e')]);});}}return _0x1742b2;};Report['prototype'][_0xb717('0x13')]=function(_0x56514e){for(var _0x22ed64=0x0;_0x22ed64<_0x56514e['length'];_0x22ed64+=0x1){var _0x130240=this[_0xb717('0x1c')](_0x56514e[_0x22ed64][_0xb717('0x23')]);if(_0x130240){_0x56514e[_0x22ed64][_0xb717('0x1d')]=_0x130240[_0xb717('0x1d')];_0x56514e[_0x22ed64][_0xb717('0x24')]=!![];_0x56514e[_0x22ed64][_0xb717('0x25')]=_0x130240[_0xb717('0x1e')];_0x56514e[_0x22ed64][_0xb717('0x21')]=_['isNil'](_0x130240[_0xb717('0x21')])?util['format'](_0xb717('0x22'),_0x130240[_0xb717('0x1e')]):_0x130240[_0xb717('0x21')];if(_0x56514e[_0x22ed64][_0xb717('0x26')]){_0x56514e[_0x22ed64]['queuecallercompleteAt']=moment()['format'](_0xb717('0x27'));}if(_0x56514e[_0x22ed64]['queuecallerexit']){_0x56514e[_0x22ed64]['queuecallerexitAt']=moment()[_0xb717('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xb717('0x13')](_0x56514e[_0x22ed64]);}RpcVoiceQueueReport['create'](_0x56514e[_0x22ed64]);}};function extractCalleridNumber(_0x5a5de8){var _0x12a55d=_0x5a5de8[_0xb717('0x29')](/<(.*?)>/);return _0x12a55d?_0x12a55d[0x1]:_0x5a5de8;}Report['prototype'][_0xb717('0x2a')]=function(_0x2e2562){for(var _0xc351e4=0x0;_0xc351e4','calleridname','transfers','linkedid','uniqueid','UserId','monitor','monitors','monitorFilename','filename','exten','connectedlinename','membername','voiceAgentReport','isArray','Local','substring','indexOf','phone','transfererlinkedid','exports','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer'];(function(_0x3bd430,_0x2a2b41){var _0x35b96e=function(_0xb6a19c){while(--_0xb6a19c){_0x3bd430['push'](_0x3bd430['shift']());}};_0x35b96e(++_0x2a2b41);}(_0x3421,0x13e));var _0x1342=function(_0x13afd2,_0x228663){_0x13afd2=_0x13afd2-0x0;var _0x1ae021=_0x3421[_0x13afd2];return _0x1ae021;};'use strict';var _=require(_0x1342('0x0'));var moment=require('moment');var util=require(_0x1342('0x1'));var config=require(_0x1342('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x1342('0x3'));var RpcVoiceCallReport=require(_0x1342('0x4'));var RpcVoiceDialReport=require(_0x1342('0x5'));var RpcMemberReport=require(_0x1342('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x1342('0x7'));var VoiceCallReport=require(_0x1342('0x8'));var VoiceAgentReport=require(_0x1342('0x9'));var VoiceDialReport=require(_0x1342('0xa'));var UserReport=require(_0x1342('0xb'));function Report(_0x40a463){this[_0x1342('0xc')]=_0x40a463;this[_0x1342('0xd')]=_0x40a463['agents'];this[_0x1342('0xe')]=_0x40a463[_0x1342('0xe')];}Report['prototype'][_0x1342('0xf')]=function(_0x4491e8){var _0x4f61d3=new VoiceQueueReport(this[_0x1342('0xc')]);var _0x589ecc=new VoiceAgentReport(this[_0x1342('0xc')]);var _0x25c810=new VoiceDialReport(this['realtime']);var _0x291220=new VoiceCallReport(this['realtime']);var _0x553645=new UserReport(this[_0x1342('0xc')]);if(config['xdr']&&config[_0x1342('0x10')]['disabled']){ami['on'](_0x1342('0x11'),this[_0x1342('0x12')][_0x1342('0x13')](this));ami['on'](_0x1342('0x14'),this['voiceCallReport'][_0x1342('0x13')](this));ami['on'](_0x1342('0x15'),this['voiceAgentReport'][_0x1342('0x13')](this));ami['on'](_0x1342('0x16'),this[_0x1342('0x17')]['bind'](this));ami['on'](_0x1342('0x18'),this[_0x1342('0x19')]['bind'](this));ami['on']('attendedtransfer',this[_0x1342('0x1a')][_0x1342('0x13')](this));}};Report['prototype'][_0x1342('0x1b')]=function(_0x2ab39d){var _0x3ffc95;_0x3ffc95=_[_0x1342('0x1c')](this[_0x1342('0xd')],function(_0x4273ff){return _0x4273ff[_0x1342('0x1d')]==_0x2ab39d||_0x4273ff[_0x1342('0x1e')]==_0x2ab39d;});if(_[_0x1342('0x1f')](_0x3ffc95)){var _0x5a0837=_[_0x1342('0x1c')](this['telephones'],function(_0x59405e){return _0x59405e[_0x1342('0x1d')]==_0x2ab39d||_0x59405e['name']==_0x2ab39d;});if(_0x5a0837){_0x3ffc95=_['find'](this[_0x1342('0xd')],function(_0x3f61d7){return _0x3f61d7[_0x1342('0x20')]==util['format']('SIP/%s',_0x5a0837[_0x1342('0x1e')]);});}}return _0x3ffc95;};Report['prototype'][_0x1342('0x12')]=function(_0x2910b8){for(var _0x358164=0x0;_0x358164<_0x2910b8['length'];_0x358164+=0x1){var _0x4c7322=this['findAgent'](_0x2910b8[_0x358164]['connectedlinenum']);if(_0x4c7322){_0x2910b8[_0x358164][_0x1342('0x1d')]=_0x4c7322[_0x1342('0x1d')];_0x2910b8[_0x358164]['assigned']=!![];_0x2910b8[_0x358164][_0x1342('0x21')]=_0x4c7322['name'];_0x2910b8[_0x358164][_0x1342('0x20')]=_['isNil'](_0x4c7322[_0x1342('0x20')])?util[_0x1342('0x22')](_0x1342('0x23'),_0x4c7322[_0x1342('0x1e')]):_0x4c7322[_0x1342('0x20')];if(_0x2910b8[_0x358164][_0x1342('0x24')]){_0x2910b8[_0x358164][_0x1342('0x25')]=moment()[_0x1342('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2910b8[_0x358164]['queuecallerexit']){_0x2910b8[_0x358164][_0x1342('0x26')]=moment()[_0x1342('0x22')](_0x1342('0x27'));}RpcMemberReport[_0x1342('0x12')](_0x2910b8[_0x358164]);}RpcVoiceQueueReport[_0x1342('0x28')](_0x2910b8[_0x358164]);}};function extractCalleridNumber(_0x1ade88){var _0x23a501=_0x1ade88[_0x1342('0x29')](/<(.*?)>/);return _0x23a501?_0x23a501[0x1]:_0x1ade88;}Report[_0x1342('0x2a')]['getAgentByInternal']=function(_0x395775){for(var _0x4daf50=0x0;_0x4daf500x0?!![]:![];if(!_0x161be4){return this[_0x580b('0x1c')](this[_0x580b('0x18')][_0x580b('0x6b')]);}};VoiceQueueReport[_0x580b('0xd')][_0x580b('0x1d')]=function(_0x2e14e7){var _0x10361a=this['summary']['id'];if(this[_0x580b('0x18')][_0x580b('0x61')][_0x10361a]&&this['summary'][_0x580b('0x61')][_0x10361a][_0x2e14e7[_0x580b('0x60')]]){this[_0x580b('0x18')][_0x580b('0x61')][_0x10361a][_0x2e14e7[_0x580b('0x60')]][_0x580b('0x14')]['push'](_0x2e14e7);}};VoiceQueueReport[_0x580b('0xd')]['syncQueueSummary']=function(_0x430f41){var _0x4241be=this;try{if(this[_0x580b('0x6c')](_0x430f41)&&this[_0x580b('0x6c')](_0x430f41['queue'])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x580b('0x3f')](_0x430f41,{'showHidden':![],'depth':null}));var _0x6d99e8=this[_0x580b('0x16')][_0x430f41[_0x580b('0x52')]];if(_0x6d99e8){logger[_0x580b('0x58')](_0x580b('0x6d'),_0x6d99e8['name']);this[_0x580b('0x18')][_0x580b('0x5c')][_0x6d99e8['name']]={'summaryEvent':_0x430f41};this[_0x580b('0x18')][_0x580b('0x6a')]+=0x1;return ami[_0x580b('0x39')]({'action':'queuestatus','queue':_0x6d99e8[_0x580b('0x67')]})[_0x580b('0x5f')](function(_0x1e741a){if(!_0x4241be[_0x580b('0x18')][_0x580b('0x61')][_0x430f41[_0x580b('0x60')]]){_0x4241be[_0x580b('0x18')][_0x580b('0x61')][_0x430f41['actionid']]={};}_0x4241be['summary'][_0x580b('0x61')][_0x430f41[_0x580b('0x60')]][_0x1e741a[_0x580b('0x60')]]={'queue':_0x6d99e8[_0x580b('0x67')],'agents':[]};})[_0x580b('0x3c')](function(_0x3f4fdf){throw _0x3f4fdf;});}}}catch(_0x23feba){logger[_0x580b('0x43')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x23feba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x580b('0xd')]['syncQueueSummaryComplete']=function(_0x47acc0){if(this['summary'][_0x580b('0x6a')]>0x0){this[_0x580b('0x18')]['completeEvent']=_0x47acc0;return;}logger[_0x580b('0x58')](_0x580b('0x6e'),util['inspect'](_0x47acc0,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x580b('0x47')](_0x580b('0x6f'),{});};VoiceQueueReport['prototype'][_0x580b('0x1f')]=function(_0x1078c9){try{if(this[_0x580b('0x6c')](_0x1078c9)){logger[_0x580b('0x58')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1078c9[_0x580b('0x4a')],util[_0x580b('0x3f')](_0x1078c9,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x1078c9['uniqueid']])){this[_0x580b('0x12')][_0x1078c9[_0x580b('0x4a')]]=[];}if(_['isUndefined'](this[_0x580b('0x15')][_0x1078c9[_0x580b('0x4a')]])){this[_0x580b('0x15')][_0x1078c9[_0x580b('0x4a')]]={};}var _0x3d1924=new QueueReport();_0x3d1924[_0x580b('0x52')]=_0x1078c9[_0x580b('0x52')];_0x3d1924[_0x580b('0x56')]=this[_0x580b('0x16')][_0x3d1924[_0x580b('0x52')]]&&this[_0x580b('0x16')][_0x3d1924['queue']][_0x580b('0x56')]?this[_0x580b('0x16')][_0x3d1924[_0x580b('0x52')]][_0x580b('0x56')]||_0x580b('0x57'):'inbound';_0x3d1924['queuecallerjoinAt']=moment()[_0x580b('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d1924[_0x580b('0x70')]=_0x1078c9['position'];_0x3d1924[_0x580b('0x71')]=_0x1078c9[_0x580b('0x71')];_0x3d1924[_0x580b('0x4a')]=_0x1078c9[_0x580b('0x4a')];logger['info'](_0x580b('0x72'),_0x3d1924[_0x580b('0x52')],_0x3d1924[_0x580b('0x56')]);Object[_0x580b('0x73')](_0x3d1924,_[_0x580b('0x74')](_0x1078c9,_[_0x580b('0x75')](_0x3d1924)));this['queueReports'][_0x1078c9[_0x580b('0x4a')]][_0x580b('0x76')](_0x3d1924);this[_0x580b('0x15')][_0x1078c9[_0x580b('0x4a')]]=_0x3d1924;this['emitVoiceQueueChannelSave'](_0x3d1924,_0x580b('0x1e'));}}catch(_0x24bc03){logger[_0x580b('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1078c9[_0x580b('0x4a')],util[_0x580b('0x3f')](_0x24bc03,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x414b43){try{if(this[_0x580b('0x6c')](_0x414b43)){logger[_0x580b('0x58')](_0x580b('0x77'),_0x414b43['uniqueid'],util[_0x580b('0x3f')](_0x414b43,{'showHidden':![],'depth':null}));if(this[_0x580b('0x12')][_0x414b43[_0x580b('0x4a')]]){var _0x15aea4=_[_0x580b('0x78')](this[_0x580b('0x12')][_0x414b43['uniqueid']]);_0x15aea4['queuecallercomplete']=![];_0x15aea4[_0x580b('0x79')]=null;_0x15aea4[_0x580b('0x7a')]=_0x414b43[_0x580b('0x7a')];_0x15aea4[_0x580b('0x7b')]=_0x414b43[_0x580b('0x7b')];_0x15aea4[_0x580b('0x34')]=!![];_0x15aea4['queuecallerabandonAt']=moment()[_0x580b('0x4b')](_0x580b('0x7c'));_0x15aea4[_0x580b('0x50')]=_0x580b('0x7d');_0x15aea4[_0x580b('0x7e')]=null;logger[_0x580b('0x7f')](_0x580b('0x80'),_0x15aea4[_0x580b('0x52')],_0x15aea4[_0x580b('0x56')]);this[_0x580b('0x15')][_0x414b43[_0x580b('0x4a')]]=_0x15aea4;this['emitVoiceQueueChannelRemove'](_0x15aea4,_0x580b('0x34'));}}}catch(_0xe494f2){logger['error'](_0x580b('0x77'),_0x414b43['uniqueid'],util['inspect'](_0xe494f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x580b('0x21')]=function(_0x3de59d){try{if(this[_0x580b('0x6c')](_0x3de59d)){logger[_0x580b('0x58')]('[%s][voiceQueueReport][queuecallerleave]',_0x3de59d['uniqueid'],util[_0x580b('0x3f')](_0x3de59d,{'showHidden':![],'depth':null}));if(this[_0x580b('0x12')][_0x3de59d[_0x580b('0x4a')]]){var _0x540a61=_[_0x580b('0x78')](this[_0x580b('0x12')][_0x3de59d[_0x580b('0x4a')]]);_0x540a61['queuecallerleaveAt']=moment()[_0x580b('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x540a61[_0x580b('0x81')]=_0x3de59d['connectedlinenum'];_0x540a61[_0x580b('0x82')]=_0x3de59d[_0x580b('0x82')];logger[_0x580b('0x7f')](_0x580b('0x83'),_0x540a61[_0x580b('0x52')],_0x540a61[_0x580b('0x56')],_0x3de59d[_0x580b('0x81')],_0x3de59d['connectedlinename']);this[_0x580b('0x15')][_0x3de59d[_0x580b('0x4a')]]=_0x540a61;this[_0x580b('0x48')](_0x540a61,'queuecallerleave');}}}catch(_0x136246){logger[_0x580b('0x43')](_0x580b('0x84'),_0x3de59d[_0x580b('0x4a')],util[_0x580b('0x3f')](_0x136246,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x580b('0xd')]['syncAgentConnect']=function(_0x381b3d){try{if(this[_0x580b('0x6c')](_0x381b3d)){logger[_0x580b('0x58')](_0x580b('0x85'),_0x381b3d['uniqueid'],util[_0x580b('0x3f')](_0x381b3d,{'showHidden':![],'depth':null}));if(this[_0x580b('0x12')][_0x381b3d[_0x580b('0x4a')]]){var _0x37edb2=_['last'](this[_0x580b('0x12')][_0x381b3d[_0x580b('0x4a')]]);_0x37edb2[_0x580b('0x35')]=!![];_0x37edb2['queuecallerexitreason']=_0x580b('0x86');logger[_0x580b('0x7f')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x37edb2[_0x580b('0x52')],_0x37edb2[_0x580b('0x56')]);}}}catch(_0x5cf028){logger[_0x580b('0x43')](_0x580b('0x85'),_0x381b3d[_0x580b('0x4a')],util[_0x580b('0x3f')](_0x5cf028,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x580b('0xd')][_0x580b('0x87')]=function(_0x45088d){try{if(this[_0x580b('0x6c')](_0x45088d)){logger['debug'](_0x580b('0x88'),_0x45088d[_0x580b('0x4a')],util[_0x580b('0x3f')](_0x45088d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x45088d[_0x580b('0x4a')]]){var _0x192b80=_[_0x580b('0x78')](this[_0x580b('0x12')][_0x45088d['uniqueid']]);_0x192b80[_0x580b('0x34')]=![];_0x192b80[_0x580b('0x89')]=null;_0x192b80['assigned']=!![];_0x192b80[_0x580b('0x7e')]=_0x45088d[_0x580b('0x8a')];_0x192b80[_0x580b('0x7a')]=_0x45088d[_0x580b('0x7a')];_0x192b80[_0x580b('0x35')]=!![];_0x192b80[_0x580b('0x8b')]=![];_0x192b80[_0x580b('0x8c')]=null;if(!_0x192b80['transfer']){if(_0x45088d[_0x580b('0x8d')]==_0x580b('0x8e')){_0x192b80[_0x580b('0x50')]='COMPLETED';logger[_0x580b('0x7f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x192b80[_0x580b('0x52')],_0x192b80['type']);}else{if(_[_0x580b('0x8f')](_0x45088d[_0x580b('0x3b')]['toLowerCase'](),_0x580b('0x90'))){if(this[_0x580b('0x12')][_0x45088d[_0x580b('0x91')]]){var _0x15768d=_['last'](this[_0x580b('0x12')][_0x45088d[_0x580b('0x91')]]);_0x15768d[_0x580b('0x35')]=![];_0x15768d[_0x580b('0x8b')]=!![];_0x15768d['queuecallerexitAt']=moment(_0x192b80[_0x580b('0x92')])[_0x580b('0x93')](_0x45088d[_0x580b('0x7a')],_0x580b('0x94'))[_0x580b('0x4b')](_0x580b('0x7c'));_0x15768d[_0x580b('0x50')]=_0x580b('0x95');_0x15768d[_0x580b('0x8e')]=!![];_0x15768d[_0x580b('0x96')]=_0x580b('0x97');_0x15768d[_0x580b('0x98')]=_0x45088d['destexten'];_0x15768d['transferuniqueid']=_0x45088d[_0x580b('0x4a')];logger[_0x580b('0x7f')](_0x580b('0x99'),_0x15768d[_0x580b('0x52')],_0x15768d[_0x580b('0x56')]);var _0x4bb6fc=this[_0x580b('0x12')][_0x45088d[_0x580b('0x91')]];this[_0x580b('0x12')][_0x45088d[_0x580b('0x91')]]=this[_0x580b('0x12')][_0x45088d[_0x580b('0x4a')]];this[_0x580b('0x12')][_0x45088d['uniqueid']]=_0x4bb6fc;}}else{_0x192b80['queuecallerexitreason']=_0x580b('0x9a')+_0x45088d[_0x580b('0x8d')][_0x580b('0x9b')]();logger['info'](_0x580b('0x9c'),_0x192b80[_0x580b('0x52')],_0x192b80['type'],_0x192b80[_0x580b('0x50')]);}}}this[_0x580b('0x15')][_0x45088d[_0x580b('0x4a')]]=_0x192b80;}}}catch(_0x3c6d5d){logger[_0x580b('0x43')](_0x580b('0x88'),_0x45088d['uniqueid'],util['inspect'](_0x3c6d5d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x580b('0xd')]['syncVarSet']=function(_0x2bda25){try{if(this[_0x580b('0x6c')](_0x2bda25)){logger[_0x580b('0x58')]('[%s][voiceQueueReport][varset]',_0x2bda25[_0x580b('0x4a')],util[_0x580b('0x3f')](_0x2bda25,{'showHidden':![],'depth':null}));this['addVariable'](_0x2bda25[_0x580b('0x4a')],_['keys'](_0x2bda25[_0x580b('0x9d')])[0x0],_0x2bda25[_0x580b('0x9e')]);if(this[_0x580b('0x12')][_0x2bda25['uniqueid']]){var _0x136826=_[_0x580b('0x78')](this['queueReports'][_0x2bda25[_0x580b('0x4a')]]);if(_0x136826){if(this[_0x580b('0x6c')](_0x2bda25[_0x580b('0x9d')])&&this[_0x580b('0x6c')](_0x2bda25[_0x580b('0x9d')]['queuestatus'])){switch(_0x2bda25[_0x580b('0x9e')]){case _0x580b('0x9f'):_0x136826['queuecallerexit']=![];_0x136826['queuecallerexitAt']=null;break;case _0x580b('0xa0'):_0x136826[_0x580b('0xa1')]=_0x580b('0xa2');_0x136826[_0x580b('0x8b')]=!![];_0x136826[_0x580b('0x8c')]=moment()[_0x580b('0x4b')](_0x580b('0x7c'));_0x136826[_0x580b('0xa3')]=moment()['format'](_0x580b('0x7c'));logger['debug'](_0x580b('0xa4'),_0x2bda25[_0x580b('0x4a')],util['inspect'](_0x136826,{'showHidden':![],'depth':null}));ami[_0x580b('0x47')](_0x580b('0xa5'),_0x136826);break;default:_0x136826[_0x580b('0x8b')]=!![];_0x136826[_0x580b('0x8c')]=moment()[_0x580b('0x4b')](_0x580b('0x7c'));_0x136826['queuecallerleaveAt']=moment()[_0x580b('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x136826['queuecallerabandon']=![];_0x136826['queuecallerabandonAt']=null;_0x136826[_0x580b('0x50')]=_0x2bda25[_0x580b('0x9e')];this[_0x580b('0x15')][_0x2bda25[_0x580b('0x4a')]]=_0x136826;this[_0x580b('0x46')](_0x136826,_0x580b('0xa6'));}else if(this[_0x580b('0x6c')](_0x2bda25['variable'])&&this[_0x580b('0x6c')](_0x2bda25['variable'][_0x580b('0xa7')])){if(!_0x136826[_0x580b('0x34')]){_0x136826[_0x580b('0x8b')]=!![];_0x136826[_0x580b('0x8c')]=moment()[_0x580b('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x136826['queuecallerexitreason']='EXITWITHKEY';_0x136826[_0x580b('0xa3')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x580b('0x15')][_0x2bda25['uniqueid']]=_0x136826;}}logger[_0x580b('0x7f')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x2bda25[_0x580b('0x4a')],_0x136826[_0x580b('0x52')],_0x136826[_0x580b('0x56')],_[_0x580b('0x75')](_0x2bda25[_0x580b('0x9d')])[0x0],_0x2bda25[_0x580b('0x9e')]);_0x136826['variables']=this[_0x580b('0xa8')][_0x2bda25[_0x580b('0x4a')]];}}}}catch(_0xa4c49d){logger[_0x580b('0x43')](_0x580b('0xa9'),_0x2bda25[_0x580b('0x4a')],util[_0x580b('0x3f')](_0xa4c49d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x580b('0xd')]['addVariable']=function(_0x3c4f4f,_0x25f9d4,_0x54c24c){var _0x350ae9=[_0x580b('0xaa'),_0x580b('0xab'),_0x580b('0xac'),_0x580b('0xad'),_0x580b('0xae'),_0x580b('0xaf'),_0x580b('0xb0'),'rtpaudioqosrttbridged','sipcallid',_0x580b('0xb1'),'bridgepeer',_0x580b('0xb2'),_0x580b('0xb3'),_0x580b('0xb4'),_0x580b('0xb5'),'memberlastcall',_0x580b('0x8a'),_0x580b('0xb6'),_0x580b('0xb7')];if(!_[_0x580b('0x38')](_0x25f9d4)&&!_[_0x580b('0xb8')](_0x350ae9,_0x25f9d4)){if(_[_0x580b('0x5b')](this[_0x580b('0xa8')][_0x3c4f4f])){this[_0x580b('0xa8')][_0x3c4f4f]={};}this[_0x580b('0xa8')][_0x3c4f4f][_0x25f9d4]=_0x54c24c;}};VoiceQueueReport['prototype'][_0x580b('0xb9')]=function(_0x238792,_0x2ec1c7,_0x338dc8){try{var _0x51442f={};if(this['queueReports'][_0x238792]){for(var _0x3812ea=0x0;_0x3812ea0x0?!![]:![];if(!_0x57bfec){return this[_0x7889('0x13')](this[_0x7889('0x10')]['completeEvent']);}};VoiceQueueReport[_0x7889('0x32')]['syncQueueMember']=function(_0x21d58f){var _0x27f7cc=this[_0x7889('0x10')]['id'];if(this[_0x7889('0x10')][_0x7889('0x63')][_0x27f7cc]&&this['summary']['queuestatus'][_0x27f7cc][_0x21d58f[_0x7889('0x5c')]]){this[_0x7889('0x10')][_0x7889('0x63')][_0x27f7cc][_0x21d58f[_0x7889('0x5c')]][_0x7889('0xc')][_0x7889('0x69')](_0x21d58f);}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x11')]=function(_0x30af7a){var _0x305b60=this;try{if(this[_0x7889('0x6a')](_0x30af7a)&&this[_0x7889('0x6a')](_0x30af7a[_0x7889('0x4b')])){logger[_0x7889('0x46')](_0x7889('0x6b'),util[_0x7889('0x3d')](_0x30af7a,{'showHidden':![],'depth':null}));var _0x2dcd5e=this['voiceQueues'][_0x30af7a[_0x7889('0x4b')]];if(_0x2dcd5e){logger[_0x7889('0x46')](_0x7889('0x6c'),_0x2dcd5e[_0x7889('0x5e')]);this[_0x7889('0x10')]['queues'][_0x2dcd5e['name']]={'summaryEvent':_0x30af7a};this[_0x7889('0x10')][_0x7889('0x68')]+=0x1;return ami[_0x7889('0x57')]({'action':'queuestatus','queue':_0x2dcd5e[_0x7889('0x5e')]})[_0x7889('0x6d')](function(_0x26b965){if(!_0x305b60[_0x7889('0x10')][_0x7889('0x63')][_0x30af7a[_0x7889('0x5c')]]){_0x305b60[_0x7889('0x10')][_0x7889('0x63')][_0x30af7a['actionid']]={};}_0x305b60[_0x7889('0x10')][_0x7889('0x63')][_0x30af7a['actionid']][_0x26b965[_0x7889('0x5c')]]={'queue':_0x2dcd5e[_0x7889('0x5e')],'agents':[]};})['catch'](function(_0x375fc4){throw _0x375fc4;});}}}catch(_0x4d9b22){logger[_0x7889('0x3b')](_0x7889('0x6e'),util[_0x7889('0x3d')](_0x4d9b22,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7889('0x13')]=function(_0x2a35d4){if(this[_0x7889('0x10')]['statusRequests']>0x0){this[_0x7889('0x10')][_0x7889('0x6f')]=_0x2a35d4;return;}logger['debug'](_0x7889('0x70'),util[_0x7889('0x3d')](_0x2a35d4,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x7889('0x44')](_0x7889('0x71'),{});};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x17')]=function(_0x5ec9c3){try{if(this[_0x7889('0x6a')](_0x5ec9c3)){logger['debug'](_0x7889('0x72'),_0x5ec9c3[_0x7889('0x49')],util[_0x7889('0x3d')](_0x5ec9c3,{'showHidden':![],'depth':null}));if(_[_0x7889('0x55')](this[_0x7889('0x3e')][_0x5ec9c3[_0x7889('0x49')]])){this['queueReports'][_0x5ec9c3['uniqueid']]=[];}if(_[_0x7889('0x55')](this[_0x7889('0x33')][_0x5ec9c3[_0x7889('0x49')]])){this['channels'][_0x5ec9c3[_0x7889('0x49')]]={};}var _0x4c03b1=new QueueReport();_0x4c03b1[_0x7889('0x4b')]=_0x5ec9c3[_0x7889('0x4b')];_0x4c03b1[_0x7889('0x64')]=this['voiceQueues'][_0x4c03b1[_0x7889('0x4b')]]&&this[_0x7889('0xe')][_0x4c03b1[_0x7889('0x4b')]][_0x7889('0x64')]?this[_0x7889('0xe')][_0x4c03b1[_0x7889('0x4b')]][_0x7889('0x64')]||_0x7889('0x65'):_0x7889('0x65');_0x4c03b1[_0x7889('0x73')]=moment()['format'](_0x7889('0x74'));_0x4c03b1[_0x7889('0x75')]=_0x5ec9c3[_0x7889('0x75')];_0x4c03b1[_0x7889('0x76')]=_0x5ec9c3[_0x7889('0x76')];_0x4c03b1[_0x7889('0x49')]=_0x5ec9c3[_0x7889('0x49')];logger[_0x7889('0x77')](_0x7889('0x78'),_0x4c03b1[_0x7889('0x4b')],_0x4c03b1[_0x7889('0x64')]);Object[_0x7889('0x61')](_0x4c03b1,_[_0x7889('0x79')](_0x5ec9c3,_['keys'](_0x4c03b1)));this[_0x7889('0x3e')][_0x5ec9c3['uniqueid']][_0x7889('0x69')](_0x4c03b1);this['channels'][_0x5ec9c3['uniqueid']]=_0x4c03b1;this[_0x7889('0x45')](_0x4c03b1,'queuecallerjoin');}}catch(_0x808170){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x5ec9c3['uniqueid'],util[_0x7889('0x3d')](_0x808170,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x19')]=function(_0x123f53){try{if(this[_0x7889('0x6a')](_0x123f53)){logger[_0x7889('0x46')](_0x7889('0x7a'),_0x123f53[_0x7889('0x49')],util['inspect'](_0x123f53,{'showHidden':![],'depth':null}));if(this[_0x7889('0x3e')][_0x123f53[_0x7889('0x49')]]){var _0x38d2eb=_['last'](this[_0x7889('0x3e')][_0x123f53[_0x7889('0x49')]]);_0x38d2eb['queuecallercomplete']=![];_0x38d2eb[_0x7889('0x7b')]=null;_0x38d2eb['holdtime']=_0x123f53[_0x7889('0x7c')];_0x38d2eb[_0x7889('0x7d')]=_0x123f53[_0x7889('0x7d')];_0x38d2eb[_0x7889('0x18')]=!![];_0x38d2eb['queuecallerabandonAt']=moment()[_0x7889('0x4a')](_0x7889('0x74'));_0x38d2eb[_0x7889('0x4e')]=_0x7889('0x7e');_0x38d2eb['lastAssignedTo']=null;logger[_0x7889('0x77')](_0x7889('0x7f'),_0x38d2eb[_0x7889('0x4b')],_0x38d2eb[_0x7889('0x64')]);this[_0x7889('0x33')][_0x123f53[_0x7889('0x49')]]=_0x38d2eb;this[_0x7889('0x43')](_0x38d2eb,_0x7889('0x18'));}}}catch(_0xc7c38d){logger[_0x7889('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x123f53['uniqueid'],util['inspect'](_0xc7c38d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')]['syncQueueCallerLeave']=function(_0x12e9fc){try{if(this['isNotNull'](_0x12e9fc)){logger['debug'](_0x7889('0x80'),_0x12e9fc[_0x7889('0x49')],util[_0x7889('0x3d')](_0x12e9fc,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x12e9fc[_0x7889('0x49')]]){var _0x22b67f=_[_0x7889('0x81')](this[_0x7889('0x3e')][_0x12e9fc[_0x7889('0x49')]]);_0x22b67f[_0x7889('0x82')]=moment()[_0x7889('0x4a')](_0x7889('0x74'));_0x22b67f['connectedlinenum']=_0x12e9fc[_0x7889('0x83')];_0x22b67f[_0x7889('0x84')]=_0x12e9fc[_0x7889('0x84')];logger['info'](_0x7889('0x85'),_0x22b67f[_0x7889('0x4b')],_0x22b67f['type'],_0x12e9fc[_0x7889('0x83')],_0x12e9fc[_0x7889('0x84')]);this[_0x7889('0x33')][_0x12e9fc['uniqueid']]=_0x22b67f;this[_0x7889('0x45')](_0x22b67f,_0x7889('0x1a'));}}}catch(_0x5cc1b3){logger['error'](_0x7889('0x80'),_0x12e9fc[_0x7889('0x49')],util['inspect'](_0x5cc1b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x1d')]=function(_0x3701f4){try{if(this['isNotNull'](_0x3701f4)){logger[_0x7889('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x3701f4[_0x7889('0x49')],util[_0x7889('0x3d')](_0x3701f4,{'showHidden':![],'depth':null}));if(this[_0x7889('0x3e')][_0x3701f4[_0x7889('0x49')]]){var _0x2e053e=_[_0x7889('0x81')](this[_0x7889('0x3e')][_0x3701f4['uniqueid']]);_0x2e053e[_0x7889('0x86')]=!![];_0x2e053e['queuecallerexitreason']=_0x7889('0x87');logger[_0x7889('0x77')](_0x7889('0x88'),_0x2e053e[_0x7889('0x4b')],_0x2e053e[_0x7889('0x64')]);}}}catch(_0x2cb782){logger[_0x7889('0x3b')](_0x7889('0x89'),_0x3701f4[_0x7889('0x49')],util[_0x7889('0x3d')](_0x2cb782,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x8a')]=function(_0x13db4a){try{if(this['isNotNull'](_0x13db4a)){logger[_0x7889('0x46')](_0x7889('0x8b'),_0x13db4a['uniqueid'],util['inspect'](_0x13db4a,{'showHidden':![],'depth':null}));if(this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x49')]]){var _0x261906=_[_0x7889('0x81')](this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x49')]]);_0x261906[_0x7889('0x18')]=![];_0x261906[_0x7889('0x8c')]=null;_0x261906['assigned']=!![];_0x261906['lastAssignedTo']=_0x13db4a[_0x7889('0x8d')];_0x261906['holdtime']=_0x13db4a['holdtime'];_0x261906['queuecallercomplete']=!![];_0x261906[_0x7889('0x8e')]=![];_0x261906[_0x7889('0x8f')]=null;if(!_0x261906[_0x7889('0x90')]){if(_0x13db4a['reason']==_0x7889('0x90')){_0x261906[_0x7889('0x4e')]=_0x7889('0x91');logger[_0x7889('0x77')](_0x7889('0x92'),_0x261906[_0x7889('0x4b')],_0x261906[_0x7889('0x64')]);}else{if(_[_0x7889('0x93')](_0x13db4a[_0x7889('0x94')]['toLowerCase'](),_0x7889('0x95'))){if(this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x96')]]){var _0x318e79=_[_0x7889('0x81')](this[_0x7889('0x3e')][_0x13db4a['linkedid']]);_0x318e79[_0x7889('0x86')]=![];_0x318e79[_0x7889('0x8e')]=!![];_0x318e79[_0x7889('0x8f')]=moment(_0x261906[_0x7889('0x73')])[_0x7889('0x97')](_0x13db4a[_0x7889('0x7c')],_0x7889('0x98'))[_0x7889('0x4a')](_0x7889('0x74'));_0x318e79[_0x7889('0x4e')]='FORWARDTRANSFER';_0x318e79['transfer']=!![];_0x318e79[_0x7889('0x99')]=_0x7889('0x9a');_0x318e79[_0x7889('0x9b')]=_0x13db4a[_0x7889('0x9c')];_0x318e79[_0x7889('0x9d')]=_0x13db4a[_0x7889('0x49')];logger['info'](_0x7889('0x9e'),_0x318e79[_0x7889('0x4b')],_0x318e79[_0x7889('0x64')]);var _0x42f610=this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x96')]];this['queueReports'][_0x13db4a['linkedid']]=this['queueReports'][_0x13db4a[_0x7889('0x49')]];this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x49')]]=_0x42f610;}}else{_0x261906[_0x7889('0x4e')]='COMPLETEDBY'+_0x13db4a[_0x7889('0x9f')][_0x7889('0xa0')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x261906['queue'],_0x261906[_0x7889('0x64')],_0x261906[_0x7889('0x4e')]);}}}this[_0x7889('0x33')][_0x13db4a[_0x7889('0x49')]]=_0x261906;}}}catch(_0x4b1599){logger[_0x7889('0x3b')](_0x7889('0x8b'),_0x13db4a[_0x7889('0x49')],util[_0x7889('0x3d')](_0x4b1599,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x1f')]=function(_0x5e2faa){try{if(this['isNotNull'](_0x5e2faa)){logger['debug'](_0x7889('0xa1'),_0x5e2faa[_0x7889('0x49')],util[_0x7889('0x3d')](_0x5e2faa,{'showHidden':![],'depth':null}));this[_0x7889('0xa2')](_0x5e2faa[_0x7889('0x49')],_[_0x7889('0xa3')](_0x5e2faa[_0x7889('0xa4')])[0x0],_0x5e2faa['value']);if(this['queueReports'][_0x5e2faa['uniqueid']]){var _0x53ccc9=_[_0x7889('0x81')](this['queueReports'][_0x5e2faa['uniqueid']]);if(_0x53ccc9){if(this[_0x7889('0x6a')](_0x5e2faa[_0x7889('0xa4')])&&this[_0x7889('0x6a')](_0x5e2faa['variable'][_0x7889('0x63')])){switch(_0x5e2faa[_0x7889('0xa5')]){case _0x7889('0xa6'):_0x53ccc9[_0x7889('0x8e')]=![];_0x53ccc9['queuecallerexitAt']=null;break;case'TIMEOUT':_0x53ccc9[_0x7889('0xa7')]=_0x7889('0xa8');_0x53ccc9['queuecallerexit']=!![];_0x53ccc9['queuecallerexitAt']=moment()[_0x7889('0x4a')](_0x7889('0x74'));_0x53ccc9[_0x7889('0x82')]=moment()[_0x7889('0x4a')](_0x7889('0x74'));logger[_0x7889('0x46')](_0x7889('0xa9'),_0x5e2faa[_0x7889('0x49')],util[_0x7889('0x3d')](_0x53ccc9,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x53ccc9);break;default:_0x53ccc9[_0x7889('0x8e')]=!![];_0x53ccc9[_0x7889('0x8f')]=moment()['format'](_0x7889('0x74'));_0x53ccc9[_0x7889('0x82')]=moment()[_0x7889('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x53ccc9[_0x7889('0x18')]=![];_0x53ccc9[_0x7889('0x8c')]=null;_0x53ccc9[_0x7889('0x4e')]=_0x5e2faa[_0x7889('0xa5')];this['channels'][_0x5e2faa[_0x7889('0x49')]]=_0x53ccc9;this[_0x7889('0x43')](_0x53ccc9,_0x7889('0x1e'));}else if(this[_0x7889('0x6a')](_0x5e2faa[_0x7889('0xa4')])&&this[_0x7889('0x6a')](_0x5e2faa['variable'][_0x7889('0xaa')])){if(!_0x53ccc9['queuecallerabandon']){_0x53ccc9[_0x7889('0x8e')]=!![];_0x53ccc9[_0x7889('0x8f')]=moment()[_0x7889('0x4a')](_0x7889('0x74'));_0x53ccc9['queuecallerexitreason']=_0x7889('0xab');_0x53ccc9[_0x7889('0x82')]=moment()[_0x7889('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7889('0x33')][_0x5e2faa[_0x7889('0x49')]]=_0x53ccc9;}}logger[_0x7889('0x77')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x5e2faa['uniqueid'],_0x53ccc9['queue'],_0x53ccc9['type'],_[_0x7889('0xa3')](_0x5e2faa[_0x7889('0xa4')])[0x0],_0x5e2faa[_0x7889('0xa5')]);_0x53ccc9[_0x7889('0x3f')]=this['variables'][_0x5e2faa[_0x7889('0x49')]];}}}}catch(_0x20729a){logger[_0x7889('0x3b')](_0x7889('0xa1'),_0x5e2faa[_0x7889('0x49')],util[_0x7889('0x3d')](_0x20729a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7889('0xa2')]=function(_0x42d881,_0x5e92ce,_0x22c77a){var _0x5ab19a=[_0x7889('0xac'),_0x7889('0xad'),'rtpaudioqosjitter',_0x7889('0xae'),_0x7889('0xaf'),'rtpaudioqoslossbridged',_0x7889('0xb0'),_0x7889('0xb1'),_0x7889('0xb2'),_0x7889('0xb3'),_0x7889('0xb4'),_0x7889('0xb5'),_0x7889('0xb6'),_0x7889('0xb7'),_0x7889('0xb8'),_0x7889('0xb9'),'membername','memberpenalty','memberrealtime'];if(!_[_0x7889('0x36')](_0x5e92ce)&&!_['includes'](_0x5ab19a,_0x5e92ce)){if(_[_0x7889('0x55')](this[_0x7889('0x3f')][_0x42d881])){this['variables'][_0x42d881]={};}this['variables'][_0x42d881][_0x5e92ce]=_0x22c77a;}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0xba')]=function(_0x495161,_0x1f40ba,_0x4ae3b4){try{var _0x18fdf0={};if(this[_0x7889('0x3e')][_0x495161]){for(var _0x5947f6=0x0;_0x5947f6=0x0?moment(_0x164bab['endtime'])['diff'](_0x164bab['starttime'],_0xd786('0x1a')):null,'data1':_0xd786('0x1b'),'data2':_0x164bab[_0xd786('0x12')],'data3':_0x164bab[_0xd786('0x10')],'data4':_0x164bab[_0xd786('0x1c')]||null,'role':'agent','internal':_0x164bab[_0xd786('0x12')]?_[_0xd786('0x13')](_0x164bab[_0xd786('0x12')]):undefined,'uniqueid':_0x164bab[_0xd786('0x14')]},'log':_0xd786('0x6')});}; \ No newline at end of file +var _0xccee=['seconds','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff'];(function(_0x1f91f1,_0xdbc1a1){var _0x1df196=function(_0x470b0d){while(--_0x470b0d){_0x1f91f1['push'](_0x1f91f1['shift']());}};_0x1df196(++_0xdbc1a1);}(_0xccee,0xfd));var _0xecce=function(_0x27eb9f,_0x526697){_0x27eb9f=_0x27eb9f-0x0;var _0x1df860=_0xccee[_0x27eb9f];return _0x1df860;};'use strict';var moment=require(_0xecce('0x0'));var _=require(_0xecce('0x1'));var util=require(_0xecce('0x2'));var client=require('../client');exports[_0xecce('0x3')]=function(_0x307df8){var _0x8469e=_0x307df8[_0xecce('0x4')]||_0x307df8[_0xecce('0x5')];return client[_0xecce('0x6')](_0xecce('0x7'),{'body':{'channel':_0xecce('0x8'),'membername':_0x307df8['lastAssignedTo'],'interface':_[_0xecce('0x9')](_0x307df8[_0xecce('0xa')])?util[_0xecce('0xb')](_0xecce('0xc'),_0x307df8[_0xecce('0xd')]):_0x307df8[_0xecce('0xa')],'type':_0xecce('0xe'),'enterAt':_0x307df8[_0xecce('0xf')],'exitAt':_0x8469e,'duration':moment(_0x8469e)[_0xecce('0x10')](_0x307df8[_0xecce('0xf')],_0xecce('0x11')),'data1':'inbound','data2':_0x307df8[_0xecce('0x12')],'data3':_0x307df8[_0xecce('0x13')],'data4':null,'data5':_0x307df8[_0xecce('0x14')],'role':_0xecce('0x15'),'internal':_0x307df8['accountcode']?_['toNumber'](_0x307df8[_0xecce('0x16')]):undefined,'uniqueid':_0x307df8[_0xecce('0x17')]},'log':'CreateMemberReport'});};exports[_0xecce('0x18')]=function(_0x13cfec){return client[_0xecce('0x6')]('CreateMemberReport',{'body':{'channel':_0xecce('0x8'),'membername':_0x13cfec[_0xecce('0x19')],'interface':_0x13cfec[_0xecce('0xa')],'type':_0xecce('0xe'),'enterAt':_0x13cfec[_0xecce('0x1a')],'exitAt':_0x13cfec['endtime'],'duration':moment(_0x13cfec[_0xecce('0x1b')])[_0xecce('0x10')](_0x13cfec[_0xecce('0x1a')],'seconds')>=0x0?moment(_0x13cfec[_0xecce('0x1b')])[_0xecce('0x10')](_0x13cfec[_0xecce('0x1a')],_0xecce('0x11')):null,'data1':_0xecce('0x1c'),'data2':_0x13cfec[_0xecce('0x16')],'data3':_0x13cfec[_0xecce('0x13')],'data4':_0x13cfec[_0xecce('0x1d')]||null,'role':'agent','internal':_0x13cfec[_0xecce('0x16')]?_['toNumber'](_0x13cfec[_0xecce('0x16')]):undefined,'uniqueid':_0x13cfec[_0xecce('0x17')]},'log':_0xecce('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 2ff0a7a..d2685c6 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 _0x1d91=['../client','getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0xdfc87d,_0x28e1a5){var _0x4e2a5e=function(_0x55f2f7){while(--_0x55f2f7){_0xdfc87d['push'](_0xdfc87d['shift']());}};_0x4e2a5e(++_0x28e1a5);}(_0x1d91,0x150));var _0x11d9=function(_0x3a1ed1,_0x1da176){_0x3a1ed1=_0x3a1ed1-0x0;var _0x1a282c=_0x1d91[_0x3a1ed1];return _0x1a282c;};'use strict';var client=require(_0x11d9('0x0'));exports[_0x11d9('0x1')]=function(){return client[_0x11d9('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x11d9('0x3'),_0x11d9('0x4')]},'log':_0x11d9('0x5')});}; \ No newline at end of file +var _0x8c7d=['../client','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x8c7d,0xe1));var _0xd8c7=function(_0x4b8f78,_0x5e0b56){_0x4b8f78=_0x4b8f78-0x0;var _0x9aa5f7=_0x8c7d[_0x4b8f78];return _0x9aa5f7;};'use strict';var client=require(_0xd8c7('0x0'));exports['getSettings']=function(){return client[_0xd8c7('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd8c7('0x2'),_0xd8c7('0x3')]},'log':_0xd8c7('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 1c0c8db..d2ad51b 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 _0x5a13=['GetTemplate','name','getTemplates','Request'];(function(_0x3c2a87,_0x301e33){var _0x3a4efd=function(_0x2c5e19){while(--_0x2c5e19){_0x3c2a87['push'](_0x3c2a87['shift']());}};_0x3a4efd(++_0x301e33);}(_0x5a13,0x92));var _0x35a1=function(_0x43b58a,_0x3f502b){_0x43b58a=_0x43b58a-0x0;var _0x3d9f06=_0x5a13[_0x43b58a];return _0x3d9f06;};'use strict';var client=require('../client');exports[_0x35a1('0x0')]=function(_0x2447dc){return function(_0x12c089){return client[_0x35a1('0x1')](_0x35a1('0x2'),{'options':{'raw':!![],'attributes':['id',_0x35a1('0x3'),'html']},'log':_0x35a1('0x2')});};}; \ No newline at end of file +var _0x846a=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x846a,0x104));var _0xa846=function(_0x33dade,_0x494e46){_0x33dade=_0x33dade-0x0;var _0x5d1eba=_0x846a[_0x33dade];return _0x5d1eba;};'use strict';var client=require(_0xa846('0x0'));exports[_0xa846('0x1')]=function(_0x1848c4){return function(_0x2a4ab2){return client[_0xa846('0x2')](_0xa846('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa846('0x4'),_0xa846('0x5')]},'log':_0xa846('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 56151f9..66722cc 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 _0xb27a=['../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','value','AnyConditions','operator','Action','Actions','data2','data3','data4','data7'];(function(_0x18a31f,_0x5b4cc5){var _0x1bea03=function(_0x59b5ea){while(--_0x59b5ea){_0x18a31f['push'](_0x18a31f['shift']());}};_0x1bea03(++_0x5b4cc5);}(_0xb27a,0x1b5));var _0xab27=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0xb27a[_0x2ca616];return _0x53155f;};'use strict';var client=require(_0xab27('0x0'));exports[_0xab27('0x1')]=function(_0x10e620){return function(_0x24c8cb){return client[_0xab27('0x2')](_0xab27('0x3'),{'options':{'raw':![],'attributes':['id',_0xab27('0x4'),_0xab27('0x5'),_0xab27('0x6')],'include':[{'model':_0xab27('0x7'),'as':_0xab27('0x8'),'attributes':['id',_0xab27('0x9'),'operator',_0xab27('0xa')]},{'model':_0xab27('0x7'),'as':_0xab27('0xb'),'attributes':['id',_0xab27('0x9'),_0xab27('0xc'),'value']},{'model':_0xab27('0xd'),'as':_0xab27('0xe'),'attributes':['id','action','data1',_0xab27('0xf'),_0xab27('0x10'),_0xab27('0x11'),'data5','data6',_0xab27('0x12')]}]},'log':_0xab27('0x3')});};}; \ No newline at end of file +var _0xfae6=['data5','data6','data7','../client','Request','channel','status','Condition','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data4'];(function(_0x71d6aa,_0x366bb3){var _0x2e80c2=function(_0x821d4e){while(--_0x821d4e){_0x71d6aa['push'](_0x71d6aa['shift']());}};_0x2e80c2(++_0x366bb3);}(_0xfae6,0x147));var _0x6fae=function(_0x5f1a92,_0xde5c39){_0x5f1a92=_0x5f1a92-0x0;var _0x39c21a=_0xfae6[_0x5f1a92];return _0x39c21a;};'use strict';var client=require(_0x6fae('0x0'));exports['getTriggers']=function(_0x48264b){return function(_0xc8505a){return client[_0x6fae('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x6fae('0x2'),_0x6fae('0x3')],'include':[{'model':_0x6fae('0x4'),'as':'AllConditions','attributes':['id',_0x6fae('0x5'),_0x6fae('0x6'),_0x6fae('0x7')]},{'model':_0x6fae('0x4'),'as':_0x6fae('0x8'),'attributes':['id',_0x6fae('0x5'),_0x6fae('0x6'),_0x6fae('0x7')]},{'model':_0x6fae('0x9'),'as':_0x6fae('0xa'),'attributes':['id',_0x6fae('0xb'),_0x6fae('0xc'),_0x6fae('0xd'),'data3',_0x6fae('0xe'),_0x6fae('0xf'),_0x6fae('0x10'),_0x6fae('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index bccc490..fd4cf39 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 _0x2123=['defaultuser','../client','getTrunks','Request','GetTrunk','name','registry'];(function(_0x48a483,_0xbd8b1a){var _0x24e745=function(_0x50330a){while(--_0x50330a){_0x48a483['push'](_0x48a483['shift']());}};_0x24e745(++_0xbd8b1a);}(_0x2123,0x190));var _0x3212=function(_0x3adb57,_0x4fce3d){_0x3adb57=_0x3adb57-0x0;var _0x27ed5e=_0x2123[_0x3adb57];return _0x27ed5e;};'use strict';var client=require(_0x3212('0x0'));exports[_0x3212('0x1')]=function(_0x420d05){return function(_0x3424c2){return client[_0x3212('0x2')](_0x3212('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3212('0x4'),_0x3212('0x5'),_0x3212('0x6')]},'log':_0x3212('0x3')});};}; \ No newline at end of file +var _0x3397=['getTrunks','Request','GetTrunk','registry','defaultuser','../client'];(function(_0x309458,_0xba6e63){var _0x3306ee=function(_0x47e10c){while(--_0x47e10c){_0x309458['push'](_0x309458['shift']());}};_0x3306ee(++_0xba6e63);}(_0x3397,0x1a3));var _0x7339=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x3397[_0x3fad5a];return _0x4ca713;};'use strict';var client=require(_0x7339('0x0'));exports[_0x7339('0x1')]=function(_0x4f2421){return function(_0x4b77bf){return client[_0x7339('0x2')](_0x7339('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x7339('0x4'),_0x7339('0x5')]},'log':_0x7339('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 20a901d..9680c1d 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x2281e0,_0x4cb815){var _0x17c112=function(_0x1ef32b){while(--_0x1ef32b){_0x2281e0['push'](_0x2281e0['shift']());}};_0x17c112(++_0x4cb815);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xcb91[_0xc8a931];return _0x28bd27;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x531d80,_0x433b6b){var _0x2ae50e=function(_0x3744ed){while(--_0x3744ed){_0x531d80['push'](_0x531d80['shift']());}};_0x2ae50e(++_0x433b6b);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f88ac88..a3abd50 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 _0xd24f=['create','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0xd24f,0x1b2));var _0xfd24=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0xd24f[_0x2af160];return _0x439d67;};'use strict';var client=require(_0xfd24('0x0'));exports[_0xfd24('0x1')]=function(_0x2d3b8e){return client['Request'](_0xfd24('0x2'),{'body':_0x2d3b8e,'log':_0xfd24('0x2')});};exports[_0xfd24('0x3')]=function(_0xc2214d,_0x248d42,_0x40c93e){return client['Request'](_0xfd24('0x4'),{'body':_0xc2214d,'options':{'where':{'uniqueid':_0x248d42,'interface':_0x40c93e,'agentcomplete':!![]}},'log':_0xfd24('0x4')});}; \ No newline at end of file +var _0x79b0=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x79b0,0x8c));var _0x079b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x79b0[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x079b('0x0'));exports[_0x079b('0x1')]=function(_0x25a553){return client['Request'](_0x079b('0x2'),{'body':_0x25a553,'log':_0x079b('0x2')});};exports[_0x079b('0x3')]=function(_0x1a3b77,_0x4cb664,_0x2701f2){return client[_0x079b('0x4')](_0x079b('0x5'),{'body':_0x1a3b77,'options':{'where':{'uniqueid':_0x4cb664,'interface':_0x2701f2,'agentcomplete':!![]}},'log':_0x079b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 56784c7..3320cb9 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 _0x3800=['calleridnum','context','callerid','CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','create','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3800,0xc2));var _0x0380=function(_0x59445a,_0x3ed9dc){_0x59445a=_0x59445a-0x0;var _0xe5340c=_0x3800[_0x59445a];return _0xe5340c;};'use strict';var moment=require(_0x0380('0x0'));var util=require(_0x0380('0x1'));var _=require('lodash');var client=require('../client');exports[_0x0380('0x2')]=function(_0x27f60f){return client['Request']('CreateVoiceCallReport',{'body':_[_0x0380('0x3')](_0x27f60f,{'source':_0x27f60f[_0x0380('0x4')],'destinationcontext':_0x27f60f[_0x0380('0x5')],'callerid':_0x27f60f[_0x0380('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0x0380('0x7')});};exports[_0x0380('0x8')]=function(){return function(){return client[_0x0380('0x9')](_0x0380('0xa'),{'options':{'where':{'type':[_0x0380('0xb')],'createdAt':{'$between':[moment()[_0x0380('0xc')](_0x0380('0xd'))[_0x0380('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x0380('0xf')](_0x0380('0xd'))['format'](_0x0380('0x10'))]}},'attributes':[_0x0380('0x11'),_0x0380('0x12'),_0x0380('0x13'),_0x0380('0x14')]},'log':_0x0380('0x15')});};}; \ No newline at end of file +var _0x49d0=['../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment','util','lodash'];(function(_0xdae8e6,_0x34854a){var _0x24c7a7=function(_0x5492a3){while(--_0x5492a3){_0xdae8e6['push'](_0xdae8e6['shift']());}};_0x24c7a7(++_0x34854a);}(_0x49d0,0x1a1));var _0x049d=function(_0x1f473c,_0x4e9362){_0x1f473c=_0x1f473c-0x0;var _0x369d97=_0x49d0[_0x1f473c];return _0x369d97;};'use strict';var moment=require(_0x049d('0x0'));var util=require(_0x049d('0x1'));var _=require(_0x049d('0x2'));var client=require(_0x049d('0x3'));exports[_0x049d('0x4')]=function(_0x4905cc){return client[_0x049d('0x5')](_0x049d('0x6'),{'body':_[_0x049d('0x7')](_0x4905cc,{'source':_0x4905cc[_0x049d('0x8')],'destinationcontext':_0x4905cc[_0x049d('0x9')],'callerid':_0x4905cc[_0x049d('0xa')],'amaflags':_0x049d('0xb')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x049d('0x5')](_0x049d('0xc'),{'options':{'where':{'type':[_0x049d('0xd')],'createdAt':{'$between':[moment()['startOf'](_0x049d('0xe'))[_0x049d('0xf')](_0x049d('0x10')),moment()['endOf']('day')[_0x049d('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x049d('0x11'),_0x049d('0x12'),_0x049d('0x13'),_0x049d('0x14')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f7987ce..d5ec22e 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 _0x351b=['../client','create','Request'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x351b,0x1c5));var _0xb351=function(_0x473be2,_0x3f0ab7){_0x473be2=_0x473be2-0x0;var _0x2bc8ba=_0x351b[_0x473be2];return _0x2bc8ba;};'use strict';var client=require(_0xb351('0x0'));exports[_0xb351('0x1')]=function(_0x20758c){return client[_0xb351('0x2')]('CreateVoiceDialReport',{'body':_0x20758c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x2326=['../client','create','Request','CreateVoiceDialReport'];(function(_0x5a763d,_0xf6dad1){var _0x3128d9=function(_0xbb5421){while(--_0xbb5421){_0x5a763d['push'](_0x5a763d['shift']());}};_0x3128d9(++_0xf6dad1);}(_0x2326,0x124));var _0x6232=function(_0x1c285b,_0x70e1b0){_0x1c285b=_0x1c285b-0x0;var _0x2fb145=_0x2326[_0x1c285b];return _0x2fb145;};'use strict';var client=require(_0x6232('0x0'));exports[_0x6232('0x1')]=function(_0x1fee5b){return client[_0x6232('0x2')](_0x6232('0x3'),{'body':_0x1fee5b,'log':_0x6232('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 8565dca..47e6c45 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 _0x7d98=['recordingFormat','../client','Request','GetVoiceExtension','exten'];(function(_0x2a41a9,_0x569e2e){var _0x470725=function(_0x208a9b){while(--_0x208a9b){_0x2a41a9['push'](_0x2a41a9['shift']());}};_0x470725(++_0x569e2e);}(_0x7d98,0xe7));var _0x87d9=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x7d98[_0x202d24];return _0x2b3a8e;};'use strict';var client=require(_0x87d9('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x87d9('0x1')](_0x87d9('0x2'),{'options':{'raw':!![],'attributes':['id',_0x87d9('0x3'),_0x87d9('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x54ef=['getVoiceExtensions','Request','exten','recordingFormat','../client'];(function(_0xb6b285,_0x596e01){var _0x11393c=function(_0x506469){while(--_0x506469){_0xb6b285['push'](_0xb6b285['shift']());}};_0x11393c(++_0x596e01);}(_0x54ef,0x112));var _0xf54e=function(_0x418928,_0x5e5704){_0x418928=_0x418928-0x0;var _0x116a5c=_0x54ef[_0x418928];return _0x116a5c;};'use strict';var client=require(_0xf54e('0x0'));exports[_0xf54e('0x1')]=function(){return function(){return client[_0xf54e('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xf54e('0x3'),_0xf54e('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xf54e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 2065334..c691830 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 _0x5a96=['callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','name','acw','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk'];(function(_0x10ab8f,_0x134ca1){var _0x50ddaf=function(_0x536136){while(--_0x536136){_0x10ab8f['push'](_0x10ab8f['shift']());}};_0x50ddaf(++_0x134ca1);}(_0x5a96,0xf1));var _0x65a9=function(_0x482a73,_0x294046){_0x482a73=_0x482a73-0x0;var _0x39b97f=_0x5a96[_0x482a73];return _0x39b97f;};'use strict';var client=require(_0x65a9('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x65a9('0x1'),_0x65a9('0x2'),'acwTimeout',_0x65a9('0x3'),'monitor_format',_0x65a9('0x4'),_0x65a9('0x5'),_0x65a9('0x6'),_0x65a9('0x7'),_0x65a9('0x8'),_0x65a9('0x9'),_0x65a9('0xa'),'dialPredictiveOptimizationPercentage',_0x65a9('0xb'),_0x65a9('0xc'),_0x65a9('0xd'),'dialOriginateTimeout','dialQueueOptions',_0x65a9('0xe'),_0x65a9('0xf'),_0x65a9('0x10'),'dialCongestionRetryFrequency',_0x65a9('0x11'),_0x65a9('0x12'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x65a9('0x13'),'dialTimezone',_0x65a9('0x14'),_0x65a9('0x15'),_0x65a9('0x16'),'dialAMDActive',_0x65a9('0x17'),_0x65a9('0x18'),_0x65a9('0x19'),'dialAMDTotalAnalysisTime',_0x65a9('0x1a'),_0x65a9('0x1b'),'dialAMDMaximumNumberOfWords',_0x65a9('0x1c'),_0x65a9('0x1d'),_0x65a9('0x1e'),_0x65a9('0x1f'),_0x65a9('0x20'),'dialOrderByScheduledAt',_0x65a9('0x21'),_0x65a9('0x22'),'dialQueueProject2',_0x65a9('0x23'),_0x65a9('0x24'),'dialRandomLastDigitCallerIdNumber',_0x65a9('0x25'),'dialNoSuchNumberMaxRetry',_0x65a9('0x26'),'dialDropMaxRetry',_0x65a9('0x27'),_0x65a9('0x28'),_0x65a9('0x29'),_0x65a9('0x2a'),_0x65a9('0x2b'),_0x65a9('0x2c'),'dialAgentRejectRetryFrequency',_0x65a9('0x2d'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x65a9('0x2e'),_0x65a9('0x2f')],'include':[{'model':'Trunk','as':_0x65a9('0x30'),'attributes':['id',_0x65a9('0x1'),_0x65a9('0x31'),_0x65a9('0x32')]},{'model':_0x65a9('0x33'),'as':_0x65a9('0x34'),'attributes':['id',_0x65a9('0x1')]},{'model':_0x65a9('0x30'),'as':_0x65a9('0x35'),'attributes':['id',_0x65a9('0x1'),_0x65a9('0x31'),_0x65a9('0x32')]},{'model':'Interval','as':_0x65a9('0x36'),'attributes':['id',_0x65a9('0x1')],'include':[{'model':_0x65a9('0x36'),'as':_0x65a9('0x37'),'attributes':['id',_0x65a9('0x1'),_0x65a9('0x38')]}]}]},'log':_0x65a9('0x39')});};}; \ No newline at end of file +var _0x0655=['dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x0655,0x142));var _0x5065=function(_0xe51964,_0x433b90){_0xe51964=_0xe51964-0x0;var _0x2c2366=_0x0655[_0xe51964];return _0x2c2366;};'use strict';var client=require(_0x5065('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x5065('0x1')](_0x5065('0x2'),{'options':{'raw':![],'attributes':['id',_0x5065('0x3'),_0x5065('0x4'),_0x5065('0x5'),_0x5065('0x6'),_0x5065('0x7'),_0x5065('0x8'),_0x5065('0x9'),'dialMethod',_0x5065('0xa'),_0x5065('0xb'),_0x5065('0xc'),_0x5065('0xd'),'dialPredictiveOptimizationPercentage',_0x5065('0xe'),_0x5065('0xf'),_0x5065('0x10'),_0x5065('0x11'),_0x5065('0x12'),_0x5065('0x13'),_0x5065('0x14'),_0x5065('0x15'),_0x5065('0x16'),_0x5065('0x17'),_0x5065('0x18'),_0x5065('0x19'),_0x5065('0x1a'),'dialGlobalMaxRetry',_0x5065('0x1b'),'dialGlobalInterval',_0x5065('0x1c'),_0x5065('0x1d'),_0x5065('0x1e'),_0x5065('0x1f'),_0x5065('0x20'),_0x5065('0x21'),'dialAMDTotalAnalysisTime',_0x5065('0x22'),_0x5065('0x23'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x5065('0x24'),_0x5065('0x25'),_0x5065('0x26'),_0x5065('0x27'),_0x5065('0x28'),_0x5065('0x29'),'dialAgiAfterHangupClient',_0x5065('0x2a'),_0x5065('0x7'),_0x5065('0x2b'),_0x5065('0x2c'),_0x5065('0x2d'),_0x5065('0x2e'),_0x5065('0x2f'),'dialDropMaxRetry',_0x5065('0x30'),_0x5065('0x31'),_0x5065('0x32'),_0x5065('0x33'),_0x5065('0x34'),_0x5065('0x35'),_0x5065('0x36'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x5065('0x37'),_0x5065('0x38'),_0x5065('0x39')],'include':[{'model':_0x5065('0x3a'),'as':_0x5065('0x3a'),'attributes':['id',_0x5065('0x3'),_0x5065('0x3b'),_0x5065('0x3c')]},{'model':_0x5065('0x3d'),'as':_0x5065('0x3e'),'attributes':['id',_0x5065('0x3')]},{'model':'Trunk','as':_0x5065('0x3f'),'attributes':['id',_0x5065('0x3'),_0x5065('0x3b'),'active']},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':'Interval','as':_0x5065('0x40'),'attributes':['id','name',_0x5065('0x41')]}]}]},'log':_0x5065('0x42')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f9dc975..705c37b 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(_0x4fc3f9,_0xe76366){var _0x56d8dc=function(_0x86afff){while(--_0x86afff){_0x4fc3f9['push'](_0x4fc3f9['shift']());}};_0x56d8dc(++_0xe76366);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x1e312b,_0xc716ad){var _0x5b2239=function(_0x7205fb){while(--_0x7205fb){_0x1e312b['push'](_0x1e312b['shift']());}};_0x5b2239(++_0xc716ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 9720ce7..ec11527 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 _0xaa8b=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x12dfa1,_0x36ff32){var _0x5db581=function(_0x3f1237){while(--_0x3f1237){_0x12dfa1['push'](_0x12dfa1['shift']());}};_0x5db581(++_0x36ff32);}(_0xaa8b,0x1d5));var _0xbaa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa8b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xbaa8('0x0'));exports[_0xbaa8('0x1')]=function(_0x5d8885){return function(){return client[_0xbaa8('0x2')](_0xbaa8('0x3'),{'options':{'where':{'VoiceQueueId':_0x5d8885,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x2b19=['GetVoiceQueueRtPauses','../client'];(function(_0x2f5dc2,_0x1dd20e){var _0x58c15e=function(_0x480fa7){while(--_0x480fa7){_0x2f5dc2['push'](_0x2f5dc2['shift']());}};_0x58c15e(++_0x1dd20e);}(_0x2b19,0x105));var _0x92b1=function(_0x5ac41b,_0x17a947){_0x5ac41b=_0x5ac41b-0x0;var _0x47d6f3=_0x2b19[_0x5ac41b];return _0x47d6f3;};'use strict';var client=require(_0x92b1('0x0'));exports['getVoiceQueueRtPauses']=function(_0x20c840){return function(){return client['Request'](_0x92b1('0x1'),{'options':{'where':{'VoiceQueueId':_0x20c840,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 91f3dc7..34e663d 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2f0138,_0x1252f0){var _0x96e492=function(_0x142936){while(--_0x142936){_0x2f0138['push'](_0x2f0138['shift']());}};_0x96e492(++_0x1252f0);}(_0x7a54,0x106));var _0x47a5=function(_0xc5fa7f,_0x309f45){_0xc5fa7f=_0xc5fa7f-0x0;var _0x3885c9=_0x7a54[_0xc5fa7f];return _0x3885c9;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4cf2f0,_0x243347){var _0x379f01=function(_0x2ee617){while(--_0x2ee617){_0x4cf2f0['push'](_0x4cf2f0['shift']());}};_0x379f01(++_0x243347);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 68c5b61..c6161cc 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 _0xb44c=['transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb44c,0x68));var _0xcb44=function(_0x17249c,_0x168d62){_0x17249c=_0x17249c-0x0;var _0x324e7b=_0xb44c[_0x17249c];return _0x324e7b;};'use strict';var client=require(_0xcb44('0x0'));exports[_0xcb44('0x1')]={};exports[_0xcb44('0x2')]=function(_0x51578e){return client[_0xcb44('0x3')](_0xcb44('0x4'),{'body':{'result':_0x51578e[_0xcb44('0x5')],'transfererchannel':_0x51578e['transfererchannel'],'transferercalleridnum':_0x51578e[_0xcb44('0x6')],'transferercalleridname':_0x51578e[_0xcb44('0x7')],'transfererconnectedlinenum':_0x51578e[_0xcb44('0x8')],'transfererconnectedlinename':_0x51578e[_0xcb44('0x9')],'transfereraccountcode':_0x51578e[_0xcb44('0xa')],'transferercontext':_0x51578e['transferercontext'],'transfererexten':_0x51578e['transfererexten'],'transfererlinkedid':_0x51578e[_0xcb44('0xb')],'transfereechannel':_0x51578e[_0xcb44('0xc')],'transfereecalleridnum':_0x51578e[_0xcb44('0xd')],'transfereecalleridname':_0x51578e[_0xcb44('0xe')],'transfereeconnectedlinenum':_0x51578e[_0xcb44('0xf')],'transfereeconnectedlinename':_0x51578e[_0xcb44('0x10')],'transfereeaccountcode':_0x51578e['transfereeaccountcode'],'transfereecontext':_0x51578e['transfereecontext'],'transfereeexten':_0x51578e['transfereeexten'],'transfereelinkedid':_0x51578e['transfereelinkedid'],'isexternal':_0x51578e[_0xcb44('0x11')],'context':_0x51578e[_0xcb44('0x12')],'extension':_0x51578e[_0xcb44('0x13')],'type':_0xcb44('0x14')},'log':_0xcb44('0x4')});};exports[_0xcb44('0x15')]=function(_0x65624b){return client[_0xcb44('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x65624b[_0xcb44('0x5')],'transfererchannel':_0x65624b[_0xcb44('0x16')],'transferercalleridnum':_0x65624b[_0xcb44('0x17')],'transferercalleridname':_0x65624b[_0xcb44('0x18')],'transfererconnectedlinenum':_0x65624b[_0xcb44('0x19')],'transfererconnectedlinename':_0x65624b[_0xcb44('0x1a')],'transfereraccountcode':_0x65624b['origtransfereraccountcode'],'transferercontext':_0x65624b['secondtransferercontext'],'transfererexten':_0x65624b[_0xcb44('0x1b')],'transfererlinkedid':_0x65624b['origtransfererlinkedid'],'transfereechannel':_0x65624b[_0xcb44('0x1c')],'transfereecalleridnum':_0x65624b[_0xcb44('0x1d')],'transfereecalleridname':_0x65624b[_0xcb44('0x1e')],'transfereeconnectedlinenum':_0x65624b[_0xcb44('0x1f')],'transfereeconnectedlinename':_0x65624b[_0xcb44('0x20')],'transfereeaccountcode':_0x65624b['transfertargetaccountcode'],'transfereecontext':_0x65624b[_0xcb44('0x21')],'transfereeexten':_0x65624b[_0xcb44('0x22')],'transfereelinkedid':_0x65624b['transfertargetlinkedid'],'isexternal':_0x65624b[_0xcb44('0x11')],'context':_0x65624b[_0xcb44('0x23')],'extension':_0x65624b[_0xcb44('0x24')],'type':'attended'},'log':_0xcb44('0x4')});}; \ No newline at end of file +var _0x4a1b=['transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a1b,0x76));var _0xb4a1=function(_0x16d411,_0x5e0970){_0x16d411=_0x16d411-0x0;var _0x20336d=_0x4a1b[_0x16d411];return _0x20336d;};'use strict';var client=require(_0xb4a1('0x0'));exports[_0xb4a1('0x1')]={};exports['blindTransfer']=function(_0x4d73e1){return client[_0xb4a1('0x2')](_0xb4a1('0x3'),{'body':{'result':_0x4d73e1[_0xb4a1('0x4')],'transfererchannel':_0x4d73e1['transfererchannel'],'transferercalleridnum':_0x4d73e1[_0xb4a1('0x5')],'transferercalleridname':_0x4d73e1['transferercalleridname'],'transfererconnectedlinenum':_0x4d73e1[_0xb4a1('0x6')],'transfererconnectedlinename':_0x4d73e1[_0xb4a1('0x7')],'transfereraccountcode':_0x4d73e1[_0xb4a1('0x8')],'transferercontext':_0x4d73e1[_0xb4a1('0x9')],'transfererexten':_0x4d73e1[_0xb4a1('0xa')],'transfererlinkedid':_0x4d73e1[_0xb4a1('0xb')],'transfereechannel':_0x4d73e1['transfereechannel'],'transfereecalleridnum':_0x4d73e1['transfereecalleridnum'],'transfereecalleridname':_0x4d73e1[_0xb4a1('0xc')],'transfereeconnectedlinenum':_0x4d73e1[_0xb4a1('0xd')],'transfereeconnectedlinename':_0x4d73e1[_0xb4a1('0xe')],'transfereeaccountcode':_0x4d73e1[_0xb4a1('0xf')],'transfereecontext':_0x4d73e1[_0xb4a1('0x10')],'transfereeexten':_0x4d73e1[_0xb4a1('0x11')],'transfereelinkedid':_0x4d73e1['transfereelinkedid'],'isexternal':_0x4d73e1[_0xb4a1('0x12')],'context':_0x4d73e1[_0xb4a1('0x13')],'extension':_0x4d73e1[_0xb4a1('0x14')],'type':'blind'},'log':_0xb4a1('0x3')});};exports[_0xb4a1('0x15')]=function(_0x3b8e22){return client['Request'](_0xb4a1('0x3'),{'body':{'result':_0x3b8e22[_0xb4a1('0x4')],'transfererchannel':_0x3b8e22[_0xb4a1('0x16')],'transferercalleridnum':_0x3b8e22['origtransferercalleridnum'],'transferercalleridname':_0x3b8e22[_0xb4a1('0x17')],'transfererconnectedlinenum':_0x3b8e22[_0xb4a1('0x18')],'transfererconnectedlinename':_0x3b8e22[_0xb4a1('0x19')],'transfereraccountcode':_0x3b8e22[_0xb4a1('0x1a')],'transferercontext':_0x3b8e22[_0xb4a1('0x1b')],'transfererexten':_0x3b8e22['secondtransfererexten'],'transfererlinkedid':_0x3b8e22['origtransfererlinkedid'],'transfereechannel':_0x3b8e22[_0xb4a1('0x1c')],'transfereecalleridnum':_0x3b8e22[_0xb4a1('0x1d')],'transfereecalleridname':_0x3b8e22['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3b8e22[_0xb4a1('0x1e')],'transfereeconnectedlinename':_0x3b8e22[_0xb4a1('0x1f')],'transfereeaccountcode':_0x3b8e22[_0xb4a1('0x20')],'transfereecontext':_0x3b8e22[_0xb4a1('0x21')],'transfereeexten':_0x3b8e22['transfertargetexten'],'transfereelinkedid':_0x3b8e22[_0xb4a1('0x22')],'isexternal':_0x3b8e22['isexternal'],'context':_0x3b8e22[_0xb4a1('0x23')],'extension':_0x3b8e22[_0xb4a1('0x24')],'type':_0xb4a1('0x25')},'log':_0xb4a1('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 211011e..0b54bff 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x251645,_0x103496){var _0x2efcc0=function(_0x2a9540){while(--_0x2a9540){_0x251645['push'](_0x251645['shift']());}};_0x2efcc0(++_0x103496);}(_0xb10b,0x12a));var _0xbb10=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xb10b[_0x207811];return _0x170d56;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x13f11b,_0x54e553){var _0x482f1f=function(_0x39f3c3){while(--_0x39f3c3){_0x13f11b['push'](_0x13f11b['shift']());}};_0x482f1f(++_0x54e553);}(_0x7a54,0x106));var _0x47a5=function(_0x34f236,_0x1c70b6){_0x34f236=_0x34f236-0x0;var _0x2cc7b9=_0x7a54[_0x34f236];return _0x2cc7b9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index cd7ccd1..1d5c2c2 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 _0x69df=['calleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','destcalleridname','format','user:%s','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName'];(function(_0x14f8ef,_0x1b1107){var _0x3b97f6=function(_0xebf2c2){while(--_0xebf2c2){_0x14f8ef['push'](_0x14f8ef['shift']());}};_0x3b97f6(++_0x1b1107);}(_0x69df,0x19c));var _0xf69d=function(_0x514ef1,_0x5d5cb1){_0x514ef1=_0x514ef1-0x0;var _0x3f5790=_0x69df[_0x514ef1];return _0x3f5790;};'use strict';var _=require('lodash');var BPromise=require(_0xf69d('0x0'));var Redis=require(_0xf69d('0x1'));var util=require(_0xf69d('0x2'));var config=require(_0xf69d('0x3'));var logger=require(_0xf69d('0x4'))(_0xf69d('0x5'));var cmContactRpc=require(_0xf69d('0x6'));config[_0xf69d('0x7')]=_['defaults'](config[_0xf69d('0x7')],{'host':_0xf69d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf69d('0x7')]));function emit(_0x319477,_0x4875cd,_0x5e1a09,_0x1c0549,_0x1be97a){logger[_0xf69d('0x9')](_0xf69d('0xa'),_0x319477,_0x4875cd['id'],_0x5e1a09,_0x1c0549,JSON[_0xf69d('0xb')](_0x1be97a));io['to'](_0x5e1a09)['emit'](_0x1c0549,_0x1be97a);}exports[_0xf69d('0xc')]=function(_0x3dce7d,_0x5ab5cb,_0x214e07,_0x34385f){var _0x559094,_0x238b26;var _0x4c1d7f={};var _0xbf05c9;var _0x23dd42=Number(_0x214e07[_0xf69d('0xd')]);var _0x51afe7=_0x214e07[_0xf69d('0xe')]?Boolean(Number(_0x214e07[_0xf69d('0xe')])):![];var _0xde0764;var _0x26d4c8=![];if(!_[_0xf69d('0xf')](_0x214e07['data5'])){if(_0x214e07['data5']=='1')_0x26d4c8=!![];}if(!_0x26d4c8){if(_0x34385f['xmd-contactid']){_0x4c1d7f['id']=_0x34385f['xmd-contactid'];}}if(!_0x4c1d7f['id']){_0x4c1d7f[_0xf69d('0x10')]=_0x23dd42;_0xde0764=_0x214e07[_0xf69d('0x11')]&&_0x214e07[_0xf69d('0x11')]!=='0'?_0x214e07[_0xf69d('0x11')][_0xf69d('0x12')](','):[_0xf69d('0x13')];_0x4c1d7f[_0xf69d('0x14')]=_['map'](_0xde0764,function(_0x5a6123){var _0x4db1ad={};_0x4db1ad[_0x5a6123]=_0x34385f[_0xf69d('0x15')]?_0x34385f[_0xf69d('0x16')]:_0x34385f[_0xf69d('0x17')];return _0x4db1ad;});_0xbf05c9=_0x34385f[_0xf69d('0x15')]?_0x34385f['destcalleridnum']:_0x34385f[_0xf69d('0x17')];}var _0x211e1e=['id','firstName',_0xf69d('0x18'),'phone',_0xf69d('0x19'),_0xf69d('0x1a'),'ListId',_0xf69d('0x1b'),_0xf69d('0x1c'),_0xf69d('0x1d')];var _0x41d728=_[_0xf69d('0x1e')](_0x211e1e,_0xde0764);BPromise[_0xf69d('0x1f')]()[_0xf69d('0x20')](cmContactRpc[_0xf69d('0x21')]({'attributes':_0x41d728,'where':_0x4c1d7f,'phone':_0xbf05c9}))[_0xf69d('0x20')](function(_0x53a116){_0x238b26=_0x53a116;if(!_[_0xf69d('0x22')](_0x238b26)){if(_0x238b26[_0xf69d('0x23')]===0x1){_0x559094=_0x238b26[0x0];logger[_0xf69d('0x9')](_0xf69d('0x24'),_0x34385f[_0xf69d('0x25')],_0x5ab5cb['id'],_0x559094['id']);}else{logger[_0xf69d('0x9')](_0xf69d('0x26'),_0x34385f[_0xf69d('0x25')],_0x5ab5cb['id'],_['map'](_0x238b26,'id')[_0xf69d('0x27')](','));}return;}else{logger['info'](_0xf69d('0x28'),_0x34385f[_0xf69d('0x25')],_0x5ab5cb['id']);var _0x5ed3a0={'ListId':_0x23dd42};var _0x25b35a=_0x214e07[_0xf69d('0x29')]&&_0x214e07[_0xf69d('0x29')]!=='0'?_0x214e07[_0xf69d('0x29')]:_0xf69d('0x13');if(_0x51afe7){logger[_0xf69d('0x9')](_0xf69d('0x2a'),_0x34385f[_0xf69d('0x25')],_0x5ab5cb['id']);_0x5ed3a0[_0x25b35a]=_[_0xf69d('0xf')](_0x34385f[_0xf69d('0x15')])?_0x34385f[_0xf69d('0x17')]:_0x34385f[_0xf69d('0x16')];if(_['isNil'](_0x34385f[_0xf69d('0x15')])){_0x5ed3a0[_0xf69d('0x2b')]=_0x34385f[_0xf69d('0x2c')]&&_0x34385f['calleridname']!==_0xf69d('0x2d')?_0x34385f['calleridname']:_0xf69d('0x2e');}else{_0x5ed3a0[_0xf69d('0x2b')]=_0x34385f['destcalleridname']&&_0x34385f['destcalleridname']!==_0xf69d('0x2d')?_0x34385f['destcalleridname']:_0xf69d('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0xf69d('0x2f')](_0x5ed3a0))[_0xf69d('0x20')](function(_0x43080b){_0x559094=_0x43080b;_0x238b26[_0xf69d('0x30')](_0x43080b);if(_0x559094){logger['info'](_0xf69d('0x31'),_0x34385f[_0xf69d('0x25')],_0x5ab5cb['id'],_0x559094['id']);}return;});}else{logger[_0xf69d('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x34385f[_0xf69d('0x25')],_0x5ab5cb['id']);_0x5ed3a0[_0x25b35a]=_[_0xf69d('0xf')](_0x34385f['routeId'])?_0x34385f[_0xf69d('0x17')]:_0x34385f[_0xf69d('0x16')];if(_[_0xf69d('0xf')](_0x34385f[_0xf69d('0x15')])){_0x5ed3a0['firstName']=_0x34385f[_0xf69d('0x2c')]&&_0x34385f[_0xf69d('0x2c')]!==''?_0x34385f['calleridname']:_0xf69d('0x2e');}else{_0x5ed3a0[_0xf69d('0x2b')]=_0x34385f['destcalleridname']&&_0x34385f['destcalleridname']!==''?_0x34385f[_0xf69d('0x32')]:_0xf69d('0x2e');}_0x559094=_0x5ed3a0;_0x238b26[_0xf69d('0x30')](_0x5ed3a0);return;}}})[_0xf69d('0x20')](function(){if(_0x3dce7d){emit(_0x34385f['uniqueid'],_0x5ab5cb,util[_0xf69d('0x33')](_0xf69d('0x34'),_0x3dce7d['name']),util[_0xf69d('0x33')](_0xf69d('0x35'),_0x214e07[_0xf69d('0x36')][_0xf69d('0x37')]()),{'evt':_[_0xf69d('0x38')](_0x34385f,{'autoCreate':_0x51afe7}),'contact':_0x559094===undefined?{}:_0x559094,'contacts':_0x238b26[_0xf69d('0x23')]===0x0?undefined:_0x238b26});}});}; \ No newline at end of file +var _0xb9be=['firstName','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','isNil','data5','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum'];(function(_0x2e4698,_0x3e248d){var _0x86ee86=function(_0x1fc86d){while(--_0x1fc86d){_0x2e4698['push'](_0x2e4698['shift']());}};_0x86ee86(++_0x3e248d);}(_0xb9be,0xc5));var _0xeb9b=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xb9be[_0x80d733];return _0x435868;};'use strict';var _=require(_0xeb9b('0x0'));var BPromise=require(_0xeb9b('0x1'));var Redis=require(_0xeb9b('0x2'));var util=require(_0xeb9b('0x3'));var config=require(_0xeb9b('0x4'));var logger=require(_0xeb9b('0x5'))(_0xeb9b('0x6'));var cmContactRpc=require(_0xeb9b('0x7'));config[_0xeb9b('0x8')]=_['defaults'](config['redis'],{'host':_0xeb9b('0x9'),'port':0x18eb});var io=require(_0xeb9b('0xa'))(new Redis(config[_0xeb9b('0x8')]));function emit(_0x49a8b9,_0x1ee7e0,_0x58ca1d,_0x210eeb,_0x28dc5f){logger[_0xeb9b('0xb')](_0xeb9b('0xc'),_0x49a8b9,_0x1ee7e0['id'],_0x58ca1d,_0x210eeb,JSON[_0xeb9b('0xd')](_0x28dc5f));io['to'](_0x58ca1d)[_0xeb9b('0xe')](_0x210eeb,_0x28dc5f);}exports[_0xeb9b('0xf')]=function(_0x4f4952,_0x20c855,_0x58d6a4,_0x4ea7bb){var _0xa3b541,_0x4236c0;var _0x4975dd={};var _0x2b7405;var _0x1def58=Number(_0x58d6a4[_0xeb9b('0x10')]);var _0x2a01df=_0x58d6a4['data2']?Boolean(Number(_0x58d6a4['data2'])):![];var _0x5af455;var _0x355edb=![];if(!_[_0xeb9b('0x11')](_0x58d6a4[_0xeb9b('0x12')])){if(_0x58d6a4['data5']=='1')_0x355edb=!![];}if(!_0x355edb){if(_0x4ea7bb['xmd-contactid']){_0x4975dd['id']=_0x4ea7bb['xmd-contactid'];}}if(!_0x4975dd['id']){_0x4975dd[_0xeb9b('0x13')]=_0x1def58;_0x5af455=_0x58d6a4[_0xeb9b('0x14')]&&_0x58d6a4[_0xeb9b('0x14')]!=='0'?_0x58d6a4[_0xeb9b('0x14')][_0xeb9b('0x15')](','):[_0xeb9b('0x16')];_0x4975dd[_0xeb9b('0x17')]=_['map'](_0x5af455,function(_0x2e8645){var _0x36e871={};_0x36e871[_0x2e8645]=_0x4ea7bb[_0xeb9b('0x18')]?_0x4ea7bb[_0xeb9b('0x19')]:_0x4ea7bb[_0xeb9b('0x1a')];return _0x36e871;});_0x2b7405=_0x4ea7bb[_0xeb9b('0x18')]?_0x4ea7bb[_0xeb9b('0x19')]:_0x4ea7bb[_0xeb9b('0x1a')];}var _0x2c199f=['id',_0xeb9b('0x1b'),'lastName',_0xeb9b('0x16'),'mobile','fax',_0xeb9b('0x13'),_0xeb9b('0x1c'),'scheduledAt',_0xeb9b('0x1d')];var _0x2dabb1=_[_0xeb9b('0x1e')](_0x2c199f,_0x5af455);BPromise[_0xeb9b('0x1f')]()[_0xeb9b('0x20')](cmContactRpc[_0xeb9b('0x21')]({'attributes':_0x2dabb1,'where':_0x4975dd,'phone':_0x2b7405}))[_0xeb9b('0x20')](function(_0x15e5b8){_0x4236c0=_0x15e5b8;if(!_[_0xeb9b('0x22')](_0x4236c0)){if(_0x4236c0[_0xeb9b('0x23')]===0x1){_0xa3b541=_0x4236c0[0x0];logger[_0xeb9b('0xb')](_0xeb9b('0x24'),_0x4ea7bb[_0xeb9b('0x25')],_0x20c855['id'],_0xa3b541['id']);}else{logger[_0xeb9b('0xb')](_0xeb9b('0x26'),_0x4ea7bb[_0xeb9b('0x25')],_0x20c855['id'],_['map'](_0x4236c0,'id')[_0xeb9b('0x27')](','));}return;}else{logger['info'](_0xeb9b('0x28'),_0x4ea7bb['uniqueid'],_0x20c855['id']);var _0x347ec1={'ListId':_0x1def58};var _0x4361b9=_0x58d6a4[_0xeb9b('0x29')]&&_0x58d6a4[_0xeb9b('0x29')]!=='0'?_0x58d6a4['data4']:_0xeb9b('0x16');if(_0x2a01df){logger[_0xeb9b('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4ea7bb[_0xeb9b('0x25')],_0x20c855['id']);_0x347ec1[_0x4361b9]=_[_0xeb9b('0x11')](_0x4ea7bb['routeId'])?_0x4ea7bb[_0xeb9b('0x1a')]:_0x4ea7bb[_0xeb9b('0x19')];if(_[_0xeb9b('0x11')](_0x4ea7bb['routeId'])){_0x347ec1[_0xeb9b('0x1b')]=_0x4ea7bb['calleridname']&&_0x4ea7bb[_0xeb9b('0x2a')]!==''?_0x4ea7bb[_0xeb9b('0x2a')]:'Unknown';}else{_0x347ec1[_0xeb9b('0x1b')]=_0x4ea7bb['destcalleridname']&&_0x4ea7bb[_0xeb9b('0x2b')]!==''?_0x4ea7bb[_0xeb9b('0x2b')]:_0xeb9b('0x2c');}return BPromise[_0xeb9b('0x1f')]()[_0xeb9b('0x20')](cmContactRpc[_0xeb9b('0x2d')](_0x347ec1))[_0xeb9b('0x20')](function(_0x9efe80){_0xa3b541=_0x9efe80;_0x4236c0[_0xeb9b('0x2e')](_0x9efe80);if(_0xa3b541){logger[_0xeb9b('0xb')](_0xeb9b('0x2f'),_0x4ea7bb['uniqueid'],_0x20c855['id'],_0xa3b541['id']);}return;});}else{logger[_0xeb9b('0xb')](_0xeb9b('0x30'),_0x4ea7bb[_0xeb9b('0x25')],_0x20c855['id']);_0x347ec1[_0x4361b9]=_[_0xeb9b('0x11')](_0x4ea7bb[_0xeb9b('0x18')])?_0x4ea7bb[_0xeb9b('0x1a')]:_0x4ea7bb[_0xeb9b('0x19')];if(_['isNil'](_0x4ea7bb[_0xeb9b('0x18')])){_0x347ec1[_0xeb9b('0x1b')]=_0x4ea7bb[_0xeb9b('0x2a')]&&_0x4ea7bb['calleridname']!==_0xeb9b('0x31')?_0x4ea7bb[_0xeb9b('0x2a')]:_0xeb9b('0x2c');}else{_0x347ec1[_0xeb9b('0x1b')]=_0x4ea7bb[_0xeb9b('0x2b')]&&_0x4ea7bb[_0xeb9b('0x2b')]!==''?_0x4ea7bb[_0xeb9b('0x2b')]:_0xeb9b('0x2c');}_0xa3b541=_0x347ec1;_0x4236c0['push'](_0x347ec1);return;}}})[_0xeb9b('0x20')](function(){if(_0x4f4952){emit(_0x4ea7bb[_0xeb9b('0x25')],_0x20c855,util[_0xeb9b('0x32')](_0xeb9b('0x33'),_0x4f4952[_0xeb9b('0x34')]),util[_0xeb9b('0x32')](_0xeb9b('0x35'),_0x58d6a4['action'][_0xeb9b('0x36')]()),{'evt':_[_0xeb9b('0x37')](_0x4ea7bb,{'autoCreate':_0x2a01df}),'contact':_0xa3b541===undefined?{}:_0xa3b541,'contacts':_0x4236c0[_0xeb9b('0x23')]===0x0?undefined:_0x4236c0});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 01d2433..3419122 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 _0x3376=['zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','servicenowAccounts','custom:agentcalled','bind','custom:agentconnect','custom:agentringnoanswer','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:acceptmessage','custom:rejectmessage','prototype','emit','motionChannel','undefined','voice','inspect','checkTriggers','status','checkTrigger','merge','variables','Actions','length','interface','toLowerCase','contactmanager','motionbar','browser','data1','data2','html','render','template\x20not\x20found','uri','isNil','data3','data4','location','windowWidth','data5','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','action','jscripty','trigger:%s','integration','exec','queue','routeId','urlforward','script','parse','query','replace','channel','AllConditions','every','checkConditions','some','AnyConditions','debug','evt','field','account','chat','ChatWebsiteId','upperFirst','AccountId','operator','value','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','offlineMessage','created','exports','util','lodash','mustache','ioredis','./integration','./cmContact','trigger','../ami','redis','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates'];(function(_0x287e95,_0x2de747){var _0x3423c4=function(_0x408873){while(--_0x408873){_0x287e95['push'](_0x287e95['shift']());}};_0x3423c4(++_0x2de747);}(_0x3376,0xe7));var _0x6337=function(_0x239d2b,_0x28f20d){_0x239d2b=_0x239d2b-0x0;var _0x4afcc8=_0x3376[_0x239d2b];return _0x4afcc8;};'use strict';var util=require(_0x6337('0x0'));var _=require(_0x6337('0x1'));var url=require('url');var Mustache=require(_0x6337('0x2'));var Redis=require(_0x6337('0x3'));var urlforward=require('./urlforward');var integration=require(_0x6337('0x4'));var cmContact=require(_0x6337('0x5'));var script=require('./script');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x6337('0x6'));var ami=require(_0x6337('0x7'));config[_0x6337('0x8')]=_['defaults'](config[_0x6337('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6337('0x9'))(new Redis(config[_0x6337('0x8')]));var operators={'equals':function(_0x5109b9,_0x58b06b){return _0x5109b9==_0x58b06b;},'not_equals':function(_0x84b828,_0x59195a){return _0x84b828!=_0x59195a;}};var barAndWebActions=[_0x6337('0xa'),_0x6337('0xb'),_0x6337('0xc')];function Trigger(_0x28c775){this[_0x6337('0xd')]=_0x28c775[_0x6337('0xd')];this[_0x6337('0xe')]=_0x28c775[_0x6337('0xe')];this[_0x6337('0xf')]=_0x28c775[_0x6337('0xf')];this[_0x6337('0x10')]=_0x28c775[_0x6337('0x10')];this['voiceExtensions']=_0x28c775['voiceExtensions'];this[_0x6337('0x11')]=_0x28c775[_0x6337('0x11')];this[_0x6337('0x12')]=_0x28c775['freshdeskAccounts'];this['salesforceAccounts']=_0x28c775[_0x6337('0x13')];this[_0x6337('0x14')]=_0x28c775['sugarcrmAccounts'];this['zohoAccounts']=_0x28c775['zohoAccounts'];this[_0x6337('0x15')]=_0x28c775[_0x6337('0x15')];this[_0x6337('0x16')]=_0x28c775[_0x6337('0x16')];this['servicenowAccounts']=_0x28c775['servicenowAccounts'];this[_0x6337('0x17')]=_0x28c775[_0x6337('0x17')];this[_0x6337('0x18')]=_0x28c775[_0x6337('0x18')];this[_0x6337('0x19')]={'zendesk':this[_0x6337('0x11')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x6337('0x12')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x6337('0x1a')],'desk':this[_0x6337('0x15')],'vtiger':this[_0x6337('0x16')],'dynamics365':this[_0x6337('0x17')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x6337('0x1b')]};ami['on'](_0x6337('0x1c'),this['syncCustomEvent'][_0x6337('0x1d')](this));ami['on'](_0x6337('0x1e'),this['syncCustomEvent']['bind'](this));ami['on'](_0x6337('0x1f'),this[_0x6337('0x20')][_0x6337('0x1d')](this));ami['on'](_0x6337('0x21'),this[_0x6337('0x20')][_0x6337('0x1d')](this));ami['on'](_0x6337('0x22'),this['syncCustomEvent'][_0x6337('0x1d')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0x6337('0x1d')](this));ami['on']('custom:agentbusy',this['syncCustomEvent'][_0x6337('0x1d')](this));ami['on'](_0x6337('0x23'),this[_0x6337('0x20')][_0x6337('0x1d')](this));ami['on'](_0x6337('0x24'),this[_0x6337('0x20')][_0x6337('0x1d')](this));ami['on'](_0x6337('0x25'),this[_0x6337('0x20')]['bind'](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent']['bind'](this));ami['on'](_0x6337('0x26'),this[_0x6337('0x20')][_0x6337('0x1d')](this));ami['on'](_0x6337('0x27'),this[_0x6337('0x28')][_0x6337('0x1d')](this));ami['on'](_0x6337('0x29'),this[_0x6337('0x28')]['bind'](this));ami['on']('custom:dialend',this[_0x6337('0x28')][_0x6337('0x1d')](this));ami['on'](_0x6337('0x2a'),this[_0x6337('0x20')][_0x6337('0x1d')](this));ami['on'](_0x6337('0x2b'),this['syncCustomEvent']['bind'](this));ami['on'](_0x6337('0x2c'),this['syncCustomEvent'][_0x6337('0x1d')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x6337('0x1d')](this));ami['on']('custom:outgoingmessage',this[_0x6337('0x20')][_0x6337('0x1d')](this));ami['on'](_0x6337('0x2d'),this['syncCustomEvent']['bind'](this));ami['on'](_0x6337('0x2e'),this[_0x6337('0x20')][_0x6337('0x1d')](this));ami['on']('custom:offlineMessage',this[_0x6337('0x20')][_0x6337('0x1d')](this));}Trigger[_0x6337('0x2f')][_0x6337('0x30')]=function(_0x15b31f,_0xcb64fa,_0x32e726){logger['info'](_0x15b31f,_0xcb64fa,JSON['stringify'](_0x32e726));io['to'](_0x15b31f)[_0x6337('0x30')](_0xcb64fa,_0x32e726);};Trigger[_0x6337('0x2f')][_0x6337('0x20')]=function(_0x510f7a){var _0x3b0cc4=_['clone'](_0x510f7a);if(typeof _0x3b0cc4[_0x6337('0x31')]===_0x6337('0x32')){_0x3b0cc4[_0x6337('0x31')]=_0x6337('0x33');}logger['debug'](_0x6337('0x20'),util[_0x6337('0x34')](_0x3b0cc4,{'showHidden':!![],'depth':null}));this[_0x6337('0x35')](_0x3b0cc4);};Trigger[_0x6337('0x2f')][_0x6337('0x28')]=function(_0x544836){if(this[_0x6337('0xe')][_0x544836['interface']]){this[_0x6337('0x20')](_0x544836);}};Trigger[_0x6337('0x2f')][_0x6337('0x35')]=function(_0x99c9b5){var _0xa1fdf;for(var _0x2cfe29 in this[_0x6337('0xd')]){if(this[_0x6337('0xd')]['hasOwnProperty'](_0x2cfe29)){if(this[_0x6337('0xd')][_0x2cfe29][_0x6337('0x36')]){_0xa1fdf=this[_0x6337('0x37')](this[_0x6337('0xd')][_0x2cfe29],_0x99c9b5);if(_0xa1fdf){_[_0x6337('0x38')](_0x99c9b5,_0x99c9b5[_0x6337('0x39')]);for(var _0x1007fe=0x0,_0x6f645e,_0x3b1836,_0x59f4be;_0x1007fe0x0){_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 +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x5ad72c,_0x499e2b){var _0x15e7bd=function(_0x1f1892){while(--_0x1f1892){_0x5ad72c['push'](_0x5ad72c['shift']());}};_0x15e7bd(++_0x499e2b);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 37c6c4b..e8603dd 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 _0x7bf3=['ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','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]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','md5','ioredis','dynamics365','redis','defaults','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','username','password','clientSecret','then','access_token','catch','error','toUpperCase','message','Bearer\x20','4.0','value','validateEmail','email','internalemailaddress','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','calleridnum','POST','contacts','body','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=','&$filter=','replace','length','nothing',']\x20Enduser\x20created!','string','nameField','customField','idField','indexOf','content'];(function(_0x51cc43,_0x39ec57){var _0x52b127=function(_0x8b75bc){while(--_0x8b75bc){_0x51cc43['push'](_0x51cc43['shift']());}};_0x52b127(++_0x39ec57);}(_0x7bf3,0x153));var _0x37bf=function(_0x2bf77d,_0x5bab3a){_0x2bf77d=_0x2bf77d-0x0;var _0x1f1e23=_0x7bf3[_0x2bf77d];return _0x1f1e23;};'use strict';var _=require('lodash');var rp=require(_0x37bf('0x0'));var util=require('util');var intUtil=require('./util');var md5=require(_0x37bf('0x1'));var Redis=require(_0x37bf('0x2'));var logger=require('../../../../config/logger')(_0x37bf('0x3'));var config=require('../../../../config/environment');config[_0x37bf('0x4')]=_[_0x37bf('0x5')](config['redis'],{'host':_0x37bf('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x37bf('0x4')]));function getAuthToken(_0x492b8b,_0x278d33,_0xe5cc2b){if(_0x492b8b[_0x37bf('0x7')]){_0x492b8b[_0x37bf('0x8')]=_0x492b8b[_0x37bf('0x9')][_0x37bf('0xa')];_0x492b8b[_0x37bf('0xb')]=_0x492b8b[_0x37bf('0x9')][_0x37bf('0xc')];return Promise['resolve'](_0x492b8b[_0x37bf('0x9')]['data5']);}var _0x326fe5={'method':'POST','uri':_0x278d33,'form':{'client_id':_0x492b8b['clientId'],'resource':_0x492b8b[_0x37bf('0x8')],'username':_0x492b8b[_0x37bf('0xd')],'password':_0x492b8b['password'],'grant_type':_0x37bf('0xe'),'client_secret':_0x492b8b[_0x37bf('0xf')]},'json':!![]};return rp(_0x326fe5)[_0x37bf('0x10')](function(_0x4c8c04){return _0x4c8c04[_0x37bf('0x11')];})[_0x37bf('0x12')](function(_0x477fc6){logger[_0x37bf('0x13')]('['+[_0xe5cc2b[_0x37bf('0x14')]()]+']\x20Wrong\x20credentials!');return _0x477fc6[_0x37bf('0x15')];});}function getUser(_0x1b9f08,_0x5a2ae7,_0x7b4d7c,_0xf1dd2d,_0xc191da,_0x17d1a7){return new Promise(function(_0x5ce336,_0x3da92f){return getAuthToken(_0x5a2ae7,_0xf1dd2d,_0x17d1a7)[_0x37bf('0x10')](function(_0x2ee91e){var _0x39dba8={'method':'GET','uri':_0xc191da+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x37bf('0x16')+_0x2ee91e,'OData-Version':_0x37bf('0x17')},'json':!![]};return rp(_0x39dba8);})[_0x37bf('0x10')](function(_0x1779f1){var _0x2bd632=_0x1779f1[_0x37bf('0x18')];var _0x1c01b0=![];var _0x373eeb=null;if(!_['isNil'](_0x7b4d7c)){if(intUtil[_0x37bf('0x19')](_0x7b4d7c[_0x37bf('0x1a')])){_0x1b9f08['userEmail']=_0x7b4d7c[_0x37bf('0x1a')];for(_0x373eeb=0x0;_0x373eeb<_0x2bd632['length'];_0x373eeb++){if(_0x2bd632[_0x373eeb][_0x37bf('0x1b')]===_0x7b4d7c[_0x37bf('0x1a')]&&!_0x2bd632[_0x373eeb][_0x37bf('0x1c')]){_0x1c01b0=!![];logger[_0x37bf('0x1d')]('['+[_0x17d1a7[_0x37bf('0x14')]()]+']\x20Agent\x20found\x20'+_0x2bd632[_0x373eeb][_0x37bf('0x1e')]+'!');_0x1b9f08[_0x37bf('0x1f')]=_0x2bd632[_0x373eeb][_0x37bf('0x1e')];}}}}if(!_0x1c01b0){logger[_0x37bf('0x1d')]('['+[_0x17d1a7['toUpperCase']()]+_0x37bf('0x20'));_0x1b9f08[_0x37bf('0x21')]=_0x5a2ae7['username'];for(_0x373eeb=0x0;_0x373eeb<_0x2bd632['length'];_0x373eeb++){if(_0x2bd632[_0x373eeb][_0x37bf('0x1b')]===_0x5a2ae7[_0x37bf('0xd')]){_0x1b9f08['userId']=_0x2bd632[_0x373eeb][_0x37bf('0x1e')];}}}_0x5ce336(_0x1b9f08);})['catch'](function(_0x367e71){_0x3da92f(_0x367e71['message']);});});}function createEndUser(_0x481438,_0x463336,_0x3ac1cd,_0x2546b6,_0x143425,_0x3b7d26,_0x409100){return new Promise(function(_0x5b47e1,_0x1f9646){return getAuthToken(_0x463336,_0x3ac1cd,_0x3b7d26)[_0x37bf('0x10')](function(_0xc81fb4){var _0x57928f=_0x3b7d26[_0x37bf('0x22')]()===_0x37bf('0x23')?_0x143425['destcalleridnum']:_0x143425[_0x37bf('0x24')];var _0x388415={'method':_0x37bf('0x25'),'uri':_0x2546b6+_0x37bf('0x26'),'body':{'fullname':_0x57928f,'firstname':_0x57928f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x481438[_0x37bf('0x1f')]+')'},'headers':{'Authorization':_0x37bf('0x16')+_0xc81fb4,'OData-Version':_0x37bf('0x17')},'json':!![],'resolveWithFullResponse':!![]};_0x388415[_0x37bf('0x27')][_0x409100]=_0x57928f;return rp(_0x388415);})[_0x37bf('0x10')](function(_0x59fe22){var _0x435b50=_0x59fe22[_0x37bf('0x28')][_0x37bf('0x29')];var _0x431cfe=_0x435b50[_0x37bf('0x2a')](_0x435b50[_0x37bf('0x2b')]('(')+0x1,_0x435b50[_0x37bf('0x2b')](')'));_0x481438[_0x37bf('0x2c')]=_0x431cfe;_0x5b47e1(_0x481438);})['catch'](function(_0x4f3e45){_0x1f9646(_0x4f3e45[_0x37bf('0x15')]);});});}function getEndUser(_0x57219f,_0x846c1a,_0x35c011,_0x1192b4,_0x334614,_0x5340cf,_0xb86a82,_0x5276d8){var _0x4b2317=_0x5340cf[_0x37bf('0x22')]()===_0x37bf('0x23')?_0x334614['destcalleridnum']:_0x334614[_0x37bf('0x24')];return getAuthToken(_0x846c1a,_0x35c011,_0x5340cf)[_0x37bf('0x10')](function(_0x9e9f45){_0x5276d8=_0x5276d8?_0x5276d8:'telephone1';var _0x179db7={'method':'GET','uri':_0x1192b4+_0x37bf('0x2d')+_0x5276d8+_0x37bf('0x2e')+_0x5276d8+'\x20eq\x20\x27'+_0x4b2317[_0x37bf('0x2f')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x9e9f45,'If-None-Match':null,'OData-Version':_0x37bf('0x17')},'json':!![]};return rp(_0x179db7);})[_0x37bf('0x10')](function(_0xde2407){var _0x15a529=![];if(!_0xde2407)return _0x15a529;var _0x5316aa=_0xde2407[_0x37bf('0x18')];for(var _0x26ee82=0x0;_0x26ee82<_0x5316aa[_0x37bf('0x30')];_0x26ee82++){if(_0x5316aa[_0x26ee82][_0x5276d8]===_0x4b2317){_0x15a529=!![];_0x57219f['enduserId']=_0x5316aa[_0x26ee82]['contactid'];}}return _0x15a529;})[_0x37bf('0x10')](function(_0x1be3de){if(_0x1be3de)return _0x57219f;if(_0xb86a82===_0x37bf('0x31')){logger[_0x37bf('0x1d')]('['+[_0x5340cf[_0x37bf('0x14')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x57219f;}return createEndUser(_0x57219f,_0x846c1a,_0x35c011,_0x1192b4,_0x334614,_0x5340cf,_0x5276d8)[_0x37bf('0x10')](function(_0x19d669){logger['info']('['+[_0x5340cf[_0x37bf('0x14')]()]+_0x37bf('0x32'),_0x19d669['enduserId']);return _0x19d669;});});}function getCustomFields(_0x262bb9,_0x4d7dd5,_0x505494){var _0x4bbf65={};if(_0x262bb9[_0x37bf('0x30')]>0x0){_['forEach'](_0x262bb9,function(_0x254720){if(_['includes']([_0x37bf('0x33'),'picklist'],_0x254720['type'])&&_0x254720[_0x37bf('0x34')]&&!_0x254720[_0x37bf('0x35')]){var _0x2ccd8b=_0x254720[_0x37bf('0x36')]['toLowerCase']();var _0x4744e7=_0x2ccd8b['substring'](0x0,_0x2ccd8b[_0x37bf('0x37')]('_'));var _0x23cbc1=_0x2ccd8b[_0x37bf('0x2a')](_0x2ccd8b['indexOf']('_')+0x1);if(_0x4744e7===_0x505494){_0x4bbf65[_0x23cbc1]=_0x254720[_0x37bf('0x38')];}}});}return _0x4bbf65;}function getTicket(_0xbc4260,_0x1da5a9,_0xb853a2,_0x4016c7,_0x406715,_0x54e432,_0x52283d){return new Promise(function(_0x1dad73,_0x22ca56){var _0x1d0ad8;return getAuthToken(_0x1da5a9,_0xb853a2,_0x52283d)['then'](function(_0x4f15b5){if(_0x54e432[_0x37bf('0x39')]===_0x37bf('0x3a')){_0x1d0ad8={'method':'POST','uri':_0x4016c7+_0x37bf('0x3b'),'body':Object[_0x37bf('0x3c')]({},{'title':intUtil[_0x37bf('0x3d')](_0x54e432[_0x37bf('0x3e')],_0x406715,'\x20'),'description':intUtil[_0x37bf('0x3d')](_0x54e432[_0x37bf('0x3f')],_0x406715,'\x0a'),'customerid_contact@odata.bind':_0xbc4260[_0x37bf('0x2c')]?_0x37bf('0x40')+_0xbc4260[_0x37bf('0x2c')]+')':undefined,'ownerid@odata.bind':_0x37bf('0x41')+_0xbc4260[_0x37bf('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x54e432[_0x37bf('0x42')],_0x406715,_0x54e432[_0x37bf('0x39')])),'headers':{'Authorization':_0x37bf('0x16')+_0x4f15b5,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x54e432['ticketType']===_0x37bf('0x43')){var _0x138bfc=_0xbc4260[_0x37bf('0x2c')]?[{'partyid_systemuser@odata.bind':_0x37bf('0x41')+_0xbc4260[_0x37bf('0x1f')]+')','participationtypemask':_0xbc4260[_0x37bf('0x44')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x37bf('0x40')+_0xbc4260[_0x37bf('0x2c')]+')','participationtypemask':_0xbc4260[_0x37bf('0x44')]===_0x37bf('0x45')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0xbc4260[_0x37bf('0x1f')]+')','participationtypemask':_0xbc4260[_0x37bf('0x44')]===_0x37bf('0x45')?0x2:0x1}];_0x1d0ad8={'method':_0x37bf('0x25'),'uri':_0x4016c7+_0x37bf('0x46'),'body':Object[_0x37bf('0x3c')]({},{'subject':intUtil[_0x37bf('0x3d')](_0x54e432['Subjects'],_0x406715,'\x20'),'phonenumber':String(_0x406715[_0x37bf('0x24')]),'description':intUtil[_0x37bf('0x3d')](_0x54e432[_0x37bf('0x3f')],_0x406715,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbc4260[_0x37bf('0x2c')]?'/contacts('+_0xbc4260[_0x37bf('0x2c')]+')':undefined,'ownerid@odata.bind':_0x37bf('0x41')+_0xbc4260[_0x37bf('0x1f')]+')','directioncode':_0xbc4260['callDirection']===_0x37bf('0x45')?![]:!![],'phonecall_activity_parties':_0x138bfc},getCustomFields(_0x54e432['Fields'],_0x406715,_0x54e432[_0x37bf('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x4f15b5,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1d0ad8);})[_0x37bf('0x10')](function(_0x10570){var _0x78c88b=_0x10570['headers'][_0x37bf('0x29')];var _0x46ba90=_0x78c88b[_0x37bf('0x2a')](_0x78c88b['lastIndexOf']('(')+0x1,_0x78c88b['lastIndexOf'](')'));_0xbc4260['ticketId']=_0x46ba90;_0x1dad73(_0xbc4260);})['catch'](function(_0xec0639){_0x22ca56(_0xec0639[_0x37bf('0x15')]);});});}function emit(_0x482f70,_0x3ed503,_0x3d39c7,_0x79de5c){var _0x55f22c={'uri':util[_0x37bf('0x47')](_0x37bf('0x48'),_0x482f70,_0x3d39c7,_0x79de5c)};io['to'](util[_0x37bf('0x47')](_0x37bf('0x49'),_0x3ed503))[_0x37bf('0x4a')](_0x37bf('0x4b'),_0x55f22c);}exports['cs']=function(_0x2b4d7,_0x2c544a,_0x5aea6c,_0x128ddf,_0x2a4478,_0x39d8c,_0x321746,_0x258003){var _0x1b663b={};_0x39d8c[_0x37bf('0x8')]=_0x39d8c[_0x37bf('0x7')]?intUtil['stripTrailingSlash'](_0x39d8c['CloudProvider']['data7']):intUtil[_0x37bf('0x4c')](_0x39d8c[_0x37bf('0x8')]);_0x39d8c[_0x37bf('0x4d')]=intUtil[_0x37bf('0x4c')](_0x39d8c['serverUrl']);_0x1b663b[_0x37bf('0x44')]=_0x258003==='queue'||_0x258003===_0x37bf('0x4e')?_0x37bf('0x45'):_0x37bf('0x23');var _0x5c610e=_0x39d8c['modernAuthentication']?util[_0x37bf('0x47')](_0x37bf('0x4f'),_0x39d8c[_0x37bf('0x9')]['data7']):util[_0x37bf('0x47')](_0x37bf('0x4f'),_0x39d8c[_0x37bf('0x8')]);var _0x126c14=util[_0x37bf('0x47')](_0x37bf('0x50'),_0x39d8c[_0x37bf('0xb')]);var _0x1d0070=util[_0x37bf('0x47')](_0x37bf('0x51'),_0x39d8c[_0x37bf('0x4d')],_0x2c544a[_0x37bf('0x52')],md5(_0x2c544a[_0x37bf('0x52')]));if(_0x2a4478&&_0x2a4478['monitor_format']){logger[_0x37bf('0x1d')](_0x37bf('0x53'),_0x37bf('0x54'));_0x2c544a[_0x37bf('0x55')]=_0x1d0070;}else if(_0x321746&&_0x321746[_0x37bf('0x56')]&&_0x321746[_0x37bf('0x56')]!==_0x37bf('0x57')){logger['info'](_0x37bf('0x58'),'Recording\x20is\x20enabled!');_0x2c544a['recordingURL']=_0x1d0070;}else{_0x2c544a[_0x37bf('0x55')]='';}return getUser(_0x1b663b,_0x39d8c,_0x128ddf,_0x126c14,_0x5c610e,_0x258003)[_0x37bf('0x10')](function(_0x354bf1){logger[_0x37bf('0x1d')]('['+_0x258003[_0x37bf('0x14')]()+_0x37bf('0x59'),_0x354bf1[_0x37bf('0x1f')]);logger[_0x37bf('0x1d')]('['+_0x258003[_0x37bf('0x14')]()+']\x20The\x20User\x20email\x20is:',_0x354bf1[_0x37bf('0x21')]);return getEndUser(_0x354bf1,_0x39d8c,_0x126c14,_0x5c610e,_0x2c544a,_0x258003,_0x5aea6c['moduleCreate'],_0x5aea6c[_0x37bf('0x5a')]);})[_0x37bf('0x10')](function(_0x4a8c63){logger[_0x37bf('0x1d')]('['+_0x258003['toUpperCase']()+_0x37bf('0x5b'),_0x4a8c63[_0x37bf('0x2c')]);logger['info']('['+_0x258003['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x2c544a['calleridnum']);return getTicket(_0x4a8c63,_0x39d8c,_0x126c14,_0x5c610e,_0x2c544a,_0x5aea6c,_0x258003);})['then'](function(_0x50f449){logger[_0x37bf('0x1d')](util[_0x37bf('0x47')]('['+_0x258003['toUpperCase']()+_0x37bf('0x5c'),_0x5aea6c[_0x37bf('0x39')],_0x50f449[_0x37bf('0x5d')]));logger[_0x37bf('0x1d')](util[_0x37bf('0x47')]('['+_0x258003['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x258003));if(_0x258003!==_0x37bf('0x4e')&&_0x5aea6c[_0x37bf('0x5e')]){logger[_0x37bf('0x1d')]('['+_0x258003[_0x37bf('0x14')]()+']',_0x37bf('0x5f'));emit(_0x39d8c[_0x37bf('0x8')],_0x128ddf[_0x37bf('0x60')],_0x5aea6c[_0x37bf('0x39')],_0x50f449[_0x37bf('0x5d')]);}})[_0x37bf('0x12')](function(_0x36e433){logger['error']('['+_0x258003[_0x37bf('0x14')]()+_0x37bf('0x61'),_0x36e433[_0x37bf('0x15')]);console[_0x37bf('0x13')](_0x37bf('0x62'),_0x36e433);});}; \ No newline at end of file +var _0x8da1=['validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','4.0','body','headers','odata-entityid','lastIndexOf','enduserId','toLowerCase','outbound','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20created!','string','picklist','nameField','customField','substring','indexOf','ticketType','incident','getString','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','Subjects','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','error','Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','defaults','socket.io-emitter','redis','modernAuthentication','remoteUri','CloudProvider','data7','resolve','data5','POST','clientId','username','password','clientSecret','access_token','catch','toUpperCase','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','then','value'];(function(_0x57a874,_0x52ad5b){var _0x4edaec=function(_0x55f461){while(--_0x55f461){_0x57a874['push'](_0x57a874['shift']());}};_0x4edaec(++_0x52ad5b);}(_0x8da1,0x189));var _0x18da=function(_0x4df6ba,_0x477c3e){_0x4df6ba=_0x4df6ba-0x0;var _0x472acf=_0x8da1[_0x4df6ba];return _0x472acf;};'use strict';var _=require('lodash');var rp=require(_0x18da('0x0'));var util=require(_0x18da('0x1'));var intUtil=require('./util');var md5=require(_0x18da('0x2'));var Redis=require(_0x18da('0x3'));var logger=require('../../../../config/logger')(_0x18da('0x4'));var config=require(_0x18da('0x5'));config['redis']=_[_0x18da('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x18da('0x7'))(new Redis(config[_0x18da('0x8')]));function getAuthToken(_0x1ef1f6,_0x4d490c,_0x4ede43){if(_0x1ef1f6[_0x18da('0x9')]){_0x1ef1f6[_0x18da('0xa')]=_0x1ef1f6[_0x18da('0xb')][_0x18da('0xc')];_0x1ef1f6['tenantId']=_0x1ef1f6['CloudProvider']['data2'];return Promise[_0x18da('0xd')](_0x1ef1f6['CloudProvider'][_0x18da('0xe')]);}var _0x388e75={'method':_0x18da('0xf'),'uri':_0x4d490c,'form':{'client_id':_0x1ef1f6[_0x18da('0x10')],'resource':_0x1ef1f6[_0x18da('0xa')],'username':_0x1ef1f6[_0x18da('0x11')],'password':_0x1ef1f6[_0x18da('0x12')],'grant_type':_0x18da('0x12'),'client_secret':_0x1ef1f6[_0x18da('0x13')]},'json':!![]};return rp(_0x388e75)['then'](function(_0x307386){return _0x307386[_0x18da('0x14')];})[_0x18da('0x15')](function(_0x1085bf){logger['error']('['+[_0x4ede43[_0x18da('0x16')]()]+']\x20Wrong\x20credentials!');return _0x1085bf[_0x18da('0x17')];});}function getUser(_0x335c82,_0x358a75,_0x1e7a02,_0x72fc7e,_0x2443ef,_0x764715){return new Promise(function(_0x3c0427,_0x51bc73){return getAuthToken(_0x358a75,_0x72fc7e,_0x764715)['then'](function(_0x52ad13){var _0x801021={'method':'GET','uri':_0x2443ef+_0x18da('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x52ad13,'OData-Version':'4.0'},'json':!![]};return rp(_0x801021);})[_0x18da('0x19')](function(_0x588b1f){var _0x1a764c=_0x588b1f[_0x18da('0x1a')];var _0x19ab78=![];var _0x46e6a6=null;if(!_['isNil'](_0x1e7a02)){if(intUtil[_0x18da('0x1b')](_0x1e7a02['email'])){_0x335c82[_0x18da('0x1c')]=_0x1e7a02[_0x18da('0x1d')];for(_0x46e6a6=0x0;_0x46e6a6<_0x1a764c[_0x18da('0x1e')];_0x46e6a6++){if(_0x1a764c[_0x46e6a6][_0x18da('0x1f')]===_0x1e7a02[_0x18da('0x1d')]&&!_0x1a764c[_0x46e6a6][_0x18da('0x20')]){_0x19ab78=!![];logger[_0x18da('0x21')]('['+[_0x764715[_0x18da('0x16')]()]+_0x18da('0x22')+_0x1a764c[_0x46e6a6][_0x18da('0x23')]+'!');_0x335c82[_0x18da('0x24')]=_0x1a764c[_0x46e6a6][_0x18da('0x23')];}}}}if(!_0x19ab78){logger[_0x18da('0x21')]('['+[_0x764715[_0x18da('0x16')]()]+_0x18da('0x25'));_0x335c82[_0x18da('0x1c')]=_0x358a75[_0x18da('0x11')];for(_0x46e6a6=0x0;_0x46e6a6<_0x1a764c['length'];_0x46e6a6++){if(_0x1a764c[_0x46e6a6]['internalemailaddress']===_0x358a75[_0x18da('0x11')]){_0x335c82[_0x18da('0x24')]=_0x1a764c[_0x46e6a6][_0x18da('0x23')];}}}_0x3c0427(_0x335c82);})['catch'](function(_0x342f1c){_0x51bc73(_0x342f1c['message']);});});}function createEndUser(_0x35ff2b,_0x152195,_0x572ff4,_0x154b73,_0x2ec40f,_0x4eec1f,_0x126bed){return new Promise(function(_0x17761f,_0x5e1add){return getAuthToken(_0x152195,_0x572ff4,_0x4eec1f)[_0x18da('0x19')](function(_0x5c7665){var _0x372625=_0x4eec1f['toLowerCase']()==='outbound'?_0x2ec40f[_0x18da('0x26')]:_0x2ec40f[_0x18da('0x27')];var _0x2cb9a1={'method':_0x18da('0xf'),'uri':_0x154b73+_0x18da('0x28'),'body':{'fullname':_0x372625,'firstname':_0x372625,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x18da('0x29')+_0x35ff2b[_0x18da('0x24')]+')'},'headers':{'Authorization':_0x18da('0x2a')+_0x5c7665,'OData-Version':_0x18da('0x2b')},'json':!![],'resolveWithFullResponse':!![]};_0x2cb9a1[_0x18da('0x2c')][_0x126bed]=_0x372625;return rp(_0x2cb9a1);})[_0x18da('0x19')](function(_0x4be942){var _0x2d66a2=_0x4be942[_0x18da('0x2d')][_0x18da('0x2e')];var _0x55a1f3=_0x2d66a2['substring'](_0x2d66a2[_0x18da('0x2f')]('(')+0x1,_0x2d66a2[_0x18da('0x2f')](')'));_0x35ff2b[_0x18da('0x30')]=_0x55a1f3;_0x17761f(_0x35ff2b);})[_0x18da('0x15')](function(_0x4424c8){_0x5e1add(_0x4424c8['message']);});});}function getEndUser(_0x558dcf,_0x5206dd,_0x1b417a,_0x4922ec,_0x21f2d3,_0x390afe,_0x2cb91d,_0x2808d6){var _0x338f7f=_0x390afe[_0x18da('0x31')]()===_0x18da('0x32')?_0x21f2d3[_0x18da('0x26')]:_0x21f2d3['calleridnum'];return getAuthToken(_0x5206dd,_0x1b417a,_0x390afe)['then'](function(_0xf087b0){_0x2808d6=_0x2808d6?_0x2808d6:'telephone1';var _0x462a5a={'method':'GET','uri':_0x4922ec+_0x18da('0x33')+_0x2808d6+'&$filter='+_0x2808d6+_0x18da('0x34')+_0x338f7f[_0x18da('0x35')]('+',_0x18da('0x36'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0xf087b0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x462a5a);})['then'](function(_0x286c14){var _0x3eb4fd=![];if(!_0x286c14)return _0x3eb4fd;var _0x1ef5bc=_0x286c14['value'];for(var _0x58526f=0x0;_0x58526f<_0x1ef5bc[_0x18da('0x1e')];_0x58526f++){if(_0x1ef5bc[_0x58526f][_0x2808d6]===_0x338f7f){_0x3eb4fd=!![];_0x558dcf['enduserId']=_0x1ef5bc[_0x58526f][_0x18da('0x37')];}}return _0x3eb4fd;})[_0x18da('0x19')](function(_0x28902a){if(_0x28902a)return _0x558dcf;if(_0x2cb91d==='nothing'){logger[_0x18da('0x21')]('['+[_0x390afe['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x558dcf;}return createEndUser(_0x558dcf,_0x5206dd,_0x1b417a,_0x4922ec,_0x21f2d3,_0x390afe,_0x2808d6)['then'](function(_0x50fb92){logger['info']('['+[_0x390afe[_0x18da('0x16')]()]+_0x18da('0x38'),_0x50fb92[_0x18da('0x30')]);return _0x50fb92;});});}function getCustomFields(_0xfda409,_0x55b10,_0x354640){var _0x5ba2d5={};if(_0xfda409['length']>0x0){_['forEach'](_0xfda409,function(_0xe202cb){if(_['includes']([_0x18da('0x39'),_0x18da('0x3a')],_0xe202cb['type'])&&_0xe202cb[_0x18da('0x3b')]&&!_0xe202cb[_0x18da('0x3c')]){var _0x58f7ae=_0xe202cb['idField'][_0x18da('0x31')]();var _0x55b54c=_0x58f7ae[_0x18da('0x3d')](0x0,_0x58f7ae[_0x18da('0x3e')]('_'));var _0x27cff7=_0x58f7ae[_0x18da('0x3d')](_0x58f7ae[_0x18da('0x3e')]('_')+0x1);if(_0x55b54c===_0x354640){_0x5ba2d5[_0x27cff7]=_0xe202cb['content'];}}});}return _0x5ba2d5;}function getTicket(_0x2c8841,_0x139035,_0x35b3db,_0x168790,_0x1645ef,_0x2e47c5,_0x359ef1){return new Promise(function(_0x3a5827,_0x597c72){var _0x1d0849;return getAuthToken(_0x139035,_0x35b3db,_0x359ef1)[_0x18da('0x19')](function(_0x1c80c2){if(_0x2e47c5[_0x18da('0x3f')]===_0x18da('0x40')){_0x1d0849={'method':_0x18da('0xf'),'uri':_0x168790+'incidents','body':Object['assign']({},{'title':intUtil[_0x18da('0x41')](_0x2e47c5['Subjects'],_0x1645ef,'\x20'),'description':intUtil[_0x18da('0x41')](_0x2e47c5['Descriptions'],_0x1645ef,'\x0a'),'customerid_contact@odata.bind':_0x2c8841['enduserId']?_0x18da('0x42')+_0x2c8841[_0x18da('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2c8841[_0x18da('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x2e47c5[_0x18da('0x43')],_0x1645ef,_0x2e47c5[_0x18da('0x3f')])),'headers':{'Authorization':_0x18da('0x2a')+_0x1c80c2,'OData-Version':_0x18da('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2e47c5[_0x18da('0x3f')]===_0x18da('0x44')){var _0x4025e1=_0x2c8841[_0x18da('0x30')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2c8841[_0x18da('0x24')]+')','participationtypemask':_0x2c8841[_0x18da('0x45')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x18da('0x42')+_0x2c8841[_0x18da('0x30')]+')','participationtypemask':_0x2c8841[_0x18da('0x45')]===_0x18da('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x18da('0x29')+_0x2c8841[_0x18da('0x24')]+')','participationtypemask':_0x2c8841[_0x18da('0x45')]===_0x18da('0x46')?0x2:0x1}];_0x1d0849={'method':_0x18da('0xf'),'uri':_0x168790+_0x18da('0x47'),'body':Object[_0x18da('0x48')]({},{'subject':intUtil['getString'](_0x2e47c5[_0x18da('0x49')],_0x1645ef,'\x20'),'phonenumber':String(_0x1645ef[_0x18da('0x27')]),'description':intUtil['getString'](_0x2e47c5[_0x18da('0x4a')],_0x1645ef,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2c8841[_0x18da('0x30')]?_0x18da('0x42')+_0x2c8841[_0x18da('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2c8841[_0x18da('0x24')]+')','directioncode':_0x2c8841['callDirection']===_0x18da('0x46')?![]:!![],'phonecall_activity_parties':_0x4025e1},getCustomFields(_0x2e47c5[_0x18da('0x43')],_0x1645ef,_0x2e47c5[_0x18da('0x3f')])),'headers':{'Authorization':_0x18da('0x2a')+_0x1c80c2,'OData-Version':_0x18da('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1d0849);})[_0x18da('0x19')](function(_0x4ec8b8){var _0x2f9e56=_0x4ec8b8[_0x18da('0x2d')]['odata-entityid'];var _0x4d2b7d=_0x2f9e56['substring'](_0x2f9e56['lastIndexOf']('(')+0x1,_0x2f9e56['lastIndexOf'](')'));_0x2c8841[_0x18da('0x4b')]=_0x4d2b7d;_0x3a5827(_0x2c8841);})['catch'](function(_0xada58e){_0x597c72(_0xada58e[_0x18da('0x17')]);});});}function emit(_0x265039,_0x499d41,_0x260923,_0x370a2f){var _0x50ce56={'uri':util[_0x18da('0x4c')](_0x18da('0x4d'),_0x265039,_0x260923,_0x370a2f)};io['to'](util[_0x18da('0x4c')]('user:%s',_0x499d41))[_0x18da('0x4e')](_0x18da('0x4f'),_0x50ce56);}exports['cs']=function(_0x34adea,_0x481ca0,_0x7dab33,_0x2042ca,_0x2ba224,_0x3e2c93,_0x243db0,_0x1f5c55){var _0x196544={};_0x3e2c93[_0x18da('0xa')]=_0x3e2c93[_0x18da('0x9')]?intUtil['stripTrailingSlash'](_0x3e2c93[_0x18da('0xb')][_0x18da('0xc')]):intUtil['stripTrailingSlash'](_0x3e2c93[_0x18da('0xa')]);_0x3e2c93[_0x18da('0x50')]=intUtil['stripTrailingSlash'](_0x3e2c93['serverUrl']);_0x196544[_0x18da('0x45')]=_0x1f5c55===_0x18da('0x46')||_0x1f5c55===_0x18da('0x51')?_0x18da('0x46'):_0x18da('0x32');var _0x44023b=_0x3e2c93[_0x18da('0x9')]?util[_0x18da('0x4c')]('%s/api/data/v9.0/',_0x3e2c93[_0x18da('0xb')][_0x18da('0xc')]):util[_0x18da('0x4c')](_0x18da('0x52'),_0x3e2c93[_0x18da('0xa')]);var _0x480699=util[_0x18da('0x4c')](_0x18da('0x53'),_0x3e2c93[_0x18da('0x54')]);var _0x30c438=util[_0x18da('0x4c')](_0x18da('0x55'),_0x3e2c93['serverUrl'],_0x481ca0[_0x18da('0x56')],md5(_0x481ca0[_0x18da('0x56')]));if(_0x2ba224&&_0x2ba224[_0x18da('0x57')]){logger[_0x18da('0x21')](_0x18da('0x58'),_0x18da('0x59'));_0x481ca0['recordingURL']=_0x30c438;}else if(_0x243db0&&_0x243db0[_0x18da('0x5a')]&&_0x243db0[_0x18da('0x5a')]!==_0x18da('0x5b')){logger[_0x18da('0x21')](_0x18da('0x5c'),_0x18da('0x59'));_0x481ca0[_0x18da('0x5d')]=_0x30c438;}else{_0x481ca0[_0x18da('0x5d')]='';}return getUser(_0x196544,_0x3e2c93,_0x2042ca,_0x480699,_0x44023b,_0x1f5c55)[_0x18da('0x19')](function(_0x37a519){logger[_0x18da('0x21')]('['+_0x1f5c55[_0x18da('0x16')]()+_0x18da('0x5e'),_0x37a519['userId']);logger['info']('['+_0x1f5c55[_0x18da('0x16')]()+_0x18da('0x5f'),_0x37a519[_0x18da('0x1c')]);return getEndUser(_0x37a519,_0x3e2c93,_0x480699,_0x44023b,_0x481ca0,_0x1f5c55,_0x7dab33[_0x18da('0x60')],_0x7dab33['additionalSearchContact']);})[_0x18da('0x19')](function(_0x5e27e5){logger[_0x18da('0x21')]('['+_0x1f5c55[_0x18da('0x16')]()+_0x18da('0x61'),_0x5e27e5['enduserId']);logger['info']('['+_0x1f5c55['toUpperCase']()+_0x18da('0x62'),_0x481ca0['calleridnum']);return getTicket(_0x5e27e5,_0x3e2c93,_0x480699,_0x44023b,_0x481ca0,_0x7dab33,_0x1f5c55);})['then'](function(_0x5d564c){logger[_0x18da('0x21')](util['format']('['+_0x1f5c55['toUpperCase']()+_0x18da('0x63'),_0x7dab33['ticketType'],_0x5d564c['ticketId']));logger[_0x18da('0x21')](util[_0x18da('0x4c')]('['+_0x1f5c55[_0x18da('0x16')]()+_0x18da('0x64'),_0x1f5c55));if(_0x1f5c55!=='unmanaged'&&_0x7dab33[_0x18da('0x65')]){logger['info']('['+_0x1f5c55[_0x18da('0x16')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3e2c93[_0x18da('0xa')],_0x2042ca[_0x18da('0x66')],_0x7dab33[_0x18da('0x3f')],_0x5d564c['ticketId']);}})[_0x18da('0x15')](function(_0x4a2a21){logger[_0x18da('0x67')]('['+_0x1f5c55[_0x18da('0x16')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x4a2a21['message']);console[_0x18da('0x67')](_0x18da('0x68'),_0x4a2a21);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 0b2c820..2f61b8c 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 _0xd71d=['remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','base64','stringify','GET','map','forEach','includes','string','picklist','nameField','customField','idField','push','content','toString','type','variable','variableName','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','lodash','request-promise','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','keyBy','value','format','then','%s/api/v2/agents'];(function(_0x39b3f9,_0x39e2cd){var _0x356039=function(_0x1d7746){while(--_0x1d7746){_0x39b3f9['push'](_0x39b3f9['shift']());}};_0x356039(++_0x39e2cd);}(_0xd71d,0x9f));var _0xdd71=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0xd71d[_0x4f8f3b];return _0x4c250c;};'use strict';var _=require(_0xdd71('0x0'));var rp=require(_0xdd71('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xdd71('0x2'));var intUtil=require('./util');var config=require(_0xdd71('0x3'));var logger=require(_0xdd71('0x4'))(_0xdd71('0x5'));config[_0xdd71('0x6')]=_[_0xdd71('0x7')](config['redis'],{'host':_0xdd71('0x8'),'port':0x18eb});var io=require(_0xdd71('0x9'))(new Redis(config[_0xdd71('0x6')]));var headers={'Content-Type':_0xdd71('0xa'),'Accept':_0xdd71('0xa')};function emit(_0x4e444b,_0x4d6136,_0x59fc31){io['to'](_0x4e444b)[_0xdd71('0xb')](_0x4d6136,_0x59fc31);}function getTicket(_0x5d5635,_0x1de71a,_0x31d284,_0x368484,_0x5f2ec2){logger[_0xdd71('0xc')](_0xdd71('0xd'));var _0xada70=_['merge']({'responder_id':_0x1de71a['id'],'requester_id':_0x31d284['id'],'name':util['format'](_0xdd71('0xe'),_0x5f2ec2[_0xdd71('0xf')]),'phone':_0x5f2ec2[_0xdd71('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xdd71('0x11')](_0x368484[_0xdd71('0x12')],_0x5f2ec2,'\x20'),'description':intUtil[_0xdd71('0x11')](_0x368484[_0xdd71('0x13')],_0x5f2ec2,'
'),'tags':getTags(_0x368484[_0xdd71('0x14')],_0xdd71('0x15'))},getCustomFields(_0x368484[_0xdd71('0x16')],_0x5f2ec2));_0xada70[_0xdd71('0x17')]=_['mapValues'](_[_0xdd71('0x18')](_0xada70[_0xdd71('0x17')],'id'),_0xdd71('0x19'));return request({'uri':util[_0xdd71('0x1a')]('%s/api/v2/tickets',_0x5d5635['remoteUri']),'method':'POST','body':_0xada70})[_0xdd71('0x1b')](function(_0x53517b){logger['info']('Ticket\x20created!');return _0x53517b;});}function getUser(_0x43797c,_0x26f657){if(intUtil['validateEmail'](_0x26f657)){return request({'uri':util[_0xdd71('0x1a')](_0xdd71('0x1c'),_0x43797c[_0xdd71('0x1d')]),'qs':{'email':_0x26f657}})[_0xdd71('0x1b')](function(_0x216d48){if(_0x216d48[_0xdd71('0x1e')]){logger[_0xdd71('0xc')](_0xdd71('0x1f'));return _[_0xdd71('0x20')](_0x216d48,function(_0x30b8a1){return _0x30b8a1[_0xdd71('0x21')][_0xdd71('0x22')]===_0x26f657;});}else{logger[_0xdd71('0xc')](_0xdd71('0x23'));return request({'uri':util[_0xdd71('0x1a')]('%s/api/v2/agents/me',_0x43797c[_0xdd71('0x1d')])})['then'](function(_0x3b0b0a){logger[_0xdd71('0xc')]('Admin\x20account\x20selected.');return _0x3b0b0a;});}});}else{logger['info'](_0xdd71('0x24'));return request({'uri':util[_0xdd71('0x1a')](_0xdd71('0x25'),_0x43797c[_0xdd71('0x1d')])})[_0xdd71('0x1b')](function(_0x22d9d0){logger[_0xdd71('0xc')](_0xdd71('0x26'));return _0x22d9d0;});}}function getEndUser(_0x566011,_0x5ca746,_0x23691b){logger[_0xdd71('0xc')](_0xdd71('0x27'),_0x23691b);return request({'uri':util[_0xdd71('0x1a')]('%s/api/v2/contacts',_0x566011[_0xdd71('0x1d')]),'qs':{'phone':_0x23691b}})['then'](function(_0x44267d){if(_0x44267d[_0xdd71('0x1e')]){logger['info'](_0xdd71('0x28'));return _[_0xdd71('0x20')](_0x44267d,{'phone':_0x23691b});}else{logger[_0xdd71('0xc')](_0xdd71('0x29'));return request({'uri':util[_0xdd71('0x1a')](_0xdd71('0x2a'),_0x566011[_0xdd71('0x1d')]),'method':_0xdd71('0x2b'),'body':{'name':_0x5ca746,'phone':_0x23691b}})[_0xdd71('0x1b')](function(_0x46f41d){logger[_0xdd71('0xc')](_0xdd71('0x2c'));return _0x46f41d;});}});}function getAuth(_0x1a7ad5){return util['format'](_0xdd71('0x2d'),new Buffer(_0x1a7ad5[_0xdd71('0x2e')]+':X')['toString'](_0xdd71('0x2f')));}function request(_0xbccdc6){logger['debug']('[HTTP]',JSON[_0xdd71('0x30')](_0xbccdc6));return rp(_[_0xdd71('0x7')](_0xbccdc6,{'method':_0xdd71('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x2b1e6f,_0x51de5a){var _0x5286a2=[];if(_0x2b1e6f&&_0x2b1e6f[_0xdd71('0x1e')]>0x0){_0x5286a2=_[_0xdd71('0x32')](_0x2b1e6f,_0x51de5a);}return _0x5286a2;}function getCustomFields(_0x430665,_0x5a5c1d){var _0x499e14=[];var _0x346f90={'custom_fields':[]};if(_0x430665[_0xdd71('0x1e')]>0x0){_[_0xdd71('0x33')](_0x430665,function(_0x1ef8fb){if(_[_0xdd71('0x34')]([_0xdd71('0x35'),_0xdd71('0x36')],_0x1ef8fb['type'])&&_0x1ef8fb[_0xdd71('0x37')]&&!_0x1ef8fb[_0xdd71('0x38')]){_0x346f90[_0x1ef8fb[_0xdd71('0x37')]['toLowerCase']()]=_0x1ef8fb['content']['toString']();}else if(_[_0xdd71('0x34')]([_0xdd71('0x35'),_0xdd71('0x36')],_0x1ef8fb['type'])&&_0x1ef8fb[_0xdd71('0x39')]&&_0x1ef8fb[_0xdd71('0x38')]){_0x346f90['custom_fields'][_0xdd71('0x3a')]({'id':_0x1ef8fb['idField'],'value':_0x1ef8fb[_0xdd71('0x3b')][_0xdd71('0x3c')]()});}else if(_0x1ef8fb[_0xdd71('0x3d')]===_0xdd71('0x3e')&&_0x1ef8fb[_0xdd71('0x3f')]&&_0x1ef8fb[_0xdd71('0x39')]&&_0x1ef8fb['customField']){_0x5a5c1d[_0x1ef8fb[_0xdd71('0x3f')]]&&_0x346f90[_0xdd71('0x17')]['push']({'id':_0x1ef8fb[_0xdd71('0x39')],'value':_0x5a5c1d[_0x1ef8fb[_0xdd71('0x3f')]][_0xdd71('0x3c')]()});}else if(_0x1ef8fb[_0xdd71('0x3d')]===_0xdd71('0x40')&&_0x1ef8fb[_0xdd71('0x41')]&&_0x1ef8fb[_0xdd71('0x41')][_0xdd71('0x15')]&&_0x1ef8fb[_0xdd71('0x39')]&&_0x1ef8fb[_0xdd71('0x38')]){_0x5a5c1d[_0x1ef8fb[_0xdd71('0x41')]['name'][_0xdd71('0x42')]()]&&_0x346f90[_0xdd71('0x17')][_0xdd71('0x3a')]({'id':_0x1ef8fb[_0xdd71('0x39')],'value':_0x5a5c1d[_0x1ef8fb['Variable']['name'][_0xdd71('0x42')]()][_0xdd71('0x3c')]()});}});}return _0x346f90;}exports[_0xdd71('0x43')]=function(_0x5c5427,_0x2c0de2,_0x2298f9,_0x27d398,_0x1ce81d,_0xd4948c){var _0x231569,_0x211895;_0xd4948c['remoteUri']=intUtil['stripTrailingSlash'](_0xd4948c[_0xdd71('0x1d')]);_0xd4948c[_0xdd71('0x44')]=intUtil[_0xdd71('0x45')](_0xd4948c[_0xdd71('0x44')]);if(_0x1ce81d&&_0x1ce81d[_0xdd71('0x46')]){logger[_0xdd71('0xc')](_0xdd71('0x47'),'Recording\x20is\x20enabled!');_0x2c0de2['recordingURL']=util[_0xdd71('0x1a')](_0xdd71('0x48'),_0xd4948c[_0xdd71('0x44')],_0x2c0de2['uniqueid'],md5(_0x2c0de2[_0xdd71('0x49')]));}else{_0x2c0de2[_0xdd71('0x4a')]='';}headers[_0xdd71('0x4b')]=getAuth(_0xd4948c);return getUser(_0xd4948c,_0x27d398[_0xdd71('0x22')])['then'](function(_0x11a0e0){_0x231569=_0x11a0e0;logger['info'](_0xdd71('0x4c'),_0x231569['id']);return getEndUser(_0xd4948c,_0x2c0de2[_0xdd71('0xf')],_0x2c0de2[_0xdd71('0x10')]);})[_0xdd71('0x1b')](function(_0x15031c){_0x211895=_0x15031c;logger[_0xdd71('0xc')]('The\x20Enduser\x20ID\x20is:',_0x211895['id']);return getTicket(_0xd4948c,_0x231569,_0x211895,_0x2298f9,_0x2c0de2);})[_0xdd71('0x1b')](function(_0x4cb1da){if(_0x4cb1da&&_0x4cb1da['id']){logger[_0xdd71('0xc')](_0xdd71('0x4d'));logger[_0xdd71('0xc')](_0xdd71('0x4e'),_0x4cb1da['id']);logger[_0xdd71('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xdd71('0x4f'),_0x27d398[_0xdd71('0x15')]),_0xdd71('0x50'),{'uri':util[_0xdd71('0x1a')](_0xdd71('0x51'),_0xd4948c[_0xdd71('0x1d')],_0x4cb1da['id'])});}})[_0xdd71('0x52')](function(_0x5619f8){logger[_0xdd71('0x53')](_0xdd71('0x47'),JSON['stringify'](_0x5619f8));});};exports[_0xdd71('0x54')]=function(_0x231440,_0x48c5dd,_0x271246,_0xf12d9a,_0x535913,_0x15e19a,_0x242ad9){var _0x49622a,_0x1b44c8;_0x15e19a[_0xdd71('0x1d')]=intUtil[_0xdd71('0x45')](_0x15e19a['remoteUri']);_0x15e19a[_0xdd71('0x44')]=intUtil['stripTrailingSlash'](_0x15e19a['serverUrl']);if(_0x242ad9&&_0x242ad9[_0xdd71('0x55')]&&_0x242ad9[_0xdd71('0x55')]!==_0xdd71('0x56')){logger[_0xdd71('0xc')](_0xdd71('0x57'),_0xdd71('0x58'));_0x48c5dd['recordingURL']=util[_0xdd71('0x1a')](_0xdd71('0x48'),_0x15e19a[_0xdd71('0x44')],_0x48c5dd[_0xdd71('0x49')],md5(_0x48c5dd[_0xdd71('0x49')]));}headers['Authorization']=getAuth(_0x15e19a);return getUser(_0x15e19a,_0xf12d9a['email'])['then'](function(_0x3ab4f5){_0x49622a=_0x3ab4f5;logger[_0xdd71('0xc')](_0xdd71('0x4c'),_0x49622a['id']);return getEndUser(_0x15e19a,_0x48c5dd[_0xdd71('0x59')],_0x48c5dd['destcalleridnum']);})[_0xdd71('0x1b')](function(_0x4bb1f0){_0x1b44c8=_0x4bb1f0;logger['info'](_0xdd71('0x5a'),_0x1b44c8['id']);return getTicket(_0x15e19a,_0x49622a,_0x1b44c8,_0x271246,_0x48c5dd);})[_0xdd71('0x1b')](function(_0x42f603){if(_0x42f603&&_0x42f603['id']){logger[_0xdd71('0xc')](_0xdd71('0x4d'));logger[_0xdd71('0xc')](_0xdd71('0x4e'),_0x42f603['id']);logger['info'](_0xdd71('0x57'),_0xdd71('0x5b'));emit(util[_0xdd71('0x1a')](_0xdd71('0x4f'),_0xf12d9a[_0xdd71('0x15')]),_0xdd71('0x50'),{'uri':util[_0xdd71('0x1a')]('%s/helpdesk/tickets/%d',_0x15e19a['remoteUri'],_0x42f603['id'])});}})[_0xdd71('0x52')](function(_0x44c102){logger[_0xdd71('0x53')](_0xdd71('0x57'),JSON[_0xdd71('0x30')](_0x44c102));});};exports[_0xdd71('0x5c')]=function(_0x1863aa,_0x2419b5,_0x463854,_0x59f994,_0x5cf5ea,_0x8f45f3){var _0x3ebe73,_0x2bc9f2;_0x8f45f3[_0xdd71('0x1d')]=intUtil['stripTrailingSlash'](_0x8f45f3[_0xdd71('0x1d')]);_0x8f45f3[_0xdd71('0x44')]=intUtil[_0xdd71('0x45')](_0x8f45f3[_0xdd71('0x44')]);if(_0x5cf5ea&&_0x5cf5ea['monitor_format']){logger[_0xdd71('0xc')]('['+_0x2419b5[_0xdd71('0x5d')]['toUpperCase']()+']',_0xdd71('0x58'));_0x2419b5[_0xdd71('0x4a')]=util[_0xdd71('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8f45f3[_0xdd71('0x44')],_0x2419b5[_0xdd71('0x49')],md5(_0x2419b5['uniqueid']));}else{_0x2419b5[_0xdd71('0x4a')]='';}headers[_0xdd71('0x4b')]=getAuth(_0x8f45f3);return getUser(_0x8f45f3,'')[_0xdd71('0x1b')](function(_0x308a1f){_0x3ebe73=_0x308a1f;logger[_0xdd71('0xc')](_0xdd71('0x4c'),_0x3ebe73['id']);return getEndUser(_0x8f45f3,_0x2419b5[_0xdd71('0xf')],_0x2419b5[_0xdd71('0x10')]);})[_0xdd71('0x1b')](function(_0x22f321){_0x2bc9f2=_0x22f321;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2bc9f2['id']);return getTicket(_0x8f45f3,_0x3ebe73,_0x2bc9f2,_0x463854,_0x2419b5);})['then'](function(_0x40542c){if(_0x40542c){logger[_0xdd71('0xc')]('Ticket\x20created!');logger[_0xdd71('0xc')](_0xdd71('0x4e'),_0x40542c['id']);}})[_0xdd71('0x52')](function(_0x381716){logger[_0xdd71('0x53')]('['+_0x2419b5['lastevent']['toUpperCase']()+']',JSON[_0xdd71('0x30')](_0x381716));});}; \ No newline at end of file +var _0x60cd=['remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','includes','string','picklist','nameField','customField','type','idField','content','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','unmanaged','lastevent','Authorization','error','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets'];(function(_0x131162,_0x4c2814){var _0x45285d=function(_0x19fb1f){while(--_0x19fb1f){_0x131162['push'](_0x131162['shift']());}};_0x45285d(++_0x4c2814);}(_0x60cd,0x159));var _0xd60c=function(_0x461119,_0x28ce98){_0x461119=_0x461119-0x0;var _0x4b5ed3=_0x60cd[_0x461119];return _0x4b5ed3;};'use strict';var _=require(_0xd60c('0x0'));var rp=require('request-promise');var md5=require(_0xd60c('0x1'));var util=require(_0xd60c('0x2'));var Redis=require(_0xd60c('0x3'));var intUtil=require(_0xd60c('0x4'));var config=require(_0xd60c('0x5'));var logger=require('../../../../config/logger')(_0xd60c('0x6'));config[_0xd60c('0x7')]=_[_0xd60c('0x8')](config[_0xd60c('0x7')],{'host':_0xd60c('0x9'),'port':0x18eb});var io=require(_0xd60c('0xa'))(new Redis(config[_0xd60c('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x41bc5b,_0x5d6fef,_0xb4522d){io['to'](_0x41bc5b)[_0xd60c('0xb')](_0x5d6fef,_0xb4522d);}function getTicket(_0x28d21f,_0x22c26a,_0x189f32,_0x44235f,_0x3b48b8){logger[_0xd60c('0xc')](_0xd60c('0xd'));var _0x620c0c=_[_0xd60c('0xe')]({'responder_id':_0x22c26a['id'],'requester_id':_0x189f32['id'],'name':util[_0xd60c('0xf')](_0xd60c('0x10'),_0x3b48b8[_0xd60c('0x11')]),'phone':_0x3b48b8[_0xd60c('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x44235f[_0xd60c('0x13')],_0x3b48b8,'\x20'),'description':intUtil[_0xd60c('0x14')](_0x44235f[_0xd60c('0x15')],_0x3b48b8,_0xd60c('0x16')),'tags':getTags(_0x44235f[_0xd60c('0x17')],_0xd60c('0x18'))},getCustomFields(_0x44235f[_0xd60c('0x19')],_0x3b48b8));_0x620c0c['custom_fields']=_[_0xd60c('0x1a')](_[_0xd60c('0x1b')](_0x620c0c[_0xd60c('0x1c')],'id'),_0xd60c('0x1d'));return request({'uri':util[_0xd60c('0xf')](_0xd60c('0x1e'),_0x28d21f[_0xd60c('0x1f')]),'method':_0xd60c('0x20'),'body':_0x620c0c})[_0xd60c('0x21')](function(_0x41776b){logger[_0xd60c('0xc')](_0xd60c('0x22'));return _0x41776b;});}function getUser(_0x11700b,_0x324683){if(intUtil[_0xd60c('0x23')](_0x324683)){return request({'uri':util['format'](_0xd60c('0x24'),_0x11700b[_0xd60c('0x1f')]),'qs':{'email':_0x324683}})['then'](function(_0x1b1a24){if(_0x1b1a24[_0xd60c('0x25')]){logger[_0xd60c('0xc')](_0xd60c('0x26'));return _[_0xd60c('0x27')](_0x1b1a24,function(_0x50640b){return _0x50640b['contact'][_0xd60c('0x28')]===_0x324683;});}else{logger[_0xd60c('0xc')](_0xd60c('0x29'));return request({'uri':util[_0xd60c('0xf')](_0xd60c('0x2a'),_0x11700b['remoteUri'])})[_0xd60c('0x21')](function(_0x1374d4){logger[_0xd60c('0xc')]('Admin\x20account\x20selected.');return _0x1374d4;});}});}else{logger[_0xd60c('0xc')](_0xd60c('0x2b'));return request({'uri':util[_0xd60c('0xf')](_0xd60c('0x2a'),_0x11700b[_0xd60c('0x1f')])})[_0xd60c('0x21')](function(_0x41a592){logger[_0xd60c('0xc')]('Admin\x20account\x20selected.');return _0x41a592;});}}function getEndUser(_0x2fcb01,_0x111b70,_0x530db2){logger[_0xd60c('0xc')](_0xd60c('0x2c'),_0x530db2);return request({'uri':util[_0xd60c('0xf')](_0xd60c('0x2d'),_0x2fcb01[_0xd60c('0x1f')]),'qs':{'phone':_0x530db2}})[_0xd60c('0x21')](function(_0x19ddc6){if(_0x19ddc6[_0xd60c('0x25')]){logger[_0xd60c('0xc')]('Enduser\x20found!');return _[_0xd60c('0x27')](_0x19ddc6,{'phone':_0x530db2});}else{logger[_0xd60c('0xc')](_0xd60c('0x2e'));return request({'uri':util['format'](_0xd60c('0x2d'),_0x2fcb01[_0xd60c('0x1f')]),'method':_0xd60c('0x20'),'body':{'name':_0x111b70,'phone':_0x530db2}})[_0xd60c('0x21')](function(_0x5b2a08){logger[_0xd60c('0xc')](_0xd60c('0x2f'));return _0x5b2a08;});}});}function getAuth(_0x2840e2){return util['format'](_0xd60c('0x30'),new Buffer(_0x2840e2[_0xd60c('0x31')]+':X')[_0xd60c('0x32')](_0xd60c('0x33')));}function request(_0x894fee){logger[_0xd60c('0x34')](_0xd60c('0x35'),JSON[_0xd60c('0x36')](_0x894fee));return rp(_[_0xd60c('0x8')](_0x894fee,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4bb6bc,_0x20ea31){var _0x422680=[];if(_0x4bb6bc&&_0x4bb6bc[_0xd60c('0x25')]>0x0){_0x422680=_['map'](_0x4bb6bc,_0x20ea31);}return _0x422680;}function getCustomFields(_0x424bb0,_0xf017ef){var _0x549828=[];var _0x174403={'custom_fields':[]};if(_0x424bb0[_0xd60c('0x25')]>0x0){_[_0xd60c('0x37')](_0x424bb0,function(_0x5bf1d9){if(_[_0xd60c('0x38')]([_0xd60c('0x39'),_0xd60c('0x3a')],_0x5bf1d9['type'])&&_0x5bf1d9[_0xd60c('0x3b')]&&!_0x5bf1d9[_0xd60c('0x3c')]){_0x174403[_0x5bf1d9[_0xd60c('0x3b')]['toLowerCase']()]=_0x5bf1d9['content'][_0xd60c('0x32')]();}else if(_[_0xd60c('0x38')]([_0xd60c('0x39'),'picklist'],_0x5bf1d9[_0xd60c('0x3d')])&&_0x5bf1d9[_0xd60c('0x3e')]&&_0x5bf1d9['customField']){_0x174403['custom_fields']['push']({'id':_0x5bf1d9[_0xd60c('0x3e')],'value':_0x5bf1d9[_0xd60c('0x3f')]['toString']()});}else if(_0x5bf1d9['type']===_0xd60c('0x40')&&_0x5bf1d9[_0xd60c('0x41')]&&_0x5bf1d9[_0xd60c('0x3e')]&&_0x5bf1d9[_0xd60c('0x3c')]){_0xf017ef[_0x5bf1d9['variableName']]&&_0x174403[_0xd60c('0x1c')][_0xd60c('0x42')]({'id':_0x5bf1d9[_0xd60c('0x3e')],'value':_0xf017ef[_0x5bf1d9['variableName']]['toString']()});}else if(_0x5bf1d9['type']===_0xd60c('0x43')&&_0x5bf1d9[_0xd60c('0x44')]&&_0x5bf1d9[_0xd60c('0x44')][_0xd60c('0x18')]&&_0x5bf1d9['idField']&&_0x5bf1d9[_0xd60c('0x3c')]){_0xf017ef[_0x5bf1d9[_0xd60c('0x44')][_0xd60c('0x18')][_0xd60c('0x45')]()]&&_0x174403[_0xd60c('0x1c')][_0xd60c('0x42')]({'id':_0x5bf1d9['idField'],'value':_0xf017ef[_0x5bf1d9['Variable'][_0xd60c('0x18')]['toLowerCase']()][_0xd60c('0x32')]()});}});}return _0x174403;}exports[_0xd60c('0x46')]=function(_0x4a8239,_0x3bee3e,_0x30aeee,_0xbf3af5,_0x2dbc18,_0x533c19){var _0x296b96,_0x242fa3;_0x533c19['remoteUri']=intUtil[_0xd60c('0x47')](_0x533c19[_0xd60c('0x1f')]);_0x533c19['serverUrl']=intUtil[_0xd60c('0x47')](_0x533c19[_0xd60c('0x48')]);if(_0x2dbc18&&_0x2dbc18[_0xd60c('0x49')]){logger[_0xd60c('0xc')](_0xd60c('0x4a'),'Recording\x20is\x20enabled!');_0x3bee3e['recordingURL']=util[_0xd60c('0xf')](_0xd60c('0x4b'),_0x533c19['serverUrl'],_0x3bee3e['uniqueid'],md5(_0x3bee3e[_0xd60c('0x4c')]));}else{_0x3bee3e[_0xd60c('0x4d')]='';}headers['Authorization']=getAuth(_0x533c19);return getUser(_0x533c19,_0xbf3af5[_0xd60c('0x28')])[_0xd60c('0x21')](function(_0x19d6f9){_0x296b96=_0x19d6f9;logger[_0xd60c('0xc')](_0xd60c('0x4e'),_0x296b96['id']);return getEndUser(_0x533c19,_0x3bee3e[_0xd60c('0x11')],_0x3bee3e['calleridnum']);})[_0xd60c('0x21')](function(_0x49fc6d){_0x242fa3=_0x49fc6d;logger[_0xd60c('0xc')](_0xd60c('0x4f'),_0x242fa3['id']);return getTicket(_0x533c19,_0x296b96,_0x242fa3,_0x30aeee,_0x3bee3e);})['then'](function(_0x1a57b9){if(_0x1a57b9&&_0x1a57b9['id']){logger[_0xd60c('0xc')](_0xd60c('0x22'));logger[_0xd60c('0xc')](_0xd60c('0x50'),_0x1a57b9['id']);logger[_0xd60c('0xc')](_0xd60c('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd60c('0xf')]('user:%s',_0xbf3af5['name']),_0xd60c('0x51'),{'uri':util[_0xd60c('0xf')]('%s/helpdesk/tickets/%d',_0x533c19[_0xd60c('0x1f')],_0x1a57b9['id'])});}})[_0xd60c('0x52')](function(_0x1e93f3){logger['error']('[QUEUE]',JSON[_0xd60c('0x36')](_0x1e93f3));});};exports['outbound']=function(_0x35db3c,_0x2b7bd9,_0x438e48,_0x112ad2,_0x2b5de0,_0x3dc9d1,_0xd17ca4){var _0x26b3f6,_0x442e67;_0x3dc9d1[_0xd60c('0x1f')]=intUtil[_0xd60c('0x47')](_0x3dc9d1[_0xd60c('0x1f')]);_0x3dc9d1[_0xd60c('0x48')]=intUtil[_0xd60c('0x47')](_0x3dc9d1['serverUrl']);if(_0xd17ca4&&_0xd17ca4[_0xd60c('0x53')]&&_0xd17ca4['recordingFormat']!==_0xd60c('0x54')){logger['info'](_0xd60c('0x55'),_0xd60c('0x56'));_0x2b7bd9[_0xd60c('0x4d')]=util['format'](_0xd60c('0x4b'),_0x3dc9d1[_0xd60c('0x48')],_0x2b7bd9[_0xd60c('0x4c')],md5(_0x2b7bd9[_0xd60c('0x4c')]));}headers['Authorization']=getAuth(_0x3dc9d1);return getUser(_0x3dc9d1,_0x112ad2[_0xd60c('0x28')])[_0xd60c('0x21')](function(_0x177c48){_0x26b3f6=_0x177c48;logger['info'](_0xd60c('0x4e'),_0x26b3f6['id']);return getEndUser(_0x3dc9d1,_0x2b7bd9['destcalleridname'],_0x2b7bd9['destcalleridnum']);})[_0xd60c('0x21')](function(_0x149743){_0x442e67=_0x149743;logger[_0xd60c('0xc')]('The\x20Enduser\x20ID\x20is:',_0x442e67['id']);return getTicket(_0x3dc9d1,_0x26b3f6,_0x442e67,_0x438e48,_0x2b7bd9);})[_0xd60c('0x21')](function(_0x32822b){if(_0x32822b&&_0x32822b['id']){logger['info']('Ticket\x20created!');logger['info'](_0xd60c('0x50'),_0x32822b['id']);logger[_0xd60c('0xc')](_0xd60c('0x55'),_0xd60c('0x57'));emit(util[_0xd60c('0xf')]('user:%s',_0x112ad2[_0xd60c('0x18')]),_0xd60c('0x51'),{'uri':util['format'](_0xd60c('0x58'),_0x3dc9d1['remoteUri'],_0x32822b['id'])});}})[_0xd60c('0x52')](function(_0x58bc39){logger['error'](_0xd60c('0x55'),JSON['stringify'](_0x58bc39));});};exports[_0xd60c('0x59')]=function(_0x1208ee,_0x5ae9a7,_0x4cb845,_0x205c44,_0x5d3627,_0x2bfd23){var _0x137c98,_0x5b4eed;_0x2bfd23[_0xd60c('0x1f')]=intUtil[_0xd60c('0x47')](_0x2bfd23[_0xd60c('0x1f')]);_0x2bfd23['serverUrl']=intUtil[_0xd60c('0x47')](_0x2bfd23[_0xd60c('0x48')]);if(_0x5d3627&&_0x5d3627[_0xd60c('0x49')]){logger[_0xd60c('0xc')]('['+_0x5ae9a7[_0xd60c('0x5a')]['toUpperCase']()+']',_0xd60c('0x56'));_0x5ae9a7['recordingURL']=util['format'](_0xd60c('0x4b'),_0x2bfd23['serverUrl'],_0x5ae9a7[_0xd60c('0x4c')],md5(_0x5ae9a7[_0xd60c('0x4c')]));}else{_0x5ae9a7['recordingURL']='';}headers[_0xd60c('0x5b')]=getAuth(_0x2bfd23);return getUser(_0x2bfd23,'')[_0xd60c('0x21')](function(_0x4d91e1){_0x137c98=_0x4d91e1;logger[_0xd60c('0xc')]('The\x20User\x20ID\x20is:',_0x137c98['id']);return getEndUser(_0x2bfd23,_0x5ae9a7['calleridname'],_0x5ae9a7['calleridnum']);})['then'](function(_0x2af30e){_0x5b4eed=_0x2af30e;logger[_0xd60c('0xc')](_0xd60c('0x4f'),_0x5b4eed['id']);return getTicket(_0x2bfd23,_0x137c98,_0x5b4eed,_0x4cb845,_0x5ae9a7);})[_0xd60c('0x21')](function(_0x34bc36){if(_0x34bc36){logger[_0xd60c('0xc')](_0xd60c('0x22'));logger[_0xd60c('0xc')]('The\x20Ticket\x20ID\x20is:',_0x34bc36['id']);}})[_0xd60c('0x52')](function(_0x93ed2a){logger[_0xd60c('0x5c')]('['+_0x5ae9a7['lastevent'][_0xd60c('0x5d')]()+']',JSON[_0xd60c('0x36')](_0x93ed2a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index ba77204..1e8b801 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 _0x7652=['then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','catch','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','getString','Subjects','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','ticketId','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information'];(function(_0x465661,_0x150fd5){var _0x316de9=function(_0x21e996){while(--_0x21e996){_0x465661['push'](_0x465661['shift']());}};_0x316de9(++_0x150fd5);}(_0x7652,0xf2));var _0x2765=function(_0x85246a,_0x3407f1){_0x85246a=_0x85246a-0x0;var _0x337a3d=_0x7652[_0x85246a];return _0x337a3d;};'use strict';var _=require(_0x2765('0x0'));var rp=require('request-promise');var md5=require(_0x2765('0x1'));var util=require(_0x2765('0x2'));var moment=require(_0x2765('0x3'));var Promise=require(_0x2765('0x4'));var Redis=require(_0x2765('0x5'));var intUtil=require('./util');var config=require(_0x2765('0x6'));var logger=require(_0x2765('0x7'))(_0x2765('0x8'));config[_0x2765('0x9')]=_['defaults'](config[_0x2765('0x9')],{'host':_0x2765('0xa'),'port':0x18eb});var io=require(_0x2765('0xb'))(new Redis(config[_0x2765('0x9')]));function getAdminId(_0x56321e,_0x5dd391,_0x50d24d,_0x4fbfd3){return new Promise(function(_0x4e1c1a,_0x4133d6){var _0x3e146b=![];var _0x4cb485={'method':'GET','uri':_0x4fbfd3+_0x2765('0xc'),'json':!![]};_0x4cb485[_0x2765('0xd')]=_0x50d24d;logger[_0x2765('0xe')](_0x2765('0xf'));return rp(_0x4cb485)[_0x2765('0x10')](function(_0x5ae81c){if(_0x5ae81c){var _0x16fee0=_0x5ae81c[_0x2765('0x11')];var _0x281705=null;for(_0x281705=0x0;_0x281705<_0x16fee0[_0x2765('0x12')];_0x281705++){if(_0x16fee0[_0x281705][_0x2765('0x13')]===_0x56321e[_0x2765('0x14')]){_0x56321e[_0x2765('0x15')]=_0x16fee0[_0x281705]['id'];_0x3e146b=!![];}}if(_0x3e146b){logger[_0x2765('0xe')](_0x2765('0x16'),_0x56321e['adminId']);_0x4e1c1a(_0x56321e);}else{_0x4133d6({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4133d6({'statusCode':0x194,'message':_0x2765('0x17')});}})['catch'](function(_0x20b478){logger[_0x2765('0x18')]('['+[_0x5dd391[_0x2765('0x19')]()]+']',_0x20b478[_0x2765('0x1a')]);_0x4133d6(_0x20b478);});});}function getUser(_0x56eebc,_0x4f6d0f,_0x152599){return function(_0x16f6b7){return new Promise(function(_0xb1ceb0,_0xe75181){var _0x3c0029={'method':_0x2765('0x1b'),'uri':_0x152599+'/api/selector/owners','json':!![]};_0x3c0029[_0x2765('0xd')]=_0x4f6d0f;logger['info'](_0x2765('0x1c'));return rp(_0x3c0029)['then'](function(_0x11c13a){if(_0x11c13a){var _0x32de17=_0x11c13a[_0x2765('0x11')];var _0x9e35e0=![];var _0x23fed7=null;if(_0x16f6b7[_0x2765('0x1d')]!==null){logger[_0x2765('0xe')](_0x2765('0x1e'),_0x16f6b7['agentEmail']);_0x16f6b7[_0x2765('0x1f')]=_0x16f6b7[_0x2765('0x1d')];for(_0x23fed7=0x0;_0x23fed7<_0x32de17['length'];_0x23fed7++){if(_0x32de17[_0x23fed7][_0x2765('0x13')]===_0x16f6b7[_0x2765('0x1d')]){_0x9e35e0=!![];_0x16f6b7[_0x2765('0x20')]=_0x32de17[_0x23fed7]['id'];logger[_0x2765('0xe')](_0x2765('0x21'),_0x16f6b7[_0x2765('0x20')]);}}}if(!_0x9e35e0){logger['info'](_0x2765('0x22'));_0x16f6b7['userEmail']=_0x16f6b7[_0x2765('0x14')];_0x16f6b7['userId']=_0x16f6b7[_0x2765('0x15')];_0x9e35e0=!![];}if(_0x9e35e0){_0xb1ceb0(_0x16f6b7);}else{_0xe75181({'statusCode':0x194,'message':_0x2765('0x17')});}}else{_0xe75181({'statusCode':0x194,'message':_0x2765('0x17')});}})[_0x2765('0x23')](function(_0x456c22){logger[_0x2765('0x18')]('['+[_0x56eebc[_0x2765('0x19')]()]+']',_0x456c22[_0x2765('0x1a')]);_0xe75181(_0x456c22);});});};}function searchContact(_0x5a8049,_0x4d90ce,_0x10779b,_0x3e5e09){return new Promise(function(_0x30bc39,_0x50439){var _0x418c44={'method':_0x2765('0x1b'),'headers':_0x4d90ce,'uri':_0x5a8049+_0x2765('0x24')+_0x3e5e09+_0x2765('0x25')+_0x10779b+'&entities=contact','json':!![]};rp(_0x418c44)[_0x2765('0x10')](function(_0x633933){var _0x49c68b=_[_0x2765('0x26')](_0x633933[_0x2765('0x27')][_0x2765('0x27')],[_0x10779b,_0x3e5e09]);_0x30bc39(_0x49c68b);})['catch'](function(_0x4a2fd1){_0x50439(_0x4a2fd1);});});}function getEndUser(_0x54e08a,_0x219cac,_0x25730c){return function(_0x38920c){return new Promise(function(_0x360537,_0x14b143){logger[_0x2765('0xe')](util[_0x2765('0x28')](_0x2765('0x29'),_0x38920c['contactNumber']));searchContact(_0x25730c,_0x219cac,'mobile_number',_0x38920c[_0x2765('0x2a')])[_0x2765('0x10')](function(_0x133419){if(_0x133419){_0x38920c[_0x2765('0x2b')]=_0x133419['id'];logger[_0x2765('0xe')]('Contact\x20found\x20mobile_number:',_0x38920c['endUserId']);return _0x360537(_0x38920c);}searchContact(_0x25730c,_0x219cac,_0x2765('0x2c'),_0x38920c['contactNumber'])[_0x2765('0x10')](function(_0x6f6da6){if(_0x6f6da6){_0x38920c[_0x2765('0x2b')]=_0x6f6da6['id'];logger['info'](_0x2765('0x2d'),_0x38920c[_0x2765('0x2b')]);return _0x360537(_0x38920c);}createEndUser(_0x38920c,_0x54e08a,_0x219cac,_0x25730c)['then'](function(_0x37a321){logger[_0x2765('0xe')](_0x2765('0x2e'),_0x37a321[_0x2765('0x2b')]);return _0x360537(_0x37a321);});});})[_0x2765('0x23')](function(_0x3d09c5){_0x14b143(_0x3d09c5);});});};}function createEndUser(_0x3b69f0,_0x4af131,_0x5dc1eb,_0x4fcf19){return new Promise(function(_0x2a4422,_0x15c036){var _0x1beb4b=moment();var _0x551dac={'method':'POST','uri':_0x4fcf19+'/api/contacts','body':{'contact':{'last_name':_0x3b69f0[_0x2765('0x2a')],'work_number':_0x3b69f0[_0x2765('0x2a')],'mobile_number':_0x3b69f0[_0x2765('0x2a')],'owner_id':_0x3b69f0[_0x2765('0x20')],'created_at':_0x1beb4b[_0x2765('0x28')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x551dac[_0x2765('0xd')]=_0x5dc1eb;logger['info'](_0x2765('0x2f'));return rp(_0x551dac)[_0x2765('0x10')](function(_0x4be15a){_0x3b69f0[_0x2765('0x2b')]=_0x4be15a[_0x2765('0x30')]['id'];_0x2a4422(_0x3b69f0);})[_0x2765('0x23')](function(_0x2188ea){logger[_0x2765('0x18')]('['+[_0x4af131[_0x2765('0x19')]()]+']',_0x2188ea[_0x2765('0x1a')]);_0x15c036(_0x2188ea[_0x2765('0x1a')]);});});}function getTicket(_0x4b3fa6,_0x4e6d32,_0x9aca02,_0x36c031,_0x269368){return function(_0x3759e3){logger[_0x2765('0xe')](_0x2765('0x31'));return new Promise(function(_0x3f727e,_0x564af1){var _0x558aae=moment();var _0x2bca7a={'method':_0x2765('0x32'),'uri':_0x9aca02+'/api/tasks','body':{'title':intUtil[_0x2765('0x33')](_0x36c031[_0x2765('0x34')],_0x269368,'\x20'),'description':intUtil['getString'](_0x36c031[_0x2765('0x35')],_0x269368,'\x0a'),'owner_id':_0x3759e3[_0x2765('0x20')],'creater_id':_0x3759e3[_0x2765('0x15')],'targetable_id':_0x3759e3[_0x2765('0x2b')],'targetable_type':_0x2765('0x36'),'created_at':_0x558aae[_0x2765('0x28')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x558aae[_0x2765('0x37')](0x1e,'m')[_0x2765('0x28')](_0x2765('0x38'))},'json':!![]};_0x2bca7a[_0x2765('0xd')]=_0x4e6d32;return rp(_0x2bca7a)[_0x2765('0x10')](function(_0x517c43){_0x3759e3['ticketId']=_0x517c43[_0x2765('0x39')]['id'];logger['info'](_0x2765('0x3a'),_0x3759e3['ticketId']);_0x3f727e(_0x3759e3);})['catch'](function(_0x103f69){logger[_0x2765('0x18')]('['+[_0x4b3fa6[_0x2765('0x19')]()]+']',_0x103f69[_0x2765('0x1a')]);_0x564af1(_0x103f69[_0x2765('0x1a')]);});});};}function emit(_0x5b91be,_0x2f6ef2,_0xfd6e58){var _0x173b92={'uri':_0x5b91be+_0x2765('0x3b')+_0xfd6e58};io['to'](util['format']('user:%s',_0x2f6ef2))[_0x2765('0x3c')](_0x2765('0x3d'),_0x173b92);}exports['cs']=function(_0x82b259,_0x455408,_0x3f380f,_0x24dc68,_0x2d9bea,_0x2c0e93,_0x31d75d,_0x4dabcb){var _0x116923={};var _0x2f48b2={'Authorization':_0x2765('0x3e')+_0x2c0e93[_0x2765('0x3f')]};_0x2c0e93[_0x2765('0x40')]=intUtil[_0x2765('0x41')](_0x2c0e93[_0x2765('0x40')]);_0x2c0e93[_0x2765('0x42')]=intUtil[_0x2765('0x41')](_0x2c0e93[_0x2765('0x42')]);var _0x3811d8=_0x2c0e93['remoteUri'];_0x116923[_0x2765('0x14')]=_0x2c0e93[_0x2765('0x43')];_0x116923[_0x2765('0x2a')]=_0x4dabcb[_0x2765('0x44')]()==='outbound'?_0x455408[_0x2765('0x45')]:_0x455408[_0x2765('0x46')];_0x116923[_0x2765('0x47')]=_0x4dabcb==='queue'||_0x4dabcb==='unmanaged'?_0x2765('0x48'):_0x2765('0x49');if(_0x24dc68){_0x116923['agentEmail']=_0x24dc68[_0x2765('0x13')];}var _0xb7c133=util[_0x2765('0x28')](_0x2765('0x4a'),_0x2c0e93[_0x2765('0x42')],_0x455408[_0x2765('0x4b')],md5(_0x455408[_0x2765('0x4b')]));if(_0x2d9bea&&_0x2d9bea['monitor_format']){logger[_0x2765('0xe')](_0x2765('0x4c'),_0x2765('0x4d'));_0x455408[_0x2765('0x4e')]=_0xb7c133;}else if(_0x31d75d&&_0x31d75d[_0x2765('0x4f')]&&_0x31d75d[_0x2765('0x4f')]!==_0x2765('0x50')){logger[_0x2765('0xe')](_0x2765('0x51'),_0x2765('0x4d'));_0x455408[_0x2765('0x4e')]=_0xb7c133;}else{_0x455408[_0x2765('0x4e')]='';}return getAdminId(_0x116923,_0x4dabcb,_0x2f48b2,_0x3811d8)['then'](getUser(_0x4dabcb,_0x2f48b2,_0x3811d8))[_0x2765('0x10')](getEndUser(_0x4dabcb,_0x2f48b2,_0x3811d8))[_0x2765('0x10')](getTicket(_0x4dabcb,_0x2f48b2,_0x3811d8,_0x3f380f,_0x455408))[_0x2765('0x10')](function(_0x389c66){logger[_0x2765('0xe')](util[_0x2765('0x28')]('The\x20ticket\x20ID\x20is:\x20%s',_0x389c66[_0x2765('0x52')]));if(_0x4dabcb!==_0x2765('0x53')){logger[_0x2765('0xe')]('['+[_0x4dabcb[_0x2765('0x19')]()]+']',_0x2765('0x54'));emit(_0x3811d8,_0x24dc68[_0x2765('0x55')],_0x389c66[_0x2765('0x2b')]);}})['catch'](function(_0x8dee36){logger[_0x2765('0x18')]('['+[_0x4dabcb['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x8dee36,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4f2a=['Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','User\x20found:','Admin\x20selected','adminEmail','userId','catch','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Contact','add','ticketId','task','Task\x20created:','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET'];(function(_0x105713,_0x1cbf06){var _0x24f6fc=function(_0xf018a1){while(--_0xf018a1){_0x105713['push'](_0x105713['shift']());}};_0x24f6fc(++_0x1cbf06);}(_0x4f2a,0x1dc));var _0xa4f2=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x4f2a[_0x596f6e];return _0x1e0803;};'use strict';var _=require(_0xa4f2('0x0'));var rp=require(_0xa4f2('0x1'));var md5=require(_0xa4f2('0x2'));var util=require('util');var moment=require(_0xa4f2('0x3'));var Promise=require(_0xa4f2('0x4'));var Redis=require(_0xa4f2('0x5'));var intUtil=require(_0xa4f2('0x6'));var config=require(_0xa4f2('0x7'));var logger=require(_0xa4f2('0x8'))('freshsales');config['redis']=_[_0xa4f2('0x9')](config[_0xa4f2('0xa')],{'host':_0xa4f2('0xb'),'port':0x18eb});var io=require(_0xa4f2('0xc'))(new Redis(config[_0xa4f2('0xa')]));function getAdminId(_0x10d424,_0x2d812b,_0x1e8b16,_0x213366){return new Promise(function(_0x4744f4,_0x48950b){var _0x14b72a=![];var _0xc41a53={'method':'GET','uri':_0x213366+_0xa4f2('0xd'),'json':!![]};_0xc41a53[_0xa4f2('0xe')]=_0x1e8b16;logger[_0xa4f2('0xf')](_0xa4f2('0x10'));return rp(_0xc41a53)[_0xa4f2('0x11')](function(_0x1381c8){if(_0x1381c8){var _0x1ee82d=_0x1381c8[_0xa4f2('0x12')];var _0x905cb9=null;for(_0x905cb9=0x0;_0x905cb9<_0x1ee82d[_0xa4f2('0x13')];_0x905cb9++){if(_0x1ee82d[_0x905cb9][_0xa4f2('0x14')]===_0x10d424['adminEmail']){_0x10d424[_0xa4f2('0x15')]=_0x1ee82d[_0x905cb9]['id'];_0x14b72a=!![];}}if(_0x14b72a){logger[_0xa4f2('0xf')](_0xa4f2('0x16'),_0x10d424[_0xa4f2('0x15')]);_0x4744f4(_0x10d424);}else{_0x48950b({'statusCode':0x194,'message':_0xa4f2('0x17')});}}else{_0x48950b({'statusCode':0x194,'message':_0xa4f2('0x17')});}})['catch'](function(_0x3fe428){logger[_0xa4f2('0x18')]('['+[_0x2d812b[_0xa4f2('0x19')]()]+']',_0x3fe428[_0xa4f2('0x1a')]);_0x48950b(_0x3fe428);});});}function getUser(_0x4dbd94,_0x58fbc8,_0x3f017b){return function(_0x17a49b){return new Promise(function(_0xb9ac17,_0x19f59c){var _0x184671={'method':_0xa4f2('0x1b'),'uri':_0x3f017b+'/api/selector/owners','json':!![]};_0x184671[_0xa4f2('0xe')]=_0x58fbc8;logger[_0xa4f2('0xf')](_0xa4f2('0x1c'));return rp(_0x184671)[_0xa4f2('0x11')](function(_0x15efb4){if(_0x15efb4){var _0xfb3b0=_0x15efb4['users'];var _0x574c98=![];var _0x400872=null;if(_0x17a49b['agentEmail']!==null){logger[_0xa4f2('0xf')](_0xa4f2('0x1d'),_0x17a49b[_0xa4f2('0x1e')]);_0x17a49b['userEmail']=_0x17a49b[_0xa4f2('0x1e')];for(_0x400872=0x0;_0x400872<_0xfb3b0[_0xa4f2('0x13')];_0x400872++){if(_0xfb3b0[_0x400872]['email']===_0x17a49b['agentEmail']){_0x574c98=!![];_0x17a49b['userId']=_0xfb3b0[_0x400872]['id'];logger[_0xa4f2('0xf')](_0xa4f2('0x1f'),_0x17a49b['userId']);}}}if(!_0x574c98){logger['info'](_0xa4f2('0x20'));_0x17a49b['userEmail']=_0x17a49b[_0xa4f2('0x21')];_0x17a49b[_0xa4f2('0x22')]=_0x17a49b[_0xa4f2('0x15')];_0x574c98=!![];}if(_0x574c98){_0xb9ac17(_0x17a49b);}else{_0x19f59c({'statusCode':0x194,'message':_0xa4f2('0x17')});}}else{_0x19f59c({'statusCode':0x194,'message':_0xa4f2('0x17')});}})[_0xa4f2('0x23')](function(_0x572606){logger[_0xa4f2('0x18')]('['+[_0x4dbd94['toUpperCase']()]+']',_0x572606['message']);_0x19f59c(_0x572606);});});};}function searchContact(_0x980da1,_0x326668,_0x4206fe,_0x469c36){return new Promise(function(_0x16fcb7,_0x23b1f0){var _0x1b5a3a={'method':_0xa4f2('0x1b'),'headers':_0x326668,'uri':_0x980da1+'/api/lookup?q='+_0x469c36+_0xa4f2('0x24')+_0x4206fe+'&entities=contact','json':!![]};rp(_0x1b5a3a)['then'](function(_0x41e22b){var _0x527842=_['find'](_0x41e22b[_0xa4f2('0x25')][_0xa4f2('0x25')],[_0x4206fe,_0x469c36]);_0x16fcb7(_0x527842);})[_0xa4f2('0x23')](function(_0x51f3a1){_0x23b1f0(_0x51f3a1);});});}function getEndUser(_0x4f316c,_0x1f670f,_0x23bc51){return function(_0x23479e){return new Promise(function(_0x114a94,_0x10c015){logger[_0xa4f2('0xf')](util[_0xa4f2('0x26')](_0xa4f2('0x27'),_0x23479e['contactNumber']));searchContact(_0x23bc51,_0x1f670f,'mobile_number',_0x23479e[_0xa4f2('0x28')])[_0xa4f2('0x11')](function(_0x137f51){if(_0x137f51){_0x23479e[_0xa4f2('0x29')]=_0x137f51['id'];logger['info'](_0xa4f2('0x2a'),_0x23479e[_0xa4f2('0x29')]);return _0x114a94(_0x23479e);}searchContact(_0x23bc51,_0x1f670f,'work_number',_0x23479e['contactNumber'])[_0xa4f2('0x11')](function(_0x3dc5bb){if(_0x3dc5bb){_0x23479e[_0xa4f2('0x29')]=_0x3dc5bb['id'];logger[_0xa4f2('0xf')](_0xa4f2('0x2b'),_0x23479e[_0xa4f2('0x29')]);return _0x114a94(_0x23479e);}createEndUser(_0x23479e,_0x4f316c,_0x1f670f,_0x23bc51)[_0xa4f2('0x11')](function(_0x3c7aba){logger[_0xa4f2('0xf')](_0xa4f2('0x2c'),_0x3c7aba[_0xa4f2('0x29')]);return _0x114a94(_0x3c7aba);});});})['catch'](function(_0x555ce5){_0x10c015(_0x555ce5);});});};}function createEndUser(_0x53603d,_0x7b1d10,_0x56af21,_0x2fcb67){return new Promise(function(_0x24c984,_0x5c6d89){var _0x492a84=moment();var _0x568381={'method':_0xa4f2('0x2d'),'uri':_0x2fcb67+'/api/contacts','body':{'contact':{'last_name':_0x53603d[_0xa4f2('0x28')],'work_number':_0x53603d['contactNumber'],'mobile_number':_0x53603d['contactNumber'],'owner_id':_0x53603d[_0xa4f2('0x22')],'created_at':_0x492a84['format'](_0xa4f2('0x2e'))}},'json':!![]};_0x568381['headers']=_0x56af21;logger['info'](_0xa4f2('0x2f'));return rp(_0x568381)[_0xa4f2('0x11')](function(_0x766898){_0x53603d[_0xa4f2('0x29')]=_0x766898[_0xa4f2('0x30')]['id'];_0x24c984(_0x53603d);})[_0xa4f2('0x23')](function(_0x6c50bf){logger['error']('['+[_0x7b1d10[_0xa4f2('0x19')]()]+']',_0x6c50bf[_0xa4f2('0x1a')]);_0x5c6d89(_0x6c50bf[_0xa4f2('0x1a')]);});});}function getTicket(_0x4b87d8,_0x49963a,_0x9cfe73,_0x423ade,_0x474565){return function(_0x1b3a0d){logger[_0xa4f2('0xf')](_0xa4f2('0x31'));return new Promise(function(_0x891cd5,_0x396de0){var _0x551abe=moment();var _0x15cafb={'method':_0xa4f2('0x2d'),'uri':_0x9cfe73+_0xa4f2('0x32'),'body':{'title':intUtil['getString'](_0x423ade[_0xa4f2('0x33')],_0x474565,'\x20'),'description':intUtil[_0xa4f2('0x34')](_0x423ade['Descriptions'],_0x474565,'\x0a'),'owner_id':_0x1b3a0d[_0xa4f2('0x22')],'creater_id':_0x1b3a0d[_0xa4f2('0x15')],'targetable_id':_0x1b3a0d[_0xa4f2('0x29')],'targetable_type':_0xa4f2('0x35'),'created_at':_0x551abe[_0xa4f2('0x26')](_0xa4f2('0x2e')),'due_date':_0x551abe[_0xa4f2('0x36')](0x1e,'m')[_0xa4f2('0x26')](_0xa4f2('0x2e'))},'json':!![]};_0x15cafb[_0xa4f2('0xe')]=_0x49963a;return rp(_0x15cafb)[_0xa4f2('0x11')](function(_0x1dc771){_0x1b3a0d[_0xa4f2('0x37')]=_0x1dc771[_0xa4f2('0x38')]['id'];logger[_0xa4f2('0xf')](_0xa4f2('0x39'),_0x1b3a0d[_0xa4f2('0x37')]);_0x891cd5(_0x1b3a0d);})[_0xa4f2('0x23')](function(_0x2d379a){logger[_0xa4f2('0x18')]('['+[_0x4b87d8['toUpperCase']()]+']',_0x2d379a[_0xa4f2('0x1a')]);_0x396de0(_0x2d379a[_0xa4f2('0x1a')]);});});};}function emit(_0x283350,_0x42a17a,_0x5f5d84){var _0x6f0edd={'uri':_0x283350+_0xa4f2('0x3a')+_0x5f5d84};io['to'](util[_0xa4f2('0x26')]('user:%s',_0x42a17a))['emit'](_0xa4f2('0x3b'),_0x6f0edd);}exports['cs']=function(_0x4052c4,_0x32ae2c,_0x493035,_0x22ed37,_0x404e02,_0x105834,_0x4665d4,_0x2f578f){var _0x3cf3be={};var _0x2197d4={'Authorization':_0xa4f2('0x3c')+_0x105834[_0xa4f2('0x3d')]};_0x105834[_0xa4f2('0x3e')]=intUtil[_0xa4f2('0x3f')](_0x105834['remoteUri']);_0x105834[_0xa4f2('0x40')]=intUtil[_0xa4f2('0x3f')](_0x105834[_0xa4f2('0x40')]);var _0x455d92=_0x105834[_0xa4f2('0x3e')];_0x3cf3be[_0xa4f2('0x21')]=_0x105834[_0xa4f2('0x41')];_0x3cf3be['contactNumber']=_0x2f578f[_0xa4f2('0x42')]()===_0xa4f2('0x43')?_0x32ae2c[_0xa4f2('0x44')]:_0x32ae2c[_0xa4f2('0x45')];_0x3cf3be[_0xa4f2('0x46')]=_0x2f578f===_0xa4f2('0x47')||_0x2f578f==='unmanaged'?'queue':'outbound';if(_0x22ed37){_0x3cf3be[_0xa4f2('0x1e')]=_0x22ed37['email'];}var _0x1d2c5b=util[_0xa4f2('0x26')](_0xa4f2('0x48'),_0x105834['serverUrl'],_0x32ae2c[_0xa4f2('0x49')],md5(_0x32ae2c[_0xa4f2('0x49')]));if(_0x404e02&&_0x404e02['monitor_format']){logger['info'](_0xa4f2('0x4a'),_0xa4f2('0x4b'));_0x32ae2c['recordingURL']=_0x1d2c5b;}else if(_0x4665d4&&_0x4665d4[_0xa4f2('0x4c')]&&_0x4665d4['recordingFormat']!=='none'){logger[_0xa4f2('0xf')](_0xa4f2('0x4d'),_0xa4f2('0x4b'));_0x32ae2c[_0xa4f2('0x4e')]=_0x1d2c5b;}else{_0x32ae2c['recordingURL']='';}return getAdminId(_0x3cf3be,_0x2f578f,_0x2197d4,_0x455d92)[_0xa4f2('0x11')](getUser(_0x2f578f,_0x2197d4,_0x455d92))[_0xa4f2('0x11')](getEndUser(_0x2f578f,_0x2197d4,_0x455d92))[_0xa4f2('0x11')](getTicket(_0x2f578f,_0x2197d4,_0x455d92,_0x493035,_0x32ae2c))[_0xa4f2('0x11')](function(_0x5f4067){logger['info'](util['format'](_0xa4f2('0x4f'),_0x5f4067[_0xa4f2('0x37')]));if(_0x2f578f!=='unmanaged'){logger['info']('['+[_0x2f578f[_0xa4f2('0x19')]()]+']',_0xa4f2('0x50'));emit(_0x455d92,_0x22ed37[_0xa4f2('0x51')],_0x5f4067[_0xa4f2('0x29')]);}})['catch'](function(_0x3d01f4){logger[_0xa4f2('0x18')]('['+[_0x2f578f['toUpperCase']()]+_0xa4f2('0x52'),util[_0xa4f2('0x53')](_0x3d01f4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index d69d9be..bf70e03 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 _0xf777=['freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound','EVENT\x20UNKNOWN','salesforce','desk','log','unknown\x20integration','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','data3','error','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','vtiger','dynamics365'];(function(_0x13eaae,_0x11ec0a){var _0x4493db=function(_0xf9d8b1){while(--_0xf9d8b1){_0x13eaae['push'](_0x13eaae['shift']());}};_0x4493db(++_0x11ec0a);}(_0xf777,0x180));var _0x7f77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf777[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var zendesk=require(_0x7f77('0x2'));var salesforce=require(_0x7f77('0x3'));var sugarcrm=require(_0x7f77('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x7f77('0x5'));var desk=require('./desk');var vtiger=require(_0x7f77('0x6'));var servicenow=require(_0x7f77('0x7'));var dynamics365=require(_0x7f77('0x8'));var freshsales=require(_0x7f77('0x9'));var integrations=[_0x7f77('0xa'),'salesforce',_0x7f77('0xb'),_0x7f77('0xc'),_0x7f77('0xd'),'desk',_0x7f77('0xe'),_0x7f77('0xf'),_0x7f77('0x10'),_0x7f77('0x11')];exports[_0x7f77('0x12')]=function(_0x1a90d0,_0x598af3,_0x197ceb,_0x5abde3,_0x254ed9,_0x478468){if(_0x197ceb){if(_[_0x7f77('0x13')](integrations,_0x1a90d0[_0x7f77('0x14')][_0x7f77('0x15')]())){try{var _0x236565=null;var _0xe0e471='';var _0x2d7951=_0x197ceb[_0x1a90d0[_0x7f77('0x14')][_0x7f77('0x15')]()];if(_0x2d7951){var _0x35aa01=_0x2d7951[_0x1a90d0[_0x7f77('0x16')]];if(_0x35aa01){var _0x1c2f5b=_[_0x7f77('0x17')](_0x35aa01[_0x7f77('0x18')],{'id':parseInt(_0x1a90d0['data3'],0xa)});if(_0x1c2f5b){if(_0x5abde3){if(_0x254ed9&&_0x598af3[_0x7f77('0x19')]){_0xe0e471=_0x7f77('0x19');}else if(_0x598af3[_0x7f77('0x1a')]){_0xe0e471=_0x7f77('0x1b');}else{console['log'](_0x7f77('0x1c'),_0x598af3);}}else{_0xe0e471='unmanaged';}switch(_0x1a90d0[_0x7f77('0x14')][_0x7f77('0x15')]()){case _0x7f77('0xa'):zendesk[_0xe0e471](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468);break;case _0x7f77('0x1d'):salesforce[_0xe0e471](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468);break;case'sugarcrm':sugarcrm[_0xe0e471](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468);break;case _0x7f77('0xc'):freshdesk[_0xe0e471](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468);break;case _0x7f77('0xd'):zoho[_0xe0e471](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468);break;case _0x7f77('0x1e'):desk[_0xe0e471](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468);break;case'vtiger':vtiger[_0xe0e471](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468);break;case _0x7f77('0x10'):freshsales['cs'](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468,_0xe0e471);break;case'servicenow':servicenow['cs'](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468,_0xe0e471);break;case'dynamics365':dynamics365['cs'](_0x1a90d0,_0x598af3,_0x1c2f5b,_0x5abde3,_0x254ed9,_0x35aa01,_0x478468,_0xe0e471);break;default:console[_0x7f77('0x1f')](_0x7f77('0x20'));}}else{_0x236565=require(_0x7f77('0x21'))(_0x1a90d0['data1'][_0x7f77('0x15')]());_0x236565['error'](_0x7f77('0x22'),util['format'](_0x7f77('0x23'),_0x1a90d0[_0x7f77('0x14')][_0x7f77('0x15')](),_0x1a90d0[_0x7f77('0x24')]));}}else{_0x236565=require(_0x7f77('0x21'))(_0x1a90d0['data1'][_0x7f77('0x15')]());_0x236565[_0x7f77('0x25')](_0x7f77('0x22'),util[_0x7f77('0x26')](_0x7f77('0x27'),_0x1a90d0['data1'][_0x7f77('0x15')](),_0x1a90d0[_0x7f77('0x16')]));}}else{}}catch(_0x463ca7){console[_0x7f77('0x25')](_0x463ca7);}}}}; \ No newline at end of file +var _0x8405=['freshsales','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','outbound','log','unmanaged','desk','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','error','lodash','util','./zendesk','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','zoho','vtiger','dynamics365'];(function(_0x1d5320,_0x4597af){var _0x82303b=function(_0x4e9b28){while(--_0x4e9b28){_0x1d5320['push'](_0x1d5320['shift']());}};_0x82303b(++_0x4597af);}(_0x8405,0x85));var _0x5840=function(_0x2d1705,_0x4b9834){_0x2d1705=_0x2d1705-0x0;var _0x24e7bf=_0x8405[_0x2d1705];return _0x24e7bf;};'use strict';var _=require(_0x5840('0x0'));var util=require(_0x5840('0x1'));var zendesk=require(_0x5840('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x5840('0x3'));var freshdesk=require(_0x5840('0x4'));var zoho=require('./zoho');var desk=require(_0x5840('0x5'));var vtiger=require(_0x5840('0x6'));var servicenow=require(_0x5840('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x5840('0x8'));var integrations=[_0x5840('0x9'),_0x5840('0xa'),_0x5840('0xb'),'freshdesk',_0x5840('0xc'),'desk',_0x5840('0xd'),_0x5840('0xe'),_0x5840('0xf'),'servicenow'];exports[_0x5840('0x10')]=function(_0x3b6e43,_0x2a0ed2,_0x316017,_0x4aac2,_0x4c52d1,_0x19027a){if(_0x316017){if(_[_0x5840('0x11')](integrations,_0x3b6e43[_0x5840('0x12')][_0x5840('0x13')]())){try{var _0x37ec6c=null;var _0x21a527='';var _0x2a7f39=_0x316017[_0x3b6e43['data1']['toLowerCase']()];if(_0x2a7f39){var _0x46f737=_0x2a7f39[_0x3b6e43['data2']];if(_0x46f737){var _0x229565=_[_0x5840('0x14')](_0x46f737[_0x5840('0x15')],{'id':parseInt(_0x3b6e43[_0x5840('0x16')],0xa)});if(_0x229565){if(_0x4aac2){if(_0x4c52d1&&_0x2a0ed2[_0x5840('0x17')]){_0x21a527=_0x5840('0x17');}else if(_0x2a0ed2['routeId']){_0x21a527=_0x5840('0x18');}else{console[_0x5840('0x19')]('EVENT\x20UNKNOWN',_0x2a0ed2);}}else{_0x21a527=_0x5840('0x1a');}switch(_0x3b6e43[_0x5840('0x12')][_0x5840('0x13')]()){case'zendesk':zendesk[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0xa'):salesforce[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case'sugarcrm':sugarcrm[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case'freshdesk':freshdesk[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0xc'):zoho[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0x1b'):desk[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0xd'):vtiger[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0xf'):freshsales['cs'](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a,_0x21a527);break;case _0x5840('0x1c'):servicenow['cs'](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a,_0x21a527);break;case'dynamics365':dynamics365['cs'](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a,_0x21a527);break;default:console[_0x5840('0x19')](_0x5840('0x1d'));}}else{_0x37ec6c=require(_0x5840('0x1e'))(_0x3b6e43['data1'][_0x5840('0x13')]());_0x37ec6c['error'](_0x5840('0x1f'),util[_0x5840('0x20')](_0x5840('0x21'),_0x3b6e43[_0x5840('0x12')][_0x5840('0x13')](),_0x3b6e43[_0x5840('0x16')]));}}else{_0x37ec6c=require(_0x5840('0x1e'))(_0x3b6e43['data1']['toLowerCase']());_0x37ec6c['error'](_0x5840('0x1f'),util[_0x5840('0x20')](_0x5840('0x22'),_0x3b6e43[_0x5840('0x12')][_0x5840('0x13')](),_0x3b6e43[_0x5840('0x23')]));}}else{}}catch(_0x523f40){console[_0x5840('0x24')](_0x523f40);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index cfb14e4..bee83c8 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 _0xf39b=['additionalSearchAccount','Account','execute','Lead','Phone','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','LastName','','Company','No\x20Company','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','Connection','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','newTab','user:%s','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','remoteUri','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','instanceUrl','[OUTBOUND]','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsRecurrence','contact','endUserType','WhatId','Case','account','AccountId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','length','find','Email','info','Agent\x20%s\x20found.','resolve','Name','identity','then','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','Contact','additionalSearchLead','$or','account_contact_lead','cloneDeep'];(function(_0xf979b6,_0x53314){var _0x2711f0=function(_0x370797){while(--_0x370797){_0xf979b6['push'](_0xf979b6['shift']());}};_0x2711f0(++_0x53314);}(_0xf39b,0xc4));var _0xbf39=function(_0x4d4cda,_0x98a46f){_0x4d4cda=_0x4d4cda-0x0;var _0x4d9f5e=_0xf39b[_0x4d4cda];return _0x4d9f5e;};'use strict';var _=require(_0xbf39('0x0'));var rp=require(_0xbf39('0x1'));var moment=require(_0xbf39('0x2'));var BPromise=require(_0xbf39('0x3'));var md5=require(_0xbf39('0x4'));var jsforce=require('jsforce');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xbf39('0x5'));var config=require(_0xbf39('0x6'));var logger=require(_0xbf39('0x7'))(_0xbf39('0x8'));config[_0xbf39('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbf39('0xa'))(new Redis(config[_0xbf39('0x9')]));function emit(_0x43f7fc,_0x2e704a,_0x5e0f1a){io['to'](_0x43f7fc)[_0xbf39('0xb')](_0x2e704a,_0x5e0f1a);}function getTicket(_0x393c7d,_0x5722ed,_0x200470,_0x4b7773,_0x5784db,_0x815ba0,_0xf4a0a2,_0x47332a){var _0x3b6ed0=Object[_0xbf39('0xc')]({},{'OwnerId':_0x5722ed['id'],'Subject':intUtil[_0xbf39('0xd')](_0x4b7773[_0xbf39('0xe')],_0x5784db,'\x20'),'Description':intUtil[_0xbf39('0xd')](_0x4b7773[_0xbf39('0xf')],_0x5784db,'\x0a')},getCustomFields(_0x815ba0,_0x5784db));if(_0x200470){if(_0x4b7773[_0xbf39('0x10')]==='Task'){_0x3b6ed0[_0xbf39('0x11')]=moment[_0xbf39('0x12')]();_0x3b6ed0['IsReminderSet']=![];_0x3b6ed0[_0xbf39('0x13')]=![];if(_0x200470['endUserType']===_0xbf39('0x14')||_0x200470[_0xbf39('0x15')]==='lead'){_0x3b6ed0['WhoId']=_0x200470['id'];}else if(_0x200470['endUserType']==='account'){_0x3b6ed0[_0xbf39('0x16')]=_0x200470['id'];}}else if(_0x4b7773[_0xbf39('0x10')]===_0xbf39('0x17')){if(_0x200470['endUserType']==='contact'){_0x3b6ed0['ContactId']=_0x200470['id'];}else if(_0x200470[_0xbf39('0x15')]===_0xbf39('0x18')){_0x3b6ed0[_0xbf39('0x19')]=_0x200470['id'];}else if(_0x200470[_0xbf39('0x15')]===_0xbf39('0x1a')&&_0x4b7773[_0xbf39('0x1b')]){_0x3b6ed0[_0x4b7773[_0xbf39('0x1b')]]=_0x200470['id'];}else{logger['info'](_0xbf39('0x1c'));}}}return _0xf4a0a2[_0xbf39('0x1d')](_0x4b7773['ticketType'])[_0xbf39('0x1e')](_0x3b6ed0);}function getUser(_0x5f3fc6,_0x1abcc1,_0xcb4869){if(!_[_0xbf39('0x1f')](_0x1abcc1)&&intUtil[_0xbf39('0x20')](_0x1abcc1)){var _0x5d70b4={'Email':_0x1abcc1};var _0x492fe9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xcb4869[_0xbf39('0x1d')](_0xbf39('0x21'))['find'](_0x5d70b4,_0x492fe9)['execute']()['then'](function(_0x20bbe6){if(_0x20bbe6[_0xbf39('0x22')]){var _0x122972=_[_0xbf39('0x23')](_0x20bbe6,function(_0x39086c){return _0x39086c[_0xbf39('0x24')]===_0x1abcc1;});if(_0x122972){logger[_0xbf39('0x25')](_0xbf39('0x26'),_0x1abcc1);return BPromise[_0xbf39('0x27')]({'id':_0x122972['Id'],'name':_0x122972[_0xbf39('0x28')]});}}else{logger[_0xbf39('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1abcc1);return _0xcb4869[_0xbf39('0x29')]()[_0xbf39('0x2a')](function(_0xfc910b){return BPromise[_0xbf39('0x27')]({'id':_0xfc910b['user_id'],'name':_0xfc910b[_0xbf39('0x2b')]});});}});}else{logger[_0xbf39('0x25')](_0xbf39('0x2c'),_0x1abcc1);return _0xcb4869['identity']()[_0xbf39('0x2a')](function(_0x452982){return BPromise[_0xbf39('0x27')]({'id':_0x452982[_0xbf39('0x2d')],'name':_0x452982[_0xbf39('0x2b')]});});}}function getEndUser(_0x28e727,_0x116d0b,_0x2c01e8,_0x156995,_0x4466b4){var _0x596c48={'$or':{'Phone':_0x156995}};var _0x4a4b52={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbf39('0x27')]()['then'](function(){logger[_0xbf39('0x25')](_0xbf39('0x2e'),_0x156995,_0x116d0b[_0xbf39('0x2f')]);switch(_0x116d0b['moduleSearch']){case _0xbf39('0x30'):var _0x1fff16=_['cloneDeep'](_0x596c48);if(_0x116d0b[_0xbf39('0x31')]){var _0x230400={};_0x230400[_0x116d0b[_0xbf39('0x31')]]=_0x156995;_[_0xbf39('0x32')](_0x1fff16['$or'],_0x230400);}return _0x4466b4[_0xbf39('0x1d')](_0xbf39('0x33'))[_0xbf39('0x23')](_0x1fff16,_0x4a4b52)['execute']()['then'](function(_0x53dba2){if(_0x53dba2&&_0x53dba2[_0xbf39('0x22')]){return _0x53dba2;}else{var _0x6a3e0c=_['cloneDeep'](_0x596c48);if(_0x116d0b['additionalSearchLead']){var _0x2a0877={};_0x2a0877[_0x116d0b[_0xbf39('0x34')]]=_0x156995;_[_0xbf39('0x32')](_0x6a3e0c[_0xbf39('0x35')],_0x2a0877);}return _0x4466b4[_0xbf39('0x1d')]('Lead')[_0xbf39('0x23')](_0x6a3e0c,_0x4a4b52);}});case _0xbf39('0x36'):var _0x32b2e0=_[_0xbf39('0x37')](_0x596c48);if(_0x116d0b['additionalSearchAccount']){var _0x230400={};_0x230400[_0x116d0b[_0xbf39('0x38')]]=_0x156995;_[_0xbf39('0x32')](_0x32b2e0[_0xbf39('0x35')],_0x230400);}return _0x4466b4[_0xbf39('0x1d')](_0xbf39('0x39'))[_0xbf39('0x23')](_0x32b2e0,_0x4a4b52)[_0xbf39('0x3a')]()[_0xbf39('0x2a')](function(_0x201309){if(_0x201309&&_0x201309[_0xbf39('0x22')]){return _0x201309;}else{var _0x573ac9=_[_0xbf39('0x37')](_0x596c48);if(_0x116d0b['additionalSearchContact']){var _0x443b53={};_0x443b53[_0x116d0b['additionalSearchContact']]=_0x156995;_[_0xbf39('0x32')](_0x573ac9[_0xbf39('0x35')],_0x443b53);}return _0x4466b4[_0xbf39('0x1d')]('Contact')[_0xbf39('0x23')](_0x573ac9,_0x4a4b52)[_0xbf39('0x2a')](function(_0x3d636e){if(_0x3d636e&&_0x3d636e[_0xbf39('0x22')]){return _0x3d636e;}else{var _0xc1a16e=_['cloneDeep'](_0x596c48);if(_0x116d0b['additionalSearchLead']){var _0x4dbb22={};_0x4dbb22[_0x116d0b[_0xbf39('0x34')]]=_0x156995;_['merge'](_0xc1a16e[_0xbf39('0x35')],_0x4dbb22);}return _0x4466b4[_0xbf39('0x1d')]('Lead')[_0xbf39('0x23')](_0xc1a16e,_0x4a4b52);}});}});case _0xbf39('0x14'):var _0x1fff16=_[_0xbf39('0x37')](_0x596c48);if(_0x116d0b[_0xbf39('0x31')]){var _0x230400={};_0x230400[_0x116d0b[_0xbf39('0x31')]]=_0x156995;_[_0xbf39('0x32')](_0x1fff16[_0xbf39('0x35')],_0x230400);}return _0x4466b4['sobject'](_0xbf39('0x33'))[_0xbf39('0x23')](_0x1fff16,_0x4a4b52)['execute']();case _0xbf39('0x1a'):var _0x73999d=_[_0xbf39('0x37')](_0x596c48);if(_0x116d0b[_0xbf39('0x34')]){var _0x230400={};_0x230400[_0x116d0b['additionalSearchLead']]=_0x156995;_[_0xbf39('0x32')](_0x73999d[_0xbf39('0x35')],_0x230400);}return _0x4466b4['sobject'](_0xbf39('0x3b'))[_0xbf39('0x23')](_0x73999d,_0x4a4b52);case _0xbf39('0x18'):var _0x32b2e0=_[_0xbf39('0x37')](_0x596c48);if(_0x116d0b['additionalSearchAccount']){var _0x230400={};_0x230400[_0x116d0b[_0xbf39('0x38')]]=_0x156995;_[_0xbf39('0x32')](_0x32b2e0['$or'],_0x230400);}return _0x4466b4[_0xbf39('0x1d')](_0xbf39('0x39'))['find'](_0x32b2e0,_0x4a4b52);default:return null;}})[_0xbf39('0x2a')](function(_0x3904e1){if(_0x3904e1&&_0x3904e1['length']){var _0x43bc1b=_['first'](_0x3904e1);if(_0x43bc1b){return BPromise['resolve']({'id':_0x43bc1b['Id'],'name':_0x43bc1b['Name'],'phone':_0x43bc1b[_0xbf39('0x3c')],'endUserType':_0x43bc1b['attributes']['type'][_0xbf39('0x3d')]()});}}})[_0xbf39('0x2a')](function(_0x58e246){if(_0x58e246){logger[_0xbf39('0x25')](_0xbf39('0x3e'),_0x58e246[_0xbf39('0x15')],_0x156995);return BPromise['resolve'](_0x58e246);}else{logger[_0xbf39('0x25')](_0xbf39('0x3f'),_0x156995);var _0x277ef8={'Phone':_0x156995};if(_0x116d0b['moduleCreate']){if(_0x116d0b[_0xbf39('0x40')]===_0xbf39('0x14')){logger[_0xbf39('0x25')](_0xbf39('0x41'),_0x156995,_0x116d0b[_0xbf39('0x40')]);_0x277ef8['LastName']=_0x2c01e8!==''?_0x2c01e8:util[_0xbf39('0x42')](_0xbf39('0x43'),_0x156995);}else if(_0x116d0b['moduleCreate']===_0xbf39('0x1a')){logger['info'](_0xbf39('0x41'),_0x156995,_0x116d0b[_0xbf39('0x40')]);_0x277ef8[_0xbf39('0x44')]=_0x2c01e8!==_0xbf39('0x45')?_0x2c01e8:util['format'](_0xbf39('0x43'),_0x156995);_0x277ef8[_0xbf39('0x46')]=_0xbf39('0x47');}else if(_0x116d0b[_0xbf39('0x40')]===_0xbf39('0x18')){logger['info'](_0xbf39('0x41'),_0x156995,_0x116d0b[_0xbf39('0x40')]);_0x277ef8[_0xbf39('0x28')]=_0x2c01e8!==''?_0x2c01e8:util[_0xbf39('0x42')](_0xbf39('0x43'),_0x156995);}else{return null;}}return _0x4466b4['sobject'](_['upperFirst'](_0x116d0b['moduleCreate']))[_0xbf39('0x1e')](_0x277ef8)[_0xbf39('0x2a')](function(_0x422fe5){return BPromise[_0xbf39('0x27')]({'id':_0x422fe5['id'],'endUserType':_0x116d0b[_0xbf39('0x40')]});});}});}function getCustomFields(_0x596628,_0x44eb93){var _0x16cbda={};if(_0x596628[_0xbf39('0x22')]>0x0){_[_0xbf39('0x48')](_0x596628,function(_0xcca65){if(_[_0xbf39('0x49')](['string',_0xbf39('0x4a')],_0xcca65[_0xbf39('0x4b')])&&_0xcca65[_0xbf39('0x4c')]){_0x16cbda[_0xcca65[_0xbf39('0x4c')]]=_0xcca65[_0xbf39('0x4d')][_0xbf39('0x4e')]();}else if(_0xcca65[_0xbf39('0x4b')]===_0xbf39('0x4f')&&_0xcca65[_0xbf39('0x50')]&&_0xcca65[_0xbf39('0x4c')]){_0x44eb93[_0xcca65['variableName']]&&(_0x16cbda[_0xcca65[_0xbf39('0x4c')]]=_0x44eb93[_0xcca65[_0xbf39('0x50')]][_0xbf39('0x4e')]());}else if(_0xcca65[_0xbf39('0x4b')]===_0xbf39('0x51')&&_0xcca65['Variable']&&_0xcca65[_0xbf39('0x52')][_0xbf39('0x53')]&&_0xcca65[_0xbf39('0x4c')]){_0x44eb93[_0xcca65[_0xbf39('0x52')][_0xbf39('0x53')]['toLowerCase']()]&&(_0x16cbda[_0xcca65[_0xbf39('0x4c')]]=_0x44eb93[_0xcca65['Variable'][_0xbf39('0x53')][_0xbf39('0x3d')]()][_0xbf39('0x4e')]());}});}return _0x16cbda;}function getConnection(_0x486488){var _0x294ca6=_0x486488[_0xbf39('0x54')]['concat'](_0x486488['securityToken']);var _0xe8e67b=new jsforce[(_0xbf39('0x55'))]({'oauth2':{'loginUrl':_0x486488['remoteUri']||_0xbf39('0x56'),'clientId':_0x486488[_0xbf39('0x57')],'clientSecret':_0x486488[_0xbf39('0x58')]}});return _0xe8e67b['login'](_0x486488[_0xbf39('0x59')],_0x294ca6)[_0xbf39('0x2a')](function(){logger[_0xbf39('0x25')](_0xbf39('0x5a'));return _0xe8e67b;});}exports['queue']=function(_0x58ba61,_0x29ecae,_0x504703,_0x2eb44b,_0x3981f9,_0x48cd8c){var _0x56bb78,_0x35118a,_0x4013f6,_0x50cc3c;_0x48cd8c[_0xbf39('0x5b')]=intUtil['stripTrailingSlash'](_0x48cd8c[_0xbf39('0x5b')]);_0x48cd8c['remoteUri']=intUtil[_0xbf39('0x5c')](_0x48cd8c['remoteUri']);if(_0x3981f9&&_0x3981f9[_0xbf39('0x5d')]){logger[_0xbf39('0x25')](_0xbf39('0x5e'),_0xbf39('0x5f'));_0x29ecae['recordingURL']=util['format'](_0xbf39('0x60'),_0x48cd8c[_0xbf39('0x5b')],_0x29ecae[_0xbf39('0x61')],md5(_0x29ecae[_0xbf39('0x61')]));}else{_0x29ecae[_0xbf39('0x62')]='';}return getConnection(_0x48cd8c)[_0xbf39('0x2a')](function(_0x5050d3){_0x50cc3c=_0x5050d3;return getUser(_0x48cd8c,_0x2eb44b[_0xbf39('0x63')],_0x50cc3c);})[_0xbf39('0x2a')](function(_0x1e5f44){_0x56bb78=_0x1e5f44;return getEndUser(_0x48cd8c,_0x504703,_0x29ecae[_0xbf39('0x64')],_0x29ecae[_0xbf39('0x65')],_0x50cc3c);})[_0xbf39('0x2a')](function(_0x2063cb){_0x35118a=_0x2063cb;return getTicket(_0x48cd8c,_0x56bb78,_0x35118a,_0x504703,_0x29ecae,_0x504703[_0xbf39('0x66')],_0x50cc3c,_0xbf39('0x67'));})['then'](function(_0x2f4965){_0x4013f6=_0x2f4965;logger[_0xbf39('0x25')](_0xbf39('0x68'),_0x4013f6['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4013f6['id'],_0x2eb44b[_0xbf39('0x53')],_0x48cd8c[_0xbf39('0x4b')]);switch(_0x48cd8c['type']){case _0xbf39('0x69'):emit(util[_0xbf39('0x42')]('user:%s',_0x2eb44b['name']),'trigger:salesforce:display',{'recordId':_0x4013f6['id']});break;case _0xbf39('0x6a'):emit(util[_0xbf39('0x42')](_0xbf39('0x6b'),_0x2eb44b['name']),'trigger:browser:url',{'uri':util[_0xbf39('0x42')](_0xbf39('0x6c'),_0x50cc3c['instanceUrl'],_0x4013f6['id'])});break;default:logger[_0xbf39('0x6d')](_0xbf39('0x6e'));}})[_0xbf39('0x6f')](function(_0x26c8ed){logger['error'](_0xbf39('0x5e'),_0x26c8ed);});};exports[_0xbf39('0x70')]=function(_0x2d7fe7,_0x5c802a,_0x5c85a9,_0x28f4f0,_0x32024c,_0x3ab154,_0x59b0cc){var _0x37ac2c,_0x2c201d,_0x53af84,_0x130abe;_0x3ab154[_0xbf39('0x5b')]=intUtil[_0xbf39('0x5c')](_0x3ab154['serverUrl']);_0x3ab154[_0xbf39('0x71')]=intUtil['stripTrailingSlash'](_0x3ab154[_0xbf39('0x71')]);if(_0x59b0cc&&_0x59b0cc[_0xbf39('0x72')]&&_0x59b0cc[_0xbf39('0x72')]!==_0xbf39('0x73')){logger[_0xbf39('0x25')]('[OUTBOUND]',_0xbf39('0x5f'));_0x5c802a[_0xbf39('0x62')]=util[_0xbf39('0x42')](_0xbf39('0x60'),_0x3ab154[_0xbf39('0x5b')],_0x5c802a[_0xbf39('0x61')],md5(_0x5c802a[_0xbf39('0x61')]));}return getConnection(_0x3ab154)[_0xbf39('0x2a')](function(_0x522078){_0x130abe=_0x522078;return getUser(_0x3ab154,_0x28f4f0['email'],_0x130abe);})[_0xbf39('0x2a')](function(_0x177e77){_0x37ac2c=_0x177e77;return getEndUser(_0x3ab154,_0x5c85a9,_0x5c802a[_0xbf39('0x74')],_0x5c802a['destcalleridnum'],_0x130abe);})[_0xbf39('0x2a')](function(_0x4389d4){_0x2c201d=_0x4389d4;return getTicket(_0x3ab154,_0x37ac2c,_0x2c201d,_0x5c85a9,_0x5c802a,_0x5c85a9['Fields'],_0x130abe,_0xbf39('0x70'));})[_0xbf39('0x2a')](function(_0xe48349){_0x53af84=_0xe48349;logger[_0xbf39('0x25')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x53af84['id']);logger[_0xbf39('0x25')](_0xbf39('0x75'),_0x53af84['id'],_0x28f4f0['name'],_0x3ab154[_0xbf39('0x4b')]);switch(_0x3ab154[_0xbf39('0x4b')]){case _0xbf39('0x69'):emit(util[_0xbf39('0x42')](_0xbf39('0x6b'),_0x28f4f0['name']),_0xbf39('0x76'),{'recordId':_0x53af84['id']});break;case _0xbf39('0x6a'):emit(util['format'](_0xbf39('0x6b'),_0x28f4f0[_0xbf39('0x53')]),_0xbf39('0x77'),{'uri':util[_0xbf39('0x42')](_0xbf39('0x6c'),_0x130abe[_0xbf39('0x78')],_0x53af84['id'])});break;default:logger['error'](_0xbf39('0x79'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xbf39('0x6f')](function(_0x10fd9b){logger['error']('[OUTBOUND]',_0x10fd9b);});};exports['unmanaged']=function(_0x1a1625,_0x730b9c,_0x95d127,_0x1de15b,_0x32679e,_0x1347df){var _0x1a17be,_0x161814,_0x53f91d,_0x131643;_0x1347df[_0xbf39('0x5b')]=intUtil['stripTrailingSlash'](_0x1347df[_0xbf39('0x5b')]);_0x1347df[_0xbf39('0x71')]=intUtil[_0xbf39('0x5c')](_0x1347df[_0xbf39('0x71')]);if(_0x32679e&&_0x32679e[_0xbf39('0x5d')]){logger[_0xbf39('0x25')]('['+_0x730b9c['lastevent'][_0xbf39('0x7a')]()+']','Recording\x20is\x20enabled!');_0x730b9c[_0xbf39('0x62')]=util[_0xbf39('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1347df[_0xbf39('0x5b')],_0x730b9c[_0xbf39('0x61')],md5(_0x730b9c[_0xbf39('0x61')]));}else{_0x730b9c[_0xbf39('0x62')]='';}return getConnection(_0x1347df)['then'](function(_0x168a19){_0x131643=_0x168a19;if(!_[_0xbf39('0x1f')](_0x1de15b)){return getUser(_0x1347df,_0x1de15b['name'],_0x131643);}else{return getUser(_0x1347df,null,_0x131643);}})[_0xbf39('0x2a')](function(_0x5d33c2){_0x1a17be=_0x5d33c2;return getEndUser(_0x1347df,_0x95d127,_0x730b9c[_0xbf39('0x64')],_0x730b9c[_0xbf39('0x65')],_0x131643);})[_0xbf39('0x2a')](function(_0x5daf3a){_0x161814=_0x5daf3a;return getTicket(_0x1347df,_0x1a17be,_0x161814,_0x95d127,_0x730b9c,_0x95d127[_0xbf39('0x66')],_0x131643);})[_0xbf39('0x2a')](function(_0x473bee){_0x53f91d=_0x473bee;logger[_0xbf39('0x25')]('['+_0x730b9c[_0xbf39('0x7b')][_0xbf39('0x7a')]()+_0xbf39('0x7c'),_0x53f91d['id']);logger['info']('['+_0x730b9c[_0xbf39('0x7b')]['toUpperCase']()+_0xbf39('0x7d'),_0x1347df[_0xbf39('0x4b')]);})[_0xbf39('0x6f')](function(_0x1a1358){logger[_0xbf39('0x6d')]('['+_0x730b9c[_0xbf39('0x7b')][_0xbf39('0x7a')]()+']',_0x1a1358);});}; \ No newline at end of file +var _0xd20a=['instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.','lodash','moment','bluebird','md5','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','getString','ticketType','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','create','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x377ff6,_0xf7fb77){var _0x2f6117=function(_0xa5ab68){while(--_0xa5ab68){_0x377ff6['push'](_0x377ff6['shift']());}};_0x2f6117(++_0xf7fb77);}(_0xd20a,0x17c));var _0xad20=function(_0x513878,_0x46db2d){_0x513878=_0x513878-0x0;var _0x239596=_0xd20a[_0x513878];return _0x239596;};'use strict';var _=require(_0xad20('0x0'));var rp=require('request-promise');var moment=require(_0xad20('0x1'));var BPromise=require(_0xad20('0x2'));var md5=require(_0xad20('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0xad20('0x4'));var intUtil=require(_0xad20('0x5'));var config=require(_0xad20('0x6'));var logger=require('../../../../config/logger')(_0xad20('0x7'));config[_0xad20('0x8')]=_[_0xad20('0x9')](config[_0xad20('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xad20('0xa'))(new Redis(config[_0xad20('0x8')]));function emit(_0x56b9b0,_0x4c059f,_0x20bffb){io['to'](_0x56b9b0)[_0xad20('0xb')](_0x4c059f,_0x20bffb);}function getTicket(_0x362515,_0xf2f100,_0x149de0,_0x41cff4,_0x22cc2c,_0x49fd61,_0x210c89,_0x1bae13){var _0x3bb122=Object['assign']({},{'OwnerId':_0xf2f100['id'],'Subject':intUtil[_0xad20('0xc')](_0x41cff4['Subjects'],_0x22cc2c,'\x20'),'Description':intUtil[_0xad20('0xc')](_0x41cff4['Descriptions'],_0x22cc2c,'\x0a')},getCustomFields(_0x49fd61,_0x22cc2c));if(_0x149de0){if(_0x41cff4[_0xad20('0xd')]==='Task'){_0x3bb122[_0xad20('0xe')]=moment['utc']();_0x3bb122[_0xad20('0xf')]=![];_0x3bb122[_0xad20('0x10')]=![];if(_0x149de0[_0xad20('0x11')]===_0xad20('0x12')||_0x149de0[_0xad20('0x11')]===_0xad20('0x13')){_0x3bb122[_0xad20('0x14')]=_0x149de0['id'];}else if(_0x149de0[_0xad20('0x11')]===_0xad20('0x15')){_0x3bb122[_0xad20('0x16')]=_0x149de0['id'];}}else if(_0x41cff4['ticketType']===_0xad20('0x17')){if(_0x149de0[_0xad20('0x11')]==='contact'){_0x3bb122[_0xad20('0x18')]=_0x149de0['id'];}else if(_0x149de0[_0xad20('0x11')]===_0xad20('0x15')){_0x3bb122[_0xad20('0x19')]=_0x149de0['id'];}else if(_0x149de0['endUserType']===_0xad20('0x13')&&_0x41cff4[_0xad20('0x1a')]){_0x3bb122[_0x41cff4['leadId']]=_0x149de0['id'];}else{logger[_0xad20('0x1b')](_0xad20('0x1c'));}}}return _0x210c89[_0xad20('0x1d')](_0x41cff4[_0xad20('0xd')])['create'](_0x3bb122);}function getUser(_0x54f7e5,_0x2f2421,_0x813602){if(!_[_0xad20('0x1e')](_0x2f2421)&&intUtil['validateEmail'](_0x2f2421)){var _0x4557c9={'Email':_0x2f2421};var _0x246f81={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x813602[_0xad20('0x1d')]('User')[_0xad20('0x1f')](_0x4557c9,_0x246f81)[_0xad20('0x20')]()[_0xad20('0x21')](function(_0x11edc6){if(_0x11edc6[_0xad20('0x22')]){var _0xc208f=_[_0xad20('0x1f')](_0x11edc6,function(_0x3cbb8f){return _0x3cbb8f['Email']===_0x2f2421;});if(_0xc208f){logger[_0xad20('0x1b')](_0xad20('0x23'),_0x2f2421);return BPromise[_0xad20('0x24')]({'id':_0xc208f['Id'],'name':_0xc208f[_0xad20('0x25')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2f2421);return _0x813602['identity']()['then'](function(_0xf1b350){return BPromise[_0xad20('0x24')]({'id':_0xf1b350[_0xad20('0x26')],'name':_0xf1b350[_0xad20('0x27')]});});}});}else{logger[_0xad20('0x1b')](_0xad20('0x28'),_0x2f2421);return _0x813602[_0xad20('0x29')]()['then'](function(_0x17bf54){return BPromise[_0xad20('0x24')]({'id':_0x17bf54[_0xad20('0x26')],'name':_0x17bf54[_0xad20('0x27')]});});}}function getEndUser(_0x5d9ef6,_0x4dc9b5,_0x10a0ee,_0x5ab713,_0x278294){var _0x22ab64={'$or':{'Phone':_0x5ab713}};var _0x2540ef={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xad20('0x24')]()[_0xad20('0x21')](function(){logger[_0xad20('0x1b')](_0xad20('0x2a'),_0x5ab713,_0x4dc9b5['moduleSearch']);switch(_0x4dc9b5[_0xad20('0x2b')]){case'contact_lead':var _0x3d085b=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x2d')]){var _0x53d710={};_0x53d710[_0x4dc9b5[_0xad20('0x2d')]]=_0x5ab713;_[_0xad20('0x2e')](_0x3d085b[_0xad20('0x2f')],_0x53d710);}return _0x278294[_0xad20('0x1d')](_0xad20('0x30'))[_0xad20('0x1f')](_0x3d085b,_0x2540ef)['execute']()['then'](function(_0x14983c){if(_0x14983c&&_0x14983c[_0xad20('0x22')]){return _0x14983c;}else{var _0x193385=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x31')]){var _0x4c856a={};_0x4c856a[_0x4dc9b5[_0xad20('0x31')]]=_0x5ab713;_[_0xad20('0x2e')](_0x193385[_0xad20('0x2f')],_0x4c856a);}return _0x278294[_0xad20('0x1d')](_0xad20('0x32'))[_0xad20('0x1f')](_0x193385,_0x2540ef);}});case _0xad20('0x33'):var _0x2590ae=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x34')]){var _0x53d710={};_0x53d710[_0x4dc9b5[_0xad20('0x34')]]=_0x5ab713;_[_0xad20('0x2e')](_0x2590ae['$or'],_0x53d710);}return _0x278294[_0xad20('0x1d')](_0xad20('0x35'))[_0xad20('0x1f')](_0x2590ae,_0x2540ef)[_0xad20('0x20')]()['then'](function(_0x3e8626){if(_0x3e8626&&_0x3e8626[_0xad20('0x22')]){return _0x3e8626;}else{var _0x53b629=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x2d')]){var _0x3f9606={};_0x3f9606[_0x4dc9b5['additionalSearchContact']]=_0x5ab713;_['merge'](_0x53b629['$or'],_0x3f9606);}return _0x278294[_0xad20('0x1d')](_0xad20('0x30'))[_0xad20('0x1f')](_0x53b629,_0x2540ef)[_0xad20('0x21')](function(_0x3b544b){if(_0x3b544b&&_0x3b544b['length']){return _0x3b544b;}else{var _0x388598=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x31')]){var _0x5ce735={};_0x5ce735[_0x4dc9b5[_0xad20('0x31')]]=_0x5ab713;_['merge'](_0x388598['$or'],_0x5ce735);}return _0x278294[_0xad20('0x1d')](_0xad20('0x32'))[_0xad20('0x1f')](_0x388598,_0x2540ef);}});}});case _0xad20('0x12'):var _0x3d085b=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x2d')]){var _0x53d710={};_0x53d710[_0x4dc9b5[_0xad20('0x2d')]]=_0x5ab713;_[_0xad20('0x2e')](_0x3d085b[_0xad20('0x2f')],_0x53d710);}return _0x278294[_0xad20('0x1d')]('Contact')['find'](_0x3d085b,_0x2540ef)[_0xad20('0x20')]();case'lead':var _0x4e5e52=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x31')]){var _0x53d710={};_0x53d710[_0x4dc9b5[_0xad20('0x31')]]=_0x5ab713;_[_0xad20('0x2e')](_0x4e5e52[_0xad20('0x2f')],_0x53d710);}return _0x278294['sobject'](_0xad20('0x32'))['find'](_0x4e5e52,_0x2540ef);case _0xad20('0x15'):var _0x2590ae=_['cloneDeep'](_0x22ab64);if(_0x4dc9b5['additionalSearchAccount']){var _0x53d710={};_0x53d710[_0x4dc9b5['additionalSearchAccount']]=_0x5ab713;_[_0xad20('0x2e')](_0x2590ae[_0xad20('0x2f')],_0x53d710);}return _0x278294['sobject'](_0xad20('0x35'))[_0xad20('0x1f')](_0x2590ae,_0x2540ef);default:return null;}})[_0xad20('0x21')](function(_0x3b28c9){if(_0x3b28c9&&_0x3b28c9[_0xad20('0x22')]){var _0x344258=_['first'](_0x3b28c9);if(_0x344258){return BPromise[_0xad20('0x24')]({'id':_0x344258['Id'],'name':_0x344258[_0xad20('0x25')],'phone':_0x344258[_0xad20('0x36')],'endUserType':_0x344258[_0xad20('0x37')]['type']['toLowerCase']()});}}})[_0xad20('0x21')](function(_0xa7f3aa){if(_0xa7f3aa){logger[_0xad20('0x1b')](_0xad20('0x38'),_0xa7f3aa[_0xad20('0x11')],_0x5ab713);return BPromise[_0xad20('0x24')](_0xa7f3aa);}else{logger['info'](_0xad20('0x39'),_0x5ab713);var _0x2ed15c={'Phone':_0x5ab713};if(_0x4dc9b5[_0xad20('0x3a')]){if(_0x4dc9b5[_0xad20('0x3a')]==='contact'){logger['info'](_0xad20('0x3b'),_0x5ab713,_0x4dc9b5['moduleCreate']);_0x2ed15c[_0xad20('0x3c')]=_0x10a0ee!==_0xad20('0x3d')?_0x10a0ee:util[_0xad20('0x3e')](_0xad20('0x3f'),_0x5ab713);}else if(_0x4dc9b5[_0xad20('0x3a')]===_0xad20('0x13')){logger[_0xad20('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5ab713,_0x4dc9b5['moduleCreate']);_0x2ed15c[_0xad20('0x3c')]=_0x10a0ee!==_0xad20('0x3d')?_0x10a0ee:util[_0xad20('0x3e')](_0xad20('0x3f'),_0x5ab713);_0x2ed15c[_0xad20('0x40')]=_0xad20('0x41');}else if(_0x4dc9b5[_0xad20('0x3a')]===_0xad20('0x15')){logger[_0xad20('0x1b')](_0xad20('0x3b'),_0x5ab713,_0x4dc9b5['moduleCreate']);_0x2ed15c[_0xad20('0x25')]=_0x10a0ee!==''?_0x10a0ee:util[_0xad20('0x3e')](_0xad20('0x3f'),_0x5ab713);}else{return null;}}return _0x278294[_0xad20('0x1d')](_['upperFirst'](_0x4dc9b5[_0xad20('0x3a')]))[_0xad20('0x42')](_0x2ed15c)[_0xad20('0x21')](function(_0x30a3e5){return BPromise[_0xad20('0x24')]({'id':_0x30a3e5['id'],'endUserType':_0x4dc9b5['moduleCreate']});});}});}function getCustomFields(_0xf10cd2,_0x3a1751){var _0x22edf9={};if(_0xf10cd2[_0xad20('0x22')]>0x0){_[_0xad20('0x43')](_0xf10cd2,function(_0xe744b5){if(_[_0xad20('0x44')]([_0xad20('0x45'),_0xad20('0x46')],_0xe744b5[_0xad20('0x47')])&&_0xe744b5[_0xad20('0x48')]){_0x22edf9[_0xe744b5[_0xad20('0x48')]]=_0xe744b5[_0xad20('0x49')][_0xad20('0x4a')]();}else if(_0xe744b5['type']===_0xad20('0x4b')&&_0xe744b5[_0xad20('0x4c')]&&_0xe744b5[_0xad20('0x48')]){_0x3a1751[_0xe744b5[_0xad20('0x4c')]]&&(_0x22edf9[_0xe744b5[_0xad20('0x48')]]=_0x3a1751[_0xe744b5[_0xad20('0x4c')]]['toString']());}else if(_0xe744b5[_0xad20('0x47')]===_0xad20('0x4d')&&_0xe744b5['Variable']&&_0xe744b5[_0xad20('0x4e')][_0xad20('0x4f')]&&_0xe744b5['idField']){_0x3a1751[_0xe744b5['Variable'][_0xad20('0x4f')][_0xad20('0x50')]()]&&(_0x22edf9[_0xe744b5[_0xad20('0x48')]]=_0x3a1751[_0xe744b5[_0xad20('0x4e')][_0xad20('0x4f')][_0xad20('0x50')]()]['toString']());}});}return _0x22edf9;}function getConnection(_0x8b8fca){var _0x3b6cbd=_0x8b8fca[_0xad20('0x51')]['concat'](_0x8b8fca['securityToken']);var _0x16ec93=new jsforce[(_0xad20('0x52'))]({'oauth2':{'loginUrl':_0x8b8fca[_0xad20('0x53')]||'https://login.salesforce.com','clientId':_0x8b8fca[_0xad20('0x54')],'clientSecret':_0x8b8fca[_0xad20('0x55')]}});return _0x16ec93[_0xad20('0x56')](_0x8b8fca[_0xad20('0x57')],_0x3b6cbd)['then'](function(){logger[_0xad20('0x1b')](_0xad20('0x58'));return _0x16ec93;});}exports[_0xad20('0x59')]=function(_0x57afc8,_0xcd9436,_0x4bc929,_0x1b1991,_0x5c13d0,_0x2ab305){var _0xa2d93a,_0x3c0922,_0x1d4a5f,_0x2c4aeb;_0x2ab305[_0xad20('0x5a')]=intUtil[_0xad20('0x5b')](_0x2ab305['serverUrl']);_0x2ab305[_0xad20('0x53')]=intUtil['stripTrailingSlash'](_0x2ab305[_0xad20('0x53')]);if(_0x5c13d0&&_0x5c13d0[_0xad20('0x5c')]){logger[_0xad20('0x1b')](_0xad20('0x5d'),_0xad20('0x5e'));_0xcd9436['recordingURL']=util[_0xad20('0x3e')](_0xad20('0x5f'),_0x2ab305[_0xad20('0x5a')],_0xcd9436[_0xad20('0x60')],md5(_0xcd9436[_0xad20('0x60')]));}else{_0xcd9436['recordingURL']='';}return getConnection(_0x2ab305)[_0xad20('0x21')](function(_0x22c1b0){_0x2c4aeb=_0x22c1b0;return getUser(_0x2ab305,_0x1b1991[_0xad20('0x61')],_0x2c4aeb);})[_0xad20('0x21')](function(_0x3c232f){_0xa2d93a=_0x3c232f;return getEndUser(_0x2ab305,_0x4bc929,_0xcd9436[_0xad20('0x62')],_0xcd9436['calleridnum'],_0x2c4aeb);})[_0xad20('0x21')](function(_0x1137cc){_0x3c0922=_0x1137cc;return getTicket(_0x2ab305,_0xa2d93a,_0x3c0922,_0x4bc929,_0xcd9436,_0x4bc929[_0xad20('0x63')],_0x2c4aeb,'queue');})[_0xad20('0x21')](function(_0x17d9ee){_0x1d4a5f=_0x17d9ee;logger[_0xad20('0x1b')](_0xad20('0x64'),_0x1d4a5f['id']);logger[_0xad20('0x1b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1d4a5f['id'],_0x1b1991[_0xad20('0x4f')],_0x2ab305[_0xad20('0x47')]);switch(_0x2ab305['type']){case _0xad20('0x65'):emit(util[_0xad20('0x3e')]('user:%s',_0x1b1991[_0xad20('0x4f')]),_0xad20('0x66'),{'recordId':_0x1d4a5f['id']});break;case _0xad20('0x67'):emit(util[_0xad20('0x3e')](_0xad20('0x68'),_0x1b1991[_0xad20('0x4f')]),_0xad20('0x69'),{'uri':util[_0xad20('0x3e')](_0xad20('0x6a'),_0x2c4aeb['instanceUrl'],_0x1d4a5f['id'])});break;default:logger[_0xad20('0x6b')](_0xad20('0x6c'));}})['catch'](function(_0x5d23d4){logger['error'](_0xad20('0x5d'),_0x5d23d4);});};exports['outbound']=function(_0x11acce,_0x10a5a3,_0xbc6dee,_0x4cba0c,_0x4a6516,_0x29eb15,_0x1f0f8e){var _0x22dacd,_0x14f152,_0x37bb6c,_0x189828;_0x29eb15[_0xad20('0x5a')]=intUtil[_0xad20('0x5b')](_0x29eb15[_0xad20('0x5a')]);_0x29eb15[_0xad20('0x53')]=intUtil[_0xad20('0x5b')](_0x29eb15[_0xad20('0x53')]);if(_0x1f0f8e&&_0x1f0f8e[_0xad20('0x6d')]&&_0x1f0f8e[_0xad20('0x6d')]!=='none'){logger[_0xad20('0x1b')](_0xad20('0x6e'),'Recording\x20is\x20enabled!');_0x10a5a3[_0xad20('0x6f')]=util[_0xad20('0x3e')](_0xad20('0x5f'),_0x29eb15[_0xad20('0x5a')],_0x10a5a3[_0xad20('0x60')],md5(_0x10a5a3['uniqueid']));}return getConnection(_0x29eb15)[_0xad20('0x21')](function(_0x30cda7){_0x189828=_0x30cda7;return getUser(_0x29eb15,_0x4cba0c['email'],_0x189828);})[_0xad20('0x21')](function(_0x175b93){_0x22dacd=_0x175b93;return getEndUser(_0x29eb15,_0xbc6dee,_0x10a5a3[_0xad20('0x70')],_0x10a5a3[_0xad20('0x71')],_0x189828);})[_0xad20('0x21')](function(_0x305afe){_0x14f152=_0x305afe;return getTicket(_0x29eb15,_0x22dacd,_0x14f152,_0xbc6dee,_0x10a5a3,_0xbc6dee['Fields'],_0x189828,'outbound');})[_0xad20('0x21')](function(_0x507901){_0x37bb6c=_0x507901;logger[_0xad20('0x1b')](_0xad20('0x72'),_0x37bb6c['id']);logger['info'](_0xad20('0x73'),_0x37bb6c['id'],_0x4cba0c[_0xad20('0x4f')],_0x29eb15[_0xad20('0x47')]);switch(_0x29eb15[_0xad20('0x47')]){case _0xad20('0x65'):emit(util['format'](_0xad20('0x68'),_0x4cba0c[_0xad20('0x4f')]),_0xad20('0x66'),{'recordId':_0x37bb6c['id']});break;case _0xad20('0x67'):emit(util[_0xad20('0x3e')](_0xad20('0x68'),_0x4cba0c[_0xad20('0x4f')]),_0xad20('0x69'),{'uri':util[_0xad20('0x3e')](_0xad20('0x6a'),_0x189828[_0xad20('0x74')],_0x37bb6c['id'])});break;default:logger[_0xad20('0x6b')](_0xad20('0x6e'),_0xad20('0x75'));}})[_0xad20('0x76')](function(_0x8d9316){logger['error'](_0xad20('0x6e'),_0x8d9316);});};exports[_0xad20('0x77')]=function(_0x1c5ce3,_0x90c67e,_0x18aaf5,_0x464de9,_0x539ef4,_0x4e0745){var _0x2de034,_0x8e9004,_0x21c6ae,_0x215132;_0x4e0745[_0xad20('0x5a')]=intUtil[_0xad20('0x5b')](_0x4e0745[_0xad20('0x5a')]);_0x4e0745[_0xad20('0x53')]=intUtil['stripTrailingSlash'](_0x4e0745[_0xad20('0x53')]);if(_0x539ef4&&_0x539ef4[_0xad20('0x5c')]){logger[_0xad20('0x1b')]('['+_0x90c67e['lastevent'][_0xad20('0x78')]()+']','Recording\x20is\x20enabled!');_0x90c67e[_0xad20('0x6f')]=util[_0xad20('0x3e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e0745[_0xad20('0x5a')],_0x90c67e[_0xad20('0x60')],md5(_0x90c67e[_0xad20('0x60')]));}else{_0x90c67e['recordingURL']='';}return getConnection(_0x4e0745)[_0xad20('0x21')](function(_0x202367){_0x215132=_0x202367;if(!_[_0xad20('0x1e')](_0x464de9)){return getUser(_0x4e0745,_0x464de9['name'],_0x215132);}else{return getUser(_0x4e0745,null,_0x215132);}})[_0xad20('0x21')](function(_0x48b1c2){_0x2de034=_0x48b1c2;return getEndUser(_0x4e0745,_0x18aaf5,_0x90c67e[_0xad20('0x62')],_0x90c67e[_0xad20('0x79')],_0x215132);})[_0xad20('0x21')](function(_0xf2a0ae){_0x8e9004=_0xf2a0ae;return getTicket(_0x4e0745,_0x2de034,_0x8e9004,_0x18aaf5,_0x90c67e,_0x18aaf5[_0xad20('0x63')],_0x215132);})[_0xad20('0x21')](function(_0x2cdc16){_0x21c6ae=_0x2cdc16;logger['info']('['+_0x90c67e[_0xad20('0x7a')][_0xad20('0x78')]()+_0xad20('0x7b'),_0x21c6ae['id']);logger[_0xad20('0x1b')]('['+_0x90c67e[_0xad20('0x7a')][_0xad20('0x78')]()+']\x20Integration\x20account\x20type\x20%s.',_0x4e0745[_0xad20('0x47')]);})[_0xad20('0x76')](function(_0x12b362){logger['error']('['+_0x90c67e[_0xad20('0x7a')][_0xad20('0x78')]()+']',_0x12b362);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 0dff97a..2e34898 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 _0xde51=['format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','util','md5','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','result','active','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20getEndUser\x20input\x20crm','sys_id','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','toLowerCase','content','toString','idField','customField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','true','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','label','label_entry','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber'];(function(_0x417081,_0x400fb0){var _0x443b7c=function(_0x3de2c4){while(--_0x3de2c4){_0x417081['push'](_0x417081['shift']());}};_0x443b7c(++_0x400fb0);}(_0xde51,0xe7));var _0x1de5=function(_0x5857a7,_0x3f8601){_0x5857a7=_0x5857a7-0x0;var _0x2c35e4=_0xde51[_0x5857a7];return _0x2c35e4;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x1de5('0x0'));var util=require(_0x1de5('0x1'));var md5=require(_0x1de5('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x1de5('0x3'));var logger=require(_0x1de5('0x4'))(_0x1de5('0x5'));config['redis']=_[_0x1de5('0x6')](config[_0x1de5('0x7')],{'host':_0x1de5('0x8'),'port':0x18eb});var io=require(_0x1de5('0x9'))(new Redis(config[_0x1de5('0x7')]));function getAdminUser(_0x2b1767,_0x178332,_0x42a879,_0x4e9db0,_0x4190b6,_0x514615){return new Promise(function(_0x5c7d13,_0x175bd0){var _0x5e8885={'method':_0x1de5('0xa'),'uri':_0x4e9db0+_0x1de5('0xb')+'&'+_0x4190b6+'&'+_0x514615,'auth':_0x178332,'json':!![]};return rp(_0x5e8885)[_0x1de5('0xc')](function(_0x3d8bc8){if(_0x3d8bc8['result'][_0x1de5('0xd')]>0x0){_0x42a879[_0x1de5('0xe')]=_0x3d8bc8['result'][0x0]['sys_id'];}logger[_0x1de5('0xf')]('['+[_0x2b1767[_0x1de5('0x10')]()]+'],\x20getAdminUser\x20crm',_0x42a879);_0x5c7d13(_0x42a879);})[_0x1de5('0x11')](function(_0x295d94){logger[_0x1de5('0x12')]('['+[_0x2b1767[_0x1de5('0x10')]()]+']',_0x295d94[_0x1de5('0x13')]);_0x175bd0(_0x295d94[_0x1de5('0x13')]);});});}function getUser(_0xfa5045,_0x3114dc,_0x4a2e17,_0x5e1737,_0x10cbbe){return function(_0x2af2ed){logger['info']('['+[_0xfa5045[_0x1de5('0x10')]()]+_0x1de5('0x14'),_0x2af2ed);return new Promise(function(_0x29db94,_0x298b17){if(intUtil[_0x1de5('0x15')](_0x2af2ed['userEmail'])){var _0x4e9860={'method':'GET','uri':_0x4a2e17+_0x1de5('0x16')+_0x2af2ed[_0x1de5('0x17')]+'&'+_0x5e1737+'&'+_0x10cbbe,'auth':_0x3114dc,'json':!![]};logger[_0x1de5('0xf')]('['+[_0xfa5045[_0x1de5('0x10')]()]+_0x1de5('0x18'),_0x4e9860);return rp(_0x4e9860)[_0x1de5('0xc')](function(_0x50a68e){logger[_0x1de5('0xf')]('['+[_0xfa5045[_0x1de5('0x10')]()]+'],\x20getUser\x20entity',_0x50a68e);if(_0x50a68e[_0x1de5('0x19')]['length']>0x0&&String(_0x50a68e['result'][0x0][_0x1de5('0x1a')])==='true'){_0x2af2ed[_0x1de5('0x1b')]=_0x50a68e[_0x1de5('0x19')][0x0]['sys_id'];}else{_0x2af2ed[_0x1de5('0x1b')]=_0x2af2ed['adminId'];_0x2af2ed[_0x1de5('0x17')]=_0x2af2ed['adminEmail'];}logger['info']('['+[_0xfa5045['toUpperCase']()]+_0x1de5('0x1c'),_0x2af2ed);_0x29db94(_0x2af2ed);})[_0x1de5('0x11')](function(_0x3760a3){logger[_0x1de5('0x12')]('['+[_0xfa5045[_0x1de5('0x10')]()]+']',_0x3760a3['message']);_0x298b17(_0x3760a3[_0x1de5('0x13')]);});}else{logger[_0x1de5('0xf')]('['+[_0xfa5045[_0x1de5('0x10')]()]+_0x1de5('0x1d'));_0x2af2ed['userId']=_0x2af2ed[_0x1de5('0xe')];_0x2af2ed['userEmail']=_0x2af2ed['adminEmail'];_0x29db94(_0x2af2ed);}});};}function createEndUser(_0x18d320,_0x3d3b9f,_0x40b0a0,_0x9db5de,_0x2860ed){logger[_0x1de5('0xf')]('['+[_0x18d320[_0x1de5('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x40b0a0);return new Promise(function(_0x315f89,_0x343e1c){var _0x25ac49={'method':_0x1de5('0x1e'),'uri':_0x9db5de+_0x1de5('0x1f')+_0x2860ed,'body':{'user_name':_0x40b0a0[_0x1de5('0x20')],'roles':_0x1de5('0x21'),'first_name':_0x40b0a0[_0x1de5('0x20')],'active':'true','date_format':_0x1de5('0x22'),'phone':_0x40b0a0[_0x1de5('0x20')]},'auth':_0x3d3b9f,'json':!![]};return rp(_0x25ac49)[_0x1de5('0xc')](function(_0xee66c8){logger[_0x1de5('0xf')]('['+[_0x18d320[_0x1de5('0x10')]()]+'],\x20EndUser\x20schema',_0xee66c8[_0x1de5('0x19')]);_0x40b0a0['endUserId']=_0xee66c8[_0x1de5('0x19')]['sys_id'];_0x315f89(_0x40b0a0);})[_0x1de5('0x11')](function(_0x1346e6){logger['error']('['+[_0x18d320[_0x1de5('0x10')]()]+']',_0x1346e6[_0x1de5('0x13')]);_0x343e1c(_0x1346e6[_0x1de5('0x13')]);});});}function getEndUser(_0x530b56,_0x4f9f46,_0x2153c5,_0x242aa1,_0x50acda){return function(_0x5d2b46){logger[_0x1de5('0xf')]('['+[_0x530b56['toUpperCase']()]+_0x1de5('0x23'),_0x5d2b46);return new Promise(function(_0x2146b1,_0xb25543){var _0x26ddf1={'method':_0x1de5('0xa'),'uri':_0x2153c5+'sys_user?sysparm_query=phone%3D'+_0x5d2b46[_0x1de5('0x20')]+'&'+_0x242aa1+'&'+_0x50acda,'auth':_0x4f9f46,'json':!![]};return rp(_0x26ddf1)[_0x1de5('0xc')](function(_0xd1e6b5){if(_0xd1e6b5[_0x1de5('0x19')][_0x1de5('0xd')]>0x0){_0x5d2b46['endUserId']=_0xd1e6b5[_0x1de5('0x19')][0x0][_0x1de5('0x24')];logger[_0x1de5('0xf')]('['+[_0x530b56['toUpperCase']()]+_0x1de5('0x25'),_0x5d2b46);_0x2146b1(_0x5d2b46);}else{return createEndUser(_0x530b56,_0x4f9f46,_0x5d2b46,_0x2153c5,_0x242aa1)[_0x1de5('0xc')](function(_0x3f3022){logger['info']('['+[_0x530b56[_0x1de5('0x10')]()]+'],\x20createEndUser\x20crm',_0x3f3022);_0x2146b1(_0x3f3022);});}})[_0x1de5('0x11')](function(_0x9181b3){logger[_0x1de5('0x12')]('['+[_0x530b56['toUpperCase']()]+']',_0x9181b3[_0x1de5('0x13')]);_0xb25543(_0x9181b3['message']);});});};}function getCustomFields(_0xc7b0eb,_0xd9de51){var _0x4bb3ed={};if(_0xc7b0eb[_0x1de5('0xd')]>0x0){_[_0x1de5('0x26')](_0xc7b0eb,function(_0x9f9155){if(_[_0x1de5('0x27')]([_0x1de5('0x28'),_0x1de5('0x29')],_0x9f9155[_0x1de5('0x2a')])&&_0x9f9155['nameField']&&!_0x9f9155['customField']){_0x4bb3ed[_0x9f9155['nameField'][_0x1de5('0x2b')]()]=_0x9f9155[_0x1de5('0x2c')][_0x1de5('0x2d')]();}else if(_['includes']([_0x1de5('0x28'),_0x1de5('0x29')],_0x9f9155[_0x1de5('0x2a')])&&_0x9f9155[_0x1de5('0x2e')]&&_0x9f9155[_0x1de5('0x2f')]){_0x4bb3ed[_0x9f9155[_0x1de5('0x2e')][_0x1de5('0x2b')]()]=_0x9f9155['content'][_0x1de5('0x2d')]();}else if(_0x9f9155[_0x1de5('0x2a')]==='variable'&&_0x9f9155[_0x1de5('0x30')]&&_0x9f9155[_0x1de5('0x2e')]&&_0x9f9155['customField']){_0x4bb3ed[_0x9f9155[_0x1de5('0x2e')][_0x1de5('0x2b')]()]=_0xd9de51[_0x9f9155[_0x1de5('0x30')]][_0x1de5('0x2d')]();}else if(_0x9f9155[_0x1de5('0x2a')]===_0x1de5('0x31')&&_0x9f9155[_0x1de5('0x32')]&&_0x9f9155['Variable'][_0x1de5('0x33')]&&_0x9f9155[_0x1de5('0x2e')]&&_0x9f9155['customField']){_0x4bb3ed[_0x9f9155[_0x1de5('0x2e')][_0x1de5('0x2b')]()]=_0xd9de51[_0x9f9155[_0x1de5('0x32')][_0x1de5('0x33')][_0x1de5('0x2b')]()][_0x1de5('0x2d')]();}});}return _0x4bb3ed;}function getTicket(_0x4a77c0,_0x9a9909,_0x5edec1,_0x285920,_0x421519,_0x5bfa0a){return function(_0x3b6ca2){logger['info']('['+[_0x4a77c0[_0x1de5('0x10')]()]+_0x1de5('0x34'),_0x3b6ca2);return new Promise(function(_0x55106f,_0x4146e4){var _0x54db7f=_0x4a77c0[_0x1de5('0x2b')]()===_0x1de5('0x35')?_0x3b6ca2[_0x1de5('0x1b')]:_0x3b6ca2[_0x1de5('0x36')];var _0x1e07b4={'method':_0x1de5('0x1e'),'uri':_0x5edec1+_0x1de5('0x37')+'?'+_0x5bfa0a,'body':Object['assign']({},{'active':_0x1de5('0x38'),'caller_id':_0x54db7f,'assigned_to':_0x3b6ca2['userId'],'short_description':intUtil[_0x1de5('0x39')](_0x285920[_0x1de5('0x3a')],_0x421519,'\x20'),'description':intUtil[_0x1de5('0x39')](_0x285920['Descriptions'],_0x421519,'\x0a')},getCustomFields(_0x285920[_0x1de5('0x3b')],_0x421519)),'auth':_0x9a9909,'json':!![]};return rp(_0x1e07b4)['then'](function(_0x2e8272){logger[_0x1de5('0xf')]('['+[_0x4a77c0[_0x1de5('0x10')]()]+_0x1de5('0x3c'),_0x2e8272[_0x1de5('0x19')]);_0x3b6ca2['ticketId']=_0x2e8272['result']['sys_id'];_0x3b6ca2[_0x1de5('0x3d')]=_0x2e8272[_0x1de5('0x19')]['number'];logger[_0x1de5('0xf')]('['+[_0x4a77c0[_0x1de5('0x10')]()]+']\x20getTicket\x20crm',_0x3b6ca2);_0x55106f(_0x3b6ca2);})[_0x1de5('0x11')](function(_0x5711f9){logger[_0x1de5('0x12')]('['+[_0x4a77c0[_0x1de5('0x10')]()]+']',_0x5711f9[_0x1de5('0x13')]);_0x4146e4(_0x5711f9[_0x1de5('0x13')]);});});};}function createRemoteTag(_0x38883c,_0xeee969,_0x3e05f0,_0x519f26){return new Promise(function(_0x5862fa,_0x40dbf0){var _0x556549={'method':_0x1de5('0x1e'),'uri':_0x3e05f0+_0x1de5('0x3e')+'?'+_0x519f26,'body':{'short_description':_0x38883c,'global':!![],'active':!![],'name':_0x38883c},'auth':_0xeee969,'json':!![]};return rp(_0x556549)[_0x1de5('0xc')](function(_0x2cf7d5){var _0x1b46a7=_0x2cf7d5['result'][_0x1de5('0x24')];_0x5862fa(_0x1b46a7);});});}function getRemoteTag(_0x1fc107,_0x403201,_0x30966b,_0x4997f9,_0x137600){return new Promise(function(_0x2eabec,_0x3742c8){var _0x45fb04={'method':'GET','uri':_0x30966b+_0x1de5('0x3e')+'?sysparm_query=name%3D'+_0x1fc107+'&'+_0x4997f9,'auth':_0x403201,'json':!![]};return rp(_0x45fb04)[_0x1de5('0xc')](function(_0x1318a3){if(_0x1318a3[_0x1de5('0x19')][_0x1de5('0xd')]>0x0){var _0xb7f217=_0x1318a3[_0x1de5('0x19')][0x0]['sys_id'];_0x2eabec(_0xb7f217);}else{return createRemoteTag(_0x1fc107,_0x403201,_0x30966b,_0x4997f9)[_0x1de5('0xc')](function(_0x280050){_0x2eabec(_0x280050);});}});});}function assignTagToIncident(_0x254bc5,_0x3e47d3,_0xecef43,_0x29d122,_0x3fb9ea){return new Promise(function(_0x2b1214,_0xb69f2a){var _0x2b78b8={'method':_0x1de5('0x1e'),'uri':_0xecef43+_0x1de5('0x3f')+'?'+_0x3fb9ea,'body':{'label':_0x254bc5,'table':_0x1de5('0x37'),'id_type':_0x1de5('0x40'),'table_key':_0x29d122[_0x1de5('0x41')],'title':_0x1de5('0x42')+_0x29d122['ticketNumber'],'id_display':_0x29d122[_0x1de5('0x3d')]},'auth':_0x3e47d3,'json':!![]};return rp(_0x2b78b8)[_0x1de5('0xc')](function(_0x580cca){_0x2b1214();})[_0x1de5('0x11')](function(){_0x2b1214();});});}function manageTags(_0x3921f2,_0x14093d,_0x330a50,_0x1b45b9,_0x583616,_0x2ca7e8,_0x240bd4){return new Promise(function(_0x2b498a,_0x477687){var _0x5bd96b=[];_0x14093d['forEach'](function(_0x55040f){_0x5bd96b[_0x1de5('0x43')](getRemoteTag(_0x55040f,_0x330a50,_0x1b45b9,_0x2ca7e8,_0x240bd4));});return Promise[_0x1de5('0x44')](_0x5bd96b)[_0x1de5('0xc')](function(_0x549ebf){if(_0x549ebf[_0x1de5('0xd')]){logger[_0x1de5('0xf')]('['+[_0x3921f2[_0x1de5('0x10')]()]+_0x1de5('0x45'),_0x549ebf);var _0x3aecc1=[];_0x549ebf[_0x1de5('0x26')](function(_0x23053e){_0x3aecc1[_0x1de5('0x43')](assignTagToIncident(_0x23053e,_0x330a50,_0x1b45b9,_0x583616,_0x2ca7e8));});return Promise[_0x1de5('0x44')](_0x3aecc1)[_0x1de5('0xc')](function(){_0x2b498a();})[_0x1de5('0x11')](function(){_0x2b498a();});}else{_0x2b498a();}});});}function getTags(_0x209724,_0x3e4ad8,_0x200110,_0x1b7d97,_0x381a1d,_0x318315){return function(_0x94b6ae){return new Promise(function(_0x276945,_0x6e9ee5){var _0x58f1a8=[];var _0x29d3ed=_0x1b7d97[_0x1de5('0x46')];if(_0x29d3ed&&_0x29d3ed[_0x1de5('0xd')]>0x0){_0x58f1a8=_[_0x1de5('0x47')](_0x29d3ed,'name');}if(_0x58f1a8[_0x1de5('0xd')]>0x0){return manageTags(_0x209724,_0x58f1a8,_0x3e4ad8,_0x200110,_0x94b6ae,_0x381a1d,_0x318315)['then'](function(){_0x276945(_0x94b6ae);});}else{_0x276945(_0x94b6ae);}});};}function emit(_0x3eed43,_0x335327,_0x2addd1){var _0x47afc5=_0x1de5('0x48')+_0x1de5('0x49')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x1de5('0x4a');var _0x53fabc={'uri':_0x3eed43+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2addd1+_0x47afc5};io['to'](util[_0x1de5('0x4b')](_0x1de5('0x4c'),_0x335327))[_0x1de5('0x4d')](_0x1de5('0x4e'),_0x53fabc);}exports['cs']=function(_0x1ebb2a,_0x3dd08b,_0x1a702f,_0x4ca31c,_0x33480a,_0xc44597,_0xb2f16b,_0x42b47c){var _0x1a91bc={};var _0x4607c8={'user':_0xc44597[_0x1de5('0x4f')],'pass':_0xc44597[_0x1de5('0x50')]};var _0x48221a='sysparm_limit=1';var _0x5254a0=_0x1de5('0x51');_0xc44597[_0x1de5('0x52')]=intUtil[_0x1de5('0x53')](_0xc44597['remoteUri']);_0xc44597['serverUrl']=intUtil[_0x1de5('0x53')](_0xc44597['serverUrl']);var _0x14e518=util[_0x1de5('0x4b')](_0x1de5('0x54'),_0xc44597[_0x1de5('0x52')]);_0x1a91bc['userEmail']=!_[_0x1de5('0x55')](_0x4ca31c)?_0x4ca31c[_0x1de5('0x56')]:null;_0x1a91bc['adminEmail']=_0xc44597[_0x1de5('0x56')];_0x1a91bc[_0x1de5('0x20')]=_0x42b47c['toLowerCase']()===_0x1de5('0x35')?_0x3dd08b[_0x1de5('0x57')]:_0x3dd08b[_0x1de5('0x58')];_0x1a91bc[_0x1de5('0x59')]=_0x42b47c==='queue'||_0x42b47c===_0x1de5('0x5a')?_0x1de5('0x5b'):_0x1de5('0x35');var _0x1df31c=util[_0x1de5('0x4b')](_0x1de5('0x5c'),_0xc44597['serverUrl'],_0x3dd08b['uniqueid'],md5(_0x3dd08b[_0x1de5('0x5d')]));if(_0x33480a&&_0x33480a['monitor_format']){logger[_0x1de5('0xf')](_0x1de5('0x5e'),_0x1de5('0x5f'));_0x3dd08b[_0x1de5('0x60')]=_0x1df31c;}else if(_0xb2f16b&&_0xb2f16b[_0x1de5('0x61')]&&_0xb2f16b['recordingFormat']!=='none'){logger[_0x1de5('0xf')]('[OUTBOUND]',_0x1de5('0x5f'));_0x3dd08b[_0x1de5('0x60')]=_0x1df31c;}else{_0x3dd08b[_0x1de5('0x60')]='';}return getAdminUser(_0x42b47c,_0x4607c8,_0x1a91bc,_0x14e518,_0x5254a0,_0x48221a)[_0x1de5('0xc')](getUser(_0x42b47c,_0x4607c8,_0x14e518,_0x5254a0,_0x48221a))[_0x1de5('0xc')](getEndUser(_0x42b47c,_0x4607c8,_0x14e518,_0x5254a0,_0x48221a))['then'](getTicket(_0x42b47c,_0x4607c8,_0x14e518,_0x1a702f,_0x3dd08b,_0x5254a0))['then'](function(_0x16e98e){logger['info'](util[_0x1de5('0x4b')](_0x1de5('0x62'),_0x16e98e[_0x1de5('0x41')]));logger[_0x1de5('0xf')](util[_0x1de5('0x4b')](_0x1de5('0x63'),_0x42b47c));if(_0x42b47c!==_0x1de5('0x5a')){logger[_0x1de5('0xf')]('['+[_0x42b47c[_0x1de5('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0xc44597[_0x1de5('0x52')],_0x4ca31c[_0x1de5('0x33')],_0x16e98e[_0x1de5('0x41')]);}})['catch'](function(_0x50ba7e){logger[_0x1de5('0x12')]('['+[_0x42b47c['toUpperCase']()]+_0x1de5('0x64'),util[_0x1de5('0x65')](_0x50ba7e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0e19=['customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','GET','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','format','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','bluebird','request-promise','util','ioredis','./util','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','result','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','toLowerCase','toString','picklist','idField','customField','content','variable'];(function(_0xeb79ca,_0x3b9197){var _0x17f118=function(_0x8b00d8){while(--_0x8b00d8){_0xeb79ca['push'](_0xeb79ca['shift']());}};_0x17f118(++_0x3b9197);}(_0x0e19,0x179));var _0x90e1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0e19[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x90e1('0x0'));var Promise=require(_0x90e1('0x1'));var rp=require(_0x90e1('0x2'));var util=require(_0x90e1('0x3'));var md5=require('md5');var Redis=require(_0x90e1('0x4'));var intUtil=require(_0x90e1('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config['redis']=_['defaults'](config[_0x90e1('0x6')],{'host':_0x90e1('0x7'),'port':0x18eb});var io=require(_0x90e1('0x8'))(new Redis(config[_0x90e1('0x6')]));function getAdminUser(_0x52e1a3,_0x5e47d7,_0xe5ffc3,_0x4c33f5,_0x51efc3,_0x22e90b){return new Promise(function(_0x58600c,_0x3c40fa){var _0x41722c={'method':'GET','uri':_0x4c33f5+_0x90e1('0x9')+'&'+_0x51efc3+'&'+_0x22e90b,'auth':_0x5e47d7,'json':!![]};return rp(_0x41722c)['then'](function(_0x2f40c4){if(_0x2f40c4['result'][_0x90e1('0xa')]>0x0){_0xe5ffc3[_0x90e1('0xb')]=_0x2f40c4['result'][0x0][_0x90e1('0xc')];}logger[_0x90e1('0xd')]('['+[_0x52e1a3[_0x90e1('0xe')]()]+_0x90e1('0xf'),_0xe5ffc3);_0x58600c(_0xe5ffc3);})[_0x90e1('0x10')](function(_0x4fec23){logger[_0x90e1('0x11')]('['+[_0x52e1a3[_0x90e1('0xe')]()]+']',_0x4fec23['message']);_0x3c40fa(_0x4fec23[_0x90e1('0x12')]);});});}function getUser(_0x2c37c4,_0x2e8754,_0xbcff0b,_0x44a80e,_0x1889d1){return function(_0x3ebc30){logger['info']('['+[_0x2c37c4['toUpperCase']()]+_0x90e1('0x13'),_0x3ebc30);return new Promise(function(_0x49ec33,_0x3028d7){if(intUtil[_0x90e1('0x14')](_0x3ebc30[_0x90e1('0x15')])){var _0x2e5f6e={'method':'GET','uri':_0xbcff0b+_0x90e1('0x16')+_0x3ebc30[_0x90e1('0x15')]+'&'+_0x44a80e+'&'+_0x1889d1,'auth':_0x2e8754,'json':!![]};logger[_0x90e1('0xd')]('['+[_0x2c37c4['toUpperCase']()]+_0x90e1('0x17'),_0x2e5f6e);return rp(_0x2e5f6e)[_0x90e1('0x18')](function(_0x58608c){logger[_0x90e1('0xd')]('['+[_0x2c37c4[_0x90e1('0xe')]()]+'],\x20getUser\x20entity',_0x58608c);if(_0x58608c[_0x90e1('0x19')][_0x90e1('0xa')]>0x0&&String(_0x58608c[_0x90e1('0x19')][0x0][_0x90e1('0x1a')])===_0x90e1('0x1b')){_0x3ebc30[_0x90e1('0x1c')]=_0x58608c[_0x90e1('0x19')][0x0]['sys_id'];}else{_0x3ebc30[_0x90e1('0x1c')]=_0x3ebc30[_0x90e1('0xb')];_0x3ebc30[_0x90e1('0x15')]=_0x3ebc30[_0x90e1('0x1d')];}logger['info']('['+[_0x2c37c4[_0x90e1('0xe')]()]+_0x90e1('0x1e'),_0x3ebc30);_0x49ec33(_0x3ebc30);})[_0x90e1('0x10')](function(_0x5c2e70){logger[_0x90e1('0x11')]('['+[_0x2c37c4['toUpperCase']()]+']',_0x5c2e70[_0x90e1('0x12')]);_0x3028d7(_0x5c2e70[_0x90e1('0x12')]);});}else{logger['info']('['+[_0x2c37c4['toUpperCase']()]+_0x90e1('0x1f'));_0x3ebc30[_0x90e1('0x1c')]=_0x3ebc30[_0x90e1('0xb')];_0x3ebc30[_0x90e1('0x15')]=_0x3ebc30[_0x90e1('0x1d')];_0x49ec33(_0x3ebc30);}});};}function createEndUser(_0x32cf2f,_0x39a201,_0x284e3a,_0x801226,_0x4b6ea0){logger['info']('['+[_0x32cf2f[_0x90e1('0xe')]()]+'],\x20createEndUser\x20input\x20crm',_0x284e3a);return new Promise(function(_0x507e30,_0x244b55){var _0x2089b4={'method':_0x90e1('0x20'),'uri':_0x801226+_0x90e1('0x21')+_0x4b6ea0,'body':{'user_name':_0x284e3a[_0x90e1('0x22')],'roles':_0x90e1('0x23'),'first_name':_0x284e3a[_0x90e1('0x22')],'active':'true','date_format':_0x90e1('0x24'),'phone':_0x284e3a['endUserNumber']},'auth':_0x39a201,'json':!![]};return rp(_0x2089b4)[_0x90e1('0x18')](function(_0x32ddd6){logger[_0x90e1('0xd')]('['+[_0x32cf2f[_0x90e1('0xe')]()]+_0x90e1('0x25'),_0x32ddd6[_0x90e1('0x19')]);_0x284e3a[_0x90e1('0x26')]=_0x32ddd6[_0x90e1('0x19')][_0x90e1('0xc')];_0x507e30(_0x284e3a);})[_0x90e1('0x10')](function(_0x3e50bd){logger[_0x90e1('0x11')]('['+[_0x32cf2f['toUpperCase']()]+']',_0x3e50bd[_0x90e1('0x12')]);_0x244b55(_0x3e50bd[_0x90e1('0x12')]);});});}function getEndUser(_0x2ec272,_0x4f3a4e,_0x43ec3b,_0x40de73,_0x159afc){return function(_0x3f8174){logger[_0x90e1('0xd')]('['+[_0x2ec272[_0x90e1('0xe')]()]+_0x90e1('0x27'),_0x3f8174);return new Promise(function(_0x5ac123,_0x2f19f8){var _0x24396c={'method':'GET','uri':_0x43ec3b+_0x90e1('0x28')+_0x3f8174['endUserNumber']+'&'+_0x40de73+'&'+_0x159afc,'auth':_0x4f3a4e,'json':!![]};return rp(_0x24396c)[_0x90e1('0x18')](function(_0x438495){if(_0x438495[_0x90e1('0x19')]['length']>0x0){_0x3f8174[_0x90e1('0x26')]=_0x438495[_0x90e1('0x19')][0x0][_0x90e1('0xc')];logger[_0x90e1('0xd')]('['+[_0x2ec272[_0x90e1('0xe')]()]+_0x90e1('0x29'),_0x3f8174);_0x5ac123(_0x3f8174);}else{return createEndUser(_0x2ec272,_0x4f3a4e,_0x3f8174,_0x43ec3b,_0x40de73)[_0x90e1('0x18')](function(_0x7b69f3){logger[_0x90e1('0xd')]('['+[_0x2ec272[_0x90e1('0xe')]()]+_0x90e1('0x2a'),_0x7b69f3);_0x5ac123(_0x7b69f3);});}})[_0x90e1('0x10')](function(_0x5ae8b8){logger['error']('['+[_0x2ec272['toUpperCase']()]+']',_0x5ae8b8[_0x90e1('0x12')]);_0x2f19f8(_0x5ae8b8['message']);});});};}function getCustomFields(_0x17bb3e,_0x4819c8){var _0x573bb3={};if(_0x17bb3e[_0x90e1('0xa')]>0x0){_[_0x90e1('0x2b')](_0x17bb3e,function(_0x3d898f){if(_[_0x90e1('0x2c')]([_0x90e1('0x2d'),'picklist'],_0x3d898f[_0x90e1('0x2e')])&&_0x3d898f[_0x90e1('0x2f')]&&!_0x3d898f['customField']){_0x573bb3[_0x3d898f[_0x90e1('0x2f')][_0x90e1('0x30')]()]=_0x3d898f['content'][_0x90e1('0x31')]();}else if(_[_0x90e1('0x2c')]([_0x90e1('0x2d'),_0x90e1('0x32')],_0x3d898f[_0x90e1('0x2e')])&&_0x3d898f[_0x90e1('0x33')]&&_0x3d898f[_0x90e1('0x34')]){_0x573bb3[_0x3d898f['idField'][_0x90e1('0x30')]()]=_0x3d898f[_0x90e1('0x35')][_0x90e1('0x31')]();}else if(_0x3d898f[_0x90e1('0x2e')]===_0x90e1('0x36')&&_0x3d898f['variableName']&&_0x3d898f['idField']&&_0x3d898f[_0x90e1('0x34')]){_0x573bb3[_0x3d898f[_0x90e1('0x33')]['toLowerCase']()]=_0x4819c8[_0x3d898f['variableName']][_0x90e1('0x31')]();}else if(_0x3d898f[_0x90e1('0x2e')]===_0x90e1('0x37')&&_0x3d898f['Variable']&&_0x3d898f[_0x90e1('0x38')][_0x90e1('0x39')]&&_0x3d898f['idField']&&_0x3d898f[_0x90e1('0x34')]){_0x573bb3[_0x3d898f[_0x90e1('0x33')]['toLowerCase']()]=_0x4819c8[_0x3d898f[_0x90e1('0x38')][_0x90e1('0x39')][_0x90e1('0x30')]()][_0x90e1('0x31')]();}});}return _0x573bb3;}function getTicket(_0x5c134e,_0x32b15b,_0x3503fe,_0x54e092,_0x1fa486,_0x2b6f09){return function(_0x298e8b){logger[_0x90e1('0xd')]('['+[_0x5c134e[_0x90e1('0xe')]()]+_0x90e1('0x3a'),_0x298e8b);return new Promise(function(_0x57d836,_0x2e340e){var _0x1c8a03=_0x5c134e[_0x90e1('0x30')]()===_0x90e1('0x3b')?_0x298e8b['userId']:_0x298e8b['endUserId'];var _0x932448={'method':'POST','uri':_0x3503fe+'incident'+'?'+_0x2b6f09,'body':Object[_0x90e1('0x3c')]({},{'active':'true','caller_id':_0x1c8a03,'assigned_to':_0x298e8b['userId'],'short_description':intUtil[_0x90e1('0x3d')](_0x54e092[_0x90e1('0x3e')],_0x1fa486,'\x20'),'description':intUtil[_0x90e1('0x3d')](_0x54e092[_0x90e1('0x3f')],_0x1fa486,'\x0a')},getCustomFields(_0x54e092['Fields'],_0x1fa486)),'auth':_0x32b15b,'json':!![]};return rp(_0x932448)[_0x90e1('0x18')](function(_0x291a78){logger['info']('['+[_0x5c134e[_0x90e1('0xe')]()]+_0x90e1('0x40'),_0x291a78[_0x90e1('0x19')]);_0x298e8b[_0x90e1('0x41')]=_0x291a78[_0x90e1('0x19')]['sys_id'];_0x298e8b[_0x90e1('0x42')]=_0x291a78[_0x90e1('0x19')]['number'];logger['info']('['+[_0x5c134e[_0x90e1('0xe')]()]+_0x90e1('0x43'),_0x298e8b);_0x57d836(_0x298e8b);})[_0x90e1('0x10')](function(_0x29c25a){logger[_0x90e1('0x11')]('['+[_0x5c134e[_0x90e1('0xe')]()]+']',_0x29c25a['message']);_0x2e340e(_0x29c25a[_0x90e1('0x12')]);});});};}function createRemoteTag(_0x402165,_0x28620b,_0x53ee39,_0x5eec45){return new Promise(function(_0x585693,_0x40e985){var _0x197135={'method':_0x90e1('0x20'),'uri':_0x53ee39+_0x90e1('0x44')+'?'+_0x5eec45,'body':{'short_description':_0x402165,'global':!![],'active':!![],'name':_0x402165},'auth':_0x28620b,'json':!![]};return rp(_0x197135)['then'](function(_0x4dca35){var _0x31f566=_0x4dca35[_0x90e1('0x19')][_0x90e1('0xc')];_0x585693(_0x31f566);});});}function getRemoteTag(_0x39067e,_0x2e8aa7,_0x1bbc66,_0xd3a0e1,_0x24b74a){return new Promise(function(_0x315548,_0x4865ba){var _0xa18f7b={'method':_0x90e1('0x45'),'uri':_0x1bbc66+_0x90e1('0x44')+_0x90e1('0x46')+_0x39067e+'&'+_0xd3a0e1,'auth':_0x2e8aa7,'json':!![]};return rp(_0xa18f7b)[_0x90e1('0x18')](function(_0xe20567){if(_0xe20567[_0x90e1('0x19')][_0x90e1('0xa')]>0x0){var _0x52c32f=_0xe20567[_0x90e1('0x19')][0x0][_0x90e1('0xc')];_0x315548(_0x52c32f);}else{return createRemoteTag(_0x39067e,_0x2e8aa7,_0x1bbc66,_0xd3a0e1)[_0x90e1('0x18')](function(_0x15142a){_0x315548(_0x15142a);});}});});}function assignTagToIncident(_0x3478fa,_0x1226f9,_0x28e396,_0x400b8b,_0x1effe7){return new Promise(function(_0x38eb49,_0x2da614){var _0x51b589={'method':'POST','uri':_0x28e396+'label_entry'+'?'+_0x1effe7,'body':{'label':_0x3478fa,'table':_0x90e1('0x47'),'id_type':_0x90e1('0x48'),'table_key':_0x400b8b[_0x90e1('0x41')],'title':_0x90e1('0x49')+_0x400b8b[_0x90e1('0x42')],'id_display':_0x400b8b['ticketNumber']},'auth':_0x1226f9,'json':!![]};return rp(_0x51b589)[_0x90e1('0x18')](function(_0x3835f4){_0x38eb49();})[_0x90e1('0x10')](function(){_0x38eb49();});});}function manageTags(_0x476ccf,_0x5c3811,_0x2ed1b7,_0x49f218,_0x5819ec,_0x20d07c,_0x273609){return new Promise(function(_0xe406e6,_0xbda6af){var _0x3b19bd=[];_0x5c3811[_0x90e1('0x2b')](function(_0x1555cd){_0x3b19bd[_0x90e1('0x4a')](getRemoteTag(_0x1555cd,_0x2ed1b7,_0x49f218,_0x20d07c,_0x273609));});return Promise[_0x90e1('0x4b')](_0x3b19bd)['then'](function(_0x330b20){if(_0x330b20[_0x90e1('0xa')]){logger['info']('['+[_0x476ccf[_0x90e1('0xe')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x330b20);var _0x1a709e=[];_0x330b20['forEach'](function(_0x437d9e){_0x1a709e['push'](assignTagToIncident(_0x437d9e,_0x2ed1b7,_0x49f218,_0x5819ec,_0x20d07c));});return Promise['all'](_0x1a709e)[_0x90e1('0x18')](function(){_0xe406e6();})[_0x90e1('0x10')](function(){_0xe406e6();});}else{_0xe406e6();}});});}function getTags(_0x3bccf9,_0x35d54e,_0x26a93b,_0x5edf0d,_0x2ddb23,_0x4a9e90){return function(_0x329c48){return new Promise(function(_0x3cd352,_0x1387cf){var _0x3ce866=[];var _0x1d3b53=_0x5edf0d['Tags'];if(_0x1d3b53&&_0x1d3b53[_0x90e1('0xa')]>0x0){_0x3ce866=_[_0x90e1('0x4c')](_0x1d3b53,'name');}if(_0x3ce866[_0x90e1('0xa')]>0x0){return manageTags(_0x3bccf9,_0x3ce866,_0x35d54e,_0x26a93b,_0x329c48,_0x2ddb23,_0x4a9e90)[_0x90e1('0x18')](function(){_0x3cd352(_0x329c48);});}else{_0x3cd352(_0x329c48);}});};}function emit(_0x4e45c7,_0x25227a,_0x2f8690){var _0x487261=_0x90e1('0x4d')+_0x90e1('0x4e')+_0x90e1('0x4f')+_0x90e1('0x50');var _0x41429b={'uri':_0x4e45c7+_0x90e1('0x51')+_0x2f8690+_0x487261};io['to'](util['format']('user:%s',_0x25227a))[_0x90e1('0x52')](_0x90e1('0x53'),_0x41429b);}exports['cs']=function(_0x17df1e,_0x1ef31d,_0x2ddb01,_0x22dc8a,_0x45d461,_0x3424ee,_0x1b0ba0,_0x4cfd14){var _0x5eb155={};var _0x281c58={'user':_0x3424ee['username'],'pass':_0x3424ee['password']};var _0x279aaa='sysparm_limit=1';var _0x12da71=_0x90e1('0x54');_0x3424ee[_0x90e1('0x55')]=intUtil['stripTrailingSlash'](_0x3424ee['remoteUri']);_0x3424ee[_0x90e1('0x56')]=intUtil['stripTrailingSlash'](_0x3424ee[_0x90e1('0x56')]);var _0x58f2e4=util['format'](_0x90e1('0x57'),_0x3424ee['remoteUri']);_0x5eb155[_0x90e1('0x15')]=!_[_0x90e1('0x58')](_0x22dc8a)?_0x22dc8a[_0x90e1('0x59')]:null;_0x5eb155[_0x90e1('0x1d')]=_0x3424ee['email'];_0x5eb155['endUserNumber']=_0x4cfd14[_0x90e1('0x30')]()===_0x90e1('0x3b')?_0x1ef31d[_0x90e1('0x5a')]:_0x1ef31d[_0x90e1('0x5b')];_0x5eb155[_0x90e1('0x5c')]=_0x4cfd14===_0x90e1('0x5d')||_0x4cfd14===_0x90e1('0x5e')?_0x90e1('0x5d'):_0x90e1('0x3b');var _0x1bebba=util['format'](_0x90e1('0x5f'),_0x3424ee[_0x90e1('0x56')],_0x1ef31d[_0x90e1('0x60')],md5(_0x1ef31d[_0x90e1('0x60')]));if(_0x45d461&&_0x45d461[_0x90e1('0x61')]){logger['info'](_0x90e1('0x62'),_0x90e1('0x63'));_0x1ef31d[_0x90e1('0x64')]=_0x1bebba;}else if(_0x1b0ba0&&_0x1b0ba0[_0x90e1('0x65')]&&_0x1b0ba0['recordingFormat']!==_0x90e1('0x66')){logger[_0x90e1('0xd')](_0x90e1('0x67'),'Recording\x20is\x20enabled!');_0x1ef31d[_0x90e1('0x64')]=_0x1bebba;}else{_0x1ef31d[_0x90e1('0x64')]='';}return getAdminUser(_0x4cfd14,_0x281c58,_0x5eb155,_0x58f2e4,_0x12da71,_0x279aaa)[_0x90e1('0x18')](getUser(_0x4cfd14,_0x281c58,_0x58f2e4,_0x12da71,_0x279aaa))[_0x90e1('0x18')](getEndUser(_0x4cfd14,_0x281c58,_0x58f2e4,_0x12da71,_0x279aaa))[_0x90e1('0x18')](getTicket(_0x4cfd14,_0x281c58,_0x58f2e4,_0x2ddb01,_0x1ef31d,_0x12da71))[_0x90e1('0x18')](function(_0x32ea93){logger['info'](util[_0x90e1('0x68')](_0x90e1('0x69'),_0x32ea93['ticketId']));logger[_0x90e1('0xd')](util[_0x90e1('0x68')](_0x90e1('0x6a'),_0x4cfd14));if(_0x4cfd14!=='unmanaged'){logger[_0x90e1('0xd')]('['+[_0x4cfd14[_0x90e1('0xe')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3424ee['remoteUri'],_0x22dc8a[_0x90e1('0x39')],_0x32ea93[_0x90e1('0x41')]);}})[_0x90e1('0x10')](function(_0x5d79ca){logger[_0x90e1('0x11')]('['+[_0x4cfd14['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x90e1('0x6b')](_0x5d79ca,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index d1e6190..17fb1e6 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 _0xcf33=['variable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','Ticket\x20created!','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','outbound','uri','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','error','lastevent','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','direction','length','forEach','variableName','push','JSON','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','string','nameField','toLowerCase','content','toString','type','idField','customField','custom_fields'];(function(_0x490c45,_0x97b829){var _0x82738e=function(_0x215c17){while(--_0x215c17){_0x490c45['push'](_0x490c45['shift']());}};_0x82738e(++_0x97b829);}(_0xcf33,0x125));var _0x3cf3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xcf33[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var rp=require(_0x3cf3('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x3cf3('0x1'));var Redis=require(_0x3cf3('0x2'));var intUtil=require('./util');var config=require(_0x3cf3('0x3'));var logger=require(_0x3cf3('0x4'))(_0x3cf3('0x5'));config[_0x3cf3('0x6')]=_[_0x3cf3('0x7')](config[_0x3cf3('0x6')],{'host':_0x3cf3('0x8'),'port':0x18eb});var io=require(_0x3cf3('0x9'))(new Redis(config['redis']));var def={'method':_0x3cf3('0xa'),'json':!![]};function emit(_0x4ce1ac,_0x13c108,_0xbd2b22){io['to'](_0x4ce1ac)[_0x3cf3('0xb')](_0x13c108,_0xbd2b22);}function getTicket(_0x26ee34,_0x57e94c,_0x299a59,_0x44acac,_0x4102f1,_0x8c1b9c,_0x1a5725,_0x1a154a){logger[_0x3cf3('0xc')](_0x3cf3('0xd'));var _0x29997f=new Date();var _0x306a39=[{'name':'name','value':intUtil[_0x3cf3('0xe')](_0x44acac[_0x3cf3('0xf')],_0x4102f1,'\x20')},{'name':_0x3cf3('0x10'),'value':_0x57e94c['id']},{'name':_0x3cf3('0x11'),'value':_0x57e94c['id']},{'name':'description','value':intUtil['getString'](_0x44acac['Descriptions'],_0x4102f1,'\x0a')},{'name':_0x3cf3('0x12'),'value':_0x29997f[_0x3cf3('0x13')]()[_0x3cf3('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x3cf3('0x15'),'value':'0'},{'name':_0x3cf3('0x16'),'value':'15'},{'name':_0x3cf3('0x17'),'value':_0x299a59['id']},{'name':_0x3cf3('0x18'),'value':'Contacts'},{'name':'parent_name','value':_0x299a59['name']},{'name':_0x3cf3('0x19'),'value':_0x1a154a}];if(_0x8c1b9c[_0x3cf3('0x1a')]){_[_0x3cf3('0x1b')](_0x8c1b9c,function(_0x44a70e){if(_0x4102f1[_0x44a70e[_0x3cf3('0x1c')]]){_0x306a39[_0x3cf3('0x1d')]({'name':_0x44a70e['idField'],'value':_0x4102f1[_0x44a70e[_0x3cf3('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x3cf3('0x1e'),'response_type':_0x3cf3('0x1e'),'rest_data':JSON[_0x3cf3('0x1f')]({'session':_0x1a5725['id'],'module_name':'Calls','name_value_list':_0x306a39})}});}function getAuth(_0x4f0ff7){return util[_0x3cf3('0x20')](_0x3cf3('0x21'),new Buffer(_0x4f0ff7[_0x3cf3('0x22')]+':X')['toString'](_0x3cf3('0x23')));}function getServerInfo(_0x37fd44){return request({'form':{'method':_0x3cf3('0x24'),'input_type':_0x3cf3('0x1e'),'response_type':_0x3cf3('0x1e'),'rest_data':JSON['stringify']({'session':_0x37fd44['id']})}});}function getUser(_0x16f7e2,_0xb656d4,_0x3a9c9b){if(!_[_0x3cf3('0x25')](_0xb656d4)){logger[_0x3cf3('0xc')]('Getting\x20agent\x20with\x20name',_0xb656d4);return request({'form':{'method':_0x3cf3('0x26'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x3cf3('0x1f')]({'session':_0x3a9c9b['id'],'module_name':_0x3cf3('0x27'),'query':util[_0x3cf3('0x20')](_0x3cf3('0x28'),_0xb656d4),'order_by':'','offset':'0','select_fields':['id',_0x3cf3('0x29'),_0x3cf3('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3cf3('0x2b')](function(_0x36b253){if(_0x36b253[_0x3cf3('0x2c')]['length']){var _0x241178=_[_0x3cf3('0x2d')](_0x36b253[_0x3cf3('0x2c')],function(_0xed97f3){return _0xed97f3[_0x3cf3('0x2e')][_0x3cf3('0x2a')][_0x3cf3('0x2f')]===_0xb656d4;});if(_0x241178){logger['info'](_0x3cf3('0x30'));return BPromise[_0x3cf3('0x31')]({'id':_0x241178[_0x3cf3('0x2e')]['id'][_0x3cf3('0x2f')],'name':_0x241178[_0x3cf3('0x2e')][_0x3cf3('0x29')][_0x3cf3('0x2f')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3a9c9b[_0x3cf3('0x2e')]['user_id'][_0x3cf3('0x2f')],'name':_0x3a9c9b[_0x3cf3('0x2e')][_0x3cf3('0x2a')]['value']});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3a9c9b['name_value_list']['user_id'][_0x3cf3('0x2f')],'name':_0x3a9c9b[_0x3cf3('0x2e')][_0x3cf3('0x2a')][_0x3cf3('0x2f')]});}}function getEndUser(_0x2fc133,_0x5666d6,_0x4c3603,_0x5d99b8){logger[_0x3cf3('0xc')](_0x3cf3('0x32'),_0x4c3603);return request({'form':{'method':_0x3cf3('0x26'),'input_type':_0x3cf3('0x1e'),'response_type':_0x3cf3('0x1e'),'rest_data':JSON[_0x3cf3('0x1f')]({'session':_0x5d99b8['id'],'module_name':_0x3cf3('0x33'),'query':util['format'](_0x3cf3('0x34'),_0x4c3603),'order_by':'','offset':'0','select_fields':['id','name',_0x3cf3('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x170240){if(_0x170240['entry_list'][_0x3cf3('0x1a')]){var _0x587279=_['find'](_0x170240[_0x3cf3('0x2c')],function(_0x7a3c6a){return _0x7a3c6a[_0x3cf3('0x2e')]['phone_home'][_0x3cf3('0x2f')]===_0x4c3603;});if(_0x587279){logger[_0x3cf3('0xc')](_0x3cf3('0x36'));return BPromise[_0x3cf3('0x31')]({'id':_0x587279['name_value_list']['id'][_0x3cf3('0x2f')],'name':_0x587279[_0x3cf3('0x2e')][_0x3cf3('0x29')][_0x3cf3('0x2f')],'phone':_0x587279[_0x3cf3('0x2e')]['phone_home'][_0x3cf3('0x2f')]});}}else{logger[_0x3cf3('0xc')](_0x3cf3('0x37'));return request({'form':{'method':_0x3cf3('0x38'),'input_type':_0x3cf3('0x1e'),'response_type':_0x3cf3('0x1e'),'rest_data':JSON[_0x3cf3('0x1f')]({'session':_0x5d99b8['id'],'module_name':'Contacts','name_value_list':[{'name':_0x3cf3('0x39'),'value':_0x5666d6!==_0x3cf3('0x3a')?_0x5666d6:util[_0x3cf3('0x20')](_0x3cf3('0x3b'),_0x4c3603)},{'name':'phone_home','value':_0x4c3603}]})}})[_0x3cf3('0x2b')](function(_0x16adc5){logger['info'](_0x3cf3('0x3c'));return BPromise[_0x3cf3('0x31')]({'id':_0x16adc5['id'],'name':_0x16adc5[_0x3cf3('0x2c')]['first_name']['value'],'phone':_0x16adc5['entry_list'][_0x3cf3('0x35')][_0x3cf3('0x2f')]});});}});}function request(_0x2dc511){logger[_0x3cf3('0x3d')]('[HTTP]',JSON['stringify'](_0x2dc511));return rp(_[_0x3cf3('0x3e')](def,_0x2dc511));}function getTags(_0x7734c4,_0x32bc8d){var _0x3b9464=[];if(_0x7734c4&&_0x7734c4[_0x3cf3('0x1a')]>0x0){_0x3b9464=_[_0x3cf3('0x3f')](_0x7734c4,_0x32bc8d);}return _0x3b9464;}function getCustomFields(_0x254685,_0x5acae6){var _0x5d5c0d=[];var _0x422eb3={'custom_fields':[]};if(_0x254685['length']>0x0){_[_0x3cf3('0x1b')](_0x254685,function(_0x576f8d){if(_0x576f8d['type']===_0x3cf3('0x40')&&_0x576f8d['nameField']&&!_0x576f8d['customField']){_0x422eb3[_0x576f8d[_0x3cf3('0x41')][_0x3cf3('0x42')]()]=_0x576f8d[_0x3cf3('0x43')][_0x3cf3('0x44')]();}else if(_0x576f8d[_0x3cf3('0x45')]===_0x3cf3('0x40')&&_0x576f8d[_0x3cf3('0x46')]&&_0x576f8d[_0x3cf3('0x47')]){_0x422eb3[_0x3cf3('0x48')][_0x3cf3('0x1d')]({'id':_0x576f8d['idField'],'value':_0x576f8d['content'][_0x3cf3('0x44')]()});}else if(_0x576f8d['type']===_0x3cf3('0x49')&&_0x576f8d[_0x3cf3('0x1c')]&&_0x576f8d[_0x3cf3('0x46')]&&_0x576f8d[_0x3cf3('0x47')]){_0x5acae6[_0x576f8d['variableName']]&&_0x422eb3[_0x3cf3('0x48')][_0x3cf3('0x1d')]({'id':_0x576f8d['idField'],'value':_0x5acae6[_0x576f8d['variableName']][_0x3cf3('0x44')]()});}else if(_0x576f8d['type']==='customVariable'&&_0x576f8d[_0x3cf3('0x4a')]&&_0x576f8d[_0x3cf3('0x4a')][_0x3cf3('0x29')]&&_0x576f8d[_0x3cf3('0x46')]&&_0x576f8d[_0x3cf3('0x47')]){_0x5acae6[_0x576f8d[_0x3cf3('0x4a')][_0x3cf3('0x29')]['toLowerCase']()]&&_0x422eb3[_0x3cf3('0x48')][_0x3cf3('0x1d')]({'id':_0x576f8d[_0x3cf3('0x46')],'value':_0x5acae6[_0x576f8d['Variable'][_0x3cf3('0x29')]['toLowerCase']()][_0x3cf3('0x44')]()});}});}return _0x422eb3;}function getConnection(_0x5022a1){return request({'method':_0x3cf3('0xa'),'form':{'method':_0x3cf3('0x4b'),'input_type':_0x3cf3('0x1e'),'response_type':_0x3cf3('0x1e'),'rest_data':JSON[_0x3cf3('0x1f')]({'user_auth':{'user_name':_0x5022a1[_0x3cf3('0x4c')],'password':_0x5022a1[_0x3cf3('0x4d')],'encryption':_0x3cf3('0x4e')},'application':_0x3cf3('0x4f')})}})['then'](function(_0x8ab654){var _0x5580bf=_0x8ab654;if(_0x5580bf['id']){def[_0x3cf3('0x50')]=_0x5580bf['id'];return BPromise[_0x3cf3('0x31')](_0x5580bf);}else{throw new Error(util['format'](_0x3cf3('0x51'),_0x5022a1['id']));}});}function setRelationship(_0x227398,_0x372486,_0x408173,_0x457a10){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x227398['id'],'module_name':'Calls','module_id':_0x408173['id'],'link_field_name':_0x457a10,'related_ids':[_0x372486['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x3cf3('0x52')]=function(_0x57ce1f,_0x540172,_0x1e33f2,_0x7fd054,_0x18dcf0,_0x2e1f29){var _0x551cf3,_0x3fe1fc,_0x5142d7,_0x43646a;_0x2e1f29[_0x3cf3('0x53')]=intUtil[_0x3cf3('0x54')](_0x2e1f29['remoteUri']);_0x2e1f29[_0x3cf3('0x55')]=intUtil[_0x3cf3('0x54')](_0x2e1f29[_0x3cf3('0x55')]);def['uri']=util[_0x3cf3('0x20')]('%s/service/v4_1/rest.php',_0x2e1f29[_0x3cf3('0x53')]);if(_0x18dcf0&&_0x18dcf0[_0x3cf3('0x56')]){logger[_0x3cf3('0xc')](_0x3cf3('0x57'),_0x3cf3('0x58'));_0x540172[_0x3cf3('0x59')]=util[_0x3cf3('0x20')](_0x3cf3('0x5a'),_0x2e1f29[_0x3cf3('0x55')],_0x540172['uniqueid'],md5(_0x540172[_0x3cf3('0x5b')]));}else{_0x540172[_0x3cf3('0x59')]='';}return getConnection(_0x2e1f29)['then'](function(_0x288dbc){_0x43646a=_0x288dbc;return getUser(_0x2e1f29,_0x7fd054[_0x3cf3('0x29')],_0x43646a);})['then'](function(_0x936aa8){_0x551cf3=_0x936aa8;logger['info'](_0x3cf3('0x5c'),_0x551cf3['id']);return getEndUser(_0x2e1f29,_0x540172[_0x3cf3('0x5d')],_0x540172['calleridnum'],_0x43646a);})[_0x3cf3('0x2b')](function(_0x5638f7){_0x3fe1fc=_0x5638f7;logger[_0x3cf3('0xc')]('The\x20Enduser\x20ID\x20is:',_0x3fe1fc['id']);return getTicket(_0x2e1f29,_0x551cf3,_0x3fe1fc,_0x1e33f2,_0x540172,_0x1e33f2[_0x3cf3('0x5e')],_0x43646a,_0x3cf3('0x5f'));})[_0x3cf3('0x2b')](function(_0x283f86){_0x5142d7=_0x283f86;logger[_0x3cf3('0xc')](_0x3cf3('0x60'));logger[_0x3cf3('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5142d7['id']);return setRelationship(_0x43646a,_0x551cf3,_0x5142d7,_0x3cf3('0x61'));})[_0x3cf3('0x2b')](function(){return setRelationship(_0x43646a,_0x3fe1fc,_0x5142d7,_0x3cf3('0x62'));})[_0x3cf3('0x2b')](function(){return getServerInfo(_0x43646a);})[_0x3cf3('0x2b')](function(_0x2e89d0){var _0x2aa837=parseInt(_0x2e89d0[_0x3cf3('0x63')]['charAt'](0x0));var _0x3e4119=util['format'](_0x3cf3('0x64'),_0x2e1f29[_0x3cf3('0x53')],_0x5142d7['id']);if(_0x2aa837>0x6){_0x3e4119=util[_0x3cf3('0x20')](_0x3cf3('0x65'),_0x2e1f29[_0x3cf3('0x53')],_0x5142d7['id']);}logger[_0x3cf3('0xc')](_0x3cf3('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3cf3('0x20')](_0x3cf3('0x66'),_0x7fd054['name']),_0x3cf3('0x67'),{'uri':_0x3e4119});})[_0x3cf3('0x68')](function(_0x17aefd){logger['error'](_0x3cf3('0x57'),JSON[_0x3cf3('0x1f')](_0x17aefd));});};exports[_0x3cf3('0x69')]=function(_0x4472b6,_0x4c257f,_0x3aacc1,_0x4a115f,_0x2553a2,_0x36ffcf,_0x509034){var _0x3af99a,_0x11d99b,_0x3d9785,_0x464789;_0x36ffcf[_0x3cf3('0x53')]=intUtil[_0x3cf3('0x54')](_0x36ffcf['remoteUri']);_0x36ffcf[_0x3cf3('0x55')]=intUtil['stripTrailingSlash'](_0x36ffcf['serverUrl']);def[_0x3cf3('0x6a')]=util[_0x3cf3('0x20')](_0x3cf3('0x6b'),_0x36ffcf['remoteUri']);if(_0x509034&&_0x509034[_0x3cf3('0x6c')]&&_0x509034['recordingFormat']!==_0x3cf3('0x6d')){logger[_0x3cf3('0xc')](_0x3cf3('0x6e'),_0x3cf3('0x58'));_0x4c257f[_0x3cf3('0x59')]=util[_0x3cf3('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36ffcf['serverUrl'],_0x4c257f[_0x3cf3('0x5b')],md5(_0x4c257f[_0x3cf3('0x5b')]));}return getConnection(_0x36ffcf)[_0x3cf3('0x2b')](function(_0x109dbb){_0x464789=_0x109dbb;return getUser(_0x36ffcf,_0x4a115f[_0x3cf3('0x29')],_0x464789);})[_0x3cf3('0x2b')](function(_0x155f03){_0x3af99a=_0x155f03;logger['info'](_0x3cf3('0x5c'),_0x3af99a['id']);return getEndUser(_0x36ffcf,_0x4c257f['destcalleridname'],_0x4c257f[_0x3cf3('0x6f')],_0x464789);})[_0x3cf3('0x2b')](function(_0xf122de){_0x11d99b=_0xf122de;logger[_0x3cf3('0xc')]('The\x20Enduser\x20ID\x20is:',_0x11d99b['id']);return getTicket(_0x36ffcf,_0x3af99a,_0x11d99b,_0x3aacc1,_0x4c257f,_0x3aacc1[_0x3cf3('0x5e')],_0x464789,_0x3cf3('0x70'));})[_0x3cf3('0x2b')](function(_0x57a712){_0x3d9785=_0x57a712;logger[_0x3cf3('0xc')](_0x3cf3('0x60'));logger[_0x3cf3('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3d9785['id']);return setRelationship(_0x464789,_0x3af99a,_0x3d9785,_0x3cf3('0x61'));})[_0x3cf3('0x2b')](function(){return setRelationship(_0x464789,_0x11d99b,_0x3d9785,_0x3cf3('0x62'));})[_0x3cf3('0x2b')](function(){return getServerInfo(_0x464789);})['then'](function(_0xeb0cb0){var _0x572e05=parseInt(_0xeb0cb0[_0x3cf3('0x63')][_0x3cf3('0x71')](0x0));var _0x235c8e=util[_0x3cf3('0x20')](_0x3cf3('0x64'),_0x36ffcf['remoteUri'],_0x3d9785['id']);if(_0x572e05>0x6){_0x235c8e=util[_0x3cf3('0x20')](_0x3cf3('0x65'),_0x36ffcf[_0x3cf3('0x53')],_0x3d9785['id']);}logger[_0x3cf3('0xc')](_0x3cf3('0x6e'),_0x3cf3('0x72'));emit(util[_0x3cf3('0x20')](_0x3cf3('0x66'),_0x4a115f[_0x3cf3('0x29')]),'trigger:browser:url',{'uri':_0x235c8e});})[_0x3cf3('0x68')](function(_0x21a1b3){logger['error']('[OUTBOUND]',JSON[_0x3cf3('0x1f')](_0x21a1b3));});};exports[_0x3cf3('0x73')]=function(_0x424364,_0x26a93e,_0x6671b0,_0xfcdfdf,_0x3b45aa,_0x44a3e2){var _0xd4cb5b,_0x3ac93a,_0x47768a,_0x273fe1;_0x44a3e2[_0x3cf3('0x53')]=intUtil[_0x3cf3('0x54')](_0x44a3e2['remoteUri']);_0x44a3e2['serverUrl']=intUtil[_0x3cf3('0x54')](_0x44a3e2[_0x3cf3('0x55')]);def[_0x3cf3('0x6a')]=util[_0x3cf3('0x20')](_0x3cf3('0x6b'),_0x44a3e2[_0x3cf3('0x53')]);if(_0x3b45aa&&_0x3b45aa['monitor_format']){logger[_0x3cf3('0xc')]('['+_0x26a93e['lastevent'][_0x3cf3('0x74')]()+']','Recording\x20is\x20enabled!');_0x26a93e[_0x3cf3('0x59')]=util[_0x3cf3('0x20')](_0x3cf3('0x5a'),_0x44a3e2[_0x3cf3('0x55')],_0x26a93e[_0x3cf3('0x5b')],md5(_0x26a93e[_0x3cf3('0x5b')]));}else{_0x26a93e[_0x3cf3('0x59')]='';}return getConnection(_0x44a3e2)[_0x3cf3('0x2b')](function(_0x571039){_0x273fe1=_0x571039;if(!_[_0x3cf3('0x25')](_0xfcdfdf)){return getUser(_0x44a3e2,_0xfcdfdf[_0x3cf3('0x29')],_0x273fe1);}else{return getUser(_0x44a3e2,null,_0x273fe1);}})[_0x3cf3('0x2b')](function(_0x2a562c){_0xd4cb5b=_0x2a562c;logger[_0x3cf3('0xc')]('The\x20User\x20ID\x20is:',_0xd4cb5b['id']);return getEndUser(_0x44a3e2,_0x26a93e[_0x3cf3('0x5d')],_0x26a93e[_0x3cf3('0x75')],_0x273fe1);})[_0x3cf3('0x2b')](function(_0x204c12){_0x3ac93a=_0x204c12;logger[_0x3cf3('0xc')](_0x3cf3('0x76'),_0x3ac93a['id']);return getTicket(_0x44a3e2,_0xd4cb5b,_0x3ac93a,_0x6671b0,_0x26a93e,_0x6671b0[_0x3cf3('0x5e')],_0x273fe1,_0x3cf3('0x5f'));})[_0x3cf3('0x2b')](function(_0x915da1){_0x47768a=_0x915da1;logger[_0x3cf3('0xc')]('Ticket\x20created!');logger[_0x3cf3('0xc')](_0x3cf3('0x77'),_0x47768a['id']);return setRelationship(_0x273fe1,_0xd4cb5b,_0x47768a,_0x3cf3('0x61'));})[_0x3cf3('0x2b')](function(){return setRelationship(_0x273fe1,_0x3ac93a,_0x47768a,_0x3cf3('0x62'));})['then'](function(){return getServerInfo(_0x273fe1);})[_0x3cf3('0x68')](function(_0xe7828){logger[_0x3cf3('0x78')]('['+_0x26a93e[_0x3cf3('0x79')]['toUpperCase']()+']',JSON[_0x3cf3('0x1f')](_0xe7828));});}; \ No newline at end of file +var _0xa4fd=['replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','user_name','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','toString','type','custom_fields','variable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','Outbound','Ticket\x20created!','users','contacts','version','[OUTBOUND]','lastevent','toUpperCase','isNil','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice'];(function(_0x13c5a9,_0x547d90){var _0x25f7dc=function(_0x1fe88e){while(--_0x1fe88e){_0x13c5a9['push'](_0x13c5a9['shift']());}};_0x25f7dc(++_0x547d90);}(_0xa4fd,0x161));var _0xda4f=function(_0x582f1c,_0x3c652a){_0x582f1c=_0x582f1c-0x0;var _0x5747b9=_0xa4fd[_0x582f1c];return _0x5747b9;};'use strict';var _=require(_0xda4f('0x0'));var rp=require(_0xda4f('0x1'));var BPromise=require(_0xda4f('0x2'));var md5=require(_0xda4f('0x3'));var util=require(_0xda4f('0x4'));var Redis=require(_0xda4f('0x5'));var intUtil=require(_0xda4f('0x6'));var config=require(_0xda4f('0x7'));var logger=require('../../../../config/logger')(_0xda4f('0x8'));config['redis']=_['defaults'](config[_0xda4f('0x9')],{'host':_0xda4f('0xa'),'port':0x18eb});var io=require(_0xda4f('0xb'))(new Redis(config[_0xda4f('0x9')]));var def={'method':_0xda4f('0xc'),'json':!![]};function emit(_0x2c837e,_0x1519d4,_0xf76943){io['to'](_0x2c837e)[_0xda4f('0xd')](_0x1519d4,_0xf76943);}function getTicket(_0x2bdfe5,_0x4efe19,_0x112202,_0x16ea27,_0x11c921,_0x10a663,_0x21cd44,_0x58c958){logger[_0xda4f('0xe')](_0xda4f('0xf'));var _0x1b1071=new Date();var _0x40ad83=[{'name':_0xda4f('0x10'),'value':intUtil[_0xda4f('0x11')](_0x16ea27[_0xda4f('0x12')],_0x11c921,'\x20')},{'name':_0xda4f('0x13'),'value':_0x4efe19['id']},{'name':_0xda4f('0x14'),'value':_0x4efe19['id']},{'name':'description','value':intUtil[_0xda4f('0x11')](_0x16ea27[_0xda4f('0x15')],_0x11c921,'\x0a')},{'name':_0xda4f('0x16'),'value':_0x1b1071[_0xda4f('0x17')]()[_0xda4f('0x18')](0x0,0x13)[_0xda4f('0x19')]('T','\x20')},{'name':_0xda4f('0x1a'),'value':'0'},{'name':_0xda4f('0x1b'),'value':'15'},{'name':'parent_id','value':_0x112202['id']},{'name':_0xda4f('0x1c'),'value':_0xda4f('0x1d')},{'name':_0xda4f('0x1e'),'value':_0x112202['name']},{'name':_0xda4f('0x1f'),'value':_0x58c958}];if(_0x10a663['length']){_[_0xda4f('0x20')](_0x10a663,function(_0x32270d){if(_0x11c921[_0x32270d[_0xda4f('0x21')]]){_0x40ad83[_0xda4f('0x22')]({'name':_0x32270d[_0xda4f('0x23')],'value':_0x11c921[_0x32270d[_0xda4f('0x21')]]});}});}return request({'form':{'method':_0xda4f('0x24'),'input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x21cd44['id'],'module_name':_0xda4f('0x27'),'name_value_list':_0x40ad83})}});}function getAuth(_0x262bbe){return util['format'](_0xda4f('0x28'),new Buffer(_0x262bbe['apiKey']+':X')['toString'](_0xda4f('0x29')));}function getServerInfo(_0x251d46){return request({'form':{'method':_0xda4f('0x2a'),'input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x251d46['id']})}});}function getUser(_0x247234,_0x44accb,_0x2b5217){if(!_['isNil'](_0x44accb)){logger['info'](_0xda4f('0x2b'),_0x44accb);return request({'form':{'method':_0xda4f('0x2c'),'input_type':'JSON','response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x2b5217['id'],'module_name':_0xda4f('0x2d'),'query':util[_0xda4f('0x2e')](_0xda4f('0x2f'),_0x44accb),'order_by':'','offset':'0','select_fields':['id',_0xda4f('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xda4f('0x30')](function(_0x416791){if(_0x416791[_0xda4f('0x31')]['length']){var _0x5945a6=_[_0xda4f('0x32')](_0x416791[_0xda4f('0x31')],function(_0x24e491){return _0x24e491['name_value_list'][_0xda4f('0x33')][_0xda4f('0x34')]===_0x44accb;});if(_0x5945a6){logger[_0xda4f('0xe')](_0xda4f('0x35'));return BPromise[_0xda4f('0x36')]({'id':_0x5945a6[_0xda4f('0x37')]['id']['value'],'name':_0x5945a6[_0xda4f('0x37')]['name'][_0xda4f('0x34')]});}}logger[_0xda4f('0xe')](_0xda4f('0x38'));return BPromise[_0xda4f('0x36')]({'id':_0x2b5217[_0xda4f('0x37')][_0xda4f('0x39')][_0xda4f('0x34')],'name':_0x2b5217[_0xda4f('0x37')]['user_name'][_0xda4f('0x34')]});});}else{logger[_0xda4f('0xe')](_0xda4f('0x3a'));return BPromise[_0xda4f('0x36')]({'id':_0x2b5217[_0xda4f('0x37')][_0xda4f('0x39')][_0xda4f('0x34')],'name':_0x2b5217['name_value_list'][_0xda4f('0x33')][_0xda4f('0x34')]});}}function getEndUser(_0x3dd5e4,_0x3c2cb5,_0x2a8b77,_0x3dbdd7){logger[_0xda4f('0xe')](_0xda4f('0x3b'),_0x2a8b77);return request({'form':{'method':_0xda4f('0x2c'),'input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x3dbdd7['id'],'module_name':_0xda4f('0x1d'),'query':util[_0xda4f('0x2e')](_0xda4f('0x3c'),_0x2a8b77),'order_by':'','offset':'0','select_fields':['id',_0xda4f('0x10'),_0xda4f('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xda4f('0x30')](function(_0x954edf){if(_0x954edf[_0xda4f('0x31')][_0xda4f('0x3e')]){var _0x193ed1=_[_0xda4f('0x32')](_0x954edf['entry_list'],function(_0x24984a){return _0x24984a['name_value_list'][_0xda4f('0x3d')][_0xda4f('0x34')]===_0x2a8b77;});if(_0x193ed1){logger[_0xda4f('0xe')]('Enduser\x20found!');return BPromise[_0xda4f('0x36')]({'id':_0x193ed1['name_value_list']['id'][_0xda4f('0x34')],'name':_0x193ed1[_0xda4f('0x37')][_0xda4f('0x10')][_0xda4f('0x34')],'phone':_0x193ed1[_0xda4f('0x37')][_0xda4f('0x3d')][_0xda4f('0x34')]});}}else{logger[_0xda4f('0xe')](_0xda4f('0x3f'));return request({'form':{'method':_0xda4f('0x24'),'input_type':_0xda4f('0x25'),'response_type':'JSON','rest_data':JSON[_0xda4f('0x26')]({'session':_0x3dbdd7['id'],'module_name':_0xda4f('0x1d'),'name_value_list':[{'name':_0xda4f('0x40'),'value':_0x3c2cb5!==''?_0x3c2cb5:util[_0xda4f('0x2e')]('Caller\x20-\x20%s',_0x2a8b77)},{'name':_0xda4f('0x3d'),'value':_0x2a8b77}]})}})[_0xda4f('0x30')](function(_0x531334){logger[_0xda4f('0xe')](_0xda4f('0x41'));return BPromise[_0xda4f('0x36')]({'id':_0x531334['id'],'name':_0x531334['entry_list'][_0xda4f('0x40')][_0xda4f('0x34')],'phone':_0x531334[_0xda4f('0x31')]['phone_home'][_0xda4f('0x34')]});});}});}function request(_0x14370f){logger[_0xda4f('0x42')](_0xda4f('0x43'),JSON[_0xda4f('0x26')](_0x14370f));return rp(_[_0xda4f('0x44')](def,_0x14370f));}function getTags(_0x2e9aab,_0x680cc0){var _0x4290d2=[];if(_0x2e9aab&&_0x2e9aab[_0xda4f('0x3e')]>0x0){_0x4290d2=_[_0xda4f('0x45')](_0x2e9aab,_0x680cc0);}return _0x4290d2;}function getCustomFields(_0x44e952,_0x4ae696){var _0x38c32d=[];var _0x1551c7={'custom_fields':[]};if(_0x44e952[_0xda4f('0x3e')]>0x0){_['forEach'](_0x44e952,function(_0xe94aa2){if(_0xe94aa2['type']==='string'&&_0xe94aa2[_0xda4f('0x46')]&&!_0xe94aa2[_0xda4f('0x47')]){_0x1551c7[_0xe94aa2[_0xda4f('0x46')][_0xda4f('0x48')]()]=_0xe94aa2[_0xda4f('0x49')][_0xda4f('0x4a')]();}else if(_0xe94aa2[_0xda4f('0x4b')]==='string'&&_0xe94aa2['idField']&&_0xe94aa2[_0xda4f('0x47')]){_0x1551c7[_0xda4f('0x4c')][_0xda4f('0x22')]({'id':_0xe94aa2[_0xda4f('0x23')],'value':_0xe94aa2[_0xda4f('0x49')][_0xda4f('0x4a')]()});}else if(_0xe94aa2[_0xda4f('0x4b')]===_0xda4f('0x4d')&&_0xe94aa2['variableName']&&_0xe94aa2[_0xda4f('0x23')]&&_0xe94aa2['customField']){_0x4ae696[_0xe94aa2[_0xda4f('0x21')]]&&_0x1551c7[_0xda4f('0x4c')][_0xda4f('0x22')]({'id':_0xe94aa2[_0xda4f('0x23')],'value':_0x4ae696[_0xe94aa2[_0xda4f('0x21')]][_0xda4f('0x4a')]()});}else if(_0xe94aa2[_0xda4f('0x4b')]==='customVariable'&&_0xe94aa2[_0xda4f('0x4e')]&&_0xe94aa2[_0xda4f('0x4e')]['name']&&_0xe94aa2[_0xda4f('0x23')]&&_0xe94aa2[_0xda4f('0x47')]){_0x4ae696[_0xe94aa2[_0xda4f('0x4e')][_0xda4f('0x10')][_0xda4f('0x48')]()]&&_0x1551c7[_0xda4f('0x4c')][_0xda4f('0x22')]({'id':_0xe94aa2['idField'],'value':_0x4ae696[_0xe94aa2[_0xda4f('0x4e')][_0xda4f('0x10')]['toLowerCase']()][_0xda4f('0x4a')]()});}});}return _0x1551c7;}function getConnection(_0x47edbb){return request({'method':_0xda4f('0xc'),'form':{'method':'login','input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x47edbb[_0xda4f('0x4f')],'password':_0x47edbb[_0xda4f('0x50')],'encryption':_0xda4f('0x51')},'application':_0xda4f('0x52')})}})[_0xda4f('0x30')](function(_0x4513de){var _0xdb32=_0x4513de;if(_0xdb32['id']){def[_0xda4f('0x53')]=_0xdb32['id'];return BPromise[_0xda4f('0x36')](_0xdb32);}else{throw new Error(util[_0xda4f('0x2e')](_0xda4f('0x54'),_0x47edbb['id']));}});}function setRelationship(_0x1afd91,_0x2ef2a5,_0x849c85,_0x16efc1){return request({'form':{'method':'set_relationship','input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x1afd91['id'],'module_name':_0xda4f('0x27'),'module_id':_0x849c85['id'],'link_field_name':_0x16efc1,'related_ids':[_0x2ef2a5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xda4f('0x55')]=function(_0x2a8a3b,_0x56c882,_0x2d73e2,_0x3394ee,_0x52a103,_0x296d71){var _0x2b05e0,_0xa6626d,_0x3f0b92,_0x85c368;_0x296d71[_0xda4f('0x56')]=intUtil['stripTrailingSlash'](_0x296d71[_0xda4f('0x56')]);_0x296d71[_0xda4f('0x57')]=intUtil[_0xda4f('0x58')](_0x296d71[_0xda4f('0x57')]);def[_0xda4f('0x59')]=util[_0xda4f('0x2e')](_0xda4f('0x5a'),_0x296d71[_0xda4f('0x56')]);if(_0x52a103&&_0x52a103[_0xda4f('0x5b')]){logger['info'](_0xda4f('0x5c'),_0xda4f('0x5d'));_0x56c882[_0xda4f('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x296d71[_0xda4f('0x57')],_0x56c882['uniqueid'],md5(_0x56c882[_0xda4f('0x5f')]));}else{_0x56c882[_0xda4f('0x5e')]='';}return getConnection(_0x296d71)[_0xda4f('0x30')](function(_0x1833f4){_0x85c368=_0x1833f4;return getUser(_0x296d71,_0x3394ee[_0xda4f('0x10')],_0x85c368);})[_0xda4f('0x30')](function(_0x56818d){_0x2b05e0=_0x56818d;logger[_0xda4f('0xe')](_0xda4f('0x60'),_0x2b05e0['id']);return getEndUser(_0x296d71,_0x56c882[_0xda4f('0x61')],_0x56c882['calleridnum'],_0x85c368);})['then'](function(_0x335e61){_0xa6626d=_0x335e61;logger[_0xda4f('0xe')](_0xda4f('0x62'),_0xa6626d['id']);return getTicket(_0x296d71,_0x2b05e0,_0xa6626d,_0x2d73e2,_0x56c882,_0x2d73e2['Fields'],_0x85c368,_0xda4f('0x63'));})[_0xda4f('0x30')](function(_0x5031da){_0x3f0b92=_0x5031da;logger[_0xda4f('0xe')]('Ticket\x20created!');logger[_0xda4f('0xe')](_0xda4f('0x64'),_0x3f0b92['id']);return setRelationship(_0x85c368,_0x2b05e0,_0x3f0b92,'users');})['then'](function(){return setRelationship(_0x85c368,_0xa6626d,_0x3f0b92,'contacts');})[_0xda4f('0x30')](function(){return getServerInfo(_0x85c368);})[_0xda4f('0x30')](function(_0x4c7a8f){var _0x392d26=parseInt(_0x4c7a8f['version'][_0xda4f('0x65')](0x0));var _0x572f2f=util[_0xda4f('0x2e')](_0xda4f('0x66'),_0x296d71[_0xda4f('0x56')],_0x3f0b92['id']);if(_0x392d26>0x6){_0x572f2f=util[_0xda4f('0x2e')](_0xda4f('0x67'),_0x296d71[_0xda4f('0x56')],_0x3f0b92['id']);}logger[_0xda4f('0xe')](_0xda4f('0x5c'),_0xda4f('0x68'));emit(util[_0xda4f('0x2e')](_0xda4f('0x69'),_0x3394ee[_0xda4f('0x10')]),_0xda4f('0x6a'),{'uri':_0x572f2f});})[_0xda4f('0x6b')](function(_0x1e9593){logger[_0xda4f('0x6c')](_0xda4f('0x5c'),JSON[_0xda4f('0x26')](_0x1e9593));});};exports[_0xda4f('0x6d')]=function(_0x38e359,_0x259779,_0xb6ac80,_0x44a864,_0x98981e,_0xea8593,_0x1c84ff){var _0x1b8033,_0x45f304,_0x135c5b,_0x2f382c;_0xea8593[_0xda4f('0x56')]=intUtil[_0xda4f('0x58')](_0xea8593[_0xda4f('0x56')]);_0xea8593[_0xda4f('0x57')]=intUtil[_0xda4f('0x58')](_0xea8593[_0xda4f('0x57')]);def[_0xda4f('0x59')]=util[_0xda4f('0x2e')](_0xda4f('0x5a'),_0xea8593[_0xda4f('0x56')]);if(_0x1c84ff&&_0x1c84ff['recordingFormat']&&_0x1c84ff[_0xda4f('0x6e')]!==_0xda4f('0x6f')){logger[_0xda4f('0xe')]('[OUTBOUND]',_0xda4f('0x5d'));_0x259779[_0xda4f('0x5e')]=util[_0xda4f('0x2e')](_0xda4f('0x70'),_0xea8593[_0xda4f('0x57')],_0x259779[_0xda4f('0x5f')],md5(_0x259779['uniqueid']));}return getConnection(_0xea8593)['then'](function(_0x1c3c4e){_0x2f382c=_0x1c3c4e;return getUser(_0xea8593,_0x44a864[_0xda4f('0x10')],_0x2f382c);})[_0xda4f('0x30')](function(_0x171263){_0x1b8033=_0x171263;logger['info']('The\x20User\x20ID\x20is:',_0x1b8033['id']);return getEndUser(_0xea8593,_0x259779[_0xda4f('0x71')],_0x259779[_0xda4f('0x72')],_0x2f382c);})[_0xda4f('0x30')](function(_0x1ef6ff){_0x45f304=_0x1ef6ff;logger[_0xda4f('0xe')](_0xda4f('0x62'),_0x45f304['id']);return getTicket(_0xea8593,_0x1b8033,_0x45f304,_0xb6ac80,_0x259779,_0xb6ac80[_0xda4f('0x73')],_0x2f382c,_0xda4f('0x74'));})['then'](function(_0x1e5caf){_0x135c5b=_0x1e5caf;logger[_0xda4f('0xe')](_0xda4f('0x75'));logger[_0xda4f('0xe')](_0xda4f('0x64'),_0x135c5b['id']);return setRelationship(_0x2f382c,_0x1b8033,_0x135c5b,_0xda4f('0x76'));})[_0xda4f('0x30')](function(){return setRelationship(_0x2f382c,_0x45f304,_0x135c5b,_0xda4f('0x77'));})['then'](function(){return getServerInfo(_0x2f382c);})['then'](function(_0x218ca5){var _0x4be179=parseInt(_0x218ca5[_0xda4f('0x78')][_0xda4f('0x65')](0x0));var _0x36b090=util[_0xda4f('0x2e')](_0xda4f('0x66'),_0xea8593['remoteUri'],_0x135c5b['id']);if(_0x4be179>0x6){_0x36b090=util[_0xda4f('0x2e')](_0xda4f('0x67'),_0xea8593['remoteUri'],_0x135c5b['id']);}logger[_0xda4f('0xe')](_0xda4f('0x79'),_0xda4f('0x68'));emit(util[_0xda4f('0x2e')](_0xda4f('0x69'),_0x44a864[_0xda4f('0x10')]),_0xda4f('0x6a'),{'uri':_0x36b090});})[_0xda4f('0x6b')](function(_0x5dc247){logger[_0xda4f('0x6c')]('[OUTBOUND]',JSON[_0xda4f('0x26')](_0x5dc247));});};exports['unmanaged']=function(_0xf88048,_0x5a3126,_0x6725f6,_0x45a692,_0x569e1d,_0x17fad4){var _0x51905b,_0x4e33b9,_0x32f4dc,_0x1d45dd;_0x17fad4[_0xda4f('0x56')]=intUtil[_0xda4f('0x58')](_0x17fad4[_0xda4f('0x56')]);_0x17fad4['serverUrl']=intUtil[_0xda4f('0x58')](_0x17fad4[_0xda4f('0x57')]);def[_0xda4f('0x59')]=util[_0xda4f('0x2e')](_0xda4f('0x5a'),_0x17fad4['remoteUri']);if(_0x569e1d&&_0x569e1d[_0xda4f('0x5b')]){logger[_0xda4f('0xe')]('['+_0x5a3126[_0xda4f('0x7a')][_0xda4f('0x7b')]()+']',_0xda4f('0x5d'));_0x5a3126[_0xda4f('0x5e')]=util[_0xda4f('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17fad4[_0xda4f('0x57')],_0x5a3126['uniqueid'],md5(_0x5a3126[_0xda4f('0x5f')]));}else{_0x5a3126[_0xda4f('0x5e')]='';}return getConnection(_0x17fad4)[_0xda4f('0x30')](function(_0x2d1b59){_0x1d45dd=_0x2d1b59;if(!_[_0xda4f('0x7c')](_0x45a692)){return getUser(_0x17fad4,_0x45a692[_0xda4f('0x10')],_0x1d45dd);}else{return getUser(_0x17fad4,null,_0x1d45dd);}})['then'](function(_0x2b9115){_0x51905b=_0x2b9115;logger[_0xda4f('0xe')](_0xda4f('0x60'),_0x51905b['id']);return getEndUser(_0x17fad4,_0x5a3126[_0xda4f('0x61')],_0x5a3126[_0xda4f('0x7d')],_0x1d45dd);})[_0xda4f('0x30')](function(_0x4e3f27){_0x4e33b9=_0x4e3f27;logger[_0xda4f('0xe')]('The\x20Enduser\x20ID\x20is:',_0x4e33b9['id']);return getTicket(_0x17fad4,_0x51905b,_0x4e33b9,_0x6725f6,_0x5a3126,_0x6725f6[_0xda4f('0x73')],_0x1d45dd,_0xda4f('0x63'));})[_0xda4f('0x30')](function(_0x4a8e35){_0x32f4dc=_0x4a8e35;logger['info']('Ticket\x20created!');logger[_0xda4f('0xe')](_0xda4f('0x64'),_0x32f4dc['id']);return setRelationship(_0x1d45dd,_0x51905b,_0x32f4dc,'users');})[_0xda4f('0x30')](function(){return setRelationship(_0x1d45dd,_0x4e33b9,_0x32f4dc,_0xda4f('0x77'));})[_0xda4f('0x30')](function(){return getServerInfo(_0x1d45dd);})['catch'](function(_0x58ea19){logger['error']('['+_0x5a3126['lastevent']['toUpperCase']()+']',JSON[_0xda4f('0x26')](_0x58ea19));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index c32c0dd..8dd29f3 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 _0x2ae3=['string','content','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','slice','substring','isNil','test','util','getString','sortBy','length','type'];(function(_0x248db3,_0x2a651b){var _0x45a189=function(_0x154de8){while(--_0x154de8){_0x248db3['push'](_0x248db3['shift']());}};_0x45a189(++_0x2a651b);}(_0x2ae3,0x9d));var _0x32ae=function(_0x320da8,_0x9d618b){_0x320da8=_0x320da8-0x0;var _0x2a73e3=_0x2ae3[_0x320da8];return _0x2a73e3;};'use strict';var _=require('lodash');var util=require(_0x32ae('0x0'));exports[_0x32ae('0x1')]=function(_0xc294ea,_0x4a120a,_0x5ed6e3){var _0x6a1787=[];if(_0xc294ea['length']>0x0){var _0x4ae5fa=_[_0x32ae('0x2')](_0xc294ea,['id']);for(var _0x57d9d9=0x0;_0x57d9d9<_0x4ae5fa[_0x32ae('0x3')];_0x57d9d9++){var _0x2a6266=_0x4ae5fa[_0x57d9d9];if(_0x2a6266[_0x32ae('0x4')]===_0x32ae('0x5')){_0x6a1787['push'](_0x2a6266[_0x32ae('0x6')]);}else if(_0x2a6266[_0x32ae('0x4')]==='variable'&&_0x2a6266[_0x32ae('0x7')]){_0x4a120a[_0x2a6266[_0x32ae('0x7')]]&&_0x6a1787[_0x32ae('0x8')](_0x4a120a[_0x2a6266[_0x32ae('0x7')]][_0x32ae('0x9')]());}else if(_0x2a6266[_0x32ae('0x4')]===_0x32ae('0xa')&&_0x2a6266[_0x32ae('0xb')]&&_0x2a6266[_0x32ae('0xb')]['name']){_0x4a120a[_0x2a6266[_0x32ae('0xb')][_0x32ae('0xc')][_0x32ae('0xd')]()]&&_0x6a1787[_0x32ae('0x8')](_0x4a120a[_0x2a6266[_0x32ae('0xb')][_0x32ae('0xc')][_0x32ae('0xd')]()][_0x32ae('0x9')]());}else if(_0x2a6266[_0x32ae('0x4')]===_0x32ae('0xe')){if(_0x2a6266[_0x32ae('0xf')]===_0x32ae('0x5')&&_0x2a6266[_0x32ae('0x10')]){_0x6a1787[_0x32ae('0x8')](util[_0x32ae('0x11')](_0x32ae('0x12'),_0x2a6266[_0x32ae('0x10')],_0x2a6266[_0x32ae('0x13')]));}else if(_0x2a6266[_0x32ae('0xf')]===_0x32ae('0x14')&&_0x2a6266[_0x32ae('0x7')]&&_0x2a6266[_0x32ae('0x10')]){_0x4a120a[_0x2a6266[_0x32ae('0x7')]]&&_0x6a1787[_0x32ae('0x8')](util[_0x32ae('0x11')](_0x32ae('0x12'),_0x2a6266[_0x32ae('0x10')],_0x4a120a[_0x2a6266[_0x32ae('0x7')]]));}else if(_0x2a6266[_0x32ae('0xf')]===_0x32ae('0xa')&&_0x2a6266[_0x32ae('0xb')]&&_0x2a6266[_0x32ae('0xb')][_0x32ae('0xc')]&&_0x2a6266[_0x32ae('0x10')]){_0x4a120a[_0x2a6266[_0x32ae('0xb')]['name'][_0x32ae('0xd')]()]&&_0x6a1787[_0x32ae('0x8')](util[_0x32ae('0x11')](_0x32ae('0x12'),_0x2a6266[_0x32ae('0x10')],_0x4a120a[_0x2a6266['Variable'][_0x32ae('0xc')][_0x32ae('0xd')]()]));}}}}return _0x6a1787[_0x32ae('0x15')](_0x5ed6e3);};exports[_0x32ae('0x16')]=function(_0x384693){var _0x166ece=_0x384693[_0x32ae('0x17')](-0x1);if(_0x166ece==='/'){_0x384693=_0x384693[_0x32ae('0x18')](0x0,_0x384693['lastIndexOf'](_0x166ece));}return _0x384693;};exports['validateEmail']=function(_0x59cf5e){if(!_[_0x32ae('0x19')](_0x59cf5e)&&_0x59cf5e!==''){var _0x55bf5e=/^(([^<>()\[\]\\.,;:\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 _0x55bf5e[_0x32ae('0x1a')](String(_0x59cf5e)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x06bd=['key','customVariable','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','sortBy','length','type','string','variable','variableName','push','Variable','name','toLowerCase','toString','keyValue','keyType','format','%s:\x20%s','keyContent'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x06bd,0x1d3));var _0xd06b=function(_0x5daeb2,_0x4b007c){_0x5daeb2=_0x5daeb2-0x0;var _0x2dbb9f=_0x06bd[_0x5daeb2];return _0x2dbb9f;};'use strict';var _=require(_0xd06b('0x0'));var util=require(_0xd06b('0x1'));exports[_0xd06b('0x2')]=function(_0x5746f9,_0x581eca,_0x5c1b7e){var _0x112747=[];if(_0x5746f9['length']>0x0){var _0x1da816=_[_0xd06b('0x3')](_0x5746f9,['id']);for(var _0x459c78=0x0;_0x459c78<_0x1da816[_0xd06b('0x4')];_0x459c78++){var _0x2bcbc7=_0x1da816[_0x459c78];if(_0x2bcbc7[_0xd06b('0x5')]===_0xd06b('0x6')){_0x112747['push'](_0x2bcbc7['content']);}else if(_0x2bcbc7['type']===_0xd06b('0x7')&&_0x2bcbc7[_0xd06b('0x8')]){_0x581eca[_0x2bcbc7[_0xd06b('0x8')]]&&_0x112747[_0xd06b('0x9')](_0x581eca[_0x2bcbc7['variableName']]['toString']());}else if(_0x2bcbc7[_0xd06b('0x5')]==='customVariable'&&_0x2bcbc7['Variable']&&_0x2bcbc7['Variable']['name']){_0x581eca[_0x2bcbc7[_0xd06b('0xa')][_0xd06b('0xb')][_0xd06b('0xc')]()]&&_0x112747[_0xd06b('0x9')](_0x581eca[_0x2bcbc7[_0xd06b('0xa')][_0xd06b('0xb')][_0xd06b('0xc')]()][_0xd06b('0xd')]());}else if(_0x2bcbc7[_0xd06b('0x5')]===_0xd06b('0xe')){if(_0x2bcbc7[_0xd06b('0xf')]==='string'&&_0x2bcbc7['key']){_0x112747[_0xd06b('0x9')](util[_0xd06b('0x10')](_0xd06b('0x11'),_0x2bcbc7['key'],_0x2bcbc7[_0xd06b('0x12')]));}else if(_0x2bcbc7[_0xd06b('0xf')]===_0xd06b('0x7')&&_0x2bcbc7[_0xd06b('0x8')]&&_0x2bcbc7[_0xd06b('0x13')]){_0x581eca[_0x2bcbc7[_0xd06b('0x8')]]&&_0x112747[_0xd06b('0x9')](util['format'](_0xd06b('0x11'),_0x2bcbc7['key'],_0x581eca[_0x2bcbc7[_0xd06b('0x8')]]));}else if(_0x2bcbc7['keyType']===_0xd06b('0x14')&&_0x2bcbc7[_0xd06b('0xa')]&&_0x2bcbc7[_0xd06b('0xa')]['name']&&_0x2bcbc7[_0xd06b('0x13')]){_0x581eca[_0x2bcbc7[_0xd06b('0xa')]['name'][_0xd06b('0xc')]()]&&_0x112747[_0xd06b('0x9')](util[_0xd06b('0x10')](_0xd06b('0x11'),_0x2bcbc7[_0xd06b('0x13')],_0x581eca[_0x2bcbc7[_0xd06b('0xa')][_0xd06b('0xb')]['toLowerCase']()]));}}}}return _0x112747['join'](_0x5c1b7e);};exports[_0xd06b('0x15')]=function(_0x4f8da0){var _0x29fa2a=_0x4f8da0[_0xd06b('0x16')](-0x1);if(_0x29fa2a==='/'){_0x4f8da0=_0x4f8da0['substring'](0x0,_0x4f8da0[_0xd06b('0x17')](_0x29fa2a));}return _0x4f8da0;};exports[_0xd06b('0x18')]=function(_0x4c0392){if(!_[_0xd06b('0x19')](_0x4c0392)&&_0x4c0392!==''){var _0xda6001=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0xda6001[_0xd06b('0x1a')](String(_0x4c0392)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 322035a..4160ef5 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x33993e,_0xd4ae85){var _0x1c3281=function(_0x133033){while(--_0x133033){_0x33993e['push'](_0x33993e['shift']());}};_0x1c3281(++_0xd4ae85);}(_0xe706,0xa3));var _0x6e70=function(_0x20efe6,_0x2d6285){_0x20efe6=_0x20efe6-0x0;var _0x2680c2=_0xe706[_0x20efe6];return _0x2680c2;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index b290602..f685637 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 _0xc3a6=['string','nameField','toLowerCase','content','picklist','type','custom_fields','push','idField','variable','variableName','customField','customVariable','Variable','queue','stripTrailingSlash','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','replace','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','util','ioredis','./util','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','remoteUri','POST','Tags','name','Subjects','getString','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','%s:%s','password','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','includes'];(function(_0x1d5b3f,_0x4fc7af){var _0x303161=function(_0x49f75d){while(--_0x49f75d){_0x1d5b3f['push'](_0x1d5b3f['shift']());}};_0x303161(++_0x4fc7af);}(_0xc3a6,0x107));var _0x6c3a=function(_0x39fee5,_0x33f715){_0x39fee5=_0x39fee5-0x0;var _0x43c19d=_0xc3a6[_0x39fee5];return _0x43c19d;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x6c3a('0x0'));var Redis=require(_0x6c3a('0x1'));var intUtil=require(_0x6c3a('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x6c3a('0x3'));config[_0x6c3a('0x4')]=_[_0x6c3a('0x5')](config[_0x6c3a('0x4')],{'host':_0x6c3a('0x6'),'port':0x18eb});var io=require(_0x6c3a('0x7'))(new Redis(config[_0x6c3a('0x4')]));function emit(_0x5ecabb,_0x3dfce2,_0x5593f2){io['to'](_0x5ecabb)[_0x6c3a('0x8')](_0x3dfce2,_0x5593f2);}var headers={'Content-Type':_0x6c3a('0x9'),'Accept':'application/json'};function getTicket(_0x369424,_0x1c83a1,_0x506442,_0x500b8e,_0x2061c6){logger[_0x6c3a('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util['format']('%s/tickets.json',_0x369424[_0x6c3a('0xb')]),'method':_0x6c3a('0xc'),'body':{'ticket':_['merge']({'requester_id':_0x506442['id'],'submitter_id':_0x1c83a1?_0x1c83a1['id']:undefined,'assignee_id':_0x1c83a1?_0x1c83a1['id']:undefined,'tags':getTags(_0x500b8e[_0x6c3a('0xd')],_0x6c3a('0xe')),'subject':intUtil['getString'](_0x500b8e[_0x6c3a('0xf')],_0x2061c6,'\x20'),'description':intUtil[_0x6c3a('0x10')](_0x500b8e[_0x6c3a('0x11')],_0x2061c6,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x500b8e[_0x6c3a('0x11')],_0x2061c6,'\x0a')}},getCustomFields(_0x500b8e[_0x6c3a('0x12')],_0x2061c6))}})[_0x6c3a('0x13')](function(_0x57daeb){logger[_0x6c3a('0xa')]('Ticket\x20created!');return _0x57daeb[_0x6c3a('0x14')];});}function getUser(_0x2cb175,_0x37b9c7){if(intUtil[_0x6c3a('0x15')](_0x37b9c7)){logger['info'](_0x6c3a('0x16'),_0x37b9c7);return request({'uri':util[_0x6c3a('0x17')](_0x6c3a('0x18'),_0x2cb175[_0x6c3a('0xb')]),'qs':{'query':util[_0x6c3a('0x17')](_0x6c3a('0x19'),_0x37b9c7)}})['then'](function(_0xf2c3f){if(_0xf2c3f[_0x6c3a('0x1a')]){logger[_0x6c3a('0xa')]('Agent\x20found!');return _[_0x6c3a('0x1b')](_0xf2c3f[_0x6c3a('0x1c')],{'email':_0x37b9c7,'role':_0x6c3a('0x1d')});}else{logger[_0x6c3a('0xa')](_0x6c3a('0x1e'));return request({'uri':util[_0x6c3a('0x17')](_0x6c3a('0x1f'),_0x2cb175[_0x6c3a('0xb')])})[_0x6c3a('0x13')](function(_0x14180a){logger['info'](_0x6c3a('0x20'));return _0x14180a[_0x6c3a('0x21')];});}});}else{logger[_0x6c3a('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6c3a('0x17')](_0x6c3a('0x1f'),_0x2cb175[_0x6c3a('0xb')])})[_0x6c3a('0x13')](function(_0x23a423){logger[_0x6c3a('0xa')](_0x6c3a('0x20'));return _0x23a423[_0x6c3a('0x21')];});}}function getEndUser(_0x704655,_0x700205,_0x57cbaf){logger[_0x6c3a('0xa')](_0x6c3a('0x22'),_0x57cbaf);return request({'uri':util[_0x6c3a('0x17')](_0x6c3a('0x18'),_0x704655['remoteUri']),'qs':{'query':util['format'](_0x6c3a('0x23'),_0x57cbaf)}})['then'](function(_0x3ee446){var _0x294181;if(_0x3ee446[_0x6c3a('0x1c')]['length']){_0x3ee446['results']=_['filter'](_0x3ee446[_0x6c3a('0x1c')],{'suspended':![],'role':_0x6c3a('0x24')});if(_0x3ee446[_0x6c3a('0x1c')][_0x6c3a('0x25')]){_0x294181=_[_0x6c3a('0x26')](_0x3ee446[_0x6c3a('0x1c')]);}}if(_0x294181){logger[_0x6c3a('0xa')](_0x6c3a('0x27'));return _0x294181;}else{logger[_0x6c3a('0xa')](_0x6c3a('0x28'));return request({'uri':util[_0x6c3a('0x17')]('%s/users.json',_0x704655[_0x6c3a('0xb')]),'method':_0x6c3a('0xc'),'body':{'user':{'role':_0x6c3a('0x24'),'name':util[_0x6c3a('0x17')](_0x6c3a('0x29'),_0x700205||_0x57cbaf),'phone':_0x57cbaf}}})['then'](function(_0x583824){logger[_0x6c3a('0xa')]('Enduser\x20created.');return _0x583824[_0x6c3a('0x21')];});}});}function getAuth(_0x5915c0){var _0x27ac69;if(_0x5915c0[_0x6c3a('0x2a')]==='password'){_0x27ac69=util[_0x6c3a('0x17')](_0x6c3a('0x2b'),_0x5915c0['username'],_0x5915c0[_0x6c3a('0x2c')]);}else if(_0x5915c0[_0x6c3a('0x2a')]===_0x6c3a('0x2d')){_0x27ac69=util[_0x6c3a('0x17')](_0x6c3a('0x2e'),_0x5915c0['username'],_0x5915c0[_0x6c3a('0x2d')]);}return util['format']('Basic\x20%s',new Buffer(_0x27ac69)[_0x6c3a('0x2f')](_0x6c3a('0x30')));}function request(_0x58fc04){logger[_0x6c3a('0x31')](_0x6c3a('0x32'),JSON[_0x6c3a('0x33')](_0x58fc04));return rp(_['defaults'](_0x58fc04,{'method':_0x6c3a('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x95fa5,_0x36dadc){var _0x3022cc=[];if(_0x95fa5&&_0x95fa5['length']>0x0){_0x3022cc=_['map'](_0x95fa5,_0x36dadc);}return _0x3022cc;}function getCustomFields(_0x50c18c,_0x693064){var _0x3aabf5=[];var _0x1e84bf={'custom_fields':[]};if(_0x50c18c[_0x6c3a('0x25')]>0x0){_[_0x6c3a('0x35')](_0x50c18c,function(_0x1f7b95){if(_[_0x6c3a('0x36')]([_0x6c3a('0x37'),'picklist'],_0x1f7b95['type'])&&_0x1f7b95[_0x6c3a('0x38')]&&!_0x1f7b95['customField']){_0x1e84bf[_0x1f7b95['nameField'][_0x6c3a('0x39')]()]=_0x1f7b95[_0x6c3a('0x3a')][_0x6c3a('0x2f')]();}else if(_[_0x6c3a('0x36')]([_0x6c3a('0x37'),_0x6c3a('0x3b')],_0x1f7b95[_0x6c3a('0x3c')])&&_0x1f7b95['idField']&&_0x1f7b95['customField']){_0x1e84bf[_0x6c3a('0x3d')][_0x6c3a('0x3e')]({'id':_0x1f7b95[_0x6c3a('0x3f')],'value':_0x1f7b95[_0x6c3a('0x3a')][_0x6c3a('0x2f')]()});}else if(_0x1f7b95[_0x6c3a('0x3c')]===_0x6c3a('0x40')&&_0x1f7b95[_0x6c3a('0x41')]&&_0x1f7b95[_0x6c3a('0x3f')]&&_0x1f7b95[_0x6c3a('0x42')]){_0x693064[_0x1f7b95[_0x6c3a('0x41')]]&&_0x1e84bf[_0x6c3a('0x3d')][_0x6c3a('0x3e')]({'id':_0x1f7b95[_0x6c3a('0x3f')],'value':_0x693064[_0x1f7b95[_0x6c3a('0x41')]]['toString']()});}else if(_0x1f7b95[_0x6c3a('0x3c')]===_0x6c3a('0x43')&&_0x1f7b95['Variable']&&_0x1f7b95[_0x6c3a('0x44')][_0x6c3a('0xe')]&&_0x1f7b95[_0x6c3a('0x3f')]&&_0x1f7b95[_0x6c3a('0x42')]){_0x693064[_0x1f7b95[_0x6c3a('0x44')][_0x6c3a('0xe')][_0x6c3a('0x39')]()]&&_0x1e84bf[_0x6c3a('0x3d')][_0x6c3a('0x3e')]({'id':_0x1f7b95[_0x6c3a('0x3f')],'value':_0x693064[_0x1f7b95[_0x6c3a('0x44')][_0x6c3a('0xe')][_0x6c3a('0x39')]()][_0x6c3a('0x2f')]()});}});}return _0x1e84bf;}exports[_0x6c3a('0x45')]=function(_0x190a10,_0x533d7a,_0xf1d9c4,_0x1e7a8b,_0x2a3f5d,_0x45f6cc){var _0x57e99e,_0x55b783;_0x45f6cc[_0x6c3a('0xb')]=intUtil[_0x6c3a('0x46')](_0x45f6cc[_0x6c3a('0xb')]);_0x45f6cc['serverUrl']=intUtil['stripTrailingSlash'](_0x45f6cc['serverUrl']);if(_0x2a3f5d&&_0x2a3f5d['monitor_format']){logger['info']('[QUEUE]',_0x6c3a('0x47'));_0x533d7a['recordingURL']=util[_0x6c3a('0x17')](_0x6c3a('0x48'),_0x45f6cc[_0x6c3a('0x49')],_0x533d7a[_0x6c3a('0x4a')],md5(_0x533d7a[_0x6c3a('0x4a')]));}else{_0x533d7a[_0x6c3a('0x4b')]='';}headers[_0x6c3a('0x4c')]=getAuth(_0x45f6cc);return getUser(_0x45f6cc,_0x1e7a8b[_0x6c3a('0x4d')])[_0x6c3a('0x13')](function(_0x4378d3){_0x57e99e=_0x4378d3;logger[_0x6c3a('0xa')](_0x6c3a('0x4e'),_0x57e99e['id']);return getEndUser(_0x45f6cc,_0x533d7a[_0x6c3a('0x4f')],_0x533d7a[_0x6c3a('0x50')]);})['then'](function(_0x5a3cf7){_0x55b783=_0x5a3cf7;logger['info'](_0x6c3a('0x51'),_0x55b783['id']);return getTicket(_0x45f6cc,_0x57e99e,_0x55b783,_0xf1d9c4,_0x533d7a);})[_0x6c3a('0x13')](function(_0x2edc53){if(_0x2edc53){logger[_0x6c3a('0xa')]('The\x20Ticket\x20ID\x20is:',_0x2edc53['id']);switch(_0x45f6cc[_0x6c3a('0x3c')]){case _0x6c3a('0x52'):logger[_0x6c3a('0xa')](_0x6c3a('0x53'),_0x6c3a('0x54'));return request({'uri':util[_0x6c3a('0x17')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x45f6cc['remoteUri'],_0x57e99e['id'],_0x2edc53['id']),'method':_0x6c3a('0xc')});case'newTab':logger['info'](_0x6c3a('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6c3a('0x17')]('user:%s',_0x1e7a8b['name']),'trigger:browser:url',{'uri':util[_0x6c3a('0x17')]('%s/agent/tickets/%s',_0x45f6cc[_0x6c3a('0xb')][_0x6c3a('0x55')]('/api/v2',''),_0x2edc53['id'])});break;default:logger[_0x6c3a('0x56')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1fbd56){logger[_0x6c3a('0x56')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1fbd56,{'showHidden':!![],'depth':null}));});};exports[_0x6c3a('0x57')]=function(_0x22c04d,_0x35457c,_0x2f24aa,_0x3ed6ad,_0x5be852,_0x164c51,_0x1dc51a){var _0x51d0ea,_0x1f7061;_0x164c51[_0x6c3a('0xb')]=intUtil[_0x6c3a('0x46')](_0x164c51['remoteUri']);_0x164c51['serverUrl']=intUtil[_0x6c3a('0x46')](_0x164c51['serverUrl']);if(_0x1dc51a&&_0x1dc51a[_0x6c3a('0x58')]&&_0x1dc51a[_0x6c3a('0x58')]!==_0x6c3a('0x59')){logger[_0x6c3a('0xa')]('[OUTBOUND]',_0x6c3a('0x47'));_0x35457c[_0x6c3a('0x4b')]=util['format'](_0x6c3a('0x48'),_0x164c51[_0x6c3a('0x49')],_0x35457c['uniqueid'],md5(_0x35457c[_0x6c3a('0x4a')]));}headers['Authorization']=getAuth(_0x164c51);return getUser(_0x164c51,_0x3ed6ad[_0x6c3a('0x4d')])['then'](function(_0x485b7d){_0x51d0ea=_0x485b7d;logger['info']('The\x20User\x20ID\x20is:',_0x51d0ea['id']);return getEndUser(_0x164c51,_0x35457c[_0x6c3a('0x5a')],_0x35457c[_0x6c3a('0x5b')]);})[_0x6c3a('0x13')](function(_0x81045e){_0x1f7061=_0x81045e;logger[_0x6c3a('0xa')](_0x6c3a('0x51'),_0x1f7061['id']);return getTicket(_0x164c51,_0x51d0ea,_0x1f7061,_0x2f24aa,_0x35457c);})[_0x6c3a('0x13')](function(_0x504559){if(_0x504559){logger['info'](_0x6c3a('0x5c'),_0x504559['id']);switch(_0x164c51[_0x6c3a('0x3c')]){case _0x6c3a('0x52'):logger[_0x6c3a('0xa')](_0x6c3a('0x5d'),_0x6c3a('0x54'));return request({'uri':util[_0x6c3a('0x17')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x164c51[_0x6c3a('0xb')],_0x51d0ea['id'],_0x504559['id']),'method':'POST'});case _0x6c3a('0x5e'):logger['info']('[OUTBOUND]',_0x6c3a('0x5f'));emit(util[_0x6c3a('0x17')](_0x6c3a('0x60'),_0x3ed6ad[_0x6c3a('0xe')]),_0x6c3a('0x61'),{'uri':util[_0x6c3a('0x17')](_0x6c3a('0x62'),_0x164c51[_0x6c3a('0xb')][_0x6c3a('0x55')](_0x6c3a('0x63'),''),_0x504559['id'])});break;default:logger[_0x6c3a('0x56')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x6c3a('0x64')](function(_0x38108f){logger['error'](_0x6c3a('0x65'),util[_0x6c3a('0x66')](_0x38108f,{'showHidden':!![],'depth':null}));});};exports[_0x6c3a('0x67')]=function(_0xdee081,_0x256e57,_0x9b478f,_0x153d47,_0x26c830,_0x4a3a60){var _0x15f5b0,_0x150946;_0x4a3a60[_0x6c3a('0xb')]=intUtil[_0x6c3a('0x46')](_0x4a3a60[_0x6c3a('0xb')]);_0x4a3a60['serverUrl']=intUtil[_0x6c3a('0x46')](_0x4a3a60[_0x6c3a('0x49')]);if(_0x26c830&&_0x26c830['monitor_format']){logger[_0x6c3a('0xa')]('['+_0x256e57[_0x6c3a('0x68')][_0x6c3a('0x69')]()+']',_0x6c3a('0x47'));_0x256e57[_0x6c3a('0x4b')]=util[_0x6c3a('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a3a60['serverUrl'],_0x256e57[_0x6c3a('0x4a')],md5(_0x256e57[_0x6c3a('0x4a')]));}else{_0x256e57[_0x6c3a('0x4b')]='';}headers[_0x6c3a('0x4c')]=getAuth(_0x4a3a60);return getUser(_0x4a3a60)[_0x6c3a('0x13')](function(_0x25526){_0x15f5b0=_0x25526;logger['info']('The\x20User\x20ID\x20is:',_0x15f5b0['id']);return getEndUser(_0x4a3a60,_0x256e57[_0x6c3a('0x4f')],_0x256e57[_0x6c3a('0x50')]);})[_0x6c3a('0x13')](function(_0x18fce1){_0x150946=_0x18fce1;logger['info'](_0x6c3a('0x51'),_0x150946['id']);return getTicket(_0x4a3a60,_0x15f5b0,_0x150946,_0x9b478f,_0x256e57);})['then'](function(_0x18be7b){if(_0x18be7b){logger['info']('The\x20Ticket\x20ID\x20is:',_0x18be7b['id']);}})[_0x6c3a('0x64')](function(_0x1a6edc){logger[_0x6c3a('0x56')]('['+_0x256e57['lastevent'][_0x6c3a('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x6c3a('0x66')](_0x1a6edc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7c81=['request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','GET','forEach','includes','string','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','inspect','unmanaged','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x16b8c4,_0x217669){var _0x4d3eff=function(_0xec6aa4){while(--_0xec6aa4){_0x16b8c4['push'](_0x16b8c4['shift']());}};_0x4d3eff(++_0x217669);}(_0x7c81,0x6b));var _0x17c8=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x7c81[_0x67f95e];return _0x538f5a;};'use strict';var _=require('lodash');var rp=require(_0x17c8('0x0'));var md5=require(_0x17c8('0x1'));var util=require(_0x17c8('0x2'));var Redis=require(_0x17c8('0x3'));var intUtil=require(_0x17c8('0x4'));var config=require(_0x17c8('0x5'));var logger=require(_0x17c8('0x6'))('zendesk');config[_0x17c8('0x7')]=_[_0x17c8('0x8')](config[_0x17c8('0x7')],{'host':_0x17c8('0x9'),'port':0x18eb});var io=require(_0x17c8('0xa'))(new Redis(config['redis']));function emit(_0x542808,_0x4ef95c,_0x4fe35e){io['to'](_0x542808)['emit'](_0x4ef95c,_0x4fe35e);}var headers={'Content-Type':_0x17c8('0xb'),'Accept':_0x17c8('0xb')};function getTicket(_0x58f40b,_0x4e0769,_0x59b7c9,_0x4b0c7b,_0x569cc3){logger[_0x17c8('0xc')](_0x17c8('0xd'));return request({'uri':util[_0x17c8('0xe')]('%s/tickets.json',_0x58f40b[_0x17c8('0xf')]),'method':_0x17c8('0x10'),'body':{'ticket':_[_0x17c8('0x11')]({'requester_id':_0x59b7c9['id'],'submitter_id':_0x4e0769?_0x4e0769['id']:undefined,'assignee_id':_0x4e0769?_0x4e0769['id']:undefined,'tags':getTags(_0x4b0c7b[_0x17c8('0x12')],_0x17c8('0x13')),'subject':intUtil[_0x17c8('0x14')](_0x4b0c7b[_0x17c8('0x15')],_0x569cc3,'\x20'),'description':intUtil[_0x17c8('0x14')](_0x4b0c7b[_0x17c8('0x16')],_0x569cc3,'\x0a'),'comment':{'public':![],'body':intUtil[_0x17c8('0x14')](_0x4b0c7b[_0x17c8('0x16')],_0x569cc3,'\x0a')}},getCustomFields(_0x4b0c7b['Fields'],_0x569cc3))}})[_0x17c8('0x17')](function(_0x31e9c5){logger['info']('Ticket\x20created!');return _0x31e9c5[_0x17c8('0x18')];});}function getUser(_0x5c6833,_0x4ca433){if(intUtil[_0x17c8('0x19')](_0x4ca433)){logger[_0x17c8('0xc')](_0x17c8('0x1a'),_0x4ca433);return request({'uri':util[_0x17c8('0xe')](_0x17c8('0x1b'),_0x5c6833['remoteUri']),'qs':{'query':util['format'](_0x17c8('0x1c'),_0x4ca433)}})[_0x17c8('0x17')](function(_0x4736a9){if(_0x4736a9['count']){logger[_0x17c8('0xc')](_0x17c8('0x1d'));return _[_0x17c8('0x1e')](_0x4736a9['results'],{'email':_0x4ca433,'role':'agent'});}else{logger[_0x17c8('0xc')](_0x17c8('0x1f'));return request({'uri':util[_0x17c8('0xe')]('%s/users/me.json',_0x5c6833['remoteUri'])})[_0x17c8('0x17')](function(_0xa32264){logger['info'](_0x17c8('0x20'));return _0xa32264[_0x17c8('0x21')];});}});}else{logger[_0x17c8('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x17c8('0x22'),_0x5c6833[_0x17c8('0xf')])})['then'](function(_0x5df06b){logger['info'](_0x17c8('0x20'));return _0x5df06b['user'];});}}function getEndUser(_0x1a6ac7,_0x304e35,_0x756c2b){logger[_0x17c8('0xc')](_0x17c8('0x23'),_0x756c2b);return request({'uri':util[_0x17c8('0xe')](_0x17c8('0x1b'),_0x1a6ac7[_0x17c8('0xf')]),'qs':{'query':util['format'](_0x17c8('0x24'),_0x756c2b)}})[_0x17c8('0x17')](function(_0x5d37bd){var _0x2a1023;if(_0x5d37bd[_0x17c8('0x25')][_0x17c8('0x26')]){_0x5d37bd[_0x17c8('0x25')]=_['filter'](_0x5d37bd['results'],{'suspended':![],'role':_0x17c8('0x27')});if(_0x5d37bd['results']['length']){_0x2a1023=_[_0x17c8('0x28')](_0x5d37bd[_0x17c8('0x25')]);}}if(_0x2a1023){logger[_0x17c8('0xc')]('Enduser\x20found!');return _0x2a1023;}else{logger[_0x17c8('0xc')](_0x17c8('0x29'));return request({'uri':util['format'](_0x17c8('0x2a'),_0x1a6ac7[_0x17c8('0xf')]),'method':'POST','body':{'user':{'role':_0x17c8('0x27'),'name':util['format'](_0x17c8('0x2b'),_0x304e35||_0x756c2b),'phone':_0x756c2b}}})[_0x17c8('0x17')](function(_0x191d2d){logger[_0x17c8('0xc')](_0x17c8('0x2c'));return _0x191d2d[_0x17c8('0x21')];});}});}function getAuth(_0x4418df){var _0x96d51;if(_0x4418df[_0x17c8('0x2d')]===_0x17c8('0x2e')){_0x96d51=util[_0x17c8('0xe')](_0x17c8('0x2f'),_0x4418df[_0x17c8('0x30')],_0x4418df[_0x17c8('0x2e')]);}else if(_0x4418df['authType']===_0x17c8('0x31')){_0x96d51=util[_0x17c8('0xe')](_0x17c8('0x32'),_0x4418df['username'],_0x4418df[_0x17c8('0x31')]);}return util[_0x17c8('0xe')](_0x17c8('0x33'),new Buffer(_0x96d51)[_0x17c8('0x34')](_0x17c8('0x35')));}function request(_0xb8eb67){logger[_0x17c8('0x36')]('[HTTP]',JSON['stringify'](_0xb8eb67));return rp(_[_0x17c8('0x8')](_0xb8eb67,{'method':_0x17c8('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x4b6e56,_0x293e6a){var _0x520996=[];if(_0x4b6e56&&_0x4b6e56['length']>0x0){_0x520996=_['map'](_0x4b6e56,_0x293e6a);}return _0x520996;}function getCustomFields(_0x4fc072,_0x4fbe19){var _0x3fbe8f=[];var _0x485e86={'custom_fields':[]};if(_0x4fc072['length']>0x0){_[_0x17c8('0x38')](_0x4fc072,function(_0x3fe005){if(_[_0x17c8('0x39')]([_0x17c8('0x3a'),'picklist'],_0x3fe005[_0x17c8('0x3b')])&&_0x3fe005[_0x17c8('0x3c')]&&!_0x3fe005[_0x17c8('0x3d')]){_0x485e86[_0x3fe005['nameField'][_0x17c8('0x3e')]()]=_0x3fe005[_0x17c8('0x3f')][_0x17c8('0x34')]();}else if(_[_0x17c8('0x39')]([_0x17c8('0x3a'),'picklist'],_0x3fe005['type'])&&_0x3fe005[_0x17c8('0x40')]&&_0x3fe005[_0x17c8('0x3d')]){_0x485e86[_0x17c8('0x41')][_0x17c8('0x42')]({'id':_0x3fe005[_0x17c8('0x40')],'value':_0x3fe005[_0x17c8('0x3f')]['toString']()});}else if(_0x3fe005[_0x17c8('0x3b')]===_0x17c8('0x43')&&_0x3fe005['variableName']&&_0x3fe005[_0x17c8('0x40')]&&_0x3fe005['customField']){_0x4fbe19[_0x3fe005[_0x17c8('0x44')]]&&_0x485e86[_0x17c8('0x41')][_0x17c8('0x42')]({'id':_0x3fe005[_0x17c8('0x40')],'value':_0x4fbe19[_0x3fe005[_0x17c8('0x44')]][_0x17c8('0x34')]()});}else if(_0x3fe005[_0x17c8('0x3b')]==='customVariable'&&_0x3fe005[_0x17c8('0x45')]&&_0x3fe005[_0x17c8('0x45')][_0x17c8('0x13')]&&_0x3fe005[_0x17c8('0x40')]&&_0x3fe005[_0x17c8('0x3d')]){_0x4fbe19[_0x3fe005[_0x17c8('0x45')][_0x17c8('0x13')]['toLowerCase']()]&&_0x485e86[_0x17c8('0x41')][_0x17c8('0x42')]({'id':_0x3fe005[_0x17c8('0x40')],'value':_0x4fbe19[_0x3fe005['Variable'][_0x17c8('0x13')][_0x17c8('0x3e')]()][_0x17c8('0x34')]()});}});}return _0x485e86;}exports[_0x17c8('0x46')]=function(_0x35f31b,_0x1f7c08,_0x485e77,_0x1d0494,_0x2c3d62,_0x18f00b){var _0x580cc1,_0x1d2e64;_0x18f00b['remoteUri']=intUtil[_0x17c8('0x47')](_0x18f00b[_0x17c8('0xf')]);_0x18f00b[_0x17c8('0x48')]=intUtil[_0x17c8('0x47')](_0x18f00b[_0x17c8('0x48')]);if(_0x2c3d62&&_0x2c3d62[_0x17c8('0x49')]){logger['info']('[QUEUE]',_0x17c8('0x4a'));_0x1f7c08[_0x17c8('0x4b')]=util[_0x17c8('0xe')](_0x17c8('0x4c'),_0x18f00b[_0x17c8('0x48')],_0x1f7c08['uniqueid'],md5(_0x1f7c08[_0x17c8('0x4d')]));}else{_0x1f7c08[_0x17c8('0x4b')]='';}headers[_0x17c8('0x4e')]=getAuth(_0x18f00b);return getUser(_0x18f00b,_0x1d0494[_0x17c8('0x4f')])['then'](function(_0x5c37b3){_0x580cc1=_0x5c37b3;logger['info'](_0x17c8('0x50'),_0x580cc1['id']);return getEndUser(_0x18f00b,_0x1f7c08[_0x17c8('0x51')],_0x1f7c08['calleridnum']);})['then'](function(_0x30cf29){_0x1d2e64=_0x30cf29;logger[_0x17c8('0xc')](_0x17c8('0x52'),_0x1d2e64['id']);return getTicket(_0x18f00b,_0x580cc1,_0x1d2e64,_0x485e77,_0x1f7c08);})[_0x17c8('0x17')](function(_0x406260){if(_0x406260){logger['info'](_0x17c8('0x53'),_0x406260['id']);switch(_0x18f00b['type']){case _0x17c8('0x54'):logger[_0x17c8('0xc')](_0x17c8('0x55'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x17c8('0xe')](_0x17c8('0x56'),_0x18f00b['remoteUri'],_0x580cc1['id'],_0x406260['id']),'method':_0x17c8('0x10')});case _0x17c8('0x57'):logger[_0x17c8('0xc')](_0x17c8('0x55'),_0x17c8('0x58'));emit(util[_0x17c8('0xe')](_0x17c8('0x59'),_0x1d0494[_0x17c8('0x13')]),_0x17c8('0x5a'),{'uri':util[_0x17c8('0xe')](_0x17c8('0x5b'),_0x18f00b[_0x17c8('0xf')][_0x17c8('0x5c')](_0x17c8('0x5d'),''),_0x406260['id'])});break;default:logger[_0x17c8('0x5e')](_0x17c8('0x55'),_0x17c8('0x5f'));}}})[_0x17c8('0x60')](function(_0xa7e43b){logger[_0x17c8('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xa7e43b,{'showHidden':!![],'depth':null}));});};exports[_0x17c8('0x61')]=function(_0x43466f,_0x10042c,_0x1c75ef,_0x372233,_0x547671,_0xa87648,_0x31edb7){var _0x3ee7de,_0x423b1c;_0xa87648[_0x17c8('0xf')]=intUtil[_0x17c8('0x47')](_0xa87648[_0x17c8('0xf')]);_0xa87648[_0x17c8('0x48')]=intUtil[_0x17c8('0x47')](_0xa87648[_0x17c8('0x48')]);if(_0x31edb7&&_0x31edb7['recordingFormat']&&_0x31edb7[_0x17c8('0x62')]!==_0x17c8('0x63')){logger[_0x17c8('0xc')](_0x17c8('0x64'),_0x17c8('0x4a'));_0x10042c[_0x17c8('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa87648[_0x17c8('0x48')],_0x10042c[_0x17c8('0x4d')],md5(_0x10042c[_0x17c8('0x4d')]));}headers['Authorization']=getAuth(_0xa87648);return getUser(_0xa87648,_0x372233['email'])['then'](function(_0x47a4ca){_0x3ee7de=_0x47a4ca;logger[_0x17c8('0xc')](_0x17c8('0x50'),_0x3ee7de['id']);return getEndUser(_0xa87648,_0x10042c['destcalleridname'],_0x10042c['destcalleridnum']);})[_0x17c8('0x17')](function(_0x132357){_0x423b1c=_0x132357;logger['info'](_0x17c8('0x52'),_0x423b1c['id']);return getTicket(_0xa87648,_0x3ee7de,_0x423b1c,_0x1c75ef,_0x10042c);})[_0x17c8('0x17')](function(_0x438036){if(_0x438036){logger[_0x17c8('0xc')](_0x17c8('0x53'),_0x438036['id']);switch(_0xa87648[_0x17c8('0x3b')]){case _0x17c8('0x54'):logger[_0x17c8('0xc')](_0x17c8('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x17c8('0x56'),_0xa87648[_0x17c8('0xf')],_0x3ee7de['id'],_0x438036['id']),'method':_0x17c8('0x10')});case'newTab':logger[_0x17c8('0xc')](_0x17c8('0x64'),_0x17c8('0x58'));emit(util[_0x17c8('0xe')](_0x17c8('0x59'),_0x372233[_0x17c8('0x13')]),'trigger:browser:url',{'uri':util[_0x17c8('0xe')](_0x17c8('0x5b'),_0xa87648[_0x17c8('0xf')][_0x17c8('0x5c')](_0x17c8('0x5d'),''),_0x438036['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x17c8('0x60')](function(_0x20ca82){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x17c8('0x65')](_0x20ca82,{'showHidden':!![],'depth':null}));});};exports[_0x17c8('0x66')]=function(_0x29ec64,_0x591c21,_0x54930c,_0x35df7e,_0xbc46be,_0x50d1af){var _0x558dbd,_0x2f7533;_0x50d1af[_0x17c8('0xf')]=intUtil[_0x17c8('0x47')](_0x50d1af[_0x17c8('0xf')]);_0x50d1af['serverUrl']=intUtil[_0x17c8('0x47')](_0x50d1af[_0x17c8('0x48')]);if(_0xbc46be&&_0xbc46be[_0x17c8('0x49')]){logger[_0x17c8('0xc')]('['+_0x591c21['lastevent'][_0x17c8('0x67')]()+']',_0x17c8('0x4a'));_0x591c21[_0x17c8('0x4b')]=util['format'](_0x17c8('0x4c'),_0x50d1af[_0x17c8('0x48')],_0x591c21[_0x17c8('0x4d')],md5(_0x591c21[_0x17c8('0x4d')]));}else{_0x591c21[_0x17c8('0x4b')]='';}headers['Authorization']=getAuth(_0x50d1af);return getUser(_0x50d1af)[_0x17c8('0x17')](function(_0x196e3c){_0x558dbd=_0x196e3c;logger['info'](_0x17c8('0x50'),_0x558dbd['id']);return getEndUser(_0x50d1af,_0x591c21['calleridname'],_0x591c21[_0x17c8('0x68')]);})[_0x17c8('0x17')](function(_0x13e21b){_0x2f7533=_0x13e21b;logger[_0x17c8('0xc')](_0x17c8('0x52'),_0x2f7533['id']);return getTicket(_0x50d1af,_0x558dbd,_0x2f7533,_0x54930c,_0x591c21);})[_0x17c8('0x17')](function(_0xd09ce1){if(_0xd09ce1){logger[_0x17c8('0xc')](_0x17c8('0x53'),_0xd09ce1['id']);}})['catch'](function(_0x3283b6){logger['error']('['+_0x591c21[_0x17c8('0x69')][_0x17c8('0x67')]()+']'+_0x17c8('0x6a'),util[_0x17c8('0x65')](_0x3283b6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 541c966..6913af9 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 _0x2c81=['/crm/EntityInfo.do?module=Calls&id=','calleridname','toUpperCase','lodash','request-promise','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','length','includes','string','picklist','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','refreshToken','clientId','clientSecret','then','add','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','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','Owner','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','answertime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','Called','complete','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','log','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','trigger:browser:url','https://crm.'];(function(_0xf858e,_0x51b0f1){var _0x5344d8=function(_0x5219d6){while(--_0x5219d6){_0xf858e['push'](_0xf858e['shift']());}};_0x5344d8(++_0x51b0f1);}(_0x2c81,0x1d1));var _0x12c8=function(_0x1caaa2,_0x2f03f2){_0x1caaa2=_0x1caaa2-0x0;var _0x469625=_0x2c81[_0x1caaa2];return _0x469625;};'use strict';var _=require(_0x12c8('0x0'));var rp=require(_0x12c8('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x12c8('0x2'));var moment=require('moment');var Redis=require(_0x12c8('0x3'));var BPromise=require('bluebird');var config=require(_0x12c8('0x4'));var logger=require(_0x12c8('0x5'))(_0x12c8('0x6'));config['redis']=_[_0x12c8('0x7')](config[_0x12c8('0x8')],{'host':_0x12c8('0x9'),'port':0x18eb});var io=require(_0x12c8('0xa'))(new Redis(config[_0x12c8('0x8')]));function emit(_0x188aa6,_0x61fc,_0x42c9fb){io['to'](_0x188aa6)[_0x12c8('0xb')](_0x61fc,_0x42c9fb);}function request(_0x345239){logger[_0x12c8('0xc')](_0x12c8('0xd'),JSON['stringify'](_0x345239));return rp(_0x345239);}function getCustomFields(_0x4b4292,_0x2b0f1d){var _0x736d9d={};if(_0x4b4292[_0x12c8('0xe')]>0x0){_['forEach'](_0x4b4292,function(_0x8967cb){if(_[_0x12c8('0xf')]([_0x12c8('0x10'),_0x12c8('0x11')],_0x8967cb['type'])&&_0x8967cb[_0x12c8('0x12')]){_0x736d9d[_0x8967cb[_0x12c8('0x12')]]=_0x8967cb[_0x12c8('0x13')][_0x12c8('0x14')]();}else if(_0x8967cb[_0x12c8('0x15')]===_0x12c8('0x16')&&_0x8967cb[_0x12c8('0x17')]&&_0x8967cb[_0x12c8('0x12')]&&_0x2b0f1d[_0x8967cb[_0x12c8('0x17')]]){_0x736d9d[_0x8967cb[_0x12c8('0x12')]]=_0x2b0f1d[_0x8967cb[_0x12c8('0x17')]][_0x12c8('0x14')]();}else if(_0x8967cb['type']==='customVariable'&&_0x8967cb[_0x12c8('0x18')]&&_0x8967cb['Variable']['name']&&_0x8967cb[_0x12c8('0x12')]&&_0x2b0f1d[_0x8967cb[_0x12c8('0x18')][_0x12c8('0x19')][_0x12c8('0x1a')]()]){_0x736d9d[_0x8967cb[_0x12c8('0x12')]]=_0x2b0f1d[_0x8967cb[_0x12c8('0x18')]['name'][_0x12c8('0x1a')]()]['toString']();}});}return _0x736d9d;}function getName(_0x2f5f5c){if(_0x2f5f5c[_0x12c8('0x1b')]('\x20')>0x0){var _0x23af18=_0x2f5f5c[_0x12c8('0x1c')](/ (.+)/);if(_0x23af18[0x1]){return _0x23af18;}}return[_0x2f5f5c,_0x2f5f5c];}var accountsTokens={};function getAccessToken(_0x45e430){return new Promise(function(_0x2a4fdc,_0x39966e){if(!_[_0x12c8('0x1d')](accountsTokens[_0x45e430['id']])&&!_[_0x12c8('0x1d')](accountsTokens[_0x45e430['id']][_0x12c8('0x1e')])){if(moment()[_0x12c8('0x1f')](accountsTokens[_0x45e430['id']][_0x12c8('0x20')])){_0x2a4fdc(accountsTokens[_0x45e430['id']][_0x12c8('0x1e')]);}}var _0x4a1b1d;switch(_0x45e430[_0x12c8('0x21')]){case'US':_0x4a1b1d=_0x12c8('0x22');break;case'AU':_0x4a1b1d=_0x12c8('0x23');break;case'EU':_0x4a1b1d=_0x12c8('0x24');break;case'IN':_0x4a1b1d='https://accounts.zoho.in';break;case'CN':_0x4a1b1d=_0x12c8('0x25');break;default:_0x4a1b1d=_0x12c8('0x24');break;}var _0x5ecdd2={'method':'POST','uri':_0x4a1b1d+'/oauth/v2/token','qs':{'refresh_token':_0x45e430[_0x12c8('0x26')],'client_id':_0x45e430[_0x12c8('0x27')],'client_secret':_0x45e430[_0x12c8('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5ecdd2)[_0x12c8('0x29')](function(_0x2b2090){accountsTokens[_0x45e430['id']]={'access_token':_0x2b2090[_0x12c8('0x1e')],'expires_in':moment()[_0x12c8('0x2a')](_0x2b2090[_0x12c8('0x20')],_0x12c8('0x2b'))};_0x2a4fdc(_0x2b2090[_0x12c8('0x1e')]);})['catch'](function(_0x4c1260){logger[_0x12c8('0x2c')](_0x12c8('0x2d'),_0x4c1260[_0x12c8('0x2e')]);_0x39966e(_0x4c1260);});});}function getUser(_0x32c058,_0x120724,_0x428ae8,_0x2212fb){logger[_0x12c8('0x2f')](_0x12c8('0x30'));return request({'method':_0x12c8('0x31'),'uri':util[_0x12c8('0x32')](_0x12c8('0x33'),_0x120724),'qs':{'type':_0x12c8('0x34')},'headers':{'Authorization':_0x12c8('0x35')+_0x32c058},'json':!![]})[_0x12c8('0x29')](function(_0x370ac8){if(_0x370ac8[_0x12c8('0x36')]){var _0x29cb94=-0x1;if(_[_0x12c8('0x37')](_0x370ac8[_0x12c8('0x36')])){if(!_['isNil'](_0x2212fb)){_0x29cb94=_['findIndex'](_0x370ac8[_0x12c8('0x36')],function(_0x428a84){return _0x428a84['email']===_0x2212fb;});}if(_0x29cb94>=0x0){logger[_0x12c8('0x2f')](_0x12c8('0x38'));}else{logger[_0x12c8('0x2f')](_0x12c8('0x39'));_0x29cb94=_[_0x12c8('0x3a')](_0x370ac8[_0x12c8('0x36')],function(_0x23a9ce){return _0x23a9ce[_0x12c8('0x3b')][_0x12c8('0x19')]==='Administrator';});}return _0x370ac8[_0x12c8('0x36')][_0x29cb94];}else{if(_0x370ac8[_0x12c8('0x3c')]['profile'][_0x12c8('0x19')]==='Administrator'){logger[_0x12c8('0x2f')](_0x12c8('0x39'));user=_0x370ac8[_0x12c8('0x3c')];return user;}else{logger[_0x12c8('0x2c')](_0x12c8('0x3d'),JSON[_0x12c8('0x3e')](_0x370ac8));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x12c8('0x3e')](_0x370ac8));}}}else{logger[_0x12c8('0x2c')](_0x12c8('0x3d'),JSON[_0x12c8('0x3e')](_0x370ac8));throw new Error(_0x12c8('0x3f')+JSON['stringify'](_0x370ac8));}})[_0x12c8('0x40')](function(_0x4be7a7){console['error'](_0x4be7a7);});}function getZohoUser(_0x1541f7,_0x5d7132){return new BPromise(function(_0x504242,_0x3d0eb0){request(_0x1541f7)['then'](function(_0x877cc){var _0x134415=null;if(_0x877cc){_0x134415=_0x877cc[_0x12c8('0x41')][0x0];_0x134415[_0x12c8('0x42')]=_0x5d7132;}_0x504242(_0x134415);})[_0x12c8('0x40')](function(_0x7008f2){_0x3d0eb0(_0x7008f2);});});}function createEndUser(_0x4b2122,_0x1c0ea4,_0x2a826c,_0x4113c8,_0x3346ce,_0x2890c7){var _0x2a826c=getName(_0x2a826c);return request({'method':_0x12c8('0x43'),'uri':_0x12c8('0x44')+_0x1c0ea4+_0x12c8('0x45')+_[_0x12c8('0x46')](_0x2890c7[_0x12c8('0x47')])+'s','body':{'data':[{'Last_Name':_0x2a826c[0x1],'First_Name':_0x2a826c[0x0],'Phone':_0x4113c8,'Owner':{'name':!_['isNil'](_0x3346ce['role'][_0x12c8('0x19')])?_0x3346ce[_0x12c8('0x48')][_0x12c8('0x19')]:!_['isNil'](_0x3346ce['first_name'])?_0x3346ce[_0x12c8('0x49')]+'\x20'+_0x3346ce[_0x12c8('0x4a')]:_0x3346ce[_0x12c8('0x4a')],'id':_0x3346ce['id']}}]},'headers':{'Authorization':_0x12c8('0x35')+_0x4b2122},'json':!![]})[_0x12c8('0x29')](function(_0x2b2434){if(_0x2b2434&&_0x2b2434[_0x12c8('0x41')][0x0][_0x12c8('0x4b')]===_0x12c8('0x4c')){var _0x4ab0b4=_0x2b2434[_0x12c8('0x41')][0x0]['details'];_0x4ab0b4[_0x12c8('0x42')]=_[_0x12c8('0x46')](_0x2890c7[_0x12c8('0x47')])+'s';return _0x4ab0b4;}logger[_0x12c8('0x2c')](_0x12c8('0x3d'),JSON[_0x12c8('0x3e')](data));throw new Error(_0x12c8('0x4d')+JSON[_0x12c8('0x3e')](data));})[_0x12c8('0x40')](function(_0x1b5bde){console['log'](_0x12c8('0x4e'),_0x1b5bde);});}function getEndUser(_0x48f233,_0x3c024f,_0x4158f2,_0x3c0eed,_0x5c272f,_0x3a3ab5,_0x792480){var _0x402820={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x48f233},'json':!![]};switch(_0x792480[_0x12c8('0x4f')]){case _0x12c8('0x50'):_0x402820[_0x12c8('0x51')]=_0x12c8('0x44')+_0x3c024f+_0x12c8('0x52')+_0x5c272f+'))';return getZohoUser(_0x402820,_0x12c8('0x53'))[_0x12c8('0x29')](function(_0x5cfa6e){if(_0x5cfa6e)return _0x5cfa6e;_0x402820['uri']=_0x12c8('0x44')+_0x3c024f+_0x12c8('0x54')+_0x5c272f+'))';return getZohoUser(_0x402820,_0x12c8('0x55'))['then'](function(_0x7dcf3b){if(_0x7dcf3b)return _0x7dcf3b;if(_0x792480[_0x12c8('0x47')]!='nothing'){return createEndUser(_0x48f233,_0x3c024f,_0x3c0eed,_0x5c272f,_0x3a3ab5,_0x792480);}else{return{};}});});break;case _0x12c8('0x56'):_0x402820[_0x12c8('0x51')]=_0x12c8('0x44')+_0x3c024f+_0x12c8('0x52')+_0x5c272f+'))';return getZohoUser(_0x402820,'Contacts')[_0x12c8('0x29')](function(_0x489a0a){if(_0x489a0a)return _0x489a0a;if(_0x792480[_0x12c8('0x47')]!=_0x12c8('0x57')){return createEndUser(_0x48f233,_0x3c024f,_0x3c0eed,_0x5c272f,_0x3a3ab5,_0x792480);}else{return{};}});break;case _0x12c8('0x58'):_0x402820['uri']=_0x12c8('0x44')+_0x3c024f+_0x12c8('0x54')+_0x5c272f+'))';return getZohoUser(_0x402820,_0x12c8('0x55'))[_0x12c8('0x29')](function(_0x25f6e9){if(_0x25f6e9)return _0x25f6e9;if(_0x792480[_0x12c8('0x47')]!=_0x12c8('0x57')){return createEndUser(_0x48f233,_0x3c024f,_0x3c0eed,_0x5c272f,_0x3a3ab5,_0x792480);}else{return{};}});break;}}function getCall(_0x415f63,_0x4a97dd,_0x20d442,_0x29e305,_0x172e75,_0x2d11f7,_0x2be49f,_0xe014a1){logger[_0x12c8('0x2f')](_0x12c8('0x59'));var _0x5407f2={};_0x5407f2[_0x12c8('0x5a')]={'name':!_[_0x12c8('0x1d')](_0x29e305[_0x12c8('0x48')][_0x12c8('0x19')])&&!_['isNil'](_0x29e305[_0x12c8('0x3b')][_0x12c8('0x19')])&&_0x29e305['profile'][_0x12c8('0x19')]==='administrator'?_0x29e305[_0x12c8('0x48')]['name']:!_[_0x12c8('0x1d')](_0x29e305[_0x12c8('0x49')])?_0x29e305[_0x12c8('0x49')]+'\x20'+_0x29e305[_0x12c8('0x4a')]:_0x29e305[_0x12c8('0x4a')],'id':_0x29e305['id']};_0x5407f2['Subject']=intUtil['getString'](_0x2d11f7['Subjects'],_0x2be49f,'\x20');_0x5407f2['Description']=intUtil[_0x12c8('0x5b')](_0x2d11f7[_0x12c8('0x5c')],_0x2be49f,'\x0a');if(_0x172e75[_0x12c8('0x42')]===_0x12c8('0x53')){_0x5407f2['Who_Id']={'name':!_[_0x12c8('0x1d')](_0x172e75[_0x12c8('0x5d')])?_0x172e75[_0x12c8('0x5d')]:!_[_0x12c8('0x1d')](_0x172e75[_0x12c8('0x5e')])?_0x172e75[_0x12c8('0x5e')]+'\x20'+_0x172e75['Last_Name']:_0x172e75[_0x12c8('0x5f')],'id':_0x172e75['id']};}if(_0x172e75['enduserType']===_0x12c8('0x55')){_0x5407f2[_0x12c8('0x60')]={'name':!_[_0x12c8('0x1d')](_0x172e75[_0x12c8('0x5d')])?_0x172e75[_0x12c8('0x5d')]:!_['isNil'](_0x172e75[_0x12c8('0x5e')])?_0x172e75['First_Name']+'\x20'+_0x172e75[_0x12c8('0x5f')]:_0x172e75['Last_Name'],'id':_0x172e75['id']};_0x5407f2[_0x12c8('0x61')]=_[_0x12c8('0x46')](_0x172e75[_0x12c8('0x42')]);}if(_0x2be49f['talktime']){_0x5407f2[_0x12c8('0x62')]=moment[_0x12c8('0x63')](parseInt(_0x2be49f[_0x12c8('0x64')])*0x3e8)[_0x12c8('0x32')]('mm:ss');}else if(_0x2be49f[_0x12c8('0x65')]&&_0x2be49f['endtime']){_0x5407f2[_0x12c8('0x62')]=moment[_0x12c8('0x63')](moment(_0x2be49f['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0x12c8('0x66')](moment(_0x2be49f[_0x12c8('0x67')],_0x12c8('0x68'))))['format']('mm:ss');}switch(_0x2be49f[_0x12c8('0x69')]){case'called':_0x5407f2[_0x12c8('0x6a')]=_0x12c8('0x6b');break;case _0x12c8('0x6c'):case'connect':_0x5407f2[_0x12c8('0x6a')]=_0x12c8('0x6d');break;case _0x12c8('0x6e'):_0x5407f2[_0x12c8('0x6a')]=_0x12c8('0x6f');break;case'abandoned':_0x5407f2[_0x12c8('0x6a')]=_0x12c8('0x70');break;case _0x12c8('0x71'):_0x5407f2[_0x12c8('0x6a')]=_0x12c8('0x72');default:}_0x5407f2[_0x12c8('0x73')]=(_0xe014a1===_0x12c8('0x74')?moment(_0x2be49f[_0x12c8('0x67')])[_0x12c8('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2be49f['agentcalledAt'])['format'](_0x12c8('0x68')))||moment()[_0x12c8('0x32')](_0x12c8('0x68'));_0x5407f2[_0x12c8('0x75')]=_0xe014a1||_0x12c8('0x76');_0x5407f2=_[_0x12c8('0x77')](_0x5407f2,getCustomFields(_0x2d11f7[_0x12c8('0x78')],_0x2be49f));return request({'method':_0x12c8('0x43'),'uri':_0x12c8('0x44')+_0x4a97dd+_0x12c8('0x79'),'headers':{'Authorization':_0x12c8('0x35')+_0x415f63},'body':{'data':[_0x5407f2]},'json':!![]})[_0x12c8('0x29')](function(_0x20aa76){if(_0x20aa76&&_0x20aa76[_0x12c8('0x41')][0x0][_0x12c8('0x4b')]===_0x12c8('0x4c')){logger[_0x12c8('0x2f')](_0x12c8('0x7a'));return{'id':_0x20aa76[_0x12c8('0x41')][0x0][_0x12c8('0x7b')]['id']};}})['catch'](function(_0x536148){logger[_0x12c8('0x2f')](_0x12c8('0x7c'),_0x536148[_0x12c8('0x2e')]);console[_0x12c8('0x7d')](_0x12c8('0x7c'),_0x536148);});}exports['queue']=function(_0x4b308c,_0xa0eb8d,_0xd099fd,_0x2e0d44,_0x481432,_0x3900b6){var _0x3ec90a,_0x586c54,_0x2407d7;_0x3900b6[_0x12c8('0x7e')]=intUtil[_0x12c8('0x7f')](_0x3900b6['host']);_0x3900b6['serverUrl']=intUtil['stripTrailingSlash'](_0x3900b6[_0x12c8('0x80')]);if(_0x481432&&_0x481432[_0x12c8('0x81')]){logger[_0x12c8('0x2f')](_0x12c8('0x82'),_0x12c8('0x83'));_0xa0eb8d['recordingURL']=_0x3900b6['serverUrl']+_0x12c8('0x84')+_0xa0eb8d[_0x12c8('0x85')]+'/downloads?type=uniqueid&token='+md5(_0xa0eb8d[_0x12c8('0x85')]);}else{_0xa0eb8d[_0x12c8('0x86')]='';}var _0x179b42=_0x3900b6['host']===_0x12c8('0x87')?'eu':_0x12c8('0x88');return getAccessToken(_0x3900b6)[_0x12c8('0x29')](function(_0x2bfae3){_0x2407d7=_0x2bfae3;return getUser(_0x2407d7,_0x179b42,_0x3900b6,_0x2e0d44[_0x12c8('0x89')]);})[_0x12c8('0x29')](function(_0x502298){_0x3ec90a=_0x502298;logger[_0x12c8('0x2f')](_0x12c8('0x8a'),_0x3ec90a['id']);return getEndUser(_0x2407d7,_0x179b42,_0x3900b6,_0xa0eb8d['calleridname'],_0xa0eb8d[_0x12c8('0x8b')],_0x3ec90a,_0xd099fd);})[_0x12c8('0x29')](function(_0x5cecd7){_0x586c54=_0x5cecd7;return getCall(_0x2407d7,_0x179b42,_0x3900b6,_0x3ec90a,_0x586c54,_0xd099fd,_0xa0eb8d,'Inbound');})[_0x12c8('0x29')](function(_0x3b2457){if(_0x3b2457){logger[_0x12c8('0x2f')](_0x12c8('0x8c'),_0x3b2457['id']);logger[_0x12c8('0x2f')](_0x12c8('0x82'),_0x12c8('0x8d'));emit(util[_0x12c8('0x32')](_0x12c8('0x8e'),_0x2e0d44[_0x12c8('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x3900b6[_0x12c8('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3b2457['id']});}})[_0x12c8('0x40')](function(_0x3d9812){logger[_0x12c8('0x2c')]('[QUEUE]',JSON[_0x12c8('0x3e')](_0x3d9812));});};exports[_0x12c8('0x74')]=function(_0x136c88,_0x3444af,_0x1b01fd,_0x3ce13c,_0x3ebc91,_0x102afb,_0x468088){var _0x54c545,_0x1244a4,_0xca7aed;_0x102afb[_0x12c8('0x7e')]=intUtil[_0x12c8('0x7f')](_0x102afb[_0x12c8('0x7e')]);_0x102afb[_0x12c8('0x80')]=intUtil[_0x12c8('0x7f')](_0x102afb[_0x12c8('0x80')]);if(_0x468088&&_0x468088[_0x12c8('0x8f')]&&_0x468088[_0x12c8('0x8f')]!==_0x12c8('0x90')){logger[_0x12c8('0x2f')](_0x12c8('0x91'),_0x12c8('0x83'));_0x3444af['recordingURL']=_0x102afb[_0x12c8('0x80')]+'/api/voice/recordings/'+_0x3444af['uniqueid']+_0x12c8('0x92')+md5(_0x3444af[_0x12c8('0x85')]);}var _0x191dfa=_0x102afb[_0x12c8('0x7e')]===_0x12c8('0x87')?'eu':_0x12c8('0x88');return getAccessToken(_0x102afb)[_0x12c8('0x29')](function(_0x590e55){_0xca7aed=_0x590e55;return getUser(_0xca7aed,_0x191dfa,_0x102afb,_0x3ce13c[_0x12c8('0x89')]);})[_0x12c8('0x29')](function(_0x35f7d8){_0x54c545=_0x35f7d8;logger['info']('The\x20User\x20ID\x20is:',_0x54c545['id']);return getEndUser(_0xca7aed,_0x191dfa,_0x102afb,_0x3444af['destcalleridname'],_0x3444af[_0x12c8('0x93')],_0x54c545,_0x1b01fd);})[_0x12c8('0x29')](function(_0x51790e){_0x1244a4=_0x51790e;return getCall(_0xca7aed,_0x191dfa,_0x102afb,_0x54c545,_0x1244a4,_0x1b01fd,_0x3444af,_0x12c8('0x94'));})[_0x12c8('0x29')](function(_0x2eeebb){if(_0x2eeebb){logger[_0x12c8('0x2f')](_0x12c8('0x8c'),_0x2eeebb['id']);logger[_0x12c8('0x2f')](_0x12c8('0x91'),_0x12c8('0x8d'));emit(util['format'](_0x12c8('0x8e'),_0x3ce13c[_0x12c8('0x19')]),_0x12c8('0x95'),{'uri':_0x12c8('0x96')+_0x102afb['host']+_0x12c8('0x97')+_0x2eeebb['id']});}})[_0x12c8('0x40')](function(_0x471561){logger['error'](_0x12c8('0x91'),JSON[_0x12c8('0x3e')](_0x471561));});};exports['unmanaged']=function(_0x15d39c,_0x4316d7,_0x528d5e,_0x172203,_0x165558,_0x5a8381){var _0x5d4e4a,_0x4252e7,_0x397d9c;_0x5a8381['host']=intUtil['stripTrailingSlash'](_0x5a8381[_0x12c8('0x7e')]);_0x5a8381[_0x12c8('0x80')]=intUtil[_0x12c8('0x7f')](_0x5a8381[_0x12c8('0x80')]);if(_0x165558&&_0x165558[_0x12c8('0x81')]){logger[_0x12c8('0x2f')]('['+_0x4316d7['lastevent']['toUpperCase']()+']',_0x12c8('0x83'));_0x4316d7['recordingURL']=_0x5a8381[_0x12c8('0x80')]+'/api/voice/recordings/'+_0x4316d7[_0x12c8('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x4316d7['uniqueid']);}else{_0x4316d7['recordingURL']='';}var _0x649c26=_0x5a8381[_0x12c8('0x7e')]==='zoho.eu'?'eu':_0x12c8('0x88');return getAccessToken(_0x5a8381)[_0x12c8('0x29')](function(_0x2a31d8){_0x397d9c=_0x2a31d8;return getUser(_0x397d9c,_0x649c26,_0x5a8381);})[_0x12c8('0x29')](function(_0x494268){_0x5d4e4a=_0x494268;logger[_0x12c8('0x2f')](_0x12c8('0x8a'),_0x5d4e4a['id']);return getEndUser(_0x397d9c,_0x649c26,_0x5a8381,_0x4316d7[_0x12c8('0x98')],_0x4316d7[_0x12c8('0x8b')],_0x5d4e4a,_0x528d5e);})['then'](function(_0x5bc8e9){_0x4252e7=_0x5bc8e9;return getCall(_0x397d9c,_0x649c26,_0x5a8381,_0x5d4e4a,_0x4252e7,_0x528d5e,_0x4316d7,'Inbound');})['then'](function(_0x162331){if(_0x162331){logger[_0x12c8('0x2f')](_0x12c8('0x8c'),_0x162331['id']);}})['catch'](function(_0x37c1b0){logger['error']('['+_0x4316d7[_0x12c8('0x69')][_0x12c8('0x99')]()+']',JSON[_0x12c8('0x3e')](_0x37c1b0));});}; \ No newline at end of file +var _0x0a1a=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','stripTrailingSlash','recordingFormat','none','/api/voice/recordings/','destcalleridnum','Outbound','[OUTBOUND]','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','access_token','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','/crm/v2/','moduleCreate','role','first_name','code','SUCCESS','startCase','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','https://www.zohoapis.','nothing','contact','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','host','serverUrl','monitor_format'];(function(_0x463376,_0x13871c){var _0x336ccd=function(_0x33afd2){while(--_0x33afd2){_0x463376['push'](_0x463376['shift']());}};_0x336ccd(++_0x13871c);}(_0x0a1a,0x161));var _0xa0a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a1a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa0a1('0x0'));var rp=require(_0xa0a1('0x1'));var md5=require(_0xa0a1('0x2'));var util=require(_0xa0a1('0x3'));var intUtil=require(_0xa0a1('0x4'));var moment=require(_0xa0a1('0x5'));var Redis=require(_0xa0a1('0x6'));var BPromise=require(_0xa0a1('0x7'));var config=require('../../../../config/environment');var logger=require(_0xa0a1('0x8'))(_0xa0a1('0x9'));config[_0xa0a1('0xa')]=_[_0xa0a1('0xb')](config[_0xa0a1('0xa')],{'host':_0xa0a1('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa0a1('0xa')]));function emit(_0xe8b7b3,_0xf9d4c8,_0x189e92){io['to'](_0xe8b7b3)[_0xa0a1('0xd')](_0xf9d4c8,_0x189e92);}function request(_0x303535){logger[_0xa0a1('0xe')](_0xa0a1('0xf'),JSON[_0xa0a1('0x10')](_0x303535));return rp(_0x303535);}function getCustomFields(_0x42a779,_0x2f61c5){var _0x2b9564={};if(_0x42a779['length']>0x0){_[_0xa0a1('0x11')](_0x42a779,function(_0x2d50d2){if(_['includes']([_0xa0a1('0x12'),_0xa0a1('0x13')],_0x2d50d2[_0xa0a1('0x14')])&&_0x2d50d2[_0xa0a1('0x15')]){_0x2b9564[_0x2d50d2[_0xa0a1('0x15')]]=_0x2d50d2[_0xa0a1('0x16')][_0xa0a1('0x17')]();}else if(_0x2d50d2['type']===_0xa0a1('0x18')&&_0x2d50d2[_0xa0a1('0x19')]&&_0x2d50d2[_0xa0a1('0x15')]&&_0x2f61c5[_0x2d50d2[_0xa0a1('0x19')]]){_0x2b9564[_0x2d50d2[_0xa0a1('0x15')]]=_0x2f61c5[_0x2d50d2[_0xa0a1('0x19')]][_0xa0a1('0x17')]();}else if(_0x2d50d2[_0xa0a1('0x14')]===_0xa0a1('0x1a')&&_0x2d50d2[_0xa0a1('0x1b')]&&_0x2d50d2['Variable'][_0xa0a1('0x1c')]&&_0x2d50d2['idField']&&_0x2f61c5[_0x2d50d2[_0xa0a1('0x1b')][_0xa0a1('0x1c')][_0xa0a1('0x1d')]()]){_0x2b9564[_0x2d50d2[_0xa0a1('0x15')]]=_0x2f61c5[_0x2d50d2[_0xa0a1('0x1b')][_0xa0a1('0x1c')][_0xa0a1('0x1d')]()][_0xa0a1('0x17')]();}});}return _0x2b9564;}function getName(_0x5b0e25){if(_0x5b0e25[_0xa0a1('0x1e')]('\x20')>0x0){var _0x228638=_0x5b0e25[_0xa0a1('0x1f')](/ (.+)/);if(_0x228638[0x1]){return _0x228638;}}return[_0x5b0e25,_0x5b0e25];}var accountsTokens={};function getAccessToken(_0x2d479f){return new Promise(function(_0x494553,_0x3c31dd){if(!_[_0xa0a1('0x20')](accountsTokens[_0x2d479f['id']])&&!_[_0xa0a1('0x20')](accountsTokens[_0x2d479f['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x2d479f['id']][_0xa0a1('0x21')])){_0x494553(accountsTokens[_0x2d479f['id']]['access_token']);}}var _0x45c72f;switch(_0x2d479f[_0xa0a1('0x22')]){case'US':_0x45c72f=_0xa0a1('0x23');break;case'AU':_0x45c72f='https://accounts.zoho.com.au';break;case'EU':_0x45c72f=_0xa0a1('0x24');break;case'IN':_0x45c72f=_0xa0a1('0x25');break;case'CN':_0x45c72f=_0xa0a1('0x26');break;default:_0x45c72f='https://accounts.zoho.eu';break;}var _0x4f84c0={'method':'POST','uri':_0x45c72f+_0xa0a1('0x27'),'qs':{'refresh_token':_0x2d479f[_0xa0a1('0x28')],'client_id':_0x2d479f[_0xa0a1('0x29')],'client_secret':_0x2d479f[_0xa0a1('0x2a')],'grant_type':_0xa0a1('0x2b')},'json':!![]};return rp(_0x4f84c0)[_0xa0a1('0x2c')](function(_0x4ca8e6){accountsTokens[_0x2d479f['id']]={'access_token':_0x4ca8e6['access_token'],'expires_in':moment()[_0xa0a1('0x2d')](_0x4ca8e6[_0xa0a1('0x21')],_0xa0a1('0x2e'))};_0x494553(_0x4ca8e6[_0xa0a1('0x2f')]);})[_0xa0a1('0x30')](function(_0x15d222){logger[_0xa0a1('0x31')](_0xa0a1('0x32'),_0x15d222[_0xa0a1('0x33')]);_0x3c31dd(_0x15d222);});});}function getUser(_0x41bc5e,_0x3b606b,_0x2255df,_0x3adee3){logger['info'](_0xa0a1('0x34'));return request({'method':_0xa0a1('0x35'),'uri':util['format'](_0xa0a1('0x36'),_0x3b606b),'qs':{'type':_0xa0a1('0x37')},'headers':{'Authorization':_0xa0a1('0x38')+_0x41bc5e},'json':!![]})[_0xa0a1('0x2c')](function(_0x471585){if(_0x471585[_0xa0a1('0x39')]){var _0x42294c=-0x1;if(_[_0xa0a1('0x3a')](_0x471585['users'])){if(!_['isNil'](_0x3adee3)){_0x42294c=_[_0xa0a1('0x3b')](_0x471585[_0xa0a1('0x39')],function(_0x586c90){return _0x586c90[_0xa0a1('0x3c')]===_0x3adee3;});}if(_0x42294c>=0x0){logger[_0xa0a1('0x3d')]('Agent\x20found!');}else{logger[_0xa0a1('0x3d')](_0xa0a1('0x3e'));_0x42294c=_[_0xa0a1('0x3b')](_0x471585[_0xa0a1('0x39')],function(_0x3dfb20){return _0x3dfb20['profile'][_0xa0a1('0x1c')]===_0xa0a1('0x3f');});}return _0x471585[_0xa0a1('0x39')][_0x42294c];}else{if(_0x471585[_0xa0a1('0x40')][_0xa0a1('0x41')]['name']==='Administrator'){logger[_0xa0a1('0x3d')](_0xa0a1('0x3e'));user=_0x471585[_0xa0a1('0x40')];return user;}else{logger[_0xa0a1('0x31')]('The\x20failing\x20result\x20is',JSON[_0xa0a1('0x10')](_0x471585));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x471585));}}}else{logger[_0xa0a1('0x31')](_0xa0a1('0x42'),JSON['stringify'](_0x471585));throw new Error(_0xa0a1('0x43')+JSON[_0xa0a1('0x10')](_0x471585));}})[_0xa0a1('0x30')](function(_0x59cec0){console[_0xa0a1('0x31')](_0x59cec0);});}function getZohoUser(_0x264422,_0x28ea8f){return new BPromise(function(_0xfd9343,_0x49cc1c){request(_0x264422)[_0xa0a1('0x2c')](function(_0x4ed612){var _0x4e4b74=null;if(_0x4ed612){_0x4e4b74=_0x4ed612[_0xa0a1('0x44')][0x0];_0x4e4b74[_0xa0a1('0x45')]=_0x28ea8f;}_0xfd9343(_0x4e4b74);})['catch'](function(_0x40adad){_0x49cc1c(_0x40adad);});});}function createEndUser(_0xde7a3e,_0x3c8e58,_0x24f6ae,_0x2b2cda,_0x597f28,_0x270da0){var _0x24f6ae=getName(_0x24f6ae);return request({'method':_0xa0a1('0x46'),'uri':'https://www.zohoapis.'+_0x3c8e58+_0xa0a1('0x47')+_['startCase'](_0x270da0[_0xa0a1('0x48')])+'s','body':{'data':[{'Last_Name':_0x24f6ae[0x1],'First_Name':_0x24f6ae[0x0],'Phone':_0x2b2cda,'Owner':{'name':!_[_0xa0a1('0x20')](_0x597f28[_0xa0a1('0x49')][_0xa0a1('0x1c')])?_0x597f28['role']['name']:!_[_0xa0a1('0x20')](_0x597f28[_0xa0a1('0x4a')])?_0x597f28[_0xa0a1('0x4a')]+'\x20'+_0x597f28['last_name']:_0x597f28['last_name'],'id':_0x597f28['id']}}]},'headers':{'Authorization':_0xa0a1('0x38')+_0xde7a3e},'json':!![]})[_0xa0a1('0x2c')](function(_0x100bac){if(_0x100bac&&_0x100bac[_0xa0a1('0x44')][0x0][_0xa0a1('0x4b')]===_0xa0a1('0x4c')){var _0x453575=_0x100bac[_0xa0a1('0x44')][0x0]['details'];_0x453575[_0xa0a1('0x45')]=_[_0xa0a1('0x4d')](_0x270da0[_0xa0a1('0x48')])+'s';return _0x453575;}logger[_0xa0a1('0x31')](_0xa0a1('0x42'),JSON[_0xa0a1('0x10')](data));throw new Error('Error:\x20'+JSON[_0xa0a1('0x10')](data));})[_0xa0a1('0x30')](function(_0x5b750c){console[_0xa0a1('0x4e')](_0xa0a1('0x4f'),_0x5b750c);});}function getEndUser(_0x5f1449,_0x2f1045,_0x49eb3b,_0xce220f,_0x2c7298,_0x1ba6eb,_0xdaa881){var _0x4b6ef2={'method':_0xa0a1('0x35'),'uri':'','headers':{'Authorization':_0xa0a1('0x38')+_0x5f1449},'json':!![]};switch(_0xdaa881['moduleSearch']){case'contact_lead':_0x4b6ef2[_0xa0a1('0x50')]='https://www.zohoapis.'+_0x2f1045+_0xa0a1('0x51')+_0x2c7298+'))';return getZohoUser(_0x4b6ef2,'Contacts')[_0xa0a1('0x2c')](function(_0x339f9a){if(_0x339f9a)return _0x339f9a;_0x4b6ef2[_0xa0a1('0x50')]=_0xa0a1('0x52')+_0x2f1045+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2c7298+'))';return getZohoUser(_0x4b6ef2,'Leads')[_0xa0a1('0x2c')](function(_0xa3c26f){if(_0xa3c26f)return _0xa3c26f;if(_0xdaa881[_0xa0a1('0x48')]!=_0xa0a1('0x53')){return createEndUser(_0x5f1449,_0x2f1045,_0xce220f,_0x2c7298,_0x1ba6eb,_0xdaa881);}else{return{};}});});break;case _0xa0a1('0x54'):_0x4b6ef2[_0xa0a1('0x50')]=_0xa0a1('0x52')+_0x2f1045+_0xa0a1('0x51')+_0x2c7298+'))';return getZohoUser(_0x4b6ef2,_0xa0a1('0x55'))[_0xa0a1('0x2c')](function(_0x590c1a){if(_0x590c1a)return _0x590c1a;if(_0xdaa881[_0xa0a1('0x48')]!='nothing'){return createEndUser(_0x5f1449,_0x2f1045,_0xce220f,_0x2c7298,_0x1ba6eb,_0xdaa881);}else{return{};}});break;case _0xa0a1('0x56'):_0x4b6ef2['uri']=_0xa0a1('0x52')+_0x2f1045+_0xa0a1('0x57')+_0x2c7298+'))';return getZohoUser(_0x4b6ef2,_0xa0a1('0x58'))[_0xa0a1('0x2c')](function(_0x3e721a){if(_0x3e721a)return _0x3e721a;if(_0xdaa881[_0xa0a1('0x48')]!=_0xa0a1('0x53')){return createEndUser(_0x5f1449,_0x2f1045,_0xce220f,_0x2c7298,_0x1ba6eb,_0xdaa881);}else{return{};}});break;}}function getCall(_0xa6138a,_0xf6a1cd,_0x15cb19,_0x46a68a,_0x35c13b,_0x290219,_0x38fdb8,_0x3e10d3){logger[_0xa0a1('0x3d')](_0xa0a1('0x59'));var _0x2ebbec={};_0x2ebbec[_0xa0a1('0x5a')]={'name':!_[_0xa0a1('0x20')](_0x46a68a['role'][_0xa0a1('0x1c')])&&!_[_0xa0a1('0x20')](_0x46a68a[_0xa0a1('0x41')][_0xa0a1('0x1c')])&&_0x46a68a[_0xa0a1('0x41')][_0xa0a1('0x1c')]===_0xa0a1('0x5b')?_0x46a68a[_0xa0a1('0x49')]['name']:!_[_0xa0a1('0x20')](_0x46a68a['first_name'])?_0x46a68a[_0xa0a1('0x4a')]+'\x20'+_0x46a68a['last_name']:_0x46a68a[_0xa0a1('0x5c')],'id':_0x46a68a['id']};_0x2ebbec[_0xa0a1('0x5d')]=intUtil['getString'](_0x290219['Subjects'],_0x38fdb8,'\x20');_0x2ebbec[_0xa0a1('0x5e')]=intUtil[_0xa0a1('0x5f')](_0x290219[_0xa0a1('0x60')],_0x38fdb8,'\x0a');if(_0x35c13b[_0xa0a1('0x45')]==='Contacts'){_0x2ebbec[_0xa0a1('0x61')]={'name':!_['isNil'](_0x35c13b[_0xa0a1('0x62')])?_0x35c13b[_0xa0a1('0x62')]:!_['isNil'](_0x35c13b[_0xa0a1('0x63')])?_0x35c13b[_0xa0a1('0x63')]+'\x20'+_0x35c13b[_0xa0a1('0x64')]:_0x35c13b[_0xa0a1('0x64')],'id':_0x35c13b['id']};}if(_0x35c13b[_0xa0a1('0x45')]===_0xa0a1('0x58')){_0x2ebbec[_0xa0a1('0x65')]={'name':!_[_0xa0a1('0x20')](_0x35c13b[_0xa0a1('0x62')])?_0x35c13b[_0xa0a1('0x62')]:!_[_0xa0a1('0x20')](_0x35c13b[_0xa0a1('0x63')])?_0x35c13b[_0xa0a1('0x63')]+'\x20'+_0x35c13b[_0xa0a1('0x64')]:_0x35c13b[_0xa0a1('0x64')],'id':_0x35c13b['id']};_0x2ebbec[_0xa0a1('0x66')]=_[_0xa0a1('0x4d')](_0x35c13b['enduserType']);}if(_0x38fdb8[_0xa0a1('0x67')]){_0x2ebbec[_0xa0a1('0x68')]=moment[_0xa0a1('0x69')](parseInt(_0x38fdb8[_0xa0a1('0x67')])*0x3e8)['format'](_0xa0a1('0x6a'));}else if(_0x38fdb8[_0xa0a1('0x6b')]&&_0x38fdb8[_0xa0a1('0x6c')]){_0x2ebbec[_0xa0a1('0x68')]=moment['utc'](moment(_0x38fdb8[_0xa0a1('0x6c')],_0xa0a1('0x6d'))[_0xa0a1('0x6e')](moment(_0x38fdb8[_0xa0a1('0x6f')],_0xa0a1('0x6d'))))[_0xa0a1('0x70')]('mm:ss');}switch(_0x38fdb8['lastevent']){case'called':_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x72');break;case _0xa0a1('0x73'):case _0xa0a1('0x74'):_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x75');break;case _0xa0a1('0x76'):_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x77');break;case'abandoned':_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x78');break;case _0xa0a1('0x79'):_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x7a');default:}_0x2ebbec[_0xa0a1('0x7b')]=(_0x3e10d3==='outbound'?moment(_0x38fdb8[_0xa0a1('0x6f')])['format'](_0xa0a1('0x6d')):moment(_0x38fdb8[_0xa0a1('0x7c')])[_0xa0a1('0x70')](_0xa0a1('0x6d')))||moment()['format'](_0xa0a1('0x6d'));_0x2ebbec[_0xa0a1('0x7d')]=_0x3e10d3||'Inbound';_0x2ebbec=_[_0xa0a1('0x7e')](_0x2ebbec,getCustomFields(_0x290219[_0xa0a1('0x7f')],_0x38fdb8));return request({'method':_0xa0a1('0x46'),'uri':_0xa0a1('0x52')+_0xf6a1cd+_0xa0a1('0x80'),'headers':{'Authorization':_0xa0a1('0x38')+_0xa6138a},'body':{'data':[_0x2ebbec]},'json':!![]})[_0xa0a1('0x2c')](function(_0x31e9ed){if(_0x31e9ed&&_0x31e9ed[_0xa0a1('0x44')][0x0][_0xa0a1('0x4b')]==='SUCCESS'){logger[_0xa0a1('0x3d')](_0xa0a1('0x81'));return{'id':_0x31e9ed[_0xa0a1('0x44')][0x0][_0xa0a1('0x82')]['id']};}})['catch'](function(_0x1bef9f){logger[_0xa0a1('0x3d')]('err',_0x1bef9f[_0xa0a1('0x33')]);console['log'](_0xa0a1('0x83'),_0x1bef9f);});}exports[_0xa0a1('0x84')]=function(_0xeeaa3d,_0x486f15,_0x206714,_0x29cee9,_0xd2118,_0x1e7b11){var _0x112da8,_0x5a2876,_0x4e34b5;_0x1e7b11['host']=intUtil['stripTrailingSlash'](_0x1e7b11[_0xa0a1('0x85')]);_0x1e7b11['serverUrl']=intUtil['stripTrailingSlash'](_0x1e7b11[_0xa0a1('0x86')]);if(_0xd2118&&_0xd2118[_0xa0a1('0x87')]){logger[_0xa0a1('0x3d')](_0xa0a1('0x88'),_0xa0a1('0x89'));_0x486f15[_0xa0a1('0x8a')]=_0x1e7b11[_0xa0a1('0x86')]+'/api/voice/recordings/'+_0x486f15[_0xa0a1('0x8b')]+_0xa0a1('0x8c')+md5(_0x486f15[_0xa0a1('0x8b')]);}else{_0x486f15['recordingURL']='';}var _0x3f71d4=_0x1e7b11[_0xa0a1('0x85')]===_0xa0a1('0x8d')?'eu':_0xa0a1('0x8e');return getAccessToken(_0x1e7b11)[_0xa0a1('0x2c')](function(_0x208c0f){_0x4e34b5=_0x208c0f;return getUser(_0x4e34b5,_0x3f71d4,_0x1e7b11,_0x29cee9[_0xa0a1('0x3c')]);})[_0xa0a1('0x2c')](function(_0x31fbd7){_0x112da8=_0x31fbd7;logger['info'](_0xa0a1('0x8f'),_0x112da8['id']);return getEndUser(_0x4e34b5,_0x3f71d4,_0x1e7b11,_0x486f15[_0xa0a1('0x90')],_0x486f15[_0xa0a1('0x91')],_0x112da8,_0x206714);})[_0xa0a1('0x2c')](function(_0x477b72){_0x5a2876=_0x477b72;return getCall(_0x4e34b5,_0x3f71d4,_0x1e7b11,_0x112da8,_0x5a2876,_0x206714,_0x486f15,_0xa0a1('0x92'));})['then'](function(_0x47b478){if(_0x47b478){logger['info'](_0xa0a1('0x93'),_0x47b478['id']);logger[_0xa0a1('0x3d')](_0xa0a1('0x88'),_0xa0a1('0x94'));emit(util[_0xa0a1('0x70')](_0xa0a1('0x95'),_0x29cee9[_0xa0a1('0x1c')]),_0xa0a1('0x96'),{'uri':_0xa0a1('0x97')+_0x1e7b11[_0xa0a1('0x85')]+'/crm/EntityInfo.do?module=Calls&id='+_0x47b478['id']});}})[_0xa0a1('0x30')](function(_0x317e19){logger[_0xa0a1('0x31')](_0xa0a1('0x88'),JSON[_0xa0a1('0x10')](_0x317e19));});};exports['outbound']=function(_0x1fba90,_0x285d5a,_0xcf28d3,_0x11bb66,_0x220213,_0x5f18cf,_0x30a9f1){var _0x297e48,_0x5894ca,_0x157da4;_0x5f18cf[_0xa0a1('0x85')]=intUtil[_0xa0a1('0x98')](_0x5f18cf['host']);_0x5f18cf[_0xa0a1('0x86')]=intUtil[_0xa0a1('0x98')](_0x5f18cf[_0xa0a1('0x86')]);if(_0x30a9f1&&_0x30a9f1['recordingFormat']&&_0x30a9f1[_0xa0a1('0x99')]!==_0xa0a1('0x9a')){logger[_0xa0a1('0x3d')]('[OUTBOUND]',_0xa0a1('0x89'));_0x285d5a[_0xa0a1('0x8a')]=_0x5f18cf[_0xa0a1('0x86')]+_0xa0a1('0x9b')+_0x285d5a[_0xa0a1('0x8b')]+'/downloads?type=uniqueid&token='+md5(_0x285d5a[_0xa0a1('0x8b')]);}var _0x52dbae=_0x5f18cf[_0xa0a1('0x85')]==='zoho.eu'?'eu':_0xa0a1('0x8e');return getAccessToken(_0x5f18cf)[_0xa0a1('0x2c')](function(_0x18367b){_0x157da4=_0x18367b;return getUser(_0x157da4,_0x52dbae,_0x5f18cf,_0x11bb66[_0xa0a1('0x3c')]);})['then'](function(_0x2b2ebb){_0x297e48=_0x2b2ebb;logger['info'](_0xa0a1('0x8f'),_0x297e48['id']);return getEndUser(_0x157da4,_0x52dbae,_0x5f18cf,_0x285d5a['destcalleridname'],_0x285d5a[_0xa0a1('0x9c')],_0x297e48,_0xcf28d3);})[_0xa0a1('0x2c')](function(_0x22893a){_0x5894ca=_0x22893a;return getCall(_0x157da4,_0x52dbae,_0x5f18cf,_0x297e48,_0x5894ca,_0xcf28d3,_0x285d5a,_0xa0a1('0x9d'));})[_0xa0a1('0x2c')](function(_0x2e00d2){if(_0x2e00d2){logger['info'](_0xa0a1('0x93'),_0x2e00d2['id']);logger[_0xa0a1('0x3d')](_0xa0a1('0x9e'),_0xa0a1('0x94'));emit(util[_0xa0a1('0x70')]('user:%s',_0x11bb66[_0xa0a1('0x1c')]),'trigger:browser:url',{'uri':'https://crm.'+_0x5f18cf[_0xa0a1('0x85')]+_0xa0a1('0x9f')+_0x2e00d2['id']});}})['catch'](function(_0x98d97e){logger[_0xa0a1('0x31')](_0xa0a1('0x9e'),JSON[_0xa0a1('0x10')](_0x98d97e));});};exports[_0xa0a1('0xa0')]=function(_0x580b02,_0x4bca5f,_0x2bee9c,_0x138969,_0x48ee96,_0x5085e4){var _0x3e4d8e,_0x3cdb3a,_0x59b76d;_0x5085e4[_0xa0a1('0x85')]=intUtil[_0xa0a1('0x98')](_0x5085e4[_0xa0a1('0x85')]);_0x5085e4[_0xa0a1('0x86')]=intUtil[_0xa0a1('0x98')](_0x5085e4[_0xa0a1('0x86')]);if(_0x48ee96&&_0x48ee96[_0xa0a1('0x87')]){logger[_0xa0a1('0x3d')]('['+_0x4bca5f[_0xa0a1('0xa1')]['toUpperCase']()+']',_0xa0a1('0x89'));_0x4bca5f['recordingURL']=_0x5085e4[_0xa0a1('0x86')]+_0xa0a1('0x9b')+_0x4bca5f[_0xa0a1('0x8b')]+_0xa0a1('0x8c')+md5(_0x4bca5f[_0xa0a1('0x8b')]);}else{_0x4bca5f[_0xa0a1('0x8a')]='';}var _0x5e882d=_0x5085e4[_0xa0a1('0x85')]===_0xa0a1('0x8d')?'eu':_0xa0a1('0x8e');return getAccessToken(_0x5085e4)[_0xa0a1('0x2c')](function(_0x4f2502){_0x59b76d=_0x4f2502;return getUser(_0x59b76d,_0x5e882d,_0x5085e4);})[_0xa0a1('0x2c')](function(_0x5cf2a5){_0x3e4d8e=_0x5cf2a5;logger[_0xa0a1('0x3d')](_0xa0a1('0x8f'),_0x3e4d8e['id']);return getEndUser(_0x59b76d,_0x5e882d,_0x5085e4,_0x4bca5f[_0xa0a1('0x90')],_0x4bca5f['calleridnum'],_0x3e4d8e,_0x2bee9c);})[_0xa0a1('0x2c')](function(_0x11ec5c){_0x3cdb3a=_0x11ec5c;return getCall(_0x59b76d,_0x5e882d,_0x5085e4,_0x3e4d8e,_0x3cdb3a,_0x2bee9c,_0x4bca5f,_0xa0a1('0x92'));})['then'](function(_0x4ee721){if(_0x4ee721){logger['info'](_0xa0a1('0x93'),_0x4ee721['id']);}})[_0xa0a1('0x30')](function(_0x4a29e7){logger[_0xa0a1('0x31')]('['+_0x4bca5f[_0xa0a1('0xa1')][_0xa0a1('0xa2')]()+']',JSON[_0xa0a1('0x10')](_0x4a29e7));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index e2d13bc..7733449 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 _0x2246=['../../../../config/logger','trigger','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0xe0c161,_0x354aaf){var _0x3978fc=function(_0x56acba){while(--_0x56acba){_0xe0c161['push'](_0xe0c161['shift']());}};_0x3978fc(++_0x354aaf);}(_0x2246,0x1ac));var _0x6224=function(_0x14017d,_0x346fdf){_0x14017d=_0x14017d-0x0;var _0x37d4aa=_0x2246[_0x14017d];return _0x37d4aa;};'use strict';var util=require(_0x6224('0x0'));var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x6224('0x1'))(_0x6224('0x2'));exports['exec']=function(_0x7346c7,_0x3709c7){var _0x27d92d=_0x7346c7[_0x6224('0x3')]?_0x7346c7[_0x6224('0x3')]:'Script';var _0x4e62ea=_0x7346c7[_0x6224('0x4')]?Mustache[_0x6224('0x5')](_0x7346c7[_0x6224('0x4')],_0x3709c7):_0x3709c7;sh['exec'](_0x4e62ea,function(_0x5194f9,_0x347958,_0x153dc5){if(_0x5194f9!==0x0){logger[_0x6224('0x6')](util[_0x6224('0x7')](_0x6224('0x8'),_0x27d92d,_0x4e62ea,_0x5194f9,_0x153dc5));}else{logger[_0x6224('0x9')](util[_0x6224('0x7')](_0x6224('0xa'),_0x27d92d,_0x4e62ea,_0x347958));}});}; \ No newline at end of file +var _0x33d9=['util','mustache','../../../../config/logger','trigger','exec','data2','render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x45d815,_0xf0e685){var _0x3a91f8=function(_0x53a33e){while(--_0x53a33e){_0x45d815['push'](_0x45d815['shift']());}};_0x3a91f8(++_0xf0e685);}(_0x33d9,0x104));var _0x933d=function(_0x14e0ad,_0x53fcfc){_0x14e0ad=_0x14e0ad-0x0;var _0x4123a4=_0x33d9[_0x14e0ad];return _0x4123a4;};'use strict';var util=require(_0x933d('0x0'));var sh=require('shelljs');var Mustache=require(_0x933d('0x1'));var logger=require(_0x933d('0x2'))(_0x933d('0x3'));exports[_0x933d('0x4')]=function(_0x341e17,_0x498505){var _0xdc4769=_0x341e17['data2']?_0x341e17[_0x933d('0x5')]:'Script';var _0x53cdf2=_0x341e17['data3']?Mustache[_0x933d('0x6')](_0x341e17[_0x933d('0x7')],_0x498505):_0x498505;sh['exec'](_0x53cdf2,function(_0x144823,_0x33e62a,_0x54ca71){if(_0x144823!==0x0){logger[_0x933d('0x8')](util[_0x933d('0x9')](_0x933d('0xa'),_0xdc4769,_0x53cdf2,_0x144823,_0x54ca71));}else{logger[_0x933d('0xb')](util[_0x933d('0x9')](_0x933d('0xc'),_0xdc4769,_0x53cdf2,_0x33e62a));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 88fc641..aa958aa 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 _0x7240=['headers','parse','data6','stack','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','request-promise','mustache','exec','data1','toUpperCase','render','data5','number'];(function(_0x5cb23e,_0x4ee4a7){var _0x135c55=function(_0xee5f08){while(--_0xee5f08){_0x5cb23e['push'](_0x5cb23e['shift']());}};_0x135c55(++_0x4ee4a7);}(_0x7240,0x178));var _0x0724=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x7240[_0x4b7895];return _0x264180;};'use strict';var rp=require(_0x0724('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x0724('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x0724('0x2')]=function(_0xda833c,_0x4448ac){var _0x47f465,_0x164cb7;var _0x59481={'method':_0xda833c[_0x0724('0x3')][_0x0724('0x4')](),'uri':Mustache[_0x0724('0x5')](_0xda833c['data2'],_0x4448ac),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xda833c[_0x0724('0x6')])===_0x0724('0x7')&&parseInt(_0xda833c['data5'])>=0x1&&parseInt(_0xda833c['data5'])<=0xa?parseInt(_0xda833c[_0x0724('0x6')])*0x3e8:0x5*0x3e8};try{_0x59481[_0x0724('0x8')]=_0xda833c['data6']?JSON[_0x0724('0x9')](Mustache[_0x0724('0x5')](_0xda833c[_0x0724('0xa')],_0x4448ac)):{};}catch(_0x398469){logger['error'](_0x398469[_0x0724('0xb')]);}switch(_0xda833c['data1']['toUpperCase']()){case'GET':case _0x0724('0xc'):_0x47f465=null;_0x59481['qs']=_0x4448ac;break;case _0x0724('0xd'):case _0x0724('0xe'):if(_0xda833c[_0x0724('0xf')]){try{_0x47f465=JSON[_0x0724('0x9')](Mustache['render'](_0xda833c[_0x0724('0xf')],_0x4448ac));_0x59481[_0x0724('0x10')]=_0x47f465;}catch(_0x54ce82){logger['error'](_0x54ce82[_0x0724('0xb')]);logger[_0x0724('0x11')](_0x0724('0x12'));}}else{_0x47f465=_0x4448ac;_0x59481['body']=_0x47f465;}break;}logger[_0x0724('0x13')](util[_0x0724('0x14')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0xda833c[_0x0724('0x3')],_0xda833c[_0x0724('0x15')],JSON[_0x0724('0x16')](_0x59481)));rp(_0x59481)[_0x0724('0x17')](function(_0x3077c5){_0x47f465=!_[_0x0724('0x18')](_0x47f465)?_0x0724('0x19')+_0x47f465:'';_0x164cb7=typeof _0x3077c5[_0x0724('0x10')]===_0x0724('0x1a')?JSON[_0x0724('0x16')](_0x3077c5[_0x0724('0x10')]):_0x3077c5[_0x0724('0x10')];logger[_0x0724('0x13')](util[_0x0724('0x14')](_0x0724('0x1b'),_0xda833c[_0x0724('0x3')],_0xda833c[_0x0724('0x15')],_0x3077c5[_0x0724('0x1c')],_0x164cb7));})[_0x0724('0x1d')](function(_0x232706){logger['error'](util[_0x0724('0x14')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0xda833c[_0x0724('0x3')],_0xda833c[_0x0724('0x15')],_0x232706[_0x0724('0x1c')],_0x232706[_0x0724('0x1e')],_0x232706[_0x0724('0x1f')]));});}; \ No newline at end of file +var _0xd87f=['DELETE','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data2','data5','number','headers','data6','parse','error','stack','toUpperCase','GET'];(function(_0x4cff9c,_0x399879){var _0xc9ba62=function(_0x20b788){while(--_0x20b788){_0x4cff9c['push'](_0x4cff9c['shift']());}};_0xc9ba62(++_0x399879);}(_0xd87f,0xb3));var _0xfd87=function(_0x2d3b99,_0x1ef1e0){_0x2d3b99=_0x2d3b99-0x0;var _0x164d35=_0xd87f[_0x2d3b99];return _0x164d35;};'use strict';var rp=require(_0xfd87('0x0'));var util=require(_0xfd87('0x1'));var _=require(_0xfd87('0x2'));var Mustache=require(_0xfd87('0x3'));var logger=require(_0xfd87('0x4'))(_0xfd87('0x5'));exports[_0xfd87('0x6')]=function(_0x2a971a,_0x3131a2){var _0x50079f,_0x5a55bc;var _0x38cc4c={'method':_0x2a971a[_0xfd87('0x7')]['toUpperCase'](),'uri':Mustache[_0xfd87('0x8')](_0x2a971a[_0xfd87('0x9')],_0x3131a2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2a971a[_0xfd87('0xa')])===_0xfd87('0xb')&&parseInt(_0x2a971a[_0xfd87('0xa')])>=0x1&&parseInt(_0x2a971a[_0xfd87('0xa')])<=0xa?parseInt(_0x2a971a[_0xfd87('0xa')])*0x3e8:0x5*0x3e8};try{_0x38cc4c[_0xfd87('0xc')]=_0x2a971a[_0xfd87('0xd')]?JSON[_0xfd87('0xe')](Mustache['render'](_0x2a971a[_0xfd87('0xd')],_0x3131a2)):{};}catch(_0x5d3ff5){logger[_0xfd87('0xf')](_0x5d3ff5[_0xfd87('0x10')]);}switch(_0x2a971a['data1'][_0xfd87('0x11')]()){case _0xfd87('0x12'):case _0xfd87('0x13'):_0x50079f=null;_0x38cc4c['qs']=_0x3131a2;break;case'POST':case'PUT':if(_0x2a971a[_0xfd87('0x14')]){try{_0x50079f=JSON['parse'](Mustache[_0xfd87('0x8')](_0x2a971a[_0xfd87('0x14')],_0x3131a2));_0x38cc4c[_0xfd87('0x15')]=_0x50079f;}catch(_0x1a064a){logger[_0xfd87('0xf')](_0x1a064a[_0xfd87('0x10')]);logger['error'](_0xfd87('0x16'));}}else{_0x50079f=_0x3131a2;_0x38cc4c['body']=_0x50079f;}break;}logger[_0xfd87('0x17')](util[_0xfd87('0x18')](_0xfd87('0x19'),_0x2a971a['data1'],_0x2a971a[_0xfd87('0x9')],JSON[_0xfd87('0x1a')](_0x38cc4c)));rp(_0x38cc4c)[_0xfd87('0x1b')](function(_0x17d4c9){_0x50079f=!_['isNil'](_0x50079f)?_0xfd87('0x1c')+_0x50079f:'';_0x5a55bc=typeof _0x17d4c9['body']===_0xfd87('0x1d')?JSON[_0xfd87('0x1a')](_0x17d4c9['body']):_0x17d4c9['body'];logger[_0xfd87('0x17')](util[_0xfd87('0x18')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2a971a[_0xfd87('0x7')],_0x2a971a['data2'],_0x17d4c9[_0xfd87('0x1e')],_0x5a55bc));})['catch'](function(_0x48f36f){logger[_0xfd87('0xf')](util['format'](_0xfd87('0x1f'),_0x2a971a[_0xfd87('0x7')],_0x2a971a[_0xfd87('0x9')],_0x48f36f['statusCode'],_0x48f36f['name'],_0x48f36f[_0xfd87('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 413efcf..9813acd 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 _0xd078=['debug','rpc','error','message','result','catch','exports','bluebird','routing','request','then'];(function(_0x820973,_0x4448c3){var _0x31b58a=function(_0x3d5225){while(--_0x3d5225){_0x820973['push'](_0x820973['shift']());}};_0x31b58a(++_0x4448c3);}(_0xd078,0x1a9));var _0x8d07=function(_0x2ec7aa,_0x4ec462){_0x2ec7aa=_0x2ec7aa-0x0;var _0x246745=_0xd078[_0x2ec7aa];return _0x246745;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x8d07('0x0'));var logger=require('../../config/logger')(_0x8d07('0x1'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x27ffae,_0x4cded3){return new BPromise(function(_0x12e156,_0x34efcd){return client[_0x8d07('0x2')](_0x27ffae,_0x4cded3)[_0x8d07('0x3')](function(_0x395984){logger[_0x8d07('0x4')](_0x8d07('0x5'),'routing',_0x27ffae,_0x4cded3,_0x395984);if(_0x395984['error']){logger[_0x8d07('0x6')]('rpc',_0x8d07('0x1'),_0x27ffae,_0x395984[_0x8d07('0x6')][_0x8d07('0x7')],_0x4cded3);return _0x34efcd(_0x395984[_0x8d07('0x6')][_0x8d07('0x7')]);}else{return _0x12e156(_0x395984[_0x8d07('0x8')]);}})[_0x8d07('0x9')](function(_0x1a02fa){logger[_0x8d07('0x6')](_0x8d07('0x5'),_0x8d07('0x1'),_0x27ffae,_0x1a02fa,_0x4cded3);return _0x34efcd(_0x1a02fa);});});};module[_0x8d07('0xa')]=client; \ No newline at end of file +var _0x5ced=['bluebird','../../config/logger','client','Request','request','then','rpc','routing','error','message','result','catch','exports','jayson/promise'];(function(_0xba227,_0xadb60e){var _0x31700b=function(_0xb4dbfe){while(--_0xb4dbfe){_0xba227['push'](_0xba227['shift']());}};_0x31700b(++_0xadb60e);}(_0x5ced,0x125));var _0xd5ce=function(_0x408165,_0x5fe9b9){_0x408165=_0x408165-0x0;var _0x3979bf=_0x5ced[_0x408165];return _0x3979bf;};'use strict';var jayson=require(_0xd5ce('0x0'));var BPromise=require(_0xd5ce('0x1'));var logger=require(_0xd5ce('0x2'))('routing');var client=jayson[_0xd5ce('0x3')]['http']({'port':0x2329});client[_0xd5ce('0x4')]=function(_0x4df5fc,_0x64fd9b){return new BPromise(function(_0x488136,_0x4bc275){return client[_0xd5ce('0x5')](_0x4df5fc,_0x64fd9b)[_0xd5ce('0x6')](function(_0x30053b){logger['debug'](_0xd5ce('0x7'),_0xd5ce('0x8'),_0x4df5fc,_0x64fd9b,_0x30053b);if(_0x30053b[_0xd5ce('0x9')]){logger[_0xd5ce('0x9')](_0xd5ce('0x7'),_0xd5ce('0x8'),_0x4df5fc,_0x30053b[_0xd5ce('0x9')][_0xd5ce('0xa')],_0x64fd9b);return _0x4bc275(_0x30053b[_0xd5ce('0x9')][_0xd5ce('0xa')]);}else{return _0x488136(_0x30053b[_0xd5ce('0xb')]);}})[_0xd5ce('0xc')](function(_0x4cf817){logger[_0xd5ce('0x9')]('rpc',_0xd5ce('0x8'),_0x4df5fc,_0x4cf817,_0x64fd9b);return _0x4bc275(_0x4cf817);});});};module[_0xd5ce('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index bee18f5..0bc728b 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 _0xee3f=['error','Email\x20service\x20initialization','./server','./realtime','./lib/email','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch'];(function(_0x9ffb7f,_0x4d05b9){var _0x2b0564=function(_0x321118){while(--_0x321118){_0x9ffb7f['push'](_0x9ffb7f['shift']());}};_0x2b0564(++_0x4d05b9);}(_0xee3f,0xd2));var _0xfee3=function(_0x16227c,_0x42a189){_0x16227c=_0x16227c-0x0;var _0x1a7e2c=_0xee3f[_0x16227c];return _0x1a7e2c;};'use strict';var server=require(_0xfee3('0x0'));var Realtime=require(_0xfee3('0x1'));var EmailChannel=require(_0xfee3('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xfee3('0x3'))(_0xfee3('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xfee3('0x5')]()[_0xfee3('0x6')](mailAccount[_0xfee3('0x7')]())[_0xfee3('0x6')](realtime[_0xfee3('0x8')]())[_0xfee3('0x6')](function(){email[_0xfee3('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xfee3('0xa')](realtime,email)[_0xfee3('0x6')](function(){return initRealtime();})[_0xfee3('0x6')](function(){return setting[_0xfee3('0xb')]();})[_0xfee3('0x6')](function(_0x46f8ac){return setInterval(initRealtime,_0x46f8ac[_0xfee3('0xc')]*0x3e8);})[_0xfee3('0xd')](function(_0x1437dc){logger[_0xfee3('0xe')](_0xfee3('0xf'),_0x1437dc);});}main(); \ No newline at end of file +var _0x49c3=['./lib/email','./rpc/mailAccount','resolve','then','initMailAccounts','refresh','listen','getSettings','error','Email\x20service\x20initialization','./server'];(function(_0x95a23f,_0xb7dbf1){var _0x2af726=function(_0xa9342a){while(--_0xa9342a){_0x95a23f['push'](_0x95a23f['shift']());}};_0x2af726(++_0xb7dbf1);}(_0x49c3,0x196));var _0x349c=function(_0x4310c2,_0x5a4ef6){_0x4310c2=_0x4310c2-0x0;var _0x52fee3=_0x49c3[_0x4310c2];return _0x52fee3;};'use strict';var server=require(_0x349c('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x349c('0x1'));var mailAccount=require(_0x349c('0x2'));var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x349c('0x3')]()['then'](mailAccount['getMailAccounts']())[_0x349c('0x4')](realtime[_0x349c('0x5')]())[_0x349c('0x4')](function(){email[_0x349c('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x349c('0x7')](realtime,email)[_0x349c('0x4')](function(){return initRealtime();})[_0x349c('0x4')](function(){return setting[_0x349c('0x8')]();})[_0x349c('0x4')](function(_0x2b5d6e){return setInterval(initRealtime,_0x2b5d6e['loginMailFrequency']*0x3e8);})['catch'](function(_0x19d432){logger[_0x349c('0x9')](_0x349c('0xa'),_0x19d432);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 86b03ed..48bd80c 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 _0x2923=['isNil','stringify','emit','mailAccount:update','refresh','hasOwnProperty','service','provider','imapAccounts','email','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','connected','messages','total','firstName','from','then','catch','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','bluebird','md5','redis','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','prototype','name','key','active','status','messageStatus','Imap'];(function(_0x3e8be1,_0x5ae90c){var _0x5265cd=function(_0x6a3dc0){while(--_0x6a3dc0){_0x3e8be1['push'](_0x3e8be1['shift']());}};_0x5265cd(++_0x5ae90c);}(_0x2923,0x1a9));var _0x3292=function(_0x17d5a0,_0x4f2b28){_0x17d5a0=_0x17d5a0-0x0;var _0x2b31a3=_0x2923[_0x17d5a0];return _0x2b31a3;};'use strict';var _=require(_0x3292('0x0'));var moment=require('moment');var BPromise=require(_0x3292('0x1'));var md5=require(_0x3292('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')('email');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3292('0x3')]));var EmailImap=require(_0x3292('0x4'));var EmailSmtp=require(_0x3292('0x5'));var mailAccount=require(_0x3292('0x6'));var md5Accounts={};function EmailChannel(_0x2fee4d){logger[_0x3292('0x7')]('start\x20email\x20channel');this[_0x3292('0x8')]=_0x2fee4d['mailAccounts'];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0x3292('0x9')]['emit']=function(_0x23fdc2){var _0x45eea5=this[_0x3292('0x8')][_0x23fdc2];var _0x249d52={'id':_0x45eea5['id'],'name':_0x45eea5[_0x3292('0xa')],'key':_0x45eea5[_0x3292('0xb')],'active':_0x45eea5[_0x3292('0xc')],'Imap':{'status':_0x45eea5['Imap'][_0x3292('0xd')],'messageStatus':_0x45eea5['Imap'][_0x3292('0xe')],'total':_0x45eea5[_0x3292('0xf')]['total']}};if(_[_0x3292('0x10')](md5Accounts[_0x23fdc2])){md5Accounts[_0x23fdc2]={};}var _0x13adf6=md5(JSON[_0x3292('0x11')](_0x249d52));if(md5Accounts[_0x23fdc2]['md5']!==_0x13adf6){md5Accounts[_0x23fdc2][_0x3292('0x2')]=_0x13adf6;io[_0x3292('0x12')](_0x3292('0x13'),_0x249d52);}};EmailChannel[_0x3292('0x9')][_0x3292('0x14')]=function(_0x1fff89){for(var _0x470a23 in _0x1fff89){if(_0x1fff89[_0x3292('0x15')](_0x470a23)){if(_0x1fff89[_0x470a23]['Imap']&&_0x1fff89[_0x470a23]['active']){var _0x4b66d0=_0x1fff89[_0x470a23][_0x3292('0xf')];if(!_0x4b66d0[_0x3292('0x16')]&&_0x1fff89[_0x470a23][_0x3292('0x17')]!=='custom')_0x4b66d0['service']=_0x1fff89[_0x470a23][_0x3292('0x17')];if(!this[_0x3292('0x18')]['hasOwnProperty'](_0x4b66d0['id'])){this[_0x3292('0x18')][_0x4b66d0['id']]=new EmailImap(_0x4b66d0,_0x1fff89[_0x470a23][_0x3292('0x19')]);this[_0x3292('0x18')][_0x4b66d0['id']]['on']('box',this[_0x3292('0x1a')][_0x3292('0x1b')](this,_0x470a23));this[_0x3292('0x18')][_0x4b66d0['id']]['on'](_0x3292('0x19'),this[_0x3292('0x1c')]['bind'](this,_0x470a23));this[_0x3292('0x18')][_0x4b66d0['id']]['on'](_0x3292('0x1d'),this[_0x3292('0x1e')]['bind'](this,_0x470a23));this['imapAccounts'][_0x4b66d0['id']]['on'](_0x3292('0x1f'),this['handleImapError']['bind'](this,_0x470a23));}}else{if(_[_0x3292('0x10')](this[_0x3292('0x8')][_0x470a23][_0x3292('0xf')])){this[_0x3292('0x8')][_0x470a23][_0x3292('0xf')]={};}this[_0x3292('0x8')][_0x470a23][_0x3292('0xf')]['status']=_0x3292('0x20');this[_0x3292('0x8')][_0x470a23][_0x3292('0xf')]['messageStatus']='';this[_0x3292('0x12')](_0x470a23);}}}};EmailChannel[_0x3292('0x9')]['handleImapBox']=function(_0x232c1e,_0x4e7564){if(this[_0x3292('0x8')][_0x232c1e]){this['mailAccounts'][_0x232c1e][_0x3292('0xf')][_0x3292('0xd')]=_0x3292('0x21');this[_0x3292('0x8')][_0x232c1e][_0x3292('0xf')]['messageStatus']=_0x4e7564[_0x3292('0xa')];if(_0x4e7564[_0x3292('0x22')]){this[_0x3292('0x8')][_0x232c1e]['Imap'][_0x3292('0x23')]=_0x4e7564[_0x3292('0x22')][_0x3292('0x23')];}return this[_0x3292('0x12')](_0x232c1e);}};EmailChannel[_0x3292('0x9')]['handleImapEmail']=function(_0x3d372b,_0x49dce8){logger[_0x3292('0x7')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x49dce8[_0x3292('0x24')],_0x49dce8['lastName'],_0x49dce8[_0x3292('0x25')],_0x3d372b);if(this[_0x3292('0x8')][_0x3d372b]){return mailAccount['notify'](_0x3d372b,_0x49dce8)[_0x3292('0x26')](function(_0x2828c6){if(_0x2828c6){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x3292('0x27')](function(_0x3fcd0c){logger[_0x3292('0x1f')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x3292('0x11')](_0x3fcd0c));});}};EmailChannel[_0x3292('0x9')][_0x3292('0x1e')]=function(_0x1f378f){if(this[_0x3292('0x8')][_0x1f378f]&&this[_0x3292('0x8')][_0x1f378f][_0x3292('0xf')]){if(this[_0x3292('0x18')][this[_0x3292('0x8')][_0x1f378f]['Imap']['id']]){delete this[_0x3292('0x18')][this[_0x3292('0x8')][_0x1f378f]['Imap']['id']];}this['mailAccounts'][_0x1f378f][_0x3292('0xf')][_0x3292('0x28')]=moment();this[_0x3292('0x12')](_0x1f378f);}};EmailChannel[_0x3292('0x9')]['handleImapError']=function(_0x1c7737,_0x3fd46b){if(this[_0x3292('0x8')][_0x1c7737]){this[_0x3292('0x8')][_0x1c7737][_0x3292('0xf')][_0x3292('0xd')]='error';this['mailAccounts'][_0x1c7737][_0x3292('0xf')][_0x3292('0xe')]=_0x3fd46b;return this['emit'](_0x1c7737);}};EmailChannel[_0x3292('0x9')][_0x3292('0x29')]=function(_0x5ef6ac,_0x4a1243){return this[_0x3292('0x2a')][_0x3292('0x2b')](_0x5ef6ac,_0x4a1243);};EmailChannel[_0x3292('0x9')][_0x3292('0x2c')]=function(_0x12c469){var _0x20beaf=this;if(this['mailAccounts'][_0x12c469['id']]){if(_[_0x3292('0x10')](this['mailAccounts'][_0x12c469['id']]['Smtp'])){this['mailAccounts'][_0x12c469['id']][_0x3292('0x2d')]={};}this[_0x3292('0x8')][_0x12c469['id']]['Smtp'][_0x3292('0x28')]=moment();return new BPromise(function(_0x4a3be9,_0x393ec1){return _0x20beaf['smtp'][_0x3292('0x2e')](_0x12c469)[_0x3292('0x26')](function(_0x20c202){_0x20beaf[_0x3292('0x8')][_0x12c469['id']][_0x3292('0x2d')][_0x3292('0xd')]=_0x3292('0x2f');_0x20beaf[_0x3292('0x8')][_0x12c469['id']][_0x3292('0x2d')]['messageStatus']='';_0x20beaf['emit'](_0x12c469['id']);_0x4a3be9(_0x20c202);})['catch'](function(_0x16cdb1){_0x20beaf['mailAccounts'][_0x12c469['id']]['Smtp'][_0x3292('0xd')]=_0x3292('0x1f');_0x20beaf[_0x3292('0x8')][_0x12c469['id']][_0x3292('0x2d')][_0x3292('0xe')]=_0x16cdb1;_0x20beaf[_0x3292('0x12')](_0x12c469['id']);_0x393ec1(_0x16cdb1);});});}return this[_0x3292('0x2a')][_0x3292('0x2e')](_0x12c469);};module[_0x3292('0x30')]=EmailChannel; \ No newline at end of file +var _0xdb3a=['mailAccount:update','refresh','hasOwnProperty','active','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','messageStatus','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','verifySmtp','Smtp','verify','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','Imap','status','isNil','stringify'];(function(_0x3ae256,_0x464cbd){var _0xdf0c35=function(_0x4f8484){while(--_0x4f8484){_0x3ae256['push'](_0x3ae256['shift']());}};_0xdf0c35(++_0x464cbd);}(_0xdb3a,0x163));var _0xadb3=function(_0x1ee04b,_0x554b3d){_0x1ee04b=_0x1ee04b-0x0;var _0x412848=_0xdb3a[_0x1ee04b];return _0x412848;};'use strict';var _=require(_0xadb3('0x0'));var moment=require('moment');var BPromise=require(_0xadb3('0x1'));var md5=require(_0xadb3('0x2'));var Redis=require(_0xadb3('0x3'));var config=require(_0xadb3('0x4'));var logger=require(_0xadb3('0x5'))(_0xadb3('0x6'));config[_0xadb3('0x7')]=_['defaults'](config[_0xadb3('0x7')],{'host':_0xadb3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xadb3('0x9'));var EmailSmtp=require(_0xadb3('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5794a2){logger[_0xadb3('0xb')](_0xadb3('0xc'));this[_0xadb3('0xd')]=_0x5794a2[_0xadb3('0xd')];this[_0xadb3('0xe')]={};this[_0xadb3('0xf')]=new EmailSmtp();}EmailChannel[_0xadb3('0x10')][_0xadb3('0x11')]=function(_0x4c7e04){var _0x50712a=this[_0xadb3('0xd')][_0x4c7e04];var _0x8469f={'id':_0x50712a['id'],'name':_0x50712a[_0xadb3('0x12')],'key':_0x50712a['key'],'active':_0x50712a['active'],'Imap':{'status':_0x50712a[_0xadb3('0x13')][_0xadb3('0x14')],'messageStatus':_0x50712a[_0xadb3('0x13')]['messageStatus'],'total':_0x50712a[_0xadb3('0x13')]['total']}};if(_[_0xadb3('0x15')](md5Accounts[_0x4c7e04])){md5Accounts[_0x4c7e04]={};}var _0x5d0d82=md5(JSON[_0xadb3('0x16')](_0x8469f));if(md5Accounts[_0x4c7e04]['md5']!==_0x5d0d82){md5Accounts[_0x4c7e04][_0xadb3('0x2')]=_0x5d0d82;io[_0xadb3('0x11')](_0xadb3('0x17'),_0x8469f);}};EmailChannel['prototype'][_0xadb3('0x18')]=function(_0x231946){for(var _0x1bad9d in _0x231946){if(_0x231946[_0xadb3('0x19')](_0x1bad9d)){if(_0x231946[_0x1bad9d]['Imap']&&_0x231946[_0x1bad9d][_0xadb3('0x1a')]){var _0x1eb745=_0x231946[_0x1bad9d]['Imap'];if(!_0x1eb745['service']&&_0x231946[_0x1bad9d][_0xadb3('0x1b')]!=='custom')_0x1eb745['service']=_0x231946[_0x1bad9d]['provider'];if(!this[_0xadb3('0xe')][_0xadb3('0x19')](_0x1eb745['id'])){this[_0xadb3('0xe')][_0x1eb745['id']]=new EmailImap(_0x1eb745,_0x231946[_0x1bad9d][_0xadb3('0x6')]);this[_0xadb3('0xe')][_0x1eb745['id']]['on'](_0xadb3('0x1c'),this[_0xadb3('0x1d')][_0xadb3('0x1e')](this,_0x1bad9d));this[_0xadb3('0xe')][_0x1eb745['id']]['on']('email',this[_0xadb3('0x1f')][_0xadb3('0x1e')](this,_0x1bad9d));this[_0xadb3('0xe')][_0x1eb745['id']]['on'](_0xadb3('0x20'),this[_0xadb3('0x21')][_0xadb3('0x1e')](this,_0x1bad9d));this[_0xadb3('0xe')][_0x1eb745['id']]['on'](_0xadb3('0x22'),this['handleImapError']['bind'](this,_0x1bad9d));}}else{if(_['isNil'](this['mailAccounts'][_0x1bad9d]['Imap'])){this['mailAccounts'][_0x1bad9d][_0xadb3('0x13')]={};}this['mailAccounts'][_0x1bad9d][_0xadb3('0x13')][_0xadb3('0x14')]=_0xadb3('0x23');this['mailAccounts'][_0x1bad9d][_0xadb3('0x13')][_0xadb3('0x24')]='';this['emit'](_0x1bad9d);}}}};EmailChannel[_0xadb3('0x10')][_0xadb3('0x1d')]=function(_0x1449c3,_0x2354f9){if(this['mailAccounts'][_0x1449c3]){this['mailAccounts'][_0x1449c3][_0xadb3('0x13')]['status']='connected';this[_0xadb3('0xd')][_0x1449c3]['Imap'][_0xadb3('0x24')]=_0x2354f9['name'];if(_0x2354f9[_0xadb3('0x25')]){this[_0xadb3('0xd')][_0x1449c3][_0xadb3('0x13')][_0xadb3('0x26')]=_0x2354f9[_0xadb3('0x25')][_0xadb3('0x26')];}return this[_0xadb3('0x11')](_0x1449c3);}};EmailChannel[_0xadb3('0x10')][_0xadb3('0x1f')]=function(_0x51482d,_0x414296){logger[_0xadb3('0xb')](_0xadb3('0x27'),_0x414296[_0xadb3('0x28')],_0x414296[_0xadb3('0x29')],_0x414296[_0xadb3('0x2a')],_0x51482d);if(this['mailAccounts'][_0x51482d]){return mailAccount[_0xadb3('0x2b')](_0x51482d,_0x414296)['then'](function(_0x37034a){if(_0x37034a){logger['info'](_0xadb3('0x2c'));}})[_0xadb3('0x2d')](function(_0x185e13){logger[_0xadb3('0x22')](_0xadb3('0x2e'),JSON['stringify'](_0x185e13));});}};EmailChannel[_0xadb3('0x10')][_0xadb3('0x21')]=function(_0xb18e9e){if(this[_0xadb3('0xd')][_0xb18e9e]&&this[_0xadb3('0xd')][_0xb18e9e][_0xadb3('0x13')]){if(this[_0xadb3('0xe')][this['mailAccounts'][_0xb18e9e][_0xadb3('0x13')]['id']]){delete this[_0xadb3('0xe')][this[_0xadb3('0xd')][_0xb18e9e][_0xadb3('0x13')]['id']];}this[_0xadb3('0xd')][_0xb18e9e]['Imap'][_0xadb3('0x2f')]=moment();this[_0xadb3('0x11')](_0xb18e9e);}};EmailChannel[_0xadb3('0x10')][_0xadb3('0x30')]=function(_0xf6de65,_0xa32d33){if(this[_0xadb3('0xd')][_0xf6de65]){this['mailAccounts'][_0xf6de65]['Imap'][_0xadb3('0x14')]=_0xadb3('0x22');this['mailAccounts'][_0xf6de65][_0xadb3('0x13')][_0xadb3('0x24')]=_0xa32d33;return this[_0xadb3('0x11')](_0xf6de65);}};EmailChannel['prototype'][_0xadb3('0x31')]=function(_0x28d4b5,_0x5af2c0){return this['smtp']['send'](_0x28d4b5,_0x5af2c0);};EmailChannel[_0xadb3('0x10')][_0xadb3('0x32')]=function(_0x27ec7b){var _0x231790=this;if(this[_0xadb3('0xd')][_0x27ec7b['id']]){if(_[_0xadb3('0x15')](this[_0xadb3('0xd')][_0x27ec7b['id']][_0xadb3('0x33')])){this[_0xadb3('0xd')][_0x27ec7b['id']]['Smtp']={};}this['mailAccounts'][_0x27ec7b['id']][_0xadb3('0x33')][_0xadb3('0x2f')]=moment();return new BPromise(function(_0x529bf5,_0x441cc3){return _0x231790[_0xadb3('0xf')][_0xadb3('0x34')](_0x27ec7b)['then'](function(_0x26b61e){_0x231790[_0xadb3('0xd')][_0x27ec7b['id']][_0xadb3('0x33')][_0xadb3('0x14')]='verified';_0x231790[_0xadb3('0xd')][_0x27ec7b['id']][_0xadb3('0x33')][_0xadb3('0x24')]='';_0x231790[_0xadb3('0x11')](_0x27ec7b['id']);_0x529bf5(_0x26b61e);})[_0xadb3('0x2d')](function(_0x38e3a3){_0x231790[_0xadb3('0xd')][_0x27ec7b['id']][_0xadb3('0x33')][_0xadb3('0x14')]=_0xadb3('0x22');_0x231790[_0xadb3('0xd')][_0x27ec7b['id']]['Smtp']['messageStatus']=_0x38e3a3;_0x231790[_0xadb3('0x11')](_0x27ec7b['id']);_0x441cc3(_0x38e3a3);});});}return this[_0xadb3('0xf')][_0xadb3('0x34')](_0x27ec7b);};module[_0xadb3('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 10f1f3e..ac839b0 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 _0x858f=['bind','end','handleEnd','handleError','connect','inherits','getAccount','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','port','tls','autotls','required','openBox','prototype','handleOpenBox','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchEnd','error','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','email','handleFetchError','textCode','hasOwnProperty','upperFirst','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','account','once','ready','handleReady'];(function(_0x5222d9,_0x12496d){var _0x16b0d5=function(_0x4220a6){while(--_0x4220a6){_0x5222d9['push'](_0x5222d9['shift']());}};_0x16b0d5(++_0x12496d);}(_0x858f,0xeb));var _0xf858=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x858f[_0x1b70e3];return _0x1452ab;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0xf858('0x0'));var simpleParser=require(_0xf858('0x1'))[_0xf858('0x2')];var Iconv=require(_0xf858('0x3'))[_0xf858('0x4')];var EventEmitter=require(_0xf858('0x5'))['EventEmitter'];var utils=require(_0xf858('0x6'));var logger=require(_0xf858('0x7'))('email');function EmailImap(_0x27b4a5,_0x4a985b){this[_0xf858('0x8')]=_0x27b4a5[_0xf858('0x8')];this[_0xf858('0x9')]=this['getAccount'](_0x27b4a5,_0x4a985b);this[_0xf858('0x0')]=new Imap(this[_0xf858('0x9')]);this[_0xf858('0x0')][_0xf858('0xa')](_0xf858('0xb'),this[_0xf858('0xc')][_0xf858('0xd')](this));this[_0xf858('0x0')][_0xf858('0xa')](_0xf858('0xe'),this[_0xf858('0xf')][_0xf858('0xd')](this));this['imap']['on']('error',this[_0xf858('0x10')][_0xf858('0xd')](this));this[_0xf858('0x0')][_0xf858('0x11')]();}util[_0xf858('0x12')](EmailImap,EventEmitter);EmailImap['prototype'][_0xf858('0x13')]=function(_0x37c2d0,_0x597343){var _0x37e817={'connTimeout':_0x37c2d0[_0xf858('0x14')]?_0x37c2d0['connTimeout']*0x3e8:0x2710,'authTimeout':_0x37c2d0[_0xf858('0x15')]?_0x37c2d0[_0xf858('0x15')]*0x3e8:0x1388};if(_0x37c2d0['service']){_0x37e817[_0xf858('0x16')]=_0x37c2d0[_0xf858('0x16')];if(_0x37c2d0[_0xf858('0x17')]){_0x37e817[_0xf858('0x18')]=utils[_0xf858('0x19')](_0x37c2d0[_0xf858('0x1a')][_0xf858('0x1b')],_0x37c2d0[_0xf858('0x16')]);}else{_0x37e817[_0xf858('0x1c')]=_0x37c2d0[_0xf858('0x1c')];}}else{if(_0x37c2d0[_0xf858('0x1d')]){_0x37e817[_0xf858('0x16')]=_0x37c2d0[_0xf858('0x16')];_0x37e817[_0xf858('0x1c')]=_0x37c2d0[_0xf858('0x1c')];}}_0x37e817['email']=_0x597343||_0x37c2d0['user']||_0xf858('0x1e');_0x37e817['host']=_0x37c2d0['host'];_0x37e817[_0xf858('0x1f')]=_0x37c2d0[_0xf858('0x1f')]||0x3e1;if(_0x37c2d0[_0xf858('0x20')]){_0x37e817['tls']=!![];}else{_0x37e817[_0xf858('0x20')]=![];_0x37e817[_0xf858('0x21')]=_0xf858('0x22');}return _0x37e817;};EmailImap['prototype'][_0xf858('0xc')]=function(){this['imap'][_0xf858('0x23')](this[_0xf858('0x8')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0xf858('0x24')][_0xf858('0x25')]=function(_0x69d667,_0x103cad){if(_0x69d667){this[_0xf858('0x10')](_0x69d667,!![]);}else{this[_0xf858('0x26')](_0xf858('0x27'),_0x103cad);this[_0xf858('0x28')]();}};EmailImap[_0xf858('0x24')][_0xf858('0x29')]=function(_0xf05c4a){if(_0xf05c4a){this[_0xf858('0x10')](_0xf05c4a,!![]);}else{this[_0xf858('0x0')][_0xf858('0xe')]();}};EmailImap[_0xf858('0x24')][_0xf858('0x28')]=function(){this[_0xf858('0x0')]['search']([_0xf858('0x2a')],this[_0xf858('0x2b')][_0xf858('0xd')](this));};EmailImap[_0xf858('0x24')][_0xf858('0x2b')]=function(_0x57b3cb,_0x4894a8){if(_0x57b3cb){this[_0xf858('0x10')](_0x57b3cb,!![]);}else{if(_0x4894a8[_0xf858('0x2c')]){try{var _0x370669=this[_0xf858('0x0')][_0xf858('0x2d')](_0x4894a8,{'bodies':'','markSeen':!![]});_0x370669['on'](_0xf858('0x2e'),this['handleFetchMessage'][_0xf858('0xd')](this));_0x370669[_0xf858('0xa')]('error',this['handleFetchError']['bind'](this));_0x370669[_0xf858('0xa')](_0xf858('0xe'),this[_0xf858('0x2f')][_0xf858('0xd')](this));}catch(_0x1ea1a7){logger[_0xf858('0x30')](_0x1ea1a7);}}else{this[_0xf858('0x0')][_0xf858('0x31')](!![],this[_0xf858('0x29')][_0xf858('0xd')](this));}}};EmailImap[_0xf858('0x24')][_0xf858('0x32')]=function(_0x3855e6){_0x3855e6['on']('body',this[_0xf858('0x33')]['bind'](this));_0x3855e6[_0xf858('0xa')](_0xf858('0x34'),this[_0xf858('0x35')]['bind'](this));_0x3855e6[_0xf858('0xa')](_0xf858('0xe'),this[_0xf858('0x36')]['bind'](this));};EmailImap[_0xf858('0x24')]['handleMessageBody']=function(_0x399be4){simpleParser(_0x399be4,{'Iconv':Iconv},this[_0xf858('0x37')][_0xf858('0xd')](this));};EmailImap['prototype'][_0xf858('0x35')]=function(){};EmailImap[_0xf858('0x24')][_0xf858('0x36')]=function(){};EmailImap[_0xf858('0x24')][_0xf858('0x37')]=function(_0x2e1228,_0x589d6f){if(_0x2e1228){logger['error'](_0x2e1228);}else{var _0x32d7a6=this;utils[_0xf858('0x38')](this[_0xf858('0x9')],_0x589d6f,function(_0x28fe6f){_0x32d7a6[_0xf858('0x26')](_0xf858('0x39'),_0x28fe6f);});}};EmailImap[_0xf858('0x24')][_0xf858('0x2f')]=function(){this['imap'][_0xf858('0x31')](!![],this[_0xf858('0x29')][_0xf858('0xd')](this));};EmailImap['prototype'][_0xf858('0x3a')]=function(_0x40bcc6){this[_0xf858('0x10')](_0x40bcc6);this['imap'][_0xf858('0x31')](!![],this[_0xf858('0x29')]['bind'](this));};EmailImap[_0xf858('0x24')]['handleEnd']=function(){this['emit'](_0xf858('0xe'));};EmailImap[_0xf858('0x24')][_0xf858('0x10')]=function(_0x353dca,_0x594707){logger[_0xf858('0x30')](_0xf858('0x10'),this[_0xf858('0x9')]['email'],JSON['stringify'](_0x353dca));var _0x2f822e='';if(_0x353dca){if(_0x353dca[_0xf858('0x3b')]){_0x2f822e=_0x353dca[_0xf858('0x3b')];}else{for(var _0x182a2e in _0x353dca){if(_0x353dca[_0xf858('0x3c')](_0x182a2e)){_0x2f822e+=_[_0xf858('0x3d')](_0x182a2e)+':\x20'+_0x353dca[_0x182a2e]+'\x0a';}}}}if(_0x594707){this[_0xf858('0x0')][_0xf858('0xe')]();}else{this['emit'](_0xf858('0x30'),_0x2f822e);this[_0xf858('0x26')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x93c1=['handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchError','stringify','textCode','upperFirst','exports','lodash','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','data5','password','authentication','email','host','port','tls','required','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchEnd','closeBox','body'];(function(_0x31d7ba,_0x2ca0f5){var _0x333aad=function(_0x563e40){while(--_0x563e40){_0x31d7ba['push'](_0x31d7ba['shift']());}};_0x333aad(++_0x2ca0f5);}(_0x93c1,0x1be));var _0x193c=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x93c1[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x193c('0x0'));var util=require(_0x193c('0x1'));var Imap=require(_0x193c('0x2'));var simpleParser=require('mailparser')[_0x193c('0x3')];var Iconv=require(_0x193c('0x4'))[_0x193c('0x5')];var EventEmitter=require(_0x193c('0x6'))[_0x193c('0x7')];var utils=require(_0x193c('0x8'));var logger=require(_0x193c('0x9'))('email');function EmailImap(_0x486da0,_0x587c7a){this[_0x193c('0xa')]=_0x486da0[_0x193c('0xa')];this[_0x193c('0xb')]=this[_0x193c('0xc')](_0x486da0,_0x587c7a);this[_0x193c('0x2')]=new Imap(this[_0x193c('0xb')]);this[_0x193c('0x2')]['once'](_0x193c('0xd'),this[_0x193c('0xe')][_0x193c('0xf')](this));this['imap'][_0x193c('0x10')](_0x193c('0x11'),this[_0x193c('0x12')][_0x193c('0xf')](this));this[_0x193c('0x2')]['on']('error',this[_0x193c('0x13')][_0x193c('0xf')](this));this[_0x193c('0x2')]['connect']();}util[_0x193c('0x14')](EmailImap,EventEmitter);EmailImap[_0x193c('0x15')][_0x193c('0xc')]=function(_0x3988ca,_0x1bd749){var _0x4acfd6={'connTimeout':_0x3988ca[_0x193c('0x16')]?_0x3988ca['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3988ca['authTimeout']?_0x3988ca[_0x193c('0x17')]*0x3e8:0x1388};if(_0x3988ca[_0x193c('0x18')]){_0x4acfd6[_0x193c('0x19')]=_0x3988ca[_0x193c('0x19')];if(_0x3988ca[_0x193c('0x1a')]){_0x4acfd6[_0x193c('0x1b')]=utils['generateXOAuth2Token'](_0x3988ca['CloudProvider'][_0x193c('0x1c')],_0x3988ca[_0x193c('0x19')]);}else{_0x4acfd6[_0x193c('0x1d')]=_0x3988ca[_0x193c('0x1d')];}}else{if(_0x3988ca[_0x193c('0x1e')]){_0x4acfd6[_0x193c('0x19')]=_0x3988ca[_0x193c('0x19')];_0x4acfd6[_0x193c('0x1d')]=_0x3988ca['password'];}}_0x4acfd6[_0x193c('0x1f')]=_0x1bd749||_0x3988ca[_0x193c('0x19')]||'anonymous@xcally.com';_0x4acfd6['host']=_0x3988ca[_0x193c('0x20')];_0x4acfd6[_0x193c('0x21')]=_0x3988ca[_0x193c('0x21')]||0x3e1;if(_0x3988ca['tls']){_0x4acfd6[_0x193c('0x22')]=!![];}else{_0x4acfd6[_0x193c('0x22')]=![];_0x4acfd6['autotls']=_0x193c('0x23');}return _0x4acfd6;};EmailImap[_0x193c('0x15')][_0x193c('0xe')]=function(){this[_0x193c('0x2')]['openBox'](this['mailbox'],![],this[_0x193c('0x24')][_0x193c('0xf')](this));};EmailImap['prototype'][_0x193c('0x24')]=function(_0x4fd73a,_0x582165){if(_0x4fd73a){this[_0x193c('0x13')](_0x4fd73a,!![]);}else{this['emit'](_0x193c('0x25'),_0x582165);this[_0x193c('0x26')]();}};EmailImap[_0x193c('0x15')][_0x193c('0x27')]=function(_0x23fbbb){if(_0x23fbbb){this[_0x193c('0x13')](_0x23fbbb,!![]);}else{this[_0x193c('0x2')][_0x193c('0x11')]();}};EmailImap['prototype'][_0x193c('0x26')]=function(){this['imap'][_0x193c('0x28')]([_0x193c('0x29')],this[_0x193c('0x2a')][_0x193c('0xf')](this));};EmailImap[_0x193c('0x15')][_0x193c('0x2a')]=function(_0x36dde8,_0x53bb90){if(_0x36dde8){this[_0x193c('0x13')](_0x36dde8,!![]);}else{if(_0x53bb90[_0x193c('0x2b')]){try{var _0x4053c2=this[_0x193c('0x2')][_0x193c('0x2c')](_0x53bb90,{'bodies':'','markSeen':!![]});_0x4053c2['on']('message',this[_0x193c('0x2d')][_0x193c('0xf')](this));_0x4053c2['once'](_0x193c('0x2e'),this['handleFetchError']['bind'](this));_0x4053c2[_0x193c('0x10')](_0x193c('0x11'),this[_0x193c('0x2f')][_0x193c('0xf')](this));}catch(_0x4666a4){logger['error'](_0x4666a4);}}else{this[_0x193c('0x2')][_0x193c('0x30')](!![],this['handleCloseBox'][_0x193c('0xf')](this));}}};EmailImap[_0x193c('0x15')][_0x193c('0x2d')]=function(_0x4d4714){_0x4d4714['on'](_0x193c('0x31'),this[_0x193c('0x32')][_0x193c('0xf')](this));_0x4d4714[_0x193c('0x10')](_0x193c('0x33'),this[_0x193c('0x34')][_0x193c('0xf')](this));_0x4d4714['once'](_0x193c('0x11'),this[_0x193c('0x35')][_0x193c('0xf')](this));};EmailImap[_0x193c('0x15')][_0x193c('0x32')]=function(_0x574489){simpleParser(_0x574489,{'Iconv':Iconv},this[_0x193c('0x36')]['bind'](this));};EmailImap[_0x193c('0x15')][_0x193c('0x34')]=function(){};EmailImap[_0x193c('0x15')]['handleMessageEnd']=function(){};EmailImap[_0x193c('0x15')][_0x193c('0x36')]=function(_0x1695e1,_0x4e57ae){if(_0x1695e1){logger[_0x193c('0x2e')](_0x1695e1);}else{var _0xaa0f77=this;utils[_0x193c('0x37')](this[_0x193c('0xb')],_0x4e57ae,function(_0x5b7ed1){_0xaa0f77[_0x193c('0x38')](_0x193c('0x1f'),_0x5b7ed1);});}};EmailImap[_0x193c('0x15')]['handleFetchEnd']=function(){this[_0x193c('0x2')][_0x193c('0x30')](!![],this[_0x193c('0x27')]['bind'](this));};EmailImap['prototype'][_0x193c('0x39')]=function(_0x211c2b){this[_0x193c('0x13')](_0x211c2b);this['imap'][_0x193c('0x30')](!![],this[_0x193c('0x27')][_0x193c('0xf')](this));};EmailImap[_0x193c('0x15')]['handleEnd']=function(){this[_0x193c('0x38')](_0x193c('0x11'));};EmailImap[_0x193c('0x15')][_0x193c('0x13')]=function(_0x2e34df,_0x598b33){logger[_0x193c('0x2e')](_0x193c('0x13'),this[_0x193c('0xb')][_0x193c('0x1f')],JSON[_0x193c('0x3a')](_0x2e34df));var _0x423d29='';if(_0x2e34df){if(_0x2e34df['textCode']){_0x423d29=_0x2e34df[_0x193c('0x3b')];}else{for(var _0x47bee7 in _0x2e34df){if(_0x2e34df['hasOwnProperty'](_0x47bee7)){_0x423d29+=_[_0x193c('0x3c')](_0x47bee7)+':\x20'+_0x2e34df[_0x47bee7]+'\x0a';}}}}if(_0x598b33){this[_0x193c('0x2')][_0x193c('0x11')]();}else{this[_0x193c('0x38')](_0x193c('0x2e'),_0x423d29);this[_0x193c('0x38')](_0x193c('0x11'));}};module[_0x193c('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 6a20b67..fe2a844 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 _0x7aba=['prototype','use','sendMail','toString','createTransport','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64'];(function(_0x597bdc,_0xc409c2){var _0x465537=function(_0x10af82){while(--_0x10af82){_0x597bdc['push'](_0x597bdc['shift']());}};_0x465537(++_0xc409c2);}(_0x7aba,0x170));var _0xa7ab=function(_0x1edca2,_0x91cc50){_0x1edca2=_0x1edca2-0x0;var _0xf96991=_0x7aba[_0x1edca2];return _0xf96991;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xa7ab('0x0'));function EmailSmtp(){}EmailSmtp[_0xa7ab('0x1')]['send']=function(_0x2089c6,_0x32e259){return new Promise(function(_0x4f9bf7,_0x57d4d2){var _0x3e8c90=nodemailer['createTransport'](_0x2089c6);_0x3e8c90[_0xa7ab('0x2')]('compile',inlineBase64());_0x3e8c90[_0xa7ab('0x3')](_0x32e259,function(_0x214dfe,_0x49dfd0){if(_0x214dfe){_0x57d4d2(_0x214dfe[_0xa7ab('0x4')]());}else{_0x4f9bf7(_0x49dfd0);}});});};EmailSmtp[_0xa7ab('0x1')]['verify']=function(_0x2f3ff0){return new Promise(function(_0x2bc567,_0x17b900){var _0x3ab310=nodemailer[_0xa7ab('0x5')](_0x2f3ff0);_0x3ab310[_0xa7ab('0x6')](function(_0x23d5cb,_0x228d3d){if(_0x23d5cb){_0x17b900(_0x23d5cb['toString']());}else{if(_0x228d3d){_0x2bc567(_0x228d3d);}else{_0x17b900(_0xa7ab('0x7'));}}});});};module[_0xa7ab('0x8')]=EmailSmtp; \ No newline at end of file +var _0x97c6=['prototype','send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64'];(function(_0x54e217,_0x243297){var _0x590ead=function(_0x2f1d78){while(--_0x2f1d78){_0x54e217['push'](_0x54e217['shift']());}};_0x590ead(++_0x243297);}(_0x97c6,0x1ad));var _0x697c=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x97c6[_0x178f52];return _0x556f99;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x697c('0x0'));function EmailSmtp(){}EmailSmtp[_0x697c('0x1')][_0x697c('0x2')]=function(_0x51a4d5,_0x2574af){return new Promise(function(_0x459b15,_0x5b249b){var _0x634b5b=nodemailer[_0x697c('0x3')](_0x51a4d5);_0x634b5b['use'](_0x697c('0x4'),inlineBase64());_0x634b5b[_0x697c('0x5')](_0x2574af,function(_0x261a72,_0x4c3994){if(_0x261a72){_0x5b249b(_0x261a72[_0x697c('0x6')]());}else{_0x459b15(_0x4c3994);}});});};EmailSmtp[_0x697c('0x1')][_0x697c('0x7')]=function(_0x2b5afb){return new Promise(function(_0x370c78,_0x11757a){var _0x50dad1=nodemailer[_0x697c('0x3')](_0x2b5afb);_0x50dad1['verify'](function(_0x10e205,_0x117553){if(_0x10e205){_0x11757a(_0x10e205[_0x697c('0x6')]());}else{if(_0x117553){_0x370c78(_0x117553);}else{_0x11757a(_0x697c('0x8'));}}});});};module[_0x697c('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 8ee279a..730000f 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 _0xb89f=['contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','BodyHTML','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','randomstring','util','node-tnef','address','anonymous','generate','value','name','substring','split','length','slice','join','Anonymous','head','pop','isEmpty','html','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','email','bcc','attachments','attachment','format','%s-%s','now','root','server/files/attachments/','writeFileSync'];(function(_0x4e1b06,_0x2155e3){var _0x374da5=function(_0x296b91){while(--_0x296b91){_0x4e1b06['push'](_0x4e1b06['shift']());}};_0x374da5(++_0x2155e3);}(_0xb89f,0x180));var _0xfb89=function(_0x3e8137,_0x38cbce){_0x3e8137=_0x3e8137-0x0;var _0x317062=_0xb89f[_0x3e8137];return _0x317062;};'use strict';var _=require(_0xfb89('0x0'));var moment=require('moment');var random=require(_0xfb89('0x1'));var fs=require('fs');var path=require('path');var util=require(_0xfb89('0x2'));var tnef=require(_0xfb89('0x3'));var logger=require('../../../config/logger')('email');var config=require('../../../config/environment');function getAddress(_0x3a07c3){var _0x5c694f=_['head'](_0x3a07c3['value']);return _0x5c694f&&_0x5c694f[_0xfb89('0x4')]?_0x5c694f[_0xfb89('0x4')]:_0xfb89('0x5')+random[_0xfb89('0x6')](0x6)+'@xcally.com';}function getFirstName(_0x29fddd){var _0x11e73a=_['head'](_0x29fddd[_0xfb89('0x7')]);if(_0x11e73a&&_0x11e73a[_0xfb89('0x8')]){if(_0x11e73a[_0xfb89('0x8')]==_0x11e73a[_0xfb89('0x4')]){return _0x11e73a[_0xfb89('0x8')][_0xfb89('0x9')](0x0,_0x11e73a['name']['indexOf']('@'));}var _0x50c90a=_0x11e73a[_0xfb89('0x8')][_0xfb89('0xa')](/\s+/);return _0x50c90a[_0xfb89('0xb')]>0x1?_0x50c90a[_0xfb89('0xc')](0x0,-0x1)[_0xfb89('0xd')]('\x20'):_0x11e73a[_0xfb89('0x8')];}return _0xfb89('0xe');}function getLastName(_0x26c447){var _0xb580b9=_[_0xfb89('0xf')](_0x26c447[_0xfb89('0x7')]);if(_0xb580b9&&_0xb580b9[_0xfb89('0x8')]){var _0x1200c6=_0xb580b9[_0xfb89('0x8')][_0xfb89('0xa')](/\s+/);return _0x1200c6[_0xfb89('0xb')]>0x1?_0x1200c6[_0xfb89('0x10')]():'';}return'';}function getMails(_0x94cfb3,_0x3493c0){var _0x18723e='';for(var _0x6aefb5=0x0;_0x6aefb5<_0x3493c0['value'][_0xfb89('0xb')];_0x6aefb5+=0x1){if(_0x3493c0['value'][_0x6aefb5][_0xfb89('0x4')]!==_0x94cfb3){if(!_[_0xfb89('0x11')](_0x18723e)){_0x18723e+=',';}_0x18723e+=_0x3493c0['value'][_0x6aefb5]['name']||_0x3493c0[_0xfb89('0x7')][_0x6aefb5][_0xfb89('0x4')]||'';_0x18723e+='\x20<';_0x18723e+=_0x3493c0['value'][_0x6aefb5]['address']?_0x3493c0['value'][_0x6aefb5]['address']:_0xfb89('0x5')+random[_0xfb89('0x6')](0x6)+'@xcally.com';_0x18723e+='>';}}return _0x18723e;}function parseEmail(_0xf0b74a,_0x255c65,_0x551394){if(_0x255c65[_0xfb89('0x12')]){var _0x1b8414=/)<[^<]*)*<\/script>/gi;while(_0x1b8414['test'](_0x255c65['html'])){_0x255c65[_0xfb89('0x12')]=_0x255c65['html']['replace'](_0x1b8414,'');}if(_0x255c65[_0xfb89('0x12')][_0xfb89('0x13')](_0xfb89('0x14'))){var _0x1c7adc=[];_0x255c65['attachments']['forEach'](_0x27363d=>{_0x1c7adc[_0xfb89('0x15')](_0x27363d[_0xfb89('0x16')]);});var _0x4e0995=/]+>/g;var _0x4d47fa=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4b6bf3=_0x255c65[_0xfb89('0x12')][_0xfb89('0x17')](_0x4d47fa,_0xfb89('0x18'));var _0x3ef89a=_0x4b6bf3['replace'](_0x4e0995,_0xfb89('0x19'));for(let _0x39d02e=0x0;_0x39d02e<_0x1c7adc[_0xfb89('0xb')];_0x39d02e++){var _0x506e1a=_0x3ef89a['replace'](_0xfb89('0x19'),_0xfb89('0x1a')+_0x1c7adc[_0x39d02e]+_0xfb89('0x1b'));_0x3ef89a=_0x506e1a;}_0x255c65[_0xfb89('0x12')]=_0x3ef89a;}_0x551394[_0xfb89('0x1c')]=_0x255c65[_0xfb89('0x12')];}else{_0x551394[_0xfb89('0x1c')]=_0x255c65[_0xfb89('0x1d')];}if(_0x551394[_0xfb89('0x1c')]){_0x551394['body']=_0x551394[_0xfb89('0x1c')][_0xfb89('0x17')](/0x0){var _0x318588=[_0xfb89('0x2c'),_0xfb89('0x2d'),_0xfb89('0x2e')];for(var _0x1f86e0=0x0;_0x1f86e0<_0x255c65['headerLines'][_0xfb89('0xb')];_0x1f86e0++){var _0x3d9d03=_[_0xfb89('0x2f')](_0x318588,_0x255c65['headerLines'][_0x1f86e0][_0xfb89('0x30')]);if(_0x3d9d03>=0x0){_0x551394[_0xfb89('0x31')]=!![];}}}return _0x551394;}exports[_0xfb89('0x32')]=function(_0x3ecc5b,_0x307934,_0x2bcdde){var _0xf5cb99={'from':getAddress(_0x307934[_0xfb89('0x33')]),'firstName':getFirstName(_0x307934[_0xfb89('0x33')]),'lastName':getLastName(_0x307934[_0xfb89('0x33')]),'mapKey':_0xfb89('0x20'),'message':{'from':getMails(_0x3ecc5b[_0xfb89('0x20')],_0x307934[_0xfb89('0x33')]),'to':_0x3ecc5b[_0xfb89('0x20')],'cc':'','subject':_0x307934[_0xfb89('0x34')]||'','messageId':_0x307934[_0xfb89('0x35')],'inReplyTo':_0x307934[_0xfb89('0x36')],'sentAt':moment(_0x307934[_0xfb89('0x37')])[_0xfb89('0x24')](_0xfb89('0x38')),'attach':![],'attachments':[]}};if(!_0x307934[_0xfb89('0x12')]&&!_0x307934['textAsHtml']){var _0x1000f8=_[_0xfb89('0x39')](_0x307934[_0xfb89('0x22')],{'contentType':'application/ms-tnef'});if(_0x1000f8[_0xfb89('0xb')]){logger['info'](util['format'](_0xfb89('0x3a'),_0x307934[_0xfb89('0x35')]));tnef[_0xfb89('0x3b')](_[_0xfb89('0x3c')](_0x1000f8)[_0xfb89('0x3d')],function(_0x2b332e,_0x5e1e35){if(_0x5e1e35){_0x307934['html']=_0x5e1e35[_0xfb89('0x3e')]||_0xfb89('0x3f');if(_0x5e1e35['Attachments']){for(var _0x506991=0x0;_0x506991<_0x5e1e35[_0xfb89('0x40')][_0xfb89('0xb')];_0x506991++){var _0x5d74bd=_0x5e1e35[_0xfb89('0x40')][_0x506991];_0xf5cb99[_0xfb89('0x1e')][_0xfb89('0x22')][_0xfb89('0x15')]({'filename':_0x5d74bd['Title'],'content':Buffer[_0xfb89('0x33')](_0x5d74bd[_0xfb89('0x41')])});}}}_0x2bcdde(parseEmail(_0x3ecc5b,_0x307934,_0xf5cb99));});}else{_0x307934[_0xfb89('0x12')]=_0xfb89('0x3f');_0x2bcdde(parseEmail(_0x3ecc5b,_0x307934,_0xf5cb99));}}else{_0x2bcdde(parseEmail(_0x3ecc5b,_0x307934,_0xf5cb99));}};exports[_0xfb89('0x42')]=function(_0xb54c8b,_0x117394){var _0x2a9411=[_0xfb89('0x43')+(_0x117394||''),_0xfb89('0x44')+_0xb54c8b,'',''];return Buffer[_0xfb89('0x33')](_0x2a9411[_0xfb89('0xd')](''),_0xfb89('0x45'))[_0xfb89('0x46')]('base64');}; \ No newline at end of file +var _0xc4a5=['filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','content','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','slice','join','split','length','isEmpty','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x3d7d6c[_0x5c4a('0x12')](0x0,-0x1)[_0x5c4a('0x13')]('\x20'):_0x347861['name'];}return'Anonymous';}function getLastName(_0x1629eb){var _0x113636=_['head'](_0x1629eb[_0x5c4a('0x9')]);if(_0x113636&&_0x113636[_0x5c4a('0xf')]){var _0x6f5171=_0x113636[_0x5c4a('0xf')][_0x5c4a('0x14')](/\s+/);return _0x6f5171[_0x5c4a('0x15')]>0x1?_0x6f5171['pop']():'';}return'';}function getMails(_0x52f915,_0x447e6e){var _0x1a2df2='';for(var _0x1f2e6e=0x0;_0x1f2e6e<_0x447e6e[_0x5c4a('0x9')][_0x5c4a('0x15')];_0x1f2e6e+=0x1){if(_0x447e6e[_0x5c4a('0x9')][_0x1f2e6e][_0x5c4a('0xa')]!==_0x52f915){if(!_[_0x5c4a('0x16')](_0x1a2df2)){_0x1a2df2+=',';}_0x1a2df2+=_0x447e6e[_0x5c4a('0x9')][_0x1f2e6e][_0x5c4a('0xf')]||_0x447e6e['value'][_0x1f2e6e][_0x5c4a('0xa')]||'';_0x1a2df2+='\x20<';_0x1a2df2+=_0x447e6e[_0x5c4a('0x9')][_0x1f2e6e]['address']?_0x447e6e[_0x5c4a('0x9')][_0x1f2e6e][_0x5c4a('0xa')]:_0x5c4a('0xb')+random[_0x5c4a('0xc')](0x6)+_0x5c4a('0xd');_0x1a2df2+='>';}}return _0x1a2df2;}function parseEmail(_0x7c7701,_0x444f5f,_0x35390a){if(_0x444f5f['html']){var _0x561f6f=/)<[^<]*)*<\/script>/gi;while(_0x561f6f[_0x5c4a('0x17')](_0x444f5f[_0x5c4a('0x18')])){_0x444f5f[_0x5c4a('0x18')]=_0x444f5f[_0x5c4a('0x18')][_0x5c4a('0x19')](_0x561f6f,'');}if(_0x444f5f[_0x5c4a('0x18')][_0x5c4a('0x1a')](_0x5c4a('0x1b'))){var _0x575bd7=[];_0x444f5f[_0x5c4a('0x1c')][_0x5c4a('0x1d')](_0x27ec81=>{_0x575bd7[_0x5c4a('0x1e')](_0x27ec81[_0x5c4a('0x1f')]);});var _0x4a4722=/]+>/g;var _0x193bb1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xea9080=_0x444f5f[_0x5c4a('0x18')][_0x5c4a('0x19')](_0x193bb1,_0x5c4a('0x20'));var _0xc886d2=_0xea9080[_0x5c4a('0x19')](_0x4a4722,_0x5c4a('0x21'));for(let _0x534913=0x0;_0x534913<_0x575bd7[_0x5c4a('0x15')];_0x534913++){var _0x4e6f9b=_0xc886d2[_0x5c4a('0x19')](_0x5c4a('0x21'),_0x5c4a('0x22')+_0x575bd7[_0x534913]+_0x5c4a('0x23'));_0xc886d2=_0x4e6f9b;}_0x444f5f[_0x5c4a('0x18')]=_0xc886d2;}_0x35390a[_0x5c4a('0x24')]=_0x444f5f[_0x5c4a('0x18')];}else{_0x35390a[_0x5c4a('0x24')]=_0x444f5f[_0x5c4a('0x25')];}if(_0x35390a[_0x5c4a('0x24')]){_0x35390a[_0x5c4a('0x24')]=_0x35390a['body']['replace'](/0x0){var _0x5c5ddc=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x22ace9=0x0;_0x22ace9<_0x444f5f[_0x5c4a('0x30')][_0x5c4a('0x15')];_0x22ace9++){var _0x122aac=_[_0x5c4a('0x11')](_0x5c5ddc,_0x444f5f[_0x5c4a('0x30')][_0x22ace9]['line']);if(_0x122aac>=0x0){_0x35390a[_0x5c4a('0x31')]=!![];}}}return _0x35390a;}exports[_0x5c4a('0x32')]=function(_0x482cbd,_0x4028e3,_0x2d789a){var _0x1020de={'from':getAddress(_0x4028e3[_0x5c4a('0x33')]),'firstName':getFirstName(_0x4028e3[_0x5c4a('0x33')]),'lastName':getLastName(_0x4028e3[_0x5c4a('0x33')]),'mapKey':_0x5c4a('0x7'),'message':{'from':getMails(_0x482cbd[_0x5c4a('0x7')],_0x4028e3[_0x5c4a('0x33')]),'to':_0x482cbd['email'],'cc':'','subject':_0x4028e3['subject']||'','messageId':_0x4028e3['messageId'],'inReplyTo':_0x4028e3[_0x5c4a('0x34')],'sentAt':moment(_0x4028e3[_0x5c4a('0x35')])[_0x5c4a('0x2c')](_0x5c4a('0x36')),'attach':![],'attachments':[]}};if(!_0x4028e3['html']&&!_0x4028e3[_0x5c4a('0x25')]){var _0x49d54d=_[_0x5c4a('0x37')](_0x4028e3[_0x5c4a('0x1c')],{'contentType':'application/ms-tnef'});if(_0x49d54d[_0x5c4a('0x15')]){logger[_0x5c4a('0x38')](util[_0x5c4a('0x2c')](_0x5c4a('0x39'),_0x4028e3[_0x5c4a('0x3a')]));tnef[_0x5c4a('0x3b')](_[_0x5c4a('0x3c')](_0x49d54d)[_0x5c4a('0x3d')],function(_0xf6bcc0,_0xa5ed92){if(_0xa5ed92){_0x4028e3['html']=_0xa5ed92['BodyHTML']||_0x5c4a('0x3e');if(_0xa5ed92[_0x5c4a('0x3f')]){for(var _0xfaef8d=0x0;_0xfaef8d<_0xa5ed92[_0x5c4a('0x3f')][_0x5c4a('0x15')];_0xfaef8d++){var _0x264f96=_0xa5ed92[_0x5c4a('0x3f')][_0xfaef8d];_0x1020de[_0x5c4a('0x27')][_0x5c4a('0x1c')][_0x5c4a('0x1e')]({'filename':_0x264f96[_0x5c4a('0x40')],'content':Buffer[_0x5c4a('0x33')](_0x264f96[_0x5c4a('0x41')])});}}}_0x2d789a(parseEmail(_0x482cbd,_0x4028e3,_0x1020de));});}else{_0x4028e3[_0x5c4a('0x18')]=_0x5c4a('0x3e');_0x2d789a(parseEmail(_0x482cbd,_0x4028e3,_0x1020de));}}else{_0x2d789a(parseEmail(_0x482cbd,_0x4028e3,_0x1020de));}};exports[_0x5c4a('0x42')]=function(_0x376fbc,_0xb2c041){var _0x397f22=[_0x5c4a('0x43')+(_0xb2c041||''),_0x5c4a('0x44')+_0x376fbc,'',''];return Buffer[_0x5c4a('0x33')](_0x397f22[_0x5c4a('0x13')](''),_0x5c4a('0x45'))[_0x5c4a('0x46')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 53f2eba..61e70f9 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 _0xbb00=['active','Imap','Smtp','exports','name','Service','key','SERV'];(function(_0x175d1e,_0x48ad7e){var _0x10aefc=function(_0x508d26){while(--_0x508d26){_0x175d1e['push'](_0x175d1e['shift']());}};_0x10aefc(++_0x48ad7e);}(_0xbb00,0x134));var _0x0bb0=function(_0x10463e,_0x3be01b){_0x10463e=_0x10463e-0x0;var _0x1966c6=_0xbb00[_0x10463e];return _0x1966c6;};'use strict';var _=require('lodash');function MailAccount(_0x372239){this['id']=_0x372239['id']||0x0;this['name']=_0x372239[_0x0bb0('0x0')]||_0x0bb0('0x1');this[_0x0bb0('0x2')]=_0x372239[_0x0bb0('0x2')]||_0x0bb0('0x3');this['active']=_0x372239[_0x0bb0('0x4')]||![];this[_0x0bb0('0x5')]=_0x372239[_0x0bb0('0x5')]||[];this['Smtp']=_0x372239[_0x0bb0('0x6')]||[];}module[_0x0bb0('0x7')]=MailAccount; \ No newline at end of file +var _0x3a35=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x417e0a,_0x446db8){var _0x223dab=function(_0x56978c){while(--_0x56978c){_0x417e0a['push'](_0x417e0a['shift']());}};_0x223dab(++_0x446db8);}(_0x3a35,0x108));var _0x53a3=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x3a35[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x53a3('0x0'));function MailAccount(_0x3ac964){this['id']=_0x3ac964['id']||0x0;this[_0x53a3('0x1')]=_0x3ac964[_0x53a3('0x1')]||_0x53a3('0x2');this[_0x53a3('0x3')]=_0x3ac964['key']||'SERV';this[_0x53a3('0x4')]=_0x3ac964[_0x53a3('0x4')]||![];this['Imap']=_0x3ac964[_0x53a3('0x5')]||[];this[_0x53a3('0x6')]=_0x3ac964[_0x53a3('0x6')]||[];}module[_0x53a3('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 9bf0cbf..494e860 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 _0x1dae=['length','isUndefined','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x2c54c0,_0x187cb3){var _0x34980f=function(_0x372ddc){while(--_0x372ddc){_0x2c54c0['push'](_0x2c54c0['shift']());}};_0x34980f(++_0x187cb3);}(_0x1dae,0x1a7));var _0xe1da=function(_0x3ae592,_0x1272d0){_0x3ae592=_0x3ae592-0x0;var _0x31406c=_0x1dae[_0x3ae592];return _0x31406c;};'use strict';var _=require(_0xe1da('0x0'));var MailAccount=require(_0xe1da('0x1'));var Realtime=function(){this[_0xe1da('0x2')]={};};function freeIsNotKey(_0x50cb85,_0x4d6bd8,_0x34c5cd){var _0x54e272=_[_0xe1da('0x3')](_0x50cb85,function(_0x18d478,_0x30b712){return _0x18d478[_0x34c5cd];});for(var _0x3dce4c in _0x4d6bd8){if(_0x4d6bd8[_0xe1da('0x4')](_0x3dce4c)){if(!_0x54e272[_0x3dce4c]){delete _0x4d6bd8[_0x3dce4c];}}}}Realtime[_0xe1da('0x5')][_0xe1da('0x6')]=function(_0x27daa2,_0x2ac27a){for(var _0x246ed8 in _0x2ac27a){if(_0x27daa2[_0xe1da('0x4')](_0x246ed8)){_0x27daa2[_0x246ed8]=_0x2ac27a[_0x246ed8];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x163ab6=this;return function(_0x1f5be4){if(_0x1f5be4){freeIsNotKey(_0x1f5be4,_0x163ab6['mailAccounts'],'id');for(var _0x50cec0=0x0,_0x4d9a86={},_0x257126={};_0x50cec0<_0x1f5be4[_0xe1da('0x7')];_0x50cec0+=0x1){_0x4d9a86=_0x1f5be4[_0x50cec0];if(_[_0xe1da('0x8')](_0x163ab6['mailAccounts'][_0x4d9a86['id']])){_0x163ab6[_0xe1da('0x2')][_0x4d9a86['id']]=new MailAccount(_0x4d9a86);}else{_['merge'](_0x163ab6[_0xe1da('0x2')][_0x4d9a86['id']],_0x4d9a86);}}}return _0x163ab6[_0xe1da('0x2')];};};module[_0xe1da('0x9')]=Realtime; \ No newline at end of file +var _0x26d0=['isUndefined','mailAccounts','merge','exports','lodash','../model/mailAccount','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','length'];(function(_0x2a12f6,_0x3e671a){var _0x20e702=function(_0x68a276){while(--_0x68a276){_0x2a12f6['push'](_0x2a12f6['shift']());}};_0x20e702(++_0x3e671a);}(_0x26d0,0x67));var _0x026d=function(_0x1067cf,_0x19f1fd){_0x1067cf=_0x1067cf-0x0;var _0x1324aa=_0x26d0[_0x1067cf];return _0x1324aa;};'use strict';var _=require(_0x026d('0x0'));var MailAccount=require(_0x026d('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4dfa01,_0x4a3831,_0x4e2a17){var _0x4c4630=_[_0x026d('0x2')](_0x4dfa01,function(_0x8e4ee1,_0x377256){return _0x8e4ee1[_0x4e2a17];});for(var _0x593035 in _0x4a3831){if(_0x4a3831['hasOwnProperty'](_0x593035)){if(!_0x4c4630[_0x593035]){delete _0x4a3831[_0x593035];}}}}Realtime[_0x026d('0x3')][_0x026d('0x4')]=function(_0x5906d0,_0x381a3b){for(var _0x4a465b in _0x381a3b){if(_0x5906d0[_0x026d('0x5')](_0x4a465b)){_0x5906d0[_0x4a465b]=_0x381a3b[_0x4a465b];}}};Realtime[_0x026d('0x3')]['initMailAccounts']=function(){var _0x1e427c=this;return function(_0x229459){if(_0x229459){freeIsNotKey(_0x229459,_0x1e427c['mailAccounts'],'id');for(var _0x199f7f=0x0,_0x95dfa7={},_0x291337={};_0x199f7f<_0x229459[_0x026d('0x6')];_0x199f7f+=0x1){_0x95dfa7=_0x229459[_0x199f7f];if(_[_0x026d('0x7')](_0x1e427c[_0x026d('0x8')][_0x95dfa7['id']])){_0x1e427c['mailAccounts'][_0x95dfa7['id']]=new MailAccount(_0x95dfa7);}else{_[_0x026d('0x9')](_0x1e427c[_0x026d('0x8')][_0x95dfa7['id']],_0x95dfa7);}}}return _0x1e427c[_0x026d('0x8')];};};module[_0x026d('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 62e3c00..45006ab 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 _0xf6fa=['key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','MailServerOut','Smtp','data5','getMailAccount','notify','Request','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','active'];(function(_0x470194,_0x1fd406){var _0x5d095b=function(_0x494d6a){while(--_0x494d6a){_0x470194['push'](_0x470194['shift']());}};_0x5d095b(++_0x1fd406);}(_0xf6fa,0x87));var _0xaf6f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf6fa[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0xaf6f('0x0')]=function(){return function(){return client['Request'](_0xaf6f('0x1'),{'options':{'attributes':['id',_0xaf6f('0x2'),_0xaf6f('0x3'),'service','email',_0xaf6f('0x4'),_0xaf6f('0x5'),_0xaf6f('0x6'),_0xaf6f('0x7')],'raw':![],'include':[{'model':_0xaf6f('0x8'),'as':_0xaf6f('0x9'),'include':[{'model':_0xaf6f('0xa'),'attributes':['id',_0xaf6f('0x2'),_0xaf6f('0xb'),_0xaf6f('0xc'),'data5'],'as':_0xaf6f('0xa')}]},{'model':_0xaf6f('0xd'),'as':_0xaf6f('0xe'),'include':[{'model':_0xaf6f('0xa'),'attributes':['id',_0xaf6f('0x2'),_0xaf6f('0xb'),'type',_0xaf6f('0xf')],'as':_0xaf6f('0xa')}]}]},'log':_0xaf6f('0x10')});};};exports[_0xaf6f('0x11')]=function(_0x5de17b,_0x514857){return client[_0xaf6f('0x12')](_0xaf6f('0x13'),{'account':{'id':_0x5de17b},'body':_0x514857,'log':_0xaf6f('0x13')});}; \ No newline at end of file +var _0x5fed=['GetMailAccount','name','provider','service','active','key','TemplateId','MailServerIn','Imap','type','data5','MailServerOut','Smtp','CloudProvider','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5fed,0xed));var _0xd5fe=function(_0x2f4311,_0xd2d511){_0x2f4311=_0x2f4311-0x0;var _0x309ccb=_0x5fed[_0x2f4311];return _0x309ccb;};'use strict';var client=require(_0xd5fe('0x0'));exports[_0xd5fe('0x1')]=function(){return function(){return client[_0xd5fe('0x2')](_0xd5fe('0x3'),{'options':{'attributes':['id',_0xd5fe('0x4'),_0xd5fe('0x5'),_0xd5fe('0x6'),'email',_0xd5fe('0x7'),_0xd5fe('0x8'),'ListId',_0xd5fe('0x9')],'raw':![],'include':[{'model':_0xd5fe('0xa'),'as':_0xd5fe('0xb'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0xd5fe('0xc'),_0xd5fe('0xd')],'as':'CloudProvider'}]},{'model':_0xd5fe('0xe'),'as':_0xd5fe('0xf'),'include':[{'model':_0xd5fe('0x10'),'attributes':['id','name',_0xd5fe('0x6'),_0xd5fe('0xc'),_0xd5fe('0xd')],'as':_0xd5fe('0x10')}]}]},'log':_0xd5fe('0x11')});};};exports[_0xd5fe('0x12')]=function(_0x2d9d14,_0xd326f4){return client['Request']('NotifyMailAccount',{'account':{'id':_0x2d9d14},'body':_0xd326f4,'log':_0xd5fe('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 40a8990..4b3a48c 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 _0x4dae=['loginMailFrequency','GetSettings','../client','Request','ShowSetting'];(function(_0x30bdcc,_0x71a33d){var _0x9c86cb=function(_0x5e0813){while(--_0x5e0813){_0x30bdcc['push'](_0x30bdcc['shift']());}};_0x9c86cb(++_0x71a33d);}(_0x4dae,0x183));var _0xe4da=function(_0x3264e6,_0x1c4164){_0x3264e6=_0x3264e6-0x0;var _0x531a30=_0x4dae[_0x3264e6];return _0x531a30;};'use strict';var client=require(_0xe4da('0x0'));exports['getSettings']=function(){return client[_0xe4da('0x1')](_0xe4da('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe4da('0x3')]},'log':_0xe4da('0x4')});}; \ No newline at end of file +var _0x54fc=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x54fc,0x6e));var _0xc54f=function(_0x4d02f0,_0x11bd74){_0x4d02f0=_0x4d02f0-0x0;var _0x6eb031=_0x54fc[_0x4d02f0];return _0x6eb031;};'use strict';var client=require(_0xc54f('0x0'));exports[_0xc54f('0x1')]=function(){return client[_0xc54f('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc54f('0x3')]},'log':_0xc54f('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f36993c..2a45fb0 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 26a12a8..0a9ef43 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 _0xfcc6=['timeout','port','socket.io','redis','defaults','localhost','socket.io-redis','../../config/socketio','default','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','../../config/environment'];(function(_0x4cfe4a,_0x20745e){var _0x2aa99d=function(_0x5ee383){while(--_0x5ee383){_0x4cfe4a['push'](_0x4cfe4a['shift']());}};_0x2aa99d(++_0x20745e);}(_0xfcc6,0x12e));var _0x6fcc=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0xfcc6[_0x15d18f];return _0xd12bf7;};'use strict';var _=require(_0x6fcc('0x0'));var http=require(_0x6fcc('0x1'));var express=require(_0x6fcc('0x2'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x6fcc('0x3'));var app=express();var server=http['createServer'](app);server[_0x6fcc('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0x6fcc('0x5')])){var socketio=require(_0x6fcc('0x6'))(server,{'transports':['websocket','polling']});config[_0x6fcc('0x7')]=_[_0x6fcc('0x8')](config[_0x6fcc('0x7')],{'host':_0x6fcc('0x9'),'port':0x18eb});socketio['adapter'](require(_0x6fcc('0xa'))({'pubClient':new Redis(config[_0x6fcc('0x7')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require(_0x6fcc('0xb'))[_0x6fcc('0xc')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x6fcc('0xc')](app);}else{server[_0x6fcc('0xd')](_0x6fcc('0xe'),function(){console['log'](_0x6fcc('0xf'),config[_0x6fcc('0x5')]);});}exports=module[_0x6fcc('0x10')]=app; \ No newline at end of file +var _0x4f75=['../../config/environment','timeout','port','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis'];(function(_0x1df8d9,_0xf253fd){var _0x142c25=function(_0x5ce490){while(--_0x5ce490){_0x1df8d9['push'](_0x1df8d9['shift']());}};_0x142c25(++_0xf253fd);}(_0x4f75,0xc3));var _0x54f7=function(_0x44be01,_0x3ffcbc){_0x44be01=_0x44be01-0x0;var _0x5c4cce=_0x4f75[_0x44be01];return _0x5c4cce;};'use strict';var _=require(_0x54f7('0x0'));var http=require(_0x54f7('0x1'));var express=require(_0x54f7('0x2'));var sticky=require(_0x54f7('0x3'));var Redis=require(_0x54f7('0x4'));var config=require(_0x54f7('0x5'));var app=express();var server=http['createServer'](app);server[_0x54f7('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x54f7('0x7')])){var socketio=require(_0x54f7('0x8'))(server,{'transports':[_0x54f7('0x9'),_0x54f7('0xa')]});config[_0x54f7('0xb')]=_['defaults'](config[_0x54f7('0xb')],{'host':_0x54f7('0xc'),'port':0x18eb});socketio[_0x54f7('0xd')](require(_0x54f7('0xe'))({'pubClient':new Redis(config[_0x54f7('0xb')]),'subClient':new Redis(config[_0x54f7('0xb')])}));require(_0x54f7('0xf'))[_0x54f7('0x10')]();require(_0x54f7('0x11'))[_0x54f7('0x10')](socketio);require(_0x54f7('0x12'))['default'](app);require(_0x54f7('0x13'))['default'](app);}else{server[_0x54f7('0x14')](_0x54f7('0x15'),function(){console[_0x54f7('0x16')](_0x54f7('0x17'),config[_0x54f7('0x7')]);});}exports=module[_0x54f7('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 28602fa..fa1aa4a 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 _0xf783=['error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc'];(function(_0x138c43,_0x3ba806){var _0x537847=function(_0x587880){while(--_0x587880){_0x138c43['push'](_0x138c43['shift']());}};_0x537847(++_0x3ba806);}(_0xf783,0x1a5));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x3f78('0x0'));var BPromise=require(_0x3f78('0x1'));var logger=require(_0x3f78('0x2'))(_0x3f78('0x3'));var client=jayson[_0x3f78('0x4')][_0x3f78('0x5')]({'port':0x2329});client[_0x3f78('0x6')]=function(_0xf9e10c,_0x918665){return new BPromise(function(_0x2df6a0,_0x5298f4){return client[_0x3f78('0x7')](_0xf9e10c,_0x918665)[_0x3f78('0x8')](function(_0x4dde66){logger[_0x3f78('0x9')](_0x3f78('0xa'),_0x3f78('0x3'),_0xf9e10c,_0x918665,_0x4dde66);if(_0x4dde66[_0x3f78('0xb')]){logger[_0x3f78('0xb')]('rpc',_0x3f78('0x3'),_0xf9e10c,_0x4dde66['error'][_0x3f78('0xc')],_0x918665);return _0x5298f4(_0x4dde66[_0x3f78('0xb')]['message']);}else{return _0x2df6a0(_0x4dde66[_0x3f78('0xd')]);}})[_0x3f78('0xe')](function(_0x1026dd){logger['error'](_0x3f78('0xa'),'routing',_0xf9e10c,_0x1026dd,_0x918665);return _0x5298f4(_0x1026dd);});});};module[_0x3f78('0xf')]=client; \ No newline at end of file +var _0x8649=['catch','exports','routing','client','http','Request','request','then','debug','rpc','error','message','result'];(function(_0x2657c1,_0x50043d){var _0x2a94c3=function(_0x6915e2){while(--_0x6915e2){_0x2657c1['push'](_0x2657c1['shift']());}};_0x2a94c3(++_0x50043d);}(_0x8649,0xab));var _0x9864=function(_0x2c64f9,_0x35ca72){_0x2c64f9=_0x2c64f9-0x0;var _0x53d89f=_0x8649[_0x2c64f9];return _0x53d89f;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x9864('0x0'));var client=jayson[_0x9864('0x1')][_0x9864('0x2')]({'port':0x2329});client[_0x9864('0x3')]=function(_0x5455eb,_0x93f41f){return new BPromise(function(_0x47cd10,_0x28c2ab){return client[_0x9864('0x4')](_0x5455eb,_0x93f41f)[_0x9864('0x5')](function(_0x26f08f){logger[_0x9864('0x6')](_0x9864('0x7'),'routing',_0x5455eb,_0x93f41f,_0x26f08f);if(_0x26f08f['error']){logger[_0x9864('0x8')](_0x9864('0x7'),_0x9864('0x0'),_0x5455eb,_0x26f08f[_0x9864('0x8')][_0x9864('0x9')],_0x93f41f);return _0x28c2ab(_0x26f08f[_0x9864('0x8')]['message']);}else{return _0x47cd10(_0x26f08f[_0x9864('0xa')]);}})[_0x9864('0xb')](function(_0x305ce6){logger[_0x9864('0x8')](_0x9864('0x7'),_0x9864('0x0'),_0x5455eb,_0x305ce6,_0x93f41f);return _0x28c2ab(_0x305ce6);});});};module[_0x9864('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 2352a68..16cd10c 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 _0x826e=['./realtime','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./server'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x826e,0x196));var _0xe826=function(_0x288a8f,_0x10ccdb){_0x288a8f=_0x288a8f-0x0;var _0x51ddd4=_0x826e[_0x288a8f];return _0x51ddd4;};'use strict';var BPromise=require(_0xe826('0x0'));var server=require(_0xe826('0x1'));var Realtime=require(_0xe826('0x2'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0xe826('0x3'));var chatQueue=require(_0xe826('0x4'));var smsQueue=require(_0xe826('0x5'));var mailQueue=require(_0xe826('0x6'));var faxQueue=require(_0xe826('0x7'));var whatsappQueue=require(_0xe826('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xe826('0x9')](user['getAgents']())[_0xe826('0x9')](realtime[_0xe826('0xa')]())[_0xe826('0x9')](interval['getIntervals']())[_0xe826('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0xe826('0xb')]())['then'](realtime[_0xe826('0xc')]())[_0xe826('0x9')](chatQueue[_0xe826('0xd')]())[_0xe826('0x9')](realtime[_0xe826('0xe')]())[_0xe826('0x9')](smsQueue[_0xe826('0xf')]())[_0xe826('0x9')](realtime[_0xe826('0x10')]())['then'](mailQueue[_0xe826('0x11')]())[_0xe826('0x9')](realtime[_0xe826('0x12')]())['then'](faxQueue[_0xe826('0x13')]())[_0xe826('0x9')](realtime[_0xe826('0x14')]())[_0xe826('0x9')](whatsappQueue['getWhatsappQueues']())[_0xe826('0x9')](realtime[_0xe826('0x15')]())[_0xe826('0x9')](function(){return realtime;});}function main(){return server[_0xe826('0x16')](realtime)[_0xe826('0x9')](function(_0xf1f89d){return initRealtime();})[_0xe826('0x9')](function(_0x2f6d7b){return setInterval(initRealtime,0x1388);})[_0xe826('0x17')](function(_0x14919e){console['log'](_0x14919e);});}main(); \ No newline at end of file +var _0xec5b=['getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xec5b,0x1c1));var _0xbec5=function(_0x861e31,_0x52a4b9){_0x861e31=_0x861e31-0x0;var _0x194bdf=_0xec5b[_0x861e31];return _0x194bdf;};'use strict';var BPromise=require(_0xbec5('0x0'));var server=require('./server');var Realtime=require(_0xbec5('0x1'));var user=require(_0xbec5('0x2'));var interval=require(_0xbec5('0x3'));var openchannelQueue=require(_0xbec5('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xbec5('0x5'));var faxQueue=require(_0xbec5('0x6'));var whatsappQueue=require(_0xbec5('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbec5('0x8')]()[_0xbec5('0x9')](user[_0xbec5('0xa')]())['then'](realtime['initAgents']())[_0xbec5('0x9')](interval[_0xbec5('0xb')]())[_0xbec5('0x9')](realtime[_0xbec5('0xc')]())[_0xbec5('0x9')](openchannelQueue[_0xbec5('0xd')]())[_0xbec5('0x9')](realtime[_0xbec5('0xe')]())[_0xbec5('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0xbec5('0xf')]())[_0xbec5('0x9')](smsQueue[_0xbec5('0x10')]())[_0xbec5('0x9')](realtime[_0xbec5('0x11')]())[_0xbec5('0x9')](mailQueue['getMailQueues']())['then'](realtime[_0xbec5('0x12')]())['then'](faxQueue[_0xbec5('0x13')]())['then'](realtime[_0xbec5('0x14')]())['then'](whatsappQueue[_0xbec5('0x15')]())['then'](realtime[_0xbec5('0x16')]())[_0xbec5('0x9')](function(){return realtime;});}function main(){return server[_0xbec5('0x17')](realtime)[_0xbec5('0x9')](function(_0x54e251){return initRealtime();})[_0xbec5('0x9')](function(_0x3b6e77){return setInterval(initRealtime,0x1388);})[_0xbec5('0x18')](function(_0x50bae8){console[_0xbec5('0x19')](_0x50bae8);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 16294b4..062ad70 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x172a71,_0x1347c5){var _0xce4c2f=function(_0x23bbc0){while(--_0x23bbc0){_0x172a71['push'](_0x172a71['shift']());}};_0xce4c2f(++_0x1347c5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x377f50,_0x5589ba){_0x377f50=_0x377f50-0x0;var _0x14a9d2=_0x1261[_0x377f50];return _0x14a9d2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index e02bc31..c80cf35 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 _0x02b1=['request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0xcc4251,_0x5a5be4){var _0x24946b=function(_0x230b18){while(--_0x230b18){_0xcc4251['push'](_0xcc4251['shift']());}};_0x24946b(++_0x5a5be4);}(_0x02b1,0x15d));var _0x102b=function(_0xce5612,_0x467ec6){_0xce5612=_0xce5612-0x0;var _0x1e6e56=_0x02b1[_0xce5612];return _0x1e6e56;};'use strict';var BPromise=require(_0x102b('0x0'));var jayson=require(_0x102b('0x1'));var client=jayson[_0x102b('0x2')]['http']({'port':0x232b});function request(_0x9d5685,_0x39e0b3){return new BPromise(function(_0x12e562,_0x464b1e){return client[_0x102b('0x3')](_0x9d5685,_0x39e0b3)[_0x102b('0x4')](function(_0x43ebe6){if(_0x43ebe6[_0x102b('0x5')]){return _0x464b1e(_0x43ebe6[_0x102b('0x5')][_0x102b('0x6')]);}else{return _0x12e562(_0x43ebe6[_0x102b('0x7')]);}})[_0x102b('0x8')](function(_0x288a50){return _0x464b1e(_0x288a50);});});}exports[_0x102b('0x9')]=function(_0x37fdc2,_0x4b5813){return request(_0x102b('0xa'),{'account':_0x37fdc2,'message':_0x4b5813});}; \ No newline at end of file +var _0xdbce=['request','then','error','message','catch','SendMail','bluebird','client','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdbce,0x7b));var _0xedbc=function(_0x17b8e2,_0x4d7aab){_0x17b8e2=_0x17b8e2-0x0;var _0x5e4b36=_0xdbce[_0x17b8e2];return _0x5e4b36;};'use strict';var BPromise=require(_0xedbc('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xedbc('0x1')][_0xedbc('0x2')]({'port':0x232b});function request(_0x2f17fa,_0x2fd23a){return new BPromise(function(_0x18cda5,_0x4d5f50){return client[_0xedbc('0x3')](_0x2f17fa,_0x2fd23a)[_0xedbc('0x4')](function(_0x4d8a20){if(_0x4d8a20['error']){return _0x4d5f50(_0x4d8a20[_0xedbc('0x5')][_0xedbc('0x6')]);}else{return _0x18cda5(_0x4d8a20['result']);}})[_0xedbc('0x7')](function(_0x195e79){return _0x4d5f50(_0x195e79);});});}exports['sendMailMessage']=function(_0x2f384f,_0x715132){return request(_0xedbc('0x8'),{'account':_0x2f384f,'message':_0x715132});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index e653073..041149a 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 _0x82c4=['mailCurrentCapacity','whatsappStatus','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busyQueue','smsWaitingInteractions','whatsappWaitingInteractions','emit','user:routing:update','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','mail','chat','openchannel','fax','sms','length','toNumber','Status','chatStatusTime','mailStatus'];(function(_0x4be000,_0x1c7319){var _0x4c6c89=function(_0x49f9d9){while(--_0x49f9d9){_0x4be000['push'](_0x4be000['shift']());}};_0x4c6c89(++_0x1c7319);}(_0x82c4,0x1ca));var _0x482c=function(_0x399a1e,_0x5d7c30){_0x399a1e=_0x399a1e-0x0;var _0x1077e1=_0x82c4[_0x399a1e];return _0x1077e1;};'use strict';var _=require(_0x482c('0x0'));var md5=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var Redis=require(_0x482c('0x3'));var config=require(_0x482c('0x4'));config[_0x482c('0x5')]=_[_0x482c('0x6')](config['redis'],{'host':_0x482c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x482c('0x5')]));function Agent(_0x47edb6){this['id']=_0x47edb6['id']||0x0;this[_0x482c('0x8')]=_0x47edb6['name']||'';this[_0x482c('0x9')]=_0x47edb6[_0x482c('0x9')]||!![];this[_0x482c('0xa')]=_0x47edb6[_0x482c('0xa')]||![];this[_0x482c('0xb')]=_0x47edb6['chatPause']||![];this[_0x482c('0xc')]=_0x47edb6[_0x482c('0xc')]||![];this[_0x482c('0xd')]=_0x47edb6[_0x482c('0xd')]||![];this[_0x482c('0xe')]=_0x47edb6[_0x482c('0xe')]||![];this['openchannelPause']=_0x47edb6[_0x482c('0xf')]||![];this[_0x482c('0x10')]=_0x482c('0x11');this['chatStatusTime']=0x0;this[_0x482c('0x12')]=_0x47edb6[_0x482c('0x12')]||0x0;this[_0x482c('0x13')]=0x0;this['mailStatus']='unknown';this[_0x482c('0x14')]=0x0;this[_0x482c('0x15')]=_0x47edb6['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x482c('0x16')]=_0x482c('0x11');this[_0x482c('0x17')]=0x0;this[_0x482c('0x18')]=_0x47edb6[_0x482c('0x18')]||0x0;this[_0x482c('0x19')]=0x0;this[_0x482c('0x1a')]=_0x482c('0x11');this[_0x482c('0x1b')]=0x0;this[_0x482c('0x1c')]=_0x47edb6[_0x482c('0x1c')]||0x0;this[_0x482c('0x1d')]=0x0;this['whatsappStatus']=_0x482c('0x11');this['whatsappStatusTime']=0x0;this[_0x482c('0x1e')]=_0x47edb6[_0x482c('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x482c('0x11');this['openchannelStatusTime']=0x0;this[_0x482c('0x1f')]=_0x47edb6[_0x482c('0x1f')]||0x0;this[_0x482c('0x20')]=0x0;this[_0x482c('0x21')]=![];this['busyQueue']=undefined;this[_0x482c('0x1')]='';this[_0x482c('0x22')]={};this[_0x482c('0x23')]={};this[_0x482c('0x24')]={};this[_0x482c('0x25')]={};this['smsWaitingInteractions']={};this['whatsappWaitingInteractions']={};this[_0x482c('0x26')]();}Agent[_0x482c('0x27')][_0x482c('0x28')]=function(_0x5c4e9c){if(this[_0x5c4e9c+_0x482c('0x29')]>0x0){if(this[_0x5c4e9c+'Capacity']>0x0&&this[_0x5c4e9c+_0x482c('0x29')]>=this[_0x5c4e9c+_0x482c('0x2a')]){return'maxcapacity';}else{return _0x482c('0x2b');}}else{return'idle';}};Agent['prototype'][_0x482c('0x26')]=function(){var _0x27f1b5=[_0x482c('0x2c'),_0x482c('0x2d'),_0x482c('0x2e'),_0x482c('0x2f'),_0x482c('0x30'),'whatsapp'];for(var _0xb65836=0x0;_0xb65836<_0x27f1b5[_0x482c('0x31')];_0xb65836+=0x1){var _0x58da7c=this[_0x482c('0x28')](_0x27f1b5[_0xb65836]);if(this[_0x27f1b5[_0xb65836]+'Status']!==_0x58da7c){this[_0x27f1b5[_0xb65836]+'StatusTime']=_[_0x482c('0x32')](moment()['format']('x'));}this[_0x27f1b5[_0xb65836]+_0x482c('0x33')]=_0x58da7c;}var _0x2c5121={'id':this['id'],'name':this[_0x482c('0x8')],'online':this[_0x482c('0x9')],'voicePause':this[_0x482c('0xa')],'chatPause':this[_0x482c('0xb')],'mailPause':this[_0x482c('0xc')],'smsPause':this[_0x482c('0xe')],'faxPause':this[_0x482c('0xd')],'openchannelPause':this[_0x482c('0xf')],'chatStatus':this[_0x482c('0x10')],'chatStatusTime':this[_0x482c('0x34')],'chatCapacity':this[_0x482c('0x12')],'chatCurrentCapacity':this[_0x482c('0x13')],'mailStatus':this[_0x482c('0x35')],'mailStatusTime':this[_0x482c('0x14')],'mailCapacity':this[_0x482c('0x15')],'mailCurrentCapacity':this[_0x482c('0x36')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x482c('0x19')],'smsStatus':this[_0x482c('0x1a')],'smsStatusTime':this[_0x482c('0x1b')],'smsCapacity':this[_0x482c('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x482c('0x37')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x482c('0x1e')],'whatsappCurrentCapacity':this[_0x482c('0x38')],'openchannelStatus':this[_0x482c('0x39')],'openchannelStatusTime':this[_0x482c('0x3a')],'openchannelCapacity':this[_0x482c('0x1f')],'openchannelCurrentCapacity':this[_0x482c('0x20')],'busy':this[_0x482c('0x21')],'busyQueue':this[_0x482c('0x3b')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x482c('0x24')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x482c('0x3c')],'whatsappWaitingInteractions':this[_0x482c('0x3d')]};var _0x3fda48=md5(JSON['stringify'](_0x2c5121));if(this[_0x482c('0x1')]!==_0x3fda48){this[_0x482c('0x1')]=_0x3fda48;io[_0x482c('0x3e')](_0x482c('0x3f'),_['omit'](_0x2c5121,[_0x482c('0x9')]));}};module['exports']=Agent; \ No newline at end of file +var _0x781d=['getChannelStatus','Status','format','faxStatus','faxCurrentCapacity','openchannelWaitingInteractions','whatsappWaitingInteractions','emit','user:routing:update','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','sms','length'];(function(_0x33d38c,_0x2ff27b){var _0x537b31=function(_0x152458){while(--_0x152458){_0x33d38c['push'](_0x33d38c['shift']());}};_0x537b31(++_0x2ff27b);}(_0x781d,0x14a));var _0xd781=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x781d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd781('0x0'));var md5=require(_0xd781('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xd781('0x2'));config[_0xd781('0x3')]=_[_0xd781('0x4')](config[_0xd781('0x3')],{'host':_0xd781('0x5'),'port':0x18eb});var io=require(_0xd781('0x6'))(new Redis(config[_0xd781('0x3')]));function Agent(_0x1d4f4e){this['id']=_0x1d4f4e['id']||0x0;this[_0xd781('0x7')]=_0x1d4f4e[_0xd781('0x7')]||'';this['online']=_0x1d4f4e[_0xd781('0x8')]||!![];this[_0xd781('0x9')]=_0x1d4f4e[_0xd781('0x9')]||![];this[_0xd781('0xa')]=_0x1d4f4e['chatPause']||![];this[_0xd781('0xb')]=_0x1d4f4e['mailPause']||![];this[_0xd781('0xc')]=_0x1d4f4e[_0xd781('0xc')]||![];this['smsPause']=_0x1d4f4e[_0xd781('0xd')]||![];this[_0xd781('0xe')]=_0x1d4f4e['openchannelPause']||![];this['chatStatus']=_0xd781('0xf');this[_0xd781('0x10')]=0x0;this[_0xd781('0x11')]=_0x1d4f4e[_0xd781('0x11')]||0x0;this[_0xd781('0x12')]=0x0;this[_0xd781('0x13')]=_0xd781('0xf');this[_0xd781('0x14')]=0x0;this[_0xd781('0x15')]=_0x1d4f4e[_0xd781('0x15')]||0x0;this[_0xd781('0x16')]=0x0;this['faxStatus']=_0xd781('0xf');this[_0xd781('0x17')]=0x0;this['faxCapacity']=_0x1d4f4e[_0xd781('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd781('0x19')]=_0xd781('0xf');this[_0xd781('0x1a')]=0x0;this[_0xd781('0x1b')]=_0x1d4f4e[_0xd781('0x1b')]||0x0;this[_0xd781('0x1c')]=0x0;this[_0xd781('0x1d')]='unknown';this[_0xd781('0x1e')]=0x0;this[_0xd781('0x1f')]=_0x1d4f4e[_0xd781('0x1f')]||0x0;this[_0xd781('0x20')]=0x0;this[_0xd781('0x21')]=_0xd781('0xf');this[_0xd781('0x22')]=0x0;this[_0xd781('0x23')]=_0x1d4f4e['openchannelCapacity']||0x0;this[_0xd781('0x24')]=0x0;this[_0xd781('0x25')]=![];this[_0xd781('0x26')]=undefined;this[_0xd781('0x1')]='';this[_0xd781('0x27')]={};this[_0xd781('0x28')]={};this[_0xd781('0x29')]={};this['openchannelWaitingInteractions']={};this[_0xd781('0x2a')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0xd781('0x2b')]['getChannelStatus']=function(_0x175ba6){if(this[_0x175ba6+_0xd781('0x2c')]>0x0){if(this[_0x175ba6+_0xd781('0x2d')]>0x0&&this[_0x175ba6+_0xd781('0x2c')]>=this[_0x175ba6+_0xd781('0x2d')]){return _0xd781('0x2e');}else{return _0xd781('0x2f');}}else{return _0xd781('0x30');}};Agent[_0xd781('0x2b')]['updateRealtime']=function(){var _0x529ca1=[_0xd781('0x31'),_0xd781('0x32'),_0xd781('0x33'),'fax',_0xd781('0x34'),'whatsapp'];for(var _0x47c609=0x0;_0x47c609<_0x529ca1[_0xd781('0x35')];_0x47c609+=0x1){var _0x54fe00=this[_0xd781('0x36')](_0x529ca1[_0x47c609]);if(this[_0x529ca1[_0x47c609]+_0xd781('0x37')]!==_0x54fe00){this[_0x529ca1[_0x47c609]+'StatusTime']=_['toNumber'](moment()[_0xd781('0x38')]('x'));}this[_0x529ca1[_0x47c609]+'Status']=_0x54fe00;}var _0x296a0b={'id':this['id'],'name':this['name'],'online':this[_0xd781('0x8')],'voicePause':this[_0xd781('0x9')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xd781('0xd')],'faxPause':this[_0xd781('0xc')],'openchannelPause':this[_0xd781('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd781('0x11')],'chatCurrentCapacity':this[_0xd781('0x12')],'mailStatus':this[_0xd781('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xd781('0x16')],'faxStatus':this[_0xd781('0x39')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd781('0x18')],'faxCurrentCapacity':this[_0xd781('0x3a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xd781('0x1a')],'smsCapacity':this[_0xd781('0x1b')],'smsCurrentCapacity':this[_0xd781('0x1c')],'whatsappStatus':this[_0xd781('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xd781('0x1f')],'whatsappCurrentCapacity':this[_0xd781('0x20')],'openchannelStatus':this[_0xd781('0x21')],'openchannelStatusTime':this[_0xd781('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd781('0x24')],'busy':this[_0xd781('0x25')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xd781('0x27')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xd781('0x29')],'openchannelWaitingInteractions':this[_0xd781('0x3b')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xd781('0x3c')]};var _0x2c6be3=md5(JSON['stringify'](_0x296a0b));if(this[_0xd781('0x1')]!==_0x2c6be3){this['md5']=_0x2c6be3;io[_0xd781('0x3d')](_0xd781('0x3e'),_['omit'](_0x296a0b,[_0xd781('0x8')]));}};module[_0xd781('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 41966cd..d865c2a 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 _0xa186=['updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','chatPause','available','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting'];(function(_0xac1880,_0x13a8c3){var _0xea39bb=function(_0x19c352){while(--_0x19c352){_0xac1880['push'](_0xac1880['shift']());}};_0xea39bb(++_0x13a8c3);}(_0xa186,0x6c));var _0x6a18=function(_0x28a8a0,_0x3c5d47){_0x28a8a0=_0x28a8a0-0x0;var _0x526d36=_0xa186[_0x28a8a0];return _0x526d36;};'use strict';var _=require(_0x6a18('0x0'));var md5=require(_0x6a18('0x1'));var util=require(_0x6a18('0x2'));var Redis=require(_0x6a18('0x3'));var config=require(_0x6a18('0x4'));config[_0x6a18('0x5')]=_[_0x6a18('0x6')](config[_0x6a18('0x5')],{'host':_0x6a18('0x7'),'port':0x18eb});var io=require(_0x6a18('0x8'))(new Redis(config[_0x6a18('0x5')]));function ChatQueue(_0x39ad00){this['id']=_0x39ad00['id']||0x0;this[_0x6a18('0x9')]=_0x39ad00[_0x6a18('0x9')]||'';this[_0x6a18('0xa')]=_0x39ad00[_0x6a18('0xa')]||0xa;this['strategy']=_0x39ad00[_0x6a18('0xb')]||_0x6a18('0xc');this[_0x6a18('0xd')]=_0x39ad00['Agents'];this['mapAgentsId']={};this[_0x6a18('0xe')]=0x0;this[_0x6a18('0x1')]='';this[_0x6a18('0xf')]();this[_0x6a18('0x10')]();}ChatQueue[_0x6a18('0x11')][_0x6a18('0xf')]=function(){var _0xc871d4=this[_0x6a18('0x12')][_0x6a18('0x13')];this['mapAgentsId']=_[_0x6a18('0x14')](this['Agents'],'id');this[_0x6a18('0x12')][_0x6a18('0x13')]=_0xc871d4;};ChatQueue[_0x6a18('0x11')][_0x6a18('0x10')]=function(){this[_0x6a18('0x15')]=0x0;this[_0x6a18('0x16')]=0x0;for(var _0x509f72=0x0;_0x509f72=0x0?this[_0x6a18('0x1a')]:0x0;var _0x58ce29={'id':this['id'],'available':this[_0x6a18('0x1a')],'loggedIn':this['loggedIn'],'name':this[_0x6a18('0x9')],'paused':this[_0x6a18('0x16')],'waiting':this['waiting']};var _0x28bfa4=md5(JSON['stringify'](_0x58ce29));if(this[_0x6a18('0x1')]!==_0x28bfa4){this[_0x6a18('0x1')]=_0x28bfa4;io['to'](util[_0x6a18('0x1b')](_0x6a18('0x1c'),_0x58ce29[_0x6a18('0x9')]))[_0x6a18('0x1d')](_0x6a18('0x1e'),_0x58ce29);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xc581=['available','loggedIn','stringify','format','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','paused','length','online','chatPause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc581,0x1ba));var _0x1c58=function(_0x4127cb,_0x508a52){_0x4127cb=_0x4127cb-0x0;var _0x2143af=_0xc581[_0x4127cb];return _0x2143af;};'use strict';var _=require(_0x1c58('0x0'));var md5=require(_0x1c58('0x1'));var util=require('util');var Redis=require(_0x1c58('0x2'));var config=require(_0x1c58('0x3'));config[_0x1c58('0x4')]=_['defaults'](config[_0x1c58('0x4')],{'host':_0x1c58('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1c58('0x4')]));function ChatQueue(_0x4665bf){this['id']=_0x4665bf['id']||0x0;this[_0x1c58('0x6')]=_0x4665bf['name']||'';this[_0x1c58('0x7')]=_0x4665bf[_0x1c58('0x7')]||0xa;this[_0x1c58('0x8')]=_0x4665bf['strategy']||_0x1c58('0x9');this[_0x1c58('0xa')]=_0x4665bf['Agents'];this[_0x1c58('0xb')]={};this[_0x1c58('0xc')]=0x0;this[_0x1c58('0x1')]='';this['updateRouting']();this[_0x1c58('0xd')]();}ChatQueue[_0x1c58('0xe')][_0x1c58('0xf')]=function(){var _0x5a7c88=this['mapAgentsId'][_0x1c58('0x10')];this[_0x1c58('0xb')]=_[_0x1c58('0x11')](this[_0x1c58('0xa')],'id');this[_0x1c58('0xb')][_0x1c58('0x10')]=_0x5a7c88;};ChatQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x1c58('0x12')]=0x0;for(var _0x14eb96=0x0;_0x14eb96=0x0?this[_0x1c58('0x16')]:0x0;var _0x24901e={'id':this['id'],'available':this[_0x1c58('0x16')],'loggedIn':this[_0x1c58('0x17')],'name':this[_0x1c58('0x6')],'paused':this[_0x1c58('0x12')],'waiting':this[_0x1c58('0xc')]};var _0x1b23a9=md5(JSON[_0x1c58('0x18')](_0x24901e));if(this[_0x1c58('0x1')]!==_0x1b23a9){this[_0x1c58('0x1')]=_0x1b23a9;io['to'](util[_0x1c58('0x19')]('chat:queue:%s',_0x24901e[_0x1c58('0x6')]))[_0x1c58('0x1a')](_0x1c58('0x1b'),_0x24901e);}};module[_0x1c58('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 5118b91..4251fce 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 _0x13a0=['defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','faxPause','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','../../../config/environment','redis'];(function(_0x1959ce,_0x4db248){var _0x323cca=function(_0x593865){while(--_0x593865){_0x1959ce['push'](_0x1959ce['shift']());}};_0x323cca(++_0x4db248);}(_0x13a0,0x11e));var _0x013a=function(_0x3b14ad,_0x5e4401){_0x3b14ad=_0x3b14ad-0x0;var _0x392677=_0x13a0[_0x3b14ad];return _0x392677;};'use strict';var _=require('lodash');var md5=require(_0x013a('0x0'));var util=require(_0x013a('0x1'));var Redis=require('ioredis');var config=require(_0x013a('0x2'));config[_0x013a('0x3')]=_[_0x013a('0x4')](config[_0x013a('0x3')],{'host':_0x013a('0x5'),'port':0x18eb});var io=require(_0x013a('0x6'))(new Redis(config['redis']));function FaxQueue(_0x36b82a){this['id']=_0x36b82a['id']||0x0;this[_0x013a('0x7')]=_0x36b82a['name']||'';this[_0x013a('0x8')]=_0x36b82a['timeout']||0xa;this[_0x013a('0x9')]=_0x36b82a['strategy']||'beepall';this[_0x013a('0xa')]=_0x36b82a[_0x013a('0xa')];this[_0x013a('0xb')]={};this[_0x013a('0xc')]=0x0;this[_0x013a('0x0')]='';this[_0x013a('0xd')]();this[_0x013a('0xe')]();}FaxQueue[_0x013a('0xf')]['updateRouting']=function(){var _0x176c61=this['mapAgentsId'][_0x013a('0x10')];this[_0x013a('0xb')]=_[_0x013a('0x11')](this[_0x013a('0xa')],'id');this[_0x013a('0xb')][_0x013a('0x10')]=_0x176c61;};FaxQueue[_0x013a('0xf')]['updateRealtime']=function(){this[_0x013a('0x12')]=0x0;this['paused']=0x0;for(var _0xb09bdf=0x0;_0xb09bdf=0x0?this['available']:0x0;var _0x594af6={'id':this['id'],'available':this[_0x013a('0x16')],'loggedIn':this[_0x013a('0x12')],'name':this[_0x013a('0x7')],'paused':this[_0x013a('0x15')],'waiting':this[_0x013a('0xc')]};var _0x1f3885=md5(JSON[_0x013a('0x17')](_0x594af6));if(this['md5']!==_0x1f3885){this[_0x013a('0x0')]=_0x1f3885;io['to'](util[_0x013a('0x18')](_0x013a('0x19'),_0x594af6[_0x013a('0x7')]))[_0x013a('0x1a')](_0x013a('0x1b'),_0x594af6);}};module[_0x013a('0x1c')]=FaxQueue; \ No newline at end of file +var _0x299b=['fax:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','online','available','paused','format'];(function(_0x530d09,_0x37d4f2){var _0xb0c00e=function(_0x1ea845){while(--_0x1ea845){_0x530d09['push'](_0x530d09['shift']());}};_0xb0c00e(++_0x37d4f2);}(_0x299b,0xf5));var _0xb299=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x299b[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require(_0xb299('0x0'));var md5=require(_0xb299('0x1'));var util=require(_0xb299('0x2'));var Redis=require(_0xb299('0x3'));var config=require(_0xb299('0x4'));config[_0xb299('0x5')]=_[_0xb299('0x6')](config[_0xb299('0x5')],{'host':_0xb299('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb299('0x5')]));function FaxQueue(_0x4386d0){this['id']=_0x4386d0['id']||0x0;this['name']=_0x4386d0[_0xb299('0x8')]||'';this[_0xb299('0x9')]=_0x4386d0[_0xb299('0x9')]||0xa;this[_0xb299('0xa')]=_0x4386d0[_0xb299('0xa')]||_0xb299('0xb');this['Agents']=_0x4386d0[_0xb299('0xc')];this[_0xb299('0xd')]={};this[_0xb299('0xe')]=0x0;this[_0xb299('0x1')]='';this[_0xb299('0xf')]();this[_0xb299('0x10')]();}FaxQueue[_0xb299('0x11')][_0xb299('0xf')]=function(){var _0x3c52b5=this[_0xb299('0xd')]['_rr'];this[_0xb299('0xd')]=_[_0xb299('0x12')](this['Agents'],'id');this[_0xb299('0xd')]['_rr']=_0x3c52b5;};FaxQueue[_0xb299('0x11')][_0xb299('0x10')]=function(){this[_0xb299('0x13')]=0x0;this['paused']=0x0;for(var _0x165aac=0x0;_0x165aac=0x0?this['available']:0x0;var _0x4479ed={'id':this['id'],'available':this[_0xb299('0x16')],'loggedIn':this[_0xb299('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x46038d=md5(JSON['stringify'](_0x4479ed));if(this[_0xb299('0x1')]!==_0x46038d){this[_0xb299('0x1')]=_0x46038d;io['to'](util[_0xb299('0x18')](_0xb299('0x19'),_0x4479ed[_0xb299('0x8')]))[_0xb299('0x1a')]('fax_queue:save',_0x4479ed);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 13cd3ec..68689b2 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 _0x9e8d=['name','Intervals'];(function(_0x404f84,_0xb7fe46){var _0x394f1c=function(_0x527ec1){while(--_0x527ec1){_0x404f84['push'](_0x404f84['shift']());}};_0x394f1c(++_0xb7fe46);}(_0x9e8d,0x78));var _0xd9e8=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x9e8d[_0x297fd3];return _0x2af381;};'use strict';function Interval(_0x5a6908){this['id']=_0x5a6908['id']||0x0;this[_0xd9e8('0x0')]=_0x5a6908[_0xd9e8('0x0')]||'';this[_0xd9e8('0x1')]=_0x5a6908[_0xd9e8('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x71d1=['exports','name','Intervals'];(function(_0x4a5195,_0x20603e){var _0x30908e=function(_0x3c57bf){while(--_0x3c57bf){_0x4a5195['push'](_0x4a5195['shift']());}};_0x30908e(++_0x20603e);}(_0x71d1,0x1ba));var _0x171d=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0x71d1[_0x21ecc8];return _0x510c1d;};'use strict';function Interval(_0x512bbf){this['id']=_0x512bbf['id']||0x0;this[_0x171d('0x0')]=_0x512bbf['name']||'';this[_0x171d('0x1')]=_0x512bbf[_0x171d('0x1')]||{};}module[_0x171d('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 7c24158..a443067 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 _0x9635=['strategy','beepall','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','length','mailPause','available','paused','stringify','format','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x78f943,_0x58e155){var _0x51255a=function(_0x4c9ebc){while(--_0x4c9ebc){_0x78f943['push'](_0x78f943['shift']());}};_0x51255a(++_0x58e155);}(_0x9635,0x1e6));var _0x5963=function(_0x405307,_0x2e2df2){_0x405307=_0x405307-0x0;var _0xd39467=_0x9635[_0x405307];return _0xd39467;};'use strict';var _=require(_0x5963('0x0'));var md5=require('md5');var util=require(_0x5963('0x1'));var Redis=require(_0x5963('0x2'));var config=require(_0x5963('0x3'));config['redis']=_[_0x5963('0x4')](config[_0x5963('0x5')],{'host':_0x5963('0x6'),'port':0x18eb});var io=require(_0x5963('0x7'))(new Redis(config['redis']));function MailQueue(_0x3d3f22){this['id']=_0x3d3f22['id']||0x0;this[_0x5963('0x8')]=_0x3d3f22[_0x5963('0x8')]||'';this[_0x5963('0x9')]=_0x3d3f22[_0x5963('0x9')]||0xa;this['strategy']=_0x3d3f22[_0x5963('0xa')]||_0x5963('0xb');this['Agents']=_0x3d3f22['Agents'];this[_0x5963('0xc')]={};this[_0x5963('0xd')]=0x0;this[_0x5963('0xe')]='';this[_0x5963('0xf')]();this[_0x5963('0x10')]();}MailQueue[_0x5963('0x11')][_0x5963('0xf')]=function(){var _0xe0a7fe=this[_0x5963('0xc')][_0x5963('0x12')];this[_0x5963('0xc')]=_[_0x5963('0x13')](this[_0x5963('0x14')],'id');this[_0x5963('0xc')]['_rr']=_0xe0a7fe;};MailQueue['prototype'][_0x5963('0x10')]=function(){this[_0x5963('0x15')]=0x0;this['paused']=0x0;for(var _0x7f072d=0x0;_0x7f072d=0x0?this['available']:0x0;var _0xfecae4={'id':this['id'],'available':this[_0x5963('0x18')],'loggedIn':this[_0x5963('0x15')],'name':this[_0x5963('0x8')],'paused':this[_0x5963('0x19')],'waiting':this['waiting']};var _0x1b04d2=md5(JSON[_0x5963('0x1a')](_0xfecae4));if(this[_0x5963('0xe')]!==_0x1b04d2){this[_0x5963('0xe')]=_0x1b04d2;io['to'](util[_0x5963('0x1b')]('mail:queue:%s',_0xfecae4[_0x5963('0x8')]))[_0x5963('0x1c')](_0x5963('0x1d'),_0xfecae4);}};module[_0x5963('0x1e')]=MailQueue; \ No newline at end of file +var _0x8a87=['map','_rr','loggedIn','paused','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype'];(function(_0xd4ef3,_0x47e660){var _0x5416a7=function(_0x56161a){while(--_0x56161a){_0xd4ef3['push'](_0xd4ef3['shift']());}};_0x5416a7(++_0x47e660);}(_0x8a87,0x7c));var _0x78a8=function(_0x175f1b,_0x1a7de0){_0x175f1b=_0x175f1b-0x0;var _0x2da79a=_0x8a87[_0x175f1b];return _0x2da79a;};'use strict';var _=require(_0x78a8('0x0'));var md5=require(_0x78a8('0x1'));var util=require(_0x78a8('0x2'));var Redis=require('ioredis');var config=require(_0x78a8('0x3'));config[_0x78a8('0x4')]=_[_0x78a8('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x78a8('0x6'))(new Redis(config['redis']));function MailQueue(_0x5c08a3){this['id']=_0x5c08a3['id']||0x0;this[_0x78a8('0x7')]=_0x5c08a3['name']||'';this[_0x78a8('0x8')]=_0x5c08a3['timeout']||0xa;this[_0x78a8('0x9')]=_0x5c08a3[_0x78a8('0x9')]||_0x78a8('0xa');this[_0x78a8('0xb')]=_0x5c08a3['Agents'];this[_0x78a8('0xc')]={};this['waiting']=0x0;this[_0x78a8('0x1')]='';this[_0x78a8('0xd')]();this[_0x78a8('0xe')]();}MailQueue[_0x78a8('0xf')][_0x78a8('0xd')]=function(){var _0x3a7aae=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x78a8('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x78a8('0x11')]=_0x3a7aae;};MailQueue['prototype'][_0x78a8('0xe')]=function(){this[_0x78a8('0x12')]=0x0;this[_0x78a8('0x13')]=0x0;for(var _0x4968fc=0x0;_0x4968fc=0x0?this['available']:0x0;var _0x5b5741={'id':this['id'],'available':this[_0x78a8('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x78a8('0x13')],'waiting':this['waiting']};var _0x3304ff=md5(JSON['stringify'](_0x5b5741));if(this[_0x78a8('0x1')]!==_0x3304ff){this[_0x78a8('0x1')]=_0x3304ff;io['to'](util[_0x78a8('0x17')](_0x78a8('0x18'),_0x5b5741[_0x78a8('0x7')]))[_0x78a8('0x19')](_0x78a8('0x1a'),_0x5b5741);}};module[_0x78a8('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9cef8e6..7d044db 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x3d45ef,_0x284156){var _0x256b6a=function(_0x4f10ba){while(--_0x4f10ba){_0x3d45ef['push'](_0x3d45ef['shift']());}};_0x256b6a(++_0x284156);}(_0x814b,0x1a2));var _0xb814=function(_0x31f7c5,_0x3bf428){_0x31f7c5=_0x31f7c5-0x0;var _0x19fabc=_0x814b[_0x31f7c5];return _0x19fabc;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x1261,0x144));var _0x1126=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x1261[_0x155c64];return _0x1f154a;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c808301..a49a8a7 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 _0x780f=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x780f,0x6c));var _0xf780=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0x780f[_0x438912];return _0x18112f;};'use strict';var _=require(_0xf780('0x0'));var md5=require(_0xf780('0x1'));var util=require(_0xf780('0x2'));var Redis=require(_0xf780('0x3'));var config=require(_0xf780('0x4'));config['redis']=_['defaults'](config[_0xf780('0x5')],{'host':_0xf780('0x6'),'port':0x18eb});var io=require(_0xf780('0x7'))(new Redis(config[_0xf780('0x5')]));function SmsQueue(_0x4af209){this['id']=_0x4af209['id']||0x0;this[_0xf780('0x8')]=_0x4af209['name']||'';this[_0xf780('0x9')]=_0x4af209[_0xf780('0x9')]||0xa;this[_0xf780('0xa')]=_0x4af209[_0xf780('0xa')]||_0xf780('0xb');this[_0xf780('0xc')]=_0x4af209['Agents'];this[_0xf780('0xd')]={};this[_0xf780('0xe')]=0x0;this[_0xf780('0x1')]='';this[_0xf780('0xf')]();this[_0xf780('0x10')]();}SmsQueue[_0xf780('0x11')][_0xf780('0xf')]=function(){var _0x47f3c9=this['mapAgentsId'][_0xf780('0x12')];this[_0xf780('0xd')]=_[_0xf780('0x13')](this[_0xf780('0xc')],'id');this['mapAgentsId'][_0xf780('0x12')]=_0x47f3c9;};SmsQueue[_0xf780('0x11')][_0xf780('0x10')]=function(){this[_0xf780('0x14')]=0x0;this['paused']=0x0;for(var _0x5a64bc=0x0;_0x5a64bc=0x0?this[_0xf780('0x19')]:0x0;var _0x188554={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf780('0x14')],'name':this[_0xf780('0x8')],'paused':this['paused'],'waiting':this[_0xf780('0xe')]};var _0x3fe0a7=md5(JSON['stringify'](_0x188554));if(this[_0xf780('0x1')]!==_0x3fe0a7){this[_0xf780('0x1')]=_0x3fe0a7;io['to'](util[_0xf780('0x1a')](_0xf780('0x1b'),_0x188554[_0xf780('0x8')]))[_0xf780('0x1c')]('sms_queue:save',_0x188554);}};module[_0xf780('0x1d')]=SmsQueue; \ No newline at end of file +var _0xe107=['format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','timeout','strategy','Agents','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','available','waiting','stringify'];(function(_0x54dbf9,_0x501d79){var _0x196dcc=function(_0x4d6683){while(--_0x4d6683){_0x54dbf9['push'](_0x54dbf9['shift']());}};_0x196dcc(++_0x501d79);}(_0xe107,0xb3));var _0x7e10=function(_0x2989c2,_0x5a26bb){_0x2989c2=_0x2989c2-0x0;var _0x2a577f=_0xe107[_0x2989c2];return _0x2a577f;};'use strict';var _=require(_0x7e10('0x0'));var md5=require('md5');var util=require(_0x7e10('0x1'));var Redis=require(_0x7e10('0x2'));var config=require(_0x7e10('0x3'));config['redis']=_[_0x7e10('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7e10('0x5'))(new Redis(config[_0x7e10('0x6')]));function SmsQueue(_0x841f6d){this['id']=_0x841f6d['id']||0x0;this['name']=_0x841f6d['name']||'';this[_0x7e10('0x7')]=_0x841f6d[_0x7e10('0x7')]||0xa;this[_0x7e10('0x8')]=_0x841f6d[_0x7e10('0x8')]||'beepall';this['Agents']=_0x841f6d[_0x7e10('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7e10('0xa')]='';this[_0x7e10('0xb')]();this[_0x7e10('0xc')]();}SmsQueue[_0x7e10('0xd')][_0x7e10('0xb')]=function(){var _0x52ba74=this[_0x7e10('0xe')]['_rr'];this[_0x7e10('0xe')]=_[_0x7e10('0xf')](this[_0x7e10('0x9')],'id');this['mapAgentsId'][_0x7e10('0x10')]=_0x52ba74;};SmsQueue[_0x7e10('0xd')][_0x7e10('0xc')]=function(){this[_0x7e10('0x11')]=0x0;this[_0x7e10('0x12')]=0x0;for(var _0x1b4d9d=0x0;_0x1b4d9d=0x0?this['available']:0x0;var _0x3208c6={'id':this['id'],'available':this[_0x7e10('0x15')],'loggedIn':this[_0x7e10('0x11')],'name':this['name'],'paused':this[_0x7e10('0x12')],'waiting':this[_0x7e10('0x16')]};var _0x157b22=md5(JSON[_0x7e10('0x17')](_0x3208c6));if(this[_0x7e10('0xa')]!==_0x157b22){this['md5']=_0x157b22;io['to'](util[_0x7e10('0x18')](_0x7e10('0x19'),_0x3208c6['name']))[_0x7e10('0x1a')](_0x7e10('0x1b'),_0x3208c6);}};module[_0x7e10('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 0df230c..6ba18cb 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 _0x3538=['paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','redis','name','timeout','strategy','Agents','mapAgentsId','updateRealtime','prototype','_rr','map','length','online','loggedIn'];(function(_0x97bf34,_0x15831e){var _0x2441c5=function(_0x5c7585){while(--_0x5c7585){_0x97bf34['push'](_0x97bf34['shift']());}};_0x2441c5(++_0x15831e);}(_0x3538,0x13c));var _0x8353=function(_0x76c5f9,_0x4672ba){_0x76c5f9=_0x76c5f9-0x0;var _0x156bf7=_0x3538[_0x76c5f9];return _0x156bf7;};'use strict';var _=require(_0x8353('0x0'));var md5=require(_0x8353('0x1'));var util=require(_0x8353('0x2'));var Redis=require(_0x8353('0x3'));var config=require(_0x8353('0x4'));config['redis']=_[_0x8353('0x5')](config['redis'],{'host':_0x8353('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8353('0x7')]));function WhatsappQueue(_0x3eb2a0){this['id']=_0x3eb2a0['id']||0x0;this[_0x8353('0x8')]=_0x3eb2a0[_0x8353('0x8')]||'';this['timeout']=_0x3eb2a0[_0x8353('0x9')]||0xa;this[_0x8353('0xa')]=_0x3eb2a0['strategy']||'beepall';this[_0x8353('0xb')]=_0x3eb2a0[_0x8353('0xb')];this[_0x8353('0xc')]={};this['waiting']=0x0;this[_0x8353('0x1')]='';this['updateRouting']();this[_0x8353('0xd')]();}WhatsappQueue[_0x8353('0xe')]['updateRouting']=function(){var _0x34b5d2=this[_0x8353('0xc')][_0x8353('0xf')];this[_0x8353('0xc')]=_[_0x8353('0x10')](this['Agents'],'id');this[_0x8353('0xc')][_0x8353('0xf')]=_0x34b5d2;};WhatsappQueue[_0x8353('0xe')][_0x8353('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4748c2=0x0;_0x4748c2=0x0?this[_0x8353('0x15')]:0x0;var _0xe43ec7={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x8353('0x14')],'waiting':this['waiting']};var _0x5d8386=md5(JSON[_0x8353('0x16')](_0xe43ec7));if(this['md5']!==_0x5d8386){this['md5']=_0x5d8386;io['to'](util[_0x8353('0x17')](_0x8353('0x18'),_0xe43ec7[_0x8353('0x8')]))[_0x8353('0x19')](_0x8353('0x1a'),_0xe43ec7);}};module[_0x8353('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xf32a=['paused','online','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','util','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xf32a,0x17e));var _0xaf32=function(_0x4b8cd2,_0x1186d1){_0x4b8cd2=_0x4b8cd2-0x0;var _0x49e7d8=_0xf32a[_0x4b8cd2];return _0x49e7d8;};'use strict';var _=require(_0xaf32('0x0'));var md5=require('md5');var util=require(_0xaf32('0x1'));var Redis=require(_0xaf32('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xaf32('0x3')],{'host':_0xaf32('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaf32('0x3')]));function WhatsappQueue(_0x55b56d){this['id']=_0x55b56d['id']||0x0;this[_0xaf32('0x5')]=_0x55b56d['name']||'';this[_0xaf32('0x6')]=_0x55b56d[_0xaf32('0x6')]||0xa;this[_0xaf32('0x7')]=_0x55b56d[_0xaf32('0x7')]||_0xaf32('0x8');this[_0xaf32('0x9')]=_0x55b56d[_0xaf32('0x9')];this[_0xaf32('0xa')]={};this[_0xaf32('0xb')]=0x0;this[_0xaf32('0xc')]='';this[_0xaf32('0xd')]();this[_0xaf32('0xe')]();}WhatsappQueue[_0xaf32('0xf')][_0xaf32('0xd')]=function(){var _0x1728a3=this[_0xaf32('0xa')][_0xaf32('0x10')];this['mapAgentsId']=_['map'](this[_0xaf32('0x9')],'id');this[_0xaf32('0xa')][_0xaf32('0x10')]=_0x1728a3;};WhatsappQueue[_0xaf32('0xf')]['updateRealtime']=function(){this[_0xaf32('0x11')]=0x0;this[_0xaf32('0x12')]=0x0;for(var _0x53c7f9=0x0;_0x53c7f9=0x0?this[_0xaf32('0x14')]:0x0;var _0x455506={'id':this['id'],'available':this[_0xaf32('0x14')],'loggedIn':this[_0xaf32('0x11')],'name':this[_0xaf32('0x5')],'paused':this['paused'],'waiting':this[_0xaf32('0xb')]};var _0x47bbcc=md5(JSON[_0xaf32('0x15')](_0x455506));if(this['md5']!==_0x47bbcc){this[_0xaf32('0xc')]=_0x47bbcc;io['to'](util['format'](_0xaf32('0x16'),_0x455506[_0xaf32('0x5')]))['emit'](_0xaf32('0x17'),_0x455506);}};module[_0xaf32('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index af7f518..d91e9c1 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x287768,_0x31ff6b){var _0x31e811=function(_0x1a2051){while(--_0x1a2051){_0x287768['push'](_0x287768['shift']());}};_0x31e811(++_0x31ff6b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f2601,_0x10b8be){_0x2f2601=_0x2f2601-0x0;var _0x3c6e6=_0xb10b[_0x2f2601];return _0x3c6e6;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index e858db0..94f0167 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 _0x7016=['Request','updateChatInteraction','addTagsToChatInteraction','../client'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7016,0x16b));var _0x6701=function(_0x3996a0,_0x15c317){_0x3996a0=_0x3996a0-0x0;var _0x39e640=_0x7016[_0x3996a0];return _0x39e640;};'use strict';var client=require(_0x6701('0x0'));exports['update']=function(_0x4377b4,_0xc43dfc){return client[_0x6701('0x1')]('UpdateChatInteraction',{'body':_0xc43dfc,'options':{'where':{'id':_0x4377b4}},'log':_0x6701('0x2')});};exports['addTags']=function(_0x5a5f7a,_0x3a5be0){return client[_0x6701('0x1')]('AddTagsToChatInteraction',{'body':_0x3a5be0,'options':{'where':{'id':_0x5a5f7a}},'log':_0x6701('0x3')});}; \ No newline at end of file +var _0x63d3=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x5e05b3,_0x2cfa36){var _0x2452ff=function(_0x42b820){while(--_0x42b820){_0x5e05b3['push'](_0x5e05b3['shift']());}};_0x2452ff(++_0x2cfa36);}(_0x63d3,0x1de));var _0x363d=function(_0x1c1e68,_0x189f46){_0x1c1e68=_0x1c1e68-0x0;var _0x458961=_0x63d3[_0x1c1e68];return _0x458961;};'use strict';var client=require(_0x363d('0x0'));exports['update']=function(_0x2329fc,_0x259918){return client[_0x363d('0x1')](_0x363d('0x2'),{'body':_0x259918,'options':{'where':{'id':_0x2329fc}},'log':_0x363d('0x3')});};exports[_0x363d('0x4')]=function(_0x5ac599,_0x3b514c){return client['Request'](_0x363d('0x5'),{'body':_0x3b514c,'options':{'where':{'id':_0x5ac599}},'log':_0x363d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3fd9a70..fa6bd94 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 _0xbeb4=['CreateChatMessage','createChatMessage','Request'];(function(_0x6d0143,_0x3d7c30){var _0x29cb75=function(_0x3bfcf4){while(--_0x3bfcf4){_0x6d0143['push'](_0x6d0143['shift']());}};_0x29cb75(++_0x3d7c30);}(_0xbeb4,0xe0));var _0x4beb=function(_0x119c02,_0x1add87){_0x119c02=_0x119c02-0x0;var _0x2e304c=_0xbeb4[_0x119c02];return _0x2e304c;};'use strict';var client=require('../client');exports['create']=function(_0x57330f){return client[_0x4beb('0x0')](_0x4beb('0x1'),{'body':_0x57330f,'log':_0x4beb('0x2')});}; \ No newline at end of file +var _0x226d=['Request','CreateChatMessage','create'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x226d,0xa4));var _0xd226=function(_0x23957f,_0x122338){_0x23957f=_0x23957f-0x0;var _0x1291cb=_0x226d[_0x23957f];return _0x1291cb;};'use strict';var client=require('../client');exports[_0xd226('0x0')]=function(_0x2f54a3){return client[_0xd226('0x1')](_0xd226('0x2'),{'body':_0x2f54a3,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4d66930..a6ad50a 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 _0x0fda=['Agents','chatPause','../client','Request','GetChatQueue','name','timeout','strategy','User'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x614ce1,_0x4b40e5){_0x614ce1=_0x614ce1-0x0;var _0x2b8849=_0x0fda[_0x614ce1];return _0x2b8849;};'use strict';var client=require(_0xa0fd('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa0fd('0x1')](_0xa0fd('0x2'),{'options':{'raw':![],'attributes':['id',_0xa0fd('0x3'),_0xa0fd('0x4'),_0xa0fd('0x5')],'include':[{'model':_0xa0fd('0x6'),'as':_0xa0fd('0x7'),'attributes':['id','name','online',_0xa0fd('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x54da=['Agents','name','online','../client','Request','timeout','User'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x54da,0x9d));var _0xa54d=function(_0x550151,_0x49d953){_0x550151=_0x550151-0x0;var _0x1ba3cb=_0x54da[_0x550151];return _0x1ba3cb;};'use strict';var client=require(_0xa54d('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa54d('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xa54d('0x2'),'strategy'],'include':[{'model':_0xa54d('0x3'),'as':_0xa54d('0x4'),'attributes':['id',_0xa54d('0x5'),_0xa54d('0x6'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e3ba358..3cfc10d 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 _0x4e83=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0x4e83,0x88));var _0x34e8=function(_0x3fb214,_0x428d93){_0x3fb214=_0x3fb214-0x0;var _0x38d89c=_0x4e83[_0x3fb214];return _0x38d89c;};'use strict';var client=require('../client');exports[_0x34e8('0x0')]=function(_0x46d22c){return client[_0x34e8('0x1')](_0x34e8('0x2'),{'body':_0x46d22c,'log':'CreateChatQueueReport'});};exports[_0x34e8('0x3')]=function(_0x4550fd,_0x3b6abf){return client[_0x34e8('0x1')](_0x34e8('0x4'),{'body':_0x3b6abf,'options':{'where':{'uniqueid':_0x4550fd},'order':[['id',_0x34e8('0x5')]],'limit':0x1},'log':_0x34e8('0x4')});}; \ No newline at end of file +var _0xf874=['update','UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x570432,_0x29ec48){var _0x20f99f=function(_0xad0666){while(--_0xad0666){_0x570432['push'](_0x570432['shift']());}};_0x20f99f(++_0x29ec48);}(_0xf874,0x177));var _0x4f87=function(_0x4431a0,_0x5ab684){_0x4431a0=_0x4431a0-0x0;var _0x109890=_0xf874[_0x4431a0];return _0x109890;};'use strict';var client=require(_0x4f87('0x0'));exports['create']=function(_0x391d9f){return client[_0x4f87('0x1')](_0x4f87('0x2'),{'body':_0x391d9f,'log':_0x4f87('0x2')});};exports[_0x4f87('0x3')]=function(_0xe4464e,_0x87123d){return client['Request'](_0x4f87('0x4'),{'body':_0x87123d,'options':{'where':{'uniqueid':_0xe4464e},'order':[['id',_0x4f87('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 709bbfc..c1d5b44 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(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0x7a54,0x106));var _0x47a5=function(_0x468556,_0x519a61){_0x468556=_0x468556-0x0;var _0x236847=_0x7a54[_0x468556];return _0x236847;};'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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5d312b,_0x38cf18){var _0x4dd79c=function(_0x3b68ce){while(--_0x3b68ce){_0x5d312b['push'](_0x5d312b['shift']());}};_0x4dd79c(++_0x38cf18);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 71e69f2..a063406 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 _0xb99a=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0xd290a3,_0x236ebf){var _0x27055c=function(_0x1f5dea){while(--_0x1f5dea){_0xd290a3['push'](_0xd290a3['shift']());}};_0x27055c(++_0x236ebf);}(_0xb99a,0x103));var _0xab99=function(_0x4e83b0,_0x28a60f){_0x4e83b0=_0x4e83b0-0x0;var _0x3b8776=_0xb99a[_0x4e83b0];return _0x3b8776;};'use strict';var client=require(_0xab99('0x0'));exports[_0xab99('0x1')]=function(_0x856b6e){return client[_0xab99('0x2')](_0xab99('0x3'),{'body':_0x856b6e,'log':_0xab99('0x4')});}; \ No newline at end of file +var _0x5c26=['CreateFaxMessage','create','Request'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5c26,0x1c6));var _0x65c2=function(_0x47abc9,_0x83ca19){_0x47abc9=_0x47abc9-0x0;var _0x1dceaa=_0x5c26[_0x47abc9];return _0x1dceaa;};'use strict';var client=require('../client');exports[_0x65c2('0x0')]=function(_0x514fba){return client[_0x65c2('0x1')](_0x65c2('0x2'),{'body':_0x514fba,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f052385..a183567 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 _0xebc1=['strategy','User','Agents','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x12299d,_0x548034){var _0x2b43da=function(_0x225c63){while(--_0x225c63){_0x12299d['push'](_0x12299d['shift']());}};_0x2b43da(++_0x548034);}(_0xebc1,0x7b));var _0x1ebc=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0xebc1[_0x29ae80];return _0x5d6d71;};'use strict';var client=require('../client');exports[_0x1ebc('0x0')]=function(){return function(){return client[_0x1ebc('0x1')](_0x1ebc('0x2'),{'options':{'raw':![],'attributes':['id',_0x1ebc('0x3'),_0x1ebc('0x4'),_0x1ebc('0x5')],'include':[{'model':_0x1ebc('0x6'),'as':_0x1ebc('0x7'),'attributes':['id','name','online','faxPause']}]},'log':_0x1ebc('0x0')});};}; \ No newline at end of file +var _0xff2f=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','strategy','Agents'];(function(_0xea66c8,_0x13b73e){var _0x7b950=function(_0x59cf60){while(--_0x59cf60){_0xea66c8['push'](_0xea66c8['shift']());}};_0x7b950(++_0x13b73e);}(_0xff2f,0xa9));var _0xfff2=function(_0xa34f01,_0x4dfd44){_0xa34f01=_0xa34f01-0x0;var _0x34c117=_0xff2f[_0xa34f01];return _0x34c117;};'use strict';var client=require(_0xfff2('0x0'));exports[_0xfff2('0x1')]=function(){return function(){return client[_0xfff2('0x2')](_0xfff2('0x3'),{'options':{'raw':![],'attributes':['id',_0xfff2('0x4'),'timeout',_0xfff2('0x5')],'include':[{'model':'User','as':_0xfff2('0x6'),'attributes':['id',_0xfff2('0x4'),'online',_0xfff2('0x7')]}]},'log':_0xfff2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 3e857ce..d1dac9c 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 _0xe50a=['CreateFaxQueueReport','update','UpdateFaxQueueReport','Request'];(function(_0x4e8100,_0x16439c){var _0x16c492=function(_0x3d0afb){while(--_0x3d0afb){_0x4e8100['push'](_0x4e8100['shift']());}};_0x16c492(++_0x16439c);}(_0xe50a,0x1cf));var _0xae50=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0xe50a[_0x36fbef];return _0x45e270;};'use strict';var client=require('../client');exports['create']=function(_0x43157f){return client[_0xae50('0x0')](_0xae50('0x1'),{'body':_0x43157f,'log':_0xae50('0x1')});};exports[_0xae50('0x2')]=function(_0x16e51c,_0x2983e3){return client[_0xae50('0x0')](_0xae50('0x3'),{'body':_0x2983e3,'options':{'where':{'uniqueid':_0x16e51c},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x0d73=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x0d73,0x15a));var _0x30d7=function(_0x1967d3,_0x42f943){_0x1967d3=_0x1967d3-0x0;var _0xa9d34e=_0x0d73[_0x1967d3];return _0xa9d34e;};'use strict';var client=require(_0x30d7('0x0'));exports[_0x30d7('0x1')]=function(_0x3f6a47){return client[_0x30d7('0x2')](_0x30d7('0x3'),{'body':_0x3f6a47,'log':_0x30d7('0x3')});};exports[_0x30d7('0x4')]=function(_0x57cd76,_0xfcc7e6){return client[_0x30d7('0x2')](_0x30d7('0x5'),{'body':_0xfcc7e6,'options':{'where':{'uniqueid':_0x57cd76},'order':[['id',_0x30d7('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 34b331f..be84616 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 _0x56b8=['getIntervals','GetInterval','name','interval','../client'];(function(_0x5df175,_0x5e1de6){var _0x242b56=function(_0x1703ea){while(--_0x1703ea){_0x5df175['push'](_0x5df175['shift']());}};_0x242b56(++_0x5e1de6);}(_0x56b8,0x108));var _0x856b=function(_0x2994ff,_0x49cfe9){_0x2994ff=_0x2994ff-0x0;var _0xff37c9=_0x56b8[_0x2994ff];return _0xff37c9;};'use strict';var client=require(_0x856b('0x0'));exports[_0x856b('0x1')]=function(){return function(){return client['Request'](_0x856b('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x856b('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name',_0x856b('0x4')]}]},'log':_0x856b('0x1')});};}; \ No newline at end of file +var _0x6c09=['getIntervals','Request','name','Intervals','interval','../client'];(function(_0x4da493,_0x15e45a){var _0x33e403=function(_0x11dfd3){while(--_0x11dfd3){_0x4da493['push'](_0x4da493['shift']());}};_0x33e403(++_0x15e45a);}(_0x6c09,0x14f));var _0x96c0=function(_0xdd69ea,_0x3555fd){_0xdd69ea=_0xdd69ea-0x0;var _0x19af0b=_0x6c09[_0xdd69ea];return _0x19af0b;};'use strict';var client=require(_0x96c0('0x0'));exports[_0x96c0('0x1')]=function(){return function(){return client[_0x96c0('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x96c0('0x3')],'include':[{'model':'Interval','as':_0x96c0('0x4'),'attributes':['id','name',_0x96c0('0x5')]}]},'log':_0x96c0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c324fff..de6be52 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 _0xd7d1=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5b5db7,_0x139890){_0x5b5db7=_0x5b5db7-0x0;var _0x359c38=_0xd7d1[_0x5b5db7];return _0x359c38;};'use strict';var client=require(_0x1d7d('0x0'));exports[_0x1d7d('0x1')]=function(_0xce4540,_0x447083){return client[_0x1d7d('0x2')](_0x1d7d('0x3'),{'body':_0x447083,'options':{'where':{'id':_0xce4540}},'log':_0x1d7d('0x4')});};exports[_0x1d7d('0x5')]=function(_0x1ac097,_0x1adb6b){return client[_0x1d7d('0x2')](_0x1d7d('0x6'),{'body':_0x1adb6b,'options':{'where':{'id':_0x1ac097}},'log':_0x1d7d('0x7')});}; \ No newline at end of file +var _0x32f4=['updateMailInteraction','Request','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction'];(function(_0xe84074,_0xaf6bcf){var _0x4de41a=function(_0x3ed7c0){while(--_0x3ed7c0){_0xe84074['push'](_0xe84074['shift']());}};_0x4de41a(++_0xaf6bcf);}(_0x32f4,0x154));var _0x432f=function(_0x5177c5,_0x2b3d33){_0x5177c5=_0x5177c5-0x0;var _0x4783d6=_0x32f4[_0x5177c5];return _0x4783d6;};'use strict';var client=require(_0x432f('0x0'));exports[_0x432f('0x1')]=function(_0x29845b,_0x2b22ad){return client['Request'](_0x432f('0x2'),{'body':_0x2b22ad,'options':{'where':{'id':_0x29845b}},'log':_0x432f('0x3')});};exports['addTags']=function(_0x354293,_0x1eabac){return client[_0x432f('0x4')](_0x432f('0x5'),{'body':_0x1eabac,'options':{'where':{'id':_0x354293}},'log':_0x432f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 17edaa5..2ddb963 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 _0xf382=['../client','Request','CreateMailMessage','createMailMessage'];(function(_0xa0dc9e,_0x36355e){var _0xfbada2=function(_0x5593de){while(--_0x5593de){_0xa0dc9e['push'](_0xa0dc9e['shift']());}};_0xfbada2(++_0x36355e);}(_0xf382,0x12c));var _0x2f38=function(_0x49b36c,_0x597234){_0x49b36c=_0x49b36c-0x0;var _0x2937bf=_0xf382[_0x49b36c];return _0x2937bf;};'use strict';var client=require(_0x2f38('0x0'));exports['create']=function(_0x3d8009){return client[_0x2f38('0x1')](_0x2f38('0x2'),{'body':_0x3d8009,'log':_0x2f38('0x3')});}; \ No newline at end of file +var _0xbd63=['Request','createMailMessage','../client','create'];(function(_0x1a3f6c,_0x2177cc){var _0x361953=function(_0x270019){while(--_0x270019){_0x1a3f6c['push'](_0x1a3f6c['shift']());}};_0x361953(++_0x2177cc);}(_0xbd63,0x1d2));var _0x3bd6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbd63[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x3bd6('0x0'));exports[_0x3bd6('0x1')]=function(_0x20259a){return client[_0x3bd6('0x2')]('CreateMailMessage',{'body':_0x20259a,'log':_0x3bd6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 22f90ce..11f8c93 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 _0x0e33=['timeout','User','Agents','../client','getMailQueues','GetMailQueue','name'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x0e33,0xf8));var _0x30e3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0e33[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x30e3('0x0'));exports[_0x30e3('0x1')]=function(){return function(){return client['Request'](_0x30e3('0x2'),{'options':{'raw':![],'attributes':['id',_0x30e3('0x3'),_0x30e3('0x4'),'strategy'],'include':[{'model':_0x30e3('0x5'),'as':_0x30e3('0x6'),'attributes':['id',_0x30e3('0x3'),'online','mailPause']}]},'log':_0x30e3('0x1')});};}; \ No newline at end of file +var _0xd242=['timeout','strategy','User','Agents','getMailQueues','../client','Request','GetMailQueue','name'];(function(_0x4e9086,_0x4167a4){var _0x23b71f=function(_0x2f08f0){while(--_0x2f08f0){_0x4e9086['push'](_0x4e9086['shift']());}};_0x23b71f(++_0x4167a4);}(_0xd242,0x137));var _0x2d24=function(_0x4ee2be,_0x188b82){_0x4ee2be=_0x4ee2be-0x0;var _0x165535=_0xd242[_0x4ee2be];return _0x165535;};'use strict';var client=require(_0x2d24('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x2d24('0x1')](_0x2d24('0x2'),{'options':{'raw':![],'attributes':['id',_0x2d24('0x3'),_0x2d24('0x4'),_0x2d24('0x5')],'include':[{'model':_0x2d24('0x6'),'as':_0x2d24('0x7'),'attributes':['id',_0x2d24('0x3'),'online','mailPause']}]},'log':_0x2d24('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 07adf92..4e23277 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 _0x734a=['Request','CreateMailQueueReport','UpdateMailQueueReport','create'];(function(_0x307146,_0x328205){var _0xfbc8cd=function(_0x2cabd2){while(--_0x2cabd2){_0x307146['push'](_0x307146['shift']());}};_0xfbc8cd(++_0x328205);}(_0x734a,0x143));var _0xa734=function(_0x479b99,_0x1e5bec){_0x479b99=_0x479b99-0x0;var _0x1e7eb7=_0x734a[_0x479b99];return _0x1e7eb7;};'use strict';var client=require('../client');exports[_0xa734('0x0')]=function(_0x5c147a){return client[_0xa734('0x1')](_0xa734('0x2'),{'body':_0x5c147a,'log':_0xa734('0x2')});};exports['update']=function(_0x115b26,_0x21abb5){return client[_0xa734('0x1')](_0xa734('0x3'),{'body':_0x21abb5,'options':{'where':{'uniqueid':_0x115b26},'order':[['id','DESC']],'limit':0x1},'log':_0xa734('0x3')});}; \ No newline at end of file +var _0x0ef9=['create','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x752d50,_0x4f8e32){var _0x1876a5=function(_0x510001){while(--_0x510001){_0x752d50['push'](_0x752d50['shift']());}};_0x1876a5(++_0x4f8e32);}(_0x0ef9,0x6e));var _0x90ef=function(_0x17ec16,_0x2436e3){_0x17ec16=_0x17ec16-0x0;var _0x1f59f5=_0x0ef9[_0x17ec16];return _0x1f59f5;};'use strict';var client=require('../client');exports[_0x90ef('0x0')]=function(_0x28a634){return client['Request'](_0x90ef('0x1'),{'body':_0x28a634,'log':'CreateMailQueueReport'});};exports[_0x90ef('0x2')]=function(_0x536077,_0x2cafac){return client['Request'](_0x90ef('0x3'),{'body':_0x2cafac,'options':{'where':{'uniqueid':_0x536077},'order':[['id',_0x90ef('0x4')]],'limit':0x1},'log':_0x90ef('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 456f072..dbc115d 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 _0x0307=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','Request'];(function(_0x3b6112,_0x31a6f3){var _0x263088=function(_0x447239){while(--_0x447239){_0x3b6112['push'](_0x3b6112['shift']());}};_0x263088(++_0x31a6f3);}(_0x0307,0x10b));var _0x7030=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0307[_0x1d1779];return _0x2377e9;};'use strict';var client=require('../client');exports['update']=function(_0x4ec2d2,_0x1237a5){return client[_0x7030('0x0')]('UpdateOpenchannelInteraction',{'body':_0x1237a5,'options':{'where':{'id':_0x4ec2d2}},'log':'updateOpenchannelInteraction'});};exports[_0x7030('0x1')]=function(_0x4e4211,_0x2df17b){return client[_0x7030('0x0')](_0x7030('0x2'),{'body':_0x2df17b,'options':{'where':{'id':_0x4e4211}},'log':_0x7030('0x3')});}; \ No newline at end of file +var _0xc2da=['../client','update','Request','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc2da,0x156));var _0xac2d=function(_0x5a6e7b,_0x3dabdc){_0x5a6e7b=_0x5a6e7b-0x0;var _0x5bef75=_0xc2da[_0x5a6e7b];return _0x5bef75;};'use strict';var client=require(_0xac2d('0x0'));exports[_0xac2d('0x1')]=function(_0x50ac8e,_0x4a5eac){return client[_0xac2d('0x2')](_0xac2d('0x3'),{'body':_0x4a5eac,'options':{'where':{'id':_0x50ac8e}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x2b19ce,_0x1940bd){return client[_0xac2d('0x2')](_0xac2d('0x4'),{'body':_0x1940bd,'options':{'where':{'id':_0x2b19ce}},'log':_0xac2d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 80881d3..834b2f3 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 _0x2b94=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x143386,_0x564ebb){var _0x1479a0=function(_0x27e331){while(--_0x27e331){_0x143386['push'](_0x143386['shift']());}};_0x1479a0(++_0x564ebb);}(_0x2b94,0xc4));var _0x42b9=function(_0x1c8135,_0x246867){_0x1c8135=_0x1c8135-0x0;var _0x40c4ab=_0x2b94[_0x1c8135];return _0x40c4ab;};'use strict';var client=require('../client');exports[_0x42b9('0x0')]=function(_0x4eb80d){return client[_0x42b9('0x1')](_0x42b9('0x2'),{'body':_0x4eb80d,'log':_0x42b9('0x3')});}; \ No newline at end of file +var _0xa4f4=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x5012e0,_0x47a186){var _0x72706d=function(_0x13d02e){while(--_0x13d02e){_0x5012e0['push'](_0x5012e0['shift']());}};_0x72706d(++_0x47a186);}(_0xa4f4,0x1ea));var _0x4a4f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa4f4[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x4a4f('0x0'));exports[_0x4a4f('0x1')]=function(_0x19dae4){return client[_0x4a4f('0x2')](_0x4a4f('0x3'),{'body':_0x19dae4,'log':_0x4a4f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5ecc502..5deecc2 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 _0xd696=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','User','Agents','openchannelPause'];(function(_0x15ec5,_0x5b20a6){var _0x3ed96b=function(_0x21decd){while(--_0x21decd){_0x15ec5['push'](_0x15ec5['shift']());}};_0x3ed96b(++_0x5b20a6);}(_0xd696,0xe1));var _0x6d69=function(_0x1765dc,_0x17d194){_0x1765dc=_0x1765dc-0x0;var _0x5e7800=_0xd696[_0x1765dc];return _0x5e7800;};'use strict';var client=require(_0x6d69('0x0'));exports[_0x6d69('0x1')]=function(){return function(){return client[_0x6d69('0x2')](_0x6d69('0x3'),{'options':{'raw':![],'attributes':['id',_0x6d69('0x4'),_0x6d69('0x5'),'strategy'],'include':[{'model':_0x6d69('0x6'),'as':_0x6d69('0x7'),'attributes':['id',_0x6d69('0x4'),'online',_0x6d69('0x8')]}]},'log':_0x6d69('0x1')});};}; \ No newline at end of file +var _0x958f=['GetOpenchannelQueue','name','strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x27793a,_0x1bf59a){var _0x4dc325=function(_0x2ccf27){while(--_0x2ccf27){_0x27793a['push'](_0x27793a['shift']());}};_0x4dc325(++_0x1bf59a);}(_0x958f,0x114));var _0xf958=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x958f[_0x599f41];return _0x2e4d58;};'use strict';var client=require(_0xf958('0x0'));exports[_0xf958('0x1')]=function(){return function(){return client[_0xf958('0x2')](_0xf958('0x3'),{'options':{'raw':![],'attributes':['id',_0xf958('0x4'),'timeout',_0xf958('0x5')],'include':[{'model':'User','as':_0xf958('0x6'),'attributes':['id','name',_0xf958('0x7'),_0xf958('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5a57f7a..cf31087 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 _0xf472=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xf472,0xd1));var _0x2f47=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf472[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x2f47('0x0'));exports[_0x2f47('0x1')]=function(_0x8ef912){return client[_0x2f47('0x2')](_0x2f47('0x3'),{'body':_0x8ef912,'log':_0x2f47('0x3')});};exports[_0x2f47('0x4')]=function(_0x31539c,_0x45af27){return client[_0x2f47('0x2')](_0x2f47('0x5'),{'body':_0x45af27,'options':{'where':{'uniqueid':_0x31539c},'order':[['id',_0x2f47('0x6')]],'limit':0x1},'log':_0x2f47('0x5')});}; \ No newline at end of file +var _0x62ed=['update','DESC','UpdateOpenchannelQueueReport','create','CreateOpenchannelQueueReport'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x62ed,0x18e));var _0xd62e=function(_0x3408f0,_0x190d1b){_0x3408f0=_0x3408f0-0x0;var _0x271e2d=_0x62ed[_0x3408f0];return _0x271e2d;};'use strict';var client=require('../client');exports[_0xd62e('0x0')]=function(_0xe2aebc){return client['Request'](_0xd62e('0x1'),{'body':_0xe2aebc,'log':_0xd62e('0x1')});};exports[_0xd62e('0x2')]=function(_0x94c426,_0x2c395c){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x2c395c,'options':{'where':{'uniqueid':_0x94c426},'order':[['id',_0xd62e('0x3')]],'limit':0x1},'log':_0xd62e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e51b3fd..193aa93 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 _0x89fe=['UpdateSmsInteraction','updateSmsInteraction','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x89fe,0x83));var _0xe89f=function(_0x29fa9d,_0x34cf83){_0x29fa9d=_0x29fa9d-0x0;var _0xaa6ac=_0x89fe[_0x29fa9d];return _0xaa6ac;};'use strict';var client=require(_0xe89f('0x0'));exports[_0xe89f('0x1')]=function(_0x2aac3e,_0x3420da){return client['Request'](_0xe89f('0x2'),{'body':_0x3420da,'options':{'where':{'id':_0x2aac3e}},'log':_0xe89f('0x3')});};exports['addTags']=function(_0x3d3aa8,_0x3d8b30){return client[_0xe89f('0x4')](_0xe89f('0x5'),{'body':_0x3d8b30,'options':{'where':{'id':_0x3d3aa8}},'log':_0xe89f('0x6')});}; \ No newline at end of file +var _0x1f63=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x2749b8,_0x570e1c){var _0x589657=function(_0x4b5169){while(--_0x4b5169){_0x2749b8['push'](_0x2749b8['shift']());}};_0x589657(++_0x570e1c);}(_0x1f63,0x7a));var _0x31f6=function(_0x575c6b,_0x6c4c22){_0x575c6b=_0x575c6b-0x0;var _0x438856=_0x1f63[_0x575c6b];return _0x438856;};'use strict';var client=require(_0x31f6('0x0'));exports[_0x31f6('0x1')]=function(_0x57257d,_0x165252){return client[_0x31f6('0x2')](_0x31f6('0x3'),{'body':_0x165252,'options':{'where':{'id':_0x57257d}},'log':'updateSmsInteraction'});};exports[_0x31f6('0x4')]=function(_0x33b415,_0x5326b7){return client['Request'](_0x31f6('0x5'),{'body':_0x5326b7,'options':{'where':{'id':_0x33b415}},'log':_0x31f6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 184a41e..ba04aca 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 _0xd740=['Request','CreateSmsMessage','../client'];(function(_0x189984,_0x477464){var _0x23c2a9=function(_0x1403ce){while(--_0x1403ce){_0x189984['push'](_0x189984['shift']());}};_0x23c2a9(++_0x477464);}(_0xd740,0x9e));var _0x0d74=function(_0x44e50a,_0x1cc4a2){_0x44e50a=_0x44e50a-0x0;var _0x1b5994=_0xd740[_0x44e50a];return _0x1b5994;};'use strict';var client=require(_0x0d74('0x0'));exports['create']=function(_0x18fc1b){return client[_0x0d74('0x1')](_0x0d74('0x2'),{'body':_0x18fc1b,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x48fc=['../client','create','Request','createSmsMessage'];(function(_0x5b0cdb,_0x3dd3e3){var _0x199c8e=function(_0x565ab2){while(--_0x565ab2){_0x5b0cdb['push'](_0x5b0cdb['shift']());}};_0x199c8e(++_0x3dd3e3);}(_0x48fc,0x148));var _0xc48f=function(_0x3706bb,_0x2679e1){_0x3706bb=_0x3706bb-0x0;var _0x5c498b=_0x48fc[_0x3706bb];return _0x5c498b;};'use strict';var client=require(_0xc48f('0x0'));exports[_0xc48f('0x1')]=function(_0x47ca63){return client[_0xc48f('0x2')]('CreateSmsMessage',{'body':_0x47ca63,'log':_0xc48f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index fca4e84..1b7293d 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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x2b9199,_0x190e7b){var _0x24efe2=function(_0x52264e){while(--_0x52264e){_0x2b9199['push'](_0x2b9199['shift']());}};_0x24efe2(++_0x190e7b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xcb91[_0x403c20];return _0x2b271a;};'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 +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x424a32,_0x74d7e5){var _0x5393bf=function(_0x171b99){while(--_0x171b99){_0x424a32['push'](_0x424a32['shift']());}};_0x5393bf(++_0x74d7e5);}(_0xe706,0xa3));var _0x6e70=function(_0x336df4,_0x52c1dc){_0x336df4=_0x336df4-0x0;var _0x580d8c=_0xe706[_0x336df4];return _0x580d8c;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index cea23d1..3b2fbab 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x432073,_0x5a06f5){var _0x5cb45e=function(_0x442cfc){while(--_0x442cfc){_0x432073['push'](_0x432073['shift']());}};_0x5cb45e(++_0x5a06f5);}(_0x70e0,0x17b));var _0x070e=function(_0x30efa7,_0x40e3b2){_0x30efa7=_0x30efa7-0x0;var _0x4a9056=_0x70e0[_0x30efa7];return _0x4a9056;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x200032,_0xe28a59){var _0x2f905b=function(_0x289a54){while(--_0x289a54){_0x200032['push'](_0x200032['shift']());}};_0x2f905b(++_0xe28a59);}(_0x3e74,0x175));var _0x43e7=function(_0xef4b0b,_0x3b0a24){_0xef4b0b=_0xef4b0b-0x0;var _0x439b22=_0x3e74[_0xef4b0b];return _0x439b22;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6045d17..1a17212 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(_0xf19caf,_0x5548ee){var _0x4952c3=function(_0x228720){while(--_0x228720){_0xf19caf['push'](_0xf19caf['shift']());}};_0x4952c3(++_0x5548ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x1de497,_0x5b2194){var _0x4f1c8f=function(_0x3a1364){while(--_0x3a1364){_0x1de497['push'](_0x1de497['shift']());}};_0x4f1c8f(++_0x5b2194);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index dda5f04..56b9d3d 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 _0xcf71=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request'];(function(_0x1bdd9a,_0x169dcd){var _0x4dc294=function(_0x4d5ede){while(--_0x4d5ede){_0x1bdd9a['push'](_0x1bdd9a['shift']());}};_0x4dc294(++_0x169dcd);}(_0xcf71,0xba));var _0x1cf7=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0xcf71[_0x2d0d9f];return _0x30243d;};'use strict';var client=require(_0x1cf7('0x0'));exports[_0x1cf7('0x1')]=function(_0x1953aa,_0x259edc){return client['Request'](_0x1cf7('0x2'),{'body':_0x259edc,'options':{'where':{'id':_0x1953aa}},'log':_0x1cf7('0x3')});};exports[_0x1cf7('0x4')]=function(_0x21307d,_0x11e462){return client[_0x1cf7('0x5')](_0x1cf7('0x6'),{'body':_0x11e462,'options':{'where':{'id':_0x21307d}},'log':_0x1cf7('0x7')});}; \ No newline at end of file +var _0x6691=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x17d7c9,_0xfc5fe1){var _0x2c2aba=function(_0x1c017b){while(--_0x1c017b){_0x17d7c9['push'](_0x17d7c9['shift']());}};_0x2c2aba(++_0xfc5fe1);}(_0x6691,0x12d));var _0x1669=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6691[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x1669('0x0'));exports[_0x1669('0x1')]=function(_0xc9ad5a,_0x1cc116){return client[_0x1669('0x2')](_0x1669('0x3'),{'body':_0x1cc116,'options':{'where':{'id':_0xc9ad5a}},'log':_0x1669('0x4')});};exports[_0x1669('0x5')]=function(_0x19a3f5,_0x2ad807){return client['Request'](_0x1669('0x6'),{'body':_0x2ad807,'options':{'where':{'id':_0x19a3f5}},'log':_0x1669('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 02d4ba0..34766a3 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 _0x1297=['createWhatsappMessage','../client','Request','CreateWhatsappMessage'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x1297,0x155));var _0x7129=function(_0x2042ed,_0x20a895){_0x2042ed=_0x2042ed-0x0;var _0x9f8fc0=_0x1297[_0x2042ed];return _0x9f8fc0;};'use strict';var client=require(_0x7129('0x0'));exports['create']=function(_0x7cc534){return client[_0x7129('0x1')](_0x7129('0x2'),{'body':_0x7cc534,'log':_0x7129('0x3')});}; \ No newline at end of file +var _0x9e67=['../client','create','Request'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9e67,0x19b));var _0x79e6=function(_0x24e14f,_0x46e02a){_0x24e14f=_0x24e14f-0x0;var _0x2a8072=_0x9e67[_0x24e14f];return _0x2a8072;};'use strict';var client=require(_0x79e6('0x0'));exports[_0x79e6('0x1')]=function(_0x218047){return client[_0x79e6('0x2')]('CreateWhatsappMessage',{'body':_0x218047,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b8576df..94c3f88 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 _0x23fd=['name','timeout','Agents','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x23fd,0x184));var _0xd23f=function(_0x590382,_0x4b7279){_0x590382=_0x590382-0x0;var _0x329c42=_0x23fd[_0x590382];return _0x329c42;};'use strict';var client=require(_0xd23f('0x0'));exports[_0xd23f('0x1')]=function(){return function(){return client[_0xd23f('0x2')](_0xd23f('0x3'),{'options':{'raw':![],'attributes':['id',_0xd23f('0x4'),_0xd23f('0x5'),'strategy'],'include':[{'model':'User','as':_0xd23f('0x6'),'attributes':['id',_0xd23f('0x4'),'online','whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xe0ee=['strategy','online','whatsappPause','getWhatsappQueues','Request','name','timeout'];(function(_0x3e2394,_0x2dc34c){var _0x29743b=function(_0x44ede3){while(--_0x44ede3){_0x3e2394['push'](_0x3e2394['shift']());}};_0x29743b(++_0x2dc34c);}(_0xe0ee,0x100));var _0xee0e=function(_0x4c8fa1,_0x4e4bde){_0x4c8fa1=_0x4c8fa1-0x0;var _0x9768c9=_0xe0ee[_0x4c8fa1];return _0x9768c9;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0xee0e('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xee0e('0x1'),_0xee0e('0x2'),_0xee0e('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xee0e('0x1'),_0xee0e('0x4'),_0xee0e('0x5')]}]},'log':_0xee0e('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 7aa538e..401181a 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 _0x0686=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update','DESC'];(function(_0x30f87a,_0x2cce5a){var _0x3a8efc=function(_0x225d6b){while(--_0x225d6b){_0x30f87a['push'](_0x30f87a['shift']());}};_0x3a8efc(++_0x2cce5a);}(_0x0686,0x1c1));var _0x6068=function(_0x29cb36,_0x2dc053){_0x29cb36=_0x29cb36-0x0;var _0x8b6afd=_0x0686[_0x29cb36];return _0x8b6afd;};'use strict';var client=require(_0x6068('0x0'));exports[_0x6068('0x1')]=function(_0xf33fb6){return client[_0x6068('0x2')](_0x6068('0x3'),{'body':_0xf33fb6,'log':_0x6068('0x3')});};exports[_0x6068('0x4')]=function(_0xacdd6e,_0x459d1a){return client[_0x6068('0x2')]('UpdateWhatsappQueueReport',{'body':_0x459d1a,'options':{'where':{'uniqueid':_0xacdd6e},'order':[['id',_0x6068('0x5')]],'limit':0x1},'log':_0x6068('0x6')});}; \ No newline at end of file +var _0x0fc6=['Request','UpdateWhatsappQueueReport','create','CreateWhatsappQueueReport','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0fc6,0x1a1));var _0x60fc=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0fc6[_0x178e48];return _0x440d7e;};'use strict';var client=require('../client');exports[_0x60fc('0x0')]=function(_0x393cb6){return client['Request']('CreateWhatsappQueueReport',{'body':_0x393cb6,'log':_0x60fc('0x1')});};exports[_0x60fc('0x2')]=function(_0x420f63,_0x5d790d){return client[_0x60fc('0x3')](_0x60fc('0x4'),{'body':_0x5d790d,'options':{'where':{'uniqueid':_0x420f63},'order':[['id','DESC']],'limit':0x1},'log':_0x60fc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 96455d2..4bf5173 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 _0x2139=['timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','error','[%s][AGENT]\x20%s','map','join','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','stack','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0x2139,0x186));var _0x9213=function(_0x2fcd34,_0x3d237a){_0x2fcd34=_0x2fcd34-0x0;var _0x4f51c8=_0x2139[_0x2fcd34];return _0x4f51c8;};'use strict';var schema=require('validate');var _=require(_0x9213('0x0'));var util=require(_0x9213('0x1'));var seqqueue=require(_0x9213('0x2'));var logger=require(_0x9213('0x3'))(_0x9213('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x9213('0x5')},'timeout':{'type':'number','message':_0x9213('0x6')}});function writeLog(_0x5e78c7,_0x386226,_0x533242){return logger[_0x9213('0x7')](util[_0x9213('0x8')](_0x9213('0x9'),_0x5e78c7,_0x386226['name'],_0x533242));}function handleFindAgent(_0x35bc2a){return function(_0x59b75b){return _0x59b75b[_0x9213('0xa')]['toLowerCase']()===_0x35bc2a[_0x9213('0xb')]();};}exports[_0x9213('0xc')]=function(_0x47d33f,_0x1929d6,_0x14185e,_0x30e680){return function(_0x23af16){try{var _0x20d48f={'name':_0x1929d6[0x0],'timeout':_0x1929d6[0x1]};var _0x39c84f=queue[_0x9213('0xd')](_0x20d48f,{'typecast':!![]});if(_0x39c84f['length']){logger[_0x9213('0xe')](_0x9213('0xf'),_0x47d33f,_[_0x9213('0x10')](_0x39c84f,'message')[_0x9213('0x11')](',\x20'));_0x23af16['stop']();}else{var _0x4dfd73=_['find'](_0x14185e[_0x9213('0x12')],handleFindAgent(_0x20d48f[_0x9213('0xa')]));if(_0x4dfd73){var _0x2f57b2=(_0x20d48f[_0x9213('0x13')]||0xa)*0x3e8;var _0x42c49e,_0x85b736;var _0x3752d1=seqqueue[_0x9213('0x14')](_0x2f57b2);_0x3752d1['id']=_0x47d33f;_0x3752d1['atimeout']=_0x2f57b2;_0x3752d1[_0x9213('0x15')]=_0x30e680[_0x9213('0x15')];writeLog(_0x47d33f,_0x4dfd73,util['format'](_0x9213('0x16'),_0x2f57b2));_0x14185e[_0x9213('0x17')][_0x47d33f]['on'](_0x9213('0x18'),function(){logger[_0x9213('0x7')](_0x9213('0x19'),_0x47d33f);clearTimeout(_0x85b736);_0x85b736=undefined;_0x3752d1[_0x9213('0x1a')]();if(_0x14185e['rules'][_0x47d33f]){delete _0x14185e[_0x9213('0x17')][_0x47d33f];}_0x23af16[_0x9213('0x1b')]();});_0x14185e[_0x9213('0x17')][_0x47d33f]['on']('complete',function(){if(_0x14185e[_0x9213('0x17')][_0x47d33f]){delete _0x14185e[_0x9213('0x17')][_0x47d33f];}});_0x85b736=setTimeout(function(){logger[_0x9213('0x7')](_0x9213('0x1c'),_0x47d33f);clearTimeout(_0x85b736);_0x3752d1[_0x9213('0x1a')]();_0x23af16[_0x9213('0x1d')]();},_0x2f57b2);strategy[_0x9213('0x1e')](_0x3752d1,_0x4dfd73,_0x14185e,_0x30e680);}else{logger[_0x9213('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x47d33f,_0x20d48f['name']);_0x23af16['stop']();}}}catch(_0x4d53c1){console[_0x9213('0x1f')](_0x4d53c1);logger['error']('[%s][QUEUE]\x20%s',_0x47d33f,_0x4d53c1[_0x9213('0x20')]);_0x23af16[_0x9213('0x1b')]();}};}; \ No newline at end of file +var _0x6435=['info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','end','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','log','[%s][QUEUE]\x20%s','validate','lodash','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6435,0xb4));var _0x5643=function(_0x4de5d0,_0x1305be){_0x4de5d0=_0x4de5d0-0x0;var _0x24510c=_0x6435[_0x4de5d0];return _0x24510c;};'use strict';var schema=require(_0x5643('0x0'));var _=require(_0x5643('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x5643('0x2'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x5643('0x3')},'timeout':{'type':_0x5643('0x4'),'message':_0x5643('0x5')}});function writeLog(_0x45f043,_0x261ac0,_0x40595d){return logger[_0x5643('0x6')](util[_0x5643('0x7')](_0x5643('0x8'),_0x45f043,_0x261ac0[_0x5643('0x9')],_0x40595d));}function handleFindAgent(_0x53a776){return function(_0x28df16){return _0x28df16[_0x5643('0x9')][_0x5643('0xa')]()===_0x53a776[_0x5643('0xa')]();};}exports[_0x5643('0xb')]=function(_0x3ec85e,_0x9e8e72,_0x5ecb46,_0x251c13){return function(_0x4227b0){try{var _0x55d765={'name':_0x9e8e72[0x0],'timeout':_0x9e8e72[0x1]};var _0x58ea69=queue[_0x5643('0x0')](_0x55d765,{'typecast':!![]});if(_0x58ea69[_0x5643('0xc')]){logger[_0x5643('0xd')](_0x5643('0xe'),_0x3ec85e,_['map'](_0x58ea69,'message')['join'](',\x20'));_0x4227b0[_0x5643('0xf')]();}else{var _0x1971d2=_[_0x5643('0x10')](_0x5ecb46[_0x5643('0x11')],handleFindAgent(_0x55d765[_0x5643('0x9')]));if(_0x1971d2){var _0x24ed8a=(_0x55d765[_0x5643('0x12')]||0xa)*0x3e8;var _0x354113,_0x4d75f3;var _0x1eaf39=seqqueue[_0x5643('0x13')](_0x24ed8a);_0x1eaf39['id']=_0x3ec85e;_0x1eaf39[_0x5643('0x14')]=_0x24ed8a;_0x1eaf39[_0x5643('0x15')]=_0x251c13[_0x5643('0x15')];writeLog(_0x3ec85e,_0x1971d2,util[_0x5643('0x7')](_0x5643('0x16'),_0x24ed8a));_0x5ecb46['rules'][_0x3ec85e]['on'](_0x5643('0x17'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3ec85e);clearTimeout(_0x4d75f3);_0x4d75f3=undefined;_0x1eaf39[_0x5643('0x18')]();if(_0x5ecb46['rules'][_0x3ec85e]){delete _0x5ecb46[_0x5643('0x19')][_0x3ec85e];}_0x4227b0[_0x5643('0xf')]();});_0x5ecb46[_0x5643('0x19')][_0x3ec85e]['on'](_0x5643('0x1a'),function(){if(_0x5ecb46['rules'][_0x3ec85e]){delete _0x5ecb46[_0x5643('0x19')][_0x3ec85e];}});_0x4d75f3=setTimeout(function(){logger[_0x5643('0x6')](_0x5643('0x1b'),_0x3ec85e);clearTimeout(_0x4d75f3);_0x1eaf39[_0x5643('0x18')]();_0x4227b0[_0x5643('0x1c')]();},_0x24ed8a);strategy['agent'](_0x1eaf39,_0x1971d2,_0x5ecb46,_0x251c13);}else{logger[_0x5643('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3ec85e,_0x55d765[_0x5643('0x9')]);_0x4227b0['stop']();}}}catch(_0xf8e5){console[_0x5643('0x1d')](_0xf8e5);logger['error'](_0x5643('0x1e'),_0x3ec85e,_0xf8e5['stack']);_0x4227b0[_0x5643('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 8256300..5cbe25d 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 _0xeb5c=['[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','body','create','then','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','message','toString','postText','error','amazonlex','providerName','providerResponse','Message','Failed','catch','aws-sdk','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x4cccd5,_0x132546){var _0xed26df=function(_0x12bbea){while(--_0x12bbea){_0x4cccd5['push'](_0x4cccd5['shift']());}};_0xed26df(++_0x132546);}(_0xeb5c,0xd4));var _0xceb5=function(_0x4789e5,_0x2d7e4d){_0x4789e5=_0x4789e5-0x0;var _0x4f2bac=_0xeb5c[_0x4789e5];return _0x4f2bac;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0xceb5('0x0'));var utils=require('./utils');var logger=require(_0xceb5('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xceb5('0x2')),'mailMessage':require(_0xceb5('0x3')),'smsMessage':require(_0xceb5('0x4')),'faxMessage':require(_0xceb5('0x5')),'whatsappMessage':require(_0xceb5('0x6'))};exports[_0xceb5('0x7')]=function(_0x44cc8a,_0x1b949e){return function(_0x19a133){try{if(!_['isNil'](this['interaction']['UserId'])){logger['info'](_0xceb5('0x8'),_0x44cc8a,_0xceb5('0x9'));return _0x19a133[_0xceb5('0xa')]();}var _0x17fa55={'ContactId':this[_0xceb5('0xb')]['id'],'sentAt':moment()[_0xceb5('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xceb5('0xd')]===_0xceb5('0xe')||this[_0xceb5('0xd')]===_0xceb5('0xf')){_0x17fa55[_0xceb5('0x10')]=this[_0xceb5('0x11')]['phone'];}var _0x869e37=this['channel'];if(_0x869e37===_0xceb5('0x12')){_0x17fa55[_0xceb5('0x13')]=this[_0xceb5('0x14')]['id'];}else{_0x17fa55[_['upperFirst'](_0x869e37)+_0xceb5('0x15')]=this[_0xceb5('0x14')]['id'];}_0x17fa55[_[_0xceb5('0x16')](_0x869e37)+_0xceb5('0x17')]=this[_0xceb5('0x11')]['id'];if(this[_0xceb5('0x11')][_0xceb5('0x18')]){var _0x47f86e=_0x1b949e[0x4];if(!_['isEmpty'](_0x47f86e)){_0x17fa55[_0xceb5('0x19')]=utils['getMustacheRender'](_0x47f86e,this);return rpc[_0x869e37+'Message'][_0xceb5('0x1a')](_0x17fa55)[_0xceb5('0x1b')](function(_0x2753f3){logger['info']('[%s][AMAZONLEX]\x20%s',_0x44cc8a,_0x17fa55[_0xceb5('0x19')]);})['catch'](function(_0x5413ef){logger['error']('[%s][AMAZONLEX]\x20%s',_0x44cc8a,JSON[_0xceb5('0x1c')](_0x5413ef));})[_0xceb5('0x1d')](function(){logger[_0xceb5('0x1e')](_0xceb5('0x1f'),_0x44cc8a);_0x19a133[_0xceb5('0x20')]();});}else{logger[_0xceb5('0x1e')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x44cc8a);_0x19a133[_0xceb5('0x20')]();}}else{var _0x13f68d=this;var _0xa991f4=new AWS[(_0xceb5('0x21'))]({'accessKeyId':_0x1b949e[0x0],'secretAccessKey':_0x1b949e[0x1],'region':_0x1b949e[0x2]});var _0x2d2bb5={'botAlias':'$LATEST','botName':_0x1b949e[0x3],'inputText':this[_0xceb5('0x22')][_0xceb5('0x19')],'userId':this['channel']+':'+this[_0xceb5('0x11')]['id'][_0xceb5('0x23')]()};_0xa991f4[_0xceb5('0x24')](_0x2d2bb5,function(_0x260ca2,_0x17560a){if(_0x260ca2){logger[_0xceb5('0x25')]('[%s][AMAZONLEX]\x20%s',_0x44cc8a,_0x260ca2[_0xceb5('0x22')]);_0x19a133[_0xceb5('0xa')]();}else if(_0x17560a&&_0x17560a[_0xceb5('0x22')]){_0x13f68d['body'][_0xceb5('0x26')]=_0x17560a;_0x17fa55[_0xceb5('0x19')]=_0x17560a[_0xceb5('0x22')];_0x17fa55[_0xceb5('0x27')]=_0xceb5('0x26');_0x17fa55[_0xceb5('0x28')]=JSON[_0xceb5('0x1c')](_0x17560a);return rpc[_0x869e37+_0xceb5('0x29')][_0xceb5('0x1a')](_0x17fa55)[_0xceb5('0x1b')](function(_0x150f98){logger[_0xceb5('0x1e')](_0xceb5('0x8'),_0x44cc8a,_0x17fa55[_0xceb5('0x19')]);if(_0x17560a['dialogState']==_0xceb5('0x2a')){_0x19a133[_0xceb5('0xa')]();}else{_0x19a133[_0xceb5('0x20')]();}})[_0xceb5('0x2b')](function(_0x1e2faa){logger[_0xceb5('0x25')](_0xceb5('0x8'),_0x44cc8a,JSON[_0xceb5('0x1c')](_0x1e2faa));_0x19a133[_0xceb5('0xa')]();});}else{_0x19a133[_0xceb5('0xa')]();}});}}catch(_0x48fd79){logger[_0xceb5('0x25')](_0xceb5('0x8'),_0x44cc8a,JSON[_0xceb5('0x1c')](_0x48fd79));_0x19a133['stop']();}};}; \ No newline at end of file +var _0x52f8=['info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','body','getMustacheRender','create','then','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','error','next','amazonlex','providerResponse','Message','dialogState','aws-sdk','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId'];(function(_0x524969,_0x3e0d6c){var _0x27c147=function(_0x32b72c){while(--_0x32b72c){_0x524969['push'](_0x524969['shift']());}};_0x27c147(++_0x3e0d6c);}(_0x52f8,0x114));var _0x852f=function(_0xf73a20,_0x35d5cb){_0xf73a20=_0xf73a20-0x0;var _0x186c54=_0x52f8[_0xf73a20];return _0x186c54;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x852f('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x852f('0x1'));var rpc={'chatMessage':require(_0x852f('0x2')),'openchannelMessage':require(_0x852f('0x3')),'mailMessage':require(_0x852f('0x4')),'smsMessage':require(_0x852f('0x5')),'faxMessage':require(_0x852f('0x6')),'whatsappMessage':require(_0x852f('0x7'))};exports[_0x852f('0x8')]=function(_0x31eb88,_0x5d50ad){return function(_0x4781e8){try{if(!_[_0x852f('0x9')](this[_0x852f('0xa')][_0x852f('0xb')])){logger[_0x852f('0xc')](_0x852f('0xd'),_0x31eb88,_0x852f('0xe'));return _0x4781e8['next']();}var _0x104cb4={'ContactId':this[_0x852f('0xf')]['id'],'sentAt':moment()['format'](_0x852f('0x10')),'direction':_0x852f('0x11')};if(this[_0x852f('0x12')]===_0x852f('0x13')||this['channel']===_0x852f('0x14')){_0x104cb4[_0x852f('0x15')]=this[_0x852f('0xa')][_0x852f('0x15')];}var _0x114488=this[_0x852f('0x12')];if(_0x114488===_0x852f('0x16')){_0x104cb4[_0x852f('0x17')]=this['account']['id'];}else{_0x104cb4[_[_0x852f('0x18')](_0x114488)+_0x852f('0x19')]=this[_0x852f('0x1a')]['id'];}_0x104cb4[_[_0x852f('0x18')](_0x114488)+'InteractionId']=this[_0x852f('0xa')]['id'];if(this[_0x852f('0xa')][_0x852f('0x1b')]){var _0x5a3e7f=_0x5d50ad[0x4];if(!_[_0x852f('0x1c')](_0x5a3e7f)){_0x104cb4[_0x852f('0x1d')]=utils[_0x852f('0x1e')](_0x5a3e7f,this);return rpc[_0x114488+'Message'][_0x852f('0x1f')](_0x104cb4)[_0x852f('0x20')](function(_0x42a042){logger[_0x852f('0xc')]('[%s][AMAZONLEX]\x20%s',_0x31eb88,_0x104cb4[_0x852f('0x1d')]);})[_0x852f('0x21')](function(_0x220dca){logger['error'](_0x852f('0xd'),_0x31eb88,JSON[_0x852f('0x22')](_0x220dca));})['finally'](function(){logger[_0x852f('0xc')](_0x852f('0x23'),_0x31eb88);_0x4781e8[_0x852f('0x24')]();});}else{logger[_0x852f('0xc')](_0x852f('0x25'),_0x31eb88);_0x4781e8['stop']();}}else{var _0x48669f=this;var _0x320583=new AWS[(_0x852f('0x26'))]({'accessKeyId':_0x5d50ad[0x0],'secretAccessKey':_0x5d50ad[0x1],'region':_0x5d50ad[0x2]});var _0x23e47e={'botAlias':_0x852f('0x27'),'botName':_0x5d50ad[0x3],'inputText':this[_0x852f('0x28')][_0x852f('0x1d')],'userId':this[_0x852f('0x12')]+':'+this[_0x852f('0xa')]['id']['toString']()};_0x320583[_0x852f('0x29')](_0x23e47e,function(_0x2aac5e,_0x3b497e){if(_0x2aac5e){logger[_0x852f('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x31eb88,_0x2aac5e[_0x852f('0x28')]);_0x4781e8[_0x852f('0x2b')]();}else if(_0x3b497e&&_0x3b497e[_0x852f('0x28')]){_0x48669f['body'][_0x852f('0x2c')]=_0x3b497e;_0x104cb4[_0x852f('0x1d')]=_0x3b497e[_0x852f('0x28')];_0x104cb4['providerName']=_0x852f('0x2c');_0x104cb4[_0x852f('0x2d')]=JSON[_0x852f('0x22')](_0x3b497e);return rpc[_0x114488+_0x852f('0x2e')]['create'](_0x104cb4)[_0x852f('0x20')](function(_0x273f95){logger[_0x852f('0xc')](_0x852f('0xd'),_0x31eb88,_0x104cb4[_0x852f('0x1d')]);if(_0x3b497e[_0x852f('0x2f')]=='Failed'){_0x4781e8[_0x852f('0x2b')]();}else{_0x4781e8[_0x852f('0x24')]();}})[_0x852f('0x21')](function(_0x419861){logger[_0x852f('0x2a')](_0x852f('0xd'),_0x31eb88,JSON[_0x852f('0x22')](_0x419861));_0x4781e8[_0x852f('0x2b')]();});}else{_0x4781e8[_0x852f('0x2b')]();}});}}catch(_0x3ce3fd){logger[_0x852f('0x2a')](_0x852f('0xd'),_0x31eb88,JSON[_0x852f('0x22')](_0x3ce3fd));_0x4781e8[_0x852f('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 5c405b0..349fcc4 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 _0xeda0=['upperFirst','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','update','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','channel','mail','body','isAutoreply','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','AccountId'];(function(_0xdfa1fa,_0xcb1c94){var _0x20fb4a=function(_0x686c21){while(--_0x686c21){_0xdfa1fa['push'](_0xdfa1fa['shift']());}};_0x20fb4a(++_0xcb1c94);}(_0xeda0,0xf2));var _0x0eda=function(_0x2cb100,_0x18a32f){_0x2cb100=_0x2cb100-0x0;var _0x248758=_0xeda0[_0x2cb100];return _0x248758;};'use strict';var _=require(_0x0eda('0x0'));var moment=require(_0x0eda('0x1'));var utils=require(_0x0eda('0x2'));var logger=require('../../../../config/logger')(_0x0eda('0x3'));var rpc={'chatMessage':require(_0x0eda('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0eda('0x5')),'smsMessage':require(_0x0eda('0x6')),'faxMessage':require(_0x0eda('0x7')),'whatsappMessage':require(_0x0eda('0x8')),'chatInteraction':require(_0x0eda('0x9')),'openchannelInteraction':require(_0x0eda('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x0eda('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0eda('0xc'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x755ffd,_0xffbc22,_0x3fb0c8,_0x2d1c40){return function(_0x5d5c1c){try{var _0x526e2e=this[_0x0eda('0xd')];if(_0x526e2e===_0x0eda('0xe')&&_0x2d1c40[_0x0eda('0xf')][_0x0eda('0x10')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x755ffd,_0x0eda('0x11'));return _0x5d5c1c[_0x0eda('0x12')]();}if(_0xffbc22[0x0]==='1'&&(_[_0x0eda('0x13')](this[_0x0eda('0x14')][_0x0eda('0x15')])||!this[_0x0eda('0x14')]['created'])){logger[_0x0eda('0x16')](_0x0eda('0x17'),_0x755ffd,_0x0eda('0x18'));return _0x5d5c1c['next']();}if(_0xffbc22[0x0]==='2'&&this['interaction'][_0x0eda('0x19')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x755ffd,_0x0eda('0x1a'));return _0x5d5c1c[_0x0eda('0x12')]();}var _0x4c0144={'ContactId':this['contact']['id'],'sentAt':moment()[_0x0eda('0x1b')](_0x0eda('0x1c')),'direction':_0x0eda('0x1d')};if(this[_0x0eda('0xd')]===_0x0eda('0xe')){_0x4c0144[_0x0eda('0xf')]=utils[_0x0eda('0x1e')](_0xffbc22[0x2],this);}else{_0x4c0144[_0x0eda('0xf')]=utils[_0x0eda('0x1e')](_0xffbc22[0x1],this);}if(this[_0x0eda('0x1f')]){_0x4c0144['to']=this[_0x0eda('0x1f')][_0x0eda('0x20')]||'';if(this[_0x0eda('0xd')]==='mail'&&_0xffbc22[0x1]==='1'){_0x4c0144['cc']=this[_0x0eda('0x1f')]['cc']||'';}_0x4c0144[_0x0eda('0x20')]=this['message']['to']||'';_0x4c0144[_0x0eda('0x21')]=this[_0x0eda('0x1f')]['phone']||'';_0x4c0144[_0x0eda('0x22')]=!![];if(this[_0x0eda('0x1f')][_0x0eda('0x23')]){_0x4c0144[_0x0eda('0x23')]='';_0x4c0144['subject']+=_[_0x0eda('0x24')](this[_0x0eda('0x1f')][_0x0eda('0x23')],_0x0eda('0x25'))?'':_0x0eda('0x26');_0x4c0144[_0x0eda('0x23')]+=this[_0x0eda('0x1f')][_0x0eda('0x23')];}}if(this[_0x0eda('0xd')]===_0x0eda('0x27')){_0x4c0144['ChatWebsiteId']=this[_0x0eda('0x28')]['id'];}else{_0x4c0144[_['upperFirst'](this['channel'])+_0x0eda('0x29')]=this['account']['id'];}_0x4c0144[_[_0x0eda('0x2a')](this[_0x0eda('0xd')])+_0x0eda('0x2b')]=this[_0x0eda('0x14')]['id'];var _0xa06b14=this[_0x0eda('0x14')];if(rpc[this[_0x0eda('0xd')]+_0x0eda('0x2c')]){if(this['channel']===_0x0eda('0xe')){_0x4c0144[_0x0eda('0x2d')]=this[_0x0eda('0x1f')][_0x0eda('0x2e')];_0x4c0144[_0x0eda('0x2f')]=_0x0eda('0x30')+_[_0x0eda('0x31')](_0x4c0144[_0x0eda('0xf')],_0x0eda('0x32'),_0x0eda('0x33'))+_0x0eda('0x34');_0x4c0144[_0x0eda('0x35')]={'Auto-Submitted':_0x0eda('0x36'),'X-Auto-Response-Suppress':_0x0eda('0x37'),'Precedence':_0x0eda('0x38')};return mailRpc[_0x0eda('0x39')](this['account'][_0x0eda('0x3a')],_0x4c0144)[_0x0eda('0x3b')](function(_0x126035){logger[_0x0eda('0x16')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x755ffd);_0x4c0144['messageId']=_0x126035[_0x0eda('0x1f')][_0x0eda('0x2e')];return rpc[_0x526e2e+_0x0eda('0x2c')]['create'](_0x4c0144);})[_0x0eda('0x3b')](function(_0x304dcd){logger['info']('[%s][AUTOREPLY]\x20%s',_0x755ffd,JSON['stringify'](_0x304dcd));})['catch'](function(_0x37b3b7){logger[_0x0eda('0x3c')](_0x0eda('0x3d'),_0x755ffd,JSON[_0x0eda('0x3e')](_0x37b3b7));})[_0x0eda('0x3f')](function(){Promise['resolve']()[_0x0eda('0x3b')](function(){if(_0xffbc22[0x0]!=='2'||_0xa06b14['autoreplyExecuted'])return;return rpc[_0x526e2e+_0x0eda('0x40')]['update'](_0xa06b14['id'],{'autoreplyExecuted':!![]})[_0x0eda('0x3b')](function(_0x5afa06){logger['info'](_0x0eda('0x41'),_0x755ffd,JSON[_0x0eda('0x3e')](_0x5afa06));})[_0x0eda('0x42')](function(_0x5d1cda){logger[_0x0eda('0x3c')](_0x0eda('0x43'),_0x755ffd,JSON[_0x0eda('0x3e')](_0x5d1cda));});})['then'](function(){_0x5d5c1c[_0x0eda('0x12')]();});});}else{return rpc[this[_0x0eda('0xd')]+'Message']['create'](_0x4c0144)[_0x0eda('0x3b')](function(){logger[_0x0eda('0x16')](_0x0eda('0x17'),_0x755ffd,_0x4c0144[_0x0eda('0xf')]);})['catch'](function(_0x14321b){logger[_0x0eda('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x755ffd,JSON[_0x0eda('0x3e')](_0x14321b));})[_0x0eda('0x3f')](function(){Promise[_0x0eda('0x44')]()[_0x0eda('0x3b')](function(){if(_0xffbc22[0x0]!=='2'||_0xa06b14[_0x0eda('0x19')])return;return rpc[_0x526e2e+'Interaction'][_0x0eda('0x45')](_0xa06b14['id'],{'autoreplyExecuted':!![]})[_0x0eda('0x3b')](function(_0x17a7c6){logger[_0x0eda('0x16')](_0x0eda('0x41'),_0x755ffd,JSON[_0x0eda('0x3e')](_0x17a7c6));})[_0x0eda('0x42')](function(_0x39b720){logger[_0x0eda('0x3c')](_0x0eda('0x43'),_0x755ffd,JSON['stringify'](_0x39b720));});})[_0x0eda('0x3b')](function(){_0x5d5c1c[_0x0eda('0x12')]();});});}}}catch(_0x167089){logger[_0x0eda('0x3c')](_0x0eda('0x17'),_0x755ffd,JSON[_0x0eda('0x3e')](_0x167089));_0x5d5c1c[_0x0eda('0x46')]();}};}; \ No newline at end of file +var _0x1ba4=['','headers','All','smtpOptions','then','Message','create','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','resolve','autoreplyExecuted','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','stop','moment','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','inReplyTo','messageId','replace'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x1ba4,0x1b8));var _0x41ba=function(_0x259301,_0x497973){_0x259301=_0x259301-0x0;var _0x37633a=_0x1ba4[_0x259301];return _0x37633a;};'use strict';var _=require('lodash');var moment=require(_0x41ba('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x41ba('0x1'));var rpc={'chatMessage':require(_0x41ba('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x41ba('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x41ba('0x4')),'whatsappMessage':require(_0x41ba('0x5')),'chatInteraction':require(_0x41ba('0x6')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x41ba('0x7')),'smsInteraction':require(_0x41ba('0x8')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x41ba('0x9'))};var mailRpc=require(_0x41ba('0xa'));exports['consequence']=function(_0x109ac1,_0x2bb19e,_0x402e77,_0x472a20){return function(_0x3f34c7){try{var _0xff865d=this[_0x41ba('0xb')];if(_0xff865d==='mail'&&_0x472a20[_0x41ba('0xc')][_0x41ba('0xd')]){logger[_0x41ba('0xe')]('[%s][AUTOREPLY]\x20%s',_0x109ac1,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x3f34c7[_0x41ba('0xf')]();}if(_0x2bb19e[0x0]==='1'&&(_[_0x41ba('0x10')](this[_0x41ba('0x11')]['created'])||!this[_0x41ba('0x11')][_0x41ba('0x12')])){logger[_0x41ba('0xe')](_0x41ba('0x13'),_0x109ac1,'Autoreply\x20already\x20sent');return _0x3f34c7[_0x41ba('0xf')]();}if(_0x2bb19e[0x0]==='2'&&this[_0x41ba('0x11')]['autoreplyExecuted']){logger[_0x41ba('0xe')](_0x41ba('0x14'),_0x109ac1,_0x41ba('0x15'));return _0x3f34c7[_0x41ba('0xf')]();}var _0x159e3b={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x41ba('0x16')),'direction':_0x41ba('0x17')};if(this[_0x41ba('0xb')]===_0x41ba('0x18')){_0x159e3b[_0x41ba('0xc')]=utils[_0x41ba('0x19')](_0x2bb19e[0x2],this);}else{_0x159e3b[_0x41ba('0xc')]=utils[_0x41ba('0x19')](_0x2bb19e[0x1],this);}if(this[_0x41ba('0x1a')]){_0x159e3b['to']=this[_0x41ba('0x1a')][_0x41ba('0x1b')]||'';if(this[_0x41ba('0xb')]===_0x41ba('0x18')&&_0x2bb19e[0x1]==='1'){_0x159e3b['cc']=this['message']['cc']||'';}_0x159e3b[_0x41ba('0x1b')]=this[_0x41ba('0x1a')]['to']||'';_0x159e3b['phone']=this['message'][_0x41ba('0x1c')]||'';_0x159e3b[_0x41ba('0x1d')]=!![];if(this['message'][_0x41ba('0x1e')]){_0x159e3b[_0x41ba('0x1e')]='';_0x159e3b[_0x41ba('0x1e')]+=_['startsWith'](this[_0x41ba('0x1a')]['subject'],'Re:')?'':_0x41ba('0x1f');_0x159e3b['subject']+=this[_0x41ba('0x1a')][_0x41ba('0x1e')];}}if(this['channel']===_0x41ba('0x20')){_0x159e3b[_0x41ba('0x21')]=this[_0x41ba('0x22')]['id'];}else{_0x159e3b[_[_0x41ba('0x23')](this['channel'])+_0x41ba('0x24')]=this[_0x41ba('0x22')]['id'];}_0x159e3b[_[_0x41ba('0x23')](this[_0x41ba('0xb')])+'InteractionId']=this['interaction']['id'];var _0x378da3=this[_0x41ba('0x11')];if(rpc[this[_0x41ba('0xb')]+'Message']){if(this[_0x41ba('0xb')]==='mail'){_0x159e3b[_0x41ba('0x25')]=this[_0x41ba('0x1a')][_0x41ba('0x26')];_0x159e3b['html']=''+_[_0x41ba('0x27')](_0x159e3b[_0x41ba('0xc')],_0x41ba('0x28'),_0x41ba('0x29'))+_0x41ba('0x2a');_0x159e3b[_0x41ba('0x2b')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x41ba('0x2c'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x41ba('0x22')][_0x41ba('0x2d')],_0x159e3b)[_0x41ba('0x2e')](function(_0x40cdc0){logger[_0x41ba('0xe')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x109ac1);_0x159e3b[_0x41ba('0x26')]=_0x40cdc0[_0x41ba('0x1a')][_0x41ba('0x26')];return rpc[_0xff865d+_0x41ba('0x2f')][_0x41ba('0x30')](_0x159e3b);})[_0x41ba('0x2e')](function(_0x47e11b){logger[_0x41ba('0xe')](_0x41ba('0x13'),_0x109ac1,JSON['stringify'](_0x47e11b));})[_0x41ba('0x31')](function(_0x345213){logger['error'](_0x41ba('0x32'),_0x109ac1,JSON[_0x41ba('0x33')](_0x345213));})['finally'](function(){Promise[_0x41ba('0x34')]()['then'](function(){if(_0x2bb19e[0x0]!=='2'||_0x378da3[_0x41ba('0x35')])return;return rpc[_0xff865d+_0x41ba('0x36')][_0x41ba('0x37')](_0x378da3['id'],{'autoreplyExecuted':!![]})[_0x41ba('0x2e')](function(_0x26d458){logger[_0x41ba('0xe')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x109ac1,JSON[_0x41ba('0x33')](_0x26d458));})[_0x41ba('0x31')](function(_0x10c7d4){logger[_0x41ba('0x38')](_0x41ba('0x39'),_0x109ac1,JSON[_0x41ba('0x33')](_0x10c7d4));});})[_0x41ba('0x2e')](function(){_0x3f34c7[_0x41ba('0xf')]();});});}else{return rpc[this[_0x41ba('0xb')]+_0x41ba('0x2f')][_0x41ba('0x30')](_0x159e3b)[_0x41ba('0x2e')](function(){logger[_0x41ba('0xe')](_0x41ba('0x13'),_0x109ac1,_0x159e3b[_0x41ba('0xc')]);})[_0x41ba('0x31')](function(_0x13591d){logger[_0x41ba('0x38')](_0x41ba('0x13'),_0x109ac1,JSON[_0x41ba('0x33')](_0x13591d));})[_0x41ba('0x3a')](function(){Promise[_0x41ba('0x34')]()['then'](function(){if(_0x2bb19e[0x0]!=='2'||_0x378da3[_0x41ba('0x35')])return;return rpc[_0xff865d+_0x41ba('0x36')]['update'](_0x378da3['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4111da){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x109ac1,JSON[_0x41ba('0x33')](_0x4111da));})['catch'](function(_0x12dfc1){logger[_0x41ba('0x38')](_0x41ba('0x39'),_0x109ac1,JSON[_0x41ba('0x33')](_0x12dfc1));});})[_0x41ba('0x2e')](function(){_0x3f34c7[_0x41ba('0xf')]();});});}}}catch(_0x346b5d){logger['error'](_0x41ba('0x13'),_0x109ac1,JSON[_0x41ba('0x33')](_0x346b5d));_0x3f34c7[_0x41ba('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index cc1a75c..ecbfa95 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 _0xf3b1=['channel','Interaction','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system'];(function(_0x886eba,_0x252981){var _0x2794ea=function(_0xe522a9){while(--_0xe522a9){_0x886eba['push'](_0x886eba['shift']());}};_0x2794ea(++_0x252981);}(_0xf3b1,0x1d9));var _0x1f3b=function(_0x3665b1,_0x5daa7c){_0x3665b1=_0x3665b1-0x0;var _0x1e7930=_0xf3b1[_0x3665b1];return _0x1e7930;};'use strict';var moment=require(_0x1f3b('0x0'));var logger=require('../../../../config/logger')(_0x1f3b('0x1'));var rpc={'chatInteraction':require(_0x1f3b('0x2')),'openchannelInteraction':require(_0x1f3b('0x3')),'smsInteraction':require(_0x1f3b('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1f3b('0x5'))};exports['consequence']=function(_0x3f68b3,_0x324d29,_0x5c0421,_0x52d436){return function(_0x194e3b){try{logger[_0x1f3b('0x6')](_0x1f3b('0x7'),_0x3f68b3,_0x324d29[0x0]);var _0x371a87={'closed':0x1,'closedAt':moment()[_0x1f3b('0x8')](_0x1f3b('0x9')),'closeReason':_0x1f3b('0xa'),'disposition':_0x324d29[0x0]};if(rpc[_0x52d436[_0x1f3b('0xb')]+_0x1f3b('0xc')]){rpc[_0x52d436[_0x1f3b('0xb')]+_0x1f3b('0xc')][_0x1f3b('0xd')](_0x52d436['interaction']['id'],_0x371a87)['then'](function(_0x42e6fd){logger[_0x1f3b('0x6')](_0x1f3b('0xe'),_0x3f68b3,_0x52d436[_0x1f3b('0xf')]['id']);})[_0x1f3b('0x10')](function(_0x4d704e){logger[_0x1f3b('0x11')](_0x1f3b('0x12'),_0x3f68b3,JSON['stringify'](_0x4d704e));})[_0x1f3b('0x13')](function(){_0x194e3b[_0x1f3b('0x14')]();});}}catch(_0x417c82){logger[_0x1f3b('0x11')](_0x1f3b('0x12'),_0x3f68b3,JSON[_0x1f3b('0x15')](_0x417c82));_0x194e3b['stop']();}};}; \ No newline at end of file +var _0xe8a8=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stop','[%s][CLOSE]\x20%s','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x28d833,_0x4277bd){var _0x7efd99=function(_0x3d4ad6){while(--_0x3d4ad6){_0x28d833['push'](_0x28d833['shift']());}};_0x7efd99(++_0x4277bd);}(_0xe8a8,0x1c8));var _0x8e8a=function(_0x4514a3,_0x404720){_0x4514a3=_0x4514a3-0x0;var _0x193f68=_0xe8a8[_0x4514a3];return _0x193f68;};'use strict';var moment=require('moment');var logger=require(_0x8e8a('0x0'))(_0x8e8a('0x1'));var rpc={'chatInteraction':require(_0x8e8a('0x2')),'openchannelInteraction':require(_0x8e8a('0x3')),'smsInteraction':require(_0x8e8a('0x4')),'mailInteraction':require(_0x8e8a('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x8e8a('0x6'))};exports[_0x8e8a('0x7')]=function(_0x368d8f,_0x19e9de,_0x5a4334,_0x4a6006){return function(_0x263ab2){try{logger[_0x8e8a('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x368d8f,_0x19e9de[0x0]);var _0x5d97b9={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x8e8a('0x9'),'disposition':_0x19e9de[0x0]};if(rpc[_0x4a6006['channel']+'Interaction']){rpc[_0x4a6006[_0x8e8a('0xa')]+_0x8e8a('0xb')][_0x8e8a('0xc')](_0x4a6006[_0x8e8a('0xd')]['id'],_0x5d97b9)[_0x8e8a('0xe')](function(_0x2231c4){logger['info'](_0x8e8a('0xf'),_0x368d8f,_0x4a6006[_0x8e8a('0xd')]['id']);})[_0x8e8a('0x10')](function(_0xa525cb){logger[_0x8e8a('0x11')]('[%s][CLOSE]\x20%s',_0x368d8f,JSON['stringify'](_0xa525cb));})['finally'](function(){_0x263ab2[_0x8e8a('0x12')]();});}}catch(_0xa4af0){logger[_0x8e8a('0x11')](_0x8e8a('0x13'),_0x368d8f,JSON['stringify'](_0xa4af0));_0x263ab2[_0x8e8a('0x12')]();}};}; \ 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 1bdf845..a651bde 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 _0xdf55=['YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','account','InteractionId','isEmpty','getMustacheRender','Message','create','then','body','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','speech','providerName','providerResponse','result','endConversation','next','catch','lodash','moment','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','format'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0xdf55,0x83));var _0x5df5=function(_0x28ac84,_0x2a75fa){_0x28ac84=_0x28ac84-0x0;var _0x10c42a=_0xdf55[_0x28ac84];return _0x10c42a;};'use strict';var _=require(_0x5df5('0x0'));var moment=require(_0x5df5('0x1'));var apiai=require('apiai-promise');var md5=require(_0x5df5('0x2'));var utils=require(_0x5df5('0x3'));var logger=require('../../../../config/logger')(_0x5df5('0x4'));var rpc={'chatMessage':require(_0x5df5('0x5')),'openchannelMessage':require(_0x5df5('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5df5('0x7')),'faxMessage':require(_0x5df5('0x8')),'whatsappMessage':require(_0x5df5('0x9'))};exports[_0x5df5('0xa')]=function(_0x9b8756,_0x2b7ed9){return function(_0x4722a2){try{if(!_[_0x5df5('0xb')](this['interaction'][_0x5df5('0xc')])){logger[_0x5df5('0xd')](_0x5df5('0xe'),_0x9b8756,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4722a2['next']();}var _0x39711b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5df5('0xf')](_0x5df5('0x10')),'direction':'out'};if(this['channel']===_0x5df5('0x11')||this[_0x5df5('0x12')]===_0x5df5('0x13')){_0x39711b[_0x5df5('0x14')]=this[_0x5df5('0x15')][_0x5df5('0x14')];}var _0x37a747=this[_0x5df5('0x12')];if(_0x37a747===_0x5df5('0x16')){_0x39711b[_0x5df5('0x17')]=this['account']['id'];}else{_0x39711b[_[_0x5df5('0x18')](_0x37a747)+'AccountId']=this[_0x5df5('0x19')]['id'];}_0x39711b[_[_0x5df5('0x18')](_0x37a747)+_0x5df5('0x1a')]=this[_0x5df5('0x15')]['id'];if(this[_0x5df5('0x15')]['created']){var _0x27b3fb=_0x2b7ed9[0x2];if(!_[_0x5df5('0x1b')](_0x27b3fb)){_0x39711b['body']=utils[_0x5df5('0x1c')](_0x27b3fb,this);return rpc[_0x37a747+_0x5df5('0x1d')][_0x5df5('0x1e')](_0x39711b)[_0x5df5('0x1f')](function(_0x215d59){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x9b8756,_0x39711b[_0x5df5('0x20')]);})['catch'](function(_0x58152a){logger[_0x5df5('0x21')](_0x5df5('0xe'),_0x9b8756,JSON[_0x5df5('0x22')](_0x58152a));})[_0x5df5('0x23')](function(){logger['info'](_0x5df5('0x24'),_0x9b8756);_0x4722a2[_0x5df5('0x25')]();});}else{logger[_0x5df5('0xd')](_0x5df5('0x26'),_0x9b8756);_0x4722a2[_0x5df5('0x25')]();}}else{var _0x382999=this;var _0x59ff67=apiai(_0x2b7ed9[0x0],{'language':_0x2b7ed9[0x1]||'en'});return _0x59ff67[_0x5df5('0x27')](this[_0x5df5('0x28')][_0x5df5('0x20')],{'sessionId':md5(this[_0x5df5('0x15')]['id'])})['then'](function(_0x4358ba){_0x382999[_0x5df5('0x20')][_0x5df5('0x29')]=_0x4358ba;_0x39711b['body']=_0x4358ba['result']['fulfillment'][_0x5df5('0x2a')];_0x39711b[_0x5df5('0x2b')]=_0x5df5('0x29');_0x39711b[_0x5df5('0x2c')]=JSON[_0x5df5('0x22')](_0x4358ba);return rpc[_0x37a747+_0x5df5('0x1d')][_0x5df5('0x1e')](_0x39711b)[_0x5df5('0x1f')](function(_0x52fbe3){logger[_0x5df5('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x9b8756,_0x39711b[_0x5df5('0x20')]);if(_0x4358ba[_0x5df5('0x2d')]['metadata'][_0x5df5('0x2e')]){_0x4722a2['next']();}else{_0x4722a2[_0x5df5('0x25')]();}})['catch'](function(_0x2e1885){logger['error'](_0x5df5('0xe'),_0x9b8756,JSON['stringify'](_0x2e1885));_0x4722a2[_0x5df5('0x2f')]();});})[_0x5df5('0x30')](function(_0x4784ca){logger['error'](_0x5df5('0xe'),_0x9b8756,_0x4784ca[_0x5df5('0x28')]);_0x4722a2[_0x5df5('0x2f')]();});}}catch(_0x2d53e5){logger[_0x5df5('0x21')](_0x5df5('0xe'),_0x9b8756,JSON[_0x5df5('0x22')](_0x2d53e5));_0x4722a2['stop']();}};}; \ No newline at end of file +var _0xc319=['fulfillment','speech','providerName','providerResponse','metadata','endConversation','next','error','lodash','moment','apiai-promise','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','upperFirst','InteractionId','created','isEmpty','body','Message','then','catch','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result'];(function(_0x124499,_0x13ee4e){var _0x382b23=function(_0x21047d){while(--_0x21047d){_0x124499['push'](_0x124499['shift']());}};_0x382b23(++_0x13ee4e);}(_0xc319,0x12e));var _0x9c31=function(_0x5e1803,_0x4024cd){_0x5e1803=_0x5e1803-0x0;var _0x521bdb=_0xc319[_0x5e1803];return _0x521bdb;};'use strict';var _=require(_0x9c31('0x0'));var moment=require(_0x9c31('0x1'));var apiai=require(_0x9c31('0x2'));var md5=require('md5');var utils=require(_0x9c31('0x3'));var logger=require(_0x9c31('0x4'))('routing');var rpc={'chatMessage':require(_0x9c31('0x5')),'openchannelMessage':require(_0x9c31('0x6')),'mailMessage':require(_0x9c31('0x7')),'smsMessage':require(_0x9c31('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9c31('0x9'))};exports[_0x9c31('0xa')]=function(_0x348e09,_0x2bdff2){return function(_0x3aa031){try{if(!_[_0x9c31('0xb')](this[_0x9c31('0xc')][_0x9c31('0xd')])){logger[_0x9c31('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x348e09,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3aa031['next']();}var _0x1d8b8b={'ContactId':this[_0x9c31('0xf')]['id'],'sentAt':moment()[_0x9c31('0x10')](_0x9c31('0x11')),'direction':_0x9c31('0x12')};if(this['channel']===_0x9c31('0x13')||this[_0x9c31('0x14')]===_0x9c31('0x15')){_0x1d8b8b['phone']=this[_0x9c31('0xc')][_0x9c31('0x16')];}var _0x16632c=this[_0x9c31('0x14')];if(_0x16632c===_0x9c31('0x17')){_0x1d8b8b['ChatWebsiteId']=this['account']['id'];}else{_0x1d8b8b[_['upperFirst'](_0x16632c)+'AccountId']=this['account']['id'];}_0x1d8b8b[_[_0x9c31('0x18')](_0x16632c)+_0x9c31('0x19')]=this['interaction']['id'];if(this[_0x9c31('0xc')][_0x9c31('0x1a')]){var _0x262d24=_0x2bdff2[0x2];if(!_[_0x9c31('0x1b')](_0x262d24)){_0x1d8b8b[_0x9c31('0x1c')]=utils['getMustacheRender'](_0x262d24,this);return rpc[_0x16632c+_0x9c31('0x1d')]['create'](_0x1d8b8b)[_0x9c31('0x1e')](function(_0x4aacad){logger[_0x9c31('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x348e09,_0x1d8b8b[_0x9c31('0x1c')]);})[_0x9c31('0x1f')](function(_0x2ebafa){logger['error'](_0x9c31('0x20'),_0x348e09,JSON[_0x9c31('0x21')](_0x2ebafa));})[_0x9c31('0x22')](function(){logger['info'](_0x9c31('0x23'),_0x348e09);_0x3aa031[_0x9c31('0x24')]();});}else{logger['info'](_0x9c31('0x25'),_0x348e09);_0x3aa031[_0x9c31('0x24')]();}}else{var _0x316917=this;var _0x9fb534=apiai(_0x2bdff2[0x0],{'language':_0x2bdff2[0x1]||'en'});return _0x9fb534['textRequest'](this[_0x9c31('0x26')][_0x9c31('0x1c')],{'sessionId':md5(this[_0x9c31('0xc')]['id'])})[_0x9c31('0x1e')](function(_0x3cfeba){_0x316917[_0x9c31('0x1c')][_0x9c31('0x27')]=_0x3cfeba;_0x1d8b8b['body']=_0x3cfeba[_0x9c31('0x28')][_0x9c31('0x29')][_0x9c31('0x2a')];_0x1d8b8b[_0x9c31('0x2b')]=_0x9c31('0x27');_0x1d8b8b[_0x9c31('0x2c')]=JSON['stringify'](_0x3cfeba);return rpc[_0x16632c+_0x9c31('0x1d')]['create'](_0x1d8b8b)['then'](function(_0x24325c){logger[_0x9c31('0xe')](_0x9c31('0x20'),_0x348e09,_0x1d8b8b[_0x9c31('0x1c')]);if(_0x3cfeba['result'][_0x9c31('0x2d')][_0x9c31('0x2e')]){_0x3aa031[_0x9c31('0x2f')]();}else{_0x3aa031[_0x9c31('0x24')]();}})[_0x9c31('0x1f')](function(_0x8f7f55){logger[_0x9c31('0x30')]('[%s][DIALOGFLOW]\x20%s',_0x348e09,JSON[_0x9c31('0x21')](_0x8f7f55));_0x3aa031[_0x9c31('0x2f')]();});})[_0x9c31('0x1f')](function(_0x44a8b0){logger[_0x9c31('0x30')](_0x9c31('0x20'),_0x348e09,_0x44a8b0[_0x9c31('0x26')]);_0x3aa031[_0x9c31('0x2f')]();});}}catch(_0x27d442){logger[_0x9c31('0x30')](_0x9c31('0x20'),_0x348e09,JSON[_0x9c31('0x21')](_0x27d442));_0x3aa031[_0x9c31('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 8274b3e..160efdd 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 _0x20e3=['dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','push','fulfillmentText','all','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length'];(function(_0xa9fde0,_0x11953c){var _0x3961c8=function(_0x556508){while(--_0x556508){_0xa9fde0['push'](_0xa9fde0['shift']());}};_0x3961c8(++_0x11953c);}(_0x20e3,0xb3));var _0x320e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x20e3[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x320e('0x0'));var dialogflow=require(_0x320e('0x1'));var md5=require(_0x320e('0x2'));var moment=require(_0x320e('0x3'));var Promise=require(_0x320e('0x4'));var logger=require(_0x320e('0x5'))(_0x320e('0x6'));var utils=require(_0x320e('0x7'));var rpc={'chatMessage':require(_0x320e('0x8')),'openchannelMessage':require(_0x320e('0x9')),'mailMessage':require(_0x320e('0xa')),'smsMessage':require(_0x320e('0xb')),'faxMessage':require(_0x320e('0xc')),'whatsappMessage':require(_0x320e('0xd'))};function createMessage(_0x552e8c,_0x477005,_0x5ef778,_0x12f3a7){return new Promise(function(_0x2db85a,_0x51a31f){var _0x386aec=_[_0x320e('0xe')](_0x5ef778);_0x386aec[_0x320e('0xf')]=_0x12f3a7;return rpc[_0x477005+'Message'][_0x320e('0x10')](_0x386aec)[_0x320e('0x11')](function(){logger[_0x320e('0x12')](_0x320e('0x13'),_0x552e8c,_0x386aec[_0x320e('0xf')]);_0x2db85a();})[_0x320e('0x14')](function(_0x12ed59){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x552e8c,JSON[_0x320e('0x15')](_0x12ed59));_0x51a31f(_0x12ed59);});});}exports[_0x320e('0x16')]=function(_0x4b200b,_0x745b4d){return function(_0x2cd1fd){try{if(!_[_0x320e('0x17')](this[_0x320e('0x18')][_0x320e('0x19')])){logger[_0x320e('0x12')](_0x320e('0x13'),_0x4b200b,_0x320e('0x1a'));return _0x2cd1fd[_0x320e('0x1b')]();}var _0x50f67c={'ContactId':this[_0x320e('0x1c')]['id'],'sentAt':moment()[_0x320e('0x1d')](_0x320e('0x1e')),'direction':'out'};if(this[_0x320e('0x1f')]===_0x320e('0x20')||this[_0x320e('0x1f')]==='whatsapp'){_0x50f67c[_0x320e('0x21')]=this[_0x320e('0x18')]['phone'];}var _0x22ce8b=this[_0x320e('0x1f')];if(_0x22ce8b===_0x320e('0x22')){_0x50f67c[_0x320e('0x23')]=this[_0x320e('0x24')]['id'];}else{_0x50f67c[_[_0x320e('0x25')](_0x22ce8b)+'AccountId']=this[_0x320e('0x24')]['id'];}_0x50f67c[_[_0x320e('0x25')](_0x22ce8b)+_0x320e('0x26')]=this[_0x320e('0x18')]['id'];if(this[_0x320e('0x18')][_0x320e('0x27')]){var _0x2ba2d3=_0x745b4d[0x4];if(!_[_0x320e('0x28')](_0x2ba2d3)){_0x50f67c[_0x320e('0xf')]=utils[_0x320e('0x29')](_0x2ba2d3,this);return rpc[_0x22ce8b+'Message'][_0x320e('0x10')](_0x50f67c)['then'](function(_0x394a4f){logger[_0x320e('0x12')](_0x320e('0x13'),_0x4b200b,_0x50f67c['body']);})[_0x320e('0x14')](function(_0x2699f5){logger[_0x320e('0x2a')](_0x320e('0x13'),_0x4b200b,JSON[_0x320e('0x15')](_0x2699f5));})[_0x320e('0x2b')](function(){logger[_0x320e('0x12')](_0x320e('0x2c'),_0x4b200b);_0x2cd1fd[_0x320e('0x2d')]();});}else{logger[_0x320e('0x12')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4b200b);_0x2cd1fd['stop']();}}else{var _0x174136=this;var _0x342d9b=_0x745b4d[0x2][_0x320e('0x2e')](/\\n/g,'\x0a');var _0x49ae5e={'credentials':{'private_key':_0x342d9b,'client_email':_0x745b4d[0x1]}};var _0x48b6cb=new dialogflow[(_0x320e('0x2f'))](_0x49ae5e);var _0x501453=_0x48b6cb[_0x320e('0x30')](_0x745b4d[0x0],md5(_0x174136['interaction']['id']));var _0x8f121b={'session':_0x501453,'queryInput':{'text':{'text':_0x174136[_0x320e('0x31')]['body'],'languageCode':_0x745b4d[0x3]||'en'}}};return _0x48b6cb[_0x320e('0x32')](_0x8f121b)[_0x320e('0x11')](function(_0x40afb7){if(_0x40afb7&&_0x40afb7[_0x320e('0x33')]){_0x174136[_0x320e('0xf')][_0x320e('0x34')]=_0x40afb7;var _0x3575fa=_0x40afb7[0x0];var _0x535778=_0x3575fa['queryResult']['diagnosticInfo']&&_0x3575fa[_0x320e('0x35')][_0x320e('0x36')][_0x320e('0x37')]?_0x3575fa[_0x320e('0x35')][_0x320e('0x36')][_0x320e('0x37')]['end_conversation'][_0x320e('0x38')]:![];_0x174136[_0x320e('0xf')]['DIALOGFLOWV2_ACTION']=_0x3575fa[_0x320e('0x35')][_0x320e('0x39')];_0x174136[_0x320e('0xf')][_0x320e('0x3a')]=_0x3575fa['queryResult'][_0x320e('0x3b')];_0x174136['body'][_0x320e('0x3c')]=_0x3575fa[_0x320e('0x35')][_0x320e('0x36')]&&_0x3575fa[_0x320e('0x35')][_0x320e('0x36')][_0x320e('0x37')]?_0x3575fa['queryResult']['diagnosticInfo'][_0x320e('0x37')][_0x320e('0x3d')]['boolValue']:![];_0x174136['body'][_0x320e('0x3e')]=_0x3575fa[_0x320e('0x35')]['intent']['name'];_0x174136[_0x320e('0xf')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3575fa['queryResult'][_0x320e('0x3f')][_0x320e('0x40')];_0x174136[_0x320e('0xf')][_0x320e('0x41')]=_0x3575fa['queryResult']['intent'][_0x320e('0x42')];_0x174136[_0x320e('0xf')][_0x320e('0x43')]=_0x3575fa[_0x320e('0x35')][_0x320e('0x44')];_0x174136[_0x320e('0xf')][_0x320e('0x45')]=_0x3575fa[_0x320e('0x35')][_0x320e('0x46')];_0x174136[_0x320e('0xf')][_0x320e('0x47')]=_0x3575fa[_0x320e('0x35')][_0x320e('0x48')];_0x50f67c['providerName']='dialogflowV2';_0x50f67c['providerResponse']=JSON['stringify'](_0x40afb7);var _0x157659=[];for(var _0x54121d=0x0;_0x54121d<_0x40afb7[_0x320e('0x33')];_0x54121d++){var _0x39e358=_0x40afb7[_0x54121d];if(_0x39e358&&_0x39e358[_0x320e('0x35')]&&_0x39e358[_0x320e('0x35')]['fulfillmentText']){_0x157659[_0x320e('0x49')](createMessage(_0x4b200b,_0x22ce8b,_0x50f67c,_0x39e358[_0x320e('0x35')][_0x320e('0x4a')]));}}return Promise[_0x320e('0x4b')](_0x157659)[_0x320e('0x11')](function(){if(_0x535778){_0x2cd1fd[_0x320e('0x1b')]();}else{_0x2cd1fd[_0x320e('0x2d')]();}})[_0x320e('0x14')](function(_0x3b9d8b){logger[_0x320e('0x2a')](_0x320e('0x13'),_0x4b200b,JSON[_0x320e('0x15')](_0x3b9d8b));_0x2cd1fd[_0x320e('0x1b')]();});}})[_0x320e('0x14')](function(_0x254bef){logger[_0x320e('0x2a')](_0x320e('0x13'),_0x4b200b,_0x254bef[_0x320e('0x31')],_0x254bef[_0x320e('0x4c')]);_0x2cd1fd[_0x320e('0x1b')]();});}}catch(_0xff0b3b){logger[_0x320e('0x2a')](_0x320e('0x13'),_0x4b200b,JSON[_0x320e('0x15')](_0xff0b3b));_0x2cd1fd[_0x320e('0x2d')]();}};}; \ No newline at end of file +var _0xf740=['catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','interaction','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_QUERYTEXT','queryText','fulfillmentText','push','all','dialogflow','md5','moment','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','create','then','info'];(function(_0xda4cb,_0x375515){var _0x3f7b00=function(_0x10131c){while(--_0x10131c){_0xda4cb['push'](_0xda4cb['shift']());}};_0x3f7b00(++_0x375515);}(_0xf740,0x1dc));var _0x0f74=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0xf740[_0x4cf8d4];return _0x2c1beb;};'use strict';var _=require('lodash');var dialogflow=require(_0x0f74('0x0'));var md5=require(_0x0f74('0x1'));var moment=require(_0x0f74('0x2'));var Promise=require('bluebird');var logger=require(_0x0f74('0x3'))('routing');var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x0f74('0x4')),'mailMessage':require(_0x0f74('0x5')),'smsMessage':require(_0x0f74('0x6')),'faxMessage':require(_0x0f74('0x7')),'whatsappMessage':require(_0x0f74('0x8'))};function createMessage(_0x53d80a,_0x1cfa5e,_0x4edf8c,_0x54dabf){return new Promise(function(_0x379fc4,_0x3dbf68){var _0x2eece3=_['clone'](_0x4edf8c);_0x2eece3['body']=_0x54dabf;return rpc[_0x1cfa5e+'Message'][_0x0f74('0x9')](_0x2eece3)[_0x0f74('0xa')](function(){logger[_0x0f74('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x53d80a,_0x2eece3['body']);_0x379fc4();})[_0x0f74('0xc')](function(_0x85863a){logger[_0x0f74('0xd')](_0x0f74('0xe'),_0x53d80a,JSON[_0x0f74('0xf')](_0x85863a));_0x3dbf68(_0x85863a);});});}exports['consequence']=function(_0xa9dfb0,_0x33b64a){return function(_0x1cd2b5){try{if(!_['isNil'](this[_0x0f74('0x10')]['UserId'])){logger[_0x0f74('0xb')](_0x0f74('0xe'),_0xa9dfb0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1cd2b5[_0x0f74('0x11')]();}var _0x93ff8c={'ContactId':this['contact']['id'],'sentAt':moment()[_0x0f74('0x12')](_0x0f74('0x13')),'direction':'out'};if(this['channel']==='sms'||this[_0x0f74('0x14')]===_0x0f74('0x15')){_0x93ff8c['phone']=this[_0x0f74('0x10')][_0x0f74('0x16')];}var _0x4d7cc8=this[_0x0f74('0x14')];if(_0x4d7cc8===_0x0f74('0x17')){_0x93ff8c['ChatWebsiteId']=this[_0x0f74('0x18')]['id'];}else{_0x93ff8c[_['upperFirst'](_0x4d7cc8)+'AccountId']=this[_0x0f74('0x18')]['id'];}_0x93ff8c[_[_0x0f74('0x19')](_0x4d7cc8)+_0x0f74('0x1a')]=this[_0x0f74('0x10')]['id'];if(this[_0x0f74('0x10')][_0x0f74('0x1b')]){var _0x4f3331=_0x33b64a[0x4];if(!_[_0x0f74('0x1c')](_0x4f3331)){_0x93ff8c[_0x0f74('0x1d')]=utils[_0x0f74('0x1e')](_0x4f3331,this);return rpc[_0x4d7cc8+_0x0f74('0x1f')][_0x0f74('0x9')](_0x93ff8c)['then'](function(_0x230548){logger['info'](_0x0f74('0xe'),_0xa9dfb0,_0x93ff8c['body']);})[_0x0f74('0xc')](function(_0x54139b){logger[_0x0f74('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0xa9dfb0,JSON[_0x0f74('0xf')](_0x54139b));})[_0x0f74('0x20')](function(){logger['info'](_0x0f74('0x21'),_0xa9dfb0);_0x1cd2b5[_0x0f74('0x22')]();});}else{logger[_0x0f74('0xb')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xa9dfb0);_0x1cd2b5[_0x0f74('0x22')]();}}else{var _0x3f70a5=this;var _0x1bec0c=_0x33b64a[0x2][_0x0f74('0x23')](/\\n/g,'\x0a');var _0x1eeddf={'credentials':{'private_key':_0x1bec0c,'client_email':_0x33b64a[0x1]}};var _0xfc4107=new dialogflow[(_0x0f74('0x24'))](_0x1eeddf);var _0x237b64=_0xfc4107[_0x0f74('0x25')](_0x33b64a[0x0],md5(_0x3f70a5[_0x0f74('0x10')]['id']));var _0x2f1297={'session':_0x237b64,'queryInput':{'text':{'text':_0x3f70a5[_0x0f74('0x26')][_0x0f74('0x1d')],'languageCode':_0x33b64a[0x3]||'en'}}};return _0xfc4107[_0x0f74('0x27')](_0x2f1297)['then'](function(_0x44e346){if(_0x44e346&&_0x44e346[_0x0f74('0x28')]){_0x3f70a5[_0x0f74('0x1d')][_0x0f74('0x29')]=_0x44e346;var _0x56c8a1=_0x44e346[0x0];var _0x3de470=_0x56c8a1[_0x0f74('0x2a')][_0x0f74('0x2b')]&&_0x56c8a1[_0x0f74('0x2a')][_0x0f74('0x2b')][_0x0f74('0x2c')]?_0x56c8a1[_0x0f74('0x2a')][_0x0f74('0x2b')][_0x0f74('0x2c')][_0x0f74('0x2d')]['boolValue']:![];_0x3f70a5[_0x0f74('0x1d')][_0x0f74('0x2e')]=_0x56c8a1[_0x0f74('0x2a')]['action'];_0x3f70a5[_0x0f74('0x1d')][_0x0f74('0x2f')]=_0x56c8a1[_0x0f74('0x2a')][_0x0f74('0x30')];_0x3f70a5[_0x0f74('0x1d')][_0x0f74('0x31')]=_0x56c8a1[_0x0f74('0x2a')]['diagnosticInfo']&&_0x56c8a1[_0x0f74('0x2a')][_0x0f74('0x2b')]['fields']?_0x56c8a1[_0x0f74('0x2a')]['diagnosticInfo'][_0x0f74('0x2c')]['end_conversation'][_0x0f74('0x32')]:![];_0x3f70a5[_0x0f74('0x1d')]['DIALOGFLOWV2_INTENTNAME']=_0x56c8a1[_0x0f74('0x2a')][_0x0f74('0x33')][_0x0f74('0x34')];_0x3f70a5[_0x0f74('0x1d')][_0x0f74('0x35')]=_0x56c8a1['queryResult'][_0x0f74('0x33')][_0x0f74('0x36')];_0x3f70a5[_0x0f74('0x1d')][_0x0f74('0x37')]=_0x56c8a1[_0x0f74('0x2a')][_0x0f74('0x33')]['isFallback'];_0x3f70a5['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x56c8a1[_0x0f74('0x2a')]['languageCode'];_0x3f70a5[_0x0f74('0x1d')][_0x0f74('0x38')]=_0x56c8a1[_0x0f74('0x2a')][_0x0f74('0x39')];_0x3f70a5[_0x0f74('0x1d')]['DIALOGFLOWV2_SCORE']=_0x56c8a1[_0x0f74('0x2a')]['intentDetectionConfidence'];_0x93ff8c['providerName']=_0x0f74('0x29');_0x93ff8c['providerResponse']=JSON[_0x0f74('0xf')](_0x44e346);var _0x59966d=[];for(var _0x1d3749=0x0;_0x1d3749<_0x44e346['length'];_0x1d3749++){var _0x4e8905=_0x44e346[_0x1d3749];if(_0x4e8905&&_0x4e8905[_0x0f74('0x2a')]&&_0x4e8905['queryResult'][_0x0f74('0x3a')]){_0x59966d[_0x0f74('0x3b')](createMessage(_0xa9dfb0,_0x4d7cc8,_0x93ff8c,_0x4e8905['queryResult'][_0x0f74('0x3a')]));}}return Promise[_0x0f74('0x3c')](_0x59966d)[_0x0f74('0xa')](function(){if(_0x3de470){_0x1cd2b5[_0x0f74('0x11')]();}else{_0x1cd2b5[_0x0f74('0x22')]();}})[_0x0f74('0xc')](function(_0xbb3680){logger[_0x0f74('0xd')](_0x0f74('0xe'),_0xa9dfb0,JSON[_0x0f74('0xf')](_0xbb3680));_0x1cd2b5[_0x0f74('0x11')]();});}})[_0x0f74('0xc')](function(_0x16d06c){logger[_0x0f74('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0xa9dfb0,_0x16d06c[_0x0f74('0x26')],_0x16d06c['stack']);_0x1cd2b5[_0x0f74('0x11')]();});}}catch(_0x40372b){logger[_0x0f74('0xd')](_0x0f74('0xe'),_0xa9dfb0,JSON[_0x0f74('0xf')](_0x40372b));_0x1cd2b5[_0x0f74('0x22')]();}};}; \ 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 c5b8c9c..6156b0c 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 _0xc1c2=['lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xc1c2,0x10e));var _0x2c1c=function(_0x1ec037,_0x47cc6a){_0x1ec037=_0x1ec037-0x0;var _0x4779fc=_0xc1c2[_0x1ec037];return _0x4779fc;};'use strict';var schema=require('validate');var _=require(_0x2c1c('0x0'));var htmlToText=require(_0x2c1c('0x1'));var utils=require('./utils');var logger=require(_0x2c1c('0x2'))(_0x2c1c('0x3'));var gotoif=schema({'condition':{'type':_0x2c1c('0x4'),'required':!![],'message':_0x2c1c('0x5')},'priorityTrue':{'type':_0x2c1c('0x6'),'message':_0x2c1c('0x7')},'priorityFalse':{'type':_0x2c1c('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x2c1c('0x8')]=function(_0x12f8e9,_0x2f2e5c){return function(_0x118756){try{var _0x4d7b62={'condition':htmlToText[_0x2c1c('0x9')](utils[_0x2c1c('0xa')](_0x2f2e5c[0x0],this),{'wordwrap':![]})[_0x2c1c('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2f2e5c[0x1],'priorityFalse':_0x2f2e5c[0x2]};var _0x27f2a5=gotoif[_0x2c1c('0xc')](_0x4d7b62,{'typecast':!![]});if(_0x27f2a5['length']){logger[_0x2c1c('0xd')](_0x2c1c('0xe'),_0x12f8e9,_[_0x2c1c('0xf')](_0x27f2a5,_0x2c1c('0x10'))[_0x2c1c('0x11')](',\x20'));_0x118756['stop']();}else{try{var _0x430e5c=eval('('+_0x4d7b62[_0x2c1c('0x12')]+')');var _0x49ed0b=_0x430e5c?_0x4d7b62['priorityTrue']:_0x4d7b62[_0x2c1c('0x13')];logger[_0x2c1c('0x14')](_0x2c1c('0x15'),_0x12f8e9,_0x4d7b62[_0x2c1c('0x12')],_0x430e5c,_0x49ed0b||_0x2c1c('0x16'));if(_0x49ed0b){var _0x5a5dc0=_[_0x2c1c('0x17')](_0x118756[_0x2c1c('0x18')](),{'p':_0x49ed0b});if(_0x5a5dc0>=0x0){logger['info'](_0x2c1c('0x19'),_0x12f8e9,_0x49ed0b||_0x2c1c('0x16'),_0x5a5dc0);_0x118756[_0x2c1c('0x16')](_0x5a5dc0);}else{logger[_0x2c1c('0x14')](_0x2c1c('0x1a'),_0x12f8e9,_0x49ed0b||'next');_0x118756[_0x2c1c('0x1b')]();}}else{_0x118756[_0x2c1c('0x16')]();}}catch(_0x184494){logger[_0x2c1c('0xd')](_0x2c1c('0x1c'),_0x12f8e9,_0x184494[_0x2c1c('0x10')]);_0x118756['stop']();}}}catch(_0x473a51){logger[_0x2c1c('0xd')](_0x2c1c('0xe'),_0x12f8e9,JSON[_0x2c1c('0x1d')](_0x473a51));_0x118756[_0x2c1c('0x1b')]();}};}; \ No newline at end of file +var _0x638e=['[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x638e,0x1c1));var _0xe638=function(_0x4fde83,_0x2d9011){_0x4fde83=_0x4fde83-0x0;var _0x3b33e3=_0x638e[_0x4fde83];return _0x3b33e3;};'use strict';var schema=require(_0xe638('0x0'));var _=require(_0xe638('0x1'));var htmlToText=require('html-to-text');var utils=require(_0xe638('0x2'));var logger=require(_0xe638('0x3'))(_0xe638('0x4'));var gotoif=schema({'condition':{'type':_0xe638('0x5'),'required':!![],'message':_0xe638('0x6')},'priorityTrue':{'type':_0xe638('0x7'),'message':_0xe638('0x8')},'priorityFalse':{'type':_0xe638('0x7'),'message':_0xe638('0x9')}});exports[_0xe638('0xa')]=function(_0x1d4539,_0x32fb0c){return function(_0x5bbc00){try{var _0x341e31={'condition':htmlToText[_0xe638('0xb')](utils['getMustacheRender'](_0x32fb0c[0x0],this),{'wordwrap':![]})[_0xe638('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x32fb0c[0x1],'priorityFalse':_0x32fb0c[0x2]};var _0x4176e0=gotoif[_0xe638('0x0')](_0x341e31,{'typecast':!![]});if(_0x4176e0[_0xe638('0xd')]){logger[_0xe638('0xe')](_0xe638('0xf'),_0x1d4539,_['map'](_0x4176e0,_0xe638('0x10'))[_0xe638('0x11')](',\x20'));_0x5bbc00[_0xe638('0x12')]();}else{try{var _0x491402=eval('('+_0x341e31[_0xe638('0x13')]+')');var _0x1cfcfa=_0x491402?_0x341e31['priorityTrue']:_0x341e31[_0xe638('0x14')];logger[_0xe638('0x15')](_0xe638('0x16'),_0x1d4539,_0x341e31[_0xe638('0x13')],_0x491402,_0x1cfcfa||'next');if(_0x1cfcfa){var _0x53ffde=_[_0xe638('0x17')](_0x5bbc00[_0xe638('0x18')](),{'p':_0x1cfcfa});if(_0x53ffde>=0x0){logger[_0xe638('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1d4539,_0x1cfcfa||_0xe638('0x19'),_0x53ffde);_0x5bbc00[_0xe638('0x19')](_0x53ffde);}else{logger[_0xe638('0x15')](_0xe638('0x1a'),_0x1d4539,_0x1cfcfa||'next');_0x5bbc00[_0xe638('0x12')]();}}else{_0x5bbc00[_0xe638('0x19')]();}}catch(_0x4e2bf5){logger[_0xe638('0xe')](_0xe638('0x1b'),_0x1d4539,_0x4e2bf5['message']);_0x5bbc00[_0xe638('0x12')]();}}}catch(_0xc49b7f){logger[_0xe638('0xe')](_0xe638('0xf'),_0x1d4539,JSON[_0xe638('0x1c')](_0xc49b7f));_0x5bbc00[_0xe638('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index d07e827..4cb984a 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 _0x7f6f=['consequence','length','error','[%s][GOTOP]\x20%s','map','join','info','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','priority','next','stop','stringify','lodash','../../../../config/logger','routing','number'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7f6f,0x10c));var _0xf7f6=function(_0x5c060d,_0x4195dc){_0x5c060d=_0x5c060d-0x0;var _0x217e6b=_0x7f6f[_0x5c060d];return _0x217e6b;};'use strict';var schema=require('validate');var _=require(_0xf7f6('0x0'));var logger=require(_0xf7f6('0x1'))(_0xf7f6('0x2'));var gotop=schema({'priority':{'type':_0xf7f6('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xf7f6('0x4')]=function(_0x267757,_0x32ae26){return function(_0x37aa13){try{var _0x49567e={'priority':_0x32ae26[0x0]};var _0x35b88a=gotop['validate'](_0x49567e,{'typecast':!![]});if(_0x35b88a[_0xf7f6('0x5')]){logger[_0xf7f6('0x6')](_0xf7f6('0x7'),_0x267757,_[_0xf7f6('0x8')](_0x35b88a,'message')[_0xf7f6('0x9')](',\x20'));_0x37aa13['stop']();}else{logger[_0xf7f6('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x267757,_0x49567e['priority']);if(_0x49567e['priority']){var _0x373ab8=_['findIndex'](_0x37aa13[_0xf7f6('0xb')](),{'p':_0x49567e['priority']});if(_0x373ab8>=0x0){logger[_0xf7f6('0xa')](_0xf7f6('0xc'),_0x267757,_0x49567e[_0xf7f6('0xd')]||_0xf7f6('0xe'),_0x373ab8);_0x37aa13[_0xf7f6('0xe')](_0x373ab8);}else{logger[_0xf7f6('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x267757,_0x49567e[_0xf7f6('0xd')]||'next');_0x37aa13[_0xf7f6('0xf')]();}}else{_0x37aa13[_0xf7f6('0xe')]();}}}catch(_0x4c09a4){logger['error'](_0xf7f6('0x7'),_0x267757,JSON[_0xf7f6('0x10')](_0x4c09a4));_0x37aa13[_0xf7f6('0xf')]();}};}; \ No newline at end of file +var _0x8c0a=['rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x8c0a,0x118));var _0xa8c0=function(_0x43a3dc,_0x2eb8eb){_0x43a3dc=_0x43a3dc-0x0;var _0x2b804d=_0x8c0a[_0x43a3dc];return _0x2b804d;};'use strict';var schema=require(_0xa8c0('0x0'));var _=require(_0xa8c0('0x1'));var logger=require(_0xa8c0('0x2'))('routing');var gotop=schema({'priority':{'type':_0xa8c0('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xa8c0('0x4')]=function(_0x3dd4b1,_0xd43540){return function(_0x456864){try{var _0x4a4225={'priority':_0xd43540[0x0]};var _0x50498a=gotop[_0xa8c0('0x0')](_0x4a4225,{'typecast':!![]});if(_0x50498a[_0xa8c0('0x5')]){logger[_0xa8c0('0x6')](_0xa8c0('0x7'),_0x3dd4b1,_[_0xa8c0('0x8')](_0x50498a,_0xa8c0('0x9'))[_0xa8c0('0xa')](',\x20'));_0x456864['stop']();}else{logger['info'](_0xa8c0('0xb'),_0x3dd4b1,_0x4a4225[_0xa8c0('0xc')]);if(_0x4a4225[_0xa8c0('0xc')]){var _0x3e4e48=_[_0xa8c0('0xd')](_0x456864[_0xa8c0('0xe')](),{'p':_0x4a4225[_0xa8c0('0xc')]});if(_0x3e4e48>=0x0){logger[_0xa8c0('0xf')](_0xa8c0('0x10'),_0x3dd4b1,_0x4a4225[_0xa8c0('0xc')]||_0xa8c0('0x11'),_0x3e4e48);_0x456864[_0xa8c0('0x11')](_0x3e4e48);}else{logger[_0xa8c0('0xf')](_0xa8c0('0x12'),_0x3dd4b1,_0x4a4225[_0xa8c0('0xc')]||_0xa8c0('0x11'));_0x456864[_0xa8c0('0x13')]();}}else{_0x456864['next']();}}}catch(_0x259f02){logger[_0xa8c0('0x6')](_0xa8c0('0x7'),_0x3dd4b1,JSON[_0xa8c0('0x14')](_0x259f02));_0x456864['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index d80faa7..00cdedd 100644 --- a/server/services/routing/server/applications/message.js +++ b/server/services/routing/server/applications/message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5795=['Message','then','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account','AccountId','upperFirst','interaction'];(function(_0x39dd10,_0x134622){var _0x35bd8a=function(_0x156710){while(--_0x156710){_0x39dd10['push'](_0x39dd10['shift']());}};_0x35bd8a(++_0x134622);}(_0x5795,0xd1));var _0x5579=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5795[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5579('0x0'));var utils=require(_0x5579('0x1'));var logger=require(_0x5579('0x2'))(_0x5579('0x3'));var rpc={'chatMessage':require(_0x5579('0x4')),'openchannelMessage':require(_0x5579('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5579('0x6'))};exports[_0x5579('0x7')]=function(_0x57e45d,_0x3aaa1c){return function(_0x1e02f3){try{var _0x3eee07={'body':utils[_0x5579('0x8')](_0x3aaa1c[0x0],this),'ContactId':this[_0x5579('0x9')]['id']};if(this[_0x5579('0xa')]==='chat'){_0x3eee07[_0x5579('0xb')]=this[_0x5579('0xc')]['id'];}else{_0x3eee07[_['upperFirst'](this['channel'])+_0x5579('0xd')]=this[_0x5579('0xc')]['id'];}_0x3eee07[_[_0x5579('0xe')](this[_0x5579('0xa')])+'InteractionId']=this[_0x5579('0xf')]['id'];if(rpc[this['channel']+_0x5579('0x10')]){return rpc[this[_0x5579('0xa')]+_0x5579('0x10')]['create'](_0x3eee07)[_0x5579('0x11')](function(_0x255e30){logger['info']('[%s][MESSAGE]\x20%s',_0x57e45d,_0x3eee07[_0x5579('0x12')]);_0x1e02f3[_0x5579('0x13')]();})[_0x5579('0x14')](function(_0x3fe5e3){logger[_0x5579('0x15')](_0x5579('0x16'),_0x57e45d,JSON[_0x5579('0x17')](_0x3fe5e3));_0x1e02f3[_0x5579('0x18')]();});}}catch(_0x406bf9){logger[_0x5579('0x15')](_0x5579('0x16'),_0x57e45d,JSON[_0x5579('0x17')](_0x406bf9));_0x1e02f3[_0x5579('0x18')]();}};}; \ No newline at end of file +var _0xab23=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stop','stringify','lodash','./utils','../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab23,0x1bc));var _0x3ab2=function(_0x47dfd5,_0x56fc43){_0x47dfd5=_0x47dfd5-0x0;var _0x3dc00c=_0xab23[_0x47dfd5];return _0x3dc00c;};'use strict';var _=require(_0x3ab2('0x0'));var utils=require(_0x3ab2('0x1'));var logger=require(_0x3ab2('0x2'))(_0x3ab2('0x3'));var rpc={'chatMessage':require(_0x3ab2('0x4')),'openchannelMessage':require(_0x3ab2('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3ab2('0x6')),'faxMessage':require(_0x3ab2('0x7')),'whatsappMessage':require(_0x3ab2('0x8'))};exports[_0x3ab2('0x9')]=function(_0x5cb595,_0x5222ba){return function(_0x3445f2){try{var _0x4e8d92={'body':utils['getMustacheRender'](_0x5222ba[0x0],this),'ContactId':this[_0x3ab2('0xa')]['id']};if(this[_0x3ab2('0xb')]===_0x3ab2('0xc')){_0x4e8d92[_0x3ab2('0xd')]=this[_0x3ab2('0xe')]['id'];}else{_0x4e8d92[_[_0x3ab2('0xf')](this[_0x3ab2('0xb')])+_0x3ab2('0x10')]=this[_0x3ab2('0xe')]['id'];}_0x4e8d92[_[_0x3ab2('0xf')](this[_0x3ab2('0xb')])+'InteractionId']=this[_0x3ab2('0x11')]['id'];if(rpc[this[_0x3ab2('0xb')]+_0x3ab2('0x12')]){return rpc[this['channel']+'Message'][_0x3ab2('0x13')](_0x4e8d92)[_0x3ab2('0x14')](function(_0x1f967a){logger[_0x3ab2('0x15')](_0x3ab2('0x16'),_0x5cb595,_0x4e8d92[_0x3ab2('0x17')]);_0x3445f2[_0x3ab2('0x18')]();})[_0x3ab2('0x19')](function(_0x11d439){logger['error'](_0x3ab2('0x16'),_0x5cb595,JSON['stringify'](_0x11d439));_0x3445f2[_0x3ab2('0x1a')]();});}}catch(_0x458f08){logger['error']('[%s][MESSAGE]\x20%s',_0x5cb595,JSON[_0x3ab2('0x1b')](_0x458f08));_0x3445f2[_0x3ab2('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 749f214..fd9b95a 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 _0x494f=['stop','./utils','../../../../config/logger','routing','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x494f,0xc7));var _0xf494=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x494f[_0x1e381c];return _0x9b5ea9;};'use strict';var utils=require(_0xf494('0x0'));var logger=require(_0xf494('0x1'))(_0xf494('0x2'));exports['consequence']=function(_0x58b96a,_0x39305a){return function(_0x1b2a51){try{logger['info']('[%s][NOOP]\x20%s',_0x58b96a,utils[_0xf494('0x3')](_0x39305a[0x0],this));_0x1b2a51[_0xf494('0x4')]();}catch(_0x268d60){logger[_0xf494('0x5')](_0xf494('0x6'),_0x58b96a,JSON[_0xf494('0x7')](_0x268d60));_0x1b2a51[_0xf494('0x8')]();}};}; \ No newline at end of file +var _0xc888=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','consequence','[%s][NOOP]\x20%s'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0xc888,0x9d));var _0x8c88=function(_0x187e82,_0x5254eb){_0x187e82=_0x187e82-0x0;var _0x58625e=_0xc888[_0x187e82];return _0x58625e;};'use strict';var utils=require('./utils');var logger=require(_0x8c88('0x0'))('routing');exports[_0x8c88('0x1')]=function(_0x10ae16,_0x5edf9a){return function(_0x42fa93){try{logger['info'](_0x8c88('0x2'),_0x10ae16,utils[_0x8c88('0x3')](_0x5edf9a[0x0],this));_0x42fa93[_0x8c88('0x4')]();}catch(_0x4500ca){logger[_0x8c88('0x5')](_0x8c88('0x2'),_0x10ae16,JSON[_0x8c88('0x6')](_0x4500ca));_0x42fa93[_0x8c88('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 85ee9a8..74a2ead 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 _0xee28=['[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','beepall','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue','from','joinAt','emit','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','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','interaction','MessageId','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','error','create\x20queue\x20report','info'];(function(_0x333755,_0x47aadf){var _0x1335ce=function(_0x370044){while(--_0x370044){_0x333755['push'](_0x333755['shift']());}};_0x1335ce(++_0x47aadf);}(_0xee28,0x1c4));var _0x8ee2=function(_0x1056c7,_0x279ac5){_0x1056c7=_0x1056c7-0x0;var _0x4ef73e=_0xee28[_0x1056c7];return _0x4ef73e;};'use strict';var schema=require('validate');var _=require(_0x8ee2('0x0'));var util=require(_0x8ee2('0x1'));var seqqueue=require(_0x8ee2('0x2'));var moment=require(_0x8ee2('0x3'));var Redis=require(_0x8ee2('0x4'));var config=require(_0x8ee2('0x5'));var logger=require('../../../../config/logger')(_0x8ee2('0x6'));var strategy=require(_0x8ee2('0x7'));config[_0x8ee2('0x8')]=_[_0x8ee2('0x9')](config['redis'],{'host':_0x8ee2('0xa'),'port':0x18eb});var io=require(_0x8ee2('0xb'))(new Redis(config[_0x8ee2('0x8')]));var attributes=['id','queue_id','account',_0x8ee2('0xc'),_0x8ee2('0xd'),_0x8ee2('0xe')];function emit(_0x1f02ac,_0x3da7a8,_0xb27770){io['to'](_0x1f02ac)[_0x8ee2('0xf')](_0x3da7a8,_0xb27770);}function emitChannelQueueInteraction(_0x16d383,_0x295584,_0xdbee09,_0x14f752,_0x2e28a6,_0x1d0a75,_0x4fe727,_0x33edad){var _0xffff16=_['clone'](_0xdbee09);_0xffff16['queue_id']=_0x33edad;_0xffff16[_0x8ee2('0xc')]=_0x295584;_0xffff16[_0x8ee2('0x10')]=_0x14f752;_0xffff16['id']=_0x2e28a6;if(_0x1d0a75){attributes[_0x8ee2('0x11')](_[_0x8ee2('0x12')](_0x16d383)+_0x8ee2('0x13'));_0x4fe727[util[_0x8ee2('0x14')](_0x8ee2('0x15'),_0x16d383)][_0x2e28a6]=_['pick'](_0xffff16,attributes);}else{delete _0x4fe727[util[_0x8ee2('0x14')](_0x8ee2('0x15'),_0x16d383)][_0x2e28a6];}emit(util['format']('%s:queue:%s',_0x16d383,_0x295584),util['format'](_0x8ee2('0x16'),_0x16d383,_0x1d0a75?_0x8ee2('0x17'):_0x8ee2('0x18')),_['pick'](_0xffff16,attributes));}var rpc={'openchannelQueueReport':require(_0x8ee2('0x19')),'mailQueueReport':require(_0x8ee2('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x8ee2('0x1b')),'faxQueueReport':require(_0x8ee2('0x1c')),'whatsappQueueReport':require(_0x8ee2('0x1d')),'chatInteraction':require(_0x8ee2('0x1e')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x8ee2('0x1f')),'openchannelInteraction':require(_0x8ee2('0x20')),'smsInteraction':require(_0x8ee2('0x21')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x8ee2('0x22')},'timeout':{'type':_0x8ee2('0x23'),'message':_0x8ee2('0x24')}});function startRouting(_0x52a474,_0x33ec76,_0x1198e9,_0x527aeb){if(_0x52a474&&_0x33ec76&&_0x1198e9){_0x33ec76[_0x8ee2('0x25')]+=0x1;var _0x28c87a={'uniqueid':_0x52a474,'from':_0x1198e9[_0x8ee2('0x26')]?_0x1198e9[_0x8ee2('0x26')][_0x8ee2('0xd')]:'','joinAt':moment()['format'](_0x8ee2('0x27')),'ContactId':_0x1198e9[_0x8ee2('0x28')]?_0x1198e9[_0x8ee2('0x28')]['id']:null,'ListId':_0x1198e9[_0x8ee2('0x29')]?_0x1198e9['list']['id']:null};_0x28c87a[_[_0x8ee2('0x2a')](_0x1198e9[_0x8ee2('0x2b')])+_0x8ee2('0x2c')]=_0x33ec76['id']||null;_0x28c87a[_[_0x8ee2('0x2a')](_0x1198e9['channel'])+_0x8ee2('0x13')]=_0x1198e9[_0x8ee2('0x2d')]?_0x1198e9[_0x8ee2('0x2d')]['id']:null;_0x28c87a[_[_0x8ee2('0x2a')](_0x1198e9[_0x8ee2('0x2b')])+_0x8ee2('0x2e')]=_0x1198e9[_0x8ee2('0x2f')]?_0x1198e9[_0x8ee2('0x2f')]['id']:null;_0x28c87a[_['upperFirst'](_0x1198e9[_0x8ee2('0x2b')])+(_0x1198e9['channel']!==_0x8ee2('0x30')?_0x8ee2('0x31'):_0x8ee2('0x32'))]=_0x1198e9[_0x8ee2('0x10')]?_0x1198e9[_0x8ee2('0x10')]['id']:null;logger['info'](util[_0x8ee2('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x52a474,_0x33ec76[_0x8ee2('0x33')]));emitChannelQueueInteraction(_0x1198e9[_0x8ee2('0x2b')],_0x33ec76[_0x8ee2('0x33')],_0x28c87a,_0x1198e9[_0x8ee2('0x10')][_0x8ee2('0x33')],_0x1198e9[_0x8ee2('0x2f')]['id'],!![],_0x527aeb,_0x33ec76['id']);if(rpc[_0x1198e9[_0x8ee2('0x2b')]+_0x8ee2('0x34')]){return rpc[_0x1198e9[_0x8ee2('0x2b')]+_0x8ee2('0x34')][_0x8ee2('0x35')](_0x28c87a)[_0x8ee2('0x36')](function(_0x3a2772){logger[_0x8ee2('0x37')](_0x8ee2('0x38'),_0x3a2772);});}}}function stopRouting(_0x11df00,_0x53837e,_0x198d15,_0x2a0b0b){if(_0x11df00&&_0x53837e){_0x53837e['waiting']-=0x1;var _0x1e0223={'leaveAt':moment()['format'](_0x8ee2('0x27')),'acceptAt':moment()[_0x8ee2('0x14')](_0x8ee2('0x27')),'reason':'accepted'};logger[_0x8ee2('0x39')](util[_0x8ee2('0x14')](_0x8ee2('0x3a'),_0x11df00,_0x53837e[_0x8ee2('0x33')]));emitChannelQueueInteraction(_0x198d15[_0x8ee2('0x2b')],_0x53837e[_0x8ee2('0x33')],_0x198d15['body'],_0x198d15[_0x8ee2('0x10')]['name'],_0x198d15['message']['id'],![],_0x2a0b0b,_0x53837e['id']);return rpc[_0x198d15[_0x8ee2('0x2b')]+_0x8ee2('0x3b')][_0x8ee2('0x3c')](_0x198d15[_0x8ee2('0x2d')]['id'],{'queueId':_0x53837e['id']})[_0x8ee2('0x3d')](function(){if(rpc[_0x198d15['channel']+_0x8ee2('0x34')]){return rpc[_0x198d15[_0x8ee2('0x2b')]+_0x8ee2('0x34')][_0x8ee2('0x3c')](_0x11df00,_0x1e0223)[_0x8ee2('0x36')](function(_0x391209){logger['error'](_0x8ee2('0x3e'),_0x391209);});}});}}function endRouting(_0x353f9f,_0x1f0202,_0x244e35,_0x1e4aa8){if(_0x353f9f&&_0x1f0202){_0x1f0202['waiting']-=0x1;var _0x1271a4={'leaveAt':moment()[_0x8ee2('0x14')](_0x8ee2('0x27')),'exitAt':moment()[_0x8ee2('0x14')](_0x8ee2('0x27')),'reason':_0x8ee2('0x3f')};logger[_0x8ee2('0x39')](util[_0x8ee2('0x14')](_0x8ee2('0x40'),_0x353f9f,_0x1f0202['name']));emitChannelQueueInteraction(_0x244e35[_0x8ee2('0x2b')],_0x1f0202['name'],_0x244e35['body'],_0x244e35[_0x8ee2('0x10')][_0x8ee2('0x33')],_0x244e35[_0x8ee2('0x2f')]['id'],![],_0x1e4aa8);if(rpc[_0x244e35['channel']+_0x8ee2('0x34')]){return rpc[_0x244e35[_0x8ee2('0x2b')]+_0x8ee2('0x34')]['update'](_0x353f9f,_0x1271a4)[_0x8ee2('0x36')](function(_0x16c656){logger[_0x8ee2('0x37')]('update\x20queue\x20report',_0x16c656);});}}}function handleFindQueue(_0x56eca9){return function(_0x25e3f1){return _0x25e3f1['name'][_0x8ee2('0x41')]()===_0x56eca9[_0x8ee2('0x41')]();};}exports[_0x8ee2('0x42')]=function(_0x3f84b3,_0x4ad625,_0x3d6e23,_0x312dbb){return function(_0x20856f){try{var _0x4dae3f={'name':_0x4ad625[0x0],'timeout':_0x4ad625[0x1]};var _0x2b5398=queue[_0x8ee2('0x43')](_0x4dae3f,{'typecast':!![]});if(_0x2b5398[_0x8ee2('0x44')]){logger[_0x8ee2('0x37')](_0x8ee2('0x45'),_0x3f84b3,_[_0x8ee2('0x46')](_0x2b5398,'message')[_0x8ee2('0x47')](',\x20'));_0x20856f[_0x8ee2('0x48')]();}else{var _0x1aba9d=_[_0x8ee2('0x49')](_0x3d6e23[_0x312dbb[_0x8ee2('0x2b')]+_0x8ee2('0x4a')],handleFindQueue(_0x4dae3f[_0x8ee2('0x33')]));if(_0x1aba9d){startRouting(_0x3f84b3,_0x1aba9d,_0x312dbb,_0x3d6e23);var _0x3dc980=(_0x1aba9d[_0x8ee2('0x3f')]||0xa)*0x3e8;var _0x4a9637=(_0x4dae3f[_0x8ee2('0x3f')]||0x14)*0x3e8;var _0x7aedb4;if(_0x3dc980>_0x4a9637){_0x4a9637=_0x3dc980;}var _0x74d1aa=seqqueue[_0x8ee2('0x4b')](_0x3dc980);_0x74d1aa['id']=_0x3f84b3;_0x74d1aa[_0x8ee2('0x4c')]=_0x3dc980;_0x74d1aa[_0x8ee2('0x4d')]=_0x4a9637;_0x74d1aa[_0x8ee2('0x2b')]=_0x312dbb[_0x8ee2('0x2b')];_0x3d6e23[_0x8ee2('0x4e')][_0x3f84b3]['on'](_0x8ee2('0x4f'),function(){logger[_0x8ee2('0x39')](_0x8ee2('0x50'),_0x3f84b3);stopRouting(_0x3f84b3,_0x1aba9d,_0x312dbb,_0x3d6e23);clearTimeout(_0x7aedb4);_0x7aedb4=undefined;_0x74d1aa[_0x8ee2('0x51')](!![]);if(_0x3d6e23[_0x8ee2('0x4e')][_0x3f84b3]){delete _0x3d6e23[_0x8ee2('0x4e')][_0x3f84b3];}_0x20856f[_0x8ee2('0x48')]();});_0x3d6e23[_0x8ee2('0x4e')][_0x3f84b3]['on'](_0x8ee2('0x52'),function(){if(_0x3d6e23['rules'][_0x3f84b3]){delete _0x3d6e23['rules'][_0x3f84b3];}});_0x7aedb4=setTimeout(function(){logger[_0x8ee2('0x39')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x3f84b3);endRouting(_0x3f84b3,_0x1aba9d,_0x312dbb,_0x3d6e23);clearTimeout(_0x7aedb4);_0x74d1aa[_0x8ee2('0x51')](!![]);_0x20856f['next']();},_0x4a9637);switch(_0x1aba9d['strategy']){case'rrmemory':strategy['rrmemory'](_0x74d1aa,_0x1aba9d,_0x3d6e23,_0x312dbb);break;default:strategy[_0x8ee2('0x53')](_0x74d1aa,_0x1aba9d,_0x3d6e23,_0x312dbb);}}else{logger[_0x8ee2('0x37')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x3f84b3,_0x4dae3f[_0x8ee2('0x33')]);_0x20856f[_0x8ee2('0x48')]();}}}catch(_0x40eeea){logger[_0x8ee2('0x37')]('[%s][QUEUE]\x20%s',_0x3f84b3,_0x40eeea[_0x8ee2('0x54')]);_0x20856f[_0x8ee2('0x48')]();}};}; \ No newline at end of file +var _0xe424=['lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','socket.io-emitter','account','queue','from','joinAt','clone','queue_id','push','InteractionId','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','error','create\x20queue\x20report','accepted','update','then','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','toLowerCase','consequence','map','join','stop','find','Queues','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate'];(function(_0xaa793a,_0x45c8d3){var _0x16d1a9=function(_0x4d3bb9){while(--_0x4d3bb9){_0xaa793a['push'](_0xaa793a['shift']());}};_0x16d1a9(++_0x45c8d3);}(_0xe424,0x13f));var _0x4e42=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xe424[_0x581af1];return _0x54c22e;};'use strict';var schema=require(_0x4e42('0x0'));var _=require(_0x4e42('0x1'));var util=require(_0x4e42('0x2'));var seqqueue=require(_0x4e42('0x3'));var moment=require(_0x4e42('0x4'));var Redis=require(_0x4e42('0x5'));var config=require(_0x4e42('0x6'));var logger=require(_0x4e42('0x7'))('routing');var strategy=require(_0x4e42('0x8'));config[_0x4e42('0x9')]=_[_0x4e42('0xa')](config[_0x4e42('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4e42('0xb'))(new Redis(config[_0x4e42('0x9')]));var attributes=['id','queue_id',_0x4e42('0xc'),_0x4e42('0xd'),_0x4e42('0xe'),_0x4e42('0xf')];function emit(_0xc5ae9e,_0x164f3d,_0x935af7){io['to'](_0xc5ae9e)['emit'](_0x164f3d,_0x935af7);}function emitChannelQueueInteraction(_0x159839,_0x511124,_0x301f19,_0x3f84e3,_0x38c2fc,_0x398d2d,_0x117369,_0x37ba91){var _0x3d3908=_[_0x4e42('0x10')](_0x301f19);_0x3d3908[_0x4e42('0x11')]=_0x37ba91;_0x3d3908[_0x4e42('0xd')]=_0x511124;_0x3d3908[_0x4e42('0xc')]=_0x3f84e3;_0x3d3908['id']=_0x38c2fc;if(_0x398d2d){attributes[_0x4e42('0x12')](_['capitalize'](_0x159839)+_0x4e42('0x13'));_0x117369[util['format'](_0x4e42('0x14'),_0x159839)][_0x38c2fc]=_[_0x4e42('0x15')](_0x3d3908,attributes);}else{delete _0x117369[util[_0x4e42('0x16')](_0x4e42('0x14'),_0x159839)][_0x38c2fc];}emit(util[_0x4e42('0x16')]('%s:queue:%s',_0x159839,_0x511124),util[_0x4e42('0x16')](_0x4e42('0x17'),_0x159839,_0x398d2d?_0x4e42('0x18'):_0x4e42('0x19')),_[_0x4e42('0x15')](_0x3d3908,attributes));}var rpc={'openchannelQueueReport':require(_0x4e42('0x1a')),'mailQueueReport':require(_0x4e42('0x1b')),'chatQueueReport':require(_0x4e42('0x1c')),'smsQueueReport':require(_0x4e42('0x1d')),'faxQueueReport':require(_0x4e42('0x1e')),'whatsappQueueReport':require(_0x4e42('0x1f')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x4e42('0x20')),'openchannelInteraction':require(_0x4e42('0x21')),'smsInteraction':require(_0x4e42('0x22')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x4e42('0x23'),'required':!![],'message':_0x4e42('0x24')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x10f9bc,_0x2dfd89,_0x2be258,_0x1ac15f){if(_0x10f9bc&&_0x2dfd89&&_0x2be258){_0x2dfd89[_0x4e42('0x25')]+=0x1;var _0x2ee52b={'uniqueid':_0x10f9bc,'from':_0x2be258[_0x4e42('0x26')]?_0x2be258[_0x4e42('0x26')][_0x4e42('0xe')]:'','joinAt':moment()[_0x4e42('0x16')](_0x4e42('0x27')),'ContactId':_0x2be258[_0x4e42('0x28')]?_0x2be258[_0x4e42('0x28')]['id']:null,'ListId':_0x2be258[_0x4e42('0x29')]?_0x2be258[_0x4e42('0x29')]['id']:null};_0x2ee52b[_[_0x4e42('0x2a')](_0x2be258[_0x4e42('0x2b')])+_0x4e42('0x2c')]=_0x2dfd89['id']||null;_0x2ee52b[_[_0x4e42('0x2a')](_0x2be258[_0x4e42('0x2b')])+_0x4e42('0x13')]=_0x2be258[_0x4e42('0x2d')]?_0x2be258[_0x4e42('0x2d')]['id']:null;_0x2ee52b[_[_0x4e42('0x2a')](_0x2be258['channel'])+'MessageId']=_0x2be258['message']?_0x2be258[_0x4e42('0x2e')]['id']:null;_0x2ee52b[_['upperFirst'](_0x2be258[_0x4e42('0x2b')])+(_0x2be258[_0x4e42('0x2b')]!==_0x4e42('0x2f')?_0x4e42('0x30'):_0x4e42('0x31'))]=_0x2be258[_0x4e42('0xc')]?_0x2be258[_0x4e42('0xc')]['id']:null;logger[_0x4e42('0x32')](util['format'](_0x4e42('0x33'),_0x10f9bc,_0x2dfd89[_0x4e42('0x34')]));emitChannelQueueInteraction(_0x2be258[_0x4e42('0x2b')],_0x2dfd89['name'],_0x2ee52b,_0x2be258['account']['name'],_0x2be258[_0x4e42('0x2e')]['id'],!![],_0x1ac15f,_0x2dfd89['id']);if(rpc[_0x2be258[_0x4e42('0x2b')]+'QueueReport']){return rpc[_0x2be258[_0x4e42('0x2b')]+'QueueReport']['create'](_0x2ee52b)['catch'](function(_0x3e53b7){logger[_0x4e42('0x35')](_0x4e42('0x36'),_0x3e53b7);});}}}function stopRouting(_0x40c735,_0x477ad6,_0xe77883,_0x1f185a){if(_0x40c735&&_0x477ad6){_0x477ad6['waiting']-=0x1;var _0x40e5ad={'leaveAt':moment()[_0x4e42('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x4e42('0x37')};logger[_0x4e42('0x32')](util[_0x4e42('0x16')]('[%s][STOP:QUEUE][NAME:%s]',_0x40c735,_0x477ad6['name']));emitChannelQueueInteraction(_0xe77883[_0x4e42('0x2b')],_0x477ad6[_0x4e42('0x34')],_0xe77883[_0x4e42('0x26')],_0xe77883[_0x4e42('0xc')][_0x4e42('0x34')],_0xe77883[_0x4e42('0x2e')]['id'],![],_0x1f185a,_0x477ad6['id']);return rpc[_0xe77883[_0x4e42('0x2b')]+'Interaction'][_0x4e42('0x38')](_0xe77883[_0x4e42('0x2d')]['id'],{'queueId':_0x477ad6['id']})[_0x4e42('0x39')](function(){if(rpc[_0xe77883[_0x4e42('0x2b')]+_0x4e42('0x3a')]){return rpc[_0xe77883[_0x4e42('0x2b')]+_0x4e42('0x3a')][_0x4e42('0x38')](_0x40c735,_0x40e5ad)['catch'](function(_0x321959){logger['error'](_0x4e42('0x3b'),_0x321959);});}});}}function endRouting(_0x6d2b2d,_0x2f8a3d,_0x4ec2b6,_0x45c419){if(_0x6d2b2d&&_0x2f8a3d){_0x2f8a3d[_0x4e42('0x25')]-=0x1;var _0x29213f={'leaveAt':moment()[_0x4e42('0x16')](_0x4e42('0x27')),'exitAt':moment()[_0x4e42('0x16')](_0x4e42('0x27')),'reason':_0x4e42('0x3c')};logger[_0x4e42('0x32')](util[_0x4e42('0x16')](_0x4e42('0x3d'),_0x6d2b2d,_0x2f8a3d['name']));emitChannelQueueInteraction(_0x4ec2b6[_0x4e42('0x2b')],_0x2f8a3d[_0x4e42('0x34')],_0x4ec2b6['body'],_0x4ec2b6[_0x4e42('0xc')][_0x4e42('0x34')],_0x4ec2b6[_0x4e42('0x2e')]['id'],![],_0x45c419);if(rpc[_0x4ec2b6[_0x4e42('0x2b')]+_0x4e42('0x3a')]){return rpc[_0x4ec2b6['channel']+_0x4e42('0x3a')][_0x4e42('0x38')](_0x6d2b2d,_0x29213f)[_0x4e42('0x3e')](function(_0x1addd2){logger[_0x4e42('0x35')](_0x4e42('0x3b'),_0x1addd2);});}}}function handleFindQueue(_0x369ed2){return function(_0x29c222){return _0x29c222[_0x4e42('0x34')]['toLowerCase']()===_0x369ed2[_0x4e42('0x3f')]();};}exports[_0x4e42('0x40')]=function(_0x53ed98,_0x2bd0d9,_0x4cb2c5,_0x1b40d1){return function(_0x778985){try{var _0x3f3127={'name':_0x2bd0d9[0x0],'timeout':_0x2bd0d9[0x1]};var _0x3688be=queue[_0x4e42('0x0')](_0x3f3127,{'typecast':!![]});if(_0x3688be['length']){logger[_0x4e42('0x35')]('[%s][QUEUE]\x20%s',_0x53ed98,_[_0x4e42('0x41')](_0x3688be,_0x4e42('0x2e'))[_0x4e42('0x42')](',\x20'));_0x778985[_0x4e42('0x43')]();}else{var _0x5bb286=_[_0x4e42('0x44')](_0x4cb2c5[_0x1b40d1[_0x4e42('0x2b')]+_0x4e42('0x45')],handleFindQueue(_0x3f3127[_0x4e42('0x34')]));if(_0x5bb286){startRouting(_0x53ed98,_0x5bb286,_0x1b40d1,_0x4cb2c5);var _0x11a68e=(_0x5bb286['timeout']||0xa)*0x3e8;var _0x198acf=(_0x3f3127[_0x4e42('0x3c')]||0x14)*0x3e8;var _0x41b03d;if(_0x11a68e>_0x198acf){_0x198acf=_0x11a68e;}var _0x225186=seqqueue['createQueue'](_0x11a68e);_0x225186['id']=_0x53ed98;_0x225186[_0x4e42('0x46')]=_0x11a68e;_0x225186['qtimeout']=_0x198acf;_0x225186['channel']=_0x1b40d1[_0x4e42('0x2b')];_0x4cb2c5[_0x4e42('0x47')][_0x53ed98]['on']('end',function(){logger['info'](_0x4e42('0x48'),_0x53ed98);stopRouting(_0x53ed98,_0x5bb286,_0x1b40d1,_0x4cb2c5);clearTimeout(_0x41b03d);_0x41b03d=undefined;_0x225186[_0x4e42('0x49')](!![]);if(_0x4cb2c5['rules'][_0x53ed98]){delete _0x4cb2c5['rules'][_0x53ed98];}_0x778985[_0x4e42('0x43')]();});_0x4cb2c5[_0x4e42('0x47')][_0x53ed98]['on'](_0x4e42('0x4a'),function(){if(_0x4cb2c5[_0x4e42('0x47')][_0x53ed98]){delete _0x4cb2c5[_0x4e42('0x47')][_0x53ed98];}});_0x41b03d=setTimeout(function(){logger[_0x4e42('0x32')](_0x4e42('0x4b'),_0x53ed98);endRouting(_0x53ed98,_0x5bb286,_0x1b40d1,_0x4cb2c5);clearTimeout(_0x41b03d);_0x225186[_0x4e42('0x49')](!![]);_0x778985[_0x4e42('0x4c')]();},_0x198acf);switch(_0x5bb286['strategy']){case _0x4e42('0x4d'):strategy[_0x4e42('0x4d')](_0x225186,_0x5bb286,_0x4cb2c5,_0x1b40d1);break;default:strategy['beepall'](_0x225186,_0x5bb286,_0x4cb2c5,_0x1b40d1);}}else{logger[_0x4e42('0x35')](_0x4e42('0x4e'),_0x53ed98,_0x3f3127['name']);_0x778985[_0x4e42('0x43')]();}}}catch(_0x5a7341){logger[_0x4e42('0x35')](_0x4e42('0x4f'),_0x53ed98,_0x5a7341['stack']);_0x778985[_0x4e42('0x43')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 4a5704e..ee29a87 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 _0x8d0e=['handleTimeout','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','busy','busyQueue','saveWaitingNotification','channel','notificationId','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','squeue','push','handleRun','bind'];(function(_0x21417c,_0x487287){var _0x542282=function(_0x22f672){while(--_0x22f672){_0x21417c['push'](_0x21417c['shift']());}};_0x542282(++_0x487287);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x5dc307,_0x4072b4){_0x5dc307=_0x5dc307-0x0;var _0x500d72=_0x8d0e[_0x5dc307];return _0x500d72;};'use strict';var _=require(_0xe8d0('0x0'));var uuid=require(_0xe8d0('0x1'));var util=require(_0xe8d0('0x2'));var logger=require(_0xe8d0('0x3'))(_0xe8d0('0x4'));var Agent=function(_0x3584ab,_0x15521e,_0x940176,_0x32cee9){this['notificationId']=uuid['v4']();this[_0xe8d0('0x5')]=_0x3584ab;this['agent']=_0x15521e;this['realtime']=_0x940176;this[_0xe8d0('0x4')]=_0x32cee9;this[_0xe8d0('0x5')][_0xe8d0('0x6')](this[_0xe8d0('0x7')][_0xe8d0('0x8')](this),this[_0xe8d0('0x9')][_0xe8d0('0x8')](this));this[_0xe8d0('0x5')]['on']('timeout',this[_0xe8d0('0x9')][_0xe8d0('0x8')](this));this[_0xe8d0('0x5')]['on']('drained',this['handleDrained'][_0xe8d0('0x8')](this));};Agent[_0xe8d0('0xa')][_0xe8d0('0x6')]=function(){this[_0xe8d0('0x5')][_0xe8d0('0x6')](this[_0xe8d0('0x7')]['bind'](this),this[_0xe8d0('0x9')][_0xe8d0('0x8')](this));};Agent['prototype'][_0xe8d0('0xb')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xe8d0('0x7')]=function(){logger[_0xe8d0('0xc')](_0xe8d0('0xd'),this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0xe')]['id']);if(_[_0xe8d0('0xf')](this['realtime'][_0xe8d0('0x10')][this['agent']['id']])){logger[_0xe8d0('0xc')](_0xe8d0('0x11'),this[_0xe8d0('0x5')]['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0xe8d0('0x4')][_0xe8d0('0x12')]||util[_0xe8d0('0x13')](this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')]['agents'][this[_0xe8d0('0xe')]['id']],this[_0xe8d0('0x5')]['channel'],![])){this['realtime']['agents'][this[_0xe8d0('0xe')]['id']][_0xe8d0('0x15')]=!![];this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']][_0xe8d0('0x16')]=undefined;util[_0xe8d0('0x17')](this[_0xe8d0('0x14')],this[_0xe8d0('0x4')],this['agent'],this[_0xe8d0('0x5')][_0xe8d0('0x18')]);util['showNotification'](this[_0xe8d0('0x19')],this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']],null,this[_0xe8d0('0x4')]);util[_0xe8d0('0x1a')](this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']],'RINGING'+(this[_0xe8d0('0x4')][_0xe8d0('0x12')]?_0xe8d0('0x1b'):''));}else{logger['debug'](_0xe8d0('0x1c'),this[_0xe8d0('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xe8d0('0x6')][_0xe8d0('0x8')](this),0x3e8);}}};Agent[_0xe8d0('0xa')][_0xe8d0('0x9')]=function(_0x3cf3d6){if(_['isNil'](this[_0xe8d0('0x14')]['agents'][this['agent']['id']])){return logger['debug'](_0xe8d0('0x11'),this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0xe')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe8d0('0x5')]['id'],this['agent']['id']);util[_0xe8d0('0x1d')](this[_0xe8d0('0x19')],this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')][_0xe8d0('0x10')][this['agent']['id']],null,this[_0xe8d0('0x4')]);this[_0xe8d0('0x14')][_0xe8d0('0x10')][this[_0xe8d0('0xe')]['id']]['busy']=![];this[_0xe8d0('0x14')][_0xe8d0('0x10')][this['agent']['id']][_0xe8d0('0x16')]=undefined;util['removeWaitingNotification'](this[_0xe8d0('0x14')],this['routing'],this[_0xe8d0('0xe')],this['squeue'][_0xe8d0('0x18')]);util[_0xe8d0('0x1a')](this[_0xe8d0('0x5')]['id'],this[_0xe8d0('0x14')]['agents'][this[_0xe8d0('0xe')]['id']],_0x3cf3d6?_0xe8d0('0x1e'):_0xe8d0('0x1f'));}if(!_0x3cf3d6){setTimeout(this['push'][_0xe8d0('0x8')](this),0x3e8);}};function agent(_0xa02b8d,_0xdfc807,_0x9cb99b,_0x1ecd41){return new Agent(_0xa02b8d,_0xdfc807,_0x9cb99b,_0x1ecd41);}module['exports']=agent; \ No newline at end of file +var _0x5178=['isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','agent','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x5178,0x171));var _0x8517=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5178[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var uuid=require(_0x8517('0x0'));var util=require(_0x8517('0x1'));var logger=require(_0x8517('0x2'))(_0x8517('0x3'));var Agent=function(_0x38d5b3,_0x5e0a44,_0x483381,_0x3ed6a5){this[_0x8517('0x4')]=uuid['v4']();this['squeue']=_0x38d5b3;this[_0x8517('0x5')]=_0x5e0a44;this['realtime']=_0x483381;this[_0x8517('0x3')]=_0x3ed6a5;this[_0x8517('0x6')][_0x8517('0x7')](this[_0x8517('0x8')][_0x8517('0x9')](this),this['handleTimeout'][_0x8517('0x9')](this));this['squeue']['on']('timeout',this[_0x8517('0xa')][_0x8517('0x9')](this));this['squeue']['on'](_0x8517('0xb'),this[_0x8517('0xc')][_0x8517('0x9')](this));};Agent[_0x8517('0xd')][_0x8517('0x7')]=function(){this[_0x8517('0x6')][_0x8517('0x7')](this[_0x8517('0x8')]['bind'](this),this[_0x8517('0xa')][_0x8517('0x9')](this));};Agent[_0x8517('0xd')][_0x8517('0xc')]=function(){this[_0x8517('0xa')](!![]);};Agent['prototype'][_0x8517('0x8')]=function(){logger[_0x8517('0xe')](_0x8517('0xf'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);if(_[_0x8517('0x10')](this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']])){logger[_0x8517('0xe')](_0x8517('0x13'),this[_0x8517('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x8517('0x7')][_0x8517('0x9')](this),0x3e8);}else{if(this[_0x8517('0x3')][_0x8517('0x14')]||util[_0x8517('0x15')](this[_0x8517('0x6')]['id'],this[_0x8517('0x11')]['agents'][this[_0x8517('0x5')]['id']],this['squeue']['channel'],![])){this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']][_0x8517('0x16')]=!![];this[_0x8517('0x11')][_0x8517('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0x8517('0x17')](this[_0x8517('0x11')],this[_0x8517('0x3')],this[_0x8517('0x5')],this[_0x8517('0x6')][_0x8517('0x18')]);util['showNotification'](this[_0x8517('0x4')],this[_0x8517('0x6')]['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],null,this[_0x8517('0x3')]);util['writeLog'](this[_0x8517('0x6')]['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],_0x8517('0x19')+(this[_0x8517('0x3')][_0x8517('0x14')]?_0x8517('0x1a'):''));}else{logger['debug'](_0x8517('0x1b'),this['squeue']['id'],this[_0x8517('0x5')]['id']);setTimeout(this[_0x8517('0x7')][_0x8517('0x9')](this),0x3e8);}}};Agent[_0x8517('0xd')][_0x8517('0xa')]=function(_0x1b2423){if(_['isNil'](this[_0x8517('0x11')]['agents'][this[_0x8517('0x5')]['id']])){return logger[_0x8517('0xe')](_0x8517('0x13'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);}else{logger[_0x8517('0xe')](_0x8517('0x1c'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);util['hideNotification'](this[_0x8517('0x4')],this[_0x8517('0x6')]['id'],this[_0x8517('0x11')]['agents'][this['agent']['id']],null,this['routing']);this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']][_0x8517('0x16')]=![];this[_0x8517('0x11')][_0x8517('0x12')][this['agent']['id']][_0x8517('0x1d')]=undefined;util[_0x8517('0x1e')](this[_0x8517('0x11')],this['routing'],this[_0x8517('0x5')],this['squeue'][_0x8517('0x18')]);util[_0x8517('0x1f')](this['squeue']['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],_0x1b2423?_0x8517('0x20'):_0x8517('0x21'));}if(!_0x1b2423){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2cb889,_0x11a1b3,_0x1835ac,_0x516fb1){return new Agent(_0x2cb889,_0x11a1b3,_0x1835ac,_0x516fb1);}module[_0x8517('0x22')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index e1c9b57..714da27 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 _0xc584=['../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','saveWaitingNotification','showNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','removeWaitingNotification','lodash','uuid','./util'];(function(_0x3bad06,_0x4f9f6f){var _0x168dec=function(_0x507af1){while(--_0x507af1){_0x3bad06['push'](_0x3bad06['shift']());}};_0x168dec(++_0x4f9f6f);}(_0xc584,0xbb));var _0x4c58=function(_0x12c66e,_0xea7b4){_0x12c66e=_0x12c66e-0x0;var _0x19481a=_0xc584[_0x12c66e];return _0x19481a;};'use strict';var _=require(_0x4c58('0x0'));var uuid=require(_0x4c58('0x1'));var util=require(_0x4c58('0x2'));var logger=require(_0x4c58('0x3'))(_0x4c58('0x4'));var Beepall=function(_0x5347bc,_0x168253,_0x377b5c,_0x4ce855){this[_0x4c58('0x5')]=uuid['v4']();this[_0x4c58('0x6')]=_0x5347bc;this[_0x4c58('0x7')]=_0x168253;this['realtime']=_0x377b5c;this['routing']=_0x4ce855;this[_0x4c58('0x6')][_0x4c58('0x8')](this[_0x4c58('0x9')]['bind'](this),this[_0x4c58('0xa')][_0x4c58('0xb')](this));this[_0x4c58('0x6')]['on'](_0x4c58('0xc'),this['handleTimeout'][_0x4c58('0xb')](this));this[_0x4c58('0x6')]['on'](_0x4c58('0xd'),this[_0x4c58('0xe')][_0x4c58('0xb')](this));};Beepall[_0x4c58('0xf')][_0x4c58('0x8')]=function(){this[_0x4c58('0x6')][_0x4c58('0x8')](this[_0x4c58('0x9')][_0x4c58('0xb')](this),this[_0x4c58('0xa')][_0x4c58('0xb')](this));};Beepall[_0x4c58('0xf')][_0x4c58('0xe')]=function(){this['handleTimeout'](!![]);};Beepall[_0x4c58('0xf')]['handleRun']=function(){var _0x9eed8=!![];if(!_[_0x4c58('0x10')](this[_0x4c58('0x7')])&&!_[_0x4c58('0x10')](this['queue'][_0x4c58('0x11')])&&this[_0x4c58('0x7')][_0x4c58('0x11')][_0x4c58('0x12')]>0x0){for(var _0x412904=0x0,_0x4236e5;_0x4129040x0){for(var _0x1b79a0=0x0,_0x2a5e98;_0x1b79a00x0&&_0x1a86a6[_0x5bc415+_0x7ba8('0x22')]>=_0x1a86a6[_0x5bc415+_0x7ba8('0x21')]){writeLog(_0x7c68e1,_0x1a86a6,_0x5bc415['toUpperCase']()+_0x7ba8('0x23'));return![];}}return!![];};exports[_0x7ba8('0x24')]=function(_0x52f387,_0x2ad996,_0x27096f,_0x45a2d9,_0x16799a){return sendNotification(!![],_0x52f387,_0x2ad996,_0x27096f,_0x45a2d9,_0x16799a);};exports[_0x7ba8('0x25')]=function(_0x3a05e7,_0x28f247,_0x3bc762,_0x30ef65,_0x1628b8){return sendNotification(![],_0x3a05e7,_0x28f247,_0x3bc762,_0x30ef65,_0x1628b8);};exports[_0x7ba8('0x26')]=function(_0x1efb58,_0x52dc05,_0x4d81ba){var _0x1a2321=_0x52dc05[_0x7ba8('0x27')][_0x7ba8('0x28')];if(!_0x1a2321&&_0x4d81ba){_0x1a2321=_0x4d81ba['id'];}var _0x132d0c=_[_0x7ba8('0x29')](_0x1efb58[_0x52dc05['channel']+_0x7ba8('0x2a')],function(_0xba4f0a){var _0x2a75b6=_[_0x7ba8('0x2b')](_0x52dc05['channel'])+_0x7ba8('0x2c');return _0xba4f0a[_0x2a75b6]===_0x52dc05['interaction']['id'];});if(!_0x132d0c&&_0x1a2321&&_0x1efb58['agents'][_0x1a2321]){_0x132d0c=_['some'](_0x1efb58['agents'][_0x1a2321][_0x52dc05[_0x7ba8('0x2d')]+_0x7ba8('0x2e')],function(_0x1cf518){return _0x1cf518['id']===_0x52dc05[_0x7ba8('0x27')]['id'];});}return _0x132d0c;};exports[_0x7ba8('0x2f')]=function(_0x3cf335,_0x344603,_0x4f061e,_0x54841f){if(_0x4f061e&&_0x4f061e['id']&&_0x3cf335['agents']&&_0x3cf335[_0x7ba8('0x30')][_0x4f061e['id']]){_0x3cf335[_0x7ba8('0x30')][_0x4f061e['id']][_0x54841f+_0x7ba8('0x2e')][_0x344603[_0x7ba8('0x13')]['id']]={'id':_0x344603['interaction']['id']};}};exports[_0x7ba8('0x31')]=function(_0x48f690,_0x535525,_0x59ad73,_0x3689b4){if(_0x59ad73&&_0x59ad73['id']&&_0x48f690[_0x7ba8('0x30')]&&_0x48f690['agents'][_0x59ad73['id']]){delete _0x48f690['agents'][_0x59ad73['id']][_0x3689b4+_0x7ba8('0x2e')][_0x535525[_0x7ba8('0x13')]['id']];}};exports[_0x7ba8('0x32')]=writeLog; \ No newline at end of file +var _0xa9f0=['notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','name','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','WaitingInteractions','interaction','agents','removeWaitingNotification','message','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','split','\x20interaction'];(function(_0x5cea30,_0x777cd1){var _0x9cd447=function(_0x1a5a13){while(--_0x1a5a13){_0x5cea30['push'](_0x5cea30['shift']());}};_0x9cd447(++_0x777cd1);}(_0xa9f0,0x153));var _0x0a9f=function(_0x5ed3c,_0x2cfd7b){_0x5ed3c=_0x5ed3c-0x0;var _0x3ae0fc=_0xa9f0[_0x5ed3c];return _0x3ae0fc;};'use strict';var _=require(_0x0a9f('0x0'));var util=require('util');var utils=require(_0x0a9f('0x1'));var Redis=require(_0x0a9f('0x2'));var config=require(_0x0a9f('0x3'));var logger=require(_0x0a9f('0x4'))(_0x0a9f('0x5'));config[_0x0a9f('0x6')]=_[_0x0a9f('0x7')](config[_0x0a9f('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9f('0x8'))(new Redis(config['redis']));function sendNotification(_0x19b209,_0x58e827,_0x820b53,_0x2a372d,_0x451a64,_0x1e461a){var _0x53532c=_0x1e461a||{};var _0x174ad2=_0x820b53[_0x0a9f('0x9')]('.');var _0x31c55e={'uniqueid':_0x58e827,'channel':_0x174ad2[0x0],'id':_0x174ad2[0x1],'title':_0x174ad2[0x0]+_0x0a9f('0xa'),'interactionId':_0x174ad2[0x2],'queue':_0x451a64?_0x451a64['name']:null,'sound':_0x53532c['account'][_0x0a9f('0xb')],'shake':_0x53532c[_0x0a9f('0xc')][_0x0a9f('0xd')]};try{if(!_0x53532c[_0x0a9f('0xe')]){_0x53532c[_0x0a9f('0xe')]={};}if(_0x451a64){_0x53532c[_0x0a9f('0xe')][_0x0a9f('0xf')]=_0x451a64;}else if(_0x53532c[_0x0a9f('0xe')][_0x0a9f('0xf')]){delete _0x53532c[_0x0a9f('0xe')][_0x0a9f('0xf')];}_0x31c55e[_0x0a9f('0x10')]=utils[_0x0a9f('0x11')](_0x53532c['account'][_0x0a9f('0x12')],_0x53532c);}catch(_0x482d30){_0x31c55e[_0x0a9f('0x10')]=_0x0a9f('0x13');logger[_0x0a9f('0x14')](util[_0x0a9f('0x15')]('[%s][QUEUE]\x20%s',_0x58e827,_0x482d30['message']));}io['to'](util['format']('user:%s',_0x2a372d[_0x0a9f('0x16')]))[_0x0a9f('0x17')](util['format'](_0x0a9f('0x18'),_0x19b209?_0x0a9f('0x19'):_0x0a9f('0x1a')),_0x31c55e);}function writeLog(_0x505444,_0x129414,_0x130304){return logger[_0x0a9f('0x1b')](util['format'](_0x0a9f('0x1c'),_0x505444,_0x129414['name'],_0x130304));}exports[_0x0a9f('0x1d')]=function(_0x1c3a4f,_0x2e010d,_0x2c3d31,_0x51ca94){if(_0x2e010d['busy']){writeLog(_0x1c3a4f,_0x2e010d,_0x0a9f('0x1e'));return![];}if(!_0x2e010d[_0x0a9f('0x1f')]){writeLog(_0x1c3a4f,_0x2e010d,_0x0a9f('0x20'));return![];}if(_0x2e010d[_0x2c3d31+_0x0a9f('0x21')]){writeLog(_0x1c3a4f,_0x2e010d,_0x0a9f('0x22'));return![];}if(_0x51ca94&&_0x2e010d[_0x0a9f('0x23')](_0x2c3d31+_0x0a9f('0x24'))&&_0x2e010d[_0x0a9f('0x23')](_0x2c3d31+_0x0a9f('0x25'))){if(_0x2e010d[_0x2c3d31+'Capacity']>0x0&&_0x2e010d[_0x2c3d31+'CurrentCapacity']>=_0x2e010d[_0x2c3d31+_0x0a9f('0x24')]){writeLog(_0x1c3a4f,_0x2e010d,_0x2c3d31['toUpperCase']()+_0x0a9f('0x26'));return![];}}return!![];};exports[_0x0a9f('0x27')]=function(_0x74f17d,_0x4dbb18,_0x331b2d,_0x47f3fc,_0x2244aa){return sendNotification(!![],_0x74f17d,_0x4dbb18,_0x331b2d,_0x47f3fc,_0x2244aa);};exports['hideNotification']=function(_0x52cae3,_0x540374,_0x44b380,_0x433801,_0x163d67){return sendNotification(![],_0x52cae3,_0x540374,_0x44b380,_0x433801,_0x163d67);};exports['checkWaitingNotifications']=function(_0x48e90b,_0x18d470,_0x48cfc5){var _0x31ca86=_0x18d470['interaction']['UserId'];if(!_0x31ca86&&_0x48cfc5){_0x31ca86=_0x48cfc5['id'];}var _0x7af7ef=_[_0x0a9f('0x28')](_0x48e90b[_0x18d470[_0x0a9f('0x29')]+_0x0a9f('0x2a')],function(_0x40bd5d){var _0x340d94=_[_0x0a9f('0x2b')](_0x18d470[_0x0a9f('0x29')])+_0x0a9f('0x2c');return _0x40bd5d[_0x340d94]===_0x18d470['interaction']['id'];});if(!_0x7af7ef&&_0x31ca86&&_0x48e90b['agents'][_0x31ca86]){_0x7af7ef=_['some'](_0x48e90b['agents'][_0x31ca86][_0x18d470['channel']+_0x0a9f('0x2d')],function(_0xa5a235){return _0xa5a235['id']===_0x18d470[_0x0a9f('0x2e')]['id'];});}return _0x7af7ef;};exports['saveWaitingNotification']=function(_0x3de055,_0x3d47aa,_0xb00a4a,_0x53e52f){if(_0xb00a4a&&_0xb00a4a['id']&&_0x3de055[_0x0a9f('0x2f')]&&_0x3de055['agents'][_0xb00a4a['id']]){_0x3de055[_0x0a9f('0x2f')][_0xb00a4a['id']][_0x53e52f+_0x0a9f('0x2d')][_0x3d47aa['message']['id']]={'id':_0x3d47aa[_0x0a9f('0x2e')]['id']};}};exports[_0x0a9f('0x30')]=function(_0x340efd,_0x22a329,_0x52f230,_0x192c48){if(_0x52f230&&_0x52f230['id']&&_0x340efd[_0x0a9f('0x2f')]&&_0x340efd[_0x0a9f('0x2f')][_0x52f230['id']]){delete _0x340efd[_0x0a9f('0x2f')][_0x52f230['id']][_0x192c48+_0x0a9f('0x2d')][_0x22a329[_0x0a9f('0x31')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 728e817..7d3691e 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 _0x36bb=['shelljs','lodash','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate'];(function(_0x45d0f5,_0x56e5d8){var _0x34ee47=function(_0x3b0ba3){while(--_0x3b0ba3){_0x45d0f5['push'](_0x45d0f5['shift']());}};_0x34ee47(++_0x56e5d8);}(_0x36bb,0xdf));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xb36b('0x0'));var sh=require(_0xb36b('0x1'));var _=require(_0xb36b('0x2'));var utils=require('./utils');var logger=require(_0xb36b('0x3'))(_0xb36b('0x4'));var system=schema({'command':{'type':_0xb36b('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xb36b('0x6')]=function(_0x437292,_0x19b4ee){return function(_0x1fbdb7){try{var _0x4f840f={'command':_0x19b4ee[0x0]};var _0x4754bd=system[_0xb36b('0x0')](_0x4f840f,{'typecast':!![]});if(_0x4754bd[_0xb36b('0x7')]){logger[_0xb36b('0x8')](_0xb36b('0x9'),_0x437292,_[_0xb36b('0xa')](_0x4754bd,_0xb36b('0xb'))[_0xb36b('0xc')](',\x20'));logger[_0xb36b('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x437292);_0x1fbdb7[_0xb36b('0xe')]();}else{var _0x47becf=this;var _0x579dfa=utils[_0xb36b('0xf')](_0x19b4ee[0x0],this);logger[_0xb36b('0xd')](_0xb36b('0x10'),_0x437292,_0x579dfa);sh[_0xb36b('0x11')](_[_0xb36b('0x12')](_0x579dfa),function(_0x111dc,_0x120ce0){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x437292,_0x111dc);if(_0x111dc==0x0){var _0x35efb8=_0x120ce0[_0xb36b('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xb36b('0x14')](_0x19b4ee[0x1])||_[_0xb36b('0x15')](_0x19b4ee[0x1])){logger['info'](_0xb36b('0x16'),_0x437292);_0x47becf[_0xb36b('0x17')][_0x19b4ee[0x1]]=_0x35efb8;}else{logger[_0xb36b('0xd')](_0xb36b('0x18'),_0x437292,_0x19b4ee[0x1],_0x35efb8);_0x47becf['body'][_0x19b4ee[0x1]]=_0x35efb8;}}_0x1fbdb7[_0xb36b('0xe')]();});}}catch(_0x1d8019){logger[_0xb36b('0x8')](_0xb36b('0x9'),_0x437292,_[_0xb36b('0x19')](_0x1d8019)?JSON[_0xb36b('0x1a')](_0x1d8019):_0x1d8019);logger[_0xb36b('0xd')](_0xb36b('0x1b'),_0x437292);_0x1fbdb7[_0xb36b('0xe')]();}};}; \ No newline at end of file +var _0x8926=['getMustacheRender','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0x8926,0x199));var _0x6892=function(_0x5a641f,_0x112a0e){_0x5a641f=_0x5a641f-0x0;var _0x5c779f=_0x8926[_0x5a641f];return _0x5c779f;};'use strict';var schema=require('validate');var sh=require(_0x6892('0x0'));var _=require(_0x6892('0x1'));var utils=require(_0x6892('0x2'));var logger=require(_0x6892('0x3'))(_0x6892('0x4'));var system=schema({'command':{'type':_0x6892('0x5'),'required':!![],'message':_0x6892('0x6')}});exports[_0x6892('0x7')]=function(_0x5e288e,_0x6fceb1){return function(_0x45e1f6){try{var _0x370d12={'command':_0x6fceb1[0x0]};var _0x570475=system[_0x6892('0x8')](_0x370d12,{'typecast':!![]});if(_0x570475['length']){logger['error'](_0x6892('0x9'),_0x5e288e,_[_0x6892('0xa')](_0x570475,_0x6892('0xb'))[_0x6892('0xc')](',\x20'));logger[_0x6892('0xd')](_0x6892('0xe'),_0x5e288e);_0x45e1f6[_0x6892('0xf')]();}else{var _0x36fd93=this;var _0x397f11=utils[_0x6892('0x10')](_0x6fceb1[0x0],this);logger[_0x6892('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5e288e,_0x397f11);sh['exec'](_['trim'](_0x397f11),function(_0x3295e3,_0x180c58){logger[_0x6892('0xd')](_0x6892('0x11'),_0x5e288e,_0x3295e3);if(_0x3295e3==0x0){var _0x42c83d=_0x180c58['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x6892('0x12')](_0x6fceb1[0x1])||_[_0x6892('0x13')](_0x6fceb1[0x1])){logger[_0x6892('0xd')](_0x6892('0x14'),_0x5e288e);_0x36fd93[_0x6892('0x15')][_0x6fceb1[0x1]]=_0x42c83d;}else{logger['info'](_0x6892('0x16'),_0x5e288e,_0x6fceb1[0x1],_0x42c83d);_0x36fd93['body'][_0x6fceb1[0x1]]=_0x42c83d;}}_0x45e1f6[_0x6892('0xf')]();});}}catch(_0x28f8e2){logger['error']('[%s][SYSTEM]\x20%s',_0x5e288e,_[_0x6892('0x17')](_0x28f8e2)?JSON[_0x6892('0x18')](_0x28f8e2):_0x28f8e2);logger[_0x6892('0xd')](_0x6892('0xe'),_0x5e288e);_0x45e1f6[_0x6892('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 7cf2a62..3d150d5 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 _0x5f38=['stringify','finally','next','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error'];(function(_0x15c2a0,_0x1d7138){var _0x415001=function(_0x4ce67d){while(--_0x4ce67d){_0x15c2a0['push'](_0x15c2a0['shift']());}};_0x415001(++_0x1d7138);}(_0x5f38,0xba));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x85f3('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x85f3('0x1')),'openchannelInteraction':require(_0x85f3('0x2')),'smsInteraction':require(_0x85f3('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x85f3('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x85f3('0x5'))(_0x85f3('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x85f3('0x7')}});exports[_0x85f3('0x8')]=function(_0x3a95bd,_0x5ea48c,_0x4c10c3,_0x1615c5){return function(_0x12b76f){try{var _0x6bacd1={'tag':_0x5ea48c[0x0]};var _0x1769f3=tag[_0x85f3('0x0')](_0x6bacd1,{'typecast':!![]});if(_0x1769f3[_0x85f3('0x9')]){logger['error'](_0x85f3('0xa'),_0x3a95bd,_[_0x85f3('0xb')](_0x1769f3,_0x85f3('0xc'))[_0x85f3('0xd')](',\x20'));logger[_0x85f3('0xe')](_0x85f3('0xf'),_0x3a95bd);_0x12b76f['next']();}else{var _0x48a2f9={'ids':[_0x5ea48c[0x0]]};if(rpc[_0x1615c5[_0x85f3('0x10')]+_0x85f3('0x11')]){rpc[_0x1615c5[_0x85f3('0x10')]+_0x85f3('0x11')][_0x85f3('0x12')](_0x1615c5[_0x85f3('0x13')]['id'],_0x48a2f9)['then'](function(_0x184cdb){logger[_0x85f3('0xe')](_0x85f3('0x14'),_0x3a95bd,_0x5ea48c[0x1],_0x1615c5[_0x85f3('0x10')],_0x1615c5[_0x85f3('0x13')]['id']);})['catch'](function(_0x323a79){logger[_0x85f3('0x15')](_0x85f3('0xa'),_0x3a95bd,JSON[_0x85f3('0x16')](_0x323a79));logger[_0x85f3('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3a95bd);})[_0x85f3('0x17')](function(){_0x12b76f[_0x85f3('0x18')]();});}}}catch(_0x620c7){logger[_0x85f3('0x15')](_0x85f3('0xa'),_0x3a95bd,_[_0x85f3('0x19')](_0x620c7)?JSON[_0x85f3('0x16')](_0x620c7):_0x620c7);logger['info'](_0x85f3('0xf'),_0x3a95bd);_0x12b76f[_0x85f3('0x18')]();}};}; \ No newline at end of file +var _0x5798=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x7b889a,_0xfd568f){var _0x20725f=function(_0x4878b9){while(--_0x4878b9){_0x7b889a['push'](_0x7b889a['shift']());}};_0x20725f(++_0xfd568f);}(_0x5798,0xd0));var _0x8579=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x5798[_0x33ebf5];return _0x66957b;};'use strict';var schema=require(_0x8579('0x0'));var _=require(_0x8579('0x1'));var rpc={'chatInteraction':require(_0x8579('0x2')),'openchannelInteraction':require(_0x8579('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x8579('0x4')),'faxInteraction':require(_0x8579('0x5')),'whatsappInteraction':require(_0x8579('0x6'))};var logger=require(_0x8579('0x7'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x8579('0x8')}});exports['consequence']=function(_0x5ce3ac,_0x201518,_0x41df86,_0x42b346){return function(_0x5a8bb3){try{var _0x3abefa={'tag':_0x201518[0x0]};var _0x3da9c8=tag[_0x8579('0x0')](_0x3abefa,{'typecast':!![]});if(_0x3da9c8[_0x8579('0x9')]){logger[_0x8579('0xa')](_0x8579('0xb'),_0x5ce3ac,_[_0x8579('0xc')](_0x3da9c8,'message')[_0x8579('0xd')](',\x20'));logger['info'](_0x8579('0xe'),_0x5ce3ac);_0x5a8bb3[_0x8579('0xf')]();}else{var _0x9121a3={'ids':[_0x201518[0x0]]};if(rpc[_0x42b346[_0x8579('0x10')]+'Interaction']){rpc[_0x42b346['channel']+_0x8579('0x11')]['addTags'](_0x42b346[_0x8579('0x12')]['id'],_0x9121a3)['then'](function(_0x5ea37a){logger[_0x8579('0x13')](_0x8579('0x14'),_0x5ce3ac,_0x201518[0x1],_0x42b346[_0x8579('0x10')],_0x42b346[_0x8579('0x12')]['id']);})['catch'](function(_0x4c72d0){logger[_0x8579('0xa')](_0x8579('0xb'),_0x5ce3ac,JSON[_0x8579('0x15')](_0x4c72d0));logger['info'](_0x8579('0xe'),_0x5ce3ac);})[_0x8579('0x16')](function(){_0x5a8bb3[_0x8579('0xf')]();});}}}catch(_0x18b52d){logger[_0x8579('0xa')](_0x8579('0xb'),_0x5ce3ac,_[_0x8579('0x17')](_0x18b52d)?JSON[_0x8579('0x15')](_0x18b52d):_0x18b52d);logger[_0x8579('0x13')](_0x8579('0xe'),_0x5ce3ac);_0x5a8bb3[_0x8579('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 7343aab..a744f21 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 _0x37d3=['includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','2.0','method','login','stringify','POST','result','logged','channelId=','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','replace'];(function(_0x44e84d,_0x5aebed){var _0x198c73=function(_0x2b7bed){while(--_0x2b7bed){_0x44e84d['push'](_0x44e84d['shift']());}};_0x198c73(++_0x5aebed);}(_0x37d3,0xfb));var _0x337d=function(_0x52aeff,_0x12f130){_0x52aeff=_0x52aeff-0x0;var _0x2d4047=_0x37d3[_0x52aeff];return _0x2d4047;};'use strict';var rp=require('request-promise');var logger=require(_0x337d('0x0'))(_0x337d('0x1'));var _=require(_0x337d('0x2'));var arr=[];exports[_0x337d('0x3')]=function(_0x3a3855,_0x534ef1){return function(_0x2b8f05){var _0xb41388=_0x534ef1[0xa];var _0x438725=_0x534ef1[0xb];var _0x13ee6f=_0x534ef1[0xc];var _0x3a0177=_0x534ef1[0xd];var _0x5daf57=_0x534ef1[0xe];var _0x3e2d22=_0x534ef1[0xf]['replace'](/\n/g,'\x20-\x20');var _0x56d4f3=_0x534ef1[0x10][_0x337d('0x4')](/\n/g,'\x20');if(!arr[_0x337d('0x5')](_0x438725)){arr[_0x337d('0x6')](_0x438725);var _0x76b84d=_0x534ef1[0x3];var _0xabe886=_0x534ef1[0x4];var _0x1da7a4=_0x534ef1[0x1];var _0x521f9f=_0x534ef1[0x0];var _0x20777d={};_0x20777d[_0x337d('0x7')]=_0x534ef1[0x8]+'?params='+_0x13ee6f+'|'+_0xb41388+'|'+_0x3a0177+'|'+_0x438725+'|'+_0x5daf57;_0x20777d[_0x337d('0x8')]=_0x534ef1[0x7]+_0x337d('0x9')+_0x13ee6f+'|'+_0xb41388+'|'+_0x3a0177+'|'+_0x438725+'|'+_0x5daf57+'|'+_0x3e2d22+'|'+_0x56d4f3;_0x20777d[_0x337d('0xa')]=_0x534ef1[0x9];var _0xbbb203={};_0xbbb203[_0x337d('0xb')]=_0x337d('0xc');_0xbbb203[_0x337d('0xd')]=_0x337d('0xe');var _0x45363f=[];_0x45363f['push'](_0x534ef1[0x2]);_0x45363f[_0x337d('0x6')](_0x534ef1[0x5]);_0x45363f[_0x337d('0x6')](_0x534ef1[0x6]);_0xbbb203['params']=_0x45363f;_0xbbb203['id']=0x1;var _0x55f248=JSON[_0x337d('0xf')](_0xbbb203);var _0x274f83={'encoding':'utf8','method':_0x337d('0x10'),'timeout':0x2710,'url':_0x76b84d,'headers':{'Content-Type':'application/json-rpc'},'body':_0x55f248};return rp(_0x274f83)['then'](function(_0x3e7249){const _0x37432e=JSON['parse'](_0x3e7249);if(!_0x37432e[_0x337d('0x11')][_0x337d('0x12')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x67e324=_0x438725;var _0x1aa75d=_0x337d('0x13')+_0x1da7a4+_0x337d('0x14')+_0x521f9f+_0x337d('0x15')+_0x67e324+_0x337d('0x16')+JSON['stringify'](_0x20777d);var _0x470fdc=_0xabe886+'?'+_0x1aa75d;return rp(_0x470fdc);})[_0x337d('0x17')](function(_0xab9ea8){logger[_0x337d('0x18')](_0x337d('0x19'),_0x3a3855,_0xab9ea8);_0x2b8f05[_0x337d('0x1a')]();})[_0x337d('0x1b')](function(_0x18919b){logger[_0x337d('0x1c')]('[%s][TVOX]\x20%s',_0x3a3855,_[_0x337d('0x1d')](_0x18919b)?JSON[_0x337d('0xf')](_0x18919b):_0x18919b);_0x2b8f05[_0x337d('0x1a')]();});}else{logger[_0x337d('0x18')](_0x337d('0x1e'),_0x3a3855);_0x2b8f05[_0x337d('0x1f')]();}};}; \ No newline at end of file +var _0xc806=['../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','then','parse','logged','channelId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xc806,0xa5));var _0x6c80=function(_0x5b923e,_0x1707cb){_0x5b923e=_0x5b923e-0x0;var _0x21b3bf=_0xc806[_0x5b923e];return _0x21b3bf;};'use strict';var rp=require('request-promise');var logger=require(_0x6c80('0x0'))(_0x6c80('0x1'));var _=require(_0x6c80('0x2'));var arr=[];exports[_0x6c80('0x3')]=function(_0x4ebd6d,_0x1abee1){return function(_0x54b690){var _0x41cbea=_0x1abee1[0xa];var _0x194724=_0x1abee1[0xb];var _0x37283f=_0x1abee1[0xc];var _0x226640=_0x1abee1[0xd];var _0x187202=_0x1abee1[0xe];var _0x16dab3=_0x1abee1[0xf][_0x6c80('0x4')](/\n/g,_0x6c80('0x5'));var _0x1361c9=_0x1abee1[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x6c80('0x6')](_0x194724)){arr[_0x6c80('0x7')](_0x194724);var _0x275422=_0x1abee1[0x3];var _0x5a56d6=_0x1abee1[0x4];var _0x56c920=_0x1abee1[0x1];var _0x4d5293=_0x1abee1[0x0];var _0x34b732={};_0x34b732[_0x6c80('0x8')]=_0x1abee1[0x8]+_0x6c80('0x9')+_0x37283f+'|'+_0x41cbea+'|'+_0x226640+'|'+_0x194724+'|'+_0x187202;_0x34b732[_0x6c80('0xa')]=_0x1abee1[0x7]+_0x6c80('0x9')+_0x37283f+'|'+_0x41cbea+'|'+_0x226640+'|'+_0x194724+'|'+_0x187202+'|'+_0x16dab3+'|'+_0x1361c9;_0x34b732['title']=_0x1abee1[0x9];var _0x137ab2={};_0x137ab2[_0x6c80('0xb')]=_0x6c80('0xc');_0x137ab2[_0x6c80('0xd')]=_0x6c80('0xe');var _0x540169=[];_0x540169[_0x6c80('0x7')](_0x1abee1[0x2]);_0x540169[_0x6c80('0x7')](_0x1abee1[0x5]);_0x540169[_0x6c80('0x7')](_0x1abee1[0x6]);_0x137ab2[_0x6c80('0xf')]=_0x540169;_0x137ab2['id']=0x1;var _0x2dc594=JSON[_0x6c80('0x10')](_0x137ab2);var _0x1a9c3e={'encoding':'utf8','method':_0x6c80('0x11'),'timeout':0x2710,'url':_0x275422,'headers':{'Content-Type':_0x6c80('0x12')},'body':_0x2dc594};return rp(_0x1a9c3e)[_0x6c80('0x13')](function(_0x3b87b9){const _0x12cb05=JSON[_0x6c80('0x14')](_0x3b87b9);if(!_0x12cb05['result'][_0x6c80('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x28b50f=_0x194724;var _0x5f3905=_0x6c80('0x16')+_0x56c920+'&serviceId='+_0x4d5293+_0x6c80('0x17')+_0x28b50f+'&data='+JSON[_0x6c80('0x10')](_0x34b732);var _0x1a99f8=_0x5a56d6+'?'+_0x5f3905;return rp(_0x1a99f8);})[_0x6c80('0x13')](function(_0x417bbe){logger[_0x6c80('0x18')](_0x6c80('0x19'),_0x4ebd6d,_0x417bbe);_0x54b690[_0x6c80('0x1a')]();})[_0x6c80('0x1b')](function(_0x121f6e){logger[_0x6c80('0x1c')](_0x6c80('0x1d'),_0x4ebd6d,_[_0x6c80('0x1e')](_0x121f6e)?JSON[_0x6c80('0x10')](_0x121f6e):_0x121f6e);_0x54b690['stop']();});}else{logger[_0x6c80('0x18')](_0x6c80('0x1f'),_0x4ebd6d);_0x54b690[_0x6c80('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index bfb0fa4..48112e1 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4eabe4,_0x400d30){var _0x2c5bec=function(_0x2bb5ed){while(--_0x2bb5ed){_0x4eabe4['push'](_0x4eabe4['shift']());}};_0x2c5bec(++_0x400d30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1d7643,_0x11cecb){var _0xf27e63=function(_0x50eea2){while(--_0x50eea2){_0x1d7643['push'](_0x1d7643['shift']());}};_0xf27e63(++_0x11cecb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ea9b61c..2555fc2 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 _0xf5c0=['execute','Applications\x20executed','stringify','matchPath','emit','format','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','existsSync','join','.js','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','app','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xf5c0,0x9d));var _0x0f5c=function(_0x3daab5,_0x4c82c0){_0x3daab5=_0x3daab5-0x0;var _0x5c9961=_0xf5c0[_0x3daab5];return _0x5c9961;};'use strict';var _=require(_0x0f5c('0x0'));var util=require(_0x0f5c('0x1'));var path=require(_0x0f5c('0x2'));var fs=require('fs');var jayson=require(_0x0f5c('0x3'));var BPromise=require(_0x0f5c('0x4'));var utils=require(_0x0f5c('0x5'));var sUtils=require('./applications/strategy/util');var logger=require(_0x0f5c('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x0f5c('0x7')),'mailQueueReport':require(_0x0f5c('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x0f5c('0x9')),'faxQueueReport':require(_0x0f5c('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x0f5c('0xb'));function getId(_0x21a8ca,_0x101d64,_0x1775eb){return util['format'](_0x0f5c('0xc'),_0x21a8ca,_0x101d64||0x0,_0x1775eb||0x0);}function getIntervals(_0x1adca3,_0x296d3d){var _0x54261e=[];if(!_[_0x0f5c('0xd')](_0x296d3d['IntervalId'])&&!_['isNil'](_0x1adca3[_0x296d3d[_0x0f5c('0xe')]])&&!_['isNil'](_0x1adca3[_0x296d3d[_0x0f5c('0xe')]]['Intervals'])){_0x54261e=_['map'](_0x1adca3[_0x296d3d[_0x0f5c('0xe')]][_0x0f5c('0xf')],'interval');}else if(!_['isNil'](_0x296d3d[_0x0f5c('0x10')])){_0x54261e=[_0x296d3d[_0x0f5c('0x10')]];}return _0x54261e;}exports[_0x0f5c('0x11')]=function(_0x1b59b0){_0x1b59b0['rules']={};return new BPromise(function(_0x5a6120,_0x4f23a8){var _0xf8a69f={'Start':function(_0x2e61b1){var _0x2bcc2d=this;return new Promise(function(_0x2e01df,_0x27b77a){if(_0x2e61b1){try{var _0x69078c=[];var _0xcf78c4=getId(_0x2e61b1[_0x0f5c('0x12')],_0x2e61b1[_0x0f5c('0x13')]?_0x2e61b1['message']['id']:0x0,_0x2e61b1[_0x0f5c('0x14')]?_0x2e61b1[_0x0f5c('0x14')]['id']:0x0);var _0x29aed3=sUtils[_0x0f5c('0x15')](_0x1b59b0,_0x2e61b1);if(_0x2e61b1[_0x0f5c('0x16')]||!_0x29aed3&&_0x2e61b1[_0x0f5c('0x17')]&&_['isArray'](_0x2e61b1[_0x0f5c('0x17')])&&_0x2e61b1[_0x0f5c('0x17')][_0x0f5c('0x18')]){for(var _0x178eaa=0x0;_0x178eaa<_0x2e61b1[_0x0f5c('0x17')][_0x0f5c('0x18')];_0x178eaa+=0x1){var _0x166722=_0x2e61b1[_0x0f5c('0x17')][_0x178eaa];if(fs[_0x0f5c('0x19')](path[_0x0f5c('0x1a')](__dirname,'applications',_0x166722['app']+_0x0f5c('0x1b')))){var _0x1fb371=[];switch(_0x166722['app']['toLowerCase']()){case _0x0f5c('0x1c'):var _0x27ff90=_0x166722[_0x0f5c('0x1d')][_0x0f5c('0x1e')](',');if(_0x2e61b1['channel']===_0x0f5c('0x1f')){_0x1fb371['push'](_0x27ff90[0x0]);_0x1fb371['push'](_0x27ff90[0x1]);_0x1fb371[_0x0f5c('0x20')](_0x27ff90[_0x0f5c('0x21')](0x2,_0x27ff90[_0x0f5c('0x18')])[_0x0f5c('0x1a')](','));}else{_0x1fb371[_0x0f5c('0x20')](_0x27ff90[0x0]);_0x1fb371[_0x0f5c('0x20')](_0x27ff90[_0x0f5c('0x21')](0x1,_0x27ff90[_0x0f5c('0x18')])[_0x0f5c('0x1a')](','));}break;case _0x0f5c('0x22'):var _0x178d46=_0x166722[_0x0f5c('0x1d')][_0x0f5c('0x1e')](',');_0x1fb371[_0x0f5c('0x20')](_0x178d46[0x0]);_0x1fb371[_0x0f5c('0x20')](_0x178d46[0x1]);_0x1fb371[_0x0f5c('0x20')](_0x178d46[_0x0f5c('0x21')](0x2,_0x178d46[_0x0f5c('0x18')])[_0x0f5c('0x1a')](','));break;case _0x0f5c('0x23'):var _0x50293b=_0x166722[_0x0f5c('0x1d')][_0x0f5c('0x1e')](',');_0x1fb371[_0x0f5c('0x20')](_0x50293b[0x0]);_0x1fb371[_0x0f5c('0x20')](_0x50293b[0x1]);_0x1fb371[_0x0f5c('0x20')](_0x50293b[0x2]);_0x1fb371[_0x0f5c('0x20')](_0x50293b[0x3]);_0x1fb371[_0x0f5c('0x20')](_0x50293b[_0x0f5c('0x21')](0x4,_0x50293b[_0x0f5c('0x18')])[_0x0f5c('0x1a')](','));break;case'amazonlex':var _0x22b3b3=_0x166722['appdata'][_0x0f5c('0x1e')](',');_0x1fb371[_0x0f5c('0x20')](_0x22b3b3[0x0]);_0x1fb371['push'](_0x22b3b3[0x1]);_0x1fb371['push'](_0x22b3b3[0x2]);_0x1fb371[_0x0f5c('0x20')](_0x22b3b3[0x3]);_0x1fb371[_0x0f5c('0x20')](_0x22b3b3[_0x0f5c('0x21')](0x4,_0x22b3b3['length'])[_0x0f5c('0x1a')](','));break;case _0x0f5c('0x13'):_0x1fb371['push'](_0x166722[_0x0f5c('0x1d')]);break;case _0x0f5c('0x24'):_0x1fb371[_0x0f5c('0x20')](_0x166722[_0x0f5c('0x25')]);_0x1fb371[_0x0f5c('0x20')](_0x166722[_0x0f5c('0x1d')]);break;case _0x0f5c('0x26'):var _0x595ef9=utils[_0x0f5c('0x27')](_0x2e61b1[_0x0f5c('0x28')][_0x0f5c('0x29')],_0x2e61b1);var _0x4e3ceb=_0x166722[_0x0f5c('0x1d')][_0x0f5c('0x1e')](',');_0x1fb371['push'](_0x4e3ceb[0x0]);_0x1fb371[_0x0f5c('0x20')](_0x4e3ceb[0x1]);_0x1fb371[_0x0f5c('0x20')](_0x4e3ceb[0x2]);_0x1fb371[_0x0f5c('0x20')](_0x4e3ceb[0x3]);_0x1fb371[_0x0f5c('0x20')](_0x4e3ceb[0x4]);_0x1fb371[_0x0f5c('0x20')](_0x4e3ceb[0x5]);_0x1fb371[_0x0f5c('0x20')](_0x4e3ceb[0x6]);_0x1fb371[_0x0f5c('0x20')](_0x4e3ceb[0x7]);_0x1fb371[_0x0f5c('0x20')](_0x4e3ceb[0x8]);_0x1fb371['push'](_0x4e3ceb[0x9]);_0x1fb371[_0x0f5c('0x20')](_0x4e3ceb[0xa]);_0x1fb371[_0x0f5c('0x20')](_0x2e61b1['interaction']['id']);_0x1fb371['push'](_0x2e61b1[_0x0f5c('0x13')]['id']);_0x1fb371[_0x0f5c('0x20')](_0x166722[_0x0f5c('0x2a')]);_0x1fb371[_0x0f5c('0x20')](_0x2e61b1['interaction'][_0x0f5c('0x2b')]);_0x1fb371['push'](_0x2e61b1[_0x0f5c('0x2c')][_0x0f5c('0x2c')]);_0x1fb371[_0x0f5c('0x20')](_0x595ef9);break;default:_0x1fb371=_[_0x0f5c('0xd')](_0x166722[_0x0f5c('0x1d')])?[]:_0x166722[_0x0f5c('0x1d')][_0x0f5c('0x1e')](',');}var _0x46825b={'id':util['format'](_0x0f5c('0x2d'),_0xcf78c4,_0x166722['id'],_0x166722[_0x0f5c('0x2e')]),'condition':require(_0x0f5c('0x2f'))[_0x0f5c('0x30')](_0xcf78c4,getIntervals(_0x1b59b0[_0x0f5c('0x31')],_0x166722),_0x1b59b0),'consequence':require(_0x0f5c('0x32')+_0x166722[_0x0f5c('0x2e')])[_0x0f5c('0x33')](_0xcf78c4,_0x1fb371,_0x1b59b0,_0x2e61b1),'p':_0x166722[_0x0f5c('0x34')]||0x0};logger['info'](_0x0f5c('0x35'),_0x46825b['id'],_0x0f5c('0x36'),getIntervals(_0x1b59b0[_0x0f5c('0x31')],_0x166722)[_0x0f5c('0x1a')](_0x0f5c('0x37')));_0x69078c['push'](_0x46825b);}else{logger[_0x0f5c('0x38')](_0x0f5c('0x39'),path['join'](__dirname,_0x0f5c('0x17'),_0x166722[_0x0f5c('0x2e')]+_0x0f5c('0x1b')));}}_0x1b59b0[_0x0f5c('0x3a')][_0xcf78c4]=new RuleEngine(_0x69078c);_0x1b59b0[_0x0f5c('0x3a')][_0xcf78c4][_0x0f5c('0x3b')](_0x2e61b1,function(_0x551366){logger['info'](_0x0f5c('0x3c'),JSON[_0x0f5c('0x3d')](_0x551366[_0x0f5c('0x3e')]));if(_0x1b59b0['rules'][_0xcf78c4]){_0x1b59b0[_0x0f5c('0x3a')][_0xcf78c4][_0x0f5c('0x3f')]('complete');}});return _0x2e01df({'code':0xc8,'message':_0x2e61b1});}else{if(_0x29aed3){logger['info'](util[_0x0f5c('0x40')](_0x0f5c('0x41'),_0xcf78c4));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x2e01df({'code':0xc8,'message':_0x2e61b1});}}catch(_0x1cf467){logger['error'](_0x1cf467[_0x0f5c('0x42')]);return _0x27b77a(_0x2bcc2d[_0x0f5c('0x38')](0x1f4,_0x1cf467));}}return _0x27b77a(_0x0f5c('0x43'));});},'AcceptMessage':function(_0x188467){var _0x4fe2e5=this;return new Promise(function(_0x1578b8,_0x3b2848){if(_0x188467[_0x0f5c('0x44')]&&_0x188467['agent']['id']){if(_0x1b59b0[_0x0f5c('0x45')][_0x188467[_0x0f5c('0x44')]['id']]){_0x1b59b0[_0x0f5c('0x45')][_0x188467[_0x0f5c('0x44')]['id']][_0x0f5c('0x46')]=![];_0x1b59b0[_0x0f5c('0x45')][_0x188467[_0x0f5c('0x44')]['id']][_0x0f5c('0x47')]=undefined;}}if(_0x188467[_0x0f5c('0x13')]&&_0x188467[_0x0f5c('0x13')]['id']){try{var _0x40e4ec=getId(_0x188467[_0x0f5c('0x12')],_0x188467[_0x0f5c('0x13')]?_0x188467[_0x0f5c('0x13')]['id']:0x0,_0x188467['interaction']?_0x188467[_0x0f5c('0x14')]['id']:0x0);if(_0x1b59b0[_0x0f5c('0x3a')][_0x40e4ec]){_0x1b59b0[_0x0f5c('0x3a')][_0x40e4ec][_0x0f5c('0x3f')](_0x0f5c('0x48'));if(rpc[_0x188467['channel']+_0x0f5c('0x49')]){rpc[_0x188467[_0x0f5c('0x12')]+_0x0f5c('0x49')][_0x0f5c('0x4a')](_0x40e4ec,{'UserId':_0x188467[_0x0f5c('0x13')][_0x0f5c('0x4b')]})[_0x0f5c('0x4c')](function(){logger[_0x0f5c('0x38')](_0x0f5c('0x4d'));});}}return _0x1578b8({'code':0xc8,'message':_0x188467});}catch(_0x51b6fa){logger[_0x0f5c('0x38')](_0x51b6fa[_0x0f5c('0x42')]);return _0x3b2848(_0x4fe2e5[_0x0f5c('0x38')](0x1f4,_0x51b6fa));}}logger['error']('message\x20is\x20empty');return _0x3b2848(_0x4fe2e5[_0x0f5c('0x38')](0x1f4,_0x0f5c('0x4e')));});},'RejectMessage':function(_0x5b0c2a){var _0x5cfc9b=this;return new Promise(function(_0x197abb,_0xc309a4){if(_0x5b0c2a[_0x0f5c('0x44')]&&_0x5b0c2a['agent']['id']){try{if(_0x1b59b0['agents'][_0x5b0c2a['agent']['id']]){_0x1b59b0[_0x0f5c('0x45')][_0x5b0c2a['agent']['id']][_0x0f5c('0x46')]=![];_0x1b59b0[_0x0f5c('0x45')][_0x5b0c2a[_0x0f5c('0x44')]['id']]['busyQueue']=undefined;}return _0x197abb({'code':0xc8,'message':_0x5b0c2a});}catch(_0x233c0d){logger[_0x0f5c('0x38')](_0x233c0d[_0x0f5c('0x42')]);return _0xc309a4(_0x5cfc9b[_0x0f5c('0x38')](0x1f4,_0x233c0d));}}logger[_0x0f5c('0x38')](_0x0f5c('0x4e'));return _0xc309a4(_0x5cfc9b[_0x0f5c('0x38')](0x1f4,_0x0f5c('0x4e')));});},'AbandonInteraction':function(_0xa99a26){var _0x66f7bb=this;return new Promise(function(_0x1b7f23,_0x39ebec){if(_0xa99a26[_0x0f5c('0x12')]&&_0xa99a26['interaction']&&_0xa99a26[_0x0f5c('0x14')]['id']){try{var _0x257cba=getId(_0xa99a26[_0x0f5c('0x12')],_0xa99a26[_0x0f5c('0x13')]?_0xa99a26[_0x0f5c('0x13')]['id']:0x0,_0xa99a26['interaction']?_0xa99a26[_0x0f5c('0x14')]['id']:0x0);if(_0x1b59b0[_0x0f5c('0x3a')][_0x257cba]){_0x1b59b0[_0x0f5c('0x3a')][_0x257cba][_0x0f5c('0x3f')]('end');}return _0x1b7f23({'code':0xc8,'message':_0xa99a26});}catch(_0x166a81){logger['error'](_0x166a81[_0x0f5c('0x42')]);return _0x39ebec(_0x66f7bb[_0x0f5c('0x38')](0x1f4,_0x166a81));}}logger['error'](_0x0f5c('0x4e'));return _0x39ebec(_0x66f7bb['error'](0x1f4,_0x0f5c('0x4e')));});},'AgentCapacity':function(_0x5c8265){var _0x12c78e=this;return new Promise(function(_0x4e38aa,_0x4d5535){if(_0x1b59b0[_0x0f5c('0x45')][_0x0f5c('0x4f')](_0x5c8265['id'])){for(var _0x43aedd in _0x5c8265[_0x0f5c('0x50')]){if(_0x5c8265['capacity']['hasOwnProperty'](_0x43aedd)){if(_0x1b59b0[_0x0f5c('0x45')][_0x5c8265['id']][_0x0f5c('0x4f')](_0x43aedd+_0x0f5c('0x51'))){_0x1b59b0['agents'][_0x5c8265['id']][_0x43aedd+_0x0f5c('0x51')]=parseInt(_0x5c8265[_0x0f5c('0x50')][_0x43aedd],0xa);}}}_0x1b59b0['agents'][_0x5c8265['id']][_0x0f5c('0x52')]();return _0x4e38aa({'code':0xc8,'message':_0x1b59b0[_0x0f5c('0x45')][_0x5c8265['id']]});}else{return _0x4d5535(_0x12c78e[_0x0f5c('0x38')](0x1f4,_0x0f5c('0x53')));}});},'Agents':function(_0x1de70f){return new Promise(function(_0x1a3957){var _0x2b8ab6=_[_0x0f5c('0x54')](_0x1b59b0[_0x0f5c('0x45')]);if(_0x1de70f&&_0x1de70f['id']){var _0x499ea8=_[_0x0f5c('0x55')](_0x2b8ab6,function(_0x17446f){return _0x17446f['id']===_0x1de70f['id'];});_0x1a3957(_0x499ea8);}else{_0x1a3957({'count':_0x2b8ab6[_0x0f5c('0x18')],'rows':_0x2b8ab6});}});},'ChatQueues':function(){return new Promise(function(_0x137906){var _0x532024=[];for(var _0x1611b6 in _0x1b59b0[_0x0f5c('0x56')]){if(_0x1b59b0['chatQueues'][_0x0f5c('0x4f')](_0x1611b6)){var _0xb74756=_0x1b59b0[_0x0f5c('0x56')][_0x1611b6];var _0x2a07c9={'id':_0xb74756['id'],'available':_0xb74756[_0x0f5c('0x57')],'loggedIn':_0xb74756[_0x0f5c('0x58')],'name':_0xb74756[_0x0f5c('0x59')],'paused':_0xb74756[_0x0f5c('0x5a')],'waiting':_0xb74756[_0x0f5c('0x5b')]};_0x532024[_0x0f5c('0x20')](_0x2a07c9);}}_0x137906({'count':_0x532024[_0x0f5c('0x18')],'rows':_0x532024});});},'MailQueues':function(){return new Promise(function(_0x151d90){var _0x3122e3=[];for(var _0x4d82ee in _0x1b59b0[_0x0f5c('0x5c')]){if(_0x1b59b0[_0x0f5c('0x5c')][_0x0f5c('0x4f')](_0x4d82ee)){var _0xa15ec4=_0x1b59b0[_0x0f5c('0x5c')][_0x4d82ee];var _0x11ac0f={'id':_0xa15ec4['id'],'available':_0xa15ec4['available'],'loggedIn':_0xa15ec4['loggedIn'],'name':_0xa15ec4['name'],'paused':_0xa15ec4[_0x0f5c('0x5a')],'waiting':_0xa15ec4[_0x0f5c('0x5b')]};_0x3122e3[_0x0f5c('0x20')](_0x11ac0f);}}_0x151d90({'count':_0x3122e3['length'],'rows':_0x3122e3});});},'OpenchannelQueues':function(){return new Promise(function(_0x2598d7){var _0x6ecc92=[];for(var _0x4a9a9a in _0x1b59b0[_0x0f5c('0x5d')]){if(_0x1b59b0[_0x0f5c('0x5d')][_0x0f5c('0x4f')](_0x4a9a9a)){var _0x13ab98=_0x1b59b0[_0x0f5c('0x5d')][_0x4a9a9a];var _0x50f738={'id':_0x13ab98['id'],'available':_0x13ab98[_0x0f5c('0x57')],'loggedIn':_0x13ab98[_0x0f5c('0x58')],'name':_0x13ab98[_0x0f5c('0x59')],'paused':_0x13ab98[_0x0f5c('0x5a')],'waiting':_0x13ab98[_0x0f5c('0x5b')]};_0x6ecc92[_0x0f5c('0x20')](_0x50f738);}}_0x2598d7({'count':_0x6ecc92[_0x0f5c('0x18')],'rows':_0x6ecc92});});},'SmsQueues':function(){return new Promise(function(_0x57e39a){var _0x2eb112=[];for(var _0x5984cd in _0x1b59b0[_0x0f5c('0x5e')]){if(_0x1b59b0[_0x0f5c('0x5e')]['hasOwnProperty'](_0x5984cd)){var _0x2c247f=_0x1b59b0[_0x0f5c('0x5e')][_0x5984cd];var _0x3b7607={'id':_0x2c247f['id'],'available':_0x2c247f['available'],'loggedIn':_0x2c247f[_0x0f5c('0x58')],'name':_0x2c247f[_0x0f5c('0x59')],'paused':_0x2c247f[_0x0f5c('0x5a')],'waiting':_0x2c247f[_0x0f5c('0x5b')]};_0x2eb112[_0x0f5c('0x20')](_0x3b7607);}}_0x57e39a({'count':_0x2eb112['length'],'rows':_0x2eb112});});},'FaxQueues':function(){return new Promise(function(_0x168e3f){var _0xb5e72=[];for(var _0x4d3246 in _0x1b59b0[_0x0f5c('0x5f')]){if(_0x1b59b0[_0x0f5c('0x5f')]['hasOwnProperty'](_0x4d3246)){var _0x28db47=_0x1b59b0[_0x0f5c('0x5f')][_0x4d3246];var _0x2e7fec={'id':_0x28db47['id'],'available':_0x28db47[_0x0f5c('0x57')],'loggedIn':_0x28db47[_0x0f5c('0x58')],'name':_0x28db47[_0x0f5c('0x59')],'paused':_0x28db47[_0x0f5c('0x5a')],'waiting':_0x28db47[_0x0f5c('0x5b')]};_0xb5e72[_0x0f5c('0x20')](_0x2e7fec);}}_0x168e3f({'count':_0xb5e72['length'],'rows':_0xb5e72});});},'WhatsappQueues':function(){return new Promise(function(_0x156317){var _0x39a51e=[];for(var _0x5b2211 in _0x1b59b0[_0x0f5c('0x60')]){if(_0x1b59b0[_0x0f5c('0x60')][_0x0f5c('0x4f')](_0x5b2211)){var _0x4eb896=_0x1b59b0[_0x0f5c('0x60')][_0x5b2211];var _0x21c3af={'id':_0x4eb896['id'],'available':_0x4eb896['available'],'loggedIn':_0x4eb896[_0x0f5c('0x58')],'name':_0x4eb896[_0x0f5c('0x59')],'paused':_0x4eb896[_0x0f5c('0x5a')],'waiting':_0x4eb896['waiting']};_0x39a51e['push'](_0x21c3af);}}_0x156317({'count':_0x39a51e[_0x0f5c('0x18')],'rows':_0x39a51e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5e9c45){var _0x56bcc5=_[_0x0f5c('0x54')](_0x1b59b0[_0x0f5c('0x61')]);_0x5e9c45({'count':_0x56bcc5[_0x0f5c('0x18')],'rows':_0x56bcc5});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1ba4d3){var _0x59ff3f=_[_0x0f5c('0x54')](_0x1b59b0[_0x0f5c('0x62')]);_0x1ba4d3({'count':_0x59ff3f[_0x0f5c('0x18')],'rows':_0x59ff3f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x53bc3f){var _0x577bb5=_[_0x0f5c('0x54')](_0x1b59b0[_0x0f5c('0x63')]);_0x53bc3f({'count':_0x577bb5[_0x0f5c('0x18')],'rows':_0x577bb5});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4c0c56){var _0x3095ea=_['values'](_0x1b59b0[_0x0f5c('0x64')]);_0x4c0c56({'count':_0x3095ea[_0x0f5c('0x18')],'rows':_0x3095ea});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x10b056){var _0x2af50f=_['values'](_0x1b59b0[_0x0f5c('0x65')]);_0x10b056({'count':_0x2af50f['length'],'rows':_0x2af50f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x40a84a){var _0x238db3=_[_0x0f5c('0x54')](_0x1b59b0[_0x0f5c('0x66')]);_0x40a84a({'count':_0x238db3['length'],'rows':_0x238db3});});}};var _0x389d22=jayson[_0x0f5c('0x67')](_0xf8a69f)[_0x0f5c('0x68')]();_0x389d22['on'](_0x0f5c('0x38'),function(_0x26bfae){logger['error'](JSON[_0x0f5c('0x3d')](_0x26bfae));return _0x4f23a8(_0x26bfae);});_0x389d22[_0x0f5c('0x11')](0x232c,_0x0f5c('0x69'),function(){console[_0x0f5c('0x6a')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x5a6120(_0x0f5c('0x6b')+0x232c);});});}; \ No newline at end of file +var _0xf4a9=['Push\x20new\x20rule','on\x20interval','\x20|\x20','execute','info','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','agent','agents','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','find','chatQueues','available','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','loggedIn','faxQueues','whatsappQueues','values','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','mail','push','slice','split','dialogflowv2','appdata','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority'];(function(_0x4d65c0,_0x3fc577){var _0x3683a3=function(_0x41cabb){while(--_0x41cabb){_0x4d65c0['push'](_0x4d65c0['shift']());}};_0x3683a3(++_0x3fc577);}(_0xf4a9,0x164));var _0x9f4a=function(_0x12723c,_0x148a5a){_0x12723c=_0x12723c-0x0;var _0x3fc804=_0xf4a9[_0x12723c];return _0x3fc804;};'use strict';var _=require(_0x9f4a('0x0'));var util=require(_0x9f4a('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x9f4a('0x2'));var BPromise=require(_0x9f4a('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x9f4a('0x4'));var logger=require(_0x9f4a('0x5'))(_0x9f4a('0x6'));var rpc={'openchannelQueueReport':require(_0x9f4a('0x7')),'mailQueueReport':require(_0x9f4a('0x8')),'chatQueueReport':require(_0x9f4a('0x9')),'smsQueueReport':require(_0x9f4a('0xa')),'faxQueueReport':require(_0x9f4a('0xb')),'whatsappQueueReport':require(_0x9f4a('0xc'))};var RuleEngine=require(_0x9f4a('0xd'));function getId(_0x485bcc,_0x23576c,_0xe24605){return util[_0x9f4a('0xe')](_0x9f4a('0xf'),_0x485bcc,_0x23576c||0x0,_0xe24605||0x0);}function getIntervals(_0x6bffff,_0x3a1781){var _0x14264e=[];if(!_[_0x9f4a('0x10')](_0x3a1781[_0x9f4a('0x11')])&&!_['isNil'](_0x6bffff[_0x3a1781['IntervalId']])&&!_[_0x9f4a('0x10')](_0x6bffff[_0x3a1781[_0x9f4a('0x11')]][_0x9f4a('0x12')])){_0x14264e=_[_0x9f4a('0x13')](_0x6bffff[_0x3a1781[_0x9f4a('0x11')]][_0x9f4a('0x12')],_0x9f4a('0x14'));}else if(!_[_0x9f4a('0x10')](_0x3a1781[_0x9f4a('0x14')])){_0x14264e=[_0x3a1781[_0x9f4a('0x14')]];}return _0x14264e;}exports[_0x9f4a('0x15')]=function(_0x2c1398){_0x2c1398[_0x9f4a('0x16')]={};return new BPromise(function(_0x52d0ee,_0x973739){var _0x2525b5={'Start':function(_0x579574){var _0x38454c=this;return new Promise(function(_0x16e448,_0x157754){if(_0x579574){try{var _0xf2b5a1=[];var _0x30582f=getId(_0x579574[_0x9f4a('0x17')],_0x579574[_0x9f4a('0x18')]?_0x579574[_0x9f4a('0x18')]['id']:0x0,_0x579574[_0x9f4a('0x19')]?_0x579574['interaction']['id']:0x0);var _0x5f3050=sUtils[_0x9f4a('0x1a')](_0x2c1398,_0x579574);if(_0x579574[_0x9f4a('0x1b')]||!_0x5f3050&&_0x579574[_0x9f4a('0x1c')]&&_[_0x9f4a('0x1d')](_0x579574[_0x9f4a('0x1c')])&&_0x579574[_0x9f4a('0x1c')]['length']){for(var _0x15fdc5=0x0;_0x15fdc5<_0x579574[_0x9f4a('0x1c')][_0x9f4a('0x1e')];_0x15fdc5+=0x1){var _0x74776b=_0x579574['applications'][_0x15fdc5];if(fs[_0x9f4a('0x1f')](path[_0x9f4a('0x20')](__dirname,_0x9f4a('0x1c'),_0x74776b[_0x9f4a('0x21')]+_0x9f4a('0x22')))){var _0x557a2e=[];switch(_0x74776b['app'][_0x9f4a('0x23')]()){case'autoreply':var _0x56b767=_0x74776b['appdata']['split'](',');if(_0x579574[_0x9f4a('0x17')]===_0x9f4a('0x24')){_0x557a2e['push'](_0x56b767[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x56b767[0x1]);_0x557a2e[_0x9f4a('0x25')](_0x56b767['slice'](0x2,_0x56b767['length'])[_0x9f4a('0x20')](','));}else{_0x557a2e[_0x9f4a('0x25')](_0x56b767[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x56b767[_0x9f4a('0x26')](0x1,_0x56b767[_0x9f4a('0x1e')])[_0x9f4a('0x20')](','));}break;case'dialogflow':var _0xa60a21=_0x74776b['appdata'][_0x9f4a('0x27')](',');_0x557a2e[_0x9f4a('0x25')](_0xa60a21[0x0]);_0x557a2e[_0x9f4a('0x25')](_0xa60a21[0x1]);_0x557a2e[_0x9f4a('0x25')](_0xa60a21[_0x9f4a('0x26')](0x2,_0xa60a21[_0x9f4a('0x1e')])[_0x9f4a('0x20')](','));break;case _0x9f4a('0x28'):var _0x1ea51=_0x74776b[_0x9f4a('0x29')][_0x9f4a('0x27')](',');_0x557a2e[_0x9f4a('0x25')](_0x1ea51[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x1ea51[0x1]);_0x557a2e[_0x9f4a('0x25')](_0x1ea51[0x2]);_0x557a2e['push'](_0x1ea51[0x3]);_0x557a2e[_0x9f4a('0x25')](_0x1ea51[_0x9f4a('0x26')](0x4,_0x1ea51[_0x9f4a('0x1e')])[_0x9f4a('0x20')](','));break;case'amazonlex':var _0x272b96=_0x74776b[_0x9f4a('0x29')][_0x9f4a('0x27')](',');_0x557a2e[_0x9f4a('0x25')](_0x272b96[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x272b96[0x1]);_0x557a2e['push'](_0x272b96[0x2]);_0x557a2e[_0x9f4a('0x25')](_0x272b96[0x3]);_0x557a2e[_0x9f4a('0x25')](_0x272b96[_0x9f4a('0x26')](0x4,_0x272b96[_0x9f4a('0x1e')])[_0x9f4a('0x20')](','));break;case _0x9f4a('0x18'):_0x557a2e[_0x9f4a('0x25')](_0x74776b[_0x9f4a('0x29')]);break;case _0x9f4a('0x2a'):_0x557a2e[_0x9f4a('0x25')](_0x74776b[_0x9f4a('0x2b')]);_0x557a2e[_0x9f4a('0x25')](_0x74776b['appdata']);break;case _0x9f4a('0x2c'):var _0x4bf7d6=utils[_0x9f4a('0x2d')](_0x579574[_0x9f4a('0x2e')][_0x9f4a('0x2f')],_0x579574);var _0x5e1df9=_0x74776b[_0x9f4a('0x29')][_0x9f4a('0x27')](',');_0x557a2e['push'](_0x5e1df9[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x1]);_0x557a2e['push'](_0x5e1df9[0x2]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x3]);_0x557a2e['push'](_0x5e1df9[0x4]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x5]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x6]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x7]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x8]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x9]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0xa]);_0x557a2e[_0x9f4a('0x25')](_0x579574[_0x9f4a('0x19')]['id']);_0x557a2e[_0x9f4a('0x25')](_0x579574[_0x9f4a('0x18')]['id']);_0x557a2e[_0x9f4a('0x25')](_0x74776b['ChatWebsiteId']);_0x557a2e['push'](_0x579574[_0x9f4a('0x19')][_0x9f4a('0x30')]);_0x557a2e[_0x9f4a('0x25')](_0x579574[_0x9f4a('0x31')][_0x9f4a('0x31')]);_0x557a2e['push'](_0x4bf7d6);break;default:_0x557a2e=_['isNil'](_0x74776b['appdata'])?[]:_0x74776b[_0x9f4a('0x29')][_0x9f4a('0x27')](',');}var _0x16cd24={'id':util[_0x9f4a('0xe')](_0x9f4a('0x32'),_0x30582f,_0x74776b['id'],_0x74776b[_0x9f4a('0x21')]),'condition':require(_0x9f4a('0x33'))['condition'](_0x30582f,getIntervals(_0x2c1398[_0x9f4a('0x34')],_0x74776b),_0x2c1398),'consequence':require(_0x9f4a('0x35')+_0x74776b[_0x9f4a('0x21')])[_0x9f4a('0x36')](_0x30582f,_0x557a2e,_0x2c1398,_0x579574),'p':_0x74776b[_0x9f4a('0x37')]||0x0};logger['info'](_0x9f4a('0x38'),_0x16cd24['id'],_0x9f4a('0x39'),getIntervals(_0x2c1398[_0x9f4a('0x34')],_0x74776b)['join'](_0x9f4a('0x3a')));_0xf2b5a1[_0x9f4a('0x25')](_0x16cd24);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x9f4a('0x20')](__dirname,'applications',_0x74776b['app']+_0x9f4a('0x22')));}}_0x2c1398[_0x9f4a('0x16')][_0x30582f]=new RuleEngine(_0xf2b5a1);_0x2c1398['rules'][_0x30582f][_0x9f4a('0x3b')](_0x579574,function(_0x2a0c84){logger[_0x9f4a('0x3c')](_0x9f4a('0x3d'),JSON[_0x9f4a('0x3e')](_0x2a0c84[_0x9f4a('0x3f')]));if(_0x2c1398[_0x9f4a('0x16')][_0x30582f]){_0x2c1398[_0x9f4a('0x16')][_0x30582f][_0x9f4a('0x40')]('complete');}});return _0x16e448({'code':0xc8,'message':_0x579574});}else{if(_0x5f3050){logger[_0x9f4a('0x3c')](util[_0x9f4a('0xe')](_0x9f4a('0x41'),_0x30582f));}else{logger['info'](_0x9f4a('0x42'));}return _0x16e448({'code':0xc8,'message':_0x579574});}}catch(_0x6f88b6){logger['error'](_0x6f88b6[_0x9f4a('0x43')]);return _0x157754(_0x38454c[_0x9f4a('0x44')](0x1f4,_0x6f88b6));}}return _0x157754(_0x9f4a('0x45'));});},'AcceptMessage':function(_0x3cb5c4){var _0x4ffb1d=this;return new Promise(function(_0x566e35,_0x210a36){if(_0x3cb5c4[_0x9f4a('0x46')]&&_0x3cb5c4[_0x9f4a('0x46')]['id']){if(_0x2c1398['agents'][_0x3cb5c4[_0x9f4a('0x46')]['id']]){_0x2c1398['agents'][_0x3cb5c4['agent']['id']]['busy']=![];_0x2c1398[_0x9f4a('0x47')][_0x3cb5c4[_0x9f4a('0x46')]['id']]['busyQueue']=undefined;}}if(_0x3cb5c4[_0x9f4a('0x18')]&&_0x3cb5c4[_0x9f4a('0x18')]['id']){try{var _0x7df13b=getId(_0x3cb5c4[_0x9f4a('0x17')],_0x3cb5c4[_0x9f4a('0x18')]?_0x3cb5c4[_0x9f4a('0x18')]['id']:0x0,_0x3cb5c4[_0x9f4a('0x19')]?_0x3cb5c4['interaction']['id']:0x0);if(_0x2c1398['rules'][_0x7df13b]){_0x2c1398['rules'][_0x7df13b][_0x9f4a('0x40')](_0x9f4a('0x48'));if(rpc[_0x3cb5c4['channel']+_0x9f4a('0x49')]){rpc[_0x3cb5c4[_0x9f4a('0x17')]+_0x9f4a('0x49')][_0x9f4a('0x4a')](_0x7df13b,{'UserId':_0x3cb5c4[_0x9f4a('0x18')][_0x9f4a('0x4b')]})['catch'](function(){logger[_0x9f4a('0x44')](_0x9f4a('0x4c'));});}}return _0x566e35({'code':0xc8,'message':_0x3cb5c4});}catch(_0x5ddf5a){logger[_0x9f4a('0x44')](_0x5ddf5a[_0x9f4a('0x43')]);return _0x210a36(_0x4ffb1d[_0x9f4a('0x44')](0x1f4,_0x5ddf5a));}}logger[_0x9f4a('0x44')]('message\x20is\x20empty');return _0x210a36(_0x4ffb1d[_0x9f4a('0x44')](0x1f4,_0x9f4a('0x4d')));});},'RejectMessage':function(_0x44dbd4){var _0x2588ce=this;return new Promise(function(_0x1dc152,_0x13d24f){if(_0x44dbd4['agent']&&_0x44dbd4[_0x9f4a('0x46')]['id']){try{if(_0x2c1398[_0x9f4a('0x47')][_0x44dbd4[_0x9f4a('0x46')]['id']]){_0x2c1398[_0x9f4a('0x47')][_0x44dbd4[_0x9f4a('0x46')]['id']][_0x9f4a('0x4e')]=![];_0x2c1398['agents'][_0x44dbd4[_0x9f4a('0x46')]['id']]['busyQueue']=undefined;}return _0x1dc152({'code':0xc8,'message':_0x44dbd4});}catch(_0x58e6a5){logger[_0x9f4a('0x44')](_0x58e6a5[_0x9f4a('0x43')]);return _0x13d24f(_0x2588ce[_0x9f4a('0x44')](0x1f4,_0x58e6a5));}}logger[_0x9f4a('0x44')](_0x9f4a('0x4d'));return _0x13d24f(_0x2588ce[_0x9f4a('0x44')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2cb72a){var _0x631ccf=this;return new Promise(function(_0x175a58,_0x4e8edb){if(_0x2cb72a[_0x9f4a('0x17')]&&_0x2cb72a[_0x9f4a('0x19')]&&_0x2cb72a[_0x9f4a('0x19')]['id']){try{var _0x4b410d=getId(_0x2cb72a['channel'],_0x2cb72a[_0x9f4a('0x18')]?_0x2cb72a['message']['id']:0x0,_0x2cb72a['interaction']?_0x2cb72a[_0x9f4a('0x19')]['id']:0x0);if(_0x2c1398['rules'][_0x4b410d]){_0x2c1398[_0x9f4a('0x16')][_0x4b410d][_0x9f4a('0x40')]('end');}return _0x175a58({'code':0xc8,'message':_0x2cb72a});}catch(_0x2fc737){logger['error'](_0x2fc737['stack']);return _0x4e8edb(_0x631ccf[_0x9f4a('0x44')](0x1f4,_0x2fc737));}}logger[_0x9f4a('0x44')](_0x9f4a('0x4d'));return _0x4e8edb(_0x631ccf[_0x9f4a('0x44')](0x1f4,_0x9f4a('0x4d')));});},'AgentCapacity':function(_0x445749){var _0x34bc31=this;return new Promise(function(_0x197121,_0x191277){if(_0x2c1398['agents']['hasOwnProperty'](_0x445749['id'])){for(var _0x4fbf3b in _0x445749[_0x9f4a('0x4f')]){if(_0x445749[_0x9f4a('0x4f')][_0x9f4a('0x50')](_0x4fbf3b)){if(_0x2c1398[_0x9f4a('0x47')][_0x445749['id']][_0x9f4a('0x50')](_0x4fbf3b+_0x9f4a('0x51'))){_0x2c1398[_0x9f4a('0x47')][_0x445749['id']][_0x4fbf3b+_0x9f4a('0x51')]=parseInt(_0x445749['capacity'][_0x4fbf3b],0xa);}}}_0x2c1398[_0x9f4a('0x47')][_0x445749['id']]['updateRealtime']();return _0x197121({'code':0xc8,'message':_0x2c1398[_0x9f4a('0x47')][_0x445749['id']]});}else{return _0x191277(_0x34bc31[_0x9f4a('0x44')](0x1f4,_0x9f4a('0x52')));}});},'Agents':function(_0x5ab21f){return new Promise(function(_0x56c510){var _0x543253=_['values'](_0x2c1398[_0x9f4a('0x47')]);if(_0x5ab21f&&_0x5ab21f['id']){var _0x1a4e7a=_[_0x9f4a('0x53')](_0x543253,function(_0xd5828e){return _0xd5828e['id']===_0x5ab21f['id'];});_0x56c510(_0x1a4e7a);}else{_0x56c510({'count':_0x543253[_0x9f4a('0x1e')],'rows':_0x543253});}});},'ChatQueues':function(){return new Promise(function(_0x39f6cd){var _0x3b2851=[];for(var _0x538049 in _0x2c1398[_0x9f4a('0x54')]){if(_0x2c1398['chatQueues'][_0x9f4a('0x50')](_0x538049)){var _0x2162af=_0x2c1398[_0x9f4a('0x54')][_0x538049];var _0x14ad34={'id':_0x2162af['id'],'available':_0x2162af[_0x9f4a('0x55')],'loggedIn':_0x2162af['loggedIn'],'name':_0x2162af[_0x9f4a('0x56')],'paused':_0x2162af[_0x9f4a('0x57')],'waiting':_0x2162af['waiting']};_0x3b2851[_0x9f4a('0x25')](_0x14ad34);}}_0x39f6cd({'count':_0x3b2851[_0x9f4a('0x1e')],'rows':_0x3b2851});});},'MailQueues':function(){return new Promise(function(_0x515758){var _0x3d7d04=[];for(var _0x4d42bb in _0x2c1398[_0x9f4a('0x58')]){if(_0x2c1398[_0x9f4a('0x58')][_0x9f4a('0x50')](_0x4d42bb)){var _0x4b3705=_0x2c1398[_0x9f4a('0x58')][_0x4d42bb];var _0x2bcba4={'id':_0x4b3705['id'],'available':_0x4b3705['available'],'loggedIn':_0x4b3705['loggedIn'],'name':_0x4b3705[_0x9f4a('0x56')],'paused':_0x4b3705[_0x9f4a('0x57')],'waiting':_0x4b3705[_0x9f4a('0x59')]};_0x3d7d04[_0x9f4a('0x25')](_0x2bcba4);}}_0x515758({'count':_0x3d7d04[_0x9f4a('0x1e')],'rows':_0x3d7d04});});},'OpenchannelQueues':function(){return new Promise(function(_0x4660fe){var _0x565972=[];for(var _0x229807 in _0x2c1398[_0x9f4a('0x5a')]){if(_0x2c1398[_0x9f4a('0x5a')][_0x9f4a('0x50')](_0x229807)){var _0x3de98b=_0x2c1398['openchannelQueues'][_0x229807];var _0x4ea4f8={'id':_0x3de98b['id'],'available':_0x3de98b[_0x9f4a('0x55')],'loggedIn':_0x3de98b['loggedIn'],'name':_0x3de98b['name'],'paused':_0x3de98b['paused'],'waiting':_0x3de98b[_0x9f4a('0x59')]};_0x565972[_0x9f4a('0x25')](_0x4ea4f8);}}_0x4660fe({'count':_0x565972[_0x9f4a('0x1e')],'rows':_0x565972});});},'SmsQueues':function(){return new Promise(function(_0x5c1896){var _0x7dec15=[];for(var _0x189f1d in _0x2c1398['smsQueues']){if(_0x2c1398[_0x9f4a('0x5b')][_0x9f4a('0x50')](_0x189f1d)){var _0x3a2194=_0x2c1398[_0x9f4a('0x5b')][_0x189f1d];var _0x3048ed={'id':_0x3a2194['id'],'available':_0x3a2194[_0x9f4a('0x55')],'loggedIn':_0x3a2194[_0x9f4a('0x5c')],'name':_0x3a2194[_0x9f4a('0x56')],'paused':_0x3a2194[_0x9f4a('0x57')],'waiting':_0x3a2194[_0x9f4a('0x59')]};_0x7dec15[_0x9f4a('0x25')](_0x3048ed);}}_0x5c1896({'count':_0x7dec15[_0x9f4a('0x1e')],'rows':_0x7dec15});});},'FaxQueues':function(){return new Promise(function(_0x32842d){var _0x406f41=[];for(var _0x1db856 in _0x2c1398['faxQueues']){if(_0x2c1398[_0x9f4a('0x5d')][_0x9f4a('0x50')](_0x1db856)){var _0x338537=_0x2c1398[_0x9f4a('0x5d')][_0x1db856];var _0x6c1fef={'id':_0x338537['id'],'available':_0x338537[_0x9f4a('0x55')],'loggedIn':_0x338537[_0x9f4a('0x5c')],'name':_0x338537['name'],'paused':_0x338537[_0x9f4a('0x57')],'waiting':_0x338537[_0x9f4a('0x59')]};_0x406f41[_0x9f4a('0x25')](_0x6c1fef);}}_0x32842d({'count':_0x406f41[_0x9f4a('0x1e')],'rows':_0x406f41});});},'WhatsappQueues':function(){return new Promise(function(_0x16d134){var _0x25175e=[];for(var _0x5e5022 in _0x2c1398[_0x9f4a('0x5e')]){if(_0x2c1398[_0x9f4a('0x5e')]['hasOwnProperty'](_0x5e5022)){var _0xb904e0=_0x2c1398[_0x9f4a('0x5e')][_0x5e5022];var _0xb9c644={'id':_0xb904e0['id'],'available':_0xb904e0[_0x9f4a('0x55')],'loggedIn':_0xb904e0['loggedIn'],'name':_0xb904e0[_0x9f4a('0x56')],'paused':_0xb904e0[_0x9f4a('0x57')],'waiting':_0xb904e0[_0x9f4a('0x59')]};_0x25175e[_0x9f4a('0x25')](_0xb9c644);}}_0x16d134({'count':_0x25175e['length'],'rows':_0x25175e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x167b42){var _0x2758ed=_[_0x9f4a('0x5f')](_0x2c1398['chatQueuesWaitingInteractions']);_0x167b42({'count':_0x2758ed['length'],'rows':_0x2758ed});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x564b14){var _0x1cac3f=_[_0x9f4a('0x5f')](_0x2c1398['mailQueuesWaitingInteractions']);_0x564b14({'count':_0x1cac3f['length'],'rows':_0x1cac3f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xfc78ee){var _0x5e265=_[_0x9f4a('0x5f')](_0x2c1398[_0x9f4a('0x60')]);_0xfc78ee({'count':_0x5e265['length'],'rows':_0x5e265});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1fb27d){var _0x3f4305=_[_0x9f4a('0x5f')](_0x2c1398['smsQueuesWaitingInteractions']);_0x1fb27d({'count':_0x3f4305[_0x9f4a('0x1e')],'rows':_0x3f4305});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4a273f){var _0x31dbc8=_['values'](_0x2c1398[_0x9f4a('0x61')]);_0x4a273f({'count':_0x31dbc8[_0x9f4a('0x1e')],'rows':_0x31dbc8});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2c6a5c){var _0x23ed94=_['values'](_0x2c1398[_0x9f4a('0x62')]);_0x2c6a5c({'count':_0x23ed94[_0x9f4a('0x1e')],'rows':_0x23ed94});});}};var _0x3a069a=jayson[_0x9f4a('0x63')](_0x2525b5)[_0x9f4a('0x64')]();_0x3a069a['on'](_0x9f4a('0x44'),function(_0x3e4baa){logger[_0x9f4a('0x44')](JSON[_0x9f4a('0x3e')](_0x3e4baa));return _0x973739(_0x3e4baa);});_0x3a069a[_0x9f4a('0x15')](0x232c,_0x9f4a('0x65'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x52d0ee(_0x9f4a('0x66')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 76be759..4abff1e 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 _0xb86b=['client','then','error','message','result','catch','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','indexOf','true','[%s][INTERVAL]\x20%s','info','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','stack','util','bluebird','../../../config/logger','routing'];(function(_0x18fcc1,_0x37053b){var _0x3a8622=function(_0x277e6f){while(--_0x277e6f){_0x18fcc1['push'](_0x18fcc1['shift']());}};_0x3a8622(++_0x37053b);}(_0xb86b,0x173));var _0xbb86=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0xb86b[_0x568cf0];return _0x360f81;};'use strict';var util=require(_0xbb86('0x0'));var BPromise=require(_0xbb86('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xbb86('0x2'))(_0xbb86('0x3'));var client=jayson[_0xbb86('0x4')]['http']({'port':0x232a});function request(_0x1f31a9,_0x3bc1a4){return new BPromise(function(_0x243818,_0x56673f){return client['request'](_0x1f31a9,_0x3bc1a4)[_0xbb86('0x5')](function(_0x2f617d){if(_0x2f617d[_0xbb86('0x6')]){return _0x56673f(_0x2f617d[_0xbb86('0x6')][_0xbb86('0x7')]);}else{return _0x243818(_0x2f617d[_0xbb86('0x8')]);}})[_0xbb86('0x9')](function(_0x6ef64){return _0x56673f(_0x6ef64);});});}exports['condition']=function(_0x124918,_0x5d195b,_0x43be0c){return function(_0x4c04ae){if(_0x43be0c[_0xbb86('0xa')]&&!_0x43be0c[_0xbb86('0xa')][_0x124918]){logger['info'](_0xbb86('0xb'),_0x124918);return _0x4c04ae[_0xbb86('0xc')]();}var _0x24868c=[];for(var _0x14563e=0x0;_0x14563e<_0x5d195b[_0xbb86('0xd')];_0x14563e+=0x1){_0x24868c[_0xbb86('0xe')](request(_0xbb86('0xf'),{'command':util[_0xbb86('0x10')]('iftime\x20%s',_0x5d195b[_0x14563e])})['then'](function(_0x361b49){return _0x361b49&&_0x361b49[_0xbb86('0x7')]&&_0x361b49['message'][_0xbb86('0x11')](_0xbb86('0x12'))>=0x0?!![]:![];})[_0xbb86('0x9')](function(){logger[_0xbb86('0x6')](_0xbb86('0x13'),_0x124918,_0x5d195b[_0x14563e]);}));}BPromise['all'](_0x24868c)['then'](function(_0x5dc16d){var _0x53f88e=_['some'](_0x5dc16d);logger[_0xbb86('0x14')](_0xbb86('0x15'),_0x124918,_0x5d195b['join'](_0xbb86('0x16')),_0x53f88e);_0x4c04ae[_0xbb86('0x17')](_0x53f88e);})['catch'](function(_0x3c8902){logger[_0xbb86('0x6')](_0xbb86('0x15'),_0x124918,_0x5d195b['join'](_0xbb86('0x16')),_0x3c8902[_0xbb86('0x18')]);_0x4c04ae[_0xbb86('0xc')]();});};}; \ No newline at end of file +var _0xeedc=['format','iftime\x20%s','then','indexOf','all','some','info','join','\x20|\x20','when','catch','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','error','message','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x193bcc,_0x434411){var _0x12ccff=function(_0x4c6576){while(--_0x4c6576){_0x193bcc['push'](_0x193bcc['shift']());}};_0x12ccff(++_0x434411);}(_0xeedc,0x67));var _0xceed=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xeedc[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xceed('0x0'));var BPromise=require(_0xceed('0x1'));var jayson=require(_0xceed('0x2'));var _=require('lodash');var logger=require(_0xceed('0x3'))(_0xceed('0x4'));var client=jayson[_0xceed('0x5')][_0xceed('0x6')]({'port':0x232a});function request(_0x25cc31,_0x1df91c){return new BPromise(function(_0x42cec8,_0x4c2c72){return client[_0xceed('0x7')](_0x25cc31,_0x1df91c)['then'](function(_0x3390be){if(_0x3390be['error']){return _0x4c2c72(_0x3390be[_0xceed('0x8')][_0xceed('0x9')]);}else{return _0x42cec8(_0x3390be[_0xceed('0xa')]);}})['catch'](function(_0x5d9aff){return _0x4c2c72(_0x5d9aff);});});}exports[_0xceed('0xb')]=function(_0xff5cf,_0x395ab9,_0x2d10ff){return function(_0x1f04b5){if(_0x2d10ff[_0xceed('0xc')]&&!_0x2d10ff[_0xceed('0xc')][_0xff5cf]){logger['info'](_0xceed('0xd'),_0xff5cf);return _0x1f04b5[_0xceed('0xe')]();}var _0x165aff=[];for(var _0x1f285b=0x0;_0x1f285b<_0x395ab9[_0xceed('0xf')];_0x1f285b+=0x1){_0x165aff[_0xceed('0x10')](request('Command',{'command':util[_0xceed('0x11')](_0xceed('0x12'),_0x395ab9[_0x1f285b])})[_0xceed('0x13')](function(_0x48720c){return _0x48720c&&_0x48720c[_0xceed('0x9')]&&_0x48720c[_0xceed('0x9')][_0xceed('0x14')]('true')>=0x0?!![]:![];})['catch'](function(){logger[_0xceed('0x8')]('[%s][INTERVAL]\x20%s',_0xff5cf,_0x395ab9[_0x1f285b]);}));}BPromise[_0xceed('0x15')](_0x165aff)[_0xceed('0x13')](function(_0x368b21){var _0x53b54b=_[_0xceed('0x16')](_0x368b21);logger[_0xceed('0x17')]('[%s][INTERVAL]\x20%s\x20%s',_0xff5cf,_0x395ab9[_0xceed('0x18')](_0xceed('0x19')),_0x53b54b);_0x1f04b5[_0xceed('0x1a')](_0x53b54b);})[_0xceed('0x1b')](function(_0xdd169c){logger[_0xceed('0x8')](_0xceed('0x1c'),_0xff5cf,_0x395ab9[_0xceed('0x18')](_0xceed('0x19')),_0xdd169c[_0xceed('0x1d')]);_0x1f04b5[_0xceed('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2817e5b..4e59405 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 _0xf45e=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agentcalledAt','ATTENDED','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','ringtime','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','now','connectedlinename','answered_elsewhere','reason','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xf45e,0x115));var _0xef45=function(_0x131961,_0x4cd0d8){_0x131961=_0x131961-0x0;var _0xd14f17=_0xf45e[_0x131961];return _0xd14f17;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var utils=require(_0xef45('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5762da,_0x17b897){utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x4'),_0x5762da[_0xef45('0x5')],_0x5762da[_0xef45('0x6')],_0x5762da[_0xef45('0x7')],_0x5762da[_0xef45('0x8')],_0x5762da[_0xef45('0x9')],_0x5762da[_0xef45('0xa')],_0x5762da[_0xef45('0xb')],_0x5762da[_0xef45('0xc')]));if(_0x5762da[_0xef45('0x7')]){utils[_0xef45('0xd')](_0x5762da[_0xef45('0x7')])[_0xef45('0xe')](function(_0x134c86){if(_0x134c86){_0x5762da[_0xef45('0xf')]=_0x134c86[_0xef45('0xf')];_0x5762da['agentacw']=_0x5762da[_0xef45('0x10')]?_0x134c86[_0xef45('0x11')]:![];_0x5762da[_0xef45('0x12')]=_0x5762da[_0xef45('0x13')]?_0x134c86[_0xef45('0x14')]:0x0;}utils[_0xef45('0x15')]('CreateVoiceAgentReport',_0x5762da);});}else{utils[_0xef45('0x15')](_0xef45('0x16'),_0x5762da);}if(_0x17b897){delete transfers[_0x5762da[_0xef45('0x5')]];}else{delete agents[_0x5762da[_0xef45('0x17')]];}}exports[_0xef45('0x18')]=function(_0x4a6e5c){try{utils['debug'](util[_0xef45('0x3')]('[%s][agents][agentcalled]',_0x4a6e5c[_0xef45('0x5')]),_0x4a6e5c);agents[_0x4a6e5c[_0xef45('0x17')]]=_0x4a6e5c;agents[_0x4a6e5c[_0xef45('0x17')]]['agentcalledAt']=utils['now']();agents[_0x4a6e5c[_0xef45('0x17')]]['lastevent']=_0xef45('0x19');agents[_0x4a6e5c[_0xef45('0x17')]][_0xef45('0xb')]=null;agents[_0x4a6e5c[_0xef45('0x17')]]['connectedlinename']=null;utils['info'](util[_0xef45('0x3')](_0xef45('0x1a'),_0x4a6e5c[_0xef45('0x5')],agents[_0x4a6e5c[_0xef45('0x17')]]['membername'],_0x4a6e5c['destuniqueid']));}catch(_0x2c57fc){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x1c'),_0x4a6e5c[_0xef45('0x5')]),_0x2c57fc);}};exports[_0xef45('0x1d')]=function(_0x375cbd){try{if(!_['isNil'](agents[_0x375cbd[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x1f'),_0x375cbd[_0xef45('0x5')]),_0x375cbd);utils['info'](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x375cbd['uniqueid'],agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x8')],_0x375cbd[_0xef45('0x17')]));agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x1d')]=!![];agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x20')]=utils['now']();agents[_0x375cbd[_0xef45('0x17')]]['lastevent']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['reason']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['holdtime']=_0x375cbd[_0xef45('0x22')]?parseInt(_0x375cbd['ringtime'])/0x3e8:0x0;agents[_0x375cbd['destuniqueid']]['talktime']=0x0;unanswered['push'](_0x375cbd[_0xef45('0x17')]);}}catch(_0x2f72ef){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]',_0x375cbd[_0xef45('0x5')]),_0x2f72ef);}};exports['queuecallerabandon']=function(_0x2525da){try{_['forIn'](agents,function(_0x3e6922,_0x5bfd2d){if(_0x3e6922['uniqueid']==_0x2525da[_0xef45('0x5')]&&!_[_0xef45('0x23')](unanswered,_0x3e6922[_0xef45('0x17')])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da['uniqueid']),_0x2525da);utils['info'](util[_0xef45('0x3')](_0xef45('0x24'),_0x2525da[_0xef45('0x5')],_0x3e6922[_0xef45('0x8')],_0x3e6922[_0xef45('0x17')]));_0x3e6922[_0xef45('0x1d')]=!![];_0x3e6922[_0xef45('0x20')]=utils['now']();_0x3e6922['lastevent']=_0xef45('0x25');_0x3e6922['reason']=_0xef45('0x25');_0x3e6922['holdtime']=_0x2525da[_0xef45('0x26')];_0x3e6922[_0xef45('0x27')]=0x0;writeDB(_0x3e6922);}});}catch(_0x2a7c53){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da[_0xef45('0x5')]),_0x2a7c53);}};exports[_0xef45('0x28')]=function(_0x9df07e){try{if(agents[_0x9df07e['destuniqueid']]){utils['debug'](util[_0xef45('0x3')](_0xef45('0x29'),_0x9df07e['uniqueid']),_0x9df07e);utils[_0xef45('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x9df07e[_0xef45('0x5')],agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x8')],_0x9df07e['destuniqueid']));agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();agents[_0x9df07e[_0xef45('0x17')]]['connectedlinenum']=_0x9df07e['connectedlinenum'];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2c')]=_0x9df07e[_0xef45('0x2c')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0xc')]='connect';_['forIn'](agents,function(_0x13f8b2,_0x35d014){if(_0x13f8b2[_0xef45('0x17')]!=_0x9df07e[_0xef45('0x17')]&&_0x13f8b2[_0xef45('0x5')]==_0x9df07e[_0xef45('0x5')]){_0x13f8b2[_0xef45('0x27')]=0x0;_0x13f8b2[_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];_0x13f8b2[_0xef45('0x1d')]=!![];_0x13f8b2[_0xef45('0x20')]=utils[_0xef45('0x2b')]();_0x13f8b2[_0xef45('0xc')]=_0xef45('0x2d');_0x13f8b2[_0xef45('0x2e')]=_0xef45('0x2d');_0x13f8b2['answeredelsewheredestinationuniqueid']=_0x9df07e[_0xef45('0x17')];_0x13f8b2[_0xef45('0x2f')]=_0x9df07e[_0xef45('0x8')];writeDB(_0x13f8b2);}});}}catch(_0x82c123){utils['error'](util[_0xef45('0x3')]('[%s][agents][agentconnect]',_0x9df07e[_0xef45('0x5')]),_0x82c123);}};exports['agentcomplete']=function(_0x5faf67){try{if(!_[_0xef45('0x30')](agents[_0x5faf67[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x31'),_0x5faf67[_0xef45('0x5')]),_0x5faf67);utils['info'](util[_0xef45('0x3')](_0xef45('0x32'),_0x5faf67[_0xef45('0x5')],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x8')],_0x5faf67[_0xef45('0x17')]));agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x10')]=!![];agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x33')]=utils[_0xef45('0x2b')]();agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x27')]=utils[_0xef45('0x34')](agents[_0x5faf67[_0xef45('0x17')]]['agentcompleteAt'],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x2a')]);agents[_0x5faf67[_0xef45('0x17')]]['reason']=_0x5faf67['reason'];agents[_0x5faf67['destuniqueid']][_0xef45('0xc')]=_0xef45('0x35');writeDB(agents[_0x5faf67[_0xef45('0x17')]]);}}catch(_0x34e9d5){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentcomplete]',_0x5faf67[_0xef45('0x5')]),_0x34e9d5);}};exports[_0xef45('0x36')]=function(_0x2b2419){try{if(!_['isNil'](agents[_0x2b2419['transfereruniqueid']])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][blindtransfer]',_0x2b2419[_0xef45('0x5')]),_0x2b2419);utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x37'),_0x2b2419[_0xef45('0x5')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x8')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')]));agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x39')]=!![];agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x3a')]=_0xef45('0x3b');agents[_0x2b2419['transfereruniqueid']][_0xef45('0x3c')]=_0x2b2419[_0xef45('0x3d')];agents[_0x2b2419[_0xef45('0x38')]]['transferuniqueid']=agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')];}}catch(_0x464bda){utils[_0xef45('0x1b')](util['format'](_0xef45('0x3e'),_0x2b2419[_0xef45('0x5')]),_0x464bda);}};exports[_0xef45('0x3f')]=function(_0x310105){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x310105);if(_0x310105[_0xef45('0x41')]==_0x310105[_0xef45('0x42')]){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x43')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x43')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x43')]]['transfer']=!![];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x3a')]='ATTENDED';agents[_0x310105[_0xef45('0x43')]][_0xef45('0x3c')]=_0x310105[_0xef45('0x45')];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x46')]=_0x310105[_0xef45('0x41')];}if(_0x310105['transfereeuniqueid']&&agents[_0x310105[_0xef45('0x47')]]){agents[_0x310105['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x310105[_0xef45('0x47')]]=_[_0xef45('0x48')](agents[_0x310105[_0xef45('0x47')]]);transfers[_0x310105[_0xef45('0x47')]][_0xef45('0xa')]=agents[_0x310105['secondtransfereruniqueid']][_0xef45('0xa')];transfers[_0x310105[_0xef45('0x47')]]['calleridname']=agents[_0x310105[_0xef45('0x43')]][_0xef45('0x49')];transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105['transfereeuniqueid']][_0xef45('0x26')]=0x0;transfers[_0x310105['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x310105[_0xef45('0x43')]==_0x310105['secondtransfererlinkedid']){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x41')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x41')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x41')]]['transfer']=!![];agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3a')]=_0xef45('0x4b');agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3c')]=_0x310105['secondtransfererexten'];agents[_0x310105[_0xef45('0x41')]]['transferuniqueid']=_0x310105[_0xef45('0x43')];}if(_0x310105[_0xef45('0x4c')]&&agents[_0x310105['transfertargetuniqueid']]){agents[_0x310105[_0xef45('0x4c')]][_0xef45('0x4d')]=0x1;transfers[_0x310105[_0xef45('0x4c')]]=_['clone'](agents[_0x310105['transfertargetuniqueid']]);transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0xa')]=agents[_0x310105[_0xef45('0x41')]]['calleridnum'];transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x49')]=agents[_0x310105['origtransfereruniqueid']][_0xef45('0x49')];transfers[_0x310105['transfertargetuniqueid']][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x26')]=0x0;transfers[_0x310105[_0xef45('0x4c')]]['agententerreason']=0x2;}}}catch(_0x3e6b06){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x3e6b06);}};exports[_0xef45('0x4e')]=function(_0xef7b79){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x4f'),_0xef7b79[_0xef45('0x5')]),_0xef7b79);if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]===_0xef45('0x21')){if(_0xef7b79[_0xef45('0x50')]==='21'){agents[_0xef7b79[_0xef45('0x5')]]['reason']=_0xef45('0x51');agents[_0xef7b79[_0xef45('0x5')]]['lastevent']='rejected';}utils[_0xef45('0x2')](util[_0xef45('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xef7b79['uniqueid'],agents[_0xef7b79['uniqueid']][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]]['reason'],agents[_0xef7b79['uniqueid']][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);var _0x36586a=unanswered[_0xef45('0x52')](_0xef7b79[_0xef45('0x5')]);if(_0x36586a>-0x1){unanswered[_0xef45('0x53')](_0x36586a,0x1);}}if(transfers[_0xef7b79[_0xef45('0x5')]]){transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x10')]=!![];transfers[_0xef7b79['uniqueid']][_0xef45('0x33')]=utils[_0xef45('0x2b')]();transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x27')]=utils[_0xef45('0x34')](transfers[_0xef7b79[_0xef45('0x5')]]['agentcompleteAt'],transfers[_0xef7b79['uniqueid']][_0xef45('0x2a')]);transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=_0xef45('0x54');transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils[_0xef45('0x2')](util['format'](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],transfers[_0xef7b79[_0xef45('0x5')]]['lastevent']));writeDB(transfers[_0xef7b79[_0xef45('0x5')]],!![]);}if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2a')]){agents[_0xef7b79['uniqueid']][_0xef45('0x10')]=!![];agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')]=utils['now']();agents[_0xef7b79[_0xef45('0x5')]]['talktime']=utils[_0xef45('0x34')](agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')],agents[_0xef7b79[_0xef45('0x5')]]['agentconnectAt']);agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=agents[_0xef7b79[_0xef45('0x5')]]['transfer']?_0xef45('0x39'):_0xef45('0x54');agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils['info'](util[_0xef45('0x3')](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);}}catch(_0xd3a51e){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][hangup]',_0xef7b79[_0xef45('0x5')]),_0xd3a51e);}}; \ No newline at end of file +var _0x96cc=['rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','debug','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause'];(function(_0x1b71e4,_0x28ef28){var _0x41342e=function(_0x297f7b){while(--_0x297f7b){_0x1b71e4['push'](_0x1b71e4['shift']());}};_0x41342e(++_0x28ef28);}(_0x96cc,0x16c));var _0xc96c=function(_0x57d53b,_0x4b0c2f){_0x57d53b=_0x57d53b-0x0;var _0x13a2df=_0x96cc[_0x57d53b];return _0x13a2df;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var utils=require(_0xc96c('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f11f2,_0x30bf8a){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x4'),_0x5f11f2[_0xc96c('0x5')],_0x5f11f2[_0xc96c('0x6')],_0x5f11f2[_0xc96c('0x7')],_0x5f11f2[_0xc96c('0x8')],_0x5f11f2[_0xc96c('0x9')],_0x5f11f2['calleridnum'],_0x5f11f2[_0xc96c('0xa')],_0x5f11f2[_0xc96c('0xb')]));if(_0x5f11f2[_0xc96c('0x7')]){utils[_0xc96c('0xc')](_0x5f11f2[_0xc96c('0x7')])[_0xc96c('0xd')](function(_0x36b2b4){if(_0x36b2b4){_0x5f11f2['type']=_0x36b2b4[_0xc96c('0xe')];_0x5f11f2[_0xc96c('0xf')]=_0x5f11f2[_0xc96c('0x10')]?_0x36b2b4['acw']:![];_0x5f11f2[_0xc96c('0x11')]=_0x5f11f2['agentacw']?_0x36b2b4[_0xc96c('0x12')]:0x0;}utils['request'](_0xc96c('0x13'),_0x5f11f2);});}else{utils[_0xc96c('0x14')](_0xc96c('0x13'),_0x5f11f2);}if(_0x30bf8a){delete transfers[_0x5f11f2[_0xc96c('0x5')]];}else{delete agents[_0x5f11f2['destuniqueid']];}}exports[_0xc96c('0x15')]=function(_0x43fcaa){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')]('[%s][agents][agentcalled]',_0x43fcaa[_0xc96c('0x5')]),_0x43fcaa);agents[_0x43fcaa[_0xc96c('0x17')]]=_0x43fcaa;agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0x18')]=utils[_0xc96c('0x19')]();agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x1a');agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xa')]=null;agents[_0x43fcaa[_0xc96c('0x17')]]['connectedlinename']=null;utils['info'](util[_0xc96c('0x3')](_0xc96c('0x1b'),_0x43fcaa[_0xc96c('0x5')],agents[_0x43fcaa[_0xc96c('0x17')]]['membername'],_0x43fcaa[_0xc96c('0x17')]));}catch(_0x100fdb){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x1d'),_0x43fcaa[_0xc96c('0x5')]),_0x100fdb);}};exports[_0xc96c('0x1e')]=function(_0x41daba){try{if(!_[_0xc96c('0x1f')](agents[_0x41daba[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x41daba);utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x21'),_0x41daba['uniqueid'],agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x8')],_0x41daba[_0xc96c('0x17')]));agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x1e')]=!![];agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x22')]=utils[_0xc96c('0x19')]();agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0xb')]='timeout';agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x23')]=_0xc96c('0x24');agents[_0x41daba[_0xc96c('0x17')]]['holdtime']=_0x41daba['ringtime']?parseInt(_0x41daba[_0xc96c('0x25')])/0x3e8:0x0;agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x26')]=0x0;unanswered[_0xc96c('0x27')](_0x41daba[_0xc96c('0x17')]);}}catch(_0x5e1727){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x5e1727);}};exports[_0xc96c('0x28')]=function(_0x40c72b){try{_[_0xc96c('0x29')](agents,function(_0x328ee4,_0x556108){if(_0x328ee4[_0xc96c('0x5')]==_0x40c72b['uniqueid']&&!_[_0xc96c('0x2a')](unanswered,_0x328ee4[_0xc96c('0x17')])){utils[_0xc96c('0x16')](util['format'](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x40c72b);utils[_0xc96c('0x2')](util[_0xc96c('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x40c72b['uniqueid'],_0x328ee4[_0xc96c('0x8')],_0x328ee4[_0xc96c('0x17')]));_0x328ee4[_0xc96c('0x1e')]=!![];_0x328ee4['agentringnoanswerAt']=utils[_0xc96c('0x19')]();_0x328ee4[_0xc96c('0xb')]=_0xc96c('0x2c');_0x328ee4[_0xc96c('0x23')]='abandoned';_0x328ee4[_0xc96c('0x2d')]=_0x40c72b[_0xc96c('0x2d')];_0x328ee4['talktime']=0x0;writeDB(_0x328ee4);}});}catch(_0x2b1dec){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x2b1dec);}};exports[_0xc96c('0x2e')]=function(_0x4e8241){try{if(agents[_0x4e8241[_0xc96c('0x17')]]){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4e8241);utils[_0xc96c('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4e8241[_0xc96c('0x5')],agents[_0x4e8241[_0xc96c('0x17')]]['membername'],_0x4e8241['destuniqueid']));agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xa')]=_0x4e8241[_0xc96c('0xa')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x31')]=_0x4e8241[_0xc96c('0x31')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x2d')]=_0x4e8241['ringtime'];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x32');_[_0xc96c('0x29')](agents,function(_0x4eb180,_0x167671){if(_0x4eb180[_0xc96c('0x17')]!=_0x4e8241[_0xc96c('0x17')]&&_0x4eb180['uniqueid']==_0x4e8241['uniqueid']){_0x4eb180[_0xc96c('0x26')]=0x0;_0x4eb180[_0xc96c('0x2d')]=_0x4e8241[_0xc96c('0x25')];_0x4eb180['agentringnoanswer']=!![];_0x4eb180[_0xc96c('0x22')]=utils[_0xc96c('0x19')]();_0x4eb180[_0xc96c('0xb')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x23')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x34')]=_0x4e8241[_0xc96c('0x17')];_0x4eb180[_0xc96c('0x35')]=_0x4e8241['membername'];writeDB(_0x4eb180);}});}}catch(_0x4c3088){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4c3088);}};exports['agentcomplete']=function(_0x5ee6ac){try{if(!_[_0xc96c('0x1f')](agents[_0x5ee6ac[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x5ee6ac);utils[_0xc96c('0x2')](util['format'](_0xc96c('0x37'),_0x5ee6ac[_0xc96c('0x5')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x8')],_0x5ee6ac['destuniqueid']));agents[_0x5ee6ac['destuniqueid']][_0xc96c('0x10')]=!![];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x30')]);agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x23')]=_0x5ee6ac['reason'];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x3a');writeDB(agents[_0x5ee6ac[_0xc96c('0x17')]]);}}catch(_0x56bce1){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x56bce1);}};exports['blindtransfer']=function(_0x2581ae){try{if(!_[_0xc96c('0x1f')](agents[_0x2581ae[_0xc96c('0x3b')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x3c'),_0x2581ae['uniqueid']),_0x2581ae);utils['info'](util['format'](_0xc96c('0x3d'),_0x2581ae['uniqueid'],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x8')],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')]));agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3e')]=!![];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3f')]=_0xc96c('0x40');agents[_0x2581ae[_0xc96c('0x3b')]]['transferexten']=_0x2581ae[_0xc96c('0x41')];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x42')]=agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')];}}catch(_0xcde9){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][blindtransfer]',_0x2581ae['uniqueid']),_0xcde9);}};exports['attendedtransfer']=function(_0x5c3d95){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0x5c3d95);if(_0x5c3d95[_0xc96c('0x44')]==_0x5c3d95[_0xc96c('0x45')]){if(!_[_0xc96c('0x1f')](agents[_0x5c3d95['secondtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x8')]));agents[_0x5c3d95[_0xc96c('0x47')]]['transfer']=!![];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x3f')]=_0xc96c('0x48');agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x4a')];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x42')]=_0x5c3d95[_0xc96c('0x44')];}if(_0x5c3d95[_0xc96c('0x4b')]&&agents[_0x5c3d95[_0xc96c('0x4b')]]){agents[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x4b')]]=_['clone'](agents[_0x5c3d95[_0xc96c('0x4b')]]);transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4d')];transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x4e')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4e')];transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentcalledAt']=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentconnectAt']=utils['now']();transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x2;}}else if(_0x5c3d95[_0xc96c('0x47')]==_0x5c3d95[_0xc96c('0x4f')]){if(!_['isNil'](agents[_0x5c3d95['origtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x44')]]['membername']));agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3e')]=!![];agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3f')]='ATTENDED';agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x50')];agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x42')]=_0x5c3d95['secondtransfereruniqueid'];}if(_0x5c3d95[_0xc96c('0x51')]&&agents[_0x5c3d95[_0xc96c('0x51')]]){agents[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x51')]]=_[_0xc96c('0x52')](agents[_0x5c3d95[_0xc96c('0x51')]]);transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x44')]]['calleridnum'];transfers[_0x5c3d95[_0xc96c('0x51')]]['calleridname']=agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x4e')];transfers[_0x5c3d95['transfertargetuniqueid']][_0xc96c('0x18')]=utils['now']();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x2;}}}catch(_0xbd6525){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0xbd6525);}};exports[_0xc96c('0x53')]=function(_0x43f94e){try{utils['debug'](util[_0xc96c('0x3')](_0xc96c('0x54'),_0x43f94e['uniqueid']),_0x43f94e);if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]]['reason']===_0xc96c('0x24')){if(_0x43f94e[_0xc96c('0x55')]==='21'){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')]=_0xc96c('0x56');agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]=_0xc96c('0x56');}utils[_0xc96c('0x2')](util['format'](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e[_0xc96c('0x5')]]['membername'],agents[_0x43f94e['uniqueid']][_0xc96c('0x23')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);var _0x1efa88=unanswered[_0xc96c('0x58')](_0x43f94e[_0xc96c('0x5')]);if(_0x1efa88>-0x1){unanswered['splice'](_0x1efa88,0x1);}}if(transfers[_0x43f94e[_0xc96c('0x5')]]){transfers[_0x43f94e[_0xc96c('0x5')]]['agentcomplete']=!![];transfers[_0x43f94e[_0xc96c('0x5')]]['agentcompleteAt']=utils[_0xc96c('0x19')]();transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);transfers[_0x43f94e[_0xc96c('0x5')]]['reason']=_0xc96c('0x59');transfers[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils['info'](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],transfers[_0x43f94e['uniqueid']][_0xc96c('0x8')],transfers[_0x43f94e[_0xc96c('0x5')]]['reason'],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(transfers[_0x43f94e[_0xc96c('0x5')]],!![]);}if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x10')]=!![];agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);agents[_0x43f94e[_0xc96c('0x5')]]['reason']=agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x3e')]?_0xc96c('0x3e'):_0xc96c('0x59');agents[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e['uniqueid']]['membername'],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')],agents[_0x43f94e['uniqueid']][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);}}catch(_0x563449){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][hangup]',_0x43f94e[_0xc96c('0x5')]),_0x563449);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c3a9c3a..51fb6f7 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 _0x096b=['[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','channel','queue','membername','interface','connectedlinenum','accountcode','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','ANSWERED','hangup','[%s][calls][hangup]','callerid','cause-txt','duration','diffTime','endtime','billableseconds','answertime','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x096b,0x72));var _0xb096=function(_0x126e93,_0x5a2ae0){_0x126e93=_0x126e93-0x0;var _0xfc452f=_0x096b[_0x126e93];return _0xfc452f;};'use strict';var _=require(_0xb096('0x0'));var util=require(_0xb096('0x1'));var utils=require(_0xb096('0x2'));var dispositions=[_0xb096('0x3'),_0xb096('0x4'),_0xb096('0x4'),_0xb096('0x3'),'NO\x20ANSWER',_0xb096('0x3'),'ANSWERED',_0xb096('0x5'),_0xb096('0x4'),_0xb096('0x4'),_0xb096('0x4')];var channels={};function writeDB(_0x1f794b){utils[_0xb096('0x6')](util[_0xb096('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1f794b[_0xb096('0x8')],_0x1f794b[_0xb096('0x9')],_0x1f794b[_0xb096('0xa')],_0x1f794b[_0xb096('0xb')],_0x1f794b[_0xb096('0xc')],_0x1f794b['calleridnum'],_0x1f794b[_0xb096('0xd')],_0x1f794b['lastevent']));if(_0x1f794b[_0xb096('0xe')]){utils['getUserByInternal'](_0x1f794b[_0xb096('0xe')])['then'](function(_0x475c3a){if(_0x475c3a){_0x1f794b['UserId']=_0x475c3a['id'];}utils['request'](_0xb096('0xf'),_0x1f794b);});}else{utils['request'](_0xb096('0xf'),_0x1f794b);}if(channels[_0x1f794b[_0xb096('0x8')]]){delete channels[_0x1f794b[_0xb096('0x8')]];}}exports[_0xb096('0x10')]=function(_0x198b34){try{utils['debug'](util['format'](_0xb096('0x11'),_0x198b34[_0xb096('0x8')]),_0x198b34);if(_0x198b34['uniqueid']==_0x198b34[_0xb096('0x12')]&&_0x198b34[_0xb096('0x9')]!=_0xb096('0x13')){utils[_0xb096('0x6')](util[_0xb096('0x7')](_0xb096('0x14'),_0x198b34[_0xb096('0x8')],_0x198b34['context'],_0x198b34[_0xb096('0x15')]));channels[_0x198b34[_0xb096('0x8')]]={'uniqueid':_0x198b34[_0xb096('0x8')],'accountcode':_0x198b34[_0xb096('0xe')],'source':_0x198b34[_0xb096('0x16')],'destination':_0x198b34[_0xb096('0x15')],'destinationcontext':_0x198b34[_0xb096('0x17')],'channel':_0x198b34[_0xb096('0x9')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xb096('0x3'),'amaflags':_0xb096('0x18')};}}catch(_0x1864a8){utils[_0xb096('0x19')](util[_0xb096('0x7')](_0xb096('0x11'),_0x198b34[_0xb096('0x8')]),_0x1864a8);}};exports['newstate']=function(_0x2ac3b9){try{utils[_0xb096('0x1a')](util[_0xb096('0x7')](_0xb096('0x1b'),_0x2ac3b9[_0xb096('0x8')]),_0x2ac3b9);if(!_[_0xb096('0x1c')](channels[_0x2ac3b9[_0xb096('0x8')]])&&_0x2ac3b9['channelstate']==0x6){utils[_0xb096('0x6')](util[_0xb096('0x7')](_0xb096('0x1d'),_0x2ac3b9[_0xb096('0x8')],_0x2ac3b9['context'],_0x2ac3b9['channel']));if(_['isNil'](channels[_0x2ac3b9['uniqueid']][_0xb096('0x1e')])){channels[_0x2ac3b9['uniqueid']][_0xb096('0x1e')]=utils[_0xb096('0x1f')]();}}else if(!_[_0xb096('0x1c')](channels[_0x2ac3b9['linkedid']])&&_0x2ac3b9[_0xb096('0x20')]==0x6&&_0x2ac3b9[_0xb096('0x17')]!=_0xb096('0x21')){utils[_0xb096('0x6')](util[_0xb096('0x7')](_0xb096('0x22'),_0x2ac3b9[_0xb096('0x8')],_0x2ac3b9[_0xb096('0x12')],_0x2ac3b9[_0xb096('0x17')],_0x2ac3b9['channel']));channels[_0x2ac3b9[_0xb096('0x12')]][_0xb096('0xe')]=_0x2ac3b9[_0xb096('0xe')];channels[_0x2ac3b9[_0xb096('0x12')]][_0xb096('0x23')]=_0x2ac3b9[_0xb096('0x9')];if(_['isNil'](channels[_0x2ac3b9[_0xb096('0x12')]]['answertime'])){channels[_0x2ac3b9['linkedid']]['answertime']=utils[_0xb096('0x1f')]();}channels[_0x2ac3b9['linkedid']][_0xb096('0x24')]=dispositions[_['toNumber'](_0x2ac3b9[_0xb096('0x20')])]||_0xb096('0x25');}}catch(_0x5893a6){utils['error'](util[_0xb096('0x7')](_0xb096('0x1b'),_0x2ac3b9[_0xb096('0x8')]),_0x5893a6);}};exports[_0xb096('0x26')]=function(_0x40aa44){try{if(!_[_0xb096('0x1c')](channels[_0x40aa44[_0xb096('0x8')]])){utils[_0xb096('0x1a')](util[_0xb096('0x7')](_0xb096('0x27'),_0x40aa44[_0xb096('0x8')]),_0x40aa44);if(_[_0xb096('0x1c')](channels[_0x40aa44[_0xb096('0x8')]][_0xb096('0x28')])){channels[_0x40aa44['uniqueid']][_0xb096('0x28')]=_0x40aa44['calleridname']+'\x20<'+_0x40aa44[_0xb096('0x16')]+'>';}utils[_0xb096('0x6')](util[_0xb096('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x40aa44[_0xb096('0x8')],channels[_0x40aa44[_0xb096('0x8')]]['callerid'],_0x40aa44[_0xb096('0x29')]));channels[_0x40aa44['uniqueid']]['endtime']=utils[_0xb096('0x1f')]();channels[_0x40aa44['uniqueid']][_0xb096('0x2a')]=utils[_0xb096('0x2b')](channels[_0x40aa44[_0xb096('0x8')]][_0xb096('0x2c')],channels[_0x40aa44['uniqueid']]['starttime']);channels[_0x40aa44[_0xb096('0x8')]][_0xb096('0x2d')]=channels[_0x40aa44['uniqueid']][_0xb096('0x2e')]?utils[_0xb096('0x2b')](channels[_0x40aa44[_0xb096('0x8')]]['endtime'],channels[_0x40aa44['uniqueid']][_0xb096('0x2e')]):0x0;writeDB(channels[_0x40aa44['uniqueid']]);}}catch(_0x22fc00){utils[_0xb096('0x19')](util['format'](_0xb096('0x27'),_0x40aa44['uniqueid']),_0x22fc00);}};exports['attendedtransfer']=function(_0x2d83d3){try{if(!_[_0xb096('0x1c')](channels[_0x2d83d3['localtwolinkedid']])){utils[_0xb096('0x1a')](util[_0xb096('0x7')](_0xb096('0x2f'),_0x2d83d3['origtransfereruniqueid']),_0x2d83d3);if(channels[_0x2d83d3['localtwolinkedid']][_0xb096('0x9')]==_0x2d83d3[_0xb096('0x30')]){utils['info'](util['format'](_0xb096('0x31'),_0x2d83d3['origtransfereruniqueid'],_0x2d83d3[_0xb096('0x32')],_0x2d83d3[_0xb096('0x33')]));channels[_0x2d83d3['localtwolinkedid']]['destinationchannel']=_0x2d83d3[_0xb096('0x33')];channels[_0x2d83d3[_0xb096('0x32')]][_0xb096('0x34')]=_0xb096('0x35');}else if(channels[_0x2d83d3[_0xb096('0x32')]][_0xb096('0x9')]=_0x2d83d3[_0xb096('0x36')]){utils[_0xb096('0x6')](util['format'](_0xb096('0x31'),_0x2d83d3[_0xb096('0x37')],_0x2d83d3[_0xb096('0x32')],_0x2d83d3[_0xb096('0x38')]));channels[_0x2d83d3[_0xb096('0x32')]][_0xb096('0x23')]=_0x2d83d3[_0xb096('0x38')];channels[_0x2d83d3[_0xb096('0x32')]][_0xb096('0x34')]=_0xb096('0x35');}}}catch(_0xbc472f){utils['error'](util[_0xb096('0x7')](_0xb096('0x2f'),_0x2d83d3[_0xb096('0x37')]),_0xbc472f);}};exports[_0xb096('0x39')]=function(_0x12eecb){try{if(!_['isNil'](channels[_0x12eecb[_0xb096('0x8')]])){utils[_0xb096('0x1a')](util[_0xb096('0x7')](_0xb096('0x3a'),_0x12eecb[_0xb096('0x8')]),_0x12eecb);channels[_0x12eecb[_0xb096('0x8')]][_0xb096('0x3b')]=utils['now']();utils[_0xb096('0x6')](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x12eecb[_0xb096('0x8')],channels[_0x12eecb[_0xb096('0x8')]][_0xb096('0x3b')]));}}catch(_0x1a8554){utils[_0xb096('0x19')](util['format'](_0xb096('0x3a'),_0x12eecb[_0xb096('0x8')]),_0x1a8554);}};exports[_0xb096('0x3c')]=function(_0x38b02b){try{if(!_[_0xb096('0x1c')](channels[_0x38b02b[_0xb096('0x8')]])){utils[_0xb096('0x1a')](util[_0xb096('0x7')](_0xb096('0x3d'),_0x38b02b[_0xb096('0x8')]),_0x38b02b);if(!_['isNil'](channels[_0x38b02b[_0xb096('0x8')]][_0xb096('0x3b')])){channels[_0x38b02b[_0xb096('0x8')]][_0xb096('0x3e')]+=utils[_0xb096('0x2b')](utils[_0xb096('0x1f')](),channels[_0x38b02b[_0xb096('0x8')]]['musiconholdstartAt']);utils[_0xb096('0x6')](util[_0xb096('0x7')](_0xb096('0x3f'),_0x38b02b['uniqueid'],channels[_0x38b02b['uniqueid']][_0xb096('0x3e')]));delete channels[_0x38b02b[_0xb096('0x8')]][_0xb096('0x3b')];}}}catch(_0x455ad9){utils['error'](util[_0xb096('0x7')](_0xb096('0x3d'),_0x38b02b[_0xb096('0x8')]),_0x455ad9);}};exports['varset']=function(_0x4de1f9){try{if(!_['isNil'](channels[_0x4de1f9[_0xb096('0x8')]])){utils[_0xb096('0x1a')](util[_0xb096('0x7')](_0xb096('0x40'),_0x4de1f9[_0xb096('0x8')]),_0x4de1f9);if(!_[_0xb096('0x1c')](_0x4de1f9[_0xb096('0x41')][_0xb096('0x42')])){utils[_0xb096('0x6')](util[_0xb096('0x7')](_0xb096('0x43'),_0x4de1f9['uniqueid'],_0x4de1f9[_0xb096('0x44')]));channels[_0x4de1f9['uniqueid']][_0xb096('0x45')]=_0x4de1f9[_0xb096('0x44')];}if(!_[_0xb096('0x1c')](_0x4de1f9[_0xb096('0x41')][_0xb096('0x46')])){utils['info'](util[_0xb096('0x7')](_0xb096('0x47'),_0x4de1f9[_0xb096('0x8')],_0x4de1f9[_0xb096('0x44')]));channels[_0x4de1f9['uniqueid']][_0xb096('0x48')]=_0x4de1f9[_0xb096('0x44')];channels[_0x4de1f9['uniqueid']][_0xb096('0x28')]='\x22'+_0x4de1f9['value']+_0xb096('0x49')+_0x4de1f9[_0xb096('0x44')]+'>';}if(!_[_0xb096('0x1c')](_0x4de1f9['variable'][_0xb096('0x4a')])||!_[_0xb096('0x1c')](_0x4de1f9[_0xb096('0x41')]['xmd-callerid'])){utils[_0xb096('0x6')](util[_0xb096('0x7')](_0xb096('0x4b'),_0x4de1f9[_0xb096('0x8')],!_[_0xb096('0x1c')](_0x4de1f9['variable']['xmd-callerid-preview'])?'xmd-callerid-preview':'xmd-callerid',_0x4de1f9[_0xb096('0x44')]));channels[_0x4de1f9[_0xb096('0x8')]][_0xb096('0x28')]=_0x4de1f9[_0xb096('0x44')];}if(!_['isNil'](_0x4de1f9[_0xb096('0x41')][_0xb096('0x4c')])||!_[_0xb096('0x1c')](_0x4de1f9[_0xb096('0x41')]['xmcs-queue'])){utils[_0xb096('0x6')](util['format'](_0xb096('0x4b'),_0x4de1f9[_0xb096('0x8')],!_[_0xb096('0x1c')](_0x4de1f9[_0xb096('0x41')][_0xb096('0x4c')])?_0xb096('0x4c'):'xmcs-queue',_0x4de1f9[_0xb096('0x44')]));channels[_0x4de1f9[_0xb096('0x8')]][_0xb096('0x4d')]=_0xb096('0x4e');channels[_0x4de1f9[_0xb096('0x8')]]['lastdata']=_0x4de1f9[_0xb096('0x44')];channels[_0x4de1f9[_0xb096('0x8')]][_0xb096('0xa')]=!![];}if(!_[_0xb096('0x1c')](_0x4de1f9[_0xb096('0x41')][_0xb096('0x4f')])){utils[_0xb096('0x6')](util[_0xb096('0x7')](_0xb096('0x50'),_0x4de1f9[_0xb096('0x8')],_0x4de1f9[_0xb096('0x44')]));channels[_0x4de1f9[_0xb096('0x8')]][_0xb096('0x51')]=_0x4de1f9[_0xb096('0x44')];}if(!_[_0xb096('0x1c')](_0x4de1f9[_0xb096('0x41')][_0xb096('0x52')])){utils[_0xb096('0x6')](util[_0xb096('0x7')](_0xb096('0x53'),_0x4de1f9[_0xb096('0x8')],_0x4de1f9[_0xb096('0x44')]));channels[_0x4de1f9[_0xb096('0x8')]]['type']=_0x4de1f9[_0xb096('0x44')];}if(!_[_0xb096('0x1c')](_0x4de1f9[_0xb096('0x41')]['outboundrouteid'])){utils[_0xb096('0x6')](util[_0xb096('0x7')](_0xb096('0x54'),_0x4de1f9[_0xb096('0x8')],_0x4de1f9[_0xb096('0x44')]));channels[_0x4de1f9['uniqueid']]['routeid']=_0x4de1f9[_0xb096('0x44')];}if(!_[_0xb096('0x1c')](_0x4de1f9[_0xb096('0x41')]['sipcallid'])){utils['info'](util[_0xb096('0x7')](_0xb096('0x55'),_0x4de1f9[_0xb096('0x8')],_0x4de1f9[_0xb096('0x44')]));channels[_0x4de1f9['uniqueid']][_0xb096('0x56')]=_0x4de1f9['value'];}}}catch(_0x5080c1){utils['error'](util[_0xb096('0x7')](_0xb096('0x40'),_0x4de1f9[_0xb096('0x8')]),_0x5080c1);}};exports[_0xb096('0x57')]=function(_0xf74629){try{if(!_['isNil'](channels[_0xf74629['uniqueid']])){utils[_0xb096('0x1a')](util['format']('[%s][calls][newexten]',_0xf74629[_0xb096('0x8')]),_0xf74629);utils[_0xb096('0x6')](util['format'](_0xb096('0x58'),_0xf74629[_0xb096('0x8')],_0xf74629[_0xb096('0x59')],_0xf74629[_0xb096('0x5a')]));if(_0xf74629['application'][_0xb096('0x5b')]()==_0xb096('0x5c')&&_['startsWith'](_0xf74629[_0xb096('0x5a')]['toLowerCase'](),_0xb096('0x5d'))){var _0xe52d09=_0xf74629[_0xb096('0x5a')][_0xb096('0x5e')]('=');var _0x3dd222=_0xe52d09[0x0]['substring'](_0xe52d09[0x0][_0xb096('0x5f')]('(')+0x1,_0xe52d09[0x0]['lastIndexOf'](')'));var _0xfb2104=_0xe52d09[0x1];channels[_0xf74629['uniqueid']][_0x3dd222]=_0xfb2104;}if(!_[_0xb096('0x60')]([_0xb096('0x26'),_0xb096('0x61'),_0xb096('0x62'),'set',_0xb096('0x63')],_0xf74629[_0xb096('0x59')][_0xb096('0x5b')]())){channels[_0xf74629[_0xb096('0x8')]][_0xb096('0x4d')]=_0xf74629['application'];channels[_0xf74629[_0xb096('0x8')]][_0xb096('0x64')]=_0xf74629[_0xb096('0x5a')];}}}catch(_0x56fd8a){utils['error'](util['format']('[%s][calls][newexten]',_0xf74629[_0xb096('0x8')]),_0x56fd8a);}}; \ No newline at end of file +var _0x1b92=['musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','execif','gotoif','lastapplication','lastdata','[%s][calls][newexten]','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','ANSWERED','error','hangup','debug','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x1b92,0x1a7));var _0x21b9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1b92[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x21b9('0x0'));var utils=require(_0x21b9('0x1'));var dispositions=[_0x21b9('0x2'),_0x21b9('0x3'),_0x21b9('0x3'),_0x21b9('0x2'),_0x21b9('0x2'),_0x21b9('0x2'),'ANSWERED',_0x21b9('0x4'),'FAILED',_0x21b9('0x3'),_0x21b9('0x3')];var channels={};function writeDB(_0x48f026){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x7'),_0x48f026[_0x21b9('0x8')],_0x48f026[_0x21b9('0x9')],_0x48f026[_0x21b9('0xa')],_0x48f026['membername'],_0x48f026['interface'],_0x48f026['calleridnum'],_0x48f026[_0x21b9('0xb')],_0x48f026['lastevent']));if(_0x48f026[_0x21b9('0xc')]){utils[_0x21b9('0xd')](_0x48f026[_0x21b9('0xc')])[_0x21b9('0xe')](function(_0x23813e){if(_0x23813e){_0x48f026[_0x21b9('0xf')]=_0x23813e['id'];}utils[_0x21b9('0x10')](_0x21b9('0x11'),_0x48f026);});}else{utils['request']('CreateVoiceCallReport',_0x48f026);}if(channels[_0x48f026['uniqueid']]){delete channels[_0x48f026[_0x21b9('0x8')]];}}exports['newchannel']=function(_0x202b9a){try{utils['debug'](util[_0x21b9('0x6')]('[%s][calls][newchannel]',_0x202b9a['uniqueid']),_0x202b9a);if(_0x202b9a[_0x21b9('0x8')]==_0x202b9a[_0x21b9('0x12')]&&_0x202b9a['channel']!='OutgoingSpoolFailed'){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x13'),_0x202b9a[_0x21b9('0x8')],_0x202b9a[_0x21b9('0x14')],_0x202b9a[_0x21b9('0x15')]));channels[_0x202b9a[_0x21b9('0x8')]]={'uniqueid':_0x202b9a[_0x21b9('0x8')],'accountcode':_0x202b9a[_0x21b9('0xc')],'source':_0x202b9a[_0x21b9('0x16')],'destination':_0x202b9a[_0x21b9('0x15')],'destinationcontext':_0x202b9a[_0x21b9('0x14')],'channel':_0x202b9a[_0x21b9('0x9')],'starttime':utils[_0x21b9('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x3619cc){utils['error'](util[_0x21b9('0x6')]('[%s][calls][newchannel]',_0x202b9a[_0x21b9('0x8')]),_0x3619cc);}};exports[_0x21b9('0x18')]=function(_0xfb418f){try{utils['debug'](util[_0x21b9('0x6')](_0x21b9('0x19'),_0xfb418f['uniqueid']),_0xfb418f);if(!_[_0x21b9('0x1a')](channels[_0xfb418f[_0x21b9('0x8')]])&&_0xfb418f[_0x21b9('0x1b')]==0x6){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x1c'),_0xfb418f[_0x21b9('0x8')],_0xfb418f[_0x21b9('0x14')],_0xfb418f[_0x21b9('0x9')]));if(_['isNil'](channels[_0xfb418f['uniqueid']][_0x21b9('0x1d')])){channels[_0xfb418f[_0x21b9('0x8')]][_0x21b9('0x1d')]=utils['now']();}}else if(!_[_0x21b9('0x1a')](channels[_0xfb418f[_0x21b9('0x12')]])&&_0xfb418f[_0x21b9('0x1b')]==0x6&&_0xfb418f[_0x21b9('0x14')]!=_0x21b9('0x1e')){utils['info'](util[_0x21b9('0x6')](_0x21b9('0x1f'),_0xfb418f[_0x21b9('0x8')],_0xfb418f[_0x21b9('0x12')],_0xfb418f['context'],_0xfb418f[_0x21b9('0x9')]));channels[_0xfb418f[_0x21b9('0x12')]][_0x21b9('0xc')]=_0xfb418f[_0x21b9('0xc')];channels[_0xfb418f[_0x21b9('0x12')]][_0x21b9('0x20')]=_0xfb418f[_0x21b9('0x9')];if(_[_0x21b9('0x1a')](channels[_0xfb418f['linkedid']]['answertime'])){channels[_0xfb418f[_0x21b9('0x12')]][_0x21b9('0x21')]=utils[_0x21b9('0x17')]();}channels[_0xfb418f[_0x21b9('0x12')]]['disposition']=dispositions[_['toNumber'](_0xfb418f[_0x21b9('0x1b')])]||_0x21b9('0x22');}}catch(_0x442052){utils[_0x21b9('0x23')](util[_0x21b9('0x6')](_0x21b9('0x19'),_0xfb418f['uniqueid']),_0x442052);}};exports[_0x21b9('0x24')]=function(_0x2944ea){try{if(!_[_0x21b9('0x1a')](channels[_0x2944ea['uniqueid']])){utils[_0x21b9('0x25')](util[_0x21b9('0x6')](_0x21b9('0x26'),_0x2944ea[_0x21b9('0x8')]),_0x2944ea);if(_[_0x21b9('0x1a')](channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x27')])){channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x27')]=_0x2944ea[_0x21b9('0x28')]+'\x20<'+_0x2944ea[_0x21b9('0x16')]+'>';}utils[_0x21b9('0x5')](util[_0x21b9('0x6')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x2944ea[_0x21b9('0x8')],channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x27')],_0x2944ea[_0x21b9('0x29')]));channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2a')]=utils[_0x21b9('0x17')]();channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2b')]=utils[_0x21b9('0x2c')](channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2a')],channels[_0x2944ea[_0x21b9('0x8')]]['starttime']);channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2d')]=channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x21')]?utils['diffTime'](channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2a')],channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x21')]):0x0;writeDB(channels[_0x2944ea[_0x21b9('0x8')]]);}}catch(_0x14533a){utils[_0x21b9('0x23')](util[_0x21b9('0x6')](_0x21b9('0x26'),_0x2944ea[_0x21b9('0x8')]),_0x14533a);}};exports[_0x21b9('0x2e')]=function(_0x481bf8){try{if(!_['isNil'](channels[_0x481bf8[_0x21b9('0x2f')]])){utils[_0x21b9('0x25')](util[_0x21b9('0x6')](_0x21b9('0x30'),_0x481bf8['origtransfereruniqueid']),_0x481bf8);if(channels[_0x481bf8[_0x21b9('0x2f')]]['channel']==_0x481bf8[_0x21b9('0x31')]){utils[_0x21b9('0x5')](util[_0x21b9('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x481bf8[_0x21b9('0x32')],_0x481bf8['localtwolinkedid'],_0x481bf8[_0x21b9('0x33')]));channels[_0x481bf8[_0x21b9('0x2f')]]['destinationchannel']=_0x481bf8['secondtransfererchannel'];channels[_0x481bf8[_0x21b9('0x2f')]][_0x21b9('0x34')]=_0x21b9('0x35');}else if(channels[_0x481bf8[_0x21b9('0x2f')]][_0x21b9('0x9')]=_0x481bf8['transfertargetchannel']){utils[_0x21b9('0x5')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x481bf8['origtransfereruniqueid'],_0x481bf8['localtwolinkedid'],_0x481bf8[_0x21b9('0x36')]));channels[_0x481bf8[_0x21b9('0x2f')]][_0x21b9('0x20')]=_0x481bf8[_0x21b9('0x36')];channels[_0x481bf8[_0x21b9('0x2f')]][_0x21b9('0x34')]=_0x21b9('0x35');}}}catch(_0x2a4e14){utils[_0x21b9('0x23')](util[_0x21b9('0x6')](_0x21b9('0x30'),_0x481bf8[_0x21b9('0x32')]),_0x2a4e14);}};exports['musiconholdstart']=function(_0x213d0c){try{if(!_['isNil'](channels[_0x213d0c[_0x21b9('0x8')]])){utils['debug'](util[_0x21b9('0x6')]('[%s][calls][musiconholdstart]',_0x213d0c[_0x21b9('0x8')]),_0x213d0c);channels[_0x213d0c[_0x21b9('0x8')]]['musiconholdstartAt']=utils[_0x21b9('0x17')]();utils['info'](util[_0x21b9('0x6')](_0x21b9('0x37'),_0x213d0c['uniqueid'],channels[_0x213d0c[_0x21b9('0x8')]][_0x21b9('0x38')]));}}catch(_0x3cf7b6){utils['error'](util[_0x21b9('0x6')]('[%s][calls][musiconholdstart]',_0x213d0c[_0x21b9('0x8')]),_0x3cf7b6);}};exports[_0x21b9('0x39')]=function(_0x1b7fca){try{if(!_[_0x21b9('0x1a')](channels[_0x1b7fca[_0x21b9('0x8')]])){utils[_0x21b9('0x25')](util[_0x21b9('0x6')](_0x21b9('0x3a'),_0x1b7fca[_0x21b9('0x8')]),_0x1b7fca);if(!_[_0x21b9('0x1a')](channels[_0x1b7fca['uniqueid']][_0x21b9('0x38')])){channels[_0x1b7fca['uniqueid']][_0x21b9('0x3b')]+=utils[_0x21b9('0x2c')](utils['now'](),channels[_0x1b7fca['uniqueid']][_0x21b9('0x38')]);utils['info'](util[_0x21b9('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1b7fca[_0x21b9('0x8')],channels[_0x1b7fca[_0x21b9('0x8')]]['mohtime']));delete channels[_0x1b7fca[_0x21b9('0x8')]][_0x21b9('0x38')];}}}catch(_0x2ccce0){utils[_0x21b9('0x23')](util[_0x21b9('0x6')]('[%s][calls][musiconholdstop]',_0x1b7fca[_0x21b9('0x8')]),_0x2ccce0);}};exports[_0x21b9('0x3c')]=function(_0x4fb81b){try{if(!_[_0x21b9('0x1a')](channels[_0x4fb81b['uniqueid']])){utils['debug'](util[_0x21b9('0x6')]('[%s][calls][varset]',_0x4fb81b[_0x21b9('0x8')]),_0x4fb81b);if(!_['isNil'](_0x4fb81b[_0x21b9('0x3d')]['xmd-originatecalleridnum'])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x3e'),_0x4fb81b[_0x21b9('0x8')],_0x4fb81b['value']));channels[_0x4fb81b[_0x21b9('0x8')]]['source']=_0x4fb81b[_0x21b9('0x3f')];}if(!_[_0x21b9('0x1a')](_0x4fb81b['variable'][_0x21b9('0x40')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4fb81b['uniqueid'],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b['uniqueid']][_0x21b9('0x41')]=_0x4fb81b[_0x21b9('0x3f')];channels[_0x4fb81b[_0x21b9('0x8')]][_0x21b9('0x27')]='\x22'+_0x4fb81b[_0x21b9('0x3f')]+_0x21b9('0x42')+_0x4fb81b[_0x21b9('0x3f')]+'>';}if(!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')]['xmd-callerid-preview'])||!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x43')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x44'),_0x4fb81b[_0x21b9('0x8')],!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x45')])?_0x21b9('0x45'):'xmd-callerid',_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]]['callerid']=_0x4fb81b[_0x21b9('0x3f')];}if(!_['isNil'](_0x4fb81b[_0x21b9('0x3d')]['xmd-queue'])||!_[_0x21b9('0x1a')](_0x4fb81b['variable'][_0x21b9('0x46')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x44'),_0x4fb81b['uniqueid'],!_['isNil'](_0x4fb81b['variable'][_0x21b9('0x47')])?_0x21b9('0x47'):_0x21b9('0x46'),_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b['uniqueid']]['lastapplication']='Queue';channels[_0x4fb81b[_0x21b9('0x8')]]['lastdata']=_0x4fb81b[_0x21b9('0x3f')];channels[_0x4fb81b['uniqueid']][_0x21b9('0xa')]=!![];}if(!_[_0x21b9('0x1a')](_0x4fb81b['variable'][_0x21b9('0x48')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4fb81b[_0x21b9('0x8')],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]][_0x21b9('0x49')]=_0x4fb81b['value'];}if(!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x4a')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x4b'),_0x4fb81b[_0x21b9('0x8')],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]]['type']=_0x4fb81b[_0x21b9('0x3f')];}if(!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x4c')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x4d'),_0x4fb81b[_0x21b9('0x8')],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]]['routeid']=_0x4fb81b['value'];}if(!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x4e')])){utils['info'](util[_0x21b9('0x6')](_0x21b9('0x4f'),_0x4fb81b[_0x21b9('0x8')],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]]['sipcallid']=_0x4fb81b[_0x21b9('0x3f')];}}}catch(_0x47f643){utils[_0x21b9('0x23')](util['format'](_0x21b9('0x50'),_0x4fb81b[_0x21b9('0x8')]),_0x47f643);}};exports['newexten']=function(_0x7650eb){try{if(!_[_0x21b9('0x1a')](channels[_0x7650eb[_0x21b9('0x8')]])){utils[_0x21b9('0x25')](util[_0x21b9('0x6')]('[%s][calls][newexten]',_0x7650eb[_0x21b9('0x8')]),_0x7650eb);utils['info'](util[_0x21b9('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x7650eb[_0x21b9('0x8')],_0x7650eb[_0x21b9('0x51')],_0x7650eb[_0x21b9('0x52')]));if(_0x7650eb[_0x21b9('0x51')][_0x21b9('0x53')]()==_0x21b9('0x54')&&_[_0x21b9('0x55')](_0x7650eb[_0x21b9('0x52')][_0x21b9('0x53')](),_0x21b9('0x56'))){var _0x4e216d=_0x7650eb[_0x21b9('0x52')][_0x21b9('0x57')]('=');var _0x292376=_0x4e216d[0x0][_0x21b9('0x58')](_0x4e216d[0x0][_0x21b9('0x59')]('(')+0x1,_0x4e216d[0x0]['lastIndexOf'](')'));var _0x139beb=_0x4e216d[0x1];channels[_0x7650eb[_0x21b9('0x8')]][_0x292376]=_0x139beb;}if(!_[_0x21b9('0x5a')]([_0x21b9('0x24'),'noop',_0x21b9('0x5b'),_0x21b9('0x54'),_0x21b9('0x5c')],_0x7650eb[_0x21b9('0x51')][_0x21b9('0x53')]())){channels[_0x7650eb[_0x21b9('0x8')]][_0x21b9('0x5d')]=_0x7650eb['application'];channels[_0x7650eb['uniqueid']][_0x21b9('0x5e')]=_0x7650eb[_0x21b9('0x52')];}}}catch(_0x3f84ad){utils['error'](util[_0x21b9('0x6')](_0x21b9('0x5f'),_0x7650eb['uniqueid']),_0x3f84ad);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 94aa5b8..d3bf957 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 _0x9ea3=['fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x2e7a41,_0x3cee63){var _0x200c42=function(_0x1b1de1){while(--_0x1b1de1){_0x2e7a41['push'](_0x2e7a41['shift']());}};_0x200c42(++_0x3cee63);}(_0x9ea3,0x126));var _0x39ea=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x9ea3[_0x4e9d3c];return _0x2d0825;};'use strict';var utils=require(_0x39ea('0x0'));exports[_0x39ea('0x1')]=function(){utils[_0x39ea('0x2')](_0x39ea('0x3'));};exports[_0x39ea('0x4')]=function(){utils[_0x39ea('0x2')](_0x39ea('0x5'));};exports[_0x39ea('0x6')]=function(){utils[_0x39ea('0x2')]('[core]\x20fullybooted');};exports[_0x39ea('0x7')]=function(_0x48c66f){utils[_0x39ea('0x7')](_0x39ea('0x8'),_0x48c66f);};exports[_0x39ea('0x9')]=function(){utils['info'](_0x39ea('0xa'));};exports[_0x39ea('0xb')]=function(_0x3f9583){}; \ No newline at end of file +var _0xde28=['[core]\x20connected','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','connect','info'];(function(_0x1d3acb,_0x2cd0a4){var _0x3f88de=function(_0x4ffe9d){while(--_0x4ffe9d){_0x1d3acb['push'](_0x1d3acb['shift']());}};_0x3f88de(++_0x2cd0a4);}(_0xde28,0xae));var _0x8de2=function(_0x43244c,_0xa2a77f){_0x43244c=_0x43244c-0x0;var _0x34babb=_0xde28[_0x43244c];return _0x34babb;};'use strict';var utils=require('./utils');exports[_0x8de2('0x0')]=function(){utils[_0x8de2('0x1')](_0x8de2('0x2'));};exports['shutdown']=function(){utils[_0x8de2('0x1')]('[core]\x20shutdown');};exports[_0x8de2('0x3')]=function(){utils[_0x8de2('0x1')](_0x8de2('0x4'));};exports[_0x8de2('0x5')]=function(_0x3bb0c8){utils['error']('[core]\x20error',_0x3bb0c8);};exports[_0x8de2('0x6')]=function(){utils[_0x8de2('0x1')](_0x8de2('0x7'));};exports['managerevent']=function(_0x3ba61a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index df8b2f4..1507ff4 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 _0x969c=['calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr(routeid)','error','[%s][dials][newexten]','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','starttime','now','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0x2a0045,_0x2015cd){var _0x3e024f=function(_0x2e79d1){while(--_0x2e79d1){_0x2a0045['push'](_0x2a0045['shift']());}};_0x3e024f(++_0x2015cd);}(_0x969c,0x166));var _0xc969=function(_0x123cf7,_0x320daf){_0x123cf7=_0x123cf7-0x0;var _0x799caf=_0x969c[_0x123cf7];return _0x799caf;};'use strict';var _=require(_0xc969('0x0'));var util=require(_0xc969('0x1'));var utils=require(_0xc969('0x2'));var dials={};function writeDB(_0x2aeea6){utils[_0xc969('0x3')](util['format'](_0xc969('0x4'),_0x2aeea6[_0xc969('0x5')],_0x2aeea6[_0xc969('0x6')],_0x2aeea6[_0xc969('0x7')],_0x2aeea6[_0xc969('0x8')],_0x2aeea6[_0xc969('0x9')],_0x2aeea6[_0xc969('0xa')]));utils[_0xc969('0xb')](_0xc969('0xc'),_0x2aeea6);delete dials[_0x2aeea6[_0xc969('0x5')]];}exports[_0xc969('0xd')]=function(_0x196df2){try{utils[_0xc969('0xe')](util[_0xc969('0xf')]('[%s][dials][newexten]',_0x196df2[_0xc969('0x5')]),_0x196df2);utils['info'](util['format'](_0xc969('0x10'),_0x196df2[_0xc969('0x5')],_0x196df2[_0xc969('0x11')],_0x196df2[_0xc969('0x12')]));if(_0x196df2[_0xc969('0x11')]['toLowerCase']()==_0xc969('0x13')&&_[_0xc969('0x14')](_0x196df2[_0xc969('0x12')]['toLowerCase'](),_0xc969('0x15'))){var _0x1a9d25=_0x196df2[_0xc969('0x12')]['split']('=');dials[_0x196df2[_0xc969('0x5')]]={'routeId':_0x1a9d25[0x1]};}}catch(_0x420cd3){utils[_0xc969('0x16')](util[_0xc969('0xf')](_0xc969('0x17'),_0x196df2[_0xc969('0x5')]),_0x420cd3);}};exports['varset']=function(_0x27408e){try{utils['debug'](util[_0xc969('0xf')](_0xc969('0x18'),_0x27408e['uniqueid']),_0x27408e);if(!_[_0xc969('0x19')](_0x27408e[_0xc969('0x1a')][_0xc969('0x1b')])){utils['info'](util[_0xc969('0xf')](_0xc969('0x1c'),_0x27408e[_0xc969('0x5')],_0x27408e['value']));dials[_0x27408e[_0xc969('0x5')]]={'routeId':_0x27408e[_0xc969('0x1d')]};}}catch(_0x44d60d){utils[_0xc969('0x16')](util[_0xc969('0xf')](_0xc969('0x18'),_0x27408e['uniqueid']),_0x44d60d);}};exports['dialbegin']=function(_0x395d27){try{if(!_['isNil'](dials[_0x395d27[_0xc969('0x5')]])){utils[_0xc969('0xe')](util[_0xc969('0xf')]('[%s][dials][dialbegin]',_0x395d27['uniqueid']),_0x395d27);dials[_0x395d27[_0xc969('0x5')]]=_[_0xc969('0x1e')](dials[_0x395d27[_0xc969('0x5')]],_0x395d27);dials[_0x395d27[_0xc969('0x5')]][_0xc969('0x1f')]=utils[_0xc969('0x20')]();dials[_0x395d27['uniqueid']]['lastevent']=_0xc969('0x21');utils[_0xc969('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x395d27[_0xc969('0x5')],dials[_0x395d27[_0xc969('0x5')]][_0xc969('0x1f')]));}}catch(_0xb7a140){utils['error'](util['format'](_0xc969('0x22'),_0x395d27[_0xc969('0x5')]),_0xb7a140);}};exports[_0xc969('0x23')]=function(_0x52eae9){try{if(!_[_0xc969('0x19')](dials[_0x52eae9[_0xc969('0x5')]])){utils[_0xc969('0xe')](util['format'](_0xc969('0x24'),_0x52eae9[_0xc969('0x5')]),_0x52eae9);dials[_0x52eae9['uniqueid']][_0xc969('0xa')]=_0x52eae9[_0xc969('0xa')];if(_0x52eae9[_0xc969('0xa')]==_0xc969('0x25')){dials[_0x52eae9[_0xc969('0x5')]]=_[_0xc969('0x1e')](dials[_0x52eae9[_0xc969('0x5')]],_0x52eae9);dials[_0x52eae9[_0xc969('0x5')]][_0xc969('0x26')]=utils[_0xc969('0x20')]();dials[_0x52eae9[_0xc969('0x5')]]['lastevent']='connect';utils['info'](util[_0xc969('0xf')](_0xc969('0x27'),_0x52eae9[_0xc969('0x5')],_0x52eae9['dialstatus'],dials[_0x52eae9[_0xc969('0x5')]]['answertime']));}else{utils[_0xc969('0x3')](util[_0xc969('0xf')](_0xc969('0x28'),_0x52eae9[_0xc969('0x5')],_0x52eae9[_0xc969('0xa')]));}}}catch(_0x3b2931){utils['error'](util[_0xc969('0xf')](_0xc969('0x24'),_0x52eae9[_0xc969('0x5')]),_0x3b2931);}};exports['hangup']=function(_0x4fb7a5){try{if(!_['isNil'](dials[_0x4fb7a5[_0xc969('0x5')]])){utils[_0xc969('0xe')](util[_0xc969('0xf')]('[%s][dials][hangup]',_0x4fb7a5['uniqueid']),_0x4fb7a5);utils['info'](util[_0xc969('0xf')](_0xc969('0x29'),_0x4fb7a5['uniqueid'],_0x4fb7a5[_0xc969('0x8')],_0x4fb7a5[_0xc969('0x2a')],_0x4fb7a5[_0xc969('0x2b')]));dials[_0x4fb7a5[_0xc969('0x5')]]=_[_0xc969('0x1e')](dials[_0x4fb7a5[_0xc969('0x5')]],{'endtime':utils['now'](),'lastevent':_0xc969('0x2c')});dials[_0x4fb7a5[_0xc969('0x5')]][_0xc969('0x2d')]=utils[_0xc969('0x2e')](dials[_0x4fb7a5['uniqueid']][_0xc969('0x2f')],dials[_0x4fb7a5[_0xc969('0x5')]][_0xc969('0x1f')]);dials[_0x4fb7a5[_0xc969('0x5')]]['holdtime']=utils[_0xc969('0x2e')](dials[_0x4fb7a5['uniqueid']][_0xc969('0x26')]||dials[_0x4fb7a5[_0xc969('0x5')]][_0xc969('0x2f')],dials[_0x4fb7a5['uniqueid']][_0xc969('0x1f')]);dials[_0x4fb7a5['uniqueid']][_0xc969('0x30')]=dials[_0x4fb7a5['uniqueid']][_0xc969('0x26')]?utils[_0xc969('0x2e')](dials[_0x4fb7a5[_0xc969('0x5')]][_0xc969('0x2f')],dials[_0x4fb7a5[_0xc969('0x5')]]['answertime']):0x0;writeDB(dials[_0x4fb7a5['uniqueid']]);}}catch(_0x59b9a4){utils['error'](util[_0xc969('0xf')](_0xc969('0x31'),_0x4fb7a5['uniqueid']),_0x59b9a4);}}; \ No newline at end of file +var _0x65dd=['./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','util'];(function(_0x304eae,_0x2f8dd3){var _0x4a3753=function(_0x531e78){while(--_0x531e78){_0x304eae['push'](_0x304eae['shift']());}};_0x4a3753(++_0x2f8dd3);}(_0x65dd,0x137));var _0xd65d=function(_0x12b5c8,_0x1b3ad8){_0x12b5c8=_0x12b5c8-0x0;var _0x223a78=_0x65dd[_0x12b5c8];return _0x223a78;};'use strict';var _=require('lodash');var util=require(_0xd65d('0x0'));var utils=require(_0xd65d('0x1'));var dials={};function writeDB(_0x372088){utils[_0xd65d('0x2')](util['format'](_0xd65d('0x3'),_0x372088['uniqueid'],_0x372088['channel'],_0x372088[_0xd65d('0x4')],_0x372088[_0xd65d('0x5')],_0x372088[_0xd65d('0x6')],_0x372088[_0xd65d('0x7')]));utils[_0xd65d('0x8')](_0xd65d('0x9'),_0x372088);delete dials[_0x372088[_0xd65d('0xa')]];}exports[_0xd65d('0xb')]=function(_0x217e9f){try{utils[_0xd65d('0xc')](util[_0xd65d('0xd')](_0xd65d('0xe'),_0x217e9f['uniqueid']),_0x217e9f);utils[_0xd65d('0x2')](util[_0xd65d('0xd')](_0xd65d('0xf'),_0x217e9f[_0xd65d('0xa')],_0x217e9f[_0xd65d('0x10')],_0x217e9f[_0xd65d('0x11')]));if(_0x217e9f[_0xd65d('0x10')][_0xd65d('0x12')]()==_0xd65d('0x13')&&_[_0xd65d('0x14')](_0x217e9f[_0xd65d('0x11')][_0xd65d('0x12')](),'cdr(routeid)')){var _0x2f6e64=_0x217e9f[_0xd65d('0x11')][_0xd65d('0x15')]('=');dials[_0x217e9f[_0xd65d('0xa')]]={'routeId':_0x2f6e64[0x1]};}}catch(_0x518e9e){utils['error'](util[_0xd65d('0xd')](_0xd65d('0xe'),_0x217e9f[_0xd65d('0xa')]),_0x518e9e);}};exports[_0xd65d('0x16')]=function(_0x110a1b){try{utils[_0xd65d('0xc')](util['format']('[%s][dials][varset]',_0x110a1b[_0xd65d('0xa')]),_0x110a1b);if(!_[_0xd65d('0x17')](_0x110a1b[_0xd65d('0x18')][_0xd65d('0x19')])){utils['info'](util[_0xd65d('0xd')](_0xd65d('0x1a'),_0x110a1b[_0xd65d('0xa')],_0x110a1b[_0xd65d('0x1b')]));dials[_0x110a1b[_0xd65d('0xa')]]={'routeId':_0x110a1b['value']};}}catch(_0x44329f){utils['error'](util['format'](_0xd65d('0x1c'),_0x110a1b[_0xd65d('0xa')]),_0x44329f);}};exports[_0xd65d('0x1d')]=function(_0x3101db){try{if(!_['isNil'](dials[_0x3101db['uniqueid']])){utils['debug'](util['format'](_0xd65d('0x1e'),_0x3101db['uniqueid']),_0x3101db);dials[_0x3101db['uniqueid']]=_[_0xd65d('0x1f')](dials[_0x3101db[_0xd65d('0xa')]],_0x3101db);dials[_0x3101db['uniqueid']][_0xd65d('0x20')]=utils[_0xd65d('0x21')]();dials[_0x3101db[_0xd65d('0xa')]][_0xd65d('0x22')]='called';utils[_0xd65d('0x2')](util[_0xd65d('0xd')](_0xd65d('0x23'),_0x3101db['uniqueid'],dials[_0x3101db[_0xd65d('0xa')]][_0xd65d('0x20')]));}}catch(_0x1a9e72){utils[_0xd65d('0x24')](util['format'](_0xd65d('0x1e'),_0x3101db[_0xd65d('0xa')]),_0x1a9e72);}};exports['dialend']=function(_0xe01155){try{if(!_[_0xd65d('0x17')](dials[_0xe01155[_0xd65d('0xa')]])){utils[_0xd65d('0xc')](util[_0xd65d('0xd')](_0xd65d('0x25'),_0xe01155[_0xd65d('0xa')]),_0xe01155);dials[_0xe01155[_0xd65d('0xa')]][_0xd65d('0x7')]=_0xe01155[_0xd65d('0x7')];if(_0xe01155[_0xd65d('0x7')]=='ANSWER'){dials[_0xe01155[_0xd65d('0xa')]]=_[_0xd65d('0x1f')](dials[_0xe01155[_0xd65d('0xa')]],_0xe01155);dials[_0xe01155[_0xd65d('0xa')]][_0xd65d('0x26')]=utils[_0xd65d('0x21')]();dials[_0xe01155['uniqueid']][_0xd65d('0x22')]=_0xd65d('0x27');utils[_0xd65d('0x2')](util[_0xd65d('0xd')](_0xd65d('0x28'),_0xe01155[_0xd65d('0xa')],_0xe01155[_0xd65d('0x7')],dials[_0xe01155[_0xd65d('0xa')]][_0xd65d('0x26')]));}else{utils[_0xd65d('0x2')](util[_0xd65d('0xd')](_0xd65d('0x29'),_0xe01155[_0xd65d('0xa')],_0xe01155[_0xd65d('0x7')]));}}}catch(_0x983f58){utils[_0xd65d('0x24')](util[_0xd65d('0xd')](_0xd65d('0x25'),_0xe01155[_0xd65d('0xa')]),_0x983f58);}};exports[_0xd65d('0x2a')]=function(_0x7d32a0){try{if(!_['isNil'](dials[_0x7d32a0[_0xd65d('0xa')]])){utils[_0xd65d('0xc')](util[_0xd65d('0xd')](_0xd65d('0x2b'),_0x7d32a0[_0xd65d('0xa')]),_0x7d32a0);utils[_0xd65d('0x2')](util['format'](_0xd65d('0x2c'),_0x7d32a0[_0xd65d('0xa')],_0x7d32a0[_0xd65d('0x5')],_0x7d32a0[_0xd65d('0x2d')],_0x7d32a0[_0xd65d('0x2e')]));dials[_0x7d32a0['uniqueid']]=_['assign'](dials[_0x7d32a0[_0xd65d('0xa')]],{'endtime':utils[_0xd65d('0x21')](),'lastevent':_0xd65d('0x2f')});dials[_0x7d32a0[_0xd65d('0xa')]]['duration']=utils[_0xd65d('0x30')](dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x31')],dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x20')]);dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x32')]=utils['diffTime'](dials[_0x7d32a0['uniqueid']][_0xd65d('0x26')]||dials[_0x7d32a0['uniqueid']]['endtime'],dials[_0x7d32a0['uniqueid']]['starttime']);dials[_0x7d32a0['uniqueid']][_0xd65d('0x33')]=dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x26')]?utils[_0xd65d('0x30')](dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x31')],dials[_0x7d32a0[_0xd65d('0xa')]]['answertime']):0x0;writeDB(dials[_0x7d32a0[_0xd65d('0xa')]]);}}catch(_0x961fc4){utils['error'](util[_0xd65d('0xd')]('[%s][dials][hangup]',_0x7d32a0[_0xd65d('0xa')]),_0x961fc4);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index faca7f8..972d1a0 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 _0x3835=['[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','disabled','env','production','xdr','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','format','agentringnoanswer'];(function(_0x5aff3b,_0x39d5cb){var _0x1046b3=function(_0x3a1938){while(--_0x3a1938){_0x5aff3b['push'](_0x5aff3b['shift']());}};_0x1046b3(++_0x39d5cb);}(_0x3835,0x187));var _0x5383=function(_0x5dfde8,_0xa2f77d){_0x5dfde8=_0x5dfde8-0x0;var _0x2253fb=_0x3835[_0x5dfde8];return _0x2253fb;};var AsteriskManager=require(_0x5383('0x0'));var config=require('../../config/environment');var utils=require(_0x5383('0x1'));var util=require(_0x5383('0x2'));var isXDREnabled=config['xdr']&&config['xdr'][_0x5383('0x3')]?!config['xdr'][_0x5383('0x3')]:!![];var isProduction=config[_0x5383('0x4')]===_0x5383('0x5')||![];var isLocalAsterisk=config[_0x5383('0x6')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x5383('0x7')][_0x5383('0x8')],config['asterisk']['ip'],config[_0x5383('0x7')][_0x5383('0x9')],config[_0x5383('0x7')][_0x5383('0xa')],!![]);ami[_0x5383('0xb')]();if(!isXDREnabled){utils[_0x5383('0xc')](_0x5383('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5383('0xc')](_0x5383('0xe'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x5383('0xf'));var members=require(_0x5383('0x10'));var dials=require(_0x5383('0x11'));var transfers=require(_0x5383('0x12'));var core=require(_0x5383('0x13'));ami['on'](_0x5383('0x14'),core['connect']);ami['on']('shutdown',core[_0x5383('0x15')]);ami['on'](_0x5383('0x16'),core[_0x5383('0x16')]);ami['on'](_0x5383('0x17'),core[_0x5383('0x17')]);ami['on'](_0x5383('0x18'),core[_0x5383('0x18')]);ami['on'](_0x5383('0x19'),core[_0x5383('0x19')]);ami['on'](_0x5383('0x1a'),function(_0x38186e){try{utils['debug'](util['format'](_0x5383('0x1b'),_0x38186e[_0x5383('0x1c')]),_0x38186e);members[_0x5383('0x1a')](_0x38186e);}catch(_0x2d74ab){utils[_0x5383('0x17')](util['format'](_0x5383('0x1b'),_0x38186e[_0x5383('0x1c')]),_0x2d74ab);}});ami['on'](_0x5383('0x1d'),function(_0x499723){try{utils[_0x5383('0x1e')](util['format'](_0x5383('0x1f'),_0x499723[_0x5383('0x20')]),_0x499723);agents[_0x5383('0x1d')](_0x499723);}catch(_0x1affa1){utils[_0x5383('0x17')](util[_0x5383('0x21')](_0x5383('0x1f'),_0x499723['uniqueid']),_0x1affa1);}});ami['on'](_0x5383('0x22'),function(_0x4ab13c){try{utils[_0x5383('0x1e')](util['format'](_0x5383('0x23'),_0x4ab13c[_0x5383('0x20')]),_0x4ab13c);agents['agentringnoanswer'](_0x4ab13c);}catch(_0x19f1ff){utils[_0x5383('0x17')](util[_0x5383('0x21')](_0x5383('0x23'),_0x4ab13c['uniqueid']),_0x19f1ff);}});ami['on'](_0x5383('0x24'),function(_0x520614){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')](_0x5383('0x25'),_0x520614['uniqueid']),_0x520614);agents[_0x5383('0x24')](_0x520614);queues[_0x5383('0x24')](_0x520614);}catch(_0x1631b9){utils[_0x5383('0x17')](util[_0x5383('0x21')](_0x5383('0x25'),_0x520614[_0x5383('0x20')]),_0x1631b9);}});ami['on']('agentcomplete',function(_0xb53595){try{utils['debug'](util[_0x5383('0x21')](_0x5383('0x26'),_0xb53595['uniqueid']),_0xb53595);agents['agentcomplete'](_0xb53595);queues['agentcomplete'](_0xb53595);members[_0x5383('0x27')](_0xb53595);}catch(_0x11eb6e){utils[_0x5383('0x17')](util[_0x5383('0x21')](_0x5383('0x26'),_0xb53595[_0x5383('0x20')]),_0x11eb6e);}});ami['on'](_0x5383('0x28'),function(_0x1f351b){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')]('[%s][index][queuecallerabandon]',_0x1f351b[_0x5383('0x20')]),_0x1f351b);agents[_0x5383('0x28')](_0x1f351b);queues['queuecallerabandon'](_0x1f351b);}catch(_0x5cc8ff){utils[_0x5383('0x17')](util[_0x5383('0x21')](_0x5383('0x29'),_0x1f351b[_0x5383('0x20')]),_0x5cc8ff);}});ami['on'](_0x5383('0x2a'),function(_0x17186d){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')](_0x5383('0x2b'),_0x17186d[_0x5383('0x20')]),_0x17186d);queues[_0x5383('0x2a')](_0x17186d);recordings[_0x5383('0x2a')](_0x17186d);}catch(_0x586a16){utils['error'](util[_0x5383('0x21')](_0x5383('0x2b'),_0x17186d[_0x5383('0x20')]),_0x586a16);}});ami['on'](_0x5383('0x2c'),function(_0xc1bd8e){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')]('[%s][index][queuecallerleave]',_0xc1bd8e[_0x5383('0x20')]),_0xc1bd8e);queues[_0x5383('0x2c')](_0xc1bd8e);}catch(_0x3de64a){utils['error'](util[_0x5383('0x21')](_0x5383('0x2d'),_0xc1bd8e[_0x5383('0x20')]),_0x3de64a);}});ami['on']('musiconholdstart',function(_0x3fabac){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')](_0x5383('0x2e'),_0x3fabac[_0x5383('0x20')]),_0x3fabac);queues[_0x5383('0x2f')](_0x3fabac);calls['musiconholdstart'](_0x3fabac);}catch(_0x257267){utils['error'](util['format']('[%s][index][musiconholdstart]',_0x3fabac['uniqueid']),_0x257267);}});ami['on']('musiconholdstop',function(_0x5ed66c){try{utils[_0x5383('0x1e')](util['format'](_0x5383('0x30'),_0x5ed66c[_0x5383('0x20')]),_0x5ed66c);queues['musiconholdstop'](_0x5ed66c);calls['musiconholdstop'](_0x5ed66c);}catch(_0x1065f3){utils['error'](util[_0x5383('0x21')](_0x5383('0x30'),_0x5ed66c[_0x5383('0x20')]),_0x1065f3);}});ami['on']('newstate',function(_0x1e47ab){try{utils[_0x5383('0x1e')](util['format']('[%s][index][newstate]',_0x1e47ab[_0x5383('0x20')]),_0x1e47ab);calls['newstate'](_0x1e47ab);recordings[_0x5383('0x31')](_0x1e47ab);}catch(_0x39a2d2){utils['error'](util[_0x5383('0x21')](_0x5383('0x32'),_0x1e47ab['uniqueid']),_0x39a2d2);}});ami['on'](_0x5383('0x33'),function(_0x4eddcf){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')](_0x5383('0x34'),_0x4eddcf[_0x5383('0x20')]),_0x4eddcf);calls[_0x5383('0x33')](_0x4eddcf);recordings[_0x5383('0x33')](_0x4eddcf);dials['hangup'](_0x4eddcf);agents[_0x5383('0x33')](_0x4eddcf);queues[_0x5383('0x33')](_0x4eddcf);}catch(_0x5f0d87){utils[_0x5383('0x17')](util[_0x5383('0x21')](_0x5383('0x34'),_0x4eddcf[_0x5383('0x20')]),_0x5f0d87);}});ami['on']('cdr',function(_0x355257){try{utils['debug'](util[_0x5383('0x21')](_0x5383('0x35'),_0x355257[_0x5383('0x20')]),_0x355257);members[_0x5383('0x36')](_0x355257);}catch(_0x8c8380){utils[_0x5383('0x17')](util[_0x5383('0x21')](_0x5383('0x35'),_0x355257[_0x5383('0x20')]),_0x8c8380);}});ami['on'](_0x5383('0x37'),function(_0x3642bc){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')](_0x5383('0x38'),_0x3642bc[_0x5383('0x20')]),_0x3642bc);queues[_0x5383('0x37')](_0x3642bc);agents[_0x5383('0x37')](_0x3642bc);transfers[_0x5383('0x37')](_0x3642bc);}catch(_0x534b66){utils['error'](util[_0x5383('0x21')](_0x5383('0x38'),_0x3642bc[_0x5383('0x20')]),_0x534b66);}});ami['on'](_0x5383('0x39'),function(_0x4d9140){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')](_0x5383('0x3a'),_0x4d9140[_0x5383('0x3b')]),_0x4d9140);queues[_0x5383('0x39')](_0x4d9140);transfers[_0x5383('0x39')](_0x4d9140);agents[_0x5383('0x39')](_0x4d9140);calls['attendedtransfer'](_0x4d9140);}catch(_0x3238b6){utils[_0x5383('0x17')](util[_0x5383('0x21')](_0x5383('0x3a'),_0x4d9140[_0x5383('0x3b')]),_0x3238b6);}});ami['on']('varset',function(_0x52282d){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')]('[%s][index][varset]',_0x52282d[_0x5383('0x20')]),_0x52282d);queues[_0x5383('0x3c')](_0x52282d);recordings['varset'](_0x52282d);calls[_0x5383('0x3c')](_0x52282d);dials['varset'](_0x52282d);}catch(_0x182545){utils[_0x5383('0x17')](util[_0x5383('0x21')](_0x5383('0x3d'),_0x52282d['uniqueid']),_0x182545);}});ami['on'](_0x5383('0x3e'),function(_0x28297a){try{utils[_0x5383('0x1e')](util['format'](_0x5383('0x3f'),_0x28297a[_0x5383('0x20')]),_0x28297a);calls[_0x5383('0x3e')](_0x28297a);recordings[_0x5383('0x3e')](_0x28297a);dials[_0x5383('0x3e')](_0x28297a);}catch(_0x205d88){utils['error'](util[_0x5383('0x21')](_0x5383('0x3f'),_0x28297a[_0x5383('0x20')]),_0x205d88);}});ami['on'](_0x5383('0x40'),function(_0x3b698a){try{utils['debug'](util[_0x5383('0x21')](_0x5383('0x41'),_0x3b698a[_0x5383('0x20')]),_0x3b698a);calls[_0x5383('0x40')](_0x3b698a);recordings[_0x5383('0x40')](_0x3b698a);}catch(_0x57afe3){utils[_0x5383('0x17')](util['format'](_0x5383('0x41'),_0x3b698a[_0x5383('0x20')]),_0x57afe3);}});ami['on'](_0x5383('0x42'),function(_0x2b0be4){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')](_0x5383('0x43'),_0x2b0be4['uniqueid']),_0x2b0be4);dials['dialbegin'](_0x2b0be4);}catch(_0x394a60){utils[_0x5383('0x17')](util['format'](_0x5383('0x44'),_0x2b0be4['uniqueid']),_0x394a60);}});ami['on'](_0x5383('0x45'),function(_0x1924b2){try{utils[_0x5383('0x1e')](util[_0x5383('0x21')](_0x5383('0x46'),_0x1924b2[_0x5383('0x20')]),_0x1924b2);dials[_0x5383('0x45')](_0x1924b2);}catch(_0x255010){utils['error'](util[_0x5383('0x21')](_0x5383('0x46'),_0x1924b2[_0x5383('0x20')]),_0x255010);}});} \ No newline at end of file +var _0xb81d=['managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','error','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','asterisk','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','close'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0xb81d,0x1d3));var _0xdb81=function(_0x37bc7c,_0x2cae93){_0x37bc7c=_0x37bc7c-0x0;var _0x4bef12=_0xb81d[_0x37bc7c];return _0x4bef12;};var AsteriskManager=require(_0xdb81('0x0'));var config=require(_0xdb81('0x1'));var utils=require(_0xdb81('0x2'));var util=require(_0xdb81('0x3'));var isXDREnabled=config[_0xdb81('0x4')]&&config['xdr'][_0xdb81('0x5')]?!config[_0xdb81('0x4')][_0xdb81('0x5')]:!![];var isProduction=config[_0xdb81('0x6')]===_0xdb81('0x7')||![];var isLocalAsterisk=config[_0xdb81('0x4')]&&config[_0xdb81('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0xdb81('0x8')]['ip'],config[_0xdb81('0x8')]['username'],config[_0xdb81('0x8')][_0xdb81('0x9')],!![]);ami[_0xdb81('0xa')]();if(!isXDREnabled){utils[_0xdb81('0xb')](_0xdb81('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xdb81('0xd'));var calls=require(_0xdb81('0xe'));var queues=require('./queues.controller');var recordings=require(_0xdb81('0xf'));var members=require(_0xdb81('0x10'));var dials=require(_0xdb81('0x11'));var transfers=require('./transfers.controller');var core=require(_0xdb81('0x12'));ami['on'](_0xdb81('0x13'),core[_0xdb81('0x13')]);ami['on'](_0xdb81('0x14'),core[_0xdb81('0x14')]);ami['on'](_0xdb81('0x15'),core[_0xdb81('0x15')]);ami['on']('error',core['error']);ami['on'](_0xdb81('0x16'),core[_0xdb81('0x16')]);ami['on'](_0xdb81('0x17'),core[_0xdb81('0x17')]);ami['on'](_0xdb81('0x18'),function(_0x16b659){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x1b'),_0x16b659[_0xdb81('0x1c')]),_0x16b659);members[_0xdb81('0x18')](_0x16b659);}catch(_0x4c4753){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x1b'),_0x16b659[_0xdb81('0x1c')]),_0x4c4753);}});ami['on']('agentcalled',function(_0x5703bc){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x1e'),_0x5703bc[_0xdb81('0x1f')]),_0x5703bc);agents[_0xdb81('0x20')](_0x5703bc);}catch(_0x3cf1e8){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')]('[%s][index][agentcalled]',_0x5703bc['uniqueid']),_0x3cf1e8);}});ami['on'](_0xdb81('0x21'),function(_0xb66739){try{utils[_0xdb81('0x19')](util['format'](_0xdb81('0x22'),_0xb66739['uniqueid']),_0xb66739);agents['agentringnoanswer'](_0xb66739);}catch(_0x131fe0){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')]('[%s][index][agentringnoanswer]',_0xb66739['uniqueid']),_0x131fe0);}});ami['on'](_0xdb81('0x23'),function(_0x1b0d9b){try{utils[_0xdb81('0x19')](util['format']('[%s][index][agentconnect]',_0x1b0d9b['uniqueid']),_0x1b0d9b);agents['agentconnect'](_0x1b0d9b);queues[_0xdb81('0x23')](_0x1b0d9b);}catch(_0x5e62ca){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x24'),_0x1b0d9b[_0xdb81('0x1f')]),_0x5e62ca);}});ami['on']('agentcomplete',function(_0x31b3d5){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')]('[%s][index][agentcomplete]',_0x31b3d5[_0xdb81('0x1f')]),_0x31b3d5);agents[_0xdb81('0x25')](_0x31b3d5);queues[_0xdb81('0x25')](_0x31b3d5);members['agentcomplete'](_0x31b3d5);}catch(_0x360ec4){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x26'),_0x31b3d5[_0xdb81('0x1f')]),_0x360ec4);}});ami['on']('queuecallerabandon',function(_0x2f099a){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x27'),_0x2f099a[_0xdb81('0x1f')]),_0x2f099a);agents[_0xdb81('0x28')](_0x2f099a);queues[_0xdb81('0x28')](_0x2f099a);}catch(_0x3ef272){utils['error'](util[_0xdb81('0x1a')](_0xdb81('0x27'),_0x2f099a['uniqueid']),_0x3ef272);}});ami['on'](_0xdb81('0x29'),function(_0x5166b5){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x2a'),_0x5166b5[_0xdb81('0x1f')]),_0x5166b5);queues[_0xdb81('0x29')](_0x5166b5);recordings['queuecallerjoin'](_0x5166b5);}catch(_0x126c1b){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x2a'),_0x5166b5[_0xdb81('0x1f')]),_0x126c1b);}});ami['on'](_0xdb81('0x2b'),function(_0x5d39ec){try{utils['debug'](util['format'](_0xdb81('0x2c'),_0x5d39ec['uniqueid']),_0x5d39ec);queues['queuecallerleave'](_0x5d39ec);}catch(_0x1b1a93){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x2c'),_0x5d39ec['uniqueid']),_0x1b1a93);}});ami['on'](_0xdb81('0x2d'),function(_0x3cc54c){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x2e'),_0x3cc54c[_0xdb81('0x1f')]),_0x3cc54c);queues[_0xdb81('0x2d')](_0x3cc54c);calls[_0xdb81('0x2d')](_0x3cc54c);}catch(_0x3c332e){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x2e'),_0x3cc54c[_0xdb81('0x1f')]),_0x3c332e);}});ami['on'](_0xdb81('0x2f'),function(_0x215ef9){try{utils['debug'](util[_0xdb81('0x1a')](_0xdb81('0x30'),_0x215ef9[_0xdb81('0x1f')]),_0x215ef9);queues[_0xdb81('0x2f')](_0x215ef9);calls[_0xdb81('0x2f')](_0x215ef9);}catch(_0x3aeb6c){utils[_0xdb81('0x1d')](util['format'](_0xdb81('0x30'),_0x215ef9['uniqueid']),_0x3aeb6c);}});ami['on'](_0xdb81('0x31'),function(_0x3a93a9){try{utils['debug'](util[_0xdb81('0x1a')]('[%s][index][newstate]',_0x3a93a9[_0xdb81('0x1f')]),_0x3a93a9);calls[_0xdb81('0x31')](_0x3a93a9);recordings[_0xdb81('0x31')](_0x3a93a9);}catch(_0xf635e){utils['error'](util['format'](_0xdb81('0x32'),_0x3a93a9[_0xdb81('0x1f')]),_0xf635e);}});ami['on'](_0xdb81('0x33'),function(_0x20f7af){try{utils[_0xdb81('0x19')](util['format'](_0xdb81('0x34'),_0x20f7af[_0xdb81('0x1f')]),_0x20f7af);calls[_0xdb81('0x33')](_0x20f7af);recordings[_0xdb81('0x33')](_0x20f7af);dials['hangup'](_0x20f7af);agents[_0xdb81('0x33')](_0x20f7af);queues['hangup'](_0x20f7af);}catch(_0x205b52){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x34'),_0x20f7af[_0xdb81('0x1f')]),_0x205b52);}});ami['on'](_0xdb81('0x35'),function(_0x338f70){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x36'),_0x338f70[_0xdb81('0x1f')]),_0x338f70);members[_0xdb81('0x35')](_0x338f70);}catch(_0x4aa17b){utils[_0xdb81('0x1d')](util['format'](_0xdb81('0x36'),_0x338f70[_0xdb81('0x1f')]),_0x4aa17b);}});ami['on']('blindtransfer',function(_0x28aca3){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x37'),_0x28aca3[_0xdb81('0x1f')]),_0x28aca3);queues[_0xdb81('0x38')](_0x28aca3);agents[_0xdb81('0x38')](_0x28aca3);transfers[_0xdb81('0x38')](_0x28aca3);}catch(_0x4b4306){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x37'),_0x28aca3['uniqueid']),_0x4b4306);}});ami['on']('attendedtransfer',function(_0x42035a){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x39'),_0x42035a[_0xdb81('0x3a')]),_0x42035a);queues[_0xdb81('0x3b')](_0x42035a);transfers[_0xdb81('0x3b')](_0x42035a);agents[_0xdb81('0x3b')](_0x42035a);calls[_0xdb81('0x3b')](_0x42035a);}catch(_0x5c077d){utils[_0xdb81('0x1d')](util['format']('[%s][index][attendedtransfer]',_0x42035a[_0xdb81('0x3a')]),_0x5c077d);}});ami['on'](_0xdb81('0x3c'),function(_0x24754c){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x3d'),_0x24754c['uniqueid']),_0x24754c);queues[_0xdb81('0x3c')](_0x24754c);recordings[_0xdb81('0x3c')](_0x24754c);calls[_0xdb81('0x3c')](_0x24754c);dials[_0xdb81('0x3c')](_0x24754c);}catch(_0x32ddcc){utils['error'](util[_0xdb81('0x1a')](_0xdb81('0x3d'),_0x24754c[_0xdb81('0x1f')]),_0x32ddcc);}});ami['on'](_0xdb81('0x3e'),function(_0x5a48eb){try{utils[_0xdb81('0x19')](util['format']('[%s][index][newexten]',_0x5a48eb[_0xdb81('0x1f')]),_0x5a48eb);calls[_0xdb81('0x3e')](_0x5a48eb);recordings['newexten'](_0x5a48eb);dials['newexten'](_0x5a48eb);}catch(_0x590f06){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x3f'),_0x5a48eb['uniqueid']),_0x590f06);}});ami['on'](_0xdb81('0x40'),function(_0x2a2d74){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')]('[%s][index][newchannel]',_0x2a2d74[_0xdb81('0x1f')]),_0x2a2d74);calls[_0xdb81('0x40')](_0x2a2d74);recordings['newchannel'](_0x2a2d74);}catch(_0x27d7c6){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x41'),_0x2a2d74[_0xdb81('0x1f')]),_0x27d7c6);}});ami['on']('dialbegin',function(_0x3a3ece){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')]('[%s][index][dialbegin]',_0x3a3ece[_0xdb81('0x1f')]),_0x3a3ece);dials[_0xdb81('0x42')](_0x3a3ece);}catch(_0x1e4fe7){utils['error'](util[_0xdb81('0x1a')](_0xdb81('0x43'),_0x3a3ece[_0xdb81('0x1f')]),_0x1e4fe7);}});ami['on'](_0xdb81('0x44'),function(_0x5aa20c){try{utils[_0xdb81('0x19')](util['format'](_0xdb81('0x45'),_0x5aa20c['uniqueid']),_0x5aa20c);dials[_0xdb81('0x44')](_0x5aa20c);}catch(_0x4696a1){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x45'),_0x5aa20c[_0xdb81('0x1f')]),_0x4696a1);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ace14a7..eb75ff8 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 _0x3eec=['queue','assign','cdr','[%s][members][cdr]','channel','split','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','name','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s'];(function(_0x490210,_0x4ab8bf){var _0xe463d5=function(_0xa0b79a){while(--_0xa0b79a){_0x490210['push'](_0x490210['shift']());}};_0xe463d5(++_0x4ab8bf);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x3b4ee6,_0x111912){_0x3b4ee6=_0x3b4ee6-0x0;var _0x1c5ed9=_0x3eec[_0x3b4ee6];return _0x1c5ed9;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var utils=require(_0xc3ee('0x2'));var members={};var exclude=[_0xc3ee('0x3'),'Queue:'];function writeDB(_0x223d08){utils[_0xc3ee('0x4')](util[_0xc3ee('0x5')](_0xc3ee('0x6'),_0x223d08[_0xc3ee('0x7')],_0x223d08[_0xc3ee('0x8')],_0x223d08['channel'],_0x223d08[_0xc3ee('0x9')],_0x223d08[_0xc3ee('0xa')],_0x223d08[_0xc3ee('0xb')]));if(_0x223d08[_0xc3ee('0x8')]){utils[_0xc3ee('0xc')](_0x223d08[_0xc3ee('0x8')])[_0xc3ee('0xd')](function(_0x2c9701){if(_0x2c9701){_0x223d08[_0xc3ee('0xa')]=_0x2c9701[_0xc3ee('0xe')];_0x223d08['internal']=_0x2c9701['internal'];utils[_0xc3ee('0xf')](_0xc3ee('0x10'),_0x223d08);}else{utils[_0xc3ee('0x11')](_0x223d08[_0xc3ee('0x8')]['split']('/')[0x1])[_0xc3ee('0xd')](function(_0x4b1bff){if(_0x4b1bff){_0x223d08[_0xc3ee('0xa')]=_0x4b1bff[_0xc3ee('0xe')];_0x223d08['internal']=_0x4b1bff['internal'];utils[_0xc3ee('0xf')]('CreateMemberReport',_0x223d08);}});}})[_0xc3ee('0x12')](function(_0x535d1a){utils[_0xc3ee('0x13')](util['format'](_0xc3ee('0x14'),_0x223d08[_0xc3ee('0x7')]),_0x535d1a);});}delete members[_0x223d08[_0xc3ee('0x8')]];}function startsWith(_0x664bad,_0x476f8f){return _[_0xc3ee('0x15')](_0x664bad,function(_0x277e11){return _['startsWith'](_0x476f8f,_0x277e11);});}exports[_0xc3ee('0x16')]=function(_0x4eea89){try{utils[_0xc3ee('0x17')](util[_0xc3ee('0x5')](_0xc3ee('0x18'),members[_0x4eea89[_0xc3ee('0x19')]]?members[_0x4eea89[_0xc3ee('0x19')]][_0xc3ee('0x7')]:_0x4eea89[_0xc3ee('0x19')]),_0x4eea89);utils[_0xc3ee('0x4')](util[_0xc3ee('0x5')](_0xc3ee('0x1a'),members[_0x4eea89[_0xc3ee('0x19')]]?members[_0x4eea89[_0xc3ee('0x19')]][_0xc3ee('0x7')]:_0x4eea89[_0xc3ee('0x19')],_0x4eea89[_0xc3ee('0x1b')],_0x4eea89[_0xc3ee('0x19')]));switch(_0x4eea89[_0xc3ee('0x1b')]){case _0xc3ee('0x1c'):case _0xc3ee('0x1d'):if(!startsWith(exclude,_0x4eea89[_0xc3ee('0x19')])){members[_0x4eea89[_0xc3ee('0x19')]]={'channel':'voice','interface':_0x4eea89['device'],'type':_0xc3ee('0x1e'),'enterAt':utils[_0xc3ee('0x1f')](),'role':_0xc3ee('0x20')};}break;case _0xc3ee('0x21'):if(!_[_0xc3ee('0x22')](members[_0x4eea89[_0xc3ee('0x19')]])){members[_0x4eea89['device']][_0xc3ee('0x23')]=utils[_0xc3ee('0x1f')]();members[_0x4eea89[_0xc3ee('0x19')]][_0xc3ee('0x24')]=utils[_0xc3ee('0x25')](members[_0x4eea89['device']]['exitAt'],members[_0x4eea89[_0xc3ee('0x19')]][_0xc3ee('0x26')]);if(members[_0x4eea89[_0xc3ee('0x19')]][_0xc3ee('0x7')]){writeDB(members[_0x4eea89[_0xc3ee('0x19')]]);}}break;default:break;}}catch(_0x4ecfec){utils['error'](util['format'](_0xc3ee('0x18'),members[_0x4eea89[_0xc3ee('0x19')]]?members[_0x4eea89[_0xc3ee('0x19')]][_0xc3ee('0x7')]:_0x4eea89[_0xc3ee('0x19')]),_0x4ecfec);}};exports['agentcomplete']=function(_0x13f30d){try{if(!_[_0xc3ee('0x22')](members[_0x13f30d[_0xc3ee('0x8')]])){utils[_0xc3ee('0x17')](util[_0xc3ee('0x5')](_0xc3ee('0x27'),_0x13f30d[_0xc3ee('0x7')]),_0x13f30d);utils['info'](util[_0xc3ee('0x5')](_0xc3ee('0x28'),_0x13f30d[_0xc3ee('0x7')],_0x13f30d['interface'],_0x13f30d[_0xc3ee('0x29')]));members[_0x13f30d[_0xc3ee('0x8')]]=_[_0xc3ee('0x2a')](members[_0x13f30d[_0xc3ee('0x8')]],{'data4':_0x13f30d[_0xc3ee('0x29')],'uniqueid':_0x13f30d[_0xc3ee('0x7')]});}}catch(_0x16677d){utils['error'](util[_0xc3ee('0x5')]('[%s][members][agentcomplete]',_0x13f30d[_0xc3ee('0x7')]),_0x16677d);}};exports[_0xc3ee('0x2b')]=function(_0x13d6e5){try{utils[_0xc3ee('0x17')](util[_0xc3ee('0x5')](_0xc3ee('0x2c'),_0x13d6e5['uniqueid']),_0x13d6e5);if(_0x13d6e5[_0xc3ee('0x2d')]){var _0x3f2e5a=_0x13d6e5[_0xc3ee('0x2d')][_0xc3ee('0x2e')]('-')[0x0];if(!_[_0xc3ee('0x22')](members[_0x3f2e5a])){members[_0x3f2e5a]=_[_0xc3ee('0x2a')](members[_0x3f2e5a],{'data1':members[_0x3f2e5a][_0xc3ee('0x2f')]||_0x13d6e5[_0xc3ee('0xb')],'data2':members[_0x3f2e5a][_0xc3ee('0x9')]||_0x13d6e5[_0xc3ee('0x30')],'data3':members[_0x3f2e5a][_0xc3ee('0x31')]||_0x13d6e5[_0xc3ee('0x32')],'uniqueid':members[_0x3f2e5a][_0xc3ee('0x7')]||_0x13d6e5[_0xc3ee('0x7')]});utils[_0xc3ee('0x4')](util[_0xc3ee('0x5')](_0xc3ee('0x33'),_0x13d6e5[_0xc3ee('0x7')],members[_0x3f2e5a][_0xc3ee('0x2f')],members[_0x3f2e5a][_0xc3ee('0x9')],members[_0x3f2e5a][_0xc3ee('0x31')]));if(members[_0x3f2e5a]['exitAt']){writeDB(members[_0x3f2e5a]);}}}if(_0x13d6e5[_0xc3ee('0x34')]){var _0x548df8=_0x13d6e5[_0xc3ee('0x34')][_0xc3ee('0x2e')]('-')[0x0];if(!_[_0xc3ee('0x22')](members[_0x548df8])){members[_0x548df8]=_[_0xc3ee('0x2a')](members[_0x548df8],{'data1':members[_0x548df8][_0xc3ee('0x2f')]||_0x13d6e5[_0xc3ee('0xb')],'data2':members[_0x548df8]['data2']||_0x13d6e5[_0xc3ee('0x30')],'data3':members[_0x548df8][_0xc3ee('0x31')]||_0x13d6e5[_0xc3ee('0x32')],'uniqueid':members[_0x548df8]['uniqueid']||_0x13d6e5[_0xc3ee('0x7')]});utils[_0xc3ee('0x4')](util[_0xc3ee('0x5')](_0xc3ee('0x33'),_0x13d6e5[_0xc3ee('0x7')],members[_0x548df8][_0xc3ee('0x2f')],members[_0x548df8][_0xc3ee('0x9')],members[_0x548df8][_0xc3ee('0x31')]));if(members[_0x548df8][_0xc3ee('0x23')]){writeDB(members[_0x548df8]);}}}}catch(_0x23d365){utils[_0xc3ee('0x13')](util['format'](_0xc3ee('0x2c'),_0x13d6e5[_0xc3ee('0x7')]),_0x23d365);}}; \ No newline at end of file +var _0x2c64=['[%s][members][writeDB]','startsWith','devicestatechange','debug','format','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','agent','NOT_INUSE','exitAt','now','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','data1','type','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','interface','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','error'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x2c64,0xbf));var _0x42c6=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x2c64[_0x74892f];return _0x10ee61;};'use strict';var _=require(_0x42c6('0x0'));var util=require('util');var utils=require(_0x42c6('0x1'));var members={};var exclude=[_0x42c6('0x2'),_0x42c6('0x3')];function writeDB(_0xdd6011){utils[_0x42c6('0x4')](util['format'](_0x42c6('0x5'),_0xdd6011[_0x42c6('0x6')],_0xdd6011['interface'],_0xdd6011[_0x42c6('0x7')],_0xdd6011[_0x42c6('0x8')],_0xdd6011[_0x42c6('0x9')],_0xdd6011['type']));if(_0xdd6011[_0x42c6('0xa')]){utils[_0x42c6('0xb')](_0xdd6011['interface'])[_0x42c6('0xc')](function(_0x42f0ac){if(_0x42f0ac){_0xdd6011['membername']=_0x42f0ac['name'];_0xdd6011[_0x42c6('0xd')]=_0x42f0ac[_0x42c6('0xd')];utils[_0x42c6('0xe')](_0x42c6('0xf'),_0xdd6011);}else{utils[_0x42c6('0x10')](_0xdd6011[_0x42c6('0xa')][_0x42c6('0x11')]('/')[0x1])['then'](function(_0x57fab7){if(_0x57fab7){_0xdd6011[_0x42c6('0x9')]=_0x57fab7[_0x42c6('0x12')];_0xdd6011['internal']=_0x57fab7[_0x42c6('0xd')];utils[_0x42c6('0xe')](_0x42c6('0xf'),_0xdd6011);}});}})[_0x42c6('0x13')](function(_0x3a008f){utils[_0x42c6('0x14')](util['format'](_0x42c6('0x15'),_0xdd6011[_0x42c6('0x6')]),_0x3a008f);});}delete members[_0xdd6011[_0x42c6('0xa')]];}function startsWith(_0x58e66b,_0x570918){return _['some'](_0x58e66b,function(_0x2825d0){return _[_0x42c6('0x16')](_0x570918,_0x2825d0);});}exports[_0x42c6('0x17')]=function(_0xa47b34){try{utils[_0x42c6('0x18')](util[_0x42c6('0x19')](_0x42c6('0x1a'),members[_0xa47b34['device']]?members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x6')]:_0xa47b34[_0x42c6('0x1b')]),_0xa47b34);utils['info'](util[_0x42c6('0x19')](_0x42c6('0x1c'),members[_0xa47b34[_0x42c6('0x1b')]]?members[_0xa47b34['device']]['uniqueid']:_0xa47b34['device'],_0xa47b34[_0x42c6('0x1d')],_0xa47b34['device']));switch(_0xa47b34[_0x42c6('0x1d')]){case _0x42c6('0x1e'):case'BUSY':if(!startsWith(exclude,_0xa47b34[_0x42c6('0x1b')])){members[_0xa47b34[_0x42c6('0x1b')]]={'channel':'voice','interface':_0xa47b34['device'],'type':_0x42c6('0x1f'),'enterAt':utils['now'](),'role':_0x42c6('0x20')};}break;case _0x42c6('0x21'):if(!_['isNil'](members[_0xa47b34[_0x42c6('0x1b')]])){members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x22')]=utils[_0x42c6('0x23')]();members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x24')]=utils[_0x42c6('0x25')](members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x22')],members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x26')]);if(members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x6')]){writeDB(members[_0xa47b34[_0x42c6('0x1b')]]);}}break;default:break;}}catch(_0x1db854){utils[_0x42c6('0x14')](util[_0x42c6('0x19')](_0x42c6('0x1a'),members[_0xa47b34[_0x42c6('0x1b')]]?members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x6')]:_0xa47b34['device']),_0x1db854);}};exports[_0x42c6('0x27')]=function(_0x22661e){try{if(!_[_0x42c6('0x28')](members[_0x22661e['interface']])){utils[_0x42c6('0x18')](util[_0x42c6('0x19')](_0x42c6('0x29'),_0x22661e['uniqueid']),_0x22661e);utils[_0x42c6('0x4')](util[_0x42c6('0x19')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x22661e[_0x42c6('0x6')],_0x22661e[_0x42c6('0xa')],_0x22661e[_0x42c6('0x2a')]));members[_0x22661e[_0x42c6('0xa')]]=_[_0x42c6('0x2b')](members[_0x22661e['interface']],{'data4':_0x22661e[_0x42c6('0x2a')],'uniqueid':_0x22661e['uniqueid']});}}catch(_0xb78a18){utils[_0x42c6('0x14')](util[_0x42c6('0x19')]('[%s][members][agentcomplete]',_0x22661e[_0x42c6('0x6')]),_0xb78a18);}};exports[_0x42c6('0x2c')]=function(_0x475f2e){try{utils[_0x42c6('0x18')](util[_0x42c6('0x19')](_0x42c6('0x2d'),_0x475f2e[_0x42c6('0x6')]),_0x475f2e);if(_0x475f2e['channel']){var _0x2e24ca=_0x475f2e['channel'][_0x42c6('0x11')]('-')[0x0];if(!_[_0x42c6('0x28')](members[_0x2e24ca])){members[_0x2e24ca]=_[_0x42c6('0x2b')](members[_0x2e24ca],{'data1':members[_0x2e24ca][_0x42c6('0x2e')]||_0x475f2e[_0x42c6('0x2f')],'data2':members[_0x2e24ca]['data2']||_0x475f2e[_0x42c6('0x30')],'data3':members[_0x2e24ca][_0x42c6('0x31')]||_0x475f2e[_0x42c6('0x32')],'uniqueid':members[_0x2e24ca]['uniqueid']||_0x475f2e[_0x42c6('0x6')]});utils[_0x42c6('0x4')](util[_0x42c6('0x19')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x475f2e[_0x42c6('0x6')],members[_0x2e24ca]['data1'],members[_0x2e24ca][_0x42c6('0x8')],members[_0x2e24ca][_0x42c6('0x31')]));if(members[_0x2e24ca]['exitAt']){writeDB(members[_0x2e24ca]);}}}if(_0x475f2e[_0x42c6('0x33')]){var _0x568c37=_0x475f2e[_0x42c6('0x33')][_0x42c6('0x11')]('-')[0x0];if(!_[_0x42c6('0x28')](members[_0x568c37])){members[_0x568c37]=_[_0x42c6('0x2b')](members[_0x568c37],{'data1':members[_0x568c37][_0x42c6('0x2e')]||_0x475f2e[_0x42c6('0x2f')],'data2':members[_0x568c37][_0x42c6('0x8')]||_0x475f2e[_0x42c6('0x30')],'data3':members[_0x568c37][_0x42c6('0x31')]||_0x475f2e['destination'],'uniqueid':members[_0x568c37][_0x42c6('0x6')]||_0x475f2e[_0x42c6('0x6')]});utils[_0x42c6('0x4')](util[_0x42c6('0x19')](_0x42c6('0x34'),_0x475f2e[_0x42c6('0x6')],members[_0x568c37][_0x42c6('0x2e')],members[_0x568c37][_0x42c6('0x8')],members[_0x568c37]['data3']));if(members[_0x568c37][_0x42c6('0x22')]){writeDB(members[_0x568c37]);}}}}catch(_0x3d03fd){utils[_0x42c6('0x14')](util[_0x42c6('0x19')](_0x42c6('0x2d'),_0x475f2e[_0x42c6('0x6')]),_0x3d03fd);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ada24c3..1a0e5dd 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 _0xc45f=['clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerexitAt','now','queueposition','queuecallerabandonAt','queuecallerexit','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid'];(function(_0x581ec3,_0x63f22c){var _0x26b77d=function(_0x2d553b){while(--_0x2d553b){_0x581ec3['push'](_0x581ec3['shift']());}};_0x26b77d(++_0x63f22c);}(_0xc45f,0x74));var _0xfc45=function(_0x407ed2,_0x30e223){_0x407ed2=_0x407ed2-0x0;var _0x4336dd=_0xc45f[_0x407ed2];return _0x4336dd;};'use strict';var _=require('lodash');var util=require(_0xfc45('0x0'));var utils=require(_0xfc45('0x1'));var queues={};function writeDB(_0x5d84a6){utils[_0xfc45('0x2')](util[_0xfc45('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x5d84a6['uniqueid'],_0x5d84a6[_0xfc45('0x4')],_0x5d84a6[_0xfc45('0x5')],_0x5d84a6['lastAssignedTo'],_0x5d84a6[_0xfc45('0x6')],_0x5d84a6[_0xfc45('0x7')],_0x5d84a6[_0xfc45('0x8')]));if(_0x5d84a6[_0xfc45('0x5')]){utils[_0xfc45('0x9')](_0x5d84a6[_0xfc45('0x5')])['then'](function(_0x1778ef){if(_0x1778ef){_0x5d84a6[_0xfc45('0xa')]=_0x1778ef[_0xfc45('0xa')];}utils[_0xfc45('0xb')](_0xfc45('0xc'),_0x5d84a6);});}else{utils[_0xfc45('0xb')](_0xfc45('0xc'),_0x5d84a6);}if(_0x5d84a6[_0xfc45('0xd')]){delete queues[_0x5d84a6[_0xfc45('0xd')]];}else{delete queues[_0x5d84a6[_0xfc45('0xe')]];}}exports[_0xfc45('0xf')]=function(_0x40e207){try{utils[_0xfc45('0x10')](util[_0xfc45('0x3')](_0xfc45('0x11'),_0x40e207[_0xfc45('0xe')]),_0x40e207);utils['info'](util[_0xfc45('0x3')](_0xfc45('0x12'),_0x40e207[_0xfc45('0xe')],_0x40e207[_0xfc45('0x5')],_0x40e207['position']));queues[_0x40e207['uniqueid']]=_[_0xfc45('0x13')](_0x40e207,{'originalposition':_0x40e207[_0xfc45('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x12ea35){utils[_0xfc45('0x15')](util[_0xfc45('0x3')](_0xfc45('0x11'),_0x40e207[_0xfc45('0xe')]),_0x12ea35);}};exports[_0xfc45('0x16')]=function(_0xd0f786){try{if(!_[_0xfc45('0x17')](queues[_0xd0f786[_0xfc45('0xe')]])){utils['debug'](util[_0xfc45('0x3')](_0xfc45('0x18'),_0xd0f786['uniqueid']),_0xd0f786);if(queues[_0xd0f786[_0xfc45('0xe')]][_0xfc45('0x19')]){if(!queues[_0xd0f786[_0xfc45('0xe')]][_0xfc45('0x1a')]&&!queues[_0xd0f786['uniqueid']]['queuecallerexit']){queues[_0xd0f786[_0xfc45('0xe')]][_0xfc45('0x1b')]=!![];queues[_0xd0f786['uniqueid']][_0xfc45('0x1c')]=utils['now']();queues[_0xd0f786['uniqueid']][_0xfc45('0x8')]=_0xfc45('0x1d');}utils[_0xfc45('0x2')](util[_0xfc45('0x3')](_0xfc45('0x1e'),_0xd0f786[_0xfc45('0xe')],queues[_0xd0f786[_0xfc45('0xe')]][_0xfc45('0x1f')],queues[_0xd0f786[_0xfc45('0xe')]][_0xfc45('0x8')]));writeDB(queues[_0xd0f786['uniqueid']]);}else if(queues[_0xd0f786[_0xfc45('0xe')]]['transfereduniqueid']){utils[_0xfc45('0x2')](util[_0xfc45('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0xd0f786[_0xfc45('0xe')],queues[_0xd0f786[_0xfc45('0xe')]][_0xfc45('0x1f')],queues[_0xd0f786[_0xfc45('0xe')]][_0xfc45('0xd')]));queues[queues[_0xd0f786[_0xfc45('0xe')]][_0xfc45('0xd')]]=queues[_0xd0f786[_0xfc45('0xe')]];queues[queues[_0xd0f786[_0xfc45('0xe')]][_0xfc45('0xd')]][_0xfc45('0x20')]=0x2;delete queues[_0xd0f786['uniqueid']];}}}catch(_0x4e1119){utils['error'](util[_0xfc45('0x3')](_0xfc45('0x18'),_0xd0f786[_0xfc45('0xe')]),_0x4e1119);}};exports[_0xfc45('0x21')]=function(_0x387c39){try{utils['debug'](util['format'](_0xfc45('0x22'),_0x387c39[_0xfc45('0xe')]),_0x387c39);if(!_[_0xfc45('0x17')](_0x387c39[_0xfc45('0x23')]['queuestatus'])&&_0x387c39[_0xfc45('0x24')][_0xfc45('0x25')]()!==_0xfc45('0x26')){if(!_['isNil'](queues[_0x387c39[_0xfc45('0xe')]])){queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x1a')]=![];queues[_0x387c39[_0xfc45('0xe')]]['queuecallerabandonAt']=null;queues[_0x387c39['uniqueid']]['queuecallerexit']=!![];queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x27')]=utils[_0xfc45('0x28')]();queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x8')]=_0x387c39[_0xfc45('0x24')][_0xfc45('0x25')]();utils['info'](util[_0xfc45('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x387c39[_0xfc45('0xe')],queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x1f')],_0x387c39[_0xfc45('0x24')],queues[_0x387c39['uniqueid']][_0xfc45('0x8')]));writeDB(queues[_0x387c39['uniqueid']]);}}else if(!_[_0xfc45('0x17')](_0x387c39['variable'][_0xfc45('0x29')])){if(!_[_0xfc45('0x17')](queues[_0x387c39['uniqueid']])&&!queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x1a')]){queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x1a')]=![];queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x2a')]=null;queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x2b')]=!![];queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x27')]=utils[_0xfc45('0x28')]();queues[_0x387c39[_0xfc45('0xe')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0xfc45('0x2')](util[_0xfc45('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x387c39[_0xfc45('0xe')],queues[_0x387c39[_0xfc45('0xe')]][_0xfc45('0x1f')],_0x387c39['value'],queues[_0x387c39['uniqueid']]['queuecallerexitreason']));}}}catch(_0x5e4f9f){utils['error'](util['format']('[%s][queues][varset]',_0x387c39[_0xfc45('0xe')]),_0x5e4f9f);}};exports[_0xfc45('0x1a')]=function(_0x70dcd4){try{if(!_[_0xfc45('0x17')](queues[_0x70dcd4[_0xfc45('0xe')]])){utils[_0xfc45('0x10')](util[_0xfc45('0x3')](_0xfc45('0x2c'),_0x70dcd4[_0xfc45('0xe')]),_0x70dcd4);queues[_0x70dcd4[_0xfc45('0xe')]]['queuecallerexit']=![];queues[_0x70dcd4[_0xfc45('0xe')]][_0xfc45('0x27')]=null;queues[_0x70dcd4[_0xfc45('0xe')]][_0xfc45('0x1a')]=!![];queues[_0x70dcd4[_0xfc45('0xe')]][_0xfc45('0x2a')]=utils[_0xfc45('0x28')]();queues[_0x70dcd4[_0xfc45('0xe')]][_0xfc45('0x8')]=_0xfc45('0x2d');utils[_0xfc45('0x2')](util[_0xfc45('0x3')](_0xfc45('0x2e'),_0x70dcd4[_0xfc45('0xe')],queues[_0x70dcd4[_0xfc45('0xe')]][_0xfc45('0x1f')],queues[_0x70dcd4[_0xfc45('0xe')]][_0xfc45('0x8')]));}}catch(_0x39de78){utils['error'](util[_0xfc45('0x3')](_0xfc45('0x2c'),_0x70dcd4[_0xfc45('0xe')]),_0x39de78);}};exports[_0xfc45('0x2f')]=function(_0x1b84f1){try{if(!_['isNil'](queues[_0x1b84f1[_0xfc45('0xe')]])){utils['debug'](util[_0xfc45('0x3')](_0xfc45('0x30'),_0x1b84f1['uniqueid']),_0x1b84f1);utils[_0xfc45('0x2')](util[_0xfc45('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x1b84f1[_0xfc45('0xe')],queues[_0x1b84f1[_0xfc45('0xe')]][_0xfc45('0x1f')],_0x1b84f1[_0xfc45('0x31')],_0x1b84f1['connectedlinename']));queues[_0x1b84f1['uniqueid']][_0xfc45('0x2f')]=!![];queues[_0x1b84f1['uniqueid']]['queuecallerleaveAt']=utils[_0xfc45('0x28')]();queues[_0x1b84f1[_0xfc45('0xe')]][_0xfc45('0x32')]=utils[_0xfc45('0x33')](queues[_0x1b84f1[_0xfc45('0xe')]][_0xfc45('0x19')],queues[_0x1b84f1[_0xfc45('0xe')]][_0xfc45('0x34')]);queues[_0x1b84f1['uniqueid']]['position']=_0x1b84f1[_0xfc45('0x14')];queues[_0x1b84f1[_0xfc45('0xe')]]['count']=_0x1b84f1[_0xfc45('0x35')];queues[_0x1b84f1[_0xfc45('0xe')]]['connectedlinenum']=_0x1b84f1[_0xfc45('0x31')];queues[_0x1b84f1['uniqueid']][_0xfc45('0x36')]=_0x1b84f1['connectedlinename'];}}catch(_0x1e49e2){utils[_0xfc45('0x15')](util[_0xfc45('0x3')](_0xfc45('0x30'),_0x1b84f1[_0xfc45('0xe')]),_0x1e49e2);}};exports[_0xfc45('0x37')]=function(_0xc2f0a5){try{if(!_[_0xfc45('0x17')](queues[_0xc2f0a5['uniqueid']])){utils[_0xfc45('0x10')](util[_0xfc45('0x3')](_0xfc45('0x38'),_0xc2f0a5[_0xfc45('0xe')]),_0xc2f0a5);utils[_0xfc45('0x2')](util[_0xfc45('0x3')](_0xfc45('0x39'),_0xc2f0a5[_0xfc45('0xe')],queues[_0xc2f0a5['uniqueid']][_0xfc45('0x1f')],_0xc2f0a5[_0xfc45('0x3a')],_0xc2f0a5['destaccountcode']));queues[_0xc2f0a5['uniqueid']][_0xfc45('0x1a')]=![];queues[_0xc2f0a5[_0xfc45('0xe')]][_0xfc45('0x1a')]=![];queues[_0xc2f0a5[_0xfc45('0xe')]][_0xfc45('0x2a')]=null;queues[_0xc2f0a5[_0xfc45('0xe')]]['queuecallerexit']=![];queues[_0xc2f0a5[_0xfc45('0xe')]][_0xfc45('0x8')]=null;queues[_0xc2f0a5[_0xfc45('0xe')]][_0xfc45('0x27')]=null;queues[_0xc2f0a5[_0xfc45('0xe')]]['assigned']=!![];queues[_0xc2f0a5[_0xfc45('0xe')]]['accountcode']=_0xc2f0a5['destaccountcode'];queues[_0xc2f0a5[_0xfc45('0xe')]][_0xfc45('0x3b')]=_0xc2f0a5[_0xfc45('0x3a')];}}catch(_0x1a8606){utils['error'](util[_0xfc45('0x3')](_0xfc45('0x38'),_0xc2f0a5['uniqueid']),_0x1a8606);}};exports[_0xfc45('0x3c')]=function(_0x5b31b2){try{if(!_[_0xfc45('0x17')](queues[_0x5b31b2['uniqueid']])){if(queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x19')]){utils['debug'](util[_0xfc45('0x3')](_0xfc45('0x3d'),_0x5b31b2[_0xfc45('0xe')]),_0x5b31b2);queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x1a')]=![];queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x1a')]=![];queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x2a')]=null;queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x2b')]=![];queues[_0x5b31b2[_0xfc45('0xe')]]['queuecallerexitAt']=null;queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x3e')]=!![];queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x3b')]=_0x5b31b2[_0xfc45('0x3a')];queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x1b')]=!![];queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x1c')]=utils[_0xfc45('0x28')]();if(_0x5b31b2['reason']==_0xfc45('0x3f')){if(!queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x3f')]){queues[_0x5b31b2['uniqueid']][_0xfc45('0x8')]=_0xfc45('0x40');}}else{queues[_0x5b31b2['uniqueid']]['queuecallerexitreason']=_0xfc45('0x41')+_0x5b31b2[_0xfc45('0x42')][_0xfc45('0x25')]();}utils['info'](util[_0xfc45('0x3')](_0xfc45('0x43'),_0x5b31b2[_0xfc45('0xe')],queues[_0x5b31b2[_0xfc45('0xe')]][_0xfc45('0x1f')],_0x5b31b2[_0xfc45('0x3a')],queues[_0x5b31b2['uniqueid']][_0xfc45('0x8')]));writeDB(queues[_0x5b31b2[_0xfc45('0xe')]]);}}}catch(_0x4266a3){utils[_0xfc45('0x15')](util[_0xfc45('0x3')](_0xfc45('0x3d'),_0x5b31b2[_0xfc45('0xe')]),_0x4266a3);}};exports['blindtransfer']=function(_0x46e242){try{if(!_[_0xfc45('0x17')](queues[_0x46e242['transfereeuniqueid']])){utils[_0xfc45('0x10')](util[_0xfc45('0x3')]('[%s][queues][blindtransfer]',_0x46e242[_0xfc45('0xe')]),_0x46e242);queues[_0x46e242[_0xfc45('0x44')]][_0xfc45('0x3f')]=!![];queues[_0x46e242['transfereeuniqueid']][_0xfc45('0x45')]=_0xfc45('0x46');queues[_0x46e242[_0xfc45('0x44')]][_0xfc45('0x47')]=_0x46e242[_0xfc45('0x48')];queues[_0x46e242[_0xfc45('0x44')]][_0xfc45('0x49')]=_0x46e242[_0xfc45('0x44')];queues[_0x46e242['transfereeuniqueid']][_0xfc45('0x8')]='BLINDTRANSFER';utils[_0xfc45('0x2')](util[_0xfc45('0x3')](_0xfc45('0x4a'),_0x46e242[_0xfc45('0xe')],queues[_0x46e242['transfereeuniqueid']]['name'],_0x46e242[_0xfc45('0x44')],_0x46e242['extension']));}}catch(_0x14613a){utils[_0xfc45('0x15')](util[_0xfc45('0x3')]('[%s][queues][blindtransfer]',_0x46e242[_0xfc45('0xe')]),_0x14613a);}};exports[_0xfc45('0x4b')]=function(_0x7f35dc){try{utils['debug'](util[_0xfc45('0x3')](_0xfc45('0x4c'),_0x7f35dc[_0xfc45('0x4d')]),_0x7f35dc);if(_0x7f35dc[_0xfc45('0x4d')]==_0x7f35dc[_0xfc45('0x4e')]){if(!_['isNil'](queues[_0x7f35dc['secondtransfererlinkedid']])){utils[_0xfc45('0x2')](util[_0xfc45('0x3')](_0xfc45('0x4f'),_0x7f35dc[_0xfc45('0x4d')],queues[_0x7f35dc[_0xfc45('0x50')]][_0xfc45('0x1f')],_0x7f35dc['origtransfererexten']));queues[_0x7f35dc['secondtransfererlinkedid']][_0xfc45('0x3f')]=!![];queues[_0x7f35dc[_0xfc45('0x50')]]['transfertype']='ATTENDED';queues[_0x7f35dc[_0xfc45('0x50')]][_0xfc45('0x47')]=_0x7f35dc[_0xfc45('0x51')];queues[_0x7f35dc[_0xfc45('0x50')]][_0xfc45('0x49')]=_0x7f35dc[_0xfc45('0x4d')];queues[_0x7f35dc['secondtransfererlinkedid']]['queuecallerexitreason']=_0xfc45('0x52');}if(!_['isNil'](queues[_0x7f35dc[_0xfc45('0x4e')]])){if(_0x7f35dc['transfereelinkedid']&&queues[_0x7f35dc[_0xfc45('0x53')]]){queues[_0x7f35dc[_0xfc45('0x53')]][_0xfc45('0x20')]=0x1;queues[_0x7f35dc[_0xfc45('0x44')]]=_[_0xfc45('0x54')](queues[_0x7f35dc[_0xfc45('0x53')]]);queues[_0x7f35dc[_0xfc45('0x44')]][_0xfc45('0xd')]=_0x7f35dc[_0xfc45('0x55')];queues[_0x7f35dc[_0xfc45('0x44')]][_0xfc45('0x20')]=0x2;queues[_0x7f35dc[_0xfc45('0x44')]][_0xfc45('0x6')]=queues[_0x7f35dc[_0xfc45('0x50')]][_0xfc45('0x6')];queues[_0x7f35dc['transfereeuniqueid']][_0xfc45('0x56')]=queues[_0x7f35dc[_0xfc45('0x50')]][_0xfc45('0x56')];queues[_0x7f35dc[_0xfc45('0x44')]][_0xfc45('0x34')]=utils[_0xfc45('0x28')]();queues[_0x7f35dc['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0xfc45('0x28')]();queues[_0x7f35dc[_0xfc45('0x44')]][_0xfc45('0x32')]=0x0;queues[_0x7f35dc[_0xfc45('0x44')]][_0xfc45('0x57')]=0x0;utils[_0xfc45('0x2')](util[_0xfc45('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x7f35dc[_0xfc45('0x4d')],queues[_0x7f35dc[_0xfc45('0x44')]]['name'],queues[_0x7f35dc[_0xfc45('0x44')]][_0xfc45('0x6')],queues[_0x7f35dc[_0xfc45('0x44')]]['calleridname']));}else{utils['info'](util[_0xfc45('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x7f35dc[_0xfc45('0x4d')],queues[_0x7f35dc[_0xfc45('0x4e')]]['name'],_0x7f35dc[_0xfc45('0x50')]));queues[_0x7f35dc[_0xfc45('0x4e')]]['transfereduniqueid']=_0x7f35dc[_0xfc45('0x50')];}}}else if(_0x7f35dc['secondtransfereruniqueid']==_0x7f35dc['secondtransfererlinkedid']){if(!_[_0xfc45('0x17')](queues[_0x7f35dc[_0xfc45('0x4e')]])){utils[_0xfc45('0x2')](util[_0xfc45('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x7f35dc[_0xfc45('0x4d')],queues[_0x7f35dc['origtransfererlinkedid']][_0xfc45('0x1f')],_0x7f35dc[_0xfc45('0x58')],_0x7f35dc[_0xfc45('0x59')]));queues[_0x7f35dc['origtransfererlinkedid']][_0xfc45('0x3f')]=!![];queues[_0x7f35dc['origtransfererlinkedid']][_0xfc45('0x45')]=_0xfc45('0x5a');queues[_0x7f35dc[_0xfc45('0x4e')]][_0xfc45('0x47')]=_0x7f35dc[_0xfc45('0x59')];queues[_0x7f35dc[_0xfc45('0x4e')]][_0xfc45('0x49')]=_0x7f35dc[_0xfc45('0x58')];queues[_0x7f35dc[_0xfc45('0x4e')]]['queuecallerexitreason']=_0xfc45('0x52');}if(!_[_0xfc45('0x17')](queues[_0x7f35dc[_0xfc45('0x50')]])){if(_0x7f35dc['transfertargetlinkedid']&&queues[_0x7f35dc[_0xfc45('0x5b')]]){queues[_0x7f35dc[_0xfc45('0x5b')]][_0xfc45('0x20')]=0x1;queues[_0x7f35dc[_0xfc45('0x55')]]=_[_0xfc45('0x54')](queues[_0x7f35dc[_0xfc45('0x5b')]]);queues[_0x7f35dc[_0xfc45('0x55')]]['transfereduniqueid']=_0x7f35dc[_0xfc45('0x55')];queues[_0x7f35dc['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x7f35dc['transfertargetuniqueid']]['calleridnum']=queues[_0x7f35dc[_0xfc45('0x4e')]]['calleridnum'];queues[_0x7f35dc[_0xfc45('0x55')]]['calleridname']=queues[_0x7f35dc[_0xfc45('0x4e')]]['calleridname'];queues[_0x7f35dc[_0xfc45('0x55')]]['queuecallerjoinAt']=utils[_0xfc45('0x28')]();queues[_0x7f35dc['transfertargetuniqueid']][_0xfc45('0x19')]=utils[_0xfc45('0x28')]();queues[_0x7f35dc[_0xfc45('0x55')]]['holdtime']=0x0;queues[_0x7f35dc[_0xfc45('0x55')]][_0xfc45('0x57')]=0x0;utils[_0xfc45('0x2')](util[_0xfc45('0x3')](_0xfc45('0x5c'),_0x7f35dc[_0xfc45('0x4d')],queues[_0x7f35dc[_0xfc45('0x55')]]['name'],queues[_0x7f35dc['transfertargetuniqueid']][_0xfc45('0xd')],queues[_0x7f35dc['transfertargetuniqueid']]['calleridnum'],queues[_0x7f35dc[_0xfc45('0x55')]][_0xfc45('0x56')]));}else{utils[_0xfc45('0x2')](util[_0xfc45('0x3')](_0xfc45('0x5d'),_0x7f35dc[_0xfc45('0x4d')],queues[_0x7f35dc[_0xfc45('0x50')]]['name'],_0x7f35dc['origtransfererlinkedid']));queues[_0x7f35dc[_0xfc45('0x50')]][_0xfc45('0xd')]=_0x7f35dc[_0xfc45('0x4e')];}}}}catch(_0x49fe09){utils['error'](util['format'](_0xfc45('0x4c'),_0x7f35dc['origtransfereruniqueid']),_0x49fe09);}};exports[_0xfc45('0x5e')]=function(_0x4d532d){try{if(!_['isNil'](queues[_0x4d532d[_0xfc45('0xe')]])){utils['debug'](util[_0xfc45('0x3')](_0xfc45('0x5f'),_0x4d532d[_0xfc45('0xe')]),_0x4d532d);queues[_0x4d532d[_0xfc45('0xe')]][_0xfc45('0x60')]=utils[_0xfc45('0x28')]();utils[_0xfc45('0x2')](util['format'](_0xfc45('0x61'),_0x4d532d[_0xfc45('0xe')],queues[_0x4d532d[_0xfc45('0xe')]][_0xfc45('0x1f')],queues[_0x4d532d[_0xfc45('0xe')]]['musiconholdstartAt']));}}catch(_0xbbd5ab){utils[_0xfc45('0x15')](util['format']('[%s][queues][musiconholdstart]',_0x4d532d[_0xfc45('0xe')]),_0xbbd5ab);}};exports['musiconholdstop']=function(_0x2adddf){try{if(!_['isNil'](queues[_0x2adddf['uniqueid']])){if(!_['isNil'](queues[_0x2adddf['uniqueid']]['musiconholdstartAt'])){utils[_0xfc45('0x10')](util[_0xfc45('0x3')](_0xfc45('0x62'),_0x2adddf[_0xfc45('0xe')]),_0x2adddf);queues[_0x2adddf[_0xfc45('0xe')]][_0xfc45('0x57')]+=utils[_0xfc45('0x33')](utils[_0xfc45('0x28')](),queues[_0x2adddf['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0xfc45('0x3')](_0xfc45('0x63'),_0x2adddf[_0xfc45('0xe')],queues[_0x2adddf[_0xfc45('0xe')]][_0xfc45('0x1f')],queues[_0x2adddf[_0xfc45('0xe')]][_0xfc45('0x57')]));delete queues[_0x2adddf[_0xfc45('0xe')]][_0xfc45('0x60')];}}}catch(_0x2784d3){utils[_0xfc45('0x15')](util[_0xfc45('0x3')](_0xfc45('0x62'),_0x2adddf[_0xfc45('0xe')]),_0x2784d3);}}; \ No newline at end of file +var _0x472b=['origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','error','variable','queuestatus','value','queuecallerabandon','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]'];(function(_0x37bc34,_0x238252){var _0x4e3dc2=function(_0x4fc334){while(--_0x4fc334){_0x37bc34['push'](_0x37bc34['shift']());}};_0x4e3dc2(++_0x238252);}(_0x472b,0x83));var _0xb472=function(_0x323244,_0x122157){_0x323244=_0x323244-0x0;var _0x7dcf5b=_0x472b[_0x323244];return _0x7dcf5b;};'use strict';var _=require('lodash');var util=require(_0xb472('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x499359){utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x3'),_0x499359[_0xb472('0x4')],_0x499359[_0xb472('0x5')],_0x499359['queue'],_0x499359[_0xb472('0x6')],_0x499359[_0xb472('0x7')],_0x499359[_0xb472('0x8')],_0x499359[_0xb472('0x9')]));if(_0x499359[_0xb472('0xa')]){utils[_0xb472('0xb')](_0x499359['queue'])[_0xb472('0xc')](function(_0x3d0fd0){if(_0x3d0fd0){_0x499359[_0xb472('0xd')]=_0x3d0fd0[_0xb472('0xd')];}utils['request']('CreateVoiceQueueReport',_0x499359);});}else{utils[_0xb472('0xe')](_0xb472('0xf'),_0x499359);}if(_0x499359[_0xb472('0x10')]){delete queues[_0x499359['transfereduniqueid']];}else{delete queues[_0x499359[_0xb472('0x4')]];}}exports[_0xb472('0x11')]=function(_0x594b74){try{utils['debug'](util['format'](_0xb472('0x12'),_0x594b74[_0xb472('0x4')]),_0x594b74);utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x13'),_0x594b74[_0xb472('0x4')],_0x594b74[_0xb472('0xa')],_0x594b74[_0xb472('0x14')]));queues[_0x594b74['uniqueid']]=_['assign'](_0x594b74,{'originalposition':_0x594b74['position'],'queuecallerjoinAt':utils[_0xb472('0x15')](),'mohtime':0x0});}catch(_0x5adf3b){utils['error'](util[_0xb472('0x2')](_0xb472('0x12'),_0x594b74[_0xb472('0x4')]),_0x5adf3b);}};exports[_0xb472('0x16')]=function(_0x53016a){try{if(!_[_0xb472('0x17')](queues[_0x53016a[_0xb472('0x4')]])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x19'),_0x53016a[_0xb472('0x4')]),_0x53016a);if(queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x1a')]){if(!queues[_0x53016a[_0xb472('0x4')]]['queuecallerabandon']&&!queues[_0x53016a['uniqueid']]['queuecallerexit']){queues[_0x53016a['uniqueid']][_0xb472('0x1b')]=!![];queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x1c')]=utils[_0xb472('0x15')]();queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x9')]='COMPLETEDBYAGENT';}utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x1d'),_0x53016a[_0xb472('0x4')],queues[_0x53016a['uniqueid']][_0xb472('0x1e')],queues[_0x53016a['uniqueid']][_0xb472('0x9')]));writeDB(queues[_0x53016a['uniqueid']]);}else if(queues[_0x53016a['uniqueid']][_0xb472('0x10')]){utils[_0xb472('0x1')](util[_0xb472('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x53016a[_0xb472('0x4')],queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x1e')],queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x10')]));queues[queues[_0x53016a['uniqueid']][_0xb472('0x10')]]=queues[_0x53016a['uniqueid']];queues[queues[_0x53016a[_0xb472('0x4')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x53016a[_0xb472('0x4')]];}}}catch(_0x715224){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x19'),_0x53016a['uniqueid']),_0x715224);}};exports['varset']=function(_0x1efbf0){try{utils[_0xb472('0x18')](util[_0xb472('0x2')]('[%s][queues][varset]',_0x1efbf0['uniqueid']),_0x1efbf0);if(!_[_0xb472('0x17')](_0x1efbf0[_0xb472('0x20')][_0xb472('0x21')])&&_0x1efbf0[_0xb472('0x22')]['toUpperCase']()!=='CONTINUE'){if(!_['isNil'](queues[_0x1efbf0[_0xb472('0x4')]])){queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x23')]=![];queues[_0x1efbf0[_0xb472('0x4')]]['queuecallerabandonAt']=null;queues[_0x1efbf0[_0xb472('0x4')]]['queuecallerexit']=!![];queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x24')]=utils[_0xb472('0x15')]();queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x9')]=_0x1efbf0[_0xb472('0x22')][_0xb472('0x25')]();utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x26'),_0x1efbf0[_0xb472('0x4')],queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x1e')],_0x1efbf0[_0xb472('0x22')],queues[_0x1efbf0[_0xb472('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x1efbf0[_0xb472('0x4')]]);}}else if(!_[_0xb472('0x17')](_0x1efbf0[_0xb472('0x20')][_0xb472('0x27')])){if(!_[_0xb472('0x17')](queues[_0x1efbf0[_0xb472('0x4')]])&&!queues[_0x1efbf0['uniqueid']]['queuecallerabandon']){queues[_0x1efbf0[_0xb472('0x4')]]['queuecallerabandon']=![];queues[_0x1efbf0['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x28')]=!![];queues[_0x1efbf0['uniqueid']]['queuecallerexitAt']=utils[_0xb472('0x15')]();queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x9')]='EXITWITHKEY';utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x29'),_0x1efbf0['uniqueid'],queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x1e')],_0x1efbf0[_0xb472('0x22')],queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x9')]));}}}catch(_0x3cb85d){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x2a'),_0x1efbf0[_0xb472('0x4')]),_0x3cb85d);}};exports[_0xb472('0x23')]=function(_0x3c2935){try{if(!_[_0xb472('0x17')](queues[_0x3c2935[_0xb472('0x4')]])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x2b'),_0x3c2935['uniqueid']),_0x3c2935);queues[_0x3c2935[_0xb472('0x4')]][_0xb472('0x28')]=![];queues[_0x3c2935['uniqueid']][_0xb472('0x24')]=null;queues[_0x3c2935[_0xb472('0x4')]][_0xb472('0x23')]=!![];queues[_0x3c2935[_0xb472('0x4')]][_0xb472('0x2c')]=utils['now']();queues[_0x3c2935[_0xb472('0x4')]][_0xb472('0x9')]=_0xb472('0x2d');utils[_0xb472('0x1')](util['format'](_0xb472('0x2e'),_0x3c2935[_0xb472('0x4')],queues[_0x3c2935['uniqueid']][_0xb472('0x1e')],queues[_0x3c2935['uniqueid']][_0xb472('0x9')]));}}catch(_0x5192f1){utils['error'](util[_0xb472('0x2')](_0xb472('0x2b'),_0x3c2935[_0xb472('0x4')]),_0x5192f1);}};exports[_0xb472('0x2f')]=function(_0x2f393d){try{if(!_[_0xb472('0x17')](queues[_0x2f393d[_0xb472('0x4')]])){utils[_0xb472('0x18')](util[_0xb472('0x2')]('[%s][queues][queuecallerleave]',_0x2f393d[_0xb472('0x4')]),_0x2f393d);utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x30'),_0x2f393d[_0xb472('0x4')],queues[_0x2f393d['uniqueid']]['name'],_0x2f393d['connectedlinenum'],_0x2f393d[_0xb472('0x31')]));queues[_0x2f393d[_0xb472('0x4')]]['queuecallerleave']=!![];queues[_0x2f393d['uniqueid']]['queuecallerleaveAt']=utils[_0xb472('0x15')]();queues[_0x2f393d['uniqueid']][_0xb472('0x32')]=utils['diffTime'](queues[_0x2f393d[_0xb472('0x4')]][_0xb472('0x1a')],queues[_0x2f393d[_0xb472('0x4')]][_0xb472('0x33')]);queues[_0x2f393d['uniqueid']][_0xb472('0x14')]=_0x2f393d[_0xb472('0x14')];queues[_0x2f393d[_0xb472('0x4')]][_0xb472('0x34')]=_0x2f393d[_0xb472('0x34')];queues[_0x2f393d[_0xb472('0x4')]]['connectedlinenum']=_0x2f393d[_0xb472('0x35')];queues[_0x2f393d[_0xb472('0x4')]][_0xb472('0x31')]=_0x2f393d[_0xb472('0x31')];}}catch(_0x10add8){utils['error'](util[_0xb472('0x2')](_0xb472('0x36'),_0x2f393d[_0xb472('0x4')]),_0x10add8);}};exports['agentconnect']=function(_0x2c0107){try{if(!_['isNil'](queues[_0x2c0107[_0xb472('0x4')]])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x37'),_0x2c0107['uniqueid']),_0x2c0107);utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x38'),_0x2c0107[_0xb472('0x4')],queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x1e')],_0x2c0107[_0xb472('0x39')],_0x2c0107['destaccountcode']));queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x23')]=![];queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x23')]=![];queues[_0x2c0107['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2c0107[_0xb472('0x4')]]['queuecallerexit']=![];queues[_0x2c0107[_0xb472('0x4')]]['queuecallerexitreason']=null;queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x24')]=null;queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x3a')]=!![];queues[_0x2c0107['uniqueid']][_0xb472('0x8')]=_0x2c0107[_0xb472('0x3b')];queues[_0x2c0107[_0xb472('0x4')]]['lastAssignedTo']=_0x2c0107['membername'];}}catch(_0x3dd877){utils[_0xb472('0x1f')](util[_0xb472('0x2')]('[%s][queues][agentconnect]',_0x2c0107[_0xb472('0x4')]),_0x3dd877);}};exports[_0xb472('0x3c')]=function(_0x5778c7){try{if(!_[_0xb472('0x17')](queues[_0x5778c7[_0xb472('0x4')]])){if(queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x1a')]){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x3d'),_0x5778c7['uniqueid']),_0x5778c7);queues[_0x5778c7[_0xb472('0x4')]]['queuecallerabandon']=![];queues[_0x5778c7['uniqueid']][_0xb472('0x23')]=![];queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x2c')]=null;queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x28')]=![];queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x24')]=null;queues[_0x5778c7[_0xb472('0x4')]]['assigned']=!![];queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x6')]=_0x5778c7[_0xb472('0x39')];queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x1b')]=!![];queues[_0x5778c7[_0xb472('0x4')]]['queuecallercompleteAt']=utils[_0xb472('0x15')]();if(_0x5778c7['reason']==_0xb472('0x3e')){if(!queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x3e')]){queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x9')]=_0xb472('0x3f');}}else{queues[_0x5778c7[_0xb472('0x4')]]['queuecallerexitreason']=_0xb472('0x40')+_0x5778c7[_0xb472('0x41')][_0xb472('0x25')]();}utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x42'),_0x5778c7[_0xb472('0x4')],queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x1e')],_0x5778c7[_0xb472('0x39')],queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x9')]));writeDB(queues[_0x5778c7['uniqueid']]);}}}catch(_0x557a34){utils['error'](util[_0xb472('0x2')](_0xb472('0x3d'),_0x5778c7[_0xb472('0x4')]),_0x557a34);}};exports[_0xb472('0x43')]=function(_0x360783){try{if(!_['isNil'](queues[_0x360783['transfereeuniqueid']])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x44'),_0x360783[_0xb472('0x4')]),_0x360783);queues[_0x360783['transfereeuniqueid']][_0xb472('0x3e')]=!![];queues[_0x360783[_0xb472('0x45')]][_0xb472('0x46')]=_0xb472('0x47');queues[_0x360783[_0xb472('0x45')]]['transferexten']=_0x360783[_0xb472('0x48')];queues[_0x360783[_0xb472('0x45')]][_0xb472('0x49')]=_0x360783['transfereeuniqueid'];queues[_0x360783[_0xb472('0x45')]]['queuecallerexitreason']='BLINDTRANSFER';utils['info'](util[_0xb472('0x2')](_0xb472('0x4a'),_0x360783[_0xb472('0x4')],queues[_0x360783[_0xb472('0x45')]][_0xb472('0x1e')],_0x360783['transfereeuniqueid'],_0x360783[_0xb472('0x48')]));}}catch(_0x5197f0){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x44'),_0x360783[_0xb472('0x4')]),_0x5197f0);}};exports[_0xb472('0x4b')]=function(_0x3033fc){try{utils[_0xb472('0x18')](util['format'](_0xb472('0x4c'),_0x3033fc[_0xb472('0x4d')]),_0x3033fc);if(_0x3033fc[_0xb472('0x4d')]==_0x3033fc[_0xb472('0x4e')]){if(!_['isNil'](queues[_0x3033fc[_0xb472('0x4f')]])){utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x50'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x1e')],_0x3033fc[_0xb472('0x51')]));queues[_0x3033fc[_0xb472('0x4f')]]['transfer']=!![];queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x46')]=_0xb472('0x52');queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x53')]=_0x3033fc[_0xb472('0x51')];queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x49')]=_0x3033fc[_0xb472('0x4d')];queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x9')]=_0xb472('0x54');}if(!_[_0xb472('0x17')](queues[_0x3033fc[_0xb472('0x4e')]])){if(_0x3033fc[_0xb472('0x55')]&&queues[_0x3033fc[_0xb472('0x55')]]){queues[_0x3033fc['transfereelinkedid']][_0xb472('0x56')]=0x1;queues[_0x3033fc['transfereeuniqueid']]=_[_0xb472('0x57')](queues[_0x3033fc[_0xb472('0x55')]]);queues[_0x3033fc[_0xb472('0x45')]]['transfereduniqueid']=_0x3033fc['transfertargetuniqueid'];queues[_0x3033fc[_0xb472('0x45')]]['queuecallerenterreason']=0x2;queues[_0x3033fc[_0xb472('0x45')]]['calleridnum']=queues[_0x3033fc['secondtransfererlinkedid']][_0xb472('0x7')];queues[_0x3033fc[_0xb472('0x45')]][_0xb472('0x58')]=queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x58')];queues[_0x3033fc[_0xb472('0x45')]]['queuecallerjoinAt']=utils[_0xb472('0x15')]();queues[_0x3033fc[_0xb472('0x45')]]['queuecallerleaveAt']=utils[_0xb472('0x15')]();queues[_0x3033fc[_0xb472('0x45')]]['holdtime']=0x0;queues[_0x3033fc[_0xb472('0x45')]][_0xb472('0x59')]=0x0;utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x5a'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x45')]]['name'],queues[_0x3033fc[_0xb472('0x45')]]['calleridnum'],queues[_0x3033fc[_0xb472('0x45')]][_0xb472('0x58')]));}else{utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x5b'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x4e')]]['name'],_0x3033fc[_0xb472('0x4f')]));queues[_0x3033fc['origtransfererlinkedid']][_0xb472('0x10')]=_0x3033fc[_0xb472('0x4f')];}}}else if(_0x3033fc[_0xb472('0x5c')]==_0x3033fc[_0xb472('0x4f')]){if(!_[_0xb472('0x17')](queues[_0x3033fc[_0xb472('0x4e')]])){utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x5d'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x1e')],_0x3033fc['secondtransfereruniqueid'],_0x3033fc[_0xb472('0x5e')]));queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x3e')]=!![];queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x46')]=_0xb472('0x52');queues[_0x3033fc[_0xb472('0x4e')]]['transferexten']=_0x3033fc[_0xb472('0x5e')];queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x49')]=_0x3033fc[_0xb472('0x5c')];queues[_0x3033fc[_0xb472('0x4e')]]['queuecallerexitreason']=_0xb472('0x54');}if(!_['isNil'](queues[_0x3033fc[_0xb472('0x4f')]])){if(_0x3033fc[_0xb472('0x5f')]&&queues[_0x3033fc['transfertargetlinkedid']]){queues[_0x3033fc[_0xb472('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x3033fc[_0xb472('0x60')]]=_[_0xb472('0x57')](queues[_0x3033fc[_0xb472('0x5f')]]);queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x10')]=_0x3033fc[_0xb472('0x60')];queues[_0x3033fc[_0xb472('0x60')]]['queuecallerenterreason']=0x2;queues[_0x3033fc[_0xb472('0x60')]]['calleridnum']=queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x7')];queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x58')]=queues[_0x3033fc['origtransfererlinkedid']][_0xb472('0x58')];queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x33')]=utils[_0xb472('0x15')]();queues[_0x3033fc['transfertargetuniqueid']][_0xb472('0x1a')]=utils[_0xb472('0x15')]();queues[_0x3033fc['transfertargetuniqueid']][_0xb472('0x32')]=0x0;queues[_0x3033fc[_0xb472('0x60')]]['mohtime']=0x0;utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x61'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x60')]]['name'],queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x10')],queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x7')],queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x58')]));}else{utils[_0xb472('0x1')](util[_0xb472('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x1e')],_0x3033fc['origtransfererlinkedid']));queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x10')]=_0x3033fc[_0xb472('0x4e')];}}}}catch(_0x3e6235){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x4c'),_0x3033fc['origtransfereruniqueid']),_0x3e6235);}};exports['musiconholdstart']=function(_0x3a0f65){try{if(!_['isNil'](queues[_0x3a0f65['uniqueid']])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x62'),_0x3a0f65['uniqueid']),_0x3a0f65);queues[_0x3a0f65['uniqueid']][_0xb472('0x63')]=utils['now']();utils[_0xb472('0x1')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3a0f65[_0xb472('0x4')],queues[_0x3a0f65[_0xb472('0x4')]][_0xb472('0x1e')],queues[_0x3a0f65[_0xb472('0x4')]][_0xb472('0x63')]));}}catch(_0x14b43f){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x62'),_0x3a0f65[_0xb472('0x4')]),_0x14b43f);}};exports[_0xb472('0x64')]=function(_0x58b589){try{if(!_[_0xb472('0x17')](queues[_0x58b589[_0xb472('0x4')]])){if(!_[_0xb472('0x17')](queues[_0x58b589[_0xb472('0x4')]]['musiconholdstartAt'])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x65'),_0x58b589[_0xb472('0x4')]),_0x58b589);queues[_0x58b589[_0xb472('0x4')]][_0xb472('0x59')]+=utils[_0xb472('0x66')](utils[_0xb472('0x15')](),queues[_0x58b589[_0xb472('0x4')]][_0xb472('0x63')]);utils[_0xb472('0x1')](util['format'](_0xb472('0x67'),_0x58b589['uniqueid'],queues[_0x58b589['uniqueid']][_0xb472('0x1e')],queues[_0x58b589[_0xb472('0x4')]][_0xb472('0x59')]));delete queues[_0x58b589[_0xb472('0x4')]][_0xb472('0x63')];}}}catch(_0x1e927d){utils['error'](util['format']('[%s][queues][musiconholdstop]',_0x58b589['uniqueid']),_0x1e927d);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5c37c52..770a759 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 _0xab9e=['uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','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','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinename','type','connectedlinenum','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','./utils','info','format','[%s][recordings][writeDB]'];(function(_0x2b82be,_0x3991a2){var _0xdefcb5=function(_0x5a68a9){while(--_0x5a68a9){_0x2b82be['push'](_0x2b82be['shift']());}};_0xdefcb5(++_0x3991a2);}(_0xab9e,0x181));var _0xeab9=function(_0x298825,_0x519160){_0x298825=_0x298825-0x0;var _0xe62c7a=_0xab9e[_0x298825];return _0xe62c7a;};'use strict';var _=require(_0xeab9('0x0'));var util=require('util');var utils=require(_0xeab9('0x1'));var recordings={};function writeDB(_0x4f9e07){utils[_0xeab9('0x2')](util[_0xeab9('0x3')](_0xeab9('0x4'),_0x4f9e07[_0xeab9('0x5')]));if(_0x4f9e07[_0xeab9('0x6')]){utils[_0xeab9('0x7')](_0x4f9e07['accountcode'])[_0xeab9('0x8')](function(_0x4846c6){if(_0x4846c6){_0x4f9e07[_0xeab9('0x9')]=_0x4846c6[_0xeab9('0xa')];_0x4f9e07[_0xeab9('0xb')]=_0x4846c6['id'];}utils[_0xeab9('0xc')](_0xeab9('0xd'),_0x4f9e07);});}else{utils[_0xeab9('0xc')](_0xeab9('0xd'),_0x4f9e07);}}exports[_0xeab9('0xe')]=function(_0x14ca9e){try{utils[_0xeab9('0xf')](util['format'](_0xeab9('0x10'),_0x14ca9e[_0xeab9('0x5')]),_0x14ca9e);if(_0x14ca9e[_0xeab9('0x5')]==_0x14ca9e[_0xeab9('0x11')]){utils[_0xeab9('0x2')](util[_0xeab9('0x3')](_0xeab9('0x12'),_0x14ca9e[_0xeab9('0x5')],_0x14ca9e[_0xeab9('0x13')],_0x14ca9e[_0xeab9('0x14')]));recordings[_0x14ca9e[_0xeab9('0x5')]]={'uniqueid':_0x14ca9e[_0xeab9('0x5')],'accountcode':_0x14ca9e[_0xeab9('0x6')],'exten':_0x14ca9e[_0xeab9('0x14')],'context':_0x14ca9e['context'],'channel':_0x14ca9e['channel'],'monitors':[]};}}catch(_0x2ddc51){utils[_0xeab9('0x15')](util[_0xeab9('0x3')]('[%s][recordings][newchannel]',_0x14ca9e[_0xeab9('0x5')]),_0x2ddc51);}};exports[_0xeab9('0x16')]=function(_0x318b79){try{utils['debug'](util[_0xeab9('0x3')](_0xeab9('0x17'),_0x318b79[_0xeab9('0x5')]),_0x318b79);if(!_[_0xeab9('0x18')](recordings[_0x318b79[_0xeab9('0x5')]])&&_0x318b79[_0xeab9('0x19')]==0x6){utils[_0xeab9('0x2')](util[_0xeab9('0x3')](_0xeab9('0x1a'),_0x318b79[_0xeab9('0x5')],_0x318b79[_0xeab9('0x13')],_0x318b79[_0xeab9('0x1b')]));}else if(!_['isNil'](recordings[_0x318b79[_0xeab9('0x11')]])&&_0x318b79[_0xeab9('0x19')]==0x6&&_0x318b79[_0xeab9('0x13')]!=_0xeab9('0x1c')){utils[_0xeab9('0x2')](util['format'](_0xeab9('0x1d'),_0x318b79[_0xeab9('0x5')],_0x318b79[_0xeab9('0x11')],_0x318b79[_0xeab9('0x13')],_0x318b79['channel']));recordings[_0x318b79[_0xeab9('0x11')]][_0xeab9('0x6')]=_0x318b79['accountcode'];}}catch(_0x1602de){utils[_0xeab9('0x15')](util[_0xeab9('0x3')]('[%s][recordings][newstate]',_0x318b79['uniqueid']),_0x1602de);}};exports[_0xeab9('0x1e')]=function(_0x413b35){try{if(!_['isNil'](_0x413b35[_0xeab9('0x1f')])&&!_[_0xeab9('0x18')](_0x413b35[_0xeab9('0x1f')][_0xeab9('0x20')])){utils['debug'](util[_0xeab9('0x3')](_0xeab9('0x21'),_0x413b35[_0xeab9('0x5')]),_0x413b35);utils[_0xeab9('0x2')](util[_0xeab9('0x3')](_0xeab9('0x22'),_0x413b35['uniqueid'],_0x413b35[_0xeab9('0x1f')],_0x413b35[_0xeab9('0x23')]));if(_[_0xeab9('0x24')](_0x413b35[_0xeab9('0x23')],'.wav49')){_0x413b35[_0xeab9('0x23')]=_0x413b35[_0xeab9('0x23')]['replace'](_0xeab9('0x25'),_0xeab9('0x26'));}if(recordings[_0x413b35[_0xeab9('0x11')]]){var _0x54a964=_[_0xeab9('0x27')](recordings[_0x413b35[_0xeab9('0x11')]]['monitors'],{'value':_0x413b35[_0xeab9('0x23')]});if(_[_0xeab9('0x18')](_0x54a964)){recordings[_0x413b35[_0xeab9('0x11')]][_0xeab9('0x28')]['push']({'value':_0x413b35[_0xeab9('0x23')]});}}}}catch(_0x45b0f2){utils['error'](util[_0xeab9('0x3')]('[%s][recordings][varset]',_0x413b35['uniqueid']),_0x45b0f2);}};exports[_0xeab9('0x29')]=function(_0x11fd3f){try{if(!_[_0xeab9('0x18')](recordings[_0x11fd3f[_0xeab9('0x5')]])){utils[_0xeab9('0xf')](util['format'](_0xeab9('0x2a'),_0x11fd3f[_0xeab9('0x5')]),_0x11fd3f);utils['info'](util[_0xeab9('0x3')](_0xeab9('0x2b'),_0x11fd3f[_0xeab9('0x5')],_0x11fd3f['calleridnum'],_0x11fd3f[_0xeab9('0x2c')],_0x11fd3f[_0xeab9('0x2d')]));recordings[_0x11fd3f['uniqueid']][_0xeab9('0x2e')]=_0x11fd3f[_0xeab9('0x2e')];recordings[_0x11fd3f[_0xeab9('0x5')]]['calleridname']=_0x11fd3f[_0xeab9('0x2c')];recordings[_0x11fd3f[_0xeab9('0x5')]]['connectedlinenum']=_0x11fd3f['connectedlinenum'];recordings[_0x11fd3f[_0xeab9('0x5')]]['connectedlinename']=_0x11fd3f[_0xeab9('0x2f')];if(recordings[_0x11fd3f[_0xeab9('0x5')]][_0xeab9('0x30')]=='outbound'&&recordings[_0x11fd3f[_0xeab9('0x5')]][_0xeab9('0x6')]){recordings[_0x11fd3f[_0xeab9('0x5')]][_0xeab9('0x31')]=recordings[_0x11fd3f[_0xeab9('0x5')]][_0xeab9('0x6')];recordings[_0x11fd3f[_0xeab9('0x5')]][_0xeab9('0x2f')]='';}recordings[_0x11fd3f[_0xeab9('0x5')]][_0xeab9('0x28')]['forEach'](function(_0x5704fd){var _0x8f705=_[_0xeab9('0x32')](recordings[_0x11fd3f[_0xeab9('0x5')]]);_0x8f705[_0xeab9('0x23')]=_0x5704fd['value'];writeDB(_0x8f705);});delete recordings[_0x11fd3f[_0xeab9('0x5')]];}}catch(_0x58ebb7){utils['error'](util[_0xeab9('0x3')]('[%s][recordings][hangup]',_0x11fd3f[_0xeab9('0x5')]),_0x58ebb7);}};exports['newexten']=function(_0x51a875){try{if(!_['isNil'](recordings[_0x51a875[_0xeab9('0x5')]])){utils['debug'](util[_0xeab9('0x3')](_0xeab9('0x33'),_0x51a875[_0xeab9('0x5')]),_0x51a875);utils[_0xeab9('0x2')](util[_0xeab9('0x3')](_0xeab9('0x34'),_0x51a875['uniqueid'],_0x51a875['application'],_0x51a875[_0xeab9('0x35')]));if(_0x51a875[_0xeab9('0x36')]['toLowerCase']()==_0xeab9('0x37')&&_[_0xeab9('0x38')](_0x51a875[_0xeab9('0x35')][_0xeab9('0x39')](),_0xeab9('0x3a'))){var _0x20d2d0=_0x51a875['appdata']['split']('=');var _0x36d9a7=_0x20d2d0[0x0][_0xeab9('0x3b')](_0x20d2d0[0x0]['lastIndexOf']('(')+0x1,_0x20d2d0[0x0][_0xeab9('0x3c')](')'));var _0x52b5fb=_0x20d2d0[0x1];recordings[_0x51a875[_0xeab9('0x5')]][_0x36d9a7]=_0x52b5fb;}}}catch(_0x21d6a5){utils[_0xeab9('0x15')](util[_0xeab9('0x3')](_0xeab9('0x33'),_0x51a875[_0xeab9('0x5')]),_0x21d6a5);}};exports[_0xeab9('0x3d')]=function(_0x213abb){try{if(!_[_0xeab9('0x18')](recordings[_0x213abb[_0xeab9('0x5')]])){utils[_0xeab9('0xf')](util[_0xeab9('0x3')]('[%s][recordings][queuecallerjoin]',_0x213abb[_0xeab9('0x5')]),_0x213abb);utils[_0xeab9('0x2')](util[_0xeab9('0x3')](_0xeab9('0x3e'),_0x213abb[_0xeab9('0x5')],_0x213abb[_0xeab9('0x3f')]));recordings[_0x213abb[_0xeab9('0x5')]][_0xeab9('0x3f')]=_0x213abb[_0xeab9('0x3f')];}}catch(_0x9c213b){utils[_0xeab9('0x15')](util[_0xeab9('0x3')](_0xeab9('0x40'),_0x213abb[_0xeab9('0x5')]),_0x9c213b);}}; \ No newline at end of file +var _0xf1a3=['format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','debug'];(function(_0x33e923,_0x18fcbd){var _0x2ace09=function(_0x681474){while(--_0x681474){_0x33e923['push'](_0x33e923['shift']());}};_0x2ace09(++_0x18fcbd);}(_0xf1a3,0x78));var _0x3f1a=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0xf1a3[_0x27604f];return _0x40d189;};'use strict';var _=require(_0x3f1a('0x0'));var util=require(_0x3f1a('0x1'));var utils=require(_0x3f1a('0x2'));var recordings={};function writeDB(_0x16a3a1){utils[_0x3f1a('0x3')](util['format'](_0x3f1a('0x4'),_0x16a3a1[_0x3f1a('0x5')]));if(_0x16a3a1[_0x3f1a('0x6')]){utils[_0x3f1a('0x7')](_0x16a3a1[_0x3f1a('0x6')])[_0x3f1a('0x8')](function(_0x4017a9){if(_0x4017a9){_0x16a3a1['membername']=_0x4017a9[_0x3f1a('0x9')];_0x16a3a1[_0x3f1a('0xa')]=_0x4017a9['id'];}utils[_0x3f1a('0xb')](_0x3f1a('0xc'),_0x16a3a1);});}else{utils[_0x3f1a('0xb')](_0x3f1a('0xc'),_0x16a3a1);}}exports['newchannel']=function(_0x8ebcaf){try{utils[_0x3f1a('0xd')](util[_0x3f1a('0xe')](_0x3f1a('0xf'),_0x8ebcaf[_0x3f1a('0x5')]),_0x8ebcaf);if(_0x8ebcaf[_0x3f1a('0x5')]==_0x8ebcaf[_0x3f1a('0x10')]){utils[_0x3f1a('0x3')](util[_0x3f1a('0xe')](_0x3f1a('0x11'),_0x8ebcaf[_0x3f1a('0x5')],_0x8ebcaf[_0x3f1a('0x12')],_0x8ebcaf['exten']));recordings[_0x8ebcaf[_0x3f1a('0x5')]]={'uniqueid':_0x8ebcaf[_0x3f1a('0x5')],'accountcode':_0x8ebcaf['accountcode'],'exten':_0x8ebcaf[_0x3f1a('0x13')],'context':_0x8ebcaf[_0x3f1a('0x12')],'channel':_0x8ebcaf[_0x3f1a('0x14')],'monitors':[]};}}catch(_0xae874a){utils['error'](util[_0x3f1a('0xe')](_0x3f1a('0xf'),_0x8ebcaf[_0x3f1a('0x5')]),_0xae874a);}};exports[_0x3f1a('0x15')]=function(_0x5d57e0){try{utils[_0x3f1a('0xd')](util[_0x3f1a('0xe')](_0x3f1a('0x16'),_0x5d57e0[_0x3f1a('0x5')]),_0x5d57e0);if(!_[_0x3f1a('0x17')](recordings[_0x5d57e0[_0x3f1a('0x5')]])&&_0x5d57e0[_0x3f1a('0x18')]==0x6){utils['info'](util[_0x3f1a('0xe')](_0x3f1a('0x19'),_0x5d57e0['uniqueid'],_0x5d57e0[_0x3f1a('0x12')],_0x5d57e0['channel']));}else if(!_['isNil'](recordings[_0x5d57e0['linkedid']])&&_0x5d57e0[_0x3f1a('0x18')]==0x6&&_0x5d57e0[_0x3f1a('0x12')]!=_0x3f1a('0x1a')){utils[_0x3f1a('0x3')](util['format'](_0x3f1a('0x1b'),_0x5d57e0[_0x3f1a('0x5')],_0x5d57e0[_0x3f1a('0x10')],_0x5d57e0[_0x3f1a('0x12')],_0x5d57e0['channel']));recordings[_0x5d57e0[_0x3f1a('0x10')]][_0x3f1a('0x6')]=_0x5d57e0[_0x3f1a('0x6')];}}catch(_0x311118){utils[_0x3f1a('0x1c')](util[_0x3f1a('0xe')]('[%s][recordings][newstate]',_0x5d57e0[_0x3f1a('0x5')]),_0x311118);}};exports[_0x3f1a('0x1d')]=function(_0x482a72){try{if(!_['isNil'](_0x482a72[_0x3f1a('0x1e')])&&!_['isNil'](_0x482a72[_0x3f1a('0x1e')][_0x3f1a('0x1f')])){utils['debug'](util[_0x3f1a('0xe')](_0x3f1a('0x20'),_0x482a72[_0x3f1a('0x5')]),_0x482a72);utils[_0x3f1a('0x3')](util[_0x3f1a('0xe')](_0x3f1a('0x21'),_0x482a72[_0x3f1a('0x5')],_0x482a72[_0x3f1a('0x1e')],_0x482a72[_0x3f1a('0x22')]));if(_['endsWith'](_0x482a72[_0x3f1a('0x22')],_0x3f1a('0x23'))){_0x482a72[_0x3f1a('0x22')]=_0x482a72[_0x3f1a('0x22')][_0x3f1a('0x24')](_0x3f1a('0x23'),'.WAV');}if(recordings[_0x482a72['linkedid']]){var _0xbad88d=_[_0x3f1a('0x25')](recordings[_0x482a72[_0x3f1a('0x10')]][_0x3f1a('0x26')],{'value':_0x482a72[_0x3f1a('0x22')]});if(_[_0x3f1a('0x17')](_0xbad88d)){recordings[_0x482a72[_0x3f1a('0x10')]]['monitors'][_0x3f1a('0x27')]({'value':_0x482a72['value']});}}}}catch(_0x54d63e){utils['error'](util[_0x3f1a('0xe')]('[%s][recordings][varset]',_0x482a72[_0x3f1a('0x5')]),_0x54d63e);}};exports[_0x3f1a('0x28')]=function(_0x492ef7){try{if(!_[_0x3f1a('0x17')](recordings[_0x492ef7['uniqueid']])){utils[_0x3f1a('0xd')](util[_0x3f1a('0xe')](_0x3f1a('0x29'),_0x492ef7[_0x3f1a('0x5')]),_0x492ef7);utils['info'](util[_0x3f1a('0xe')](_0x3f1a('0x2a'),_0x492ef7[_0x3f1a('0x5')],_0x492ef7[_0x3f1a('0x2b')],_0x492ef7[_0x3f1a('0x2c')],_0x492ef7[_0x3f1a('0x2d')]));recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x2b')]=_0x492ef7[_0x3f1a('0x2b')];recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x2c')]=_0x492ef7[_0x3f1a('0x2c')];recordings[_0x492ef7['uniqueid']][_0x3f1a('0x2e')]=_0x492ef7[_0x3f1a('0x2e')];recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x2f')]=_0x492ef7[_0x3f1a('0x2f')];if(recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x30')]==_0x3f1a('0x31')&&recordings[_0x492ef7[_0x3f1a('0x5')]]['accountcode']){recordings[_0x492ef7['uniqueid']][_0x3f1a('0x2e')]=recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x6')];recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x2f')]='';}recordings[_0x492ef7[_0x3f1a('0x5')]]['monitors'][_0x3f1a('0x32')](function(_0x47f7ab){var _0x1cdaff=_[_0x3f1a('0x33')](recordings[_0x492ef7['uniqueid']]);_0x1cdaff[_0x3f1a('0x22')]=_0x47f7ab[_0x3f1a('0x22')];writeDB(_0x1cdaff);});delete recordings[_0x492ef7[_0x3f1a('0x5')]];}}catch(_0xf5124f){utils['error'](util[_0x3f1a('0xe')](_0x3f1a('0x29'),_0x492ef7[_0x3f1a('0x5')]),_0xf5124f);}};exports[_0x3f1a('0x34')]=function(_0x915e30){try{if(!_[_0x3f1a('0x17')](recordings[_0x915e30[_0x3f1a('0x5')]])){utils[_0x3f1a('0xd')](util['format'](_0x3f1a('0x35'),_0x915e30[_0x3f1a('0x5')]),_0x915e30);utils['info'](util[_0x3f1a('0xe')](_0x3f1a('0x36'),_0x915e30[_0x3f1a('0x5')],_0x915e30['application'],_0x915e30[_0x3f1a('0x37')]));if(_0x915e30[_0x3f1a('0x38')][_0x3f1a('0x39')]()==_0x3f1a('0x3a')&&_[_0x3f1a('0x3b')](_0x915e30[_0x3f1a('0x37')][_0x3f1a('0x39')](),_0x3f1a('0x3c'))){var _0x19dcde=_0x915e30[_0x3f1a('0x37')]['split']('=');var _0x1cf6ef=_0x19dcde[0x0][_0x3f1a('0x3d')](_0x19dcde[0x0]['lastIndexOf']('(')+0x1,_0x19dcde[0x0][_0x3f1a('0x3e')](')'));var _0x5d066a=_0x19dcde[0x1];recordings[_0x915e30['uniqueid']][_0x1cf6ef]=_0x5d066a;}}}catch(_0x14cfa8){utils['error'](util['format'](_0x3f1a('0x35'),_0x915e30[_0x3f1a('0x5')]),_0x14cfa8);}};exports[_0x3f1a('0x3f')]=function(_0x39c274){try{if(!_['isNil'](recordings[_0x39c274['uniqueid']])){utils[_0x3f1a('0xd')](util[_0x3f1a('0xe')](_0x3f1a('0x40'),_0x39c274[_0x3f1a('0x5')]),_0x39c274);utils[_0x3f1a('0x3')](util[_0x3f1a('0xe')](_0x3f1a('0x41'),_0x39c274[_0x3f1a('0x5')],_0x39c274[_0x3f1a('0x42')]));recordings[_0x39c274[_0x3f1a('0x5')]]['queue']=_0x39c274[_0x3f1a('0x42')];}}catch(_0x2df694){utils[_0x3f1a('0x1c')](util['format']('[%s][recordings][queuecallerjoin]',_0x39c274['uniqueid']),_0x2df694);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 12162c3..682b5dc 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 _0x4464=['secondtransfererexten','origtransferercontext','attended','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext'];(function(_0x3de2eb,_0x28c2e0){var _0x5ad88f=function(_0x521d5d){while(--_0x521d5d){_0x3de2eb['push'](_0x3de2eb['shift']());}};_0x5ad88f(++_0x28c2e0);}(_0x4464,0xed));var _0x4446=function(_0x5b4f6b,_0x5cda30){_0x5b4f6b=_0x5b4f6b-0x0;var _0x39f333=_0x4464[_0x5b4f6b];return _0x39f333;};'use strict';var _=require(_0x4446('0x0'));var util=require(_0x4446('0x1'));var utils=require(_0x4446('0x2'));function writeDB(_0x598ae3){utils[_0x4446('0x3')](util[_0x4446('0x4')](_0x4446('0x5'),_0x598ae3[_0x4446('0x6')]==='attended'?_0x598ae3['origtransfereruniqueid']:_0x598ae3[_0x4446('0x7')],_0x598ae3['type']));utils[_0x4446('0x8')](_0x4446('0x9'),_0x598ae3);}exports['blindtransfer']=function(_0x5c3753){try{utils[_0x4446('0xa')](util[_0x4446('0x4')](_0x4446('0xb'),_0x5c3753[_0x4446('0x7')]),_0x5c3753);utils['info'](util[_0x4446('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5c3753[_0x4446('0x7')],_0x5c3753[_0x4446('0xc')],_0x5c3753[_0x4446('0xd')],_0x5c3753[_0x4446('0xe')],_0x5c3753[_0x4446('0xf')]));_0x5c3753[_0x4446('0x6')]='blind';writeDB(_0x5c3753);}catch(_0x347a4e){utils[_0x4446('0x10')](util[_0x4446('0x4')]('[%s][transfers][blindtransfer]',_0x5c3753[_0x4446('0x7')]),_0x347a4e);}};exports[_0x4446('0x11')]=function(_0x809d46){try{utils['debug'](util['format'](_0x4446('0x12'),_0x809d46[_0x4446('0x13')]),_0x809d46);utils[_0x4446('0x3')](util[_0x4446('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x809d46[_0x4446('0x13')],_0x809d46[_0x4446('0x14')],_0x809d46[_0x4446('0x15')],_0x809d46[_0x4446('0x16')],_0x809d46[_0x4446('0x17')]));_0x809d46=_[_0x4446('0x18')](_0x809d46,{'transfererchannel':_0x809d46[_0x4446('0x19')],'transferercalleridnum':_0x809d46[_0x4446('0x14')],'transferercalleridname':_0x809d46[_0x4446('0x15')],'transfererconnectedlinenum':_0x809d46[_0x4446('0x1a')],'transfererconnectedlinename':_0x809d46[_0x4446('0x1b')],'transfereraccountcode':_0x809d46['origtransfereraccountcode'],'transferercontext':_0x809d46[_0x4446('0x1c')],'transfererexten':_0x809d46[_0x4446('0x1d')],'transfererlinkedid':_0x809d46['origtransfererlinkedid'],'context':_0x809d46[_0x4446('0x1e')],'extension':_0x809d46['origtransfererexten'],'type':_0x4446('0x1f')});if(_['isNil'](_0x809d46['transfereechannel'])){_0x809d46=_[_0x4446('0x18')](_0x809d46,{'transfereechannel':_0x809d46[_0x4446('0x20')],'transfereecalleridnum':_0x809d46[_0x4446('0x16')],'transfereecalleridname':_0x809d46['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x809d46['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x809d46[_0x4446('0x21')],'transfereeaccountcode':_0x809d46[_0x4446('0x22')],'transfereecontext':_0x809d46[_0x4446('0x23')],'transfereeexten':_0x809d46[_0x4446('0x24')],'transfereelinkedid':_0x809d46[_0x4446('0x25')]});}writeDB(_0x809d46);}catch(_0x2237b1){utils[_0x4446('0x10')](util[_0x4446('0x4')]('[%s][transfers][attendedtransfer]',_0x809d46['origtransfereruniqueid']),_0x2237b1);}}; \ No newline at end of file +var _0x0e23=['type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','debug','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','format'];(function(_0x4af431,_0x4493a1){var _0x41cfff=function(_0x5ef837){while(--_0x5ef837){_0x4af431['push'](_0x4af431['shift']());}};_0x41cfff(++_0x4493a1);}(_0x0e23,0x1ea));var _0x30e2=function(_0x23088e,_0x9b50b0){_0x23088e=_0x23088e-0x0;var _0x242c4c=_0x0e23[_0x23088e];return _0x242c4c;};'use strict';var _=require(_0x30e2('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x44cdbc){utils['info'](util[_0x30e2('0x1')]('[%s][transfers][writeDB]\x20type:%s',_0x44cdbc[_0x30e2('0x2')]==='attended'?_0x44cdbc[_0x30e2('0x3')]:_0x44cdbc[_0x30e2('0x4')],_0x44cdbc[_0x30e2('0x2')]));utils[_0x30e2('0x5')](_0x30e2('0x6'),_0x44cdbc);}exports['blindtransfer']=function(_0x29cb31){try{utils['debug'](util[_0x30e2('0x1')]('[%s][transfers][blindtransfer]',_0x29cb31[_0x30e2('0x4')]),_0x29cb31);utils[_0x30e2('0x7')](util[_0x30e2('0x1')](_0x30e2('0x8'),_0x29cb31[_0x30e2('0x4')],_0x29cb31[_0x30e2('0x9')],_0x29cb31[_0x30e2('0xa')],_0x29cb31[_0x30e2('0xb')],_0x29cb31[_0x30e2('0xc')]));_0x29cb31[_0x30e2('0x2')]=_0x30e2('0xd');writeDB(_0x29cb31);}catch(_0x382878){utils[_0x30e2('0xe')](util[_0x30e2('0x1')](_0x30e2('0xf'),_0x29cb31[_0x30e2('0x4')]),_0x382878);}};exports[_0x30e2('0x10')]=function(_0x933840){try{utils[_0x30e2('0x11')](util[_0x30e2('0x1')]('[%s][transfers][attendedtransfer]',_0x933840[_0x30e2('0x3')]),_0x933840);utils[_0x30e2('0x7')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x933840[_0x30e2('0x3')],_0x933840[_0x30e2('0x12')],_0x933840[_0x30e2('0x13')],_0x933840[_0x30e2('0x14')],_0x933840[_0x30e2('0x15')]));_0x933840=_[_0x30e2('0x16')](_0x933840,{'transfererchannel':_0x933840[_0x30e2('0x17')],'transferercalleridnum':_0x933840[_0x30e2('0x12')],'transferercalleridname':_0x933840['origtransferercalleridname'],'transfererconnectedlinenum':_0x933840['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x933840[_0x30e2('0x18')],'transfereraccountcode':_0x933840[_0x30e2('0x19')],'transferercontext':_0x933840[_0x30e2('0x1a')],'transfererexten':_0x933840[_0x30e2('0x1b')],'transfererlinkedid':_0x933840[_0x30e2('0x1c')],'context':_0x933840[_0x30e2('0x1d')],'extension':_0x933840[_0x30e2('0x1e')],'type':_0x30e2('0x1f')});if(_[_0x30e2('0x20')](_0x933840[_0x30e2('0x21')])){_0x933840=_[_0x30e2('0x16')](_0x933840,{'transfereechannel':_0x933840[_0x30e2('0x22')],'transfereecalleridnum':_0x933840['transfertargetcalleridnum'],'transfereecalleridname':_0x933840[_0x30e2('0x15')],'transfereeconnectedlinenum':_0x933840['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x933840[_0x30e2('0x23')],'transfereeaccountcode':_0x933840[_0x30e2('0x24')],'transfereecontext':_0x933840[_0x30e2('0x25')],'transfereeexten':_0x933840[_0x30e2('0x26')],'transfereelinkedid':_0x933840[_0x30e2('0x27')]});}writeDB(_0x933840);}catch(_0x4b39de){utils[_0x30e2('0xe')](util['format'](_0x30e2('0x28'),_0x933840['origtransfereruniqueid']),_0x4b39de);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ae16e86..3e607fe 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 _0x6de6=['request','then','[utils][request]\x20name:%s','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','format','diffTime','diff','sumTime','now','isAfter','bluebird','moment','util','client','http','../../config/logger','info','inspect','debug','error'];(function(_0x3bdf8d,_0x2ba114){var _0x31717a=function(_0x1baf4b){while(--_0x1baf4b){_0x3bdf8d['push'](_0x3bdf8d['shift']());}};_0x31717a(++_0x2ba114);}(_0x6de6,0x19d));var _0x66de=function(_0xa521cb,_0x274e3e){_0xa521cb=_0xa521cb-0x0;var _0x159b3d=_0x6de6[_0xa521cb];return _0x159b3d;};'use strict';var BPromise=require(_0x66de('0x0'));var jayson=require('jayson/promise');var moment=require(_0x66de('0x1'));var util=require(_0x66de('0x2'));var client=jayson[_0x66de('0x3')][_0x66de('0x4')]({'port':0x2329});var logger=require(_0x66de('0x5'))('xdr');exports['info']=function(_0x574044,_0x103c4c){logger[_0x66de('0x6')](_0x574044,_0x103c4c?util[_0x66de('0x7')](_0x103c4c,{'showHidden':![],'depth':null}):'');};exports[_0x66de('0x8')]=function(_0x13e275,_0x25b8d6){logger[_0x66de('0x8')](_0x13e275,_0x25b8d6?util[_0x66de('0x7')](_0x25b8d6,{'showHidden':![],'depth':null}):'');};exports[_0x66de('0x9')]=function(_0x287ca0,_0x1007a2){logger['error'](_0x287ca0,_0x1007a2?util['inspect'](_0x1007a2,{'showHidden':![],'depth':null}):'');};exports[_0x66de('0xa')]=function(_0x3fba36,_0x38a905){return client[_0x66de('0xa')](_0x3fba36,{'body':_0x38a905})[_0x66de('0xb')](function(_0x56c983){logger[_0x66de('0x8')](_0x66de('0xc'),_0x3fba36,_0x56c983?util[_0x66de('0x7')](_0x56c983,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x858305){logger['error'](_0x66de('0xc'),_0x3fba36,_0x858305?util[_0x66de('0x7')](_0x858305,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5e9f6c){return client[_0x66de('0xa')](_0x66de('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x66de('0xe'),_0x66de('0xf')],'where':_0x5e9f6c,'limit':0x1}})['then'](function(_0x58a32d){logger[_0x66de('0x8')](_0x66de('0x10'),JSON[_0x66de('0x11')](_0x5e9f6c),_0x58a32d?util[_0x66de('0x7')](_0x58a32d,{'showHidden':![],'depth':null}):'');return _0x58a32d['result'][_0x66de('0x12')]?_0x58a32d[_0x66de('0x13')][0x0]:null;});}exports[_0x66de('0x14')]=function(_0x11a589){return new BPromise(function(_0x2786d5,_0x171177){if(_0x11a589){return getUser({'internal':_0x11a589})[_0x66de('0xb')](function(_0x92865c){logger[_0x66de('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x11a589,_0x92865c?_0x66de('0x15'):_0x66de('0x16'));return _0x2786d5(_0x92865c);})[_0x66de('0x17')](function(_0x2f86c4){logger[_0x66de('0x9')](_0x66de('0x18'),_0x2f86c4?util[_0x66de('0x7')](_0x2f86c4,{'showHidden':![],'depth':null}):'');return _0x2786d5(null);});}return _0x2786d5(null);});};exports[_0x66de('0x19')]=function(_0x736ba6){return new BPromise(function(_0x2c6b42,_0x533d54){if(_0x736ba6){return getUser({'interface':_0x736ba6})['then'](function(_0x40f7de){logger[_0x66de('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x736ba6,_0x40f7de?_0x66de('0x15'):_0x66de('0x16'));return _0x2c6b42(_0x40f7de);})[_0x66de('0x17')](function(_0x42769c){logger[_0x66de('0x9')](_0x66de('0x1a'),_0x42769c?util['inspect'](_0x42769c,{'showHidden':![],'depth':null}):'');return _0x2c6b42(null);});}return _0x2c6b42(null);});};exports[_0x66de('0x1b')]=function(_0x331626){return new BPromise(function(_0x54d385,_0x49389b){if(_0x331626){return getUser({'name':_0x331626})[_0x66de('0xb')](function(_0x5e0c2c){logger['info'](_0x66de('0x1c'),_0x331626,_0x5e0c2c?_0x66de('0x15'):_0x66de('0x16'));return _0x54d385(_0x5e0c2c);})[_0x66de('0x17')](function(_0xcb0670){logger[_0x66de('0x9')]('[utils][getUserByName]',_0xcb0670?util[_0x66de('0x7')](_0xcb0670,{'showHidden':![],'depth':null}):'');return _0x54d385(null);});}return _0x54d385(null);});};exports[_0x66de('0x1d')]=function(_0x5c7e00){return new BPromise(function(_0x3b4b23,_0x19f71a){if(_0x5c7e00){return client[_0x66de('0xa')](_0x66de('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x66de('0xe'),_0x66de('0x1f'),_0x66de('0x20'),_0x66de('0x21')],'where':{'name':_0x5c7e00},'limit':0x1}})[_0x66de('0xb')](function(_0x351e9e){logger[_0x66de('0x8')](_0x66de('0x22'),_0x5c7e00,_0x351e9e?util[_0x66de('0x7')](_0x351e9e,{'showHidden':![],'depth':null}):'');logger[_0x66de('0x6')](_0x66de('0x23'),_0x5c7e00,_0x351e9e?_0x66de('0x15'):_0x66de('0x16'));return _0x3b4b23(_0x351e9e[_0x66de('0x13')][_0x66de('0x12')]?_0x351e9e[_0x66de('0x13')][0x0]:null);})[_0x66de('0x17')](function(_0x51d972){logger[_0x66de('0x9')](_0x66de('0x24'),_0x51d972?util[_0x66de('0x7')](_0x51d972,{'showHidden':![],'depth':null}):'');return _0x3b4b23(null);});}return _0x3b4b23(null);});};exports[_0x66de('0x25')]=function(_0x2936dc,_0x4cedf6){return moment(_0x2936dc)[_0x66de('0x26')](_0x4cedf6,_0x66de('0x27'))['format'](_0x66de('0x28'));};exports['subtractTime']=function(_0x1f9d8c,_0x4cb1ef){return moment(_0x1f9d8c)['subtract'](_0x4cb1ef,_0x66de('0x27'))[_0x66de('0x29')](_0x66de('0x28'));};exports[_0x66de('0x2a')]=function(_0x1c0029,_0x1963f4){return moment(_0x1c0029)[_0x66de('0x2b')](moment(_0x1963f4),_0x66de('0x27'));};exports[_0x66de('0x2c')]=function(_0x41346c,_0x1c61f8){return parseInt(_0x41346c,0xa)+parseInt(_0x1c61f8,0xa);};exports[_0x66de('0x2d')]=function(){return moment()['format'](_0x66de('0x28'));};exports[_0x66de('0x2e')]=function(_0x515d12,_0x1f4f59){if(_0x1f4f59){return moment(_0x515d12)[_0x66de('0x2e')](_0x1f4f59);}return!![];};exports['isBefore']=function(_0x366463,_0x5405a1){if(_0x5405a1){return moment(_0x366463)['isBefore'](_0x5405a1);}else if(_0x366463){return!![];}return![];}; \ No newline at end of file +var _0x9999=['getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','util','http','../../config/logger','info','debug','inspect','request','then','[utils][request]\x20name:%s','catch','error','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length'];(function(_0x416df5,_0x5cd9e7){var _0x53235b=function(_0xc8811e){while(--_0xc8811e){_0x416df5['push'](_0x416df5['shift']());}};_0x53235b(++_0x5cd9e7);}(_0x9999,0xaf));var _0x9999=function(_0x2d9350,_0x36025a){_0x2d9350=_0x2d9350-0x0;var _0x49910b=_0x9999[_0x2d9350];return _0x49910b;};'use strict';var BPromise=require(_0x9999('0x0'));var jayson=require(_0x9999('0x1'));var moment=require('moment');var util=require(_0x9999('0x2'));var client=jayson['client'][_0x9999('0x3')]({'port':0x2329});var logger=require(_0x9999('0x4'))('xdr');exports[_0x9999('0x5')]=function(_0x242450,_0x38ab56){logger['info'](_0x242450,_0x38ab56?util['inspect'](_0x38ab56,{'showHidden':![],'depth':null}):'');};exports[_0x9999('0x6')]=function(_0x16d823,_0x5207ac){logger[_0x9999('0x6')](_0x16d823,_0x5207ac?util[_0x9999('0x7')](_0x5207ac,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x4c4ce9,_0x4ef0ab){logger['error'](_0x4c4ce9,_0x4ef0ab?util['inspect'](_0x4ef0ab,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4dee74,_0x52bced){return client[_0x9999('0x8')](_0x4dee74,{'body':_0x52bced})[_0x9999('0x9')](function(_0x567dd9){logger['debug'](_0x9999('0xa'),_0x4dee74,_0x567dd9?util[_0x9999('0x7')](_0x567dd9,{'showHidden':![],'depth':null}):'');})[_0x9999('0xb')](function(_0x3a2aa4){logger[_0x9999('0xc')](_0x9999('0xa'),_0x4dee74,_0x3a2aa4?util[_0x9999('0x7')](_0x3a2aa4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1756c1){return client[_0x9999('0x8')](_0x9999('0xd'),{'options':{'raw':!![],'attributes':['id',_0x9999('0xe'),_0x9999('0xf'),_0x9999('0x10')],'where':_0x1756c1,'limit':0x1}})[_0x9999('0x9')](function(_0x2e78ae){logger[_0x9999('0x6')](_0x9999('0x11'),JSON[_0x9999('0x12')](_0x1756c1),_0x2e78ae?util[_0x9999('0x7')](_0x2e78ae,{'showHidden':![],'depth':null}):'');return _0x2e78ae[_0x9999('0x13')][_0x9999('0x14')]?_0x2e78ae[_0x9999('0x13')][0x0]:null;});}exports[_0x9999('0x15')]=function(_0x164532){return new BPromise(function(_0x4fdcdd,_0x403226){if(_0x164532){return getUser({'internal':_0x164532})['then'](function(_0x19b9f4){logger[_0x9999('0x5')](_0x9999('0x16'),_0x164532,_0x19b9f4?_0x9999('0x17'):_0x9999('0x18'));return _0x4fdcdd(_0x19b9f4);})[_0x9999('0xb')](function(_0x4c9331){logger[_0x9999('0xc')](_0x9999('0x19'),_0x4c9331?util['inspect'](_0x4c9331,{'showHidden':![],'depth':null}):'');return _0x4fdcdd(null);});}return _0x4fdcdd(null);});};exports[_0x9999('0x1a')]=function(_0x1e52f1){return new BPromise(function(_0x275fd3,_0x5c8519){if(_0x1e52f1){return getUser({'interface':_0x1e52f1})[_0x9999('0x9')](function(_0x3bbe16){logger[_0x9999('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1e52f1,_0x3bbe16?_0x9999('0x17'):_0x9999('0x18'));return _0x275fd3(_0x3bbe16);})[_0x9999('0xb')](function(_0x246af2){logger[_0x9999('0xc')](_0x9999('0x1b'),_0x246af2?util[_0x9999('0x7')](_0x246af2,{'showHidden':![],'depth':null}):'');return _0x275fd3(null);});}return _0x275fd3(null);});};exports[_0x9999('0x1c')]=function(_0x219ce3){return new BPromise(function(_0x4aed1b,_0xe7e5c9){if(_0x219ce3){return getUser({'name':_0x219ce3})['then'](function(_0x46da2b){logger['info'](_0x9999('0x1d'),_0x219ce3,_0x46da2b?_0x9999('0x17'):_0x9999('0x18'));return _0x4aed1b(_0x46da2b);})[_0x9999('0xb')](function(_0x2b0ed7){logger['error'](_0x9999('0x1e'),_0x2b0ed7?util[_0x9999('0x7')](_0x2b0ed7,{'showHidden':![],'depth':null}):'');return _0x4aed1b(null);});}return _0x4aed1b(null);});};exports[_0x9999('0x1f')]=function(_0x47d915){return new BPromise(function(_0xc7562b,_0x447f90){if(_0x47d915){return client[_0x9999('0x8')](_0x9999('0x20'),{'options':{'raw':!![],'attributes':['id','name','type',_0x9999('0x21'),_0x9999('0x22')],'where':{'name':_0x47d915},'limit':0x1}})[_0x9999('0x9')](function(_0x3f21de){logger[_0x9999('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x47d915,_0x3f21de?util[_0x9999('0x7')](_0x3f21de,{'showHidden':![],'depth':null}):'');logger[_0x9999('0x5')](_0x9999('0x23'),_0x47d915,_0x3f21de?'found':_0x9999('0x18'));return _0xc7562b(_0x3f21de[_0x9999('0x13')][_0x9999('0x14')]?_0x3f21de[_0x9999('0x13')][0x0]:null);})[_0x9999('0xb')](function(_0x54f604){logger[_0x9999('0xc')](_0x9999('0x24'),_0x54f604?util[_0x9999('0x7')](_0x54f604,{'showHidden':![],'depth':null}):'');return _0xc7562b(null);});}return _0xc7562b(null);});};exports[_0x9999('0x25')]=function(_0x56e94c,_0x7626d6){return moment(_0x56e94c)[_0x9999('0x26')](_0x7626d6,_0x9999('0x27'))[_0x9999('0x28')](_0x9999('0x29'));};exports[_0x9999('0x2a')]=function(_0x3d4a96,_0x3fffaa){return moment(_0x3d4a96)[_0x9999('0x2b')](_0x3fffaa,_0x9999('0x27'))[_0x9999('0x28')](_0x9999('0x29'));};exports[_0x9999('0x2c')]=function(_0x1b8290,_0x27f7cf){return moment(_0x1b8290)[_0x9999('0x2d')](moment(_0x27f7cf),_0x9999('0x27'));};exports['sumTime']=function(_0x5b0973,_0x48c64e){return parseInt(_0x5b0973,0xa)+parseInt(_0x48c64e,0xa);};exports[_0x9999('0x2e')]=function(){return moment()['format'](_0x9999('0x29'));};exports[_0x9999('0x2f')]=function(_0xc7932f,_0x22bec3){if(_0x22bec3){return moment(_0xc7932f)[_0x9999('0x2f')](_0x22bec3);}return!![];};exports[_0x9999('0x30')]=function(_0x4e8d60,_0x6c1c46){if(_0x6c1c46){return moment(_0x4e8d60)[_0x9999('0x30')](_0x6c1c46);}else if(_0x4e8d60){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 9e65857..d4931ac 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 _0x52d2=['x-forwarded-for','connection','url','statusCode','responseTime','inspect','logger','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','other','agent_id','agent_name','test','setupLoggers','lodash','express-winston','path','./loggers','fileLogger','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','role','name','ensureDir','then','client','catch','user','no-user','data','timestamp','error','auth','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers'];(function(_0x1b3f44,_0x5cdb98){var _0xb6ff18=function(_0x16c78a){while(--_0x16c78a){_0x1b3f44['push'](_0x1b3f44['shift']());}};_0xb6ff18(++_0x5cdb98);}(_0x52d2,0x9c));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};var fs=require('fs-extra');var _=require(_0x252d('0x0'));var ewinston=require(_0x252d('0x1'));var path=require(_0x252d('0x2'));var util=require('util');var fileLogger=require(_0x252d('0x3'))[_0x252d('0x4')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x252d('0x5'))[_0x252d('0x6')];function ClientSideLogger(){function _0x1f636a(_0x527462){var _0x5497f5=path['join'](_0x252d('0x7'),_0x252d('0x8'),_0x252d('0x9'));var _0x2d9951=path[_0x252d('0xa')]('client',_0x527462[_0x252d('0xb')]+'-'+_0x527462[_0x252d('0xc')]);return fs[_0x252d('0xd')](path[_0x252d('0xa')](_0x5497f5,_0x2d9951))[_0x252d('0xe')](function(){var _0x3c9747=fileLogger(_0x252d('0xf'),path['join'](_0x5497f5,_0x2d9951));return _0x3c9747;})[_0x252d('0x10')](function(_0x503a1f){throw _0x503a1f;});}this[_0x252d('0x8')]=function(_0x376362,_0x31c97c,_0x6d83b7,_0x2859d5){return _0x1f636a(_0x376362[_0x252d('0x11')])[_0x252d('0xe')](function(_0x4cc2a8){var _0x1b2153=_0x4cc2a8[_0x31c97c];return _0x1b2153;})[_0x252d('0xe')](function(_0x127324){var _0x1a35d8=_0x376362[_0x252d('0x11')]?_0x376362[_0x252d('0x11')]['id']:_0x252d('0x12');var _0x17c18a=_0x2859d5[_0x252d('0x13')];var _0x5917bf=_0x2859d5[_0x252d('0x14')];var _0x19cc3f=new Date(Number(_0x5917bf));return _0x127324(_0x1a35d8,_0x19cc3f,_0x6d83b7,_0x17c18a);})['catch'](function(_0x52d7b6){fileLogger(_0x252d('0xf'))[_0x252d('0x15')](_0x52d7b6);});};}function setupLoggers(_0x480ce2){return new Promise(function(_0x841f73){var _0x5d9b83=new ClientSideLogger();var _0x45af3d=fileLogger('api');var _0x2fe9e7=fileLogger(_0x252d('0x16'));_0x480ce2['set'](_0x252d('0x17'),_0x5d9b83);_0x480ce2[_0x252d('0x18')](ewinston['logger']({'winstonInstance':_0x45af3d,'meta':![],'statusLevels':!![],'msg':function(_0x15e2a5,_0x292428){var _0x261772=_0x252d('0x19');if(!_[_0x252d('0x1a')](_0x15e2a5[_0x252d('0x1b')])){_0x261772+=_0x252d('0x1c');var _0x16a10d=_0x15e2a5['body'];maskSensitiveData(_0x16a10d);}return safeTemplate(util[_0x252d('0x1d')](_0x261772,_0x15e2a5[_0x252d('0x1e')],_0x15e2a5[_0x252d('0x1f')][_0x252d('0x20')]?_0x15e2a5[_0x252d('0x1f')][_0x252d('0x20')]:_0x15e2a5[_0x252d('0x21')]['remoteAddress']||_0x15e2a5['ip'],_0x15e2a5[_0x252d('0x22')],_0x292428[_0x252d('0x23')],_0x292428[_0x252d('0x24')],_0x15e2a5[_0x252d('0x11')]?_0x15e2a5[_0x252d('0x11')]['id']:null,_0x15e2a5[_0x252d('0x11')]?_0x15e2a5[_0x252d('0x11')][_0x252d('0xc')]:null,_0x15e2a5[_0x252d('0x11')]?_0x15e2a5[_0x252d('0x11')][_0x252d('0xb')]:null,_0x16a10d?util[_0x252d('0x25')](_0x16a10d,![],null):''));}}));_0x480ce2['use'](ewinston[_0x252d('0x26')]({'winstonInstance':_0x2fe9e7,'meta':![],'statusLevels':!![],'msg':function(_0x16be3f,_0x378047){var _0xfab464='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x16be3f[_0x252d('0x1b')]&&_0x16be3f[_0x252d('0x1b')][_0x252d('0x27')]&&_0x16be3f[_0x252d('0x1b')]['agent_id']){_0xfab464=_0x252d('0x28');}return util[_0x252d('0x1d')](_0xfab464,_0x16be3f[_0x252d('0x1e')],_0x16be3f[_0x252d('0x1f')][_0x252d('0x20')]?_0x16be3f['headers'][_0x252d('0x20')]:_0x16be3f[_0x252d('0x21')][_0x252d('0x29')]||_0x16be3f['ip'],_0x16be3f[_0x252d('0x22')],_0x378047[_0x252d('0x23')],_0x378047[_0x252d('0x24')],_0x16be3f['user']?_0x16be3f[_0x252d('0x11')]['id']:null,_0x16be3f[_0x252d('0x11')]?_0x16be3f[_0x252d('0x11')][_0x252d('0xc')]:null,_0x16be3f[_0x252d('0x11')]?_0x16be3f['user']['role']:null,_0x16be3f[_0x252d('0x1b')]&&_0x16be3f['body'][_0x252d('0x27')]?_0x16be3f[_0x252d('0x1b')][_0x252d('0x27')]:_0x252d('0x2a'),_0x16be3f[_0x252d('0x1b')]&&_0x16be3f['body'][_0x252d('0x2b')]?_0x16be3f[_0x252d('0x1b')][_0x252d('0x2b')]:'',_0x16be3f[_0x252d('0x1b')]&&_0x16be3f['body'][_0x252d('0x2c')]?_0x16be3f[_0x252d('0x1b')][_0x252d('0x2c')]:'');},'ignoreRoute':function(_0x55b7f4){var _0x9ef668=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x9ef668[_0x252d('0x2d')](_0x55b7f4['url']);}}));return _0x841f73();});}exports[_0x252d('0x2e')]=setupLoggers; \ No newline at end of file +var _0x71b9=['no-user','data','timestamp','error','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','other','agent_name','setupLoggers','fs-extra','express-winston','path','util','./loggers','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','catch','user','then'];(function(_0x19e425,_0x7f53c0){var _0x220e1d=function(_0x824c8){while(--_0x824c8){_0x19e425['push'](_0x19e425['shift']());}};_0x220e1d(++_0x7f53c0);}(_0x71b9,0xfc));var _0x971b=function(_0x44883e,_0x4e1af1){_0x44883e=_0x44883e-0x0;var _0x5a541c=_0x71b9[_0x44883e];return _0x5a541c;};var fs=require(_0x971b('0x0'));var _=require('lodash');var ewinston=require(_0x971b('0x1'));var path=require(_0x971b('0x2'));var util=require(_0x971b('0x3'));var fileLogger=require(_0x971b('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x971b('0x5'))[_0x971b('0x6')];function ClientSideLogger(){function _0xce1412(_0x1a22f6){var _0x2e5c90=path[_0x971b('0x7')](_0x971b('0x8'),_0x971b('0x9'),_0x971b('0xa'));var _0xfb4e4b=path[_0x971b('0x7')](_0x971b('0xb'),_0x1a22f6[_0x971b('0xc')]+'-'+_0x1a22f6[_0x971b('0xd')]);return fs[_0x971b('0xe')](path[_0x971b('0x7')](_0x2e5c90,_0xfb4e4b))['then'](function(){var _0x19ad50=fileLogger('client',path[_0x971b('0x7')](_0x2e5c90,_0xfb4e4b));return _0x19ad50;})[_0x971b('0xf')](function(_0x4e8298){throw _0x4e8298;});}this[_0x971b('0x9')]=function(_0x319e58,_0x18d867,_0x351db2,_0x9bc8b4){return _0xce1412(_0x319e58[_0x971b('0x10')])[_0x971b('0x11')](function(_0x3811fa){var _0x343e12=_0x3811fa[_0x18d867];return _0x343e12;})[_0x971b('0x11')](function(_0x5b486f){var _0x493d0a=_0x319e58[_0x971b('0x10')]?_0x319e58['user']['id']:_0x971b('0x12');var _0x2da014=_0x9bc8b4[_0x971b('0x13')];var _0x3653b5=_0x9bc8b4[_0x971b('0x14')];var _0x52c0ce=new Date(Number(_0x3653b5));return _0x5b486f(_0x493d0a,_0x52c0ce,_0x351db2,_0x2da014);})[_0x971b('0xf')](function(_0x5ac65c){fileLogger(_0x971b('0xb'))[_0x971b('0x15')](_0x5ac65c);});};}function setupLoggers(_0x5585b6){return new Promise(function(_0x596298){var _0xbf3e03=new ClientSideLogger();var _0x39004b=fileLogger(_0x971b('0x16'));var _0x54a019=fileLogger(_0x971b('0x17'));_0x5585b6['set']('client-side-logger',_0xbf3e03);_0x5585b6[_0x971b('0x18')](ewinston[_0x971b('0x19')]({'winstonInstance':_0x39004b,'meta':![],'statusLevels':!![],'msg':function(_0x5212ba,_0x498c14){var _0x45c829=_0x971b('0x1a');if(!_[_0x971b('0x1b')](_0x5212ba[_0x971b('0x1c')])){_0x45c829+=_0x971b('0x1d');var _0x52270e=_0x5212ba[_0x971b('0x1c')];maskSensitiveData(_0x52270e);}return safeTemplate(util['format'](_0x45c829,_0x5212ba['method'],_0x5212ba[_0x971b('0x1e')][_0x971b('0x1f')]?_0x5212ba[_0x971b('0x1e')]['x-forwarded-for']:_0x5212ba[_0x971b('0x20')][_0x971b('0x21')]||_0x5212ba['ip'],_0x5212ba[_0x971b('0x22')],_0x498c14['statusCode'],_0x498c14[_0x971b('0x23')],_0x5212ba[_0x971b('0x10')]?_0x5212ba['user']['id']:null,_0x5212ba['user']?_0x5212ba['user'][_0x971b('0xd')]:null,_0x5212ba[_0x971b('0x10')]?_0x5212ba[_0x971b('0x10')][_0x971b('0xc')]:null,_0x52270e?util[_0x971b('0x24')](_0x52270e,![],null):''));}}));_0x5585b6[_0x971b('0x18')](ewinston[_0x971b('0x19')]({'winstonInstance':_0x54a019,'meta':![],'statusLevels':!![],'msg':function(_0xa04359,_0x35f630){var _0x1d53ff=_0x971b('0x25');if(_0xa04359[_0x971b('0x1c')]&&_0xa04359[_0x971b('0x1c')][_0x971b('0x26')]&&_0xa04359[_0x971b('0x1c')][_0x971b('0x27')]){_0x1d53ff=_0x971b('0x28');}return util[_0x971b('0x29')](_0x1d53ff,_0xa04359['method'],_0xa04359['headers']['x-forwarded-for']?_0xa04359['headers'][_0x971b('0x1f')]:_0xa04359[_0x971b('0x20')]['remoteAddress']||_0xa04359['ip'],_0xa04359[_0x971b('0x22')],_0x35f630['statusCode'],_0x35f630[_0x971b('0x23')],_0xa04359[_0x971b('0x10')]?_0xa04359[_0x971b('0x10')]['id']:null,_0xa04359[_0x971b('0x10')]?_0xa04359['user'][_0x971b('0xd')]:null,_0xa04359['user']?_0xa04359[_0x971b('0x10')][_0x971b('0xc')]:null,_0xa04359[_0x971b('0x1c')]&&_0xa04359['body'][_0x971b('0x26')]?_0xa04359[_0x971b('0x1c')]['device']:_0x971b('0x2a'),_0xa04359[_0x971b('0x1c')]&&_0xa04359[_0x971b('0x1c')][_0x971b('0x27')]?_0xa04359[_0x971b('0x1c')][_0x971b('0x27')]:'',_0xa04359[_0x971b('0x1c')]&&_0xa04359[_0x971b('0x1c')][_0x971b('0x2b')]?_0xa04359[_0x971b('0x1c')][_0x971b('0x2b')]:'');},'ignoreRoute':function(_0x5b5813){var _0x44c3d9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x44c3d9['test'](_0x5b5813[_0x971b('0x22')]);}}));return _0x596298();});}exports[_0x971b('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 82719a2..530884c 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcbb=['timeCompare','ddd','includes','dowCompare','daysInMonth','max','min','domCompare','format','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','map','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','isBefore','day','isBetween'];(function(_0x301c2b,_0x436065){var _0x3353c3=function(_0x54ba30){while(--_0x54ba30){_0x301c2b['push'](_0x301c2b['shift']());}};_0x3353c3(++_0x436065);}(_0xbcbb,0x1b2));var _0xbbcb=function(_0x27e321,_0x222eb5){_0x27e321=_0x27e321-0x0;var _0x19ac6c=_0xbcbb[_0x27e321];return _0x19ac6c;};var _=require(_0xbbcb('0x0'));var moment=require(_0xbbcb('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(_0x2a2986){return _0x2a2986['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xbbcb('0x2');var EINVALID_DATE=_0xbbcb('0x3');function throwIfDateNotValid(_0x14db56){if(!_0x14db56[_0xbbcb('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x45b093){var _0x4b919d=_0x45b093[_0xbbcb('0x5')](':')['map'](function(_0x519522){return parseInt(_0x519522,0xa);});var _0x4ef10d=_0x4b919d[0x0];var _0x3d1e41=_0x4b919d[0x1];if(_0x4ef10d<0x0||_0x4ef10d>0x17||_0x3d1e41<0x0||_0x3d1e41>0x3b){throw new Error(EINVALID_DATE);}return[_0x4ef10d,_0x3d1e41];}function circularDoWInterval(_0x3666c9,_0x4b629a){if(_0x3666c9===_0x4b629a){return[_0x3666c9];}else{var _0x98e9b4=moment['locale']();moment[_0xbbcb('0x6')]('en');var _0x43d334=moment[_0xbbcb('0x7')]()[_0xbbcb('0x8')](function(_0x118729){return _0x118729[_0xbbcb('0x9')]();});moment['locale'](_0x98e9b4);var _0x1cf5d8=_0x43d334['indexOf'](_0x3666c9);var _0x3d7e04=_0x43d334[_0xbbcb('0xa')](_0x4b629a);if(_0x3d7e04>_0x1cf5d8){return _0x43d334[_0xbbcb('0xb')](_0x1cf5d8,_0x3d7e04+0x1);}else{var _0x5beb64=_0x43d334['slice'](0x0,_0x3d7e04+0x1);var _0x4bae39=_0x43d334[_0xbbcb('0xb')](_0x1cf5d8);return _0x4bae39[_0xbbcb('0xc')](_0x5beb64);}}}module[_0xbbcb('0xd')][_0xbbcb('0xe')]=circularDoWInterval;function circularMonthInterval(_0x4b80fa,_0x189f12){if(_0x4b80fa===_0x189f12){return[_0x4b80fa];}else{var _0xcae222=moment[_0xbbcb('0x6')]();moment['locale']('en');var _0x494b35=moment[_0xbbcb('0xf')]()[_0xbbcb('0x8')](function(_0x5d34bf){return _0x5d34bf[_0xbbcb('0x9')]();});moment[_0xbbcb('0x6')](_0xcae222);var _0x34ad18=_0x494b35['indexOf'](_0x4b80fa);var _0x2c66d=_0x494b35[_0xbbcb('0xa')](_0x189f12);if(_0x2c66d>_0x34ad18){return _0x494b35[_0xbbcb('0xb')](_0x34ad18,_0x2c66d+0x1);}else{var _0x31bdbc=_0x494b35[_0xbbcb('0xb')](0x0,_0x2c66d+0x1);var _0x34274f=_0x494b35['slice'](_0x34ad18);return _0x34274f['concat'](_0x31bdbc);}}}module[_0xbbcb('0xd')][_0xbbcb('0x10')]=circularMonthInterval;function parseDom(_0x5e0c38){var _0x107c6b=parseInt(_0x5e0c38,0xa);if(_0x107c6b<0x1||_0x107c6b>0x1f){throw new Error(EINVALID_DATE);}return _0x107c6b;}function timeCompare(_0x40a953,_0x5947ed,_0x1bde19){var _0x432cc7=_0x40a953[_0xbbcb('0x11')]();var _0x3c925d=extractTime(_0x5947ed);var _0x26fd18=_0x3c925d[0x0];var _0x362ce9=_0x3c925d[0x1];var _0x360a6c=_0x40a953[_0xbbcb('0x11')]()['hours'](_0x26fd18)['minutes'](_0x362ce9);throwIfDateNotValid(_0x360a6c);var _0x3ea6e1=extractTime(_0x1bde19);var _0x275275=_0x3ea6e1[0x0];var _0xb905df=_0x3ea6e1[0x1];var _0x193fb5=_0x40a953[_0xbbcb('0x11')]()['hours'](_0x275275)[_0xbbcb('0x12')](_0xb905df);throwIfDateNotValid(_0x193fb5);if(_0x193fb5[_0xbbcb('0x13')](_0x360a6c)){var _0x1ad8fc=_0x432cc7[_0xbbcb('0x11')]()['startOf'](_0xbbcb('0x14'));var _0x2444c5=_0x432cc7[_0xbbcb('0x11')]()['endOf'](_0xbbcb('0x14'));return _0x432cc7[_0xbbcb('0x15')](_0x360a6c,_0x2444c5,undefined,'[]')||_0x432cc7[_0xbbcb('0x15')](_0x1ad8fc,_0x193fb5,undefined,'[]');}else{return _0x432cc7[_0xbbcb('0x15')](_0x360a6c,_0x193fb5,undefined,'[]');}}module[_0xbbcb('0xd')][_0xbbcb('0x16')]=timeCompare;function dowCompare(_0xb94b2e,_0x2a3e9a,_0x1cfeee){var _0x4d5458=_0xb94b2e['locale']('en')['format'](_0xbbcb('0x17'))[_0xbbcb('0x9')]();return circularDoWInterval(_0x2a3e9a,_0x1cfeee)[_0xbbcb('0x18')](_0x4d5458);}module[_0xbbcb('0xd')][_0xbbcb('0x19')]=dowCompare;function domCompare(_0xb6a7a0,_0x1822a5,_0x1c3f0d){var _0x1de31a=_0xb6a7a0['date']();if(_0x1822a5===_0x1c3f0d){return _0x1de31a===_0x1822a5;}else{var _0x2f1136=_0xb6a7a0[_0xbbcb('0x1a')]();var _0x1904c0=_0x1822a5<_0x1c3f0d;let _0x2ff609=![];var _0x2b7289=0x0;var _0x3cbdd1=0x0;if(_0x1904c0){_0x2b7289=Math[_0xbbcb('0x1b')](0x1,_0x1822a5);_0x3cbdd1=Math[_0xbbcb('0x1c')](_0x1c3f0d,_0x2f1136);_0x2ff609=_0x1de31a>=_0x2b7289&&_0x1de31a<=_0x3cbdd1;}else{_0x2b7289=Math[_0xbbcb('0x1c')](_0x1822a5,_0x2f1136);_0x3cbdd1=Math[_0xbbcb('0x1b')](0x1,_0x1c3f0d);_0x2ff609=_0x1de31a>=_0x2b7289||_0x1de31a<=_0x3cbdd1;}return _0x2ff609;}}module[_0xbbcb('0xd')][_0xbbcb('0x1d')]=domCompare;function monthCompare(_0x44a75c,_0xc6243e,_0x5dd3b8){var _0x498b12=_0x44a75c[_0xbbcb('0x6')]('en')[_0xbbcb('0x1e')]('MMM')[_0xbbcb('0x9')]();return circularMonthInterval(_0xc6243e,_0x5dd3b8)[_0xbbcb('0x18')](_0x498b12);}module[_0xbbcb('0xd')][_0xbbcb('0x1f')]=monthCompare;function iftime(_0x12d4f8,_0x44ac49=moment['tz'][_0xbbcb('0x20')](),_0xa59557=moment()){if(!validateRx[_0xbbcb('0x21')](_0x12d4f8)){throw new Error(EINVALID_STRING);}else{var _0x306a73=(moment[_0xbbcb('0x22')](_0xa59557)?_0xa59557['clone']():moment(_0xa59557))['tz'](_0x44ac49)['locale']('en');throwIfDateNotValid(_0x306a73);var _0xbcfe68=_0x12d4f8[_0xbbcb('0x5')](',');var _0x50c1cd=_0xbcfe68[0x0];var _0x552477=_0xbcfe68[0x1];var _0x307bff=_0xbcfe68[0x2];var _0xd8078=_0xbcfe68[0x3];let _0x2a46f6=!![];if(_0x50c1cd!=='*'){var _0x15c87f=_0x50c1cd[_0xbbcb('0x5')]('-');var _0x571c54=_[_0xbbcb('0x23')](_0x15c87f[0x0],0x5,'0');var _0x24a3e6=_0x15c87f['length']===0x2?_['padStart'](_0x15c87f[0x1],0x5,'0'):_0x571c54;_0x2a46f6=timeCompare(_0x306a73,_0x571c54,_0x24a3e6);}let _0x4c09b4=!![];if(_0x552477!=='*'){var _0x35cdd8=_0x552477[_0xbbcb('0x5')]('-');var _0xd19f2a=_0x35cdd8[0x0];var _0x35dd99=_0x35cdd8[_0xbbcb('0x24')]===0x2?_0x35cdd8[0x1]:_0xd19f2a;_0x4c09b4=dowCompare(_0x306a73,_0xd19f2a,_0x35dd99);}let _0x57ddd6=!![];if(_0x307bff!=='*'){var _0x307b5a=_0x307bff[_0xbbcb('0x5')]('-');var _0x327782=parseDom(_0x307b5a[0x0]);var _0x18a2d9=_0x307b5a['length']===0x2?parseDom(_0x307b5a[0x1]):_0x327782;_0x57ddd6=domCompare(_0x306a73,_0x327782,_0x18a2d9);}let _0x3c936f=!![];if(_0xd8078!=='*'){var _0x38fd90=_0xd8078[_0xbbcb('0x5')]('-');var _0x1ab293=_0x38fd90[0x0];var _0x56ae87=_0x38fd90[_0xbbcb('0x24')]===0x2?_0x38fd90[0x1]:_0x38fd90[0x0];_0x3c936f=monthCompare(_0x306a73,_0x1ab293,_0x56ae87);}return _0x2a46f6&&_0x4c09b4&&_0x57ddd6&&_0x3c936f;}}module['exports'][_0xbbcb('0x25')]=iftime; \ No newline at end of file +var _0xe899=['slice','concat','exports','monthsShort','toLowerCase','indexOf','circularMonthInterval','clone','hours','minutes','isBefore','endOf','isBetween','format','ddd','includes','dowCompare','date','max','min','domCompare','MMM','isMoment','padStart','length','iftime','lodash','moment-timezone','map','Date\x20not\x20valid','isValid','split','locale','weekdaysShort'];(function(_0x104648,_0x36d686){var _0x54463d=function(_0x3254a6){while(--_0x3254a6){_0x104648['push'](_0x104648['shift']());}};_0x54463d(++_0x36d686);}(_0xe899,0x12a));var _0x9e89=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0xe899[_0x5a7618];return _0x12dc65;};var _=require(_0x9e89('0x0'));var moment=require(_0x9e89('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9e89('0x2')](function(_0x2eccaf){return _0x2eccaf['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x9e89('0x3');function throwIfDateNotValid(_0x3a0b86){if(!_0x3a0b86[_0x9e89('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5d3d08){var _0xaf47d4=_0x5d3d08[_0x9e89('0x5')](':')[_0x9e89('0x2')](function(_0x57d5ec){return parseInt(_0x57d5ec,0xa);});var _0x4291cf=_0xaf47d4[0x0];var _0xfe0378=_0xaf47d4[0x1];if(_0x4291cf<0x0||_0x4291cf>0x17||_0xfe0378<0x0||_0xfe0378>0x3b){throw new Error(EINVALID_DATE);}return[_0x4291cf,_0xfe0378];}function circularDoWInterval(_0x5cef0,_0x376dee){if(_0x5cef0===_0x376dee){return[_0x5cef0];}else{var _0x760e0=moment[_0x9e89('0x6')]();moment['locale']('en');var _0xcfc163=moment[_0x9e89('0x7')]()[_0x9e89('0x2')](function(_0x1f48d7){return _0x1f48d7['toLowerCase']();});moment[_0x9e89('0x6')](_0x760e0);var _0x40f445=_0xcfc163['indexOf'](_0x5cef0);var _0x20127e=_0xcfc163['indexOf'](_0x376dee);if(_0x20127e>_0x40f445){return _0xcfc163[_0x9e89('0x8')](_0x40f445,_0x20127e+0x1);}else{var _0x273587=_0xcfc163[_0x9e89('0x8')](0x0,_0x20127e+0x1);var _0x1e8e40=_0xcfc163[_0x9e89('0x8')](_0x40f445);return _0x1e8e40[_0x9e89('0x9')](_0x273587);}}}module[_0x9e89('0xa')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x733d61,_0x5330e6){if(_0x733d61===_0x5330e6){return[_0x733d61];}else{var _0x321841=moment['locale']();moment[_0x9e89('0x6')]('en');var _0x4fee54=moment[_0x9e89('0xb')]()['map'](function(_0x561539){return _0x561539[_0x9e89('0xc')]();});moment[_0x9e89('0x6')](_0x321841);var _0x42ca30=_0x4fee54[_0x9e89('0xd')](_0x733d61);var _0xcb1e72=_0x4fee54[_0x9e89('0xd')](_0x5330e6);if(_0xcb1e72>_0x42ca30){return _0x4fee54['slice'](_0x42ca30,_0xcb1e72+0x1);}else{var _0x24332d=_0x4fee54[_0x9e89('0x8')](0x0,_0xcb1e72+0x1);var _0x5cbc0b=_0x4fee54[_0x9e89('0x8')](_0x42ca30);return _0x5cbc0b['concat'](_0x24332d);}}}module[_0x9e89('0xa')][_0x9e89('0xe')]=circularMonthInterval;function parseDom(_0x3f9ea9){var _0x43bafb=parseInt(_0x3f9ea9,0xa);if(_0x43bafb<0x1||_0x43bafb>0x1f){throw new Error(EINVALID_DATE);}return _0x43bafb;}function timeCompare(_0x1e8653,_0x3e918c,_0x3b8112){var _0x2ee19c=_0x1e8653['clone']();var _0x46a34c=extractTime(_0x3e918c);var _0x1810a8=_0x46a34c[0x0];var _0x494930=_0x46a34c[0x1];var _0x27cabc=_0x1e8653[_0x9e89('0xf')]()[_0x9e89('0x10')](_0x1810a8)[_0x9e89('0x11')](_0x494930);throwIfDateNotValid(_0x27cabc);var _0x2eb3f9=extractTime(_0x3b8112);var _0x3eefe6=_0x2eb3f9[0x0];var _0x23cb36=_0x2eb3f9[0x1];var _0x540dec=_0x1e8653[_0x9e89('0xf')]()['hours'](_0x3eefe6)['minutes'](_0x23cb36);throwIfDateNotValid(_0x540dec);if(_0x540dec[_0x9e89('0x12')](_0x27cabc)){var _0x511777=_0x2ee19c[_0x9e89('0xf')]()['startOf']('day');var _0x47c678=_0x2ee19c[_0x9e89('0xf')]()[_0x9e89('0x13')]('day');return _0x2ee19c['isBetween'](_0x27cabc,_0x47c678,undefined,'[]')||_0x2ee19c[_0x9e89('0x14')](_0x511777,_0x540dec,undefined,'[]');}else{return _0x2ee19c[_0x9e89('0x14')](_0x27cabc,_0x540dec,undefined,'[]');}}module[_0x9e89('0xa')]['timeCompare']=timeCompare;function dowCompare(_0x3cee10,_0x42a661,_0x4c1f3b){var _0x3e7c5f=_0x3cee10[_0x9e89('0x6')]('en')[_0x9e89('0x15')](_0x9e89('0x16'))[_0x9e89('0xc')]();return circularDoWInterval(_0x42a661,_0x4c1f3b)[_0x9e89('0x17')](_0x3e7c5f);}module['exports'][_0x9e89('0x18')]=dowCompare;function domCompare(_0x250d02,_0x39b453,_0x1b2d7c){var _0x513bda=_0x250d02[_0x9e89('0x19')]();if(_0x39b453===_0x1b2d7c){return _0x513bda===_0x39b453;}else{var _0x5bde92=_0x250d02['daysInMonth']();var _0x437c4e=_0x39b453<_0x1b2d7c;let _0x317ca5=![];var _0x179378=0x0;var _0x31fdea=0x0;if(_0x437c4e){_0x179378=Math[_0x9e89('0x1a')](0x1,_0x39b453);_0x31fdea=Math[_0x9e89('0x1b')](_0x1b2d7c,_0x5bde92);_0x317ca5=_0x513bda>=_0x179378&&_0x513bda<=_0x31fdea;}else{_0x179378=Math[_0x9e89('0x1b')](_0x39b453,_0x5bde92);_0x31fdea=Math[_0x9e89('0x1a')](0x1,_0x1b2d7c);_0x317ca5=_0x513bda>=_0x179378||_0x513bda<=_0x31fdea;}return _0x317ca5;}}module['exports'][_0x9e89('0x1c')]=domCompare;function monthCompare(_0x515b5a,_0x54d18e,_0x5ee0e8){var _0x3849a2=_0x515b5a[_0x9e89('0x6')]('en')[_0x9e89('0x15')](_0x9e89('0x1d'))[_0x9e89('0xc')]();return circularMonthInterval(_0x54d18e,_0x5ee0e8)[_0x9e89('0x17')](_0x3849a2);}module[_0x9e89('0xa')]['monthCompare']=monthCompare;function iftime(_0x458a12,_0x4a80d2=moment['tz']['guess'](),_0x3e818e=moment()){if(!validateRx['test'](_0x458a12)){throw new Error(EINVALID_STRING);}else{var _0x4d71e1=(moment[_0x9e89('0x1e')](_0x3e818e)?_0x3e818e[_0x9e89('0xf')]():moment(_0x3e818e))['tz'](_0x4a80d2)[_0x9e89('0x6')]('en');throwIfDateNotValid(_0x4d71e1);var _0xd28da3=_0x458a12[_0x9e89('0x5')](',');var _0xa1ce0e=_0xd28da3[0x0];var _0x1e31ab=_0xd28da3[0x1];var _0x4c904a=_0xd28da3[0x2];var _0x2e6820=_0xd28da3[0x3];let _0x27fadd=!![];if(_0xa1ce0e!=='*'){var _0x473917=_0xa1ce0e['split']('-');var _0x4fac5e=_[_0x9e89('0x1f')](_0x473917[0x0],0x5,'0');var _0x46f94e=_0x473917[_0x9e89('0x20')]===0x2?_[_0x9e89('0x1f')](_0x473917[0x1],0x5,'0'):_0x4fac5e;_0x27fadd=timeCompare(_0x4d71e1,_0x4fac5e,_0x46f94e);}let _0x5f44e0=!![];if(_0x1e31ab!=='*'){var _0xdf3f7d=_0x1e31ab['split']('-');var _0x2c375c=_0xdf3f7d[0x0];var _0x5afe30=_0xdf3f7d['length']===0x2?_0xdf3f7d[0x1]:_0x2c375c;_0x5f44e0=dowCompare(_0x4d71e1,_0x2c375c,_0x5afe30);}let _0x6478a=!![];if(_0x4c904a!=='*'){var _0x738316=_0x4c904a[_0x9e89('0x5')]('-');var _0x2dbea3=parseDom(_0x738316[0x0]);var _0x370713=_0x738316[_0x9e89('0x20')]===0x2?parseDom(_0x738316[0x1]):_0x2dbea3;_0x6478a=domCompare(_0x4d71e1,_0x2dbea3,_0x370713);}let _0x22d78e=!![];if(_0x2e6820!=='*'){var _0x262fac=_0x2e6820[_0x9e89('0x5')]('-');var _0x3e5167=_0x262fac[0x0];var _0xdd7f03=_0x262fac[_0x9e89('0x20')]===0x2?_0x262fac[0x1]:_0x262fac[0x0];_0x22d78e=monthCompare(_0x4d71e1,_0x3e5167,_0xdd7f03);}return _0x27fadd&&_0x5f44e0&&_0x6478a&&_0x22d78e;}}module[_0x9e89('0xa')][_0x9e89('0x21')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 07c2edf..5ed61c8 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb27=['util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','path'];(function(_0x4ff2e4,_0x3b1489){var _0x69c350=function(_0x4de9d3){while(--_0x4de9d3){_0x4ff2e4['push'](_0x4ff2e4['shift']());}};_0x69c350(++_0x3b1489);}(_0xcb27,0x18f));var _0x7cb2=function(_0x43d785,_0x1dbc6a){_0x43d785=_0x43d785-0x0;var _0x517c77=_0xcb27[_0x43d785];return _0x517c77;};'use strict';var path=require(_0x7cb2('0x0'));var util=require(_0x7cb2('0x1'));var moment=require(_0x7cb2('0x2'));var winston=require(_0x7cb2('0x3'));var config=require('../config/environment');var debugLevel=config[_0x7cb2('0x4')]?config[_0x7cb2('0x4')][_0x7cb2('0x5')]():_0x7cb2('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x7cb2('0x7'),'error':'red','warn':_0x7cb2('0x8'),'info':_0x7cb2('0x9'),'print':_0x7cb2('0xa'),'success':_0x7cb2('0xb'),'http':_0x7cb2('0xc'),'verbose':_0x7cb2('0xd'),'debug':_0x7cb2('0xe'),'silly':_0x7cb2('0xf')};winston[_0x7cb2('0x10')](XC_LOG_COLORS);function getLogFileName(_0x173979,_0x221713,_0x43f67b){var _0xf374=_0x173979||_0x7cb2('0x11');return path[_0x7cb2('0x12')](_0xf374,util[_0x7cb2('0x13')]('%s-%s.log',_0x221713,_0x43f67b));}function formatter(_0x488930,_0x41ffd6){_0x41ffd6['message']=_0x41ffd6[_0x7cb2('0x14')][_0x7cb2('0x15')](/@@{/g,_0x7cb2('0x16'))[_0x7cb2('0x15')](/}@@/g,_0x7cb2('0x17'))[_0x7cb2('0x15')](/@{/g,'{{')[_0x7cb2('0x15')](/}@/g,'}}');return util['format'](_0x7cb2('0x18'),moment()[_0x7cb2('0x13')](_0x7cb2('0x19')),_0x41ffd6[_0x7cb2('0x1a')][_0x7cb2('0x1b')](),_0x488930,_0x41ffd6[_0x7cb2('0x14')]);}function fileFormat(_0x15832a,_0x292177){_0x292177[_0x7cb2('0x14')]=_0x292177[_0x7cb2('0x14')][_0x7cb2('0x15')](/@@{/g,_0x7cb2('0x16'))['replace'](/}@@/g,_0x7cb2('0x17'))['replace'](/@{/g,'{{')[_0x7cb2('0x15')](/}@/g,'}}');var _0x539280=_0x292177[_0x7cb2('0x1c')]&&Object[_0x7cb2('0x1d')](_0x292177[_0x7cb2('0x1c')])[_0x7cb2('0x1e')]?'\x0a\x09'+JSON['stringify'](_0x292177[_0x7cb2('0x1c')]):'';return util['format'](_0x7cb2('0x1f'),moment()['format'](_0x7cb2('0x19')),_0x292177['level']['toUpperCase'](),_0x15832a,_0x292177[_0x7cb2('0x14')],_0x539280);}function consoleLogger(){var _0x593829=new winston[(_0x7cb2('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7cb2('0x21'))][(_0x7cb2('0x22'))]({'level':_0x7cb2('0x23'),'json':![],'formatter':function(_0xffb49){return formatter('',_0xffb49);}})]});return _0x593829;}function fileLogger(_0x1bdbd3,_0xbe9a94){var _0xf3548=new winston[(_0x7cb2('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7cb2('0x21'))][(_0x7cb2('0x24'))]({'name':util[_0x7cb2('0x13')]('%s-%s',_0x1bdbd3,'error'),'filename':getLogFileName(_0xbe9a94,_0x1bdbd3,_0x7cb2('0x25')),'level':_0x7cb2('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x30025b){return fileFormat(_0x1bdbd3,_0x30025b);}}),new winston[(_0x7cb2('0x21'))][(_0x7cb2('0x24'))]({'name':util['format'](_0x7cb2('0x26'),_0x1bdbd3,debugLevel),'filename':getLogFileName(_0xbe9a94,_0x1bdbd3,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x572d4e){return fileFormat(_0x1bdbd3,_0x572d4e);}}),new winston[(_0x7cb2('0x21'))][(_0x7cb2('0x22'))]({'level':_0x7cb2('0x23'),'json':![],'formatter':function(_0x169e0a){return fileFormat(_0x1bdbd3,_0x169e0a);}})]});return _0xf3548;}exports[_0x7cb2('0x27')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x87a7=['join','format','%s-%s.log','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','stringify','Console','Logger','transports','File','%s-%s','error','fileLogger','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally'];(function(_0x24541f,_0x3c88bd){var _0x459bcd=function(_0x934830){while(--_0x934830){_0x24541f['push'](_0x24541f['shift']());}};_0x459bcd(++_0x3c88bd);}(_0x87a7,0x1c4));var _0x787a=function(_0x2a01f6,_0xf6d2fb){_0x2a01f6=_0x2a01f6-0x0;var _0x1c28a5=_0x87a7[_0x2a01f6];return _0x1c28a5;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x787a('0x0'));var winston=require('winston');var config=require(_0x787a('0x1'));var debugLevel=config[_0x787a('0x2')]?config[_0x787a('0x2')][_0x787a('0x3')]():_0x787a('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x787a('0x5'),'error':_0x787a('0x6'),'warn':_0x787a('0x7'),'info':_0x787a('0x8'),'print':'bold\x20white','success':_0x787a('0x9'),'http':_0x787a('0xa'),'verbose':_0x787a('0xb'),'debug':_0x787a('0xc'),'silly':_0x787a('0xd')};winston[_0x787a('0xe')](XC_LOG_COLORS);function getLogFileName(_0x105f9d,_0x1ce208,_0x5dbb24){var _0x16bc2f=_0x105f9d||_0x787a('0xf');return path[_0x787a('0x10')](_0x16bc2f,util[_0x787a('0x11')](_0x787a('0x12'),_0x1ce208,_0x5dbb24));}function formatter(_0x431cd7,_0x3c6103){_0x3c6103[_0x787a('0x13')]=_0x3c6103[_0x787a('0x13')]['replace'](/@@{/g,'{{{')[_0x787a('0x14')](/}@@/g,_0x787a('0x15'))[_0x787a('0x14')](/@{/g,'{{')[_0x787a('0x14')](/}@/g,'}}');return util[_0x787a('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x787a('0x11')](_0x787a('0x16')),_0x3c6103[_0x787a('0x17')][_0x787a('0x18')](),_0x431cd7,_0x3c6103[_0x787a('0x13')]);}function fileFormat(_0x16b718,_0x2e8de3){_0x2e8de3[_0x787a('0x13')]=_0x2e8de3[_0x787a('0x13')]['replace'](/@@{/g,_0x787a('0x19'))[_0x787a('0x14')](/}@@/g,_0x787a('0x15'))[_0x787a('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1dc3ab=_0x2e8de3[_0x787a('0x1a')]&&Object[_0x787a('0x1b')](_0x2e8de3[_0x787a('0x1a')])['length']?'\x0a\x09'+JSON[_0x787a('0x1c')](_0x2e8de3[_0x787a('0x1a')]):'';return util[_0x787a('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x787a('0x11')](_0x787a('0x16')),_0x2e8de3['level'][_0x787a('0x18')](),_0x16b718,_0x2e8de3[_0x787a('0x13')],_0x1dc3ab);}function consoleLogger(){var _0x7ca81a=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x787a('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x1e5f5c){return formatter('',_0x1e5f5c);}})]});return _0x7ca81a;}function fileLogger(_0x36b834,_0xc933a1){var _0x39deee=new winston[(_0x787a('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x787a('0x1f'))][(_0x787a('0x20'))]({'name':util[_0x787a('0x11')](_0x787a('0x21'),_0x36b834,'error'),'filename':getLogFileName(_0xc933a1,_0x36b834,_0x787a('0x22')),'level':_0x787a('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x524076){return fileFormat(_0x36b834,_0x524076);}}),new winston[(_0x787a('0x1f'))]['File']({'name':util[_0x787a('0x11')](_0x787a('0x21'),_0x36b834,debugLevel),'filename':getLogFileName(_0xc933a1,_0x36b834,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5e823e){return fileFormat(_0x36b834,_0x5e823e);}}),new winston[(_0x787a('0x1f'))][(_0x787a('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x3678bc){return fileFormat(_0x36b834,_0x3678bc);}})]});return _0x39deee;}exports['consoleLogger']=consoleLogger;exports[_0x787a('0x23')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 62d16d4..67ae8b0 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 _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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x57ca,0x108));var _0xa57c=function(_0x42f579,_0x1b4844){_0x42f579=_0x42f579-0x0;var _0x508d11=_0x57ca[_0x42f579];return _0x508d11;};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 +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdb28,0x106));var _0x8db2=function(_0x174714,_0x1c5cb7){_0x174714=_0x174714-0x0;var _0x54e189=_0xdb28[_0x174714];return _0x54e189;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index fbf576b..80cf771 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['replace','\x5c$&','exports'];(function(_0xccf48b,_0x3ba8dc){var _0x371f9a=function(_0x4f4761){while(--_0x4f4761){_0xccf48b['push'](_0xccf48b['shift']());}};_0x371f9a(++_0x3ba8dc);}(_0x4975,0x86));var _0x5497=function(_0xabbfc9,_0x50e21a){_0xabbfc9=_0xabbfc9-0x0;var _0x1e56e5=_0x4975[_0xabbfc9];return _0x1e56e5;};module[_0x5497('0x0')]={'escapeRegExp'(_0x4db539,_0x474989=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4db539[_0x5497('0x1')](_0x474989,_0x5497('0x2'));}}; \ No newline at end of file +var _0x5fab=['exports','replace','\x5c$&'];(function(_0x1be790,_0x112549){var _0x7668c8=function(_0x47a470){while(--_0x47a470){_0x1be790['push'](_0x1be790['shift']());}};_0x7668c8(++_0x112549);}(_0x5fab,0x177));var _0xb5fa=function(_0x4e6eac,_0x3f4365){_0x4e6eac=_0x4e6eac-0x0;var _0x79f963=_0x5fab[_0x4e6eac];return _0x79f963;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index dda95de..ae3b52c 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 _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5b87ce,_0x20b7f6){_0x5b87ce=_0x5b87ce-0x0;var _0x597aa7=_0xf4f4[_0x5b87ce];return _0x597aa7;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file +var _0x4213=['{\x20{\x20','\x20}\x20}','string','isArray','isPlainObject','keys','reduce','exports','safeTemplate','lodash'];(function(_0x4b4344,_0x5712b9){var _0xa45d77=function(_0x2da403){while(--_0x2da403){_0x4b4344['push'](_0x4b4344['shift']());}};_0xa45d77(++_0x5712b9);}(_0x4213,0x77));var _0x3421=function(_0x2221be,_0x2d5377){_0x2221be=_0x2221be-0x0;var _0x2a8fd9=_0x4213[_0x2221be];return _0x2a8fd9;};var _=require(_0x3421('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x445ef6){return _0x445ef6==='{{'?_0x3421('0x1'):_0x3421('0x2');}function safeTemplate(_0x2613b6){var _0x153f3a=_0x2613b6;if(typeof _0x2613b6===_0x3421('0x3')){_0x153f3a=_0x2613b6['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3421('0x4')](_0x2613b6)){_0x153f3a=_0x2613b6['map'](function(_0x459c5e){return safeTemplate(_0x459c5e);});}else if(_[_0x3421('0x5')](_0x2613b6)){_0x153f3a=Object[_0x3421('0x6')](_0x2613b6)[_0x3421('0x7')](function(_0x5469d8,_0x50e464){_0x5469d8[_0x50e464]=safeTemplate(_0x2613b6[_0x50e464]);return _0x5469d8;},{});}return _0x153f3a;}module[_0x3421('0x8')][_0x3421('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 2f9dfeb..edd60d1 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 _0x46e5=['Updating\x20app.json','exports','fs-extra','path','../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','name','env','string','NODE_PATH','updated','info'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x46e5,0xd2));var _0x546e=function(_0x4dbad6,_0x4ce533){_0x4dbad6=_0x4dbad6-0x0;var _0x56c1d1=_0x46e5[_0x4dbad6];return _0x56c1d1;};var fs=require(_0x546e('0x0'));var path=require(_0x546e('0x1'));var config=require(_0x546e('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x546e('0x3')](root,_0x546e('0x4'));var NODEPATH=path[_0x546e('0x3')](root,_0x546e('0x5'));function setLegacyLibsNodeEnvPath(_0x4af8a4){let _0x338ea4=![];if(Array[_0x546e('0x6')](_0x4af8a4[_0x546e('0x7')])){var _0xad2acf=_0x4af8a4['apps']['findIndex'](function(_0x398288){return _0x398288[_0x546e('0x8')]==='motion2';});if(_0xad2acf>-0x1){var _0x1ec4eb=_0x4af8a4[_0x546e('0x7')][_0xad2acf];if(typeof _0x1ec4eb[_0x546e('0x9')]['NODE_PATH']!==_0x546e('0xa')){_0x1ec4eb['env'][_0x546e('0xb')]=NODEPATH;_0x338ea4=!![];}}return{'appConfig':_0x4af8a4,'updated':_0x338ea4};}}function updateAppConfig(_0x30bfca){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x3015e4){if(_0x3015e4){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x1881b0){var _0x92b0b6=setLegacyLibsNodeEnvPath(_0x1881b0);if(_0x92b0b6[_0x546e('0xc')]){_0x30bfca[_0x546e('0xd')](_0x546e('0xe'));return fs['writeJSON'](APP_JSON_PATH,_0x1881b0,{'spaces':0x2});}else{return Promise[_0x546e('0x3')]();}});}else{return Promise['resolve']();}});}module[_0x546e('0xf')]=updateAppConfig; \ No newline at end of file +var _0x5071=['pathExists','then','readJSON','updated','info','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','apps','findIndex','name','motion2','env','NODE_PATH','string'];(function(_0xf67f45,_0x36e087){var _0xd9ab5=function(_0x594070){while(--_0x594070){_0xf67f45['push'](_0xf67f45['shift']());}};_0xd9ab5(++_0x36e087);}(_0x5071,0x16f));var _0x1507=function(_0x4e87ba,_0x2d95f9){_0x4e87ba=_0x4e87ba-0x0;var _0x212b08=_0x5071[_0x4e87ba];return _0x212b08;};var fs=require(_0x1507('0x0'));var path=require(_0x1507('0x1'));var config=require(_0x1507('0x2'));var root=config[_0x1507('0x3')];var APP_JSON_PATH=path[_0x1507('0x4')](root,_0x1507('0x5'));var NODEPATH=path[_0x1507('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x754a10){let _0x8816f9=![];if(Array['isArray'](_0x754a10[_0x1507('0x6')])){var _0xace4c7=_0x754a10[_0x1507('0x6')][_0x1507('0x7')](function(_0x4aa16b){return _0x4aa16b[_0x1507('0x8')]===_0x1507('0x9');});if(_0xace4c7>-0x1){var _0x46e1c5=_0x754a10[_0x1507('0x6')][_0xace4c7];if(typeof _0x46e1c5[_0x1507('0xa')][_0x1507('0xb')]!==_0x1507('0xc')){_0x46e1c5[_0x1507('0xa')][_0x1507('0xb')]=NODEPATH;_0x8816f9=!![];}}return{'appConfig':_0x754a10,'updated':_0x8816f9};}}function updateAppConfig(_0x57be5b){return fs[_0x1507('0xd')](APP_JSON_PATH)[_0x1507('0xe')](function(_0x36b408){if(_0x36b408){return fs[_0x1507('0xf')](APP_JSON_PATH)['then'](function(_0x2cf15f){var _0x3442d1=setLegacyLibsNodeEnvPath(_0x2cf15f);if(_0x3442d1[_0x1507('0x10')]){_0x57be5b[_0x1507('0x11')]('Updating\x20app.json');return fs[_0x1507('0x12')](APP_JSON_PATH,_0x2cf15f,{'spaces':0x2});}else{return Promise[_0x1507('0x4')]();}});}else{return Promise[_0x1507('0x4')]();}});}module[_0x1507('0x13')]=updateAppConfig; \ No newline at end of file